diff --git a/contrib/binutils/ChangeLog b/contrib/binutils/ChangeLog index f054da6c1aa..1d6afc2e0f1 100644 --- a/contrib/binutils/ChangeLog +++ b/contrib/binutils/ChangeLog @@ -1,40 +1,1802 @@ -2004-05-06 Daniel Jacobowitz +2006-05-17 Daniel Jacobowitz - * src-release (do-tar): Add directories to the tar file. + * src-release (MAKEINFOFLAGS): Define. + (do-proto-toplev): Pass MAKEINFOFLAGS to submakes. -2004-05-06 Daniel Jacobowitz +2006-04-10 Ben Elliston - Merge from mainline: - 2004-04-15 James E Wilson - * Makefile.tpl (configure-[+module+], configure-gcc, - configure-stage1-gcc, configure-stage2-gcc, configure-stage3-gcc): - Set and export LDFLAGS. + * contrib: Remove directory. + +2006-04-06 Carlos O'Donell + + * Makefile.tpl: Add install-html target. + * Makefile.def: Add install-html target. * Makefile.in: Regenerate. + * configure.in: Add --with-datarootdir, --with-docdir, + and --with-htmldir options. + * configure: Regenerate. + +2006-03-31 Ben Elliston + + PR binutils/1860 + * configure.in: Require makeinfo 4.4 or higher. + * configure: Regenerate. + +2006-03-14 Paolo Bonzini + + * Makefile.in: Regenerate. + +2006-03-14 Paolo Bonzini + + Sync with gcc: + 2006-03-10 Aldy Hernandez + + * configure.in: Handle --disable- generically. + * configure: Regenerate. + + 2006-02-21 Rafael Avila de Espindola + + * Makefile.tpl (BUILD_CONFIGDIRS): Remove. + (TARGET_CONFIGDIRS): Remove. + * configure.in: Remove AC_SUBST(target_configdirs). + * Makefile.in, configure: Regenerated. + + +2006-03-01 H.J. Lu + + PR libgcj/17311 + * ltmain.sh: Don't use "$finalize_rpath" for compile. + +2006-02-20 Paolo Bonzini + + PR bootstrap/25670 + + * Makefile.tpl ([+compare-target+]): Print explanation messages. + + * Makefile.def (ADAFLAGS, BOOT_ADAFLAGS, LANGUAGES): New flags_to_pass. + * Makefile.tpl (BASE_FLAGS_TO_PASS): Support optional flags_to_pass. + (EXTRA_GCC_FLAGS): Remove ADAFLAGS, BOOT_ADAFLAGS, LANGUAGES, + BUILD_PREFIX, BUILD_PREFIX_1. + * configure.in: (BUILD_PREFIX, BUILD_PREFIX_1): Don't substitute. + + * Makefile.def (bootstrap stage 1): Pass LIBCFLAGS too. + * Makefile.tpl (POSTSTAGE1_FLAGS_TO_PASS): Override LIBCFLAGS too. + + * Makefile.tpl (configure-stage[+id+]-[+prefix+][+module+], + all-stage[+id+]-[+prefix+][+module+], : Use $(current_stage) instead + of `cat stage_current`. Always provide the `r' and `s' variables. + (clean-stage[+id+]-[+prefix+][+module+]): Likewise, and make it into + a single shell execution. + (configure-[+prefix+][+module+], all-[+prefix+][+module+]): For + bootstrapped modules, make the stage1 module if the build was not + started yet, else build the current stage. + (all-host, all-target): Omit bootstrapped modules (if bootstrapping). + (all-build, all-host, all-target, [+make_target+]-host, + [+make_target+]-target): Do not use \-continued lines. + (target modules): Depend on stage_last, not all-gcc, if bootstrapping. + (current_stage, restrap, stage_last): New. + + * Makefile.in: Regenerate. + * configure: Regenerate. + +2006-02-14 Paolo Bonzini + + Sync from gcc: + + 2006-01-31 Richard Guenther + Paolo Bonzini + + * Makefile.def (target_modules): Add libgcc-math target module. + * configure.in (target_libraries): Add libgcc-math target library. + (--enable-libgcc-math): New configure switch. + * Makefile.in: Re-generate. + * configure: Re-generate. + * libgcc-math: New toplevel directory. + + 2006-01-18 Richard Henderson + Jakub Jelinek + Diego Novillo + + * libgomp: New directory. + * Makefile.def: Add target_module libgomp. + * Makefile.in: Regenerate. + * configure.in (target_libraries): Add target-libgomp. + * configure: Regenerate. + +2006-02-14 Paolo Bonzini + Andreas Schwab + + * configure: Regenerate. + +2006-01-16 Paolo Bonzini + + * configure.in: Set with_gnu_as, with_gnu_ld, with_newlib earlier. + Set md_exec_prefix. Use ACX_CHECK_INSTALLED_TARGET_TOOL to find + the assembler, linker and binutils. + * configure: Regenerate. + +2006-01-16 Nick Clifton + + * config.sub, config.guess: Sync from config repository. + +2006-01-05 Alexandre Oliva + + * Makefile.tpl (clean-stage[+id+]-[+prefix+][+module+]): Remove + @ from continuation. + * Makefile.in: Rebuilt. + +2006-01-04 Paolo Bonzini + + Sync from gcc: + + 2006-01-04 Paolo Bonzini + + PR bootstrap/24252 + + * Makefile.def (flags_to_pass): Add STAGE1_CFLAGS and STAGE1_LANGUAGES. + * Makefile.tpl (OBJDUMP): New. + (EXTRA_HOST_FLAGS): Add it. + (EXTRA_GCC_FLAGS): Remove flags already specified in flags_to_pass. + + * Makefile.tpl (stage[+id+]-start, stage[+id+]-end): Do not try + to use symbolic links between directories. Avoid race conditions + or make them harmless. + * configure.in: Do not try to use symbolic links between directories. + + * Makefile.def (LEAN): Pass. + * Makefile.tpl (LEAN): Define. + (stage[+id+]-start): Accept that the previous directory does not + exist, if the bootstrap is lean. + (stage[+id+]-bubble): Invoke lean bootstrap commands after + stage[+id+]-start. Use a makefile variable and an `if' instead of a + configure substitution. + ([+compare-target+]): Likewise. + ([+bootstrap-target+]-lean): New. + * configure.in: Remove lean bootstrap support from here. + + * Makefile.in: Regenerate. + * configure: Regenerate. + + 2006-01-02 Andreas Schwab + + * configure.in: When reconfiguring remove Makefile in + all stage directories. + * configure: Regenerate. + +2005-12-27 Leif Ekblad + + * configure.in: Add support for RDOS target. + * configure: Regenerate. + +2005-12-27 Nick Clifton + + PR binutils/1990 + * libtool.m4: Synchronize with version in GCC sources. + +2005-12-20 Paolo Bonzini + + Revert Ada-related part of the previous change. + + * Makefile.def (ADAFLAGS, BOOT_ADAFLAGS, ADAFLAGS_FOR_TARGET): + Do not pass. + * Makefile.tpl (BOOT_ADAFLAGS): Do not define. + * Makefile.in: Regenerate. + * configure.in: Do not include mt-ppc-aix target fragment. + * configure: Regenerate. + +2005-12-19 Paolo Bonzini + + * configure.in: Select appropriate fragments for PowerPC/AIX. + * configure: Regenerate. + + * Makefile.def (flags_to_pass): Add ADAFLAGS, BOOT_ADAFLAGS, + BOOT_CFLAGS, BOOT_LDFLAGS. + * Makefile.tpl (POSTSTAGE1_FLAGS_TO_PASS): Handle BOOT_ADAFLAGS, + BOOT_CFLAGS, BOOT_LDFLAGS. + (TARGET_FLAGS_TO_PASS): Handle ADAFLAGS_FOR_TARGET. + (stage[+id+]-bubble): Pass flags recursively to the comparison target. + (stage): Fail if we cannot complete the work. + * Makefile.in: Regenerate. + +2005-12-16 Jeff Johnston + + * COPYING.NEWLIB: Update copyright year for default + copyright. + +2005-12-15 Paolo Bonzini + + * Makefile.tpl (all, do-[+make_target+], do-check, install, + install-host-nogcc): Don't invoke $(stage) at the end. + * Makefile.in: Regenerate. + +2005-12-14 Paolo Bonzini + + * configure.in: Flip the top-level bootstrap switch. + * configure: Regenerate. + + Merge from gcc: + + 2005-12-14 Daniel Jacobowitz + + * Makefile.tpl: Throughout the file, use : $(MAKE) along with + $(stage) and $(unstage). + (EXTRA_TARGET_FLAGS): Correct double-quoting. + (all): Remove stray semicolon. + (local-distclean): Don't handle multilib.tmp and multilib.out. + (install.all): Set $s for consistency. + (configure-[+prefix+][+module+]): Instead of [+deps+], handle + check_multilibs setting. Always make the install directory. + (configure-stage[+id+]-[+prefix+][+module+]): Likewise. + Correct @if/@endif. + (all-stage[+id+]-[+prefix+][+module+]): Correct @if/@endif. + ($(TARGET_SUBDIR)/[+module+]/multilib.out): Remove. + (stage[+id+]-start, stage[+id+]-end): Stage $(TARGET_SUBDIR). + (multilib.out): Remove. + * Makefile.in: Regenerated. + +2005-12-12 Nathan Sidwell + + * config.sub: Replace ms1 arch with mt. Allow ms1 as alias. + * configure.in: Replace ms1 arch with mt. + * configure: Rebuilt. + +2005-12-05 Paolo Bonzini + + Sync with gcc: + +2005-12-12 Nathan Sidwell + + * config.sub: Replace ms1 arch with mt. Allow ms1 as alias. + * configure.in: Replace ms1 arch with mt. + * configure: Rebuilt. + +2005-12-05 Paolo Bonzini + + Sync with gcc: + + 2005-12-05 Paolo Bonzini + + * configure.in (CONFIGURED_BISON, CONFIGURED_YACC, CONFIGURED_M4, + CONFIGURED_FLEX, CONFIGURED_LEX, CONFIGURED_MAKEINFO): Remove + "CONFIGURED_" from the AC_CHECK_PROGS invocation. Move below. + Find in-tree tools if available. + (EXPECT, RUNTEST, LIPO, STRIP): Find them and substitute them. + (CONFIGURED_*_FOR_TARGET): Don't set nor substitute. + (*_FOR_TARGET): Set them with GCC_TARGET_TOOL. + (COMPILER_*_FOR_TARGET): New. + * Makefile.tpl (HOST_EXPORTS): Add *_FOR_TARGET symbols that gcc needs. + (BASE_TARGET_EXPORTS): Use COMPILER_*_FOR_TARGET symbols. + (CONFIGURED_*, USUAL_*): Remove. + (BISON, YACC, FLEX, LEX, M4, MAKEINFO, EXPECT, RUNTEST, LIPO, + STRIP): Use autoconf substitutions. + (COMPILER_AS_FOR_TARGET, COMPILER_LD_FOR_TARGET, + COMPILER_NM_FOR_TARGET): New. + (EXTRA_HOST_FLAGS): Pass LIPO and STRIP. + + (all): Make all-host and all-target in parallel. + (do-[+make_target+], do-check, install, [+compare-target+]): Ensure + that $$r and $$s are set before invoking a recursive make. + (stage[+id+]-bubble): Likewise, and invoke the comparison at the end. + ([+bootstrap-target+]): Inline most of the `all' target. + + 2005-11-29 Ben Elliston + + * Makefile.tpl (clean-target-libgcc): Invoke clean-target-libgcc + from the gcc build directory. + * Makefile.in: Regenerate. + + 2005-11-29 Ben Elliston + + * Makefile.def: Add new libdecnumber host_module. Make all-gcc + depend on all-libdecnumber. + * configure.in (host_libs): Include libdecnumber. + * Makefile.in: Regenerate. + * configure: Likewise. + + 2005-11-21 Kean Johnston + + * config.sub, config.guess: Sync from upstream sources. + +2005-11-11 Daniel Jacobowitz + + * Makefile.def: Remove gdb dependencies for gdbtk. + * Makefile.tpl (CONFIGURE_GDB_TK, INSTALL_GDB_TK): New variables. + (configure-gdb, install-gdb): New rules. + * configure.in: Set CONFIGURE_GDB_TK and INSTALL_GDB_TK. + * Makefile.in, configure: Regenerated. + +2005-10-22 Paolo Bonzini + + PR bootstrap/24297 + * Makefile.tpl (do-[+make-target+], do-check, install, + stage[+id+]-bubble, [+compare-target+]): Ensure $$r and $$s + are set before recursing. + * Makefile.in: Regenerate. + +2005-10-20 Eric Botcazou + + PR bootstrap/18939 + * Makefile.def (gcc) : Fix thinko. + * Makefile.in: Regenerate. + +2005-10-17 Bernd Schmidt + + * configure.in (bfin-*-*): Use test, not brackets, in if statement. + * configure: Regenerate. + +2005-10-09 Kazu Hirata + + * configure.in (arm-*-linux-gnueabi): Add to noconfigdirs + target-libffi, target-qthreads, target-libjava, and + targetlibobjc. + * configure: Regenerate. + +2005-10-06 Daniel Jacobowitz + + * Makefile.def (flags_to_pass): Add OBJDUMP_FOR_TARGET. + * Makefile.tpl (BASE_TARGET_EXPORTS): Add OBJDUMP. + (OBJDUMP_FOR_TARGET, CONFIGURED_OBJDUMP_FOR_TARGET) + (USUAL_OBJDUMP_FOR_TARGET): New. + (EXTRA_TARGET_FLAGS): Add OBJDUMP. + * configure.in: Check for $OBJDUMP_FOR_TARGET. + * configure, Makefile.in: Regenerated. + +2005-10-05 Paolo Bonzini + + * Makefile.tpl (all) [gcc-no-bootstrap]: Make prebootstrap packages + before other host packages. + +2005-10-05 Paolo Bonzini + + PR bootstrap/22340 + + * configure.in (default_target): Remove. + * Makefile.tpl (all): Do not use prerequisites as subroutines + (all) [gcc-bootstrap]: Bootstrap gcc first if it was not done yet. + (do-[+make_target+], check, install, [+bootstrap_target+]): Do not + use prerequisites as subroutines. + (check-host, check-target): New. + (bootstrap configure & all targets): Do not use stage*-start + if the directory layout is already ok. + (non-bootstrap configure & all targets): Prepend a $(unstage). + (stage[+id+]-bubble): Do that here. Do not use NOTPARALLEL. + (NOTPARALLEL): Remove. + (unstage, stage variables): New variables. + (unstage, stage targets): Simply expand to those variables. + + * configure: Regenerate. + * Makefile.in: Regenerate. + +2005-10-04 James E Wilson + + * Makefile.def (lang_env_dependencies): Add libmudflap. + * Makefile.in: Regenerate. + +2005-10-03 Catherine Moore + + * configure.in (bfin-*-*): Support bfin. + * configure: Regenerated. + +2005-09-30 H.J. Lu + + * configure.in (*-*-darwin*): Build bfd, binutils and opcodes. + * configure: Regenerated. + +2005-09-28 Geoffrey Keating + + * Makefile.tpl (BASE_TARGET_EXPORTS): Add LIPO, STRIP. + (LIPO_FOR_TARGET): New. + (CONFIGURED_LIPO_FOR_TARGET): New. + (USUAL_LIPO_FOR_TARGET): New. + (STRIP_FOR_TARGET): New. + (CONFIGURED_STRIP_FOR_TARGET): New. + (USUAL_STRIP_FOR_TARGET): New. + * Makefile.def (flags_to_pass): Add LIPO_FOR_TARGET and + STRIP_FOR_TARGET. + * configure.in: Set LIPO_FOR_TARGET, STRIP_FOR_TARGET, + CONFIGURED_LIPO_FOR_TARGET, CONFIGURED_STRIP_FOR_TARGET. + * Makefile.in: Regenerate. + * configure: Regenerate. + +2005-09-19 David Edelsohn + + * configure.in (powerpc-*-aix*): Add target-libssp to noconfigdirs. + (rs6000-*-aix*): Same. + * configure: Regenerate. + +2005-09-14 Francois-Xavier Coudert + + * configure.in: Recognize f95 in the --enable-languages option, + and substitute it for fortran, issuing a warning. + * configure: Regenerate. + +2005-09-07 Ben Elliston + + Import from Autoconf sources: + + 2005-09-06 Paul Eggert + * move-if-change: Don't output "$2 is unchanged"; suggested by Ben + Elliston. Handle weird characters correctly. + +2005-08-30 Phil Edwards + + * configure.in (*-*-vxworks*): Add target-libstdc++-v3 to noconfigdirs. + * configure: Regenerated. + +2005-08-20 Richard Earnshaw + + * Makefile.def (libssp): Add to lang_env_dependencies. + * Makefile.in: Regenerate. + +2005-08-17 Christian Groessler + + * Makefile.tpl: (USUAL_CC_FOR_TARGET): Add missing trailing slash. + * Makefile.in: Regenerate. + +2005-08-12 Paolo Bonzini + + * configure.in: Replace NCN_STRICT_CHECK_TOOL with + NCN_STRICT_CHECK_TOOLS, and likewise for NCN_STRICT_CHECK_TARGET_TOOLS. + Look for alternate names of the target cc and c++ + * configure: Regenerate. + +2005-08-08 Paolo Bonzini + + * configure.in (CC_FOR_TARGET, CXX_FOR_TARGET, GCJ_FOR_TARGET, + GCC_FOR_TARGET, RAW_CXX_FOR_TARGET, GFORTRAN_FOR_TARGET): Find + them with NCN_STRICT_CHECK_TARGET_TOOL, like the other target + tools; remove code to manually set them. + (Target tools): Look in the environment for them. + * Makefile.tpl (CC_FOR_TARGET, CXX_FOR_TARGET, GCJ_FOR_TARGET, + GCC_FOR_TARGET, RAW_CXX_FOR_TARGET, GFORTRAN_FOR_TARGET): Redefine. + (AS_FOR_TARGET, LD_FOR_TARGET, NM_FOR_TARGET): Look into gcc + build directory. + (CONFIGURED_CC_FOR_TARGET, CONFIGURED_CXX_FOR_TARGET, + CONFIGURED_GCJ_FOR_TARGET, CONFIGURED_GCC_FOR_TARGET, + CONFIGURED_GFORTRAN_FOR_TARGET, USUAL_CC_FOR_TARGET, + USUAL_CXX_FOR_TARGET, USUAL_GCJ_FOR_TARGET, USUAL_GCC_FOR_TARGET, + USUAL_RAW_CXX_FOR_TARGET, USUAL_GFORTRAN_FOR_TARGET): New. + (CXX_FOR_TARGET_FOR_RECURSIVE_MAKE, + RAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE, RECURSE_FLAGS): Delete. + * configure: Regenerate. + * Makefile.in: Regenerate. + +2005-07-27 Mark Mitchell + + * Makefile.tpl (EXTRA_TARGET_FLAGS): Set LDFLAGS=LDFLAGS_FOR_TARGET. + * Makefile.def (flags_to_pass): Add LDFLAGS_FOR_TARGET. + * Makefile.in: Regenerated. + +2005-07-26 Mark Mitchell + + * Makefile.tpl (SYSROOT_CFLAGS_FOR_TARGET): New variable. + (CFLAGS_FOR_TARGET): Use it. + (CXXFLAGS_FOR_TARGET): Likewise. + * Makefile.in: Regenerated. + * configure.in (--with-build-sysroot): New option. + * configure: Regenerated. + +2005-07-24 Paolo Bonzini + + * Makefile.tpl: Wrap install between unstage and stage + * Makefile.in: Regenerate. + +2005-07-16 Kelley Cook + + * all files: Update FSF address. + +2005-07-14 Jim Blandy + + * configure.in: Add cases for Renesas m32c. + * configure: Regenerated. + +2005-07-14 Kelley Cook + + * COPYING, compile, config-ml.in, config.guess, + config.sub, install-sh, missing, mkinstalldirs, + symlink-tree, ylwrap: Sync from upstream sources. + +2005-07-13 Eric Christopher + + * configure.in: Add toplevel noconfigdir support for tpf. + * configure: Regenerate. + +2005-07-11 Jakub Jelinek + + * Makefile.def (target_modules): Add libssp. + * configure.in (target_libraries): Add target-libssp. + * configure: Rebuilt. + * Makefile.in: Rebuilt. + +2005-07-11 Paolo Bonzini + + PR ada/22340 + + * Makefile.def: Sync with gcc. + * Makefile.tpl (POSTSTAGE1_FLAGS_TO_PASS): Fix pasto. + * Makefile.in: Regenerate. + +2005-07-07 Andreas Schwab + + * Makefile.def (flags_to_pass): Add CFLAGS_FOR_BUILD. + * Makefile.tpl (EXTRA_GCC_FLAGS): Don't pass CFLAGS_FOR_BUILD here. + * Makefile.in: Regenerated. + +2005-07-07 Kazu Hirata + + * configure.in: Add --enable-libssp and --disable-libssp. + * configure: Regenerate with autoconf-2.13. + +2005-07-06 Geoffrey Keating + + * configure.in: Don't build sim or rda when targetting darwin. + * configure: Regenerate. + +2005-07-04 Ben Elliston + + * src-release (do-proto-toplev): Remove dejagnu bits. + (DEJAGNU_SUPPORT_DIRS): Remove. + (dejagnu.tar.bz2, dejagnu.tar): Likewise. + (GDBD_SUPPORT_DIRS): Likewise. + (gdb+dejagnu.tar.bz2, gdb+dejagnu.tar): Likewise. + (INSIGHTD_SUPPORT_DIRS): Likewise. + (insight+dejagnu.tar.bz2, insight+dejagnu.tar): Likewise. + +2005-06-30 Ben Elliston + + * setup.com (mpw): Remove unused directive. + +2005-06-22 Paolo Bonzini + + * Makefile.def (stagefeedback): Come after profile. + Define profiledbootstrap target. + * Makefile.tpl (profiledbootstrap): Remove. + (stageprofile-end): Zap stagefeedback. + (stagefeedback-start): Copy all .gcda files, not only GCC's. + * Makefile.in: Regenerate. + +2005-06-13 Zack Weinberg + + * depcomp: Update from automake CVS. Add 'ia64hp' stanza. + In 'cpp' stanza, support '#line' as well as '# '. + +2005-06-07 Hans-Peter Nilsson + + * configure.in (unsupported_languages): New macro. + : Set unsupported_languages. Name explicit + non-ported target libraries in noconfigdirs. + Ditto, except for non-aout, non-elf, + non-linux-gnu. Remove libgcj_ex_libffi. + : Set add_this_lang=no if the language is in + unsupported_languages. + * configure: Regenerate. + +2005-06-04 Tobias Schl"uter + + * configure.in: Fix typo in handling of --with-mpfr-dir. + * configure: Regenerate. + +2005-06-02 Jim Blandy + + * config.sub: Add cases for the Renesas m32c. (This patch has been + accepted into the master sources.) + +2005-06-02 Aldy Hernandez + Michael Snyder + Stan Cox + + * configure.in: Set noconfigdirs for ms1. + + * configure: Regenerate. + +2005-05-25 Paolo Bonzini + + * Makefile.tpl (stage[+id+]-start): Iterate over target module as well. + (Dependencies): Consider target modules for bootstrap dependencies. + Make target bootstrap modules depend on each stage's gcc. + * Makefile.in: Regenerate. + +2005-05-20 Paolo Bonzini + + * Makefile.def (configure-gcc): Depend on binutils having been built. + (all-gcc): No need to do it here. + * Makefile.in: Regenerate. + +2005-05-19 Paul Brook + + * configure.in: Rewrite misleading error message when requested + language cannot be built. + * configure: Regenerate. + +2005-05-15 Daniel Jacobowitz + + * ylwrap: Import from Automake 1.9.5. + +2005-05-04 Mike Stump + + * configure.in: Always pass --target to target configures as + otherwise rebuilds that do --recheck will fail. + * configure: Rebuilt. + +2005-05-04 Paolo Bonzini + + * Makefile.tpl (POSTSTAGE1_HOST_EXPORTS): Rename from + STAGE_HOST_EXPORTS. + (configure, all): Add bootstrap support. + (Host modules, target modules): Pass post-stage1 flags and exports. + (Top-level bootstrap): Remove bootstrap rules, expanded elsewhere. + * Makefile.in: Regenerate. + +2005-04-29 Paolo Bonzini + + Sync from gcc: + + 2005-04-22 Bernd Schmidt + + * config.sub: Update from master copy. + + 2005-04-19 Hans-Peter Nilsson + + * configure.in : New local variable + libgcj_ex_libffi. Have specific match for *-*-linux*. Separate + matches for "*-*-aout" and "*-*-elf". Don't disable libffi for + "*-*-elf" and "*-*-linux*". + * configure: Regenerate. + +2005-04-06 Paolo Bonzini + + * Makefile.tpl (BUILD_CONFIGARGS): Include --with-build-subdir. + (TARGET_CONFIGARGS): Include --with-target-subdir. + (configure, all): New macros. Use them throughout. + +2005-04-05 Paolo Bonzini + + * Makefile.tpl: Sync with gcc. + * Makefile.in: Regenerate. + +2005-03-30 J"orn Rennecke + + * config/mh-mingw32: Delete. + * configure.in: Don't use it. + * configure: Regenerate. + +2005-03-31 Paolo Bonzini + + * Makefile.def (bfd, opcodes, libstdc++-v3, libmudflap): Set lib_path. + * Makefile.tpl (SET_LIB_PATH, REALLY_SET_LIB_PATH): Remove. + (HOST_EXPORTS, STAGE_HOST_EXPORTS, TARGET_EXPORTS): Set $(RPATH_ENVVAR). + (HOST_LIB_PATH): Generate from Makefile.def. + (TARGET_LIB_PATH): Likewise. + (Old bootstrap targets): Include TARGET_LIB_PATH into RPATH_ENVVAR. + * Makefile.in: Regenerate. + * configure.in (set_lib_path, SET_LIB_PATH, SET_GCC_LIB_PATH): Remove. + (RPATH_ENVVAR): Include Darwin case. + * configure: Regenerate. + +2005-03-25 Paolo Bonzini + + * configure.in (RPATH_ENVVAR): Set to DYLD_LIBRARY_PATH on Darwin. + * configure: Regenerate. + +2005-03-21 Zack Weinberg + + * Makefile.def: Remove libstdcxx_incdir, libsubdir, gxx_include_dir, + gcc_version, and gcc_version_trigger from set of flags to pass. + * Makefile.tpl: Remove definitions of above variables. + (config.status): Remove dependency on $(gcc_version_trigger). + * Makefile.in: Regenerate. + * configure.in: Do not reference config/gcc-version.m4 nor + config/gxx-include-dir.m4. Do not invoke TL_AC_GCC_VERSION nor + TL_AC_GXX_INCLUDE_DIR. Do not set gcc_version_trigger. + * configure: Regenerate. + +2005-03-16 Manfred Hollstein + Andrew Pinski + + * Makefile.tpl (check-[+module+]): Fix shell statement inside if ... fi. + * Makefile.in: Regenerate. + +2005-03-01 Alexandre Oliva + + PR libgcj/20160 + * ltmain.sh: Avoid creating archives with components that have + duplicate basenames. + +2005-02-28 Andrew Pinski + + PR bootstrap/20250 + * Makefile.tpl (HOST target installs): Fix copy and pasto, use install + instead of check. + * Makefile.in: Regenerate. + +2005-02-28 Paolo Bonzini + + Sync from gcc. + + 2005-02-28 Paolo Bonzini + + PR bootstrap/17383 + * Makefile.def (target_modules): Remove "stage", now unnecessary. + * Makefile.tpl (HOST_SUBDIR): New substitution. + (STAGE_HOST_EXPORTS, EXPECT, HOST_LIB_PATH, USUAL_AR_FOR_TARGET, + USUAL_AS_FOR_TARGET, USUAL_DLLTOOL_FOR_TARGET, USUAL_GCC_FOR_TARGET, + USUAL_LD_FOR_TARGET, USUAL_NM_FOR_TARGET, USUAL_OBJDUMP_FOR_TARGET, + USUAL_RANLIB_FOR_TARGET, USUAL_WINDRES_FOR_TARGET): Use it. + (Host modules, Bootstrapped modules): Use it. + (Build modules, Target modules): Do not create symlink trees, + always configure out-of-srcdir. + (distclean): Try removing $(host_subdir) with rm before using rm -rf. + * configure.in (FLAGS_FOR_TARGET, CC_FOR_TARGET, GCJ_FOR_TARGET, + GFORTRAN_FOR_TARGET, CXX_FOR_TARGET, RAW_CXX_FOR_TARGET): Use + $(HOST_SUBDIR). Create a symlink for host_subdir. + + * Makefile.in: Regenerate. + * configure: Regenerate. + + Merged from libada-gnattools-branch: + 2004-11-28 Nathanael Nerode + + * Makefile.def: Add gnattools as a module, depending on target-libada. + * Makefile.in: Regenerate. + * configure.in: Include gnattools in host_tools; disable it if ada + is disabled. + * configure: Regenerate. + +2005-02-23 Nick Clifton + + * configure: Regenerate. + +2005-02-22 Paul Schlie + + * configure.in: Allow darwin targeted ports to build tk, itcl and + libgui. + +2005-02-21 Eric Botcazou + + PR libgcj/10353 + * configure.in (noconfigdirs) : Add libgcj. + * configure: Regenerate. + +2005-02-08 Andrew Cagney + + * MAINTAINERS: Delete reference to dejagnu/ and mmalloc/ from the + gdb/ section. Update GDB's URL. + +2005-01-31 Andrew Cagney + + * gettext.m4: Only set ENABLE_NLS when gettext is present. + +2005-01-29 Hans-Peter Nilsson + + * configure.in (noconfigdirs) : Match like cris-*-*. + : Only disable target-newlib and + target-libgloss when not *-*-elf and *-*-aout. + * configure: Regenerate. + +2005-01-27 Andrew Cagney + + * gettext.m4: Don't use NONE as a default for CATOBJEXT. + +2005-01-24 Andrew Cagney + + * gettext.m4: Only fall back to ../intl/ when it's present. + +2005-01-17 Kelley Cook + + * install-sh, config.sub: Import from upstream. + +2005-01-17 Kelley Cook + + PR bootstrap/18222 + * Makefile.def: Pass CPPFLAGS_FOR_TARGET. + * Makefile.tpl: Define target CPPFLAGS on CPPFLAGS_FOR_TARGET. + * Makefile.in: Regenerate. + +2005-01-03 Paolo Bonzini + + Revert 2004-12-28 Makefile changes, a better fix will be + applied to mainline and src after GCC 4.0 branches. + +2004-12-28 Paolo Bonzini + + PR bootstrap/17383 + + * Makefile.def (target_modules): Remove stage parameter, + it is always true now. + * Makefile.tpl (configure-build-[+module+], + configure-target-[+module+]): Always build symlink tree + for the directory and for include. BUILD_SUBDIR and + TARGET_SUBDIR cannot be . anymore. + * Makefile.in: Regenerate. + +2004-12-25 David Edelsohn + + Revert 2004-12-08 Makefile changes. + +2004-12-16 Andrew Stubbs + + * configure.in (sh64-*-*): Reenable gprof. + * configure: Regenerate. + +2004-12-09 Jim Blandy + + * MAINTAINERS: List 'depcomp' as part of automake. + +2004-12-08 David Edelsohn + + * Makefile.def (flags_to_pass): Add PICFLAG_FOR_TARGET. + * Makefile.tpl (EXTRA_HOST_FLAGS): Add PICFLAG. + (EXTRA_TARGET_FLAGS): Add PICFLAG. + * Makefile.in: Regenerate. + +2004-12-07 Matt Kraai + + * Makefile.tpl: Generate normal dependencies if the LHS module is + not bootstrapped. + * Makefile.in: Regenerate. + +2004-12-03 Richard Sandiford + + * configure.in: Include config/gxx-include-dir.m4. Use + TL_AC_GXX_INCLUDE_DIR. Remove some now-redundant AC_SUBSTs. + * configure: Regenerate. + +2004-12-03 Richard Sandiford + + * config.if: Delete. + * configure.in: Set libstdcxx_incdir directly. + * configure: Regenerate. + * MAINTAINERS: Remove mention of config.if. + * src-release (DEVO_SUPPORT): Remove config.if. + +2004-12-02 Eric Christopher + + * Makefile.tpl (clean-target-libgcc): Add stmp-dirs to list + of things to remove. + * Makefile.in: Regenerate. + +2004-12-02 Richard Sandiford + + * configure.in: Clear gcc_version_trigger if the file doesn't exist. + * configure: Regenerate. + +2004-12-02 Richard Sandiford + + * configure.in: Include config/gcc-version.m4. Use TL_AC_GCC_VERSION + to set gcc_version_trigger. Remove some now-redundant AC_SUBSTs. + * configure: Regenerate. + +2004-11-26 John David Anglin + + * configure.in (hppa*-*-linux*): Don't add libgcj to noconfigdirs. + (hppa*64*-*-*): Delete incorrect comment. + * configure: Rebuilt. + +2004-11-15 Kelley Cook + + * install-sh, compile: Import from automake. + +2004-11-15 Kelley Cook + + * config.guess, config.sub: Import from savannnah. + +2004-11-12 Mike Stump + + * Makefile.def: Add html support. + * Makefile.tpl: Likewise. + * Makefile.in: Regenerate. + +2004-11-11 Geoffrey Keating + + PR 18423 + * configure.in: Remove all instances of build-fixincludes from + noconfigdirs. + (build_configargs): Supply --target to subdirectories. + * configure: Regenerate. + + * Makefile.def: Make gcc install depend on fixincludes install. + * Makefile.in: Regenerate. + +2004-11-08 Hans-Peter Nilsson + + * configure.in (noconfigdirs) [mmix-*-*]: Disable + target-libgfortran. + * configure: Regenerate. + +2004-11-07 David Edelsohn + + * config-ml.in: Pass FCFLAGS for multilibs, handle GFORTRAN + like CC. + +2004-11-05 Paolo Bonzini + + * Makefile.def (host fixincludes): Specify missing targets. + * Makefile.in: Regenerate. + +2004-11-04 H.J. Lu + + PR other/17783 + * configure.in: Set up LD_LIBRARY_PATH by default for gcc. + * configure: Regenerated. + +2004-11-04 Daniel Jacobowitz + + * configure.in (arm-*-oabi*, thumb-*-oabi*): Remove. + * configure: Regenerated. + +2004-10-28 Eric B. Weddington + + PR target/18151 + * configure.in (case ${target}): Do not build fixincludes for avr. + * configure: Regenerated. + +2004-10-26 Paolo Bonzini + + * configure.in (case ${target}): Do not build fixincludes + on platforms where it is not used. + * configure: Regenerated. + +2004-10-23 Daniel Jacobowitz + + * configure.in: Use an absolute path to install-sh. + * configure: Regenerated. + +2004-10-19 Andrew Cagney + + * src-release (do-djunpack, do-md5sum): Install the generated file + directly into the proto-toplev/ directory. + +2004-10-19 Andrew Cagney + + * src-release (GDB_SUPPORT_DIRS): Remove utils and intl. + +2004-10-12 Kelley Cook + + * configure.in (*-*-cygwin*): Supress warning if newlib not present. + * configure: Regenerate. + +2004-10-06 Paolo Bonzini + + Fix wrong conflict resolution in: + + 2004-08-16 Paolo Bonzini + + * Makefile.in: Regenerate. + * Makefile.tpl (Autogenerated `all-*' targets): Invoke $(TARGET-*) + in the recursive `make', instead of hardwiring `all'. + (Autogenerated TARGET-* variables): New. + +2004-10-05 Ulrich Weigand + + Merged from GCC / libtool upstream: + 2004-10-02 P.J. Darcy + * ltcf-c.sh (tpf*): Add ld_shlibs=yes. + * ltcf-cxx.sh (tpf*): Likewise. + * ltconfig (tpf*): Add TPF OS configuration support. + +2004-09-30 Tomer Levi + + * configure.in: Enable target-libgloss for crx-*-*. + * configure: Regenerate. + +2004-09-24 Michael Roth + + * configure.in (--without-headers): Add missing double quotes. + * configure: Regenerate. + +2004-09-24 Kelley Cook + + * ylwrap: Revert to previous version. + +2004-09-23 H.J. Lu + + PR bootstrap/17369 + * Makefile.tpl (REALLY_SET_LIB_PATH): Add @SET_GCC_LIB_PATH@. + (HOST_EXPORTS]): Add @SET_GCC_LIB_PATH@. Set and export + SET_GCC_LIB_PATH_CMD. + (BASE_TARGET_EXPORTS): Likewise. + * Makefile.in: Regenerated. + + * configure.in (SET_GCC_LIB_PATH): Set and substitute. + * configure: Regenerated. + +2004-09-23 Kelley Cook + + * config.guess: New upstream version + * compile, depcomp, install-sh, ylwrap: Likewise. + +2004-09-19 Roger Sayle + + * config/mh-x86omitfp: New host makefile fragment. Add + -fomit-frame-pointer to the default BOOT_CFLAGS. + * configure.in: Use it to speed up bootstrap on some IA-32 hosts. + * configure: Regenerate. + +2004-09-15 Andrew Pinski + + PR target/11572 + * configure.in (*-*-darwin*): Renable libobjc. + * configure: Regenerate. + +2004-09-09 Daniel Berlin + + * Makefile.def: Remove libbanshee. + * Makefile.tpl: Ditto. + * configure.in: Ditto. + * Makefile.in: Regen. + * configure: Ditto. + +2004-09-07 Paolo Bonzini + + * missing: Import latest version from master repository. + +2004-09-04 Nick Clifton + + * config.sub: Import latest version from master repository. + * config.guess: Likewise. + This includes these changes: + + 2004-08-27 Hans-Peter Nilsson + + * config.sub: Handle crisv32, alias etraxfs. + * config.guess (crisv32:Linux:*:*): Handle. + + 2004-08-13 Brad Smith + + * config.guess (*:OpenBSD:*:*): Remove defunct MIPS machines. + (sgi:OpenBSD:*:*): Emit mips64, not mipseb. + + 2004-08-11 Paul Eggert + + * config.guess (*:Darwin:*:*): If uname -p reports "unknown", + assume the processor is a powerpc. This is because coreutils + uname (at least versions 4.5.7 through 5.2.1) outputs "unknown" + in this case, due to a MacOS X bug that causes + sysctl ((int[]) {CTL_HW, HW_MACHINE_ARCH}, 2, buffer, &bufsize, 0, 0) + to return a negative number. + Problem reported by Petter Reinholdtsen in: + http://lists.gnu.org/archive/html/bug-gnu-utils/2003-02/msg00201.html + + 2004-07-19 Ben Elliston + + * config.guess (S7501:*:4.0:3.0): Handle NCR System V UNIX machine. + + 2004-06-24 Ben Elliston + + * config.guess: Update copyright years. + * config.sub: Likewise. + + 2004-06-22 Robert Millan + + * config.guess (*:FreeBSD:*:*): Remove check for glibc (unneeded + since GNU/kFreeBSD systems match *:GNU/*:*:* instead). + + 2004-06-22 Stanley F. Quayle + + * config.guess (*:*VMS:*:*): New entry. Replaces + Alpha:OpenVMS:*. Recognize and advertise all VMS flavors as dec + manufacturer. + + 2004-06-22 Ben Elliston + + * config.guess: Cray fixes from Wendy Palm . + * config.sub: Likewise. + + 2004-06-22 Ben Elliston + + Reported by Hans-Peter Nilsson : + * config.sub: Correctly handle mmix-knuth and mmix-knuth-mmixware. + + 2004-06-11 Ben Elliston + + * config.guess (pegasos:OpenBSD:*:*): Remove. + + 2004-06-11 Ben Elliston + + From Wouter Verhelst : + * config.guess (M68*:*:R3V[5678]:*): Detect R3V8. + + 2004-06-11 Ben Elliston + + * config.guess (luna88k:OpenBSD:*:*): New. + + 2004-03-12 Kazuhiro Inaoka + + * config.guess (m32r*:Linux:*:*): New case. + * config.sub: Handle m32rle. + + 2004-03-12 Ben Elliston + + From Jens Petersen : + * config.sub: Handle sparcv8. + + 2004-03-03 Ben Elliston + + From Tom Smith : + * config.guess: Version suffixes are equally significant on Tru64 + V4.* and V5.*, so do not ignore them on V5.*. Handle a version + prefix of "P" (patched kernel). + + 2004-02-23 Tal Agmon + + * config.sub: Add support for National Semiconductor CRX target. + +2004-09-03 Jan Beulich + + * configure.in: Remove target-libstdc++-v3 from noconfigdirs for + *-*-netware, but add target-libmudflap. + Consolidate *-*-netware targets (of which really only i?86 exists) + into a single entry. + * configure: Likewise. + +2004-09-01 Paolo Bonzini + + * Makefile.tpl (sorry): Remove. + (clean-stage[+id+], clean-stage[+id+]-module): New targets. + (cleanstrap targets): Depend on distclean, not distclean-stage1. + (do-clean): Clean per-stage directories too. + (do-distclean): Run distclean-stage1 too. + (.NOTPARALLEL): Enable during toplevel bootstrap. + (stage[+id+]-bubble): Enable parallel execution during + the recursive invocation. + * Makefile.in: Regenerate. + + Sync from gcc (moving the Makefile.in change to Makefile.tpl): + + 2004-08-31 Robert Bowdidge + + * Makefile.in: Move BOOT_CFLAGS above host makefile fragment include. + * configure.in: add test for powerpc-*-darwin* to specify makefile frag + * configure: regenerate + * config/mh-ppc-darwin: create file, override BOOT_CFLAGS for + -mdynamic-no-pic + +2004-08-31 Paolo Bonzini + + * Makefile.tpl: Move BOOT_CFLAGS above host makefile fragment + include. + * configure.in: Fix indentation. + * configure: Regenerate. + +2004-08-31 Paolo Bonzini + + * Makefile.def (build_modules): Add fixincludes. + (dependencies): Make gcc depend on fixincludes. + * configure.in (build_tools): Add fixincludes. + (build_configdirs): Always include build_libs. + * Makefile.in: Regenerate. + * configure: Regenerate. + +2004-08-30 Paolo Bonzini + + * Makefile.def (bootstrap stages): Add 'lean' parameter. + * Makefile.tpl (configure-stageN-*, all-stageN-*): Turned into + phony targets; do not generate timestamp files. + (distclean-stageN): Remove references to their timestamp files. + (restageN, touch-stageN): Remove. + (stageN-bubble): Rewritten. + (compare): Support lean bootstraps. + * Makefile.in: Regenerate. + + * configure.in: Only warn when bootstrapping but + build != host or build != target. Support lean bootstraps. + * configure: Regenerate. + + Sync from gcc: + 2004-08-26 Phil Edwards + + * configure.in: Give a better error message if GMP/MPFR are missing + and a language needing them has been requested. + * configure: Regenerated. + + 2004-08-25 Phil Edwards + + * configure.in: Print a list of available language front-ends if + a requested one is missing. Tidy stray tab characters. + * configure: Regenerated. + +2004-08-17 Paolo Bonzini + + * Makefile.in: Regenerate. + * configure: Regenerate. + + * Makefile.def (bootstrap-stage): Rename extra_*_flags to + stage_*_flags. + * Makefile.tpl (configure-[+module+], all-[+module+]): Exit + for bootstrapped modules if toplevel bootstrap is going. + (GCC bootstrap): Generate per-stage targets for all bootstrapped + modules. Adjust for changes in Makefile.def. Enable several + rules even in non-bootstrap mode, just to avoid peppering the + template with unnecessary "@if/@endif gcc-bootstrap" pairs. + (stage-[+prev+]-bubble): Remove. + + * Makefile.def (Dependencies): Depend on all-build-bison, + all-build-flex, all-build-byacc, all-build-texinfo, rather + than the host variations. + * Makefile.tpl (BUILD_DIR_PREFIX): Remove. Replace throughout + with BUILD_SUBDIR. + (BISON): Update for recent Bisons. + (YACC): Fix typo. + (cross): Depend on all-build. + (all): Do not depend on all-build. + (prebootstrap): Remove. + (dep-kind): Accept separate prefixes for MODULE and ON variables. + (Prebootstrap dependencies): Add them to the per-stage targets + and to all-prebootstrap. + * configure.in (build_configdirs): Always enable build_tools. + (BUILD_DIR_PREFIX): Remove. + + * Makefile.def (gcc): Add target variable. + (gdb, expect, guile, tk, tix): Replace with_x with extra_make_flags. + * Makefile.tpl (Autogenerated `all-*' targets): Invoke $(TARGET-*) + in the recursive `make', instead of hardwiring `all'. + (Autogenerated TARGET-* variables): New. + +2004-08-17 Robert Millan + + * configure.in: In noconfigdirs check, match GNU/k*BSD with GNU/Linux + (instead of FreeBSD). + * configure: Regenerate. + +2004-08-12 Nathanael Nerode + + * Makefile.def, configure.in, src-release: Remove useless, bogus + references to tix. + * Makefile.in, configure: Regenerate. + + * src-release: Stop distributing mmalloc with gdb (which doesn't + use it). + * Makefile.def: GDB doesn't depend on mmalloc anymore. + * Makefile.in: Regenerate. + +2004-08-09 Mark Mitchell + + * configure.in (arm*-*-eabi*): New target. + * configure: Regenerate. + +2004-08-01 Robert Millan + + * configure.in: Turn mt-linux into mt-gnu. Use mt-gnu and enable + libmudflap for all GNU-based systems (with Glibc). + * configure: Regenerate. + +2004-08-06 Paolo Bonzini + + * Makefile.def (bfd, opcodes, gcc, zlib): Mark as bootstrap module. + (bison, byacc, flex, texinfo): Do not mark as bootstrap module. + (Dependencies): New section. + * Makefile.tpl (Dependencies): Generate from Makefile.def. + (configure-target-[+module+]): Depend on maybe-all-gcc + (all-prebootstrap): New name of all-bootstrap. Changed throughout. + (toplevel profiledbootstrap): Fix dependencies. + * Makefile.in: Regenerate. + +2004-08-03 Mark Mitchell + + * configure.in (arm*-*-symbianelf*): Add ${libgcj} and + target-libiberty to noconfigdirs. + +2004-08-03 Paul Brook + + * configure.in: Check for MPFR as well as GMP. + * configure: Regenerate. + +2004-08-03 Paolo Bonzini + + * Makefile.def (host-modules): Add gcc. + * Makefile.in: Regenerate. + * Makefile.tpl (sorry): New rule. + (configure-host, all-host, [+make_target+]-host, do-check, + install-host): Do not add gcc as a special case. + (host modules): Add a small special-casing for gcc. Export + extra_make_flags through the environment. + (maybe-configure-gcc, configure-gcc, maybe-all-gcc, all-gcc, + maybe-check-gcc, check-gcc, maybe-install-gcc, install-gcc, + other recursive targets for gcc): Remove. + + (all, do-[+make_target+], do-check): Wrap between unstage and stage. + (stage, unstage): New rules. + (stage[+id+]-start, stage[+id+]-end, [+compare-target+], + distclean-stage[+id+]): Use stage_current. + ([+bootstrap-target+], profiledbootstrap): Do not invoke manually + the stage*-start rules. + +2004-07-19 Robert Millan + + Synced from gcc: + + 2004-04-26 Robert Millan + + Add patches from libtool CVS. + * libtool.m4: Add kfreebsd*-gnu and knetbsd*-gnu. + * ltconfig: Likewise. + * ltcf-c.sh: Likewise. + * ltcf-cxx.sh: Likewise. + * ltcf-gcj.sh: Likewise. + +2004-07-12 Paolo Bonzini + + * configure.in: Add noconfigdirs for crx-*-*. + * configure: Regenerate. + +2004-07-12 Paolo Bonzini + + Synced from gcc: + + 2004-07-09 Loren J. Rittle + + * configure.in: Build libmudflap by default on FreeBSD. + * configure: Regenerated. + + 2004-07-09 Mark Mitchell + + * configure.in: Do not build libmudflap by default on non-GNU/Linux + systems. + * configure: Regenerated. + + 2004-07-08 John David Anglin + + PR target/16344 + * Makefile.tpl (profiledbootstrap): Build runtime libraries with + feedback based compiler. + * Makefile.in: Rebuilt. + + 2004-07-05 Phil Edwards + + * configure.in: Do not prepend $srcdir to /dev/null in + makefile fragments. + * configure: Regenerate. + +2004-07-08 Alexandre Oliva + + * Makefile.def (host_modules): Set bootstrap=true for flex. + * Makefile.tpl (all-gcc): Depend on texinfo and flex. + * Makefile.in: Rebuilt. + +2004-07-01 Paolo Bonzini + + * Makefile.def (build_modules): Add bison, byacc, flex, + m4, texinfo. + (flags_to_pass): Add FLEX. + * Makefile.tpl (BUILD_DIR_PREFIX, BASE_EXPORTS): New. + (BUILD_EXPORTS, HOST_EXPORTS, BASE_TARGET_EXPORTS): Include it. + (DEFAULT_YACC, USUAL_YACC, DEFAULT_LEX, USUAL_LEX, DEFAULT_M4, + DEFAULT_MAKEINFO): Remove. + (CONFIGURED_YACC, CONFIGURED_FLEX, CONFIGURED_BISON, + CONFIGURED_LEX, CONFIGURED_M4, CONFIGURED_MAKEINFO): Substitute. + (YACC, FLEX, BISON, LEX, M4, MAKEINFO): Define to look into + objdir or else use configured tool. + (all-build): New. + (all): Depend on it. + (Build module dependencies): Add. + * Makefile.in: Regenerate. + * configure.in: Better support for multiple build modules, + matching what is done for host/target modules. Do not look + for "plausible" locations of build tools if Canadian cross. + Use autoconf's AC_PROG_CC to find a C compiler. Define + BUILD_DIR_PREFIX. Look for flex, makeinfo and m4. + * configure: Regenerate. + +2004-06-22 Paolo Bonzini + + * Makefile.tpl (HOST_EXPORTS): Fix pasto. + * Makefile.in: Regenerate. + +2004-06-22 Paolo Bonzini + + * Makefile.tpl (configure-build-[+module+], + configure-[+module+], configure-target-[+module+]): Pass + [+extra_configure_args+]. + (all-build-[+module+], all-[+module+], check-[+module+], + install-[+module+], [+make_target+]-[+module+], + all-target-[+module+], check-target-[+module+], + install-target-[+module+], [+make_target+]-target-[+module+]): + Pass [+extra_make_args+]. + (HOST_EXPORTS): Include the former GCC_HOST_EXPORTS. + (GCC_HOST_EXPORTS): Remove. + (configure-gcc, all-gcc, GCC_STRAP_TARGETS, profiledbootstrap, + cross, check-gcc, check-gcc-c++, install-gcc, + gcc-no-fixedincludes, [+make_target+]-gcc, stage[+id+]-bubble): + Replace GCC_HOST_EXPORTS with HOST_EXPORTS. + * Makefile.in: Regenerate. + +2004-06-21 Christopher Faylor + + * configure.in: Check for srcdir/winsup rather than build directory + winsup. + * configure: Regenerate. + +2004-06-17 Corinna Vinschen + + * configure.in: Don't build Cygwin native newlib if winsup + directory is missing. Emit warning instead. + * configure: Regenerate. + +2004-06-09 Paolo Bonzini + + * Makefile.tpl (touch-stage[+id+]): New. + (restage[+prev+]): Depend on touch-stage[+id+]. + + * Makefile.tpl (RECURSE_FLAGS_TO_PASS): New. + Use it throughout. + + * Makefile.def: Add profile and feedback bootstrap stages. + Remove next field from bootstrap stages. + * Makefile.tpl (LN, LN_S): Substitute. + (stageN-start, stageN-end): Use double-colon rules, to + provide a hook for additional setup commands. + (distclean-stageN-gcc, restageN): Create dependencies from + [+prev+], not from [+next+]. + (stageN-bubble): Add commands for successive stages from + [+prev+], using double-colon rules. + (all-stageN-gcc): Fix typo. + (stagefeedback-start, profiledbootstrap): New. + * Makefile.in: Regenerate. + * configure.in: Call ACX_PROG_LN. + * configure: Regenerate. + +2004-06-03 Paolo Bonzini + + * configure.in: Fix --enable-bootstrap breakage introduced in trees + without gcc. + * configure: Regenerate. + +2004-06-01 Paolo Bonzini + + * Makefile.tpl: Fix typo. + * Makefile.in: Regenerate. + +2004-06-01 Paolo Bonzini + + * configure.in: Remove new- prefix from toplevel + bootstrap targets. + * configure: Regenerate. + +2004-06-01 Paolo Bonzini + + Merge this patch from the gcc tree: + + 2004-05-30 Andreas Jaeger + Jim Wilson + + * config-ml.in: Pass FFLAGS and ADAFLAGS for multilibs, handle F77 + like CC. + +2004-06-01 Paolo Bonzini + + * Makefile.tpl (all.normal): Rename to all. + (all): Replace with a rule to pick the default + target from configure. + (all-gcc, configure-gcc): Use conditionals to + do nothing when toplevel bootstrap is going on. + (GCC directory bootstrap) [gcc-bootstrap]: Disable. + (Toplevel bootstrap) [gcc-no-bootstrap]: Disable. + * configure.in: Support --enable-bootstrap. + + * Makefile.def: Remove new- prefix from toplevel + bootstrap targets. + * Makefile.tpl: Likewise. + + * Makefile.def: Add bootstrap_stage 4. Add bootstrap2 + target. + + * Makefile.tpl (Toplevel bootstrap): Pass $(BASE_FLAGS_TO_PASS) + $(RECURSE_FLAGS) to recursive invocation of make. + + * Makefile.in: Regenerate. + * configure: Regenerate. + +2004-05-27 Daniel Jacobowitz + + * configure.in: Fix sed invocation for GFORTRAN_FOR_TARGET. + * configure: Regenerate. + +2004-05-25 Daniel Jacobowitz + + * Makefile.tpl (BUILD_EXPORTS, HOST_EXPORTS, GCC_HOST_EXPORTS) + (STAGE_HOST_EXPORTS, BASE_TARGET_EXPORTS, RAW_CXX_TARGET_EXPORTS) + (NORMAL_TARGET_EXPORTS): New macros. Use them in all the recursive + targets. + * Makefile.in: Regenerate. + +2005-05-24 Paolo Bonzini + + * configure.in: Test the ability to symlink directories. + * configure: Regenerate. + + * Makefile.def (bootstrap-stage): New definitions. + * Makefile.tpl (configure-stage1-gcc, + configure-stage2-gcc, configure-stage3-gcc, + all-stage1-gcc, all-stage2-gcc, all-stage3-gcc, + new-bootstrap, new-cleanstrap, new-restage1, new-restage2, + new-restage3, compare): Autogenerate, see Makefile.in + entry for behavioral changes. + (distclean-stage1, new-stage1-start, new-stage1-end, + new-stage1-bubble, distclean-stage2, new-stage2-start, + new-stage2-end, new-stage2-bubble, distclean-stage3, + new-stage3-start, new-stage3-end): New autogenerated targets. + (objext, prebootstrap, BOOT_CFLAGS, + POSTSTAGE1_FLAGS_TO_PASS): Move above the autogenerated + targets. + + * Makefile.in: Regenerate. + (distclean-stage1, new-stage1-start, new-stage1-end, + new-stage1-bubble, distclean-stage2, new-stage2-start, + new-stage2-end, new-stage2-bubble, distclean-stage3, + new-stage3-start, new-stage3-end): New targets. + (all-stage1-gcc): Move prebootstrap dependency from here... + (configure-stage1-gcc): ...to here. + (new-bootstrap): Use bubble targets. + (new-cleanstrap, new-restage1, new-restage2, new-restage3): + Use per-stage distclean targets. + (configure-stage1-gcc, configure-stage2-gcc, + configure-stage3-gcc, all-stage1-gcc, + all-stage2-gcc, all-stage3-gcc, new-bootstrap): + Use new-stageN-start to prepare the tree. + +2004-05-23 Paolo Bonzini + + * Makefile.def (host_modules): add libcpp. + * Makefile.tpl: Add dependencies on and for libcpp. + * Makefile.in: Regenerate. + * configure.in: Add libcpp host module. + * configure: Regenerate. + +2004-05-17 Zack Weinberg + + * Makefile.def, Makefile.tpl, configure.in: Remove all mention + of libf2c. + * configure, Makefile.in: Regenerate. + +2004-05-13 Diego Novillo + + Merge from tree-ssa-20020619-branch. + + * Makefile.def: Add libbanshee, libmudflap and libgfortran. + * Makefile.tpl (BUILD_CONFIGDIRS): Add libbanshee. + (HOST_GMPLIBS): Define. + (HOST_GMPINC): Define. + (TARGET_LIB_PATH): Add libmudflap. + (GFORTRAN_FOR_TARGET): Define. + (configure-build*): Export GFORTRAN. + (configure-gcc): Export GMPLIBS and GMPINC. + (all-gcc): Add maybe-all-libbanshee. + (configure-target-libgfortran): Define. + * Makefile.in: Regenerate. + * configure.in (host_libs): Add libbanshee. + (target_libraries): Add target-libmudflap and target-libgfortran. + Add --with-libbanshee. + Handle --disable-libmudflap. + (*-*-freebsd*): Use with_gmp. + Add $(libgcj) to noconfigdirs. + * configure: Regenerate. + * depcomp: New file. + * MAINTAINERS: Add tree-ssa maintainers. + +2004-04-28 Paolo Bonzini + + * config/acx.m4: Fix fastcompare support for new-bootstrap. + * configure: Regenerate. + +2004-04-27 Paolo Bonzini + + Revert: + 2004-04-26 Paolo Bonzini + + * Makefile.def (flags_to_pass): Remove *dir variables that + are passed to the modules via TOPLEVEL_CONFIGURE_ARGUMENTS, + as well as prefix and exec_prefix. + * Makefile.in: Regenerate. + +2004-04-26 Paolo Bonzini + + * Makefile.def (host_modules): Mark with the bootstrap + flag packages on which gcc depends. + * Makefile.tpl (all-bootstrap): Use it. + * Makefile.in: Regenerate. + +2004-04-26 Paolo Bonzini + + * Makefile.def (flags_to_pass): Remove *dir variables that + are passed to the modules via TOPLEVEL_CONFIGURE_ARGUMENTS, + as well as prefix and exec_prefix. + * Makefile.in: Regenerate. + +2004-04-26 Paolo Bonzini + + * configure.in: Invoke ACX_PROG_CMP_IGNORE_INITIAL. + * configure: Regenerate. + * config/acx.m4: Mutuate ACX_PROG_CMP_IGNORE_INITIAL from gcc. + * gcc/Makefile.tpl (compare): Use the result of the test. + * gcc/Makefile.in: Regenerate. + +2004-04-23 Paolo Bonzini + + * Makefile.tpl (all-stage1-gcc, all-stage2-gcc, all-stage3-gcc): + Always relocate gcc and prev-gcc to the original names, even + if the build fails. + (new-cleanstrap, new-restage1, new-restage2, new-restage3): + New targets. 2004-04-19 Rainer Orth * configure.in (mips*-*-irix5*): Enable ld. * configure: Regenerate. -2004-04-09 Daniel Jacobowitz +2004-04-15 James E Wilson - Merge from mainline: - 2004-03-25 Stan Shebs - Remove MPW support, no longer used. - * mpw-README, mpw-build.in, mpw-config.in, mpw-configure, - mpw-install: Remove files. - * src-release (DEVO_SUPPORT): Remove names of removed files. - * MAINTAINERS: Likewise. + * Makefile.tpl (configure-[+module+], configure-gcc, + configure-stage1-gcc, configure-stage2-gcc, configure-stage3-gcc): + Set and export LDFLAGS. + * Makefile.in: Regenerate. + +2004-04-09 Nathanael Nerode + + PR bootstrap/14871 + * Makefile.tpl: If we don't have built-in-tree target tools, + use the ones found by configure rather than hacking around with + program_transform_name. + * configure.in: Give Makefile.tpl the information necessary + to do that. + * Makefile.in: Regenerate. + * configure: Regenerate. + +2004-04-06 Nathanael Nerode + + PR bootstrap/14760 + * configure.in: When computing baseargs, strip *all* copies of + offending options. Also, don't match/substitute the trailing space, + so that this actually works when two similar options are separated by + only one space. + * configure: Regenerate. + +2004-04-06 David Edelsohn + + * configure.in (powerpc-*-aix*): Remove target-libada from noconfigdirs. + (rs6000-*-aix*): Same. + * configure: Regenerate. + +2004-03-25 Stan Shebs + + Remove MPW support, no longer used. + * mpw-README, mpw-build.in, mpw-config.in, mpw-configure, + mpw-install: Remove files. + * src-release (DEVO_SUPPORT): Remove names of removed files. + * MAINTAINERS: Likewise. + +2004-03-24 Nathanael Nerode + + * Makefile.tpl (top level bootstrap support): Remove now-unneeded + STRICT_WARN, WARN_CFLAGS flags passed down to make. + * Makefile.in: Regenerate. + + * configure.in (top level bootstrap support): Rework --enable-werror + to set @stage2_werror_flag@. + * configure: Regenerate. + * Makefile.tpl (top level bootstrap support): Pass + @stage2_werror_flag@ down to configure in stages 2 and 3. + * Makefile.in: Regenerate. + +2004-03-23 Nathanael Nerode + + * Makefile.tpl (new-bootstrap): Set CC and CC_FOR_BUILD in configure + for stages 2 and 3 as well as in make. As a consequence, remove + OUTPUT_OPTION (now detected by configure) from the flags passed down + to make. + * Makefile.in: Regenerate. + + * Makefile.tpl (new-bootstrap): Fix typo. + * Makefile.in: Regenerate. + +2004-03-22 Nathanael Nerode + + * Makefile.tpl: Rearrange by moving recursive_targets rules + into their proper sections. + * Makefile.tpl (top level bootstrap support): Move disabling + of coverage flags from 'make' to 'configure'; improve comments. + * Makefile.in: Regenerate. + + * Makefile.tpl (experimental top level bootstrap) Move stage1 + language setting from all- target to configure- target; disable + intermodule optimization in stage 1; prevent gratuitous rebuilds + of stage 1. + * Makefile.in: Regenerate. + * configure.in: Comma-separate stage 1 language list for top + level bootstrap. + * configure: Regenerate. + + * Makefile.tpl: Clean up experimental top level bootstrap support: + note known problems; set CONFIG_SHELL; don't set BUILD_CC; relocate + prev-gcc in configure- targets as well as all- targets. + * Makefile.in: Regenerate. + +2004-03-17 Paolo Bonzini + + * configure.in: Remove symbolic link section. + * configure: Regenerate. + * Makefile.tpl (links): Remove. + * Makefile.in: Regenerate. + +2004-03-15 Paolo Bonzini + Nathanael Nerode + + * configure.in (DEFAULT_YACC, DEFAULT_M4, DEFAULT_LEX): + Set with AC_CHECK_PROGS. + * configure.in: Fix comment typo from last patch. + * configure: Regenerate. + +2004-03-15 Nathanael Nerode + + * Makefile.tpl: Introduce experimental top level bootstrap support. + * Makefile.in: Regenerate. + * configure.in: Introduce support for top level bootstrap. + * configure: Regenerate. + +2004-03-12 Eric Botcazou + Paolo Bonzini + + PR bootstrap/14522 + * configure.in: Cope with shells that do not support unquoted ^ + * configure: Regenerate. + +2004-03-11 Eric Botcazou + Paolo Bonzini + + PR bootstrap/14522 + * configure.in: Cope with shell that do not support nesting + quotes inside quoted backquote substitutions. + * configure: Regenerate. + +2004-03-10 Andrew Pinski + + PR bootstrap/14522 + * configure.in: Fix escaping of $. + * configure: Regenerate. + +2004-03-11 Nathanael Nerode + + * configure: Regenerate. + +2004-03-08 Paolo Bonzini + + PR ada/14131 + Move language detection to the top level. + * configure.in: Find default values for the tools as + soon as possible. Disable ada if GNAT is not found. + Emit error message about missing languages. Expand + --enable-languages=all for the gcc subdirectory. + +2004-03-01 Richard Sandiford + + * configure.in (mips64*-*-linux*): Override mips*-*-linux* case + and disable libgcj. + * configure: Regenerated. + +2004-02-28 Nathanael Nerode + + PR bootstrap/7087 + * Makefile.tpl: Guard XFOO sed statements better. + * Makefile.tpl: Add dependency for configure-target-libada. + * Makefile.in: Regenerate (incidentally fixes broken + commit when libada-branch was merged). + +2004-02-28 Andrew Cagney - 2004-02-28 Andrew Cagney * src-release (CVS_NAMES): Define. (do-tar, do-tar): Prune $(CVS_NAMES). - 2004-02-23 Andrew Cagney +2004-02-23 Andrew Cagney + * texinfo/texinfo.tex: Update from version 2003-02-03.16 to 2004-02-19.09. - 2004-02-19 Andrew Cagney +2004-02-19 Nathanael Nerode + + PR bootstrap/11932 + * mkinstalldirs, install-sh: Import from automake CVS HEAD. + +2004-02-19 Andrew Cagney + * config.guess: Update from version 2003-06-12 to 2004-02-16. * config.sub: Update from version 2003-06-13 to 2004-02-16. @@ -53,7 +1815,7 @@ Nathanael Nerode PR ada/6637, PR ada/5911 - Merge with libada-branch: + Merge with libada-branch: * configure.in, Makefile.tpl, Makefile.def: Add target-libada, with appropriate dependencies. Add --enable-libada configure switch. * configure, Makefile.in: Regenerate. @@ -66,14 +1828,14 @@ 2004-02-02 Jeff Johnston * COPYING.NEWLIB: Update Red Hat license to 2004. - + 2004-01-23 DJ Delorie * Makefile.def (target_modules) [libiberty]: Don't stage. * Makefile.in: Rebuilt. 2004-01-23 Jeff Johnston - + * COPYING.NEWLIB: Update to include copyrights for new iconv code. @@ -125,7 +1887,7 @@ * configure: Regenerated. 2003-12-21 Bernardo Innocenti - + * configure.in (*-*-uclinux): Exclude newlib, libgloss and rda. * configure: Regenerated. @@ -145,7 +1907,7 @@ 2003-11-27 Jeff Johnston - * COPYING.NEWLIB: Add license info for long long routines added to + * COPYING.NEWLIB: Add license info for long long routines added to stdlib. 2003-11-14 Arnaud Charlet @@ -225,7 +1987,7 @@ 2003-09-04 Robert Millan * configure.in: Match GNU/KFreeBSD with new kfreebsd*-gnu triplet. - + 2003-09-02 Kaveh R. Ghazi * configure.in: Ensure arguments to sed are properly spaced. @@ -256,7 +2018,7 @@ * configure.in: When testing with_libs and with_headers, treat 'no' as unset. Based on a patch by Dan Kegel . * configure: Regenerate. - + * configure.in (TOPLEVEL_CONFIGURE_ARGUMENTS): Quote properly for make, shell, etc. (baseargs): Likewise. @@ -388,14 +2150,14 @@ * configure.in: Update testsuite_flags to new location. * configure. Regenerate. - + 2003-06-18 Nathanael Nerode * Makefile.tpl: Remove BUILD_CC stuff. * Makefile.in: Regenerate. 2003-06-14 H.J. Lu - + * config.guess: Update to 2003-06-12 version. * config.sub: Update to 2003-06-13 version. @@ -404,7 +2166,7 @@ * MAINTAINERS: Add myself as MIPS co-maintainer. 2003-06-12 H.J. Lu - + * config.guess: Update to 2003-06-06 version. * config.sub: Update to 2003-06-06 version. @@ -469,10 +2231,10 @@ 2003-05-28 Jeff Johnston - * COPYING.NEWLIB: Add license info for newlib/libc/sys/linux/stdlib. + * COPYING.NEWLIB: Add license info for newlib/libc/sys/linux/stdlib. 2003-05-21 DJ Delorie - + * Makefile.tpl (configure-target-libiberty): Depend only on gcc, not newlib or libgloss. * Makefile.in: Regenerate. @@ -490,7 +2252,7 @@ 2003-05-19 Nathanael Nerode * configure.in: Switch more things to use maybe dependencies. - * Makefile.tpl: Switch more things to use maybe dependencies. + * Makefile.tpl: Switch more things to use maybe dependencies. Factor out common code from autogen IF statements. * configure: Regenerate. * Makefile.in: Regenerate. @@ -536,8 +2298,8 @@ 2003-05-02 Chris Demetriou - * Makefile.tpl: Require "makeinfo" from texinfo 4.2 or later. - * Makefile.in: Regenerate. + * Makefile.tpl: Require "makeinfo" from texinfo 4.2 or later. + * Makefile.in: Regenerate. 2003-04-27 Daniel Jacobowitz @@ -784,8 +2546,8 @@ 2003-01-07 Christopher Faylor - * configure.in: Add AC_PREREQ for consistency. - * configure: Regenerate. + * configure.in: Add AC_PREREQ for consistency. + * configure: Regenerate. 2003-01-06 Andrew Cagney @@ -956,9 +2718,9 @@ 2002-12-12 Jeff Johnston - * COPYING.NEWLIB: Update list of alternate Regent of California - licenses and discuss official revoking of advertising clause. - * COPYING.LIBGLOSS: Ditto. + * COPYING.NEWLIB: Update list of alternate Regent of California + licenses and discuss official revoking of advertising clause. + * COPYING.LIBGLOSS: Ditto. 2002-12-12 Alexandre Oliva @@ -3077,7 +4839,7 @@ Thu Jul 8 12:32:23 1999 John David Anglin Bad merge removed these two changes. Tue Apr 13 22:50:54 1999 Donn Terry (donn@interix.com) - Martin Heller (Ing.-Buero_Heller@t-online.de) + Martin Heller (Ing.-Buero_Heller@t-online.de) * config.guess (interix Alpha): Add. @@ -5386,8 +7148,8 @@ Mon Jun 24 15:01:12 1996 Joel Sherrill Sun Jun 23 22:41:54 1996 Geoffrey Noer * configure.in: enable dosrel for cygwin32-hosted builds, - remove diff from the list of things not buildable - via Canadian Cross + remove diff from the list of things not buildable + via Canadian Cross Sat Jun 22 11:39:01 1996 Jason Merrill diff --git a/contrib/binutils/MAINTAINERS b/contrib/binutils/MAINTAINERS index 71942684b28..b2077e7c26a 100644 --- a/contrib/binutils/MAINTAINERS +++ b/contrib/binutils/MAINTAINERS @@ -4,8 +4,12 @@ Please do not make ChangeLog entries. COPYING, COPYING.LIB, README http://gnu.org. -Makefile.in; configure; configure.in; src-release - Please notify the following of any committed patches. +Makefile.*; configure; configure.in; src-release + Any global maintainer can approve changes to these + files, but they should be aware that they need to + be kept in sync with their counterparts in the GCC + repository. Also please notify the following of + any committed patches: binutils@sources.redhat.com gdb-patches@sources.redhat.com @@ -21,8 +25,7 @@ cgen/; cgen parts of opcodes/, sim/ & include/ May need separate opcodes/ or sim/ approval for commits of regenerated files there. -config.guess; config.sub; dejagnu/config.guess; dejagnu/config.sub; -readline/support/config.sub; readline/support/config.guess +config.guess; config.sub; readline/support/config.{sub,guess} config: http://savannah.gnu.org/projects/config Patches to config-patches@gnu.org. Changes need to be done in tandem with the official CONFIG @@ -33,18 +36,13 @@ readline/support/config.sub; readline/support/config.guess binutils@sources.redhat.com gdb-patches@sources.redhat.com -dejagnu/ - dejagnu: http://www.gnu.org/software/dejagnu/ - Patches to bug-dejagnu@gnu.org - Avoid making changes to the local repository; please send - patches upstream. Important and approved patches can be - checked into the src repository, otheriwse patches will be - imported from the next release. +depcomp + Send bug reports and patches to bug-automake@gnu.org. -gdb/; mmalloc/; readline/; sim/; GDB's part of include/ & dejagnu/ - gdb: http://sources.redhat.com/gdb/ +gdb/; readline/; sim/; GDB's part of include/ + GDB: http://www.gnu.org/software/gdb/ Patches to gdb-patches@sources.redhat.com. - See also gdb/MAINTAINERS, sim/MAINTAINERS, mmalloc/MAINTAINERS. + See also gdb/MAINTAINERS and sim/MAINTAINERS. include/ See binutils/, gdb/, sid/, gcc/, libiberty/ etc. @@ -59,8 +57,8 @@ libiberty/; libiberty's part of include/ Otherwise, changes are automatically merged, usually within a day. -ltconfig; ltmain.sh - libtool: http://gnu.org +ltconfig; ltmain.sh; ltcf-*.sh + libtool: http://www.gnu.org/software/libtool/ Changes need to be done in tandem with the official LIBTOOL sources or submitted to the master file maintainer and brought in via a merge. @@ -80,7 +78,7 @@ newlib/; libgloss/ http://sources.redhat.com/newlib/ Patches to newlib@sources.redhat.com. -sid/; SID's part of cgen/ & dejagnu/ +sid/; SID's part of cgen/ sid: http://sources.redhat.com/sid/ Patches to sid@sources.redhat.com @@ -100,10 +98,17 @@ winsup/ General discussion cygwin@sources.redhat.com. See also winsup/MAINTAINERS. -expect/; config-ml.in; setup.com; missing; makefile.vms; utils/; -config/; config.if; makefile.vms; missing; ylwrap; mkdep; etc/; -install-sh; intl/ - Ask DJ Delorie after reading the libiberty entry. +config-ml.in; makefile.vms; mkdep; setup.com; +etc/; intl/; utils/; + Any global maintainer can approve changes to these + files and directories. + +compile; depcomp; install-sh; missing; ylwrap; +config/ + Any global maintainer can approve changes to these + files and directories, but they should be aware + that they need to be kept in sync with their + counterparts in the GCC repository. modules file Obviously changes to this file should not go through diff --git a/contrib/binutils/Makefile.def b/contrib/binutils/Makefile.def index 5a68098157b..4c58ab5a71f 100644 --- a/contrib/binutils/Makefile.def +++ b/contrib/binutils/Makefile.def @@ -4,7 +4,7 @@ AutoGen definitions Makefile.tpl; // Makefile.in is generated from Makefile.tpl by 'autogen Makefile.def'. // This file was originally written by Nathanael Nerode. // -// Copyright 2002, 2003 Free Software Foundation +// Copyright 2002, 2003, 2004, 2005, 2006 Free Software Foundation // // This file is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -18,21 +18,28 @@ AutoGen definitions Makefile.tpl; // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // "missing" indicates that that module doesn't supply // that recursive target in its Makefile. build_modules= { module= libiberty; }; +build_modules= { module= bison; }; +build_modules= { module= byacc; }; +build_modules= { module= flex; }; +build_modules= { module= m4; }; +build_modules= { module= texinfo; }; +build_modules= { module= fixincludes; + extra_configure_args='--target=$(target)'; }; host_modules= { module= ash; }; host_modules= { module= autoconf; }; host_modules= { module= automake; }; host_modules= { module= bash; }; -host_modules= { module= bfd; }; -host_modules= { module= opcodes; }; -host_modules= { module= binutils; }; +host_modules= { module= bfd; lib_path=.; bootstrap=true; }; +host_modules= { module= opcodes; lib_path=.; bootstrap=true; }; +host_modules= { module= binutils; bootstrap=true; }; host_modules= { module= bison; no_check_cross= true; }; host_modules= { module= byacc; no_check_cross= true; }; host_modules= { module= bzip2; }; @@ -44,8 +51,17 @@ host_modules= { module= fastjar; no_check_cross= true; }; host_modules= { module= fileutils; }; host_modules= { module= findutils; }; host_modules= { module= find; }; +host_modules= { module= fixincludes; + missing= info; + missing= dvi; + missing= TAGS; + missing= install-info; + missing= installcheck; }; host_modules= { module= flex; no_check_cross= true; }; -host_modules= { module= gas; }; +host_modules= { module= gas; bootstrap=true; }; +host_modules= { module= gcc; bootstrap=true; + target="`if [ -f stage_last ]; then echo quickstrap ; else echo all; fi`"; + extra_make_flags="$(EXTRA_GCC_FLAGS)"; }; host_modules= { module= gawk; }; host_modules= { module= gettext; }; host_modules= { module= gnuserv; }; @@ -53,13 +69,15 @@ host_modules= { module= gprof; }; host_modules= { module= gzip; }; host_modules= { module= hello; }; host_modules= { module= indent; }; -host_modules= { module= intl; }; +host_modules= { module= intl; bootstrap=true; }; host_modules= { module= tcl; missing=mostlyclean; }; host_modules= { module= itcl; }; -host_modules= { module= ld; }; +host_modules= { module= ld; bootstrap=true; }; +host_modules= { module= libcpp; bootstrap=true; }; +host_modules= { module= libdecnumber; bootstrap=true; }; host_modules= { module= libgui; }; -host_modules= { module= libiberty; }; +host_modules= { module= libiberty; bootstrap=true; }; host_modules= { module= libtool; }; host_modules= { module= m4; }; host_modules= { module= make; }; @@ -83,24 +101,27 @@ host_modules= { module= time; }; host_modules= { module= uudecode; }; host_modules= { module= wdiff; }; host_modules= { module= zip; no_check_cross=true; }; -host_modules= { module= zlib; no_install=true; no_check=true; }; -host_modules= { module= gdb; with_x=true; }; -host_modules= { module= expect; with_x=true; }; -host_modules= { module= guile; with_x=true; }; -host_modules= { module= tk; with_x=true; }; -host_modules= { module= tix; with_x=true; }; +host_modules= { module= zlib; no_install=true; no_check=true; bootstrap=true; }; +host_modules= { module= gdb; extra_make_flags="$(X11_FLAGS_TO_PASS)"; }; +host_modules= { module= expect; extra_make_flags="$(X11_FLAGS_TO_PASS)"; }; +host_modules= { module= guile; extra_make_flags="$(X11_FLAGS_TO_PASS)"; }; +host_modules= { module= tk; extra_make_flags="$(X11_FLAGS_TO_PASS)"; }; host_modules= { module= libtermcap; no_check=true; missing=mostlyclean; missing=clean; missing=distclean; missing=maintainer-clean; }; host_modules= { module= utils; no_check=true; }; +host_modules= { module= gnattools; }; -target_modules = { module= libstdc++-v3; raw_cxx=true; }; +target_modules = { module= libstdc++-v3; lib_path=.libs; raw_cxx=true; }; +target_modules = { module= libmudflap; lib_path=.libs; }; +target_modules = { module= libssp; lib_path=.libs; }; +target_modules = { module= libgcc-math; lib_path=.libs; }; target_modules = { module= newlib; }; -target_modules = { module= libf2c; }; +target_modules = { module= libgfortran; }; target_modules = { module= libobjc; }; -target_modules = { module= libtermcap; no_check=true; stage=true; +target_modules = { module= libtermcap; no_check=true; missing=mostlyclean; missing=clean; missing=distclean; @@ -112,11 +133,12 @@ target_modules = { module= gperf; }; target_modules = { module= examples; no_check=true; no_install=true; }; target_modules = { module= libffi; }; target_modules = { module= libjava; raw_cxx=true; }; -target_modules = { module= zlib; stage=true; }; +target_modules = { module= zlib; }; target_modules = { module= boehm-gc; }; target_modules = { module= qthreads; }; target_modules = { module= rda; }; target_modules = { module= libada; }; +target_modules = { module= libgomp; lib_path=.libs; }; // These are (some of) the make targets to be done in each subdirectory. // Not all; these are the ones which don't have special options. @@ -126,11 +148,16 @@ recursive_targets = { make_target= info; depend=configure; }; recursive_targets = { make_target= dvi; depend=configure; }; +recursive_targets = { make_target= html; + depend=configure; }; recursive_targets = { make_target= TAGS; depend=configure; }; recursive_targets = { make_target= install-info; depend=configure; depend=info; }; +recursive_targets = { make_target= install-html; + depend=configure; + depend=html; }; recursive_targets = { make_target= installcheck; depend=configure; }; recursive_targets = { make_target= mostlyclean; }; @@ -148,12 +175,13 @@ flags_to_pass = { flag= bindir ; }; flags_to_pass = { flag= datadir ; }; flags_to_pass = { flag= exec_prefix ; }; flags_to_pass = { flag= includedir ; }; +flags_to_pass = { flag= datarootdir ; }; +flags_to_pass = { flag= docdir ; }; flags_to_pass = { flag= infodir ; }; +flags_to_pass = { flag= htmldir ; }; flags_to_pass = { flag= libdir ; }; flags_to_pass = { flag= libexecdir ; }; flags_to_pass = { flag= lispdir ; }; -flags_to_pass = { flag= libstdcxx_incdir ; }; -flags_to_pass = { flag= libsubdir ; }; flags_to_pass = { flag= localstatedir ; }; flags_to_pass = { flag= mandir ; }; flags_to_pass = { flag= oldincludedir ; }; @@ -163,16 +191,15 @@ flags_to_pass = { flag= sharedstatedir ; }; flags_to_pass = { flag= sysconfdir ; }; flags_to_pass = { flag= tooldir ; }; flags_to_pass = { flag= build_tooldir ; }; -flags_to_pass = { flag= gxx_include_dir ; }; -flags_to_pass = { flag= gcc_version ; }; -flags_to_pass = { flag= gcc_version_trigger ; }; flags_to_pass = { flag= target_alias ; }; // Build tools flags_to_pass = { flag= BISON ; }; flags_to_pass = { flag= CC_FOR_BUILD ; }; +flags_to_pass = { flag= CFLAGS_FOR_BUILD ; }; flags_to_pass = { flag= CXX_FOR_BUILD ; }; flags_to_pass = { flag= EXPECT ; }; +flags_to_pass = { flag= FLEX ; }; flags_to_pass = { flag= INSTALL ; }; flags_to_pass = { flag= INSTALL_DATA ; }; flags_to_pass = { flag= INSTALL_PROGRAM ; }; @@ -186,25 +213,288 @@ flags_to_pass = { flag= SHELL ; }; flags_to_pass = { flag= YACC ; }; // Host tools +flags_to_pass = { flag= ADAFLAGS ; optional=true ; }; flags_to_pass = { flag= AR_FLAGS ; }; +flags_to_pass = { flag= BOOT_ADAFLAGS ; optional=true ; }; +flags_to_pass = { flag= BOOT_CFLAGS ; }; +flags_to_pass = { flag= BOOT_LDFLAGS ; }; flags_to_pass = { flag= CFLAGS ; }; flags_to_pass = { flag= CXXFLAGS ; }; flags_to_pass = { flag= LDFLAGS ; }; flags_to_pass = { flag= LIBCFLAGS ; }; flags_to_pass = { flag= LIBCXXFLAGS ; }; +flags_to_pass = { flag= STAGE1_CFLAGS ; }; +flags_to_pass = { flag= STAGE1_LANGUAGES ; }; // Target tools flags_to_pass = { flag= AR_FOR_TARGET ; }; flags_to_pass = { flag= AS_FOR_TARGET ; }; flags_to_pass = { flag= CC_FOR_TARGET ; }; flags_to_pass = { flag= CFLAGS_FOR_TARGET ; }; +flags_to_pass = { flag= CPPFLAGS_FOR_TARGET ; }; flags_to_pass = { flag= CXX_FOR_TARGET ; }; flags_to_pass = { flag= CXXFLAGS_FOR_TARGET ; }; flags_to_pass = { flag= DLLTOOL_FOR_TARGET ; }; flags_to_pass = { flag= GCJ_FOR_TARGET ; }; +flags_to_pass = { flag= GFORTRAN_FOR_TARGET ; }; flags_to_pass = { flag= LD_FOR_TARGET ; }; +flags_to_pass = { flag= LIPO_FOR_TARGET ; }; +flags_to_pass = { flag= LDFLAGS_FOR_TARGET ; }; flags_to_pass = { flag= LIBCFLAGS_FOR_TARGET ; }; flags_to_pass = { flag= LIBCXXFLAGS_FOR_TARGET ; }; flags_to_pass = { flag= NM_FOR_TARGET ; }; +flags_to_pass = { flag= OBJDUMP_FOR_TARGET ; }; flags_to_pass = { flag= RANLIB_FOR_TARGET ; }; +flags_to_pass = { flag= STRIP_FOR_TARGET ; }; flags_to_pass = { flag= WINDRES_FOR_TARGET ; }; + +// Miscellaneous +flags_to_pass = { flag= LANGUAGES ; optional=true ; }; +flags_to_pass = { flag= LEAN ; }; + +// Inter-module dependencies + +// Build modules +dependencies = { module=all-build-bison; on=all-build-texinfo; }; +dependencies = { module=all-build-byacc; on=all-build-texinfo; }; +dependencies = { module=all-build-flex; on=all-build-texinfo; }; +dependencies = { module=all-build-flex; on=all-build-bison; }; +dependencies = { module=all-build-flex; on=all-build-byacc; }; +dependencies = { module=all-build-flex; on=all-build-m4; }; +dependencies = { module=all-build-libiberty; on=all-build-texinfo; }; +dependencies = { module=all-build-m4; on=all-build-texinfo; }; +dependencies = { module=all-build-fixincludes; on=all-build-libiberty; }; + +// Host modules specific to gcc. +dependencies = { module=configure-gcc; on=configure-intl; }; +dependencies = { module=configure-gcc; on=all-binutils; }; +dependencies = { module=configure-gcc; on=all-gas; }; +dependencies = { module=configure-gcc; on=all-ld; }; +dependencies = { module=all-gcc; on=all-libiberty; hard=true; }; +dependencies = { module=all-gcc; on=all-intl; }; +dependencies = { module=all-gcc; on=all-build-texinfo; }; +dependencies = { module=all-gcc; on=all-build-bison; }; +dependencies = { module=all-gcc; on=all-build-byacc; }; +dependencies = { module=all-gcc; on=all-build-flex; }; +dependencies = { module=all-gcc; on=all-build-libiberty; }; +dependencies = { module=all-gcc; on=all-build-fixincludes; }; +dependencies = { module=all-gcc; on=all-zlib; }; +dependencies = { module=all-gcc; on=all-libcpp; hard=true; }; +dependencies = { module=all-gcc; on=all-libdecnumber; hard=true; }; +dependencies = { module=all-gcc; on=all-libiberty; }; +dependencies = { module=all-gcc; on=all-fixincludes; }; +dependencies = { module=install-gcc ; on=install-fixincludes; }; + +dependencies = { module=configure-libcpp; on=configure-libiberty; hard=true; }; +dependencies = { module=configure-libcpp; on=configure-intl; }; +dependencies = { module=all-libcpp; on=all-libiberty; hard=true; }; +dependencies = { module=all-libcpp; on=all-intl; }; + +dependencies = { module=all-fixincludes; on=all-libiberty; }; + +dependencies = { module=all-gnattools; on=all-target-libada; }; + +// Host modules specific to gdb. +dependencies = { module=configure-gdb; on=configure-sim; }; +dependencies = { module=all-gdb; on=all-libiberty; }; +dependencies = { module=all-gdb; on=all-opcodes; }; +dependencies = { module=all-gdb; on=all-bfd; }; +dependencies = { module=all-gdb; on=all-readline; }; +dependencies = { module=all-gdb; on=all-build-bison; }; +dependencies = { module=all-gdb; on=all-build-byacc; }; +dependencies = { module=all-gdb; on=all-sim; }; + +dependencies = { module=configure-libgui; on=configure-tcl; }; +dependencies = { module=configure-libgui; on=configure-tk; }; +dependencies = { module=all-libgui; on=all-tcl; }; +dependencies = { module=all-libgui; on=all-tk; }; +dependencies = { module=all-libgui; on=all-itcl; }; + +// Host modules specific to binutils. +dependencies = { module=configure-bfd; on=configure-libiberty; hard=true; }; +dependencies = { module=all-bfd; on=all-libiberty; }; +dependencies = { module=all-bfd; on=all-intl; }; + +dependencies = { module=all-binutils; on=all-libiberty; }; +dependencies = { module=all-binutils; on=all-opcodes; }; +dependencies = { module=all-binutils; on=all-bfd; }; +dependencies = { module=all-binutils; on=all-build-flex; }; +dependencies = { module=all-binutils; on=all-build-bison; }; +dependencies = { module=all-binutils; on=all-build-byacc; }; +dependencies = { module=all-binutils; on=all-intl; }; + +// We put install-opcodes before install-binutils because the installed +// binutils might be on PATH, and they might need the shared opcodes +// library. +dependencies = { module=install-binutils; on=install-opcodes; }; + +// libopcodes depends on libbfd +dependencies = { module=install-opcodes; on=install-bfd; }; + +dependencies = { module=all-gas; on=all-libiberty; }; +dependencies = { module=all-gas; on=all-opcodes; }; +dependencies = { module=all-gas; on=all-bfd; }; +dependencies = { module=all-gas; on=all-intl; }; +dependencies = { module=all-gprof; on=all-libiberty; }; +dependencies = { module=all-gprof; on=all-bfd; }; +dependencies = { module=all-gprof; on=all-opcodes; }; +dependencies = { module=all-gprof; on=all-intl; }; +dependencies = { module=all-ld; on=all-libiberty; }; +dependencies = { module=all-ld; on=all-bfd; }; +dependencies = { module=all-ld; on=all-opcodes; }; +dependencies = { module=all-ld; on=all-build-bison; }; +dependencies = { module=all-ld; on=all-build-byacc; }; +dependencies = { module=all-ld; on=all-build-flex; }; +dependencies = { module=all-ld; on=all-intl; }; + +dependencies = { module=all-opcodes; on=all-bfd; }; +dependencies = { module=all-opcodes; on=all-libiberty; }; + +// Other host modules in the 'src' repository. +dependencies = { module=all-dejagnu; on=all-tcl; }; +dependencies = { module=all-dejagnu; on=all-expect; }; +dependencies = { module=all-dejagnu; on=all-tk; }; +dependencies = { module=configure-expect; on=configure-tcl; }; +dependencies = { module=configure-expect; on=configure-tk; }; +dependencies = { module=all-expect; on=all-tcl; }; +dependencies = { module=all-expect; on=all-tk; }; + +// We put install-tcl before install-itcl because itcl wants to run a +// program on installation which uses the Tcl libraries. +dependencies = { module=configure-itcl; on=configure-tcl; }; +dependencies = { module=configure-itcl; on=configure-tk; }; +dependencies = { module=all-itcl; on=all-tcl; }; +dependencies = { module=all-itcl; on=all-tk; }; +dependencies = { module=install-itcl; on=install-tcl; }; + +dependencies = { module=configure-tk; on=configure-tcl; }; +dependencies = { module=all-tk; on=all-tcl; }; + +dependencies = { module=all-sid; on=all-libiberty; }; +dependencies = { module=all-sid; on=all-bfd; }; +dependencies = { module=all-sid; on=all-opcodes; }; +dependencies = { module=all-sid; on=all-tcl; }; +dependencies = { module=all-sid; on=all-tk; }; +dependencies = { module=install-sid; on=install-tcl; }; +dependencies = { module=install-sid; on=install-tk; }; + +dependencies = { module=all-sim; on=all-libiberty; }; +dependencies = { module=all-sim; on=all-bfd; }; +dependencies = { module=all-sim; on=all-opcodes; }; +dependencies = { module=all-sim; on=all-readline; }; +dependencies = { module=all-sim; on=configure-gdb; }; + +// Other host modules. +dependencies = { module=all-fastjar; on=all-zlib; }; +dependencies = { module=all-fastjar; on=all-build-texinfo; }; +dependencies = { module=all-fastjar; on=all-libiberty; }; + +// Warning, these are not well tested. +dependencies = { module=all-autoconf; on=all-m4; }; +dependencies = { module=all-autoconf; on=all-build-texinfo; }; +dependencies = { module=all-automake; on=all-m4; }; +dependencies = { module=all-automake; on=all-build-texinfo; }; +dependencies = { module=all-automake; on=all-autoconf; }; +dependencies = { module=all-bison; on=all-intl; }; +dependencies = { module=all-bison; on=all-build-texinfo; }; +dependencies = { module=all-diff; on=all-intl; }; +dependencies = { module=all-diff; on=all-build-texinfo; }; +dependencies = { module=all-fileutils; on=all-intl; }; +dependencies = { module=all-fileutils; on=all-build-texinfo; }; +dependencies = { module=all-flex; on=all-build-bison; }; +dependencies = { module=all-flex; on=all-build-byacc; }; +dependencies = { module=all-flex; on=all-intl; }; +dependencies = { module=all-flex; on=all-m4; }; +dependencies = { module=all-flex; on=all-build-texinfo; }; +dependencies = { module=all-gzip; on=all-intl; }; +dependencies = { module=all-gzip; on=all-zlib; }; +dependencies = { module=all-gzip; on=all-build-texinfo; }; +dependencies = { module=all-hello; on=all-intl; }; +dependencies = { module=all-hello; on=all-build-texinfo; }; +dependencies = { module=all-m4; on=all-intl; }; +dependencies = { module=all-m4; on=all-build-texinfo; }; +dependencies = { module=all-make; on=all-intl; }; +dependencies = { module=all-make; on=all-build-texinfo; }; +dependencies = { module=all-patch; on=all-build-texinfo; }; +dependencies = { module=all-make; on=all-build-texinfo; }; +dependencies = { module=all-prms; on=all-libiberty; }; +dependencies = { module=all-recode; on=all-build-texinfo; }; +dependencies = { module=all-sed; on=all-build-texinfo; }; +dependencies = { module=all-send-pr; on=all-prms; }; +dependencies = { module=all-tar; on=all-build-texinfo; }; +dependencies = { module=all-uudecode; on=all-build-texinfo; }; + +// Target modules. These can also have dependencies on the language +// environment (e.g. on libstdc++). +lang_env_dependencies = { module=boehm-gc; }; +lang_env_dependencies = { module=gperf; cxx=true; }; +lang_env_dependencies = { module=libada; }; +lang_env_dependencies = { module=libgfortran; }; +lang_env_dependencies = { module=libffi; }; +lang_env_dependencies = { module=libjava; cxx=true; }; +lang_env_dependencies = { module=libmudflap; }; +lang_env_dependencies = { module=libobjc; }; +lang_env_dependencies = { module=libssp; }; +lang_env_dependencies = { module=libstdc++-v3; }; +lang_env_dependencies = { module=zlib; }; + +dependencies = { module=configure-target-boehm-gc; on=configure-target-qthreads; }; +dependencies = { module=configure-target-fastjar; on=configure-target-zlib; }; +dependencies = { module=all-target-fastjar; on=all-target-zlib; }; +dependencies = { module=all-target-fastjar; on=all-target-libiberty; }; +dependencies = { module=configure-target-libjava; on=configure-target-zlib; }; +dependencies = { module=configure-target-libjava; on=configure-target-boehm-gc; }; +dependencies = { module=configure-target-libjava; on=configure-target-qthreads; }; +dependencies = { module=configure-target-libjava; on=configure-target-libffi; }; +dependencies = { module=all-target-libjava; on=all-fastjar; }; +dependencies = { module=all-target-libjava; on=all-target-zlib; }; +dependencies = { module=all-target-libjava; on=all-target-boehm-gc; }; +dependencies = { module=all-target-libjava; on=all-target-qthreads; }; +dependencies = { module=all-target-libjava; on=all-target-libffi; }; +dependencies = { module=all-target-libobjc; on=all-target-libiberty; }; +dependencies = { module=all-target-libstdc++-v3; on=all-target-libiberty; }; + +// Target modules in the 'src' repository. +lang_env_dependencies = { module=examples; }; +lang_env_dependencies = { module=libtermcap; }; +lang_env_dependencies = { module=rda; }; +lang_env_dependencies = { module=winsup; }; +lang_env_dependencies = { module=qthreads; }; + +dependencies = { module=all-target-libgloss; on=configure-target-newlib; }; +dependencies = { module=all-target-winsup; on=all-target-libiberty; }; +dependencies = { module=all-target-winsup; on=all-target-libtermcap; }; + +// Toplevel bootstrap +bootstrap_stage = { + id=1 ; + stage_configure_flags='--disable-intermodule \ + --disable-coverage --enable-languages="$(STAGE1_LANGUAGES)"' ; + stage_make_flags='CFLAGS="$(STAGE1_CFLAGS)" LIBCFLAGS="$(STAGE1_CFLAGS)"' ; }; +bootstrap_stage = { + id=2 ; prev=1 ; + bootstrap_target=bootstrap2 ; + stage_configure_flags="@stage2_werror_flag@" ; + stage_make_flags="" ; }; +bootstrap_stage = { + id=3 ; prev=2 ; lean=1 ; + compare_target=compare ; + bootstrap_target=bootstrap ; + cleanstrap_target=cleanstrap ; + stage_configure_flags="@stage2_werror_flag@" ; + stage_make_flags="" ; }; +bootstrap_stage = { + id=4 ; prev=3 ; lean=2 ; + compare_target=compare3 ; + bootstrap_target=bootstrap4 ; + stage_configure_flags="@stage2_werror_flag@" ; + stage_make_flags="" ; }; +bootstrap_stage = { + id=profile ; prev=1 ; + stage_configure_flags="@stage2_werror_flag@" ; + stage_make_flags='CFLAGS="$(BOOT_CFLAGS) -fprofile-generate"' ; }; +bootstrap_stage = { + id=feedback ; prev=profile ; + bootstrap_target=profiledbootstrap ; + stage_configure_flags="@stage2_werror_flag@" ; + stage_make_flags='CFLAGS="$(BOOT_CFLAGS) -fprofile-use"' ; }; diff --git a/contrib/binutils/Makefile.in b/contrib/binutils/Makefile.in index 2acda0180b8..2d0da2e7c3c 100644 --- a/contrib/binutils/Makefile.in +++ b/contrib/binutils/Makefile.in @@ -3,7 +3,7 @@ # # Makefile for directory with subdirs to build. # Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, -# 1999, 2000, 2001, 2002, 2003 Free Software Foundation +# 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -17,7 +17,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # ------------------------------- @@ -50,6 +50,9 @@ libdir = @libdir@ includedir = @includedir@ oldincludedir = @oldincludedir@ infodir = @infodir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +htmldir = @htmldir@ mandir = @mandir@ man1dir = $(mandir)/man1 man2dir = $(mandir)/man2 @@ -65,65 +68,158 @@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_DATA = @INSTALL_DATA@ +LN = @LN@ +LN_S = @LN_S@ # ------------------------------------------------- # Miscellaneous non-standard autoconf-set variables # ------------------------------------------------- -links=@configlinks@ -# The file containing GCC's version number. -gcc_version_trigger = @gcc_version_trigger@ -gcc_version = @gcc_version@ - # The gcc driver likes to know the arguments it was configured with. TOPLEVEL_CONFIGURE_ARGUMENTS=@TOPLEVEL_CONFIGURE_ARGUMENTS@ -gxx_include_dir = @gxx_include_dir@ -libstdcxx_incdir = @libstdcxx_incdir@ - tooldir = @tooldir@ build_tooldir = @build_tooldir@ -# Directory in which the compiler finds executables, libraries, etc. -libsubdir = $(libdir)/gcc/$(target_alias)/$(gcc_version) GDB_NLM_DEPS = # This is the name of the environment variable used for the path to # the libraries. RPATH_ENVVAR = @RPATH_ENVVAR@ -# This is set by configure to REALLY_SET_LIB_PATH if --enable-shared -# was used. -SET_LIB_PATH = @SET_LIB_PATH@ - -# configure.in sets SET_LIB_PATH to this if --enable-shared was used. -# Some platforms don't like blank entries, so we remove duplicate, -# leading and trailing colons. -REALLY_SET_LIB_PATH = \ - $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH):$(TARGET_LIB_PATH):$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); - -# This is the list of directories to be built for the build system. -BUILD_CONFIGDIRS = libiberty # Build programs are put under this directory. BUILD_SUBDIR = @build_subdir@ # This is set by the configure script to the arguments to use when configuring # directories built for the build system. -BUILD_CONFIGARGS = @build_configargs@ +BUILD_CONFIGARGS = @build_configargs@ --with-build-subdir="$(BUILD_SUBDIR)" + +# This is the list of variables to export in the environment when +# configuring any subdirectory. It must also be exported whenever +# recursing into a build directory in case that directory's Makefile +# re-runs configure. +BASE_EXPORTS = \ + FLEX="$(FLEX)"; export FLEX; \ + LEX="$(LEX)"; export LEX; \ + BISON="$(BISON)"; export BISON; \ + YACC="$(YACC)"; export YACC; \ + M4="$(M4)"; export M4; \ + MAKEINFO="$(MAKEINFO)"; export MAKEINFO; + +# This is the list of variables to export in the environment when +# configuring subdirectories for the build system. +BUILD_EXPORTS = \ + $(BASE_EXPORTS) \ + AR="$(AR_FOR_BUILD)"; export AR; \ + AS="$(AS_FOR_BUILD)"; export AS; \ + CC="$(CC_FOR_BUILD)"; export CC; \ + CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ + CXX="$(CXX_FOR_BUILD)"; export CXX; \ + CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \ + GCJ="$(GCJ_FOR_BUILD)"; export GCJ; \ + GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \ + DLLTOOL="$(DLLTOOL_FOR_BUILD)"; export DLLTOOL; \ + LD="$(LD_FOR_BUILD)"; export LD; \ + LDFLAGS="$(LDFLAGS_FOR_BUILD)"; export LDFLAGS; \ + NM="$(NM_FOR_BUILD)"; export NM; \ + RANLIB="$(RANLIB_FOR_BUILD)"; export RANLIB; \ + WINDRES="$(WINDRES_FOR_BUILD)"; export WINDRES; # This is the list of directories to built for the host system. SUBDIRS = @configdirs@ # This is set by the configure script to the arguments to use when configuring # directories built for the host system. HOST_CONFIGARGS = @host_configargs@ +# Host programs are put under this directory, which is . except if building +# with srcdir=.. +HOST_SUBDIR = @host_subdir@ +# This is the list of variables to export in the environment when +# configuring subdirectories for the host system. We need to pass +# some to the GCC configure because of its hybrid host/target nature. +HOST_EXPORTS = \ + $(BASE_EXPORTS) \ + CC="$(CC)"; export CC; \ + CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ + CXX="$(CXX)"; export CXX; \ + CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ + AR_FOR_TARGET="$(AR_FOR_TARGET)"; export AR_FOR_TARGET; \ + AS_FOR_TARGET="$(AS_FOR_TARGET)"; export AS_FOR_TARGET; \ + GCC_FOR_TARGET="$(GCC_FOR_TARGET)"; export GCC_FOR_TARGET; \ + LD_FOR_TARGET="$(LD_FOR_TARGET)"; export LD_FOR_TARGET; \ + NM_FOR_TARGET="$(NM_FOR_TARGET)"; export NM_FOR_TARGET; \ + OBJDUMP_FOR_TARGET="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP_FOR_TARGET; \ + RANLIB_FOR_TARGET="$(RANLIB_FOR_TARGET)"; export RANLIB_FOR_TARGET; \ + TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \ + GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \ + GMPINC="$(HOST_GMPINC)"; export GMPINC; \ +@if gcc-bootstrap + $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \ +@endif gcc-bootstrap + $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); + +# Similar, for later GCC stages. +POSTSTAGE1_HOST_EXPORTS = \ + $(HOST_EXPORTS) \ + CC="$(STAGE_CC_WRAPPER) $$r/$(HOST_SUBDIR)/prev-gcc/xgcc$(exeext) \ + -B$$r/$(HOST_SUBDIR)/prev-gcc/ -B$(build_tooldir)/bin/"; export CC; \ + CC_FOR_BUILD="$(STAGE_CC_WRAPPER) \ + $$r/$(HOST_SUBDIR)/prev-gcc/xgcc$(exeext) \ + -B$$r/$(HOST_SUBDIR)/prev-gcc/ \ + -B$(build_tooldir)/bin/"; export CC_FOR_BUILD; -# This is set by the configure script to the list of directories which -# should be built using the target tools. -TARGET_CONFIGDIRS = @target_configdirs@ # Target libraries are put under this directory: TARGET_SUBDIR = @target_subdir@ # This is set by the configure script to the arguments to use when configuring # directories built for the target. -TARGET_CONFIGARGS = @target_configargs@ +TARGET_CONFIGARGS = @target_configargs@ --with-target-subdir="$(TARGET_SUBDIR)" +# This is the list of variables to export in the environment when +# configuring subdirectories for the host system. +BASE_TARGET_EXPORTS = \ + $(BASE_EXPORTS) \ + AR="$(AR_FOR_TARGET)"; export AR; \ + AS="$(COMPILER_AS_FOR_TARGET)"; export AS; \ + CC="$(CC_FOR_TARGET)"; export CC; \ + CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ + CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \ + CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \ + GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \ + GFORTRAN="$(GFORTRAN_FOR_TARGET)"; export GFORTRAN; \ + DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \ + LD="$(COMPILER_LD_FOR_TARGET)"; export LD; \ + LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \ + LIPO="$(LIPO_FOR_TARGET)"; export LIPO; \ + NM="$(COMPILER_NM_FOR_TARGET)"; export NM; \ + OBJDUMP="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP; \ + RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \ + STRIP="$(STRIP_FOR_TARGET)"; export STRIP; \ + WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \ + $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); + +RAW_CXX_TARGET_EXPORTS = \ + $(BASE_TARGET_EXPORTS) \ + CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \ + CXX="$(RAW_CXX_FOR_TARGET)"; export CXX; + +NORMAL_TARGET_EXPORTS = \ + $(BASE_TARGET_EXPORTS) \ + CXX="$(CXX_FOR_TARGET)"; export CXX; + +# Where to find GMP +HOST_GMPLIBS = @gmplibs@ +HOST_GMPINC = @gmpinc@ # ---------------------------------------------- # Programs producing files for the BUILD machine @@ -151,42 +247,19 @@ CXX_FOR_BUILD = $(CXX) BUILD_PREFIX = @BUILD_PREFIX@ BUILD_PREFIX_1 = @BUILD_PREFIX_1@ -BISON=@BISON@ -USUAL_BISON = `if [ -f $$r/bison/bison ] ; then \ - echo $$r/bison/bison -L $$s/bison/ ; \ - else \ - echo bison ; \ - fi` +# Flags to pass to stage2 and later makes. They are defined +# here so that they can be overridden by Makefile fragments. +BOOT_CFLAGS= -g -O2 +BOOT_LDFLAGS= -DEFAULT_YACC = @DEFAULT_YACC@ -YACC=@YACC@ -USUAL_YACC = `if [ -f $$r/bison/bison ] ; then \ - echo $$r/bison/bison -y -L $$s/bison/ ; \ - elif [ -f $$r/byacc/byacc ] ; then \ - echo $$r/byacc/byacc ; \ - else \ - echo ${DEFAULT_YACC} ; \ - fi` - -DEFAULT_LEX = @DEFAULT_LEX@ -LEX=@LEX@ -USUAL_LEX = `if [ -f $$r/flex/flex ] ; \ - then echo $$r/flex/flex ; \ - else echo ${DEFAULT_LEX} ; fi` - -DEFAULT_M4 = @DEFAULT_M4@ -M4 = `if [ -f $$r/m4/m4 ] ; \ - then echo $$r/m4/m4 ; \ - else echo ${DEFAULT_M4} ; fi` - -# For an installed makeinfo, we require it to be from texinfo 4.2 or -# higher, else we use the "missing" dummy. -MAKEINFO=@MAKEINFO@ -USUAL_MAKEINFO = `if [ -f $$r/texinfo/makeinfo/makeinfo ] ; \ - then echo $$r/texinfo/makeinfo/makeinfo ; \ - else if (makeinfo --version \ - | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.[2-9]|[5-9])') >/dev/null 2>&1; \ - then echo makeinfo; else echo $$s/missing makeinfo; fi; fi` +BISON = @BISON@ +YACC = @YACC@ +FLEX = @FLEX@ +LEX = @LEX@ +M4 = @M4@ +MAKEINFO = @MAKEINFO@ +EXPECT = @EXPECT@ +RUNTEST = @RUNTEST@ # This just becomes part of the MAKEINFO definition passed down to # sub-makes. It lets flags be given on the command line while still @@ -194,177 +267,74 @@ USUAL_MAKEINFO = `if [ -f $$r/texinfo/makeinfo/makeinfo ] ; \ # (Default to avoid splitting info files by setting the threshold high.) MAKEINFOFLAGS = --split-size=5000000 -EXPECT = `if [ -f $$r/expect/expect ] ; \ - then echo $$r/expect/expect ; \ - else echo expect ; fi` - -RUNTEST = `if [ -f $$s/dejagnu/runtest ] ; \ - then echo $$s/dejagnu/runtest ; \ - else echo runtest ; fi` - # --------------------------------------------- # Programs producing files for the HOST machine # --------------------------------------------- -# This is the list of directories that may be needed in RPATH_ENVVAR -# so that programs built for the host machine work. -HOST_LIB_PATH = $$r/bfd:$$r/opcodes - AS = @AS@ - AR = @AR@ AR_FLAGS = rc - CC = @CC@ -CFLAGS = @CFLAGS@ -LIBCFLAGS = $(CFLAGS) - CXX = @CXX@ -CXXFLAGS = @CXXFLAGS@ -LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates - DLLTOOL = @DLLTOOL@ - -NM = @NM@ - LD = @LD@ -LDFLAGS = - +LIPO = @LIPO@ +NM = @NM@ +OBJDUMP = @OBJDUMP@ RANLIB = @RANLIB@ - +STRIP = @STRIP@ WINDRES = @WINDRES@ +CFLAGS = @CFLAGS@ +LDFLAGS = +LIBCFLAGS = $(CFLAGS) +CXXFLAGS = @CXXFLAGS@ +LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates PICFLAG = # ----------------------------------------------- # Programs producing files for the TARGET machine # ----------------------------------------------- -# This is the list of directories that may be needed in RPATH_ENVVAR -# so that prorgams built for the target machine work. -TARGET_LIB_PATH = $$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs: - FLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@ AR_FOR_TARGET=@AR_FOR_TARGET@ -USUAL_AR_FOR_TARGET = ` \ - if [ -f $$r/binutils/ar ] ; then \ - echo $$r/binutils/ar ; \ - else \ - if [ '$(host)' = '$(target)' ] ; then \ - echo $(AR); \ - else \ - echo ar | sed '$(program_transform_name)' ; \ - fi; \ - fi` - AS_FOR_TARGET=@AS_FOR_TARGET@ -USUAL_AS_FOR_TARGET = ` \ - if [ -f $$r/gas/as-new ] ; then \ - echo $$r/gas/as-new ; \ - elif [ -f $$r/gcc/xgcc ]; then \ - $(CC_FOR_TARGET) -print-prog-name=as ; \ - else \ - if [ '$(host)' = '$(target)' ] ; then \ - echo $(AS); \ - else \ - echo as | sed '$(program_transform_name)' ; \ - fi; \ - fi` +CC_FOR_TARGET=$(STAGE_CC_WRAPPER) @CC_FOR_TARGET@ $(FLAGS_FOR_TARGET) -CC_FOR_TARGET = @CC_FOR_TARGET@ -# During gcc bootstrap, if we use some random cc for stage1 then -# CFLAGS will be just -g. We want to ensure that TARGET libraries -# (which we know are built with gcc) are built with optimizations so -# prepend -O2 when setting CFLAGS_FOR_TARGET. -CFLAGS_FOR_TARGET = -O2 $(CFLAGS) # If GCC_FOR_TARGET is not overriden on the command line, then this # variable is passed down to the gcc Makefile, where it is used to # build libgcc2.a. We define it here so that it can itself be # overridden on the command line. -GCC_FOR_TARGET=@GCC_FOR_TARGET@ -USUAL_GCC_FOR_TARGET = $(STAGE_CC_WRAPPER) $$r/gcc/xgcc -B$$r/gcc/ $(FLAGS_FOR_TARGET) -LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET) - -CXX_FOR_TARGET = @CXX_FOR_TARGET@ -RAW_CXX_FOR_TARGET = @RAW_CXX_FOR_TARGET@ -CXX_FOR_TARGET_FOR_RECURSIVE_MAKE = @CXX_FOR_TARGET_FOR_RECURSIVE_MAKE@ -RAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE = @RAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE@ -CXXFLAGS_FOR_TARGET = $(CXXFLAGS) -LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates - +GCC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCC_FOR_TARGET@ $(FLAGS_FOR_TARGET) +CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @CXX_FOR_TARGET@ $(FLAGS_FOR_TARGET) +RAW_CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @RAW_CXX_FOR_TARGET@ $(FLAGS_FOR_TARGET) +GCJ_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCJ_FOR_TARGET@ $(FLAGS_FOR_TARGET) +GFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) @GFORTRAN_FOR_TARGET@ $(FLAGS_FOR_TARGET) DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@ -USUAL_DLLTOOL_FOR_TARGET = ` \ - if [ -f $$r/binutils/dlltool ] ; then \ - echo $$r/binutils/dlltool ; \ - else \ - if [ '$(host)' = '$(target)' ] ; then \ - echo $(DLLTOOL); \ - else \ - echo dlltool | sed '$(program_transform_name)' ; \ - fi; \ - fi` - -GCJ_FOR_TARGET = @GCJ_FOR_TARGET@ - LD_FOR_TARGET=@LD_FOR_TARGET@ -USUAL_LD_FOR_TARGET = ` \ - if [ -f $$r/ld/ld-new ] ; then \ - echo $$r/ld/ld-new ; \ - elif [ -f $$r/gcc/xgcc ]; then \ - $(CC_FOR_TARGET) -print-prog-name=ld ; \ - else \ - if [ '$(host)' = '$(target)' ] ; then \ - echo $(LD); \ - else \ - echo ld | sed '$(program_transform_name)' ; \ - fi; \ - fi` - -LDFLAGS_FOR_TARGET = +LIPO_FOR_TARGET=@LIPO_FOR_TARGET@ NM_FOR_TARGET=@NM_FOR_TARGET@ -USUAL_NM_FOR_TARGET = ` \ - if [ -f $$r/binutils/nm-new ] ; then \ - echo $$r/binutils/nm-new ; \ - elif [ -f $$r/gcc/xgcc ]; then \ - $(CC_FOR_TARGET) -print-prog-name=nm ; \ - else \ - if [ '$(host)' = '$(target)' ] ; then \ - echo $(NM); \ - else \ - echo nm | sed '$(program_transform_name)' ; \ - fi; \ - fi` - +OBJDUMP_FOR_TARGET=@OBJDUMP_FOR_TARGET@ RANLIB_FOR_TARGET=@RANLIB_FOR_TARGET@ -USUAL_RANLIB_FOR_TARGET = ` \ - if [ -f $$r/binutils/ranlib ] ; then \ - echo $$r/binutils/ranlib ; \ - else \ - if [ '$(host)' = '$(target)' ] ; then \ - if [ x'$(RANLIB)' != x ]; then \ - echo $(RANLIB); \ - else \ - echo ranlib; \ - fi; \ - else \ - echo ranlib | sed '$(program_transform_name)' ; \ - fi; \ - fi` - +STRIP_FOR_TARGET=@STRIP_FOR_TARGET@ WINDRES_FOR_TARGET=@WINDRES_FOR_TARGET@ -USUAL_WINDRES_FOR_TARGET = ` \ - if [ -f $$r/binutils/windres ] ; then \ - echo $$r/binutils/windres ; \ - else \ - if [ '$(host)' = '$(target)' ] ; then \ - echo $(WINDRES); \ - else \ - echo windres | sed '$(program_transform_name)' ; \ - fi; \ - fi` +COMPILER_AS_FOR_TARGET=@COMPILER_AS_FOR_TARGET@ +COMPILER_LD_FOR_TARGET=@COMPILER_LD_FOR_TARGET@ +COMPILER_NM_FOR_TARGET=@COMPILER_NM_FOR_TARGET@ + +# During gcc bootstrap, if we use some random cc for stage1 then +# CFLAGS will be just -g. We want to ensure that TARGET libraries +# (which we know are built with gcc) are built with optimizations so +# prepend -O2 when setting CFLAGS_FOR_TARGET. +CFLAGS_FOR_TARGET = -O2 $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET) +SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@ +CXXFLAGS_FOR_TARGET = $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET) +LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET) +LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates +LDFLAGS_FOR_TARGET = PICFLAG_FOR_TARGET = # ------------------------------------ @@ -373,8 +343,7 @@ PICFLAG_FOR_TARGET = # The first rule in the file had better be this one. Don't put any above it. # This lives here to allow makefile fragments to contain dependencies. -all: all.normal -.PHONY: all +all: #### host and target specific makefile fragments come in here. @target_makefile_frag@ @@ -383,6 +352,53 @@ all: all.normal @host_makefile_frag@ ### +# This is the list of directories that may be needed in RPATH_ENVVAR +# so that prorgams built for the target machine work. +TARGET_LIB_PATH = $(TARGET_LIB_PATH_libstdc++-v3)$(TARGET_LIB_PATH_libmudflap)$(TARGET_LIB_PATH_libssp)$(TARGET_LIB_PATH_libgcc-math)$(TARGET_LIB_PATH_libgomp)$(HOST_LIB_PATH_gcc) + +@if target-libstdc++-v3 +TARGET_LIB_PATH_libstdc++-v3 = $$r/$(TARGET_SUBDIR)/libstdc++-v3/.libs: +@endif target-libstdc++-v3 + +@if target-libmudflap +TARGET_LIB_PATH_libmudflap = $$r/$(TARGET_SUBDIR)/libmudflap/.libs: +@endif target-libmudflap + +@if target-libssp +TARGET_LIB_PATH_libssp = $$r/$(TARGET_SUBDIR)/libssp/.libs: +@endif target-libssp + +@if target-libgcc-math +TARGET_LIB_PATH_libgcc-math = $$r/$(TARGET_SUBDIR)/libgcc-math/.libs: +@endif target-libgcc-math + +@if target-libgomp +TARGET_LIB_PATH_libgomp = $$r/$(TARGET_SUBDIR)/libgomp/.libs: +@endif target-libgomp + + + +# This is the list of directories that may be needed in RPATH_ENVVAR +# so that programs built for the host machine work. +HOST_LIB_PATH = $(HOST_LIB_PATH_bfd)$(HOST_LIB_PATH_opcodes) + +# Define HOST_LIB_PATH_gcc here, for the sake of TARGET_LIB_PATH, ouch +@if gcc +HOST_LIB_PATH_gcc = $$r/$(HOST_SUBDIR)/gcc:$$r/$(HOST_SUBDIR)/prev-gcc: +@endif gcc + + +@if bfd +HOST_LIB_PATH_bfd = \ + $$r/$(HOST_SUBDIR)/bfd/.:$$r/$(HOST_SUBDIR)/prev-bfd/.: +@endif bfd + +@if opcodes +HOST_LIB_PATH_opcodes = \ + $$r/$(HOST_SUBDIR)/opcodes/.:$$r/$(HOST_SUBDIR)/prev-opcodes/.: +@endif opcodes + + # Flags to pass down to all sub-makes. BASE_FLAGS_TO_PASS = \ "DESTDIR=$(DESTDIR)" \ @@ -392,12 +408,13 @@ BASE_FLAGS_TO_PASS = \ "datadir=$(datadir)" \ "exec_prefix=$(exec_prefix)" \ "includedir=$(includedir)" \ + "datarootdir=$(datarootdir)" \ + "docdir=$(docdir)" \ "infodir=$(infodir)" \ + "htmldir=$(htmldir)" \ "libdir=$(libdir)" \ "libexecdir=$(libexecdir)" \ "lispdir=$(lispdir)" \ - "libstdcxx_incdir=$(libstdcxx_incdir)" \ - "libsubdir=$(libsubdir)" \ "localstatedir=$(localstatedir)" \ "mandir=$(mandir)" \ "oldincludedir=$(oldincludedir)" \ @@ -407,14 +424,13 @@ BASE_FLAGS_TO_PASS = \ "sysconfdir=$(sysconfdir)" \ "tooldir=$(tooldir)" \ "build_tooldir=$(build_tooldir)" \ - "gxx_include_dir=$(gxx_include_dir)" \ - "gcc_version=$(gcc_version)" \ - "gcc_version_trigger=$(gcc_version_trigger)" \ "target_alias=$(target_alias)" \ "BISON=$(BISON)" \ "CC_FOR_BUILD=$(CC_FOR_BUILD)" \ + "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \ "CXX_FOR_BUILD=$(CXX_FOR_BUILD)" \ "EXPECT=$(EXPECT)" \ + "FLEX=$(FLEX)" \ "INSTALL=$(INSTALL)" \ "INSTALL_DATA=$(INSTALL_DATA)" \ "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \ @@ -426,37 +442,45 @@ BASE_FLAGS_TO_PASS = \ "RUNTESTFLAGS=$(RUNTESTFLAGS)" \ "SHELL=$(SHELL)" \ "YACC=$(YACC)" \ + "`echo 'ADAFLAGS=$(ADAFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \ "AR_FLAGS=$(AR_FLAGS)" \ + "`echo 'BOOT_ADAFLAGS=$(BOOT_ADAFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \ + "BOOT_CFLAGS=$(BOOT_CFLAGS)" \ + "BOOT_LDFLAGS=$(BOOT_LDFLAGS)" \ "CFLAGS=$(CFLAGS)" \ "CXXFLAGS=$(CXXFLAGS)" \ "LDFLAGS=$(LDFLAGS)" \ "LIBCFLAGS=$(LIBCFLAGS)" \ "LIBCXXFLAGS=$(LIBCXXFLAGS)" \ + "STAGE1_CFLAGS=$(STAGE1_CFLAGS)" \ + "STAGE1_LANGUAGES=$(STAGE1_LANGUAGES)" \ "AR_FOR_TARGET=$(AR_FOR_TARGET)" \ "AS_FOR_TARGET=$(AS_FOR_TARGET)" \ "CC_FOR_TARGET=$(CC_FOR_TARGET)" \ "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \ + "CPPFLAGS_FOR_TARGET=$(CPPFLAGS_FOR_TARGET)" \ "CXX_FOR_TARGET=$(CXX_FOR_TARGET)" \ "CXXFLAGS_FOR_TARGET=$(CXXFLAGS_FOR_TARGET)" \ "DLLTOOL_FOR_TARGET=$(DLLTOOL_FOR_TARGET)" \ "GCJ_FOR_TARGET=$(GCJ_FOR_TARGET)" \ + "GFORTRAN_FOR_TARGET=$(GFORTRAN_FOR_TARGET)" \ "LD_FOR_TARGET=$(LD_FOR_TARGET)" \ + "LIPO_FOR_TARGET=$(LIPO_FOR_TARGET)" \ + "LDFLAGS_FOR_TARGET=$(LDFLAGS_FOR_TARGET)" \ "LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \ "LIBCXXFLAGS_FOR_TARGET=$(LIBCXXFLAGS_FOR_TARGET)" \ "NM_FOR_TARGET=$(NM_FOR_TARGET)" \ + "OBJDUMP_FOR_TARGET=$(OBJDUMP_FOR_TARGET)" \ "RANLIB_FOR_TARGET=$(RANLIB_FOR_TARGET)" \ + "STRIP_FOR_TARGET=$(STRIP_FOR_TARGET)" \ "WINDRES_FOR_TARGET=$(WINDRES_FOR_TARGET)" \ + "`echo 'LANGUAGES=$(LANGUAGES)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \ + "LEAN=$(LEAN)" \ "CONFIG_SHELL=$(SHELL)" \ "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" -# For any flags above that may contain shell code that varies from one -# target library to another. When doing recursive invocations of the -# top-level Makefile, we don't want the outer make to evaluate them, -# so we pass these variables down unchanged. They must not contain -# single nor double quotes. -RECURSE_FLAGS = \ - CXX_FOR_TARGET='$(CXX_FOR_TARGET_FOR_RECURSIVE_MAKE)' \ - RAW_CXX_FOR_TARGET='$(RAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE)' \ +# We leave this in just in case, but it is not needed anymore. +RECURSE_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) # Flags to pass down to most sub-makes, in which we're building with # the host environment. @@ -467,8 +491,11 @@ EXTRA_HOST_FLAGS = \ 'CXX=$(CXX)' \ 'DLLTOOL=$(DLLTOOL)' \ 'LD=$(LD)' \ + 'LIPO=$(LIPO)' \ 'NM=$(NM)' \ + 'OBJDUMP=$(OBJDUMP)' \ 'RANLIB=$(RANLIB)' \ + 'STRIP=$(STRIP)' \ 'WINDRES=$(WINDRES)' FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) @@ -486,20 +513,23 @@ X11_FLAGS_TO_PASS = \ 'X11_EXTRA_LIBS=$(X11_EXTRA_LIBS)' # Flags to pass down to makes which are built with the target environment. -# The double $ decreases the length of the command line; the variables -# are set in BASE_FLAGS_TO_PASS, and the sub-make will expand them. +# The double $ decreases the length of the command line; those variables +# are set in BASE_FLAGS_TO_PASS, and the sub-make will expand them. The +# COMPILER_ prefixed variables are not passed down so we expand them here. EXTRA_TARGET_FLAGS = \ 'AR=$$(AR_FOR_TARGET)' \ - 'AS=$$(AS_FOR_TARGET)' \ + 'AS=$(COMPILER_AS_FOR_TARGET)' \ 'CC=$$(CC_FOR_TARGET)' \ 'CFLAGS=$$(CFLAGS_FOR_TARGET)' \ 'CXX=$$(CXX_FOR_TARGET)' \ 'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \ 'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \ - 'LD=$$(LD_FOR_TARGET)' \ + 'LD=$(COMPILER_LD_FOR_TARGET)' \ + 'LDFLAGS=$$(LDFLAGS_FOR_TARGET)' \ 'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \ 'LIBCXXFLAGS=$$(LIBCXXFLAGS_FOR_TARGET)' \ - 'NM=$$(NM_FOR_TARGET)' \ + 'NM=$(COMPILER_NM_FOR_TARGET)' \ + 'OBJDUMP=$$(OBJDUMP_FOR_TARGET)' \ 'RANLIB=$$(RANLIB_FOR_TARGET)' \ 'WINDRES=$$(WINDRES_FOR_TARGET)' @@ -512,24 +542,17 @@ TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS) # The BUILD_* variables are a special case, which are used for the gcc # cross-building scheme. EXTRA_GCC_FLAGS = \ - 'BUILD_PREFIX=$(BUILD_PREFIX)' \ - 'BUILD_PREFIX_1=$(BUILD_PREFIX_1)' \ "GCC_FOR_TARGET=$(GCC_FOR_TARGET)" \ - "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \ - "`echo 'LANGUAGES=$(LANGUAGES)' | sed -e s/.*=$$/XFOO=/`" \ - "`echo 'STMP_FIXPROTO=$(STMP_FIXPROTO)' | sed -e s/.*=$$/XFOO=/`" \ - "`echo 'LIMITS_H_TEST=$(LIMITS_H_TEST)' | sed -e s/.*=$$/XFOO=/`" \ - "`echo 'LIBGCC2_CFLAGS=$(LIBGCC2_CFLAGS)' | sed -e s/.*=$$/XFOO=/`" \ - "`echo 'LIBGCC2_DEBUG_CFLAGS=$(LIBGCC2_DEBUG_CFLAGS)' | sed -e s/.*=$$/XFOO=/`" \ - "`echo 'LIBGCC2_INCLUDES=$(LIBGCC2_INCLUDES)' | sed -e s/.*=$$/XFOO=/`" \ - "`echo 'STAGE1_CFLAGS=$(STAGE1_CFLAGS)' | sed -e s/.*=$$/XFOO=/`" \ - "`echo 'BOOT_CFLAGS=$(BOOT_CFLAGS)' | sed -e s/.*=$$/XFOO=/`" \ - "`echo 'BOOT_ADAFLAGS=$(BOOT_ADAFLAGS)' | sed -e s/.*=$$/XFOO=/`" + "`echo 'STMP_FIXPROTO=$(STMP_FIXPROTO)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \ + "`echo 'LIMITS_H_TEST=$(LIMITS_H_TEST)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \ + "`echo 'LIBGCC2_CFLAGS=$(LIBGCC2_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \ + "`echo 'LIBGCC2_DEBUG_CFLAGS=$(LIBGCC2_DEBUG_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \ + "`echo 'LIBGCC2_INCLUDES=$(LIBGCC2_INCLUDES)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" GCC_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS) .PHONY: configure-host -configure-host: maybe-configure-gcc \ +configure-host: \ maybe-configure-ash \ maybe-configure-autoconf \ maybe-configure-automake \ @@ -548,8 +571,10 @@ configure-host: maybe-configure-gcc \ maybe-configure-fileutils \ maybe-configure-findutils \ maybe-configure-find \ + maybe-configure-fixincludes \ maybe-configure-flex \ maybe-configure-gas \ + maybe-configure-gcc \ maybe-configure-gawk \ maybe-configure-gettext \ maybe-configure-gnuserv \ @@ -561,6 +586,8 @@ configure-host: maybe-configure-gcc \ maybe-configure-tcl \ maybe-configure-itcl \ maybe-configure-ld \ + maybe-configure-libcpp \ + maybe-configure-libdecnumber \ maybe-configure-libgui \ maybe-configure-libiberty \ maybe-configure-libtool \ @@ -591,14 +618,17 @@ configure-host: maybe-configure-gcc \ maybe-configure-expect \ maybe-configure-guile \ maybe-configure-tk \ - maybe-configure-tix \ maybe-configure-libtermcap \ - maybe-configure-utils + maybe-configure-utils \ + maybe-configure-gnattools .PHONY: configure-target configure-target: \ maybe-configure-target-libstdc++-v3 \ + maybe-configure-target-libmudflap \ + maybe-configure-target-libssp \ + maybe-configure-target-libgcc-math \ maybe-configure-target-newlib \ - maybe-configure-target-libf2c \ + maybe-configure-target-libgfortran \ maybe-configure-target-libobjc \ maybe-configure-target-libtermcap \ maybe-configure-target-winsup \ @@ -612,97 +642,153 @@ configure-target: \ maybe-configure-target-boehm-gc \ maybe-configure-target-qthreads \ maybe-configure-target-rda \ - maybe-configure-target-libada + maybe-configure-target-libada \ + maybe-configure-target-libgomp -# The target built for a native build. -.PHONY: all.normal -all.normal: @all_build_modules@ all-host all-target +# The target built for a native non-bootstrap build. +.PHONY: all +all: +@if gcc-bootstrap + [ -f stage_final ] || echo stage3 > stage_final + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(MAKE) $(RECURSE_FLAGS_TO_PASS) `cat stage_final`-bubble +@endif gcc-bootstrap + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + if [ -f stage_last ]; then \ + $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target; \ + else \ + $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-host all-target; \ + fi + +.PHONY: all-build + +all-build: maybe-all-build-libiberty +all-build: maybe-all-build-bison +all-build: maybe-all-build-byacc +all-build: maybe-all-build-flex +all-build: maybe-all-build-m4 +all-build: maybe-all-build-texinfo +all-build: maybe-all-build-fixincludes .PHONY: all-host -all-host: maybe-all-gcc \ - maybe-all-ash \ - maybe-all-autoconf \ - maybe-all-automake \ - maybe-all-bash \ - maybe-all-bfd \ - maybe-all-opcodes \ - maybe-all-binutils \ - maybe-all-bison \ - maybe-all-byacc \ - maybe-all-bzip2 \ - maybe-all-dejagnu \ - maybe-all-diff \ - maybe-all-dosutils \ - maybe-all-etc \ - maybe-all-fastjar \ - maybe-all-fileutils \ - maybe-all-findutils \ - maybe-all-find \ - maybe-all-flex \ - maybe-all-gas \ - maybe-all-gawk \ - maybe-all-gettext \ - maybe-all-gnuserv \ - maybe-all-gprof \ - maybe-all-gzip \ - maybe-all-hello \ - maybe-all-indent \ - maybe-all-intl \ - maybe-all-tcl \ - maybe-all-itcl \ - maybe-all-ld \ - maybe-all-libgui \ - maybe-all-libiberty \ - maybe-all-libtool \ - maybe-all-m4 \ - maybe-all-make \ - maybe-all-mmalloc \ - maybe-all-patch \ - maybe-all-perl \ - maybe-all-prms \ - maybe-all-rcs \ - maybe-all-readline \ - maybe-all-release \ - maybe-all-recode \ - maybe-all-sed \ - maybe-all-send-pr \ - maybe-all-shellutils \ - maybe-all-sid \ - maybe-all-sim \ - maybe-all-tar \ - maybe-all-texinfo \ - maybe-all-textutils \ - maybe-all-time \ - maybe-all-uudecode \ - maybe-all-wdiff \ - maybe-all-zip \ - maybe-all-zlib \ - maybe-all-gdb \ - maybe-all-expect \ - maybe-all-guile \ - maybe-all-tk \ - maybe-all-tix \ - maybe-all-libtermcap \ - maybe-all-utils + +all-host: maybe-all-ash +all-host: maybe-all-autoconf +all-host: maybe-all-automake +all-host: maybe-all-bash +@if bfd-no-bootstrap +all-host: maybe-all-bfd +@endif bfd-no-bootstrap +@if opcodes-no-bootstrap +all-host: maybe-all-opcodes +@endif opcodes-no-bootstrap +@if binutils-no-bootstrap +all-host: maybe-all-binutils +@endif binutils-no-bootstrap +all-host: maybe-all-bison +all-host: maybe-all-byacc +all-host: maybe-all-bzip2 +all-host: maybe-all-dejagnu +all-host: maybe-all-diff +all-host: maybe-all-dosutils +all-host: maybe-all-etc +all-host: maybe-all-fastjar +all-host: maybe-all-fileutils +all-host: maybe-all-findutils +all-host: maybe-all-find +all-host: maybe-all-fixincludes +all-host: maybe-all-flex +@if gas-no-bootstrap +all-host: maybe-all-gas +@endif gas-no-bootstrap +@if gcc-no-bootstrap +all-host: maybe-all-gcc +@endif gcc-no-bootstrap +all-host: maybe-all-gawk +all-host: maybe-all-gettext +all-host: maybe-all-gnuserv +all-host: maybe-all-gprof +all-host: maybe-all-gzip +all-host: maybe-all-hello +all-host: maybe-all-indent +@if intl-no-bootstrap +all-host: maybe-all-intl +@endif intl-no-bootstrap +all-host: maybe-all-tcl +all-host: maybe-all-itcl +@if ld-no-bootstrap +all-host: maybe-all-ld +@endif ld-no-bootstrap +@if libcpp-no-bootstrap +all-host: maybe-all-libcpp +@endif libcpp-no-bootstrap +@if libdecnumber-no-bootstrap +all-host: maybe-all-libdecnumber +@endif libdecnumber-no-bootstrap +all-host: maybe-all-libgui +@if libiberty-no-bootstrap +all-host: maybe-all-libiberty +@endif libiberty-no-bootstrap +all-host: maybe-all-libtool +all-host: maybe-all-m4 +all-host: maybe-all-make +all-host: maybe-all-mmalloc +all-host: maybe-all-patch +all-host: maybe-all-perl +all-host: maybe-all-prms +all-host: maybe-all-rcs +all-host: maybe-all-readline +all-host: maybe-all-release +all-host: maybe-all-recode +all-host: maybe-all-sed +all-host: maybe-all-send-pr +all-host: maybe-all-shellutils +all-host: maybe-all-sid +all-host: maybe-all-sim +all-host: maybe-all-tar +all-host: maybe-all-texinfo +all-host: maybe-all-textutils +all-host: maybe-all-time +all-host: maybe-all-uudecode +all-host: maybe-all-wdiff +all-host: maybe-all-zip +@if zlib-no-bootstrap +all-host: maybe-all-zlib +@endif zlib-no-bootstrap +all-host: maybe-all-gdb +all-host: maybe-all-expect +all-host: maybe-all-guile +all-host: maybe-all-tk +all-host: maybe-all-libtermcap +all-host: maybe-all-utils +all-host: maybe-all-gnattools + .PHONY: all-target -all-target: \ - maybe-all-target-libstdc++-v3 \ - maybe-all-target-newlib \ - maybe-all-target-libf2c \ - maybe-all-target-libobjc \ - maybe-all-target-libtermcap \ - maybe-all-target-winsup \ - maybe-all-target-libgloss \ - maybe-all-target-libiberty \ - maybe-all-target-gperf \ - maybe-all-target-examples \ - maybe-all-target-libffi \ - maybe-all-target-libjava \ - maybe-all-target-zlib \ - maybe-all-target-boehm-gc \ - maybe-all-target-qthreads \ - maybe-all-target-rda \ - maybe-all-target-libada + +all-target: maybe-all-target-libstdc++-v3 +all-target: maybe-all-target-libmudflap +all-target: maybe-all-target-libssp +all-target: maybe-all-target-libgcc-math +all-target: maybe-all-target-newlib +all-target: maybe-all-target-libgfortran +all-target: maybe-all-target-libobjc +all-target: maybe-all-target-libtermcap +all-target: maybe-all-target-winsup +all-target: maybe-all-target-libgloss +all-target: maybe-all-target-libiberty +all-target: maybe-all-target-gperf +all-target: maybe-all-target-examples +all-target: maybe-all-target-libffi +all-target: maybe-all-target-libjava +all-target: maybe-all-target-zlib +all-target: maybe-all-target-boehm-gc +all-target: maybe-all-target-qthreads +all-target: maybe-all-target-rda +all-target: maybe-all-target-libada +all-target: maybe-all-target-libgomp # Do a target for all the subdirectories. A ``make do-X'' will do a # ``make X'' in all subdirectories (because, in general, there is a @@ -710,16733 +796,1159 @@ all-target: \ # but it may do additional work as well). .PHONY: do-info -do-info: info-host info-target +do-info: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(MAKE) $(RECURSE_FLAGS_TO_PASS) info-host \ + info-target + .PHONY: info-host -info-host: maybe-info-gcc \ - maybe-info-ash \ - maybe-info-autoconf \ - maybe-info-automake \ - maybe-info-bash \ - maybe-info-bfd \ - maybe-info-opcodes \ - maybe-info-binutils \ - maybe-info-bison \ - maybe-info-byacc \ - maybe-info-bzip2 \ - maybe-info-dejagnu \ - maybe-info-diff \ - maybe-info-dosutils \ - maybe-info-etc \ - maybe-info-fastjar \ - maybe-info-fileutils \ - maybe-info-findutils \ - maybe-info-find \ - maybe-info-flex \ - maybe-info-gas \ - maybe-info-gawk \ - maybe-info-gettext \ - maybe-info-gnuserv \ - maybe-info-gprof \ - maybe-info-gzip \ - maybe-info-hello \ - maybe-info-indent \ - maybe-info-intl \ - maybe-info-tcl \ - maybe-info-itcl \ - maybe-info-ld \ - maybe-info-libgui \ - maybe-info-libiberty \ - maybe-info-libtool \ - maybe-info-m4 \ - maybe-info-make \ - maybe-info-mmalloc \ - maybe-info-patch \ - maybe-info-perl \ - maybe-info-prms \ - maybe-info-rcs \ - maybe-info-readline \ - maybe-info-release \ - maybe-info-recode \ - maybe-info-sed \ - maybe-info-send-pr \ - maybe-info-shellutils \ - maybe-info-sid \ - maybe-info-sim \ - maybe-info-tar \ - maybe-info-texinfo \ - maybe-info-textutils \ - maybe-info-time \ - maybe-info-uudecode \ - maybe-info-wdiff \ - maybe-info-zip \ - maybe-info-zlib \ - maybe-info-gdb \ - maybe-info-expect \ - maybe-info-guile \ - maybe-info-tk \ - maybe-info-tix \ - maybe-info-libtermcap \ - maybe-info-utils + +info-host: maybe-info-ash +info-host: maybe-info-autoconf +info-host: maybe-info-automake +info-host: maybe-info-bash +info-host: maybe-info-bfd +info-host: maybe-info-opcodes +info-host: maybe-info-binutils +info-host: maybe-info-bison +info-host: maybe-info-byacc +info-host: maybe-info-bzip2 +info-host: maybe-info-dejagnu +info-host: maybe-info-diff +info-host: maybe-info-dosutils +info-host: maybe-info-etc +info-host: maybe-info-fastjar +info-host: maybe-info-fileutils +info-host: maybe-info-findutils +info-host: maybe-info-find +info-host: maybe-info-fixincludes +info-host: maybe-info-flex +info-host: maybe-info-gas +info-host: maybe-info-gcc +info-host: maybe-info-gawk +info-host: maybe-info-gettext +info-host: maybe-info-gnuserv +info-host: maybe-info-gprof +info-host: maybe-info-gzip +info-host: maybe-info-hello +info-host: maybe-info-indent +info-host: maybe-info-intl +info-host: maybe-info-tcl +info-host: maybe-info-itcl +info-host: maybe-info-ld +info-host: maybe-info-libcpp +info-host: maybe-info-libdecnumber +info-host: maybe-info-libgui +info-host: maybe-info-libiberty +info-host: maybe-info-libtool +info-host: maybe-info-m4 +info-host: maybe-info-make +info-host: maybe-info-mmalloc +info-host: maybe-info-patch +info-host: maybe-info-perl +info-host: maybe-info-prms +info-host: maybe-info-rcs +info-host: maybe-info-readline +info-host: maybe-info-release +info-host: maybe-info-recode +info-host: maybe-info-sed +info-host: maybe-info-send-pr +info-host: maybe-info-shellutils +info-host: maybe-info-sid +info-host: maybe-info-sim +info-host: maybe-info-tar +info-host: maybe-info-texinfo +info-host: maybe-info-textutils +info-host: maybe-info-time +info-host: maybe-info-uudecode +info-host: maybe-info-wdiff +info-host: maybe-info-zip +info-host: maybe-info-zlib +info-host: maybe-info-gdb +info-host: maybe-info-expect +info-host: maybe-info-guile +info-host: maybe-info-tk +info-host: maybe-info-libtermcap +info-host: maybe-info-utils +info-host: maybe-info-gnattools .PHONY: info-target -info-target: \ - maybe-info-target-libstdc++-v3 \ - maybe-info-target-newlib \ - maybe-info-target-libf2c \ - maybe-info-target-libobjc \ - maybe-info-target-libtermcap \ - maybe-info-target-winsup \ - maybe-info-target-libgloss \ - maybe-info-target-libiberty \ - maybe-info-target-gperf \ - maybe-info-target-examples \ - maybe-info-target-libffi \ - maybe-info-target-libjava \ - maybe-info-target-zlib \ - maybe-info-target-boehm-gc \ - maybe-info-target-qthreads \ - maybe-info-target-rda \ - maybe-info-target-libada - -# GCC, the eternal special case -.PHONY: maybe-info-gcc info-gcc -maybe-info-gcc: -info-gcc: \ - configure-gcc - @[ -f ./gcc/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_GCC_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in gcc" ; \ - (cd gcc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - -# Host modules. - -.PHONY: maybe-info-ash info-ash -maybe-info-ash: - -info-ash: \ - configure-ash - @[ -f ./ash/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in ash" ; \ - (cd ash && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-autoconf info-autoconf -maybe-info-autoconf: - -info-autoconf: \ - configure-autoconf - @[ -f ./autoconf/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in autoconf" ; \ - (cd autoconf && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-automake info-automake -maybe-info-automake: - -info-automake: \ - configure-automake - @[ -f ./automake/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in automake" ; \ - (cd automake && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-bash info-bash -maybe-info-bash: - -info-bash: \ - configure-bash - @[ -f ./bash/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in bash" ; \ - (cd bash && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-bfd info-bfd -maybe-info-bfd: - -info-bfd: \ - configure-bfd - @[ -f ./bfd/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in bfd" ; \ - (cd bfd && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-opcodes info-opcodes -maybe-info-opcodes: - -info-opcodes: \ - configure-opcodes - @[ -f ./opcodes/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in opcodes" ; \ - (cd opcodes && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-binutils info-binutils -maybe-info-binutils: - -info-binutils: \ - configure-binutils - @[ -f ./binutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in binutils" ; \ - (cd binutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-bison info-bison -maybe-info-bison: - -info-bison: \ - configure-bison - @[ -f ./bison/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in bison" ; \ - (cd bison && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-byacc info-byacc -maybe-info-byacc: - -info-byacc: \ - configure-byacc - @[ -f ./byacc/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in byacc" ; \ - (cd byacc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-bzip2 info-bzip2 -maybe-info-bzip2: - -info-bzip2: \ - configure-bzip2 - @[ -f ./bzip2/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in bzip2" ; \ - (cd bzip2 && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-dejagnu info-dejagnu -maybe-info-dejagnu: - -info-dejagnu: \ - configure-dejagnu - @[ -f ./dejagnu/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in dejagnu" ; \ - (cd dejagnu && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-diff info-diff -maybe-info-diff: - -info-diff: \ - configure-diff - @[ -f ./diff/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in diff" ; \ - (cd diff && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-dosutils info-dosutils -maybe-info-dosutils: - -info-dosutils: \ - configure-dosutils - @[ -f ./dosutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in dosutils" ; \ - (cd dosutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-etc info-etc -maybe-info-etc: - -info-etc: \ - configure-etc - @[ -f ./etc/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in etc" ; \ - (cd etc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-fastjar info-fastjar -maybe-info-fastjar: - -info-fastjar: \ - configure-fastjar - @[ -f ./fastjar/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in fastjar" ; \ - (cd fastjar && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-fileutils info-fileutils -maybe-info-fileutils: - -info-fileutils: \ - configure-fileutils - @[ -f ./fileutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in fileutils" ; \ - (cd fileutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-findutils info-findutils -maybe-info-findutils: - -info-findutils: \ - configure-findutils - @[ -f ./findutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in findutils" ; \ - (cd findutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-find info-find -maybe-info-find: - -info-find: \ - configure-find - @[ -f ./find/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in find" ; \ - (cd find && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-flex info-flex -maybe-info-flex: - -info-flex: \ - configure-flex - @[ -f ./flex/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in flex" ; \ - (cd flex && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-gas info-gas -maybe-info-gas: - -info-gas: \ - configure-gas - @[ -f ./gas/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in gas" ; \ - (cd gas && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-gawk info-gawk -maybe-info-gawk: - -info-gawk: \ - configure-gawk - @[ -f ./gawk/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in gawk" ; \ - (cd gawk && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-gettext info-gettext -maybe-info-gettext: - -info-gettext: \ - configure-gettext - @[ -f ./gettext/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in gettext" ; \ - (cd gettext && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-gnuserv info-gnuserv -maybe-info-gnuserv: - -info-gnuserv: \ - configure-gnuserv - @[ -f ./gnuserv/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in gnuserv" ; \ - (cd gnuserv && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-gprof info-gprof -maybe-info-gprof: - -info-gprof: \ - configure-gprof - @[ -f ./gprof/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in gprof" ; \ - (cd gprof && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-gzip info-gzip -maybe-info-gzip: - -info-gzip: \ - configure-gzip - @[ -f ./gzip/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in gzip" ; \ - (cd gzip && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-hello info-hello -maybe-info-hello: - -info-hello: \ - configure-hello - @[ -f ./hello/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in hello" ; \ - (cd hello && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-indent info-indent -maybe-info-indent: - -info-indent: \ - configure-indent - @[ -f ./indent/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in indent" ; \ - (cd indent && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-intl info-intl -maybe-info-intl: - -info-intl: \ - configure-intl - @[ -f ./intl/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in intl" ; \ - (cd intl && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-tcl info-tcl -maybe-info-tcl: - -info-tcl: \ - configure-tcl - @[ -f ./tcl/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in tcl" ; \ - (cd tcl && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-itcl info-itcl -maybe-info-itcl: - -info-itcl: \ - configure-itcl - @[ -f ./itcl/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in itcl" ; \ - (cd itcl && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-ld info-ld -maybe-info-ld: - -info-ld: \ - configure-ld - @[ -f ./ld/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in ld" ; \ - (cd ld && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-libgui info-libgui -maybe-info-libgui: - -info-libgui: \ - configure-libgui - @[ -f ./libgui/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in libgui" ; \ - (cd libgui && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-libiberty info-libiberty -maybe-info-libiberty: - -info-libiberty: \ - configure-libiberty - @[ -f ./libiberty/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in libiberty" ; \ - (cd libiberty && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-libtool info-libtool -maybe-info-libtool: - -info-libtool: \ - configure-libtool - @[ -f ./libtool/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in libtool" ; \ - (cd libtool && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-m4 info-m4 -maybe-info-m4: - -info-m4: \ - configure-m4 - @[ -f ./m4/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in m4" ; \ - (cd m4 && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-make info-make -maybe-info-make: - -info-make: \ - configure-make - @[ -f ./make/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in make" ; \ - (cd make && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-mmalloc info-mmalloc -maybe-info-mmalloc: - -info-mmalloc: \ - configure-mmalloc - @[ -f ./mmalloc/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in mmalloc" ; \ - (cd mmalloc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-patch info-patch -maybe-info-patch: - -info-patch: \ - configure-patch - @[ -f ./patch/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in patch" ; \ - (cd patch && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-perl info-perl -maybe-info-perl: - -info-perl: \ - configure-perl - @[ -f ./perl/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in perl" ; \ - (cd perl && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-prms info-prms -maybe-info-prms: - -info-prms: \ - configure-prms - @[ -f ./prms/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in prms" ; \ - (cd prms && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-rcs info-rcs -maybe-info-rcs: - -info-rcs: \ - configure-rcs - @[ -f ./rcs/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in rcs" ; \ - (cd rcs && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-readline info-readline -maybe-info-readline: - -info-readline: \ - configure-readline - @[ -f ./readline/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in readline" ; \ - (cd readline && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-release info-release -maybe-info-release: - -info-release: \ - configure-release - @[ -f ./release/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in release" ; \ - (cd release && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-recode info-recode -maybe-info-recode: - -info-recode: \ - configure-recode - @[ -f ./recode/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in recode" ; \ - (cd recode && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-sed info-sed -maybe-info-sed: - -info-sed: \ - configure-sed - @[ -f ./sed/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in sed" ; \ - (cd sed && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-send-pr info-send-pr -maybe-info-send-pr: - -info-send-pr: \ - configure-send-pr - @[ -f ./send-pr/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in send-pr" ; \ - (cd send-pr && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-shellutils info-shellutils -maybe-info-shellutils: - -info-shellutils: \ - configure-shellutils - @[ -f ./shellutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in shellutils" ; \ - (cd shellutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-sid info-sid -maybe-info-sid: - -info-sid: \ - configure-sid - @[ -f ./sid/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in sid" ; \ - (cd sid && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-sim info-sim -maybe-info-sim: - -info-sim: \ - configure-sim - @[ -f ./sim/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in sim" ; \ - (cd sim && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-tar info-tar -maybe-info-tar: - -info-tar: \ - configure-tar - @[ -f ./tar/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in tar" ; \ - (cd tar && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-texinfo info-texinfo -maybe-info-texinfo: - -info-texinfo: \ - configure-texinfo - @[ -f ./texinfo/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in texinfo" ; \ - (cd texinfo && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-textutils info-textutils -maybe-info-textutils: - -info-textutils: \ - configure-textutils - @[ -f ./textutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in textutils" ; \ - (cd textutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-time info-time -maybe-info-time: - -info-time: \ - configure-time - @[ -f ./time/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in time" ; \ - (cd time && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-uudecode info-uudecode -maybe-info-uudecode: - -info-uudecode: \ - configure-uudecode - @[ -f ./uudecode/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in uudecode" ; \ - (cd uudecode && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-wdiff info-wdiff -maybe-info-wdiff: - -info-wdiff: \ - configure-wdiff - @[ -f ./wdiff/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in wdiff" ; \ - (cd wdiff && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-zip info-zip -maybe-info-zip: - -info-zip: \ - configure-zip - @[ -f ./zip/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in zip" ; \ - (cd zip && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-zlib info-zlib -maybe-info-zlib: - -info-zlib: \ - configure-zlib - @[ -f ./zlib/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in zlib" ; \ - (cd zlib && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-gdb info-gdb -maybe-info-gdb: - -info-gdb: \ - configure-gdb - @[ -f ./gdb/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in gdb" ; \ - (cd gdb && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-expect info-expect -maybe-info-expect: - -info-expect: \ - configure-expect - @[ -f ./expect/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in expect" ; \ - (cd expect && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-guile info-guile -maybe-info-guile: - -info-guile: \ - configure-guile - @[ -f ./guile/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in guile" ; \ - (cd guile && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-tk info-tk -maybe-info-tk: - -info-tk: \ - configure-tk - @[ -f ./tk/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in tk" ; \ - (cd tk && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-tix info-tix -maybe-info-tix: - -info-tix: \ - configure-tix - @[ -f ./tix/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in tix" ; \ - (cd tix && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-libtermcap info-libtermcap -maybe-info-libtermcap: - -info-libtermcap: \ - configure-libtermcap - @[ -f ./libtermcap/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in libtermcap" ; \ - (cd libtermcap && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-utils info-utils -maybe-info-utils: - -info-utils: \ - configure-utils - @[ -f ./utils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in utils" ; \ - (cd utils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - - -# Target modules. - -.PHONY: maybe-info-target-libstdc++-v3 info-target-libstdc++-v3 -maybe-info-target-libstdc++-v3: - -info-target-libstdc++-v3: \ - configure-target-libstdc++-v3 - @[ -f $(TARGET_SUBDIR)/libstdc++-v3/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing info in $(TARGET_SUBDIR)/libstdc++-v3" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libstdc++-v3 && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-target-newlib info-target-newlib -maybe-info-target-newlib: - -info-target-newlib: \ - configure-target-newlib - @[ -f $(TARGET_SUBDIR)/newlib/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing info in $(TARGET_SUBDIR)/newlib" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/newlib && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-target-libf2c info-target-libf2c -maybe-info-target-libf2c: - -info-target-libf2c: \ - configure-target-libf2c - @[ -f $(TARGET_SUBDIR)/libf2c/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing info in $(TARGET_SUBDIR)/libf2c" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libf2c && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-target-libobjc info-target-libobjc -maybe-info-target-libobjc: - -info-target-libobjc: \ - configure-target-libobjc - @[ -f $(TARGET_SUBDIR)/libobjc/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing info in $(TARGET_SUBDIR)/libobjc" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libobjc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-target-libtermcap info-target-libtermcap -maybe-info-target-libtermcap: - -info-target-libtermcap: \ - configure-target-libtermcap - @[ -f $(TARGET_SUBDIR)/libtermcap/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing info in $(TARGET_SUBDIR)/libtermcap" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libtermcap && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-target-winsup info-target-winsup -maybe-info-target-winsup: - -info-target-winsup: \ - configure-target-winsup - @[ -f $(TARGET_SUBDIR)/winsup/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing info in $(TARGET_SUBDIR)/winsup" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/winsup && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-target-libgloss info-target-libgloss -maybe-info-target-libgloss: - -info-target-libgloss: \ - configure-target-libgloss - @[ -f $(TARGET_SUBDIR)/libgloss/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing info in $(TARGET_SUBDIR)/libgloss" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libgloss && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-target-libiberty info-target-libiberty -maybe-info-target-libiberty: - -info-target-libiberty: \ - configure-target-libiberty - @[ -f $(TARGET_SUBDIR)/libiberty/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing info in $(TARGET_SUBDIR)/libiberty" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libiberty && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-target-gperf info-target-gperf -maybe-info-target-gperf: - -info-target-gperf: \ - configure-target-gperf - @[ -f $(TARGET_SUBDIR)/gperf/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing info in $(TARGET_SUBDIR)/gperf" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/gperf && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-target-examples info-target-examples -maybe-info-target-examples: - -info-target-examples: \ - configure-target-examples - @[ -f $(TARGET_SUBDIR)/examples/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing info in $(TARGET_SUBDIR)/examples" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/examples && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-target-libffi info-target-libffi -maybe-info-target-libffi: - -info-target-libffi: \ - configure-target-libffi - @[ -f $(TARGET_SUBDIR)/libffi/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing info in $(TARGET_SUBDIR)/libffi" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libffi && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-target-libjava info-target-libjava -maybe-info-target-libjava: - -info-target-libjava: \ - configure-target-libjava - @[ -f $(TARGET_SUBDIR)/libjava/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing info in $(TARGET_SUBDIR)/libjava" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libjava && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-target-zlib info-target-zlib -maybe-info-target-zlib: - -info-target-zlib: \ - configure-target-zlib - @[ -f $(TARGET_SUBDIR)/zlib/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing info in $(TARGET_SUBDIR)/zlib" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/zlib && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-target-boehm-gc info-target-boehm-gc -maybe-info-target-boehm-gc: - -info-target-boehm-gc: \ - configure-target-boehm-gc - @[ -f $(TARGET_SUBDIR)/boehm-gc/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing info in $(TARGET_SUBDIR)/boehm-gc" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/boehm-gc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-target-qthreads info-target-qthreads -maybe-info-target-qthreads: - -info-target-qthreads: \ - configure-target-qthreads - @[ -f $(TARGET_SUBDIR)/qthreads/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing info in $(TARGET_SUBDIR)/qthreads" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/qthreads && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-target-rda info-target-rda -maybe-info-target-rda: - -info-target-rda: \ - configure-target-rda - @[ -f $(TARGET_SUBDIR)/rda/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing info in $(TARGET_SUBDIR)/rda" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/rda && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - - -.PHONY: maybe-info-target-libada info-target-libada -maybe-info-target-libada: - -info-target-libada: \ - configure-target-libada - @[ -f $(TARGET_SUBDIR)/libada/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing info in $(TARGET_SUBDIR)/libada" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libada && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - info) \ - || exit 1 - +info-target: maybe-info-target-libstdc++-v3 +info-target: maybe-info-target-libmudflap +info-target: maybe-info-target-libssp +info-target: maybe-info-target-libgcc-math +info-target: maybe-info-target-newlib +info-target: maybe-info-target-libgfortran +info-target: maybe-info-target-libobjc +info-target: maybe-info-target-libtermcap +info-target: maybe-info-target-winsup +info-target: maybe-info-target-libgloss +info-target: maybe-info-target-libiberty +info-target: maybe-info-target-gperf +info-target: maybe-info-target-examples +info-target: maybe-info-target-libffi +info-target: maybe-info-target-libjava +info-target: maybe-info-target-zlib +info-target: maybe-info-target-boehm-gc +info-target: maybe-info-target-qthreads +info-target: maybe-info-target-rda +info-target: maybe-info-target-libada +info-target: maybe-info-target-libgomp .PHONY: do-dvi -do-dvi: dvi-host dvi-target +do-dvi: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(MAKE) $(RECURSE_FLAGS_TO_PASS) dvi-host \ + dvi-target + .PHONY: dvi-host -dvi-host: maybe-dvi-gcc \ - maybe-dvi-ash \ - maybe-dvi-autoconf \ - maybe-dvi-automake \ - maybe-dvi-bash \ - maybe-dvi-bfd \ - maybe-dvi-opcodes \ - maybe-dvi-binutils \ - maybe-dvi-bison \ - maybe-dvi-byacc \ - maybe-dvi-bzip2 \ - maybe-dvi-dejagnu \ - maybe-dvi-diff \ - maybe-dvi-dosutils \ - maybe-dvi-etc \ - maybe-dvi-fastjar \ - maybe-dvi-fileutils \ - maybe-dvi-findutils \ - maybe-dvi-find \ - maybe-dvi-flex \ - maybe-dvi-gas \ - maybe-dvi-gawk \ - maybe-dvi-gettext \ - maybe-dvi-gnuserv \ - maybe-dvi-gprof \ - maybe-dvi-gzip \ - maybe-dvi-hello \ - maybe-dvi-indent \ - maybe-dvi-intl \ - maybe-dvi-tcl \ - maybe-dvi-itcl \ - maybe-dvi-ld \ - maybe-dvi-libgui \ - maybe-dvi-libiberty \ - maybe-dvi-libtool \ - maybe-dvi-m4 \ - maybe-dvi-make \ - maybe-dvi-mmalloc \ - maybe-dvi-patch \ - maybe-dvi-perl \ - maybe-dvi-prms \ - maybe-dvi-rcs \ - maybe-dvi-readline \ - maybe-dvi-release \ - maybe-dvi-recode \ - maybe-dvi-sed \ - maybe-dvi-send-pr \ - maybe-dvi-shellutils \ - maybe-dvi-sid \ - maybe-dvi-sim \ - maybe-dvi-tar \ - maybe-dvi-texinfo \ - maybe-dvi-textutils \ - maybe-dvi-time \ - maybe-dvi-uudecode \ - maybe-dvi-wdiff \ - maybe-dvi-zip \ - maybe-dvi-zlib \ - maybe-dvi-gdb \ - maybe-dvi-expect \ - maybe-dvi-guile \ - maybe-dvi-tk \ - maybe-dvi-tix \ - maybe-dvi-libtermcap \ - maybe-dvi-utils + +dvi-host: maybe-dvi-ash +dvi-host: maybe-dvi-autoconf +dvi-host: maybe-dvi-automake +dvi-host: maybe-dvi-bash +dvi-host: maybe-dvi-bfd +dvi-host: maybe-dvi-opcodes +dvi-host: maybe-dvi-binutils +dvi-host: maybe-dvi-bison +dvi-host: maybe-dvi-byacc +dvi-host: maybe-dvi-bzip2 +dvi-host: maybe-dvi-dejagnu +dvi-host: maybe-dvi-diff +dvi-host: maybe-dvi-dosutils +dvi-host: maybe-dvi-etc +dvi-host: maybe-dvi-fastjar +dvi-host: maybe-dvi-fileutils +dvi-host: maybe-dvi-findutils +dvi-host: maybe-dvi-find +dvi-host: maybe-dvi-fixincludes +dvi-host: maybe-dvi-flex +dvi-host: maybe-dvi-gas +dvi-host: maybe-dvi-gcc +dvi-host: maybe-dvi-gawk +dvi-host: maybe-dvi-gettext +dvi-host: maybe-dvi-gnuserv +dvi-host: maybe-dvi-gprof +dvi-host: maybe-dvi-gzip +dvi-host: maybe-dvi-hello +dvi-host: maybe-dvi-indent +dvi-host: maybe-dvi-intl +dvi-host: maybe-dvi-tcl +dvi-host: maybe-dvi-itcl +dvi-host: maybe-dvi-ld +dvi-host: maybe-dvi-libcpp +dvi-host: maybe-dvi-libdecnumber +dvi-host: maybe-dvi-libgui +dvi-host: maybe-dvi-libiberty +dvi-host: maybe-dvi-libtool +dvi-host: maybe-dvi-m4 +dvi-host: maybe-dvi-make +dvi-host: maybe-dvi-mmalloc +dvi-host: maybe-dvi-patch +dvi-host: maybe-dvi-perl +dvi-host: maybe-dvi-prms +dvi-host: maybe-dvi-rcs +dvi-host: maybe-dvi-readline +dvi-host: maybe-dvi-release +dvi-host: maybe-dvi-recode +dvi-host: maybe-dvi-sed +dvi-host: maybe-dvi-send-pr +dvi-host: maybe-dvi-shellutils +dvi-host: maybe-dvi-sid +dvi-host: maybe-dvi-sim +dvi-host: maybe-dvi-tar +dvi-host: maybe-dvi-texinfo +dvi-host: maybe-dvi-textutils +dvi-host: maybe-dvi-time +dvi-host: maybe-dvi-uudecode +dvi-host: maybe-dvi-wdiff +dvi-host: maybe-dvi-zip +dvi-host: maybe-dvi-zlib +dvi-host: maybe-dvi-gdb +dvi-host: maybe-dvi-expect +dvi-host: maybe-dvi-guile +dvi-host: maybe-dvi-tk +dvi-host: maybe-dvi-libtermcap +dvi-host: maybe-dvi-utils +dvi-host: maybe-dvi-gnattools .PHONY: dvi-target -dvi-target: \ - maybe-dvi-target-libstdc++-v3 \ - maybe-dvi-target-newlib \ - maybe-dvi-target-libf2c \ - maybe-dvi-target-libobjc \ - maybe-dvi-target-libtermcap \ - maybe-dvi-target-winsup \ - maybe-dvi-target-libgloss \ - maybe-dvi-target-libiberty \ - maybe-dvi-target-gperf \ - maybe-dvi-target-examples \ - maybe-dvi-target-libffi \ - maybe-dvi-target-libjava \ - maybe-dvi-target-zlib \ - maybe-dvi-target-boehm-gc \ - maybe-dvi-target-qthreads \ - maybe-dvi-target-rda \ - maybe-dvi-target-libada - -# GCC, the eternal special case -.PHONY: maybe-dvi-gcc dvi-gcc -maybe-dvi-gcc: -dvi-gcc: \ - configure-gcc - @[ -f ./gcc/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_GCC_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in gcc" ; \ - (cd gcc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - -# Host modules. - -.PHONY: maybe-dvi-ash dvi-ash -maybe-dvi-ash: - -dvi-ash: \ - configure-ash - @[ -f ./ash/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in ash" ; \ - (cd ash && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-autoconf dvi-autoconf -maybe-dvi-autoconf: - -dvi-autoconf: \ - configure-autoconf - @[ -f ./autoconf/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in autoconf" ; \ - (cd autoconf && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-automake dvi-automake -maybe-dvi-automake: - -dvi-automake: \ - configure-automake - @[ -f ./automake/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in automake" ; \ - (cd automake && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-bash dvi-bash -maybe-dvi-bash: - -dvi-bash: \ - configure-bash - @[ -f ./bash/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in bash" ; \ - (cd bash && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-bfd dvi-bfd -maybe-dvi-bfd: - -dvi-bfd: \ - configure-bfd - @[ -f ./bfd/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in bfd" ; \ - (cd bfd && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-opcodes dvi-opcodes -maybe-dvi-opcodes: - -dvi-opcodes: \ - configure-opcodes - @[ -f ./opcodes/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in opcodes" ; \ - (cd opcodes && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-binutils dvi-binutils -maybe-dvi-binutils: - -dvi-binutils: \ - configure-binutils - @[ -f ./binutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in binutils" ; \ - (cd binutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-bison dvi-bison -maybe-dvi-bison: - -dvi-bison: \ - configure-bison - @[ -f ./bison/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in bison" ; \ - (cd bison && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-byacc dvi-byacc -maybe-dvi-byacc: - -dvi-byacc: \ - configure-byacc - @[ -f ./byacc/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in byacc" ; \ - (cd byacc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-bzip2 dvi-bzip2 -maybe-dvi-bzip2: - -dvi-bzip2: \ - configure-bzip2 - @[ -f ./bzip2/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in bzip2" ; \ - (cd bzip2 && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-dejagnu dvi-dejagnu -maybe-dvi-dejagnu: - -dvi-dejagnu: \ - configure-dejagnu - @[ -f ./dejagnu/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in dejagnu" ; \ - (cd dejagnu && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-diff dvi-diff -maybe-dvi-diff: - -dvi-diff: \ - configure-diff - @[ -f ./diff/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in diff" ; \ - (cd diff && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-dosutils dvi-dosutils -maybe-dvi-dosutils: - -dvi-dosutils: \ - configure-dosutils - @[ -f ./dosutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in dosutils" ; \ - (cd dosutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-etc dvi-etc -maybe-dvi-etc: - -dvi-etc: \ - configure-etc - @[ -f ./etc/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in etc" ; \ - (cd etc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-fastjar dvi-fastjar -maybe-dvi-fastjar: - -dvi-fastjar: \ - configure-fastjar - @[ -f ./fastjar/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in fastjar" ; \ - (cd fastjar && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-fileutils dvi-fileutils -maybe-dvi-fileutils: - -dvi-fileutils: \ - configure-fileutils - @[ -f ./fileutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in fileutils" ; \ - (cd fileutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-findutils dvi-findutils -maybe-dvi-findutils: - -dvi-findutils: \ - configure-findutils - @[ -f ./findutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in findutils" ; \ - (cd findutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-find dvi-find -maybe-dvi-find: - -dvi-find: \ - configure-find - @[ -f ./find/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in find" ; \ - (cd find && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-flex dvi-flex -maybe-dvi-flex: - -dvi-flex: \ - configure-flex - @[ -f ./flex/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in flex" ; \ - (cd flex && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-gas dvi-gas -maybe-dvi-gas: - -dvi-gas: \ - configure-gas - @[ -f ./gas/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in gas" ; \ - (cd gas && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-gawk dvi-gawk -maybe-dvi-gawk: - -dvi-gawk: \ - configure-gawk - @[ -f ./gawk/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in gawk" ; \ - (cd gawk && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-gettext dvi-gettext -maybe-dvi-gettext: - -dvi-gettext: \ - configure-gettext - @[ -f ./gettext/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in gettext" ; \ - (cd gettext && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-gnuserv dvi-gnuserv -maybe-dvi-gnuserv: - -dvi-gnuserv: \ - configure-gnuserv - @[ -f ./gnuserv/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in gnuserv" ; \ - (cd gnuserv && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-gprof dvi-gprof -maybe-dvi-gprof: - -dvi-gprof: \ - configure-gprof - @[ -f ./gprof/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in gprof" ; \ - (cd gprof && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-gzip dvi-gzip -maybe-dvi-gzip: - -dvi-gzip: \ - configure-gzip - @[ -f ./gzip/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in gzip" ; \ - (cd gzip && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-hello dvi-hello -maybe-dvi-hello: - -dvi-hello: \ - configure-hello - @[ -f ./hello/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in hello" ; \ - (cd hello && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-indent dvi-indent -maybe-dvi-indent: - -dvi-indent: \ - configure-indent - @[ -f ./indent/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in indent" ; \ - (cd indent && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-intl dvi-intl -maybe-dvi-intl: - -dvi-intl: \ - configure-intl - @[ -f ./intl/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in intl" ; \ - (cd intl && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-tcl dvi-tcl -maybe-dvi-tcl: - -dvi-tcl: \ - configure-tcl - @[ -f ./tcl/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in tcl" ; \ - (cd tcl && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-itcl dvi-itcl -maybe-dvi-itcl: - -dvi-itcl: \ - configure-itcl - @[ -f ./itcl/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in itcl" ; \ - (cd itcl && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-ld dvi-ld -maybe-dvi-ld: - -dvi-ld: \ - configure-ld - @[ -f ./ld/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in ld" ; \ - (cd ld && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-libgui dvi-libgui -maybe-dvi-libgui: - -dvi-libgui: \ - configure-libgui - @[ -f ./libgui/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in libgui" ; \ - (cd libgui && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-libiberty dvi-libiberty -maybe-dvi-libiberty: - -dvi-libiberty: \ - configure-libiberty - @[ -f ./libiberty/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in libiberty" ; \ - (cd libiberty && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-libtool dvi-libtool -maybe-dvi-libtool: - -dvi-libtool: \ - configure-libtool - @[ -f ./libtool/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in libtool" ; \ - (cd libtool && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-m4 dvi-m4 -maybe-dvi-m4: - -dvi-m4: \ - configure-m4 - @[ -f ./m4/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in m4" ; \ - (cd m4 && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-make dvi-make -maybe-dvi-make: - -dvi-make: \ - configure-make - @[ -f ./make/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in make" ; \ - (cd make && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-mmalloc dvi-mmalloc -maybe-dvi-mmalloc: - -dvi-mmalloc: \ - configure-mmalloc - @[ -f ./mmalloc/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in mmalloc" ; \ - (cd mmalloc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-patch dvi-patch -maybe-dvi-patch: - -dvi-patch: \ - configure-patch - @[ -f ./patch/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in patch" ; \ - (cd patch && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-perl dvi-perl -maybe-dvi-perl: - -dvi-perl: \ - configure-perl - @[ -f ./perl/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in perl" ; \ - (cd perl && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-prms dvi-prms -maybe-dvi-prms: - -dvi-prms: \ - configure-prms - @[ -f ./prms/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in prms" ; \ - (cd prms && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-rcs dvi-rcs -maybe-dvi-rcs: - -dvi-rcs: \ - configure-rcs - @[ -f ./rcs/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in rcs" ; \ - (cd rcs && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-readline dvi-readline -maybe-dvi-readline: - -dvi-readline: \ - configure-readline - @[ -f ./readline/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in readline" ; \ - (cd readline && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-release dvi-release -maybe-dvi-release: - -dvi-release: \ - configure-release - @[ -f ./release/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in release" ; \ - (cd release && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-recode dvi-recode -maybe-dvi-recode: - -dvi-recode: \ - configure-recode - @[ -f ./recode/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in recode" ; \ - (cd recode && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-sed dvi-sed -maybe-dvi-sed: - -dvi-sed: \ - configure-sed - @[ -f ./sed/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in sed" ; \ - (cd sed && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-send-pr dvi-send-pr -maybe-dvi-send-pr: - -dvi-send-pr: \ - configure-send-pr - @[ -f ./send-pr/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in send-pr" ; \ - (cd send-pr && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-shellutils dvi-shellutils -maybe-dvi-shellutils: - -dvi-shellutils: \ - configure-shellutils - @[ -f ./shellutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in shellutils" ; \ - (cd shellutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-sid dvi-sid -maybe-dvi-sid: - -dvi-sid: \ - configure-sid - @[ -f ./sid/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in sid" ; \ - (cd sid && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-sim dvi-sim -maybe-dvi-sim: - -dvi-sim: \ - configure-sim - @[ -f ./sim/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in sim" ; \ - (cd sim && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-tar dvi-tar -maybe-dvi-tar: - -dvi-tar: \ - configure-tar - @[ -f ./tar/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in tar" ; \ - (cd tar && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-texinfo dvi-texinfo -maybe-dvi-texinfo: - -dvi-texinfo: \ - configure-texinfo - @[ -f ./texinfo/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in texinfo" ; \ - (cd texinfo && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-textutils dvi-textutils -maybe-dvi-textutils: - -dvi-textutils: \ - configure-textutils - @[ -f ./textutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in textutils" ; \ - (cd textutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-time dvi-time -maybe-dvi-time: - -dvi-time: \ - configure-time - @[ -f ./time/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in time" ; \ - (cd time && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-uudecode dvi-uudecode -maybe-dvi-uudecode: - -dvi-uudecode: \ - configure-uudecode - @[ -f ./uudecode/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in uudecode" ; \ - (cd uudecode && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-wdiff dvi-wdiff -maybe-dvi-wdiff: - -dvi-wdiff: \ - configure-wdiff - @[ -f ./wdiff/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in wdiff" ; \ - (cd wdiff && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-zip dvi-zip -maybe-dvi-zip: - -dvi-zip: \ - configure-zip - @[ -f ./zip/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in zip" ; \ - (cd zip && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-zlib dvi-zlib -maybe-dvi-zlib: - -dvi-zlib: \ - configure-zlib - @[ -f ./zlib/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in zlib" ; \ - (cd zlib && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-gdb dvi-gdb -maybe-dvi-gdb: - -dvi-gdb: \ - configure-gdb - @[ -f ./gdb/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in gdb" ; \ - (cd gdb && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-expect dvi-expect -maybe-dvi-expect: - -dvi-expect: \ - configure-expect - @[ -f ./expect/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in expect" ; \ - (cd expect && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-guile dvi-guile -maybe-dvi-guile: - -dvi-guile: \ - configure-guile - @[ -f ./guile/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in guile" ; \ - (cd guile && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-tk dvi-tk -maybe-dvi-tk: - -dvi-tk: \ - configure-tk - @[ -f ./tk/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in tk" ; \ - (cd tk && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-tix dvi-tix -maybe-dvi-tix: - -dvi-tix: \ - configure-tix - @[ -f ./tix/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in tix" ; \ - (cd tix && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-libtermcap dvi-libtermcap -maybe-dvi-libtermcap: - -dvi-libtermcap: \ - configure-libtermcap - @[ -f ./libtermcap/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in libtermcap" ; \ - (cd libtermcap && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-utils dvi-utils -maybe-dvi-utils: - -dvi-utils: \ - configure-utils - @[ -f ./utils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing dvi in utils" ; \ - (cd utils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - - -# Target modules. - -.PHONY: maybe-dvi-target-libstdc++-v3 dvi-target-libstdc++-v3 -maybe-dvi-target-libstdc++-v3: - -dvi-target-libstdc++-v3: \ - configure-target-libstdc++-v3 - @[ -f $(TARGET_SUBDIR)/libstdc++-v3/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing dvi in $(TARGET_SUBDIR)/libstdc++-v3" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libstdc++-v3 && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-target-newlib dvi-target-newlib -maybe-dvi-target-newlib: - -dvi-target-newlib: \ - configure-target-newlib - @[ -f $(TARGET_SUBDIR)/newlib/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing dvi in $(TARGET_SUBDIR)/newlib" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/newlib && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-target-libf2c dvi-target-libf2c -maybe-dvi-target-libf2c: - -dvi-target-libf2c: \ - configure-target-libf2c - @[ -f $(TARGET_SUBDIR)/libf2c/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing dvi in $(TARGET_SUBDIR)/libf2c" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libf2c && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-target-libobjc dvi-target-libobjc -maybe-dvi-target-libobjc: - -dvi-target-libobjc: \ - configure-target-libobjc - @[ -f $(TARGET_SUBDIR)/libobjc/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing dvi in $(TARGET_SUBDIR)/libobjc" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libobjc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-target-libtermcap dvi-target-libtermcap -maybe-dvi-target-libtermcap: - -dvi-target-libtermcap: \ - configure-target-libtermcap - @[ -f $(TARGET_SUBDIR)/libtermcap/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing dvi in $(TARGET_SUBDIR)/libtermcap" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libtermcap && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-target-winsup dvi-target-winsup -maybe-dvi-target-winsup: - -dvi-target-winsup: \ - configure-target-winsup - @[ -f $(TARGET_SUBDIR)/winsup/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing dvi in $(TARGET_SUBDIR)/winsup" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/winsup && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-target-libgloss dvi-target-libgloss -maybe-dvi-target-libgloss: - -dvi-target-libgloss: \ - configure-target-libgloss - @[ -f $(TARGET_SUBDIR)/libgloss/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing dvi in $(TARGET_SUBDIR)/libgloss" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libgloss && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-target-libiberty dvi-target-libiberty -maybe-dvi-target-libiberty: - -dvi-target-libiberty: \ - configure-target-libiberty - @[ -f $(TARGET_SUBDIR)/libiberty/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing dvi in $(TARGET_SUBDIR)/libiberty" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libiberty && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-target-gperf dvi-target-gperf -maybe-dvi-target-gperf: - -dvi-target-gperf: \ - configure-target-gperf - @[ -f $(TARGET_SUBDIR)/gperf/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing dvi in $(TARGET_SUBDIR)/gperf" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/gperf && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-target-examples dvi-target-examples -maybe-dvi-target-examples: - -dvi-target-examples: \ - configure-target-examples - @[ -f $(TARGET_SUBDIR)/examples/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing dvi in $(TARGET_SUBDIR)/examples" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/examples && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-target-libffi dvi-target-libffi -maybe-dvi-target-libffi: - -dvi-target-libffi: \ - configure-target-libffi - @[ -f $(TARGET_SUBDIR)/libffi/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing dvi in $(TARGET_SUBDIR)/libffi" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libffi && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-target-libjava dvi-target-libjava -maybe-dvi-target-libjava: - -dvi-target-libjava: \ - configure-target-libjava - @[ -f $(TARGET_SUBDIR)/libjava/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing dvi in $(TARGET_SUBDIR)/libjava" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libjava && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-target-zlib dvi-target-zlib -maybe-dvi-target-zlib: - -dvi-target-zlib: \ - configure-target-zlib - @[ -f $(TARGET_SUBDIR)/zlib/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing dvi in $(TARGET_SUBDIR)/zlib" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/zlib && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-target-boehm-gc dvi-target-boehm-gc -maybe-dvi-target-boehm-gc: - -dvi-target-boehm-gc: \ - configure-target-boehm-gc - @[ -f $(TARGET_SUBDIR)/boehm-gc/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing dvi in $(TARGET_SUBDIR)/boehm-gc" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/boehm-gc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-target-qthreads dvi-target-qthreads -maybe-dvi-target-qthreads: - -dvi-target-qthreads: \ - configure-target-qthreads - @[ -f $(TARGET_SUBDIR)/qthreads/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing dvi in $(TARGET_SUBDIR)/qthreads" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/qthreads && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-target-rda dvi-target-rda -maybe-dvi-target-rda: - -dvi-target-rda: \ - configure-target-rda - @[ -f $(TARGET_SUBDIR)/rda/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing dvi in $(TARGET_SUBDIR)/rda" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/rda && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - - -.PHONY: maybe-dvi-target-libada dvi-target-libada -maybe-dvi-target-libada: - -dvi-target-libada: \ - configure-target-libada - @[ -f $(TARGET_SUBDIR)/libada/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing dvi in $(TARGET_SUBDIR)/libada" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libada && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - dvi) \ - || exit 1 - +dvi-target: maybe-dvi-target-libstdc++-v3 +dvi-target: maybe-dvi-target-libmudflap +dvi-target: maybe-dvi-target-libssp +dvi-target: maybe-dvi-target-libgcc-math +dvi-target: maybe-dvi-target-newlib +dvi-target: maybe-dvi-target-libgfortran +dvi-target: maybe-dvi-target-libobjc +dvi-target: maybe-dvi-target-libtermcap +dvi-target: maybe-dvi-target-winsup +dvi-target: maybe-dvi-target-libgloss +dvi-target: maybe-dvi-target-libiberty +dvi-target: maybe-dvi-target-gperf +dvi-target: maybe-dvi-target-examples +dvi-target: maybe-dvi-target-libffi +dvi-target: maybe-dvi-target-libjava +dvi-target: maybe-dvi-target-zlib +dvi-target: maybe-dvi-target-boehm-gc +dvi-target: maybe-dvi-target-qthreads +dvi-target: maybe-dvi-target-rda +dvi-target: maybe-dvi-target-libada +dvi-target: maybe-dvi-target-libgomp + +.PHONY: do-html +do-html: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(MAKE) $(RECURSE_FLAGS_TO_PASS) html-host \ + html-target + + +.PHONY: html-host + +html-host: maybe-html-ash +html-host: maybe-html-autoconf +html-host: maybe-html-automake +html-host: maybe-html-bash +html-host: maybe-html-bfd +html-host: maybe-html-opcodes +html-host: maybe-html-binutils +html-host: maybe-html-bison +html-host: maybe-html-byacc +html-host: maybe-html-bzip2 +html-host: maybe-html-dejagnu +html-host: maybe-html-diff +html-host: maybe-html-dosutils +html-host: maybe-html-etc +html-host: maybe-html-fastjar +html-host: maybe-html-fileutils +html-host: maybe-html-findutils +html-host: maybe-html-find +html-host: maybe-html-fixincludes +html-host: maybe-html-flex +html-host: maybe-html-gas +html-host: maybe-html-gcc +html-host: maybe-html-gawk +html-host: maybe-html-gettext +html-host: maybe-html-gnuserv +html-host: maybe-html-gprof +html-host: maybe-html-gzip +html-host: maybe-html-hello +html-host: maybe-html-indent +html-host: maybe-html-intl +html-host: maybe-html-tcl +html-host: maybe-html-itcl +html-host: maybe-html-ld +html-host: maybe-html-libcpp +html-host: maybe-html-libdecnumber +html-host: maybe-html-libgui +html-host: maybe-html-libiberty +html-host: maybe-html-libtool +html-host: maybe-html-m4 +html-host: maybe-html-make +html-host: maybe-html-mmalloc +html-host: maybe-html-patch +html-host: maybe-html-perl +html-host: maybe-html-prms +html-host: maybe-html-rcs +html-host: maybe-html-readline +html-host: maybe-html-release +html-host: maybe-html-recode +html-host: maybe-html-sed +html-host: maybe-html-send-pr +html-host: maybe-html-shellutils +html-host: maybe-html-sid +html-host: maybe-html-sim +html-host: maybe-html-tar +html-host: maybe-html-texinfo +html-host: maybe-html-textutils +html-host: maybe-html-time +html-host: maybe-html-uudecode +html-host: maybe-html-wdiff +html-host: maybe-html-zip +html-host: maybe-html-zlib +html-host: maybe-html-gdb +html-host: maybe-html-expect +html-host: maybe-html-guile +html-host: maybe-html-tk +html-host: maybe-html-libtermcap +html-host: maybe-html-utils +html-host: maybe-html-gnattools + +.PHONY: html-target + +html-target: maybe-html-target-libstdc++-v3 +html-target: maybe-html-target-libmudflap +html-target: maybe-html-target-libssp +html-target: maybe-html-target-libgcc-math +html-target: maybe-html-target-newlib +html-target: maybe-html-target-libgfortran +html-target: maybe-html-target-libobjc +html-target: maybe-html-target-libtermcap +html-target: maybe-html-target-winsup +html-target: maybe-html-target-libgloss +html-target: maybe-html-target-libiberty +html-target: maybe-html-target-gperf +html-target: maybe-html-target-examples +html-target: maybe-html-target-libffi +html-target: maybe-html-target-libjava +html-target: maybe-html-target-zlib +html-target: maybe-html-target-boehm-gc +html-target: maybe-html-target-qthreads +html-target: maybe-html-target-rda +html-target: maybe-html-target-libada +html-target: maybe-html-target-libgomp .PHONY: do-TAGS -do-TAGS: TAGS-host TAGS-target +do-TAGS: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(MAKE) $(RECURSE_FLAGS_TO_PASS) TAGS-host \ + TAGS-target + .PHONY: TAGS-host -TAGS-host: maybe-TAGS-gcc \ - maybe-TAGS-ash \ - maybe-TAGS-autoconf \ - maybe-TAGS-automake \ - maybe-TAGS-bash \ - maybe-TAGS-bfd \ - maybe-TAGS-opcodes \ - maybe-TAGS-binutils \ - maybe-TAGS-bison \ - maybe-TAGS-byacc \ - maybe-TAGS-bzip2 \ - maybe-TAGS-dejagnu \ - maybe-TAGS-diff \ - maybe-TAGS-dosutils \ - maybe-TAGS-etc \ - maybe-TAGS-fastjar \ - maybe-TAGS-fileutils \ - maybe-TAGS-findutils \ - maybe-TAGS-find \ - maybe-TAGS-flex \ - maybe-TAGS-gas \ - maybe-TAGS-gawk \ - maybe-TAGS-gettext \ - maybe-TAGS-gnuserv \ - maybe-TAGS-gprof \ - maybe-TAGS-gzip \ - maybe-TAGS-hello \ - maybe-TAGS-indent \ - maybe-TAGS-intl \ - maybe-TAGS-tcl \ - maybe-TAGS-itcl \ - maybe-TAGS-ld \ - maybe-TAGS-libgui \ - maybe-TAGS-libiberty \ - maybe-TAGS-libtool \ - maybe-TAGS-m4 \ - maybe-TAGS-make \ - maybe-TAGS-mmalloc \ - maybe-TAGS-patch \ - maybe-TAGS-perl \ - maybe-TAGS-prms \ - maybe-TAGS-rcs \ - maybe-TAGS-readline \ - maybe-TAGS-release \ - maybe-TAGS-recode \ - maybe-TAGS-sed \ - maybe-TAGS-send-pr \ - maybe-TAGS-shellutils \ - maybe-TAGS-sid \ - maybe-TAGS-sim \ - maybe-TAGS-tar \ - maybe-TAGS-texinfo \ - maybe-TAGS-textutils \ - maybe-TAGS-time \ - maybe-TAGS-uudecode \ - maybe-TAGS-wdiff \ - maybe-TAGS-zip \ - maybe-TAGS-zlib \ - maybe-TAGS-gdb \ - maybe-TAGS-expect \ - maybe-TAGS-guile \ - maybe-TAGS-tk \ - maybe-TAGS-tix \ - maybe-TAGS-libtermcap \ - maybe-TAGS-utils + +TAGS-host: maybe-TAGS-ash +TAGS-host: maybe-TAGS-autoconf +TAGS-host: maybe-TAGS-automake +TAGS-host: maybe-TAGS-bash +TAGS-host: maybe-TAGS-bfd +TAGS-host: maybe-TAGS-opcodes +TAGS-host: maybe-TAGS-binutils +TAGS-host: maybe-TAGS-bison +TAGS-host: maybe-TAGS-byacc +TAGS-host: maybe-TAGS-bzip2 +TAGS-host: maybe-TAGS-dejagnu +TAGS-host: maybe-TAGS-diff +TAGS-host: maybe-TAGS-dosutils +TAGS-host: maybe-TAGS-etc +TAGS-host: maybe-TAGS-fastjar +TAGS-host: maybe-TAGS-fileutils +TAGS-host: maybe-TAGS-findutils +TAGS-host: maybe-TAGS-find +TAGS-host: maybe-TAGS-fixincludes +TAGS-host: maybe-TAGS-flex +TAGS-host: maybe-TAGS-gas +TAGS-host: maybe-TAGS-gcc +TAGS-host: maybe-TAGS-gawk +TAGS-host: maybe-TAGS-gettext +TAGS-host: maybe-TAGS-gnuserv +TAGS-host: maybe-TAGS-gprof +TAGS-host: maybe-TAGS-gzip +TAGS-host: maybe-TAGS-hello +TAGS-host: maybe-TAGS-indent +TAGS-host: maybe-TAGS-intl +TAGS-host: maybe-TAGS-tcl +TAGS-host: maybe-TAGS-itcl +TAGS-host: maybe-TAGS-ld +TAGS-host: maybe-TAGS-libcpp +TAGS-host: maybe-TAGS-libdecnumber +TAGS-host: maybe-TAGS-libgui +TAGS-host: maybe-TAGS-libiberty +TAGS-host: maybe-TAGS-libtool +TAGS-host: maybe-TAGS-m4 +TAGS-host: maybe-TAGS-make +TAGS-host: maybe-TAGS-mmalloc +TAGS-host: maybe-TAGS-patch +TAGS-host: maybe-TAGS-perl +TAGS-host: maybe-TAGS-prms +TAGS-host: maybe-TAGS-rcs +TAGS-host: maybe-TAGS-readline +TAGS-host: maybe-TAGS-release +TAGS-host: maybe-TAGS-recode +TAGS-host: maybe-TAGS-sed +TAGS-host: maybe-TAGS-send-pr +TAGS-host: maybe-TAGS-shellutils +TAGS-host: maybe-TAGS-sid +TAGS-host: maybe-TAGS-sim +TAGS-host: maybe-TAGS-tar +TAGS-host: maybe-TAGS-texinfo +TAGS-host: maybe-TAGS-textutils +TAGS-host: maybe-TAGS-time +TAGS-host: maybe-TAGS-uudecode +TAGS-host: maybe-TAGS-wdiff +TAGS-host: maybe-TAGS-zip +TAGS-host: maybe-TAGS-zlib +TAGS-host: maybe-TAGS-gdb +TAGS-host: maybe-TAGS-expect +TAGS-host: maybe-TAGS-guile +TAGS-host: maybe-TAGS-tk +TAGS-host: maybe-TAGS-libtermcap +TAGS-host: maybe-TAGS-utils +TAGS-host: maybe-TAGS-gnattools .PHONY: TAGS-target -TAGS-target: \ - maybe-TAGS-target-libstdc++-v3 \ - maybe-TAGS-target-newlib \ - maybe-TAGS-target-libf2c \ - maybe-TAGS-target-libobjc \ - maybe-TAGS-target-libtermcap \ - maybe-TAGS-target-winsup \ - maybe-TAGS-target-libgloss \ - maybe-TAGS-target-libiberty \ - maybe-TAGS-target-gperf \ - maybe-TAGS-target-examples \ - maybe-TAGS-target-libffi \ - maybe-TAGS-target-libjava \ - maybe-TAGS-target-zlib \ - maybe-TAGS-target-boehm-gc \ - maybe-TAGS-target-qthreads \ - maybe-TAGS-target-rda \ - maybe-TAGS-target-libada - -# GCC, the eternal special case -.PHONY: maybe-TAGS-gcc TAGS-gcc -maybe-TAGS-gcc: -TAGS-gcc: \ - configure-gcc - @[ -f ./gcc/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_GCC_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in gcc" ; \ - (cd gcc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - -# Host modules. - -.PHONY: maybe-TAGS-ash TAGS-ash -maybe-TAGS-ash: - -TAGS-ash: \ - configure-ash - @[ -f ./ash/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in ash" ; \ - (cd ash && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-autoconf TAGS-autoconf -maybe-TAGS-autoconf: - -TAGS-autoconf: \ - configure-autoconf - @[ -f ./autoconf/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in autoconf" ; \ - (cd autoconf && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-automake TAGS-automake -maybe-TAGS-automake: - -TAGS-automake: \ - configure-automake - @[ -f ./automake/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in automake" ; \ - (cd automake && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-bash TAGS-bash -maybe-TAGS-bash: - -TAGS-bash: \ - configure-bash - @[ -f ./bash/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in bash" ; \ - (cd bash && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-bfd TAGS-bfd -maybe-TAGS-bfd: - -TAGS-bfd: \ - configure-bfd - @[ -f ./bfd/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in bfd" ; \ - (cd bfd && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-opcodes TAGS-opcodes -maybe-TAGS-opcodes: - -TAGS-opcodes: \ - configure-opcodes - @[ -f ./opcodes/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in opcodes" ; \ - (cd opcodes && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-binutils TAGS-binutils -maybe-TAGS-binutils: - -TAGS-binutils: \ - configure-binutils - @[ -f ./binutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in binutils" ; \ - (cd binutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-bison TAGS-bison -maybe-TAGS-bison: - -TAGS-bison: \ - configure-bison - @[ -f ./bison/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in bison" ; \ - (cd bison && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-byacc TAGS-byacc -maybe-TAGS-byacc: - -TAGS-byacc: \ - configure-byacc - @[ -f ./byacc/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in byacc" ; \ - (cd byacc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-bzip2 TAGS-bzip2 -maybe-TAGS-bzip2: - -TAGS-bzip2: \ - configure-bzip2 - @[ -f ./bzip2/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in bzip2" ; \ - (cd bzip2 && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-dejagnu TAGS-dejagnu -maybe-TAGS-dejagnu: - -TAGS-dejagnu: \ - configure-dejagnu - @[ -f ./dejagnu/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in dejagnu" ; \ - (cd dejagnu && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-diff TAGS-diff -maybe-TAGS-diff: - -TAGS-diff: \ - configure-diff - @[ -f ./diff/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in diff" ; \ - (cd diff && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-dosutils TAGS-dosutils -maybe-TAGS-dosutils: - -TAGS-dosutils: \ - configure-dosutils - @[ -f ./dosutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in dosutils" ; \ - (cd dosutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-etc TAGS-etc -maybe-TAGS-etc: - -TAGS-etc: \ - configure-etc - @[ -f ./etc/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in etc" ; \ - (cd etc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-fastjar TAGS-fastjar -maybe-TAGS-fastjar: - -TAGS-fastjar: \ - configure-fastjar - @[ -f ./fastjar/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in fastjar" ; \ - (cd fastjar && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-fileutils TAGS-fileutils -maybe-TAGS-fileutils: - -TAGS-fileutils: \ - configure-fileutils - @[ -f ./fileutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in fileutils" ; \ - (cd fileutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-findutils TAGS-findutils -maybe-TAGS-findutils: - -TAGS-findutils: \ - configure-findutils - @[ -f ./findutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in findutils" ; \ - (cd findutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-find TAGS-find -maybe-TAGS-find: - -TAGS-find: \ - configure-find - @[ -f ./find/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in find" ; \ - (cd find && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-flex TAGS-flex -maybe-TAGS-flex: - -TAGS-flex: \ - configure-flex - @[ -f ./flex/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in flex" ; \ - (cd flex && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-gas TAGS-gas -maybe-TAGS-gas: - -TAGS-gas: \ - configure-gas - @[ -f ./gas/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in gas" ; \ - (cd gas && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-gawk TAGS-gawk -maybe-TAGS-gawk: - -TAGS-gawk: \ - configure-gawk - @[ -f ./gawk/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in gawk" ; \ - (cd gawk && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-gettext TAGS-gettext -maybe-TAGS-gettext: - -TAGS-gettext: \ - configure-gettext - @[ -f ./gettext/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in gettext" ; \ - (cd gettext && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-gnuserv TAGS-gnuserv -maybe-TAGS-gnuserv: - -TAGS-gnuserv: \ - configure-gnuserv - @[ -f ./gnuserv/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in gnuserv" ; \ - (cd gnuserv && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-gprof TAGS-gprof -maybe-TAGS-gprof: - -TAGS-gprof: \ - configure-gprof - @[ -f ./gprof/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in gprof" ; \ - (cd gprof && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-gzip TAGS-gzip -maybe-TAGS-gzip: - -TAGS-gzip: \ - configure-gzip - @[ -f ./gzip/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in gzip" ; \ - (cd gzip && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-hello TAGS-hello -maybe-TAGS-hello: - -TAGS-hello: \ - configure-hello - @[ -f ./hello/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in hello" ; \ - (cd hello && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-indent TAGS-indent -maybe-TAGS-indent: - -TAGS-indent: \ - configure-indent - @[ -f ./indent/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in indent" ; \ - (cd indent && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-intl TAGS-intl -maybe-TAGS-intl: - -TAGS-intl: \ - configure-intl - @[ -f ./intl/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in intl" ; \ - (cd intl && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-tcl TAGS-tcl -maybe-TAGS-tcl: - -TAGS-tcl: \ - configure-tcl - @[ -f ./tcl/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in tcl" ; \ - (cd tcl && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-itcl TAGS-itcl -maybe-TAGS-itcl: - -TAGS-itcl: \ - configure-itcl - @[ -f ./itcl/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in itcl" ; \ - (cd itcl && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-ld TAGS-ld -maybe-TAGS-ld: - -TAGS-ld: \ - configure-ld - @[ -f ./ld/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in ld" ; \ - (cd ld && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-libgui TAGS-libgui -maybe-TAGS-libgui: - -TAGS-libgui: \ - configure-libgui - @[ -f ./libgui/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in libgui" ; \ - (cd libgui && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-libiberty TAGS-libiberty -maybe-TAGS-libiberty: - -TAGS-libiberty: \ - configure-libiberty - @[ -f ./libiberty/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in libiberty" ; \ - (cd libiberty && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-libtool TAGS-libtool -maybe-TAGS-libtool: - -TAGS-libtool: \ - configure-libtool - @[ -f ./libtool/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in libtool" ; \ - (cd libtool && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-m4 TAGS-m4 -maybe-TAGS-m4: - -TAGS-m4: \ - configure-m4 - @[ -f ./m4/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in m4" ; \ - (cd m4 && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-make TAGS-make -maybe-TAGS-make: - -TAGS-make: \ - configure-make - @[ -f ./make/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in make" ; \ - (cd make && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-mmalloc TAGS-mmalloc -maybe-TAGS-mmalloc: - -TAGS-mmalloc: \ - configure-mmalloc - @[ -f ./mmalloc/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in mmalloc" ; \ - (cd mmalloc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-patch TAGS-patch -maybe-TAGS-patch: - -TAGS-patch: \ - configure-patch - @[ -f ./patch/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in patch" ; \ - (cd patch && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-perl TAGS-perl -maybe-TAGS-perl: - -TAGS-perl: \ - configure-perl - @[ -f ./perl/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in perl" ; \ - (cd perl && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-prms TAGS-prms -maybe-TAGS-prms: - -TAGS-prms: \ - configure-prms - @[ -f ./prms/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in prms" ; \ - (cd prms && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-rcs TAGS-rcs -maybe-TAGS-rcs: - -TAGS-rcs: \ - configure-rcs - @[ -f ./rcs/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in rcs" ; \ - (cd rcs && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-readline TAGS-readline -maybe-TAGS-readline: - -TAGS-readline: \ - configure-readline - @[ -f ./readline/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in readline" ; \ - (cd readline && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-release TAGS-release -maybe-TAGS-release: - -TAGS-release: \ - configure-release - @[ -f ./release/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in release" ; \ - (cd release && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-recode TAGS-recode -maybe-TAGS-recode: - -TAGS-recode: \ - configure-recode - @[ -f ./recode/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in recode" ; \ - (cd recode && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-sed TAGS-sed -maybe-TAGS-sed: - -TAGS-sed: \ - configure-sed - @[ -f ./sed/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in sed" ; \ - (cd sed && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-send-pr TAGS-send-pr -maybe-TAGS-send-pr: - -TAGS-send-pr: \ - configure-send-pr - @[ -f ./send-pr/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in send-pr" ; \ - (cd send-pr && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-shellutils TAGS-shellutils -maybe-TAGS-shellutils: - -TAGS-shellutils: \ - configure-shellutils - @[ -f ./shellutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in shellutils" ; \ - (cd shellutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-sid TAGS-sid -maybe-TAGS-sid: - -TAGS-sid: \ - configure-sid - @[ -f ./sid/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in sid" ; \ - (cd sid && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-sim TAGS-sim -maybe-TAGS-sim: - -TAGS-sim: \ - configure-sim - @[ -f ./sim/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in sim" ; \ - (cd sim && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-tar TAGS-tar -maybe-TAGS-tar: - -TAGS-tar: \ - configure-tar - @[ -f ./tar/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in tar" ; \ - (cd tar && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-texinfo TAGS-texinfo -maybe-TAGS-texinfo: - -TAGS-texinfo: \ - configure-texinfo - @[ -f ./texinfo/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in texinfo" ; \ - (cd texinfo && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-textutils TAGS-textutils -maybe-TAGS-textutils: - -TAGS-textutils: \ - configure-textutils - @[ -f ./textutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in textutils" ; \ - (cd textutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-time TAGS-time -maybe-TAGS-time: - -TAGS-time: \ - configure-time - @[ -f ./time/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in time" ; \ - (cd time && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-uudecode TAGS-uudecode -maybe-TAGS-uudecode: - -TAGS-uudecode: \ - configure-uudecode - @[ -f ./uudecode/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in uudecode" ; \ - (cd uudecode && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-wdiff TAGS-wdiff -maybe-TAGS-wdiff: - -TAGS-wdiff: \ - configure-wdiff - @[ -f ./wdiff/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in wdiff" ; \ - (cd wdiff && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-zip TAGS-zip -maybe-TAGS-zip: - -TAGS-zip: \ - configure-zip - @[ -f ./zip/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in zip" ; \ - (cd zip && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-zlib TAGS-zlib -maybe-TAGS-zlib: - -TAGS-zlib: \ - configure-zlib - @[ -f ./zlib/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in zlib" ; \ - (cd zlib && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-gdb TAGS-gdb -maybe-TAGS-gdb: - -TAGS-gdb: \ - configure-gdb - @[ -f ./gdb/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in gdb" ; \ - (cd gdb && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-expect TAGS-expect -maybe-TAGS-expect: - -TAGS-expect: \ - configure-expect - @[ -f ./expect/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in expect" ; \ - (cd expect && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-guile TAGS-guile -maybe-TAGS-guile: - -TAGS-guile: \ - configure-guile - @[ -f ./guile/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in guile" ; \ - (cd guile && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-tk TAGS-tk -maybe-TAGS-tk: - -TAGS-tk: \ - configure-tk - @[ -f ./tk/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in tk" ; \ - (cd tk && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-tix TAGS-tix -maybe-TAGS-tix: - -TAGS-tix: \ - configure-tix - @[ -f ./tix/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in tix" ; \ - (cd tix && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-libtermcap TAGS-libtermcap -maybe-TAGS-libtermcap: - -TAGS-libtermcap: \ - configure-libtermcap - @[ -f ./libtermcap/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in libtermcap" ; \ - (cd libtermcap && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-utils TAGS-utils -maybe-TAGS-utils: - -TAGS-utils: \ - configure-utils - @[ -f ./utils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing TAGS in utils" ; \ - (cd utils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - - -# Target modules. - -.PHONY: maybe-TAGS-target-libstdc++-v3 TAGS-target-libstdc++-v3 -maybe-TAGS-target-libstdc++-v3: - -TAGS-target-libstdc++-v3: \ - configure-target-libstdc++-v3 - @[ -f $(TARGET_SUBDIR)/libstdc++-v3/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing TAGS in $(TARGET_SUBDIR)/libstdc++-v3" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libstdc++-v3 && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-target-newlib TAGS-target-newlib -maybe-TAGS-target-newlib: - -TAGS-target-newlib: \ - configure-target-newlib - @[ -f $(TARGET_SUBDIR)/newlib/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing TAGS in $(TARGET_SUBDIR)/newlib" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/newlib && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-target-libf2c TAGS-target-libf2c -maybe-TAGS-target-libf2c: - -TAGS-target-libf2c: \ - configure-target-libf2c - @[ -f $(TARGET_SUBDIR)/libf2c/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing TAGS in $(TARGET_SUBDIR)/libf2c" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libf2c && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-target-libobjc TAGS-target-libobjc -maybe-TAGS-target-libobjc: - -TAGS-target-libobjc: \ - configure-target-libobjc - @[ -f $(TARGET_SUBDIR)/libobjc/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing TAGS in $(TARGET_SUBDIR)/libobjc" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libobjc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-target-libtermcap TAGS-target-libtermcap -maybe-TAGS-target-libtermcap: - -TAGS-target-libtermcap: \ - configure-target-libtermcap - @[ -f $(TARGET_SUBDIR)/libtermcap/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing TAGS in $(TARGET_SUBDIR)/libtermcap" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libtermcap && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-target-winsup TAGS-target-winsup -maybe-TAGS-target-winsup: - -TAGS-target-winsup: \ - configure-target-winsup - @[ -f $(TARGET_SUBDIR)/winsup/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing TAGS in $(TARGET_SUBDIR)/winsup" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/winsup && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-target-libgloss TAGS-target-libgloss -maybe-TAGS-target-libgloss: - -TAGS-target-libgloss: \ - configure-target-libgloss - @[ -f $(TARGET_SUBDIR)/libgloss/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing TAGS in $(TARGET_SUBDIR)/libgloss" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libgloss && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-target-libiberty TAGS-target-libiberty -maybe-TAGS-target-libiberty: - -TAGS-target-libiberty: \ - configure-target-libiberty - @[ -f $(TARGET_SUBDIR)/libiberty/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing TAGS in $(TARGET_SUBDIR)/libiberty" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libiberty && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-target-gperf TAGS-target-gperf -maybe-TAGS-target-gperf: - -TAGS-target-gperf: \ - configure-target-gperf - @[ -f $(TARGET_SUBDIR)/gperf/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing TAGS in $(TARGET_SUBDIR)/gperf" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/gperf && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-target-examples TAGS-target-examples -maybe-TAGS-target-examples: - -TAGS-target-examples: \ - configure-target-examples - @[ -f $(TARGET_SUBDIR)/examples/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing TAGS in $(TARGET_SUBDIR)/examples" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/examples && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-target-libffi TAGS-target-libffi -maybe-TAGS-target-libffi: - -TAGS-target-libffi: \ - configure-target-libffi - @[ -f $(TARGET_SUBDIR)/libffi/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing TAGS in $(TARGET_SUBDIR)/libffi" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libffi && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-target-libjava TAGS-target-libjava -maybe-TAGS-target-libjava: - -TAGS-target-libjava: \ - configure-target-libjava - @[ -f $(TARGET_SUBDIR)/libjava/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing TAGS in $(TARGET_SUBDIR)/libjava" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libjava && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-target-zlib TAGS-target-zlib -maybe-TAGS-target-zlib: - -TAGS-target-zlib: \ - configure-target-zlib - @[ -f $(TARGET_SUBDIR)/zlib/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing TAGS in $(TARGET_SUBDIR)/zlib" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/zlib && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-target-boehm-gc TAGS-target-boehm-gc -maybe-TAGS-target-boehm-gc: - -TAGS-target-boehm-gc: \ - configure-target-boehm-gc - @[ -f $(TARGET_SUBDIR)/boehm-gc/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing TAGS in $(TARGET_SUBDIR)/boehm-gc" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/boehm-gc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-target-qthreads TAGS-target-qthreads -maybe-TAGS-target-qthreads: - -TAGS-target-qthreads: \ - configure-target-qthreads - @[ -f $(TARGET_SUBDIR)/qthreads/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing TAGS in $(TARGET_SUBDIR)/qthreads" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/qthreads && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-target-rda TAGS-target-rda -maybe-TAGS-target-rda: - -TAGS-target-rda: \ - configure-target-rda - @[ -f $(TARGET_SUBDIR)/rda/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing TAGS in $(TARGET_SUBDIR)/rda" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/rda && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - - -.PHONY: maybe-TAGS-target-libada TAGS-target-libada -maybe-TAGS-target-libada: - -TAGS-target-libada: \ - configure-target-libada - @[ -f $(TARGET_SUBDIR)/libada/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing TAGS in $(TARGET_SUBDIR)/libada" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libada && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - TAGS) \ - || exit 1 - +TAGS-target: maybe-TAGS-target-libstdc++-v3 +TAGS-target: maybe-TAGS-target-libmudflap +TAGS-target: maybe-TAGS-target-libssp +TAGS-target: maybe-TAGS-target-libgcc-math +TAGS-target: maybe-TAGS-target-newlib +TAGS-target: maybe-TAGS-target-libgfortran +TAGS-target: maybe-TAGS-target-libobjc +TAGS-target: maybe-TAGS-target-libtermcap +TAGS-target: maybe-TAGS-target-winsup +TAGS-target: maybe-TAGS-target-libgloss +TAGS-target: maybe-TAGS-target-libiberty +TAGS-target: maybe-TAGS-target-gperf +TAGS-target: maybe-TAGS-target-examples +TAGS-target: maybe-TAGS-target-libffi +TAGS-target: maybe-TAGS-target-libjava +TAGS-target: maybe-TAGS-target-zlib +TAGS-target: maybe-TAGS-target-boehm-gc +TAGS-target: maybe-TAGS-target-qthreads +TAGS-target: maybe-TAGS-target-rda +TAGS-target: maybe-TAGS-target-libada +TAGS-target: maybe-TAGS-target-libgomp .PHONY: do-install-info -do-install-info: install-info-host install-info-target +do-install-info: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(MAKE) $(RECURSE_FLAGS_TO_PASS) install-info-host \ + install-info-target + .PHONY: install-info-host -install-info-host: maybe-install-info-gcc \ - maybe-install-info-ash \ - maybe-install-info-autoconf \ - maybe-install-info-automake \ - maybe-install-info-bash \ - maybe-install-info-bfd \ - maybe-install-info-opcodes \ - maybe-install-info-binutils \ - maybe-install-info-bison \ - maybe-install-info-byacc \ - maybe-install-info-bzip2 \ - maybe-install-info-dejagnu \ - maybe-install-info-diff \ - maybe-install-info-dosutils \ - maybe-install-info-etc \ - maybe-install-info-fastjar \ - maybe-install-info-fileutils \ - maybe-install-info-findutils \ - maybe-install-info-find \ - maybe-install-info-flex \ - maybe-install-info-gas \ - maybe-install-info-gawk \ - maybe-install-info-gettext \ - maybe-install-info-gnuserv \ - maybe-install-info-gprof \ - maybe-install-info-gzip \ - maybe-install-info-hello \ - maybe-install-info-indent \ - maybe-install-info-intl \ - maybe-install-info-tcl \ - maybe-install-info-itcl \ - maybe-install-info-ld \ - maybe-install-info-libgui \ - maybe-install-info-libiberty \ - maybe-install-info-libtool \ - maybe-install-info-m4 \ - maybe-install-info-make \ - maybe-install-info-mmalloc \ - maybe-install-info-patch \ - maybe-install-info-perl \ - maybe-install-info-prms \ - maybe-install-info-rcs \ - maybe-install-info-readline \ - maybe-install-info-release \ - maybe-install-info-recode \ - maybe-install-info-sed \ - maybe-install-info-send-pr \ - maybe-install-info-shellutils \ - maybe-install-info-sid \ - maybe-install-info-sim \ - maybe-install-info-tar \ - maybe-install-info-texinfo \ - maybe-install-info-textutils \ - maybe-install-info-time \ - maybe-install-info-uudecode \ - maybe-install-info-wdiff \ - maybe-install-info-zip \ - maybe-install-info-zlib \ - maybe-install-info-gdb \ - maybe-install-info-expect \ - maybe-install-info-guile \ - maybe-install-info-tk \ - maybe-install-info-tix \ - maybe-install-info-libtermcap \ - maybe-install-info-utils + +install-info-host: maybe-install-info-ash +install-info-host: maybe-install-info-autoconf +install-info-host: maybe-install-info-automake +install-info-host: maybe-install-info-bash +install-info-host: maybe-install-info-bfd +install-info-host: maybe-install-info-opcodes +install-info-host: maybe-install-info-binutils +install-info-host: maybe-install-info-bison +install-info-host: maybe-install-info-byacc +install-info-host: maybe-install-info-bzip2 +install-info-host: maybe-install-info-dejagnu +install-info-host: maybe-install-info-diff +install-info-host: maybe-install-info-dosutils +install-info-host: maybe-install-info-etc +install-info-host: maybe-install-info-fastjar +install-info-host: maybe-install-info-fileutils +install-info-host: maybe-install-info-findutils +install-info-host: maybe-install-info-find +install-info-host: maybe-install-info-fixincludes +install-info-host: maybe-install-info-flex +install-info-host: maybe-install-info-gas +install-info-host: maybe-install-info-gcc +install-info-host: maybe-install-info-gawk +install-info-host: maybe-install-info-gettext +install-info-host: maybe-install-info-gnuserv +install-info-host: maybe-install-info-gprof +install-info-host: maybe-install-info-gzip +install-info-host: maybe-install-info-hello +install-info-host: maybe-install-info-indent +install-info-host: maybe-install-info-intl +install-info-host: maybe-install-info-tcl +install-info-host: maybe-install-info-itcl +install-info-host: maybe-install-info-ld +install-info-host: maybe-install-info-libcpp +install-info-host: maybe-install-info-libdecnumber +install-info-host: maybe-install-info-libgui +install-info-host: maybe-install-info-libiberty +install-info-host: maybe-install-info-libtool +install-info-host: maybe-install-info-m4 +install-info-host: maybe-install-info-make +install-info-host: maybe-install-info-mmalloc +install-info-host: maybe-install-info-patch +install-info-host: maybe-install-info-perl +install-info-host: maybe-install-info-prms +install-info-host: maybe-install-info-rcs +install-info-host: maybe-install-info-readline +install-info-host: maybe-install-info-release +install-info-host: maybe-install-info-recode +install-info-host: maybe-install-info-sed +install-info-host: maybe-install-info-send-pr +install-info-host: maybe-install-info-shellutils +install-info-host: maybe-install-info-sid +install-info-host: maybe-install-info-sim +install-info-host: maybe-install-info-tar +install-info-host: maybe-install-info-texinfo +install-info-host: maybe-install-info-textutils +install-info-host: maybe-install-info-time +install-info-host: maybe-install-info-uudecode +install-info-host: maybe-install-info-wdiff +install-info-host: maybe-install-info-zip +install-info-host: maybe-install-info-zlib +install-info-host: maybe-install-info-gdb +install-info-host: maybe-install-info-expect +install-info-host: maybe-install-info-guile +install-info-host: maybe-install-info-tk +install-info-host: maybe-install-info-libtermcap +install-info-host: maybe-install-info-utils +install-info-host: maybe-install-info-gnattools .PHONY: install-info-target -install-info-target: \ - maybe-install-info-target-libstdc++-v3 \ - maybe-install-info-target-newlib \ - maybe-install-info-target-libf2c \ - maybe-install-info-target-libobjc \ - maybe-install-info-target-libtermcap \ - maybe-install-info-target-winsup \ - maybe-install-info-target-libgloss \ - maybe-install-info-target-libiberty \ - maybe-install-info-target-gperf \ - maybe-install-info-target-examples \ - maybe-install-info-target-libffi \ - maybe-install-info-target-libjava \ - maybe-install-info-target-zlib \ - maybe-install-info-target-boehm-gc \ - maybe-install-info-target-qthreads \ - maybe-install-info-target-rda \ - maybe-install-info-target-libada - -# GCC, the eternal special case -.PHONY: maybe-install-info-gcc install-info-gcc -maybe-install-info-gcc: -install-info-gcc: \ - configure-gcc \ - info-gcc - @[ -f ./gcc/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_GCC_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in gcc" ; \ - (cd gcc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - -# Host modules. - -.PHONY: maybe-install-info-ash install-info-ash -maybe-install-info-ash: - -install-info-ash: \ - configure-ash \ - info-ash - @[ -f ./ash/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in ash" ; \ - (cd ash && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-autoconf install-info-autoconf -maybe-install-info-autoconf: - -install-info-autoconf: \ - configure-autoconf \ - info-autoconf - @[ -f ./autoconf/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in autoconf" ; \ - (cd autoconf && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-automake install-info-automake -maybe-install-info-automake: - -install-info-automake: \ - configure-automake \ - info-automake - @[ -f ./automake/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in automake" ; \ - (cd automake && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-bash install-info-bash -maybe-install-info-bash: - -install-info-bash: \ - configure-bash \ - info-bash - @[ -f ./bash/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in bash" ; \ - (cd bash && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-bfd install-info-bfd -maybe-install-info-bfd: - -install-info-bfd: \ - configure-bfd \ - info-bfd - @[ -f ./bfd/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in bfd" ; \ - (cd bfd && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-opcodes install-info-opcodes -maybe-install-info-opcodes: - -install-info-opcodes: \ - configure-opcodes \ - info-opcodes - @[ -f ./opcodes/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in opcodes" ; \ - (cd opcodes && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-binutils install-info-binutils -maybe-install-info-binutils: - -install-info-binutils: \ - configure-binutils \ - info-binutils - @[ -f ./binutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in binutils" ; \ - (cd binutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-bison install-info-bison -maybe-install-info-bison: - -install-info-bison: \ - configure-bison \ - info-bison - @[ -f ./bison/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in bison" ; \ - (cd bison && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-byacc install-info-byacc -maybe-install-info-byacc: - -install-info-byacc: \ - configure-byacc \ - info-byacc - @[ -f ./byacc/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in byacc" ; \ - (cd byacc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-bzip2 install-info-bzip2 -maybe-install-info-bzip2: - -install-info-bzip2: \ - configure-bzip2 \ - info-bzip2 - @[ -f ./bzip2/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in bzip2" ; \ - (cd bzip2 && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-dejagnu install-info-dejagnu -maybe-install-info-dejagnu: - -install-info-dejagnu: \ - configure-dejagnu \ - info-dejagnu - @[ -f ./dejagnu/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in dejagnu" ; \ - (cd dejagnu && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-diff install-info-diff -maybe-install-info-diff: - -install-info-diff: \ - configure-diff \ - info-diff - @[ -f ./diff/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in diff" ; \ - (cd diff && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-dosutils install-info-dosutils -maybe-install-info-dosutils: - -install-info-dosutils: \ - configure-dosutils \ - info-dosutils - @[ -f ./dosutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in dosutils" ; \ - (cd dosutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-etc install-info-etc -maybe-install-info-etc: - -install-info-etc: \ - configure-etc \ - info-etc - @[ -f ./etc/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in etc" ; \ - (cd etc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-fastjar install-info-fastjar -maybe-install-info-fastjar: - -install-info-fastjar: \ - configure-fastjar \ - info-fastjar - @[ -f ./fastjar/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in fastjar" ; \ - (cd fastjar && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-fileutils install-info-fileutils -maybe-install-info-fileutils: - -install-info-fileutils: \ - configure-fileutils \ - info-fileutils - @[ -f ./fileutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in fileutils" ; \ - (cd fileutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-findutils install-info-findutils -maybe-install-info-findutils: - -install-info-findutils: \ - configure-findutils \ - info-findutils - @[ -f ./findutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in findutils" ; \ - (cd findutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-find install-info-find -maybe-install-info-find: - -install-info-find: \ - configure-find \ - info-find - @[ -f ./find/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in find" ; \ - (cd find && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-flex install-info-flex -maybe-install-info-flex: - -install-info-flex: \ - configure-flex \ - info-flex - @[ -f ./flex/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in flex" ; \ - (cd flex && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-gas install-info-gas -maybe-install-info-gas: - -install-info-gas: \ - configure-gas \ - info-gas - @[ -f ./gas/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in gas" ; \ - (cd gas && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-gawk install-info-gawk -maybe-install-info-gawk: - -install-info-gawk: \ - configure-gawk \ - info-gawk - @[ -f ./gawk/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in gawk" ; \ - (cd gawk && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-gettext install-info-gettext -maybe-install-info-gettext: - -install-info-gettext: \ - configure-gettext \ - info-gettext - @[ -f ./gettext/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in gettext" ; \ - (cd gettext && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-gnuserv install-info-gnuserv -maybe-install-info-gnuserv: - -install-info-gnuserv: \ - configure-gnuserv \ - info-gnuserv - @[ -f ./gnuserv/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in gnuserv" ; \ - (cd gnuserv && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-gprof install-info-gprof -maybe-install-info-gprof: - -install-info-gprof: \ - configure-gprof \ - info-gprof - @[ -f ./gprof/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in gprof" ; \ - (cd gprof && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-gzip install-info-gzip -maybe-install-info-gzip: - -install-info-gzip: \ - configure-gzip \ - info-gzip - @[ -f ./gzip/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in gzip" ; \ - (cd gzip && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-hello install-info-hello -maybe-install-info-hello: - -install-info-hello: \ - configure-hello \ - info-hello - @[ -f ./hello/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in hello" ; \ - (cd hello && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-indent install-info-indent -maybe-install-info-indent: - -install-info-indent: \ - configure-indent \ - info-indent - @[ -f ./indent/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in indent" ; \ - (cd indent && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-intl install-info-intl -maybe-install-info-intl: - -install-info-intl: \ - configure-intl \ - info-intl - @[ -f ./intl/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in intl" ; \ - (cd intl && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-tcl install-info-tcl -maybe-install-info-tcl: - -install-info-tcl: \ - configure-tcl \ - info-tcl - @[ -f ./tcl/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in tcl" ; \ - (cd tcl && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-itcl install-info-itcl -maybe-install-info-itcl: - -install-info-itcl: \ - configure-itcl \ - info-itcl - @[ -f ./itcl/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in itcl" ; \ - (cd itcl && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-ld install-info-ld -maybe-install-info-ld: - -install-info-ld: \ - configure-ld \ - info-ld - @[ -f ./ld/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in ld" ; \ - (cd ld && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-libgui install-info-libgui -maybe-install-info-libgui: - -install-info-libgui: \ - configure-libgui \ - info-libgui - @[ -f ./libgui/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in libgui" ; \ - (cd libgui && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-libiberty install-info-libiberty -maybe-install-info-libiberty: - -install-info-libiberty: \ - configure-libiberty \ - info-libiberty - @[ -f ./libiberty/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in libiberty" ; \ - (cd libiberty && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-libtool install-info-libtool -maybe-install-info-libtool: - -install-info-libtool: \ - configure-libtool \ - info-libtool - @[ -f ./libtool/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in libtool" ; \ - (cd libtool && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-m4 install-info-m4 -maybe-install-info-m4: - -install-info-m4: \ - configure-m4 \ - info-m4 - @[ -f ./m4/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in m4" ; \ - (cd m4 && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-make install-info-make -maybe-install-info-make: - -install-info-make: \ - configure-make \ - info-make - @[ -f ./make/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in make" ; \ - (cd make && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-mmalloc install-info-mmalloc -maybe-install-info-mmalloc: - -install-info-mmalloc: \ - configure-mmalloc \ - info-mmalloc - @[ -f ./mmalloc/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in mmalloc" ; \ - (cd mmalloc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-patch install-info-patch -maybe-install-info-patch: - -install-info-patch: \ - configure-patch \ - info-patch - @[ -f ./patch/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in patch" ; \ - (cd patch && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-perl install-info-perl -maybe-install-info-perl: - -install-info-perl: \ - configure-perl \ - info-perl - @[ -f ./perl/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in perl" ; \ - (cd perl && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-prms install-info-prms -maybe-install-info-prms: - -install-info-prms: \ - configure-prms \ - info-prms - @[ -f ./prms/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in prms" ; \ - (cd prms && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-rcs install-info-rcs -maybe-install-info-rcs: - -install-info-rcs: \ - configure-rcs \ - info-rcs - @[ -f ./rcs/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in rcs" ; \ - (cd rcs && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-readline install-info-readline -maybe-install-info-readline: - -install-info-readline: \ - configure-readline \ - info-readline - @[ -f ./readline/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in readline" ; \ - (cd readline && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-release install-info-release -maybe-install-info-release: - -install-info-release: \ - configure-release \ - info-release - @[ -f ./release/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in release" ; \ - (cd release && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-recode install-info-recode -maybe-install-info-recode: - -install-info-recode: \ - configure-recode \ - info-recode - @[ -f ./recode/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in recode" ; \ - (cd recode && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-sed install-info-sed -maybe-install-info-sed: - -install-info-sed: \ - configure-sed \ - info-sed - @[ -f ./sed/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in sed" ; \ - (cd sed && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-send-pr install-info-send-pr -maybe-install-info-send-pr: - -install-info-send-pr: \ - configure-send-pr \ - info-send-pr - @[ -f ./send-pr/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in send-pr" ; \ - (cd send-pr && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-shellutils install-info-shellutils -maybe-install-info-shellutils: - -install-info-shellutils: \ - configure-shellutils \ - info-shellutils - @[ -f ./shellutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in shellutils" ; \ - (cd shellutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-sid install-info-sid -maybe-install-info-sid: - -install-info-sid: \ - configure-sid \ - info-sid - @[ -f ./sid/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in sid" ; \ - (cd sid && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-sim install-info-sim -maybe-install-info-sim: - -install-info-sim: \ - configure-sim \ - info-sim - @[ -f ./sim/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in sim" ; \ - (cd sim && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-tar install-info-tar -maybe-install-info-tar: - -install-info-tar: \ - configure-tar \ - info-tar - @[ -f ./tar/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in tar" ; \ - (cd tar && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-texinfo install-info-texinfo -maybe-install-info-texinfo: - -install-info-texinfo: \ - configure-texinfo \ - info-texinfo - @[ -f ./texinfo/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in texinfo" ; \ - (cd texinfo && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-textutils install-info-textutils -maybe-install-info-textutils: - -install-info-textutils: \ - configure-textutils \ - info-textutils - @[ -f ./textutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in textutils" ; \ - (cd textutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-time install-info-time -maybe-install-info-time: - -install-info-time: \ - configure-time \ - info-time - @[ -f ./time/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in time" ; \ - (cd time && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-uudecode install-info-uudecode -maybe-install-info-uudecode: - -install-info-uudecode: \ - configure-uudecode \ - info-uudecode - @[ -f ./uudecode/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in uudecode" ; \ - (cd uudecode && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-wdiff install-info-wdiff -maybe-install-info-wdiff: - -install-info-wdiff: \ - configure-wdiff \ - info-wdiff - @[ -f ./wdiff/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in wdiff" ; \ - (cd wdiff && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-zip install-info-zip -maybe-install-info-zip: - -install-info-zip: \ - configure-zip \ - info-zip - @[ -f ./zip/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in zip" ; \ - (cd zip && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-zlib install-info-zlib -maybe-install-info-zlib: - -install-info-zlib: \ - configure-zlib \ - info-zlib - @[ -f ./zlib/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in zlib" ; \ - (cd zlib && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-gdb install-info-gdb -maybe-install-info-gdb: - -install-info-gdb: \ - configure-gdb \ - info-gdb - @[ -f ./gdb/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in gdb" ; \ - (cd gdb && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-expect install-info-expect -maybe-install-info-expect: - -install-info-expect: \ - configure-expect \ - info-expect - @[ -f ./expect/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in expect" ; \ - (cd expect && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-guile install-info-guile -maybe-install-info-guile: - -install-info-guile: \ - configure-guile \ - info-guile - @[ -f ./guile/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in guile" ; \ - (cd guile && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-tk install-info-tk -maybe-install-info-tk: - -install-info-tk: \ - configure-tk \ - info-tk - @[ -f ./tk/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in tk" ; \ - (cd tk && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-tix install-info-tix -maybe-install-info-tix: - -install-info-tix: \ - configure-tix \ - info-tix - @[ -f ./tix/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in tix" ; \ - (cd tix && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-libtermcap install-info-libtermcap -maybe-install-info-libtermcap: - -install-info-libtermcap: \ - configure-libtermcap \ - info-libtermcap - @[ -f ./libtermcap/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in libtermcap" ; \ - (cd libtermcap && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-utils install-info-utils -maybe-install-info-utils: - -install-info-utils: \ - configure-utils \ - info-utils - @[ -f ./utils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing install-info in utils" ; \ - (cd utils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - - -# Target modules. - -.PHONY: maybe-install-info-target-libstdc++-v3 install-info-target-libstdc++-v3 -maybe-install-info-target-libstdc++-v3: - -install-info-target-libstdc++-v3: \ - configure-target-libstdc++-v3 \ - info-target-libstdc++-v3 - @[ -f $(TARGET_SUBDIR)/libstdc++-v3/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing install-info in $(TARGET_SUBDIR)/libstdc++-v3" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libstdc++-v3 && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-target-newlib install-info-target-newlib -maybe-install-info-target-newlib: - -install-info-target-newlib: \ - configure-target-newlib \ - info-target-newlib - @[ -f $(TARGET_SUBDIR)/newlib/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing install-info in $(TARGET_SUBDIR)/newlib" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/newlib && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-target-libf2c install-info-target-libf2c -maybe-install-info-target-libf2c: - -install-info-target-libf2c: \ - configure-target-libf2c \ - info-target-libf2c - @[ -f $(TARGET_SUBDIR)/libf2c/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing install-info in $(TARGET_SUBDIR)/libf2c" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libf2c && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-target-libobjc install-info-target-libobjc -maybe-install-info-target-libobjc: - -install-info-target-libobjc: \ - configure-target-libobjc \ - info-target-libobjc - @[ -f $(TARGET_SUBDIR)/libobjc/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing install-info in $(TARGET_SUBDIR)/libobjc" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libobjc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-target-libtermcap install-info-target-libtermcap -maybe-install-info-target-libtermcap: - -install-info-target-libtermcap: \ - configure-target-libtermcap \ - info-target-libtermcap - @[ -f $(TARGET_SUBDIR)/libtermcap/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing install-info in $(TARGET_SUBDIR)/libtermcap" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libtermcap && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-target-winsup install-info-target-winsup -maybe-install-info-target-winsup: - -install-info-target-winsup: \ - configure-target-winsup \ - info-target-winsup - @[ -f $(TARGET_SUBDIR)/winsup/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing install-info in $(TARGET_SUBDIR)/winsup" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/winsup && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-target-libgloss install-info-target-libgloss -maybe-install-info-target-libgloss: - -install-info-target-libgloss: \ - configure-target-libgloss \ - info-target-libgloss - @[ -f $(TARGET_SUBDIR)/libgloss/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing install-info in $(TARGET_SUBDIR)/libgloss" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libgloss && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-target-libiberty install-info-target-libiberty -maybe-install-info-target-libiberty: - -install-info-target-libiberty: \ - configure-target-libiberty \ - info-target-libiberty - @[ -f $(TARGET_SUBDIR)/libiberty/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing install-info in $(TARGET_SUBDIR)/libiberty" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libiberty && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-target-gperf install-info-target-gperf -maybe-install-info-target-gperf: - -install-info-target-gperf: \ - configure-target-gperf \ - info-target-gperf - @[ -f $(TARGET_SUBDIR)/gperf/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing install-info in $(TARGET_SUBDIR)/gperf" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/gperf && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-target-examples install-info-target-examples -maybe-install-info-target-examples: - -install-info-target-examples: \ - configure-target-examples \ - info-target-examples - @[ -f $(TARGET_SUBDIR)/examples/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing install-info in $(TARGET_SUBDIR)/examples" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/examples && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-target-libffi install-info-target-libffi -maybe-install-info-target-libffi: - -install-info-target-libffi: \ - configure-target-libffi \ - info-target-libffi - @[ -f $(TARGET_SUBDIR)/libffi/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing install-info in $(TARGET_SUBDIR)/libffi" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libffi && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-target-libjava install-info-target-libjava -maybe-install-info-target-libjava: - -install-info-target-libjava: \ - configure-target-libjava \ - info-target-libjava - @[ -f $(TARGET_SUBDIR)/libjava/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing install-info in $(TARGET_SUBDIR)/libjava" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libjava && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-target-zlib install-info-target-zlib -maybe-install-info-target-zlib: - -install-info-target-zlib: \ - configure-target-zlib \ - info-target-zlib - @[ -f $(TARGET_SUBDIR)/zlib/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing install-info in $(TARGET_SUBDIR)/zlib" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/zlib && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-target-boehm-gc install-info-target-boehm-gc -maybe-install-info-target-boehm-gc: - -install-info-target-boehm-gc: \ - configure-target-boehm-gc \ - info-target-boehm-gc - @[ -f $(TARGET_SUBDIR)/boehm-gc/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing install-info in $(TARGET_SUBDIR)/boehm-gc" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/boehm-gc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-target-qthreads install-info-target-qthreads -maybe-install-info-target-qthreads: - -install-info-target-qthreads: \ - configure-target-qthreads \ - info-target-qthreads - @[ -f $(TARGET_SUBDIR)/qthreads/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing install-info in $(TARGET_SUBDIR)/qthreads" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/qthreads && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-target-rda install-info-target-rda -maybe-install-info-target-rda: - -install-info-target-rda: \ - configure-target-rda \ - info-target-rda - @[ -f $(TARGET_SUBDIR)/rda/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing install-info in $(TARGET_SUBDIR)/rda" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/rda && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - - -.PHONY: maybe-install-info-target-libada install-info-target-libada -maybe-install-info-target-libada: - -install-info-target-libada: \ - configure-target-libada \ - info-target-libada - @[ -f $(TARGET_SUBDIR)/libada/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing install-info in $(TARGET_SUBDIR)/libada" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libada && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - install-info) \ - || exit 1 - +install-info-target: maybe-install-info-target-libstdc++-v3 +install-info-target: maybe-install-info-target-libmudflap +install-info-target: maybe-install-info-target-libssp +install-info-target: maybe-install-info-target-libgcc-math +install-info-target: maybe-install-info-target-newlib +install-info-target: maybe-install-info-target-libgfortran +install-info-target: maybe-install-info-target-libobjc +install-info-target: maybe-install-info-target-libtermcap +install-info-target: maybe-install-info-target-winsup +install-info-target: maybe-install-info-target-libgloss +install-info-target: maybe-install-info-target-libiberty +install-info-target: maybe-install-info-target-gperf +install-info-target: maybe-install-info-target-examples +install-info-target: maybe-install-info-target-libffi +install-info-target: maybe-install-info-target-libjava +install-info-target: maybe-install-info-target-zlib +install-info-target: maybe-install-info-target-boehm-gc +install-info-target: maybe-install-info-target-qthreads +install-info-target: maybe-install-info-target-rda +install-info-target: maybe-install-info-target-libada +install-info-target: maybe-install-info-target-libgomp + +.PHONY: do-install-html +do-install-html: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(MAKE) $(RECURSE_FLAGS_TO_PASS) install-html-host \ + install-html-target + + +.PHONY: install-html-host + +install-html-host: maybe-install-html-ash +install-html-host: maybe-install-html-autoconf +install-html-host: maybe-install-html-automake +install-html-host: maybe-install-html-bash +install-html-host: maybe-install-html-bfd +install-html-host: maybe-install-html-opcodes +install-html-host: maybe-install-html-binutils +install-html-host: maybe-install-html-bison +install-html-host: maybe-install-html-byacc +install-html-host: maybe-install-html-bzip2 +install-html-host: maybe-install-html-dejagnu +install-html-host: maybe-install-html-diff +install-html-host: maybe-install-html-dosutils +install-html-host: maybe-install-html-etc +install-html-host: maybe-install-html-fastjar +install-html-host: maybe-install-html-fileutils +install-html-host: maybe-install-html-findutils +install-html-host: maybe-install-html-find +install-html-host: maybe-install-html-fixincludes +install-html-host: maybe-install-html-flex +install-html-host: maybe-install-html-gas +install-html-host: maybe-install-html-gcc +install-html-host: maybe-install-html-gawk +install-html-host: maybe-install-html-gettext +install-html-host: maybe-install-html-gnuserv +install-html-host: maybe-install-html-gprof +install-html-host: maybe-install-html-gzip +install-html-host: maybe-install-html-hello +install-html-host: maybe-install-html-indent +install-html-host: maybe-install-html-intl +install-html-host: maybe-install-html-tcl +install-html-host: maybe-install-html-itcl +install-html-host: maybe-install-html-ld +install-html-host: maybe-install-html-libcpp +install-html-host: maybe-install-html-libdecnumber +install-html-host: maybe-install-html-libgui +install-html-host: maybe-install-html-libiberty +install-html-host: maybe-install-html-libtool +install-html-host: maybe-install-html-m4 +install-html-host: maybe-install-html-make +install-html-host: maybe-install-html-mmalloc +install-html-host: maybe-install-html-patch +install-html-host: maybe-install-html-perl +install-html-host: maybe-install-html-prms +install-html-host: maybe-install-html-rcs +install-html-host: maybe-install-html-readline +install-html-host: maybe-install-html-release +install-html-host: maybe-install-html-recode +install-html-host: maybe-install-html-sed +install-html-host: maybe-install-html-send-pr +install-html-host: maybe-install-html-shellutils +install-html-host: maybe-install-html-sid +install-html-host: maybe-install-html-sim +install-html-host: maybe-install-html-tar +install-html-host: maybe-install-html-texinfo +install-html-host: maybe-install-html-textutils +install-html-host: maybe-install-html-time +install-html-host: maybe-install-html-uudecode +install-html-host: maybe-install-html-wdiff +install-html-host: maybe-install-html-zip +install-html-host: maybe-install-html-zlib +install-html-host: maybe-install-html-gdb +install-html-host: maybe-install-html-expect +install-html-host: maybe-install-html-guile +install-html-host: maybe-install-html-tk +install-html-host: maybe-install-html-libtermcap +install-html-host: maybe-install-html-utils +install-html-host: maybe-install-html-gnattools + +.PHONY: install-html-target + +install-html-target: maybe-install-html-target-libstdc++-v3 +install-html-target: maybe-install-html-target-libmudflap +install-html-target: maybe-install-html-target-libssp +install-html-target: maybe-install-html-target-libgcc-math +install-html-target: maybe-install-html-target-newlib +install-html-target: maybe-install-html-target-libgfortran +install-html-target: maybe-install-html-target-libobjc +install-html-target: maybe-install-html-target-libtermcap +install-html-target: maybe-install-html-target-winsup +install-html-target: maybe-install-html-target-libgloss +install-html-target: maybe-install-html-target-libiberty +install-html-target: maybe-install-html-target-gperf +install-html-target: maybe-install-html-target-examples +install-html-target: maybe-install-html-target-libffi +install-html-target: maybe-install-html-target-libjava +install-html-target: maybe-install-html-target-zlib +install-html-target: maybe-install-html-target-boehm-gc +install-html-target: maybe-install-html-target-qthreads +install-html-target: maybe-install-html-target-rda +install-html-target: maybe-install-html-target-libada +install-html-target: maybe-install-html-target-libgomp .PHONY: do-installcheck -do-installcheck: installcheck-host installcheck-target +do-installcheck: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(MAKE) $(RECURSE_FLAGS_TO_PASS) installcheck-host \ + installcheck-target + .PHONY: installcheck-host -installcheck-host: maybe-installcheck-gcc \ - maybe-installcheck-ash \ - maybe-installcheck-autoconf \ - maybe-installcheck-automake \ - maybe-installcheck-bash \ - maybe-installcheck-bfd \ - maybe-installcheck-opcodes \ - maybe-installcheck-binutils \ - maybe-installcheck-bison \ - maybe-installcheck-byacc \ - maybe-installcheck-bzip2 \ - maybe-installcheck-dejagnu \ - maybe-installcheck-diff \ - maybe-installcheck-dosutils \ - maybe-installcheck-etc \ - maybe-installcheck-fastjar \ - maybe-installcheck-fileutils \ - maybe-installcheck-findutils \ - maybe-installcheck-find \ - maybe-installcheck-flex \ - maybe-installcheck-gas \ - maybe-installcheck-gawk \ - maybe-installcheck-gettext \ - maybe-installcheck-gnuserv \ - maybe-installcheck-gprof \ - maybe-installcheck-gzip \ - maybe-installcheck-hello \ - maybe-installcheck-indent \ - maybe-installcheck-intl \ - maybe-installcheck-tcl \ - maybe-installcheck-itcl \ - maybe-installcheck-ld \ - maybe-installcheck-libgui \ - maybe-installcheck-libiberty \ - maybe-installcheck-libtool \ - maybe-installcheck-m4 \ - maybe-installcheck-make \ - maybe-installcheck-mmalloc \ - maybe-installcheck-patch \ - maybe-installcheck-perl \ - maybe-installcheck-prms \ - maybe-installcheck-rcs \ - maybe-installcheck-readline \ - maybe-installcheck-release \ - maybe-installcheck-recode \ - maybe-installcheck-sed \ - maybe-installcheck-send-pr \ - maybe-installcheck-shellutils \ - maybe-installcheck-sid \ - maybe-installcheck-sim \ - maybe-installcheck-tar \ - maybe-installcheck-texinfo \ - maybe-installcheck-textutils \ - maybe-installcheck-time \ - maybe-installcheck-uudecode \ - maybe-installcheck-wdiff \ - maybe-installcheck-zip \ - maybe-installcheck-zlib \ - maybe-installcheck-gdb \ - maybe-installcheck-expect \ - maybe-installcheck-guile \ - maybe-installcheck-tk \ - maybe-installcheck-tix \ - maybe-installcheck-libtermcap \ - maybe-installcheck-utils + +installcheck-host: maybe-installcheck-ash +installcheck-host: maybe-installcheck-autoconf +installcheck-host: maybe-installcheck-automake +installcheck-host: maybe-installcheck-bash +installcheck-host: maybe-installcheck-bfd +installcheck-host: maybe-installcheck-opcodes +installcheck-host: maybe-installcheck-binutils +installcheck-host: maybe-installcheck-bison +installcheck-host: maybe-installcheck-byacc +installcheck-host: maybe-installcheck-bzip2 +installcheck-host: maybe-installcheck-dejagnu +installcheck-host: maybe-installcheck-diff +installcheck-host: maybe-installcheck-dosutils +installcheck-host: maybe-installcheck-etc +installcheck-host: maybe-installcheck-fastjar +installcheck-host: maybe-installcheck-fileutils +installcheck-host: maybe-installcheck-findutils +installcheck-host: maybe-installcheck-find +installcheck-host: maybe-installcheck-fixincludes +installcheck-host: maybe-installcheck-flex +installcheck-host: maybe-installcheck-gas +installcheck-host: maybe-installcheck-gcc +installcheck-host: maybe-installcheck-gawk +installcheck-host: maybe-installcheck-gettext +installcheck-host: maybe-installcheck-gnuserv +installcheck-host: maybe-installcheck-gprof +installcheck-host: maybe-installcheck-gzip +installcheck-host: maybe-installcheck-hello +installcheck-host: maybe-installcheck-indent +installcheck-host: maybe-installcheck-intl +installcheck-host: maybe-installcheck-tcl +installcheck-host: maybe-installcheck-itcl +installcheck-host: maybe-installcheck-ld +installcheck-host: maybe-installcheck-libcpp +installcheck-host: maybe-installcheck-libdecnumber +installcheck-host: maybe-installcheck-libgui +installcheck-host: maybe-installcheck-libiberty +installcheck-host: maybe-installcheck-libtool +installcheck-host: maybe-installcheck-m4 +installcheck-host: maybe-installcheck-make +installcheck-host: maybe-installcheck-mmalloc +installcheck-host: maybe-installcheck-patch +installcheck-host: maybe-installcheck-perl +installcheck-host: maybe-installcheck-prms +installcheck-host: maybe-installcheck-rcs +installcheck-host: maybe-installcheck-readline +installcheck-host: maybe-installcheck-release +installcheck-host: maybe-installcheck-recode +installcheck-host: maybe-installcheck-sed +installcheck-host: maybe-installcheck-send-pr +installcheck-host: maybe-installcheck-shellutils +installcheck-host: maybe-installcheck-sid +installcheck-host: maybe-installcheck-sim +installcheck-host: maybe-installcheck-tar +installcheck-host: maybe-installcheck-texinfo +installcheck-host: maybe-installcheck-textutils +installcheck-host: maybe-installcheck-time +installcheck-host: maybe-installcheck-uudecode +installcheck-host: maybe-installcheck-wdiff +installcheck-host: maybe-installcheck-zip +installcheck-host: maybe-installcheck-zlib +installcheck-host: maybe-installcheck-gdb +installcheck-host: maybe-installcheck-expect +installcheck-host: maybe-installcheck-guile +installcheck-host: maybe-installcheck-tk +installcheck-host: maybe-installcheck-libtermcap +installcheck-host: maybe-installcheck-utils +installcheck-host: maybe-installcheck-gnattools .PHONY: installcheck-target -installcheck-target: \ - maybe-installcheck-target-libstdc++-v3 \ - maybe-installcheck-target-newlib \ - maybe-installcheck-target-libf2c \ - maybe-installcheck-target-libobjc \ - maybe-installcheck-target-libtermcap \ - maybe-installcheck-target-winsup \ - maybe-installcheck-target-libgloss \ - maybe-installcheck-target-libiberty \ - maybe-installcheck-target-gperf \ - maybe-installcheck-target-examples \ - maybe-installcheck-target-libffi \ - maybe-installcheck-target-libjava \ - maybe-installcheck-target-zlib \ - maybe-installcheck-target-boehm-gc \ - maybe-installcheck-target-qthreads \ - maybe-installcheck-target-rda \ - maybe-installcheck-target-libada - -# GCC, the eternal special case -.PHONY: maybe-installcheck-gcc installcheck-gcc -maybe-installcheck-gcc: -installcheck-gcc: \ - configure-gcc - @[ -f ./gcc/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_GCC_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in gcc" ; \ - (cd gcc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - -# Host modules. - -.PHONY: maybe-installcheck-ash installcheck-ash -maybe-installcheck-ash: - -installcheck-ash: \ - configure-ash - @[ -f ./ash/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in ash" ; \ - (cd ash && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-autoconf installcheck-autoconf -maybe-installcheck-autoconf: - -installcheck-autoconf: \ - configure-autoconf - @[ -f ./autoconf/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in autoconf" ; \ - (cd autoconf && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-automake installcheck-automake -maybe-installcheck-automake: - -installcheck-automake: \ - configure-automake - @[ -f ./automake/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in automake" ; \ - (cd automake && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-bash installcheck-bash -maybe-installcheck-bash: - -installcheck-bash: \ - configure-bash - @[ -f ./bash/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in bash" ; \ - (cd bash && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-bfd installcheck-bfd -maybe-installcheck-bfd: - -installcheck-bfd: \ - configure-bfd - @[ -f ./bfd/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in bfd" ; \ - (cd bfd && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-opcodes installcheck-opcodes -maybe-installcheck-opcodes: - -installcheck-opcodes: \ - configure-opcodes - @[ -f ./opcodes/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in opcodes" ; \ - (cd opcodes && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-binutils installcheck-binutils -maybe-installcheck-binutils: - -installcheck-binutils: \ - configure-binutils - @[ -f ./binutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in binutils" ; \ - (cd binutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-bison installcheck-bison -maybe-installcheck-bison: - -installcheck-bison: \ - configure-bison - @[ -f ./bison/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in bison" ; \ - (cd bison && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-byacc installcheck-byacc -maybe-installcheck-byacc: - -installcheck-byacc: \ - configure-byacc - @[ -f ./byacc/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in byacc" ; \ - (cd byacc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-bzip2 installcheck-bzip2 -maybe-installcheck-bzip2: - -installcheck-bzip2: \ - configure-bzip2 - @[ -f ./bzip2/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in bzip2" ; \ - (cd bzip2 && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-dejagnu installcheck-dejagnu -maybe-installcheck-dejagnu: - -installcheck-dejagnu: \ - configure-dejagnu - @[ -f ./dejagnu/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in dejagnu" ; \ - (cd dejagnu && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-diff installcheck-diff -maybe-installcheck-diff: - -installcheck-diff: \ - configure-diff - @[ -f ./diff/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in diff" ; \ - (cd diff && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-dosutils installcheck-dosutils -maybe-installcheck-dosutils: - -installcheck-dosutils: \ - configure-dosutils - @[ -f ./dosutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in dosutils" ; \ - (cd dosutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-etc installcheck-etc -maybe-installcheck-etc: - -installcheck-etc: \ - configure-etc - @[ -f ./etc/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in etc" ; \ - (cd etc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-fastjar installcheck-fastjar -maybe-installcheck-fastjar: - -installcheck-fastjar: \ - configure-fastjar - @[ -f ./fastjar/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in fastjar" ; \ - (cd fastjar && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-fileutils installcheck-fileutils -maybe-installcheck-fileutils: - -installcheck-fileutils: \ - configure-fileutils - @[ -f ./fileutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in fileutils" ; \ - (cd fileutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-findutils installcheck-findutils -maybe-installcheck-findutils: - -installcheck-findutils: \ - configure-findutils - @[ -f ./findutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in findutils" ; \ - (cd findutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-find installcheck-find -maybe-installcheck-find: - -installcheck-find: \ - configure-find - @[ -f ./find/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in find" ; \ - (cd find && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-flex installcheck-flex -maybe-installcheck-flex: - -installcheck-flex: \ - configure-flex - @[ -f ./flex/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in flex" ; \ - (cd flex && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-gas installcheck-gas -maybe-installcheck-gas: - -installcheck-gas: \ - configure-gas - @[ -f ./gas/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in gas" ; \ - (cd gas && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-gawk installcheck-gawk -maybe-installcheck-gawk: - -installcheck-gawk: \ - configure-gawk - @[ -f ./gawk/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in gawk" ; \ - (cd gawk && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-gettext installcheck-gettext -maybe-installcheck-gettext: - -installcheck-gettext: \ - configure-gettext - @[ -f ./gettext/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in gettext" ; \ - (cd gettext && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-gnuserv installcheck-gnuserv -maybe-installcheck-gnuserv: - -installcheck-gnuserv: \ - configure-gnuserv - @[ -f ./gnuserv/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in gnuserv" ; \ - (cd gnuserv && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-gprof installcheck-gprof -maybe-installcheck-gprof: - -installcheck-gprof: \ - configure-gprof - @[ -f ./gprof/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in gprof" ; \ - (cd gprof && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-gzip installcheck-gzip -maybe-installcheck-gzip: - -installcheck-gzip: \ - configure-gzip - @[ -f ./gzip/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in gzip" ; \ - (cd gzip && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-hello installcheck-hello -maybe-installcheck-hello: - -installcheck-hello: \ - configure-hello - @[ -f ./hello/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in hello" ; \ - (cd hello && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-indent installcheck-indent -maybe-installcheck-indent: - -installcheck-indent: \ - configure-indent - @[ -f ./indent/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in indent" ; \ - (cd indent && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-intl installcheck-intl -maybe-installcheck-intl: - -installcheck-intl: \ - configure-intl - @[ -f ./intl/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in intl" ; \ - (cd intl && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-tcl installcheck-tcl -maybe-installcheck-tcl: - -installcheck-tcl: \ - configure-tcl - @[ -f ./tcl/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in tcl" ; \ - (cd tcl && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-itcl installcheck-itcl -maybe-installcheck-itcl: - -installcheck-itcl: \ - configure-itcl - @[ -f ./itcl/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in itcl" ; \ - (cd itcl && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-ld installcheck-ld -maybe-installcheck-ld: - -installcheck-ld: \ - configure-ld - @[ -f ./ld/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in ld" ; \ - (cd ld && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-libgui installcheck-libgui -maybe-installcheck-libgui: - -installcheck-libgui: \ - configure-libgui - @[ -f ./libgui/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in libgui" ; \ - (cd libgui && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-libiberty installcheck-libiberty -maybe-installcheck-libiberty: - -installcheck-libiberty: \ - configure-libiberty - @[ -f ./libiberty/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in libiberty" ; \ - (cd libiberty && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-libtool installcheck-libtool -maybe-installcheck-libtool: - -installcheck-libtool: \ - configure-libtool - @[ -f ./libtool/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in libtool" ; \ - (cd libtool && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-m4 installcheck-m4 -maybe-installcheck-m4: - -installcheck-m4: \ - configure-m4 - @[ -f ./m4/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in m4" ; \ - (cd m4 && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-make installcheck-make -maybe-installcheck-make: - -installcheck-make: \ - configure-make - @[ -f ./make/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in make" ; \ - (cd make && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-mmalloc installcheck-mmalloc -maybe-installcheck-mmalloc: - -installcheck-mmalloc: \ - configure-mmalloc - @[ -f ./mmalloc/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in mmalloc" ; \ - (cd mmalloc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-patch installcheck-patch -maybe-installcheck-patch: - -installcheck-patch: \ - configure-patch - @[ -f ./patch/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in patch" ; \ - (cd patch && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-perl installcheck-perl -maybe-installcheck-perl: - -installcheck-perl: \ - configure-perl - @[ -f ./perl/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in perl" ; \ - (cd perl && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-prms installcheck-prms -maybe-installcheck-prms: - -installcheck-prms: \ - configure-prms - @[ -f ./prms/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in prms" ; \ - (cd prms && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-rcs installcheck-rcs -maybe-installcheck-rcs: - -installcheck-rcs: \ - configure-rcs - @[ -f ./rcs/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in rcs" ; \ - (cd rcs && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-readline installcheck-readline -maybe-installcheck-readline: - -installcheck-readline: \ - configure-readline - @[ -f ./readline/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in readline" ; \ - (cd readline && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-release installcheck-release -maybe-installcheck-release: - -installcheck-release: \ - configure-release - @[ -f ./release/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in release" ; \ - (cd release && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-recode installcheck-recode -maybe-installcheck-recode: - -installcheck-recode: \ - configure-recode - @[ -f ./recode/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in recode" ; \ - (cd recode && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-sed installcheck-sed -maybe-installcheck-sed: - -installcheck-sed: \ - configure-sed - @[ -f ./sed/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in sed" ; \ - (cd sed && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-send-pr installcheck-send-pr -maybe-installcheck-send-pr: - -installcheck-send-pr: \ - configure-send-pr - @[ -f ./send-pr/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in send-pr" ; \ - (cd send-pr && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-shellutils installcheck-shellutils -maybe-installcheck-shellutils: - -installcheck-shellutils: \ - configure-shellutils - @[ -f ./shellutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in shellutils" ; \ - (cd shellutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-sid installcheck-sid -maybe-installcheck-sid: - -installcheck-sid: \ - configure-sid - @[ -f ./sid/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in sid" ; \ - (cd sid && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-sim installcheck-sim -maybe-installcheck-sim: - -installcheck-sim: \ - configure-sim - @[ -f ./sim/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in sim" ; \ - (cd sim && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-tar installcheck-tar -maybe-installcheck-tar: - -installcheck-tar: \ - configure-tar - @[ -f ./tar/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in tar" ; \ - (cd tar && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-texinfo installcheck-texinfo -maybe-installcheck-texinfo: - -installcheck-texinfo: \ - configure-texinfo - @[ -f ./texinfo/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in texinfo" ; \ - (cd texinfo && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-textutils installcheck-textutils -maybe-installcheck-textutils: - -installcheck-textutils: \ - configure-textutils - @[ -f ./textutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in textutils" ; \ - (cd textutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-time installcheck-time -maybe-installcheck-time: - -installcheck-time: \ - configure-time - @[ -f ./time/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in time" ; \ - (cd time && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-uudecode installcheck-uudecode -maybe-installcheck-uudecode: - -installcheck-uudecode: \ - configure-uudecode - @[ -f ./uudecode/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in uudecode" ; \ - (cd uudecode && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-wdiff installcheck-wdiff -maybe-installcheck-wdiff: - -installcheck-wdiff: \ - configure-wdiff - @[ -f ./wdiff/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in wdiff" ; \ - (cd wdiff && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-zip installcheck-zip -maybe-installcheck-zip: - -installcheck-zip: \ - configure-zip - @[ -f ./zip/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in zip" ; \ - (cd zip && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-zlib installcheck-zlib -maybe-installcheck-zlib: - -installcheck-zlib: \ - configure-zlib - @[ -f ./zlib/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in zlib" ; \ - (cd zlib && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-gdb installcheck-gdb -maybe-installcheck-gdb: - -installcheck-gdb: \ - configure-gdb - @[ -f ./gdb/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in gdb" ; \ - (cd gdb && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-expect installcheck-expect -maybe-installcheck-expect: - -installcheck-expect: \ - configure-expect - @[ -f ./expect/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in expect" ; \ - (cd expect && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-guile installcheck-guile -maybe-installcheck-guile: - -installcheck-guile: \ - configure-guile - @[ -f ./guile/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in guile" ; \ - (cd guile && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-tk installcheck-tk -maybe-installcheck-tk: - -installcheck-tk: \ - configure-tk - @[ -f ./tk/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in tk" ; \ - (cd tk && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-tix installcheck-tix -maybe-installcheck-tix: - -installcheck-tix: \ - configure-tix - @[ -f ./tix/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in tix" ; \ - (cd tix && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-libtermcap installcheck-libtermcap -maybe-installcheck-libtermcap: - -installcheck-libtermcap: \ - configure-libtermcap - @[ -f ./libtermcap/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in libtermcap" ; \ - (cd libtermcap && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-utils installcheck-utils -maybe-installcheck-utils: - -installcheck-utils: \ - configure-utils - @[ -f ./utils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing installcheck in utils" ; \ - (cd utils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - - -# Target modules. - -.PHONY: maybe-installcheck-target-libstdc++-v3 installcheck-target-libstdc++-v3 -maybe-installcheck-target-libstdc++-v3: - -installcheck-target-libstdc++-v3: \ - configure-target-libstdc++-v3 - @[ -f $(TARGET_SUBDIR)/libstdc++-v3/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing installcheck in $(TARGET_SUBDIR)/libstdc++-v3" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libstdc++-v3 && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-target-newlib installcheck-target-newlib -maybe-installcheck-target-newlib: - -installcheck-target-newlib: \ - configure-target-newlib - @[ -f $(TARGET_SUBDIR)/newlib/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing installcheck in $(TARGET_SUBDIR)/newlib" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/newlib && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-target-libf2c installcheck-target-libf2c -maybe-installcheck-target-libf2c: - -installcheck-target-libf2c: \ - configure-target-libf2c - @[ -f $(TARGET_SUBDIR)/libf2c/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing installcheck in $(TARGET_SUBDIR)/libf2c" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libf2c && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-target-libobjc installcheck-target-libobjc -maybe-installcheck-target-libobjc: - -installcheck-target-libobjc: \ - configure-target-libobjc - @[ -f $(TARGET_SUBDIR)/libobjc/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing installcheck in $(TARGET_SUBDIR)/libobjc" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libobjc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-target-libtermcap installcheck-target-libtermcap -maybe-installcheck-target-libtermcap: - -installcheck-target-libtermcap: \ - configure-target-libtermcap - @[ -f $(TARGET_SUBDIR)/libtermcap/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing installcheck in $(TARGET_SUBDIR)/libtermcap" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libtermcap && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-target-winsup installcheck-target-winsup -maybe-installcheck-target-winsup: - -installcheck-target-winsup: \ - configure-target-winsup - @[ -f $(TARGET_SUBDIR)/winsup/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing installcheck in $(TARGET_SUBDIR)/winsup" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/winsup && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-target-libgloss installcheck-target-libgloss -maybe-installcheck-target-libgloss: - -installcheck-target-libgloss: \ - configure-target-libgloss - @[ -f $(TARGET_SUBDIR)/libgloss/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing installcheck in $(TARGET_SUBDIR)/libgloss" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libgloss && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-target-libiberty installcheck-target-libiberty -maybe-installcheck-target-libiberty: - -installcheck-target-libiberty: \ - configure-target-libiberty - @[ -f $(TARGET_SUBDIR)/libiberty/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing installcheck in $(TARGET_SUBDIR)/libiberty" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libiberty && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-target-gperf installcheck-target-gperf -maybe-installcheck-target-gperf: - -installcheck-target-gperf: \ - configure-target-gperf - @[ -f $(TARGET_SUBDIR)/gperf/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing installcheck in $(TARGET_SUBDIR)/gperf" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/gperf && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-target-examples installcheck-target-examples -maybe-installcheck-target-examples: - -installcheck-target-examples: \ - configure-target-examples - @[ -f $(TARGET_SUBDIR)/examples/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing installcheck in $(TARGET_SUBDIR)/examples" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/examples && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-target-libffi installcheck-target-libffi -maybe-installcheck-target-libffi: - -installcheck-target-libffi: \ - configure-target-libffi - @[ -f $(TARGET_SUBDIR)/libffi/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing installcheck in $(TARGET_SUBDIR)/libffi" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libffi && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-target-libjava installcheck-target-libjava -maybe-installcheck-target-libjava: - -installcheck-target-libjava: \ - configure-target-libjava - @[ -f $(TARGET_SUBDIR)/libjava/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing installcheck in $(TARGET_SUBDIR)/libjava" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libjava && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-target-zlib installcheck-target-zlib -maybe-installcheck-target-zlib: - -installcheck-target-zlib: \ - configure-target-zlib - @[ -f $(TARGET_SUBDIR)/zlib/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing installcheck in $(TARGET_SUBDIR)/zlib" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/zlib && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-target-boehm-gc installcheck-target-boehm-gc -maybe-installcheck-target-boehm-gc: - -installcheck-target-boehm-gc: \ - configure-target-boehm-gc - @[ -f $(TARGET_SUBDIR)/boehm-gc/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing installcheck in $(TARGET_SUBDIR)/boehm-gc" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/boehm-gc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-target-qthreads installcheck-target-qthreads -maybe-installcheck-target-qthreads: - -installcheck-target-qthreads: \ - configure-target-qthreads - @[ -f $(TARGET_SUBDIR)/qthreads/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing installcheck in $(TARGET_SUBDIR)/qthreads" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/qthreads && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-target-rda installcheck-target-rda -maybe-installcheck-target-rda: - -installcheck-target-rda: \ - configure-target-rda - @[ -f $(TARGET_SUBDIR)/rda/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing installcheck in $(TARGET_SUBDIR)/rda" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/rda && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - - -.PHONY: maybe-installcheck-target-libada installcheck-target-libada -maybe-installcheck-target-libada: - -installcheck-target-libada: \ - configure-target-libada - @[ -f $(TARGET_SUBDIR)/libada/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing installcheck in $(TARGET_SUBDIR)/libada" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libada && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - installcheck) \ - || exit 1 - +installcheck-target: maybe-installcheck-target-libstdc++-v3 +installcheck-target: maybe-installcheck-target-libmudflap +installcheck-target: maybe-installcheck-target-libssp +installcheck-target: maybe-installcheck-target-libgcc-math +installcheck-target: maybe-installcheck-target-newlib +installcheck-target: maybe-installcheck-target-libgfortran +installcheck-target: maybe-installcheck-target-libobjc +installcheck-target: maybe-installcheck-target-libtermcap +installcheck-target: maybe-installcheck-target-winsup +installcheck-target: maybe-installcheck-target-libgloss +installcheck-target: maybe-installcheck-target-libiberty +installcheck-target: maybe-installcheck-target-gperf +installcheck-target: maybe-installcheck-target-examples +installcheck-target: maybe-installcheck-target-libffi +installcheck-target: maybe-installcheck-target-libjava +installcheck-target: maybe-installcheck-target-zlib +installcheck-target: maybe-installcheck-target-boehm-gc +installcheck-target: maybe-installcheck-target-qthreads +installcheck-target: maybe-installcheck-target-rda +installcheck-target: maybe-installcheck-target-libada +installcheck-target: maybe-installcheck-target-libgomp .PHONY: do-mostlyclean -do-mostlyclean: mostlyclean-host mostlyclean-target +do-mostlyclean: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(MAKE) $(RECURSE_FLAGS_TO_PASS) mostlyclean-host \ + mostlyclean-target + .PHONY: mostlyclean-host -mostlyclean-host: maybe-mostlyclean-gcc \ - maybe-mostlyclean-ash \ - maybe-mostlyclean-autoconf \ - maybe-mostlyclean-automake \ - maybe-mostlyclean-bash \ - maybe-mostlyclean-bfd \ - maybe-mostlyclean-opcodes \ - maybe-mostlyclean-binutils \ - maybe-mostlyclean-bison \ - maybe-mostlyclean-byacc \ - maybe-mostlyclean-bzip2 \ - maybe-mostlyclean-dejagnu \ - maybe-mostlyclean-diff \ - maybe-mostlyclean-dosutils \ - maybe-mostlyclean-etc \ - maybe-mostlyclean-fastjar \ - maybe-mostlyclean-fileutils \ - maybe-mostlyclean-findutils \ - maybe-mostlyclean-find \ - maybe-mostlyclean-flex \ - maybe-mostlyclean-gas \ - maybe-mostlyclean-gawk \ - maybe-mostlyclean-gettext \ - maybe-mostlyclean-gnuserv \ - maybe-mostlyclean-gprof \ - maybe-mostlyclean-gzip \ - maybe-mostlyclean-hello \ - maybe-mostlyclean-indent \ - maybe-mostlyclean-intl \ - maybe-mostlyclean-tcl \ - maybe-mostlyclean-itcl \ - maybe-mostlyclean-ld \ - maybe-mostlyclean-libgui \ - maybe-mostlyclean-libiberty \ - maybe-mostlyclean-libtool \ - maybe-mostlyclean-m4 \ - maybe-mostlyclean-make \ - maybe-mostlyclean-mmalloc \ - maybe-mostlyclean-patch \ - maybe-mostlyclean-perl \ - maybe-mostlyclean-prms \ - maybe-mostlyclean-rcs \ - maybe-mostlyclean-readline \ - maybe-mostlyclean-release \ - maybe-mostlyclean-recode \ - maybe-mostlyclean-sed \ - maybe-mostlyclean-send-pr \ - maybe-mostlyclean-shellutils \ - maybe-mostlyclean-sid \ - maybe-mostlyclean-sim \ - maybe-mostlyclean-tar \ - maybe-mostlyclean-texinfo \ - maybe-mostlyclean-textutils \ - maybe-mostlyclean-time \ - maybe-mostlyclean-uudecode \ - maybe-mostlyclean-wdiff \ - maybe-mostlyclean-zip \ - maybe-mostlyclean-zlib \ - maybe-mostlyclean-gdb \ - maybe-mostlyclean-expect \ - maybe-mostlyclean-guile \ - maybe-mostlyclean-tk \ - maybe-mostlyclean-tix \ - maybe-mostlyclean-libtermcap \ - maybe-mostlyclean-utils + +mostlyclean-host: maybe-mostlyclean-ash +mostlyclean-host: maybe-mostlyclean-autoconf +mostlyclean-host: maybe-mostlyclean-automake +mostlyclean-host: maybe-mostlyclean-bash +mostlyclean-host: maybe-mostlyclean-bfd +mostlyclean-host: maybe-mostlyclean-opcodes +mostlyclean-host: maybe-mostlyclean-binutils +mostlyclean-host: maybe-mostlyclean-bison +mostlyclean-host: maybe-mostlyclean-byacc +mostlyclean-host: maybe-mostlyclean-bzip2 +mostlyclean-host: maybe-mostlyclean-dejagnu +mostlyclean-host: maybe-mostlyclean-diff +mostlyclean-host: maybe-mostlyclean-dosutils +mostlyclean-host: maybe-mostlyclean-etc +mostlyclean-host: maybe-mostlyclean-fastjar +mostlyclean-host: maybe-mostlyclean-fileutils +mostlyclean-host: maybe-mostlyclean-findutils +mostlyclean-host: maybe-mostlyclean-find +mostlyclean-host: maybe-mostlyclean-fixincludes +mostlyclean-host: maybe-mostlyclean-flex +mostlyclean-host: maybe-mostlyclean-gas +mostlyclean-host: maybe-mostlyclean-gcc +mostlyclean-host: maybe-mostlyclean-gawk +mostlyclean-host: maybe-mostlyclean-gettext +mostlyclean-host: maybe-mostlyclean-gnuserv +mostlyclean-host: maybe-mostlyclean-gprof +mostlyclean-host: maybe-mostlyclean-gzip +mostlyclean-host: maybe-mostlyclean-hello +mostlyclean-host: maybe-mostlyclean-indent +mostlyclean-host: maybe-mostlyclean-intl +mostlyclean-host: maybe-mostlyclean-tcl +mostlyclean-host: maybe-mostlyclean-itcl +mostlyclean-host: maybe-mostlyclean-ld +mostlyclean-host: maybe-mostlyclean-libcpp +mostlyclean-host: maybe-mostlyclean-libdecnumber +mostlyclean-host: maybe-mostlyclean-libgui +mostlyclean-host: maybe-mostlyclean-libiberty +mostlyclean-host: maybe-mostlyclean-libtool +mostlyclean-host: maybe-mostlyclean-m4 +mostlyclean-host: maybe-mostlyclean-make +mostlyclean-host: maybe-mostlyclean-mmalloc +mostlyclean-host: maybe-mostlyclean-patch +mostlyclean-host: maybe-mostlyclean-perl +mostlyclean-host: maybe-mostlyclean-prms +mostlyclean-host: maybe-mostlyclean-rcs +mostlyclean-host: maybe-mostlyclean-readline +mostlyclean-host: maybe-mostlyclean-release +mostlyclean-host: maybe-mostlyclean-recode +mostlyclean-host: maybe-mostlyclean-sed +mostlyclean-host: maybe-mostlyclean-send-pr +mostlyclean-host: maybe-mostlyclean-shellutils +mostlyclean-host: maybe-mostlyclean-sid +mostlyclean-host: maybe-mostlyclean-sim +mostlyclean-host: maybe-mostlyclean-tar +mostlyclean-host: maybe-mostlyclean-texinfo +mostlyclean-host: maybe-mostlyclean-textutils +mostlyclean-host: maybe-mostlyclean-time +mostlyclean-host: maybe-mostlyclean-uudecode +mostlyclean-host: maybe-mostlyclean-wdiff +mostlyclean-host: maybe-mostlyclean-zip +mostlyclean-host: maybe-mostlyclean-zlib +mostlyclean-host: maybe-mostlyclean-gdb +mostlyclean-host: maybe-mostlyclean-expect +mostlyclean-host: maybe-mostlyclean-guile +mostlyclean-host: maybe-mostlyclean-tk +mostlyclean-host: maybe-mostlyclean-libtermcap +mostlyclean-host: maybe-mostlyclean-utils +mostlyclean-host: maybe-mostlyclean-gnattools .PHONY: mostlyclean-target -mostlyclean-target: \ - maybe-mostlyclean-target-libstdc++-v3 \ - maybe-mostlyclean-target-newlib \ - maybe-mostlyclean-target-libf2c \ - maybe-mostlyclean-target-libobjc \ - maybe-mostlyclean-target-libtermcap \ - maybe-mostlyclean-target-winsup \ - maybe-mostlyclean-target-libgloss \ - maybe-mostlyclean-target-libiberty \ - maybe-mostlyclean-target-gperf \ - maybe-mostlyclean-target-examples \ - maybe-mostlyclean-target-libffi \ - maybe-mostlyclean-target-libjava \ - maybe-mostlyclean-target-zlib \ - maybe-mostlyclean-target-boehm-gc \ - maybe-mostlyclean-target-qthreads \ - maybe-mostlyclean-target-rda \ - maybe-mostlyclean-target-libada - -# GCC, the eternal special case -.PHONY: maybe-mostlyclean-gcc mostlyclean-gcc -maybe-mostlyclean-gcc: -mostlyclean-gcc: - @[ -f ./gcc/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_GCC_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in gcc" ; \ - (cd gcc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - -# Host modules. - -.PHONY: maybe-mostlyclean-ash mostlyclean-ash -maybe-mostlyclean-ash: - -mostlyclean-ash: - @[ -f ./ash/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in ash" ; \ - (cd ash && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-autoconf mostlyclean-autoconf -maybe-mostlyclean-autoconf: - -mostlyclean-autoconf: - @[ -f ./autoconf/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in autoconf" ; \ - (cd autoconf && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-automake mostlyclean-automake -maybe-mostlyclean-automake: - -mostlyclean-automake: - @[ -f ./automake/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in automake" ; \ - (cd automake && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-bash mostlyclean-bash -maybe-mostlyclean-bash: - -mostlyclean-bash: - @[ -f ./bash/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in bash" ; \ - (cd bash && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-bfd mostlyclean-bfd -maybe-mostlyclean-bfd: - -mostlyclean-bfd: - @[ -f ./bfd/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in bfd" ; \ - (cd bfd && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-opcodes mostlyclean-opcodes -maybe-mostlyclean-opcodes: - -mostlyclean-opcodes: - @[ -f ./opcodes/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in opcodes" ; \ - (cd opcodes && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-binutils mostlyclean-binutils -maybe-mostlyclean-binutils: - -mostlyclean-binutils: - @[ -f ./binutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in binutils" ; \ - (cd binutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-bison mostlyclean-bison -maybe-mostlyclean-bison: - -mostlyclean-bison: - @[ -f ./bison/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in bison" ; \ - (cd bison && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-byacc mostlyclean-byacc -maybe-mostlyclean-byacc: - -mostlyclean-byacc: - @[ -f ./byacc/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in byacc" ; \ - (cd byacc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-bzip2 mostlyclean-bzip2 -maybe-mostlyclean-bzip2: - -mostlyclean-bzip2: - @[ -f ./bzip2/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in bzip2" ; \ - (cd bzip2 && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-dejagnu mostlyclean-dejagnu -maybe-mostlyclean-dejagnu: - -mostlyclean-dejagnu: - @[ -f ./dejagnu/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in dejagnu" ; \ - (cd dejagnu && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-diff mostlyclean-diff -maybe-mostlyclean-diff: - -mostlyclean-diff: - @[ -f ./diff/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in diff" ; \ - (cd diff && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-dosutils mostlyclean-dosutils -maybe-mostlyclean-dosutils: - -mostlyclean-dosutils: - @[ -f ./dosutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in dosutils" ; \ - (cd dosutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-etc mostlyclean-etc -maybe-mostlyclean-etc: - -mostlyclean-etc: - @[ -f ./etc/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in etc" ; \ - (cd etc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-fastjar mostlyclean-fastjar -maybe-mostlyclean-fastjar: - -mostlyclean-fastjar: - @[ -f ./fastjar/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in fastjar" ; \ - (cd fastjar && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-fileutils mostlyclean-fileutils -maybe-mostlyclean-fileutils: - -mostlyclean-fileutils: - @[ -f ./fileutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in fileutils" ; \ - (cd fileutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-findutils mostlyclean-findutils -maybe-mostlyclean-findutils: - -mostlyclean-findutils: - @[ -f ./findutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in findutils" ; \ - (cd findutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-find mostlyclean-find -maybe-mostlyclean-find: - -mostlyclean-find: - @[ -f ./find/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in find" ; \ - (cd find && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-flex mostlyclean-flex -maybe-mostlyclean-flex: - -mostlyclean-flex: - @[ -f ./flex/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in flex" ; \ - (cd flex && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-gas mostlyclean-gas -maybe-mostlyclean-gas: - -mostlyclean-gas: - @[ -f ./gas/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in gas" ; \ - (cd gas && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-gawk mostlyclean-gawk -maybe-mostlyclean-gawk: - -mostlyclean-gawk: - @[ -f ./gawk/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in gawk" ; \ - (cd gawk && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-gettext mostlyclean-gettext -maybe-mostlyclean-gettext: - -mostlyclean-gettext: - @[ -f ./gettext/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in gettext" ; \ - (cd gettext && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-gnuserv mostlyclean-gnuserv -maybe-mostlyclean-gnuserv: - -mostlyclean-gnuserv: - @[ -f ./gnuserv/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in gnuserv" ; \ - (cd gnuserv && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-gprof mostlyclean-gprof -maybe-mostlyclean-gprof: - -mostlyclean-gprof: - @[ -f ./gprof/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in gprof" ; \ - (cd gprof && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-gzip mostlyclean-gzip -maybe-mostlyclean-gzip: - -mostlyclean-gzip: - @[ -f ./gzip/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in gzip" ; \ - (cd gzip && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-hello mostlyclean-hello -maybe-mostlyclean-hello: - -mostlyclean-hello: - @[ -f ./hello/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in hello" ; \ - (cd hello && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-indent mostlyclean-indent -maybe-mostlyclean-indent: - -mostlyclean-indent: - @[ -f ./indent/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in indent" ; \ - (cd indent && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-intl mostlyclean-intl -maybe-mostlyclean-intl: - -mostlyclean-intl: - @[ -f ./intl/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in intl" ; \ - (cd intl && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-tcl mostlyclean-tcl -maybe-mostlyclean-tcl: - -# tcl doesn't support mostlyclean. -mostlyclean-tcl: - - -.PHONY: maybe-mostlyclean-itcl mostlyclean-itcl -maybe-mostlyclean-itcl: - -mostlyclean-itcl: - @[ -f ./itcl/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in itcl" ; \ - (cd itcl && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-ld mostlyclean-ld -maybe-mostlyclean-ld: - -mostlyclean-ld: - @[ -f ./ld/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in ld" ; \ - (cd ld && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-libgui mostlyclean-libgui -maybe-mostlyclean-libgui: - -mostlyclean-libgui: - @[ -f ./libgui/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in libgui" ; \ - (cd libgui && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-libiberty mostlyclean-libiberty -maybe-mostlyclean-libiberty: - -mostlyclean-libiberty: - @[ -f ./libiberty/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in libiberty" ; \ - (cd libiberty && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-libtool mostlyclean-libtool -maybe-mostlyclean-libtool: - -mostlyclean-libtool: - @[ -f ./libtool/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in libtool" ; \ - (cd libtool && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-m4 mostlyclean-m4 -maybe-mostlyclean-m4: - -mostlyclean-m4: - @[ -f ./m4/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in m4" ; \ - (cd m4 && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-make mostlyclean-make -maybe-mostlyclean-make: - -mostlyclean-make: - @[ -f ./make/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in make" ; \ - (cd make && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-mmalloc mostlyclean-mmalloc -maybe-mostlyclean-mmalloc: - -mostlyclean-mmalloc: - @[ -f ./mmalloc/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in mmalloc" ; \ - (cd mmalloc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-patch mostlyclean-patch -maybe-mostlyclean-patch: - -mostlyclean-patch: - @[ -f ./patch/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in patch" ; \ - (cd patch && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-perl mostlyclean-perl -maybe-mostlyclean-perl: - -mostlyclean-perl: - @[ -f ./perl/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in perl" ; \ - (cd perl && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-prms mostlyclean-prms -maybe-mostlyclean-prms: - -mostlyclean-prms: - @[ -f ./prms/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in prms" ; \ - (cd prms && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-rcs mostlyclean-rcs -maybe-mostlyclean-rcs: - -mostlyclean-rcs: - @[ -f ./rcs/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in rcs" ; \ - (cd rcs && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-readline mostlyclean-readline -maybe-mostlyclean-readline: - -mostlyclean-readline: - @[ -f ./readline/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in readline" ; \ - (cd readline && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-release mostlyclean-release -maybe-mostlyclean-release: - -mostlyclean-release: - @[ -f ./release/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in release" ; \ - (cd release && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-recode mostlyclean-recode -maybe-mostlyclean-recode: - -mostlyclean-recode: - @[ -f ./recode/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in recode" ; \ - (cd recode && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-sed mostlyclean-sed -maybe-mostlyclean-sed: - -mostlyclean-sed: - @[ -f ./sed/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in sed" ; \ - (cd sed && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-send-pr mostlyclean-send-pr -maybe-mostlyclean-send-pr: - -mostlyclean-send-pr: - @[ -f ./send-pr/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in send-pr" ; \ - (cd send-pr && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-shellutils mostlyclean-shellutils -maybe-mostlyclean-shellutils: - -mostlyclean-shellutils: - @[ -f ./shellutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in shellutils" ; \ - (cd shellutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-sid mostlyclean-sid -maybe-mostlyclean-sid: - -mostlyclean-sid: - @[ -f ./sid/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in sid" ; \ - (cd sid && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-sim mostlyclean-sim -maybe-mostlyclean-sim: - -mostlyclean-sim: - @[ -f ./sim/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in sim" ; \ - (cd sim && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-tar mostlyclean-tar -maybe-mostlyclean-tar: - -mostlyclean-tar: - @[ -f ./tar/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in tar" ; \ - (cd tar && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-texinfo mostlyclean-texinfo -maybe-mostlyclean-texinfo: - -mostlyclean-texinfo: - @[ -f ./texinfo/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in texinfo" ; \ - (cd texinfo && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-textutils mostlyclean-textutils -maybe-mostlyclean-textutils: - -mostlyclean-textutils: - @[ -f ./textutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in textutils" ; \ - (cd textutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-time mostlyclean-time -maybe-mostlyclean-time: - -mostlyclean-time: - @[ -f ./time/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in time" ; \ - (cd time && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-uudecode mostlyclean-uudecode -maybe-mostlyclean-uudecode: - -mostlyclean-uudecode: - @[ -f ./uudecode/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in uudecode" ; \ - (cd uudecode && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-wdiff mostlyclean-wdiff -maybe-mostlyclean-wdiff: - -mostlyclean-wdiff: - @[ -f ./wdiff/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in wdiff" ; \ - (cd wdiff && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-zip mostlyclean-zip -maybe-mostlyclean-zip: - -mostlyclean-zip: - @[ -f ./zip/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in zip" ; \ - (cd zip && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-zlib mostlyclean-zlib -maybe-mostlyclean-zlib: - -mostlyclean-zlib: - @[ -f ./zlib/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in zlib" ; \ - (cd zlib && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-gdb mostlyclean-gdb -maybe-mostlyclean-gdb: - -mostlyclean-gdb: - @[ -f ./gdb/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in gdb" ; \ - (cd gdb && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-expect mostlyclean-expect -maybe-mostlyclean-expect: - -mostlyclean-expect: - @[ -f ./expect/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in expect" ; \ - (cd expect && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-guile mostlyclean-guile -maybe-mostlyclean-guile: - -mostlyclean-guile: - @[ -f ./guile/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in guile" ; \ - (cd guile && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-tk mostlyclean-tk -maybe-mostlyclean-tk: - -mostlyclean-tk: - @[ -f ./tk/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in tk" ; \ - (cd tk && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-tix mostlyclean-tix -maybe-mostlyclean-tix: - -mostlyclean-tix: - @[ -f ./tix/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in tix" ; \ - (cd tix && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-libtermcap mostlyclean-libtermcap -maybe-mostlyclean-libtermcap: - -# libtermcap doesn't support mostlyclean. -mostlyclean-libtermcap: - - -.PHONY: maybe-mostlyclean-utils mostlyclean-utils -maybe-mostlyclean-utils: - -mostlyclean-utils: - @[ -f ./utils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing mostlyclean in utils" ; \ - (cd utils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - - -# Target modules. - -.PHONY: maybe-mostlyclean-target-libstdc++-v3 mostlyclean-target-libstdc++-v3 -maybe-mostlyclean-target-libstdc++-v3: - -mostlyclean-target-libstdc++-v3: - @[ -f $(TARGET_SUBDIR)/libstdc++-v3/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing mostlyclean in $(TARGET_SUBDIR)/libstdc++-v3" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libstdc++-v3 && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-target-newlib mostlyclean-target-newlib -maybe-mostlyclean-target-newlib: - -mostlyclean-target-newlib: - @[ -f $(TARGET_SUBDIR)/newlib/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing mostlyclean in $(TARGET_SUBDIR)/newlib" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/newlib && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-target-libf2c mostlyclean-target-libf2c -maybe-mostlyclean-target-libf2c: - -mostlyclean-target-libf2c: - @[ -f $(TARGET_SUBDIR)/libf2c/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing mostlyclean in $(TARGET_SUBDIR)/libf2c" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libf2c && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-target-libobjc mostlyclean-target-libobjc -maybe-mostlyclean-target-libobjc: - -mostlyclean-target-libobjc: - @[ -f $(TARGET_SUBDIR)/libobjc/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing mostlyclean in $(TARGET_SUBDIR)/libobjc" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libobjc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-target-libtermcap mostlyclean-target-libtermcap -maybe-mostlyclean-target-libtermcap: - -# libtermcap doesn't support mostlyclean. -mostlyclean-target-libtermcap: - - -.PHONY: maybe-mostlyclean-target-winsup mostlyclean-target-winsup -maybe-mostlyclean-target-winsup: - -mostlyclean-target-winsup: - @[ -f $(TARGET_SUBDIR)/winsup/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing mostlyclean in $(TARGET_SUBDIR)/winsup" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/winsup && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-target-libgloss mostlyclean-target-libgloss -maybe-mostlyclean-target-libgloss: - -mostlyclean-target-libgloss: - @[ -f $(TARGET_SUBDIR)/libgloss/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing mostlyclean in $(TARGET_SUBDIR)/libgloss" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libgloss && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-target-libiberty mostlyclean-target-libiberty -maybe-mostlyclean-target-libiberty: - -mostlyclean-target-libiberty: - @[ -f $(TARGET_SUBDIR)/libiberty/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing mostlyclean in $(TARGET_SUBDIR)/libiberty" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libiberty && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-target-gperf mostlyclean-target-gperf -maybe-mostlyclean-target-gperf: - -mostlyclean-target-gperf: - @[ -f $(TARGET_SUBDIR)/gperf/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing mostlyclean in $(TARGET_SUBDIR)/gperf" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/gperf && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-target-examples mostlyclean-target-examples -maybe-mostlyclean-target-examples: - -mostlyclean-target-examples: - @[ -f $(TARGET_SUBDIR)/examples/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing mostlyclean in $(TARGET_SUBDIR)/examples" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/examples && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-target-libffi mostlyclean-target-libffi -maybe-mostlyclean-target-libffi: - -mostlyclean-target-libffi: - @[ -f $(TARGET_SUBDIR)/libffi/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing mostlyclean in $(TARGET_SUBDIR)/libffi" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libffi && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-target-libjava mostlyclean-target-libjava -maybe-mostlyclean-target-libjava: - -mostlyclean-target-libjava: - @[ -f $(TARGET_SUBDIR)/libjava/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing mostlyclean in $(TARGET_SUBDIR)/libjava" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libjava && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-target-zlib mostlyclean-target-zlib -maybe-mostlyclean-target-zlib: - -mostlyclean-target-zlib: - @[ -f $(TARGET_SUBDIR)/zlib/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing mostlyclean in $(TARGET_SUBDIR)/zlib" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/zlib && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-target-boehm-gc mostlyclean-target-boehm-gc -maybe-mostlyclean-target-boehm-gc: - -mostlyclean-target-boehm-gc: - @[ -f $(TARGET_SUBDIR)/boehm-gc/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing mostlyclean in $(TARGET_SUBDIR)/boehm-gc" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/boehm-gc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-target-qthreads mostlyclean-target-qthreads -maybe-mostlyclean-target-qthreads: - -mostlyclean-target-qthreads: - @[ -f $(TARGET_SUBDIR)/qthreads/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing mostlyclean in $(TARGET_SUBDIR)/qthreads" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/qthreads && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-target-rda mostlyclean-target-rda -maybe-mostlyclean-target-rda: - -mostlyclean-target-rda: - @[ -f $(TARGET_SUBDIR)/rda/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing mostlyclean in $(TARGET_SUBDIR)/rda" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/rda && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - - -.PHONY: maybe-mostlyclean-target-libada mostlyclean-target-libada -maybe-mostlyclean-target-libada: - -mostlyclean-target-libada: - @[ -f $(TARGET_SUBDIR)/libada/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing mostlyclean in $(TARGET_SUBDIR)/libada" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libada && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - mostlyclean) \ - || exit 1 - +mostlyclean-target: maybe-mostlyclean-target-libstdc++-v3 +mostlyclean-target: maybe-mostlyclean-target-libmudflap +mostlyclean-target: maybe-mostlyclean-target-libssp +mostlyclean-target: maybe-mostlyclean-target-libgcc-math +mostlyclean-target: maybe-mostlyclean-target-newlib +mostlyclean-target: maybe-mostlyclean-target-libgfortran +mostlyclean-target: maybe-mostlyclean-target-libobjc +mostlyclean-target: maybe-mostlyclean-target-libtermcap +mostlyclean-target: maybe-mostlyclean-target-winsup +mostlyclean-target: maybe-mostlyclean-target-libgloss +mostlyclean-target: maybe-mostlyclean-target-libiberty +mostlyclean-target: maybe-mostlyclean-target-gperf +mostlyclean-target: maybe-mostlyclean-target-examples +mostlyclean-target: maybe-mostlyclean-target-libffi +mostlyclean-target: maybe-mostlyclean-target-libjava +mostlyclean-target: maybe-mostlyclean-target-zlib +mostlyclean-target: maybe-mostlyclean-target-boehm-gc +mostlyclean-target: maybe-mostlyclean-target-qthreads +mostlyclean-target: maybe-mostlyclean-target-rda +mostlyclean-target: maybe-mostlyclean-target-libada +mostlyclean-target: maybe-mostlyclean-target-libgomp .PHONY: do-clean -do-clean: clean-host clean-target +do-clean: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(MAKE) $(RECURSE_FLAGS_TO_PASS) clean-host \ + clean-target + .PHONY: clean-host -clean-host: maybe-clean-gcc \ - maybe-clean-ash \ - maybe-clean-autoconf \ - maybe-clean-automake \ - maybe-clean-bash \ - maybe-clean-bfd \ - maybe-clean-opcodes \ - maybe-clean-binutils \ - maybe-clean-bison \ - maybe-clean-byacc \ - maybe-clean-bzip2 \ - maybe-clean-dejagnu \ - maybe-clean-diff \ - maybe-clean-dosutils \ - maybe-clean-etc \ - maybe-clean-fastjar \ - maybe-clean-fileutils \ - maybe-clean-findutils \ - maybe-clean-find \ - maybe-clean-flex \ - maybe-clean-gas \ - maybe-clean-gawk \ - maybe-clean-gettext \ - maybe-clean-gnuserv \ - maybe-clean-gprof \ - maybe-clean-gzip \ - maybe-clean-hello \ - maybe-clean-indent \ - maybe-clean-intl \ - maybe-clean-tcl \ - maybe-clean-itcl \ - maybe-clean-ld \ - maybe-clean-libgui \ - maybe-clean-libiberty \ - maybe-clean-libtool \ - maybe-clean-m4 \ - maybe-clean-make \ - maybe-clean-mmalloc \ - maybe-clean-patch \ - maybe-clean-perl \ - maybe-clean-prms \ - maybe-clean-rcs \ - maybe-clean-readline \ - maybe-clean-release \ - maybe-clean-recode \ - maybe-clean-sed \ - maybe-clean-send-pr \ - maybe-clean-shellutils \ - maybe-clean-sid \ - maybe-clean-sim \ - maybe-clean-tar \ - maybe-clean-texinfo \ - maybe-clean-textutils \ - maybe-clean-time \ - maybe-clean-uudecode \ - maybe-clean-wdiff \ - maybe-clean-zip \ - maybe-clean-zlib \ - maybe-clean-gdb \ - maybe-clean-expect \ - maybe-clean-guile \ - maybe-clean-tk \ - maybe-clean-tix \ - maybe-clean-libtermcap \ - maybe-clean-utils + +clean-host: maybe-clean-ash +clean-host: maybe-clean-autoconf +clean-host: maybe-clean-automake +clean-host: maybe-clean-bash +clean-host: maybe-clean-bfd +clean-host: maybe-clean-opcodes +clean-host: maybe-clean-binutils +clean-host: maybe-clean-bison +clean-host: maybe-clean-byacc +clean-host: maybe-clean-bzip2 +clean-host: maybe-clean-dejagnu +clean-host: maybe-clean-diff +clean-host: maybe-clean-dosutils +clean-host: maybe-clean-etc +clean-host: maybe-clean-fastjar +clean-host: maybe-clean-fileutils +clean-host: maybe-clean-findutils +clean-host: maybe-clean-find +clean-host: maybe-clean-fixincludes +clean-host: maybe-clean-flex +clean-host: maybe-clean-gas +clean-host: maybe-clean-gcc +clean-host: maybe-clean-gawk +clean-host: maybe-clean-gettext +clean-host: maybe-clean-gnuserv +clean-host: maybe-clean-gprof +clean-host: maybe-clean-gzip +clean-host: maybe-clean-hello +clean-host: maybe-clean-indent +clean-host: maybe-clean-intl +clean-host: maybe-clean-tcl +clean-host: maybe-clean-itcl +clean-host: maybe-clean-ld +clean-host: maybe-clean-libcpp +clean-host: maybe-clean-libdecnumber +clean-host: maybe-clean-libgui +clean-host: maybe-clean-libiberty +clean-host: maybe-clean-libtool +clean-host: maybe-clean-m4 +clean-host: maybe-clean-make +clean-host: maybe-clean-mmalloc +clean-host: maybe-clean-patch +clean-host: maybe-clean-perl +clean-host: maybe-clean-prms +clean-host: maybe-clean-rcs +clean-host: maybe-clean-readline +clean-host: maybe-clean-release +clean-host: maybe-clean-recode +clean-host: maybe-clean-sed +clean-host: maybe-clean-send-pr +clean-host: maybe-clean-shellutils +clean-host: maybe-clean-sid +clean-host: maybe-clean-sim +clean-host: maybe-clean-tar +clean-host: maybe-clean-texinfo +clean-host: maybe-clean-textutils +clean-host: maybe-clean-time +clean-host: maybe-clean-uudecode +clean-host: maybe-clean-wdiff +clean-host: maybe-clean-zip +clean-host: maybe-clean-zlib +clean-host: maybe-clean-gdb +clean-host: maybe-clean-expect +clean-host: maybe-clean-guile +clean-host: maybe-clean-tk +clean-host: maybe-clean-libtermcap +clean-host: maybe-clean-utils +clean-host: maybe-clean-gnattools .PHONY: clean-target -clean-target: \ - maybe-clean-target-libstdc++-v3 \ - maybe-clean-target-newlib \ - maybe-clean-target-libf2c \ - maybe-clean-target-libobjc \ - maybe-clean-target-libtermcap \ - maybe-clean-target-winsup \ - maybe-clean-target-libgloss \ - maybe-clean-target-libiberty \ - maybe-clean-target-gperf \ - maybe-clean-target-examples \ - maybe-clean-target-libffi \ - maybe-clean-target-libjava \ - maybe-clean-target-zlib \ - maybe-clean-target-boehm-gc \ - maybe-clean-target-qthreads \ - maybe-clean-target-rda \ - maybe-clean-target-libada - -# GCC, the eternal special case -.PHONY: maybe-clean-gcc clean-gcc -maybe-clean-gcc: -clean-gcc: - @[ -f ./gcc/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_GCC_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in gcc" ; \ - (cd gcc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - -# Host modules. - -.PHONY: maybe-clean-ash clean-ash -maybe-clean-ash: - -clean-ash: - @[ -f ./ash/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in ash" ; \ - (cd ash && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-autoconf clean-autoconf -maybe-clean-autoconf: - -clean-autoconf: - @[ -f ./autoconf/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in autoconf" ; \ - (cd autoconf && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-automake clean-automake -maybe-clean-automake: - -clean-automake: - @[ -f ./automake/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in automake" ; \ - (cd automake && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-bash clean-bash -maybe-clean-bash: - -clean-bash: - @[ -f ./bash/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in bash" ; \ - (cd bash && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-bfd clean-bfd -maybe-clean-bfd: - -clean-bfd: - @[ -f ./bfd/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in bfd" ; \ - (cd bfd && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-opcodes clean-opcodes -maybe-clean-opcodes: - -clean-opcodes: - @[ -f ./opcodes/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in opcodes" ; \ - (cd opcodes && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-binutils clean-binutils -maybe-clean-binutils: - -clean-binutils: - @[ -f ./binutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in binutils" ; \ - (cd binutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-bison clean-bison -maybe-clean-bison: - -clean-bison: - @[ -f ./bison/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in bison" ; \ - (cd bison && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-byacc clean-byacc -maybe-clean-byacc: - -clean-byacc: - @[ -f ./byacc/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in byacc" ; \ - (cd byacc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-bzip2 clean-bzip2 -maybe-clean-bzip2: - -clean-bzip2: - @[ -f ./bzip2/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in bzip2" ; \ - (cd bzip2 && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-dejagnu clean-dejagnu -maybe-clean-dejagnu: - -clean-dejagnu: - @[ -f ./dejagnu/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in dejagnu" ; \ - (cd dejagnu && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-diff clean-diff -maybe-clean-diff: - -clean-diff: - @[ -f ./diff/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in diff" ; \ - (cd diff && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-dosutils clean-dosutils -maybe-clean-dosutils: - -clean-dosutils: - @[ -f ./dosutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in dosutils" ; \ - (cd dosutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-etc clean-etc -maybe-clean-etc: - -clean-etc: - @[ -f ./etc/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in etc" ; \ - (cd etc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-fastjar clean-fastjar -maybe-clean-fastjar: - -clean-fastjar: - @[ -f ./fastjar/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in fastjar" ; \ - (cd fastjar && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-fileutils clean-fileutils -maybe-clean-fileutils: - -clean-fileutils: - @[ -f ./fileutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in fileutils" ; \ - (cd fileutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-findutils clean-findutils -maybe-clean-findutils: - -clean-findutils: - @[ -f ./findutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in findutils" ; \ - (cd findutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-find clean-find -maybe-clean-find: - -clean-find: - @[ -f ./find/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in find" ; \ - (cd find && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-flex clean-flex -maybe-clean-flex: - -clean-flex: - @[ -f ./flex/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in flex" ; \ - (cd flex && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-gas clean-gas -maybe-clean-gas: - -clean-gas: - @[ -f ./gas/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in gas" ; \ - (cd gas && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-gawk clean-gawk -maybe-clean-gawk: - -clean-gawk: - @[ -f ./gawk/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in gawk" ; \ - (cd gawk && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-gettext clean-gettext -maybe-clean-gettext: - -clean-gettext: - @[ -f ./gettext/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in gettext" ; \ - (cd gettext && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-gnuserv clean-gnuserv -maybe-clean-gnuserv: - -clean-gnuserv: - @[ -f ./gnuserv/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in gnuserv" ; \ - (cd gnuserv && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-gprof clean-gprof -maybe-clean-gprof: - -clean-gprof: - @[ -f ./gprof/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in gprof" ; \ - (cd gprof && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-gzip clean-gzip -maybe-clean-gzip: - -clean-gzip: - @[ -f ./gzip/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in gzip" ; \ - (cd gzip && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-hello clean-hello -maybe-clean-hello: - -clean-hello: - @[ -f ./hello/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in hello" ; \ - (cd hello && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-indent clean-indent -maybe-clean-indent: - -clean-indent: - @[ -f ./indent/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in indent" ; \ - (cd indent && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-intl clean-intl -maybe-clean-intl: - -clean-intl: - @[ -f ./intl/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in intl" ; \ - (cd intl && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-tcl clean-tcl -maybe-clean-tcl: - -clean-tcl: - @[ -f ./tcl/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in tcl" ; \ - (cd tcl && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-itcl clean-itcl -maybe-clean-itcl: - -clean-itcl: - @[ -f ./itcl/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in itcl" ; \ - (cd itcl && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-ld clean-ld -maybe-clean-ld: - -clean-ld: - @[ -f ./ld/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in ld" ; \ - (cd ld && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-libgui clean-libgui -maybe-clean-libgui: - -clean-libgui: - @[ -f ./libgui/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in libgui" ; \ - (cd libgui && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-libiberty clean-libiberty -maybe-clean-libiberty: - -clean-libiberty: - @[ -f ./libiberty/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in libiberty" ; \ - (cd libiberty && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-libtool clean-libtool -maybe-clean-libtool: - -clean-libtool: - @[ -f ./libtool/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in libtool" ; \ - (cd libtool && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-m4 clean-m4 -maybe-clean-m4: - -clean-m4: - @[ -f ./m4/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in m4" ; \ - (cd m4 && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-make clean-make -maybe-clean-make: - -clean-make: - @[ -f ./make/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in make" ; \ - (cd make && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-mmalloc clean-mmalloc -maybe-clean-mmalloc: - -clean-mmalloc: - @[ -f ./mmalloc/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in mmalloc" ; \ - (cd mmalloc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-patch clean-patch -maybe-clean-patch: - -clean-patch: - @[ -f ./patch/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in patch" ; \ - (cd patch && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-perl clean-perl -maybe-clean-perl: - -clean-perl: - @[ -f ./perl/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in perl" ; \ - (cd perl && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-prms clean-prms -maybe-clean-prms: - -clean-prms: - @[ -f ./prms/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in prms" ; \ - (cd prms && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-rcs clean-rcs -maybe-clean-rcs: - -clean-rcs: - @[ -f ./rcs/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in rcs" ; \ - (cd rcs && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-readline clean-readline -maybe-clean-readline: - -clean-readline: - @[ -f ./readline/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in readline" ; \ - (cd readline && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-release clean-release -maybe-clean-release: - -clean-release: - @[ -f ./release/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in release" ; \ - (cd release && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-recode clean-recode -maybe-clean-recode: - -clean-recode: - @[ -f ./recode/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in recode" ; \ - (cd recode && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-sed clean-sed -maybe-clean-sed: - -clean-sed: - @[ -f ./sed/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in sed" ; \ - (cd sed && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-send-pr clean-send-pr -maybe-clean-send-pr: - -clean-send-pr: - @[ -f ./send-pr/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in send-pr" ; \ - (cd send-pr && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-shellutils clean-shellutils -maybe-clean-shellutils: - -clean-shellutils: - @[ -f ./shellutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in shellutils" ; \ - (cd shellutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-sid clean-sid -maybe-clean-sid: - -clean-sid: - @[ -f ./sid/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in sid" ; \ - (cd sid && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-sim clean-sim -maybe-clean-sim: - -clean-sim: - @[ -f ./sim/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in sim" ; \ - (cd sim && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-tar clean-tar -maybe-clean-tar: - -clean-tar: - @[ -f ./tar/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in tar" ; \ - (cd tar && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-texinfo clean-texinfo -maybe-clean-texinfo: - -clean-texinfo: - @[ -f ./texinfo/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in texinfo" ; \ - (cd texinfo && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-textutils clean-textutils -maybe-clean-textutils: - -clean-textutils: - @[ -f ./textutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in textutils" ; \ - (cd textutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-time clean-time -maybe-clean-time: - -clean-time: - @[ -f ./time/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in time" ; \ - (cd time && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-uudecode clean-uudecode -maybe-clean-uudecode: - -clean-uudecode: - @[ -f ./uudecode/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in uudecode" ; \ - (cd uudecode && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-wdiff clean-wdiff -maybe-clean-wdiff: - -clean-wdiff: - @[ -f ./wdiff/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in wdiff" ; \ - (cd wdiff && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-zip clean-zip -maybe-clean-zip: - -clean-zip: - @[ -f ./zip/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in zip" ; \ - (cd zip && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-zlib clean-zlib -maybe-clean-zlib: - -clean-zlib: - @[ -f ./zlib/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in zlib" ; \ - (cd zlib && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-gdb clean-gdb -maybe-clean-gdb: - -clean-gdb: - @[ -f ./gdb/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in gdb" ; \ - (cd gdb && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-expect clean-expect -maybe-clean-expect: - -clean-expect: - @[ -f ./expect/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in expect" ; \ - (cd expect && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-guile clean-guile -maybe-clean-guile: - -clean-guile: - @[ -f ./guile/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in guile" ; \ - (cd guile && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-tk clean-tk -maybe-clean-tk: - -clean-tk: - @[ -f ./tk/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in tk" ; \ - (cd tk && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-tix clean-tix -maybe-clean-tix: - -clean-tix: - @[ -f ./tix/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in tix" ; \ - (cd tix && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-libtermcap clean-libtermcap -maybe-clean-libtermcap: - -# libtermcap doesn't support clean. -clean-libtermcap: - - -.PHONY: maybe-clean-utils clean-utils -maybe-clean-utils: - -clean-utils: - @[ -f ./utils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing clean in utils" ; \ - (cd utils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - - -# Target modules. - -.PHONY: maybe-clean-target-libstdc++-v3 clean-target-libstdc++-v3 -maybe-clean-target-libstdc++-v3: - -clean-target-libstdc++-v3: - @[ -f $(TARGET_SUBDIR)/libstdc++-v3/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing clean in $(TARGET_SUBDIR)/libstdc++-v3" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libstdc++-v3 && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-target-newlib clean-target-newlib -maybe-clean-target-newlib: - -clean-target-newlib: - @[ -f $(TARGET_SUBDIR)/newlib/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing clean in $(TARGET_SUBDIR)/newlib" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/newlib && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-target-libf2c clean-target-libf2c -maybe-clean-target-libf2c: - -clean-target-libf2c: - @[ -f $(TARGET_SUBDIR)/libf2c/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing clean in $(TARGET_SUBDIR)/libf2c" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libf2c && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-target-libobjc clean-target-libobjc -maybe-clean-target-libobjc: - -clean-target-libobjc: - @[ -f $(TARGET_SUBDIR)/libobjc/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing clean in $(TARGET_SUBDIR)/libobjc" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libobjc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-target-libtermcap clean-target-libtermcap -maybe-clean-target-libtermcap: - -# libtermcap doesn't support clean. -clean-target-libtermcap: - - -.PHONY: maybe-clean-target-winsup clean-target-winsup -maybe-clean-target-winsup: - -clean-target-winsup: - @[ -f $(TARGET_SUBDIR)/winsup/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing clean in $(TARGET_SUBDIR)/winsup" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/winsup && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-target-libgloss clean-target-libgloss -maybe-clean-target-libgloss: - -clean-target-libgloss: - @[ -f $(TARGET_SUBDIR)/libgloss/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing clean in $(TARGET_SUBDIR)/libgloss" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libgloss && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-target-libiberty clean-target-libiberty -maybe-clean-target-libiberty: - -clean-target-libiberty: - @[ -f $(TARGET_SUBDIR)/libiberty/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing clean in $(TARGET_SUBDIR)/libiberty" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libiberty && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-target-gperf clean-target-gperf -maybe-clean-target-gperf: - -clean-target-gperf: - @[ -f $(TARGET_SUBDIR)/gperf/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing clean in $(TARGET_SUBDIR)/gperf" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/gperf && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-target-examples clean-target-examples -maybe-clean-target-examples: - -clean-target-examples: - @[ -f $(TARGET_SUBDIR)/examples/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing clean in $(TARGET_SUBDIR)/examples" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/examples && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-target-libffi clean-target-libffi -maybe-clean-target-libffi: - -clean-target-libffi: - @[ -f $(TARGET_SUBDIR)/libffi/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing clean in $(TARGET_SUBDIR)/libffi" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libffi && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-target-libjava clean-target-libjava -maybe-clean-target-libjava: - -clean-target-libjava: - @[ -f $(TARGET_SUBDIR)/libjava/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing clean in $(TARGET_SUBDIR)/libjava" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libjava && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-target-zlib clean-target-zlib -maybe-clean-target-zlib: - -clean-target-zlib: - @[ -f $(TARGET_SUBDIR)/zlib/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing clean in $(TARGET_SUBDIR)/zlib" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/zlib && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-target-boehm-gc clean-target-boehm-gc -maybe-clean-target-boehm-gc: - -clean-target-boehm-gc: - @[ -f $(TARGET_SUBDIR)/boehm-gc/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing clean in $(TARGET_SUBDIR)/boehm-gc" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/boehm-gc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-target-qthreads clean-target-qthreads -maybe-clean-target-qthreads: - -clean-target-qthreads: - @[ -f $(TARGET_SUBDIR)/qthreads/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing clean in $(TARGET_SUBDIR)/qthreads" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/qthreads && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-target-rda clean-target-rda -maybe-clean-target-rda: - -clean-target-rda: - @[ -f $(TARGET_SUBDIR)/rda/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing clean in $(TARGET_SUBDIR)/rda" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/rda && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - - -.PHONY: maybe-clean-target-libada clean-target-libada -maybe-clean-target-libada: - -clean-target-libada: - @[ -f $(TARGET_SUBDIR)/libada/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing clean in $(TARGET_SUBDIR)/libada" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libada && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - clean) \ - || exit 1 - +clean-target: maybe-clean-target-libstdc++-v3 +clean-target: maybe-clean-target-libmudflap +clean-target: maybe-clean-target-libssp +clean-target: maybe-clean-target-libgcc-math +clean-target: maybe-clean-target-newlib +clean-target: maybe-clean-target-libgfortran +clean-target: maybe-clean-target-libobjc +clean-target: maybe-clean-target-libtermcap +clean-target: maybe-clean-target-winsup +clean-target: maybe-clean-target-libgloss +clean-target: maybe-clean-target-libiberty +clean-target: maybe-clean-target-gperf +clean-target: maybe-clean-target-examples +clean-target: maybe-clean-target-libffi +clean-target: maybe-clean-target-libjava +clean-target: maybe-clean-target-zlib +clean-target: maybe-clean-target-boehm-gc +clean-target: maybe-clean-target-qthreads +clean-target: maybe-clean-target-rda +clean-target: maybe-clean-target-libada +clean-target: maybe-clean-target-libgomp .PHONY: do-distclean -do-distclean: distclean-host distclean-target +do-distclean: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(MAKE) $(RECURSE_FLAGS_TO_PASS) distclean-host \ + distclean-target + .PHONY: distclean-host -distclean-host: maybe-distclean-gcc \ - maybe-distclean-ash \ - maybe-distclean-autoconf \ - maybe-distclean-automake \ - maybe-distclean-bash \ - maybe-distclean-bfd \ - maybe-distclean-opcodes \ - maybe-distclean-binutils \ - maybe-distclean-bison \ - maybe-distclean-byacc \ - maybe-distclean-bzip2 \ - maybe-distclean-dejagnu \ - maybe-distclean-diff \ - maybe-distclean-dosutils \ - maybe-distclean-etc \ - maybe-distclean-fastjar \ - maybe-distclean-fileutils \ - maybe-distclean-findutils \ - maybe-distclean-find \ - maybe-distclean-flex \ - maybe-distclean-gas \ - maybe-distclean-gawk \ - maybe-distclean-gettext \ - maybe-distclean-gnuserv \ - maybe-distclean-gprof \ - maybe-distclean-gzip \ - maybe-distclean-hello \ - maybe-distclean-indent \ - maybe-distclean-intl \ - maybe-distclean-tcl \ - maybe-distclean-itcl \ - maybe-distclean-ld \ - maybe-distclean-libgui \ - maybe-distclean-libiberty \ - maybe-distclean-libtool \ - maybe-distclean-m4 \ - maybe-distclean-make \ - maybe-distclean-mmalloc \ - maybe-distclean-patch \ - maybe-distclean-perl \ - maybe-distclean-prms \ - maybe-distclean-rcs \ - maybe-distclean-readline \ - maybe-distclean-release \ - maybe-distclean-recode \ - maybe-distclean-sed \ - maybe-distclean-send-pr \ - maybe-distclean-shellutils \ - maybe-distclean-sid \ - maybe-distclean-sim \ - maybe-distclean-tar \ - maybe-distclean-texinfo \ - maybe-distclean-textutils \ - maybe-distclean-time \ - maybe-distclean-uudecode \ - maybe-distclean-wdiff \ - maybe-distclean-zip \ - maybe-distclean-zlib \ - maybe-distclean-gdb \ - maybe-distclean-expect \ - maybe-distclean-guile \ - maybe-distclean-tk \ - maybe-distclean-tix \ - maybe-distclean-libtermcap \ - maybe-distclean-utils + +distclean-host: maybe-distclean-ash +distclean-host: maybe-distclean-autoconf +distclean-host: maybe-distclean-automake +distclean-host: maybe-distclean-bash +distclean-host: maybe-distclean-bfd +distclean-host: maybe-distclean-opcodes +distclean-host: maybe-distclean-binutils +distclean-host: maybe-distclean-bison +distclean-host: maybe-distclean-byacc +distclean-host: maybe-distclean-bzip2 +distclean-host: maybe-distclean-dejagnu +distclean-host: maybe-distclean-diff +distclean-host: maybe-distclean-dosutils +distclean-host: maybe-distclean-etc +distclean-host: maybe-distclean-fastjar +distclean-host: maybe-distclean-fileutils +distclean-host: maybe-distclean-findutils +distclean-host: maybe-distclean-find +distclean-host: maybe-distclean-fixincludes +distclean-host: maybe-distclean-flex +distclean-host: maybe-distclean-gas +distclean-host: maybe-distclean-gcc +distclean-host: maybe-distclean-gawk +distclean-host: maybe-distclean-gettext +distclean-host: maybe-distclean-gnuserv +distclean-host: maybe-distclean-gprof +distclean-host: maybe-distclean-gzip +distclean-host: maybe-distclean-hello +distclean-host: maybe-distclean-indent +distclean-host: maybe-distclean-intl +distclean-host: maybe-distclean-tcl +distclean-host: maybe-distclean-itcl +distclean-host: maybe-distclean-ld +distclean-host: maybe-distclean-libcpp +distclean-host: maybe-distclean-libdecnumber +distclean-host: maybe-distclean-libgui +distclean-host: maybe-distclean-libiberty +distclean-host: maybe-distclean-libtool +distclean-host: maybe-distclean-m4 +distclean-host: maybe-distclean-make +distclean-host: maybe-distclean-mmalloc +distclean-host: maybe-distclean-patch +distclean-host: maybe-distclean-perl +distclean-host: maybe-distclean-prms +distclean-host: maybe-distclean-rcs +distclean-host: maybe-distclean-readline +distclean-host: maybe-distclean-release +distclean-host: maybe-distclean-recode +distclean-host: maybe-distclean-sed +distclean-host: maybe-distclean-send-pr +distclean-host: maybe-distclean-shellutils +distclean-host: maybe-distclean-sid +distclean-host: maybe-distclean-sim +distclean-host: maybe-distclean-tar +distclean-host: maybe-distclean-texinfo +distclean-host: maybe-distclean-textutils +distclean-host: maybe-distclean-time +distclean-host: maybe-distclean-uudecode +distclean-host: maybe-distclean-wdiff +distclean-host: maybe-distclean-zip +distclean-host: maybe-distclean-zlib +distclean-host: maybe-distclean-gdb +distclean-host: maybe-distclean-expect +distclean-host: maybe-distclean-guile +distclean-host: maybe-distclean-tk +distclean-host: maybe-distclean-libtermcap +distclean-host: maybe-distclean-utils +distclean-host: maybe-distclean-gnattools .PHONY: distclean-target -distclean-target: \ - maybe-distclean-target-libstdc++-v3 \ - maybe-distclean-target-newlib \ - maybe-distclean-target-libf2c \ - maybe-distclean-target-libobjc \ - maybe-distclean-target-libtermcap \ - maybe-distclean-target-winsup \ - maybe-distclean-target-libgloss \ - maybe-distclean-target-libiberty \ - maybe-distclean-target-gperf \ - maybe-distclean-target-examples \ - maybe-distclean-target-libffi \ - maybe-distclean-target-libjava \ - maybe-distclean-target-zlib \ - maybe-distclean-target-boehm-gc \ - maybe-distclean-target-qthreads \ - maybe-distclean-target-rda \ - maybe-distclean-target-libada - -# GCC, the eternal special case -.PHONY: maybe-distclean-gcc distclean-gcc -maybe-distclean-gcc: -distclean-gcc: - @[ -f ./gcc/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_GCC_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in gcc" ; \ - (cd gcc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - -# Host modules. - -.PHONY: maybe-distclean-ash distclean-ash -maybe-distclean-ash: - -distclean-ash: - @[ -f ./ash/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in ash" ; \ - (cd ash && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-autoconf distclean-autoconf -maybe-distclean-autoconf: - -distclean-autoconf: - @[ -f ./autoconf/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in autoconf" ; \ - (cd autoconf && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-automake distclean-automake -maybe-distclean-automake: - -distclean-automake: - @[ -f ./automake/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in automake" ; \ - (cd automake && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-bash distclean-bash -maybe-distclean-bash: - -distclean-bash: - @[ -f ./bash/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in bash" ; \ - (cd bash && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-bfd distclean-bfd -maybe-distclean-bfd: - -distclean-bfd: - @[ -f ./bfd/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in bfd" ; \ - (cd bfd && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-opcodes distclean-opcodes -maybe-distclean-opcodes: - -distclean-opcodes: - @[ -f ./opcodes/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in opcodes" ; \ - (cd opcodes && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-binutils distclean-binutils -maybe-distclean-binutils: - -distclean-binutils: - @[ -f ./binutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in binutils" ; \ - (cd binutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-bison distclean-bison -maybe-distclean-bison: - -distclean-bison: - @[ -f ./bison/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in bison" ; \ - (cd bison && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-byacc distclean-byacc -maybe-distclean-byacc: - -distclean-byacc: - @[ -f ./byacc/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in byacc" ; \ - (cd byacc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-bzip2 distclean-bzip2 -maybe-distclean-bzip2: - -distclean-bzip2: - @[ -f ./bzip2/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in bzip2" ; \ - (cd bzip2 && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-dejagnu distclean-dejagnu -maybe-distclean-dejagnu: - -distclean-dejagnu: - @[ -f ./dejagnu/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in dejagnu" ; \ - (cd dejagnu && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-diff distclean-diff -maybe-distclean-diff: - -distclean-diff: - @[ -f ./diff/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in diff" ; \ - (cd diff && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-dosutils distclean-dosutils -maybe-distclean-dosutils: - -distclean-dosutils: - @[ -f ./dosutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in dosutils" ; \ - (cd dosutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-etc distclean-etc -maybe-distclean-etc: - -distclean-etc: - @[ -f ./etc/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in etc" ; \ - (cd etc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-fastjar distclean-fastjar -maybe-distclean-fastjar: - -distclean-fastjar: - @[ -f ./fastjar/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in fastjar" ; \ - (cd fastjar && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-fileutils distclean-fileutils -maybe-distclean-fileutils: - -distclean-fileutils: - @[ -f ./fileutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in fileutils" ; \ - (cd fileutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-findutils distclean-findutils -maybe-distclean-findutils: - -distclean-findutils: - @[ -f ./findutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in findutils" ; \ - (cd findutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-find distclean-find -maybe-distclean-find: - -distclean-find: - @[ -f ./find/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in find" ; \ - (cd find && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-flex distclean-flex -maybe-distclean-flex: - -distclean-flex: - @[ -f ./flex/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in flex" ; \ - (cd flex && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-gas distclean-gas -maybe-distclean-gas: - -distclean-gas: - @[ -f ./gas/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in gas" ; \ - (cd gas && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-gawk distclean-gawk -maybe-distclean-gawk: - -distclean-gawk: - @[ -f ./gawk/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in gawk" ; \ - (cd gawk && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-gettext distclean-gettext -maybe-distclean-gettext: - -distclean-gettext: - @[ -f ./gettext/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in gettext" ; \ - (cd gettext && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-gnuserv distclean-gnuserv -maybe-distclean-gnuserv: - -distclean-gnuserv: - @[ -f ./gnuserv/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in gnuserv" ; \ - (cd gnuserv && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-gprof distclean-gprof -maybe-distclean-gprof: - -distclean-gprof: - @[ -f ./gprof/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in gprof" ; \ - (cd gprof && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-gzip distclean-gzip -maybe-distclean-gzip: - -distclean-gzip: - @[ -f ./gzip/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in gzip" ; \ - (cd gzip && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-hello distclean-hello -maybe-distclean-hello: - -distclean-hello: - @[ -f ./hello/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in hello" ; \ - (cd hello && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-indent distclean-indent -maybe-distclean-indent: - -distclean-indent: - @[ -f ./indent/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in indent" ; \ - (cd indent && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-intl distclean-intl -maybe-distclean-intl: - -distclean-intl: - @[ -f ./intl/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in intl" ; \ - (cd intl && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-tcl distclean-tcl -maybe-distclean-tcl: - -distclean-tcl: - @[ -f ./tcl/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in tcl" ; \ - (cd tcl && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-itcl distclean-itcl -maybe-distclean-itcl: - -distclean-itcl: - @[ -f ./itcl/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in itcl" ; \ - (cd itcl && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-ld distclean-ld -maybe-distclean-ld: - -distclean-ld: - @[ -f ./ld/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in ld" ; \ - (cd ld && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-libgui distclean-libgui -maybe-distclean-libgui: - -distclean-libgui: - @[ -f ./libgui/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in libgui" ; \ - (cd libgui && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-libiberty distclean-libiberty -maybe-distclean-libiberty: - -distclean-libiberty: - @[ -f ./libiberty/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in libiberty" ; \ - (cd libiberty && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-libtool distclean-libtool -maybe-distclean-libtool: - -distclean-libtool: - @[ -f ./libtool/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in libtool" ; \ - (cd libtool && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-m4 distclean-m4 -maybe-distclean-m4: - -distclean-m4: - @[ -f ./m4/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in m4" ; \ - (cd m4 && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-make distclean-make -maybe-distclean-make: - -distclean-make: - @[ -f ./make/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in make" ; \ - (cd make && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-mmalloc distclean-mmalloc -maybe-distclean-mmalloc: - -distclean-mmalloc: - @[ -f ./mmalloc/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in mmalloc" ; \ - (cd mmalloc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-patch distclean-patch -maybe-distclean-patch: - -distclean-patch: - @[ -f ./patch/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in patch" ; \ - (cd patch && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-perl distclean-perl -maybe-distclean-perl: - -distclean-perl: - @[ -f ./perl/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in perl" ; \ - (cd perl && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-prms distclean-prms -maybe-distclean-prms: - -distclean-prms: - @[ -f ./prms/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in prms" ; \ - (cd prms && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-rcs distclean-rcs -maybe-distclean-rcs: - -distclean-rcs: - @[ -f ./rcs/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in rcs" ; \ - (cd rcs && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-readline distclean-readline -maybe-distclean-readline: - -distclean-readline: - @[ -f ./readline/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in readline" ; \ - (cd readline && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-release distclean-release -maybe-distclean-release: - -distclean-release: - @[ -f ./release/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in release" ; \ - (cd release && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-recode distclean-recode -maybe-distclean-recode: - -distclean-recode: - @[ -f ./recode/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in recode" ; \ - (cd recode && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-sed distclean-sed -maybe-distclean-sed: - -distclean-sed: - @[ -f ./sed/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in sed" ; \ - (cd sed && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-send-pr distclean-send-pr -maybe-distclean-send-pr: - -distclean-send-pr: - @[ -f ./send-pr/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in send-pr" ; \ - (cd send-pr && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-shellutils distclean-shellutils -maybe-distclean-shellutils: - -distclean-shellutils: - @[ -f ./shellutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in shellutils" ; \ - (cd shellutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-sid distclean-sid -maybe-distclean-sid: - -distclean-sid: - @[ -f ./sid/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in sid" ; \ - (cd sid && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-sim distclean-sim -maybe-distclean-sim: - -distclean-sim: - @[ -f ./sim/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in sim" ; \ - (cd sim && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-tar distclean-tar -maybe-distclean-tar: - -distclean-tar: - @[ -f ./tar/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in tar" ; \ - (cd tar && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-texinfo distclean-texinfo -maybe-distclean-texinfo: - -distclean-texinfo: - @[ -f ./texinfo/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in texinfo" ; \ - (cd texinfo && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-textutils distclean-textutils -maybe-distclean-textutils: - -distclean-textutils: - @[ -f ./textutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in textutils" ; \ - (cd textutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-time distclean-time -maybe-distclean-time: - -distclean-time: - @[ -f ./time/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in time" ; \ - (cd time && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-uudecode distclean-uudecode -maybe-distclean-uudecode: - -distclean-uudecode: - @[ -f ./uudecode/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in uudecode" ; \ - (cd uudecode && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-wdiff distclean-wdiff -maybe-distclean-wdiff: - -distclean-wdiff: - @[ -f ./wdiff/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in wdiff" ; \ - (cd wdiff && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-zip distclean-zip -maybe-distclean-zip: - -distclean-zip: - @[ -f ./zip/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in zip" ; \ - (cd zip && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-zlib distclean-zlib -maybe-distclean-zlib: - -distclean-zlib: - @[ -f ./zlib/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in zlib" ; \ - (cd zlib && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-gdb distclean-gdb -maybe-distclean-gdb: - -distclean-gdb: - @[ -f ./gdb/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in gdb" ; \ - (cd gdb && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-expect distclean-expect -maybe-distclean-expect: - -distclean-expect: - @[ -f ./expect/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in expect" ; \ - (cd expect && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-guile distclean-guile -maybe-distclean-guile: - -distclean-guile: - @[ -f ./guile/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in guile" ; \ - (cd guile && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-tk distclean-tk -maybe-distclean-tk: - -distclean-tk: - @[ -f ./tk/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in tk" ; \ - (cd tk && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-tix distclean-tix -maybe-distclean-tix: - -distclean-tix: - @[ -f ./tix/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in tix" ; \ - (cd tix && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-libtermcap distclean-libtermcap -maybe-distclean-libtermcap: - -# libtermcap doesn't support distclean. -distclean-libtermcap: - - -.PHONY: maybe-distclean-utils distclean-utils -maybe-distclean-utils: - -distclean-utils: - @[ -f ./utils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing distclean in utils" ; \ - (cd utils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - - -# Target modules. - -.PHONY: maybe-distclean-target-libstdc++-v3 distclean-target-libstdc++-v3 -maybe-distclean-target-libstdc++-v3: - -distclean-target-libstdc++-v3: - @[ -f $(TARGET_SUBDIR)/libstdc++-v3/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing distclean in $(TARGET_SUBDIR)/libstdc++-v3" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libstdc++-v3 && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-target-newlib distclean-target-newlib -maybe-distclean-target-newlib: - -distclean-target-newlib: - @[ -f $(TARGET_SUBDIR)/newlib/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing distclean in $(TARGET_SUBDIR)/newlib" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/newlib && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-target-libf2c distclean-target-libf2c -maybe-distclean-target-libf2c: - -distclean-target-libf2c: - @[ -f $(TARGET_SUBDIR)/libf2c/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing distclean in $(TARGET_SUBDIR)/libf2c" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libf2c && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-target-libobjc distclean-target-libobjc -maybe-distclean-target-libobjc: - -distclean-target-libobjc: - @[ -f $(TARGET_SUBDIR)/libobjc/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing distclean in $(TARGET_SUBDIR)/libobjc" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libobjc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-target-libtermcap distclean-target-libtermcap -maybe-distclean-target-libtermcap: - -# libtermcap doesn't support distclean. -distclean-target-libtermcap: - - -.PHONY: maybe-distclean-target-winsup distclean-target-winsup -maybe-distclean-target-winsup: - -distclean-target-winsup: - @[ -f $(TARGET_SUBDIR)/winsup/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing distclean in $(TARGET_SUBDIR)/winsup" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/winsup && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-target-libgloss distclean-target-libgloss -maybe-distclean-target-libgloss: - -distclean-target-libgloss: - @[ -f $(TARGET_SUBDIR)/libgloss/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing distclean in $(TARGET_SUBDIR)/libgloss" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libgloss && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-target-libiberty distclean-target-libiberty -maybe-distclean-target-libiberty: - -distclean-target-libiberty: - @[ -f $(TARGET_SUBDIR)/libiberty/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing distclean in $(TARGET_SUBDIR)/libiberty" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libiberty && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-target-gperf distclean-target-gperf -maybe-distclean-target-gperf: - -distclean-target-gperf: - @[ -f $(TARGET_SUBDIR)/gperf/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing distclean in $(TARGET_SUBDIR)/gperf" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/gperf && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-target-examples distclean-target-examples -maybe-distclean-target-examples: - -distclean-target-examples: - @[ -f $(TARGET_SUBDIR)/examples/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing distclean in $(TARGET_SUBDIR)/examples" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/examples && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-target-libffi distclean-target-libffi -maybe-distclean-target-libffi: - -distclean-target-libffi: - @[ -f $(TARGET_SUBDIR)/libffi/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing distclean in $(TARGET_SUBDIR)/libffi" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libffi && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-target-libjava distclean-target-libjava -maybe-distclean-target-libjava: - -distclean-target-libjava: - @[ -f $(TARGET_SUBDIR)/libjava/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing distclean in $(TARGET_SUBDIR)/libjava" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libjava && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-target-zlib distclean-target-zlib -maybe-distclean-target-zlib: - -distclean-target-zlib: - @[ -f $(TARGET_SUBDIR)/zlib/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing distclean in $(TARGET_SUBDIR)/zlib" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/zlib && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-target-boehm-gc distclean-target-boehm-gc -maybe-distclean-target-boehm-gc: - -distclean-target-boehm-gc: - @[ -f $(TARGET_SUBDIR)/boehm-gc/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing distclean in $(TARGET_SUBDIR)/boehm-gc" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/boehm-gc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-target-qthreads distclean-target-qthreads -maybe-distclean-target-qthreads: - -distclean-target-qthreads: - @[ -f $(TARGET_SUBDIR)/qthreads/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing distclean in $(TARGET_SUBDIR)/qthreads" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/qthreads && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-target-rda distclean-target-rda -maybe-distclean-target-rda: - -distclean-target-rda: - @[ -f $(TARGET_SUBDIR)/rda/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing distclean in $(TARGET_SUBDIR)/rda" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/rda && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - - -.PHONY: maybe-distclean-target-libada distclean-target-libada -maybe-distclean-target-libada: - -distclean-target-libada: - @[ -f $(TARGET_SUBDIR)/libada/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing distclean in $(TARGET_SUBDIR)/libada" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libada && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - distclean) \ - || exit 1 - +distclean-target: maybe-distclean-target-libstdc++-v3 +distclean-target: maybe-distclean-target-libmudflap +distclean-target: maybe-distclean-target-libssp +distclean-target: maybe-distclean-target-libgcc-math +distclean-target: maybe-distclean-target-newlib +distclean-target: maybe-distclean-target-libgfortran +distclean-target: maybe-distclean-target-libobjc +distclean-target: maybe-distclean-target-libtermcap +distclean-target: maybe-distclean-target-winsup +distclean-target: maybe-distclean-target-libgloss +distclean-target: maybe-distclean-target-libiberty +distclean-target: maybe-distclean-target-gperf +distclean-target: maybe-distclean-target-examples +distclean-target: maybe-distclean-target-libffi +distclean-target: maybe-distclean-target-libjava +distclean-target: maybe-distclean-target-zlib +distclean-target: maybe-distclean-target-boehm-gc +distclean-target: maybe-distclean-target-qthreads +distclean-target: maybe-distclean-target-rda +distclean-target: maybe-distclean-target-libada +distclean-target: maybe-distclean-target-libgomp .PHONY: do-maintainer-clean -do-maintainer-clean: maintainer-clean-host maintainer-clean-target +do-maintainer-clean: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(MAKE) $(RECURSE_FLAGS_TO_PASS) maintainer-clean-host \ + maintainer-clean-target + .PHONY: maintainer-clean-host -maintainer-clean-host: maybe-maintainer-clean-gcc \ - maybe-maintainer-clean-ash \ - maybe-maintainer-clean-autoconf \ - maybe-maintainer-clean-automake \ - maybe-maintainer-clean-bash \ - maybe-maintainer-clean-bfd \ - maybe-maintainer-clean-opcodes \ - maybe-maintainer-clean-binutils \ - maybe-maintainer-clean-bison \ - maybe-maintainer-clean-byacc \ - maybe-maintainer-clean-bzip2 \ - maybe-maintainer-clean-dejagnu \ - maybe-maintainer-clean-diff \ - maybe-maintainer-clean-dosutils \ - maybe-maintainer-clean-etc \ - maybe-maintainer-clean-fastjar \ - maybe-maintainer-clean-fileutils \ - maybe-maintainer-clean-findutils \ - maybe-maintainer-clean-find \ - maybe-maintainer-clean-flex \ - maybe-maintainer-clean-gas \ - maybe-maintainer-clean-gawk \ - maybe-maintainer-clean-gettext \ - maybe-maintainer-clean-gnuserv \ - maybe-maintainer-clean-gprof \ - maybe-maintainer-clean-gzip \ - maybe-maintainer-clean-hello \ - maybe-maintainer-clean-indent \ - maybe-maintainer-clean-intl \ - maybe-maintainer-clean-tcl \ - maybe-maintainer-clean-itcl \ - maybe-maintainer-clean-ld \ - maybe-maintainer-clean-libgui \ - maybe-maintainer-clean-libiberty \ - maybe-maintainer-clean-libtool \ - maybe-maintainer-clean-m4 \ - maybe-maintainer-clean-make \ - maybe-maintainer-clean-mmalloc \ - maybe-maintainer-clean-patch \ - maybe-maintainer-clean-perl \ - maybe-maintainer-clean-prms \ - maybe-maintainer-clean-rcs \ - maybe-maintainer-clean-readline \ - maybe-maintainer-clean-release \ - maybe-maintainer-clean-recode \ - maybe-maintainer-clean-sed \ - maybe-maintainer-clean-send-pr \ - maybe-maintainer-clean-shellutils \ - maybe-maintainer-clean-sid \ - maybe-maintainer-clean-sim \ - maybe-maintainer-clean-tar \ - maybe-maintainer-clean-texinfo \ - maybe-maintainer-clean-textutils \ - maybe-maintainer-clean-time \ - maybe-maintainer-clean-uudecode \ - maybe-maintainer-clean-wdiff \ - maybe-maintainer-clean-zip \ - maybe-maintainer-clean-zlib \ - maybe-maintainer-clean-gdb \ - maybe-maintainer-clean-expect \ - maybe-maintainer-clean-guile \ - maybe-maintainer-clean-tk \ - maybe-maintainer-clean-tix \ - maybe-maintainer-clean-libtermcap \ - maybe-maintainer-clean-utils + +maintainer-clean-host: maybe-maintainer-clean-ash +maintainer-clean-host: maybe-maintainer-clean-autoconf +maintainer-clean-host: maybe-maintainer-clean-automake +maintainer-clean-host: maybe-maintainer-clean-bash +maintainer-clean-host: maybe-maintainer-clean-bfd +maintainer-clean-host: maybe-maintainer-clean-opcodes +maintainer-clean-host: maybe-maintainer-clean-binutils +maintainer-clean-host: maybe-maintainer-clean-bison +maintainer-clean-host: maybe-maintainer-clean-byacc +maintainer-clean-host: maybe-maintainer-clean-bzip2 +maintainer-clean-host: maybe-maintainer-clean-dejagnu +maintainer-clean-host: maybe-maintainer-clean-diff +maintainer-clean-host: maybe-maintainer-clean-dosutils +maintainer-clean-host: maybe-maintainer-clean-etc +maintainer-clean-host: maybe-maintainer-clean-fastjar +maintainer-clean-host: maybe-maintainer-clean-fileutils +maintainer-clean-host: maybe-maintainer-clean-findutils +maintainer-clean-host: maybe-maintainer-clean-find +maintainer-clean-host: maybe-maintainer-clean-fixincludes +maintainer-clean-host: maybe-maintainer-clean-flex +maintainer-clean-host: maybe-maintainer-clean-gas +maintainer-clean-host: maybe-maintainer-clean-gcc +maintainer-clean-host: maybe-maintainer-clean-gawk +maintainer-clean-host: maybe-maintainer-clean-gettext +maintainer-clean-host: maybe-maintainer-clean-gnuserv +maintainer-clean-host: maybe-maintainer-clean-gprof +maintainer-clean-host: maybe-maintainer-clean-gzip +maintainer-clean-host: maybe-maintainer-clean-hello +maintainer-clean-host: maybe-maintainer-clean-indent +maintainer-clean-host: maybe-maintainer-clean-intl +maintainer-clean-host: maybe-maintainer-clean-tcl +maintainer-clean-host: maybe-maintainer-clean-itcl +maintainer-clean-host: maybe-maintainer-clean-ld +maintainer-clean-host: maybe-maintainer-clean-libcpp +maintainer-clean-host: maybe-maintainer-clean-libdecnumber +maintainer-clean-host: maybe-maintainer-clean-libgui +maintainer-clean-host: maybe-maintainer-clean-libiberty +maintainer-clean-host: maybe-maintainer-clean-libtool +maintainer-clean-host: maybe-maintainer-clean-m4 +maintainer-clean-host: maybe-maintainer-clean-make +maintainer-clean-host: maybe-maintainer-clean-mmalloc +maintainer-clean-host: maybe-maintainer-clean-patch +maintainer-clean-host: maybe-maintainer-clean-perl +maintainer-clean-host: maybe-maintainer-clean-prms +maintainer-clean-host: maybe-maintainer-clean-rcs +maintainer-clean-host: maybe-maintainer-clean-readline +maintainer-clean-host: maybe-maintainer-clean-release +maintainer-clean-host: maybe-maintainer-clean-recode +maintainer-clean-host: maybe-maintainer-clean-sed +maintainer-clean-host: maybe-maintainer-clean-send-pr +maintainer-clean-host: maybe-maintainer-clean-shellutils +maintainer-clean-host: maybe-maintainer-clean-sid +maintainer-clean-host: maybe-maintainer-clean-sim +maintainer-clean-host: maybe-maintainer-clean-tar +maintainer-clean-host: maybe-maintainer-clean-texinfo +maintainer-clean-host: maybe-maintainer-clean-textutils +maintainer-clean-host: maybe-maintainer-clean-time +maintainer-clean-host: maybe-maintainer-clean-uudecode +maintainer-clean-host: maybe-maintainer-clean-wdiff +maintainer-clean-host: maybe-maintainer-clean-zip +maintainer-clean-host: maybe-maintainer-clean-zlib +maintainer-clean-host: maybe-maintainer-clean-gdb +maintainer-clean-host: maybe-maintainer-clean-expect +maintainer-clean-host: maybe-maintainer-clean-guile +maintainer-clean-host: maybe-maintainer-clean-tk +maintainer-clean-host: maybe-maintainer-clean-libtermcap +maintainer-clean-host: maybe-maintainer-clean-utils +maintainer-clean-host: maybe-maintainer-clean-gnattools .PHONY: maintainer-clean-target -maintainer-clean-target: \ - maybe-maintainer-clean-target-libstdc++-v3 \ - maybe-maintainer-clean-target-newlib \ - maybe-maintainer-clean-target-libf2c \ - maybe-maintainer-clean-target-libobjc \ - maybe-maintainer-clean-target-libtermcap \ - maybe-maintainer-clean-target-winsup \ - maybe-maintainer-clean-target-libgloss \ - maybe-maintainer-clean-target-libiberty \ - maybe-maintainer-clean-target-gperf \ - maybe-maintainer-clean-target-examples \ - maybe-maintainer-clean-target-libffi \ - maybe-maintainer-clean-target-libjava \ - maybe-maintainer-clean-target-zlib \ - maybe-maintainer-clean-target-boehm-gc \ - maybe-maintainer-clean-target-qthreads \ - maybe-maintainer-clean-target-rda \ - maybe-maintainer-clean-target-libada - -# GCC, the eternal special case -.PHONY: maybe-maintainer-clean-gcc maintainer-clean-gcc -maybe-maintainer-clean-gcc: -maintainer-clean-gcc: - @[ -f ./gcc/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_GCC_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in gcc" ; \ - (cd gcc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - -# Host modules. - -.PHONY: maybe-maintainer-clean-ash maintainer-clean-ash -maybe-maintainer-clean-ash: - -maintainer-clean-ash: - @[ -f ./ash/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in ash" ; \ - (cd ash && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-autoconf maintainer-clean-autoconf -maybe-maintainer-clean-autoconf: - -maintainer-clean-autoconf: - @[ -f ./autoconf/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in autoconf" ; \ - (cd autoconf && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-automake maintainer-clean-automake -maybe-maintainer-clean-automake: - -maintainer-clean-automake: - @[ -f ./automake/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in automake" ; \ - (cd automake && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-bash maintainer-clean-bash -maybe-maintainer-clean-bash: - -maintainer-clean-bash: - @[ -f ./bash/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in bash" ; \ - (cd bash && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-bfd maintainer-clean-bfd -maybe-maintainer-clean-bfd: - -maintainer-clean-bfd: - @[ -f ./bfd/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in bfd" ; \ - (cd bfd && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-opcodes maintainer-clean-opcodes -maybe-maintainer-clean-opcodes: - -maintainer-clean-opcodes: - @[ -f ./opcodes/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in opcodes" ; \ - (cd opcodes && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-binutils maintainer-clean-binutils -maybe-maintainer-clean-binutils: - -maintainer-clean-binutils: - @[ -f ./binutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in binutils" ; \ - (cd binutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-bison maintainer-clean-bison -maybe-maintainer-clean-bison: - -maintainer-clean-bison: - @[ -f ./bison/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in bison" ; \ - (cd bison && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-byacc maintainer-clean-byacc -maybe-maintainer-clean-byacc: - -maintainer-clean-byacc: - @[ -f ./byacc/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in byacc" ; \ - (cd byacc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-bzip2 maintainer-clean-bzip2 -maybe-maintainer-clean-bzip2: - -maintainer-clean-bzip2: - @[ -f ./bzip2/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in bzip2" ; \ - (cd bzip2 && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-dejagnu maintainer-clean-dejagnu -maybe-maintainer-clean-dejagnu: - -maintainer-clean-dejagnu: - @[ -f ./dejagnu/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in dejagnu" ; \ - (cd dejagnu && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-diff maintainer-clean-diff -maybe-maintainer-clean-diff: - -maintainer-clean-diff: - @[ -f ./diff/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in diff" ; \ - (cd diff && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-dosutils maintainer-clean-dosutils -maybe-maintainer-clean-dosutils: - -maintainer-clean-dosutils: - @[ -f ./dosutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in dosutils" ; \ - (cd dosutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-etc maintainer-clean-etc -maybe-maintainer-clean-etc: - -maintainer-clean-etc: - @[ -f ./etc/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in etc" ; \ - (cd etc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-fastjar maintainer-clean-fastjar -maybe-maintainer-clean-fastjar: - -maintainer-clean-fastjar: - @[ -f ./fastjar/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in fastjar" ; \ - (cd fastjar && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-fileutils maintainer-clean-fileutils -maybe-maintainer-clean-fileutils: - -maintainer-clean-fileutils: - @[ -f ./fileutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in fileutils" ; \ - (cd fileutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-findutils maintainer-clean-findutils -maybe-maintainer-clean-findutils: - -maintainer-clean-findutils: - @[ -f ./findutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in findutils" ; \ - (cd findutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-find maintainer-clean-find -maybe-maintainer-clean-find: - -maintainer-clean-find: - @[ -f ./find/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in find" ; \ - (cd find && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-flex maintainer-clean-flex -maybe-maintainer-clean-flex: - -maintainer-clean-flex: - @[ -f ./flex/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in flex" ; \ - (cd flex && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-gas maintainer-clean-gas -maybe-maintainer-clean-gas: - -maintainer-clean-gas: - @[ -f ./gas/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in gas" ; \ - (cd gas && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-gawk maintainer-clean-gawk -maybe-maintainer-clean-gawk: - -maintainer-clean-gawk: - @[ -f ./gawk/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in gawk" ; \ - (cd gawk && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-gettext maintainer-clean-gettext -maybe-maintainer-clean-gettext: - -maintainer-clean-gettext: - @[ -f ./gettext/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in gettext" ; \ - (cd gettext && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-gnuserv maintainer-clean-gnuserv -maybe-maintainer-clean-gnuserv: - -maintainer-clean-gnuserv: - @[ -f ./gnuserv/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in gnuserv" ; \ - (cd gnuserv && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-gprof maintainer-clean-gprof -maybe-maintainer-clean-gprof: - -maintainer-clean-gprof: - @[ -f ./gprof/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in gprof" ; \ - (cd gprof && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-gzip maintainer-clean-gzip -maybe-maintainer-clean-gzip: - -maintainer-clean-gzip: - @[ -f ./gzip/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in gzip" ; \ - (cd gzip && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-hello maintainer-clean-hello -maybe-maintainer-clean-hello: - -maintainer-clean-hello: - @[ -f ./hello/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in hello" ; \ - (cd hello && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-indent maintainer-clean-indent -maybe-maintainer-clean-indent: - -maintainer-clean-indent: - @[ -f ./indent/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in indent" ; \ - (cd indent && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-intl maintainer-clean-intl -maybe-maintainer-clean-intl: - -maintainer-clean-intl: - @[ -f ./intl/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in intl" ; \ - (cd intl && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-tcl maintainer-clean-tcl -maybe-maintainer-clean-tcl: - -maintainer-clean-tcl: - @[ -f ./tcl/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in tcl" ; \ - (cd tcl && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-itcl maintainer-clean-itcl -maybe-maintainer-clean-itcl: - -maintainer-clean-itcl: - @[ -f ./itcl/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in itcl" ; \ - (cd itcl && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-ld maintainer-clean-ld -maybe-maintainer-clean-ld: - -maintainer-clean-ld: - @[ -f ./ld/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in ld" ; \ - (cd ld && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-libgui maintainer-clean-libgui -maybe-maintainer-clean-libgui: - -maintainer-clean-libgui: - @[ -f ./libgui/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in libgui" ; \ - (cd libgui && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-libiberty maintainer-clean-libiberty -maybe-maintainer-clean-libiberty: - -maintainer-clean-libiberty: - @[ -f ./libiberty/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in libiberty" ; \ - (cd libiberty && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-libtool maintainer-clean-libtool -maybe-maintainer-clean-libtool: - -maintainer-clean-libtool: - @[ -f ./libtool/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in libtool" ; \ - (cd libtool && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-m4 maintainer-clean-m4 -maybe-maintainer-clean-m4: - -maintainer-clean-m4: - @[ -f ./m4/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in m4" ; \ - (cd m4 && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-make maintainer-clean-make -maybe-maintainer-clean-make: - -maintainer-clean-make: - @[ -f ./make/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in make" ; \ - (cd make && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-mmalloc maintainer-clean-mmalloc -maybe-maintainer-clean-mmalloc: - -maintainer-clean-mmalloc: - @[ -f ./mmalloc/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in mmalloc" ; \ - (cd mmalloc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-patch maintainer-clean-patch -maybe-maintainer-clean-patch: - -maintainer-clean-patch: - @[ -f ./patch/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in patch" ; \ - (cd patch && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-perl maintainer-clean-perl -maybe-maintainer-clean-perl: - -maintainer-clean-perl: - @[ -f ./perl/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in perl" ; \ - (cd perl && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-prms maintainer-clean-prms -maybe-maintainer-clean-prms: - -maintainer-clean-prms: - @[ -f ./prms/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in prms" ; \ - (cd prms && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-rcs maintainer-clean-rcs -maybe-maintainer-clean-rcs: - -maintainer-clean-rcs: - @[ -f ./rcs/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in rcs" ; \ - (cd rcs && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-readline maintainer-clean-readline -maybe-maintainer-clean-readline: - -maintainer-clean-readline: - @[ -f ./readline/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in readline" ; \ - (cd readline && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-release maintainer-clean-release -maybe-maintainer-clean-release: - -maintainer-clean-release: - @[ -f ./release/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in release" ; \ - (cd release && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-recode maintainer-clean-recode -maybe-maintainer-clean-recode: - -maintainer-clean-recode: - @[ -f ./recode/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in recode" ; \ - (cd recode && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-sed maintainer-clean-sed -maybe-maintainer-clean-sed: - -maintainer-clean-sed: - @[ -f ./sed/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in sed" ; \ - (cd sed && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-send-pr maintainer-clean-send-pr -maybe-maintainer-clean-send-pr: - -maintainer-clean-send-pr: - @[ -f ./send-pr/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in send-pr" ; \ - (cd send-pr && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-shellutils maintainer-clean-shellutils -maybe-maintainer-clean-shellutils: - -maintainer-clean-shellutils: - @[ -f ./shellutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in shellutils" ; \ - (cd shellutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-sid maintainer-clean-sid -maybe-maintainer-clean-sid: - -maintainer-clean-sid: - @[ -f ./sid/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in sid" ; \ - (cd sid && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-sim maintainer-clean-sim -maybe-maintainer-clean-sim: - -maintainer-clean-sim: - @[ -f ./sim/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in sim" ; \ - (cd sim && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-tar maintainer-clean-tar -maybe-maintainer-clean-tar: - -maintainer-clean-tar: - @[ -f ./tar/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in tar" ; \ - (cd tar && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-texinfo maintainer-clean-texinfo -maybe-maintainer-clean-texinfo: - -maintainer-clean-texinfo: - @[ -f ./texinfo/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in texinfo" ; \ - (cd texinfo && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-textutils maintainer-clean-textutils -maybe-maintainer-clean-textutils: - -maintainer-clean-textutils: - @[ -f ./textutils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in textutils" ; \ - (cd textutils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-time maintainer-clean-time -maybe-maintainer-clean-time: - -maintainer-clean-time: - @[ -f ./time/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in time" ; \ - (cd time && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-uudecode maintainer-clean-uudecode -maybe-maintainer-clean-uudecode: - -maintainer-clean-uudecode: - @[ -f ./uudecode/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in uudecode" ; \ - (cd uudecode && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-wdiff maintainer-clean-wdiff -maybe-maintainer-clean-wdiff: - -maintainer-clean-wdiff: - @[ -f ./wdiff/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in wdiff" ; \ - (cd wdiff && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-zip maintainer-clean-zip -maybe-maintainer-clean-zip: - -maintainer-clean-zip: - @[ -f ./zip/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in zip" ; \ - (cd zip && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-zlib maintainer-clean-zlib -maybe-maintainer-clean-zlib: - -maintainer-clean-zlib: - @[ -f ./zlib/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in zlib" ; \ - (cd zlib && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-gdb maintainer-clean-gdb -maybe-maintainer-clean-gdb: - -maintainer-clean-gdb: - @[ -f ./gdb/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in gdb" ; \ - (cd gdb && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-expect maintainer-clean-expect -maybe-maintainer-clean-expect: - -maintainer-clean-expect: - @[ -f ./expect/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in expect" ; \ - (cd expect && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-guile maintainer-clean-guile -maybe-maintainer-clean-guile: - -maintainer-clean-guile: - @[ -f ./guile/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in guile" ; \ - (cd guile && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-tk maintainer-clean-tk -maybe-maintainer-clean-tk: - -maintainer-clean-tk: - @[ -f ./tk/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in tk" ; \ - (cd tk && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-tix maintainer-clean-tix -maybe-maintainer-clean-tix: - -maintainer-clean-tix: - @[ -f ./tix/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in tix" ; \ - (cd tix && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-libtermcap maintainer-clean-libtermcap -maybe-maintainer-clean-libtermcap: - -# libtermcap doesn't support maintainer-clean. -maintainer-clean-libtermcap: - - -.PHONY: maybe-maintainer-clean-utils maintainer-clean-utils -maybe-maintainer-clean-utils: - -maintainer-clean-utils: - @[ -f ./utils/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing maintainer-clean in utils" ; \ - (cd utils && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - - -# Target modules. - -.PHONY: maybe-maintainer-clean-target-libstdc++-v3 maintainer-clean-target-libstdc++-v3 -maybe-maintainer-clean-target-libstdc++-v3: - -maintainer-clean-target-libstdc++-v3: - @[ -f $(TARGET_SUBDIR)/libstdc++-v3/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing maintainer-clean in $(TARGET_SUBDIR)/libstdc++-v3" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libstdc++-v3 && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-target-newlib maintainer-clean-target-newlib -maybe-maintainer-clean-target-newlib: - -maintainer-clean-target-newlib: - @[ -f $(TARGET_SUBDIR)/newlib/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing maintainer-clean in $(TARGET_SUBDIR)/newlib" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/newlib && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-target-libf2c maintainer-clean-target-libf2c -maybe-maintainer-clean-target-libf2c: - -maintainer-clean-target-libf2c: - @[ -f $(TARGET_SUBDIR)/libf2c/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing maintainer-clean in $(TARGET_SUBDIR)/libf2c" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libf2c && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-target-libobjc maintainer-clean-target-libobjc -maybe-maintainer-clean-target-libobjc: - -maintainer-clean-target-libobjc: - @[ -f $(TARGET_SUBDIR)/libobjc/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing maintainer-clean in $(TARGET_SUBDIR)/libobjc" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libobjc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-target-libtermcap maintainer-clean-target-libtermcap -maybe-maintainer-clean-target-libtermcap: - -# libtermcap doesn't support maintainer-clean. -maintainer-clean-target-libtermcap: - - -.PHONY: maybe-maintainer-clean-target-winsup maintainer-clean-target-winsup -maybe-maintainer-clean-target-winsup: - -maintainer-clean-target-winsup: - @[ -f $(TARGET_SUBDIR)/winsup/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing maintainer-clean in $(TARGET_SUBDIR)/winsup" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/winsup && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-target-libgloss maintainer-clean-target-libgloss -maybe-maintainer-clean-target-libgloss: - -maintainer-clean-target-libgloss: - @[ -f $(TARGET_SUBDIR)/libgloss/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing maintainer-clean in $(TARGET_SUBDIR)/libgloss" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libgloss && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-target-libiberty maintainer-clean-target-libiberty -maybe-maintainer-clean-target-libiberty: - -maintainer-clean-target-libiberty: - @[ -f $(TARGET_SUBDIR)/libiberty/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing maintainer-clean in $(TARGET_SUBDIR)/libiberty" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libiberty && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-target-gperf maintainer-clean-target-gperf -maybe-maintainer-clean-target-gperf: - -maintainer-clean-target-gperf: - @[ -f $(TARGET_SUBDIR)/gperf/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing maintainer-clean in $(TARGET_SUBDIR)/gperf" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/gperf && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-target-examples maintainer-clean-target-examples -maybe-maintainer-clean-target-examples: - -maintainer-clean-target-examples: - @[ -f $(TARGET_SUBDIR)/examples/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing maintainer-clean in $(TARGET_SUBDIR)/examples" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/examples && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-target-libffi maintainer-clean-target-libffi -maybe-maintainer-clean-target-libffi: - -maintainer-clean-target-libffi: - @[ -f $(TARGET_SUBDIR)/libffi/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing maintainer-clean in $(TARGET_SUBDIR)/libffi" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libffi && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-target-libjava maintainer-clean-target-libjava -maybe-maintainer-clean-target-libjava: - -maintainer-clean-target-libjava: - @[ -f $(TARGET_SUBDIR)/libjava/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing maintainer-clean in $(TARGET_SUBDIR)/libjava" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libjava && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-target-zlib maintainer-clean-target-zlib -maybe-maintainer-clean-target-zlib: - -maintainer-clean-target-zlib: - @[ -f $(TARGET_SUBDIR)/zlib/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing maintainer-clean in $(TARGET_SUBDIR)/zlib" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/zlib && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-target-boehm-gc maintainer-clean-target-boehm-gc -maybe-maintainer-clean-target-boehm-gc: - -maintainer-clean-target-boehm-gc: - @[ -f $(TARGET_SUBDIR)/boehm-gc/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing maintainer-clean in $(TARGET_SUBDIR)/boehm-gc" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/boehm-gc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-target-qthreads maintainer-clean-target-qthreads -maybe-maintainer-clean-target-qthreads: - -maintainer-clean-target-qthreads: - @[ -f $(TARGET_SUBDIR)/qthreads/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing maintainer-clean in $(TARGET_SUBDIR)/qthreads" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/qthreads && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-target-rda maintainer-clean-target-rda -maybe-maintainer-clean-target-rda: - -maintainer-clean-target-rda: - @[ -f $(TARGET_SUBDIR)/rda/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing maintainer-clean in $(TARGET_SUBDIR)/rda" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/rda && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - - -.PHONY: maybe-maintainer-clean-target-libada maintainer-clean-target-libada -maybe-maintainer-clean-target-libada: - -maintainer-clean-target-libada: - @[ -f $(TARGET_SUBDIR)/libada/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing maintainer-clean in $(TARGET_SUBDIR)/libada" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/libada && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - maintainer-clean) \ - || exit 1 - +maintainer-clean-target: maybe-maintainer-clean-target-libstdc++-v3 +maintainer-clean-target: maybe-maintainer-clean-target-libmudflap +maintainer-clean-target: maybe-maintainer-clean-target-libssp +maintainer-clean-target: maybe-maintainer-clean-target-libgcc-math +maintainer-clean-target: maybe-maintainer-clean-target-newlib +maintainer-clean-target: maybe-maintainer-clean-target-libgfortran +maintainer-clean-target: maybe-maintainer-clean-target-libobjc +maintainer-clean-target: maybe-maintainer-clean-target-libtermcap +maintainer-clean-target: maybe-maintainer-clean-target-winsup +maintainer-clean-target: maybe-maintainer-clean-target-libgloss +maintainer-clean-target: maybe-maintainer-clean-target-libiberty +maintainer-clean-target: maybe-maintainer-clean-target-gperf +maintainer-clean-target: maybe-maintainer-clean-target-examples +maintainer-clean-target: maybe-maintainer-clean-target-libffi +maintainer-clean-target: maybe-maintainer-clean-target-libjava +maintainer-clean-target: maybe-maintainer-clean-target-zlib +maintainer-clean-target: maybe-maintainer-clean-target-boehm-gc +maintainer-clean-target: maybe-maintainer-clean-target-qthreads +maintainer-clean-target: maybe-maintainer-clean-target-rda +maintainer-clean-target: maybe-maintainer-clean-target-libada +maintainer-clean-target: maybe-maintainer-clean-target-libgomp # Here are the targets which correspond to the do-X targets. -.PHONY: info installcheck dvi install-info +.PHONY: info installcheck dvi html install-info install-html .PHONY: clean distclean mostlyclean maintainer-clean realclean .PHONY: local-clean local-distclean local-maintainer-clean info: do-info installcheck: do-installcheck dvi: do-dvi +html: do-html # Make sure makeinfo is built before we do a `make info', if we're # in fact building texinfo. @@ -17448,16 +1960,21 @@ install-info: do-install-info dir.info $(INSTALL_DATA) dir.info $(DESTDIR)$(infodir)/dir.info ; \ else true ; fi +install-html: do-install-html + local-clean: -rm -f *.a TEMP errs core *.o *~ \#* TAGS *.E *.log local-distclean: -rm -f Makefile config.status config.cache mh-frag mt-frag - -rm -f multilib.out multilib.tmp maybedep.tmp serdep.tmp + -rm -f maybedep.tmp serdep.tmp -if [ "$(TARGET_SUBDIR)" != "." ]; then \ rm -rf $(TARGET_SUBDIR); \ else true; fi -rm -rf $(BUILD_SUBDIR) + -if [ "$(HOST_SUBDIR)" != "." ]; then \ + rm -rf $(HOST_SUBDIR); \ + else true; fi -rm -f texinfo/po/Makefile texinfo/po/Makefile.in texinfo/info/Makefile -rm -f texinfo/doc/Makefile texinfo/po/POTFILES -rmdir texinfo/doc texinfo/info texinfo/intl texinfo/lib 2>/dev/null @@ -17475,13 +1992,10 @@ maintainer-clean: local-maintainer-clean do-maintainer-clean local-clean maintainer-clean: local-distclean realclean: maintainer-clean -# Extra dependency for clean-target, owing to the mixed nature of gcc +# Extra dependency for clean-target, owing to the mixed nature of gcc. clean-target: clean-target-libgcc clean-target-libgcc: - test ! -d gcc/libgcc || \ - (cd gcc/libgcc && find . -type d -print) | \ - while read d; do rm -f gcc/$$d/libgcc.a || : ; done - -rm -rf gcc/libgcc + test ! -d gcc || (cd gcc && $(MAKE) $@) # Check target. @@ -17489,7 +2003,8 @@ clean-target-libgcc: check: do-check # Only include modules actually being configured and built. -do-check: maybe-check-gcc \ +.PHONY: check-host +check-host: \ maybe-check-ash \ maybe-check-autoconf \ maybe-check-automake \ @@ -17508,8 +2023,10 @@ do-check: maybe-check-gcc \ maybe-check-fileutils \ maybe-check-findutils \ maybe-check-find \ + maybe-check-fixincludes \ maybe-check-flex \ maybe-check-gas \ + maybe-check-gcc \ maybe-check-gawk \ maybe-check-gettext \ maybe-check-gnuserv \ @@ -17521,6 +2038,8 @@ do-check: maybe-check-gcc \ maybe-check-tcl \ maybe-check-itcl \ maybe-check-ld \ + maybe-check-libcpp \ + maybe-check-libdecnumber \ maybe-check-libgui \ maybe-check-libiberty \ maybe-check-libtool \ @@ -17551,12 +2070,18 @@ do-check: maybe-check-gcc \ maybe-check-expect \ maybe-check-guile \ maybe-check-tk \ - maybe-check-tix \ maybe-check-libtermcap \ maybe-check-utils \ + maybe-check-gnattools + +.PHONY: check-target +check-target: \ maybe-check-target-libstdc++-v3 \ + maybe-check-target-libmudflap \ + maybe-check-target-libssp \ + maybe-check-target-libgcc-math \ maybe-check-target-newlib \ - maybe-check-target-libf2c \ + maybe-check-target-libgfortran \ maybe-check-target-libobjc \ maybe-check-target-libtermcap \ maybe-check-target-winsup \ @@ -17570,7 +2095,14 @@ do-check: maybe-check-gcc \ maybe-check-target-boehm-gc \ maybe-check-target-qthreads \ maybe-check-target-rda \ - maybe-check-target-libada + maybe-check-target-libada \ + maybe-check-target-libgomp + +do-check: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(MAKE) $(RECURSE_FLAGS_TO_PASS) check-host check-target # Automated reporting of test results. @@ -17596,7 +2128,11 @@ mail-report-with-warnings.log: warning.log # Installation targets. .PHONY: install uninstall -install: installdirs install-host install-target +install: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(MAKE) $(RECURSE_FLAGS_TO_PASS) installdirs install-host install-target .PHONY: install-host-nogcc install-host-nogcc: \ @@ -17618,6 +2154,7 @@ install-host-nogcc: \ maybe-install-fileutils \ maybe-install-findutils \ maybe-install-find \ + maybe-install-fixincludes \ maybe-install-flex \ maybe-install-gas \ maybe-install-gawk \ @@ -17631,6 +2168,8 @@ install-host-nogcc: \ maybe-install-tcl \ maybe-install-itcl \ maybe-install-ld \ + maybe-install-libcpp \ + maybe-install-libdecnumber \ maybe-install-libgui \ maybe-install-libiberty \ maybe-install-libtool \ @@ -17661,12 +2200,12 @@ install-host-nogcc: \ maybe-install-expect \ maybe-install-guile \ maybe-install-tk \ - maybe-install-tix \ maybe-install-libtermcap \ - maybe-install-utils + maybe-install-utils \ + maybe-install-gnattools .PHONY: install-host -install-host: maybe-install-gcc \ +install-host: \ maybe-install-ash \ maybe-install-autoconf \ maybe-install-automake \ @@ -17685,8 +2224,10 @@ install-host: maybe-install-gcc \ maybe-install-fileutils \ maybe-install-findutils \ maybe-install-find \ + maybe-install-fixincludes \ maybe-install-flex \ maybe-install-gas \ + maybe-install-gcc \ maybe-install-gawk \ maybe-install-gettext \ maybe-install-gnuserv \ @@ -17698,6 +2239,8 @@ install-host: maybe-install-gcc \ maybe-install-tcl \ maybe-install-itcl \ maybe-install-ld \ + maybe-install-libcpp \ + maybe-install-libdecnumber \ maybe-install-libgui \ maybe-install-libiberty \ maybe-install-libtool \ @@ -17728,15 +2271,18 @@ install-host: maybe-install-gcc \ maybe-install-expect \ maybe-install-guile \ maybe-install-tk \ - maybe-install-tix \ maybe-install-libtermcap \ - maybe-install-utils + maybe-install-utils \ + maybe-install-gnattools .PHONY: install-target install-target: \ maybe-install-target-libstdc++-v3 \ + maybe-install-target-libmudflap \ + maybe-install-target-libssp \ + maybe-install-target-libgcc-math \ maybe-install-target-newlib \ - maybe-install-target-libf2c \ + maybe-install-target-libgfortran \ maybe-install-target-libobjc \ maybe-install-target-libtermcap \ maybe-install-target-winsup \ @@ -17750,7 +2296,8 @@ install-target: \ maybe-install-target-boehm-gc \ maybe-install-target-qthreads \ maybe-install-target-rda \ - maybe-install-target-libada + maybe-install-target-libada \ + maybe-install-target-libgomp uninstall: @echo "the uninstall target is not supported in this tree" @@ -17759,7 +2306,8 @@ uninstall: install.all: install-no-fixedincludes @if [ -f ./gcc/Makefile ] ; then \ r=`${PWD_COMMAND}` ; export r ; \ - $(SET_LIB_PATH) \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ (cd ./gcc && \ $(MAKE) $(FLAGS_TO_PASS) install-headers) ; \ else \ @@ -17802,4413 +2350,28720 @@ etags tags: TAGS # built are. TAGS: do-TAGS +# ------------------------------------ +# Macros for configure and all targets +# ------------------------------------ + + + + + # -------------------------------------- # Modules which run on the build machine # -------------------------------------- + .PHONY: configure-build-libiberty maybe-configure-build-libiberty maybe-configure-build-libiberty: -configure-build-libiberty: - @test ! -f $(BUILD_SUBDIR)/libiberty/Makefile || exit 0; \ - $(SHELL) $(srcdir)/mkinstalldirs $(BUILD_SUBDIR)/libiberty ; \ - r=`${PWD_COMMAND}`; export r; \ +@if build-libiberty +maybe-configure-build-libiberty: configure-build-libiberty +configure-build-libiberty: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - AR="$(AR_FOR_BUILD)"; export AR; \ - AS="$(AS_FOR_BUILD)"; export AS; \ - CC="$(CC_FOR_BUILD)"; export CC; \ - CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX_FOR_BUILD)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \ - GCJ="$(GCJ_FOR_BUILD)"; export GCJ; \ - DLLTOOL="$(DLLTOOL_FOR_BUILD)"; export DLLTOOL; \ - LD="$(LD_FOR_BUILD)"; export LD; \ - LDFLAGS="$(LDFLAGS_FOR_BUILD)"; export LDFLAGS; \ - NM="$(NM_FOR_BUILD)"; export NM; \ - RANLIB="$(RANLIB_FOR_BUILD)"; export RANLIB; \ - WINDRES="$(WINDRES_FOR_BUILD)"; export WINDRES; \ + test ! -f $(BUILD_SUBDIR)/libiberty/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(BUILD_SUBDIR)/libiberty ; \ + $(BUILD_EXPORTS) \ echo Configuring in $(BUILD_SUBDIR)/libiberty; \ cd "$(BUILD_SUBDIR)/libiberty" || exit 1; \ case $(srcdir) in \ - /* | [A-Za-z]:[\\/]*) \ - topdir=$(srcdir) ;; \ - *) \ - case "$(BUILD_SUBDIR)" in \ - .) topdir="../$(srcdir)" ;; \ - *) topdir="../../$(srcdir)" ;; \ - esac ;; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(BUILD_SUBDIR)/libiberty/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ - if [ "$(srcdir)" = "." ] ; then \ - if [ "$(BUILD_SUBDIR)" != "." ] ; then \ - if $(SHELL) $$s/symlink-tree $${topdir}/libiberty "no-such-file" ; then \ - if [ -f Makefile ]; then \ - if $(MAKE) distclean; then \ - true; \ - else \ - exit 1; \ - fi; \ - else \ - true; \ - fi; \ - else \ - exit 1; \ - fi; \ - else \ - true; \ - fi; \ - srcdiroption="--srcdir=."; \ - libsrcdir="."; \ - else \ - srcdiroption="--srcdir=$${topdir}/libiberty"; \ - libsrcdir="$$s/libiberty"; \ - fi; \ + srcdiroption="--srcdir=$${topdir}/libiberty"; \ + libsrcdir="$$s/libiberty"; \ rm -f no-such-file || : ; \ CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \ - $(BUILD_CONFIGARGS) $${srcdiroption} \ - --with-build-subdir="$(BUILD_SUBDIR)" \ + $(BUILD_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif build-libiberty + + + + .PHONY: all-build-libiberty maybe-all-build-libiberty maybe-all-build-libiberty: +@if build-libiberty +TARGET-build-libiberty=all +maybe-all-build-libiberty: all-build-libiberty all-build-libiberty: configure-build-libiberty + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - (cd $(BUILD_SUBDIR)/libiberty && $(MAKE) all) + $(BUILD_EXPORTS) \ + (cd $(BUILD_SUBDIR)/libiberty && \ + $(MAKE) $(TARGET-build-libiberty)) +@endif build-libiberty + + + + + +.PHONY: configure-build-bison maybe-configure-build-bison +maybe-configure-build-bison: +@if build-bison +maybe-configure-build-bison: configure-build-bison +configure-build-bison: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(BUILD_SUBDIR)/bison/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(BUILD_SUBDIR)/bison ; \ + $(BUILD_EXPORTS) \ + echo Configuring in $(BUILD_SUBDIR)/bison; \ + cd "$(BUILD_SUBDIR)/bison" || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(BUILD_SUBDIR)/bison/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/bison"; \ + libsrcdir="$$s/bison"; \ + rm -f no-such-file || : ; \ + CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \ + $(BUILD_CONFIGARGS) $${srcdiroption} \ + || exit 1 +@endif build-bison + + + + + +.PHONY: all-build-bison maybe-all-build-bison +maybe-all-build-bison: +@if build-bison +TARGET-build-bison=all +maybe-all-build-bison: all-build-bison +all-build-bison: configure-build-bison + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(BUILD_EXPORTS) \ + (cd $(BUILD_SUBDIR)/bison && \ + $(MAKE) $(TARGET-build-bison)) +@endif build-bison + + + + + +.PHONY: configure-build-byacc maybe-configure-build-byacc +maybe-configure-build-byacc: +@if build-byacc +maybe-configure-build-byacc: configure-build-byacc +configure-build-byacc: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(BUILD_SUBDIR)/byacc/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(BUILD_SUBDIR)/byacc ; \ + $(BUILD_EXPORTS) \ + echo Configuring in $(BUILD_SUBDIR)/byacc; \ + cd "$(BUILD_SUBDIR)/byacc" || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(BUILD_SUBDIR)/byacc/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/byacc"; \ + libsrcdir="$$s/byacc"; \ + rm -f no-such-file || : ; \ + CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \ + $(BUILD_CONFIGARGS) $${srcdiroption} \ + || exit 1 +@endif build-byacc + + + + + +.PHONY: all-build-byacc maybe-all-build-byacc +maybe-all-build-byacc: +@if build-byacc +TARGET-build-byacc=all +maybe-all-build-byacc: all-build-byacc +all-build-byacc: configure-build-byacc + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(BUILD_EXPORTS) \ + (cd $(BUILD_SUBDIR)/byacc && \ + $(MAKE) $(TARGET-build-byacc)) +@endif build-byacc + + + + + +.PHONY: configure-build-flex maybe-configure-build-flex +maybe-configure-build-flex: +@if build-flex +maybe-configure-build-flex: configure-build-flex +configure-build-flex: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(BUILD_SUBDIR)/flex/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(BUILD_SUBDIR)/flex ; \ + $(BUILD_EXPORTS) \ + echo Configuring in $(BUILD_SUBDIR)/flex; \ + cd "$(BUILD_SUBDIR)/flex" || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(BUILD_SUBDIR)/flex/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/flex"; \ + libsrcdir="$$s/flex"; \ + rm -f no-such-file || : ; \ + CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \ + $(BUILD_CONFIGARGS) $${srcdiroption} \ + || exit 1 +@endif build-flex + + + + + +.PHONY: all-build-flex maybe-all-build-flex +maybe-all-build-flex: +@if build-flex +TARGET-build-flex=all +maybe-all-build-flex: all-build-flex +all-build-flex: configure-build-flex + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(BUILD_EXPORTS) \ + (cd $(BUILD_SUBDIR)/flex && \ + $(MAKE) $(TARGET-build-flex)) +@endif build-flex + + + + + +.PHONY: configure-build-m4 maybe-configure-build-m4 +maybe-configure-build-m4: +@if build-m4 +maybe-configure-build-m4: configure-build-m4 +configure-build-m4: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(BUILD_SUBDIR)/m4/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(BUILD_SUBDIR)/m4 ; \ + $(BUILD_EXPORTS) \ + echo Configuring in $(BUILD_SUBDIR)/m4; \ + cd "$(BUILD_SUBDIR)/m4" || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(BUILD_SUBDIR)/m4/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/m4"; \ + libsrcdir="$$s/m4"; \ + rm -f no-such-file || : ; \ + CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \ + $(BUILD_CONFIGARGS) $${srcdiroption} \ + || exit 1 +@endif build-m4 + + + + + +.PHONY: all-build-m4 maybe-all-build-m4 +maybe-all-build-m4: +@if build-m4 +TARGET-build-m4=all +maybe-all-build-m4: all-build-m4 +all-build-m4: configure-build-m4 + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(BUILD_EXPORTS) \ + (cd $(BUILD_SUBDIR)/m4 && \ + $(MAKE) $(TARGET-build-m4)) +@endif build-m4 + + + + + +.PHONY: configure-build-texinfo maybe-configure-build-texinfo +maybe-configure-build-texinfo: +@if build-texinfo +maybe-configure-build-texinfo: configure-build-texinfo +configure-build-texinfo: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(BUILD_SUBDIR)/texinfo/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(BUILD_SUBDIR)/texinfo ; \ + $(BUILD_EXPORTS) \ + echo Configuring in $(BUILD_SUBDIR)/texinfo; \ + cd "$(BUILD_SUBDIR)/texinfo" || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(BUILD_SUBDIR)/texinfo/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/texinfo"; \ + libsrcdir="$$s/texinfo"; \ + rm -f no-such-file || : ; \ + CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \ + $(BUILD_CONFIGARGS) $${srcdiroption} \ + || exit 1 +@endif build-texinfo + + + + + +.PHONY: all-build-texinfo maybe-all-build-texinfo +maybe-all-build-texinfo: +@if build-texinfo +TARGET-build-texinfo=all +maybe-all-build-texinfo: all-build-texinfo +all-build-texinfo: configure-build-texinfo + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(BUILD_EXPORTS) \ + (cd $(BUILD_SUBDIR)/texinfo && \ + $(MAKE) $(TARGET-build-texinfo)) +@endif build-texinfo + + + + + +.PHONY: configure-build-fixincludes maybe-configure-build-fixincludes +maybe-configure-build-fixincludes: +@if build-fixincludes +maybe-configure-build-fixincludes: configure-build-fixincludes +configure-build-fixincludes: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(BUILD_SUBDIR)/fixincludes/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(BUILD_SUBDIR)/fixincludes ; \ + $(BUILD_EXPORTS) \ + echo Configuring in $(BUILD_SUBDIR)/fixincludes; \ + cd "$(BUILD_SUBDIR)/fixincludes" || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(BUILD_SUBDIR)/fixincludes/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/fixincludes"; \ + libsrcdir="$$s/fixincludes"; \ + rm -f no-such-file || : ; \ + CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \ + $(BUILD_CONFIGARGS) $${srcdiroption} \ + || exit 1 +@endif build-fixincludes + + + + + +.PHONY: all-build-fixincludes maybe-all-build-fixincludes +maybe-all-build-fixincludes: +@if build-fixincludes +TARGET-build-fixincludes=all +maybe-all-build-fixincludes: all-build-fixincludes +all-build-fixincludes: configure-build-fixincludes + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(BUILD_EXPORTS) \ + (cd $(BUILD_SUBDIR)/fixincludes && \ + $(MAKE) $(TARGET-build-fixincludes)) +@endif build-fixincludes + + + # -------------------------------------- # Modules which run on the host machine # -------------------------------------- + .PHONY: configure-ash maybe-configure-ash maybe-configure-ash: -configure-ash: - @test ! -f ash/Makefile || exit 0; \ - [ -d ash ] || mkdir ash; \ - r=`${PWD_COMMAND}`; export r; \ +@if ash +maybe-configure-ash: configure-ash +configure-ash: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in ash; \ - cd ash || exit 1; \ + test ! -f $(HOST_SUBDIR)/ash/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/ash ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/ash; \ + cd "$(HOST_SUBDIR)/ash" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/ash"; \ - libsrcdir="$$s/ash";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/ash"; \ - libsrcdir="$$s/ash";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/ash/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/ash"; \ + libsrcdir="$$s/ash"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif ash + + + + .PHONY: all-ash maybe-all-ash maybe-all-ash: +@if ash +TARGET-ash=all +maybe-all-ash: all-ash all-ash: configure-ash + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd ash && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/ash && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-ash)) +@endif ash + + + .PHONY: check-ash maybe-check-ash maybe-check-ash: +@if ash +maybe-check-ash: check-ash check-ash: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd ash && $(MAKE) $(FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/ash && \ + $(MAKE) $(FLAGS_TO_PASS) check) +@endif ash .PHONY: install-ash maybe-install-ash maybe-install-ash: +@if ash +maybe-install-ash: install-ash install-ash: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd ash && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/ash && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif ash + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-ash info-ash +maybe-info-ash: +@if ash +maybe-info-ash: info-ash + +info-ash: \ + configure-ash + @: $(MAKE); $(unstage) + @[ -f ./ash/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in ash" ; \ + (cd $(HOST_SUBDIR)/ash && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif ash + +.PHONY: maybe-dvi-ash dvi-ash +maybe-dvi-ash: +@if ash +maybe-dvi-ash: dvi-ash + +dvi-ash: \ + configure-ash + @: $(MAKE); $(unstage) + @[ -f ./ash/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in ash" ; \ + (cd $(HOST_SUBDIR)/ash && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif ash + +.PHONY: maybe-html-ash html-ash +maybe-html-ash: +@if ash +maybe-html-ash: html-ash + +html-ash: \ + configure-ash + @: $(MAKE); $(unstage) + @[ -f ./ash/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in ash" ; \ + (cd $(HOST_SUBDIR)/ash && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif ash + +.PHONY: maybe-TAGS-ash TAGS-ash +maybe-TAGS-ash: +@if ash +maybe-TAGS-ash: TAGS-ash + +TAGS-ash: \ + configure-ash + @: $(MAKE); $(unstage) + @[ -f ./ash/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in ash" ; \ + (cd $(HOST_SUBDIR)/ash && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif ash + +.PHONY: maybe-install-info-ash install-info-ash +maybe-install-info-ash: +@if ash +maybe-install-info-ash: install-info-ash + +install-info-ash: \ + configure-ash \ + info-ash + @: $(MAKE); $(unstage) + @[ -f ./ash/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in ash" ; \ + (cd $(HOST_SUBDIR)/ash && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif ash + +.PHONY: maybe-install-html-ash install-html-ash +maybe-install-html-ash: +@if ash +maybe-install-html-ash: install-html-ash + +install-html-ash: \ + configure-ash \ + html-ash + @: $(MAKE); $(unstage) + @[ -f ./ash/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in ash" ; \ + (cd $(HOST_SUBDIR)/ash && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif ash + +.PHONY: maybe-installcheck-ash installcheck-ash +maybe-installcheck-ash: +@if ash +maybe-installcheck-ash: installcheck-ash + +installcheck-ash: \ + configure-ash + @: $(MAKE); $(unstage) + @[ -f ./ash/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in ash" ; \ + (cd $(HOST_SUBDIR)/ash && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif ash + +.PHONY: maybe-mostlyclean-ash mostlyclean-ash +maybe-mostlyclean-ash: +@if ash +maybe-mostlyclean-ash: mostlyclean-ash + +mostlyclean-ash: + @: $(MAKE); $(unstage) + @[ -f ./ash/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in ash" ; \ + (cd $(HOST_SUBDIR)/ash && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif ash + +.PHONY: maybe-clean-ash clean-ash +maybe-clean-ash: +@if ash +maybe-clean-ash: clean-ash + +clean-ash: + @: $(MAKE); $(unstage) + @[ -f ./ash/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in ash" ; \ + (cd $(HOST_SUBDIR)/ash && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif ash + +.PHONY: maybe-distclean-ash distclean-ash +maybe-distclean-ash: +@if ash +maybe-distclean-ash: distclean-ash + +distclean-ash: + @: $(MAKE); $(unstage) + @[ -f ./ash/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in ash" ; \ + (cd $(HOST_SUBDIR)/ash && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif ash + +.PHONY: maybe-maintainer-clean-ash maintainer-clean-ash +maybe-maintainer-clean-ash: +@if ash +maybe-maintainer-clean-ash: maintainer-clean-ash + +maintainer-clean-ash: + @: $(MAKE); $(unstage) + @[ -f ./ash/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in ash" ; \ + (cd $(HOST_SUBDIR)/ash && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif ash + .PHONY: configure-autoconf maybe-configure-autoconf maybe-configure-autoconf: -configure-autoconf: - @test ! -f autoconf/Makefile || exit 0; \ - [ -d autoconf ] || mkdir autoconf; \ - r=`${PWD_COMMAND}`; export r; \ +@if autoconf +maybe-configure-autoconf: configure-autoconf +configure-autoconf: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in autoconf; \ - cd autoconf || exit 1; \ + test ! -f $(HOST_SUBDIR)/autoconf/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/autoconf ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/autoconf; \ + cd "$(HOST_SUBDIR)/autoconf" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/autoconf"; \ - libsrcdir="$$s/autoconf";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/autoconf"; \ - libsrcdir="$$s/autoconf";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/autoconf/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/autoconf"; \ + libsrcdir="$$s/autoconf"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif autoconf + + + + .PHONY: all-autoconf maybe-all-autoconf maybe-all-autoconf: +@if autoconf +TARGET-autoconf=all +maybe-all-autoconf: all-autoconf all-autoconf: configure-autoconf + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd autoconf && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/autoconf && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-autoconf)) +@endif autoconf + + + .PHONY: check-autoconf maybe-check-autoconf maybe-check-autoconf: +@if autoconf +maybe-check-autoconf: check-autoconf check-autoconf: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd autoconf && $(MAKE) $(FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/autoconf && \ + $(MAKE) $(FLAGS_TO_PASS) check) +@endif autoconf .PHONY: install-autoconf maybe-install-autoconf maybe-install-autoconf: +@if autoconf +maybe-install-autoconf: install-autoconf install-autoconf: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd autoconf && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/autoconf && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif autoconf + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-autoconf info-autoconf +maybe-info-autoconf: +@if autoconf +maybe-info-autoconf: info-autoconf + +info-autoconf: \ + configure-autoconf + @: $(MAKE); $(unstage) + @[ -f ./autoconf/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in autoconf" ; \ + (cd $(HOST_SUBDIR)/autoconf && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif autoconf + +.PHONY: maybe-dvi-autoconf dvi-autoconf +maybe-dvi-autoconf: +@if autoconf +maybe-dvi-autoconf: dvi-autoconf + +dvi-autoconf: \ + configure-autoconf + @: $(MAKE); $(unstage) + @[ -f ./autoconf/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in autoconf" ; \ + (cd $(HOST_SUBDIR)/autoconf && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif autoconf + +.PHONY: maybe-html-autoconf html-autoconf +maybe-html-autoconf: +@if autoconf +maybe-html-autoconf: html-autoconf + +html-autoconf: \ + configure-autoconf + @: $(MAKE); $(unstage) + @[ -f ./autoconf/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in autoconf" ; \ + (cd $(HOST_SUBDIR)/autoconf && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif autoconf + +.PHONY: maybe-TAGS-autoconf TAGS-autoconf +maybe-TAGS-autoconf: +@if autoconf +maybe-TAGS-autoconf: TAGS-autoconf + +TAGS-autoconf: \ + configure-autoconf + @: $(MAKE); $(unstage) + @[ -f ./autoconf/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in autoconf" ; \ + (cd $(HOST_SUBDIR)/autoconf && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif autoconf + +.PHONY: maybe-install-info-autoconf install-info-autoconf +maybe-install-info-autoconf: +@if autoconf +maybe-install-info-autoconf: install-info-autoconf + +install-info-autoconf: \ + configure-autoconf \ + info-autoconf + @: $(MAKE); $(unstage) + @[ -f ./autoconf/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in autoconf" ; \ + (cd $(HOST_SUBDIR)/autoconf && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif autoconf + +.PHONY: maybe-install-html-autoconf install-html-autoconf +maybe-install-html-autoconf: +@if autoconf +maybe-install-html-autoconf: install-html-autoconf + +install-html-autoconf: \ + configure-autoconf \ + html-autoconf + @: $(MAKE); $(unstage) + @[ -f ./autoconf/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in autoconf" ; \ + (cd $(HOST_SUBDIR)/autoconf && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif autoconf + +.PHONY: maybe-installcheck-autoconf installcheck-autoconf +maybe-installcheck-autoconf: +@if autoconf +maybe-installcheck-autoconf: installcheck-autoconf + +installcheck-autoconf: \ + configure-autoconf + @: $(MAKE); $(unstage) + @[ -f ./autoconf/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in autoconf" ; \ + (cd $(HOST_SUBDIR)/autoconf && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif autoconf + +.PHONY: maybe-mostlyclean-autoconf mostlyclean-autoconf +maybe-mostlyclean-autoconf: +@if autoconf +maybe-mostlyclean-autoconf: mostlyclean-autoconf + +mostlyclean-autoconf: + @: $(MAKE); $(unstage) + @[ -f ./autoconf/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in autoconf" ; \ + (cd $(HOST_SUBDIR)/autoconf && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif autoconf + +.PHONY: maybe-clean-autoconf clean-autoconf +maybe-clean-autoconf: +@if autoconf +maybe-clean-autoconf: clean-autoconf + +clean-autoconf: + @: $(MAKE); $(unstage) + @[ -f ./autoconf/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in autoconf" ; \ + (cd $(HOST_SUBDIR)/autoconf && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif autoconf + +.PHONY: maybe-distclean-autoconf distclean-autoconf +maybe-distclean-autoconf: +@if autoconf +maybe-distclean-autoconf: distclean-autoconf + +distclean-autoconf: + @: $(MAKE); $(unstage) + @[ -f ./autoconf/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in autoconf" ; \ + (cd $(HOST_SUBDIR)/autoconf && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif autoconf + +.PHONY: maybe-maintainer-clean-autoconf maintainer-clean-autoconf +maybe-maintainer-clean-autoconf: +@if autoconf +maybe-maintainer-clean-autoconf: maintainer-clean-autoconf + +maintainer-clean-autoconf: + @: $(MAKE); $(unstage) + @[ -f ./autoconf/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in autoconf" ; \ + (cd $(HOST_SUBDIR)/autoconf && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif autoconf + .PHONY: configure-automake maybe-configure-automake maybe-configure-automake: -configure-automake: - @test ! -f automake/Makefile || exit 0; \ - [ -d automake ] || mkdir automake; \ - r=`${PWD_COMMAND}`; export r; \ +@if automake +maybe-configure-automake: configure-automake +configure-automake: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in automake; \ - cd automake || exit 1; \ + test ! -f $(HOST_SUBDIR)/automake/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/automake ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/automake; \ + cd "$(HOST_SUBDIR)/automake" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/automake"; \ - libsrcdir="$$s/automake";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/automake"; \ - libsrcdir="$$s/automake";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/automake/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/automake"; \ + libsrcdir="$$s/automake"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif automake + + + + .PHONY: all-automake maybe-all-automake maybe-all-automake: +@if automake +TARGET-automake=all +maybe-all-automake: all-automake all-automake: configure-automake + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd automake && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/automake && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-automake)) +@endif automake + + + .PHONY: check-automake maybe-check-automake maybe-check-automake: +@if automake +maybe-check-automake: check-automake check-automake: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd automake && $(MAKE) $(FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/automake && \ + $(MAKE) $(FLAGS_TO_PASS) check) +@endif automake .PHONY: install-automake maybe-install-automake maybe-install-automake: +@if automake +maybe-install-automake: install-automake install-automake: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd automake && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/automake && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif automake + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-automake info-automake +maybe-info-automake: +@if automake +maybe-info-automake: info-automake + +info-automake: \ + configure-automake + @: $(MAKE); $(unstage) + @[ -f ./automake/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in automake" ; \ + (cd $(HOST_SUBDIR)/automake && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif automake + +.PHONY: maybe-dvi-automake dvi-automake +maybe-dvi-automake: +@if automake +maybe-dvi-automake: dvi-automake + +dvi-automake: \ + configure-automake + @: $(MAKE); $(unstage) + @[ -f ./automake/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in automake" ; \ + (cd $(HOST_SUBDIR)/automake && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif automake + +.PHONY: maybe-html-automake html-automake +maybe-html-automake: +@if automake +maybe-html-automake: html-automake + +html-automake: \ + configure-automake + @: $(MAKE); $(unstage) + @[ -f ./automake/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in automake" ; \ + (cd $(HOST_SUBDIR)/automake && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif automake + +.PHONY: maybe-TAGS-automake TAGS-automake +maybe-TAGS-automake: +@if automake +maybe-TAGS-automake: TAGS-automake + +TAGS-automake: \ + configure-automake + @: $(MAKE); $(unstage) + @[ -f ./automake/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in automake" ; \ + (cd $(HOST_SUBDIR)/automake && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif automake + +.PHONY: maybe-install-info-automake install-info-automake +maybe-install-info-automake: +@if automake +maybe-install-info-automake: install-info-automake + +install-info-automake: \ + configure-automake \ + info-automake + @: $(MAKE); $(unstage) + @[ -f ./automake/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in automake" ; \ + (cd $(HOST_SUBDIR)/automake && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif automake + +.PHONY: maybe-install-html-automake install-html-automake +maybe-install-html-automake: +@if automake +maybe-install-html-automake: install-html-automake + +install-html-automake: \ + configure-automake \ + html-automake + @: $(MAKE); $(unstage) + @[ -f ./automake/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in automake" ; \ + (cd $(HOST_SUBDIR)/automake && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif automake + +.PHONY: maybe-installcheck-automake installcheck-automake +maybe-installcheck-automake: +@if automake +maybe-installcheck-automake: installcheck-automake + +installcheck-automake: \ + configure-automake + @: $(MAKE); $(unstage) + @[ -f ./automake/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in automake" ; \ + (cd $(HOST_SUBDIR)/automake && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif automake + +.PHONY: maybe-mostlyclean-automake mostlyclean-automake +maybe-mostlyclean-automake: +@if automake +maybe-mostlyclean-automake: mostlyclean-automake + +mostlyclean-automake: + @: $(MAKE); $(unstage) + @[ -f ./automake/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in automake" ; \ + (cd $(HOST_SUBDIR)/automake && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif automake + +.PHONY: maybe-clean-automake clean-automake +maybe-clean-automake: +@if automake +maybe-clean-automake: clean-automake + +clean-automake: + @: $(MAKE); $(unstage) + @[ -f ./automake/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in automake" ; \ + (cd $(HOST_SUBDIR)/automake && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif automake + +.PHONY: maybe-distclean-automake distclean-automake +maybe-distclean-automake: +@if automake +maybe-distclean-automake: distclean-automake + +distclean-automake: + @: $(MAKE); $(unstage) + @[ -f ./automake/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in automake" ; \ + (cd $(HOST_SUBDIR)/automake && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif automake + +.PHONY: maybe-maintainer-clean-automake maintainer-clean-automake +maybe-maintainer-clean-automake: +@if automake +maybe-maintainer-clean-automake: maintainer-clean-automake + +maintainer-clean-automake: + @: $(MAKE); $(unstage) + @[ -f ./automake/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in automake" ; \ + (cd $(HOST_SUBDIR)/automake && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif automake + .PHONY: configure-bash maybe-configure-bash maybe-configure-bash: -configure-bash: - @test ! -f bash/Makefile || exit 0; \ - [ -d bash ] || mkdir bash; \ - r=`${PWD_COMMAND}`; export r; \ +@if bash +maybe-configure-bash: configure-bash +configure-bash: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in bash; \ - cd bash || exit 1; \ + test ! -f $(HOST_SUBDIR)/bash/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/bash ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/bash; \ + cd "$(HOST_SUBDIR)/bash" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/bash"; \ - libsrcdir="$$s/bash";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/bash"; \ - libsrcdir="$$s/bash";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/bash/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/bash"; \ + libsrcdir="$$s/bash"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif bash + + + + .PHONY: all-bash maybe-all-bash maybe-all-bash: +@if bash +TARGET-bash=all +maybe-all-bash: all-bash all-bash: configure-bash + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd bash && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/bash && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-bash)) +@endif bash + + + .PHONY: check-bash maybe-check-bash maybe-check-bash: +@if bash +maybe-check-bash: check-bash check-bash: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd bash && $(MAKE) $(FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/bash && \ + $(MAKE) $(FLAGS_TO_PASS) check) +@endif bash .PHONY: install-bash maybe-install-bash maybe-install-bash: +@if bash +maybe-install-bash: install-bash install-bash: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd bash && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/bash && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif bash + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-bash info-bash +maybe-info-bash: +@if bash +maybe-info-bash: info-bash + +info-bash: \ + configure-bash + @: $(MAKE); $(unstage) + @[ -f ./bash/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in bash" ; \ + (cd $(HOST_SUBDIR)/bash && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif bash + +.PHONY: maybe-dvi-bash dvi-bash +maybe-dvi-bash: +@if bash +maybe-dvi-bash: dvi-bash + +dvi-bash: \ + configure-bash + @: $(MAKE); $(unstage) + @[ -f ./bash/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in bash" ; \ + (cd $(HOST_SUBDIR)/bash && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif bash + +.PHONY: maybe-html-bash html-bash +maybe-html-bash: +@if bash +maybe-html-bash: html-bash + +html-bash: \ + configure-bash + @: $(MAKE); $(unstage) + @[ -f ./bash/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in bash" ; \ + (cd $(HOST_SUBDIR)/bash && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif bash + +.PHONY: maybe-TAGS-bash TAGS-bash +maybe-TAGS-bash: +@if bash +maybe-TAGS-bash: TAGS-bash + +TAGS-bash: \ + configure-bash + @: $(MAKE); $(unstage) + @[ -f ./bash/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in bash" ; \ + (cd $(HOST_SUBDIR)/bash && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif bash + +.PHONY: maybe-install-info-bash install-info-bash +maybe-install-info-bash: +@if bash +maybe-install-info-bash: install-info-bash + +install-info-bash: \ + configure-bash \ + info-bash + @: $(MAKE); $(unstage) + @[ -f ./bash/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in bash" ; \ + (cd $(HOST_SUBDIR)/bash && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif bash + +.PHONY: maybe-install-html-bash install-html-bash +maybe-install-html-bash: +@if bash +maybe-install-html-bash: install-html-bash + +install-html-bash: \ + configure-bash \ + html-bash + @: $(MAKE); $(unstage) + @[ -f ./bash/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in bash" ; \ + (cd $(HOST_SUBDIR)/bash && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif bash + +.PHONY: maybe-installcheck-bash installcheck-bash +maybe-installcheck-bash: +@if bash +maybe-installcheck-bash: installcheck-bash + +installcheck-bash: \ + configure-bash + @: $(MAKE); $(unstage) + @[ -f ./bash/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in bash" ; \ + (cd $(HOST_SUBDIR)/bash && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif bash + +.PHONY: maybe-mostlyclean-bash mostlyclean-bash +maybe-mostlyclean-bash: +@if bash +maybe-mostlyclean-bash: mostlyclean-bash + +mostlyclean-bash: + @: $(MAKE); $(unstage) + @[ -f ./bash/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in bash" ; \ + (cd $(HOST_SUBDIR)/bash && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif bash + +.PHONY: maybe-clean-bash clean-bash +maybe-clean-bash: +@if bash +maybe-clean-bash: clean-bash + +clean-bash: + @: $(MAKE); $(unstage) + @[ -f ./bash/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in bash" ; \ + (cd $(HOST_SUBDIR)/bash && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif bash + +.PHONY: maybe-distclean-bash distclean-bash +maybe-distclean-bash: +@if bash +maybe-distclean-bash: distclean-bash + +distclean-bash: + @: $(MAKE); $(unstage) + @[ -f ./bash/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in bash" ; \ + (cd $(HOST_SUBDIR)/bash && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif bash + +.PHONY: maybe-maintainer-clean-bash maintainer-clean-bash +maybe-maintainer-clean-bash: +@if bash +maybe-maintainer-clean-bash: maintainer-clean-bash + +maintainer-clean-bash: + @: $(MAKE); $(unstage) + @[ -f ./bash/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in bash" ; \ + (cd $(HOST_SUBDIR)/bash && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif bash + .PHONY: configure-bfd maybe-configure-bfd maybe-configure-bfd: -configure-bfd: - @test ! -f bfd/Makefile || exit 0; \ - [ -d bfd ] || mkdir bfd; \ - r=`${PWD_COMMAND}`; export r; \ +@if bfd +maybe-configure-bfd: configure-bfd +configure-bfd: +@endif bfd +@if bfd-bootstrap + @if test -f stage_last; then $(unstage); else $(MAKE) stage1-start; fi +@endif bfd-bootstrap +@if bfd + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in bfd; \ - cd bfd || exit 1; \ + test ! -f $(HOST_SUBDIR)/bfd/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/bfd ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/bfd; \ + cd "$(HOST_SUBDIR)/bfd" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/bfd"; \ - libsrcdir="$$s/bfd";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/bfd"; \ - libsrcdir="$$s/bfd";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/bfd/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/bfd"; \ + libsrcdir="$$s/bfd"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + || exit 1 +@endif bfd + + + +.PHONY: configure-stage1-bfd maybe-configure-stage1-bfd +maybe-configure-stage1-bfd: +@if bfd-bootstrap +maybe-configure-stage1-bfd: configure-stage1-bfd +configure-stage1-bfd: + @[ $(current_stage) = stage1 ] || $(MAKE) stage1-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/bfd + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/bfd/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + echo Configuring stage 1 in $(HOST_SUBDIR)/bfd ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/bfd ; \ + cd $(HOST_SUBDIR)/bfd || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/bfd/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/bfd"; \ + libsrcdir="$$s/bfd"; \ $(SHELL) $${libsrcdir}/configure \ $(HOST_CONFIGARGS) $${srcdiroption} \ - || exit 1 + --disable-intermodule --disable-coverage --enable-languages="$(STAGE1_LANGUAGES)" +@endif bfd-bootstrap + +.PHONY: configure-stage2-bfd maybe-configure-stage2-bfd +maybe-configure-stage2-bfd: +@if bfd-bootstrap +maybe-configure-stage2-bfd: configure-stage2-bfd +configure-stage2-bfd: + @[ $(current_stage) = stage2 ] || $(MAKE) stage2-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/bfd + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/bfd/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage 2 in $(HOST_SUBDIR)/bfd ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/bfd ; \ + cd $(HOST_SUBDIR)/bfd || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/bfd/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/bfd"; \ + libsrcdir="$$s/bfd"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif bfd-bootstrap + +.PHONY: configure-stage3-bfd maybe-configure-stage3-bfd +maybe-configure-stage3-bfd: +@if bfd-bootstrap +maybe-configure-stage3-bfd: configure-stage3-bfd +configure-stage3-bfd: + @[ $(current_stage) = stage3 ] || $(MAKE) stage3-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/bfd + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/bfd/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage 3 in $(HOST_SUBDIR)/bfd ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/bfd ; \ + cd $(HOST_SUBDIR)/bfd || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/bfd/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/bfd"; \ + libsrcdir="$$s/bfd"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif bfd-bootstrap + +.PHONY: configure-stage4-bfd maybe-configure-stage4-bfd +maybe-configure-stage4-bfd: +@if bfd-bootstrap +maybe-configure-stage4-bfd: configure-stage4-bfd +configure-stage4-bfd: + @[ $(current_stage) = stage4 ] || $(MAKE) stage4-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/bfd + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/bfd/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage 4 in $(HOST_SUBDIR)/bfd ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/bfd ; \ + cd $(HOST_SUBDIR)/bfd || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/bfd/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/bfd"; \ + libsrcdir="$$s/bfd"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif bfd-bootstrap + +.PHONY: configure-stageprofile-bfd maybe-configure-stageprofile-bfd +maybe-configure-stageprofile-bfd: +@if bfd-bootstrap +maybe-configure-stageprofile-bfd: configure-stageprofile-bfd +configure-stageprofile-bfd: + @[ $(current_stage) = stageprofile ] || $(MAKE) stageprofile-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/bfd + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/bfd/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage profile in $(HOST_SUBDIR)/bfd ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/bfd ; \ + cd $(HOST_SUBDIR)/bfd || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/bfd/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/bfd"; \ + libsrcdir="$$s/bfd"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif bfd-bootstrap + +.PHONY: configure-stagefeedback-bfd maybe-configure-stagefeedback-bfd +maybe-configure-stagefeedback-bfd: +@if bfd-bootstrap +maybe-configure-stagefeedback-bfd: configure-stagefeedback-bfd +configure-stagefeedback-bfd: + @[ $(current_stage) = stagefeedback ] || $(MAKE) stagefeedback-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/bfd + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/bfd/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage feedback in $(HOST_SUBDIR)/bfd ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/bfd ; \ + cd $(HOST_SUBDIR)/bfd || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/bfd/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/bfd"; \ + libsrcdir="$$s/bfd"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif bfd-bootstrap + + + + .PHONY: all-bfd maybe-all-bfd maybe-all-bfd: +@if bfd +TARGET-bfd=all +maybe-all-bfd: all-bfd all-bfd: configure-bfd +@endif bfd +@if bfd-bootstrap + @if test -f stage_last; then $(unstage); else $(MAKE) stage1-start; fi +@endif bfd-bootstrap +@if bfd @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd bfd && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/bfd && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-bfd)) +@endif bfd + + + +.PHONY: all-stage1-bfd maybe-all-stage1-bfd +.PHONY: clean-stage1-bfd maybe-clean-stage1-bfd +maybe-all-stage1-bfd: +maybe-clean-stage1-bfd: +@if bfd-bootstrap +maybe-all-stage1-bfd: all-stage1-bfd +all-stage1: all-stage1-bfd +TARGET-stage1-bfd = $(TARGET-bfd) +all-stage1-bfd: configure-stage1-bfd + @[ $(current_stage) = stage1 ] || $(MAKE) stage1-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/bfd && \ + $(MAKE) $(FLAGS_TO_PASS) CFLAGS="$(STAGE1_CFLAGS)" LIBCFLAGS="$(STAGE1_CFLAGS)" \ + $(TARGET-stage1-bfd) + +maybe-clean-stage1-bfd: clean-stage1-bfd +clean-stage1: clean-stage1-bfd +clean-stage1-bfd: + @[ -f $(HOST_SUBDIR)/bfd/Makefile ] || [ -f $(HOST_SUBDIR)/stage1-bfd/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stage1 ] || $(MAKE) stage1-start; \ + cd $(HOST_SUBDIR)/bfd && \ + $(MAKE) $(FLAGS_TO_PASS) \ + CFLAGS="$(STAGE1_CFLAGS)" LIBCFLAGS="$(STAGE1_CFLAGS)" clean +@endif bfd-bootstrap + + +.PHONY: all-stage2-bfd maybe-all-stage2-bfd +.PHONY: clean-stage2-bfd maybe-clean-stage2-bfd +maybe-all-stage2-bfd: +maybe-clean-stage2-bfd: +@if bfd-bootstrap +maybe-all-stage2-bfd: all-stage2-bfd +all-stage2: all-stage2-bfd +TARGET-stage2-bfd = $(TARGET-bfd) +all-stage2-bfd: configure-stage2-bfd + @[ $(current_stage) = stage2 ] || $(MAKE) stage2-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/bfd && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) \ + $(TARGET-stage2-bfd) + +maybe-clean-stage2-bfd: clean-stage2-bfd +clean-stage2: clean-stage2-bfd +clean-stage2-bfd: + @[ -f $(HOST_SUBDIR)/bfd/Makefile ] || [ -f $(HOST_SUBDIR)/stage2-bfd/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stage2 ] || $(MAKE) stage2-start; \ + cd $(HOST_SUBDIR)/bfd && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + clean +@endif bfd-bootstrap + + +.PHONY: all-stage3-bfd maybe-all-stage3-bfd +.PHONY: clean-stage3-bfd maybe-clean-stage3-bfd +maybe-all-stage3-bfd: +maybe-clean-stage3-bfd: +@if bfd-bootstrap +maybe-all-stage3-bfd: all-stage3-bfd +all-stage3: all-stage3-bfd +TARGET-stage3-bfd = $(TARGET-bfd) +all-stage3-bfd: configure-stage3-bfd + @[ $(current_stage) = stage3 ] || $(MAKE) stage3-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/bfd && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) \ + $(TARGET-stage3-bfd) + +maybe-clean-stage3-bfd: clean-stage3-bfd +clean-stage3: clean-stage3-bfd +clean-stage3-bfd: + @[ -f $(HOST_SUBDIR)/bfd/Makefile ] || [ -f $(HOST_SUBDIR)/stage3-bfd/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stage3 ] || $(MAKE) stage3-start; \ + cd $(HOST_SUBDIR)/bfd && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + clean +@endif bfd-bootstrap + + +.PHONY: all-stage4-bfd maybe-all-stage4-bfd +.PHONY: clean-stage4-bfd maybe-clean-stage4-bfd +maybe-all-stage4-bfd: +maybe-clean-stage4-bfd: +@if bfd-bootstrap +maybe-all-stage4-bfd: all-stage4-bfd +all-stage4: all-stage4-bfd +TARGET-stage4-bfd = $(TARGET-bfd) +all-stage4-bfd: configure-stage4-bfd + @[ $(current_stage) = stage4 ] || $(MAKE) stage4-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/bfd && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) \ + $(TARGET-stage4-bfd) + +maybe-clean-stage4-bfd: clean-stage4-bfd +clean-stage4: clean-stage4-bfd +clean-stage4-bfd: + @[ -f $(HOST_SUBDIR)/bfd/Makefile ] || [ -f $(HOST_SUBDIR)/stage4-bfd/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stage4 ] || $(MAKE) stage4-start; \ + cd $(HOST_SUBDIR)/bfd && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + clean +@endif bfd-bootstrap + + +.PHONY: all-stageprofile-bfd maybe-all-stageprofile-bfd +.PHONY: clean-stageprofile-bfd maybe-clean-stageprofile-bfd +maybe-all-stageprofile-bfd: +maybe-clean-stageprofile-bfd: +@if bfd-bootstrap +maybe-all-stageprofile-bfd: all-stageprofile-bfd +all-stageprofile: all-stageprofile-bfd +TARGET-stageprofile-bfd = $(TARGET-bfd) +all-stageprofile-bfd: configure-stageprofile-bfd + @[ $(current_stage) = stageprofile ] || $(MAKE) stageprofile-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/bfd && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) CFLAGS="$(BOOT_CFLAGS) -fprofile-generate" \ + $(TARGET-stageprofile-bfd) + +maybe-clean-stageprofile-bfd: clean-stageprofile-bfd +clean-stageprofile: clean-stageprofile-bfd +clean-stageprofile-bfd: + @[ -f $(HOST_SUBDIR)/bfd/Makefile ] || [ -f $(HOST_SUBDIR)/stageprofile-bfd/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stageprofile ] || $(MAKE) stageprofile-start; \ + cd $(HOST_SUBDIR)/bfd && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + CFLAGS="$(BOOT_CFLAGS) -fprofile-generate" clean +@endif bfd-bootstrap + + +.PHONY: all-stagefeedback-bfd maybe-all-stagefeedback-bfd +.PHONY: clean-stagefeedback-bfd maybe-clean-stagefeedback-bfd +maybe-all-stagefeedback-bfd: +maybe-clean-stagefeedback-bfd: +@if bfd-bootstrap +maybe-all-stagefeedback-bfd: all-stagefeedback-bfd +all-stagefeedback: all-stagefeedback-bfd +TARGET-stagefeedback-bfd = $(TARGET-bfd) +all-stagefeedback-bfd: configure-stagefeedback-bfd + @[ $(current_stage) = stagefeedback ] || $(MAKE) stagefeedback-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/bfd && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) CFLAGS="$(BOOT_CFLAGS) -fprofile-use" \ + $(TARGET-stagefeedback-bfd) + +maybe-clean-stagefeedback-bfd: clean-stagefeedback-bfd +clean-stagefeedback: clean-stagefeedback-bfd +clean-stagefeedback-bfd: + @[ -f $(HOST_SUBDIR)/bfd/Makefile ] || [ -f $(HOST_SUBDIR)/stagefeedback-bfd/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stagefeedback ] || $(MAKE) stagefeedback-start; \ + cd $(HOST_SUBDIR)/bfd && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + CFLAGS="$(BOOT_CFLAGS) -fprofile-use" clean +@endif bfd-bootstrap + + + + .PHONY: check-bfd maybe-check-bfd maybe-check-bfd: +@if bfd +maybe-check-bfd: check-bfd check-bfd: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd bfd && $(MAKE) $(FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/bfd && \ + $(MAKE) $(FLAGS_TO_PASS) check) +@endif bfd .PHONY: install-bfd maybe-install-bfd maybe-install-bfd: +@if bfd +maybe-install-bfd: install-bfd install-bfd: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd bfd && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/bfd && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif bfd + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-bfd info-bfd +maybe-info-bfd: +@if bfd +maybe-info-bfd: info-bfd + +info-bfd: \ + configure-bfd + @[ -f ./bfd/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in bfd" ; \ + (cd $(HOST_SUBDIR)/bfd && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif bfd + +.PHONY: maybe-dvi-bfd dvi-bfd +maybe-dvi-bfd: +@if bfd +maybe-dvi-bfd: dvi-bfd + +dvi-bfd: \ + configure-bfd + @[ -f ./bfd/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in bfd" ; \ + (cd $(HOST_SUBDIR)/bfd && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif bfd + +.PHONY: maybe-html-bfd html-bfd +maybe-html-bfd: +@if bfd +maybe-html-bfd: html-bfd + +html-bfd: \ + configure-bfd + @[ -f ./bfd/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in bfd" ; \ + (cd $(HOST_SUBDIR)/bfd && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif bfd + +.PHONY: maybe-TAGS-bfd TAGS-bfd +maybe-TAGS-bfd: +@if bfd +maybe-TAGS-bfd: TAGS-bfd + +TAGS-bfd: \ + configure-bfd + @[ -f ./bfd/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in bfd" ; \ + (cd $(HOST_SUBDIR)/bfd && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif bfd + +.PHONY: maybe-install-info-bfd install-info-bfd +maybe-install-info-bfd: +@if bfd +maybe-install-info-bfd: install-info-bfd + +install-info-bfd: \ + configure-bfd \ + info-bfd + @[ -f ./bfd/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in bfd" ; \ + (cd $(HOST_SUBDIR)/bfd && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif bfd + +.PHONY: maybe-install-html-bfd install-html-bfd +maybe-install-html-bfd: +@if bfd +maybe-install-html-bfd: install-html-bfd + +install-html-bfd: \ + configure-bfd \ + html-bfd + @[ -f ./bfd/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in bfd" ; \ + (cd $(HOST_SUBDIR)/bfd && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif bfd + +.PHONY: maybe-installcheck-bfd installcheck-bfd +maybe-installcheck-bfd: +@if bfd +maybe-installcheck-bfd: installcheck-bfd + +installcheck-bfd: \ + configure-bfd + @[ -f ./bfd/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in bfd" ; \ + (cd $(HOST_SUBDIR)/bfd && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif bfd + +.PHONY: maybe-mostlyclean-bfd mostlyclean-bfd +maybe-mostlyclean-bfd: +@if bfd +maybe-mostlyclean-bfd: mostlyclean-bfd + +mostlyclean-bfd: + @[ -f ./bfd/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in bfd" ; \ + (cd $(HOST_SUBDIR)/bfd && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif bfd + +.PHONY: maybe-clean-bfd clean-bfd +maybe-clean-bfd: +@if bfd +maybe-clean-bfd: clean-bfd + +clean-bfd: + @[ -f ./bfd/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in bfd" ; \ + (cd $(HOST_SUBDIR)/bfd && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif bfd + +.PHONY: maybe-distclean-bfd distclean-bfd +maybe-distclean-bfd: +@if bfd +maybe-distclean-bfd: distclean-bfd + +distclean-bfd: + @[ -f ./bfd/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in bfd" ; \ + (cd $(HOST_SUBDIR)/bfd && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif bfd + +.PHONY: maybe-maintainer-clean-bfd maintainer-clean-bfd +maybe-maintainer-clean-bfd: +@if bfd +maybe-maintainer-clean-bfd: maintainer-clean-bfd + +maintainer-clean-bfd: + @[ -f ./bfd/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in bfd" ; \ + (cd $(HOST_SUBDIR)/bfd && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif bfd + .PHONY: configure-opcodes maybe-configure-opcodes maybe-configure-opcodes: -configure-opcodes: - @test ! -f opcodes/Makefile || exit 0; \ - [ -d opcodes ] || mkdir opcodes; \ - r=`${PWD_COMMAND}`; export r; \ +@if opcodes +maybe-configure-opcodes: configure-opcodes +configure-opcodes: +@endif opcodes +@if opcodes-bootstrap + @if test -f stage_last; then $(unstage); else $(MAKE) stage1-start; fi +@endif opcodes-bootstrap +@if opcodes + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in opcodes; \ - cd opcodes || exit 1; \ + test ! -f $(HOST_SUBDIR)/opcodes/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/opcodes ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/opcodes; \ + cd "$(HOST_SUBDIR)/opcodes" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/opcodes"; \ - libsrcdir="$$s/opcodes";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/opcodes"; \ - libsrcdir="$$s/opcodes";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/opcodes/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/opcodes"; \ + libsrcdir="$$s/opcodes"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + || exit 1 +@endif opcodes + + + +.PHONY: configure-stage1-opcodes maybe-configure-stage1-opcodes +maybe-configure-stage1-opcodes: +@if opcodes-bootstrap +maybe-configure-stage1-opcodes: configure-stage1-opcodes +configure-stage1-opcodes: + @[ $(current_stage) = stage1 ] || $(MAKE) stage1-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/opcodes + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/opcodes/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + echo Configuring stage 1 in $(HOST_SUBDIR)/opcodes ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/opcodes ; \ + cd $(HOST_SUBDIR)/opcodes || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/opcodes/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/opcodes"; \ + libsrcdir="$$s/opcodes"; \ $(SHELL) $${libsrcdir}/configure \ $(HOST_CONFIGARGS) $${srcdiroption} \ - || exit 1 + --disable-intermodule --disable-coverage --enable-languages="$(STAGE1_LANGUAGES)" +@endif opcodes-bootstrap + +.PHONY: configure-stage2-opcodes maybe-configure-stage2-opcodes +maybe-configure-stage2-opcodes: +@if opcodes-bootstrap +maybe-configure-stage2-opcodes: configure-stage2-opcodes +configure-stage2-opcodes: + @[ $(current_stage) = stage2 ] || $(MAKE) stage2-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/opcodes + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/opcodes/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage 2 in $(HOST_SUBDIR)/opcodes ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/opcodes ; \ + cd $(HOST_SUBDIR)/opcodes || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/opcodes/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/opcodes"; \ + libsrcdir="$$s/opcodes"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif opcodes-bootstrap + +.PHONY: configure-stage3-opcodes maybe-configure-stage3-opcodes +maybe-configure-stage3-opcodes: +@if opcodes-bootstrap +maybe-configure-stage3-opcodes: configure-stage3-opcodes +configure-stage3-opcodes: + @[ $(current_stage) = stage3 ] || $(MAKE) stage3-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/opcodes + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/opcodes/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage 3 in $(HOST_SUBDIR)/opcodes ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/opcodes ; \ + cd $(HOST_SUBDIR)/opcodes || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/opcodes/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/opcodes"; \ + libsrcdir="$$s/opcodes"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif opcodes-bootstrap + +.PHONY: configure-stage4-opcodes maybe-configure-stage4-opcodes +maybe-configure-stage4-opcodes: +@if opcodes-bootstrap +maybe-configure-stage4-opcodes: configure-stage4-opcodes +configure-stage4-opcodes: + @[ $(current_stage) = stage4 ] || $(MAKE) stage4-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/opcodes + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/opcodes/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage 4 in $(HOST_SUBDIR)/opcodes ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/opcodes ; \ + cd $(HOST_SUBDIR)/opcodes || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/opcodes/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/opcodes"; \ + libsrcdir="$$s/opcodes"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif opcodes-bootstrap + +.PHONY: configure-stageprofile-opcodes maybe-configure-stageprofile-opcodes +maybe-configure-stageprofile-opcodes: +@if opcodes-bootstrap +maybe-configure-stageprofile-opcodes: configure-stageprofile-opcodes +configure-stageprofile-opcodes: + @[ $(current_stage) = stageprofile ] || $(MAKE) stageprofile-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/opcodes + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/opcodes/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage profile in $(HOST_SUBDIR)/opcodes ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/opcodes ; \ + cd $(HOST_SUBDIR)/opcodes || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/opcodes/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/opcodes"; \ + libsrcdir="$$s/opcodes"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif opcodes-bootstrap + +.PHONY: configure-stagefeedback-opcodes maybe-configure-stagefeedback-opcodes +maybe-configure-stagefeedback-opcodes: +@if opcodes-bootstrap +maybe-configure-stagefeedback-opcodes: configure-stagefeedback-opcodes +configure-stagefeedback-opcodes: + @[ $(current_stage) = stagefeedback ] || $(MAKE) stagefeedback-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/opcodes + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/opcodes/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage feedback in $(HOST_SUBDIR)/opcodes ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/opcodes ; \ + cd $(HOST_SUBDIR)/opcodes || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/opcodes/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/opcodes"; \ + libsrcdir="$$s/opcodes"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif opcodes-bootstrap + + + + .PHONY: all-opcodes maybe-all-opcodes maybe-all-opcodes: +@if opcodes +TARGET-opcodes=all +maybe-all-opcodes: all-opcodes all-opcodes: configure-opcodes +@endif opcodes +@if opcodes-bootstrap + @if test -f stage_last; then $(unstage); else $(MAKE) stage1-start; fi +@endif opcodes-bootstrap +@if opcodes @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd opcodes && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/opcodes && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-opcodes)) +@endif opcodes + + + +.PHONY: all-stage1-opcodes maybe-all-stage1-opcodes +.PHONY: clean-stage1-opcodes maybe-clean-stage1-opcodes +maybe-all-stage1-opcodes: +maybe-clean-stage1-opcodes: +@if opcodes-bootstrap +maybe-all-stage1-opcodes: all-stage1-opcodes +all-stage1: all-stage1-opcodes +TARGET-stage1-opcodes = $(TARGET-opcodes) +all-stage1-opcodes: configure-stage1-opcodes + @[ $(current_stage) = stage1 ] || $(MAKE) stage1-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/opcodes && \ + $(MAKE) $(FLAGS_TO_PASS) CFLAGS="$(STAGE1_CFLAGS)" LIBCFLAGS="$(STAGE1_CFLAGS)" \ + $(TARGET-stage1-opcodes) + +maybe-clean-stage1-opcodes: clean-stage1-opcodes +clean-stage1: clean-stage1-opcodes +clean-stage1-opcodes: + @[ -f $(HOST_SUBDIR)/opcodes/Makefile ] || [ -f $(HOST_SUBDIR)/stage1-opcodes/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stage1 ] || $(MAKE) stage1-start; \ + cd $(HOST_SUBDIR)/opcodes && \ + $(MAKE) $(FLAGS_TO_PASS) \ + CFLAGS="$(STAGE1_CFLAGS)" LIBCFLAGS="$(STAGE1_CFLAGS)" clean +@endif opcodes-bootstrap + + +.PHONY: all-stage2-opcodes maybe-all-stage2-opcodes +.PHONY: clean-stage2-opcodes maybe-clean-stage2-opcodes +maybe-all-stage2-opcodes: +maybe-clean-stage2-opcodes: +@if opcodes-bootstrap +maybe-all-stage2-opcodes: all-stage2-opcodes +all-stage2: all-stage2-opcodes +TARGET-stage2-opcodes = $(TARGET-opcodes) +all-stage2-opcodes: configure-stage2-opcodes + @[ $(current_stage) = stage2 ] || $(MAKE) stage2-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/opcodes && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) \ + $(TARGET-stage2-opcodes) + +maybe-clean-stage2-opcodes: clean-stage2-opcodes +clean-stage2: clean-stage2-opcodes +clean-stage2-opcodes: + @[ -f $(HOST_SUBDIR)/opcodes/Makefile ] || [ -f $(HOST_SUBDIR)/stage2-opcodes/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stage2 ] || $(MAKE) stage2-start; \ + cd $(HOST_SUBDIR)/opcodes && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + clean +@endif opcodes-bootstrap + + +.PHONY: all-stage3-opcodes maybe-all-stage3-opcodes +.PHONY: clean-stage3-opcodes maybe-clean-stage3-opcodes +maybe-all-stage3-opcodes: +maybe-clean-stage3-opcodes: +@if opcodes-bootstrap +maybe-all-stage3-opcodes: all-stage3-opcodes +all-stage3: all-stage3-opcodes +TARGET-stage3-opcodes = $(TARGET-opcodes) +all-stage3-opcodes: configure-stage3-opcodes + @[ $(current_stage) = stage3 ] || $(MAKE) stage3-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/opcodes && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) \ + $(TARGET-stage3-opcodes) + +maybe-clean-stage3-opcodes: clean-stage3-opcodes +clean-stage3: clean-stage3-opcodes +clean-stage3-opcodes: + @[ -f $(HOST_SUBDIR)/opcodes/Makefile ] || [ -f $(HOST_SUBDIR)/stage3-opcodes/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stage3 ] || $(MAKE) stage3-start; \ + cd $(HOST_SUBDIR)/opcodes && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + clean +@endif opcodes-bootstrap + + +.PHONY: all-stage4-opcodes maybe-all-stage4-opcodes +.PHONY: clean-stage4-opcodes maybe-clean-stage4-opcodes +maybe-all-stage4-opcodes: +maybe-clean-stage4-opcodes: +@if opcodes-bootstrap +maybe-all-stage4-opcodes: all-stage4-opcodes +all-stage4: all-stage4-opcodes +TARGET-stage4-opcodes = $(TARGET-opcodes) +all-stage4-opcodes: configure-stage4-opcodes + @[ $(current_stage) = stage4 ] || $(MAKE) stage4-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/opcodes && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) \ + $(TARGET-stage4-opcodes) + +maybe-clean-stage4-opcodes: clean-stage4-opcodes +clean-stage4: clean-stage4-opcodes +clean-stage4-opcodes: + @[ -f $(HOST_SUBDIR)/opcodes/Makefile ] || [ -f $(HOST_SUBDIR)/stage4-opcodes/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stage4 ] || $(MAKE) stage4-start; \ + cd $(HOST_SUBDIR)/opcodes && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + clean +@endif opcodes-bootstrap + + +.PHONY: all-stageprofile-opcodes maybe-all-stageprofile-opcodes +.PHONY: clean-stageprofile-opcodes maybe-clean-stageprofile-opcodes +maybe-all-stageprofile-opcodes: +maybe-clean-stageprofile-opcodes: +@if opcodes-bootstrap +maybe-all-stageprofile-opcodes: all-stageprofile-opcodes +all-stageprofile: all-stageprofile-opcodes +TARGET-stageprofile-opcodes = $(TARGET-opcodes) +all-stageprofile-opcodes: configure-stageprofile-opcodes + @[ $(current_stage) = stageprofile ] || $(MAKE) stageprofile-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/opcodes && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) CFLAGS="$(BOOT_CFLAGS) -fprofile-generate" \ + $(TARGET-stageprofile-opcodes) + +maybe-clean-stageprofile-opcodes: clean-stageprofile-opcodes +clean-stageprofile: clean-stageprofile-opcodes +clean-stageprofile-opcodes: + @[ -f $(HOST_SUBDIR)/opcodes/Makefile ] || [ -f $(HOST_SUBDIR)/stageprofile-opcodes/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stageprofile ] || $(MAKE) stageprofile-start; \ + cd $(HOST_SUBDIR)/opcodes && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + CFLAGS="$(BOOT_CFLAGS) -fprofile-generate" clean +@endif opcodes-bootstrap + + +.PHONY: all-stagefeedback-opcodes maybe-all-stagefeedback-opcodes +.PHONY: clean-stagefeedback-opcodes maybe-clean-stagefeedback-opcodes +maybe-all-stagefeedback-opcodes: +maybe-clean-stagefeedback-opcodes: +@if opcodes-bootstrap +maybe-all-stagefeedback-opcodes: all-stagefeedback-opcodes +all-stagefeedback: all-stagefeedback-opcodes +TARGET-stagefeedback-opcodes = $(TARGET-opcodes) +all-stagefeedback-opcodes: configure-stagefeedback-opcodes + @[ $(current_stage) = stagefeedback ] || $(MAKE) stagefeedback-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/opcodes && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) CFLAGS="$(BOOT_CFLAGS) -fprofile-use" \ + $(TARGET-stagefeedback-opcodes) + +maybe-clean-stagefeedback-opcodes: clean-stagefeedback-opcodes +clean-stagefeedback: clean-stagefeedback-opcodes +clean-stagefeedback-opcodes: + @[ -f $(HOST_SUBDIR)/opcodes/Makefile ] || [ -f $(HOST_SUBDIR)/stagefeedback-opcodes/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stagefeedback ] || $(MAKE) stagefeedback-start; \ + cd $(HOST_SUBDIR)/opcodes && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + CFLAGS="$(BOOT_CFLAGS) -fprofile-use" clean +@endif opcodes-bootstrap + + + + .PHONY: check-opcodes maybe-check-opcodes maybe-check-opcodes: +@if opcodes +maybe-check-opcodes: check-opcodes check-opcodes: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd opcodes && $(MAKE) $(FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/opcodes && \ + $(MAKE) $(FLAGS_TO_PASS) check) +@endif opcodes .PHONY: install-opcodes maybe-install-opcodes maybe-install-opcodes: +@if opcodes +maybe-install-opcodes: install-opcodes install-opcodes: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd opcodes && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/opcodes && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif opcodes + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-opcodes info-opcodes +maybe-info-opcodes: +@if opcodes +maybe-info-opcodes: info-opcodes + +info-opcodes: \ + configure-opcodes + @[ -f ./opcodes/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in opcodes" ; \ + (cd $(HOST_SUBDIR)/opcodes && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif opcodes + +.PHONY: maybe-dvi-opcodes dvi-opcodes +maybe-dvi-opcodes: +@if opcodes +maybe-dvi-opcodes: dvi-opcodes + +dvi-opcodes: \ + configure-opcodes + @[ -f ./opcodes/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in opcodes" ; \ + (cd $(HOST_SUBDIR)/opcodes && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif opcodes + +.PHONY: maybe-html-opcodes html-opcodes +maybe-html-opcodes: +@if opcodes +maybe-html-opcodes: html-opcodes + +html-opcodes: \ + configure-opcodes + @[ -f ./opcodes/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in opcodes" ; \ + (cd $(HOST_SUBDIR)/opcodes && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif opcodes + +.PHONY: maybe-TAGS-opcodes TAGS-opcodes +maybe-TAGS-opcodes: +@if opcodes +maybe-TAGS-opcodes: TAGS-opcodes + +TAGS-opcodes: \ + configure-opcodes + @[ -f ./opcodes/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in opcodes" ; \ + (cd $(HOST_SUBDIR)/opcodes && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif opcodes + +.PHONY: maybe-install-info-opcodes install-info-opcodes +maybe-install-info-opcodes: +@if opcodes +maybe-install-info-opcodes: install-info-opcodes + +install-info-opcodes: \ + configure-opcodes \ + info-opcodes + @[ -f ./opcodes/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in opcodes" ; \ + (cd $(HOST_SUBDIR)/opcodes && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif opcodes + +.PHONY: maybe-install-html-opcodes install-html-opcodes +maybe-install-html-opcodes: +@if opcodes +maybe-install-html-opcodes: install-html-opcodes + +install-html-opcodes: \ + configure-opcodes \ + html-opcodes + @[ -f ./opcodes/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in opcodes" ; \ + (cd $(HOST_SUBDIR)/opcodes && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif opcodes + +.PHONY: maybe-installcheck-opcodes installcheck-opcodes +maybe-installcheck-opcodes: +@if opcodes +maybe-installcheck-opcodes: installcheck-opcodes + +installcheck-opcodes: \ + configure-opcodes + @[ -f ./opcodes/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in opcodes" ; \ + (cd $(HOST_SUBDIR)/opcodes && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif opcodes + +.PHONY: maybe-mostlyclean-opcodes mostlyclean-opcodes +maybe-mostlyclean-opcodes: +@if opcodes +maybe-mostlyclean-opcodes: mostlyclean-opcodes + +mostlyclean-opcodes: + @[ -f ./opcodes/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in opcodes" ; \ + (cd $(HOST_SUBDIR)/opcodes && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif opcodes + +.PHONY: maybe-clean-opcodes clean-opcodes +maybe-clean-opcodes: +@if opcodes +maybe-clean-opcodes: clean-opcodes + +clean-opcodes: + @[ -f ./opcodes/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in opcodes" ; \ + (cd $(HOST_SUBDIR)/opcodes && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif opcodes + +.PHONY: maybe-distclean-opcodes distclean-opcodes +maybe-distclean-opcodes: +@if opcodes +maybe-distclean-opcodes: distclean-opcodes + +distclean-opcodes: + @[ -f ./opcodes/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in opcodes" ; \ + (cd $(HOST_SUBDIR)/opcodes && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif opcodes + +.PHONY: maybe-maintainer-clean-opcodes maintainer-clean-opcodes +maybe-maintainer-clean-opcodes: +@if opcodes +maybe-maintainer-clean-opcodes: maintainer-clean-opcodes + +maintainer-clean-opcodes: + @[ -f ./opcodes/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in opcodes" ; \ + (cd $(HOST_SUBDIR)/opcodes && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif opcodes + .PHONY: configure-binutils maybe-configure-binutils maybe-configure-binutils: -configure-binutils: - @test ! -f binutils/Makefile || exit 0; \ - [ -d binutils ] || mkdir binutils; \ - r=`${PWD_COMMAND}`; export r; \ +@if binutils +maybe-configure-binutils: configure-binutils +configure-binutils: +@endif binutils +@if binutils-bootstrap + @if test -f stage_last; then $(unstage); else $(MAKE) stage1-start; fi +@endif binutils-bootstrap +@if binutils + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in binutils; \ - cd binutils || exit 1; \ + test ! -f $(HOST_SUBDIR)/binutils/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/binutils ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/binutils; \ + cd "$(HOST_SUBDIR)/binutils" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/binutils"; \ - libsrcdir="$$s/binutils";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/binutils"; \ - libsrcdir="$$s/binutils";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/binutils/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/binutils"; \ + libsrcdir="$$s/binutils"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + || exit 1 +@endif binutils + + + +.PHONY: configure-stage1-binutils maybe-configure-stage1-binutils +maybe-configure-stage1-binutils: +@if binutils-bootstrap +maybe-configure-stage1-binutils: configure-stage1-binutils +configure-stage1-binutils: + @[ $(current_stage) = stage1 ] || $(MAKE) stage1-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/binutils + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/binutils/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + echo Configuring stage 1 in $(HOST_SUBDIR)/binutils ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/binutils ; \ + cd $(HOST_SUBDIR)/binutils || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/binutils/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/binutils"; \ + libsrcdir="$$s/binutils"; \ $(SHELL) $${libsrcdir}/configure \ $(HOST_CONFIGARGS) $${srcdiroption} \ - || exit 1 + --disable-intermodule --disable-coverage --enable-languages="$(STAGE1_LANGUAGES)" +@endif binutils-bootstrap + +.PHONY: configure-stage2-binutils maybe-configure-stage2-binutils +maybe-configure-stage2-binutils: +@if binutils-bootstrap +maybe-configure-stage2-binutils: configure-stage2-binutils +configure-stage2-binutils: + @[ $(current_stage) = stage2 ] || $(MAKE) stage2-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/binutils + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/binutils/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage 2 in $(HOST_SUBDIR)/binutils ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/binutils ; \ + cd $(HOST_SUBDIR)/binutils || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/binutils/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/binutils"; \ + libsrcdir="$$s/binutils"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif binutils-bootstrap + +.PHONY: configure-stage3-binutils maybe-configure-stage3-binutils +maybe-configure-stage3-binutils: +@if binutils-bootstrap +maybe-configure-stage3-binutils: configure-stage3-binutils +configure-stage3-binutils: + @[ $(current_stage) = stage3 ] || $(MAKE) stage3-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/binutils + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/binutils/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage 3 in $(HOST_SUBDIR)/binutils ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/binutils ; \ + cd $(HOST_SUBDIR)/binutils || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/binutils/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/binutils"; \ + libsrcdir="$$s/binutils"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif binutils-bootstrap + +.PHONY: configure-stage4-binutils maybe-configure-stage4-binutils +maybe-configure-stage4-binutils: +@if binutils-bootstrap +maybe-configure-stage4-binutils: configure-stage4-binutils +configure-stage4-binutils: + @[ $(current_stage) = stage4 ] || $(MAKE) stage4-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/binutils + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/binutils/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage 4 in $(HOST_SUBDIR)/binutils ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/binutils ; \ + cd $(HOST_SUBDIR)/binutils || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/binutils/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/binutils"; \ + libsrcdir="$$s/binutils"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif binutils-bootstrap + +.PHONY: configure-stageprofile-binutils maybe-configure-stageprofile-binutils +maybe-configure-stageprofile-binutils: +@if binutils-bootstrap +maybe-configure-stageprofile-binutils: configure-stageprofile-binutils +configure-stageprofile-binutils: + @[ $(current_stage) = stageprofile ] || $(MAKE) stageprofile-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/binutils + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/binutils/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage profile in $(HOST_SUBDIR)/binutils ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/binutils ; \ + cd $(HOST_SUBDIR)/binutils || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/binutils/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/binutils"; \ + libsrcdir="$$s/binutils"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif binutils-bootstrap + +.PHONY: configure-stagefeedback-binutils maybe-configure-stagefeedback-binutils +maybe-configure-stagefeedback-binutils: +@if binutils-bootstrap +maybe-configure-stagefeedback-binutils: configure-stagefeedback-binutils +configure-stagefeedback-binutils: + @[ $(current_stage) = stagefeedback ] || $(MAKE) stagefeedback-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/binutils + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/binutils/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage feedback in $(HOST_SUBDIR)/binutils ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/binutils ; \ + cd $(HOST_SUBDIR)/binutils || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/binutils/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/binutils"; \ + libsrcdir="$$s/binutils"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif binutils-bootstrap + + + + .PHONY: all-binutils maybe-all-binutils maybe-all-binutils: +@if binutils +TARGET-binutils=all +maybe-all-binutils: all-binutils all-binutils: configure-binutils +@endif binutils +@if binutils-bootstrap + @if test -f stage_last; then $(unstage); else $(MAKE) stage1-start; fi +@endif binutils-bootstrap +@if binutils @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd binutils && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/binutils && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-binutils)) +@endif binutils + + + +.PHONY: all-stage1-binutils maybe-all-stage1-binutils +.PHONY: clean-stage1-binutils maybe-clean-stage1-binutils +maybe-all-stage1-binutils: +maybe-clean-stage1-binutils: +@if binutils-bootstrap +maybe-all-stage1-binutils: all-stage1-binutils +all-stage1: all-stage1-binutils +TARGET-stage1-binutils = $(TARGET-binutils) +all-stage1-binutils: configure-stage1-binutils + @[ $(current_stage) = stage1 ] || $(MAKE) stage1-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/binutils && \ + $(MAKE) $(FLAGS_TO_PASS) CFLAGS="$(STAGE1_CFLAGS)" LIBCFLAGS="$(STAGE1_CFLAGS)" \ + $(TARGET-stage1-binutils) + +maybe-clean-stage1-binutils: clean-stage1-binutils +clean-stage1: clean-stage1-binutils +clean-stage1-binutils: + @[ -f $(HOST_SUBDIR)/binutils/Makefile ] || [ -f $(HOST_SUBDIR)/stage1-binutils/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stage1 ] || $(MAKE) stage1-start; \ + cd $(HOST_SUBDIR)/binutils && \ + $(MAKE) $(FLAGS_TO_PASS) \ + CFLAGS="$(STAGE1_CFLAGS)" LIBCFLAGS="$(STAGE1_CFLAGS)" clean +@endif binutils-bootstrap + + +.PHONY: all-stage2-binutils maybe-all-stage2-binutils +.PHONY: clean-stage2-binutils maybe-clean-stage2-binutils +maybe-all-stage2-binutils: +maybe-clean-stage2-binutils: +@if binutils-bootstrap +maybe-all-stage2-binutils: all-stage2-binutils +all-stage2: all-stage2-binutils +TARGET-stage2-binutils = $(TARGET-binutils) +all-stage2-binutils: configure-stage2-binutils + @[ $(current_stage) = stage2 ] || $(MAKE) stage2-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/binutils && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) \ + $(TARGET-stage2-binutils) + +maybe-clean-stage2-binutils: clean-stage2-binutils +clean-stage2: clean-stage2-binutils +clean-stage2-binutils: + @[ -f $(HOST_SUBDIR)/binutils/Makefile ] || [ -f $(HOST_SUBDIR)/stage2-binutils/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stage2 ] || $(MAKE) stage2-start; \ + cd $(HOST_SUBDIR)/binutils && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + clean +@endif binutils-bootstrap + + +.PHONY: all-stage3-binutils maybe-all-stage3-binutils +.PHONY: clean-stage3-binutils maybe-clean-stage3-binutils +maybe-all-stage3-binutils: +maybe-clean-stage3-binutils: +@if binutils-bootstrap +maybe-all-stage3-binutils: all-stage3-binutils +all-stage3: all-stage3-binutils +TARGET-stage3-binutils = $(TARGET-binutils) +all-stage3-binutils: configure-stage3-binutils + @[ $(current_stage) = stage3 ] || $(MAKE) stage3-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/binutils && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) \ + $(TARGET-stage3-binutils) + +maybe-clean-stage3-binutils: clean-stage3-binutils +clean-stage3: clean-stage3-binutils +clean-stage3-binutils: + @[ -f $(HOST_SUBDIR)/binutils/Makefile ] || [ -f $(HOST_SUBDIR)/stage3-binutils/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stage3 ] || $(MAKE) stage3-start; \ + cd $(HOST_SUBDIR)/binutils && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + clean +@endif binutils-bootstrap + + +.PHONY: all-stage4-binutils maybe-all-stage4-binutils +.PHONY: clean-stage4-binutils maybe-clean-stage4-binutils +maybe-all-stage4-binutils: +maybe-clean-stage4-binutils: +@if binutils-bootstrap +maybe-all-stage4-binutils: all-stage4-binutils +all-stage4: all-stage4-binutils +TARGET-stage4-binutils = $(TARGET-binutils) +all-stage4-binutils: configure-stage4-binutils + @[ $(current_stage) = stage4 ] || $(MAKE) stage4-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/binutils && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) \ + $(TARGET-stage4-binutils) + +maybe-clean-stage4-binutils: clean-stage4-binutils +clean-stage4: clean-stage4-binutils +clean-stage4-binutils: + @[ -f $(HOST_SUBDIR)/binutils/Makefile ] || [ -f $(HOST_SUBDIR)/stage4-binutils/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stage4 ] || $(MAKE) stage4-start; \ + cd $(HOST_SUBDIR)/binutils && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + clean +@endif binutils-bootstrap + + +.PHONY: all-stageprofile-binutils maybe-all-stageprofile-binutils +.PHONY: clean-stageprofile-binutils maybe-clean-stageprofile-binutils +maybe-all-stageprofile-binutils: +maybe-clean-stageprofile-binutils: +@if binutils-bootstrap +maybe-all-stageprofile-binutils: all-stageprofile-binutils +all-stageprofile: all-stageprofile-binutils +TARGET-stageprofile-binutils = $(TARGET-binutils) +all-stageprofile-binutils: configure-stageprofile-binutils + @[ $(current_stage) = stageprofile ] || $(MAKE) stageprofile-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/binutils && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) CFLAGS="$(BOOT_CFLAGS) -fprofile-generate" \ + $(TARGET-stageprofile-binutils) + +maybe-clean-stageprofile-binutils: clean-stageprofile-binutils +clean-stageprofile: clean-stageprofile-binutils +clean-stageprofile-binutils: + @[ -f $(HOST_SUBDIR)/binutils/Makefile ] || [ -f $(HOST_SUBDIR)/stageprofile-binutils/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stageprofile ] || $(MAKE) stageprofile-start; \ + cd $(HOST_SUBDIR)/binutils && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + CFLAGS="$(BOOT_CFLAGS) -fprofile-generate" clean +@endif binutils-bootstrap + + +.PHONY: all-stagefeedback-binutils maybe-all-stagefeedback-binutils +.PHONY: clean-stagefeedback-binutils maybe-clean-stagefeedback-binutils +maybe-all-stagefeedback-binutils: +maybe-clean-stagefeedback-binutils: +@if binutils-bootstrap +maybe-all-stagefeedback-binutils: all-stagefeedback-binutils +all-stagefeedback: all-stagefeedback-binutils +TARGET-stagefeedback-binutils = $(TARGET-binutils) +all-stagefeedback-binutils: configure-stagefeedback-binutils + @[ $(current_stage) = stagefeedback ] || $(MAKE) stagefeedback-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/binutils && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) CFLAGS="$(BOOT_CFLAGS) -fprofile-use" \ + $(TARGET-stagefeedback-binutils) + +maybe-clean-stagefeedback-binutils: clean-stagefeedback-binutils +clean-stagefeedback: clean-stagefeedback-binutils +clean-stagefeedback-binutils: + @[ -f $(HOST_SUBDIR)/binutils/Makefile ] || [ -f $(HOST_SUBDIR)/stagefeedback-binutils/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stagefeedback ] || $(MAKE) stagefeedback-start; \ + cd $(HOST_SUBDIR)/binutils && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + CFLAGS="$(BOOT_CFLAGS) -fprofile-use" clean +@endif binutils-bootstrap + + + + .PHONY: check-binutils maybe-check-binutils maybe-check-binutils: +@if binutils +maybe-check-binutils: check-binutils check-binutils: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd binutils && $(MAKE) $(FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/binutils && \ + $(MAKE) $(FLAGS_TO_PASS) check) +@endif binutils .PHONY: install-binutils maybe-install-binutils maybe-install-binutils: +@if binutils +maybe-install-binutils: install-binutils install-binutils: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd binutils && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/binutils && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif binutils + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-binutils info-binutils +maybe-info-binutils: +@if binutils +maybe-info-binutils: info-binutils + +info-binutils: \ + configure-binutils + @[ -f ./binutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in binutils" ; \ + (cd $(HOST_SUBDIR)/binutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif binutils + +.PHONY: maybe-dvi-binutils dvi-binutils +maybe-dvi-binutils: +@if binutils +maybe-dvi-binutils: dvi-binutils + +dvi-binutils: \ + configure-binutils + @[ -f ./binutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in binutils" ; \ + (cd $(HOST_SUBDIR)/binutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif binutils + +.PHONY: maybe-html-binutils html-binutils +maybe-html-binutils: +@if binutils +maybe-html-binutils: html-binutils + +html-binutils: \ + configure-binutils + @[ -f ./binutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in binutils" ; \ + (cd $(HOST_SUBDIR)/binutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif binutils + +.PHONY: maybe-TAGS-binutils TAGS-binutils +maybe-TAGS-binutils: +@if binutils +maybe-TAGS-binutils: TAGS-binutils + +TAGS-binutils: \ + configure-binutils + @[ -f ./binutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in binutils" ; \ + (cd $(HOST_SUBDIR)/binutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif binutils + +.PHONY: maybe-install-info-binutils install-info-binutils +maybe-install-info-binutils: +@if binutils +maybe-install-info-binutils: install-info-binutils + +install-info-binutils: \ + configure-binutils \ + info-binutils + @[ -f ./binutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in binutils" ; \ + (cd $(HOST_SUBDIR)/binutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif binutils + +.PHONY: maybe-install-html-binutils install-html-binutils +maybe-install-html-binutils: +@if binutils +maybe-install-html-binutils: install-html-binutils + +install-html-binutils: \ + configure-binutils \ + html-binutils + @[ -f ./binutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in binutils" ; \ + (cd $(HOST_SUBDIR)/binutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif binutils + +.PHONY: maybe-installcheck-binutils installcheck-binutils +maybe-installcheck-binutils: +@if binutils +maybe-installcheck-binutils: installcheck-binutils + +installcheck-binutils: \ + configure-binutils + @[ -f ./binutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in binutils" ; \ + (cd $(HOST_SUBDIR)/binutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif binutils + +.PHONY: maybe-mostlyclean-binutils mostlyclean-binutils +maybe-mostlyclean-binutils: +@if binutils +maybe-mostlyclean-binutils: mostlyclean-binutils + +mostlyclean-binutils: + @[ -f ./binutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in binutils" ; \ + (cd $(HOST_SUBDIR)/binutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif binutils + +.PHONY: maybe-clean-binutils clean-binutils +maybe-clean-binutils: +@if binutils +maybe-clean-binutils: clean-binutils + +clean-binutils: + @[ -f ./binutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in binutils" ; \ + (cd $(HOST_SUBDIR)/binutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif binutils + +.PHONY: maybe-distclean-binutils distclean-binutils +maybe-distclean-binutils: +@if binutils +maybe-distclean-binutils: distclean-binutils + +distclean-binutils: + @[ -f ./binutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in binutils" ; \ + (cd $(HOST_SUBDIR)/binutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif binutils + +.PHONY: maybe-maintainer-clean-binutils maintainer-clean-binutils +maybe-maintainer-clean-binutils: +@if binutils +maybe-maintainer-clean-binutils: maintainer-clean-binutils + +maintainer-clean-binutils: + @[ -f ./binutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in binutils" ; \ + (cd $(HOST_SUBDIR)/binutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif binutils + .PHONY: configure-bison maybe-configure-bison maybe-configure-bison: -configure-bison: - @test ! -f bison/Makefile || exit 0; \ - [ -d bison ] || mkdir bison; \ - r=`${PWD_COMMAND}`; export r; \ +@if bison +maybe-configure-bison: configure-bison +configure-bison: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in bison; \ - cd bison || exit 1; \ + test ! -f $(HOST_SUBDIR)/bison/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/bison ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/bison; \ + cd "$(HOST_SUBDIR)/bison" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/bison"; \ - libsrcdir="$$s/bison";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/bison"; \ - libsrcdir="$$s/bison";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/bison/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/bison"; \ + libsrcdir="$$s/bison"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif bison + + + + .PHONY: all-bison maybe-all-bison maybe-all-bison: +@if bison +TARGET-bison=all +maybe-all-bison: all-bison all-bison: configure-bison + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd bison && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/bison && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-bison)) +@endif bison + + + .PHONY: check-bison maybe-check-bison maybe-check-bison: +@if bison +maybe-check-bison: check-bison # This module is only tested in a native toolchain. check-bison: + @: $(MAKE); $(unstage) @if [ '$(host)' = '$(target)' ] ; then \ r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd bison && $(MAKE) $(FLAGS_TO_PASS) check); \ + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/bison && \ + $(MAKE) $(FLAGS_TO_PASS) check); \ fi +@endif bison .PHONY: install-bison maybe-install-bison maybe-install-bison: +@if bison +maybe-install-bison: install-bison install-bison: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd bison && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/bison && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif bison + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-bison info-bison +maybe-info-bison: +@if bison +maybe-info-bison: info-bison + +info-bison: \ + configure-bison + @: $(MAKE); $(unstage) + @[ -f ./bison/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in bison" ; \ + (cd $(HOST_SUBDIR)/bison && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif bison + +.PHONY: maybe-dvi-bison dvi-bison +maybe-dvi-bison: +@if bison +maybe-dvi-bison: dvi-bison + +dvi-bison: \ + configure-bison + @: $(MAKE); $(unstage) + @[ -f ./bison/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in bison" ; \ + (cd $(HOST_SUBDIR)/bison && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif bison + +.PHONY: maybe-html-bison html-bison +maybe-html-bison: +@if bison +maybe-html-bison: html-bison + +html-bison: \ + configure-bison + @: $(MAKE); $(unstage) + @[ -f ./bison/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in bison" ; \ + (cd $(HOST_SUBDIR)/bison && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif bison + +.PHONY: maybe-TAGS-bison TAGS-bison +maybe-TAGS-bison: +@if bison +maybe-TAGS-bison: TAGS-bison + +TAGS-bison: \ + configure-bison + @: $(MAKE); $(unstage) + @[ -f ./bison/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in bison" ; \ + (cd $(HOST_SUBDIR)/bison && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif bison + +.PHONY: maybe-install-info-bison install-info-bison +maybe-install-info-bison: +@if bison +maybe-install-info-bison: install-info-bison + +install-info-bison: \ + configure-bison \ + info-bison + @: $(MAKE); $(unstage) + @[ -f ./bison/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in bison" ; \ + (cd $(HOST_SUBDIR)/bison && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif bison + +.PHONY: maybe-install-html-bison install-html-bison +maybe-install-html-bison: +@if bison +maybe-install-html-bison: install-html-bison + +install-html-bison: \ + configure-bison \ + html-bison + @: $(MAKE); $(unstage) + @[ -f ./bison/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in bison" ; \ + (cd $(HOST_SUBDIR)/bison && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif bison + +.PHONY: maybe-installcheck-bison installcheck-bison +maybe-installcheck-bison: +@if bison +maybe-installcheck-bison: installcheck-bison + +installcheck-bison: \ + configure-bison + @: $(MAKE); $(unstage) + @[ -f ./bison/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in bison" ; \ + (cd $(HOST_SUBDIR)/bison && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif bison + +.PHONY: maybe-mostlyclean-bison mostlyclean-bison +maybe-mostlyclean-bison: +@if bison +maybe-mostlyclean-bison: mostlyclean-bison + +mostlyclean-bison: + @: $(MAKE); $(unstage) + @[ -f ./bison/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in bison" ; \ + (cd $(HOST_SUBDIR)/bison && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif bison + +.PHONY: maybe-clean-bison clean-bison +maybe-clean-bison: +@if bison +maybe-clean-bison: clean-bison + +clean-bison: + @: $(MAKE); $(unstage) + @[ -f ./bison/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in bison" ; \ + (cd $(HOST_SUBDIR)/bison && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif bison + +.PHONY: maybe-distclean-bison distclean-bison +maybe-distclean-bison: +@if bison +maybe-distclean-bison: distclean-bison + +distclean-bison: + @: $(MAKE); $(unstage) + @[ -f ./bison/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in bison" ; \ + (cd $(HOST_SUBDIR)/bison && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif bison + +.PHONY: maybe-maintainer-clean-bison maintainer-clean-bison +maybe-maintainer-clean-bison: +@if bison +maybe-maintainer-clean-bison: maintainer-clean-bison + +maintainer-clean-bison: + @: $(MAKE); $(unstage) + @[ -f ./bison/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in bison" ; \ + (cd $(HOST_SUBDIR)/bison && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif bison + .PHONY: configure-byacc maybe-configure-byacc maybe-configure-byacc: -configure-byacc: - @test ! -f byacc/Makefile || exit 0; \ - [ -d byacc ] || mkdir byacc; \ - r=`${PWD_COMMAND}`; export r; \ +@if byacc +maybe-configure-byacc: configure-byacc +configure-byacc: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in byacc; \ - cd byacc || exit 1; \ + test ! -f $(HOST_SUBDIR)/byacc/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/byacc ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/byacc; \ + cd "$(HOST_SUBDIR)/byacc" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/byacc"; \ - libsrcdir="$$s/byacc";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/byacc"; \ - libsrcdir="$$s/byacc";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/byacc/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/byacc"; \ + libsrcdir="$$s/byacc"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif byacc + + + + .PHONY: all-byacc maybe-all-byacc maybe-all-byacc: +@if byacc +TARGET-byacc=all +maybe-all-byacc: all-byacc all-byacc: configure-byacc + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd byacc && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/byacc && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-byacc)) +@endif byacc + + + .PHONY: check-byacc maybe-check-byacc maybe-check-byacc: +@if byacc +maybe-check-byacc: check-byacc # This module is only tested in a native toolchain. check-byacc: + @: $(MAKE); $(unstage) @if [ '$(host)' = '$(target)' ] ; then \ r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd byacc && $(MAKE) $(FLAGS_TO_PASS) check); \ + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/byacc && \ + $(MAKE) $(FLAGS_TO_PASS) check); \ fi +@endif byacc .PHONY: install-byacc maybe-install-byacc maybe-install-byacc: +@if byacc +maybe-install-byacc: install-byacc install-byacc: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd byacc && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/byacc && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif byacc + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-byacc info-byacc +maybe-info-byacc: +@if byacc +maybe-info-byacc: info-byacc + +info-byacc: \ + configure-byacc + @: $(MAKE); $(unstage) + @[ -f ./byacc/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in byacc" ; \ + (cd $(HOST_SUBDIR)/byacc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif byacc + +.PHONY: maybe-dvi-byacc dvi-byacc +maybe-dvi-byacc: +@if byacc +maybe-dvi-byacc: dvi-byacc + +dvi-byacc: \ + configure-byacc + @: $(MAKE); $(unstage) + @[ -f ./byacc/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in byacc" ; \ + (cd $(HOST_SUBDIR)/byacc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif byacc + +.PHONY: maybe-html-byacc html-byacc +maybe-html-byacc: +@if byacc +maybe-html-byacc: html-byacc + +html-byacc: \ + configure-byacc + @: $(MAKE); $(unstage) + @[ -f ./byacc/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in byacc" ; \ + (cd $(HOST_SUBDIR)/byacc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif byacc + +.PHONY: maybe-TAGS-byacc TAGS-byacc +maybe-TAGS-byacc: +@if byacc +maybe-TAGS-byacc: TAGS-byacc + +TAGS-byacc: \ + configure-byacc + @: $(MAKE); $(unstage) + @[ -f ./byacc/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in byacc" ; \ + (cd $(HOST_SUBDIR)/byacc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif byacc + +.PHONY: maybe-install-info-byacc install-info-byacc +maybe-install-info-byacc: +@if byacc +maybe-install-info-byacc: install-info-byacc + +install-info-byacc: \ + configure-byacc \ + info-byacc + @: $(MAKE); $(unstage) + @[ -f ./byacc/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in byacc" ; \ + (cd $(HOST_SUBDIR)/byacc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif byacc + +.PHONY: maybe-install-html-byacc install-html-byacc +maybe-install-html-byacc: +@if byacc +maybe-install-html-byacc: install-html-byacc + +install-html-byacc: \ + configure-byacc \ + html-byacc + @: $(MAKE); $(unstage) + @[ -f ./byacc/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in byacc" ; \ + (cd $(HOST_SUBDIR)/byacc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif byacc + +.PHONY: maybe-installcheck-byacc installcheck-byacc +maybe-installcheck-byacc: +@if byacc +maybe-installcheck-byacc: installcheck-byacc + +installcheck-byacc: \ + configure-byacc + @: $(MAKE); $(unstage) + @[ -f ./byacc/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in byacc" ; \ + (cd $(HOST_SUBDIR)/byacc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif byacc + +.PHONY: maybe-mostlyclean-byacc mostlyclean-byacc +maybe-mostlyclean-byacc: +@if byacc +maybe-mostlyclean-byacc: mostlyclean-byacc + +mostlyclean-byacc: + @: $(MAKE); $(unstage) + @[ -f ./byacc/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in byacc" ; \ + (cd $(HOST_SUBDIR)/byacc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif byacc + +.PHONY: maybe-clean-byacc clean-byacc +maybe-clean-byacc: +@if byacc +maybe-clean-byacc: clean-byacc + +clean-byacc: + @: $(MAKE); $(unstage) + @[ -f ./byacc/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in byacc" ; \ + (cd $(HOST_SUBDIR)/byacc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif byacc + +.PHONY: maybe-distclean-byacc distclean-byacc +maybe-distclean-byacc: +@if byacc +maybe-distclean-byacc: distclean-byacc + +distclean-byacc: + @: $(MAKE); $(unstage) + @[ -f ./byacc/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in byacc" ; \ + (cd $(HOST_SUBDIR)/byacc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif byacc + +.PHONY: maybe-maintainer-clean-byacc maintainer-clean-byacc +maybe-maintainer-clean-byacc: +@if byacc +maybe-maintainer-clean-byacc: maintainer-clean-byacc + +maintainer-clean-byacc: + @: $(MAKE); $(unstage) + @[ -f ./byacc/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in byacc" ; \ + (cd $(HOST_SUBDIR)/byacc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif byacc + .PHONY: configure-bzip2 maybe-configure-bzip2 maybe-configure-bzip2: -configure-bzip2: - @test ! -f bzip2/Makefile || exit 0; \ - [ -d bzip2 ] || mkdir bzip2; \ - r=`${PWD_COMMAND}`; export r; \ +@if bzip2 +maybe-configure-bzip2: configure-bzip2 +configure-bzip2: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in bzip2; \ - cd bzip2 || exit 1; \ + test ! -f $(HOST_SUBDIR)/bzip2/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/bzip2 ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/bzip2; \ + cd "$(HOST_SUBDIR)/bzip2" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/bzip2"; \ - libsrcdir="$$s/bzip2";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/bzip2"; \ - libsrcdir="$$s/bzip2";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/bzip2/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/bzip2"; \ + libsrcdir="$$s/bzip2"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif bzip2 + + + + .PHONY: all-bzip2 maybe-all-bzip2 maybe-all-bzip2: +@if bzip2 +TARGET-bzip2=all +maybe-all-bzip2: all-bzip2 all-bzip2: configure-bzip2 + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd bzip2 && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/bzip2 && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-bzip2)) +@endif bzip2 + + + .PHONY: check-bzip2 maybe-check-bzip2 maybe-check-bzip2: +@if bzip2 +maybe-check-bzip2: check-bzip2 check-bzip2: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd bzip2 && $(MAKE) $(FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/bzip2 && \ + $(MAKE) $(FLAGS_TO_PASS) check) +@endif bzip2 .PHONY: install-bzip2 maybe-install-bzip2 maybe-install-bzip2: +@if bzip2 +maybe-install-bzip2: install-bzip2 install-bzip2: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd bzip2 && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/bzip2 && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif bzip2 + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-bzip2 info-bzip2 +maybe-info-bzip2: +@if bzip2 +maybe-info-bzip2: info-bzip2 + +info-bzip2: \ + configure-bzip2 + @: $(MAKE); $(unstage) + @[ -f ./bzip2/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in bzip2" ; \ + (cd $(HOST_SUBDIR)/bzip2 && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif bzip2 + +.PHONY: maybe-dvi-bzip2 dvi-bzip2 +maybe-dvi-bzip2: +@if bzip2 +maybe-dvi-bzip2: dvi-bzip2 + +dvi-bzip2: \ + configure-bzip2 + @: $(MAKE); $(unstage) + @[ -f ./bzip2/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in bzip2" ; \ + (cd $(HOST_SUBDIR)/bzip2 && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif bzip2 + +.PHONY: maybe-html-bzip2 html-bzip2 +maybe-html-bzip2: +@if bzip2 +maybe-html-bzip2: html-bzip2 + +html-bzip2: \ + configure-bzip2 + @: $(MAKE); $(unstage) + @[ -f ./bzip2/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in bzip2" ; \ + (cd $(HOST_SUBDIR)/bzip2 && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif bzip2 + +.PHONY: maybe-TAGS-bzip2 TAGS-bzip2 +maybe-TAGS-bzip2: +@if bzip2 +maybe-TAGS-bzip2: TAGS-bzip2 + +TAGS-bzip2: \ + configure-bzip2 + @: $(MAKE); $(unstage) + @[ -f ./bzip2/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in bzip2" ; \ + (cd $(HOST_SUBDIR)/bzip2 && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif bzip2 + +.PHONY: maybe-install-info-bzip2 install-info-bzip2 +maybe-install-info-bzip2: +@if bzip2 +maybe-install-info-bzip2: install-info-bzip2 + +install-info-bzip2: \ + configure-bzip2 \ + info-bzip2 + @: $(MAKE); $(unstage) + @[ -f ./bzip2/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in bzip2" ; \ + (cd $(HOST_SUBDIR)/bzip2 && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif bzip2 + +.PHONY: maybe-install-html-bzip2 install-html-bzip2 +maybe-install-html-bzip2: +@if bzip2 +maybe-install-html-bzip2: install-html-bzip2 + +install-html-bzip2: \ + configure-bzip2 \ + html-bzip2 + @: $(MAKE); $(unstage) + @[ -f ./bzip2/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in bzip2" ; \ + (cd $(HOST_SUBDIR)/bzip2 && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif bzip2 + +.PHONY: maybe-installcheck-bzip2 installcheck-bzip2 +maybe-installcheck-bzip2: +@if bzip2 +maybe-installcheck-bzip2: installcheck-bzip2 + +installcheck-bzip2: \ + configure-bzip2 + @: $(MAKE); $(unstage) + @[ -f ./bzip2/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in bzip2" ; \ + (cd $(HOST_SUBDIR)/bzip2 && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif bzip2 + +.PHONY: maybe-mostlyclean-bzip2 mostlyclean-bzip2 +maybe-mostlyclean-bzip2: +@if bzip2 +maybe-mostlyclean-bzip2: mostlyclean-bzip2 + +mostlyclean-bzip2: + @: $(MAKE); $(unstage) + @[ -f ./bzip2/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in bzip2" ; \ + (cd $(HOST_SUBDIR)/bzip2 && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif bzip2 + +.PHONY: maybe-clean-bzip2 clean-bzip2 +maybe-clean-bzip2: +@if bzip2 +maybe-clean-bzip2: clean-bzip2 + +clean-bzip2: + @: $(MAKE); $(unstage) + @[ -f ./bzip2/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in bzip2" ; \ + (cd $(HOST_SUBDIR)/bzip2 && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif bzip2 + +.PHONY: maybe-distclean-bzip2 distclean-bzip2 +maybe-distclean-bzip2: +@if bzip2 +maybe-distclean-bzip2: distclean-bzip2 + +distclean-bzip2: + @: $(MAKE); $(unstage) + @[ -f ./bzip2/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in bzip2" ; \ + (cd $(HOST_SUBDIR)/bzip2 && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif bzip2 + +.PHONY: maybe-maintainer-clean-bzip2 maintainer-clean-bzip2 +maybe-maintainer-clean-bzip2: +@if bzip2 +maybe-maintainer-clean-bzip2: maintainer-clean-bzip2 + +maintainer-clean-bzip2: + @: $(MAKE); $(unstage) + @[ -f ./bzip2/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in bzip2" ; \ + (cd $(HOST_SUBDIR)/bzip2 && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif bzip2 + .PHONY: configure-dejagnu maybe-configure-dejagnu maybe-configure-dejagnu: -configure-dejagnu: - @test ! -f dejagnu/Makefile || exit 0; \ - [ -d dejagnu ] || mkdir dejagnu; \ - r=`${PWD_COMMAND}`; export r; \ +@if dejagnu +maybe-configure-dejagnu: configure-dejagnu +configure-dejagnu: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in dejagnu; \ - cd dejagnu || exit 1; \ + test ! -f $(HOST_SUBDIR)/dejagnu/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/dejagnu ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/dejagnu; \ + cd "$(HOST_SUBDIR)/dejagnu" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/dejagnu"; \ - libsrcdir="$$s/dejagnu";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/dejagnu"; \ - libsrcdir="$$s/dejagnu";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/dejagnu/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/dejagnu"; \ + libsrcdir="$$s/dejagnu"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif dejagnu + + + + .PHONY: all-dejagnu maybe-all-dejagnu maybe-all-dejagnu: +@if dejagnu +TARGET-dejagnu=all +maybe-all-dejagnu: all-dejagnu all-dejagnu: configure-dejagnu + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd dejagnu && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/dejagnu && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-dejagnu)) +@endif dejagnu + + + .PHONY: check-dejagnu maybe-check-dejagnu maybe-check-dejagnu: +@if dejagnu +maybe-check-dejagnu: check-dejagnu check-dejagnu: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd dejagnu && $(MAKE) $(FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/dejagnu && \ + $(MAKE) $(FLAGS_TO_PASS) check) +@endif dejagnu .PHONY: install-dejagnu maybe-install-dejagnu maybe-install-dejagnu: +@if dejagnu +maybe-install-dejagnu: install-dejagnu install-dejagnu: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd dejagnu && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/dejagnu && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif dejagnu + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-dejagnu info-dejagnu +maybe-info-dejagnu: +@if dejagnu +maybe-info-dejagnu: info-dejagnu + +info-dejagnu: \ + configure-dejagnu + @: $(MAKE); $(unstage) + @[ -f ./dejagnu/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in dejagnu" ; \ + (cd $(HOST_SUBDIR)/dejagnu && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif dejagnu + +.PHONY: maybe-dvi-dejagnu dvi-dejagnu +maybe-dvi-dejagnu: +@if dejagnu +maybe-dvi-dejagnu: dvi-dejagnu + +dvi-dejagnu: \ + configure-dejagnu + @: $(MAKE); $(unstage) + @[ -f ./dejagnu/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in dejagnu" ; \ + (cd $(HOST_SUBDIR)/dejagnu && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif dejagnu + +.PHONY: maybe-html-dejagnu html-dejagnu +maybe-html-dejagnu: +@if dejagnu +maybe-html-dejagnu: html-dejagnu + +html-dejagnu: \ + configure-dejagnu + @: $(MAKE); $(unstage) + @[ -f ./dejagnu/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in dejagnu" ; \ + (cd $(HOST_SUBDIR)/dejagnu && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif dejagnu + +.PHONY: maybe-TAGS-dejagnu TAGS-dejagnu +maybe-TAGS-dejagnu: +@if dejagnu +maybe-TAGS-dejagnu: TAGS-dejagnu + +TAGS-dejagnu: \ + configure-dejagnu + @: $(MAKE); $(unstage) + @[ -f ./dejagnu/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in dejagnu" ; \ + (cd $(HOST_SUBDIR)/dejagnu && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif dejagnu + +.PHONY: maybe-install-info-dejagnu install-info-dejagnu +maybe-install-info-dejagnu: +@if dejagnu +maybe-install-info-dejagnu: install-info-dejagnu + +install-info-dejagnu: \ + configure-dejagnu \ + info-dejagnu + @: $(MAKE); $(unstage) + @[ -f ./dejagnu/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in dejagnu" ; \ + (cd $(HOST_SUBDIR)/dejagnu && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif dejagnu + +.PHONY: maybe-install-html-dejagnu install-html-dejagnu +maybe-install-html-dejagnu: +@if dejagnu +maybe-install-html-dejagnu: install-html-dejagnu + +install-html-dejagnu: \ + configure-dejagnu \ + html-dejagnu + @: $(MAKE); $(unstage) + @[ -f ./dejagnu/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in dejagnu" ; \ + (cd $(HOST_SUBDIR)/dejagnu && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif dejagnu + +.PHONY: maybe-installcheck-dejagnu installcheck-dejagnu +maybe-installcheck-dejagnu: +@if dejagnu +maybe-installcheck-dejagnu: installcheck-dejagnu + +installcheck-dejagnu: \ + configure-dejagnu + @: $(MAKE); $(unstage) + @[ -f ./dejagnu/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in dejagnu" ; \ + (cd $(HOST_SUBDIR)/dejagnu && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif dejagnu + +.PHONY: maybe-mostlyclean-dejagnu mostlyclean-dejagnu +maybe-mostlyclean-dejagnu: +@if dejagnu +maybe-mostlyclean-dejagnu: mostlyclean-dejagnu + +mostlyclean-dejagnu: + @: $(MAKE); $(unstage) + @[ -f ./dejagnu/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in dejagnu" ; \ + (cd $(HOST_SUBDIR)/dejagnu && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif dejagnu + +.PHONY: maybe-clean-dejagnu clean-dejagnu +maybe-clean-dejagnu: +@if dejagnu +maybe-clean-dejagnu: clean-dejagnu + +clean-dejagnu: + @: $(MAKE); $(unstage) + @[ -f ./dejagnu/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in dejagnu" ; \ + (cd $(HOST_SUBDIR)/dejagnu && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif dejagnu + +.PHONY: maybe-distclean-dejagnu distclean-dejagnu +maybe-distclean-dejagnu: +@if dejagnu +maybe-distclean-dejagnu: distclean-dejagnu + +distclean-dejagnu: + @: $(MAKE); $(unstage) + @[ -f ./dejagnu/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in dejagnu" ; \ + (cd $(HOST_SUBDIR)/dejagnu && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif dejagnu + +.PHONY: maybe-maintainer-clean-dejagnu maintainer-clean-dejagnu +maybe-maintainer-clean-dejagnu: +@if dejagnu +maybe-maintainer-clean-dejagnu: maintainer-clean-dejagnu + +maintainer-clean-dejagnu: + @: $(MAKE); $(unstage) + @[ -f ./dejagnu/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in dejagnu" ; \ + (cd $(HOST_SUBDIR)/dejagnu && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif dejagnu + .PHONY: configure-diff maybe-configure-diff maybe-configure-diff: -configure-diff: - @test ! -f diff/Makefile || exit 0; \ - [ -d diff ] || mkdir diff; \ - r=`${PWD_COMMAND}`; export r; \ +@if diff +maybe-configure-diff: configure-diff +configure-diff: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in diff; \ - cd diff || exit 1; \ + test ! -f $(HOST_SUBDIR)/diff/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/diff ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/diff; \ + cd "$(HOST_SUBDIR)/diff" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/diff"; \ - libsrcdir="$$s/diff";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/diff"; \ - libsrcdir="$$s/diff";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/diff/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/diff"; \ + libsrcdir="$$s/diff"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif diff + + + + .PHONY: all-diff maybe-all-diff maybe-all-diff: +@if diff +TARGET-diff=all +maybe-all-diff: all-diff all-diff: configure-diff + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd diff && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/diff && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-diff)) +@endif diff + + + .PHONY: check-diff maybe-check-diff maybe-check-diff: +@if diff +maybe-check-diff: check-diff check-diff: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd diff && $(MAKE) $(FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/diff && \ + $(MAKE) $(FLAGS_TO_PASS) check) +@endif diff .PHONY: install-diff maybe-install-diff maybe-install-diff: +@if diff +maybe-install-diff: install-diff install-diff: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd diff && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/diff && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif diff + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-diff info-diff +maybe-info-diff: +@if diff +maybe-info-diff: info-diff + +info-diff: \ + configure-diff + @: $(MAKE); $(unstage) + @[ -f ./diff/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in diff" ; \ + (cd $(HOST_SUBDIR)/diff && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif diff + +.PHONY: maybe-dvi-diff dvi-diff +maybe-dvi-diff: +@if diff +maybe-dvi-diff: dvi-diff + +dvi-diff: \ + configure-diff + @: $(MAKE); $(unstage) + @[ -f ./diff/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in diff" ; \ + (cd $(HOST_SUBDIR)/diff && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif diff + +.PHONY: maybe-html-diff html-diff +maybe-html-diff: +@if diff +maybe-html-diff: html-diff + +html-diff: \ + configure-diff + @: $(MAKE); $(unstage) + @[ -f ./diff/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in diff" ; \ + (cd $(HOST_SUBDIR)/diff && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif diff + +.PHONY: maybe-TAGS-diff TAGS-diff +maybe-TAGS-diff: +@if diff +maybe-TAGS-diff: TAGS-diff + +TAGS-diff: \ + configure-diff + @: $(MAKE); $(unstage) + @[ -f ./diff/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in diff" ; \ + (cd $(HOST_SUBDIR)/diff && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif diff + +.PHONY: maybe-install-info-diff install-info-diff +maybe-install-info-diff: +@if diff +maybe-install-info-diff: install-info-diff + +install-info-diff: \ + configure-diff \ + info-diff + @: $(MAKE); $(unstage) + @[ -f ./diff/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in diff" ; \ + (cd $(HOST_SUBDIR)/diff && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif diff + +.PHONY: maybe-install-html-diff install-html-diff +maybe-install-html-diff: +@if diff +maybe-install-html-diff: install-html-diff + +install-html-diff: \ + configure-diff \ + html-diff + @: $(MAKE); $(unstage) + @[ -f ./diff/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in diff" ; \ + (cd $(HOST_SUBDIR)/diff && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif diff + +.PHONY: maybe-installcheck-diff installcheck-diff +maybe-installcheck-diff: +@if diff +maybe-installcheck-diff: installcheck-diff + +installcheck-diff: \ + configure-diff + @: $(MAKE); $(unstage) + @[ -f ./diff/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in diff" ; \ + (cd $(HOST_SUBDIR)/diff && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif diff + +.PHONY: maybe-mostlyclean-diff mostlyclean-diff +maybe-mostlyclean-diff: +@if diff +maybe-mostlyclean-diff: mostlyclean-diff + +mostlyclean-diff: + @: $(MAKE); $(unstage) + @[ -f ./diff/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in diff" ; \ + (cd $(HOST_SUBDIR)/diff && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif diff + +.PHONY: maybe-clean-diff clean-diff +maybe-clean-diff: +@if diff +maybe-clean-diff: clean-diff + +clean-diff: + @: $(MAKE); $(unstage) + @[ -f ./diff/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in diff" ; \ + (cd $(HOST_SUBDIR)/diff && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif diff + +.PHONY: maybe-distclean-diff distclean-diff +maybe-distclean-diff: +@if diff +maybe-distclean-diff: distclean-diff + +distclean-diff: + @: $(MAKE); $(unstage) + @[ -f ./diff/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in diff" ; \ + (cd $(HOST_SUBDIR)/diff && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif diff + +.PHONY: maybe-maintainer-clean-diff maintainer-clean-diff +maybe-maintainer-clean-diff: +@if diff +maybe-maintainer-clean-diff: maintainer-clean-diff + +maintainer-clean-diff: + @: $(MAKE); $(unstage) + @[ -f ./diff/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in diff" ; \ + (cd $(HOST_SUBDIR)/diff && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif diff + .PHONY: configure-dosutils maybe-configure-dosutils maybe-configure-dosutils: -configure-dosutils: - @test ! -f dosutils/Makefile || exit 0; \ - [ -d dosutils ] || mkdir dosutils; \ - r=`${PWD_COMMAND}`; export r; \ +@if dosutils +maybe-configure-dosutils: configure-dosutils +configure-dosutils: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in dosutils; \ - cd dosutils || exit 1; \ + test ! -f $(HOST_SUBDIR)/dosutils/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/dosutils ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/dosutils; \ + cd "$(HOST_SUBDIR)/dosutils" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/dosutils"; \ - libsrcdir="$$s/dosutils";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/dosutils"; \ - libsrcdir="$$s/dosutils";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/dosutils/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/dosutils"; \ + libsrcdir="$$s/dosutils"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif dosutils + + + + .PHONY: all-dosutils maybe-all-dosutils maybe-all-dosutils: +@if dosutils +TARGET-dosutils=all +maybe-all-dosutils: all-dosutils all-dosutils: configure-dosutils + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd dosutils && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/dosutils && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-dosutils)) +@endif dosutils + + + .PHONY: check-dosutils maybe-check-dosutils maybe-check-dosutils: +@if dosutils +maybe-check-dosutils: check-dosutils check-dosutils: +@endif dosutils .PHONY: install-dosutils maybe-install-dosutils maybe-install-dosutils: +@if dosutils +maybe-install-dosutils: install-dosutils install-dosutils: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd dosutils && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/dosutils && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif dosutils + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-dosutils info-dosutils +maybe-info-dosutils: +@if dosutils +maybe-info-dosutils: info-dosutils + +info-dosutils: \ + configure-dosutils + @: $(MAKE); $(unstage) + @[ -f ./dosutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in dosutils" ; \ + (cd $(HOST_SUBDIR)/dosutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif dosutils + +.PHONY: maybe-dvi-dosutils dvi-dosutils +maybe-dvi-dosutils: +@if dosutils +maybe-dvi-dosutils: dvi-dosutils + +dvi-dosutils: \ + configure-dosutils + @: $(MAKE); $(unstage) + @[ -f ./dosutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in dosutils" ; \ + (cd $(HOST_SUBDIR)/dosutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif dosutils + +.PHONY: maybe-html-dosutils html-dosutils +maybe-html-dosutils: +@if dosutils +maybe-html-dosutils: html-dosutils + +html-dosutils: \ + configure-dosutils + @: $(MAKE); $(unstage) + @[ -f ./dosutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in dosutils" ; \ + (cd $(HOST_SUBDIR)/dosutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif dosutils + +.PHONY: maybe-TAGS-dosutils TAGS-dosutils +maybe-TAGS-dosutils: +@if dosutils +maybe-TAGS-dosutils: TAGS-dosutils + +TAGS-dosutils: \ + configure-dosutils + @: $(MAKE); $(unstage) + @[ -f ./dosutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in dosutils" ; \ + (cd $(HOST_SUBDIR)/dosutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif dosutils + +.PHONY: maybe-install-info-dosutils install-info-dosutils +maybe-install-info-dosutils: +@if dosutils +maybe-install-info-dosutils: install-info-dosutils + +install-info-dosutils: \ + configure-dosutils \ + info-dosutils + @: $(MAKE); $(unstage) + @[ -f ./dosutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in dosutils" ; \ + (cd $(HOST_SUBDIR)/dosutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif dosutils + +.PHONY: maybe-install-html-dosutils install-html-dosutils +maybe-install-html-dosutils: +@if dosutils +maybe-install-html-dosutils: install-html-dosutils + +install-html-dosutils: \ + configure-dosutils \ + html-dosutils + @: $(MAKE); $(unstage) + @[ -f ./dosutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in dosutils" ; \ + (cd $(HOST_SUBDIR)/dosutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif dosutils + +.PHONY: maybe-installcheck-dosutils installcheck-dosutils +maybe-installcheck-dosutils: +@if dosutils +maybe-installcheck-dosutils: installcheck-dosutils + +installcheck-dosutils: \ + configure-dosutils + @: $(MAKE); $(unstage) + @[ -f ./dosutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in dosutils" ; \ + (cd $(HOST_SUBDIR)/dosutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif dosutils + +.PHONY: maybe-mostlyclean-dosutils mostlyclean-dosutils +maybe-mostlyclean-dosutils: +@if dosutils +maybe-mostlyclean-dosutils: mostlyclean-dosutils + +mostlyclean-dosutils: + @: $(MAKE); $(unstage) + @[ -f ./dosutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in dosutils" ; \ + (cd $(HOST_SUBDIR)/dosutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif dosutils + +.PHONY: maybe-clean-dosutils clean-dosutils +maybe-clean-dosutils: +@if dosutils +maybe-clean-dosutils: clean-dosutils + +clean-dosutils: + @: $(MAKE); $(unstage) + @[ -f ./dosutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in dosutils" ; \ + (cd $(HOST_SUBDIR)/dosutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif dosutils + +.PHONY: maybe-distclean-dosutils distclean-dosutils +maybe-distclean-dosutils: +@if dosutils +maybe-distclean-dosutils: distclean-dosutils + +distclean-dosutils: + @: $(MAKE); $(unstage) + @[ -f ./dosutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in dosutils" ; \ + (cd $(HOST_SUBDIR)/dosutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif dosutils + +.PHONY: maybe-maintainer-clean-dosutils maintainer-clean-dosutils +maybe-maintainer-clean-dosutils: +@if dosutils +maybe-maintainer-clean-dosutils: maintainer-clean-dosutils + +maintainer-clean-dosutils: + @: $(MAKE); $(unstage) + @[ -f ./dosutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in dosutils" ; \ + (cd $(HOST_SUBDIR)/dosutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif dosutils + .PHONY: configure-etc maybe-configure-etc maybe-configure-etc: -configure-etc: - @test ! -f etc/Makefile || exit 0; \ - [ -d etc ] || mkdir etc; \ - r=`${PWD_COMMAND}`; export r; \ +@if etc +maybe-configure-etc: configure-etc +configure-etc: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in etc; \ - cd etc || exit 1; \ + test ! -f $(HOST_SUBDIR)/etc/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/etc ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/etc; \ + cd "$(HOST_SUBDIR)/etc" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/etc"; \ - libsrcdir="$$s/etc";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/etc"; \ - libsrcdir="$$s/etc";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/etc/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/etc"; \ + libsrcdir="$$s/etc"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif etc + + + + .PHONY: all-etc maybe-all-etc maybe-all-etc: +@if etc +TARGET-etc=all +maybe-all-etc: all-etc all-etc: configure-etc + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd etc && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/etc && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-etc)) +@endif etc + + + .PHONY: check-etc maybe-check-etc maybe-check-etc: +@if etc +maybe-check-etc: check-etc check-etc: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd etc && $(MAKE) $(FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/etc && \ + $(MAKE) $(FLAGS_TO_PASS) check) +@endif etc .PHONY: install-etc maybe-install-etc maybe-install-etc: +@if etc +maybe-install-etc: install-etc install-etc: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd etc && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/etc && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif etc + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-etc info-etc +maybe-info-etc: +@if etc +maybe-info-etc: info-etc + +info-etc: \ + configure-etc + @: $(MAKE); $(unstage) + @[ -f ./etc/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in etc" ; \ + (cd $(HOST_SUBDIR)/etc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif etc + +.PHONY: maybe-dvi-etc dvi-etc +maybe-dvi-etc: +@if etc +maybe-dvi-etc: dvi-etc + +dvi-etc: \ + configure-etc + @: $(MAKE); $(unstage) + @[ -f ./etc/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in etc" ; \ + (cd $(HOST_SUBDIR)/etc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif etc + +.PHONY: maybe-html-etc html-etc +maybe-html-etc: +@if etc +maybe-html-etc: html-etc + +html-etc: \ + configure-etc + @: $(MAKE); $(unstage) + @[ -f ./etc/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in etc" ; \ + (cd $(HOST_SUBDIR)/etc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif etc + +.PHONY: maybe-TAGS-etc TAGS-etc +maybe-TAGS-etc: +@if etc +maybe-TAGS-etc: TAGS-etc + +TAGS-etc: \ + configure-etc + @: $(MAKE); $(unstage) + @[ -f ./etc/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in etc" ; \ + (cd $(HOST_SUBDIR)/etc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif etc + +.PHONY: maybe-install-info-etc install-info-etc +maybe-install-info-etc: +@if etc +maybe-install-info-etc: install-info-etc + +install-info-etc: \ + configure-etc \ + info-etc + @: $(MAKE); $(unstage) + @[ -f ./etc/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in etc" ; \ + (cd $(HOST_SUBDIR)/etc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif etc + +.PHONY: maybe-install-html-etc install-html-etc +maybe-install-html-etc: +@if etc +maybe-install-html-etc: install-html-etc + +install-html-etc: \ + configure-etc \ + html-etc + @: $(MAKE); $(unstage) + @[ -f ./etc/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in etc" ; \ + (cd $(HOST_SUBDIR)/etc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif etc + +.PHONY: maybe-installcheck-etc installcheck-etc +maybe-installcheck-etc: +@if etc +maybe-installcheck-etc: installcheck-etc + +installcheck-etc: \ + configure-etc + @: $(MAKE); $(unstage) + @[ -f ./etc/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in etc" ; \ + (cd $(HOST_SUBDIR)/etc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif etc + +.PHONY: maybe-mostlyclean-etc mostlyclean-etc +maybe-mostlyclean-etc: +@if etc +maybe-mostlyclean-etc: mostlyclean-etc + +mostlyclean-etc: + @: $(MAKE); $(unstage) + @[ -f ./etc/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in etc" ; \ + (cd $(HOST_SUBDIR)/etc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif etc + +.PHONY: maybe-clean-etc clean-etc +maybe-clean-etc: +@if etc +maybe-clean-etc: clean-etc + +clean-etc: + @: $(MAKE); $(unstage) + @[ -f ./etc/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in etc" ; \ + (cd $(HOST_SUBDIR)/etc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif etc + +.PHONY: maybe-distclean-etc distclean-etc +maybe-distclean-etc: +@if etc +maybe-distclean-etc: distclean-etc + +distclean-etc: + @: $(MAKE); $(unstage) + @[ -f ./etc/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in etc" ; \ + (cd $(HOST_SUBDIR)/etc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif etc + +.PHONY: maybe-maintainer-clean-etc maintainer-clean-etc +maybe-maintainer-clean-etc: +@if etc +maybe-maintainer-clean-etc: maintainer-clean-etc + +maintainer-clean-etc: + @: $(MAKE); $(unstage) + @[ -f ./etc/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in etc" ; \ + (cd $(HOST_SUBDIR)/etc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif etc + .PHONY: configure-fastjar maybe-configure-fastjar maybe-configure-fastjar: -configure-fastjar: - @test ! -f fastjar/Makefile || exit 0; \ - [ -d fastjar ] || mkdir fastjar; \ - r=`${PWD_COMMAND}`; export r; \ +@if fastjar +maybe-configure-fastjar: configure-fastjar +configure-fastjar: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in fastjar; \ - cd fastjar || exit 1; \ + test ! -f $(HOST_SUBDIR)/fastjar/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/fastjar ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/fastjar; \ + cd "$(HOST_SUBDIR)/fastjar" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/fastjar"; \ - libsrcdir="$$s/fastjar";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/fastjar"; \ - libsrcdir="$$s/fastjar";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/fastjar/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/fastjar"; \ + libsrcdir="$$s/fastjar"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif fastjar + + + + .PHONY: all-fastjar maybe-all-fastjar maybe-all-fastjar: +@if fastjar +TARGET-fastjar=all +maybe-all-fastjar: all-fastjar all-fastjar: configure-fastjar + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd fastjar && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/fastjar && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-fastjar)) +@endif fastjar + + + .PHONY: check-fastjar maybe-check-fastjar maybe-check-fastjar: +@if fastjar +maybe-check-fastjar: check-fastjar # This module is only tested in a native toolchain. check-fastjar: + @: $(MAKE); $(unstage) @if [ '$(host)' = '$(target)' ] ; then \ r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd fastjar && $(MAKE) $(FLAGS_TO_PASS) check); \ + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/fastjar && \ + $(MAKE) $(FLAGS_TO_PASS) check); \ fi +@endif fastjar .PHONY: install-fastjar maybe-install-fastjar maybe-install-fastjar: +@if fastjar +maybe-install-fastjar: install-fastjar install-fastjar: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd fastjar && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/fastjar && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif fastjar + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-fastjar info-fastjar +maybe-info-fastjar: +@if fastjar +maybe-info-fastjar: info-fastjar + +info-fastjar: \ + configure-fastjar + @: $(MAKE); $(unstage) + @[ -f ./fastjar/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in fastjar" ; \ + (cd $(HOST_SUBDIR)/fastjar && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif fastjar + +.PHONY: maybe-dvi-fastjar dvi-fastjar +maybe-dvi-fastjar: +@if fastjar +maybe-dvi-fastjar: dvi-fastjar + +dvi-fastjar: \ + configure-fastjar + @: $(MAKE); $(unstage) + @[ -f ./fastjar/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in fastjar" ; \ + (cd $(HOST_SUBDIR)/fastjar && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif fastjar + +.PHONY: maybe-html-fastjar html-fastjar +maybe-html-fastjar: +@if fastjar +maybe-html-fastjar: html-fastjar + +html-fastjar: \ + configure-fastjar + @: $(MAKE); $(unstage) + @[ -f ./fastjar/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in fastjar" ; \ + (cd $(HOST_SUBDIR)/fastjar && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif fastjar + +.PHONY: maybe-TAGS-fastjar TAGS-fastjar +maybe-TAGS-fastjar: +@if fastjar +maybe-TAGS-fastjar: TAGS-fastjar + +TAGS-fastjar: \ + configure-fastjar + @: $(MAKE); $(unstage) + @[ -f ./fastjar/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in fastjar" ; \ + (cd $(HOST_SUBDIR)/fastjar && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif fastjar + +.PHONY: maybe-install-info-fastjar install-info-fastjar +maybe-install-info-fastjar: +@if fastjar +maybe-install-info-fastjar: install-info-fastjar + +install-info-fastjar: \ + configure-fastjar \ + info-fastjar + @: $(MAKE); $(unstage) + @[ -f ./fastjar/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in fastjar" ; \ + (cd $(HOST_SUBDIR)/fastjar && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif fastjar + +.PHONY: maybe-install-html-fastjar install-html-fastjar +maybe-install-html-fastjar: +@if fastjar +maybe-install-html-fastjar: install-html-fastjar + +install-html-fastjar: \ + configure-fastjar \ + html-fastjar + @: $(MAKE); $(unstage) + @[ -f ./fastjar/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in fastjar" ; \ + (cd $(HOST_SUBDIR)/fastjar && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif fastjar + +.PHONY: maybe-installcheck-fastjar installcheck-fastjar +maybe-installcheck-fastjar: +@if fastjar +maybe-installcheck-fastjar: installcheck-fastjar + +installcheck-fastjar: \ + configure-fastjar + @: $(MAKE); $(unstage) + @[ -f ./fastjar/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in fastjar" ; \ + (cd $(HOST_SUBDIR)/fastjar && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif fastjar + +.PHONY: maybe-mostlyclean-fastjar mostlyclean-fastjar +maybe-mostlyclean-fastjar: +@if fastjar +maybe-mostlyclean-fastjar: mostlyclean-fastjar + +mostlyclean-fastjar: + @: $(MAKE); $(unstage) + @[ -f ./fastjar/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in fastjar" ; \ + (cd $(HOST_SUBDIR)/fastjar && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif fastjar + +.PHONY: maybe-clean-fastjar clean-fastjar +maybe-clean-fastjar: +@if fastjar +maybe-clean-fastjar: clean-fastjar + +clean-fastjar: + @: $(MAKE); $(unstage) + @[ -f ./fastjar/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in fastjar" ; \ + (cd $(HOST_SUBDIR)/fastjar && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif fastjar + +.PHONY: maybe-distclean-fastjar distclean-fastjar +maybe-distclean-fastjar: +@if fastjar +maybe-distclean-fastjar: distclean-fastjar + +distclean-fastjar: + @: $(MAKE); $(unstage) + @[ -f ./fastjar/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in fastjar" ; \ + (cd $(HOST_SUBDIR)/fastjar && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif fastjar + +.PHONY: maybe-maintainer-clean-fastjar maintainer-clean-fastjar +maybe-maintainer-clean-fastjar: +@if fastjar +maybe-maintainer-clean-fastjar: maintainer-clean-fastjar + +maintainer-clean-fastjar: + @: $(MAKE); $(unstage) + @[ -f ./fastjar/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in fastjar" ; \ + (cd $(HOST_SUBDIR)/fastjar && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif fastjar + .PHONY: configure-fileutils maybe-configure-fileutils maybe-configure-fileutils: -configure-fileutils: - @test ! -f fileutils/Makefile || exit 0; \ - [ -d fileutils ] || mkdir fileutils; \ - r=`${PWD_COMMAND}`; export r; \ +@if fileutils +maybe-configure-fileutils: configure-fileutils +configure-fileutils: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in fileutils; \ - cd fileutils || exit 1; \ + test ! -f $(HOST_SUBDIR)/fileutils/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/fileutils ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/fileutils; \ + cd "$(HOST_SUBDIR)/fileutils" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/fileutils"; \ - libsrcdir="$$s/fileutils";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/fileutils"; \ - libsrcdir="$$s/fileutils";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/fileutils/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/fileutils"; \ + libsrcdir="$$s/fileutils"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif fileutils + + + + .PHONY: all-fileutils maybe-all-fileutils maybe-all-fileutils: +@if fileutils +TARGET-fileutils=all +maybe-all-fileutils: all-fileutils all-fileutils: configure-fileutils + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd fileutils && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/fileutils && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-fileutils)) +@endif fileutils + + + .PHONY: check-fileutils maybe-check-fileutils maybe-check-fileutils: +@if fileutils +maybe-check-fileutils: check-fileutils check-fileutils: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd fileutils && $(MAKE) $(FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/fileutils && \ + $(MAKE) $(FLAGS_TO_PASS) check) +@endif fileutils .PHONY: install-fileutils maybe-install-fileutils maybe-install-fileutils: +@if fileutils +maybe-install-fileutils: install-fileutils install-fileutils: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd fileutils && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/fileutils && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif fileutils + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-fileutils info-fileutils +maybe-info-fileutils: +@if fileutils +maybe-info-fileutils: info-fileutils + +info-fileutils: \ + configure-fileutils + @: $(MAKE); $(unstage) + @[ -f ./fileutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in fileutils" ; \ + (cd $(HOST_SUBDIR)/fileutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif fileutils + +.PHONY: maybe-dvi-fileutils dvi-fileutils +maybe-dvi-fileutils: +@if fileutils +maybe-dvi-fileutils: dvi-fileutils + +dvi-fileutils: \ + configure-fileutils + @: $(MAKE); $(unstage) + @[ -f ./fileutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in fileutils" ; \ + (cd $(HOST_SUBDIR)/fileutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif fileutils + +.PHONY: maybe-html-fileutils html-fileutils +maybe-html-fileutils: +@if fileutils +maybe-html-fileutils: html-fileutils + +html-fileutils: \ + configure-fileutils + @: $(MAKE); $(unstage) + @[ -f ./fileutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in fileutils" ; \ + (cd $(HOST_SUBDIR)/fileutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif fileutils + +.PHONY: maybe-TAGS-fileutils TAGS-fileutils +maybe-TAGS-fileutils: +@if fileutils +maybe-TAGS-fileutils: TAGS-fileutils + +TAGS-fileutils: \ + configure-fileutils + @: $(MAKE); $(unstage) + @[ -f ./fileutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in fileutils" ; \ + (cd $(HOST_SUBDIR)/fileutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif fileutils + +.PHONY: maybe-install-info-fileutils install-info-fileutils +maybe-install-info-fileutils: +@if fileutils +maybe-install-info-fileutils: install-info-fileutils + +install-info-fileutils: \ + configure-fileutils \ + info-fileutils + @: $(MAKE); $(unstage) + @[ -f ./fileutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in fileutils" ; \ + (cd $(HOST_SUBDIR)/fileutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif fileutils + +.PHONY: maybe-install-html-fileutils install-html-fileutils +maybe-install-html-fileutils: +@if fileutils +maybe-install-html-fileutils: install-html-fileutils + +install-html-fileutils: \ + configure-fileutils \ + html-fileutils + @: $(MAKE); $(unstage) + @[ -f ./fileutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in fileutils" ; \ + (cd $(HOST_SUBDIR)/fileutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif fileutils + +.PHONY: maybe-installcheck-fileutils installcheck-fileutils +maybe-installcheck-fileutils: +@if fileutils +maybe-installcheck-fileutils: installcheck-fileutils + +installcheck-fileutils: \ + configure-fileutils + @: $(MAKE); $(unstage) + @[ -f ./fileutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in fileutils" ; \ + (cd $(HOST_SUBDIR)/fileutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif fileutils + +.PHONY: maybe-mostlyclean-fileutils mostlyclean-fileutils +maybe-mostlyclean-fileutils: +@if fileutils +maybe-mostlyclean-fileutils: mostlyclean-fileutils + +mostlyclean-fileutils: + @: $(MAKE); $(unstage) + @[ -f ./fileutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in fileutils" ; \ + (cd $(HOST_SUBDIR)/fileutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif fileutils + +.PHONY: maybe-clean-fileutils clean-fileutils +maybe-clean-fileutils: +@if fileutils +maybe-clean-fileutils: clean-fileutils + +clean-fileutils: + @: $(MAKE); $(unstage) + @[ -f ./fileutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in fileutils" ; \ + (cd $(HOST_SUBDIR)/fileutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif fileutils + +.PHONY: maybe-distclean-fileutils distclean-fileutils +maybe-distclean-fileutils: +@if fileutils +maybe-distclean-fileutils: distclean-fileutils + +distclean-fileutils: + @: $(MAKE); $(unstage) + @[ -f ./fileutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in fileutils" ; \ + (cd $(HOST_SUBDIR)/fileutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif fileutils + +.PHONY: maybe-maintainer-clean-fileutils maintainer-clean-fileutils +maybe-maintainer-clean-fileutils: +@if fileutils +maybe-maintainer-clean-fileutils: maintainer-clean-fileutils + +maintainer-clean-fileutils: + @: $(MAKE); $(unstage) + @[ -f ./fileutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in fileutils" ; \ + (cd $(HOST_SUBDIR)/fileutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif fileutils + .PHONY: configure-findutils maybe-configure-findutils maybe-configure-findutils: -configure-findutils: - @test ! -f findutils/Makefile || exit 0; \ - [ -d findutils ] || mkdir findutils; \ - r=`${PWD_COMMAND}`; export r; \ +@if findutils +maybe-configure-findutils: configure-findutils +configure-findutils: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in findutils; \ - cd findutils || exit 1; \ + test ! -f $(HOST_SUBDIR)/findutils/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/findutils ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/findutils; \ + cd "$(HOST_SUBDIR)/findutils" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/findutils"; \ - libsrcdir="$$s/findutils";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/findutils"; \ - libsrcdir="$$s/findutils";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/findutils/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/findutils"; \ + libsrcdir="$$s/findutils"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif findutils + + + + .PHONY: all-findutils maybe-all-findutils maybe-all-findutils: +@if findutils +TARGET-findutils=all +maybe-all-findutils: all-findutils all-findutils: configure-findutils + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd findutils && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/findutils && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-findutils)) +@endif findutils + + + .PHONY: check-findutils maybe-check-findutils maybe-check-findutils: +@if findutils +maybe-check-findutils: check-findutils check-findutils: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd findutils && $(MAKE) $(FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/findutils && \ + $(MAKE) $(FLAGS_TO_PASS) check) +@endif findutils .PHONY: install-findutils maybe-install-findutils maybe-install-findutils: +@if findutils +maybe-install-findutils: install-findutils install-findutils: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd findutils && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/findutils && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif findutils + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-findutils info-findutils +maybe-info-findutils: +@if findutils +maybe-info-findutils: info-findutils + +info-findutils: \ + configure-findutils + @: $(MAKE); $(unstage) + @[ -f ./findutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in findutils" ; \ + (cd $(HOST_SUBDIR)/findutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif findutils + +.PHONY: maybe-dvi-findutils dvi-findutils +maybe-dvi-findutils: +@if findutils +maybe-dvi-findutils: dvi-findutils + +dvi-findutils: \ + configure-findutils + @: $(MAKE); $(unstage) + @[ -f ./findutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in findutils" ; \ + (cd $(HOST_SUBDIR)/findutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif findutils + +.PHONY: maybe-html-findutils html-findutils +maybe-html-findutils: +@if findutils +maybe-html-findutils: html-findutils + +html-findutils: \ + configure-findutils + @: $(MAKE); $(unstage) + @[ -f ./findutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in findutils" ; \ + (cd $(HOST_SUBDIR)/findutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif findutils + +.PHONY: maybe-TAGS-findutils TAGS-findutils +maybe-TAGS-findutils: +@if findutils +maybe-TAGS-findutils: TAGS-findutils + +TAGS-findutils: \ + configure-findutils + @: $(MAKE); $(unstage) + @[ -f ./findutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in findutils" ; \ + (cd $(HOST_SUBDIR)/findutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif findutils + +.PHONY: maybe-install-info-findutils install-info-findutils +maybe-install-info-findutils: +@if findutils +maybe-install-info-findutils: install-info-findutils + +install-info-findutils: \ + configure-findutils \ + info-findutils + @: $(MAKE); $(unstage) + @[ -f ./findutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in findutils" ; \ + (cd $(HOST_SUBDIR)/findutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif findutils + +.PHONY: maybe-install-html-findutils install-html-findutils +maybe-install-html-findutils: +@if findutils +maybe-install-html-findutils: install-html-findutils + +install-html-findutils: \ + configure-findutils \ + html-findutils + @: $(MAKE); $(unstage) + @[ -f ./findutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in findutils" ; \ + (cd $(HOST_SUBDIR)/findutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif findutils + +.PHONY: maybe-installcheck-findutils installcheck-findutils +maybe-installcheck-findutils: +@if findutils +maybe-installcheck-findutils: installcheck-findutils + +installcheck-findutils: \ + configure-findutils + @: $(MAKE); $(unstage) + @[ -f ./findutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in findutils" ; \ + (cd $(HOST_SUBDIR)/findutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif findutils + +.PHONY: maybe-mostlyclean-findutils mostlyclean-findutils +maybe-mostlyclean-findutils: +@if findutils +maybe-mostlyclean-findutils: mostlyclean-findutils + +mostlyclean-findutils: + @: $(MAKE); $(unstage) + @[ -f ./findutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in findutils" ; \ + (cd $(HOST_SUBDIR)/findutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif findutils + +.PHONY: maybe-clean-findutils clean-findutils +maybe-clean-findutils: +@if findutils +maybe-clean-findutils: clean-findutils + +clean-findutils: + @: $(MAKE); $(unstage) + @[ -f ./findutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in findutils" ; \ + (cd $(HOST_SUBDIR)/findutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif findutils + +.PHONY: maybe-distclean-findutils distclean-findutils +maybe-distclean-findutils: +@if findutils +maybe-distclean-findutils: distclean-findutils + +distclean-findutils: + @: $(MAKE); $(unstage) + @[ -f ./findutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in findutils" ; \ + (cd $(HOST_SUBDIR)/findutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif findutils + +.PHONY: maybe-maintainer-clean-findutils maintainer-clean-findutils +maybe-maintainer-clean-findutils: +@if findutils +maybe-maintainer-clean-findutils: maintainer-clean-findutils + +maintainer-clean-findutils: + @: $(MAKE); $(unstage) + @[ -f ./findutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in findutils" ; \ + (cd $(HOST_SUBDIR)/findutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif findutils + .PHONY: configure-find maybe-configure-find maybe-configure-find: -configure-find: - @test ! -f find/Makefile || exit 0; \ - [ -d find ] || mkdir find; \ - r=`${PWD_COMMAND}`; export r; \ +@if find +maybe-configure-find: configure-find +configure-find: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in find; \ - cd find || exit 1; \ + test ! -f $(HOST_SUBDIR)/find/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/find ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/find; \ + cd "$(HOST_SUBDIR)/find" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/find"; \ - libsrcdir="$$s/find";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/find"; \ - libsrcdir="$$s/find";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/find/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/find"; \ + libsrcdir="$$s/find"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif find + + + + .PHONY: all-find maybe-all-find maybe-all-find: +@if find +TARGET-find=all +maybe-all-find: all-find all-find: configure-find + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd find && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/find && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-find)) +@endif find + + + .PHONY: check-find maybe-check-find maybe-check-find: +@if find +maybe-check-find: check-find check-find: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd find && $(MAKE) $(FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/find && \ + $(MAKE) $(FLAGS_TO_PASS) check) +@endif find .PHONY: install-find maybe-install-find maybe-install-find: +@if find +maybe-install-find: install-find install-find: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd find && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/find && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif find + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-find info-find +maybe-info-find: +@if find +maybe-info-find: info-find + +info-find: \ + configure-find + @: $(MAKE); $(unstage) + @[ -f ./find/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in find" ; \ + (cd $(HOST_SUBDIR)/find && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif find + +.PHONY: maybe-dvi-find dvi-find +maybe-dvi-find: +@if find +maybe-dvi-find: dvi-find + +dvi-find: \ + configure-find + @: $(MAKE); $(unstage) + @[ -f ./find/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in find" ; \ + (cd $(HOST_SUBDIR)/find && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif find + +.PHONY: maybe-html-find html-find +maybe-html-find: +@if find +maybe-html-find: html-find + +html-find: \ + configure-find + @: $(MAKE); $(unstage) + @[ -f ./find/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in find" ; \ + (cd $(HOST_SUBDIR)/find && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif find + +.PHONY: maybe-TAGS-find TAGS-find +maybe-TAGS-find: +@if find +maybe-TAGS-find: TAGS-find + +TAGS-find: \ + configure-find + @: $(MAKE); $(unstage) + @[ -f ./find/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in find" ; \ + (cd $(HOST_SUBDIR)/find && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif find + +.PHONY: maybe-install-info-find install-info-find +maybe-install-info-find: +@if find +maybe-install-info-find: install-info-find + +install-info-find: \ + configure-find \ + info-find + @: $(MAKE); $(unstage) + @[ -f ./find/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in find" ; \ + (cd $(HOST_SUBDIR)/find && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif find + +.PHONY: maybe-install-html-find install-html-find +maybe-install-html-find: +@if find +maybe-install-html-find: install-html-find + +install-html-find: \ + configure-find \ + html-find + @: $(MAKE); $(unstage) + @[ -f ./find/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in find" ; \ + (cd $(HOST_SUBDIR)/find && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif find + +.PHONY: maybe-installcheck-find installcheck-find +maybe-installcheck-find: +@if find +maybe-installcheck-find: installcheck-find + +installcheck-find: \ + configure-find + @: $(MAKE); $(unstage) + @[ -f ./find/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in find" ; \ + (cd $(HOST_SUBDIR)/find && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif find + +.PHONY: maybe-mostlyclean-find mostlyclean-find +maybe-mostlyclean-find: +@if find +maybe-mostlyclean-find: mostlyclean-find + +mostlyclean-find: + @: $(MAKE); $(unstage) + @[ -f ./find/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in find" ; \ + (cd $(HOST_SUBDIR)/find && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif find + +.PHONY: maybe-clean-find clean-find +maybe-clean-find: +@if find +maybe-clean-find: clean-find + +clean-find: + @: $(MAKE); $(unstage) + @[ -f ./find/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in find" ; \ + (cd $(HOST_SUBDIR)/find && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif find + +.PHONY: maybe-distclean-find distclean-find +maybe-distclean-find: +@if find +maybe-distclean-find: distclean-find + +distclean-find: + @: $(MAKE); $(unstage) + @[ -f ./find/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in find" ; \ + (cd $(HOST_SUBDIR)/find && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif find + +.PHONY: maybe-maintainer-clean-find maintainer-clean-find +maybe-maintainer-clean-find: +@if find +maybe-maintainer-clean-find: maintainer-clean-find + +maintainer-clean-find: + @: $(MAKE); $(unstage) + @[ -f ./find/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in find" ; \ + (cd $(HOST_SUBDIR)/find && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif find + + + +.PHONY: configure-fixincludes maybe-configure-fixincludes +maybe-configure-fixincludes: +@if fixincludes +maybe-configure-fixincludes: configure-fixincludes +configure-fixincludes: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/fixincludes/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/fixincludes ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/fixincludes; \ + cd "$(HOST_SUBDIR)/fixincludes" || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/fixincludes/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/fixincludes"; \ + libsrcdir="$$s/fixincludes"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + || exit 1 +@endif fixincludes + + + + + +.PHONY: all-fixincludes maybe-all-fixincludes +maybe-all-fixincludes: +@if fixincludes +TARGET-fixincludes=all +maybe-all-fixincludes: all-fixincludes +all-fixincludes: configure-fixincludes + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/fixincludes && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-fixincludes)) +@endif fixincludes + + + + +.PHONY: check-fixincludes maybe-check-fixincludes +maybe-check-fixincludes: +@if fixincludes +maybe-check-fixincludes: check-fixincludes + +check-fixincludes: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/fixincludes && \ + $(MAKE) $(FLAGS_TO_PASS) check) + +@endif fixincludes + +.PHONY: install-fixincludes maybe-install-fixincludes +maybe-install-fixincludes: +@if fixincludes +maybe-install-fixincludes: install-fixincludes + +install-fixincludes: installdirs + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/fixincludes && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif fixincludes + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-fixincludes info-fixincludes +maybe-info-fixincludes: +@if fixincludes +maybe-info-fixincludes: info-fixincludes + +# fixincludes doesn't support info. +info-fixincludes: + +@endif fixincludes + +.PHONY: maybe-dvi-fixincludes dvi-fixincludes +maybe-dvi-fixincludes: +@if fixincludes +maybe-dvi-fixincludes: dvi-fixincludes + +# fixincludes doesn't support dvi. +dvi-fixincludes: + +@endif fixincludes + +.PHONY: maybe-html-fixincludes html-fixincludes +maybe-html-fixincludes: +@if fixincludes +maybe-html-fixincludes: html-fixincludes + +html-fixincludes: \ + configure-fixincludes + @: $(MAKE); $(unstage) + @[ -f ./fixincludes/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in fixincludes" ; \ + (cd $(HOST_SUBDIR)/fixincludes && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif fixincludes + +.PHONY: maybe-TAGS-fixincludes TAGS-fixincludes +maybe-TAGS-fixincludes: +@if fixincludes +maybe-TAGS-fixincludes: TAGS-fixincludes + +# fixincludes doesn't support TAGS. +TAGS-fixincludes: + +@endif fixincludes + +.PHONY: maybe-install-info-fixincludes install-info-fixincludes +maybe-install-info-fixincludes: +@if fixincludes +maybe-install-info-fixincludes: install-info-fixincludes + +# fixincludes doesn't support install-info. +install-info-fixincludes: + +@endif fixincludes + +.PHONY: maybe-install-html-fixincludes install-html-fixincludes +maybe-install-html-fixincludes: +@if fixincludes +maybe-install-html-fixincludes: install-html-fixincludes + +install-html-fixincludes: \ + configure-fixincludes \ + html-fixincludes + @: $(MAKE); $(unstage) + @[ -f ./fixincludes/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in fixincludes" ; \ + (cd $(HOST_SUBDIR)/fixincludes && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif fixincludes + +.PHONY: maybe-installcheck-fixincludes installcheck-fixincludes +maybe-installcheck-fixincludes: +@if fixincludes +maybe-installcheck-fixincludes: installcheck-fixincludes + +# fixincludes doesn't support installcheck. +installcheck-fixincludes: + +@endif fixincludes + +.PHONY: maybe-mostlyclean-fixincludes mostlyclean-fixincludes +maybe-mostlyclean-fixincludes: +@if fixincludes +maybe-mostlyclean-fixincludes: mostlyclean-fixincludes + +mostlyclean-fixincludes: + @: $(MAKE); $(unstage) + @[ -f ./fixincludes/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in fixincludes" ; \ + (cd $(HOST_SUBDIR)/fixincludes && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif fixincludes + +.PHONY: maybe-clean-fixincludes clean-fixincludes +maybe-clean-fixincludes: +@if fixincludes +maybe-clean-fixincludes: clean-fixincludes + +clean-fixincludes: + @: $(MAKE); $(unstage) + @[ -f ./fixincludes/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in fixincludes" ; \ + (cd $(HOST_SUBDIR)/fixincludes && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif fixincludes + +.PHONY: maybe-distclean-fixincludes distclean-fixincludes +maybe-distclean-fixincludes: +@if fixincludes +maybe-distclean-fixincludes: distclean-fixincludes + +distclean-fixincludes: + @: $(MAKE); $(unstage) + @[ -f ./fixincludes/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in fixincludes" ; \ + (cd $(HOST_SUBDIR)/fixincludes && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif fixincludes + +.PHONY: maybe-maintainer-clean-fixincludes maintainer-clean-fixincludes +maybe-maintainer-clean-fixincludes: +@if fixincludes +maybe-maintainer-clean-fixincludes: maintainer-clean-fixincludes + +maintainer-clean-fixincludes: + @: $(MAKE); $(unstage) + @[ -f ./fixincludes/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in fixincludes" ; \ + (cd $(HOST_SUBDIR)/fixincludes && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif fixincludes + .PHONY: configure-flex maybe-configure-flex maybe-configure-flex: -configure-flex: - @test ! -f flex/Makefile || exit 0; \ - [ -d flex ] || mkdir flex; \ - r=`${PWD_COMMAND}`; export r; \ +@if flex +maybe-configure-flex: configure-flex +configure-flex: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in flex; \ - cd flex || exit 1; \ + test ! -f $(HOST_SUBDIR)/flex/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/flex ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/flex; \ + cd "$(HOST_SUBDIR)/flex" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/flex"; \ - libsrcdir="$$s/flex";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/flex"; \ - libsrcdir="$$s/flex";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/flex/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/flex"; \ + libsrcdir="$$s/flex"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif flex + + + + .PHONY: all-flex maybe-all-flex maybe-all-flex: +@if flex +TARGET-flex=all +maybe-all-flex: all-flex all-flex: configure-flex + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd flex && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/flex && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-flex)) +@endif flex + + + .PHONY: check-flex maybe-check-flex maybe-check-flex: +@if flex +maybe-check-flex: check-flex # This module is only tested in a native toolchain. check-flex: + @: $(MAKE); $(unstage) @if [ '$(host)' = '$(target)' ] ; then \ r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd flex && $(MAKE) $(FLAGS_TO_PASS) check); \ + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/flex && \ + $(MAKE) $(FLAGS_TO_PASS) check); \ fi +@endif flex .PHONY: install-flex maybe-install-flex maybe-install-flex: +@if flex +maybe-install-flex: install-flex install-flex: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd flex && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/flex && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif flex + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-flex info-flex +maybe-info-flex: +@if flex +maybe-info-flex: info-flex + +info-flex: \ + configure-flex + @: $(MAKE); $(unstage) + @[ -f ./flex/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in flex" ; \ + (cd $(HOST_SUBDIR)/flex && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif flex + +.PHONY: maybe-dvi-flex dvi-flex +maybe-dvi-flex: +@if flex +maybe-dvi-flex: dvi-flex + +dvi-flex: \ + configure-flex + @: $(MAKE); $(unstage) + @[ -f ./flex/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in flex" ; \ + (cd $(HOST_SUBDIR)/flex && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif flex + +.PHONY: maybe-html-flex html-flex +maybe-html-flex: +@if flex +maybe-html-flex: html-flex + +html-flex: \ + configure-flex + @: $(MAKE); $(unstage) + @[ -f ./flex/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in flex" ; \ + (cd $(HOST_SUBDIR)/flex && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif flex + +.PHONY: maybe-TAGS-flex TAGS-flex +maybe-TAGS-flex: +@if flex +maybe-TAGS-flex: TAGS-flex + +TAGS-flex: \ + configure-flex + @: $(MAKE); $(unstage) + @[ -f ./flex/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in flex" ; \ + (cd $(HOST_SUBDIR)/flex && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif flex + +.PHONY: maybe-install-info-flex install-info-flex +maybe-install-info-flex: +@if flex +maybe-install-info-flex: install-info-flex + +install-info-flex: \ + configure-flex \ + info-flex + @: $(MAKE); $(unstage) + @[ -f ./flex/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in flex" ; \ + (cd $(HOST_SUBDIR)/flex && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif flex + +.PHONY: maybe-install-html-flex install-html-flex +maybe-install-html-flex: +@if flex +maybe-install-html-flex: install-html-flex + +install-html-flex: \ + configure-flex \ + html-flex + @: $(MAKE); $(unstage) + @[ -f ./flex/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in flex" ; \ + (cd $(HOST_SUBDIR)/flex && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif flex + +.PHONY: maybe-installcheck-flex installcheck-flex +maybe-installcheck-flex: +@if flex +maybe-installcheck-flex: installcheck-flex + +installcheck-flex: \ + configure-flex + @: $(MAKE); $(unstage) + @[ -f ./flex/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in flex" ; \ + (cd $(HOST_SUBDIR)/flex && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif flex + +.PHONY: maybe-mostlyclean-flex mostlyclean-flex +maybe-mostlyclean-flex: +@if flex +maybe-mostlyclean-flex: mostlyclean-flex + +mostlyclean-flex: + @: $(MAKE); $(unstage) + @[ -f ./flex/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in flex" ; \ + (cd $(HOST_SUBDIR)/flex && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif flex + +.PHONY: maybe-clean-flex clean-flex +maybe-clean-flex: +@if flex +maybe-clean-flex: clean-flex + +clean-flex: + @: $(MAKE); $(unstage) + @[ -f ./flex/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in flex" ; \ + (cd $(HOST_SUBDIR)/flex && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif flex + +.PHONY: maybe-distclean-flex distclean-flex +maybe-distclean-flex: +@if flex +maybe-distclean-flex: distclean-flex + +distclean-flex: + @: $(MAKE); $(unstage) + @[ -f ./flex/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in flex" ; \ + (cd $(HOST_SUBDIR)/flex && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif flex + +.PHONY: maybe-maintainer-clean-flex maintainer-clean-flex +maybe-maintainer-clean-flex: +@if flex +maybe-maintainer-clean-flex: maintainer-clean-flex + +maintainer-clean-flex: + @: $(MAKE); $(unstage) + @[ -f ./flex/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in flex" ; \ + (cd $(HOST_SUBDIR)/flex && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif flex + .PHONY: configure-gas maybe-configure-gas maybe-configure-gas: -configure-gas: - @test ! -f gas/Makefile || exit 0; \ - [ -d gas ] || mkdir gas; \ - r=`${PWD_COMMAND}`; export r; \ +@if gas +maybe-configure-gas: configure-gas +configure-gas: +@endif gas +@if gas-bootstrap + @if test -f stage_last; then $(unstage); else $(MAKE) stage1-start; fi +@endif gas-bootstrap +@if gas + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in gas; \ - cd gas || exit 1; \ + test ! -f $(HOST_SUBDIR)/gas/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gas ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/gas; \ + cd "$(HOST_SUBDIR)/gas" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/gas"; \ - libsrcdir="$$s/gas";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/gas"; \ - libsrcdir="$$s/gas";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/gas/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/gas"; \ + libsrcdir="$$s/gas"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + || exit 1 +@endif gas + + + +.PHONY: configure-stage1-gas maybe-configure-stage1-gas +maybe-configure-stage1-gas: +@if gas-bootstrap +maybe-configure-stage1-gas: configure-stage1-gas +configure-stage1-gas: + @[ $(current_stage) = stage1 ] || $(MAKE) stage1-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gas + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/gas/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + echo Configuring stage 1 in $(HOST_SUBDIR)/gas ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gas ; \ + cd $(HOST_SUBDIR)/gas || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/gas/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/gas"; \ + libsrcdir="$$s/gas"; \ $(SHELL) $${libsrcdir}/configure \ $(HOST_CONFIGARGS) $${srcdiroption} \ - || exit 1 + --disable-intermodule --disable-coverage --enable-languages="$(STAGE1_LANGUAGES)" +@endif gas-bootstrap + +.PHONY: configure-stage2-gas maybe-configure-stage2-gas +maybe-configure-stage2-gas: +@if gas-bootstrap +maybe-configure-stage2-gas: configure-stage2-gas +configure-stage2-gas: + @[ $(current_stage) = stage2 ] || $(MAKE) stage2-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gas + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/gas/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage 2 in $(HOST_SUBDIR)/gas ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gas ; \ + cd $(HOST_SUBDIR)/gas || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/gas/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/gas"; \ + libsrcdir="$$s/gas"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif gas-bootstrap + +.PHONY: configure-stage3-gas maybe-configure-stage3-gas +maybe-configure-stage3-gas: +@if gas-bootstrap +maybe-configure-stage3-gas: configure-stage3-gas +configure-stage3-gas: + @[ $(current_stage) = stage3 ] || $(MAKE) stage3-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gas + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/gas/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage 3 in $(HOST_SUBDIR)/gas ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gas ; \ + cd $(HOST_SUBDIR)/gas || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/gas/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/gas"; \ + libsrcdir="$$s/gas"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif gas-bootstrap + +.PHONY: configure-stage4-gas maybe-configure-stage4-gas +maybe-configure-stage4-gas: +@if gas-bootstrap +maybe-configure-stage4-gas: configure-stage4-gas +configure-stage4-gas: + @[ $(current_stage) = stage4 ] || $(MAKE) stage4-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gas + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/gas/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage 4 in $(HOST_SUBDIR)/gas ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gas ; \ + cd $(HOST_SUBDIR)/gas || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/gas/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/gas"; \ + libsrcdir="$$s/gas"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif gas-bootstrap + +.PHONY: configure-stageprofile-gas maybe-configure-stageprofile-gas +maybe-configure-stageprofile-gas: +@if gas-bootstrap +maybe-configure-stageprofile-gas: configure-stageprofile-gas +configure-stageprofile-gas: + @[ $(current_stage) = stageprofile ] || $(MAKE) stageprofile-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gas + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/gas/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage profile in $(HOST_SUBDIR)/gas ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gas ; \ + cd $(HOST_SUBDIR)/gas || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/gas/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/gas"; \ + libsrcdir="$$s/gas"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif gas-bootstrap + +.PHONY: configure-stagefeedback-gas maybe-configure-stagefeedback-gas +maybe-configure-stagefeedback-gas: +@if gas-bootstrap +maybe-configure-stagefeedback-gas: configure-stagefeedback-gas +configure-stagefeedback-gas: + @[ $(current_stage) = stagefeedback ] || $(MAKE) stagefeedback-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gas + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/gas/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage feedback in $(HOST_SUBDIR)/gas ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gas ; \ + cd $(HOST_SUBDIR)/gas || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/gas/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/gas"; \ + libsrcdir="$$s/gas"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif gas-bootstrap + + + + .PHONY: all-gas maybe-all-gas maybe-all-gas: +@if gas +TARGET-gas=all +maybe-all-gas: all-gas all-gas: configure-gas +@endif gas +@if gas-bootstrap + @if test -f stage_last; then $(unstage); else $(MAKE) stage1-start; fi +@endif gas-bootstrap +@if gas @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd gas && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/gas && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-gas)) +@endif gas + + + +.PHONY: all-stage1-gas maybe-all-stage1-gas +.PHONY: clean-stage1-gas maybe-clean-stage1-gas +maybe-all-stage1-gas: +maybe-clean-stage1-gas: +@if gas-bootstrap +maybe-all-stage1-gas: all-stage1-gas +all-stage1: all-stage1-gas +TARGET-stage1-gas = $(TARGET-gas) +all-stage1-gas: configure-stage1-gas + @[ $(current_stage) = stage1 ] || $(MAKE) stage1-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/gas && \ + $(MAKE) $(FLAGS_TO_PASS) CFLAGS="$(STAGE1_CFLAGS)" LIBCFLAGS="$(STAGE1_CFLAGS)" \ + $(TARGET-stage1-gas) + +maybe-clean-stage1-gas: clean-stage1-gas +clean-stage1: clean-stage1-gas +clean-stage1-gas: + @[ -f $(HOST_SUBDIR)/gas/Makefile ] || [ -f $(HOST_SUBDIR)/stage1-gas/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stage1 ] || $(MAKE) stage1-start; \ + cd $(HOST_SUBDIR)/gas && \ + $(MAKE) $(FLAGS_TO_PASS) \ + CFLAGS="$(STAGE1_CFLAGS)" LIBCFLAGS="$(STAGE1_CFLAGS)" clean +@endif gas-bootstrap + + +.PHONY: all-stage2-gas maybe-all-stage2-gas +.PHONY: clean-stage2-gas maybe-clean-stage2-gas +maybe-all-stage2-gas: +maybe-clean-stage2-gas: +@if gas-bootstrap +maybe-all-stage2-gas: all-stage2-gas +all-stage2: all-stage2-gas +TARGET-stage2-gas = $(TARGET-gas) +all-stage2-gas: configure-stage2-gas + @[ $(current_stage) = stage2 ] || $(MAKE) stage2-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/gas && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) \ + $(TARGET-stage2-gas) + +maybe-clean-stage2-gas: clean-stage2-gas +clean-stage2: clean-stage2-gas +clean-stage2-gas: + @[ -f $(HOST_SUBDIR)/gas/Makefile ] || [ -f $(HOST_SUBDIR)/stage2-gas/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stage2 ] || $(MAKE) stage2-start; \ + cd $(HOST_SUBDIR)/gas && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + clean +@endif gas-bootstrap + + +.PHONY: all-stage3-gas maybe-all-stage3-gas +.PHONY: clean-stage3-gas maybe-clean-stage3-gas +maybe-all-stage3-gas: +maybe-clean-stage3-gas: +@if gas-bootstrap +maybe-all-stage3-gas: all-stage3-gas +all-stage3: all-stage3-gas +TARGET-stage3-gas = $(TARGET-gas) +all-stage3-gas: configure-stage3-gas + @[ $(current_stage) = stage3 ] || $(MAKE) stage3-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/gas && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) \ + $(TARGET-stage3-gas) + +maybe-clean-stage3-gas: clean-stage3-gas +clean-stage3: clean-stage3-gas +clean-stage3-gas: + @[ -f $(HOST_SUBDIR)/gas/Makefile ] || [ -f $(HOST_SUBDIR)/stage3-gas/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stage3 ] || $(MAKE) stage3-start; \ + cd $(HOST_SUBDIR)/gas && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + clean +@endif gas-bootstrap + + +.PHONY: all-stage4-gas maybe-all-stage4-gas +.PHONY: clean-stage4-gas maybe-clean-stage4-gas +maybe-all-stage4-gas: +maybe-clean-stage4-gas: +@if gas-bootstrap +maybe-all-stage4-gas: all-stage4-gas +all-stage4: all-stage4-gas +TARGET-stage4-gas = $(TARGET-gas) +all-stage4-gas: configure-stage4-gas + @[ $(current_stage) = stage4 ] || $(MAKE) stage4-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/gas && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) \ + $(TARGET-stage4-gas) + +maybe-clean-stage4-gas: clean-stage4-gas +clean-stage4: clean-stage4-gas +clean-stage4-gas: + @[ -f $(HOST_SUBDIR)/gas/Makefile ] || [ -f $(HOST_SUBDIR)/stage4-gas/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stage4 ] || $(MAKE) stage4-start; \ + cd $(HOST_SUBDIR)/gas && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + clean +@endif gas-bootstrap + + +.PHONY: all-stageprofile-gas maybe-all-stageprofile-gas +.PHONY: clean-stageprofile-gas maybe-clean-stageprofile-gas +maybe-all-stageprofile-gas: +maybe-clean-stageprofile-gas: +@if gas-bootstrap +maybe-all-stageprofile-gas: all-stageprofile-gas +all-stageprofile: all-stageprofile-gas +TARGET-stageprofile-gas = $(TARGET-gas) +all-stageprofile-gas: configure-stageprofile-gas + @[ $(current_stage) = stageprofile ] || $(MAKE) stageprofile-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/gas && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) CFLAGS="$(BOOT_CFLAGS) -fprofile-generate" \ + $(TARGET-stageprofile-gas) + +maybe-clean-stageprofile-gas: clean-stageprofile-gas +clean-stageprofile: clean-stageprofile-gas +clean-stageprofile-gas: + @[ -f $(HOST_SUBDIR)/gas/Makefile ] || [ -f $(HOST_SUBDIR)/stageprofile-gas/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stageprofile ] || $(MAKE) stageprofile-start; \ + cd $(HOST_SUBDIR)/gas && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + CFLAGS="$(BOOT_CFLAGS) -fprofile-generate" clean +@endif gas-bootstrap + + +.PHONY: all-stagefeedback-gas maybe-all-stagefeedback-gas +.PHONY: clean-stagefeedback-gas maybe-clean-stagefeedback-gas +maybe-all-stagefeedback-gas: +maybe-clean-stagefeedback-gas: +@if gas-bootstrap +maybe-all-stagefeedback-gas: all-stagefeedback-gas +all-stagefeedback: all-stagefeedback-gas +TARGET-stagefeedback-gas = $(TARGET-gas) +all-stagefeedback-gas: configure-stagefeedback-gas + @[ $(current_stage) = stagefeedback ] || $(MAKE) stagefeedback-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/gas && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) CFLAGS="$(BOOT_CFLAGS) -fprofile-use" \ + $(TARGET-stagefeedback-gas) + +maybe-clean-stagefeedback-gas: clean-stagefeedback-gas +clean-stagefeedback: clean-stagefeedback-gas +clean-stagefeedback-gas: + @[ -f $(HOST_SUBDIR)/gas/Makefile ] || [ -f $(HOST_SUBDIR)/stagefeedback-gas/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stagefeedback ] || $(MAKE) stagefeedback-start; \ + cd $(HOST_SUBDIR)/gas && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + CFLAGS="$(BOOT_CFLAGS) -fprofile-use" clean +@endif gas-bootstrap + + + + .PHONY: check-gas maybe-check-gas maybe-check-gas: +@if gas +maybe-check-gas: check-gas check-gas: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd gas && $(MAKE) $(FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/gas && \ + $(MAKE) $(FLAGS_TO_PASS) check) +@endif gas .PHONY: install-gas maybe-install-gas maybe-install-gas: +@if gas +maybe-install-gas: install-gas install-gas: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd gas && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/gas && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif gas + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-gas info-gas +maybe-info-gas: +@if gas +maybe-info-gas: info-gas + +info-gas: \ + configure-gas + @[ -f ./gas/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in gas" ; \ + (cd $(HOST_SUBDIR)/gas && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif gas + +.PHONY: maybe-dvi-gas dvi-gas +maybe-dvi-gas: +@if gas +maybe-dvi-gas: dvi-gas + +dvi-gas: \ + configure-gas + @[ -f ./gas/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in gas" ; \ + (cd $(HOST_SUBDIR)/gas && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif gas + +.PHONY: maybe-html-gas html-gas +maybe-html-gas: +@if gas +maybe-html-gas: html-gas + +html-gas: \ + configure-gas + @[ -f ./gas/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in gas" ; \ + (cd $(HOST_SUBDIR)/gas && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif gas + +.PHONY: maybe-TAGS-gas TAGS-gas +maybe-TAGS-gas: +@if gas +maybe-TAGS-gas: TAGS-gas + +TAGS-gas: \ + configure-gas + @[ -f ./gas/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in gas" ; \ + (cd $(HOST_SUBDIR)/gas && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif gas + +.PHONY: maybe-install-info-gas install-info-gas +maybe-install-info-gas: +@if gas +maybe-install-info-gas: install-info-gas + +install-info-gas: \ + configure-gas \ + info-gas + @[ -f ./gas/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in gas" ; \ + (cd $(HOST_SUBDIR)/gas && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif gas + +.PHONY: maybe-install-html-gas install-html-gas +maybe-install-html-gas: +@if gas +maybe-install-html-gas: install-html-gas + +install-html-gas: \ + configure-gas \ + html-gas + @[ -f ./gas/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in gas" ; \ + (cd $(HOST_SUBDIR)/gas && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif gas + +.PHONY: maybe-installcheck-gas installcheck-gas +maybe-installcheck-gas: +@if gas +maybe-installcheck-gas: installcheck-gas + +installcheck-gas: \ + configure-gas + @[ -f ./gas/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in gas" ; \ + (cd $(HOST_SUBDIR)/gas && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif gas + +.PHONY: maybe-mostlyclean-gas mostlyclean-gas +maybe-mostlyclean-gas: +@if gas +maybe-mostlyclean-gas: mostlyclean-gas + +mostlyclean-gas: + @[ -f ./gas/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in gas" ; \ + (cd $(HOST_SUBDIR)/gas && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif gas + +.PHONY: maybe-clean-gas clean-gas +maybe-clean-gas: +@if gas +maybe-clean-gas: clean-gas + +clean-gas: + @[ -f ./gas/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in gas" ; \ + (cd $(HOST_SUBDIR)/gas && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif gas + +.PHONY: maybe-distclean-gas distclean-gas +maybe-distclean-gas: +@if gas +maybe-distclean-gas: distclean-gas + +distclean-gas: + @[ -f ./gas/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in gas" ; \ + (cd $(HOST_SUBDIR)/gas && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif gas + +.PHONY: maybe-maintainer-clean-gas maintainer-clean-gas +maybe-maintainer-clean-gas: +@if gas +maybe-maintainer-clean-gas: maintainer-clean-gas + +maintainer-clean-gas: + @[ -f ./gas/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in gas" ; \ + (cd $(HOST_SUBDIR)/gas && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif gas + + + +.PHONY: configure-gcc maybe-configure-gcc +maybe-configure-gcc: +@if gcc +maybe-configure-gcc: configure-gcc +configure-gcc: +@endif gcc +@if gcc-bootstrap + @if test -f stage_last; then $(unstage); else $(MAKE) stage1-start; fi +@endif gcc-bootstrap +@if gcc + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/gcc/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gcc ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/gcc; \ + cd "$(HOST_SUBDIR)/gcc" || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/gcc/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/gcc"; \ + libsrcdir="$$s/gcc"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + || exit 1 +@endif gcc + + + +.PHONY: configure-stage1-gcc maybe-configure-stage1-gcc +maybe-configure-stage1-gcc: +@if gcc-bootstrap +maybe-configure-stage1-gcc: configure-stage1-gcc +configure-stage1-gcc: + @[ $(current_stage) = stage1 ] || $(MAKE) stage1-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gcc + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/gcc/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + echo Configuring stage 1 in $(HOST_SUBDIR)/gcc ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gcc ; \ + cd $(HOST_SUBDIR)/gcc || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/gcc/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/gcc"; \ + libsrcdir="$$s/gcc"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + --disable-intermodule --disable-coverage --enable-languages="$(STAGE1_LANGUAGES)" +@endif gcc-bootstrap + +.PHONY: configure-stage2-gcc maybe-configure-stage2-gcc +maybe-configure-stage2-gcc: +@if gcc-bootstrap +maybe-configure-stage2-gcc: configure-stage2-gcc +configure-stage2-gcc: + @[ $(current_stage) = stage2 ] || $(MAKE) stage2-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gcc + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/gcc/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage 2 in $(HOST_SUBDIR)/gcc ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gcc ; \ + cd $(HOST_SUBDIR)/gcc || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/gcc/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/gcc"; \ + libsrcdir="$$s/gcc"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif gcc-bootstrap + +.PHONY: configure-stage3-gcc maybe-configure-stage3-gcc +maybe-configure-stage3-gcc: +@if gcc-bootstrap +maybe-configure-stage3-gcc: configure-stage3-gcc +configure-stage3-gcc: + @[ $(current_stage) = stage3 ] || $(MAKE) stage3-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gcc + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/gcc/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage 3 in $(HOST_SUBDIR)/gcc ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gcc ; \ + cd $(HOST_SUBDIR)/gcc || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/gcc/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/gcc"; \ + libsrcdir="$$s/gcc"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif gcc-bootstrap + +.PHONY: configure-stage4-gcc maybe-configure-stage4-gcc +maybe-configure-stage4-gcc: +@if gcc-bootstrap +maybe-configure-stage4-gcc: configure-stage4-gcc +configure-stage4-gcc: + @[ $(current_stage) = stage4 ] || $(MAKE) stage4-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gcc + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/gcc/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage 4 in $(HOST_SUBDIR)/gcc ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gcc ; \ + cd $(HOST_SUBDIR)/gcc || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/gcc/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/gcc"; \ + libsrcdir="$$s/gcc"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif gcc-bootstrap + +.PHONY: configure-stageprofile-gcc maybe-configure-stageprofile-gcc +maybe-configure-stageprofile-gcc: +@if gcc-bootstrap +maybe-configure-stageprofile-gcc: configure-stageprofile-gcc +configure-stageprofile-gcc: + @[ $(current_stage) = stageprofile ] || $(MAKE) stageprofile-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gcc + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/gcc/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage profile in $(HOST_SUBDIR)/gcc ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gcc ; \ + cd $(HOST_SUBDIR)/gcc || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/gcc/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/gcc"; \ + libsrcdir="$$s/gcc"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif gcc-bootstrap + +.PHONY: configure-stagefeedback-gcc maybe-configure-stagefeedback-gcc +maybe-configure-stagefeedback-gcc: +@if gcc-bootstrap +maybe-configure-stagefeedback-gcc: configure-stagefeedback-gcc +configure-stagefeedback-gcc: + @[ $(current_stage) = stagefeedback ] || $(MAKE) stagefeedback-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gcc + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/gcc/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage feedback in $(HOST_SUBDIR)/gcc ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gcc ; \ + cd $(HOST_SUBDIR)/gcc || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/gcc/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/gcc"; \ + libsrcdir="$$s/gcc"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif gcc-bootstrap + + + + + +.PHONY: all-gcc maybe-all-gcc +maybe-all-gcc: +@if gcc +TARGET-gcc=`if [ -f stage_last ]; then echo quickstrap ; else echo all; fi` +maybe-all-gcc: all-gcc +all-gcc: configure-gcc +@endif gcc +@if gcc-bootstrap + @if test -f stage_last; then $(unstage); else $(MAKE) stage1-start; fi +@endif gcc-bootstrap +@if gcc + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/gcc && \ + $(MAKE) $(FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) $(TARGET-gcc)) +@endif gcc + + + +.PHONY: all-stage1-gcc maybe-all-stage1-gcc +.PHONY: clean-stage1-gcc maybe-clean-stage1-gcc +maybe-all-stage1-gcc: +maybe-clean-stage1-gcc: +@if gcc-bootstrap +maybe-all-stage1-gcc: all-stage1-gcc +all-stage1: all-stage1-gcc +TARGET-stage1-gcc = $(TARGET-gcc) +all-stage1-gcc: configure-stage1-gcc + @[ $(current_stage) = stage1 ] || $(MAKE) stage1-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/gcc && \ + $(MAKE) $(FLAGS_TO_PASS) CFLAGS="$(STAGE1_CFLAGS)" LIBCFLAGS="$(STAGE1_CFLAGS)" $(EXTRA_GCC_FLAGS) \ + $(TARGET-stage1-gcc) + +maybe-clean-stage1-gcc: clean-stage1-gcc +clean-stage1: clean-stage1-gcc +clean-stage1-gcc: + @[ -f $(HOST_SUBDIR)/gcc/Makefile ] || [ -f $(HOST_SUBDIR)/stage1-gcc/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stage1 ] || $(MAKE) stage1-start; \ + cd $(HOST_SUBDIR)/gcc && \ + $(MAKE) $(FLAGS_TO_PASS) \ + CFLAGS="$(STAGE1_CFLAGS)" LIBCFLAGS="$(STAGE1_CFLAGS)" $(EXTRA_GCC_FLAGS) clean +@endif gcc-bootstrap + + +.PHONY: all-stage2-gcc maybe-all-stage2-gcc +.PHONY: clean-stage2-gcc maybe-clean-stage2-gcc +maybe-all-stage2-gcc: +maybe-clean-stage2-gcc: +@if gcc-bootstrap +maybe-all-stage2-gcc: all-stage2-gcc +all-stage2: all-stage2-gcc +TARGET-stage2-gcc = $(TARGET-gcc) +all-stage2-gcc: configure-stage2-gcc + @[ $(current_stage) = stage2 ] || $(MAKE) stage2-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/gcc && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) \ + $(TARGET-stage2-gcc) + +maybe-clean-stage2-gcc: clean-stage2-gcc +clean-stage2: clean-stage2-gcc +clean-stage2-gcc: + @[ -f $(HOST_SUBDIR)/gcc/Makefile ] || [ -f $(HOST_SUBDIR)/stage2-gcc/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stage2 ] || $(MAKE) stage2-start; \ + cd $(HOST_SUBDIR)/gcc && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + $(EXTRA_GCC_FLAGS) clean +@endif gcc-bootstrap + + +.PHONY: all-stage3-gcc maybe-all-stage3-gcc +.PHONY: clean-stage3-gcc maybe-clean-stage3-gcc +maybe-all-stage3-gcc: +maybe-clean-stage3-gcc: +@if gcc-bootstrap +maybe-all-stage3-gcc: all-stage3-gcc +all-stage3: all-stage3-gcc +TARGET-stage3-gcc = $(TARGET-gcc) +all-stage3-gcc: configure-stage3-gcc + @[ $(current_stage) = stage3 ] || $(MAKE) stage3-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/gcc && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) \ + $(TARGET-stage3-gcc) + +maybe-clean-stage3-gcc: clean-stage3-gcc +clean-stage3: clean-stage3-gcc +clean-stage3-gcc: + @[ -f $(HOST_SUBDIR)/gcc/Makefile ] || [ -f $(HOST_SUBDIR)/stage3-gcc/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stage3 ] || $(MAKE) stage3-start; \ + cd $(HOST_SUBDIR)/gcc && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + $(EXTRA_GCC_FLAGS) clean +@endif gcc-bootstrap + + +.PHONY: all-stage4-gcc maybe-all-stage4-gcc +.PHONY: clean-stage4-gcc maybe-clean-stage4-gcc +maybe-all-stage4-gcc: +maybe-clean-stage4-gcc: +@if gcc-bootstrap +maybe-all-stage4-gcc: all-stage4-gcc +all-stage4: all-stage4-gcc +TARGET-stage4-gcc = $(TARGET-gcc) +all-stage4-gcc: configure-stage4-gcc + @[ $(current_stage) = stage4 ] || $(MAKE) stage4-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/gcc && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) \ + $(TARGET-stage4-gcc) + +maybe-clean-stage4-gcc: clean-stage4-gcc +clean-stage4: clean-stage4-gcc +clean-stage4-gcc: + @[ -f $(HOST_SUBDIR)/gcc/Makefile ] || [ -f $(HOST_SUBDIR)/stage4-gcc/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stage4 ] || $(MAKE) stage4-start; \ + cd $(HOST_SUBDIR)/gcc && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + $(EXTRA_GCC_FLAGS) clean +@endif gcc-bootstrap + + +.PHONY: all-stageprofile-gcc maybe-all-stageprofile-gcc +.PHONY: clean-stageprofile-gcc maybe-clean-stageprofile-gcc +maybe-all-stageprofile-gcc: +maybe-clean-stageprofile-gcc: +@if gcc-bootstrap +maybe-all-stageprofile-gcc: all-stageprofile-gcc +all-stageprofile: all-stageprofile-gcc +TARGET-stageprofile-gcc = $(TARGET-gcc) +all-stageprofile-gcc: configure-stageprofile-gcc + @[ $(current_stage) = stageprofile ] || $(MAKE) stageprofile-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/gcc && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) CFLAGS="$(BOOT_CFLAGS) -fprofile-generate" $(EXTRA_GCC_FLAGS) \ + $(TARGET-stageprofile-gcc) + +maybe-clean-stageprofile-gcc: clean-stageprofile-gcc +clean-stageprofile: clean-stageprofile-gcc +clean-stageprofile-gcc: + @[ -f $(HOST_SUBDIR)/gcc/Makefile ] || [ -f $(HOST_SUBDIR)/stageprofile-gcc/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stageprofile ] || $(MAKE) stageprofile-start; \ + cd $(HOST_SUBDIR)/gcc && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + CFLAGS="$(BOOT_CFLAGS) -fprofile-generate" $(EXTRA_GCC_FLAGS) clean +@endif gcc-bootstrap + + +.PHONY: all-stagefeedback-gcc maybe-all-stagefeedback-gcc +.PHONY: clean-stagefeedback-gcc maybe-clean-stagefeedback-gcc +maybe-all-stagefeedback-gcc: +maybe-clean-stagefeedback-gcc: +@if gcc-bootstrap +maybe-all-stagefeedback-gcc: all-stagefeedback-gcc +all-stagefeedback: all-stagefeedback-gcc +TARGET-stagefeedback-gcc = $(TARGET-gcc) +all-stagefeedback-gcc: configure-stagefeedback-gcc + @[ $(current_stage) = stagefeedback ] || $(MAKE) stagefeedback-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/gcc && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) CFLAGS="$(BOOT_CFLAGS) -fprofile-use" $(EXTRA_GCC_FLAGS) \ + $(TARGET-stagefeedback-gcc) + +maybe-clean-stagefeedback-gcc: clean-stagefeedback-gcc +clean-stagefeedback: clean-stagefeedback-gcc +clean-stagefeedback-gcc: + @[ -f $(HOST_SUBDIR)/gcc/Makefile ] || [ -f $(HOST_SUBDIR)/stagefeedback-gcc/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stagefeedback ] || $(MAKE) stagefeedback-start; \ + cd $(HOST_SUBDIR)/gcc && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + CFLAGS="$(BOOT_CFLAGS) -fprofile-use" $(EXTRA_GCC_FLAGS) clean +@endif gcc-bootstrap + + + + + +.PHONY: check-gcc maybe-check-gcc +maybe-check-gcc: +@if gcc +maybe-check-gcc: check-gcc + +check-gcc: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/gcc && \ + $(MAKE) $(FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) check) + +@endif gcc + +.PHONY: install-gcc maybe-install-gcc +maybe-install-gcc: +@if gcc +maybe-install-gcc: install-gcc + +install-gcc: installdirs + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/gcc && \ + $(MAKE) $(FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS) install) + +@endif gcc + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-gcc info-gcc +maybe-info-gcc: +@if gcc +maybe-info-gcc: info-gcc + +info-gcc: \ + configure-gcc + @[ -f ./gcc/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in gcc" ; \ + (cd $(HOST_SUBDIR)/gcc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif gcc + +.PHONY: maybe-dvi-gcc dvi-gcc +maybe-dvi-gcc: +@if gcc +maybe-dvi-gcc: dvi-gcc + +dvi-gcc: \ + configure-gcc + @[ -f ./gcc/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in gcc" ; \ + (cd $(HOST_SUBDIR)/gcc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif gcc + +.PHONY: maybe-html-gcc html-gcc +maybe-html-gcc: +@if gcc +maybe-html-gcc: html-gcc + +html-gcc: \ + configure-gcc + @[ -f ./gcc/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in gcc" ; \ + (cd $(HOST_SUBDIR)/gcc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif gcc + +.PHONY: maybe-TAGS-gcc TAGS-gcc +maybe-TAGS-gcc: +@if gcc +maybe-TAGS-gcc: TAGS-gcc + +TAGS-gcc: \ + configure-gcc + @[ -f ./gcc/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in gcc" ; \ + (cd $(HOST_SUBDIR)/gcc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif gcc + +.PHONY: maybe-install-info-gcc install-info-gcc +maybe-install-info-gcc: +@if gcc +maybe-install-info-gcc: install-info-gcc + +install-info-gcc: \ + configure-gcc \ + info-gcc + @[ -f ./gcc/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in gcc" ; \ + (cd $(HOST_SUBDIR)/gcc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif gcc + +.PHONY: maybe-install-html-gcc install-html-gcc +maybe-install-html-gcc: +@if gcc +maybe-install-html-gcc: install-html-gcc + +install-html-gcc: \ + configure-gcc \ + html-gcc + @[ -f ./gcc/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in gcc" ; \ + (cd $(HOST_SUBDIR)/gcc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif gcc + +.PHONY: maybe-installcheck-gcc installcheck-gcc +maybe-installcheck-gcc: +@if gcc +maybe-installcheck-gcc: installcheck-gcc + +installcheck-gcc: \ + configure-gcc + @[ -f ./gcc/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in gcc" ; \ + (cd $(HOST_SUBDIR)/gcc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif gcc + +.PHONY: maybe-mostlyclean-gcc mostlyclean-gcc +maybe-mostlyclean-gcc: +@if gcc +maybe-mostlyclean-gcc: mostlyclean-gcc + +mostlyclean-gcc: + @[ -f ./gcc/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in gcc" ; \ + (cd $(HOST_SUBDIR)/gcc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif gcc + +.PHONY: maybe-clean-gcc clean-gcc +maybe-clean-gcc: +@if gcc +maybe-clean-gcc: clean-gcc + +clean-gcc: + @[ -f ./gcc/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in gcc" ; \ + (cd $(HOST_SUBDIR)/gcc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif gcc + +.PHONY: maybe-distclean-gcc distclean-gcc +maybe-distclean-gcc: +@if gcc +maybe-distclean-gcc: distclean-gcc + +distclean-gcc: + @[ -f ./gcc/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in gcc" ; \ + (cd $(HOST_SUBDIR)/gcc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif gcc + +.PHONY: maybe-maintainer-clean-gcc maintainer-clean-gcc +maybe-maintainer-clean-gcc: +@if gcc +maybe-maintainer-clean-gcc: maintainer-clean-gcc + +maintainer-clean-gcc: + @[ -f ./gcc/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in gcc" ; \ + (cd $(HOST_SUBDIR)/gcc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif gcc + .PHONY: configure-gawk maybe-configure-gawk maybe-configure-gawk: -configure-gawk: - @test ! -f gawk/Makefile || exit 0; \ - [ -d gawk ] || mkdir gawk; \ - r=`${PWD_COMMAND}`; export r; \ +@if gawk +maybe-configure-gawk: configure-gawk +configure-gawk: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in gawk; \ - cd gawk || exit 1; \ + test ! -f $(HOST_SUBDIR)/gawk/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gawk ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/gawk; \ + cd "$(HOST_SUBDIR)/gawk" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/gawk"; \ - libsrcdir="$$s/gawk";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/gawk"; \ - libsrcdir="$$s/gawk";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/gawk/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/gawk"; \ + libsrcdir="$$s/gawk"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif gawk + + + + .PHONY: all-gawk maybe-all-gawk maybe-all-gawk: +@if gawk +TARGET-gawk=all +maybe-all-gawk: all-gawk all-gawk: configure-gawk + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd gawk && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/gawk && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-gawk)) +@endif gawk + + + .PHONY: check-gawk maybe-check-gawk maybe-check-gawk: +@if gawk +maybe-check-gawk: check-gawk check-gawk: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd gawk && $(MAKE) $(FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/gawk && \ + $(MAKE) $(FLAGS_TO_PASS) check) +@endif gawk .PHONY: install-gawk maybe-install-gawk maybe-install-gawk: +@if gawk +maybe-install-gawk: install-gawk install-gawk: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd gawk && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/gawk && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif gawk + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-gawk info-gawk +maybe-info-gawk: +@if gawk +maybe-info-gawk: info-gawk + +info-gawk: \ + configure-gawk + @: $(MAKE); $(unstage) + @[ -f ./gawk/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in gawk" ; \ + (cd $(HOST_SUBDIR)/gawk && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif gawk + +.PHONY: maybe-dvi-gawk dvi-gawk +maybe-dvi-gawk: +@if gawk +maybe-dvi-gawk: dvi-gawk + +dvi-gawk: \ + configure-gawk + @: $(MAKE); $(unstage) + @[ -f ./gawk/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in gawk" ; \ + (cd $(HOST_SUBDIR)/gawk && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif gawk + +.PHONY: maybe-html-gawk html-gawk +maybe-html-gawk: +@if gawk +maybe-html-gawk: html-gawk + +html-gawk: \ + configure-gawk + @: $(MAKE); $(unstage) + @[ -f ./gawk/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in gawk" ; \ + (cd $(HOST_SUBDIR)/gawk && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif gawk + +.PHONY: maybe-TAGS-gawk TAGS-gawk +maybe-TAGS-gawk: +@if gawk +maybe-TAGS-gawk: TAGS-gawk + +TAGS-gawk: \ + configure-gawk + @: $(MAKE); $(unstage) + @[ -f ./gawk/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in gawk" ; \ + (cd $(HOST_SUBDIR)/gawk && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif gawk + +.PHONY: maybe-install-info-gawk install-info-gawk +maybe-install-info-gawk: +@if gawk +maybe-install-info-gawk: install-info-gawk + +install-info-gawk: \ + configure-gawk \ + info-gawk + @: $(MAKE); $(unstage) + @[ -f ./gawk/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in gawk" ; \ + (cd $(HOST_SUBDIR)/gawk && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif gawk + +.PHONY: maybe-install-html-gawk install-html-gawk +maybe-install-html-gawk: +@if gawk +maybe-install-html-gawk: install-html-gawk + +install-html-gawk: \ + configure-gawk \ + html-gawk + @: $(MAKE); $(unstage) + @[ -f ./gawk/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in gawk" ; \ + (cd $(HOST_SUBDIR)/gawk && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif gawk + +.PHONY: maybe-installcheck-gawk installcheck-gawk +maybe-installcheck-gawk: +@if gawk +maybe-installcheck-gawk: installcheck-gawk + +installcheck-gawk: \ + configure-gawk + @: $(MAKE); $(unstage) + @[ -f ./gawk/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in gawk" ; \ + (cd $(HOST_SUBDIR)/gawk && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif gawk + +.PHONY: maybe-mostlyclean-gawk mostlyclean-gawk +maybe-mostlyclean-gawk: +@if gawk +maybe-mostlyclean-gawk: mostlyclean-gawk + +mostlyclean-gawk: + @: $(MAKE); $(unstage) + @[ -f ./gawk/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in gawk" ; \ + (cd $(HOST_SUBDIR)/gawk && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif gawk + +.PHONY: maybe-clean-gawk clean-gawk +maybe-clean-gawk: +@if gawk +maybe-clean-gawk: clean-gawk + +clean-gawk: + @: $(MAKE); $(unstage) + @[ -f ./gawk/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in gawk" ; \ + (cd $(HOST_SUBDIR)/gawk && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif gawk + +.PHONY: maybe-distclean-gawk distclean-gawk +maybe-distclean-gawk: +@if gawk +maybe-distclean-gawk: distclean-gawk + +distclean-gawk: + @: $(MAKE); $(unstage) + @[ -f ./gawk/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in gawk" ; \ + (cd $(HOST_SUBDIR)/gawk && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif gawk + +.PHONY: maybe-maintainer-clean-gawk maintainer-clean-gawk +maybe-maintainer-clean-gawk: +@if gawk +maybe-maintainer-clean-gawk: maintainer-clean-gawk + +maintainer-clean-gawk: + @: $(MAKE); $(unstage) + @[ -f ./gawk/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in gawk" ; \ + (cd $(HOST_SUBDIR)/gawk && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif gawk + .PHONY: configure-gettext maybe-configure-gettext maybe-configure-gettext: -configure-gettext: - @test ! -f gettext/Makefile || exit 0; \ - [ -d gettext ] || mkdir gettext; \ - r=`${PWD_COMMAND}`; export r; \ +@if gettext +maybe-configure-gettext: configure-gettext +configure-gettext: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in gettext; \ - cd gettext || exit 1; \ + test ! -f $(HOST_SUBDIR)/gettext/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gettext ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/gettext; \ + cd "$(HOST_SUBDIR)/gettext" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/gettext"; \ - libsrcdir="$$s/gettext";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/gettext"; \ - libsrcdir="$$s/gettext";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/gettext/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/gettext"; \ + libsrcdir="$$s/gettext"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif gettext + + + + .PHONY: all-gettext maybe-all-gettext maybe-all-gettext: +@if gettext +TARGET-gettext=all +maybe-all-gettext: all-gettext all-gettext: configure-gettext + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd gettext && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/gettext && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-gettext)) +@endif gettext + + + .PHONY: check-gettext maybe-check-gettext maybe-check-gettext: +@if gettext +maybe-check-gettext: check-gettext check-gettext: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd gettext && $(MAKE) $(FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/gettext && \ + $(MAKE) $(FLAGS_TO_PASS) check) +@endif gettext .PHONY: install-gettext maybe-install-gettext maybe-install-gettext: +@if gettext +maybe-install-gettext: install-gettext install-gettext: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd gettext && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/gettext && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif gettext + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-gettext info-gettext +maybe-info-gettext: +@if gettext +maybe-info-gettext: info-gettext + +info-gettext: \ + configure-gettext + @: $(MAKE); $(unstage) + @[ -f ./gettext/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in gettext" ; \ + (cd $(HOST_SUBDIR)/gettext && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif gettext + +.PHONY: maybe-dvi-gettext dvi-gettext +maybe-dvi-gettext: +@if gettext +maybe-dvi-gettext: dvi-gettext + +dvi-gettext: \ + configure-gettext + @: $(MAKE); $(unstage) + @[ -f ./gettext/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in gettext" ; \ + (cd $(HOST_SUBDIR)/gettext && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif gettext + +.PHONY: maybe-html-gettext html-gettext +maybe-html-gettext: +@if gettext +maybe-html-gettext: html-gettext + +html-gettext: \ + configure-gettext + @: $(MAKE); $(unstage) + @[ -f ./gettext/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in gettext" ; \ + (cd $(HOST_SUBDIR)/gettext && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif gettext + +.PHONY: maybe-TAGS-gettext TAGS-gettext +maybe-TAGS-gettext: +@if gettext +maybe-TAGS-gettext: TAGS-gettext + +TAGS-gettext: \ + configure-gettext + @: $(MAKE); $(unstage) + @[ -f ./gettext/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in gettext" ; \ + (cd $(HOST_SUBDIR)/gettext && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif gettext + +.PHONY: maybe-install-info-gettext install-info-gettext +maybe-install-info-gettext: +@if gettext +maybe-install-info-gettext: install-info-gettext + +install-info-gettext: \ + configure-gettext \ + info-gettext + @: $(MAKE); $(unstage) + @[ -f ./gettext/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in gettext" ; \ + (cd $(HOST_SUBDIR)/gettext && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif gettext + +.PHONY: maybe-install-html-gettext install-html-gettext +maybe-install-html-gettext: +@if gettext +maybe-install-html-gettext: install-html-gettext + +install-html-gettext: \ + configure-gettext \ + html-gettext + @: $(MAKE); $(unstage) + @[ -f ./gettext/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in gettext" ; \ + (cd $(HOST_SUBDIR)/gettext && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif gettext + +.PHONY: maybe-installcheck-gettext installcheck-gettext +maybe-installcheck-gettext: +@if gettext +maybe-installcheck-gettext: installcheck-gettext + +installcheck-gettext: \ + configure-gettext + @: $(MAKE); $(unstage) + @[ -f ./gettext/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in gettext" ; \ + (cd $(HOST_SUBDIR)/gettext && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif gettext + +.PHONY: maybe-mostlyclean-gettext mostlyclean-gettext +maybe-mostlyclean-gettext: +@if gettext +maybe-mostlyclean-gettext: mostlyclean-gettext + +mostlyclean-gettext: + @: $(MAKE); $(unstage) + @[ -f ./gettext/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in gettext" ; \ + (cd $(HOST_SUBDIR)/gettext && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif gettext + +.PHONY: maybe-clean-gettext clean-gettext +maybe-clean-gettext: +@if gettext +maybe-clean-gettext: clean-gettext + +clean-gettext: + @: $(MAKE); $(unstage) + @[ -f ./gettext/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in gettext" ; \ + (cd $(HOST_SUBDIR)/gettext && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif gettext + +.PHONY: maybe-distclean-gettext distclean-gettext +maybe-distclean-gettext: +@if gettext +maybe-distclean-gettext: distclean-gettext + +distclean-gettext: + @: $(MAKE); $(unstage) + @[ -f ./gettext/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in gettext" ; \ + (cd $(HOST_SUBDIR)/gettext && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif gettext + +.PHONY: maybe-maintainer-clean-gettext maintainer-clean-gettext +maybe-maintainer-clean-gettext: +@if gettext +maybe-maintainer-clean-gettext: maintainer-clean-gettext + +maintainer-clean-gettext: + @: $(MAKE); $(unstage) + @[ -f ./gettext/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in gettext" ; \ + (cd $(HOST_SUBDIR)/gettext && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif gettext + .PHONY: configure-gnuserv maybe-configure-gnuserv maybe-configure-gnuserv: -configure-gnuserv: - @test ! -f gnuserv/Makefile || exit 0; \ - [ -d gnuserv ] || mkdir gnuserv; \ - r=`${PWD_COMMAND}`; export r; \ +@if gnuserv +maybe-configure-gnuserv: configure-gnuserv +configure-gnuserv: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in gnuserv; \ - cd gnuserv || exit 1; \ + test ! -f $(HOST_SUBDIR)/gnuserv/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gnuserv ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/gnuserv; \ + cd "$(HOST_SUBDIR)/gnuserv" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/gnuserv"; \ - libsrcdir="$$s/gnuserv";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/gnuserv"; \ - libsrcdir="$$s/gnuserv";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/gnuserv/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/gnuserv"; \ + libsrcdir="$$s/gnuserv"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif gnuserv + + + + .PHONY: all-gnuserv maybe-all-gnuserv maybe-all-gnuserv: +@if gnuserv +TARGET-gnuserv=all +maybe-all-gnuserv: all-gnuserv all-gnuserv: configure-gnuserv + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd gnuserv && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/gnuserv && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-gnuserv)) +@endif gnuserv + + + .PHONY: check-gnuserv maybe-check-gnuserv maybe-check-gnuserv: +@if gnuserv +maybe-check-gnuserv: check-gnuserv check-gnuserv: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd gnuserv && $(MAKE) $(FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/gnuserv && \ + $(MAKE) $(FLAGS_TO_PASS) check) +@endif gnuserv .PHONY: install-gnuserv maybe-install-gnuserv maybe-install-gnuserv: +@if gnuserv +maybe-install-gnuserv: install-gnuserv install-gnuserv: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd gnuserv && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/gnuserv && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif gnuserv + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-gnuserv info-gnuserv +maybe-info-gnuserv: +@if gnuserv +maybe-info-gnuserv: info-gnuserv + +info-gnuserv: \ + configure-gnuserv + @: $(MAKE); $(unstage) + @[ -f ./gnuserv/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in gnuserv" ; \ + (cd $(HOST_SUBDIR)/gnuserv && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif gnuserv + +.PHONY: maybe-dvi-gnuserv dvi-gnuserv +maybe-dvi-gnuserv: +@if gnuserv +maybe-dvi-gnuserv: dvi-gnuserv + +dvi-gnuserv: \ + configure-gnuserv + @: $(MAKE); $(unstage) + @[ -f ./gnuserv/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in gnuserv" ; \ + (cd $(HOST_SUBDIR)/gnuserv && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif gnuserv + +.PHONY: maybe-html-gnuserv html-gnuserv +maybe-html-gnuserv: +@if gnuserv +maybe-html-gnuserv: html-gnuserv + +html-gnuserv: \ + configure-gnuserv + @: $(MAKE); $(unstage) + @[ -f ./gnuserv/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in gnuserv" ; \ + (cd $(HOST_SUBDIR)/gnuserv && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif gnuserv + +.PHONY: maybe-TAGS-gnuserv TAGS-gnuserv +maybe-TAGS-gnuserv: +@if gnuserv +maybe-TAGS-gnuserv: TAGS-gnuserv + +TAGS-gnuserv: \ + configure-gnuserv + @: $(MAKE); $(unstage) + @[ -f ./gnuserv/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in gnuserv" ; \ + (cd $(HOST_SUBDIR)/gnuserv && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif gnuserv + +.PHONY: maybe-install-info-gnuserv install-info-gnuserv +maybe-install-info-gnuserv: +@if gnuserv +maybe-install-info-gnuserv: install-info-gnuserv + +install-info-gnuserv: \ + configure-gnuserv \ + info-gnuserv + @: $(MAKE); $(unstage) + @[ -f ./gnuserv/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in gnuserv" ; \ + (cd $(HOST_SUBDIR)/gnuserv && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif gnuserv + +.PHONY: maybe-install-html-gnuserv install-html-gnuserv +maybe-install-html-gnuserv: +@if gnuserv +maybe-install-html-gnuserv: install-html-gnuserv + +install-html-gnuserv: \ + configure-gnuserv \ + html-gnuserv + @: $(MAKE); $(unstage) + @[ -f ./gnuserv/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in gnuserv" ; \ + (cd $(HOST_SUBDIR)/gnuserv && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif gnuserv + +.PHONY: maybe-installcheck-gnuserv installcheck-gnuserv +maybe-installcheck-gnuserv: +@if gnuserv +maybe-installcheck-gnuserv: installcheck-gnuserv + +installcheck-gnuserv: \ + configure-gnuserv + @: $(MAKE); $(unstage) + @[ -f ./gnuserv/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in gnuserv" ; \ + (cd $(HOST_SUBDIR)/gnuserv && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif gnuserv + +.PHONY: maybe-mostlyclean-gnuserv mostlyclean-gnuserv +maybe-mostlyclean-gnuserv: +@if gnuserv +maybe-mostlyclean-gnuserv: mostlyclean-gnuserv + +mostlyclean-gnuserv: + @: $(MAKE); $(unstage) + @[ -f ./gnuserv/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in gnuserv" ; \ + (cd $(HOST_SUBDIR)/gnuserv && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif gnuserv + +.PHONY: maybe-clean-gnuserv clean-gnuserv +maybe-clean-gnuserv: +@if gnuserv +maybe-clean-gnuserv: clean-gnuserv + +clean-gnuserv: + @: $(MAKE); $(unstage) + @[ -f ./gnuserv/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in gnuserv" ; \ + (cd $(HOST_SUBDIR)/gnuserv && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif gnuserv + +.PHONY: maybe-distclean-gnuserv distclean-gnuserv +maybe-distclean-gnuserv: +@if gnuserv +maybe-distclean-gnuserv: distclean-gnuserv + +distclean-gnuserv: + @: $(MAKE); $(unstage) + @[ -f ./gnuserv/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in gnuserv" ; \ + (cd $(HOST_SUBDIR)/gnuserv && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif gnuserv + +.PHONY: maybe-maintainer-clean-gnuserv maintainer-clean-gnuserv +maybe-maintainer-clean-gnuserv: +@if gnuserv +maybe-maintainer-clean-gnuserv: maintainer-clean-gnuserv + +maintainer-clean-gnuserv: + @: $(MAKE); $(unstage) + @[ -f ./gnuserv/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in gnuserv" ; \ + (cd $(HOST_SUBDIR)/gnuserv && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif gnuserv + .PHONY: configure-gprof maybe-configure-gprof maybe-configure-gprof: -configure-gprof: - @test ! -f gprof/Makefile || exit 0; \ - [ -d gprof ] || mkdir gprof; \ - r=`${PWD_COMMAND}`; export r; \ +@if gprof +maybe-configure-gprof: configure-gprof +configure-gprof: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in gprof; \ - cd gprof || exit 1; \ + test ! -f $(HOST_SUBDIR)/gprof/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gprof ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/gprof; \ + cd "$(HOST_SUBDIR)/gprof" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/gprof"; \ - libsrcdir="$$s/gprof";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/gprof"; \ - libsrcdir="$$s/gprof";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/gprof/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/gprof"; \ + libsrcdir="$$s/gprof"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif gprof + + + + .PHONY: all-gprof maybe-all-gprof maybe-all-gprof: +@if gprof +TARGET-gprof=all +maybe-all-gprof: all-gprof all-gprof: configure-gprof + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd gprof && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/gprof && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-gprof)) +@endif gprof + + + .PHONY: check-gprof maybe-check-gprof maybe-check-gprof: +@if gprof +maybe-check-gprof: check-gprof check-gprof: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd gprof && $(MAKE) $(FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/gprof && \ + $(MAKE) $(FLAGS_TO_PASS) check) +@endif gprof .PHONY: install-gprof maybe-install-gprof maybe-install-gprof: +@if gprof +maybe-install-gprof: install-gprof install-gprof: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd gprof && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/gprof && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif gprof + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-gprof info-gprof +maybe-info-gprof: +@if gprof +maybe-info-gprof: info-gprof + +info-gprof: \ + configure-gprof + @: $(MAKE); $(unstage) + @[ -f ./gprof/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in gprof" ; \ + (cd $(HOST_SUBDIR)/gprof && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif gprof + +.PHONY: maybe-dvi-gprof dvi-gprof +maybe-dvi-gprof: +@if gprof +maybe-dvi-gprof: dvi-gprof + +dvi-gprof: \ + configure-gprof + @: $(MAKE); $(unstage) + @[ -f ./gprof/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in gprof" ; \ + (cd $(HOST_SUBDIR)/gprof && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif gprof + +.PHONY: maybe-html-gprof html-gprof +maybe-html-gprof: +@if gprof +maybe-html-gprof: html-gprof + +html-gprof: \ + configure-gprof + @: $(MAKE); $(unstage) + @[ -f ./gprof/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in gprof" ; \ + (cd $(HOST_SUBDIR)/gprof && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif gprof + +.PHONY: maybe-TAGS-gprof TAGS-gprof +maybe-TAGS-gprof: +@if gprof +maybe-TAGS-gprof: TAGS-gprof + +TAGS-gprof: \ + configure-gprof + @: $(MAKE); $(unstage) + @[ -f ./gprof/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in gprof" ; \ + (cd $(HOST_SUBDIR)/gprof && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif gprof + +.PHONY: maybe-install-info-gprof install-info-gprof +maybe-install-info-gprof: +@if gprof +maybe-install-info-gprof: install-info-gprof + +install-info-gprof: \ + configure-gprof \ + info-gprof + @: $(MAKE); $(unstage) + @[ -f ./gprof/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in gprof" ; \ + (cd $(HOST_SUBDIR)/gprof && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif gprof + +.PHONY: maybe-install-html-gprof install-html-gprof +maybe-install-html-gprof: +@if gprof +maybe-install-html-gprof: install-html-gprof + +install-html-gprof: \ + configure-gprof \ + html-gprof + @: $(MAKE); $(unstage) + @[ -f ./gprof/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in gprof" ; \ + (cd $(HOST_SUBDIR)/gprof && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif gprof + +.PHONY: maybe-installcheck-gprof installcheck-gprof +maybe-installcheck-gprof: +@if gprof +maybe-installcheck-gprof: installcheck-gprof + +installcheck-gprof: \ + configure-gprof + @: $(MAKE); $(unstage) + @[ -f ./gprof/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in gprof" ; \ + (cd $(HOST_SUBDIR)/gprof && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif gprof + +.PHONY: maybe-mostlyclean-gprof mostlyclean-gprof +maybe-mostlyclean-gprof: +@if gprof +maybe-mostlyclean-gprof: mostlyclean-gprof + +mostlyclean-gprof: + @: $(MAKE); $(unstage) + @[ -f ./gprof/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in gprof" ; \ + (cd $(HOST_SUBDIR)/gprof && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif gprof + +.PHONY: maybe-clean-gprof clean-gprof +maybe-clean-gprof: +@if gprof +maybe-clean-gprof: clean-gprof + +clean-gprof: + @: $(MAKE); $(unstage) + @[ -f ./gprof/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in gprof" ; \ + (cd $(HOST_SUBDIR)/gprof && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif gprof + +.PHONY: maybe-distclean-gprof distclean-gprof +maybe-distclean-gprof: +@if gprof +maybe-distclean-gprof: distclean-gprof + +distclean-gprof: + @: $(MAKE); $(unstage) + @[ -f ./gprof/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in gprof" ; \ + (cd $(HOST_SUBDIR)/gprof && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif gprof + +.PHONY: maybe-maintainer-clean-gprof maintainer-clean-gprof +maybe-maintainer-clean-gprof: +@if gprof +maybe-maintainer-clean-gprof: maintainer-clean-gprof + +maintainer-clean-gprof: + @: $(MAKE); $(unstage) + @[ -f ./gprof/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in gprof" ; \ + (cd $(HOST_SUBDIR)/gprof && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif gprof + .PHONY: configure-gzip maybe-configure-gzip maybe-configure-gzip: -configure-gzip: - @test ! -f gzip/Makefile || exit 0; \ - [ -d gzip ] || mkdir gzip; \ - r=`${PWD_COMMAND}`; export r; \ +@if gzip +maybe-configure-gzip: configure-gzip +configure-gzip: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in gzip; \ - cd gzip || exit 1; \ + test ! -f $(HOST_SUBDIR)/gzip/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gzip ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/gzip; \ + cd "$(HOST_SUBDIR)/gzip" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/gzip"; \ - libsrcdir="$$s/gzip";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/gzip"; \ - libsrcdir="$$s/gzip";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/gzip/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/gzip"; \ + libsrcdir="$$s/gzip"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif gzip + + + + .PHONY: all-gzip maybe-all-gzip maybe-all-gzip: +@if gzip +TARGET-gzip=all +maybe-all-gzip: all-gzip all-gzip: configure-gzip + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd gzip && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/gzip && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-gzip)) +@endif gzip + + + .PHONY: check-gzip maybe-check-gzip maybe-check-gzip: +@if gzip +maybe-check-gzip: check-gzip check-gzip: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd gzip && $(MAKE) $(FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/gzip && \ + $(MAKE) $(FLAGS_TO_PASS) check) +@endif gzip .PHONY: install-gzip maybe-install-gzip maybe-install-gzip: +@if gzip +maybe-install-gzip: install-gzip install-gzip: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd gzip && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/gzip && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif gzip + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-gzip info-gzip +maybe-info-gzip: +@if gzip +maybe-info-gzip: info-gzip + +info-gzip: \ + configure-gzip + @: $(MAKE); $(unstage) + @[ -f ./gzip/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in gzip" ; \ + (cd $(HOST_SUBDIR)/gzip && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif gzip + +.PHONY: maybe-dvi-gzip dvi-gzip +maybe-dvi-gzip: +@if gzip +maybe-dvi-gzip: dvi-gzip + +dvi-gzip: \ + configure-gzip + @: $(MAKE); $(unstage) + @[ -f ./gzip/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in gzip" ; \ + (cd $(HOST_SUBDIR)/gzip && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif gzip + +.PHONY: maybe-html-gzip html-gzip +maybe-html-gzip: +@if gzip +maybe-html-gzip: html-gzip + +html-gzip: \ + configure-gzip + @: $(MAKE); $(unstage) + @[ -f ./gzip/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in gzip" ; \ + (cd $(HOST_SUBDIR)/gzip && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif gzip + +.PHONY: maybe-TAGS-gzip TAGS-gzip +maybe-TAGS-gzip: +@if gzip +maybe-TAGS-gzip: TAGS-gzip + +TAGS-gzip: \ + configure-gzip + @: $(MAKE); $(unstage) + @[ -f ./gzip/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in gzip" ; \ + (cd $(HOST_SUBDIR)/gzip && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif gzip + +.PHONY: maybe-install-info-gzip install-info-gzip +maybe-install-info-gzip: +@if gzip +maybe-install-info-gzip: install-info-gzip + +install-info-gzip: \ + configure-gzip \ + info-gzip + @: $(MAKE); $(unstage) + @[ -f ./gzip/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in gzip" ; \ + (cd $(HOST_SUBDIR)/gzip && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif gzip + +.PHONY: maybe-install-html-gzip install-html-gzip +maybe-install-html-gzip: +@if gzip +maybe-install-html-gzip: install-html-gzip + +install-html-gzip: \ + configure-gzip \ + html-gzip + @: $(MAKE); $(unstage) + @[ -f ./gzip/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in gzip" ; \ + (cd $(HOST_SUBDIR)/gzip && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif gzip + +.PHONY: maybe-installcheck-gzip installcheck-gzip +maybe-installcheck-gzip: +@if gzip +maybe-installcheck-gzip: installcheck-gzip + +installcheck-gzip: \ + configure-gzip + @: $(MAKE); $(unstage) + @[ -f ./gzip/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in gzip" ; \ + (cd $(HOST_SUBDIR)/gzip && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif gzip + +.PHONY: maybe-mostlyclean-gzip mostlyclean-gzip +maybe-mostlyclean-gzip: +@if gzip +maybe-mostlyclean-gzip: mostlyclean-gzip + +mostlyclean-gzip: + @: $(MAKE); $(unstage) + @[ -f ./gzip/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in gzip" ; \ + (cd $(HOST_SUBDIR)/gzip && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif gzip + +.PHONY: maybe-clean-gzip clean-gzip +maybe-clean-gzip: +@if gzip +maybe-clean-gzip: clean-gzip + +clean-gzip: + @: $(MAKE); $(unstage) + @[ -f ./gzip/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in gzip" ; \ + (cd $(HOST_SUBDIR)/gzip && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif gzip + +.PHONY: maybe-distclean-gzip distclean-gzip +maybe-distclean-gzip: +@if gzip +maybe-distclean-gzip: distclean-gzip + +distclean-gzip: + @: $(MAKE); $(unstage) + @[ -f ./gzip/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in gzip" ; \ + (cd $(HOST_SUBDIR)/gzip && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif gzip + +.PHONY: maybe-maintainer-clean-gzip maintainer-clean-gzip +maybe-maintainer-clean-gzip: +@if gzip +maybe-maintainer-clean-gzip: maintainer-clean-gzip + +maintainer-clean-gzip: + @: $(MAKE); $(unstage) + @[ -f ./gzip/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in gzip" ; \ + (cd $(HOST_SUBDIR)/gzip && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif gzip + .PHONY: configure-hello maybe-configure-hello maybe-configure-hello: -configure-hello: - @test ! -f hello/Makefile || exit 0; \ - [ -d hello ] || mkdir hello; \ - r=`${PWD_COMMAND}`; export r; \ +@if hello +maybe-configure-hello: configure-hello +configure-hello: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in hello; \ - cd hello || exit 1; \ + test ! -f $(HOST_SUBDIR)/hello/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/hello ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/hello; \ + cd "$(HOST_SUBDIR)/hello" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/hello"; \ - libsrcdir="$$s/hello";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/hello"; \ - libsrcdir="$$s/hello";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/hello/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/hello"; \ + libsrcdir="$$s/hello"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif hello + + + + .PHONY: all-hello maybe-all-hello maybe-all-hello: +@if hello +TARGET-hello=all +maybe-all-hello: all-hello all-hello: configure-hello + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd hello && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/hello && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-hello)) +@endif hello + + + .PHONY: check-hello maybe-check-hello maybe-check-hello: +@if hello +maybe-check-hello: check-hello check-hello: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd hello && $(MAKE) $(FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/hello && \ + $(MAKE) $(FLAGS_TO_PASS) check) +@endif hello .PHONY: install-hello maybe-install-hello maybe-install-hello: +@if hello +maybe-install-hello: install-hello install-hello: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd hello && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/hello && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif hello + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-hello info-hello +maybe-info-hello: +@if hello +maybe-info-hello: info-hello + +info-hello: \ + configure-hello + @: $(MAKE); $(unstage) + @[ -f ./hello/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in hello" ; \ + (cd $(HOST_SUBDIR)/hello && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif hello + +.PHONY: maybe-dvi-hello dvi-hello +maybe-dvi-hello: +@if hello +maybe-dvi-hello: dvi-hello + +dvi-hello: \ + configure-hello + @: $(MAKE); $(unstage) + @[ -f ./hello/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in hello" ; \ + (cd $(HOST_SUBDIR)/hello && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif hello + +.PHONY: maybe-html-hello html-hello +maybe-html-hello: +@if hello +maybe-html-hello: html-hello + +html-hello: \ + configure-hello + @: $(MAKE); $(unstage) + @[ -f ./hello/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in hello" ; \ + (cd $(HOST_SUBDIR)/hello && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif hello + +.PHONY: maybe-TAGS-hello TAGS-hello +maybe-TAGS-hello: +@if hello +maybe-TAGS-hello: TAGS-hello + +TAGS-hello: \ + configure-hello + @: $(MAKE); $(unstage) + @[ -f ./hello/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in hello" ; \ + (cd $(HOST_SUBDIR)/hello && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif hello + +.PHONY: maybe-install-info-hello install-info-hello +maybe-install-info-hello: +@if hello +maybe-install-info-hello: install-info-hello + +install-info-hello: \ + configure-hello \ + info-hello + @: $(MAKE); $(unstage) + @[ -f ./hello/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in hello" ; \ + (cd $(HOST_SUBDIR)/hello && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif hello + +.PHONY: maybe-install-html-hello install-html-hello +maybe-install-html-hello: +@if hello +maybe-install-html-hello: install-html-hello + +install-html-hello: \ + configure-hello \ + html-hello + @: $(MAKE); $(unstage) + @[ -f ./hello/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in hello" ; \ + (cd $(HOST_SUBDIR)/hello && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif hello + +.PHONY: maybe-installcheck-hello installcheck-hello +maybe-installcheck-hello: +@if hello +maybe-installcheck-hello: installcheck-hello + +installcheck-hello: \ + configure-hello + @: $(MAKE); $(unstage) + @[ -f ./hello/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in hello" ; \ + (cd $(HOST_SUBDIR)/hello && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif hello + +.PHONY: maybe-mostlyclean-hello mostlyclean-hello +maybe-mostlyclean-hello: +@if hello +maybe-mostlyclean-hello: mostlyclean-hello + +mostlyclean-hello: + @: $(MAKE); $(unstage) + @[ -f ./hello/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in hello" ; \ + (cd $(HOST_SUBDIR)/hello && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif hello + +.PHONY: maybe-clean-hello clean-hello +maybe-clean-hello: +@if hello +maybe-clean-hello: clean-hello + +clean-hello: + @: $(MAKE); $(unstage) + @[ -f ./hello/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in hello" ; \ + (cd $(HOST_SUBDIR)/hello && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif hello + +.PHONY: maybe-distclean-hello distclean-hello +maybe-distclean-hello: +@if hello +maybe-distclean-hello: distclean-hello + +distclean-hello: + @: $(MAKE); $(unstage) + @[ -f ./hello/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in hello" ; \ + (cd $(HOST_SUBDIR)/hello && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif hello + +.PHONY: maybe-maintainer-clean-hello maintainer-clean-hello +maybe-maintainer-clean-hello: +@if hello +maybe-maintainer-clean-hello: maintainer-clean-hello + +maintainer-clean-hello: + @: $(MAKE); $(unstage) + @[ -f ./hello/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in hello" ; \ + (cd $(HOST_SUBDIR)/hello && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif hello + .PHONY: configure-indent maybe-configure-indent maybe-configure-indent: -configure-indent: - @test ! -f indent/Makefile || exit 0; \ - [ -d indent ] || mkdir indent; \ - r=`${PWD_COMMAND}`; export r; \ +@if indent +maybe-configure-indent: configure-indent +configure-indent: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in indent; \ - cd indent || exit 1; \ + test ! -f $(HOST_SUBDIR)/indent/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/indent ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/indent; \ + cd "$(HOST_SUBDIR)/indent" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/indent"; \ - libsrcdir="$$s/indent";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/indent"; \ - libsrcdir="$$s/indent";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/indent/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/indent"; \ + libsrcdir="$$s/indent"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif indent + + + + .PHONY: all-indent maybe-all-indent maybe-all-indent: +@if indent +TARGET-indent=all +maybe-all-indent: all-indent all-indent: configure-indent + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd indent && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/indent && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-indent)) +@endif indent + + + .PHONY: check-indent maybe-check-indent maybe-check-indent: +@if indent +maybe-check-indent: check-indent check-indent: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd indent && $(MAKE) $(FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/indent && \ + $(MAKE) $(FLAGS_TO_PASS) check) +@endif indent .PHONY: install-indent maybe-install-indent maybe-install-indent: +@if indent +maybe-install-indent: install-indent install-indent: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd indent && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/indent && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif indent + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-indent info-indent +maybe-info-indent: +@if indent +maybe-info-indent: info-indent + +info-indent: \ + configure-indent + @: $(MAKE); $(unstage) + @[ -f ./indent/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in indent" ; \ + (cd $(HOST_SUBDIR)/indent && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif indent + +.PHONY: maybe-dvi-indent dvi-indent +maybe-dvi-indent: +@if indent +maybe-dvi-indent: dvi-indent + +dvi-indent: \ + configure-indent + @: $(MAKE); $(unstage) + @[ -f ./indent/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in indent" ; \ + (cd $(HOST_SUBDIR)/indent && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif indent + +.PHONY: maybe-html-indent html-indent +maybe-html-indent: +@if indent +maybe-html-indent: html-indent + +html-indent: \ + configure-indent + @: $(MAKE); $(unstage) + @[ -f ./indent/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in indent" ; \ + (cd $(HOST_SUBDIR)/indent && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif indent + +.PHONY: maybe-TAGS-indent TAGS-indent +maybe-TAGS-indent: +@if indent +maybe-TAGS-indent: TAGS-indent + +TAGS-indent: \ + configure-indent + @: $(MAKE); $(unstage) + @[ -f ./indent/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in indent" ; \ + (cd $(HOST_SUBDIR)/indent && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif indent + +.PHONY: maybe-install-info-indent install-info-indent +maybe-install-info-indent: +@if indent +maybe-install-info-indent: install-info-indent + +install-info-indent: \ + configure-indent \ + info-indent + @: $(MAKE); $(unstage) + @[ -f ./indent/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in indent" ; \ + (cd $(HOST_SUBDIR)/indent && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif indent + +.PHONY: maybe-install-html-indent install-html-indent +maybe-install-html-indent: +@if indent +maybe-install-html-indent: install-html-indent + +install-html-indent: \ + configure-indent \ + html-indent + @: $(MAKE); $(unstage) + @[ -f ./indent/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in indent" ; \ + (cd $(HOST_SUBDIR)/indent && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif indent + +.PHONY: maybe-installcheck-indent installcheck-indent +maybe-installcheck-indent: +@if indent +maybe-installcheck-indent: installcheck-indent + +installcheck-indent: \ + configure-indent + @: $(MAKE); $(unstage) + @[ -f ./indent/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in indent" ; \ + (cd $(HOST_SUBDIR)/indent && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif indent + +.PHONY: maybe-mostlyclean-indent mostlyclean-indent +maybe-mostlyclean-indent: +@if indent +maybe-mostlyclean-indent: mostlyclean-indent + +mostlyclean-indent: + @: $(MAKE); $(unstage) + @[ -f ./indent/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in indent" ; \ + (cd $(HOST_SUBDIR)/indent && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif indent + +.PHONY: maybe-clean-indent clean-indent +maybe-clean-indent: +@if indent +maybe-clean-indent: clean-indent + +clean-indent: + @: $(MAKE); $(unstage) + @[ -f ./indent/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in indent" ; \ + (cd $(HOST_SUBDIR)/indent && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif indent + +.PHONY: maybe-distclean-indent distclean-indent +maybe-distclean-indent: +@if indent +maybe-distclean-indent: distclean-indent + +distclean-indent: + @: $(MAKE); $(unstage) + @[ -f ./indent/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in indent" ; \ + (cd $(HOST_SUBDIR)/indent && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif indent + +.PHONY: maybe-maintainer-clean-indent maintainer-clean-indent +maybe-maintainer-clean-indent: +@if indent +maybe-maintainer-clean-indent: maintainer-clean-indent + +maintainer-clean-indent: + @: $(MAKE); $(unstage) + @[ -f ./indent/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in indent" ; \ + (cd $(HOST_SUBDIR)/indent && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif indent + .PHONY: configure-intl maybe-configure-intl maybe-configure-intl: -configure-intl: - @test ! -f intl/Makefile || exit 0; \ - [ -d intl ] || mkdir intl; \ - r=`${PWD_COMMAND}`; export r; \ +@if intl +maybe-configure-intl: configure-intl +configure-intl: +@endif intl +@if intl-bootstrap + @if test -f stage_last; then $(unstage); else $(MAKE) stage1-start; fi +@endif intl-bootstrap +@if intl + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in intl; \ - cd intl || exit 1; \ + test ! -f $(HOST_SUBDIR)/intl/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/intl ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/intl; \ + cd "$(HOST_SUBDIR)/intl" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/intl"; \ - libsrcdir="$$s/intl";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/intl"; \ - libsrcdir="$$s/intl";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/intl/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/intl"; \ + libsrcdir="$$s/intl"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + || exit 1 +@endif intl + + + +.PHONY: configure-stage1-intl maybe-configure-stage1-intl +maybe-configure-stage1-intl: +@if intl-bootstrap +maybe-configure-stage1-intl: configure-stage1-intl +configure-stage1-intl: + @[ $(current_stage) = stage1 ] || $(MAKE) stage1-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/intl + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/intl/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + echo Configuring stage 1 in $(HOST_SUBDIR)/intl ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/intl ; \ + cd $(HOST_SUBDIR)/intl || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/intl/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/intl"; \ + libsrcdir="$$s/intl"; \ $(SHELL) $${libsrcdir}/configure \ $(HOST_CONFIGARGS) $${srcdiroption} \ - || exit 1 + --disable-intermodule --disable-coverage --enable-languages="$(STAGE1_LANGUAGES)" +@endif intl-bootstrap + +.PHONY: configure-stage2-intl maybe-configure-stage2-intl +maybe-configure-stage2-intl: +@if intl-bootstrap +maybe-configure-stage2-intl: configure-stage2-intl +configure-stage2-intl: + @[ $(current_stage) = stage2 ] || $(MAKE) stage2-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/intl + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/intl/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage 2 in $(HOST_SUBDIR)/intl ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/intl ; \ + cd $(HOST_SUBDIR)/intl || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/intl/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/intl"; \ + libsrcdir="$$s/intl"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif intl-bootstrap + +.PHONY: configure-stage3-intl maybe-configure-stage3-intl +maybe-configure-stage3-intl: +@if intl-bootstrap +maybe-configure-stage3-intl: configure-stage3-intl +configure-stage3-intl: + @[ $(current_stage) = stage3 ] || $(MAKE) stage3-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/intl + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/intl/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage 3 in $(HOST_SUBDIR)/intl ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/intl ; \ + cd $(HOST_SUBDIR)/intl || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/intl/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/intl"; \ + libsrcdir="$$s/intl"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif intl-bootstrap + +.PHONY: configure-stage4-intl maybe-configure-stage4-intl +maybe-configure-stage4-intl: +@if intl-bootstrap +maybe-configure-stage4-intl: configure-stage4-intl +configure-stage4-intl: + @[ $(current_stage) = stage4 ] || $(MAKE) stage4-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/intl + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/intl/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage 4 in $(HOST_SUBDIR)/intl ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/intl ; \ + cd $(HOST_SUBDIR)/intl || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/intl/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/intl"; \ + libsrcdir="$$s/intl"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif intl-bootstrap + +.PHONY: configure-stageprofile-intl maybe-configure-stageprofile-intl +maybe-configure-stageprofile-intl: +@if intl-bootstrap +maybe-configure-stageprofile-intl: configure-stageprofile-intl +configure-stageprofile-intl: + @[ $(current_stage) = stageprofile ] || $(MAKE) stageprofile-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/intl + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/intl/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage profile in $(HOST_SUBDIR)/intl ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/intl ; \ + cd $(HOST_SUBDIR)/intl || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/intl/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/intl"; \ + libsrcdir="$$s/intl"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif intl-bootstrap + +.PHONY: configure-stagefeedback-intl maybe-configure-stagefeedback-intl +maybe-configure-stagefeedback-intl: +@if intl-bootstrap +maybe-configure-stagefeedback-intl: configure-stagefeedback-intl +configure-stagefeedback-intl: + @[ $(current_stage) = stagefeedback ] || $(MAKE) stagefeedback-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/intl + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/intl/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage feedback in $(HOST_SUBDIR)/intl ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/intl ; \ + cd $(HOST_SUBDIR)/intl || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/intl/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/intl"; \ + libsrcdir="$$s/intl"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif intl-bootstrap + + + + .PHONY: all-intl maybe-all-intl maybe-all-intl: +@if intl +TARGET-intl=all +maybe-all-intl: all-intl all-intl: configure-intl +@endif intl +@if intl-bootstrap + @if test -f stage_last; then $(unstage); else $(MAKE) stage1-start; fi +@endif intl-bootstrap +@if intl @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd intl && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/intl && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-intl)) +@endif intl + + + +.PHONY: all-stage1-intl maybe-all-stage1-intl +.PHONY: clean-stage1-intl maybe-clean-stage1-intl +maybe-all-stage1-intl: +maybe-clean-stage1-intl: +@if intl-bootstrap +maybe-all-stage1-intl: all-stage1-intl +all-stage1: all-stage1-intl +TARGET-stage1-intl = $(TARGET-intl) +all-stage1-intl: configure-stage1-intl + @[ $(current_stage) = stage1 ] || $(MAKE) stage1-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/intl && \ + $(MAKE) $(FLAGS_TO_PASS) CFLAGS="$(STAGE1_CFLAGS)" LIBCFLAGS="$(STAGE1_CFLAGS)" \ + $(TARGET-stage1-intl) + +maybe-clean-stage1-intl: clean-stage1-intl +clean-stage1: clean-stage1-intl +clean-stage1-intl: + @[ -f $(HOST_SUBDIR)/intl/Makefile ] || [ -f $(HOST_SUBDIR)/stage1-intl/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stage1 ] || $(MAKE) stage1-start; \ + cd $(HOST_SUBDIR)/intl && \ + $(MAKE) $(FLAGS_TO_PASS) \ + CFLAGS="$(STAGE1_CFLAGS)" LIBCFLAGS="$(STAGE1_CFLAGS)" clean +@endif intl-bootstrap + + +.PHONY: all-stage2-intl maybe-all-stage2-intl +.PHONY: clean-stage2-intl maybe-clean-stage2-intl +maybe-all-stage2-intl: +maybe-clean-stage2-intl: +@if intl-bootstrap +maybe-all-stage2-intl: all-stage2-intl +all-stage2: all-stage2-intl +TARGET-stage2-intl = $(TARGET-intl) +all-stage2-intl: configure-stage2-intl + @[ $(current_stage) = stage2 ] || $(MAKE) stage2-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/intl && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) \ + $(TARGET-stage2-intl) + +maybe-clean-stage2-intl: clean-stage2-intl +clean-stage2: clean-stage2-intl +clean-stage2-intl: + @[ -f $(HOST_SUBDIR)/intl/Makefile ] || [ -f $(HOST_SUBDIR)/stage2-intl/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stage2 ] || $(MAKE) stage2-start; \ + cd $(HOST_SUBDIR)/intl && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + clean +@endif intl-bootstrap + + +.PHONY: all-stage3-intl maybe-all-stage3-intl +.PHONY: clean-stage3-intl maybe-clean-stage3-intl +maybe-all-stage3-intl: +maybe-clean-stage3-intl: +@if intl-bootstrap +maybe-all-stage3-intl: all-stage3-intl +all-stage3: all-stage3-intl +TARGET-stage3-intl = $(TARGET-intl) +all-stage3-intl: configure-stage3-intl + @[ $(current_stage) = stage3 ] || $(MAKE) stage3-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/intl && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) \ + $(TARGET-stage3-intl) + +maybe-clean-stage3-intl: clean-stage3-intl +clean-stage3: clean-stage3-intl +clean-stage3-intl: + @[ -f $(HOST_SUBDIR)/intl/Makefile ] || [ -f $(HOST_SUBDIR)/stage3-intl/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stage3 ] || $(MAKE) stage3-start; \ + cd $(HOST_SUBDIR)/intl && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + clean +@endif intl-bootstrap + + +.PHONY: all-stage4-intl maybe-all-stage4-intl +.PHONY: clean-stage4-intl maybe-clean-stage4-intl +maybe-all-stage4-intl: +maybe-clean-stage4-intl: +@if intl-bootstrap +maybe-all-stage4-intl: all-stage4-intl +all-stage4: all-stage4-intl +TARGET-stage4-intl = $(TARGET-intl) +all-stage4-intl: configure-stage4-intl + @[ $(current_stage) = stage4 ] || $(MAKE) stage4-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/intl && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) \ + $(TARGET-stage4-intl) + +maybe-clean-stage4-intl: clean-stage4-intl +clean-stage4: clean-stage4-intl +clean-stage4-intl: + @[ -f $(HOST_SUBDIR)/intl/Makefile ] || [ -f $(HOST_SUBDIR)/stage4-intl/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stage4 ] || $(MAKE) stage4-start; \ + cd $(HOST_SUBDIR)/intl && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + clean +@endif intl-bootstrap + + +.PHONY: all-stageprofile-intl maybe-all-stageprofile-intl +.PHONY: clean-stageprofile-intl maybe-clean-stageprofile-intl +maybe-all-stageprofile-intl: +maybe-clean-stageprofile-intl: +@if intl-bootstrap +maybe-all-stageprofile-intl: all-stageprofile-intl +all-stageprofile: all-stageprofile-intl +TARGET-stageprofile-intl = $(TARGET-intl) +all-stageprofile-intl: configure-stageprofile-intl + @[ $(current_stage) = stageprofile ] || $(MAKE) stageprofile-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/intl && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) CFLAGS="$(BOOT_CFLAGS) -fprofile-generate" \ + $(TARGET-stageprofile-intl) + +maybe-clean-stageprofile-intl: clean-stageprofile-intl +clean-stageprofile: clean-stageprofile-intl +clean-stageprofile-intl: + @[ -f $(HOST_SUBDIR)/intl/Makefile ] || [ -f $(HOST_SUBDIR)/stageprofile-intl/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stageprofile ] || $(MAKE) stageprofile-start; \ + cd $(HOST_SUBDIR)/intl && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + CFLAGS="$(BOOT_CFLAGS) -fprofile-generate" clean +@endif intl-bootstrap + + +.PHONY: all-stagefeedback-intl maybe-all-stagefeedback-intl +.PHONY: clean-stagefeedback-intl maybe-clean-stagefeedback-intl +maybe-all-stagefeedback-intl: +maybe-clean-stagefeedback-intl: +@if intl-bootstrap +maybe-all-stagefeedback-intl: all-stagefeedback-intl +all-stagefeedback: all-stagefeedback-intl +TARGET-stagefeedback-intl = $(TARGET-intl) +all-stagefeedback-intl: configure-stagefeedback-intl + @[ $(current_stage) = stagefeedback ] || $(MAKE) stagefeedback-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/intl && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) CFLAGS="$(BOOT_CFLAGS) -fprofile-use" \ + $(TARGET-stagefeedback-intl) + +maybe-clean-stagefeedback-intl: clean-stagefeedback-intl +clean-stagefeedback: clean-stagefeedback-intl +clean-stagefeedback-intl: + @[ -f $(HOST_SUBDIR)/intl/Makefile ] || [ -f $(HOST_SUBDIR)/stagefeedback-intl/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stagefeedback ] || $(MAKE) stagefeedback-start; \ + cd $(HOST_SUBDIR)/intl && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + CFLAGS="$(BOOT_CFLAGS) -fprofile-use" clean +@endif intl-bootstrap + + + + .PHONY: check-intl maybe-check-intl maybe-check-intl: +@if intl +maybe-check-intl: check-intl check-intl: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd intl && $(MAKE) $(FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/intl && \ + $(MAKE) $(FLAGS_TO_PASS) check) +@endif intl .PHONY: install-intl maybe-install-intl maybe-install-intl: +@if intl +maybe-install-intl: install-intl install-intl: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd intl && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/intl && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif intl + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-intl info-intl +maybe-info-intl: +@if intl +maybe-info-intl: info-intl + +info-intl: \ + configure-intl + @[ -f ./intl/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in intl" ; \ + (cd $(HOST_SUBDIR)/intl && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif intl + +.PHONY: maybe-dvi-intl dvi-intl +maybe-dvi-intl: +@if intl +maybe-dvi-intl: dvi-intl + +dvi-intl: \ + configure-intl + @[ -f ./intl/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in intl" ; \ + (cd $(HOST_SUBDIR)/intl && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif intl + +.PHONY: maybe-html-intl html-intl +maybe-html-intl: +@if intl +maybe-html-intl: html-intl + +html-intl: \ + configure-intl + @[ -f ./intl/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in intl" ; \ + (cd $(HOST_SUBDIR)/intl && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif intl + +.PHONY: maybe-TAGS-intl TAGS-intl +maybe-TAGS-intl: +@if intl +maybe-TAGS-intl: TAGS-intl + +TAGS-intl: \ + configure-intl + @[ -f ./intl/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in intl" ; \ + (cd $(HOST_SUBDIR)/intl && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif intl + +.PHONY: maybe-install-info-intl install-info-intl +maybe-install-info-intl: +@if intl +maybe-install-info-intl: install-info-intl + +install-info-intl: \ + configure-intl \ + info-intl + @[ -f ./intl/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in intl" ; \ + (cd $(HOST_SUBDIR)/intl && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif intl + +.PHONY: maybe-install-html-intl install-html-intl +maybe-install-html-intl: +@if intl +maybe-install-html-intl: install-html-intl + +install-html-intl: \ + configure-intl \ + html-intl + @[ -f ./intl/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in intl" ; \ + (cd $(HOST_SUBDIR)/intl && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif intl + +.PHONY: maybe-installcheck-intl installcheck-intl +maybe-installcheck-intl: +@if intl +maybe-installcheck-intl: installcheck-intl + +installcheck-intl: \ + configure-intl + @[ -f ./intl/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in intl" ; \ + (cd $(HOST_SUBDIR)/intl && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif intl + +.PHONY: maybe-mostlyclean-intl mostlyclean-intl +maybe-mostlyclean-intl: +@if intl +maybe-mostlyclean-intl: mostlyclean-intl + +mostlyclean-intl: + @[ -f ./intl/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in intl" ; \ + (cd $(HOST_SUBDIR)/intl && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif intl + +.PHONY: maybe-clean-intl clean-intl +maybe-clean-intl: +@if intl +maybe-clean-intl: clean-intl + +clean-intl: + @[ -f ./intl/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in intl" ; \ + (cd $(HOST_SUBDIR)/intl && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif intl + +.PHONY: maybe-distclean-intl distclean-intl +maybe-distclean-intl: +@if intl +maybe-distclean-intl: distclean-intl + +distclean-intl: + @[ -f ./intl/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in intl" ; \ + (cd $(HOST_SUBDIR)/intl && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif intl + +.PHONY: maybe-maintainer-clean-intl maintainer-clean-intl +maybe-maintainer-clean-intl: +@if intl +maybe-maintainer-clean-intl: maintainer-clean-intl + +maintainer-clean-intl: + @[ -f ./intl/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in intl" ; \ + (cd $(HOST_SUBDIR)/intl && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif intl + .PHONY: configure-tcl maybe-configure-tcl maybe-configure-tcl: -configure-tcl: - @test ! -f tcl/Makefile || exit 0; \ - [ -d tcl ] || mkdir tcl; \ - r=`${PWD_COMMAND}`; export r; \ +@if tcl +maybe-configure-tcl: configure-tcl +configure-tcl: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in tcl; \ - cd tcl || exit 1; \ + test ! -f $(HOST_SUBDIR)/tcl/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/tcl ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/tcl; \ + cd "$(HOST_SUBDIR)/tcl" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/tcl"; \ - libsrcdir="$$s/tcl";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/tcl"; \ - libsrcdir="$$s/tcl";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/tcl/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/tcl"; \ + libsrcdir="$$s/tcl"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif tcl + + + + .PHONY: all-tcl maybe-all-tcl maybe-all-tcl: +@if tcl +TARGET-tcl=all +maybe-all-tcl: all-tcl all-tcl: configure-tcl + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd tcl && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/tcl && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-tcl)) +@endif tcl + + + .PHONY: check-tcl maybe-check-tcl maybe-check-tcl: +@if tcl +maybe-check-tcl: check-tcl check-tcl: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd tcl && $(MAKE) $(FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/tcl && \ + $(MAKE) $(FLAGS_TO_PASS) check) +@endif tcl .PHONY: install-tcl maybe-install-tcl maybe-install-tcl: +@if tcl +maybe-install-tcl: install-tcl install-tcl: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd tcl && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/tcl && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif tcl + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-tcl info-tcl +maybe-info-tcl: +@if tcl +maybe-info-tcl: info-tcl + +info-tcl: \ + configure-tcl + @: $(MAKE); $(unstage) + @[ -f ./tcl/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in tcl" ; \ + (cd $(HOST_SUBDIR)/tcl && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif tcl + +.PHONY: maybe-dvi-tcl dvi-tcl +maybe-dvi-tcl: +@if tcl +maybe-dvi-tcl: dvi-tcl + +dvi-tcl: \ + configure-tcl + @: $(MAKE); $(unstage) + @[ -f ./tcl/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in tcl" ; \ + (cd $(HOST_SUBDIR)/tcl && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif tcl + +.PHONY: maybe-html-tcl html-tcl +maybe-html-tcl: +@if tcl +maybe-html-tcl: html-tcl + +html-tcl: \ + configure-tcl + @: $(MAKE); $(unstage) + @[ -f ./tcl/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in tcl" ; \ + (cd $(HOST_SUBDIR)/tcl && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif tcl + +.PHONY: maybe-TAGS-tcl TAGS-tcl +maybe-TAGS-tcl: +@if tcl +maybe-TAGS-tcl: TAGS-tcl + +TAGS-tcl: \ + configure-tcl + @: $(MAKE); $(unstage) + @[ -f ./tcl/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in tcl" ; \ + (cd $(HOST_SUBDIR)/tcl && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif tcl + +.PHONY: maybe-install-info-tcl install-info-tcl +maybe-install-info-tcl: +@if tcl +maybe-install-info-tcl: install-info-tcl + +install-info-tcl: \ + configure-tcl \ + info-tcl + @: $(MAKE); $(unstage) + @[ -f ./tcl/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in tcl" ; \ + (cd $(HOST_SUBDIR)/tcl && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif tcl + +.PHONY: maybe-install-html-tcl install-html-tcl +maybe-install-html-tcl: +@if tcl +maybe-install-html-tcl: install-html-tcl + +install-html-tcl: \ + configure-tcl \ + html-tcl + @: $(MAKE); $(unstage) + @[ -f ./tcl/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in tcl" ; \ + (cd $(HOST_SUBDIR)/tcl && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif tcl + +.PHONY: maybe-installcheck-tcl installcheck-tcl +maybe-installcheck-tcl: +@if tcl +maybe-installcheck-tcl: installcheck-tcl + +installcheck-tcl: \ + configure-tcl + @: $(MAKE); $(unstage) + @[ -f ./tcl/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in tcl" ; \ + (cd $(HOST_SUBDIR)/tcl && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif tcl + +.PHONY: maybe-mostlyclean-tcl mostlyclean-tcl +maybe-mostlyclean-tcl: +@if tcl +maybe-mostlyclean-tcl: mostlyclean-tcl + +# tcl doesn't support mostlyclean. +mostlyclean-tcl: + +@endif tcl + +.PHONY: maybe-clean-tcl clean-tcl +maybe-clean-tcl: +@if tcl +maybe-clean-tcl: clean-tcl + +clean-tcl: + @: $(MAKE); $(unstage) + @[ -f ./tcl/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in tcl" ; \ + (cd $(HOST_SUBDIR)/tcl && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif tcl + +.PHONY: maybe-distclean-tcl distclean-tcl +maybe-distclean-tcl: +@if tcl +maybe-distclean-tcl: distclean-tcl + +distclean-tcl: + @: $(MAKE); $(unstage) + @[ -f ./tcl/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in tcl" ; \ + (cd $(HOST_SUBDIR)/tcl && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif tcl + +.PHONY: maybe-maintainer-clean-tcl maintainer-clean-tcl +maybe-maintainer-clean-tcl: +@if tcl +maybe-maintainer-clean-tcl: maintainer-clean-tcl + +maintainer-clean-tcl: + @: $(MAKE); $(unstage) + @[ -f ./tcl/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in tcl" ; \ + (cd $(HOST_SUBDIR)/tcl && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif tcl + .PHONY: configure-itcl maybe-configure-itcl maybe-configure-itcl: -configure-itcl: - @test ! -f itcl/Makefile || exit 0; \ - [ -d itcl ] || mkdir itcl; \ - r=`${PWD_COMMAND}`; export r; \ +@if itcl +maybe-configure-itcl: configure-itcl +configure-itcl: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in itcl; \ - cd itcl || exit 1; \ + test ! -f $(HOST_SUBDIR)/itcl/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/itcl ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/itcl; \ + cd "$(HOST_SUBDIR)/itcl" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/itcl"; \ - libsrcdir="$$s/itcl";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/itcl"; \ - libsrcdir="$$s/itcl";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/itcl/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/itcl"; \ + libsrcdir="$$s/itcl"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif itcl + + + + .PHONY: all-itcl maybe-all-itcl maybe-all-itcl: +@if itcl +TARGET-itcl=all +maybe-all-itcl: all-itcl all-itcl: configure-itcl + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd itcl && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/itcl && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-itcl)) +@endif itcl + + + .PHONY: check-itcl maybe-check-itcl maybe-check-itcl: +@if itcl +maybe-check-itcl: check-itcl check-itcl: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd itcl && $(MAKE) $(FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/itcl && \ + $(MAKE) $(FLAGS_TO_PASS) check) +@endif itcl .PHONY: install-itcl maybe-install-itcl maybe-install-itcl: +@if itcl +maybe-install-itcl: install-itcl install-itcl: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd itcl && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/itcl && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif itcl + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-itcl info-itcl +maybe-info-itcl: +@if itcl +maybe-info-itcl: info-itcl + +info-itcl: \ + configure-itcl + @: $(MAKE); $(unstage) + @[ -f ./itcl/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in itcl" ; \ + (cd $(HOST_SUBDIR)/itcl && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif itcl + +.PHONY: maybe-dvi-itcl dvi-itcl +maybe-dvi-itcl: +@if itcl +maybe-dvi-itcl: dvi-itcl + +dvi-itcl: \ + configure-itcl + @: $(MAKE); $(unstage) + @[ -f ./itcl/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in itcl" ; \ + (cd $(HOST_SUBDIR)/itcl && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif itcl + +.PHONY: maybe-html-itcl html-itcl +maybe-html-itcl: +@if itcl +maybe-html-itcl: html-itcl + +html-itcl: \ + configure-itcl + @: $(MAKE); $(unstage) + @[ -f ./itcl/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in itcl" ; \ + (cd $(HOST_SUBDIR)/itcl && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif itcl + +.PHONY: maybe-TAGS-itcl TAGS-itcl +maybe-TAGS-itcl: +@if itcl +maybe-TAGS-itcl: TAGS-itcl + +TAGS-itcl: \ + configure-itcl + @: $(MAKE); $(unstage) + @[ -f ./itcl/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in itcl" ; \ + (cd $(HOST_SUBDIR)/itcl && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif itcl + +.PHONY: maybe-install-info-itcl install-info-itcl +maybe-install-info-itcl: +@if itcl +maybe-install-info-itcl: install-info-itcl + +install-info-itcl: \ + configure-itcl \ + info-itcl + @: $(MAKE); $(unstage) + @[ -f ./itcl/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in itcl" ; \ + (cd $(HOST_SUBDIR)/itcl && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif itcl + +.PHONY: maybe-install-html-itcl install-html-itcl +maybe-install-html-itcl: +@if itcl +maybe-install-html-itcl: install-html-itcl + +install-html-itcl: \ + configure-itcl \ + html-itcl + @: $(MAKE); $(unstage) + @[ -f ./itcl/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in itcl" ; \ + (cd $(HOST_SUBDIR)/itcl && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif itcl + +.PHONY: maybe-installcheck-itcl installcheck-itcl +maybe-installcheck-itcl: +@if itcl +maybe-installcheck-itcl: installcheck-itcl + +installcheck-itcl: \ + configure-itcl + @: $(MAKE); $(unstage) + @[ -f ./itcl/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in itcl" ; \ + (cd $(HOST_SUBDIR)/itcl && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif itcl + +.PHONY: maybe-mostlyclean-itcl mostlyclean-itcl +maybe-mostlyclean-itcl: +@if itcl +maybe-mostlyclean-itcl: mostlyclean-itcl + +mostlyclean-itcl: + @: $(MAKE); $(unstage) + @[ -f ./itcl/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in itcl" ; \ + (cd $(HOST_SUBDIR)/itcl && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif itcl + +.PHONY: maybe-clean-itcl clean-itcl +maybe-clean-itcl: +@if itcl +maybe-clean-itcl: clean-itcl + +clean-itcl: + @: $(MAKE); $(unstage) + @[ -f ./itcl/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in itcl" ; \ + (cd $(HOST_SUBDIR)/itcl && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif itcl + +.PHONY: maybe-distclean-itcl distclean-itcl +maybe-distclean-itcl: +@if itcl +maybe-distclean-itcl: distclean-itcl + +distclean-itcl: + @: $(MAKE); $(unstage) + @[ -f ./itcl/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in itcl" ; \ + (cd $(HOST_SUBDIR)/itcl && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif itcl + +.PHONY: maybe-maintainer-clean-itcl maintainer-clean-itcl +maybe-maintainer-clean-itcl: +@if itcl +maybe-maintainer-clean-itcl: maintainer-clean-itcl + +maintainer-clean-itcl: + @: $(MAKE); $(unstage) + @[ -f ./itcl/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in itcl" ; \ + (cd $(HOST_SUBDIR)/itcl && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif itcl + .PHONY: configure-ld maybe-configure-ld maybe-configure-ld: -configure-ld: - @test ! -f ld/Makefile || exit 0; \ - [ -d ld ] || mkdir ld; \ - r=`${PWD_COMMAND}`; export r; \ +@if ld +maybe-configure-ld: configure-ld +configure-ld: +@endif ld +@if ld-bootstrap + @if test -f stage_last; then $(unstage); else $(MAKE) stage1-start; fi +@endif ld-bootstrap +@if ld + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in ld; \ - cd ld || exit 1; \ + test ! -f $(HOST_SUBDIR)/ld/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/ld ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/ld; \ + cd "$(HOST_SUBDIR)/ld" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/ld"; \ - libsrcdir="$$s/ld";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/ld"; \ - libsrcdir="$$s/ld";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/ld/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/ld"; \ + libsrcdir="$$s/ld"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + || exit 1 +@endif ld + + + +.PHONY: configure-stage1-ld maybe-configure-stage1-ld +maybe-configure-stage1-ld: +@if ld-bootstrap +maybe-configure-stage1-ld: configure-stage1-ld +configure-stage1-ld: + @[ $(current_stage) = stage1 ] || $(MAKE) stage1-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/ld + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/ld/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + echo Configuring stage 1 in $(HOST_SUBDIR)/ld ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/ld ; \ + cd $(HOST_SUBDIR)/ld || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/ld/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/ld"; \ + libsrcdir="$$s/ld"; \ $(SHELL) $${libsrcdir}/configure \ $(HOST_CONFIGARGS) $${srcdiroption} \ - || exit 1 + --disable-intermodule --disable-coverage --enable-languages="$(STAGE1_LANGUAGES)" +@endif ld-bootstrap + +.PHONY: configure-stage2-ld maybe-configure-stage2-ld +maybe-configure-stage2-ld: +@if ld-bootstrap +maybe-configure-stage2-ld: configure-stage2-ld +configure-stage2-ld: + @[ $(current_stage) = stage2 ] || $(MAKE) stage2-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/ld + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/ld/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage 2 in $(HOST_SUBDIR)/ld ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/ld ; \ + cd $(HOST_SUBDIR)/ld || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/ld/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/ld"; \ + libsrcdir="$$s/ld"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif ld-bootstrap + +.PHONY: configure-stage3-ld maybe-configure-stage3-ld +maybe-configure-stage3-ld: +@if ld-bootstrap +maybe-configure-stage3-ld: configure-stage3-ld +configure-stage3-ld: + @[ $(current_stage) = stage3 ] || $(MAKE) stage3-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/ld + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/ld/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage 3 in $(HOST_SUBDIR)/ld ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/ld ; \ + cd $(HOST_SUBDIR)/ld || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/ld/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/ld"; \ + libsrcdir="$$s/ld"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif ld-bootstrap + +.PHONY: configure-stage4-ld maybe-configure-stage4-ld +maybe-configure-stage4-ld: +@if ld-bootstrap +maybe-configure-stage4-ld: configure-stage4-ld +configure-stage4-ld: + @[ $(current_stage) = stage4 ] || $(MAKE) stage4-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/ld + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/ld/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage 4 in $(HOST_SUBDIR)/ld ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/ld ; \ + cd $(HOST_SUBDIR)/ld || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/ld/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/ld"; \ + libsrcdir="$$s/ld"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif ld-bootstrap + +.PHONY: configure-stageprofile-ld maybe-configure-stageprofile-ld +maybe-configure-stageprofile-ld: +@if ld-bootstrap +maybe-configure-stageprofile-ld: configure-stageprofile-ld +configure-stageprofile-ld: + @[ $(current_stage) = stageprofile ] || $(MAKE) stageprofile-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/ld + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/ld/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage profile in $(HOST_SUBDIR)/ld ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/ld ; \ + cd $(HOST_SUBDIR)/ld || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/ld/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/ld"; \ + libsrcdir="$$s/ld"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif ld-bootstrap + +.PHONY: configure-stagefeedback-ld maybe-configure-stagefeedback-ld +maybe-configure-stagefeedback-ld: +@if ld-bootstrap +maybe-configure-stagefeedback-ld: configure-stagefeedback-ld +configure-stagefeedback-ld: + @[ $(current_stage) = stagefeedback ] || $(MAKE) stagefeedback-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/ld + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/ld/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage feedback in $(HOST_SUBDIR)/ld ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/ld ; \ + cd $(HOST_SUBDIR)/ld || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/ld/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/ld"; \ + libsrcdir="$$s/ld"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif ld-bootstrap + + + + .PHONY: all-ld maybe-all-ld maybe-all-ld: +@if ld +TARGET-ld=all +maybe-all-ld: all-ld all-ld: configure-ld +@endif ld +@if ld-bootstrap + @if test -f stage_last; then $(unstage); else $(MAKE) stage1-start; fi +@endif ld-bootstrap +@if ld @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd ld && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/ld && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-ld)) +@endif ld + + + +.PHONY: all-stage1-ld maybe-all-stage1-ld +.PHONY: clean-stage1-ld maybe-clean-stage1-ld +maybe-all-stage1-ld: +maybe-clean-stage1-ld: +@if ld-bootstrap +maybe-all-stage1-ld: all-stage1-ld +all-stage1: all-stage1-ld +TARGET-stage1-ld = $(TARGET-ld) +all-stage1-ld: configure-stage1-ld + @[ $(current_stage) = stage1 ] || $(MAKE) stage1-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/ld && \ + $(MAKE) $(FLAGS_TO_PASS) CFLAGS="$(STAGE1_CFLAGS)" LIBCFLAGS="$(STAGE1_CFLAGS)" \ + $(TARGET-stage1-ld) + +maybe-clean-stage1-ld: clean-stage1-ld +clean-stage1: clean-stage1-ld +clean-stage1-ld: + @[ -f $(HOST_SUBDIR)/ld/Makefile ] || [ -f $(HOST_SUBDIR)/stage1-ld/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stage1 ] || $(MAKE) stage1-start; \ + cd $(HOST_SUBDIR)/ld && \ + $(MAKE) $(FLAGS_TO_PASS) \ + CFLAGS="$(STAGE1_CFLAGS)" LIBCFLAGS="$(STAGE1_CFLAGS)" clean +@endif ld-bootstrap + + +.PHONY: all-stage2-ld maybe-all-stage2-ld +.PHONY: clean-stage2-ld maybe-clean-stage2-ld +maybe-all-stage2-ld: +maybe-clean-stage2-ld: +@if ld-bootstrap +maybe-all-stage2-ld: all-stage2-ld +all-stage2: all-stage2-ld +TARGET-stage2-ld = $(TARGET-ld) +all-stage2-ld: configure-stage2-ld + @[ $(current_stage) = stage2 ] || $(MAKE) stage2-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/ld && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) \ + $(TARGET-stage2-ld) + +maybe-clean-stage2-ld: clean-stage2-ld +clean-stage2: clean-stage2-ld +clean-stage2-ld: + @[ -f $(HOST_SUBDIR)/ld/Makefile ] || [ -f $(HOST_SUBDIR)/stage2-ld/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stage2 ] || $(MAKE) stage2-start; \ + cd $(HOST_SUBDIR)/ld && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + clean +@endif ld-bootstrap + + +.PHONY: all-stage3-ld maybe-all-stage3-ld +.PHONY: clean-stage3-ld maybe-clean-stage3-ld +maybe-all-stage3-ld: +maybe-clean-stage3-ld: +@if ld-bootstrap +maybe-all-stage3-ld: all-stage3-ld +all-stage3: all-stage3-ld +TARGET-stage3-ld = $(TARGET-ld) +all-stage3-ld: configure-stage3-ld + @[ $(current_stage) = stage3 ] || $(MAKE) stage3-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/ld && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) \ + $(TARGET-stage3-ld) + +maybe-clean-stage3-ld: clean-stage3-ld +clean-stage3: clean-stage3-ld +clean-stage3-ld: + @[ -f $(HOST_SUBDIR)/ld/Makefile ] || [ -f $(HOST_SUBDIR)/stage3-ld/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stage3 ] || $(MAKE) stage3-start; \ + cd $(HOST_SUBDIR)/ld && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + clean +@endif ld-bootstrap + + +.PHONY: all-stage4-ld maybe-all-stage4-ld +.PHONY: clean-stage4-ld maybe-clean-stage4-ld +maybe-all-stage4-ld: +maybe-clean-stage4-ld: +@if ld-bootstrap +maybe-all-stage4-ld: all-stage4-ld +all-stage4: all-stage4-ld +TARGET-stage4-ld = $(TARGET-ld) +all-stage4-ld: configure-stage4-ld + @[ $(current_stage) = stage4 ] || $(MAKE) stage4-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/ld && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) \ + $(TARGET-stage4-ld) + +maybe-clean-stage4-ld: clean-stage4-ld +clean-stage4: clean-stage4-ld +clean-stage4-ld: + @[ -f $(HOST_SUBDIR)/ld/Makefile ] || [ -f $(HOST_SUBDIR)/stage4-ld/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stage4 ] || $(MAKE) stage4-start; \ + cd $(HOST_SUBDIR)/ld && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + clean +@endif ld-bootstrap + + +.PHONY: all-stageprofile-ld maybe-all-stageprofile-ld +.PHONY: clean-stageprofile-ld maybe-clean-stageprofile-ld +maybe-all-stageprofile-ld: +maybe-clean-stageprofile-ld: +@if ld-bootstrap +maybe-all-stageprofile-ld: all-stageprofile-ld +all-stageprofile: all-stageprofile-ld +TARGET-stageprofile-ld = $(TARGET-ld) +all-stageprofile-ld: configure-stageprofile-ld + @[ $(current_stage) = stageprofile ] || $(MAKE) stageprofile-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/ld && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) CFLAGS="$(BOOT_CFLAGS) -fprofile-generate" \ + $(TARGET-stageprofile-ld) + +maybe-clean-stageprofile-ld: clean-stageprofile-ld +clean-stageprofile: clean-stageprofile-ld +clean-stageprofile-ld: + @[ -f $(HOST_SUBDIR)/ld/Makefile ] || [ -f $(HOST_SUBDIR)/stageprofile-ld/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stageprofile ] || $(MAKE) stageprofile-start; \ + cd $(HOST_SUBDIR)/ld && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + CFLAGS="$(BOOT_CFLAGS) -fprofile-generate" clean +@endif ld-bootstrap + + +.PHONY: all-stagefeedback-ld maybe-all-stagefeedback-ld +.PHONY: clean-stagefeedback-ld maybe-clean-stagefeedback-ld +maybe-all-stagefeedback-ld: +maybe-clean-stagefeedback-ld: +@if ld-bootstrap +maybe-all-stagefeedback-ld: all-stagefeedback-ld +all-stagefeedback: all-stagefeedback-ld +TARGET-stagefeedback-ld = $(TARGET-ld) +all-stagefeedback-ld: configure-stagefeedback-ld + @[ $(current_stage) = stagefeedback ] || $(MAKE) stagefeedback-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/ld && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) CFLAGS="$(BOOT_CFLAGS) -fprofile-use" \ + $(TARGET-stagefeedback-ld) + +maybe-clean-stagefeedback-ld: clean-stagefeedback-ld +clean-stagefeedback: clean-stagefeedback-ld +clean-stagefeedback-ld: + @[ -f $(HOST_SUBDIR)/ld/Makefile ] || [ -f $(HOST_SUBDIR)/stagefeedback-ld/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stagefeedback ] || $(MAKE) stagefeedback-start; \ + cd $(HOST_SUBDIR)/ld && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + CFLAGS="$(BOOT_CFLAGS) -fprofile-use" clean +@endif ld-bootstrap + + + + .PHONY: check-ld maybe-check-ld maybe-check-ld: +@if ld +maybe-check-ld: check-ld check-ld: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd ld && $(MAKE) $(FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/ld && \ + $(MAKE) $(FLAGS_TO_PASS) check) +@endif ld .PHONY: install-ld maybe-install-ld maybe-install-ld: +@if ld +maybe-install-ld: install-ld install-ld: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd ld && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/ld && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif ld + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-ld info-ld +maybe-info-ld: +@if ld +maybe-info-ld: info-ld + +info-ld: \ + configure-ld + @[ -f ./ld/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in ld" ; \ + (cd $(HOST_SUBDIR)/ld && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif ld + +.PHONY: maybe-dvi-ld dvi-ld +maybe-dvi-ld: +@if ld +maybe-dvi-ld: dvi-ld + +dvi-ld: \ + configure-ld + @[ -f ./ld/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in ld" ; \ + (cd $(HOST_SUBDIR)/ld && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif ld + +.PHONY: maybe-html-ld html-ld +maybe-html-ld: +@if ld +maybe-html-ld: html-ld + +html-ld: \ + configure-ld + @[ -f ./ld/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in ld" ; \ + (cd $(HOST_SUBDIR)/ld && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif ld + +.PHONY: maybe-TAGS-ld TAGS-ld +maybe-TAGS-ld: +@if ld +maybe-TAGS-ld: TAGS-ld + +TAGS-ld: \ + configure-ld + @[ -f ./ld/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in ld" ; \ + (cd $(HOST_SUBDIR)/ld && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif ld + +.PHONY: maybe-install-info-ld install-info-ld +maybe-install-info-ld: +@if ld +maybe-install-info-ld: install-info-ld + +install-info-ld: \ + configure-ld \ + info-ld + @[ -f ./ld/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in ld" ; \ + (cd $(HOST_SUBDIR)/ld && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif ld + +.PHONY: maybe-install-html-ld install-html-ld +maybe-install-html-ld: +@if ld +maybe-install-html-ld: install-html-ld + +install-html-ld: \ + configure-ld \ + html-ld + @[ -f ./ld/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in ld" ; \ + (cd $(HOST_SUBDIR)/ld && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif ld + +.PHONY: maybe-installcheck-ld installcheck-ld +maybe-installcheck-ld: +@if ld +maybe-installcheck-ld: installcheck-ld + +installcheck-ld: \ + configure-ld + @[ -f ./ld/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in ld" ; \ + (cd $(HOST_SUBDIR)/ld && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif ld + +.PHONY: maybe-mostlyclean-ld mostlyclean-ld +maybe-mostlyclean-ld: +@if ld +maybe-mostlyclean-ld: mostlyclean-ld + +mostlyclean-ld: + @[ -f ./ld/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in ld" ; \ + (cd $(HOST_SUBDIR)/ld && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif ld + +.PHONY: maybe-clean-ld clean-ld +maybe-clean-ld: +@if ld +maybe-clean-ld: clean-ld + +clean-ld: + @[ -f ./ld/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in ld" ; \ + (cd $(HOST_SUBDIR)/ld && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif ld + +.PHONY: maybe-distclean-ld distclean-ld +maybe-distclean-ld: +@if ld +maybe-distclean-ld: distclean-ld + +distclean-ld: + @[ -f ./ld/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in ld" ; \ + (cd $(HOST_SUBDIR)/ld && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif ld + +.PHONY: maybe-maintainer-clean-ld maintainer-clean-ld +maybe-maintainer-clean-ld: +@if ld +maybe-maintainer-clean-ld: maintainer-clean-ld + +maintainer-clean-ld: + @[ -f ./ld/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in ld" ; \ + (cd $(HOST_SUBDIR)/ld && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif ld + + + +.PHONY: configure-libcpp maybe-configure-libcpp +maybe-configure-libcpp: +@if libcpp +maybe-configure-libcpp: configure-libcpp +configure-libcpp: +@endif libcpp +@if libcpp-bootstrap + @if test -f stage_last; then $(unstage); else $(MAKE) stage1-start; fi +@endif libcpp-bootstrap +@if libcpp + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/libcpp/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libcpp ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/libcpp; \ + cd "$(HOST_SUBDIR)/libcpp" || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/libcpp/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/libcpp"; \ + libsrcdir="$$s/libcpp"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + || exit 1 +@endif libcpp + + + +.PHONY: configure-stage1-libcpp maybe-configure-stage1-libcpp +maybe-configure-stage1-libcpp: +@if libcpp-bootstrap +maybe-configure-stage1-libcpp: configure-stage1-libcpp +configure-stage1-libcpp: + @[ $(current_stage) = stage1 ] || $(MAKE) stage1-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libcpp + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/libcpp/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + echo Configuring stage 1 in $(HOST_SUBDIR)/libcpp ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libcpp ; \ + cd $(HOST_SUBDIR)/libcpp || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/libcpp/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/libcpp"; \ + libsrcdir="$$s/libcpp"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + --disable-intermodule --disable-coverage --enable-languages="$(STAGE1_LANGUAGES)" +@endif libcpp-bootstrap + +.PHONY: configure-stage2-libcpp maybe-configure-stage2-libcpp +maybe-configure-stage2-libcpp: +@if libcpp-bootstrap +maybe-configure-stage2-libcpp: configure-stage2-libcpp +configure-stage2-libcpp: + @[ $(current_stage) = stage2 ] || $(MAKE) stage2-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libcpp + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/libcpp/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage 2 in $(HOST_SUBDIR)/libcpp ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libcpp ; \ + cd $(HOST_SUBDIR)/libcpp || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/libcpp/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/libcpp"; \ + libsrcdir="$$s/libcpp"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif libcpp-bootstrap + +.PHONY: configure-stage3-libcpp maybe-configure-stage3-libcpp +maybe-configure-stage3-libcpp: +@if libcpp-bootstrap +maybe-configure-stage3-libcpp: configure-stage3-libcpp +configure-stage3-libcpp: + @[ $(current_stage) = stage3 ] || $(MAKE) stage3-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libcpp + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/libcpp/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage 3 in $(HOST_SUBDIR)/libcpp ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libcpp ; \ + cd $(HOST_SUBDIR)/libcpp || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/libcpp/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/libcpp"; \ + libsrcdir="$$s/libcpp"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif libcpp-bootstrap + +.PHONY: configure-stage4-libcpp maybe-configure-stage4-libcpp +maybe-configure-stage4-libcpp: +@if libcpp-bootstrap +maybe-configure-stage4-libcpp: configure-stage4-libcpp +configure-stage4-libcpp: + @[ $(current_stage) = stage4 ] || $(MAKE) stage4-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libcpp + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/libcpp/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage 4 in $(HOST_SUBDIR)/libcpp ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libcpp ; \ + cd $(HOST_SUBDIR)/libcpp || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/libcpp/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/libcpp"; \ + libsrcdir="$$s/libcpp"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif libcpp-bootstrap + +.PHONY: configure-stageprofile-libcpp maybe-configure-stageprofile-libcpp +maybe-configure-stageprofile-libcpp: +@if libcpp-bootstrap +maybe-configure-stageprofile-libcpp: configure-stageprofile-libcpp +configure-stageprofile-libcpp: + @[ $(current_stage) = stageprofile ] || $(MAKE) stageprofile-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libcpp + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/libcpp/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage profile in $(HOST_SUBDIR)/libcpp ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libcpp ; \ + cd $(HOST_SUBDIR)/libcpp || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/libcpp/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/libcpp"; \ + libsrcdir="$$s/libcpp"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif libcpp-bootstrap + +.PHONY: configure-stagefeedback-libcpp maybe-configure-stagefeedback-libcpp +maybe-configure-stagefeedback-libcpp: +@if libcpp-bootstrap +maybe-configure-stagefeedback-libcpp: configure-stagefeedback-libcpp +configure-stagefeedback-libcpp: + @[ $(current_stage) = stagefeedback ] || $(MAKE) stagefeedback-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libcpp + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/libcpp/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage feedback in $(HOST_SUBDIR)/libcpp ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libcpp ; \ + cd $(HOST_SUBDIR)/libcpp || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/libcpp/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/libcpp"; \ + libsrcdir="$$s/libcpp"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif libcpp-bootstrap + + + + + +.PHONY: all-libcpp maybe-all-libcpp +maybe-all-libcpp: +@if libcpp +TARGET-libcpp=all +maybe-all-libcpp: all-libcpp +all-libcpp: configure-libcpp +@endif libcpp +@if libcpp-bootstrap + @if test -f stage_last; then $(unstage); else $(MAKE) stage1-start; fi +@endif libcpp-bootstrap +@if libcpp + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/libcpp && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-libcpp)) +@endif libcpp + + + +.PHONY: all-stage1-libcpp maybe-all-stage1-libcpp +.PHONY: clean-stage1-libcpp maybe-clean-stage1-libcpp +maybe-all-stage1-libcpp: +maybe-clean-stage1-libcpp: +@if libcpp-bootstrap +maybe-all-stage1-libcpp: all-stage1-libcpp +all-stage1: all-stage1-libcpp +TARGET-stage1-libcpp = $(TARGET-libcpp) +all-stage1-libcpp: configure-stage1-libcpp + @[ $(current_stage) = stage1 ] || $(MAKE) stage1-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/libcpp && \ + $(MAKE) $(FLAGS_TO_PASS) CFLAGS="$(STAGE1_CFLAGS)" LIBCFLAGS="$(STAGE1_CFLAGS)" \ + $(TARGET-stage1-libcpp) + +maybe-clean-stage1-libcpp: clean-stage1-libcpp +clean-stage1: clean-stage1-libcpp +clean-stage1-libcpp: + @[ -f $(HOST_SUBDIR)/libcpp/Makefile ] || [ -f $(HOST_SUBDIR)/stage1-libcpp/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stage1 ] || $(MAKE) stage1-start; \ + cd $(HOST_SUBDIR)/libcpp && \ + $(MAKE) $(FLAGS_TO_PASS) \ + CFLAGS="$(STAGE1_CFLAGS)" LIBCFLAGS="$(STAGE1_CFLAGS)" clean +@endif libcpp-bootstrap + + +.PHONY: all-stage2-libcpp maybe-all-stage2-libcpp +.PHONY: clean-stage2-libcpp maybe-clean-stage2-libcpp +maybe-all-stage2-libcpp: +maybe-clean-stage2-libcpp: +@if libcpp-bootstrap +maybe-all-stage2-libcpp: all-stage2-libcpp +all-stage2: all-stage2-libcpp +TARGET-stage2-libcpp = $(TARGET-libcpp) +all-stage2-libcpp: configure-stage2-libcpp + @[ $(current_stage) = stage2 ] || $(MAKE) stage2-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/libcpp && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) \ + $(TARGET-stage2-libcpp) + +maybe-clean-stage2-libcpp: clean-stage2-libcpp +clean-stage2: clean-stage2-libcpp +clean-stage2-libcpp: + @[ -f $(HOST_SUBDIR)/libcpp/Makefile ] || [ -f $(HOST_SUBDIR)/stage2-libcpp/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stage2 ] || $(MAKE) stage2-start; \ + cd $(HOST_SUBDIR)/libcpp && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + clean +@endif libcpp-bootstrap + + +.PHONY: all-stage3-libcpp maybe-all-stage3-libcpp +.PHONY: clean-stage3-libcpp maybe-clean-stage3-libcpp +maybe-all-stage3-libcpp: +maybe-clean-stage3-libcpp: +@if libcpp-bootstrap +maybe-all-stage3-libcpp: all-stage3-libcpp +all-stage3: all-stage3-libcpp +TARGET-stage3-libcpp = $(TARGET-libcpp) +all-stage3-libcpp: configure-stage3-libcpp + @[ $(current_stage) = stage3 ] || $(MAKE) stage3-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/libcpp && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) \ + $(TARGET-stage3-libcpp) + +maybe-clean-stage3-libcpp: clean-stage3-libcpp +clean-stage3: clean-stage3-libcpp +clean-stage3-libcpp: + @[ -f $(HOST_SUBDIR)/libcpp/Makefile ] || [ -f $(HOST_SUBDIR)/stage3-libcpp/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stage3 ] || $(MAKE) stage3-start; \ + cd $(HOST_SUBDIR)/libcpp && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + clean +@endif libcpp-bootstrap + + +.PHONY: all-stage4-libcpp maybe-all-stage4-libcpp +.PHONY: clean-stage4-libcpp maybe-clean-stage4-libcpp +maybe-all-stage4-libcpp: +maybe-clean-stage4-libcpp: +@if libcpp-bootstrap +maybe-all-stage4-libcpp: all-stage4-libcpp +all-stage4: all-stage4-libcpp +TARGET-stage4-libcpp = $(TARGET-libcpp) +all-stage4-libcpp: configure-stage4-libcpp + @[ $(current_stage) = stage4 ] || $(MAKE) stage4-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/libcpp && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) \ + $(TARGET-stage4-libcpp) + +maybe-clean-stage4-libcpp: clean-stage4-libcpp +clean-stage4: clean-stage4-libcpp +clean-stage4-libcpp: + @[ -f $(HOST_SUBDIR)/libcpp/Makefile ] || [ -f $(HOST_SUBDIR)/stage4-libcpp/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stage4 ] || $(MAKE) stage4-start; \ + cd $(HOST_SUBDIR)/libcpp && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + clean +@endif libcpp-bootstrap + + +.PHONY: all-stageprofile-libcpp maybe-all-stageprofile-libcpp +.PHONY: clean-stageprofile-libcpp maybe-clean-stageprofile-libcpp +maybe-all-stageprofile-libcpp: +maybe-clean-stageprofile-libcpp: +@if libcpp-bootstrap +maybe-all-stageprofile-libcpp: all-stageprofile-libcpp +all-stageprofile: all-stageprofile-libcpp +TARGET-stageprofile-libcpp = $(TARGET-libcpp) +all-stageprofile-libcpp: configure-stageprofile-libcpp + @[ $(current_stage) = stageprofile ] || $(MAKE) stageprofile-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/libcpp && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) CFLAGS="$(BOOT_CFLAGS) -fprofile-generate" \ + $(TARGET-stageprofile-libcpp) + +maybe-clean-stageprofile-libcpp: clean-stageprofile-libcpp +clean-stageprofile: clean-stageprofile-libcpp +clean-stageprofile-libcpp: + @[ -f $(HOST_SUBDIR)/libcpp/Makefile ] || [ -f $(HOST_SUBDIR)/stageprofile-libcpp/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stageprofile ] || $(MAKE) stageprofile-start; \ + cd $(HOST_SUBDIR)/libcpp && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + CFLAGS="$(BOOT_CFLAGS) -fprofile-generate" clean +@endif libcpp-bootstrap + + +.PHONY: all-stagefeedback-libcpp maybe-all-stagefeedback-libcpp +.PHONY: clean-stagefeedback-libcpp maybe-clean-stagefeedback-libcpp +maybe-all-stagefeedback-libcpp: +maybe-clean-stagefeedback-libcpp: +@if libcpp-bootstrap +maybe-all-stagefeedback-libcpp: all-stagefeedback-libcpp +all-stagefeedback: all-stagefeedback-libcpp +TARGET-stagefeedback-libcpp = $(TARGET-libcpp) +all-stagefeedback-libcpp: configure-stagefeedback-libcpp + @[ $(current_stage) = stagefeedback ] || $(MAKE) stagefeedback-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/libcpp && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) CFLAGS="$(BOOT_CFLAGS) -fprofile-use" \ + $(TARGET-stagefeedback-libcpp) + +maybe-clean-stagefeedback-libcpp: clean-stagefeedback-libcpp +clean-stagefeedback: clean-stagefeedback-libcpp +clean-stagefeedback-libcpp: + @[ -f $(HOST_SUBDIR)/libcpp/Makefile ] || [ -f $(HOST_SUBDIR)/stagefeedback-libcpp/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stagefeedback ] || $(MAKE) stagefeedback-start; \ + cd $(HOST_SUBDIR)/libcpp && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + CFLAGS="$(BOOT_CFLAGS) -fprofile-use" clean +@endif libcpp-bootstrap + + + + + +.PHONY: check-libcpp maybe-check-libcpp +maybe-check-libcpp: +@if libcpp +maybe-check-libcpp: check-libcpp + +check-libcpp: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/libcpp && \ + $(MAKE) $(FLAGS_TO_PASS) check) + +@endif libcpp + +.PHONY: install-libcpp maybe-install-libcpp +maybe-install-libcpp: +@if libcpp +maybe-install-libcpp: install-libcpp + +install-libcpp: installdirs + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/libcpp && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif libcpp + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-libcpp info-libcpp +maybe-info-libcpp: +@if libcpp +maybe-info-libcpp: info-libcpp + +info-libcpp: \ + configure-libcpp + @[ -f ./libcpp/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in libcpp" ; \ + (cd $(HOST_SUBDIR)/libcpp && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif libcpp + +.PHONY: maybe-dvi-libcpp dvi-libcpp +maybe-dvi-libcpp: +@if libcpp +maybe-dvi-libcpp: dvi-libcpp + +dvi-libcpp: \ + configure-libcpp + @[ -f ./libcpp/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in libcpp" ; \ + (cd $(HOST_SUBDIR)/libcpp && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif libcpp + +.PHONY: maybe-html-libcpp html-libcpp +maybe-html-libcpp: +@if libcpp +maybe-html-libcpp: html-libcpp + +html-libcpp: \ + configure-libcpp + @[ -f ./libcpp/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in libcpp" ; \ + (cd $(HOST_SUBDIR)/libcpp && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif libcpp + +.PHONY: maybe-TAGS-libcpp TAGS-libcpp +maybe-TAGS-libcpp: +@if libcpp +maybe-TAGS-libcpp: TAGS-libcpp + +TAGS-libcpp: \ + configure-libcpp + @[ -f ./libcpp/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in libcpp" ; \ + (cd $(HOST_SUBDIR)/libcpp && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif libcpp + +.PHONY: maybe-install-info-libcpp install-info-libcpp +maybe-install-info-libcpp: +@if libcpp +maybe-install-info-libcpp: install-info-libcpp + +install-info-libcpp: \ + configure-libcpp \ + info-libcpp + @[ -f ./libcpp/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in libcpp" ; \ + (cd $(HOST_SUBDIR)/libcpp && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif libcpp + +.PHONY: maybe-install-html-libcpp install-html-libcpp +maybe-install-html-libcpp: +@if libcpp +maybe-install-html-libcpp: install-html-libcpp + +install-html-libcpp: \ + configure-libcpp \ + html-libcpp + @[ -f ./libcpp/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in libcpp" ; \ + (cd $(HOST_SUBDIR)/libcpp && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif libcpp + +.PHONY: maybe-installcheck-libcpp installcheck-libcpp +maybe-installcheck-libcpp: +@if libcpp +maybe-installcheck-libcpp: installcheck-libcpp + +installcheck-libcpp: \ + configure-libcpp + @[ -f ./libcpp/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in libcpp" ; \ + (cd $(HOST_SUBDIR)/libcpp && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif libcpp + +.PHONY: maybe-mostlyclean-libcpp mostlyclean-libcpp +maybe-mostlyclean-libcpp: +@if libcpp +maybe-mostlyclean-libcpp: mostlyclean-libcpp + +mostlyclean-libcpp: + @[ -f ./libcpp/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in libcpp" ; \ + (cd $(HOST_SUBDIR)/libcpp && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif libcpp + +.PHONY: maybe-clean-libcpp clean-libcpp +maybe-clean-libcpp: +@if libcpp +maybe-clean-libcpp: clean-libcpp + +clean-libcpp: + @[ -f ./libcpp/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in libcpp" ; \ + (cd $(HOST_SUBDIR)/libcpp && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif libcpp + +.PHONY: maybe-distclean-libcpp distclean-libcpp +maybe-distclean-libcpp: +@if libcpp +maybe-distclean-libcpp: distclean-libcpp + +distclean-libcpp: + @[ -f ./libcpp/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in libcpp" ; \ + (cd $(HOST_SUBDIR)/libcpp && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif libcpp + +.PHONY: maybe-maintainer-clean-libcpp maintainer-clean-libcpp +maybe-maintainer-clean-libcpp: +@if libcpp +maybe-maintainer-clean-libcpp: maintainer-clean-libcpp + +maintainer-clean-libcpp: + @[ -f ./libcpp/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in libcpp" ; \ + (cd $(HOST_SUBDIR)/libcpp && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif libcpp + + + +.PHONY: configure-libdecnumber maybe-configure-libdecnumber +maybe-configure-libdecnumber: +@if libdecnumber +maybe-configure-libdecnumber: configure-libdecnumber +configure-libdecnumber: +@endif libdecnumber +@if libdecnumber-bootstrap + @if test -f stage_last; then $(unstage); else $(MAKE) stage1-start; fi +@endif libdecnumber-bootstrap +@if libdecnumber + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/libdecnumber/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libdecnumber ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/libdecnumber; \ + cd "$(HOST_SUBDIR)/libdecnumber" || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/libdecnumber/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/libdecnumber"; \ + libsrcdir="$$s/libdecnumber"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + || exit 1 +@endif libdecnumber + + + +.PHONY: configure-stage1-libdecnumber maybe-configure-stage1-libdecnumber +maybe-configure-stage1-libdecnumber: +@if libdecnumber-bootstrap +maybe-configure-stage1-libdecnumber: configure-stage1-libdecnumber +configure-stage1-libdecnumber: + @[ $(current_stage) = stage1 ] || $(MAKE) stage1-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libdecnumber + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/libdecnumber/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + echo Configuring stage 1 in $(HOST_SUBDIR)/libdecnumber ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libdecnumber ; \ + cd $(HOST_SUBDIR)/libdecnumber || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/libdecnumber/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/libdecnumber"; \ + libsrcdir="$$s/libdecnumber"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + --disable-intermodule --disable-coverage --enable-languages="$(STAGE1_LANGUAGES)" +@endif libdecnumber-bootstrap + +.PHONY: configure-stage2-libdecnumber maybe-configure-stage2-libdecnumber +maybe-configure-stage2-libdecnumber: +@if libdecnumber-bootstrap +maybe-configure-stage2-libdecnumber: configure-stage2-libdecnumber +configure-stage2-libdecnumber: + @[ $(current_stage) = stage2 ] || $(MAKE) stage2-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libdecnumber + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/libdecnumber/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage 2 in $(HOST_SUBDIR)/libdecnumber ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libdecnumber ; \ + cd $(HOST_SUBDIR)/libdecnumber || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/libdecnumber/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/libdecnumber"; \ + libsrcdir="$$s/libdecnumber"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif libdecnumber-bootstrap + +.PHONY: configure-stage3-libdecnumber maybe-configure-stage3-libdecnumber +maybe-configure-stage3-libdecnumber: +@if libdecnumber-bootstrap +maybe-configure-stage3-libdecnumber: configure-stage3-libdecnumber +configure-stage3-libdecnumber: + @[ $(current_stage) = stage3 ] || $(MAKE) stage3-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libdecnumber + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/libdecnumber/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage 3 in $(HOST_SUBDIR)/libdecnumber ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libdecnumber ; \ + cd $(HOST_SUBDIR)/libdecnumber || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/libdecnumber/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/libdecnumber"; \ + libsrcdir="$$s/libdecnumber"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif libdecnumber-bootstrap + +.PHONY: configure-stage4-libdecnumber maybe-configure-stage4-libdecnumber +maybe-configure-stage4-libdecnumber: +@if libdecnumber-bootstrap +maybe-configure-stage4-libdecnumber: configure-stage4-libdecnumber +configure-stage4-libdecnumber: + @[ $(current_stage) = stage4 ] || $(MAKE) stage4-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libdecnumber + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/libdecnumber/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage 4 in $(HOST_SUBDIR)/libdecnumber ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libdecnumber ; \ + cd $(HOST_SUBDIR)/libdecnumber || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/libdecnumber/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/libdecnumber"; \ + libsrcdir="$$s/libdecnumber"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif libdecnumber-bootstrap + +.PHONY: configure-stageprofile-libdecnumber maybe-configure-stageprofile-libdecnumber +maybe-configure-stageprofile-libdecnumber: +@if libdecnumber-bootstrap +maybe-configure-stageprofile-libdecnumber: configure-stageprofile-libdecnumber +configure-stageprofile-libdecnumber: + @[ $(current_stage) = stageprofile ] || $(MAKE) stageprofile-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libdecnumber + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/libdecnumber/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage profile in $(HOST_SUBDIR)/libdecnumber ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libdecnumber ; \ + cd $(HOST_SUBDIR)/libdecnumber || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/libdecnumber/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/libdecnumber"; \ + libsrcdir="$$s/libdecnumber"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif libdecnumber-bootstrap + +.PHONY: configure-stagefeedback-libdecnumber maybe-configure-stagefeedback-libdecnumber +maybe-configure-stagefeedback-libdecnumber: +@if libdecnumber-bootstrap +maybe-configure-stagefeedback-libdecnumber: configure-stagefeedback-libdecnumber +configure-stagefeedback-libdecnumber: + @[ $(current_stage) = stagefeedback ] || $(MAKE) stagefeedback-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libdecnumber + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/libdecnumber/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage feedback in $(HOST_SUBDIR)/libdecnumber ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libdecnumber ; \ + cd $(HOST_SUBDIR)/libdecnumber || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/libdecnumber/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/libdecnumber"; \ + libsrcdir="$$s/libdecnumber"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif libdecnumber-bootstrap + + + + + +.PHONY: all-libdecnumber maybe-all-libdecnumber +maybe-all-libdecnumber: +@if libdecnumber +TARGET-libdecnumber=all +maybe-all-libdecnumber: all-libdecnumber +all-libdecnumber: configure-libdecnumber +@endif libdecnumber +@if libdecnumber-bootstrap + @if test -f stage_last; then $(unstage); else $(MAKE) stage1-start; fi +@endif libdecnumber-bootstrap +@if libdecnumber + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/libdecnumber && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-libdecnumber)) +@endif libdecnumber + + + +.PHONY: all-stage1-libdecnumber maybe-all-stage1-libdecnumber +.PHONY: clean-stage1-libdecnumber maybe-clean-stage1-libdecnumber +maybe-all-stage1-libdecnumber: +maybe-clean-stage1-libdecnumber: +@if libdecnumber-bootstrap +maybe-all-stage1-libdecnumber: all-stage1-libdecnumber +all-stage1: all-stage1-libdecnumber +TARGET-stage1-libdecnumber = $(TARGET-libdecnumber) +all-stage1-libdecnumber: configure-stage1-libdecnumber + @[ $(current_stage) = stage1 ] || $(MAKE) stage1-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/libdecnumber && \ + $(MAKE) $(FLAGS_TO_PASS) CFLAGS="$(STAGE1_CFLAGS)" LIBCFLAGS="$(STAGE1_CFLAGS)" \ + $(TARGET-stage1-libdecnumber) + +maybe-clean-stage1-libdecnumber: clean-stage1-libdecnumber +clean-stage1: clean-stage1-libdecnumber +clean-stage1-libdecnumber: + @[ -f $(HOST_SUBDIR)/libdecnumber/Makefile ] || [ -f $(HOST_SUBDIR)/stage1-libdecnumber/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stage1 ] || $(MAKE) stage1-start; \ + cd $(HOST_SUBDIR)/libdecnumber && \ + $(MAKE) $(FLAGS_TO_PASS) \ + CFLAGS="$(STAGE1_CFLAGS)" LIBCFLAGS="$(STAGE1_CFLAGS)" clean +@endif libdecnumber-bootstrap + + +.PHONY: all-stage2-libdecnumber maybe-all-stage2-libdecnumber +.PHONY: clean-stage2-libdecnumber maybe-clean-stage2-libdecnumber +maybe-all-stage2-libdecnumber: +maybe-clean-stage2-libdecnumber: +@if libdecnumber-bootstrap +maybe-all-stage2-libdecnumber: all-stage2-libdecnumber +all-stage2: all-stage2-libdecnumber +TARGET-stage2-libdecnumber = $(TARGET-libdecnumber) +all-stage2-libdecnumber: configure-stage2-libdecnumber + @[ $(current_stage) = stage2 ] || $(MAKE) stage2-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/libdecnumber && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) \ + $(TARGET-stage2-libdecnumber) + +maybe-clean-stage2-libdecnumber: clean-stage2-libdecnumber +clean-stage2: clean-stage2-libdecnumber +clean-stage2-libdecnumber: + @[ -f $(HOST_SUBDIR)/libdecnumber/Makefile ] || [ -f $(HOST_SUBDIR)/stage2-libdecnumber/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stage2 ] || $(MAKE) stage2-start; \ + cd $(HOST_SUBDIR)/libdecnumber && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + clean +@endif libdecnumber-bootstrap + + +.PHONY: all-stage3-libdecnumber maybe-all-stage3-libdecnumber +.PHONY: clean-stage3-libdecnumber maybe-clean-stage3-libdecnumber +maybe-all-stage3-libdecnumber: +maybe-clean-stage3-libdecnumber: +@if libdecnumber-bootstrap +maybe-all-stage3-libdecnumber: all-stage3-libdecnumber +all-stage3: all-stage3-libdecnumber +TARGET-stage3-libdecnumber = $(TARGET-libdecnumber) +all-stage3-libdecnumber: configure-stage3-libdecnumber + @[ $(current_stage) = stage3 ] || $(MAKE) stage3-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/libdecnumber && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) \ + $(TARGET-stage3-libdecnumber) + +maybe-clean-stage3-libdecnumber: clean-stage3-libdecnumber +clean-stage3: clean-stage3-libdecnumber +clean-stage3-libdecnumber: + @[ -f $(HOST_SUBDIR)/libdecnumber/Makefile ] || [ -f $(HOST_SUBDIR)/stage3-libdecnumber/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stage3 ] || $(MAKE) stage3-start; \ + cd $(HOST_SUBDIR)/libdecnumber && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + clean +@endif libdecnumber-bootstrap + + +.PHONY: all-stage4-libdecnumber maybe-all-stage4-libdecnumber +.PHONY: clean-stage4-libdecnumber maybe-clean-stage4-libdecnumber +maybe-all-stage4-libdecnumber: +maybe-clean-stage4-libdecnumber: +@if libdecnumber-bootstrap +maybe-all-stage4-libdecnumber: all-stage4-libdecnumber +all-stage4: all-stage4-libdecnumber +TARGET-stage4-libdecnumber = $(TARGET-libdecnumber) +all-stage4-libdecnumber: configure-stage4-libdecnumber + @[ $(current_stage) = stage4 ] || $(MAKE) stage4-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/libdecnumber && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) \ + $(TARGET-stage4-libdecnumber) + +maybe-clean-stage4-libdecnumber: clean-stage4-libdecnumber +clean-stage4: clean-stage4-libdecnumber +clean-stage4-libdecnumber: + @[ -f $(HOST_SUBDIR)/libdecnumber/Makefile ] || [ -f $(HOST_SUBDIR)/stage4-libdecnumber/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stage4 ] || $(MAKE) stage4-start; \ + cd $(HOST_SUBDIR)/libdecnumber && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + clean +@endif libdecnumber-bootstrap + + +.PHONY: all-stageprofile-libdecnumber maybe-all-stageprofile-libdecnumber +.PHONY: clean-stageprofile-libdecnumber maybe-clean-stageprofile-libdecnumber +maybe-all-stageprofile-libdecnumber: +maybe-clean-stageprofile-libdecnumber: +@if libdecnumber-bootstrap +maybe-all-stageprofile-libdecnumber: all-stageprofile-libdecnumber +all-stageprofile: all-stageprofile-libdecnumber +TARGET-stageprofile-libdecnumber = $(TARGET-libdecnumber) +all-stageprofile-libdecnumber: configure-stageprofile-libdecnumber + @[ $(current_stage) = stageprofile ] || $(MAKE) stageprofile-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/libdecnumber && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) CFLAGS="$(BOOT_CFLAGS) -fprofile-generate" \ + $(TARGET-stageprofile-libdecnumber) + +maybe-clean-stageprofile-libdecnumber: clean-stageprofile-libdecnumber +clean-stageprofile: clean-stageprofile-libdecnumber +clean-stageprofile-libdecnumber: + @[ -f $(HOST_SUBDIR)/libdecnumber/Makefile ] || [ -f $(HOST_SUBDIR)/stageprofile-libdecnumber/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stageprofile ] || $(MAKE) stageprofile-start; \ + cd $(HOST_SUBDIR)/libdecnumber && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + CFLAGS="$(BOOT_CFLAGS) -fprofile-generate" clean +@endif libdecnumber-bootstrap + + +.PHONY: all-stagefeedback-libdecnumber maybe-all-stagefeedback-libdecnumber +.PHONY: clean-stagefeedback-libdecnumber maybe-clean-stagefeedback-libdecnumber +maybe-all-stagefeedback-libdecnumber: +maybe-clean-stagefeedback-libdecnumber: +@if libdecnumber-bootstrap +maybe-all-stagefeedback-libdecnumber: all-stagefeedback-libdecnumber +all-stagefeedback: all-stagefeedback-libdecnumber +TARGET-stagefeedback-libdecnumber = $(TARGET-libdecnumber) +all-stagefeedback-libdecnumber: configure-stagefeedback-libdecnumber + @[ $(current_stage) = stagefeedback ] || $(MAKE) stagefeedback-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/libdecnumber && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) CFLAGS="$(BOOT_CFLAGS) -fprofile-use" \ + $(TARGET-stagefeedback-libdecnumber) + +maybe-clean-stagefeedback-libdecnumber: clean-stagefeedback-libdecnumber +clean-stagefeedback: clean-stagefeedback-libdecnumber +clean-stagefeedback-libdecnumber: + @[ -f $(HOST_SUBDIR)/libdecnumber/Makefile ] || [ -f $(HOST_SUBDIR)/stagefeedback-libdecnumber/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stagefeedback ] || $(MAKE) stagefeedback-start; \ + cd $(HOST_SUBDIR)/libdecnumber && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + CFLAGS="$(BOOT_CFLAGS) -fprofile-use" clean +@endif libdecnumber-bootstrap + + + + + +.PHONY: check-libdecnumber maybe-check-libdecnumber +maybe-check-libdecnumber: +@if libdecnumber +maybe-check-libdecnumber: check-libdecnumber + +check-libdecnumber: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/libdecnumber && \ + $(MAKE) $(FLAGS_TO_PASS) check) + +@endif libdecnumber + +.PHONY: install-libdecnumber maybe-install-libdecnumber +maybe-install-libdecnumber: +@if libdecnumber +maybe-install-libdecnumber: install-libdecnumber + +install-libdecnumber: installdirs + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/libdecnumber && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif libdecnumber + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-libdecnumber info-libdecnumber +maybe-info-libdecnumber: +@if libdecnumber +maybe-info-libdecnumber: info-libdecnumber + +info-libdecnumber: \ + configure-libdecnumber + @[ -f ./libdecnumber/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in libdecnumber" ; \ + (cd $(HOST_SUBDIR)/libdecnumber && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif libdecnumber + +.PHONY: maybe-dvi-libdecnumber dvi-libdecnumber +maybe-dvi-libdecnumber: +@if libdecnumber +maybe-dvi-libdecnumber: dvi-libdecnumber + +dvi-libdecnumber: \ + configure-libdecnumber + @[ -f ./libdecnumber/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in libdecnumber" ; \ + (cd $(HOST_SUBDIR)/libdecnumber && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif libdecnumber + +.PHONY: maybe-html-libdecnumber html-libdecnumber +maybe-html-libdecnumber: +@if libdecnumber +maybe-html-libdecnumber: html-libdecnumber + +html-libdecnumber: \ + configure-libdecnumber + @[ -f ./libdecnumber/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in libdecnumber" ; \ + (cd $(HOST_SUBDIR)/libdecnumber && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif libdecnumber + +.PHONY: maybe-TAGS-libdecnumber TAGS-libdecnumber +maybe-TAGS-libdecnumber: +@if libdecnumber +maybe-TAGS-libdecnumber: TAGS-libdecnumber + +TAGS-libdecnumber: \ + configure-libdecnumber + @[ -f ./libdecnumber/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in libdecnumber" ; \ + (cd $(HOST_SUBDIR)/libdecnumber && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif libdecnumber + +.PHONY: maybe-install-info-libdecnumber install-info-libdecnumber +maybe-install-info-libdecnumber: +@if libdecnumber +maybe-install-info-libdecnumber: install-info-libdecnumber + +install-info-libdecnumber: \ + configure-libdecnumber \ + info-libdecnumber + @[ -f ./libdecnumber/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in libdecnumber" ; \ + (cd $(HOST_SUBDIR)/libdecnumber && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif libdecnumber + +.PHONY: maybe-install-html-libdecnumber install-html-libdecnumber +maybe-install-html-libdecnumber: +@if libdecnumber +maybe-install-html-libdecnumber: install-html-libdecnumber + +install-html-libdecnumber: \ + configure-libdecnumber \ + html-libdecnumber + @[ -f ./libdecnumber/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in libdecnumber" ; \ + (cd $(HOST_SUBDIR)/libdecnumber && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif libdecnumber + +.PHONY: maybe-installcheck-libdecnumber installcheck-libdecnumber +maybe-installcheck-libdecnumber: +@if libdecnumber +maybe-installcheck-libdecnumber: installcheck-libdecnumber + +installcheck-libdecnumber: \ + configure-libdecnumber + @[ -f ./libdecnumber/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in libdecnumber" ; \ + (cd $(HOST_SUBDIR)/libdecnumber && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif libdecnumber + +.PHONY: maybe-mostlyclean-libdecnumber mostlyclean-libdecnumber +maybe-mostlyclean-libdecnumber: +@if libdecnumber +maybe-mostlyclean-libdecnumber: mostlyclean-libdecnumber + +mostlyclean-libdecnumber: + @[ -f ./libdecnumber/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in libdecnumber" ; \ + (cd $(HOST_SUBDIR)/libdecnumber && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif libdecnumber + +.PHONY: maybe-clean-libdecnumber clean-libdecnumber +maybe-clean-libdecnumber: +@if libdecnumber +maybe-clean-libdecnumber: clean-libdecnumber + +clean-libdecnumber: + @[ -f ./libdecnumber/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in libdecnumber" ; \ + (cd $(HOST_SUBDIR)/libdecnumber && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif libdecnumber + +.PHONY: maybe-distclean-libdecnumber distclean-libdecnumber +maybe-distclean-libdecnumber: +@if libdecnumber +maybe-distclean-libdecnumber: distclean-libdecnumber + +distclean-libdecnumber: + @[ -f ./libdecnumber/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in libdecnumber" ; \ + (cd $(HOST_SUBDIR)/libdecnumber && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif libdecnumber + +.PHONY: maybe-maintainer-clean-libdecnumber maintainer-clean-libdecnumber +maybe-maintainer-clean-libdecnumber: +@if libdecnumber +maybe-maintainer-clean-libdecnumber: maintainer-clean-libdecnumber + +maintainer-clean-libdecnumber: + @[ -f ./libdecnumber/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in libdecnumber" ; \ + (cd $(HOST_SUBDIR)/libdecnumber && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif libdecnumber + .PHONY: configure-libgui maybe-configure-libgui maybe-configure-libgui: -configure-libgui: - @test ! -f libgui/Makefile || exit 0; \ - [ -d libgui ] || mkdir libgui; \ - r=`${PWD_COMMAND}`; export r; \ +@if libgui +maybe-configure-libgui: configure-libgui +configure-libgui: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in libgui; \ - cd libgui || exit 1; \ + test ! -f $(HOST_SUBDIR)/libgui/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libgui ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/libgui; \ + cd "$(HOST_SUBDIR)/libgui" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/libgui"; \ - libsrcdir="$$s/libgui";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/libgui"; \ - libsrcdir="$$s/libgui";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/libgui/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/libgui"; \ + libsrcdir="$$s/libgui"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif libgui + + + + .PHONY: all-libgui maybe-all-libgui maybe-all-libgui: +@if libgui +TARGET-libgui=all +maybe-all-libgui: all-libgui all-libgui: configure-libgui + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd libgui && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/libgui && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-libgui)) +@endif libgui + + + .PHONY: check-libgui maybe-check-libgui maybe-check-libgui: +@if libgui +maybe-check-libgui: check-libgui check-libgui: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd libgui && $(MAKE) $(FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/libgui && \ + $(MAKE) $(FLAGS_TO_PASS) check) +@endif libgui .PHONY: install-libgui maybe-install-libgui maybe-install-libgui: +@if libgui +maybe-install-libgui: install-libgui install-libgui: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd libgui && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/libgui && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif libgui + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-libgui info-libgui +maybe-info-libgui: +@if libgui +maybe-info-libgui: info-libgui + +info-libgui: \ + configure-libgui + @: $(MAKE); $(unstage) + @[ -f ./libgui/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in libgui" ; \ + (cd $(HOST_SUBDIR)/libgui && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif libgui + +.PHONY: maybe-dvi-libgui dvi-libgui +maybe-dvi-libgui: +@if libgui +maybe-dvi-libgui: dvi-libgui + +dvi-libgui: \ + configure-libgui + @: $(MAKE); $(unstage) + @[ -f ./libgui/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in libgui" ; \ + (cd $(HOST_SUBDIR)/libgui && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif libgui + +.PHONY: maybe-html-libgui html-libgui +maybe-html-libgui: +@if libgui +maybe-html-libgui: html-libgui + +html-libgui: \ + configure-libgui + @: $(MAKE); $(unstage) + @[ -f ./libgui/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in libgui" ; \ + (cd $(HOST_SUBDIR)/libgui && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif libgui + +.PHONY: maybe-TAGS-libgui TAGS-libgui +maybe-TAGS-libgui: +@if libgui +maybe-TAGS-libgui: TAGS-libgui + +TAGS-libgui: \ + configure-libgui + @: $(MAKE); $(unstage) + @[ -f ./libgui/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in libgui" ; \ + (cd $(HOST_SUBDIR)/libgui && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif libgui + +.PHONY: maybe-install-info-libgui install-info-libgui +maybe-install-info-libgui: +@if libgui +maybe-install-info-libgui: install-info-libgui + +install-info-libgui: \ + configure-libgui \ + info-libgui + @: $(MAKE); $(unstage) + @[ -f ./libgui/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in libgui" ; \ + (cd $(HOST_SUBDIR)/libgui && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif libgui + +.PHONY: maybe-install-html-libgui install-html-libgui +maybe-install-html-libgui: +@if libgui +maybe-install-html-libgui: install-html-libgui + +install-html-libgui: \ + configure-libgui \ + html-libgui + @: $(MAKE); $(unstage) + @[ -f ./libgui/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in libgui" ; \ + (cd $(HOST_SUBDIR)/libgui && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif libgui + +.PHONY: maybe-installcheck-libgui installcheck-libgui +maybe-installcheck-libgui: +@if libgui +maybe-installcheck-libgui: installcheck-libgui + +installcheck-libgui: \ + configure-libgui + @: $(MAKE); $(unstage) + @[ -f ./libgui/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in libgui" ; \ + (cd $(HOST_SUBDIR)/libgui && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif libgui + +.PHONY: maybe-mostlyclean-libgui mostlyclean-libgui +maybe-mostlyclean-libgui: +@if libgui +maybe-mostlyclean-libgui: mostlyclean-libgui + +mostlyclean-libgui: + @: $(MAKE); $(unstage) + @[ -f ./libgui/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in libgui" ; \ + (cd $(HOST_SUBDIR)/libgui && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif libgui + +.PHONY: maybe-clean-libgui clean-libgui +maybe-clean-libgui: +@if libgui +maybe-clean-libgui: clean-libgui + +clean-libgui: + @: $(MAKE); $(unstage) + @[ -f ./libgui/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in libgui" ; \ + (cd $(HOST_SUBDIR)/libgui && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif libgui + +.PHONY: maybe-distclean-libgui distclean-libgui +maybe-distclean-libgui: +@if libgui +maybe-distclean-libgui: distclean-libgui + +distclean-libgui: + @: $(MAKE); $(unstage) + @[ -f ./libgui/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in libgui" ; \ + (cd $(HOST_SUBDIR)/libgui && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif libgui + +.PHONY: maybe-maintainer-clean-libgui maintainer-clean-libgui +maybe-maintainer-clean-libgui: +@if libgui +maybe-maintainer-clean-libgui: maintainer-clean-libgui + +maintainer-clean-libgui: + @: $(MAKE); $(unstage) + @[ -f ./libgui/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in libgui" ; \ + (cd $(HOST_SUBDIR)/libgui && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif libgui + .PHONY: configure-libiberty maybe-configure-libiberty maybe-configure-libiberty: -configure-libiberty: - @test ! -f libiberty/Makefile || exit 0; \ - [ -d libiberty ] || mkdir libiberty; \ - r=`${PWD_COMMAND}`; export r; \ +@if libiberty +maybe-configure-libiberty: configure-libiberty +configure-libiberty: +@endif libiberty +@if libiberty-bootstrap + @if test -f stage_last; then $(unstage); else $(MAKE) stage1-start; fi +@endif libiberty-bootstrap +@if libiberty + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in libiberty; \ - cd libiberty || exit 1; \ + test ! -f $(HOST_SUBDIR)/libiberty/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libiberty ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/libiberty; \ + cd "$(HOST_SUBDIR)/libiberty" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/libiberty"; \ - libsrcdir="$$s/libiberty";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/libiberty"; \ - libsrcdir="$$s/libiberty";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/libiberty/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/libiberty"; \ + libsrcdir="$$s/libiberty"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + || exit 1 +@endif libiberty + + + +.PHONY: configure-stage1-libiberty maybe-configure-stage1-libiberty +maybe-configure-stage1-libiberty: +@if libiberty-bootstrap +maybe-configure-stage1-libiberty: configure-stage1-libiberty +configure-stage1-libiberty: + @[ $(current_stage) = stage1 ] || $(MAKE) stage1-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libiberty + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/libiberty/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + echo Configuring stage 1 in $(HOST_SUBDIR)/libiberty ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libiberty ; \ + cd $(HOST_SUBDIR)/libiberty || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/libiberty/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/libiberty"; \ + libsrcdir="$$s/libiberty"; \ $(SHELL) $${libsrcdir}/configure \ $(HOST_CONFIGARGS) $${srcdiroption} \ - || exit 1 + --disable-intermodule --disable-coverage --enable-languages="$(STAGE1_LANGUAGES)" +@endif libiberty-bootstrap + +.PHONY: configure-stage2-libiberty maybe-configure-stage2-libiberty +maybe-configure-stage2-libiberty: +@if libiberty-bootstrap +maybe-configure-stage2-libiberty: configure-stage2-libiberty +configure-stage2-libiberty: + @[ $(current_stage) = stage2 ] || $(MAKE) stage2-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libiberty + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/libiberty/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage 2 in $(HOST_SUBDIR)/libiberty ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libiberty ; \ + cd $(HOST_SUBDIR)/libiberty || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/libiberty/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/libiberty"; \ + libsrcdir="$$s/libiberty"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif libiberty-bootstrap + +.PHONY: configure-stage3-libiberty maybe-configure-stage3-libiberty +maybe-configure-stage3-libiberty: +@if libiberty-bootstrap +maybe-configure-stage3-libiberty: configure-stage3-libiberty +configure-stage3-libiberty: + @[ $(current_stage) = stage3 ] || $(MAKE) stage3-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libiberty + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/libiberty/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage 3 in $(HOST_SUBDIR)/libiberty ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libiberty ; \ + cd $(HOST_SUBDIR)/libiberty || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/libiberty/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/libiberty"; \ + libsrcdir="$$s/libiberty"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif libiberty-bootstrap + +.PHONY: configure-stage4-libiberty maybe-configure-stage4-libiberty +maybe-configure-stage4-libiberty: +@if libiberty-bootstrap +maybe-configure-stage4-libiberty: configure-stage4-libiberty +configure-stage4-libiberty: + @[ $(current_stage) = stage4 ] || $(MAKE) stage4-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libiberty + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/libiberty/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage 4 in $(HOST_SUBDIR)/libiberty ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libiberty ; \ + cd $(HOST_SUBDIR)/libiberty || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/libiberty/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/libiberty"; \ + libsrcdir="$$s/libiberty"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif libiberty-bootstrap + +.PHONY: configure-stageprofile-libiberty maybe-configure-stageprofile-libiberty +maybe-configure-stageprofile-libiberty: +@if libiberty-bootstrap +maybe-configure-stageprofile-libiberty: configure-stageprofile-libiberty +configure-stageprofile-libiberty: + @[ $(current_stage) = stageprofile ] || $(MAKE) stageprofile-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libiberty + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/libiberty/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage profile in $(HOST_SUBDIR)/libiberty ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libiberty ; \ + cd $(HOST_SUBDIR)/libiberty || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/libiberty/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/libiberty"; \ + libsrcdir="$$s/libiberty"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif libiberty-bootstrap + +.PHONY: configure-stagefeedback-libiberty maybe-configure-stagefeedback-libiberty +maybe-configure-stagefeedback-libiberty: +@if libiberty-bootstrap +maybe-configure-stagefeedback-libiberty: configure-stagefeedback-libiberty +configure-stagefeedback-libiberty: + @[ $(current_stage) = stagefeedback ] || $(MAKE) stagefeedback-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libiberty + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/libiberty/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage feedback in $(HOST_SUBDIR)/libiberty ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libiberty ; \ + cd $(HOST_SUBDIR)/libiberty || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/libiberty/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/libiberty"; \ + libsrcdir="$$s/libiberty"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif libiberty-bootstrap + + + + .PHONY: all-libiberty maybe-all-libiberty maybe-all-libiberty: +@if libiberty +TARGET-libiberty=all +maybe-all-libiberty: all-libiberty all-libiberty: configure-libiberty +@endif libiberty +@if libiberty-bootstrap + @if test -f stage_last; then $(unstage); else $(MAKE) stage1-start; fi +@endif libiberty-bootstrap +@if libiberty @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd libiberty && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/libiberty && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-libiberty)) +@endif libiberty + + + +.PHONY: all-stage1-libiberty maybe-all-stage1-libiberty +.PHONY: clean-stage1-libiberty maybe-clean-stage1-libiberty +maybe-all-stage1-libiberty: +maybe-clean-stage1-libiberty: +@if libiberty-bootstrap +maybe-all-stage1-libiberty: all-stage1-libiberty +all-stage1: all-stage1-libiberty +TARGET-stage1-libiberty = $(TARGET-libiberty) +all-stage1-libiberty: configure-stage1-libiberty + @[ $(current_stage) = stage1 ] || $(MAKE) stage1-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/libiberty && \ + $(MAKE) $(FLAGS_TO_PASS) CFLAGS="$(STAGE1_CFLAGS)" LIBCFLAGS="$(STAGE1_CFLAGS)" \ + $(TARGET-stage1-libiberty) + +maybe-clean-stage1-libiberty: clean-stage1-libiberty +clean-stage1: clean-stage1-libiberty +clean-stage1-libiberty: + @[ -f $(HOST_SUBDIR)/libiberty/Makefile ] || [ -f $(HOST_SUBDIR)/stage1-libiberty/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stage1 ] || $(MAKE) stage1-start; \ + cd $(HOST_SUBDIR)/libiberty && \ + $(MAKE) $(FLAGS_TO_PASS) \ + CFLAGS="$(STAGE1_CFLAGS)" LIBCFLAGS="$(STAGE1_CFLAGS)" clean +@endif libiberty-bootstrap + + +.PHONY: all-stage2-libiberty maybe-all-stage2-libiberty +.PHONY: clean-stage2-libiberty maybe-clean-stage2-libiberty +maybe-all-stage2-libiberty: +maybe-clean-stage2-libiberty: +@if libiberty-bootstrap +maybe-all-stage2-libiberty: all-stage2-libiberty +all-stage2: all-stage2-libiberty +TARGET-stage2-libiberty = $(TARGET-libiberty) +all-stage2-libiberty: configure-stage2-libiberty + @[ $(current_stage) = stage2 ] || $(MAKE) stage2-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/libiberty && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) \ + $(TARGET-stage2-libiberty) + +maybe-clean-stage2-libiberty: clean-stage2-libiberty +clean-stage2: clean-stage2-libiberty +clean-stage2-libiberty: + @[ -f $(HOST_SUBDIR)/libiberty/Makefile ] || [ -f $(HOST_SUBDIR)/stage2-libiberty/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stage2 ] || $(MAKE) stage2-start; \ + cd $(HOST_SUBDIR)/libiberty && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + clean +@endif libiberty-bootstrap + + +.PHONY: all-stage3-libiberty maybe-all-stage3-libiberty +.PHONY: clean-stage3-libiberty maybe-clean-stage3-libiberty +maybe-all-stage3-libiberty: +maybe-clean-stage3-libiberty: +@if libiberty-bootstrap +maybe-all-stage3-libiberty: all-stage3-libiberty +all-stage3: all-stage3-libiberty +TARGET-stage3-libiberty = $(TARGET-libiberty) +all-stage3-libiberty: configure-stage3-libiberty + @[ $(current_stage) = stage3 ] || $(MAKE) stage3-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/libiberty && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) \ + $(TARGET-stage3-libiberty) + +maybe-clean-stage3-libiberty: clean-stage3-libiberty +clean-stage3: clean-stage3-libiberty +clean-stage3-libiberty: + @[ -f $(HOST_SUBDIR)/libiberty/Makefile ] || [ -f $(HOST_SUBDIR)/stage3-libiberty/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stage3 ] || $(MAKE) stage3-start; \ + cd $(HOST_SUBDIR)/libiberty && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + clean +@endif libiberty-bootstrap + + +.PHONY: all-stage4-libiberty maybe-all-stage4-libiberty +.PHONY: clean-stage4-libiberty maybe-clean-stage4-libiberty +maybe-all-stage4-libiberty: +maybe-clean-stage4-libiberty: +@if libiberty-bootstrap +maybe-all-stage4-libiberty: all-stage4-libiberty +all-stage4: all-stage4-libiberty +TARGET-stage4-libiberty = $(TARGET-libiberty) +all-stage4-libiberty: configure-stage4-libiberty + @[ $(current_stage) = stage4 ] || $(MAKE) stage4-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/libiberty && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) \ + $(TARGET-stage4-libiberty) + +maybe-clean-stage4-libiberty: clean-stage4-libiberty +clean-stage4: clean-stage4-libiberty +clean-stage4-libiberty: + @[ -f $(HOST_SUBDIR)/libiberty/Makefile ] || [ -f $(HOST_SUBDIR)/stage4-libiberty/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stage4 ] || $(MAKE) stage4-start; \ + cd $(HOST_SUBDIR)/libiberty && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + clean +@endif libiberty-bootstrap + + +.PHONY: all-stageprofile-libiberty maybe-all-stageprofile-libiberty +.PHONY: clean-stageprofile-libiberty maybe-clean-stageprofile-libiberty +maybe-all-stageprofile-libiberty: +maybe-clean-stageprofile-libiberty: +@if libiberty-bootstrap +maybe-all-stageprofile-libiberty: all-stageprofile-libiberty +all-stageprofile: all-stageprofile-libiberty +TARGET-stageprofile-libiberty = $(TARGET-libiberty) +all-stageprofile-libiberty: configure-stageprofile-libiberty + @[ $(current_stage) = stageprofile ] || $(MAKE) stageprofile-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/libiberty && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) CFLAGS="$(BOOT_CFLAGS) -fprofile-generate" \ + $(TARGET-stageprofile-libiberty) + +maybe-clean-stageprofile-libiberty: clean-stageprofile-libiberty +clean-stageprofile: clean-stageprofile-libiberty +clean-stageprofile-libiberty: + @[ -f $(HOST_SUBDIR)/libiberty/Makefile ] || [ -f $(HOST_SUBDIR)/stageprofile-libiberty/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stageprofile ] || $(MAKE) stageprofile-start; \ + cd $(HOST_SUBDIR)/libiberty && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + CFLAGS="$(BOOT_CFLAGS) -fprofile-generate" clean +@endif libiberty-bootstrap + + +.PHONY: all-stagefeedback-libiberty maybe-all-stagefeedback-libiberty +.PHONY: clean-stagefeedback-libiberty maybe-clean-stagefeedback-libiberty +maybe-all-stagefeedback-libiberty: +maybe-clean-stagefeedback-libiberty: +@if libiberty-bootstrap +maybe-all-stagefeedback-libiberty: all-stagefeedback-libiberty +all-stagefeedback: all-stagefeedback-libiberty +TARGET-stagefeedback-libiberty = $(TARGET-libiberty) +all-stagefeedback-libiberty: configure-stagefeedback-libiberty + @[ $(current_stage) = stagefeedback ] || $(MAKE) stagefeedback-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/libiberty && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) CFLAGS="$(BOOT_CFLAGS) -fprofile-use" \ + $(TARGET-stagefeedback-libiberty) + +maybe-clean-stagefeedback-libiberty: clean-stagefeedback-libiberty +clean-stagefeedback: clean-stagefeedback-libiberty +clean-stagefeedback-libiberty: + @[ -f $(HOST_SUBDIR)/libiberty/Makefile ] || [ -f $(HOST_SUBDIR)/stagefeedback-libiberty/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stagefeedback ] || $(MAKE) stagefeedback-start; \ + cd $(HOST_SUBDIR)/libiberty && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + CFLAGS="$(BOOT_CFLAGS) -fprofile-use" clean +@endif libiberty-bootstrap + + + + .PHONY: check-libiberty maybe-check-libiberty maybe-check-libiberty: +@if libiberty +maybe-check-libiberty: check-libiberty check-libiberty: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd libiberty && $(MAKE) $(FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/libiberty && \ + $(MAKE) $(FLAGS_TO_PASS) check) +@endif libiberty .PHONY: install-libiberty maybe-install-libiberty maybe-install-libiberty: +@if libiberty +maybe-install-libiberty: install-libiberty install-libiberty: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd libiberty && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/libiberty && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif libiberty + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-libiberty info-libiberty +maybe-info-libiberty: +@if libiberty +maybe-info-libiberty: info-libiberty + +info-libiberty: \ + configure-libiberty + @[ -f ./libiberty/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in libiberty" ; \ + (cd $(HOST_SUBDIR)/libiberty && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif libiberty + +.PHONY: maybe-dvi-libiberty dvi-libiberty +maybe-dvi-libiberty: +@if libiberty +maybe-dvi-libiberty: dvi-libiberty + +dvi-libiberty: \ + configure-libiberty + @[ -f ./libiberty/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in libiberty" ; \ + (cd $(HOST_SUBDIR)/libiberty && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif libiberty + +.PHONY: maybe-html-libiberty html-libiberty +maybe-html-libiberty: +@if libiberty +maybe-html-libiberty: html-libiberty + +html-libiberty: \ + configure-libiberty + @[ -f ./libiberty/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in libiberty" ; \ + (cd $(HOST_SUBDIR)/libiberty && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif libiberty + +.PHONY: maybe-TAGS-libiberty TAGS-libiberty +maybe-TAGS-libiberty: +@if libiberty +maybe-TAGS-libiberty: TAGS-libiberty + +TAGS-libiberty: \ + configure-libiberty + @[ -f ./libiberty/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in libiberty" ; \ + (cd $(HOST_SUBDIR)/libiberty && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif libiberty + +.PHONY: maybe-install-info-libiberty install-info-libiberty +maybe-install-info-libiberty: +@if libiberty +maybe-install-info-libiberty: install-info-libiberty + +install-info-libiberty: \ + configure-libiberty \ + info-libiberty + @[ -f ./libiberty/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in libiberty" ; \ + (cd $(HOST_SUBDIR)/libiberty && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif libiberty + +.PHONY: maybe-install-html-libiberty install-html-libiberty +maybe-install-html-libiberty: +@if libiberty +maybe-install-html-libiberty: install-html-libiberty + +install-html-libiberty: \ + configure-libiberty \ + html-libiberty + @[ -f ./libiberty/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in libiberty" ; \ + (cd $(HOST_SUBDIR)/libiberty && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif libiberty + +.PHONY: maybe-installcheck-libiberty installcheck-libiberty +maybe-installcheck-libiberty: +@if libiberty +maybe-installcheck-libiberty: installcheck-libiberty + +installcheck-libiberty: \ + configure-libiberty + @[ -f ./libiberty/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in libiberty" ; \ + (cd $(HOST_SUBDIR)/libiberty && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif libiberty + +.PHONY: maybe-mostlyclean-libiberty mostlyclean-libiberty +maybe-mostlyclean-libiberty: +@if libiberty +maybe-mostlyclean-libiberty: mostlyclean-libiberty + +mostlyclean-libiberty: + @[ -f ./libiberty/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in libiberty" ; \ + (cd $(HOST_SUBDIR)/libiberty && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif libiberty + +.PHONY: maybe-clean-libiberty clean-libiberty +maybe-clean-libiberty: +@if libiberty +maybe-clean-libiberty: clean-libiberty + +clean-libiberty: + @[ -f ./libiberty/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in libiberty" ; \ + (cd $(HOST_SUBDIR)/libiberty && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif libiberty + +.PHONY: maybe-distclean-libiberty distclean-libiberty +maybe-distclean-libiberty: +@if libiberty +maybe-distclean-libiberty: distclean-libiberty + +distclean-libiberty: + @[ -f ./libiberty/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in libiberty" ; \ + (cd $(HOST_SUBDIR)/libiberty && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif libiberty + +.PHONY: maybe-maintainer-clean-libiberty maintainer-clean-libiberty +maybe-maintainer-clean-libiberty: +@if libiberty +maybe-maintainer-clean-libiberty: maintainer-clean-libiberty + +maintainer-clean-libiberty: + @[ -f ./libiberty/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in libiberty" ; \ + (cd $(HOST_SUBDIR)/libiberty && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif libiberty + .PHONY: configure-libtool maybe-configure-libtool maybe-configure-libtool: -configure-libtool: - @test ! -f libtool/Makefile || exit 0; \ - [ -d libtool ] || mkdir libtool; \ - r=`${PWD_COMMAND}`; export r; \ +@if libtool +maybe-configure-libtool: configure-libtool +configure-libtool: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in libtool; \ - cd libtool || exit 1; \ + test ! -f $(HOST_SUBDIR)/libtool/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libtool ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/libtool; \ + cd "$(HOST_SUBDIR)/libtool" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/libtool"; \ - libsrcdir="$$s/libtool";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/libtool"; \ - libsrcdir="$$s/libtool";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/libtool/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/libtool"; \ + libsrcdir="$$s/libtool"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif libtool + + + + .PHONY: all-libtool maybe-all-libtool maybe-all-libtool: +@if libtool +TARGET-libtool=all +maybe-all-libtool: all-libtool all-libtool: configure-libtool + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd libtool && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/libtool && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-libtool)) +@endif libtool + + + .PHONY: check-libtool maybe-check-libtool maybe-check-libtool: +@if libtool +maybe-check-libtool: check-libtool check-libtool: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd libtool && $(MAKE) $(FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/libtool && \ + $(MAKE) $(FLAGS_TO_PASS) check) +@endif libtool .PHONY: install-libtool maybe-install-libtool maybe-install-libtool: +@if libtool +maybe-install-libtool: install-libtool install-libtool: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd libtool && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/libtool && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif libtool + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-libtool info-libtool +maybe-info-libtool: +@if libtool +maybe-info-libtool: info-libtool + +info-libtool: \ + configure-libtool + @: $(MAKE); $(unstage) + @[ -f ./libtool/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in libtool" ; \ + (cd $(HOST_SUBDIR)/libtool && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif libtool + +.PHONY: maybe-dvi-libtool dvi-libtool +maybe-dvi-libtool: +@if libtool +maybe-dvi-libtool: dvi-libtool + +dvi-libtool: \ + configure-libtool + @: $(MAKE); $(unstage) + @[ -f ./libtool/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in libtool" ; \ + (cd $(HOST_SUBDIR)/libtool && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif libtool + +.PHONY: maybe-html-libtool html-libtool +maybe-html-libtool: +@if libtool +maybe-html-libtool: html-libtool + +html-libtool: \ + configure-libtool + @: $(MAKE); $(unstage) + @[ -f ./libtool/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in libtool" ; \ + (cd $(HOST_SUBDIR)/libtool && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif libtool + +.PHONY: maybe-TAGS-libtool TAGS-libtool +maybe-TAGS-libtool: +@if libtool +maybe-TAGS-libtool: TAGS-libtool + +TAGS-libtool: \ + configure-libtool + @: $(MAKE); $(unstage) + @[ -f ./libtool/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in libtool" ; \ + (cd $(HOST_SUBDIR)/libtool && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif libtool + +.PHONY: maybe-install-info-libtool install-info-libtool +maybe-install-info-libtool: +@if libtool +maybe-install-info-libtool: install-info-libtool + +install-info-libtool: \ + configure-libtool \ + info-libtool + @: $(MAKE); $(unstage) + @[ -f ./libtool/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in libtool" ; \ + (cd $(HOST_SUBDIR)/libtool && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif libtool + +.PHONY: maybe-install-html-libtool install-html-libtool +maybe-install-html-libtool: +@if libtool +maybe-install-html-libtool: install-html-libtool + +install-html-libtool: \ + configure-libtool \ + html-libtool + @: $(MAKE); $(unstage) + @[ -f ./libtool/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in libtool" ; \ + (cd $(HOST_SUBDIR)/libtool && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif libtool + +.PHONY: maybe-installcheck-libtool installcheck-libtool +maybe-installcheck-libtool: +@if libtool +maybe-installcheck-libtool: installcheck-libtool + +installcheck-libtool: \ + configure-libtool + @: $(MAKE); $(unstage) + @[ -f ./libtool/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in libtool" ; \ + (cd $(HOST_SUBDIR)/libtool && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif libtool + +.PHONY: maybe-mostlyclean-libtool mostlyclean-libtool +maybe-mostlyclean-libtool: +@if libtool +maybe-mostlyclean-libtool: mostlyclean-libtool + +mostlyclean-libtool: + @: $(MAKE); $(unstage) + @[ -f ./libtool/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in libtool" ; \ + (cd $(HOST_SUBDIR)/libtool && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif libtool + +.PHONY: maybe-clean-libtool clean-libtool +maybe-clean-libtool: +@if libtool +maybe-clean-libtool: clean-libtool + +clean-libtool: + @: $(MAKE); $(unstage) + @[ -f ./libtool/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in libtool" ; \ + (cd $(HOST_SUBDIR)/libtool && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif libtool + +.PHONY: maybe-distclean-libtool distclean-libtool +maybe-distclean-libtool: +@if libtool +maybe-distclean-libtool: distclean-libtool + +distclean-libtool: + @: $(MAKE); $(unstage) + @[ -f ./libtool/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in libtool" ; \ + (cd $(HOST_SUBDIR)/libtool && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif libtool + +.PHONY: maybe-maintainer-clean-libtool maintainer-clean-libtool +maybe-maintainer-clean-libtool: +@if libtool +maybe-maintainer-clean-libtool: maintainer-clean-libtool + +maintainer-clean-libtool: + @: $(MAKE); $(unstage) + @[ -f ./libtool/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in libtool" ; \ + (cd $(HOST_SUBDIR)/libtool && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif libtool + .PHONY: configure-m4 maybe-configure-m4 maybe-configure-m4: -configure-m4: - @test ! -f m4/Makefile || exit 0; \ - [ -d m4 ] || mkdir m4; \ - r=`${PWD_COMMAND}`; export r; \ +@if m4 +maybe-configure-m4: configure-m4 +configure-m4: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in m4; \ - cd m4 || exit 1; \ + test ! -f $(HOST_SUBDIR)/m4/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/m4 ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/m4; \ + cd "$(HOST_SUBDIR)/m4" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/m4"; \ - libsrcdir="$$s/m4";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/m4"; \ - libsrcdir="$$s/m4";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/m4/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/m4"; \ + libsrcdir="$$s/m4"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif m4 + + + + .PHONY: all-m4 maybe-all-m4 maybe-all-m4: +@if m4 +TARGET-m4=all +maybe-all-m4: all-m4 all-m4: configure-m4 + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd m4 && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/m4 && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-m4)) +@endif m4 + + + .PHONY: check-m4 maybe-check-m4 maybe-check-m4: +@if m4 +maybe-check-m4: check-m4 check-m4: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd m4 && $(MAKE) $(FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/m4 && \ + $(MAKE) $(FLAGS_TO_PASS) check) +@endif m4 .PHONY: install-m4 maybe-install-m4 maybe-install-m4: +@if m4 +maybe-install-m4: install-m4 install-m4: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd m4 && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/m4 && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif m4 + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-m4 info-m4 +maybe-info-m4: +@if m4 +maybe-info-m4: info-m4 + +info-m4: \ + configure-m4 + @: $(MAKE); $(unstage) + @[ -f ./m4/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in m4" ; \ + (cd $(HOST_SUBDIR)/m4 && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif m4 + +.PHONY: maybe-dvi-m4 dvi-m4 +maybe-dvi-m4: +@if m4 +maybe-dvi-m4: dvi-m4 + +dvi-m4: \ + configure-m4 + @: $(MAKE); $(unstage) + @[ -f ./m4/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in m4" ; \ + (cd $(HOST_SUBDIR)/m4 && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif m4 + +.PHONY: maybe-html-m4 html-m4 +maybe-html-m4: +@if m4 +maybe-html-m4: html-m4 + +html-m4: \ + configure-m4 + @: $(MAKE); $(unstage) + @[ -f ./m4/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in m4" ; \ + (cd $(HOST_SUBDIR)/m4 && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif m4 + +.PHONY: maybe-TAGS-m4 TAGS-m4 +maybe-TAGS-m4: +@if m4 +maybe-TAGS-m4: TAGS-m4 + +TAGS-m4: \ + configure-m4 + @: $(MAKE); $(unstage) + @[ -f ./m4/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in m4" ; \ + (cd $(HOST_SUBDIR)/m4 && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif m4 + +.PHONY: maybe-install-info-m4 install-info-m4 +maybe-install-info-m4: +@if m4 +maybe-install-info-m4: install-info-m4 + +install-info-m4: \ + configure-m4 \ + info-m4 + @: $(MAKE); $(unstage) + @[ -f ./m4/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in m4" ; \ + (cd $(HOST_SUBDIR)/m4 && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif m4 + +.PHONY: maybe-install-html-m4 install-html-m4 +maybe-install-html-m4: +@if m4 +maybe-install-html-m4: install-html-m4 + +install-html-m4: \ + configure-m4 \ + html-m4 + @: $(MAKE); $(unstage) + @[ -f ./m4/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in m4" ; \ + (cd $(HOST_SUBDIR)/m4 && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif m4 + +.PHONY: maybe-installcheck-m4 installcheck-m4 +maybe-installcheck-m4: +@if m4 +maybe-installcheck-m4: installcheck-m4 + +installcheck-m4: \ + configure-m4 + @: $(MAKE); $(unstage) + @[ -f ./m4/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in m4" ; \ + (cd $(HOST_SUBDIR)/m4 && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif m4 + +.PHONY: maybe-mostlyclean-m4 mostlyclean-m4 +maybe-mostlyclean-m4: +@if m4 +maybe-mostlyclean-m4: mostlyclean-m4 + +mostlyclean-m4: + @: $(MAKE); $(unstage) + @[ -f ./m4/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in m4" ; \ + (cd $(HOST_SUBDIR)/m4 && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif m4 + +.PHONY: maybe-clean-m4 clean-m4 +maybe-clean-m4: +@if m4 +maybe-clean-m4: clean-m4 + +clean-m4: + @: $(MAKE); $(unstage) + @[ -f ./m4/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in m4" ; \ + (cd $(HOST_SUBDIR)/m4 && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif m4 + +.PHONY: maybe-distclean-m4 distclean-m4 +maybe-distclean-m4: +@if m4 +maybe-distclean-m4: distclean-m4 + +distclean-m4: + @: $(MAKE); $(unstage) + @[ -f ./m4/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in m4" ; \ + (cd $(HOST_SUBDIR)/m4 && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif m4 + +.PHONY: maybe-maintainer-clean-m4 maintainer-clean-m4 +maybe-maintainer-clean-m4: +@if m4 +maybe-maintainer-clean-m4: maintainer-clean-m4 + +maintainer-clean-m4: + @: $(MAKE); $(unstage) + @[ -f ./m4/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in m4" ; \ + (cd $(HOST_SUBDIR)/m4 && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif m4 + .PHONY: configure-make maybe-configure-make maybe-configure-make: -configure-make: - @test ! -f make/Makefile || exit 0; \ - [ -d make ] || mkdir make; \ - r=`${PWD_COMMAND}`; export r; \ +@if make +maybe-configure-make: configure-make +configure-make: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in make; \ - cd make || exit 1; \ + test ! -f $(HOST_SUBDIR)/make/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/make ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/make; \ + cd "$(HOST_SUBDIR)/make" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/make"; \ - libsrcdir="$$s/make";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/make"; \ - libsrcdir="$$s/make";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/make/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/make"; \ + libsrcdir="$$s/make"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif make + + + + .PHONY: all-make maybe-all-make maybe-all-make: +@if make +TARGET-make=all +maybe-all-make: all-make all-make: configure-make + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd make && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/make && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-make)) +@endif make + + + .PHONY: check-make maybe-check-make maybe-check-make: +@if make +maybe-check-make: check-make check-make: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd make && $(MAKE) $(FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/make && \ + $(MAKE) $(FLAGS_TO_PASS) check) +@endif make .PHONY: install-make maybe-install-make maybe-install-make: +@if make +maybe-install-make: install-make install-make: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd make && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/make && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif make + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-make info-make +maybe-info-make: +@if make +maybe-info-make: info-make + +info-make: \ + configure-make + @: $(MAKE); $(unstage) + @[ -f ./make/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in make" ; \ + (cd $(HOST_SUBDIR)/make && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif make + +.PHONY: maybe-dvi-make dvi-make +maybe-dvi-make: +@if make +maybe-dvi-make: dvi-make + +dvi-make: \ + configure-make + @: $(MAKE); $(unstage) + @[ -f ./make/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in make" ; \ + (cd $(HOST_SUBDIR)/make && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif make + +.PHONY: maybe-html-make html-make +maybe-html-make: +@if make +maybe-html-make: html-make + +html-make: \ + configure-make + @: $(MAKE); $(unstage) + @[ -f ./make/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in make" ; \ + (cd $(HOST_SUBDIR)/make && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif make + +.PHONY: maybe-TAGS-make TAGS-make +maybe-TAGS-make: +@if make +maybe-TAGS-make: TAGS-make + +TAGS-make: \ + configure-make + @: $(MAKE); $(unstage) + @[ -f ./make/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in make" ; \ + (cd $(HOST_SUBDIR)/make && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif make + +.PHONY: maybe-install-info-make install-info-make +maybe-install-info-make: +@if make +maybe-install-info-make: install-info-make + +install-info-make: \ + configure-make \ + info-make + @: $(MAKE); $(unstage) + @[ -f ./make/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in make" ; \ + (cd $(HOST_SUBDIR)/make && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif make + +.PHONY: maybe-install-html-make install-html-make +maybe-install-html-make: +@if make +maybe-install-html-make: install-html-make + +install-html-make: \ + configure-make \ + html-make + @: $(MAKE); $(unstage) + @[ -f ./make/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in make" ; \ + (cd $(HOST_SUBDIR)/make && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif make + +.PHONY: maybe-installcheck-make installcheck-make +maybe-installcheck-make: +@if make +maybe-installcheck-make: installcheck-make + +installcheck-make: \ + configure-make + @: $(MAKE); $(unstage) + @[ -f ./make/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in make" ; \ + (cd $(HOST_SUBDIR)/make && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif make + +.PHONY: maybe-mostlyclean-make mostlyclean-make +maybe-mostlyclean-make: +@if make +maybe-mostlyclean-make: mostlyclean-make + +mostlyclean-make: + @: $(MAKE); $(unstage) + @[ -f ./make/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in make" ; \ + (cd $(HOST_SUBDIR)/make && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif make + +.PHONY: maybe-clean-make clean-make +maybe-clean-make: +@if make +maybe-clean-make: clean-make + +clean-make: + @: $(MAKE); $(unstage) + @[ -f ./make/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in make" ; \ + (cd $(HOST_SUBDIR)/make && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif make + +.PHONY: maybe-distclean-make distclean-make +maybe-distclean-make: +@if make +maybe-distclean-make: distclean-make + +distclean-make: + @: $(MAKE); $(unstage) + @[ -f ./make/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in make" ; \ + (cd $(HOST_SUBDIR)/make && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif make + +.PHONY: maybe-maintainer-clean-make maintainer-clean-make +maybe-maintainer-clean-make: +@if make +maybe-maintainer-clean-make: maintainer-clean-make + +maintainer-clean-make: + @: $(MAKE); $(unstage) + @[ -f ./make/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in make" ; \ + (cd $(HOST_SUBDIR)/make && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif make + .PHONY: configure-mmalloc maybe-configure-mmalloc maybe-configure-mmalloc: -configure-mmalloc: - @test ! -f mmalloc/Makefile || exit 0; \ - [ -d mmalloc ] || mkdir mmalloc; \ - r=`${PWD_COMMAND}`; export r; \ +@if mmalloc +maybe-configure-mmalloc: configure-mmalloc +configure-mmalloc: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in mmalloc; \ - cd mmalloc || exit 1; \ + test ! -f $(HOST_SUBDIR)/mmalloc/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/mmalloc ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/mmalloc; \ + cd "$(HOST_SUBDIR)/mmalloc" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/mmalloc"; \ - libsrcdir="$$s/mmalloc";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/mmalloc"; \ - libsrcdir="$$s/mmalloc";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/mmalloc/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/mmalloc"; \ + libsrcdir="$$s/mmalloc"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif mmalloc + + + + .PHONY: all-mmalloc maybe-all-mmalloc maybe-all-mmalloc: +@if mmalloc +TARGET-mmalloc=all +maybe-all-mmalloc: all-mmalloc all-mmalloc: configure-mmalloc + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd mmalloc && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/mmalloc && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-mmalloc)) +@endif mmalloc + + + .PHONY: check-mmalloc maybe-check-mmalloc maybe-check-mmalloc: +@if mmalloc +maybe-check-mmalloc: check-mmalloc check-mmalloc: +@endif mmalloc .PHONY: install-mmalloc maybe-install-mmalloc maybe-install-mmalloc: +@if mmalloc +maybe-install-mmalloc: install-mmalloc install-mmalloc: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd mmalloc && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/mmalloc && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif mmalloc + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-mmalloc info-mmalloc +maybe-info-mmalloc: +@if mmalloc +maybe-info-mmalloc: info-mmalloc + +info-mmalloc: \ + configure-mmalloc + @: $(MAKE); $(unstage) + @[ -f ./mmalloc/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in mmalloc" ; \ + (cd $(HOST_SUBDIR)/mmalloc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif mmalloc + +.PHONY: maybe-dvi-mmalloc dvi-mmalloc +maybe-dvi-mmalloc: +@if mmalloc +maybe-dvi-mmalloc: dvi-mmalloc + +dvi-mmalloc: \ + configure-mmalloc + @: $(MAKE); $(unstage) + @[ -f ./mmalloc/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in mmalloc" ; \ + (cd $(HOST_SUBDIR)/mmalloc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif mmalloc + +.PHONY: maybe-html-mmalloc html-mmalloc +maybe-html-mmalloc: +@if mmalloc +maybe-html-mmalloc: html-mmalloc + +html-mmalloc: \ + configure-mmalloc + @: $(MAKE); $(unstage) + @[ -f ./mmalloc/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in mmalloc" ; \ + (cd $(HOST_SUBDIR)/mmalloc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif mmalloc + +.PHONY: maybe-TAGS-mmalloc TAGS-mmalloc +maybe-TAGS-mmalloc: +@if mmalloc +maybe-TAGS-mmalloc: TAGS-mmalloc + +TAGS-mmalloc: \ + configure-mmalloc + @: $(MAKE); $(unstage) + @[ -f ./mmalloc/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in mmalloc" ; \ + (cd $(HOST_SUBDIR)/mmalloc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif mmalloc + +.PHONY: maybe-install-info-mmalloc install-info-mmalloc +maybe-install-info-mmalloc: +@if mmalloc +maybe-install-info-mmalloc: install-info-mmalloc + +install-info-mmalloc: \ + configure-mmalloc \ + info-mmalloc + @: $(MAKE); $(unstage) + @[ -f ./mmalloc/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in mmalloc" ; \ + (cd $(HOST_SUBDIR)/mmalloc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif mmalloc + +.PHONY: maybe-install-html-mmalloc install-html-mmalloc +maybe-install-html-mmalloc: +@if mmalloc +maybe-install-html-mmalloc: install-html-mmalloc + +install-html-mmalloc: \ + configure-mmalloc \ + html-mmalloc + @: $(MAKE); $(unstage) + @[ -f ./mmalloc/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in mmalloc" ; \ + (cd $(HOST_SUBDIR)/mmalloc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif mmalloc + +.PHONY: maybe-installcheck-mmalloc installcheck-mmalloc +maybe-installcheck-mmalloc: +@if mmalloc +maybe-installcheck-mmalloc: installcheck-mmalloc + +installcheck-mmalloc: \ + configure-mmalloc + @: $(MAKE); $(unstage) + @[ -f ./mmalloc/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in mmalloc" ; \ + (cd $(HOST_SUBDIR)/mmalloc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif mmalloc + +.PHONY: maybe-mostlyclean-mmalloc mostlyclean-mmalloc +maybe-mostlyclean-mmalloc: +@if mmalloc +maybe-mostlyclean-mmalloc: mostlyclean-mmalloc + +mostlyclean-mmalloc: + @: $(MAKE); $(unstage) + @[ -f ./mmalloc/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in mmalloc" ; \ + (cd $(HOST_SUBDIR)/mmalloc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif mmalloc + +.PHONY: maybe-clean-mmalloc clean-mmalloc +maybe-clean-mmalloc: +@if mmalloc +maybe-clean-mmalloc: clean-mmalloc + +clean-mmalloc: + @: $(MAKE); $(unstage) + @[ -f ./mmalloc/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in mmalloc" ; \ + (cd $(HOST_SUBDIR)/mmalloc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif mmalloc + +.PHONY: maybe-distclean-mmalloc distclean-mmalloc +maybe-distclean-mmalloc: +@if mmalloc +maybe-distclean-mmalloc: distclean-mmalloc + +distclean-mmalloc: + @: $(MAKE); $(unstage) + @[ -f ./mmalloc/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in mmalloc" ; \ + (cd $(HOST_SUBDIR)/mmalloc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif mmalloc + +.PHONY: maybe-maintainer-clean-mmalloc maintainer-clean-mmalloc +maybe-maintainer-clean-mmalloc: +@if mmalloc +maybe-maintainer-clean-mmalloc: maintainer-clean-mmalloc + +maintainer-clean-mmalloc: + @: $(MAKE); $(unstage) + @[ -f ./mmalloc/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in mmalloc" ; \ + (cd $(HOST_SUBDIR)/mmalloc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif mmalloc + .PHONY: configure-patch maybe-configure-patch maybe-configure-patch: -configure-patch: - @test ! -f patch/Makefile || exit 0; \ - [ -d patch ] || mkdir patch; \ - r=`${PWD_COMMAND}`; export r; \ +@if patch +maybe-configure-patch: configure-patch +configure-patch: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in patch; \ - cd patch || exit 1; \ + test ! -f $(HOST_SUBDIR)/patch/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/patch ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/patch; \ + cd "$(HOST_SUBDIR)/patch" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/patch"; \ - libsrcdir="$$s/patch";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/patch"; \ - libsrcdir="$$s/patch";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/patch/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/patch"; \ + libsrcdir="$$s/patch"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif patch + + + + .PHONY: all-patch maybe-all-patch maybe-all-patch: +@if patch +TARGET-patch=all +maybe-all-patch: all-patch all-patch: configure-patch + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd patch && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/patch && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-patch)) +@endif patch + + + .PHONY: check-patch maybe-check-patch maybe-check-patch: +@if patch +maybe-check-patch: check-patch check-patch: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd patch && $(MAKE) $(FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/patch && \ + $(MAKE) $(FLAGS_TO_PASS) check) +@endif patch .PHONY: install-patch maybe-install-patch maybe-install-patch: +@if patch +maybe-install-patch: install-patch install-patch: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd patch && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/patch && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif patch + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-patch info-patch +maybe-info-patch: +@if patch +maybe-info-patch: info-patch + +info-patch: \ + configure-patch + @: $(MAKE); $(unstage) + @[ -f ./patch/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in patch" ; \ + (cd $(HOST_SUBDIR)/patch && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif patch + +.PHONY: maybe-dvi-patch dvi-patch +maybe-dvi-patch: +@if patch +maybe-dvi-patch: dvi-patch + +dvi-patch: \ + configure-patch + @: $(MAKE); $(unstage) + @[ -f ./patch/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in patch" ; \ + (cd $(HOST_SUBDIR)/patch && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif patch + +.PHONY: maybe-html-patch html-patch +maybe-html-patch: +@if patch +maybe-html-patch: html-patch + +html-patch: \ + configure-patch + @: $(MAKE); $(unstage) + @[ -f ./patch/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in patch" ; \ + (cd $(HOST_SUBDIR)/patch && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif patch + +.PHONY: maybe-TAGS-patch TAGS-patch +maybe-TAGS-patch: +@if patch +maybe-TAGS-patch: TAGS-patch + +TAGS-patch: \ + configure-patch + @: $(MAKE); $(unstage) + @[ -f ./patch/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in patch" ; \ + (cd $(HOST_SUBDIR)/patch && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif patch + +.PHONY: maybe-install-info-patch install-info-patch +maybe-install-info-patch: +@if patch +maybe-install-info-patch: install-info-patch + +install-info-patch: \ + configure-patch \ + info-patch + @: $(MAKE); $(unstage) + @[ -f ./patch/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in patch" ; \ + (cd $(HOST_SUBDIR)/patch && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif patch + +.PHONY: maybe-install-html-patch install-html-patch +maybe-install-html-patch: +@if patch +maybe-install-html-patch: install-html-patch + +install-html-patch: \ + configure-patch \ + html-patch + @: $(MAKE); $(unstage) + @[ -f ./patch/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in patch" ; \ + (cd $(HOST_SUBDIR)/patch && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif patch + +.PHONY: maybe-installcheck-patch installcheck-patch +maybe-installcheck-patch: +@if patch +maybe-installcheck-patch: installcheck-patch + +installcheck-patch: \ + configure-patch + @: $(MAKE); $(unstage) + @[ -f ./patch/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in patch" ; \ + (cd $(HOST_SUBDIR)/patch && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif patch + +.PHONY: maybe-mostlyclean-patch mostlyclean-patch +maybe-mostlyclean-patch: +@if patch +maybe-mostlyclean-patch: mostlyclean-patch + +mostlyclean-patch: + @: $(MAKE); $(unstage) + @[ -f ./patch/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in patch" ; \ + (cd $(HOST_SUBDIR)/patch && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif patch + +.PHONY: maybe-clean-patch clean-patch +maybe-clean-patch: +@if patch +maybe-clean-patch: clean-patch + +clean-patch: + @: $(MAKE); $(unstage) + @[ -f ./patch/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in patch" ; \ + (cd $(HOST_SUBDIR)/patch && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif patch + +.PHONY: maybe-distclean-patch distclean-patch +maybe-distclean-patch: +@if patch +maybe-distclean-patch: distclean-patch + +distclean-patch: + @: $(MAKE); $(unstage) + @[ -f ./patch/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in patch" ; \ + (cd $(HOST_SUBDIR)/patch && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif patch + +.PHONY: maybe-maintainer-clean-patch maintainer-clean-patch +maybe-maintainer-clean-patch: +@if patch +maybe-maintainer-clean-patch: maintainer-clean-patch + +maintainer-clean-patch: + @: $(MAKE); $(unstage) + @[ -f ./patch/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in patch" ; \ + (cd $(HOST_SUBDIR)/patch && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif patch + .PHONY: configure-perl maybe-configure-perl maybe-configure-perl: -configure-perl: - @test ! -f perl/Makefile || exit 0; \ - [ -d perl ] || mkdir perl; \ - r=`${PWD_COMMAND}`; export r; \ +@if perl +maybe-configure-perl: configure-perl +configure-perl: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in perl; \ - cd perl || exit 1; \ + test ! -f $(HOST_SUBDIR)/perl/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/perl ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/perl; \ + cd "$(HOST_SUBDIR)/perl" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/perl"; \ - libsrcdir="$$s/perl";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/perl"; \ - libsrcdir="$$s/perl";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/perl/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/perl"; \ + libsrcdir="$$s/perl"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif perl + + + + .PHONY: all-perl maybe-all-perl maybe-all-perl: +@if perl +TARGET-perl=all +maybe-all-perl: all-perl all-perl: configure-perl + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd perl && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/perl && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-perl)) +@endif perl + + + .PHONY: check-perl maybe-check-perl maybe-check-perl: +@if perl +maybe-check-perl: check-perl check-perl: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd perl && $(MAKE) $(FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/perl && \ + $(MAKE) $(FLAGS_TO_PASS) check) +@endif perl .PHONY: install-perl maybe-install-perl maybe-install-perl: +@if perl +maybe-install-perl: install-perl install-perl: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd perl && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/perl && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif perl + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-perl info-perl +maybe-info-perl: +@if perl +maybe-info-perl: info-perl + +info-perl: \ + configure-perl + @: $(MAKE); $(unstage) + @[ -f ./perl/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in perl" ; \ + (cd $(HOST_SUBDIR)/perl && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif perl + +.PHONY: maybe-dvi-perl dvi-perl +maybe-dvi-perl: +@if perl +maybe-dvi-perl: dvi-perl + +dvi-perl: \ + configure-perl + @: $(MAKE); $(unstage) + @[ -f ./perl/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in perl" ; \ + (cd $(HOST_SUBDIR)/perl && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif perl + +.PHONY: maybe-html-perl html-perl +maybe-html-perl: +@if perl +maybe-html-perl: html-perl + +html-perl: \ + configure-perl + @: $(MAKE); $(unstage) + @[ -f ./perl/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in perl" ; \ + (cd $(HOST_SUBDIR)/perl && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif perl + +.PHONY: maybe-TAGS-perl TAGS-perl +maybe-TAGS-perl: +@if perl +maybe-TAGS-perl: TAGS-perl + +TAGS-perl: \ + configure-perl + @: $(MAKE); $(unstage) + @[ -f ./perl/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in perl" ; \ + (cd $(HOST_SUBDIR)/perl && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif perl + +.PHONY: maybe-install-info-perl install-info-perl +maybe-install-info-perl: +@if perl +maybe-install-info-perl: install-info-perl + +install-info-perl: \ + configure-perl \ + info-perl + @: $(MAKE); $(unstage) + @[ -f ./perl/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in perl" ; \ + (cd $(HOST_SUBDIR)/perl && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif perl + +.PHONY: maybe-install-html-perl install-html-perl +maybe-install-html-perl: +@if perl +maybe-install-html-perl: install-html-perl + +install-html-perl: \ + configure-perl \ + html-perl + @: $(MAKE); $(unstage) + @[ -f ./perl/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in perl" ; \ + (cd $(HOST_SUBDIR)/perl && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif perl + +.PHONY: maybe-installcheck-perl installcheck-perl +maybe-installcheck-perl: +@if perl +maybe-installcheck-perl: installcheck-perl + +installcheck-perl: \ + configure-perl + @: $(MAKE); $(unstage) + @[ -f ./perl/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in perl" ; \ + (cd $(HOST_SUBDIR)/perl && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif perl + +.PHONY: maybe-mostlyclean-perl mostlyclean-perl +maybe-mostlyclean-perl: +@if perl +maybe-mostlyclean-perl: mostlyclean-perl + +mostlyclean-perl: + @: $(MAKE); $(unstage) + @[ -f ./perl/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in perl" ; \ + (cd $(HOST_SUBDIR)/perl && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif perl + +.PHONY: maybe-clean-perl clean-perl +maybe-clean-perl: +@if perl +maybe-clean-perl: clean-perl + +clean-perl: + @: $(MAKE); $(unstage) + @[ -f ./perl/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in perl" ; \ + (cd $(HOST_SUBDIR)/perl && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif perl + +.PHONY: maybe-distclean-perl distclean-perl +maybe-distclean-perl: +@if perl +maybe-distclean-perl: distclean-perl + +distclean-perl: + @: $(MAKE); $(unstage) + @[ -f ./perl/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in perl" ; \ + (cd $(HOST_SUBDIR)/perl && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif perl + +.PHONY: maybe-maintainer-clean-perl maintainer-clean-perl +maybe-maintainer-clean-perl: +@if perl +maybe-maintainer-clean-perl: maintainer-clean-perl + +maintainer-clean-perl: + @: $(MAKE); $(unstage) + @[ -f ./perl/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in perl" ; \ + (cd $(HOST_SUBDIR)/perl && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif perl + .PHONY: configure-prms maybe-configure-prms maybe-configure-prms: -configure-prms: - @test ! -f prms/Makefile || exit 0; \ - [ -d prms ] || mkdir prms; \ - r=`${PWD_COMMAND}`; export r; \ +@if prms +maybe-configure-prms: configure-prms +configure-prms: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in prms; \ - cd prms || exit 1; \ + test ! -f $(HOST_SUBDIR)/prms/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/prms ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/prms; \ + cd "$(HOST_SUBDIR)/prms" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/prms"; \ - libsrcdir="$$s/prms";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/prms"; \ - libsrcdir="$$s/prms";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/prms/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/prms"; \ + libsrcdir="$$s/prms"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif prms + + + + .PHONY: all-prms maybe-all-prms maybe-all-prms: +@if prms +TARGET-prms=all +maybe-all-prms: all-prms all-prms: configure-prms + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd prms && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/prms && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-prms)) +@endif prms + + + .PHONY: check-prms maybe-check-prms maybe-check-prms: +@if prms +maybe-check-prms: check-prms check-prms: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd prms && $(MAKE) $(FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/prms && \ + $(MAKE) $(FLAGS_TO_PASS) check) +@endif prms .PHONY: install-prms maybe-install-prms maybe-install-prms: +@if prms +maybe-install-prms: install-prms install-prms: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd prms && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/prms && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif prms + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-prms info-prms +maybe-info-prms: +@if prms +maybe-info-prms: info-prms + +info-prms: \ + configure-prms + @: $(MAKE); $(unstage) + @[ -f ./prms/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in prms" ; \ + (cd $(HOST_SUBDIR)/prms && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif prms + +.PHONY: maybe-dvi-prms dvi-prms +maybe-dvi-prms: +@if prms +maybe-dvi-prms: dvi-prms + +dvi-prms: \ + configure-prms + @: $(MAKE); $(unstage) + @[ -f ./prms/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in prms" ; \ + (cd $(HOST_SUBDIR)/prms && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif prms + +.PHONY: maybe-html-prms html-prms +maybe-html-prms: +@if prms +maybe-html-prms: html-prms + +html-prms: \ + configure-prms + @: $(MAKE); $(unstage) + @[ -f ./prms/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in prms" ; \ + (cd $(HOST_SUBDIR)/prms && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif prms + +.PHONY: maybe-TAGS-prms TAGS-prms +maybe-TAGS-prms: +@if prms +maybe-TAGS-prms: TAGS-prms + +TAGS-prms: \ + configure-prms + @: $(MAKE); $(unstage) + @[ -f ./prms/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in prms" ; \ + (cd $(HOST_SUBDIR)/prms && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif prms + +.PHONY: maybe-install-info-prms install-info-prms +maybe-install-info-prms: +@if prms +maybe-install-info-prms: install-info-prms + +install-info-prms: \ + configure-prms \ + info-prms + @: $(MAKE); $(unstage) + @[ -f ./prms/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in prms" ; \ + (cd $(HOST_SUBDIR)/prms && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif prms + +.PHONY: maybe-install-html-prms install-html-prms +maybe-install-html-prms: +@if prms +maybe-install-html-prms: install-html-prms + +install-html-prms: \ + configure-prms \ + html-prms + @: $(MAKE); $(unstage) + @[ -f ./prms/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in prms" ; \ + (cd $(HOST_SUBDIR)/prms && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif prms + +.PHONY: maybe-installcheck-prms installcheck-prms +maybe-installcheck-prms: +@if prms +maybe-installcheck-prms: installcheck-prms + +installcheck-prms: \ + configure-prms + @: $(MAKE); $(unstage) + @[ -f ./prms/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in prms" ; \ + (cd $(HOST_SUBDIR)/prms && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif prms + +.PHONY: maybe-mostlyclean-prms mostlyclean-prms +maybe-mostlyclean-prms: +@if prms +maybe-mostlyclean-prms: mostlyclean-prms + +mostlyclean-prms: + @: $(MAKE); $(unstage) + @[ -f ./prms/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in prms" ; \ + (cd $(HOST_SUBDIR)/prms && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif prms + +.PHONY: maybe-clean-prms clean-prms +maybe-clean-prms: +@if prms +maybe-clean-prms: clean-prms + +clean-prms: + @: $(MAKE); $(unstage) + @[ -f ./prms/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in prms" ; \ + (cd $(HOST_SUBDIR)/prms && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif prms + +.PHONY: maybe-distclean-prms distclean-prms +maybe-distclean-prms: +@if prms +maybe-distclean-prms: distclean-prms + +distclean-prms: + @: $(MAKE); $(unstage) + @[ -f ./prms/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in prms" ; \ + (cd $(HOST_SUBDIR)/prms && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif prms + +.PHONY: maybe-maintainer-clean-prms maintainer-clean-prms +maybe-maintainer-clean-prms: +@if prms +maybe-maintainer-clean-prms: maintainer-clean-prms + +maintainer-clean-prms: + @: $(MAKE); $(unstage) + @[ -f ./prms/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in prms" ; \ + (cd $(HOST_SUBDIR)/prms && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif prms + .PHONY: configure-rcs maybe-configure-rcs maybe-configure-rcs: -configure-rcs: - @test ! -f rcs/Makefile || exit 0; \ - [ -d rcs ] || mkdir rcs; \ - r=`${PWD_COMMAND}`; export r; \ +@if rcs +maybe-configure-rcs: configure-rcs +configure-rcs: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in rcs; \ - cd rcs || exit 1; \ + test ! -f $(HOST_SUBDIR)/rcs/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/rcs ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/rcs; \ + cd "$(HOST_SUBDIR)/rcs" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/rcs"; \ - libsrcdir="$$s/rcs";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/rcs"; \ - libsrcdir="$$s/rcs";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/rcs/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/rcs"; \ + libsrcdir="$$s/rcs"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif rcs + + + + .PHONY: all-rcs maybe-all-rcs maybe-all-rcs: +@if rcs +TARGET-rcs=all +maybe-all-rcs: all-rcs all-rcs: configure-rcs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd rcs && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/rcs && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-rcs)) +@endif rcs + + + .PHONY: check-rcs maybe-check-rcs maybe-check-rcs: +@if rcs +maybe-check-rcs: check-rcs check-rcs: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd rcs && $(MAKE) $(FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/rcs && \ + $(MAKE) $(FLAGS_TO_PASS) check) +@endif rcs .PHONY: install-rcs maybe-install-rcs maybe-install-rcs: +@if rcs +maybe-install-rcs: install-rcs install-rcs: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd rcs && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/rcs && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif rcs + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-rcs info-rcs +maybe-info-rcs: +@if rcs +maybe-info-rcs: info-rcs + +info-rcs: \ + configure-rcs + @: $(MAKE); $(unstage) + @[ -f ./rcs/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in rcs" ; \ + (cd $(HOST_SUBDIR)/rcs && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif rcs + +.PHONY: maybe-dvi-rcs dvi-rcs +maybe-dvi-rcs: +@if rcs +maybe-dvi-rcs: dvi-rcs + +dvi-rcs: \ + configure-rcs + @: $(MAKE); $(unstage) + @[ -f ./rcs/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in rcs" ; \ + (cd $(HOST_SUBDIR)/rcs && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif rcs + +.PHONY: maybe-html-rcs html-rcs +maybe-html-rcs: +@if rcs +maybe-html-rcs: html-rcs + +html-rcs: \ + configure-rcs + @: $(MAKE); $(unstage) + @[ -f ./rcs/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in rcs" ; \ + (cd $(HOST_SUBDIR)/rcs && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif rcs + +.PHONY: maybe-TAGS-rcs TAGS-rcs +maybe-TAGS-rcs: +@if rcs +maybe-TAGS-rcs: TAGS-rcs + +TAGS-rcs: \ + configure-rcs + @: $(MAKE); $(unstage) + @[ -f ./rcs/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in rcs" ; \ + (cd $(HOST_SUBDIR)/rcs && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif rcs + +.PHONY: maybe-install-info-rcs install-info-rcs +maybe-install-info-rcs: +@if rcs +maybe-install-info-rcs: install-info-rcs + +install-info-rcs: \ + configure-rcs \ + info-rcs + @: $(MAKE); $(unstage) + @[ -f ./rcs/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in rcs" ; \ + (cd $(HOST_SUBDIR)/rcs && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif rcs + +.PHONY: maybe-install-html-rcs install-html-rcs +maybe-install-html-rcs: +@if rcs +maybe-install-html-rcs: install-html-rcs + +install-html-rcs: \ + configure-rcs \ + html-rcs + @: $(MAKE); $(unstage) + @[ -f ./rcs/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in rcs" ; \ + (cd $(HOST_SUBDIR)/rcs && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif rcs + +.PHONY: maybe-installcheck-rcs installcheck-rcs +maybe-installcheck-rcs: +@if rcs +maybe-installcheck-rcs: installcheck-rcs + +installcheck-rcs: \ + configure-rcs + @: $(MAKE); $(unstage) + @[ -f ./rcs/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in rcs" ; \ + (cd $(HOST_SUBDIR)/rcs && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif rcs + +.PHONY: maybe-mostlyclean-rcs mostlyclean-rcs +maybe-mostlyclean-rcs: +@if rcs +maybe-mostlyclean-rcs: mostlyclean-rcs + +mostlyclean-rcs: + @: $(MAKE); $(unstage) + @[ -f ./rcs/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in rcs" ; \ + (cd $(HOST_SUBDIR)/rcs && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif rcs + +.PHONY: maybe-clean-rcs clean-rcs +maybe-clean-rcs: +@if rcs +maybe-clean-rcs: clean-rcs + +clean-rcs: + @: $(MAKE); $(unstage) + @[ -f ./rcs/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in rcs" ; \ + (cd $(HOST_SUBDIR)/rcs && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif rcs + +.PHONY: maybe-distclean-rcs distclean-rcs +maybe-distclean-rcs: +@if rcs +maybe-distclean-rcs: distclean-rcs + +distclean-rcs: + @: $(MAKE); $(unstage) + @[ -f ./rcs/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in rcs" ; \ + (cd $(HOST_SUBDIR)/rcs && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif rcs + +.PHONY: maybe-maintainer-clean-rcs maintainer-clean-rcs +maybe-maintainer-clean-rcs: +@if rcs +maybe-maintainer-clean-rcs: maintainer-clean-rcs + +maintainer-clean-rcs: + @: $(MAKE); $(unstage) + @[ -f ./rcs/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in rcs" ; \ + (cd $(HOST_SUBDIR)/rcs && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif rcs + .PHONY: configure-readline maybe-configure-readline maybe-configure-readline: -configure-readline: - @test ! -f readline/Makefile || exit 0; \ - [ -d readline ] || mkdir readline; \ - r=`${PWD_COMMAND}`; export r; \ +@if readline +maybe-configure-readline: configure-readline +configure-readline: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in readline; \ - cd readline || exit 1; \ + test ! -f $(HOST_SUBDIR)/readline/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/readline ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/readline; \ + cd "$(HOST_SUBDIR)/readline" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/readline"; \ - libsrcdir="$$s/readline";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/readline"; \ - libsrcdir="$$s/readline";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/readline/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/readline"; \ + libsrcdir="$$s/readline"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif readline + + + + .PHONY: all-readline maybe-all-readline maybe-all-readline: +@if readline +TARGET-readline=all +maybe-all-readline: all-readline all-readline: configure-readline + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd readline && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/readline && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-readline)) +@endif readline + + + .PHONY: check-readline maybe-check-readline maybe-check-readline: +@if readline +maybe-check-readline: check-readline check-readline: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd readline && $(MAKE) $(FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/readline && \ + $(MAKE) $(FLAGS_TO_PASS) check) +@endif readline .PHONY: install-readline maybe-install-readline maybe-install-readline: +@if readline +maybe-install-readline: install-readline install-readline: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd readline && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/readline && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif readline + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-readline info-readline +maybe-info-readline: +@if readline +maybe-info-readline: info-readline + +info-readline: \ + configure-readline + @: $(MAKE); $(unstage) + @[ -f ./readline/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in readline" ; \ + (cd $(HOST_SUBDIR)/readline && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif readline + +.PHONY: maybe-dvi-readline dvi-readline +maybe-dvi-readline: +@if readline +maybe-dvi-readline: dvi-readline + +dvi-readline: \ + configure-readline + @: $(MAKE); $(unstage) + @[ -f ./readline/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in readline" ; \ + (cd $(HOST_SUBDIR)/readline && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif readline + +.PHONY: maybe-html-readline html-readline +maybe-html-readline: +@if readline +maybe-html-readline: html-readline + +html-readline: \ + configure-readline + @: $(MAKE); $(unstage) + @[ -f ./readline/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in readline" ; \ + (cd $(HOST_SUBDIR)/readline && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif readline + +.PHONY: maybe-TAGS-readline TAGS-readline +maybe-TAGS-readline: +@if readline +maybe-TAGS-readline: TAGS-readline + +TAGS-readline: \ + configure-readline + @: $(MAKE); $(unstage) + @[ -f ./readline/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in readline" ; \ + (cd $(HOST_SUBDIR)/readline && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif readline + +.PHONY: maybe-install-info-readline install-info-readline +maybe-install-info-readline: +@if readline +maybe-install-info-readline: install-info-readline + +install-info-readline: \ + configure-readline \ + info-readline + @: $(MAKE); $(unstage) + @[ -f ./readline/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in readline" ; \ + (cd $(HOST_SUBDIR)/readline && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif readline + +.PHONY: maybe-install-html-readline install-html-readline +maybe-install-html-readline: +@if readline +maybe-install-html-readline: install-html-readline + +install-html-readline: \ + configure-readline \ + html-readline + @: $(MAKE); $(unstage) + @[ -f ./readline/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in readline" ; \ + (cd $(HOST_SUBDIR)/readline && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif readline + +.PHONY: maybe-installcheck-readline installcheck-readline +maybe-installcheck-readline: +@if readline +maybe-installcheck-readline: installcheck-readline + +installcheck-readline: \ + configure-readline + @: $(MAKE); $(unstage) + @[ -f ./readline/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in readline" ; \ + (cd $(HOST_SUBDIR)/readline && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif readline + +.PHONY: maybe-mostlyclean-readline mostlyclean-readline +maybe-mostlyclean-readline: +@if readline +maybe-mostlyclean-readline: mostlyclean-readline + +mostlyclean-readline: + @: $(MAKE); $(unstage) + @[ -f ./readline/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in readline" ; \ + (cd $(HOST_SUBDIR)/readline && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif readline + +.PHONY: maybe-clean-readline clean-readline +maybe-clean-readline: +@if readline +maybe-clean-readline: clean-readline + +clean-readline: + @: $(MAKE); $(unstage) + @[ -f ./readline/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in readline" ; \ + (cd $(HOST_SUBDIR)/readline && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif readline + +.PHONY: maybe-distclean-readline distclean-readline +maybe-distclean-readline: +@if readline +maybe-distclean-readline: distclean-readline + +distclean-readline: + @: $(MAKE); $(unstage) + @[ -f ./readline/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in readline" ; \ + (cd $(HOST_SUBDIR)/readline && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif readline + +.PHONY: maybe-maintainer-clean-readline maintainer-clean-readline +maybe-maintainer-clean-readline: +@if readline +maybe-maintainer-clean-readline: maintainer-clean-readline + +maintainer-clean-readline: + @: $(MAKE); $(unstage) + @[ -f ./readline/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in readline" ; \ + (cd $(HOST_SUBDIR)/readline && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif readline + .PHONY: configure-release maybe-configure-release maybe-configure-release: -configure-release: - @test ! -f release/Makefile || exit 0; \ - [ -d release ] || mkdir release; \ - r=`${PWD_COMMAND}`; export r; \ +@if release +maybe-configure-release: configure-release +configure-release: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in release; \ - cd release || exit 1; \ + test ! -f $(HOST_SUBDIR)/release/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/release ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/release; \ + cd "$(HOST_SUBDIR)/release" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/release"; \ - libsrcdir="$$s/release";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/release"; \ - libsrcdir="$$s/release";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/release/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/release"; \ + libsrcdir="$$s/release"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif release + + + + .PHONY: all-release maybe-all-release maybe-all-release: +@if release +TARGET-release=all +maybe-all-release: all-release all-release: configure-release + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd release && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/release && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-release)) +@endif release + + + .PHONY: check-release maybe-check-release maybe-check-release: +@if release +maybe-check-release: check-release check-release: +@endif release .PHONY: install-release maybe-install-release maybe-install-release: +@if release +maybe-install-release: install-release install-release: +@endif release + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-release info-release +maybe-info-release: +@if release +maybe-info-release: info-release + +info-release: \ + configure-release + @: $(MAKE); $(unstage) + @[ -f ./release/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in release" ; \ + (cd $(HOST_SUBDIR)/release && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif release + +.PHONY: maybe-dvi-release dvi-release +maybe-dvi-release: +@if release +maybe-dvi-release: dvi-release + +dvi-release: \ + configure-release + @: $(MAKE); $(unstage) + @[ -f ./release/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in release" ; \ + (cd $(HOST_SUBDIR)/release && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif release + +.PHONY: maybe-html-release html-release +maybe-html-release: +@if release +maybe-html-release: html-release + +html-release: \ + configure-release + @: $(MAKE); $(unstage) + @[ -f ./release/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in release" ; \ + (cd $(HOST_SUBDIR)/release && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif release + +.PHONY: maybe-TAGS-release TAGS-release +maybe-TAGS-release: +@if release +maybe-TAGS-release: TAGS-release + +TAGS-release: \ + configure-release + @: $(MAKE); $(unstage) + @[ -f ./release/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in release" ; \ + (cd $(HOST_SUBDIR)/release && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif release + +.PHONY: maybe-install-info-release install-info-release +maybe-install-info-release: +@if release +maybe-install-info-release: install-info-release + +install-info-release: \ + configure-release \ + info-release + @: $(MAKE); $(unstage) + @[ -f ./release/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in release" ; \ + (cd $(HOST_SUBDIR)/release && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif release + +.PHONY: maybe-install-html-release install-html-release +maybe-install-html-release: +@if release +maybe-install-html-release: install-html-release + +install-html-release: \ + configure-release \ + html-release + @: $(MAKE); $(unstage) + @[ -f ./release/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in release" ; \ + (cd $(HOST_SUBDIR)/release && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif release + +.PHONY: maybe-installcheck-release installcheck-release +maybe-installcheck-release: +@if release +maybe-installcheck-release: installcheck-release + +installcheck-release: \ + configure-release + @: $(MAKE); $(unstage) + @[ -f ./release/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in release" ; \ + (cd $(HOST_SUBDIR)/release && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif release + +.PHONY: maybe-mostlyclean-release mostlyclean-release +maybe-mostlyclean-release: +@if release +maybe-mostlyclean-release: mostlyclean-release + +mostlyclean-release: + @: $(MAKE); $(unstage) + @[ -f ./release/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in release" ; \ + (cd $(HOST_SUBDIR)/release && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif release + +.PHONY: maybe-clean-release clean-release +maybe-clean-release: +@if release +maybe-clean-release: clean-release + +clean-release: + @: $(MAKE); $(unstage) + @[ -f ./release/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in release" ; \ + (cd $(HOST_SUBDIR)/release && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif release + +.PHONY: maybe-distclean-release distclean-release +maybe-distclean-release: +@if release +maybe-distclean-release: distclean-release + +distclean-release: + @: $(MAKE); $(unstage) + @[ -f ./release/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in release" ; \ + (cd $(HOST_SUBDIR)/release && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif release + +.PHONY: maybe-maintainer-clean-release maintainer-clean-release +maybe-maintainer-clean-release: +@if release +maybe-maintainer-clean-release: maintainer-clean-release + +maintainer-clean-release: + @: $(MAKE); $(unstage) + @[ -f ./release/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in release" ; \ + (cd $(HOST_SUBDIR)/release && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif release + + .PHONY: configure-recode maybe-configure-recode maybe-configure-recode: -configure-recode: - @test ! -f recode/Makefile || exit 0; \ - [ -d recode ] || mkdir recode; \ - r=`${PWD_COMMAND}`; export r; \ +@if recode +maybe-configure-recode: configure-recode +configure-recode: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in recode; \ - cd recode || exit 1; \ + test ! -f $(HOST_SUBDIR)/recode/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/recode ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/recode; \ + cd "$(HOST_SUBDIR)/recode" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/recode"; \ - libsrcdir="$$s/recode";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/recode"; \ - libsrcdir="$$s/recode";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/recode/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/recode"; \ + libsrcdir="$$s/recode"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif recode + + + + .PHONY: all-recode maybe-all-recode maybe-all-recode: +@if recode +TARGET-recode=all +maybe-all-recode: all-recode all-recode: configure-recode + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd recode && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/recode && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-recode)) +@endif recode + + + .PHONY: check-recode maybe-check-recode maybe-check-recode: +@if recode +maybe-check-recode: check-recode check-recode: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd recode && $(MAKE) $(FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/recode && \ + $(MAKE) $(FLAGS_TO_PASS) check) +@endif recode .PHONY: install-recode maybe-install-recode maybe-install-recode: +@if recode +maybe-install-recode: install-recode install-recode: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd recode && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/recode && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif recode + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-recode info-recode +maybe-info-recode: +@if recode +maybe-info-recode: info-recode + +info-recode: \ + configure-recode + @: $(MAKE); $(unstage) + @[ -f ./recode/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in recode" ; \ + (cd $(HOST_SUBDIR)/recode && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif recode + +.PHONY: maybe-dvi-recode dvi-recode +maybe-dvi-recode: +@if recode +maybe-dvi-recode: dvi-recode + +dvi-recode: \ + configure-recode + @: $(MAKE); $(unstage) + @[ -f ./recode/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in recode" ; \ + (cd $(HOST_SUBDIR)/recode && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif recode + +.PHONY: maybe-html-recode html-recode +maybe-html-recode: +@if recode +maybe-html-recode: html-recode + +html-recode: \ + configure-recode + @: $(MAKE); $(unstage) + @[ -f ./recode/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in recode" ; \ + (cd $(HOST_SUBDIR)/recode && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif recode + +.PHONY: maybe-TAGS-recode TAGS-recode +maybe-TAGS-recode: +@if recode +maybe-TAGS-recode: TAGS-recode + +TAGS-recode: \ + configure-recode + @: $(MAKE); $(unstage) + @[ -f ./recode/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in recode" ; \ + (cd $(HOST_SUBDIR)/recode && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif recode + +.PHONY: maybe-install-info-recode install-info-recode +maybe-install-info-recode: +@if recode +maybe-install-info-recode: install-info-recode + +install-info-recode: \ + configure-recode \ + info-recode + @: $(MAKE); $(unstage) + @[ -f ./recode/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in recode" ; \ + (cd $(HOST_SUBDIR)/recode && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif recode + +.PHONY: maybe-install-html-recode install-html-recode +maybe-install-html-recode: +@if recode +maybe-install-html-recode: install-html-recode + +install-html-recode: \ + configure-recode \ + html-recode + @: $(MAKE); $(unstage) + @[ -f ./recode/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in recode" ; \ + (cd $(HOST_SUBDIR)/recode && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif recode + +.PHONY: maybe-installcheck-recode installcheck-recode +maybe-installcheck-recode: +@if recode +maybe-installcheck-recode: installcheck-recode + +installcheck-recode: \ + configure-recode + @: $(MAKE); $(unstage) + @[ -f ./recode/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in recode" ; \ + (cd $(HOST_SUBDIR)/recode && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif recode + +.PHONY: maybe-mostlyclean-recode mostlyclean-recode +maybe-mostlyclean-recode: +@if recode +maybe-mostlyclean-recode: mostlyclean-recode + +mostlyclean-recode: + @: $(MAKE); $(unstage) + @[ -f ./recode/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in recode" ; \ + (cd $(HOST_SUBDIR)/recode && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif recode + +.PHONY: maybe-clean-recode clean-recode +maybe-clean-recode: +@if recode +maybe-clean-recode: clean-recode + +clean-recode: + @: $(MAKE); $(unstage) + @[ -f ./recode/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in recode" ; \ + (cd $(HOST_SUBDIR)/recode && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif recode + +.PHONY: maybe-distclean-recode distclean-recode +maybe-distclean-recode: +@if recode +maybe-distclean-recode: distclean-recode + +distclean-recode: + @: $(MAKE); $(unstage) + @[ -f ./recode/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in recode" ; \ + (cd $(HOST_SUBDIR)/recode && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif recode + +.PHONY: maybe-maintainer-clean-recode maintainer-clean-recode +maybe-maintainer-clean-recode: +@if recode +maybe-maintainer-clean-recode: maintainer-clean-recode + +maintainer-clean-recode: + @: $(MAKE); $(unstage) + @[ -f ./recode/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in recode" ; \ + (cd $(HOST_SUBDIR)/recode && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif recode + .PHONY: configure-sed maybe-configure-sed maybe-configure-sed: -configure-sed: - @test ! -f sed/Makefile || exit 0; \ - [ -d sed ] || mkdir sed; \ - r=`${PWD_COMMAND}`; export r; \ +@if sed +maybe-configure-sed: configure-sed +configure-sed: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in sed; \ - cd sed || exit 1; \ + test ! -f $(HOST_SUBDIR)/sed/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/sed ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/sed; \ + cd "$(HOST_SUBDIR)/sed" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/sed"; \ - libsrcdir="$$s/sed";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/sed"; \ - libsrcdir="$$s/sed";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/sed/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/sed"; \ + libsrcdir="$$s/sed"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif sed + + + + .PHONY: all-sed maybe-all-sed maybe-all-sed: +@if sed +TARGET-sed=all +maybe-all-sed: all-sed all-sed: configure-sed + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd sed && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/sed && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-sed)) +@endif sed + + + .PHONY: check-sed maybe-check-sed maybe-check-sed: +@if sed +maybe-check-sed: check-sed check-sed: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd sed && $(MAKE) $(FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/sed && \ + $(MAKE) $(FLAGS_TO_PASS) check) +@endif sed .PHONY: install-sed maybe-install-sed maybe-install-sed: +@if sed +maybe-install-sed: install-sed install-sed: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd sed && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/sed && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif sed + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-sed info-sed +maybe-info-sed: +@if sed +maybe-info-sed: info-sed + +info-sed: \ + configure-sed + @: $(MAKE); $(unstage) + @[ -f ./sed/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in sed" ; \ + (cd $(HOST_SUBDIR)/sed && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif sed + +.PHONY: maybe-dvi-sed dvi-sed +maybe-dvi-sed: +@if sed +maybe-dvi-sed: dvi-sed + +dvi-sed: \ + configure-sed + @: $(MAKE); $(unstage) + @[ -f ./sed/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in sed" ; \ + (cd $(HOST_SUBDIR)/sed && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif sed + +.PHONY: maybe-html-sed html-sed +maybe-html-sed: +@if sed +maybe-html-sed: html-sed + +html-sed: \ + configure-sed + @: $(MAKE); $(unstage) + @[ -f ./sed/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in sed" ; \ + (cd $(HOST_SUBDIR)/sed && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif sed + +.PHONY: maybe-TAGS-sed TAGS-sed +maybe-TAGS-sed: +@if sed +maybe-TAGS-sed: TAGS-sed + +TAGS-sed: \ + configure-sed + @: $(MAKE); $(unstage) + @[ -f ./sed/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in sed" ; \ + (cd $(HOST_SUBDIR)/sed && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif sed + +.PHONY: maybe-install-info-sed install-info-sed +maybe-install-info-sed: +@if sed +maybe-install-info-sed: install-info-sed + +install-info-sed: \ + configure-sed \ + info-sed + @: $(MAKE); $(unstage) + @[ -f ./sed/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in sed" ; \ + (cd $(HOST_SUBDIR)/sed && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif sed + +.PHONY: maybe-install-html-sed install-html-sed +maybe-install-html-sed: +@if sed +maybe-install-html-sed: install-html-sed + +install-html-sed: \ + configure-sed \ + html-sed + @: $(MAKE); $(unstage) + @[ -f ./sed/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in sed" ; \ + (cd $(HOST_SUBDIR)/sed && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif sed + +.PHONY: maybe-installcheck-sed installcheck-sed +maybe-installcheck-sed: +@if sed +maybe-installcheck-sed: installcheck-sed + +installcheck-sed: \ + configure-sed + @: $(MAKE); $(unstage) + @[ -f ./sed/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in sed" ; \ + (cd $(HOST_SUBDIR)/sed && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif sed + +.PHONY: maybe-mostlyclean-sed mostlyclean-sed +maybe-mostlyclean-sed: +@if sed +maybe-mostlyclean-sed: mostlyclean-sed + +mostlyclean-sed: + @: $(MAKE); $(unstage) + @[ -f ./sed/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in sed" ; \ + (cd $(HOST_SUBDIR)/sed && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif sed + +.PHONY: maybe-clean-sed clean-sed +maybe-clean-sed: +@if sed +maybe-clean-sed: clean-sed + +clean-sed: + @: $(MAKE); $(unstage) + @[ -f ./sed/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in sed" ; \ + (cd $(HOST_SUBDIR)/sed && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif sed + +.PHONY: maybe-distclean-sed distclean-sed +maybe-distclean-sed: +@if sed +maybe-distclean-sed: distclean-sed + +distclean-sed: + @: $(MAKE); $(unstage) + @[ -f ./sed/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in sed" ; \ + (cd $(HOST_SUBDIR)/sed && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif sed + +.PHONY: maybe-maintainer-clean-sed maintainer-clean-sed +maybe-maintainer-clean-sed: +@if sed +maybe-maintainer-clean-sed: maintainer-clean-sed + +maintainer-clean-sed: + @: $(MAKE); $(unstage) + @[ -f ./sed/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in sed" ; \ + (cd $(HOST_SUBDIR)/sed && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif sed + .PHONY: configure-send-pr maybe-configure-send-pr maybe-configure-send-pr: -configure-send-pr: - @test ! -f send-pr/Makefile || exit 0; \ - [ -d send-pr ] || mkdir send-pr; \ - r=`${PWD_COMMAND}`; export r; \ +@if send-pr +maybe-configure-send-pr: configure-send-pr +configure-send-pr: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in send-pr; \ - cd send-pr || exit 1; \ + test ! -f $(HOST_SUBDIR)/send-pr/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/send-pr ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/send-pr; \ + cd "$(HOST_SUBDIR)/send-pr" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/send-pr"; \ - libsrcdir="$$s/send-pr";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/send-pr"; \ - libsrcdir="$$s/send-pr";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/send-pr/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/send-pr"; \ + libsrcdir="$$s/send-pr"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif send-pr + + + + .PHONY: all-send-pr maybe-all-send-pr maybe-all-send-pr: +@if send-pr +TARGET-send-pr=all +maybe-all-send-pr: all-send-pr all-send-pr: configure-send-pr + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd send-pr && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/send-pr && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-send-pr)) +@endif send-pr + + + .PHONY: check-send-pr maybe-check-send-pr maybe-check-send-pr: +@if send-pr +maybe-check-send-pr: check-send-pr check-send-pr: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd send-pr && $(MAKE) $(FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/send-pr && \ + $(MAKE) $(FLAGS_TO_PASS) check) +@endif send-pr .PHONY: install-send-pr maybe-install-send-pr maybe-install-send-pr: +@if send-pr +maybe-install-send-pr: install-send-pr install-send-pr: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd send-pr && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/send-pr && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif send-pr + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-send-pr info-send-pr +maybe-info-send-pr: +@if send-pr +maybe-info-send-pr: info-send-pr + +info-send-pr: \ + configure-send-pr + @: $(MAKE); $(unstage) + @[ -f ./send-pr/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in send-pr" ; \ + (cd $(HOST_SUBDIR)/send-pr && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif send-pr + +.PHONY: maybe-dvi-send-pr dvi-send-pr +maybe-dvi-send-pr: +@if send-pr +maybe-dvi-send-pr: dvi-send-pr + +dvi-send-pr: \ + configure-send-pr + @: $(MAKE); $(unstage) + @[ -f ./send-pr/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in send-pr" ; \ + (cd $(HOST_SUBDIR)/send-pr && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif send-pr + +.PHONY: maybe-html-send-pr html-send-pr +maybe-html-send-pr: +@if send-pr +maybe-html-send-pr: html-send-pr + +html-send-pr: \ + configure-send-pr + @: $(MAKE); $(unstage) + @[ -f ./send-pr/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in send-pr" ; \ + (cd $(HOST_SUBDIR)/send-pr && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif send-pr + +.PHONY: maybe-TAGS-send-pr TAGS-send-pr +maybe-TAGS-send-pr: +@if send-pr +maybe-TAGS-send-pr: TAGS-send-pr + +TAGS-send-pr: \ + configure-send-pr + @: $(MAKE); $(unstage) + @[ -f ./send-pr/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in send-pr" ; \ + (cd $(HOST_SUBDIR)/send-pr && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif send-pr + +.PHONY: maybe-install-info-send-pr install-info-send-pr +maybe-install-info-send-pr: +@if send-pr +maybe-install-info-send-pr: install-info-send-pr + +install-info-send-pr: \ + configure-send-pr \ + info-send-pr + @: $(MAKE); $(unstage) + @[ -f ./send-pr/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in send-pr" ; \ + (cd $(HOST_SUBDIR)/send-pr && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif send-pr + +.PHONY: maybe-install-html-send-pr install-html-send-pr +maybe-install-html-send-pr: +@if send-pr +maybe-install-html-send-pr: install-html-send-pr + +install-html-send-pr: \ + configure-send-pr \ + html-send-pr + @: $(MAKE); $(unstage) + @[ -f ./send-pr/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in send-pr" ; \ + (cd $(HOST_SUBDIR)/send-pr && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif send-pr + +.PHONY: maybe-installcheck-send-pr installcheck-send-pr +maybe-installcheck-send-pr: +@if send-pr +maybe-installcheck-send-pr: installcheck-send-pr + +installcheck-send-pr: \ + configure-send-pr + @: $(MAKE); $(unstage) + @[ -f ./send-pr/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in send-pr" ; \ + (cd $(HOST_SUBDIR)/send-pr && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif send-pr + +.PHONY: maybe-mostlyclean-send-pr mostlyclean-send-pr +maybe-mostlyclean-send-pr: +@if send-pr +maybe-mostlyclean-send-pr: mostlyclean-send-pr + +mostlyclean-send-pr: + @: $(MAKE); $(unstage) + @[ -f ./send-pr/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in send-pr" ; \ + (cd $(HOST_SUBDIR)/send-pr && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif send-pr + +.PHONY: maybe-clean-send-pr clean-send-pr +maybe-clean-send-pr: +@if send-pr +maybe-clean-send-pr: clean-send-pr + +clean-send-pr: + @: $(MAKE); $(unstage) + @[ -f ./send-pr/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in send-pr" ; \ + (cd $(HOST_SUBDIR)/send-pr && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif send-pr + +.PHONY: maybe-distclean-send-pr distclean-send-pr +maybe-distclean-send-pr: +@if send-pr +maybe-distclean-send-pr: distclean-send-pr + +distclean-send-pr: + @: $(MAKE); $(unstage) + @[ -f ./send-pr/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in send-pr" ; \ + (cd $(HOST_SUBDIR)/send-pr && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif send-pr + +.PHONY: maybe-maintainer-clean-send-pr maintainer-clean-send-pr +maybe-maintainer-clean-send-pr: +@if send-pr +maybe-maintainer-clean-send-pr: maintainer-clean-send-pr + +maintainer-clean-send-pr: + @: $(MAKE); $(unstage) + @[ -f ./send-pr/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in send-pr" ; \ + (cd $(HOST_SUBDIR)/send-pr && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif send-pr + .PHONY: configure-shellutils maybe-configure-shellutils maybe-configure-shellutils: -configure-shellutils: - @test ! -f shellutils/Makefile || exit 0; \ - [ -d shellutils ] || mkdir shellutils; \ - r=`${PWD_COMMAND}`; export r; \ +@if shellutils +maybe-configure-shellutils: configure-shellutils +configure-shellutils: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in shellutils; \ - cd shellutils || exit 1; \ + test ! -f $(HOST_SUBDIR)/shellutils/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/shellutils ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/shellutils; \ + cd "$(HOST_SUBDIR)/shellutils" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/shellutils"; \ - libsrcdir="$$s/shellutils";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/shellutils"; \ - libsrcdir="$$s/shellutils";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/shellutils/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/shellutils"; \ + libsrcdir="$$s/shellutils"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif shellutils + + + + .PHONY: all-shellutils maybe-all-shellutils maybe-all-shellutils: +@if shellutils +TARGET-shellutils=all +maybe-all-shellutils: all-shellutils all-shellutils: configure-shellutils + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd shellutils && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/shellutils && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-shellutils)) +@endif shellutils + + + .PHONY: check-shellutils maybe-check-shellutils maybe-check-shellutils: +@if shellutils +maybe-check-shellutils: check-shellutils check-shellutils: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd shellutils && $(MAKE) $(FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/shellutils && \ + $(MAKE) $(FLAGS_TO_PASS) check) +@endif shellutils .PHONY: install-shellutils maybe-install-shellutils maybe-install-shellutils: +@if shellutils +maybe-install-shellutils: install-shellutils install-shellutils: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd shellutils && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/shellutils && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif shellutils + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-shellutils info-shellutils +maybe-info-shellutils: +@if shellutils +maybe-info-shellutils: info-shellutils + +info-shellutils: \ + configure-shellutils + @: $(MAKE); $(unstage) + @[ -f ./shellutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in shellutils" ; \ + (cd $(HOST_SUBDIR)/shellutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif shellutils + +.PHONY: maybe-dvi-shellutils dvi-shellutils +maybe-dvi-shellutils: +@if shellutils +maybe-dvi-shellutils: dvi-shellutils + +dvi-shellutils: \ + configure-shellutils + @: $(MAKE); $(unstage) + @[ -f ./shellutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in shellutils" ; \ + (cd $(HOST_SUBDIR)/shellutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif shellutils + +.PHONY: maybe-html-shellutils html-shellutils +maybe-html-shellutils: +@if shellutils +maybe-html-shellutils: html-shellutils + +html-shellutils: \ + configure-shellutils + @: $(MAKE); $(unstage) + @[ -f ./shellutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in shellutils" ; \ + (cd $(HOST_SUBDIR)/shellutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif shellutils + +.PHONY: maybe-TAGS-shellutils TAGS-shellutils +maybe-TAGS-shellutils: +@if shellutils +maybe-TAGS-shellutils: TAGS-shellutils + +TAGS-shellutils: \ + configure-shellutils + @: $(MAKE); $(unstage) + @[ -f ./shellutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in shellutils" ; \ + (cd $(HOST_SUBDIR)/shellutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif shellutils + +.PHONY: maybe-install-info-shellutils install-info-shellutils +maybe-install-info-shellutils: +@if shellutils +maybe-install-info-shellutils: install-info-shellutils + +install-info-shellutils: \ + configure-shellutils \ + info-shellutils + @: $(MAKE); $(unstage) + @[ -f ./shellutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in shellutils" ; \ + (cd $(HOST_SUBDIR)/shellutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif shellutils + +.PHONY: maybe-install-html-shellutils install-html-shellutils +maybe-install-html-shellutils: +@if shellutils +maybe-install-html-shellutils: install-html-shellutils + +install-html-shellutils: \ + configure-shellutils \ + html-shellutils + @: $(MAKE); $(unstage) + @[ -f ./shellutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in shellutils" ; \ + (cd $(HOST_SUBDIR)/shellutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif shellutils + +.PHONY: maybe-installcheck-shellutils installcheck-shellutils +maybe-installcheck-shellutils: +@if shellutils +maybe-installcheck-shellutils: installcheck-shellutils + +installcheck-shellutils: \ + configure-shellutils + @: $(MAKE); $(unstage) + @[ -f ./shellutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in shellutils" ; \ + (cd $(HOST_SUBDIR)/shellutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif shellutils + +.PHONY: maybe-mostlyclean-shellutils mostlyclean-shellutils +maybe-mostlyclean-shellutils: +@if shellutils +maybe-mostlyclean-shellutils: mostlyclean-shellutils + +mostlyclean-shellutils: + @: $(MAKE); $(unstage) + @[ -f ./shellutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in shellutils" ; \ + (cd $(HOST_SUBDIR)/shellutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif shellutils + +.PHONY: maybe-clean-shellutils clean-shellutils +maybe-clean-shellutils: +@if shellutils +maybe-clean-shellutils: clean-shellutils + +clean-shellutils: + @: $(MAKE); $(unstage) + @[ -f ./shellutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in shellutils" ; \ + (cd $(HOST_SUBDIR)/shellutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif shellutils + +.PHONY: maybe-distclean-shellutils distclean-shellutils +maybe-distclean-shellutils: +@if shellutils +maybe-distclean-shellutils: distclean-shellutils + +distclean-shellutils: + @: $(MAKE); $(unstage) + @[ -f ./shellutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in shellutils" ; \ + (cd $(HOST_SUBDIR)/shellutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif shellutils + +.PHONY: maybe-maintainer-clean-shellutils maintainer-clean-shellutils +maybe-maintainer-clean-shellutils: +@if shellutils +maybe-maintainer-clean-shellutils: maintainer-clean-shellutils + +maintainer-clean-shellutils: + @: $(MAKE); $(unstage) + @[ -f ./shellutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in shellutils" ; \ + (cd $(HOST_SUBDIR)/shellutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif shellutils + .PHONY: configure-sid maybe-configure-sid maybe-configure-sid: -configure-sid: - @test ! -f sid/Makefile || exit 0; \ - [ -d sid ] || mkdir sid; \ - r=`${PWD_COMMAND}`; export r; \ +@if sid +maybe-configure-sid: configure-sid +configure-sid: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in sid; \ - cd sid || exit 1; \ + test ! -f $(HOST_SUBDIR)/sid/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/sid ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/sid; \ + cd "$(HOST_SUBDIR)/sid" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/sid"; \ - libsrcdir="$$s/sid";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/sid"; \ - libsrcdir="$$s/sid";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/sid/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/sid"; \ + libsrcdir="$$s/sid"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif sid + + + + .PHONY: all-sid maybe-all-sid maybe-all-sid: +@if sid +TARGET-sid=all +maybe-all-sid: all-sid all-sid: configure-sid + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd sid && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/sid && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-sid)) +@endif sid + + + .PHONY: check-sid maybe-check-sid maybe-check-sid: +@if sid +maybe-check-sid: check-sid check-sid: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd sid && $(MAKE) $(FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/sid && \ + $(MAKE) $(FLAGS_TO_PASS) check) +@endif sid .PHONY: install-sid maybe-install-sid maybe-install-sid: +@if sid +maybe-install-sid: install-sid install-sid: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd sid && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/sid && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif sid + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-sid info-sid +maybe-info-sid: +@if sid +maybe-info-sid: info-sid + +info-sid: \ + configure-sid + @: $(MAKE); $(unstage) + @[ -f ./sid/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in sid" ; \ + (cd $(HOST_SUBDIR)/sid && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif sid + +.PHONY: maybe-dvi-sid dvi-sid +maybe-dvi-sid: +@if sid +maybe-dvi-sid: dvi-sid + +dvi-sid: \ + configure-sid + @: $(MAKE); $(unstage) + @[ -f ./sid/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in sid" ; \ + (cd $(HOST_SUBDIR)/sid && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif sid + +.PHONY: maybe-html-sid html-sid +maybe-html-sid: +@if sid +maybe-html-sid: html-sid + +html-sid: \ + configure-sid + @: $(MAKE); $(unstage) + @[ -f ./sid/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in sid" ; \ + (cd $(HOST_SUBDIR)/sid && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif sid + +.PHONY: maybe-TAGS-sid TAGS-sid +maybe-TAGS-sid: +@if sid +maybe-TAGS-sid: TAGS-sid + +TAGS-sid: \ + configure-sid + @: $(MAKE); $(unstage) + @[ -f ./sid/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in sid" ; \ + (cd $(HOST_SUBDIR)/sid && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif sid + +.PHONY: maybe-install-info-sid install-info-sid +maybe-install-info-sid: +@if sid +maybe-install-info-sid: install-info-sid + +install-info-sid: \ + configure-sid \ + info-sid + @: $(MAKE); $(unstage) + @[ -f ./sid/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in sid" ; \ + (cd $(HOST_SUBDIR)/sid && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif sid + +.PHONY: maybe-install-html-sid install-html-sid +maybe-install-html-sid: +@if sid +maybe-install-html-sid: install-html-sid + +install-html-sid: \ + configure-sid \ + html-sid + @: $(MAKE); $(unstage) + @[ -f ./sid/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in sid" ; \ + (cd $(HOST_SUBDIR)/sid && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif sid + +.PHONY: maybe-installcheck-sid installcheck-sid +maybe-installcheck-sid: +@if sid +maybe-installcheck-sid: installcheck-sid + +installcheck-sid: \ + configure-sid + @: $(MAKE); $(unstage) + @[ -f ./sid/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in sid" ; \ + (cd $(HOST_SUBDIR)/sid && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif sid + +.PHONY: maybe-mostlyclean-sid mostlyclean-sid +maybe-mostlyclean-sid: +@if sid +maybe-mostlyclean-sid: mostlyclean-sid + +mostlyclean-sid: + @: $(MAKE); $(unstage) + @[ -f ./sid/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in sid" ; \ + (cd $(HOST_SUBDIR)/sid && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif sid + +.PHONY: maybe-clean-sid clean-sid +maybe-clean-sid: +@if sid +maybe-clean-sid: clean-sid + +clean-sid: + @: $(MAKE); $(unstage) + @[ -f ./sid/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in sid" ; \ + (cd $(HOST_SUBDIR)/sid && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif sid + +.PHONY: maybe-distclean-sid distclean-sid +maybe-distclean-sid: +@if sid +maybe-distclean-sid: distclean-sid + +distclean-sid: + @: $(MAKE); $(unstage) + @[ -f ./sid/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in sid" ; \ + (cd $(HOST_SUBDIR)/sid && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif sid + +.PHONY: maybe-maintainer-clean-sid maintainer-clean-sid +maybe-maintainer-clean-sid: +@if sid +maybe-maintainer-clean-sid: maintainer-clean-sid + +maintainer-clean-sid: + @: $(MAKE); $(unstage) + @[ -f ./sid/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in sid" ; \ + (cd $(HOST_SUBDIR)/sid && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif sid + .PHONY: configure-sim maybe-configure-sim maybe-configure-sim: -configure-sim: - @test ! -f sim/Makefile || exit 0; \ - [ -d sim ] || mkdir sim; \ - r=`${PWD_COMMAND}`; export r; \ +@if sim +maybe-configure-sim: configure-sim +configure-sim: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in sim; \ - cd sim || exit 1; \ + test ! -f $(HOST_SUBDIR)/sim/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/sim ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/sim; \ + cd "$(HOST_SUBDIR)/sim" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/sim"; \ - libsrcdir="$$s/sim";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/sim"; \ - libsrcdir="$$s/sim";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/sim/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/sim"; \ + libsrcdir="$$s/sim"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif sim + + + + .PHONY: all-sim maybe-all-sim maybe-all-sim: +@if sim +TARGET-sim=all +maybe-all-sim: all-sim all-sim: configure-sim + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd sim && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/sim && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-sim)) +@endif sim + + + .PHONY: check-sim maybe-check-sim maybe-check-sim: +@if sim +maybe-check-sim: check-sim check-sim: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd sim && $(MAKE) $(FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/sim && \ + $(MAKE) $(FLAGS_TO_PASS) check) +@endif sim .PHONY: install-sim maybe-install-sim maybe-install-sim: +@if sim +maybe-install-sim: install-sim install-sim: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd sim && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/sim && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif sim + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-sim info-sim +maybe-info-sim: +@if sim +maybe-info-sim: info-sim + +info-sim: \ + configure-sim + @: $(MAKE); $(unstage) + @[ -f ./sim/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in sim" ; \ + (cd $(HOST_SUBDIR)/sim && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif sim + +.PHONY: maybe-dvi-sim dvi-sim +maybe-dvi-sim: +@if sim +maybe-dvi-sim: dvi-sim + +dvi-sim: \ + configure-sim + @: $(MAKE); $(unstage) + @[ -f ./sim/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in sim" ; \ + (cd $(HOST_SUBDIR)/sim && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif sim + +.PHONY: maybe-html-sim html-sim +maybe-html-sim: +@if sim +maybe-html-sim: html-sim + +html-sim: \ + configure-sim + @: $(MAKE); $(unstage) + @[ -f ./sim/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in sim" ; \ + (cd $(HOST_SUBDIR)/sim && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif sim + +.PHONY: maybe-TAGS-sim TAGS-sim +maybe-TAGS-sim: +@if sim +maybe-TAGS-sim: TAGS-sim + +TAGS-sim: \ + configure-sim + @: $(MAKE); $(unstage) + @[ -f ./sim/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in sim" ; \ + (cd $(HOST_SUBDIR)/sim && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif sim + +.PHONY: maybe-install-info-sim install-info-sim +maybe-install-info-sim: +@if sim +maybe-install-info-sim: install-info-sim + +install-info-sim: \ + configure-sim \ + info-sim + @: $(MAKE); $(unstage) + @[ -f ./sim/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in sim" ; \ + (cd $(HOST_SUBDIR)/sim && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif sim + +.PHONY: maybe-install-html-sim install-html-sim +maybe-install-html-sim: +@if sim +maybe-install-html-sim: install-html-sim + +install-html-sim: \ + configure-sim \ + html-sim + @: $(MAKE); $(unstage) + @[ -f ./sim/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in sim" ; \ + (cd $(HOST_SUBDIR)/sim && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif sim + +.PHONY: maybe-installcheck-sim installcheck-sim +maybe-installcheck-sim: +@if sim +maybe-installcheck-sim: installcheck-sim + +installcheck-sim: \ + configure-sim + @: $(MAKE); $(unstage) + @[ -f ./sim/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in sim" ; \ + (cd $(HOST_SUBDIR)/sim && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif sim + +.PHONY: maybe-mostlyclean-sim mostlyclean-sim +maybe-mostlyclean-sim: +@if sim +maybe-mostlyclean-sim: mostlyclean-sim + +mostlyclean-sim: + @: $(MAKE); $(unstage) + @[ -f ./sim/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in sim" ; \ + (cd $(HOST_SUBDIR)/sim && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif sim + +.PHONY: maybe-clean-sim clean-sim +maybe-clean-sim: +@if sim +maybe-clean-sim: clean-sim + +clean-sim: + @: $(MAKE); $(unstage) + @[ -f ./sim/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in sim" ; \ + (cd $(HOST_SUBDIR)/sim && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif sim + +.PHONY: maybe-distclean-sim distclean-sim +maybe-distclean-sim: +@if sim +maybe-distclean-sim: distclean-sim + +distclean-sim: + @: $(MAKE); $(unstage) + @[ -f ./sim/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in sim" ; \ + (cd $(HOST_SUBDIR)/sim && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif sim + +.PHONY: maybe-maintainer-clean-sim maintainer-clean-sim +maybe-maintainer-clean-sim: +@if sim +maybe-maintainer-clean-sim: maintainer-clean-sim + +maintainer-clean-sim: + @: $(MAKE); $(unstage) + @[ -f ./sim/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in sim" ; \ + (cd $(HOST_SUBDIR)/sim && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif sim + .PHONY: configure-tar maybe-configure-tar maybe-configure-tar: -configure-tar: - @test ! -f tar/Makefile || exit 0; \ - [ -d tar ] || mkdir tar; \ - r=`${PWD_COMMAND}`; export r; \ +@if tar +maybe-configure-tar: configure-tar +configure-tar: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in tar; \ - cd tar || exit 1; \ + test ! -f $(HOST_SUBDIR)/tar/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/tar ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/tar; \ + cd "$(HOST_SUBDIR)/tar" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/tar"; \ - libsrcdir="$$s/tar";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/tar"; \ - libsrcdir="$$s/tar";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/tar/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/tar"; \ + libsrcdir="$$s/tar"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif tar + + + + .PHONY: all-tar maybe-all-tar maybe-all-tar: +@if tar +TARGET-tar=all +maybe-all-tar: all-tar all-tar: configure-tar + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd tar && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/tar && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-tar)) +@endif tar + + + .PHONY: check-tar maybe-check-tar maybe-check-tar: +@if tar +maybe-check-tar: check-tar check-tar: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd tar && $(MAKE) $(FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/tar && \ + $(MAKE) $(FLAGS_TO_PASS) check) +@endif tar .PHONY: install-tar maybe-install-tar maybe-install-tar: +@if tar +maybe-install-tar: install-tar install-tar: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd tar && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/tar && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif tar + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-tar info-tar +maybe-info-tar: +@if tar +maybe-info-tar: info-tar + +info-tar: \ + configure-tar + @: $(MAKE); $(unstage) + @[ -f ./tar/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in tar" ; \ + (cd $(HOST_SUBDIR)/tar && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif tar + +.PHONY: maybe-dvi-tar dvi-tar +maybe-dvi-tar: +@if tar +maybe-dvi-tar: dvi-tar + +dvi-tar: \ + configure-tar + @: $(MAKE); $(unstage) + @[ -f ./tar/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in tar" ; \ + (cd $(HOST_SUBDIR)/tar && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif tar + +.PHONY: maybe-html-tar html-tar +maybe-html-tar: +@if tar +maybe-html-tar: html-tar + +html-tar: \ + configure-tar + @: $(MAKE); $(unstage) + @[ -f ./tar/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in tar" ; \ + (cd $(HOST_SUBDIR)/tar && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif tar + +.PHONY: maybe-TAGS-tar TAGS-tar +maybe-TAGS-tar: +@if tar +maybe-TAGS-tar: TAGS-tar + +TAGS-tar: \ + configure-tar + @: $(MAKE); $(unstage) + @[ -f ./tar/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in tar" ; \ + (cd $(HOST_SUBDIR)/tar && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif tar + +.PHONY: maybe-install-info-tar install-info-tar +maybe-install-info-tar: +@if tar +maybe-install-info-tar: install-info-tar + +install-info-tar: \ + configure-tar \ + info-tar + @: $(MAKE); $(unstage) + @[ -f ./tar/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in tar" ; \ + (cd $(HOST_SUBDIR)/tar && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif tar + +.PHONY: maybe-install-html-tar install-html-tar +maybe-install-html-tar: +@if tar +maybe-install-html-tar: install-html-tar + +install-html-tar: \ + configure-tar \ + html-tar + @: $(MAKE); $(unstage) + @[ -f ./tar/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in tar" ; \ + (cd $(HOST_SUBDIR)/tar && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif tar + +.PHONY: maybe-installcheck-tar installcheck-tar +maybe-installcheck-tar: +@if tar +maybe-installcheck-tar: installcheck-tar + +installcheck-tar: \ + configure-tar + @: $(MAKE); $(unstage) + @[ -f ./tar/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in tar" ; \ + (cd $(HOST_SUBDIR)/tar && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif tar + +.PHONY: maybe-mostlyclean-tar mostlyclean-tar +maybe-mostlyclean-tar: +@if tar +maybe-mostlyclean-tar: mostlyclean-tar + +mostlyclean-tar: + @: $(MAKE); $(unstage) + @[ -f ./tar/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in tar" ; \ + (cd $(HOST_SUBDIR)/tar && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif tar + +.PHONY: maybe-clean-tar clean-tar +maybe-clean-tar: +@if tar +maybe-clean-tar: clean-tar + +clean-tar: + @: $(MAKE); $(unstage) + @[ -f ./tar/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in tar" ; \ + (cd $(HOST_SUBDIR)/tar && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif tar + +.PHONY: maybe-distclean-tar distclean-tar +maybe-distclean-tar: +@if tar +maybe-distclean-tar: distclean-tar + +distclean-tar: + @: $(MAKE); $(unstage) + @[ -f ./tar/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in tar" ; \ + (cd $(HOST_SUBDIR)/tar && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif tar + +.PHONY: maybe-maintainer-clean-tar maintainer-clean-tar +maybe-maintainer-clean-tar: +@if tar +maybe-maintainer-clean-tar: maintainer-clean-tar + +maintainer-clean-tar: + @: $(MAKE); $(unstage) + @[ -f ./tar/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in tar" ; \ + (cd $(HOST_SUBDIR)/tar && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif tar + .PHONY: configure-texinfo maybe-configure-texinfo maybe-configure-texinfo: -configure-texinfo: - @test ! -f texinfo/Makefile || exit 0; \ - [ -d texinfo ] || mkdir texinfo; \ - r=`${PWD_COMMAND}`; export r; \ +@if texinfo +maybe-configure-texinfo: configure-texinfo +configure-texinfo: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in texinfo; \ - cd texinfo || exit 1; \ + test ! -f $(HOST_SUBDIR)/texinfo/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/texinfo ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/texinfo; \ + cd "$(HOST_SUBDIR)/texinfo" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/texinfo"; \ - libsrcdir="$$s/texinfo";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/texinfo"; \ - libsrcdir="$$s/texinfo";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/texinfo/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/texinfo"; \ + libsrcdir="$$s/texinfo"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif texinfo + + + + .PHONY: all-texinfo maybe-all-texinfo maybe-all-texinfo: +@if texinfo +TARGET-texinfo=all +maybe-all-texinfo: all-texinfo all-texinfo: configure-texinfo + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd texinfo && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/texinfo && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-texinfo)) +@endif texinfo + + + .PHONY: check-texinfo maybe-check-texinfo maybe-check-texinfo: +@if texinfo +maybe-check-texinfo: check-texinfo check-texinfo: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd texinfo && $(MAKE) $(FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/texinfo && \ + $(MAKE) $(FLAGS_TO_PASS) check) +@endif texinfo .PHONY: install-texinfo maybe-install-texinfo maybe-install-texinfo: +@if texinfo +maybe-install-texinfo: install-texinfo install-texinfo: +@endif texinfo + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-texinfo info-texinfo +maybe-info-texinfo: +@if texinfo +maybe-info-texinfo: info-texinfo + +info-texinfo: \ + configure-texinfo + @: $(MAKE); $(unstage) + @[ -f ./texinfo/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in texinfo" ; \ + (cd $(HOST_SUBDIR)/texinfo && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif texinfo + +.PHONY: maybe-dvi-texinfo dvi-texinfo +maybe-dvi-texinfo: +@if texinfo +maybe-dvi-texinfo: dvi-texinfo + +dvi-texinfo: \ + configure-texinfo + @: $(MAKE); $(unstage) + @[ -f ./texinfo/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in texinfo" ; \ + (cd $(HOST_SUBDIR)/texinfo && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif texinfo + +.PHONY: maybe-html-texinfo html-texinfo +maybe-html-texinfo: +@if texinfo +maybe-html-texinfo: html-texinfo + +html-texinfo: \ + configure-texinfo + @: $(MAKE); $(unstage) + @[ -f ./texinfo/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in texinfo" ; \ + (cd $(HOST_SUBDIR)/texinfo && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif texinfo + +.PHONY: maybe-TAGS-texinfo TAGS-texinfo +maybe-TAGS-texinfo: +@if texinfo +maybe-TAGS-texinfo: TAGS-texinfo + +TAGS-texinfo: \ + configure-texinfo + @: $(MAKE); $(unstage) + @[ -f ./texinfo/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in texinfo" ; \ + (cd $(HOST_SUBDIR)/texinfo && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif texinfo + +.PHONY: maybe-install-info-texinfo install-info-texinfo +maybe-install-info-texinfo: +@if texinfo +maybe-install-info-texinfo: install-info-texinfo + +install-info-texinfo: \ + configure-texinfo \ + info-texinfo + @: $(MAKE); $(unstage) + @[ -f ./texinfo/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in texinfo" ; \ + (cd $(HOST_SUBDIR)/texinfo && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif texinfo + +.PHONY: maybe-install-html-texinfo install-html-texinfo +maybe-install-html-texinfo: +@if texinfo +maybe-install-html-texinfo: install-html-texinfo + +install-html-texinfo: \ + configure-texinfo \ + html-texinfo + @: $(MAKE); $(unstage) + @[ -f ./texinfo/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in texinfo" ; \ + (cd $(HOST_SUBDIR)/texinfo && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif texinfo + +.PHONY: maybe-installcheck-texinfo installcheck-texinfo +maybe-installcheck-texinfo: +@if texinfo +maybe-installcheck-texinfo: installcheck-texinfo + +installcheck-texinfo: \ + configure-texinfo + @: $(MAKE); $(unstage) + @[ -f ./texinfo/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in texinfo" ; \ + (cd $(HOST_SUBDIR)/texinfo && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif texinfo + +.PHONY: maybe-mostlyclean-texinfo mostlyclean-texinfo +maybe-mostlyclean-texinfo: +@if texinfo +maybe-mostlyclean-texinfo: mostlyclean-texinfo + +mostlyclean-texinfo: + @: $(MAKE); $(unstage) + @[ -f ./texinfo/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in texinfo" ; \ + (cd $(HOST_SUBDIR)/texinfo && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif texinfo + +.PHONY: maybe-clean-texinfo clean-texinfo +maybe-clean-texinfo: +@if texinfo +maybe-clean-texinfo: clean-texinfo + +clean-texinfo: + @: $(MAKE); $(unstage) + @[ -f ./texinfo/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in texinfo" ; \ + (cd $(HOST_SUBDIR)/texinfo && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif texinfo + +.PHONY: maybe-distclean-texinfo distclean-texinfo +maybe-distclean-texinfo: +@if texinfo +maybe-distclean-texinfo: distclean-texinfo + +distclean-texinfo: + @: $(MAKE); $(unstage) + @[ -f ./texinfo/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in texinfo" ; \ + (cd $(HOST_SUBDIR)/texinfo && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif texinfo + +.PHONY: maybe-maintainer-clean-texinfo maintainer-clean-texinfo +maybe-maintainer-clean-texinfo: +@if texinfo +maybe-maintainer-clean-texinfo: maintainer-clean-texinfo + +maintainer-clean-texinfo: + @: $(MAKE); $(unstage) + @[ -f ./texinfo/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in texinfo" ; \ + (cd $(HOST_SUBDIR)/texinfo && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif texinfo + + .PHONY: configure-textutils maybe-configure-textutils maybe-configure-textutils: -configure-textutils: - @test ! -f textutils/Makefile || exit 0; \ - [ -d textutils ] || mkdir textutils; \ - r=`${PWD_COMMAND}`; export r; \ +@if textutils +maybe-configure-textutils: configure-textutils +configure-textutils: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in textutils; \ - cd textutils || exit 1; \ + test ! -f $(HOST_SUBDIR)/textutils/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/textutils ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/textutils; \ + cd "$(HOST_SUBDIR)/textutils" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/textutils"; \ - libsrcdir="$$s/textutils";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/textutils"; \ - libsrcdir="$$s/textutils";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/textutils/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/textutils"; \ + libsrcdir="$$s/textutils"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif textutils + + + + .PHONY: all-textutils maybe-all-textutils maybe-all-textutils: +@if textutils +TARGET-textutils=all +maybe-all-textutils: all-textutils all-textutils: configure-textutils + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd textutils && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/textutils && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-textutils)) +@endif textutils + + + .PHONY: check-textutils maybe-check-textutils maybe-check-textutils: +@if textutils +maybe-check-textutils: check-textutils check-textutils: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd textutils && $(MAKE) $(FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/textutils && \ + $(MAKE) $(FLAGS_TO_PASS) check) +@endif textutils .PHONY: install-textutils maybe-install-textutils maybe-install-textutils: +@if textutils +maybe-install-textutils: install-textutils install-textutils: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd textutils && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/textutils && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif textutils + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-textutils info-textutils +maybe-info-textutils: +@if textutils +maybe-info-textutils: info-textutils + +info-textutils: \ + configure-textutils + @: $(MAKE); $(unstage) + @[ -f ./textutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in textutils" ; \ + (cd $(HOST_SUBDIR)/textutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif textutils + +.PHONY: maybe-dvi-textutils dvi-textutils +maybe-dvi-textutils: +@if textutils +maybe-dvi-textutils: dvi-textutils + +dvi-textutils: \ + configure-textutils + @: $(MAKE); $(unstage) + @[ -f ./textutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in textutils" ; \ + (cd $(HOST_SUBDIR)/textutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif textutils + +.PHONY: maybe-html-textutils html-textutils +maybe-html-textutils: +@if textutils +maybe-html-textutils: html-textutils + +html-textutils: \ + configure-textutils + @: $(MAKE); $(unstage) + @[ -f ./textutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in textutils" ; \ + (cd $(HOST_SUBDIR)/textutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif textutils + +.PHONY: maybe-TAGS-textutils TAGS-textutils +maybe-TAGS-textutils: +@if textutils +maybe-TAGS-textutils: TAGS-textutils + +TAGS-textutils: \ + configure-textutils + @: $(MAKE); $(unstage) + @[ -f ./textutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in textutils" ; \ + (cd $(HOST_SUBDIR)/textutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif textutils + +.PHONY: maybe-install-info-textutils install-info-textutils +maybe-install-info-textutils: +@if textutils +maybe-install-info-textutils: install-info-textutils + +install-info-textutils: \ + configure-textutils \ + info-textutils + @: $(MAKE); $(unstage) + @[ -f ./textutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in textutils" ; \ + (cd $(HOST_SUBDIR)/textutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif textutils + +.PHONY: maybe-install-html-textutils install-html-textutils +maybe-install-html-textutils: +@if textutils +maybe-install-html-textutils: install-html-textutils + +install-html-textutils: \ + configure-textutils \ + html-textutils + @: $(MAKE); $(unstage) + @[ -f ./textutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in textutils" ; \ + (cd $(HOST_SUBDIR)/textutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif textutils + +.PHONY: maybe-installcheck-textutils installcheck-textutils +maybe-installcheck-textutils: +@if textutils +maybe-installcheck-textutils: installcheck-textutils + +installcheck-textutils: \ + configure-textutils + @: $(MAKE); $(unstage) + @[ -f ./textutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in textutils" ; \ + (cd $(HOST_SUBDIR)/textutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif textutils + +.PHONY: maybe-mostlyclean-textutils mostlyclean-textutils +maybe-mostlyclean-textutils: +@if textutils +maybe-mostlyclean-textutils: mostlyclean-textutils + +mostlyclean-textutils: + @: $(MAKE); $(unstage) + @[ -f ./textutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in textutils" ; \ + (cd $(HOST_SUBDIR)/textutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif textutils + +.PHONY: maybe-clean-textutils clean-textutils +maybe-clean-textutils: +@if textutils +maybe-clean-textutils: clean-textutils + +clean-textutils: + @: $(MAKE); $(unstage) + @[ -f ./textutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in textutils" ; \ + (cd $(HOST_SUBDIR)/textutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif textutils + +.PHONY: maybe-distclean-textutils distclean-textutils +maybe-distclean-textutils: +@if textutils +maybe-distclean-textutils: distclean-textutils + +distclean-textutils: + @: $(MAKE); $(unstage) + @[ -f ./textutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in textutils" ; \ + (cd $(HOST_SUBDIR)/textutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif textutils + +.PHONY: maybe-maintainer-clean-textutils maintainer-clean-textutils +maybe-maintainer-clean-textutils: +@if textutils +maybe-maintainer-clean-textutils: maintainer-clean-textutils + +maintainer-clean-textutils: + @: $(MAKE); $(unstage) + @[ -f ./textutils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in textutils" ; \ + (cd $(HOST_SUBDIR)/textutils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif textutils + .PHONY: configure-time maybe-configure-time maybe-configure-time: -configure-time: - @test ! -f time/Makefile || exit 0; \ - [ -d time ] || mkdir time; \ - r=`${PWD_COMMAND}`; export r; \ +@if time +maybe-configure-time: configure-time +configure-time: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in time; \ - cd time || exit 1; \ + test ! -f $(HOST_SUBDIR)/time/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/time ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/time; \ + cd "$(HOST_SUBDIR)/time" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/time"; \ - libsrcdir="$$s/time";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/time"; \ - libsrcdir="$$s/time";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/time/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/time"; \ + libsrcdir="$$s/time"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif time + + + + .PHONY: all-time maybe-all-time maybe-all-time: +@if time +TARGET-time=all +maybe-all-time: all-time all-time: configure-time + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd time && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/time && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-time)) +@endif time + + + .PHONY: check-time maybe-check-time maybe-check-time: +@if time +maybe-check-time: check-time check-time: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd time && $(MAKE) $(FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/time && \ + $(MAKE) $(FLAGS_TO_PASS) check) +@endif time .PHONY: install-time maybe-install-time maybe-install-time: +@if time +maybe-install-time: install-time install-time: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd time && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/time && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif time + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-time info-time +maybe-info-time: +@if time +maybe-info-time: info-time + +info-time: \ + configure-time + @: $(MAKE); $(unstage) + @[ -f ./time/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in time" ; \ + (cd $(HOST_SUBDIR)/time && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif time + +.PHONY: maybe-dvi-time dvi-time +maybe-dvi-time: +@if time +maybe-dvi-time: dvi-time + +dvi-time: \ + configure-time + @: $(MAKE); $(unstage) + @[ -f ./time/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in time" ; \ + (cd $(HOST_SUBDIR)/time && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif time + +.PHONY: maybe-html-time html-time +maybe-html-time: +@if time +maybe-html-time: html-time + +html-time: \ + configure-time + @: $(MAKE); $(unstage) + @[ -f ./time/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in time" ; \ + (cd $(HOST_SUBDIR)/time && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif time + +.PHONY: maybe-TAGS-time TAGS-time +maybe-TAGS-time: +@if time +maybe-TAGS-time: TAGS-time + +TAGS-time: \ + configure-time + @: $(MAKE); $(unstage) + @[ -f ./time/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in time" ; \ + (cd $(HOST_SUBDIR)/time && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif time + +.PHONY: maybe-install-info-time install-info-time +maybe-install-info-time: +@if time +maybe-install-info-time: install-info-time + +install-info-time: \ + configure-time \ + info-time + @: $(MAKE); $(unstage) + @[ -f ./time/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in time" ; \ + (cd $(HOST_SUBDIR)/time && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif time + +.PHONY: maybe-install-html-time install-html-time +maybe-install-html-time: +@if time +maybe-install-html-time: install-html-time + +install-html-time: \ + configure-time \ + html-time + @: $(MAKE); $(unstage) + @[ -f ./time/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in time" ; \ + (cd $(HOST_SUBDIR)/time && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif time + +.PHONY: maybe-installcheck-time installcheck-time +maybe-installcheck-time: +@if time +maybe-installcheck-time: installcheck-time + +installcheck-time: \ + configure-time + @: $(MAKE); $(unstage) + @[ -f ./time/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in time" ; \ + (cd $(HOST_SUBDIR)/time && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif time + +.PHONY: maybe-mostlyclean-time mostlyclean-time +maybe-mostlyclean-time: +@if time +maybe-mostlyclean-time: mostlyclean-time + +mostlyclean-time: + @: $(MAKE); $(unstage) + @[ -f ./time/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in time" ; \ + (cd $(HOST_SUBDIR)/time && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif time + +.PHONY: maybe-clean-time clean-time +maybe-clean-time: +@if time +maybe-clean-time: clean-time + +clean-time: + @: $(MAKE); $(unstage) + @[ -f ./time/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in time" ; \ + (cd $(HOST_SUBDIR)/time && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif time + +.PHONY: maybe-distclean-time distclean-time +maybe-distclean-time: +@if time +maybe-distclean-time: distclean-time + +distclean-time: + @: $(MAKE); $(unstage) + @[ -f ./time/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in time" ; \ + (cd $(HOST_SUBDIR)/time && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif time + +.PHONY: maybe-maintainer-clean-time maintainer-clean-time +maybe-maintainer-clean-time: +@if time +maybe-maintainer-clean-time: maintainer-clean-time + +maintainer-clean-time: + @: $(MAKE); $(unstage) + @[ -f ./time/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in time" ; \ + (cd $(HOST_SUBDIR)/time && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif time + .PHONY: configure-uudecode maybe-configure-uudecode maybe-configure-uudecode: -configure-uudecode: - @test ! -f uudecode/Makefile || exit 0; \ - [ -d uudecode ] || mkdir uudecode; \ - r=`${PWD_COMMAND}`; export r; \ +@if uudecode +maybe-configure-uudecode: configure-uudecode +configure-uudecode: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in uudecode; \ - cd uudecode || exit 1; \ + test ! -f $(HOST_SUBDIR)/uudecode/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/uudecode ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/uudecode; \ + cd "$(HOST_SUBDIR)/uudecode" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/uudecode"; \ - libsrcdir="$$s/uudecode";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/uudecode"; \ - libsrcdir="$$s/uudecode";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/uudecode/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/uudecode"; \ + libsrcdir="$$s/uudecode"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif uudecode + + + + .PHONY: all-uudecode maybe-all-uudecode maybe-all-uudecode: +@if uudecode +TARGET-uudecode=all +maybe-all-uudecode: all-uudecode all-uudecode: configure-uudecode + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd uudecode && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/uudecode && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-uudecode)) +@endif uudecode + + + .PHONY: check-uudecode maybe-check-uudecode maybe-check-uudecode: +@if uudecode +maybe-check-uudecode: check-uudecode check-uudecode: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd uudecode && $(MAKE) $(FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/uudecode && \ + $(MAKE) $(FLAGS_TO_PASS) check) +@endif uudecode .PHONY: install-uudecode maybe-install-uudecode maybe-install-uudecode: +@if uudecode +maybe-install-uudecode: install-uudecode install-uudecode: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd uudecode && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/uudecode && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif uudecode + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-uudecode info-uudecode +maybe-info-uudecode: +@if uudecode +maybe-info-uudecode: info-uudecode + +info-uudecode: \ + configure-uudecode + @: $(MAKE); $(unstage) + @[ -f ./uudecode/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in uudecode" ; \ + (cd $(HOST_SUBDIR)/uudecode && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif uudecode + +.PHONY: maybe-dvi-uudecode dvi-uudecode +maybe-dvi-uudecode: +@if uudecode +maybe-dvi-uudecode: dvi-uudecode + +dvi-uudecode: \ + configure-uudecode + @: $(MAKE); $(unstage) + @[ -f ./uudecode/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in uudecode" ; \ + (cd $(HOST_SUBDIR)/uudecode && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif uudecode + +.PHONY: maybe-html-uudecode html-uudecode +maybe-html-uudecode: +@if uudecode +maybe-html-uudecode: html-uudecode + +html-uudecode: \ + configure-uudecode + @: $(MAKE); $(unstage) + @[ -f ./uudecode/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in uudecode" ; \ + (cd $(HOST_SUBDIR)/uudecode && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif uudecode + +.PHONY: maybe-TAGS-uudecode TAGS-uudecode +maybe-TAGS-uudecode: +@if uudecode +maybe-TAGS-uudecode: TAGS-uudecode + +TAGS-uudecode: \ + configure-uudecode + @: $(MAKE); $(unstage) + @[ -f ./uudecode/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in uudecode" ; \ + (cd $(HOST_SUBDIR)/uudecode && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif uudecode + +.PHONY: maybe-install-info-uudecode install-info-uudecode +maybe-install-info-uudecode: +@if uudecode +maybe-install-info-uudecode: install-info-uudecode + +install-info-uudecode: \ + configure-uudecode \ + info-uudecode + @: $(MAKE); $(unstage) + @[ -f ./uudecode/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in uudecode" ; \ + (cd $(HOST_SUBDIR)/uudecode && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif uudecode + +.PHONY: maybe-install-html-uudecode install-html-uudecode +maybe-install-html-uudecode: +@if uudecode +maybe-install-html-uudecode: install-html-uudecode + +install-html-uudecode: \ + configure-uudecode \ + html-uudecode + @: $(MAKE); $(unstage) + @[ -f ./uudecode/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in uudecode" ; \ + (cd $(HOST_SUBDIR)/uudecode && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif uudecode + +.PHONY: maybe-installcheck-uudecode installcheck-uudecode +maybe-installcheck-uudecode: +@if uudecode +maybe-installcheck-uudecode: installcheck-uudecode + +installcheck-uudecode: \ + configure-uudecode + @: $(MAKE); $(unstage) + @[ -f ./uudecode/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in uudecode" ; \ + (cd $(HOST_SUBDIR)/uudecode && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif uudecode + +.PHONY: maybe-mostlyclean-uudecode mostlyclean-uudecode +maybe-mostlyclean-uudecode: +@if uudecode +maybe-mostlyclean-uudecode: mostlyclean-uudecode + +mostlyclean-uudecode: + @: $(MAKE); $(unstage) + @[ -f ./uudecode/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in uudecode" ; \ + (cd $(HOST_SUBDIR)/uudecode && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif uudecode + +.PHONY: maybe-clean-uudecode clean-uudecode +maybe-clean-uudecode: +@if uudecode +maybe-clean-uudecode: clean-uudecode + +clean-uudecode: + @: $(MAKE); $(unstage) + @[ -f ./uudecode/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in uudecode" ; \ + (cd $(HOST_SUBDIR)/uudecode && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif uudecode + +.PHONY: maybe-distclean-uudecode distclean-uudecode +maybe-distclean-uudecode: +@if uudecode +maybe-distclean-uudecode: distclean-uudecode + +distclean-uudecode: + @: $(MAKE); $(unstage) + @[ -f ./uudecode/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in uudecode" ; \ + (cd $(HOST_SUBDIR)/uudecode && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif uudecode + +.PHONY: maybe-maintainer-clean-uudecode maintainer-clean-uudecode +maybe-maintainer-clean-uudecode: +@if uudecode +maybe-maintainer-clean-uudecode: maintainer-clean-uudecode + +maintainer-clean-uudecode: + @: $(MAKE); $(unstage) + @[ -f ./uudecode/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in uudecode" ; \ + (cd $(HOST_SUBDIR)/uudecode && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif uudecode + .PHONY: configure-wdiff maybe-configure-wdiff maybe-configure-wdiff: -configure-wdiff: - @test ! -f wdiff/Makefile || exit 0; \ - [ -d wdiff ] || mkdir wdiff; \ - r=`${PWD_COMMAND}`; export r; \ +@if wdiff +maybe-configure-wdiff: configure-wdiff +configure-wdiff: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in wdiff; \ - cd wdiff || exit 1; \ + test ! -f $(HOST_SUBDIR)/wdiff/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/wdiff ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/wdiff; \ + cd "$(HOST_SUBDIR)/wdiff" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/wdiff"; \ - libsrcdir="$$s/wdiff";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/wdiff"; \ - libsrcdir="$$s/wdiff";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/wdiff/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/wdiff"; \ + libsrcdir="$$s/wdiff"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif wdiff + + + + .PHONY: all-wdiff maybe-all-wdiff maybe-all-wdiff: +@if wdiff +TARGET-wdiff=all +maybe-all-wdiff: all-wdiff all-wdiff: configure-wdiff + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd wdiff && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/wdiff && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-wdiff)) +@endif wdiff + + + .PHONY: check-wdiff maybe-check-wdiff maybe-check-wdiff: +@if wdiff +maybe-check-wdiff: check-wdiff check-wdiff: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd wdiff && $(MAKE) $(FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/wdiff && \ + $(MAKE) $(FLAGS_TO_PASS) check) +@endif wdiff .PHONY: install-wdiff maybe-install-wdiff maybe-install-wdiff: +@if wdiff +maybe-install-wdiff: install-wdiff install-wdiff: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd wdiff && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/wdiff && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif wdiff + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-wdiff info-wdiff +maybe-info-wdiff: +@if wdiff +maybe-info-wdiff: info-wdiff + +info-wdiff: \ + configure-wdiff + @: $(MAKE); $(unstage) + @[ -f ./wdiff/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in wdiff" ; \ + (cd $(HOST_SUBDIR)/wdiff && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif wdiff + +.PHONY: maybe-dvi-wdiff dvi-wdiff +maybe-dvi-wdiff: +@if wdiff +maybe-dvi-wdiff: dvi-wdiff + +dvi-wdiff: \ + configure-wdiff + @: $(MAKE); $(unstage) + @[ -f ./wdiff/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in wdiff" ; \ + (cd $(HOST_SUBDIR)/wdiff && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif wdiff + +.PHONY: maybe-html-wdiff html-wdiff +maybe-html-wdiff: +@if wdiff +maybe-html-wdiff: html-wdiff + +html-wdiff: \ + configure-wdiff + @: $(MAKE); $(unstage) + @[ -f ./wdiff/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in wdiff" ; \ + (cd $(HOST_SUBDIR)/wdiff && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif wdiff + +.PHONY: maybe-TAGS-wdiff TAGS-wdiff +maybe-TAGS-wdiff: +@if wdiff +maybe-TAGS-wdiff: TAGS-wdiff + +TAGS-wdiff: \ + configure-wdiff + @: $(MAKE); $(unstage) + @[ -f ./wdiff/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in wdiff" ; \ + (cd $(HOST_SUBDIR)/wdiff && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif wdiff + +.PHONY: maybe-install-info-wdiff install-info-wdiff +maybe-install-info-wdiff: +@if wdiff +maybe-install-info-wdiff: install-info-wdiff + +install-info-wdiff: \ + configure-wdiff \ + info-wdiff + @: $(MAKE); $(unstage) + @[ -f ./wdiff/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in wdiff" ; \ + (cd $(HOST_SUBDIR)/wdiff && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif wdiff + +.PHONY: maybe-install-html-wdiff install-html-wdiff +maybe-install-html-wdiff: +@if wdiff +maybe-install-html-wdiff: install-html-wdiff + +install-html-wdiff: \ + configure-wdiff \ + html-wdiff + @: $(MAKE); $(unstage) + @[ -f ./wdiff/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in wdiff" ; \ + (cd $(HOST_SUBDIR)/wdiff && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif wdiff + +.PHONY: maybe-installcheck-wdiff installcheck-wdiff +maybe-installcheck-wdiff: +@if wdiff +maybe-installcheck-wdiff: installcheck-wdiff + +installcheck-wdiff: \ + configure-wdiff + @: $(MAKE); $(unstage) + @[ -f ./wdiff/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in wdiff" ; \ + (cd $(HOST_SUBDIR)/wdiff && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif wdiff + +.PHONY: maybe-mostlyclean-wdiff mostlyclean-wdiff +maybe-mostlyclean-wdiff: +@if wdiff +maybe-mostlyclean-wdiff: mostlyclean-wdiff + +mostlyclean-wdiff: + @: $(MAKE); $(unstage) + @[ -f ./wdiff/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in wdiff" ; \ + (cd $(HOST_SUBDIR)/wdiff && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif wdiff + +.PHONY: maybe-clean-wdiff clean-wdiff +maybe-clean-wdiff: +@if wdiff +maybe-clean-wdiff: clean-wdiff + +clean-wdiff: + @: $(MAKE); $(unstage) + @[ -f ./wdiff/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in wdiff" ; \ + (cd $(HOST_SUBDIR)/wdiff && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif wdiff + +.PHONY: maybe-distclean-wdiff distclean-wdiff +maybe-distclean-wdiff: +@if wdiff +maybe-distclean-wdiff: distclean-wdiff + +distclean-wdiff: + @: $(MAKE); $(unstage) + @[ -f ./wdiff/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in wdiff" ; \ + (cd $(HOST_SUBDIR)/wdiff && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif wdiff + +.PHONY: maybe-maintainer-clean-wdiff maintainer-clean-wdiff +maybe-maintainer-clean-wdiff: +@if wdiff +maybe-maintainer-clean-wdiff: maintainer-clean-wdiff + +maintainer-clean-wdiff: + @: $(MAKE); $(unstage) + @[ -f ./wdiff/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in wdiff" ; \ + (cd $(HOST_SUBDIR)/wdiff && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif wdiff + .PHONY: configure-zip maybe-configure-zip maybe-configure-zip: -configure-zip: - @test ! -f zip/Makefile || exit 0; \ - [ -d zip ] || mkdir zip; \ - r=`${PWD_COMMAND}`; export r; \ +@if zip +maybe-configure-zip: configure-zip +configure-zip: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in zip; \ - cd zip || exit 1; \ + test ! -f $(HOST_SUBDIR)/zip/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/zip ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/zip; \ + cd "$(HOST_SUBDIR)/zip" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/zip"; \ - libsrcdir="$$s/zip";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/zip"; \ - libsrcdir="$$s/zip";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/zip/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/zip"; \ + libsrcdir="$$s/zip"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif zip + + + + .PHONY: all-zip maybe-all-zip maybe-all-zip: +@if zip +TARGET-zip=all +maybe-all-zip: all-zip all-zip: configure-zip + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd zip && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/zip && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-zip)) +@endif zip + + + .PHONY: check-zip maybe-check-zip maybe-check-zip: +@if zip +maybe-check-zip: check-zip # This module is only tested in a native toolchain. check-zip: + @: $(MAKE); $(unstage) @if [ '$(host)' = '$(target)' ] ; then \ r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd zip && $(MAKE) $(FLAGS_TO_PASS) check); \ + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/zip && \ + $(MAKE) $(FLAGS_TO_PASS) check); \ fi +@endif zip .PHONY: install-zip maybe-install-zip maybe-install-zip: +@if zip +maybe-install-zip: install-zip install-zip: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd zip && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/zip && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif zip + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-zip info-zip +maybe-info-zip: +@if zip +maybe-info-zip: info-zip + +info-zip: \ + configure-zip + @: $(MAKE); $(unstage) + @[ -f ./zip/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in zip" ; \ + (cd $(HOST_SUBDIR)/zip && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif zip + +.PHONY: maybe-dvi-zip dvi-zip +maybe-dvi-zip: +@if zip +maybe-dvi-zip: dvi-zip + +dvi-zip: \ + configure-zip + @: $(MAKE); $(unstage) + @[ -f ./zip/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in zip" ; \ + (cd $(HOST_SUBDIR)/zip && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif zip + +.PHONY: maybe-html-zip html-zip +maybe-html-zip: +@if zip +maybe-html-zip: html-zip + +html-zip: \ + configure-zip + @: $(MAKE); $(unstage) + @[ -f ./zip/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in zip" ; \ + (cd $(HOST_SUBDIR)/zip && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif zip + +.PHONY: maybe-TAGS-zip TAGS-zip +maybe-TAGS-zip: +@if zip +maybe-TAGS-zip: TAGS-zip + +TAGS-zip: \ + configure-zip + @: $(MAKE); $(unstage) + @[ -f ./zip/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in zip" ; \ + (cd $(HOST_SUBDIR)/zip && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif zip + +.PHONY: maybe-install-info-zip install-info-zip +maybe-install-info-zip: +@if zip +maybe-install-info-zip: install-info-zip + +install-info-zip: \ + configure-zip \ + info-zip + @: $(MAKE); $(unstage) + @[ -f ./zip/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in zip" ; \ + (cd $(HOST_SUBDIR)/zip && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif zip + +.PHONY: maybe-install-html-zip install-html-zip +maybe-install-html-zip: +@if zip +maybe-install-html-zip: install-html-zip + +install-html-zip: \ + configure-zip \ + html-zip + @: $(MAKE); $(unstage) + @[ -f ./zip/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in zip" ; \ + (cd $(HOST_SUBDIR)/zip && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif zip + +.PHONY: maybe-installcheck-zip installcheck-zip +maybe-installcheck-zip: +@if zip +maybe-installcheck-zip: installcheck-zip + +installcheck-zip: \ + configure-zip + @: $(MAKE); $(unstage) + @[ -f ./zip/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in zip" ; \ + (cd $(HOST_SUBDIR)/zip && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif zip + +.PHONY: maybe-mostlyclean-zip mostlyclean-zip +maybe-mostlyclean-zip: +@if zip +maybe-mostlyclean-zip: mostlyclean-zip + +mostlyclean-zip: + @: $(MAKE); $(unstage) + @[ -f ./zip/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in zip" ; \ + (cd $(HOST_SUBDIR)/zip && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif zip + +.PHONY: maybe-clean-zip clean-zip +maybe-clean-zip: +@if zip +maybe-clean-zip: clean-zip + +clean-zip: + @: $(MAKE); $(unstage) + @[ -f ./zip/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in zip" ; \ + (cd $(HOST_SUBDIR)/zip && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif zip + +.PHONY: maybe-distclean-zip distclean-zip +maybe-distclean-zip: +@if zip +maybe-distclean-zip: distclean-zip + +distclean-zip: + @: $(MAKE); $(unstage) + @[ -f ./zip/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in zip" ; \ + (cd $(HOST_SUBDIR)/zip && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif zip + +.PHONY: maybe-maintainer-clean-zip maintainer-clean-zip +maybe-maintainer-clean-zip: +@if zip +maybe-maintainer-clean-zip: maintainer-clean-zip + +maintainer-clean-zip: + @: $(MAKE); $(unstage) + @[ -f ./zip/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in zip" ; \ + (cd $(HOST_SUBDIR)/zip && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif zip + .PHONY: configure-zlib maybe-configure-zlib maybe-configure-zlib: -configure-zlib: - @test ! -f zlib/Makefile || exit 0; \ - [ -d zlib ] || mkdir zlib; \ - r=`${PWD_COMMAND}`; export r; \ +@if zlib +maybe-configure-zlib: configure-zlib +configure-zlib: +@endif zlib +@if zlib-bootstrap + @if test -f stage_last; then $(unstage); else $(MAKE) stage1-start; fi +@endif zlib-bootstrap +@if zlib + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in zlib; \ - cd zlib || exit 1; \ + test ! -f $(HOST_SUBDIR)/zlib/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/zlib ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/zlib; \ + cd "$(HOST_SUBDIR)/zlib" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/zlib"; \ - libsrcdir="$$s/zlib";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/zlib"; \ - libsrcdir="$$s/zlib";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/zlib/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/zlib"; \ + libsrcdir="$$s/zlib"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + || exit 1 +@endif zlib + + + +.PHONY: configure-stage1-zlib maybe-configure-stage1-zlib +maybe-configure-stage1-zlib: +@if zlib-bootstrap +maybe-configure-stage1-zlib: configure-stage1-zlib +configure-stage1-zlib: + @[ $(current_stage) = stage1 ] || $(MAKE) stage1-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/zlib + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/zlib/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + echo Configuring stage 1 in $(HOST_SUBDIR)/zlib ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/zlib ; \ + cd $(HOST_SUBDIR)/zlib || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/zlib/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/zlib"; \ + libsrcdir="$$s/zlib"; \ $(SHELL) $${libsrcdir}/configure \ $(HOST_CONFIGARGS) $${srcdiroption} \ - || exit 1 + --disable-intermodule --disable-coverage --enable-languages="$(STAGE1_LANGUAGES)" +@endif zlib-bootstrap + +.PHONY: configure-stage2-zlib maybe-configure-stage2-zlib +maybe-configure-stage2-zlib: +@if zlib-bootstrap +maybe-configure-stage2-zlib: configure-stage2-zlib +configure-stage2-zlib: + @[ $(current_stage) = stage2 ] || $(MAKE) stage2-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/zlib + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/zlib/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage 2 in $(HOST_SUBDIR)/zlib ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/zlib ; \ + cd $(HOST_SUBDIR)/zlib || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/zlib/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/zlib"; \ + libsrcdir="$$s/zlib"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif zlib-bootstrap + +.PHONY: configure-stage3-zlib maybe-configure-stage3-zlib +maybe-configure-stage3-zlib: +@if zlib-bootstrap +maybe-configure-stage3-zlib: configure-stage3-zlib +configure-stage3-zlib: + @[ $(current_stage) = stage3 ] || $(MAKE) stage3-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/zlib + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/zlib/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage 3 in $(HOST_SUBDIR)/zlib ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/zlib ; \ + cd $(HOST_SUBDIR)/zlib || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/zlib/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/zlib"; \ + libsrcdir="$$s/zlib"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif zlib-bootstrap + +.PHONY: configure-stage4-zlib maybe-configure-stage4-zlib +maybe-configure-stage4-zlib: +@if zlib-bootstrap +maybe-configure-stage4-zlib: configure-stage4-zlib +configure-stage4-zlib: + @[ $(current_stage) = stage4 ] || $(MAKE) stage4-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/zlib + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/zlib/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage 4 in $(HOST_SUBDIR)/zlib ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/zlib ; \ + cd $(HOST_SUBDIR)/zlib || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/zlib/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/zlib"; \ + libsrcdir="$$s/zlib"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif zlib-bootstrap + +.PHONY: configure-stageprofile-zlib maybe-configure-stageprofile-zlib +maybe-configure-stageprofile-zlib: +@if zlib-bootstrap +maybe-configure-stageprofile-zlib: configure-stageprofile-zlib +configure-stageprofile-zlib: + @[ $(current_stage) = stageprofile ] || $(MAKE) stageprofile-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/zlib + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/zlib/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage profile in $(HOST_SUBDIR)/zlib ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/zlib ; \ + cd $(HOST_SUBDIR)/zlib || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/zlib/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/zlib"; \ + libsrcdir="$$s/zlib"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif zlib-bootstrap + +.PHONY: configure-stagefeedback-zlib maybe-configure-stagefeedback-zlib +maybe-configure-stagefeedback-zlib: +@if zlib-bootstrap +maybe-configure-stagefeedback-zlib: configure-stagefeedback-zlib +configure-stagefeedback-zlib: + @[ $(current_stage) = stagefeedback ] || $(MAKE) stagefeedback-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/zlib + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/zlib/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + echo Configuring stage feedback in $(HOST_SUBDIR)/zlib ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/zlib ; \ + cd $(HOST_SUBDIR)/zlib || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/zlib/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/zlib"; \ + libsrcdir="$$s/zlib"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + @stage2_werror_flag@ +@endif zlib-bootstrap + + + + .PHONY: all-zlib maybe-all-zlib maybe-all-zlib: +@if zlib +TARGET-zlib=all +maybe-all-zlib: all-zlib all-zlib: configure-zlib +@endif zlib +@if zlib-bootstrap + @if test -f stage_last; then $(unstage); else $(MAKE) stage1-start; fi +@endif zlib-bootstrap +@if zlib @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd zlib && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/zlib && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-zlib)) +@endif zlib + + + +.PHONY: all-stage1-zlib maybe-all-stage1-zlib +.PHONY: clean-stage1-zlib maybe-clean-stage1-zlib +maybe-all-stage1-zlib: +maybe-clean-stage1-zlib: +@if zlib-bootstrap +maybe-all-stage1-zlib: all-stage1-zlib +all-stage1: all-stage1-zlib +TARGET-stage1-zlib = $(TARGET-zlib) +all-stage1-zlib: configure-stage1-zlib + @[ $(current_stage) = stage1 ] || $(MAKE) stage1-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/zlib && \ + $(MAKE) $(FLAGS_TO_PASS) CFLAGS="$(STAGE1_CFLAGS)" LIBCFLAGS="$(STAGE1_CFLAGS)" \ + $(TARGET-stage1-zlib) + +maybe-clean-stage1-zlib: clean-stage1-zlib +clean-stage1: clean-stage1-zlib +clean-stage1-zlib: + @[ -f $(HOST_SUBDIR)/zlib/Makefile ] || [ -f $(HOST_SUBDIR)/stage1-zlib/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stage1 ] || $(MAKE) stage1-start; \ + cd $(HOST_SUBDIR)/zlib && \ + $(MAKE) $(FLAGS_TO_PASS) \ + CFLAGS="$(STAGE1_CFLAGS)" LIBCFLAGS="$(STAGE1_CFLAGS)" clean +@endif zlib-bootstrap + + +.PHONY: all-stage2-zlib maybe-all-stage2-zlib +.PHONY: clean-stage2-zlib maybe-clean-stage2-zlib +maybe-all-stage2-zlib: +maybe-clean-stage2-zlib: +@if zlib-bootstrap +maybe-all-stage2-zlib: all-stage2-zlib +all-stage2: all-stage2-zlib +TARGET-stage2-zlib = $(TARGET-zlib) +all-stage2-zlib: configure-stage2-zlib + @[ $(current_stage) = stage2 ] || $(MAKE) stage2-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/zlib && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) \ + $(TARGET-stage2-zlib) + +maybe-clean-stage2-zlib: clean-stage2-zlib +clean-stage2: clean-stage2-zlib +clean-stage2-zlib: + @[ -f $(HOST_SUBDIR)/zlib/Makefile ] || [ -f $(HOST_SUBDIR)/stage2-zlib/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stage2 ] || $(MAKE) stage2-start; \ + cd $(HOST_SUBDIR)/zlib && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + clean +@endif zlib-bootstrap + + +.PHONY: all-stage3-zlib maybe-all-stage3-zlib +.PHONY: clean-stage3-zlib maybe-clean-stage3-zlib +maybe-all-stage3-zlib: +maybe-clean-stage3-zlib: +@if zlib-bootstrap +maybe-all-stage3-zlib: all-stage3-zlib +all-stage3: all-stage3-zlib +TARGET-stage3-zlib = $(TARGET-zlib) +all-stage3-zlib: configure-stage3-zlib + @[ $(current_stage) = stage3 ] || $(MAKE) stage3-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/zlib && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) \ + $(TARGET-stage3-zlib) + +maybe-clean-stage3-zlib: clean-stage3-zlib +clean-stage3: clean-stage3-zlib +clean-stage3-zlib: + @[ -f $(HOST_SUBDIR)/zlib/Makefile ] || [ -f $(HOST_SUBDIR)/stage3-zlib/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stage3 ] || $(MAKE) stage3-start; \ + cd $(HOST_SUBDIR)/zlib && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + clean +@endif zlib-bootstrap + + +.PHONY: all-stage4-zlib maybe-all-stage4-zlib +.PHONY: clean-stage4-zlib maybe-clean-stage4-zlib +maybe-all-stage4-zlib: +maybe-clean-stage4-zlib: +@if zlib-bootstrap +maybe-all-stage4-zlib: all-stage4-zlib +all-stage4: all-stage4-zlib +TARGET-stage4-zlib = $(TARGET-zlib) +all-stage4-zlib: configure-stage4-zlib + @[ $(current_stage) = stage4 ] || $(MAKE) stage4-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/zlib && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) \ + $(TARGET-stage4-zlib) + +maybe-clean-stage4-zlib: clean-stage4-zlib +clean-stage4: clean-stage4-zlib +clean-stage4-zlib: + @[ -f $(HOST_SUBDIR)/zlib/Makefile ] || [ -f $(HOST_SUBDIR)/stage4-zlib/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stage4 ] || $(MAKE) stage4-start; \ + cd $(HOST_SUBDIR)/zlib && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + clean +@endif zlib-bootstrap + + +.PHONY: all-stageprofile-zlib maybe-all-stageprofile-zlib +.PHONY: clean-stageprofile-zlib maybe-clean-stageprofile-zlib +maybe-all-stageprofile-zlib: +maybe-clean-stageprofile-zlib: +@if zlib-bootstrap +maybe-all-stageprofile-zlib: all-stageprofile-zlib +all-stageprofile: all-stageprofile-zlib +TARGET-stageprofile-zlib = $(TARGET-zlib) +all-stageprofile-zlib: configure-stageprofile-zlib + @[ $(current_stage) = stageprofile ] || $(MAKE) stageprofile-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/zlib && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) CFLAGS="$(BOOT_CFLAGS) -fprofile-generate" \ + $(TARGET-stageprofile-zlib) + +maybe-clean-stageprofile-zlib: clean-stageprofile-zlib +clean-stageprofile: clean-stageprofile-zlib +clean-stageprofile-zlib: + @[ -f $(HOST_SUBDIR)/zlib/Makefile ] || [ -f $(HOST_SUBDIR)/stageprofile-zlib/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stageprofile ] || $(MAKE) stageprofile-start; \ + cd $(HOST_SUBDIR)/zlib && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + CFLAGS="$(BOOT_CFLAGS) -fprofile-generate" clean +@endif zlib-bootstrap + + +.PHONY: all-stagefeedback-zlib maybe-all-stagefeedback-zlib +.PHONY: clean-stagefeedback-zlib maybe-clean-stagefeedback-zlib +maybe-all-stagefeedback-zlib: +maybe-clean-stagefeedback-zlib: +@if zlib-bootstrap +maybe-all-stagefeedback-zlib: all-stagefeedback-zlib +all-stagefeedback: all-stagefeedback-zlib +TARGET-stagefeedback-zlib = $(TARGET-zlib) +all-stagefeedback-zlib: configure-stagefeedback-zlib + @[ $(current_stage) = stagefeedback ] || $(MAKE) stagefeedback-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/zlib && \ + $(MAKE) $(FLAGS_TO_PASS) $(POSTSTAGE1_FLAGS_TO_PASS) CFLAGS="$(BOOT_CFLAGS) -fprofile-use" \ + $(TARGET-stagefeedback-zlib) + +maybe-clean-stagefeedback-zlib: clean-stagefeedback-zlib +clean-stagefeedback: clean-stagefeedback-zlib +clean-stagefeedback-zlib: + @[ -f $(HOST_SUBDIR)/zlib/Makefile ] || [ -f $(HOST_SUBDIR)/stagefeedback-zlib/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stagefeedback ] || $(MAKE) stagefeedback-start; \ + cd $(HOST_SUBDIR)/zlib && \ + $(MAKE) $(FLAGS_TO_PASS) \ + $(POSTSTAGE1_FLAGS_TO_PASS) \ + CFLAGS="$(BOOT_CFLAGS) -fprofile-use" clean +@endif zlib-bootstrap + + + + .PHONY: check-zlib maybe-check-zlib maybe-check-zlib: +@if zlib +maybe-check-zlib: check-zlib check-zlib: +@endif zlib .PHONY: install-zlib maybe-install-zlib maybe-install-zlib: +@if zlib +maybe-install-zlib: install-zlib install-zlib: +@endif zlib + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-zlib info-zlib +maybe-info-zlib: +@if zlib +maybe-info-zlib: info-zlib + +info-zlib: \ + configure-zlib + @[ -f ./zlib/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in zlib" ; \ + (cd $(HOST_SUBDIR)/zlib && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif zlib + +.PHONY: maybe-dvi-zlib dvi-zlib +maybe-dvi-zlib: +@if zlib +maybe-dvi-zlib: dvi-zlib + +dvi-zlib: \ + configure-zlib + @[ -f ./zlib/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in zlib" ; \ + (cd $(HOST_SUBDIR)/zlib && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif zlib + +.PHONY: maybe-html-zlib html-zlib +maybe-html-zlib: +@if zlib +maybe-html-zlib: html-zlib + +html-zlib: \ + configure-zlib + @[ -f ./zlib/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in zlib" ; \ + (cd $(HOST_SUBDIR)/zlib && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif zlib + +.PHONY: maybe-TAGS-zlib TAGS-zlib +maybe-TAGS-zlib: +@if zlib +maybe-TAGS-zlib: TAGS-zlib + +TAGS-zlib: \ + configure-zlib + @[ -f ./zlib/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in zlib" ; \ + (cd $(HOST_SUBDIR)/zlib && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif zlib + +.PHONY: maybe-install-info-zlib install-info-zlib +maybe-install-info-zlib: +@if zlib +maybe-install-info-zlib: install-info-zlib + +install-info-zlib: \ + configure-zlib \ + info-zlib + @[ -f ./zlib/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in zlib" ; \ + (cd $(HOST_SUBDIR)/zlib && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif zlib + +.PHONY: maybe-install-html-zlib install-html-zlib +maybe-install-html-zlib: +@if zlib +maybe-install-html-zlib: install-html-zlib + +install-html-zlib: \ + configure-zlib \ + html-zlib + @[ -f ./zlib/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in zlib" ; \ + (cd $(HOST_SUBDIR)/zlib && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif zlib + +.PHONY: maybe-installcheck-zlib installcheck-zlib +maybe-installcheck-zlib: +@if zlib +maybe-installcheck-zlib: installcheck-zlib + +installcheck-zlib: \ + configure-zlib + @[ -f ./zlib/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in zlib" ; \ + (cd $(HOST_SUBDIR)/zlib && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif zlib + +.PHONY: maybe-mostlyclean-zlib mostlyclean-zlib +maybe-mostlyclean-zlib: +@if zlib +maybe-mostlyclean-zlib: mostlyclean-zlib + +mostlyclean-zlib: + @[ -f ./zlib/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in zlib" ; \ + (cd $(HOST_SUBDIR)/zlib && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif zlib + +.PHONY: maybe-clean-zlib clean-zlib +maybe-clean-zlib: +@if zlib +maybe-clean-zlib: clean-zlib + +clean-zlib: + @[ -f ./zlib/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in zlib" ; \ + (cd $(HOST_SUBDIR)/zlib && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif zlib + +.PHONY: maybe-distclean-zlib distclean-zlib +maybe-distclean-zlib: +@if zlib +maybe-distclean-zlib: distclean-zlib + +distclean-zlib: + @[ -f ./zlib/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in zlib" ; \ + (cd $(HOST_SUBDIR)/zlib && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif zlib + +.PHONY: maybe-maintainer-clean-zlib maintainer-clean-zlib +maybe-maintainer-clean-zlib: +@if zlib +maybe-maintainer-clean-zlib: maintainer-clean-zlib + +maintainer-clean-zlib: + @[ -f ./zlib/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in zlib" ; \ + (cd $(HOST_SUBDIR)/zlib && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif zlib + + .PHONY: configure-gdb maybe-configure-gdb maybe-configure-gdb: -configure-gdb: - @test ! -f gdb/Makefile || exit 0; \ - [ -d gdb ] || mkdir gdb; \ - r=`${PWD_COMMAND}`; export r; \ +@if gdb +maybe-configure-gdb: configure-gdb +configure-gdb: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in gdb; \ - cd gdb || exit 1; \ + test ! -f $(HOST_SUBDIR)/gdb/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gdb ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/gdb; \ + cd "$(HOST_SUBDIR)/gdb" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/gdb"; \ - libsrcdir="$$s/gdb";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/gdb"; \ - libsrcdir="$$s/gdb";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/gdb/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/gdb"; \ + libsrcdir="$$s/gdb"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif gdb + + + + .PHONY: all-gdb maybe-all-gdb maybe-all-gdb: +@if gdb +TARGET-gdb=all +maybe-all-gdb: all-gdb all-gdb: configure-gdb + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd gdb && $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/gdb && \ + $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) $(TARGET-gdb)) +@endif gdb + + + .PHONY: check-gdb maybe-check-gdb maybe-check-gdb: +@if gdb +maybe-check-gdb: check-gdb check-gdb: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd gdb && $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/gdb && \ + $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) check) +@endif gdb .PHONY: install-gdb maybe-install-gdb maybe-install-gdb: +@if gdb +maybe-install-gdb: install-gdb install-gdb: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd gdb && $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/gdb && \ + $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) install) + +@endif gdb + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-gdb info-gdb +maybe-info-gdb: +@if gdb +maybe-info-gdb: info-gdb + +info-gdb: \ + configure-gdb + @: $(MAKE); $(unstage) + @[ -f ./gdb/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(X11_FLAGS_TO_PASS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in gdb" ; \ + (cd $(HOST_SUBDIR)/gdb && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif gdb + +.PHONY: maybe-dvi-gdb dvi-gdb +maybe-dvi-gdb: +@if gdb +maybe-dvi-gdb: dvi-gdb + +dvi-gdb: \ + configure-gdb + @: $(MAKE); $(unstage) + @[ -f ./gdb/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(X11_FLAGS_TO_PASS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in gdb" ; \ + (cd $(HOST_SUBDIR)/gdb && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif gdb + +.PHONY: maybe-html-gdb html-gdb +maybe-html-gdb: +@if gdb +maybe-html-gdb: html-gdb + +html-gdb: \ + configure-gdb + @: $(MAKE); $(unstage) + @[ -f ./gdb/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(X11_FLAGS_TO_PASS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in gdb" ; \ + (cd $(HOST_SUBDIR)/gdb && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif gdb + +.PHONY: maybe-TAGS-gdb TAGS-gdb +maybe-TAGS-gdb: +@if gdb +maybe-TAGS-gdb: TAGS-gdb + +TAGS-gdb: \ + configure-gdb + @: $(MAKE); $(unstage) + @[ -f ./gdb/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(X11_FLAGS_TO_PASS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in gdb" ; \ + (cd $(HOST_SUBDIR)/gdb && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif gdb + +.PHONY: maybe-install-info-gdb install-info-gdb +maybe-install-info-gdb: +@if gdb +maybe-install-info-gdb: install-info-gdb + +install-info-gdb: \ + configure-gdb \ + info-gdb + @: $(MAKE); $(unstage) + @[ -f ./gdb/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(X11_FLAGS_TO_PASS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in gdb" ; \ + (cd $(HOST_SUBDIR)/gdb && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif gdb + +.PHONY: maybe-install-html-gdb install-html-gdb +maybe-install-html-gdb: +@if gdb +maybe-install-html-gdb: install-html-gdb + +install-html-gdb: \ + configure-gdb \ + html-gdb + @: $(MAKE); $(unstage) + @[ -f ./gdb/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(X11_FLAGS_TO_PASS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in gdb" ; \ + (cd $(HOST_SUBDIR)/gdb && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif gdb + +.PHONY: maybe-installcheck-gdb installcheck-gdb +maybe-installcheck-gdb: +@if gdb +maybe-installcheck-gdb: installcheck-gdb + +installcheck-gdb: \ + configure-gdb + @: $(MAKE); $(unstage) + @[ -f ./gdb/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(X11_FLAGS_TO_PASS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in gdb" ; \ + (cd $(HOST_SUBDIR)/gdb && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif gdb + +.PHONY: maybe-mostlyclean-gdb mostlyclean-gdb +maybe-mostlyclean-gdb: +@if gdb +maybe-mostlyclean-gdb: mostlyclean-gdb + +mostlyclean-gdb: + @: $(MAKE); $(unstage) + @[ -f ./gdb/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(X11_FLAGS_TO_PASS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in gdb" ; \ + (cd $(HOST_SUBDIR)/gdb && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif gdb + +.PHONY: maybe-clean-gdb clean-gdb +maybe-clean-gdb: +@if gdb +maybe-clean-gdb: clean-gdb + +clean-gdb: + @: $(MAKE); $(unstage) + @[ -f ./gdb/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(X11_FLAGS_TO_PASS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in gdb" ; \ + (cd $(HOST_SUBDIR)/gdb && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif gdb + +.PHONY: maybe-distclean-gdb distclean-gdb +maybe-distclean-gdb: +@if gdb +maybe-distclean-gdb: distclean-gdb + +distclean-gdb: + @: $(MAKE); $(unstage) + @[ -f ./gdb/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(X11_FLAGS_TO_PASS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in gdb" ; \ + (cd $(HOST_SUBDIR)/gdb && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif gdb + +.PHONY: maybe-maintainer-clean-gdb maintainer-clean-gdb +maybe-maintainer-clean-gdb: +@if gdb +maybe-maintainer-clean-gdb: maintainer-clean-gdb + +maintainer-clean-gdb: + @: $(MAKE); $(unstage) + @[ -f ./gdb/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(X11_FLAGS_TO_PASS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in gdb" ; \ + (cd $(HOST_SUBDIR)/gdb && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif gdb + .PHONY: configure-expect maybe-configure-expect maybe-configure-expect: -configure-expect: - @test ! -f expect/Makefile || exit 0; \ - [ -d expect ] || mkdir expect; \ - r=`${PWD_COMMAND}`; export r; \ +@if expect +maybe-configure-expect: configure-expect +configure-expect: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in expect; \ - cd expect || exit 1; \ + test ! -f $(HOST_SUBDIR)/expect/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/expect ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/expect; \ + cd "$(HOST_SUBDIR)/expect" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/expect"; \ - libsrcdir="$$s/expect";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/expect"; \ - libsrcdir="$$s/expect";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/expect/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/expect"; \ + libsrcdir="$$s/expect"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif expect + + + + .PHONY: all-expect maybe-all-expect maybe-all-expect: +@if expect +TARGET-expect=all +maybe-all-expect: all-expect all-expect: configure-expect + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd expect && $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/expect && \ + $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) $(TARGET-expect)) +@endif expect + + + .PHONY: check-expect maybe-check-expect maybe-check-expect: +@if expect +maybe-check-expect: check-expect check-expect: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd expect && $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/expect && \ + $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) check) +@endif expect .PHONY: install-expect maybe-install-expect maybe-install-expect: +@if expect +maybe-install-expect: install-expect install-expect: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd expect && $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/expect && \ + $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) install) + +@endif expect + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-expect info-expect +maybe-info-expect: +@if expect +maybe-info-expect: info-expect + +info-expect: \ + configure-expect + @: $(MAKE); $(unstage) + @[ -f ./expect/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(X11_FLAGS_TO_PASS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in expect" ; \ + (cd $(HOST_SUBDIR)/expect && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif expect + +.PHONY: maybe-dvi-expect dvi-expect +maybe-dvi-expect: +@if expect +maybe-dvi-expect: dvi-expect + +dvi-expect: \ + configure-expect + @: $(MAKE); $(unstage) + @[ -f ./expect/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(X11_FLAGS_TO_PASS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in expect" ; \ + (cd $(HOST_SUBDIR)/expect && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif expect + +.PHONY: maybe-html-expect html-expect +maybe-html-expect: +@if expect +maybe-html-expect: html-expect + +html-expect: \ + configure-expect + @: $(MAKE); $(unstage) + @[ -f ./expect/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(X11_FLAGS_TO_PASS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in expect" ; \ + (cd $(HOST_SUBDIR)/expect && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif expect + +.PHONY: maybe-TAGS-expect TAGS-expect +maybe-TAGS-expect: +@if expect +maybe-TAGS-expect: TAGS-expect + +TAGS-expect: \ + configure-expect + @: $(MAKE); $(unstage) + @[ -f ./expect/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(X11_FLAGS_TO_PASS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in expect" ; \ + (cd $(HOST_SUBDIR)/expect && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif expect + +.PHONY: maybe-install-info-expect install-info-expect +maybe-install-info-expect: +@if expect +maybe-install-info-expect: install-info-expect + +install-info-expect: \ + configure-expect \ + info-expect + @: $(MAKE); $(unstage) + @[ -f ./expect/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(X11_FLAGS_TO_PASS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in expect" ; \ + (cd $(HOST_SUBDIR)/expect && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif expect + +.PHONY: maybe-install-html-expect install-html-expect +maybe-install-html-expect: +@if expect +maybe-install-html-expect: install-html-expect + +install-html-expect: \ + configure-expect \ + html-expect + @: $(MAKE); $(unstage) + @[ -f ./expect/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(X11_FLAGS_TO_PASS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in expect" ; \ + (cd $(HOST_SUBDIR)/expect && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif expect + +.PHONY: maybe-installcheck-expect installcheck-expect +maybe-installcheck-expect: +@if expect +maybe-installcheck-expect: installcheck-expect + +installcheck-expect: \ + configure-expect + @: $(MAKE); $(unstage) + @[ -f ./expect/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(X11_FLAGS_TO_PASS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in expect" ; \ + (cd $(HOST_SUBDIR)/expect && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif expect + +.PHONY: maybe-mostlyclean-expect mostlyclean-expect +maybe-mostlyclean-expect: +@if expect +maybe-mostlyclean-expect: mostlyclean-expect + +mostlyclean-expect: + @: $(MAKE); $(unstage) + @[ -f ./expect/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(X11_FLAGS_TO_PASS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in expect" ; \ + (cd $(HOST_SUBDIR)/expect && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif expect + +.PHONY: maybe-clean-expect clean-expect +maybe-clean-expect: +@if expect +maybe-clean-expect: clean-expect + +clean-expect: + @: $(MAKE); $(unstage) + @[ -f ./expect/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(X11_FLAGS_TO_PASS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in expect" ; \ + (cd $(HOST_SUBDIR)/expect && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif expect + +.PHONY: maybe-distclean-expect distclean-expect +maybe-distclean-expect: +@if expect +maybe-distclean-expect: distclean-expect + +distclean-expect: + @: $(MAKE); $(unstage) + @[ -f ./expect/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(X11_FLAGS_TO_PASS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in expect" ; \ + (cd $(HOST_SUBDIR)/expect && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif expect + +.PHONY: maybe-maintainer-clean-expect maintainer-clean-expect +maybe-maintainer-clean-expect: +@if expect +maybe-maintainer-clean-expect: maintainer-clean-expect + +maintainer-clean-expect: + @: $(MAKE); $(unstage) + @[ -f ./expect/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(X11_FLAGS_TO_PASS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in expect" ; \ + (cd $(HOST_SUBDIR)/expect && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif expect + .PHONY: configure-guile maybe-configure-guile maybe-configure-guile: -configure-guile: - @test ! -f guile/Makefile || exit 0; \ - [ -d guile ] || mkdir guile; \ - r=`${PWD_COMMAND}`; export r; \ +@if guile +maybe-configure-guile: configure-guile +configure-guile: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in guile; \ - cd guile || exit 1; \ + test ! -f $(HOST_SUBDIR)/guile/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/guile ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/guile; \ + cd "$(HOST_SUBDIR)/guile" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/guile"; \ - libsrcdir="$$s/guile";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/guile"; \ - libsrcdir="$$s/guile";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/guile/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/guile"; \ + libsrcdir="$$s/guile"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif guile + + + + .PHONY: all-guile maybe-all-guile maybe-all-guile: +@if guile +TARGET-guile=all +maybe-all-guile: all-guile all-guile: configure-guile + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd guile && $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/guile && \ + $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) $(TARGET-guile)) +@endif guile + + + .PHONY: check-guile maybe-check-guile maybe-check-guile: +@if guile +maybe-check-guile: check-guile check-guile: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd guile && $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/guile && \ + $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) check) +@endif guile .PHONY: install-guile maybe-install-guile maybe-install-guile: +@if guile +maybe-install-guile: install-guile install-guile: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd guile && $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/guile && \ + $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) install) + +@endif guile + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-guile info-guile +maybe-info-guile: +@if guile +maybe-info-guile: info-guile + +info-guile: \ + configure-guile + @: $(MAKE); $(unstage) + @[ -f ./guile/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(X11_FLAGS_TO_PASS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in guile" ; \ + (cd $(HOST_SUBDIR)/guile && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif guile + +.PHONY: maybe-dvi-guile dvi-guile +maybe-dvi-guile: +@if guile +maybe-dvi-guile: dvi-guile + +dvi-guile: \ + configure-guile + @: $(MAKE); $(unstage) + @[ -f ./guile/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(X11_FLAGS_TO_PASS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in guile" ; \ + (cd $(HOST_SUBDIR)/guile && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif guile + +.PHONY: maybe-html-guile html-guile +maybe-html-guile: +@if guile +maybe-html-guile: html-guile + +html-guile: \ + configure-guile + @: $(MAKE); $(unstage) + @[ -f ./guile/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(X11_FLAGS_TO_PASS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in guile" ; \ + (cd $(HOST_SUBDIR)/guile && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif guile + +.PHONY: maybe-TAGS-guile TAGS-guile +maybe-TAGS-guile: +@if guile +maybe-TAGS-guile: TAGS-guile + +TAGS-guile: \ + configure-guile + @: $(MAKE); $(unstage) + @[ -f ./guile/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(X11_FLAGS_TO_PASS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in guile" ; \ + (cd $(HOST_SUBDIR)/guile && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif guile + +.PHONY: maybe-install-info-guile install-info-guile +maybe-install-info-guile: +@if guile +maybe-install-info-guile: install-info-guile + +install-info-guile: \ + configure-guile \ + info-guile + @: $(MAKE); $(unstage) + @[ -f ./guile/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(X11_FLAGS_TO_PASS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in guile" ; \ + (cd $(HOST_SUBDIR)/guile && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif guile + +.PHONY: maybe-install-html-guile install-html-guile +maybe-install-html-guile: +@if guile +maybe-install-html-guile: install-html-guile + +install-html-guile: \ + configure-guile \ + html-guile + @: $(MAKE); $(unstage) + @[ -f ./guile/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(X11_FLAGS_TO_PASS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in guile" ; \ + (cd $(HOST_SUBDIR)/guile && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif guile + +.PHONY: maybe-installcheck-guile installcheck-guile +maybe-installcheck-guile: +@if guile +maybe-installcheck-guile: installcheck-guile + +installcheck-guile: \ + configure-guile + @: $(MAKE); $(unstage) + @[ -f ./guile/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(X11_FLAGS_TO_PASS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in guile" ; \ + (cd $(HOST_SUBDIR)/guile && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif guile + +.PHONY: maybe-mostlyclean-guile mostlyclean-guile +maybe-mostlyclean-guile: +@if guile +maybe-mostlyclean-guile: mostlyclean-guile + +mostlyclean-guile: + @: $(MAKE); $(unstage) + @[ -f ./guile/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(X11_FLAGS_TO_PASS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in guile" ; \ + (cd $(HOST_SUBDIR)/guile && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif guile + +.PHONY: maybe-clean-guile clean-guile +maybe-clean-guile: +@if guile +maybe-clean-guile: clean-guile + +clean-guile: + @: $(MAKE); $(unstage) + @[ -f ./guile/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(X11_FLAGS_TO_PASS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in guile" ; \ + (cd $(HOST_SUBDIR)/guile && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif guile + +.PHONY: maybe-distclean-guile distclean-guile +maybe-distclean-guile: +@if guile +maybe-distclean-guile: distclean-guile + +distclean-guile: + @: $(MAKE); $(unstage) + @[ -f ./guile/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(X11_FLAGS_TO_PASS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in guile" ; \ + (cd $(HOST_SUBDIR)/guile && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif guile + +.PHONY: maybe-maintainer-clean-guile maintainer-clean-guile +maybe-maintainer-clean-guile: +@if guile +maybe-maintainer-clean-guile: maintainer-clean-guile + +maintainer-clean-guile: + @: $(MAKE); $(unstage) + @[ -f ./guile/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(X11_FLAGS_TO_PASS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in guile" ; \ + (cd $(HOST_SUBDIR)/guile && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif guile + .PHONY: configure-tk maybe-configure-tk maybe-configure-tk: -configure-tk: - @test ! -f tk/Makefile || exit 0; \ - [ -d tk ] || mkdir tk; \ - r=`${PWD_COMMAND}`; export r; \ +@if tk +maybe-configure-tk: configure-tk +configure-tk: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in tk; \ - cd tk || exit 1; \ + test ! -f $(HOST_SUBDIR)/tk/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/tk ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/tk; \ + cd "$(HOST_SUBDIR)/tk" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/tk"; \ - libsrcdir="$$s/tk";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/tk"; \ - libsrcdir="$$s/tk";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/tk/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/tk"; \ + libsrcdir="$$s/tk"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif tk + + + + .PHONY: all-tk maybe-all-tk maybe-all-tk: +@if tk +TARGET-tk=all +maybe-all-tk: all-tk all-tk: configure-tk + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd tk && $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/tk && \ + $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) $(TARGET-tk)) +@endif tk + + + .PHONY: check-tk maybe-check-tk maybe-check-tk: +@if tk +maybe-check-tk: check-tk check-tk: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd tk && $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/tk && \ + $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) check) +@endif tk .PHONY: install-tk maybe-install-tk maybe-install-tk: +@if tk +maybe-install-tk: install-tk install-tk: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd tk && $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/tk && \ + $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) install) +@endif tk -.PHONY: configure-tix maybe-configure-tix -maybe-configure-tix: -configure-tix: - @test ! -f tix/Makefile || exit 0; \ - [ -d tix ] || mkdir tix; \ +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-tk info-tk +maybe-info-tk: +@if tk +maybe-info-tk: info-tk + +info-tk: \ + configure-tk + @: $(MAKE); $(unstage) + @[ -f ./tk/Makefile ] || exit 0; \ r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in tix; \ - cd tix || exit 1; \ - case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/tix"; \ - libsrcdir="$$s/tix";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/tix"; \ - libsrcdir="$$s/tix";; \ - esac; \ - $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(X11_FLAGS_TO_PASS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in tk" ; \ + (cd $(HOST_SUBDIR)/tk && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ || exit 1 -.PHONY: all-tix maybe-all-tix -maybe-all-tix: -all-tix: configure-tix - @r=`${PWD_COMMAND}`; export r; \ +@endif tk + +.PHONY: maybe-dvi-tk dvi-tk +maybe-dvi-tk: +@if tk +maybe-dvi-tk: dvi-tk + +dvi-tk: \ + configure-tk + @: $(MAKE); $(unstage) + @[ -f ./tk/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd tix && $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(X11_FLAGS_TO_PASS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in tk" ; \ + (cd $(HOST_SUBDIR)/tk && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 -.PHONY: check-tix maybe-check-tix -maybe-check-tix: +@endif tk -check-tix: - @r=`${PWD_COMMAND}`; export r; \ +.PHONY: maybe-html-tk html-tk +maybe-html-tk: +@if tk +maybe-html-tk: html-tk + +html-tk: \ + configure-tk + @: $(MAKE); $(unstage) + @[ -f ./tk/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd tix && $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) check) + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(X11_FLAGS_TO_PASS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in tk" ; \ + (cd $(HOST_SUBDIR)/tk && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 +@endif tk -.PHONY: install-tix maybe-install-tix -maybe-install-tix: +.PHONY: maybe-TAGS-tk TAGS-tk +maybe-TAGS-tk: +@if tk +maybe-TAGS-tk: TAGS-tk -install-tix: installdirs - @r=`${PWD_COMMAND}`; export r; \ +TAGS-tk: \ + configure-tk + @: $(MAKE); $(unstage) + @[ -f ./tk/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd tix && $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(X11_FLAGS_TO_PASS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in tk" ; \ + (cd $(HOST_SUBDIR)/tk && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif tk + +.PHONY: maybe-install-info-tk install-info-tk +maybe-install-info-tk: +@if tk +maybe-install-info-tk: install-info-tk + +install-info-tk: \ + configure-tk \ + info-tk + @: $(MAKE); $(unstage) + @[ -f ./tk/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(X11_FLAGS_TO_PASS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in tk" ; \ + (cd $(HOST_SUBDIR)/tk && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif tk + +.PHONY: maybe-install-html-tk install-html-tk +maybe-install-html-tk: +@if tk +maybe-install-html-tk: install-html-tk + +install-html-tk: \ + configure-tk \ + html-tk + @: $(MAKE); $(unstage) + @[ -f ./tk/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(X11_FLAGS_TO_PASS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in tk" ; \ + (cd $(HOST_SUBDIR)/tk && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif tk + +.PHONY: maybe-installcheck-tk installcheck-tk +maybe-installcheck-tk: +@if tk +maybe-installcheck-tk: installcheck-tk + +installcheck-tk: \ + configure-tk + @: $(MAKE); $(unstage) + @[ -f ./tk/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(X11_FLAGS_TO_PASS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in tk" ; \ + (cd $(HOST_SUBDIR)/tk && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif tk + +.PHONY: maybe-mostlyclean-tk mostlyclean-tk +maybe-mostlyclean-tk: +@if tk +maybe-mostlyclean-tk: mostlyclean-tk + +mostlyclean-tk: + @: $(MAKE); $(unstage) + @[ -f ./tk/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(X11_FLAGS_TO_PASS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in tk" ; \ + (cd $(HOST_SUBDIR)/tk && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif tk + +.PHONY: maybe-clean-tk clean-tk +maybe-clean-tk: +@if tk +maybe-clean-tk: clean-tk + +clean-tk: + @: $(MAKE); $(unstage) + @[ -f ./tk/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(X11_FLAGS_TO_PASS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in tk" ; \ + (cd $(HOST_SUBDIR)/tk && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif tk + +.PHONY: maybe-distclean-tk distclean-tk +maybe-distclean-tk: +@if tk +maybe-distclean-tk: distclean-tk + +distclean-tk: + @: $(MAKE); $(unstage) + @[ -f ./tk/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(X11_FLAGS_TO_PASS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in tk" ; \ + (cd $(HOST_SUBDIR)/tk && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif tk + +.PHONY: maybe-maintainer-clean-tk maintainer-clean-tk +maybe-maintainer-clean-tk: +@if tk +maybe-maintainer-clean-tk: maintainer-clean-tk + +maintainer-clean-tk: + @: $(MAKE); $(unstage) + @[ -f ./tk/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) $(X11_FLAGS_TO_PASS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in tk" ; \ + (cd $(HOST_SUBDIR)/tk && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif tk + .PHONY: configure-libtermcap maybe-configure-libtermcap maybe-configure-libtermcap: -configure-libtermcap: - @test ! -f libtermcap/Makefile || exit 0; \ - [ -d libtermcap ] || mkdir libtermcap; \ - r=`${PWD_COMMAND}`; export r; \ +@if libtermcap +maybe-configure-libtermcap: configure-libtermcap +configure-libtermcap: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in libtermcap; \ - cd libtermcap || exit 1; \ + test ! -f $(HOST_SUBDIR)/libtermcap/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libtermcap ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/libtermcap; \ + cd "$(HOST_SUBDIR)/libtermcap" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/libtermcap"; \ - libsrcdir="$$s/libtermcap";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/libtermcap"; \ - libsrcdir="$$s/libtermcap";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/libtermcap/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/libtermcap"; \ + libsrcdir="$$s/libtermcap"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif libtermcap + + + + .PHONY: all-libtermcap maybe-all-libtermcap maybe-all-libtermcap: +@if libtermcap +TARGET-libtermcap=all +maybe-all-libtermcap: all-libtermcap all-libtermcap: configure-libtermcap + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd libtermcap && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/libtermcap && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-libtermcap)) +@endif libtermcap + + + .PHONY: check-libtermcap maybe-check-libtermcap maybe-check-libtermcap: +@if libtermcap +maybe-check-libtermcap: check-libtermcap check-libtermcap: +@endif libtermcap .PHONY: install-libtermcap maybe-install-libtermcap maybe-install-libtermcap: +@if libtermcap +maybe-install-libtermcap: install-libtermcap install-libtermcap: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd libtermcap && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/libtermcap && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif libtermcap + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-libtermcap info-libtermcap +maybe-info-libtermcap: +@if libtermcap +maybe-info-libtermcap: info-libtermcap + +info-libtermcap: \ + configure-libtermcap + @: $(MAKE); $(unstage) + @[ -f ./libtermcap/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in libtermcap" ; \ + (cd $(HOST_SUBDIR)/libtermcap && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif libtermcap + +.PHONY: maybe-dvi-libtermcap dvi-libtermcap +maybe-dvi-libtermcap: +@if libtermcap +maybe-dvi-libtermcap: dvi-libtermcap + +dvi-libtermcap: \ + configure-libtermcap + @: $(MAKE); $(unstage) + @[ -f ./libtermcap/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in libtermcap" ; \ + (cd $(HOST_SUBDIR)/libtermcap && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif libtermcap + +.PHONY: maybe-html-libtermcap html-libtermcap +maybe-html-libtermcap: +@if libtermcap +maybe-html-libtermcap: html-libtermcap + +html-libtermcap: \ + configure-libtermcap + @: $(MAKE); $(unstage) + @[ -f ./libtermcap/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in libtermcap" ; \ + (cd $(HOST_SUBDIR)/libtermcap && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif libtermcap + +.PHONY: maybe-TAGS-libtermcap TAGS-libtermcap +maybe-TAGS-libtermcap: +@if libtermcap +maybe-TAGS-libtermcap: TAGS-libtermcap + +TAGS-libtermcap: \ + configure-libtermcap + @: $(MAKE); $(unstage) + @[ -f ./libtermcap/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in libtermcap" ; \ + (cd $(HOST_SUBDIR)/libtermcap && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif libtermcap + +.PHONY: maybe-install-info-libtermcap install-info-libtermcap +maybe-install-info-libtermcap: +@if libtermcap +maybe-install-info-libtermcap: install-info-libtermcap + +install-info-libtermcap: \ + configure-libtermcap \ + info-libtermcap + @: $(MAKE); $(unstage) + @[ -f ./libtermcap/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in libtermcap" ; \ + (cd $(HOST_SUBDIR)/libtermcap && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif libtermcap + +.PHONY: maybe-install-html-libtermcap install-html-libtermcap +maybe-install-html-libtermcap: +@if libtermcap +maybe-install-html-libtermcap: install-html-libtermcap + +install-html-libtermcap: \ + configure-libtermcap \ + html-libtermcap + @: $(MAKE); $(unstage) + @[ -f ./libtermcap/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in libtermcap" ; \ + (cd $(HOST_SUBDIR)/libtermcap && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif libtermcap + +.PHONY: maybe-installcheck-libtermcap installcheck-libtermcap +maybe-installcheck-libtermcap: +@if libtermcap +maybe-installcheck-libtermcap: installcheck-libtermcap + +installcheck-libtermcap: \ + configure-libtermcap + @: $(MAKE); $(unstage) + @[ -f ./libtermcap/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in libtermcap" ; \ + (cd $(HOST_SUBDIR)/libtermcap && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif libtermcap + +.PHONY: maybe-mostlyclean-libtermcap mostlyclean-libtermcap +maybe-mostlyclean-libtermcap: +@if libtermcap +maybe-mostlyclean-libtermcap: mostlyclean-libtermcap + +# libtermcap doesn't support mostlyclean. +mostlyclean-libtermcap: + +@endif libtermcap + +.PHONY: maybe-clean-libtermcap clean-libtermcap +maybe-clean-libtermcap: +@if libtermcap +maybe-clean-libtermcap: clean-libtermcap + +# libtermcap doesn't support clean. +clean-libtermcap: + +@endif libtermcap + +.PHONY: maybe-distclean-libtermcap distclean-libtermcap +maybe-distclean-libtermcap: +@if libtermcap +maybe-distclean-libtermcap: distclean-libtermcap + +# libtermcap doesn't support distclean. +distclean-libtermcap: + +@endif libtermcap + +.PHONY: maybe-maintainer-clean-libtermcap maintainer-clean-libtermcap +maybe-maintainer-clean-libtermcap: +@if libtermcap +maybe-maintainer-clean-libtermcap: maintainer-clean-libtermcap + +# libtermcap doesn't support maintainer-clean. +maintainer-clean-libtermcap: + +@endif libtermcap + .PHONY: configure-utils maybe-configure-utils maybe-configure-utils: -configure-utils: - @test ! -f utils/Makefile || exit 0; \ - [ -d utils ] || mkdir utils; \ - r=`${PWD_COMMAND}`; export r; \ +@if utils +maybe-configure-utils: configure-utils +configure-utils: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in utils; \ - cd utils || exit 1; \ + test ! -f $(HOST_SUBDIR)/utils/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/utils ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/utils; \ + cd "$(HOST_SUBDIR)/utils" || exit 1; \ case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/utils"; \ - libsrcdir="$$s/utils";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/utils"; \ - libsrcdir="$$s/utils";; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/utils/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ + srcdiroption="--srcdir=$${topdir}/utils"; \ + libsrcdir="$$s/utils"; \ $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ + $(HOST_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif utils + + + + .PHONY: all-utils maybe-all-utils maybe-all-utils: +@if utils +TARGET-utils=all +maybe-all-utils: all-utils all-utils: configure-utils + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd utils && $(MAKE) $(FLAGS_TO_PASS) all) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/utils && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-utils)) +@endif utils + + + .PHONY: check-utils maybe-check-utils maybe-check-utils: +@if utils +maybe-check-utils: check-utils check-utils: +@endif utils .PHONY: install-utils maybe-install-utils maybe-install-utils: +@if utils +maybe-install-utils: install-utils install-utils: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd utils && $(MAKE) $(FLAGS_TO_PASS) install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/utils && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif utils + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-utils info-utils +maybe-info-utils: +@if utils +maybe-info-utils: info-utils + +info-utils: \ + configure-utils + @: $(MAKE); $(unstage) + @[ -f ./utils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in utils" ; \ + (cd $(HOST_SUBDIR)/utils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif utils + +.PHONY: maybe-dvi-utils dvi-utils +maybe-dvi-utils: +@if utils +maybe-dvi-utils: dvi-utils + +dvi-utils: \ + configure-utils + @: $(MAKE); $(unstage) + @[ -f ./utils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in utils" ; \ + (cd $(HOST_SUBDIR)/utils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif utils + +.PHONY: maybe-html-utils html-utils +maybe-html-utils: +@if utils +maybe-html-utils: html-utils + +html-utils: \ + configure-utils + @: $(MAKE); $(unstage) + @[ -f ./utils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in utils" ; \ + (cd $(HOST_SUBDIR)/utils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif utils + +.PHONY: maybe-TAGS-utils TAGS-utils +maybe-TAGS-utils: +@if utils +maybe-TAGS-utils: TAGS-utils + +TAGS-utils: \ + configure-utils + @: $(MAKE); $(unstage) + @[ -f ./utils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in utils" ; \ + (cd $(HOST_SUBDIR)/utils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif utils + +.PHONY: maybe-install-info-utils install-info-utils +maybe-install-info-utils: +@if utils +maybe-install-info-utils: install-info-utils + +install-info-utils: \ + configure-utils \ + info-utils + @: $(MAKE); $(unstage) + @[ -f ./utils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in utils" ; \ + (cd $(HOST_SUBDIR)/utils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif utils + +.PHONY: maybe-install-html-utils install-html-utils +maybe-install-html-utils: +@if utils +maybe-install-html-utils: install-html-utils + +install-html-utils: \ + configure-utils \ + html-utils + @: $(MAKE); $(unstage) + @[ -f ./utils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in utils" ; \ + (cd $(HOST_SUBDIR)/utils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif utils + +.PHONY: maybe-installcheck-utils installcheck-utils +maybe-installcheck-utils: +@if utils +maybe-installcheck-utils: installcheck-utils + +installcheck-utils: \ + configure-utils + @: $(MAKE); $(unstage) + @[ -f ./utils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in utils" ; \ + (cd $(HOST_SUBDIR)/utils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif utils + +.PHONY: maybe-mostlyclean-utils mostlyclean-utils +maybe-mostlyclean-utils: +@if utils +maybe-mostlyclean-utils: mostlyclean-utils + +mostlyclean-utils: + @: $(MAKE); $(unstage) + @[ -f ./utils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in utils" ; \ + (cd $(HOST_SUBDIR)/utils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif utils + +.PHONY: maybe-clean-utils clean-utils +maybe-clean-utils: +@if utils +maybe-clean-utils: clean-utils + +clean-utils: + @: $(MAKE); $(unstage) + @[ -f ./utils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in utils" ; \ + (cd $(HOST_SUBDIR)/utils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif utils + +.PHONY: maybe-distclean-utils distclean-utils +maybe-distclean-utils: +@if utils +maybe-distclean-utils: distclean-utils + +distclean-utils: + @: $(MAKE); $(unstage) + @[ -f ./utils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in utils" ; \ + (cd $(HOST_SUBDIR)/utils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif utils + +.PHONY: maybe-maintainer-clean-utils maintainer-clean-utils +maybe-maintainer-clean-utils: +@if utils +maybe-maintainer-clean-utils: maintainer-clean-utils + +maintainer-clean-utils: + @: $(MAKE); $(unstage) + @[ -f ./utils/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in utils" ; \ + (cd $(HOST_SUBDIR)/utils && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif utils + + + +.PHONY: configure-gnattools maybe-configure-gnattools +maybe-configure-gnattools: +@if gnattools +maybe-configure-gnattools: configure-gnattools +configure-gnattools: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/gnattools/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gnattools ; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/gnattools; \ + cd "$(HOST_SUBDIR)/gnattools" || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/gnattools/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/gnattools"; \ + libsrcdir="$$s/gnattools"; \ + $(SHELL) $${libsrcdir}/configure \ + $(HOST_CONFIGARGS) $${srcdiroption} \ + || exit 1 +@endif gnattools + + + + + +.PHONY: all-gnattools maybe-all-gnattools +maybe-all-gnattools: +@if gnattools +TARGET-gnattools=all +maybe-all-gnattools: all-gnattools +all-gnattools: configure-gnattools + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/gnattools && \ + $(MAKE) $(FLAGS_TO_PASS) $(TARGET-gnattools)) +@endif gnattools + + + + +.PHONY: check-gnattools maybe-check-gnattools +maybe-check-gnattools: +@if gnattools +maybe-check-gnattools: check-gnattools + +check-gnattools: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/gnattools && \ + $(MAKE) $(FLAGS_TO_PASS) check) + +@endif gnattools + +.PHONY: install-gnattools maybe-install-gnattools +maybe-install-gnattools: +@if gnattools +maybe-install-gnattools: install-gnattools + +install-gnattools: installdirs + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/gnattools && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif gnattools + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-gnattools info-gnattools +maybe-info-gnattools: +@if gnattools +maybe-info-gnattools: info-gnattools + +info-gnattools: \ + configure-gnattools + @: $(MAKE); $(unstage) + @[ -f ./gnattools/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in gnattools" ; \ + (cd $(HOST_SUBDIR)/gnattools && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif gnattools + +.PHONY: maybe-dvi-gnattools dvi-gnattools +maybe-dvi-gnattools: +@if gnattools +maybe-dvi-gnattools: dvi-gnattools + +dvi-gnattools: \ + configure-gnattools + @: $(MAKE); $(unstage) + @[ -f ./gnattools/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in gnattools" ; \ + (cd $(HOST_SUBDIR)/gnattools && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif gnattools + +.PHONY: maybe-html-gnattools html-gnattools +maybe-html-gnattools: +@if gnattools +maybe-html-gnattools: html-gnattools + +html-gnattools: \ + configure-gnattools + @: $(MAKE); $(unstage) + @[ -f ./gnattools/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in gnattools" ; \ + (cd $(HOST_SUBDIR)/gnattools && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif gnattools + +.PHONY: maybe-TAGS-gnattools TAGS-gnattools +maybe-TAGS-gnattools: +@if gnattools +maybe-TAGS-gnattools: TAGS-gnattools + +TAGS-gnattools: \ + configure-gnattools + @: $(MAKE); $(unstage) + @[ -f ./gnattools/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in gnattools" ; \ + (cd $(HOST_SUBDIR)/gnattools && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif gnattools + +.PHONY: maybe-install-info-gnattools install-info-gnattools +maybe-install-info-gnattools: +@if gnattools +maybe-install-info-gnattools: install-info-gnattools + +install-info-gnattools: \ + configure-gnattools \ + info-gnattools + @: $(MAKE); $(unstage) + @[ -f ./gnattools/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in gnattools" ; \ + (cd $(HOST_SUBDIR)/gnattools && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif gnattools + +.PHONY: maybe-install-html-gnattools install-html-gnattools +maybe-install-html-gnattools: +@if gnattools +maybe-install-html-gnattools: install-html-gnattools + +install-html-gnattools: \ + configure-gnattools \ + html-gnattools + @: $(MAKE); $(unstage) + @[ -f ./gnattools/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in gnattools" ; \ + (cd $(HOST_SUBDIR)/gnattools && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif gnattools + +.PHONY: maybe-installcheck-gnattools installcheck-gnattools +maybe-installcheck-gnattools: +@if gnattools +maybe-installcheck-gnattools: installcheck-gnattools + +installcheck-gnattools: \ + configure-gnattools + @: $(MAKE); $(unstage) + @[ -f ./gnattools/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in gnattools" ; \ + (cd $(HOST_SUBDIR)/gnattools && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif gnattools + +.PHONY: maybe-mostlyclean-gnattools mostlyclean-gnattools +maybe-mostlyclean-gnattools: +@if gnattools +maybe-mostlyclean-gnattools: mostlyclean-gnattools + +mostlyclean-gnattools: + @: $(MAKE); $(unstage) + @[ -f ./gnattools/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in gnattools" ; \ + (cd $(HOST_SUBDIR)/gnattools && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif gnattools + +.PHONY: maybe-clean-gnattools clean-gnattools +maybe-clean-gnattools: +@if gnattools +maybe-clean-gnattools: clean-gnattools + +clean-gnattools: + @: $(MAKE); $(unstage) + @[ -f ./gnattools/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in gnattools" ; \ + (cd $(HOST_SUBDIR)/gnattools && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif gnattools + +.PHONY: maybe-distclean-gnattools distclean-gnattools +maybe-distclean-gnattools: +@if gnattools +maybe-distclean-gnattools: distclean-gnattools + +distclean-gnattools: + @: $(MAKE); $(unstage) + @[ -f ./gnattools/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in gnattools" ; \ + (cd $(HOST_SUBDIR)/gnattools && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif gnattools + +.PHONY: maybe-maintainer-clean-gnattools maintainer-clean-gnattools +maybe-maintainer-clean-gnattools: +@if gnattools +maybe-maintainer-clean-gnattools: maintainer-clean-gnattools + +maintainer-clean-gnattools: + @: $(MAKE); $(unstage) + @[ -f ./gnattools/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in gnattools" ; \ + (cd $(HOST_SUBDIR)/gnattools && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif gnattools @@ -22216,1394 +31071,7925 @@ install-utils: installdirs # Modules which run on the target machine # --------------------------------------- + + + .PHONY: configure-target-libstdc++-v3 maybe-configure-target-libstdc++-v3 maybe-configure-target-libstdc++-v3: - -# There's only one multilib.out. Cleverer subdirs shouldn't need it copied. -$(TARGET_SUBDIR)/libstdc++-v3/multilib.out: multilib.out - $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libstdc++-v3 ; \ - rm -f $(TARGET_SUBDIR)/libstdc++-v3/Makefile || : ; \ - cp multilib.out $(TARGET_SUBDIR)/libstdc++-v3/multilib.out - -configure-target-libstdc++-v3: $(TARGET_SUBDIR)/libstdc++-v3/multilib.out - @test ! -f $(TARGET_SUBDIR)/libstdc++-v3/Makefile || exit 0; \ - $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libstdc++-v3 ; \ - r=`${PWD_COMMAND}`; export r; \ +@if target-libstdc++-v3 +maybe-configure-target-libstdc++-v3: configure-target-libstdc++-v3 +configure-target-libstdc++-v3: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - AR="$(AR_FOR_TARGET)"; export AR; \ - AS="$(AS_FOR_TARGET)"; export AS; \ - CC="$(CC_FOR_TARGET)"; export CC; \ - CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \ - CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \ - CXX="$(RAW_CXX_FOR_TARGET)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \ - GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \ - DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \ - LD="$(LD_FOR_TARGET)"; export LD; \ - LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \ - NM="$(NM_FOR_TARGET)"; export NM; \ - RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \ - WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \ + echo "Checking multilib configuration for libstdc++-v3..."; \ + $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libstdc++-v3 ; \ + $(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/libstdc++-v3/multilib.tmp 2> /dev/null ; \ + if test -r $(TARGET_SUBDIR)/libstdc++-v3/multilib.out; then \ + if cmp -s $(TARGET_SUBDIR)/libstdc++-v3/multilib.tmp $(TARGET_SUBDIR)/libstdc++-v3/multilib.out; then \ + rm -f $(TARGET_SUBDIR)/libstdc++-v3/multilib.tmp; \ + else \ + rm -f $(TARGET_SUBDIR)/libstdc++-v3/Makefile; \ + mv $(TARGET_SUBDIR)/libstdc++-v3/multilib.tmp $(TARGET_SUBDIR)/libstdc++-v3/multilib.out; \ + fi; \ + else \ + mv $(TARGET_SUBDIR)/libstdc++-v3/multilib.tmp $(TARGET_SUBDIR)/libstdc++-v3/multilib.out; \ + fi; \ + test ! -f $(TARGET_SUBDIR)/libstdc++-v3/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libstdc++-v3 ; \ + $(RAW_CXX_TARGET_EXPORTS) \ echo Configuring in $(TARGET_SUBDIR)/libstdc++-v3; \ cd "$(TARGET_SUBDIR)/libstdc++-v3" || exit 1; \ case $(srcdir) in \ - /* | [A-Za-z]:[\\/]*) \ - topdir=$(srcdir) ;; \ - *) \ - case "$(TARGET_SUBDIR)" in \ - .) topdir="../$(srcdir)" ;; \ - *) topdir="../../$(srcdir)" ;; \ - esac ;; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(TARGET_SUBDIR)/libstdc++-v3/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ - srcdiroption="--srcdir=$${topdir}/libstdc++-v3"; \ - libsrcdir="$$s/libstdc++-v3"; \ + srcdiroption="--srcdir=$${topdir}/libstdc++-v3"; \ + libsrcdir="$$s/libstdc++-v3"; \ rm -f no-such-file || : ; \ CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \ - $(TARGET_CONFIGARGS) $${srcdiroption} \ - --with-target-subdir="$(TARGET_SUBDIR)" \ + $(TARGET_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif target-libstdc++-v3 + + + + .PHONY: all-target-libstdc++-v3 maybe-all-target-libstdc++-v3 maybe-all-target-libstdc++-v3: +@if target-libstdc++-v3 +TARGET-target-libstdc++-v3=all +maybe-all-target-libstdc++-v3: all-target-libstdc++-v3 all-target-libstdc++-v3: configure-target-libstdc++-v3 + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(RAW_CXX_TARGET_EXPORTS) \ (cd $(TARGET_SUBDIR)/libstdc++-v3 && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)' all) + $(MAKE) $(TARGET_FLAGS_TO_PASS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)' $(TARGET-target-libstdc++-v3)) +@endif target-libstdc++-v3 + + + + .PHONY: check-target-libstdc++-v3 maybe-check-target-libstdc++-v3 maybe-check-target-libstdc++-v3: +@if target-libstdc++-v3 +maybe-check-target-libstdc++-v3: check-target-libstdc++-v3 check-target-libstdc++-v3: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(RAW_CXX_TARGET_EXPORTS) \ (cd $(TARGET_SUBDIR)/libstdc++-v3 && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)' check) + $(MAKE) $(TARGET_FLAGS_TO_PASS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)' check) +@endif target-libstdc++-v3 .PHONY: install-target-libstdc++-v3 maybe-install-target-libstdc++-v3 maybe-install-target-libstdc++-v3: +@if target-libstdc++-v3 +maybe-install-target-libstdc++-v3: install-target-libstdc++-v3 install-target-libstdc++-v3: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(RAW_CXX_TARGET_EXPORTS) \ (cd $(TARGET_SUBDIR)/libstdc++-v3 && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) install) + $(MAKE) $(TARGET_FLAGS_TO_PASS) install) + +@endif target-libstdc++-v3 + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-target-libstdc++-v3 info-target-libstdc++-v3 +maybe-info-target-libstdc++-v3: +@if target-libstdc++-v3 +maybe-info-target-libstdc++-v3: info-target-libstdc++-v3 + +info-target-libstdc++-v3: \ + configure-target-libstdc++-v3 + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libstdc++-v3/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(RAW_CXX_TARGET_EXPORTS) \ + echo "Doing info in $(TARGET_SUBDIR)/libstdc++-v3" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libstdc++-v3 && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif target-libstdc++-v3 + +.PHONY: maybe-dvi-target-libstdc++-v3 dvi-target-libstdc++-v3 +maybe-dvi-target-libstdc++-v3: +@if target-libstdc++-v3 +maybe-dvi-target-libstdc++-v3: dvi-target-libstdc++-v3 + +dvi-target-libstdc++-v3: \ + configure-target-libstdc++-v3 + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libstdc++-v3/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(RAW_CXX_TARGET_EXPORTS) \ + echo "Doing dvi in $(TARGET_SUBDIR)/libstdc++-v3" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libstdc++-v3 && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif target-libstdc++-v3 + +.PHONY: maybe-html-target-libstdc++-v3 html-target-libstdc++-v3 +maybe-html-target-libstdc++-v3: +@if target-libstdc++-v3 +maybe-html-target-libstdc++-v3: html-target-libstdc++-v3 + +html-target-libstdc++-v3: \ + configure-target-libstdc++-v3 + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libstdc++-v3/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(RAW_CXX_TARGET_EXPORTS) \ + echo "Doing html in $(TARGET_SUBDIR)/libstdc++-v3" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libstdc++-v3 && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif target-libstdc++-v3 + +.PHONY: maybe-TAGS-target-libstdc++-v3 TAGS-target-libstdc++-v3 +maybe-TAGS-target-libstdc++-v3: +@if target-libstdc++-v3 +maybe-TAGS-target-libstdc++-v3: TAGS-target-libstdc++-v3 + +TAGS-target-libstdc++-v3: \ + configure-target-libstdc++-v3 + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libstdc++-v3/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(RAW_CXX_TARGET_EXPORTS) \ + echo "Doing TAGS in $(TARGET_SUBDIR)/libstdc++-v3" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libstdc++-v3 && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif target-libstdc++-v3 + +.PHONY: maybe-install-info-target-libstdc++-v3 install-info-target-libstdc++-v3 +maybe-install-info-target-libstdc++-v3: +@if target-libstdc++-v3 +maybe-install-info-target-libstdc++-v3: install-info-target-libstdc++-v3 + +install-info-target-libstdc++-v3: \ + configure-target-libstdc++-v3 \ + info-target-libstdc++-v3 + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libstdc++-v3/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(RAW_CXX_TARGET_EXPORTS) \ + echo "Doing install-info in $(TARGET_SUBDIR)/libstdc++-v3" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libstdc++-v3 && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif target-libstdc++-v3 + +.PHONY: maybe-install-html-target-libstdc++-v3 install-html-target-libstdc++-v3 +maybe-install-html-target-libstdc++-v3: +@if target-libstdc++-v3 +maybe-install-html-target-libstdc++-v3: install-html-target-libstdc++-v3 + +install-html-target-libstdc++-v3: \ + configure-target-libstdc++-v3 \ + html-target-libstdc++-v3 + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libstdc++-v3/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(RAW_CXX_TARGET_EXPORTS) \ + echo "Doing install-html in $(TARGET_SUBDIR)/libstdc++-v3" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libstdc++-v3 && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif target-libstdc++-v3 + +.PHONY: maybe-installcheck-target-libstdc++-v3 installcheck-target-libstdc++-v3 +maybe-installcheck-target-libstdc++-v3: +@if target-libstdc++-v3 +maybe-installcheck-target-libstdc++-v3: installcheck-target-libstdc++-v3 + +installcheck-target-libstdc++-v3: \ + configure-target-libstdc++-v3 + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libstdc++-v3/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(RAW_CXX_TARGET_EXPORTS) \ + echo "Doing installcheck in $(TARGET_SUBDIR)/libstdc++-v3" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libstdc++-v3 && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif target-libstdc++-v3 + +.PHONY: maybe-mostlyclean-target-libstdc++-v3 mostlyclean-target-libstdc++-v3 +maybe-mostlyclean-target-libstdc++-v3: +@if target-libstdc++-v3 +maybe-mostlyclean-target-libstdc++-v3: mostlyclean-target-libstdc++-v3 + +mostlyclean-target-libstdc++-v3: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libstdc++-v3/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(RAW_CXX_TARGET_EXPORTS) \ + echo "Doing mostlyclean in $(TARGET_SUBDIR)/libstdc++-v3" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libstdc++-v3 && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif target-libstdc++-v3 + +.PHONY: maybe-clean-target-libstdc++-v3 clean-target-libstdc++-v3 +maybe-clean-target-libstdc++-v3: +@if target-libstdc++-v3 +maybe-clean-target-libstdc++-v3: clean-target-libstdc++-v3 + +clean-target-libstdc++-v3: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libstdc++-v3/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(RAW_CXX_TARGET_EXPORTS) \ + echo "Doing clean in $(TARGET_SUBDIR)/libstdc++-v3" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libstdc++-v3 && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif target-libstdc++-v3 + +.PHONY: maybe-distclean-target-libstdc++-v3 distclean-target-libstdc++-v3 +maybe-distclean-target-libstdc++-v3: +@if target-libstdc++-v3 +maybe-distclean-target-libstdc++-v3: distclean-target-libstdc++-v3 + +distclean-target-libstdc++-v3: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libstdc++-v3/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(RAW_CXX_TARGET_EXPORTS) \ + echo "Doing distclean in $(TARGET_SUBDIR)/libstdc++-v3" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libstdc++-v3 && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif target-libstdc++-v3 + +.PHONY: maybe-maintainer-clean-target-libstdc++-v3 maintainer-clean-target-libstdc++-v3 +maybe-maintainer-clean-target-libstdc++-v3: +@if target-libstdc++-v3 +maybe-maintainer-clean-target-libstdc++-v3: maintainer-clean-target-libstdc++-v3 + +maintainer-clean-target-libstdc++-v3: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libstdc++-v3/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(RAW_CXX_TARGET_EXPORTS) \ + echo "Doing maintainer-clean in $(TARGET_SUBDIR)/libstdc++-v3" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libstdc++-v3 && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif target-libstdc++-v3 + + + + + +.PHONY: configure-target-libmudflap maybe-configure-target-libmudflap +maybe-configure-target-libmudflap: +@if target-libmudflap +maybe-configure-target-libmudflap: configure-target-libmudflap +configure-target-libmudflap: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + echo "Checking multilib configuration for libmudflap..."; \ + $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libmudflap ; \ + $(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/libmudflap/multilib.tmp 2> /dev/null ; \ + if test -r $(TARGET_SUBDIR)/libmudflap/multilib.out; then \ + if cmp -s $(TARGET_SUBDIR)/libmudflap/multilib.tmp $(TARGET_SUBDIR)/libmudflap/multilib.out; then \ + rm -f $(TARGET_SUBDIR)/libmudflap/multilib.tmp; \ + else \ + rm -f $(TARGET_SUBDIR)/libmudflap/Makefile; \ + mv $(TARGET_SUBDIR)/libmudflap/multilib.tmp $(TARGET_SUBDIR)/libmudflap/multilib.out; \ + fi; \ + else \ + mv $(TARGET_SUBDIR)/libmudflap/multilib.tmp $(TARGET_SUBDIR)/libmudflap/multilib.out; \ + fi; \ + test ! -f $(TARGET_SUBDIR)/libmudflap/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libmudflap ; \ + $(NORMAL_TARGET_EXPORTS) \ + echo Configuring in $(TARGET_SUBDIR)/libmudflap; \ + cd "$(TARGET_SUBDIR)/libmudflap" || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(TARGET_SUBDIR)/libmudflap/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/libmudflap"; \ + libsrcdir="$$s/libmudflap"; \ + rm -f no-such-file || : ; \ + CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \ + $(TARGET_CONFIGARGS) $${srcdiroption} \ + || exit 1 +@endif target-libmudflap + + + + + +.PHONY: all-target-libmudflap maybe-all-target-libmudflap +maybe-all-target-libmudflap: +@if target-libmudflap +TARGET-target-libmudflap=all +maybe-all-target-libmudflap: all-target-libmudflap +all-target-libmudflap: configure-target-libmudflap + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + (cd $(TARGET_SUBDIR)/libmudflap && \ + $(MAKE) $(TARGET_FLAGS_TO_PASS) $(TARGET-target-libmudflap)) +@endif target-libmudflap + + + + + +.PHONY: check-target-libmudflap maybe-check-target-libmudflap +maybe-check-target-libmudflap: +@if target-libmudflap +maybe-check-target-libmudflap: check-target-libmudflap + +check-target-libmudflap: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + (cd $(TARGET_SUBDIR)/libmudflap && \ + $(MAKE) $(TARGET_FLAGS_TO_PASS) check) + +@endif target-libmudflap + +.PHONY: install-target-libmudflap maybe-install-target-libmudflap +maybe-install-target-libmudflap: +@if target-libmudflap +maybe-install-target-libmudflap: install-target-libmudflap + +install-target-libmudflap: installdirs + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + (cd $(TARGET_SUBDIR)/libmudflap && \ + $(MAKE) $(TARGET_FLAGS_TO_PASS) install) + +@endif target-libmudflap + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-target-libmudflap info-target-libmudflap +maybe-info-target-libmudflap: +@if target-libmudflap +maybe-info-target-libmudflap: info-target-libmudflap + +info-target-libmudflap: \ + configure-target-libmudflap + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libmudflap/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing info in $(TARGET_SUBDIR)/libmudflap" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libmudflap && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif target-libmudflap + +.PHONY: maybe-dvi-target-libmudflap dvi-target-libmudflap +maybe-dvi-target-libmudflap: +@if target-libmudflap +maybe-dvi-target-libmudflap: dvi-target-libmudflap + +dvi-target-libmudflap: \ + configure-target-libmudflap + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libmudflap/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing dvi in $(TARGET_SUBDIR)/libmudflap" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libmudflap && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif target-libmudflap + +.PHONY: maybe-html-target-libmudflap html-target-libmudflap +maybe-html-target-libmudflap: +@if target-libmudflap +maybe-html-target-libmudflap: html-target-libmudflap + +html-target-libmudflap: \ + configure-target-libmudflap + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libmudflap/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing html in $(TARGET_SUBDIR)/libmudflap" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libmudflap && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif target-libmudflap + +.PHONY: maybe-TAGS-target-libmudflap TAGS-target-libmudflap +maybe-TAGS-target-libmudflap: +@if target-libmudflap +maybe-TAGS-target-libmudflap: TAGS-target-libmudflap + +TAGS-target-libmudflap: \ + configure-target-libmudflap + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libmudflap/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing TAGS in $(TARGET_SUBDIR)/libmudflap" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libmudflap && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif target-libmudflap + +.PHONY: maybe-install-info-target-libmudflap install-info-target-libmudflap +maybe-install-info-target-libmudflap: +@if target-libmudflap +maybe-install-info-target-libmudflap: install-info-target-libmudflap + +install-info-target-libmudflap: \ + configure-target-libmudflap \ + info-target-libmudflap + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libmudflap/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-info in $(TARGET_SUBDIR)/libmudflap" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libmudflap && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif target-libmudflap + +.PHONY: maybe-install-html-target-libmudflap install-html-target-libmudflap +maybe-install-html-target-libmudflap: +@if target-libmudflap +maybe-install-html-target-libmudflap: install-html-target-libmudflap + +install-html-target-libmudflap: \ + configure-target-libmudflap \ + html-target-libmudflap + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libmudflap/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-html in $(TARGET_SUBDIR)/libmudflap" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libmudflap && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif target-libmudflap + +.PHONY: maybe-installcheck-target-libmudflap installcheck-target-libmudflap +maybe-installcheck-target-libmudflap: +@if target-libmudflap +maybe-installcheck-target-libmudflap: installcheck-target-libmudflap + +installcheck-target-libmudflap: \ + configure-target-libmudflap + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libmudflap/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing installcheck in $(TARGET_SUBDIR)/libmudflap" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libmudflap && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif target-libmudflap + +.PHONY: maybe-mostlyclean-target-libmudflap mostlyclean-target-libmudflap +maybe-mostlyclean-target-libmudflap: +@if target-libmudflap +maybe-mostlyclean-target-libmudflap: mostlyclean-target-libmudflap + +mostlyclean-target-libmudflap: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libmudflap/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing mostlyclean in $(TARGET_SUBDIR)/libmudflap" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libmudflap && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif target-libmudflap + +.PHONY: maybe-clean-target-libmudflap clean-target-libmudflap +maybe-clean-target-libmudflap: +@if target-libmudflap +maybe-clean-target-libmudflap: clean-target-libmudflap + +clean-target-libmudflap: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libmudflap/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing clean in $(TARGET_SUBDIR)/libmudflap" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libmudflap && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif target-libmudflap + +.PHONY: maybe-distclean-target-libmudflap distclean-target-libmudflap +maybe-distclean-target-libmudflap: +@if target-libmudflap +maybe-distclean-target-libmudflap: distclean-target-libmudflap + +distclean-target-libmudflap: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libmudflap/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing distclean in $(TARGET_SUBDIR)/libmudflap" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libmudflap && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif target-libmudflap + +.PHONY: maybe-maintainer-clean-target-libmudflap maintainer-clean-target-libmudflap +maybe-maintainer-clean-target-libmudflap: +@if target-libmudflap +maybe-maintainer-clean-target-libmudflap: maintainer-clean-target-libmudflap + +maintainer-clean-target-libmudflap: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libmudflap/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing maintainer-clean in $(TARGET_SUBDIR)/libmudflap" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libmudflap && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif target-libmudflap + + + + + +.PHONY: configure-target-libssp maybe-configure-target-libssp +maybe-configure-target-libssp: +@if target-libssp +maybe-configure-target-libssp: configure-target-libssp +configure-target-libssp: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + echo "Checking multilib configuration for libssp..."; \ + $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libssp ; \ + $(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/libssp/multilib.tmp 2> /dev/null ; \ + if test -r $(TARGET_SUBDIR)/libssp/multilib.out; then \ + if cmp -s $(TARGET_SUBDIR)/libssp/multilib.tmp $(TARGET_SUBDIR)/libssp/multilib.out; then \ + rm -f $(TARGET_SUBDIR)/libssp/multilib.tmp; \ + else \ + rm -f $(TARGET_SUBDIR)/libssp/Makefile; \ + mv $(TARGET_SUBDIR)/libssp/multilib.tmp $(TARGET_SUBDIR)/libssp/multilib.out; \ + fi; \ + else \ + mv $(TARGET_SUBDIR)/libssp/multilib.tmp $(TARGET_SUBDIR)/libssp/multilib.out; \ + fi; \ + test ! -f $(TARGET_SUBDIR)/libssp/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libssp ; \ + $(NORMAL_TARGET_EXPORTS) \ + echo Configuring in $(TARGET_SUBDIR)/libssp; \ + cd "$(TARGET_SUBDIR)/libssp" || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(TARGET_SUBDIR)/libssp/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/libssp"; \ + libsrcdir="$$s/libssp"; \ + rm -f no-such-file || : ; \ + CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \ + $(TARGET_CONFIGARGS) $${srcdiroption} \ + || exit 1 +@endif target-libssp + + + + + +.PHONY: all-target-libssp maybe-all-target-libssp +maybe-all-target-libssp: +@if target-libssp +TARGET-target-libssp=all +maybe-all-target-libssp: all-target-libssp +all-target-libssp: configure-target-libssp + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + (cd $(TARGET_SUBDIR)/libssp && \ + $(MAKE) $(TARGET_FLAGS_TO_PASS) $(TARGET-target-libssp)) +@endif target-libssp + + + + + +.PHONY: check-target-libssp maybe-check-target-libssp +maybe-check-target-libssp: +@if target-libssp +maybe-check-target-libssp: check-target-libssp + +check-target-libssp: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + (cd $(TARGET_SUBDIR)/libssp && \ + $(MAKE) $(TARGET_FLAGS_TO_PASS) check) + +@endif target-libssp + +.PHONY: install-target-libssp maybe-install-target-libssp +maybe-install-target-libssp: +@if target-libssp +maybe-install-target-libssp: install-target-libssp + +install-target-libssp: installdirs + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + (cd $(TARGET_SUBDIR)/libssp && \ + $(MAKE) $(TARGET_FLAGS_TO_PASS) install) + +@endif target-libssp + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-target-libssp info-target-libssp +maybe-info-target-libssp: +@if target-libssp +maybe-info-target-libssp: info-target-libssp + +info-target-libssp: \ + configure-target-libssp + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libssp/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing info in $(TARGET_SUBDIR)/libssp" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libssp && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif target-libssp + +.PHONY: maybe-dvi-target-libssp dvi-target-libssp +maybe-dvi-target-libssp: +@if target-libssp +maybe-dvi-target-libssp: dvi-target-libssp + +dvi-target-libssp: \ + configure-target-libssp + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libssp/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing dvi in $(TARGET_SUBDIR)/libssp" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libssp && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif target-libssp + +.PHONY: maybe-html-target-libssp html-target-libssp +maybe-html-target-libssp: +@if target-libssp +maybe-html-target-libssp: html-target-libssp + +html-target-libssp: \ + configure-target-libssp + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libssp/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing html in $(TARGET_SUBDIR)/libssp" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libssp && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif target-libssp + +.PHONY: maybe-TAGS-target-libssp TAGS-target-libssp +maybe-TAGS-target-libssp: +@if target-libssp +maybe-TAGS-target-libssp: TAGS-target-libssp + +TAGS-target-libssp: \ + configure-target-libssp + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libssp/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing TAGS in $(TARGET_SUBDIR)/libssp" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libssp && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif target-libssp + +.PHONY: maybe-install-info-target-libssp install-info-target-libssp +maybe-install-info-target-libssp: +@if target-libssp +maybe-install-info-target-libssp: install-info-target-libssp + +install-info-target-libssp: \ + configure-target-libssp \ + info-target-libssp + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libssp/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-info in $(TARGET_SUBDIR)/libssp" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libssp && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif target-libssp + +.PHONY: maybe-install-html-target-libssp install-html-target-libssp +maybe-install-html-target-libssp: +@if target-libssp +maybe-install-html-target-libssp: install-html-target-libssp + +install-html-target-libssp: \ + configure-target-libssp \ + html-target-libssp + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libssp/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-html in $(TARGET_SUBDIR)/libssp" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libssp && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif target-libssp + +.PHONY: maybe-installcheck-target-libssp installcheck-target-libssp +maybe-installcheck-target-libssp: +@if target-libssp +maybe-installcheck-target-libssp: installcheck-target-libssp + +installcheck-target-libssp: \ + configure-target-libssp + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libssp/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing installcheck in $(TARGET_SUBDIR)/libssp" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libssp && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif target-libssp + +.PHONY: maybe-mostlyclean-target-libssp mostlyclean-target-libssp +maybe-mostlyclean-target-libssp: +@if target-libssp +maybe-mostlyclean-target-libssp: mostlyclean-target-libssp + +mostlyclean-target-libssp: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libssp/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing mostlyclean in $(TARGET_SUBDIR)/libssp" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libssp && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif target-libssp + +.PHONY: maybe-clean-target-libssp clean-target-libssp +maybe-clean-target-libssp: +@if target-libssp +maybe-clean-target-libssp: clean-target-libssp + +clean-target-libssp: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libssp/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing clean in $(TARGET_SUBDIR)/libssp" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libssp && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif target-libssp + +.PHONY: maybe-distclean-target-libssp distclean-target-libssp +maybe-distclean-target-libssp: +@if target-libssp +maybe-distclean-target-libssp: distclean-target-libssp + +distclean-target-libssp: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libssp/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing distclean in $(TARGET_SUBDIR)/libssp" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libssp && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif target-libssp + +.PHONY: maybe-maintainer-clean-target-libssp maintainer-clean-target-libssp +maybe-maintainer-clean-target-libssp: +@if target-libssp +maybe-maintainer-clean-target-libssp: maintainer-clean-target-libssp + +maintainer-clean-target-libssp: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libssp/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing maintainer-clean in $(TARGET_SUBDIR)/libssp" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libssp && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif target-libssp + + + + + +.PHONY: configure-target-libgcc-math maybe-configure-target-libgcc-math +maybe-configure-target-libgcc-math: +@if target-libgcc-math +maybe-configure-target-libgcc-math: configure-target-libgcc-math +configure-target-libgcc-math: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + echo "Checking multilib configuration for libgcc-math..."; \ + $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libgcc-math ; \ + $(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/libgcc-math/multilib.tmp 2> /dev/null ; \ + if test -r $(TARGET_SUBDIR)/libgcc-math/multilib.out; then \ + if cmp -s $(TARGET_SUBDIR)/libgcc-math/multilib.tmp $(TARGET_SUBDIR)/libgcc-math/multilib.out; then \ + rm -f $(TARGET_SUBDIR)/libgcc-math/multilib.tmp; \ + else \ + rm -f $(TARGET_SUBDIR)/libgcc-math/Makefile; \ + mv $(TARGET_SUBDIR)/libgcc-math/multilib.tmp $(TARGET_SUBDIR)/libgcc-math/multilib.out; \ + fi; \ + else \ + mv $(TARGET_SUBDIR)/libgcc-math/multilib.tmp $(TARGET_SUBDIR)/libgcc-math/multilib.out; \ + fi; \ + test ! -f $(TARGET_SUBDIR)/libgcc-math/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libgcc-math ; \ + $(NORMAL_TARGET_EXPORTS) \ + echo Configuring in $(TARGET_SUBDIR)/libgcc-math; \ + cd "$(TARGET_SUBDIR)/libgcc-math" || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(TARGET_SUBDIR)/libgcc-math/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/libgcc-math"; \ + libsrcdir="$$s/libgcc-math"; \ + rm -f no-such-file || : ; \ + CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \ + $(TARGET_CONFIGARGS) $${srcdiroption} \ + || exit 1 +@endif target-libgcc-math + + + + + +.PHONY: all-target-libgcc-math maybe-all-target-libgcc-math +maybe-all-target-libgcc-math: +@if target-libgcc-math +TARGET-target-libgcc-math=all +maybe-all-target-libgcc-math: all-target-libgcc-math +all-target-libgcc-math: configure-target-libgcc-math + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + (cd $(TARGET_SUBDIR)/libgcc-math && \ + $(MAKE) $(TARGET_FLAGS_TO_PASS) $(TARGET-target-libgcc-math)) +@endif target-libgcc-math + + + + + +.PHONY: check-target-libgcc-math maybe-check-target-libgcc-math +maybe-check-target-libgcc-math: +@if target-libgcc-math +maybe-check-target-libgcc-math: check-target-libgcc-math + +check-target-libgcc-math: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + (cd $(TARGET_SUBDIR)/libgcc-math && \ + $(MAKE) $(TARGET_FLAGS_TO_PASS) check) + +@endif target-libgcc-math + +.PHONY: install-target-libgcc-math maybe-install-target-libgcc-math +maybe-install-target-libgcc-math: +@if target-libgcc-math +maybe-install-target-libgcc-math: install-target-libgcc-math + +install-target-libgcc-math: installdirs + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + (cd $(TARGET_SUBDIR)/libgcc-math && \ + $(MAKE) $(TARGET_FLAGS_TO_PASS) install) + +@endif target-libgcc-math + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-target-libgcc-math info-target-libgcc-math +maybe-info-target-libgcc-math: +@if target-libgcc-math +maybe-info-target-libgcc-math: info-target-libgcc-math + +info-target-libgcc-math: \ + configure-target-libgcc-math + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgcc-math/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing info in $(TARGET_SUBDIR)/libgcc-math" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgcc-math && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif target-libgcc-math + +.PHONY: maybe-dvi-target-libgcc-math dvi-target-libgcc-math +maybe-dvi-target-libgcc-math: +@if target-libgcc-math +maybe-dvi-target-libgcc-math: dvi-target-libgcc-math + +dvi-target-libgcc-math: \ + configure-target-libgcc-math + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgcc-math/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing dvi in $(TARGET_SUBDIR)/libgcc-math" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgcc-math && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif target-libgcc-math + +.PHONY: maybe-html-target-libgcc-math html-target-libgcc-math +maybe-html-target-libgcc-math: +@if target-libgcc-math +maybe-html-target-libgcc-math: html-target-libgcc-math + +html-target-libgcc-math: \ + configure-target-libgcc-math + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgcc-math/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing html in $(TARGET_SUBDIR)/libgcc-math" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgcc-math && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif target-libgcc-math + +.PHONY: maybe-TAGS-target-libgcc-math TAGS-target-libgcc-math +maybe-TAGS-target-libgcc-math: +@if target-libgcc-math +maybe-TAGS-target-libgcc-math: TAGS-target-libgcc-math + +TAGS-target-libgcc-math: \ + configure-target-libgcc-math + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgcc-math/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing TAGS in $(TARGET_SUBDIR)/libgcc-math" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgcc-math && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif target-libgcc-math + +.PHONY: maybe-install-info-target-libgcc-math install-info-target-libgcc-math +maybe-install-info-target-libgcc-math: +@if target-libgcc-math +maybe-install-info-target-libgcc-math: install-info-target-libgcc-math + +install-info-target-libgcc-math: \ + configure-target-libgcc-math \ + info-target-libgcc-math + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgcc-math/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-info in $(TARGET_SUBDIR)/libgcc-math" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgcc-math && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif target-libgcc-math + +.PHONY: maybe-install-html-target-libgcc-math install-html-target-libgcc-math +maybe-install-html-target-libgcc-math: +@if target-libgcc-math +maybe-install-html-target-libgcc-math: install-html-target-libgcc-math + +install-html-target-libgcc-math: \ + configure-target-libgcc-math \ + html-target-libgcc-math + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgcc-math/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-html in $(TARGET_SUBDIR)/libgcc-math" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgcc-math && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif target-libgcc-math + +.PHONY: maybe-installcheck-target-libgcc-math installcheck-target-libgcc-math +maybe-installcheck-target-libgcc-math: +@if target-libgcc-math +maybe-installcheck-target-libgcc-math: installcheck-target-libgcc-math + +installcheck-target-libgcc-math: \ + configure-target-libgcc-math + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgcc-math/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing installcheck in $(TARGET_SUBDIR)/libgcc-math" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgcc-math && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif target-libgcc-math + +.PHONY: maybe-mostlyclean-target-libgcc-math mostlyclean-target-libgcc-math +maybe-mostlyclean-target-libgcc-math: +@if target-libgcc-math +maybe-mostlyclean-target-libgcc-math: mostlyclean-target-libgcc-math + +mostlyclean-target-libgcc-math: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgcc-math/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing mostlyclean in $(TARGET_SUBDIR)/libgcc-math" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgcc-math && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif target-libgcc-math + +.PHONY: maybe-clean-target-libgcc-math clean-target-libgcc-math +maybe-clean-target-libgcc-math: +@if target-libgcc-math +maybe-clean-target-libgcc-math: clean-target-libgcc-math + +clean-target-libgcc-math: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgcc-math/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing clean in $(TARGET_SUBDIR)/libgcc-math" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgcc-math && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif target-libgcc-math + +.PHONY: maybe-distclean-target-libgcc-math distclean-target-libgcc-math +maybe-distclean-target-libgcc-math: +@if target-libgcc-math +maybe-distclean-target-libgcc-math: distclean-target-libgcc-math + +distclean-target-libgcc-math: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgcc-math/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing distclean in $(TARGET_SUBDIR)/libgcc-math" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgcc-math && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif target-libgcc-math + +.PHONY: maybe-maintainer-clean-target-libgcc-math maintainer-clean-target-libgcc-math +maybe-maintainer-clean-target-libgcc-math: +@if target-libgcc-math +maybe-maintainer-clean-target-libgcc-math: maintainer-clean-target-libgcc-math + +maintainer-clean-target-libgcc-math: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgcc-math/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing maintainer-clean in $(TARGET_SUBDIR)/libgcc-math" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgcc-math && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif target-libgcc-math + + + .PHONY: configure-target-newlib maybe-configure-target-newlib maybe-configure-target-newlib: - -# There's only one multilib.out. Cleverer subdirs shouldn't need it copied. -$(TARGET_SUBDIR)/newlib/multilib.out: multilib.out - $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/newlib ; \ - rm -f $(TARGET_SUBDIR)/newlib/Makefile || : ; \ - cp multilib.out $(TARGET_SUBDIR)/newlib/multilib.out - -configure-target-newlib: $(TARGET_SUBDIR)/newlib/multilib.out - @test ! -f $(TARGET_SUBDIR)/newlib/Makefile || exit 0; \ - $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/newlib ; \ - r=`${PWD_COMMAND}`; export r; \ +@if target-newlib +maybe-configure-target-newlib: configure-target-newlib +configure-target-newlib: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - AR="$(AR_FOR_TARGET)"; export AR; \ - AS="$(AS_FOR_TARGET)"; export AS; \ - CC="$(CC_FOR_TARGET)"; export CC; \ - CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \ - CXX="$(CXX_FOR_TARGET)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \ - GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \ - DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \ - LD="$(LD_FOR_TARGET)"; export LD; \ - LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \ - NM="$(NM_FOR_TARGET)"; export NM; \ - RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \ - WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \ + echo "Checking multilib configuration for newlib..."; \ + $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/newlib ; \ + $(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/newlib/multilib.tmp 2> /dev/null ; \ + if test -r $(TARGET_SUBDIR)/newlib/multilib.out; then \ + if cmp -s $(TARGET_SUBDIR)/newlib/multilib.tmp $(TARGET_SUBDIR)/newlib/multilib.out; then \ + rm -f $(TARGET_SUBDIR)/newlib/multilib.tmp; \ + else \ + rm -f $(TARGET_SUBDIR)/newlib/Makefile; \ + mv $(TARGET_SUBDIR)/newlib/multilib.tmp $(TARGET_SUBDIR)/newlib/multilib.out; \ + fi; \ + else \ + mv $(TARGET_SUBDIR)/newlib/multilib.tmp $(TARGET_SUBDIR)/newlib/multilib.out; \ + fi; \ + test ! -f $(TARGET_SUBDIR)/newlib/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/newlib ; \ + $(NORMAL_TARGET_EXPORTS) \ echo Configuring in $(TARGET_SUBDIR)/newlib; \ cd "$(TARGET_SUBDIR)/newlib" || exit 1; \ case $(srcdir) in \ - /* | [A-Za-z]:[\\/]*) \ - topdir=$(srcdir) ;; \ - *) \ - case "$(TARGET_SUBDIR)" in \ - .) topdir="../$(srcdir)" ;; \ - *) topdir="../../$(srcdir)" ;; \ - esac ;; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(TARGET_SUBDIR)/newlib/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ - srcdiroption="--srcdir=$${topdir}/newlib"; \ - libsrcdir="$$s/newlib"; \ + srcdiroption="--srcdir=$${topdir}/newlib"; \ + libsrcdir="$$s/newlib"; \ rm -f no-such-file || : ; \ CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \ - $(TARGET_CONFIGARGS) $${srcdiroption} \ - --with-target-subdir="$(TARGET_SUBDIR)" \ + $(TARGET_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif target-newlib + + + + .PHONY: all-target-newlib maybe-all-target-newlib maybe-all-target-newlib: +@if target-newlib +TARGET-target-newlib=all +maybe-all-target-newlib: all-target-newlib all-target-newlib: configure-target-newlib + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(NORMAL_TARGET_EXPORTS) \ (cd $(TARGET_SUBDIR)/newlib && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) all) + $(MAKE) $(TARGET_FLAGS_TO_PASS) $(TARGET-target-newlib)) +@endif target-newlib + + + + .PHONY: check-target-newlib maybe-check-target-newlib maybe-check-target-newlib: +@if target-newlib +maybe-check-target-newlib: check-target-newlib check-target-newlib: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(NORMAL_TARGET_EXPORTS) \ (cd $(TARGET_SUBDIR)/newlib && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) check) + $(MAKE) $(TARGET_FLAGS_TO_PASS) check) +@endif target-newlib .PHONY: install-target-newlib maybe-install-target-newlib maybe-install-target-newlib: +@if target-newlib +maybe-install-target-newlib: install-target-newlib install-target-newlib: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(NORMAL_TARGET_EXPORTS) \ (cd $(TARGET_SUBDIR)/newlib && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) install) + $(MAKE) $(TARGET_FLAGS_TO_PASS) install) +@endif target-newlib -.PHONY: configure-target-libf2c maybe-configure-target-libf2c -maybe-configure-target-libf2c: +# Other targets (info, dvi, etc.) -# There's only one multilib.out. Cleverer subdirs shouldn't need it copied. -$(TARGET_SUBDIR)/libf2c/multilib.out: multilib.out - $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libf2c ; \ - rm -f $(TARGET_SUBDIR)/libf2c/Makefile || : ; \ - cp multilib.out $(TARGET_SUBDIR)/libf2c/multilib.out +.PHONY: maybe-info-target-newlib info-target-newlib +maybe-info-target-newlib: +@if target-newlib +maybe-info-target-newlib: info-target-newlib -configure-target-libf2c: $(TARGET_SUBDIR)/libf2c/multilib.out - @test ! -f $(TARGET_SUBDIR)/libf2c/Makefile || exit 0; \ - $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libf2c ; \ +info-target-newlib: \ + configure-target-newlib + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/newlib/Makefile ] || exit 0 ; \ r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - AR="$(AR_FOR_TARGET)"; export AR; \ - AS="$(AS_FOR_TARGET)"; export AS; \ - CC="$(CC_FOR_TARGET)"; export CC; \ - CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \ - CXX="$(CXX_FOR_TARGET)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \ - GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \ - DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \ - LD="$(LD_FOR_TARGET)"; export LD; \ - LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \ - NM="$(NM_FOR_TARGET)"; export NM; \ - RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \ - WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \ - echo Configuring in $(TARGET_SUBDIR)/libf2c; \ - cd "$(TARGET_SUBDIR)/libf2c" || exit 1; \ - case $(srcdir) in \ - /* | [A-Za-z]:[\\/]*) \ - topdir=$(srcdir) ;; \ - *) \ - case "$(TARGET_SUBDIR)" in \ - .) topdir="../$(srcdir)" ;; \ - *) topdir="../../$(srcdir)" ;; \ - esac ;; \ - esac; \ - srcdiroption="--srcdir=$${topdir}/libf2c"; \ - libsrcdir="$$s/libf2c"; \ - rm -f no-such-file || : ; \ - CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \ - $(TARGET_CONFIGARGS) $${srcdiroption} \ - --with-target-subdir="$(TARGET_SUBDIR)" \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing info in $(TARGET_SUBDIR)/newlib" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/newlib && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ || exit 1 -.PHONY: all-target-libf2c maybe-all-target-libf2c -maybe-all-target-libf2c: -all-target-libf2c: configure-target-libf2c +@endif target-newlib + +.PHONY: maybe-dvi-target-newlib dvi-target-newlib +maybe-dvi-target-newlib: +@if target-newlib +maybe-dvi-target-newlib: dvi-target-newlib + +dvi-target-newlib: \ + configure-target-newlib + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/newlib/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing dvi in $(TARGET_SUBDIR)/newlib" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/newlib && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif target-newlib + +.PHONY: maybe-html-target-newlib html-target-newlib +maybe-html-target-newlib: +@if target-newlib +maybe-html-target-newlib: html-target-newlib + +html-target-newlib: \ + configure-target-newlib + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/newlib/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing html in $(TARGET_SUBDIR)/newlib" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/newlib && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif target-newlib + +.PHONY: maybe-TAGS-target-newlib TAGS-target-newlib +maybe-TAGS-target-newlib: +@if target-newlib +maybe-TAGS-target-newlib: TAGS-target-newlib + +TAGS-target-newlib: \ + configure-target-newlib + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/newlib/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing TAGS in $(TARGET_SUBDIR)/newlib" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/newlib && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif target-newlib + +.PHONY: maybe-install-info-target-newlib install-info-target-newlib +maybe-install-info-target-newlib: +@if target-newlib +maybe-install-info-target-newlib: install-info-target-newlib + +install-info-target-newlib: \ + configure-target-newlib \ + info-target-newlib + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/newlib/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-info in $(TARGET_SUBDIR)/newlib" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/newlib && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif target-newlib + +.PHONY: maybe-install-html-target-newlib install-html-target-newlib +maybe-install-html-target-newlib: +@if target-newlib +maybe-install-html-target-newlib: install-html-target-newlib + +install-html-target-newlib: \ + configure-target-newlib \ + html-target-newlib + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/newlib/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-html in $(TARGET_SUBDIR)/newlib" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/newlib && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif target-newlib + +.PHONY: maybe-installcheck-target-newlib installcheck-target-newlib +maybe-installcheck-target-newlib: +@if target-newlib +maybe-installcheck-target-newlib: installcheck-target-newlib + +installcheck-target-newlib: \ + configure-target-newlib + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/newlib/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing installcheck in $(TARGET_SUBDIR)/newlib" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/newlib && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif target-newlib + +.PHONY: maybe-mostlyclean-target-newlib mostlyclean-target-newlib +maybe-mostlyclean-target-newlib: +@if target-newlib +maybe-mostlyclean-target-newlib: mostlyclean-target-newlib + +mostlyclean-target-newlib: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/newlib/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing mostlyclean in $(TARGET_SUBDIR)/newlib" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/newlib && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif target-newlib + +.PHONY: maybe-clean-target-newlib clean-target-newlib +maybe-clean-target-newlib: +@if target-newlib +maybe-clean-target-newlib: clean-target-newlib + +clean-target-newlib: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/newlib/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing clean in $(TARGET_SUBDIR)/newlib" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/newlib && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif target-newlib + +.PHONY: maybe-distclean-target-newlib distclean-target-newlib +maybe-distclean-target-newlib: +@if target-newlib +maybe-distclean-target-newlib: distclean-target-newlib + +distclean-target-newlib: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/newlib/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing distclean in $(TARGET_SUBDIR)/newlib" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/newlib && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif target-newlib + +.PHONY: maybe-maintainer-clean-target-newlib maintainer-clean-target-newlib +maybe-maintainer-clean-target-newlib: +@if target-newlib +maybe-maintainer-clean-target-newlib: maintainer-clean-target-newlib + +maintainer-clean-target-newlib: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/newlib/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing maintainer-clean in $(TARGET_SUBDIR)/newlib" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/newlib && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif target-newlib + + + + + +.PHONY: configure-target-libgfortran maybe-configure-target-libgfortran +maybe-configure-target-libgfortran: +@if target-libgfortran +maybe-configure-target-libgfortran: configure-target-libgfortran +configure-target-libgfortran: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd $(TARGET_SUBDIR)/libf2c && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) all) + echo "Checking multilib configuration for libgfortran..."; \ + $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libgfortran ; \ + $(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/libgfortran/multilib.tmp 2> /dev/null ; \ + if test -r $(TARGET_SUBDIR)/libgfortran/multilib.out; then \ + if cmp -s $(TARGET_SUBDIR)/libgfortran/multilib.tmp $(TARGET_SUBDIR)/libgfortran/multilib.out; then \ + rm -f $(TARGET_SUBDIR)/libgfortran/multilib.tmp; \ + else \ + rm -f $(TARGET_SUBDIR)/libgfortran/Makefile; \ + mv $(TARGET_SUBDIR)/libgfortran/multilib.tmp $(TARGET_SUBDIR)/libgfortran/multilib.out; \ + fi; \ + else \ + mv $(TARGET_SUBDIR)/libgfortran/multilib.tmp $(TARGET_SUBDIR)/libgfortran/multilib.out; \ + fi; \ + test ! -f $(TARGET_SUBDIR)/libgfortran/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libgfortran ; \ + $(NORMAL_TARGET_EXPORTS) \ + echo Configuring in $(TARGET_SUBDIR)/libgfortran; \ + cd "$(TARGET_SUBDIR)/libgfortran" || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(TARGET_SUBDIR)/libgfortran/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/libgfortran"; \ + libsrcdir="$$s/libgfortran"; \ + rm -f no-such-file || : ; \ + CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \ + $(TARGET_CONFIGARGS) $${srcdiroption} \ + || exit 1 +@endif target-libgfortran -.PHONY: check-target-libf2c maybe-check-target-libf2c -maybe-check-target-libf2c: -check-target-libf2c: + + + +.PHONY: all-target-libgfortran maybe-all-target-libgfortran +maybe-all-target-libgfortran: +@if target-libgfortran +TARGET-target-libgfortran=all +maybe-all-target-libgfortran: all-target-libgfortran +all-target-libgfortran: configure-target-libgfortran + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd $(TARGET_SUBDIR)/libf2c && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) check) + $(NORMAL_TARGET_EXPORTS) \ + (cd $(TARGET_SUBDIR)/libgfortran && \ + $(MAKE) $(TARGET_FLAGS_TO_PASS) $(TARGET-target-libgfortran)) +@endif target-libgfortran -.PHONY: install-target-libf2c maybe-install-target-libf2c -maybe-install-target-libf2c: -install-target-libf2c: installdirs + + +.PHONY: check-target-libgfortran maybe-check-target-libgfortran +maybe-check-target-libgfortran: +@if target-libgfortran +maybe-check-target-libgfortran: check-target-libgfortran + +check-target-libgfortran: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd $(TARGET_SUBDIR)/libf2c && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) install) + $(NORMAL_TARGET_EXPORTS) \ + (cd $(TARGET_SUBDIR)/libgfortran && \ + $(MAKE) $(TARGET_FLAGS_TO_PASS) check) + +@endif target-libgfortran + +.PHONY: install-target-libgfortran maybe-install-target-libgfortran +maybe-install-target-libgfortran: +@if target-libgfortran +maybe-install-target-libgfortran: install-target-libgfortran + +install-target-libgfortran: installdirs + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + (cd $(TARGET_SUBDIR)/libgfortran && \ + $(MAKE) $(TARGET_FLAGS_TO_PASS) install) + +@endif target-libgfortran + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-target-libgfortran info-target-libgfortran +maybe-info-target-libgfortran: +@if target-libgfortran +maybe-info-target-libgfortran: info-target-libgfortran + +info-target-libgfortran: \ + configure-target-libgfortran + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgfortran/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing info in $(TARGET_SUBDIR)/libgfortran" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgfortran && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif target-libgfortran + +.PHONY: maybe-dvi-target-libgfortran dvi-target-libgfortran +maybe-dvi-target-libgfortran: +@if target-libgfortran +maybe-dvi-target-libgfortran: dvi-target-libgfortran + +dvi-target-libgfortran: \ + configure-target-libgfortran + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgfortran/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing dvi in $(TARGET_SUBDIR)/libgfortran" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgfortran && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif target-libgfortran + +.PHONY: maybe-html-target-libgfortran html-target-libgfortran +maybe-html-target-libgfortran: +@if target-libgfortran +maybe-html-target-libgfortran: html-target-libgfortran + +html-target-libgfortran: \ + configure-target-libgfortran + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgfortran/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing html in $(TARGET_SUBDIR)/libgfortran" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgfortran && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif target-libgfortran + +.PHONY: maybe-TAGS-target-libgfortran TAGS-target-libgfortran +maybe-TAGS-target-libgfortran: +@if target-libgfortran +maybe-TAGS-target-libgfortran: TAGS-target-libgfortran + +TAGS-target-libgfortran: \ + configure-target-libgfortran + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgfortran/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing TAGS in $(TARGET_SUBDIR)/libgfortran" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgfortran && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif target-libgfortran + +.PHONY: maybe-install-info-target-libgfortran install-info-target-libgfortran +maybe-install-info-target-libgfortran: +@if target-libgfortran +maybe-install-info-target-libgfortran: install-info-target-libgfortran + +install-info-target-libgfortran: \ + configure-target-libgfortran \ + info-target-libgfortran + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgfortran/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-info in $(TARGET_SUBDIR)/libgfortran" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgfortran && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif target-libgfortran + +.PHONY: maybe-install-html-target-libgfortran install-html-target-libgfortran +maybe-install-html-target-libgfortran: +@if target-libgfortran +maybe-install-html-target-libgfortran: install-html-target-libgfortran + +install-html-target-libgfortran: \ + configure-target-libgfortran \ + html-target-libgfortran + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgfortran/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-html in $(TARGET_SUBDIR)/libgfortran" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgfortran && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif target-libgfortran + +.PHONY: maybe-installcheck-target-libgfortran installcheck-target-libgfortran +maybe-installcheck-target-libgfortran: +@if target-libgfortran +maybe-installcheck-target-libgfortran: installcheck-target-libgfortran + +installcheck-target-libgfortran: \ + configure-target-libgfortran + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgfortran/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing installcheck in $(TARGET_SUBDIR)/libgfortran" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgfortran && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif target-libgfortran + +.PHONY: maybe-mostlyclean-target-libgfortran mostlyclean-target-libgfortran +maybe-mostlyclean-target-libgfortran: +@if target-libgfortran +maybe-mostlyclean-target-libgfortran: mostlyclean-target-libgfortran + +mostlyclean-target-libgfortran: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgfortran/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing mostlyclean in $(TARGET_SUBDIR)/libgfortran" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgfortran && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif target-libgfortran + +.PHONY: maybe-clean-target-libgfortran clean-target-libgfortran +maybe-clean-target-libgfortran: +@if target-libgfortran +maybe-clean-target-libgfortran: clean-target-libgfortran + +clean-target-libgfortran: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgfortran/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing clean in $(TARGET_SUBDIR)/libgfortran" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgfortran && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif target-libgfortran + +.PHONY: maybe-distclean-target-libgfortran distclean-target-libgfortran +maybe-distclean-target-libgfortran: +@if target-libgfortran +maybe-distclean-target-libgfortran: distclean-target-libgfortran + +distclean-target-libgfortran: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgfortran/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing distclean in $(TARGET_SUBDIR)/libgfortran" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgfortran && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif target-libgfortran + +.PHONY: maybe-maintainer-clean-target-libgfortran maintainer-clean-target-libgfortran +maybe-maintainer-clean-target-libgfortran: +@if target-libgfortran +maybe-maintainer-clean-target-libgfortran: maintainer-clean-target-libgfortran + +maintainer-clean-target-libgfortran: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgfortran/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing maintainer-clean in $(TARGET_SUBDIR)/libgfortran" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgfortran && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif target-libgfortran + + + .PHONY: configure-target-libobjc maybe-configure-target-libobjc maybe-configure-target-libobjc: - -# There's only one multilib.out. Cleverer subdirs shouldn't need it copied. -$(TARGET_SUBDIR)/libobjc/multilib.out: multilib.out - $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libobjc ; \ - rm -f $(TARGET_SUBDIR)/libobjc/Makefile || : ; \ - cp multilib.out $(TARGET_SUBDIR)/libobjc/multilib.out - -configure-target-libobjc: $(TARGET_SUBDIR)/libobjc/multilib.out - @test ! -f $(TARGET_SUBDIR)/libobjc/Makefile || exit 0; \ - $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libobjc ; \ - r=`${PWD_COMMAND}`; export r; \ +@if target-libobjc +maybe-configure-target-libobjc: configure-target-libobjc +configure-target-libobjc: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - AR="$(AR_FOR_TARGET)"; export AR; \ - AS="$(AS_FOR_TARGET)"; export AS; \ - CC="$(CC_FOR_TARGET)"; export CC; \ - CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \ - CXX="$(CXX_FOR_TARGET)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \ - GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \ - DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \ - LD="$(LD_FOR_TARGET)"; export LD; \ - LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \ - NM="$(NM_FOR_TARGET)"; export NM; \ - RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \ - WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \ + echo "Checking multilib configuration for libobjc..."; \ + $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libobjc ; \ + $(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/libobjc/multilib.tmp 2> /dev/null ; \ + if test -r $(TARGET_SUBDIR)/libobjc/multilib.out; then \ + if cmp -s $(TARGET_SUBDIR)/libobjc/multilib.tmp $(TARGET_SUBDIR)/libobjc/multilib.out; then \ + rm -f $(TARGET_SUBDIR)/libobjc/multilib.tmp; \ + else \ + rm -f $(TARGET_SUBDIR)/libobjc/Makefile; \ + mv $(TARGET_SUBDIR)/libobjc/multilib.tmp $(TARGET_SUBDIR)/libobjc/multilib.out; \ + fi; \ + else \ + mv $(TARGET_SUBDIR)/libobjc/multilib.tmp $(TARGET_SUBDIR)/libobjc/multilib.out; \ + fi; \ + test ! -f $(TARGET_SUBDIR)/libobjc/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libobjc ; \ + $(NORMAL_TARGET_EXPORTS) \ echo Configuring in $(TARGET_SUBDIR)/libobjc; \ cd "$(TARGET_SUBDIR)/libobjc" || exit 1; \ case $(srcdir) in \ - /* | [A-Za-z]:[\\/]*) \ - topdir=$(srcdir) ;; \ - *) \ - case "$(TARGET_SUBDIR)" in \ - .) topdir="../$(srcdir)" ;; \ - *) topdir="../../$(srcdir)" ;; \ - esac ;; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(TARGET_SUBDIR)/libobjc/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ - srcdiroption="--srcdir=$${topdir}/libobjc"; \ - libsrcdir="$$s/libobjc"; \ + srcdiroption="--srcdir=$${topdir}/libobjc"; \ + libsrcdir="$$s/libobjc"; \ rm -f no-such-file || : ; \ CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \ - $(TARGET_CONFIGARGS) $${srcdiroption} \ - --with-target-subdir="$(TARGET_SUBDIR)" \ + $(TARGET_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif target-libobjc + + + + .PHONY: all-target-libobjc maybe-all-target-libobjc maybe-all-target-libobjc: +@if target-libobjc +TARGET-target-libobjc=all +maybe-all-target-libobjc: all-target-libobjc all-target-libobjc: configure-target-libobjc + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(NORMAL_TARGET_EXPORTS) \ (cd $(TARGET_SUBDIR)/libobjc && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) all) + $(MAKE) $(TARGET_FLAGS_TO_PASS) $(TARGET-target-libobjc)) +@endif target-libobjc + + + + .PHONY: check-target-libobjc maybe-check-target-libobjc maybe-check-target-libobjc: +@if target-libobjc +maybe-check-target-libobjc: check-target-libobjc check-target-libobjc: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(NORMAL_TARGET_EXPORTS) \ (cd $(TARGET_SUBDIR)/libobjc && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) check) + $(MAKE) $(TARGET_FLAGS_TO_PASS) check) +@endif target-libobjc .PHONY: install-target-libobjc maybe-install-target-libobjc maybe-install-target-libobjc: +@if target-libobjc +maybe-install-target-libobjc: install-target-libobjc install-target-libobjc: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(NORMAL_TARGET_EXPORTS) \ (cd $(TARGET_SUBDIR)/libobjc && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) install) + $(MAKE) $(TARGET_FLAGS_TO_PASS) install) + +@endif target-libobjc + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-target-libobjc info-target-libobjc +maybe-info-target-libobjc: +@if target-libobjc +maybe-info-target-libobjc: info-target-libobjc + +info-target-libobjc: \ + configure-target-libobjc + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libobjc/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing info in $(TARGET_SUBDIR)/libobjc" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libobjc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif target-libobjc + +.PHONY: maybe-dvi-target-libobjc dvi-target-libobjc +maybe-dvi-target-libobjc: +@if target-libobjc +maybe-dvi-target-libobjc: dvi-target-libobjc + +dvi-target-libobjc: \ + configure-target-libobjc + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libobjc/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing dvi in $(TARGET_SUBDIR)/libobjc" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libobjc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif target-libobjc + +.PHONY: maybe-html-target-libobjc html-target-libobjc +maybe-html-target-libobjc: +@if target-libobjc +maybe-html-target-libobjc: html-target-libobjc + +html-target-libobjc: \ + configure-target-libobjc + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libobjc/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing html in $(TARGET_SUBDIR)/libobjc" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libobjc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif target-libobjc + +.PHONY: maybe-TAGS-target-libobjc TAGS-target-libobjc +maybe-TAGS-target-libobjc: +@if target-libobjc +maybe-TAGS-target-libobjc: TAGS-target-libobjc + +TAGS-target-libobjc: \ + configure-target-libobjc + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libobjc/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing TAGS in $(TARGET_SUBDIR)/libobjc" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libobjc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif target-libobjc + +.PHONY: maybe-install-info-target-libobjc install-info-target-libobjc +maybe-install-info-target-libobjc: +@if target-libobjc +maybe-install-info-target-libobjc: install-info-target-libobjc + +install-info-target-libobjc: \ + configure-target-libobjc \ + info-target-libobjc + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libobjc/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-info in $(TARGET_SUBDIR)/libobjc" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libobjc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif target-libobjc + +.PHONY: maybe-install-html-target-libobjc install-html-target-libobjc +maybe-install-html-target-libobjc: +@if target-libobjc +maybe-install-html-target-libobjc: install-html-target-libobjc + +install-html-target-libobjc: \ + configure-target-libobjc \ + html-target-libobjc + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libobjc/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-html in $(TARGET_SUBDIR)/libobjc" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libobjc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif target-libobjc + +.PHONY: maybe-installcheck-target-libobjc installcheck-target-libobjc +maybe-installcheck-target-libobjc: +@if target-libobjc +maybe-installcheck-target-libobjc: installcheck-target-libobjc + +installcheck-target-libobjc: \ + configure-target-libobjc + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libobjc/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing installcheck in $(TARGET_SUBDIR)/libobjc" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libobjc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif target-libobjc + +.PHONY: maybe-mostlyclean-target-libobjc mostlyclean-target-libobjc +maybe-mostlyclean-target-libobjc: +@if target-libobjc +maybe-mostlyclean-target-libobjc: mostlyclean-target-libobjc + +mostlyclean-target-libobjc: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libobjc/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing mostlyclean in $(TARGET_SUBDIR)/libobjc" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libobjc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif target-libobjc + +.PHONY: maybe-clean-target-libobjc clean-target-libobjc +maybe-clean-target-libobjc: +@if target-libobjc +maybe-clean-target-libobjc: clean-target-libobjc + +clean-target-libobjc: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libobjc/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing clean in $(TARGET_SUBDIR)/libobjc" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libobjc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif target-libobjc + +.PHONY: maybe-distclean-target-libobjc distclean-target-libobjc +maybe-distclean-target-libobjc: +@if target-libobjc +maybe-distclean-target-libobjc: distclean-target-libobjc + +distclean-target-libobjc: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libobjc/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing distclean in $(TARGET_SUBDIR)/libobjc" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libobjc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif target-libobjc + +.PHONY: maybe-maintainer-clean-target-libobjc maintainer-clean-target-libobjc +maybe-maintainer-clean-target-libobjc: +@if target-libobjc +maybe-maintainer-clean-target-libobjc: maintainer-clean-target-libobjc + +maintainer-clean-target-libobjc: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libobjc/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing maintainer-clean in $(TARGET_SUBDIR)/libobjc" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libobjc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif target-libobjc + + + .PHONY: configure-target-libtermcap maybe-configure-target-libtermcap maybe-configure-target-libtermcap: - -# There's only one multilib.out. Cleverer subdirs shouldn't need it copied. -$(TARGET_SUBDIR)/libtermcap/multilib.out: multilib.out - $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libtermcap ; \ - rm -f $(TARGET_SUBDIR)/libtermcap/Makefile || : ; \ - cp multilib.out $(TARGET_SUBDIR)/libtermcap/multilib.out - -configure-target-libtermcap: $(TARGET_SUBDIR)/libtermcap/multilib.out - @test ! -f $(TARGET_SUBDIR)/libtermcap/Makefile || exit 0; \ - $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libtermcap ; \ - r=`${PWD_COMMAND}`; export r; \ +@if target-libtermcap +maybe-configure-target-libtermcap: configure-target-libtermcap +configure-target-libtermcap: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - AR="$(AR_FOR_TARGET)"; export AR; \ - AS="$(AS_FOR_TARGET)"; export AS; \ - CC="$(CC_FOR_TARGET)"; export CC; \ - CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \ - CXX="$(CXX_FOR_TARGET)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \ - GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \ - DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \ - LD="$(LD_FOR_TARGET)"; export LD; \ - LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \ - NM="$(NM_FOR_TARGET)"; export NM; \ - RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \ - WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \ + echo "Checking multilib configuration for libtermcap..."; \ + $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libtermcap ; \ + $(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/libtermcap/multilib.tmp 2> /dev/null ; \ + if test -r $(TARGET_SUBDIR)/libtermcap/multilib.out; then \ + if cmp -s $(TARGET_SUBDIR)/libtermcap/multilib.tmp $(TARGET_SUBDIR)/libtermcap/multilib.out; then \ + rm -f $(TARGET_SUBDIR)/libtermcap/multilib.tmp; \ + else \ + rm -f $(TARGET_SUBDIR)/libtermcap/Makefile; \ + mv $(TARGET_SUBDIR)/libtermcap/multilib.tmp $(TARGET_SUBDIR)/libtermcap/multilib.out; \ + fi; \ + else \ + mv $(TARGET_SUBDIR)/libtermcap/multilib.tmp $(TARGET_SUBDIR)/libtermcap/multilib.out; \ + fi; \ + test ! -f $(TARGET_SUBDIR)/libtermcap/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libtermcap ; \ + $(NORMAL_TARGET_EXPORTS) \ echo Configuring in $(TARGET_SUBDIR)/libtermcap; \ cd "$(TARGET_SUBDIR)/libtermcap" || exit 1; \ case $(srcdir) in \ - /* | [A-Za-z]:[\\/]*) \ - topdir=$(srcdir) ;; \ - *) \ - case "$(TARGET_SUBDIR)" in \ - .) topdir="../$(srcdir)" ;; \ - *) topdir="../../$(srcdir)" ;; \ - esac ;; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(TARGET_SUBDIR)/libtermcap/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ - if [ "$(srcdir)" = "." ] ; then \ - if [ "$(TARGET_SUBDIR)" != "." ] ; then \ - if $(SHELL) $$s/symlink-tree $${topdir}/libtermcap "no-such-file" ; then \ - if [ -f Makefile ]; then \ - if $(MAKE) distclean; then \ - true; \ - else \ - exit 1; \ - fi; \ - else \ - true; \ - fi; \ - else \ - exit 1; \ - fi; \ - else \ - true; \ - fi; \ - srcdiroption="--srcdir=."; \ - libsrcdir="."; \ - else \ - srcdiroption="--srcdir=$${topdir}/libtermcap"; \ - libsrcdir="$$s/libtermcap"; \ - fi; \ + srcdiroption="--srcdir=$${topdir}/libtermcap"; \ + libsrcdir="$$s/libtermcap"; \ rm -f no-such-file || : ; \ CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \ - $(TARGET_CONFIGARGS) $${srcdiroption} \ - --with-target-subdir="$(TARGET_SUBDIR)" \ + $(TARGET_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif target-libtermcap + + + + .PHONY: all-target-libtermcap maybe-all-target-libtermcap maybe-all-target-libtermcap: +@if target-libtermcap +TARGET-target-libtermcap=all +maybe-all-target-libtermcap: all-target-libtermcap all-target-libtermcap: configure-target-libtermcap + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(NORMAL_TARGET_EXPORTS) \ (cd $(TARGET_SUBDIR)/libtermcap && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) all) + $(MAKE) $(TARGET_FLAGS_TO_PASS) $(TARGET-target-libtermcap)) +@endif target-libtermcap + + + + .PHONY: check-target-libtermcap maybe-check-target-libtermcap maybe-check-target-libtermcap: +@if target-libtermcap +maybe-check-target-libtermcap: check-target-libtermcap # Dummy target for uncheckable module. check-target-libtermcap: +@endif target-libtermcap .PHONY: install-target-libtermcap maybe-install-target-libtermcap maybe-install-target-libtermcap: +@if target-libtermcap +maybe-install-target-libtermcap: install-target-libtermcap install-target-libtermcap: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(NORMAL_TARGET_EXPORTS) \ (cd $(TARGET_SUBDIR)/libtermcap && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) install) + $(MAKE) $(TARGET_FLAGS_TO_PASS) install) + +@endif target-libtermcap + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-target-libtermcap info-target-libtermcap +maybe-info-target-libtermcap: +@if target-libtermcap +maybe-info-target-libtermcap: info-target-libtermcap + +info-target-libtermcap: \ + configure-target-libtermcap + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libtermcap/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing info in $(TARGET_SUBDIR)/libtermcap" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libtermcap && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif target-libtermcap + +.PHONY: maybe-dvi-target-libtermcap dvi-target-libtermcap +maybe-dvi-target-libtermcap: +@if target-libtermcap +maybe-dvi-target-libtermcap: dvi-target-libtermcap + +dvi-target-libtermcap: \ + configure-target-libtermcap + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libtermcap/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing dvi in $(TARGET_SUBDIR)/libtermcap" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libtermcap && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif target-libtermcap + +.PHONY: maybe-html-target-libtermcap html-target-libtermcap +maybe-html-target-libtermcap: +@if target-libtermcap +maybe-html-target-libtermcap: html-target-libtermcap + +html-target-libtermcap: \ + configure-target-libtermcap + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libtermcap/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing html in $(TARGET_SUBDIR)/libtermcap" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libtermcap && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif target-libtermcap + +.PHONY: maybe-TAGS-target-libtermcap TAGS-target-libtermcap +maybe-TAGS-target-libtermcap: +@if target-libtermcap +maybe-TAGS-target-libtermcap: TAGS-target-libtermcap + +TAGS-target-libtermcap: \ + configure-target-libtermcap + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libtermcap/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing TAGS in $(TARGET_SUBDIR)/libtermcap" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libtermcap && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif target-libtermcap + +.PHONY: maybe-install-info-target-libtermcap install-info-target-libtermcap +maybe-install-info-target-libtermcap: +@if target-libtermcap +maybe-install-info-target-libtermcap: install-info-target-libtermcap + +install-info-target-libtermcap: \ + configure-target-libtermcap \ + info-target-libtermcap + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libtermcap/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-info in $(TARGET_SUBDIR)/libtermcap" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libtermcap && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif target-libtermcap + +.PHONY: maybe-install-html-target-libtermcap install-html-target-libtermcap +maybe-install-html-target-libtermcap: +@if target-libtermcap +maybe-install-html-target-libtermcap: install-html-target-libtermcap + +install-html-target-libtermcap: \ + configure-target-libtermcap \ + html-target-libtermcap + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libtermcap/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-html in $(TARGET_SUBDIR)/libtermcap" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libtermcap && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif target-libtermcap + +.PHONY: maybe-installcheck-target-libtermcap installcheck-target-libtermcap +maybe-installcheck-target-libtermcap: +@if target-libtermcap +maybe-installcheck-target-libtermcap: installcheck-target-libtermcap + +installcheck-target-libtermcap: \ + configure-target-libtermcap + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libtermcap/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing installcheck in $(TARGET_SUBDIR)/libtermcap" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libtermcap && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif target-libtermcap + +.PHONY: maybe-mostlyclean-target-libtermcap mostlyclean-target-libtermcap +maybe-mostlyclean-target-libtermcap: +@if target-libtermcap +maybe-mostlyclean-target-libtermcap: mostlyclean-target-libtermcap + +# libtermcap doesn't support mostlyclean. +mostlyclean-target-libtermcap: + +@endif target-libtermcap + +.PHONY: maybe-clean-target-libtermcap clean-target-libtermcap +maybe-clean-target-libtermcap: +@if target-libtermcap +maybe-clean-target-libtermcap: clean-target-libtermcap + +# libtermcap doesn't support clean. +clean-target-libtermcap: + +@endif target-libtermcap + +.PHONY: maybe-distclean-target-libtermcap distclean-target-libtermcap +maybe-distclean-target-libtermcap: +@if target-libtermcap +maybe-distclean-target-libtermcap: distclean-target-libtermcap + +# libtermcap doesn't support distclean. +distclean-target-libtermcap: + +@endif target-libtermcap + +.PHONY: maybe-maintainer-clean-target-libtermcap maintainer-clean-target-libtermcap +maybe-maintainer-clean-target-libtermcap: +@if target-libtermcap +maybe-maintainer-clean-target-libtermcap: maintainer-clean-target-libtermcap + +# libtermcap doesn't support maintainer-clean. +maintainer-clean-target-libtermcap: + +@endif target-libtermcap + + + .PHONY: configure-target-winsup maybe-configure-target-winsup maybe-configure-target-winsup: - -# There's only one multilib.out. Cleverer subdirs shouldn't need it copied. -$(TARGET_SUBDIR)/winsup/multilib.out: multilib.out - $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/winsup ; \ - rm -f $(TARGET_SUBDIR)/winsup/Makefile || : ; \ - cp multilib.out $(TARGET_SUBDIR)/winsup/multilib.out - -configure-target-winsup: $(TARGET_SUBDIR)/winsup/multilib.out - @test ! -f $(TARGET_SUBDIR)/winsup/Makefile || exit 0; \ - $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/winsup ; \ - r=`${PWD_COMMAND}`; export r; \ +@if target-winsup +maybe-configure-target-winsup: configure-target-winsup +configure-target-winsup: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - AR="$(AR_FOR_TARGET)"; export AR; \ - AS="$(AS_FOR_TARGET)"; export AS; \ - CC="$(CC_FOR_TARGET)"; export CC; \ - CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \ - CXX="$(CXX_FOR_TARGET)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \ - GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \ - DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \ - LD="$(LD_FOR_TARGET)"; export LD; \ - LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \ - NM="$(NM_FOR_TARGET)"; export NM; \ - RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \ - WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \ + echo "Checking multilib configuration for winsup..."; \ + $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/winsup ; \ + $(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/winsup/multilib.tmp 2> /dev/null ; \ + if test -r $(TARGET_SUBDIR)/winsup/multilib.out; then \ + if cmp -s $(TARGET_SUBDIR)/winsup/multilib.tmp $(TARGET_SUBDIR)/winsup/multilib.out; then \ + rm -f $(TARGET_SUBDIR)/winsup/multilib.tmp; \ + else \ + rm -f $(TARGET_SUBDIR)/winsup/Makefile; \ + mv $(TARGET_SUBDIR)/winsup/multilib.tmp $(TARGET_SUBDIR)/winsup/multilib.out; \ + fi; \ + else \ + mv $(TARGET_SUBDIR)/winsup/multilib.tmp $(TARGET_SUBDIR)/winsup/multilib.out; \ + fi; \ + test ! -f $(TARGET_SUBDIR)/winsup/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/winsup ; \ + $(NORMAL_TARGET_EXPORTS) \ echo Configuring in $(TARGET_SUBDIR)/winsup; \ cd "$(TARGET_SUBDIR)/winsup" || exit 1; \ case $(srcdir) in \ - /* | [A-Za-z]:[\\/]*) \ - topdir=$(srcdir) ;; \ - *) \ - case "$(TARGET_SUBDIR)" in \ - .) topdir="../$(srcdir)" ;; \ - *) topdir="../../$(srcdir)" ;; \ - esac ;; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(TARGET_SUBDIR)/winsup/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ - srcdiroption="--srcdir=$${topdir}/winsup"; \ - libsrcdir="$$s/winsup"; \ + srcdiroption="--srcdir=$${topdir}/winsup"; \ + libsrcdir="$$s/winsup"; \ rm -f no-such-file || : ; \ CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \ - $(TARGET_CONFIGARGS) $${srcdiroption} \ - --with-target-subdir="$(TARGET_SUBDIR)" \ + $(TARGET_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif target-winsup + + + + .PHONY: all-target-winsup maybe-all-target-winsup maybe-all-target-winsup: +@if target-winsup +TARGET-target-winsup=all +maybe-all-target-winsup: all-target-winsup all-target-winsup: configure-target-winsup + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(NORMAL_TARGET_EXPORTS) \ (cd $(TARGET_SUBDIR)/winsup && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) all) + $(MAKE) $(TARGET_FLAGS_TO_PASS) $(TARGET-target-winsup)) +@endif target-winsup + + + + .PHONY: check-target-winsup maybe-check-target-winsup maybe-check-target-winsup: +@if target-winsup +maybe-check-target-winsup: check-target-winsup check-target-winsup: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(NORMAL_TARGET_EXPORTS) \ (cd $(TARGET_SUBDIR)/winsup && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) check) + $(MAKE) $(TARGET_FLAGS_TO_PASS) check) +@endif target-winsup .PHONY: install-target-winsup maybe-install-target-winsup maybe-install-target-winsup: +@if target-winsup +maybe-install-target-winsup: install-target-winsup install-target-winsup: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(NORMAL_TARGET_EXPORTS) \ (cd $(TARGET_SUBDIR)/winsup && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) install) + $(MAKE) $(TARGET_FLAGS_TO_PASS) install) + +@endif target-winsup + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-target-winsup info-target-winsup +maybe-info-target-winsup: +@if target-winsup +maybe-info-target-winsup: info-target-winsup + +info-target-winsup: \ + configure-target-winsup + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/winsup/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing info in $(TARGET_SUBDIR)/winsup" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/winsup && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif target-winsup + +.PHONY: maybe-dvi-target-winsup dvi-target-winsup +maybe-dvi-target-winsup: +@if target-winsup +maybe-dvi-target-winsup: dvi-target-winsup + +dvi-target-winsup: \ + configure-target-winsup + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/winsup/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing dvi in $(TARGET_SUBDIR)/winsup" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/winsup && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif target-winsup + +.PHONY: maybe-html-target-winsup html-target-winsup +maybe-html-target-winsup: +@if target-winsup +maybe-html-target-winsup: html-target-winsup + +html-target-winsup: \ + configure-target-winsup + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/winsup/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing html in $(TARGET_SUBDIR)/winsup" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/winsup && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif target-winsup + +.PHONY: maybe-TAGS-target-winsup TAGS-target-winsup +maybe-TAGS-target-winsup: +@if target-winsup +maybe-TAGS-target-winsup: TAGS-target-winsup + +TAGS-target-winsup: \ + configure-target-winsup + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/winsup/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing TAGS in $(TARGET_SUBDIR)/winsup" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/winsup && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif target-winsup + +.PHONY: maybe-install-info-target-winsup install-info-target-winsup +maybe-install-info-target-winsup: +@if target-winsup +maybe-install-info-target-winsup: install-info-target-winsup + +install-info-target-winsup: \ + configure-target-winsup \ + info-target-winsup + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/winsup/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-info in $(TARGET_SUBDIR)/winsup" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/winsup && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif target-winsup + +.PHONY: maybe-install-html-target-winsup install-html-target-winsup +maybe-install-html-target-winsup: +@if target-winsup +maybe-install-html-target-winsup: install-html-target-winsup + +install-html-target-winsup: \ + configure-target-winsup \ + html-target-winsup + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/winsup/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-html in $(TARGET_SUBDIR)/winsup" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/winsup && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif target-winsup + +.PHONY: maybe-installcheck-target-winsup installcheck-target-winsup +maybe-installcheck-target-winsup: +@if target-winsup +maybe-installcheck-target-winsup: installcheck-target-winsup + +installcheck-target-winsup: \ + configure-target-winsup + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/winsup/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing installcheck in $(TARGET_SUBDIR)/winsup" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/winsup && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif target-winsup + +.PHONY: maybe-mostlyclean-target-winsup mostlyclean-target-winsup +maybe-mostlyclean-target-winsup: +@if target-winsup +maybe-mostlyclean-target-winsup: mostlyclean-target-winsup + +mostlyclean-target-winsup: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/winsup/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing mostlyclean in $(TARGET_SUBDIR)/winsup" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/winsup && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif target-winsup + +.PHONY: maybe-clean-target-winsup clean-target-winsup +maybe-clean-target-winsup: +@if target-winsup +maybe-clean-target-winsup: clean-target-winsup + +clean-target-winsup: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/winsup/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing clean in $(TARGET_SUBDIR)/winsup" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/winsup && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif target-winsup + +.PHONY: maybe-distclean-target-winsup distclean-target-winsup +maybe-distclean-target-winsup: +@if target-winsup +maybe-distclean-target-winsup: distclean-target-winsup + +distclean-target-winsup: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/winsup/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing distclean in $(TARGET_SUBDIR)/winsup" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/winsup && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif target-winsup + +.PHONY: maybe-maintainer-clean-target-winsup maintainer-clean-target-winsup +maybe-maintainer-clean-target-winsup: +@if target-winsup +maybe-maintainer-clean-target-winsup: maintainer-clean-target-winsup + +maintainer-clean-target-winsup: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/winsup/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing maintainer-clean in $(TARGET_SUBDIR)/winsup" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/winsup && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif target-winsup + + + .PHONY: configure-target-libgloss maybe-configure-target-libgloss maybe-configure-target-libgloss: - -# There's only one multilib.out. Cleverer subdirs shouldn't need it copied. -$(TARGET_SUBDIR)/libgloss/multilib.out: multilib.out - $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libgloss ; \ - rm -f $(TARGET_SUBDIR)/libgloss/Makefile || : ; \ - cp multilib.out $(TARGET_SUBDIR)/libgloss/multilib.out - -configure-target-libgloss: $(TARGET_SUBDIR)/libgloss/multilib.out - @test ! -f $(TARGET_SUBDIR)/libgloss/Makefile || exit 0; \ - $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libgloss ; \ - r=`${PWD_COMMAND}`; export r; \ +@if target-libgloss +maybe-configure-target-libgloss: configure-target-libgloss +configure-target-libgloss: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - AR="$(AR_FOR_TARGET)"; export AR; \ - AS="$(AS_FOR_TARGET)"; export AS; \ - CC="$(CC_FOR_TARGET)"; export CC; \ - CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \ - CXX="$(CXX_FOR_TARGET)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \ - GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \ - DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \ - LD="$(LD_FOR_TARGET)"; export LD; \ - LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \ - NM="$(NM_FOR_TARGET)"; export NM; \ - RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \ - WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \ + echo "Checking multilib configuration for libgloss..."; \ + $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libgloss ; \ + $(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/libgloss/multilib.tmp 2> /dev/null ; \ + if test -r $(TARGET_SUBDIR)/libgloss/multilib.out; then \ + if cmp -s $(TARGET_SUBDIR)/libgloss/multilib.tmp $(TARGET_SUBDIR)/libgloss/multilib.out; then \ + rm -f $(TARGET_SUBDIR)/libgloss/multilib.tmp; \ + else \ + rm -f $(TARGET_SUBDIR)/libgloss/Makefile; \ + mv $(TARGET_SUBDIR)/libgloss/multilib.tmp $(TARGET_SUBDIR)/libgloss/multilib.out; \ + fi; \ + else \ + mv $(TARGET_SUBDIR)/libgloss/multilib.tmp $(TARGET_SUBDIR)/libgloss/multilib.out; \ + fi; \ + test ! -f $(TARGET_SUBDIR)/libgloss/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libgloss ; \ + $(NORMAL_TARGET_EXPORTS) \ echo Configuring in $(TARGET_SUBDIR)/libgloss; \ cd "$(TARGET_SUBDIR)/libgloss" || exit 1; \ case $(srcdir) in \ - /* | [A-Za-z]:[\\/]*) \ - topdir=$(srcdir) ;; \ - *) \ - case "$(TARGET_SUBDIR)" in \ - .) topdir="../$(srcdir)" ;; \ - *) topdir="../../$(srcdir)" ;; \ - esac ;; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(TARGET_SUBDIR)/libgloss/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ - srcdiroption="--srcdir=$${topdir}/libgloss"; \ - libsrcdir="$$s/libgloss"; \ + srcdiroption="--srcdir=$${topdir}/libgloss"; \ + libsrcdir="$$s/libgloss"; \ rm -f no-such-file || : ; \ CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \ - $(TARGET_CONFIGARGS) $${srcdiroption} \ - --with-target-subdir="$(TARGET_SUBDIR)" \ + $(TARGET_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif target-libgloss + + + + .PHONY: all-target-libgloss maybe-all-target-libgloss maybe-all-target-libgloss: +@if target-libgloss +TARGET-target-libgloss=all +maybe-all-target-libgloss: all-target-libgloss all-target-libgloss: configure-target-libgloss + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(NORMAL_TARGET_EXPORTS) \ (cd $(TARGET_SUBDIR)/libgloss && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) all) + $(MAKE) $(TARGET_FLAGS_TO_PASS) $(TARGET-target-libgloss)) +@endif target-libgloss + + + + .PHONY: check-target-libgloss maybe-check-target-libgloss maybe-check-target-libgloss: +@if target-libgloss +maybe-check-target-libgloss: check-target-libgloss # Dummy target for uncheckable module. check-target-libgloss: +@endif target-libgloss .PHONY: install-target-libgloss maybe-install-target-libgloss maybe-install-target-libgloss: +@if target-libgloss +maybe-install-target-libgloss: install-target-libgloss install-target-libgloss: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(NORMAL_TARGET_EXPORTS) \ (cd $(TARGET_SUBDIR)/libgloss && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) install) + $(MAKE) $(TARGET_FLAGS_TO_PASS) install) + +@endif target-libgloss + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-target-libgloss info-target-libgloss +maybe-info-target-libgloss: +@if target-libgloss +maybe-info-target-libgloss: info-target-libgloss + +info-target-libgloss: \ + configure-target-libgloss + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgloss/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing info in $(TARGET_SUBDIR)/libgloss" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgloss && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif target-libgloss + +.PHONY: maybe-dvi-target-libgloss dvi-target-libgloss +maybe-dvi-target-libgloss: +@if target-libgloss +maybe-dvi-target-libgloss: dvi-target-libgloss + +dvi-target-libgloss: \ + configure-target-libgloss + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgloss/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing dvi in $(TARGET_SUBDIR)/libgloss" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgloss && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif target-libgloss + +.PHONY: maybe-html-target-libgloss html-target-libgloss +maybe-html-target-libgloss: +@if target-libgloss +maybe-html-target-libgloss: html-target-libgloss + +html-target-libgloss: \ + configure-target-libgloss + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgloss/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing html in $(TARGET_SUBDIR)/libgloss" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgloss && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif target-libgloss + +.PHONY: maybe-TAGS-target-libgloss TAGS-target-libgloss +maybe-TAGS-target-libgloss: +@if target-libgloss +maybe-TAGS-target-libgloss: TAGS-target-libgloss + +TAGS-target-libgloss: \ + configure-target-libgloss + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgloss/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing TAGS in $(TARGET_SUBDIR)/libgloss" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgloss && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif target-libgloss + +.PHONY: maybe-install-info-target-libgloss install-info-target-libgloss +maybe-install-info-target-libgloss: +@if target-libgloss +maybe-install-info-target-libgloss: install-info-target-libgloss + +install-info-target-libgloss: \ + configure-target-libgloss \ + info-target-libgloss + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgloss/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-info in $(TARGET_SUBDIR)/libgloss" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgloss && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif target-libgloss + +.PHONY: maybe-install-html-target-libgloss install-html-target-libgloss +maybe-install-html-target-libgloss: +@if target-libgloss +maybe-install-html-target-libgloss: install-html-target-libgloss + +install-html-target-libgloss: \ + configure-target-libgloss \ + html-target-libgloss + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgloss/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-html in $(TARGET_SUBDIR)/libgloss" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgloss && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif target-libgloss + +.PHONY: maybe-installcheck-target-libgloss installcheck-target-libgloss +maybe-installcheck-target-libgloss: +@if target-libgloss +maybe-installcheck-target-libgloss: installcheck-target-libgloss + +installcheck-target-libgloss: \ + configure-target-libgloss + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgloss/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing installcheck in $(TARGET_SUBDIR)/libgloss" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgloss && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif target-libgloss + +.PHONY: maybe-mostlyclean-target-libgloss mostlyclean-target-libgloss +maybe-mostlyclean-target-libgloss: +@if target-libgloss +maybe-mostlyclean-target-libgloss: mostlyclean-target-libgloss + +mostlyclean-target-libgloss: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgloss/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing mostlyclean in $(TARGET_SUBDIR)/libgloss" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgloss && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif target-libgloss + +.PHONY: maybe-clean-target-libgloss clean-target-libgloss +maybe-clean-target-libgloss: +@if target-libgloss +maybe-clean-target-libgloss: clean-target-libgloss + +clean-target-libgloss: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgloss/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing clean in $(TARGET_SUBDIR)/libgloss" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgloss && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif target-libgloss + +.PHONY: maybe-distclean-target-libgloss distclean-target-libgloss +maybe-distclean-target-libgloss: +@if target-libgloss +maybe-distclean-target-libgloss: distclean-target-libgloss + +distclean-target-libgloss: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgloss/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing distclean in $(TARGET_SUBDIR)/libgloss" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgloss && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif target-libgloss + +.PHONY: maybe-maintainer-clean-target-libgloss maintainer-clean-target-libgloss +maybe-maintainer-clean-target-libgloss: +@if target-libgloss +maybe-maintainer-clean-target-libgloss: maintainer-clean-target-libgloss + +maintainer-clean-target-libgloss: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgloss/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing maintainer-clean in $(TARGET_SUBDIR)/libgloss" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgloss && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif target-libgloss + + + .PHONY: configure-target-libiberty maybe-configure-target-libiberty maybe-configure-target-libiberty: - -# There's only one multilib.out. Cleverer subdirs shouldn't need it copied. -$(TARGET_SUBDIR)/libiberty/multilib.out: multilib.out - $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libiberty ; \ - rm -f $(TARGET_SUBDIR)/libiberty/Makefile || : ; \ - cp multilib.out $(TARGET_SUBDIR)/libiberty/multilib.out - -configure-target-libiberty: $(TARGET_SUBDIR)/libiberty/multilib.out - @test ! -f $(TARGET_SUBDIR)/libiberty/Makefile || exit 0; \ - $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libiberty ; \ - r=`${PWD_COMMAND}`; export r; \ +@if target-libiberty +maybe-configure-target-libiberty: configure-target-libiberty +configure-target-libiberty: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - AR="$(AR_FOR_TARGET)"; export AR; \ - AS="$(AS_FOR_TARGET)"; export AS; \ - CC="$(CC_FOR_TARGET)"; export CC; \ - CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \ - CXX="$(CXX_FOR_TARGET)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \ - GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \ - DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \ - LD="$(LD_FOR_TARGET)"; export LD; \ - LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \ - NM="$(NM_FOR_TARGET)"; export NM; \ - RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \ - WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \ + echo "Checking multilib configuration for libiberty..."; \ + $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libiberty ; \ + $(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/libiberty/multilib.tmp 2> /dev/null ; \ + if test -r $(TARGET_SUBDIR)/libiberty/multilib.out; then \ + if cmp -s $(TARGET_SUBDIR)/libiberty/multilib.tmp $(TARGET_SUBDIR)/libiberty/multilib.out; then \ + rm -f $(TARGET_SUBDIR)/libiberty/multilib.tmp; \ + else \ + rm -f $(TARGET_SUBDIR)/libiberty/Makefile; \ + mv $(TARGET_SUBDIR)/libiberty/multilib.tmp $(TARGET_SUBDIR)/libiberty/multilib.out; \ + fi; \ + else \ + mv $(TARGET_SUBDIR)/libiberty/multilib.tmp $(TARGET_SUBDIR)/libiberty/multilib.out; \ + fi; \ + test ! -f $(TARGET_SUBDIR)/libiberty/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libiberty ; \ + $(NORMAL_TARGET_EXPORTS) \ echo Configuring in $(TARGET_SUBDIR)/libiberty; \ cd "$(TARGET_SUBDIR)/libiberty" || exit 1; \ case $(srcdir) in \ - /* | [A-Za-z]:[\\/]*) \ - topdir=$(srcdir) ;; \ - *) \ - case "$(TARGET_SUBDIR)" in \ - .) topdir="../$(srcdir)" ;; \ - *) topdir="../../$(srcdir)" ;; \ - esac ;; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(TARGET_SUBDIR)/libiberty/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ - srcdiroption="--srcdir=$${topdir}/libiberty"; \ - libsrcdir="$$s/libiberty"; \ + srcdiroption="--srcdir=$${topdir}/libiberty"; \ + libsrcdir="$$s/libiberty"; \ rm -f no-such-file || : ; \ CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \ - $(TARGET_CONFIGARGS) $${srcdiroption} \ - --with-target-subdir="$(TARGET_SUBDIR)" \ + $(TARGET_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif target-libiberty + + + + .PHONY: all-target-libiberty maybe-all-target-libiberty maybe-all-target-libiberty: +@if target-libiberty +TARGET-target-libiberty=all +maybe-all-target-libiberty: all-target-libiberty all-target-libiberty: configure-target-libiberty + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(NORMAL_TARGET_EXPORTS) \ (cd $(TARGET_SUBDIR)/libiberty && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) all) + $(MAKE) $(TARGET_FLAGS_TO_PASS) $(TARGET-target-libiberty)) +@endif target-libiberty + + + + .PHONY: check-target-libiberty maybe-check-target-libiberty maybe-check-target-libiberty: +@if target-libiberty +maybe-check-target-libiberty: check-target-libiberty check-target-libiberty: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(NORMAL_TARGET_EXPORTS) \ (cd $(TARGET_SUBDIR)/libiberty && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) check) + $(MAKE) $(TARGET_FLAGS_TO_PASS) check) +@endif target-libiberty .PHONY: install-target-libiberty maybe-install-target-libiberty maybe-install-target-libiberty: +@if target-libiberty +maybe-install-target-libiberty: install-target-libiberty install-target-libiberty: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(NORMAL_TARGET_EXPORTS) \ (cd $(TARGET_SUBDIR)/libiberty && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) install) + $(MAKE) $(TARGET_FLAGS_TO_PASS) install) + +@endif target-libiberty + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-target-libiberty info-target-libiberty +maybe-info-target-libiberty: +@if target-libiberty +maybe-info-target-libiberty: info-target-libiberty + +info-target-libiberty: \ + configure-target-libiberty + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libiberty/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing info in $(TARGET_SUBDIR)/libiberty" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libiberty && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif target-libiberty + +.PHONY: maybe-dvi-target-libiberty dvi-target-libiberty +maybe-dvi-target-libiberty: +@if target-libiberty +maybe-dvi-target-libiberty: dvi-target-libiberty + +dvi-target-libiberty: \ + configure-target-libiberty + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libiberty/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing dvi in $(TARGET_SUBDIR)/libiberty" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libiberty && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif target-libiberty + +.PHONY: maybe-html-target-libiberty html-target-libiberty +maybe-html-target-libiberty: +@if target-libiberty +maybe-html-target-libiberty: html-target-libiberty + +html-target-libiberty: \ + configure-target-libiberty + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libiberty/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing html in $(TARGET_SUBDIR)/libiberty" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libiberty && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif target-libiberty + +.PHONY: maybe-TAGS-target-libiberty TAGS-target-libiberty +maybe-TAGS-target-libiberty: +@if target-libiberty +maybe-TAGS-target-libiberty: TAGS-target-libiberty + +TAGS-target-libiberty: \ + configure-target-libiberty + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libiberty/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing TAGS in $(TARGET_SUBDIR)/libiberty" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libiberty && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif target-libiberty + +.PHONY: maybe-install-info-target-libiberty install-info-target-libiberty +maybe-install-info-target-libiberty: +@if target-libiberty +maybe-install-info-target-libiberty: install-info-target-libiberty + +install-info-target-libiberty: \ + configure-target-libiberty \ + info-target-libiberty + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libiberty/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-info in $(TARGET_SUBDIR)/libiberty" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libiberty && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif target-libiberty + +.PHONY: maybe-install-html-target-libiberty install-html-target-libiberty +maybe-install-html-target-libiberty: +@if target-libiberty +maybe-install-html-target-libiberty: install-html-target-libiberty + +install-html-target-libiberty: \ + configure-target-libiberty \ + html-target-libiberty + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libiberty/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-html in $(TARGET_SUBDIR)/libiberty" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libiberty && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif target-libiberty + +.PHONY: maybe-installcheck-target-libiberty installcheck-target-libiberty +maybe-installcheck-target-libiberty: +@if target-libiberty +maybe-installcheck-target-libiberty: installcheck-target-libiberty + +installcheck-target-libiberty: \ + configure-target-libiberty + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libiberty/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing installcheck in $(TARGET_SUBDIR)/libiberty" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libiberty && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif target-libiberty + +.PHONY: maybe-mostlyclean-target-libiberty mostlyclean-target-libiberty +maybe-mostlyclean-target-libiberty: +@if target-libiberty +maybe-mostlyclean-target-libiberty: mostlyclean-target-libiberty + +mostlyclean-target-libiberty: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libiberty/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing mostlyclean in $(TARGET_SUBDIR)/libiberty" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libiberty && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif target-libiberty + +.PHONY: maybe-clean-target-libiberty clean-target-libiberty +maybe-clean-target-libiberty: +@if target-libiberty +maybe-clean-target-libiberty: clean-target-libiberty + +clean-target-libiberty: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libiberty/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing clean in $(TARGET_SUBDIR)/libiberty" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libiberty && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif target-libiberty + +.PHONY: maybe-distclean-target-libiberty distclean-target-libiberty +maybe-distclean-target-libiberty: +@if target-libiberty +maybe-distclean-target-libiberty: distclean-target-libiberty + +distclean-target-libiberty: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libiberty/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing distclean in $(TARGET_SUBDIR)/libiberty" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libiberty && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif target-libiberty + +.PHONY: maybe-maintainer-clean-target-libiberty maintainer-clean-target-libiberty +maybe-maintainer-clean-target-libiberty: +@if target-libiberty +maybe-maintainer-clean-target-libiberty: maintainer-clean-target-libiberty + +maintainer-clean-target-libiberty: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libiberty/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing maintainer-clean in $(TARGET_SUBDIR)/libiberty" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libiberty && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif target-libiberty + + + .PHONY: configure-target-gperf maybe-configure-target-gperf maybe-configure-target-gperf: - -# There's only one multilib.out. Cleverer subdirs shouldn't need it copied. -$(TARGET_SUBDIR)/gperf/multilib.out: multilib.out - $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/gperf ; \ - rm -f $(TARGET_SUBDIR)/gperf/Makefile || : ; \ - cp multilib.out $(TARGET_SUBDIR)/gperf/multilib.out - -configure-target-gperf: $(TARGET_SUBDIR)/gperf/multilib.out - @test ! -f $(TARGET_SUBDIR)/gperf/Makefile || exit 0; \ - $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/gperf ; \ - r=`${PWD_COMMAND}`; export r; \ +@if target-gperf +maybe-configure-target-gperf: configure-target-gperf +configure-target-gperf: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - AR="$(AR_FOR_TARGET)"; export AR; \ - AS="$(AS_FOR_TARGET)"; export AS; \ - CC="$(CC_FOR_TARGET)"; export CC; \ - CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \ - CXX="$(CXX_FOR_TARGET)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \ - GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \ - DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \ - LD="$(LD_FOR_TARGET)"; export LD; \ - LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \ - NM="$(NM_FOR_TARGET)"; export NM; \ - RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \ - WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \ + echo "Checking multilib configuration for gperf..."; \ + $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/gperf ; \ + $(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/gperf/multilib.tmp 2> /dev/null ; \ + if test -r $(TARGET_SUBDIR)/gperf/multilib.out; then \ + if cmp -s $(TARGET_SUBDIR)/gperf/multilib.tmp $(TARGET_SUBDIR)/gperf/multilib.out; then \ + rm -f $(TARGET_SUBDIR)/gperf/multilib.tmp; \ + else \ + rm -f $(TARGET_SUBDIR)/gperf/Makefile; \ + mv $(TARGET_SUBDIR)/gperf/multilib.tmp $(TARGET_SUBDIR)/gperf/multilib.out; \ + fi; \ + else \ + mv $(TARGET_SUBDIR)/gperf/multilib.tmp $(TARGET_SUBDIR)/gperf/multilib.out; \ + fi; \ + test ! -f $(TARGET_SUBDIR)/gperf/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/gperf ; \ + $(NORMAL_TARGET_EXPORTS) \ echo Configuring in $(TARGET_SUBDIR)/gperf; \ cd "$(TARGET_SUBDIR)/gperf" || exit 1; \ case $(srcdir) in \ - /* | [A-Za-z]:[\\/]*) \ - topdir=$(srcdir) ;; \ - *) \ - case "$(TARGET_SUBDIR)" in \ - .) topdir="../$(srcdir)" ;; \ - *) topdir="../../$(srcdir)" ;; \ - esac ;; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(TARGET_SUBDIR)/gperf/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ - srcdiroption="--srcdir=$${topdir}/gperf"; \ - libsrcdir="$$s/gperf"; \ + srcdiroption="--srcdir=$${topdir}/gperf"; \ + libsrcdir="$$s/gperf"; \ rm -f no-such-file || : ; \ CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \ - $(TARGET_CONFIGARGS) $${srcdiroption} \ - --with-target-subdir="$(TARGET_SUBDIR)" \ + $(TARGET_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif target-gperf + + + + .PHONY: all-target-gperf maybe-all-target-gperf maybe-all-target-gperf: +@if target-gperf +TARGET-target-gperf=all +maybe-all-target-gperf: all-target-gperf all-target-gperf: configure-target-gperf + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(NORMAL_TARGET_EXPORTS) \ (cd $(TARGET_SUBDIR)/gperf && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) all) + $(MAKE) $(TARGET_FLAGS_TO_PASS) $(TARGET-target-gperf)) +@endif target-gperf + + + + .PHONY: check-target-gperf maybe-check-target-gperf maybe-check-target-gperf: +@if target-gperf +maybe-check-target-gperf: check-target-gperf check-target-gperf: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(NORMAL_TARGET_EXPORTS) \ (cd $(TARGET_SUBDIR)/gperf && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) check) + $(MAKE) $(TARGET_FLAGS_TO_PASS) check) +@endif target-gperf .PHONY: install-target-gperf maybe-install-target-gperf maybe-install-target-gperf: +@if target-gperf +maybe-install-target-gperf: install-target-gperf install-target-gperf: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(NORMAL_TARGET_EXPORTS) \ (cd $(TARGET_SUBDIR)/gperf && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) install) + $(MAKE) $(TARGET_FLAGS_TO_PASS) install) + +@endif target-gperf + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-target-gperf info-target-gperf +maybe-info-target-gperf: +@if target-gperf +maybe-info-target-gperf: info-target-gperf + +info-target-gperf: \ + configure-target-gperf + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/gperf/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing info in $(TARGET_SUBDIR)/gperf" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/gperf && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif target-gperf + +.PHONY: maybe-dvi-target-gperf dvi-target-gperf +maybe-dvi-target-gperf: +@if target-gperf +maybe-dvi-target-gperf: dvi-target-gperf + +dvi-target-gperf: \ + configure-target-gperf + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/gperf/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing dvi in $(TARGET_SUBDIR)/gperf" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/gperf && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif target-gperf + +.PHONY: maybe-html-target-gperf html-target-gperf +maybe-html-target-gperf: +@if target-gperf +maybe-html-target-gperf: html-target-gperf + +html-target-gperf: \ + configure-target-gperf + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/gperf/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing html in $(TARGET_SUBDIR)/gperf" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/gperf && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif target-gperf + +.PHONY: maybe-TAGS-target-gperf TAGS-target-gperf +maybe-TAGS-target-gperf: +@if target-gperf +maybe-TAGS-target-gperf: TAGS-target-gperf + +TAGS-target-gperf: \ + configure-target-gperf + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/gperf/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing TAGS in $(TARGET_SUBDIR)/gperf" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/gperf && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif target-gperf + +.PHONY: maybe-install-info-target-gperf install-info-target-gperf +maybe-install-info-target-gperf: +@if target-gperf +maybe-install-info-target-gperf: install-info-target-gperf + +install-info-target-gperf: \ + configure-target-gperf \ + info-target-gperf + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/gperf/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-info in $(TARGET_SUBDIR)/gperf" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/gperf && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif target-gperf + +.PHONY: maybe-install-html-target-gperf install-html-target-gperf +maybe-install-html-target-gperf: +@if target-gperf +maybe-install-html-target-gperf: install-html-target-gperf + +install-html-target-gperf: \ + configure-target-gperf \ + html-target-gperf + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/gperf/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-html in $(TARGET_SUBDIR)/gperf" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/gperf && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif target-gperf + +.PHONY: maybe-installcheck-target-gperf installcheck-target-gperf +maybe-installcheck-target-gperf: +@if target-gperf +maybe-installcheck-target-gperf: installcheck-target-gperf + +installcheck-target-gperf: \ + configure-target-gperf + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/gperf/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing installcheck in $(TARGET_SUBDIR)/gperf" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/gperf && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif target-gperf + +.PHONY: maybe-mostlyclean-target-gperf mostlyclean-target-gperf +maybe-mostlyclean-target-gperf: +@if target-gperf +maybe-mostlyclean-target-gperf: mostlyclean-target-gperf + +mostlyclean-target-gperf: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/gperf/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing mostlyclean in $(TARGET_SUBDIR)/gperf" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/gperf && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif target-gperf + +.PHONY: maybe-clean-target-gperf clean-target-gperf +maybe-clean-target-gperf: +@if target-gperf +maybe-clean-target-gperf: clean-target-gperf + +clean-target-gperf: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/gperf/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing clean in $(TARGET_SUBDIR)/gperf" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/gperf && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif target-gperf + +.PHONY: maybe-distclean-target-gperf distclean-target-gperf +maybe-distclean-target-gperf: +@if target-gperf +maybe-distclean-target-gperf: distclean-target-gperf + +distclean-target-gperf: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/gperf/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing distclean in $(TARGET_SUBDIR)/gperf" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/gperf && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif target-gperf + +.PHONY: maybe-maintainer-clean-target-gperf maintainer-clean-target-gperf +maybe-maintainer-clean-target-gperf: +@if target-gperf +maybe-maintainer-clean-target-gperf: maintainer-clean-target-gperf + +maintainer-clean-target-gperf: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/gperf/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing maintainer-clean in $(TARGET_SUBDIR)/gperf" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/gperf && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif target-gperf + + + .PHONY: configure-target-examples maybe-configure-target-examples maybe-configure-target-examples: - -# There's only one multilib.out. Cleverer subdirs shouldn't need it copied. -$(TARGET_SUBDIR)/examples/multilib.out: multilib.out - $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/examples ; \ - rm -f $(TARGET_SUBDIR)/examples/Makefile || : ; \ - cp multilib.out $(TARGET_SUBDIR)/examples/multilib.out - -configure-target-examples: $(TARGET_SUBDIR)/examples/multilib.out - @test ! -f $(TARGET_SUBDIR)/examples/Makefile || exit 0; \ - $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/examples ; \ - r=`${PWD_COMMAND}`; export r; \ +@if target-examples +maybe-configure-target-examples: configure-target-examples +configure-target-examples: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - AR="$(AR_FOR_TARGET)"; export AR; \ - AS="$(AS_FOR_TARGET)"; export AS; \ - CC="$(CC_FOR_TARGET)"; export CC; \ - CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \ - CXX="$(CXX_FOR_TARGET)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \ - GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \ - DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \ - LD="$(LD_FOR_TARGET)"; export LD; \ - LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \ - NM="$(NM_FOR_TARGET)"; export NM; \ - RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \ - WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \ + echo "Checking multilib configuration for examples..."; \ + $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/examples ; \ + $(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/examples/multilib.tmp 2> /dev/null ; \ + if test -r $(TARGET_SUBDIR)/examples/multilib.out; then \ + if cmp -s $(TARGET_SUBDIR)/examples/multilib.tmp $(TARGET_SUBDIR)/examples/multilib.out; then \ + rm -f $(TARGET_SUBDIR)/examples/multilib.tmp; \ + else \ + rm -f $(TARGET_SUBDIR)/examples/Makefile; \ + mv $(TARGET_SUBDIR)/examples/multilib.tmp $(TARGET_SUBDIR)/examples/multilib.out; \ + fi; \ + else \ + mv $(TARGET_SUBDIR)/examples/multilib.tmp $(TARGET_SUBDIR)/examples/multilib.out; \ + fi; \ + test ! -f $(TARGET_SUBDIR)/examples/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/examples ; \ + $(NORMAL_TARGET_EXPORTS) \ echo Configuring in $(TARGET_SUBDIR)/examples; \ cd "$(TARGET_SUBDIR)/examples" || exit 1; \ case $(srcdir) in \ - /* | [A-Za-z]:[\\/]*) \ - topdir=$(srcdir) ;; \ - *) \ - case "$(TARGET_SUBDIR)" in \ - .) topdir="../$(srcdir)" ;; \ - *) topdir="../../$(srcdir)" ;; \ - esac ;; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(TARGET_SUBDIR)/examples/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ - srcdiroption="--srcdir=$${topdir}/examples"; \ - libsrcdir="$$s/examples"; \ + srcdiroption="--srcdir=$${topdir}/examples"; \ + libsrcdir="$$s/examples"; \ rm -f no-such-file || : ; \ CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \ - $(TARGET_CONFIGARGS) $${srcdiroption} \ - --with-target-subdir="$(TARGET_SUBDIR)" \ + $(TARGET_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif target-examples + + + + .PHONY: all-target-examples maybe-all-target-examples maybe-all-target-examples: +@if target-examples +TARGET-target-examples=all +maybe-all-target-examples: all-target-examples all-target-examples: configure-target-examples + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(NORMAL_TARGET_EXPORTS) \ (cd $(TARGET_SUBDIR)/examples && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) all) + $(MAKE) $(TARGET_FLAGS_TO_PASS) $(TARGET-target-examples)) +@endif target-examples + + + + .PHONY: check-target-examples maybe-check-target-examples maybe-check-target-examples: +@if target-examples +maybe-check-target-examples: check-target-examples # Dummy target for uncheckable module. check-target-examples: +@endif target-examples .PHONY: install-target-examples maybe-install-target-examples maybe-install-target-examples: +@if target-examples +maybe-install-target-examples: install-target-examples # Dummy target for uninstallable. install-target-examples: +@endif target-examples + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-target-examples info-target-examples +maybe-info-target-examples: +@if target-examples +maybe-info-target-examples: info-target-examples + +info-target-examples: \ + configure-target-examples + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/examples/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing info in $(TARGET_SUBDIR)/examples" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/examples && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif target-examples + +.PHONY: maybe-dvi-target-examples dvi-target-examples +maybe-dvi-target-examples: +@if target-examples +maybe-dvi-target-examples: dvi-target-examples + +dvi-target-examples: \ + configure-target-examples + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/examples/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing dvi in $(TARGET_SUBDIR)/examples" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/examples && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif target-examples + +.PHONY: maybe-html-target-examples html-target-examples +maybe-html-target-examples: +@if target-examples +maybe-html-target-examples: html-target-examples + +html-target-examples: \ + configure-target-examples + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/examples/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing html in $(TARGET_SUBDIR)/examples" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/examples && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif target-examples + +.PHONY: maybe-TAGS-target-examples TAGS-target-examples +maybe-TAGS-target-examples: +@if target-examples +maybe-TAGS-target-examples: TAGS-target-examples + +TAGS-target-examples: \ + configure-target-examples + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/examples/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing TAGS in $(TARGET_SUBDIR)/examples" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/examples && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif target-examples + +.PHONY: maybe-install-info-target-examples install-info-target-examples +maybe-install-info-target-examples: +@if target-examples +maybe-install-info-target-examples: install-info-target-examples + +install-info-target-examples: \ + configure-target-examples \ + info-target-examples + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/examples/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-info in $(TARGET_SUBDIR)/examples" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/examples && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif target-examples + +.PHONY: maybe-install-html-target-examples install-html-target-examples +maybe-install-html-target-examples: +@if target-examples +maybe-install-html-target-examples: install-html-target-examples + +install-html-target-examples: \ + configure-target-examples \ + html-target-examples + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/examples/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-html in $(TARGET_SUBDIR)/examples" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/examples && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif target-examples + +.PHONY: maybe-installcheck-target-examples installcheck-target-examples +maybe-installcheck-target-examples: +@if target-examples +maybe-installcheck-target-examples: installcheck-target-examples + +installcheck-target-examples: \ + configure-target-examples + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/examples/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing installcheck in $(TARGET_SUBDIR)/examples" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/examples && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif target-examples + +.PHONY: maybe-mostlyclean-target-examples mostlyclean-target-examples +maybe-mostlyclean-target-examples: +@if target-examples +maybe-mostlyclean-target-examples: mostlyclean-target-examples + +mostlyclean-target-examples: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/examples/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing mostlyclean in $(TARGET_SUBDIR)/examples" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/examples && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif target-examples + +.PHONY: maybe-clean-target-examples clean-target-examples +maybe-clean-target-examples: +@if target-examples +maybe-clean-target-examples: clean-target-examples + +clean-target-examples: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/examples/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing clean in $(TARGET_SUBDIR)/examples" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/examples && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif target-examples + +.PHONY: maybe-distclean-target-examples distclean-target-examples +maybe-distclean-target-examples: +@if target-examples +maybe-distclean-target-examples: distclean-target-examples + +distclean-target-examples: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/examples/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing distclean in $(TARGET_SUBDIR)/examples" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/examples && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif target-examples + +.PHONY: maybe-maintainer-clean-target-examples maintainer-clean-target-examples +maybe-maintainer-clean-target-examples: +@if target-examples +maybe-maintainer-clean-target-examples: maintainer-clean-target-examples + +maintainer-clean-target-examples: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/examples/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing maintainer-clean in $(TARGET_SUBDIR)/examples" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/examples && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif target-examples + + + + .PHONY: configure-target-libffi maybe-configure-target-libffi maybe-configure-target-libffi: - -# There's only one multilib.out. Cleverer subdirs shouldn't need it copied. -$(TARGET_SUBDIR)/libffi/multilib.out: multilib.out - $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libffi ; \ - rm -f $(TARGET_SUBDIR)/libffi/Makefile || : ; \ - cp multilib.out $(TARGET_SUBDIR)/libffi/multilib.out - -configure-target-libffi: $(TARGET_SUBDIR)/libffi/multilib.out - @test ! -f $(TARGET_SUBDIR)/libffi/Makefile || exit 0; \ - $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libffi ; \ - r=`${PWD_COMMAND}`; export r; \ +@if target-libffi +maybe-configure-target-libffi: configure-target-libffi +configure-target-libffi: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - AR="$(AR_FOR_TARGET)"; export AR; \ - AS="$(AS_FOR_TARGET)"; export AS; \ - CC="$(CC_FOR_TARGET)"; export CC; \ - CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \ - CXX="$(CXX_FOR_TARGET)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \ - GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \ - DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \ - LD="$(LD_FOR_TARGET)"; export LD; \ - LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \ - NM="$(NM_FOR_TARGET)"; export NM; \ - RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \ - WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \ + echo "Checking multilib configuration for libffi..."; \ + $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libffi ; \ + $(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/libffi/multilib.tmp 2> /dev/null ; \ + if test -r $(TARGET_SUBDIR)/libffi/multilib.out; then \ + if cmp -s $(TARGET_SUBDIR)/libffi/multilib.tmp $(TARGET_SUBDIR)/libffi/multilib.out; then \ + rm -f $(TARGET_SUBDIR)/libffi/multilib.tmp; \ + else \ + rm -f $(TARGET_SUBDIR)/libffi/Makefile; \ + mv $(TARGET_SUBDIR)/libffi/multilib.tmp $(TARGET_SUBDIR)/libffi/multilib.out; \ + fi; \ + else \ + mv $(TARGET_SUBDIR)/libffi/multilib.tmp $(TARGET_SUBDIR)/libffi/multilib.out; \ + fi; \ + test ! -f $(TARGET_SUBDIR)/libffi/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libffi ; \ + $(NORMAL_TARGET_EXPORTS) \ echo Configuring in $(TARGET_SUBDIR)/libffi; \ cd "$(TARGET_SUBDIR)/libffi" || exit 1; \ case $(srcdir) in \ - /* | [A-Za-z]:[\\/]*) \ - topdir=$(srcdir) ;; \ - *) \ - case "$(TARGET_SUBDIR)" in \ - .) topdir="../$(srcdir)" ;; \ - *) topdir="../../$(srcdir)" ;; \ - esac ;; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(TARGET_SUBDIR)/libffi/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ - srcdiroption="--srcdir=$${topdir}/libffi"; \ - libsrcdir="$$s/libffi"; \ + srcdiroption="--srcdir=$${topdir}/libffi"; \ + libsrcdir="$$s/libffi"; \ rm -f no-such-file || : ; \ CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \ - $(TARGET_CONFIGARGS) $${srcdiroption} \ - --with-target-subdir="$(TARGET_SUBDIR)" \ + $(TARGET_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif target-libffi + + + + .PHONY: all-target-libffi maybe-all-target-libffi maybe-all-target-libffi: +@if target-libffi +TARGET-target-libffi=all +maybe-all-target-libffi: all-target-libffi all-target-libffi: configure-target-libffi + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(NORMAL_TARGET_EXPORTS) \ (cd $(TARGET_SUBDIR)/libffi && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) all) + $(MAKE) $(TARGET_FLAGS_TO_PASS) $(TARGET-target-libffi)) +@endif target-libffi + + + + .PHONY: check-target-libffi maybe-check-target-libffi maybe-check-target-libffi: +@if target-libffi +maybe-check-target-libffi: check-target-libffi check-target-libffi: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(NORMAL_TARGET_EXPORTS) \ (cd $(TARGET_SUBDIR)/libffi && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) check) + $(MAKE) $(TARGET_FLAGS_TO_PASS) check) +@endif target-libffi .PHONY: install-target-libffi maybe-install-target-libffi maybe-install-target-libffi: +@if target-libffi +maybe-install-target-libffi: install-target-libffi install-target-libffi: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(NORMAL_TARGET_EXPORTS) \ (cd $(TARGET_SUBDIR)/libffi && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) install) + $(MAKE) $(TARGET_FLAGS_TO_PASS) install) + +@endif target-libffi + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-target-libffi info-target-libffi +maybe-info-target-libffi: +@if target-libffi +maybe-info-target-libffi: info-target-libffi + +info-target-libffi: \ + configure-target-libffi + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libffi/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing info in $(TARGET_SUBDIR)/libffi" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libffi && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif target-libffi + +.PHONY: maybe-dvi-target-libffi dvi-target-libffi +maybe-dvi-target-libffi: +@if target-libffi +maybe-dvi-target-libffi: dvi-target-libffi + +dvi-target-libffi: \ + configure-target-libffi + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libffi/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing dvi in $(TARGET_SUBDIR)/libffi" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libffi && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif target-libffi + +.PHONY: maybe-html-target-libffi html-target-libffi +maybe-html-target-libffi: +@if target-libffi +maybe-html-target-libffi: html-target-libffi + +html-target-libffi: \ + configure-target-libffi + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libffi/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing html in $(TARGET_SUBDIR)/libffi" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libffi && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif target-libffi + +.PHONY: maybe-TAGS-target-libffi TAGS-target-libffi +maybe-TAGS-target-libffi: +@if target-libffi +maybe-TAGS-target-libffi: TAGS-target-libffi + +TAGS-target-libffi: \ + configure-target-libffi + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libffi/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing TAGS in $(TARGET_SUBDIR)/libffi" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libffi && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif target-libffi + +.PHONY: maybe-install-info-target-libffi install-info-target-libffi +maybe-install-info-target-libffi: +@if target-libffi +maybe-install-info-target-libffi: install-info-target-libffi + +install-info-target-libffi: \ + configure-target-libffi \ + info-target-libffi + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libffi/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-info in $(TARGET_SUBDIR)/libffi" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libffi && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif target-libffi + +.PHONY: maybe-install-html-target-libffi install-html-target-libffi +maybe-install-html-target-libffi: +@if target-libffi +maybe-install-html-target-libffi: install-html-target-libffi + +install-html-target-libffi: \ + configure-target-libffi \ + html-target-libffi + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libffi/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-html in $(TARGET_SUBDIR)/libffi" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libffi && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif target-libffi + +.PHONY: maybe-installcheck-target-libffi installcheck-target-libffi +maybe-installcheck-target-libffi: +@if target-libffi +maybe-installcheck-target-libffi: installcheck-target-libffi + +installcheck-target-libffi: \ + configure-target-libffi + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libffi/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing installcheck in $(TARGET_SUBDIR)/libffi" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libffi && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif target-libffi + +.PHONY: maybe-mostlyclean-target-libffi mostlyclean-target-libffi +maybe-mostlyclean-target-libffi: +@if target-libffi +maybe-mostlyclean-target-libffi: mostlyclean-target-libffi + +mostlyclean-target-libffi: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libffi/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing mostlyclean in $(TARGET_SUBDIR)/libffi" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libffi && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif target-libffi + +.PHONY: maybe-clean-target-libffi clean-target-libffi +maybe-clean-target-libffi: +@if target-libffi +maybe-clean-target-libffi: clean-target-libffi + +clean-target-libffi: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libffi/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing clean in $(TARGET_SUBDIR)/libffi" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libffi && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif target-libffi + +.PHONY: maybe-distclean-target-libffi distclean-target-libffi +maybe-distclean-target-libffi: +@if target-libffi +maybe-distclean-target-libffi: distclean-target-libffi + +distclean-target-libffi: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libffi/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing distclean in $(TARGET_SUBDIR)/libffi" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libffi && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif target-libffi + +.PHONY: maybe-maintainer-clean-target-libffi maintainer-clean-target-libffi +maybe-maintainer-clean-target-libffi: +@if target-libffi +maybe-maintainer-clean-target-libffi: maintainer-clean-target-libffi + +maintainer-clean-target-libffi: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libffi/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing maintainer-clean in $(TARGET_SUBDIR)/libffi" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libffi && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif target-libffi + + + .PHONY: configure-target-libjava maybe-configure-target-libjava maybe-configure-target-libjava: - -# There's only one multilib.out. Cleverer subdirs shouldn't need it copied. -$(TARGET_SUBDIR)/libjava/multilib.out: multilib.out - $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libjava ; \ - rm -f $(TARGET_SUBDIR)/libjava/Makefile || : ; \ - cp multilib.out $(TARGET_SUBDIR)/libjava/multilib.out - -configure-target-libjava: $(TARGET_SUBDIR)/libjava/multilib.out - @test ! -f $(TARGET_SUBDIR)/libjava/Makefile || exit 0; \ - $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libjava ; \ - r=`${PWD_COMMAND}`; export r; \ +@if target-libjava +maybe-configure-target-libjava: configure-target-libjava +configure-target-libjava: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - AR="$(AR_FOR_TARGET)"; export AR; \ - AS="$(AS_FOR_TARGET)"; export AS; \ - CC="$(CC_FOR_TARGET)"; export CC; \ - CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \ - CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \ - CXX="$(RAW_CXX_FOR_TARGET)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \ - GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \ - DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \ - LD="$(LD_FOR_TARGET)"; export LD; \ - LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \ - NM="$(NM_FOR_TARGET)"; export NM; \ - RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \ - WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \ + echo "Checking multilib configuration for libjava..."; \ + $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libjava ; \ + $(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/libjava/multilib.tmp 2> /dev/null ; \ + if test -r $(TARGET_SUBDIR)/libjava/multilib.out; then \ + if cmp -s $(TARGET_SUBDIR)/libjava/multilib.tmp $(TARGET_SUBDIR)/libjava/multilib.out; then \ + rm -f $(TARGET_SUBDIR)/libjava/multilib.tmp; \ + else \ + rm -f $(TARGET_SUBDIR)/libjava/Makefile; \ + mv $(TARGET_SUBDIR)/libjava/multilib.tmp $(TARGET_SUBDIR)/libjava/multilib.out; \ + fi; \ + else \ + mv $(TARGET_SUBDIR)/libjava/multilib.tmp $(TARGET_SUBDIR)/libjava/multilib.out; \ + fi; \ + test ! -f $(TARGET_SUBDIR)/libjava/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libjava ; \ + $(RAW_CXX_TARGET_EXPORTS) \ echo Configuring in $(TARGET_SUBDIR)/libjava; \ cd "$(TARGET_SUBDIR)/libjava" || exit 1; \ case $(srcdir) in \ - /* | [A-Za-z]:[\\/]*) \ - topdir=$(srcdir) ;; \ - *) \ - case "$(TARGET_SUBDIR)" in \ - .) topdir="../$(srcdir)" ;; \ - *) topdir="../../$(srcdir)" ;; \ - esac ;; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(TARGET_SUBDIR)/libjava/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ - srcdiroption="--srcdir=$${topdir}/libjava"; \ - libsrcdir="$$s/libjava"; \ + srcdiroption="--srcdir=$${topdir}/libjava"; \ + libsrcdir="$$s/libjava"; \ rm -f no-such-file || : ; \ CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \ - $(TARGET_CONFIGARGS) $${srcdiroption} \ - --with-target-subdir="$(TARGET_SUBDIR)" \ + $(TARGET_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif target-libjava + + + + .PHONY: all-target-libjava maybe-all-target-libjava maybe-all-target-libjava: +@if target-libjava +TARGET-target-libjava=all +maybe-all-target-libjava: all-target-libjava all-target-libjava: configure-target-libjava + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(RAW_CXX_TARGET_EXPORTS) \ (cd $(TARGET_SUBDIR)/libjava && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)' all) + $(MAKE) $(TARGET_FLAGS_TO_PASS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)' $(TARGET-target-libjava)) +@endif target-libjava + + + + .PHONY: check-target-libjava maybe-check-target-libjava maybe-check-target-libjava: +@if target-libjava +maybe-check-target-libjava: check-target-libjava check-target-libjava: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(RAW_CXX_TARGET_EXPORTS) \ (cd $(TARGET_SUBDIR)/libjava && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)' check) + $(MAKE) $(TARGET_FLAGS_TO_PASS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)' check) +@endif target-libjava .PHONY: install-target-libjava maybe-install-target-libjava maybe-install-target-libjava: +@if target-libjava +maybe-install-target-libjava: install-target-libjava install-target-libjava: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(RAW_CXX_TARGET_EXPORTS) \ (cd $(TARGET_SUBDIR)/libjava && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) install) + $(MAKE) $(TARGET_FLAGS_TO_PASS) install) + +@endif target-libjava + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-target-libjava info-target-libjava +maybe-info-target-libjava: +@if target-libjava +maybe-info-target-libjava: info-target-libjava + +info-target-libjava: \ + configure-target-libjava + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libjava/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(RAW_CXX_TARGET_EXPORTS) \ + echo "Doing info in $(TARGET_SUBDIR)/libjava" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libjava && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif target-libjava + +.PHONY: maybe-dvi-target-libjava dvi-target-libjava +maybe-dvi-target-libjava: +@if target-libjava +maybe-dvi-target-libjava: dvi-target-libjava + +dvi-target-libjava: \ + configure-target-libjava + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libjava/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(RAW_CXX_TARGET_EXPORTS) \ + echo "Doing dvi in $(TARGET_SUBDIR)/libjava" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libjava && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif target-libjava + +.PHONY: maybe-html-target-libjava html-target-libjava +maybe-html-target-libjava: +@if target-libjava +maybe-html-target-libjava: html-target-libjava + +html-target-libjava: \ + configure-target-libjava + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libjava/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(RAW_CXX_TARGET_EXPORTS) \ + echo "Doing html in $(TARGET_SUBDIR)/libjava" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libjava && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif target-libjava + +.PHONY: maybe-TAGS-target-libjava TAGS-target-libjava +maybe-TAGS-target-libjava: +@if target-libjava +maybe-TAGS-target-libjava: TAGS-target-libjava + +TAGS-target-libjava: \ + configure-target-libjava + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libjava/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(RAW_CXX_TARGET_EXPORTS) \ + echo "Doing TAGS in $(TARGET_SUBDIR)/libjava" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libjava && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif target-libjava + +.PHONY: maybe-install-info-target-libjava install-info-target-libjava +maybe-install-info-target-libjava: +@if target-libjava +maybe-install-info-target-libjava: install-info-target-libjava + +install-info-target-libjava: \ + configure-target-libjava \ + info-target-libjava + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libjava/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(RAW_CXX_TARGET_EXPORTS) \ + echo "Doing install-info in $(TARGET_SUBDIR)/libjava" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libjava && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif target-libjava + +.PHONY: maybe-install-html-target-libjava install-html-target-libjava +maybe-install-html-target-libjava: +@if target-libjava +maybe-install-html-target-libjava: install-html-target-libjava + +install-html-target-libjava: \ + configure-target-libjava \ + html-target-libjava + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libjava/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(RAW_CXX_TARGET_EXPORTS) \ + echo "Doing install-html in $(TARGET_SUBDIR)/libjava" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libjava && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif target-libjava + +.PHONY: maybe-installcheck-target-libjava installcheck-target-libjava +maybe-installcheck-target-libjava: +@if target-libjava +maybe-installcheck-target-libjava: installcheck-target-libjava + +installcheck-target-libjava: \ + configure-target-libjava + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libjava/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(RAW_CXX_TARGET_EXPORTS) \ + echo "Doing installcheck in $(TARGET_SUBDIR)/libjava" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libjava && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif target-libjava + +.PHONY: maybe-mostlyclean-target-libjava mostlyclean-target-libjava +maybe-mostlyclean-target-libjava: +@if target-libjava +maybe-mostlyclean-target-libjava: mostlyclean-target-libjava + +mostlyclean-target-libjava: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libjava/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(RAW_CXX_TARGET_EXPORTS) \ + echo "Doing mostlyclean in $(TARGET_SUBDIR)/libjava" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libjava && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif target-libjava + +.PHONY: maybe-clean-target-libjava clean-target-libjava +maybe-clean-target-libjava: +@if target-libjava +maybe-clean-target-libjava: clean-target-libjava + +clean-target-libjava: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libjava/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(RAW_CXX_TARGET_EXPORTS) \ + echo "Doing clean in $(TARGET_SUBDIR)/libjava" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libjava && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif target-libjava + +.PHONY: maybe-distclean-target-libjava distclean-target-libjava +maybe-distclean-target-libjava: +@if target-libjava +maybe-distclean-target-libjava: distclean-target-libjava + +distclean-target-libjava: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libjava/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(RAW_CXX_TARGET_EXPORTS) \ + echo "Doing distclean in $(TARGET_SUBDIR)/libjava" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libjava && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif target-libjava + +.PHONY: maybe-maintainer-clean-target-libjava maintainer-clean-target-libjava +maybe-maintainer-clean-target-libjava: +@if target-libjava +maybe-maintainer-clean-target-libjava: maintainer-clean-target-libjava + +maintainer-clean-target-libjava: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libjava/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(RAW_CXX_TARGET_EXPORTS) \ + echo "Doing maintainer-clean in $(TARGET_SUBDIR)/libjava" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libjava && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif target-libjava + + + .PHONY: configure-target-zlib maybe-configure-target-zlib maybe-configure-target-zlib: - -# There's only one multilib.out. Cleverer subdirs shouldn't need it copied. -$(TARGET_SUBDIR)/zlib/multilib.out: multilib.out - $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/zlib ; \ - rm -f $(TARGET_SUBDIR)/zlib/Makefile || : ; \ - cp multilib.out $(TARGET_SUBDIR)/zlib/multilib.out - -configure-target-zlib: $(TARGET_SUBDIR)/zlib/multilib.out - @test ! -f $(TARGET_SUBDIR)/zlib/Makefile || exit 0; \ - $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/zlib ; \ - r=`${PWD_COMMAND}`; export r; \ +@if target-zlib +maybe-configure-target-zlib: configure-target-zlib +configure-target-zlib: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - AR="$(AR_FOR_TARGET)"; export AR; \ - AS="$(AS_FOR_TARGET)"; export AS; \ - CC="$(CC_FOR_TARGET)"; export CC; \ - CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \ - CXX="$(CXX_FOR_TARGET)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \ - GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \ - DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \ - LD="$(LD_FOR_TARGET)"; export LD; \ - LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \ - NM="$(NM_FOR_TARGET)"; export NM; \ - RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \ - WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \ + echo "Checking multilib configuration for zlib..."; \ + $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/zlib ; \ + $(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/zlib/multilib.tmp 2> /dev/null ; \ + if test -r $(TARGET_SUBDIR)/zlib/multilib.out; then \ + if cmp -s $(TARGET_SUBDIR)/zlib/multilib.tmp $(TARGET_SUBDIR)/zlib/multilib.out; then \ + rm -f $(TARGET_SUBDIR)/zlib/multilib.tmp; \ + else \ + rm -f $(TARGET_SUBDIR)/zlib/Makefile; \ + mv $(TARGET_SUBDIR)/zlib/multilib.tmp $(TARGET_SUBDIR)/zlib/multilib.out; \ + fi; \ + else \ + mv $(TARGET_SUBDIR)/zlib/multilib.tmp $(TARGET_SUBDIR)/zlib/multilib.out; \ + fi; \ + test ! -f $(TARGET_SUBDIR)/zlib/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/zlib ; \ + $(NORMAL_TARGET_EXPORTS) \ echo Configuring in $(TARGET_SUBDIR)/zlib; \ cd "$(TARGET_SUBDIR)/zlib" || exit 1; \ case $(srcdir) in \ - /* | [A-Za-z]:[\\/]*) \ - topdir=$(srcdir) ;; \ - *) \ - case "$(TARGET_SUBDIR)" in \ - .) topdir="../$(srcdir)" ;; \ - *) topdir="../../$(srcdir)" ;; \ - esac ;; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(TARGET_SUBDIR)/zlib/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ - if [ "$(srcdir)" = "." ] ; then \ - if [ "$(TARGET_SUBDIR)" != "." ] ; then \ - if $(SHELL) $$s/symlink-tree $${topdir}/zlib "no-such-file" ; then \ - if [ -f Makefile ]; then \ - if $(MAKE) distclean; then \ - true; \ - else \ - exit 1; \ - fi; \ - else \ - true; \ - fi; \ - else \ - exit 1; \ - fi; \ - else \ - true; \ - fi; \ - srcdiroption="--srcdir=."; \ - libsrcdir="."; \ - else \ - srcdiroption="--srcdir=$${topdir}/zlib"; \ - libsrcdir="$$s/zlib"; \ - fi; \ + srcdiroption="--srcdir=$${topdir}/zlib"; \ + libsrcdir="$$s/zlib"; \ rm -f no-such-file || : ; \ CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \ - $(TARGET_CONFIGARGS) $${srcdiroption} \ - --with-target-subdir="$(TARGET_SUBDIR)" \ + $(TARGET_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif target-zlib + + + + .PHONY: all-target-zlib maybe-all-target-zlib maybe-all-target-zlib: +@if target-zlib +TARGET-target-zlib=all +maybe-all-target-zlib: all-target-zlib all-target-zlib: configure-target-zlib + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(NORMAL_TARGET_EXPORTS) \ (cd $(TARGET_SUBDIR)/zlib && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) all) + $(MAKE) $(TARGET_FLAGS_TO_PASS) $(TARGET-target-zlib)) +@endif target-zlib + + + + .PHONY: check-target-zlib maybe-check-target-zlib maybe-check-target-zlib: +@if target-zlib +maybe-check-target-zlib: check-target-zlib check-target-zlib: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(NORMAL_TARGET_EXPORTS) \ (cd $(TARGET_SUBDIR)/zlib && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) check) + $(MAKE) $(TARGET_FLAGS_TO_PASS) check) +@endif target-zlib .PHONY: install-target-zlib maybe-install-target-zlib maybe-install-target-zlib: +@if target-zlib +maybe-install-target-zlib: install-target-zlib install-target-zlib: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(NORMAL_TARGET_EXPORTS) \ (cd $(TARGET_SUBDIR)/zlib && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) install) + $(MAKE) $(TARGET_FLAGS_TO_PASS) install) + +@endif target-zlib + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-target-zlib info-target-zlib +maybe-info-target-zlib: +@if target-zlib +maybe-info-target-zlib: info-target-zlib + +info-target-zlib: \ + configure-target-zlib + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/zlib/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing info in $(TARGET_SUBDIR)/zlib" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/zlib && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif target-zlib + +.PHONY: maybe-dvi-target-zlib dvi-target-zlib +maybe-dvi-target-zlib: +@if target-zlib +maybe-dvi-target-zlib: dvi-target-zlib + +dvi-target-zlib: \ + configure-target-zlib + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/zlib/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing dvi in $(TARGET_SUBDIR)/zlib" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/zlib && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif target-zlib + +.PHONY: maybe-html-target-zlib html-target-zlib +maybe-html-target-zlib: +@if target-zlib +maybe-html-target-zlib: html-target-zlib + +html-target-zlib: \ + configure-target-zlib + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/zlib/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing html in $(TARGET_SUBDIR)/zlib" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/zlib && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif target-zlib + +.PHONY: maybe-TAGS-target-zlib TAGS-target-zlib +maybe-TAGS-target-zlib: +@if target-zlib +maybe-TAGS-target-zlib: TAGS-target-zlib + +TAGS-target-zlib: \ + configure-target-zlib + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/zlib/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing TAGS in $(TARGET_SUBDIR)/zlib" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/zlib && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif target-zlib + +.PHONY: maybe-install-info-target-zlib install-info-target-zlib +maybe-install-info-target-zlib: +@if target-zlib +maybe-install-info-target-zlib: install-info-target-zlib + +install-info-target-zlib: \ + configure-target-zlib \ + info-target-zlib + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/zlib/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-info in $(TARGET_SUBDIR)/zlib" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/zlib && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif target-zlib + +.PHONY: maybe-install-html-target-zlib install-html-target-zlib +maybe-install-html-target-zlib: +@if target-zlib +maybe-install-html-target-zlib: install-html-target-zlib + +install-html-target-zlib: \ + configure-target-zlib \ + html-target-zlib + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/zlib/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-html in $(TARGET_SUBDIR)/zlib" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/zlib && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif target-zlib + +.PHONY: maybe-installcheck-target-zlib installcheck-target-zlib +maybe-installcheck-target-zlib: +@if target-zlib +maybe-installcheck-target-zlib: installcheck-target-zlib + +installcheck-target-zlib: \ + configure-target-zlib + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/zlib/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing installcheck in $(TARGET_SUBDIR)/zlib" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/zlib && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif target-zlib + +.PHONY: maybe-mostlyclean-target-zlib mostlyclean-target-zlib +maybe-mostlyclean-target-zlib: +@if target-zlib +maybe-mostlyclean-target-zlib: mostlyclean-target-zlib + +mostlyclean-target-zlib: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/zlib/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing mostlyclean in $(TARGET_SUBDIR)/zlib" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/zlib && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif target-zlib + +.PHONY: maybe-clean-target-zlib clean-target-zlib +maybe-clean-target-zlib: +@if target-zlib +maybe-clean-target-zlib: clean-target-zlib + +clean-target-zlib: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/zlib/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing clean in $(TARGET_SUBDIR)/zlib" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/zlib && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif target-zlib + +.PHONY: maybe-distclean-target-zlib distclean-target-zlib +maybe-distclean-target-zlib: +@if target-zlib +maybe-distclean-target-zlib: distclean-target-zlib + +distclean-target-zlib: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/zlib/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing distclean in $(TARGET_SUBDIR)/zlib" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/zlib && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif target-zlib + +.PHONY: maybe-maintainer-clean-target-zlib maintainer-clean-target-zlib +maybe-maintainer-clean-target-zlib: +@if target-zlib +maybe-maintainer-clean-target-zlib: maintainer-clean-target-zlib + +maintainer-clean-target-zlib: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/zlib/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing maintainer-clean in $(TARGET_SUBDIR)/zlib" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/zlib && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif target-zlib + + + .PHONY: configure-target-boehm-gc maybe-configure-target-boehm-gc maybe-configure-target-boehm-gc: - -# There's only one multilib.out. Cleverer subdirs shouldn't need it copied. -$(TARGET_SUBDIR)/boehm-gc/multilib.out: multilib.out - $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/boehm-gc ; \ - rm -f $(TARGET_SUBDIR)/boehm-gc/Makefile || : ; \ - cp multilib.out $(TARGET_SUBDIR)/boehm-gc/multilib.out - -configure-target-boehm-gc: $(TARGET_SUBDIR)/boehm-gc/multilib.out - @test ! -f $(TARGET_SUBDIR)/boehm-gc/Makefile || exit 0; \ - $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/boehm-gc ; \ - r=`${PWD_COMMAND}`; export r; \ +@if target-boehm-gc +maybe-configure-target-boehm-gc: configure-target-boehm-gc +configure-target-boehm-gc: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - AR="$(AR_FOR_TARGET)"; export AR; \ - AS="$(AS_FOR_TARGET)"; export AS; \ - CC="$(CC_FOR_TARGET)"; export CC; \ - CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \ - CXX="$(CXX_FOR_TARGET)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \ - GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \ - DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \ - LD="$(LD_FOR_TARGET)"; export LD; \ - LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \ - NM="$(NM_FOR_TARGET)"; export NM; \ - RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \ - WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \ + echo "Checking multilib configuration for boehm-gc..."; \ + $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/boehm-gc ; \ + $(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/boehm-gc/multilib.tmp 2> /dev/null ; \ + if test -r $(TARGET_SUBDIR)/boehm-gc/multilib.out; then \ + if cmp -s $(TARGET_SUBDIR)/boehm-gc/multilib.tmp $(TARGET_SUBDIR)/boehm-gc/multilib.out; then \ + rm -f $(TARGET_SUBDIR)/boehm-gc/multilib.tmp; \ + else \ + rm -f $(TARGET_SUBDIR)/boehm-gc/Makefile; \ + mv $(TARGET_SUBDIR)/boehm-gc/multilib.tmp $(TARGET_SUBDIR)/boehm-gc/multilib.out; \ + fi; \ + else \ + mv $(TARGET_SUBDIR)/boehm-gc/multilib.tmp $(TARGET_SUBDIR)/boehm-gc/multilib.out; \ + fi; \ + test ! -f $(TARGET_SUBDIR)/boehm-gc/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/boehm-gc ; \ + $(NORMAL_TARGET_EXPORTS) \ echo Configuring in $(TARGET_SUBDIR)/boehm-gc; \ cd "$(TARGET_SUBDIR)/boehm-gc" || exit 1; \ case $(srcdir) in \ - /* | [A-Za-z]:[\\/]*) \ - topdir=$(srcdir) ;; \ - *) \ - case "$(TARGET_SUBDIR)" in \ - .) topdir="../$(srcdir)" ;; \ - *) topdir="../../$(srcdir)" ;; \ - esac ;; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(TARGET_SUBDIR)/boehm-gc/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ - srcdiroption="--srcdir=$${topdir}/boehm-gc"; \ - libsrcdir="$$s/boehm-gc"; \ + srcdiroption="--srcdir=$${topdir}/boehm-gc"; \ + libsrcdir="$$s/boehm-gc"; \ rm -f no-such-file || : ; \ CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \ - $(TARGET_CONFIGARGS) $${srcdiroption} \ - --with-target-subdir="$(TARGET_SUBDIR)" \ + $(TARGET_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif target-boehm-gc + + + + .PHONY: all-target-boehm-gc maybe-all-target-boehm-gc maybe-all-target-boehm-gc: +@if target-boehm-gc +TARGET-target-boehm-gc=all +maybe-all-target-boehm-gc: all-target-boehm-gc all-target-boehm-gc: configure-target-boehm-gc + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(NORMAL_TARGET_EXPORTS) \ (cd $(TARGET_SUBDIR)/boehm-gc && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) all) + $(MAKE) $(TARGET_FLAGS_TO_PASS) $(TARGET-target-boehm-gc)) +@endif target-boehm-gc + + + + .PHONY: check-target-boehm-gc maybe-check-target-boehm-gc maybe-check-target-boehm-gc: +@if target-boehm-gc +maybe-check-target-boehm-gc: check-target-boehm-gc check-target-boehm-gc: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(NORMAL_TARGET_EXPORTS) \ (cd $(TARGET_SUBDIR)/boehm-gc && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) check) + $(MAKE) $(TARGET_FLAGS_TO_PASS) check) +@endif target-boehm-gc .PHONY: install-target-boehm-gc maybe-install-target-boehm-gc maybe-install-target-boehm-gc: +@if target-boehm-gc +maybe-install-target-boehm-gc: install-target-boehm-gc install-target-boehm-gc: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(NORMAL_TARGET_EXPORTS) \ (cd $(TARGET_SUBDIR)/boehm-gc && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) install) + $(MAKE) $(TARGET_FLAGS_TO_PASS) install) + +@endif target-boehm-gc + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-target-boehm-gc info-target-boehm-gc +maybe-info-target-boehm-gc: +@if target-boehm-gc +maybe-info-target-boehm-gc: info-target-boehm-gc + +info-target-boehm-gc: \ + configure-target-boehm-gc + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/boehm-gc/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing info in $(TARGET_SUBDIR)/boehm-gc" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/boehm-gc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif target-boehm-gc + +.PHONY: maybe-dvi-target-boehm-gc dvi-target-boehm-gc +maybe-dvi-target-boehm-gc: +@if target-boehm-gc +maybe-dvi-target-boehm-gc: dvi-target-boehm-gc + +dvi-target-boehm-gc: \ + configure-target-boehm-gc + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/boehm-gc/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing dvi in $(TARGET_SUBDIR)/boehm-gc" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/boehm-gc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif target-boehm-gc + +.PHONY: maybe-html-target-boehm-gc html-target-boehm-gc +maybe-html-target-boehm-gc: +@if target-boehm-gc +maybe-html-target-boehm-gc: html-target-boehm-gc + +html-target-boehm-gc: \ + configure-target-boehm-gc + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/boehm-gc/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing html in $(TARGET_SUBDIR)/boehm-gc" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/boehm-gc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif target-boehm-gc + +.PHONY: maybe-TAGS-target-boehm-gc TAGS-target-boehm-gc +maybe-TAGS-target-boehm-gc: +@if target-boehm-gc +maybe-TAGS-target-boehm-gc: TAGS-target-boehm-gc + +TAGS-target-boehm-gc: \ + configure-target-boehm-gc + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/boehm-gc/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing TAGS in $(TARGET_SUBDIR)/boehm-gc" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/boehm-gc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif target-boehm-gc + +.PHONY: maybe-install-info-target-boehm-gc install-info-target-boehm-gc +maybe-install-info-target-boehm-gc: +@if target-boehm-gc +maybe-install-info-target-boehm-gc: install-info-target-boehm-gc + +install-info-target-boehm-gc: \ + configure-target-boehm-gc \ + info-target-boehm-gc + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/boehm-gc/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-info in $(TARGET_SUBDIR)/boehm-gc" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/boehm-gc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif target-boehm-gc + +.PHONY: maybe-install-html-target-boehm-gc install-html-target-boehm-gc +maybe-install-html-target-boehm-gc: +@if target-boehm-gc +maybe-install-html-target-boehm-gc: install-html-target-boehm-gc + +install-html-target-boehm-gc: \ + configure-target-boehm-gc \ + html-target-boehm-gc + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/boehm-gc/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-html in $(TARGET_SUBDIR)/boehm-gc" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/boehm-gc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif target-boehm-gc + +.PHONY: maybe-installcheck-target-boehm-gc installcheck-target-boehm-gc +maybe-installcheck-target-boehm-gc: +@if target-boehm-gc +maybe-installcheck-target-boehm-gc: installcheck-target-boehm-gc + +installcheck-target-boehm-gc: \ + configure-target-boehm-gc + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/boehm-gc/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing installcheck in $(TARGET_SUBDIR)/boehm-gc" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/boehm-gc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif target-boehm-gc + +.PHONY: maybe-mostlyclean-target-boehm-gc mostlyclean-target-boehm-gc +maybe-mostlyclean-target-boehm-gc: +@if target-boehm-gc +maybe-mostlyclean-target-boehm-gc: mostlyclean-target-boehm-gc + +mostlyclean-target-boehm-gc: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/boehm-gc/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing mostlyclean in $(TARGET_SUBDIR)/boehm-gc" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/boehm-gc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif target-boehm-gc + +.PHONY: maybe-clean-target-boehm-gc clean-target-boehm-gc +maybe-clean-target-boehm-gc: +@if target-boehm-gc +maybe-clean-target-boehm-gc: clean-target-boehm-gc + +clean-target-boehm-gc: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/boehm-gc/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing clean in $(TARGET_SUBDIR)/boehm-gc" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/boehm-gc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif target-boehm-gc + +.PHONY: maybe-distclean-target-boehm-gc distclean-target-boehm-gc +maybe-distclean-target-boehm-gc: +@if target-boehm-gc +maybe-distclean-target-boehm-gc: distclean-target-boehm-gc + +distclean-target-boehm-gc: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/boehm-gc/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing distclean in $(TARGET_SUBDIR)/boehm-gc" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/boehm-gc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif target-boehm-gc + +.PHONY: maybe-maintainer-clean-target-boehm-gc maintainer-clean-target-boehm-gc +maybe-maintainer-clean-target-boehm-gc: +@if target-boehm-gc +maybe-maintainer-clean-target-boehm-gc: maintainer-clean-target-boehm-gc + +maintainer-clean-target-boehm-gc: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/boehm-gc/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing maintainer-clean in $(TARGET_SUBDIR)/boehm-gc" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/boehm-gc && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif target-boehm-gc + + + .PHONY: configure-target-qthreads maybe-configure-target-qthreads maybe-configure-target-qthreads: - -# There's only one multilib.out. Cleverer subdirs shouldn't need it copied. -$(TARGET_SUBDIR)/qthreads/multilib.out: multilib.out - $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/qthreads ; \ - rm -f $(TARGET_SUBDIR)/qthreads/Makefile || : ; \ - cp multilib.out $(TARGET_SUBDIR)/qthreads/multilib.out - -configure-target-qthreads: $(TARGET_SUBDIR)/qthreads/multilib.out - @test ! -f $(TARGET_SUBDIR)/qthreads/Makefile || exit 0; \ - $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/qthreads ; \ - r=`${PWD_COMMAND}`; export r; \ +@if target-qthreads +maybe-configure-target-qthreads: configure-target-qthreads +configure-target-qthreads: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - AR="$(AR_FOR_TARGET)"; export AR; \ - AS="$(AS_FOR_TARGET)"; export AS; \ - CC="$(CC_FOR_TARGET)"; export CC; \ - CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \ - CXX="$(CXX_FOR_TARGET)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \ - GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \ - DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \ - LD="$(LD_FOR_TARGET)"; export LD; \ - LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \ - NM="$(NM_FOR_TARGET)"; export NM; \ - RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \ - WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \ + echo "Checking multilib configuration for qthreads..."; \ + $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/qthreads ; \ + $(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/qthreads/multilib.tmp 2> /dev/null ; \ + if test -r $(TARGET_SUBDIR)/qthreads/multilib.out; then \ + if cmp -s $(TARGET_SUBDIR)/qthreads/multilib.tmp $(TARGET_SUBDIR)/qthreads/multilib.out; then \ + rm -f $(TARGET_SUBDIR)/qthreads/multilib.tmp; \ + else \ + rm -f $(TARGET_SUBDIR)/qthreads/Makefile; \ + mv $(TARGET_SUBDIR)/qthreads/multilib.tmp $(TARGET_SUBDIR)/qthreads/multilib.out; \ + fi; \ + else \ + mv $(TARGET_SUBDIR)/qthreads/multilib.tmp $(TARGET_SUBDIR)/qthreads/multilib.out; \ + fi; \ + test ! -f $(TARGET_SUBDIR)/qthreads/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/qthreads ; \ + $(NORMAL_TARGET_EXPORTS) \ echo Configuring in $(TARGET_SUBDIR)/qthreads; \ cd "$(TARGET_SUBDIR)/qthreads" || exit 1; \ case $(srcdir) in \ - /* | [A-Za-z]:[\\/]*) \ - topdir=$(srcdir) ;; \ - *) \ - case "$(TARGET_SUBDIR)" in \ - .) topdir="../$(srcdir)" ;; \ - *) topdir="../../$(srcdir)" ;; \ - esac ;; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(TARGET_SUBDIR)/qthreads/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ - srcdiroption="--srcdir=$${topdir}/qthreads"; \ - libsrcdir="$$s/qthreads"; \ + srcdiroption="--srcdir=$${topdir}/qthreads"; \ + libsrcdir="$$s/qthreads"; \ rm -f no-such-file || : ; \ CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \ - $(TARGET_CONFIGARGS) $${srcdiroption} \ - --with-target-subdir="$(TARGET_SUBDIR)" \ + $(TARGET_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif target-qthreads + + + + .PHONY: all-target-qthreads maybe-all-target-qthreads maybe-all-target-qthreads: +@if target-qthreads +TARGET-target-qthreads=all +maybe-all-target-qthreads: all-target-qthreads all-target-qthreads: configure-target-qthreads + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(NORMAL_TARGET_EXPORTS) \ (cd $(TARGET_SUBDIR)/qthreads && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) all) + $(MAKE) $(TARGET_FLAGS_TO_PASS) $(TARGET-target-qthreads)) +@endif target-qthreads + + + + .PHONY: check-target-qthreads maybe-check-target-qthreads maybe-check-target-qthreads: +@if target-qthreads +maybe-check-target-qthreads: check-target-qthreads check-target-qthreads: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(NORMAL_TARGET_EXPORTS) \ (cd $(TARGET_SUBDIR)/qthreads && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) check) + $(MAKE) $(TARGET_FLAGS_TO_PASS) check) +@endif target-qthreads .PHONY: install-target-qthreads maybe-install-target-qthreads maybe-install-target-qthreads: +@if target-qthreads +maybe-install-target-qthreads: install-target-qthreads install-target-qthreads: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(NORMAL_TARGET_EXPORTS) \ (cd $(TARGET_SUBDIR)/qthreads && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) install) + $(MAKE) $(TARGET_FLAGS_TO_PASS) install) + +@endif target-qthreads + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-target-qthreads info-target-qthreads +maybe-info-target-qthreads: +@if target-qthreads +maybe-info-target-qthreads: info-target-qthreads + +info-target-qthreads: \ + configure-target-qthreads + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/qthreads/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing info in $(TARGET_SUBDIR)/qthreads" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/qthreads && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif target-qthreads + +.PHONY: maybe-dvi-target-qthreads dvi-target-qthreads +maybe-dvi-target-qthreads: +@if target-qthreads +maybe-dvi-target-qthreads: dvi-target-qthreads + +dvi-target-qthreads: \ + configure-target-qthreads + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/qthreads/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing dvi in $(TARGET_SUBDIR)/qthreads" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/qthreads && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif target-qthreads + +.PHONY: maybe-html-target-qthreads html-target-qthreads +maybe-html-target-qthreads: +@if target-qthreads +maybe-html-target-qthreads: html-target-qthreads + +html-target-qthreads: \ + configure-target-qthreads + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/qthreads/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing html in $(TARGET_SUBDIR)/qthreads" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/qthreads && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif target-qthreads + +.PHONY: maybe-TAGS-target-qthreads TAGS-target-qthreads +maybe-TAGS-target-qthreads: +@if target-qthreads +maybe-TAGS-target-qthreads: TAGS-target-qthreads + +TAGS-target-qthreads: \ + configure-target-qthreads + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/qthreads/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing TAGS in $(TARGET_SUBDIR)/qthreads" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/qthreads && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif target-qthreads + +.PHONY: maybe-install-info-target-qthreads install-info-target-qthreads +maybe-install-info-target-qthreads: +@if target-qthreads +maybe-install-info-target-qthreads: install-info-target-qthreads + +install-info-target-qthreads: \ + configure-target-qthreads \ + info-target-qthreads + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/qthreads/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-info in $(TARGET_SUBDIR)/qthreads" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/qthreads && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif target-qthreads + +.PHONY: maybe-install-html-target-qthreads install-html-target-qthreads +maybe-install-html-target-qthreads: +@if target-qthreads +maybe-install-html-target-qthreads: install-html-target-qthreads + +install-html-target-qthreads: \ + configure-target-qthreads \ + html-target-qthreads + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/qthreads/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-html in $(TARGET_SUBDIR)/qthreads" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/qthreads && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif target-qthreads + +.PHONY: maybe-installcheck-target-qthreads installcheck-target-qthreads +maybe-installcheck-target-qthreads: +@if target-qthreads +maybe-installcheck-target-qthreads: installcheck-target-qthreads + +installcheck-target-qthreads: \ + configure-target-qthreads + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/qthreads/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing installcheck in $(TARGET_SUBDIR)/qthreads" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/qthreads && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif target-qthreads + +.PHONY: maybe-mostlyclean-target-qthreads mostlyclean-target-qthreads +maybe-mostlyclean-target-qthreads: +@if target-qthreads +maybe-mostlyclean-target-qthreads: mostlyclean-target-qthreads + +mostlyclean-target-qthreads: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/qthreads/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing mostlyclean in $(TARGET_SUBDIR)/qthreads" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/qthreads && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif target-qthreads + +.PHONY: maybe-clean-target-qthreads clean-target-qthreads +maybe-clean-target-qthreads: +@if target-qthreads +maybe-clean-target-qthreads: clean-target-qthreads + +clean-target-qthreads: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/qthreads/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing clean in $(TARGET_SUBDIR)/qthreads" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/qthreads && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif target-qthreads + +.PHONY: maybe-distclean-target-qthreads distclean-target-qthreads +maybe-distclean-target-qthreads: +@if target-qthreads +maybe-distclean-target-qthreads: distclean-target-qthreads + +distclean-target-qthreads: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/qthreads/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing distclean in $(TARGET_SUBDIR)/qthreads" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/qthreads && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif target-qthreads + +.PHONY: maybe-maintainer-clean-target-qthreads maintainer-clean-target-qthreads +maybe-maintainer-clean-target-qthreads: +@if target-qthreads +maybe-maintainer-clean-target-qthreads: maintainer-clean-target-qthreads + +maintainer-clean-target-qthreads: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/qthreads/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing maintainer-clean in $(TARGET_SUBDIR)/qthreads" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/qthreads && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif target-qthreads + + + .PHONY: configure-target-rda maybe-configure-target-rda maybe-configure-target-rda: - -# There's only one multilib.out. Cleverer subdirs shouldn't need it copied. -$(TARGET_SUBDIR)/rda/multilib.out: multilib.out - $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/rda ; \ - rm -f $(TARGET_SUBDIR)/rda/Makefile || : ; \ - cp multilib.out $(TARGET_SUBDIR)/rda/multilib.out - -configure-target-rda: $(TARGET_SUBDIR)/rda/multilib.out - @test ! -f $(TARGET_SUBDIR)/rda/Makefile || exit 0; \ - $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/rda ; \ - r=`${PWD_COMMAND}`; export r; \ +@if target-rda +maybe-configure-target-rda: configure-target-rda +configure-target-rda: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - AR="$(AR_FOR_TARGET)"; export AR; \ - AS="$(AS_FOR_TARGET)"; export AS; \ - CC="$(CC_FOR_TARGET)"; export CC; \ - CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \ - CXX="$(CXX_FOR_TARGET)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \ - GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \ - DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \ - LD="$(LD_FOR_TARGET)"; export LD; \ - LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \ - NM="$(NM_FOR_TARGET)"; export NM; \ - RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \ - WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \ + echo "Checking multilib configuration for rda..."; \ + $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/rda ; \ + $(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/rda/multilib.tmp 2> /dev/null ; \ + if test -r $(TARGET_SUBDIR)/rda/multilib.out; then \ + if cmp -s $(TARGET_SUBDIR)/rda/multilib.tmp $(TARGET_SUBDIR)/rda/multilib.out; then \ + rm -f $(TARGET_SUBDIR)/rda/multilib.tmp; \ + else \ + rm -f $(TARGET_SUBDIR)/rda/Makefile; \ + mv $(TARGET_SUBDIR)/rda/multilib.tmp $(TARGET_SUBDIR)/rda/multilib.out; \ + fi; \ + else \ + mv $(TARGET_SUBDIR)/rda/multilib.tmp $(TARGET_SUBDIR)/rda/multilib.out; \ + fi; \ + test ! -f $(TARGET_SUBDIR)/rda/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/rda ; \ + $(NORMAL_TARGET_EXPORTS) \ echo Configuring in $(TARGET_SUBDIR)/rda; \ cd "$(TARGET_SUBDIR)/rda" || exit 1; \ case $(srcdir) in \ - /* | [A-Za-z]:[\\/]*) \ - topdir=$(srcdir) ;; \ - *) \ - case "$(TARGET_SUBDIR)" in \ - .) topdir="../$(srcdir)" ;; \ - *) topdir="../../$(srcdir)" ;; \ - esac ;; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(TARGET_SUBDIR)/rda/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ - srcdiroption="--srcdir=$${topdir}/rda"; \ - libsrcdir="$$s/rda"; \ + srcdiroption="--srcdir=$${topdir}/rda"; \ + libsrcdir="$$s/rda"; \ rm -f no-such-file || : ; \ CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \ - $(TARGET_CONFIGARGS) $${srcdiroption} \ - --with-target-subdir="$(TARGET_SUBDIR)" \ + $(TARGET_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif target-rda + + + + .PHONY: all-target-rda maybe-all-target-rda maybe-all-target-rda: +@if target-rda +TARGET-target-rda=all +maybe-all-target-rda: all-target-rda all-target-rda: configure-target-rda + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(NORMAL_TARGET_EXPORTS) \ (cd $(TARGET_SUBDIR)/rda && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) all) + $(MAKE) $(TARGET_FLAGS_TO_PASS) $(TARGET-target-rda)) +@endif target-rda + + + + .PHONY: check-target-rda maybe-check-target-rda maybe-check-target-rda: +@if target-rda +maybe-check-target-rda: check-target-rda check-target-rda: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(NORMAL_TARGET_EXPORTS) \ (cd $(TARGET_SUBDIR)/rda && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) check) + $(MAKE) $(TARGET_FLAGS_TO_PASS) check) +@endif target-rda .PHONY: install-target-rda maybe-install-target-rda maybe-install-target-rda: +@if target-rda +maybe-install-target-rda: install-target-rda install-target-rda: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(NORMAL_TARGET_EXPORTS) \ (cd $(TARGET_SUBDIR)/rda && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) install) + $(MAKE) $(TARGET_FLAGS_TO_PASS) install) + +@endif target-rda + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-target-rda info-target-rda +maybe-info-target-rda: +@if target-rda +maybe-info-target-rda: info-target-rda + +info-target-rda: \ + configure-target-rda + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/rda/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing info in $(TARGET_SUBDIR)/rda" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/rda && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif target-rda + +.PHONY: maybe-dvi-target-rda dvi-target-rda +maybe-dvi-target-rda: +@if target-rda +maybe-dvi-target-rda: dvi-target-rda + +dvi-target-rda: \ + configure-target-rda + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/rda/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing dvi in $(TARGET_SUBDIR)/rda" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/rda && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif target-rda + +.PHONY: maybe-html-target-rda html-target-rda +maybe-html-target-rda: +@if target-rda +maybe-html-target-rda: html-target-rda + +html-target-rda: \ + configure-target-rda + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/rda/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing html in $(TARGET_SUBDIR)/rda" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/rda && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif target-rda + +.PHONY: maybe-TAGS-target-rda TAGS-target-rda +maybe-TAGS-target-rda: +@if target-rda +maybe-TAGS-target-rda: TAGS-target-rda + +TAGS-target-rda: \ + configure-target-rda + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/rda/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing TAGS in $(TARGET_SUBDIR)/rda" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/rda && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif target-rda + +.PHONY: maybe-install-info-target-rda install-info-target-rda +maybe-install-info-target-rda: +@if target-rda +maybe-install-info-target-rda: install-info-target-rda + +install-info-target-rda: \ + configure-target-rda \ + info-target-rda + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/rda/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-info in $(TARGET_SUBDIR)/rda" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/rda && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif target-rda + +.PHONY: maybe-install-html-target-rda install-html-target-rda +maybe-install-html-target-rda: +@if target-rda +maybe-install-html-target-rda: install-html-target-rda + +install-html-target-rda: \ + configure-target-rda \ + html-target-rda + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/rda/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-html in $(TARGET_SUBDIR)/rda" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/rda && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif target-rda + +.PHONY: maybe-installcheck-target-rda installcheck-target-rda +maybe-installcheck-target-rda: +@if target-rda +maybe-installcheck-target-rda: installcheck-target-rda + +installcheck-target-rda: \ + configure-target-rda + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/rda/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing installcheck in $(TARGET_SUBDIR)/rda" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/rda && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif target-rda + +.PHONY: maybe-mostlyclean-target-rda mostlyclean-target-rda +maybe-mostlyclean-target-rda: +@if target-rda +maybe-mostlyclean-target-rda: mostlyclean-target-rda + +mostlyclean-target-rda: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/rda/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing mostlyclean in $(TARGET_SUBDIR)/rda" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/rda && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif target-rda + +.PHONY: maybe-clean-target-rda clean-target-rda +maybe-clean-target-rda: +@if target-rda +maybe-clean-target-rda: clean-target-rda + +clean-target-rda: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/rda/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing clean in $(TARGET_SUBDIR)/rda" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/rda && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif target-rda + +.PHONY: maybe-distclean-target-rda distclean-target-rda +maybe-distclean-target-rda: +@if target-rda +maybe-distclean-target-rda: distclean-target-rda + +distclean-target-rda: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/rda/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing distclean in $(TARGET_SUBDIR)/rda" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/rda && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif target-rda + +.PHONY: maybe-maintainer-clean-target-rda maintainer-clean-target-rda +maybe-maintainer-clean-target-rda: +@if target-rda +maybe-maintainer-clean-target-rda: maintainer-clean-target-rda + +maintainer-clean-target-rda: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/rda/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing maintainer-clean in $(TARGET_SUBDIR)/rda" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/rda && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif target-rda + + + .PHONY: configure-target-libada maybe-configure-target-libada maybe-configure-target-libada: - -# There's only one multilib.out. Cleverer subdirs shouldn't need it copied. -$(TARGET_SUBDIR)/libada/multilib.out: multilib.out - $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libada ; \ - rm -f $(TARGET_SUBDIR)/libada/Makefile || : ; \ - cp multilib.out $(TARGET_SUBDIR)/libada/multilib.out - -configure-target-libada: $(TARGET_SUBDIR)/libada/multilib.out - @test ! -f $(TARGET_SUBDIR)/libada/Makefile || exit 0; \ - $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libada ; \ - r=`${PWD_COMMAND}`; export r; \ +@if target-libada +maybe-configure-target-libada: configure-target-libada +configure-target-libada: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - AR="$(AR_FOR_TARGET)"; export AR; \ - AS="$(AS_FOR_TARGET)"; export AS; \ - CC="$(CC_FOR_TARGET)"; export CC; \ - CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \ - CXX="$(CXX_FOR_TARGET)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \ - GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \ - DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \ - LD="$(LD_FOR_TARGET)"; export LD; \ - LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \ - NM="$(NM_FOR_TARGET)"; export NM; \ - RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \ - WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \ + echo "Checking multilib configuration for libada..."; \ + $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libada ; \ + $(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/libada/multilib.tmp 2> /dev/null ; \ + if test -r $(TARGET_SUBDIR)/libada/multilib.out; then \ + if cmp -s $(TARGET_SUBDIR)/libada/multilib.tmp $(TARGET_SUBDIR)/libada/multilib.out; then \ + rm -f $(TARGET_SUBDIR)/libada/multilib.tmp; \ + else \ + rm -f $(TARGET_SUBDIR)/libada/Makefile; \ + mv $(TARGET_SUBDIR)/libada/multilib.tmp $(TARGET_SUBDIR)/libada/multilib.out; \ + fi; \ + else \ + mv $(TARGET_SUBDIR)/libada/multilib.tmp $(TARGET_SUBDIR)/libada/multilib.out; \ + fi; \ + test ! -f $(TARGET_SUBDIR)/libada/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libada ; \ + $(NORMAL_TARGET_EXPORTS) \ echo Configuring in $(TARGET_SUBDIR)/libada; \ cd "$(TARGET_SUBDIR)/libada" || exit 1; \ case $(srcdir) in \ - /* | [A-Za-z]:[\\/]*) \ - topdir=$(srcdir) ;; \ - *) \ - case "$(TARGET_SUBDIR)" in \ - .) topdir="../$(srcdir)" ;; \ - *) topdir="../../$(srcdir)" ;; \ - esac ;; \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(TARGET_SUBDIR)/libada/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ - srcdiroption="--srcdir=$${topdir}/libada"; \ - libsrcdir="$$s/libada"; \ + srcdiroption="--srcdir=$${topdir}/libada"; \ + libsrcdir="$$s/libada"; \ rm -f no-such-file || : ; \ CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \ - $(TARGET_CONFIGARGS) $${srcdiroption} \ - --with-target-subdir="$(TARGET_SUBDIR)" \ + $(TARGET_CONFIGARGS) $${srcdiroption} \ || exit 1 +@endif target-libada + + + + .PHONY: all-target-libada maybe-all-target-libada maybe-all-target-libada: +@if target-libada +TARGET-target-libada=all +maybe-all-target-libada: all-target-libada all-target-libada: configure-target-libada + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(NORMAL_TARGET_EXPORTS) \ (cd $(TARGET_SUBDIR)/libada && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) all) + $(MAKE) $(TARGET_FLAGS_TO_PASS) $(TARGET-target-libada)) +@endif target-libada + + + + .PHONY: check-target-libada maybe-check-target-libada maybe-check-target-libada: +@if target-libada +maybe-check-target-libada: check-target-libada check-target-libada: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(NORMAL_TARGET_EXPORTS) \ (cd $(TARGET_SUBDIR)/libada && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) check) + $(MAKE) $(TARGET_FLAGS_TO_PASS) check) +@endif target-libada .PHONY: install-target-libada maybe-install-target-libada maybe-install-target-libada: +@if target-libada +maybe-install-target-libada: install-target-libada install-target-libada: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(NORMAL_TARGET_EXPORTS) \ (cd $(TARGET_SUBDIR)/libada && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) install) + $(MAKE) $(TARGET_FLAGS_TO_PASS) install) + +@endif target-libada + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-target-libada info-target-libada +maybe-info-target-libada: +@if target-libada +maybe-info-target-libada: info-target-libada + +info-target-libada: \ + configure-target-libada + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libada/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing info in $(TARGET_SUBDIR)/libada" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libada && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif target-libada + +.PHONY: maybe-dvi-target-libada dvi-target-libada +maybe-dvi-target-libada: +@if target-libada +maybe-dvi-target-libada: dvi-target-libada + +dvi-target-libada: \ + configure-target-libada + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libada/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing dvi in $(TARGET_SUBDIR)/libada" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libada && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif target-libada + +.PHONY: maybe-html-target-libada html-target-libada +maybe-html-target-libada: +@if target-libada +maybe-html-target-libada: html-target-libada + +html-target-libada: \ + configure-target-libada + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libada/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing html in $(TARGET_SUBDIR)/libada" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libada && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif target-libada + +.PHONY: maybe-TAGS-target-libada TAGS-target-libada +maybe-TAGS-target-libada: +@if target-libada +maybe-TAGS-target-libada: TAGS-target-libada + +TAGS-target-libada: \ + configure-target-libada + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libada/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing TAGS in $(TARGET_SUBDIR)/libada" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libada && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif target-libada + +.PHONY: maybe-install-info-target-libada install-info-target-libada +maybe-install-info-target-libada: +@if target-libada +maybe-install-info-target-libada: install-info-target-libada + +install-info-target-libada: \ + configure-target-libada \ + info-target-libada + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libada/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-info in $(TARGET_SUBDIR)/libada" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libada && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif target-libada + +.PHONY: maybe-install-html-target-libada install-html-target-libada +maybe-install-html-target-libada: +@if target-libada +maybe-install-html-target-libada: install-html-target-libada + +install-html-target-libada: \ + configure-target-libada \ + html-target-libada + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libada/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-html in $(TARGET_SUBDIR)/libada" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libada && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif target-libada + +.PHONY: maybe-installcheck-target-libada installcheck-target-libada +maybe-installcheck-target-libada: +@if target-libada +maybe-installcheck-target-libada: installcheck-target-libada + +installcheck-target-libada: \ + configure-target-libada + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libada/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing installcheck in $(TARGET_SUBDIR)/libada" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libada && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif target-libada + +.PHONY: maybe-mostlyclean-target-libada mostlyclean-target-libada +maybe-mostlyclean-target-libada: +@if target-libada +maybe-mostlyclean-target-libada: mostlyclean-target-libada + +mostlyclean-target-libada: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libada/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing mostlyclean in $(TARGET_SUBDIR)/libada" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libada && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif target-libada + +.PHONY: maybe-clean-target-libada clean-target-libada +maybe-clean-target-libada: +@if target-libada +maybe-clean-target-libada: clean-target-libada + +clean-target-libada: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libada/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing clean in $(TARGET_SUBDIR)/libada" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libada && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif target-libada + +.PHONY: maybe-distclean-target-libada distclean-target-libada +maybe-distclean-target-libada: +@if target-libada +maybe-distclean-target-libada: distclean-target-libada + +distclean-target-libada: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libada/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing distclean in $(TARGET_SUBDIR)/libada" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libada && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif target-libada + +.PHONY: maybe-maintainer-clean-target-libada maintainer-clean-target-libada +maybe-maintainer-clean-target-libada: +@if target-libada +maybe-maintainer-clean-target-libada: maintainer-clean-target-libada + +maintainer-clean-target-libada: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libada/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing maintainer-clean in $(TARGET_SUBDIR)/libada" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libada && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif target-libada + + + + + +.PHONY: configure-target-libgomp maybe-configure-target-libgomp +maybe-configure-target-libgomp: +@if target-libgomp +maybe-configure-target-libgomp: configure-target-libgomp +configure-target-libgomp: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + echo "Checking multilib configuration for libgomp..."; \ + $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libgomp ; \ + $(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/libgomp/multilib.tmp 2> /dev/null ; \ + if test -r $(TARGET_SUBDIR)/libgomp/multilib.out; then \ + if cmp -s $(TARGET_SUBDIR)/libgomp/multilib.tmp $(TARGET_SUBDIR)/libgomp/multilib.out; then \ + rm -f $(TARGET_SUBDIR)/libgomp/multilib.tmp; \ + else \ + rm -f $(TARGET_SUBDIR)/libgomp/Makefile; \ + mv $(TARGET_SUBDIR)/libgomp/multilib.tmp $(TARGET_SUBDIR)/libgomp/multilib.out; \ + fi; \ + else \ + mv $(TARGET_SUBDIR)/libgomp/multilib.tmp $(TARGET_SUBDIR)/libgomp/multilib.out; \ + fi; \ + test ! -f $(TARGET_SUBDIR)/libgomp/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libgomp ; \ + $(NORMAL_TARGET_EXPORTS) \ + echo Configuring in $(TARGET_SUBDIR)/libgomp; \ + cd "$(TARGET_SUBDIR)/libgomp" || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(TARGET_SUBDIR)/libgomp/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/libgomp"; \ + libsrcdir="$$s/libgomp"; \ + rm -f no-such-file || : ; \ + CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \ + $(TARGET_CONFIGARGS) $${srcdiroption} \ + || exit 1 +@endif target-libgomp + + + + + +.PHONY: all-target-libgomp maybe-all-target-libgomp +maybe-all-target-libgomp: +@if target-libgomp +TARGET-target-libgomp=all +maybe-all-target-libgomp: all-target-libgomp +all-target-libgomp: configure-target-libgomp + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + (cd $(TARGET_SUBDIR)/libgomp && \ + $(MAKE) $(TARGET_FLAGS_TO_PASS) $(TARGET-target-libgomp)) +@endif target-libgomp + + + + + +.PHONY: check-target-libgomp maybe-check-target-libgomp +maybe-check-target-libgomp: +@if target-libgomp +maybe-check-target-libgomp: check-target-libgomp + +check-target-libgomp: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + (cd $(TARGET_SUBDIR)/libgomp && \ + $(MAKE) $(TARGET_FLAGS_TO_PASS) check) + +@endif target-libgomp + +.PHONY: install-target-libgomp maybe-install-target-libgomp +maybe-install-target-libgomp: +@if target-libgomp +maybe-install-target-libgomp: install-target-libgomp + +install-target-libgomp: installdirs + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + (cd $(TARGET_SUBDIR)/libgomp && \ + $(MAKE) $(TARGET_FLAGS_TO_PASS) install) + +@endif target-libgomp + +# Other targets (info, dvi, etc.) + +.PHONY: maybe-info-target-libgomp info-target-libgomp +maybe-info-target-libgomp: +@if target-libgomp +maybe-info-target-libgomp: info-target-libgomp + +info-target-libgomp: \ + configure-target-libgomp + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgomp/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing info in $(TARGET_SUBDIR)/libgomp" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgomp && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + info) \ + || exit 1 + +@endif target-libgomp + +.PHONY: maybe-dvi-target-libgomp dvi-target-libgomp +maybe-dvi-target-libgomp: +@if target-libgomp +maybe-dvi-target-libgomp: dvi-target-libgomp + +dvi-target-libgomp: \ + configure-target-libgomp + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgomp/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing dvi in $(TARGET_SUBDIR)/libgomp" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgomp && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + dvi) \ + || exit 1 + +@endif target-libgomp + +.PHONY: maybe-html-target-libgomp html-target-libgomp +maybe-html-target-libgomp: +@if target-libgomp +maybe-html-target-libgomp: html-target-libgomp + +html-target-libgomp: \ + configure-target-libgomp + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgomp/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing html in $(TARGET_SUBDIR)/libgomp" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgomp && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + html) \ + || exit 1 + +@endif target-libgomp + +.PHONY: maybe-TAGS-target-libgomp TAGS-target-libgomp +maybe-TAGS-target-libgomp: +@if target-libgomp +maybe-TAGS-target-libgomp: TAGS-target-libgomp + +TAGS-target-libgomp: \ + configure-target-libgomp + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgomp/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing TAGS in $(TARGET_SUBDIR)/libgomp" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgomp && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + TAGS) \ + || exit 1 + +@endif target-libgomp + +.PHONY: maybe-install-info-target-libgomp install-info-target-libgomp +maybe-install-info-target-libgomp: +@if target-libgomp +maybe-install-info-target-libgomp: install-info-target-libgomp + +install-info-target-libgomp: \ + configure-target-libgomp \ + info-target-libgomp + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgomp/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-info in $(TARGET_SUBDIR)/libgomp" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgomp && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-info) \ + || exit 1 + +@endif target-libgomp + +.PHONY: maybe-install-html-target-libgomp install-html-target-libgomp +maybe-install-html-target-libgomp: +@if target-libgomp +maybe-install-html-target-libgomp: install-html-target-libgomp + +install-html-target-libgomp: \ + configure-target-libgomp \ + html-target-libgomp + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgomp/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing install-html in $(TARGET_SUBDIR)/libgomp" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgomp && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + install-html) \ + || exit 1 + +@endif target-libgomp + +.PHONY: maybe-installcheck-target-libgomp installcheck-target-libgomp +maybe-installcheck-target-libgomp: +@if target-libgomp +maybe-installcheck-target-libgomp: installcheck-target-libgomp + +installcheck-target-libgomp: \ + configure-target-libgomp + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgomp/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing installcheck in $(TARGET_SUBDIR)/libgomp" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgomp && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + installcheck) \ + || exit 1 + +@endif target-libgomp + +.PHONY: maybe-mostlyclean-target-libgomp mostlyclean-target-libgomp +maybe-mostlyclean-target-libgomp: +@if target-libgomp +maybe-mostlyclean-target-libgomp: mostlyclean-target-libgomp + +mostlyclean-target-libgomp: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgomp/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing mostlyclean in $(TARGET_SUBDIR)/libgomp" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgomp && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + mostlyclean) \ + || exit 1 + +@endif target-libgomp + +.PHONY: maybe-clean-target-libgomp clean-target-libgomp +maybe-clean-target-libgomp: +@if target-libgomp +maybe-clean-target-libgomp: clean-target-libgomp + +clean-target-libgomp: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgomp/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing clean in $(TARGET_SUBDIR)/libgomp" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgomp && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + clean) \ + || exit 1 + +@endif target-libgomp + +.PHONY: maybe-distclean-target-libgomp distclean-target-libgomp +maybe-distclean-target-libgomp: +@if target-libgomp +maybe-distclean-target-libgomp: distclean-target-libgomp + +distclean-target-libgomp: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgomp/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing distclean in $(TARGET_SUBDIR)/libgomp" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgomp && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + distclean) \ + || exit 1 + +@endif target-libgomp + +.PHONY: maybe-maintainer-clean-target-libgomp maintainer-clean-target-libgomp +maybe-maintainer-clean-target-libgomp: +@if target-libgomp +maybe-maintainer-clean-target-libgomp: maintainer-clean-target-libgomp + +maintainer-clean-target-libgomp: + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/libgomp/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(NORMAL_TARGET_EXPORTS) \ + echo "Doing maintainer-clean in $(TARGET_SUBDIR)/libgomp" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/libgomp && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + maintainer-clean) \ + || exit 1 + +@endif target-libgomp @@ -23611,90 +38997,19 @@ install-target-libada: installdirs # GCC module # ---------- -# Unfortunately, while gcc _should_ be a host module, -# libgcc is a target module, and gen* programs are -# build modules. So GCC is a sort of hybrid. +@if gcc-no-bootstrap +# GCC has some more recursive targets, which trigger the old +# (but still current, until the toplevel bootstrap project +# is finished) compiler bootstrapping rules. -# gcc is the only module which uses GCC_FLAGS_TO_PASS. -# Don't use shared host config.cache, as it will confuse later -# directories; GCC wants slightly different values for some -# precious variables. *sigh* -.PHONY: configure-gcc maybe-configure-gcc -maybe-configure-gcc: -configure-gcc: - @test ! -f gcc/Makefile || exit 0; \ - [ -d gcc ] || mkdir gcc; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in gcc; \ - cd gcc || exit 1; \ - case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/gcc"; \ - libsrcdir="$$s/gcc";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/gcc"; \ - libsrcdir="$$s/gcc";; \ - esac; \ - $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ - || exit 1 - -# Don't 'make all' in gcc if it's already been made by 'bootstrap'; that -# causes trouble. This wart will be fixed eventually by moving -# the bootstrap behavior to this file. -.PHONY: all-gcc maybe-all-gcc -maybe-all-gcc: -all-gcc: configure-gcc - @if [ -f gcc/stage_last ] ; then \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) quickstrap); \ - else \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) all); \ - fi - -# Building GCC uses some tools for rebuilding "source" files -# like texinfo, bison/byacc, etc. So we must depend on those. -# -# While building GCC, it may be necessary to run various target -# programs like the assembler, linker, etc. So we depend on -# those too. -# -# In theory, on an SMP all those dependencies can be resolved -# in parallel. -# GCC_STRAP_TARGETS = bootstrap bootstrap-lean bootstrap2 bootstrap2-lean bootstrap3 bootstrap3-lean bootstrap4 bootstrap4-lean bubblestrap quickstrap cleanstrap restrap .PHONY: $(GCC_STRAP_TARGETS) -$(GCC_STRAP_TARGETS): all-bootstrap configure-gcc +$(GCC_STRAP_TARGETS): all-prebootstrap configure-gcc @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(HOST_EXPORTS) \ echo "Bootstrapping the compiler"; \ + $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,:[ :]*,:,g;s,^[ :]*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \ cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) $@ @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ @@ -23712,64 +39027,51 @@ $(GCC_STRAP_TARGETS): all-bootstrap configure-gcc msg="Comparing stage2 and stage3 of the compiler"; \ compare=compare ;; \ esac; \ - $(SET_LIB_PATH) \ + $(HOST_EXPORTS) \ echo "$$msg"; \ cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) $$compare @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \ - $(SET_LIB_PATH) \ echo "Building runtime libraries"; \ - $(MAKE) $(BASE_FLAGS_TO_PASS) $(RECURSE_FLAGS) all + $(MAKE) $(RECURSE_FLAGS_TO_PASS) all -profiledbootstrap: all-bootstrap configure-gcc +profiledbootstrap: all-prebootstrap configure-gcc @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Bootstrapping the compiler"; \ + $(HOST_EXPORTS) \ + $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,:[ :]*,:,g;s,^[ :]*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \ + echo "Bootstrapping training compiler"; \ cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) stageprofile_build @r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \ - $(SET_LIB_PATH) \ - echo "Building runtime libraries and training compiler"; \ - $(MAKE) $(BASE_FLAGS_TO_PASS) $(RECURSE_FLAGS) all - @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(HOST_EXPORTS) \ echo "Building feedback based compiler"; \ cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) stagefeedback_build + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \ + echo "Building runtime libraries"; \ + $(MAKE) $(RECURSE_FLAGS_TO_PASS) all .PHONY: cross -cross: all-texinfo all-bison all-byacc all-binutils all-gas all-ld +cross: all-build all-gas all-ld @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(HOST_EXPORTS) \ echo "Building the C and C++ compiler"; \ cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) LANGUAGES="c c++" @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \ - $(SET_LIB_PATH) \ echo "Building runtime libraries"; \ - $(MAKE) $(BASE_FLAGS_TO_PASS) $(RECURSE_FLAGS) \ - LANGUAGES="c c++" all - -.PHONY: check-gcc maybe-check-gcc -maybe-check-gcc: -check-gcc: - @if [ -f ./gcc/Makefile ] ; then \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) check); \ - else \ - true; \ - fi + $(MAKE) $(RECURSE_FLAGS_TO_PASS) LANGUAGES="c c++" all +@endif gcc-no-bootstrap +@if gcc .PHONY: check-gcc-c++ check-gcc-c++: @if [ -f ./gcc/Makefile ] ; then \ r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(HOST_EXPORTS) \ (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) check-c++); \ else \ true; \ @@ -23778,18 +39080,6 @@ check-gcc-c++: .PHONY: check-c++ check-c++: check-target-libstdc++-v3 check-gcc-c++ -.PHONY: install-gcc maybe-install-gcc -maybe-install-gcc: -install-gcc: - @if [ -f ./gcc/Makefile ] ; then \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) install); \ - else \ - true; \ - fi - # Install the gcc headers files, but not the fixed include files, # which Cygnus is not allowed to distribute. This rule is very # dependent on the workings of the gcc Makefile.in. @@ -23804,134 +39094,1985 @@ gcc-no-fixedincludes: rm -f gcc/stmp-headers gcc/stmp-int-hdrs; \ r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \ - $(SET_LIB_PATH) \ + $(HOST_EXPORTS) \ (cd ./gcc && \ $(MAKE) $(GCC_FLAGS_TO_PASS) install); \ rm -rf gcc/include; \ mv gcc/tmp-include gcc/include 2>/dev/null; \ else true; fi +@endif gcc + +# --------------------- +# GCC bootstrap support +# --------------------- + +# We track the current stage (the one in 'gcc') in the stage_current file. +# stage_last instead tracks the stage that was built last. These targets +# are dummy when toplevel bootstrap is not active. + +# While making host and target tools, symlinks to the final stage must be +# there, so $(unstage) should be run at various points. To avoid excessive +# recursive invocations of make, we "inline" them using a variable. These +# must be referenced as ": $(MAKE) ; $(unstage)" rather than "$(unstage)" +# to avoid warnings from the GNU Make job server. + +unstage = : +stage = : +current_stage = "" + +@if gcc-bootstrap +unstage = [ -f stage_current ] || $(MAKE) `cat stage_last`-start +stage = if [ -f stage_current ]; then $(MAKE) `cat stage_current`-end || exit 1; else :; fi +current_stage = "`cat stage_current 2> /dev/null`" +@endif gcc-bootstrap + +.PHONY: unstage stage +unstage: + @: $(MAKE); $(unstage) +stage: + @: $(MAKE); $(stage) + +# Disable commands for lean bootstrap. +LEAN = false + +# We name the build directories for the various stages "stage1-gcc", +# "stage2-gcc","stage3-gcc", etc. + +# Since the 'compare' process will fail (on debugging information) if any +# directory names are different, we need to link the gcc directory for +# the previous stage to a constant name ('prev-gcc'), and to make the name of +# the build directories constant as well. For the latter, we use naked names +# like 'gcc', because the scripts in that directory assume it. We use +# mv on platforms where symlinks to directories do not work or are not +# reliable. + +# 'touch' doesn't work right on some platforms. +STAMP = echo timestamp > + +# Only build the C compiler for stage1, because that is the only one that +# we can guarantee will build with the native compiler, and also it is the +# only thing useful for building stage2. STAGE1_CFLAGS (via CFLAGS), +# MAKEINFO and MAKEINFOFLAGS are explicitly passed here to make them +# overrideable (for a bootstrap build stage1 also builds gcc.info). + +STAGE1_CFLAGS=@stage1_cflags@ +STAGE1_LANGUAGES=@stage1_languages@ + +# We only want to compare .o files, so set this! +objext = .o + +# Flags to pass to stage2 and later makes. +POSTSTAGE1_FLAGS_TO_PASS = \ + CC="$${CC}" CC_FOR_BUILD="$${CC_FOR_BUILD}" \ + STAGE_PREFIX=$$r/prev-gcc/ \ + CFLAGS="$(BOOT_CFLAGS)" \ + LIBCFLAGS="$(BOOT_CFLAGS)" \ + LDFLAGS="$(BOOT_LDFLAGS)" \ + ADAC="\$$(CC)" + +# For stage 1: +# * We force-disable intermodule optimizations, even if +# --enable-intermodule was passed, since the installed compiler probably +# can't handle them. Luckily, autoconf always respects +# the last argument when conflicting --enable arguments are passed. +# * Likewise, we force-disable coverage flags, since the installed compiler +# probably has never heard of them. +# * We build only C (and possibly Ada). + + +.PHONY: stage1-start stage1-end + +stage1-start:: + @: $(MAKE); $(stage); \ + echo stage1 > stage_current ; \ + echo stage1 > stage_last; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR) +@if bfd + @cd $(HOST_SUBDIR); [ -d stage1-bfd ] || \ + mkdir stage1-bfd; \ + mv stage1-bfd bfd +@endif bfd +@if opcodes + @cd $(HOST_SUBDIR); [ -d stage1-opcodes ] || \ + mkdir stage1-opcodes; \ + mv stage1-opcodes opcodes +@endif opcodes +@if binutils + @cd $(HOST_SUBDIR); [ -d stage1-binutils ] || \ + mkdir stage1-binutils; \ + mv stage1-binutils binutils +@endif binutils +@if gas + @cd $(HOST_SUBDIR); [ -d stage1-gas ] || \ + mkdir stage1-gas; \ + mv stage1-gas gas +@endif gas +@if gcc + @cd $(HOST_SUBDIR); [ -d stage1-gcc ] || \ + mkdir stage1-gcc; \ + mv stage1-gcc gcc +@endif gcc +@if intl + @cd $(HOST_SUBDIR); [ -d stage1-intl ] || \ + mkdir stage1-intl; \ + mv stage1-intl intl +@endif intl +@if ld + @cd $(HOST_SUBDIR); [ -d stage1-ld ] || \ + mkdir stage1-ld; \ + mv stage1-ld ld +@endif ld +@if libcpp + @cd $(HOST_SUBDIR); [ -d stage1-libcpp ] || \ + mkdir stage1-libcpp; \ + mv stage1-libcpp libcpp +@endif libcpp +@if libdecnumber + @cd $(HOST_SUBDIR); [ -d stage1-libdecnumber ] || \ + mkdir stage1-libdecnumber; \ + mv stage1-libdecnumber libdecnumber +@endif libdecnumber +@if libiberty + @cd $(HOST_SUBDIR); [ -d stage1-libiberty ] || \ + mkdir stage1-libiberty; \ + mv stage1-libiberty libiberty +@endif libiberty +@if zlib + @cd $(HOST_SUBDIR); [ -d stage1-zlib ] || \ + mkdir stage1-zlib; \ + mv stage1-zlib zlib +@endif zlib + @[ -d stage1-$(TARGET_SUBDIR) ] || \ + mkdir stage1-$(TARGET_SUBDIR); \ + mv stage1-$(TARGET_SUBDIR) $(TARGET_SUBDIR) + +stage1-end:: +@if bfd + @if test -d $(HOST_SUBDIR)/bfd ; then \ + cd $(HOST_SUBDIR); mv bfd stage1-bfd ; \ + fi +@endif bfd +@if opcodes + @if test -d $(HOST_SUBDIR)/opcodes ; then \ + cd $(HOST_SUBDIR); mv opcodes stage1-opcodes ; \ + fi +@endif opcodes +@if binutils + @if test -d $(HOST_SUBDIR)/binutils ; then \ + cd $(HOST_SUBDIR); mv binutils stage1-binutils ; \ + fi +@endif binutils +@if gas + @if test -d $(HOST_SUBDIR)/gas ; then \ + cd $(HOST_SUBDIR); mv gas stage1-gas ; \ + fi +@endif gas +@if gcc + @if test -d $(HOST_SUBDIR)/gcc ; then \ + cd $(HOST_SUBDIR); mv gcc stage1-gcc ; \ + fi +@endif gcc +@if intl + @if test -d $(HOST_SUBDIR)/intl ; then \ + cd $(HOST_SUBDIR); mv intl stage1-intl ; \ + fi +@endif intl +@if ld + @if test -d $(HOST_SUBDIR)/ld ; then \ + cd $(HOST_SUBDIR); mv ld stage1-ld ; \ + fi +@endif ld +@if libcpp + @if test -d $(HOST_SUBDIR)/libcpp ; then \ + cd $(HOST_SUBDIR); mv libcpp stage1-libcpp ; \ + fi +@endif libcpp +@if libdecnumber + @if test -d $(HOST_SUBDIR)/libdecnumber ; then \ + cd $(HOST_SUBDIR); mv libdecnumber stage1-libdecnumber ; \ + fi +@endif libdecnumber +@if libiberty + @if test -d $(HOST_SUBDIR)/libiberty ; then \ + cd $(HOST_SUBDIR); mv libiberty stage1-libiberty ; \ + fi +@endif libiberty +@if zlib + @if test -d $(HOST_SUBDIR)/zlib ; then \ + cd $(HOST_SUBDIR); mv zlib stage1-zlib ; \ + fi +@endif zlib + @if test -d $(TARGET_SUBDIR) ; then \ + mv $(TARGET_SUBDIR) stage1-$(TARGET_SUBDIR) ; \ + fi + rm -f stage_current + +# Bubble a bugfix through all the stages up to stage 1. They are +# remade, but not reconfigured. The next stage (if any) will not be +# reconfigured as well. +.PHONY: stage1-bubble +stage1-bubble:: + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + if test -f stage1-lean ; then \ + echo Skipping rebuild of stage1 ; \ + else \ + $(MAKE) stage1-start; \ + $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-stage1; \ + fi + +.PHONY: all-stage1 clean-stage1 +do-clean: clean-stage1 + +# FIXME: Will not need to be conditional when toplevel bootstrap is the +# only possibility, but now it conflicts with no-bootstrap rules +@if gcc-bootstrap + + + + +# Rules to wipe a stage and all the following ones, also used for cleanstrap + +.PHONY: distclean-stage1 +distclean-stage1:: + @: $(MAKE); $(stage) + rm -rf stage1-* + + +@endif gcc-bootstrap + + +.PHONY: stage2-start stage2-end + +stage2-start:: + @: $(MAKE); $(stage); \ + echo stage2 > stage_current ; \ + echo stage2 > stage_last; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR) +@if bfd + @cd $(HOST_SUBDIR); [ -d stage2-bfd ] || \ + mkdir stage2-bfd; \ + mv stage2-bfd bfd ; \ + mv stage1-bfd prev-bfd || test -f stage1-lean +@endif bfd +@if opcodes + @cd $(HOST_SUBDIR); [ -d stage2-opcodes ] || \ + mkdir stage2-opcodes; \ + mv stage2-opcodes opcodes ; \ + mv stage1-opcodes prev-opcodes || test -f stage1-lean +@endif opcodes +@if binutils + @cd $(HOST_SUBDIR); [ -d stage2-binutils ] || \ + mkdir stage2-binutils; \ + mv stage2-binutils binutils ; \ + mv stage1-binutils prev-binutils || test -f stage1-lean +@endif binutils +@if gas + @cd $(HOST_SUBDIR); [ -d stage2-gas ] || \ + mkdir stage2-gas; \ + mv stage2-gas gas ; \ + mv stage1-gas prev-gas || test -f stage1-lean +@endif gas +@if gcc + @cd $(HOST_SUBDIR); [ -d stage2-gcc ] || \ + mkdir stage2-gcc; \ + mv stage2-gcc gcc ; \ + mv stage1-gcc prev-gcc || test -f stage1-lean +@endif gcc +@if intl + @cd $(HOST_SUBDIR); [ -d stage2-intl ] || \ + mkdir stage2-intl; \ + mv stage2-intl intl ; \ + mv stage1-intl prev-intl || test -f stage1-lean +@endif intl +@if ld + @cd $(HOST_SUBDIR); [ -d stage2-ld ] || \ + mkdir stage2-ld; \ + mv stage2-ld ld ; \ + mv stage1-ld prev-ld || test -f stage1-lean +@endif ld +@if libcpp + @cd $(HOST_SUBDIR); [ -d stage2-libcpp ] || \ + mkdir stage2-libcpp; \ + mv stage2-libcpp libcpp ; \ + mv stage1-libcpp prev-libcpp || test -f stage1-lean +@endif libcpp +@if libdecnumber + @cd $(HOST_SUBDIR); [ -d stage2-libdecnumber ] || \ + mkdir stage2-libdecnumber; \ + mv stage2-libdecnumber libdecnumber ; \ + mv stage1-libdecnumber prev-libdecnumber || test -f stage1-lean +@endif libdecnumber +@if libiberty + @cd $(HOST_SUBDIR); [ -d stage2-libiberty ] || \ + mkdir stage2-libiberty; \ + mv stage2-libiberty libiberty ; \ + mv stage1-libiberty prev-libiberty || test -f stage1-lean +@endif libiberty +@if zlib + @cd $(HOST_SUBDIR); [ -d stage2-zlib ] || \ + mkdir stage2-zlib; \ + mv stage2-zlib zlib ; \ + mv stage1-zlib prev-zlib || test -f stage1-lean +@endif zlib + @[ -d stage2-$(TARGET_SUBDIR) ] || \ + mkdir stage2-$(TARGET_SUBDIR); \ + mv stage2-$(TARGET_SUBDIR) $(TARGET_SUBDIR) ; \ + mv stage1-$(TARGET_SUBDIR) prev-$(TARGET_SUBDIR) || test -f stage1-lean + +stage2-end:: +@if bfd + @if test -d $(HOST_SUBDIR)/bfd ; then \ + cd $(HOST_SUBDIR); mv bfd stage2-bfd ; \ + mv prev-bfd stage1-bfd ; : ; \ + fi +@endif bfd +@if opcodes + @if test -d $(HOST_SUBDIR)/opcodes ; then \ + cd $(HOST_SUBDIR); mv opcodes stage2-opcodes ; \ + mv prev-opcodes stage1-opcodes ; : ; \ + fi +@endif opcodes +@if binutils + @if test -d $(HOST_SUBDIR)/binutils ; then \ + cd $(HOST_SUBDIR); mv binutils stage2-binutils ; \ + mv prev-binutils stage1-binutils ; : ; \ + fi +@endif binutils +@if gas + @if test -d $(HOST_SUBDIR)/gas ; then \ + cd $(HOST_SUBDIR); mv gas stage2-gas ; \ + mv prev-gas stage1-gas ; : ; \ + fi +@endif gas +@if gcc + @if test -d $(HOST_SUBDIR)/gcc ; then \ + cd $(HOST_SUBDIR); mv gcc stage2-gcc ; \ + mv prev-gcc stage1-gcc ; : ; \ + fi +@endif gcc +@if intl + @if test -d $(HOST_SUBDIR)/intl ; then \ + cd $(HOST_SUBDIR); mv intl stage2-intl ; \ + mv prev-intl stage1-intl ; : ; \ + fi +@endif intl +@if ld + @if test -d $(HOST_SUBDIR)/ld ; then \ + cd $(HOST_SUBDIR); mv ld stage2-ld ; \ + mv prev-ld stage1-ld ; : ; \ + fi +@endif ld +@if libcpp + @if test -d $(HOST_SUBDIR)/libcpp ; then \ + cd $(HOST_SUBDIR); mv libcpp stage2-libcpp ; \ + mv prev-libcpp stage1-libcpp ; : ; \ + fi +@endif libcpp +@if libdecnumber + @if test -d $(HOST_SUBDIR)/libdecnumber ; then \ + cd $(HOST_SUBDIR); mv libdecnumber stage2-libdecnumber ; \ + mv prev-libdecnumber stage1-libdecnumber ; : ; \ + fi +@endif libdecnumber +@if libiberty + @if test -d $(HOST_SUBDIR)/libiberty ; then \ + cd $(HOST_SUBDIR); mv libiberty stage2-libiberty ; \ + mv prev-libiberty stage1-libiberty ; : ; \ + fi +@endif libiberty +@if zlib + @if test -d $(HOST_SUBDIR)/zlib ; then \ + cd $(HOST_SUBDIR); mv zlib stage2-zlib ; \ + mv prev-zlib stage1-zlib ; : ; \ + fi +@endif zlib + @if test -d $(TARGET_SUBDIR) ; then \ + mv $(TARGET_SUBDIR) stage2-$(TARGET_SUBDIR) ; \ + mv prev-$(TARGET_SUBDIR) stage1-$(TARGET_SUBDIR) ; : ; \ + fi + rm -f stage_current + +# Bubble a bugfix through all the stages up to stage 2. They are +# remade, but not reconfigured. The next stage (if any) will not be +# reconfigured as well. +.PHONY: stage2-bubble +stage2-bubble:: stage1-bubble + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + if test -f stage2-lean || test -f stage1-lean ; then \ + echo Skipping rebuild of stage2 ; \ + else \ + $(MAKE) stage2-start; \ + $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-stage2; \ + fi + +.PHONY: all-stage2 clean-stage2 +do-clean: clean-stage2 + +# FIXME: Will not need to be conditional when toplevel bootstrap is the +# only possibility, but now it conflicts with no-bootstrap rules +@if gcc-bootstrap + + + +.PHONY: bootstrap2 bootstrap2-lean +bootstrap2: + echo stage2 > stage_final + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage2-bubble + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target + +bootstrap2-lean: + echo stage2 > stage_final + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(MAKE) $(RECURSE_FLAGS_TO_PASS) LEAN=: stage2-bubble + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target + + +# Rules to wipe a stage and all the following ones, also used for cleanstrap +distclean-stage1:: distclean-stage2 +.PHONY: distclean-stage2 +distclean-stage2:: + @: $(MAKE); $(stage) + rm -rf stage2-* + + +@endif gcc-bootstrap + + +.PHONY: stage3-start stage3-end + +stage3-start:: + @: $(MAKE); $(stage); \ + echo stage3 > stage_current ; \ + echo stage3 > stage_last; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR) +@if bfd + @cd $(HOST_SUBDIR); [ -d stage3-bfd ] || \ + mkdir stage3-bfd; \ + mv stage3-bfd bfd ; \ + mv stage2-bfd prev-bfd || test -f stage2-lean +@endif bfd +@if opcodes + @cd $(HOST_SUBDIR); [ -d stage3-opcodes ] || \ + mkdir stage3-opcodes; \ + mv stage3-opcodes opcodes ; \ + mv stage2-opcodes prev-opcodes || test -f stage2-lean +@endif opcodes +@if binutils + @cd $(HOST_SUBDIR); [ -d stage3-binutils ] || \ + mkdir stage3-binutils; \ + mv stage3-binutils binutils ; \ + mv stage2-binutils prev-binutils || test -f stage2-lean +@endif binutils +@if gas + @cd $(HOST_SUBDIR); [ -d stage3-gas ] || \ + mkdir stage3-gas; \ + mv stage3-gas gas ; \ + mv stage2-gas prev-gas || test -f stage2-lean +@endif gas +@if gcc + @cd $(HOST_SUBDIR); [ -d stage3-gcc ] || \ + mkdir stage3-gcc; \ + mv stage3-gcc gcc ; \ + mv stage2-gcc prev-gcc || test -f stage2-lean +@endif gcc +@if intl + @cd $(HOST_SUBDIR); [ -d stage3-intl ] || \ + mkdir stage3-intl; \ + mv stage3-intl intl ; \ + mv stage2-intl prev-intl || test -f stage2-lean +@endif intl +@if ld + @cd $(HOST_SUBDIR); [ -d stage3-ld ] || \ + mkdir stage3-ld; \ + mv stage3-ld ld ; \ + mv stage2-ld prev-ld || test -f stage2-lean +@endif ld +@if libcpp + @cd $(HOST_SUBDIR); [ -d stage3-libcpp ] || \ + mkdir stage3-libcpp; \ + mv stage3-libcpp libcpp ; \ + mv stage2-libcpp prev-libcpp || test -f stage2-lean +@endif libcpp +@if libdecnumber + @cd $(HOST_SUBDIR); [ -d stage3-libdecnumber ] || \ + mkdir stage3-libdecnumber; \ + mv stage3-libdecnumber libdecnumber ; \ + mv stage2-libdecnumber prev-libdecnumber || test -f stage2-lean +@endif libdecnumber +@if libiberty + @cd $(HOST_SUBDIR); [ -d stage3-libiberty ] || \ + mkdir stage3-libiberty; \ + mv stage3-libiberty libiberty ; \ + mv stage2-libiberty prev-libiberty || test -f stage2-lean +@endif libiberty +@if zlib + @cd $(HOST_SUBDIR); [ -d stage3-zlib ] || \ + mkdir stage3-zlib; \ + mv stage3-zlib zlib ; \ + mv stage2-zlib prev-zlib || test -f stage2-lean +@endif zlib + @[ -d stage3-$(TARGET_SUBDIR) ] || \ + mkdir stage3-$(TARGET_SUBDIR); \ + mv stage3-$(TARGET_SUBDIR) $(TARGET_SUBDIR) ; \ + mv stage2-$(TARGET_SUBDIR) prev-$(TARGET_SUBDIR) || test -f stage2-lean + +stage3-end:: +@if bfd + @if test -d $(HOST_SUBDIR)/bfd ; then \ + cd $(HOST_SUBDIR); mv bfd stage3-bfd ; \ + mv prev-bfd stage2-bfd ; : ; \ + fi +@endif bfd +@if opcodes + @if test -d $(HOST_SUBDIR)/opcodes ; then \ + cd $(HOST_SUBDIR); mv opcodes stage3-opcodes ; \ + mv prev-opcodes stage2-opcodes ; : ; \ + fi +@endif opcodes +@if binutils + @if test -d $(HOST_SUBDIR)/binutils ; then \ + cd $(HOST_SUBDIR); mv binutils stage3-binutils ; \ + mv prev-binutils stage2-binutils ; : ; \ + fi +@endif binutils +@if gas + @if test -d $(HOST_SUBDIR)/gas ; then \ + cd $(HOST_SUBDIR); mv gas stage3-gas ; \ + mv prev-gas stage2-gas ; : ; \ + fi +@endif gas +@if gcc + @if test -d $(HOST_SUBDIR)/gcc ; then \ + cd $(HOST_SUBDIR); mv gcc stage3-gcc ; \ + mv prev-gcc stage2-gcc ; : ; \ + fi +@endif gcc +@if intl + @if test -d $(HOST_SUBDIR)/intl ; then \ + cd $(HOST_SUBDIR); mv intl stage3-intl ; \ + mv prev-intl stage2-intl ; : ; \ + fi +@endif intl +@if ld + @if test -d $(HOST_SUBDIR)/ld ; then \ + cd $(HOST_SUBDIR); mv ld stage3-ld ; \ + mv prev-ld stage2-ld ; : ; \ + fi +@endif ld +@if libcpp + @if test -d $(HOST_SUBDIR)/libcpp ; then \ + cd $(HOST_SUBDIR); mv libcpp stage3-libcpp ; \ + mv prev-libcpp stage2-libcpp ; : ; \ + fi +@endif libcpp +@if libdecnumber + @if test -d $(HOST_SUBDIR)/libdecnumber ; then \ + cd $(HOST_SUBDIR); mv libdecnumber stage3-libdecnumber ; \ + mv prev-libdecnumber stage2-libdecnumber ; : ; \ + fi +@endif libdecnumber +@if libiberty + @if test -d $(HOST_SUBDIR)/libiberty ; then \ + cd $(HOST_SUBDIR); mv libiberty stage3-libiberty ; \ + mv prev-libiberty stage2-libiberty ; : ; \ + fi +@endif libiberty +@if zlib + @if test -d $(HOST_SUBDIR)/zlib ; then \ + cd $(HOST_SUBDIR); mv zlib stage3-zlib ; \ + mv prev-zlib stage2-zlib ; : ; \ + fi +@endif zlib + @if test -d $(TARGET_SUBDIR) ; then \ + mv $(TARGET_SUBDIR) stage3-$(TARGET_SUBDIR) ; \ + mv prev-$(TARGET_SUBDIR) stage2-$(TARGET_SUBDIR) ; : ; \ + fi + rm -f stage_current + +# Bubble a bugfix through all the stages up to stage 3. They are +# remade, but not reconfigured. The next stage (if any) will not be +# reconfigured as well. +.PHONY: stage3-bubble +stage3-bubble:: stage2-bubble + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + if test -f stage3-lean || test -f stage2-lean ; then \ + echo Skipping rebuild of stage3 ; \ + else \ + $(MAKE) stage3-start; \ + if $(LEAN); then \ + rm -rf stage1-* ; \ + $(STAMP) stage1-lean ; \ + fi; \ + $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-stage3; \ + fi + $(MAKE) $(RECURSE_FLAGS_TO_PASS) compare + +.PHONY: all-stage3 clean-stage3 +do-clean: clean-stage3 + +# FIXME: Will not need to be conditional when toplevel bootstrap is the +# only possibility, but now it conflicts with no-bootstrap rules +@if gcc-bootstrap + +compare: + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + if test -f stage2-lean; then \ + echo Cannot compare object files as stage 2 was deleted. ; \ + exit 0 ; \ + fi; \ + : $(MAKE); $(stage); \ + rm -f .bad_compare ; \ + echo Comparing stages 2 and 3 ; \ + cd stage3-gcc; \ + files=`find . -name "*$(objext)" -print` ; \ + cd .. ; \ + for file in $${files} ; do \ + f1=$$r/stage2-gcc/$$file; f2=$$r/stage3-gcc/$$file; \ + @do_compare@ > /dev/null 2>&1; \ + if test $$? -eq 1; then \ + case $$file in \ + ./cc*-checksum$(objext) | ./libgcc/* ) \ + echo warning: $$file differs ;; \ + *) \ + echo $$file differs >> .bad_compare ;; \ + esac ; \ + fi ; \ + done ; \ + if [ -f .bad_compare ]; then \ + echo "Bootstrap comparison failure!"; \ + cat .bad_compare; \ + exit 1; \ + else \ + echo Comparison successful.; \ + fi ; \ + $(STAMP) compare + if $(LEAN); then \ + rm -rf stage2-*; \ + $(STAMP) stage2-lean; \ + fi + + + +.PHONY: bootstrap bootstrap-lean +bootstrap: + echo stage3 > stage_final + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage3-bubble + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target + +bootstrap-lean: + echo stage3 > stage_final + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(MAKE) $(RECURSE_FLAGS_TO_PASS) LEAN=: stage3-bubble + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target + + +# Rules to wipe a stage and all the following ones, also used for cleanstrap +distclean-stage2:: distclean-stage3 +.PHONY: distclean-stage3 +distclean-stage3:: + @: $(MAKE); $(stage) + rm -rf stage3-* compare + + +.PHONY: cleanstrap +cleanstrap: distclean bootstrap + +@endif gcc-bootstrap + + +.PHONY: stage4-start stage4-end + +stage4-start:: + @: $(MAKE); $(stage); \ + echo stage4 > stage_current ; \ + echo stage4 > stage_last; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR) +@if bfd + @cd $(HOST_SUBDIR); [ -d stage4-bfd ] || \ + mkdir stage4-bfd; \ + mv stage4-bfd bfd ; \ + mv stage3-bfd prev-bfd || test -f stage3-lean +@endif bfd +@if opcodes + @cd $(HOST_SUBDIR); [ -d stage4-opcodes ] || \ + mkdir stage4-opcodes; \ + mv stage4-opcodes opcodes ; \ + mv stage3-opcodes prev-opcodes || test -f stage3-lean +@endif opcodes +@if binutils + @cd $(HOST_SUBDIR); [ -d stage4-binutils ] || \ + mkdir stage4-binutils; \ + mv stage4-binutils binutils ; \ + mv stage3-binutils prev-binutils || test -f stage3-lean +@endif binutils +@if gas + @cd $(HOST_SUBDIR); [ -d stage4-gas ] || \ + mkdir stage4-gas; \ + mv stage4-gas gas ; \ + mv stage3-gas prev-gas || test -f stage3-lean +@endif gas +@if gcc + @cd $(HOST_SUBDIR); [ -d stage4-gcc ] || \ + mkdir stage4-gcc; \ + mv stage4-gcc gcc ; \ + mv stage3-gcc prev-gcc || test -f stage3-lean +@endif gcc +@if intl + @cd $(HOST_SUBDIR); [ -d stage4-intl ] || \ + mkdir stage4-intl; \ + mv stage4-intl intl ; \ + mv stage3-intl prev-intl || test -f stage3-lean +@endif intl +@if ld + @cd $(HOST_SUBDIR); [ -d stage4-ld ] || \ + mkdir stage4-ld; \ + mv stage4-ld ld ; \ + mv stage3-ld prev-ld || test -f stage3-lean +@endif ld +@if libcpp + @cd $(HOST_SUBDIR); [ -d stage4-libcpp ] || \ + mkdir stage4-libcpp; \ + mv stage4-libcpp libcpp ; \ + mv stage3-libcpp prev-libcpp || test -f stage3-lean +@endif libcpp +@if libdecnumber + @cd $(HOST_SUBDIR); [ -d stage4-libdecnumber ] || \ + mkdir stage4-libdecnumber; \ + mv stage4-libdecnumber libdecnumber ; \ + mv stage3-libdecnumber prev-libdecnumber || test -f stage3-lean +@endif libdecnumber +@if libiberty + @cd $(HOST_SUBDIR); [ -d stage4-libiberty ] || \ + mkdir stage4-libiberty; \ + mv stage4-libiberty libiberty ; \ + mv stage3-libiberty prev-libiberty || test -f stage3-lean +@endif libiberty +@if zlib + @cd $(HOST_SUBDIR); [ -d stage4-zlib ] || \ + mkdir stage4-zlib; \ + mv stage4-zlib zlib ; \ + mv stage3-zlib prev-zlib || test -f stage3-lean +@endif zlib + @[ -d stage4-$(TARGET_SUBDIR) ] || \ + mkdir stage4-$(TARGET_SUBDIR); \ + mv stage4-$(TARGET_SUBDIR) $(TARGET_SUBDIR) ; \ + mv stage3-$(TARGET_SUBDIR) prev-$(TARGET_SUBDIR) || test -f stage3-lean + +stage4-end:: +@if bfd + @if test -d $(HOST_SUBDIR)/bfd ; then \ + cd $(HOST_SUBDIR); mv bfd stage4-bfd ; \ + mv prev-bfd stage3-bfd ; : ; \ + fi +@endif bfd +@if opcodes + @if test -d $(HOST_SUBDIR)/opcodes ; then \ + cd $(HOST_SUBDIR); mv opcodes stage4-opcodes ; \ + mv prev-opcodes stage3-opcodes ; : ; \ + fi +@endif opcodes +@if binutils + @if test -d $(HOST_SUBDIR)/binutils ; then \ + cd $(HOST_SUBDIR); mv binutils stage4-binutils ; \ + mv prev-binutils stage3-binutils ; : ; \ + fi +@endif binutils +@if gas + @if test -d $(HOST_SUBDIR)/gas ; then \ + cd $(HOST_SUBDIR); mv gas stage4-gas ; \ + mv prev-gas stage3-gas ; : ; \ + fi +@endif gas +@if gcc + @if test -d $(HOST_SUBDIR)/gcc ; then \ + cd $(HOST_SUBDIR); mv gcc stage4-gcc ; \ + mv prev-gcc stage3-gcc ; : ; \ + fi +@endif gcc +@if intl + @if test -d $(HOST_SUBDIR)/intl ; then \ + cd $(HOST_SUBDIR); mv intl stage4-intl ; \ + mv prev-intl stage3-intl ; : ; \ + fi +@endif intl +@if ld + @if test -d $(HOST_SUBDIR)/ld ; then \ + cd $(HOST_SUBDIR); mv ld stage4-ld ; \ + mv prev-ld stage3-ld ; : ; \ + fi +@endif ld +@if libcpp + @if test -d $(HOST_SUBDIR)/libcpp ; then \ + cd $(HOST_SUBDIR); mv libcpp stage4-libcpp ; \ + mv prev-libcpp stage3-libcpp ; : ; \ + fi +@endif libcpp +@if libdecnumber + @if test -d $(HOST_SUBDIR)/libdecnumber ; then \ + cd $(HOST_SUBDIR); mv libdecnumber stage4-libdecnumber ; \ + mv prev-libdecnumber stage3-libdecnumber ; : ; \ + fi +@endif libdecnumber +@if libiberty + @if test -d $(HOST_SUBDIR)/libiberty ; then \ + cd $(HOST_SUBDIR); mv libiberty stage4-libiberty ; \ + mv prev-libiberty stage3-libiberty ; : ; \ + fi +@endif libiberty +@if zlib + @if test -d $(HOST_SUBDIR)/zlib ; then \ + cd $(HOST_SUBDIR); mv zlib stage4-zlib ; \ + mv prev-zlib stage3-zlib ; : ; \ + fi +@endif zlib + @if test -d $(TARGET_SUBDIR) ; then \ + mv $(TARGET_SUBDIR) stage4-$(TARGET_SUBDIR) ; \ + mv prev-$(TARGET_SUBDIR) stage3-$(TARGET_SUBDIR) ; : ; \ + fi + rm -f stage_current + +# Bubble a bugfix through all the stages up to stage 4. They are +# remade, but not reconfigured. The next stage (if any) will not be +# reconfigured as well. +.PHONY: stage4-bubble +stage4-bubble:: stage3-bubble + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + if test -f stage4-lean || test -f stage3-lean ; then \ + echo Skipping rebuild of stage4 ; \ + else \ + $(MAKE) stage4-start; \ + if $(LEAN); then \ + rm -rf stage2-* ; \ + $(STAMP) stage2-lean ; \ + fi; \ + $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-stage4; \ + fi + $(MAKE) $(RECURSE_FLAGS_TO_PASS) compare3 + +.PHONY: all-stage4 clean-stage4 +do-clean: clean-stage4 + +# FIXME: Will not need to be conditional when toplevel bootstrap is the +# only possibility, but now it conflicts with no-bootstrap rules +@if gcc-bootstrap + +compare3: + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + if test -f stage3-lean; then \ + echo Cannot compare object files as stage 3 was deleted. ; \ + exit 0 ; \ + fi; \ + : $(MAKE); $(stage); \ + rm -f .bad_compare ; \ + echo Comparing stages 3 and 4 ; \ + cd stage4-gcc; \ + files=`find . -name "*$(objext)" -print` ; \ + cd .. ; \ + for file in $${files} ; do \ + f1=$$r/stage3-gcc/$$file; f2=$$r/stage4-gcc/$$file; \ + @do_compare@ > /dev/null 2>&1; \ + if test $$? -eq 1; then \ + case $$file in \ + ./cc*-checksum$(objext) | ./libgcc/* ) \ + echo warning: $$file differs ;; \ + *) \ + echo $$file differs >> .bad_compare ;; \ + esac ; \ + fi ; \ + done ; \ + if [ -f .bad_compare ]; then \ + echo "Bootstrap comparison failure!"; \ + cat .bad_compare; \ + exit 1; \ + else \ + echo Comparison successful.; \ + fi ; \ + $(STAMP) compare3 + if $(LEAN); then \ + rm -rf stage3-*; \ + $(STAMP) stage3-lean; \ + fi + + + +.PHONY: bootstrap4 bootstrap4-lean +bootstrap4: + echo stage4 > stage_final + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage4-bubble + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target + +bootstrap4-lean: + echo stage4 > stage_final + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(MAKE) $(RECURSE_FLAGS_TO_PASS) LEAN=: stage4-bubble + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target + + +# Rules to wipe a stage and all the following ones, also used for cleanstrap +distclean-stage3:: distclean-stage4 +.PHONY: distclean-stage4 +distclean-stage4:: + @: $(MAKE); $(stage) + rm -rf stage4-* compare3 + + +@endif gcc-bootstrap + + +.PHONY: stageprofile-start stageprofile-end + +stageprofile-start:: + @: $(MAKE); $(stage); \ + echo stageprofile > stage_current ; \ + echo stageprofile > stage_last; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR) +@if bfd + @cd $(HOST_SUBDIR); [ -d stageprofile-bfd ] || \ + mkdir stageprofile-bfd; \ + mv stageprofile-bfd bfd ; \ + mv stage1-bfd prev-bfd || test -f stage1-lean +@endif bfd +@if opcodes + @cd $(HOST_SUBDIR); [ -d stageprofile-opcodes ] || \ + mkdir stageprofile-opcodes; \ + mv stageprofile-opcodes opcodes ; \ + mv stage1-opcodes prev-opcodes || test -f stage1-lean +@endif opcodes +@if binutils + @cd $(HOST_SUBDIR); [ -d stageprofile-binutils ] || \ + mkdir stageprofile-binutils; \ + mv stageprofile-binutils binutils ; \ + mv stage1-binutils prev-binutils || test -f stage1-lean +@endif binutils +@if gas + @cd $(HOST_SUBDIR); [ -d stageprofile-gas ] || \ + mkdir stageprofile-gas; \ + mv stageprofile-gas gas ; \ + mv stage1-gas prev-gas || test -f stage1-lean +@endif gas +@if gcc + @cd $(HOST_SUBDIR); [ -d stageprofile-gcc ] || \ + mkdir stageprofile-gcc; \ + mv stageprofile-gcc gcc ; \ + mv stage1-gcc prev-gcc || test -f stage1-lean +@endif gcc +@if intl + @cd $(HOST_SUBDIR); [ -d stageprofile-intl ] || \ + mkdir stageprofile-intl; \ + mv stageprofile-intl intl ; \ + mv stage1-intl prev-intl || test -f stage1-lean +@endif intl +@if ld + @cd $(HOST_SUBDIR); [ -d stageprofile-ld ] || \ + mkdir stageprofile-ld; \ + mv stageprofile-ld ld ; \ + mv stage1-ld prev-ld || test -f stage1-lean +@endif ld +@if libcpp + @cd $(HOST_SUBDIR); [ -d stageprofile-libcpp ] || \ + mkdir stageprofile-libcpp; \ + mv stageprofile-libcpp libcpp ; \ + mv stage1-libcpp prev-libcpp || test -f stage1-lean +@endif libcpp +@if libdecnumber + @cd $(HOST_SUBDIR); [ -d stageprofile-libdecnumber ] || \ + mkdir stageprofile-libdecnumber; \ + mv stageprofile-libdecnumber libdecnumber ; \ + mv stage1-libdecnumber prev-libdecnumber || test -f stage1-lean +@endif libdecnumber +@if libiberty + @cd $(HOST_SUBDIR); [ -d stageprofile-libiberty ] || \ + mkdir stageprofile-libiberty; \ + mv stageprofile-libiberty libiberty ; \ + mv stage1-libiberty prev-libiberty || test -f stage1-lean +@endif libiberty +@if zlib + @cd $(HOST_SUBDIR); [ -d stageprofile-zlib ] || \ + mkdir stageprofile-zlib; \ + mv stageprofile-zlib zlib ; \ + mv stage1-zlib prev-zlib || test -f stage1-lean +@endif zlib + @[ -d stageprofile-$(TARGET_SUBDIR) ] || \ + mkdir stageprofile-$(TARGET_SUBDIR); \ + mv stageprofile-$(TARGET_SUBDIR) $(TARGET_SUBDIR) ; \ + mv stage1-$(TARGET_SUBDIR) prev-$(TARGET_SUBDIR) || test -f stage1-lean + +stageprofile-end:: +@if bfd + @if test -d $(HOST_SUBDIR)/bfd ; then \ + cd $(HOST_SUBDIR); mv bfd stageprofile-bfd ; \ + mv prev-bfd stage1-bfd ; : ; \ + fi +@endif bfd +@if opcodes + @if test -d $(HOST_SUBDIR)/opcodes ; then \ + cd $(HOST_SUBDIR); mv opcodes stageprofile-opcodes ; \ + mv prev-opcodes stage1-opcodes ; : ; \ + fi +@endif opcodes +@if binutils + @if test -d $(HOST_SUBDIR)/binutils ; then \ + cd $(HOST_SUBDIR); mv binutils stageprofile-binutils ; \ + mv prev-binutils stage1-binutils ; : ; \ + fi +@endif binutils +@if gas + @if test -d $(HOST_SUBDIR)/gas ; then \ + cd $(HOST_SUBDIR); mv gas stageprofile-gas ; \ + mv prev-gas stage1-gas ; : ; \ + fi +@endif gas +@if gcc + @if test -d $(HOST_SUBDIR)/gcc ; then \ + cd $(HOST_SUBDIR); mv gcc stageprofile-gcc ; \ + mv prev-gcc stage1-gcc ; : ; \ + fi +@endif gcc +@if intl + @if test -d $(HOST_SUBDIR)/intl ; then \ + cd $(HOST_SUBDIR); mv intl stageprofile-intl ; \ + mv prev-intl stage1-intl ; : ; \ + fi +@endif intl +@if ld + @if test -d $(HOST_SUBDIR)/ld ; then \ + cd $(HOST_SUBDIR); mv ld stageprofile-ld ; \ + mv prev-ld stage1-ld ; : ; \ + fi +@endif ld +@if libcpp + @if test -d $(HOST_SUBDIR)/libcpp ; then \ + cd $(HOST_SUBDIR); mv libcpp stageprofile-libcpp ; \ + mv prev-libcpp stage1-libcpp ; : ; \ + fi +@endif libcpp +@if libdecnumber + @if test -d $(HOST_SUBDIR)/libdecnumber ; then \ + cd $(HOST_SUBDIR); mv libdecnumber stageprofile-libdecnumber ; \ + mv prev-libdecnumber stage1-libdecnumber ; : ; \ + fi +@endif libdecnumber +@if libiberty + @if test -d $(HOST_SUBDIR)/libiberty ; then \ + cd $(HOST_SUBDIR); mv libiberty stageprofile-libiberty ; \ + mv prev-libiberty stage1-libiberty ; : ; \ + fi +@endif libiberty +@if zlib + @if test -d $(HOST_SUBDIR)/zlib ; then \ + cd $(HOST_SUBDIR); mv zlib stageprofile-zlib ; \ + mv prev-zlib stage1-zlib ; : ; \ + fi +@endif zlib + @if test -d $(TARGET_SUBDIR) ; then \ + mv $(TARGET_SUBDIR) stageprofile-$(TARGET_SUBDIR) ; \ + mv prev-$(TARGET_SUBDIR) stage1-$(TARGET_SUBDIR) ; : ; \ + fi + rm -f stage_current + +# Bubble a bugfix through all the stages up to stage profile. They are +# remade, but not reconfigured. The next stage (if any) will not be +# reconfigured as well. +.PHONY: stageprofile-bubble +stageprofile-bubble:: stage1-bubble + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + if test -f stageprofile-lean || test -f stage1-lean ; then \ + echo Skipping rebuild of stageprofile ; \ + else \ + $(MAKE) stageprofile-start; \ + $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-stageprofile; \ + fi + +.PHONY: all-stageprofile clean-stageprofile +do-clean: clean-stageprofile + +# FIXME: Will not need to be conditional when toplevel bootstrap is the +# only possibility, but now it conflicts with no-bootstrap rules +@if gcc-bootstrap + + + + +# Rules to wipe a stage and all the following ones, also used for cleanstrap +distclean-stage1:: distclean-stageprofile +.PHONY: distclean-stageprofile +distclean-stageprofile:: + @: $(MAKE); $(stage) + rm -rf stageprofile-* + + +@endif gcc-bootstrap + + +.PHONY: stagefeedback-start stagefeedback-end + +stagefeedback-start:: + @: $(MAKE); $(stage); \ + echo stagefeedback > stage_current ; \ + echo stagefeedback > stage_last; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR) +@if bfd + @cd $(HOST_SUBDIR); [ -d stagefeedback-bfd ] || \ + mkdir stagefeedback-bfd; \ + mv stagefeedback-bfd bfd ; \ + mv stageprofile-bfd prev-bfd || test -f stageprofile-lean +@endif bfd +@if opcodes + @cd $(HOST_SUBDIR); [ -d stagefeedback-opcodes ] || \ + mkdir stagefeedback-opcodes; \ + mv stagefeedback-opcodes opcodes ; \ + mv stageprofile-opcodes prev-opcodes || test -f stageprofile-lean +@endif opcodes +@if binutils + @cd $(HOST_SUBDIR); [ -d stagefeedback-binutils ] || \ + mkdir stagefeedback-binutils; \ + mv stagefeedback-binutils binutils ; \ + mv stageprofile-binutils prev-binutils || test -f stageprofile-lean +@endif binutils +@if gas + @cd $(HOST_SUBDIR); [ -d stagefeedback-gas ] || \ + mkdir stagefeedback-gas; \ + mv stagefeedback-gas gas ; \ + mv stageprofile-gas prev-gas || test -f stageprofile-lean +@endif gas +@if gcc + @cd $(HOST_SUBDIR); [ -d stagefeedback-gcc ] || \ + mkdir stagefeedback-gcc; \ + mv stagefeedback-gcc gcc ; \ + mv stageprofile-gcc prev-gcc || test -f stageprofile-lean +@endif gcc +@if intl + @cd $(HOST_SUBDIR); [ -d stagefeedback-intl ] || \ + mkdir stagefeedback-intl; \ + mv stagefeedback-intl intl ; \ + mv stageprofile-intl prev-intl || test -f stageprofile-lean +@endif intl +@if ld + @cd $(HOST_SUBDIR); [ -d stagefeedback-ld ] || \ + mkdir stagefeedback-ld; \ + mv stagefeedback-ld ld ; \ + mv stageprofile-ld prev-ld || test -f stageprofile-lean +@endif ld +@if libcpp + @cd $(HOST_SUBDIR); [ -d stagefeedback-libcpp ] || \ + mkdir stagefeedback-libcpp; \ + mv stagefeedback-libcpp libcpp ; \ + mv stageprofile-libcpp prev-libcpp || test -f stageprofile-lean +@endif libcpp +@if libdecnumber + @cd $(HOST_SUBDIR); [ -d stagefeedback-libdecnumber ] || \ + mkdir stagefeedback-libdecnumber; \ + mv stagefeedback-libdecnumber libdecnumber ; \ + mv stageprofile-libdecnumber prev-libdecnumber || test -f stageprofile-lean +@endif libdecnumber +@if libiberty + @cd $(HOST_SUBDIR); [ -d stagefeedback-libiberty ] || \ + mkdir stagefeedback-libiberty; \ + mv stagefeedback-libiberty libiberty ; \ + mv stageprofile-libiberty prev-libiberty || test -f stageprofile-lean +@endif libiberty +@if zlib + @cd $(HOST_SUBDIR); [ -d stagefeedback-zlib ] || \ + mkdir stagefeedback-zlib; \ + mv stagefeedback-zlib zlib ; \ + mv stageprofile-zlib prev-zlib || test -f stageprofile-lean +@endif zlib + @[ -d stagefeedback-$(TARGET_SUBDIR) ] || \ + mkdir stagefeedback-$(TARGET_SUBDIR); \ + mv stagefeedback-$(TARGET_SUBDIR) $(TARGET_SUBDIR) ; \ + mv stageprofile-$(TARGET_SUBDIR) prev-$(TARGET_SUBDIR) || test -f stageprofile-lean + +stagefeedback-end:: +@if bfd + @if test -d $(HOST_SUBDIR)/bfd ; then \ + cd $(HOST_SUBDIR); mv bfd stagefeedback-bfd ; \ + mv prev-bfd stageprofile-bfd ; : ; \ + fi +@endif bfd +@if opcodes + @if test -d $(HOST_SUBDIR)/opcodes ; then \ + cd $(HOST_SUBDIR); mv opcodes stagefeedback-opcodes ; \ + mv prev-opcodes stageprofile-opcodes ; : ; \ + fi +@endif opcodes +@if binutils + @if test -d $(HOST_SUBDIR)/binutils ; then \ + cd $(HOST_SUBDIR); mv binutils stagefeedback-binutils ; \ + mv prev-binutils stageprofile-binutils ; : ; \ + fi +@endif binutils +@if gas + @if test -d $(HOST_SUBDIR)/gas ; then \ + cd $(HOST_SUBDIR); mv gas stagefeedback-gas ; \ + mv prev-gas stageprofile-gas ; : ; \ + fi +@endif gas +@if gcc + @if test -d $(HOST_SUBDIR)/gcc ; then \ + cd $(HOST_SUBDIR); mv gcc stagefeedback-gcc ; \ + mv prev-gcc stageprofile-gcc ; : ; \ + fi +@endif gcc +@if intl + @if test -d $(HOST_SUBDIR)/intl ; then \ + cd $(HOST_SUBDIR); mv intl stagefeedback-intl ; \ + mv prev-intl stageprofile-intl ; : ; \ + fi +@endif intl +@if ld + @if test -d $(HOST_SUBDIR)/ld ; then \ + cd $(HOST_SUBDIR); mv ld stagefeedback-ld ; \ + mv prev-ld stageprofile-ld ; : ; \ + fi +@endif ld +@if libcpp + @if test -d $(HOST_SUBDIR)/libcpp ; then \ + cd $(HOST_SUBDIR); mv libcpp stagefeedback-libcpp ; \ + mv prev-libcpp stageprofile-libcpp ; : ; \ + fi +@endif libcpp +@if libdecnumber + @if test -d $(HOST_SUBDIR)/libdecnumber ; then \ + cd $(HOST_SUBDIR); mv libdecnumber stagefeedback-libdecnumber ; \ + mv prev-libdecnumber stageprofile-libdecnumber ; : ; \ + fi +@endif libdecnumber +@if libiberty + @if test -d $(HOST_SUBDIR)/libiberty ; then \ + cd $(HOST_SUBDIR); mv libiberty stagefeedback-libiberty ; \ + mv prev-libiberty stageprofile-libiberty ; : ; \ + fi +@endif libiberty +@if zlib + @if test -d $(HOST_SUBDIR)/zlib ; then \ + cd $(HOST_SUBDIR); mv zlib stagefeedback-zlib ; \ + mv prev-zlib stageprofile-zlib ; : ; \ + fi +@endif zlib + @if test -d $(TARGET_SUBDIR) ; then \ + mv $(TARGET_SUBDIR) stagefeedback-$(TARGET_SUBDIR) ; \ + mv prev-$(TARGET_SUBDIR) stageprofile-$(TARGET_SUBDIR) ; : ; \ + fi + rm -f stage_current + +# Bubble a bugfix through all the stages up to stage feedback. They are +# remade, but not reconfigured. The next stage (if any) will not be +# reconfigured as well. +.PHONY: stagefeedback-bubble +stagefeedback-bubble:: stageprofile-bubble + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + if test -f stagefeedback-lean || test -f stageprofile-lean ; then \ + echo Skipping rebuild of stagefeedback ; \ + else \ + $(MAKE) stagefeedback-start; \ + $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-stagefeedback; \ + fi + +.PHONY: all-stagefeedback clean-stagefeedback +do-clean: clean-stagefeedback + +# FIXME: Will not need to be conditional when toplevel bootstrap is the +# only possibility, but now it conflicts with no-bootstrap rules +@if gcc-bootstrap + + + +.PHONY: profiledbootstrap profiledbootstrap-lean +profiledbootstrap: + echo stagefeedback > stage_final + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(MAKE) $(RECURSE_FLAGS_TO_PASS) stagefeedback-bubble + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target + +profiledbootstrap-lean: + echo stagefeedback > stage_final + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(MAKE) $(RECURSE_FLAGS_TO_PASS) LEAN=: stagefeedback-bubble + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target + + +# Rules to wipe a stage and all the following ones, also used for cleanstrap +distclean-stageprofile:: distclean-stagefeedback +.PHONY: distclean-stagefeedback +distclean-stagefeedback:: + @: $(MAKE); $(stage) + rm -rf stagefeedback-* + + +@endif gcc-bootstrap + + + +stageprofile-end:: + $(MAKE) distclean-stagefeedback + +stagefeedback-start:: + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + for i in prev-*; do \ + j=`echo $$i | sed s/^prev-//` ; \ + cd $$r/$$i && \ + { find . -type d | sort | sed 's,.*,$(SHELL) '"$$s"'/mkinstalldirs "../'$$j'/&",' | $(SHELL) ; } && \ + { find . -name '*.*da' | sed 's,.*,$(LN) -f "&" "../'$$j'/&",' | $(SHELL) ; } ; \ + done + +@if gcc-bootstrap +do-distclean: distclean-stage1 + +# Provide a GCC build when we're building target libraries. This does +# not work as a dependency, just as the minimum necessary to avoid errors. +stage_last: + $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage1-bubble +@endif gcc-bootstrap + +.PHONY: restrap +restrap: + @: $(MAKE); $(stage) + rm -rf stage1-$(TARGET_SUBDIR) stage2 stage3 stage4 stageprofile stagefeedback + $(MAKE) $(RECURSE_FLAGS_TO_PASS) all # -------------------------------------- # Dependencies between different modules # -------------------------------------- +# Generic dependencies for target modules on host stuff, especially gcc +@if gcc-bootstrap +configure-target-libstdc++-v3: stage_last +configure-target-libmudflap: stage_last +configure-target-libssp: stage_last +configure-target-libgcc-math: stage_last +configure-target-newlib: stage_last +configure-target-libgfortran: stage_last +configure-target-libobjc: stage_last +configure-target-libtermcap: stage_last +configure-target-winsup: stage_last +configure-target-libgloss: stage_last +configure-target-libiberty: stage_last +configure-target-gperf: stage_last +configure-target-examples: stage_last +configure-target-libffi: stage_last +configure-target-libjava: stage_last +configure-target-zlib: stage_last +configure-target-boehm-gc: stage_last +configure-target-qthreads: stage_last +configure-target-rda: stage_last +configure-target-libada: stage_last +configure-target-libgomp: stage_last +@endif gcc-bootstrap + +@if gcc-no-bootstrap +configure-target-libstdc++-v3: maybe-all-gcc +configure-target-libmudflap: maybe-all-gcc +configure-target-libssp: maybe-all-gcc +configure-target-libgcc-math: maybe-all-gcc +configure-target-newlib: maybe-all-gcc +configure-target-libgfortran: maybe-all-gcc +configure-target-libobjc: maybe-all-gcc +configure-target-libtermcap: maybe-all-gcc +configure-target-winsup: maybe-all-gcc +configure-target-libgloss: maybe-all-gcc +configure-target-libiberty: maybe-all-gcc +configure-target-gperf: maybe-all-gcc +configure-target-examples: maybe-all-gcc +configure-target-libffi: maybe-all-gcc +configure-target-libjava: maybe-all-gcc +configure-target-zlib: maybe-all-gcc +configure-target-boehm-gc: maybe-all-gcc +configure-target-qthreads: maybe-all-gcc +configure-target-rda: maybe-all-gcc +configure-target-libada: maybe-all-gcc +configure-target-libgomp: maybe-all-gcc +@endif gcc-no-bootstrap + + + +configure-target-boehm-gc: maybe-all-target-newlib maybe-all-target-libgloss + +configure-target-gperf: maybe-all-target-newlib maybe-all-target-libgloss +configure-target-gperf: maybe-all-target-libstdc++-v3 + +configure-target-libada: maybe-all-target-newlib maybe-all-target-libgloss + +configure-target-libgfortran: maybe-all-target-newlib maybe-all-target-libgloss + +configure-target-libffi: maybe-all-target-newlib maybe-all-target-libgloss + +configure-target-libjava: maybe-all-target-newlib maybe-all-target-libgloss +configure-target-libjava: maybe-all-target-libstdc++-v3 + +configure-target-libmudflap: maybe-all-target-newlib maybe-all-target-libgloss + +configure-target-libobjc: maybe-all-target-newlib maybe-all-target-libgloss + +configure-target-libssp: maybe-all-target-newlib maybe-all-target-libgloss + +configure-target-libstdc++-v3: maybe-all-target-newlib maybe-all-target-libgloss + +configure-target-zlib: maybe-all-target-newlib maybe-all-target-libgloss + +configure-target-examples: maybe-all-target-newlib maybe-all-target-libgloss + +configure-target-libtermcap: maybe-all-target-newlib maybe-all-target-libgloss + +configure-target-rda: maybe-all-target-newlib maybe-all-target-libgloss + +configure-target-winsup: maybe-all-target-newlib maybe-all-target-libgloss + +configure-target-qthreads: maybe-all-target-newlib maybe-all-target-libgloss + + # There are two types of dependencies here: 'hard' dependencies, where one # module simply won't build without the other; and 'soft' dependencies, where # if the depended-on module is missing, the depending module will do without # or find a substitute somewhere (perhaps installed). Soft dependencies -# are specified by depending on a 'maybe-' target. If you're not sure, +# are made here to depend on a 'maybe-' target. If you're not sure, # it's safer to use a soft dependency. -# Host modules specific to gcc. -# GCC needs to identify certain tools. -# GCC also needs the information exported by the intl configure script. -configure-gcc: maybe-configure-intl maybe-configure-binutils maybe-configure-gas maybe-configure-ld maybe-configure-bison maybe-configure-flex -all-gcc: maybe-all-libiberty maybe-all-intl maybe-all-bison maybe-all-byacc maybe-all-binutils maybe-all-gas maybe-all-ld maybe-all-zlib -# This is a slightly kludgy method of getting dependencies on -# all-build-libiberty correct; it would be better to build it every time. + + + + + +# With all the machinery above in place, it is pretty easy to generate +# dependencies. Host dependencies are a bit more complex because we have +# to check for bootstrap/prebootstrap dependencies. To resolve +# prebootstrap dependencies, prebootstrap modules are gathered in +# a hash table. +all-build-bison: maybe-all-build-texinfo +all-build-byacc: maybe-all-build-texinfo +all-build-flex: maybe-all-build-texinfo +all-build-flex: maybe-all-build-bison +all-build-flex: maybe-all-build-byacc +all-build-flex: maybe-all-build-m4 +all-build-libiberty: maybe-all-build-texinfo +all-build-m4: maybe-all-build-texinfo +all-build-fixincludes: maybe-all-build-libiberty +configure-gcc: maybe-configure-intl + +configure-stage1-gcc: maybe-configure-stage1-intl +configure-stage2-gcc: maybe-configure-stage2-intl +configure-stage3-gcc: maybe-configure-stage3-intl +configure-stage4-gcc: maybe-configure-stage4-intl +configure-stageprofile-gcc: maybe-configure-stageprofile-intl +configure-stagefeedback-gcc: maybe-configure-stagefeedback-intl +configure-gcc: maybe-all-binutils + +configure-stage1-gcc: maybe-all-stage1-binutils +configure-stage2-gcc: maybe-all-stage2-binutils +configure-stage3-gcc: maybe-all-stage3-binutils +configure-stage4-gcc: maybe-all-stage4-binutils +configure-stageprofile-gcc: maybe-all-stageprofile-binutils +configure-stagefeedback-gcc: maybe-all-stagefeedback-binutils +configure-gcc: maybe-all-gas + +configure-stage1-gcc: maybe-all-stage1-gas +configure-stage2-gcc: maybe-all-stage2-gas +configure-stage3-gcc: maybe-all-stage3-gas +configure-stage4-gcc: maybe-all-stage4-gas +configure-stageprofile-gcc: maybe-all-stageprofile-gas +configure-stagefeedback-gcc: maybe-all-stagefeedback-gas +configure-gcc: maybe-all-ld + +configure-stage1-gcc: maybe-all-stage1-ld +configure-stage2-gcc: maybe-all-stage2-ld +configure-stage3-gcc: maybe-all-stage3-ld +configure-stage4-gcc: maybe-all-stage4-ld +configure-stageprofile-gcc: maybe-all-stageprofile-ld +configure-stagefeedback-gcc: maybe-all-stagefeedback-ld +all-gcc: all-libiberty + +all-stage1-gcc: all-stage1-libiberty +all-stage2-gcc: all-stage2-libiberty +all-stage3-gcc: all-stage3-libiberty +all-stage4-gcc: all-stage4-libiberty +all-stageprofile-gcc: all-stageprofile-libiberty +all-stagefeedback-gcc: all-stagefeedback-libiberty +all-gcc: maybe-all-intl + +all-stage1-gcc: maybe-all-stage1-intl +all-stage2-gcc: maybe-all-stage2-intl +all-stage3-gcc: maybe-all-stage3-intl +all-stage4-gcc: maybe-all-stage4-intl +all-stageprofile-gcc: maybe-all-stageprofile-intl +all-stagefeedback-gcc: maybe-all-stagefeedback-intl +all-gcc: maybe-all-build-texinfo + +all-stage1-gcc: maybe-all-build-texinfo +all-stage2-gcc: maybe-all-build-texinfo +all-stage3-gcc: maybe-all-build-texinfo +all-stage4-gcc: maybe-all-build-texinfo +all-stageprofile-gcc: maybe-all-build-texinfo +all-stagefeedback-gcc: maybe-all-build-texinfo +all-prebootstrap: maybe-all-build-texinfo +all-gcc: maybe-all-build-bison + +all-stage1-gcc: maybe-all-build-bison +all-stage2-gcc: maybe-all-build-bison +all-stage3-gcc: maybe-all-build-bison +all-stage4-gcc: maybe-all-build-bison +all-stageprofile-gcc: maybe-all-build-bison +all-stagefeedback-gcc: maybe-all-build-bison +all-prebootstrap: maybe-all-build-bison +all-gcc: maybe-all-build-byacc + +all-stage1-gcc: maybe-all-build-byacc +all-stage2-gcc: maybe-all-build-byacc +all-stage3-gcc: maybe-all-build-byacc +all-stage4-gcc: maybe-all-build-byacc +all-stageprofile-gcc: maybe-all-build-byacc +all-stagefeedback-gcc: maybe-all-build-byacc +all-prebootstrap: maybe-all-build-byacc +all-gcc: maybe-all-build-flex + +all-stage1-gcc: maybe-all-build-flex +all-stage2-gcc: maybe-all-build-flex +all-stage3-gcc: maybe-all-build-flex +all-stage4-gcc: maybe-all-build-flex +all-stageprofile-gcc: maybe-all-build-flex +all-stagefeedback-gcc: maybe-all-build-flex +all-prebootstrap: maybe-all-build-flex all-gcc: maybe-all-build-libiberty -all-bootstrap: maybe-all-libiberty maybe-all-intl maybe-all-texinfo maybe-all-bison maybe-all-byacc maybe-all-binutils maybe-all-gas maybe-all-ld maybe-all-zlib -# Host modules specific to gdb. -# GDB needs to know that the simulator is being built. -configure-gdb: maybe-configure-itcl maybe-configure-tcl maybe-configure-tk maybe-configure-sim -GDB_TK = @GDB_TK@ -all-gdb: maybe-all-libiberty maybe-all-opcodes maybe-all-bfd maybe-all-mmalloc maybe-all-readline maybe-all-bison maybe-all-byacc maybe-all-sim $(gdbnlmrequirements) $(GDB_TK) -install-gdb: maybe-install-tcl maybe-install-tk maybe-install-itcl maybe-install-tix maybe-install-libgui -configure-libgui: maybe-configure-tcl maybe-configure-tk -all-libgui: maybe-all-tcl maybe-all-tk maybe-all-itcl +all-stage1-gcc: maybe-all-build-libiberty +all-stage2-gcc: maybe-all-build-libiberty +all-stage3-gcc: maybe-all-build-libiberty +all-stage4-gcc: maybe-all-build-libiberty +all-stageprofile-gcc: maybe-all-build-libiberty +all-stagefeedback-gcc: maybe-all-build-libiberty +all-prebootstrap: maybe-all-build-libiberty +all-gcc: maybe-all-build-fixincludes -# Host modules specific to binutils. +all-stage1-gcc: maybe-all-build-fixincludes +all-stage2-gcc: maybe-all-build-fixincludes +all-stage3-gcc: maybe-all-build-fixincludes +all-stage4-gcc: maybe-all-build-fixincludes +all-stageprofile-gcc: maybe-all-build-fixincludes +all-stagefeedback-gcc: maybe-all-build-fixincludes +all-prebootstrap: maybe-all-build-fixincludes +all-gcc: maybe-all-zlib + +all-stage1-gcc: maybe-all-stage1-zlib +all-stage2-gcc: maybe-all-stage2-zlib +all-stage3-gcc: maybe-all-stage3-zlib +all-stage4-gcc: maybe-all-stage4-zlib +all-stageprofile-gcc: maybe-all-stageprofile-zlib +all-stagefeedback-gcc: maybe-all-stagefeedback-zlib +all-gcc: all-libcpp + +all-stage1-gcc: all-stage1-libcpp +all-stage2-gcc: all-stage2-libcpp +all-stage3-gcc: all-stage3-libcpp +all-stage4-gcc: all-stage4-libcpp +all-stageprofile-gcc: all-stageprofile-libcpp +all-stagefeedback-gcc: all-stagefeedback-libcpp +all-gcc: all-libdecnumber + +all-stage1-gcc: all-stage1-libdecnumber +all-stage2-gcc: all-stage2-libdecnumber +all-stage3-gcc: all-stage3-libdecnumber +all-stage4-gcc: all-stage4-libdecnumber +all-stageprofile-gcc: all-stageprofile-libdecnumber +all-stagefeedback-gcc: all-stagefeedback-libdecnumber +all-gcc: maybe-all-libiberty + +all-stage1-gcc: maybe-all-stage1-libiberty +all-stage2-gcc: maybe-all-stage2-libiberty +all-stage3-gcc: maybe-all-stage3-libiberty +all-stage4-gcc: maybe-all-stage4-libiberty +all-stageprofile-gcc: maybe-all-stageprofile-libiberty +all-stagefeedback-gcc: maybe-all-stagefeedback-libiberty +all-gcc: maybe-all-fixincludes +install-gcc: maybe-install-fixincludes +configure-libcpp: configure-libiberty + +configure-stage1-libcpp: configure-stage1-libiberty +configure-stage2-libcpp: configure-stage2-libiberty +configure-stage3-libcpp: configure-stage3-libiberty +configure-stage4-libcpp: configure-stage4-libiberty +configure-stageprofile-libcpp: configure-stageprofile-libiberty +configure-stagefeedback-libcpp: configure-stagefeedback-libiberty +configure-libcpp: maybe-configure-intl + +configure-stage1-libcpp: maybe-configure-stage1-intl +configure-stage2-libcpp: maybe-configure-stage2-intl +configure-stage3-libcpp: maybe-configure-stage3-intl +configure-stage4-libcpp: maybe-configure-stage4-intl +configure-stageprofile-libcpp: maybe-configure-stageprofile-intl +configure-stagefeedback-libcpp: maybe-configure-stagefeedback-intl +all-libcpp: all-libiberty + +all-stage1-libcpp: all-stage1-libiberty +all-stage2-libcpp: all-stage2-libiberty +all-stage3-libcpp: all-stage3-libiberty +all-stage4-libcpp: all-stage4-libiberty +all-stageprofile-libcpp: all-stageprofile-libiberty +all-stagefeedback-libcpp: all-stagefeedback-libiberty +all-libcpp: maybe-all-intl + +all-stage1-libcpp: maybe-all-stage1-intl +all-stage2-libcpp: maybe-all-stage2-intl +all-stage3-libcpp: maybe-all-stage3-intl +all-stage4-libcpp: maybe-all-stage4-intl +all-stageprofile-libcpp: maybe-all-stageprofile-intl +all-stagefeedback-libcpp: maybe-all-stagefeedback-intl +all-fixincludes: maybe-all-libiberty +all-gnattools: maybe-all-target-libada +configure-gdb: maybe-configure-sim +all-gdb: maybe-all-libiberty +all-gdb: maybe-all-opcodes +all-gdb: maybe-all-bfd +all-gdb: maybe-all-readline +all-gdb: maybe-all-build-bison +all-gdb: maybe-all-build-byacc +all-gdb: maybe-all-sim +configure-libgui: maybe-configure-tcl +configure-libgui: maybe-configure-tk +all-libgui: maybe-all-tcl +all-libgui: maybe-all-tk +all-libgui: maybe-all-itcl configure-bfd: configure-libiberty -all-bfd: maybe-all-libiberty maybe-all-intl -all-binutils: maybe-all-libiberty maybe-all-opcodes maybe-all-bfd maybe-all-flex maybe-all-bison maybe-all-byacc maybe-all-intl -# We put install-opcodes before install-binutils because the installed -# binutils might be on PATH, and they might need the shared opcodes -# library. -install-binutils: maybe-install-opcodes -# libopcodes depends on libbfd -install-opcodes: maybe-install-bfd -all-gas: maybe-all-libiberty maybe-all-opcodes maybe-all-bfd maybe-all-intl -all-gprof: maybe-all-libiberty maybe-all-bfd maybe-all-opcodes maybe-all-intl -all-ld: maybe-all-libiberty maybe-all-bfd maybe-all-opcodes maybe-all-bison maybe-all-byacc maybe-all-flex maybe-all-intl -all-opcodes: maybe-all-bfd maybe-all-libiberty -# Other host modules in the 'src' repository. -all-dejagnu: maybe-all-tcl maybe-all-expect maybe-all-tk -configure-expect: maybe-configure-tcl maybe-configure-tk -all-expect: maybe-all-tcl maybe-all-tk -configure-itcl: maybe-configure-tcl maybe-configure-tk -all-itcl: maybe-all-tcl maybe-all-tk -# We put install-tcl before install-itcl because itcl wants to run a -# program on installation which uses the Tcl libraries. +configure-stage1-bfd: configure-stage1-libiberty +configure-stage2-bfd: configure-stage2-libiberty +configure-stage3-bfd: configure-stage3-libiberty +configure-stage4-bfd: configure-stage4-libiberty +configure-stageprofile-bfd: configure-stageprofile-libiberty +configure-stagefeedback-bfd: configure-stagefeedback-libiberty +all-bfd: maybe-all-libiberty + +all-stage1-bfd: maybe-all-stage1-libiberty +all-stage2-bfd: maybe-all-stage2-libiberty +all-stage3-bfd: maybe-all-stage3-libiberty +all-stage4-bfd: maybe-all-stage4-libiberty +all-stageprofile-bfd: maybe-all-stageprofile-libiberty +all-stagefeedback-bfd: maybe-all-stagefeedback-libiberty +all-bfd: maybe-all-intl + +all-stage1-bfd: maybe-all-stage1-intl +all-stage2-bfd: maybe-all-stage2-intl +all-stage3-bfd: maybe-all-stage3-intl +all-stage4-bfd: maybe-all-stage4-intl +all-stageprofile-bfd: maybe-all-stageprofile-intl +all-stagefeedback-bfd: maybe-all-stagefeedback-intl +all-binutils: maybe-all-libiberty + +all-stage1-binutils: maybe-all-stage1-libiberty +all-stage2-binutils: maybe-all-stage2-libiberty +all-stage3-binutils: maybe-all-stage3-libiberty +all-stage4-binutils: maybe-all-stage4-libiberty +all-stageprofile-binutils: maybe-all-stageprofile-libiberty +all-stagefeedback-binutils: maybe-all-stagefeedback-libiberty +all-binutils: maybe-all-opcodes + +all-stage1-binutils: maybe-all-stage1-opcodes +all-stage2-binutils: maybe-all-stage2-opcodes +all-stage3-binutils: maybe-all-stage3-opcodes +all-stage4-binutils: maybe-all-stage4-opcodes +all-stageprofile-binutils: maybe-all-stageprofile-opcodes +all-stagefeedback-binutils: maybe-all-stagefeedback-opcodes +all-binutils: maybe-all-bfd + +all-stage1-binutils: maybe-all-stage1-bfd +all-stage2-binutils: maybe-all-stage2-bfd +all-stage3-binutils: maybe-all-stage3-bfd +all-stage4-binutils: maybe-all-stage4-bfd +all-stageprofile-binutils: maybe-all-stageprofile-bfd +all-stagefeedback-binutils: maybe-all-stagefeedback-bfd +all-binutils: maybe-all-build-flex + +all-stage1-binutils: maybe-all-build-flex +all-stage2-binutils: maybe-all-build-flex +all-stage3-binutils: maybe-all-build-flex +all-stage4-binutils: maybe-all-build-flex +all-stageprofile-binutils: maybe-all-build-flex +all-stagefeedback-binutils: maybe-all-build-flex +all-prebootstrap: maybe-all-build-flex +all-binutils: maybe-all-build-bison + +all-stage1-binutils: maybe-all-build-bison +all-stage2-binutils: maybe-all-build-bison +all-stage3-binutils: maybe-all-build-bison +all-stage4-binutils: maybe-all-build-bison +all-stageprofile-binutils: maybe-all-build-bison +all-stagefeedback-binutils: maybe-all-build-bison +all-prebootstrap: maybe-all-build-bison +all-binutils: maybe-all-build-byacc + +all-stage1-binutils: maybe-all-build-byacc +all-stage2-binutils: maybe-all-build-byacc +all-stage3-binutils: maybe-all-build-byacc +all-stage4-binutils: maybe-all-build-byacc +all-stageprofile-binutils: maybe-all-build-byacc +all-stagefeedback-binutils: maybe-all-build-byacc +all-prebootstrap: maybe-all-build-byacc +all-binutils: maybe-all-intl + +all-stage1-binutils: maybe-all-stage1-intl +all-stage2-binutils: maybe-all-stage2-intl +all-stage3-binutils: maybe-all-stage3-intl +all-stage4-binutils: maybe-all-stage4-intl +all-stageprofile-binutils: maybe-all-stageprofile-intl +all-stagefeedback-binutils: maybe-all-stagefeedback-intl +install-binutils: maybe-install-opcodes +install-opcodes: maybe-install-bfd +all-gas: maybe-all-libiberty + +all-stage1-gas: maybe-all-stage1-libiberty +all-stage2-gas: maybe-all-stage2-libiberty +all-stage3-gas: maybe-all-stage3-libiberty +all-stage4-gas: maybe-all-stage4-libiberty +all-stageprofile-gas: maybe-all-stageprofile-libiberty +all-stagefeedback-gas: maybe-all-stagefeedback-libiberty +all-gas: maybe-all-opcodes + +all-stage1-gas: maybe-all-stage1-opcodes +all-stage2-gas: maybe-all-stage2-opcodes +all-stage3-gas: maybe-all-stage3-opcodes +all-stage4-gas: maybe-all-stage4-opcodes +all-stageprofile-gas: maybe-all-stageprofile-opcodes +all-stagefeedback-gas: maybe-all-stagefeedback-opcodes +all-gas: maybe-all-bfd + +all-stage1-gas: maybe-all-stage1-bfd +all-stage2-gas: maybe-all-stage2-bfd +all-stage3-gas: maybe-all-stage3-bfd +all-stage4-gas: maybe-all-stage4-bfd +all-stageprofile-gas: maybe-all-stageprofile-bfd +all-stagefeedback-gas: maybe-all-stagefeedback-bfd +all-gas: maybe-all-intl + +all-stage1-gas: maybe-all-stage1-intl +all-stage2-gas: maybe-all-stage2-intl +all-stage3-gas: maybe-all-stage3-intl +all-stage4-gas: maybe-all-stage4-intl +all-stageprofile-gas: maybe-all-stageprofile-intl +all-stagefeedback-gas: maybe-all-stagefeedback-intl +all-gprof: maybe-all-libiberty +all-gprof: maybe-all-bfd +all-gprof: maybe-all-opcodes +all-gprof: maybe-all-intl +all-ld: maybe-all-libiberty + +all-stage1-ld: maybe-all-stage1-libiberty +all-stage2-ld: maybe-all-stage2-libiberty +all-stage3-ld: maybe-all-stage3-libiberty +all-stage4-ld: maybe-all-stage4-libiberty +all-stageprofile-ld: maybe-all-stageprofile-libiberty +all-stagefeedback-ld: maybe-all-stagefeedback-libiberty +all-ld: maybe-all-bfd + +all-stage1-ld: maybe-all-stage1-bfd +all-stage2-ld: maybe-all-stage2-bfd +all-stage3-ld: maybe-all-stage3-bfd +all-stage4-ld: maybe-all-stage4-bfd +all-stageprofile-ld: maybe-all-stageprofile-bfd +all-stagefeedback-ld: maybe-all-stagefeedback-bfd +all-ld: maybe-all-opcodes + +all-stage1-ld: maybe-all-stage1-opcodes +all-stage2-ld: maybe-all-stage2-opcodes +all-stage3-ld: maybe-all-stage3-opcodes +all-stage4-ld: maybe-all-stage4-opcodes +all-stageprofile-ld: maybe-all-stageprofile-opcodes +all-stagefeedback-ld: maybe-all-stagefeedback-opcodes +all-ld: maybe-all-build-bison + +all-stage1-ld: maybe-all-build-bison +all-stage2-ld: maybe-all-build-bison +all-stage3-ld: maybe-all-build-bison +all-stage4-ld: maybe-all-build-bison +all-stageprofile-ld: maybe-all-build-bison +all-stagefeedback-ld: maybe-all-build-bison +all-prebootstrap: maybe-all-build-bison +all-ld: maybe-all-build-byacc + +all-stage1-ld: maybe-all-build-byacc +all-stage2-ld: maybe-all-build-byacc +all-stage3-ld: maybe-all-build-byacc +all-stage4-ld: maybe-all-build-byacc +all-stageprofile-ld: maybe-all-build-byacc +all-stagefeedback-ld: maybe-all-build-byacc +all-prebootstrap: maybe-all-build-byacc +all-ld: maybe-all-build-flex + +all-stage1-ld: maybe-all-build-flex +all-stage2-ld: maybe-all-build-flex +all-stage3-ld: maybe-all-build-flex +all-stage4-ld: maybe-all-build-flex +all-stageprofile-ld: maybe-all-build-flex +all-stagefeedback-ld: maybe-all-build-flex +all-prebootstrap: maybe-all-build-flex +all-ld: maybe-all-intl + +all-stage1-ld: maybe-all-stage1-intl +all-stage2-ld: maybe-all-stage2-intl +all-stage3-ld: maybe-all-stage3-intl +all-stage4-ld: maybe-all-stage4-intl +all-stageprofile-ld: maybe-all-stageprofile-intl +all-stagefeedback-ld: maybe-all-stagefeedback-intl +all-opcodes: maybe-all-bfd + +all-stage1-opcodes: maybe-all-stage1-bfd +all-stage2-opcodes: maybe-all-stage2-bfd +all-stage3-opcodes: maybe-all-stage3-bfd +all-stage4-opcodes: maybe-all-stage4-bfd +all-stageprofile-opcodes: maybe-all-stageprofile-bfd +all-stagefeedback-opcodes: maybe-all-stagefeedback-bfd +all-opcodes: maybe-all-libiberty + +all-stage1-opcodes: maybe-all-stage1-libiberty +all-stage2-opcodes: maybe-all-stage2-libiberty +all-stage3-opcodes: maybe-all-stage3-libiberty +all-stage4-opcodes: maybe-all-stage4-libiberty +all-stageprofile-opcodes: maybe-all-stageprofile-libiberty +all-stagefeedback-opcodes: maybe-all-stagefeedback-libiberty +all-dejagnu: maybe-all-tcl +all-dejagnu: maybe-all-expect +all-dejagnu: maybe-all-tk +configure-expect: maybe-configure-tcl +configure-expect: maybe-configure-tk +all-expect: maybe-all-tcl +all-expect: maybe-all-tk +configure-itcl: maybe-configure-tcl +configure-itcl: maybe-configure-tk +all-itcl: maybe-all-tcl +all-itcl: maybe-all-tk install-itcl: maybe-install-tcl -all-sid: maybe-all-libiberty maybe-all-bfd maybe-all-opcodes maybe-all-tcl maybe-all-tk -install-sid: maybe-install-tcl maybe-install-tk -all-sim: maybe-all-libiberty maybe-all-bfd maybe-all-opcodes maybe-all-readline maybe-configure-gdb configure-tk: maybe-configure-tcl all-tk: maybe-all-tcl -configure-tix: maybe-configure-tcl maybe-configure-tk -all-tix: maybe-all-tcl maybe-all-tk -all-texinfo: maybe-all-libiberty - -# Other host modules. Warning, these are not well tested. -all-autoconf: maybe-all-m4 maybe-all-texinfo -all-automake: maybe-all-m4 maybe-all-texinfo -all-bison: maybe-all-texinfo -all-diff: maybe-all-libiberty -all-fastjar: maybe-all-zlib maybe-all-libiberty -all-fileutils: maybe-all-libiberty -all-flex: maybe-all-libiberty maybe-all-bison maybe-all-byacc -all-gzip: maybe-all-libiberty -all-hello: maybe-all-libiberty -all-m4: maybe-all-libiberty maybe-all-texinfo -all-make: maybe-all-libiberty maybe-all-intl -all-patch: maybe-all-libiberty +all-sid: maybe-all-libiberty +all-sid: maybe-all-bfd +all-sid: maybe-all-opcodes +all-sid: maybe-all-tcl +all-sid: maybe-all-tk +install-sid: maybe-install-tcl +install-sid: maybe-install-tk +all-sim: maybe-all-libiberty +all-sim: maybe-all-bfd +all-sim: maybe-all-opcodes +all-sim: maybe-all-readline +all-sim: maybe-configure-gdb +all-fastjar: maybe-all-zlib +all-fastjar: maybe-all-build-texinfo +all-fastjar: maybe-all-libiberty +all-autoconf: maybe-all-m4 +all-autoconf: maybe-all-build-texinfo +all-automake: maybe-all-m4 +all-automake: maybe-all-build-texinfo +all-automake: maybe-all-autoconf +all-bison: maybe-all-intl +all-bison: maybe-all-build-texinfo +all-diff: maybe-all-intl +all-diff: maybe-all-build-texinfo +all-fileutils: maybe-all-intl +all-fileutils: maybe-all-build-texinfo +all-flex: maybe-all-build-bison +all-flex: maybe-all-build-byacc +all-flex: maybe-all-intl +all-flex: maybe-all-m4 +all-flex: maybe-all-build-texinfo +all-gzip: maybe-all-intl +all-gzip: maybe-all-zlib +all-gzip: maybe-all-build-texinfo +all-hello: maybe-all-intl +all-hello: maybe-all-build-texinfo +all-m4: maybe-all-intl +all-m4: maybe-all-build-texinfo +all-make: maybe-all-intl +all-make: maybe-all-build-texinfo +all-patch: maybe-all-build-texinfo +all-make: maybe-all-build-texinfo all-prms: maybe-all-libiberty -all-recode: maybe-all-libiberty -all-sed: maybe-all-libiberty +all-recode: maybe-all-build-texinfo +all-sed: maybe-all-build-texinfo all-send-pr: maybe-all-prms -all-tar: maybe-all-libiberty -all-uudecode: maybe-all-libiberty - -ALL_GCC = maybe-all-gcc -ALL_GCC_C = $(ALL_GCC) maybe-all-target-newlib maybe-all-target-libgloss -ALL_GCC_CXX = $(ALL_GCC_C) maybe-all-target-libstdc++-v3 - -# Target modules specific to gcc. -configure-target-boehm-gc: $(ALL_GCC_C) maybe-configure-target-qthreads +all-tar: maybe-all-build-texinfo +all-uudecode: maybe-all-build-texinfo +configure-target-boehm-gc: maybe-configure-target-qthreads configure-target-fastjar: maybe-configure-target-zlib -all-target-fastjar: maybe-all-target-zlib maybe-all-target-libiberty -configure-target-libf2c: $(ALL_GCC_C) -all-target-libf2c: maybe-all-target-libiberty -configure-target-libffi: $(ALL_GCC_C) -configure-target-libjava: $(ALL_GCC_C) maybe-configure-target-zlib maybe-configure-target-boehm-gc maybe-configure-target-qthreads maybe-configure-target-libffi -all-target-libjava: maybe-all-fastjar maybe-all-target-zlib maybe-all-target-boehm-gc maybe-all-target-qthreads maybe-all-target-libffi -configure-target-libobjc: $(ALL_GCC_C) +all-target-fastjar: maybe-all-target-zlib +all-target-fastjar: maybe-all-target-libiberty +configure-target-libjava: maybe-configure-target-zlib +configure-target-libjava: maybe-configure-target-boehm-gc +configure-target-libjava: maybe-configure-target-qthreads +configure-target-libjava: maybe-configure-target-libffi +all-target-libjava: maybe-all-fastjar +all-target-libjava: maybe-all-target-zlib +all-target-libjava: maybe-all-target-boehm-gc +all-target-libjava: maybe-all-target-qthreads +all-target-libjava: maybe-all-target-libffi all-target-libobjc: maybe-all-target-libiberty -configure-target-libstdc++-v3: $(ALL_GCC_C) all-target-libstdc++-v3: maybe-all-target-libiberty -configure-target-zlib: $(ALL_GCC_C) - -# Target modules in the 'src' repository. -configure-target-examples: $(ALL_GCC_C) -configure-target-libgloss: $(ALL_GCC) all-target-libgloss: maybe-configure-target-newlib -configure-target-libiberty: $(ALL_GCC) -configure-target-libtermcap: $(ALL_GCC_C) -configure-target-newlib: $(ALL_GCC) -configure-target-rda: $(ALL_GCC_C) -configure-target-winsup: $(ALL_GCC_C) -all-target-winsup: maybe-all-target-libiberty maybe-all-target-libtermcap +all-target-winsup: maybe-all-target-libiberty +all-target-winsup: maybe-all-target-libtermcap -# Other target modules. Warning, these are not well tested. -configure-target-gperf: $(ALL_GCC_CXX) -all-target-gperf: maybe-all-target-libiberty maybe-all-target-libstdc++-v3 -configure-target-qthreads: $(ALL_GCC_C) -# Dependencies of maybe-foo on foo. These are used because, for example, -# all-gcc only depends on all-gas if gas is present and being configured. -@maybe_dependencies@ +# Non-toplevel bootstrap rules must depend on several packages, to be built +# before gcc. Another wart that will go away, hopefully soon. +@if gcc-no-bootstrap + +all-prebootstrap: maybe-all-bfd +all-prebootstrap: maybe-all-opcodes +all-prebootstrap: maybe-all-binutils +all-prebootstrap: maybe-all-gas +all-prebootstrap: maybe-all-intl +all-prebootstrap: maybe-all-ld +all-prebootstrap: maybe-all-libcpp +all-prebootstrap: maybe-all-libdecnumber +all-prebootstrap: maybe-all-libiberty +all-prebootstrap: maybe-all-zlib +@endif gcc-no-bootstrap + +CONFIGURE_GDB_TK = @CONFIGURE_GDB_TK@ +GDB_TK = @GDB_TK@ +INSTALL_GDB_TK = @INSTALL_GDB_TK@ +configure-gdb: $(CONFIGURE_GDB_TK) +all-gdb: $(gdbnlmrequirements) $(GDB_TK) +install-gdb: $(INSTALL_GDB_TK) # Serialization dependencies. Host configures don't work well in parallel to # each other, due to contention over config.cache. Target configures and @@ -23942,17 +41083,6 @@ configure-target-qthreads: $(ALL_GCC_C) # Regenerating top level configury # -------------------------------- -# Multilib.out tells target dirs what multilibs they should build. -# There is really only one copy. We use the 'timestamp' method to -# work around various timestamp bugs on some systems. -# We use move-if-change so that it's only considered updated when it -# actually changes, because it has to depend on a phony target. -multilib.out: maybe-all-gcc - @r=`${PWD_COMMAND}`; export r; \ - echo "Checking multilib configuration..."; \ - $(CC_FOR_TARGET) --print-multi-lib > multilib.tmp 2> /dev/null ; \ - $(SHELL) $(srcdir)/move-if-change multilib.tmp multilib.out ; \ - # Rebuilding Makefile.in, using autogen. AUTOGEN = autogen $(srcdir)/Makefile.in: @MAINT@ $(srcdir)/Makefile.tpl $(srcdir)/Makefile.def @@ -23962,7 +41092,7 @@ $(srcdir)/Makefile.in: @MAINT@ $(srcdir)/Makefile.tpl $(srcdir)/Makefile.def Makefile: $(srcdir)/Makefile.in config.status CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status -config.status: configure $(gcc_version_trigger) +config.status: configure CONFIG_SHELL="$(SHELL)" $(SHELL) ./config.status --recheck # Rebuilding configure. diff --git a/contrib/binutils/Makefile.tpl b/contrib/binutils/Makefile.tpl index 3a7750c845a..b83d8d5abd9 100644 --- a/contrib/binutils/Makefile.tpl +++ b/contrib/binutils/Makefile.tpl @@ -6,7 +6,7 @@ in # # Makefile for directory with subdirs to build. # Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, -# 1999, 2000, 2001, 2002, 2003 Free Software Foundation +# 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -20,7 +20,7 @@ in # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # ------------------------------- @@ -53,6 +53,9 @@ libdir = @libdir@ includedir = @includedir@ oldincludedir = @oldincludedir@ infodir = @infodir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +htmldir = @htmldir@ mandir = @mandir@ man1dir = $(mandir)/man1 man2dir = $(mandir)/man2 @@ -68,65 +71,158 @@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_DATA = @INSTALL_DATA@ +LN = @LN@ +LN_S = @LN_S@ # ------------------------------------------------- # Miscellaneous non-standard autoconf-set variables # ------------------------------------------------- -links=@configlinks@ -# The file containing GCC's version number. -gcc_version_trigger = @gcc_version_trigger@ -gcc_version = @gcc_version@ - # The gcc driver likes to know the arguments it was configured with. TOPLEVEL_CONFIGURE_ARGUMENTS=@TOPLEVEL_CONFIGURE_ARGUMENTS@ -gxx_include_dir = @gxx_include_dir@ -libstdcxx_incdir = @libstdcxx_incdir@ - tooldir = @tooldir@ build_tooldir = @build_tooldir@ -# Directory in which the compiler finds executables, libraries, etc. -libsubdir = $(libdir)/gcc/$(target_alias)/$(gcc_version) GDB_NLM_DEPS = # This is the name of the environment variable used for the path to # the libraries. RPATH_ENVVAR = @RPATH_ENVVAR@ -# This is set by configure to REALLY_SET_LIB_PATH if --enable-shared -# was used. -SET_LIB_PATH = @SET_LIB_PATH@ - -# configure.in sets SET_LIB_PATH to this if --enable-shared was used. -# Some platforms don't like blank entries, so we remove duplicate, -# leading and trailing colons. -REALLY_SET_LIB_PATH = \ - $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH):$(TARGET_LIB_PATH):$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); - -# This is the list of directories to be built for the build system. -BUILD_CONFIGDIRS = libiberty # Build programs are put under this directory. BUILD_SUBDIR = @build_subdir@ # This is set by the configure script to the arguments to use when configuring # directories built for the build system. -BUILD_CONFIGARGS = @build_configargs@ +BUILD_CONFIGARGS = @build_configargs@ --with-build-subdir="$(BUILD_SUBDIR)" + +# This is the list of variables to export in the environment when +# configuring any subdirectory. It must also be exported whenever +# recursing into a build directory in case that directory's Makefile +# re-runs configure. +BASE_EXPORTS = \ + FLEX="$(FLEX)"; export FLEX; \ + LEX="$(LEX)"; export LEX; \ + BISON="$(BISON)"; export BISON; \ + YACC="$(YACC)"; export YACC; \ + M4="$(M4)"; export M4; \ + MAKEINFO="$(MAKEINFO)"; export MAKEINFO; + +# This is the list of variables to export in the environment when +# configuring subdirectories for the build system. +BUILD_EXPORTS = \ + $(BASE_EXPORTS) \ + AR="$(AR_FOR_BUILD)"; export AR; \ + AS="$(AS_FOR_BUILD)"; export AS; \ + CC="$(CC_FOR_BUILD)"; export CC; \ + CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ + CXX="$(CXX_FOR_BUILD)"; export CXX; \ + CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \ + GCJ="$(GCJ_FOR_BUILD)"; export GCJ; \ + GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \ + DLLTOOL="$(DLLTOOL_FOR_BUILD)"; export DLLTOOL; \ + LD="$(LD_FOR_BUILD)"; export LD; \ + LDFLAGS="$(LDFLAGS_FOR_BUILD)"; export LDFLAGS; \ + NM="$(NM_FOR_BUILD)"; export NM; \ + RANLIB="$(RANLIB_FOR_BUILD)"; export RANLIB; \ + WINDRES="$(WINDRES_FOR_BUILD)"; export WINDRES; # This is the list of directories to built for the host system. SUBDIRS = @configdirs@ # This is set by the configure script to the arguments to use when configuring # directories built for the host system. HOST_CONFIGARGS = @host_configargs@ +# Host programs are put under this directory, which is . except if building +# with srcdir=.. +HOST_SUBDIR = @host_subdir@ +# This is the list of variables to export in the environment when +# configuring subdirectories for the host system. We need to pass +# some to the GCC configure because of its hybrid host/target nature. +HOST_EXPORTS = \ + $(BASE_EXPORTS) \ + CC="$(CC)"; export CC; \ + CFLAGS="$(CFLAGS)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ + CXX="$(CXX)"; export CXX; \ + CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ + AR="$(AR)"; export AR; \ + AS="$(AS)"; export AS; \ + CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ + DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + LD="$(LD)"; export LD; \ + LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ + NM="$(NM)"; export NM; \ + RANLIB="$(RANLIB)"; export RANLIB; \ + WINDRES="$(WINDRES)"; export WINDRES; \ + OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ + OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ + AR_FOR_TARGET="$(AR_FOR_TARGET)"; export AR_FOR_TARGET; \ + AS_FOR_TARGET="$(AS_FOR_TARGET)"; export AS_FOR_TARGET; \ + GCC_FOR_TARGET="$(GCC_FOR_TARGET)"; export GCC_FOR_TARGET; \ + LD_FOR_TARGET="$(LD_FOR_TARGET)"; export LD_FOR_TARGET; \ + NM_FOR_TARGET="$(NM_FOR_TARGET)"; export NM_FOR_TARGET; \ + OBJDUMP_FOR_TARGET="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP_FOR_TARGET; \ + RANLIB_FOR_TARGET="$(RANLIB_FOR_TARGET)"; export RANLIB_FOR_TARGET; \ + TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \ + GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \ + GMPINC="$(HOST_GMPINC)"; export GMPINC; \ +@if gcc-bootstrap + $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \ +@endif gcc-bootstrap + $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); + +# Similar, for later GCC stages. +POSTSTAGE1_HOST_EXPORTS = \ + $(HOST_EXPORTS) \ + CC="$(STAGE_CC_WRAPPER) $$r/$(HOST_SUBDIR)/prev-gcc/xgcc$(exeext) \ + -B$$r/$(HOST_SUBDIR)/prev-gcc/ -B$(build_tooldir)/bin/"; export CC; \ + CC_FOR_BUILD="$(STAGE_CC_WRAPPER) \ + $$r/$(HOST_SUBDIR)/prev-gcc/xgcc$(exeext) \ + -B$$r/$(HOST_SUBDIR)/prev-gcc/ \ + -B$(build_tooldir)/bin/"; export CC_FOR_BUILD; -# This is set by the configure script to the list of directories which -# should be built using the target tools. -TARGET_CONFIGDIRS = @target_configdirs@ # Target libraries are put under this directory: TARGET_SUBDIR = @target_subdir@ # This is set by the configure script to the arguments to use when configuring # directories built for the target. -TARGET_CONFIGARGS = @target_configargs@ +TARGET_CONFIGARGS = @target_configargs@ --with-target-subdir="$(TARGET_SUBDIR)" +# This is the list of variables to export in the environment when +# configuring subdirectories for the host system. +BASE_TARGET_EXPORTS = \ + $(BASE_EXPORTS) \ + AR="$(AR_FOR_TARGET)"; export AR; \ + AS="$(COMPILER_AS_FOR_TARGET)"; export AS; \ + CC="$(CC_FOR_TARGET)"; export CC; \ + CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ + CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ + CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \ + CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \ + GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \ + GFORTRAN="$(GFORTRAN_FOR_TARGET)"; export GFORTRAN; \ + DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \ + LD="$(COMPILER_LD_FOR_TARGET)"; export LD; \ + LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \ + LIPO="$(LIPO_FOR_TARGET)"; export LIPO; \ + NM="$(COMPILER_NM_FOR_TARGET)"; export NM; \ + OBJDUMP="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP; \ + RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \ + STRIP="$(STRIP_FOR_TARGET)"; export STRIP; \ + WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \ + $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); + +RAW_CXX_TARGET_EXPORTS = \ + $(BASE_TARGET_EXPORTS) \ + CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \ + CXX="$(RAW_CXX_FOR_TARGET)"; export CXX; + +NORMAL_TARGET_EXPORTS = \ + $(BASE_TARGET_EXPORTS) \ + CXX="$(CXX_FOR_TARGET)"; export CXX; + +# Where to find GMP +HOST_GMPLIBS = @gmplibs@ +HOST_GMPINC = @gmpinc@ # ---------------------------------------------- # Programs producing files for the BUILD machine @@ -154,42 +250,19 @@ CXX_FOR_BUILD = $(CXX) BUILD_PREFIX = @BUILD_PREFIX@ BUILD_PREFIX_1 = @BUILD_PREFIX_1@ -BISON=@BISON@ -USUAL_BISON = `if [ -f $$r/bison/bison ] ; then \ - echo $$r/bison/bison -L $$s/bison/ ; \ - else \ - echo bison ; \ - fi` +# Flags to pass to stage2 and later makes. They are defined +# here so that they can be overridden by Makefile fragments. +BOOT_CFLAGS= -g -O2 +BOOT_LDFLAGS= -DEFAULT_YACC = @DEFAULT_YACC@ -YACC=@YACC@ -USUAL_YACC = `if [ -f $$r/bison/bison ] ; then \ - echo $$r/bison/bison -y -L $$s/bison/ ; \ - elif [ -f $$r/byacc/byacc ] ; then \ - echo $$r/byacc/byacc ; \ - else \ - echo ${DEFAULT_YACC} ; \ - fi` - -DEFAULT_LEX = @DEFAULT_LEX@ -LEX=@LEX@ -USUAL_LEX = `if [ -f $$r/flex/flex ] ; \ - then echo $$r/flex/flex ; \ - else echo ${DEFAULT_LEX} ; fi` - -DEFAULT_M4 = @DEFAULT_M4@ -M4 = `if [ -f $$r/m4/m4 ] ; \ - then echo $$r/m4/m4 ; \ - else echo ${DEFAULT_M4} ; fi` - -# For an installed makeinfo, we require it to be from texinfo 4.2 or -# higher, else we use the "missing" dummy. -MAKEINFO=@MAKEINFO@ -USUAL_MAKEINFO = `if [ -f $$r/texinfo/makeinfo/makeinfo ] ; \ - then echo $$r/texinfo/makeinfo/makeinfo ; \ - else if (makeinfo --version \ - | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.[2-9]|[5-9])') >/dev/null 2>&1; \ - then echo makeinfo; else echo $$s/missing makeinfo; fi; fi` +BISON = @BISON@ +YACC = @YACC@ +FLEX = @FLEX@ +LEX = @LEX@ +M4 = @M4@ +MAKEINFO = @MAKEINFO@ +EXPECT = @EXPECT@ +RUNTEST = @RUNTEST@ # This just becomes part of the MAKEINFO definition passed down to # sub-makes. It lets flags be given on the command line while still @@ -197,177 +270,74 @@ USUAL_MAKEINFO = `if [ -f $$r/texinfo/makeinfo/makeinfo ] ; \ # (Default to avoid splitting info files by setting the threshold high.) MAKEINFOFLAGS = --split-size=5000000 -EXPECT = `if [ -f $$r/expect/expect ] ; \ - then echo $$r/expect/expect ; \ - else echo expect ; fi` - -RUNTEST = `if [ -f $$s/dejagnu/runtest ] ; \ - then echo $$s/dejagnu/runtest ; \ - else echo runtest ; fi` - # --------------------------------------------- # Programs producing files for the HOST machine # --------------------------------------------- -# This is the list of directories that may be needed in RPATH_ENVVAR -# so that programs built for the host machine work. -HOST_LIB_PATH = $$r/bfd:$$r/opcodes - AS = @AS@ - AR = @AR@ AR_FLAGS = rc - CC = @CC@ -CFLAGS = @CFLAGS@ -LIBCFLAGS = $(CFLAGS) - CXX = @CXX@ -CXXFLAGS = @CXXFLAGS@ -LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates - DLLTOOL = @DLLTOOL@ - -NM = @NM@ - LD = @LD@ -LDFLAGS = - +LIPO = @LIPO@ +NM = @NM@ +OBJDUMP = @OBJDUMP@ RANLIB = @RANLIB@ - +STRIP = @STRIP@ WINDRES = @WINDRES@ +CFLAGS = @CFLAGS@ +LDFLAGS = +LIBCFLAGS = $(CFLAGS) +CXXFLAGS = @CXXFLAGS@ +LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates PICFLAG = # ----------------------------------------------- # Programs producing files for the TARGET machine # ----------------------------------------------- -# This is the list of directories that may be needed in RPATH_ENVVAR -# so that prorgams built for the target machine work. -TARGET_LIB_PATH = $$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs: - FLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@ AR_FOR_TARGET=@AR_FOR_TARGET@ -USUAL_AR_FOR_TARGET = ` \ - if [ -f $$r/binutils/ar ] ; then \ - echo $$r/binutils/ar ; \ - else \ - if [ '$(host)' = '$(target)' ] ; then \ - echo $(AR); \ - else \ - echo ar | sed '$(program_transform_name)' ; \ - fi; \ - fi` - AS_FOR_TARGET=@AS_FOR_TARGET@ -USUAL_AS_FOR_TARGET = ` \ - if [ -f $$r/gas/as-new ] ; then \ - echo $$r/gas/as-new ; \ - elif [ -f $$r/gcc/xgcc ]; then \ - $(CC_FOR_TARGET) -print-prog-name=as ; \ - else \ - if [ '$(host)' = '$(target)' ] ; then \ - echo $(AS); \ - else \ - echo as | sed '$(program_transform_name)' ; \ - fi; \ - fi` +CC_FOR_TARGET=$(STAGE_CC_WRAPPER) @CC_FOR_TARGET@ $(FLAGS_FOR_TARGET) -CC_FOR_TARGET = @CC_FOR_TARGET@ -# During gcc bootstrap, if we use some random cc for stage1 then -# CFLAGS will be just -g. We want to ensure that TARGET libraries -# (which we know are built with gcc) are built with optimizations so -# prepend -O2 when setting CFLAGS_FOR_TARGET. -CFLAGS_FOR_TARGET = -O2 $(CFLAGS) # If GCC_FOR_TARGET is not overriden on the command line, then this # variable is passed down to the gcc Makefile, where it is used to # build libgcc2.a. We define it here so that it can itself be # overridden on the command line. -GCC_FOR_TARGET=@GCC_FOR_TARGET@ -USUAL_GCC_FOR_TARGET = $(STAGE_CC_WRAPPER) $$r/gcc/xgcc -B$$r/gcc/ $(FLAGS_FOR_TARGET) -LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET) - -CXX_FOR_TARGET = @CXX_FOR_TARGET@ -RAW_CXX_FOR_TARGET = @RAW_CXX_FOR_TARGET@ -CXX_FOR_TARGET_FOR_RECURSIVE_MAKE = @CXX_FOR_TARGET_FOR_RECURSIVE_MAKE@ -RAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE = @RAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE@ -CXXFLAGS_FOR_TARGET = $(CXXFLAGS) -LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates - +GCC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCC_FOR_TARGET@ $(FLAGS_FOR_TARGET) +CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @CXX_FOR_TARGET@ $(FLAGS_FOR_TARGET) +RAW_CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @RAW_CXX_FOR_TARGET@ $(FLAGS_FOR_TARGET) +GCJ_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCJ_FOR_TARGET@ $(FLAGS_FOR_TARGET) +GFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) @GFORTRAN_FOR_TARGET@ $(FLAGS_FOR_TARGET) DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@ -USUAL_DLLTOOL_FOR_TARGET = ` \ - if [ -f $$r/binutils/dlltool ] ; then \ - echo $$r/binutils/dlltool ; \ - else \ - if [ '$(host)' = '$(target)' ] ; then \ - echo $(DLLTOOL); \ - else \ - echo dlltool | sed '$(program_transform_name)' ; \ - fi; \ - fi` - -GCJ_FOR_TARGET = @GCJ_FOR_TARGET@ - LD_FOR_TARGET=@LD_FOR_TARGET@ -USUAL_LD_FOR_TARGET = ` \ - if [ -f $$r/ld/ld-new ] ; then \ - echo $$r/ld/ld-new ; \ - elif [ -f $$r/gcc/xgcc ]; then \ - $(CC_FOR_TARGET) -print-prog-name=ld ; \ - else \ - if [ '$(host)' = '$(target)' ] ; then \ - echo $(LD); \ - else \ - echo ld | sed '$(program_transform_name)' ; \ - fi; \ - fi` - -LDFLAGS_FOR_TARGET = +LIPO_FOR_TARGET=@LIPO_FOR_TARGET@ NM_FOR_TARGET=@NM_FOR_TARGET@ -USUAL_NM_FOR_TARGET = ` \ - if [ -f $$r/binutils/nm-new ] ; then \ - echo $$r/binutils/nm-new ; \ - elif [ -f $$r/gcc/xgcc ]; then \ - $(CC_FOR_TARGET) -print-prog-name=nm ; \ - else \ - if [ '$(host)' = '$(target)' ] ; then \ - echo $(NM); \ - else \ - echo nm | sed '$(program_transform_name)' ; \ - fi; \ - fi` - +OBJDUMP_FOR_TARGET=@OBJDUMP_FOR_TARGET@ RANLIB_FOR_TARGET=@RANLIB_FOR_TARGET@ -USUAL_RANLIB_FOR_TARGET = ` \ - if [ -f $$r/binutils/ranlib ] ; then \ - echo $$r/binutils/ranlib ; \ - else \ - if [ '$(host)' = '$(target)' ] ; then \ - if [ x'$(RANLIB)' != x ]; then \ - echo $(RANLIB); \ - else \ - echo ranlib; \ - fi; \ - else \ - echo ranlib | sed '$(program_transform_name)' ; \ - fi; \ - fi` - +STRIP_FOR_TARGET=@STRIP_FOR_TARGET@ WINDRES_FOR_TARGET=@WINDRES_FOR_TARGET@ -USUAL_WINDRES_FOR_TARGET = ` \ - if [ -f $$r/binutils/windres ] ; then \ - echo $$r/binutils/windres ; \ - else \ - if [ '$(host)' = '$(target)' ] ; then \ - echo $(WINDRES); \ - else \ - echo windres | sed '$(program_transform_name)' ; \ - fi; \ - fi` +COMPILER_AS_FOR_TARGET=@COMPILER_AS_FOR_TARGET@ +COMPILER_LD_FOR_TARGET=@COMPILER_LD_FOR_TARGET@ +COMPILER_NM_FOR_TARGET=@COMPILER_NM_FOR_TARGET@ + +# During gcc bootstrap, if we use some random cc for stage1 then +# CFLAGS will be just -g. We want to ensure that TARGET libraries +# (which we know are built with gcc) are built with optimizations so +# prepend -O2 when setting CFLAGS_FOR_TARGET. +CFLAGS_FOR_TARGET = -O2 $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET) +SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@ +CXXFLAGS_FOR_TARGET = $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET) +LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET) +LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates +LDFLAGS_FOR_TARGET = PICFLAG_FOR_TARGET = # ------------------------------------ @@ -376,8 +346,7 @@ PICFLAG_FOR_TARGET = # The first rule in the file had better be this one. Don't put any above it. # This lives here to allow makefile fragments to contain dependencies. -all: all.normal -.PHONY: all +all: #### host and target specific makefile fragments come in here. @target_makefile_frag@ @@ -386,20 +355,46 @@ all: all.normal @host_makefile_frag@ ### +# This is the list of directories that may be needed in RPATH_ENVVAR +# so that prorgams built for the target machine work. +TARGET_LIB_PATH = [+ FOR target_modules +][+ + IF lib_path +]$(TARGET_LIB_PATH_[+module+])[+ ENDIF lib_path +][+ + ENDFOR target_modules +]$(HOST_LIB_PATH_gcc) +[+ FOR target_modules +][+ IF lib_path +] +@if target-[+module+] +TARGET_LIB_PATH_[+module+] = $$r/$(TARGET_SUBDIR)/[+module+]/[+lib_path+]: +@endif target-[+module+] +[+ ENDIF lib_path +][+ ENDFOR target_modules +] + + +# This is the list of directories that may be needed in RPATH_ENVVAR +# so that programs built for the host machine work. +HOST_LIB_PATH = [+ FOR host_modules +][+ + IF lib_path +]$(HOST_LIB_PATH_[+module+])[+ ENDIF lib_path +][+ + ENDFOR host_modules +] + +# Define HOST_LIB_PATH_gcc here, for the sake of TARGET_LIB_PATH, ouch +@if gcc +HOST_LIB_PATH_gcc = $$r/$(HOST_SUBDIR)/gcc:$$r/$(HOST_SUBDIR)/prev-gcc: +@endif gcc + +[+ FOR host_modules +][+ IF lib_path +] +@if [+module+] +HOST_LIB_PATH_[+module+] = \ + $$r/$(HOST_SUBDIR)/[+module+]/[+lib_path+]:[+ IF bootstrap + +]$$r/$(HOST_SUBDIR)/prev-[+module+]/[+lib_path+]:[+ ENDIF bootstrap +] +@endif [+module+] +[+ ENDIF lib_path +][+ ENDFOR host_modules +] + # Flags to pass down to all sub-makes. -BASE_FLAGS_TO_PASS = [+ FOR flags_to_pass +]\ - "[+flag+]=$([+flag+])" [+ ENDFOR flags_to_pass +]\ +BASE_FLAGS_TO_PASS =[+ FOR flags_to_pass +][+ IF optional +] \ + "`echo '[+flag+]=$([+flag+])' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"[+ ELSE optional +] \ + "[+flag+]=$([+flag+])"[+ ENDIF optional+][+ ENDFOR flags_to_pass +] \ "CONFIG_SHELL=$(SHELL)" \ "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" -# For any flags above that may contain shell code that varies from one -# target library to another. When doing recursive invocations of the -# top-level Makefile, we don't want the outer make to evaluate them, -# so we pass these variables down unchanged. They must not contain -# single nor double quotes. -RECURSE_FLAGS = \ - CXX_FOR_TARGET='$(CXX_FOR_TARGET_FOR_RECURSIVE_MAKE)' \ - RAW_CXX_FOR_TARGET='$(RAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE)' \ +# We leave this in just in case, but it is not needed anymore. +RECURSE_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) # Flags to pass down to most sub-makes, in which we're building with # the host environment. @@ -410,8 +405,11 @@ EXTRA_HOST_FLAGS = \ 'CXX=$(CXX)' \ 'DLLTOOL=$(DLLTOOL)' \ 'LD=$(LD)' \ + 'LIPO=$(LIPO)' \ 'NM=$(NM)' \ + 'OBJDUMP=$(OBJDUMP)' \ 'RANLIB=$(RANLIB)' \ + 'STRIP=$(STRIP)' \ 'WINDRES=$(WINDRES)' FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) @@ -429,20 +427,23 @@ X11_FLAGS_TO_PASS = \ 'X11_EXTRA_LIBS=$(X11_EXTRA_LIBS)' # Flags to pass down to makes which are built with the target environment. -# The double $ decreases the length of the command line; the variables -# are set in BASE_FLAGS_TO_PASS, and the sub-make will expand them. +# The double $ decreases the length of the command line; those variables +# are set in BASE_FLAGS_TO_PASS, and the sub-make will expand them. The +# COMPILER_ prefixed variables are not passed down so we expand them here. EXTRA_TARGET_FLAGS = \ 'AR=$$(AR_FOR_TARGET)' \ - 'AS=$$(AS_FOR_TARGET)' \ + 'AS=$(COMPILER_AS_FOR_TARGET)' \ 'CC=$$(CC_FOR_TARGET)' \ 'CFLAGS=$$(CFLAGS_FOR_TARGET)' \ 'CXX=$$(CXX_FOR_TARGET)' \ 'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \ 'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \ - 'LD=$$(LD_FOR_TARGET)' \ + 'LD=$(COMPILER_LD_FOR_TARGET)' \ + 'LDFLAGS=$$(LDFLAGS_FOR_TARGET)' \ 'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \ 'LIBCXXFLAGS=$$(LIBCXXFLAGS_FOR_TARGET)' \ - 'NM=$$(NM_FOR_TARGET)' \ + 'NM=$(COMPILER_NM_FOR_TARGET)' \ + 'OBJDUMP=$$(OBJDUMP_FOR_TARGET)' \ 'RANLIB=$$(RANLIB_FOR_TARGET)' \ 'WINDRES=$$(WINDRES_FOR_TARGET)' @@ -455,24 +456,17 @@ TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS) # The BUILD_* variables are a special case, which are used for the gcc # cross-building scheme. EXTRA_GCC_FLAGS = \ - 'BUILD_PREFIX=$(BUILD_PREFIX)' \ - 'BUILD_PREFIX_1=$(BUILD_PREFIX_1)' \ "GCC_FOR_TARGET=$(GCC_FOR_TARGET)" \ - "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \ - "`echo 'LANGUAGES=$(LANGUAGES)' | sed -e s/.*=$$/XFOO=/`" \ - "`echo 'STMP_FIXPROTO=$(STMP_FIXPROTO)' | sed -e s/.*=$$/XFOO=/`" \ - "`echo 'LIMITS_H_TEST=$(LIMITS_H_TEST)' | sed -e s/.*=$$/XFOO=/`" \ - "`echo 'LIBGCC2_CFLAGS=$(LIBGCC2_CFLAGS)' | sed -e s/.*=$$/XFOO=/`" \ - "`echo 'LIBGCC2_DEBUG_CFLAGS=$(LIBGCC2_DEBUG_CFLAGS)' | sed -e s/.*=$$/XFOO=/`" \ - "`echo 'LIBGCC2_INCLUDES=$(LIBGCC2_INCLUDES)' | sed -e s/.*=$$/XFOO=/`" \ - "`echo 'STAGE1_CFLAGS=$(STAGE1_CFLAGS)' | sed -e s/.*=$$/XFOO=/`" \ - "`echo 'BOOT_CFLAGS=$(BOOT_CFLAGS)' | sed -e s/.*=$$/XFOO=/`" \ - "`echo 'BOOT_ADAFLAGS=$(BOOT_ADAFLAGS)' | sed -e s/.*=$$/XFOO=/`" + "`echo 'STMP_FIXPROTO=$(STMP_FIXPROTO)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \ + "`echo 'LIMITS_H_TEST=$(LIMITS_H_TEST)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \ + "`echo 'LIBGCC2_CFLAGS=$(LIBGCC2_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \ + "`echo 'LIBGCC2_DEBUG_CFLAGS=$(LIBGCC2_DEBUG_CFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \ + "`echo 'LIBGCC2_INCLUDES=$(LIBGCC2_INCLUDES)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" GCC_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS) .PHONY: configure-host -configure-host: maybe-configure-gcc [+ +configure-host: [+ FOR host_modules +] \ maybe-configure-[+module+][+ ENDFOR host_modules +] @@ -482,20 +476,39 @@ configure-target: [+ maybe-configure-target-[+module+][+ ENDFOR target_modules +] -# The target built for a native build. -.PHONY: all.normal -all.normal: @all_build_modules@ all-host all-target +# The target built for a native non-bootstrap build. +.PHONY: all +all: +@if gcc-bootstrap + [ -f stage_final ] || echo stage3 > stage_final + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(MAKE) $(RECURSE_FLAGS_TO_PASS) `cat stage_final`-bubble +@endif gcc-bootstrap + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + if [ -f stage_last ]; then \ + $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target; \ + else \ + $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-host all-target; \ + fi + +.PHONY: all-build +[+ FOR build_modules +] +all-build: maybe-all-build-[+module+][+ ENDFOR build_modules +] .PHONY: all-host -all-host: maybe-all-gcc [+ - FOR host_modules +] \ - maybe-all-[+module+][+ - ENDFOR host_modules +] +[+ FOR host_modules +][+ IF bootstrap +] +@if [+module+]-no-bootstrap[+ ENDIF bootstrap +] +all-host: maybe-all-[+module+][+ IF bootstrap +] +@endif [+module+]-no-bootstrap[+ ENDIF bootstrap +][+ ENDFOR host_modules +] + .PHONY: all-target -all-target: [+ - FOR target_modules +] \ - maybe-all-target-[+module+][+ - ENDFOR target_modules +] +[+ FOR target_modules +][+ IF bootstrap +] +@if [+module+]-no-bootstrap[+ ENDIF bootstrap +] +all-target: maybe-all-target-[+module+][+ IF bootstrap +] +@endif [+module+]-no-bootstrap[+ ENDIF bootstrap +][+ ENDFOR target_modules +] # Do a target for all the subdirectories. A ``make do-X'' will do a # ``make X'' in all subdirectories (because, in general, there is a @@ -503,112 +516,32 @@ all-target: [+ # but it may do additional work as well). [+ FOR recursive_targets +] .PHONY: do-[+make_target+] -do-[+make_target+]: [+make_target+]-host [+make_target+]-target +do-[+make_target+]: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(MAKE) $(RECURSE_FLAGS_TO_PASS) [+make_target+]-host \ + [+make_target+]-target + .PHONY: [+make_target+]-host -[+make_target+]-host: maybe-[+make_target+]-gcc [+ - FOR host_modules +] \ - maybe-[+make_target+]-[+module+][+ - ENDFOR host_modules +] +[+ FOR host_modules +] +[+make_target+]-host: maybe-[+make_target+]-[+module+][+ ENDFOR host_modules +] .PHONY: [+make_target+]-target -[+make_target+]-target: [+ - FOR target_modules +] \ - maybe-[+make_target+]-target-[+module+][+ - ENDFOR target_modules +] - -# GCC, the eternal special case -.PHONY: maybe-[+make_target+]-gcc [+make_target+]-gcc -maybe-[+make_target+]-gcc: -[+make_target+]-gcc: [+ - FOR depend +]\ - [+depend+]-gcc [+ - ENDFOR depend +] - @[ -f ./gcc/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_GCC_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing [+make_target+] in gcc" ; \ - (cd gcc && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - [+make_target+]) \ - || exit 1 - -# Host modules. -[+ FOR host_modules +] -.PHONY: maybe-[+make_target+]-[+module+] [+make_target+]-[+module+] -maybe-[+make_target+]-[+module+]: -[+ IF (match-value? = "missing" (get "make_target") ) +] -# [+module+] doesn't support [+make_target+]. -[+make_target+]-[+module+]: -[+ ELSE +] -[+make_target+]-[+module+]: [+ - FOR depend +]\ - [+depend+]-[+module+] [+ - ENDFOR depend +] - @[ -f ./[+module+]/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - for flag in $(EXTRA_HOST_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing [+make_target+] in [+module+]" ; \ - (cd [+module+] && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - [+make_target+]) \ - || exit 1 -[+ ENDIF +] -[+ ENDFOR host_modules +] - -# Target modules. [+ FOR target_modules +] -.PHONY: maybe-[+make_target+]-target-[+module+] [+make_target+]-target-[+module+] -maybe-[+make_target+]-target-[+module+]: -[+ IF (match-value? = "missing" (get "make_target") ) +] -# [+module+] doesn't support [+make_target+]. -[+make_target+]-target-[+module+]: -[+ ELSE +] -[+make_target+]-target-[+module+]: [+ - FOR depend +]\ - [+depend+]-target-[+module+] [+ - ENDFOR depend +] - @[ -f $(TARGET_SUBDIR)/[+module+]/Makefile ] || exit 0 ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Doing [+make_target+] in $(TARGET_SUBDIR)/[+module+]" ; \ - for flag in $(EXTRA_TARGET_FLAGS); do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - (cd $(TARGET_SUBDIR)/[+module+] && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ - [+make_target+]) \ - || exit 1 -[+ ENDIF +] -[+ ENDFOR target_modules +] +[+make_target+]-target: maybe-[+make_target+]-target-[+module+][+ ENDFOR target_modules +] [+ ENDFOR recursive_targets +] # Here are the targets which correspond to the do-X targets. -.PHONY: info installcheck dvi install-info +.PHONY: info installcheck dvi html install-info install-html .PHONY: clean distclean mostlyclean maintainer-clean realclean .PHONY: local-clean local-distclean local-maintainer-clean info: do-info installcheck: do-installcheck dvi: do-dvi +html: do-html # Make sure makeinfo is built before we do a `make info', if we're # in fact building texinfo. @@ -620,16 +553,21 @@ install-info: do-install-info dir.info $(INSTALL_DATA) dir.info $(DESTDIR)$(infodir)/dir.info ; \ else true ; fi +install-html: do-install-html + local-clean: -rm -f *.a TEMP errs core *.o *~ \#* TAGS *.E *.log local-distclean: -rm -f Makefile config.status config.cache mh-frag mt-frag - -rm -f multilib.out multilib.tmp maybedep.tmp serdep.tmp + -rm -f maybedep.tmp serdep.tmp -if [ "$(TARGET_SUBDIR)" != "." ]; then \ rm -rf $(TARGET_SUBDIR); \ else true; fi -rm -rf $(BUILD_SUBDIR) + -if [ "$(HOST_SUBDIR)" != "." ]; then \ + rm -rf $(HOST_SUBDIR); \ + else true; fi -rm -f texinfo/po/Makefile texinfo/po/Makefile.in texinfo/info/Makefile -rm -f texinfo/doc/Makefile texinfo/po/POTFILES -rmdir texinfo/doc texinfo/info texinfo/intl texinfo/lib 2>/dev/null @@ -647,13 +585,10 @@ maintainer-clean: local-maintainer-clean do-maintainer-clean local-clean maintainer-clean: local-distclean realclean: maintainer-clean -# Extra dependency for clean-target, owing to the mixed nature of gcc +# Extra dependency for clean-target, owing to the mixed nature of gcc. clean-target: clean-target-libgcc clean-target-libgcc: - test ! -d gcc/libgcc || \ - (cd gcc/libgcc && find . -type d -print) | \ - while read d; do rm -f gcc/$$d/libgcc.a || : ; done - -rm -rf gcc/libgcc + test ! -d gcc || (cd gcc && $(MAKE) $@) # Check target. @@ -661,14 +596,24 @@ clean-target-libgcc: check: do-check # Only include modules actually being configured and built. -do-check: maybe-check-gcc [+ +.PHONY: check-host +check-host: [+ FOR host_modules +] \ maybe-check-[+module+][+ - ENDFOR host_modules +][+ + ENDFOR host_modules +] + +.PHONY: check-target +check-target: [+ FOR target_modules +] \ maybe-check-target-[+module+][+ ENDFOR target_modules +] +do-check: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(MAKE) $(RECURSE_FLAGS_TO_PASS) check-host check-target + # Automated reporting of test results. warning.log: build.log @@ -693,16 +638,20 @@ mail-report-with-warnings.log: warning.log # Installation targets. .PHONY: install uninstall -install: installdirs install-host install-target +install: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(MAKE) $(RECURSE_FLAGS_TO_PASS) installdirs install-host install-target .PHONY: install-host-nogcc install-host-nogcc: [+ - FOR host_modules +] \ - maybe-install-[+module+][+ + FOR host_modules +][+ IF (not (= (get "module") "gcc")) +] \ + maybe-install-[+module+][+ ENDIF +][+ ENDFOR host_modules +] .PHONY: install-host -install-host: maybe-install-gcc [+ +install-host: [+ FOR host_modules +] \ maybe-install-[+module+][+ ENDFOR host_modules +] @@ -720,7 +669,8 @@ uninstall: install.all: install-no-fixedincludes @if [ -f ./gcc/Makefile ] ; then \ r=`${PWD_COMMAND}` ; export r ; \ - $(SET_LIB_PATH) \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ (cd ./gcc && \ $(MAKE) $(FLAGS_TO_PASS) install-headers) ; \ else \ @@ -763,392 +713,394 @@ etags tags: TAGS # built are. TAGS: do-TAGS +# ------------------------------------ +# Macros for configure and all targets +# ------------------------------------ + +[+ DEFINE configure +] +.PHONY: configure-[+prefix+][+module+] maybe-configure-[+prefix+][+module+] +maybe-configure-[+prefix+][+module+]: +@if [+prefix+][+module+] +maybe-configure-[+prefix+][+module+]: configure-[+prefix+][+module+] +configure-[+prefix+][+module+]: [+ IF bootstrap +] +@endif [+prefix+][+module+] +@if [+prefix+][+module+]-bootstrap + @if test -f stage_last; then $(unstage); else $(MAKE) stage1-start; fi +@endif [+prefix+][+module+]-bootstrap +@if [+prefix+][+module+][+ ELSE bootstrap +] + @: $(MAKE); $(unstage)[+ ENDIF bootstrap +] + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + [+ IF check_multilibs + +]echo "Checking multilib configuration for [+module+]..."; \ + $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \ + $(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null ; \ + if test -r [+subdir+]/[+module+]/multilib.out; then \ + if cmp -s [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; then \ + rm -f [+subdir+]/[+module+]/multilib.tmp; \ + else \ + rm -f [+subdir+]/[+module+]/Makefile; \ + mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \ + fi; \ + else \ + mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \ + fi; \ + [+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \ + [+exports+] \ + echo Configuring in [+subdir+]/[+module+]; \ + cd "[+subdir+]/[+module+]" || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo [+subdir+]/[+module+]/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/[+module+]"; \ + libsrcdir="$$s/[+module+]"; \ + [+ IF no-config-site +]rm -f no-such-file || : ; \ + CONFIG_SITE=no-such-file [+ ENDIF +]$(SHELL) $${libsrcdir}/configure \ + [+args+] $${srcdiroption} [+extra_configure_flags+] \ + || exit 1 +@endif [+prefix+][+module+] + +[+ IF bootstrap +] +[+ FOR bootstrap_stage +] +.PHONY: configure-stage[+id+]-[+prefix+][+module+] maybe-configure-stage[+id+]-[+prefix+][+module+] +maybe-configure-stage[+id+]-[+prefix+][+module+]: +@if [+prefix+][+module+]-bootstrap +maybe-configure-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+] +configure-stage[+id+]-[+prefix+][+module+]: + @[ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start + @$(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + [+ IF check_multilibs + +]echo "Checking multilib configuration for [+module+]..."; \ + $(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null ; \ + if test -r [+subdir+]/[+module+]/multilib.out; then \ + if cmp -s [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; then \ + rm -f [+subdir+]/[+module+]/multilib.tmp; \ + else \ + rm -f [+subdir+]/[+module+]/Makefile; \ + mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \ + fi; \ + else \ + mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \ + fi; \ + [+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \ + [+exports+][+ IF prev +] \ + [+poststage1_exports+][+ ENDIF prev +] \ + echo Configuring stage [+id+] in [+subdir+]/[+module+] ; \ + $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] ; \ + cd [+subdir+]/[+module+] || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo [+subdir+]/[+module+]/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + srcdiroption="--srcdir=$${topdir}/[+module+]"; \ + libsrcdir="$$s/[+module+]"; \ + $(SHELL) $${libsrcdir}/configure \ + [+args+] $${srcdiroption} \ + [+stage_configure_flags+] [+extra_configure_flags+] +@endif [+prefix+][+module+]-bootstrap +[+ ENDFOR bootstrap_stage +] +[+ ENDIF bootstrap +] +[+ ENDDEF +] + +[+ DEFINE all +] +.PHONY: all-[+prefix+][+module+] maybe-all-[+prefix+][+module+] +maybe-all-[+prefix+][+module+]: +@if [+prefix+][+module+] +TARGET-[+prefix+][+module+]=[+ + IF target +][+target+][+ ELSE +]all[+ ENDIF target +] +maybe-all-[+prefix+][+module+]: all-[+prefix+][+module+] +all-[+prefix+][+module+]: configure-[+prefix+][+module+][+ IF bootstrap +] +@endif [+prefix+][+module+] +@if [+prefix+][+module+]-bootstrap + @if test -f stage_last; then $(unstage); else $(MAKE) stage1-start; fi +@endif [+prefix+][+module+]-bootstrap +@if [+prefix+][+module+][+ ELSE bootstrap +] + @: $(MAKE); $(unstage)[+ ENDIF bootstrap +] + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + [+exports+] \ + (cd [+subdir+]/[+module+] && \ + $(MAKE) [+args+] [+extra_make_flags+] $(TARGET-[+prefix+][+module+])) +@endif [+prefix+][+module+] + +[+ IF bootstrap +] +[+ FOR bootstrap_stage +] +.PHONY: all-stage[+id+]-[+prefix+][+module+] maybe-all-stage[+id+]-[+prefix+][+module+] +.PHONY: clean-stage[+id+]-[+prefix+][+module+] maybe-clean-stage[+id+]-[+prefix+][+module+] +maybe-all-stage[+id+]-[+prefix+][+module+]: +maybe-clean-stage[+id+]-[+prefix+][+module+]: +@if [+prefix+][+module+]-bootstrap +maybe-all-stage[+id+]-[+prefix+][+module+]: all-stage[+id+]-[+prefix+][+module+] +all-stage[+id+]: all-stage[+id+]-[+prefix+][+module+] +TARGET-stage[+id+]-[+prefix+][+module+] = $(TARGET-[+prefix+][+module+]) +all-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+] + @[ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + [+exports+][+ IF prev +] \ + [+poststage1_exports+][+ ENDIF prev +] \ + cd [+subdir+]/[+module+] && \ + $(MAKE) [+args+] [+ IF prev + +][+poststage1_args+][+ ENDIF prev + +] [+stage_make_flags+] [+extra_make_flags+] \ + $(TARGET-stage[+id+]-[+prefix+][+module+]) + +maybe-clean-stage[+id+]-[+prefix+][+module+]: clean-stage[+id+]-[+prefix+][+module+] +clean-stage[+id+]: clean-stage[+id+]-[+prefix+][+module+] +clean-stage[+id+]-[+prefix+][+module+]: + @[ -f [+subdir+]/[+module+]/Makefile ] || [ -f [+subdir+]/stage[+id+]-[+module+]/Makefile ] \ + || exit 0 ; \ + [ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start; \ + cd [+subdir+]/[+module+] && \ + $(MAKE) [+args+] [+ IF prev +] \ + [+poststage1_args+] [+ ENDIF prev +] \ + [+stage_make_flags+] [+extra_make_flags+] clean +@endif [+prefix+][+module+]-bootstrap + +[+ ENDFOR bootstrap_stage +] +[+ ENDIF bootstrap +] +[+ ENDDEF +] + # -------------------------------------- # Modules which run on the build machine # -------------------------------------- [+ FOR build_modules +] -.PHONY: configure-build-[+module+] maybe-configure-build-[+module+] -maybe-configure-build-[+module+]: -configure-build-[+module+]: - @test ! -f $(BUILD_SUBDIR)/[+module+]/Makefile || exit 0; \ - $(SHELL) $(srcdir)/mkinstalldirs $(BUILD_SUBDIR)/[+module+] ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - AR="$(AR_FOR_BUILD)"; export AR; \ - AS="$(AS_FOR_BUILD)"; export AS; \ - CC="$(CC_FOR_BUILD)"; export CC; \ - CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX_FOR_BUILD)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \ - GCJ="$(GCJ_FOR_BUILD)"; export GCJ; \ - DLLTOOL="$(DLLTOOL_FOR_BUILD)"; export DLLTOOL; \ - LD="$(LD_FOR_BUILD)"; export LD; \ - LDFLAGS="$(LDFLAGS_FOR_BUILD)"; export LDFLAGS; \ - NM="$(NM_FOR_BUILD)"; export NM; \ - RANLIB="$(RANLIB_FOR_BUILD)"; export RANLIB; \ - WINDRES="$(WINDRES_FOR_BUILD)"; export WINDRES; \ - echo Configuring in $(BUILD_SUBDIR)/[+module+]; \ - cd "$(BUILD_SUBDIR)/[+module+]" || exit 1; \ - case $(srcdir) in \ - /* | [A-Za-z]:[\\/]*) \ - topdir=$(srcdir) ;; \ - *) \ - case "$(BUILD_SUBDIR)" in \ - .) topdir="../$(srcdir)" ;; \ - *) topdir="../../$(srcdir)" ;; \ - esac ;; \ - esac; \ - if [ "$(srcdir)" = "." ] ; then \ - if [ "$(BUILD_SUBDIR)" != "." ] ; then \ - if $(SHELL) $$s/symlink-tree $${topdir}/[+module+] "no-such-file" ; then \ - if [ -f Makefile ]; then \ - if $(MAKE) distclean; then \ - true; \ - else \ - exit 1; \ - fi; \ - else \ - true; \ - fi; \ - else \ - exit 1; \ - fi; \ - else \ - true; \ - fi; \ - srcdiroption="--srcdir=."; \ - libsrcdir="."; \ - else \ - srcdiroption="--srcdir=$${topdir}/[+module+]"; \ - libsrcdir="$$s/[+module+]"; \ - fi; \ - rm -f no-such-file || : ; \ - CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \ - $(BUILD_CONFIGARGS) $${srcdiroption} \ - --with-build-subdir="$(BUILD_SUBDIR)" \ - || exit 1 +[+ configure prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)" + args="$(BUILD_CONFIGARGS)" no-config-site=true +] -.PHONY: all-build-[+module+] maybe-all-build-[+module+] -maybe-all-build-[+module+]: -all-build-[+module+]: configure-build-[+module+] - @r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - (cd $(BUILD_SUBDIR)/[+module+] && $(MAKE) all) -[+ ENDFOR build_modules +] +[+ all prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)" +] +[+ ENDFOR build_module +] # -------------------------------------- # Modules which run on the host machine # -------------------------------------- [+ FOR host_modules +] -.PHONY: configure-[+module+] maybe-configure-[+module+] -maybe-configure-[+module+]: -configure-[+module+]: - @test ! -f [+module+]/Makefile || exit 0; \ - [ -d [+module+] ] || mkdir [+module+]; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in [+module+]; \ - cd [+module+] || exit 1; \ - case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/[+module+]"; \ - libsrcdir="$$s/[+module+]";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/[+module+]"; \ - libsrcdir="$$s/[+module+]";; \ - esac; \ - $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ - || exit 1 +[+ configure prefix="" subdir="$(HOST_SUBDIR)" + exports="$(HOST_EXPORTS)" + poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)" + args="$(HOST_CONFIGARGS)" +] -.PHONY: all-[+module+] maybe-all-[+module+] -maybe-all-[+module+]: -all-[+module+]: configure-[+module+] - @r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd [+module+] && $(MAKE) $(FLAGS_TO_PASS)[+ - IF with_x - +] $(X11_FLAGS_TO_PASS)[+ - ENDIF with_x +] all) +[+ all prefix="" subdir="$(HOST_SUBDIR)" + exports="$(HOST_EXPORTS)" + poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)" + args="$(FLAGS_TO_PASS)" + poststage1_args="$(POSTSTAGE1_FLAGS_TO_PASS)" +] .PHONY: check-[+module+] maybe-check-[+module+] maybe-check-[+module+]: +@if [+module+] +maybe-check-[+module+]: check-[+module+] [+ IF no_check +] check-[+module+]: [+ ELIF no_check_cross +] # This module is only tested in a native toolchain. check-[+module+]: + @: $(MAKE); $(unstage) @if [ '$(host)' = '$(target)' ] ; then \ r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd [+module+] && $(MAKE) $(FLAGS_TO_PASS)[+ - IF with_x - +] $(X11_FLAGS_TO_PASS)[+ - ENDIF with_x +] check); \ + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/[+module+] && \ + $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] check); \ fi [+ ELSE check +] check-[+module+]: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd [+module+] && $(MAKE) $(FLAGS_TO_PASS)[+ - IF with_x - +] $(X11_FLAGS_TO_PASS)[+ - ENDIF with_x +] check) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/[+module+] && \ + $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] check) [+ ENDIF no_check +] +@endif [+module+] .PHONY: install-[+module+] maybe-install-[+module+] maybe-install-[+module+]: +@if [+module+] +maybe-install-[+module+]: install-[+module+] [+ IF no_install +] install-[+module+]: [+ ELSE install +] install-[+module+]: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd [+module+] && $(MAKE) $(FLAGS_TO_PASS)[+ - IF with_x - +] $(X11_FLAGS_TO_PASS)[+ - ENDIF with_x +] install) + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/[+module+] && \ + $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] install) [+ ENDIF no_install +] +@endif [+module+] + +# Other targets (info, dvi, etc.) +[+ FOR recursive_targets +] +.PHONY: maybe-[+make_target+]-[+module+] [+make_target+]-[+module+] +maybe-[+make_target+]-[+module+]: +@if [+module+] +maybe-[+make_target+]-[+module+]: [+make_target+]-[+module+] +[+ IF (match-value? = "missing" (get "make_target") ) +] +# [+module+] doesn't support [+make_target+]. +[+make_target+]-[+module+]: +[+ ELSE +] +[+make_target+]-[+module+]: [+ + FOR depend +]\ + [+depend+]-[+module+] [+ + ENDFOR depend +] + @[+ IF bootstrap +][+ ELSE +]: $(MAKE); $(unstage) + @[+ ENDIF bootstrap +][ -f ./[+module+]/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) [+extra_make_flags+]; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing [+make_target+] in [+module+]" ; \ + (cd $(HOST_SUBDIR)/[+module+] && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + [+make_target+]) \ + || exit 1 +[+ ENDIF +] +@endif [+module+] +[+ ENDFOR recursive_targets +] [+ ENDFOR host_modules +] # --------------------------------------- # Modules which run on the target machine # --------------------------------------- [+ FOR target_modules +] -.PHONY: configure-target-[+module+] maybe-configure-target-[+module+] -maybe-configure-target-[+module+]: -# There's only one multilib.out. Cleverer subdirs shouldn't need it copied. -$(TARGET_SUBDIR)/[+module+]/multilib.out: multilib.out - $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/[+module+] ; \ - rm -f $(TARGET_SUBDIR)/[+module+]/Makefile || : ; \ - cp multilib.out $(TARGET_SUBDIR)/[+module+]/multilib.out +[+ IF raw_cxx +] +[+ configure prefix="target-" subdir="$(TARGET_SUBDIR)" + check_multilibs=true + exports="$(RAW_CXX_TARGET_EXPORTS)" + args="$(TARGET_CONFIGARGS)" no-config-site=true +] -configure-target-[+module+]: $(TARGET_SUBDIR)/[+module+]/multilib.out - @test ! -f $(TARGET_SUBDIR)/[+module+]/Makefile || exit 0; \ - $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/[+module+] ; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - AR="$(AR_FOR_TARGET)"; export AR; \ - AS="$(AS_FOR_TARGET)"; export AS; \ - CC="$(CC_FOR_TARGET)"; export CC; \ - CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \[+ -IF raw_cxx +] - CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \ - CXX="$(RAW_CXX_FOR_TARGET)"; export CXX; \[+ -ELSE normal_cxx +] - CXX="$(CXX_FOR_TARGET)"; export CXX; \[+ -ENDIF raw_cxx +] - CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \ - GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \ - DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \ - LD="$(LD_FOR_TARGET)"; export LD; \ - LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \ - NM="$(NM_FOR_TARGET)"; export NM; \ - RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \ - WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \ - echo Configuring in $(TARGET_SUBDIR)/[+module+]; \ - cd "$(TARGET_SUBDIR)/[+module+]" || exit 1; \ - case $(srcdir) in \ - /* | [A-Za-z]:[\\/]*) \ - topdir=$(srcdir) ;; \ - *) \ - case "$(TARGET_SUBDIR)" in \ - .) topdir="../$(srcdir)" ;; \ - *) topdir="../../$(srcdir)" ;; \ - esac ;; \ - esac; \[+ IF stage +] - if [ "$(srcdir)" = "." ] ; then \ - if [ "$(TARGET_SUBDIR)" != "." ] ; then \ - if $(SHELL) $$s/symlink-tree $${topdir}/[+module+] "no-such-file" ; then \ - if [ -f Makefile ]; then \ - if $(MAKE) distclean; then \ - true; \ - else \ - exit 1; \ - fi; \ - else \ - true; \ - fi; \ - else \ - exit 1; \ - fi; \ - else \ - true; \ - fi; \ - srcdiroption="--srcdir=."; \ - libsrcdir="."; \ - else \[+ ENDIF stage +] - srcdiroption="--srcdir=$${topdir}/[+module+]"; \ - libsrcdir="$$s/[+module+]"; \[+ IF stage +] - fi; \[+ ENDIF stage +] - rm -f no-such-file || : ; \ - CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \ - $(TARGET_CONFIGARGS) $${srcdiroption} \ - --with-target-subdir="$(TARGET_SUBDIR)" \ - || exit 1 +[+ all prefix="target-" subdir="$(TARGET_SUBDIR)" + exports="$(RAW_CXX_TARGET_EXPORTS)" + args="$(TARGET_FLAGS_TO_PASS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'" +] +[+ ELSE +] +[+ configure prefix="target-" subdir="$(TARGET_SUBDIR)" + check_multilibs=true + exports="$(NORMAL_TARGET_EXPORTS)" + args="$(TARGET_CONFIGARGS)" no-config-site=true +] -.PHONY: all-target-[+module+] maybe-all-target-[+module+] -maybe-all-target-[+module+]: -all-target-[+module+]: configure-target-[+module+] - @r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd $(TARGET_SUBDIR)/[+module+] && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) [+ - IF raw_cxx - +] 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)' [+ - ENDIF raw_cxx - +] all) +[+ all prefix="target-" subdir="$(TARGET_SUBDIR)" + exports="$(NORMAL_TARGET_EXPORTS)" + args="$(TARGET_FLAGS_TO_PASS)" +] +[+ ENDIF +] .PHONY: check-target-[+module+] maybe-check-target-[+module+] maybe-check-target-[+module+]: +@if target-[+module+] +maybe-check-target-[+module+]: check-target-[+module+] [+ IF no_check +] # Dummy target for uncheckable module. check-target-[+module+]: [+ ELSE check +] check-target-[+module+]: + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+ +IF raw_cxx +] + $(RAW_CXX_TARGET_EXPORTS) \[+ +ELSE normal_cxx +] + $(NORMAL_TARGET_EXPORTS) \[+ +ENDIF raw_cxx +] (cd $(TARGET_SUBDIR)/[+module+] && \ $(MAKE) $(TARGET_FLAGS_TO_PASS) [+ IF raw_cxx +] 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)' [+ ENDIF raw_cxx - +] check) + +] [+extra_make_flags+] check) [+ ENDIF no_check +] +@endif target-[+module+] .PHONY: install-target-[+module+] maybe-install-target-[+module+] maybe-install-target-[+module+]: +@if target-[+module+] +maybe-install-target-[+module+]: install-target-[+module+] [+ IF no_install +] # Dummy target for uninstallable. install-target-[+module+]: [+ ELSE install +] install-target-[+module+]: installdirs + @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+ +IF raw_cxx +] + $(RAW_CXX_TARGET_EXPORTS) \[+ +ELSE normal_cxx +] + $(NORMAL_TARGET_EXPORTS) \[+ +ENDIF raw_cxx +] (cd $(TARGET_SUBDIR)/[+module+] && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) install) + $(MAKE) $(TARGET_FLAGS_TO_PASS) [+extra_make_flags+] install) [+ ENDIF no_install +] +@endif target-[+module+] + +# Other targets (info, dvi, etc.) +[+ FOR recursive_targets +] +.PHONY: maybe-[+make_target+]-target-[+module+] [+make_target+]-target-[+module+] +maybe-[+make_target+]-target-[+module+]: +@if target-[+module+] +maybe-[+make_target+]-target-[+module+]: [+make_target+]-target-[+module+] +[+ IF (match-value? = "missing" (get "make_target") ) +] +# [+module+] doesn't support [+make_target+]. +[+make_target+]-target-[+module+]: +[+ ELSE +] +[+make_target+]-target-[+module+]: [+ + FOR depend +]\ + [+depend+]-target-[+module+] [+ + ENDFOR depend +] + @: $(MAKE); $(unstage) + @[ -f $(TARGET_SUBDIR)/[+module+]/Makefile ] || exit 0 ; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+ +IF raw_cxx +] + $(RAW_CXX_TARGET_EXPORTS) \[+ +ELSE normal_cxx +] + $(NORMAL_TARGET_EXPORTS) \[+ +ENDIF raw_cxx +] + echo "Doing [+make_target+] in $(TARGET_SUBDIR)/[+module+]" ; \ + for flag in $(EXTRA_TARGET_FLAGS); do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + (cd $(TARGET_SUBDIR)/[+module+] && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" \ + [+extra_make_flags+] [+make_target+]) \ + || exit 1 +[+ ENDIF +] +@endif target-[+module+] +[+ ENDFOR recursive_targets +] [+ ENDFOR target_modules +] # ---------- # GCC module # ---------- -# Unfortunately, while gcc _should_ be a host module, -# libgcc is a target module, and gen* programs are -# build modules. So GCC is a sort of hybrid. +@if gcc-no-bootstrap +# GCC has some more recursive targets, which trigger the old +# (but still current, until the toplevel bootstrap project +# is finished) compiler bootstrapping rules. -# gcc is the only module which uses GCC_FLAGS_TO_PASS. -# Don't use shared host config.cache, as it will confuse later -# directories; GCC wants slightly different values for some -# precious variables. *sigh* -.PHONY: configure-gcc maybe-configure-gcc -maybe-configure-gcc: -configure-gcc: - @test ! -f gcc/Makefile || exit 0; \ - [ -d gcc ] || mkdir gcc; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - CC="$(CC)"; export CC; \ - CFLAGS="$(CFLAGS)"; export CFLAGS; \ - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ - CXX="$(CXX)"; export CXX; \ - CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ - TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \ - AR="$(AR)"; export AR; \ - AS="$(AS)"; export AS; \ - CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ - DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ - LD="$(LD)"; export LD; \ - LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \ - NM="$(NM)"; export NM; \ - RANLIB="$(RANLIB)"; export RANLIB; \ - WINDRES="$(WINDRES)"; export WINDRES; \ - OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ - OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ - echo Configuring in gcc; \ - cd gcc || exit 1; \ - case $(srcdir) in \ - \.) \ - srcdiroption="--srcdir=."; \ - libsrcdir=".";; \ - /* | [A-Za-z]:[\\/]*) \ - srcdiroption="--srcdir=$(srcdir)/gcc"; \ - libsrcdir="$$s/gcc";; \ - *) \ - srcdiroption="--srcdir=../$(srcdir)/gcc"; \ - libsrcdir="$$s/gcc";; \ - esac; \ - $(SHELL) $${libsrcdir}/configure \ - $(HOST_CONFIGARGS) $${srcdiroption} \ - || exit 1 - -# Don't 'make all' in gcc if it's already been made by 'bootstrap'; that -# causes trouble. This wart will be fixed eventually by moving -# the bootstrap behavior to this file. -.PHONY: all-gcc maybe-all-gcc -maybe-all-gcc: -all-gcc: configure-gcc - @if [ -f gcc/stage_last ] ; then \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) quickstrap); \ - else \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) all); \ - fi - -# Building GCC uses some tools for rebuilding "source" files -# like texinfo, bison/byacc, etc. So we must depend on those. -# -# While building GCC, it may be necessary to run various target -# programs like the assembler, linker, etc. So we depend on -# those too. -# -# In theory, on an SMP all those dependencies can be resolved -# in parallel. -# GCC_STRAP_TARGETS = bootstrap bootstrap-lean bootstrap2 bootstrap2-lean bootstrap3 bootstrap3-lean bootstrap4 bootstrap4-lean bubblestrap quickstrap cleanstrap restrap .PHONY: $(GCC_STRAP_TARGETS) -$(GCC_STRAP_TARGETS): all-bootstrap configure-gcc +$(GCC_STRAP_TARGETS): all-prebootstrap configure-gcc @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(HOST_EXPORTS) \ echo "Bootstrapping the compiler"; \ + $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,:[ :]*,:,g;s,^[ :]*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \ cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) $@ @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ @@ -1166,64 +1118,51 @@ $(GCC_STRAP_TARGETS): all-bootstrap configure-gcc msg="Comparing stage2 and stage3 of the compiler"; \ compare=compare ;; \ esac; \ - $(SET_LIB_PATH) \ + $(HOST_EXPORTS) \ echo "$$msg"; \ cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) $$compare @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \ - $(SET_LIB_PATH) \ echo "Building runtime libraries"; \ - $(MAKE) $(BASE_FLAGS_TO_PASS) $(RECURSE_FLAGS) all + $(MAKE) $(RECURSE_FLAGS_TO_PASS) all -profiledbootstrap: all-bootstrap configure-gcc +profiledbootstrap: all-prebootstrap configure-gcc @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - echo "Bootstrapping the compiler"; \ + $(HOST_EXPORTS) \ + $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,:[ :]*,:,g;s,^[ :]*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \ + echo "Bootstrapping training compiler"; \ cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) stageprofile_build @r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \ - $(SET_LIB_PATH) \ - echo "Building runtime libraries and training compiler"; \ - $(MAKE) $(BASE_FLAGS_TO_PASS) $(RECURSE_FLAGS) all - @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(HOST_EXPORTS) \ echo "Building feedback based compiler"; \ cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) stagefeedback_build + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \ + echo "Building runtime libraries"; \ + $(MAKE) $(RECURSE_FLAGS_TO_PASS) all .PHONY: cross -cross: all-texinfo all-bison all-byacc all-binutils all-gas all-ld +cross: all-build all-gas all-ld @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(HOST_EXPORTS) \ echo "Building the C and C++ compiler"; \ cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) LANGUAGES="c c++" @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \ - $(SET_LIB_PATH) \ echo "Building runtime libraries"; \ - $(MAKE) $(BASE_FLAGS_TO_PASS) $(RECURSE_FLAGS) \ - LANGUAGES="c c++" all - -.PHONY: check-gcc maybe-check-gcc -maybe-check-gcc: -check-gcc: - @if [ -f ./gcc/Makefile ] ; then \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) check); \ - else \ - true; \ - fi + $(MAKE) $(RECURSE_FLAGS_TO_PASS) LANGUAGES="c c++" all +@endif gcc-no-bootstrap +@if gcc .PHONY: check-gcc-c++ check-gcc-c++: @if [ -f ./gcc/Makefile ] ; then \ r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ + $(HOST_EXPORTS) \ (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) check-c++); \ else \ true; \ @@ -1232,18 +1171,6 @@ check-gcc-c++: .PHONY: check-c++ check-c++: check-target-libstdc++-v3 check-gcc-c++ -.PHONY: install-gcc maybe-install-gcc -maybe-install-gcc: -install-gcc: - @if [ -f ./gcc/Makefile ] ; then \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(SET_LIB_PATH) \ - (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) install); \ - else \ - true; \ - fi - # Install the gcc headers files, but not the fixed include files, # which Cygnus is not allowed to distribute. This rule is very # dependent on the workings of the gcc Makefile.in. @@ -1258,134 +1185,396 @@ gcc-no-fixedincludes: rm -f gcc/stmp-headers gcc/stmp-int-hdrs; \ r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}` ; export s; \ - $(SET_LIB_PATH) \ + $(HOST_EXPORTS) \ (cd ./gcc && \ $(MAKE) $(GCC_FLAGS_TO_PASS) install); \ rm -rf gcc/include; \ mv gcc/tmp-include gcc/include 2>/dev/null; \ else true; fi +@endif gcc + +# --------------------- +# GCC bootstrap support +# --------------------- + +# We track the current stage (the one in 'gcc') in the stage_current file. +# stage_last instead tracks the stage that was built last. These targets +# are dummy when toplevel bootstrap is not active. + +# While making host and target tools, symlinks to the final stage must be +# there, so $(unstage) should be run at various points. To avoid excessive +# recursive invocations of make, we "inline" them using a variable. These +# must be referenced as ": $(MAKE) ; $(unstage)" rather than "$(unstage)" +# to avoid warnings from the GNU Make job server. + +unstage = : +stage = : +current_stage = "" + +@if gcc-bootstrap +unstage = [ -f stage_current ] || $(MAKE) `cat stage_last`-start +stage = if [ -f stage_current ]; then $(MAKE) `cat stage_current`-end || exit 1; else :; fi +current_stage = "`cat stage_current 2> /dev/null`" +@endif gcc-bootstrap + +.PHONY: unstage stage +unstage: + @: $(MAKE); $(unstage) +stage: + @: $(MAKE); $(stage) + +# Disable commands for lean bootstrap. +LEAN = false + +# We name the build directories for the various stages "stage1-gcc", +# "stage2-gcc","stage3-gcc", etc. + +# Since the 'compare' process will fail (on debugging information) if any +# directory names are different, we need to link the gcc directory for +# the previous stage to a constant name ('prev-gcc'), and to make the name of +# the build directories constant as well. For the latter, we use naked names +# like 'gcc', because the scripts in that directory assume it. We use +# mv on platforms where symlinks to directories do not work or are not +# reliable. + +# 'touch' doesn't work right on some platforms. +STAMP = echo timestamp > + +# Only build the C compiler for stage1, because that is the only one that +# we can guarantee will build with the native compiler, and also it is the +# only thing useful for building stage2. STAGE1_CFLAGS (via CFLAGS), +# MAKEINFO and MAKEINFOFLAGS are explicitly passed here to make them +# overrideable (for a bootstrap build stage1 also builds gcc.info). + +STAGE1_CFLAGS=@stage1_cflags@ +STAGE1_LANGUAGES=@stage1_languages@ + +# We only want to compare .o files, so set this! +objext = .o + +# Flags to pass to stage2 and later makes. +POSTSTAGE1_FLAGS_TO_PASS = \ + CC="$${CC}" CC_FOR_BUILD="$${CC_FOR_BUILD}" \ + STAGE_PREFIX=$$r/prev-gcc/ \ + CFLAGS="$(BOOT_CFLAGS)" \ + LIBCFLAGS="$(BOOT_CFLAGS)" \ + LDFLAGS="$(BOOT_LDFLAGS)" \ + ADAC="\$$(CC)" + +# For stage 1: +# * We force-disable intermodule optimizations, even if +# --enable-intermodule was passed, since the installed compiler probably +# can't handle them. Luckily, autoconf always respects +# the last argument when conflicting --enable arguments are passed. +# * Likewise, we force-disable coverage flags, since the installed compiler +# probably has never heard of them. +# * We build only C (and possibly Ada). + +[+ FOR bootstrap-stage +] +.PHONY: stage[+id+]-start stage[+id+]-end + +stage[+id+]-start:: + @: $(MAKE); $(stage); \ + echo stage[+id+] > stage_current ; \ + echo stage[+id+] > stage_last; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)[+ + FOR host_modules +][+ IF bootstrap +] +@if [+ module +] + @cd $(HOST_SUBDIR); [ -d stage[+id+]-[+module+] ] || \ + mkdir stage[+id+]-[+module+]; \ + mv stage[+id+]-[+module+] [+module+] [+ IF prev +] ; \ + mv stage[+prev+]-[+module+] prev-[+module+] || test -f stage[+prev+]-lean [+ ENDIF prev +] +@endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +] + @[ -d stage[+id+]-$(TARGET_SUBDIR) ] || \ + mkdir stage[+id+]-$(TARGET_SUBDIR); \ + mv stage[+id+]-$(TARGET_SUBDIR) $(TARGET_SUBDIR) [+ IF prev +] ; \ + mv stage[+prev+]-$(TARGET_SUBDIR) prev-$(TARGET_SUBDIR) || test -f stage[+prev+]-lean [+ ENDIF prev +] + +stage[+id+]-end:: [+ FOR host_modules +][+ IF bootstrap +] +@if [+ module +] + @if test -d $(HOST_SUBDIR)/[+module+] ; then \ + cd $(HOST_SUBDIR); mv [+module+] stage[+id+]-[+module+] [+ IF prev +]; \ + mv prev-[+module+] stage[+prev+]-[+module+] ; : [+ ENDIF prev +] ; \ + fi +@endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +] + @if test -d $(TARGET_SUBDIR) ; then \ + mv $(TARGET_SUBDIR) stage[+id+]-$(TARGET_SUBDIR) [+ IF prev +] ; \ + mv prev-$(TARGET_SUBDIR) stage[+prev+]-$(TARGET_SUBDIR) ; : [+ ENDIF prev +] ; \ + fi + rm -f stage_current + +# Bubble a bugfix through all the stages up to stage [+id+]. They are +# remade, but not reconfigured. The next stage (if any) will not be +# reconfigured as well. +.PHONY: stage[+id+]-bubble +stage[+id+]-bubble:: [+ IF prev +]stage[+prev+]-bubble[+ ENDIF +] + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + if test -f stage[+id+]-lean [+ + IF prev +]|| test -f stage[+prev+]-lean [+ ENDIF prev +] ; then \ + echo Skipping rebuild of stage[+id+] ; \ + else \ + $(MAKE) stage[+id+]-start; \[+IF lean +] + if $(LEAN); then \ + rm -rf stage[+lean+]-* ; \ + $(STAMP) stage[+lean+]-lean ; \ + fi; \[+ ENDIF lean +] + $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-stage[+id+]; \ + fi[+ IF compare-target +] + $(MAKE) $(RECURSE_FLAGS_TO_PASS) [+compare-target+][+ ENDIF compare-target +] + +.PHONY: all-stage[+id+] clean-stage[+id+] +do-clean: clean-stage[+id+] + +# FIXME: Will not need to be conditional when toplevel bootstrap is the +# only possibility, but now it conflicts with no-bootstrap rules +@if gcc-bootstrap +[+ IF compare-target +] +[+compare-target+]: + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + if test -f stage[+prev+]-lean; then \ + echo Cannot compare object files as stage [+prev+] was deleted. ; \ + exit 0 ; \ + fi; \ + : $(MAKE); $(stage); \ + rm -f .bad_compare ; \ + echo Comparing stages [+prev+] and [+id+] ; \ + cd stage[+id+]-gcc; \ + files=`find . -name "*$(objext)" -print` ; \ + cd .. ; \ + for file in $${files} ; do \ + f1=$$r/stage[+prev+]-gcc/$$file; f2=$$r/stage[+id+]-gcc/$$file; \ + @do_compare@ > /dev/null 2>&1; \ + if test $$? -eq 1; then \ + case $$file in \ + ./cc*-checksum$(objext) | ./libgcc/* ) \ + echo warning: $$file differs ;; \ + *) \ + echo $$file differs >> .bad_compare ;; \ + esac ; \ + fi ; \ + done ; \ + if [ -f .bad_compare ]; then \ + echo "Bootstrap comparison failure!"; \ + cat .bad_compare; \ + exit 1; \ + else \ + echo Comparison successful.; \ + fi ; \ + $(STAMP) [+compare-target+][+ IF prev +] + if $(LEAN); then \ + rm -rf stage[+prev+]-*; \ + $(STAMP) stage[+prev+]-lean; \ + fi[+ ENDIF prev +] +[+ ENDIF compare-target +] + +[+ IF bootstrap-target +] +.PHONY: [+bootstrap-target+] [+bootstrap-target+]-lean +[+bootstrap-target+]: + echo stage[+id+] > stage_final + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage[+id+]-bubble + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target + +[+bootstrap-target+]-lean: + echo stage[+id+] > stage_final + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(MAKE) $(RECURSE_FLAGS_TO_PASS) LEAN=: stage[+id+]-bubble + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target +[+ ENDIF bootstrap-target +] + +# Rules to wipe a stage and all the following ones, also used for cleanstrap +[+ IF prev +]distclean-stage[+prev+]:: distclean-stage[+id+] [+ ENDIF prev +] +.PHONY: distclean-stage[+id+] +distclean-stage[+id+]:: + @: $(MAKE); $(stage) + rm -rf stage[+id+]-* [+ + IF compare-target +][+compare-target+] [+ ENDIF compare-target +] + +[+ IF cleanstrap-target +] +.PHONY: [+cleanstrap-target+] +[+cleanstrap-target+]: distclean [+bootstrap-target+] +[+ ENDIF cleanstrap-target +] +@endif gcc-bootstrap + +[+ ENDFOR bootstrap-stage +] + +stageprofile-end:: + $(MAKE) distclean-stagefeedback + +stagefeedback-start:: + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + for i in prev-*; do \ + j=`echo $$i | sed s/^prev-//` ; \ + cd $$r/$$i && \ + { find . -type d | sort | sed 's,.*,$(SHELL) '"$$s"'/mkinstalldirs "../'$$j'/&",' | $(SHELL) ; } && \ + { find . -name '*.*da' | sed 's,.*,$(LN) -f "&" "../'$$j'/&",' | $(SHELL) ; } ; \ + done + +@if gcc-bootstrap +do-distclean: distclean-stage1 + +# Provide a GCC build when we're building target libraries. This does +# not work as a dependency, just as the minimum necessary to avoid errors. +stage_last: + $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage1-bubble +@endif gcc-bootstrap + +.PHONY: restrap +restrap: + @: $(MAKE); $(stage) + rm -rf stage1-$(TARGET_SUBDIR) [+ FOR bootstrap-stage +][+ IF prev + +]stage[+id+] [+ ENDIF prev +][+ ENDFOR bootstrap-stage +] + $(MAKE) $(RECURSE_FLAGS_TO_PASS) all # -------------------------------------- # Dependencies between different modules # -------------------------------------- +# Generic dependencies for target modules on host stuff, especially gcc +@if gcc-bootstrap[+ FOR target_modules +][+ IF bootstrap + +][+ FOR bootstrap_stage +] +configure-stage[+id+]-target-[+module+]: maybe-all-stage[+id+]-gcc[+ + ENDFOR +][+ ELSE bootstrap +] +configure-target-[+module+]: stage_last[+ + ENDIF bootstrap +][+ ENDFOR target_modules +] +@endif gcc-bootstrap + +@if gcc-no-bootstrap[+ FOR target_modules +][+ IF bootstrap + +][+ ELSE +] +configure-target-[+module+]: maybe-all-gcc[+ + ENDIF bootstrap +][+ ENDFOR target_modules +] +@endif gcc-no-bootstrap + + +[+ FOR lang_env_dependencies +] +configure-target-[+module+]: maybe-all-target-newlib maybe-all-target-libgloss +[+ IF cxx +]configure-target-[+module+]: maybe-all-target-libstdc++-v3 +[+ ENDIF cxx +][+ ENDFOR lang_env_dependencies +] + # There are two types of dependencies here: 'hard' dependencies, where one # module simply won't build without the other; and 'soft' dependencies, where # if the depended-on module is missing, the depending module will do without # or find a substitute somewhere (perhaps installed). Soft dependencies -# are specified by depending on a 'maybe-' target. If you're not sure, +# are made here to depend on a 'maybe-' target. If you're not sure, # it's safer to use a soft dependency. -# Host modules specific to gcc. -# GCC needs to identify certain tools. -# GCC also needs the information exported by the intl configure script. -configure-gcc: maybe-configure-intl maybe-configure-binutils maybe-configure-gas maybe-configure-ld maybe-configure-bison maybe-configure-flex -all-gcc: maybe-all-libiberty maybe-all-intl maybe-all-bison maybe-all-byacc maybe-all-binutils maybe-all-gas maybe-all-ld maybe-all-zlib -# This is a slightly kludgy method of getting dependencies on -# all-build-libiberty correct; it would be better to build it every time. -all-gcc: maybe-all-build-libiberty -all-bootstrap: maybe-all-libiberty maybe-all-intl maybe-all-texinfo maybe-all-bison maybe-all-byacc maybe-all-binutils maybe-all-gas maybe-all-ld maybe-all-zlib +[+ ;; These Scheme functions build the bulk of the dependencies. + ;; dep-target builds a string like "maybe-all-MODULE_KIND-gcc", + ;; where "maybe-" is only included if HARD is true, and all-gcc + ;; is taken from VAR-NAME. + (define dep-target (lambda (module-kind var-name hard) + (string-append + (if hard "" "maybe-") + (dep-subtarget var-name) + module-kind + (dep-module var-name) + ))) -# Host modules specific to gdb. -# GDB needs to know that the simulator is being built. -configure-gdb: maybe-configure-itcl maybe-configure-tcl maybe-configure-tk maybe-configure-sim + ;; make-dep builds a dependency from the MODULE and ON AutoGen vars. + (define make-dep (lambda (module-kind on-kind) + (string-append + (dep-target module-kind "module" #t) ": " + (dep-target on-kind "on" (exist? "hard"))))) + + ;; dep-subtarget extracts everything up to the first dash in the given + ;; AutoGen variable, for example it extracts "all-" out of "all-gcc". + (define dep-subtarget (lambda (var-name) + (substring (get var-name) 0 (+ 1 (string-index (get var-name) #\-))))) + + ;; dep-module extracts everything up to the first dash in the given + ;; AutoGen variable, for example it extracts "gcc" out of "all-gcc". + (define dep-module (lambda (var-name) + (substring (get var-name) (+ 1 (string-index (get var-name) #\-))))) + + ;; dep-stage builds a string for the prefix of a bootstrap stage. + (define dep-stage (lambda () + (string-append + "stage" + (get "id") + "-"))) + + ;; dep-maybe is the same as the AutoGen expression "- hard 'maybe-'" + ;; but is written in Scheme. + (define dep-maybe (lambda () + (if (exist? "hard") "" "maybe-"))) + + ;; dep-kind returns "normal" if the dependency is on an "install" target, + ;; or if either module is not bootstrapped. It returns "bootstrap" for + ;; configure or build dependencies between bootstrapped modules; it returns + ;; "prebootstrap" for configure or build dependencies of bootstrapped + ;; modules on a build module (e.g. all-gcc on all-build-bison). All this + ;; is only necessary for host modules. + (define dep-kind (lambda () + (if (and (hash-ref boot-modules (dep-module "module")) + (=* (dep-module "on") "build-")) + "prebootstrap" + + (if (or (= (dep-subtarget "on") "install-") + (not (hash-ref boot-modules (dep-module "module"))) + (not (hash-ref boot-modules (dep-module "on")))) + "normal" + "bootstrap")))) + + ;; We now build the hash table that is used by dep-kind. + (define boot-modules (make-hash-table 113)) ++] + +[+ FOR host_modules +][+ + (if (exist? "bootstrap") + (hash-create-handle! boot-modules (get "module") #t)) + "" +][+ ENDFOR host_modules +] +[+ FOR target_modules +][+ + (if (exist? "bootstrap") + (hash-create-handle! boot-modules (string-append "target-" (get "module")) #t)) + "" +][+ ENDFOR target_modules +] + +# With all the machinery above in place, it is pretty easy to generate +# dependencies. Host dependencies are a bit more complex because we have +# to check for bootstrap/prebootstrap dependencies. To resolve +# prebootstrap dependencies, prebootstrap modules are gathered in +# a hash table. +[+ FOR dependencies +][+ (make-dep "" "") +] +[+ CASE (dep-kind) +] +[+ == "prebootstrap" + +][+ FOR bootstrap_stage +] +[+ (make-dep (dep-stage) "") +][+ + ENDFOR bootstrap_stage +] +all-prebootstrap: [+ (dep-target "" "on" (exist? "hard")) +] +[+ == "bootstrap" + +][+ FOR bootstrap_stage +] +[+ (make-dep (dep-stage) (dep-stage)) +][+ + ENDFOR bootstrap_stage +] +[+ ESAC +][+ +ENDFOR dependencies +] + +# Non-toplevel bootstrap rules must depend on several packages, to be built +# before gcc. Another wart that will go away, hopefully soon. +@if gcc-no-bootstrap +[+ FOR host_modules +][+ + IF (and (not (= (get "module") "gcc")) + (hash-ref boot-modules (get "module"))) +] +all-prebootstrap: maybe-all-[+module+][+ + ENDIF +][+ +ENDFOR host_modules +] +@endif gcc-no-bootstrap + +CONFIGURE_GDB_TK = @CONFIGURE_GDB_TK@ GDB_TK = @GDB_TK@ -all-gdb: maybe-all-libiberty maybe-all-opcodes maybe-all-bfd maybe-all-mmalloc maybe-all-readline maybe-all-bison maybe-all-byacc maybe-all-sim $(gdbnlmrequirements) $(GDB_TK) -install-gdb: maybe-install-tcl maybe-install-tk maybe-install-itcl maybe-install-tix maybe-install-libgui -configure-libgui: maybe-configure-tcl maybe-configure-tk -all-libgui: maybe-all-tcl maybe-all-tk maybe-all-itcl - -# Host modules specific to binutils. -configure-bfd: configure-libiberty -all-bfd: maybe-all-libiberty maybe-all-intl -all-binutils: maybe-all-libiberty maybe-all-opcodes maybe-all-bfd maybe-all-flex maybe-all-bison maybe-all-byacc maybe-all-intl -# We put install-opcodes before install-binutils because the installed -# binutils might be on PATH, and they might need the shared opcodes -# library. -install-binutils: maybe-install-opcodes -# libopcodes depends on libbfd -install-opcodes: maybe-install-bfd -all-gas: maybe-all-libiberty maybe-all-opcodes maybe-all-bfd maybe-all-intl -all-gprof: maybe-all-libiberty maybe-all-bfd maybe-all-opcodes maybe-all-intl -all-ld: maybe-all-libiberty maybe-all-bfd maybe-all-opcodes maybe-all-bison maybe-all-byacc maybe-all-flex maybe-all-intl -all-opcodes: maybe-all-bfd maybe-all-libiberty - -# Other host modules in the 'src' repository. -all-dejagnu: maybe-all-tcl maybe-all-expect maybe-all-tk -configure-expect: maybe-configure-tcl maybe-configure-tk -all-expect: maybe-all-tcl maybe-all-tk -configure-itcl: maybe-configure-tcl maybe-configure-tk -all-itcl: maybe-all-tcl maybe-all-tk -# We put install-tcl before install-itcl because itcl wants to run a -# program on installation which uses the Tcl libraries. -install-itcl: maybe-install-tcl -all-sid: maybe-all-libiberty maybe-all-bfd maybe-all-opcodes maybe-all-tcl maybe-all-tk -install-sid: maybe-install-tcl maybe-install-tk -all-sim: maybe-all-libiberty maybe-all-bfd maybe-all-opcodes maybe-all-readline maybe-configure-gdb -configure-tk: maybe-configure-tcl -all-tk: maybe-all-tcl -configure-tix: maybe-configure-tcl maybe-configure-tk -all-tix: maybe-all-tcl maybe-all-tk -all-texinfo: maybe-all-libiberty - -# Other host modules. Warning, these are not well tested. -all-autoconf: maybe-all-m4 maybe-all-texinfo -all-automake: maybe-all-m4 maybe-all-texinfo -all-bison: maybe-all-texinfo -all-diff: maybe-all-libiberty -all-fastjar: maybe-all-zlib maybe-all-libiberty -all-fileutils: maybe-all-libiberty -all-flex: maybe-all-libiberty maybe-all-bison maybe-all-byacc -all-gzip: maybe-all-libiberty -all-hello: maybe-all-libiberty -all-m4: maybe-all-libiberty maybe-all-texinfo -all-make: maybe-all-libiberty maybe-all-intl -all-patch: maybe-all-libiberty -all-prms: maybe-all-libiberty -all-recode: maybe-all-libiberty -all-sed: maybe-all-libiberty -all-send-pr: maybe-all-prms -all-tar: maybe-all-libiberty -all-uudecode: maybe-all-libiberty - -ALL_GCC = maybe-all-gcc -ALL_GCC_C = $(ALL_GCC) maybe-all-target-newlib maybe-all-target-libgloss -ALL_GCC_CXX = $(ALL_GCC_C) maybe-all-target-libstdc++-v3 - -# Target modules specific to gcc. -configure-target-boehm-gc: $(ALL_GCC_C) maybe-configure-target-qthreads -configure-target-fastjar: maybe-configure-target-zlib -all-target-fastjar: maybe-all-target-zlib maybe-all-target-libiberty -configure-target-libf2c: $(ALL_GCC_C) -all-target-libf2c: maybe-all-target-libiberty -configure-target-libffi: $(ALL_GCC_C) -configure-target-libjava: $(ALL_GCC_C) maybe-configure-target-zlib maybe-configure-target-boehm-gc maybe-configure-target-qthreads maybe-configure-target-libffi -all-target-libjava: maybe-all-fastjar maybe-all-target-zlib maybe-all-target-boehm-gc maybe-all-target-qthreads maybe-all-target-libffi -configure-target-libobjc: $(ALL_GCC_C) -all-target-libobjc: maybe-all-target-libiberty -configure-target-libstdc++-v3: $(ALL_GCC_C) -all-target-libstdc++-v3: maybe-all-target-libiberty -configure-target-zlib: $(ALL_GCC_C) - -# Target modules in the 'src' repository. -configure-target-examples: $(ALL_GCC_C) -configure-target-libgloss: $(ALL_GCC) -all-target-libgloss: maybe-configure-target-newlib -configure-target-libiberty: $(ALL_GCC) -configure-target-libtermcap: $(ALL_GCC_C) -configure-target-newlib: $(ALL_GCC) -configure-target-rda: $(ALL_GCC_C) -configure-target-winsup: $(ALL_GCC_C) -all-target-winsup: maybe-all-target-libiberty maybe-all-target-libtermcap - -# Other target modules. Warning, these are not well tested. -configure-target-gperf: $(ALL_GCC_CXX) -all-target-gperf: maybe-all-target-libiberty maybe-all-target-libstdc++-v3 -configure-target-qthreads: $(ALL_GCC_C) - -# Dependencies of maybe-foo on foo. These are used because, for example, -# all-gcc only depends on all-gas if gas is present and being configured. -@maybe_dependencies@ +INSTALL_GDB_TK = @INSTALL_GDB_TK@ +configure-gdb: $(CONFIGURE_GDB_TK) +all-gdb: $(gdbnlmrequirements) $(GDB_TK) +install-gdb: $(INSTALL_GDB_TK) # Serialization dependencies. Host configures don't work well in parallel to # each other, due to contention over config.cache. Target configures and @@ -1396,17 +1585,6 @@ configure-target-qthreads: $(ALL_GCC_C) # Regenerating top level configury # -------------------------------- -# Multilib.out tells target dirs what multilibs they should build. -# There is really only one copy. We use the 'timestamp' method to -# work around various timestamp bugs on some systems. -# We use move-if-change so that it's only considered updated when it -# actually changes, because it has to depend on a phony target. -multilib.out: maybe-all-gcc - @r=`${PWD_COMMAND}`; export r; \ - echo "Checking multilib configuration..."; \ - $(CC_FOR_TARGET) --print-multi-lib > multilib.tmp 2> /dev/null ; \ - $(SHELL) $(srcdir)/move-if-change multilib.tmp multilib.out ; \ - # Rebuilding Makefile.in, using autogen. AUTOGEN = autogen $(srcdir)/Makefile.in: @MAINT@ $(srcdir)/Makefile.tpl $(srcdir)/Makefile.def @@ -1416,7 +1594,7 @@ $(srcdir)/Makefile.in: @MAINT@ $(srcdir)/Makefile.tpl $(srcdir)/Makefile.def Makefile: $(srcdir)/Makefile.in config.status CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status -config.status: configure $(gcc_version_trigger) +config.status: configure CONFIG_SHELL="$(SHELL)" $(SHELL) ./config.status --recheck # Rebuilding configure. diff --git a/contrib/binutils/bfd/ChangeLog b/contrib/binutils/bfd/ChangeLog index 89cf8797d6b..5bb5bb2a600 100644 --- a/contrib/binutils/bfd/ChangeLog +++ b/contrib/binutils/bfd/ChangeLog @@ -1,1276 +1,1359 @@ -2005-01-05 Eric Botcazou +2006-12-11 Eric Botcazou - * elf64-sparc.c (sparc64_elf_relocate_section): Ignore overflows - from STABS debugging sections again. + * elflink.c (bfd_elf_gc_sections): Also search for corresponding + sections with .gnu.linkonce.t. prefix. -2004-10-16 H.J. Lu +2006-08-08 Nick Clifton - * elflink.c (elf_link_add_object_symbols): Also clear - _cooked_size for warning sections. + PR binutils/2724 + * coffcode.h (coff_new_section_hook): Only modify the section + symbol of sections which were created by the user. -2004-09-07 Eric Botcazou +2006-07-19 Alan Modra + + * bfd-in.h (enum notice_asneeded_action): Define. + * bfd-in2.h: Regenerate. + * elflink.c (elf_link_add_object_symbols): Call linker "notice" + function with NULL name for as-needed handling. + +2006-07-12 Matthew R. Dempsky + + * cpu-m68k.c (bfd_m68k_compatible): Handle CPU32. + +2006-06-23 Daniel Jacobowitz + + * Makefile.am: Clear RELEASE. + * Makefile.in: Regenerated. - Merge from mainline: - 2004-08-31 Eric Botcazou - * elf.c (special_sections): Add .gnu.linkonce.b modelled on .bss. +2006-06-23 Daniel Jacobowitz - 2004-06-09 Alexandre Oliva - * elflink.c (elf_sort_symbol): Compare section id, not pointers. - (elf_link_add_object_symbols): Likewise. + * configure.in: Update version to 2.17. + * Makefile.am: Set RELEASE. + * configure, Makefile.in: Regenerated. -2004-08-10 Daniel Jacobowitz +2006-06-12 Daniel Jacobowitz - * elf.c (assign_file_positions_except_relocs): Revert unintended - change from 2004-04-08. - -2004-05-28 Jason Thorpe + * configure.in: Update version to 2.16.94. + * configure: Regenerated. - * config.bfd (hppa*-*-netbsd*): Set targ_defvec to - bfd_elf32_hppa_nbsd_vec. Add bfd_elf32_hppa_linux_vec - to targ_selvecs. - * configure.in (bfd_elf32_hppa_nbsd_vec): Add case. - * configure: Regenerate. - * elf32-hppa.c (elf32_hppa_object_p): Add "elf32-hppa-netbsd" - case that accepts OSABI=NetBSD and OSABI=SysV. - (elf32_hppa_set_gp): For "elf32-hppa-netbsd", set the GP to - the base of .got or .data (if .got does not exist). - (elf32_hppa_post_process_headers): For elf32-hppa-netbsd, - set OSABI=NetBSD. - (TARGET_BIG_SYM): Add bfd_elf32_hppa_nbsd_vec case. - (TARGET_BIG_NAME): Add "elf32-hppa-netbsd" case. - * targets.c (bfd_elf32_hppa_nbsd_vec): Add extern declaration. - (_bfd_target_vector): Add bfd_elf32_hppa_nbsd_vec. - -2004-05-17 Daniel Jacobowitz - - * configure.in: Mark unreleased for post-2.15 snapshots. - * configure: Regenerate. - -2004-05-17 Daniel Jacobowitz - - * configure.in: Bump version to 2.15. Mark as released. - * configure: Regenerate. - -2004-05-13 Joel Sherrill - - * config.bfd (or32-*-rtems*): Switch to elf. - -2004-05-13 Nick Clifton - - * po/fr.po: Updated French translation. - -2004-05-07 Daniel Jacobowitz - - * configure.in: Bump version to 2.14.92. - * configure: Regenerate. - -2004-05-07 Daniel Jacobowitz - - Merge from mainline: - 2004-04-16 Alan Modra - * simple.c (bfd_simple_get_relocated_section_contents): Don't - change reloc_done. Set and restore _cooked_size. - (RETURN): Delete. - -2004-05-07 Alexandre Oliva - - * elf32-frv.c (elf32_frvfdpic_modify_segment_map): Return - immediately if there's no link info. - (elf32_frvfdpic_copy_private_bfd_data): New. - (bfd_elf32_bfd_copy_private_bfd_data): Use it for frvfdpic. - -2004-05-06 Zack Weinberg - - * dwarf2.c (add_line_info): Also set info->filename to NULL if - filename argument is null; do not call strlen on a null pointer. - -2004-05-06 Daniel Jacobowitz - - * elf32-arm.h (elf32_arm_relocate_section): Remove R_ARM_PLT32 - special case. - -2004-05-05 Alexandre Oliva - - * configure.in (bfd_elf32_frvfdpic_vec): New. - * configure: Rebuilt. - * targets.c (bfd_elf32_frvfdpic_vec): New. - * config.bfd: Enable it on frv-*-elf and frv-*-*linux*, as default - on the latter. - * elf32-frv.c: Prefix all identifiers added for FDPIC support with - frvfdpic instead of frv. Rearrange elf-target macros such that - the FDPIC-specific ones are only defined for this new target - vector. - (bfd_elf32_frvfdpic_vec): Declare. - (IS_FDPIC): New. - (elf32_frv_relocate_section): Use it to enable segment checking - and to control rofixup emission. Add output section vma to - applied relocation in non-LOAD non-ALLOC sections. Use - _bfd_error_handler for errors. - (_frv_create_got_section): Create .rel.got and .rofixup only in - FDPIC. Create non-dynamic _gp at .got+2048 in non-FDPIC, like the - linker script. - (elf32_frvfdpic_size_dynamic_sections): Assume FDPIC. - (elf32_frvfdpic_modify_segment_map): Likewise. - (elf32_frv_finish_dynamic_sections): New, do-nothing. - (elf32_frvfdpic_finish_dynamic_sections): Assume FDPIC. Improve - error message if we miscompute the rofixup size. - (frvfdpic_elf_use_relative_eh_frame): Assume FDPIC. - (frvfdpic_elf_encode_eh_address): Likewise. - (elf32_frv_check_relocs): Reject FDPIC-only relocs in non-FDPIC. - Record relocs only in FDPIC. Make sure _gp is defined for GPREL - relocs. Reject unknown relocation types. - (elf32_frv_object_p): Make sure target vector matches FDPIC bits. - (frv_elf_merge_private_bfd_data): Likewise. - (ELF_MAXPAGESIZE): Revert to 0x1000 for elf32-frv; keep it as - 0x4000 for newly-added elf32-frvfdpic. - -2004-05-05 Alexandre Oliva - - Merge from mainline: - 2004-02-27 Alexandre Oliva - * elf-bfd.h (struct elf_backend_data): Added - elf_backend_can_make_relative_eh_frame, - elf_backend_can_make_lsda_relative_eh_frame and - elf_backend_encode_eh_address. - (_bfd_elf_encode_eh_address): Declare. - (_bfd_elf_can_make_relative): Declare. - * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Use new - hooks to decide whether to attempt to make_relative and - make_lsda_relative. - (_bfd_elf_write_section_eh_frame_hdr): Call encode_eh_address. - (_bfd_elf_can_make_relative): New. - (_bfd_elf_encode_eh_address): New. - * elf32-frv.c (frv_elf_use_relative_eh_frame): New. - (frv_elf_encode_eh_address): New. - (elf_backend_can_make_relative_eh_frame): Define. - (elf_backend_can_make_lsda_relative_eh_frame): Define. - (elf_backend_encode_eh_address): Define. - * elfxx-target.h - (elf_backend_can_make_relative_eh_frame): Define. - (elf_backend_can_make_lsda_relative_eh_frame): Define. - (elf_backend_encode_eh_address): Define. - (elfNN_bed): Add them. - -2004-04-27 Bob Wilson - - * elf32-xtensa.c (xtensa_read_table_entries): Use section _cooked_size - if set. Check reloc_done flag before applying relocations. Use - output addresses, both when applying relocations and when comparing - against the specified section. - (elf_xtensa_relocate_section): Use output address to check if dynamic - reloc is in a literal pool. Set section's reloc_done flag. - -2004-04-21 Philip Blundell - - * elf32-arm.h (elf32_arm_check_relocs): Don't output REL32 - relocs for locally defined symbols during -shared final link. - (elf32_arm_final_link_relocate): Likewise. - -2004-04-21 Bob Wilson - - * elf32-xtensa.c (is_same_value): Add final_static_link argument and - require relocations against a weak symbol to reference the same - symbol hash entry if not a final, static link. - (get_cached_value, add_value_map): Add final_static_link argument. - (remove_literals): Pass final_static_link argument as needed. - -2004-04-16 Nick Clifton - - * bfd.c (bfd_archive_filename): Catch NULL bfd pointers. - -2004-04-16 H.J. Lu - - * elflink.c (_bfd_elf_merge_symbol): Treat weak as strong only - when it is a definition. - -2004-04-16 Alan Modra - - * elf32-sparc.c (elf32_sparc_relocate_section): Don't abort - when statically linking PIC code. - * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. - -2004-04-11 Thiemo Seufer - - * config.bfd: Remove mips*-*-mach3* and mips*-dec-mach3* targets. - * configure.in: Remove mips-dec-bsd*, mips-dec-mach3*, mips-*-mach3* - targets amd aout_mips_big_vec, aout_mips_little_vec target vectors. - * configure: Regenerate. - -2004-04-09 Daniel Jacobowitz - - * configure.in: Update version to 2.14.91. - * configure: Likewise. - -2004-04-09 Daniel Jacobowitz - - Merge from mainline: - 2004-04-06 Daniel Jacobowitz - * elfxx-mips.c (MIPS_ELF_STUB_SECTION_NAME): Always use - ".MIPS.stubs". - - 2004-04-05 H.J. Lu - * elfxx-ia64.c (elfNN_ia64_size_dynamic_sections): Always - reserve the memory for dynamic linker - - 2004-04-05 Mark Kettenis - * netbsd-core.c (CORE_WCOOKIE_OFFSET): New define. - (netbsd_core_file_p): Create a .wcookie section for OpenBSD/sparc. - - 2004-04-01 Andy Chittenden - * stabs.c (struct stab_link_includes_totals): Add field 'symb' - that keeps the characters in a B_INCL..B_EINCL range. - (_bfd_link_section_stabs): When computing the sum of the - characters in a B_INCL..B_EINCL range also keep a copy of those - characters. Use this information to distinguish between - include sections that have the same sum and the same length - but which are nevertheless unique. - - 2004-03-31 Andy Chittenden - * stabs.c (struct stab_link_includes_totals): Rename field 'total' - to 'sum_chars' and add field 'num_chars'. - (_bfd_link_section_stabs): When computing the sum of the - characters in a B_INCL..B_EINCL range also keep a count of the - number of characters. Use this information to help distinguish - between include sections when have the same sum but which - nevertheless are still unique. - - 2004-03-31 Mattias Engdegård - * stabs.c (_bfd_link_section_stabs): Do not skip N_EXCL stabs. - - 2004-03-19 John David Anglin - * elf32-hppa.c (elf32_hppa_check_relocs): Handle R_PARISC_PCREL32. - (final_link_relocate): Likewise. - - 2004-03-19 John David Anglin - * elf-hppa.h (elf_hppa_reloc_final_type): Handle selectors for - R_PARISC_PCREL32 and R_PARISC_PCREL64 relocations. - - 2004-03-17 Nathan Sidwell - * elfxx-mips.c (_bfd_mips_elf_merge_private_bfd_data): Correct - logic for null_input_bfd detection. - - 2004-03-12 Nick Clifton - Dave Murphy - - * elf32-arm.h (elf32_arm_merge_private_bfd_data): Skip most checks - if the input bfd does not contain any code. - - 2004-03-02 Alexandre Oliva - * elf32-frv.c (struct frv_pic_relocs_info): Added fixups and - dynrelocs. - (_frv_count_got_plt_entries): Initialize them. - (frv_pic_relocs_info_find): Add insert argument. Adjust all - callers. - (frv_pic_relocs_info_for_global): Likewise. - (frv_pic_relocs_info_for_local): Likewise. - (frv_pic_merge_early_relocs_info): New. - (_frv_resolve_final_relocs_info): Use it in case one entry maps to - another. - (_frv_add_dyn_reloc): Add entry argument. Adjust all callers. - Check that we don't exceed the allocated count for entry. - (_frv_add_rofixup): Likewise. - (_frv_emit_got_relocs_plt_entries): Adjust for coding standards. - (elf32_frv_finish_dynamic_sections): Improve error message in case - we emit too few rofixup entries. - - 2004-02-27 Alexandre Oliva - * elf32-frv.c (elf32_frv_howto_table) : Set - complain_on_overflow to signed. - - 2004-02-27 Jakub Jelinek - * elf32-s390.c (allocate_dynrelocs): Use SYMBOL_REFERENCES_LOCAL - for pc relative relocs. - (elf_s390_relocate_section): Likewise. - * elf64-s390.c (allocate_dynrelocs): Use SYMBOL_REFERENCES_LOCAL - for pc relative relocs. - (elf_s390_relocate_section): Likewise. - - 2004-02-26 H.J. Lu - * elfxx-ia64.c (elfNN_ia64_check_relocs): Fix call to - count_dyn_reloc. - - 2004-02-25 H.J. Lu - * elfxx-ia64.c (elfNN_ia64_dyn_reloc_entry): Add the reltext. - field to track if a relocation is against readonly section. - (count_dyn_reloc): Take a new argument for rent->reltext. - (elfNN_ia64_check_relocs): Adjust call to count_dyn_reloc. - (get_reloc_section): Don't set ia64_info->reltext here. - (allocate_dynrel_entries): Set ia64_info->reltext here. - - 2004-02-24 Alexandre Oliva - * elf32-frv.c (FRV_SYM_LOCAL): Weak undefined doesn't imply local. - (_frv_emit_got_relocs_plt_entries): Decay relocation to protected - function's descriptor to symbol+offset, and map local undefweak - symbol to NULL function descriptor. - (elf32_frv_relocate_section): Likewise. - - 2004-02-21 Danny Smith - * peXXigen.c (_bfd_XXi_swap_scnhdr_out): Clear - IMAGE_SCN_MEM_WRITE on known sections only. - - 2004-02-19 Jakub Jelinek - * elf32-sparc.c (elf32_sparc_finish_dynamic_sections): Clear - .plt sh_entsize. - -2004-04-08 Richard Sandiford - - * elflink.c: Include libiberty.h. - * Makefile.am (elflink.lo): Depend on libiberty.h. +2006-06-11 Richard Sandiford + Thiemo Seufer + + * elfxx-mips.c (mips_elf_link_hash_table): Add function_stub_size. + (STUB_ORI): New macro. + (STUB_LI16U): Fix formatting. + (MIPS_FUNCTION_STUB_SIZE): Delete. + (MIPS_FUNCTION_STUB_MAX_SIZE): Likewise. + (MIPS_FUNCTION_STUB_NORMAL_SIZE): New macro. + (MIPS_FUNCTION_STUB_BIG_SIZE): Likewise. + (_bfd_mips_elf_adjust_dynamic_symbol): Use htab->function_stub_size + instead of MIPS_FUNCTION_STUB_SIZE. + (count_section_dynsyms): New function, split out from + _bfd_mips_elf_final_link. + (_bfd_mips_elf_always_size_sections): Get a worst-case estimate + of the number of dynamic symbols needed and use it to set up + function_stub_size. Use function_stub_size rather than + MIPS_FUNCTION_STUB_SIZE to determine the size of the stub section. + Use 16-byte stubs for 0x10000 dynamic symbols. + (_bfd_mips_elf_size_dynamic_sections): Use htab->function_stub_size + instead of MIPS_FUNCTION_STUB_SIZE. Fix formatting. + (_bfd_mips_elf_finish_dynamic_symbol): Likewise. Change the + size of the stub buffer from MIPS_FUNCTION_STUB_MAX_SIZE to + MIPS_FUNCTION_STUB_BIG_SIZE. Tweak the check for unhandled dynindxes. + Use MIPS_FUNCTION_STUB_BIG_SIZE rather than a hard-coded 20. + Use STUB_ORI rather than STUB_LI16U for big stubs. + (_bfd_mips_elf_link_hash_table_create): Initialize function_stub_size. + (_bfd_mips_elf_final_link): Use count_section_dynsyms. + +2006-06-08 David Daney + + * elfxx-mips.c (STUB_LI16): Removed. + (STUB_LUI): New macro. + (STUB_LI16U): Ditto. + (STUB_LI16S): Ditto. + (MIPS_FUNCTION_STUB_SIZE): Rewrote to take info parameter. + (_bfd_mips_elf_adjust_dynamic_symbol): Pass info parameter to + MIPS_FUNCTION_STUB_SIZE. + (_bfd_mips_elf_always_size_sections): Ditto. + (_bfd_mips_elf_size_dynamic_sections): Ditto. + (_bfd_mips_elf_finish_dynamic_sections): Ditto. + (_bfd_mips_elf_finish_dynamic_symbol): Rewrote stub generation + to allow larger symbol table indexes. + +2006-06-07 Joseph S. Myers + + * po/Make-in (pdf, ps): New dummy targets. + +2006-06-01 Daniel Jacobowitz + + Backport: + 2006-05-23 H.J. Lu + PR ld/2655 + PR ld/2657 + * elf-eh-frame.c (_bfd_elf_write_section_eh_frame): Properly + update CIE/FDE length. Don't pad to the section alignment. + +2006-05-30 Nick Clifton + + * po/es.po: Updated Spanish translation. + +2006-05-23 Alan Modra + + * elf64-ppc.c (compare_symbols): Prefer strong dynamic global + function syms over other syms. + +2006-05-22 Daniel Jacobowitz + + * elflink.c (_bfd_elf_add_dynamic_entry): Remove DT_TEXTREL + check. + (bfd_elf_final_link): Add a late DT_TEXTREL check. + * elfxx-mips.c (MIPS_ELF_READONLY_SECTION): Define. + (mips_elf_create_dynamic_relocation): Set DF_TEXTREL. + (_bfd_mips_elf_check_relocs): Delete MIPS_READONLY_SECTION. + Use MIPS_ELF_READONLY_SECTION. + (_bfd_mips_elf_size_dynamic_sections): Clear DF_TEXTREL after + creating DT_TEXTREL. + (_bfd_mips_elf_finish_dynamic_sections): Clear textrel markers + if no text relocations were generated. + +2006-05-17 Daniel Jacobowitz + + * configure.in: Update version to 2.16.93. + * configure: Regenerated. + +2006-05-17 Alan Modra + + * elflink.c (elf_gc_sweep): Don't specially keep non-alloc, + non-load sections if they have relocs. + +2006-05-16 Andreas Schwab + + * aoutf1.h (struct external_sparc_core): Declare c_regs as struct + regs instead of an array of int. + (struct external_solaris_bcp_core): Likewise. + (swapcore_sun3): Use offsetof instead of computing the offset + manually. + (swapcore_sparc): Likewise. Simplify reference to c_regs. + (swapcore_solaris_bcp): Likewise. + +2006-05-15 Alan Modra + + PR 2658 + * elf32-ppc.c (ppc_elf_relax_section): Don't segfault on non-pic + -shared link. + +2006-05-11 Michael Matz + + * elflink.c (match_group_member): Correctly iterate group + members. + +2006-05-11 Nick Clifton + + PR ld/2607 + * elfcode.h (valid_section_index_p): New function: Checks for a + valid section index. Allows indicies in the range SHN_LOPROC to + SHN_HIOS. + (elf_object_p): Use valid_section_index_p. + +2006-05-11 Nick Clifton + + PR ld/2257 + * elfcode.h (elf_object_p): Allow files with corrupt e_shstrndx + fields to still be handled as ELF files. + +2006-05-10 Alan Modra + + PR 2342 + * elflink.c (_bfd_elf_default_action_discarded): Revert 2006-02-16. + +2006-05-10 Alan Modra + + * elf64-ppc.c (ppc64_elf_tls_optimize): Only optimize + R_PPC64_TPREL64 and R_PPC64_DTPMOD64 relocs when they are in + the .toc and referenced by a TLS code sequence. + (ppc64_elf_edit_toc): Cater for the unlikely situation that + .toc is the first section in a file. + +2006-05-03 Kaz Kojima + + PR binutils/2584 + * tekhex.c (getvalue): Change return type to bfd_boolean and + add the new parameter. Return false if the unexpected character + is found. + (getsym): Likewise. + (first_phase): Change return type to bfd_boolean and return + false if the unexpected character is found. Replace abort + with returning false. + (pass_over): Change return type to bfd_boolean and the type of + the second argument to bfd_boolean (*) (bfd *, int, char *). + Return false if FUNC returns false. + (tekhex_object_p): Return NULL if pass_over fails. + +2006-05-02 Paul Brook + + * elf32-arm.c (elf32_arm_final_link_relocate): Set thumb funciton bit + for R_ARM_REL32. + +2006-04-27 Alan Modra + + * coff-rs6000.c (xcoff_write_archive_contents_old): Warning fix. + +2006-04-16 Daniel Jacobowitz + + * configure.in: Update version to 2.16.92. + * configure: Regenerated. + +2006-04-16 Daniel Jacobowitz + + * po/SRC-POTFILES.in: Regenerated. + +2006-04-14 David Heine + + * elf32-xtensa.c (build_reloc_opcodes): New. + (compute_text_actions): Use it to decode opcodes outside inner loop. + (check_section_ebb_pcrels_fit): Add "reloc_opcodes" argument, and if + it is set, use it to get the opcodes for relocations. + (move_shared_literal): Adjust call to check_section_ebb_pcrels_fit. + +2006-04-08 H.J. Lu + + PR ld/2513 + * elf32-i386.c (GOT_TLS_MASK): New macro for tls_type. + (GOT_TLS_IE_IE): Likewise. + (GOT_TLS_IE_GD): Likewise. + (GOT_TLS_IE_MASK): Likewise. + (elf_i386_check_relocs): For global symbols, set GOT_TLS_IE_GD + and GOT_TLS_IE_IE for R_386_TLS_GD and R_386_TLS_IE + respectively. + (allocate_dynrelocs): If both GOT_TLS_IE_IE and GOT_TLS_IE_GD + are set, treat tls_type as GOT_TLS_IE_BOTH. + (elf_i386_relocate_section): Likewise. + +2006-04-07 Randolph Chung + + * elf64-hppa.c (elf64_hppa_grok_prstatus): New function. + (elf64_hppa_grok_psinfo): Likewise. + (elf_backend_grok_pstatus, elf_backend_grok_psinfo): Define. + +2006-04-06 DJ Delorie + + * elf32-m32c.c (m32c_elf_relocate_section): Generate a symbol for + each plt entry we create. + +2006-04-06 Carlos O'Donell + + * po/Make-in: Add install-html target. + * Makefile.am: Rename docdir to bfddocdir. Add datarootdir, docdir + htmldir. Add install-html and install-html-recursive targets. * Makefile.in: Regenerate. + * configure.in: AC_SUBST for datarootdir, docdir and htmldir. + * configure: Regenerate. -2004-04-08 Alan Modra +2006-04-06 H.J. Lu - Apply from mainline. - 2004-03-30 Jakub Jelinek - * elf.c (map_sections_to_segments): Fix handling of .tbss. + * elfxx-ia64.c (elfNN_ia64_relax_section): Skip unneeded passes + with the skip_relax_pass_0 and skip_relax_pass_1 bits in the + section structure. - 2004-03-27 Alan Modra - * Makefile.am: Remove all mention of elflink.h. +2006-04-05 Bernd Schmidt + + * elf32-bfin.c (bfinfdpic_relocs_info_hash): Sprinkle casts to + eliminate warnings. + +2006-04-05 H.J. Lu + James E Wilson + + PR ld/2442 + * elfxx-ia64.c (elfNN_ia64_dyn_sym_info): Remove next. + (elfNN_ia64_local_hash_entry): Add count, sorted_count and + size. + (elfNN_ia64_link_hash_entry): Likewise. + (elfNN_ia64_new_elf_hash_entry): Initialize count, sorted_count + and size. + (elfNN_ia64_hash_copy_indirect): Updated elfNN_ia64_dyn_sym_info + processing. + (elfNN_ia64_hash_hide_symbol): Likewise. + (elfNN_ia64_global_dyn_sym_thunk): Likewise. + (elfNN_ia64_local_dyn_sym_thunk): Likewise. + (elfNN_ia64_global_dyn_info_free): New function. + (elfNN_ia64_local_dyn_info_free): Likewise. + (elfNN_ia64_hash_table_free): Free local and global + elfNN_ia64_dyn_sym_info. + (addend_compare): New function. + (sort_dyn_sym_info): Likewise. + (get_dyn_sym_info): Updated to use binary search for addend. + (elfNN_ia64_check_relocs): Scan relocations to create dynamic + relocation arrays first. + +2006-04-05 Bernd Schmidt + + * elf32-bfin.c (_bfin_create_got_section): Don't generate a _gp + symbol. + +2006-04-05 H.J. Lu + + PR ld/2411 + * elflink.c (check_dynsym): New. + (elf_link_output_extsym): Use it. + (bfd_elf_final_link): Likewise. + +2006-04-05 H.J. Lu + + PR ld/2404 + * elflink.c (_bfd_elf_merge_symbol): Skip the default indirect + symbol from the dynamic definition with the default version if + its type and the type of existing regular definition mismatch. + +2006-04-05 Richard Sandiford + Daniel Jacobowitz + + * config.bfd (sparc-*-vxworks*): New stanza. + * configure.in (bfd_elf32_sparc_vxworks_vec): New stanza. + (bfd_elf32_sparc_vec, bfd_elf64_sparc_vec): Add elf-vxworks.lo. + * configure: Regenerate. + * elf32-sparc.c: Include elf-vxworks.h. + (elf32_sparc_vxworks_link_hash_table_create: New. + (elf32_sparc_vxworks_final_write_processing): New. + (TARGET_BIG_SYM): Override for VxWorks. + (TARGET_BIG_NAME, ELF_MINPAGESIZE): Likewise. + (bfd_elf32_bfd_link_hash_table_create): Likewise. + (elf_backend_want_got_plt, elf_backend_plt_readonly): Likewise. + (elf_backend_got_header_size, elf_backend_add_symbol_hook): Likewise. + (elf_backend_link_output_symbol_hook): Likewise. + (elf_backend_emit_relocs): Likewise. + (elf_backend_final_write_processing, elf32_bed): Likewise. + * elfxx-sparc.c: Include libiberty.h and elf-vxworks.h. + (sparc_vxworks_exec_plt0_entry, sparc_vxworks_exec_plt_entry): New. + (sparc_vxworks_shared_plt0_entry, sparc_vxworks_shared_plt_entry): New. + (_bfd_sparc_elf_link_hash_table_create): Don't initialize + build_plt_entry here. + (create_got_section): Initialize sgotplt for VxWorks. + (_bfd_sparc_elf_create_dynamic_sections): Initialize build_plt_entry, + plt_header_size and plt_entry_size, with new VxWorks-specific settings. + Call elf_vxworks_create_dynamic_sections for VxWorks. + (allocate_dynrelocs): Use plt_header_size and plt_entry_size. + Allocate room for .got.plt and .rela.plt.unloaded entries on VxWorks. + (_bfd_sparc_elf_size_dynamic_sections): Don't allocate a nop in .plt + for VxWorks. Check for the .got.plt section. + (sparc_vxworks_build_plt_entry): New function. + (_bfd_sparc_elf_finish_dynamic_symbol): Add handling of VxWorks PLTs. + Don't make _GLOBAL_OFFSET_TABLE_ and _PROCEDURE_LINKAGE_TABLE_ + absolute on VxWorks. + (sparc32_finish_dyn): Add special handling for DT_RELASZ + and DT_PLTGOT on VxWorks. + (sparc_vxworks_finish_exec_plt): New. + (sparc_vxworks_finish_shared_plt): New. + (_bfd_sparc_elf_finish_dynamic_sections): Call them. + Use plt_header_size and plt_entry_size. + * elfxx-sparc.h (_bfd_sparc_elf_link_hash_table): Add is_vxworks, + srelplt2, sgotplt, plt_header_size and plt_entry_size fields. + * Makefile.am (elfxx-sparc.lo): Depend on elf-vxworks.h. + (elf32-sparc.lo): Likewise. * Makefile.in: Regenerate. - * bfd-in.h (bfd_elf_discard_info): Declare. - (bfd_elf32_discard_info, bfd_elf64_discard_info): Delete. - * bfd-in2.h: Regenerate. - * elf-bfd.h (bfd_elf32_print_symbol, bfd_elf64_print_symbol, - bfd_elf32_link_record_dynamic_symbol, - bfd_elf64_link_record_dynamic_symbol, - _bfd_elf_link_record_dynamic_symbol, bfd_elf32_bfd_final_link, - bfd_elf64_bfd_final_link, elf_link_record_local_dynamic_symbol, - _bfd_elf32_link_record_local_dynamic_symbol, - _bfd_elf64_link_record_local_dynamic_symbol, - _bfd_elf32_gc_sections, _bfd_elf32_gc_common_finalize_got_offsets, - _bfd_elf32_gc_common_final_link, _bfd_elf64_gc_common_final_link, - _bfd_elf32_gc_record_vtinherit, _bfd_elf32_gc_record_vtentry, - _bfd_elf64_gc_sections, _bfd_elf64_gc_common_finalize_got_offsets, - _bfd_elf64_gc_record_vtinherit, _bfd_elf64_gc_record_vtentry, - _bfd_elf32_reloc_symbol_deleted_p, - _bfd_elf64_reloc_symbol_deleted_p): Delete. - (bfd_elf_link_record_dynamic_symbol, - bfd_elf_link_record_local_dynamic_symbol, - bfd_elf_final_link, bfd_elf_gc_sections, - bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtentry, - bfd_elf_gc_common_finalize_got_offsets, bfd_elf_gc_common_final_link, - bfd_elf_reloc_symbol_deleted_p): Declare. - (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define. - * elf32-arm.h: Update for changed function names. Remove local - WILL_CALL_FINISH_DYNAMIC_SECTION define. - * elf-hppa.h, elf-m10300.c, elf32-cris.c, elf32-d10v.c, elf32-dlx.c, - * elf32-fr30.c, elf32-frv.c, elf32-h8300.c, elf32-hppa.c, elf32-i386.c, - * elf32-iq2000.c, elf32-m32r.c, elf32-m68hc1x.c, elf32-m68k.c, - * elf32-mcore.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, - * elf32-sh.c, elf32-sparc.c, elf32-v850.c, elf32-vax.c, - * elf32-xstormy16.c, elf32-xtensa.c, elf64-alpha.c, elf64-hppa.c, - * elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c, elf64-sparc.c, - * elf64-x86-64.c, elfxx-ia64.c, elfxx-mips.c, elfxx-target.h: Likewise. - * elfxx-target.h (bfd_elfNN_bfd_final_link): Define. - (bfd_elfNN_print_symbol): Define. - * elfcode.h: Don't include elflink.h. - (elf_bfd_discard_info, elf_reloc_symbol_deleted_p, - elf_link_record_dynamic_symbol, elf_bfd_final_link, elf_gc_sections, - elf_gc_common_finalize_got_offsets, elf_gc_common_final_link, - elf_gc_record_vtinherit, elf_gc_record_vtentry, - elf_link_record_local_dynamic_symbol): Don't define. - * elflink.c: Update for changed function names. Move elflink.h - code here. - * elflink.h: Delete file. - * po/SRC-POTFILES.in: Regenerate. - * po/bfd.pot: Regenerate. + * targets.c (bfd_elf32_sparc_vxworks_vec): Declare. + (_bfd_target_vector): Add a pointer to it. - 2004-03-27 Alan Modra - * elf64-mmix.c (mmix_elf_relocate_section): Restore code setting - "name" for global syms accidentally removed in 2004-03-20 change. +2006-03-30 Ben Elliston - 2004-03-27 Alan Modra - * elf-bfd.h (struct elf_reloc_cookie): Add r_sym_shift field. - * elflink.h: Replace all occurrences of sizeof (Elf_External_*) - where Elf_External_* is different for 64 and 32 bit, with - corresponding elf_size_info field. - (struct elf_final_link_info): Use "bfd_byte *" instead - of "Elf_External_Sym *" for external_syms and symbuf. - (elf_link_adjust_relocs): Set up r_type_mask and r_sym_shift local - vars and use instead of ELF_R_INFO and ELF_R_TYPE macros. - (struct elf_link_sort_rela): Add "sym_mask" alias for "offset". - (elf_link_sort_cmp1): Use sym_mask field instead of ELF_R_SYM. - (elf_link_sort_cmp2): Adjust. - (elf_link_sort_relocs): Set up r_sym_mask local var instead of - using ELF_R_SYM macro. Set u.sym_mask. - (elf_bfd_final_link): Call _bfd_elf_stringtab_init instead of macro - version, elf_stringtab_init. Ditto for bfd_section_from_elf_index - vs. section_from_elf_index. Adjust Elf_External_Sym pointer - arithmetic. Pass bed to elf_link_flush_output_syms. Adjust - Elf_External_Dyn pointer arithmentic. Use bed swap_dyn_in and - swap_syn_out functions. Rearrange dyn swap in/out switch. - (elf_link_output_sym): Adjust Elf_External_Sym pointer arithmentic. - Pass bed to elf_link_flush_output_syms. Use bed swap_symbol_out. - (elf_link_flush_output_syms): Add elf_backend_data arg. - (elf_link_check_versioned_symbol): Likewise. - (elf_link_output_extsym): Pass bed to elf_link_check_versioned_symbol. - Adjust Elf_External_Sym pointer arithmetic. Use bed swap_symbol_out. - (elf_link_input_bfd): Use bfd_section_from_elf_index. Set up - r_type_mask and r_sym_shift local vars and use instead of ELF_R_SYM, - ELF_R_TYPE and ELF_R_INFO macros. - (elf_reloc_link_order): Select ELF32_R_INFO or ELF64_R_INFO invocation - based on size rather than using ELF_R_INFO. - (elf_gc_mark): Set up r_sym_shift local var and use instead of - ELF_R_SYM macro. - (struct alloc_got_off_arg): New. - (elf_gc_common_finalize_got_offsets): Use elf_size_info instead of - ARCH_SIZE. Pass get entry size down to elf_gc_allocate_got_offsets. - (elf_gc_allocate_got_offsets): Adjust. - (elf_reloc_symbol_deleted_p): Usee cookie.r_sym_shift instead of - ELF_R_SYM. Use bfd_section_from_elf_index. - (elf_bfd_discard_info): Set cookie.r_sym_shift. - * elfcode.h (elf_stringtab_init, section_from_elf_index): Delete. - (elf_slurp_symbol_table): Use bfd_section_from_elf_index. + PR ld/2267 + * elflink.c (elf_fixup_link_order): Ensure `elfsec' is not a + special section number that exceeds the number of ELF sections + (eg. SHN_MIPS_SCOMMON). - 2004-03-26 Alan Modra - * elf64-ppc.c (elf_backend_add_symbol_hook): Define. - (ppc64_elf_add_symbol_hook): New function. - * elf-bfd.h (struct elf_backend_data ): Remove - const from Elf_Internal_Sym param. - * elflink.c (elf_link_add_object_symbols): Adjust. - * elf-hppa.h (elf_hppa_add_symbol_hook): Adjust. - * elf32-frv.c (elf32_frv_add_symbol_hook): Adjust. - * elf32-i370.c (elf_backend_add_symbol_hook): Adjust. - * elf32-m32r.c (m32r_elf_add_symbol_hook): Adjust. - * elf32-m68hc1x.c (elf32_m68hc11_add_symbol_hook): Adjust. - * elf32-m68hc1x.h (elf32_m68hc11_add_symbol_hook): Adjust. - * elf32-ppc.c (ppc_elf_add_symbol_hook): Adjust. - * elf32-sh64.c (sh64_elf_add_symbol_hook): Adjust. - * elf32-v850.c (v850_elf_add_symbol_hook): Adjust. - * elf64-alpha.c (elf64_alpha_add_symbol_hook): Adjust. - * elf64-mmix.c (mmix_elf_add_symbol_hook): Adjust. - * elf64-sh64.c (sh64_elf64_add_symbol_hook): Adjust. - * elf64-sparc.c (sparc64_elf_add_symbol_hook): Adjust. - * elfxx-ia64.c (elfNN_ia64_add_symbol_hook): Adjust. - * elfxx-mips.c (_bfd_mips_elf_add_symbol_hook): Adjust. - * elfxx-mips.h (_bfd_mips_elf_add_symbol_hook): Adjust. +2006-03-27 Richard Sandiford - 2004-03-26 Alan Modra - * elfxx-target.h (bfd_elfNN_bfd_link_add_symbols): Define. - * elf-bfd.h (_bfd_elf_link_add_archive_symbols): Delete. - (_bfd_elf_sort_symbol, _bfd_elf_add_dt_needed_tag): Delete. - (_bfd_elf_finalize_dynstr, bfd_elf32_bfd_link_add_symbols): Delete. - (bfd_elf64_bfd_link_add_symbols): Delete. - (bfd_elf_link_add_symbols): Declare. - * elfcode.h (elf_bfd_link_add_symbols): Delete. - * elflink.c: Include safe-ctype.h. - (elf_add_dt_needed_tag): Rename from _bfd_elf_add_dt_needed_tag, - make static. - (elf_sort_symbol): Rename from _bfd_elf_sort_symbol, make static. - (elf_finalize_dynstr): Rename from _bfd_elf_finalize_dynstr, make - static. - (elf_link_add_archive_symbols): Rename from - _bfd_elf_link_add_archive_symbols, make static. - (elf_link_add_object_symbols): New function. Corresponding - elflink.h function converted to use elf_size_info. - (bfd_elf_link_add_symbols): Likewise. - (bfd_elf_size_dynamic_sections): Adjust. - * elflink.h (elf_bfd_link_add_symbols): Delete. - (elf_link_add_object_symbols): Delete. - * elf32-gen.c (elf32_generic_link_add_symbols): Call - bfd_elf_link_add_symbols. - * elf64-gen.c (elf64_generic_link_add_symbols): Likewise. + * elfxx-mips.c (mips_got_entry): Add more commentary. + (mips_elf_local_got_index): Use the hash table entry to record + the GOT index of forced-local symbols. + (mips_elf_initialize_tls_index): Rearrange code. Store the index + in either the hash table entry or the mips_got_entry, not both. + Add more commentary. + (mips_elf_multi_got): Make sure the g->next is nonnull when calling + mips_elf_initialize_tls_index. - 2004-03-25 Alan Modra - * elflink.h (elf_link_add_object_symbols): Add DT_NEEDED for as-needed - and chained shared libs only if dynsym. Clear dynsym on forced-local. - * elf-bfd.h (_bfd_elf_add_dynamic_entry): Declare. - (bfd_elf32_add_dynamic_entry, bfd_elf64_add_dynamic_entry): Delete. - (_bfd_elf_add_dt_needed_tag): Declare. - (_bfd_elf_sort_symbol): Declare. - (_bfd_elf_finalize_dynstr): Declare. - (RELOC_FOR_GLOBAL_SYM): Formatting. - * elfcode.h (elf_add_dynamic_entry): Delete. - * elflink.c (_bfd_elf_add_dynamic_entry): New function. Corresponding - elflink.h function converted to use elf_size_info. - (_bfd_elf_add_dt_needed_tag): Likewise. - (_bfd_elf_sort_symbol): Likewise. - (_bfd_elf_finalize_dynstr): Likewise. - (compute_bucket_count): Likewise. - (bfd_elf_size_dynamic_sections): Likewise. Check result of - _bfd_elf_strtab_add before calling _bfd_elf_strtab_addref. - (elf_adjust_dynstr_offsets, elf_collect_hash_codes): Moved from.. - * elflink.h: ..here. - (sort_symbol, add_dt_needed_tag): Delete. - (elf_add_dynamic_entry, elf_finalize_dynstr): Delete. - (compute_bucket_count, NAME(bfd_elf,size_dynamic_sections)): Delete. - Update all users. - * elf32-arm.h (add_dynamic_entry): Update. Remove casts. - * elf32-cris.c (add_dynamic_entry): Likewise. - * elf32-hppa.c (add_dynamic_entry): Likewise. - * elf32-i370.c (add_dynamic_entry): Likewise. - * elf32-i386.c (add_dynamic_entry): Likewise. - * elf32-m32r.c (add_dynamic_entry): Likewise. - * elf32-m68k.c (add_dynamic_entry): Likewise. - * elf32-ppc.c (add_dynamic_entry): Likewise. - * elf32-s390.c (add_dynamic_entry): Likewise. - * elf32-sh.c (add_dynamic_entry): Likewise. - * elf32-sparc.c (add_dynamic_entry): Likewise. - * elf32-vax.c (add_dynamic_entry): Likewise. - * elf32-xtensa.c (add_dynamic_entry): Likewise. - * elf64-alpha.c (add_dynamic_entry): Likewise. - * elf64-hppa.c (add_dynamic_entry): Likewise. - * elf64-ppc.c (add_dynamic_entry): Likewise. - * elf64-s390.c (add_dynamic_entry): Likewise. - * elf64-sparc.c (add_dynamic_entry): Likewise. - * elf64-x86-64.c (add_dynamic_entry): Likewise. - * elfxx-ia64.c (add_dynamic_entry): Likewise. - * elfxx-mips.c (MIPS_ELF_ADD_DYNAMIC_ENTRY): Likewise. - * elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise. - * elf32-frv.c (elf32_frv_size_dynamic_sections): Likewise. - * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. +2006-03-25 Bernd Schmidt - 2004-03-22 Alan Modra - * elf-bfd.h (RELOC_FOR_GLOBAL_SYMBOL): Add input_bfd, input_section - and rel args. Group input and output args. Wrap to 80 columns. - * elf-m10200.c, elf-m10300.c, elf32-arm.h, elf32-avr.c, - elf32-cris.c, elf32-d10v.c, elf32-fr30.c, elf32-h8300.c, - elf32-hppa.c, elf32-i386.c, elf32-i860.c, elf32-ip2k.c, - elf32-iq2000.c, elf32-m68hc1x.c, elf32-m68k.c, elf32-mcore.c, - elf32-msp430.c, elf32-openrisc.c, elf32-ppc.c, elf32-s390.c, - elf32-sparc.c, elf32-v850.c, elf32-vax.c, elf32-xstormy16.c, - elf32-xtensa.c, elf64-alpha.c, elf64-mmix.c, elf64-ppc.c, - elf64-s390.c, elf64-sparc.c, elf64-x86-64.c, elfxx-ia64.c: Update - RELOC_FOR_GLOBAL_SYMBOL invocation. + * elf32-bfin.c (bfd_const_reloc, bfd_oper_reloc, bfin_push_reloc, + RELOC_STACK_SIZE, reloc_stack, reloc_stack_tos, is_reloc_stack_empty, + reloc_stack_push, reloc_stack_pop, reloc_stack_operate, + bfin_areloc_howto_table): Delete. All + uses deleted as well. + (bfin_reloc_map): Delete all stack relocs. + (bfin_info_to_howto, bfin_bfd_reloc_type_lookup, + bfin_reloc_type_lookup): Don't support them. + (bfin_relocate_section): Don't try to handle them. - 2004-03-20 H.J. Lu - * elf-bfd.h (RELOC_FOR_GLOBAL_SYMBOL): Report error if - unresolved symbols in objects aren't allowed. - * elf-hppa.h (elf_hppa_relocate_section): Properly handle - unresolved symbols. - (elf_hppa_remark_useless_dynamic_symbols): Likewise. - (elf_hppa_unmark_useless_dynamic_symbols): - * elf32-frv.c (elf32_frv_relocate_section): Likewise. - * elf32-hppa.c (elf32_hppa_size_stubs): Likewise. - (elf32_hppa_relocate_section): Likewise. - * elf32-i370.c (i370_elf_relocate_section): Likewise. - * elf32-m32r.c (m32r_elf_relocate_section): Likewise. - * elf32-sh.c (sh_elf_relocate_section): Likewise. - * elf64-sh64.c (sh_elf64_relocate_section): Likewise. - * elfxx-mips.c (mips_elf_calculate_relocation): Likewise. - * elf-m10200.c (mn10200_elf_relocate_section): Use - RELOC_FOR_GLOBAL_SYMBOL. - * elf32-avr.c (elf32_avr_relocate_section): Likewise. - * elf32-d10v.c (elf32_d10v_relocate_section): Likewise. - * elf32-fr30.c (fr30_elf_relocate_section): Likewise. - * elf32-h8300.c (elf32_h8_relocate_section): Likewise. - * elf32-i860.c (elf32_i860_relocate_section): Likewise. - * elf32-m68hc1x.c (m68hc11_get_relocation_value): Likewise. - * elf32-mcore.c (mcore_elf_relocate_section): Likewise. - * elf32-msp430.c (elf32_msp430_relocate_section): Likewise. - * elf32-openrisc.c (openrisc_elf_relocate_section): Likewise. - * elf32-v850.c (v850_elf_relocate_section): Likewise. - * elf32-xstormy16.c (xstormy16_elf_relocate_section): Likewise. - * elf64-mmix.c (mmix_elf_relocate_section): Likewise. - - 2004-03-19 Alan Modra - H.J. Lu - * elflink.c (_bfd_elf_merge_symbol): Revert last change. Move - type and size change code to where it was previously. Remove - dt_needed param. Treat old weak syms as strong if new sym is - from a shared lib, even when old sym is from another shared - lib. Remove unnecessary tests of oldweak and newweak. Correct - comments. - (_bfd_elf_add_default_symbol): Remove dt_needed param. Update - _bfd_elf_merge_symbol calls. - * elflink.h (elf_link_add_object_symbols): Update calls. Remove - dt_needed local var. Update comments. - * elf-bfd.h (_bfd_elf_merge_symbol): Update prototype. - (_bfd_elf_add_default_symbol): Likewise. - * elflink.c (_bfd_elf_merge_symbol): Reinstate code to handle - strong syms in one shared object overriding weak syms in another. - - 2004-03-18 Alan Modra - * elf-bfd.h (struct elf_obj_tdata): Delete dt_soname field. Add - dyn_lib_class field. Rearrange for better packing. - (elf_dt_soname): Delete. - (elf_dyn_lib_class): Define. - * elf.c (bfd_elf_set_dt_needed_name): Update comment. - (bfd_elf_set_dt_needed_soname): Delete. - (bfd_elf_set_dyn_lib_class): New function. - * elflink.h (add_dt_needed_tag): New function. Split out from.. - (elf_link_add_object_symbols): ..here. Rename "name" to "soname". - Use elf_dyn_lib_class to set dt_needed and add_needed. Move fallback - initialization of soname. - (elf_link_check_versioned_symbol): Test elf_dyn_lib_class instead of - elf_dt_soname. - * bfd-in.h (enum dynamic_lib_link_class): New. - (bfd_elf_set_dt_needed_soname): Delete. - (bfd_elf_set_dyn_lib_class): Declare. - * bfd-in2.h: Regenerate. - * elflink.c (_bfd_elf_merge_symbol): Rewrite weak symbol handling. - (_bfd_elf_add_default_symbol): Remove indirect BFD_ASSERTs. - * elflink.h (elf_link_add_object_symbols): Don't clear dt_needed in - symbol loop. Instead use add_needed to flag tag as written. - - 2004-03-03 Alexandre Oliva - * elflink.c (bfd_elf_record_link_assignment): Mark undefweak and - undefined symbols as hash_new. - - 2004-02-28 H.J. Lu - * elf-bfd.h (_bfd_elf_link_add_archive_symbols): New prototype. - * elflink.h (is_global_data_symbol_definition): Moved to - elflink.c. - (elf_link_is_defined_archive_symbol): Likewise. - (elf_link_add_archive_symbols): Likewise. Renamed to - _bfd_elf_link_add_archive_symbols. - * elflink.c (elf_link_is_defined_archive_symbol): Get the size - of ELF symbol table entry from backend. - (_bfd_elf_link_add_archive_symbols): Call bfd_link_add_symbols - instead of elf_link_add_object_symbols. - - 2004-02-27 H.J. Lu - * elflink.h (sort_symbol): New. - (elf_link_add_object_symbols): Use a sorted symbol array for - weakdef. - - 2004-02-23 Jakub Jelinek - * elflink.h (size_dynamic_sections): If not adding DT_FLAGS and - DF_BIND_NOW is set in info->flags, create DT_BIND_NOW dynamic entry. - - 2004-02-21 H.J. Lu - * elflink.c (_bfd_elf_merge_symbol): Properly handle undefined - symbols with non-default visibility. - -2004-03-22 Bob Wilson - - * elf32-xtensa.c (elf_xtensa_check_relocs): Remove code to read - literal tables and check for relocs outside of literal pools. - (elf_xtensa_make_sym_local): Don't clear ELF_LINK_NON_GOT_REF flag. - (elf_xtensa_fix_refcounts): Don't check ELF_LINK_NON_GOT_REF or - set DF_TEXTREL. - (elf_xtensa_size_dynamic_sections): Don't add DT_TEXTREL entry. - (elf_xtensa_relocate_section): Read literal tables and check for - dynamic relocations in read-only sections and not in literal pools. - -2004-03-23 Alan Modra - - PR 51. - * linker.c (bfd_wrapped_link_hash_lookup): Handle info->wrap_char. - -2004-03-22 Hans-Peter Nilsson - - * elf32-cris.c (cris_elf_relocate_section) : Also error if there's no PLT for a symbol - not defined by the executable, or defined in a DSO. - : Initialize GOT entry for a - function symbol or ELF_LINK_HASH_NEEDS_PLT statically in an - executable. - (cris_elf_gc_sweep_hook): Improve fallthrough marking. - (elf_cris_try_fold_plt_to_got): Improve head comment. Do not fold - a PLT reloc to GOT for an executable. - (elf_cris_adjust_dynamic_symbol): Only fold a .got.plt entry with - .got for a DSO and explain why. - (elf_cris_discard_excess_program_dynamics): Also lose GOT-relocs - and unreferenced symbols for which a PLT is defined. Adjust - dynamic-symbol pruning correspondingly, to make sure we don't lose - a dynamic symbol also defined by a DSO. - -2004-03-17 Ralf Corsepius - - * config.bfd: Switch sh-*-rtems* to ELF. Add sh-*-rtemscoff*. - -2004-03-16 Alan Modra - - * elflink.c (elf_link_read_relocs_from_section): Don't use - NUM_SHDR_ENTRIES in end of reloc calc. Move NULL shdr check.. - (_bfd_elf_link_read_relocs): ..to here. - * elf32-ppc.c (ppc_elf_relax_section): Formatting. - - Merge from mainline. - 2004-02-20 Jakub Jelinek - * elf32-ppc.c (allocate_dynrelocs): Create dynsym for undef weak - symbols used in PIE relocs. - -2004-03-16 Alan Modra - - * configure.in (HOST_64BIT_TYPE, HOST_U_64BIT_TYPE): Don't override - values selected in configure.host. Require both to be defined - before setting BFD_HOST_64_BIT_DEFINED. Protect assignment to - corresponding BFD_HOST vars with quotes. - <${host64}-${target64}-${want64} in *true*>: Don't exempt gcc; - Always require BFD_HOST_64_BIT_DEFINED. - : Find off_t size before emitting message. Combine - off_t and ftello64 conditional. + * config.bfd (bfin-*-*): Add bfd_elf32_bfinfdpic_vec. + * configure.in: Likewise. * configure: Regenerate. + * elf32-bfin.c: Include "elf/dwarf2.h" and "hashtab.h". + (BFIN_RELOC_MAX): Now 0x21. + (bfin_howto_table, bfin_reloc_map): Add FD-PIC relocs. + (bfd_elf32_bfinfdpic_vec): Declare. + (IS_FDPIC): New macro. + (struct bfinfdpic_elf_link_hash_table): New struct. + (bfinfdpic_hash_table, bfinfdpic_got_section, + bfinfdpic_gotrel_section, bfinfdpic_gotfixup_section, + bfinfdpic_plt_setion, bfinfdpic_pltrel_section, + bfinfdpic_relocs_info, bfinfdpic_got_initial_offset, + bfinfdpic_plt_initial_offset): Accessor macros for it. + (BFINFDPIC_SYM_LOCAL, BFINFDPIC_FUNCDESC_LOCAL): New macros. + (struct bfinfdpic_relocs_info): New struct. + (LZPLT_RESOLVER_EXTRA, LZPLT_NORMAL_SIZE, LZPLT_ENTRIES, + BFINFDPIC_LZPLT_BLOCK_SIZE, BFINFDPIC_LZPLT_RESOLV_LOC, + DEFAULT_STACK_SIZE): New macros. + (bfinfdpic_elf_link_hash_table_create, bfinfdpic_relocs_info_hash, + bfinfdpic_relocs_info_eq, bfinfdpics_relocs_info_find, + bfinfdpic_relocs_info_for_global, bfinfdpic_relocs_info_for_local, + bfinfdpic_pic_merge_early_relocs_info, _bfinfdpic_add_dyn_reloc, + _bfinfdpic_add_rofixup, _bfinfdpic_osec_to_segment, + _bfinfdpic_osec_readonly_p, bfinfdpic_relocate_section, + bfinfdpic_check_relocs, bfinfdpic_gc_sweep_hook, + _bfinfdpic_link_omit_section_dynsym, _bfin_create_got_section, + elf32_bfinfdpic_create_dynamic_sections, _bfinfdpic_get_fd_entry, + _bfinfdpic_compute_got_alloc_data, _bfinfdpic_get_got_entry, + _bfinfdpic_assign_got_entries, _bfinfdpic_assign_plt_entries, + _bfinfdpic_resolve_final_relocs_info, + elf32_bfinfdpic_size_dynamic_sections, + elf32_bfinfdpic_always_size_sections, + elf32_bfinfdpic_modify_segment_map, + _bfinfdpic_count_got_plt_entries, + elf32_bfinfdpic_finish_dynamic_sections, + elf32_bfinfdpic_adjust_dynamic_symbol, + elf32_bfinfdpic_finish_dynamic_symbol, + elf32_bfinfdpic_elf_use_relative_eh_frame, + elf32_bfinfdpic_elf_encode_eh_address, + elf32_bfin_object_p, bfin_elf_copy_private_bfd_data, + elf32_bfinfdpic_copy_private_bfd_data, + (struct _bfinfdpic_dynamic_got_info, + struct _bfinfdpic_dynamic_got_plt_info): New structs. + (elf32_bfin_print_private_bfd_data): Print PIC flags. + (elf32_bfin_merge_private_bfd_data): Extend to support FD-PIC. + (TARGET_LITTLE_SYM, TARGET_LITTLE_NAME, elf32_bed, + elf_backend_got_header_size, bfd_elf32_bfd_link_hash_table_create, + elf_backend_always_size_sectinos, elf_backend_modify_segment_map, + bfd_elf32_bfd_copy_private_bfd_data, + elf_backend_create_dynamic_sections, elf_backend_adjust_dynamic_symbol, + elf_backend_size_dynamic_sections, elf_backend_finish_dynamic_symbol, + elf_backend_finish_dynamic_sections, elf_backend_relocate_section, + elf_backend_can_make_relative_eh_frame, elf_backend_check_relocs, + elf_backend_can_make_ldsa_relative_eh_frame, elf_backend_may_use_rel_p, + elf_backend_may_use_rela_p, elf_backend_default_use_rela_p, + elf_backend_omit_section_dynsym): Redefine these macros and include + "elf32-target.h" again to create the elf32-bfinfdpic target. + * reloc.c (BFD_RELOC_BFIN_GOT17M4, BFD_RELOC_BFIN_GOTHI, + BFD_RELOC_BFIN_GOTLO, BFD_RELOC_BFIN_FUNCDESC, + BFD_RELOC_BFIN_FUNCDESC_GOT17M4, BFD_RELOC_BFIN_FUNCDESC_GOTHI, + BFD_RELOC_BFIN_FUNCDESC_GOTLO, BFD_RELOC_BFIN_FUNCDESC_VALUE, + BFD_RELOC_BFIN_FUNCDESC_GOTOFF17M4, BFD_RELOC_BFIN_FUNCDESC_GOTOFFHI, + BFD_RELOC_BFIN_FUNCDESC_GOTOFFLO, BFD_RELOC_BFIN_GOTOFFHI, + BFD_RELOC_BFIN_GOTOFFLO): New. + * targets.c (bfd_elf32_bfinfdpic_vec): New bfd_target. + (_bfd_target_vector): Add it. + * bfd-in2.h: Regenerate. + * libbfd.h: Regenerate. -2004-03-16 Alan Modra +2006-03-25 Richard Sandiford - * elf32-m32r.c (m32r_elf_create_dynamic_sections): Fix pointer - aliasing warning. Remove trailing whitespace throughout file. + * cpu-m68k.c (bfd_m68k_compatible): Treat ISA A+ and ISA B code as + incompatible. Likewise MAC and EMAC code. + * elf32-m68k.c (elf32_m68k_merge_private_bfd_data): Use + bfd_get_compatible to set the new bfd architecture. Rely on it + to detect incompatibilities. -2004-03-15 John David Anglin +2006-03-22 Bob Wilson - * elf-hppa.h (elf_hppa_relocate_section): Pass input_bfd instead of - input_section in calls to get_dyn_name. - * elf64-hppa.c (get_dyn_name): Change type of first argument to "bfd *". Use section id of first section in input BFD to build dynamic name for - local symbols. - (elf64_hppa_check_relocs): Pass abfd in call to get_dyn_name. + * elf32-xtensa.c (xtensa_read_table_entries): Remove assertion that + rel->r_addend is zero. -2004-03-15 Alan Modra +2006-03-22 Richard Sandiford - * bfd-in.h (bfd_int64_t, bfd_uint64_t): New types. - (BFD_HOST_64_BIT, BFD_HOST_U_64_BIT): Don't define here. - (bfd_getb64, bfd_getl64, bfd_get_bits): Return bfd_uint64_t. - (bfd_getb_signed_64, bfd_getl_signed_64): Return bfd_int64_t. - (bfd_putb64, bfd_putl64, bfd_put_bits): Accept bfd_uint64_t. - * configure.in (HOST_U_64BIT_TYPE): Set when sizeof long is 8. - (BFD_HOST_64_BIT_DEFINED, BFD_HOST_64_BIT, BFD_HOST_U_64_BIT): Set - when using long. - * libbfd.c (EIGHT_GAZILLION, COERCE64): Use bfd_int64_t. - (bfd_getb64): Return bfd_uint64_t. Enable when BFD_HOST_64_BIT. - (bfd_getl64, bfd_getb_signed_64, bfd_getl_signed_64): Likewise. - (bfd_putb64): Accept bfd_uint64_t. Enable when BFD_HOST_64_BIT. - (bfd_putl64, bfd_put_bits, bfd_get_bits): Likewise. - * dwarf2.c (struct attribute): Use bfd_int64_t and bfd_uint64_t. - (read_8_bytes, read_indirect_string, read_address): Likewise. - (read_abbrevs, parse_comp_unit): Likewise. - * targets.c (struct bfd_target): Likewise. - * aix386-core.c (NO_GET64, NO_PUT64, NO_GETS64): Define and use. - * hppabsd-core.c: Likewise. Formatting. - * hpux-core.c: Likewise. - * irix-core.c: Likewise. - * netbsd-core.c: Likewise. - * osf-core.c: Likewise. - * ptrace-core.c: Likewise. - * sco5-core.c: Likewise. - * trad-core.c: Likewise. + * elfxx-mips.c (_bfd_mips_vxworks_finish_dynamic_symbol): Fix type + of "loc". + +2006-03-22 Richard Sandiford + Daniel Jacobowitz + Phil Edwards + Zack Weinberg + Mark Mitchell + Nathan Sidwell + + * bfd-in2.h: Regenerate. + * config.bfd (mips*-*-vxworks*, mips*el-*-vxworks*): New stanzas. + * configure.in (bfd_elf32_bigmips_vxworks_vec): New stanza. + (bfd_elf32_littlemips_vxworks_vec): Likewise. + (bfd_elf32_bigmips_vec): Add elf-vxworks.lo. + (bfd_elf32_littlemips_vec): Likewise. + (bfd_elf32_nbigmips_vec): Likewise. + (bfd_elf32_nlittlemips_vec): Likewise. + (bfd_elf32_ntradbigmips_vec): Likewise. + (bfd_elf32_ntradlittlemips_vec): Likewise. + (bfd_elf32_tradbigmips_vec): Likewise. + (bfd_elf32_tradlittlemips_vec): Likewise. + (bfd_elf64_bigmips_vec): Likewise. + (bfd_elf64_littlemips_vec): Likewise. + (bfd_elf64_tradbigmips_vec): Likewise. + (bfd_elf64_tradlittlemips_vec): Likewise. + * elf32-mips.c: Include elf-vxworks.h. + (mips_info_to_howto_rel): Use elf_backend_mips_rtype_to_howto + instead of calling mips_elf32_rtype_to_howto directly. + (mips_vxworks_copy_howto_rela): New reloc howto. + (mips_vxworks_jump_slot_howto_rela): Likewise. + (mips_vxworks_bfd_reloc_type_lookup): New function. + (mips_vxworks_rtype_to_howto): Likewise. + (mips_vxworks_final_write_processing): Likewise. + (TARGET_LITTLE_SYM, TARGET_LITTLE_NAME): Override for VxWorks. + (TARGET_BIG_SYM, TARGET_BIG_NAME, elf_bed, ELF_MAXPAGESIZE): Likewise. + (elf_backend_want_got_plt): Likewise. + (elf_backend_want_plt_sym): Likewise. + (elf_backend_got_symbol_offset): Likewise. + (elf_backend_want_dynbss): Likewise. + (elf_backend_may_use_rel_p): Likewise. + (elf_backend_may_use_rela_p): Likewise. + (elf_backend_default_use_rela_p): Likewise. + (elf_backend_got_header_size: Likewise. + (elf_backend_plt_readonly): Likewise. + (bfd_elf32_bfd_reloc_type_lookup): Likewise. + (elf_backend_mips_rtype_to_howto): Likewise. + (elf_backend_adjust_dynamic_symbol): Likewise. + (elf_backend_finish_dynamic_symbol): Likewise. + (bfd_elf32_bfd_link_hash_table_create): Likewise. + (elf_backend_add_symbol_hook): Likewise. + (elf_backend_link_output_symbol_hook): Likewise. + (elf_backend_emit_relocs): Likewise. + (elf_backend_final_write_processing: Likewise. + (elf_backend_additional_program_headers): Likewise. + (elf_backend_modify_segment_map): Likewise. + (elf_backend_symbol_processing): Likewise. + * elfxx-mips.c: Include elf-vxworks.h. + (mips_elf_link_hash_entry): Add is_relocation_target and + is_branch_target fields. + (mips_elf_link_hash_table): Add is_vxworks, srelbss, sdynbss, srelplt, + srelplt2, sgotplt, splt, plt_header_size and plt_entry_size fields. + (MIPS_ELF_RELA_SIZE, MIPS_ELF_REL_DYN_NAME): New macros. + (MIPS_RESERVED_GOTNO): Take a mips_elf_link_hash_table argument. + Return 3 for VxWorks. + (ELF_MIPS_GP_OFFSET): Change the argument from a bfd to a + mips_elf_link_hash_table. Return 0 for VxWorks. + (MIPS_ELF_GOT_MAX_SIZE): Change the argument from a bfd to a + mips_elf_link_hash_table. Update the call to ELF_MIPS_GP_OFFSET. + (mips_vxworks_exec_plt0_entry): New variable. + (mips_vxworks_exec_plt_entry): Likewise. + (mips_vxworks_shared_plt0_entry): Likewise. + (mips_vxworks_shared_plt_entry): Likewise. + (mips_elf_link_hash_newfunc): Initialize the new hash_entry fields. + (mips_elf_rel_dyn_section): Change the bfd argument to a + mips_elf_link_hash_table. Use MIPS_ELF_REL_DYN_NAME to get + the name of the section. + (mips_elf_initialize_tls_slots): Update the call to + mips_elf_rel_dyn_section. + (mips_elf_gotplt_index): New function. + (mips_elf_local_got_index): Add an input_section argument. + Update the call to mips_elf_create_local_got_entry. + (mips_elf_got_page): Likewise. + (mips_elf_got16_entry): Likewise. + (mips_elf_create_local_got_entry): Add bfd_link_info and input_section + arguments. Create dynamic relocations for each entry on VxWorks. + (mips_elf_merge_gots): Update the use of MIPS_ELF_GOT_MAX_SIZE. + (mips_elf_multi_got): Update the uses of MIPS_ELF_GOT_MAX_SIZE + and MIPS_RESERVED_GOTNO. + (mips_elf_create_got_section): Update the uses of + MIPS_ELF_GOT_MAX_SIZE. Create .got.plt on VxWorks. + (is_gott_symbol): New function. + (mips_elf_calculate_relocation): Use a dynobj local variable. + Update the calls to mips_elf_local_got_index, mips_elf_got16_entry and + mips_elf_got_page_entry. Set G to the .got.plt entry when calculating + VxWorks R_MIPS_CALL* relocations. Calculate and use G for all GOT + relocations on VxWorks. Add dynamic relocations for references + to the VxWorks __GOTT_BASE__ and __GOTT_INDEX__ symbols. Don't + create dynamic relocations for R_MIPS_32, R_MIPS_REL32 or R_MIPS_64 + in VxWorks executables. + (mips_elf_allocate_dynamic_relocations): Add a bfd_link_info argument. + Use MIPS_ELF_RELA_SIZE to calculate the size of a VxWorks entry. + Don't allocate a null entry on VxWorks. + (mips_elf_create_dynamic_relocation): Update the call to + mips_elf_rel_dyn_section. Use absolute rather than relative + relocations for VxWorks, and make them RELA rather than REL. + (_bfd_mips_elf_create_dynamic_sections): Don't make .dynamic + read-only on VxWorks. Update the call to mips_elf_rel_dyn_section. + Create the .plt, .rela.plt, .dynbss and .rela.bss sections on + VxWorks. Likewise create the _PROCEDURE_LINKAGE_TABLE symbol. + Call elf_vxworks_create_dynamic_sections for VxWorks and + initialize the plt_header_size and plt_entry_size fields. + (_bfd_mips_elf_check_relocs): Don't allow GOT relocations to be + used in VxWorks executables. Don't allocate dynamic relocations + for R_MIPS_32, R_MIPS_REL32 or R_MIPS_64 in VxWorks executables. + Set is_relocation_target for each symbol referenced by a relocation. + Allocate .rela.dyn entries for relocations against the special + VxWorks __GOTT_BASE__ and __GOTT_INDEX__ symbols. Create GOT + entries for all VxWorks R_MIPS_GOT16 relocations. Don't allocate + a global GOT entry for symbols mentioned in VxWorks R_MIPS_CALL*, + R_MIPS_32, R_MIPS_REL32 or R_MIPS_64 relocations. Update the calls + to mips_elf_rel_dyn_section and mips_elf_allocate_dynamic_relocations. + Set is_branch_target for symbols mentioned in R_MIPS_PC16 or R_MIPS_26 + relocations. Don't set no_fn_stub on VxWorks. + (_bfd_mips_elf_adjust_dynamic_symbol): Update the call to + mips_elf_allocate_dynamic_relocations. + (_bfd_mips_vxworks_adjust_dynamic_symbol): New function. + (_bfd_mips_elf_always_size_sections): Do not allocate GOT page + entries for VxWorks, and do not create multiple GOTs. + (_bfd_mips_elf_size_dynamic_sections): Use MIPS_ELF_REL_DYN_NAME. + Handle .got specially for VxWorks. Update the uses of + MIPS_RESERVED_GOTNO and mips_elf_allocate_dynamic_relocations. + Check for sgotplt and splt. Allocate the .rel(a).dyn contents last, + once its final size is known. Set DF_TEXTREL for VxWorks. Add + DT_RELA, DT_RELASZ, DT_RELAENT, DT_PLTREL, DT_PLTRELSZ and DT_JMPREL + tags on VxWorks. Do not add the MIPS-specific tags for VxWorks. + (_bfd_mips_vxworks_finish_dynamic_symbol): New function. + (mips_vxworks_finish_exec_plt): Likewise. + (mips_vxworks_finish_shared_plt): Likewise. + (_bfd_mips_elf_finish_dynamic_sections): Remove an unncessary call + to mips_elf_rel_dyn_section. Use a VxWorks-specific value of + DT_PLTGOT. Handle DT_RELA, DT_RELASZ, DT_RELAENT, DT_PLTREL, + DT_PLTRELSZ and DT_JMPREL. Update the uses of MIPS_RESERVED_GOTNO + and mips_elf_rel_dyn_section. Use a different GOT header for + VxWorks. Don't sort .rela.dyn on VxWorks. Finish the PLT on VxWorks. + (_bfd_mips_elf_link_hash_table_create): Initialize the new + mips_elf_link_hash_table fields. + (_bfd_mips_vxworks_link_hash_table_create): New function. + (_bfd_mips_elf_final_link): Set the GP value to _GLOBAL_OFFSET_TABLE_ + on VxWorks. Update the call to ELF_MIPS_GP_OFFSET. + * elfxx-mips.h (_bfd_mips_vxworks_adjust_dynamic_symbol): Declare. + (_bfd_mips_vxworks_finish_dynamic_symbol): Likewise. + (_bfd_mips_vxworks_link_hash_table_create): Likewise. + * libbfd.h: Regenerate. + * Makefile.am (elfxx-mips.lo): Depend on elf-vxworks.h. + (elf32-mips.lo): Likewise. + * Makefile.in: Regenerate. + * reloc.c (BFD_RELOC_MIPS_COPY, BFD_RELOC_MIPS_JUMP_SLOT): Declare. + * targets.c (bfd_elf32_bigmips_vxworks_vec): Declare. + (bfd_elf32_littlemips_vxworks_vec): Likewise. + (_bfd_target_vector): Add entries for them. + +2006-03-19 John David Anglin + + * elf64-hppa.c (elf64_hppa_special_sections): Change flags for .tbss + section from SHF_PARISC_WEAKORDER to SHF_HP_TLS. + (elf_backend_special_sections): Remove #undef. + +2006-03-18 John David Anglin + + * elf64-hppa.c (allocate_global_data_opd): Don't create an OPD entry + for undefined weak symbols. + +2006-03-17 Daniel Jacobowitz + + PR ld/2462 + * elflink.c (bfd_elf_final_link): Remove + bed->elf_backend_emit_relocs from emit_relocs. + +2006-03-17 Alexandre Oliva + + * elf32-ppc.c (ppc_elf_relocate_section): Copy addend from + first relocation to the second when relaxing TLS GD to LE; + zero it out when relaxing to IE. + +2006-03-17 Alan Modra + + PR 2434 + * elflink.c (elf_link_add_object_symbols): Save and restore + warning sym's linked sym. + +2006-03-16 Alan Modra + + PR 2434 + * elflink.c (struct elf_smash_syms_data, elf_smash_syms): Delete. + (elf_link_add_object_symbols): Delete unnecessary locals. Rename + hash_table -> htab. Formatting. Save entire symbol table + before loading as-needed syms, and restore afterwards if lib not + needed. Use bfd_hash_allocate rather than bfd_alloc for sym + name. Free some buffers earlier. + * bfd-in.h (struct bfd_hash_table): Add entsize. + (bfd_hash_table_init, bfd_hash_table_init_n): Adjust prototype. + * elf-bfd.h (_bfd_elf_link_hash_table_init): Likewise + * hash.c (bfd_hash_table_init_n): Add entsize param, save to + hash table. + (bfd_hash_table_init): Add param, adjust calls. + * aoutx.h: Adjust all hash_table_init functions and calls. + * bfd.c: Likewise. + * coff-arm.c: Likewise. + * coff-h8300.c: Likewise. + * coff-ppc.c: Likewise. + * cofflink.c: Likewise. + * ecoff.c: Likewise. + * ecofflink.c: Likewise. + * elf-m10300.c: Likewise. + * elf-strtab.c: Likewise. + * elf.c: Likewise. + * elf32-arm.c: Likewise. + * elf32-bfin.c: Likewise. + * elf32-cris.c: Likewise. + * elf32-frv.c: Likewise. + * elf32-hppa.c: Likewise. + * elf32-i386.c: Likewise. + * elf32-m32r.c: Likewise. + * elf32-m68hc1x.c: Likewise. + * elf32-m68k.c: Likewise. + * elf32-ppc.c: Likewise. + * elf32-s390.c: Likewise. + * elf32-sh.c: Likewise. + * elf32-vax.c: Likewise. + * elf64-alpha.c: Likewise. + * elf64-hppa.c: Likewise. + * elf64-ppc.c: Likewise. + * elf64-s390.c: Likewise. + * elf64-sh64.c: Likewise. + * elf64-x86-64.c: Likewise. + * elfxx-ia64.c: Likewise. + * elfxx-mips.c: Likewise. + * elfxx-sparc.c: Likewise. + * i386linux.c: Likewise. + * libaout.h: Likewise. + * libbfd-in.h: Likewise. + * libcoff-in.h: Likewise. + * linker.c: Likewise. + * m68klinux.c: Likewise. + * merge.c: Likewise. + * opncls.c: Likewise. + * pdp11.c: Likewise. + * sparclinux.c: Likewise. + * stabs.c: Likewise. + * sunos.c: Likewise. + * vms.c: Likewise. + * xcofflink.c: Likewise. + * section.c (struct section_hash_entry): Move to.. + * libbfd-in.h: ..here. + * Makefile.am: Run "make dep-am" + * Makefile.in: Regenerate. + * bfd-in2.h: Regenerate. + * libbfd.h: Regenerate. + * libcoff.h: Regenerate. + +2006-03-16 Alan Modra + + * elf32-ppc.c (ppc_elf_check_relocs): REL24 and REL14 relocs + against __GLOBAL_OFFSET_TABLE__ need never be dynamic. Tweak + last change to REL32 relocs so that they are counted as + possibly dynamic as per REL24 and REL14. + +2006-03-16 Alan Modra + + * elf32-ppc.c (ppc_elf_check_relocs): Don't fall into REL24 + checks from REL32. + +2006-03-15 Ben Elliston + + * elf32-arm.c (elf32_arm_merge_eabi_attributes): Iterate over all + in_list elements, not just the first. + +2006-03-14 Richard Sandiford + + * elf32-mips.c (mips_elf_adjust_addend): New function, mostly split + out from... + (_bfd_mips_elf_relocate_section): ...here. Use it to adjust r_addend + for final links too. + +2006-03-13 Richard Sandiford + + * elfxx-mips.c (mips_elf_create_got_section): Initialize hgot. + +2006-03-11 H.J. Lu + + PR ld/2443 + * dwarf2.c (concat_filename): Don't issue an error if file is + 0. + +2006-03-10 Paul Brook + + * elf32-arm.c (INTERWORK_FLAG): Handle EABIv5. + (elf32_arm_print_private_bfd_data): Ditto. + +2006-03-09 Paul Brook + + * cpu-arm.c (bfd_is_arm_mapping_symbol_name): Recognise additional + mapping symbols. + +2006-03-09 Khem Raj + + * elf32-arm.c(elf32_arm_finish_dynamic_sections): Use unsigned + char type. + +2006-03-08 H.J. Lu + + * elfxx-ia64.c (elfNN_ia64_choose_gp): Properly choose gp. + +2006-03-07 Richard Sandiford + Daniel Jacobowitz + Zack Weinberg + Nathan Sidwell + Paul Brook + Ricardo Anguiano + Phil Edwards + + * configure.in (bfd_elf32_bigarm_vec): Include elf-vxworks.lo. + (bfd_elf32_bigarm_symbian_vec): Likewise. + (bfd_elf32_bigarm_vxworks_vec): Likewise. + (bfd_elf32_littlearm_vec): Likewise. + (bfd_elf32_littlearm_symbian_vec): Likewise. + (bfd_elf32_littlearm_vxworks_vec): Likewise. * configure: Regenerate. + * elf32-arm.c: Include libiberty.h and elf-vxworks.h. + (RELOC_SECTION, RELOC_SIZE, SWAP_RELOC_IN, SWAP_RELOC_OUT): New macros. + (elf32_arm_vxworks_bed): Add forward declaration. + (elf32_arm_howto_table_1): Fix the masks for R_ASM_ABS12. + (elf32_arm_vxworks_exec_plt0_entry): New table. + (elf32_arm_vxworks_exec_plt_entry): Likewise. + (elf32_arm_vxworks_shared_plt_entry): Likewise. + (elf32_arm_link_hash_table): Add vxworks_p and srelplt2 fields. + (reloc_section_p): New function. + (create_got_section): Use RELOC_SECTION. + (elf32_arm_create_dynamic_sections): Likewise. Call + elf_vxworks_create_dynamic_sections for VxWorks targets. + Choose between the two possible values of plt_header_size + and plt_entry_size. + (elf32_arm_link_hash_table_create): Initialize vxworks_p and srelplt2. + (elf32_arm_abs12_reloc): New function. + (elf32_arm_final_link_relocate): Call it. Allow the creation of + dynamic R_ARM_ABS12 relocs on VxWorks. Use reloc_section_p, + RELOC_SIZE, SWAP_RELOC_OUT and RELOC_SECTION. Initialize the + r_addend fields of relocs. On rela targets, skip any code that + adjusts in-place addends. When using _bfd_link_final_relocate + to perform a final relocation, pass rel->r_addend as the addend + argument. + (elf32_arm_merge_private_bfd_data): If one of the bfds is a VxWorks + object, ignore flags that are not standard on VxWorks. + (elf32_arm_check_relocs): Allow the creation of dynamic R_ARM_ABS12 + relocs on VxWorks. Use reloc_section_p. + (elf32_arm_adjust_dynamic_symbol): Use RELOC_SECTION and RELOC_SIZE. + (allocate_dynrelocs): Use RELOC_SIZE. Account for the size of + .rela.plt.unloaded relocs on VxWorks targets. + (elf32_arm_size_dynamic_sections): Use RELOC_SIZE. Check for + .rela.plt.unloaded as well as .rel(a).plt. Add DT_RELA* tags + instead of DT_REL* tags on RELA targets. + (elf32_arm_finish_dynamic_symbol): Use RELOC_SECTION, RELOC_SIZE + and SWAP_RELOC_OUT. Initialize r_addend fields. Handle VxWorks + PLT entries. Do not make _GLOBAL_OFFSET_TABLE_ absolute on VxWorks. + (elf32_arm_finish_dynamic_sections): Use RELOC_SECTION, RELOC_SIZE + and SWAP_RELOC_OUT. Initialize r_addend fields. Handle DT_RELASZ + like DT_RELSZ. Handle the VxWorks form of initial PLT entry. + Correct the .rela.plt.unreloaded symbol indexes. + (elf32_arm_output_symbol_hook): Call the VxWorks version of this + hook on VxWorks targets. + (elf32_arm_vxworks_link_hash_table_create): Set vxworks_p to true. + Minor formatting tweak. + (elf32_arm_vxworks_final_write_processing): New function. + (elf_backend_add_symbol_hook): Override for VxWorks and reset + for Symbian. + (elf_backend_final_write_processing): Likewise. + (elf_backend_emit_relocs): Likewise. + (elf_backend_want_plt_sym): Likewise. + (ELF_MAXPAGESIZE): Likewise. + (elf_backend_may_use_rel_p): Minor formatting tweak. + (elf_backend_may_use_rela_p): Likewise. + (elf_backend_default_use_rela_p): Likewise. + (elf_backend_rela_normal): Likewise. + * Makefile.in (elf32-arm.lo): Depend on elf-vxworks.h. + +2006-03-06 Nathan Sidwell + + * archures.c (bfd_mach_mcf_isa_a_nodiv, bfd_mach_mcf_isa_b_nousp): + New. Adjust other variants. + (bfd_default_scan): Update. + * bfd-in2.h: Rebuilt. + * cpu-m68k.c: Adjust. + (bfd_m68k_compatible): New. Use it for architectures. + * elf32-m68k.c (elf32_m68k_object_p): Adjust. + (elf32_m68k_merge_private_bfd_data): Adjust. Correct isa-a/b + mismatch. + (elf32_m68k_print_private_bfd_data): Adjust. + * ieee.c (ieee_write_processor): Adjust. + +2006-03-06 Alan Modra + + * dwarf2.c: Formatting. + (add_line_info): Remove outer loop. + +2006-03-05 H.J. Lu + Alan Modra + + PR binutils/2338 + * dwarf2.c (loadable_section): New struct. + (dwarf2_debug): Add loadable_section_count and + loadable_sections. + (new_line_sorts_after): New. + (add_line_info): Use new_line_sorts_after to compare line + addresses. + (check_function_name): Removed. + (unset_sections): New. + (place_sections): New. + (_bfd_dwarf2_find_nearest_line): Updated. Call place_sections + and unset_sections on relocatable files. + (_bfd_dwarf2_find_line): Likewise. + +2006-03-03 Nick Clifton + + * cpu-avr.c: Update to ISO-C90 formatting. + * elf32-avr.c: Likewise. + +2006-03-03 Bjoern Haase + + * elf32-avr.c (avr_reloc_map): Insert BFD_RELOC_AVR_MS8_LDI + and R_AVR_MS8_LDI + (bfd_elf_avr_final_write_processing): Set + EF_AVR_LINKRELAX_PREPARED in e_flags field. + (elf32_avr_relax_section): New function. + (elf32_avr_relax_delete_bytes): New function. + (elf32_avr_get_relocated_section_contents): New function. + (avr_pc_wrap_around): New function. + (avr_relative_distance_considering_wrap_around): New function. + (avr_final_link_relocate): Handle negative int8t_t immediate for R_AVR_LDI. + * reloc.c: Add BFD_RELOC_AVR_MS8_LDI and BFD_RELOC_AVR_LDI_NEG + * libbfd.h: Regenerate. * bfd-in2.h: Regenerate. -2004-03-15 Alan Modra +2006-03-02 DJ Delorie - * bfd-in.h (bfd_getb64, bfd_getl64): Replace bfd_byte* with void*. - (bfd_getb32, bfd_getl32, bfd_getb16, bfd_getl16): Likewise. - (bfd_getb_signed_64, bfd_getl_signed_64): Likewise. - (bfd_getb_signed_32, bfd_getl_signed_32): Likewise. - (bfd_getb_signed_16, bfd_getl_signed_16): Likewise. - (bfd_putb64, bfd_putl64, bfd_putb32, bfd_putl32): Likewise. - (bfd_putb16, bfd_putl16, bfd_get_bits, bfd_put_bits): Likewise. - * libbfd.c: Likewise in function definitions. - (bfd_put_8): Mask with 0xff rather than casting to char. - (bfd_putb16, bfd_putl16, bfd_putb32, bfd_putl32): Likewise. - (bfd_putb64, bfd_putl64, bfd_put_bits): Likewise. - (H_PUT_64, H_PUT_32, H_PUT_16, H_PUT_8): Remove casts, simplify. - (H_PUT_S64, H_PUT_S32, H_PUT_S16, H_PUT_S8): Likewise. - (H_GET_64, H_GET_32, H_GET_16, H_GET_8): Likewise. - (H_GET_S64, H_GET_S32, H_GET_S16, H_GET_S8): Likewise. - * libaout.h (H_PUT_64 H_PUT_32, H_PUT_16): Remove casts, simplify. - (H_PUT_S64, H_PUT_S32, H_PUT_S16): Likewise. - (H_GET_64, H_GET_32, H_GET_16): Likewise. - (H_GET_S64, H_GET_S32, H_GET_S16): Likewise. - * archive.c (do_slurp_coff_armap): Update swap prototype. - * coff-tic54x.c (tic54x_getl32): Replace bfd_byte* with void*. - (tic54x_getl_signed_32): Likewise. - (tic54x_putl32): Likewise. Mask with 0xff rather than casting to char. - * mach-o.c (bfd_mach_o_read_header): Update get32 prototype. - * pdp11.c (bfd_getp32): Make static, replace bfd_byte* with void*. - (bfd_getp_signed_32, bfd_putp32): Likewise. - * targets.c (struct bfd_target): Use void* in place of bfd_byte* for - bfd_getx64, bfd_getx_signed_64, bfd_putx64, bfd_getx32, - bfd_getx_signed_32, bfd_putx32, bfd_getx16, bfd_getx_signed_16, - bfd_putx16, bfd_h_getx64, bfd_h_getx_signed_64, bfd_h_putx64, - bfd_h_getx32, bfd_h_getx_signed_32, bfd_h_putx32, bfd_h_getx16, - bfd_h_getx_signed_16, bfd_h_putx16. - * aix386-core.c (NO_GET, NO_GETS, NO_PUT): Update prototypes. - * hppabsd-core.c: Similarly. Rename NO_SIGNED_GET to NO_GETS. - * hpux-core.c: Likewise. - * irix-core.c: Likewise. - * netbsd-core.c: Likewise. - * osf-core.c: Likewise. - * ptrace-core.c: Likewise. - * sco5-core.c: Likewise. - * trad-core.c: Likewise. + * elf32-m32c.c (m32c_offset_for_reloc): Fix local symbol + calculations. + +2006-03-02 Richard Sandiford + + * elf32-ppc.c (is_ppc_elf_target): Return true if the target is + bfd_elf32_powerpc_vxworks_vec. + +2006-03-02 Nick Clifton + + * elf32-m32c.c (m32c_elf_relax_section): Initialise 'gap'. + +2006-03-02 Richard Sandiford + + * elf32-i386.c (elf_i386_create_dynamic_sections): Use + elf_vxworks_create_dynamic_sections. + (elf_i386_size_dynamic_sections): Remove VxWorks GOT and PLT + symbol handling. + * elf32-ppc.c (ppc_elf_create_dynamic_sections): Use + elf_vxworks_create_dynamic_sections. + (ppc_elf_size_dynamic_sections): Remove VxWorks GOT and PLT + symbol handling. + * elf-vxworks.c (elf_vxworks_create_dynamic_sections): New function. + * elf-vxworks.h (elf_vxworks_create_dynamic_sections): Declare. + +2006-03-02 Richard Sandiford + + * elf32-i386.c (elf_i386_vxworks_link_output_symbol_hook): Delete. + (elf_backend_link_output_symbol_hook): Use + elf_vxworks_link_output_symbol_hook instead. + * elf32-ppc.c (elf_i386_vxworks_link_output_symbol_hook): Delete. + (elf_backend_link_output_symbol_hook): Use + elf_vxworks_link_output_symbol_hook instead. + * elf-vxworks.c (elf_vxworks_link_output_symbol_hook): Provide the + same interface as elf_backend_link_output_symbol_hook. + * elf-vxworks.h (elf_vxworks_link_output_symbol_hook): Update + prototype accordingly. + +2006-03-02 Richard Sandiford + + * elf32-ppc.c (ppc_elf_plt_type): New enumeration. + (ppc_elf_link_hash_table): Replace old_got and new_got with + plt_type and can_use_new_plt. + (ppc_elf_create_dynamic_sections): Add SEC_HAS_CONTENTS, + SEC_LOAD and SEC_READONLY to the VxWorks .plt flags. + (ppc_elf_check_relocs): Set can_use_new_plt instead of new_plt. + Move from plt_type == PLT_UNSET to PLT_OLD instead of setting old_plt. + (ppc_elf_select_plt_layout): Move from plt_type == PLT_UNSET to + either plt_type == PLT_OLD or plt_type == PLT_NEW. Assert that + this function should not be called for VxWorks targets. + (ppc_elf_tls_setup): Use plt_type instead of old_got. + (allocate_got): Likewise. Rearrange so that max_before_header + is only used for PLT_OLD and PLT_NEW. + (allocate_dynrelocs): Use plt_type instead of old_got and is_vxworks. + (ppc_elf_size_dynamic_sections): Likewise. + (ppc_elf_relax_section): Likewise. + (ppc_elf_relocate_section): Likewise. + (ppc_elf_finish_dynamic_symbol): Likewise. + (ppc_elf_vxworks_link_hash_table_create): Initialize plt_type. + +2006-02-28 Richard Sandiford + + * elf32-i386.c (elf_i386_link_hash_table): Add next_tls_desc_index. + (elf_i386_link_hash_table_create): Initialize it. + (elf_i386_compute_jump_table_size): Use it instead of + srelplt->reloc_count. + (allocate_dynrelocs): Likewise. + (elf_i386_size_dynamic_sections): Likewise. + (elf_i386_relocate_section): Likewise. + +2006-02-27 Jakub Jelinek + + * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Handle S flag. + (_bfd_elf_write_section_eh_frame): Likewise. + +2006-02-27 Carlos O'Donell + + * po/Make-in: Add html target. + +2006-02-27 Richard Sandiford + + * elf-m10300.c (_bfd_mn10300_elf_finish_dynamic_symbol): Use the + cached hgot entry to check for _GLOBAL_OFFSET_TABLE_. + * elf32-arm.c (elf32_arm_finish_dynamic_symbol): Likewise. + * elf32-bfin.c (bfin_finish_dynamic_symbol): Likewise. + * elf32-cris.c (elf_cris_finish_dynamic_symbol): Likewise. + * elf32-hppa.c (elf32_hppa_finish_dynamic_symbol): Likewise. + * elf32-i386.c (elf_i386_finish_dynamic_symbol): Likewise. + * elf32-m32r.c (m32r_elf_finish_dynamic_symbol): Likewise. + * elf32-m68k.c (elf_m68k_finish_dynamic_symbol): Likewise. + * elf32-sh.c (sh_elf_finish_dynamic_symbol): Likewise. + * elf32-vax.c (elf_vax_finish_dynamic_symbol): Likewise. + * elf32-xtensa.c (elf_xtensa_finish_dynamic_symbol): Likewise. + * elf64-sh64.c (sh64_elf64_finish_dynamic_symbol): Likewise. + * elf64-x86-64.c (elf64_x86_64_finish_dynamic_symbol): Likewise. + * elfxx-mips.c (_bfd_mips_elf_finish_dynamic_symbol): Likewise. + * elf32-s390.c (elf_s390_finish_dynamic_symbol): Likewise. Also use + the cached hplt entry to check for _PROCEDURE_LINKAGE_TABLE_. + * elf64-alpha.c (elf64_alpha_finish_dynamic_symbol): Likewise. + * elf64-s390.c (elf_s390_finish_dynamic_symbol): Likewise. + * elfxx-ia64.c (elfNN_ia64_finish_dynamic_symbol): Likewise. + * elfxx-sparc.c (_bfd_sparc_elf_finish_dynamic_symbol): Likewise. + +2006-02-25 Richard Sandiford + + * elf-bfd.h (elf_link_hash_table): Add hplt field. + * elflink.c (_bfd_elf_create_dynamic_sections): Initialize it. + * elf-m10300.c (_bfd_mn10300_elf_create_got_section): Likewise. + * elf32-frv.c (_frv_create_got_section): Likewise. + * elf32-m32r.c (m32r_elf_create_dynamic_sections): Likewise. + * elf32-sh.c (sh_elf_create_dynamic_sections): Likewise. + * elf64-alpha.c (elf64_alpha_create_dynamic_sections): Likewise. + * elf64-sh64.c (sh64_elf64_create_dynamic_sections): Likewise. + * elf32-i386.c (elf_i386_link_hash_table): Remove hgot and hplt. + (elf_i386_link_hash_table_create): Don't initialize them. + (elf_i386_size_dynamic_sections): Use the generic ELF hplt and + hgot fields. + (elf_i386_finish_dynamic_symbol): Likewise. + * elf32-ppc.c (ppc_elf_link_hash_table): Remove hplt. + (ppc_elf_size_dynamic_sections): Use the generic ELF hplt fields. + (ppc_elf_finish_dynamic_symbol): Likewise. + +2006-02-24 DJ Delorie + + * elf32-m32c.c (m32c_elf_howto_table): Add relaxation relocs. + (m32c_elf_relocate_section): Don't relocate them. + (compare_reloc): New. + (relax_reloc): Remove. + (m32c_offset_for_reloc): New. + (m16c_addr_encodings): New. + (m16c_jmpaddr_encodings): New. + (m32c_addr_encodings): New. + (m32c_elf_relax_section): Relax jumps and address displacements. + (m32c_elf_relax_delete_bytes): Adjust for internal syms. Fix up + short jumps. + + * reloc.c: Add m32c relax relocs. + * libbfd.h: Regenerate. * bfd-in2.h: Regenerate. + +2006-02-24 H.J. Lu -2004-03-15 Matt Thomas + PR ld/2218 + * elf-bfd.h (elf_backend_data): Add elf_backend_fixup_symbol. + (_bfd_elf_link_hash_fixup_symbol): New. - * config.bfd: Add x86-64 vector to NetBSD/i386 if 64bit BFD is - selected. + * elflink.c (_bfd_elf_link_hash_fixup_symbol): New. + (_bfd_elf_fix_symbol_flags): Call elf_backend_fixup_symbol if + it isn't NULL. -2004-03-13 Mark Kettenis + * elfxx-ia64.c (elf_backend_fixup_symbol): Defined. - * config.bfd: Add x86_64-*-openbsd*. - * configure.in (x86_64-*-openbsd*): Set COREFILE to - netbsd-core.lo. + * elfxx-target.h (elf_backend_fixup_symbol): New. + (elfNN_bed): Initialize elf_backend_fixup_symbol. + +2006-02-23 H.J. Lu + + * cpu-ia64-opc.c (ins_immu5b): New. + (ext_immu5b): Likewise. + (elf64_ia64_operands): Add IMMU5b. + +2006-02-21 Alan Modra + + PR ld/2218 + * elf32-arm.c (allocate_dynrelocs): Ensure undef weak sym in pie + is dynamic. + * elf32-hppa.c (allocate_dynrelocs): Likewise. + * elf32-i386.c (allocate_dynrelocs): Likewise. + * elf32-s390.c (allocate_dynrelocs): Likewise. + * elf32-sh.c (allocate_dynrelocs): Likewise. + * elf64-s390.c (allocate_dynrelocs): Likewise. + * elf64-x86-64.c (allocate_dynrelocs): Likewise. + * elf32-m32r.c (allocate_dynrelocs): Likewise. Discard relocs + on undef weak with non-default visibility too. + * elfxx-sparc.c (allocate_dynrelocs): Ditto. + +2006-02-21 Alan Modra + + * bfd.c: (_bfd_default_error_handler): Don't call abort on + error, instead call _exit. + (_bfd_abort): Call _exit not xexit. + +2006-02-17 Kevin Buettner + + * elf32-frv.c (elf32_frv_grok_prstatus, elf32_frv_grok_psinfo): + New functions. + * elf_backend_grok_prstatus, elf_backend_grok_psinfo): Define. + +2006-02-17 Shrirang Khisti + Anil Paranjape + Shilin Shakti + + * Makefile.am: Add xc16x related entry + * Makefile.in: Regenerate + * archures.c: Add bfd_xc16x_arch + * bfd-in2.h: Regenerate + * config.bfd: Add xc16x-*-elf + * configure.in: Add bfd_elf32_xc16x_vec * configure: Regenerate. + * targets.c: Added xc16x related information + * cpu-xc16x.c: New file + * reloc.c: Add new relocations specific to xc16x: + BFD_RELOC_XC16X_PAG, BFD_RELOC_XC16X_POF, BFD_RELOC_XC16X_SEG, + BFD_RELOC_XC16X_SOF + * elf32-xc16x.c: New file. + +2006-02-17 Alan Modra + + * elf32-ppc.c (allocate_dynrelocs): Tweak undef weak handling. + * elf64-ppc.c (allocate_dynrelocs): Likewise. + +2006-02-17 Alan Modra -2004-03-09 Steve Ellcey + PR ld/2218 + * elf64-ppc.c (allocate_dynrelocs): Ensure undef weak sym is + dynamic. + (ppc64_elf_relocate_section): Check output reloc section size. + * elf32-ppc.c (allocate_dynrelocs): Simplify undef weak test. - * elfxx-ia64.c (plt_full_entry): Change ld8 to ld8.acq. +2006-02-16 H.J. Lu -2004-03-05 Nathan Sidwell + PR ld/2322 + * elf.c (get_segment_type): New function. + (_bfd_elf_print_private_bfd_data): Use it. + (print_segment_map): New function. + (assign_file_positions_for_segments): Call print_segment_map + when there are not enough room for program headers. - * elf.c (map_sections_to_segments): Ignore .tbss sections for - layout purposes. +2006-02-16 Nick Hudson -2004-02-17 Daniel Jacobowitz - Richard Sandiford - - * elfxx-mips.c (mips_elf_calculate_relocation): Use - _bfd_elf_symbol_refs_local_p to decide whether to decay - a GOT_PAGE/GOT_OFST pair to GOT_DISP/addend. - (_bfd_mips_elf_check_relocs): Add a global GOT entry for GOT_PAGE - relocs if the symbol wasn't defined by a regular object file. - Don't check the symbol's dynindx. - -2004-02-16 Andrew Cagney - - * bfd-in.h (file_ptr, ufile_ptr): Configure type using - @bfd_file_ptr@. - * bfd-in2.h: Re-generate. - -2004-02-14 Andrew Cagney - - * configure.host (HDEFINES): When hppa*-*-hpux*, define - _LARGEFILE64_SOURCE. - -2004-02-13 Andrew Cagney - - * elf.c (vma_page_aligned_bias): New function. - (assign_file_positions_except_relocs) - (assign_file_positions_for_segments): Replace broken modulo - arithmetic with call to vma_page_aligned_bias. - -2004-02-11 Andrew Cagney - - * bfd-in.h: Update copyright. - (bfd_tell): Change return type to file_ptr. - * bfd-in2.h: Re-generate. - * cache.c: Update copyright. - (bfd_cache_lookup_worker): Use real_fseek, do not cast offset - parameter. - (close_one): Use real_ftell. - * bfdio.c: Update copyright. - (real_ftell, real_fseek): New functions. - (bfd_tell): Use real_fseek and real_ftell, change return type to - file_ptr. - (bfd_seek): Use real_ftell and real_fseek, change type of - file_position to a file_ptr. - * libbfd-in.h: Update copyright. - (real_ftell, real_fseek): Declare. - * libbfd.h: Re-generate. - - * configure.in (AC_CHECK_FUNCS): Check for ftello, ftello64, - fseeko and fseeko64. Determine bfd_file_ptr. - * configure: Re-generate. - * config.in: Re-generate. - -2004-02-09 Anil Paranjpe - - * coff-h8300.c: Added comments about relaxation for ldc.w and stc.w. - * elf32-h8300.c: Likewise. - -2004-02-09 Christian Vogel - Nick Clifton - - * elf64-alpha.c (elf64_alpha_calc_got_offsets_for_symbol): Catch - GOT entries with no associated GOT subsection. - -2004-02-09 Richard Sandiford - - * bfd-elf.h (elf_backend_name_local_section_symbols): New hook. - * elf.c (swap_out_syms): Use it to decide whether local section - symbols should be named. - * elfxx-target.h (elf_backend_name_local_section_symbols): New macro. - * elfxx-mips.h (_bfd_mips_elf_name_local_section_symbols): Declare. - (elf_backend_name_local_section_symbols): Define. - * elfxx-mips.c (_bfd_mips_elf_name_local_section_symbols): New. - -2004-01-30 H.J. Lu - - * elfxx-ia64.c (elfNN_ia64_relax_brl): New function. - (elfNN_ia64_relax_section): Optimize brl to br during the relax - finalize pass. - -2004-01-30 Alexandre Oliva - - * elf32-frv.c (elf32_frv_always_size_sections): Initialize pointer - to bfd_link_hash_entry passed by reference to - _bfd_generic_link_add_one_symbol. - -2004-01-25 H.J. Lu - - * elfxx-ia64.c (elfNN_ia64_relocate_section): Disallow imm - relocations against dynamic symbols. - -2004-01-23 Daniel Jacobowitz - - * elf32-arm.h (elf32_arm_check_relocs): Revert part of 2004-01-13 - change. - -2004-01-21 Tom Rix - - * reloc.c: New 5 bit reloc, BFD_RELOC_M68HC12_5B, for m68hc12 movb/movw. - * bfd-in2.h, libbfd.h: Rebuilt. - -2004-01-20 Danny Smith - - * peXXigen.c (_bfd_XXi_swap_scnhdr_out): Don't remove - IMAGE_SCN_MEM_WRITE flag from .text section if WP_TEXT - flag has been cleared. - -2004-01-19 Kazu Hirata - - * coff-h8300.c: Add and adjust comments about relaxation. - * elf32-h8300.c: Likewise. - -2004-01-16 Kazu Hirata - - * coff-h8300.c: Fix comment typos. - * elf32-h8300.c: Likewise. - -2004-01-16 Kazu Hirata - - * coff-h8300.c: Add comments about relaxation. - * elf32-h8300.c: Likewise. - -2004-01-14 Maciej W. Rozycki - - * acinclude.m4: Quote names of macros to be defined by AC_DEFUN - throughout. - * aclocal.m4: Regenerate. - * configure: Regenerate. - -2004-01-13 Ian Lance Taylor - - * elf64-mips.c (mips_elf64_slurp_one_reloc_table): Call - mips_elf64_rtype_to_howto instead of using howto_table. - -2004-01-13 Daniel Jacobowitz - - * elf32-arm.h (elf32_arm_final_link_relocate): Check that we created - the .plt section. - (elf32_arm_check_relocs): Don't increment the PLT refcount for - relocs which would not use the PLT. - -2004-01-13 Alan Modra - - * elf64-ppc.c (ppc64_elf_check_relocs): Ignore !SEC_ALLOC relocs. - (ppc64_elf_gc_sweep_hook): Likewise. - (ppc64_elf_size_dynamic_sections): Test for .plt directly. - -2004-01-12 Anil Paranjpe - - Adds linker relaxation support for bit manipulation insns like - band, bclr, biand, bild, bior, bist, bixor, bld, bnot, bor, bset, - bst, btst, bxor. - * elf32-h8300.c: Opcode for bit manipulation insn is checked in - elf32_h8_relax_section function while relxation for aa:16 and aa:32. - * coff-h8300.c: Opcode for bit manipulation insn is checked in - h8300_reloc16_extra_cases function while relxation for aa:16 and aa:32. - -2004-01-12 Alan Modra - - * dwarf2.c: Convert to C90, remove unneeded casts and prototypes. - -2004-01-11 Kazu Hirata - - * elf32-h8300.c: Fix formatting. - -2004-01-11 Kazu Hirata - - * elf32-cris.c (cris_elf_gc_sweep_hook): Return early if no - dynamic object is present. Declare r_symndx and h in an inner - scope. - * elf32-vax.c (elf_vax_gc_sweep_hook): Likewise. - -2004-01-09 Daniel Jacobowitz - - * elf32-arm.h (struct elf32_arm_relocs_copied): Remove pc_count. - (elf32_arm_copy_indirect_symbol): Don't copy pc_count. - (elf32_arm_final_link_relocate): Handle PLT32 and PC24 relocs - identically. Do not emit PC24 relocations for shared libraries. - (elf32_arm_gc_sweep_hook): Handle PLT32 and PC24 relocs - identically. Don't adjust pc_count. - (elf32_arm_check_relocs): Handle PLT32 and PC24 relocs identically. - Set ELF_LINK_HASH_NEEDS_PLT for both. Don't adjust pc_count; don't - adjust count for branch relocations. - (allocate_dynrelocs): Correct typo in call to - WILL_CALL_FINISH_DYNAMIC_SYMBOL. Never allocate space for - PC24 or PLT32 relocs when linking. - -2004-01-09 Dmitry Semyonov - - * coff-arm.c (aoutarm_std_reloc_howto): [ARM_WINCE] Synchronize ARM_26D - relocation howto with ARM_26 one for consistency. - (coff_arm_relocate_section): Set partial_inplace for ARM_26 relocations - that will be converted to ARM_26D ones, since we always want 'done' - relocations to be reflected in section's data. - (coff_arm_relocate_section): [ARM_WINCE] Quick fix for BL instruction - offset. - (_bfd_final_link_relocate): Do not modify "inplace" data, if not - requested. - -2004-01-08 Dmitry Semyonov - - * coff-arm.c (coff_arm_relocate_section): Do not alter relocs that - are not partial_inplace during a relocatable link. - -2004-01-08 Kazu Hirata - - * elf32-m68k.c (elf_m68k_gc_sweep_hook): Return early - if no dynamic object is present. Declare r_symndx and h in an - inner scope. - -2004-01-07 H.J. Lu - - * elfxx-ia64.c (elfNN_ia64_relax_section): Don't install - trampoline if it is known out of range. - -2004-01-06 Alexandre Oliva - - 2003-12-17 Alexandre Oliva - * elf32-frv.c (_frv_osec_readonly_p): New. - (_frv_emit_got_relocs_plt_entries): Don't emit rofixup for - undefweak symbol. - (_frv_count_got_plt_entries): Adjust expected count accordingly. - (elf32_frv_relocate_section): Likewise. Error out if attempting - to emit rofixups or dynamic relocs in read-only segments. Use - _bfd_elf_section_offset to adjust r_offsets in rofixups and - dynamic relocations. - 2003-12-12 Alexandre Oliva - * elf32-frv.c (elf32_frv_relocate_section): Compute dynamic - relocations or fixups involving merged sections correctly. Avoid - crash when undefined symbol is referenced by R_FRV_32 or - R_FRV_FUNCDESC_VALUE. - 2003-12-02 Alexandre Oliva - * elf32-frv.c (elf32_frv_relocate_section): Add output_offset of - input section holding local symbol to addend of R_FRV_32 or - R_FRV_FUNCDESC_VALUE dynamic relocation. - 2003-11-27 Alexandre Oliva - * elf32-frv.c (elf32_frv_modify_segment_map): Add link info arg. - (elf32_frv_always_size_sections): Don't store pointer to - __stacksize symbol in sec_info. - (elf32_frv_modify_segment_map): Look it up here. - 2003-11-26 Alexandre Oliva - * elf32-frv.c (_frv_emit_got_relocs_plt_entries): Emit the address - of the lazy PLT entry, not only its offset, as the low word of a - function descriptor. - 2003-11-10 Alexandre Oliva - * elf32-frv.c (elf32_frv_always_size_sections): Define __stacksize - if a hash table entry already exists but is not a definition. - 2003-11-05 Alexandre Oliva - * elf32-frv.c (frv_elf_link_hash_table_create): Use bfd_zalloc. - (_frv_add_rofixup): Don't inline. - (_frv_emit_got_relocs_plt_entries): Use NULL as funcdesc address - for undefweak symbols. - (elf32_frv_relocate_section): Avoid crash while computing - relocation when linking with shared library. Only emit rofixups - and dynamic relocations for alloc&load sections. Mark binaries - with inter-segment relocations for relocation as a unit. - (_frv_create_got_section): Rename .rofixup.got to .rofixup. - (DEFAULT_STACK_SIZE): New. - (_frv_count_got_plt_entries): Fix thinko in deciding whether to - emit rofixups or dynamic relocs when linking dynamic non-PIE - executables. - (elf32_frv_size_dynamic_sections): Generate rofixup on PIEs and - shared libs too. Reserve the last entry for the GOT pointer. - (elf32_frv_finish_dynamic_sections): Emit it. - (elf32_frv_always_size_sections): New. - (elf32_frv_modify_segment_map): New. - (elf32_frv_check_relocs): Reserve relocs32 space only in ALLOC - sections. - (frv_elf_merge_private_bfd_data): Clear PIC bit if FDPIC is set. - (frv_elf_print_private_bfd_data): Handle FDPIC and LIBPIC. - (elf_backend_always_size_sections): New. - (elf_backend_modify_segment_map): New. - 2003-10-31 Alexandre Oliva - * config.bfd: Added frv-*-*linux*. - * elf32-frv.c (_frv_emit_got_relocs_plt_entries): Use idx 0 for - ABS section, instead of crashing. - (elf32_frv_relocate_section): Don't crash before warning about - different segments in non-PIC relocation. - 2003-10-17 Alexandre Oliva - * elf32-frv.c (elf32_frv_relocate_section): Don't warn on LABEL24 - relocs to undefweak symbols. - (elf32_frv_relocate_section): Ditto for undefined symbols. - 2003-10-06 Alexandre Oliva - * elf32-frv.c (elf32_frv_create_dynamic_sections): Make sure - gotfixup section was created. - 2003-09-30 Alexandre Oliva - * elf32-frv.c (elf32_frv_howto_table): Change GOT12, - FUNCDESC_GOT12, GOTOFF12 and FUNCDESC_GOTOFF12 to - complain_overflow_signed. - * elf32-frv.c (_frv_add_rofixup): Do not error out if contents - have not been allocated. - (_frv_emit_got_relocs_plt_entries): Return non-void. Assert - privfd only if dynamic sections were created. - (elf32_frv_relocate_section): Compute gprel_segment, and use it - for GPREL relocs. When linking relocatable FDPIC executables, - emit warnings for relocations that would be illegal on PIE or - shared libraries. Emit rofixup for R_FRV_32 only if input object - is not FDPIC. - (_frv_create_got_section): Define _gp symbol in the rofixup - section. - (elf32_frv_finish_dynamic_sections): If rofixups needed but - dynamic sections missing, error out requesting -melf32frvfd. - 2003-09-19 Alexandre Oliva - * elf32-frv.c (_frv_emit_got_relocs_plt_entries): Rearrange - computation of addends from section and global or local symbol - value. Change return type to bfd_boolean, and return a failure if - a dynamic FUNCDESC or FUNCDESC_VALUE relocation that requires a - nonzero addend is required. - (elf32_frv_relocate_section): Likewise. Print error for - unsupported nonzero addends. - 2003-09-18 Alexandre Oliva - * elf32-frv.c (FRV_SYM_LOCAL): In the absence of dynamic sections, - force everything local. - (_frv_emit_got_relocs_plt_entries): Cope with NULL sec. - * elf32-frv.c (struct frv_elf_link_hash_table): Added sgotfixup. - (frv_gotfixup_section): New. - (FRV_SYM_LOCAL): Accept undefweak and local common symbols. - (struct frv_pic_relocs_info): Split relocs into relocs32, relocsfd - and relocsfdv. - (_frv_add_rofixup): New. - (_frv_emit_got_relocs_plt_entries): Generate fixups for non-PIE - fdpic executables. Use FRV_SYM_LOCAL more widely to simplify and - improve some ugly conditions. - (elf32_frv_relocate_section): Likewise. Reject inter-segment - relocations in fdpic. - (_frv_create_got_section): Create .rofixup.got section. - (struct _frv_dynamic_got_info): Added fixups. - (_frv_count_got_plt_entries): Account in-GOT relocations into - relocs32, relocsfd and relocsfdv. Account them into relocs or - fixups, as appropriate. - (elf32_frv_size_dynamic_sections): Size rofixup section. Simplify - sizing of gotrel. - (elf32_frv_finish_dynamic_sections): Verify that the right number - of relocations and fixups was generated. - (elf32_frv_check_relocs): Compute relocs32, relocsfd and - relocsfdv. - * elf32-frv.c (FRV_SYM_LOCAL): New macro, used instead of - SYMBOL_CALLS_LOCAL and SYMBOL_REFERENCES_LOCAL. - (FRV_FUNCDESC_LOCAL): New macro, used to decide whether a function - descriptor of a (formerly-)global symbol is local. - (struct frv_pic_relocs_info): Adjust comments. - (_frv_emit_got_relocs_plt_entries): Adjust. - (elf32_frv_relocate_section): Likewise. - (_frv_count_got_plt_entries): Likewise. - * elf32-frv.c (_frv_emit_got_relocs_plt_entries): Don't add global - symbol's value to addend in the common preamble. Decay dynamic - symbols to section+offset if they bind or call locally, for GOT - and FUNCDESC_VALUE, respectively. - (elf32_frv_relocate_section): Likewise. - (elf32_frv_check_relocs): Don't register as dynamic symbols of - internal or hidden visibility. - 2003-09-17 Alexandre Oliva - * elf32-frv.c (_frv_emit_got_relocs_plt_entries): Get addend as - argument, so as to not call _bfd_elf_rel_local_sym to compute it. - (elf32_frv_relocate_section): Pass relocation addend in. Use - original relocation addend to look up the got relocs/plt entries - table. Do not call _bfd_elf_rel_local_sym. Don't error out when - processing relocations that reference .scommon symbols. - 2003-09-15 Alexandre Oliva - Introduce support for dynamic linking. - * elf32-frv.c (R_FRV_FUNCDESC_VALUE): Mark it as 64 bits. - (elf32_frv_rel_32_howto, elf32_frv_rel_funcdesc_howto, - elf32_frv_rel_funcdesc_value_howto): New REL descriptors. - (frv_reloc_type_lookup): Return REL howtos for executables and - dynamic libraries. - (frv_info_to_howto_rel): New. - (struct frv_elf_link_hash_table): New. - (frv_hash_table, frv_got_section, frv_gotrel_section, - frv_plt_section, frv_pltrel_section, frv_relocs_info, - frv_got_initial_offset, frv_plt_initial_offset): New macros. - (frv_elf_link_hash_table_create): New. - (struct frv_pic_relocs_info): New. - (frv_pic_relocs_info_hash, frv_pic_relocs_info_eq): New. - (frv_pic_relocs_info_find): New. - (frv_pic_relocs_info_for_global, frv_pic_relocs_info_for_local): - New. - (FRV_LZPLT_BLOCK_SIZE, FRV_LZPLT_RESOLVE_LOC): New. - (_frv_add_dyn_reloc, _frv_osec_to_segment): New. - (_frv_emit_got_relocs_plt_entries): New. - (elf32_frv_relocate_section): Add support for dynamic linking. - Handle new relocations. - (_frv_create_got_section): New. - (elf32_frv_create_dynamic_sections): New. - (ELF_DYNAMIC_INTERPRETER): New. - (struct _frv_dynamic_got_info): New. - (_frv_count_got_plt_entries): New. - (struct _frv_dynamic_got_plt_info): New. - (_frv_compute_got_alloc_data): New. - (_frv_get_got_entry, _frv_get_fd_entry): New. - (_frv_assign_got_entries, _frv_assign_plt_entries): New. - (_frv_resolve_final_relocs_info): New. - (elf32_frv_size_dynamic_sections): New. - (elf32_frv_finish_dynamic_sections): New. - (elf32_frv_adjust_dynamic_symbol): New. - (elf32_frv_finish_dynamic_symbol): New. - (elf32_frv_check_relocs): Handle new relocs. Explain how the - whole thing works. - (elf_info_to_howto_rel): Define. - (bfd_elf32_bfd_link_hash_table_create): Define. - (elf_backend_create_dynamic_sections): Define. - (elf_backend_adjust_dynamic_symbol): Define. - (elf_backend_size_dynamic_sections): Define. - (elf_backend_finish_dynamic_symbol): Define. - (elf_backend_finish_dynamic_sections): Define. - (elf_backend_want_got_sym): Define. - (elf_backend_got_header_size): Define. - (elf_backend_want_got_plt): Define. - (elf_backend_plt_readonly): Define. - (elf_backend_want_plt_sym): Define. - (elf_backend_plt_header_size): Define. - (elf_backend_may_use_rel_p): Define. - (elf_backend_may_use_rela_p): Define. - (elf_backend_default_use_rela_p): Define. - 2003-08-08 Alexandre Oliva - * elf32-frv.c (R_FRV_FUNCDESC_VALUE, R_FRV_FUNCDESC_GOTOFF12, - R_FRV_FUNCDESC_GOTOFFHI, R_FRV_FUNCDESC_GOTOFFLO, R_FRV_GOTOFF12, - R_FRV_GOTOFFHI, R_FRV_GOTOFFLO): New. - (frv_reloc_map): Map the corresponding BFD relocs to them. - (frv_reloc_type_lookup): ... and back to BFD relocs. - * reloc.c: New relocs. - * bfd-in2.h, libbfd.h: Rebuilt. - 2003-08-04 Alexandre Oliva - * elf32-frv.c (R_FRV_GOT12, R_FRV_GOTHI, R_FRV_GOTLO, - R_FRV_FUNCDESC, R_FRV_FUNCDESC_GOT12, R_FRV_FUNCDESC_GOTHI, - R_FRV_FUNCDESC_GOTLO): New. - (frv_reloc_map): Map the corresponding BFD relocs to them. - (frv_reloc_type_lookup): ... and back to BFD relocs. - * reloc.c: New relocs. - * bfd-in2.h, libbfd.h: Rebuilt. - -2004-01-05 Maciej W. Rozycki - - * elf32-mips.c (ELF_MAXPAGESIZE): Redefine for traditional - targets to support pages of up to 64kB. - (elf32_bed): Redefine to get a separate backend data structure for - traditional targets. - * elf64-mips.c (ELF_MAXPAGESIZE): Redefine for traditional - targets to support pages of up to 64kB. - (elf64_bed): Redefine to get a separate backend data structure for - traditional targets. - * elfn32-mips.c (ELF_MAXPAGESIZE): Redefine for traditional - targets to support pages of up to 64kB. - (elf32_bed): Redefine to get a separate backend data structure for - traditional targets. - -2004-01-04 Mark Kettenis - - * elf32-sparc.c (elf32_sparc_grok_psinfo): New function. - -2004-01-02 Mark Kettenis - - * elf32-i386.c (elf_i386_grok_prstatus): Add support for FreeBSD. - (elf_i386_grok_psinfo): Likewise. - -2004-01-02 Bernardo Innocenti - - * config.bfd: Add m68k-uClinux target. - -2004-01-01 Grant Edwards - - * elflink.h (elf_gc_sections): Warn when gc-sections option is ignored. - * elf32-h8300.c (elf32_h8_gc_mark_hook): New function. - (elf32_h8_gc_sweep_hook): New function. - (elf_backend_gc_mark_hook): Define. - (elf_backend_gc_sweep_hook): Define. - (elf_backend_can_gc_sections): Define. - -For older changes see ChangeLog-0203 + * config.bfd (mips*el-*-netbsd*, mips*-*-netbsd*): Use + traditional MIPS ELF targets. + +2006-02-15 H.J. Lu + + PR binutils/2338 + * dwarf2.c (check_function_name): New function. + (_bfd_dwarf2_find_nearest_line): Use check_function_name to + check if function is correct. + +2006-02-16 Alan Modra + + * elflink.c (_bfd_elf_default_action_discarded): Return 0 for + debug sections. + (elf_link_input_bfd): Adjust comments. + +2006-02-10 H.J. Lu + + * elf.c (copy_private_bfd_data): Minor update. + +2006-02-10 H.J. Lu + + PR binutils/2258 + * elf.c (copy_private_bfd_data): Renamed to ... + (rewrite_elf_program_header): This. + (copy_elf_program_header): New function. + (copy_private_bfd_data): Likewise. + +2006-02-07 Nathan Sidwell + + * archures.c (bfd_mach_mcf5200, bfd_mach_mcf5206e, + bfd_mach_mcf5307, bfd_mach_mcf5407, bfd_mach_mcf528x, + bfd_mach_mcfv4e, bfd_mach_mcf521x, bfd_mach_mcf5249, + bfd_mach_mcf547x, bfd_mach_mcf548x): Remove. + (bfd_mach_mcf_isa_a, bfd_mach_mcf_isa_a_div, + bfd_mach_mcf_isa_a_div_mac, bfd_mach_mcf_isa_a_div_emac, + bfd_mach_mcf_isa_aplus, bfd_mach_mcf_isa_aplus_mac, + bfd_mach_mcf_isa_aplus_emac, bfd_mach_mcf_isa_aplus_usp, + bfd_mach_mcf_isa_aplus_usp_mac, bfd_mach_mcf_isa_aplus_usp_emac, + bfd_mach_mcf_isa_b, bfd_mach_mcf_isa_b_mac, bfd_mach_mcf_isa_b_emac, + bfd_mach_mcf_isa_b_usp_float, bfd_mach_mcf_isa_b_usp_float_mac, + bfd_mach_mcf_isa_b_usp_float_emac): New. + (bfd_default_scan): Update coldfire mapping. + * bfd-in.h (bfd_m68k_mach_to_features, + bfd_m68k_features_to_mach): Declare. + * bfd-in2.h: Rebuilt. + * cpu-m68k.c (arch_info_struct): Add new coldfire machines, + adjust legacy names. + (m68k_arch_features): New. + (bfd_m68k_mach_to_features, + bfd_m68k_features_to_mach): Define. + * elf32-m68k.c (elf32_m68k_object_p): New. + (elf32_m68k_merge_private_bfd_data): Merge the CF EF flags. + (elf32_m68k_print_private_bfd_data): Print the CF EF flags. + (elf_backend_object_p): Define. + * ieee.c (ieee_write_processor): Update coldfire machines. + * libbfd.h: Rebuilt. + +2006-02-06 Steve Ellcey + + * elfxx-ia64.c (elfNN_ia64_fake_sections): Set SHF_IA_64_HP_TLS + if SHF_TLS is set. + +2006-02-05 Arnold Metselaar + + * coff-z80.c (r_imm24): New howto. + (rtype2howto): New case R_IMM24. + (coff_z80_reloc_type_lookup): New case BFD_RELOC_24. + (extra_case): Use bfd_get_8 for R_IMM8, new case R_IMM24. + +2006-02-04 Richard Sandiford + + * elfxx-mips.c (mips_elf_initialize_tls_index): If a TLS symbol + has already been assigned a GOT index, copy that index to the + current hash table entry. + +2006-02-01 Eric Botcazou + + * elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Reinstate bypass + for call-to-undefweak reloc overflow. + +2006-01-31 Eric Botcazou + + * elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Reinstate bypass + for 32-bit relocs overflow. + +2006-01-27 Paul Brook + + * elf32-arm.c (elf32_arm_get_symbol_type): Allow STT_TLS thumb + objects. + +2006-01-18 Alexandre Oliva + + Introduce TLS descriptors for i386 and x86_64. + * reloc.c (BFD_RELOC_386_TLS_GOTDESC, BFD_RELOC_386_TLS_DESC, + BFD_RELOC_386_TLS_DESC_CALL, BFD_RELOC_X86_64_GOTPC32_TLSDESC, + BFD_RELOC_X86_64_TLSDESC, BFD_RELOC_X86_64_TLSDESC_CALL): New. + * libbfd.h, bfd-in2.h: Rebuilt. + * elf32-i386.c (elf_howto_table): New relocations. + (R_386_tls): Adjust. + (elf_i386_reloc_type_lookup): Map new relocations. + (GOT_TLS_GDESC, GOT_TLS_GD_BOTH_P): New macros. + (GOT_TLS_GD_P, GOT_TLS_GDESC_P, GOT_TLS_GD_ANY_P): New macros. + (struct elf_i386_link_hash_entry): Add tlsdesc_got field. + (struct elf_i386_obj_tdata): Add local_tlsdesc_gotent field. + (elf_i386_local_tlsdesc_gotent): New macro. + (struct elf_i386_link_hash_table): Add sgotplt_jump_table_size. + (elf_i386_compute_jump_table_size): New macro. + (link_hash_newfunc): Initialize tlsdesc_got. + (elf_i386_link_hash_table_create): Set sgotplt_jump_table_size. + (elf_i386_tls_transition): Handle R_386_TLS_GOTDESC and + R_386_TLS_DESC_CALL. + (elf_i386_check_relocs): Likewise. Allocate space for + local_tlsdesc_gotent. + (elf_i386_gc_sweep_hook): Handle R_386_TLS_GOTDESC and + R_386_TLS_DESC_CALL. + (allocate_dynrelocs): Count function PLT relocations. Reserve + space for TLS descriptors and relocations. + (elf_i386_size_dynamic_sections): Reserve space for TLS + descriptors and relocations. Set up sgotplt_jump_table_size. + Don't zero reloc_count in srelplt. + (elf_i386_always_size_sections): New. Set up _TLS_MODULE_BASE_. + (elf_i386_relocate_section): Handle R_386_TLS_GOTDESC and + R_386_TLS_DESC_CALL. + (elf_i386_finish_dynamic_symbol): Use GOT_TLS_GD_ANY_P. + (elf_backend_always_size_sections): Define. + * elf64-x86-64.c (x86_64_elf_howto): Add R_X86_64_GOTPC32_TLSDESC, + R_X86_64_TLSDESC, R_X86_64_TLSDESC_CALL. + (R_X86_64_standard): Adjust. + (x86_64_reloc_map): Map new relocs. + (elf64_x86_64_rtype_to_howto): New, split out of... + (elf64_x86_64_info_to_howto): ... this function, and... + (elf64_x86_64_reloc_type_lookup): ... use it to map elf_reloc_val. + (GOT_TLS_GDESC, GOT_TLS_GD_BOTH_P): New macros. + (GOT_TLS_GD_P, GOT_TLS_GDESC_P, GOT_TLS_GD_ANY_P): New macros. + (struct elf64_x86_64_link_hash_entry): Add tlsdesc_got field. + (struct elf64_x86_64_obj_tdata): Add local_tlsdesc_gotent field. + (elf64_x86_64_local_tlsdesc_gotent): New macro. + (struct elf64_x86_64_link_hash_table): Add tlsdesc_plt, + tlsdesc_got and sgotplt_jump_table_size fields. + (elf64_x86_64_compute_jump_table_size): New macro. + (link_hash_newfunc): Initialize tlsdesc_got. + (elf64_x86_64_link_hash_table_create): Initialize new fields. + (elf64_x86_64_tls_transition): Handle R_X86_64_GOTPC32_TLSDESC and + R_X86_64_TLSDESC_CALL. + (elf64_x86_64_check_relocs): Likewise. Allocate space for + local_tlsdesc_gotent. + (elf64_x86_64_gc_sweep_hook): Handle R_X86_64_GOTPC32_TLSDESC and + R_X86_64_TLSDESC_CALL. + (allocate_dynrelocs): Count function PLT relocations. Reserve + space for TLS descriptors and relocations. + (elf64_x86_64_size_dynamic_sections): Reserve space for TLS + descriptors and relocations. Set up sgotplt_jump_table_size, + tlsdesc_plt and tlsdesc_got. Make room for them. Don't zero + reloc_count in srelplt. Add dynamic entries for DT_TLSDESC_PLT + and DT_TLSDESC_GOT. + (elf64_x86_64_always_size_sections): New. Set up + _TLS_MODULE_BASE_. + (elf64_x86_64_relocate_section): Handle R_386_TLS_GOTDESC and + R_386_TLS_DESC_CALL. + (elf64_x86_64_finish_dynamic_symbol): Use GOT_TLS_GD_ANY_P. + (elf64_x86_64_finish_dynamic_sections): Set DT_TLSDESC_PLT and + DT_TLSDESC_GOT. Set up TLS descriptor lazy resolver PLT entry. + (elf_backend_always_size_sections): Define. + +2006-01-17 H.J. Lu + + PR binutils/2096 + * dwarf2.c (comp_unit_contains_address): Update comment. + (_bfd_dwarf2_find_nearest_line): Use section's vma, instead of + lma. Return TRUE only if both comp_unit_contains_address and + comp_unit_find_nearest_line return TRUE. + (_bfd_dwarf2_find_line): Use section's vma, instead of lma. + +2006-01-18 Alan Modra + + * elf-bfd.h (struct elf_backend_data): Add gc_mark_dynamic_ref. + (bfd_elf_gc_mark_dynamic_ref_symbol): Declare. + * elflink.c (bfd_elf_gc_mark_dynamic_ref_symbol): Rename from + elf_gc_mark_dynamic_ref_symbol. Make global. + (bfd_elf_gc_sections): Call bed->gc_mark_dynamic_ref. + * elfxx-target.h (elf_backend_gc_mark_dynamic_ref): Define. + (elfNN_bed): Init new field. + * elf64-ppc.c (elf_backend_gc_mark_dynamic_ref): Define. + (ppc64_elf_gc_mark_dynamic_ref): New function. + +2006-01-17 Alan Modra + + * elf64-ppc.c (ppc64_elf_gc_mark_hook): Don't hang forever in loop. + +2006-01-17 Nick Clifton + + PR binutils/2159 + * elf.c (elfcore_write_pstatus): Add ATTRIBUTE_UNUSED to unused + parameters. + +2006-01-11 Nick Clifton + + * elf32-arm.c (elf32_arm_output_symbol_hook): Install new entry + into the newly (re)allocated map array. + +2006-01-09 Alexis Wilke + + * peXXigen.c (tbl): Add comma after "HIGH3ADJ". + +2006-01-01 Jakub Jelinek + + * elf64-ppc.c (ppc64_elf_action_discarded): Return 0 + for .toc1 section. + +For older changes see ChangeLog-2005 Local Variables: mode: change-log diff --git a/contrib/binutils/bfd/Makefile.am b/contrib/binutils/bfd/Makefile.am index de811af6f79..77278a832a1 100644 --- a/contrib/binutils/bfd/Makefile.am +++ b/contrib/binutils/bfd/Makefile.am @@ -1,6 +1,9 @@ ## Process this file with automake to generate Makefile.in -AUTOMAKE_OPTIONS = cygnus +AUTOMAKE_OPTIONS = 1.9 cygnus + +# Uncomment the following line when doing a release. +# RELEASE=y INCDIR = $(srcdir)/../include CSEARCH = -I. -I$(srcdir) -I$(INCDIR) @@ -8,13 +11,18 @@ MKDEP = gcc -MM SUBDIRS = doc po -docdir = doc +bfddocdir = doc bfdlibdir = @bfdlibdir@ bfdincludedir = @bfdincludedir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +htmldir = @htmldir@ + bfdlib_LTLIBRARIES = libbfd.la WARN_CFLAGS = @WARN_CFLAGS@ +NO_WERROR = @NO_WERROR@ AM_CFLAGS = $(WARN_CFLAGS) # bfd.h goes here, for now @@ -50,12 +58,14 @@ BFD64_LIBS_CFILES = archive64.c # This list is alphabetized to make it easier to keep in sync # with the decls and initializer in archures.c. ALL_MACHINES = \ - cpu-a29k.lo \ cpu-alpha.lo \ cpu-arc.lo \ cpu-arm.lo \ cpu-avr.lo \ + cpu-bfin.lo \ + cpu-cr16c.lo \ cpu-cris.lo \ + cpu-crx.lo \ cpu-d10v.lo \ cpu-d30v.lo \ cpu-dlx.lo \ @@ -71,6 +81,7 @@ ALL_MACHINES = \ cpu-i960.lo \ cpu-ip2k.lo \ cpu-iq2000.lo \ + cpu-m32c.lo \ cpu-m32r.lo \ cpu-m68hc11.lo \ cpu-m68hc12.lo \ @@ -78,9 +89,11 @@ ALL_MACHINES = \ cpu-m88k.lo \ cpu-m10200.lo \ cpu-m10300.lo \ + cpu-maxq.lo \ cpu-mcore.lo \ cpu-mips.lo \ cpu-mmix.lo \ + cpu-mt.lo \ cpu-msp430.lo \ cpu-or32.lo \ cpu-ns32k.lo \ @@ -102,15 +115,19 @@ ALL_MACHINES = \ cpu-w65.lo \ cpu-xstormy16.lo \ cpu-xtensa.lo \ + cpu-xc16x.lo \ + cpu-z80.lo \ cpu-z8k.lo ALL_MACHINES_CFILES = \ - cpu-a29k.c \ cpu-alpha.c \ cpu-arc.c \ cpu-arm.c \ cpu-avr.c \ + cpu-bfin.c \ cpu-cris.c \ + cpu-cr16c.c \ + cpu-crx.c \ cpu-d10v.c \ cpu-d30v.c \ cpu-dlx.c \ @@ -126,6 +143,7 @@ ALL_MACHINES_CFILES = \ cpu-i960.c \ cpu-ip2k.c \ cpu-iq2000.c \ + cpu-m32c.c \ cpu-m32r.c \ cpu-m68hc11.c \ cpu-m68hc12.c \ @@ -133,9 +151,11 @@ ALL_MACHINES_CFILES = \ cpu-m88k.c \ cpu-m10200.c \ cpu-m10300.c \ + cpu-maxq.c \ cpu-mcore.c \ cpu-mips.c \ cpu-mmix.c \ + cpu-mt.c \ cpu-msp430.c \ cpu-or32.c \ cpu-ns32k.c \ @@ -157,6 +177,8 @@ ALL_MACHINES_CFILES = \ cpu-w65.c \ cpu-xstormy16.c \ cpu-xtensa.c \ + cpu-xc16x.c \ + cpu-z80.c \ cpu-z8k.c # The .o files needed by all of the 32 bit vectors that are configured into @@ -173,9 +195,7 @@ BFD32_BACKENDS = \ armnetbsd.lo \ bout.lo \ cf-i386lynx.lo \ - cf-m68klynx.lo \ cf-sparclynx.lo \ - coff-a29k.lo \ coff-apollo.lo \ coff-arm.lo \ coff-aux.lo \ @@ -187,6 +207,7 @@ BFD32_BACKENDS = \ coff-i960.lo \ coff-m68k.lo \ coff-m88k.lo \ + coff-maxq.lo \ coff-mips.lo \ coff-or32.lo \ coff-rs6000.lo \ @@ -201,6 +222,7 @@ BFD32_BACKENDS = \ coff-u68k.lo \ coff-we32k.lo \ coff-w65.lo \ + coff-z80.lo \ coff-z8k.lo \ cofflink.lo \ dwarf1.lo \ @@ -210,10 +232,12 @@ BFD32_BACKENDS = \ elf.lo \ elf32-am33lin.lo \ elf32-arc.lo \ - elfarm-oabi.lo \ - elfarm-nabi.lo \ + elf32-arm.lo \ elf32-avr.lo \ + elf32-bfin.lo \ + elf32-cr16c.lo \ elf32-cris.lo \ + elf32-crx.lo \ elf32-d10v.lo \ elf32-d30v.lo \ elf32-dlx.lo \ @@ -226,9 +250,9 @@ BFD32_BACKENDS = \ elf32-i386.lo \ elf32-i860.lo \ elf32-i960.lo \ - elf32-ia64.lo \ elf32-ip2k.lo \ elf32-iq2000.lo \ + elf32-m32c.lo \ elf32-m32r.lo \ elf32-m68hc11.lo \ elf32-m68hc12.lo \ @@ -240,6 +264,7 @@ BFD32_BACKENDS = \ elf32-mcore.lo \ elfxx-mips.lo \ elf32-mips.lo \ + elf32-mt.lo \ elf32-msp430.lo \ elf32-openrisc.lo \ elf32-or32.lo \ @@ -247,17 +272,21 @@ BFD32_BACKENDS = \ elf32-ppc.lo \ elf32-s390.lo \ elf32-sh.lo \ + elf32-sh-symbian.lo \ elf32-sh64.lo \ elf32-sh64-com.lo \ + elfxx-sparc.lo \ elf32-sparc.lo \ elf32-v850.lo \ elf32-vax.lo \ elf32-xstormy16.lo \ elf32-xtensa.lo \ + elf32-xc16x.lo \ elf32.lo \ elflink.lo \ elf-strtab.lo \ elf-eh-frame.lo \ + elf-vxworks.lo \ epoc-pe-arm.lo \ epoc-pei-arm.lo \ hp300bsd.lo \ @@ -276,9 +305,9 @@ BFD32_BACKENDS = \ ieee.lo \ m68k4knetbsd.lo \ m68klinux.lo \ - m68klynx.lo \ m68knetbsd.lo \ m88kmach3.lo \ + m88kopenbsd.lo \ mach-o.lo \ mipsbsd.lo \ newsos3.lo \ @@ -338,9 +367,7 @@ BFD32_BACKENDS_CFILES = \ armnetbsd.c \ bout.c \ cf-i386lynx.c \ - cf-m68klynx.c \ cf-sparclynx.c \ - coff-a29k.c \ coff-apollo.c \ coff-arm.c \ coff-aux.c \ @@ -352,6 +379,7 @@ BFD32_BACKENDS_CFILES = \ coff-i960.c \ coff-m68k.c \ coff-m88k.c \ + coff-maxq.c \ coff-mips.c \ coff-or32.c \ coff-rs6000.c \ @@ -366,6 +394,7 @@ BFD32_BACKENDS_CFILES = \ coff-u68k.c \ coff-we32k.c \ coff-w65.c \ + coff-z80.c \ coff-z8k.c \ cofflink.c \ dwarf1.c \ @@ -375,10 +404,12 @@ BFD32_BACKENDS_CFILES = \ elf.c \ elf32-am33lin.c \ elf32-arc.c \ - elfarm-oabi.c \ - elfarm-nabi.c \ + elf32-arm.c \ elf32-avr.c \ + elf32-bfin.c \ + elf32-cr16c.c \ elf32-cris.c \ + elf32-crx.c \ elf32-d10v.c \ elf32-d30v.c \ elf32-dlx.c \ @@ -393,6 +424,7 @@ BFD32_BACKENDS_CFILES = \ elf32-i960.c \ elf32-ip2k.c \ elf32-iq2000.c \ + elf32-m32c.c \ elf32-m32r.c \ elf32-m68k.c \ elf32-m68hc11.c \ @@ -404,6 +436,7 @@ BFD32_BACKENDS_CFILES = \ elf32-mcore.c \ elfxx-mips.c \ elf32-mips.c \ + elf32-mt.c \ elf32-msp430.c \ elf32-openrisc.c \ elf32-or32.c \ @@ -413,15 +446,19 @@ BFD32_BACKENDS_CFILES = \ elf32-sh64-com.c \ elf32-s390.c \ elf32-sh.c \ + elf32-sh-symbian.c \ + elfxx-sparc.c \ elf32-sparc.c \ elf32-v850.c \ elf32-vax.c \ elf32-xstormy16.c \ elf32-xtensa.c \ + elf32-xc16x.c \ elf32.c \ elflink.c \ elf-strtab.c \ elf-eh-frame.c \ + elf-vxworks.c \ epoc-pe-arm.c \ epoc-pei-arm.c \ hp300bsd.c \ @@ -440,9 +477,9 @@ BFD32_BACKENDS_CFILES = \ ieee.c \ m68k4knetbsd.c \ m68klinux.c \ - m68klynx.c \ m68knetbsd.c \ m88kmach3.c \ + m88kopenbsd.c \ mach-o.c \ mipsbsd.c \ newsos3.c \ @@ -492,6 +529,8 @@ BFD32_BACKENDS_CFILES = \ # The .o files needed by all of the 64 bit vectors that are configured into # target_vector in targets.c if configured with --enable-targets=all # and --enable-64-bit-bfd. +# elf32-ia64.c requires a 64-bit bfd_vma, and hence can not be put in +# BFD32_BACKENDS. BFD64_BACKENDS = \ aix5ppc-core.lo \ aout64.lo \ @@ -502,6 +541,7 @@ BFD64_BACKENDS = \ elf64-x86-64.lo \ elf64-alpha.lo \ elf64-hppa.lo \ + elf32-ia64.lo \ elf64-ia64.lo \ elf64-gen.lo \ elfn32-mips.lo \ @@ -560,6 +600,14 @@ OPTIONAL_BACKENDS_CFILES = \ trad-core.c \ cisco-core.c +# We want to rerun configure if configure.in, config.bfd or +# configure.host change. configure.in is needed since the version +# number in Makefile comes from configure.in. +CONFIG_STATUS_DEPENDENCIES = \ + $(srcdir)/configure.in \ + $(srcdir)/config.bfd \ + $(srcdir)/configure.host + # These are defined by configure.in: WORDSIZE = @wordsize@ ALL_BACKENDS = @all_backends@ @@ -568,7 +616,7 @@ BFD_LIBS = @bfd_libs@ BFD_MACHINES = @bfd_machines@ TDEFAULTS = @tdefaults@ -INCLUDES = -D_GNU_SOURCE @HDEFINES@ @COREFLAG@ @TDEFINES@ $(CSEARCH) $(CSWITCHES) -I$(srcdir)/../intl -I../intl +INCLUDES = @HDEFINES@ @COREFLAG@ @TDEFINES@ $(CSEARCH) $(CSWITCHES) -I$(srcdir)/../intl -I../intl # C source files that correspond to .o's. SOURCE_CFILES = \ @@ -587,7 +635,7 @@ CFILES = $(SOURCE_CFILES) $(BUILD_CFILES) ## This is a list of all .h files which are in the source tree. SOURCE_HFILES = \ aout-target.h aoutf1.h aoutx.h coffcode.h coffswap.h ecoffswap.h \ - elf-bfd.h elf-hppa.h elf32-arm.h elf32-hppa.h \ + elf-bfd.h elf-hppa.h elf32-hppa.h \ elf64-hppa.h elfcode.h elfcore.h \ freebsd.h genlink.h go32stub.h \ libaout.h libbfd.h libcoff.h libecoff.h libhppa.h libieee.h \ @@ -615,7 +663,36 @@ po/BLD-POTFILES.in: @MAINT@ Makefile $(BLD_POTFILES) | LC_COLLATE= sort > tmp.bld \ && mv tmp.bld $(srcdir)/po/BLD-POTFILES.in -diststuff: info +all diststuff: info + +.PHONY: install-html install-html-am install-html-recursive + +install-html: install-html-recursive + +install-html-recursive: + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" # Various kinds of .o files to put in libbfd.a: # BFD_BACKENDS Routines the configured targets need. @@ -748,8 +825,6 @@ uninstall_libbfd: rm -f $(DESTDIR)$(bfdincludedir)/symcat.h rm -f $(DESTDIR)$(bfdincludedir)/bfdlink.h -Makefile: $(srcdir)/configure.in - # Have to get rid of DEP1 here so that "$?" later includes all of $(CFILES). DEP: dep.sed $(CFILES) $(HFILES) bfd.h rm -f DEP1 @@ -817,12 +892,12 @@ LIBCOFF_H_FILES = libcoff-in.h coffcode.h # Could really use a "copy-if-change"... headers: - (cd $(docdir); $(MAKE) protos $(FLAGS_TO_PASS)) - cp $(docdir)/bfd.h bfd-in2.h-new + (cd $(bfddocdir); $(MAKE) protos $(FLAGS_TO_PASS)) + cp $(bfddocdir)/bfd.h bfd-in2.h-new $(SHELL) $(srcdir)/../move-if-change bfd-in2.h-new $(srcdir)/bfd-in2.h - cp $(docdir)/libbfd.h libbfd.h-new + cp $(bfddocdir)/libbfd.h libbfd.h-new $(SHELL) $(srcdir)/../move-if-change libbfd.h-new $(srcdir)/libbfd.h - cp $(docdir)/libcoff.h libcoff.h-new + cp $(bfddocdir)/libcoff.h libcoff.h-new $(SHELL) $(srcdir)/../move-if-change libcoff.h-new $(srcdir)/libcoff.h # We only rebuild the header files automatically if we have been @@ -830,22 +905,22 @@ headers: $(srcdir)/bfd-in2.h: @MAINT@ stmp-bin2-h ; @true stmp-bin2-h: $(BFD_H_FILES) $(BFD64_H_FILES) - (cd $(docdir); $(MAKE) $(FLAGS_TO_PASS) bfd.h) - cp $(docdir)/bfd.h bfd-in2.h-new + (cd $(bfddocdir); $(MAKE) $(FLAGS_TO_PASS) bfd.h) + cp $(bfddocdir)/bfd.h bfd-in2.h-new $(SHELL) $(srcdir)/../move-if-change bfd-in2.h-new $(srcdir)/bfd-in2.h touch stmp-bin2-h $(srcdir)/libbfd.h: @MAINT@ stmp-lbfd-h ; @true stmp-lbfd-h: $(LIBBFD_H_FILES) - (cd $(docdir); $(MAKE) $(FLAGS_TO_PASS) libbfd.h) - cp $(docdir)/libbfd.h libbfd.h-new + (cd $(bfddocdir); $(MAKE) $(FLAGS_TO_PASS) libbfd.h) + cp $(bfddocdir)/libbfd.h libbfd.h-new $(SHELL) $(srcdir)/../move-if-change libbfd.h-new $(srcdir)/libbfd.h touch stmp-lbfd-h $(srcdir)/libcoff.h: @MAINT@ stmp-lcoff-h ; @true stmp-lcoff-h: $(LIBCOFF_H_FILES) - (cd $(docdir); $(MAKE) $(FLAGS_TO_PASS) libcoff.h) - cp $(docdir)/libcoff.h libcoff.h-new + (cd $(bfddocdir); $(MAKE) $(FLAGS_TO_PASS) libcoff.h) + cp $(bfddocdir)/libcoff.h libcoff.h-new $(SHELL) $(srcdir)/../move-if-change libcoff.h-new $(srcdir)/libcoff.h touch stmp-lcoff-h @@ -856,777 +931,909 @@ CLEANFILES = bfd.h dep.sed stmp-bfd-h DEP DEPA DEP1 DEP2 libbfd.a stamp-lib \ DISTCLEANFILES = $(BUILD_CFILES) $(BUILD_HFILES) -# We want to rerun configure if config.bfd, configure.host or version.h change. -config.status: $(srcdir)/configure $(srcdir)/config.bfd \ - $(srcdir)/configure.host $(srcdir)/version.h - $(SHELL) ./config.status --recheck +bfdver.h: $(srcdir)/version.h $(srcdir)/Makefile.in + @echo "creating $@" + @bfd_version=`echo "$(VERSION)" | sed -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$$/\1\2\3\4\5/'` ;\ + bfd_version_string="\"$(VERSION)\"" ;\ + if test "x$(RELEASE)" = x ; then \ + bfd_version_date=`sed -n -e 's/.*DATE //p' < $(srcdir)/version.h` ;\ + bfd_version_string="\"$(VERSION) $${bfd_version_date}\"" ;\ + fi ;\ + sed -e "s/@bfd_version@/$$bfd_version/" -e "s/@bfd_version_string@/$$bfd_version_string/" < $(srcdir)/version.h > $@ # What appears below is generated by a hacked mkdep using gcc -MM. # DO NOT DELETE THIS LINE -- mkdep uses it. # DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. -archive.lo: archive.c $(INCDIR)/filenames.h $(INCDIR)/aout/ar.h \ - $(INCDIR)/aout/ranlib.h $(INCDIR)/safe-ctype.h -archures.lo: archures.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h +archive.lo: archive.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ + $(INCDIR)/hashtab.h $(INCDIR)/aout/ar.h $(INCDIR)/aout/ranlib.h \ + $(INCDIR)/safe-ctype.h +archures.lo: archures.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/safe-ctype.h bfd.lo: bfd.c bfdver.h $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ - $(INCDIR)/safe-ctype.h $(INCDIR)/bfdlink.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/sym.h libcoff.h libecoff.h $(INCDIR)/coff/ecoff.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h -bfdio.lo: bfdio.c $(INCDIR)/filenames.h -bfdwin.lo: bfdwin.c $(INCDIR)/filenames.h -cache.lo: cache.c $(INCDIR)/filenames.h -coffgen.lo: coffgen.c $(INCDIR)/filenames.h $(INCDIR)/coff/internal.h \ - libcoff.h $(INCDIR)/bfdlink.h -corefile.lo: corefile.c $(INCDIR)/filenames.h -format.lo: format.c $(INCDIR)/filenames.h -init.lo: init.c $(INCDIR)/filenames.h -libbfd.lo: libbfd.c $(INCDIR)/filenames.h -opncls.lo: opncls.c $(INCDIR)/filenames.h $(INCDIR)/objalloc.h \ + $(INCDIR)/safe-ctype.h $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h libcoff.h \ + libecoff.h $(INCDIR)/coff/ecoff.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h +bfdio.lo: bfdio.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +bfdwin.lo: bfdwin.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cache.lo: cache.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ $(INCDIR)/libiberty.h -reloc.lo: reloc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h -section.lo: section.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h -syms.lo: syms.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def -targets.lo: targets.c $(INCDIR)/filenames.h $(INCDIR)/fnmatch.h \ - targmatch.h -hash.lo: hash.c $(INCDIR)/filenames.h $(INCDIR)/objalloc.h -linker.lo: linker.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - genlink.h -srec.lo: srec.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ - $(INCDIR)/safe-ctype.h -binary.lo: binary.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h -tekhex.lo: tekhex.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h -ihex.lo: ihex.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ - $(INCDIR)/safe-ctype.h -stabs.lo: stabs.c $(INCDIR)/filenames.h $(INCDIR)/aout/stab_gnu.h \ - $(INCDIR)/aout/stab.def $(INCDIR)/safe-ctype.h +coffgen.lo: coffgen.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h +corefile.lo: corefile.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +format.lo: format.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +init.lo: init.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +libbfd.lo: libbfd.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +opncls.lo: opncls.c $(INCDIR)/filenames.h $(INCDIR)/objalloc.h \ + $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h +reloc.lo: reloc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/hashtab.h +section.lo: section.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/bfdlink.h +syms.lo: syms.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/safe-ctype.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/stab_gnu.h \ + $(INCDIR)/aout/stab.def +targets.lo: targets.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/fnmatch.h targmatch.h +hash.lo: hash.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/objalloc.h $(INCDIR)/libiberty.h +linker.lo: linker.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/bfdlink.h genlink.h +srec.lo: srec.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h +binary.lo: binary.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \ + $(INCDIR)/hashtab.h +tekhex.lo: tekhex.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/libiberty.h +ihex.lo: ihex.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h +stabs.lo: stabs.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/safe-ctype.h stab-syms.lo: stab-syms.c libaout.h $(INCDIR)/bfdlink.h \ $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab.def merge.lo: merge.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ $(INCDIR)/libiberty.h dwarf2.lo: dwarf2.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/dwarf2.h -simple.lo: simple.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h -archive64.lo: archive64.c $(INCDIR)/filenames.h $(INCDIR)/aout/ar.h -cpu-a29k.lo: cpu-a29k.c $(INCDIR)/filenames.h -cpu-alpha.lo: cpu-alpha.c $(INCDIR)/filenames.h -cpu-arc.lo: cpu-arc.c $(INCDIR)/filenames.h -cpu-arm.lo: cpu-arm.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h -cpu-avr.lo: cpu-avr.c $(INCDIR)/filenames.h -cpu-cris.lo: cpu-cris.c $(INCDIR)/filenames.h -cpu-d10v.lo: cpu-d10v.c $(INCDIR)/filenames.h -cpu-d30v.lo: cpu-d30v.c $(INCDIR)/filenames.h -cpu-dlx.lo: cpu-dlx.c $(INCDIR)/filenames.h -cpu-fr30.lo: cpu-fr30.c $(INCDIR)/filenames.h -cpu-frv.lo: cpu-frv.c $(INCDIR)/filenames.h -cpu-h8300.lo: cpu-h8300.c $(INCDIR)/filenames.h -cpu-h8500.lo: cpu-h8500.c $(INCDIR)/filenames.h -cpu-hppa.lo: cpu-hppa.c $(INCDIR)/filenames.h -cpu-ia64.lo: cpu-ia64.c $(INCDIR)/filenames.h cpu-ia64-opc.c \ - $(srcdir)/../opcodes/ia64-opc.h $(INCDIR)/opcode/ia64.h -cpu-i370.lo: cpu-i370.c $(INCDIR)/filenames.h -cpu-i386.lo: cpu-i386.c $(INCDIR)/filenames.h -cpu-i860.lo: cpu-i860.c $(INCDIR)/filenames.h -cpu-i960.lo: cpu-i960.c $(INCDIR)/filenames.h -cpu-ip2k.lo: cpu-ip2k.c $(INCDIR)/filenames.h -cpu-iq2000.lo: cpu-iq2000.c $(INCDIR)/filenames.h -cpu-m32r.lo: cpu-m32r.c $(INCDIR)/filenames.h -cpu-m68hc11.lo: cpu-m68hc11.c $(INCDIR)/filenames.h -cpu-m68hc12.lo: cpu-m68hc12.c $(INCDIR)/filenames.h -cpu-m68k.lo: cpu-m68k.c $(INCDIR)/filenames.h -cpu-m88k.lo: cpu-m88k.c $(INCDIR)/filenames.h -cpu-m10200.lo: cpu-m10200.c $(INCDIR)/filenames.h -cpu-m10300.lo: cpu-m10300.c $(INCDIR)/filenames.h -cpu-mcore.lo: cpu-mcore.c $(INCDIR)/filenames.h -cpu-mips.lo: cpu-mips.c $(INCDIR)/filenames.h -cpu-mmix.lo: cpu-mmix.c $(INCDIR)/filenames.h -cpu-msp430.lo: cpu-msp430.c $(INCDIR)/filenames.h -cpu-or32.lo: cpu-or32.c $(INCDIR)/filenames.h -cpu-ns32k.lo: cpu-ns32k.c $(INCDIR)/filenames.h ns32k.h -cpu-openrisc.lo: cpu-openrisc.c $(INCDIR)/filenames.h -cpu-pdp11.lo: cpu-pdp11.c $(INCDIR)/filenames.h -cpu-pj.lo: cpu-pj.c $(INCDIR)/filenames.h -cpu-powerpc.lo: cpu-powerpc.c $(INCDIR)/filenames.h -cpu-rs6000.lo: cpu-rs6000.c $(INCDIR)/filenames.h -cpu-s390.lo: cpu-s390.c $(INCDIR)/filenames.h -cpu-sh.lo: cpu-sh.c $(INCDIR)/filenames.h -cpu-sparc.lo: cpu-sparc.c $(INCDIR)/filenames.h -cpu-tic30.lo: cpu-tic30.c $(INCDIR)/filenames.h -cpu-tic4x.lo: cpu-tic4x.c $(INCDIR)/filenames.h -cpu-tic54x.lo: cpu-tic54x.c $(INCDIR)/filenames.h -cpu-tic80.lo: cpu-tic80.c $(INCDIR)/filenames.h -cpu-v850.lo: cpu-v850.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h -cpu-vax.lo: cpu-vax.c $(INCDIR)/filenames.h -cpu-we32k.lo: cpu-we32k.c $(INCDIR)/filenames.h -cpu-w65.lo: cpu-w65.c $(INCDIR)/filenames.h -cpu-xstormy16.lo: cpu-xstormy16.c $(INCDIR)/filenames.h -cpu-xtensa.lo: cpu-xtensa.c $(INCDIR)/filenames.h -cpu-z8k.lo: cpu-z8k.c $(INCDIR)/filenames.h -aout-adobe.lo: aout-adobe.c $(INCDIR)/filenames.h $(INCDIR)/aout/adobe.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def libaout.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/elf/dwarf2.h +simple.lo: simple.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ $(INCDIR)/bfdlink.h +archive64.lo: archive64.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/aout/ar.h +cpu-alpha.lo: cpu-alpha.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-arc.lo: cpu-arc.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-arm.lo: cpu-arm.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/libiberty.h +cpu-avr.lo: cpu-avr.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-bfin.lo: cpu-bfin.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-cris.lo: cpu-cris.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-cr16c.lo: cpu-cr16c.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-crx.lo: cpu-crx.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-d10v.lo: cpu-d10v.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-d30v.lo: cpu-d30v.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-dlx.lo: cpu-dlx.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-fr30.lo: cpu-fr30.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-frv.lo: cpu-frv.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-h8300.lo: cpu-h8300.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-h8500.lo: cpu-h8500.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-hppa.lo: cpu-hppa.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-ia64.lo: cpu-ia64.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + cpu-ia64-opc.c $(srcdir)/../opcodes/ia64-opc.h $(INCDIR)/opcode/ia64.h +cpu-i370.lo: cpu-i370.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-i386.lo: cpu-i386.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-i860.lo: cpu-i860.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-i960.lo: cpu-i960.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-ip2k.lo: cpu-ip2k.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-iq2000.lo: cpu-iq2000.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-m32c.lo: cpu-m32c.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-m32r.lo: cpu-m32r.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-m68hc11.lo: cpu-m68hc11.c $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h +cpu-m68hc12.lo: cpu-m68hc12.c $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h +cpu-m68k.lo: cpu-m68k.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/opcode/m68k.h +cpu-m88k.lo: cpu-m88k.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-m10200.lo: cpu-m10200.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-m10300.lo: cpu-m10300.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-maxq.lo: cpu-maxq.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-mcore.lo: cpu-mcore.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-mips.lo: cpu-mips.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-mmix.lo: cpu-mmix.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-mt.lo: cpu-mt.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-msp430.lo: cpu-msp430.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-or32.lo: cpu-or32.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-ns32k.lo: cpu-ns32k.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + ns32k.h +cpu-openrisc.lo: cpu-openrisc.c $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h +cpu-pdp11.lo: cpu-pdp11.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-pj.lo: cpu-pj.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-powerpc.lo: cpu-powerpc.c $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h +cpu-rs6000.lo: cpu-rs6000.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-s390.lo: cpu-s390.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-sh.lo: cpu-sh.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(srcdir)/../opcodes/sh-opc.h +cpu-sparc.lo: cpu-sparc.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-tic30.lo: cpu-tic30.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-tic4x.lo: cpu-tic4x.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-tic54x.lo: cpu-tic54x.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-tic80.lo: cpu-tic80.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-v850.lo: cpu-v850.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/safe-ctype.h +cpu-vax.lo: cpu-vax.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-we32k.lo: cpu-we32k.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-w65.lo: cpu-w65.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-xstormy16.lo: cpu-xstormy16.c $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h +cpu-xtensa.lo: cpu-xtensa.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-xc16x.lo: cpu-xc16x.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-z80.lo: cpu-z80.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-z8k.lo: cpu-z8k.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +aout-adobe.lo: aout-adobe.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/aout/adobe.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + libaout.h $(INCDIR)/bfdlink.h aout-arm.lo: aout-arm.c $(INCDIR)/filenames.h libaout.h \ $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h aoutx.h \ - $(INCDIR)/safe-ctype.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ - $(INCDIR)/aout/ar.h aout-target.h + $(INCDIR)/safe-ctype.h $(INCDIR)/hashtab.h $(INCDIR)/aout/stab_gnu.h \ + $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h aout-target.h aout-cris.lo: aout-cris.c aout32.c aoutx.h $(INCDIR)/filenames.h \ $(INCDIR)/safe-ctype.h $(INCDIR)/bfdlink.h libaout.h \ - $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ - $(INCDIR)/aout/ar.h aout-target.h + $(INCDIR)/hashtab.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ + $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h aout-target.h aout-ns32k.lo: aout-ns32k.c $(INCDIR)/aout/aout64.h \ ns32k.h libaout.h $(INCDIR)/bfdlink.h aoutx.h $(INCDIR)/filenames.h \ - $(INCDIR)/safe-ctype.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ - $(INCDIR)/aout/ar.h + $(INCDIR)/safe-ctype.h $(INCDIR)/hashtab.h $(INCDIR)/aout/stab_gnu.h \ + $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h aout-sparcle.lo: aout-sparcle.c $(INCDIR)/bfdlink.h \ - libaout.h aoutf1.h $(INCDIR)/filenames.h $(INCDIR)/aout/sun4.h \ - $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ - $(INCDIR)/aout/ar.h aout-target.h + libaout.h aoutf1.h $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/aout/sun4.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ + $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h aout-target.h aout-tic30.lo: aout-tic30.c $(INCDIR)/filenames.h libaout.h \ $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h aoutx.h \ - $(INCDIR)/safe-ctype.h -aout0.lo: aout0.c aoutf1.h $(INCDIR)/filenames.h $(INCDIR)/aout/sun4.h \ - libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \ - aout-target.h + $(INCDIR)/safe-ctype.h $(INCDIR)/hashtab.h +aout0.lo: aout0.c aoutf1.h $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/aout/sun4.h libaout.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h aout-target.h aout32.lo: aout32.c aoutx.h $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \ - $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \ + $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/hashtab.h $(INCDIR)/aout/aout64.h \ $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h armnetbsd.lo: armnetbsd.c netbsd.h $(INCDIR)/filenames.h \ - libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h -bout.lo: bout.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - genlink.h $(INCDIR)/bout.h $(INCDIR)/aout/stab_gnu.h \ - $(INCDIR)/aout/stab.def libaout.h + $(INCDIR)/hashtab.h libaout.h $(INCDIR)/bfdlink.h aout-target.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h +bout.lo: bout.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/bfdlink.h genlink.h $(INCDIR)/bout.h $(INCDIR)/libiberty.h \ + $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def libaout.h cf-i386lynx.lo: cf-i386lynx.c $(INCDIR)/filenames.h \ - coff-i386.c $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h \ - $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \ - coffcode.h coffswap.h -cf-m68klynx.lo: cf-m68klynx.c coff-m68k.c $(INCDIR)/filenames.h \ - $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ + coff-i386.c $(INCDIR)/hashtab.h $(INCDIR)/coff/i386.h \ + $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h cf-sparclynx.lo: cf-sparclynx.c coff-sparc.c $(INCDIR)/filenames.h \ - $(INCDIR)/coff/sparc.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ - libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h -coff-a29k.lo: coff-a29k.c $(INCDIR)/filenames.h $(INCDIR)/coff/a29k.h \ - $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ - libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h + $(INCDIR)/hashtab.h $(INCDIR)/coff/sparc.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \ + coffcode.h coffswap.h coff-apollo.lo: coff-apollo.c $(INCDIR)/filenames.h \ - $(INCDIR)/coff/apollo.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ - libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h -coff-arm.lo: coff-arm.c $(INCDIR)/filenames.h $(INCDIR)/coff/arm.h \ - $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/hashtab.h $(INCDIR)/coff/apollo.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \ + coffcode.h coffswap.h +coff-arm.lo: coff-arm.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h coff-aux.lo: coff-aux.c $(INCDIR)/filenames.h $(INCDIR)/coff/aux-coff.h \ $(INCDIR)/coff/internal.h $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h \ - coff-m68k.c libcoff.h $(INCDIR)/bfdlink.h coffcode.h \ - coffswap.h -coff-h8300.lo: coff-h8300.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - genlink.h $(INCDIR)/coff/h8300.h $(INCDIR)/coff/external.h \ - $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/libiberty.h \ + coff-m68k.c $(INCDIR)/hashtab.h libcoff.h $(INCDIR)/bfdlink.h \ coffcode.h coffswap.h -coff-h8500.lo: coff-h8500.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/coff/h8500.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ - libcoff.h coffcode.h coffswap.h -coff-i386.lo: coff-i386.c $(INCDIR)/filenames.h $(INCDIR)/coff/i386.h \ +coff-h8300.lo: coff-h8300.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/bfdlink.h genlink.h $(INCDIR)/coff/h8300.h \ $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ + libcoff.h $(INCDIR)/libiberty.h coffcode.h coffswap.h +coff-h8500.lo: coff-h8500.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/coff/h8500.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h +coff-i386.lo: coff-i386.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h -coff-i860.lo: coff-i860.c $(INCDIR)/filenames.h $(INCDIR)/coff/i860.h \ - $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ +coff-i860.lo: coff-i860.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/coff/i860.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h coff-go32.lo: coff-go32.c coff-i386.c $(INCDIR)/filenames.h \ - $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ - libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h -coff-i960.lo: coff-i960.c $(INCDIR)/filenames.h $(INCDIR)/coff/i960.h \ + $(INCDIR)/hashtab.h $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h \ $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \ coffcode.h coffswap.h -coff-m68k.lo: coff-m68k.c $(INCDIR)/filenames.h $(INCDIR)/coff/m68k.h \ - $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ +coff-i960.lo: coff-i960.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/coff/i960.h $(INCDIR)/coff/internal.h libcoff.h \ + $(INCDIR)/bfdlink.h coffcode.h coffswap.h +coff-m68k.lo: coff-m68k.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h -coff-m88k.lo: coff-m88k.c $(INCDIR)/filenames.h $(INCDIR)/coff/m88k.h \ - $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ +coff-m88k.lo: coff-m88k.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/coff/m88k.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h +coff-maxq.lo: coff-maxq.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/coff/maxq.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ + libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h \ + coffcode.h coffswap.h coff-mips.lo: coff-mips.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \ - $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h $(INCDIR)/coff/external.h \ - libcoff.h libecoff.h coffswap.h ecoffswap.h -coff-or32.lo: coff-or32.c $(INCDIR)/filenames.h $(INCDIR)/coff/or32.h \ - $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \ - coffcode.h coffswap.h + $(INCDIR)/hashtab.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h \ + $(INCDIR)/coff/symconst.h $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h \ + $(INCDIR)/coff/external.h libcoff.h libecoff.h coffswap.h \ + ecoffswap.h +coff-or32.lo: coff-or32.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/coff/or32.h $(INCDIR)/coff/internal.h libcoff.h \ + $(INCDIR)/bfdlink.h coffcode.h coffswap.h coff-rs6000.lo: coff-rs6000.c $(INCDIR)/filenames.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h \ - $(INCDIR)/coff/rs6000.h libcoff.h libxcoff.h coffcode.h \ - coffswap.h + $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/xcoff.h $(INCDIR)/coff/rs6000.h libcoff.h \ + libxcoff.h coffcode.h coffswap.h coff-sh.lo: coff-sh.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/coff/sh.h $(INCDIR)/coff/external.h \ - $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h -coff-sparc.lo: coff-sparc.c $(INCDIR)/filenames.h $(INCDIR)/coff/sparc.h \ + $(INCDIR)/hashtab.h $(INCDIR)/bfdlink.h $(INCDIR)/coff/sh.h \ $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ + libcoff.h coffcode.h coffswap.h +coff-sparc.lo: coff-sparc.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/coff/sparc.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h coff-stgo32.lo: coff-stgo32.c coff-i386.c $(INCDIR)/filenames.h \ - $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/go32exe.h libcoff.h $(INCDIR)/bfdlink.h \ - coffcode.h coffswap.h go32stub.h + $(INCDIR)/hashtab.h $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/go32exe.h \ + libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h \ + go32stub.h coff-svm68k.lo: coff-svm68k.c coff-m68k.c $(INCDIR)/filenames.h \ - $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ - libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h -coff-tic30.lo: coff-tic30.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/coff/tic30.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ - libcoff.h coffcode.h coffswap.h -coff-tic4x.lo: coff-tic4x.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/coff/tic4x.h $(INCDIR)/coff/ti.h $(INCDIR)/coff/internal.h \ - libcoff.h coffcode.h coffswap.h -coff-tic54x.lo: coff-tic54x.c $(INCDIR)/filenames.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/coff/tic54x.h $(INCDIR)/coff/ti.h \ + $(INCDIR)/hashtab.h $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \ + coffcode.h coffswap.h +coff-tic30.lo: coff-tic30.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/coff/tic30.h $(INCDIR)/coff/external.h \ $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h +coff-tic4x.lo: coff-tic4x.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/coff/tic4x.h $(INCDIR)/coff/ti.h \ + $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h +coff-tic54x.lo: coff-tic54x.c $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h $(INCDIR)/bfdlink.h $(INCDIR)/coff/tic54x.h \ + $(INCDIR)/coff/ti.h $(INCDIR)/coff/internal.h libcoff.h \ + coffcode.h coffswap.h coff-tic80.lo: coff-tic80.c $(INCDIR)/bfdlink.h $(INCDIR)/filenames.h \ - $(INCDIR)/coff/tic80.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ - libcoff.h coffcode.h coffswap.h + $(INCDIR)/hashtab.h $(INCDIR)/coff/tic80.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h coff-u68k.lo: coff-u68k.c coff-m68k.c $(INCDIR)/filenames.h \ - $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/hashtab.h $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \ + coffcode.h coffswap.h +coff-we32k.lo: coff-we32k.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/coff/we32k.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h -coff-we32k.lo: coff-we32k.c $(INCDIR)/filenames.h $(INCDIR)/coff/we32k.h \ - $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ - libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h -coff-w65.lo: coff-w65.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/coff/w65.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ - libcoff.h coffcode.h coffswap.h -coff-z8k.lo: coff-z8k.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/coff/z8k.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ - libcoff.h coffcode.h coffswap.h +coff-w65.lo: coff-w65.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/coff/w65.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h +coff-z80.lo: coff-z80.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/coff/z80.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h +coff-z8k.lo: coff-z8k.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/coff/z8k.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h cofflink.lo: cofflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/safe-ctype.h + $(INCDIR)/hashtab.h $(INCDIR)/coff/internal.h libcoff.h \ + $(INCDIR)/safe-ctype.h dwarf1.lo: dwarf1.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/dwarf.h + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/elf/dwarf.h ecoff.lo: ecoff.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/aout/ar.h $(INCDIR)/aout/ranlib.h $(INCDIR)/aout/stab_gnu.h \ - $(INCDIR)/aout/stab.def libaout.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \ - $(INCDIR)/coff/ecoff.h libcoff.h libecoff.h + $(INCDIR)/hashtab.h $(INCDIR)/aout/ar.h $(INCDIR)/aout/ranlib.h \ + $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def libaout.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h \ + $(INCDIR)/coff/symconst.h $(INCDIR)/coff/ecoff.h libcoff.h \ + libecoff.h $(INCDIR)/libiberty.h ecofflink.lo: ecofflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/objalloc.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \ - $(INCDIR)/coff/ecoff.h libcoff.h libecoff.h + $(INCDIR)/hashtab.h $(INCDIR)/objalloc.h $(INCDIR)/aout/stab_gnu.h \ + $(INCDIR)/aout/stab.def $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h \ + $(INCDIR)/coff/symconst.h $(INCDIR)/coff/ecoff.h libcoff.h \ + libecoff.h efi-app-ia32.lo: efi-app-ia32.c $(INCDIR)/filenames.h \ - coff-i386.c $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ - $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h + coff-i386.c $(INCDIR)/hashtab.h $(INCDIR)/coff/i386.h \ + $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \ + peicode.h libpei.h elf.lo: elf.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/libiberty.h -elf32-am33lin.lo: elf32-am33lin.c elf-m10300.c $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/libiberty.h +elf32-am33lin.lo: elf32-am33lin.c $(INCDIR)/filenames.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/mn10300.h \ + $(INCDIR)/elf/reloc-macros.h elf-m10300.c $(INCDIR)/hashtab.h \ + elf32-target.h +elf32-arc.lo: elf32-arc.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/arc.h \ + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \ + elf32-target.h +elf32-arm.lo: elf32-arm.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ + elf-vxworks.h $(INCDIR)/elf/arm.h $(INCDIR)/elf/reloc-macros.h \ + elf32-target.h +elf32-avr.lo: elf32-avr.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/avr.h \ $(INCDIR)/elf/reloc-macros.h elf32-target.h -elf32-arc.lo: elf32-arc.c $(INCDIR)/filenames.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/elf/arc.h $(INCDIR)/elf/reloc-macros.h \ - $(INCDIR)/libiberty.h elf32-target.h -elfarm-oabi.lo: elfarm-oabi.c $(INCDIR)/elf/arm.h $(INCDIR)/elf/reloc-macros.h \ - $(INCDIR)/filenames.h elf-bfd.h $(INCDIR)/elf/common.h \ - $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ - elf32-arm.h elf32-target.h -elfarm-nabi.lo: elfarm-nabi.c $(INCDIR)/elf/arm.h $(INCDIR)/elf/reloc-macros.h \ - $(INCDIR)/filenames.h elf-bfd.h $(INCDIR)/elf/common.h \ - $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ - elf32-arm.h elf32-target.h -elf32-avr.lo: elf32-avr.c $(INCDIR)/filenames.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/elf/avr.h $(INCDIR)/elf/reloc-macros.h \ +elf32-bfin.lo: elf32-bfin.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/bfin.h \ + $(INCDIR)/elf/reloc-macros.h elf32-target.h +elf32-cr16c.lo: elf32-cr16c.c $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/cr16c.h \ + $(INCDIR)/elf/reloc-macros.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elf32-target.h +elf32-cris.lo: elf32-cris.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/cris.h \ + $(INCDIR)/elf/reloc-macros.h elf32-target.h +elf32-crx.lo: elf32-crx.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/crx.h \ + $(INCDIR)/elf/reloc-macros.h elf32-target.h +elf32-d10v.lo: elf32-d10v.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/d10v.h \ + $(INCDIR)/elf/reloc-macros.h elf32-target.h +elf32-d30v.lo: elf32-d30v.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/d30v.h \ + $(INCDIR)/elf/reloc-macros.h elf32-target.h +elf32-dlx.lo: elf32-dlx.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/dlx.h \ + $(INCDIR)/elf/reloc-macros.h elf32-target.h +elf32-fr30.lo: elf32-fr30.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/fr30.h \ + $(INCDIR)/elf/reloc-macros.h elf32-target.h +elf32-frv.lo: elf32-frv.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/frv.h \ + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/elf/dwarf2.h \ elf32-target.h -elf32-cris.lo: elf32-cris.c $(INCDIR)/filenames.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/elf/cris.h $(INCDIR)/elf/reloc-macros.h \ - elf32-target.h -elf32-d10v.lo: elf32-d10v.c $(INCDIR)/filenames.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/elf/d10v.h $(INCDIR)/elf/reloc-macros.h \ - elf32-target.h -elf32-d30v.lo: elf32-d30v.c $(INCDIR)/filenames.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/elf/d30v.h $(INCDIR)/elf/reloc-macros.h \ - elf32-target.h -elf32-dlx.lo: elf32-dlx.c $(INCDIR)/filenames.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/elf/dlx.h $(INCDIR)/elf/reloc-macros.h \ - elf32-target.h -elf32-fr30.lo: elf32-fr30.c $(INCDIR)/filenames.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/elf/fr30.h $(INCDIR)/elf/reloc-macros.h \ - elf32-target.h -elf32-frv.lo: elf32-frv.c $(INCDIR)/filenames.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/elf/frv.h $(INCDIR)/elf/reloc-macros.h \ - $(INCDIR)/hashtab.h elf32-target.h -elf32-gen.lo: elf32-gen.c $(INCDIR)/filenames.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h elf32-target.h +elf32-gen.lo: elf32-gen.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h elf32-target.h elf32-h8300.lo: elf32-h8300.c $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/elf/h8.h $(INCDIR)/elf/reloc-macros.h elf32-target.h +elf32-hppa.lo: elf32-hppa.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/h8.h \ - $(INCDIR)/elf/reloc-macros.h elf32-target.h -elf32-hppa.lo: elf32-hppa.c $(INCDIR)/filenames.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/elf/hppa.h $(INCDIR)/elf/reloc-macros.h \ - libhppa.h elf32-hppa.h elf-hppa.h elf32-target.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/hppa.h \ + $(INCDIR)/elf/reloc-macros.h libhppa.h elf32-hppa.h \ + elf-hppa.h elf32-target.h elf32-i370.lo: elf32-i370.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/elf/i370.h $(INCDIR)/elf/reloc-macros.h \ - elf32-target.h -elf32-i386.lo: elf32-i386.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/elf/i386.h $(INCDIR)/elf/reloc-macros.h \ - elf32-target.h -elf32-i860.lo: elf32-i860.c $(INCDIR)/filenames.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/elf/i860.h $(INCDIR)/elf/reloc-macros.h \ - elf32-target.h -elf32-i960.lo: elf32-i960.c $(INCDIR)/filenames.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/elf/i960.h $(INCDIR)/elf/reloc-macros.h \ - elf32-target.h -elf32-ip2k.lo: elf32-ip2k.c $(INCDIR)/filenames.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/elf/ip2k.h $(INCDIR)/elf/reloc-macros.h \ - elf32-target.h -elf32-iq2000.lo: elf32-iq2000.c $(INCDIR)/filenames.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/iq2000.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/i370.h \ $(INCDIR)/elf/reloc-macros.h elf32-target.h -elf32-m32r.lo: elf32-m32r.c $(INCDIR)/filenames.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/elf/m32r.h $(INCDIR)/elf/reloc-macros.h \ - elf32-target.h -elf32-m68k.lo: elf32-m68k.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ +elf32-i386.lo: elf32-i386.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elf-vxworks.h \ + $(INCDIR)/elf/i386.h $(INCDIR)/elf/reloc-macros.h elf32-target.h +elf32-i860.lo: elf32-i860.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/elf/m68k.h $(INCDIR)/elf/reloc-macros.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/i860.h \ + $(INCDIR)/elf/reloc-macros.h elf32-target.h +elf32-i960.lo: elf32-i960.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/i960.h \ + $(INCDIR)/elf/reloc-macros.h elf32-target.h +elf32-ip2k.lo: elf32-ip2k.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/ip2k.h \ + $(INCDIR)/elf/reloc-macros.h elf32-target.h +elf32-iq2000.lo: elf32-iq2000.c $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/elf/iq2000.h $(INCDIR)/elf/reloc-macros.h \ + elf32-target.h +elf32-m32c.lo: elf32-m32c.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/m32c.h \ + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \ + elf32-target.h +elf32-m32r.lo: elf32-m32r.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/m32r.h \ + $(INCDIR)/elf/reloc-macros.h elf32-target.h +elf32-m68k.lo: elf32-m68k.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/m68k.h \ + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/m68k.h \ elf32-target.h elf32-m68hc11.lo: elf32-m68hc11.c $(INCDIR)/filenames.h \ - $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elf32-m68hc1x.h \ $(INCDIR)/elf/m68hc11.h $(INCDIR)/elf/reloc-macros.h \ $(INCDIR)/opcode/m68hc11.h elf32-target.h elf32-m68hc12.lo: elf32-m68hc12.c $(INCDIR)/filenames.h \ - $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elf32-m68hc1x.h \ $(INCDIR)/elf/m68hc11.h $(INCDIR)/elf/reloc-macros.h \ $(INCDIR)/opcode/m68hc11.h elf32-target.h elf32-m68hc1x.lo: elf32-m68hc1x.c $(INCDIR)/filenames.h \ - $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elf32-m68hc1x.h \ $(INCDIR)/elf/m68hc11.h $(INCDIR)/elf/reloc-macros.h \ $(INCDIR)/opcode/m68hc11.h -elf32-m88k.lo: elf32-m88k.c $(INCDIR)/filenames.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h elf32-target.h -elf-m10200.lo: elf-m10200.c $(INCDIR)/filenames.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h elf32-target.h -elf-m10300.lo: elf-m10300.c $(INCDIR)/filenames.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/elf/mn10300.h $(INCDIR)/elf/reloc-macros.h \ - elf32-target.h +elf32-m88k.lo: elf32-m88k.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h elf32-target.h +elf-m10200.lo: elf-m10200.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h elf32-target.h +elf-m10300.lo: elf-m10300.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/mn10300.h \ + $(INCDIR)/elf/reloc-macros.h elf32-target.h elf32-mcore.lo: elf32-mcore.c $(INCDIR)/filenames.h \ - $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/mcore.h \ $(INCDIR)/elf/reloc-macros.h elf32-target.h -elfxx-mips.lo: elfxx-mips.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h elfxx-mips.h \ - $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/sym.h \ - $(INCDIR)/coff/symconst.h $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h \ - $(INCDIR)/coff/external.h $(INCDIR)/hashtab.h -elf32-mips.lo: elf32-mips.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - genlink.h elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h elfxx-mips.h $(INCDIR)/elf/mips.h \ - $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h \ - $(INCDIR)/coff/external.h ecoffswap.h elf32-target.h -elf32-msp430.lo: elf32-msp430.c $(INCDIR)/filenames.h \ +elfxx-mips.lo: elfxx-mips.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ $(INCDIR)/libiberty.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/elf/msp430.h $(INCDIR)/elf/reloc-macros.h \ - elf32-target.h -elf32-openrisc.lo: elf32-openrisc.c $(INCDIR)/filenames.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/openrisc.h \ - $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \ - elf32-target.h -elf32-or32.lo: elf32-or32.c $(INCDIR)/filenames.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/elf/or32.h $(INCDIR)/elf/reloc-macros.h \ - $(INCDIR)/libiberty.h elf32-target.h -elf32-pj.lo: elf32-pj.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/elf/pj.h $(INCDIR)/elf/reloc-macros.h \ - elf32-target.h -elf32-ppc.lo: elf32-ppc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h \ - elf32-ppc.h elf32-target.h -elf32-sh64.lo: elf32-sh64.c $(INCDIR)/filenames.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/../opcodes/sh64-opc.h \ - elf32-sh64.h elf32-sh.c $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \ - elf32-target.h -elf32-sh64-com.lo: elf32-sh64-com.c $(INCDIR)/filenames.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/sh.h \ - $(INCDIR)/elf/reloc-macros.h elf32-sh64.h $(srcdir)/../opcodes/sh64-opc.h -elf32-s390.lo: elf32-s390.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/elf/s390.h $(INCDIR)/elf/reloc-macros.h \ - elf32-target.h -elf32-sh.lo: elf32-sh.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \ - elf32-target.h -elf32-sparc.lo: elf32-sparc.c $(INCDIR)/filenames.h \ - $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ - $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h \ - $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/sparc.h \ - elf32-target.h -elf32-v850.lo: elf32-v850.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/elf/v850.h $(INCDIR)/elf/reloc-macros.h \ - $(INCDIR)/libiberty.h elf32-target.h -elf32-vax.lo: elf32-vax.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/elf/vax.h $(INCDIR)/elf/reloc-macros.h \ - elf32-target.h -elf32-xstormy16.lo: elf32-xstormy16.c $(INCDIR)/filenames.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/xstormy16.h \ - $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \ - elf32-target.h -elf32-xtensa.lo: elf32-xtensa.c $(INCDIR)/filenames.h \ - $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ - $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/xtensa.h \ - $(INCDIR)/elf/reloc-macros.h $(INCDIR)/xtensa-isa.h \ - $(INCDIR)/xtensa-config.h elf32-target.h -elf32.lo: elf32.c elfcode.h $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ - $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ - $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfcore.h \ - $(INCDIR)/safe-ctype.h -elflink.lo: elflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/libiberty.h -elf-strtab.lo: elf-strtab.c $(INCDIR)/filenames.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h -elf-eh-frame.lo: elf-eh-frame.c $(INCDIR)/filenames.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/dwarf2.h -epoc-pe-arm.lo: epoc-pe-arm.c pe-arm.c $(INCDIR)/filenames.h \ - coff-arm.c $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ - $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h -epoc-pei-arm.lo: epoc-pei-arm.c pei-arm.c $(INCDIR)/filenames.h \ - coff-arm.c $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ - $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h -hp300bsd.lo: hp300bsd.c $(INCDIR)/filenames.h libaout.h \ - $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h -hp300hpux.lo: hp300hpux.c $(INCDIR)/aout/hp300hpux.h \ - aoutx.h $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \ - $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \ - aout-target.h -som.lo: som.c $(INCDIR)/alloca-conf.h $(INCDIR)/filenames.h -i386aout.lo: i386aout.c $(INCDIR)/filenames.h $(INCDIR)/aout/aout64.h \ - libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/stab_gnu.h \ - $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h -i386bsd.lo: i386bsd.c $(INCDIR)/filenames.h libaout.h \ - $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h -i386dynix.lo: i386dynix.c $(INCDIR)/aout/dynix3.h aoutx.h \ - $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h $(INCDIR)/bfdlink.h \ - libaout.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ - $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h aout-target.h -i386freebsd.lo: i386freebsd.c freebsd.h $(INCDIR)/filenames.h \ - libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h -i386linux.lo: i386linux.c $(INCDIR)/filenames.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \ - libaout.h $(INCDIR)/bfdlink.h aout-target.h -i386lynx.lo: i386lynx.c $(INCDIR)/filenames.h libaout.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h aout-target.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h -i386msdos.lo: i386msdos.c $(INCDIR)/filenames.h libaout.h \ - $(INCDIR)/bfdlink.h -i386netbsd.lo: i386netbsd.c netbsd.h $(INCDIR)/filenames.h \ - libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h -i386mach3.lo: i386mach3.c $(INCDIR)/filenames.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \ - libaout.h $(INCDIR)/bfdlink.h aout-target.h -i386os9k.lo: i386os9k.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - libaout.h $(INCDIR)/os9k.h -ieee.lo: ieee.c $(INCDIR)/filenames.h $(INCDIR)/ieee.h \ - libieee.h $(INCDIR)/safe-ctype.h -m68k4knetbsd.lo: m68k4knetbsd.c netbsd.h $(INCDIR)/filenames.h \ - libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h -m68klinux.lo: m68klinux.c $(INCDIR)/filenames.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \ - libaout.h $(INCDIR)/bfdlink.h aout-target.h -m68klynx.lo: m68klynx.c $(INCDIR)/filenames.h libaout.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h aout-target.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h -m68knetbsd.lo: m68knetbsd.c netbsd.h $(INCDIR)/filenames.h \ - libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h -m88kmach3.lo: m88kmach3.c $(INCDIR)/filenames.h libaout.h \ - $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h -mach-o.lo: mach-o.c mach-o.h $(INCDIR)/filenames.h \ - $(INCDIR)/libiberty.h mach-o-target.c -mipsbsd.lo: mipsbsd.c $(INCDIR)/filenames.h libaout.h \ - $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h -newsos3.lo: newsos3.c $(INCDIR)/filenames.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \ - libaout.h $(INCDIR)/bfdlink.h aout-target.h -nlm.lo: nlm.c $(INCDIR)/filenames.h libnlm.h $(INCDIR)/nlm/common.h \ - $(INCDIR)/nlm/internal.h $(INCDIR)/nlm/external.h -nlm32-i386.lo: nlm32-i386.c $(INCDIR)/filenames.h $(INCDIR)/nlm/i386-ext.h \ - libnlm.h $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h \ - $(INCDIR)/nlm/external.h nlmswap.h nlm-target.h -nlm32-sparc.lo: nlm32-sparc.c $(INCDIR)/filenames.h \ - $(INCDIR)/nlm/sparc32-ext.h libnlm.h $(INCDIR)/nlm/common.h \ - $(INCDIR)/nlm/internal.h $(INCDIR)/nlm/external.h nlmswap.h \ - nlm-target.h -nlm32-ppc.lo: nlm32-ppc.c $(INCDIR)/filenames.h $(INCDIR)/nlm/ppc-ext.h \ - libnlm.h $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h \ - $(INCDIR)/nlm/external.h nlmswap.h nlm-target.h -nlm32.lo: nlm32.c nlmcode.h $(INCDIR)/filenames.h libnlm.h \ - $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h $(INCDIR)/nlm/external.h -ns32knetbsd.lo: ns32knetbsd.c netbsd.h $(INCDIR)/filenames.h \ - libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h -oasys.lo: oasys.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \ - $(INCDIR)/oasys.h liboasys.h -pc532-mach.lo: pc532-mach.c $(INCDIR)/filenames.h libaout.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h aout-target.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h -pdp11.lo: pdp11.c $(INCDIR)/filenames.h libaout.h $(INCDIR)/bfdlink.h \ - aout-target.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ - $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h $(INCDIR)/safe-ctype.h -pef.lo: pef.c $(INCDIR)/safe-ctype.h pef.h pef-traceback.h \ - $(INCDIR)/filenames.h $(INCDIR)/libiberty.h -pe-arm.lo: pe-arm.c $(INCDIR)/filenames.h coff-arm.c \ - $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \ - peicode.h libpei.h -pei-arm.lo: pei-arm.c $(INCDIR)/filenames.h coff-arm.c \ - $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \ - peicode.h libpei.h -pe-i386.lo: pe-i386.c $(INCDIR)/filenames.h coff-i386.c \ - $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \ - peicode.h libpei.h -pei-i386.lo: pei-i386.c $(INCDIR)/filenames.h coff-i386.c \ - $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \ - peicode.h libpei.h -pe-mcore.lo: pe-mcore.c $(INCDIR)/filenames.h coff-mcore.c \ - $(INCDIR)/coff/mcore.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \ - peicode.h libpei.h -pei-mcore.lo: pei-mcore.c $(INCDIR)/filenames.h coff-mcore.c \ - $(INCDIR)/coff/mcore.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \ - peicode.h libpei.h -pe-ppc.lo: pe-ppc.c $(INCDIR)/filenames.h coff-ppc.c \ - $(INCDIR)/coff/powerpc.h $(INCDIR)/coff/external.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ - $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h -pei-ppc.lo: pei-ppc.c $(INCDIR)/filenames.h coff-ppc.c \ - $(INCDIR)/coff/powerpc.h $(INCDIR)/coff/external.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ - $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h -pe-sh.lo: pe-sh.c $(INCDIR)/filenames.h coff-sh.c $(INCDIR)/libiberty.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/coff/sh.h $(INCDIR)/coff/external.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ - coffcode.h peicode.h libpei.h -pei-sh.lo: pei-sh.c $(INCDIR)/filenames.h coff-sh.c \ - $(INCDIR)/libiberty.h $(INCDIR)/bfdlink.h $(INCDIR)/coff/sh.h \ - $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/pe.h libcoff.h coffcode.h peicode.h \ - libpei.h -pe-mips.lo: pe-mips.c $(INCDIR)/filenames.h $(INCDIR)/coff/mipspe.h \ - $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \ - peicode.h libpei.h -pei-mips.lo: pei-mips.c $(INCDIR)/filenames.h pe-mips.c \ - $(INCDIR)/coff/mipspe.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \ - peicode.h libpei.h -ppcboot.lo: ppcboot.c $(INCDIR)/safe-ctype.h $(INCDIR)/filenames.h -reloc16.lo: reloc16.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - genlink.h $(INCDIR)/coff/internal.h libcoff.h -riscix.lo: riscix.c $(INCDIR)/filenames.h libaout.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h aout-target.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h -sparclinux.lo: sparclinux.c $(INCDIR)/filenames.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \ - libaout.h $(INCDIR)/bfdlink.h aout-target.h -sparclynx.lo: sparclynx.c $(INCDIR)/filenames.h $(INCDIR)/aout/sun4.h \ - libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \ - aout-target.h -sparcnetbsd.lo: sparcnetbsd.c netbsd.h $(INCDIR)/filenames.h \ - libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h -sunos.lo: sunos.c $(INCDIR)/bfdlink.h libaout.h aoutf1.h \ - $(INCDIR)/filenames.h $(INCDIR)/aout/sun4.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \ - aout-target.h -vaxnetbsd.lo: vaxnetbsd.c netbsd.h $(INCDIR)/filenames.h \ - libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h -vax1knetbsd.lo: vax1knetbsd.c netbsd.h $(INCDIR)/filenames.h \ - libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h -vaxbsd.lo: vaxbsd.c $(INCDIR)/filenames.h libaout.h \ - $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h -versados.lo: versados.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h -vms.lo: vms.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - vms.h -vms-gsd.lo: vms-gsd.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - vms.h -vms-hdr.lo: vms-hdr.c bfdver.h $(INCDIR)/filenames.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h vms.h -vms-misc.lo: vms-misc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - vms.h -vms-tir.lo: vms-tir.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - vms.h -xcofflink.lo: xcofflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h libcoff.h \ - libxcoff.h -xsym.lo: xsym.c xsym.h $(INCDIR)/filenames.h -xtensa-isa.lo: xtensa-isa.c $(INCDIR)/xtensa-isa.h \ - $(INCDIR)/xtensa-isa-internal.h -xtensa-modules.lo: xtensa-modules.c $(INCDIR)/xtensa-isa.h \ - $(INCDIR)/xtensa-isa-internal.h -aix5ppc-core.lo: aix5ppc-core.c -aout64.lo: aout64.c aoutx.h $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \ - $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h -coff-alpha.lo: coff-alpha.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \ - $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/alpha.h $(INCDIR)/aout/ar.h \ - libcoff.h libecoff.h coffswap.h ecoffswap.h -coff64-rs6000.lo: coff64-rs6000.c $(INCDIR)/filenames.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h \ - $(INCDIR)/coff/rs6k64.h libcoff.h libxcoff.h coffcode.h \ - coffswap.h -demo64.lo: demo64.c aoutf1.h $(INCDIR)/filenames.h \ - $(INCDIR)/aout/sun4.h libaout.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ - $(INCDIR)/aout/ar.h aout-target.h -efi-app-ia64.lo: efi-app-ia64.c $(INCDIR)/filenames.h \ - coff-ia64.c $(INCDIR)/coff/ia64.h $(INCDIR)/coff/external.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ - $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h -elf64-x86-64.lo: elf64-x86-64.c $(INCDIR)/filenames.h \ - $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ - $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/x86-64.h \ - $(INCDIR)/elf/reloc-macros.h elf64-target.h -elf64-alpha.lo: elf64-alpha.c $(INCDIR)/filenames.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/alpha.h \ - $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/internal.h \ + elfxx-mips.h $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h \ $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/ecoff.h \ - $(INCDIR)/coff/alpha.h $(INCDIR)/aout/ar.h libcoff.h \ - libecoff.h ecoffswap.h elf64-target.h -elf64-hppa.lo: elf64-hppa.c $(INCDIR)/alloca-conf.h \ - $(INCDIR)/filenames.h elf-bfd.h $(INCDIR)/elf/common.h \ - $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/elf/hppa.h $(INCDIR)/elf/reloc-macros.h libhppa.h \ - elf64-hppa.h elf-hppa.h elf64-target.h -elf64-gen.lo: elf64-gen.c $(INCDIR)/filenames.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h elf64-target.h -elfn32-mips.lo: elfn32-mips.c $(INCDIR)/filenames.h \ + $(INCDIR)/coff/mips.h $(INCDIR)/coff/external.h elf-vxworks.h +elf32-mips.lo: elf32-mips.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ $(INCDIR)/bfdlink.h genlink.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfxx-mips.h \ $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/sym.h \ $(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h $(INCDIR)/coff/external.h \ - ecoffswap.h elf32-target.h -elf64-mips.lo: elf64-mips.c $(INCDIR)/filenames.h $(INCDIR)/aout/ar.h \ - $(INCDIR)/bfdlink.h genlink.h elf-bfd.h $(INCDIR)/elf/common.h \ - $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfxx-mips.h \ - $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/sym.h \ - $(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/alpha.h ecoffswap.h \ - elf64-target.h -elf64-mmix.lo: elf64-mmix.c $(INCDIR)/filenames.h elf-bfd.h \ + ecoffswap.h elf32-target.h elf-vxworks.h +elf32-mt.lo: elf32-mt.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/mt.h \ + $(INCDIR)/elf/reloc-macros.h elf32-target.h +elf32-msp430.lo: elf32-msp430.c $(INCDIR)/filenames.h \ + $(INCDIR)/libiberty.h $(INCDIR)/hashtab.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/elf/mmix.h $(INCDIR)/elf/reloc-macros.h \ - $(INCDIR)/opcode/mmix.h elf64-target.h -elf64-ppc.lo: elf64-ppc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/elf/msp430.h $(INCDIR)/elf/reloc-macros.h \ + elf32-target.h +elf32-openrisc.lo: elf32-openrisc.c $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/elf/openrisc.h $(INCDIR)/elf/reloc-macros.h \ + $(INCDIR)/libiberty.h elf32-target.h +elf32-or32.lo: elf32-or32.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/elf/ppc64.h $(INCDIR)/elf/reloc-macros.h \ - elf64-ppc.h elf64-target.h -elf64-s390.lo: elf64-s390.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/elf/s390.h $(INCDIR)/elf/reloc-macros.h \ - elf64-target.h -elf64-sh64.lo: elf64-sh64.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/or32.h \ + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \ + elf32-target.h +elf32-pj.lo: elf32-pj.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/pj.h \ + $(INCDIR)/elf/reloc-macros.h elf32-target.h +elf32-ppc.lo: elf32-ppc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/ppc.h \ + $(INCDIR)/elf/reloc-macros.h elf32-ppc.h elf-vxworks.h \ + elf32-target.h +elf32-sh64.lo: elf32-sh64.c $(INCDIR)/filenames.h elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/../opcodes/sh64-opc.h \ + elf32-sh64.h elf32-sh.c $(INCDIR)/hashtab.h $(INCDIR)/elf/sh.h \ + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \ + $(srcdir)/../opcodes/sh-opc.h elf32-target.h +elf32-sh64-com.lo: elf32-sh64-com.c $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h elf32-sh64.h \ + $(srcdir)/../opcodes/sh64-opc.h +elf32-s390.lo: elf32-s390.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/s390.h \ + $(INCDIR)/elf/reloc-macros.h elf32-target.h +elf32-sh.lo: elf32-sh.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h \ + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \ + $(srcdir)/../opcodes/sh-opc.h elf32-target.h +elf32-sh-symbian.lo: elf32-sh-symbian.c elf32-sh.c \ + $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \ - elf64-target.h -elf64-sparc.lo: elf64-sparc.c $(INCDIR)/filenames.h \ + $(INCDIR)/libiberty.h $(srcdir)/../opcodes/sh-opc.h \ + elf32-target.h +elfxx-sparc.lo: elfxx-sparc.c $(INCDIR)/filenames.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h \ + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/sparc.h \ + elfxx-sparc.h elf-vxworks.h +elf32-sparc.lo: elf32-sparc.c $(INCDIR)/filenames.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h \ + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/sparc.h \ + elfxx-sparc.h elf32-target.h elf-vxworks.h +elf32-v850.lo: elf32-v850.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/v850.h \ + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \ + elf32-target.h +elf32-vax.lo: elf32-vax.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/vax.h \ + $(INCDIR)/elf/reloc-macros.h elf32-target.h +elf32-xstormy16.lo: elf32-xstormy16.c $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/elf/xstormy16.h $(INCDIR)/elf/reloc-macros.h \ + $(INCDIR)/libiberty.h elf32-target.h +elf32-xtensa.lo: elf32-xtensa.c $(INCDIR)/filenames.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/xtensa.h \ + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/xtensa-isa.h \ + $(INCDIR)/xtensa-config.h elf32-target.h +elf32-xc16x.lo: elf32-xc16x.c $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/elf/xc16x.h $(INCDIR)/elf/reloc-macros.h \ + $(INCDIR)/elf/dwarf2.h $(INCDIR)/libiberty.h elf32-target.h +elf32.lo: elf32.c elfcode.h $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfcore.h +elflink.lo: elflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/safe-ctype.h \ + $(INCDIR)/libiberty.h $(INCDIR)/objalloc.h +elf-strtab.lo: elf-strtab.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/sparc.h \ - $(INCDIR)/elf/sparc.h $(INCDIR)/elf/reloc-macros.h \ - elf64-target.h -elf64.lo: elf64.c elfcode.h $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ - $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ - $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfcore.h \ - $(INCDIR)/safe-ctype.h -mmo.lo: mmo.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ - $(INCDIR)/elf/mmix.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/mmix.h -nlm32-alpha.lo: nlm32-alpha.c $(INCDIR)/filenames.h \ - $(INCDIR)/nlm/alpha-ext.h libnlm.h $(INCDIR)/nlm/common.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h +elf-eh-frame.lo: elf-eh-frame.c $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/elf/dwarf2.h +elf-vxworks.lo: elf-vxworks.c $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ + elf-vxworks.h +epoc-pe-arm.lo: epoc-pe-arm.c pe-arm.c $(INCDIR)/filenames.h \ + coff-arm.c $(INCDIR)/hashtab.h $(INCDIR)/coff/arm.h \ + $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \ + peicode.h libpei.h +epoc-pei-arm.lo: epoc-pei-arm.c pei-arm.c $(INCDIR)/filenames.h \ + coff-arm.c $(INCDIR)/hashtab.h $(INCDIR)/coff/arm.h \ + $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \ + peicode.h libpei.h +hp300bsd.lo: hp300bsd.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ + $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h +hp300hpux.lo: hp300hpux.c $(INCDIR)/aout/hp300hpux.h \ + aoutx.h $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \ + $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/hashtab.h $(INCDIR)/aout/aout64.h \ + $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \ + aout-target.h +som.lo: som.c $(INCDIR)/alloca-conf.h $(INCDIR)/filenames.h +i386aout.lo: i386aout.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/aout/aout64.h libaout.h $(INCDIR)/bfdlink.h \ + aout-target.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h +i386bsd.lo: i386bsd.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ + $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h +i386dynix.lo: i386dynix.c $(INCDIR)/aout/dynix3.h aoutx.h \ + $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h $(INCDIR)/bfdlink.h \ + libaout.h $(INCDIR)/hashtab.h $(INCDIR)/aout/aout64.h \ + $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \ + aout-target.h +i386freebsd.lo: i386freebsd.c freebsd.h $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h libaout.h $(INCDIR)/bfdlink.h aout-target.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h +i386linux.lo: i386linux.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h libaout.h $(INCDIR)/bfdlink.h aout-target.h +i386lynx.lo: i386lynx.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \ + aout-target.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h +i386msdos.lo: i386msdos.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + libaout.h $(INCDIR)/bfdlink.h +i386netbsd.lo: i386netbsd.c netbsd.h $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h libaout.h $(INCDIR)/bfdlink.h aout-target.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h +i386mach3.lo: i386mach3.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h libaout.h $(INCDIR)/bfdlink.h aout-target.h +i386os9k.lo: i386os9k.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/os9k.h +ieee.lo: ieee.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/ieee.h libieee.h $(INCDIR)/safe-ctype.h +m68k4knetbsd.lo: m68k4knetbsd.c netbsd.h $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h libaout.h $(INCDIR)/bfdlink.h aout-target.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h +m68klinux.lo: m68klinux.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h libaout.h $(INCDIR)/bfdlink.h aout-target.h +m68knetbsd.lo: m68knetbsd.c netbsd.h $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h libaout.h $(INCDIR)/bfdlink.h aout-target.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h +m88kmach3.lo: m88kmach3.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ + $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h +m88kopenbsd.lo: m88kopenbsd.c netbsd.h $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h libaout.h $(INCDIR)/bfdlink.h aout-target.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h +mach-o.lo: mach-o.c mach-o.h $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h mach-o-target.c +mipsbsd.lo: mipsbsd.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ + $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h +newsos3.lo: newsos3.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h libaout.h $(INCDIR)/bfdlink.h aout-target.h +nlm.lo: nlm.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + libnlm.h $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h \ + $(INCDIR)/nlm/external.h +nlm32-i386.lo: nlm32-i386.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/nlm/i386-ext.h libnlm.h $(INCDIR)/nlm/common.h \ $(INCDIR)/nlm/internal.h $(INCDIR)/nlm/external.h nlmswap.h \ nlm-target.h -nlm64.lo: nlm64.c nlmcode.h $(INCDIR)/filenames.h libnlm.h \ - $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h $(INCDIR)/nlm/external.h -aix386-core.lo: aix386-core.c $(INCDIR)/filenames.h \ - $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ - libcoff.h $(INCDIR)/bfdlink.h -hpux-core.lo: hpux-core.c $(INCDIR)/filenames.h -irix-core.lo: irix-core.c $(INCDIR)/filenames.h -lynx-core.lo: lynx-core.c $(INCDIR)/filenames.h -osf-core.lo: osf-core.c $(INCDIR)/filenames.h -sco5-core.lo: sco5-core.c $(INCDIR)/filenames.h libaout.h \ - $(INCDIR)/bfdlink.h -trad-core.lo: trad-core.c $(INCDIR)/filenames.h libaout.h \ - $(INCDIR)/bfdlink.h -cisco-core.lo: cisco-core.c $(INCDIR)/filenames.h -elf32-ia64.lo: elf32-ia64.c $(INCDIR)/filenames.h elf-bfd.h \ +nlm32-sparc.lo: nlm32-sparc.c $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h $(INCDIR)/nlm/sparc32-ext.h libnlm.h \ + $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h $(INCDIR)/nlm/external.h \ + nlmswap.h nlm-target.h +nlm32-ppc.lo: nlm32-ppc.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/nlm/ppc-ext.h libnlm.h $(INCDIR)/nlm/common.h \ + $(INCDIR)/nlm/internal.h $(INCDIR)/nlm/external.h nlmswap.h \ + nlm-target.h +nlm32.lo: nlm32.c nlmcode.h $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + libnlm.h $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h \ + $(INCDIR)/nlm/external.h +ns32knetbsd.lo: ns32knetbsd.c netbsd.h $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h libaout.h $(INCDIR)/bfdlink.h aout-target.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h +oasys.lo: oasys.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \ + $(INCDIR)/hashtab.h $(INCDIR)/oasys.h liboasys.h +pc532-mach.lo: pc532-mach.c $(INCDIR)/filenames.h libaout.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h $(INCDIR)/aout/aout64.h \ + aout-target.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h +pdp11.lo: pdp11.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ + $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \ + $(INCDIR)/safe-ctype.h +pef.lo: pef.c $(INCDIR)/safe-ctype.h pef.h pef-traceback.h \ + $(INCDIR)/filenames.h $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h +pe-arm.lo: pe-arm.c $(INCDIR)/filenames.h coff-arm.c \ + $(INCDIR)/hashtab.h $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ + $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h +pei-arm.lo: pei-arm.c $(INCDIR)/filenames.h coff-arm.c \ + $(INCDIR)/hashtab.h $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ + $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h +pe-i386.lo: pe-i386.c $(INCDIR)/filenames.h coff-i386.c \ + $(INCDIR)/hashtab.h $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ + $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h +pei-i386.lo: pei-i386.c $(INCDIR)/filenames.h coff-i386.c \ + $(INCDIR)/hashtab.h $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ + $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h +pe-mcore.lo: pe-mcore.c $(INCDIR)/filenames.h coff-mcore.c \ + $(INCDIR)/hashtab.h $(INCDIR)/coff/mcore.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ + $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h +pei-mcore.lo: pei-mcore.c $(INCDIR)/filenames.h coff-mcore.c \ + $(INCDIR)/hashtab.h $(INCDIR)/coff/mcore.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ + $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h +pe-ppc.lo: pe-ppc.c $(INCDIR)/filenames.h coff-ppc.c \ + $(INCDIR)/hashtab.h $(INCDIR)/coff/powerpc.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ + $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h +pei-ppc.lo: pei-ppc.c $(INCDIR)/filenames.h coff-ppc.c \ + $(INCDIR)/hashtab.h $(INCDIR)/coff/powerpc.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ + $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h +pe-sh.lo: pe-sh.c $(INCDIR)/filenames.h coff-sh.c $(INCDIR)/libiberty.h \ + $(INCDIR)/hashtab.h $(INCDIR)/bfdlink.h $(INCDIR)/coff/sh.h \ + $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/pe.h libcoff.h coffcode.h peicode.h \ + libpei.h +pei-sh.lo: pei-sh.c $(INCDIR)/filenames.h coff-sh.c \ + $(INCDIR)/libiberty.h $(INCDIR)/hashtab.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/coff/sh.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/pe.h libcoff.h coffcode.h peicode.h \ + libpei.h +pe-mips.lo: pe-mips.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/coff/mipspe.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \ + peicode.h libpei.h +pei-mips.lo: pei-mips.c $(INCDIR)/filenames.h pe-mips.c \ + $(INCDIR)/hashtab.h $(INCDIR)/coff/mipspe.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ + $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h +ppcboot.lo: ppcboot.c $(INCDIR)/safe-ctype.h $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h +reloc16.lo: reloc16.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/bfdlink.h genlink.h $(INCDIR)/coff/internal.h \ + libcoff.h +riscix.lo: riscix.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \ + aout-target.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h +sparclinux.lo: sparclinux.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h libaout.h $(INCDIR)/bfdlink.h aout-target.h +sparclynx.lo: sparclynx.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/aout/sun4.h libaout.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h aout-target.h +sparcnetbsd.lo: sparcnetbsd.c netbsd.h $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h libaout.h $(INCDIR)/bfdlink.h aout-target.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h +sunos.lo: sunos.c $(INCDIR)/bfdlink.h libaout.h aoutf1.h \ + $(INCDIR)/filenames.h $(INCDIR)/hashtab.h $(INCDIR)/aout/sun4.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h aout-target.h +vaxnetbsd.lo: vaxnetbsd.c netbsd.h $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h libaout.h $(INCDIR)/bfdlink.h aout-target.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h +vax1knetbsd.lo: vax1knetbsd.c netbsd.h $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h libaout.h $(INCDIR)/bfdlink.h aout-target.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h +vaxbsd.lo: vaxbsd.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ + $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h +versados.lo: versados.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/libiberty.h +vms.lo: vms.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/hashtab.h vms.h +vms-gsd.lo: vms-gsd.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/hashtab.h vms.h +vms-hdr.lo: vms-hdr.c bfdver.h $(INCDIR)/filenames.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h $(INCDIR)/hashtab.h \ + vms.h +vms-misc.lo: vms-misc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/hashtab.h vms.h +vms-tir.lo: vms-tir.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/hashtab.h vms.h +xcofflink.lo: xcofflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/hashtab.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h \ + libcoff.h libxcoff.h +xsym.lo: xsym.c xsym.h $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +xtensa-isa.lo: xtensa-isa.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/xtensa-isa.h $(INCDIR)/xtensa-isa-internal.h +xtensa-modules.lo: xtensa-modules.c $(INCDIR)/xtensa-isa.h \ + $(INCDIR)/xtensa-isa-internal.h +aix5ppc-core.lo: aix5ppc-core.c +aout64.lo: aout64.c aoutx.h $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \ + $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/hashtab.h $(INCDIR)/aout/aout64.h \ + $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h +coff-alpha.lo: coff-alpha.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/hashtab.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h \ + $(INCDIR)/coff/symconst.h $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/alpha.h \ + $(INCDIR)/aout/ar.h libcoff.h libecoff.h coffswap.h \ + ecoffswap.h +coff64-rs6000.lo: coff64-rs6000.c $(INCDIR)/filenames.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/xcoff.h $(INCDIR)/coff/rs6k64.h libcoff.h \ + libxcoff.h coffcode.h coffswap.h +demo64.lo: demo64.c aoutf1.h $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h $(INCDIR)/aout/sun4.h libaout.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ + $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h aout-target.h +efi-app-ia64.lo: efi-app-ia64.c $(INCDIR)/filenames.h \ + coff-ia64.c $(INCDIR)/hashtab.h $(INCDIR)/coff/ia64.h \ + $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \ + peicode.h libpei.h +elf64-x86-64.lo: elf64-x86-64.c $(INCDIR)/filenames.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/x86-64.h \ + $(INCDIR)/elf/reloc-macros.h elf64-target.h +elf64-alpha.lo: elf64-alpha.c $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/elf/alpha.h $(INCDIR)/elf/reloc-macros.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \ + $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/alpha.h $(INCDIR)/aout/ar.h \ + libcoff.h libecoff.h ecoffswap.h elf64-target.h +elf64-hppa.lo: elf64-hppa.c $(INCDIR)/alloca-conf.h \ + $(INCDIR)/filenames.h $(INCDIR)/hashtab.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/opcode/ia64.h $(INCDIR)/elf/ia64.h \ - $(INCDIR)/elf/reloc-macros.h $(INCDIR)/objalloc.h $(INCDIR)/hashtab.h \ - elf32-target.h -elf64-ia64.lo: elf64-ia64.c $(INCDIR)/filenames.h elf-bfd.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/elf/hppa.h $(INCDIR)/elf/reloc-macros.h \ + libhppa.h elf64-hppa.h elf-hppa.h elf64-target.h +elf64-gen.lo: elf64-gen.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h elf64-target.h +elfn32-mips.lo: elfn32-mips.c $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h $(INCDIR)/bfdlink.h genlink.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/opcode/ia64.h $(INCDIR)/elf/ia64.h \ - $(INCDIR)/elf/reloc-macros.h $(INCDIR)/objalloc.h $(INCDIR)/hashtab.h \ + elfxx-mips.h $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h \ + $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h $(INCDIR)/coff/external.h \ + ecoffswap.h elf32-target.h +elf64-mips.lo: elf64-mips.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/aout/ar.h $(INCDIR)/bfdlink.h genlink.h elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + elfxx-mips.h $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h \ + $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/alpha.h ecoffswap.h \ elf64-target.h -peigen.lo: peigen.c $(INCDIR)/filenames.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h $(INCDIR)/coff/pe.h \ - libcoff.h $(INCDIR)/bfdlink.h libpei.h -pepigen.lo: pepigen.c $(INCDIR)/filenames.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/ia64.h $(INCDIR)/coff/external.h $(INCDIR)/coff/pe.h \ - libcoff.h $(INCDIR)/bfdlink.h libpei.h +elf64-mmix.lo: elf64-mmix.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/mmix.h \ + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/mmix.h \ + elf64-target.h +elf64-ppc.lo: elf64-ppc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/ppc64.h \ + $(INCDIR)/elf/reloc-macros.h elf64-ppc.h elf64-target.h +elf64-s390.lo: elf64-s390.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/s390.h \ + $(INCDIR)/elf/reloc-macros.h elf64-target.h +elf64-sh64.lo: elf64-sh64.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h \ + $(INCDIR)/elf/reloc-macros.h elf64-target.h +elf64-sparc.lo: elf64-sparc.c $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/elf/sparc.h $(INCDIR)/elf/reloc-macros.h \ + $(INCDIR)/opcode/sparc.h elfxx-sparc.h elf64-target.h +elf64.lo: elf64.c elfcode.h $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfcore.h +mmo.lo: mmo.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/libiberty.h $(INCDIR)/elf/mmix.h $(INCDIR)/elf/reloc-macros.h \ + $(INCDIR)/opcode/mmix.h +nlm32-alpha.lo: nlm32-alpha.c $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h $(INCDIR)/nlm/alpha-ext.h libnlm.h \ + $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h $(INCDIR)/nlm/external.h \ + nlmswap.h nlm-target.h +nlm64.lo: nlm64.c nlmcode.h $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + libnlm.h $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h \ + $(INCDIR)/nlm/external.h +aix386-core.lo: aix386-core.c $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h +hpux-core.lo: hpux-core.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +irix-core.lo: irix-core.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +lynx-core.lo: lynx-core.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +osf-core.lo: osf-core.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +sco5-core.lo: sco5-core.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + libaout.h $(INCDIR)/bfdlink.h +trad-core.lo: trad-core.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + libaout.h $(INCDIR)/bfdlink.h +cisco-core.lo: cisco-core.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +elf32-ia64.lo: elf32-ia64.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/ia64.h \ + $(INCDIR)/elf/ia64.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/objalloc.h \ + elf32-target.h +elf64-ia64.lo: elf64-ia64.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/ia64.h \ + $(INCDIR)/elf/ia64.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/objalloc.h \ + elf64-target.h +peigen.lo: peigen.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h libpei.h +pepigen.lo: pepigen.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/ia64.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h libpei.h # IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/contrib/binutils/bfd/Makefile.in b/contrib/binutils/bfd/Makefile.in index a6685f260d1..8ed90563561 100644 --- a/contrib/binutils/bfd/Makefile.in +++ b/contrib/binutils/bfd/Makefile.in @@ -1,6 +1,8 @@ -# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am +# Makefile.in generated by automake 1.9.5 from Makefile.am. +# @configure_input@ -# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -10,61 +12,108 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. +@SET_MAKE@ -SHELL = @SHELL@ + +SOURCES = $(libbfd_a_SOURCES) $(libbfd_la_SOURCES) srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -sbindir = @sbindir@ -libexecdir = @libexecdir@ -datadir = @datadir@ -sysconfdir = @sysconfdir@ -sharedstatedir = @sharedstatedir@ -localstatedir = @localstatedir@ -libdir = @libdir@ -infodir = @infodir@ -mandir = @mandir@ -includedir = @includedir@ -oldincludedir = /usr/include - -DESTDIR = - pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ - top_builddir = . - -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -transform = @program_transform_name@ - +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : -build_alias = @build_alias@ build_triplet = @build@ -host_alias = @host_alias@ host_triplet = @host@ -target_alias = @target_alias@ target_triplet = @target@ +DIST_COMMON = $(srcdir)/../config.guess $(srcdir)/../config.sub README \ + ChangeLog $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(top_srcdir)/configure $(am__configure_deps) \ + $(srcdir)/config.in $(srcdir)/../mkinstalldirs \ + $(srcdir)/bfd-in2.h $(top_srcdir)/po/Make-in \ + $(srcdir)/../ltmain.sh $(srcdir)/../config.guess \ + $(srcdir)/../config.sub +subdir = . +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/../config/acx.m4 $(top_srcdir)/../bfd/bfd.m4 \ + $(top_srcdir)/../bfd/warning.m4 $(top_srcdir)/../libtool.m4 \ + $(top_srcdir)/../gettext.m4 $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno configure.status.lineno +mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = bfd-in3.h po/Makefile.in +LIBRARIES = $(noinst_LIBRARIES) +ARFLAGS = cru +libbfd_a_AR = $(AR) $(ARFLAGS) +libbfd_a_LIBADD = +am_libbfd_a_OBJECTS = +libbfd_a_OBJECTS = $(am_libbfd_a_OBJECTS) +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(bfdlibdir)" +bfdlibLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(bfdlib_LTLIBRARIES) +am__objects_1 = archive.lo archures.lo bfd.lo bfdio.lo bfdwin.lo \ + cache.lo coffgen.lo corefile.lo format.lo init.lo libbfd.lo \ + opncls.lo reloc.lo section.lo syms.lo targets.lo hash.lo \ + linker.lo srec.lo binary.lo tekhex.lo ihex.lo stabs.lo \ + stab-syms.lo merge.lo dwarf2.lo simple.lo +am__objects_2 = archive64.lo +am_libbfd_la_OBJECTS = $(am__objects_1) $(am__objects_2) +libbfd_la_OBJECTS = $(am_libbfd_la_OBJECTS) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I. +depcomp = +am__depfiles_maybe = +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libbfd_a_SOURCES) $(libbfd_la_SOURCES) +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-exec-recursive install-info-recursive \ + install-recursive installcheck-recursive installdirs-recursive \ + pdf-recursive ps-recursive uninstall-info-recursive \ + uninstall-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ AR = @AR@ -AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ BFD_HOST_64BIT_LONG = @BFD_HOST_64BIT_LONG@ BFD_HOST_64_BIT = @BFD_HOST_64_BIT@ BFD_HOST_64_BIT_DEFINED = @BFD_HOST_64_BIT_DEFINED@ @@ -73,74 +122,144 @@ BFD_HOST_U_64_BIT = @BFD_HOST_U_64_BIT@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ +CCDEPMODE = @CCDEPMODE@ CC_FOR_BUILD = @CC_FOR_BUILD@ +CFLAGS = @CFLAGS@ COREFILE = @COREFILE@ COREFLAG = @COREFLAG@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ -DLLTOOL = @DLLTOOL@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ EXEEXT = @EXEEXT@ EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@ -GCJ = @GCJ@ -GCJFLAGS = @GCJFLAGS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GT_NO = @GT_NO@ GT_YES = @GT_YES@ HDEFINES = @HDEFINES@ INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_LIBBFD_FALSE = @INSTALL_LIBBFD_FALSE@ +INSTALL_LIBBFD_TRUE = @INSTALL_LIBBFD_TRUE@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLDEPS = @INTLDEPS@ INTLLIBS = @INTLLIBS@ INTLOBJS = @INTLOBJS@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MKINSTALLDIRS = @MKINSTALLDIRS@ MSGFMT = @MSGFMT@ -OBJDUMP = @OBJDUMP@ +NO_WERROR = @NO_WERROR@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ POFILES = @POFILES@ POSUB = @POSUB@ RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ STRIP = @STRIP@ TDEFINES = @TDEFINES@ USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ +WARN_CFLAGS = @WARN_CFLAGS@ WIN32LDFLAGS = @WIN32LDFLAGS@ WIN32LIBADD = @WIN32LIBADD@ +XGETTEXT = @XGETTEXT@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ all_backends = @all_backends@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ bfd_backends = @bfd_backends@ bfd_default_target_size = @bfd_default_target_size@ bfd_file_ptr = @bfd_file_ptr@ bfd_libs = @bfd_libs@ bfd_machines = @bfd_machines@ bfd_ufile_ptr = @bfd_ufile_ptr@ -bfd_version = @bfd_version@ -bfd_version_string = @bfd_version_string@ +bfdincludedir = @bfdincludedir@ +bfdlibdir = @bfdlibdir@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_noncanonical = @host_noncanonical@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ l = @l@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_noncanonical = @target_noncanonical@ +target_os = @target_os@ +target_vendor = @target_vendor@ tdefaults = @tdefaults@ wordsize = @wordsize@ +AUTOMAKE_OPTIONS = 1.9 cygnus -AUTOMAKE_OPTIONS = cygnus - +# Uncomment the following line when doing a release. +# RELEASE=y INCDIR = $(srcdir)/../include CSEARCH = -I. -I$(srcdir) -I$(INCDIR) MKDEP = gcc -MM - SUBDIRS = doc po - -docdir = doc -bfdlibdir = @bfdlibdir@ -bfdincludedir = @bfdincludedir@ - +bfddocdir = doc bfdlib_LTLIBRARIES = libbfd.la - -WARN_CFLAGS = @WARN_CFLAGS@ AM_CFLAGS = $(WARN_CFLAGS) # bfd.h goes here, for now @@ -161,9 +280,7 @@ BFD32_LIBS = \ srec.lo binary.lo tekhex.lo ihex.lo stabs.lo stab-syms.lo \ merge.lo dwarf2.lo simple.lo - BFD64_LIBS = archive64.lo - BFD32_LIBS_CFILES = \ archive.c archures.c bfd.c bfdio.c bfdwin.c \ cache.c coffgen.c corefile.c \ @@ -172,18 +289,19 @@ BFD32_LIBS_CFILES = \ srec.c binary.c tekhex.c ihex.c stabs.c stab-syms.c \ merge.c dwarf2.c simple.c - BFD64_LIBS_CFILES = archive64.c # This list is alphabetized to make it easier to keep in sync # with the decls and initializer in archures.c. ALL_MACHINES = \ - cpu-a29k.lo \ cpu-alpha.lo \ cpu-arc.lo \ cpu-arm.lo \ cpu-avr.lo \ + cpu-bfin.lo \ + cpu-cr16c.lo \ cpu-cris.lo \ + cpu-crx.lo \ cpu-d10v.lo \ cpu-d30v.lo \ cpu-dlx.lo \ @@ -199,6 +317,7 @@ ALL_MACHINES = \ cpu-i960.lo \ cpu-ip2k.lo \ cpu-iq2000.lo \ + cpu-m32c.lo \ cpu-m32r.lo \ cpu-m68hc11.lo \ cpu-m68hc12.lo \ @@ -206,9 +325,11 @@ ALL_MACHINES = \ cpu-m88k.lo \ cpu-m10200.lo \ cpu-m10300.lo \ + cpu-maxq.lo \ cpu-mcore.lo \ cpu-mips.lo \ cpu-mmix.lo \ + cpu-mt.lo \ cpu-msp430.lo \ cpu-or32.lo \ cpu-ns32k.lo \ @@ -230,16 +351,19 @@ ALL_MACHINES = \ cpu-w65.lo \ cpu-xstormy16.lo \ cpu-xtensa.lo \ + cpu-xc16x.lo \ + cpu-z80.lo \ cpu-z8k.lo - ALL_MACHINES_CFILES = \ - cpu-a29k.c \ cpu-alpha.c \ cpu-arc.c \ cpu-arm.c \ cpu-avr.c \ + cpu-bfin.c \ cpu-cris.c \ + cpu-cr16c.c \ + cpu-crx.c \ cpu-d10v.c \ cpu-d30v.c \ cpu-dlx.c \ @@ -255,6 +379,7 @@ ALL_MACHINES_CFILES = \ cpu-i960.c \ cpu-ip2k.c \ cpu-iq2000.c \ + cpu-m32c.c \ cpu-m32r.c \ cpu-m68hc11.c \ cpu-m68hc12.c \ @@ -262,9 +387,11 @@ ALL_MACHINES_CFILES = \ cpu-m88k.c \ cpu-m10200.c \ cpu-m10300.c \ + cpu-maxq.c \ cpu-mcore.c \ cpu-mips.c \ cpu-mmix.c \ + cpu-mt.c \ cpu-msp430.c \ cpu-or32.c \ cpu-ns32k.c \ @@ -286,6 +413,8 @@ ALL_MACHINES_CFILES = \ cpu-w65.c \ cpu-xstormy16.c \ cpu-xtensa.c \ + cpu-xc16x.c \ + cpu-z80.c \ cpu-z8k.c @@ -303,9 +432,7 @@ BFD32_BACKENDS = \ armnetbsd.lo \ bout.lo \ cf-i386lynx.lo \ - cf-m68klynx.lo \ cf-sparclynx.lo \ - coff-a29k.lo \ coff-apollo.lo \ coff-arm.lo \ coff-aux.lo \ @@ -317,6 +444,7 @@ BFD32_BACKENDS = \ coff-i960.lo \ coff-m68k.lo \ coff-m88k.lo \ + coff-maxq.lo \ coff-mips.lo \ coff-or32.lo \ coff-rs6000.lo \ @@ -331,6 +459,7 @@ BFD32_BACKENDS = \ coff-u68k.lo \ coff-we32k.lo \ coff-w65.lo \ + coff-z80.lo \ coff-z8k.lo \ cofflink.lo \ dwarf1.lo \ @@ -340,10 +469,12 @@ BFD32_BACKENDS = \ elf.lo \ elf32-am33lin.lo \ elf32-arc.lo \ - elfarm-oabi.lo \ - elfarm-nabi.lo \ + elf32-arm.lo \ elf32-avr.lo \ + elf32-bfin.lo \ + elf32-cr16c.lo \ elf32-cris.lo \ + elf32-crx.lo \ elf32-d10v.lo \ elf32-d30v.lo \ elf32-dlx.lo \ @@ -356,9 +487,9 @@ BFD32_BACKENDS = \ elf32-i386.lo \ elf32-i860.lo \ elf32-i960.lo \ - elf32-ia64.lo \ elf32-ip2k.lo \ elf32-iq2000.lo \ + elf32-m32c.lo \ elf32-m32r.lo \ elf32-m68hc11.lo \ elf32-m68hc12.lo \ @@ -370,6 +501,7 @@ BFD32_BACKENDS = \ elf32-mcore.lo \ elfxx-mips.lo \ elf32-mips.lo \ + elf32-mt.lo \ elf32-msp430.lo \ elf32-openrisc.lo \ elf32-or32.lo \ @@ -377,17 +509,21 @@ BFD32_BACKENDS = \ elf32-ppc.lo \ elf32-s390.lo \ elf32-sh.lo \ + elf32-sh-symbian.lo \ elf32-sh64.lo \ elf32-sh64-com.lo \ + elfxx-sparc.lo \ elf32-sparc.lo \ elf32-v850.lo \ elf32-vax.lo \ elf32-xstormy16.lo \ elf32-xtensa.lo \ + elf32-xc16x.lo \ elf32.lo \ elflink.lo \ elf-strtab.lo \ elf-eh-frame.lo \ + elf-vxworks.lo \ epoc-pe-arm.lo \ epoc-pei-arm.lo \ hp300bsd.lo \ @@ -406,9 +542,9 @@ BFD32_BACKENDS = \ ieee.lo \ m68k4knetbsd.lo \ m68klinux.lo \ - m68klynx.lo \ m68knetbsd.lo \ m88kmach3.lo \ + m88kopenbsd.lo \ mach-o.lo \ mipsbsd.lo \ newsos3.lo \ @@ -456,7 +592,6 @@ BFD32_BACKENDS = \ xtensa-isa.lo \ xtensa-modules.lo - BFD32_BACKENDS_CFILES = \ aout-adobe.c \ aout-arm.c \ @@ -469,9 +604,7 @@ BFD32_BACKENDS_CFILES = \ armnetbsd.c \ bout.c \ cf-i386lynx.c \ - cf-m68klynx.c \ cf-sparclynx.c \ - coff-a29k.c \ coff-apollo.c \ coff-arm.c \ coff-aux.c \ @@ -483,6 +616,7 @@ BFD32_BACKENDS_CFILES = \ coff-i960.c \ coff-m68k.c \ coff-m88k.c \ + coff-maxq.c \ coff-mips.c \ coff-or32.c \ coff-rs6000.c \ @@ -497,6 +631,7 @@ BFD32_BACKENDS_CFILES = \ coff-u68k.c \ coff-we32k.c \ coff-w65.c \ + coff-z80.c \ coff-z8k.c \ cofflink.c \ dwarf1.c \ @@ -506,10 +641,12 @@ BFD32_BACKENDS_CFILES = \ elf.c \ elf32-am33lin.c \ elf32-arc.c \ - elfarm-oabi.c \ - elfarm-nabi.c \ + elf32-arm.c \ elf32-avr.c \ + elf32-bfin.c \ + elf32-cr16c.c \ elf32-cris.c \ + elf32-crx.c \ elf32-d10v.c \ elf32-d30v.c \ elf32-dlx.c \ @@ -524,6 +661,7 @@ BFD32_BACKENDS_CFILES = \ elf32-i960.c \ elf32-ip2k.c \ elf32-iq2000.c \ + elf32-m32c.c \ elf32-m32r.c \ elf32-m68k.c \ elf32-m68hc11.c \ @@ -535,6 +673,7 @@ BFD32_BACKENDS_CFILES = \ elf32-mcore.c \ elfxx-mips.c \ elf32-mips.c \ + elf32-mt.c \ elf32-msp430.c \ elf32-openrisc.c \ elf32-or32.c \ @@ -544,15 +683,19 @@ BFD32_BACKENDS_CFILES = \ elf32-sh64-com.c \ elf32-s390.c \ elf32-sh.c \ + elf32-sh-symbian.c \ + elfxx-sparc.c \ elf32-sparc.c \ elf32-v850.c \ elf32-vax.c \ elf32-xstormy16.c \ elf32-xtensa.c \ + elf32-xc16x.c \ elf32.c \ elflink.c \ elf-strtab.c \ elf-eh-frame.c \ + elf-vxworks.c \ epoc-pe-arm.c \ epoc-pei-arm.c \ hp300bsd.c \ @@ -571,9 +714,9 @@ BFD32_BACKENDS_CFILES = \ ieee.c \ m68k4knetbsd.c \ m68klinux.c \ - m68klynx.c \ m68knetbsd.c \ m88kmach3.c \ + m88kopenbsd.c \ mach-o.c \ mipsbsd.c \ newsos3.c \ @@ -624,6 +767,8 @@ BFD32_BACKENDS_CFILES = \ # The .o files needed by all of the 64 bit vectors that are configured into # target_vector in targets.c if configured with --enable-targets=all # and --enable-64-bit-bfd. +# elf32-ia64.c requires a 64-bit bfd_vma, and hence can not be put in +# BFD32_BACKENDS. BFD64_BACKENDS = \ aix5ppc-core.lo \ aout64.lo \ @@ -634,6 +779,7 @@ BFD64_BACKENDS = \ elf64-x86-64.lo \ elf64-alpha.lo \ elf64-hppa.lo \ + elf32-ia64.lo \ elf64-ia64.lo \ elf64-gen.lo \ elfn32-mips.lo \ @@ -649,7 +795,6 @@ BFD64_BACKENDS = \ nlm64.lo \ pepigen.lo - BFD64_BACKENDS_CFILES = \ aix5ppc-core.c \ aout64.c \ @@ -673,7 +818,6 @@ BFD64_BACKENDS_CFILES = \ nlm32-alpha.c \ nlm64.c - OPTIONAL_BACKENDS = \ aix386-core.lo \ hpux-core.lo \ @@ -684,7 +828,6 @@ OPTIONAL_BACKENDS = \ trad-core.lo \ cisco-core.lo - OPTIONAL_BACKENDS_CFILES = \ aix386-core.c \ hpux-core.c \ @@ -696,6 +839,15 @@ OPTIONAL_BACKENDS_CFILES = \ cisco-core.c +# We want to rerun configure if configure.in, config.bfd or +# configure.host change. configure.in is needed since the version +# number in Makefile comes from configure.in. +CONFIG_STATUS_DEPENDENCIES = \ + $(srcdir)/configure.in \ + $(srcdir)/config.bfd \ + $(srcdir)/configure.host + + # These are defined by configure.in: WORDSIZE = @wordsize@ ALL_BACKENDS = @all_backends@ @@ -703,8 +855,7 @@ BFD_BACKENDS = @bfd_backends@ BFD_LIBS = @bfd_libs@ BFD_MACHINES = @bfd_machines@ TDEFAULTS = @tdefaults@ - -INCLUDES = -D_GNU_SOURCE @HDEFINES@ @COREFLAG@ @TDEFINES@ $(CSEARCH) $(CSWITCHES) -I$(srcdir)/../intl -I../intl +INCLUDES = @HDEFINES@ @COREFLAG@ @TDEFINES@ $(CSEARCH) $(CSWITCHES) -I$(srcdir)/../intl -I../intl # C source files that correspond to .o's. SOURCE_CFILES = \ @@ -715,16 +866,13 @@ SOURCE_CFILES = \ $(BFD64_BACKENDS_CFILES) \ $(OPTIONAL_BACKENDS_CFILES) - BUILD_CFILES = \ elf32-ia64.c elf64-ia64.c peigen.c pepigen.c - CFILES = $(SOURCE_CFILES) $(BUILD_CFILES) - SOURCE_HFILES = \ aout-target.h aoutf1.h aoutx.h coffcode.h coffswap.h ecoffswap.h \ - elf-bfd.h elf-hppa.h elf32-arm.h elf32-hppa.h \ + elf-bfd.h elf-hppa.h elf32-hppa.h \ elf64-hppa.h elfcode.h elfcore.h \ freebsd.h genlink.h go32stub.h \ libaout.h libbfd.h libcoff.h libecoff.h libhppa.h libieee.h \ @@ -733,13 +881,10 @@ SOURCE_HFILES = \ pef.h pef-traceback.h peicode.h som.h version.h \ vms.h xcoff-target.h xsym.h - BUILD_HFILES = \ bfdver.h elf32-target.h elf64-target.h targmatch.h - HFILES = $(SOURCE_HFILES) $(BUILD_HFILES) - SRC_POTFILES = $(SOURCE_CFILES) $(SOURCE_HFILES) BLD_POTFILES = $(BUILD_CFILES) $(BUILD_HFILES) @@ -748,7 +893,6 @@ BLD_POTFILES = $(BUILD_CFILES) $(BUILD_HFILES) # BFD_MACHINES Architecture-specific routines the configured targets need. # COREFILE Core file routines for a native configuration OFILES = $(BFD_BACKENDS) $(BFD_MACHINES) @COREFILE@ - libbfd_la_SOURCES = $(BFD32_LIBS_CFILES) $(BFD64_LIBS_CFILES) libbfd_la_DEPENDENCIES = $(OFILES) ofiles libbfd_la_LIBADD = `cat ofiles` @WIN32LIBADD@ @@ -758,13 +902,10 @@ libbfd_la_LDFLAGS = -release $(VERSION) @WIN32LDFLAGS@ # directory so that we don't have to convert all the programs that use # libbfd.a simultaneously. This is a hack which should be removed if # everything else starts using libtool. FIXME. - noinst_LIBRARIES = libbfd.a libbfd_a_SOURCES = - BFD_H_DEPS = $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h LOCAL_H_DEPS = libbfd.h sysdep.h config.h - BFD_H_FILES = bfd-in.h init.c opncls.c libbfd.c section.c archures.c \ reloc.c syms.c bfd.c bfdio.c bfdwin.c \ archive.c corefile.c targets.c format.c @@ -774,140 +915,99 @@ LIBBFD_H_FILES = libbfd-in.h init.c libbfd.c bfdio.c bfdwin.c \ cache.c reloc.c archures.c elf.c LIBCOFF_H_FILES = libcoff-in.h coffcode.h - MOSTLYCLEANFILES = ofiles stamp-ofiles - CLEANFILES = bfd.h dep.sed stmp-bfd-h DEP DEPA DEP1 DEP2 libbfd.a stamp-lib \ stmp-bin2-h stmp-lbfd-h stmp-lcoff-h - DISTCLEANFILES = $(BUILD_CFILES) $(BUILD_HFILES) -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs -CONFIG_HEADER = config.h -CONFIG_CLEAN_FILES = bfd-in3.h bfdver.h -LIBRARIES = $(noinst_LIBRARIES) +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive - -DEFS = @DEFS@ -I. -I$(srcdir) -I. -CPPFLAGS = @CPPFLAGS@ -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ -libbfd_a_LIBADD = -libbfd_a_OBJECTS = -LTLIBRARIES = $(bfdlib_LTLIBRARIES) - -libbfd_la_OBJECTS = archive.lo archures.lo bfd.lo bfdio.lo bfdwin.lo \ -cache.lo coffgen.lo corefile.lo format.lo init.lo libbfd.lo opncls.lo \ -reloc.lo section.lo syms.lo targets.lo hash.lo linker.lo srec.lo \ -binary.lo tekhex.lo ihex.lo stabs.lo stab-syms.lo merge.lo dwarf2.lo \ -simple.lo archive64.lo -CFLAGS = @CFLAGS@ -COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ -DIST_COMMON = README ./stamp-h.in COPYING ChangeLog Makefile.am \ -Makefile.in TODO acinclude.m4 aclocal.m4 bfd-in2.h config.in configure \ -configure.in version.h - - -DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) - -TAR = tar -GZIP_ENV = --best -SOURCES = $(libbfd_a_SOURCES) $(libbfd_la_SOURCES) -OBJECTS = $(libbfd_a_OBJECTS) $(libbfd_la_OBJECTS) - -all: all-redirect .SUFFIXES: -.SUFFIXES: .S .c .lo .o .obj .s -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --cygnus Makefile +.SUFFIXES: .c .lo .o .obj +am--refresh: + @: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \ + cd $(srcdir) && $(AUTOMAKE) --foreign \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) \ - && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in acinclude.m4 - cd $(srcdir) && $(ACLOCAL) -$(srcdir)/configure: @MAINTAINER_MODE_TRUE@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) -config.h: stamp-h +config.h: stamp-h1 @if test ! -f $@; then \ - rm -f stamp-h; \ - $(MAKE) stamp-h; \ + rm -f stamp-h1; \ + $(MAKE) stamp-h1; \ else :; fi -stamp-h: $(srcdir)/config.in $(top_builddir)/config.status - cd $(top_builddir) \ - && CONFIG_FILES= CONFIG_HEADERS=config.h:config.in \ - $(SHELL) ./config.status - @echo timestamp > stamp-h 2> /dev/null -$(srcdir)/config.in: @MAINTAINER_MODE_TRUE@$(srcdir)/stamp-h.in - @if test ! -f $@; then \ - rm -f $(srcdir)/stamp-h.in; \ - $(MAKE) $(srcdir)/stamp-h.in; \ - else :; fi -$(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) + +stamp-h1: $(srcdir)/config.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status config.h +$(srcdir)/config.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_srcdir) && $(AUTOHEADER) - @echo timestamp > $(srcdir)/stamp-h.in 2> /dev/null - -mostlyclean-hdr: - -clean-hdr: + rm -f stamp-h1 + touch $@ distclean-hdr: - -rm -f config.h - -maintainer-clean-hdr: -bfd-in3.h: $(top_builddir)/config.status bfd-in2.h - cd $(top_builddir) && CONFIG_FILES=$@:bfd-in2.h CONFIG_HEADERS= $(SHELL) ./config.status -bfdver.h: $(top_builddir)/config.status version.h - cd $(top_builddir) && CONFIG_FILES=$@:version.h CONFIG_HEADERS= $(SHELL) ./config.status - -mostlyclean-noinstLIBRARIES: + -rm -f config.h stamp-h1 +bfd-in3.h: $(top_builddir)/config.status $(srcdir)/bfd-in2.h + cd $(top_builddir) && $(SHELL) ./config.status $@ +po/Makefile.in: $(top_builddir)/config.status $(top_srcdir)/po/Make-in + cd $(top_builddir) && $(SHELL) ./config.status $@ clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) -distclean-noinstLIBRARIES: - -maintainer-clean-noinstLIBRARIES: - -.c.o: - $(COMPILE) -c $< - -# FIXME: We should only use cygpath when building on Windows, -# and only if it is available. -.c.obj: - $(COMPILE) -c `cygpath -w $<` - -.s.o: - $(COMPILE) -c $< - -.S.o: - $(COMPILE) -c $< +clean-bfdlibLTLIBRARIES: + -test -z "$(bfdlib_LTLIBRARIES)" || rm -f $(bfdlib_LTLIBRARIES) + @list='$(bfdlib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libbfd.la: $(libbfd_la_OBJECTS) $(libbfd_la_DEPENDENCIES) + $(LINK) -rpath $(bfdlibdir) $(libbfd_la_LDFLAGS) $(libbfd_la_OBJECTS) $(libbfd_la_LIBADD) $(LIBS) mostlyclean-compile: - -rm -f *.o core *.core -rm -f *.$(OBJEXT) -clean-compile: - distclean-compile: -rm -f *.tab.c -maintainer-clean-compile: +.c.o: + $(COMPILE) -c $< + +.c.obj: + $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: - $(LIBTOOL) --mode=compile $(COMPILE) -c $< - -.s.lo: - $(LIBTOOL) --mode=compile $(COMPILE) -c $< - -.S.lo: - $(LIBTOOL) --mode=compile $(COMPILE) -c $< + $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo @@ -916,20 +1016,8 @@ clean-libtool: -rm -rf .libs _libs distclean-libtool: - -maintainer-clean-libtool: - -mostlyclean-bfdlibLTLIBRARIES: - -clean-bfdlibLTLIBRARIES: - -test -z "$(bfdlib_LTLIBRARIES)" || rm -f $(bfdlib_LTLIBRARIES) - -distclean-bfdlibLTLIBRARIES: - -maintainer-clean-bfdlibLTLIBRARIES: - -libbfd.la: $(libbfd_la_OBJECTS) $(libbfd_la_DEPENDENCIES) - $(LINK) -rpath $(bfdlibdir) $(libbfd_la_LDFLAGS) $(libbfd_la_OBJECTS) $(libbfd_la_LIBADD) $(LIBS) + -rm -f libtool +uninstall-info-am: # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. @@ -937,13 +1025,14 @@ libbfd.la: $(libbfd_la_OBJECTS) $(libbfd_la_DEPENDENCIES) # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. - -@SET_MAKE@ - -all-recursive install-data-recursive install-exec-recursive \ -installdirs-recursive install-recursive uninstall-recursive install-info-recursive \ -check-recursive installcheck-recursive info-recursive dvi-recursive: - @set fnord $(MAKEFLAGS); amf=$$2; \ +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ @@ -955,7 +1044,7 @@ check-recursive installcheck-recursive info-recursive dvi-recursive: local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ @@ -963,13 +1052,24 @@ check-recursive installcheck-recursive info-recursive dvi-recursive: mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: - @set fnord $(MAKEFLAGS); amf=$$2; \ - dot_seen=no; \ - rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ - rev="$$subdir $$rev"; \ - test "$$subdir" != "." || dot_seen=yes; \ + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ done; \ - test "$$dot_seen" = "no" && rev=". $$rev"; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ @@ -979,138 +1079,99 @@ maintainer-clean-recursive: local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique tags: TAGS -ID: $(HEADERS) $(SOURCES) $(LISP) - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - here=`pwd` && cd $(srcdir) \ - && mkid -f$$here/ID $$unique $(LISP) - -TAGS: tags-recursive $(HEADERS) $(SOURCES) config.in $(TAGS_DEPENDENCIES) $(LISP) +TAGS: tags-recursive $(HEADERS) $(SOURCES) config.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ - fi; \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ done; \ - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ + list='$(SOURCES) $(HEADERS) config.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)config.in$$unique$(LISP)$$tags" \ - || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.in $$unique $(LISP) -o $$here/TAGS) + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) config.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique -mostlyclean-tags: - -clean-tags: +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here distclean-tags: - -rm -f TAGS ID - -maintainer-clean-tags: - -distdir = $(PACKAGE)-$(VERSION) -top_distdir = $(distdir) - -# This target untars the dist file and tries a VPATH configuration. Then -# it guarantees that the distribution is self-contained by making another -# tarfile. -distcheck: dist - -rm -rf $(distdir) - GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz - mkdir $(distdir)/=build - mkdir $(distdir)/=inst - dc_install_base=`cd $(distdir)/=inst && pwd`; \ - cd $(distdir)/=build \ - && ../configure --srcdir=.. --prefix=$$dc_install_base \ - && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) dvi \ - && $(MAKE) $(AM_MAKEFLAGS) check \ - && $(MAKE) $(AM_MAKEFLAGS) install \ - && $(MAKE) $(AM_MAKEFLAGS) installcheck \ - && $(MAKE) $(AM_MAKEFLAGS) dist - -rm -rf $(distdir) - @banner="$(distdir).tar.gz is ready for distribution"; \ - dashes=`echo "$$banner" | sed s/./=/g`; \ - echo "$$dashes"; \ - echo "$$banner"; \ - echo "$$dashes" -dist: distdir - -chmod -R a+r $(distdir) - GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) - -rm -rf $(distdir) -dist-all: distdir - -chmod -R a+r $(distdir) - GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) - -rm -rf $(distdir) -distdir: $(DISTFILES) - -rm -rf $(distdir) - mkdir $(distdir) - -chmod 777 $(distdir) - @for file in $(DISTFILES); do \ - if test -f $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - cp -pr $$d/$$file $(distdir)/$$file; \ - else \ - test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file || :; \ - fi; \ - done - for subdir in $(SUBDIRS); do \ - if test "$$subdir" = .; then :; else \ - test -d $(distdir)/$$subdir \ - || mkdir $(distdir)/$$subdir \ - || exit 1; \ - chmod 777 $(distdir)/$$subdir; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \ - || exit 1; \ - fi; \ - done -info-am: -info: info-recursive -dvi-am: -dvi: dvi-recursive + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags check-am: check: check-recursive -installcheck-am: -installcheck: installcheck-recursive -install-info-am: -install-info: install-info-recursive -all-recursive-am: config.h - $(MAKE) $(AM_MAKEFLAGS) all-recursive - -install-exec-am: +all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) config.h +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(bfdlibdir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-recursive install-exec: install-exec-recursive - -install-data-am: install-bfdlibLTLIBRARIES install-data: install-data-recursive +uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -install: install-recursive -uninstall-am: uninstall-bfdlibLTLIBRARIES -uninstall: uninstall-recursive -all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) config.h -all-redirect: all-recursive-am + +installcheck: installcheck-recursive install-strip: - $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install -installdirs: installdirs-recursive -installdirs-am: - $(mkinstalldirs) $(DESTDIR)$(bfdlibdir) - - + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) @@ -1118,65 +1179,81 @@ clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) - -rm -f config.cache config.log stamp-h stamp-h[0-9]* + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: -mostlyclean-am: mostlyclean-hdr mostlyclean-noinstLIBRARIES \ - mostlyclean-compile mostlyclean-libtool \ - mostlyclean-bfdlibLTLIBRARIES mostlyclean-tags \ - mostlyclean-generic + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-bfdlibLTLIBRARIES clean-generic clean-libtool \ + clean-noinstLIBRARIES mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-hdr distclean-libtool distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: install-bfdlibLTLIBRARIES + +install-exec-am: + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive -clean-am: clean-hdr clean-noinstLIBRARIES clean-compile clean-libtool \ - clean-bfdlibLTLIBRARIES clean-tags clean-generic \ - mostlyclean-am +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool -clean: clean-recursive +pdf: pdf-recursive -distclean-am: distclean-hdr distclean-noinstLIBRARIES distclean-compile \ - distclean-libtool distclean-bfdlibLTLIBRARIES \ - distclean-tags distclean-generic clean-am - -rm -f libtool +pdf-am: -distclean: distclean-recursive - -rm -f config.status +ps: ps-recursive -maintainer-clean-am: maintainer-clean-hdr \ - maintainer-clean-noinstLIBRARIES \ - maintainer-clean-compile maintainer-clean-libtool \ - maintainer-clean-bfdlibLTLIBRARIES \ - maintainer-clean-tags maintainer-clean-generic \ - distclean-am - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." +ps-am: -maintainer-clean: maintainer-clean-recursive - -rm -f config.status +uninstall-am: uninstall-bfdlibLTLIBRARIES -.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \ -mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \ -clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \ -mostlyclean-compile distclean-compile clean-compile \ -maintainer-clean-compile mostlyclean-libtool distclean-libtool \ -clean-libtool maintainer-clean-libtool mostlyclean-bfdlibLTLIBRARIES \ -distclean-bfdlibLTLIBRARIES clean-bfdlibLTLIBRARIES \ -maintainer-clean-bfdlibLTLIBRARIES uninstall-bfdlibLTLIBRARIES \ -install-bfdlibLTLIBRARIES install-data-recursive \ -uninstall-data-recursive install-exec-recursive \ -uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \ -all-recursive check-recursive installcheck-recursive info-recursive \ -dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \ -maintainer-clean-recursive tags tags-recursive mostlyclean-tags \ -distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ -dvi-am dvi check check-am installcheck-am installcheck install-info-am \ -install-info all-recursive-am install-exec-am install-exec \ -install-data-am install-data install-am install uninstall-am uninstall \ -all-redirect all-am all installdirs-am installdirs mostlyclean-generic \ -distclean-generic clean-generic maintainer-clean-generic clean \ -mostlyclean distclean maintainer-clean +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \ + check-am clean clean-bfdlibLTLIBRARIES clean-generic \ + clean-libtool clean-noinstLIBRARIES clean-recursive ctags \ + ctags-recursive distclean distclean-compile distclean-generic \ + distclean-hdr distclean-libtool distclean-recursive \ + distclean-tags dvi dvi-am html html-am info info-am install \ + install-am install-bfdlibLTLIBRARIES install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic maintainer-clean-recursive \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \ + tags tags-recursive uninstall uninstall-am \ + uninstall-bfdlibLTLIBRARIES uninstall-info-am po/SRC-POTFILES.in: @MAINT@ Makefile $(SRC_POTFILES) @@ -1189,7 +1266,36 @@ po/BLD-POTFILES.in: @MAINT@ Makefile $(BLD_POTFILES) | LC_COLLATE= sort > tmp.bld \ && mv tmp.bld $(srcdir)/po/BLD-POTFILES.in -diststuff: info +all diststuff: info + +.PHONY: install-html install-html-am install-html-recursive + +install-html: install-html-recursive + +install-html-recursive: + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" stamp-ofiles: Makefile rm -f tofiles @@ -1300,8 +1406,6 @@ uninstall_libbfd: rm -f $(DESTDIR)$(bfdincludedir)/symcat.h rm -f $(DESTDIR)$(bfdincludedir)/bfdlink.h -Makefile: $(srcdir)/configure.in - # Have to get rid of DEP1 here so that "$?" later includes all of $(CFILES). DEP: dep.sed $(CFILES) $(HFILES) bfd.h rm -f DEP1 @@ -1361,12 +1465,12 @@ stmp-bfd-h: bfd-in3.h # Could really use a "copy-if-change"... headers: - (cd $(docdir); $(MAKE) protos $(FLAGS_TO_PASS)) - cp $(docdir)/bfd.h bfd-in2.h-new + (cd $(bfddocdir); $(MAKE) protos $(FLAGS_TO_PASS)) + cp $(bfddocdir)/bfd.h bfd-in2.h-new $(SHELL) $(srcdir)/../move-if-change bfd-in2.h-new $(srcdir)/bfd-in2.h - cp $(docdir)/libbfd.h libbfd.h-new + cp $(bfddocdir)/libbfd.h libbfd.h-new $(SHELL) $(srcdir)/../move-if-change libbfd.h-new $(srcdir)/libbfd.h - cp $(docdir)/libcoff.h libcoff.h-new + cp $(bfddocdir)/libcoff.h libcoff.h-new $(SHELL) $(srcdir)/../move-if-change libcoff.h-new $(srcdir)/libcoff.h # We only rebuild the header files automatically if we have been @@ -1374,800 +1478,931 @@ headers: $(srcdir)/bfd-in2.h: @MAINT@ stmp-bin2-h ; @true stmp-bin2-h: $(BFD_H_FILES) $(BFD64_H_FILES) - (cd $(docdir); $(MAKE) $(FLAGS_TO_PASS) bfd.h) - cp $(docdir)/bfd.h bfd-in2.h-new + (cd $(bfddocdir); $(MAKE) $(FLAGS_TO_PASS) bfd.h) + cp $(bfddocdir)/bfd.h bfd-in2.h-new $(SHELL) $(srcdir)/../move-if-change bfd-in2.h-new $(srcdir)/bfd-in2.h touch stmp-bin2-h $(srcdir)/libbfd.h: @MAINT@ stmp-lbfd-h ; @true stmp-lbfd-h: $(LIBBFD_H_FILES) - (cd $(docdir); $(MAKE) $(FLAGS_TO_PASS) libbfd.h) - cp $(docdir)/libbfd.h libbfd.h-new + (cd $(bfddocdir); $(MAKE) $(FLAGS_TO_PASS) libbfd.h) + cp $(bfddocdir)/libbfd.h libbfd.h-new $(SHELL) $(srcdir)/../move-if-change libbfd.h-new $(srcdir)/libbfd.h touch stmp-lbfd-h $(srcdir)/libcoff.h: @MAINT@ stmp-lcoff-h ; @true stmp-lcoff-h: $(LIBCOFF_H_FILES) - (cd $(docdir); $(MAKE) $(FLAGS_TO_PASS) libcoff.h) - cp $(docdir)/libcoff.h libcoff.h-new + (cd $(bfddocdir); $(MAKE) $(FLAGS_TO_PASS) libcoff.h) + cp $(bfddocdir)/libcoff.h libcoff.h-new $(SHELL) $(srcdir)/../move-if-change libcoff.h-new $(srcdir)/libcoff.h touch stmp-lcoff-h -# We want to rerun configure if config.bfd, configure.host or version.h change. -config.status: $(srcdir)/configure $(srcdir)/config.bfd \ - $(srcdir)/configure.host $(srcdir)/version.h - $(SHELL) ./config.status --recheck +bfdver.h: $(srcdir)/version.h $(srcdir)/Makefile.in + @echo "creating $@" + @bfd_version=`echo "$(VERSION)" | sed -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$$/\1\2\3\4\5/'` ;\ + bfd_version_string="\"$(VERSION)\"" ;\ + if test "x$(RELEASE)" = x ; then \ + bfd_version_date=`sed -n -e 's/.*DATE //p' < $(srcdir)/version.h` ;\ + bfd_version_string="\"$(VERSION) $${bfd_version_date}\"" ;\ + fi ;\ + sed -e "s/@bfd_version@/$$bfd_version/" -e "s/@bfd_version_string@/$$bfd_version_string/" < $(srcdir)/version.h > $@ # What appears below is generated by a hacked mkdep using gcc -MM. # DO NOT DELETE THIS LINE -- mkdep uses it. # DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. -archive.lo: archive.c $(INCDIR)/filenames.h $(INCDIR)/aout/ar.h \ - $(INCDIR)/aout/ranlib.h $(INCDIR)/safe-ctype.h -archures.lo: archures.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h +archive.lo: archive.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ + $(INCDIR)/hashtab.h $(INCDIR)/aout/ar.h $(INCDIR)/aout/ranlib.h \ + $(INCDIR)/safe-ctype.h +archures.lo: archures.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/safe-ctype.h bfd.lo: bfd.c bfdver.h $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ - $(INCDIR)/safe-ctype.h $(INCDIR)/bfdlink.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/sym.h libcoff.h libecoff.h $(INCDIR)/coff/ecoff.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h -bfdio.lo: bfdio.c $(INCDIR)/filenames.h -bfdwin.lo: bfdwin.c $(INCDIR)/filenames.h -cache.lo: cache.c $(INCDIR)/filenames.h -coffgen.lo: coffgen.c $(INCDIR)/filenames.h $(INCDIR)/coff/internal.h \ - libcoff.h $(INCDIR)/bfdlink.h -corefile.lo: corefile.c $(INCDIR)/filenames.h -format.lo: format.c $(INCDIR)/filenames.h -init.lo: init.c $(INCDIR)/filenames.h -libbfd.lo: libbfd.c $(INCDIR)/filenames.h -opncls.lo: opncls.c $(INCDIR)/filenames.h $(INCDIR)/objalloc.h \ + $(INCDIR)/safe-ctype.h $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h libcoff.h \ + libecoff.h $(INCDIR)/coff/ecoff.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h +bfdio.lo: bfdio.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +bfdwin.lo: bfdwin.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cache.lo: cache.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ $(INCDIR)/libiberty.h -reloc.lo: reloc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h -section.lo: section.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h -syms.lo: syms.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def -targets.lo: targets.c $(INCDIR)/filenames.h $(INCDIR)/fnmatch.h \ - targmatch.h -hash.lo: hash.c $(INCDIR)/filenames.h $(INCDIR)/objalloc.h -linker.lo: linker.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - genlink.h -srec.lo: srec.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ - $(INCDIR)/safe-ctype.h -binary.lo: binary.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h -tekhex.lo: tekhex.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h -ihex.lo: ihex.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ - $(INCDIR)/safe-ctype.h -stabs.lo: stabs.c $(INCDIR)/filenames.h $(INCDIR)/aout/stab_gnu.h \ - $(INCDIR)/aout/stab.def $(INCDIR)/safe-ctype.h +coffgen.lo: coffgen.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h +corefile.lo: corefile.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +format.lo: format.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +init.lo: init.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +libbfd.lo: libbfd.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +opncls.lo: opncls.c $(INCDIR)/filenames.h $(INCDIR)/objalloc.h \ + $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h +reloc.lo: reloc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/hashtab.h +section.lo: section.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/bfdlink.h +syms.lo: syms.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/safe-ctype.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/stab_gnu.h \ + $(INCDIR)/aout/stab.def +targets.lo: targets.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/fnmatch.h targmatch.h +hash.lo: hash.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/objalloc.h $(INCDIR)/libiberty.h +linker.lo: linker.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/bfdlink.h genlink.h +srec.lo: srec.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h +binary.lo: binary.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \ + $(INCDIR)/hashtab.h +tekhex.lo: tekhex.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/libiberty.h +ihex.lo: ihex.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h +stabs.lo: stabs.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/safe-ctype.h stab-syms.lo: stab-syms.c libaout.h $(INCDIR)/bfdlink.h \ $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab.def merge.lo: merge.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ $(INCDIR)/libiberty.h dwarf2.lo: dwarf2.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/dwarf2.h -simple.lo: simple.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h -archive64.lo: archive64.c $(INCDIR)/filenames.h $(INCDIR)/aout/ar.h -cpu-a29k.lo: cpu-a29k.c $(INCDIR)/filenames.h -cpu-alpha.lo: cpu-alpha.c $(INCDIR)/filenames.h -cpu-arc.lo: cpu-arc.c $(INCDIR)/filenames.h -cpu-arm.lo: cpu-arm.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h -cpu-avr.lo: cpu-avr.c $(INCDIR)/filenames.h -cpu-cris.lo: cpu-cris.c $(INCDIR)/filenames.h -cpu-d10v.lo: cpu-d10v.c $(INCDIR)/filenames.h -cpu-d30v.lo: cpu-d30v.c $(INCDIR)/filenames.h -cpu-dlx.lo: cpu-dlx.c $(INCDIR)/filenames.h -cpu-fr30.lo: cpu-fr30.c $(INCDIR)/filenames.h -cpu-frv.lo: cpu-frv.c $(INCDIR)/filenames.h -cpu-h8300.lo: cpu-h8300.c $(INCDIR)/filenames.h -cpu-h8500.lo: cpu-h8500.c $(INCDIR)/filenames.h -cpu-hppa.lo: cpu-hppa.c $(INCDIR)/filenames.h -cpu-ia64.lo: cpu-ia64.c $(INCDIR)/filenames.h cpu-ia64-opc.c \ - $(srcdir)/../opcodes/ia64-opc.h $(INCDIR)/opcode/ia64.h -cpu-i370.lo: cpu-i370.c $(INCDIR)/filenames.h -cpu-i386.lo: cpu-i386.c $(INCDIR)/filenames.h -cpu-i860.lo: cpu-i860.c $(INCDIR)/filenames.h -cpu-i960.lo: cpu-i960.c $(INCDIR)/filenames.h -cpu-ip2k.lo: cpu-ip2k.c $(INCDIR)/filenames.h -cpu-iq2000.lo: cpu-iq2000.c $(INCDIR)/filenames.h -cpu-m32r.lo: cpu-m32r.c $(INCDIR)/filenames.h -cpu-m68hc11.lo: cpu-m68hc11.c $(INCDIR)/filenames.h -cpu-m68hc12.lo: cpu-m68hc12.c $(INCDIR)/filenames.h -cpu-m68k.lo: cpu-m68k.c $(INCDIR)/filenames.h -cpu-m88k.lo: cpu-m88k.c $(INCDIR)/filenames.h -cpu-m10200.lo: cpu-m10200.c $(INCDIR)/filenames.h -cpu-m10300.lo: cpu-m10300.c $(INCDIR)/filenames.h -cpu-mcore.lo: cpu-mcore.c $(INCDIR)/filenames.h -cpu-mips.lo: cpu-mips.c $(INCDIR)/filenames.h -cpu-mmix.lo: cpu-mmix.c $(INCDIR)/filenames.h -cpu-msp430.lo: cpu-msp430.c $(INCDIR)/filenames.h -cpu-or32.lo: cpu-or32.c $(INCDIR)/filenames.h -cpu-ns32k.lo: cpu-ns32k.c $(INCDIR)/filenames.h ns32k.h -cpu-openrisc.lo: cpu-openrisc.c $(INCDIR)/filenames.h -cpu-pdp11.lo: cpu-pdp11.c $(INCDIR)/filenames.h -cpu-pj.lo: cpu-pj.c $(INCDIR)/filenames.h -cpu-powerpc.lo: cpu-powerpc.c $(INCDIR)/filenames.h -cpu-rs6000.lo: cpu-rs6000.c $(INCDIR)/filenames.h -cpu-s390.lo: cpu-s390.c $(INCDIR)/filenames.h -cpu-sh.lo: cpu-sh.c $(INCDIR)/filenames.h -cpu-sparc.lo: cpu-sparc.c $(INCDIR)/filenames.h -cpu-tic30.lo: cpu-tic30.c $(INCDIR)/filenames.h -cpu-tic4x.lo: cpu-tic4x.c $(INCDIR)/filenames.h -cpu-tic54x.lo: cpu-tic54x.c $(INCDIR)/filenames.h -cpu-tic80.lo: cpu-tic80.c $(INCDIR)/filenames.h -cpu-v850.lo: cpu-v850.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h -cpu-vax.lo: cpu-vax.c $(INCDIR)/filenames.h -cpu-we32k.lo: cpu-we32k.c $(INCDIR)/filenames.h -cpu-w65.lo: cpu-w65.c $(INCDIR)/filenames.h -cpu-xstormy16.lo: cpu-xstormy16.c $(INCDIR)/filenames.h -cpu-xtensa.lo: cpu-xtensa.c $(INCDIR)/filenames.h -cpu-z8k.lo: cpu-z8k.c $(INCDIR)/filenames.h -aout-adobe.lo: aout-adobe.c $(INCDIR)/filenames.h $(INCDIR)/aout/adobe.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def libaout.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/elf/dwarf2.h +simple.lo: simple.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ $(INCDIR)/bfdlink.h +archive64.lo: archive64.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/aout/ar.h +cpu-alpha.lo: cpu-alpha.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-arc.lo: cpu-arc.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-arm.lo: cpu-arm.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/libiberty.h +cpu-avr.lo: cpu-avr.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-bfin.lo: cpu-bfin.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-cris.lo: cpu-cris.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-cr16c.lo: cpu-cr16c.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-crx.lo: cpu-crx.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-d10v.lo: cpu-d10v.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-d30v.lo: cpu-d30v.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-dlx.lo: cpu-dlx.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-fr30.lo: cpu-fr30.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-frv.lo: cpu-frv.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-h8300.lo: cpu-h8300.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-h8500.lo: cpu-h8500.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-hppa.lo: cpu-hppa.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-ia64.lo: cpu-ia64.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + cpu-ia64-opc.c $(srcdir)/../opcodes/ia64-opc.h $(INCDIR)/opcode/ia64.h +cpu-i370.lo: cpu-i370.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-i386.lo: cpu-i386.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-i860.lo: cpu-i860.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-i960.lo: cpu-i960.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-ip2k.lo: cpu-ip2k.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-iq2000.lo: cpu-iq2000.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-m32c.lo: cpu-m32c.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-m32r.lo: cpu-m32r.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-m68hc11.lo: cpu-m68hc11.c $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h +cpu-m68hc12.lo: cpu-m68hc12.c $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h +cpu-m68k.lo: cpu-m68k.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/opcode/m68k.h +cpu-m88k.lo: cpu-m88k.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-m10200.lo: cpu-m10200.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-m10300.lo: cpu-m10300.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-maxq.lo: cpu-maxq.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-mcore.lo: cpu-mcore.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-mips.lo: cpu-mips.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-mmix.lo: cpu-mmix.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-mt.lo: cpu-mt.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-msp430.lo: cpu-msp430.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-or32.lo: cpu-or32.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-ns32k.lo: cpu-ns32k.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + ns32k.h +cpu-openrisc.lo: cpu-openrisc.c $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h +cpu-pdp11.lo: cpu-pdp11.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-pj.lo: cpu-pj.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-powerpc.lo: cpu-powerpc.c $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h +cpu-rs6000.lo: cpu-rs6000.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-s390.lo: cpu-s390.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-sh.lo: cpu-sh.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(srcdir)/../opcodes/sh-opc.h +cpu-sparc.lo: cpu-sparc.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-tic30.lo: cpu-tic30.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-tic4x.lo: cpu-tic4x.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-tic54x.lo: cpu-tic54x.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-tic80.lo: cpu-tic80.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-v850.lo: cpu-v850.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/safe-ctype.h +cpu-vax.lo: cpu-vax.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-we32k.lo: cpu-we32k.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-w65.lo: cpu-w65.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-xstormy16.lo: cpu-xstormy16.c $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h +cpu-xtensa.lo: cpu-xtensa.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-xc16x.lo: cpu-xc16x.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-z80.lo: cpu-z80.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +cpu-z8k.lo: cpu-z8k.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +aout-adobe.lo: aout-adobe.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/aout/adobe.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + libaout.h $(INCDIR)/bfdlink.h aout-arm.lo: aout-arm.c $(INCDIR)/filenames.h libaout.h \ $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h aoutx.h \ - $(INCDIR)/safe-ctype.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ - $(INCDIR)/aout/ar.h aout-target.h + $(INCDIR)/safe-ctype.h $(INCDIR)/hashtab.h $(INCDIR)/aout/stab_gnu.h \ + $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h aout-target.h aout-cris.lo: aout-cris.c aout32.c aoutx.h $(INCDIR)/filenames.h \ $(INCDIR)/safe-ctype.h $(INCDIR)/bfdlink.h libaout.h \ - $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ - $(INCDIR)/aout/ar.h aout-target.h + $(INCDIR)/hashtab.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ + $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h aout-target.h aout-ns32k.lo: aout-ns32k.c $(INCDIR)/aout/aout64.h \ ns32k.h libaout.h $(INCDIR)/bfdlink.h aoutx.h $(INCDIR)/filenames.h \ - $(INCDIR)/safe-ctype.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ - $(INCDIR)/aout/ar.h + $(INCDIR)/safe-ctype.h $(INCDIR)/hashtab.h $(INCDIR)/aout/stab_gnu.h \ + $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h aout-sparcle.lo: aout-sparcle.c $(INCDIR)/bfdlink.h \ - libaout.h aoutf1.h $(INCDIR)/filenames.h $(INCDIR)/aout/sun4.h \ - $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ - $(INCDIR)/aout/ar.h aout-target.h + libaout.h aoutf1.h $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/aout/sun4.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ + $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h aout-target.h aout-tic30.lo: aout-tic30.c $(INCDIR)/filenames.h libaout.h \ $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h aoutx.h \ - $(INCDIR)/safe-ctype.h -aout0.lo: aout0.c aoutf1.h $(INCDIR)/filenames.h $(INCDIR)/aout/sun4.h \ - libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \ - aout-target.h + $(INCDIR)/safe-ctype.h $(INCDIR)/hashtab.h +aout0.lo: aout0.c aoutf1.h $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/aout/sun4.h libaout.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h aout-target.h aout32.lo: aout32.c aoutx.h $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \ - $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \ + $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/hashtab.h $(INCDIR)/aout/aout64.h \ $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h armnetbsd.lo: armnetbsd.c netbsd.h $(INCDIR)/filenames.h \ - libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h -bout.lo: bout.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - genlink.h $(INCDIR)/bout.h $(INCDIR)/aout/stab_gnu.h \ - $(INCDIR)/aout/stab.def libaout.h + $(INCDIR)/hashtab.h libaout.h $(INCDIR)/bfdlink.h aout-target.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h +bout.lo: bout.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/bfdlink.h genlink.h $(INCDIR)/bout.h $(INCDIR)/libiberty.h \ + $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def libaout.h cf-i386lynx.lo: cf-i386lynx.c $(INCDIR)/filenames.h \ - coff-i386.c $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h \ - $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \ - coffcode.h coffswap.h -cf-m68klynx.lo: cf-m68klynx.c coff-m68k.c $(INCDIR)/filenames.h \ - $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ + coff-i386.c $(INCDIR)/hashtab.h $(INCDIR)/coff/i386.h \ + $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h cf-sparclynx.lo: cf-sparclynx.c coff-sparc.c $(INCDIR)/filenames.h \ - $(INCDIR)/coff/sparc.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ - libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h -coff-a29k.lo: coff-a29k.c $(INCDIR)/filenames.h $(INCDIR)/coff/a29k.h \ - $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ - libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h + $(INCDIR)/hashtab.h $(INCDIR)/coff/sparc.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \ + coffcode.h coffswap.h coff-apollo.lo: coff-apollo.c $(INCDIR)/filenames.h \ - $(INCDIR)/coff/apollo.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ - libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h -coff-arm.lo: coff-arm.c $(INCDIR)/filenames.h $(INCDIR)/coff/arm.h \ - $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/hashtab.h $(INCDIR)/coff/apollo.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \ + coffcode.h coffswap.h +coff-arm.lo: coff-arm.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h coff-aux.lo: coff-aux.c $(INCDIR)/filenames.h $(INCDIR)/coff/aux-coff.h \ $(INCDIR)/coff/internal.h $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h \ - coff-m68k.c libcoff.h $(INCDIR)/bfdlink.h coffcode.h \ - coffswap.h -coff-h8300.lo: coff-h8300.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - genlink.h $(INCDIR)/coff/h8300.h $(INCDIR)/coff/external.h \ - $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/libiberty.h \ + coff-m68k.c $(INCDIR)/hashtab.h libcoff.h $(INCDIR)/bfdlink.h \ coffcode.h coffswap.h -coff-h8500.lo: coff-h8500.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/coff/h8500.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ - libcoff.h coffcode.h coffswap.h -coff-i386.lo: coff-i386.c $(INCDIR)/filenames.h $(INCDIR)/coff/i386.h \ +coff-h8300.lo: coff-h8300.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/bfdlink.h genlink.h $(INCDIR)/coff/h8300.h \ $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ + libcoff.h $(INCDIR)/libiberty.h coffcode.h coffswap.h +coff-h8500.lo: coff-h8500.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/coff/h8500.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h +coff-i386.lo: coff-i386.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h -coff-i860.lo: coff-i860.c $(INCDIR)/filenames.h $(INCDIR)/coff/i860.h \ - $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ +coff-i860.lo: coff-i860.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/coff/i860.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h coff-go32.lo: coff-go32.c coff-i386.c $(INCDIR)/filenames.h \ - $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ - libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h -coff-i960.lo: coff-i960.c $(INCDIR)/filenames.h $(INCDIR)/coff/i960.h \ + $(INCDIR)/hashtab.h $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h \ $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \ coffcode.h coffswap.h -coff-m68k.lo: coff-m68k.c $(INCDIR)/filenames.h $(INCDIR)/coff/m68k.h \ - $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ +coff-i960.lo: coff-i960.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/coff/i960.h $(INCDIR)/coff/internal.h libcoff.h \ + $(INCDIR)/bfdlink.h coffcode.h coffswap.h +coff-m68k.lo: coff-m68k.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h -coff-m88k.lo: coff-m88k.c $(INCDIR)/filenames.h $(INCDIR)/coff/m88k.h \ - $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ +coff-m88k.lo: coff-m88k.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/coff/m88k.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h +coff-maxq.lo: coff-maxq.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/coff/maxq.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ + libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h \ + coffcode.h coffswap.h coff-mips.lo: coff-mips.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \ - $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h $(INCDIR)/coff/external.h \ - libcoff.h libecoff.h coffswap.h ecoffswap.h -coff-or32.lo: coff-or32.c $(INCDIR)/filenames.h $(INCDIR)/coff/or32.h \ - $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \ - coffcode.h coffswap.h + $(INCDIR)/hashtab.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h \ + $(INCDIR)/coff/symconst.h $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h \ + $(INCDIR)/coff/external.h libcoff.h libecoff.h coffswap.h \ + ecoffswap.h +coff-or32.lo: coff-or32.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/coff/or32.h $(INCDIR)/coff/internal.h libcoff.h \ + $(INCDIR)/bfdlink.h coffcode.h coffswap.h coff-rs6000.lo: coff-rs6000.c $(INCDIR)/filenames.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h \ - $(INCDIR)/coff/rs6000.h libcoff.h libxcoff.h coffcode.h \ - coffswap.h + $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/xcoff.h $(INCDIR)/coff/rs6000.h libcoff.h \ + libxcoff.h coffcode.h coffswap.h coff-sh.lo: coff-sh.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/coff/sh.h $(INCDIR)/coff/external.h \ - $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h -coff-sparc.lo: coff-sparc.c $(INCDIR)/filenames.h $(INCDIR)/coff/sparc.h \ + $(INCDIR)/hashtab.h $(INCDIR)/bfdlink.h $(INCDIR)/coff/sh.h \ $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ + libcoff.h coffcode.h coffswap.h +coff-sparc.lo: coff-sparc.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/coff/sparc.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h coff-stgo32.lo: coff-stgo32.c coff-i386.c $(INCDIR)/filenames.h \ - $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/go32exe.h libcoff.h $(INCDIR)/bfdlink.h \ - coffcode.h coffswap.h go32stub.h + $(INCDIR)/hashtab.h $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/go32exe.h \ + libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h \ + go32stub.h coff-svm68k.lo: coff-svm68k.c coff-m68k.c $(INCDIR)/filenames.h \ - $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ - libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h -coff-tic30.lo: coff-tic30.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/coff/tic30.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ - libcoff.h coffcode.h coffswap.h -coff-tic4x.lo: coff-tic4x.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/coff/tic4x.h $(INCDIR)/coff/ti.h $(INCDIR)/coff/internal.h \ - libcoff.h coffcode.h coffswap.h -coff-tic54x.lo: coff-tic54x.c $(INCDIR)/filenames.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/coff/tic54x.h $(INCDIR)/coff/ti.h \ + $(INCDIR)/hashtab.h $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \ + coffcode.h coffswap.h +coff-tic30.lo: coff-tic30.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/coff/tic30.h $(INCDIR)/coff/external.h \ $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h +coff-tic4x.lo: coff-tic4x.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/coff/tic4x.h $(INCDIR)/coff/ti.h \ + $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h +coff-tic54x.lo: coff-tic54x.c $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h $(INCDIR)/bfdlink.h $(INCDIR)/coff/tic54x.h \ + $(INCDIR)/coff/ti.h $(INCDIR)/coff/internal.h libcoff.h \ + coffcode.h coffswap.h coff-tic80.lo: coff-tic80.c $(INCDIR)/bfdlink.h $(INCDIR)/filenames.h \ - $(INCDIR)/coff/tic80.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ - libcoff.h coffcode.h coffswap.h + $(INCDIR)/hashtab.h $(INCDIR)/coff/tic80.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h coff-u68k.lo: coff-u68k.c coff-m68k.c $(INCDIR)/filenames.h \ - $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/hashtab.h $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \ + coffcode.h coffswap.h +coff-we32k.lo: coff-we32k.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/coff/we32k.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h -coff-we32k.lo: coff-we32k.c $(INCDIR)/filenames.h $(INCDIR)/coff/we32k.h \ - $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ - libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h -coff-w65.lo: coff-w65.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/coff/w65.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ - libcoff.h coffcode.h coffswap.h -coff-z8k.lo: coff-z8k.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/coff/z8k.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ - libcoff.h coffcode.h coffswap.h +coff-w65.lo: coff-w65.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/coff/w65.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h +coff-z80.lo: coff-z80.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/coff/z80.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h +coff-z8k.lo: coff-z8k.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/coff/z8k.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h cofflink.lo: cofflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/safe-ctype.h + $(INCDIR)/hashtab.h $(INCDIR)/coff/internal.h libcoff.h \ + $(INCDIR)/safe-ctype.h dwarf1.lo: dwarf1.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/dwarf.h + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/elf/dwarf.h ecoff.lo: ecoff.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/aout/ar.h $(INCDIR)/aout/ranlib.h $(INCDIR)/aout/stab_gnu.h \ - $(INCDIR)/aout/stab.def libaout.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \ - $(INCDIR)/coff/ecoff.h libcoff.h libecoff.h + $(INCDIR)/hashtab.h $(INCDIR)/aout/ar.h $(INCDIR)/aout/ranlib.h \ + $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def libaout.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h \ + $(INCDIR)/coff/symconst.h $(INCDIR)/coff/ecoff.h libcoff.h \ + libecoff.h $(INCDIR)/libiberty.h ecofflink.lo: ecofflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/objalloc.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \ - $(INCDIR)/coff/ecoff.h libcoff.h libecoff.h + $(INCDIR)/hashtab.h $(INCDIR)/objalloc.h $(INCDIR)/aout/stab_gnu.h \ + $(INCDIR)/aout/stab.def $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h \ + $(INCDIR)/coff/symconst.h $(INCDIR)/coff/ecoff.h libcoff.h \ + libecoff.h efi-app-ia32.lo: efi-app-ia32.c $(INCDIR)/filenames.h \ - coff-i386.c $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ - $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h + coff-i386.c $(INCDIR)/hashtab.h $(INCDIR)/coff/i386.h \ + $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \ + peicode.h libpei.h elf.lo: elf.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/libiberty.h -elf32-am33lin.lo: elf32-am33lin.c elf-m10300.c $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/libiberty.h +elf32-am33lin.lo: elf32-am33lin.c $(INCDIR)/filenames.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/mn10300.h \ + $(INCDIR)/elf/reloc-macros.h elf-m10300.c $(INCDIR)/hashtab.h \ + elf32-target.h +elf32-arc.lo: elf32-arc.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/arc.h \ + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \ + elf32-target.h +elf32-arm.lo: elf32-arm.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ + elf-vxworks.h $(INCDIR)/elf/arm.h $(INCDIR)/elf/reloc-macros.h \ + elf32-target.h +elf32-avr.lo: elf32-avr.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/avr.h \ $(INCDIR)/elf/reloc-macros.h elf32-target.h -elf32-arc.lo: elf32-arc.c $(INCDIR)/filenames.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/elf/arc.h $(INCDIR)/elf/reloc-macros.h \ - $(INCDIR)/libiberty.h elf32-target.h -elfarm-oabi.lo: elfarm-oabi.c $(INCDIR)/elf/arm.h $(INCDIR)/elf/reloc-macros.h \ - $(INCDIR)/filenames.h elf-bfd.h $(INCDIR)/elf/common.h \ - $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ - elf32-arm.h elf32-target.h -elfarm-nabi.lo: elfarm-nabi.c $(INCDIR)/elf/arm.h $(INCDIR)/elf/reloc-macros.h \ - $(INCDIR)/filenames.h elf-bfd.h $(INCDIR)/elf/common.h \ - $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ - elf32-arm.h elf32-target.h -elf32-avr.lo: elf32-avr.c $(INCDIR)/filenames.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/elf/avr.h $(INCDIR)/elf/reloc-macros.h \ +elf32-bfin.lo: elf32-bfin.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/bfin.h \ + $(INCDIR)/elf/reloc-macros.h elf32-target.h +elf32-cr16c.lo: elf32-cr16c.c $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/cr16c.h \ + $(INCDIR)/elf/reloc-macros.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elf32-target.h +elf32-cris.lo: elf32-cris.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/cris.h \ + $(INCDIR)/elf/reloc-macros.h elf32-target.h +elf32-crx.lo: elf32-crx.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/crx.h \ + $(INCDIR)/elf/reloc-macros.h elf32-target.h +elf32-d10v.lo: elf32-d10v.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/d10v.h \ + $(INCDIR)/elf/reloc-macros.h elf32-target.h +elf32-d30v.lo: elf32-d30v.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/d30v.h \ + $(INCDIR)/elf/reloc-macros.h elf32-target.h +elf32-dlx.lo: elf32-dlx.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/dlx.h \ + $(INCDIR)/elf/reloc-macros.h elf32-target.h +elf32-fr30.lo: elf32-fr30.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/fr30.h \ + $(INCDIR)/elf/reloc-macros.h elf32-target.h +elf32-frv.lo: elf32-frv.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/frv.h \ + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/elf/dwarf2.h \ elf32-target.h -elf32-cris.lo: elf32-cris.c $(INCDIR)/filenames.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/elf/cris.h $(INCDIR)/elf/reloc-macros.h \ - elf32-target.h -elf32-d10v.lo: elf32-d10v.c $(INCDIR)/filenames.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/elf/d10v.h $(INCDIR)/elf/reloc-macros.h \ - elf32-target.h -elf32-d30v.lo: elf32-d30v.c $(INCDIR)/filenames.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/elf/d30v.h $(INCDIR)/elf/reloc-macros.h \ - elf32-target.h -elf32-dlx.lo: elf32-dlx.c $(INCDIR)/filenames.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/elf/dlx.h $(INCDIR)/elf/reloc-macros.h \ - elf32-target.h -elf32-fr30.lo: elf32-fr30.c $(INCDIR)/filenames.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/elf/fr30.h $(INCDIR)/elf/reloc-macros.h \ - elf32-target.h -elf32-frv.lo: elf32-frv.c $(INCDIR)/filenames.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/elf/frv.h $(INCDIR)/elf/reloc-macros.h \ - $(INCDIR)/elf/dwarf2.h $(INCDIR)/hashtab.h elf32-target.h -elf32-gen.lo: elf32-gen.c $(INCDIR)/filenames.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h elf32-target.h +elf32-gen.lo: elf32-gen.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h elf32-target.h elf32-h8300.lo: elf32-h8300.c $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/elf/h8.h $(INCDIR)/elf/reloc-macros.h elf32-target.h +elf32-hppa.lo: elf32-hppa.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/h8.h \ - $(INCDIR)/elf/reloc-macros.h elf32-target.h -elf32-hppa.lo: elf32-hppa.c $(INCDIR)/filenames.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/elf/hppa.h $(INCDIR)/elf/reloc-macros.h \ - libhppa.h elf32-hppa.h elf-hppa.h elf32-target.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/hppa.h \ + $(INCDIR)/elf/reloc-macros.h libhppa.h elf32-hppa.h \ + elf-hppa.h elf32-target.h elf32-i370.lo: elf32-i370.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/elf/i370.h $(INCDIR)/elf/reloc-macros.h \ - elf32-target.h -elf32-i386.lo: elf32-i386.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/elf/i386.h $(INCDIR)/elf/reloc-macros.h \ - elf32-target.h -elf32-i860.lo: elf32-i860.c $(INCDIR)/filenames.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/elf/i860.h $(INCDIR)/elf/reloc-macros.h \ - elf32-target.h -elf32-i960.lo: elf32-i960.c $(INCDIR)/filenames.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/elf/i960.h $(INCDIR)/elf/reloc-macros.h \ - elf32-target.h -elf32-ip2k.lo: elf32-ip2k.c $(INCDIR)/filenames.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/elf/ip2k.h $(INCDIR)/elf/reloc-macros.h \ - elf32-target.h -elf32-iq2000.lo: elf32-iq2000.c $(INCDIR)/filenames.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/iq2000.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/i370.h \ $(INCDIR)/elf/reloc-macros.h elf32-target.h -elf32-m32r.lo: elf32-m32r.c $(INCDIR)/filenames.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/elf/m32r.h $(INCDIR)/elf/reloc-macros.h \ - elf32-target.h -elf32-m68k.lo: elf32-m68k.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ +elf32-i386.lo: elf32-i386.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elf-vxworks.h \ + $(INCDIR)/elf/i386.h $(INCDIR)/elf/reloc-macros.h elf32-target.h +elf32-i860.lo: elf32-i860.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/elf/m68k.h $(INCDIR)/elf/reloc-macros.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/i860.h \ + $(INCDIR)/elf/reloc-macros.h elf32-target.h +elf32-i960.lo: elf32-i960.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/i960.h \ + $(INCDIR)/elf/reloc-macros.h elf32-target.h +elf32-ip2k.lo: elf32-ip2k.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/ip2k.h \ + $(INCDIR)/elf/reloc-macros.h elf32-target.h +elf32-iq2000.lo: elf32-iq2000.c $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/elf/iq2000.h $(INCDIR)/elf/reloc-macros.h \ + elf32-target.h +elf32-m32c.lo: elf32-m32c.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/m32c.h \ + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \ + elf32-target.h +elf32-m32r.lo: elf32-m32r.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/m32r.h \ + $(INCDIR)/elf/reloc-macros.h elf32-target.h +elf32-m68k.lo: elf32-m68k.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/m68k.h \ + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/m68k.h \ elf32-target.h elf32-m68hc11.lo: elf32-m68hc11.c $(INCDIR)/filenames.h \ - $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elf32-m68hc1x.h \ $(INCDIR)/elf/m68hc11.h $(INCDIR)/elf/reloc-macros.h \ $(INCDIR)/opcode/m68hc11.h elf32-target.h elf32-m68hc12.lo: elf32-m68hc12.c $(INCDIR)/filenames.h \ - $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elf32-m68hc1x.h \ $(INCDIR)/elf/m68hc11.h $(INCDIR)/elf/reloc-macros.h \ $(INCDIR)/opcode/m68hc11.h elf32-target.h elf32-m68hc1x.lo: elf32-m68hc1x.c $(INCDIR)/filenames.h \ - $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elf32-m68hc1x.h \ $(INCDIR)/elf/m68hc11.h $(INCDIR)/elf/reloc-macros.h \ $(INCDIR)/opcode/m68hc11.h -elf32-m88k.lo: elf32-m88k.c $(INCDIR)/filenames.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h elf32-target.h -elf-m10200.lo: elf-m10200.c $(INCDIR)/filenames.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h elf32-target.h -elf-m10300.lo: elf-m10300.c $(INCDIR)/filenames.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/elf/mn10300.h $(INCDIR)/elf/reloc-macros.h \ - elf32-target.h +elf32-m88k.lo: elf32-m88k.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h elf32-target.h +elf-m10200.lo: elf-m10200.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h elf32-target.h +elf-m10300.lo: elf-m10300.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/mn10300.h \ + $(INCDIR)/elf/reloc-macros.h elf32-target.h elf32-mcore.lo: elf32-mcore.c $(INCDIR)/filenames.h \ - $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/mcore.h \ $(INCDIR)/elf/reloc-macros.h elf32-target.h -elfxx-mips.lo: elfxx-mips.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h elfxx-mips.h \ - $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/sym.h \ - $(INCDIR)/coff/symconst.h $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h \ - $(INCDIR)/coff/external.h $(INCDIR)/hashtab.h -elf32-mips.lo: elf32-mips.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - genlink.h elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h elfxx-mips.h $(INCDIR)/elf/mips.h \ - $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h \ - $(INCDIR)/coff/external.h ecoffswap.h elf32-target.h -elf32-msp430.lo: elf32-msp430.c $(INCDIR)/filenames.h \ +elfxx-mips.lo: elfxx-mips.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ $(INCDIR)/libiberty.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/elf/msp430.h $(INCDIR)/elf/reloc-macros.h \ - elf32-target.h -elf32-openrisc.lo: elf32-openrisc.c $(INCDIR)/filenames.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/openrisc.h \ - $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \ - elf32-target.h -elf32-or32.lo: elf32-or32.c $(INCDIR)/filenames.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/elf/or32.h $(INCDIR)/elf/reloc-macros.h \ - $(INCDIR)/libiberty.h elf32-target.h -elf32-pj.lo: elf32-pj.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/elf/pj.h $(INCDIR)/elf/reloc-macros.h \ - elf32-target.h -elf32-ppc.lo: elf32-ppc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h \ - elf32-ppc.h elf32-target.h -elf32-sh64.lo: elf32-sh64.c $(INCDIR)/filenames.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(srcdir)/../opcodes/sh64-opc.h \ - elf32-sh64.h elf32-sh.c $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \ - elf32-target.h -elf32-sh64-com.lo: elf32-sh64-com.c $(INCDIR)/filenames.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/sh.h \ - $(INCDIR)/elf/reloc-macros.h elf32-sh64.h $(srcdir)/../opcodes/sh64-opc.h -elf32-s390.lo: elf32-s390.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/elf/s390.h $(INCDIR)/elf/reloc-macros.h \ - elf32-target.h -elf32-sh.lo: elf32-sh.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \ - elf32-target.h -elf32-sparc.lo: elf32-sparc.c $(INCDIR)/filenames.h \ - $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ - $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h \ - $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/sparc.h \ - elf32-target.h -elf32-v850.lo: elf32-v850.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/elf/v850.h $(INCDIR)/elf/reloc-macros.h \ - $(INCDIR)/libiberty.h elf32-target.h -elf32-vax.lo: elf32-vax.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/elf/vax.h $(INCDIR)/elf/reloc-macros.h \ - elf32-target.h -elf32-xstormy16.lo: elf32-xstormy16.c $(INCDIR)/filenames.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/xstormy16.h \ - $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \ - elf32-target.h -elf32-xtensa.lo: elf32-xtensa.c $(INCDIR)/filenames.h \ - $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ - $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/xtensa.h \ - $(INCDIR)/elf/reloc-macros.h $(INCDIR)/xtensa-isa.h \ - $(INCDIR)/xtensa-config.h elf32-target.h -elf32.lo: elf32.c elfcode.h $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ - $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ - $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfcore.h \ - $(INCDIR)/safe-ctype.h -elflink.lo: elflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/libiberty.h -elf-strtab.lo: elf-strtab.c $(INCDIR)/filenames.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h -elf-eh-frame.lo: elf-eh-frame.c $(INCDIR)/filenames.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/dwarf2.h -epoc-pe-arm.lo: epoc-pe-arm.c pe-arm.c $(INCDIR)/filenames.h \ - coff-arm.c $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ - $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h -epoc-pei-arm.lo: epoc-pei-arm.c pei-arm.c $(INCDIR)/filenames.h \ - coff-arm.c $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ - $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h -hp300bsd.lo: hp300bsd.c $(INCDIR)/filenames.h libaout.h \ - $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h -hp300hpux.lo: hp300hpux.c $(INCDIR)/aout/hp300hpux.h \ - aoutx.h $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \ - $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \ - aout-target.h -som.lo: som.c $(INCDIR)/alloca-conf.h $(INCDIR)/filenames.h -i386aout.lo: i386aout.c $(INCDIR)/filenames.h $(INCDIR)/aout/aout64.h \ - libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/stab_gnu.h \ - $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h -i386bsd.lo: i386bsd.c $(INCDIR)/filenames.h libaout.h \ - $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h -i386dynix.lo: i386dynix.c $(INCDIR)/aout/dynix3.h aoutx.h \ - $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h $(INCDIR)/bfdlink.h \ - libaout.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ - $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h aout-target.h -i386freebsd.lo: i386freebsd.c freebsd.h $(INCDIR)/filenames.h \ - libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h -i386linux.lo: i386linux.c $(INCDIR)/filenames.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \ - libaout.h $(INCDIR)/bfdlink.h aout-target.h -i386lynx.lo: i386lynx.c $(INCDIR)/filenames.h libaout.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h aout-target.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h -i386msdos.lo: i386msdos.c $(INCDIR)/filenames.h libaout.h \ - $(INCDIR)/bfdlink.h -i386netbsd.lo: i386netbsd.c netbsd.h $(INCDIR)/filenames.h \ - libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h -i386mach3.lo: i386mach3.c $(INCDIR)/filenames.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \ - libaout.h $(INCDIR)/bfdlink.h aout-target.h -i386os9k.lo: i386os9k.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - libaout.h $(INCDIR)/os9k.h -ieee.lo: ieee.c $(INCDIR)/filenames.h $(INCDIR)/ieee.h \ - libieee.h $(INCDIR)/safe-ctype.h -m68k4knetbsd.lo: m68k4knetbsd.c netbsd.h $(INCDIR)/filenames.h \ - libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h -m68klinux.lo: m68klinux.c $(INCDIR)/filenames.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \ - libaout.h $(INCDIR)/bfdlink.h aout-target.h -m68klynx.lo: m68klynx.c $(INCDIR)/filenames.h libaout.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h aout-target.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h -m68knetbsd.lo: m68knetbsd.c netbsd.h $(INCDIR)/filenames.h \ - libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h -m88kmach3.lo: m88kmach3.c $(INCDIR)/filenames.h libaout.h \ - $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h -mach-o.lo: mach-o.c mach-o.h $(INCDIR)/filenames.h \ - $(INCDIR)/libiberty.h mach-o-target.c -mipsbsd.lo: mipsbsd.c $(INCDIR)/filenames.h libaout.h \ - $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h -newsos3.lo: newsos3.c $(INCDIR)/filenames.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \ - libaout.h $(INCDIR)/bfdlink.h aout-target.h -nlm.lo: nlm.c $(INCDIR)/filenames.h libnlm.h $(INCDIR)/nlm/common.h \ - $(INCDIR)/nlm/internal.h $(INCDIR)/nlm/external.h -nlm32-i386.lo: nlm32-i386.c $(INCDIR)/filenames.h $(INCDIR)/nlm/i386-ext.h \ - libnlm.h $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h \ - $(INCDIR)/nlm/external.h nlmswap.h nlm-target.h -nlm32-sparc.lo: nlm32-sparc.c $(INCDIR)/filenames.h \ - $(INCDIR)/nlm/sparc32-ext.h libnlm.h $(INCDIR)/nlm/common.h \ - $(INCDIR)/nlm/internal.h $(INCDIR)/nlm/external.h nlmswap.h \ - nlm-target.h -nlm32-ppc.lo: nlm32-ppc.c $(INCDIR)/filenames.h $(INCDIR)/nlm/ppc-ext.h \ - libnlm.h $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h \ - $(INCDIR)/nlm/external.h nlmswap.h nlm-target.h -nlm32.lo: nlm32.c nlmcode.h $(INCDIR)/filenames.h libnlm.h \ - $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h $(INCDIR)/nlm/external.h -ns32knetbsd.lo: ns32knetbsd.c netbsd.h $(INCDIR)/filenames.h \ - libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h -oasys.lo: oasys.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \ - $(INCDIR)/oasys.h liboasys.h -pc532-mach.lo: pc532-mach.c $(INCDIR)/filenames.h libaout.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h aout-target.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h -pdp11.lo: pdp11.c $(INCDIR)/filenames.h libaout.h $(INCDIR)/bfdlink.h \ - aout-target.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ - $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h $(INCDIR)/safe-ctype.h -pef.lo: pef.c $(INCDIR)/safe-ctype.h pef.h pef-traceback.h \ - $(INCDIR)/filenames.h $(INCDIR)/libiberty.h -pe-arm.lo: pe-arm.c $(INCDIR)/filenames.h coff-arm.c \ - $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \ - peicode.h libpei.h -pei-arm.lo: pei-arm.c $(INCDIR)/filenames.h coff-arm.c \ - $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \ - peicode.h libpei.h -pe-i386.lo: pe-i386.c $(INCDIR)/filenames.h coff-i386.c \ - $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \ - peicode.h libpei.h -pei-i386.lo: pei-i386.c $(INCDIR)/filenames.h coff-i386.c \ - $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \ - peicode.h libpei.h -pe-mcore.lo: pe-mcore.c $(INCDIR)/filenames.h coff-mcore.c \ - $(INCDIR)/coff/mcore.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \ - peicode.h libpei.h -pei-mcore.lo: pei-mcore.c $(INCDIR)/filenames.h coff-mcore.c \ - $(INCDIR)/coff/mcore.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \ - peicode.h libpei.h -pe-ppc.lo: pe-ppc.c $(INCDIR)/filenames.h coff-ppc.c \ - $(INCDIR)/coff/powerpc.h $(INCDIR)/coff/external.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ - $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h -pei-ppc.lo: pei-ppc.c $(INCDIR)/filenames.h coff-ppc.c \ - $(INCDIR)/coff/powerpc.h $(INCDIR)/coff/external.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ - $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h -pe-sh.lo: pe-sh.c $(INCDIR)/filenames.h coff-sh.c $(INCDIR)/libiberty.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/coff/sh.h $(INCDIR)/coff/external.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ - coffcode.h peicode.h libpei.h -pei-sh.lo: pei-sh.c $(INCDIR)/filenames.h coff-sh.c \ - $(INCDIR)/libiberty.h $(INCDIR)/bfdlink.h $(INCDIR)/coff/sh.h \ - $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/pe.h libcoff.h coffcode.h peicode.h \ - libpei.h -pe-mips.lo: pe-mips.c $(INCDIR)/filenames.h $(INCDIR)/coff/mipspe.h \ - $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \ - peicode.h libpei.h -pei-mips.lo: pei-mips.c $(INCDIR)/filenames.h pe-mips.c \ - $(INCDIR)/coff/mipspe.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \ - peicode.h libpei.h -ppcboot.lo: ppcboot.c $(INCDIR)/safe-ctype.h $(INCDIR)/filenames.h -reloc16.lo: reloc16.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - genlink.h $(INCDIR)/coff/internal.h libcoff.h -riscix.lo: riscix.c $(INCDIR)/filenames.h libaout.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h aout-target.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h -sparclinux.lo: sparclinux.c $(INCDIR)/filenames.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \ - libaout.h $(INCDIR)/bfdlink.h aout-target.h -sparclynx.lo: sparclynx.c $(INCDIR)/filenames.h $(INCDIR)/aout/sun4.h \ - libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \ - aout-target.h -sparcnetbsd.lo: sparcnetbsd.c netbsd.h $(INCDIR)/filenames.h \ - libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h -sunos.lo: sunos.c $(INCDIR)/bfdlink.h libaout.h aoutf1.h \ - $(INCDIR)/filenames.h $(INCDIR)/aout/sun4.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \ - aout-target.h -vaxnetbsd.lo: vaxnetbsd.c netbsd.h $(INCDIR)/filenames.h \ - libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h -vax1knetbsd.lo: vax1knetbsd.c netbsd.h $(INCDIR)/filenames.h \ - libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h -vaxbsd.lo: vaxbsd.c $(INCDIR)/filenames.h libaout.h \ - $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h -versados.lo: versados.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h -vms.lo: vms.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - vms.h -vms-gsd.lo: vms-gsd.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - vms.h -vms-hdr.lo: vms-hdr.c bfdver.h $(INCDIR)/filenames.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h vms.h -vms-misc.lo: vms-misc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - vms.h -vms-tir.lo: vms-tir.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - vms.h -xcofflink.lo: xcofflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h libcoff.h \ - libxcoff.h -xsym.lo: xsym.c xsym.h $(INCDIR)/filenames.h -xtensa-isa.lo: xtensa-isa.c $(INCDIR)/xtensa-isa.h \ - $(INCDIR)/xtensa-isa-internal.h -xtensa-modules.lo: xtensa-modules.c $(INCDIR)/xtensa-isa.h \ - $(INCDIR)/xtensa-isa-internal.h -aix5ppc-core.lo: aix5ppc-core.c -aout64.lo: aout64.c aoutx.h $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \ - $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h -coff-alpha.lo: coff-alpha.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \ - $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/alpha.h $(INCDIR)/aout/ar.h \ - libcoff.h libecoff.h coffswap.h ecoffswap.h -coff64-rs6000.lo: coff64-rs6000.c $(INCDIR)/filenames.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h \ - $(INCDIR)/coff/rs6k64.h libcoff.h libxcoff.h coffcode.h \ - coffswap.h -demo64.lo: demo64.c aoutf1.h $(INCDIR)/filenames.h \ - $(INCDIR)/aout/sun4.h libaout.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ - $(INCDIR)/aout/ar.h aout-target.h -efi-app-ia64.lo: efi-app-ia64.c $(INCDIR)/filenames.h \ - coff-ia64.c $(INCDIR)/coff/ia64.h $(INCDIR)/coff/external.h \ - $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ - $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h -elf64-x86-64.lo: elf64-x86-64.c $(INCDIR)/filenames.h \ - $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ - $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/x86-64.h \ - $(INCDIR)/elf/reloc-macros.h elf64-target.h -elf64-alpha.lo: elf64-alpha.c $(INCDIR)/filenames.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/alpha.h \ - $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/internal.h \ + elfxx-mips.h $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h \ $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/ecoff.h \ - $(INCDIR)/coff/alpha.h $(INCDIR)/aout/ar.h libcoff.h \ - libecoff.h ecoffswap.h elf64-target.h -elf64-hppa.lo: elf64-hppa.c $(INCDIR)/alloca-conf.h \ - $(INCDIR)/filenames.h elf-bfd.h $(INCDIR)/elf/common.h \ - $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/elf/hppa.h $(INCDIR)/elf/reloc-macros.h libhppa.h \ - elf64-hppa.h elf-hppa.h elf64-target.h -elf64-gen.lo: elf64-gen.c $(INCDIR)/filenames.h elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h elf64-target.h -elfn32-mips.lo: elfn32-mips.c $(INCDIR)/filenames.h \ + $(INCDIR)/coff/mips.h $(INCDIR)/coff/external.h elf-vxworks.h +elf32-mips.lo: elf32-mips.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ $(INCDIR)/bfdlink.h genlink.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfxx-mips.h \ $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/sym.h \ $(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h $(INCDIR)/coff/external.h \ - ecoffswap.h elf32-target.h -elf64-mips.lo: elf64-mips.c $(INCDIR)/filenames.h $(INCDIR)/aout/ar.h \ - $(INCDIR)/bfdlink.h genlink.h elf-bfd.h $(INCDIR)/elf/common.h \ - $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfxx-mips.h \ - $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/sym.h \ - $(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/alpha.h ecoffswap.h \ - elf64-target.h -elf64-mmix.lo: elf64-mmix.c $(INCDIR)/filenames.h elf-bfd.h \ + ecoffswap.h elf32-target.h elf-vxworks.h +elf32-mt.lo: elf32-mt.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/mt.h \ + $(INCDIR)/elf/reloc-macros.h elf32-target.h +elf32-msp430.lo: elf32-msp430.c $(INCDIR)/filenames.h \ + $(INCDIR)/libiberty.h $(INCDIR)/hashtab.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/elf/mmix.h $(INCDIR)/elf/reloc-macros.h \ - $(INCDIR)/opcode/mmix.h elf64-target.h -elf64-ppc.lo: elf64-ppc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/elf/msp430.h $(INCDIR)/elf/reloc-macros.h \ + elf32-target.h +elf32-openrisc.lo: elf32-openrisc.c $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/elf/openrisc.h $(INCDIR)/elf/reloc-macros.h \ + $(INCDIR)/libiberty.h elf32-target.h +elf32-or32.lo: elf32-or32.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/elf/ppc64.h $(INCDIR)/elf/reloc-macros.h \ - elf64-ppc.h elf64-target.h -elf64-s390.lo: elf64-s390.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ - elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/elf/s390.h $(INCDIR)/elf/reloc-macros.h \ - elf64-target.h -elf64-sh64.lo: elf64-sh64.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/or32.h \ + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \ + elf32-target.h +elf32-pj.lo: elf32-pj.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/pj.h \ + $(INCDIR)/elf/reloc-macros.h elf32-target.h +elf32-ppc.lo: elf32-ppc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/ppc.h \ + $(INCDIR)/elf/reloc-macros.h elf32-ppc.h elf-vxworks.h \ + elf32-target.h +elf32-sh64.lo: elf32-sh64.c $(INCDIR)/filenames.h elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(srcdir)/../opcodes/sh64-opc.h \ + elf32-sh64.h elf32-sh.c $(INCDIR)/hashtab.h $(INCDIR)/elf/sh.h \ + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \ + $(srcdir)/../opcodes/sh-opc.h elf32-target.h +elf32-sh64-com.lo: elf32-sh64-com.c $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h elf32-sh64.h \ + $(srcdir)/../opcodes/sh64-opc.h +elf32-s390.lo: elf32-s390.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/s390.h \ + $(INCDIR)/elf/reloc-macros.h elf32-target.h +elf32-sh.lo: elf32-sh.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h \ + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \ + $(srcdir)/../opcodes/sh-opc.h elf32-target.h +elf32-sh-symbian.lo: elf32-sh-symbian.c elf32-sh.c \ + $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \ - elf64-target.h -elf64-sparc.lo: elf64-sparc.c $(INCDIR)/filenames.h \ + $(INCDIR)/libiberty.h $(srcdir)/../opcodes/sh-opc.h \ + elf32-target.h +elfxx-sparc.lo: elfxx-sparc.c $(INCDIR)/filenames.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h \ + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/sparc.h \ + elfxx-sparc.h elf-vxworks.h +elf32-sparc.lo: elf32-sparc.c $(INCDIR)/filenames.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h \ + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/sparc.h \ + elfxx-sparc.h elf32-target.h elf-vxworks.h +elf32-v850.lo: elf32-v850.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/v850.h \ + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/libiberty.h \ + elf32-target.h +elf32-vax.lo: elf32-vax.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/vax.h \ + $(INCDIR)/elf/reloc-macros.h elf32-target.h +elf32-xstormy16.lo: elf32-xstormy16.c $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/elf/xstormy16.h $(INCDIR)/elf/reloc-macros.h \ + $(INCDIR)/libiberty.h elf32-target.h +elf32-xtensa.lo: elf32-xtensa.c $(INCDIR)/filenames.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/xtensa.h \ + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/xtensa-isa.h \ + $(INCDIR)/xtensa-config.h elf32-target.h +elf32-xc16x.lo: elf32-xc16x.c $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/elf/xc16x.h $(INCDIR)/elf/reloc-macros.h \ + $(INCDIR)/elf/dwarf2.h $(INCDIR)/libiberty.h elf32-target.h +elf32.lo: elf32.c elfcode.h $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfcore.h +elflink.lo: elflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/safe-ctype.h \ + $(INCDIR)/libiberty.h $(INCDIR)/objalloc.h +elf-strtab.lo: elf-strtab.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/sparc.h \ - $(INCDIR)/elf/sparc.h $(INCDIR)/elf/reloc-macros.h \ - elf64-target.h -elf64.lo: elf64.c elfcode.h $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ - $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ - $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfcore.h \ - $(INCDIR)/safe-ctype.h -mmo.lo: mmo.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ - $(INCDIR)/elf/mmix.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/mmix.h -nlm32-alpha.lo: nlm32-alpha.c $(INCDIR)/filenames.h \ - $(INCDIR)/nlm/alpha-ext.h libnlm.h $(INCDIR)/nlm/common.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h +elf-eh-frame.lo: elf-eh-frame.c $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/elf/dwarf2.h +elf-vxworks.lo: elf-vxworks.c $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ + elf-vxworks.h +epoc-pe-arm.lo: epoc-pe-arm.c pe-arm.c $(INCDIR)/filenames.h \ + coff-arm.c $(INCDIR)/hashtab.h $(INCDIR)/coff/arm.h \ + $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \ + peicode.h libpei.h +epoc-pei-arm.lo: epoc-pei-arm.c pei-arm.c $(INCDIR)/filenames.h \ + coff-arm.c $(INCDIR)/hashtab.h $(INCDIR)/coff/arm.h \ + $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \ + peicode.h libpei.h +hp300bsd.lo: hp300bsd.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ + $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h +hp300hpux.lo: hp300hpux.c $(INCDIR)/aout/hp300hpux.h \ + aoutx.h $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \ + $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/hashtab.h $(INCDIR)/aout/aout64.h \ + $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \ + aout-target.h +som.lo: som.c $(INCDIR)/alloca-conf.h $(INCDIR)/filenames.h +i386aout.lo: i386aout.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/aout/aout64.h libaout.h $(INCDIR)/bfdlink.h \ + aout-target.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h +i386bsd.lo: i386bsd.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ + $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h +i386dynix.lo: i386dynix.c $(INCDIR)/aout/dynix3.h aoutx.h \ + $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h $(INCDIR)/bfdlink.h \ + libaout.h $(INCDIR)/hashtab.h $(INCDIR)/aout/aout64.h \ + $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \ + aout-target.h +i386freebsd.lo: i386freebsd.c freebsd.h $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h libaout.h $(INCDIR)/bfdlink.h aout-target.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h +i386linux.lo: i386linux.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h libaout.h $(INCDIR)/bfdlink.h aout-target.h +i386lynx.lo: i386lynx.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \ + aout-target.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h +i386msdos.lo: i386msdos.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + libaout.h $(INCDIR)/bfdlink.h +i386netbsd.lo: i386netbsd.c netbsd.h $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h libaout.h $(INCDIR)/bfdlink.h aout-target.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h +i386mach3.lo: i386mach3.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h libaout.h $(INCDIR)/bfdlink.h aout-target.h +i386os9k.lo: i386os9k.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/os9k.h +ieee.lo: ieee.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/ieee.h libieee.h $(INCDIR)/safe-ctype.h +m68k4knetbsd.lo: m68k4knetbsd.c netbsd.h $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h libaout.h $(INCDIR)/bfdlink.h aout-target.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h +m68klinux.lo: m68klinux.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h libaout.h $(INCDIR)/bfdlink.h aout-target.h +m68knetbsd.lo: m68knetbsd.c netbsd.h $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h libaout.h $(INCDIR)/bfdlink.h aout-target.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h +m88kmach3.lo: m88kmach3.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ + $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h +m88kopenbsd.lo: m88kopenbsd.c netbsd.h $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h libaout.h $(INCDIR)/bfdlink.h aout-target.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h +mach-o.lo: mach-o.c mach-o.h $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h mach-o-target.c +mipsbsd.lo: mipsbsd.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ + $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h +newsos3.lo: newsos3.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h libaout.h $(INCDIR)/bfdlink.h aout-target.h +nlm.lo: nlm.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + libnlm.h $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h \ + $(INCDIR)/nlm/external.h +nlm32-i386.lo: nlm32-i386.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/nlm/i386-ext.h libnlm.h $(INCDIR)/nlm/common.h \ $(INCDIR)/nlm/internal.h $(INCDIR)/nlm/external.h nlmswap.h \ nlm-target.h -nlm64.lo: nlm64.c nlmcode.h $(INCDIR)/filenames.h libnlm.h \ - $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h $(INCDIR)/nlm/external.h -aix386-core.lo: aix386-core.c $(INCDIR)/filenames.h \ - $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ - libcoff.h $(INCDIR)/bfdlink.h -hpux-core.lo: hpux-core.c $(INCDIR)/filenames.h -irix-core.lo: irix-core.c $(INCDIR)/filenames.h -lynx-core.lo: lynx-core.c $(INCDIR)/filenames.h -osf-core.lo: osf-core.c $(INCDIR)/filenames.h -sco5-core.lo: sco5-core.c $(INCDIR)/filenames.h libaout.h \ - $(INCDIR)/bfdlink.h -trad-core.lo: trad-core.c $(INCDIR)/filenames.h libaout.h \ - $(INCDIR)/bfdlink.h -cisco-core.lo: cisco-core.c $(INCDIR)/filenames.h -elf32-ia64.lo: elf32-ia64.c $(INCDIR)/filenames.h elf-bfd.h \ +nlm32-sparc.lo: nlm32-sparc.c $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h $(INCDIR)/nlm/sparc32-ext.h libnlm.h \ + $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h $(INCDIR)/nlm/external.h \ + nlmswap.h nlm-target.h +nlm32-ppc.lo: nlm32-ppc.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/nlm/ppc-ext.h libnlm.h $(INCDIR)/nlm/common.h \ + $(INCDIR)/nlm/internal.h $(INCDIR)/nlm/external.h nlmswap.h \ + nlm-target.h +nlm32.lo: nlm32.c nlmcode.h $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + libnlm.h $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h \ + $(INCDIR)/nlm/external.h +ns32knetbsd.lo: ns32knetbsd.c netbsd.h $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h libaout.h $(INCDIR)/bfdlink.h aout-target.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h +oasys.lo: oasys.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \ + $(INCDIR)/hashtab.h $(INCDIR)/oasys.h liboasys.h +pc532-mach.lo: pc532-mach.c $(INCDIR)/filenames.h libaout.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h $(INCDIR)/aout/aout64.h \ + aout-target.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h +pdp11.lo: pdp11.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ + $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h \ + $(INCDIR)/safe-ctype.h +pef.lo: pef.c $(INCDIR)/safe-ctype.h pef.h pef-traceback.h \ + $(INCDIR)/filenames.h $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h +pe-arm.lo: pe-arm.c $(INCDIR)/filenames.h coff-arm.c \ + $(INCDIR)/hashtab.h $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ + $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h +pei-arm.lo: pei-arm.c $(INCDIR)/filenames.h coff-arm.c \ + $(INCDIR)/hashtab.h $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ + $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h +pe-i386.lo: pe-i386.c $(INCDIR)/filenames.h coff-i386.c \ + $(INCDIR)/hashtab.h $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ + $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h +pei-i386.lo: pei-i386.c $(INCDIR)/filenames.h coff-i386.c \ + $(INCDIR)/hashtab.h $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ + $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h +pe-mcore.lo: pe-mcore.c $(INCDIR)/filenames.h coff-mcore.c \ + $(INCDIR)/hashtab.h $(INCDIR)/coff/mcore.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ + $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h +pei-mcore.lo: pei-mcore.c $(INCDIR)/filenames.h coff-mcore.c \ + $(INCDIR)/hashtab.h $(INCDIR)/coff/mcore.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ + $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h +pe-ppc.lo: pe-ppc.c $(INCDIR)/filenames.h coff-ppc.c \ + $(INCDIR)/hashtab.h $(INCDIR)/coff/powerpc.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ + $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h +pei-ppc.lo: pei-ppc.c $(INCDIR)/filenames.h coff-ppc.c \ + $(INCDIR)/hashtab.h $(INCDIR)/coff/powerpc.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ + $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h +pe-sh.lo: pe-sh.c $(INCDIR)/filenames.h coff-sh.c $(INCDIR)/libiberty.h \ + $(INCDIR)/hashtab.h $(INCDIR)/bfdlink.h $(INCDIR)/coff/sh.h \ + $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/pe.h libcoff.h coffcode.h peicode.h \ + libpei.h +pei-sh.lo: pei-sh.c $(INCDIR)/filenames.h coff-sh.c \ + $(INCDIR)/libiberty.h $(INCDIR)/hashtab.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/coff/sh.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/pe.h libcoff.h coffcode.h peicode.h \ + libpei.h +pe-mips.lo: pe-mips.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/coff/mipspe.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \ + peicode.h libpei.h +pei-mips.lo: pei-mips.c $(INCDIR)/filenames.h pe-mips.c \ + $(INCDIR)/hashtab.h $(INCDIR)/coff/mipspe.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \ + $(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h +ppcboot.lo: ppcboot.c $(INCDIR)/safe-ctype.h $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h +reloc16.lo: reloc16.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/bfdlink.h genlink.h $(INCDIR)/coff/internal.h \ + libcoff.h +riscix.lo: riscix.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \ + aout-target.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h +sparclinux.lo: sparclinux.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h libaout.h $(INCDIR)/bfdlink.h aout-target.h +sparclynx.lo: sparclynx.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/aout/sun4.h libaout.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h aout-target.h +sparcnetbsd.lo: sparcnetbsd.c netbsd.h $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h libaout.h $(INCDIR)/bfdlink.h aout-target.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h +sunos.lo: sunos.c $(INCDIR)/bfdlink.h libaout.h aoutf1.h \ + $(INCDIR)/filenames.h $(INCDIR)/hashtab.h $(INCDIR)/aout/sun4.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h aout-target.h +vaxnetbsd.lo: vaxnetbsd.c netbsd.h $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h libaout.h $(INCDIR)/bfdlink.h aout-target.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h +vax1knetbsd.lo: vax1knetbsd.c netbsd.h $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h libaout.h $(INCDIR)/bfdlink.h aout-target.h \ + $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ + $(INCDIR)/aout/ar.h +vaxbsd.lo: vaxbsd.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ + $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h +versados.lo: versados.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/libiberty.h +vms.lo: vms.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/hashtab.h vms.h +vms-gsd.lo: vms-gsd.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/hashtab.h vms.h +vms-hdr.lo: vms-hdr.c bfdver.h $(INCDIR)/filenames.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h $(INCDIR)/hashtab.h \ + vms.h +vms-misc.lo: vms-misc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/hashtab.h vms.h +vms-tir.lo: vms-tir.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/hashtab.h vms.h +xcofflink.lo: xcofflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/hashtab.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h \ + libcoff.h libxcoff.h +xsym.lo: xsym.c xsym.h $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +xtensa-isa.lo: xtensa-isa.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/xtensa-isa.h $(INCDIR)/xtensa-isa-internal.h +xtensa-modules.lo: xtensa-modules.c $(INCDIR)/xtensa-isa.h \ + $(INCDIR)/xtensa-isa-internal.h +aix5ppc-core.lo: aix5ppc-core.c +aout64.lo: aout64.c aoutx.h $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \ + $(INCDIR)/bfdlink.h libaout.h $(INCDIR)/hashtab.h $(INCDIR)/aout/aout64.h \ + $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h +coff-alpha.lo: coff-alpha.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/hashtab.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h \ + $(INCDIR)/coff/symconst.h $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/alpha.h \ + $(INCDIR)/aout/ar.h libcoff.h libecoff.h coffswap.h \ + ecoffswap.h +coff64-rs6000.lo: coff64-rs6000.c $(INCDIR)/filenames.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/xcoff.h $(INCDIR)/coff/rs6k64.h libcoff.h \ + libxcoff.h coffcode.h coffswap.h +demo64.lo: demo64.c aoutf1.h $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h $(INCDIR)/aout/sun4.h libaout.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ + $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h aout-target.h +efi-app-ia64.lo: efi-app-ia64.c $(INCDIR)/filenames.h \ + coff-ia64.c $(INCDIR)/hashtab.h $(INCDIR)/coff/ia64.h \ + $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \ + peicode.h libpei.h +elf64-x86-64.lo: elf64-x86-64.c $(INCDIR)/filenames.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/x86-64.h \ + $(INCDIR)/elf/reloc-macros.h elf64-target.h +elf64-alpha.lo: elf64-alpha.c $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/elf/alpha.h $(INCDIR)/elf/reloc-macros.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \ + $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/alpha.h $(INCDIR)/aout/ar.h \ + libcoff.h libecoff.h ecoffswap.h elf64-target.h +elf64-hppa.lo: elf64-hppa.c $(INCDIR)/alloca-conf.h \ + $(INCDIR)/filenames.h $(INCDIR)/hashtab.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/opcode/ia64.h $(INCDIR)/elf/ia64.h \ - $(INCDIR)/elf/reloc-macros.h $(INCDIR)/objalloc.h $(INCDIR)/hashtab.h \ - elf32-target.h -elf64-ia64.lo: elf64-ia64.c $(INCDIR)/filenames.h elf-bfd.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/elf/hppa.h $(INCDIR)/elf/reloc-macros.h \ + libhppa.h elf64-hppa.h elf-hppa.h elf64-target.h +elf64-gen.lo: elf64-gen.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h elf64-target.h +elfn32-mips.lo: elfn32-mips.c $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h $(INCDIR)/bfdlink.h genlink.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/opcode/ia64.h $(INCDIR)/elf/ia64.h \ - $(INCDIR)/elf/reloc-macros.h $(INCDIR)/objalloc.h $(INCDIR)/hashtab.h \ + elfxx-mips.h $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h \ + $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h $(INCDIR)/coff/external.h \ + ecoffswap.h elf32-target.h +elf64-mips.lo: elf64-mips.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/aout/ar.h $(INCDIR)/bfdlink.h genlink.h elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + elfxx-mips.h $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h \ + $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/alpha.h ecoffswap.h \ elf64-target.h -peigen.lo: peigen.c $(INCDIR)/filenames.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h $(INCDIR)/coff/pe.h \ - libcoff.h $(INCDIR)/bfdlink.h libpei.h -pepigen.lo: pepigen.c $(INCDIR)/filenames.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/ia64.h $(INCDIR)/coff/external.h $(INCDIR)/coff/pe.h \ - libcoff.h $(INCDIR)/bfdlink.h libpei.h +elf64-mmix.lo: elf64-mmix.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/mmix.h \ + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/mmix.h \ + elf64-target.h +elf64-ppc.lo: elf64-ppc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/ppc64.h \ + $(INCDIR)/elf/reloc-macros.h elf64-ppc.h elf64-target.h +elf64-s390.lo: elf64-s390.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/s390.h \ + $(INCDIR)/elf/reloc-macros.h elf64-target.h +elf64-sh64.lo: elf64-sh64.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h \ + $(INCDIR)/elf/reloc-macros.h elf64-target.h +elf64-sparc.lo: elf64-sparc.c $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ + $(INCDIR)/elf/sparc.h $(INCDIR)/elf/reloc-macros.h \ + $(INCDIR)/opcode/sparc.h elfxx-sparc.h elf64-target.h +elf64.lo: elf64.c elfcode.h $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h elfcore.h +mmo.lo: mmo.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/libiberty.h $(INCDIR)/elf/mmix.h $(INCDIR)/elf/reloc-macros.h \ + $(INCDIR)/opcode/mmix.h +nlm32-alpha.lo: nlm32-alpha.c $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h $(INCDIR)/nlm/alpha-ext.h libnlm.h \ + $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h $(INCDIR)/nlm/external.h \ + nlmswap.h nlm-target.h +nlm64.lo: nlm64.c nlmcode.h $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + libnlm.h $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h \ + $(INCDIR)/nlm/external.h +aix386-core.lo: aix386-core.c $(INCDIR)/filenames.h \ + $(INCDIR)/hashtab.h $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h +hpux-core.lo: hpux-core.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +irix-core.lo: irix-core.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +lynx-core.lo: lynx-core.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +osf-core.lo: osf-core.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +sco5-core.lo: sco5-core.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + libaout.h $(INCDIR)/bfdlink.h +trad-core.lo: trad-core.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + libaout.h $(INCDIR)/bfdlink.h +cisco-core.lo: cisco-core.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +elf32-ia64.lo: elf32-ia64.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/ia64.h \ + $(INCDIR)/elf/ia64.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/objalloc.h \ + elf32-target.h +elf64-ia64.lo: elf64-ia64.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/ia64.h \ + $(INCDIR)/elf/ia64.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/objalloc.h \ + elf64-target.h +peigen.lo: peigen.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h libpei.h +pepigen.lo: pepigen.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/ia64.h $(INCDIR)/coff/external.h \ + $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h libpei.h # IF YOU PUT ANYTHING HERE IT WILL GO AWAY - # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/contrib/binutils/bfd/acinclude.m4 b/contrib/binutils/bfd/acinclude.m4 index 63b4bf92b17..95e3d4a702d 100644 --- a/contrib/binutils/bfd/acinclude.m4 +++ b/contrib/binutils/bfd/acinclude.m4 @@ -1,8 +1,10 @@ -sinclude(../config/accross.m4) +sinclude(../config/acx.m4) +sinclude(../bfd/bfd.m4) +sinclude(../bfd/warning.m4) dnl See whether we need to use fopen-bin.h rather than fopen-same.h. AC_DEFUN([BFD_BINARY_FOPEN], -[AC_REQUIRE([AC_CANONICAL_SYSTEM]) +[AC_REQUIRE([AC_CANONICAL_TARGET]) case "${host}" in changequote(,)dnl *-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*) @@ -43,73 +45,6 @@ else fi AC_SUBST(EXEEXT_FOR_BUILD)])dnl -dnl See whether we need a declaration for a function. -AC_DEFUN([BFD_NEED_DECLARATION], -[AC_MSG_CHECKING([whether $1 must be declared]) -AC_CACHE_VAL(bfd_cv_decl_needed_$1, -[AC_TRY_COMPILE([ -#include -#ifdef HAVE_STRING_H -#include -#else -#ifdef HAVE_STRINGS_H -#include -#endif -#endif -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif], -[char *(*pfn) = (char *(*)) $1], -bfd_cv_decl_needed_$1=no, bfd_cv_decl_needed_$1=yes)]) -AC_MSG_RESULT($bfd_cv_decl_needed_$1) -if test $bfd_cv_decl_needed_$1 = yes; then - AC_DEFINE([NEED_DECLARATION_]translit($1, [a-z], [A-Z]), 1, - [Define if $1 is not declared in system header files.]) -fi -])dnl - -dnl Check for existence of a type $1 in sys/procfs.h - -AC_DEFUN([BFD_HAVE_SYS_PROCFS_TYPE], -[AC_MSG_CHECKING([for $1 in sys/procfs.h]) - AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_$1, - [AC_TRY_COMPILE([ -#define _SYSCALL32 -#include ], - [$1 avar], - bfd_cv_have_sys_procfs_type_$1=yes, - bfd_cv_have_sys_procfs_type_$1=no - )]) - if test $bfd_cv_have_sys_procfs_type_$1 = yes; then - AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z]), 1, - [Define if has $1.]) - fi - AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_$1) -]) - - -dnl Check for existence of member $2 in type $1 in sys/procfs.h - -AC_DEFUN([BFD_HAVE_SYS_PROCFS_TYPE_MEMBER], -[AC_MSG_CHECKING([for $1.$2 in sys/procfs.h]) - AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_member_$1_$2, - [AC_TRY_COMPILE([ -#define _SYSCALL32 -#include ], - [$1 avar; void* aref = (void*) &avar.$2], - bfd_cv_have_sys_procfs_type_member_$1_$2=yes, - bfd_cv_have_sys_procfs_type_member_$1_$2=no - )]) - if test $bfd_cv_have_sys_procfs_type_member_$1_$2 = yes; then - AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z])[_]translit($2, [a-z], [A-Z]), 1, - [Define if has $1.$2.]) - fi - AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_member_$1_$2) -]) - sinclude(../libtool.m4) dnl The lines below arrange for aclocal not to bring libtool.m4 dnl AM_PROG_LIBTOOL into aclocal.m4, while still arranging for automake @@ -138,12 +73,15 @@ AC_DEFUN([AM_INSTALL_LIBBFD], fi) AC_MSG_RESULT($install_libbfd_p) AM_CONDITIONAL(INSTALL_LIBBFD, test $install_libbfd_p = yes) + # Need _noncanonical variables for this. + ACX_NONCANONICAL_HOST + ACX_NONCANONICAL_TARGET # libbfd.a is a host library containing target dependent code bfdlibdir='$(libdir)' bfdincludedir='$(includedir)' if test "${host}" != "${target}"; then - bfdlibdir='$(exec_prefix)/$(host_alias)/$(target_alias)/lib' - bfdincludedir='$(exec_prefix)/$(host_alias)/$(target_alias)/include' + bfdlibdir='$(exec_prefix)/$(host_noncanonical)/$(target_noncanonical)/lib' + bfdincludedir='$(exec_prefix)/$(host_noncanonical)/$(target_noncanonical)/include' fi AC_SUBST(bfdlibdir) AC_SUBST(bfdincludedir) diff --git a/contrib/binutils/bfd/aclocal.m4 b/contrib/binutils/bfd/aclocal.m4 index 9d27670a0f1..d5f315805a9 100644 --- a/contrib/binutils/bfd/aclocal.m4 +++ b/contrib/binutils/bfd/aclocal.m4 @@ -1,292 +1,750 @@ -dnl aclocal.m4 generated automatically by aclocal 1.4-p6 +# generated automatically by aclocal 1.9.5 -*- Autoconf -*- -dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl This program is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without -dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A -dnl PARTICULAR PURPOSE. - -sinclude(../config/accross.m4) - -dnl See whether we need to use fopen-bin.h rather than fopen-same.h. -AC_DEFUN(BFD_BINARY_FOPEN, -[AC_REQUIRE([AC_CANONICAL_SYSTEM]) -case "${host}" in -changequote(,)dnl -*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*) -changequote([,])dnl - AC_DEFINE(USE_BINARY_FOPEN, 1, [Use b modifier when opening binary files?]) ;; -esac])dnl - -dnl Get a default for CC_FOR_BUILD to put into Makefile. -AC_DEFUN(BFD_CC_FOR_BUILD, -[# Put a plausible default for CC_FOR_BUILD in Makefile. -if test -z "$CC_FOR_BUILD"; then - if test "x$cross_compiling" = "xno"; then - CC_FOR_BUILD='$(CC)' - else - CC_FOR_BUILD=gcc - fi -fi -AC_SUBST(CC_FOR_BUILD) -# Also set EXEEXT_FOR_BUILD. -if test "x$cross_compiling" = "xno"; then - EXEEXT_FOR_BUILD='$(EXEEXT)' -else - AC_CACHE_CHECK([for build system executable suffix], bfd_cv_build_exeext, - [rm -f conftest* - echo 'int main () { return 0; }' > conftest.c - bfd_cv_build_exeext= - ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5 - for file in conftest.*; do - case $file in - *.c | *.o | *.obj | *.ilk | *.pdb) ;; - *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;; - esac - done - rm -f conftest* - test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no]) - EXEEXT_FOR_BUILD="" - test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext} -fi -AC_SUBST(EXEEXT_FOR_BUILD)])dnl - -dnl See whether we need a declaration for a function. -AC_DEFUN(BFD_NEED_DECLARATION, -[AC_MSG_CHECKING([whether $1 must be declared]) -AC_CACHE_VAL(bfd_cv_decl_needed_$1, -[AC_TRY_COMPILE([ -#include -#ifdef HAVE_STRING_H -#include -#else -#ifdef HAVE_STRINGS_H -#include -#endif -#endif -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif], -[char *(*pfn) = (char *(*)) $1], -bfd_cv_decl_needed_$1=no, bfd_cv_decl_needed_$1=yes)]) -AC_MSG_RESULT($bfd_cv_decl_needed_$1) -if test $bfd_cv_decl_needed_$1 = yes; then - AC_DEFINE([NEED_DECLARATION_]translit($1, [a-z], [A-Z]), 1, - [Define if $1 is not declared in system header files.]) -fi -])dnl - -dnl Check for existence of a type $1 in sys/procfs.h - -AC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE, -[AC_MSG_CHECKING([for $1 in sys/procfs.h]) - AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_$1, - [AC_TRY_COMPILE([ -#define _SYSCALL32 -#include ], - [$1 avar], - bfd_cv_have_sys_procfs_type_$1=yes, - bfd_cv_have_sys_procfs_type_$1=no - )]) - if test $bfd_cv_have_sys_procfs_type_$1 = yes; then - AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z]), 1, - [Define if has $1.]) - fi - AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_$1) -]) - - -dnl Check for existence of member $2 in type $1 in sys/procfs.h - -AC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE_MEMBER, -[AC_MSG_CHECKING([for $1.$2 in sys/procfs.h]) - AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_member_$1_$2, - [AC_TRY_COMPILE([ -#define _SYSCALL32 -#include ], - [$1 avar; void* aref = (void*) &avar.$2], - bfd_cv_have_sys_procfs_type_member_$1_$2=yes, - bfd_cv_have_sys_procfs_type_member_$1_$2=no - )]) - if test $bfd_cv_have_sys_procfs_type_member_$1_$2 = yes; then - AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z])[_]translit($2, [a-z], [A-Z]), 1, - [Define if has $1.$2.]) - fi - AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_member_$1_$2) -]) - -sinclude(../libtool.m4) -dnl The lines below arrange for aclocal not to bring libtool.m4 -dnl AM_PROG_LIBTOOL into aclocal.m4, while still arranging for automake -dnl to add a definition of LIBTOOL to Makefile.in. -ifelse(yes,no,[ -AC_DEFUN([AM_PROG_LIBTOOL],) -AC_DEFUN([AM_DISABLE_SHARED],) -AC_SUBST(LIBTOOL) -]) - -sinclude(../gettext.m4) -ifelse(yes,no,[ -AC_DEFUN([CY_WITH_NLS],) -AC_SUBST(INTLLIBS) -]) - -AC_DEFUN([AM_INSTALL_LIBBFD], -[AC_MSG_CHECKING([whether to install libbfd]) - AC_ARG_ENABLE(install-libbfd, -[ --enable-install-libbfd controls installation of libbfd and related headers], - install_libbfd_p=$enableval, - if test "${host}" = "${target}" || test "$enable_shared" = "yes"; then - install_libbfd_p=yes - else - install_libbfd_p=no - fi) - AC_MSG_RESULT($install_libbfd_p) - AM_CONDITIONAL(INSTALL_LIBBFD, test $install_libbfd_p = yes) - # libbfd.a is a host library containing target dependent code - bfdlibdir='$(libdir)' - bfdincludedir='$(includedir)' - if test "${host}" != "${target}"; then - bfdlibdir='$(exec_prefix)/$(host_alias)/$(target_alias)/lib' - bfdincludedir='$(exec_prefix)/$(host_alias)/$(target_alias)/include' - fi - AC_SUBST(bfdlibdir) - AC_SUBST(bfdincludedir) -] -) - -# Define a conditional. - -AC_DEFUN([AM_CONDITIONAL], -[AC_SUBST($1_TRUE) -AC_SUBST($1_FALSE) -if $2; then - $1_TRUE= - $1_FALSE='#' -else - $1_TRUE='#' - $1_FALSE= -fi]) - -# isc-posix.m4 serial 2 (gettext-0.11.2) -dnl Copyright (C) 1995-2002 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -# This file is not needed with autoconf-2.53 and newer. Remove it in 2005. - -# This test replaces the one in autoconf. -# Currently this macro should have the same name as the autoconf macro -# because gettext's gettext.m4 (distributed in the automake package) -# still uses it. Otherwise, the use in gettext.m4 makes autoheader -# give these diagnostics: -# configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX -# configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX - -undefine([AC_ISC_POSIX]) - -AC_DEFUN([AC_ISC_POSIX], - [ - dnl This test replaces the obsolescent AC_ISC_POSIX kludge. - AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"]) - ] -) - -# Do all the work for Automake. This macro actually does too much -- -# some checks are only needed if your package does certain things. -# But this isn't really a big deal. - -# serial 1 - -dnl Usage: -dnl AM_INIT_AUTOMAKE(package,version, [no-define]) - -AC_DEFUN([AM_INIT_AUTOMAKE], -[AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl -AC_REQUIRE([AC_PROG_INSTALL]) -PACKAGE=[$1] -AC_SUBST(PACKAGE) -VERSION=[$2] -AC_SUBST(VERSION) -dnl test to see if srcdir already configured -if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then - AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) -fi -ifelse([$3],, -AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) -AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])) -AC_REQUIRE([AM_SANITY_CHECK]) -AC_REQUIRE([AC_ARG_PROGRAM]) -dnl FIXME This is truly gross. -missing_dir=`cd $ac_aux_dir && pwd` -AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}, $missing_dir) -AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) -AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}, $missing_dir) -AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) -AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) -AC_REQUIRE([AC_PROG_MAKE_SET])]) - -# Copyright 2002 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. -# You 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 +# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. -AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.4"]) +AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"]) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION so it can be traced. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], - [AM_AUTOMAKE_VERSION([1.4-p6])]) + [AM_AUTOMAKE_VERSION([1.9.5])]) -# -# Check to make sure that the build environment is sane. -# +# AM_AUX_DIR_EXPAND -*- Autoconf -*- +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to +# `$srcdir', `$srcdir/..', or `$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is `.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[dnl Rely on autoconf to set up CDPATH properly. +AC_PREREQ([2.50])dnl +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 7 + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ(2.52)dnl + ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE]) +AC_SUBST([$1_FALSE]) +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) +fi])]) + + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 8 + +# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "GCJ", or "OBJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +ifelse([$1], CC, [depcc="$CC" am_compiler_list=], + [$1], CXX, [depcc="$CXX" am_compiler_list=], + [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +AM_CONDITIONAL([am__fastdep$1], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES +AC_DEFUN([AM_SET_DEPDIR], +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE(dependency-tracking, +[ --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH]) +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +#serial 3 + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # So let's grep whole file. + if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + dirpart=`AS_DIRNAME("$mf")` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`AS_DIRNAME(["$file"])` + AS_MKDIR_P([$dirpart/$fdir]) + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking +# is enabled. FIXME. This creates each `.P' file that we will +# need in order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) +]) + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 8 + +# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. +AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) + +# Do all the work for Automake. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 12 + +# This macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_PREREQ([2.58])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl +# test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) + AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) +AM_MISSING_PROG(AUTOCONF, autoconf) +AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) +AM_MISSING_PROG(AUTOHEADER, autoheader) +AM_MISSING_PROG(MAKEINFO, makeinfo) +AM_PROG_INSTALL_SH +AM_PROG_INSTALL_STRIP +AC_REQUIRE([AM_PROG_MKDIR_P])dnl +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES(CC)], + [define([AC_PROG_CC], + defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES(CXX)], + [define([AC_PROG_CXX], + defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl +]) +]) + + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $1 | $1:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +install_sh=${install_sh-"$am_aux_dir/install-sh"} +AC_SUBST(install_sh)]) + +# Copyright (C) 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# Check whether the underlying file-system supports filenames +# with a leading dot. For instance MS-DOS doesn't. +AC_DEFUN([AM_SET_LEADING_DOT], +[rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null +AC_SUBST([am__leading_dot])]) + +# Add --enable-maintainer-mode option to configure. -*- Autoconf -*- +# From Jim Meyering + +# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +AC_DEFUN([AM_MAINTAINER_MODE], +[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) + dnl maintainer-mode is disabled by default + AC_ARG_ENABLE(maintainer-mode, +[ --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer], + USE_MAINTAINER_MODE=$enableval, + USE_MAINTAINER_MODE=no) + AC_MSG_RESULT([$USE_MAINTAINER_MODE]) + AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes]) + MAINT=$MAINTAINER_MODE_TRUE + AC_SUBST(MAINT)dnl +] +) + +AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE]) + +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 3 + +# AM_MAKE_INCLUDE() +# ----------------- +# Check to see how make treats includes. +AC_DEFUN([AM_MAKE_INCLUDE], +[am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +AC_MSG_CHECKING([for style of include used by $am_make]) +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi +AC_SUBST([am__include]) +AC_SUBST([am__quote]) +AC_MSG_RESULT([$_am_result]) +rm -f confinc confmf +]) + +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- + +# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it supports --run. +# If it does, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + AC_MSG_WARN([`missing' script is too old or missing]) +fi +]) + +# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_MKDIR_P +# --------------- +# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. +# +# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories +# created by `make install' are always world readable, even if the +# installer happens to have an overly restrictive umask (e.g. 077). +# This was a mistake. There are at least two reasons why we must not +# use `-m 0755': +# - it causes special bits like SGID to be ignored, +# - it may be too restrictive (some setups expect 775 directories). +# +# Do not use -m 0755 and let people choose whatever they expect by +# setting umask. +# +# We cannot accept any implementation of `mkdir' that recognizes `-p'. +# Some implementations (such as Solaris 8's) are not thread-safe: if a +# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c' +# concurrently, both version can detect that a/ is missing, but only +# one can create it and the other will error out. Consequently we +# restrict ourselves to GNU make (using the --version option ensures +# this.) +AC_DEFUN([AM_PROG_MKDIR_P], +[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then + # We used to keeping the `.' as first argument, in order to + # allow $(mkdir_p) to be used without argument. As in + # $(mkdir_p) $(somedir) + # where $(somedir) is conditionally defined. However this is wrong + # for two reasons: + # 1. if the package is installed by a user who cannot write `.' + # make install will fail, + # 2. the above comment should most certainly read + # $(mkdir_p) $(DESTDIR)$(somedir) + # so it does not work when $(somedir) is undefined and + # $(DESTDIR) is not. + # To support the latter case, we have to write + # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), + # so the `.' trick is pointless. + mkdir_p='mkdir -p --' +else + # On NextStep and OpenStep, the `mkdir' command does not + # recognize any option. It will interpret all options as + # directories to create, and then abort because `.' already + # exists. + for d in ./-p ./--version; + do + test -d $d && rmdir $d + done + # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. + if test -f "$ac_aux_dir/mkinstalldirs"; then + mkdir_p='$(mkinstalldirs)' + else + mkdir_p='$(install_sh) -d' + fi +fi +AC_SUBST([mkdir_p])]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 3 + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# ------------------------------ +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) + +# _AM_SET_OPTIONS(OPTIONS) +# ---------------------------------- +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +# AM_SANITY_CHECK +# --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 -echo timestamp > conftestfile +echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( - set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` - if test "[$]*" = "X"; then + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$[*]" = "X"; then # -L didn't work. - set X `ls -t $srcdir/configure conftestfile` + set X `ls -t $srcdir/configure conftest.file` fi - if test "[$]*" != "X $srcdir/configure conftestfile" \ - && test "[$]*" != "X conftestfile $srcdir/configure"; then + rm -f conftest.file + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a @@ -296,7 +754,7 @@ if ( alias in your environment]) fi - test "[$]2" = conftestfile + test "$[2]" = conftest.file ) then # Ok. @@ -305,65 +763,130 @@ else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi -rm -f conftest* AC_MSG_RESULT(yes)]) -dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) -dnl The program must properly implement --version. -AC_DEFUN([AM_MISSING_PROG], -[AC_MSG_CHECKING(for working $2) -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if ($2 --version) < /dev/null > /dev/null 2>&1; then - $1=$2 - AC_MSG_RESULT(found) -else - $1="$3/missing $2" - AC_MSG_RESULT(missing) +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_STRIP +# --------------------- +# One issue with vendor `install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in `make install-strip', and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be `maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) fi -AC_SUBST($1)]) +INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) -# Like AC_CONFIG_HEADER, but automatically create stamp file. +# Check how to create a tarball. -*- Autoconf -*- -AC_DEFUN([AM_CONFIG_HEADER], -[AC_PREREQ([2.12]) -AC_CONFIG_HEADER([$1]) -dnl When config.status generates a header, we must update the stamp-h file. -dnl This file resides in the same directory as the config header -dnl that is generated. We must strip everything past the first ":", -dnl and everything past the last "/". -AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl -ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>, -<>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>, -<>; do - case " <<$>>CONFIG_HEADERS " in - *" <<$>>am_file "*<<)>> - echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx +# Copyright (C) 2004, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of `v7', `ustar', or `pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. +AM_MISSING_PROG([AMTAR], [tar]) +m4_if([$1], [v7], + [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], + [m4_case([$1], [ustar],, [pax],, + [m4_fatal([Unknown tar format])]) +AC_MSG_CHECKING([how to create a $1 tar archive]) +# Loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' +_am_tools=${am_cv_prog_tar_$1-$_am_tools} +# Do not fold the above two line into one, because Tru64 sh and +# Solaris sh will not grok spaces in the rhs of `-'. +for _am_tool in $_am_tools +do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; + do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false ;; esac - am_indx=`expr "<<$>>am_indx" + 1` -done<<>>dnl>>) -changequote([,]))]) -# Add --enable-maintainer-mode option to configure. -# From Jim Meyering + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break -# serial 1 + # tar/untar a dummy directory, and stop if the command works + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar /dev/null 2>&1 && break + fi +done +rm -rf conftest.dir -AC_DEFUN([AM_MAINTAINER_MODE], -[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) - dnl maintainer-mode is disabled by default - AC_ARG_ENABLE(maintainer-mode, -[ --enable-maintainer-mode enable make rules and dependencies not useful - (and sometimes confusing) to the casual installer], - USE_MAINTAINER_MODE=$enableval, - USE_MAINTAINER_MODE=no) - AC_MSG_RESULT($USE_MAINTAINER_MODE) - AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes) - MAINT=$MAINTAINER_MODE_TRUE - AC_SUBST(MAINT)dnl -] -) +AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) +AC_MSG_RESULT([$am_cv_prog_tar_$1])]) +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR +m4_include([acinclude.m4]) diff --git a/contrib/binutils/bfd/aout-arm.c b/contrib/binutils/bfd/aout-arm.c index 38ecfab9d41..d8834a4f331 100644 --- a/contrib/binutils/bfd/aout-arm.c +++ b/contrib/binutils/bfd/aout-arm.c @@ -1,23 +1,23 @@ /* BFD back-end for raw ARM a.out binaries. - Copyright 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002 + Copyright 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005 Free Software Foundation, Inc. Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org) -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" @@ -54,66 +54,49 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "libaout.h" #include "aout/aout64.h" -static bfd_boolean MY(write_object_contents) - PARAMS ((bfd *)); -static bfd_reloc_status_type MY(fix_pcrel_26_done) - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static bfd_reloc_status_type MY(fix_pcrel_26) - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static void MY(swap_std_reloc_in) - PARAMS ((bfd *, struct reloc_std_external *, arelent *, asymbol **, - bfd_size_type)); -reloc_howto_type *MY(bfd_reloc_type_lookup) - PARAMS ((bfd *, bfd_reloc_code_real_type)); -reloc_howto_type * MY(reloc_howto) - PARAMS ((bfd *, struct reloc_std_external *, int *, int *, int *)); -void MY(put_reloc) - PARAMS ((bfd *, int, int, bfd_vma, reloc_howto_type *, - struct reloc_std_external *)); -void MY(relocatable_reloc) - PARAMS ((reloc_howto_type *, bfd *, struct reloc_std_external *, bfd_vma *, - bfd_vma)); -void MY(swap_std_reloc_out) - PARAMS ((bfd *, arelent *, struct reloc_std_external *)); -reloc_howto_type MY(howto_table)[] = - { - /* Type rs size bsz pcrel bitpos ovrf sf name part_inpl - readmask setmask pcdone. */ - HOWTO (0, 0, 0, 8, FALSE, 0, complain_overflow_bitfield, 0, "8", TRUE, - 0x000000ff, 0x000000ff, FALSE), - HOWTO (1, 0, 1, 16, FALSE, 0, complain_overflow_bitfield, 0, "16", TRUE, - 0x0000ffff, 0x0000ffff, FALSE), - HOWTO (2, 0, 2, 32, FALSE, 0, complain_overflow_bitfield, 0, "32", TRUE, - 0xffffffff, 0xffffffff, FALSE), - HOWTO (3, 2, 2, 26, TRUE, 0, complain_overflow_signed, MY(fix_pcrel_26), - "ARM26", TRUE, 0x00ffffff, 0x00ffffff, TRUE), - HOWTO (4, 0, 0, 8, TRUE, 0, complain_overflow_signed, 0, "DISP8", TRUE, - 0x000000ff, 0x000000ff, TRUE), - HOWTO (5, 0, 1, 16, TRUE, 0, complain_overflow_signed, 0, "DISP16", TRUE, - 0x0000ffff, 0x0000ffff, TRUE), - HOWTO (6, 0, 2, 32, TRUE, 0, complain_overflow_signed, 0, "DISP32", TRUE, - 0xffffffff, 0xffffffff, TRUE), - HOWTO (7, 2, 2, 26, FALSE, 0, complain_overflow_signed, - MY(fix_pcrel_26_done), "ARM26D", TRUE, 0x0, 0x0, - FALSE), - EMPTY_HOWTO (-1), - HOWTO (9, 0, -1, 16, FALSE, 0, complain_overflow_bitfield, 0, "NEG16", TRUE, - 0x0000ffff, 0x0000ffff, FALSE), - HOWTO (10, 0, -2, 32, FALSE, 0, complain_overflow_bitfield, 0, "NEG32", TRUE, - 0xffffffff, 0xffffffff, FALSE) - }; +static bfd_reloc_status_type + MY (fix_pcrel_26) (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); +static bfd_reloc_status_type + MY (fix_pcrel_26_done) (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); + +reloc_howto_type MY (howto_table)[] = +{ + /* Type rs size bsz pcrel bitpos ovrf sf name part_inpl + readmask setmask pcdone. */ + HOWTO (0, 0, 0, 8, FALSE, 0, complain_overflow_bitfield, 0, "8", TRUE, + 0x000000ff, 0x000000ff, FALSE), + HOWTO (1, 0, 1, 16, FALSE, 0, complain_overflow_bitfield, 0, "16", TRUE, + 0x0000ffff, 0x0000ffff, FALSE), + HOWTO (2, 0, 2, 32, FALSE, 0, complain_overflow_bitfield, 0, "32", TRUE, + 0xffffffff, 0xffffffff, FALSE), + HOWTO (3, 2, 2, 26, TRUE, 0, complain_overflow_signed, MY (fix_pcrel_26), + "ARM26", TRUE, 0x00ffffff, 0x00ffffff, TRUE), + HOWTO (4, 0, 0, 8, TRUE, 0, complain_overflow_signed, 0, "DISP8", TRUE, + 0x000000ff, 0x000000ff, TRUE), + HOWTO (5, 0, 1, 16, TRUE, 0, complain_overflow_signed, 0, "DISP16", TRUE, + 0x0000ffff, 0x0000ffff, TRUE), + HOWTO (6, 0, 2, 32, TRUE, 0, complain_overflow_signed, 0, "DISP32", TRUE, + 0xffffffff, 0xffffffff, TRUE), + HOWTO (7, 2, 2, 26, FALSE, 0, complain_overflow_signed, + MY (fix_pcrel_26_done), "ARM26D", TRUE, 0x0, 0x0, + FALSE), + EMPTY_HOWTO (-1), + HOWTO (9, 0, -1, 16, FALSE, 0, complain_overflow_bitfield, 0, "NEG16", TRUE, + 0x0000ffff, 0x0000ffff, FALSE), + HOWTO (10, 0, -2, 32, FALSE, 0, complain_overflow_bitfield, 0, "NEG32", TRUE, + 0xffffffff, 0xffffffff, FALSE) +}; #define RELOC_ARM_BITS_NEG_BIG ((unsigned int) 0x08) #define RELOC_ARM_BITS_NEG_LITTLE ((unsigned int) 0x10) -reloc_howto_type * -MY(reloc_howto) (abfd, rel, r_index, r_extern, r_pcrel) - bfd *abfd; - struct reloc_std_external *rel; - int *r_index; - int *r_extern; - int *r_pcrel; +static reloc_howto_type * +MY (reloc_howto) (bfd *abfd, + struct reloc_std_external *rel, + int *r_index, + int *r_extern, + int *r_pcrel) { unsigned int r_length; unsigned int r_pcrel_done; @@ -147,20 +130,19 @@ MY(reloc_howto) (abfd, rel, r_index, r_extern, r_pcrel) if (index == 3) *r_pcrel = 1; - return MY(howto_table) + index; + return MY (howto_table) + index; } #define MY_reloc_howto(BFD, REL, IN, EX, PC) \ - MY(reloc_howto) (BFD, REL, &IN, &EX, &PC) + MY (reloc_howto) (BFD, REL, &IN, &EX, &PC) -void -MY(put_reloc) (abfd, r_extern, r_index, value, howto, reloc) - bfd *abfd; - int r_extern; - int r_index; - bfd_vma value; - reloc_howto_type *howto; - struct reloc_std_external *reloc; +static void +MY (put_reloc) (bfd *abfd, + int r_extern, + int r_index, + bfd_vma value, + reloc_howto_type *howto, + struct reloc_std_external *reloc) { unsigned int r_length; int r_pcrel; @@ -202,25 +184,22 @@ MY(put_reloc) (abfd, r_extern, r_index, value, howto, reloc) } #define MY_put_reloc(BFD, EXT, IDX, VAL, HOWTO, RELOC) \ - MY(put_reloc) (BFD, EXT, IDX, VAL, HOWTO, RELOC) + MY (put_reloc) (BFD, EXT, IDX, VAL, HOWTO, RELOC) -void -MY(relocatable_reloc) (howto, abfd, reloc, amount, r_addr) - reloc_howto_type *howto; - bfd *abfd; - struct reloc_std_external *reloc; - bfd_vma *amount; - bfd_vma r_addr; +static void +MY (relocatable_reloc) (reloc_howto_type *howto, + bfd *abfd, + struct reloc_std_external *reloc, + bfd_vma *amount, + bfd_vma r_addr) { if (howto->type == 3) { if (reloc->r_type[0] & (bfd_header_big_endian (abfd) ? RELOC_STD_BITS_EXTERN_BIG : RELOC_STD_BITS_EXTERN_LITTLE)) - { - /* The reloc is still external, so don't modify anything. */ - *amount = 0; - } + /* The reloc is still external, so don't modify anything. */ + *amount = 0; else { *amount -= r_addr; @@ -237,33 +216,29 @@ MY(relocatable_reloc) (howto, abfd, reloc, amount, r_addr) } #define MY_relocatable_reloc(HOW, BFD, REL, AMOUNT, ADDR) \ - MY(relocatable_reloc) (HOW, BFD, REL, &(AMOUNT), ADDR) + MY (relocatable_reloc) (HOW, BFD, REL, &(AMOUNT), ADDR) static bfd_reloc_status_type -MY(fix_pcrel_26_done) (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; +MY (fix_pcrel_26_done) (bfd *abfd ATTRIBUTE_UNUSED, + arelent *reloc_entry ATTRIBUTE_UNUSED, + asymbol *symbol ATTRIBUTE_UNUSED, + void * data ATTRIBUTE_UNUSED, + asection *input_section ATTRIBUTE_UNUSED, + bfd *output_bfd ATTRIBUTE_UNUSED, + char **error_message ATTRIBUTE_UNUSED) { /* This is dead simple at present. */ return bfd_reloc_ok; } static bfd_reloc_status_type -MY(fix_pcrel_26) (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message ATTRIBUTE_UNUSED; +MY (fix_pcrel_26) (bfd *abfd, + arelent *reloc_entry, + asymbol *symbol, + void * data, + asection *input_section, + bfd *output_bfd, + char **error_message ATTRIBUTE_UNUSED) { bfd_vma relocation; bfd_size_type addr = reloc_entry->address; @@ -278,7 +253,7 @@ MY(fix_pcrel_26) (abfd, reloc_entry, symbol, data, input_section, /* If the sections are different, and we are doing a partial relocation, just ignore it for now. */ if (symbol->section->name != input_section->name - && output_bfd != (bfd *)NULL) + && output_bfd != NULL) return bfd_reloc_ok; relocation = (target & 0x00ffffff) << 2; @@ -308,17 +283,17 @@ MY(fix_pcrel_26) (abfd, reloc_entry, symbol, data, input_section, /* Now the ARM magic... Change the reloc type so that it is marked as done. Strictly this is only necessary if we are doing a partial relocation. */ - reloc_entry->howto = &MY(howto_table)[7]; + reloc_entry->howto = &MY (howto_table)[7]; return flag; } -reloc_howto_type * -MY(bfd_reloc_type_lookup) (abfd,code) - bfd *abfd; - bfd_reloc_code_real_type code; +static reloc_howto_type * +MY (bfd_reloc_type_lookup) (bfd *abfd, + bfd_reloc_code_real_type code) { -#define ASTD(i,j) case i: return &MY(howto_table)[j] +#define ASTD(i,j) case i: return & MY (howto_table)[j] + if (code == BFD_RELOC_CTOR) switch (bfd_get_arch_info (abfd)->bits_per_address) { @@ -326,7 +301,7 @@ MY(bfd_reloc_type_lookup) (abfd,code) code = BFD_RELOC_32; break; default: - return (const struct reloc_howto_struct *) 0; + return NULL; } switch (code) @@ -338,26 +313,25 @@ MY(bfd_reloc_type_lookup) (abfd,code) ASTD (BFD_RELOC_16_PCREL, 5); ASTD (BFD_RELOC_32_PCREL, 6); default: - return (const struct reloc_howto_struct *) 0; + return NULL; } } -#define MY_swap_std_reloc_in MY(swap_std_reloc_in) -#define MY_swap_std_reloc_out MY(swap_std_reloc_out) -#define MY_get_section_contents _bfd_generic_get_section_contents -/* #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_bfd_final_link _bfd_generic_final_link */ +#define MY_swap_std_reloc_in MY (swap_std_reloc_in) +#define MY_swap_std_reloc_out MY (swap_std_reloc_out) +#define MY_get_section_contents _bfd_generic_get_section_contents + +void MY_swap_std_reloc_in (bfd *, struct reloc_std_external *, arelent *, asymbol **, bfd_size_type); +void MY_swap_std_reloc_out (bfd *, arelent *, struct reloc_std_external *); #include "aoutx.h" -static void -MY_swap_std_reloc_in (abfd, bytes, cache_ptr, symbols, symcount) - bfd *abfd; - struct reloc_std_external *bytes; - arelent *cache_ptr; - asymbol **symbols; - bfd_size_type symcount ATTRIBUTE_UNUSED; +void +MY_swap_std_reloc_in (bfd *abfd, + struct reloc_std_external *bytes, + arelent *cache_ptr, + asymbol **symbols, + bfd_size_type symcount ATTRIBUTE_UNUSED) { int r_index; int r_extern; @@ -372,10 +346,9 @@ MY_swap_std_reloc_in (abfd, bytes, cache_ptr, symbols, symcount) } void -MY_swap_std_reloc_out (abfd, g, natptr) - bfd *abfd; - arelent *g; - struct reloc_std_external *natptr; +MY_swap_std_reloc_out (bfd *abfd, + arelent *g, + struct reloc_std_external *natptr) { int r_index; asymbol *sym = *(g->sym_ptr_ptr); @@ -385,21 +358,19 @@ MY_swap_std_reloc_out (abfd, g, natptr) int r_neg = 0; /* Negative relocs use the BASEREL bit. */ asection *output_section = sym->section->output_section; - PUT_WORD(abfd, g->address, natptr->r_address); + PUT_WORD (abfd, g->address, natptr->r_address); - r_length = g->howto->size ; /* Size as a power of two */ + r_length = g->howto->size ; /* Size as a power of two. */ if (r_length < 0) { r_length = -r_length; r_neg = 1; } - r_pcrel = (int) g->howto->pc_relative; /* Relative to PC? */ + r_pcrel = (int) g->howto->pc_relative; /* Relative to PC? */ /* For RISC iX, in pc-relative relocs the r_pcrel bit means that the - relocation has been done already (Only for the 26-bit one I think)???!!! - */ - + relocation has been done already (Only for the 26-bit one I think). */ if (g->howto->type == 3) { r_length = 3; @@ -411,20 +382,14 @@ MY_swap_std_reloc_out (abfd, g, natptr) r_pcrel = 1; } -#if 0 - /* For a standard reloc, the addend is in the object file. */ - r_addend = g->addend + (*(g->sym_ptr_ptr))->section->output_section->vma; -#endif - - /* name was clobbered by aout_write_syms to be symbol index */ + /* Name was clobbered by aout_write_syms to be symbol index. */ /* If this relocation is relative to a symbol then set the r_index to the symbols index, and the r_extern bit. Absolute symbols can come in in two ways, either as an offset from the abs section, or as a symbol which has an abs value. - check for that here - */ + check for that here. */ if (bfd_is_com_section (output_section) || output_section == &bfd_abs_section @@ -483,83 +448,83 @@ MY_swap_std_reloc_out (abfd, g, natptr) extern const bfd_target aout_arm_big_vec; const bfd_target aout_arm_little_vec = - { - "a.out-arm-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 | DYNAMIC | WP_TEXT | D_PAGED), - (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA), - MY_symbol_leading_char, - AR_PAD_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}, +{ + "a.out-arm-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 | DYNAMIC | WP_TEXT | D_PAGED), + (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA), + MY_symbol_leading_char, + AR_PAD_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, /* Headers. */ + {_bfd_dummy_target, MY_object_p, /* bfd_check_format. */ + bfd_generic_archive_p, MY_core_file_p}, + {bfd_false, MY_mkobject, /* bfd_set_format. */ + _bfd_generic_mkarchive, bfd_false}, + {bfd_false, MY_write_object_contents, /* bfd_write_contents. */ + _bfd_write_archive_contents, bfd_false}, - BFD_JUMP_TABLE_GENERIC (MY), - BFD_JUMP_TABLE_COPY (MY), - BFD_JUMP_TABLE_CORE (MY), - BFD_JUMP_TABLE_ARCHIVE (MY), - BFD_JUMP_TABLE_SYMBOLS (MY), - BFD_JUMP_TABLE_RELOCS (MY), - BFD_JUMP_TABLE_WRITE (MY), - BFD_JUMP_TABLE_LINK (MY), - BFD_JUMP_TABLE_DYNAMIC (MY), + BFD_JUMP_TABLE_GENERIC (MY), + BFD_JUMP_TABLE_COPY (MY), + BFD_JUMP_TABLE_CORE (MY), + BFD_JUMP_TABLE_ARCHIVE (MY), + BFD_JUMP_TABLE_SYMBOLS (MY), + BFD_JUMP_TABLE_RELOCS (MY), + BFD_JUMP_TABLE_WRITE (MY), + BFD_JUMP_TABLE_LINK (MY), + BFD_JUMP_TABLE_DYNAMIC (MY), - & aout_arm_big_vec, + & aout_arm_big_vec, - (PTR) MY_backend_data, - }; + (void *) MY_backend_data, +}; const bfd_target aout_arm_big_vec = - { - "a.out-arm-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 | DYNAMIC | WP_TEXT | D_PAGED), - (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA), - MY_symbol_leading_char, - AR_PAD_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}, +{ + "a.out-arm-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 | DYNAMIC | WP_TEXT | D_PAGED), + (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA), + MY_symbol_leading_char, + AR_PAD_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, /* Headers. */ + {_bfd_dummy_target, MY_object_p, /* bfd_check_format. */ + bfd_generic_archive_p, MY_core_file_p}, + {bfd_false, MY_mkobject, /* bfd_set_format. */ + _bfd_generic_mkarchive, bfd_false}, + {bfd_false, MY_write_object_contents, /* bfd_write_contents. */ + _bfd_write_archive_contents, bfd_false}, - BFD_JUMP_TABLE_GENERIC (MY), - BFD_JUMP_TABLE_COPY (MY), - BFD_JUMP_TABLE_CORE (MY), - BFD_JUMP_TABLE_ARCHIVE (MY), - BFD_JUMP_TABLE_SYMBOLS (MY), - BFD_JUMP_TABLE_RELOCS (MY), - BFD_JUMP_TABLE_WRITE (MY), - BFD_JUMP_TABLE_LINK (MY), - BFD_JUMP_TABLE_DYNAMIC (MY), + BFD_JUMP_TABLE_GENERIC (MY), + BFD_JUMP_TABLE_COPY (MY), + BFD_JUMP_TABLE_CORE (MY), + BFD_JUMP_TABLE_ARCHIVE (MY), + BFD_JUMP_TABLE_SYMBOLS (MY), + BFD_JUMP_TABLE_RELOCS (MY), + BFD_JUMP_TABLE_WRITE (MY), + BFD_JUMP_TABLE_LINK (MY), + BFD_JUMP_TABLE_DYNAMIC (MY), - & aout_arm_little_vec, + & aout_arm_little_vec, - (PTR) MY_backend_data, - }; + (void *) MY_backend_data, +}; diff --git a/contrib/binutils/bfd/aout-encap.c b/contrib/binutils/bfd/aout-encap.c deleted file mode 100644 index 96c70829333..00000000000 --- a/contrib/binutils/bfd/aout-encap.c +++ /dev/null @@ -1,239 +0,0 @@ -/* BFD back-end for a.out files encapsulated with COFF headers. - Copyright 1990, 1991, 1994, 1995, 2000, 2001, 2002, 2003 - Free Software Foundation, Inc. - -This file is part of BFD, the Binary File Descriptor library. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/* THIS MODULE IS NOT FINISHED. IT PROBABLY DOESN'T EVEN COMPILE. */ - -#if 0 -#define TARGET_PAGE_SIZE 4096 -#define SEGMENT_SIZE TARGET_PAGE_SIZE -#define TEXT_START_ADDR 0 -#endif - -#include "bfd.h" -#include "sysdep.h" -#include "libbfd.h" -#include "aout/aout64.h" -#include "aout/stab_gnu.h" -#include "aout/ar.h" -#include "libaout.h" /* BFD a.out internal data structures */ - -const bfd_target *encap_real_callback (); - -const bfd_target * -encap_object_p (abfd) - bfd *abfd; -{ - unsigned char magicbuf[4]; /* Raw bytes of magic number from file */ - unsigned long magic; /* Swapped magic number */ - short coff_magic; - struct external_exec exec_bytes; - struct internal_exec exec; - bfd_size_type amt = sizeof (magicbuf); - - if (bfd_bread ((PTR) magicbuf, amt, abfd) != amt) - { - if (bfd_get_error () != bfd_error_system_call) - bfd_set_error (bfd_error_wrong_format); - return 0; - } - - coff_magic = H_GET_16 (abfd, magicbuf); - if (coff_magic != COFF_MAGIC) - return 0; /* Not an encap coff file */ - - magic = H_GET_32 (abfd, magicbuf); - - if (N_BADMAG (*((struct internal_exec *) &magic))) - return 0; - - if (bfd_seek (abfd, (file_ptr) sizeof (struct coffheader), SEEK_SET) != 0) - return 0; - - amt = EXEC_BYTES_SIZE; - if (bfd_bread ((PTR) &exec_bytes, amt, abfd) != amt) - { - if (bfd_get_error () != bfd_error_system_call) - bfd_set_error (bfd_error_wrong_format); - return 0; - } - NAME(aout,swap_exec_header_in) (abfd, &exec_bytes, &exec); - - return aout_32_some_aout_object_p (abfd, &exec, encap_realcallback); -} - -/* Finish up the reading of an encapsulated-coff a.out file header. */ -const bfd_target * -encap_real_callback (abfd) - bfd *abfd; -{ - struct internal_exec *execp = exec_hdr (abfd); - - MY(callback) (abfd, execp); - - /* If we have a coff header, it can give us better values for - text_start and exec_data_start. This is particularly useful - for remote debugging of embedded systems. */ - if (N_FLAGS(exec_aouthdr) & N_FLAGS_COFF_ENCAPSULATE) - { - struct coffheader ch; - int val; - val = lseek (execchan, -(sizeof (AOUTHDR) + sizeof (ch)), 1); - if (val == -1) - perror_with_name (filename); - val = myread (execchan, &ch, sizeof (ch)); - if (val < 0) - perror_with_name (filename); - text_start = ch.text_start; - exec_data_start = ch.data_start; - } - else - { - text_start = - IS_OBJECT_FILE (exec_aouthdr) ? 0 : N_TXTADDR (exec_aouthdr); - exec_data_start = (IS_OBJECT_FILE (exec_aouthdr) - ? exec_aouthdr.a_text - : N_DATADDR (exec_aouthdr)); - } - - /* Determine the architecture and machine type of the object file. */ - bfd_default_set_arch_mach(abfd, bfd_arch_m68k, 0); /* FIXME */ - - return abfd->xvec; -} - -/* Write an object file in Encapsulated COFF format. - Section contents have already been written. We write the - file header, symbols, and relocation. */ - -bfd_boolean -encap_write_object_contents (abfd) - bfd *abfd; -{ - bfd_size_type data_pad = 0; - struct external_exec exec_bytes; - struct internal_exec *execp = exec_hdr (abfd); - - /* FIXME: Fragments from the old GNU LD program for dealing with - encap coff. */ - struct coffheader coffheader; - int need_coff_header; - - /* Determine whether to count the header as part of - the text size, and initialize the text size accordingly. - This depends on the kind of system and on the output format selected. */ - - N_SET_MAGIC (outheader, magic); -#ifdef INITIALIZE_HEADER - INITIALIZE_HEADER; -#endif - - text_size = sizeof (struct exec); -#ifdef COFF_ENCAPSULATE - if (relocatable_output == 0 && file_table[0].just_syms_flag == 0) - { - need_coff_header = 1; - /* set this flag now, since it will change the values of N_TXTOFF, etc */ - N_SET_FLAGS (outheader, aout_backend_info (abfd)->exec_hdr_flags); - text_size += sizeof (struct coffheader); - } -#endif - -#ifdef COFF_ENCAPSULATE - if (need_coff_header) - { - /* We are encapsulating BSD format within COFF format. */ - struct coffscn *tp, *dp, *bp; - - tp = &coffheader.scns[0]; - dp = &coffheader.scns[1]; - bp = &coffheader.scns[2]; - - strcpy (tp->s_name, ".text"); - tp->s_paddr = text_start; - tp->s_vaddr = text_start; - tp->s_size = text_size; - tp->s_scnptr = sizeof (struct coffheader) + sizeof (struct exec); - tp->s_relptr = 0; - tp->s_lnnoptr = 0; - tp->s_nreloc = 0; - tp->s_nlnno = 0; - tp->s_flags = 0x20; - strcpy (dp->s_name, ".data"); - dp->s_paddr = data_start; - dp->s_vaddr = data_start; - dp->s_size = data_size; - dp->s_scnptr = tp->s_scnptr + tp->s_size; - dp->s_relptr = 0; - dp->s_lnnoptr = 0; - dp->s_nreloc = 0; - dp->s_nlnno = 0; - dp->s_flags = 0x40; - strcpy (bp->s_name, ".bss"); - bp->s_paddr = dp->s_vaddr + dp->s_size; - bp->s_vaddr = bp->s_paddr; - bp->s_size = bss_size; - bp->s_scnptr = 0; - bp->s_relptr = 0; - bp->s_lnnoptr = 0; - bp->s_nreloc = 0; - bp->s_nlnno = 0; - bp->s_flags = 0x80; - - coffheader.f_magic = COFF_MAGIC; - coffheader.f_nscns = 3; - /* store an unlikely time so programs can - * tell that there is a bsd header - */ - coffheader.f_timdat = 1; - coffheader.f_symptr = 0; - coffheader.f_nsyms = 0; - coffheader.f_opthdr = 28; - coffheader.f_flags = 0x103; - /* aouthdr */ - coffheader.magic = ZMAGIC; - coffheader.vstamp = 0; - coffheader.tsize = tp->s_size; - coffheader.dsize = dp->s_size; - coffheader.bsize = bp->s_size; - coffheader.entry = outheader.a_entry; - coffheader.text_start = tp->s_vaddr; - coffheader.data_start = dp->s_vaddr; - } -#endif - -#ifdef COFF_ENCAPSULATE - if (need_coff_header) - mywrite (&coffheader, sizeof coffheader, 1, outdesc); -#endif - -#ifndef COFF_ENCAPSULATE - padfile (N_TXTOFF (outheader) - sizeof outheader, outdesc); -#endif - - text_size -= N_TXTOFF (outheader); - WRITE_HEADERS(abfd, execp); - return TRUE; -} - -#define MY_write_object_content encap_write_object_contents -#define MY_object_p encap_object_p -#define MY_exec_hdr_flags N_FLAGS_COFF_ENCAPSULATE - -#include "aout-target.h" diff --git a/contrib/binutils/bfd/aout-sparcle.c b/contrib/binutils/bfd/aout-sparcle.c index 7772c290dea..23347316409 100644 --- a/contrib/binutils/bfd/aout-sparcle.c +++ b/contrib/binutils/bfd/aout-sparcle.c @@ -16,7 +16,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #define TARGETNAME "a.out-sparc-little" diff --git a/contrib/binutils/bfd/aout-target.h b/contrib/binutils/bfd/aout-target.h index d8cad54708d..5a30eda7414 100644 --- a/contrib/binutils/bfd/aout-target.h +++ b/contrib/binutils/bfd/aout-target.h @@ -1,23 +1,23 @@ /* Define a target vector and some small routines for a variant of a.out. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003 + 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "aout/aout64.h" #include "aout/stab_gnu.h" @@ -28,30 +28,26 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define SEGMENT_SIZE TARGET_PAGE_SIZE #endif -extern reloc_howto_type * NAME(aout,reloc_type_lookup) - PARAMS ((bfd *, bfd_reloc_code_real_type)); +extern reloc_howto_type * NAME (aout, reloc_type_lookup) (bfd *, bfd_reloc_code_real_type); /* Set parameters about this a.out file that are machine-dependent. This routine is called from some_aout_object_p just before it returns. */ #ifndef MY_callback -static const bfd_target *MY(callback) PARAMS ((bfd *)); - static const bfd_target * -MY(callback) (abfd) - bfd *abfd; +MY (callback) (bfd *abfd) { struct internal_exec *execp = exec_hdr (abfd); unsigned int arch_align_power; unsigned long arch_align; - /* Calculate the file positions of the parts of a newly read aout header */ - obj_textsec (abfd)->_raw_size = N_TXTSIZE(*execp); + /* Calculate the file positions of the parts of a newly read aout header. */ + obj_textsec (abfd)->size = N_TXTSIZE (*execp); - /* The virtual memory addresses of the sections */ - obj_textsec (abfd)->vma = N_TXTADDR(*execp); - obj_datasec (abfd)->vma = N_DATADDR(*execp); - obj_bsssec (abfd)->vma = N_BSSADDR(*execp); + /* The virtual memory addresses of the sections. */ + obj_textsec (abfd)->vma = N_TXTADDR (*execp); + obj_datasec (abfd)->vma = N_DATADDR (*execp); + obj_bsssec (abfd)->vma = N_BSSADDR (*execp); /* For some targets, if the entry point is not in the same page as the start of the text, then adjust the VMA so that it is. @@ -74,13 +70,13 @@ MY(callback) (abfd) obj_datasec (abfd)->lma = obj_datasec (abfd)->vma; obj_bsssec (abfd)->lma = obj_bsssec (abfd)->vma; - /* The file offsets of the sections */ + /* The file offsets of the sections. */ obj_textsec (abfd)->filepos = N_TXTOFF (*execp); obj_datasec (abfd)->filepos = N_DATOFF (*execp); - /* The file offsets of the relocation info */ - obj_textsec (abfd)->rel_filepos = N_TRELOFF(*execp); - obj_datasec (abfd)->rel_filepos = N_DRELOFF(*execp); + /* The file offsets of the relocation info. */ + obj_textsec (abfd)->rel_filepos = N_TRELOFF (*execp); + obj_datasec (abfd)->rel_filepos = N_DRELOFF (*execp); /* The file offsets of the string table and symbol table. */ obj_sym_filepos (abfd) = N_SYMOFF (*execp); @@ -103,19 +99,19 @@ MY(callback) (abfd) execp->a_drsize / obj_reloc_entry_size (abfd); /* Now that we know the architecture, set the alignments of the - sections. This is normally done by NAME(aout,new_section_hook), + sections. This is normally done by NAME (aout,new_section_hook), but when the initial sections were created the architecture had not yet been set. However, for backward compatibility, we don't set the alignment power any higher than as required by the size of the section. */ arch_align_power = bfd_get_arch_info (abfd)->section_align_power; arch_align = 1 << arch_align_power; - if ((BFD_ALIGN (obj_textsec (abfd)->_raw_size, arch_align) - == obj_textsec (abfd)->_raw_size) - && (BFD_ALIGN (obj_datasec (abfd)->_raw_size, arch_align) - == obj_datasec (abfd)->_raw_size) - && (BFD_ALIGN (obj_bsssec (abfd)->_raw_size, arch_align) - == obj_bsssec (abfd)->_raw_size)) + if ((BFD_ALIGN (obj_textsec (abfd)->size, arch_align) + == obj_textsec (abfd)->size) + && (BFD_ALIGN (obj_datasec (abfd)->size, arch_align) + == obj_datasec (abfd)->size) + && (BFD_ALIGN (obj_bsssec (abfd)->size, arch_align) + == obj_bsssec (abfd)->size)) { obj_textsec (abfd)->alignment_power = arch_align_power; obj_datasec (abfd)->alignment_power = arch_align_power; @@ -124,31 +120,23 @@ MY(callback) (abfd) /* Don't set sizes now -- can't be sure until we know arch & mach. Sizes get set in set_sizes callback, later. */ -#if 0 - adata(abfd).page_size = TARGET_PAGE_SIZE; - adata(abfd).segment_size = SEGMENT_SIZE; - adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE; -#endif return abfd->xvec; } #endif #ifndef MY_object_p -/* Finish up the reading of an a.out file header */ - -static const bfd_target *MY(object_p) PARAMS ((bfd *)); +/* Finish up the reading of an a.out file header. */ static const bfd_target * -MY(object_p) (abfd) - bfd *abfd; +MY (object_p) (bfd *abfd) { - struct external_exec exec_bytes; /* Raw exec header from file */ - struct internal_exec exec; /* Cleaned-up exec header */ + struct external_exec exec_bytes; /* Raw exec header from file. */ + struct internal_exec exec; /* Cleaned-up exec header. */ const bfd_target *target; bfd_size_type amt = EXEC_BYTES_SIZE; - if (bfd_bread ((PTR) &exec_bytes, amt, abfd) != amt) + if (bfd_bread ((void *) &exec_bytes, amt, abfd) != amt) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); @@ -159,28 +147,31 @@ MY(object_p) (abfd) exec.a_info = SWAP_MAGIC (exec_bytes.e_info); #else exec.a_info = GET_MAGIC (abfd, exec_bytes.e_info); -#endif /* SWAP_MAGIC */ - - if (N_BADMAG (exec)) return 0; -#ifdef MACHTYPE_OK - if (!(MACHTYPE_OK (N_MACHTYPE (exec)))) return 0; #endif - NAME(aout,swap_exec_header_in) (abfd, &exec_bytes, &exec); + if (N_BADMAG (exec)) + return 0; + +#ifdef MACHTYPE_OK + if (!(MACHTYPE_OK (N_MACHTYPE (exec)))) + return 0; +#endif + + NAME (aout, swap_exec_header_in) (abfd, &exec_bytes, &exec); #ifdef SWAP_MAGIC - /* swap_exec_header_in read in a_info with the wrong byte order */ + /* Swap_exec_header_in read in a_info with the wrong byte order. */ exec.a_info = SWAP_MAGIC (exec_bytes.e_info); -#endif /* SWAP_MAGIC */ +#endif - target = NAME(aout,some_aout_object_p) (abfd, &exec, MY(callback)); + target = NAME (aout, some_aout_object_p) (abfd, &exec, MY (callback)); #ifdef ENTRY_CAN_BE_ZERO /* The NEWSOS3 entry-point is/was 0, which (amongst other lossage) - * means that it isn't obvious if EXEC_P should be set. - * All of the following must be true for an executable: - * There must be no relocations, the bfd can be neither an - * archive nor an archive element, and the file must be executable. */ + means that it isn't obvious if EXEC_P should be set. + All of the following must be true for an executable: + There must be no relocations, the bfd can be neither an + archive nor an archive element, and the file must be executable. */ if (exec.a_trsize + exec.a_drsize == 0 && bfd_get_format(abfd) == bfd_object && abfd->my_archive == NULL) @@ -196,28 +187,18 @@ MY(object_p) (abfd) return target; } -#define MY_object_p MY(object_p) +#define MY_object_p MY (object_p) #endif #ifndef MY_mkobject -static bfd_boolean MY(mkobject) PARAMS ((bfd *)); - static bfd_boolean -MY(mkobject) (abfd) - bfd *abfd; +MY (mkobject) (bfd *abfd) { - if (! NAME(aout,mkobject) (abfd)) - return FALSE; -#if 0 /* Sizes get set in set_sizes callback, later, after we know - the architecture and machine. */ - adata(abfd).page_size = TARGET_PAGE_SIZE; - adata(abfd).segment_size = SEGMENT_SIZE; - adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE; -#endif - return TRUE; + return NAME (aout, mkobject (abfd)); } -#define MY_mkobject MY(mkobject) + +#define MY_mkobject MY (mkobject) #endif #ifndef MY_bfd_copy_private_section_data @@ -228,15 +209,11 @@ MY(mkobject) (abfd) section contents, and copy_private_bfd_data is not called until after the section contents have been set. */ -static bfd_boolean MY_bfd_copy_private_section_data - PARAMS ((bfd *, asection *, bfd *, asection *)); - static bfd_boolean -MY_bfd_copy_private_section_data (ibfd, isec, obfd, osec) - bfd *ibfd; - asection *isec ATTRIBUTE_UNUSED; - bfd *obfd; - asection *osec ATTRIBUTE_UNUSED; +MY_bfd_copy_private_section_data (bfd *ibfd, + asection *isec ATTRIBUTE_UNUSED, + bfd *obfd, + asection *osec ATTRIBUTE_UNUSED) { if (bfd_get_flavour (ibfd) == bfd_target_aout_flavour && bfd_get_flavour (obfd) == bfd_target_aout_flavour) @@ -251,31 +228,26 @@ MY_bfd_copy_private_section_data (ibfd, isec, obfd, osec) file header, symbols, and relocation. */ #ifndef MY_write_object_contents -static bfd_boolean MY(write_object_contents) PARAMS ((bfd *)); static bfd_boolean -MY(write_object_contents) (abfd) - bfd *abfd; +MY (write_object_contents) (bfd *abfd) { struct external_exec exec_bytes; struct internal_exec *execp = exec_hdr (abfd); obj_reloc_entry_size (abfd) = RELOC_STD_SIZE; - WRITE_HEADERS(abfd, execp); + WRITE_HEADERS (abfd, execp); return TRUE; } -#define MY_write_object_contents MY(write_object_contents) +#define MY_write_object_contents MY (write_object_contents) #endif #ifndef MY_set_sizes -static bfd_boolean MY(set_sizes) PARAMS ((bfd *)); - static bfd_boolean -MY(set_sizes) (abfd) - bfd *abfd; +MY (set_sizes) (bfd *abfd) { adata(abfd).page_size = TARGET_PAGE_SIZE; adata(abfd).segment_size = SEGMENT_SIZE; @@ -289,7 +261,7 @@ MY(set_sizes) (abfd) adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE; return TRUE; } -#define MY_set_sizes MY(set_sizes) +#define MY_set_sizes MY (set_sizes) #endif #ifndef MY_exec_hdr_flags @@ -329,12 +301,13 @@ MY(set_sizes) (abfd) #define MY_finish_dynamic_link 0 #endif -static const struct aout_backend_data MY(backend_data) = { +static const struct aout_backend_data MY (backend_data) = +{ MY_zmagic_contiguous, MY_text_includes_header, MY_entry_is_text_address, MY_exec_hdr_flags, - 0, /* text vma? */ + 0, /* Text vma? */ MY_set_sizes, MY_exec_header_not_counted, MY_add_dynamic_symbols, @@ -344,22 +317,18 @@ static const struct aout_backend_data MY(backend_data) = { MY_check_dynamic_reloc, MY_finish_dynamic_link }; -#define MY_backend_data &MY(backend_data) +#define MY_backend_data &MY (backend_data) #endif #ifndef MY_final_link_callback /* Callback for the final_link routine to set the section offsets. */ -static void MY_final_link_callback - PARAMS ((bfd *, file_ptr *, file_ptr *, file_ptr *)); - static void -MY_final_link_callback (abfd, ptreloff, pdreloff, psymoff) - bfd *abfd; - file_ptr *ptreloff; - file_ptr *pdreloff; - file_ptr *psymoff; +MY_final_link_callback (bfd *abfd, + file_ptr *ptreloff, + file_ptr *pdreloff, + file_ptr *psymoff) { struct internal_exec *execp = exec_hdr (abfd); @@ -375,14 +344,10 @@ MY_final_link_callback (abfd, ptreloff, pdreloff, psymoff) /* Final link routine. We need to use a call back to get the correct offsets in the output file. */ -static bfd_boolean MY_bfd_final_link PARAMS ((bfd *, struct bfd_link_info *)); - static bfd_boolean -MY_bfd_final_link (abfd, info) - bfd *abfd; - struct bfd_link_info *info; +MY_bfd_final_link (bfd *abfd, struct bfd_link_info *info) { - return NAME(aout,final_link) (abfd, info, MY_final_link_callback); + return NAME (aout, final_link) (abfd, info, MY_final_link_callback); } #endif @@ -443,62 +408,65 @@ MY_bfd_final_link (abfd, info) #endif #ifndef MY_bfd_debug_info_accumulate #define MY_bfd_debug_info_accumulate \ - (void (*) PARAMS ((bfd*, struct bfd_section *))) bfd_void + (void (*) (bfd *, struct bfd_section *)) bfd_void #endif #ifndef MY_core_file_failing_command -#define MY_core_file_failing_command NAME(aout,core_file_failing_command) +#define MY_core_file_failing_command NAME (aout, core_file_failing_command) #endif #ifndef MY_core_file_failing_signal -#define MY_core_file_failing_signal NAME(aout,core_file_failing_signal) +#define MY_core_file_failing_signal NAME (aout, core_file_failing_signal) #endif #ifndef MY_core_file_matches_executable_p -#define MY_core_file_matches_executable_p NAME(aout,core_file_matches_executable_p) +#define MY_core_file_matches_executable_p NAME (aout, core_file_matches_executable_p) #endif #ifndef MY_set_section_contents -#define MY_set_section_contents NAME(aout,set_section_contents) +#define MY_set_section_contents NAME (aout, set_section_contents) #endif #ifndef MY_get_section_contents -#define MY_get_section_contents NAME(aout,get_section_contents) +#define MY_get_section_contents NAME (aout, get_section_contents) #endif #ifndef MY_get_section_contents_in_window #define MY_get_section_contents_in_window _bfd_generic_get_section_contents_in_window #endif #ifndef MY_new_section_hook -#define MY_new_section_hook NAME(aout,new_section_hook) +#define MY_new_section_hook NAME (aout, new_section_hook) #endif #ifndef MY_get_symtab_upper_bound -#define MY_get_symtab_upper_bound NAME(aout,get_symtab_upper_bound) +#define MY_get_symtab_upper_bound NAME (aout, get_symtab_upper_bound) #endif #ifndef MY_canonicalize_symtab -#define MY_canonicalize_symtab NAME(aout,canonicalize_symtab) +#define MY_canonicalize_symtab NAME (aout, canonicalize_symtab) #endif #ifndef MY_get_reloc_upper_bound -#define MY_get_reloc_upper_bound NAME(aout,get_reloc_upper_bound) +#define MY_get_reloc_upper_bound NAME (aout,get_reloc_upper_bound) #endif #ifndef MY_canonicalize_reloc -#define MY_canonicalize_reloc NAME(aout,canonicalize_reloc) +#define MY_canonicalize_reloc NAME (aout, canonicalize_reloc) #endif #ifndef MY_make_empty_symbol -#define MY_make_empty_symbol NAME(aout,make_empty_symbol) +#define MY_make_empty_symbol NAME (aout, make_empty_symbol) #endif #ifndef MY_print_symbol -#define MY_print_symbol NAME(aout,print_symbol) +#define MY_print_symbol NAME (aout, print_symbol) #endif #ifndef MY_get_symbol_info -#define MY_get_symbol_info NAME(aout,get_symbol_info) +#define MY_get_symbol_info NAME (aout, get_symbol_info) #endif #ifndef MY_get_lineno -#define MY_get_lineno NAME(aout,get_lineno) +#define MY_get_lineno NAME (aout, get_lineno) #endif #ifndef MY_set_arch_mach -#define MY_set_arch_mach NAME(aout,set_arch_mach) +#define MY_set_arch_mach NAME (aout, set_arch_mach) #endif #ifndef MY_find_nearest_line -#define MY_find_nearest_line NAME(aout,find_nearest_line) +#define MY_find_nearest_line NAME (aout, find_nearest_line) +#endif +#ifndef MY_find_inliner_info +#define MY_find_inliner_info _bfd_nosymbols_find_inliner_info #endif #ifndef MY_sizeof_headers -#define MY_sizeof_headers NAME(aout,sizeof_headers) +#define MY_sizeof_headers NAME (aout, sizeof_headers) #endif #ifndef MY_bfd_get_relocated_section_contents #define MY_bfd_get_relocated_section_contents \ @@ -513,29 +481,36 @@ MY_bfd_final_link (abfd, info) #ifndef MY_bfd_merge_sections #define MY_bfd_merge_sections bfd_generic_merge_sections #endif +#ifndef MY_bfd_is_group_section +#define MY_bfd_is_group_section bfd_generic_is_group_section +#endif #ifndef MY_bfd_discard_group #define MY_bfd_discard_group bfd_generic_discard_group #endif +#ifndef MY_section_already_linked +#define MY_section_already_linked \ + _bfd_generic_section_already_linked +#endif #ifndef MY_bfd_reloc_type_lookup -#define MY_bfd_reloc_type_lookup NAME(aout,reloc_type_lookup) +#define MY_bfd_reloc_type_lookup NAME (aout, reloc_type_lookup) #endif #ifndef MY_bfd_make_debug_symbol #define MY_bfd_make_debug_symbol 0 #endif #ifndef MY_read_minisymbols -#define MY_read_minisymbols NAME(aout,read_minisymbols) +#define MY_read_minisymbols NAME (aout, read_minisymbols) #endif #ifndef MY_minisymbol_to_symbol -#define MY_minisymbol_to_symbol NAME(aout,minisymbol_to_symbol) +#define MY_minisymbol_to_symbol NAME (aout, minisymbol_to_symbol) #endif #ifndef MY_bfd_link_hash_table_create -#define MY_bfd_link_hash_table_create NAME(aout,link_hash_table_create) +#define MY_bfd_link_hash_table_create NAME (aout, link_hash_table_create) #endif #ifndef MY_bfd_link_hash_table_free #define MY_bfd_link_hash_table_free _bfd_generic_link_hash_table_free #endif #ifndef MY_bfd_link_add_symbols -#define MY_bfd_link_add_symbols NAME(aout,link_add_symbols) +#define MY_bfd_link_add_symbols NAME (aout, link_add_symbols) #endif #ifndef MY_bfd_link_just_syms #define MY_bfd_link_just_syms _bfd_generic_link_just_syms @@ -556,6 +531,10 @@ MY_bfd_final_link (abfd, info) #define MY_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data #endif +#ifndef MY_bfd_copy_private_header_data +#define MY_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data +#endif + #ifndef MY_bfd_print_private_bfd_data #define MY_bfd_print_private_bfd_data _bfd_generic_bfd_print_private_bfd_data #endif @@ -568,8 +547,12 @@ MY_bfd_final_link (abfd, info) #define MY_bfd_is_local_label_name bfd_generic_is_local_label_name #endif +#ifndef MY_bfd_is_target_special_symbol +#define MY_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) +#endif + #ifndef MY_bfd_free_cached_info -#define MY_bfd_free_cached_info NAME(aout,bfd_free_cached_info) +#define MY_bfd_free_cached_info NAME (aout, bfd_free_cached_info) #endif #ifndef MY_close_and_cleanup @@ -584,6 +567,10 @@ MY_bfd_final_link (abfd, info) #define MY_canonicalize_dynamic_symtab \ _bfd_nodynamic_canonicalize_dynamic_symtab #endif +#ifndef MY_get_synthetic_symtab +#define MY_get_synthetic_symtab \ + _bfd_nodynamic_get_synthetic_symtab +#endif #ifndef MY_get_dynamic_reloc_upper_bound #define MY_get_dynamic_reloc_upper_bound \ _bfd_nodynamic_get_dynamic_reloc_upper_bound @@ -593,55 +580,55 @@ MY_bfd_final_link (abfd, info) _bfd_nodynamic_canonicalize_dynamic_reloc #endif -/* Aout symbols normally have leading underscores */ +/* Aout symbols normally have leading underscores. */ #ifndef MY_symbol_leading_char #define MY_symbol_leading_char '_' #endif -/* Aout archives normally use spaces for padding */ +/* Aout archives normally use spaces for padding. */ #ifndef AR_PAD_CHAR #define AR_PAD_CHAR ' ' #endif #ifndef MY_BFD_TARGET -const bfd_target MY(vec) = +const bfd_target MY (vec) = { - TARGETNAME, /* name */ + TARGETNAME, /* Name. */ bfd_target_aout_flavour, #ifdef TARGET_IS_BIG_ENDIAN_P - BFD_ENDIAN_BIG, /* target byte order (big) */ - BFD_ENDIAN_BIG, /* target headers byte order (big) */ + BFD_ENDIAN_BIG, /* Target byte order (big). */ + BFD_ENDIAN_BIG, /* Target headers byte order (big). */ #else - BFD_ENDIAN_LITTLE, /* target byte order (little) */ - BFD_ENDIAN_LITTLE, /* target headers byte order (little) */ + BFD_ENDIAN_LITTLE, /* Target byte order (little). */ + BFD_ENDIAN_LITTLE, /* Target headers byte order (little). */ #endif - (HAS_RELOC | EXEC_P | /* object flags */ + (HAS_RELOC | EXEC_P | /* Object flags. */ HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED), (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA), MY_symbol_leading_char, - AR_PAD_CHAR, /* ar_pad_char */ - 15, /* ar_max_namelen */ + AR_PAD_CHAR, /* AR_pad_char. */ + 15, /* AR_max_namelen. */ #ifdef TARGET_IS_BIG_ENDIAN_P bfd_getb64, bfd_getb_signed_64, bfd_putb64, bfd_getb32, bfd_getb_signed_32, bfd_putb32, - bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */ + bfd_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_getb16, bfd_getb_signed_16, bfd_putb16, /* Headers. */ #else bfd_getl64, bfd_getl_signed_64, bfd_putl64, bfd_getl32, bfd_getl_signed_32, bfd_putl32, - bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ + bfd_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_getl16, bfd_getl_signed_16, bfd_putl16, /* Headers. */ #endif - {_bfd_dummy_target, MY_object_p, /* bfd_check_format */ + {_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_false, MY_mkobject, /* bfd_set_format. */ _bfd_generic_mkarchive, bfd_false}, - {bfd_false, MY_write_object_contents, /* bfd_write_contents */ + {bfd_false, MY_write_object_contents, /* bfd_write_contents. */ _bfd_write_archive_contents, bfd_false}, BFD_JUMP_TABLE_GENERIC (MY), @@ -654,9 +641,9 @@ const bfd_target MY(vec) = BFD_JUMP_TABLE_LINK (MY), BFD_JUMP_TABLE_DYNAMIC (MY), - /* Alternative_target */ + /* Alternative_target. */ NULL, - (PTR) MY_backend_data + MY_backend_data }; #endif /* MY_BFD_TARGET */ diff --git a/contrib/binutils/bfd/aout0.c b/contrib/binutils/bfd/aout0.c index 731d476cfb3..382fa8e526d 100644 --- a/contrib/binutils/bfd/aout0.c +++ b/contrib/binutils/bfd/aout0.c @@ -17,7 +17,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #define TARGETNAME "a.out-zero-big" diff --git a/contrib/binutils/bfd/aout32.c b/contrib/binutils/bfd/aout32.c index afe7fa21903..dca338edf9f 100644 --- a/contrib/binutils/bfd/aout32.c +++ b/contrib/binutils/bfd/aout32.c @@ -16,7 +16,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #define ARCH_SIZE 32 diff --git a/contrib/binutils/bfd/aout64.c b/contrib/binutils/bfd/aout64.c index 0f31dab6fcb..a18882364d0 100644 --- a/contrib/binutils/bfd/aout64.c +++ b/contrib/binutils/bfd/aout64.c @@ -16,7 +16,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #define ARCH_SIZE 64 diff --git a/contrib/binutils/bfd/aoutf1.h b/contrib/binutils/bfd/aoutf1.h index 352dadf4e54..cba4fbbeff9 100644 --- a/contrib/binutils/bfd/aoutf1.h +++ b/contrib/binutils/bfd/aoutf1.h @@ -1,31 +1,31 @@ /* A.out "format 1" file handling code for BFD. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, - 2001, 2002, 2003 + 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Written by Cygnus Support. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" #include "libbfd.h" #include "aout/sun4.h" -#include "libaout.h" /* BFD a.out internal data structures */ +#include "libaout.h" /* BFD a.out internal data structures. */ #include "aout/aout64.h" #include "aout/stab_gnu.h" @@ -42,30 +42,24 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ && bfd_lookup_arch (bfd_arch_m68k, 0) != NULL)) #endif -/* -The file @code{aoutf1.h} contains the code for BFD's -a.out back end. Control over the generated back end is given by these -two preprocessor names: -@table @code -@item ARCH_SIZE -This value should be either 32 or 64, depending upon the size of an -int in the target format. It changes the sizes of the structs which -perform the memory/disk mapping of structures. +/* The file @code{aoutf1.h} contains the code for BFD's + a.out back end. Control over the generated back end is given by these + two preprocessor names: + @table @code + @item ARCH_SIZE + This value should be either 32 or 64, depending upon the size of an + int in the target format. It changes the sizes of the structs which + perform the memory/disk mapping of structures. -The 64 bit backend may only be used if the host compiler supports 64 -ints (eg long long with gcc), by defining the name @code{BFD_HOST_64_BIT} in @code{bfd.h}. -With this name defined, @emph{all} bfd operations are performed with 64bit -arithmetic, not just those to a 64bit target. + The 64 bit backend may only be used if the host compiler supports 64 + ints (eg long long with gcc), by defining the name @code{BFD_HOST_64_BIT} in @code{bfd.h}. + With this name defined, @emph{all} bfd operations are performed with 64bit + arithmetic, not just those to a 64bit target. -@item TARGETNAME -The name put into the target vector. -@item -@end table - -*/ - -/*SUPPRESS558*/ -/*SUPPRESS529*/ + @item TARGETNAME + The name put into the target vector. + @item + @end table. */ #if ARCH_SIZE == 64 #define sunos_set_arch_mach sunos_64_set_arch_mach @@ -75,25 +69,6 @@ The name put into the target vector. #define sunos_write_object_contents aout_32_sunos4_write_object_contents #endif -static bfd_boolean sunos_merge_private_bfd_data - PARAMS ((bfd *, bfd *)); -static void sunos_set_arch_mach - PARAMS ((bfd *, enum machine_type)); -static void choose_reloc_size - PARAMS ((bfd *)); -static bfd_boolean sunos_write_object_contents - PARAMS ((bfd *)); -static const bfd_target *sunos4_core_file_p - PARAMS ((bfd *)); -static char *sunos4_core_file_failing_command - PARAMS ((bfd *)); -static int sunos4_core_file_failing_signal - PARAMS ((bfd *)); -static bfd_boolean sunos4_core_file_matches_executable_p - PARAMS ((bfd *, bfd *)); -static bfd_boolean sunos4_set_sizes - PARAMS ((bfd *)); - /* Merge backend data into the output file. This is necessary on sparclet-aout where we want the resultant machine number to be M_SPARCLET if any input file is M_SPARCLET. */ @@ -101,8 +76,7 @@ static bfd_boolean sunos4_set_sizes #define MY_bfd_merge_private_bfd_data sunos_merge_private_bfd_data static bfd_boolean -sunos_merge_private_bfd_data (ibfd, obfd) - bfd *ibfd, *obfd; +sunos_merge_private_bfd_data (bfd *ibfd, bfd *obfd) { if (bfd_get_flavour (ibfd) != bfd_target_aout_flavour || bfd_get_flavour (obfd) != bfd_target_aout_flavour) @@ -121,16 +95,14 @@ sunos_merge_private_bfd_data (ibfd, obfd) depending upon ARCH_SIZE. */ static void -sunos_set_arch_mach (abfd, machtype) - bfd *abfd; - enum machine_type machtype; +sunos_set_arch_mach (bfd *abfd, enum machine_type machtype) { /* Determine the architecture and machine type of the object file. */ enum bfd_architecture arch; unsigned long machine; + switch (machtype) { - case M_UNKNOWN: /* Some Sun3s make magic numbers without cpu types in them, so we'll default to the 68000. */ @@ -171,11 +143,6 @@ sunos_set_arch_mach (abfd, machtype) machine = 0; break; - case M_29K: - arch = bfd_arch_a29k; - machine = 0; - break; - case M_HPUX: arch = bfd_arch_m68k; machine = 0; @@ -193,15 +160,14 @@ sunos_set_arch_mach (abfd, machtype) NAME(sunos,set_arch_mach) (ABFD, N_MACHTYPE (EXEC)); \ choose_reloc_size(ABFD); -/* Determine the size of a relocation entry, based on the architecture */ +/* Determine the size of a relocation entry, based on the architecture. */ + static void -choose_reloc_size (abfd) - bfd *abfd; +choose_reloc_size (bfd *abfd) { switch (bfd_get_arch (abfd)) { case bfd_arch_sparc: - case bfd_arch_a29k: obj_reloc_entry_size (abfd) = RELOC_EXT_SIZE; break; default: @@ -217,8 +183,7 @@ choose_reloc_size (abfd) aout_32_sunos4_write_object_contents, depending upon ARCH_SIZE. */ static bfd_boolean -sunos_write_object_contents (abfd) - bfd *abfd; +sunos_write_object_contents (bfd *abfd) { struct external_exec exec_bytes; struct internal_exec *execp = exec_hdr (abfd); @@ -258,9 +223,6 @@ sunos_write_object_contents (abfd) case bfd_arch_i386: N_SET_MACHTYPE (*execp, M_386); break; - case bfd_arch_a29k: - N_SET_MACHTYPE (*execp, M_29K); - break; default: N_SET_MACHTYPE (*execp, M_UNKNOWN); } @@ -276,9 +238,9 @@ sunos_write_object_contents (abfd) return TRUE; } -/* core files */ +/* Core files. */ -#define CORE_MAGIC 0x080456 +#define CORE_MAGIC 0x080456 #define CORE_NAMELEN 16 /* The core structure is taken from the Sun documentation. @@ -320,121 +282,112 @@ struct regs even portably access the stuff in between! */ struct external_sparc_core - { - int c_magic; /* Corefile magic number */ - int c_len; /* Sizeof (struct core) */ +{ + int c_magic; /* Corefile magic number. */ + int c_len; /* Sizeof (struct core). */ #define SPARC_CORE_LEN 432 - int c_regs[19]; /* General purpose registers -- MACHDEP SIZE */ - struct external_exec c_aouthdr; /* A.out header */ - int c_signo; /* Killing signal, if any */ - int c_tsize; /* Text size (bytes) */ - int c_dsize; /* Data size (bytes) */ - int c_ssize; /* Stack size (bytes) */ - char c_cmdname[CORE_NAMELEN + 1]; /* Command name */ - double fp_stuff[1]; /* external FPU state (size unknown by us) */ - /* The type "double" is critical here, for alignment. - SunOS declares a struct here, but the struct's alignment - is double since it contains doubles. */ - int c_ucode; /* Exception no. from u_code */ - /* (this member is not accessible by name since we don't - portably know the size of fp_stuff.) */ - }; + struct regs c_regs; /* General purpose registers -- MACHDEP SIZE. */ + struct external_exec c_aouthdr; /* A.out header. */ + int c_signo; /* Killing signal, if any. */ + int c_tsize; /* Text size (bytes). */ + int c_dsize; /* Data size (bytes). */ + int c_ssize; /* Stack size (bytes). */ + char c_cmdname[CORE_NAMELEN + 1]; /* Command name. */ + double fp_stuff[1]; /* External FPU state (size unknown by us). */ + /* The type "double" is critical here, for alignment. + SunOS declares a struct here, but the struct's + alignment is double since it contains doubles. */ + int c_ucode; /* Exception no. from u_code. */ + /* This member is not accessible by name since + we don't portably know the size of fp_stuff. */ +}; /* Core files generated by the BCP (the part of Solaris which allows it to run SunOS4 a.out files). */ struct external_solaris_bcp_core - { - int c_magic; /* Corefile magic number */ - int c_len; /* Sizeof (struct core) */ +{ + int c_magic; /* Corefile magic number. */ + int c_len; /* Sizeof (struct core). */ #define SOLARIS_BCP_CORE_LEN 456 - int c_regs[19]; /* General purpose registers -- MACHDEP SIZE */ - int c_exdata_vp; /* exdata structure */ - int c_exdata_tsize; - int c_exdata_dsize; - int c_exdata_bsize; - int c_exdata_lsize; - int c_exdata_nshlibs; - short c_exdata_mach; - short c_exdata_mag; - int c_exdata_toffset; - int c_exdata_doffset; - int c_exdata_loffset; - int c_exdata_txtorg; - int c_exdata_datorg; - int c_exdata_entloc; - int c_signo; /* Killing signal, if any */ - int c_tsize; /* Text size (bytes) */ - int c_dsize; /* Data size (bytes) */ - int c_ssize; /* Stack size (bytes) */ - char c_cmdname[CORE_NAMELEN + 1]; /* Command name */ - double fp_stuff[1]; /* external FPU state (size unknown by us) */ - /* The type "double" is critical here, for alignment. - SunOS declares a struct here, but the struct's alignment - is double since it contains doubles. */ - int c_ucode; /* Exception no. from u_code */ - /* (this member is not accessible by name since we don't - portably know the size of fp_stuff.) */ - }; + struct regs c_regs; /* General purpose registers -- MACHDEP SIZE. */ + int c_exdata_vp; /* Exdata structure. */ + int c_exdata_tsize; + int c_exdata_dsize; + int c_exdata_bsize; + int c_exdata_lsize; + int c_exdata_nshlibs; + short c_exdata_mach; + short c_exdata_mag; + int c_exdata_toffset; + int c_exdata_doffset; + int c_exdata_loffset; + int c_exdata_txtorg; + int c_exdata_datorg; + int c_exdata_entloc; + int c_signo; /* Killing signal, if any. */ + int c_tsize; /* Text size (bytes). */ + int c_dsize; /* Data size (bytes). */ + int c_ssize; /* Stack size (bytes). */ + char c_cmdname[CORE_NAMELEN + 1]; /* Command name. */ + double fp_stuff[1]; /* External FPU state (size unknown by us). */ + /* The type "double" is critical here, for alignment. + SunOS declares a struct here, but the struct's + alignment is double since it contains doubles. */ + int c_ucode; /* Exception no. from u_code. */ + /* This member is not accessible by name since + we don't portably know the size of fp_stuff. */ +}; struct external_sun3_core - { - int c_magic; /* Corefile magic number */ - int c_len; /* Sizeof (struct core) */ -#define SUN3_CORE_LEN 826 /* As of SunOS 4.1.1 */ - int c_regs[18]; /* General purpose registers -- MACHDEP SIZE */ - struct external_exec c_aouthdr; /* A.out header */ - int c_signo; /* Killing signal, if any */ - int c_tsize; /* Text size (bytes) */ - int c_dsize; /* Data size (bytes) */ - int c_ssize; /* Stack size (bytes) */ - char c_cmdname[CORE_NAMELEN + 1]; /* Command name */ - double fp_stuff[1]; /* external FPU state (size unknown by us) */ - /* The type "double" is critical here, for alignment. - SunOS declares a struct here, but the struct's alignment - is double since it contains doubles. */ - int c_ucode; /* Exception no. from u_code */ - /* (this member is not accessible by name since we don't - portably know the size of fp_stuff.) */ - }; +{ + int c_magic; /* Corefile magic number. */ + int c_len; /* Sizeof (struct core). */ +#define SUN3_CORE_LEN 826 /* As of SunOS 4.1.1. */ + int c_regs[18]; /* General purpose registers -- MACHDEP SIZE. */ + struct external_exec c_aouthdr; /* A.out header. */ + int c_signo; /* Killing signal, if any. */ + int c_tsize; /* Text size (bytes). */ + int c_dsize; /* Data size (bytes). */ + int c_ssize; /* Stack size (bytes). */ + char c_cmdname[CORE_NAMELEN + 1]; /* Command name. */ + double fp_stuff[1]; /* External FPU state (size unknown by us). */ + /* The type "double" is critical here, for alignment. + SunOS declares a struct here, but the struct's + alignment is double since it contains doubles. */ + int c_ucode; /* Exception no. from u_code. */ + /* This member is not accessible by name since + we don't portably know the size of fp_stuff. */ +}; struct internal_sunos_core - { - int c_magic; /* Corefile magic number */ - int c_len; /* Sizeof (struct core) */ - long c_regs_pos; /* file offset of General purpose registers */ - int c_regs_size; /* size of General purpose registers */ - struct internal_exec c_aouthdr; /* A.out header */ - int c_signo; /* Killing signal, if any */ - int c_tsize; /* Text size (bytes) */ - int c_dsize; /* Data size (bytes) */ - bfd_vma c_data_addr; /* Data start (address) */ - int c_ssize; /* Stack size (bytes) */ - bfd_vma c_stacktop; /* Stack top (address) */ - char c_cmdname[CORE_NAMELEN + 1]; /* Command name */ - long fp_stuff_pos; /* file offset of external FPU state (regs) */ - int fp_stuff_size; /* Size of it */ - int c_ucode; /* Exception no. from u_code */ - }; +{ + int c_magic; /* Corefile magic number. */ + int c_len; /* Sizeof (struct core). */ + long c_regs_pos; /* File offset of General purpose registers. */ + int c_regs_size; /* Size of General purpose registers. */ + struct internal_exec c_aouthdr; /* A.out header. */ + int c_signo; /* Killing signal, if any. */ + int c_tsize; /* Text size (bytes). */ + int c_dsize; /* Data size (bytes). */ + bfd_vma c_data_addr; /* Data start (address). */ + int c_ssize; /* Stack size (bytes). */ + bfd_vma c_stacktop; /* Stack top (address). */ + char c_cmdname[CORE_NAMELEN + 1]; /* Command name. */ + long fp_stuff_pos; /* File offset of external FPU state (regs). */ + int fp_stuff_size; /* Size of it. */ + int c_ucode; /* Exception no. from u_code. */ +}; -static void swapcore_sun3 - PARAMS ((bfd *, char *, struct internal_sunos_core *)); -static void swapcore_sparc - PARAMS ((bfd *, char *, struct internal_sunos_core *)); -static void swapcore_solaris_bcp - PARAMS ((bfd *, char *, struct internal_sunos_core *)); +/* Byte-swap in the Sun-3 core structure. */ -/* byte-swap in the Sun-3 core structure */ static void -swapcore_sun3 (abfd, ext, intcore) - bfd *abfd; - char *ext; - struct internal_sunos_core *intcore; +swapcore_sun3 (bfd *abfd, char *ext, struct internal_sunos_core *intcore) { struct external_sun3_core *extcore = (struct external_sun3_core *) ext; intcore->c_magic = H_GET_32 (abfd, &extcore->c_magic); intcore->c_len = H_GET_32 (abfd, &extcore->c_len); - intcore->c_regs_pos = (long) (((struct external_sun3_core *) 0)->c_regs); + intcore->c_regs_pos = offsetof (struct external_sun3_core, c_regs); intcore->c_regs_size = sizeof (extcore->c_regs); #if ARCH_SIZE == 64 aout_64_swap_exec_header_in @@ -448,30 +401,28 @@ swapcore_sun3 (abfd, ext, intcore) intcore->c_data_addr = N_DATADDR (intcore->c_aouthdr); intcore->c_ssize = H_GET_32 (abfd, &extcore->c_ssize); memcpy (intcore->c_cmdname, extcore->c_cmdname, sizeof (intcore->c_cmdname)); - intcore->fp_stuff_pos = (long) (((struct external_sun3_core *) 0)->fp_stuff); + intcore->fp_stuff_pos = offsetof (struct external_sun3_core, fp_stuff); /* FP stuff takes up whole rest of struct, except c_ucode. */ intcore->fp_stuff_size = intcore->c_len - (sizeof extcore->c_ucode) - - (file_ptr) (((struct external_sun3_core *) 0)->fp_stuff); - /* Ucode is the last thing in the struct -- just before the end */ + offsetof (struct external_sun3_core, fp_stuff); + /* Ucode is the last thing in the struct -- just before the end. */ intcore->c_ucode = H_GET_32 (abfd, (intcore->c_len - sizeof (extcore->c_ucode) + (unsigned char *) extcore)); - intcore->c_stacktop = 0x0E000000; /* By experimentation */ + intcore->c_stacktop = 0x0E000000; /* By experimentation. */ } -/* byte-swap in the Sparc core structure */ +/* Byte-swap in the Sparc core structure. */ + static void -swapcore_sparc (abfd, ext, intcore) - bfd *abfd; - char *ext; - struct internal_sunos_core *intcore; +swapcore_sparc (bfd *abfd, char *ext, struct internal_sunos_core *intcore) { struct external_sparc_core *extcore = (struct external_sparc_core *) ext; intcore->c_magic = H_GET_32 (abfd, &extcore->c_magic); intcore->c_len = H_GET_32 (abfd, &extcore->c_len); - intcore->c_regs_pos = (long) (((struct external_sparc_core *) 0)->c_regs); + intcore->c_regs_pos = offsetof (struct external_sparc_core, c_regs); intcore->c_regs_size = sizeof (extcore->c_regs); #if ARCH_SIZE == 64 aout_64_swap_exec_header_in @@ -485,11 +436,11 @@ swapcore_sparc (abfd, ext, intcore) intcore->c_data_addr = N_DATADDR (intcore->c_aouthdr); intcore->c_ssize = H_GET_32 (abfd, &extcore->c_ssize); memcpy (intcore->c_cmdname, extcore->c_cmdname, sizeof (intcore->c_cmdname)); - intcore->fp_stuff_pos = (long) (((struct external_sparc_core *) 0)->fp_stuff); + intcore->fp_stuff_pos = offsetof (struct external_sparc_core, fp_stuff); /* FP stuff takes up whole rest of struct, except c_ucode. */ intcore->fp_stuff_size = intcore->c_len - (sizeof extcore->c_ucode) - - (file_ptr) (((struct external_sparc_core *) 0)->fp_stuff); - /* Ucode is the last thing in the struct -- just before the end */ + offsetof (struct external_sparc_core, fp_stuff); + /* Ucode is the last thing in the struct -- just before the end. */ intcore->c_ucode = H_GET_32 (abfd, (intcore->c_len - sizeof (extcore->c_ucode) @@ -511,7 +462,7 @@ swapcore_sparc (abfd, ext, intcore) #define SPARC_USRSTACK_SPARC2 ((bfd_vma)0xf8000000) #define SPARC_USRSTACK_SPARC10 ((bfd_vma)0xf0000000) { - bfd_vma sp = H_GET_32 (abfd, &((struct regs *) &extcore->c_regs[0])->r_o6); + bfd_vma sp = H_GET_32 (abfd, &extcore->c_regs.r_o6); if (sp < SPARC_USRSTACK_SPARC10) intcore->c_stacktop = SPARC_USRSTACK_SPARC10; else @@ -519,19 +470,17 @@ swapcore_sparc (abfd, ext, intcore) } } -/* byte-swap in the Solaris BCP core structure */ +/* Byte-swap in the Solaris BCP core structure. */ + static void -swapcore_solaris_bcp (abfd, ext, intcore) - bfd *abfd; - char *ext; - struct internal_sunos_core *intcore; +swapcore_solaris_bcp (bfd *abfd, char *ext, struct internal_sunos_core *intcore) { struct external_solaris_bcp_core *extcore = (struct external_solaris_bcp_core *) ext; intcore->c_magic = H_GET_32 (abfd, &extcore->c_magic); intcore->c_len = H_GET_32 (abfd, &extcore->c_len); - intcore->c_regs_pos = (long) (((struct external_solaris_bcp_core *) 0)->c_regs); + intcore->c_regs_pos = offsetof (struct external_solaris_bcp_core, c_regs); intcore->c_regs_size = sizeof (extcore->c_regs); /* The Solaris BCP exdata structure does not contain an a_syms field, @@ -544,7 +493,7 @@ swapcore_solaris_bcp (abfd, ext, intcore) are buggy. The exdata structure is not properly filled in, and the data section is written from address zero instead of the data start address. */ - memset ((PTR) &intcore->c_aouthdr, 0, sizeof (struct internal_exec)); + memset ((void *) &intcore->c_aouthdr, 0, sizeof (struct internal_exec)); intcore->c_data_addr = H_GET_32 (abfd, &extcore->c_exdata_datorg); intcore->c_signo = H_GET_32 (abfd, &extcore->c_signo); intcore->c_tsize = H_GET_32 (abfd, &extcore->c_tsize); @@ -552,10 +501,10 @@ swapcore_solaris_bcp (abfd, ext, intcore) intcore->c_ssize = H_GET_32 (abfd, &extcore->c_ssize); memcpy (intcore->c_cmdname, extcore->c_cmdname, sizeof (intcore->c_cmdname)); intcore->fp_stuff_pos = - (long) (((struct external_solaris_bcp_core *) 0)->fp_stuff); + offsetof (struct external_solaris_bcp_core, fp_stuff); /* FP stuff takes up whole rest of struct, except c_ucode. */ intcore->fp_stuff_size = intcore->c_len - (sizeof extcore->c_ucode) - - (file_ptr) (((struct external_solaris_bcp_core *) 0)->fp_stuff); + offsetof (struct external_solaris_bcp_core, fp_stuff); /* Ucode is the last thing in the struct -- just before the end */ intcore->c_ucode = H_GET_32 (abfd, (intcore->c_len @@ -578,7 +527,7 @@ swapcore_solaris_bcp (abfd, ext, intcore) #define SPARC_USRSTACK_SPARC2 ((bfd_vma)0xf8000000) #define SPARC_USRSTACK_SPARC10 ((bfd_vma)0xf0000000) { - bfd_vma sp = H_GET_32 (abfd, &((struct regs *) &extcore->c_regs[0])->r_o6); + bfd_vma sp = H_GET_32 (abfd, &extcore->c_regs.r_o6); if (sp < SPARC_USRSTACK_SPARC10) intcore->c_stacktop = SPARC_USRSTACK_SPARC10; else @@ -586,17 +535,17 @@ swapcore_solaris_bcp (abfd, ext, intcore) } } -/* need this cast because ptr is really void * */ -#define core_hdr(bfd) ((bfd)->tdata.sun_core_data) -#define core_datasec(bfd) (core_hdr(bfd)->data_section) -#define core_stacksec(bfd) (core_hdr(bfd)->stack_section) -#define core_regsec(bfd) (core_hdr(bfd)->reg_section) -#define core_reg2sec(bfd) (core_hdr(bfd)->reg2_section) +/* Need this cast because ptr is really void *. */ +#define core_hdr(bfd) ((bfd)->tdata.sun_core_data) +#define core_datasec(bfd) (core_hdr (bfd)->data_section) +#define core_stacksec(bfd) (core_hdr (bfd)->stack_section) +#define core_regsec(bfd) (core_hdr (bfd)->reg_section) +#define core_reg2sec(bfd) (core_hdr (bfd)->reg2_section) -/* These are stored in the bfd's tdata */ +/* These are stored in the bfd's tdata. */ struct sun_core_struct { - struct internal_sunos_core *hdr; /* core file header */ + struct internal_sunos_core *hdr; /* Core file header. */ asection *data_section; asection *stack_section; asection *reg_section; @@ -604,10 +553,9 @@ struct sun_core_struct }; static const bfd_target * -sunos4_core_file_p (abfd) - bfd *abfd; +sunos4_core_file_p (bfd *abfd) { - unsigned char longbuf[4]; /* Raw bytes of various header fields */ + unsigned char longbuf[4]; /* Raw bytes of various header fields. */ bfd_size_type core_size, amt; unsigned long core_mag; struct internal_sunos_core *core; @@ -619,40 +567,40 @@ sunos4_core_file_p (abfd) char external_core[1]; } *mergem; - if (bfd_bread ((PTR) longbuf, (bfd_size_type) sizeof (longbuf), abfd) + if (bfd_bread ((void *) longbuf, (bfd_size_type) sizeof (longbuf), abfd) != sizeof (longbuf)) - return 0; + return NULL; core_mag = H_GET_32 (abfd, longbuf); if (core_mag != CORE_MAGIC) - return 0; + return NULL; /* SunOS core headers can vary in length; second word is size; */ - if (bfd_bread ((PTR) longbuf, (bfd_size_type) sizeof (longbuf), abfd) + if (bfd_bread ((void *) longbuf, (bfd_size_type) sizeof (longbuf), abfd) != sizeof (longbuf)) - return 0; + return NULL; core_size = H_GET_32 (abfd, longbuf); - /* Sanity check */ + /* Sanity check. */ if (core_size > 20000) - return 0; + return NULL; if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) - return 0; + return NULL; amt = core_size + sizeof (struct mergem); - mergem = (struct mergem *) bfd_zalloc (abfd, amt); + mergem = bfd_zalloc (abfd, amt); if (mergem == NULL) - return 0; + return NULL; extcore = mergem->external_core; - if ((bfd_bread ((PTR) extcore, core_size, abfd)) != core_size) + if ((bfd_bread ((void *) extcore, core_size, abfd)) != core_size) { loser: bfd_release (abfd, (char *) mergem); abfd->tdata.any = NULL; bfd_section_list_clear (abfd); - return 0; + return NULL; } /* Validate that it's a core file we know how to handle, due to sun @@ -671,7 +619,7 @@ sunos4_core_file_p (abfd) swapcore_solaris_bcp (abfd, extcore, core); break; default: - bfd_set_error (bfd_error_system_call); /* FIXME */ + bfd_set_error (bfd_error_system_call); /* FIXME. */ goto loser; } @@ -701,10 +649,10 @@ sunos4_core_file_p (abfd) core_regsec (abfd)->flags = SEC_HAS_CONTENTS; core_reg2sec (abfd)->flags = SEC_HAS_CONTENTS; - core_stacksec (abfd)->_raw_size = core->c_ssize; - core_datasec (abfd)->_raw_size = core->c_dsize; - core_regsec (abfd)->_raw_size = core->c_regs_size; - core_reg2sec (abfd)->_raw_size = core->fp_stuff_size; + core_stacksec (abfd)->size = core->c_ssize; + core_datasec (abfd)->size = core->c_dsize; + core_regsec (abfd)->size = core->c_regs_size; + core_reg2sec (abfd)->size = core->fp_stuff_size; core_stacksec (abfd)->vma = (core->c_stacktop - core->c_ssize); core_datasec (abfd)->vma = core->c_data_addr; @@ -713,11 +661,11 @@ sunos4_core_file_p (abfd) core_stacksec (abfd)->filepos = core->c_len + core->c_dsize; core_datasec (abfd)->filepos = core->c_len; - /* We'll access the regs afresh in the core file, like any section: */ + /* We'll access the regs afresh in the core file, like any section: */ core_regsec (abfd)->filepos = (file_ptr) core->c_regs_pos; core_reg2sec (abfd)->filepos = (file_ptr) core->fp_stuff_pos; - /* Align to word at least */ + /* Align to word at least. */ core_stacksec (abfd)->alignment_power = 2; core_datasec (abfd)->alignment_power = 2; core_regsec (abfd)->alignment_power = 2; @@ -727,23 +675,19 @@ sunos4_core_file_p (abfd) } static char * -sunos4_core_file_failing_command (abfd) - bfd *abfd; +sunos4_core_file_failing_command (bfd *abfd) { return core_hdr (abfd)->hdr->c_cmdname; } static int -sunos4_core_file_failing_signal (abfd) - bfd *abfd; +sunos4_core_file_failing_signal (bfd *abfd) { return core_hdr (abfd)->hdr->c_signo; } static bfd_boolean -sunos4_core_file_matches_executable_p (core_bfd, exec_bfd) - bfd *core_bfd; - bfd *exec_bfd; +sunos4_core_file_matches_executable_p (bfd *core_bfd, bfd *exec_bfd) { if (core_bfd->xvec != exec_bfd->xvec) { @@ -755,15 +699,15 @@ sunos4_core_file_matches_executable_p (core_bfd, exec_bfd) if ((core_hdr (core_bfd)->hdr)->c_len == SOLARIS_BCP_CORE_LEN) return TRUE; - return (memcmp ((char *) &((core_hdr (core_bfd)->hdr)->c_aouthdr), - (char *) exec_hdr (exec_bfd), - sizeof (struct internal_exec)) == 0); + return memcmp ((char *) &((core_hdr (core_bfd)->hdr)->c_aouthdr), + (char *) exec_hdr (exec_bfd), + sizeof (struct internal_exec)) == 0; } #define MY_set_sizes sunos4_set_sizes + static bfd_boolean -sunos4_set_sizes (abfd) - bfd *abfd; +sunos4_set_sizes (bfd *abfd) { switch (bfd_get_arch (abfd)) { @@ -812,13 +756,13 @@ sunos4_set_sizes (abfd) static const struct aout_backend_data sunos4_aout_backend = { - 0, /* zmagic files are not contiguous */ - 1, /* text includes header */ + 0, /* Zmagic files are not contiguous. */ + 1, /* Text includes header. */ MY_entry_is_text_address, MY_exec_hdr_flags, - 0, /* default text vma */ + 0, /* Default text vma. */ sunos4_set_sizes, - 0, /* header is counted in zmagic text */ + 0, /* Header is counted in zmagic text. */ MY_add_dynamic_symbols, MY_add_one_symbol, MY_link_dynamic_object, @@ -833,11 +777,10 @@ static const struct aout_backend_data sunos4_aout_backend = #define MY_bfd_debug_info_start bfd_void #define MY_bfd_debug_info_end bfd_void -#define MY_bfd_debug_info_accumulate \ - (void (*) PARAMS ((bfd *, struct bfd_section *))) bfd_void +#define MY_bfd_debug_info_accumulate (void (*) (bfd *, struct bfd_section *)) bfd_void #define MY_core_file_p sunos4_core_file_p -#define MY_write_object_contents NAME(aout,sunos4_write_object_contents) -#define MY_backend_data &sunos4_aout_backend +#define MY_write_object_contents NAME(aout, sunos4_write_object_contents) +#define MY_backend_data & sunos4_aout_backend #ifndef TARGET_IS_LITTLE_ENDIAN_P #define TARGET_IS_BIG_ENDIAN_P diff --git a/contrib/binutils/bfd/aoutx.h b/contrib/binutils/bfd/aoutx.h index 3282f87dfe2..7dce07240ff 100644 --- a/contrib/binutils/bfd/aoutx.h +++ b/contrib/binutils/bfd/aoutx.h @@ -1,6 +1,6 @@ /* BFD semi-generic back-end for a.out binaries. - Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, - 2001, 2002, 2003 + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, + 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Written by Cygnus Support. @@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* SECTION @@ -129,20 +129,7 @@ DESCRIPTION #include "aout/stab_gnu.h" #include "aout/ar.h" -static bfd_boolean aout_get_external_symbols - PARAMS ((bfd *)); -static bfd_boolean translate_from_native_sym_flags - PARAMS ((bfd *, aout_symbol_type *)); -static bfd_boolean translate_to_native_sym_flags - PARAMS ((bfd *, asymbol *, struct external_nlist *)); -static void adjust_o_magic - PARAMS ((bfd *, struct internal_exec *)); -static void adjust_z_magic - PARAMS ((bfd *, struct internal_exec *)); -static void adjust_n_magic - PARAMS ((bfd *, struct internal_exec *)); -reloc_howto_type * NAME(aout,reloc_type_lookup) - PARAMS ((bfd *, bfd_reloc_code_real_type)); +reloc_howto_type * NAME (aout, reloc_type_lookup) (bfd *, bfd_reloc_code_real_type); /* SUBSECTION @@ -166,19 +153,19 @@ DESCRIPTION #endif #ifndef MY_swap_std_reloc_in -#define MY_swap_std_reloc_in NAME(aout,swap_std_reloc_in) +#define MY_swap_std_reloc_in NAME (aout, swap_std_reloc_in) #endif #ifndef MY_swap_ext_reloc_in -#define MY_swap_ext_reloc_in NAME(aout,swap_ext_reloc_in) +#define MY_swap_ext_reloc_in NAME (aout, swap_ext_reloc_in) #endif #ifndef MY_swap_std_reloc_out -#define MY_swap_std_reloc_out NAME(aout,swap_std_reloc_out) +#define MY_swap_std_reloc_out NAME (aout, swap_std_reloc_out) #endif #ifndef MY_swap_ext_reloc_out -#define MY_swap_ext_reloc_out NAME(aout,swap_ext_reloc_out) +#define MY_swap_ext_reloc_out NAME (aout, swap_ext_reloc_out) #endif #ifndef MY_final_link_relocate @@ -189,40 +176,40 @@ DESCRIPTION #define MY_relocate_contents _bfd_relocate_contents #endif -#define howto_table_ext NAME(aout,ext_howto_table) -#define howto_table_std NAME(aout,std_howto_table) +#define howto_table_ext NAME (aout, ext_howto_table) +#define howto_table_std NAME (aout, std_howto_table) reloc_howto_type howto_table_ext[] = { - /* type rs size bsz pcrel bitpos ovrf sf name part_inpl readmask setmask pcdone. */ - HOWTO(RELOC_8, 0, 0, 8, FALSE, 0, complain_overflow_bitfield,0,"8", FALSE, 0,0x000000ff, FALSE), - HOWTO(RELOC_16, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,0,"16", FALSE, 0,0x0000ffff, FALSE), - HOWTO(RELOC_32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,0,"32", FALSE, 0,0xffffffff, FALSE), - HOWTO(RELOC_DISP8, 0, 0, 8, TRUE, 0, complain_overflow_signed,0,"DISP8", FALSE, 0,0x000000ff, FALSE), - HOWTO(RELOC_DISP16, 0, 1, 16, TRUE, 0, complain_overflow_signed,0,"DISP16", FALSE, 0,0x0000ffff, FALSE), - HOWTO(RELOC_DISP32, 0, 2, 32, TRUE, 0, complain_overflow_signed,0,"DISP32", FALSE, 0,0xffffffff, FALSE), - HOWTO(RELOC_WDISP30,2, 2, 30, TRUE, 0, complain_overflow_signed,0,"WDISP30", FALSE, 0,0x3fffffff, FALSE), - HOWTO(RELOC_WDISP22,2, 2, 22, TRUE, 0, complain_overflow_signed,0,"WDISP22", FALSE, 0,0x003fffff, FALSE), - HOWTO(RELOC_HI22, 10, 2, 22, FALSE, 0, complain_overflow_bitfield,0,"HI22", FALSE, 0,0x003fffff, FALSE), - HOWTO(RELOC_22, 0, 2, 22, FALSE, 0, complain_overflow_bitfield,0,"22", FALSE, 0,0x003fffff, FALSE), - HOWTO(RELOC_13, 0, 2, 13, FALSE, 0, complain_overflow_bitfield,0,"13", FALSE, 0,0x00001fff, FALSE), - HOWTO(RELOC_LO10, 0, 2, 10, FALSE, 0, complain_overflow_dont,0,"LO10", FALSE, 0,0x000003ff, FALSE), - HOWTO(RELOC_SFA_BASE,0, 2, 32, FALSE, 0, complain_overflow_bitfield,0,"SFA_BASE", FALSE, 0,0xffffffff, FALSE), - HOWTO(RELOC_SFA_OFF13,0,2, 32, FALSE, 0, complain_overflow_bitfield,0,"SFA_OFF13",FALSE, 0,0xffffffff, FALSE), - HOWTO(RELOC_BASE10, 0, 2, 10, FALSE, 0, complain_overflow_dont,0,"BASE10", FALSE, 0,0x000003ff, FALSE), - HOWTO(RELOC_BASE13, 0, 2, 13, FALSE, 0, complain_overflow_signed,0,"BASE13", FALSE, 0,0x00001fff, FALSE), - HOWTO(RELOC_BASE22, 10, 2, 22, FALSE, 0, complain_overflow_bitfield,0,"BASE22", FALSE, 0,0x003fffff, FALSE), - HOWTO(RELOC_PC10, 0, 2, 10, TRUE, 0, complain_overflow_dont,0,"PC10", FALSE, 0,0x000003ff, TRUE), - HOWTO(RELOC_PC22, 10, 2, 22, TRUE, 0, complain_overflow_signed,0,"PC22", FALSE, 0,0x003fffff, TRUE), - HOWTO(RELOC_JMP_TBL,2, 2, 30, TRUE, 0, complain_overflow_signed,0,"JMP_TBL", FALSE, 0,0x3fffffff, FALSE), - HOWTO(RELOC_SEGOFF16,0, 2, 0, FALSE, 0, complain_overflow_bitfield,0,"SEGOFF16", FALSE, 0,0x00000000, FALSE), - HOWTO(RELOC_GLOB_DAT,0, 2, 0, FALSE, 0, complain_overflow_bitfield,0,"GLOB_DAT", FALSE, 0,0x00000000, FALSE), - HOWTO(RELOC_JMP_SLOT,0, 2, 0, FALSE, 0, complain_overflow_bitfield,0,"JMP_SLOT", FALSE, 0,0x00000000, FALSE), - HOWTO(RELOC_RELATIVE,0, 2, 0, FALSE, 0, complain_overflow_bitfield,0,"RELATIVE", FALSE, 0,0x00000000, FALSE), - HOWTO(0, 0, 0, 0, FALSE, 0, complain_overflow_dont, 0, "R_SPARC_NONE", FALSE,0,0x00000000,TRUE), - HOWTO(0, 0, 0, 0, FALSE, 0, complain_overflow_dont, 0, "R_SPARC_NONE", FALSE,0,0x00000000,TRUE), + /* Type rs size bsz pcrel bitpos ovrf sf name part_inpl readmask setmask pcdone. */ + HOWTO (RELOC_8, 0, 0, 8, FALSE, 0, complain_overflow_bitfield, 0, "8", FALSE, 0, 0x000000ff, FALSE), + HOWTO (RELOC_16, 0, 1, 16, FALSE, 0, complain_overflow_bitfield, 0, "16", FALSE, 0, 0x0000ffff, FALSE), + HOWTO (RELOC_32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield, 0, "32", FALSE, 0, 0xffffffff, FALSE), + HOWTO (RELOC_DISP8, 0, 0, 8, TRUE, 0, complain_overflow_signed, 0, "DISP8", FALSE, 0, 0x000000ff, FALSE), + HOWTO (RELOC_DISP16, 0, 1, 16, TRUE, 0, complain_overflow_signed, 0, "DISP16", FALSE, 0, 0x0000ffff, FALSE), + HOWTO (RELOC_DISP32, 0, 2, 32, TRUE, 0, complain_overflow_signed, 0, "DISP32", FALSE, 0, 0xffffffff, FALSE), + HOWTO (RELOC_WDISP30, 2, 2, 30, TRUE, 0, complain_overflow_signed, 0, "WDISP30", FALSE, 0, 0x3fffffff, FALSE), + HOWTO (RELOC_WDISP22, 2, 2, 22, TRUE, 0, complain_overflow_signed, 0, "WDISP22", FALSE, 0, 0x003fffff, FALSE), + HOWTO (RELOC_HI22, 10, 2, 22, FALSE, 0, complain_overflow_bitfield, 0, "HI22", FALSE, 0, 0x003fffff, FALSE), + HOWTO (RELOC_22, 0, 2, 22, FALSE, 0, complain_overflow_bitfield, 0, "22", FALSE, 0, 0x003fffff, FALSE), + HOWTO (RELOC_13, 0, 2, 13, FALSE, 0, complain_overflow_bitfield, 0, "13", FALSE, 0, 0x00001fff, FALSE), + HOWTO (RELOC_LO10, 0, 2, 10, FALSE, 0, complain_overflow_dont, 0, "LO10", FALSE, 0, 0x000003ff, FALSE), + HOWTO (RELOC_SFA_BASE,0, 2, 32, FALSE, 0, complain_overflow_bitfield, 0, "SFA_BASE", FALSE, 0, 0xffffffff, FALSE), + HOWTO (RELOC_SFA_OFF13,0, 2, 32, FALSE, 0, complain_overflow_bitfield, 0, "SFA_OFF13", FALSE, 0, 0xffffffff, FALSE), + HOWTO (RELOC_BASE10, 0, 2, 10, FALSE, 0, complain_overflow_dont, 0, "BASE10", FALSE, 0, 0x000003ff, FALSE), + HOWTO (RELOC_BASE13, 0, 2, 13, FALSE, 0, complain_overflow_signed, 0, "BASE13", FALSE, 0, 0x00001fff, FALSE), + HOWTO (RELOC_BASE22, 10, 2, 22, FALSE, 0, complain_overflow_bitfield, 0, "BASE22", FALSE, 0, 0x003fffff, FALSE), + HOWTO (RELOC_PC10, 0, 2, 10, TRUE, 0, complain_overflow_dont, 0, "PC10", FALSE, 0, 0x000003ff, TRUE), + HOWTO (RELOC_PC22, 10, 2, 22, TRUE, 0, complain_overflow_signed, 0, "PC22", FALSE, 0, 0x003fffff, TRUE), + HOWTO (RELOC_JMP_TBL, 2, 2, 30, TRUE, 0, complain_overflow_signed, 0, "JMP_TBL", FALSE, 0, 0x3fffffff, FALSE), + HOWTO (RELOC_SEGOFF16,0, 2, 0, FALSE, 0, complain_overflow_bitfield, 0, "SEGOFF16", FALSE, 0, 0x00000000, FALSE), + HOWTO (RELOC_GLOB_DAT,0, 2, 0, FALSE, 0, complain_overflow_bitfield, 0, "GLOB_DAT", FALSE, 0, 0x00000000, FALSE), + HOWTO (RELOC_JMP_SLOT,0, 2, 0, FALSE, 0, complain_overflow_bitfield, 0, "JMP_SLOT", FALSE, 0, 0x00000000, FALSE), + HOWTO (RELOC_RELATIVE,0, 2, 0, FALSE, 0, complain_overflow_bitfield, 0, "RELATIVE", FALSE, 0, 0x00000000, FALSE), + HOWTO (0, 0, 0, 0, FALSE, 0, complain_overflow_dont, 0, "R_SPARC_NONE",FALSE, 0, 0x00000000, TRUE), + HOWTO (0, 0, 0, 0, FALSE, 0, complain_overflow_dont, 0, "R_SPARC_NONE",FALSE, 0, 0x00000000, TRUE), #define RELOC_SPARC_REV32 RELOC_WDISP19 - HOWTO(RELOC_SPARC_REV32, 0, 2, 32, FALSE, 0, complain_overflow_dont,0,"R_SPARC_REV32", FALSE, 0,0xffffffff, FALSE), + HOWTO (RELOC_SPARC_REV32, 0, 2, 32, FALSE, 0, complain_overflow_dont, 0,"R_SPARC_REV32",FALSE, 0, 0xffffffff, FALSE), }; /* Convert standard reloc records to "arelent" format (incl byte swap). */ @@ -276,12 +263,10 @@ EMPTY_HOWTO (-1), #define TABLE_SIZE(TABLE) (sizeof (TABLE) / sizeof (TABLE[0])) reloc_howto_type * -NAME(aout,reloc_type_lookup) (abfd,code) - bfd *abfd; - bfd_reloc_code_real_type code; +NAME (aout, reloc_type_lookup) (bfd *abfd, bfd_reloc_code_real_type code) { -#define EXT(i, j) case i: return &howto_table_ext[j] -#define STD(i, j) case i: return &howto_table_std[j] +#define EXT(i, j) case i: return & howto_table_ext [j] +#define STD(i, j) case i: return & howto_table_std [j] int ext = obj_reloc_entry_size (abfd) == RELOC_EXT_SIZE; if (code == BFD_RELOC_CTOR) @@ -314,7 +299,8 @@ NAME(aout,reloc_type_lookup) (abfd,code) EXT (BFD_RELOC_SPARC_PC22, 18); EXT (BFD_RELOC_SPARC_WPLT30, 19); EXT (BFD_RELOC_SPARC_REV32, 26); - default: return (reloc_howto_type *) NULL; + default: + return NULL; } else /* std relocs. */ @@ -328,7 +314,8 @@ NAME(aout,reloc_type_lookup) (abfd,code) STD (BFD_RELOC_32_PCREL, 6); STD (BFD_RELOC_16_BASEREL, 9); STD (BFD_RELOC_32_BASEREL, 10); - default: return (reloc_howto_type *) NULL; + default: + return NULL; } } @@ -340,7 +327,6 @@ DESCRIPTION @file{aoutx.h} exports several routines for accessing the contents of an a.out file, which are gathered and exported in turn by various format specific files (eg sunos.c). - */ /* @@ -350,7 +336,7 @@ FUNCTION SYNOPSIS void aout_@var{size}_swap_exec_header_in, (bfd *abfd, - struct external_exec *raw_bytes, + struct external_exec *bytes, struct internal_exec *execp); DESCRIPTION @@ -361,18 +347,15 @@ DESCRIPTION #ifndef NAME_swap_exec_header_in void -NAME(aout,swap_exec_header_in) (abfd, raw_bytes, execp) - bfd *abfd; - struct external_exec *raw_bytes; - struct internal_exec *execp; +NAME (aout, swap_exec_header_in) (bfd *abfd, + struct external_exec *bytes, + struct internal_exec *execp) { - struct external_exec *bytes = (struct external_exec *)raw_bytes; - /* The internal_exec structure has some fields that are unused in this configuration (IE for i960), so ensure that all such uninitialized fields are zero'd out. There are places where two of these structs are memcmp'd, and thus the contents do matter. */ - memset ((PTR) execp, 0, sizeof (struct internal_exec)); + memset ((void *) execp, 0, sizeof (struct internal_exec)); /* Now fill in fields in the execp, from the bytes in the raw data. */ execp->a_info = H_GET_32 (abfd, bytes->e_info); execp->a_text = GET_WORD (abfd, bytes->e_text); @@ -383,7 +366,7 @@ NAME(aout,swap_exec_header_in) (abfd, raw_bytes, execp) execp->a_trsize = GET_WORD (abfd, bytes->e_trsize); execp->a_drsize = GET_WORD (abfd, bytes->e_drsize); } -#define NAME_swap_exec_header_in NAME(aout,swap_exec_header_in) +#define NAME_swap_exec_header_in NAME (aout, swap_exec_header_in) #endif /* @@ -401,13 +384,10 @@ DESCRIPTION @var{execp} into the buffer @var{raw_bytes} ready for writing to disk. */ void -NAME(aout,swap_exec_header_out) (abfd, execp, raw_bytes) - bfd *abfd; - struct internal_exec *execp; - struct external_exec *raw_bytes; +NAME (aout, swap_exec_header_out) (bfd *abfd, + struct internal_exec *execp, + struct external_exec *bytes) { - struct external_exec *bytes = (struct external_exec *)raw_bytes; - /* Now fill in fields in the raw data, from the fields in the exec struct. */ H_PUT_32 (abfd, execp->a_info , bytes->e_info); PUT_WORD (abfd, execp->a_text , bytes->e_text); @@ -422,17 +402,13 @@ NAME(aout,swap_exec_header_out) (abfd, execp, raw_bytes) /* Make all the section for an a.out file. */ bfd_boolean -NAME(aout,make_sections) (abfd) - bfd *abfd; +NAME (aout, make_sections) (bfd *abfd) { - if (obj_textsec (abfd) == (asection *) NULL - && bfd_make_section (abfd, ".text") == (asection *) NULL) + if (obj_textsec (abfd) == NULL && bfd_make_section (abfd, ".text") == NULL) return FALSE; - if (obj_datasec (abfd) == (asection *) NULL - && bfd_make_section (abfd, ".data") == (asection *) NULL) + if (obj_datasec (abfd) == NULL && bfd_make_section (abfd, ".data") == NULL) return FALSE; - if (obj_bsssec (abfd) == (asection *) NULL - && bfd_make_section (abfd, ".bss") == (asection *) NULL) + if (obj_bsssec (abfd) == NULL && bfd_make_section (abfd, ".bss") == NULL) return FALSE; return TRUE; } @@ -444,7 +420,8 @@ FUNCTION SYNOPSIS const bfd_target *aout_@var{size}_some_aout_object_p (bfd *abfd, - const bfd_target *(*callback_to_real_object_p) ()); + struct internal_exec *execp, + const bfd_target *(*callback_to_real_object_p) (bfd *)); DESCRIPTION Some a.out variant thinks that the file open in @var{abfd} @@ -455,18 +432,17 @@ DESCRIPTION */ const bfd_target * -NAME(aout,some_aout_object_p) (abfd, execp, callback_to_real_object_p) - bfd *abfd; - struct internal_exec *execp; - const bfd_target *(*callback_to_real_object_p) PARAMS ((bfd *)); +NAME (aout, some_aout_object_p) (bfd *abfd, + struct internal_exec *execp, + const bfd_target *(*callback_to_real_object_p) (bfd *)) { struct aout_data_struct *rawptr, *oldrawptr; const bfd_target *result; - bfd_size_type amt = sizeof (struct aout_data_struct); + bfd_size_type amt = sizeof (* rawptr); - rawptr = (struct aout_data_struct *) bfd_zalloc (abfd, amt); + rawptr = bfd_zalloc (abfd, amt); if (rawptr == NULL) - return 0; + return NULL; oldrawptr = abfd->tdata.aout_data; abfd->tdata.aout_data = rawptr; @@ -513,15 +489,13 @@ NAME(aout,some_aout_object_p) (abfd, execp, callback_to_real_object_p) || N_MAGIC (*execp) == BMAGIC) adata (abfd).magic = o_magic; else - { - /* Should have been checked with N_BADMAG before this routine - was called. */ - abort (); - } + /* Should have been checked with N_BADMAG before this routine + was called. */ + abort (); bfd_get_start_address (abfd) = execp->a_entry; - obj_aout_symbols (abfd) = (aout_symbol_type *)NULL; + obj_aout_symbols (abfd) = NULL; bfd_get_symcount (abfd) = execp->a_syms / sizeof (struct external_nlist); /* The default relocation entry size is that of traditional V7 Unix. */ @@ -538,11 +512,11 @@ NAME(aout,some_aout_object_p) (abfd, execp, callback_to_real_object_p) obj_aout_external_strings (abfd) = NULL; obj_aout_sym_hashes (abfd) = NULL; - if (! NAME(aout,make_sections) (abfd)) + if (! NAME (aout, make_sections) (abfd)) goto error_ret; - obj_datasec (abfd)->_raw_size = execp->a_data; - obj_bsssec (abfd)->_raw_size = execp->a_bss; + obj_datasec (abfd)->size = execp->a_data; + obj_bsssec (abfd)->size = execp->a_bss; obj_textsec (abfd)->flags = (execp->a_trsize != 0 @@ -568,7 +542,6 @@ NAME(aout,some_aout_object_p) (abfd, execp, callback_to_real_object_p) struct exec *execp = exec_hdr (abfd); obj_textsec (abfd)->size = N_TXTSIZE (*execp); - obj_textsec (abfd)->raw_size = N_TXTSIZE (*execp); /* Data and bss are already filled in since they're so standard. */ /* The virtual memory addresses of the sections. */ @@ -632,7 +605,7 @@ NAME(aout,some_aout_object_p) (abfd, execp, callback_to_real_object_p) if (execp->a_entry != 0 || (execp->a_entry >= obj_textsec (abfd)->vma && execp->a_entry < (obj_textsec (abfd)->vma - + obj_textsec (abfd)->_raw_size))) + + obj_textsec (abfd)->size))) abfd->flags |= EXEC_P; #ifdef STAT_FOR_EXEC else @@ -655,14 +628,7 @@ NAME(aout,some_aout_object_p) (abfd, execp, callback_to_real_object_p) #endif /* STAT_FOR_EXEC */ if (result) - { -#if 0 /* These should be set correctly anyways. */ - abfd->sections = obj_textsec (abfd); - obj_textsec (abfd)->next = obj_datasec (abfd); - obj_datasec (abfd)->next = obj_bsssec (abfd); -#endif - return result; - } + return result; error_ret: bfd_release (abfd, rawptr); @@ -682,24 +648,23 @@ DESCRIPTION */ bfd_boolean -NAME(aout,mkobject) (abfd) - bfd *abfd; +NAME (aout, mkobject) (bfd *abfd) { struct aout_data_struct *rawptr; - bfd_size_type amt = sizeof (struct aout_data_struct); + bfd_size_type amt = sizeof (* rawptr); bfd_set_error (bfd_error_system_call); - rawptr = (struct aout_data_struct *) bfd_zalloc (abfd, amt); + rawptr = bfd_zalloc (abfd, amt); if (rawptr == NULL) return FALSE; abfd->tdata.aout_data = rawptr; exec_hdr (abfd) = &(rawptr->e); - obj_textsec (abfd) = (asection *) NULL; - obj_datasec (abfd) = (asection *) NULL; - obj_bsssec (abfd) = (asection *) NULL; + obj_textsec (abfd) = NULL; + obj_datasec (abfd) = NULL; + obj_bsssec (abfd) = NULL; return TRUE; } @@ -711,7 +676,8 @@ FUNCTION SYNOPSIS enum machine_type aout_@var{size}_machine_type (enum bfd_architecture arch, - unsigned long machine)); + unsigned long machine, + bfd_boolean *unknown); DESCRIPTION Keep track of machine architecture and machine type for @@ -724,10 +690,9 @@ DESCRIPTION */ enum machine_type -NAME(aout,machine_type) (arch, machine, unknown) - enum bfd_architecture arch; - unsigned long machine; - bfd_boolean *unknown; +NAME (aout, machine_type) (enum bfd_architecture arch, + unsigned long machine, + bfd_boolean *unknown) { enum machine_type arch_flags; @@ -741,7 +706,12 @@ NAME(aout,machine_type) (arch, machine, unknown) || machine == bfd_mach_sparc || machine == bfd_mach_sparc_sparclite || machine == bfd_mach_sparc_sparclite_le - || machine == bfd_mach_sparc_v9) + || machine == bfd_mach_sparc_v8plus + || machine == bfd_mach_sparc_v8plusa + || machine == bfd_mach_sparc_v8plusb + || machine == bfd_mach_sparc_v9 + || machine == bfd_mach_sparc_v9a + || machine == bfd_mach_sparc_v9b) arch_flags = M_SPARC; else if (machine == bfd_mach_sparc_sparclet) arch_flags = M_SPARCLET; @@ -765,11 +735,6 @@ NAME(aout,machine_type) (arch, machine, unknown) arch_flags = M_386; break; - case bfd_arch_a29k: - if (machine == 0) - arch_flags = M_29K; - break; - case bfd_arch_arm: if (machine == 0) arch_flags = M_ARM; @@ -794,6 +759,7 @@ NAME(aout,machine_type) (arch, machine, unknown) case bfd_mach_mips4600: case bfd_mach_mips4650: case bfd_mach_mips8000: + case bfd_mach_mips9000: case bfd_mach_mips10000: case bfd_mach_mips12000: case bfd_mach_mips16: @@ -831,6 +797,10 @@ NAME(aout,machine_type) (arch, machine, unknown) arch_flags = M_CRIS; break; + case bfd_arch_m88k: + *unknown = FALSE; + break; + default: arch_flags = M_UNKNOWN; } @@ -849,7 +819,7 @@ SYNOPSIS bfd_boolean aout_@var{size}_set_arch_mach, (bfd *, enum bfd_architecture arch, - unsigned long machine)); + unsigned long machine); DESCRIPTION Set the architecture and the machine of the BFD @var{abfd} to the @@ -858,10 +828,9 @@ DESCRIPTION */ bfd_boolean -NAME(aout,set_arch_mach) (abfd, arch, machine) - bfd *abfd; - enum bfd_architecture arch; - unsigned long machine; +NAME (aout, set_arch_mach) (bfd *abfd, + enum bfd_architecture arch, + unsigned long machine) { if (! bfd_default_set_arch_mach (abfd, arch, machine)) return FALSE; @@ -870,7 +839,7 @@ NAME(aout,set_arch_mach) (abfd, arch, machine) { bfd_boolean unknown; - NAME(aout,machine_type) (arch, machine, &unknown); + NAME (aout, machine_type) (arch, machine, &unknown); if (unknown) return FALSE; } @@ -879,7 +848,6 @@ NAME(aout,set_arch_mach) (abfd, arch, machine) switch (arch) { case bfd_arch_sparc: - case bfd_arch_a29k: case bfd_arch_mips: obj_reloc_entry_size (abfd) = RELOC_EXT_SIZE; break; @@ -892,9 +860,7 @@ NAME(aout,set_arch_mach) (abfd, arch, machine) } static void -adjust_o_magic (abfd, execp) - bfd *abfd; - struct internal_exec *execp; +adjust_o_magic (bfd *abfd, struct internal_exec *execp) { file_ptr pos = adata (abfd).exec_bytes_size; bfd_vma vma = 0; @@ -907,16 +873,13 @@ adjust_o_magic (abfd, execp) else vma = obj_textsec (abfd)->vma; - pos += obj_textsec (abfd)->_raw_size; - vma += obj_textsec (abfd)->_raw_size; + pos += obj_textsec (abfd)->size; + vma += obj_textsec (abfd)->size; /* Data. */ if (!obj_datasec (abfd)->user_set_vma) { -#if 0 /* ?? Does alignment in the file image really matter? */ - pad = align_power (vma, obj_datasec (abfd)->alignment_power) - vma; -#endif - obj_textsec (abfd)->_raw_size += pad; + obj_textsec (abfd)->size += pad; pos += pad; vma += pad; obj_datasec (abfd)->vma = vma; @@ -924,16 +887,13 @@ adjust_o_magic (abfd, execp) else vma = obj_datasec (abfd)->vma; obj_datasec (abfd)->filepos = pos; - pos += obj_datasec (abfd)->_raw_size; - vma += obj_datasec (abfd)->_raw_size; + pos += obj_datasec (abfd)->size; + vma += obj_datasec (abfd)->size; /* BSS. */ if (!obj_bsssec (abfd)->user_set_vma) { -#if 0 - pad = align_power (vma, obj_bsssec (abfd)->alignment_power) - vma; -#endif - obj_datasec (abfd)->_raw_size += pad; + obj_datasec (abfd)->size += pad; pos += pad; vma += pad; obj_bsssec (abfd)->vma = vma; @@ -946,28 +906,27 @@ adjust_o_magic (abfd, execp) pad = obj_bsssec (abfd)->vma - vma; if (pad > 0) { - obj_datasec (abfd)->_raw_size += pad; + obj_datasec (abfd)->size += pad; pos += pad; } } obj_bsssec (abfd)->filepos = pos; /* Fix up the exec header. */ - execp->a_text = obj_textsec (abfd)->_raw_size; - execp->a_data = obj_datasec (abfd)->_raw_size; - execp->a_bss = obj_bsssec (abfd)->_raw_size; + execp->a_text = obj_textsec (abfd)->size; + execp->a_data = obj_datasec (abfd)->size; + execp->a_bss = obj_bsssec (abfd)->size; N_SET_MAGIC (*execp, OMAGIC); } static void -adjust_z_magic (abfd, execp) - bfd *abfd; - struct internal_exec *execp; +adjust_z_magic (bfd *abfd, struct internal_exec *execp) { bfd_size_type data_pad, text_pad; file_ptr text_end; const struct aout_backend_data *abdp; - int ztih; /* Nonzero if text includes exec header. */ + /* TRUE if text includes exec header. */ + bfd_boolean ztih; abdp = aout_backend_info (abfd); @@ -1005,7 +964,7 @@ adjust_z_magic (abfd, execp) /* Find start of data. */ if (ztih) { - text_end = obj_textsec (abfd)->filepos + obj_textsec (abfd)->_raw_size; + text_end = obj_textsec (abfd)->filepos + obj_textsec (abfd)->size; text_pad += BFD_ALIGN (text_end, adata (abfd).page_size) - text_end; } else @@ -1013,18 +972,18 @@ adjust_z_magic (abfd, execp) /* Note that if page_size == zmagic_disk_block_size, then filepos == page_size, and this case is the same as the ztih case. */ - text_end = obj_textsec (abfd)->_raw_size; + text_end = obj_textsec (abfd)->size; text_pad += BFD_ALIGN (text_end, adata (abfd).page_size) - text_end; text_end += obj_textsec (abfd)->filepos; } - obj_textsec (abfd)->_raw_size += text_pad; + obj_textsec (abfd)->size += text_pad; text_end += text_pad; /* Data. */ if (!obj_datasec (abfd)->user_set_vma) { bfd_vma vma; - vma = obj_textsec (abfd)->vma + obj_textsec (abfd)->_raw_size; + vma = obj_textsec (abfd)->vma + obj_textsec (abfd)->size; obj_datasec (abfd)->vma = BFD_ALIGN (vma, adata (abfd).segment_size); } if (abdp && abdp->zmagic_mapped_contiguous) @@ -1032,17 +991,17 @@ adjust_z_magic (abfd, execp) asection * text = obj_textsec (abfd); asection * data = obj_datasec (abfd); - text_pad = data->vma - (text->vma + text->_raw_size); + text_pad = data->vma - (text->vma + text->size); /* Only pad the text section if the data section is going to be placed after it. */ if (text_pad > 0) - text->_raw_size += text_pad; + text->size += text_pad; } obj_datasec (abfd)->filepos = (obj_textsec (abfd)->filepos - + obj_textsec (abfd)->_raw_size); + + obj_textsec (abfd)->size); /* Fix up exec header while we're at it. */ - execp->a_text = obj_textsec (abfd)->_raw_size; + execp->a_text = obj_textsec (abfd)->size; if (ztih && (!abdp || (abdp && !abdp->exec_header_not_counted))) execp->a_text += adata (abfd).exec_bytes_size; if (obj_aout_subformat (abfd) == q_magic_format) @@ -1051,17 +1010,17 @@ adjust_z_magic (abfd, execp) N_SET_MAGIC (*execp, ZMAGIC); /* Spec says data section should be rounded up to page boundary. */ - obj_datasec (abfd)->_raw_size - = align_power (obj_datasec (abfd)->_raw_size, + obj_datasec (abfd)->size + = align_power (obj_datasec (abfd)->size, obj_bsssec (abfd)->alignment_power); - execp->a_data = BFD_ALIGN (obj_datasec (abfd)->_raw_size, + execp->a_data = BFD_ALIGN (obj_datasec (abfd)->size, adata (abfd).page_size); - data_pad = execp->a_data - obj_datasec (abfd)->_raw_size; + data_pad = execp->a_data - obj_datasec (abfd)->size; /* BSS. */ if (!obj_bsssec (abfd)->user_set_vma) obj_bsssec (abfd)->vma = (obj_datasec (abfd)->vma - + obj_datasec (abfd)->_raw_size); + + obj_datasec (abfd)->size); /* If the BSS immediately follows the data section and extra space in the page is left after the data section, fudge data in the header so that the bss section looks smaller by that @@ -1070,17 +1029,15 @@ adjust_z_magic (abfd, execp) could have explicitly set the BSS vma to immediately follow the data section.) */ if (align_power (obj_bsssec (abfd)->vma, obj_bsssec (abfd)->alignment_power) - == obj_datasec (abfd)->vma + obj_datasec (abfd)->_raw_size) - execp->a_bss = (data_pad > obj_bsssec (abfd)->_raw_size - ? 0 : obj_bsssec (abfd)->_raw_size - data_pad); + == obj_datasec (abfd)->vma + obj_datasec (abfd)->size) + execp->a_bss = (data_pad > obj_bsssec (abfd)->size + ? 0 : obj_bsssec (abfd)->size - data_pad); else - execp->a_bss = obj_bsssec (abfd)->_raw_size; + execp->a_bss = obj_bsssec (abfd)->size; } static void -adjust_n_magic (abfd, execp) - bfd *abfd; - struct internal_exec *execp; +adjust_n_magic (bfd *abfd, struct internal_exec *execp) { file_ptr pos = adata (abfd).exec_bytes_size; bfd_vma vma = 0; @@ -1092,8 +1049,8 @@ adjust_n_magic (abfd, execp) obj_textsec (abfd)->vma = vma; else vma = obj_textsec (abfd)->vma; - pos += obj_textsec (abfd)->_raw_size; - vma += obj_textsec (abfd)->_raw_size; + pos += obj_textsec (abfd)->size; + vma += obj_textsec (abfd)->size; /* Data. */ obj_datasec (abfd)->filepos = pos; @@ -1102,10 +1059,10 @@ adjust_n_magic (abfd, execp) vma = obj_datasec (abfd)->vma; /* Since BSS follows data immediately, see if it needs alignment. */ - vma += obj_datasec (abfd)->_raw_size; + vma += obj_datasec (abfd)->size; pad = align_power (vma, obj_bsssec (abfd)->alignment_power) - vma; - obj_datasec (abfd)->_raw_size += pad; - pos += obj_datasec (abfd)->_raw_size; + obj_datasec (abfd)->size += pad; + pos += obj_datasec (abfd)->size; /* BSS. */ if (!obj_bsssec (abfd)->user_set_vma) @@ -1114,31 +1071,30 @@ adjust_n_magic (abfd, execp) vma = obj_bsssec (abfd)->vma; /* Fix up exec header. */ - execp->a_text = obj_textsec (abfd)->_raw_size; - execp->a_data = obj_datasec (abfd)->_raw_size; - execp->a_bss = obj_bsssec (abfd)->_raw_size; + execp->a_text = obj_textsec (abfd)->size; + execp->a_data = obj_datasec (abfd)->size; + execp->a_bss = obj_bsssec (abfd)->size; N_SET_MAGIC (*execp, NMAGIC); } bfd_boolean -NAME(aout,adjust_sizes_and_vmas) (abfd, text_size, text_end) - bfd *abfd; - bfd_size_type *text_size; - file_ptr *text_end ATTRIBUTE_UNUSED; +NAME (aout, adjust_sizes_and_vmas) (bfd *abfd, + bfd_size_type *text_size, + file_ptr *text_end ATTRIBUTE_UNUSED) { struct internal_exec *execp = exec_hdr (abfd); - if (! NAME(aout,make_sections) (abfd)) + if (! NAME (aout, make_sections) (abfd)) return FALSE; if (adata (abfd).magic != undecided_magic) return TRUE; - obj_textsec (abfd)->_raw_size = - align_power (obj_textsec (abfd)->_raw_size, + obj_textsec (abfd)->size = + align_power (obj_textsec (abfd)->size, obj_textsec (abfd)->alignment_power); - *text_size = obj_textsec (abfd)->_raw_size; + *text_size = obj_textsec (abfd)->size; /* Rule (heuristic) for when to pad to a new page. Note that there are (at least) two ways demand-paged (ZMAGIC) files have been handled. Most Berkeley-based systems start the text segment at @@ -1176,11 +1132,11 @@ NAME(aout,adjust_sizes_and_vmas) (abfd, text_size, text_end) } str; }), - obj_textsec (abfd)->vma, obj_textsec (abfd)->_raw_size, + obj_textsec (abfd)->vma, obj_textsec (abfd)->size, obj_textsec (abfd)->alignment_power, - obj_datasec (abfd)->vma, obj_datasec (abfd)->_raw_size, + obj_datasec (abfd)->vma, obj_datasec (abfd)->size, obj_datasec (abfd)->alignment_power, - obj_bsssec (abfd)->vma, obj_bsssec (abfd)->_raw_size, + obj_bsssec (abfd)->vma, obj_bsssec (abfd)->size, obj_bsssec (abfd)->alignment_power); #endif #endif @@ -1202,11 +1158,11 @@ NAME(aout,adjust_sizes_and_vmas) (abfd, text_size, text_end) #ifdef BFD_AOUT_DEBUG fprintf (stderr, " text=<%x,%x,%x> data=<%x,%x,%x> bss=<%x,%x>\n", - obj_textsec (abfd)->vma, obj_textsec (abfd)->_raw_size, + obj_textsec (abfd)->vma, obj_textsec (abfd)->size, obj_textsec (abfd)->filepos, - obj_datasec (abfd)->vma, obj_datasec (abfd)->_raw_size, + obj_datasec (abfd)->vma, obj_datasec (abfd)->size, obj_datasec (abfd)->filepos, - obj_bsssec (abfd)->vma, obj_bsssec (abfd)->_raw_size); + obj_bsssec (abfd)->vma, obj_bsssec (abfd)->size); #endif return TRUE; @@ -1219,16 +1175,14 @@ FUNCTION SYNOPSIS bfd_boolean aout_@var{size}_new_section_hook, (bfd *abfd, - asection *newsect)); + asection *newsect); DESCRIPTION Called by the BFD in response to a @code{bfd_make_section} request. */ bfd_boolean -NAME(aout,new_section_hook) (abfd, newsect) - bfd *abfd; - asection *newsect; +NAME (aout, new_section_hook) (bfd *abfd, asection *newsect) { /* Align to double at least. */ newsect->alignment_power = bfd_get_arch_info (abfd)->section_align_power; @@ -1262,19 +1216,18 @@ NAME(aout,new_section_hook) (abfd, newsect) } bfd_boolean -NAME(aout,set_section_contents) (abfd, section, location, offset, count) - bfd *abfd; - sec_ptr section; - const PTR location; - file_ptr offset; - bfd_size_type count; +NAME (aout, set_section_contents) (bfd *abfd, + sec_ptr section, + const void * location, + file_ptr offset, + bfd_size_type count) { file_ptr text_end; bfd_size_type text_size; if (! abfd->output_has_begun) { - if (! NAME(aout,adjust_sizes_and_vmas) (abfd, &text_size, &text_end)) + if (! NAME (aout, adjust_sizes_and_vmas) (abfd, &text_size, &text_end)) return FALSE; } @@ -1313,10 +1266,9 @@ NAME(aout,set_section_contents) (abfd, section, location, offset, count) /* Read the external symbols from an a.out file. */ static bfd_boolean -aout_get_external_symbols (abfd) - bfd *abfd; +aout_get_external_symbols (bfd *abfd) { - if (obj_aout_external_syms (abfd) == (struct external_nlist *) NULL) + if (obj_aout_external_syms (abfd) == NULL) { bfd_size_type count; struct external_nlist *syms; @@ -1334,9 +1286,8 @@ aout_get_external_symbols (abfd) /* We allocate using malloc to make the values easy to free later on. If we put them on the objalloc it might not be possible to free them. */ - syms = ((struct external_nlist *) - bfd_malloc (count * EXTERNAL_NLIST_SIZE)); - if (syms == (struct external_nlist *) NULL && count != 0) + syms = bfd_malloc (count * EXTERNAL_NLIST_SIZE); + if (syms == NULL && count != 0) return FALSE; amt = exec_hdr (abfd)->a_syms; @@ -1362,7 +1313,7 @@ aout_get_external_symbols (abfd) /* Get the size of the strings. */ if (bfd_seek (abfd, obj_str_filepos (abfd), SEEK_SET) != 0 - || bfd_bread ((PTR) string_chars, amt, abfd) != amt) + || bfd_bread ((void *) string_chars, amt, abfd) != amt) return FALSE; stringsize = GET_WORD (abfd, string_chars); @@ -1372,7 +1323,7 @@ aout_get_external_symbols (abfd) return FALSE; strings = (char *) obj_aout_string_window (abfd).data; #else - strings = (char *) bfd_malloc (stringsize + 1); + strings = bfd_malloc (stringsize + 1); if (strings == NULL) return FALSE; @@ -1404,9 +1355,7 @@ aout_get_external_symbols (abfd) symbol->flags and symbol->section, and adjusting symbol->value. */ static bfd_boolean -translate_from_native_sym_flags (abfd, cache_ptr) - bfd *abfd; - aout_symbol_type *cache_ptr; +translate_from_native_sym_flags (bfd *abfd, aout_symbol_type *cache_ptr) { flagword visible; @@ -1505,88 +1454,6 @@ translate_from_native_sym_flags (abfd, cache_ptr) /* This code is no longer needed. It used to be used to make the linker handle set symbols, but they are now handled in the add_symbols routine instead. */ -#if 0 - asection *section; - arelent_chain *reloc; - asection *into_section; - bfd_size_type amt; - - /* This is a set symbol. The name of the symbol is the name - of the set (e.g., __CTOR_LIST__). The value of the symbol - is the value to add to the set. We create a section with - the same name as the symbol, and add a reloc to insert the - appropriate value into the section. - - This action is actually obsolete; it used to make the - linker do the right thing, but the linker no longer uses - this function. */ - - section = bfd_get_section_by_name (abfd, cache_ptr->symbol.name); - if (section == NULL) - { - char *copy; - - amt = strlen (cache_ptr->symbol.name) + 1; - copy = bfd_alloc (abfd, amt); - if (copy == NULL) - return FALSE; - - strcpy (copy, cache_ptr->symbol.name); - section = bfd_make_section (abfd, copy); - if (section == NULL) - return FALSE; - } - - amt = sizeof (arelent_chain); - reloc = (arelent_chain *) bfd_alloc (abfd, amt); - if (reloc == NULL) - return FALSE; - - /* Build a relocation entry for the constructor. */ - switch (cache_ptr->type & N_TYPE) - { - case N_SETA: - into_section = bfd_abs_section_ptr; - cache_ptr->type = N_ABS; - break; - case N_SETT: - into_section = obj_textsec (abfd); - cache_ptr->type = N_TEXT; - break; - case N_SETD: - into_section = obj_datasec (abfd); - cache_ptr->type = N_DATA; - break; - case N_SETB: - into_section = obj_bsssec (abfd); - cache_ptr->type = N_BSS; - break; - } - - /* Build a relocation pointing into the constructor section - pointing at the symbol in the set vector specified. */ - reloc->relent.addend = cache_ptr->symbol.value; - cache_ptr->symbol.section = into_section; - reloc->relent.sym_ptr_ptr = into_section->symbol_ptr_ptr; - - /* We modify the symbol to belong to a section depending upon - the name of the symbol, and add to the size of the section - to contain a pointer to the symbol. Build a reloc entry to - relocate to this symbol attached to this section. */ - section->flags = SEC_CONSTRUCTOR | SEC_RELOC; - - section->reloc_count++; - section->alignment_power = 2; - - reloc->next = section->constructor_chain; - section->constructor_chain = reloc; - reloc->relent.address = section->_raw_size; - section->_raw_size += BYTES_IN_WORD; - - reloc->relent.howto = CTOR_TABLE_RELOC_HOWTO (abfd); - -#endif /* 0 */ - switch (cache_ptr->type & N_TYPE) { case N_SETA: @@ -1659,10 +1526,9 @@ translate_from_native_sym_flags (abfd, cache_ptr) /* Set the fields of SYM_POINTER according to CACHE_PTR. */ static bfd_boolean -translate_to_native_sym_flags (abfd, cache_ptr, sym_pointer) - bfd *abfd; - asymbol *cache_ptr; - struct external_nlist *sym_pointer; +translate_to_native_sym_flags (bfd *abfd, + asymbol *cache_ptr, + struct external_nlist *sym_pointer) { bfd_vma value = cache_ptr->value; asection *sec; @@ -1772,11 +1638,11 @@ translate_to_native_sym_flags (abfd, cache_ptr, sym_pointer) /* Native-level interface to symbols. */ asymbol * -NAME(aout,make_empty_symbol) (abfd) - bfd *abfd; +NAME (aout, make_empty_symbol) (bfd *abfd) { bfd_size_type amt = sizeof (aout_symbol_type); - aout_symbol_type *new = (aout_symbol_type *) bfd_zalloc (abfd, amt); + + aout_symbol_type *new = bfd_zalloc (abfd, amt); if (!new) return NULL; new->symbol.the_bfd = abfd; @@ -1787,14 +1653,13 @@ NAME(aout,make_empty_symbol) (abfd) /* Translate a set of internal symbols into external symbols. */ bfd_boolean -NAME(aout,translate_symbol_table) (abfd, in, ext, count, str, strsize, dynamic) - bfd *abfd; - aout_symbol_type *in; - struct external_nlist *ext; - bfd_size_type count; - char *str; - bfd_size_type strsize; - bfd_boolean dynamic; +NAME (aout, translate_symbol_table) (bfd *abfd, + aout_symbol_type *in, + struct external_nlist *ext, + bfd_size_type count, + char *str, + bfd_size_type strsize, + bfd_boolean dynamic) { struct external_nlist *ext_end; @@ -1839,15 +1704,14 @@ NAME(aout,translate_symbol_table) (abfd, in, ext, count, str, strsize, dynamic) hold them all plus all the cached symbol entries. */ bfd_boolean -NAME(aout,slurp_symbol_table) (abfd) - bfd *abfd; +NAME (aout, slurp_symbol_table) (bfd *abfd) { struct external_nlist *old_external_syms; aout_symbol_type *cached; bfd_size_type cached_size; /* If there's no work to be done, don't do any. */ - if (obj_aout_symbols (abfd) != (aout_symbol_type *) NULL) + if (obj_aout_symbols (abfd) != NULL) return TRUE; old_external_syms = obj_aout_external_syms (abfd); @@ -1857,12 +1721,12 @@ NAME(aout,slurp_symbol_table) (abfd) cached_size = obj_aout_external_sym_count (abfd); cached_size *= sizeof (aout_symbol_type); - cached = (aout_symbol_type *) bfd_zmalloc (cached_size); + cached = bfd_zmalloc (cached_size); if (cached == NULL && cached_size != 0) return FALSE; /* Convert from external symbol information to internal. */ - if (! (NAME(aout,translate_symbol_table) + if (! (NAME (aout, translate_symbol_table) (abfd, cached, obj_aout_external_syms (abfd), obj_aout_external_sym_count (abfd), @@ -1882,8 +1746,8 @@ NAME(aout,slurp_symbol_table) (abfd) want the external symbol information, so if it was allocated because of our call to aout_get_external_symbols, we free it up right away to save space. */ - if (old_external_syms == (struct external_nlist *) NULL - && obj_aout_external_syms (abfd) != (struct external_nlist *) NULL) + if (old_external_syms == NULL + && obj_aout_external_syms (abfd) != NULL) { #ifdef USE_MMAP bfd_free_window (&obj_aout_sym_window (abfd)); @@ -1905,20 +1769,14 @@ NAME(aout,slurp_symbol_table) (abfd) This hash table code breaks dbx on SunOS 4.1.3, so we don't do it if BFD_TRADITIONAL_FORMAT is set. */ -static bfd_size_type add_to_stringtab - PARAMS ((bfd *, struct bfd_strtab_hash *, const char *, bfd_boolean)); -static bfd_boolean emit_stringtab - PARAMS ((bfd *, struct bfd_strtab_hash *)); - /* Get the index of a string in a strtab, adding it if it is not already present. */ -static INLINE bfd_size_type -add_to_stringtab (abfd, tab, str, copy) - bfd *abfd; - struct bfd_strtab_hash *tab; - const char *str; - bfd_boolean copy; +static inline bfd_size_type +add_to_stringtab (bfd *abfd, + struct bfd_strtab_hash *tab, + const char *str, + bfd_boolean copy) { bfd_boolean hash; bfd_size_type index; @@ -1936,11 +1794,9 @@ add_to_stringtab (abfd, tab, str, copy) index = _bfd_stringtab_add (tab, str, hash, copy); if (index != (bfd_size_type) -1) - { - /* Add BYTES_IN_WORD to the return value to account for the - space taken up by the string table size. */ - index += BYTES_IN_WORD; - } + /* Add BYTES_IN_WORD to the return value to account for the + space taken up by the string table size. */ + index += BYTES_IN_WORD; return index; } @@ -1949,24 +1805,21 @@ add_to_stringtab (abfd, tab, str, copy) file. */ static bfd_boolean -emit_stringtab (abfd, tab) - register bfd *abfd; - struct bfd_strtab_hash *tab; +emit_stringtab (bfd *abfd, struct bfd_strtab_hash *tab) { bfd_byte buffer[BYTES_IN_WORD]; bfd_size_type amt = BYTES_IN_WORD; /* The string table starts with the size. */ PUT_WORD (abfd, _bfd_stringtab_size (tab) + BYTES_IN_WORD, buffer); - if (bfd_bwrite ((PTR) buffer, amt, abfd) != amt) + if (bfd_bwrite ((void *) buffer, amt, abfd) != amt) return FALSE; return _bfd_stringtab_emit (abfd, tab); } bfd_boolean -NAME(aout,write_syms) (abfd) - bfd *abfd; +NAME (aout, write_syms) (bfd *abfd) { unsigned int count ; asymbol **generic = bfd_get_outsymbols (abfd); @@ -2005,7 +1858,7 @@ NAME(aout,write_syms) (abfd) goto error_return; amt = EXTERNAL_NLIST_SIZE; - if (bfd_bwrite ((PTR) &nsp, amt, abfd) != amt) + if (bfd_bwrite ((void *) &nsp, amt, abfd) != amt) goto error_return; /* NB: `KEEPIT' currently overlays `udata.p', so set this only @@ -2026,35 +1879,32 @@ error_return: } long -NAME(aout,canonicalize_symtab) (abfd, location) - bfd *abfd; - asymbol **location; +NAME (aout, canonicalize_symtab) (bfd *abfd, asymbol **location) { - unsigned int counter = 0; - aout_symbol_type *symbase; + unsigned int counter = 0; + aout_symbol_type *symbase; - if (!NAME(aout,slurp_symbol_table) (abfd)) - return -1; + if (!NAME (aout, slurp_symbol_table) (abfd)) + return -1; - for (symbase = obj_aout_symbols (abfd); - counter++ < bfd_get_symcount (abfd); - ) - *(location++) = (asymbol *) (symbase++); - *location++ =0; - return bfd_get_symcount (abfd); + for (symbase = obj_aout_symbols (abfd); + counter++ < bfd_get_symcount (abfd); + ) + *(location++) = (asymbol *) (symbase++); + *location++ =0; + return bfd_get_symcount (abfd); } /* Standard reloc stuff. */ /* Output standard relocation information to a file in target byte order. */ -extern void NAME(aout,swap_std_reloc_out) - PARAMS ((bfd *, arelent *, struct reloc_std_external *)); +extern void NAME (aout, swap_std_reloc_out) + (bfd *, arelent *, struct reloc_std_external *); void -NAME(aout,swap_std_reloc_out) (abfd, g, natptr) - bfd *abfd; - arelent *g; - struct reloc_std_external *natptr; +NAME (aout, swap_std_reloc_out) (bfd *abfd, + arelent *g, + struct reloc_std_external *natptr) { int r_index; asymbol *sym = *(g->sym_ptr_ptr); @@ -2073,11 +1923,6 @@ NAME(aout,swap_std_reloc_out) (abfd, g, natptr) r_jmptable = (g->howto->type & 16) != 0; r_relative = (g->howto->type & 32) != 0; -#if 0 - /* For a standard reloc, the addend is in the object file. */ - r_addend = g->addend + (*(g->sym_ptr_ptr))->section->output_section->vma; -#endif - /* Name was clobbered by aout_write_syms to be symbol index. */ /* If this relocation is relative to a symbol then set the @@ -2142,14 +1987,13 @@ NAME(aout,swap_std_reloc_out) (abfd, g, natptr) /* Extended stuff. */ /* Output extended relocation information to a file in target byte order. */ -extern void NAME(aout,swap_ext_reloc_out) - PARAMS ((bfd *, arelent *, struct reloc_ext_external *)); +extern void NAME (aout, swap_ext_reloc_out) + (bfd *, arelent *, struct reloc_ext_external *); void -NAME(aout,swap_ext_reloc_out) (abfd, g, natptr) - bfd *abfd; - arelent *g; - register struct reloc_ext_external *natptr; +NAME (aout, swap_ext_reloc_out) (bfd *abfd, + arelent *g, + struct reloc_ext_external *natptr) { int r_index; int r_extern; @@ -2260,12 +2104,11 @@ NAME(aout,swap_ext_reloc_out) (abfd, g, natptr) } void -NAME(aout,swap_ext_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount) - bfd *abfd; - struct reloc_ext_external *bytes; - arelent *cache_ptr; - asymbol **symbols; - bfd_size_type symcount; +NAME (aout, swap_ext_reloc_in) (bfd *abfd, + struct reloc_ext_external *bytes, + arelent *cache_ptr, + asymbol **symbols, + bfd_size_type symcount) { unsigned int r_index; int r_extern; @@ -2316,12 +2159,11 @@ NAME(aout,swap_ext_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount) } void -NAME(aout,swap_std_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount) - bfd *abfd; - struct reloc_std_external *bytes; - arelent *cache_ptr; - asymbol **symbols; - bfd_size_type symcount; +NAME (aout, swap_std_reloc_in) (bfd *abfd, + struct reloc_std_external *bytes, + arelent *cache_ptr, + asymbol **symbols, + bfd_size_type symcount) { unsigned int r_index; int r_extern; @@ -2387,14 +2229,11 @@ NAME(aout,swap_std_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount) /* Read and swap the relocs for a section. */ bfd_boolean -NAME(aout,slurp_reloc_table) (abfd, asect, symbols) - bfd *abfd; - sec_ptr asect; - asymbol **symbols; +NAME (aout, slurp_reloc_table) (bfd *abfd, sec_ptr asect, asymbol **symbols) { bfd_size_type count; bfd_size_type reloc_size; - PTR relocs; + void * relocs; arelent *reloc_cache; size_t each_size; unsigned int counter = 0; @@ -2427,7 +2266,7 @@ NAME(aout,slurp_reloc_table) (abfd, asect, symbols) count = reloc_size / each_size; amt = count * sizeof (arelent); - reloc_cache = (arelent *) bfd_zmalloc (amt); + reloc_cache = bfd_zmalloc (amt); if (reloc_cache == NULL && count != 0) return FALSE; @@ -2474,9 +2313,7 @@ NAME(aout,slurp_reloc_table) (abfd, asect, symbols) /* Write out a relocation section into an object file. */ bfd_boolean -NAME(aout,squirt_out_relocs) (abfd, section) - bfd *abfd; - asection *section; +NAME (aout, squirt_out_relocs) (bfd *abfd, asection *section) { arelent **generic; unsigned char *native, *natptr; @@ -2490,7 +2327,7 @@ NAME(aout,squirt_out_relocs) (abfd, section) each_size = obj_reloc_entry_size (abfd); natsize = (bfd_size_type) each_size * count; - native = (unsigned char *) bfd_zalloc (abfd, natsize); + native = bfd_zalloc (abfd, natsize); if (!native) return FALSE; @@ -2513,7 +2350,7 @@ NAME(aout,squirt_out_relocs) (abfd, section) (struct reloc_std_external *) natptr); } - if (bfd_bwrite ((PTR) native, natsize, abfd) != natsize) + if (bfd_bwrite ((void *) native, natsize, abfd) != natsize) { bfd_release (abfd, native); return FALSE; @@ -2526,11 +2363,10 @@ NAME(aout,squirt_out_relocs) (abfd, section) /* This is stupid. This function should be a boolean predicate. */ long -NAME(aout,canonicalize_reloc) (abfd, section, relptr, symbols) - bfd *abfd; - sec_ptr section; - arelent **relptr; - asymbol **symbols; +NAME (aout, canonicalize_reloc) (bfd *abfd, + sec_ptr section, + arelent **relptr, + asymbol **symbols) { arelent *tblptr = section->relocation; unsigned int count; @@ -2541,7 +2377,7 @@ NAME(aout,canonicalize_reloc) (abfd, section, relptr, symbols) return 0; } - if (!(tblptr || NAME(aout,slurp_reloc_table) (abfd, section, symbols))) + if (!(tblptr || NAME (aout, slurp_reloc_table) (abfd, section, symbols))) return -1; if (section->flags & SEC_CONSTRUCTOR) @@ -2568,9 +2404,7 @@ NAME(aout,canonicalize_reloc) (abfd, section, relptr, symbols) } long -NAME(aout,get_reloc_upper_bound) (abfd, asect) - bfd *abfd; - sec_ptr asect; +NAME (aout, get_reloc_upper_bound) (bfd *abfd, sec_ptr asect) { if (bfd_get_format (abfd) != bfd_object) { @@ -2579,17 +2413,17 @@ NAME(aout,get_reloc_upper_bound) (abfd, asect) } if (asect->flags & SEC_CONSTRUCTOR) - return (sizeof (arelent *) * (asect->reloc_count+1)); + return sizeof (arelent *) * (asect->reloc_count + 1); if (asect == obj_datasec (abfd)) - return (sizeof (arelent *) - * ((exec_hdr (abfd)->a_drsize / obj_reloc_entry_size (abfd)) - + 1)); + return sizeof (arelent *) + * ((exec_hdr (abfd)->a_drsize / obj_reloc_entry_size (abfd)) + + 1); if (asect == obj_textsec (abfd)) - return (sizeof (arelent *) - * ((exec_hdr (abfd)->a_trsize / obj_reloc_entry_size (abfd)) - + 1)); + return sizeof (arelent *) + * ((exec_hdr (abfd)->a_trsize / obj_reloc_entry_size (abfd)) + + 1); if (asect == obj_bsssec (abfd)) return sizeof (arelent *); @@ -2602,28 +2436,25 @@ NAME(aout,get_reloc_upper_bound) (abfd, asect) } long -NAME(aout,get_symtab_upper_bound) (abfd) - bfd *abfd; +NAME (aout, get_symtab_upper_bound) (bfd *abfd) { - if (!NAME(aout,slurp_symbol_table) (abfd)) + if (!NAME (aout, slurp_symbol_table) (abfd)) return -1; return (bfd_get_symcount (abfd)+1) * (sizeof (aout_symbol_type *)); } alent * -NAME(aout,get_lineno) (ignore_abfd, ignore_symbol) - bfd *ignore_abfd ATTRIBUTE_UNUSED; - asymbol *ignore_symbol ATTRIBUTE_UNUSED; +NAME (aout, get_lineno) (bfd *ignore_abfd ATTRIBUTE_UNUSED, + asymbol *ignore_symbol ATTRIBUTE_UNUSED) { - return (alent *)NULL; + return NULL; } void -NAME(aout,get_symbol_info) (ignore_abfd, symbol, ret) - bfd *ignore_abfd ATTRIBUTE_UNUSED; - asymbol *symbol; - symbol_info *ret; +NAME (aout, get_symbol_info) (bfd *ignore_abfd ATTRIBUTE_UNUSED, + asymbol *symbol, + symbol_info *ret) { bfd_symbol_info (symbol, ret); @@ -2647,11 +2478,10 @@ NAME(aout,get_symbol_info) (ignore_abfd, symbol, ret) } void -NAME(aout,print_symbol) (abfd, afile, symbol, how) - bfd *abfd; - PTR afile; - asymbol *symbol; - bfd_print_symbol_type how; +NAME (aout, print_symbol) (bfd *abfd, + void * afile, + asymbol *symbol, + bfd_print_symbol_type how) { FILE *file = (FILE *)afile; @@ -2671,7 +2501,7 @@ NAME(aout,print_symbol) (abfd, afile, symbol, how) { const char *section_name = symbol->section->name; - bfd_print_symbol_vandf (abfd, (PTR)file, symbol); + bfd_print_symbol_vandf (abfd, (void *)file, symbol); fprintf (file," %-5s %04x %02x %02x", section_name, @@ -2695,18 +2525,15 @@ NAME(aout,print_symbol) (abfd, afile, symbol, how) BFD asymbol structures. */ long -NAME(aout,read_minisymbols) (abfd, dynamic, minisymsp, sizep) - bfd *abfd; - bfd_boolean dynamic; - PTR *minisymsp; - unsigned int *sizep; +NAME (aout, read_minisymbols) (bfd *abfd, + bfd_boolean dynamic, + void * *minisymsp, + unsigned int *sizep) { if (dynamic) - { - /* We could handle the dynamic symbols here as well, but it's - easier to hand them off. */ - return _bfd_generic_read_minisymbols (abfd, dynamic, minisymsp, sizep); - } + /* We could handle the dynamic symbols here as well, but it's + easier to hand them off. */ + return _bfd_generic_read_minisymbols (abfd, dynamic, minisymsp, sizep); if (! aout_get_external_symbols (abfd)) return -1; @@ -2714,7 +2541,7 @@ NAME(aout,read_minisymbols) (abfd, dynamic, minisymsp, sizep) if (obj_aout_external_sym_count (abfd) < MINISYM_THRESHOLD) return _bfd_generic_read_minisymbols (abfd, dynamic, minisymsp, sizep); - *minisymsp = (PTR) obj_aout_external_syms (abfd); + *minisymsp = (void *) obj_aout_external_syms (abfd); /* By passing the external symbols back from this routine, we are giving up control over the memory block. Clear @@ -2731,11 +2558,10 @@ NAME(aout,read_minisymbols) (abfd, dynamic, minisymsp, sizep) by bfd_make_empty_symbol, which we fill in here. */ asymbol * -NAME(aout,minisymbol_to_symbol) (abfd, dynamic, minisym, sym) - bfd *abfd; - bfd_boolean dynamic; - const PTR minisym; - asymbol *sym; +NAME (aout, minisymbol_to_symbol) (bfd *abfd, + bfd_boolean dynamic, + const void * minisym, + asymbol *sym) { if (dynamic || obj_aout_external_sym_count (abfd) < MINISYM_THRESHOLD) @@ -2744,7 +2570,7 @@ NAME(aout,minisymbol_to_symbol) (abfd, dynamic, minisym, sym) memset (sym, 0, sizeof (aout_symbol_type)); /* We call translate_symbol_table to translate a single symbol. */ - if (! (NAME(aout,translate_symbol_table) + if (! (NAME (aout, translate_symbol_table) (abfd, (aout_symbol_type *) sym, (struct external_nlist *) minisym, @@ -2762,22 +2588,20 @@ NAME(aout,minisymbol_to_symbol) (abfd, dynamic, minisym, sym) wanted location. */ bfd_boolean -NAME(aout,find_nearest_line) - (abfd, section, symbols, offset, filename_ptr, functionname_ptr, line_ptr) - bfd *abfd; - asection *section; - asymbol **symbols; - bfd_vma offset; - const char **filename_ptr; - const char **functionname_ptr; - unsigned int *line_ptr; +NAME (aout, find_nearest_line) (bfd *abfd, + asection *section, + asymbol **symbols, + bfd_vma offset, + const char **filename_ptr, + const char **functionname_ptr, + unsigned int *line_ptr) { /* Run down the file looking for the filename, function and linenumber. */ asymbol **p; const char *directory_name = NULL; const char *main_file_name = NULL; const char *current_file_name = NULL; - const char *line_file_name = NULL; /* Value of current_file_name at line number. */ + const char *line_file_name = NULL; /* Value of current_file_name at line number. */ const char *line_directory_name = NULL; /* Value of directory_name at line number. */ bfd_vma low_line_vma = 0; bfd_vma low_func_vma = 0; @@ -2789,7 +2613,7 @@ NAME(aout,find_nearest_line) *functionname_ptr = 0; *line_ptr = 0; - if (symbols != (asymbol **)NULL) + if (symbols != NULL) { for (p = symbols; *p; p++) { @@ -2844,7 +2668,7 @@ NAME(aout,find_nearest_line) /* Look ahead to next symbol to check if that too is an N_SO. */ p++; if (*p == NULL) - break; + goto done; q = (aout_symbol_type *) (*p); if (q->type != (int)N_SO) goto next; @@ -2917,7 +2741,7 @@ NAME(aout,find_nearest_line) adata (abfd).line_buf = buf = NULL; else { - buf = (char *) bfd_malloc (filelen + funclen + 3); + buf = bfd_malloc (filelen + funclen + 3); adata (abfd).line_buf = buf; if (buf == NULL) return FALSE; @@ -2961,9 +2785,7 @@ NAME(aout,find_nearest_line) } int -NAME(aout,sizeof_headers) (abfd, execable) - bfd *abfd; - bfd_boolean execable ATTRIBUTE_UNUSED; +NAME (aout, sizeof_headers) (bfd *abfd, bfd_boolean execable ATTRIBUTE_UNUSED) { return adata (abfd).exec_bytes_size; } @@ -2972,8 +2794,7 @@ NAME(aout,sizeof_headers) (abfd, execable) read it again later if we need it. */ bfd_boolean -NAME(aout,bfd_free_cached_info) (abfd) - bfd *abfd; +NAME (aout, bfd_free_cached_info) (bfd *abfd) { asection *o; @@ -2992,7 +2813,7 @@ NAME(aout,bfd_free_cached_info) (abfd) BFCI_FREE (obj_aout_external_syms (abfd)); BFCI_FREE (obj_aout_external_strings (abfd)); #endif - for (o = abfd->sections; o != (asection *) NULL; o = o->next) + for (o = abfd->sections; o != NULL; o = o->next) BFCI_FREE (o->relocation); #undef BFCI_FREE @@ -3001,34 +2822,21 @@ NAME(aout,bfd_free_cached_info) (abfd) /* a.out link code. */ -static bfd_boolean aout_link_add_object_symbols - PARAMS ((bfd *, struct bfd_link_info *)); -static bfd_boolean aout_link_check_archive_element - PARAMS ((bfd *, struct bfd_link_info *, bfd_boolean *)); -static bfd_boolean aout_link_free_symbols - PARAMS ((bfd *)); -static bfd_boolean aout_link_check_ar_symbols - PARAMS ((bfd *, struct bfd_link_info *, bfd_boolean *pneeded)); -static bfd_boolean aout_link_add_symbols - PARAMS ((bfd *, struct bfd_link_info *)); - /* Routine to create an entry in an a.out link hash table. */ struct bfd_hash_entry * -NAME(aout,link_hash_newfunc) (entry, table, string) - struct bfd_hash_entry *entry; - struct bfd_hash_table *table; - const char *string; +NAME (aout, link_hash_newfunc) (struct bfd_hash_entry *entry, + struct bfd_hash_table *table, + const char *string) { struct aout_link_hash_entry *ret = (struct aout_link_hash_entry *) entry; /* Allocate the structure if it has not already been allocated by a subclass. */ - if (ret == (struct aout_link_hash_entry *) NULL) - ret = ((struct aout_link_hash_entry *) - bfd_hash_allocate (table, sizeof (struct aout_link_hash_entry))); - if (ret == (struct aout_link_hash_entry *) NULL) - return (struct bfd_hash_entry *) ret; + if (ret == NULL) + ret = bfd_hash_allocate (table, sizeof (* ret)); + if (ret == NULL) + return NULL; /* Call the allocation method of the superclass. */ ret = ((struct aout_link_hash_entry *) @@ -3047,348 +2855,53 @@ NAME(aout,link_hash_newfunc) (entry, table, string) /* Initialize an a.out link hash table. */ bfd_boolean -NAME(aout,link_hash_table_init) (table, abfd, newfunc) - struct aout_link_hash_table *table; - bfd *abfd; - struct bfd_hash_entry *(*newfunc) - PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, - const char *)); +NAME (aout, link_hash_table_init) (struct aout_link_hash_table *table, + bfd *abfd, + struct bfd_hash_entry *(*newfunc) + (struct bfd_hash_entry *, struct bfd_hash_table *, + const char *), + unsigned int entsize) { - return _bfd_link_hash_table_init (&table->root, abfd, newfunc); + return _bfd_link_hash_table_init (&table->root, abfd, newfunc, entsize); } /* Create an a.out link hash table. */ struct bfd_link_hash_table * -NAME(aout,link_hash_table_create) (abfd) - bfd *abfd; +NAME (aout, link_hash_table_create) (bfd *abfd) { struct aout_link_hash_table *ret; - bfd_size_type amt = sizeof (struct aout_link_hash_table); + bfd_size_type amt = sizeof (* ret); - ret = (struct aout_link_hash_table *) bfd_malloc (amt); + ret = bfd_malloc (amt); if (ret == NULL) - return (struct bfd_link_hash_table *) NULL; + return NULL; - if (! NAME(aout,link_hash_table_init) (ret, abfd, - NAME(aout,link_hash_newfunc))) + if (!NAME (aout, link_hash_table_init) (ret, abfd, + NAME (aout, link_hash_newfunc), + sizeof (struct aout_link_hash_entry))) { free (ret); - return (struct bfd_link_hash_table *) NULL; + return NULL; } return &ret->root; } -/* Given an a.out BFD, add symbols to the global hash table as - appropriate. */ - -bfd_boolean -NAME(aout,link_add_symbols) (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - switch (bfd_get_format (abfd)) - { - case bfd_object: - return aout_link_add_object_symbols (abfd, info); - case bfd_archive: - return _bfd_generic_link_add_archive_symbols - (abfd, info, aout_link_check_archive_element); - default: - bfd_set_error (bfd_error_wrong_format); - return FALSE; - } -} - -/* Add symbols from an a.out object file. */ - -static bfd_boolean -aout_link_add_object_symbols (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - if (! aout_get_external_symbols (abfd)) - return FALSE; - if (! aout_link_add_symbols (abfd, info)) - return FALSE; - if (! info->keep_memory) - { - if (! aout_link_free_symbols (abfd)) - return FALSE; - } - return TRUE; -} - -/* Check a single archive element to see if we need to include it in - the link. *PNEEDED is set according to whether this element is - needed in the link or not. This is called from - _bfd_generic_link_add_archive_symbols. */ - -static bfd_boolean -aout_link_check_archive_element (abfd, info, pneeded) - bfd *abfd; - struct bfd_link_info *info; - bfd_boolean *pneeded; -{ - if (! aout_get_external_symbols (abfd)) - return FALSE; - - if (! aout_link_check_ar_symbols (abfd, info, pneeded)) - return FALSE; - - if (*pneeded) - { - if (! aout_link_add_symbols (abfd, info)) - return FALSE; - } - - if (! info->keep_memory || ! *pneeded) - { - if (! aout_link_free_symbols (abfd)) - return FALSE; - } - - return TRUE; -} - -/* Free up the internal symbols read from an a.out file. */ - -static bfd_boolean -aout_link_free_symbols (abfd) - bfd *abfd; -{ - if (obj_aout_external_syms (abfd) != (struct external_nlist *) NULL) - { -#ifdef USE_MMAP - bfd_free_window (&obj_aout_sym_window (abfd)); -#else - free ((PTR) obj_aout_external_syms (abfd)); -#endif - obj_aout_external_syms (abfd) = (struct external_nlist *) NULL; - } - if (obj_aout_external_strings (abfd) != (char *) NULL) - { -#ifdef USE_MMAP - bfd_free_window (&obj_aout_string_window (abfd)); -#else - free ((PTR) obj_aout_external_strings (abfd)); -#endif - obj_aout_external_strings (abfd) = (char *) NULL; - } - return TRUE; -} - -/* Look through the internal symbols to see if this object file should - be included in the link. We should include this object file if it - defines any symbols which are currently undefined. If this object - file defines a common symbol, then we may adjust the size of the - known symbol but we do not include the object file in the link - (unless there is some other reason to include it). */ - -static bfd_boolean -aout_link_check_ar_symbols (abfd, info, pneeded) - bfd *abfd; - struct bfd_link_info *info; - bfd_boolean *pneeded; -{ - register struct external_nlist *p; - struct external_nlist *pend; - char *strings; - - *pneeded = FALSE; - - /* Look through all the symbols. */ - p = obj_aout_external_syms (abfd); - pend = p + obj_aout_external_sym_count (abfd); - strings = obj_aout_external_strings (abfd); - for (; p < pend; p++) - { - int type = H_GET_8 (abfd, p->e_type); - const char *name; - struct bfd_link_hash_entry *h; - - /* Ignore symbols that are not externally visible. This is an - optimization only, as we check the type more thoroughly - below. */ - if (((type & N_EXT) == 0 - || (type & N_STAB) != 0 - || type == N_FN) - && type != N_WEAKA - && type != N_WEAKT - && type != N_WEAKD - && type != N_WEAKB) - { - if (type == N_WARNING - || type == N_INDR) - ++p; - continue; - } - - name = strings + GET_WORD (abfd, p->e_strx); - h = bfd_link_hash_lookup (info->hash, name, FALSE, FALSE, TRUE); - - /* We are only interested in symbols that are currently - undefined or common. */ - if (h == (struct bfd_link_hash_entry *) NULL - || (h->type != bfd_link_hash_undefined - && h->type != bfd_link_hash_common)) - { - if (type == (N_INDR | N_EXT)) - ++p; - continue; - } - - if (type == (N_TEXT | N_EXT) - || type == (N_DATA | N_EXT) - || type == (N_BSS | N_EXT) - || type == (N_ABS | N_EXT) - || type == (N_INDR | N_EXT)) - { - /* This object file defines this symbol. We must link it - in. This is true regardless of whether the current - definition of the symbol is undefined or common. - - If the current definition is common, we have a case in - which we have already seen an object file including: - int a; - and this object file from the archive includes: - int a = 5; - In such a case, whether to include this object is target - dependant for backward compatibility. - - FIXME: The SunOS 4.1.3 linker will pull in the archive - element if the symbol is defined in the .data section, - but not if it is defined in the .text section. That - seems a bit crazy to me, and it has not been implemented - yet. However, it might be correct. */ - if (h->type == bfd_link_hash_common) - { - int skip = 0; - - switch (info->common_skip_ar_aymbols) - { - case bfd_link_common_skip_text: - skip = (type == (N_TEXT | N_EXT)); - break; - case bfd_link_common_skip_data: - skip = (type == (N_DATA | N_EXT)); - break; - default: - case bfd_link_common_skip_all: - skip = 1; - break; - } - - if (skip) - continue; - } - - if (! (*info->callbacks->add_archive_element) (info, abfd, name)) - return FALSE; - *pneeded = TRUE; - return TRUE; - } - - if (type == (N_UNDF | N_EXT)) - { - bfd_vma value; - - value = GET_WORD (abfd, p->e_value); - if (value != 0) - { - /* This symbol is common in the object from the archive - file. */ - if (h->type == bfd_link_hash_undefined) - { - bfd *symbfd; - unsigned int power; - - symbfd = h->u.undef.abfd; - if (symbfd == (bfd *) NULL) - { - /* This symbol was created as undefined from - outside BFD. We assume that we should link - in the object file. This is done for the -u - option in the linker. */ - if (! (*info->callbacks->add_archive_element) (info, - abfd, - name)) - return FALSE; - *pneeded = TRUE; - return TRUE; - } - /* Turn the current link symbol into a common - symbol. It is already on the undefs list. */ - h->type = bfd_link_hash_common; - h->u.c.p = ((struct bfd_link_hash_common_entry *) - bfd_hash_allocate (&info->hash->table, - sizeof (struct bfd_link_hash_common_entry))); - if (h->u.c.p == NULL) - return FALSE; - - h->u.c.size = value; - - /* FIXME: This isn't quite right. The maximum - alignment of a common symbol should be set by the - architecture of the output file, not of the input - file. */ - power = bfd_log2 (value); - if (power > bfd_get_arch_info (abfd)->section_align_power) - power = bfd_get_arch_info (abfd)->section_align_power; - h->u.c.p->alignment_power = power; - - h->u.c.p->section = bfd_make_section_old_way (symbfd, - "COMMON"); - } - else - { - /* Adjust the size of the common symbol if - necessary. */ - if (value > h->u.c.size) - h->u.c.size = value; - } - } - } - - if (type == N_WEAKA - || type == N_WEAKT - || type == N_WEAKD - || type == N_WEAKB) - { - /* This symbol is weak but defined. We must pull it in if - the current link symbol is undefined, but we don't want - it if the current link symbol is common. */ - if (h->type == bfd_link_hash_undefined) - { - if (! (*info->callbacks->add_archive_element) (info, abfd, name)) - return FALSE; - *pneeded = TRUE; - return TRUE; - } - } - } - - /* We do not need this object file. */ - return TRUE; -} - /* Add all symbols from an object file to the hash table. */ static bfd_boolean -aout_link_add_symbols (abfd, info) - bfd *abfd; - struct bfd_link_info *info; +aout_link_add_symbols (bfd *abfd, struct bfd_link_info *info) { bfd_boolean (*add_one_symbol) - PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword, asection *, + (struct bfd_link_info *, bfd *, const char *, flagword, asection *, bfd_vma, const char *, bfd_boolean, bfd_boolean, - struct bfd_link_hash_entry **)); + struct bfd_link_hash_entry **); struct external_nlist *syms; bfd_size_type sym_count; char *strings; bfd_boolean copy; struct aout_link_hash_entry **sym_hash; - register struct external_nlist *p; + struct external_nlist *p; struct external_nlist *pend; bfd_size_type amt; @@ -3412,7 +2925,7 @@ aout_link_add_symbols (abfd, info) table, but keeping the list is more efficient. Perhaps this should be conditional on info->keep_memory. */ amt = sym_count * sizeof (struct aout_link_hash_entry *); - sym_hash = (struct aout_link_hash_entry **) bfd_alloc (abfd, amt); + sym_hash = bfd_alloc (abfd, amt); if (sym_hash == NULL && sym_count != 0) return FALSE; obj_aout_sym_hashes (abfd) = sym_hash; @@ -3526,8 +3039,9 @@ aout_link_add_symbols (abfd, info) break; case N_WARNING: /* A warning symbol. The next symbol is the one to warn - about. */ - BFD_ASSERT (p + 1 < pend); + about. If there is no next symbol, just look away. */ + if (p + 1 >= pend) + return TRUE; ++p; string = name; name = strings + GET_WORD (abfd, p->e_strx); @@ -3590,6 +3104,290 @@ aout_link_add_symbols (abfd, info) return TRUE; } + +/* Free up the internal symbols read from an a.out file. */ + +static bfd_boolean +aout_link_free_symbols (bfd *abfd) +{ + if (obj_aout_external_syms (abfd) != NULL) + { +#ifdef USE_MMAP + bfd_free_window (&obj_aout_sym_window (abfd)); +#else + free ((void *) obj_aout_external_syms (abfd)); +#endif + obj_aout_external_syms (abfd) = NULL; + } + if (obj_aout_external_strings (abfd) != NULL) + { +#ifdef USE_MMAP + bfd_free_window (&obj_aout_string_window (abfd)); +#else + free ((void *) obj_aout_external_strings (abfd)); +#endif + obj_aout_external_strings (abfd) = NULL; + } + return TRUE; +} + +/* Add symbols from an a.out object file. */ + +static bfd_boolean +aout_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) +{ + if (! aout_get_external_symbols (abfd)) + return FALSE; + if (! aout_link_add_symbols (abfd, info)) + return FALSE; + if (! info->keep_memory) + { + if (! aout_link_free_symbols (abfd)) + return FALSE; + } + return TRUE; +} + +/* Look through the internal symbols to see if this object file should + be included in the link. We should include this object file if it + defines any symbols which are currently undefined. If this object + file defines a common symbol, then we may adjust the size of the + known symbol but we do not include the object file in the link + (unless there is some other reason to include it). */ + +static bfd_boolean +aout_link_check_ar_symbols (bfd *abfd, + struct bfd_link_info *info, + bfd_boolean *pneeded) +{ + struct external_nlist *p; + struct external_nlist *pend; + char *strings; + + *pneeded = FALSE; + + /* Look through all the symbols. */ + p = obj_aout_external_syms (abfd); + pend = p + obj_aout_external_sym_count (abfd); + strings = obj_aout_external_strings (abfd); + for (; p < pend; p++) + { + int type = H_GET_8 (abfd, p->e_type); + const char *name; + struct bfd_link_hash_entry *h; + + /* Ignore symbols that are not externally visible. This is an + optimization only, as we check the type more thoroughly + below. */ + if (((type & N_EXT) == 0 + || (type & N_STAB) != 0 + || type == N_FN) + && type != N_WEAKA + && type != N_WEAKT + && type != N_WEAKD + && type != N_WEAKB) + { + if (type == N_WARNING + || type == N_INDR) + ++p; + continue; + } + + name = strings + GET_WORD (abfd, p->e_strx); + h = bfd_link_hash_lookup (info->hash, name, FALSE, FALSE, TRUE); + + /* We are only interested in symbols that are currently + undefined or common. */ + if (h == NULL + || (h->type != bfd_link_hash_undefined + && h->type != bfd_link_hash_common)) + { + if (type == (N_INDR | N_EXT)) + ++p; + continue; + } + + if (type == (N_TEXT | N_EXT) + || type == (N_DATA | N_EXT) + || type == (N_BSS | N_EXT) + || type == (N_ABS | N_EXT) + || type == (N_INDR | N_EXT)) + { + /* This object file defines this symbol. We must link it + in. This is true regardless of whether the current + definition of the symbol is undefined or common. + + If the current definition is common, we have a case in + which we have already seen an object file including: + int a; + and this object file from the archive includes: + int a = 5; + In such a case, whether to include this object is target + dependant for backward compatibility. + + FIXME: The SunOS 4.1.3 linker will pull in the archive + element if the symbol is defined in the .data section, + but not if it is defined in the .text section. That + seems a bit crazy to me, and it has not been implemented + yet. However, it might be correct. */ + if (h->type == bfd_link_hash_common) + { + int skip = 0; + + switch (info->common_skip_ar_aymbols) + { + case bfd_link_common_skip_text: + skip = (type == (N_TEXT | N_EXT)); + break; + case bfd_link_common_skip_data: + skip = (type == (N_DATA | N_EXT)); + break; + default: + case bfd_link_common_skip_all: + skip = 1; + break; + } + + if (skip) + continue; + } + + if (! (*info->callbacks->add_archive_element) (info, abfd, name)) + return FALSE; + *pneeded = TRUE; + return TRUE; + } + + if (type == (N_UNDF | N_EXT)) + { + bfd_vma value; + + value = GET_WORD (abfd, p->e_value); + if (value != 0) + { + /* This symbol is common in the object from the archive + file. */ + if (h->type == bfd_link_hash_undefined) + { + bfd *symbfd; + unsigned int power; + + symbfd = h->u.undef.abfd; + if (symbfd == NULL) + { + /* This symbol was created as undefined from + outside BFD. We assume that we should link + in the object file. This is done for the -u + option in the linker. */ + if (! (*info->callbacks->add_archive_element) (info, + abfd, + name)) + return FALSE; + *pneeded = TRUE; + return TRUE; + } + /* Turn the current link symbol into a common + symbol. It is already on the undefs list. */ + h->type = bfd_link_hash_common; + h->u.c.p = bfd_hash_allocate (&info->hash->table, + sizeof (struct bfd_link_hash_common_entry)); + if (h->u.c.p == NULL) + return FALSE; + + h->u.c.size = value; + + /* FIXME: This isn't quite right. The maximum + alignment of a common symbol should be set by the + architecture of the output file, not of the input + file. */ + power = bfd_log2 (value); + if (power > bfd_get_arch_info (abfd)->section_align_power) + power = bfd_get_arch_info (abfd)->section_align_power; + h->u.c.p->alignment_power = power; + + h->u.c.p->section = bfd_make_section_old_way (symbfd, + "COMMON"); + } + else + { + /* Adjust the size of the common symbol if + necessary. */ + if (value > h->u.c.size) + h->u.c.size = value; + } + } + } + + if (type == N_WEAKA + || type == N_WEAKT + || type == N_WEAKD + || type == N_WEAKB) + { + /* This symbol is weak but defined. We must pull it in if + the current link symbol is undefined, but we don't want + it if the current link symbol is common. */ + if (h->type == bfd_link_hash_undefined) + { + if (! (*info->callbacks->add_archive_element) (info, abfd, name)) + return FALSE; + *pneeded = TRUE; + return TRUE; + } + } + } + + /* We do not need this object file. */ + return TRUE; +} +/* Check a single archive element to see if we need to include it in + the link. *PNEEDED is set according to whether this element is + needed in the link or not. This is called from + _bfd_generic_link_add_archive_symbols. */ + +static bfd_boolean +aout_link_check_archive_element (bfd *abfd, + struct bfd_link_info *info, + bfd_boolean *pneeded) +{ + if (! aout_get_external_symbols (abfd)) + return FALSE; + + if (! aout_link_check_ar_symbols (abfd, info, pneeded)) + return FALSE; + + if (*pneeded) + { + if (! aout_link_add_symbols (abfd, info)) + return FALSE; + } + + if (! info->keep_memory || ! *pneeded) + { + if (! aout_link_free_symbols (abfd)) + return FALSE; + } + + return TRUE; +} + +/* Given an a.out BFD, add symbols to the global hash table as + appropriate. */ + +bfd_boolean +NAME (aout, link_add_symbols) (bfd *abfd, struct bfd_link_info *info) +{ + switch (bfd_get_format (abfd)) + { + case bfd_object: + return aout_link_add_object_symbols (abfd, info); + case bfd_archive: + return _bfd_generic_link_add_archive_symbols + (abfd, info, aout_link_check_archive_element); + default: + bfd_set_error (bfd_error_wrong_format); + return FALSE; + } +} /* A hash table used for header files with N_BINCL entries. */ @@ -3642,58 +3440,29 @@ struct aout_final_link_info /* A buffer large enough to hold the contents of any section. */ bfd_byte *contents; /* A buffer large enough to hold the relocs of any section. */ - PTR relocs; + void * relocs; /* A buffer large enough to hold the symbol map of any input BFD. */ int *symbol_map; /* A buffer large enough to hold output symbols of any input BFD. */ struct external_nlist *output_syms; }; -static struct bfd_hash_entry *aout_link_includes_newfunc - PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); -static bfd_boolean aout_link_input_bfd - PARAMS ((struct aout_final_link_info *, bfd *input_bfd)); -static bfd_boolean aout_link_write_symbols - PARAMS ((struct aout_final_link_info *, bfd *input_bfd)); -static bfd_boolean aout_link_write_other_symbol - PARAMS ((struct aout_link_hash_entry *, PTR)); -static bfd_boolean aout_link_input_section - PARAMS ((struct aout_final_link_info *, bfd *input_bfd, - asection *input_section, file_ptr *reloff_ptr, - bfd_size_type rel_size)); -static bfd_boolean aout_link_input_section_std - PARAMS ((struct aout_final_link_info *, bfd *input_bfd, - asection *input_section, struct reloc_std_external *, - bfd_size_type rel_size, bfd_byte *contents)); -static bfd_boolean aout_link_input_section_ext - PARAMS ((struct aout_final_link_info *, bfd *input_bfd, - asection *input_section, struct reloc_ext_external *, - bfd_size_type rel_size, bfd_byte *contents)); -static INLINE asection *aout_reloc_index_to_section - PARAMS ((bfd *, int)); -static bfd_boolean aout_link_reloc_link_order - PARAMS ((struct aout_final_link_info *, asection *, - struct bfd_link_order *)); - /* The function to create a new entry in the header file hash table. */ static struct bfd_hash_entry * -aout_link_includes_newfunc (entry, table, string) - struct bfd_hash_entry *entry; - struct bfd_hash_table *table; - const char *string; +aout_link_includes_newfunc (struct bfd_hash_entry *entry, + struct bfd_hash_table *table, + const char *string) { struct aout_link_includes_entry *ret = (struct aout_link_includes_entry *) entry; /* Allocate the structure if it has not already been allocated by a subclass. */ - if (ret == (struct aout_link_includes_entry *) NULL) - ret = ((struct aout_link_includes_entry *) - bfd_hash_allocate (table, - sizeof (struct aout_link_includes_entry))); - if (ret == (struct aout_link_includes_entry *) NULL) - return (struct bfd_hash_entry *) ret; + if (ret == NULL) + ret = bfd_hash_allocate (table, sizeof (* ret)); + if (ret == NULL) + return NULL; /* Call the allocation method of the superclass. */ ret = ((struct aout_link_includes_entry *) @@ -3707,408 +3476,1200 @@ aout_link_includes_newfunc (entry, table, string) return (struct bfd_hash_entry *) ret; } -/* Do the final link step. This is called on the output BFD. The - INFO structure should point to a list of BFDs linked through the - link_next field which can be used to find each BFD which takes part - in the output. Also, each section in ABFD should point to a list - of bfd_link_order structures which list all the input sections for - the output section. */ +/* Write out a symbol that was not associated with an a.out input + object. */ -bfd_boolean -NAME(aout,final_link) (abfd, info, callback) - bfd *abfd; - struct bfd_link_info *info; - void (*callback) PARAMS ((bfd *, file_ptr *, file_ptr *, file_ptr *)); +static bfd_boolean +aout_link_write_other_symbol (struct aout_link_hash_entry *h, void * data) { - struct aout_final_link_info aout_info; - bfd_boolean includes_hash_initialized = FALSE; - register bfd *sub; - bfd_size_type trsize, drsize; - bfd_size_type max_contents_size; - bfd_size_type max_relocs_size; - bfd_size_type max_sym_count; - bfd_size_type text_size; - file_ptr text_end; - register struct bfd_link_order *p; - asection *o; - bfd_boolean have_link_order_relocs; + struct aout_final_link_info *finfo = (struct aout_final_link_info *) data; + bfd *output_bfd; + int type; + bfd_vma val; + struct external_nlist outsym; + bfd_size_type indx; + bfd_size_type amt; - if (info->shared) - abfd->flags |= DYNAMIC; - - aout_info.info = info; - aout_info.output_bfd = abfd; - aout_info.contents = NULL; - aout_info.relocs = NULL; - aout_info.symbol_map = NULL; - aout_info.output_syms = NULL; - - if (! bfd_hash_table_init_n (&aout_info.includes.root, - aout_link_includes_newfunc, - 251)) - goto error_return; - includes_hash_initialized = TRUE; - - /* Figure out the largest section size. Also, if generating - relocatable output, count the relocs. */ - trsize = 0; - drsize = 0; - max_contents_size = 0; - max_relocs_size = 0; - max_sym_count = 0; - for (sub = info->input_bfds; sub != NULL; sub = sub->link_next) + if (h->root.type == bfd_link_hash_warning) { - bfd_size_type sz; + h = (struct aout_link_hash_entry *) h->root.u.i.link; + if (h->root.type == bfd_link_hash_new) + return TRUE; + } - if (info->relocatable) + output_bfd = finfo->output_bfd; + + if (aout_backend_info (output_bfd)->write_dynamic_symbol != NULL) + { + if (! ((*aout_backend_info (output_bfd)->write_dynamic_symbol) + (output_bfd, finfo->info, h))) { - if (bfd_get_flavour (sub) == bfd_target_aout_flavour) + /* FIXME: No way to handle errors. */ + abort (); + } + } + + if (h->written) + return TRUE; + + h->written = TRUE; + + /* An indx of -2 means the symbol must be written. */ + if (h->indx != -2 + && (finfo->info->strip == strip_all + || (finfo->info->strip == strip_some + && bfd_hash_lookup (finfo->info->keep_hash, h->root.root.string, + FALSE, FALSE) == NULL))) + return TRUE; + + switch (h->root.type) + { + default: + case bfd_link_hash_warning: + abort (); + /* Avoid variable not initialized warnings. */ + return TRUE; + case bfd_link_hash_new: + /* This can happen for set symbols when sets are not being + built. */ + return TRUE; + case bfd_link_hash_undefined: + type = N_UNDF | N_EXT; + val = 0; + break; + case bfd_link_hash_defined: + case bfd_link_hash_defweak: + { + asection *sec; + + sec = h->root.u.def.section->output_section; + BFD_ASSERT (bfd_is_abs_section (sec) + || sec->owner == output_bfd); + if (sec == obj_textsec (output_bfd)) + type = h->root.type == bfd_link_hash_defined ? N_TEXT : N_WEAKT; + else if (sec == obj_datasec (output_bfd)) + type = h->root.type == bfd_link_hash_defined ? N_DATA : N_WEAKD; + else if (sec == obj_bsssec (output_bfd)) + type = h->root.type == bfd_link_hash_defined ? N_BSS : N_WEAKB; + else + type = h->root.type == bfd_link_hash_defined ? N_ABS : N_WEAKA; + type |= N_EXT; + val = (h->root.u.def.value + + sec->vma + + h->root.u.def.section->output_offset); + } + break; + case bfd_link_hash_common: + type = N_UNDF | N_EXT; + val = h->root.u.c.size; + break; + case bfd_link_hash_undefweak: + type = N_WEAKU; + val = 0; + case bfd_link_hash_indirect: + /* We ignore these symbols, since the indirected symbol is + already in the hash table. */ + return TRUE; + } + + H_PUT_8 (output_bfd, type, outsym.e_type); + H_PUT_8 (output_bfd, 0, outsym.e_other); + H_PUT_16 (output_bfd, 0, outsym.e_desc); + indx = add_to_stringtab (output_bfd, finfo->strtab, h->root.root.string, + FALSE); + if (indx == - (bfd_size_type) 1) + /* FIXME: No way to handle errors. */ + abort (); + + PUT_WORD (output_bfd, indx, outsym.e_strx); + PUT_WORD (output_bfd, val, outsym.e_value); + + amt = EXTERNAL_NLIST_SIZE; + if (bfd_seek (output_bfd, finfo->symoff, SEEK_SET) != 0 + || bfd_bwrite ((void *) &outsym, amt, output_bfd) != amt) + /* FIXME: No way to handle errors. */ + abort (); + + finfo->symoff += EXTERNAL_NLIST_SIZE; + h->indx = obj_aout_external_sym_count (output_bfd); + ++obj_aout_external_sym_count (output_bfd); + + return TRUE; +} + +/* Handle a link order which is supposed to generate a reloc. */ + +static bfd_boolean +aout_link_reloc_link_order (struct aout_final_link_info *finfo, + asection *o, + struct bfd_link_order *p) +{ + struct bfd_link_order_reloc *pr; + int r_index; + int r_extern; + reloc_howto_type *howto; + file_ptr *reloff_ptr = NULL; + struct reloc_std_external srel; + struct reloc_ext_external erel; + void * rel_ptr; + bfd_size_type amt; + + pr = p->u.reloc.p; + + if (p->type == bfd_section_reloc_link_order) + { + r_extern = 0; + if (bfd_is_abs_section (pr->u.section)) + r_index = N_ABS | N_EXT; + else + { + BFD_ASSERT (pr->u.section->owner == finfo->output_bfd); + r_index = pr->u.section->target_index; + } + } + else + { + struct aout_link_hash_entry *h; + + BFD_ASSERT (p->type == bfd_symbol_reloc_link_order); + r_extern = 1; + h = ((struct aout_link_hash_entry *) + bfd_wrapped_link_hash_lookup (finfo->output_bfd, finfo->info, + pr->u.name, FALSE, FALSE, TRUE)); + if (h != NULL + && h->indx >= 0) + r_index = h->indx; + else if (h != NULL) + { + /* We decided to strip this symbol, but it turns out that we + can't. Note that we lose the other and desc information + here. I don't think that will ever matter for a global + symbol. */ + h->indx = -2; + h->written = FALSE; + if (! aout_link_write_other_symbol (h, (void *) finfo)) + return FALSE; + r_index = h->indx; + } + else + { + if (! ((*finfo->info->callbacks->unattached_reloc) + (finfo->info, pr->u.name, NULL, NULL, (bfd_vma) 0))) + return FALSE; + r_index = 0; + } + } + + howto = bfd_reloc_type_lookup (finfo->output_bfd, pr->reloc); + if (howto == 0) + { + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + + if (o == obj_textsec (finfo->output_bfd)) + reloff_ptr = &finfo->treloff; + else if (o == obj_datasec (finfo->output_bfd)) + reloff_ptr = &finfo->dreloff; + else + abort (); + + if (obj_reloc_entry_size (finfo->output_bfd) == RELOC_STD_SIZE) + { +#ifdef MY_put_reloc + MY_put_reloc (finfo->output_bfd, r_extern, r_index, p->offset, howto, + &srel); +#else + { + int r_pcrel; + int r_baserel; + int r_jmptable; + int r_relative; + int r_length; + + r_pcrel = (int) howto->pc_relative; + r_baserel = (howto->type & 8) != 0; + r_jmptable = (howto->type & 16) != 0; + r_relative = (howto->type & 32) != 0; + r_length = howto->size; + + PUT_WORD (finfo->output_bfd, p->offset, srel.r_address); + if (bfd_header_big_endian (finfo->output_bfd)) + { + srel.r_index[0] = r_index >> 16; + srel.r_index[1] = r_index >> 8; + srel.r_index[2] = r_index; + srel.r_type[0] = + ((r_extern ? RELOC_STD_BITS_EXTERN_BIG : 0) + | (r_pcrel ? RELOC_STD_BITS_PCREL_BIG : 0) + | (r_baserel ? RELOC_STD_BITS_BASEREL_BIG : 0) + | (r_jmptable ? RELOC_STD_BITS_JMPTABLE_BIG : 0) + | (r_relative ? RELOC_STD_BITS_RELATIVE_BIG : 0) + | (r_length << RELOC_STD_BITS_LENGTH_SH_BIG)); + } + else + { + srel.r_index[2] = r_index >> 16; + srel.r_index[1] = r_index >> 8; + srel.r_index[0] = r_index; + srel.r_type[0] = + ((r_extern ? RELOC_STD_BITS_EXTERN_LITTLE : 0) + | (r_pcrel ? RELOC_STD_BITS_PCREL_LITTLE : 0) + | (r_baserel ? RELOC_STD_BITS_BASEREL_LITTLE : 0) + | (r_jmptable ? RELOC_STD_BITS_JMPTABLE_LITTLE : 0) + | (r_relative ? RELOC_STD_BITS_RELATIVE_LITTLE : 0) + | (r_length << RELOC_STD_BITS_LENGTH_SH_LITTLE)); + } + } +#endif + rel_ptr = (void *) &srel; + + /* We have to write the addend into the object file, since + standard a.out relocs are in place. It would be more + reliable if we had the current contents of the file here, + rather than assuming zeroes, but we can't read the file since + it was opened using bfd_openw. */ + if (pr->addend != 0) + { + bfd_size_type size; + bfd_reloc_status_type r; + bfd_byte *buf; + bfd_boolean ok; + + size = bfd_get_reloc_size (howto); + buf = bfd_zmalloc (size); + if (buf == NULL) + return FALSE; + r = MY_relocate_contents (howto, finfo->output_bfd, + (bfd_vma) pr->addend, buf); + switch (r) { - trsize += exec_hdr (sub)->a_trsize; - drsize += exec_hdr (sub)->a_drsize; + case bfd_reloc_ok: + break; + default: + case bfd_reloc_outofrange: + abort (); + case bfd_reloc_overflow: + if (! ((*finfo->info->callbacks->reloc_overflow) + (finfo->info, NULL, + (p->type == bfd_section_reloc_link_order + ? bfd_section_name (finfo->output_bfd, + pr->u.section) + : pr->u.name), + howto->name, pr->addend, NULL, NULL, (bfd_vma) 0))) + { + free (buf); + return FALSE; + } + break; + } + ok = bfd_set_section_contents (finfo->output_bfd, o, (void *) buf, + (file_ptr) p->offset, size); + free (buf); + if (! ok) + return FALSE; + } + } + else + { +#ifdef MY_put_ext_reloc + MY_put_ext_reloc (finfo->output_bfd, r_extern, r_index, p->offset, + howto, &erel, pr->addend); +#else + PUT_WORD (finfo->output_bfd, p->offset, erel.r_address); + + if (bfd_header_big_endian (finfo->output_bfd)) + { + erel.r_index[0] = r_index >> 16; + erel.r_index[1] = r_index >> 8; + erel.r_index[2] = r_index; + erel.r_type[0] = + ((r_extern ? RELOC_EXT_BITS_EXTERN_BIG : 0) + | (howto->type << RELOC_EXT_BITS_TYPE_SH_BIG)); + } + else + { + erel.r_index[2] = r_index >> 16; + erel.r_index[1] = r_index >> 8; + erel.r_index[0] = r_index; + erel.r_type[0] = + (r_extern ? RELOC_EXT_BITS_EXTERN_LITTLE : 0) + | (howto->type << RELOC_EXT_BITS_TYPE_SH_LITTLE); + } + + PUT_WORD (finfo->output_bfd, (bfd_vma) pr->addend, erel.r_addend); +#endif /* MY_put_ext_reloc */ + + rel_ptr = (void *) &erel; + } + + amt = obj_reloc_entry_size (finfo->output_bfd); + if (bfd_seek (finfo->output_bfd, *reloff_ptr, SEEK_SET) != 0 + || bfd_bwrite (rel_ptr, amt, finfo->output_bfd) != amt) + return FALSE; + + *reloff_ptr += obj_reloc_entry_size (finfo->output_bfd); + + /* Assert that the relocs have not run into the symbols, and that n + the text relocs have not run into the data relocs. */ + BFD_ASSERT (*reloff_ptr <= obj_sym_filepos (finfo->output_bfd) + && (reloff_ptr != &finfo->treloff + || (*reloff_ptr + <= obj_datasec (finfo->output_bfd)->rel_filepos))); + + return TRUE; +} + +/* Get the section corresponding to a reloc index. */ + +static INLINE asection * +aout_reloc_index_to_section (bfd *abfd, int indx) +{ + switch (indx & N_TYPE) + { + case N_TEXT: return obj_textsec (abfd); + case N_DATA: return obj_datasec (abfd); + case N_BSS: return obj_bsssec (abfd); + case N_ABS: + case N_UNDF: return bfd_abs_section_ptr; + default: abort (); + } + return NULL; +} + +/* Relocate an a.out section using standard a.out relocs. */ + +static bfd_boolean +aout_link_input_section_std (struct aout_final_link_info *finfo, + bfd *input_bfd, + asection *input_section, + struct reloc_std_external *relocs, + bfd_size_type rel_size, + bfd_byte *contents) +{ + bfd_boolean (*check_dynamic_reloc) + (struct bfd_link_info *, bfd *, asection *, + struct aout_link_hash_entry *, void *, bfd_byte *, bfd_boolean *, + bfd_vma *); + bfd *output_bfd; + bfd_boolean relocatable; + struct external_nlist *syms; + char *strings; + struct aout_link_hash_entry **sym_hashes; + int *symbol_map; + bfd_size_type reloc_count; + struct reloc_std_external *rel; + struct reloc_std_external *rel_end; + + output_bfd = finfo->output_bfd; + check_dynamic_reloc = aout_backend_info (output_bfd)->check_dynamic_reloc; + + BFD_ASSERT (obj_reloc_entry_size (input_bfd) == RELOC_STD_SIZE); + BFD_ASSERT (input_bfd->xvec->header_byteorder + == output_bfd->xvec->header_byteorder); + + relocatable = finfo->info->relocatable; + syms = obj_aout_external_syms (input_bfd); + strings = obj_aout_external_strings (input_bfd); + sym_hashes = obj_aout_sym_hashes (input_bfd); + symbol_map = finfo->symbol_map; + + reloc_count = rel_size / RELOC_STD_SIZE; + rel = relocs; + rel_end = rel + reloc_count; + for (; rel < rel_end; rel++) + { + bfd_vma r_addr; + int r_index; + int r_extern; + int r_pcrel; + int r_baserel = 0; + reloc_howto_type *howto; + struct aout_link_hash_entry *h = NULL; + bfd_vma relocation; + bfd_reloc_status_type r; + + r_addr = GET_SWORD (input_bfd, rel->r_address); + +#ifdef MY_reloc_howto + howto = MY_reloc_howto (input_bfd, rel, r_index, r_extern, r_pcrel); +#else + { + int r_jmptable; + int r_relative; + int r_length; + unsigned int howto_idx; + + if (bfd_header_big_endian (input_bfd)) + { + r_index = (((unsigned int) rel->r_index[0] << 16) + | ((unsigned int) rel->r_index[1] << 8) + | rel->r_index[2]); + r_extern = (0 != (rel->r_type[0] & RELOC_STD_BITS_EXTERN_BIG)); + r_pcrel = (0 != (rel->r_type[0] & RELOC_STD_BITS_PCREL_BIG)); + r_baserel = (0 != (rel->r_type[0] & RELOC_STD_BITS_BASEREL_BIG)); + r_jmptable= (0 != (rel->r_type[0] & RELOC_STD_BITS_JMPTABLE_BIG)); + r_relative= (0 != (rel->r_type[0] & RELOC_STD_BITS_RELATIVE_BIG)); + r_length = ((rel->r_type[0] & RELOC_STD_BITS_LENGTH_BIG) + >> RELOC_STD_BITS_LENGTH_SH_BIG); + } + else + { + r_index = (((unsigned int) rel->r_index[2] << 16) + | ((unsigned int) rel->r_index[1] << 8) + | rel->r_index[0]); + r_extern = (0 != (rel->r_type[0] & RELOC_STD_BITS_EXTERN_LITTLE)); + r_pcrel = (0 != (rel->r_type[0] & RELOC_STD_BITS_PCREL_LITTLE)); + r_baserel = (0 != (rel->r_type[0] + & RELOC_STD_BITS_BASEREL_LITTLE)); + r_jmptable= (0 != (rel->r_type[0] + & RELOC_STD_BITS_JMPTABLE_LITTLE)); + r_relative= (0 != (rel->r_type[0] + & RELOC_STD_BITS_RELATIVE_LITTLE)); + r_length = ((rel->r_type[0] & RELOC_STD_BITS_LENGTH_LITTLE) + >> RELOC_STD_BITS_LENGTH_SH_LITTLE); + } + + howto_idx = (r_length + 4 * r_pcrel + 8 * r_baserel + + 16 * r_jmptable + 32 * r_relative); + BFD_ASSERT (howto_idx < TABLE_SIZE (howto_table_std)); + howto = howto_table_std + howto_idx; + } +#endif + + if (relocatable) + { + /* We are generating a relocatable output file, and must + modify the reloc accordingly. */ + if (r_extern) + { + /* If we know the symbol this relocation is against, + convert it into a relocation against a section. This + is what the native linker does. */ + h = sym_hashes[r_index]; + if (h != NULL + && (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak)) + { + asection *output_section; + + /* Change the r_extern value. */ + if (bfd_header_big_endian (output_bfd)) + rel->r_type[0] &=~ RELOC_STD_BITS_EXTERN_BIG; + else + rel->r_type[0] &=~ RELOC_STD_BITS_EXTERN_LITTLE; + + /* Compute a new r_index. */ + output_section = h->root.u.def.section->output_section; + if (output_section == obj_textsec (output_bfd)) + r_index = N_TEXT; + else if (output_section == obj_datasec (output_bfd)) + r_index = N_DATA; + else if (output_section == obj_bsssec (output_bfd)) + r_index = N_BSS; + else + r_index = N_ABS; + + /* Add the symbol value and the section VMA to the + addend stored in the contents. */ + relocation = (h->root.u.def.value + + output_section->vma + + h->root.u.def.section->output_offset); + } + else + { + /* We must change r_index according to the symbol + map. */ + r_index = symbol_map[r_index]; + + if (r_index == -1) + { + if (h != NULL) + { + /* We decided to strip this symbol, but it + turns out that we can't. Note that we + lose the other and desc information here. + I don't think that will ever matter for a + global symbol. */ + if (h->indx < 0) + { + h->indx = -2; + h->written = FALSE; + if (! aout_link_write_other_symbol (h, + (void *) finfo)) + return FALSE; + } + r_index = h->indx; + } + else + { + const char *name; + + name = strings + GET_WORD (input_bfd, + syms[r_index].e_strx); + if (! ((*finfo->info->callbacks->unattached_reloc) + (finfo->info, name, input_bfd, input_section, + r_addr))) + return FALSE; + r_index = 0; + } + } + + relocation = 0; + } + + /* Write out the new r_index value. */ + if (bfd_header_big_endian (output_bfd)) + { + rel->r_index[0] = r_index >> 16; + rel->r_index[1] = r_index >> 8; + rel->r_index[2] = r_index; + } + else + { + rel->r_index[2] = r_index >> 16; + rel->r_index[1] = r_index >> 8; + rel->r_index[0] = r_index; + } } else { - /* FIXME: We need to identify the .text and .data sections - and call get_reloc_upper_bound and canonicalize_reloc to - work out the number of relocs needed, and then multiply - by the reloc size. */ - (*_bfd_error_handler) - (_("%s: relocatable link from %s to %s not supported"), - bfd_get_filename (abfd), - sub->xvec->name, abfd->xvec->name); - bfd_set_error (bfd_error_invalid_operation); - goto error_return; + asection *section; + + /* This is a relocation against a section. We must + adjust by the amount that the section moved. */ + section = aout_reloc_index_to_section (input_bfd, r_index); + relocation = (section->output_section->vma + + section->output_offset + - section->vma); } + + /* Change the address of the relocation. */ + PUT_WORD (output_bfd, + r_addr + input_section->output_offset, + rel->r_address); + + /* Adjust a PC relative relocation by removing the reference + to the original address in the section and including the + reference to the new address. */ + if (r_pcrel) + relocation -= (input_section->output_section->vma + + input_section->output_offset + - input_section->vma); + +#ifdef MY_relocatable_reloc + MY_relocatable_reloc (howto, output_bfd, rel, relocation, r_addr); +#endif + + if (relocation == 0) + r = bfd_reloc_ok; + else + r = MY_relocate_contents (howto, + input_bfd, relocation, + contents + r_addr); } - - if (bfd_get_flavour (sub) == bfd_target_aout_flavour) + else { - sz = bfd_section_size (sub, obj_textsec (sub)); - if (sz > max_contents_size) - max_contents_size = sz; - sz = bfd_section_size (sub, obj_datasec (sub)); - if (sz > max_contents_size) - max_contents_size = sz; + bfd_boolean hundef; - sz = exec_hdr (sub)->a_trsize; - if (sz > max_relocs_size) - max_relocs_size = sz; - sz = exec_hdr (sub)->a_drsize; - if (sz > max_relocs_size) - max_relocs_size = sz; + /* We are generating an executable, and must do a full + relocation. */ + hundef = FALSE; - sz = obj_aout_external_sym_count (sub); - if (sz > max_sym_count) - max_sym_count = sz; - } - } - - if (info->relocatable) - { - if (obj_textsec (abfd) != (asection *) NULL) - trsize += (_bfd_count_link_order_relocs (obj_textsec (abfd) - ->link_order_head) - * obj_reloc_entry_size (abfd)); - if (obj_datasec (abfd) != (asection *) NULL) - drsize += (_bfd_count_link_order_relocs (obj_datasec (abfd) - ->link_order_head) - * obj_reloc_entry_size (abfd)); - } - - exec_hdr (abfd)->a_trsize = trsize; - exec_hdr (abfd)->a_drsize = drsize; - - exec_hdr (abfd)->a_entry = bfd_get_start_address (abfd); - - /* Adjust the section sizes and vmas according to the magic number. - This sets a_text, a_data and a_bss in the exec_hdr and sets the - filepos for each section. */ - if (! NAME(aout,adjust_sizes_and_vmas) (abfd, &text_size, &text_end)) - goto error_return; - - /* The relocation and symbol file positions differ among a.out - targets. We are passed a callback routine from the backend - specific code to handle this. - FIXME: At this point we do not know how much space the symbol - table will require. This will not work for any (nonstandard) - a.out target that needs to know the symbol table size before it - can compute the relocation file positions. This may or may not - be the case for the hp300hpux target, for example. */ - (*callback) (abfd, &aout_info.treloff, &aout_info.dreloff, - &aout_info.symoff); - obj_textsec (abfd)->rel_filepos = aout_info.treloff; - obj_datasec (abfd)->rel_filepos = aout_info.dreloff; - obj_sym_filepos (abfd) = aout_info.symoff; - - /* We keep a count of the symbols as we output them. */ - obj_aout_external_sym_count (abfd) = 0; - - /* We accumulate the string table as we write out the symbols. */ - aout_info.strtab = _bfd_stringtab_init (); - if (aout_info.strtab == NULL) - goto error_return; - - /* Allocate buffers to hold section contents and relocs. */ - aout_info.contents = (bfd_byte *) bfd_malloc (max_contents_size); - aout_info.relocs = (PTR) bfd_malloc (max_relocs_size); - aout_info.symbol_map = (int *) bfd_malloc (max_sym_count * sizeof (int *)); - aout_info.output_syms = ((struct external_nlist *) - bfd_malloc ((max_sym_count + 1) - * sizeof (struct external_nlist))); - if ((aout_info.contents == NULL && max_contents_size != 0) - || (aout_info.relocs == NULL && max_relocs_size != 0) - || (aout_info.symbol_map == NULL && max_sym_count != 0) - || aout_info.output_syms == NULL) - goto error_return; - - /* If we have a symbol named __DYNAMIC, force it out now. This is - required by SunOS. Doing this here rather than in sunos.c is a - hack, but it's easier than exporting everything which would be - needed. */ - { - struct aout_link_hash_entry *h; - - h = aout_link_hash_lookup (aout_hash_table (info), "__DYNAMIC", - FALSE, FALSE, FALSE); - if (h != NULL) - aout_link_write_other_symbol (h, &aout_info); - } - - /* The most time efficient way to do the link would be to read all - the input object files into memory and then sort out the - information into the output file. Unfortunately, that will - probably use too much memory. Another method would be to step - through everything that composes the text section and write it - out, and then everything that composes the data section and write - it out, and then write out the relocs, and then write out the - symbols. Unfortunately, that requires reading stuff from each - input file several times, and we will not be able to keep all the - input files open simultaneously, and reopening them will be slow. - - What we do is basically process one input file at a time. We do - everything we need to do with an input file once--copy over the - section contents, handle the relocation information, and write - out the symbols--and then we throw away the information we read - from it. This approach requires a lot of lseeks of the output - file, which is unfortunate but still faster than reopening a lot - of files. - - We use the output_has_begun field of the input BFDs to see - whether we have already handled it. */ - for (sub = info->input_bfds; sub != (bfd *) NULL; sub = sub->link_next) - sub->output_has_begun = FALSE; - - /* Mark all sections which are to be included in the link. This - will normally be every section. We need to do this so that we - can identify any sections which the linker has decided to not - include. */ - for (o = abfd->sections; o != NULL; o = o->next) - { - for (p = o->link_order_head; p != NULL; p = p->next) - if (p->type == bfd_indirect_link_order) - p->u.indirect.section->linker_mark = TRUE; - } - - have_link_order_relocs = FALSE; - for (o = abfd->sections; o != (asection *) NULL; o = o->next) - { - for (p = o->link_order_head; - p != (struct bfd_link_order *) NULL; - p = p->next) - { - if (p->type == bfd_indirect_link_order - && (bfd_get_flavour (p->u.indirect.section->owner) - == bfd_target_aout_flavour)) + if (r_extern) { - bfd *input_bfd; + h = sym_hashes[r_index]; - input_bfd = p->u.indirect.section->owner; - if (! input_bfd->output_has_begun) + if (h != NULL + && (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak)) { - if (! aout_link_input_bfd (&aout_info, input_bfd)) - goto error_return; - input_bfd->output_has_begun = TRUE; + relocation = (h->root.u.def.value + + h->root.u.def.section->output_section->vma + + h->root.u.def.section->output_offset); + } + else if (h != NULL + && h->root.type == bfd_link_hash_undefweak) + relocation = 0; + else + { + hundef = TRUE; + relocation = 0; } - } - else if (p->type == bfd_section_reloc_link_order - || p->type == bfd_symbol_reloc_link_order) - { - /* These are handled below. */ - have_link_order_relocs = TRUE; } else { - if (! _bfd_default_link_order (abfd, info, o, p)) - goto error_return; + asection *section; + + section = aout_reloc_index_to_section (input_bfd, r_index); + relocation = (section->output_section->vma + + section->output_offset + - section->vma); + if (r_pcrel) + relocation += input_section->vma; } - } - } - /* Write out any symbols that we have not already written out. */ - aout_link_hash_traverse (aout_hash_table (info), - aout_link_write_other_symbol, - (PTR) &aout_info); - - /* Now handle any relocs we were asked to create by the linker. - These did not come from any input file. We must do these after - we have written out all the symbols, so that we know the symbol - indices to use. */ - if (have_link_order_relocs) - { - for (o = abfd->sections; o != (asection *) NULL; o = o->next) - { - for (p = o->link_order_head; - p != (struct bfd_link_order *) NULL; - p = p->next) + if (check_dynamic_reloc != NULL) { - if (p->type == bfd_section_reloc_link_order - || p->type == bfd_symbol_reloc_link_order) - { - if (! aout_link_reloc_link_order (&aout_info, o, p)) - goto error_return; - } + bfd_boolean skip; + + if (! ((*check_dynamic_reloc) + (finfo->info, input_bfd, input_section, h, + (void *) rel, contents, &skip, &relocation))) + return FALSE; + if (skip) + continue; + } + + /* Now warn if a global symbol is undefined. We could not + do this earlier, because check_dynamic_reloc might want + to skip this reloc. */ + if (hundef && ! finfo->info->shared && ! r_baserel) + { + const char *name; + + if (h != NULL) + name = h->root.root.string; + else + name = strings + GET_WORD (input_bfd, syms[r_index].e_strx); + if (! ((*finfo->info->callbacks->undefined_symbol) + (finfo->info, name, input_bfd, input_section, + r_addr, TRUE))) + return FALSE; + } + + r = MY_final_link_relocate (howto, + input_bfd, input_section, + contents, r_addr, relocation, + (bfd_vma) 0); + } + + if (r != bfd_reloc_ok) + { + switch (r) + { + default: + case bfd_reloc_outofrange: + abort (); + case bfd_reloc_overflow: + { + const char *name; + + if (h != NULL) + name = NULL; + else if (r_extern) + name = strings + GET_WORD (input_bfd, + syms[r_index].e_strx); + else + { + asection *s; + + s = aout_reloc_index_to_section (input_bfd, r_index); + name = bfd_section_name (input_bfd, s); + } + if (! ((*finfo->info->callbacks->reloc_overflow) + (finfo->info, (h ? &h->root : NULL), name, + howto->name, (bfd_vma) 0, input_bfd, + input_section, r_addr))) + return FALSE; + } + break; } } } - if (aout_info.contents != NULL) - { - free (aout_info.contents); - aout_info.contents = NULL; - } - if (aout_info.relocs != NULL) - { - free (aout_info.relocs); - aout_info.relocs = NULL; - } - if (aout_info.symbol_map != NULL) - { - free (aout_info.symbol_map); - aout_info.symbol_map = NULL; - } - if (aout_info.output_syms != NULL) - { - free (aout_info.output_syms); - aout_info.output_syms = NULL; - } - if (includes_hash_initialized) - { - bfd_hash_table_free (&aout_info.includes.root); - includes_hash_initialized = FALSE; - } - - /* Finish up any dynamic linking we may be doing. */ - if (aout_backend_info (abfd)->finish_dynamic_link != NULL) - { - if (! (*aout_backend_info (abfd)->finish_dynamic_link) (abfd, info)) - goto error_return; - } - - /* Update the header information. */ - abfd->symcount = obj_aout_external_sym_count (abfd); - exec_hdr (abfd)->a_syms = abfd->symcount * EXTERNAL_NLIST_SIZE; - obj_str_filepos (abfd) = obj_sym_filepos (abfd) + exec_hdr (abfd)->a_syms; - obj_textsec (abfd)->reloc_count = - exec_hdr (abfd)->a_trsize / obj_reloc_entry_size (abfd); - obj_datasec (abfd)->reloc_count = - exec_hdr (abfd)->a_drsize / obj_reloc_entry_size (abfd); - - /* Write out the string table, unless there are no symbols. */ - if (abfd->symcount > 0) - { - if (bfd_seek (abfd, obj_str_filepos (abfd), SEEK_SET) != 0 - || ! emit_stringtab (abfd, aout_info.strtab)) - goto error_return; - } - else if (obj_textsec (abfd)->reloc_count == 0 - && obj_datasec (abfd)->reloc_count == 0) - { - bfd_byte b; - file_ptr pos; - - b = 0; - pos = obj_datasec (abfd)->filepos + exec_hdr (abfd)->a_data - 1; - if (bfd_seek (abfd, pos, SEEK_SET) != 0 - || bfd_bwrite (&b, (bfd_size_type) 1, abfd) != 1) - goto error_return; - } - return TRUE; - - error_return: - if (aout_info.contents != NULL) - free (aout_info.contents); - if (aout_info.relocs != NULL) - free (aout_info.relocs); - if (aout_info.symbol_map != NULL) - free (aout_info.symbol_map); - if (aout_info.output_syms != NULL) - free (aout_info.output_syms); - if (includes_hash_initialized) - bfd_hash_table_free (&aout_info.includes.root); - return FALSE; } -/* Link an a.out input BFD into the output file. */ +/* Relocate an a.out section using extended a.out relocs. */ static bfd_boolean -aout_link_input_bfd (finfo, input_bfd) - struct aout_final_link_info *finfo; - bfd *input_bfd; +aout_link_input_section_ext (struct aout_final_link_info *finfo, + bfd *input_bfd, + asection *input_section, + struct reloc_ext_external *relocs, + bfd_size_type rel_size, + bfd_byte *contents) { - bfd_size_type sym_count; + bfd_boolean (*check_dynamic_reloc) + (struct bfd_link_info *, bfd *, asection *, + struct aout_link_hash_entry *, void *, bfd_byte *, bfd_boolean *, + bfd_vma *); + bfd *output_bfd; + bfd_boolean relocatable; + struct external_nlist *syms; + char *strings; + struct aout_link_hash_entry **sym_hashes; + int *symbol_map; + bfd_size_type reloc_count; + struct reloc_ext_external *rel; + struct reloc_ext_external *rel_end; - BFD_ASSERT (bfd_get_format (input_bfd) == bfd_object); + output_bfd = finfo->output_bfd; + check_dynamic_reloc = aout_backend_info (output_bfd)->check_dynamic_reloc; - /* If this is a dynamic object, it may need special handling. */ - if ((input_bfd->flags & DYNAMIC) != 0 - && aout_backend_info (input_bfd)->link_dynamic_object != NULL) + BFD_ASSERT (obj_reloc_entry_size (input_bfd) == RELOC_EXT_SIZE); + BFD_ASSERT (input_bfd->xvec->header_byteorder + == output_bfd->xvec->header_byteorder); + + relocatable = finfo->info->relocatable; + syms = obj_aout_external_syms (input_bfd); + strings = obj_aout_external_strings (input_bfd); + sym_hashes = obj_aout_sym_hashes (input_bfd); + symbol_map = finfo->symbol_map; + + reloc_count = rel_size / RELOC_EXT_SIZE; + rel = relocs; + rel_end = rel + reloc_count; + for (; rel < rel_end; rel++) { - return ((*aout_backend_info (input_bfd)->link_dynamic_object) - (finfo->info, input_bfd)); + bfd_vma r_addr; + int r_index; + int r_extern; + unsigned int r_type; + bfd_vma r_addend; + struct aout_link_hash_entry *h = NULL; + asection *r_section = NULL; + bfd_vma relocation; + + r_addr = GET_SWORD (input_bfd, rel->r_address); + + if (bfd_header_big_endian (input_bfd)) + { + r_index = (((unsigned int) rel->r_index[0] << 16) + | ((unsigned int) 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 = (((unsigned int) rel->r_index[2] << 16) + | ((unsigned int) rel->r_index[1] << 8) + | rel->r_index[0]); + r_extern = (0 != (rel->r_type[0] & RELOC_EXT_BITS_EXTERN_LITTLE)); + r_type = ((rel->r_type[0] & RELOC_EXT_BITS_TYPE_LITTLE) + >> RELOC_EXT_BITS_TYPE_SH_LITTLE); + } + + r_addend = GET_SWORD (input_bfd, rel->r_addend); + + BFD_ASSERT (r_type < TABLE_SIZE (howto_table_ext)); + + if (relocatable) + { + /* We are generating a relocatable output file, and must + modify the reloc accordingly. */ + if (r_extern + || r_type == (unsigned int) RELOC_BASE10 + || r_type == (unsigned int) RELOC_BASE13 + || r_type == (unsigned int) RELOC_BASE22) + { + /* If we know the symbol this relocation is against, + convert it into a relocation against a section. This + is what the native linker does. */ + if (r_type == (unsigned int) RELOC_BASE10 + || r_type == (unsigned int) RELOC_BASE13 + || r_type == (unsigned int) RELOC_BASE22) + h = NULL; + else + h = sym_hashes[r_index]; + if (h != NULL + && (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak)) + { + asection *output_section; + + /* Change the r_extern value. */ + if (bfd_header_big_endian (output_bfd)) + rel->r_type[0] &=~ RELOC_EXT_BITS_EXTERN_BIG; + else + rel->r_type[0] &=~ RELOC_EXT_BITS_EXTERN_LITTLE; + + /* Compute a new r_index. */ + output_section = h->root.u.def.section->output_section; + if (output_section == obj_textsec (output_bfd)) + r_index = N_TEXT; + else if (output_section == obj_datasec (output_bfd)) + r_index = N_DATA; + else if (output_section == obj_bsssec (output_bfd)) + r_index = N_BSS; + else + r_index = N_ABS; + + /* Add the symbol value and the section VMA to the + addend. */ + relocation = (h->root.u.def.value + + output_section->vma + + h->root.u.def.section->output_offset); + + /* Now RELOCATION is the VMA of the final + destination. If this is a PC relative reloc, + then ADDEND is the negative of the source VMA. + We want to set ADDEND to the difference between + the destination VMA and the source VMA, which + means we must adjust RELOCATION by the change in + the source VMA. This is done below. */ + } + else + { + /* We must change r_index according to the symbol + map. */ + r_index = symbol_map[r_index]; + + if (r_index == -1) + { + if (h != NULL) + { + /* We decided to strip this symbol, but it + turns out that we can't. Note that we + lose the other and desc information here. + I don't think that will ever matter for a + global symbol. */ + if (h->indx < 0) + { + h->indx = -2; + h->written = FALSE; + if (! aout_link_write_other_symbol (h, + (void *) finfo)) + return FALSE; + } + r_index = h->indx; + } + else + { + const char *name; + + name = strings + GET_WORD (input_bfd, + syms[r_index].e_strx); + if (! ((*finfo->info->callbacks->unattached_reloc) + (finfo->info, name, input_bfd, input_section, + r_addr))) + return FALSE; + r_index = 0; + } + } + + relocation = 0; + + /* If this is a PC relative reloc, then the addend + is the negative of the source VMA. We must + adjust it by the change in the source VMA. This + is done below. */ + } + + /* Write out the new r_index value. */ + if (bfd_header_big_endian (output_bfd)) + { + rel->r_index[0] = r_index >> 16; + rel->r_index[1] = r_index >> 8; + rel->r_index[2] = r_index; + } + else + { + rel->r_index[2] = r_index >> 16; + rel->r_index[1] = r_index >> 8; + rel->r_index[0] = r_index; + } + } + else + { + /* This is a relocation against a section. We must + adjust by the amount that the section moved. */ + r_section = aout_reloc_index_to_section (input_bfd, r_index); + relocation = (r_section->output_section->vma + + r_section->output_offset + - r_section->vma); + + /* If this is a PC relative reloc, then the addend is + the difference in VMA between the destination and the + source. We have just adjusted for the change in VMA + of the destination, so we must also adjust by the + change in VMA of the source. This is done below. */ + } + + /* As described above, we must always adjust a PC relative + reloc by the change in VMA of the source. However, if + pcrel_offset is set, then the addend does not include the + location within the section, in which case we don't need + to adjust anything. */ + if (howto_table_ext[r_type].pc_relative + && ! howto_table_ext[r_type].pcrel_offset) + relocation -= (input_section->output_section->vma + + input_section->output_offset + - input_section->vma); + + /* Change the addend if necessary. */ + if (relocation != 0) + PUT_WORD (output_bfd, r_addend + relocation, rel->r_addend); + + /* Change the address of the relocation. */ + PUT_WORD (output_bfd, + r_addr + input_section->output_offset, + rel->r_address); + } + else + { + bfd_boolean hundef; + bfd_reloc_status_type r; + + /* We are generating an executable, and must do a full + relocation. */ + hundef = FALSE; + + if (r_extern) + { + h = sym_hashes[r_index]; + + if (h != NULL + && (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak)) + { + relocation = (h->root.u.def.value + + h->root.u.def.section->output_section->vma + + h->root.u.def.section->output_offset); + } + else if (h != NULL + && h->root.type == bfd_link_hash_undefweak) + relocation = 0; + else + { + hundef = TRUE; + relocation = 0; + } + } + else if (r_type == (unsigned int) RELOC_BASE10 + || r_type == (unsigned int) RELOC_BASE13 + || r_type == (unsigned int) RELOC_BASE22) + { + struct external_nlist *sym; + int type; + + /* For base relative relocs, r_index is always an index + into the symbol table, even if r_extern is 0. */ + sym = syms + r_index; + type = H_GET_8 (input_bfd, sym->e_type); + if ((type & N_TYPE) == N_TEXT + || type == N_WEAKT) + r_section = obj_textsec (input_bfd); + else if ((type & N_TYPE) == N_DATA + || type == N_WEAKD) + r_section = obj_datasec (input_bfd); + else if ((type & N_TYPE) == N_BSS + || type == N_WEAKB) + r_section = obj_bsssec (input_bfd); + else if ((type & N_TYPE) == N_ABS + || type == N_WEAKA) + r_section = bfd_abs_section_ptr; + else + abort (); + relocation = (r_section->output_section->vma + + r_section->output_offset + + (GET_WORD (input_bfd, sym->e_value) + - r_section->vma)); + } + else + { + r_section = aout_reloc_index_to_section (input_bfd, r_index); + + /* If this is a PC relative reloc, then R_ADDEND is the + difference between the two vmas, or + old_dest_sec + old_dest_off - (old_src_sec + old_src_off) + where + old_dest_sec == section->vma + and + old_src_sec == input_section->vma + and + old_src_off == r_addr + + _bfd_final_link_relocate expects RELOCATION + + R_ADDEND to be the VMA of the destination minus + r_addr (the minus r_addr is because this relocation + is not pcrel_offset, which is a bit confusing and + should, perhaps, be changed), or + new_dest_sec + where + new_dest_sec == output_section->vma + output_offset + We arrange for this to happen by setting RELOCATION to + new_dest_sec + old_src_sec - old_dest_sec + + If this is not a PC relative reloc, then R_ADDEND is + simply the VMA of the destination, so we set + RELOCATION to the change in the destination VMA, or + new_dest_sec - old_dest_sec + */ + relocation = (r_section->output_section->vma + + r_section->output_offset + - r_section->vma); + if (howto_table_ext[r_type].pc_relative) + relocation += input_section->vma; + } + + if (check_dynamic_reloc != NULL) + { + bfd_boolean skip; + + if (! ((*check_dynamic_reloc) + (finfo->info, input_bfd, input_section, h, + (void *) rel, contents, &skip, &relocation))) + return FALSE; + if (skip) + continue; + } + + /* Now warn if a global symbol is undefined. We could not + do this earlier, because check_dynamic_reloc might want + to skip this reloc. */ + if (hundef + && ! finfo->info->shared + && r_type != (unsigned int) RELOC_BASE10 + && r_type != (unsigned int) RELOC_BASE13 + && r_type != (unsigned int) RELOC_BASE22) + { + const char *name; + + if (h != NULL) + name = h->root.root.string; + else + name = strings + GET_WORD (input_bfd, syms[r_index].e_strx); + if (! ((*finfo->info->callbacks->undefined_symbol) + (finfo->info, name, input_bfd, input_section, + r_addr, TRUE))) + return FALSE; + } + + if (r_type != (unsigned int) RELOC_SPARC_REV32) + r = MY_final_link_relocate (howto_table_ext + r_type, + input_bfd, input_section, + contents, r_addr, relocation, + r_addend); + else + { + bfd_vma x; + + x = bfd_get_32 (input_bfd, contents + r_addr); + x = x + relocation + r_addend; + bfd_putl32 (/*input_bfd,*/ x, contents + r_addr); + r = bfd_reloc_ok; + } + + if (r != bfd_reloc_ok) + { + switch (r) + { + default: + case bfd_reloc_outofrange: + abort (); + case bfd_reloc_overflow: + { + const char *name; + + if (h != NULL) + name = NULL; + else if (r_extern + || r_type == (unsigned int) RELOC_BASE10 + || r_type == (unsigned int) RELOC_BASE13 + || r_type == (unsigned int) RELOC_BASE22) + name = strings + GET_WORD (input_bfd, + syms[r_index].e_strx); + else + { + asection *s; + + s = aout_reloc_index_to_section (input_bfd, r_index); + name = bfd_section_name (input_bfd, s); + } + if (! ((*finfo->info->callbacks->reloc_overflow) + (finfo->info, (h ? &h->root : NULL), name, + howto_table_ext[r_type].name, + r_addend, input_bfd, input_section, r_addr))) + return FALSE; + } + break; + } + } + } } - /* Get the symbols. We probably have them already, unless - finfo->info->keep_memory is FALSE. */ - if (! aout_get_external_symbols (input_bfd)) + return TRUE; +} + +/* Link an a.out section into the output file. */ + +static bfd_boolean +aout_link_input_section (struct aout_final_link_info *finfo, + bfd *input_bfd, + asection *input_section, + file_ptr *reloff_ptr, + bfd_size_type rel_size) +{ + bfd_size_type input_size; + void * relocs; + + /* Get the section contents. */ + input_size = input_section->size; + if (! bfd_get_section_contents (input_bfd, input_section, + (void *) finfo->contents, + (file_ptr) 0, input_size)) return FALSE; - sym_count = obj_aout_external_sym_count (input_bfd); + /* Read in the relocs if we haven't already done it. */ + if (aout_section_data (input_section) != NULL + && aout_section_data (input_section)->relocs != NULL) + relocs = aout_section_data (input_section)->relocs; + else + { + relocs = finfo->relocs; + if (rel_size > 0) + { + if (bfd_seek (input_bfd, input_section->rel_filepos, SEEK_SET) != 0 + || bfd_bread (relocs, rel_size, input_bfd) != rel_size) + return FALSE; + } + } - /* Write out the symbols and get a map of the new indices. The map - is placed into finfo->symbol_map. */ - if (! aout_link_write_symbols (finfo, input_bfd)) + /* Relocate the section contents. */ + if (obj_reloc_entry_size (input_bfd) == RELOC_STD_SIZE) + { + if (! aout_link_input_section_std (finfo, input_bfd, input_section, + (struct reloc_std_external *) relocs, + rel_size, finfo->contents)) + return FALSE; + } + else + { + if (! aout_link_input_section_ext (finfo, input_bfd, input_section, + (struct reloc_ext_external *) relocs, + rel_size, finfo->contents)) + return FALSE; + } + + /* Write out the section contents. */ + if (! bfd_set_section_contents (finfo->output_bfd, + input_section->output_section, + (void *) finfo->contents, + (file_ptr) input_section->output_offset, + input_size)) return FALSE; - /* Relocate and write out the sections. These functions use the - symbol map created by aout_link_write_symbols. The linker_mark - field will be set if these sections are to be included in the - link, which will normally be the case. */ - if (obj_textsec (input_bfd)->linker_mark) + /* If we are producing relocatable output, the relocs were + modified, and we now write them out. */ + if (finfo->info->relocatable && rel_size > 0) { - if (! aout_link_input_section (finfo, input_bfd, - obj_textsec (input_bfd), - &finfo->treloff, - exec_hdr (input_bfd)->a_trsize)) + if (bfd_seek (finfo->output_bfd, *reloff_ptr, SEEK_SET) != 0) return FALSE; - } - if (obj_datasec (input_bfd)->linker_mark) - { - if (! aout_link_input_section (finfo, input_bfd, - obj_datasec (input_bfd), - &finfo->dreloff, - exec_hdr (input_bfd)->a_drsize)) + if (bfd_bwrite (relocs, rel_size, finfo->output_bfd) != rel_size) return FALSE; - } + *reloff_ptr += rel_size; - /* If we are not keeping memory, we don't need the symbols any - longer. We still need them if we are keeping memory, because the - strings in the hash table point into them. */ - if (! finfo->info->keep_memory) - { - if (! aout_link_free_symbols (input_bfd)) - return FALSE; + /* Assert that the relocs have not run into the symbols, and + that if these are the text relocs they have not run into the + data relocs. */ + BFD_ASSERT (*reloff_ptr <= obj_sym_filepos (finfo->output_bfd) + && (reloff_ptr != &finfo->treloff + || (*reloff_ptr + <= obj_datasec (finfo->output_bfd)->rel_filepos))); } return TRUE; @@ -4118,9 +4679,7 @@ aout_link_input_bfd (finfo, input_bfd) symbol indices into a symbol_map. */ static bfd_boolean -aout_link_write_symbols (finfo, input_bfd) - struct aout_final_link_info *finfo; - bfd *input_bfd; +aout_link_write_symbols (struct aout_final_link_info *finfo, bfd *input_bfd) { bfd *output_bfd; bfd_size_type sym_count; @@ -4129,7 +4688,7 @@ aout_link_write_symbols (finfo, input_bfd) enum bfd_link_discard discard; struct external_nlist *outsym; bfd_size_type strtab_index; - register struct external_nlist *sym; + struct external_nlist *sym; struct external_nlist *sym_end; struct aout_link_hash_entry **sym_hash; int *symbol_map; @@ -4251,7 +4810,7 @@ aout_link_write_symbols (finfo, input_bfd) } /* If the symbol has already been written out, skip it. */ - if (h != (struct aout_link_hash_entry *) NULL + if (h != NULL && h->written) { if ((type & N_TYPE) == N_INDR @@ -4282,7 +4841,7 @@ aout_link_write_symbols (finfo, input_bfd) } if (skip) { - if (h != (struct aout_link_hash_entry *) NULL) + if (h != NULL) h->written = TRUE; continue; } @@ -4301,7 +4860,7 @@ aout_link_write_symbols (finfo, input_bfd) || type == N_WEAKA) symsec = bfd_abs_section_ptr; else if (((type & N_TYPE) == N_INDR - && (hresolve == (struct aout_link_hash_entry *) NULL + && (hresolve == NULL || (hresolve->root.type != bfd_link_hash_defined && hresolve->root.type != bfd_link_hash_defweak && hresolve->root.type != bfd_link_hash_common))) @@ -4335,7 +4894,7 @@ aout_link_write_symbols (finfo, input_bfd) /* We need to get the value from the hash table. We use hresolve so that if we have defined an indirect symbol we output the final definition. */ - if (h == (struct aout_link_hash_entry *) NULL) + if (h == NULL) { switch (type & N_TYPE) { @@ -4410,7 +4969,7 @@ aout_link_write_symbols (finfo, input_bfd) else val = 0; } - if (symsec != (asection *) NULL) + if (symsec != NULL) val = (symsec->output_section->vma + symsec->output_offset + (GET_WORD (input_bfd, sym->e_value) @@ -4418,7 +4977,7 @@ aout_link_write_symbols (finfo, input_bfd) /* If this is a global symbol set the written flag, and if it is a local symbol see if we should discard it. */ - if (h != (struct aout_link_hash_entry *) NULL) + if (h != NULL) { h->written = TRUE; h->indx = obj_aout_external_sym_count (output_bfd); @@ -4512,9 +5071,8 @@ aout_link_write_symbols (finfo, input_bfd) { /* This is the first time we have seen this header file with this set of stabs strings. */ - t = ((struct aout_link_includes_totals *) - bfd_hash_allocate (&finfo->includes.root, - sizeof *t)); + t = bfd_hash_allocate (&finfo->includes.root, + sizeof *t); if (t == NULL) return FALSE; t->total = val; @@ -4567,7 +5125,7 @@ aout_link_write_symbols (finfo, input_bfd) /* name points into a string table which we are going to free. If there is a hash table entry, use that string. Otherwise, copy name into memory. */ - if (h != (struct aout_link_hash_entry *) NULL) + if (h != NULL) name = h->root.root.string; else copy = TRUE; @@ -4592,7 +5150,7 @@ aout_link_write_symbols (finfo, input_bfd) return FALSE; outsym_size = outsym - finfo->output_syms; outsym_size *= EXTERNAL_NLIST_SIZE; - if (bfd_bwrite ((PTR) finfo->output_syms, outsym_size, output_bfd) + if (bfd_bwrite ((void *) finfo->output_syms, outsym_size, output_bfd) != outsym_size) return FALSE; finfo->symoff += outsym_size; @@ -4601,1221 +5159,404 @@ aout_link_write_symbols (finfo, input_bfd) return TRUE; } -/* Write out a symbol that was not associated with an a.out input - object. */ +/* Link an a.out input BFD into the output file. */ static bfd_boolean -aout_link_write_other_symbol (h, data) - struct aout_link_hash_entry *h; - PTR data; +aout_link_input_bfd (struct aout_final_link_info *finfo, bfd *input_bfd) { - struct aout_final_link_info *finfo = (struct aout_final_link_info *) data; - bfd *output_bfd; - int type; - bfd_vma val; - struct external_nlist outsym; - bfd_size_type indx; - bfd_size_type amt; + bfd_size_type sym_count; - if (h->root.type == bfd_link_hash_warning) - { - h = (struct aout_link_hash_entry *) h->root.u.i.link; - if (h->root.type == bfd_link_hash_new) - return TRUE; - } + BFD_ASSERT (bfd_get_format (input_bfd) == bfd_object); - output_bfd = finfo->output_bfd; + /* If this is a dynamic object, it may need special handling. */ + if ((input_bfd->flags & DYNAMIC) != 0 + && aout_backend_info (input_bfd)->link_dynamic_object != NULL) + return ((*aout_backend_info (input_bfd)->link_dynamic_object) + (finfo->info, input_bfd)); - if (aout_backend_info (output_bfd)->write_dynamic_symbol != NULL) - { - if (! ((*aout_backend_info (output_bfd)->write_dynamic_symbol) - (output_bfd, finfo->info, h))) - { - /* FIXME: No way to handle errors. */ - abort (); - } - } - - if (h->written) - return TRUE; - - h->written = TRUE; - - /* An indx of -2 means the symbol must be written. */ - if (h->indx != -2 - && (finfo->info->strip == strip_all - || (finfo->info->strip == strip_some - && bfd_hash_lookup (finfo->info->keep_hash, h->root.root.string, - FALSE, FALSE) == NULL))) - return TRUE; - - switch (h->root.type) - { - default: - case bfd_link_hash_warning: - abort (); - /* Avoid variable not initialized warnings. */ - return TRUE; - case bfd_link_hash_new: - /* This can happen for set symbols when sets are not being - built. */ - return TRUE; - case bfd_link_hash_undefined: - type = N_UNDF | N_EXT; - val = 0; - break; - case bfd_link_hash_defined: - case bfd_link_hash_defweak: - { - asection *sec; - - sec = h->root.u.def.section->output_section; - BFD_ASSERT (bfd_is_abs_section (sec) - || sec->owner == output_bfd); - if (sec == obj_textsec (output_bfd)) - type = h->root.type == bfd_link_hash_defined ? N_TEXT : N_WEAKT; - else if (sec == obj_datasec (output_bfd)) - type = h->root.type == bfd_link_hash_defined ? N_DATA : N_WEAKD; - else if (sec == obj_bsssec (output_bfd)) - type = h->root.type == bfd_link_hash_defined ? N_BSS : N_WEAKB; - else - type = h->root.type == bfd_link_hash_defined ? N_ABS : N_WEAKA; - type |= N_EXT; - val = (h->root.u.def.value - + sec->vma - + h->root.u.def.section->output_offset); - } - break; - case bfd_link_hash_common: - type = N_UNDF | N_EXT; - val = h->root.u.c.size; - break; - case bfd_link_hash_undefweak: - type = N_WEAKU; - val = 0; - case bfd_link_hash_indirect: - /* We ignore these symbols, since the indirected symbol is - already in the hash table. */ - return TRUE; - } - - H_PUT_8 (output_bfd, type, outsym.e_type); - H_PUT_8 (output_bfd, 0, outsym.e_other); - H_PUT_16 (output_bfd, 0, outsym.e_desc); - indx = add_to_stringtab (output_bfd, finfo->strtab, h->root.root.string, - FALSE); - if (indx == - (bfd_size_type) 1) - { - /* FIXME: No way to handle errors. */ - abort (); - } - PUT_WORD (output_bfd, indx, outsym.e_strx); - PUT_WORD (output_bfd, val, outsym.e_value); - - amt = EXTERNAL_NLIST_SIZE; - if (bfd_seek (output_bfd, finfo->symoff, SEEK_SET) != 0 - || bfd_bwrite ((PTR) &outsym, amt, output_bfd) != amt) - { - /* FIXME: No way to handle errors. */ - abort (); - } - - finfo->symoff += EXTERNAL_NLIST_SIZE; - h->indx = obj_aout_external_sym_count (output_bfd); - ++obj_aout_external_sym_count (output_bfd); - - return TRUE; -} - -/* Link an a.out section into the output file. */ - -static bfd_boolean -aout_link_input_section (finfo, input_bfd, input_section, reloff_ptr, - rel_size) - struct aout_final_link_info *finfo; - bfd *input_bfd; - asection *input_section; - file_ptr *reloff_ptr; - bfd_size_type rel_size; -{ - bfd_size_type input_size; - PTR relocs; - - /* Get the section contents. */ - input_size = bfd_section_size (input_bfd, input_section); - if (! bfd_get_section_contents (input_bfd, input_section, - (PTR) finfo->contents, - (file_ptr) 0, input_size)) + /* Get the symbols. We probably have them already, unless + finfo->info->keep_memory is FALSE. */ + if (! aout_get_external_symbols (input_bfd)) return FALSE; - /* Read in the relocs if we haven't already done it. */ - if (aout_section_data (input_section) != NULL - && aout_section_data (input_section)->relocs != NULL) - relocs = aout_section_data (input_section)->relocs; - else - { - relocs = finfo->relocs; - if (rel_size > 0) - { - if (bfd_seek (input_bfd, input_section->rel_filepos, SEEK_SET) != 0 - || bfd_bread (relocs, rel_size, input_bfd) != rel_size) - return FALSE; - } - } + sym_count = obj_aout_external_sym_count (input_bfd); - /* Relocate the section contents. */ - if (obj_reloc_entry_size (input_bfd) == RELOC_STD_SIZE) - { - if (! aout_link_input_section_std (finfo, input_bfd, input_section, - (struct reloc_std_external *) relocs, - rel_size, finfo->contents)) - return FALSE; - } - else - { - if (! aout_link_input_section_ext (finfo, input_bfd, input_section, - (struct reloc_ext_external *) relocs, - rel_size, finfo->contents)) - return FALSE; - } - - /* Write out the section contents. */ - if (! bfd_set_section_contents (finfo->output_bfd, - input_section->output_section, - (PTR) finfo->contents, - (file_ptr) input_section->output_offset, - input_size)) + /* Write out the symbols and get a map of the new indices. The map + is placed into finfo->symbol_map. */ + if (! aout_link_write_symbols (finfo, input_bfd)) return FALSE; - /* If we are producing relocatable output, the relocs were - modified, and we now write them out. */ - if (finfo->info->relocatable && rel_size > 0) + /* Relocate and write out the sections. These functions use the + symbol map created by aout_link_write_symbols. The linker_mark + field will be set if these sections are to be included in the + link, which will normally be the case. */ + if (obj_textsec (input_bfd)->linker_mark) { - if (bfd_seek (finfo->output_bfd, *reloff_ptr, SEEK_SET) != 0) + if (! aout_link_input_section (finfo, input_bfd, + obj_textsec (input_bfd), + &finfo->treloff, + exec_hdr (input_bfd)->a_trsize)) return FALSE; - if (bfd_bwrite (relocs, rel_size, finfo->output_bfd) != rel_size) + } + if (obj_datasec (input_bfd)->linker_mark) + { + if (! aout_link_input_section (finfo, input_bfd, + obj_datasec (input_bfd), + &finfo->dreloff, + exec_hdr (input_bfd)->a_drsize)) return FALSE; - *reloff_ptr += rel_size; + } - /* Assert that the relocs have not run into the symbols, and - that if these are the text relocs they have not run into the - data relocs. */ - BFD_ASSERT (*reloff_ptr <= obj_sym_filepos (finfo->output_bfd) - && (reloff_ptr != &finfo->treloff - || (*reloff_ptr - <= obj_datasec (finfo->output_bfd)->rel_filepos))); + /* If we are not keeping memory, we don't need the symbols any + longer. We still need them if we are keeping memory, because the + strings in the hash table point into them. */ + if (! finfo->info->keep_memory) + { + if (! aout_link_free_symbols (input_bfd)) + return FALSE; } return TRUE; } -/* Get the section corresponding to a reloc index. */ +/* Do the final link step. This is called on the output BFD. The + INFO structure should point to a list of BFDs linked through the + link_next field which can be used to find each BFD which takes part + in the output. Also, each section in ABFD should point to a list + of bfd_link_order structures which list all the input sections for + the output section. */ -static INLINE asection * -aout_reloc_index_to_section (abfd, indx) - bfd *abfd; - int indx; +bfd_boolean +NAME (aout, final_link) (bfd *abfd, + struct bfd_link_info *info, + void (*callback) (bfd *, file_ptr *, file_ptr *, file_ptr *)) { - switch (indx & N_TYPE) + struct aout_final_link_info aout_info; + bfd_boolean includes_hash_initialized = FALSE; + bfd *sub; + bfd_size_type trsize, drsize; + bfd_size_type max_contents_size; + bfd_size_type max_relocs_size; + bfd_size_type max_sym_count; + bfd_size_type text_size; + file_ptr text_end; + struct bfd_link_order *p; + asection *o; + bfd_boolean have_link_order_relocs; + + if (info->shared) + abfd->flags |= DYNAMIC; + + aout_info.info = info; + aout_info.output_bfd = abfd; + aout_info.contents = NULL; + aout_info.relocs = NULL; + aout_info.symbol_map = NULL; + aout_info.output_syms = NULL; + + if (!bfd_hash_table_init_n (&aout_info.includes.root, + aout_link_includes_newfunc, + sizeof (struct aout_link_includes_entry), + 251)) + goto error_return; + includes_hash_initialized = TRUE; + + /* Figure out the largest section size. Also, if generating + relocatable output, count the relocs. */ + trsize = 0; + drsize = 0; + max_contents_size = 0; + max_relocs_size = 0; + max_sym_count = 0; + for (sub = info->input_bfds; sub != NULL; sub = sub->link_next) { - case N_TEXT: - return obj_textsec (abfd); - case N_DATA: - return obj_datasec (abfd); - case N_BSS: - return obj_bsssec (abfd); - case N_ABS: - case N_UNDF: - return bfd_abs_section_ptr; - default: - abort (); + bfd_size_type sz; + + if (info->relocatable) + { + if (bfd_get_flavour (sub) == bfd_target_aout_flavour) + { + trsize += exec_hdr (sub)->a_trsize; + drsize += exec_hdr (sub)->a_drsize; + } + else + { + /* FIXME: We need to identify the .text and .data sections + and call get_reloc_upper_bound and canonicalize_reloc to + work out the number of relocs needed, and then multiply + by the reloc size. */ + (*_bfd_error_handler) + (_("%s: relocatable link from %s to %s not supported"), + bfd_get_filename (abfd), + sub->xvec->name, abfd->xvec->name); + bfd_set_error (bfd_error_invalid_operation); + goto error_return; + } + } + + if (bfd_get_flavour (sub) == bfd_target_aout_flavour) + { + sz = obj_textsec (sub)->size; + if (sz > max_contents_size) + max_contents_size = sz; + sz = obj_datasec (sub)->size; + if (sz > max_contents_size) + max_contents_size = sz; + + sz = exec_hdr (sub)->a_trsize; + if (sz > max_relocs_size) + max_relocs_size = sz; + sz = exec_hdr (sub)->a_drsize; + if (sz > max_relocs_size) + max_relocs_size = sz; + + sz = obj_aout_external_sym_count (sub); + if (sz > max_sym_count) + max_sym_count = sz; + } } - /*NOTREACHED*/ - return NULL; -} -/* Relocate an a.out section using standard a.out relocs. */ - -static bfd_boolean -aout_link_input_section_std (finfo, input_bfd, input_section, relocs, - rel_size, contents) - struct aout_final_link_info *finfo; - bfd *input_bfd; - asection *input_section; - struct reloc_std_external *relocs; - bfd_size_type rel_size; - bfd_byte *contents; -{ - bfd_boolean (*check_dynamic_reloc) - PARAMS ((struct bfd_link_info *, bfd *, asection *, - struct aout_link_hash_entry *, PTR, bfd_byte *, bfd_boolean *, - bfd_vma *)); - bfd *output_bfd; - bfd_boolean relocatable; - struct external_nlist *syms; - char *strings; - struct aout_link_hash_entry **sym_hashes; - int *symbol_map; - bfd_size_type reloc_count; - register struct reloc_std_external *rel; - struct reloc_std_external *rel_end; - - output_bfd = finfo->output_bfd; - check_dynamic_reloc = aout_backend_info (output_bfd)->check_dynamic_reloc; - - BFD_ASSERT (obj_reloc_entry_size (input_bfd) == RELOC_STD_SIZE); - BFD_ASSERT (input_bfd->xvec->header_byteorder - == output_bfd->xvec->header_byteorder); - - relocatable = finfo->info->relocatable; - syms = obj_aout_external_syms (input_bfd); - strings = obj_aout_external_strings (input_bfd); - sym_hashes = obj_aout_sym_hashes (input_bfd); - symbol_map = finfo->symbol_map; - - reloc_count = rel_size / RELOC_STD_SIZE; - rel = relocs; - rel_end = rel + reloc_count; - for (; rel < rel_end; rel++) + if (info->relocatable) { - bfd_vma r_addr; - int r_index; - int r_extern; - int r_pcrel; - int r_baserel = 0; - reloc_howto_type *howto; - struct aout_link_hash_entry *h = NULL; - bfd_vma relocation; - bfd_reloc_status_type r; + if (obj_textsec (abfd) != NULL) + trsize += (_bfd_count_link_order_relocs (obj_textsec (abfd) + ->map_head.link_order) + * obj_reloc_entry_size (abfd)); + if (obj_datasec (abfd) != NULL) + drsize += (_bfd_count_link_order_relocs (obj_datasec (abfd) + ->map_head.link_order) + * obj_reloc_entry_size (abfd)); + } - r_addr = GET_SWORD (input_bfd, rel->r_address); + exec_hdr (abfd)->a_trsize = trsize; + exec_hdr (abfd)->a_drsize = drsize; -#ifdef MY_reloc_howto - howto = MY_reloc_howto (input_bfd, rel, r_index, r_extern, r_pcrel); -#else - { - int r_jmptable; - int r_relative; - int r_length; - unsigned int howto_idx; + exec_hdr (abfd)->a_entry = bfd_get_start_address (abfd); - if (bfd_header_big_endian (input_bfd)) - { - r_index = (((unsigned int) rel->r_index[0] << 16) - | ((unsigned int) rel->r_index[1] << 8) - | rel->r_index[2]); - r_extern = (0 != (rel->r_type[0] & RELOC_STD_BITS_EXTERN_BIG)); - r_pcrel = (0 != (rel->r_type[0] & RELOC_STD_BITS_PCREL_BIG)); - r_baserel = (0 != (rel->r_type[0] & RELOC_STD_BITS_BASEREL_BIG)); - r_jmptable= (0 != (rel->r_type[0] & RELOC_STD_BITS_JMPTABLE_BIG)); - r_relative= (0 != (rel->r_type[0] & RELOC_STD_BITS_RELATIVE_BIG)); - r_length = ((rel->r_type[0] & RELOC_STD_BITS_LENGTH_BIG) - >> RELOC_STD_BITS_LENGTH_SH_BIG); - } - else - { - r_index = (((unsigned int) rel->r_index[2] << 16) - | ((unsigned int) rel->r_index[1] << 8) - | rel->r_index[0]); - r_extern = (0 != (rel->r_type[0] & RELOC_STD_BITS_EXTERN_LITTLE)); - r_pcrel = (0 != (rel->r_type[0] & RELOC_STD_BITS_PCREL_LITTLE)); - r_baserel = (0 != (rel->r_type[0] - & RELOC_STD_BITS_BASEREL_LITTLE)); - r_jmptable= (0 != (rel->r_type[0] - & RELOC_STD_BITS_JMPTABLE_LITTLE)); - r_relative= (0 != (rel->r_type[0] - & RELOC_STD_BITS_RELATIVE_LITTLE)); - r_length = ((rel->r_type[0] & RELOC_STD_BITS_LENGTH_LITTLE) - >> RELOC_STD_BITS_LENGTH_SH_LITTLE); - } + /* Adjust the section sizes and vmas according to the magic number. + This sets a_text, a_data and a_bss in the exec_hdr and sets the + filepos for each section. */ + if (! NAME (aout, adjust_sizes_and_vmas) (abfd, &text_size, &text_end)) + goto error_return; - howto_idx = (r_length + 4 * r_pcrel + 8 * r_baserel - + 16 * r_jmptable + 32 * r_relative); - BFD_ASSERT (howto_idx < TABLE_SIZE (howto_table_std)); - howto = howto_table_std + howto_idx; - } -#endif + /* The relocation and symbol file positions differ among a.out + targets. We are passed a callback routine from the backend + specific code to handle this. + FIXME: At this point we do not know how much space the symbol + table will require. This will not work for any (nonstandard) + a.out target that needs to know the symbol table size before it + can compute the relocation file positions. This may or may not + be the case for the hp300hpux target, for example. */ + (*callback) (abfd, &aout_info.treloff, &aout_info.dreloff, + &aout_info.symoff); + obj_textsec (abfd)->rel_filepos = aout_info.treloff; + obj_datasec (abfd)->rel_filepos = aout_info.dreloff; + obj_sym_filepos (abfd) = aout_info.symoff; - if (relocatable) + /* We keep a count of the symbols as we output them. */ + obj_aout_external_sym_count (abfd) = 0; + + /* We accumulate the string table as we write out the symbols. */ + aout_info.strtab = _bfd_stringtab_init (); + if (aout_info.strtab == NULL) + goto error_return; + + /* Allocate buffers to hold section contents and relocs. */ + aout_info.contents = bfd_malloc (max_contents_size); + aout_info.relocs = bfd_malloc (max_relocs_size); + aout_info.symbol_map = bfd_malloc (max_sym_count * sizeof (int *)); + aout_info.output_syms = bfd_malloc ((max_sym_count + 1) + * sizeof (struct external_nlist)); + if ((aout_info.contents == NULL && max_contents_size != 0) + || (aout_info.relocs == NULL && max_relocs_size != 0) + || (aout_info.symbol_map == NULL && max_sym_count != 0) + || aout_info.output_syms == NULL) + goto error_return; + + /* If we have a symbol named __DYNAMIC, force it out now. This is + required by SunOS. Doing this here rather than in sunos.c is a + hack, but it's easier than exporting everything which would be + needed. */ + { + struct aout_link_hash_entry *h; + + h = aout_link_hash_lookup (aout_hash_table (info), "__DYNAMIC", + FALSE, FALSE, FALSE); + if (h != NULL) + aout_link_write_other_symbol (h, &aout_info); + } + + /* The most time efficient way to do the link would be to read all + the input object files into memory and then sort out the + information into the output file. Unfortunately, that will + probably use too much memory. Another method would be to step + through everything that composes the text section and write it + out, and then everything that composes the data section and write + it out, and then write out the relocs, and then write out the + symbols. Unfortunately, that requires reading stuff from each + input file several times, and we will not be able to keep all the + input files open simultaneously, and reopening them will be slow. + + What we do is basically process one input file at a time. We do + everything we need to do with an input file once--copy over the + section contents, handle the relocation information, and write + out the symbols--and then we throw away the information we read + from it. This approach requires a lot of lseeks of the output + file, which is unfortunate but still faster than reopening a lot + of files. + + We use the output_has_begun field of the input BFDs to see + whether we have already handled it. */ + for (sub = info->input_bfds; sub != NULL; sub = sub->link_next) + sub->output_has_begun = FALSE; + + /* Mark all sections which are to be included in the link. This + will normally be every section. We need to do this so that we + can identify any sections which the linker has decided to not + include. */ + for (o = abfd->sections; o != NULL; o = o->next) + { + for (p = o->map_head.link_order; p != NULL; p = p->next) + if (p->type == bfd_indirect_link_order) + p->u.indirect.section->linker_mark = TRUE; + } + + have_link_order_relocs = FALSE; + for (o = abfd->sections; o != NULL; o = o->next) + { + for (p = o->map_head.link_order; + p != NULL; + p = p->next) { - /* We are generating a relocatable output file, and must - modify the reloc accordingly. */ - if (r_extern) + if (p->type == bfd_indirect_link_order + && (bfd_get_flavour (p->u.indirect.section->owner) + == bfd_target_aout_flavour)) { - /* If we know the symbol this relocation is against, - convert it into a relocation against a section. This - is what the native linker does. */ - h = sym_hashes[r_index]; - if (h != (struct aout_link_hash_entry *) NULL - && (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak)) + bfd *input_bfd; + + input_bfd = p->u.indirect.section->owner; + if (! input_bfd->output_has_begun) { - asection *output_section; - - /* Change the r_extern value. */ - if (bfd_header_big_endian (output_bfd)) - rel->r_type[0] &=~ RELOC_STD_BITS_EXTERN_BIG; - else - rel->r_type[0] &=~ RELOC_STD_BITS_EXTERN_LITTLE; - - /* Compute a new r_index. */ - output_section = h->root.u.def.section->output_section; - if (output_section == obj_textsec (output_bfd)) - r_index = N_TEXT; - else if (output_section == obj_datasec (output_bfd)) - r_index = N_DATA; - else if (output_section == obj_bsssec (output_bfd)) - r_index = N_BSS; - else - r_index = N_ABS; - - /* Add the symbol value and the section VMA to the - addend stored in the contents. */ - relocation = (h->root.u.def.value - + output_section->vma - + h->root.u.def.section->output_offset); - } - else - { - /* We must change r_index according to the symbol - map. */ - r_index = symbol_map[r_index]; - - if (r_index == -1) - { - if (h != NULL) - { - /* We decided to strip this symbol, but it - turns out that we can't. Note that we - lose the other and desc information here. - I don't think that will ever matter for a - global symbol. */ - if (h->indx < 0) - { - h->indx = -2; - h->written = FALSE; - if (! aout_link_write_other_symbol (h, - (PTR) finfo)) - return FALSE; - } - r_index = h->indx; - } - else - { - const char *name; - - name = strings + GET_WORD (input_bfd, - syms[r_index].e_strx); - if (! ((*finfo->info->callbacks->unattached_reloc) - (finfo->info, name, input_bfd, input_section, - r_addr))) - return FALSE; - r_index = 0; - } - } - - relocation = 0; - } - - /* Write out the new r_index value. */ - if (bfd_header_big_endian (output_bfd)) - { - rel->r_index[0] = r_index >> 16; - rel->r_index[1] = r_index >> 8; - rel->r_index[2] = r_index; - } - else - { - rel->r_index[2] = r_index >> 16; - rel->r_index[1] = r_index >> 8; - rel->r_index[0] = r_index; + if (! aout_link_input_bfd (&aout_info, input_bfd)) + goto error_return; + input_bfd->output_has_begun = TRUE; } } + else if (p->type == bfd_section_reloc_link_order + || p->type == bfd_symbol_reloc_link_order) + { + /* These are handled below. */ + have_link_order_relocs = TRUE; + } else { - asection *section; - - /* This is a relocation against a section. We must - adjust by the amount that the section moved. */ - section = aout_reloc_index_to_section (input_bfd, r_index); - relocation = (section->output_section->vma - + section->output_offset - - section->vma); + if (! _bfd_default_link_order (abfd, info, o, p)) + goto error_return; } - - /* Change the address of the relocation. */ - PUT_WORD (output_bfd, - r_addr + input_section->output_offset, - rel->r_address); - - /* Adjust a PC relative relocation by removing the reference - to the original address in the section and including the - reference to the new address. */ - if (r_pcrel) - relocation -= (input_section->output_section->vma - + input_section->output_offset - - input_section->vma); - -#ifdef MY_relocatable_reloc - MY_relocatable_reloc (howto, output_bfd, rel, relocation, r_addr); -#endif - - if (relocation == 0) - r = bfd_reloc_ok; - else - r = MY_relocate_contents (howto, - input_bfd, relocation, - contents + r_addr); } - else + } + + /* Write out any symbols that we have not already written out. */ + aout_link_hash_traverse (aout_hash_table (info), + aout_link_write_other_symbol, + (void *) &aout_info); + + /* Now handle any relocs we were asked to create by the linker. + These did not come from any input file. We must do these after + we have written out all the symbols, so that we know the symbol + indices to use. */ + if (have_link_order_relocs) + { + for (o = abfd->sections; o != NULL; o = o->next) { - bfd_boolean hundef; - - /* We are generating an executable, and must do a full - relocation. */ - hundef = FALSE; - - if (r_extern) + for (p = o->map_head.link_order; + p != NULL; + p = p->next) { - h = sym_hashes[r_index]; - - if (h != (struct aout_link_hash_entry *) NULL - && (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak)) + if (p->type == bfd_section_reloc_link_order + || p->type == bfd_symbol_reloc_link_order) { - relocation = (h->root.u.def.value - + h->root.u.def.section->output_section->vma - + h->root.u.def.section->output_offset); - } - else if (h != (struct aout_link_hash_entry *) NULL - && h->root.type == bfd_link_hash_undefweak) - relocation = 0; - else - { - hundef = TRUE; - relocation = 0; + if (! aout_link_reloc_link_order (&aout_info, o, p)) + goto error_return; } } - else - { - asection *section; - - section = aout_reloc_index_to_section (input_bfd, r_index); - relocation = (section->output_section->vma - + section->output_offset - - section->vma); - if (r_pcrel) - relocation += input_section->vma; - } - - if (check_dynamic_reloc != NULL) - { - bfd_boolean skip; - - if (! ((*check_dynamic_reloc) - (finfo->info, input_bfd, input_section, h, - (PTR) rel, contents, &skip, &relocation))) - return FALSE; - if (skip) - continue; - } - - /* Now warn if a global symbol is undefined. We could not - do this earlier, because check_dynamic_reloc might want - to skip this reloc. */ - if (hundef && ! finfo->info->shared && ! r_baserel) - { - const char *name; - - if (h != NULL) - name = h->root.root.string; - else - name = strings + GET_WORD (input_bfd, syms[r_index].e_strx); - if (! ((*finfo->info->callbacks->undefined_symbol) - (finfo->info, name, input_bfd, input_section, - r_addr, TRUE))) - return FALSE; - } - - r = MY_final_link_relocate (howto, - input_bfd, input_section, - contents, r_addr, relocation, - (bfd_vma) 0); } + } - if (r != bfd_reloc_ok) - { - switch (r) - { - default: - case bfd_reloc_outofrange: - abort (); - case bfd_reloc_overflow: - { - const char *name; + if (aout_info.contents != NULL) + { + free (aout_info.contents); + aout_info.contents = NULL; + } + if (aout_info.relocs != NULL) + { + free (aout_info.relocs); + aout_info.relocs = NULL; + } + if (aout_info.symbol_map != NULL) + { + free (aout_info.symbol_map); + aout_info.symbol_map = NULL; + } + if (aout_info.output_syms != NULL) + { + free (aout_info.output_syms); + aout_info.output_syms = NULL; + } + if (includes_hash_initialized) + { + bfd_hash_table_free (&aout_info.includes.root); + includes_hash_initialized = FALSE; + } - if (h != NULL) - name = h->root.root.string; - else if (r_extern) - name = strings + GET_WORD (input_bfd, - syms[r_index].e_strx); - else - { - asection *s; + /* Finish up any dynamic linking we may be doing. */ + if (aout_backend_info (abfd)->finish_dynamic_link != NULL) + { + if (! (*aout_backend_info (abfd)->finish_dynamic_link) (abfd, info)) + goto error_return; + } - s = aout_reloc_index_to_section (input_bfd, r_index); - name = bfd_section_name (input_bfd, s); - } - if (! ((*finfo->info->callbacks->reloc_overflow) - (finfo->info, name, howto->name, - (bfd_vma) 0, input_bfd, input_section, r_addr))) - return FALSE; - } - break; - } - } + /* Update the header information. */ + abfd->symcount = obj_aout_external_sym_count (abfd); + exec_hdr (abfd)->a_syms = abfd->symcount * EXTERNAL_NLIST_SIZE; + obj_str_filepos (abfd) = obj_sym_filepos (abfd) + exec_hdr (abfd)->a_syms; + obj_textsec (abfd)->reloc_count = + exec_hdr (abfd)->a_trsize / obj_reloc_entry_size (abfd); + obj_datasec (abfd)->reloc_count = + exec_hdr (abfd)->a_drsize / obj_reloc_entry_size (abfd); + + /* Write out the string table, unless there are no symbols. */ + if (abfd->symcount > 0) + { + if (bfd_seek (abfd, obj_str_filepos (abfd), SEEK_SET) != 0 + || ! emit_stringtab (abfd, aout_info.strtab)) + goto error_return; + } + else if (obj_textsec (abfd)->reloc_count == 0 + && obj_datasec (abfd)->reloc_count == 0) + { + bfd_byte b; + file_ptr pos; + + b = 0; + pos = obj_datasec (abfd)->filepos + exec_hdr (abfd)->a_data - 1; + if (bfd_seek (abfd, pos, SEEK_SET) != 0 + || bfd_bwrite (&b, (bfd_size_type) 1, abfd) != 1) + goto error_return; } return TRUE; -} - -/* Relocate an a.out section using extended a.out relocs. */ - -static bfd_boolean -aout_link_input_section_ext (finfo, input_bfd, input_section, relocs, - rel_size, contents) - struct aout_final_link_info *finfo; - bfd *input_bfd; - asection *input_section; - struct reloc_ext_external *relocs; - bfd_size_type rel_size; - bfd_byte *contents; -{ - bfd_boolean (*check_dynamic_reloc) - PARAMS ((struct bfd_link_info *, bfd *, asection *, - struct aout_link_hash_entry *, PTR, bfd_byte *, bfd_boolean *, - bfd_vma *)); - bfd *output_bfd; - bfd_boolean relocatable; - struct external_nlist *syms; - char *strings; - struct aout_link_hash_entry **sym_hashes; - int *symbol_map; - bfd_size_type reloc_count; - register struct reloc_ext_external *rel; - struct reloc_ext_external *rel_end; - - output_bfd = finfo->output_bfd; - check_dynamic_reloc = aout_backend_info (output_bfd)->check_dynamic_reloc; - - BFD_ASSERT (obj_reloc_entry_size (input_bfd) == RELOC_EXT_SIZE); - BFD_ASSERT (input_bfd->xvec->header_byteorder - == output_bfd->xvec->header_byteorder); - - relocatable = finfo->info->relocatable; - syms = obj_aout_external_syms (input_bfd); - strings = obj_aout_external_strings (input_bfd); - sym_hashes = obj_aout_sym_hashes (input_bfd); - symbol_map = finfo->symbol_map; - - reloc_count = rel_size / RELOC_EXT_SIZE; - rel = relocs; - rel_end = rel + reloc_count; - for (; rel < rel_end; rel++) - { - bfd_vma r_addr; - int r_index; - int r_extern; - unsigned int r_type; - bfd_vma r_addend; - struct aout_link_hash_entry *h = NULL; - asection *r_section = NULL; - bfd_vma relocation; - - r_addr = GET_SWORD (input_bfd, rel->r_address); - - if (bfd_header_big_endian (input_bfd)) - { - r_index = (((unsigned int) rel->r_index[0] << 16) - | ((unsigned int) 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 = (((unsigned int) rel->r_index[2] << 16) - | ((unsigned int) rel->r_index[1] << 8) - | rel->r_index[0]); - r_extern = (0 != (rel->r_type[0] & RELOC_EXT_BITS_EXTERN_LITTLE)); - r_type = ((rel->r_type[0] & RELOC_EXT_BITS_TYPE_LITTLE) - >> RELOC_EXT_BITS_TYPE_SH_LITTLE); - } - - r_addend = GET_SWORD (input_bfd, rel->r_addend); - - BFD_ASSERT (r_type < TABLE_SIZE (howto_table_ext)); - - if (relocatable) - { - /* We are generating a relocatable output file, and must - modify the reloc accordingly. */ - if (r_extern - || r_type == (unsigned int) RELOC_BASE10 - || r_type == (unsigned int) RELOC_BASE13 - || r_type == (unsigned int) RELOC_BASE22) - { - /* If we know the symbol this relocation is against, - convert it into a relocation against a section. This - is what the native linker does. */ - if (r_type == (unsigned int) RELOC_BASE10 - || r_type == (unsigned int) RELOC_BASE13 - || r_type == (unsigned int) RELOC_BASE22) - h = NULL; - else - h = sym_hashes[r_index]; - if (h != (struct aout_link_hash_entry *) NULL - && (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak)) - { - asection *output_section; - - /* Change the r_extern value. */ - if (bfd_header_big_endian (output_bfd)) - rel->r_type[0] &=~ RELOC_EXT_BITS_EXTERN_BIG; - else - rel->r_type[0] &=~ RELOC_EXT_BITS_EXTERN_LITTLE; - - /* Compute a new r_index. */ - output_section = h->root.u.def.section->output_section; - if (output_section == obj_textsec (output_bfd)) - r_index = N_TEXT; - else if (output_section == obj_datasec (output_bfd)) - r_index = N_DATA; - else if (output_section == obj_bsssec (output_bfd)) - r_index = N_BSS; - else - r_index = N_ABS; - - /* Add the symbol value and the section VMA to the - addend. */ - relocation = (h->root.u.def.value - + output_section->vma - + h->root.u.def.section->output_offset); - - /* Now RELOCATION is the VMA of the final - destination. If this is a PC relative reloc, - then ADDEND is the negative of the source VMA. - We want to set ADDEND to the difference between - the destination VMA and the source VMA, which - means we must adjust RELOCATION by the change in - the source VMA. This is done below. */ - } - else - { - /* We must change r_index according to the symbol - map. */ - r_index = symbol_map[r_index]; - - if (r_index == -1) - { - if (h != NULL) - { - /* We decided to strip this symbol, but it - turns out that we can't. Note that we - lose the other and desc information here. - I don't think that will ever matter for a - global symbol. */ - if (h->indx < 0) - { - h->indx = -2; - h->written = FALSE; - if (! aout_link_write_other_symbol (h, - (PTR) finfo)) - return FALSE; - } - r_index = h->indx; - } - else - { - const char *name; - - name = strings + GET_WORD (input_bfd, - syms[r_index].e_strx); - if (! ((*finfo->info->callbacks->unattached_reloc) - (finfo->info, name, input_bfd, input_section, - r_addr))) - return FALSE; - r_index = 0; - } - } - - relocation = 0; - - /* If this is a PC relative reloc, then the addend - is the negative of the source VMA. We must - adjust it by the change in the source VMA. This - is done below. */ - } - - /* Write out the new r_index value. */ - if (bfd_header_big_endian (output_bfd)) - { - rel->r_index[0] = r_index >> 16; - rel->r_index[1] = r_index >> 8; - rel->r_index[2] = r_index; - } - else - { - rel->r_index[2] = r_index >> 16; - rel->r_index[1] = r_index >> 8; - rel->r_index[0] = r_index; - } - } - else - { - /* This is a relocation against a section. We must - adjust by the amount that the section moved. */ - r_section = aout_reloc_index_to_section (input_bfd, r_index); - relocation = (r_section->output_section->vma - + r_section->output_offset - - r_section->vma); - - /* If this is a PC relative reloc, then the addend is - the difference in VMA between the destination and the - source. We have just adjusted for the change in VMA - of the destination, so we must also adjust by the - change in VMA of the source. This is done below. */ - } - - /* As described above, we must always adjust a PC relative - reloc by the change in VMA of the source. However, if - pcrel_offset is set, then the addend does not include the - location within the section, in which case we don't need - to adjust anything. */ - if (howto_table_ext[r_type].pc_relative - && ! howto_table_ext[r_type].pcrel_offset) - relocation -= (input_section->output_section->vma - + input_section->output_offset - - input_section->vma); - - /* Change the addend if necessary. */ - if (relocation != 0) - PUT_WORD (output_bfd, r_addend + relocation, rel->r_addend); - - /* Change the address of the relocation. */ - PUT_WORD (output_bfd, - r_addr + input_section->output_offset, - rel->r_address); - } - else - { - bfd_boolean hundef; - bfd_reloc_status_type r; - - /* We are generating an executable, and must do a full - relocation. */ - hundef = FALSE; - - if (r_extern) - { - h = sym_hashes[r_index]; - - if (h != (struct aout_link_hash_entry *) NULL - && (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak)) - { - relocation = (h->root.u.def.value - + h->root.u.def.section->output_section->vma - + h->root.u.def.section->output_offset); - } - else if (h != (struct aout_link_hash_entry *) NULL - && h->root.type == bfd_link_hash_undefweak) - relocation = 0; - else - { - hundef = TRUE; - relocation = 0; - } - } - else if (r_type == (unsigned int) RELOC_BASE10 - || r_type == (unsigned int) RELOC_BASE13 - || r_type == (unsigned int) RELOC_BASE22) - { - struct external_nlist *sym; - int type; - - /* For base relative relocs, r_index is always an index - into the symbol table, even if r_extern is 0. */ - sym = syms + r_index; - type = H_GET_8 (input_bfd, sym->e_type); - if ((type & N_TYPE) == N_TEXT - || type == N_WEAKT) - r_section = obj_textsec (input_bfd); - else if ((type & N_TYPE) == N_DATA - || type == N_WEAKD) - r_section = obj_datasec (input_bfd); - else if ((type & N_TYPE) == N_BSS - || type == N_WEAKB) - r_section = obj_bsssec (input_bfd); - else if ((type & N_TYPE) == N_ABS - || type == N_WEAKA) - r_section = bfd_abs_section_ptr; - else - abort (); - relocation = (r_section->output_section->vma - + r_section->output_offset - + (GET_WORD (input_bfd, sym->e_value) - - r_section->vma)); - } - else - { - r_section = aout_reloc_index_to_section (input_bfd, r_index); - - /* If this is a PC relative reloc, then R_ADDEND is the - difference between the two vmas, or - old_dest_sec + old_dest_off - (old_src_sec + old_src_off) - where - old_dest_sec == section->vma - and - old_src_sec == input_section->vma - and - old_src_off == r_addr - - _bfd_final_link_relocate expects RELOCATION + - R_ADDEND to be the VMA of the destination minus - r_addr (the minus r_addr is because this relocation - is not pcrel_offset, which is a bit confusing and - should, perhaps, be changed), or - new_dest_sec - where - new_dest_sec == output_section->vma + output_offset - We arrange for this to happen by setting RELOCATION to - new_dest_sec + old_src_sec - old_dest_sec - - If this is not a PC relative reloc, then R_ADDEND is - simply the VMA of the destination, so we set - RELOCATION to the change in the destination VMA, or - new_dest_sec - old_dest_sec - */ - relocation = (r_section->output_section->vma - + r_section->output_offset - - r_section->vma); - if (howto_table_ext[r_type].pc_relative) - relocation += input_section->vma; - } - - if (check_dynamic_reloc != NULL) - { - bfd_boolean skip; - - if (! ((*check_dynamic_reloc) - (finfo->info, input_bfd, input_section, h, - (PTR) rel, contents, &skip, &relocation))) - return FALSE; - if (skip) - continue; - } - - /* Now warn if a global symbol is undefined. We could not - do this earlier, because check_dynamic_reloc might want - to skip this reloc. */ - if (hundef - && ! finfo->info->shared - && r_type != (unsigned int) RELOC_BASE10 - && r_type != (unsigned int) RELOC_BASE13 - && r_type != (unsigned int) RELOC_BASE22) - { - const char *name; - - if (h != NULL) - name = h->root.root.string; - else - name = strings + GET_WORD (input_bfd, syms[r_index].e_strx); - if (! ((*finfo->info->callbacks->undefined_symbol) - (finfo->info, name, input_bfd, input_section, - r_addr, TRUE))) - return FALSE; - } - - if (r_type != (unsigned int) RELOC_SPARC_REV32) - r = MY_final_link_relocate (howto_table_ext + r_type, - input_bfd, input_section, - contents, r_addr, relocation, - r_addend); - else - { - bfd_vma x; - - x = bfd_get_32 (input_bfd, contents + r_addr); - x = x + relocation + r_addend; - bfd_putl32 (/*input_bfd,*/ x, contents + r_addr); - r = bfd_reloc_ok; - } - - 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 if (r_extern - || r_type == (unsigned int) RELOC_BASE10 - || r_type == (unsigned int) RELOC_BASE13 - || r_type == (unsigned int) RELOC_BASE22) - name = strings + GET_WORD (input_bfd, - syms[r_index].e_strx); - else - { - asection *s; - - s = aout_reloc_index_to_section (input_bfd, r_index); - name = bfd_section_name (input_bfd, s); - } - if (! ((*finfo->info->callbacks->reloc_overflow) - (finfo->info, name, howto_table_ext[r_type].name, - r_addend, input_bfd, input_section, r_addr))) - return FALSE; - } - break; - } - } - } - } - - return TRUE; -} - -/* Handle a link order which is supposed to generate a reloc. */ - -static bfd_boolean -aout_link_reloc_link_order (finfo, o, p) - struct aout_final_link_info *finfo; - asection *o; - struct bfd_link_order *p; -{ - struct bfd_link_order_reloc *pr; - int r_index; - int r_extern; - reloc_howto_type *howto; - file_ptr *reloff_ptr = NULL; - struct reloc_std_external srel; - struct reloc_ext_external erel; - PTR rel_ptr; - bfd_size_type amt; - - pr = p->u.reloc.p; - - if (p->type == bfd_section_reloc_link_order) - { - r_extern = 0; - if (bfd_is_abs_section (pr->u.section)) - r_index = N_ABS | N_EXT; - else - { - BFD_ASSERT (pr->u.section->owner == finfo->output_bfd); - r_index = pr->u.section->target_index; - } - } - else - { - struct aout_link_hash_entry *h; - - BFD_ASSERT (p->type == bfd_symbol_reloc_link_order); - r_extern = 1; - h = ((struct aout_link_hash_entry *) - bfd_wrapped_link_hash_lookup (finfo->output_bfd, finfo->info, - pr->u.name, FALSE, FALSE, TRUE)); - if (h != (struct aout_link_hash_entry *) NULL - && h->indx >= 0) - r_index = h->indx; - else if (h != NULL) - { - /* We decided to strip this symbol, but it turns out that we - can't. Note that we lose the other and desc information - here. I don't think that will ever matter for a global - symbol. */ - h->indx = -2; - h->written = FALSE; - if (! aout_link_write_other_symbol (h, (PTR) finfo)) - return FALSE; - r_index = h->indx; - } - else - { - if (! ((*finfo->info->callbacks->unattached_reloc) - (finfo->info, pr->u.name, (bfd *) NULL, - (asection *) NULL, (bfd_vma) 0))) - return FALSE; - r_index = 0; - } - } - - howto = bfd_reloc_type_lookup (finfo->output_bfd, pr->reloc); - if (howto == 0) - { - bfd_set_error (bfd_error_bad_value); - return FALSE; - } - - if (o == obj_textsec (finfo->output_bfd)) - reloff_ptr = &finfo->treloff; - else if (o == obj_datasec (finfo->output_bfd)) - reloff_ptr = &finfo->dreloff; - else - abort (); - - if (obj_reloc_entry_size (finfo->output_bfd) == RELOC_STD_SIZE) - { -#ifdef MY_put_reloc - MY_put_reloc (finfo->output_bfd, r_extern, r_index, p->offset, howto, - &srel); -#else - { - int r_pcrel; - int r_baserel; - int r_jmptable; - int r_relative; - int r_length; - - r_pcrel = (int) howto->pc_relative; - r_baserel = (howto->type & 8) != 0; - r_jmptable = (howto->type & 16) != 0; - r_relative = (howto->type & 32) != 0; - r_length = howto->size; - - PUT_WORD (finfo->output_bfd, p->offset, srel.r_address); - if (bfd_header_big_endian (finfo->output_bfd)) - { - srel.r_index[0] = r_index >> 16; - srel.r_index[1] = r_index >> 8; - srel.r_index[2] = r_index; - srel.r_type[0] = - ((r_extern ? RELOC_STD_BITS_EXTERN_BIG : 0) - | (r_pcrel ? RELOC_STD_BITS_PCREL_BIG : 0) - | (r_baserel ? RELOC_STD_BITS_BASEREL_BIG : 0) - | (r_jmptable ? RELOC_STD_BITS_JMPTABLE_BIG : 0) - | (r_relative ? RELOC_STD_BITS_RELATIVE_BIG : 0) - | (r_length << RELOC_STD_BITS_LENGTH_SH_BIG)); - } - else - { - srel.r_index[2] = r_index >> 16; - srel.r_index[1] = r_index >> 8; - srel.r_index[0] = r_index; - srel.r_type[0] = - ((r_extern ? RELOC_STD_BITS_EXTERN_LITTLE : 0) - | (r_pcrel ? RELOC_STD_BITS_PCREL_LITTLE : 0) - | (r_baserel ? RELOC_STD_BITS_BASEREL_LITTLE : 0) - | (r_jmptable ? RELOC_STD_BITS_JMPTABLE_LITTLE : 0) - | (r_relative ? RELOC_STD_BITS_RELATIVE_LITTLE : 0) - | (r_length << RELOC_STD_BITS_LENGTH_SH_LITTLE)); - } - } -#endif - rel_ptr = (PTR) &srel; - - /* We have to write the addend into the object file, since - standard a.out relocs are in place. It would be more - reliable if we had the current contents of the file here, - rather than assuming zeroes, but we can't read the file since - it was opened using bfd_openw. */ - if (pr->addend != 0) - { - bfd_size_type size; - bfd_reloc_status_type r; - bfd_byte *buf; - bfd_boolean ok; - - size = bfd_get_reloc_size (howto); - buf = (bfd_byte *) bfd_zmalloc (size); - if (buf == (bfd_byte *) NULL) - return FALSE; - r = MY_relocate_contents (howto, finfo->output_bfd, - (bfd_vma) pr->addend, buf); - switch (r) - { - case bfd_reloc_ok: - break; - default: - case bfd_reloc_outofrange: - abort (); - case bfd_reloc_overflow: - if (! ((*finfo->info->callbacks->reloc_overflow) - (finfo->info, - (p->type == bfd_section_reloc_link_order - ? bfd_section_name (finfo->output_bfd, - pr->u.section) - : pr->u.name), - howto->name, pr->addend, (bfd *) NULL, - (asection *) NULL, (bfd_vma) 0))) - { - free (buf); - return FALSE; - } - break; - } - ok = bfd_set_section_contents (finfo->output_bfd, o, (PTR) buf, - (file_ptr) p->offset, size); - free (buf); - if (! ok) - return FALSE; - } - } - else - { -#ifdef MY_put_ext_reloc - MY_put_ext_reloc (finfo->output_bfd, r_extern, r_index, p->offset, - howto, &erel, pr->addend); -#else - PUT_WORD (finfo->output_bfd, p->offset, erel.r_address); - - if (bfd_header_big_endian (finfo->output_bfd)) - { - erel.r_index[0] = r_index >> 16; - erel.r_index[1] = r_index >> 8; - erel.r_index[2] = r_index; - erel.r_type[0] = - ((r_extern ? RELOC_EXT_BITS_EXTERN_BIG : 0) - | (howto->type << RELOC_EXT_BITS_TYPE_SH_BIG)); - } - else - { - erel.r_index[2] = r_index >> 16; - erel.r_index[1] = r_index >> 8; - erel.r_index[0] = r_index; - erel.r_type[0] = - (r_extern ? RELOC_EXT_BITS_EXTERN_LITTLE : 0) - | (howto->type << RELOC_EXT_BITS_TYPE_SH_LITTLE); - } - - PUT_WORD (finfo->output_bfd, (bfd_vma) pr->addend, erel.r_addend); -#endif /* MY_put_ext_reloc */ - - rel_ptr = (PTR) &erel; - } - - amt = obj_reloc_entry_size (finfo->output_bfd); - if (bfd_seek (finfo->output_bfd, *reloff_ptr, SEEK_SET) != 0 - || bfd_bwrite (rel_ptr, amt, finfo->output_bfd) != amt) - return FALSE; - - *reloff_ptr += obj_reloc_entry_size (finfo->output_bfd); - - /* Assert that the relocs have not run into the symbols, and that n - the text relocs have not run into the data relocs. */ - BFD_ASSERT (*reloff_ptr <= obj_sym_filepos (finfo->output_bfd) - && (reloff_ptr != &finfo->treloff - || (*reloff_ptr - <= obj_datasec (finfo->output_bfd)->rel_filepos))); - - return TRUE; + + error_return: + if (aout_info.contents != NULL) + free (aout_info.contents); + if (aout_info.relocs != NULL) + free (aout_info.relocs); + if (aout_info.symbol_map != NULL) + free (aout_info.symbol_map); + if (aout_info.output_syms != NULL) + free (aout_info.output_syms); + if (includes_hash_initialized) + bfd_hash_table_free (&aout_info.includes.root); + return FALSE; } diff --git a/contrib/binutils/bfd/archive.c b/contrib/binutils/bfd/archive.c index ba6e684ee23..5a12f01f7cc 100644 --- a/contrib/binutils/bfd/archive.c +++ b/contrib/binutils/bfd/archive.c @@ -1,24 +1,24 @@ /* BFD back-end for archive files (libraries). Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003 + 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. Written by Cygnus Support. Mostly Gumby Henkel-Wallace's fault. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* @setfilename archive-info @@ -74,6 +74,8 @@ DESCRIPTION Archives are supported in BFD in <>. +SUBSECTION + Archive functions */ /* Assumes: @@ -121,7 +123,7 @@ DESCRIPTION Regular files with long names (or embedded spaces, for BSD variants): "/18 " - SVR4 style, name at offset 18 in name table. - "#1/23 " - Long name (or embedded paces) 23 characters long, + "#1/23 " - Long name (or embedded spaces) 23 characters long, BSD 4.4 style, full name follows header. Implemented for reading, not writing. " 18 " - Long name 18 characters long, extended pseudo-BSD. @@ -129,19 +131,17 @@ DESCRIPTION #include "bfd.h" #include "sysdep.h" +#include "libiberty.h" #include "libbfd.h" #include "aout/ar.h" #include "aout/ranlib.h" #include "safe-ctype.h" +#include "hashtab.h" #ifndef errno extern int errno; #endif -#ifdef GNU960 -#define BFD_GNU960_ARMAG(abfd) (BFD_COFF_FILE_P((abfd)) ? ARMAG : ARMAGB) -#endif - /* We keep a cache of archive filepointers to archive elements to speed up searching the archive by filepos. We only add an entry to the cache when we actually read one. We also don't sort the cache; @@ -150,8 +150,7 @@ extern int errno; to the front of the contents! */ struct ar_cache { file_ptr ptr; - bfd *arelt; - struct ar_cache *next; + bfd *arbfd; }; #define ar_padchar(abfd) ((abfd)->xvec->ar_pad_char) @@ -159,7 +158,22 @@ struct ar_cache { #define arch_eltdata(bfd) ((struct areltdata *) ((bfd)->arelt_data)) #define arch_hdr(bfd) ((struct ar_hdr *) arch_eltdata(bfd)->arch_header) - + +void +_bfd_ar_spacepad (char *p, size_t n, const char *fmt, long val) +{ + static char buf[20]; + size_t len; + snprintf (buf, sizeof (buf), fmt, val); + len = strlen (buf); + if (len < n) + { + memcpy (p, buf, len); + memset (p + len, ' ', n - len); + } + else + memcpy (p, buf, n); +} bfd_boolean _bfd_generic_mkarchive (bfd *abfd) @@ -170,11 +184,13 @@ _bfd_generic_mkarchive (bfd *abfd) if (bfd_ardata (abfd) == NULL) return FALSE; - bfd_ardata (abfd)->cache = NULL; - bfd_ardata (abfd)->archive_head = NULL; - bfd_ardata (abfd)->symdefs = NULL; - bfd_ardata (abfd)->extended_names = NULL; - bfd_ardata (abfd)->tdata = NULL; + /* Already cleared by bfd_zalloc above. + bfd_ardata (abfd)->cache = NULL; + bfd_ardata (abfd)->archive_head = NULL; + bfd_ardata (abfd)->symdefs = NULL; + bfd_ardata (abfd)->extended_names = NULL; + bfd_ardata (abfd)->extended_names_size = 0; + bfd_ardata (abfd)->tdata = NULL; */ return TRUE; } @@ -221,7 +237,7 @@ bfd_get_next_mapent (bfd *abfd, symindex prev, carsym **entry) return prev; } -/* To be called by backends only */ +/* To be called by backends only. */ bfd * _bfd_create_empty_archive_element_shell (bfd *obfd) @@ -251,40 +267,62 @@ bfd_set_archive_head (bfd *output_archive, bfd *new_head) bfd * _bfd_look_for_bfd_in_cache (bfd *arch_bfd, file_ptr filepos) { - struct ar_cache *current; + htab_t hash_table = bfd_ardata (arch_bfd)->cache; + struct ar_cache m; + m.ptr = filepos; - for (current = bfd_ardata (arch_bfd)->cache; current != NULL; - current = current->next) - if (current->ptr == filepos) - return current->arelt; - - return NULL; + if (hash_table) + { + struct ar_cache *entry = (struct ar_cache *) htab_find (hash_table, &m); + if (!entry) + return NULL; + else + return entry->arbfd; + } + else + return NULL; } -/* Kind of stupid to call cons for each one, but we don't do too many */ +static hashval_t +hash_file_ptr (const PTR p) +{ + return (hashval_t) (((struct ar_cache *) p)->ptr); +} + +/* Returns non-zero if P1 and P2 are equal. */ + +static int +eq_file_ptr (const PTR p1, const PTR p2) +{ + struct ar_cache *arc1 = (struct ar_cache *) p1; + struct ar_cache *arc2 = (struct ar_cache *) p2; + return arc1->ptr == arc2->ptr; +} + +/* Kind of stupid to call cons for each one, but we don't do too many. */ + bfd_boolean _bfd_add_bfd_to_archive_cache (bfd *arch_bfd, file_ptr filepos, bfd *new_elt) { - bfd_size_type amt = sizeof (struct ar_cache); + struct ar_cache *cache; + htab_t hash_table = bfd_ardata (arch_bfd)->cache; - struct ar_cache *new_cache = bfd_zalloc (arch_bfd, amt); - if (new_cache == NULL) - return FALSE; - - new_cache->ptr = filepos; - new_cache->arelt = new_elt; - new_cache->next = NULL; - if (bfd_ardata (arch_bfd)->cache == NULL) - bfd_ardata (arch_bfd)->cache = new_cache; - else + /* If the hash table hasn't been created, create it. */ + if (hash_table == NULL) { - struct ar_cache *current = bfd_ardata (arch_bfd)->cache; - - while (current->next != NULL) - current = current->next; - current->next = new_cache; + hash_table = htab_create_alloc (16, hash_file_ptr, eq_file_ptr, + NULL, calloc, free); + if (hash_table == NULL) + return FALSE; + bfd_ardata (arch_bfd)->cache = hash_table; } + /* Insert new_elt into the hash table by filepos. */ + cache = bfd_zalloc (arch_bfd, sizeof (struct ar_cache)); + cache->ptr = filepos; + cache->arbfd = new_elt; + *htab_find_slot (hash_table, (const void *) cache, INSERT) = cache; + return TRUE; } @@ -301,7 +339,7 @@ get_extended_arelt_filename (bfd *arch, const char *name) errno = 0; /* Skip first char, which is '/' in SVR4 or ' ' in some other variants. */ index = strtol (name + 1, NULL, 10); - if (errno != 0) + if (errno != 0 || index >= bfd_ardata (arch)->extended_names_size) { bfd_set_error (bfd_error_malformed_archive); return NULL; @@ -316,8 +354,7 @@ get_extended_arelt_filename (bfd *arch, const char *name) Presumes the file pointer is already in the right place (ie pointing to the ar_hdr in the file). Moves the file pointer; on success it should be pointing to the front of the file contents; on failure it - could have been moved arbitrarily. -*/ + could have been moved arbitrarily. */ void * _bfd_generic_read_ar_hdr (bfd *abfd) @@ -372,10 +409,7 @@ _bfd_generic_read_ar_hdr_mag (bfd *abfd, const char *mag) { filename = get_extended_arelt_filename (abfd, hdr.ar_name); if (filename == NULL) - { - bfd_set_error (bfd_error_malformed_archive); - return NULL; - } + return NULL; } /* BSD4.4-style long filename. Only implemented for reading, so far! */ @@ -467,6 +501,12 @@ _bfd_get_elt_at_filepos (bfd *archive, file_ptr filepos) struct areltdata *new_areldata; bfd *n_nfd; + if (archive->my_archive) + { + filepos += archive->origin; + archive = archive->my_archive; + } + n_nfd = _bfd_look_for_bfd_in_cache (archive, filepos); if (n_nfd) return n_nfd; @@ -549,10 +589,12 @@ bfd_generic_openr_next_archived_file (bfd *archive, bfd *last_file) else { unsigned int size = arelt_size (last_file); + filestart = last_file->origin + size; + if (archive->my_archive) + filestart -= archive->origin; /* Pad to an even boundary... Note that last_file->origin can be odd in the case of BSD-4.4-style element with a long odd size. */ - filestart = last_file->origin + size; filestart += filestart % 2; } @@ -573,14 +615,9 @@ bfd_generic_archive_p (bfd *abfd) return NULL; } -#ifdef GNU960 - if (strncmp (armag, BFD_GNU960_ARMAG (abfd), SARMAG) != 0) - return 0; -#else if (strncmp (armag, ARMAG, SARMAG) != 0 && strncmp (armag, ARMAGB, SARMAG) != 0) return 0; -#endif tdata_hold = bfd_ardata (abfd); @@ -593,11 +630,13 @@ bfd_generic_archive_p (bfd *abfd) } bfd_ardata (abfd)->first_file_filepos = SARMAG; - bfd_ardata (abfd)->cache = NULL; - bfd_ardata (abfd)->archive_head = NULL; - bfd_ardata (abfd)->symdefs = NULL; - bfd_ardata (abfd)->extended_names = NULL; - bfd_ardata (abfd)->tdata = NULL; + /* Cleared by bfd_zalloc above. + bfd_ardata (abfd)->cache = NULL; + bfd_ardata (abfd)->archive_head = NULL; + bfd_ardata (abfd)->symdefs = NULL; + bfd_ardata (abfd)->extended_names = NULL; + bfd_ardata (abfd)->extended_names_size = 0; + bfd_ardata (abfd)->tdata = NULL; */ if (!BFD_SEND (abfd, _bfd_slurp_armap, (abfd)) || !BFD_SEND (abfd, _bfd_slurp_extended_name_table, (abfd))) @@ -634,14 +673,6 @@ bfd_generic_archive_p (bfd *abfd) if (bfd_check_format (first, bfd_object) && first->xvec != abfd->xvec) { -#if 0 - /* We ought to close `first' here, but we can't, because - we have no way to remove it from the archive cache. - It's close to impossible to figure out when we can - release bfd_ardata. FIXME. */ - bfd_close (first); - bfd_release (abfd, bfd_ardata (abfd)); -#endif bfd_set_error (bfd_error_wrong_object_format); bfd_ardata (abfd) = tdata_hold; return NULL; @@ -670,7 +701,7 @@ bfd_generic_archive_p (bfd *abfd) /* The size of the string count. */ #define BSD_STRING_COUNT_SIZE 4 -/* Returns FALSE on error, TRUE otherwise */ +/* Returns FALSE on error, TRUE otherwise. */ static bfd_boolean do_slurp_bsd_armap (bfd *abfd) @@ -776,7 +807,6 @@ do_slurp_coff_armap (bfd *abfd) nsymz = bfd_getb32 (int_buf); stringsize = parsed_size - (4 * nsymz) - 4; -#if 1 /* ... except that some archive formats are broken, and it may be our fault - the i960 little endian coff sometimes has big and sometimes little, because our tools changed. Here's a horrible hack to clean @@ -791,14 +821,19 @@ do_slurp_coff_armap (bfd *abfd) stringsize = parsed_size - (4 * nsymz) - 4; swap = bfd_getl32; } -#endif /* The coff armap must be read sequentially. So we construct a bsd-style one in core all at once, for simplicity. */ + if (nsymz > ~ (bfd_size_type) 0 / sizeof (carsym)) + return FALSE; + carsym_size = (nsymz * sizeof (carsym)); ptrsize = (4 * nsymz); + if (carsym_size + stringsize + 1 <= carsym_size) + return FALSE; + ardata->symdefs = bfd_zalloc (abfd, carsym_size + stringsize + 1); if (ardata->symdefs == NULL) return FALSE; @@ -901,8 +936,8 @@ bfd_slurp_armap (bfd *abfd) return TRUE; } -/* Returns FALSE on error, TRUE otherwise */ -/* flavor 2 of a bsd armap, similar to bfd_slurp_bsd_armap except the +/* Returns FALSE on error, TRUE otherwise. */ +/* Flavor 2 of a bsd armap, similar to bfd_slurp_bsd_armap except the header is in a slightly different order and the map name is '/'. This flavour is used by hp300hpux. */ @@ -932,7 +967,7 @@ bfd_slurp_bsd_armap_f2 (bfd *abfd) return FALSE; if (!strncmp (nextname, "__.SYMDEF ", 16) - || !strncmp (nextname, "__.SYMDEF/ ", 16)) /* old Linux archives */ + || !strncmp (nextname, "__.SYMDEF/ ", 16)) /* Old Linux archives. */ return do_slurp_bsd_armap (abfd); if (strncmp (nextname, "/ ", 16)) @@ -1035,6 +1070,7 @@ _bfd_slurp_extended_name_table (bfd *abfd) strncmp (nextname, "// ", 16) != 0) { bfd_ardata (abfd)->extended_names = NULL; + bfd_ardata (abfd)->extended_names_size = 0; return TRUE; } @@ -1043,7 +1079,11 @@ _bfd_slurp_extended_name_table (bfd *abfd) return FALSE; amt = namedata->parsed_size; - bfd_ardata (abfd)->extended_names = bfd_zalloc (abfd, amt); + if (amt + 1 == 0) + goto byebye; + + bfd_ardata (abfd)->extended_names_size = amt; + bfd_ardata (abfd)->extended_names = bfd_zalloc (abfd, amt + 1); if (bfd_ardata (abfd)->extended_names == NULL) { byebye: @@ -1066,15 +1106,17 @@ _bfd_slurp_extended_name_table (bfd *abfd) trailing '/'. DOS/NT created archive often have \ in them We'll fix all problems here.. */ { - char *temp = bfd_ardata (abfd)->extended_names; + char *ext_names = bfd_ardata (abfd)->extended_names; + char *temp = ext_names; char *limit = temp + namedata->parsed_size; for (; temp < limit; ++temp) { if (*temp == '\012') - temp[temp[-1] == '/' ? -1 : 0] = '\0'; + temp[temp > ext_names && temp[-1] == '/' ? -1 : 0] = '\0'; if (*temp == '\\') *temp = '/'; } + *limit = '\0'; } /* Pad to an even boundary if you have to. */ @@ -1084,9 +1126,6 @@ _bfd_slurp_extended_name_table (bfd *abfd) /* FIXME, we can't release namedata here because it was allocated below extended_names on the objalloc... */ -#if 0 - bfd_release (abfd, namedata); -#endif } return TRUE; } @@ -1276,17 +1315,8 @@ _bfd_construct_extended_name_table (bfd *abfd, strptr[thislen + 1] = '\012'; } hdr->ar_name[0] = ar_padchar (current); - /* We know there will always be enough room (one of the few - cases where you may safely use sprintf). */ - sprintf ((hdr->ar_name) + 1, "%-d", (unsigned) (strptr - *tabloc)); - /* Kinda Kludgy. We should just use the returned value of - sprintf but not all implementations get this right. */ - { - char *temp = hdr->ar_name + 2; - for (; temp < hdr->ar_name + maxname; temp++) - if (*temp == '\0') - *temp = ' '; - } + _bfd_ar_spacepad (hdr->ar_name + 1, maxname - 1, "%-ld", + strptr - *tabloc); strptr += thislen + 1; if (trailing_slash) ++strptr; @@ -1296,7 +1326,7 @@ _bfd_construct_extended_name_table (bfd *abfd, return TRUE; } -/** A couple of functions for creating ar_hdrs */ +/* A couple of functions for creating ar_hdrs. */ #ifdef HPUX_LARGE_AR_IDS /* Function to encode large UID/GID values according to HP. */ @@ -1333,7 +1363,6 @@ bfd_ar_hdr_from_filesystem (bfd *abfd, const char *filename, bfd *member) struct stat status; struct areltdata *ared; struct ar_hdr *hdr; - char *temp, *temp1; bfd_size_type amt; if (member && (member->flags & BFD_IN_MEMORY) != 0) @@ -1361,39 +1390,31 @@ bfd_ar_hdr_from_filesystem (bfd *abfd, const char *filename, bfd *member) /* ar headers are space padded, not null padded! */ memset (hdr, ' ', sizeof (struct ar_hdr)); - strncpy (hdr->ar_fmag, ARFMAG, 2); - - /* Goddamned sprintf doesn't permit MAXIMUM field lengths. */ - sprintf ((hdr->ar_date), "%-12ld", (long) status.st_mtime); + _bfd_ar_spacepad (hdr->ar_date, sizeof (hdr->ar_date), "%-12ld", + status.st_mtime); #ifdef HPUX_LARGE_AR_IDS /* HP has a very "special" way to handle UID/GID's with numeric values > 99999. */ if (status.st_uid > 99999) - hpux_uid_gid_encode (hdr->ar_gid, (long) status.st_uid); + hpux_uid_gid_encode (hdr->ar_uid, (long) status.st_uid); else #endif - sprintf ((hdr->ar_uid), "%ld", (long) status.st_uid); + _bfd_ar_spacepad (hdr->ar_uid, sizeof (hdr->ar_uid), "%ld", + status.st_uid); #ifdef HPUX_LARGE_AR_IDS /* HP has a very "special" way to handle UID/GID's with numeric values > 99999. */ if (status.st_gid > 99999) - hpux_uid_gid_encode (hdr->ar_uid, (long) status.st_gid); + hpux_uid_gid_encode (hdr->ar_gid, (long) status.st_gid); else #endif - sprintf ((hdr->ar_gid), "%ld", (long) status.st_gid); - sprintf ((hdr->ar_mode), "%-8o", (unsigned int) status.st_mode); - sprintf ((hdr->ar_size), "%-10ld", (long) status.st_size); - /* Correct for a lossage in sprintf whereby it null-terminates. I cannot - understand how these C losers could design such a ramshackle bunch of - IO operations. */ - temp = (char *) hdr; - temp1 = temp + sizeof (struct ar_hdr) - 2; - for (; temp < temp1; temp++) - { - if (*temp == '\0') - *temp = ' '; - } - strncpy (hdr->ar_fmag, ARFMAG, 2); + _bfd_ar_spacepad (hdr->ar_gid, sizeof (hdr->ar_gid), "%ld", + status.st_gid); + _bfd_ar_spacepad (hdr->ar_mode, sizeof (hdr->ar_mode), "%-8lo", + status.st_mode); + _bfd_ar_spacepad (hdr->ar_size, sizeof (hdr->ar_size), "%-10ld", + status.st_size); + memcpy (hdr->ar_fmag, ARFMAG, 2); ared->parsed_size = status.st_size; ared->arch_header = (char *) hdr; @@ -1614,7 +1635,6 @@ _bfd_write_archive_contents (bfd *arch) /* If no .o's, don't bother to make a map. */ bfd_boolean hasobjects = FALSE; bfd_size_type wrote; - unsigned int i; int tries; /* Verify the viability of all entries; if any of them live in the @@ -1646,11 +1666,7 @@ _bfd_write_archive_contents (bfd *arch) if (makemap && ! hasobjects) { /* Don't bother if we won't make a map! */ - if ((bfd_check_format (current, bfd_object)) -#if 0 /* FIXME -- these are not set correctly */ - && ((bfd_get_file_flags (current) & HAS_SYMS)) -#endif - ) + if ((bfd_check_format (current, bfd_object))) hasobjects = TRUE; } } @@ -1661,11 +1677,7 @@ _bfd_write_archive_contents (bfd *arch) if (bfd_seek (arch, (file_ptr) 0, SEEK_SET) != 0) return FALSE; -#ifdef GNU960 - wrote = bfd_bwrite (BFD_GNU960_ARMAG (arch), SARMAG, arch); -#else wrote = bfd_bwrite (ARMAG, SARMAG, arch); -#endif if (wrote != SARMAG) return FALSE; @@ -1679,15 +1691,12 @@ _bfd_write_archive_contents (bfd *arch) { struct ar_hdr hdr; - memset (&hdr, 0, sizeof (struct ar_hdr)); - strcpy (hdr.ar_name, ename); + memset (&hdr, ' ', sizeof (struct ar_hdr)); + memcpy (hdr.ar_name, ename, strlen (ename)); /* Round size up to even number in archive header. */ - sprintf (&(hdr.ar_size[0]), "%-10d", - (int) ((elength + 1) & ~(bfd_size_type) 1)); - strncpy (hdr.ar_fmag, ARFMAG, 2); - for (i = 0; i < sizeof (struct ar_hdr); i++) - if (((char *) (&hdr))[i] == '\0') - (((char *) (&hdr))[i]) = ' '; + _bfd_ar_spacepad (hdr.ar_size, sizeof (hdr.ar_size), "%-10ld", + (elength + 1) & ~(bfd_size_type) 1); + memcpy (hdr.ar_fmag, ARFMAG, 2); if ((bfd_bwrite (&hdr, sizeof (struct ar_hdr), arch) != sizeof (struct ar_hdr)) || bfd_bwrite (etable, elength, arch) != elength) @@ -1765,9 +1774,9 @@ _bfd_compute_and_write_armap (bfd *arch, unsigned int elength) bfd *current; file_ptr elt_no = 0; struct orl *map = NULL; - unsigned int orl_max = 1024; /* fine initial default */ + unsigned int orl_max = 1024; /* Fine initial default. */ unsigned int orl_count = 0; - int stridx = 0; /* string index */ + int stridx = 0; asymbol **syms = NULL; long syms_max = 0; bfd_boolean ret; @@ -1916,30 +1925,27 @@ bsd_write_armap (bfd *arch, unsigned int mapsize = ranlibsize + stringsize + 8; file_ptr firstreal; bfd *current = arch->archive_head; - bfd *last_elt = current; /* last element arch seen */ + bfd *last_elt = current; /* Last element arch seen. */ bfd_byte temp[4]; unsigned int count; struct ar_hdr hdr; struct stat statbuf; - unsigned int i; firstreal = mapsize + elength + sizeof (struct ar_hdr) + SARMAG; stat (arch->filename, &statbuf); - memset (&hdr, 0, sizeof (struct ar_hdr)); - sprintf (hdr.ar_name, RANLIBMAG); + memset (&hdr, ' ', sizeof (struct ar_hdr)); + memcpy (hdr.ar_name, RANLIBMAG, strlen (RANLIBMAG)); /* Remember the timestamp, to keep it holy. But fudge it a little. */ bfd_ardata (arch)->armap_timestamp = statbuf.st_mtime + ARMAP_TIME_OFFSET; bfd_ardata (arch)->armap_datepos = (SARMAG + offsetof (struct ar_hdr, ar_date[0])); - sprintf (hdr.ar_date, "%ld", bfd_ardata (arch)->armap_timestamp); - sprintf (hdr.ar_uid, "%ld", (long) getuid ()); - sprintf (hdr.ar_gid, "%ld", (long) getgid ()); - sprintf (hdr.ar_size, "%-10d", (int) mapsize); - strncpy (hdr.ar_fmag, ARFMAG, 2); - for (i = 0; i < sizeof (struct ar_hdr); i++) - if (((char *) (&hdr))[i] == '\0') - (((char *) (&hdr))[i]) = ' '; + _bfd_ar_spacepad (hdr.ar_date, sizeof (hdr.ar_date), "%ld", + bfd_ardata (arch)->armap_timestamp); + _bfd_ar_spacepad (hdr.ar_uid, sizeof (hdr.ar_uid), "%ld", getuid ()); + _bfd_ar_spacepad (hdr.ar_gid, sizeof (hdr.ar_gid), "%ld", getgid ()); + _bfd_ar_spacepad (hdr.ar_size, sizeof (hdr.ar_size), "%-10ld", mapsize); + memcpy (hdr.ar_fmag, ARFMAG, 2); if (bfd_bwrite (&hdr, sizeof (struct ar_hdr), arch) != sizeof (struct ar_hdr)) return FALSE; @@ -1960,7 +1966,7 @@ bsd_write_armap (bfd *arch, current = current->next; } while (current != map[count].u.abfd); - } /* if new archive element */ + } last_elt = current; H_PUT_32 (arch, map[count].namidx, buf); @@ -2004,7 +2010,6 @@ _bfd_archive_bsd_update_armap_timestamp (bfd *arch) { struct stat archstat; struct ar_hdr hdr; - unsigned int i; /* Flush writes, get last-write timestamp from file, and compare it to the timestamp IN the file. */ @@ -2024,11 +2029,9 @@ _bfd_archive_bsd_update_armap_timestamp (bfd *arch) bfd_ardata (arch)->armap_timestamp = archstat.st_mtime + ARMAP_TIME_OFFSET; /* Prepare an ASCII version suitable for writing. */ - memset (hdr.ar_date, 0, sizeof (hdr.ar_date)); - sprintf (hdr.ar_date, "%ld", bfd_ardata (arch)->armap_timestamp); - for (i = 0; i < sizeof (hdr.ar_date); i++) - if (hdr.ar_date[i] == '\0') - (hdr.ar_date)[i] = ' '; + memset (hdr.ar_date, ' ', sizeof (hdr.ar_date)); + _bfd_ar_spacepad (hdr.ar_date, sizeof (hdr.ar_date), "%ld", + bfd_ardata (arch)->armap_timestamp); /* Write it into the file. */ bfd_ardata (arch)->armap_datepos = (SARMAG @@ -2058,8 +2061,7 @@ _bfd_archive_bsd_update_armap_timestamp (bfd *arch) symbol name 0 symbol name 1 - symbol name n-1 -*/ + symbol name n-1 */ bfd_boolean coff_write_armap (bfd *arch, @@ -2077,7 +2079,6 @@ coff_write_armap (bfd *arch, bfd *current = arch->archive_head; unsigned int count; struct ar_hdr hdr; - unsigned int i; int padit = mapsize & 1; if (padit) @@ -2089,22 +2090,19 @@ coff_write_armap (bfd *arch, + sizeof (struct ar_hdr) + SARMAG); - memset (&hdr, 0, sizeof (struct ar_hdr)); + memset (&hdr, ' ', sizeof (struct ar_hdr)); hdr.ar_name[0] = '/'; - sprintf (hdr.ar_size, "%-10d", (int) mapsize); - sprintf (hdr.ar_date, "%ld", (long) time (NULL)); + _bfd_ar_spacepad (hdr.ar_size, sizeof (hdr.ar_size), "%-10ld", + mapsize); + _bfd_ar_spacepad (hdr.ar_date, sizeof (hdr.ar_date), "%ld", + 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]) = ' '; + _bfd_ar_spacepad (hdr.ar_uid, sizeof (hdr.ar_uid), "%ld", 0); + _bfd_ar_spacepad (hdr.ar_gid, sizeof (hdr.ar_gid), "%ld", 0); + _bfd_ar_spacepad (hdr.ar_mode, sizeof (hdr.ar_mode), "%-7lo", 0); + memcpy (hdr.ar_fmag, ARFMAG, 2); /* Write the ar header for this item and the number of symbols. */ - if (bfd_bwrite (&hdr, sizeof (struct ar_hdr), arch) != sizeof (struct ar_hdr)) return FALSE; diff --git a/contrib/binutils/bfd/archive64.c b/contrib/binutils/bfd/archive64.c index 1b9f5f3c0f2..3b28f853c21 100644 --- a/contrib/binutils/bfd/archive64.c +++ b/contrib/binutils/bfd/archive64.c @@ -19,7 +19,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* This file supports the 64-bit (MIPS) ELF archives. */ @@ -156,7 +156,6 @@ bfd_elf64_archive_write_armap (bfd *arch, bfd *current = arch->archive_head; unsigned int count; struct ar_hdr hdr; - unsigned int i; int padding; bfd_byte buf[8]; @@ -169,19 +168,17 @@ bfd_elf64_archive_write_armap (bfd *arch, + sizeof (struct ar_hdr) + SARMAG); - memset (&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)); + memset (&hdr, ' ', sizeof (struct ar_hdr)); + memcpy (hdr.ar_name, "/SYM64/", strlen ("/SYM64/")); + _bfd_ar_spacepad (hdr.ar_size, sizeof (hdr.ar_size), "%-10ld", + mapsize); + _bfd_ar_spacepad (hdr.ar_date, sizeof (hdr.ar_date), "%ld", + 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]) = ' '; + _bfd_ar_spacepad (hdr.ar_uid, sizeof (hdr.ar_uid), "%ld", 0); + _bfd_ar_spacepad (hdr.ar_gid, sizeof (hdr.ar_gid), "%ld", 0); + _bfd_ar_spacepad (hdr.ar_mode, sizeof (hdr.ar_mode), "%-7lo", 0); + memcpy (hdr.ar_fmag, ARFMAG, 2); /* Write the ar header for this item and the number of symbols */ diff --git a/contrib/binutils/bfd/archures.c b/contrib/binutils/bfd/archures.c index 58893b02290..137c8285806 100644 --- a/contrib/binutils/bfd/archures.c +++ b/contrib/binutils/bfd/archures.c @@ -80,11 +80,22 @@ DESCRIPTION .#define bfd_mach_m68040 6 .#define bfd_mach_m68060 7 .#define bfd_mach_cpu32 8 -.#define bfd_mach_mcf5200 9 -.#define bfd_mach_mcf5206e 10 -.#define bfd_mach_mcf5307 11 -.#define bfd_mach_mcf5407 12 -.#define bfd_mach_mcf528x 13 +.#define bfd_mach_mcf_isa_a_nodiv 9 +.#define bfd_mach_mcf_isa_a 10 +.#define bfd_mach_mcf_isa_a_mac 11 +.#define bfd_mach_mcf_isa_a_emac 12 +.#define bfd_mach_mcf_isa_aplus 13 +.#define bfd_mach_mcf_isa_aplus_mac 14 +.#define bfd_mach_mcf_isa_aplus_emac 15 +.#define bfd_mach_mcf_isa_b_nousp 16 +.#define bfd_mach_mcf_isa_b_nousp_mac 17 +.#define bfd_mach_mcf_isa_b_nousp_emac 18 +.#define bfd_mach_mcf_isa_b 19 +.#define bfd_mach_mcf_isa_b_mac 20 +.#define bfd_mach_mcf_isa_b_emac 21 +.#define bfd_mach_mcf_isa_b_float 22 +.#define bfd_mach_mcf_isa_b_float_mac 23 +.#define bfd_mach_mcf_isa_b_float_emac 24 . bfd_arch_vax, {* DEC Vax *} . bfd_arch_i960, {* Intel 960 *} . {* The order of the following is important. @@ -106,7 +117,6 @@ DESCRIPTION . . bfd_arch_or32, {* OpenRISC 32 *} . -. bfd_arch_a29k, {* AMD 29000 *} . bfd_arch_sparc, {* SPARC *} .#define bfd_mach_sparc 1 .{* The difference between v8plus and v9 is that v9 is a true 64 bit env. *} @@ -123,6 +133,9 @@ DESCRIPTION .#define bfd_mach_sparc_v9_p(mach) \ . ((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9b \ . && (mach) != bfd_mach_sparc_sparclite_le) +.{* Nonzero if MACH is a 64 bit sparc architecture. *} +.#define bfd_mach_sparc_64bit_p(mach) \ +. ((mach) >= bfd_mach_sparc_v9 && (mach) != bfd_mach_sparc_v8plusb) . bfd_arch_mips, {* MIPS Rxxxx *} .#define bfd_mach_mips3000 3000 .#define bfd_mach_mips3900 3900 @@ -163,7 +176,6 @@ DESCRIPTION . bfd_arch_i860, {* Intel 860 *} . bfd_arch_i370, {* IBM 360/370 Mainframes *} . bfd_arch_romp, {* IBM ROMP PC/RT *} -. bfd_arch_alliant, {* Alliant *} . bfd_arch_convex, {* Convex *} . bfd_arch_m88k, {* Motorola 88xxx *} . bfd_arch_m98k, {* Motorola 98xxx *} @@ -226,12 +238,20 @@ DESCRIPTION .#define bfd_mach_sh 1 .#define bfd_mach_sh2 0x20 .#define bfd_mach_sh_dsp 0x2d +.#define bfd_mach_sh2a 0x2a +.#define bfd_mach_sh2a_nofpu 0x2b +.#define bfd_mach_sh2a_nofpu_or_sh4_nommu_nofpu 0x2a1 +.#define bfd_mach_sh2a_nofpu_or_sh3_nommu 0x2a2 +.#define bfd_mach_sh2a_or_sh4 0x2a3 +.#define bfd_mach_sh2a_or_sh3e 0x2a4 .#define bfd_mach_sh2e 0x2e .#define bfd_mach_sh3 0x30 +.#define bfd_mach_sh3_nommu 0x31 .#define bfd_mach_sh3_dsp 0x3d .#define bfd_mach_sh3e 0x3e .#define bfd_mach_sh4 0x40 .#define bfd_mach_sh4_nofpu 0x41 +.#define bfd_mach_sh4_nommu_nofpu 0x42 .#define bfd_mach_sh4a 0x4a .#define bfd_mach_sh4a_nofpu 0x4b .#define bfd_mach_sh4al_dsp 0x4d @@ -271,6 +291,9 @@ DESCRIPTION .#define bfd_mach_arc_6 6 .#define bfd_mach_arc_7 7 .#define bfd_mach_arc_8 8 +. bfd_arch_m32c, {* Renesas M16C/M32C. *} +.#define bfd_mach_m16c 0x75 +.#define bfd_mach_m32c 0x78 . bfd_arch_m32r, {* Renesas M32R (formerly Mitsubishi M32R/D) *} .#define bfd_mach_m32r 1 {* For backwards compatibility. *} .#define bfd_mach_m32rx 'x' @@ -287,6 +310,7 @@ DESCRIPTION .#define bfd_mach_frvsimple 2 .#define bfd_mach_fr300 300 .#define bfd_mach_fr400 400 +.#define bfd_mach_fr450 450 .#define bfd_mach_frvtomcat 499 {* fr500 prototype *} .#define bfd_mach_fr500 500 .#define bfd_mach_fr550 550 @@ -300,6 +324,10 @@ DESCRIPTION . bfd_arch_iq2000, {* Vitesse IQ2000. *} .#define bfd_mach_iq2000 1 .#define bfd_mach_iq10 2 +. bfd_arch_mt, +.#define bfd_mach_ms1 1 +.#define bfd_mach_mrisc2 2 +.#define bfd_mach_ms2 3 . bfd_arch_pj, . bfd_arch_avr, {* Atmel AVR microcontrollers. *} .#define bfd_mach_avr1 1 @@ -307,7 +335,16 @@ DESCRIPTION .#define bfd_mach_avr3 3 .#define bfd_mach_avr4 4 .#define bfd_mach_avr5 5 +. bfd_arch_bfin, {* ADI Blackfin *} +.#define bfd_mach_bfin 1 +. bfd_arch_cr16c, {* National Semiconductor CompactRISC. *} +.#define bfd_mach_cr16c 1 +. bfd_arch_crx, {* National Semiconductor CRX. *} +.#define bfd_mach_crx 1 . bfd_arch_cris, {* Axis CRIS *} +.#define bfd_mach_cris_v0_v10 255 +.#define bfd_mach_cris_v32 32 +.#define bfd_mach_cris_v10_v32 1032 . bfd_arch_s390, {* IBM s390 *} .#define bfd_mach_s390_31 31 .#define bfd_mach_s390_64 64 @@ -322,7 +359,8 @@ DESCRIPTION .#define bfd_mach_msp13 13 .#define bfd_mach_msp14 14 .#define bfd_mach_msp15 15 -.#define bfd_mach_msp16 16 +.#define bfd_mach_msp16 16 +.#define bfd_mach_msp21 21 .#define bfd_mach_msp31 31 .#define bfd_mach_msp32 32 .#define bfd_mach_msp33 33 @@ -330,8 +368,20 @@ DESCRIPTION .#define bfd_mach_msp42 42 .#define bfd_mach_msp43 43 .#define bfd_mach_msp44 44 +. bfd_arch_xc16x, {* Infineon's XC16X Series. *} +.#define bfd_mach_xc16x 1 +.#define bfd_mach_xc16xl 2 +.#define bfd_mach_xc16xs 3 . bfd_arch_xtensa, {* Tensilica's Xtensa cores. *} .#define bfd_mach_xtensa 1 +. bfd_arch_maxq, {* Dallas MAXQ 10/20 *} +.#define bfd_mach_maxq10 10 +.#define bfd_mach_maxq20 20 +. bfd_arch_z80, +.#define bfd_mach_z80strict 1 {* No undocumented opcodes. *} +.#define bfd_mach_z80 3 {* With ixl, ixh, iyl, and iyh. *} +.#define bfd_mach_z80full 7 {* All undocumented instructions. *} +.#define bfd_mach_r800 11 {* R800: successor with multiplication. *} . bfd_arch_last . }; */ @@ -370,12 +420,14 @@ DESCRIPTION . */ -extern const bfd_arch_info_type bfd_a29k_arch; extern const bfd_arch_info_type bfd_alpha_arch; extern const bfd_arch_info_type bfd_arc_arch; extern const bfd_arch_info_type bfd_arm_arch; extern const bfd_arch_info_type bfd_avr_arch; +extern const bfd_arch_info_type bfd_bfin_arch; +extern const bfd_arch_info_type bfd_cr16c_arch; extern const bfd_arch_info_type bfd_cris_arch; +extern const bfd_arch_info_type bfd_crx_arch; extern const bfd_arch_info_type bfd_d10v_arch; extern const bfd_arch_info_type bfd_d30v_arch; extern const bfd_arch_info_type bfd_dlx_arch; @@ -391,17 +443,20 @@ extern const bfd_arch_info_type bfd_i960_arch; extern const bfd_arch_info_type bfd_ia64_arch; extern const bfd_arch_info_type bfd_ip2k_arch; extern const bfd_arch_info_type bfd_iq2000_arch; +extern const bfd_arch_info_type bfd_m32c_arch; extern const bfd_arch_info_type bfd_m32r_arch; extern const bfd_arch_info_type bfd_m68hc11_arch; extern const bfd_arch_info_type bfd_m68hc12_arch; extern const bfd_arch_info_type bfd_m68k_arch; extern const bfd_arch_info_type bfd_m88k_arch; +extern const bfd_arch_info_type bfd_maxq_arch; extern const bfd_arch_info_type bfd_mcore_arch; extern const bfd_arch_info_type bfd_mips_arch; extern const bfd_arch_info_type bfd_mmix_arch; extern const bfd_arch_info_type bfd_mn10200_arch; extern const bfd_arch_info_type bfd_mn10300_arch; extern const bfd_arch_info_type bfd_msp430_arch; +extern const bfd_arch_info_type bfd_mt_arch; extern const bfd_arch_info_type bfd_ns32k_arch; extern const bfd_arch_info_type bfd_openrisc_arch; extern const bfd_arch_info_type bfd_or32_arch; @@ -423,6 +478,8 @@ extern const bfd_arch_info_type bfd_we32k_arch; extern const bfd_arch_info_type bfd_w65_arch; extern const bfd_arch_info_type bfd_xstormy16_arch; extern const bfd_arch_info_type bfd_xtensa_arch; +extern const bfd_arch_info_type bfd_xc16x_arch; +extern const bfd_arch_info_type bfd_z80_arch; extern const bfd_arch_info_type bfd_z8k_arch; static const bfd_arch_info_type * const bfd_archures_list[] = @@ -430,12 +487,14 @@ static const bfd_arch_info_type * const bfd_archures_list[] = #ifdef SELECT_ARCHITECTURES SELECT_ARCHITECTURES, #else - &bfd_a29k_arch, &bfd_alpha_arch, &bfd_arc_arch, &bfd_arm_arch, &bfd_avr_arch, + &bfd_bfin_arch, + &bfd_cr16c_arch, &bfd_cris_arch, + &bfd_crx_arch, &bfd_d10v_arch, &bfd_d30v_arch, &bfd_dlx_arch, @@ -451,16 +510,19 @@ static const bfd_arch_info_type * const bfd_archures_list[] = &bfd_ia64_arch, &bfd_ip2k_arch, &bfd_iq2000_arch, + &bfd_m32c_arch, &bfd_m32r_arch, &bfd_m68hc11_arch, &bfd_m68hc12_arch, &bfd_m68k_arch, &bfd_m88k_arch, + &bfd_maxq_arch, &bfd_mcore_arch, &bfd_mips_arch, &bfd_mmix_arch, &bfd_mn10200_arch, &bfd_mn10300_arch, + &bfd_mt_arch, &bfd_msp430_arch, &bfd_ns32k_arch, &bfd_openrisc_arch, @@ -481,6 +543,8 @@ static const bfd_arch_info_type * const bfd_archures_list[] = &bfd_we32k_arch, &bfd_xstormy16_arch, &bfd_xtensa_arch, + &bfd_xc16x_arch, + &bfd_z80_arch, &bfd_z8k_arch, #endif 0 @@ -953,23 +1017,23 @@ bfd_default_scan (const bfd_arch_info_type *info, const char *string) break; case 5200: arch = bfd_arch_m68k; - number = bfd_mach_mcf5200; + number = bfd_mach_mcf_isa_a_nodiv; break; case 5206: arch = bfd_arch_m68k; - number = bfd_mach_mcf5206e; + number = bfd_mach_mcf_isa_a_mac; break; case 5307: arch = bfd_arch_m68k; - number = bfd_mach_mcf5307; + number = bfd_mach_mcf_isa_a_mac; break; case 5407: arch = bfd_arch_m68k; - number = bfd_mach_mcf5407; + number = bfd_mach_mcf_isa_b_nousp_mac; break; case 5282: arch = bfd_arch_m68k; - number = bfd_mach_mcf528x; + number = bfd_mach_mcf_isa_aplus_emac; break; case 32000: diff --git a/contrib/binutils/bfd/armnetbsd.c b/contrib/binutils/bfd/armnetbsd.c index d82e98f49eb..602c1e058a0 100644 --- a/contrib/binutils/bfd/armnetbsd.c +++ b/contrib/binutils/bfd/armnetbsd.c @@ -1,5 +1,6 @@ /* BFD back-end for NetBSD/ARM a.out-ish binaries. - Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright 1999, 2000, 2001, 2002, 2005 + Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -15,7 +16,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #define BYTES_IN_WORD 4 #undef TARGET_IS_BIG_ENDIAN_P @@ -35,19 +36,4 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* This needs to start with a.out so GDB knows it is an a.out variant. */ #define TARGETNAME "a.out-arm-netbsd" -#if 0 -#define NAME(x,y) CONCAT3 (aoutarm,_32_,y) - -#define aoutarm_32_get_section_contents aout_32_get_section_contents - -#define MY_bfd_reloc_type_lookup aoutarm_bfd_reloc_type_lookup - -#include "bfd.h" /* To ensure following declaration is OK */ - -const struct reloc_howto_struct * -MY_bfd_reloc_type_lookup - PARAMS ((bfd * abfd AND - bfd_reloc_code_real_type code)); -#endif - #include "netbsd.h" diff --git a/contrib/binutils/bfd/bfd-in.h b/contrib/binutils/bfd/bfd-in.h index 1a5d1ea0dd6..33b649d0585 100644 --- a/contrib/binutils/bfd/bfd-in.h +++ b/contrib/binutils/bfd/bfd-in.h @@ -1,7 +1,8 @@ /* Main header file for the bfd library -- portable access to object files. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. Contributed by Cygnus Support. @@ -19,7 +20,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef __BFD_H_SEEN__ #define __BFD_H_SEEN__ @@ -89,14 +90,6 @@ typedef int bfd_boolean; #define FALSE 0 #define TRUE 1 -#if 0 -/* Poison. */ -#undef false -#undef true -#define false dont_use_false_in_bfd -#define true dont_use_true_in_bfd -#endif - #ifdef BFD64 #ifndef BFD_HOST_64_BIT @@ -144,6 +137,9 @@ typedef unsigned long bfd_size_type; #endif /* not BFD64 */ +#define HALF_BFD_SIZE_TYPE \ + (((bfd_size_type) 1) << (8 * sizeof (bfd_size_type) / 2)) + #ifndef BFD_HOST_64_BIT /* Fall back on a 32 bit type. The idea is to make these types always available for function return types, but in the case that @@ -238,6 +234,10 @@ bfd_format; /* The sections in this BFD specify a memory page. */ #define HAS_LOAD_PAGE 0x1000 + +/* This BFD has been created by the linker and doesn't correspond + to any input file. */ +#define BFD_LINKER_CREATED 0x2000 /* Symbols and relocation. */ @@ -308,7 +308,8 @@ typedef struct bfd_section *sec_ptr; #define bfd_get_section_lma(bfd, ptr) ((ptr)->lma + 0) #define bfd_get_section_alignment(bfd, ptr) ((ptr)->alignment_power + 0) #define bfd_section_name(bfd, ptr) ((ptr)->name) -#define bfd_section_size(bfd, ptr) (bfd_get_section_size_before_reloc(ptr)) +#define bfd_section_size(bfd, ptr) ((ptr)->size) +#define bfd_get_section_size(ptr) ((ptr)->size) #define bfd_section_vma(bfd, ptr) ((ptr)->vma) #define bfd_section_lma(bfd, ptr) ((ptr)->lma) #define bfd_section_alignment(bfd, ptr) ((ptr)->alignment_power) @@ -320,6 +321,10 @@ typedef struct bfd_section *sec_ptr; #define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = TRUE), TRUE) #define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),TRUE) #define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),TRUE) +/* Find the address one past the end of SEC. */ +#define bfd_get_section_limit(bfd, sec) \ + (((sec)->rawsize ? (sec)->rawsize : (sec)->size) \ + / bfd_octets_per_byte (bfd)) typedef struct stat stat_type; @@ -371,6 +376,8 @@ struct bfd_hash_table struct bfd_hash_entry **table; /* The number of slots in the hash table. */ unsigned int size; + /* The size of elements. */ + unsigned int entsize; /* A function used to create new elements in the hash table. The first entry is itself a pointer to an element. When this function is first invoked, this pointer will be NULL. However, @@ -390,7 +397,8 @@ extern bfd_boolean bfd_hash_table_init (struct bfd_hash_table *, struct bfd_hash_entry *(*) (struct bfd_hash_entry *, struct bfd_hash_table *, - const char *)); + const char *), + unsigned int); /* Initialize a hash table specifying a size. */ extern bfd_boolean bfd_hash_table_init_n @@ -398,7 +406,7 @@ extern bfd_boolean bfd_hash_table_init_n struct bfd_hash_entry *(*) (struct bfd_hash_entry *, struct bfd_hash_table *, const char *), - unsigned int size); + unsigned int, unsigned int); /* Free up a hash table. */ extern void bfd_hash_table_free @@ -433,6 +441,24 @@ extern void bfd_hash_traverse bfd_boolean (*) (struct bfd_hash_entry *, void *), void *info); +/* Allows the default size of a hash table to be configured. New hash + tables allocated using bfd_hash_table_init will be created with + this size. */ +extern void bfd_hash_set_default_size (bfd_size_type); + +/* This structure is used to keep track of stabs in sections + information while linking. */ + +struct stab_info +{ + /* A hash table used to hold stabs strings. */ + struct bfd_strtab_hash *strings; + /* The header file hash table. */ + struct bfd_hash_table includes; + /* The first .stabstr section. */ + struct bfd_section *stabstr; +}; + #define COFF_SWAP_TABLE (void *) &bfd_coff_std_swap_table /* User program access to BFD facilities. */ @@ -505,6 +531,8 @@ extern bfd_boolean bfd_cache_close (bfd *abfd); /* NB: This declaration should match the autogenerated one in libbfd.h. */ +extern bfd_boolean bfd_cache_close_all (void); + extern bfd_boolean bfd_record_phdr (bfd *, unsigned long, bfd_boolean, flagword, bfd_boolean, bfd_vma, bfd_boolean, bfd_boolean, unsigned int, struct bfd_section **); @@ -534,6 +562,9 @@ void bfd_putl16 (bfd_vma, void *); bfd_uint64_t bfd_get_bits (const void *, int, bfd_boolean); void bfd_put_bits (bfd_uint64_t, void *, int, bfd_boolean); + +extern bfd_boolean bfd_section_already_linked_table_init (void); +extern void bfd_section_already_linked_table_free (void); /* Externally visible ECOFF routines. */ @@ -587,8 +618,6 @@ extern bfd_boolean bfd_ecoff_write_accumulated_debug (void *handle, bfd *abfd, struct ecoff_debug_info *debug, const struct ecoff_debug_swap *swap, struct bfd_link_info *info, file_ptr where); -extern bfd_boolean bfd_mips_ecoff_create_embedded_relocs - (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **); /* Externally visible ELF routines. */ @@ -602,28 +631,44 @@ struct bfd_link_needed_list enum dynamic_lib_link_class { DYN_NORMAL = 0, DYN_AS_NEEDED = 1, - DYN_DT_NEEDED = 2 + DYN_DT_NEEDED = 2, + DYN_NO_ADD_NEEDED = 4, + DYN_NO_NEEDED = 8 +}; + +enum notice_asneeded_action { + notice_as_needed, + notice_not_needed, + notice_needed }; extern bfd_boolean bfd_elf_record_link_assignment - (bfd *, struct bfd_link_info *, const char *, bfd_boolean); + (bfd *, struct bfd_link_info *, const char *, bfd_boolean, + bfd_boolean); extern struct bfd_link_needed_list *bfd_elf_get_needed_list (bfd *, struct bfd_link_info *); extern bfd_boolean bfd_elf_get_bfd_needed_list (bfd *, struct bfd_link_needed_list **); extern bfd_boolean bfd_elf_size_dynamic_sections (bfd *, const char *, const char *, const char *, const char * const *, - struct bfd_link_info *, struct bfd_section **, struct bfd_elf_version_tree *); + struct bfd_link_info *, struct bfd_section **, + struct bfd_elf_version_tree *); +extern bfd_boolean bfd_elf_size_dynsym_hash_dynstr + (bfd *, struct bfd_link_info *); extern void bfd_elf_set_dt_needed_name (bfd *, const char *); extern const char *bfd_elf_get_dt_soname (bfd *); extern void bfd_elf_set_dyn_lib_class (bfd *, int); +extern int bfd_elf_get_dyn_lib_class + (bfd *); extern struct bfd_link_needed_list *bfd_elf_get_runpath_list (bfd *, struct bfd_link_info *); extern bfd_boolean bfd_elf_discard_info (bfd *, struct bfd_link_info *); +extern unsigned int _bfd_elf_default_action_discarded + (struct bfd_section *); /* Return an upper bound on the number of bytes required to store a copy of ABFD's program header table entries. Return -1 if an error @@ -655,7 +700,7 @@ extern int bfd_get_elf_phdrs the remote memory. */ extern bfd *bfd_elf_bfd_from_remote_memory (bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep, - int (*target_read_memory) (bfd_vma vma, char *myaddr, int len)); + int (*target_read_memory) (bfd_vma vma, bfd_byte *myaddr, int len)); /* Return the arch_size field of an elf bfd, or -1 if not elf. */ extern int bfd_get_arch_size @@ -668,10 +713,20 @@ extern int bfd_get_sign_extend_vma extern struct bfd_section *_bfd_elf_tls_setup (bfd *, struct bfd_link_info *); +extern void _bfd_fix_excluded_sec_syms + (bfd *, struct bfd_link_info *); + +extern unsigned bfd_m68k_mach_to_features (int); + +extern int bfd_m68k_features_to_mach (unsigned); + extern bfd_boolean bfd_m68k_elf32_create_embedded_relocs - (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **); -extern bfd_boolean bfd_mips_elf32_create_embedded_relocs - (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **); + (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, + char **); + +extern bfd_boolean bfd_bfin_elf32_create_embedded_relocs + (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, + char **); /* SunOS shared library support routines for the linker. */ @@ -680,7 +735,8 @@ extern struct bfd_link_needed_list *bfd_sunos_get_needed_list extern bfd_boolean bfd_sunos_record_link_assignment (bfd *, struct bfd_link_info *, const char *); extern bfd_boolean bfd_sunos_size_dynamic_sections - (bfd *, struct bfd_link_info *, struct bfd_section **, struct bfd_section **, struct bfd_section **); + (bfd *, struct bfd_link_info *, struct bfd_section **, + struct bfd_section **, struct bfd_section **); /* Linux shared library support routines for the linker. */ @@ -788,12 +844,19 @@ extern bfd_boolean bfd_elf32_arm_allocate_interworking_sections extern bfd_boolean bfd_elf32_arm_process_before_allocation (bfd *, struct bfd_link_info *, int); +void bfd_elf32_arm_set_target_relocs + (struct bfd_link_info *, int, char *, int, int); + extern bfd_boolean bfd_elf32_arm_get_bfd_for_interworking (bfd *, struct bfd_link_info *); extern bfd_boolean bfd_elf32_arm_add_glue_sections_to_bfd (bfd *, struct bfd_link_info *); +/* ELF ARM mapping symbol support */ +extern bfd_boolean bfd_is_arm_mapping_symbol_name + (const char * name); + /* ARM Note section processing. */ extern bfd_boolean bfd_arm_merge_machines (bfd *, bfd *); @@ -822,3 +885,23 @@ extern void bfd_elf32_ia64_after_parse extern void bfd_elf64_ia64_after_parse (int); +/* This structure is used for a comdat section, as in PE. A comdat + section is associated with a particular symbol. When the linker + sees a comdat section, it keeps only one of the sections with a + given name and associated with a given symbol. */ + +struct coff_comdat_info +{ + /* The name of the symbol associated with a comdat section. */ + const char *name; + + /* The local symbol table index of the symbol associated with a + comdat section. This is only meaningful to the object file format + specific code; it is not an index into the list returned by + bfd_canonicalize_symtab. */ + long symbol; +}; + +extern struct coff_comdat_info *bfd_coff_get_comdat_section + (bfd *, struct bfd_section *); + diff --git a/contrib/binutils/bfd/bfd-in2.h b/contrib/binutils/bfd/bfd-in2.h index 91447a12cbb..ddcda2377df 100644 --- a/contrib/binutils/bfd/bfd-in2.h +++ b/contrib/binutils/bfd/bfd-in2.h @@ -97,14 +97,6 @@ typedef int bfd_boolean; #define FALSE 0 #define TRUE 1 -#if 0 -/* Poison. */ -#undef false -#undef true -#define false dont_use_false_in_bfd -#define true dont_use_true_in_bfd -#endif - #ifdef BFD64 #ifndef BFD_HOST_64_BIT @@ -152,6 +144,9 @@ typedef unsigned long bfd_size_type; #endif /* not BFD64 */ +#define HALF_BFD_SIZE_TYPE \ + (((bfd_size_type) 1) << (8 * sizeof (bfd_size_type) / 2)) + #ifndef BFD_HOST_64_BIT /* Fall back on a 32 bit type. The idea is to make these types always available for function return types, but in the case that @@ -246,6 +241,10 @@ bfd_format; /* The sections in this BFD specify a memory page. */ #define HAS_LOAD_PAGE 0x1000 + +/* This BFD has been created by the linker and doesn't correspond + to any input file. */ +#define BFD_LINKER_CREATED 0x2000 /* Symbols and relocation. */ @@ -316,7 +315,8 @@ typedef struct bfd_section *sec_ptr; #define bfd_get_section_lma(bfd, ptr) ((ptr)->lma + 0) #define bfd_get_section_alignment(bfd, ptr) ((ptr)->alignment_power + 0) #define bfd_section_name(bfd, ptr) ((ptr)->name) -#define bfd_section_size(bfd, ptr) (bfd_get_section_size_before_reloc(ptr)) +#define bfd_section_size(bfd, ptr) ((ptr)->size) +#define bfd_get_section_size(ptr) ((ptr)->size) #define bfd_section_vma(bfd, ptr) ((ptr)->vma) #define bfd_section_lma(bfd, ptr) ((ptr)->lma) #define bfd_section_alignment(bfd, ptr) ((ptr)->alignment_power) @@ -328,6 +328,10 @@ typedef struct bfd_section *sec_ptr; #define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = TRUE), TRUE) #define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),TRUE) #define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),TRUE) +/* Find the address one past the end of SEC. */ +#define bfd_get_section_limit(bfd, sec) \ + (((sec)->rawsize ? (sec)->rawsize : (sec)->size) \ + / bfd_octets_per_byte (bfd)) typedef struct stat stat_type; @@ -379,6 +383,8 @@ struct bfd_hash_table struct bfd_hash_entry **table; /* The number of slots in the hash table. */ unsigned int size; + /* The size of elements. */ + unsigned int entsize; /* A function used to create new elements in the hash table. The first entry is itself a pointer to an element. When this function is first invoked, this pointer will be NULL. However, @@ -398,7 +404,8 @@ extern bfd_boolean bfd_hash_table_init (struct bfd_hash_table *, struct bfd_hash_entry *(*) (struct bfd_hash_entry *, struct bfd_hash_table *, - const char *)); + const char *), + unsigned int); /* Initialize a hash table specifying a size. */ extern bfd_boolean bfd_hash_table_init_n @@ -406,7 +413,7 @@ extern bfd_boolean bfd_hash_table_init_n struct bfd_hash_entry *(*) (struct bfd_hash_entry *, struct bfd_hash_table *, const char *), - unsigned int size); + unsigned int, unsigned int); /* Free up a hash table. */ extern void bfd_hash_table_free @@ -441,6 +448,24 @@ extern void bfd_hash_traverse bfd_boolean (*) (struct bfd_hash_entry *, void *), void *info); +/* Allows the default size of a hash table to be configured. New hash + tables allocated using bfd_hash_table_init will be created with + this size. */ +extern void bfd_hash_set_default_size (bfd_size_type); + +/* This structure is used to keep track of stabs in sections + information while linking. */ + +struct stab_info +{ + /* A hash table used to hold stabs strings. */ + struct bfd_strtab_hash *strings; + /* The header file hash table. */ + struct bfd_hash_table includes; + /* The first .stabstr section. */ + struct bfd_section *stabstr; +}; + #define COFF_SWAP_TABLE (void *) &bfd_coff_std_swap_table /* User program access to BFD facilities. */ @@ -513,6 +538,8 @@ extern bfd_boolean bfd_cache_close (bfd *abfd); /* NB: This declaration should match the autogenerated one in libbfd.h. */ +extern bfd_boolean bfd_cache_close_all (void); + extern bfd_boolean bfd_record_phdr (bfd *, unsigned long, bfd_boolean, flagword, bfd_boolean, bfd_vma, bfd_boolean, bfd_boolean, unsigned int, struct bfd_section **); @@ -542,6 +569,9 @@ void bfd_putl16 (bfd_vma, void *); bfd_uint64_t bfd_get_bits (const void *, int, bfd_boolean); void bfd_put_bits (bfd_uint64_t, void *, int, bfd_boolean); + +extern bfd_boolean bfd_section_already_linked_table_init (void); +extern void bfd_section_already_linked_table_free (void); /* Externally visible ECOFF routines. */ @@ -595,8 +625,6 @@ extern bfd_boolean bfd_ecoff_write_accumulated_debug (void *handle, bfd *abfd, struct ecoff_debug_info *debug, const struct ecoff_debug_swap *swap, struct bfd_link_info *info, file_ptr where); -extern bfd_boolean bfd_mips_ecoff_create_embedded_relocs - (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **); /* Externally visible ELF routines. */ @@ -610,28 +638,44 @@ struct bfd_link_needed_list enum dynamic_lib_link_class { DYN_NORMAL = 0, DYN_AS_NEEDED = 1, - DYN_DT_NEEDED = 2 + DYN_DT_NEEDED = 2, + DYN_NO_ADD_NEEDED = 4, + DYN_NO_NEEDED = 8 +}; + +enum notice_asneeded_action { + notice_as_needed, + notice_not_needed, + notice_needed }; extern bfd_boolean bfd_elf_record_link_assignment - (bfd *, struct bfd_link_info *, const char *, bfd_boolean); + (bfd *, struct bfd_link_info *, const char *, bfd_boolean, + bfd_boolean); extern struct bfd_link_needed_list *bfd_elf_get_needed_list (bfd *, struct bfd_link_info *); extern bfd_boolean bfd_elf_get_bfd_needed_list (bfd *, struct bfd_link_needed_list **); extern bfd_boolean bfd_elf_size_dynamic_sections (bfd *, const char *, const char *, const char *, const char * const *, - struct bfd_link_info *, struct bfd_section **, struct bfd_elf_version_tree *); + struct bfd_link_info *, struct bfd_section **, + struct bfd_elf_version_tree *); +extern bfd_boolean bfd_elf_size_dynsym_hash_dynstr + (bfd *, struct bfd_link_info *); extern void bfd_elf_set_dt_needed_name (bfd *, const char *); extern const char *bfd_elf_get_dt_soname (bfd *); extern void bfd_elf_set_dyn_lib_class (bfd *, int); +extern int bfd_elf_get_dyn_lib_class + (bfd *); extern struct bfd_link_needed_list *bfd_elf_get_runpath_list (bfd *, struct bfd_link_info *); extern bfd_boolean bfd_elf_discard_info (bfd *, struct bfd_link_info *); +extern unsigned int _bfd_elf_default_action_discarded + (struct bfd_section *); /* Return an upper bound on the number of bytes required to store a copy of ABFD's program header table entries. Return -1 if an error @@ -663,7 +707,7 @@ extern int bfd_get_elf_phdrs the remote memory. */ extern bfd *bfd_elf_bfd_from_remote_memory (bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep, - int (*target_read_memory) (bfd_vma vma, char *myaddr, int len)); + int (*target_read_memory) (bfd_vma vma, bfd_byte *myaddr, int len)); /* Return the arch_size field of an elf bfd, or -1 if not elf. */ extern int bfd_get_arch_size @@ -676,10 +720,20 @@ extern int bfd_get_sign_extend_vma extern struct bfd_section *_bfd_elf_tls_setup (bfd *, struct bfd_link_info *); +extern void _bfd_fix_excluded_sec_syms + (bfd *, struct bfd_link_info *); + +extern unsigned bfd_m68k_mach_to_features (int); + +extern int bfd_m68k_features_to_mach (unsigned); + extern bfd_boolean bfd_m68k_elf32_create_embedded_relocs - (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **); -extern bfd_boolean bfd_mips_elf32_create_embedded_relocs - (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **); + (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, + char **); + +extern bfd_boolean bfd_bfin_elf32_create_embedded_relocs + (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, + char **); /* SunOS shared library support routines for the linker. */ @@ -688,7 +742,8 @@ extern struct bfd_link_needed_list *bfd_sunos_get_needed_list extern bfd_boolean bfd_sunos_record_link_assignment (bfd *, struct bfd_link_info *, const char *); extern bfd_boolean bfd_sunos_size_dynamic_sections - (bfd *, struct bfd_link_info *, struct bfd_section **, struct bfd_section **, struct bfd_section **); + (bfd *, struct bfd_link_info *, struct bfd_section **, + struct bfd_section **, struct bfd_section **); /* Linux shared library support routines for the linker. */ @@ -796,12 +851,19 @@ extern bfd_boolean bfd_elf32_arm_allocate_interworking_sections extern bfd_boolean bfd_elf32_arm_process_before_allocation (bfd *, struct bfd_link_info *, int); +void bfd_elf32_arm_set_target_relocs + (struct bfd_link_info *, int, char *, int, int); + extern bfd_boolean bfd_elf32_arm_get_bfd_for_interworking (bfd *, struct bfd_link_info *); extern bfd_boolean bfd_elf32_arm_add_glue_sections_to_bfd (bfd *, struct bfd_link_info *); +/* ELF ARM mapping symbol support */ +extern bfd_boolean bfd_is_arm_mapping_symbol_name + (const char * name); + /* ARM Note section processing. */ extern bfd_boolean bfd_arm_merge_machines (bfd *, bfd *); @@ -830,16 +892,51 @@ extern void bfd_elf32_ia64_after_parse extern void bfd_elf64_ia64_after_parse (int); +/* This structure is used for a comdat section, as in PE. A comdat + section is associated with a particular symbol. When the linker + sees a comdat section, it keeps only one of the sections with a + given name and associated with a given symbol. */ + +struct coff_comdat_info +{ + /* The name of the symbol associated with a comdat section. */ + const char *name; + + /* The local symbol table index of the symbol associated with a + comdat section. This is only meaningful to the object file format + specific code; it is not an index into the list returned by + bfd_canonicalize_symtab. */ + long symbol; +}; + +extern struct coff_comdat_info *bfd_coff_get_comdat_section + (bfd *, struct bfd_section *); + /* Extracted from init.c. */ void bfd_init (void); /* Extracted from opncls.c. */ +bfd *bfd_fopen (const char *filename, const char *target, + const char *mode, int fd); + bfd *bfd_openr (const char *filename, const char *target); bfd *bfd_fdopenr (const char *filename, const char *target, int fd); bfd *bfd_openstreamr (const char *, const char *, void *); +bfd *bfd_openr_iovec (const char *filename, const char *target, + void *(*open) (struct bfd *nbfd, + void *open_closure), + void *open_closure, + file_ptr (*pread) (struct bfd *nbfd, + void *stream, + void *buf, + file_ptr nbytes, + file_ptr offset), + int (*close) (struct bfd *nbfd, + void *stream)); + bfd *bfd_openw (const char *filename, const char *target); bfd_boolean bfd_close (bfd *abfd); @@ -983,23 +1080,6 @@ long bfd_get_size (bfd *abfd); /* Extracted from bfdwin.c. */ /* Extracted from section.c. */ -/* This structure is used for a comdat section, as in PE. A comdat - section is associated with a particular symbol. When the linker - sees a comdat section, it keeps only one of the sections with a - given name and associated with a given symbol. */ - -struct bfd_comdat_info -{ - /* The name of the symbol associated with a comdat section. */ - const char *name; - - /* The local symbol table index of the symbol associated with a - comdat section. This is only meaningful to the object file format - specific code; it is not an index into the list returned by - bfd_canonicalize_symtab. */ - long symbol; -}; - typedef struct bfd_section { /* The name of the section; the name isn't a copy, the pointer is @@ -1015,6 +1095,9 @@ typedef struct bfd_section /* The next section in the list belonging to the BFD, or NULL. */ struct bfd_section *next; + /* The previous section in the list belonging to the BFD, or NULL. */ + struct bfd_section *prev; + /* The field flags contains attributes of the section. Some flags are read in from the object file, and some are synthesized from other information. */ @@ -1034,23 +1117,17 @@ typedef struct bfd_section some relocation information too. */ #define SEC_RELOC 0x004 - /* ELF reserves 4 processor specific bits and 8 operating system - specific bits in sh_flags; at present we can get away with just - one in communicating between the assembler and BFD, but this - isn't a good long-term solution. */ -#define SEC_ARCH_BIT_0 0x008 - /* A signal to the OS that the section contains read only data. */ -#define SEC_READONLY 0x010 +#define SEC_READONLY 0x008 /* The section contains code only. */ -#define SEC_CODE 0x020 +#define SEC_CODE 0x010 /* The section contains data only. */ -#define SEC_DATA 0x040 +#define SEC_DATA 0x020 /* The section will reside in ROM. */ -#define SEC_ROM 0x080 +#define SEC_ROM 0x040 /* The section contains constructor information. This section type is used by the linker to create lists of constructors and @@ -1062,16 +1139,110 @@ typedef struct bfd_section sections called <<__CTOR_LIST__>> and relocate the data contained within - exactly the operations it would peform on standard data. */ -#define SEC_CONSTRUCTOR 0x100 +#define SEC_CONSTRUCTOR 0x080 /* The section has contents - a data section could be <> | <>; a debug section could be <> */ -#define SEC_HAS_CONTENTS 0x200 +#define SEC_HAS_CONTENTS 0x100 /* An instruction to the linker to not output the section even if it has information which would normally be written. */ -#define SEC_NEVER_LOAD 0x400 +#define SEC_NEVER_LOAD 0x200 + + /* The section contains thread local data. */ +#define SEC_THREAD_LOCAL 0x400 + + /* The section has GOT references. This flag is only for the + linker, and is currently only used by the elf32-hppa back end. + It will be set if global offset table references were detected + in this section, which indicate to the linker that the section + contains PIC code, and must be handled specially when doing a + static link. */ +#define SEC_HAS_GOT_REF 0x800 + + /* The section contains common symbols (symbols may be defined + multiple times, the value of a symbol is the amount of + space it requires, and the largest symbol value is the one + used). Most targets have exactly one of these (which we + translate to bfd_com_section_ptr), but ECOFF has two. */ +#define SEC_IS_COMMON 0x1000 + + /* The section contains only debugging information. For + example, this is set for ELF .debug and .stab sections. + strip tests this flag to see if a section can be + discarded. */ +#define SEC_DEBUGGING 0x2000 + + /* The contents of this section are held in memory pointed to + by the contents field. This is checked by bfd_get_section_contents, + and the data is retrieved from memory if appropriate. */ +#define SEC_IN_MEMORY 0x4000 + + /* The contents of this section are to be excluded by the + linker for executable and shared objects unless those + objects are to be further relocated. */ +#define SEC_EXCLUDE 0x8000 + + /* The contents of this section are to be sorted based on the sum of + the symbol and addend values specified by the associated relocation + entries. Entries without associated relocation entries will be + appended to the end of the section in an unspecified order. */ +#define SEC_SORT_ENTRIES 0x10000 + + /* When linking, duplicate sections of the same name should be + discarded, rather than being combined into a single section as + is usually done. This is similar to how common symbols are + handled. See SEC_LINK_DUPLICATES below. */ +#define SEC_LINK_ONCE 0x20000 + + /* If SEC_LINK_ONCE is set, this bitfield describes how the linker + should handle duplicate sections. */ +#define SEC_LINK_DUPLICATES 0x40000 + + /* This value for SEC_LINK_DUPLICATES means that duplicate + sections with the same name should simply be discarded. */ +#define SEC_LINK_DUPLICATES_DISCARD 0x0 + + /* This value for SEC_LINK_DUPLICATES means that the linker + should warn if there are any duplicate sections, although + it should still only link one copy. */ +#define SEC_LINK_DUPLICATES_ONE_ONLY 0x80000 + + /* This value for SEC_LINK_DUPLICATES means that the linker + should warn if any duplicate sections are a different size. */ +#define SEC_LINK_DUPLICATES_SAME_SIZE 0x100000 + + /* This value for SEC_LINK_DUPLICATES means that the linker + should warn if any duplicate sections contain different + contents. */ +#define SEC_LINK_DUPLICATES_SAME_CONTENTS \ + (SEC_LINK_DUPLICATES_ONE_ONLY | SEC_LINK_DUPLICATES_SAME_SIZE) + + /* This section was created by the linker as part of dynamic + relocation or other arcane processing. It is skipped when + going through the first-pass output, trusting that someone + else up the line will take care of it later. */ +#define SEC_LINKER_CREATED 0x200000 + + /* This section should not be subject to garbage collection. */ +#define SEC_KEEP 0x400000 + + /* This section contains "short" data, and should be placed + "near" the GP. */ +#define SEC_SMALL_DATA 0x800000 + + /* Attempt to merge identical entities in the section. + Entity size is given in the entsize field. */ +#define SEC_MERGE 0x1000000 + + /* If given with SEC_MERGE, entities to merge are zero terminated + strings where entsize specifies character size instead of fixed + size entries. */ +#define SEC_STRINGS 0x2000000 + + /* This section contains data about section groups. */ +#define SEC_GROUP 0x4000000 /* The section is a COFF shared library section. This flag is only for the linker. If this type of section appears in @@ -1082,114 +1253,23 @@ typedef struct bfd_section might be cleaner to have some more general mechanism to allow the back end to control what the linker does with sections. */ -#define SEC_COFF_SHARED_LIBRARY 0x800 - - /* The section contains thread local data. */ -#define SEC_THREAD_LOCAL 0x1000 - - /* The section has GOT references. This flag is only for the - linker, and is currently only used by the elf32-hppa back end. - It will be set if global offset table references were detected - in this section, which indicate to the linker that the section - contains PIC code, and must be handled specially when doing a - static link. */ -#define SEC_HAS_GOT_REF 0x4000 - - /* The section contains common symbols (symbols may be defined - multiple times, the value of a symbol is the amount of - space it requires, and the largest symbol value is the one - used). Most targets have exactly one of these (which we - translate to bfd_com_section_ptr), but ECOFF has two. */ -#define SEC_IS_COMMON 0x8000 - - /* The section contains only debugging information. For - example, this is set for ELF .debug and .stab sections. - strip tests this flag to see if a section can be - discarded. */ -#define SEC_DEBUGGING 0x10000 - - /* The contents of this section are held in memory pointed to - by the contents field. This is checked by bfd_get_section_contents, - and the data is retrieved from memory if appropriate. */ -#define SEC_IN_MEMORY 0x20000 - - /* The contents of this section are to be excluded by the - linker for executable and shared objects unless those - objects are to be further relocated. */ -#define SEC_EXCLUDE 0x40000 - - /* The contents of this section are to be sorted based on the sum of - the symbol and addend values specified by the associated relocation - entries. Entries without associated relocation entries will be - appended to the end of the section in an unspecified order. */ -#define SEC_SORT_ENTRIES 0x80000 - - /* When linking, duplicate sections of the same name should be - discarded, rather than being combined into a single section as - is usually done. This is similar to how common symbols are - handled. See SEC_LINK_DUPLICATES below. */ -#define SEC_LINK_ONCE 0x100000 - - /* If SEC_LINK_ONCE is set, this bitfield describes how the linker - should handle duplicate sections. */ -#define SEC_LINK_DUPLICATES 0x600000 - - /* This value for SEC_LINK_DUPLICATES means that duplicate - sections with the same name should simply be discarded. */ -#define SEC_LINK_DUPLICATES_DISCARD 0x0 - - /* This value for SEC_LINK_DUPLICATES means that the linker - should warn if there are any duplicate sections, although - it should still only link one copy. */ -#define SEC_LINK_DUPLICATES_ONE_ONLY 0x200000 - - /* This value for SEC_LINK_DUPLICATES means that the linker - should warn if any duplicate sections are a different size. */ -#define SEC_LINK_DUPLICATES_SAME_SIZE 0x400000 - - /* This value for SEC_LINK_DUPLICATES means that the linker - should warn if any duplicate sections contain different - contents. */ -#define SEC_LINK_DUPLICATES_SAME_CONTENTS 0x600000 - - /* This section was created by the linker as part of dynamic - relocation or other arcane processing. It is skipped when - going through the first-pass output, trusting that someone - else up the line will take care of it later. */ -#define SEC_LINKER_CREATED 0x800000 - - /* This section should not be subject to garbage collection. */ -#define SEC_KEEP 0x1000000 - - /* This section contains "short" data, and should be placed - "near" the GP. */ -#define SEC_SMALL_DATA 0x2000000 +#define SEC_COFF_SHARED_LIBRARY 0x10000000 /* This section contains data which may be shared with other - executables or shared objects. */ -#define SEC_SHARED 0x4000000 + executables or shared objects. This is for COFF only. */ +#define SEC_COFF_SHARED 0x20000000 /* When a section with this flag is being linked, then if the size of the input section is less than a page, it should not cross a page - boundary. If the size of the input section is one page or more, it - should be aligned on a page boundary. */ -#define SEC_BLOCK 0x8000000 + boundary. If the size of the input section is one page or more, + it should be aligned on a page boundary. This is for TI + TMS320C54X only. */ +#define SEC_TIC54X_BLOCK 0x40000000 /* Conditionally link this section; do not link if there are no - references found to any symbol in the section. */ -#define SEC_CLINK 0x10000000 - - /* Attempt to merge identical entities in the section. - Entity size is given in the entsize field. */ -#define SEC_MERGE 0x20000000 - - /* If given with SEC_MERGE, entities to merge are zero terminated - strings where entsize specifies character size instead of fixed - size entries. */ -#define SEC_STRINGS 0x40000000 - - /* This section contains data about section groups. */ -#define SEC_GROUP 0x80000000 + references found to any symbol in the section. This is for TI + TMS320C54X only. */ +#define SEC_TIC54X_CLINK 0x80000000 /* End of section flags. */ @@ -1198,9 +1278,6 @@ typedef struct bfd_section /* See the vma field. */ unsigned int user_set_vma : 1; - /* Whether relocations have been processed. */ - unsigned int reloc_done : 1; - /* A mark flag used by some of the linker backends. */ unsigned int linker_mark : 1; @@ -1208,8 +1285,9 @@ typedef struct bfd_section output sections that have an input section. */ unsigned int linker_has_input : 1; - /* A mark flag used by some linker backends for garbage collection. */ + /* Mark flags used by some linker backends for garbage collection. */ unsigned int gc_mark : 1; + unsigned int gc_mark_from_eh : 1; /* The following flags are used by the ELF linker. */ @@ -1227,22 +1305,20 @@ typedef struct bfd_section /* Nonzero if this section uses RELA relocations, rather than REL. */ unsigned int use_rela_p:1; - /* Bits used by various backends. */ - unsigned int has_tls_reloc:1; + /* Bits used by various backends. The generic code doesn't touch + these fields. */ - /* Nonzero if this section needs the relax finalize pass. */ - unsigned int need_finalize_relax:1; + /* Nonzero if this section has TLS related relocations. */ + unsigned int has_tls_reloc:1; /* Nonzero if this section has a gp reloc. */ unsigned int has_gp_reloc:1; - /* Unused bits. */ - unsigned int flag13:1; - unsigned int flag14:1; - unsigned int flag15:1; - unsigned int flag16:4; - unsigned int flag20:4; - unsigned int flag24:8; + /* Nonzero if this section needs the relax finalize pass. */ + unsigned int need_finalize_relax:1; + + /* Whether relocations have been processed. */ + unsigned int reloc_done : 1; /* End of internal packed boolean fields. */ @@ -1261,13 +1337,18 @@ typedef struct bfd_section /* The size of the section in octets, as it will be output. Contains a value even if the section has no contents (e.g., the - size of <<.bss>>). This will be filled in after relocation. */ - bfd_size_type _cooked_size; + size of <<.bss>>). */ + bfd_size_type size; - /* The original size on disk of the section, in octets. Normally this - value is the same as the size, but if some relaxing has - been done, then this value will be bigger. */ - bfd_size_type _raw_size; + /* For input sections, the original size on disk of the section, in + octets. This field is used by the linker relaxation code. It is + currently only set for sections where the linker relaxation scheme + doesn't cache altered section and reloc contents (stabs, eh_frame, + SEC_MERGE, some coff relaxing targets), and thus the original size + needs to be kept to read the section multiple times. + For output sections, rawsize holds the section size calculated on + a previous linker relaxation pass. */ + bfd_size_type rawsize; /* If this section is going to be output, then this value is the offset in *bytes* into the output section of the first byte in the @@ -1324,9 +1405,6 @@ typedef struct bfd_section /* Entity size for merging purposes. */ unsigned int entsize; - /* Optional information about a COMDAT entry; NULL if not COMDAT. */ - struct bfd_comdat_info *comdat; - /* Points to the kept section if this section is a link-once section, and is discarded. */ struct bfd_section *kept_section; @@ -1351,8 +1429,14 @@ typedef struct bfd_section struct bfd_symbol *symbol; struct bfd_symbol **symbol_ptr_ptr; - struct bfd_link_order *link_order_head; - struct bfd_link_order *link_order_tail; + /* Early in the link process, map_head and map_tail are used to build + a list of input sections attached to an output section. Later, + output sections use these fields for a list of bfd_link_order + structs. */ + union { + struct bfd_link_order *link_order; + struct bfd_section *s; + } map_head, map_tail; } asection; /* These sections are global, and are managed by BFD. The application @@ -1391,48 +1475,161 @@ extern const struct bfd_symbol * const bfd_abs_symbol; extern const struct bfd_symbol * const bfd_com_symbol; extern const struct bfd_symbol * const bfd_und_symbol; extern const struct bfd_symbol * const bfd_ind_symbol; -#define bfd_get_section_size_before_reloc(section) \ - ((section)->_raw_size) -#define bfd_get_section_size_after_reloc(section) \ - ((section)->reloc_done ? (section)->_cooked_size \ - : (abort (), (bfd_size_type) 1)) /* Macros to handle insertion and deletion of a bfd's sections. These only handle the list pointers, ie. do not adjust section_count, target_index etc. */ -#define bfd_section_list_remove(ABFD, PS) \ +#define bfd_section_list_remove(ABFD, S) \ do \ { \ - asection **_ps = PS; \ - asection *_s = *_ps; \ - *_ps = _s->next; \ - if (_s->next == NULL) \ - (ABFD)->section_tail = _ps; \ - } \ - while (0) -#define bfd_section_list_insert(ABFD, PS, S) \ - do \ - { \ - asection **_ps = PS; \ asection *_s = S; \ - _s->next = *_ps; \ - *_ps = _s; \ - if (_s->next == NULL) \ - (ABFD)->section_tail = &_s->next; \ + asection *_next = _s->next; \ + asection *_prev = _s->prev; \ + if (_prev) \ + _prev->next = _next; \ + else \ + (ABFD)->sections = _next; \ + if (_next) \ + _next->prev = _prev; \ + else \ + (ABFD)->section_last = _prev; \ } \ while (0) +#define bfd_section_list_append(ABFD, S) \ + do \ + { \ + asection *_s = S; \ + bfd *_abfd = ABFD; \ + _s->next = NULL; \ + if (_abfd->section_last) \ + { \ + _s->prev = _abfd->section_last; \ + _abfd->section_last->next = _s; \ + } \ + else \ + { \ + _s->prev = NULL; \ + _abfd->sections = _s; \ + } \ + _abfd->section_last = _s; \ + } \ + while (0) +#define bfd_section_list_prepend(ABFD, S) \ + do \ + { \ + asection *_s = S; \ + bfd *_abfd = ABFD; \ + _s->prev = NULL; \ + if (_abfd->sections) \ + { \ + _s->next = _abfd->sections; \ + _abfd->sections->prev = _s; \ + } \ + else \ + { \ + _s->next = NULL; \ + _abfd->section_last = _s; \ + } \ + _abfd->sections = _s; \ + } \ + while (0) +#define bfd_section_list_insert_after(ABFD, A, S) \ + do \ + { \ + asection *_a = A; \ + asection *_s = S; \ + asection *_next = _a->next; \ + _s->next = _next; \ + _s->prev = _a; \ + _a->next = _s; \ + if (_next) \ + _next->prev = _s; \ + else \ + (ABFD)->section_last = _s; \ + } \ + while (0) +#define bfd_section_list_insert_before(ABFD, B, S) \ + do \ + { \ + asection *_b = B; \ + asection *_s = S; \ + asection *_prev = _b->prev; \ + _s->prev = _prev; \ + _s->next = _b; \ + _b->prev = _s; \ + if (_prev) \ + _prev->next = _s; \ + else \ + (ABFD)->sections = _s; \ + } \ + while (0) +#define bfd_section_removed_from_list(ABFD, S) \ + ((S)->next == NULL ? (ABFD)->section_last != (S) : (S)->next->prev != (S)) + +#define BFD_FAKE_SECTION(SEC, FLAGS, SYM, SYM_PTR, NAME, IDX) \ + /* name, id, index, next, prev, flags, user_set_vma, */ \ + { NAME, IDX, 0, NULL, NULL, FLAGS, 0, \ + \ + /* linker_mark, linker_has_input, gc_mark, gc_mark_from_eh, */ \ + 0, 0, 1, 0, \ + \ + /* segment_mark, sec_info_type, use_rela_p, has_tls_reloc, */ \ + 0, 0, 0, 0, \ + \ + /* has_gp_reloc, need_finalize_relax, reloc_done, */ \ + 0, 0, 0, \ + \ + /* vma, lma, size, rawsize */ \ + 0, 0, 0, 0, \ + \ + /* output_offset, output_section, alignment_power, */ \ + 0, (struct bfd_section *) &SEC, 0, \ + \ + /* relocation, orelocation, reloc_count, filepos, rel_filepos, */ \ + NULL, NULL, 0, 0, 0, \ + \ + /* line_filepos, userdata, contents, lineno, lineno_count, */ \ + 0, NULL, NULL, NULL, 0, \ + \ + /* entsize, kept_section, moving_line_filepos, */ \ + 0, NULL, 0, \ + \ + /* target_index, used_by_bfd, constructor_chain, owner, */ \ + 0, NULL, NULL, NULL, \ + \ + /* symbol, */ \ + (struct bfd_symbol *) SYM, \ + \ + /* symbol_ptr_ptr, */ \ + (struct bfd_symbol **) SYM_PTR, \ + \ + /* map_head, map_tail */ \ + { NULL }, { NULL } \ + } void bfd_section_list_clear (bfd *); asection *bfd_get_section_by_name (bfd *abfd, const char *name); +asection *bfd_get_section_by_name_if + (bfd *abfd, + const char *name, + bfd_boolean (*func) (bfd *abfd, asection *sect, void *obj), + void *obj); + char *bfd_get_unique_section_name (bfd *abfd, const char *templat, int *count); asection *bfd_make_section_old_way (bfd *abfd, const char *name); +asection *bfd_make_section_anyway_with_flags + (bfd *abfd, const char *name, flagword flags); + asection *bfd_make_section_anyway (bfd *abfd, const char *name); +asection *bfd_make_section_with_flags + (bfd *, const char *name, flagword flags); + asection *bfd_make_section (bfd *, const char *name); bfd_boolean bfd_set_section_flags @@ -1443,6 +1640,11 @@ void bfd_map_over_sections void (*func) (bfd *abfd, asection *sect, void *obj), void *obj); +asection *bfd_sections_find_if + (bfd *abfd, + bfd_boolean (*operation) (bfd *abfd, asection *sect, void *obj), + void *obj); + bfd_boolean bfd_set_section_size (bfd *abfd, asection *sec, bfd_size_type val); @@ -1454,14 +1656,16 @@ bfd_boolean bfd_get_section_contents (bfd *abfd, asection *section, void *location, file_ptr offset, bfd_size_type count); +bfd_boolean bfd_malloc_and_get_section + (bfd *abfd, asection *section, bfd_byte **buf); + bfd_boolean bfd_copy_private_section_data (bfd *ibfd, asection *isec, bfd *obfd, asection *osec); #define bfd_copy_private_section_data(ibfd, isection, obfd, osection) \ BFD_SEND (obfd, _bfd_copy_private_section_data, \ (ibfd, isection, obfd, osection)) -void _bfd_strip_section_from_output - (struct bfd_link_info *info, asection *section); +bfd_boolean bfd_generic_is_group_section (bfd *, const asection *sec); bfd_boolean bfd_generic_discard_group (bfd *abfd, asection *group); @@ -1479,11 +1683,22 @@ enum bfd_architecture #define bfd_mach_m68040 6 #define bfd_mach_m68060 7 #define bfd_mach_cpu32 8 -#define bfd_mach_mcf5200 9 -#define bfd_mach_mcf5206e 10 -#define bfd_mach_mcf5307 11 -#define bfd_mach_mcf5407 12 -#define bfd_mach_mcf528x 13 +#define bfd_mach_mcf_isa_a_nodiv 9 +#define bfd_mach_mcf_isa_a 10 +#define bfd_mach_mcf_isa_a_mac 11 +#define bfd_mach_mcf_isa_a_emac 12 +#define bfd_mach_mcf_isa_aplus 13 +#define bfd_mach_mcf_isa_aplus_mac 14 +#define bfd_mach_mcf_isa_aplus_emac 15 +#define bfd_mach_mcf_isa_b_nousp 16 +#define bfd_mach_mcf_isa_b_nousp_mac 17 +#define bfd_mach_mcf_isa_b_nousp_emac 18 +#define bfd_mach_mcf_isa_b 19 +#define bfd_mach_mcf_isa_b_mac 20 +#define bfd_mach_mcf_isa_b_emac 21 +#define bfd_mach_mcf_isa_b_float 22 +#define bfd_mach_mcf_isa_b_float_mac 23 +#define bfd_mach_mcf_isa_b_float_emac 24 bfd_arch_vax, /* DEC Vax */ bfd_arch_i960, /* Intel 960 */ /* The order of the following is important. @@ -1505,7 +1720,6 @@ enum bfd_architecture bfd_arch_or32, /* OpenRISC 32 */ - bfd_arch_a29k, /* AMD 29000 */ bfd_arch_sparc, /* SPARC */ #define bfd_mach_sparc 1 /* The difference between v8plus and v9 is that v9 is a true 64 bit env. */ @@ -1522,6 +1736,9 @@ enum bfd_architecture #define bfd_mach_sparc_v9_p(mach) \ ((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9b \ && (mach) != bfd_mach_sparc_sparclite_le) +/* Nonzero if MACH is a 64 bit sparc architecture. */ +#define bfd_mach_sparc_64bit_p(mach) \ + ((mach) >= bfd_mach_sparc_v9 && (mach) != bfd_mach_sparc_v8plusb) bfd_arch_mips, /* MIPS Rxxxx */ #define bfd_mach_mips3000 3000 #define bfd_mach_mips3900 3900 @@ -1540,6 +1757,7 @@ enum bfd_architecture #define bfd_mach_mips6000 6000 #define bfd_mach_mips7000 7000 #define bfd_mach_mips8000 8000 +#define bfd_mach_mips9000 9000 #define bfd_mach_mips10000 10000 #define bfd_mach_mips12000 12000 #define bfd_mach_mips16 16 @@ -1560,7 +1778,6 @@ enum bfd_architecture bfd_arch_i860, /* Intel 860 */ bfd_arch_i370, /* IBM 360/370 Mainframes */ bfd_arch_romp, /* IBM ROMP PC/RT */ - bfd_arch_alliant, /* Alliant */ bfd_arch_convex, /* Convex */ bfd_arch_m88k, /* Motorola 88xxx */ bfd_arch_m98k, /* Motorola 98xxx */ @@ -1623,12 +1840,20 @@ enum bfd_architecture #define bfd_mach_sh 1 #define bfd_mach_sh2 0x20 #define bfd_mach_sh_dsp 0x2d +#define bfd_mach_sh2a 0x2a +#define bfd_mach_sh2a_nofpu 0x2b +#define bfd_mach_sh2a_nofpu_or_sh4_nommu_nofpu 0x2a1 +#define bfd_mach_sh2a_nofpu_or_sh3_nommu 0x2a2 +#define bfd_mach_sh2a_or_sh4 0x2a3 +#define bfd_mach_sh2a_or_sh3e 0x2a4 #define bfd_mach_sh2e 0x2e #define bfd_mach_sh3 0x30 +#define bfd_mach_sh3_nommu 0x31 #define bfd_mach_sh3_dsp 0x3d #define bfd_mach_sh3e 0x3e #define bfd_mach_sh4 0x40 #define bfd_mach_sh4_nofpu 0x41 +#define bfd_mach_sh4_nommu_nofpu 0x42 #define bfd_mach_sh4a 0x4a #define bfd_mach_sh4a_nofpu 0x4b #define bfd_mach_sh4al_dsp 0x4d @@ -1668,6 +1893,9 @@ enum bfd_architecture #define bfd_mach_arc_6 6 #define bfd_mach_arc_7 7 #define bfd_mach_arc_8 8 + bfd_arch_m32c, /* Renesas M16C/M32C. */ +#define bfd_mach_m16c 0x75 +#define bfd_mach_m32c 0x78 bfd_arch_m32r, /* Renesas M32R (formerly Mitsubishi M32R/D) */ #define bfd_mach_m32r 1 /* For backwards compatibility. */ #define bfd_mach_m32rx 'x' @@ -1684,6 +1912,7 @@ enum bfd_architecture #define bfd_mach_frvsimple 2 #define bfd_mach_fr300 300 #define bfd_mach_fr400 400 +#define bfd_mach_fr450 450 #define bfd_mach_frvtomcat 499 /* fr500 prototype */ #define bfd_mach_fr500 500 #define bfd_mach_fr550 550 @@ -1697,6 +1926,10 @@ enum bfd_architecture bfd_arch_iq2000, /* Vitesse IQ2000. */ #define bfd_mach_iq2000 1 #define bfd_mach_iq10 2 + bfd_arch_mt, +#define bfd_mach_ms1 1 +#define bfd_mach_mrisc2 2 +#define bfd_mach_ms2 3 bfd_arch_pj, bfd_arch_avr, /* Atmel AVR microcontrollers. */ #define bfd_mach_avr1 1 @@ -1704,7 +1937,16 @@ enum bfd_architecture #define bfd_mach_avr3 3 #define bfd_mach_avr4 4 #define bfd_mach_avr5 5 + bfd_arch_bfin, /* ADI Blackfin */ +#define bfd_mach_bfin 1 + bfd_arch_cr16c, /* National Semiconductor CompactRISC. */ +#define bfd_mach_cr16c 1 + bfd_arch_crx, /* National Semiconductor CRX. */ +#define bfd_mach_crx 1 bfd_arch_cris, /* Axis CRIS */ +#define bfd_mach_cris_v0_v10 255 +#define bfd_mach_cris_v32 32 +#define bfd_mach_cris_v10_v32 1032 bfd_arch_s390, /* IBM s390 */ #define bfd_mach_s390_31 31 #define bfd_mach_s390_64 64 @@ -1719,7 +1961,8 @@ enum bfd_architecture #define bfd_mach_msp13 13 #define bfd_mach_msp14 14 #define bfd_mach_msp15 15 -#define bfd_mach_msp16 16 +#define bfd_mach_msp16 16 +#define bfd_mach_msp21 21 #define bfd_mach_msp31 31 #define bfd_mach_msp32 32 #define bfd_mach_msp33 33 @@ -1727,8 +1970,20 @@ enum bfd_architecture #define bfd_mach_msp42 42 #define bfd_mach_msp43 43 #define bfd_mach_msp44 44 + bfd_arch_xc16x, /* Infineon's XC16X Series. */ +#define bfd_mach_xc16x 1 +#define bfd_mach_xc16xl 2 +#define bfd_mach_xc16xs 3 bfd_arch_xtensa, /* Tensilica's Xtensa cores. */ #define bfd_mach_xtensa 1 + bfd_arch_maxq, /* Dallas MAXQ 10/20 */ +#define bfd_mach_maxq10 10 +#define bfd_mach_maxq20 20 + bfd_arch_z80, +#define bfd_mach_z80strict 1 /* No undocumented opcodes. */ +#define bfd_mach_z80 3 /* With ixl, ixh, iyl, and iyh. */ +#define bfd_mach_z80full 7 /* All undocumented instructions. */ +#define bfd_mach_r800 11 /* R800: successor with multiplication. */ bfd_arch_last }; @@ -1842,11 +2097,12 @@ enum complain_overflow /* Do not complain on overflow. */ complain_overflow_dont, - /* Complain if the bitfield overflows, whether it is considered - as signed or unsigned. */ + /* Complain if the value overflows when considered as a signed + number one bit larger than the field. ie. A bitfield of N bits + is allowed to represent -2**n to 2**n-1. */ complain_overflow_bitfield, - /* Complain if the value overflows when considered as signed + /* Complain if the value overflows when considered as a signed number. */ complain_overflow_signed, @@ -2024,6 +2280,9 @@ The 24-bit relocation is used in some Intel 960 configurations. */ BFD_RELOC_12_PCREL, BFD_RELOC_8_PCREL, +/* Section relative relocations. Some targets need this for DWARF2. */ + BFD_RELOC_32_SECREL, + /* For ELF. */ BFD_RELOC_32_GOT_PCREL, BFD_RELOC_16_GOT_PCREL, @@ -2274,11 +2533,26 @@ to compensate for the borrow when the low bits are added. */ /* Low 16 bits. */ BFD_RELOC_LO16, -/* Like BFD_RELOC_HI16_S, but PC relative. */ - BFD_RELOC_PCREL_HI16_S, +/* High 16 bits of 32-bit pc-relative value */ + BFD_RELOC_HI16_PCREL, -/* Like BFD_RELOC_LO16, but PC relative. */ - BFD_RELOC_PCREL_LO16, +/* High 16 bits of 32-bit pc-relative value, adjusted */ + BFD_RELOC_HI16_S_PCREL, + +/* Low 16 bits of pc-relative value */ + BFD_RELOC_LO16_PCREL, + +/* MIPS16 high 16 bits of 32-bit value. */ + BFD_RELOC_MIPS16_HI16, + +/* MIPS16 high 16 bits of 32-bit value but the low 16 bits will be sign +extended and added to form the final result. If the low 16 +bits form a negative number, we need to add one to the high value +to compensate for the borrow when the low bits are added. */ + BFD_RELOC_MIPS16_HI16_S, + +/* MIPS16 low 16 bits. */ + BFD_RELOC_MIPS16_LO16, /* Relocation against a MIPS literal section. */ BFD_RELOC_MIPS_LITERAL, @@ -2305,6 +2579,24 @@ to compensate for the borrow when the low bits are added. */ BFD_RELOC_MIPS_REL16, BFD_RELOC_MIPS_RELGOT, BFD_RELOC_MIPS_JALR, + BFD_RELOC_MIPS_TLS_DTPMOD32, + BFD_RELOC_MIPS_TLS_DTPREL32, + BFD_RELOC_MIPS_TLS_DTPMOD64, + BFD_RELOC_MIPS_TLS_DTPREL64, + BFD_RELOC_MIPS_TLS_GD, + BFD_RELOC_MIPS_TLS_LDM, + BFD_RELOC_MIPS_TLS_DTPREL_HI16, + BFD_RELOC_MIPS_TLS_DTPREL_LO16, + BFD_RELOC_MIPS_TLS_GOTTPREL, + BFD_RELOC_MIPS_TLS_TPREL32, + BFD_RELOC_MIPS_TLS_TPREL64, + BFD_RELOC_MIPS_TLS_TPREL_HI16, + BFD_RELOC_MIPS_TLS_TPREL_LO16, + + +/* MIPS ELF relocations (VxWorks extensions). */ + BFD_RELOC_MIPS_COPY, + BFD_RELOC_MIPS_JUMP_SLOT, /* Fujitsu Frv Relocations. */ @@ -2331,6 +2623,22 @@ to compensate for the borrow when the low bits are added. */ BFD_RELOC_FRV_GOTOFF12, BFD_RELOC_FRV_GOTOFFHI, BFD_RELOC_FRV_GOTOFFLO, + BFD_RELOC_FRV_GETTLSOFF, + BFD_RELOC_FRV_TLSDESC_VALUE, + BFD_RELOC_FRV_GOTTLSDESC12, + BFD_RELOC_FRV_GOTTLSDESCHI, + BFD_RELOC_FRV_GOTTLSDESCLO, + BFD_RELOC_FRV_TLSMOFF12, + BFD_RELOC_FRV_TLSMOFFHI, + BFD_RELOC_FRV_TLSMOFFLO, + BFD_RELOC_FRV_GOTTLSOFF12, + BFD_RELOC_FRV_GOTTLSOFFHI, + BFD_RELOC_FRV_GOTTLSOFFLO, + BFD_RELOC_FRV_TLSOFF, + BFD_RELOC_FRV_TLSDESC_RELAX, + BFD_RELOC_FRV_GETTLSOFF_RELAX, + BFD_RELOC_FRV_TLSOFF_RELAX, + BFD_RELOC_FRV_TLSMOFF, /* This is a 24bit GOT-relative reloc for the mn10300. */ @@ -2382,6 +2690,9 @@ in the instruction. */ BFD_RELOC_386_TLS_DTPMOD32, BFD_RELOC_386_TLS_DTPOFF32, BFD_RELOC_386_TLS_TPOFF32, + BFD_RELOC_386_TLS_GOTDESC, + BFD_RELOC_386_TLS_DESC_CALL, + BFD_RELOC_386_TLS_DESC, /* x86-64/elf relocations */ BFD_RELOC_X86_64_GOT32, @@ -2400,6 +2711,16 @@ in the instruction. */ BFD_RELOC_X86_64_DTPOFF32, BFD_RELOC_X86_64_GOTTPOFF, BFD_RELOC_X86_64_TPOFF32, + BFD_RELOC_X86_64_GOTOFF64, + BFD_RELOC_X86_64_GOTPC32, + BFD_RELOC_X86_64_GOT64, + BFD_RELOC_X86_64_GOTPCREL64, + BFD_RELOC_X86_64_GOTPC64, + BFD_RELOC_X86_64_GOTPLT64, + BFD_RELOC_X86_64_PLTOFF64, + BFD_RELOC_X86_64_GOTPC32_TLSDESC, + BFD_RELOC_X86_64_TLSDESC_CALL, + BFD_RELOC_X86_64_TLSDESC, /* ns32k relocations */ BFD_RELOC_NS32K_IMM_8, @@ -2546,39 +2867,105 @@ not stored in the instruction. The 2nd lowest bit comes from a 1 bit field in the instruction. */ BFD_RELOC_THUMB_PCREL_BLX, -/* These relocs are only used within the ARM assembler. They are not -(at present) written to any object files. */ - BFD_RELOC_ARM_IMMEDIATE, - BFD_RELOC_ARM_ADRL_IMMEDIATE, +/* ARM 26-bit pc-relative branch for an unconditional BL or BLX instruction. */ + BFD_RELOC_ARM_PCREL_CALL, + +/* ARM 26-bit pc-relative branch for B or conditional BL instruction. */ + BFD_RELOC_ARM_PCREL_JUMP, + +/* Thumb 7-, 9-, 12-, 20-, 23-, and 25-bit pc-relative branches. +The lowest bit must be zero and is not stored in the instruction. +Note that the corresponding ELF R_ARM_THM_JUMPnn constant has an +"nn" one smaller in all cases. Note further that BRANCH23 +corresponds to R_ARM_THM_CALL. */ + BFD_RELOC_THUMB_PCREL_BRANCH7, + BFD_RELOC_THUMB_PCREL_BRANCH9, + BFD_RELOC_THUMB_PCREL_BRANCH12, + BFD_RELOC_THUMB_PCREL_BRANCH20, + BFD_RELOC_THUMB_PCREL_BRANCH23, + BFD_RELOC_THUMB_PCREL_BRANCH25, + +/* 12-bit immediate offset, used in ARM-format ldr and str instructions. */ BFD_RELOC_ARM_OFFSET_IMM, - BFD_RELOC_ARM_SHIFT_IMM, - BFD_RELOC_ARM_SWI, - BFD_RELOC_ARM_MULTI, - BFD_RELOC_ARM_CP_OFF_IMM, - BFD_RELOC_ARM_CP_OFF_IMM_S2, - BFD_RELOC_ARM_ADR_IMM, - BFD_RELOC_ARM_LDR_IMM, - BFD_RELOC_ARM_LITERAL, - BFD_RELOC_ARM_IN_POOL, - BFD_RELOC_ARM_OFFSET_IMM8, - BFD_RELOC_ARM_HWLITERAL, - BFD_RELOC_ARM_THUMB_ADD, - BFD_RELOC_ARM_THUMB_IMM, - BFD_RELOC_ARM_THUMB_SHIFT, + +/* 5-bit immediate offset, used in Thumb-format ldr and str instructions. */ BFD_RELOC_ARM_THUMB_OFFSET, - BFD_RELOC_ARM_GOT12, - BFD_RELOC_ARM_GOT32, + +/* Pc-relative or absolute relocation depending on target. Used for +entries in .init_array sections. */ + BFD_RELOC_ARM_TARGET1, + +/* Read-only segment base relative address. */ + BFD_RELOC_ARM_ROSEGREL32, + +/* Data segment base relative address. */ + BFD_RELOC_ARM_SBREL32, + +/* This reloc is used for references to RTTI data from exception handling +tables. The actual definition depends on the target. It may be a +pc-relative or some form of GOT-indirect relocation. */ + BFD_RELOC_ARM_TARGET2, + +/* 31-bit PC relative address. */ + BFD_RELOC_ARM_PREL31, + +/* Relocations for setting up GOTs and PLTs for shared libraries. */ BFD_RELOC_ARM_JUMP_SLOT, - BFD_RELOC_ARM_COPY, BFD_RELOC_ARM_GLOB_DAT, + BFD_RELOC_ARM_GOT32, BFD_RELOC_ARM_PLT32, BFD_RELOC_ARM_RELATIVE, BFD_RELOC_ARM_GOTOFF, BFD_RELOC_ARM_GOTPC, +/* ARM thread-local storage relocations. */ + BFD_RELOC_ARM_TLS_GD32, + BFD_RELOC_ARM_TLS_LDO32, + BFD_RELOC_ARM_TLS_LDM32, + BFD_RELOC_ARM_TLS_DTPOFF32, + BFD_RELOC_ARM_TLS_DTPMOD32, + BFD_RELOC_ARM_TLS_TPOFF32, + BFD_RELOC_ARM_TLS_IE32, + BFD_RELOC_ARM_TLS_LE32, + +/* These relocs are only used within the ARM assembler. They are not +(at present) written to any object files. */ + BFD_RELOC_ARM_IMMEDIATE, + BFD_RELOC_ARM_ADRL_IMMEDIATE, + BFD_RELOC_ARM_T32_IMMEDIATE, + BFD_RELOC_ARM_T32_IMM12, + BFD_RELOC_ARM_T32_ADD_PC12, + BFD_RELOC_ARM_SHIFT_IMM, + BFD_RELOC_ARM_SMC, + BFD_RELOC_ARM_SWI, + BFD_RELOC_ARM_MULTI, + BFD_RELOC_ARM_CP_OFF_IMM, + BFD_RELOC_ARM_CP_OFF_IMM_S2, + BFD_RELOC_ARM_T32_CP_OFF_IMM, + BFD_RELOC_ARM_T32_CP_OFF_IMM_S2, + BFD_RELOC_ARM_ADR_IMM, + BFD_RELOC_ARM_LDR_IMM, + BFD_RELOC_ARM_LITERAL, + BFD_RELOC_ARM_IN_POOL, + BFD_RELOC_ARM_OFFSET_IMM8, + BFD_RELOC_ARM_T32_OFFSET_U8, + BFD_RELOC_ARM_T32_OFFSET_IMM, + BFD_RELOC_ARM_HWLITERAL, + BFD_RELOC_ARM_THUMB_ADD, + BFD_RELOC_ARM_THUMB_IMM, + BFD_RELOC_ARM_THUMB_SHIFT, + /* Renesas / SuperH SH relocs. Not all of these appear in object files. */ BFD_RELOC_SH_PCDISP8BY2, BFD_RELOC_SH_PCDISP12BY2, + BFD_RELOC_SH_IMM3, + BFD_RELOC_SH_IMM3U, + BFD_RELOC_SH_DISP12, + BFD_RELOC_SH_DISP12BY2, + BFD_RELOC_SH_DISP12BY4, + BFD_RELOC_SH_DISP12BY8, + BFD_RELOC_SH_DISP20, + BFD_RELOC_SH_DISP20BY8, BFD_RELOC_SH_IMM4, BFD_RELOC_SH_IMM4BY2, BFD_RELOC_SH_IMM4BY4, @@ -2660,12 +3047,6 @@ field in the instruction. */ BFD_RELOC_SH_TLS_DTPOFF32, BFD_RELOC_SH_TLS_TPOFF32, -/* Thumb 23-, 12- and 9-bit pc-relative branches. The lowest bit must -be zero and is not stored in the instruction. */ - BFD_RELOC_THUMB_PCREL_BRANCH9, - BFD_RELOC_THUMB_PCREL_BRANCH12, - BFD_RELOC_THUMB_PCREL_BRANCH23, - /* ARC Cores relocs. ARC 22 bit pc-relative branch. The lowest two bits must be zero and are not stored in the instruction. The high 20 bits are installed in bits 26 @@ -2677,6 +3058,121 @@ stored in the instruction. The high 24 bits are installed in bits 23 through 0. */ BFD_RELOC_ARC_B26, +/* ADI Blackfin 16 bit immediate absolute reloc. */ + BFD_RELOC_BFIN_16_IMM, + +/* ADI Blackfin 16 bit immediate absolute reloc higher 16 bits. */ + BFD_RELOC_BFIN_16_HIGH, + +/* ADI Blackfin 'a' part of LSETUP. */ + BFD_RELOC_BFIN_4_PCREL, + +/* ADI Blackfin. */ + BFD_RELOC_BFIN_5_PCREL, + +/* ADI Blackfin 16 bit immediate absolute reloc lower 16 bits. */ + BFD_RELOC_BFIN_16_LOW, + +/* ADI Blackfin. */ + BFD_RELOC_BFIN_10_PCREL, + +/* ADI Blackfin 'b' part of LSETUP. */ + BFD_RELOC_BFIN_11_PCREL, + +/* ADI Blackfin. */ + BFD_RELOC_BFIN_12_PCREL_JUMP, + +/* ADI Blackfin Short jump, pcrel. */ + BFD_RELOC_BFIN_12_PCREL_JUMP_S, + +/* ADI Blackfin Call.x not implemented. */ + BFD_RELOC_BFIN_24_PCREL_CALL_X, + +/* ADI Blackfin Long Jump pcrel. */ + BFD_RELOC_BFIN_24_PCREL_JUMP_L, + +/* ADI Blackfin FD-PIC relocations. */ + BFD_RELOC_BFIN_GOT17M4, + BFD_RELOC_BFIN_GOTHI, + BFD_RELOC_BFIN_GOTLO, + BFD_RELOC_BFIN_FUNCDESC, + BFD_RELOC_BFIN_FUNCDESC_GOT17M4, + BFD_RELOC_BFIN_FUNCDESC_GOTHI, + BFD_RELOC_BFIN_FUNCDESC_GOTLO, + BFD_RELOC_BFIN_FUNCDESC_VALUE, + BFD_RELOC_BFIN_FUNCDESC_GOTOFF17M4, + BFD_RELOC_BFIN_FUNCDESC_GOTOFFHI, + BFD_RELOC_BFIN_FUNCDESC_GOTOFFLO, + BFD_RELOC_BFIN_GOTOFF17M4, + BFD_RELOC_BFIN_GOTOFFHI, + BFD_RELOC_BFIN_GOTOFFLO, + +/* ADI Blackfin GOT relocation. */ + BFD_RELOC_BFIN_GOT, + +/* ADI Blackfin PLTPC relocation. */ + BFD_RELOC_BFIN_PLTPC, + +/* ADI Blackfin arithmetic relocation. */ + BFD_ARELOC_BFIN_PUSH, + +/* ADI Blackfin arithmetic relocation. */ + BFD_ARELOC_BFIN_CONST, + +/* ADI Blackfin arithmetic relocation. */ + BFD_ARELOC_BFIN_ADD, + +/* ADI Blackfin arithmetic relocation. */ + BFD_ARELOC_BFIN_SUB, + +/* ADI Blackfin arithmetic relocation. */ + BFD_ARELOC_BFIN_MULT, + +/* ADI Blackfin arithmetic relocation. */ + BFD_ARELOC_BFIN_DIV, + +/* ADI Blackfin arithmetic relocation. */ + BFD_ARELOC_BFIN_MOD, + +/* ADI Blackfin arithmetic relocation. */ + BFD_ARELOC_BFIN_LSHIFT, + +/* ADI Blackfin arithmetic relocation. */ + BFD_ARELOC_BFIN_RSHIFT, + +/* ADI Blackfin arithmetic relocation. */ + BFD_ARELOC_BFIN_AND, + +/* ADI Blackfin arithmetic relocation. */ + BFD_ARELOC_BFIN_OR, + +/* ADI Blackfin arithmetic relocation. */ + BFD_ARELOC_BFIN_XOR, + +/* ADI Blackfin arithmetic relocation. */ + BFD_ARELOC_BFIN_LAND, + +/* ADI Blackfin arithmetic relocation. */ + BFD_ARELOC_BFIN_LOR, + +/* ADI Blackfin arithmetic relocation. */ + BFD_ARELOC_BFIN_LEN, + +/* ADI Blackfin arithmetic relocation. */ + BFD_ARELOC_BFIN_NEG, + +/* ADI Blackfin arithmetic relocation. */ + BFD_ARELOC_BFIN_COMP, + +/* ADI Blackfin arithmetic relocation. */ + BFD_ARELOC_BFIN_PAGE, + +/* ADI Blackfin arithmetic relocation. */ + BFD_ARELOC_BFIN_HWPAGE, + +/* ADI Blackfin arithmetic relocation. */ + BFD_ARELOC_BFIN_ADDR, + /* Mitsubishi D10V relocs. This is a 10-bit reloc with the right 2 bits assumed to be 0. */ @@ -2754,6 +3250,12 @@ of the container. */ /* DLX relocs */ BFD_RELOC_DLX_JMP26, +/* Renesas M16C/M32C Relocations. */ + BFD_RELOC_M32C_HI8, + BFD_RELOC_M32C_RL_JUMP, + BFD_RELOC_M32C_RL_1ADDR, + BFD_RELOC_M32C_RL_2ADDR, + /* Renesas M32R (formerly Mitsubishi M32R) relocs. This is a 24 bit absolute address. */ BFD_RELOC_M32R_24, @@ -2790,6 +3292,9 @@ add3, load, and store instructions. */ BFD_RELOC_M32R_JMP_SLOT, BFD_RELOC_M32R_RELATIVE, BFD_RELOC_M32R_GOTOFF, + BFD_RELOC_M32R_GOTOFF_HI_ULO, + BFD_RELOC_M32R_GOTOFF_HI_SLO, + BFD_RELOC_M32R_GOTOFF_LO, BFD_RELOC_M32R_GOTPC24, BFD_RELOC_M32R_GOT16_HI_ULO, BFD_RELOC_M32R_GOT16_HI_SLO, @@ -2862,6 +3367,10 @@ bits placed non-contiguously in the instruction. */ /* Used to maintain alignment whilst relaxing. */ BFD_RELOC_V850_ALIGN, +/* This is a variation of BFD_RELOC_LO16 that can be used in v850e ld.bu +instructions. */ + BFD_RELOC_V850_LO16_SPLIT_OFFSET, + /* This is a 32bit pcrel reloc for the mn10300, offset by two bytes in the instruction. */ BFD_RELOC_MN10300_32_PCREL, @@ -3010,6 +3519,10 @@ of data memory address) into 8 bit immediate value of LDI insn. */ of program memory address) into 8 bit immediate value of LDI insn. */ BFD_RELOC_AVR_HH8_LDI, +/* This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit +of 32 bit value) into 8 bit immediate value of LDI insn. */ + BFD_RELOC_AVR_MS8_LDI, + /* This is a 16 bit reloc for the AVR that stores negated 8 bit value (usually data memory address) into 8 bit immediate value of SUBI insn. */ BFD_RELOC_AVR_LO8_LDI_NEG, @@ -3024,6 +3537,10 @@ SUBI insn. */ of LDI or SUBI insn. */ BFD_RELOC_AVR_HH8_LDI_NEG, +/* This is a 16 bit reloc for the AVR that stores negated 8 bit value (msb +of 32 bit value) into 8 bit immediate value of LDI insn. */ + BFD_RELOC_AVR_MS8_LDI_NEG, + /* This is a 16 bit reloc for the AVR that stores 8 bit value (usually command address) into 8 bit immediate value of LDI insn. */ BFD_RELOC_AVR_LO8_LDI_PM, @@ -3054,6 +3571,18 @@ value of SUBI insn. */ into 22 bits. */ BFD_RELOC_AVR_CALL, +/* This is a 16 bit reloc for the AVR that stores all needed bits +for absolute addressing with ldi with overflow check to linktime */ + BFD_RELOC_AVR_LDI, + +/* This is a 6 bit reloc for the AVR that stores offset for ldd/std +instructions */ + BFD_RELOC_AVR_6, + +/* This is a 6 bit reloc for the AVR that stores offset for adiw/sbiw +instructions */ + BFD_RELOC_AVR_6_ADIW, + /* Direct 12 bit. */ BFD_RELOC_390_12, @@ -3342,12 +3871,81 @@ to follow the 16K memory bank of 68HC12 (seen as mapped in the window). */ This is the 5 bits of a value. */ BFD_RELOC_M68HC12_5B, +/* NS CR16C Relocations. */ + BFD_RELOC_16C_NUM08, + BFD_RELOC_16C_NUM08_C, + BFD_RELOC_16C_NUM16, + BFD_RELOC_16C_NUM16_C, + BFD_RELOC_16C_NUM32, + BFD_RELOC_16C_NUM32_C, + BFD_RELOC_16C_DISP04, + BFD_RELOC_16C_DISP04_C, + BFD_RELOC_16C_DISP08, + BFD_RELOC_16C_DISP08_C, + BFD_RELOC_16C_DISP16, + BFD_RELOC_16C_DISP16_C, + BFD_RELOC_16C_DISP24, + BFD_RELOC_16C_DISP24_C, + BFD_RELOC_16C_DISP24a, + BFD_RELOC_16C_DISP24a_C, + BFD_RELOC_16C_REG04, + BFD_RELOC_16C_REG04_C, + BFD_RELOC_16C_REG04a, + BFD_RELOC_16C_REG04a_C, + BFD_RELOC_16C_REG14, + BFD_RELOC_16C_REG14_C, + BFD_RELOC_16C_REG16, + BFD_RELOC_16C_REG16_C, + BFD_RELOC_16C_REG20, + BFD_RELOC_16C_REG20_C, + BFD_RELOC_16C_ABS20, + BFD_RELOC_16C_ABS20_C, + BFD_RELOC_16C_ABS24, + BFD_RELOC_16C_ABS24_C, + BFD_RELOC_16C_IMM04, + BFD_RELOC_16C_IMM04_C, + BFD_RELOC_16C_IMM16, + BFD_RELOC_16C_IMM16_C, + BFD_RELOC_16C_IMM20, + BFD_RELOC_16C_IMM20_C, + BFD_RELOC_16C_IMM24, + BFD_RELOC_16C_IMM24_C, + BFD_RELOC_16C_IMM32, + BFD_RELOC_16C_IMM32_C, + +/* NS CRX Relocations. */ + BFD_RELOC_CRX_REL4, + BFD_RELOC_CRX_REL8, + BFD_RELOC_CRX_REL8_CMP, + BFD_RELOC_CRX_REL16, + BFD_RELOC_CRX_REL24, + BFD_RELOC_CRX_REL32, + BFD_RELOC_CRX_REGREL12, + BFD_RELOC_CRX_REGREL22, + BFD_RELOC_CRX_REGREL28, + BFD_RELOC_CRX_REGREL32, + BFD_RELOC_CRX_ABS16, + BFD_RELOC_CRX_ABS32, + BFD_RELOC_CRX_NUM8, + BFD_RELOC_CRX_NUM16, + BFD_RELOC_CRX_NUM32, + BFD_RELOC_CRX_IMM16, + BFD_RELOC_CRX_IMM32, + BFD_RELOC_CRX_SWITCH8, + BFD_RELOC_CRX_SWITCH16, + BFD_RELOC_CRX_SWITCH32, + /* These relocs are only used within the CRIS assembler. They are not (at present) written to any object files. */ BFD_RELOC_CRIS_BDISP8, BFD_RELOC_CRIS_UNSIGNED_5, BFD_RELOC_CRIS_SIGNED_6, BFD_RELOC_CRIS_UNSIGNED_6, + BFD_RELOC_CRIS_SIGNED_8, + BFD_RELOC_CRIS_UNSIGNED_8, + BFD_RELOC_CRIS_SIGNED_16, + BFD_RELOC_CRIS_UNSIGNED_16, + BFD_RELOC_CRIS_LAPCQ_OFFSET, BFD_RELOC_CRIS_UNSIGNED_4, /* Relocs used in ELF shared libraries for CRIS. */ @@ -3428,17 +4026,43 @@ This is the 5 bits of a value. */ BFD_RELOC_XSTORMY16_24, BFD_RELOC_XSTORMY16_FPTR16, +/* Infineon Relocations. */ + BFD_RELOC_XC16X_PAG, + BFD_RELOC_XC16X_POF, + BFD_RELOC_XC16X_SEG, + BFD_RELOC_XC16X_SOF, + /* Relocations used by VAX ELF. */ BFD_RELOC_VAX_GLOB_DAT, BFD_RELOC_VAX_JMP_SLOT, BFD_RELOC_VAX_RELATIVE, +/* Morpho MT - 16 bit immediate relocation. */ + BFD_RELOC_MT_PC16, + +/* Morpho MT - Hi 16 bits of an address. */ + BFD_RELOC_MT_HI16, + +/* Morpho MT - Low 16 bits of an address. */ + BFD_RELOC_MT_LO16, + +/* Morpho MT - Used to tell the linker which vtable entries are used. */ + BFD_RELOC_MT_GNU_VTINHERIT, + +/* Morpho MT - Used to tell the linker which vtable entries are used. */ + BFD_RELOC_MT_GNU_VTENTRY, + +/* Morpho MT - 8 bit immediate relocation. */ + BFD_RELOC_MT_PCINSN8, + /* msp430 specific relocation codes */ BFD_RELOC_MSP430_10_PCREL, BFD_RELOC_MSP430_16_PCREL, BFD_RELOC_MSP430_16, BFD_RELOC_MSP430_16_PCREL_BYTE, BFD_RELOC_MSP430_16_BYTE, + BFD_RELOC_MSP430_2X_PCREL, + BFD_RELOC_MSP430_RL_PCREL, /* IQ2000 Relocations. */ BFD_RELOC_IQ2000_OFFSET_16, @@ -3459,23 +4083,82 @@ to one of its own internal functions or data structures. */ PLT entries. Otherwise, this is just a generic 32-bit relocation. */ BFD_RELOC_XTENSA_PLT, -/* Generic Xtensa relocations. Only the operand number is encoded -in the relocation. The details are determined by extracting the -instruction opcode. */ +/* Xtensa relocations to mark the difference of two local symbols. +These are only needed to support linker relaxation and can be ignored +when not relaxing. The field is set to the value of the difference +assuming no relaxation. The relocation encodes the position of the +first symbol so the linker can determine whether to adjust the field +value. */ + BFD_RELOC_XTENSA_DIFF8, + BFD_RELOC_XTENSA_DIFF16, + BFD_RELOC_XTENSA_DIFF32, + +/* Generic Xtensa relocations for instruction operands. Only the slot +number is encoded in the relocation. The relocation applies to the +last PC-relative immediate operand, or if there are no PC-relative +immediates, to the last immediate operand. */ + BFD_RELOC_XTENSA_SLOT0_OP, + BFD_RELOC_XTENSA_SLOT1_OP, + BFD_RELOC_XTENSA_SLOT2_OP, + BFD_RELOC_XTENSA_SLOT3_OP, + BFD_RELOC_XTENSA_SLOT4_OP, + BFD_RELOC_XTENSA_SLOT5_OP, + BFD_RELOC_XTENSA_SLOT6_OP, + BFD_RELOC_XTENSA_SLOT7_OP, + BFD_RELOC_XTENSA_SLOT8_OP, + BFD_RELOC_XTENSA_SLOT9_OP, + BFD_RELOC_XTENSA_SLOT10_OP, + BFD_RELOC_XTENSA_SLOT11_OP, + BFD_RELOC_XTENSA_SLOT12_OP, + BFD_RELOC_XTENSA_SLOT13_OP, + BFD_RELOC_XTENSA_SLOT14_OP, + +/* Alternate Xtensa relocations. Only the slot is encoded in the +relocation. The meaning of these relocations is opcode-specific. */ + BFD_RELOC_XTENSA_SLOT0_ALT, + BFD_RELOC_XTENSA_SLOT1_ALT, + BFD_RELOC_XTENSA_SLOT2_ALT, + BFD_RELOC_XTENSA_SLOT3_ALT, + BFD_RELOC_XTENSA_SLOT4_ALT, + BFD_RELOC_XTENSA_SLOT5_ALT, + BFD_RELOC_XTENSA_SLOT6_ALT, + BFD_RELOC_XTENSA_SLOT7_ALT, + BFD_RELOC_XTENSA_SLOT8_ALT, + BFD_RELOC_XTENSA_SLOT9_ALT, + BFD_RELOC_XTENSA_SLOT10_ALT, + BFD_RELOC_XTENSA_SLOT11_ALT, + BFD_RELOC_XTENSA_SLOT12_ALT, + BFD_RELOC_XTENSA_SLOT13_ALT, + BFD_RELOC_XTENSA_SLOT14_ALT, + +/* Xtensa relocations for backward compatibility. These have all been +replaced by BFD_RELOC_XTENSA_SLOT0_OP. */ BFD_RELOC_XTENSA_OP0, BFD_RELOC_XTENSA_OP1, BFD_RELOC_XTENSA_OP2, -/* Xtensa relocation to mark that the assembler expanded the +/* Xtensa relocation to mark that the assembler expanded the instructions from an original target. The expansion size is encoded in the reloc size. */ BFD_RELOC_XTENSA_ASM_EXPAND, -/* Xtensa relocation to mark that the linker should simplify -assembler-expanded instructions. This is commonly used -internally by the linker after analysis of a +/* Xtensa relocation to mark that the linker should simplify +assembler-expanded instructions. This is commonly used +internally by the linker after analysis of a BFD_RELOC_XTENSA_ASM_EXPAND. */ BFD_RELOC_XTENSA_ASM_SIMPLIFY, + +/* 8 bit signed offset in (ix+d) or (iy+d). */ + BFD_RELOC_Z80_DISP8, + +/* DJNZ offset. */ + BFD_RELOC_Z8K_DISP7, + +/* CALR offset. */ + BFD_RELOC_Z8K_CALLR, + +/* 4 bit value. */ + BFD_RELOC_Z8K_IMM4L, BFD_RELOC_UNUSED }; typedef enum bfd_reloc_code_real bfd_reloc_code_real_type; reloc_howto_type *bfd_reloc_type_lookup @@ -3619,6 +4302,11 @@ bfd_boolean bfd_is_local_label_name (bfd *abfd, const char *name); #define bfd_is_local_label_name(abfd, name) \ BFD_SEND (abfd, _bfd_is_local_label_name, (abfd, name)) +bfd_boolean bfd_is_target_special_symbol (bfd *abfd, asymbol *sym); + +#define bfd_is_target_special_symbol(abfd, sym) \ + BFD_SEND (abfd, _bfd_is_target_special_symbol, (abfd, sym)) + #define bfd_canonicalize_symtab(abfd, location) \ BFD_SEND (abfd, _bfd_canonicalize_symtab, (abfd, location)) @@ -3660,14 +4348,10 @@ struct bfd /* A pointer to the target jump table. */ const struct bfd_target *xvec; - /* To avoid dragging too many header files into every file that - includes `<>', IOSTREAM has been declared as a "char *", - and MTIME as a "long". Their correct types, to which they - are cast when used, are "FILE *" and "time_t". The iostream - is the result of an fopen on the filename. However, if the - BFD_IN_MEMORY flag is set, then iostream is actually a pointer - to a bfd_in_memory struct. */ + /* The IOSTREAM, and corresponding IO vector that provide access + to the file backing the BFD. */ void *iostream; + const struct bfd_iovec *iovec; /* Is the file descriptor being cached? That is, can it be closed as needed, and re-opened when accessed later? */ @@ -3730,8 +4414,8 @@ struct bfd /* Pointer to linked list of sections. */ struct bfd_section *sections; - /* The place where we add to the section list. */ - struct bfd_section **section_tail; + /* The last section on the section list. */ + struct bfd_section *section_last; /* The number of sections. */ unsigned int section_count; @@ -3752,6 +4436,9 @@ struct bfd /* Pointer to structure which contains architecture information. */ const struct bfd_arch_info *arch_info; + /* Flag set if symbols from this BFD should not be exported. */ + bfd_boolean no_export; + /* Stuff only useful for archives. */ void *arelt_data; struct bfd *my_archive; /* The containing archive BFD. */ @@ -3857,8 +4544,6 @@ void bfd_set_error_program_name (const char *); bfd_error_handler_type bfd_get_error_handler (void); -const char *bfd_archive_filename (bfd *); - long bfd_get_reloc_upper_bound (bfd *abfd, asection *sect); long bfd_canonicalize_reloc @@ -3881,6 +4566,11 @@ void bfd_set_gp_size (bfd *abfd, unsigned int i); bfd_vma bfd_scan_vma (const char *string, const char **end, int base); +bfd_boolean bfd_copy_private_header_data (bfd *ibfd, bfd *obfd); + +#define bfd_copy_private_header_data(ibfd, obfd) \ + BFD_SEND (obfd, _bfd_copy_private_header_data, \ + (ibfd, obfd)) bfd_boolean bfd_copy_private_bfd_data (bfd *ibfd, bfd *obfd); #define bfd_copy_private_bfd_data(ibfd, obfd) \ @@ -3902,6 +4592,14 @@ bfd_boolean bfd_set_private_flags (bfd *abfd, flagword flags); BFD_SEND (abfd, _bfd_find_nearest_line, \ (abfd, sec, syms, off, file, func, line)) +#define bfd_find_line(abfd, syms, sym, file, line) \ + BFD_SEND (abfd, _bfd_find_line, \ + (abfd, syms, sym, file, line)) + +#define bfd_find_inliner_info(abfd, file, func, line) \ + BFD_SEND (abfd, _bfd_find_inliner_info, \ + (abfd, file, func, line)) + #define bfd_debug_info_start(abfd) \ BFD_SEND (abfd, _bfd_debug_info_start, (abfd)) @@ -3929,6 +4627,9 @@ bfd_boolean bfd_set_private_flags (bfd *abfd, flagword flags); #define bfd_merge_sections(abfd, link_info) \ BFD_SEND (abfd, _bfd_merge_sections, (abfd, link_info)) +#define bfd_is_group_section(abfd, sec) \ + BFD_SEND (abfd, _bfd_is_group_section, (abfd, sec)) + #define bfd_discard_group(abfd, sec) \ BFD_SEND (abfd, _bfd_discard_group, (abfd, sec)) @@ -3941,7 +4642,7 @@ bfd_boolean bfd_set_private_flags (bfd *abfd, flagword flags); #define bfd_link_add_symbols(abfd, info) \ BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info)) -#define bfd_link_just_syms(sec, info) \ +#define bfd_link_just_syms(abfd, sec, info) \ BFD_SEND (abfd, _bfd_link_just_syms, (sec, info)) #define bfd_final_link(abfd, info) \ @@ -3959,6 +4660,10 @@ bfd_boolean bfd_set_private_flags (bfd *abfd, flagword flags); #define bfd_canonicalize_dynamic_symtab(abfd, asymbols) \ BFD_SEND (abfd, _bfd_canonicalize_dynamic_symtab, (abfd, asymbols)) +#define bfd_get_synthetic_symtab(abfd, count, syms, dyncount, dynsyms, ret) \ + BFD_SEND (abfd, _bfd_get_synthetic_symtab, (abfd, count, syms, \ + dyncount, dynsyms, ret)) + #define bfd_get_dynamic_reloc_upper_bound(abfd) \ BFD_SEND (abfd, _bfd_get_dynamic_reloc_upper_bound, (abfd)) @@ -3978,7 +4683,7 @@ struct bfd_preserve flagword flags; const struct bfd_arch_info *arch_info; struct bfd_section *sections; - struct bfd_section **section_tail; + struct bfd_section *section_last; unsigned int section_count; struct bfd_hash_table section_htab; }; @@ -4005,6 +4710,9 @@ int bfd_core_file_failing_signal (bfd *abfd); bfd_boolean core_file_matches_executable_p (bfd *core_bfd, bfd *exec_bfd); +bfd_boolean generic_core_file_matches_executable_p + (bfd *core_bfd, bfd *exec_bfd); + /* Extracted from targets.c. */ #define BFD_SEND(bfd, message, arglist) \ ((*((bfd)->xvec->message)) arglist) @@ -4093,7 +4801,7 @@ typedef struct bfd_target unsigned short ar_max_namelen; /* Entries for byte swapping for data. These are different from the - other entry points, since they don't take a BFD asthe first argument. + other entry points, since they don't take a BFD as the first argument. Certain other handlers could do the same. */ bfd_uint64_t (*bfd_getx64) (const void *); bfd_int64_t (*bfd_getx_signed_64) (const void *); @@ -4153,8 +4861,10 @@ typedef struct bfd_target #define BFD_JUMP_TABLE_COPY(NAME) \ NAME##_bfd_copy_private_bfd_data, \ NAME##_bfd_merge_private_bfd_data, \ + _bfd_generic_init_private_section_data, \ NAME##_bfd_copy_private_section_data, \ NAME##_bfd_copy_private_symbol_data, \ + NAME##_bfd_copy_private_header_data, \ NAME##_bfd_set_private_flags, \ NAME##_bfd_print_private_bfd_data @@ -4164,6 +4874,12 @@ typedef struct bfd_target /* Called to merge BFD general private data from one object file to a common output file when linking. */ bfd_boolean (*_bfd_merge_private_bfd_data) (bfd *, bfd *); + /* Called to initialize BFD private section data from one object file + to another. */ +#define bfd_init_private_section_data(ibfd, isec, obfd, osec, link_info) \ + BFD_SEND (obfd, _bfd_init_private_section_data, (ibfd, isec, obfd, osec, link_info)) + bfd_boolean (*_bfd_init_private_section_data) + (bfd *, sec_ptr, bfd *, sec_ptr, struct bfd_link_info *); /* Called to copy BFD private section data from one object file to another. */ bfd_boolean (*_bfd_copy_private_section_data) @@ -4172,6 +4888,10 @@ typedef struct bfd_target to another. */ bfd_boolean (*_bfd_copy_private_symbol_data) (bfd *, asymbol *, bfd *, asymbol *); + /* Called to copy BFD private header data from one object file + to another. */ + bfd_boolean (*_bfd_copy_private_header_data) + (bfd *, bfd *); /* Called to set private backend flags. */ bfd_boolean (*_bfd_set_private_flags) (bfd *, flagword); @@ -4223,8 +4943,11 @@ typedef struct bfd_target NAME##_print_symbol, \ NAME##_get_symbol_info, \ NAME##_bfd_is_local_label_name, \ + NAME##_bfd_is_target_special_symbol, \ NAME##_get_lineno, \ NAME##_find_nearest_line, \ + _bfd_generic_find_line, \ + NAME##_find_inliner_info, \ NAME##_bfd_make_debug_symbol, \ NAME##_read_minisymbols, \ NAME##_minisymbol_to_symbol @@ -4241,11 +4964,16 @@ typedef struct bfd_target (bfd *, struct bfd_symbol *, symbol_info *); #define bfd_get_symbol_info(b,p,e) BFD_SEND (b, _bfd_get_symbol_info, (b,p,e)) bfd_boolean (*_bfd_is_local_label_name) (bfd *, const char *); - + bfd_boolean (*_bfd_is_target_special_symbol) (bfd *, asymbol *); alent * (*_get_lineno) (bfd *, struct bfd_symbol *); bfd_boolean (*_bfd_find_nearest_line) (bfd *, struct bfd_section *, struct bfd_symbol **, bfd_vma, const char **, const char **, unsigned int *); + bfd_boolean (*_bfd_find_line) + (bfd *, struct bfd_symbol **, struct bfd_symbol *, + const char **, unsigned int *); + bfd_boolean (*_bfd_find_inliner_info) + (bfd *, const char **, const char **, unsigned int *); /* Back-door to allow format-aware applications to create debug symbols while using BFD for everything else. Currently used by the assembler when creating COFF files. */ @@ -4296,7 +5024,9 @@ typedef struct bfd_target NAME##_bfd_link_split_section, \ NAME##_bfd_gc_sections, \ NAME##_bfd_merge_sections, \ - NAME##_bfd_discard_group + NAME##_bfd_is_group_section, \ + NAME##_bfd_discard_group, \ + NAME##_section_already_linked \ int (*_bfd_sizeof_headers) (bfd *, bfd_boolean); bfd_byte * (*_bfd_get_relocated_section_contents) @@ -4333,13 +5063,21 @@ typedef struct bfd_target /* Attempt to merge SEC_MERGE sections. */ bfd_boolean (*_bfd_merge_sections) (bfd *, struct bfd_link_info *); + /* Is this section a member of a group? */ + bfd_boolean (*_bfd_is_group_section) (bfd *, const struct bfd_section *); + /* Discard members of a group. */ bfd_boolean (*_bfd_discard_group) (bfd *, struct bfd_section *); + /* Check if SEC has been already linked during a reloceatable or + final link. */ + void (*_section_already_linked) (bfd *, struct bfd_section *); + /* Routines to handle dynamic symbols and relocs. */ #define BFD_JUMP_TABLE_DYNAMIC(NAME) \ NAME##_get_dynamic_symtab_upper_bound, \ NAME##_canonicalize_dynamic_symtab, \ + NAME##_get_synthetic_symtab, \ NAME##_get_dynamic_reloc_upper_bound, \ NAME##_canonicalize_dynamic_reloc @@ -4348,6 +5086,10 @@ typedef struct bfd_target /* Read in the dynamic symbols. */ long (*_bfd_canonicalize_dynamic_symtab) (bfd *, struct bfd_symbol **); + /* Create synthetized symbols. */ + long (*_bfd_get_synthetic_symtab) + (bfd *, long, struct bfd_symbol **, long, struct bfd_symbol **, + struct bfd_symbol **); /* Get the amount of memory required to hold the dynamic relocs. */ long (*_bfd_get_dynamic_reloc_upper_bound) (bfd *); /* Read in the dynamic relocs. */ @@ -4389,6 +5131,11 @@ bfd_boolean bfd_link_split_section (bfd *abfd, asection *sec); #define bfd_link_split_section(abfd, sec) \ BFD_SEND (abfd, _bfd_link_split_section, (abfd, sec)) +void bfd_section_already_linked (bfd *abfd, asection *sec); + +#define bfd_section_already_linked(abfd, sec) \ + BFD_SEND (abfd, _section_already_linked, (abfd, sec)) + /* Extracted from simple.c. */ bfd_byte *bfd_simple_get_relocated_section_contents (bfd *abfd, asection *sec, bfd_byte *outbuf, asymbol **symbol_table); diff --git a/contrib/binutils/bfd/bfd.c b/contrib/binutils/bfd/bfd.c index 59e22aaed8d..733f6ee0272 100644 --- a/contrib/binutils/bfd/bfd.c +++ b/contrib/binutils/bfd/bfd.c @@ -1,6 +1,6 @@ /* Generic BFD library interface and support routines. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003 + 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Written by Cygnus Support. @@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* SECTION @@ -45,14 +45,10 @@ CODE_FRAGMENT . {* A pointer to the target jump table. *} . const struct bfd_target *xvec; . -. {* To avoid dragging too many header files into every file that -. includes `<>', IOSTREAM has been declared as a "char *", -. and MTIME as a "long". Their correct types, to which they -. are cast when used, are "FILE *" and "time_t". The iostream -. is the result of an fopen on the filename. However, if the -. BFD_IN_MEMORY flag is set, then iostream is actually a pointer -. to a bfd_in_memory struct. *} +. {* The IOSTREAM, and corresponding IO vector that provide access +. to the file backing the BFD. *} . void *iostream; +. const struct bfd_iovec *iovec; . . {* Is the file descriptor being cached? That is, can it be closed as . needed, and re-opened when accessed later? *} @@ -115,8 +111,8 @@ CODE_FRAGMENT . {* Pointer to linked list of sections. *} . struct bfd_section *sections; . -. {* The place where we add to the section list. *} -. struct bfd_section **section_tail; +. {* The last section on the section list. *} +. struct bfd_section *section_last; . . {* The number of sections. *} . unsigned int section_count; @@ -137,6 +133,9 @@ CODE_FRAGMENT . {* Pointer to structure which contains architecture information. *} . const struct bfd_arch_info *arch_info; . +. {* Flag set if symbols from this BFD should not be exported. *} +. bfd_boolean no_export; +. . {* Stuff only useful for archives. *} . void *arelt_data; . struct bfd *my_archive; {* The containing archive BFD. *} @@ -217,6 +216,11 @@ CODE_FRAGMENT #include "libecoff.h" #undef obj_symbols #include "elf-bfd.h" + +#ifndef EXIT_FAILURE +#define EXIT_FAILURE 1 +#endif + /* provide storage for subsystem, stack and heap data which may have been passed in on the command line. Ld puts this data into a bfd_link_info @@ -410,23 +414,152 @@ CODE_FRAGMENT static const char *_bfd_error_program_name; -/* This is the default routine to handle BFD error messages. */ +/* This is the default routine to handle BFD error messages. + Like fprintf (stderr, ...), but also handles some extra format specifiers. -static void -_bfd_default_error_handler (const char *s, ...) + %A section name from section. For group components, print group name too. + %B file name from bfd. For archive components, prints archive too. + */ + +void +_bfd_default_error_handler (const char *fmt, ...) { - va_list p; + va_list ap; + char *bufp; + const char *new_fmt, *p; + size_t avail = 1000; + char buf[1000]; if (_bfd_error_program_name != NULL) fprintf (stderr, "%s: ", _bfd_error_program_name); else fprintf (stderr, "BFD: "); - va_start (p, s); - vfprintf (stderr, s, p); - va_end (p); + va_start (ap, fmt); + new_fmt = fmt; + bufp = buf; - fprintf (stderr, "\n"); + /* Reserve enough space for the existing format string. */ + avail -= strlen (fmt) + 1; + if (avail > 1000) + _exit (EXIT_FAILURE); + + p = fmt; + while (1) + { + char *q; + size_t len, extra, trim; + + p = strchr (p, '%'); + if (p == NULL || p[1] == '\0') + { + if (new_fmt == buf) + { + len = strlen (fmt); + memcpy (bufp, fmt, len + 1); + } + break; + } + + if (p[1] == 'A' || p[1] == 'B') + { + len = p - fmt; + memcpy (bufp, fmt, len); + bufp += len; + fmt = p + 2; + new_fmt = buf; + + /* If we run out of space, tough, you lose your ridiculously + long file or section name. It's not safe to try to alloc + memory here; We might be printing an out of memory message. */ + if (avail == 0) + { + *bufp++ = '*'; + *bufp++ = '*'; + *bufp = '\0'; + } + else + { + if (p[1] == 'B') + { + bfd *abfd = va_arg (ap, bfd *); + if (abfd->my_archive) + snprintf (bufp, avail, "%s(%s)", + abfd->my_archive->filename, abfd->filename); + else + snprintf (bufp, avail, "%s", abfd->filename); + } + else + { + asection *sec = va_arg (ap, asection *); + bfd *abfd = sec->owner; + const char *group = NULL; + struct coff_comdat_info *ci; + + if (abfd != NULL + && bfd_get_flavour (abfd) == bfd_target_elf_flavour + && elf_next_in_group (sec) != NULL + && (sec->flags & SEC_GROUP) == 0) + group = elf_group_name (sec); + else if (abfd != NULL + && bfd_get_flavour (abfd) == bfd_target_coff_flavour + && (ci = bfd_coff_get_comdat_section (sec->owner, + sec)) != NULL) + group = ci->name; + if (group != NULL) + snprintf (bufp, avail, "%s[%s]", sec->name, group); + else + snprintf (bufp, avail, "%s", sec->name); + } + len = strlen (bufp); + avail = avail - len + 2; + + /* We need to replace any '%' we printed by "%%". + First count how many. */ + q = bufp; + bufp += len; + extra = 0; + while ((q = strchr (q, '%')) != NULL) + { + ++q; + ++extra; + } + + /* If there isn't room, trim off the end of the string. */ + q = bufp; + bufp += extra; + if (extra > avail) + { + trim = extra - avail; + bufp -= trim; + do + { + if (*--q == '%') + --extra; + } + while (--trim != 0); + *q = '\0'; + avail = extra; + } + avail -= extra; + + /* Now double all '%' chars, shuffling the string as we go. */ + while (extra != 0) + { + while ((q[extra] = *q) != '%') + --q; + q[--extra] = '%'; + --q; + } + } + } + p = p + 2; + } + + vfprintf (stderr, new_fmt, ap); + va_end (ap); + + putc ('\n', stderr); } /* This is a function pointer to the routine which should handle BFD @@ -495,60 +628,13 @@ bfd_get_error_handler (void) { return _bfd_error_handler; } - -/* -FUNCTION - bfd_archive_filename - -SYNOPSIS - const char *bfd_archive_filename (bfd *); - -DESCRIPTION - For a BFD that is a component of an archive, returns a string - with both the archive name and file name. For other BFDs, just - returns the file name. -*/ - -const char * -bfd_archive_filename (bfd *abfd) -{ - if (abfd == NULL) - return _(""); - - if (abfd->my_archive) - { - static size_t curr = 0; - static char *buf; - size_t needed; - - needed = (strlen (bfd_get_filename (abfd->my_archive)) - + strlen (bfd_get_filename (abfd)) + 3); - if (needed > curr) - { - if (curr) - free (buf); - curr = needed + (needed >> 1); - buf = bfd_malloc (curr); - /* If we can't malloc, fail safe by returning just the file - name. This function is only used when building error - messages. */ - if (!buf) - { - curr = 0; - return bfd_get_filename (abfd); - } - } - sprintf (buf, "%s(%s)", bfd_get_filename (abfd->my_archive), - bfd_get_filename (abfd)); - return buf; - } - else - return bfd_get_filename (abfd); -} /* SECTION - Symbols + Miscellaneous + +SUBSECTION + Miscellaneous functions */ /* @@ -694,10 +780,6 @@ bfd_assert (const char *file, int line) /* A more or less friendly abort message. In libbfd.h abort is defined to call this function. */ -#ifndef EXIT_FAILURE -#define EXIT_FAILURE 1 -#endif - void _bfd_abort (const char *file, int line, const char *fn) { @@ -710,7 +792,7 @@ _bfd_abort (const char *file, int line, const char *fn) (_("BFD %s internal error, aborting at %s line %d\n"), BFD_VERSION_STRING, file, line); (*_bfd_error_handler) (_("Please report this bug.\n")); - xexit (EXIT_FAILURE); + _exit (EXIT_FAILURE); } /* @@ -769,12 +851,14 @@ bfd_get_sign_extend_vma (bfd *abfd) name = bfd_get_target (abfd); - /* Return a proper value for DJGPP COFF (an x86 COFF variant). + /* Return a proper value for DJGPP & PE COFF (x86 COFF variants). This function is required for DWARF2 support, but there is no place to store this information in the COFF back end. Should enough other COFF targets add support for DWARF2, a place will have to be found. Until then, this hack will do. */ - if (strncmp (name, "coff-go32", sizeof ("coff-go32") - 1) == 0) + if (strncmp (name, "coff-go32", sizeof ("coff-go32") - 1) == 0 + || strcmp (name, "pe-i386") == 0 + || strcmp (name, "pei-i386") == 0) return 1; bfd_set_error (bfd_error_wrong_format); @@ -982,6 +1066,29 @@ bfd_scan_vma (const char *string, const char **end, int base) return value; } +/* +FUNCTION + bfd_copy_private_header_data + +SYNOPSIS + bfd_boolean bfd_copy_private_header_data (bfd *ibfd, bfd *obfd); + +DESCRIPTION + Copy private BFD header information from the BFD @var{ibfd} to the + the BFD @var{obfd}. This copies information that may require + sections to exist, but does not require symbol tables. Return + <> on success, <> on error. + Possible error returns are: + + o <> - + Not enough memory exists to create private data for @var{obfd}. + +.#define bfd_copy_private_header_data(ibfd, obfd) \ +. BFD_SEND (obfd, _bfd_copy_private_header_data, \ +. (ibfd, obfd)) + +*/ + /* FUNCTION bfd_copy_private_bfd_data @@ -1058,6 +1165,14 @@ DESCRIPTION . BFD_SEND (abfd, _bfd_find_nearest_line, \ . (abfd, sec, syms, off, file, func, line)) . +.#define bfd_find_line(abfd, syms, sym, file, line) \ +. BFD_SEND (abfd, _bfd_find_line, \ +. (abfd, syms, sym, file, line)) +. +.#define bfd_find_inliner_info(abfd, file, func, line) \ +. BFD_SEND (abfd, _bfd_find_inliner_info, \ +. (abfd, file, func, line)) +. .#define bfd_debug_info_start(abfd) \ . BFD_SEND (abfd, _bfd_debug_info_start, (abfd)) . @@ -1085,6 +1200,9 @@ DESCRIPTION .#define bfd_merge_sections(abfd, link_info) \ . BFD_SEND (abfd, _bfd_merge_sections, (abfd, link_info)) . +.#define bfd_is_group_section(abfd, sec) \ +. BFD_SEND (abfd, _bfd_is_group_section, (abfd, sec)) +. .#define bfd_discard_group(abfd, sec) \ . BFD_SEND (abfd, _bfd_discard_group, (abfd, sec)) . @@ -1097,7 +1215,7 @@ DESCRIPTION .#define bfd_link_add_symbols(abfd, info) \ . BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info)) . -.#define bfd_link_just_syms(sec, info) \ +.#define bfd_link_just_syms(abfd, sec, info) \ . BFD_SEND (abfd, _bfd_link_just_syms, (sec, info)) . .#define bfd_final_link(abfd, info) \ @@ -1115,6 +1233,10 @@ DESCRIPTION .#define bfd_canonicalize_dynamic_symtab(abfd, asymbols) \ . BFD_SEND (abfd, _bfd_canonicalize_dynamic_symtab, (abfd, asymbols)) . +.#define bfd_get_synthetic_symtab(abfd, count, syms, dyncount, dynsyms, ret) \ +. BFD_SEND (abfd, _bfd_get_synthetic_symtab, (abfd, count, syms, \ +. dyncount, dynsyms, ret)) +. .#define bfd_get_dynamic_reloc_upper_bound(abfd) \ . BFD_SEND (abfd, _bfd_get_dynamic_reloc_upper_bound, (abfd)) . @@ -1280,7 +1402,7 @@ CODE_FRAGMENT . flagword flags; . const struct bfd_arch_info *arch_info; . struct bfd_section *sections; -. struct bfd_section **section_tail; +. struct bfd_section *section_last; . unsigned int section_count; . struct bfd_hash_table section_htab; .}; @@ -1314,18 +1436,19 @@ bfd_preserve_save (bfd *abfd, struct bfd_preserve *preserve) preserve->arch_info = abfd->arch_info; preserve->flags = abfd->flags; preserve->sections = abfd->sections; - preserve->section_tail = abfd->section_tail; + preserve->section_last = abfd->section_last; preserve->section_count = abfd->section_count; preserve->section_htab = abfd->section_htab; - if (! bfd_hash_table_init (&abfd->section_htab, bfd_section_hash_newfunc)) + if (! bfd_hash_table_init (&abfd->section_htab, bfd_section_hash_newfunc, + sizeof (struct section_hash_entry))) return FALSE; abfd->tdata.any = NULL; abfd->arch_info = &bfd_default_arch_struct; abfd->flags &= BFD_IN_MEMORY; abfd->sections = NULL; - abfd->section_tail = &abfd->sections; + abfd->section_last = NULL; abfd->section_count = 0; return TRUE; @@ -1355,7 +1478,7 @@ bfd_preserve_restore (bfd *abfd, struct bfd_preserve *preserve) abfd->flags = preserve->flags; abfd->section_htab = preserve->section_htab; abfd->sections = preserve->sections; - abfd->section_tail = preserve->section_tail; + abfd->section_last = preserve->section_last; abfd->section_count = preserve->section_count; /* bfd_release frees all memory more recently bfd_alloc'd than diff --git a/contrib/binutils/bfd/bfdio.c b/contrib/binutils/bfd/bfdio.c index a90cb33ea5f..22ea886b5cb 100644 --- a/contrib/binutils/bfd/bfdio.c +++ b/contrib/binutils/bfd/bfdio.c @@ -1,7 +1,8 @@ /* Low-level I/O routines for BFDs. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + 1999, 2000, 2001, 2002, 2003, 2004, 2005 + Free Software Foundation, Inc. Written by Cygnus Support. @@ -19,7 +20,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "sysdep.h" @@ -62,38 +63,52 @@ real_fseek (FILE *file, file_ptr offset, int whence) #endif } -/* Note that archive entries don't have streams; they share their parent's. - This allows someone to play with the iostream behind BFD's back. - - Also, note that the origin pointer points to the beginning of a file's - contents (0 for non-archive elements). For archive entries this is the - first octet in the file, NOT the beginning of the archive header. */ - -static size_t -real_read (void *where, size_t a, size_t b, FILE *file) +FILE * +real_fopen (const char *filename, const char *modes) { - /* FIXME - this looks like an optimization, but it's really to cover - up for a feature of some OSs (not solaris - sigh) that - ld/pe-dll.c takes advantage of (apparently) when it creates BFDs - internally and tries to link against them. BFD seems to be smart - enough to realize there are no symbol records in the "file" that - doesn't exist but attempts to read them anyway. On Solaris, - attempting to read zero bytes from a NULL file results in a core - dump, but on other platforms it just returns zero bytes read. - This makes it to something reasonable. - DJ */ - if (a == 0 || b == 0) - return 0; - - -#if defined (__VAX) && defined (VMS) - /* Apparently fread on Vax VMS does not keep the record length - information. */ - return read (fileno (file), where, a * b); +#if defined (HAVE_FOPEN64) + return fopen64 (filename, modes); #else - return fread (where, a, b, file); + return fopen (filename, modes); #endif } +/* +INTERNAL_DEFINITION + struct bfd_iovec + +DESCRIPTION + + The <> contains the internal file I/O class. + Each <> has an instance of this class and all file I/O is + routed through it (it is assumed that the instance implements + all methods listed below). + +.struct bfd_iovec +.{ +. {* To avoid problems with macros, a "b" rather than "f" +. prefix is prepended to each method name. *} +. {* Attempt to read/write NBYTES on ABFD's IOSTREAM storing/fetching +. bytes starting at PTR. Return the number of bytes actually +. transfered (a read past end-of-file returns less than NBYTES), +. or -1 (setting <>) if an error occurs. *} +. file_ptr (*bread) (struct bfd *abfd, void *ptr, file_ptr nbytes); +. file_ptr (*bwrite) (struct bfd *abfd, const void *ptr, +. file_ptr nbytes); +. {* Return the current IOSTREAM file offset, or -1 (setting <> +. if an error occurs. *} +. file_ptr (*btell) (struct bfd *abfd); +. {* For the following, on successful completion a value of 0 is returned. +. Otherwise, a value of -1 is returned (and <> is set). *} +. int (*bseek) (struct bfd *abfd, file_ptr offset, int whence); +. int (*bclose) (struct bfd *abfd); +. int (*bflush) (struct bfd *abfd); +. int (*bstat) (struct bfd *abfd, struct stat *sb); +.}; + +*/ + + /* Return value is amount read. */ bfd_size_type @@ -121,25 +136,13 @@ bfd_bread (void *ptr, bfd_size_type size, bfd *abfd) return get; } - nread = real_read (ptr, 1, (size_t) size, bfd_cache_lookup (abfd)); + if (abfd->iovec) + nread = abfd->iovec->bread (abfd, ptr, size); + else + nread = 0; if (nread != (size_t) -1) abfd->where += nread; - /* Set bfd_error if we did not read as much data as we expected. - - If the read failed due to an error set the bfd_error_system_call, - else set bfd_error_file_truncated. - - A BFD backend may wish to override bfd_error_file_truncated to - provide something more useful (eg. no_symbols or wrong_format). */ - if (nread != size) - { - if (ferror (bfd_cache_lookup (abfd))) - bfd_set_error (bfd_error_system_call); - else - bfd_set_error (bfd_error_file_truncated); - } - return nread; } @@ -151,6 +154,7 @@ bfd_bwrite (const void *ptr, bfd_size_type size, bfd *abfd) if ((abfd->flags & BFD_IN_MEMORY) != 0) { struct bfd_in_memory *bim = abfd->iostream; + size = (size_t) size; if (abfd->where + size > bim->size) { @@ -175,7 +179,11 @@ bfd_bwrite (const void *ptr, bfd_size_type size, bfd *abfd) return size; } - nwrote = fwrite (ptr, 1, (size_t) size, bfd_cache_lookup (abfd)); + if (abfd->iovec) + nwrote = abfd->iovec->bwrite (abfd, ptr, size); + else + nwrote = 0; + if (nwrote != (size_t) -1) abfd->where += nwrote; if (nwrote != size) @@ -196,10 +204,16 @@ bfd_tell (bfd *abfd) if ((abfd->flags & BFD_IN_MEMORY) != 0) return abfd->where; - ptr = real_ftell (bfd_cache_lookup (abfd)); + if (abfd->iovec) + { + ptr = abfd->iovec->btell (abfd); + + if (abfd->my_archive) + ptr -= abfd->origin; + } + else + ptr = 0; - if (abfd->my_archive) - ptr -= abfd->origin; abfd->where = ptr; return ptr; } @@ -209,7 +223,10 @@ bfd_flush (bfd *abfd) { if ((abfd->flags & BFD_IN_MEMORY) != 0) return 0; - return fflush (bfd_cache_lookup(abfd)); + + if (abfd->iovec) + return abfd->iovec->bflush (abfd); + return 0; } /* Returns 0 for success, negative value for failure (in which case @@ -217,19 +234,16 @@ bfd_flush (bfd *abfd) int bfd_stat (bfd *abfd, struct stat *statbuf) { - FILE *f; int result; if ((abfd->flags & BFD_IN_MEMORY) != 0) abort (); - f = bfd_cache_lookup (abfd); - if (f == NULL) - { - bfd_set_error (bfd_error_system_call); - return -1; - } - result = fstat (fileno (f), statbuf); + if (abfd->iovec) + result = abfd->iovec->bstat (abfd, statbuf); + else + result = -1; + if (result < 0) bfd_set_error (bfd_error_system_call); return result; @@ -242,7 +256,6 @@ int bfd_seek (bfd *abfd, file_ptr position, int direction) { int result; - FILE *f; file_ptr file_position; /* For the time being, a BFD may not seek to it's end. The problem is that we don't easily have a way to recognize the end of an @@ -270,6 +283,7 @@ bfd_seek (bfd *abfd, file_ptr position, int direction) (abfd->direction == both_direction)) { bfd_size_type newsize, oldsize; + oldsize = (bim->size + 127) & ~(bfd_size_type) 127; bim->size = abfd->where; /* Round up to cut down on memory fragmentation */ @@ -296,20 +310,6 @@ bfd_seek (bfd *abfd, file_ptr position, int direction) if (abfd->format != bfd_archive && abfd->my_archive == 0) { -#if 0 - /* Explanation for this code: I'm only about 95+% sure that the above - conditions are sufficient and that all i/o calls are properly - adjusting the `where' field. So this is sort of an `assert' - that the `where' field is correct. If we can go a while without - tripping the abort, we can probably safely disable this code, - so that the real optimizations happen. */ - file_ptr where_am_i_now; - where_am_i_now = real_ftell (bfd_cache_lookup (abfd)); - if (abfd->my_archive) - where_am_i_now -= abfd->origin; - if (where_am_i_now != abfd->where) - abort (); -#endif if (direction == SEEK_SET && (bfd_vma) position == abfd->where) return 0; } @@ -328,12 +328,15 @@ bfd_seek (bfd *abfd, file_ptr position, int direction) In the meantime, no optimization for archives. */ } - f = bfd_cache_lookup (abfd); file_position = position; if (direction == SEEK_SET && abfd->my_archive != NULL) file_position += abfd->origin; - result = real_fseek (f, file_position, direction); + if (abfd->iovec) + result = abfd->iovec->bseek (abfd, file_position, direction); + else + result = -1; + if (result != 0) { int hold_errno = errno; @@ -378,14 +381,15 @@ DESCRIPTION long bfd_get_mtime (bfd *abfd) { - FILE *fp; struct stat buf; if (abfd->mtime_set) return abfd->mtime; - fp = bfd_cache_lookup (abfd); - if (0 != fstat (fileno (fp), &buf)) + if (abfd->iovec == NULL) + return 0; + + if (abfd->iovec->bstat (abfd, &buf) != 0) return 0; abfd->mtime = buf.st_mtime; /* Save value in case anyone wants it */ @@ -428,14 +432,15 @@ DESCRIPTION long bfd_get_size (bfd *abfd) { - FILE *fp; struct stat buf; if ((abfd->flags & BFD_IN_MEMORY) != 0) return ((struct bfd_in_memory *) abfd->iostream)->size; - fp = bfd_cache_lookup (abfd); - if (0 != fstat (fileno (fp), & buf)) + if (abfd->iovec == NULL) + return 0; + + if (abfd->iovec->bstat (abfd, &buf) != 0) return 0; return buf.st_size; diff --git a/contrib/binutils/bfd/bfdwin.c b/contrib/binutils/bfd/bfdwin.c index fb7c967bff3..7236906e28b 100644 --- a/contrib/binutils/bfd/bfdwin.c +++ b/contrib/binutils/bfd/bfdwin.c @@ -1,5 +1,6 @@ /* Support for memory-mapped windows into a BFD. - Copyright 1995, 1996, 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright 1995, 1996, 2001, 2002, 2003, 2005 + Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -16,7 +17,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "sysdep.h" @@ -144,7 +145,6 @@ bfd_get_file_window (bfd *abfd, file_ptr file_offset, offset2; size_t real_size; int fd; - FILE *f; /* Find the real file and the real offset into it. */ while (abfd->my_archive != NULL) @@ -152,8 +152,13 @@ bfd_get_file_window (bfd *abfd, offset += abfd->origin; abfd = abfd->my_archive; } - f = bfd_cache_lookup (abfd); - fd = fileno (f); + + /* Seek into the file, to ensure it is open if cacheable. */ + if (abfd->iostream == NULL + && (abfd->iovec == NULL + || abfd->iovec->bseek (abfd, offset, SEEK_SET) != 0)) + return FALSE; + fd = fileno ((FILE *) abfd->iostream); /* Compute offsets and size for mmap and for the user's data. */ offset2 = offset % pagesize; diff --git a/contrib/binutils/bfd/binary.c b/contrib/binutils/bfd/binary.c index 65f46afa39c..458626f02a3 100644 --- a/contrib/binutils/bfd/binary.c +++ b/contrib/binutils/bfd/binary.c @@ -1,6 +1,6 @@ /* BFD back-end for binary objects. - Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 - Free Software Foundation, Inc. + Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, + 2004, 2005 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support, This file is part of BFD, the Binary File Descriptor library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* This is a BFD backend which may be used to write binary objects. It may only be used for output, not input. The intention is that @@ -41,18 +41,6 @@ a start symbol, an end symbol, and an absolute length symbol. */ #define BIN_SYMS 3 -static bfd_boolean binary_mkobject PARAMS ((bfd *)); -static const bfd_target *binary_object_p PARAMS ((bfd *)); -static bfd_boolean binary_get_section_contents - PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); -static long binary_get_symtab_upper_bound PARAMS ((bfd *)); -static char *mangle_name PARAMS ((bfd *, char *)); -static long binary_canonicalize_symtab PARAMS ((bfd *, asymbol **)); -static void binary_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *)); -static bfd_boolean binary_set_section_contents - PARAMS ((bfd *, asection *, const PTR, file_ptr, bfd_size_type)); -static int binary_sizeof_headers PARAMS ((bfd *, bfd_boolean)); - /* Set by external programs - specifies the BFD architecture and machine number to be uses when creating binary BFDs. */ enum bfd_architecture bfd_external_binary_architecture = bfd_arch_unknown; @@ -61,8 +49,7 @@ unsigned long bfd_external_machine = 0; /* Create a binary object. Invoked via bfd_set_format. */ static bfd_boolean -binary_mkobject (abfd) - bfd *abfd ATTRIBUTE_UNUSED; +binary_mkobject (bfd *abfd ATTRIBUTE_UNUSED) { return TRUE; } @@ -72,8 +59,7 @@ binary_mkobject (abfd) being binary. */ static const bfd_target * -binary_object_p (abfd) - bfd *abfd; +binary_object_p (bfd *abfd) { struct stat statbuf; asection *sec; @@ -99,10 +85,10 @@ binary_object_p (abfd) return NULL; sec->flags = SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_HAS_CONTENTS; sec->vma = 0; - sec->_raw_size = statbuf.st_size; + sec->size = statbuf.st_size; sec->filepos = 0; - abfd->tdata.any = (PTR) sec; + abfd->tdata.any = (void *) sec; if (bfd_get_arch_info (abfd) != NULL) { @@ -115,19 +101,18 @@ binary_object_p (abfd) return abfd->xvec; } -#define binary_close_and_cleanup _bfd_generic_close_and_cleanup -#define binary_bfd_free_cached_info _bfd_generic_bfd_free_cached_info -#define binary_new_section_hook _bfd_generic_new_section_hook +#define binary_close_and_cleanup _bfd_generic_close_and_cleanup +#define binary_bfd_free_cached_info _bfd_generic_bfd_free_cached_info +#define binary_new_section_hook _bfd_generic_new_section_hook /* Get contents of the only section. */ static bfd_boolean -binary_get_section_contents (abfd, section, location, offset, count) - bfd *abfd; - asection *section ATTRIBUTE_UNUSED; - PTR location; - file_ptr offset; - bfd_size_type count; +binary_get_section_contents (bfd *abfd, + asection *section ATTRIBUTE_UNUSED, + void * location, + file_ptr offset, + bfd_size_type count) { if (bfd_seek (abfd, offset, SEEK_SET) != 0 || bfd_bread (location, count, abfd) != count) @@ -138,8 +123,7 @@ binary_get_section_contents (abfd, section, location, offset, count) /* Return the amount of memory needed to read the symbol table. */ static long -binary_get_symtab_upper_bound (abfd) - bfd *abfd ATTRIBUTE_UNUSED; +binary_get_symtab_upper_bound (bfd *abfd ATTRIBUTE_UNUSED) { return (BIN_SYMS + 1) * sizeof (asymbol *); } @@ -147,9 +131,7 @@ binary_get_symtab_upper_bound (abfd) /* Create a symbol name based on the bfd's filename. */ static char * -mangle_name (abfd, suffix) - bfd *abfd; - char *suffix; +mangle_name (bfd *abfd, char *suffix) { bfd_size_type size; char *buf; @@ -159,7 +141,7 @@ mangle_name (abfd, suffix) + strlen (suffix) + sizeof "_binary__"); - buf = (char *) bfd_alloc (abfd, size); + buf = bfd_alloc (abfd, size); if (buf == NULL) return ""; @@ -176,16 +158,14 @@ mangle_name (abfd, suffix) /* Return the symbol table. */ static long -binary_canonicalize_symtab (abfd, alocation) - bfd *abfd; - asymbol **alocation; +binary_canonicalize_symtab (bfd *abfd, asymbol **alocation) { asection *sec = (asection *) abfd->tdata.any; asymbol *syms; unsigned int i; bfd_size_type amt = BIN_SYMS * sizeof (asymbol); - syms = (asymbol *) bfd_alloc (abfd, amt); + syms = bfd_alloc (abfd, amt); if (syms == NULL) return 0; @@ -200,7 +180,7 @@ binary_canonicalize_symtab (abfd, alocation) /* End symbol. */ syms[1].the_bfd = abfd; syms[1].name = mangle_name (abfd, "end"); - syms[1].value = sec->_raw_size; + syms[1].value = sec->size; syms[1].flags = BSF_GLOBAL; syms[1].section = sec; syms[1].udata.p = NULL; @@ -208,7 +188,7 @@ binary_canonicalize_symtab (abfd, alocation) /* Size symbol. */ syms[2].the_bfd = abfd; syms[2].name = mangle_name (abfd, "size"); - syms[2].value = sec->_raw_size; + syms[2].value = sec->size; syms[2].flags = BSF_GLOBAL; syms[2].section = bfd_abs_section_ptr; syms[2].udata.p = NULL; @@ -220,32 +200,30 @@ binary_canonicalize_symtab (abfd, alocation) return BIN_SYMS; } -#define binary_make_empty_symbol _bfd_generic_make_empty_symbol -#define binary_print_symbol _bfd_nosymbols_print_symbol +#define binary_make_empty_symbol _bfd_generic_make_empty_symbol +#define binary_print_symbol _bfd_nosymbols_print_symbol /* Get information about a symbol. */ static void -binary_get_symbol_info (ignore_abfd, symbol, ret) - bfd *ignore_abfd ATTRIBUTE_UNUSED; - asymbol *symbol; - symbol_info *ret; +binary_get_symbol_info (bfd *ignore_abfd ATTRIBUTE_UNUSED, + asymbol *symbol, + symbol_info *ret) { bfd_symbol_info (symbol, ret); } -#define binary_bfd_is_local_label_name bfd_generic_is_local_label_name -#define binary_get_lineno _bfd_nosymbols_get_lineno -#define binary_find_nearest_line _bfd_nosymbols_find_nearest_line -#define binary_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol -#define binary_read_minisymbols _bfd_generic_read_minisymbols -#define binary_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol - -#define binary_get_reloc_upper_bound \ - ((long (*) PARAMS ((bfd *, asection *))) bfd_0l) -#define binary_canonicalize_reloc \ - ((long (*) PARAMS ((bfd *, asection *, arelent **, asymbol **))) bfd_0l) -#define binary_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup +#define binary_bfd_is_local_label_name bfd_generic_is_local_label_name +#define binary_get_lineno _bfd_nosymbols_get_lineno +#define binary_find_nearest_line _bfd_nosymbols_find_nearest_line +#define binary_find_inliner_info _bfd_nosymbols_find_inliner_info +#define binary_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol +#define binary_read_minisymbols _bfd_generic_read_minisymbols +#define binary_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol +#define binary_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup +#define binary_get_reloc_upper_bound ((long (*) (bfd *, asection *)) bfd_0l) +#define binary_canonicalize_reloc ((long (*) (bfd *, asection *, arelent **, asymbol **)) bfd_0l) +#define binary_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) /* Set the architecture of a binary file. */ #define binary_set_arch_mach _bfd_generic_set_arch_mach @@ -253,12 +231,11 @@ binary_get_symbol_info (ignore_abfd, symbol, ret) /* Write section contents of a binary file. */ static bfd_boolean -binary_set_section_contents (abfd, sec, data, offset, size) - bfd *abfd; - asection *sec; - const PTR data; - file_ptr offset; - bfd_size_type size; +binary_set_section_contents (bfd *abfd, + asection *sec, + const void * data, + file_ptr offset, + bfd_size_type size) { if (size == 0) return TRUE; @@ -278,7 +255,7 @@ binary_set_section_contents (abfd, sec, data, offset, size) if (((s->flags & (SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC | SEC_NEVER_LOAD)) == (SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC)) - && (s->_raw_size > 0) + && (s->size > 0) && (! found_low || s->lma < low)) { low = s->lma; @@ -294,7 +271,7 @@ binary_set_section_contents (abfd, sec, data, offset, size) if ((s->flags & (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_NEVER_LOAD)) != (SEC_HAS_CONTENTS | SEC_ALLOC) - || (s->_raw_size == 0)) + || (s->size == 0)) continue; /* If attempting to generate a binary file from a bfd with @@ -327,27 +304,26 @@ binary_set_section_contents (abfd, sec, data, offset, size) /* No space is required for header information. */ static int -binary_sizeof_headers (abfd, exec) - bfd *abfd ATTRIBUTE_UNUSED; - bfd_boolean exec ATTRIBUTE_UNUSED; +binary_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, + bfd_boolean exec ATTRIBUTE_UNUSED) { return 0; } -#define binary_bfd_get_relocated_section_contents \ - bfd_generic_get_relocated_section_contents -#define binary_bfd_relax_section bfd_generic_relax_section -#define binary_bfd_gc_sections bfd_generic_gc_sections -#define binary_bfd_merge_sections bfd_generic_merge_sections -#define binary_bfd_discard_group bfd_generic_discard_group -#define binary_bfd_link_hash_table_create _bfd_generic_link_hash_table_create -#define binary_bfd_link_hash_table_free _bfd_generic_link_hash_table_free -#define binary_bfd_link_just_syms _bfd_generic_link_just_syms -#define binary_bfd_link_add_symbols _bfd_generic_link_add_symbols -#define binary_bfd_final_link _bfd_generic_final_link -#define binary_bfd_link_split_section _bfd_generic_link_split_section -#define binary_get_section_contents_in_window \ - _bfd_generic_get_section_contents_in_window +#define binary_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents +#define binary_bfd_relax_section bfd_generic_relax_section +#define binary_bfd_gc_sections bfd_generic_gc_sections +#define binary_bfd_merge_sections bfd_generic_merge_sections +#define binary_bfd_is_group_section bfd_generic_is_group_section +#define binary_bfd_discard_group bfd_generic_discard_group +#define binary_section_already_linked _bfd_generic_section_already_linked +#define binary_bfd_link_hash_table_create _bfd_generic_link_hash_table_create +#define binary_bfd_link_hash_table_free _bfd_generic_link_hash_table_free +#define binary_bfd_link_just_syms _bfd_generic_link_just_syms +#define binary_bfd_link_add_symbols _bfd_generic_link_add_symbols +#define binary_bfd_final_link _bfd_generic_final_link +#define binary_bfd_link_split_section _bfd_generic_link_split_section +#define binary_get_section_contents_in_window _bfd_generic_get_section_contents_in_window const bfd_target binary_vec = { @@ -369,7 +345,7 @@ const bfd_target binary_vec = bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */ { /* bfd_check_format */ _bfd_dummy_target, - binary_object_p, /* bfd_check_format */ + binary_object_p, _bfd_dummy_target, _bfd_dummy_target, }, diff --git a/contrib/binutils/bfd/bout.c b/contrib/binutils/bfd/bout.c index a39a9a36a94..5102ba77622 100644 --- a/contrib/binutils/bfd/bout.c +++ b/contrib/binutils/bfd/bout.c @@ -1,24 +1,24 @@ /* BFD back-end for Intel 960 b.out binaries. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003 + 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. Written by Cygnus Support. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" @@ -26,103 +26,85 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfdlink.h" #include "genlink.h" #include "bout.h" +#include "libiberty.h" #include "aout/stab_gnu.h" #include "libaout.h" /* BFD a.out internal data structures. */ -static int aligncode - PARAMS ((bfd *abfd, asection *input_section, arelent *r, - unsigned int shrink)); -static void perform_slip - PARAMS ((bfd *abfd, unsigned int slip, asection *input_section, - bfd_vma value)); -static bfd_boolean b_out_squirt_out_relocs - PARAMS ((bfd *abfd, asection *section)); -static const bfd_target *b_out_callback - PARAMS ((bfd *)); -static bfd_reloc_status_type calljx_callback - PARAMS ((bfd *, struct bfd_link_info *, arelent *, PTR src, PTR dst, - asection *)); -static bfd_reloc_status_type callj_callback - PARAMS ((bfd *, struct bfd_link_info *, arelent *, PTR data, - unsigned int srcidx, unsigned int dstidx, asection *, bfd_boolean)); -static bfd_vma get_value - PARAMS ((arelent *, struct bfd_link_info *, asection *)); -static int abs32code - PARAMS ((bfd *, asection *, arelent *, unsigned int, - struct bfd_link_info *)); -static bfd_boolean b_out_bfd_relax_section - PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *)); -static bfd_byte *b_out_bfd_get_relocated_section_contents - PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *, - bfd_boolean, asymbol **)); -static int b_out_sizeof_headers - PARAMS ((bfd *, bfd_boolean)); -static bfd_boolean b_out_set_arch_mach - PARAMS ((bfd *, enum bfd_architecture, unsigned long)); -static bfd_boolean b_out_set_section_contents - PARAMS ((bfd *, asection *, const PTR, file_ptr, bfd_size_type)); -static long b_out_get_reloc_upper_bound - PARAMS ((bfd *, sec_ptr)); -static long b_out_canonicalize_reloc - PARAMS ((bfd *, sec_ptr, arelent **, asymbol **)); -static bfd_boolean b_out_slurp_reloc_table - PARAMS ((bfd *, sec_ptr, asymbol **)); -static reloc_howto_type *b_out_bfd_reloc_type_lookup - PARAMS ((bfd *, bfd_reloc_code_real_type)); -static bfd_boolean b_out_write_object_contents - PARAMS ((bfd *)); -static int b_out_symbol_cmp - PARAMS ((const void *, const void *)); -static bfd_boolean b_out_mkobject - PARAMS ((bfd *)); -static const bfd_target *b_out_object_p - PARAMS ((bfd *)); +#define ABS32CODE 0 +#define ABS32CODE_SHRUNK 1 +#define PCREL24 2 +#define CALLJ 3 +#define ABS32 4 +#define PCREL13 5 +#define ABS32_MAYBE_RELAXABLE 1 +#define ABS32_WAS_RELAXABLE 2 -void bout_swap_exec_header_in - PARAMS ((bfd *, struct external_exec *, struct internal_exec *)); -void bout_swap_exec_header_out - PARAMS ((bfd *, struct internal_exec *, struct external_exec *)); +#define ALIGNER 10 +#define ALIGNDONE 11 + +static reloc_howto_type howto_reloc_callj = + HOWTO (CALLJ, 0, 2, 24, TRUE, 0, complain_overflow_signed, 0,"callj", TRUE, 0x00ffffff, 0x00ffffff,FALSE); +static reloc_howto_type howto_reloc_abs32 = + HOWTO (ABS32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,0,"abs32", TRUE, 0xffffffff,0xffffffff,FALSE); +static reloc_howto_type howto_reloc_pcrel24 = + HOWTO (PCREL24, 0, 2, 24, TRUE, 0, complain_overflow_signed,0,"pcrel24", TRUE, 0x00ffffff,0x00ffffff,FALSE); +static reloc_howto_type howto_reloc_pcrel13 = + HOWTO (PCREL13, 0, 2, 13, TRUE, 0, complain_overflow_signed,0,"pcrel13", TRUE, 0x00001fff,0x00001fff,FALSE); +static reloc_howto_type howto_reloc_abs32codeshrunk = + HOWTO (ABS32CODE_SHRUNK, 0, 2, 24, TRUE, 0, complain_overflow_signed, 0,"callx->callj", TRUE, 0x00ffffff, 0x00ffffff,FALSE); +static reloc_howto_type howto_reloc_abs32code = + HOWTO (ABS32CODE, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,0,"callx", TRUE, 0xffffffff,0xffffffff,FALSE); + +static reloc_howto_type howto_align_table[] = +{ + HOWTO (ALIGNER, 0, 0x1, 0, FALSE, 0, complain_overflow_dont, 0, "align16", FALSE, 0, 0, FALSE), + HOWTO (ALIGNER, 0, 0x3, 0, FALSE, 0, complain_overflow_dont, 0, "align32", FALSE, 0, 0, FALSE), + HOWTO (ALIGNER, 0, 0x7, 0, FALSE, 0, complain_overflow_dont, 0, "align64", FALSE, 0, 0, FALSE), + HOWTO (ALIGNER, 0, 0xf, 0, FALSE, 0, complain_overflow_dont, 0, "align128", FALSE, 0, 0, FALSE), +}; + +static reloc_howto_type howto_done_align_table[] = +{ + HOWTO (ALIGNDONE, 0x1, 0x1, 0, FALSE, 0, complain_overflow_dont, 0, "donealign16", FALSE, 0, 0, FALSE), + HOWTO (ALIGNDONE, 0x3, 0x3, 0, FALSE, 0, complain_overflow_dont, 0, "donealign32", FALSE, 0, 0, FALSE), + HOWTO (ALIGNDONE, 0x7, 0x7, 0, FALSE, 0, complain_overflow_dont, 0, "donealign64", FALSE, 0, 0, FALSE), + HOWTO (ALIGNDONE, 0xf, 0xf, 0, FALSE, 0, complain_overflow_dont, 0, "donealign128", FALSE, 0, 0, FALSE), +}; /* Swaps the information in an executable header taken from a raw byte stream memory image, into the internal exec_header structure. */ -void -bout_swap_exec_header_in (abfd, raw_bytes, execp) - bfd *abfd; - struct external_exec *raw_bytes; - struct internal_exec *execp; +static void +bout_swap_exec_header_in (bfd *abfd, + struct external_exec *bytes, + struct internal_exec *execp) { - struct external_exec *bytes = (struct external_exec *)raw_bytes; - /* Now fill in fields in the execp, from the bytes in the raw data. */ - execp->a_info = H_GET_32 (abfd, bytes->e_info); - execp->a_text = GET_WORD (abfd, bytes->e_text); - execp->a_data = GET_WORD (abfd, bytes->e_data); - execp->a_bss = GET_WORD (abfd, bytes->e_bss); - execp->a_syms = GET_WORD (abfd, bytes->e_syms); - execp->a_entry = GET_WORD (abfd, bytes->e_entry); - execp->a_trsize = GET_WORD (abfd, bytes->e_trsize); - execp->a_drsize = GET_WORD (abfd, bytes->e_drsize); - execp->a_tload = GET_WORD (abfd, bytes->e_tload); - execp->a_dload = GET_WORD (abfd, bytes->e_dload); - execp->a_talign = bytes->e_talign[0]; - execp->a_dalign = bytes->e_dalign[0]; - execp->a_balign = bytes->e_balign[0]; + execp->a_info = H_GET_32 (abfd, bytes->e_info); + execp->a_text = GET_WORD (abfd, bytes->e_text); + execp->a_data = GET_WORD (abfd, bytes->e_data); + execp->a_bss = GET_WORD (abfd, bytes->e_bss); + execp->a_syms = GET_WORD (abfd, bytes->e_syms); + execp->a_entry = GET_WORD (abfd, bytes->e_entry); + execp->a_trsize = GET_WORD (abfd, bytes->e_trsize); + execp->a_drsize = GET_WORD (abfd, bytes->e_drsize); + execp->a_tload = GET_WORD (abfd, bytes->e_tload); + execp->a_dload = GET_WORD (abfd, bytes->e_dload); + execp->a_talign = bytes->e_talign[0]; + execp->a_dalign = bytes->e_dalign[0]; + execp->a_balign = bytes->e_balign[0]; execp->a_relaxable = bytes->e_relaxable[0]; } /* Swaps the information in an internal exec header structure into the supplied buffer ready for writing to disk. */ -void -bout_swap_exec_header_out (abfd, execp, raw_bytes) - bfd *abfd; - struct internal_exec *execp; - struct external_exec *raw_bytes; +static void +bout_swap_exec_header_out (bfd *abfd, + struct internal_exec *execp, + struct external_exec *bytes) { - struct external_exec *bytes = (struct external_exec *)raw_bytes; - /* Now fill in fields in the raw data, from the fields in the exec struct. */ H_PUT_32 (abfd, execp->a_info , bytes->e_info); PUT_WORD (abfd, execp->a_text , bytes->e_text); @@ -134,54 +116,26 @@ bout_swap_exec_header_out (abfd, execp, raw_bytes) PUT_WORD (abfd, execp->a_drsize, bytes->e_drsize); PUT_WORD (abfd, execp->a_tload , bytes->e_tload); PUT_WORD (abfd, execp->a_dload , bytes->e_dload); - bytes->e_talign[0] = execp->a_talign; - bytes->e_dalign[0] = execp->a_dalign; - bytes->e_balign[0] = execp->a_balign; + bytes->e_talign[0] = execp->a_talign; + bytes->e_dalign[0] = execp->a_dalign; + bytes->e_balign[0] = execp->a_balign; bytes->e_relaxable[0] = execp->a_relaxable; } -static const bfd_target * -b_out_object_p (abfd) - bfd *abfd; -{ - struct internal_exec anexec; - struct external_exec exec_bytes; - bfd_size_type amt = EXEC_BYTES_SIZE; - - if (bfd_bread ((PTR) &exec_bytes, amt, abfd) != amt) - { - if (bfd_get_error () != bfd_error_system_call) - bfd_set_error (bfd_error_wrong_format); - return 0; - } - - anexec.a_info = H_GET_32 (abfd, exec_bytes.e_info); - - if (N_BADMAG (anexec)) - { - bfd_set_error (bfd_error_wrong_format); - return 0; - } - - bout_swap_exec_header_in (abfd, &exec_bytes, &anexec); - return aout_32_some_aout_object_p (abfd, &anexec, b_out_callback); -} - /* Finish up the opening of a b.out file for reading. Fill in all the fields that are not handled by common code. */ static const bfd_target * -b_out_callback (abfd) - bfd *abfd; +b_out_callback (bfd *abfd) { struct internal_exec *execp = exec_hdr (abfd); unsigned long bss_start; /* Architecture and machine type. */ - bfd_set_arch_mach(abfd, - bfd_arch_i960, /* B.out only used on i960 */ - bfd_mach_i960_core /* Default */ - ); + bfd_set_arch_mach (abfd, + bfd_arch_i960, /* B.out only used on i960. */ + bfd_mach_i960_core /* Default. */ + ); /* The positions of the string table and symbol table. */ obj_str_filepos (abfd) = N_STROFF (*execp); @@ -200,30 +154,56 @@ b_out_callback (abfd) obj_datasec (abfd)->lma = obj_datasec (abfd)->vma; /* And reload the sizes, since the aout module zaps them. */ - obj_textsec (abfd)->_raw_size = execp->a_text; + obj_textsec (abfd)->size = execp->a_text; - bss_start = execp->a_dload + execp->a_data; /* BSS = end of data section */ + bss_start = execp->a_dload + execp->a_data; /* BSS = end of data section. */ obj_bsssec (abfd)->vma = align_power (bss_start, execp->a_balign); obj_bsssec (abfd)->lma = obj_bsssec (abfd)->vma; /* The file positions of the sections. */ - obj_textsec (abfd)->filepos = N_TXTOFF(*execp); - obj_datasec (abfd)->filepos = N_DATOFF(*execp); + obj_textsec (abfd)->filepos = N_TXTOFF (*execp); + obj_datasec (abfd)->filepos = N_DATOFF (*execp); /* The file positions of the relocation info. */ - obj_textsec (abfd)->rel_filepos = N_TROFF(*execp); - obj_datasec (abfd)->rel_filepos = N_DROFF(*execp); + obj_textsec (abfd)->rel_filepos = N_TROFF (*execp); + obj_datasec (abfd)->rel_filepos = N_DROFF (*execp); - adata(abfd).page_size = 1; /* Not applicable. */ - adata(abfd).segment_size = 1; /* Not applicable. */ - adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE; + adata (abfd).page_size = 1; /* Not applicable. */ + adata (abfd).segment_size = 1; /* Not applicable. */ + adata (abfd).exec_bytes_size = EXEC_BYTES_SIZE; if (execp->a_relaxable) abfd->flags |= BFD_IS_RELAXABLE; return abfd->xvec; } +static const bfd_target * +b_out_object_p (bfd *abfd) +{ + struct internal_exec anexec; + struct external_exec exec_bytes; + bfd_size_type amt = EXEC_BYTES_SIZE; + + if (bfd_bread ((void *) &exec_bytes, amt, abfd) != amt) + { + if (bfd_get_error () != bfd_error_system_call) + bfd_set_error (bfd_error_wrong_format); + return 0; + } + + anexec.a_info = H_GET_32 (abfd, exec_bytes.e_info); + + if (N_BADMAG (anexec)) + { + bfd_set_error (bfd_error_wrong_format); + return 0; + } + + bout_swap_exec_header_in (abfd, &exec_bytes, &anexec); + return aout_32_some_aout_object_p (abfd, &anexec, b_out_callback); +} + struct bout_data_struct { struct aoutdata a; @@ -231,30 +211,27 @@ struct bout_data_struct }; static bfd_boolean -b_out_mkobject (abfd) - bfd *abfd; +b_out_mkobject (bfd *abfd) { struct bout_data_struct *rawptr; bfd_size_type amt = sizeof (struct bout_data_struct); - rawptr = (struct bout_data_struct *) bfd_zalloc (abfd, amt); + rawptr = bfd_zalloc (abfd, amt); if (rawptr == NULL) return FALSE; abfd->tdata.bout_data = rawptr; exec_hdr (abfd) = &rawptr->e; - obj_textsec (abfd) = (asection *) NULL; - obj_datasec (abfd) = (asection *) NULL; - obj_bsssec (abfd) = (asection *) NULL; + obj_textsec (abfd) = NULL; + obj_datasec (abfd) = NULL; + obj_bsssec (abfd) = NULL; return TRUE; } static int -b_out_symbol_cmp (a_ptr, b_ptr) - const void * a_ptr; - const void * b_ptr; +b_out_symbol_cmp (const void * a_ptr, const void * b_ptr) { struct aout_symbol ** a = (struct aout_symbol **) a_ptr; struct aout_symbol ** b = (struct aout_symbol **) b_ptr; @@ -272,8 +249,8 @@ b_out_symbol_cmp (a_ptr, b_ptr) if (av > bv) return 1; - /* Secondary key puts CALLNAME syms last and BALNAME syms first, so - that they have the best chance of being contiguous. */ + /* Secondary key puts CALLNAME syms last and BALNAME syms first, + so that they have the best chance of being contiguous. */ if (IS_BALNAME ((*a)->other) || IS_CALLNAME ((*b)->other)) return -1; if (IS_CALLNAME ((*a)->other) || IS_BALNAME ((*b)->other)) @@ -283,8 +260,138 @@ b_out_symbol_cmp (a_ptr, b_ptr) } static bfd_boolean -b_out_write_object_contents (abfd) - bfd *abfd; +b_out_squirt_out_relocs (bfd *abfd, asection *section) +{ + arelent **generic; + int r_extern = 0; + int r_idx; + int incode_mask; + int len_1; + unsigned int count = section->reloc_count; + struct relocation_info *native, *natptr; + bfd_size_type natsize; + int extern_mask, pcrel_mask, len_2, callj_mask; + + if (count == 0) + return TRUE; + + generic = section->orelocation; + natsize = (bfd_size_type) count * sizeof (struct relocation_info); + native = bfd_malloc (natsize); + if (!native && natsize != 0) + return FALSE; + + if (bfd_header_big_endian (abfd)) + { + /* Big-endian bit field allocation order. */ + pcrel_mask = 0x80; + extern_mask = 0x10; + len_2 = 0x40; + len_1 = 0x20; + callj_mask = 0x02; + incode_mask = 0x08; + } + else + { + /* Little-endian bit field allocation order. */ + pcrel_mask = 0x01; + extern_mask = 0x08; + len_2 = 0x04; + len_1 = 0x02; + callj_mask = 0x40; + incode_mask = 0x10; + } + + for (natptr = native; count > 0; --count, ++natptr, ++generic) + { + arelent *g = *generic; + unsigned char *raw = (unsigned char *) natptr; + asymbol *sym = *(g->sym_ptr_ptr); + asection *output_section = sym->section->output_section; + + H_PUT_32 (abfd, g->address, raw); + /* Find a type in the output format which matches the input howto - + at the moment we assume input format == output format FIXME!! */ + r_idx = 0; + /* FIXME: Need callj stuff here, and to check the howto entries to + be sure they are real for this architecture. */ + if (g->howto== &howto_reloc_callj) + raw[7] = callj_mask + pcrel_mask + len_2; + else if (g->howto == &howto_reloc_pcrel24) + raw[7] = pcrel_mask + len_2; + else if (g->howto == &howto_reloc_pcrel13) + raw[7] = pcrel_mask + len_1; + else if (g->howto == &howto_reloc_abs32code) + raw[7] = len_2 + incode_mask; + else if (g->howto >= howto_align_table + && g->howto <= (howto_align_table + ARRAY_SIZE (howto_align_table) - 1)) + { + /* symnum == -2; extern_mask not set, pcrel_mask set. */ + r_idx = -2; + r_extern = 0; + raw[7] = (pcrel_mask + | ((g->howto - howto_align_table) << 1)); + } + else + raw[7] = len_2; + + if (r_idx != 0) + /* Already mucked with r_extern, r_idx. */; + else if (bfd_is_com_section (output_section) + || bfd_is_abs_section (output_section) + || bfd_is_und_section (output_section)) + { + if (bfd_abs_section_ptr->symbol == sym) + { + /* Whoops, looked like an abs symbol, but is really an offset + from the abs section. */ + r_idx = 0; + r_extern = 0; + } + else + { + /* Fill in symbol. */ + r_extern = 1; + r_idx = (*g->sym_ptr_ptr)->udata.i; + } + } + else + { + /* Just an ordinary section. */ + r_extern = 0; + r_idx = output_section->target_index; + } + + if (bfd_header_big_endian (abfd)) + { + raw[4] = (unsigned char) (r_idx >> 16); + raw[5] = (unsigned char) (r_idx >> 8); + raw[6] = (unsigned char) (r_idx ); + } + else + { + raw[6] = (unsigned char) (r_idx >> 16); + raw[5] = (unsigned char) (r_idx>> 8); + raw[4] = (unsigned char) (r_idx ); + } + + if (r_extern) + raw[7] |= extern_mask; + } + + if (bfd_bwrite ((void *) native, natsize, abfd) != natsize) + { + free (native); + return FALSE; + } + + free (native); + + return TRUE; +} + +static bfd_boolean +b_out_write_object_contents (bfd *abfd) { struct external_exec swapped_hdr; bfd_size_type amt; @@ -294,15 +401,13 @@ b_out_write_object_contents (abfd) exec_hdr (abfd)->a_info = BMAGIC; - exec_hdr (abfd)->a_text = obj_textsec (abfd)->_raw_size; - exec_hdr (abfd)->a_data = obj_datasec (abfd)->_raw_size; - exec_hdr (abfd)->a_bss = obj_bsssec (abfd)->_raw_size; - exec_hdr (abfd)->a_syms = bfd_get_symcount (abfd) * sizeof (struct nlist); + exec_hdr (abfd)->a_text = obj_textsec (abfd)->size; + exec_hdr (abfd)->a_data = obj_datasec (abfd)->size; + exec_hdr (abfd)->a_bss = obj_bsssec (abfd)->size; + exec_hdr (abfd)->a_syms = bfd_get_symcount (abfd) * 12; exec_hdr (abfd)->a_entry = bfd_get_start_address (abfd); - exec_hdr (abfd)->a_trsize = ((obj_textsec (abfd)->reloc_count) * - sizeof (struct relocation_info)); - exec_hdr (abfd)->a_drsize = ((obj_datasec (abfd)->reloc_count) * - sizeof (struct relocation_info)); + exec_hdr (abfd)->a_trsize = (obj_textsec (abfd)->reloc_count) * 8; + exec_hdr (abfd)->a_drsize = (obj_datasec (abfd)->reloc_count) * 8; exec_hdr (abfd)->a_talign = obj_textsec (abfd)->alignment_power; exec_hdr (abfd)->a_dalign = obj_datasec (abfd)->alignment_power; @@ -315,7 +420,7 @@ b_out_write_object_contents (abfd) amt = EXEC_BYTES_SIZE; if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 - || bfd_bwrite ((PTR) &swapped_hdr, amt, abfd) != amt) + || bfd_bwrite ((void *) &swapped_hdr, amt, abfd) != amt) return FALSE; /* Now write out reloc info, followed by syms and strings */ @@ -346,20 +451,20 @@ b_out_write_object_contents (abfd) b_out_symbol_cmp); /* Back to your regularly scheduled program. */ - if (bfd_seek (abfd, (file_ptr) (N_SYMOFF(*exec_hdr(abfd))), SEEK_SET) + if (bfd_seek (abfd, (file_ptr) (N_SYMOFF (*exec_hdr (abfd))), SEEK_SET) != 0) return FALSE; if (! aout_32_write_syms (abfd)) return FALSE; - if (bfd_seek (abfd, (file_ptr) (N_TROFF(*exec_hdr(abfd))), SEEK_SET) + if (bfd_seek (abfd, (file_ptr) (N_TROFF (*exec_hdr (abfd))), SEEK_SET) != 0) return FALSE; if (!b_out_squirt_out_relocs (abfd, obj_textsec (abfd))) return FALSE; - if (bfd_seek (abfd, (file_ptr) (N_DROFF(*exec_hdr(abfd))), SEEK_SET) + if (bfd_seek (abfd, (file_ptr) (N_DROFF (*exec_hdr (abfd))), SEEK_SET) != 0) return FALSE; @@ -381,16 +486,64 @@ b_out_write_object_contents (abfd) #define output_addr(sec) ((sec)->output_offset+(sec)->output_section->vma) +static bfd_vma +get_value (arelent *reloc, + struct bfd_link_info *link_info, + asection *input_section) +{ + bfd_vma value; + asymbol *symbol = *(reloc->sym_ptr_ptr); + + /* A symbol holds a pointer to a section, and an offset from the + base of the section. To relocate, we find where the section will + live in the output and add that in. */ + if (bfd_is_und_section (symbol->section)) + { + struct bfd_link_hash_entry *h; + + /* The symbol is undefined in this BFD. Look it up in the + global linker hash table. FIXME: This should be changed when + we convert b.out to use a specific final_link function and + change the interface to bfd_relax_section to not require the + generic symbols. */ + h = bfd_wrapped_link_hash_lookup (input_section->owner, link_info, + bfd_asymbol_name (symbol), + FALSE, FALSE, TRUE); + if (h != (struct bfd_link_hash_entry *) NULL + && (h->type == bfd_link_hash_defined + || h->type == bfd_link_hash_defweak)) + value = h->u.def.value + output_addr (h->u.def.section); + else if (h != (struct bfd_link_hash_entry *) NULL + && h->type == bfd_link_hash_common) + value = h->u.c.size; + else + { + if (! ((*link_info->callbacks->undefined_symbol) + (link_info, bfd_asymbol_name (symbol), + input_section->owner, input_section, reloc->address, + TRUE))) + abort (); + value = 0; + } + } + else + value = symbol->value + output_addr (symbol->section); + + /* Add the value contained in the relocation. */ + value += reloc->addend; + + return value; +} + /* Magic to turn callx into calljx. */ static bfd_reloc_status_type -calljx_callback (abfd, link_info, reloc_entry, src, dst, input_section) - bfd *abfd; - struct bfd_link_info *link_info; - arelent *reloc_entry; - PTR src; - PTR dst; - asection *input_section; +calljx_callback (bfd *abfd, + struct bfd_link_info *link_info, + arelent *reloc_entry, + void * src, + void * dst, + asection *input_section) { int word = bfd_get_32 (abfd, src); asymbol *symbol_in = *(reloc_entry->sym_ptr_ptr); @@ -403,6 +556,7 @@ calljx_callback (abfd, link_info, reloc_entry, src, dst, input_section) { aout_symbol_type *balsym = symbol+1; int inst = bfd_get_32 (abfd, (bfd_byte *) src-4); + /* The next symbol should be an N_BALNAME. */ BFD_ASSERT (IS_BALNAME (balsym->other)); inst &= BALX_MASK; @@ -422,16 +576,14 @@ calljx_callback (abfd, link_info, reloc_entry, src, dst, input_section) /* Magic to turn call into callj. */ static bfd_reloc_status_type -callj_callback (abfd, link_info, reloc_entry, data, srcidx, dstidx, - input_section, shrinking) - bfd *abfd; - struct bfd_link_info *link_info; - arelent *reloc_entry; - PTR data; - unsigned int srcidx; - unsigned int dstidx; - asection *input_section; - bfd_boolean shrinking; +callj_callback (bfd *abfd, + struct bfd_link_info *link_info, + arelent *reloc_entry, + void * data, + unsigned int srcidx, + unsigned int dstidx, + asection *input_section, + bfd_boolean shrinking) { int word = bfd_get_32 (abfd, (bfd_byte *) data + srcidx); asymbol *symbol_in = *(reloc_entry->sym_ptr_ptr); @@ -440,18 +592,17 @@ callj_callback (abfd, link_info, reloc_entry, data, srcidx, dstidx, value = get_value (reloc_entry, link_info, input_section); - if (IS_OTHER(symbol->other)) - { - /* Call to a system procedure - replace code with system - procedure number. */ - word = CALLS | (symbol->other - 1); - } - else if (IS_CALLNAME(symbol->other)) + if (IS_OTHER (symbol->other)) + /* Call to a system procedure - replace code with system + procedure number. */ + word = CALLS | (symbol->other - 1); + + else if (IS_CALLNAME (symbol->other)) { aout_symbol_type *balsym = symbol+1; /* The next symbol should be an N_BALNAME. */ - BFD_ASSERT(IS_BALNAME(balsym->other)); + BFD_ASSERT (IS_BALNAME (balsym->other)); /* We are calling a leaf, so replace the call instruction with a bal. */ @@ -472,65 +623,19 @@ callj_callback (abfd, link_info, reloc_entry, data, srcidx, dstidx, BFD_ASSERT (symbol->symbol.section == input_section); } else - { - word = CALL | (((word & BAL_MASK) - + value - + reloc_entry->addend - - (shrinking ? dstidx : 0) - - output_addr (input_section)) - & BAL_MASK); - } + word = CALL | (((word & BAL_MASK) + + value + + reloc_entry->addend + - (shrinking ? dstidx : 0) + - output_addr (input_section)) + & BAL_MASK); + bfd_put_32 (abfd, (bfd_vma) word, (bfd_byte *) data + dstidx); return bfd_reloc_ok; } -/* type rshift size bitsize pcrel bitpos absolute overflow check*/ - -#define ABS32CODE 0 -#define ABS32CODE_SHRUNK 1 -#define PCREL24 2 -#define CALLJ 3 -#define ABS32 4 -#define PCREL13 5 -#define ABS32_MAYBE_RELAXABLE 1 -#define ABS32_WAS_RELAXABLE 2 - -#define ALIGNER 10 -#define ALIGNDONE 11 -static reloc_howto_type howto_reloc_callj = -HOWTO(CALLJ, 0, 2, 24, TRUE, 0, complain_overflow_signed, 0,"callj", TRUE, 0x00ffffff, 0x00ffffff,FALSE); -static reloc_howto_type howto_reloc_abs32 = -HOWTO(ABS32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,0,"abs32", TRUE, 0xffffffff,0xffffffff,FALSE); -static reloc_howto_type howto_reloc_pcrel24 = -HOWTO(PCREL24, 0, 2, 24, TRUE, 0, complain_overflow_signed,0,"pcrel24", TRUE, 0x00ffffff,0x00ffffff,FALSE); - -static reloc_howto_type howto_reloc_pcrel13 = -HOWTO(PCREL13, 0, 2, 13, TRUE, 0, complain_overflow_signed,0,"pcrel13", TRUE, 0x00001fff,0x00001fff,FALSE); - -static reloc_howto_type howto_reloc_abs32codeshrunk = -HOWTO(ABS32CODE_SHRUNK, 0, 2, 24, TRUE, 0, complain_overflow_signed, 0,"callx->callj", TRUE, 0x00ffffff, 0x00ffffff,FALSE); - -static reloc_howto_type howto_reloc_abs32code = -HOWTO(ABS32CODE, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,0,"callx", TRUE, 0xffffffff,0xffffffff,FALSE); - -static reloc_howto_type howto_align_table[] = { - HOWTO (ALIGNER, 0, 0x1, 0, FALSE, 0, complain_overflow_dont, 0, "align16", FALSE, 0, 0, FALSE), - HOWTO (ALIGNER, 0, 0x3, 0, FALSE, 0, complain_overflow_dont, 0, "align32", FALSE, 0, 0, FALSE), - HOWTO (ALIGNER, 0, 0x7, 0, FALSE, 0, complain_overflow_dont, 0, "align64", FALSE, 0, 0, FALSE), - HOWTO (ALIGNER, 0, 0xf, 0, FALSE, 0, complain_overflow_dont, 0, "align128", FALSE, 0, 0, FALSE), -}; - -static reloc_howto_type howto_done_align_table[] = { - HOWTO (ALIGNDONE, 0x1, 0x1, 0, FALSE, 0, complain_overflow_dont, 0, "donealign16", FALSE, 0, 0, FALSE), - HOWTO (ALIGNDONE, 0x3, 0x3, 0, FALSE, 0, complain_overflow_dont, 0, "donealign32", FALSE, 0, 0, FALSE), - HOWTO (ALIGNDONE, 0x7, 0x7, 0, FALSE, 0, complain_overflow_dont, 0, "donealign64", FALSE, 0, 0, FALSE), - HOWTO (ALIGNDONE, 0xf, 0xf, 0, FALSE, 0, complain_overflow_dont, 0, "donealign128", FALSE, 0, 0, FALSE), -}; - static reloc_howto_type * -b_out_bfd_reloc_type_lookup (abfd, code) - bfd *abfd ATTRIBUTE_UNUSED; - bfd_reloc_code_real_type code; +b_out_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, bfd_reloc_code_real_type code) { switch (code) { @@ -549,12 +654,9 @@ b_out_bfd_reloc_type_lookup (abfd, code) /* Allocate enough room for all the reloc entries, plus pointers to them all. */ static bfd_boolean -b_out_slurp_reloc_table (abfd, asect, symbols) - bfd *abfd; - sec_ptr asect; - asymbol **symbols; +b_out_slurp_reloc_table (bfd *abfd, sec_ptr asect, asymbol **symbols) { - register struct relocation_info *rptr; + struct relocation_info *rptr; unsigned int counter; arelent *cache_ptr; int extern_mask, pcrel_mask, callj_mask, length_shift; @@ -573,37 +675,27 @@ b_out_slurp_reloc_table (abfd, asect, symbols) return FALSE; if (asect == obj_datasec (abfd)) + reloc_size = exec_hdr (abfd)->a_drsize; + else if (asect == obj_textsec (abfd)) + reloc_size = exec_hdr (abfd)->a_trsize; + else if (asect == obj_bsssec (abfd)) + reloc_size = 0; + else { - reloc_size = exec_hdr(abfd)->a_drsize; - goto doit; + bfd_set_error (bfd_error_invalid_operation); + return FALSE; } - if (asect == obj_textsec (abfd)) - { - reloc_size = exec_hdr(abfd)->a_trsize; - goto doit; - } - - if (asect == obj_bsssec (abfd)) - { - reloc_size = 0; - goto doit; - } - - bfd_set_error (bfd_error_invalid_operation); - return FALSE; - - doit: if (bfd_seek (abfd, asect->rel_filepos, SEEK_SET) != 0) return FALSE; count = reloc_size / sizeof (struct relocation_info); - relocs = (struct relocation_info *) bfd_malloc (reloc_size); + relocs = bfd_malloc (reloc_size); if (!relocs && reloc_size != 0) return FALSE; amt = ((bfd_size_type) count + 1) * sizeof (arelent); - reloc_cache = (arelent *) bfd_malloc (amt); + reloc_cache = bfd_malloc (amt); if (!reloc_cache) { if (relocs != NULL) @@ -611,7 +703,7 @@ b_out_slurp_reloc_table (abfd, asect, symbols) return FALSE; } - if (bfd_bread ((PTR) relocs, reloc_size, abfd) != reloc_size) + if (bfd_bread ((void *) relocs, reloc_size, abfd) != reloc_size) { free (reloc_cache); if (relocs != NULL) @@ -716,7 +808,7 @@ b_out_slurp_reloc_table (abfd, asect, symbols) cache_ptr->addend = 0; break; default: - BFD_ASSERT(0); + BFD_ASSERT (FALSE); break; } } @@ -761,9 +853,7 @@ b_out_slurp_reloc_table (abfd, asect, symbols) cursor[1] = tmp; } else - { - prev_addr = cache_ptr->address; - } + prev_addr = cache_ptr->address; } if (relocs != NULL) @@ -774,149 +864,13 @@ b_out_slurp_reloc_table (abfd, asect, symbols) return TRUE; } -static bfd_boolean -b_out_squirt_out_relocs (abfd, section) - bfd *abfd; - asection *section; -{ - arelent **generic; - int r_extern = 0; - int r_idx; - int incode_mask; - int len_1; - unsigned int count = section->reloc_count; - struct relocation_info *native, *natptr; - bfd_size_type natsize; - int extern_mask, pcrel_mask, len_2, callj_mask; - - if (count == 0) - return TRUE; - - generic = section->orelocation; - natsize = (bfd_size_type) count * sizeof (struct relocation_info); - native = ((struct relocation_info *) bfd_malloc (natsize)); - if (!native && natsize != 0) - return FALSE; - - if (bfd_header_big_endian (abfd)) - { - /* Big-endian bit field allocation order. */ - pcrel_mask = 0x80; - extern_mask = 0x10; - len_2 = 0x40; - len_1 = 0x20; - callj_mask = 0x02; - incode_mask = 0x08; - } - else - { - /* Little-endian bit field allocation order. */ - pcrel_mask = 0x01; - extern_mask = 0x08; - len_2 = 0x04; - len_1 = 0x02; - callj_mask = 0x40; - incode_mask = 0x10; - } - - for (natptr = native; count > 0; --count, ++natptr, ++generic) - { - arelent *g = *generic; - unsigned char *raw = (unsigned char *)natptr; - asymbol *sym = *(g->sym_ptr_ptr); - asection *output_section = sym->section->output_section; - - H_PUT_32 (abfd, g->address, raw); - /* Find a type in the output format which matches the input howto - - at the moment we assume input format == output format FIXME!! */ - r_idx = 0; - /* FIXME: Need callj stuff here, and to check the howto entries to - be sure they are real for this architecture. */ - if (g->howto== &howto_reloc_callj) - raw[7] = callj_mask + pcrel_mask + len_2; - else if (g->howto == &howto_reloc_pcrel24) - raw[7] = pcrel_mask + len_2; - else if (g->howto == &howto_reloc_pcrel13) - raw[7] = pcrel_mask + len_1; - else if (g->howto == &howto_reloc_abs32code) - raw[7] = len_2 + incode_mask; - else if (g->howto >= howto_align_table - && g->howto <= (howto_align_table - + sizeof (howto_align_table) / sizeof (howto_align_table[0]) - - 1)) - { - /* symnum == -2; extern_mask not set, pcrel_mask set. */ - r_idx = -2; - r_extern = 0; - raw[7] = (pcrel_mask - | ((g->howto - howto_align_table) << 1)); - } - else - raw[7] = len_2; - - if (r_idx != 0) - /* Already mucked with r_extern, r_idx. */; - else if (bfd_is_com_section (output_section) - || bfd_is_abs_section (output_section) - || bfd_is_und_section (output_section)) - { - if (bfd_abs_section_ptr->symbol == sym) - { - /* Whoops, looked like an abs symbol, but is really an offset - from the abs section. */ - r_idx = 0; - r_extern = 0; - } - else - { - /* Fill in symbol. */ - r_extern = 1; - r_idx = (*g->sym_ptr_ptr)->udata.i; - } - } - else - { - /* Just an ordinary section. */ - r_extern = 0; - r_idx = output_section->target_index; - } - - if (bfd_header_big_endian (abfd)) - { - raw[4] = (unsigned char) (r_idx >> 16); - raw[5] = (unsigned char) (r_idx >> 8); - raw[6] = (unsigned char) (r_idx ); - } - else - { - raw[6] = (unsigned char) (r_idx >> 16); - raw[5] = (unsigned char) (r_idx>> 8); - raw[4] = (unsigned char) (r_idx ); - } - - if (r_extern) - raw[7] |= extern_mask; - } - - if (bfd_bwrite ((PTR) native, natsize, abfd) != natsize) - { - free ((PTR)native); - return FALSE; - } - - free ((PTR)native); - - return TRUE; -} - /* This is stupid. This function should be a boolean predicate. */ static long -b_out_canonicalize_reloc (abfd, section, relptr, symbols) - bfd *abfd; - sec_ptr section; - arelent **relptr; - asymbol **symbols; +b_out_canonicalize_reloc (bfd *abfd, + sec_ptr section, + arelent **relptr, + asymbol **symbols) { arelent *tblptr; unsigned int count; @@ -948,9 +902,7 @@ b_out_canonicalize_reloc (abfd, section, relptr, symbols) } static long -b_out_get_reloc_upper_bound (abfd, asect) - bfd *abfd; - sec_ptr asect; +b_out_get_reloc_upper_bound (bfd *abfd, sec_ptr asect) { if (bfd_get_format (abfd) != bfd_object) { @@ -963,13 +915,13 @@ b_out_get_reloc_upper_bound (abfd, asect) if (asect == obj_datasec (abfd)) return (sizeof (arelent *) * - ((exec_hdr(abfd)->a_drsize / sizeof (struct relocation_info)) - +1)); + ((exec_hdr (abfd)->a_drsize / sizeof (struct relocation_info)) + + 1)); if (asect == obj_textsec (abfd)) return (sizeof (arelent *) * - ((exec_hdr(abfd)->a_trsize / sizeof (struct relocation_info)) - +1)); + ((exec_hdr (abfd)->a_trsize / sizeof (struct relocation_info)) + + 1)); if (asect == obj_bsssec (abfd)) return 0; @@ -980,12 +932,11 @@ b_out_get_reloc_upper_bound (abfd, asect) static bfd_boolean -b_out_set_section_contents (abfd, section, location, offset, count) - bfd *abfd; - asection *section; - const PTR location; - file_ptr offset; - bfd_size_type count; +b_out_set_section_contents (bfd *abfd, + asection *section, + const void * location, + file_ptr offset, + bfd_size_type count) { if (! abfd->output_has_begun) { @@ -993,9 +944,9 @@ b_out_set_section_contents (abfd, section, location, offset, count) if (! aout_32_make_sections (abfd)) return FALSE; - obj_textsec (abfd)->filepos = sizeof (struct internal_exec); - obj_datasec(abfd)->filepos = obj_textsec(abfd)->filepos - + obj_textsec (abfd)->_raw_size; + obj_textsec (abfd)->filepos = sizeof (struct external_exec); + obj_datasec (abfd)->filepos = obj_textsec (abfd)->filepos + + obj_textsec (abfd)->size; } /* Regardless, once we know what we're doing, we might as well get going. */ @@ -1005,16 +956,15 @@ b_out_set_section_contents (abfd, section, location, offset, count) if (count == 0) return TRUE; - return bfd_bwrite ((PTR) location, count, abfd) == count; + return bfd_bwrite ((void *) location, count, abfd) == count; } static bfd_boolean -b_out_set_arch_mach (abfd, arch, machine) - bfd *abfd; - enum bfd_architecture arch; - unsigned long machine; +b_out_set_arch_mach (bfd *abfd, + enum bfd_architecture arch, + unsigned long machine) { - bfd_default_set_arch_mach(abfd, arch, machine); + bfd_default_set_arch_mach (abfd, arch, machine); if (arch == bfd_arch_unknown) /* Unknown machine arch is OK. */ return TRUE; @@ -1040,72 +990,16 @@ b_out_set_arch_mach (abfd, arch, machine) } static int -b_out_sizeof_headers (ignore_abfd, ignore) - bfd *ignore_abfd ATTRIBUTE_UNUSED; - bfd_boolean ignore ATTRIBUTE_UNUSED; +b_out_sizeof_headers (bfd *ignore_abfd ATTRIBUTE_UNUSED, bfd_boolean ignore ATTRIBUTE_UNUSED) { - return sizeof (struct internal_exec); + return sizeof (struct external_exec); } - -static bfd_vma -get_value (reloc, link_info, input_section) - arelent *reloc; - struct bfd_link_info *link_info; - asection *input_section; -{ - bfd_vma value; - asymbol *symbol = *(reloc->sym_ptr_ptr); - - /* A symbol holds a pointer to a section, and an offset from the - base of the section. To relocate, we find where the section will - live in the output and add that in. */ - if (bfd_is_und_section (symbol->section)) - { - struct bfd_link_hash_entry *h; - - /* The symbol is undefined in this BFD. Look it up in the - global linker hash table. FIXME: This should be changed when - we convert b.out to use a specific final_link function and - change the interface to bfd_relax_section to not require the - generic symbols. */ - h = bfd_wrapped_link_hash_lookup (input_section->owner, link_info, - bfd_asymbol_name (symbol), - FALSE, FALSE, TRUE); - if (h != (struct bfd_link_hash_entry *) NULL - && (h->type == bfd_link_hash_defined - || h->type == bfd_link_hash_defweak)) - value = h->u.def.value + output_addr (h->u.def.section); - else if (h != (struct bfd_link_hash_entry *) NULL - && h->type == bfd_link_hash_common) - value = h->u.c.size; - else - { - if (! ((*link_info->callbacks->undefined_symbol) - (link_info, bfd_asymbol_name (symbol), - input_section->owner, input_section, reloc->address, - TRUE))) - abort (); - value = 0; - } - } - else - { - value = symbol->value + output_addr (symbol->section); - } - - /* Add the value contained in the relocation. */ - value += reloc->addend; - - return value; -} - static void -perform_slip (abfd, slip, input_section, value) - bfd *abfd; - unsigned int slip; - asection *input_section; - bfd_vma value; +perform_slip (bfd *abfd, + unsigned int slip, + asection *input_section, + bfd_vma value) { asymbol **s; @@ -1145,12 +1039,11 @@ perform_slip (abfd, slip, input_section, value) If it can, then it changes the amode. */ static int -abs32code (abfd, input_section, r, shrink, link_info) - bfd *abfd; - asection *input_section; - arelent *r; - unsigned int shrink; - struct bfd_link_info *link_info; +abs32code (bfd *abfd, + asection *input_section, + arelent *r, + unsigned int shrink, + struct bfd_link_info *link_info) { bfd_vma value = get_value (r, link_info, input_section); bfd_vma dot = output_addr (input_section) + r->address; @@ -1178,11 +1071,10 @@ abs32code (abfd, input_section, r, shrink, link_info) } static int -aligncode (abfd, input_section, r, shrink) - bfd *abfd; - asection *input_section; - arelent *r; - unsigned int shrink; +aligncode (bfd *abfd, + asection *input_section, + arelent *r, + unsigned int shrink) { bfd_vma dot = output_addr (input_section) + r->address; bfd_vma gap; @@ -1224,19 +1116,17 @@ aligncode (abfd, input_section, r, shrink) } static bfd_boolean -b_out_bfd_relax_section (abfd, i, link_info, again) - bfd *abfd; - asection *i; - struct bfd_link_info *link_info; - bfd_boolean *again; +b_out_bfd_relax_section (bfd *abfd, + asection *i, + struct bfd_link_info *link_info, + bfd_boolean *again) { /* Get enough memory to hold the stuff. */ bfd *input_bfd = i->owner; asection *input_section = i; unsigned int shrink = 0 ; arelent **reloc_vector = NULL; - long reloc_size = bfd_get_reloc_upper_bound (input_bfd, - input_section); + long reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section); if (reloc_size < 0) return FALSE; @@ -1249,7 +1139,7 @@ b_out_bfd_relax_section (abfd, i, link_info, again) { long reloc_count; - reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size); + reloc_vector = bfd_malloc ((bfd_size_type) reloc_size); if (reloc_vector == NULL && reloc_size != 0) goto error_return; @@ -1285,7 +1175,7 @@ b_out_bfd_relax_section (abfd, i, link_info, again) } } } - input_section->_cooked_size = input_section->_raw_size - shrink; + input_section->size -= shrink; if (reloc_vector != NULL) free (reloc_vector); @@ -1297,20 +1187,17 @@ b_out_bfd_relax_section (abfd, i, link_info, again) } static bfd_byte * -b_out_bfd_get_relocated_section_contents (output_bfd, link_info, link_order, - data, relocatable, symbols) - bfd *output_bfd; - struct bfd_link_info *link_info; - struct bfd_link_order *link_order; - bfd_byte *data; - bfd_boolean relocatable; - asymbol **symbols; +b_out_bfd_get_relocated_section_contents (bfd *output_bfd, + struct bfd_link_info *link_info, + struct bfd_link_order *link_order, + bfd_byte *data, + bfd_boolean relocatable, + asymbol **symbols) { /* Get enough memory to hold the stuff. */ bfd *input_bfd = link_order->u.indirect.section->owner; asection *input_section = link_order->u.indirect.section; - long reloc_size = bfd_get_reloc_upper_bound (input_bfd, - input_section); + long reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section); arelent **reloc_vector = NULL; long reloc_count; @@ -1324,18 +1211,16 @@ b_out_bfd_get_relocated_section_contents (output_bfd, link_info, link_order, data, relocatable, symbols); - reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size); + reloc_vector = bfd_malloc ((bfd_size_type) reloc_size); if (reloc_vector == NULL && reloc_size != 0) goto error_return; - input_section->reloc_done = 1; - /* Read in the section. */ BFD_ASSERT (bfd_get_section_contents (input_bfd, input_section, data, (bfd_vma) 0, - input_section->_raw_size)); + input_section->size)); reloc_count = bfd_canonicalize_reloc (input_bfd, input_section, @@ -1366,9 +1251,7 @@ b_out_bfd_get_relocated_section_contents (output_bfd, link_info, link_order, parent++; } else - { - run = link_order->size - dst_address; - } + run = link_order->size - dst_address; /* Copy the bytes. */ for (idx = 0; idx < run; idx++) @@ -1404,7 +1287,7 @@ b_out_bfd_get_relocated_section_contents (output_bfd, link_info, link_order, case ALIGNDONE: BFD_ASSERT (reloc->addend >= src_address); BFD_ASSERT ((bfd_vma) reloc->addend - <= input_section->_raw_size); + <= input_section->size); src_address = reloc->addend; dst_address = ((dst_address + reloc->howto->size) & ~reloc->howto->size); @@ -1476,49 +1359,48 @@ b_out_bfd_get_relocated_section_contents (output_bfd, link_info, link_order, /* Build the transfer vectors for Big and Little-Endian B.OUT files. */ -#define aout_32_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol -#define aout_32_close_and_cleanup aout_32_bfd_free_cached_info - -#define b_out_bfd_link_hash_table_create _bfd_generic_link_hash_table_create -#define b_out_bfd_link_hash_table_free _bfd_generic_link_hash_table_free -#define b_out_bfd_link_add_symbols _bfd_generic_link_add_symbols -#define b_out_bfd_link_just_syms _bfd_generic_link_just_syms -#define b_out_bfd_final_link _bfd_generic_final_link -#define b_out_bfd_link_split_section _bfd_generic_link_split_section -#define b_out_bfd_gc_sections bfd_generic_gc_sections -#define b_out_bfd_merge_sections bfd_generic_merge_sections -#define b_out_bfd_discard_group bfd_generic_discard_group - -#define aout_32_get_section_contents_in_window \ - _bfd_generic_get_section_contents_in_window +#define aout_32_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol +#define aout_32_close_and_cleanup aout_32_bfd_free_cached_info +#define b_out_bfd_link_hash_table_create _bfd_generic_link_hash_table_create +#define b_out_bfd_link_hash_table_free _bfd_generic_link_hash_table_free +#define b_out_bfd_link_add_symbols _bfd_generic_link_add_symbols +#define b_out_bfd_link_just_syms _bfd_generic_link_just_syms +#define b_out_bfd_final_link _bfd_generic_final_link +#define b_out_bfd_link_split_section _bfd_generic_link_split_section +#define b_out_bfd_gc_sections bfd_generic_gc_sections +#define b_out_bfd_merge_sections bfd_generic_merge_sections +#define b_out_bfd_is_group_section bfd_generic_is_group_section +#define b_out_bfd_discard_group bfd_generic_discard_group +#define b_out_section_already_linked _bfd_generic_section_already_linked +#define aout_32_get_section_contents_in_window _bfd_generic_get_section_contents_in_window extern const bfd_target b_out_vec_little_host; const bfd_target b_out_vec_big_host = { - "b.out.big", /* name */ + "b.out.big", /* Name. */ bfd_target_aout_flavour, - BFD_ENDIAN_LITTLE, /* data byte order is little */ - BFD_ENDIAN_BIG, /* hdr byte order is big */ - (HAS_RELOC | EXEC_P | /* object flags */ + BFD_ENDIAN_LITTLE, /* Data byte order. */ + BFD_ENDIAN_BIG, /* Header byte order. */ + (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 | SEC_CODE | SEC_DATA), - '_', /* symbol leading char */ - ' ', /* ar_pad_char */ - 16, /* ar_max_namelen */ + '_', /* Symbol leading char. */ + ' ', /* AR_pad_char. */ + 16, /* 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_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, b_out_object_p, /* bfd_check_format */ + bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Headers. */ + {_bfd_dummy_target, b_out_object_p, /* bfd_check_format. */ bfd_generic_archive_p, _bfd_dummy_target}, - {bfd_false, b_out_mkobject, /* bfd_set_format */ + {bfd_false, b_out_mkobject, /* bfd_set_format. */ _bfd_generic_mkarchive, bfd_false}, - {bfd_false, b_out_write_object_contents, /* bfd_write_contents */ + {bfd_false, b_out_write_object_contents, /* bfd_write_contents. */ _bfd_write_archive_contents, bfd_false}, BFD_JUMP_TABLE_GENERIC (aout_32), @@ -1533,34 +1415,34 @@ const bfd_target b_out_vec_big_host = & b_out_vec_little_host, - (PTR) 0, + NULL }; const bfd_target b_out_vec_little_host = { - "b.out.little", /* name */ + "b.out.little", /* Name. */ bfd_target_aout_flavour, - BFD_ENDIAN_LITTLE, /* data byte order is little */ - BFD_ENDIAN_LITTLE, /* header byte order is little */ - (HAS_RELOC | EXEC_P | /* object flags */ + BFD_ENDIAN_LITTLE, /* Data byte order. */ + BFD_ENDIAN_LITTLE, /* Header byte order. */ + (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 | SEC_CODE | SEC_DATA), - '_', /* symbol leading char */ - ' ', /* ar_pad_char */ - 16, /* ar_max_namelen */ + '_', /* Symbol leading char. */ + ' ', /* AR_pad_char. */ + 16, /* 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_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_getl16, bfd_getl_signed_16, bfd_putl16, /* Headers. */ - {_bfd_dummy_target, b_out_object_p, /* bfd_check_format */ + {_bfd_dummy_target, b_out_object_p, /* bfd_check_format. */ bfd_generic_archive_p, _bfd_dummy_target}, - {bfd_false, b_out_mkobject, /* bfd_set_format */ + {bfd_false, b_out_mkobject, /* bfd_set_format. */ _bfd_generic_mkarchive, bfd_false}, - {bfd_false, b_out_write_object_contents, /* bfd_write_contents */ + {bfd_false, b_out_write_object_contents, /* bfd_write_contents. */ _bfd_write_archive_contents, bfd_false}, BFD_JUMP_TABLE_GENERIC (aout_32), @@ -1575,5 +1457,5 @@ const bfd_target b_out_vec_little_host = & b_out_vec_big_host, - (PTR) 0 + NULL }; diff --git a/contrib/binutils/bfd/cache.c b/contrib/binutils/bfd/cache.c index 7d056ea0cfa..6db6a6b4d56 100644 --- a/contrib/binutils/bfd/cache.c +++ b/contrib/binutils/bfd/cache.c @@ -1,7 +1,7 @@ /* BFD library -- caching of file descriptors. Copyright 1990, 1991, 1992, 1993, 1994, 1996, 2000, 2001, 2002, - 2003, 2004 Free Software Foundation, Inc. + 2003, 2004, 2005 Free Software Foundation, Inc. Hacked by Steve Chamberlain of Cygnus Support (steve@cygnus.com). @@ -19,7 +19,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* SECTION @@ -36,61 +36,44 @@ SECTION close, closes it and opens the one wanted, returning its file handle. +SUBSECTION + Caching functions */ #include "bfd.h" #include "sysdep.h" #include "libbfd.h" +#include "libiberty.h" -static bfd_boolean bfd_cache_delete (bfd *); +/* In some cases we can optimize cache operation when reopening files. + For instance, a flush is entirely unnecessary if the file is already + closed, so a flush would use CACHE_NO_OPEN. Similarly, a seek using + SEEK_SET or SEEK_END need not first seek to the current position. + For stat we ignore seek errors, just in case the file has changed + while we weren't looking. If it has, then it's possible that the + file is shorter and we don't want a seek error to prevent us doing + the stat. */ +enum cache_flag { + CACHE_NORMAL = 0, + CACHE_NO_OPEN = 1, + CACHE_NO_SEEK = 2, + CACHE_NO_SEEK_ERROR = 4 +}; -/* -INTERNAL_FUNCTION - BFD_CACHE_MAX_OPEN macro +/* The maximum number of files which the cache will keep open at + one time. */ -DESCRIPTION - The maximum number of files which the cache will keep open at - one time. - -.#define BFD_CACHE_MAX_OPEN 10 - -*/ +#define BFD_CACHE_MAX_OPEN 10 /* The number of BFD files we have open. */ static int open_files; -/* -INTERNAL_FUNCTION - bfd_last_cache +/* Zero, or a pointer to the topmost BFD on the chain. This is + used by the <> macro in @file{libbfd.h} to + determine when it can avoid a function call. */ -SYNOPSIS - extern bfd *bfd_last_cache; - -DESCRIPTION - Zero, or a pointer to the topmost BFD on the chain. This is - used by the <> macro in @file{libbfd.h} to - determine when it can avoid a function call. -*/ - -bfd *bfd_last_cache; - -/* - INTERNAL_FUNCTION - bfd_cache_lookup - - DESCRIPTION - Check to see if the required BFD is the same as the last one - looked up. If so, then it can use the stream in the BFD with - impunity, since it can't have changed since the last lookup; - otherwise, it has to perform the complicated lookup function. - - .#define bfd_cache_lookup(x) \ - . ((x)==bfd_last_cache? \ - . (FILE*) (bfd_last_cache->iostream): \ - . bfd_cache_lookup_worker(x)) - - */ +static bfd *bfd_last_cache = NULL; /* Insert a BFD into the cache. */ @@ -127,6 +110,29 @@ snip (bfd *abfd) } } +/* Close a BFD and remove it from the cache. */ + +static bfd_boolean +bfd_cache_delete (bfd *abfd) +{ + bfd_boolean ret; + + if (fclose ((FILE *) abfd->iostream) == 0) + ret = TRUE; + else + { + ret = FALSE; + bfd_set_error (bfd_error_system_call); + } + + snip (abfd); + + abfd->iostream = NULL; + --open_files; + + return ret; +} + /* We need to open a new file, and the cache is full. Find the least recently used cacheable BFD and close it. */ @@ -159,32 +165,205 @@ close_one (void) kill->where = real_ftell ((FILE *) kill->iostream); + /* Save the file st_mtime. This is a hack so that gdb can detect when + an executable has been deleted and recreated. The only thing that + makes this reasonable is that st_mtime doesn't change when a file + is unlinked, so saving st_mtime makes BFD's file cache operation + a little more transparent for this particular usage pattern. If we + hadn't closed the file then we would not have lost the original + contents, st_mtime etc. Of course, if something is writing to an + existing file, then this is the wrong thing to do. + FIXME: gdb should save these times itself on first opening a file, + and this hack be removed. */ + if (kill->direction == no_direction || kill->direction == read_direction) + { + bfd_get_mtime (kill); + kill->mtime_set = TRUE; + } + return bfd_cache_delete (kill); } -/* Close a BFD and remove it from the cache. */ +/* Check to see if the required BFD is the same as the last one + looked up. If so, then it can use the stream in the BFD with + impunity, since it can't have changed since the last lookup; + otherwise, it has to perform the complicated lookup function. */ -static bfd_boolean -bfd_cache_delete (bfd *abfd) +#define bfd_cache_lookup(x, flag) \ + ((x) == bfd_last_cache \ + ? (FILE *) (bfd_last_cache->iostream) \ + : bfd_cache_lookup_worker (x, flag)) + +/* Called when the macro <> fails to find a + quick answer. Find a file descriptor for @var{abfd}. If + necessary, it open it. If there are already more than + <> files open, it tries to close one first, to + avoid running out of file descriptors. It will return NULL + if it is unable to (re)open the @var{abfd}. */ + +static FILE * +bfd_cache_lookup_worker (bfd *abfd, enum cache_flag flag) { - bfd_boolean ret; + bfd *orig_bfd = abfd; + if ((abfd->flags & BFD_IN_MEMORY) != 0) + abort (); - if (fclose ((FILE *) abfd->iostream) == 0) - ret = TRUE; - else + if (abfd->my_archive) + abfd = abfd->my_archive; + + if (abfd->iostream != NULL) { - ret = FALSE; - bfd_set_error (bfd_error_system_call); + /* Move the file to the start of the cache. */ + if (abfd != bfd_last_cache) + { + snip (abfd); + insert (abfd); + } + return (FILE *) abfd->iostream; } - snip (abfd); + if (flag & CACHE_NO_OPEN) + return NULL; - abfd->iostream = NULL; - --open_files; + if (bfd_open_file (abfd) == NULL) + ; + else if (!(flag & CACHE_NO_SEEK) + && real_fseek ((FILE *) abfd->iostream, abfd->where, SEEK_SET) != 0 + && !(flag & CACHE_NO_SEEK_ERROR)) + bfd_set_error (bfd_error_system_call); + else + return (FILE *) abfd->iostream; - return ret; + (*_bfd_error_handler) (_("reopening %B: %s\n"), + orig_bfd, bfd_errmsg (bfd_get_error ())); + return NULL; } +static file_ptr +cache_btell (struct bfd *abfd) +{ + FILE *f = bfd_cache_lookup (abfd, CACHE_NO_OPEN); + if (f == NULL) + return abfd->where; + return real_ftell (f); +} + +static int +cache_bseek (struct bfd *abfd, file_ptr offset, int whence) +{ + FILE *f = bfd_cache_lookup (abfd, whence != SEEK_CUR ? CACHE_NO_SEEK : 0); + if (f == NULL) + return -1; + return real_fseek (f, offset, whence); +} + +/* Note that archive entries don't have streams; they share their parent's. + This allows someone to play with the iostream behind BFD's back. + + Also, note that the origin pointer points to the beginning of a file's + contents (0 for non-archive elements). For archive entries this is the + first octet in the file, NOT the beginning of the archive header. */ + +static file_ptr +cache_bread (struct bfd *abfd, void *buf, file_ptr nbytes) +{ + FILE *f; + file_ptr nread; + /* FIXME - this looks like an optimization, but it's really to cover + up for a feature of some OSs (not solaris - sigh) that + ld/pe-dll.c takes advantage of (apparently) when it creates BFDs + internally and tries to link against them. BFD seems to be smart + enough to realize there are no symbol records in the "file" that + doesn't exist but attempts to read them anyway. On Solaris, + attempting to read zero bytes from a NULL file results in a core + dump, but on other platforms it just returns zero bytes read. + This makes it to something reasonable. - DJ */ + if (nbytes == 0) + return 0; + + f = bfd_cache_lookup (abfd, 0); + if (f == NULL) + return 0; + +#if defined (__VAX) && defined (VMS) + /* Apparently fread on Vax VMS does not keep the record length + information. */ + nread = read (fileno (f), buf, nbytes); + /* Set bfd_error if we did not read as much data as we expected. If + the read failed due to an error set the bfd_error_system_call, + else set bfd_error_file_truncated. */ + if (nread == (file_ptr)-1) + { + bfd_set_error (bfd_error_system_call); + return -1; + } +#else + nread = fread (buf, 1, nbytes, f); + /* Set bfd_error if we did not read as much data as we expected. If + the read failed due to an error set the bfd_error_system_call, + else set bfd_error_file_truncated. */ + if (nread < nbytes && ferror (f)) + { + bfd_set_error (bfd_error_system_call); + return -1; + } +#endif + return nread; +} + +static file_ptr +cache_bwrite (struct bfd *abfd, const void *where, file_ptr nbytes) +{ + file_ptr nwrite; + FILE *f = bfd_cache_lookup (abfd, 0); + if (f == NULL) + return 0; + nwrite = fwrite (where, 1, nbytes, f); + if (nwrite < nbytes && ferror (f)) + { + bfd_set_error (bfd_error_system_call); + return -1; + } + return nwrite; +} + +static int +cache_bclose (struct bfd *abfd) +{ + return bfd_cache_close (abfd); +} + +static int +cache_bflush (struct bfd *abfd) +{ + int sts; + FILE *f = bfd_cache_lookup (abfd, CACHE_NO_OPEN); + if (f == NULL) + return 0; + sts = fflush (f); + if (sts < 0) + bfd_set_error (bfd_error_system_call); + return sts; +} + +static int +cache_bstat (struct bfd *abfd, struct stat *sb) +{ + int sts; + FILE *f = bfd_cache_lookup (abfd, CACHE_NO_SEEK_ERROR); + if (f == NULL) + return -1; + sts = fstat (fileno (f), sb); + if (sts < 0) + bfd_set_error (bfd_error_system_call); + return sts; +} + +static const struct bfd_iovec cache_iovec = { + &cache_bread, &cache_bwrite, &cache_btell, &cache_bseek, + &cache_bclose, &cache_bflush, &cache_bstat +}; + /* INTERNAL_FUNCTION bfd_cache_init @@ -205,6 +384,7 @@ bfd_cache_init (bfd *abfd) if (! close_one ()) return FALSE; } + abfd->iovec = &cache_iovec; insert (abfd); ++open_files; return TRUE; @@ -229,13 +409,43 @@ RETURNS bfd_boolean bfd_cache_close (bfd *abfd) { - if (abfd->iostream == NULL - || (abfd->flags & BFD_IN_MEMORY) != 0) + if (abfd->iovec != &cache_iovec) + return TRUE; + + if (abfd->iostream == NULL) + /* Previously closed. */ return TRUE; return bfd_cache_delete (abfd); } +/* +FUNCTION + bfd_cache_close_all + +SYNOPSIS + bfd_boolean bfd_cache_close_all (void); + +DESCRIPTION + Remove all BFDs from the cache. If the attached file is open, + then close it too. + +RETURNS + <> is returned if closing one of the file fails, <> is + returned if all is well. +*/ + +bfd_boolean +bfd_cache_close_all () +{ + bfd_boolean ret = TRUE; + + while (bfd_last_cache != NULL) + ret &= bfd_cache_close (bfd_last_cache); + + return ret; +} + /* INTERNAL_FUNCTION bfd_open_file @@ -266,15 +476,15 @@ bfd_open_file (bfd *abfd) { case read_direction: case no_direction: - abfd->iostream = (PTR) fopen (abfd->filename, FOPEN_RB); + abfd->iostream = (PTR) real_fopen (abfd->filename, FOPEN_RB); break; case both_direction: case write_direction: if (abfd->opened_once) { - abfd->iostream = (PTR) fopen (abfd->filename, FOPEN_RUB); + abfd->iostream = (PTR) real_fopen (abfd->filename, FOPEN_RUB); if (abfd->iostream == NULL) - abfd->iostream = (PTR) fopen (abfd->filename, FOPEN_WUB); + abfd->iostream = (PTR) real_fopen (abfd->filename, FOPEN_WUB); } else { @@ -302,15 +512,17 @@ bfd_open_file (bfd *abfd) struct stat s; if (stat (abfd->filename, &s) == 0 && s.st_size != 0) - unlink (abfd->filename); + unlink_if_ordinary (abfd->filename); #endif - abfd->iostream = (PTR) fopen (abfd->filename, FOPEN_WUB); + abfd->iostream = (PTR) real_fopen (abfd->filename, FOPEN_WUB); abfd->opened_once = TRUE; } break; } - if (abfd->iostream != NULL) + if (abfd->iostream == NULL) + bfd_set_error (bfd_error_system_call); + else { if (! bfd_cache_init (abfd)) return NULL; @@ -318,49 +530,3 @@ bfd_open_file (bfd *abfd) return (FILE *) abfd->iostream; } - -/* -INTERNAL_FUNCTION - bfd_cache_lookup_worker - -SYNOPSIS - FILE *bfd_cache_lookup_worker (bfd *abfd); - -DESCRIPTION - Called when the macro <> fails to find a - quick answer. Find a file descriptor for @var{abfd}. If - necessary, it open it. If there are already more than - <> files open, it tries to close one first, to - avoid running out of file descriptors. -*/ - -FILE * -bfd_cache_lookup_worker (bfd *abfd) -{ - if ((abfd->flags & BFD_IN_MEMORY) != 0) - abort (); - - if (abfd->my_archive) - abfd = abfd->my_archive; - - if (abfd->iostream != NULL) - { - /* Move the file to the start of the cache. */ - if (abfd != bfd_last_cache) - { - snip (abfd); - insert (abfd); - } - } - else - { - if (bfd_open_file (abfd) == NULL) - return NULL; - if (abfd->where != (unsigned long) abfd->where) - return NULL; - if (real_fseek ((FILE *) abfd->iostream, abfd->where, SEEK_SET) != 0) - return NULL; - } - - return (FILE *) abfd->iostream; -} diff --git a/contrib/binutils/bfd/coff-alpha.c b/contrib/binutils/bfd/coff-alpha.c index e9dd4169b22..d9b890502d3 100644 --- a/contrib/binutils/bfd/coff-alpha.c +++ b/contrib/binutils/bfd/coff-alpha.c @@ -1,6 +1,6 @@ /* BFD back-end for ALPHA Extended-Coff files. - Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 - Free Software Foundation, Inc. + Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, + 2003, 2004, 2005 Free Software Foundation, Inc. Modified from coff-mips.c by Steve Chamberlain and Ian Lance Taylor . @@ -18,7 +18,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" @@ -462,8 +462,8 @@ alpha_ecoff_object_p (abfd) bfd_size_type size; size = sec->line_filepos * 8; - BFD_ASSERT (size == bfd_section_size (abfd, sec) - || size + 8 == bfd_section_size (abfd, sec)); + BFD_ASSERT (size == sec->size + || size + 8 == sec->size); if (! bfd_set_section_size (abfd, sec, size)) return NULL; } @@ -481,10 +481,16 @@ alpha_ecoff_bad_format_hook (abfd, filehdr) { struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr; - if (ALPHA_ECOFF_BADMAG (*internal_f)) - return FALSE; + if (! ALPHA_ECOFF_BADMAG (*internal_f)) + return TRUE; - return TRUE; + if (ALPHA_ECOFF_COMPRESSEDMAG (*internal_f)) + (*_bfd_error_handler) + (_("%B: Cannot handle compressed Alpha binaries.\n" + " Use compiler flags, or objZ, to generate uncompressed binaries."), + abfd); + + return FALSE; } /* This is a hook called by coff_real_object_p to create any backend @@ -603,8 +609,11 @@ alpha_ecoff_swap_reloc_out (abfd, intern, dst) size = intern->r_size; } + /* XXX FIXME: The maximum symndx value used to be 14 but this + fails with object files produced by DEC's C++ compiler. + Where does the value 14 (or 15) come from anyway ? */ BFD_ASSERT (intern->r_extern - || (intern->r_symndx >= 0 && intern->r_symndx <= 14)); + || (intern->r_symndx >= 0 && intern->r_symndx <= 15)); H_PUT_64 (abfd, intern->r_vaddr, ext->r_vaddr); H_PUT_32 (abfd, symndx, ext->r_symndx); @@ -632,7 +641,15 @@ alpha_adjust_reloc_in (abfd, intern, rptr) arelent *rptr; { if (intern->r_type > ALPHA_R_GPVALUE) - abort (); + { + (*_bfd_error_handler) + (_("%B: unknown/unsupported relocation type %d"), + abfd, intern->r_type); + bfd_set_error (bfd_error_bad_value); + rptr->addend = 0; + rptr->howto = NULL; + return; + } switch (intern->r_type) { @@ -668,7 +685,7 @@ alpha_adjust_reloc_in (abfd, intern, rptr) case ALPHA_R_OP_STORE: /* The STORE reloc needs the size and offset fields. We store them in the addend. */ - BFD_ASSERT (intern->r_offset <= 256 && intern->r_size <= 256); + BFD_ASSERT (intern->r_offset <= 256); rptr->addend = (intern->r_offset << 8) + intern->r_size; break; @@ -768,6 +785,7 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order, long reloc_count; bfd *output_bfd = relocatable ? abfd : (bfd *) NULL; bfd_vma gp; + bfd_size_type sz; bfd_boolean gp_undefined; bfd_vma stack[RELOC_STACKSIZE]; int tos = 0; @@ -778,14 +796,10 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order, if (reloc_vector == NULL && reloc_size != 0) goto error_return; - if (! bfd_get_section_contents (input_bfd, input_section, data, - (file_ptr) 0, input_section->_raw_size)) + sz = input_section->rawsize ? input_section->rawsize : input_section->size; + if (! bfd_get_section_contents (input_bfd, input_section, data, 0, sz)) goto error_return; - /* The section size is not going to change. */ - 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) @@ -1148,7 +1162,8 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order, break; case bfd_reloc_overflow: if (! ((*link_info->callbacks->reloc_overflow) - (link_info, bfd_asymbol_name (*rel->sym_ptr_ptr), + (link_info, NULL, + bfd_asymbol_name (*rel->sym_ptr_ptr), rel->howto->name, rel->addend, input_bfd, input_section, rel->address))) goto error_return; @@ -1223,23 +1238,6 @@ alpha_bfd_reloc_type_lookup (abfd, code) case BFD_RELOC_64_PCREL: alpha_type = ALPHA_R_SREL64; break; -#if 0 - case ???: - alpha_type = ALPHA_R_OP_PUSH; - break; - case ???: - alpha_type = ALPHA_R_OP_STORE; - break; - case ???: - alpha_type = ALPHA_R_OP_PSUB; - break; - case ???: - alpha_type = ALPHA_R_OP_PRSHIFT; - break; - case ???: - alpha_type = ALPHA_R_GPVALUE; - break; -#endif default: return (reloc_howto_type *) NULL; } @@ -1455,7 +1453,7 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section, amt = sizeof (struct ecoff_section_tdata); lita_sec_data = ((struct ecoff_section_tdata *) bfd_zalloc (input_bfd, amt)); - ecoff_section_data (input_bfd, lita_sec) = lita_sec_data; + lita_sec->used_by_bfd = lita_sec_data; } if (lita_sec_data->gp != 0) @@ -1470,9 +1468,7 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section, bfd_size_type lita_size; lita_vma = lita_sec->output_offset + lita_sec->output_section->vma; - lita_size = lita_sec->_cooked_size; - if (lita_size == 0) - lita_size = lita_sec->_raw_size; + lita_size = lita_sec->size; if (gp == 0 || lita_vma < gp - 0x8000 @@ -1542,8 +1538,26 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section, switch (r_type) { + case ALPHA_R_GPRELHIGH: + (*_bfd_error_handler) + (_("%B: unsupported relocation: ALPHA_R_GPRELHIGH"), + input_bfd); + bfd_set_error (bfd_error_bad_value); + continue; + + case ALPHA_R_GPRELLOW: + (*_bfd_error_handler) + (_("%B: unsupported relocation: ALPHA_R_GPRELLOW"), + input_bfd); + bfd_set_error (bfd_error_bad_value); + continue; + default: - abort (); + (*_bfd_error_handler) + (_("%B: unknown relocation type %d"), + input_bfd, (int) r_type); + bfd_set_error (bfd_error_bad_value); + continue; case ALPHA_R_IGNORE: /* This reloc appears after a GPDISP reloc. On earlier @@ -1965,7 +1979,8 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section, name = bfd_section_name (input_bfd, symndx_to_section[r_symndx]); if (! ((*info->callbacks->reloc_overflow) - (info, name, alpha_howto_table[r_type].name, + (info, NULL, name, + alpha_howto_table[r_type].name, (bfd_vma) 0, input_bfd, input_section, r_vaddr - input_section->vma))) return FALSE; @@ -2359,7 +2374,10 @@ static const struct ecoff_backend_data alpha_ecoff_backend_data = #define _bfd_ecoff_bfd_relax_section bfd_generic_relax_section #define _bfd_ecoff_bfd_gc_sections bfd_generic_gc_sections #define _bfd_ecoff_bfd_merge_sections bfd_generic_merge_sections +#define _bfd_ecoff_bfd_is_group_section bfd_generic_is_group_section #define _bfd_ecoff_bfd_discard_group bfd_generic_discard_group +#define _bfd_ecoff_section_already_linked \ + _bfd_generic_section_already_linked const bfd_target ecoffalpha_little_vec = { diff --git a/contrib/binutils/bfd/coff-arm.c b/contrib/binutils/bfd/coff-arm.c index e51d07d583c..6b83dc7af7f 100644 --- a/contrib/binutils/bfd/coff-arm.c +++ b/contrib/binutils/bfd/coff-arm.c @@ -1,6 +1,6 @@ /* BFD back-end for ARM COFF files. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003 + 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Written by Cygnus Support. @@ -18,14 +18,12 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" #include "libbfd.h" - #include "coff/arm.h" - #include "coff/internal.h" #ifdef COFF_WITH_PE @@ -75,73 +73,10 @@ #endif typedef enum {bunknown, b9, b12, b23} thumb_pcrel_branchtype; -/* some typedefs for holding instructions */ +/* Some typedefs for holding instructions. */ typedef unsigned long int insn32; typedef unsigned short int insn16; - /* Forward declarations for stupid compilers. */ -static bfd_boolean coff_arm_relocate_section - PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, - struct internal_reloc *, struct internal_syment *, asection **)); -static bfd_reloc_status_type aoutarm_fix_pcrel_26_done - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static bfd_reloc_status_type aoutarm_fix_pcrel_26 - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -#ifndef ARM_WINCE -static bfd_reloc_status_type coff_thumb_pcrel_23 - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static bfd_reloc_status_type coff_thumb_pcrel_9 - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static insn32 insert_thumb_branch - PARAMS ((insn32, int)); -#endif -static bfd_reloc_status_type coff_thumb_pcrel_12 - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static bfd_reloc_status_type coff_arm_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static bfd_boolean coff_arm_adjust_symndx - PARAMS ((bfd *, struct bfd_link_info *, bfd *, - asection *, struct internal_reloc *, bfd_boolean *)); -static reloc_howto_type * coff_arm_rtype_to_howto - PARAMS ((bfd *, asection *, struct internal_reloc *, - struct coff_link_hash_entry *, struct internal_syment *, - bfd_vma *)); -static bfd_reloc_status_type coff_thumb_pcrel_common - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **, - thumb_pcrel_branchtype)); -static const struct reloc_howto_struct * coff_arm_reloc_type_lookup - PARAMS ((bfd *, bfd_reloc_code_real_type)); -static struct bfd_link_hash_table * coff_arm_link_hash_table_create - PARAMS ((bfd *)); -static struct coff_link_hash_entry * find_thumb_glue - PARAMS ((struct bfd_link_info *, const char *, bfd *)); -static struct coff_link_hash_entry * find_arm_glue - PARAMS ((struct bfd_link_info *, const char *, bfd *)); -#ifndef COFF_IMAGE_WITH_PE -static void record_arm_to_thumb_glue - PARAMS ((struct bfd_link_info *, struct coff_link_hash_entry *)); -#ifndef ARM_WINCE -static void record_thumb_to_arm_glue - PARAMS ((struct bfd_link_info *, struct coff_link_hash_entry *)); -#endif -#endif -static bfd_boolean coff_arm_merge_private_bfd_data - PARAMS ((bfd *, bfd *)); -static bfd_boolean coff_arm_print_private_bfd_data - PARAMS ((bfd *, PTR)); -static bfd_boolean _bfd_coff_arm_set_private_flags - PARAMS ((bfd *, flagword)); -static bfd_boolean coff_arm_copy_private_bfd_data - PARAMS ((bfd *, bfd *)); -static bfd_boolean coff_arm_is_local_label_name - PARAMS ((bfd *, const char *)); -static bfd_boolean coff_arm_link_output_has_begun - PARAMS ((bfd *, struct coff_final_link_info *)); -static bfd_boolean coff_arm_final_link_postscript - PARAMS ((bfd *, struct coff_final_link_info *)); -static void arm_emit_base_file_entry - PARAMS ((struct bfd_link_info *, bfd *, asection *, bfd_vma)); - /* The linker script knows the section names for placement. The entry_names are used to do simple name mangling on the stubs. Given a function name, and its type, the stub can be found. The @@ -156,18 +91,17 @@ static void arm_emit_base_file_entry /* Used by the assembler. */ static bfd_reloc_status_type -coff_arm_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, - error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol ATTRIBUTE_UNUSED; - PTR data; - asection *input_section ATTRIBUTE_UNUSED; - bfd *output_bfd; - char **error_message ATTRIBUTE_UNUSED; +coff_arm_reloc (bfd *abfd, + arelent *reloc_entry, + asymbol *symbol ATTRIBUTE_UNUSED, + void * data, + asection *input_section ATTRIBUTE_UNUSED, + bfd *output_bfd, + char **error_message ATTRIBUTE_UNUSED) { symvalue diff; - if (output_bfd == (bfd *) NULL) + + if (output_bfd == NULL) return bfd_reloc_continue; diff = reloc_entry->addend; @@ -237,7 +171,7 @@ coff_arm_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, #define ARM_DISP16 5 #define ARM_DISP32 6 #define ARM_26D 7 -/* 8 is unused */ +/* 8 is unused. */ #define ARM_NEG16 9 #define ARM_NEG32 10 #define ARM_RVA32 11 @@ -261,6 +195,19 @@ coff_arm_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, #define ARM_SECREL 15 #endif +static bfd_reloc_status_type aoutarm_fix_pcrel_26_done + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); +static bfd_reloc_status_type aoutarm_fix_pcrel_26 + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); +static bfd_reloc_status_type coff_thumb_pcrel_12 + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); +#ifndef ARM_WINCE +static bfd_reloc_status_type coff_thumb_pcrel_9 + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); +static bfd_reloc_status_type coff_thumb_pcrel_23 + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); +#endif + static reloc_howto_type aoutarm_std_reloc_howto[] = { #ifdef ARM_WINCE @@ -365,19 +312,19 @@ static reloc_howto_type aoutarm_std_reloc_howto[] = 0xffffffff, PCRELOFFSET), #else /* not ARM_WINCE */ - HOWTO (ARM_8, /* type */ - 0, /* rightshift */ - 0, /* size */ - 8, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - coff_arm_reloc, /* special_function */ - "ARM_8", /* name */ - TRUE, /* partial_inplace */ - 0x000000ff, /* src_mask */ - 0x000000ff, /* dst_mask */ - PCRELOFFSET /* pcrel_offset */), + HOWTO (ARM_8, + 0, + 0, + 8, + FALSE, + 0, + complain_overflow_bitfield, + coff_arm_reloc, + "ARM_8", + TRUE, + 0x000000ff, + 0x000000ff, + PCRELOFFSET), HOWTO (ARM_16, 0, 1, @@ -555,14 +502,12 @@ static reloc_howto_type aoutarm_std_reloc_howto[] = #define NUM_RELOCS NUM_ELEM (aoutarm_std_reloc_howto) #ifdef COFF_WITH_PE -static bfd_boolean in_reloc_p PARAMS ((bfd *, reloc_howto_type *)); /* Return TRUE if this relocation should appear in the output .reloc section. */ static bfd_boolean -in_reloc_p (abfd, howto) - bfd * abfd ATTRIBUTE_UNUSED; - reloc_howto_type * howto; +in_reloc_p (bfd * abfd ATTRIBUTE_UNUSED, + reloc_howto_type * howto) { return !howto->pc_relative && howto->type != ARM_RVA32; } @@ -577,13 +522,12 @@ in_reloc_p (abfd, howto) #define coff_rtype_to_howto coff_arm_rtype_to_howto static reloc_howto_type * -coff_arm_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 ATTRIBUTE_UNUSED; - struct internal_syment *sym ATTRIBUTE_UNUSED; - bfd_vma *addendp; +coff_arm_rtype_to_howto (bfd *abfd ATTRIBUTE_UNUSED, + asection *sec, + struct internal_reloc *rel, + struct coff_link_hash_entry *h ATTRIBUTE_UNUSED, + struct internal_syment *sym ATTRIBUTE_UNUSED, + bfd_vma *addendp) { reloc_howto_type * howto; @@ -601,15 +545,13 @@ coff_arm_rtype_to_howto (abfd, sec, rel, h, sym, addendp) /* Used by the assembler. */ static bfd_reloc_status_type -aoutarm_fix_pcrel_26_done (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; +aoutarm_fix_pcrel_26_done (bfd *abfd ATTRIBUTE_UNUSED, + arelent *reloc_entry ATTRIBUTE_UNUSED, + asymbol *symbol ATTRIBUTE_UNUSED, + void * data ATTRIBUTE_UNUSED, + asection *input_section ATTRIBUTE_UNUSED, + bfd *output_bfd ATTRIBUTE_UNUSED, + char **error_message ATTRIBUTE_UNUSED) { /* This is dead simple at present. */ return bfd_reloc_ok; @@ -618,15 +560,13 @@ aoutarm_fix_pcrel_26_done (abfd, reloc_entry, symbol, data, input_section, /* Used by the assembler. */ static bfd_reloc_status_type -aoutarm_fix_pcrel_26 (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message ATTRIBUTE_UNUSED; +aoutarm_fix_pcrel_26 (bfd *abfd, + arelent *reloc_entry, + asymbol *symbol, + void * data, + asection *input_section, + bfd *output_bfd, + char **error_message ATTRIBUTE_UNUSED) { bfd_vma relocation; bfd_size_type addr = reloc_entry->address; @@ -678,16 +618,14 @@ aoutarm_fix_pcrel_26 (abfd, reloc_entry, symbol, data, input_section, } static bfd_reloc_status_type -coff_thumb_pcrel_common (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message, btype) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message ATTRIBUTE_UNUSED; - thumb_pcrel_branchtype btype; +coff_thumb_pcrel_common (bfd *abfd, + arelent *reloc_entry, + asymbol *symbol, + void * data, + asection *input_section, + bfd *output_bfd, + char **error_message ATTRIBUTE_UNUSED, + thumb_pcrel_branchtype btype) { bfd_vma relocation = 0; bfd_size_type addr = reloc_entry->address; @@ -699,7 +637,6 @@ coff_thumb_pcrel_common (abfd, reloc_entry, symbol, data, input_section, /* NOTE: This routine is currently used by GAS, but not by the link phase. */ - switch (btype) { case b9: @@ -807,15 +744,13 @@ coff_thumb_pcrel_common (abfd, reloc_entry, symbol, data, input_section, #ifndef ARM_WINCE static bfd_reloc_status_type -coff_thumb_pcrel_23 (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; +coff_thumb_pcrel_23 (bfd *abfd, + arelent *reloc_entry, + asymbol *symbol, + void * data, + asection *input_section, + bfd *output_bfd, + char **error_message) { return coff_thumb_pcrel_common (abfd, reloc_entry, symbol, data, input_section, output_bfd, error_message, @@ -823,15 +758,13 @@ coff_thumb_pcrel_23 (abfd, reloc_entry, symbol, data, input_section, } static bfd_reloc_status_type -coff_thumb_pcrel_9 (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; +coff_thumb_pcrel_9 (bfd *abfd, + arelent *reloc_entry, + asymbol *symbol, + void * data, + asection *input_section, + bfd *output_bfd, + char **error_message) { return coff_thumb_pcrel_common (abfd, reloc_entry, symbol, data, input_section, output_bfd, error_message, @@ -840,15 +773,13 @@ coff_thumb_pcrel_9 (abfd, reloc_entry, symbol, data, input_section, #endif /* not ARM_WINCE */ static bfd_reloc_status_type -coff_thumb_pcrel_12 (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; +coff_thumb_pcrel_12 (bfd *abfd, + arelent *reloc_entry, + asymbol *symbol, + void * data, + asection *input_section, + bfd *output_bfd, + char **error_message) { return coff_thumb_pcrel_common (abfd, reloc_entry, symbol, data, input_section, output_bfd, error_message, @@ -856,9 +787,7 @@ coff_thumb_pcrel_12 (abfd, reloc_entry, symbol, data, input_section, } static const struct reloc_howto_struct * -coff_arm_reloc_type_lookup (abfd, code) - bfd * abfd; - bfd_reloc_code_real_type code; +coff_arm_reloc_type_lookup (bfd * abfd, bfd_reloc_code_real_type code) { #define ASTD(i,j) case i: return aoutarm_std_reloc_howto + j @@ -869,7 +798,7 @@ coff_arm_reloc_type_lookup (abfd, code) code = BFD_RELOC_32; break; default: - return (const struct reloc_howto_struct *) 0; + return NULL; } switch (code) @@ -894,17 +823,17 @@ coff_arm_reloc_type_lookup (abfd, code) ASTD (BFD_RELOC_THUMB_PCREL_BRANCH23, ARM_THUMB23); ASTD (BFD_RELOC_THUMB_PCREL_BLX, ARM_THUMB23); #endif - default: return (const struct reloc_howto_struct *) 0; + default: return NULL; } } -#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2) -#define COFF_PAGE_SIZE 0x1000 -/* Turn a howto into a reloc nunmber */ +#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER 2 +#define COFF_PAGE_SIZE 0x1000 +/* Turn a howto into a reloc nunmber. */ #define SELECT_RELOC(x,howto) { x.r_type = howto->type; } -#define BADMAG(x) ARMBADMAG(x) -#define ARM 1 /* Customize coffcode.h */ +#define BADMAG(x) ARMBADMAG(x) +#define ARM 1 /* Customize coffcode.h. */ #ifndef ARM_WINCE /* Make sure that the 'r_offset' field is copied properly @@ -941,21 +870,22 @@ struct coff_arm_link_hash_table /* Create an ARM coff linker hash table. */ static struct bfd_link_hash_table * -coff_arm_link_hash_table_create (abfd) - bfd * abfd; +coff_arm_link_hash_table_create (bfd * abfd) { struct coff_arm_link_hash_table * ret; bfd_size_type amt = sizeof (struct coff_arm_link_hash_table); - ret = (struct coff_arm_link_hash_table *) bfd_malloc (amt); - if (ret == (struct coff_arm_link_hash_table *) NULL) + ret = bfd_malloc (amt); + if (ret == NULL) return NULL; - if (! _bfd_coff_link_hash_table_init - (& ret->root, abfd, _bfd_coff_link_hash_newfunc)) + if (!_bfd_coff_link_hash_table_init (&ret->root, + abfd, + _bfd_coff_link_hash_newfunc, + sizeof (struct coff_link_hash_entry))) { free (ret); - return (struct bfd_link_hash_table *) NULL; + return NULL; } ret->thumb_glue_size = 0; @@ -966,11 +896,10 @@ coff_arm_link_hash_table_create (abfd) } static void -arm_emit_base_file_entry (info, output_bfd, input_section, reloc_offset) - struct bfd_link_info *info; - bfd *output_bfd; - asection *input_section; - bfd_vma reloc_offset; +arm_emit_base_file_entry (struct bfd_link_info *info, + bfd *output_bfd, + asection *input_section, + bfd_vma reloc_offset) { bfd_vma addr = reloc_offset - input_section->vma @@ -1016,18 +945,16 @@ arm_emit_base_file_entry (info, output_bfd, input_section, reloc_offset) #define HI_LOW_ORDER 0xF000F800 static insn32 -insert_thumb_branch (br_insn, rel_off) - insn32 br_insn; - int rel_off; +insert_thumb_branch (insn32 br_insn, int rel_off) { unsigned int low_bits; unsigned int high_bits; - BFD_ASSERT((rel_off & 1) != 1); + BFD_ASSERT ((rel_off & 1) != 1); - rel_off >>= 1; /* half word aligned address */ - low_bits = rel_off & 0x000007FF; /* the bottom 11 bits */ - high_bits = (rel_off >> 11) & 0x000007FF; /* the top 11 bits */ + rel_off >>= 1; /* Half word aligned address. */ + low_bits = rel_off & 0x000007FF; /* The bottom 11 bits. */ + high_bits = (rel_off >> 11) & 0x000007FF; /* The top 11 bits. */ if ((br_insn & LOW_HI_ORDER) == LOW_HI_ORDER) br_insn = LOW_HI_ORDER | (low_bits << 16) | high_bits; @@ -1043,16 +970,15 @@ insert_thumb_branch (br_insn, rel_off) static struct coff_link_hash_entry * -find_thumb_glue (info, name, input_bfd) - struct bfd_link_info *info; - const char *name; - bfd *input_bfd; +find_thumb_glue (struct bfd_link_info *info, + const char *name, + bfd *input_bfd) { char *tmp_name; struct coff_link_hash_entry *myh; bfd_size_type amt = strlen (name) + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1; - tmp_name = (char *) bfd_malloc (amt); + tmp_name = bfd_malloc (amt); BFD_ASSERT (tmp_name); @@ -1063,8 +989,8 @@ find_thumb_glue (info, name, input_bfd) if (myh == NULL) /* xgettext:c-format */ - _bfd_error_handler (_("%s: unable to find THUMB glue '%s' for `%s'"), - bfd_archive_filename (input_bfd), tmp_name, name); + _bfd_error_handler (_("%B: unable to find THUMB glue '%s' for `%s'"), + input_bfd, tmp_name, name); free (tmp_name); @@ -1073,16 +999,15 @@ find_thumb_glue (info, name, input_bfd) #endif /* not ARM_WINCE */ static struct coff_link_hash_entry * -find_arm_glue (info, name, input_bfd) - struct bfd_link_info *info; - const char *name; - bfd *input_bfd; +find_arm_glue (struct bfd_link_info *info, + const char *name, + bfd *input_bfd) { char *tmp_name; struct coff_link_hash_entry * myh; bfd_size_type amt = strlen (name) + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1; - tmp_name = (char *) bfd_malloc (amt); + tmp_name = bfd_malloc (amt); BFD_ASSERT (tmp_name); @@ -1093,8 +1018,8 @@ find_arm_glue (info, name, input_bfd) if (myh == NULL) /* xgettext:c-format */ - _bfd_error_handler (_("%s: unable to find ARM glue '%s' for `%s'"), - bfd_archive_filename (input_bfd), tmp_name, name); + _bfd_error_handler (_("%B: unable to find ARM glue '%s' for `%s'"), + input_bfd, tmp_name, name); free (tmp_name); @@ -1136,6 +1061,7 @@ static const insn32 a2t3_func_addr_insn = 0x00000001; */ #define THUMB2ARM_GLUE_SIZE (globals->support_old_code ? 20 : 8) +#ifndef ARM_WINCE static const insn16 t2a1_bx_pc_insn = 0x4778; static const insn16 t2a2_noop_insn = 0x46c0; static const insn32 t2a3_b_insn = 0xea000000; @@ -1146,6 +1072,7 @@ static const insn16 t2a3_mov_insn = 0x46fe; static const insn16 t2a4_bx_insn = 0x4730; static const insn32 t2a5_pop_insn = 0xe8bd4040; static const insn32 t2a6_bx_insn = 0xe12fff1e; +#endif /* TODO: We should really create new local (static) symbols in destination @@ -1189,19 +1116,20 @@ static const insn32 t2a6_bx_insn = 0xe12fff1e; is different from the original. */ static bfd_boolean -coff_arm_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; +coff_arm_relocate_section (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; +#ifndef ARM_WINCE + bfd_vma high_address = bfd_get_section_limit (input_bfd, input_section); +#endif rel = relocs; relend = rel + input_section->reloc_count; @@ -1278,7 +1206,7 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section, addend -= rel->r_vaddr - input_section->vma; #ifdef ARM_WINCE /* FIXME: I don't know why, but the hack is necessary for correct - generation of bl's instruction offset. */ + generation of bl's instruction offset. */ addend -= 8; #endif howto = &fake_arm26_reloc; @@ -1287,11 +1215,6 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section, #ifdef ARM_WINCE /* MS ARM-CE makes the reloc relative to the opcode's pc, not the next opcode's pc, so is off by one. */ -#if 0 /* This appears to have been true for WINCE 2.0, but it is not - true for WINCE 3.0. */ - if (howto->pc_relative && !info->relocatable) - addend -= 8; -#endif #endif /* If we are doing a relocatable link, then we can just ignore @@ -1341,7 +1264,6 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section, } else { -#if 1 /* THUMBEXTENSION */ /* We don't output the stubs if we are generating a relocatable output file, since we may as well leave the stub generation to the final linker pass. If we fail to @@ -1394,16 +1316,11 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section, if (h_sec->owner != NULL && INTERWORK_SET (h_sec->owner) && ! INTERWORK_FLAG (h_sec->owner)) - { - _bfd_error_handler - /* xgettext:c-format */ - (_("%s(%s): warning: interworking not enabled."), - bfd_archive_filename (h_sec->owner), name); - _bfd_error_handler - /* xgettext:c-format */ - (_(" first occurrence: %s: arm call to thumb"), - bfd_archive_filename (input_bfd)); - } + _bfd_error_handler + /* xgettext:c-format */ + (_("%B(%s): warning: interworking not enabled.\n" + " first occurrence: %B: arm call to thumb"), + h_sec->owner, input_bfd, name); --my_offset; myh->root.u.def.value = my_offset; @@ -1457,7 +1374,7 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section, || h->class == C_STAT || h->class == C_LABEL) { - /* Thumb code calling an ARM function */ + /* Thumb code calling an ARM function. */ asection * s = 0; bfd_vma my_offset; unsigned long int tmp; @@ -1489,18 +1406,12 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section, && INTERWORK_SET (h_sec->owner) && ! INTERWORK_FLAG (h_sec->owner) && ! globals->support_old_code) - { - _bfd_error_handler - /* xgettext:c-format */ - (_("%s(%s): warning: interworking not enabled."), - bfd_archive_filename (h_sec->owner), name); - _bfd_error_handler - /* xgettext:c-format */ - (_(" first occurrence: %s: thumb call to arm"), - bfd_archive_filename (input_bfd)); - _bfd_error_handler - (_(" consider relinking with --support-old-code enabled")); - } + _bfd_error_handler + /* xgettext:c-format */ + (_("%B(%s): warning: interworking not enabled.\n" + " first occurrence: %B: thumb call to arm\n" + " consider relinking with --support-old-code enabled"), + h_sec->owner, input_bfd, name); -- my_offset; myh->root.u.def.value = my_offset; @@ -1542,13 +1453,19 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section, s->contents + my_offset + 2); ret_offset = - ((bfd_signed_vma) h_val) /* Address of destination of the stub. */ + /* Address of destination of the stub. */ + ((bfd_signed_vma) h_val) - ((bfd_signed_vma) - (s->output_offset /* Offset from the start of the current section to the start of the stubs. */ - + my_offset /* Offset of the start of this stub from the start of the stubs. */ - + s->output_section->vma) /* Address of the start of the current section. */ - + 4 /* The branch instruction is 4 bytes into the stub. */ - + 8); /* ARM branches work from the pc of the instruction + 8. */ + /* Offset from the start of the current section to the start of the stubs. */ + (s->output_offset + /* Offset of the start of this stub from the start of the stubs. */ + + my_offset + /* Address of the start of the current section. */ + + s->output_section->vma) + /* The branch instruction is 4 bytes into the stub. */ + + 4 + /* ARM branches work from the pc of the instruction + 8. */ + + 8); bfd_put_32 (output_bfd, (bfd_vma) t2a3_b_insn | ((ret_offset >> 2) & 0x00FFFFFF), @@ -1589,7 +1506,6 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section, if (done) rstat = bfd_reloc_ok; else -#endif /* THUMBEXTENSION */ if ( h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak) { @@ -1618,11 +1534,10 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section, rel->r_vaddr); } -#if 1 /* THUMBEXTENSION */ if (done) rstat = bfd_reloc_ok; #ifndef ARM_WINCE - /* Only perform this fix during the final link, not a relocatable link. nickc@cygnus.com */ + /* Only perform this fix during the final link, not a relocatable link. */ else if (! info->relocatable && howto->type == ARM_THUMB23) { @@ -1636,7 +1551,7 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section, bfd_vma address = rel->r_vaddr - input_section->vma; - if (address > input_section->_raw_size) + if (address > high_address) rstat = bfd_reloc_outofrange; else { @@ -1739,7 +1654,6 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section, } #endif else -#endif /* THUMBEXTENSION */ if (info->relocatable && ! howto->partial_inplace) rstat = bfd_reloc_ok; else @@ -1747,17 +1661,12 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section, contents, rel->r_vaddr - input_section->vma, val, addend); -#if 1 /* THUMBEXTENSION */ - /* FIXME: - Is this the best way to fix up thumb addresses? krk@cygnus.com - Probably not, but it works, and if it works it don't need fixing! nickc@cygnus.com */ - /* Only perform this fix during the final link, not a relocatable link. nickc@cygnus.com */ + /* Only perform this fix during the final link, not a relocatable link. */ if (! info->relocatable && (rel->r_type == ARM_32 || rel->r_type == ARM_RVA32)) { /* Determine if we need to set the bottom bit of a relocated address because the address is the address of a Thumb code symbol. */ - int patchit = FALSE; if (h != NULL @@ -1770,7 +1679,6 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section, && sym->n_scnum > N_UNDEF) { /* No hash entry - use the symbol instead. */ - if ( sym->n_sclass == C_THUMBSTATFUNC || sym->n_sclass == C_THUMBEXTFUNC) patchit = TRUE; @@ -1784,7 +1692,6 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section, bfd_put_32 (input_bfd, x | 1, location); } } -#endif /* THUMBEXTENSION */ switch (rstat) { @@ -1794,10 +1701,8 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section, break; case bfd_reloc_outofrange: (*_bfd_error_handler) - (_("%s: bad reloc address 0x%lx in section `%s'"), - bfd_archive_filename (input_bfd), - (unsigned long) rel->r_vaddr, - bfd_get_section_name (input_bfd, input_section)); + (_("%B: bad reloc address 0x%lx in section `%A'"), + input_bfd, input_section, (unsigned long) rel->r_vaddr); return FALSE; case bfd_reloc_overflow: { @@ -1807,7 +1712,7 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section, if (symndx == -1) name = "*ABS*"; else if (h != NULL) - name = h->root.root.string; + name = NULL; else { name = _bfd_coff_internal_syment_name (input_bfd, sym, buf); @@ -1816,8 +1721,9 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section, } if (! ((*info->callbacks->reloc_overflow) - (info, name, howto->name, (bfd_vma) 0, input_bfd, - input_section, rel->r_vaddr - input_section->vma))) + (info, (h ? &h->root : NULL), name, howto->name, + (bfd_vma) 0, input_bfd, input_section, + rel->r_vaddr - input_section->vma))) return FALSE; } } @@ -1829,15 +1735,11 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section, #ifndef COFF_IMAGE_WITH_PE bfd_boolean -bfd_arm_allocate_interworking_sections (info) - struct bfd_link_info * info; +bfd_arm_allocate_interworking_sections (struct bfd_link_info * info) { asection * s; bfd_byte * foo; struct coff_arm_link_hash_table * globals; -#if 0 - static char test_char = '1'; -#endif globals = coff_arm_hash_table (info); @@ -1852,13 +1754,9 @@ bfd_arm_allocate_interworking_sections (info) BFD_ASSERT (s != NULL); - foo = (bfd_byte *) bfd_alloc (globals->bfd_of_glue_owner, - globals->arm_glue_size); -#if 0 - memset (foo, test_char, (size_t) globals->arm_glue_size); -#endif + foo = bfd_alloc (globals->bfd_of_glue_owner, globals->arm_glue_size); - s->_raw_size = s->_cooked_size = globals->arm_glue_size; + s->size = globals->arm_glue_size; s->contents = foo; } @@ -1871,13 +1769,9 @@ bfd_arm_allocate_interworking_sections (info) BFD_ASSERT (s != NULL); - foo = (bfd_byte *) bfd_alloc (globals->bfd_of_glue_owner, - globals->thumb_glue_size); -#if 0 - memset (foo, test_char, (size_t) globals->thumb_glue_size); -#endif + foo = bfd_alloc (globals->bfd_of_glue_owner, globals->thumb_glue_size); - s->_raw_size = s->_cooked_size = globals->thumb_glue_size; + s->size = globals->thumb_glue_size; s->contents = foo; } @@ -1885,9 +1779,8 @@ bfd_arm_allocate_interworking_sections (info) } static void -record_arm_to_thumb_glue (info, h) - struct bfd_link_info * info; - struct coff_link_hash_entry * h; +record_arm_to_thumb_glue (struct bfd_link_info * info, + struct coff_link_hash_entry * h) { const char * name = h->root.root.string; register asection * s; @@ -1909,7 +1802,7 @@ record_arm_to_thumb_glue (info, h) BFD_ASSERT (s != NULL); amt = strlen (name) + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1; - tmp_name = (char *) bfd_malloc (amt); + tmp_name = bfd_malloc (amt); BFD_ASSERT (tmp_name); @@ -1921,13 +1814,13 @@ record_arm_to_thumb_glue (info, h) if (myh != NULL) { free (tmp_name); - return; /* we've already seen this guy */ + /* We've already seen this guy. */ + return; } /* The only trick here is using globals->arm_glue_size as the value. Even though the section isn't allocated yet, this is where we will be putting it. */ - bh = NULL; val = globals->arm_glue_size + 1; bfd_coff_link_add_one_symbol (info, globals->bfd_of_glue_owner, tmp_name, @@ -1942,12 +1835,11 @@ record_arm_to_thumb_glue (info, h) #ifndef ARM_WINCE static void -record_thumb_to_arm_glue (info, h) - struct bfd_link_info * info; - struct coff_link_hash_entry * h; +record_thumb_to_arm_glue (struct bfd_link_info * info, + struct coff_link_hash_entry * h) { const char * name = h->root.root.string; - register asection * s; + asection * s; char * tmp_name; struct coff_link_hash_entry * myh; struct bfd_link_hash_entry * bh; @@ -1966,7 +1858,7 @@ record_thumb_to_arm_glue (info, h) BFD_ASSERT (s != NULL); amt = strlen (name) + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1; - tmp_name = (char *) bfd_malloc (amt); + tmp_name = bfd_malloc (amt); BFD_ASSERT (tmp_name); @@ -1978,7 +1870,8 @@ record_thumb_to_arm_glue (info, h) if (myh != NULL) { free (tmp_name); - return; /* we've already seen this guy */ + /* We've already seen this guy. */ + return; } bh = NULL; @@ -1998,7 +1891,7 @@ record_thumb_to_arm_glue (info, h) #define BACK_FROM_ARM "__%s_back_from_arm" amt = strlen (name) + strlen (CHANGE_TO_ARM) + 1; - tmp_name = (char *) bfd_malloc (amt); + tmp_name = bfd_malloc (amt); BFD_ASSERT (tmp_name); @@ -2022,9 +1915,8 @@ record_thumb_to_arm_glue (info, h) {armcoff/pe}.em */ bfd_boolean -bfd_arm_get_bfd_for_interworking (abfd, info) - bfd * abfd; - struct bfd_link_info * info; +bfd_arm_get_bfd_for_interworking (bfd * abfd, + struct bfd_link_info * info) { struct coff_arm_link_hash_table * globals; flagword flags; @@ -2077,10 +1969,9 @@ bfd_arm_get_bfd_for_interworking (abfd, info) } bfd_boolean -bfd_arm_process_before_allocation (abfd, info, support_old_code) - bfd * abfd; - struct bfd_link_info * info; - int support_old_code; +bfd_arm_process_before_allocation (bfd * abfd, + struct bfd_link_info * info, + int support_old_code) { asection * sec; struct coff_arm_link_hash_table * globals; @@ -2092,7 +1983,6 @@ bfd_arm_process_before_allocation (abfd, info, support_old_code) /* Here we have a bfd that is to be included on the link. We have a hook to do reloc rummaging, before section sizes are nailed down. */ - _bfd_coff_get_external_symbols (abfd); globals = coff_arm_hash_table (info); @@ -2118,7 +2008,6 @@ bfd_arm_process_before_allocation (abfd, info, support_old_code) /* Load the relocs. */ /* FIXME: there may be a storage leak here. */ - i = _bfd_coff_read_internal_relocs (abfd, sec, 1, 0, 0, 0); BFD_ASSERT (i != 0); @@ -2138,8 +2027,8 @@ bfd_arm_process_before_allocation (abfd, info, support_old_code) /* If the index is outside of the range of our table, something has gone wrong. */ if (symndx >= obj_conv_table_size (abfd)) { - _bfd_error_handler (_("%s: illegal symbol index in reloc: %d"), - bfd_archive_filename (abfd), symndx); + _bfd_error_handler (_("%B: illegal symbol index in reloc: %d"), + abfd, symndx); continue; } @@ -2211,13 +2100,12 @@ bfd_arm_process_before_allocation (abfd, info, support_old_code) into ARM_26D relocs. */ static bfd_boolean -coff_arm_adjust_symndx (obfd, info, ibfd, sec, irel, adjustedp) - bfd *obfd ATTRIBUTE_UNUSED; - struct bfd_link_info *info ATTRIBUTE_UNUSED; - bfd *ibfd; - asection *sec; - struct internal_reloc *irel; - bfd_boolean *adjustedp; +coff_arm_adjust_symndx (bfd *obfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info ATTRIBUTE_UNUSED, + bfd *ibfd, + asection *sec, + struct internal_reloc *irel, + bfd_boolean *adjustedp) { if (irel->r_type == ARM_26) { @@ -2240,9 +2128,7 @@ coff_arm_adjust_symndx (obfd, info, ibfd, sec, irel, adjustedp) targets, eg different CPUs or different APCS's. */ static bfd_boolean -coff_arm_merge_private_bfd_data (ibfd, obfd) - bfd * ibfd; - bfd * obfd; +coff_arm_merge_private_bfd_data (bfd * ibfd, bfd * obfd) { BFD_ASSERT (ibfd != NULL && obfd != NULL); @@ -2271,9 +2157,10 @@ coff_arm_merge_private_bfd_data (ibfd, obfd) { _bfd_error_handler /* xgettext: c-format */ - (_("ERROR: %s is compiled for APCS-%d, whereas %s is compiled for APCS-%d"), - bfd_archive_filename (ibfd), APCS_26_FLAG (ibfd) ? 26 : 32, - bfd_get_filename (obfd), APCS_26_FLAG (obfd) ? 26 : 32 + (_("ERROR: %B is compiled for APCS-%d, whereas %B is compiled for APCS-%d"), + ibfd, obfd, + APCS_26_FLAG (ibfd) ? 26 : 32, + APCS_26_FLAG (obfd) ? 26 : 32 ); bfd_set_error (bfd_error_wrong_format); @@ -2286,13 +2173,12 @@ coff_arm_merge_private_bfd_data (ibfd, obfd) if (APCS_FLOAT_FLAG (ibfd)) /* xgettext: c-format */ - msg = _("ERROR: %s passes floats in float registers, whereas %s passes them in integer registers"); + msg = _("ERROR: %B passes floats in float registers, whereas %B passes them in integer registers"); else /* xgettext: c-format */ - msg = _("ERROR: %s passes floats in integer registers, whereas %s passes them in float registers"); + msg = _("ERROR: %B passes floats in integer registers, whereas %B passes them in float registers"); - _bfd_error_handler (msg, bfd_archive_filename (ibfd), - bfd_get_filename (obfd)); + _bfd_error_handler (msg, ibfd, obfd); bfd_set_error (bfd_error_wrong_format); return FALSE; @@ -2304,12 +2190,11 @@ coff_arm_merge_private_bfd_data (ibfd, obfd) if (PIC_FLAG (ibfd)) /* xgettext: c-format */ - msg = _("ERROR: %s is compiled as position independent code, whereas target %s is absolute position"); + msg = _("ERROR: %B is compiled as position independent code, whereas target %B is absolute position"); else /* xgettext: c-format */ - msg = _("ERROR: %s is compiled as absolute position code, whereas target %s is position independent"); - _bfd_error_handler (msg, bfd_archive_filename (ibfd), - bfd_get_filename (obfd)); + msg = _("ERROR: %B is compiled as absolute position code, whereas target %B is position independent"); + _bfd_error_handler (msg, ibfd, obfd); bfd_set_error (bfd_error_wrong_format); return FALSE; @@ -2336,13 +2221,12 @@ coff_arm_merge_private_bfd_data (ibfd, obfd) if (INTERWORK_FLAG (ibfd)) /* xgettext: c-format */ - msg = _("Warning: %s supports interworking, whereas %s does not"); + msg = _("Warning: %B supports interworking, whereas %B does not"); else /* xgettext: c-format */ - msg = _("Warning: %s does not support interworking, whereas %s does"); + msg = _("Warning: %B does not support interworking, whereas %B does"); - _bfd_error_handler (msg, bfd_archive_filename (ibfd), - bfd_get_filename (obfd)); + _bfd_error_handler (msg, ibfd, obfd); } } else @@ -2357,9 +2241,7 @@ coff_arm_merge_private_bfd_data (ibfd, obfd) /* Display the flags field. */ static bfd_boolean -coff_arm_print_private_bfd_data (abfd, ptr) - bfd * abfd; - PTR ptr; +coff_arm_print_private_bfd_data (bfd * abfd, void * ptr) { FILE * file = (FILE *) ptr; @@ -2404,9 +2286,7 @@ coff_arm_print_private_bfd_data (abfd, ptr) called from both coffcode.h and peicode.h. */ static bfd_boolean -_bfd_coff_arm_set_private_flags (abfd, flags) - bfd * abfd; - flagword flags; +_bfd_coff_arm_set_private_flags (bfd * abfd, flagword flags) { flagword flag; @@ -2437,12 +2317,12 @@ _bfd_coff_arm_set_private_flags (abfd, flags) { if (flag) /* xgettext: c-format */ - _bfd_error_handler (_("Warning: Not setting interworking flag of %s since it has already been specified as non-interworking"), - bfd_archive_filename (abfd)); + _bfd_error_handler (_("Warning: Not setting interworking flag of %B since it has already been specified as non-interworking"), + abfd); else /* xgettext: c-format */ - _bfd_error_handler (_("Warning: Clearing the interworking flag of %s due to outside request"), - bfd_archive_filename (abfd)); + _bfd_error_handler (_("Warning: Clearing the interworking flag of %B due to outside request"), + abfd); flag = 0; } @@ -2455,9 +2335,7 @@ _bfd_coff_arm_set_private_flags (abfd, flags) from one instance of a BFD to another. */ static bfd_boolean -coff_arm_copy_private_bfd_data (src, dest) - bfd * src; - bfd * dest; +coff_arm_copy_private_bfd_data (bfd * src, bfd * dest) { BFD_ASSERT (src != NULL && dest != NULL); @@ -2469,7 +2347,7 @@ coff_arm_copy_private_bfd_data (src, dest) if (src->xvec != dest->xvec) return TRUE; - /* copy the flags field */ + /* Copy the flags field. */ if (APCS_SET (src)) { if (APCS_SET (dest)) @@ -2501,9 +2379,8 @@ coff_arm_copy_private_bfd_data (src, dest) { /* xgettext:c-format */ _bfd_error_handler (("\ -Warning: Clearing the interworking flag of %s because non-interworking code in %s has been linked with it"), - bfd_get_filename (dest), - bfd_archive_filename (src)); +Warning: Clearing the interworking flag of %B because non-interworking code in %B has been linked with it"), + dest, src); } SET_INTERWORK_FLAG (dest, 0); @@ -2530,15 +2407,17 @@ Warning: Clearing the interworking flag of %s because non-interworking code in % non-local. b) Allow other prefixes than ".", e.g. an empty prefix would cause all labels of the form Lxxx to be stripped. */ + static bfd_boolean -coff_arm_is_local_label_name (abfd, name) - bfd * abfd ATTRIBUTE_UNUSED; - const char * name; +coff_arm_is_local_label_name (bfd * abfd ATTRIBUTE_UNUSED, + const char * name) { #ifdef USER_LABEL_PREFIX if (USER_LABEL_PREFIX[0] != 0) { - if (strncmp (name, USER_LABEL_PREFIX, strlen (USER_LABEL_PREFIX)) == 0) + size_t len = strlen (USER_LABEL_PREFIX); + + if (strncmp (name, USER_LABEL_PREFIX, len) == 0) return FALSE; } #endif @@ -2566,23 +2445,18 @@ coff_arm_is_local_label_name (abfd, name) the glue section is written last. This does depend on bfd_make_section attaching a new section to the - end of the section list for the bfd. - - krk@cygnus.com */ + end of the section list for the bfd. */ static bfd_boolean -coff_arm_link_output_has_begun (sub, info) - bfd * sub; - struct coff_final_link_info * info; +coff_arm_link_output_has_begun (bfd * sub, struct coff_final_link_info * info) { return (sub->output_has_begun || sub == coff_arm_hash_table (info->info)->bfd_of_glue_owner); } static bfd_boolean -coff_arm_final_link_postscript (abfd, pfinfo) - bfd * abfd ATTRIBUTE_UNUSED; - struct coff_final_link_info * pfinfo; +coff_arm_final_link_postscript (bfd * abfd ATTRIBUTE_UNUSED, + struct coff_final_link_info * pfinfo) { struct coff_arm_link_hash_table * globals; diff --git a/contrib/binutils/bfd/coff-aux.c b/contrib/binutils/bfd/coff-aux.c index 4d7cde55571..e22d85566a6 100644 --- a/contrib/binutils/bfd/coff-aux.c +++ b/contrib/binutils/bfd/coff-aux.c @@ -16,7 +16,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #define TARGET_SYM m68kaux_coff_vec #define TARGET_NAME "coff-m68k-aux" diff --git a/contrib/binutils/bfd/coff-i386.c b/contrib/binutils/bfd/coff-i386.c index a24344ad8c3..0d71cd00065 100644 --- a/contrib/binutils/bfd/coff-i386.c +++ b/contrib/binutils/bfd/coff-i386.c @@ -1,24 +1,24 @@ /* BFD back-end for Intel 386 COFF files. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003 + 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Written by Cygnus Support. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" @@ -119,6 +119,8 @@ coff_i386_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, here. */ if (howto->pc_relative && howto->pcrel_offset) diff = -(1 << howto->size); + else if (symbol->flags & BSF_WEAK) + diff = reloc_entry->addend - symbol->value; else diff = -reloc_entry->addend; } @@ -234,7 +236,24 @@ static reloc_howto_type howto_table[] = EMPTY_HOWTO (010), EMPTY_HOWTO (011), EMPTY_HOWTO (012), +#ifdef COFF_WITH_PE + /* 32-bit longword section relative relocation (013). */ + HOWTO (R_SECREL32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + coff_i386_reloc, /* special_function */ + "secrel32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ +#else EMPTY_HOWTO (013), +#endif EMPTY_HOWTO (014), EMPTY_HOWTO (015), EMPTY_HOWTO (016), @@ -497,6 +516,30 @@ coff_i386_rtype_to_howto (abfd, sec, rel, h, sym, addendp) { *addendp -= pe_data(sec->output_section->owner)->pe_opthdr.ImageBase; } + + if (rel->r_type == R_SECREL32) + { + bfd_vma osect_vma; + + if (h && (h->type == bfd_link_hash_defined + || h->type == bfd_link_hash_defweak)) + osect_vma = h->root.u.def.section->output_section->vma; + else + { + asection *sec; + int i; + + /* Sigh, the only way to get the section to offset against + is to find it the hard way. */ + + for (sec = abfd->sections, i = 1; i < sym->n_scnum; i++) + sec = sec->next; + + osect_vma = sec->output_section->vma; + } + + *addendp -= osect_vma; + } #endif return howto; @@ -525,6 +568,10 @@ coff_i386_reloc_type_lookup (abfd, code) return howto_table + R_RELBYTE; case BFD_RELOC_8_PCREL: return howto_table + R_PCRBYTE; +#ifdef COFF_WITH_PE + case BFD_RELOC_32_SECREL: + return howto_table + R_SECREL32; +#endif default: BFD_FAIL (); return 0; diff --git a/contrib/binutils/bfd/coff-ia64.c b/contrib/binutils/bfd/coff-ia64.c index 2b5b557ddbb..1e3b3440f2e 100644 --- a/contrib/binutils/bfd/coff-ia64.c +++ b/contrib/binutils/bfd/coff-ia64.c @@ -16,7 +16,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" diff --git a/contrib/binutils/bfd/coff-mips.c b/contrib/binutils/bfd/coff-mips.c index d6d82184234..34b072c4138 100644 --- a/contrib/binutils/bfd/coff-mips.c +++ b/contrib/binutils/bfd/coff-mips.c @@ -1,6 +1,6 @@ /* BFD back-end for MIPS Extended-Coff files. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003 + 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Original version by Per Bothner. Full support added by Ian Lance Taylor, ian@cygnus.com. @@ -19,7 +19,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" @@ -57,28 +57,12 @@ static bfd_reloc_status_type mips_reflo_reloc 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, bfd_boolean pcrel)); + bfd_vma relocation)); static bfd_boolean mips_relocate_section PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, PTR)); -static bfd_boolean mips_read_relocs - PARAMS ((bfd *, asection *)); -static bfd_boolean mips_relax_section - PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *)); -static bfd_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)); @@ -243,10 +227,9 @@ static reloc_howto_type mips_howto_table[] = 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. */ + /* FIXME: This relocation is used (internally only) to represent branches + when assembling. It should never appear in output files, and + be removed. (It used to be used for embedded-PIC support.) */ HOWTO (MIPS_R_PCREL16, /* type */ 2, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ @@ -260,92 +243,10 @@ static reloc_howto_type mips_howto_table[] = 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 an 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. */ @@ -418,25 +319,6 @@ mips_ecoff_swap_reloc_in (abfd, ext_ptr, intern) << 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. */ @@ -453,20 +335,7 @@ mips_ecoff_swap_reloc_out (abfd, intern, dst) 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; - } + r_symndx = intern->r_symndx; H_PUT_32 (abfd, intern->r_vaddr, ext->r_vaddr); if (bfd_header_big_endian (abfd)) @@ -501,7 +370,7 @@ mips_adjust_reloc_in (abfd, intern, rptr) const struct internal_reloc *intern; arelent *rptr; { - if (intern->r_type > MIPS_R_SWITCH) + if (intern->r_type > MIPS_R_PCREL16) abort (); if (! intern->r_extern @@ -514,18 +383,6 @@ mips_adjust_reloc_in (abfd, intern, rptr) 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]; } @@ -535,19 +392,9 @@ mips_adjust_reloc_in (abfd, intern, rptr) static void mips_adjust_reloc_out (abfd, rel, intern) bfd *abfd ATTRIBUTE_UNUSED; - const arelent *rel; - struct internal_reloc *intern; + const arelent *rel ATTRIBUTE_UNUSED; + struct internal_reloc *intern ATTRIBUTE_UNUSED; { - /* 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 @@ -652,7 +499,7 @@ mips_refhi_reloc (abfd, relocation += symbol->section->output_offset; relocation += reloc_entry->addend; - if (reloc_entry->address > input_section->_cooked_size) + if (reloc_entry->address > bfd_get_section_limit (abfd, input_section)) return bfd_reloc_outofrange; /* Save the information, and let REFLO do the actual relocation. */ @@ -850,7 +697,7 @@ mips_gprel_reloc (abfd, relocation += symbol->section->output_section->vma; relocation += symbol->section->output_offset; - if (reloc_entry->address > input_section->_cooked_size) + if (reloc_entry->address > bfd_get_section_limit (abfd, input_section)) return bfd_reloc_outofrange; insn = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address); @@ -880,209 +727,6 @@ mips_gprel_reloc (abfd, 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 ((bfd_size_type) 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 &~ (unsigned) 0xffff) | ((val >> 16) & 0xffff); - bfd_put_32 (abfd, (bfd_vma) 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 relocatable 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. */ - -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 * @@ -1119,15 +763,6 @@ mips_bfd_reloc_type_lookup (abfd, code) 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; } @@ -1136,21 +771,19 @@ mips_bfd_reloc_type_lookup (abfd, code) } /* 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. */ + relocations. The REFHI relocation must be followed by a REFLO + relocation, 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) +mips_relocate_hi (refhi, reflo, input_bfd, input_section, contents, + relocation) struct internal_reloc *refhi; struct internal_reloc *reflo; bfd *input_bfd; asection *input_section; bfd_byte *contents; - size_t adjust; bfd_vma relocation; - bfd_boolean pcrel; { unsigned long insn; unsigned long val; @@ -1160,12 +793,12 @@ mips_relocate_hi (refhi, reflo, input_bfd, input_section, contents, adjust, return; insn = bfd_get_32 (input_bfd, - contents + adjust + refhi->r_vaddr - input_section->vma); + contents + 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) + contents + reflo->r_vaddr - input_section->vma) & 0xffff); val = ((insn & 0xffff) << 16) + vallo; @@ -1179,17 +812,12 @@ mips_relocate_hi (refhi, reflo, input_bfd, input_section, contents, adjust, 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 &~ (unsigned) 0xffff) | ((val >> 16) & 0xffff); bfd_put_32 (input_bfd, (bfd_vma) insn, - contents + adjust + refhi->r_vaddr - input_section->vma); + contents + refhi->r_vaddr - input_section->vma); } /* Relocate a section while linking a MIPS ECOFF file. */ @@ -1208,8 +836,6 @@ mips_relocate_section (output_bfd, info, input_bfd, input_section, struct ecoff_link_hash_entry **sym_hashes; bfd_vma gp; bfd_boolean gp_undefined; - size_t adjust; - long *offsets; struct external_reloc *ext_rel; struct external_reloc *ext_rel_end; unsigned int i; @@ -1270,13 +896,6 @@ mips_relocate_section (output_bfd, info, input_bfd, input_section, 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++) @@ -1301,17 +920,15 @@ mips_relocate_section (output_bfd, info, input_bfd, input_section, 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) + /* The REFHI reloc requires special handling. It must be followed + by a REFLO reloc, and the addend is formed from both relocs. */ + if (int_rel.r_type == MIPS_R_REFHI) { 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. */ + relocs before the REFLO 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++) @@ -1323,10 +940,7 @@ mips_relocate_section (output_bfd, info, input_bfd, input_section, } 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)) + && lo_int_rel.r_type == MIPS_R_REFLO && int_rel.r_extern == lo_int_rel.r_extern && int_rel.r_symndx == lo_int_rel.r_symndx) { @@ -1338,32 +952,6 @@ mips_relocate_section (output_bfd, info, input_bfd, input_section, 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]; @@ -1439,91 +1027,6 @@ mips_relocate_section (output_bfd, info, input_bfd, input_section, } } - /* 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->relocatable); - 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->relocatable) { /* We are generating relocatable output, and must convert @@ -1601,49 +1104,7 @@ mips_relocate_section (output_bfd, info, input_bfd, input_section, 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; - } - } + relocation -= int_rel.r_vaddr - input_section->vma; h = NULL; } @@ -1679,14 +1140,8 @@ mips_relocate_section (output_bfd, info, input_bfd, input_section, /* 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))) + reference to the new address. */ + if (howto->pc_relative) relocation -= (input_section->output_section->vma + input_section->output_offset - input_section->vma); @@ -1696,11 +1151,9 @@ mips_relocate_section (output_bfd, info, input_bfd, input_section, r = bfd_reloc_ok; else { - if (int_rel.r_type != MIPS_R_REFHI - && int_rel.r_type != MIPS_R_RELHI) + if (int_rel.r_type != MIPS_R_REFHI) r = _bfd_relocate_contents (howto, input_bfd, relocation, (contents - + adjust + int_rel.r_vaddr - input_section->vma)); else @@ -1708,8 +1161,7 @@ mips_relocate_section (output_bfd, info, input_bfd, input_section, 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); + relocation); r = bfd_reloc_ok; } } @@ -1759,32 +1211,24 @@ mips_relocate_section (output_bfd, info, input_bfd, input_section, 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; - } + relocation += int_rel.r_vaddr; } - if (int_rel.r_type != MIPS_R_REFHI - && int_rel.r_type != MIPS_R_RELHI) + if (int_rel.r_type != MIPS_R_REFHI) r = _bfd_final_link_relocate (howto, input_bfd, input_section, contents, (int_rel.r_vaddr - - input_section->vma - + adjust), + - input_section->vma), 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); + input_bfd, input_section, contents, + relocation); r = bfd_reloc_ok; } } @@ -1801,8 +1245,7 @@ mips_relocate_section (output_bfd, info, input_bfd, input_section, & 0xf0000000) != ((input_section->output_section->vma + input_section->output_offset - + (int_rel.r_vaddr - input_section->vma) - + adjust) + + (int_rel.r_vaddr - input_section->vma)) & 0xf0000000))) r = bfd_reloc_overflow; @@ -1818,12 +1261,12 @@ mips_relocate_section (output_bfd, info, input_bfd, input_section, const char *name; if (int_rel.r_extern) - name = h->root.root.string; + name = NULL; else name = bfd_section_name (input_bfd, s); if (! ((*info->callbacks->reloc_overflow) - (info, name, howto->name, (bfd_vma) 0, - input_bfd, input_section, + (info, (h ? &h->root : NULL), name, howto->name, + (bfd_vma) 0, input_bfd, input_section, int_rel.r_vaddr - input_section->vma))) return FALSE; } @@ -1835,621 +1278,6 @@ mips_relocate_section (output_bfd, info, input_bfd, input_section, return TRUE; } -/* Read in the relocs for a section. */ - -static bfd_boolean -mips_read_relocs (abfd, sec) - bfd *abfd; - asection *sec; -{ - struct ecoff_section_tdata *section_tdata; - bfd_size_type amt; - - section_tdata = ecoff_section_data (abfd, sec); - if (section_tdata == (struct ecoff_section_tdata *) NULL) - { - amt = sizeof (struct ecoff_section_tdata); - sec->used_by_bfd = (PTR) bfd_alloc (abfd, amt); - 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) - { - amt = ecoff_backend (abfd)->external_reloc_size; - amt *= sec->reloc_count; - section_tdata->external_relocs = (PTR) bfd_alloc (abfd, amt); - if (section_tdata->external_relocs == NULL && amt != 0) - return FALSE; - - if (bfd_seek (abfd, sec->rel_filepos, SEEK_SET) != 0 - || bfd_bread (section_tdata->external_relocs, amt, abfd) != amt) - 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 bfd_boolean -mips_relax_section (abfd, sec, info, again) - bfd *abfd; - asection *sec; - struct bfd_link_info *info; - bfd_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; - bfd_size_type amt; - - /* 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 (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) - { - bfd_size_type size; - - size = (bfd_size_type) sec->reloc_count * sizeof (long); - offsets = (long *) bfd_zalloc (abfd, size); - if (offsets == (long *) NULL) - goto error_return; - 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. */ - amt = sizeof (struct ecoff_value_adjust); - adjust = (struct ecoff_value_adjust *) bfd_alloc (abfd, amt); - 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 bfd_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, (bfd_vma) 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, - (bfd_vma) 0x003f0821, location + 12); /* addu $at,$at,$ra */ - bfd_put_32 (input_bfd, - (bfd_vma) 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. */ - -bfd_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_size_type amt; - - BFD_ASSERT (! info->relocatable); - - *errmsg = NULL; - - if (datasec->reloc_count == 0) - return TRUE; - - sym_hashes = ecoff_data (abfd)->sym_hashes; - - if (! mips_read_relocs (abfd, datasec)) - return FALSE; - - amt = (bfd_size_type) datasec->reloc_count * 4; - relsec->contents = (bfd_byte *) bfd_alloc (abfd, amt); - 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; - bfd_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. */ @@ -2557,7 +1385,7 @@ static const struct ecoff_backend_data mips_ecoff_backend_data = _bfd_generic_get_section_contents_in_window /* Relaxing sections is MIPS specific. */ -#define _bfd_ecoff_bfd_relax_section mips_relax_section +#define _bfd_ecoff_bfd_relax_section bfd_generic_relax_section /* GC of sections is not done. */ #define _bfd_ecoff_bfd_gc_sections bfd_generic_gc_sections @@ -2565,7 +1393,10 @@ static const struct ecoff_backend_data mips_ecoff_backend_data = /* Merging of sections is not done. */ #define _bfd_ecoff_bfd_merge_sections bfd_generic_merge_sections +#define _bfd_ecoff_bfd_is_group_section bfd_generic_is_group_section #define _bfd_ecoff_bfd_discard_group bfd_generic_discard_group +#define _bfd_ecoff_section_already_linked \ + _bfd_generic_section_already_linked extern const bfd_target ecoff_big_vec; diff --git a/contrib/binutils/bfd/coff-ppc.c b/contrib/binutils/bfd/coff-ppc.c index c1c2c32a178..b4427936933 100644 --- a/contrib/binutils/bfd/coff-ppc.c +++ b/contrib/binutils/bfd/coff-ppc.c @@ -1,6 +1,6 @@ /* BFD back-end for PowerPC Microsoft Portable Executable files. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003 + 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Original version pieced together by Kim Knuttila (krk@cygnus.com) @@ -23,8 +23,8 @@ 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. */ + Foundation, 51 Franklin Street - Fifth Floor, + Boston, MA 02110-1301, USA. */ /* Current State: - objdump works @@ -127,11 +127,6 @@ struct ppc_coff_link_hash_table static struct bfd_hash_entry *ppc_coff_link_hash_newfunc PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); -static bfd_boolean ppc_coff_link_hash_table_init - PARAMS ((struct ppc_coff_link_hash_table *, bfd *, - struct bfd_hash_entry *(*) (struct bfd_hash_entry *, - struct bfd_hash_table *, - const char *))); static struct bfd_link_hash_table *ppc_coff_link_hash_table_create PARAMS ((bfd *)); static bfd_boolean coff_ppc_relocate_section @@ -184,14 +179,14 @@ ppc_coff_link_hash_newfunc (entry, table, string) /* Initialize a PE linker hash table. */ static bfd_boolean -ppc_coff_link_hash_table_init (table, abfd, newfunc) - struct ppc_coff_link_hash_table *table; - bfd *abfd; - struct bfd_hash_entry *(*newfunc) PARAMS ((struct bfd_hash_entry *, - struct bfd_hash_table *, - const char *)); +ppc_coff_link_hash_table_init (struct ppc_coff_link_hash_table *table, + bfd *abfd, + struct bfd_hash_entry *(*newfunc) (struct bfd_hash_entry *, + struct bfd_hash_table *, + const char *), + unsigned int entsize) { - return _bfd_coff_link_hash_table_init (&table->root, abfd, newfunc); + return _bfd_coff_link_hash_table_init (&table->root, abfd, newfunc, entsize); } /* Create a PE linker hash table. */ @@ -206,8 +201,9 @@ ppc_coff_link_hash_table_create (abfd) ret = (struct ppc_coff_link_hash_table *) bfd_malloc (amt); if (ret == NULL) return NULL; - if (! ppc_coff_link_hash_table_init (ret, abfd, - ppc_coff_link_hash_newfunc)) + if (!ppc_coff_link_hash_table_init (ret, abfd, + ppc_coff_link_hash_newfunc, + sizeof (struct ppc_coff_link_hash_entry))) { free (ret); return (struct bfd_link_hash_table *) NULL; @@ -326,15 +322,6 @@ static bfd_reloc_status_type ppc_refhi_reloc PARAMS ((bfd *abfd, asection *section, bfd *output_bfd, char **error)); -#if 0 -static bfd_reloc_status_type ppc_reflo_reloc PARAMS ((bfd *abfd, - arelent *reloc, - asymbol *symbol, - PTR data, - asection *section, - bfd *output_bfd, - char **error)); -#endif static bfd_reloc_status_type ppc_pair_reloc PARAMS ((bfd *abfd, arelent *reloc, asymbol *symbol, @@ -351,15 +338,6 @@ static bfd_reloc_status_type ppc_toc16_reloc PARAMS ((bfd *abfd, bfd *output_bfd, char **error)); -#if 0 -static bfd_reloc_status_type ppc_addr32nb_reloc PARAMS ((bfd *abfd, - arelent *reloc, - asymbol *symbol, - PTR data, - asection *section, - bfd *output_bfd, - char **error)); -#endif static bfd_reloc_status_type ppc_section_reloc PARAMS ((bfd *abfd, arelent *reloc, asymbol *symbol, @@ -1005,67 +983,6 @@ static bfd_boolean in_reloc_p(abfd, howto) && (howto->type != IMAGE_REL_PPC_TOCREL16_DEFN) ; } -#if 0 - -/* This function is in charge of performing all the ppc PE relocations - Don't yet know if we want to do this this particular way ... (krk). */ -/* FIXME: (it is not yet enabled). */ - -static bfd_reloc_status_type -pe_ppc_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; -{ - /* The consth relocation comes in two parts, we have to remember - the state between calls, in these variables. */ - static bfd_boolean part1_consth_active = FALSE; - static unsigned long part1_consth_value; - - unsigned long sym_value; - unsigned short r_type; - unsigned long addr = reloc_entry->address ; /*+ input_section->vma*/ - - r_type = reloc_entry->howto->type; - - if (output_bfd) - { - /* Partial linking - do nothing. */ - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - if (symbol_in != NULL - && bfd_is_und_section (symbol_in->section)) - { - /* Keep the state machine happy in case we're called again. */ - if (r_type == IMAGE_REL_PPC_REFHI) - { - part1_consth_active = TRUE; - part1_consth_value = 0; - } - return(bfd_reloc_undefined); - } - - if ((part1_consth_active) && (r_type != IMAGE_REL_PPC_PAIR)) - { - part1_consth_active = FALSE; - *error_message = (char *) _("Missing PAIR"); - return(bfd_reloc_dangerous); - } - - sym_value = get_symbol_value(symbol_in); - - return(bfd_reloc_ok); -} - -#endif /* 0 */ - /* The reloc processing routine for the optimized COFF linker. */ static bfd_boolean @@ -1188,8 +1105,7 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section, { default: (*_bfd_error_handler) - (_("%s: unsupported relocation type 0x%02x"), - bfd_archive_filename (input_bfd), r_type); + (_("%B: unsupported relocation type 0x%02x"), input_bfd, r_type); bfd_set_error (bfd_error_bad_value); return FALSE; case IMAGE_REL_PPC_TOCREL16: @@ -1278,8 +1194,8 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section, if ((bfd_vma) our_toc_offset >= 65535) { (*_bfd_error_handler) - (_("%s: Relocation for %s of %lx exceeds Toc size limit"), - bfd_archive_filename (input_bfd), name, + (_("%B: Relocation for %s of %lx exceeds Toc size limit"), + input_bfd, name, (unsigned long) our_toc_offset); bfd_set_error (bfd_error_bad_value); return FALSE; @@ -1330,12 +1246,11 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section, /* FIXME: this test is conservative. */ if ((r_flags & IMAGE_REL_PPC_TOCDEFN) != IMAGE_REL_PPC_TOCDEFN - && (bfd_vma) our_toc_offset > toc_section->_raw_size) + && (bfd_vma) our_toc_offset > toc_section->size) { (*_bfd_error_handler) - (_("%s: Relocation exceeds allocated TOC (%lx)"), - bfd_archive_filename (input_bfd), - (unsigned long) toc_section->_raw_size); + (_("%B: Relocation exceeds allocated TOC (%lx)"), + input_bfd, (unsigned long) toc_section->size); bfd_set_error (bfd_error_bad_value); return FALSE; } @@ -1387,15 +1302,12 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section, else my_name = h->root.root.root.string; - fprintf (stderr, - _("Warning: unsupported reloc %s \n"), - howto->name, - bfd_archive_filename(input_bfd), - input_section->name); - - fprintf (stderr,"sym %ld (%s), r_vaddr %ld (%lx)\n", - rel->r_symndx, my_name, (long) rel->r_vaddr, - (unsigned long) rel->r_vaddr); + (*_bfd_error_handler) + (_("Warning: unsupported reloc %s \n" + "sym %ld (%s), r_vaddr %ld (%lx)"), + input_bfd, input_section, howto->name, + rel->r_symndx, my_name, (long) rel->r_vaddr, + (unsigned long) rel->r_vaddr); } break; case IMAGE_REL_PPC_IMGLUE: @@ -1409,8 +1321,7 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section, my_name = h->root.root.root.string; (*_bfd_error_handler) - (_("%s: Out of order IMGLUE reloc for %s"), - bfd_archive_filename (input_bfd), my_name); + (_("%B: Out of order IMGLUE reloc for %s"), input_bfd, my_name); bfd_set_error (bfd_error_bad_value); return FALSE; } @@ -1569,7 +1480,7 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section, if (symndx == -1) name = "*ABS*"; else if (h != NULL) - name = h->root.root.root.string; + name = NULL; else if (sym == NULL) name = "*unknown*"; else if (sym->_n._n_n._n_zeroes == 0 @@ -1583,7 +1494,7 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section, } if (! ((*info->callbacks->reloc_overflow) - (info, name, howto->name, + (info, (h ? &h->root.root : NULL), name, howto->name, (bfd_vma) 0, input_bfd, input_section, rel->r_vaddr - input_section->vma))) return FALSE; @@ -1690,7 +1601,7 @@ ppc_allocate_toc_section (info) foo = (bfd_byte *) bfd_alloc (bfd_of_toc_owner, amt); memset(foo, test_char, (size_t) global_toc_size); - s->_raw_size = s->_cooked_size = global_toc_size; + s->size = global_toc_size; s->contents = foo; return TRUE; @@ -1779,30 +1690,6 @@ ppc_refhi_reloc (abfd, reloc_entry, symbol, data, return bfd_reloc_undefined; } -#if 0 - -static bfd_reloc_status_type -ppc_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; -{ - UN_IMPL("REFLO"); - DUMP_RELOC("REFLO",reloc_entry); - - if (output_bfd == (bfd *) NULL) - return bfd_reloc_continue; - - return bfd_reloc_undefined; -} - -#endif - static bfd_reloc_status_type ppc_pair_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, error_message) @@ -1843,31 +1730,6 @@ ppc_toc16_reloc (abfd, reloc_entry, symbol, data, return bfd_reloc_ok; } -#if 0 - -/* ADDR32NB : 32 bit address relative to the virtual origin. - (On the alpha, this is always a linker generated thunk) - (i.e. 32bit addr relative to the image base). */ - -static bfd_reloc_status_type -ppc_addr32nb_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; -{ - UN_IMPL("ADDR32NB"); - DUMP_RELOC("ADDR32NB",reloc_entry); - - return bfd_reloc_ok; -} - -#endif - static bfd_reloc_status_type ppc_secrel_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, error_message) @@ -2114,10 +1976,6 @@ ppc_coff_reloc_type_lookup (abfd, code) #define coff_bfd_final_link ppc_bfd_coff_final_link #ifndef COFF_IMAGE_WITH_PE -/* FIXME: This no longer works. */ -#if 0 -#define coff_swap_sym_in_hook ppc_coff_swap_sym_in_hook -#endif #endif #define SELECT_RELOC(internal, howto) {internal.r_type=howto->type;} @@ -2145,62 +2003,6 @@ ppc_coff_reloc_type_lookup (abfd, code) #include "coffcode.h" -#ifndef COFF_IMAGE_WITH_PE -/* FIXME: This no longer works. */ -#if 0 -/* FIXME: - What we're trying to do here is allocate a toc section (early), and attach - it to the last bfd to be processed. This avoids the problem of having a toc - written out before all files have been processed. This code allocates - a toc section for every file, and records the last one seen. There are - at least two problems with this approach: - 1. We allocate whole bunches of toc sections that are ignored, but at - at least we will not allocate a toc if no .toc is present. - 2. It's not clear to me that being the last bfd read necessarily means - that you are the last bfd closed. - 3. Doing it on a "swap in" hook depends on when the "swap in" is called, - and how often, etc. It's not clear to me that there isn't a hole here. */ -static void ppc_coff_swap_sym_in_hook PARAMS ((bfd *, PTR, PTR)); - -static void -ppc_coff_swap_sym_in_hook (abfd, ext1, in1) - bfd *abfd; - PTR ext1 ATTRIBUTE_UNUSED; - PTR in1; -{ - struct internal_syment * in = (struct internal_syment *)in1; - - if (bfd_of_toc_owner != 0) /* We already have a toc, so go home. */ - return; - - if (strcmp (in->_n._n_name, ".toc") == 0) - { - flagword flags; - register asection *s; - - s = bfd_get_section_by_name (abfd, TOC_SECTION_NAME); - if (s != NULL) - return; - - flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY ; - - s = bfd_make_section (abfd, TOC_SECTION_NAME); - - if (s == NULL - || !bfd_set_section_flags (abfd, s, flags) - || !bfd_set_section_alignment (abfd, s, 2)) - /* FIXME: set appropriate bfd error. */ - abort (); - - /* Save the bfd for later allocation. */ - bfd_of_toc_owner = abfd; - } - - return; -} -#endif -#endif - #ifndef COFF_IMAGE_WITH_PE static bfd_boolean ppc_do_last PARAMS ((bfd *)); @@ -2307,7 +2109,7 @@ ppc_bfd_coff_final_link (abfd, info) o->reloc_count = 0; o->lineno_count = 0; - for (p = o->link_order_head; p != NULL; p = p->next) + for (p = o->map_head.link_order; p != NULL; p = p->next) { if (p->type == bfd_indirect_link_order) { @@ -2328,8 +2130,10 @@ ppc_bfd_coff_final_link (abfd, info) if (info->relocatable) o->reloc_count += sec->reloc_count; - if (sec->_raw_size > max_contents_size) - max_contents_size = sec->_raw_size; + if (sec->rawsize > max_contents_size) + max_contents_size = sec->rawsize; + if (sec->size > max_contents_size) + max_contents_size = sec->size; if (sec->lineno_count > max_lineno_count) max_lineno_count = sec->lineno_count; if (sec->reloc_count > max_reloc_count) @@ -2487,7 +2291,7 @@ ppc_bfd_coff_final_link (abfd, info) for (o = abfd->sections; o != NULL; o = o->next) { - for (p = o->link_order_head; p != NULL; p = p->next) + for (p = o->map_head.link_order; p != NULL; p = p->next) { if (p->type == bfd_indirect_link_order && (bfd_get_flavour (p->u.indirect.section->owner) @@ -2663,7 +2467,7 @@ ppc_bfd_coff_final_link (abfd, info) } /* If we have optimized stabs strings, output them. */ - if (coff_hash_table (info)->stab_info != NULL) + if (coff_hash_table (info)->stab_info.stabstr != NULL) { if (! _bfd_write_stab_strings (abfd, &coff_hash_table (info)->stab_info)) return FALSE; diff --git a/contrib/binutils/bfd/coff-rs6000.c b/contrib/binutils/bfd/coff-rs6000.c index 56e34e2d720..951587f99b1 100644 --- a/contrib/binutils/bfd/coff-rs6000.c +++ b/contrib/binutils/bfd/coff-rs6000.c @@ -1,5 +1,5 @@ /* BFD back-end for IBM RS/6000 "XCOFF" files. - Copyright 1990-1999, 2000, 2001, 2002, 2003 + Copyright 1990-1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. FIXME: Can someone provide a transliteration of this name into ASCII? Using the following chars caused a compiler warning on HIUX (so I replaced @@ -24,7 +24,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" @@ -180,7 +180,7 @@ static bfd_boolean do_pad static bfd_boolean do_copy PARAMS ((bfd *, bfd *)); static bfd_boolean do_shared_object_padding - PARAMS ((bfd *, bfd *, ufile_ptr *, int)); + PARAMS ((bfd *, bfd *, file_ptr *, int)); /* Relocation functions */ static bfd_boolean xcoff_reloc_type_br @@ -1294,10 +1294,12 @@ _bfd_xcoff_archive_p (abfd) if (bfd_ardata (abfd) == (struct artdata *) NULL) goto error_ret_restore; - bfd_ardata (abfd)->cache = NULL; - bfd_ardata (abfd)->archive_head = NULL; - bfd_ardata (abfd)->symdefs = NULL; - bfd_ardata (abfd)->extended_names = NULL; + /* Cleared by bfd_zalloc above. + bfd_ardata (abfd)->cache = NULL; + bfd_ardata (abfd)->archive_head = NULL; + bfd_ardata (abfd)->symdefs = NULL; + bfd_ardata (abfd)->extended_names = NULL; + bfd_ardata (abfd)->extended_names_size = 0; */ /* Now handle the two formats. */ if (magic[1] != 'b') @@ -1742,7 +1744,7 @@ static bfd_boolean do_shared_object_padding (out_bfd, in_bfd, offset, ar_header_size) bfd *out_bfd; bfd *in_bfd; - ufile_ptr *offset; + file_ptr *offset; int ar_header_size; { if (bfd_check_format (in_bfd, bfd_object) @@ -1779,7 +1781,7 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx) const bfd_arch_info_type *arch_info = NULL; bfd *current_bfd; size_t string_length; - ufile_ptr nextoff, prevoff; + file_ptr nextoff, prevoff; /* First, we look through the symbols and work out which are from 32-bit objects and which from 64-bit ones. */ @@ -1849,8 +1851,8 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx) if (sym_32) { struct xcoff_ar_hdr_big *hdr; - bfd_byte *symbol_table; - bfd_byte *st; + char *symbol_table; + char *st; file_ptr fileoff; bfd_vma symbol_table_size = @@ -1860,8 +1862,7 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx) + 8 * sym_32 + str_32 + (str_32 & 1); - symbol_table = NULL; - symbol_table = (bfd_byte *) bfd_zmalloc (symbol_table_size); + symbol_table = bfd_zmalloc (symbol_table_size); if (symbol_table == NULL) return FALSE; @@ -1941,7 +1942,6 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx) bfd_bwrite (symbol_table, symbol_table_size, abfd); free (symbol_table); - symbol_table = NULL; prevoff = nextoff; nextoff = nextoff + symbol_table_size; @@ -1952,8 +1952,8 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx) if (sym_64) { struct xcoff_ar_hdr_big *hdr; - bfd_byte *symbol_table; - bfd_byte *st; + char *symbol_table; + char *st; file_ptr fileoff; bfd_vma symbol_table_size = @@ -1963,8 +1963,7 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx) + 8 * sym_64 + str_64 + (str_64 & 1); - symbol_table = NULL; - symbol_table = (bfd_byte *) bfd_zmalloc (symbol_table_size); + symbol_table = bfd_zmalloc (symbol_table_size); if (symbol_table == NULL) return FALSE; @@ -2039,7 +2038,6 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx) bfd_bwrite (symbol_table, symbol_table_size, abfd); free (symbol_table); - symbol_table = NULL; PRINT20 (fhdr->symoff64, nextoff); } @@ -2076,7 +2074,7 @@ xcoff_write_archive_contents_old (abfd) file_ptr *offsets; bfd_boolean makemap; bfd_boolean hasobjects; - ufile_ptr prevoff, nextoff; + file_ptr prevoff, nextoff; bfd *sub; size_t i; struct xcoff_ar_hdr ahdr; @@ -2085,7 +2083,7 @@ xcoff_write_archive_contents_old (abfd) char decbuf[XCOFFARMAG_ELEMENT_SIZE + 1]; memset (&fhdr, 0, sizeof fhdr); - strncpy (fhdr.magic, XCOFFARMAG, SXCOFFARMAG); + (void) strncpy (fhdr.magic, XCOFFARMAG, SXCOFFARMAG); sprintf (fhdr.firstmemoff, "%d", SIZEOF_AR_FILE_HDR); sprintf (fhdr.freeoff, "%d", 0); @@ -2306,12 +2304,12 @@ xcoff_write_archive_contents_big (abfd) file_ptr *offsets; bfd_boolean makemap; bfd_boolean hasobjects; - ufile_ptr prevoff, nextoff; + file_ptr prevoff, nextoff; bfd *current_bfd; size_t i; struct xcoff_ar_hdr_big *hdr, ahdr; bfd_size_type size; - bfd_byte *member_table, *mt; + char *member_table, *mt; bfd_vma member_table_size; memset (&fhdr, 0, SIZEOF_AR_FILE_HDR_BIG); @@ -2476,8 +2474,7 @@ xcoff_write_archive_contents_big (abfd) + total_namlen); member_table_size += member_table_size & 1; - member_table = NULL; - member_table = (bfd_byte *) bfd_zmalloc (member_table_size); + member_table = bfd_zmalloc (member_table_size); if (member_table == NULL) return FALSE; @@ -2530,7 +2527,6 @@ xcoff_write_archive_contents_big (abfd) return FALSE; free (member_table); - member_table = NULL; PRINT20 (fhdr.memoff, nextoff); @@ -2948,8 +2944,7 @@ xcoff_reloc_type_br (input_bfd, input_section, output_bfd, rel, sym, howto, cror. */ if (NULL != h && bfd_link_hash_defined == h->root.type - && (rel->r_vaddr - input_section->vma + 8 - <= input_section->_cooked_size)) + && rel->r_vaddr - input_section->vma + 8 <= input_section->size) { bfd_byte *pnext; unsigned long next; @@ -3449,7 +3444,7 @@ xcoff_ppc_relocate_section (output_bfd, info, input_bfd, address = rel->r_vaddr - input_section->vma; location = contents + address; - if (address > input_section->_raw_size) + if (address > input_section->size) abort (); /* Get the value we are going to relocate. */ @@ -3482,7 +3477,7 @@ xcoff_ppc_relocate_section (output_bfd, info, input_bfd, } else if (h != NULL) { - name = h->root.root.string; + name = NULL; } else { @@ -3493,8 +3488,9 @@ xcoff_ppc_relocate_section (output_bfd, info, input_bfd, sprintf (reloc_type_name, "0x%02x", rel->r_type); if (! ((*info->callbacks->reloc_overflow) - (info, name, reloc_type_name, (bfd_vma) 0, input_bfd, - input_section, rel->r_vaddr - input_section->vma))) + (info, (h ? &h->root : NULL), name, reloc_type_name, + (bfd_vma) 0, input_bfd, input_section, + rel->r_vaddr - input_section->vma))) return FALSE; } @@ -3530,7 +3526,7 @@ _bfd_xcoff_put_ldsymbol_name (abfd, ldinfo, ldsym, name) if (ldinfo->string_size + len + 3 > ldinfo->string_alc) { bfd_size_type newalc; - bfd_byte *newstrings; + char *newstrings; newalc = ldinfo->string_alc * 2; if (newalc == 0) @@ -3538,8 +3534,7 @@ _bfd_xcoff_put_ldsymbol_name (abfd, ldinfo, ldsym, name) while (ldinfo->string_size + len + 3 > newalc) newalc *= 2; - newstrings = ((bfd_byte *) - bfd_realloc ((PTR) ldinfo->strings, newalc)); + newstrings = bfd_realloc (ldinfo->strings, newalc); if (newstrings == NULL) { ldinfo->failed = TRUE; @@ -3612,8 +3607,8 @@ xcoff_create_csect_from_smclas (abfd, aux, symbol_name) else { (*_bfd_error_handler) - (_("%s: symbol `%s' has unrecognized smclas %d"), - bfd_archive_filename (abfd), symbol_name, aux->x_csect.x_smclas); + (_("%B: symbol `%s' has unrecognized smclas %d"), + abfd, symbol_name, aux->x_csect.x_smclas); bfd_set_error (bfd_error_bad_value); } @@ -4140,8 +4135,10 @@ const bfd_target rs6000coff_vec = /* Copy */ _bfd_xcoff_copy_private_bfd_data, ((bfd_boolean (*) (bfd *, bfd *)) bfd_true), + _bfd_generic_init_private_section_data, ((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true), ((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true), + ((bfd_boolean (*) (bfd *, bfd *)) bfd_true), ((bfd_boolean (*) (bfd *, flagword)) bfd_true), ((bfd_boolean (*) (bfd *, void * )) bfd_true), @@ -4169,8 +4166,11 @@ const bfd_target rs6000coff_vec = coff_print_symbol, coff_get_symbol_info, _bfd_xcoff_is_local_label_name, + coff_bfd_is_target_special_symbol, coff_get_lineno, coff_find_nearest_line, + _bfd_generic_find_line, + coff_find_inliner_info, coff_bfd_make_debug_symbol, _bfd_generic_read_minisymbols, _bfd_generic_minisymbol_to_symbol, @@ -4196,11 +4196,14 @@ const bfd_target rs6000coff_vec = _bfd_generic_link_split_section, bfd_generic_gc_sections, bfd_generic_merge_sections, + bfd_generic_is_group_section, bfd_generic_discard_group, + _bfd_generic_section_already_linked, /* Dynamic */ _bfd_xcoff_get_dynamic_symtab_upper_bound, _bfd_xcoff_canonicalize_dynamic_symtab, + _bfd_nodynamic_get_synthetic_symtab, _bfd_xcoff_get_dynamic_reloc_upper_bound, _bfd_xcoff_canonicalize_dynamic_reloc, @@ -4382,8 +4385,10 @@ const bfd_target pmac_xcoff_vec = /* Copy */ _bfd_xcoff_copy_private_bfd_data, ((bfd_boolean (*) (bfd *, bfd *)) bfd_true), + _bfd_generic_init_private_section_data, ((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true), ((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true), + ((bfd_boolean (*) (bfd *, bfd *)) bfd_true), ((bfd_boolean (*) (bfd *, flagword)) bfd_true), ((bfd_boolean (*) (bfd *, void * )) bfd_true), @@ -4411,8 +4416,11 @@ const bfd_target pmac_xcoff_vec = coff_print_symbol, coff_get_symbol_info, _bfd_xcoff_is_local_label_name, + coff_bfd_is_target_special_symbol, coff_get_lineno, coff_find_nearest_line, + _bfd_generic_find_line, + coff_find_inliner_info, coff_bfd_make_debug_symbol, _bfd_generic_read_minisymbols, _bfd_generic_minisymbol_to_symbol, @@ -4438,11 +4446,14 @@ const bfd_target pmac_xcoff_vec = _bfd_generic_link_split_section, bfd_generic_gc_sections, bfd_generic_merge_sections, + bfd_generic_is_group_section, bfd_generic_discard_group, + _bfd_generic_section_already_linked, /* Dynamic */ _bfd_xcoff_get_dynamic_symtab_upper_bound, _bfd_xcoff_canonicalize_dynamic_symtab, + _bfd_nodynamic_get_synthetic_symtab, _bfd_xcoff_get_dynamic_reloc_upper_bound, _bfd_xcoff_canonicalize_dynamic_reloc, diff --git a/contrib/binutils/bfd/coff-sparc.c b/contrib/binutils/bfd/coff-sparc.c index 372b1a72278..0236f525e66 100644 --- a/contrib/binutils/bfd/coff-sparc.c +++ b/contrib/binutils/bfd/coff-sparc.c @@ -1,6 +1,6 @@ /* BFD back-end for Sparc COFF files. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000, 2001, - 2002, 2003 Free Software Foundation, Inc. + 2002, 2003, 2005 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -17,7 +17,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" @@ -56,25 +56,6 @@ enum reloc_type R_SPARC_max }; -#if 0 -static const char *const reloc_type_names[] = -{ - "R_SPARC_NONE", - "R_SPARC_8", "R_SPARC_16", "R_SPARC_32", - "R_SPARC_DISP8", "R_SPARC_DISP16", "R_SPARC_DISP32", - "R_SPARC_WDISP30", "R_SPARC_WDISP22", - "R_SPARC_HI22", "R_SPARC_22", - "R_SPARC_13", "R_SPARC_LO10", - "R_SPARC_GOT10", "R_SPARC_GOT13", "R_SPARC_GOT22", - "R_SPARC_PC10", "R_SPARC_PC22", - "R_SPARC_WPLT30", - "R_SPARC_COPY", - "R_SPARC_GLOB_DAT", "R_SPARC_JMP_SLOT", - "R_SPARC_RELATIVE", - "R_SPARC_UA32", -}; -#endif - /* This is stolen pretty directly from elf.c. */ static bfd_reloc_status_type bfd_coff_generic_reloc PARAMS ((bfd *, arelent *, asymbol *, PTR, diff --git a/contrib/binutils/bfd/coff64-rs6000.c b/contrib/binutils/bfd/coff64-rs6000.c index ec9c6953478..e0aa87ef677 100644 --- a/contrib/binutils/bfd/coff64-rs6000.c +++ b/contrib/binutils/bfd/coff64-rs6000.c @@ -1,5 +1,5 @@ /* BFD back-end for IBM RS/6000 "XCOFF64" files. - Copyright 2000, 2001, 2002, 2003 + Copyright 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. Written Clinton Popetz. Contributed by Cygnus Support. @@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" @@ -564,7 +564,7 @@ _bfd_xcoff64_put_ldsymbol_name (abfd, ldinfo, ldsym, name) if (ldinfo->string_size + len + 3 > ldinfo->string_alc) { bfd_size_type newalc; - bfd_byte *newstrings; + char *newstrings; newalc = ldinfo->string_alc * 2; if (newalc == 0) @@ -572,8 +572,7 @@ _bfd_xcoff64_put_ldsymbol_name (abfd, ldinfo, ldsym, name) while (ldinfo->string_size + len + 3 > newalc) newalc *= 2; - newstrings = ((bfd_byte *) - bfd_realloc ((PTR) ldinfo->strings, newalc)); + newstrings = bfd_realloc (ldinfo->strings, newalc); if (newstrings == NULL) { ldinfo->failed = TRUE; @@ -845,11 +844,11 @@ xcoff64_write_object_contents (abfd) section.s_vaddr = current->vma; section.s_paddr = current->lma; - section.s_size = current->_raw_size; + section.s_size = current->size; /* If this section has no size or is unloadable then the scnptr will be 0 too. */ - if (current->_raw_size == 0 + if (current->size == 0 || (current->flags & (SEC_LOAD | SEC_HAS_CONTENTS)) == 0) { section.s_scnptr = 0; @@ -965,19 +964,19 @@ xcoff64_write_object_contents (abfd) if (text_sec) { - internal_a.tsize = bfd_get_section_size_before_reloc (text_sec); + internal_a.tsize = text_sec->size; internal_a.text_start = internal_a.tsize ? text_sec->vma : 0; } if (data_sec) { - internal_a.dsize = bfd_get_section_size_before_reloc (data_sec); + internal_a.dsize = data_sec->size; internal_a.data_start = internal_a.dsize ? data_sec->vma : 0; } if (bss_sec) { - internal_a.bsize = bfd_get_section_size_before_reloc (bss_sec); + internal_a.bsize = bss_sec->size; if (internal_a.bsize && bss_sec->vma < internal_a.data_start) internal_a.data_start = bss_sec->vma; } @@ -1127,8 +1126,7 @@ xcoff64_reloc_type_br (input_bfd, input_section, output_bfd, rel, sym, howto, cror. */ if (NULL != h && bfd_link_hash_defined == h->root.type - && (rel->r_vaddr - input_section->vma + 8 - <= input_section->_cooked_size)) + && rel->r_vaddr - input_section->vma + 8 <= input_section->size) { bfd_byte *pnext; unsigned long next; @@ -1301,7 +1299,7 @@ xcoff64_ppc_relocate_section (output_bfd, info, input_bfd, address = rel->r_vaddr - input_section->vma; location = contents + address; - if (address > input_section->_raw_size) + if (address > input_section->size) abort (); /* Get the value we are going to relocate. */ @@ -1336,7 +1334,7 @@ xcoff64_ppc_relocate_section (output_bfd, info, input_bfd, } else if (h != NULL) { - name = h->root.root.string; + name = NULL; } else { @@ -1347,8 +1345,9 @@ xcoff64_ppc_relocate_section (output_bfd, info, input_bfd, sprintf (reloc_type_name, "0x%02x", rel->r_type); if (! ((*info->callbacks->reloc_overflow) - (info, name, reloc_type_name, (bfd_vma) 0, input_bfd, - input_section, rel->r_vaddr - input_section->vma))) + (info, (h ? &h->root : NULL), name, reloc_type_name, + (bfd_vma) 0, input_bfd, input_section, + rel->r_vaddr - input_section->vma))) return FALSE; } @@ -1984,10 +1983,12 @@ xcoff64_archive_p (abfd) if (bfd_ardata (abfd) == (struct artdata *) NULL) goto error_ret_restore; - bfd_ardata (abfd)->cache = NULL; - bfd_ardata (abfd)->archive_head = NULL; - bfd_ardata (abfd)->symdefs = NULL; - bfd_ardata (abfd)->extended_names = NULL; + /* Already cleared by bfd_zalloc above. + bfd_ardata (abfd)->cache = NULL; + bfd_ardata (abfd)->archive_head = NULL; + bfd_ardata (abfd)->symdefs = NULL; + bfd_ardata (abfd)->extended_names = NULL; + bfd_ardata (abfd)->extended_names_size = 0; */ bfd_ardata (abfd)->first_file_filepos = bfd_scan_vma (hdr.firstmemoff, (const char **) NULL, 10); @@ -2105,8 +2106,8 @@ xcoff64_create_csect_from_smclas (abfd, aux, symbol_name) else { (*_bfd_error_handler) - (_("%s: symbol `%s' has unrecognized smclas %d"), - bfd_archive_filename (abfd), symbol_name, aux->x_csect.x_smclas); + (_("%B: symbol `%s' has unrecognized smclas %d"), + abfd, symbol_name, aux->x_csect.x_smclas); bfd_set_error (bfd_error_bad_value); } @@ -2681,8 +2682,10 @@ const bfd_target rs6000coff64_vec = /* Copy */ _bfd_xcoff_copy_private_bfd_data, ((bfd_boolean (*) (bfd *, bfd *)) bfd_true), + _bfd_generic_init_private_section_data, ((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true), ((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true), + ((bfd_boolean (*) (bfd *, bfd *)) bfd_true), ((bfd_boolean (*) (bfd *, flagword)) bfd_true), ((bfd_boolean (*) (bfd *, void * )) bfd_true), @@ -2710,8 +2713,11 @@ const bfd_target rs6000coff64_vec = coff_print_symbol, coff_get_symbol_info, _bfd_xcoff_is_local_label_name, + coff_bfd_is_target_special_symbol, coff_get_lineno, coff_find_nearest_line, + _bfd_generic_find_line, + coff_find_inliner_info, coff_bfd_make_debug_symbol, _bfd_generic_read_minisymbols, _bfd_generic_minisymbol_to_symbol, @@ -2737,11 +2743,14 @@ const bfd_target rs6000coff64_vec = _bfd_generic_link_split_section, bfd_generic_gc_sections, bfd_generic_merge_sections, + bfd_generic_is_group_section, bfd_generic_discard_group, + _bfd_generic_section_already_linked, /* Dynamic */ _bfd_xcoff_get_dynamic_symtab_upper_bound, _bfd_xcoff_canonicalize_dynamic_symtab, + _bfd_nodynamic_get_synthetic_symtab, _bfd_xcoff_get_dynamic_reloc_upper_bound, _bfd_xcoff_canonicalize_dynamic_reloc, @@ -2924,8 +2933,10 @@ const bfd_target aix5coff64_vec = /* Copy */ _bfd_xcoff_copy_private_bfd_data, ((bfd_boolean (*) (bfd *, bfd *)) bfd_true), + _bfd_generic_init_private_section_data, ((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true), ((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true), + ((bfd_boolean (*) (bfd *, bfd *)) bfd_true), ((bfd_boolean (*) (bfd *, flagword)) bfd_true), ((bfd_boolean (*) (bfd *, void * )) bfd_true), @@ -2953,8 +2964,11 @@ const bfd_target aix5coff64_vec = coff_print_symbol, coff_get_symbol_info, _bfd_xcoff_is_local_label_name, + coff_bfd_is_target_special_symbol, coff_get_lineno, coff_find_nearest_line, + _bfd_generic_find_line, + coff_find_inliner_info, coff_bfd_make_debug_symbol, _bfd_generic_read_minisymbols, _bfd_generic_minisymbol_to_symbol, @@ -2980,11 +2994,14 @@ const bfd_target aix5coff64_vec = _bfd_generic_link_split_section, bfd_generic_gc_sections, bfd_generic_merge_sections, + bfd_generic_is_group_section, bfd_generic_discard_group, + _bfd_generic_section_already_linked, /* Dynamic */ _bfd_xcoff_get_dynamic_symtab_upper_bound, _bfd_xcoff_canonicalize_dynamic_symtab, + _bfd_nodynamic_get_synthetic_symtab, _bfd_xcoff_get_dynamic_reloc_upper_bound, _bfd_xcoff_canonicalize_dynamic_reloc, diff --git a/contrib/binutils/bfd/coffcode.h b/contrib/binutils/bfd/coffcode.h index 15d97093f67..256732c314d 100644 --- a/contrib/binutils/bfd/coffcode.h +++ b/contrib/binutils/bfd/coffcode.h @@ -1,6 +1,6 @@ /* Support for the generic parts of most COFF variants, for BFD. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003 + 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. Written by Cygnus Support. @@ -18,14 +18,11 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ +/* Most of this hacked by Steve Chamberlain, + sac@cygnus.com. */ /* -Most of this hacked by Steve Chamberlain, - sac@cygnus.com -*/ -/* - SECTION coff backends @@ -307,66 +304,69 @@ CODE_FRAGMENT #include "coffswap.h" #endif -#define STRING_SIZE_SIZE (4) +#define STRING_SIZE_SIZE 4 + +#define DOT_DEBUG ".debug" +#define GNU_LINKONCE_WI ".gnu.linkonce.wi." static long sec_to_styp_flags - PARAMS ((const char *, flagword)); + (const char *, flagword); static bfd_boolean styp_to_sec_flags - PARAMS ((bfd *, PTR, const char *, asection *, flagword *)); + (bfd *, void *, const char *, asection *, flagword *); static bfd_boolean coff_bad_format_hook - PARAMS ((bfd *, PTR)); + (bfd *, void *); static void coff_set_custom_section_alignment - PARAMS ((bfd *, asection *, const struct coff_section_alignment_entry *, - const unsigned int)); + (bfd *, asection *, const struct coff_section_alignment_entry *, + const unsigned int); static bfd_boolean coff_new_section_hook - PARAMS ((bfd *, asection *)); + (bfd *, asection *); static bfd_boolean coff_set_arch_mach_hook - PARAMS ((bfd *, PTR)); + (bfd *, void *); static bfd_boolean coff_write_relocs - PARAMS ((bfd *, int)); + (bfd *, int); static bfd_boolean coff_set_flags - PARAMS ((bfd *, unsigned int *, unsigned short *)); + (bfd *, unsigned int *, unsigned short *); static bfd_boolean coff_set_arch_mach - PARAMS ((bfd *, enum bfd_architecture, unsigned long)) ATTRIBUTE_UNUSED; + (bfd *, enum bfd_architecture, unsigned long) ATTRIBUTE_UNUSED; static bfd_boolean coff_compute_section_file_positions - PARAMS ((bfd *)); + (bfd *); static bfd_boolean coff_write_object_contents - PARAMS ((bfd *)) ATTRIBUTE_UNUSED; + (bfd *) ATTRIBUTE_UNUSED; static bfd_boolean coff_set_section_contents - PARAMS ((bfd *, asection *, const PTR, file_ptr, bfd_size_type)); -static PTR buy_and_read - PARAMS ((bfd *, file_ptr, bfd_size_type)); + (bfd *, asection *, const void *, file_ptr, bfd_size_type); +static void * buy_and_read + (bfd *, file_ptr, bfd_size_type); static bfd_boolean coff_slurp_line_table - PARAMS ((bfd *, asection *)); + (bfd *, asection *); static bfd_boolean coff_slurp_symbol_table - PARAMS ((bfd *)); + (bfd *); static enum coff_symbol_classification coff_classify_symbol - PARAMS ((bfd *, struct internal_syment *)); + (bfd *, struct internal_syment *); static bfd_boolean coff_slurp_reloc_table - PARAMS ((bfd *, asection *, asymbol **)); + (bfd *, asection *, asymbol **); static long coff_canonicalize_reloc - PARAMS ((bfd *, asection *, arelent **, asymbol **)); + (bfd *, asection *, arelent **, asymbol **); #ifndef coff_mkobject_hook -static PTR coff_mkobject_hook - PARAMS ((bfd *, PTR, PTR)); +static void * coff_mkobject_hook + (bfd *, void *, void *); #endif #ifdef COFF_WITH_PE static flagword handle_COMDAT - PARAMS ((bfd *, flagword, PTR, const char *, asection *)); + (bfd *, flagword, void *, const char *, asection *); #endif #ifdef COFF_IMAGE_WITH_PE static bfd_boolean coff_read_word - PARAMS ((bfd *, unsigned int *)); + (bfd *, unsigned int *); static unsigned int coff_compute_checksum - PARAMS ((bfd *)); + (bfd *); static bfd_boolean coff_apply_checksum - PARAMS ((bfd *)); + (bfd *); #endif #ifdef TICOFF static bfd_boolean ticoff0_bad_format_hook - PARAMS ((bfd *, PTR )); + (bfd *, void * ); static bfd_boolean ticoff1_bad_format_hook - PARAMS ((bfd *, PTR )); + (bfd *, void * ); #endif /* void warning(); */ @@ -379,6 +379,7 @@ static bfd_boolean ticoff1_bad_format_hook #ifndef COFF_WITH_PE /* Macros for setting debugging flags. */ + #ifdef STYP_DEBUG #define STYP_XCOFF_DEBUG STYP_DEBUG #else @@ -392,9 +393,7 @@ static bfd_boolean ticoff1_bad_format_hook #endif static long -sec_to_styp_flags (sec_name, sec_flags) - const char *sec_name; - flagword sec_flags; +sec_to_styp_flags (const char *sec_name, flagword sec_flags) { long styp_flags = 0; @@ -428,7 +427,7 @@ sec_to_styp_flags (sec_name, sec_flags) styp_flags = STYP_LIT; #endif /* _LIT */ } - else if (!strncmp (sec_name, ".debug", 6)) + else if (!strncmp (sec_name, DOT_DEBUG, sizeof (DOT_DEBUG) - 1)) { /* Handle the XCOFF debug section and DWARF2 debug sections. */ if (!sec_name[6]) @@ -441,7 +440,7 @@ sec_to_styp_flags (sec_name, sec_flags) styp_flags = STYP_DEBUG_INFO; } #ifdef COFF_LONG_SECTION_NAMES - else if (!strncmp (sec_name, ".gnu.linkonce.wi.", 17)) + else if (!strncmp (sec_name, GNU_LINKONCE_WI, sizeof (GNU_LINKONCE_WI) - 1)) { styp_flags = STYP_DEBUG_INFO; } @@ -491,12 +490,12 @@ sec_to_styp_flags (sec_name, sec_flags) } #ifdef STYP_CLINK - if (sec_flags & SEC_CLINK) + if (sec_flags & SEC_TIC54X_CLINK) styp_flags |= STYP_CLINK; #endif #ifdef STYP_BLOCK - if (sec_flags & SEC_BLOCK) + if (sec_flags & SEC_TIC54X_BLOCK) styp_flags |= STYP_BLOCK; #endif @@ -517,9 +516,7 @@ sec_to_styp_flags (sec_name, sec_flags) and honor whatever objcopy/strip, etc. sent us as input. */ static long -sec_to_styp_flags (sec_name, sec_flags) - const char *sec_name ATTRIBUTE_UNUSED; - flagword sec_flags; +sec_to_styp_flags (const char *sec_name, flagword sec_flags) { long styp_flags = 0; @@ -531,6 +528,11 @@ sec_to_styp_flags (sec_name, sec_flags) PE files. The STYP_* flags and the IMAGE_SCN_* flags overlap, but there are more IMAGE_SCN_* flags. */ + /* FIXME: There is no gas syntax to specify the debug section flag. */ + if (strncmp (sec_name, DOT_DEBUG, sizeof (DOT_DEBUG) - 1) == 0 + || strncmp (sec_name, GNU_LINKONCE_WI, sizeof (GNU_LINKONCE_WI) - 1) == 0) + sec_flags = SEC_DEBUGGING; + /* skip LOAD */ /* READONLY later */ /* skip RELOC */ @@ -543,10 +545,6 @@ sec_to_styp_flags (sec_name, sec_flags) /* skip ROM */ /* skip constRUCTOR */ /* skip CONTENTS */ -#ifdef STYP_NOLOAD - if ((sec_flags & (SEC_NEVER_LOAD | SEC_COFF_SHARED_LIBRARY)) != 0) - styp_flags |= STYP_NOLOAD; -#endif if ((sec_flags & SEC_IS_COMMON) != 0) styp_flags |= IMAGE_SCN_LNK_COMDAT; if ((sec_flags & SEC_DEBUGGING) != 0) @@ -562,17 +560,19 @@ sec_to_styp_flags (sec_name, sec_flags) /* skip LINK_DUPLICATES */ /* skip LINKER_CREATED */ - /* For now, the read/write bits are mapped onto SEC_READONLY, even - though the semantics don't quite match. The bits from the input - are retained in pei_section_data(abfd, section)->pe_flags. */ - - styp_flags |= IMAGE_SCN_MEM_READ; /* Always readable. */ - if ((sec_flags & SEC_READONLY) == 0) - styp_flags |= IMAGE_SCN_MEM_WRITE; /* Invert READONLY for write. */ - if (sec_flags & SEC_CODE) - styp_flags |= IMAGE_SCN_MEM_EXECUTE; /* CODE->EXECUTE. */ - if (sec_flags & SEC_SHARED) - styp_flags |= IMAGE_SCN_MEM_SHARED; /* Shared remains meaningful. */ + if (sec_flags & (SEC_ALLOC | SEC_LOAD)) + { + /* For now, the read/write bits are mapped onto SEC_READONLY, even + though the semantics don't quite match. The bits from the input + are retained in pei_section_data(abfd, section)->pe_flags. */ + styp_flags |= IMAGE_SCN_MEM_READ; /* Always readable. */ + if ((sec_flags & SEC_READONLY) == 0) + styp_flags |= IMAGE_SCN_MEM_WRITE; /* Invert READONLY for write. */ + if (sec_flags & SEC_CODE) + styp_flags |= IMAGE_SCN_MEM_EXECUTE; /* CODE->EXECUTE. */ + if (sec_flags & SEC_COFF_SHARED) + styp_flags |= IMAGE_SCN_MEM_SHARED; /* Shared remains meaningful. */ + } return styp_flags; } @@ -587,12 +587,11 @@ sec_to_styp_flags (sec_name, sec_flags) #ifndef COFF_WITH_PE static bfd_boolean -styp_to_sec_flags (abfd, hdr, name, section, flags_ptr) - bfd *abfd ATTRIBUTE_UNUSED; - PTR hdr; - const char *name; - asection *section ATTRIBUTE_UNUSED; - flagword *flags_ptr; +styp_to_sec_flags (bfd *abfd ATTRIBUTE_UNUSED, + void * hdr, + const char *name, + asection *section ATTRIBUTE_UNUSED, + flagword *flags_ptr) { struct internal_scnhdr *internal_s = (struct internal_scnhdr *) hdr; long styp_flags = internal_s->s_flags; @@ -600,12 +599,12 @@ styp_to_sec_flags (abfd, hdr, name, section, flags_ptr) #ifdef STYP_BLOCK if (styp_flags & STYP_BLOCK) - sec_flags |= SEC_BLOCK; + sec_flags |= SEC_TIC54X_BLOCK; #endif #ifdef STYP_CLINK if (styp_flags & STYP_CLINK) - sec_flags |= SEC_CLINK; + sec_flags |= SEC_TIC54X_CLINK; #endif #ifdef STYP_NOLOAD @@ -675,12 +674,12 @@ styp_to_sec_flags (abfd, hdr, name, section, flags_ptr) #endif sec_flags |= SEC_ALLOC; } - else if (strncmp (name, ".debug", 6) == 0 + else if (strncmp (name, DOT_DEBUG, sizeof (DOT_DEBUG) - 1) == 0 #ifdef _COMMENT || strcmp (name, _COMMENT) == 0 #endif #ifdef COFF_LONG_SECTION_NAMES - || strncmp (name, ".gnu.linkonce.wi.", 17) == 0 + || strncmp (name, GNU_LINKONCE_WI, sizeof (GNU_LINKONCE_WI) - 1) == 0 #endif || strncmp (name, ".stab", 5) == 0) { @@ -730,12 +729,11 @@ styp_to_sec_flags (abfd, hdr, name, section, flags_ptr) #else /* COFF_WITH_PE */ static flagword -handle_COMDAT (abfd, sec_flags, hdr, name, section) - bfd * abfd; - flagword sec_flags; - PTR hdr; - const char *name; - asection *section; +handle_COMDAT (bfd * abfd, + flagword sec_flags, + void * hdr, + const char *name, + asection *section) { struct internal_scnhdr *internal_s = (struct internal_scnhdr *) hdr; bfd_byte *esymstart, *esym, *esymend; @@ -773,7 +771,7 @@ handle_COMDAT (abfd, sec_flags, hdr, name, section) char buf[SYMNMLEN + 1]; const char *symname; - bfd_coff_swap_sym_in (abfd, (PTR) esym, (PTR) &isym); + bfd_coff_swap_sym_in (abfd, esym, & isym); if (sizeof (internal_s->s_name) > SYMNMLEN) { @@ -821,8 +819,6 @@ handle_COMDAT (abfd, sec_flags, hdr, name, section) /* The first time we've seen the symbol. */ union internal_auxent aux; - seen_state = 1; - /* If it isn't the stuff we're expecting, die; The MS documentation is vague, but it appears that the second entry serves BOTH @@ -850,12 +846,15 @@ handle_COMDAT (abfd, sec_flags, hdr, name, section) function). See comment above for more. */ if (strcmp (name, symname) != 0) - abort (); + _bfd_error_handler (_("%B: warning: COMDAT symbol '%s' does not match section name '%s'"), + abfd, symname, name); + + seen_state = 1; /* This is the section symbol. */ - bfd_coff_swap_aux_in (abfd, (PTR) (esym + bfd_coff_symesz (abfd)), + bfd_coff_swap_aux_in (abfd, (esym + bfd_coff_symesz (abfd)), isym.n_type, isym.n_sclass, - 0, isym.n_numaux, (PTR) &aux); + 0, isym.n_numaux, & aux); target_name = strchr (name, '$'); if (target_name != NULL) @@ -957,12 +956,13 @@ handle_COMDAT (abfd, sec_flags, hdr, name, section) Intel puts the two adjacent, but Alpha (at least) spreads them out. */ - amt = sizeof (struct bfd_comdat_info); - section->comdat = bfd_alloc (abfd, amt); - if (section->comdat == NULL) + amt = sizeof (struct coff_comdat_info); + coff_section_data (abfd, section)->comdat + = bfd_alloc (abfd, amt); + if (coff_section_data (abfd, section)->comdat == NULL) abort (); - section->comdat->symbol = + coff_section_data (abfd, section)->comdat->symbol = (esym - esymstart) / bfd_coff_symesz (abfd); amt = strlen (symname) + 1; @@ -971,7 +971,8 @@ handle_COMDAT (abfd, sec_flags, hdr, name, section) abort (); strcpy (newname, symname); - section->comdat->name = newname; + coff_section_data (abfd, section)->comdat->name + = newname; } goto breakloop; @@ -996,12 +997,11 @@ handle_COMDAT (abfd, sec_flags, hdr, name, section) any purpose other than objdump? */ static bfd_boolean -styp_to_sec_flags (abfd, hdr, name, section, flags_ptr) - bfd *abfd; - PTR hdr; - const char *name; - asection *section; - flagword *flags_ptr; +styp_to_sec_flags (bfd *abfd, + void * hdr, + const char *name, + asection *section, + flagword *flags_ptr) { struct internal_scnhdr *internal_s = (struct internal_scnhdr *) hdr; long styp_flags = internal_s->s_flags; @@ -1055,7 +1055,11 @@ styp_to_sec_flags (abfd, hdr, name, section, flags_ptr) unhandled = "IMAGE_SCN_MEM_NOT_CACHED"; break; case IMAGE_SCN_MEM_NOT_PAGED: - unhandled = "IMAGE_SCN_MEM_NOT_PAGED"; + /* Generate a warning message rather using the 'unhandled' + variable as this will allow some .sys files generate by + other toolchains to be processed. See bugzilla issue 196. */ + _bfd_error_handler (_("%B: Warning: Ignoring section flag IMAGE_SCN_MEM_NOT_PAGED in section %s"), + abfd, name); break; case IMAGE_SCN_MEM_EXECUTE: sec_flags |= SEC_CODE; @@ -1071,7 +1075,7 @@ styp_to_sec_flags (abfd, hdr, name, section, flags_ptr) sec_flags |= SEC_DEBUGGING; break; case IMAGE_SCN_MEM_SHARED: - sec_flags |= SEC_SHARED; + sec_flags |= SEC_COFF_SHARED; break; case IMAGE_SCN_LNK_REMOVE: sec_flags |= SEC_EXCLUDE; @@ -1109,8 +1113,8 @@ styp_to_sec_flags (abfd, hdr, name, section, flags_ptr) if (unhandled != NULL) { (*_bfd_error_handler) - (_("%s (%s): Section flag %s (0x%x) ignored"), - bfd_archive_filename (abfd), name, unhandled, flag); + (_("%B (%s): Section flag %s (0x%x) ignored"), + abfd, name, unhandled, flag); result = FALSE; } } @@ -1162,34 +1166,34 @@ Special entry points for gdb to swap in coff symbol table parts: .typedef struct .{ . void (*_bfd_coff_swap_aux_in) -. PARAMS ((bfd *, PTR, int, int, int, int, PTR)); +. (bfd *, void *, int, int, int, int, void *); . . void (*_bfd_coff_swap_sym_in) -. PARAMS ((bfd *, PTR, PTR)); +. (bfd *, void *, void *); . . void (*_bfd_coff_swap_lineno_in) -. PARAMS ((bfd *, PTR, PTR)); +. (bfd *, void *, void *); . . unsigned int (*_bfd_coff_swap_aux_out) -. PARAMS ((bfd *, PTR, int, int, int, int, PTR)); +. (bfd *, void *, int, int, int, int, void *); . . unsigned int (*_bfd_coff_swap_sym_out) -. PARAMS ((bfd *, PTR, PTR)); +. (bfd *, void *, void *); . . unsigned int (*_bfd_coff_swap_lineno_out) -. PARAMS ((bfd *, PTR, PTR)); +. (bfd *, void *, void *); . . unsigned int (*_bfd_coff_swap_reloc_out) -. PARAMS ((bfd *, PTR, PTR)); +. (bfd *, void *, void *); . . unsigned int (*_bfd_coff_swap_filehdr_out) -. PARAMS ((bfd *, PTR, PTR)); +. (bfd *, void *, void *); . . unsigned int (*_bfd_coff_swap_aouthdr_out) -. PARAMS ((bfd *, PTR, PTR)); +. (bfd *, void *, void *); . . unsigned int (*_bfd_coff_swap_scnhdr_out) -. PARAMS ((bfd *, PTR, PTR)); +. (bfd *, void *, void *); . . unsigned int _bfd_filhsz; . unsigned int _bfd_aoutsz; @@ -1206,86 +1210,86 @@ Special entry points for gdb to swap in coff symbol table parts: . unsigned int _bfd_coff_debug_string_prefix_length; . . void (*_bfd_coff_swap_filehdr_in) -. PARAMS ((bfd *, PTR, PTR)); +. (bfd *, void *, void *); . . void (*_bfd_coff_swap_aouthdr_in) -. PARAMS ((bfd *, PTR, PTR)); +. (bfd *, void *, void *); . . void (*_bfd_coff_swap_scnhdr_in) -. PARAMS ((bfd *, PTR, PTR)); +. (bfd *, void *, void *); . . void (*_bfd_coff_swap_reloc_in) -. PARAMS ((bfd *abfd, PTR, PTR)); +. (bfd *abfd, void *, void *); . . bfd_boolean (*_bfd_coff_bad_format_hook) -. PARAMS ((bfd *, PTR)); +. (bfd *, void *); . . bfd_boolean (*_bfd_coff_set_arch_mach_hook) -. PARAMS ((bfd *, PTR)); +. (bfd *, void *); . -. PTR (*_bfd_coff_mkobject_hook) -. PARAMS ((bfd *, PTR, PTR)); +. void * (*_bfd_coff_mkobject_hook) +. (bfd *, void *, void *); . . bfd_boolean (*_bfd_styp_to_sec_flags_hook) -. PARAMS ((bfd *, PTR, const char *, asection *, flagword *)); +. (bfd *, void *, const char *, asection *, flagword *); . . void (*_bfd_set_alignment_hook) -. PARAMS ((bfd *, asection *, PTR)); +. (bfd *, asection *, void *); . . bfd_boolean (*_bfd_coff_slurp_symbol_table) -. PARAMS ((bfd *)); +. (bfd *); . . bfd_boolean (*_bfd_coff_symname_in_debug) -. PARAMS ((bfd *, struct internal_syment *)); +. (bfd *, struct internal_syment *); . . bfd_boolean (*_bfd_coff_pointerize_aux_hook) -. PARAMS ((bfd *, combined_entry_type *, combined_entry_type *, -. unsigned int, combined_entry_type *)); +. (bfd *, combined_entry_type *, combined_entry_type *, +. unsigned int, combined_entry_type *); . . bfd_boolean (*_bfd_coff_print_aux) -. PARAMS ((bfd *, FILE *, combined_entry_type *, combined_entry_type *, -. combined_entry_type *, unsigned int)); +. (bfd *, FILE *, combined_entry_type *, combined_entry_type *, +. combined_entry_type *, unsigned int); . . void (*_bfd_coff_reloc16_extra_cases) -. PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *, -. bfd_byte *, unsigned int *, unsigned int *)); +. (bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *, +. bfd_byte *, unsigned int *, unsigned int *); . . int (*_bfd_coff_reloc16_estimate) -. PARAMS ((bfd *, asection *, arelent *, unsigned int, -. struct bfd_link_info *)); +. (bfd *, asection *, arelent *, unsigned int, +. struct bfd_link_info *); . . enum coff_symbol_classification (*_bfd_coff_classify_symbol) -. PARAMS ((bfd *, struct internal_syment *)); +. (bfd *, struct internal_syment *); . . bfd_boolean (*_bfd_coff_compute_section_file_positions) -. PARAMS ((bfd *)); +. (bfd *); . . bfd_boolean (*_bfd_coff_start_final_link) -. PARAMS ((bfd *, struct bfd_link_info *)); +. (bfd *, struct bfd_link_info *); . . bfd_boolean (*_bfd_coff_relocate_section) -. PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, -. struct internal_reloc *, struct internal_syment *, asection **)); +. (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, +. struct internal_reloc *, struct internal_syment *, asection **); . . reloc_howto_type *(*_bfd_coff_rtype_to_howto) -. PARAMS ((bfd *, asection *, struct internal_reloc *, +. (bfd *, asection *, struct internal_reloc *, . struct coff_link_hash_entry *, struct internal_syment *, -. bfd_vma *)); +. bfd_vma *); . . bfd_boolean (*_bfd_coff_adjust_symndx) -. PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, -. struct internal_reloc *, bfd_boolean *)); +. (bfd *, struct bfd_link_info *, bfd *, asection *, +. struct internal_reloc *, bfd_boolean *); . . bfd_boolean (*_bfd_coff_link_add_one_symbol) -. PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword, +. (struct bfd_link_info *, bfd *, const char *, flagword, . asection *, bfd_vma, const char *, bfd_boolean, bfd_boolean, -. struct bfd_link_hash_entry **)); +. struct bfd_link_hash_entry **); . . bfd_boolean (*_bfd_coff_link_output_has_begun) -. PARAMS ((bfd *, struct coff_final_link_info *)); +. (bfd *, struct coff_final_link_info *); . . bfd_boolean (*_bfd_coff_final_link_postscript) -. PARAMS ((bfd *, struct coff_final_link_info *)); +. (bfd *, struct coff_final_link_info *); . .} bfd_coff_backend_data; . @@ -1415,18 +1419,16 @@ Special entry points for gdb to swap in coff symbol table parts: . (info, abfd, name, flags, section, value, string, cp, coll, hashp)) . .#define bfd_coff_link_output_has_begun(a,p) \ -. ((coff_backend_info (a)->_bfd_coff_link_output_has_begun) (a,p)) +. ((coff_backend_info (a)->_bfd_coff_link_output_has_begun) (a, p)) .#define bfd_coff_final_link_postscript(a,p) \ -. ((coff_backend_info (a)->_bfd_coff_final_link_postscript) (a,p)) +. ((coff_backend_info (a)->_bfd_coff_final_link_postscript) (a, p)) . */ /* See whether the magic number matches. */ static bfd_boolean -coff_bad_format_hook (abfd, filehdr) - bfd * abfd ATTRIBUTE_UNUSED; - PTR filehdr; +coff_bad_format_hook (bfd * abfd ATTRIBUTE_UNUSED, void * filehdr) { struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr; @@ -1451,9 +1453,7 @@ coff_bad_format_hook (abfd, filehdr) #ifdef TICOFF static bfd_boolean -ticoff0_bad_format_hook (abfd, filehdr) - bfd *abfd ATTRIBUTE_UNUSED; - PTR filehdr; +ticoff0_bad_format_hook (bfd *abfd ATTRIBUTE_UNUSED, void * filehdr) { struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr; @@ -1466,9 +1466,7 @@ ticoff0_bad_format_hook (abfd, filehdr) #ifdef TICOFF static bfd_boolean -ticoff1_bad_format_hook (abfd, filehdr) - bfd *abfd ATTRIBUTE_UNUSED; - PTR filehdr; +ticoff1_bad_format_hook (bfd *abfd ATTRIBUTE_UNUSED, void * filehdr) { struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr; @@ -1483,11 +1481,10 @@ ticoff1_bad_format_hook (abfd, filehdr) default. */ static void -coff_set_custom_section_alignment (abfd, section, alignment_table, table_size) - bfd *abfd ATTRIBUTE_UNUSED; - asection *section; - const struct coff_section_alignment_entry *alignment_table; - const unsigned int table_size; +coff_set_custom_section_alignment (bfd *abfd ATTRIBUTE_UNUSED, + asection *section, + const struct coff_section_alignment_entry *alignment_table, + const unsigned int table_size) { const unsigned int default_alignment = COFF_DEFAULT_SECTION_ALIGNMENT_POWER; unsigned int i; @@ -1547,13 +1544,8 @@ static const unsigned int coff_section_alignment_table_size = particular implementation of COFF. */ static bfd_boolean -coff_new_section_hook (abfd, section) - bfd * abfd; - asection * section; +coff_new_section_hook (bfd * abfd, asection * section) { - combined_entry_type *native; - bfd_size_type amt; - section->alignment_power = COFF_DEFAULT_SECTION_ALIGNMENT_POWER; #ifdef RS6000COFF_C @@ -1565,27 +1557,34 @@ coff_new_section_hook (abfd, section) section->alignment_power = bfd_xcoff_data_align_power (abfd); #endif - /* Allocate aux records for section symbols, to store size and - related info. + /* PR binutils/2724: Only real sections have a symbol that + has the coff_symbol_type structure allocated for it. */ + if (! bfd_is_const_section (section)) + { + combined_entry_type *native; + bfd_size_type amt; - @@ The 10 is a guess at a plausible maximum number of aux entries - (but shouldn't be a constant). */ - amt = sizeof (combined_entry_type) * 10; - native = (combined_entry_type *) bfd_zalloc (abfd, amt); - if (native == NULL) - return FALSE; + /* Allocate aux records for section symbols, to store size and + related info. - /* We don't need to set up n_name, n_value, or n_scnum in the native - symbol information, since they'll be overridden by the BFD symbol - anyhow. However, we do need to set the type and storage class, - in case this symbol winds up getting written out. The value 0 - for n_numaux is already correct. */ + @@ The 10 is a guess at a plausible maximum number of aux entries + (but shouldn't be a constant). */ + amt = sizeof (combined_entry_type) * 10; + native = bfd_zalloc (abfd, amt); + if (native == NULL) + return FALSE; - native->u.syment.n_type = T_NULL; - native->u.syment.n_sclass = C_STAT; - - coffsymbol (section->symbol)->native = native; + /* We don't need to set up n_name, n_value, or n_scnum in the native + symbol information, since they'll be overridden by the BFD symbol + anyhow. However, we do need to set the type and storage class, + in case this symbol winds up getting written out. The value 0 + for n_numaux is already correct. */ + native->u.syment.n_type = T_NULL; + native->u.syment.n_sclass = C_STAT; + coffsymbol (section->symbol)->native = native; + } + coff_set_custom_section_alignment (abfd, section, coff_section_alignment_table, coff_section_alignment_table_size); @@ -1597,13 +1596,10 @@ coff_new_section_hook (abfd, section) /* Set the alignment of a BFD section. */ -static void coff_set_alignment_hook PARAMS ((bfd *, asection *, PTR)); - static void -coff_set_alignment_hook (abfd, section, scnhdr) - bfd * abfd ATTRIBUTE_UNUSED; - asection * section; - PTR scnhdr; +coff_set_alignment_hook (bfd * abfd ATTRIBUTE_UNUSED, + asection * section, + void * scnhdr) { struct internal_scnhdr *hdr = (struct internal_scnhdr *) scnhdr; unsigned int i; @@ -1632,25 +1628,22 @@ coff_set_alignment_hook (abfd, section, scnhdr) #ifdef COFF_WITH_PE /* A couple of macros to help setting the alignment power field. */ -#define ALIGN_SET(field,x,y) \ - if (((field) & IMAGE_SCN_ALIGN_64BYTES) == x )\ - {\ - section->alignment_power = y;\ - } +#define ALIGN_SET(field, x, y) \ + if (((field) & IMAGE_SCN_ALIGN_64BYTES) == x)\ + {\ + section->alignment_power = y;\ + } -#define ELIFALIGN_SET(field,x,y) \ - else if (( (field) & IMAGE_SCN_ALIGN_64BYTES) == x ) \ - {\ - section->alignment_power = y;\ - } - -static void coff_set_alignment_hook PARAMS ((bfd *, asection *, PTR)); +#define ELIFALIGN_SET(field, x, y) \ + else if (((field) & IMAGE_SCN_ALIGN_64BYTES) == x) \ + {\ + section->alignment_power = y;\ + } static void -coff_set_alignment_hook (abfd, section, scnhdr) - bfd * abfd ATTRIBUTE_UNUSED; - asection * section; - PTR scnhdr; +coff_set_alignment_hook (bfd * abfd ATTRIBUTE_UNUSED, + asection * section, + void * scnhdr) { struct internal_scnhdr *hdr = (struct internal_scnhdr *) scnhdr; bfd_size_type amt; @@ -1670,22 +1663,19 @@ coff_set_alignment_hook (abfd, section, scnhdr) if (coff_section_data (abfd, section) == NULL) { amt = sizeof (struct coff_section_tdata); - section->used_by_bfd = (PTR) bfd_zalloc (abfd, amt); + section->used_by_bfd = bfd_zalloc (abfd, amt); if (section->used_by_bfd == NULL) - { - /* FIXME: Return error. */ - abort (); - } + /* FIXME: Return error. */ + abort (); } + if (pei_section_data (abfd, section) == NULL) { amt = sizeof (struct pei_section_tdata); - coff_section_data (abfd, section)->tdata = (PTR) bfd_zalloc (abfd, amt); + coff_section_data (abfd, section)->tdata = bfd_zalloc (abfd, amt); if (coff_section_data (abfd, section)->tdata == NULL) - { - /* FIXME: Return error. */ - abort (); - } + /* FIXME: Return error. */ + abort (); } pei_section_data (abfd, section)->virt_size = hdr->s_paddr; pei_section_data (abfd, section)->pe_flags = hdr->s_flags; @@ -1701,7 +1691,7 @@ coff_set_alignment_hook (abfd, section, scnhdr) bfd_size_type relsz = bfd_coff_relsz (abfd); bfd_seek (abfd, (file_ptr) hdr->s_relptr, 0); - if (bfd_bread ((PTR) &dst, relsz, abfd) != relsz) + if (bfd_bread (& dst, relsz, abfd) != relsz) return; coff_swap_reloc_in (abfd, &dst, &n); @@ -1724,17 +1714,11 @@ coff_set_alignment_hook (abfd, section, scnhdr) When we see one, we correct the reloc and line number counts in the real header, and remove the section we just created. */ -static void coff_set_alignment_hook PARAMS ((bfd *, asection *, PTR)); - static void -coff_set_alignment_hook (abfd, section, scnhdr) - bfd *abfd; - asection *section; - PTR scnhdr; +coff_set_alignment_hook (bfd *abfd, asection *section, void * scnhdr) { struct internal_scnhdr *hdr = (struct internal_scnhdr *) scnhdr; asection *real_sec; - asection **ps; if ((hdr->s_flags & STYP_OVRFLO) == 0) return; @@ -1746,21 +1730,17 @@ coff_set_alignment_hook (abfd, section, scnhdr) real_sec->reloc_count = hdr->s_paddr; real_sec->lineno_count = hdr->s_vaddr; - for (ps = &abfd->sections; *ps != NULL; ps = &(*ps)->next) + if (!bfd_section_removed_from_list (abfd, section)) { - if (*ps == section) - { - bfd_section_list_remove (abfd, ps); - --abfd->section_count; - break; - } + bfd_section_list_remove (abfd, section); + --abfd->section_count; } } #else /* ! RS6000COFF_C */ #define coff_set_alignment_hook \ - ((void (*) PARAMS ((bfd *, asection *, PTR))) bfd_void) + ((void (*) (bfd *, asection *, void *)) bfd_void) #endif /* ! RS6000COFF_C */ #endif /* ! COFF_WITH_PE */ @@ -1768,22 +1748,19 @@ coff_set_alignment_hook (abfd, section, scnhdr) #ifndef coff_mkobject -static bfd_boolean coff_mkobject PARAMS ((bfd *)); - static bfd_boolean -coff_mkobject (abfd) - bfd * abfd; +coff_mkobject (bfd * abfd) { coff_data_type *coff; bfd_size_type amt = sizeof (coff_data_type); - abfd->tdata.coff_obj_data = (struct coff_tdata *) bfd_zalloc (abfd, amt); - if (abfd->tdata.coff_obj_data == 0) + abfd->tdata.coff_obj_data = bfd_zalloc (abfd, amt); + if (abfd->tdata.coff_obj_data == NULL) return FALSE; coff = coff_data (abfd); - coff->symbols = (coff_symbol_type *) NULL; - coff->conversion_table = (unsigned int *) NULL; - coff->raw_syments = (struct coff_ptr_struct *) NULL; + coff->symbols = NULL; + coff->conversion_table = NULL; + coff->raw_syments = NULL; coff->relocbase = 0; coff->local_toc_sym_map = 0; @@ -1796,11 +1773,10 @@ coff_mkobject (abfd) /* Create the COFF backend specific information. */ #ifndef coff_mkobject_hook -static PTR -coff_mkobject_hook (abfd, filehdr, aouthdr) - bfd * abfd; - PTR filehdr; - PTR aouthdr ATTRIBUTE_UNUSED; +static void * +coff_mkobject_hook (bfd * abfd, + void * filehdr, + void * aouthdr ATTRIBUTE_UNUSED) { struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr; coff_data_type *coff; @@ -1870,7 +1846,7 @@ coff_mkobject_hook (abfd, filehdr, aouthdr) abfd->flags |= HAS_DEBUG; #endif - return (PTR) coff; + return coff; } #endif @@ -1882,9 +1858,7 @@ coff_mkobject_hook (abfd, filehdr, aouthdr) at linking together COFF files for different architectures. */ static bfd_boolean -coff_set_arch_mach_hook (abfd, filehdr) - bfd *abfd; - PTR filehdr; +coff_set_arch_mach_hook (bfd *abfd, void * filehdr) { unsigned long machine; enum bfd_architecture arch; @@ -1918,12 +1892,6 @@ coff_set_arch_mach_hook (abfd, filehdr) arch = bfd_arch_ia64; break; #endif -#ifdef A29K_MAGIC_BIG - case A29K_MAGIC_BIG: - case A29K_MAGIC_LITTLE: - arch = bfd_arch_a29k; - break; -#endif #ifdef ARMMAGIC case ARMMAGIC: case ARMPEMAGIC: @@ -1967,6 +1935,22 @@ coff_set_arch_mach_hook (abfd, filehdr) machine = bfd_mach_m68020; break; #endif +#ifdef MAXQ20MAGIC + case MAXQ20MAGIC: + arch = bfd_arch_maxq; + switch (internal_f->f_flags & F_MACHMASK) + { + case F_MAXQ10: + machine = bfd_mach_maxq10; + break; + case F_MAXQ20: + machine = bfd_mach_maxq20; + break; + default: + return FALSE; + } + break; +#endif #ifdef MC88MAGIC case MC88MAGIC: case MC88DMAGIC: @@ -1975,6 +1959,23 @@ coff_set_arch_mach_hook (abfd, filehdr) machine = 88100; break; #endif +#ifdef Z80MAGIC + case Z80MAGIC: + arch = bfd_arch_z80; + switch (internal_f->f_flags & F_MACHMASK) + { + case 0: + case bfd_mach_z80strict << 12: + case bfd_mach_z80 << 12: + case bfd_mach_z80full << 12: + case bfd_mach_r800 << 12: + machine = ((unsigned)internal_f->f_flags & F_MACHMASK) >> 12; + break; + default: + return FALSE; + } + break; +#endif #ifdef Z8KMAGIC case Z8KMAGIC: arch = bfd_arch_z8k; @@ -2061,14 +2062,14 @@ coff_set_arch_mach_hook (abfd, filehdr) struct internal_syment sym; bfd_size_type amt = bfd_coff_symesz (abfd); - buf = (bfd_byte *) bfd_malloc (amt); + buf = bfd_malloc (amt); if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0 || bfd_bread (buf, amt, abfd) != amt) { free (buf); return FALSE; } - bfd_coff_swap_sym_in (abfd, (PTR) buf, (PTR) &sym); + bfd_coff_swap_sym_in (abfd, buf, & sym); if (sym.n_sclass == C_FILE) cputype = sym.n_type & 0xff; else @@ -2257,13 +2258,8 @@ coff_set_arch_mach_hook (abfd, filehdr) #ifdef SYMNAME_IN_DEBUG -static bfd_boolean symname_in_debug_hook - PARAMS ((bfd *, struct internal_syment *)); - static bfd_boolean -symname_in_debug_hook (abfd, sym) - bfd * abfd ATTRIBUTE_UNUSED; - struct internal_syment *sym; +symname_in_debug_hook (bfd * abfd ATTRIBUTE_UNUSED, struct internal_syment *sym) { return SYMNAME_IN_DEBUG (sym) != 0; } @@ -2271,7 +2267,7 @@ symname_in_debug_hook (abfd, sym) #else #define symname_in_debug_hook \ - (bfd_boolean (*) PARAMS ((bfd *, struct internal_syment *))) bfd_false + (bfd_boolean (*) (bfd *, struct internal_syment *)) bfd_false #endif @@ -2283,17 +2279,12 @@ symname_in_debug_hook (abfd, sym) /* Handle the csect auxent of a C_EXT or C_HIDEXT symbol. */ -static bfd_boolean coff_pointerize_aux_hook - PARAMS ((bfd *, combined_entry_type *, combined_entry_type *, - unsigned int, combined_entry_type *)); - static bfd_boolean -coff_pointerize_aux_hook (abfd, table_base, symbol, indaux, aux) - bfd *abfd ATTRIBUTE_UNUSED; - combined_entry_type *table_base; - combined_entry_type *symbol; - unsigned int indaux; - combined_entry_type *aux; +coff_pointerize_aux_hook (bfd *abfd ATTRIBUTE_UNUSED, + combined_entry_type *table_base, + combined_entry_type *symbol, + unsigned int indaux, + combined_entry_type *aux) { int class = symbol->u.syment.n_sclass; @@ -2322,17 +2313,12 @@ coff_pointerize_aux_hook (abfd, table_base, symbol, indaux, aux) /* We don't want to pointerize bal entries. */ -static bfd_boolean coff_pointerize_aux_hook - PARAMS ((bfd *, combined_entry_type *, combined_entry_type *, - unsigned int, combined_entry_type *)); - static bfd_boolean -coff_pointerize_aux_hook (abfd, table_base, symbol, indaux, aux) - bfd *abfd ATTRIBUTE_UNUSED; - combined_entry_type *table_base ATTRIBUTE_UNUSED; - combined_entry_type *symbol; - unsigned int indaux; - combined_entry_type *aux ATTRIBUTE_UNUSED; +coff_pointerize_aux_hook (bfd *abfd ATTRIBUTE_UNUSED, + combined_entry_type *table_base ATTRIBUTE_UNUSED, + combined_entry_type *symbol, + unsigned int indaux, + combined_entry_type *aux ATTRIBUTE_UNUSED) { /* Return TRUE if we don't want to pointerize this aux entry, which is the case for the lastfirst aux entry for a C_LEAFPROC symbol. */ @@ -2351,18 +2337,13 @@ coff_pointerize_aux_hook (abfd, table_base, symbol, indaux, aux) /* Print an aux entry. This returns TRUE if it has printed it. */ -static bfd_boolean coff_print_aux - PARAMS ((bfd *, FILE *, combined_entry_type *, combined_entry_type *, - combined_entry_type *, unsigned int)); - static bfd_boolean -coff_print_aux (abfd, file, table_base, symbol, aux, indaux) - bfd *abfd ATTRIBUTE_UNUSED; - FILE *file ATTRIBUTE_UNUSED; - combined_entry_type *table_base ATTRIBUTE_UNUSED; - combined_entry_type *symbol ATTRIBUTE_UNUSED; - combined_entry_type *aux ATTRIBUTE_UNUSED; - unsigned int indaux ATTRIBUTE_UNUSED; +coff_print_aux (bfd *abfd ATTRIBUTE_UNUSED, + FILE *file ATTRIBUTE_UNUSED, + combined_entry_type *table_base ATTRIBUTE_UNUSED, + combined_entry_type *symbol ATTRIBUTE_UNUSED, + combined_entry_type *aux ATTRIBUTE_UNUSED, + unsigned int indaux ATTRIBUTE_UNUSED) { #ifdef RS6000COFF_C if ((symbol->u.syment.n_sclass == C_EXT @@ -2375,7 +2356,8 @@ coff_print_aux (abfd, file, table_base, symbol, aux, indaux) { BFD_ASSERT (! aux->fix_scnlen); #ifdef XCOFF64 - fprintf (file, "val %5lld", aux->u.auxent.x_csect.x_scnlen.l); + fprintf (file, "val %5lld", + (long long) aux->u.auxent.x_csect.x_scnlen.l); #else fprintf (file, "val %5ld", (long) aux->u.auxent.x_csect.x_scnlen.l); #endif @@ -2385,7 +2367,8 @@ coff_print_aux (abfd, file, table_base, symbol, aux, indaux) fprintf (file, "indx "); if (! aux->fix_scnlen) #ifdef XCOFF64 - fprintf (file, "%4lld", aux->u.auxent.x_csect.x_scnlen.l); + fprintf (file, "%4lld", + (long long) aux->u.auxent.x_csect.x_scnlen.l); #else fprintf (file, "%4ld", (long) aux->u.auxent.x_csect.x_scnlen.l); #endif @@ -2428,13 +2411,10 @@ SUBSUBSECTION #ifdef TARG_AUX -static int compare_arelent_ptr PARAMS ((const PTR, const PTR)); /* AUX's ld wants relocations to be sorted. */ static int -compare_arelent_ptr (x, y) - const PTR x; - const PTR y; +compare_arelent_ptr (const void * x, const void * y) { const arelent **a = (const arelent **) x; const arelent **b = (const arelent **) y; @@ -2447,13 +2427,11 @@ compare_arelent_ptr (x, y) #endif /* TARG_AUX */ static bfd_boolean -coff_write_relocs (abfd, first_undef) - bfd * abfd; - int first_undef; +coff_write_relocs (bfd * abfd, int first_undef) { asection *s; - for (s = abfd->sections; s != (asection *) NULL; s = s->next) + for (s = abfd->sections; s != NULL; s = s->next) { unsigned int i; struct external_reloc dst; @@ -2468,7 +2446,7 @@ coff_write_relocs (abfd, first_undef) amt = s->reloc_count; amt *= sizeof (arelent *); - p = (arelent **) bfd_malloc (amt); + p = bfd_malloc (amt); if (p == NULL && s->reloc_count > 0) return FALSE; memcpy (p, s->orelocation, (size_t) amt); @@ -2485,12 +2463,12 @@ coff_write_relocs (abfd, first_undef) /* Encode real count here as first reloc. */ struct internal_reloc n; - memset ((PTR) & n, 0, sizeof (n)); + memset (& n, 0, sizeof (n)); /* Add one to count *this* reloc (grr). */ n.r_vaddr = s->reloc_count + 1; coff_swap_reloc_out (abfd, &n, &dst); - if (bfd_bwrite ((PTR) & dst, (bfd_size_type) bfd_coff_relsz (abfd), - abfd) != bfd_coff_relsz (abfd)) + if (bfd_bwrite (& dst, (bfd_size_type) bfd_coff_relsz (abfd), + abfd) != bfd_coff_relsz (abfd)) return FALSE; } #endif @@ -2500,7 +2478,7 @@ coff_write_relocs (abfd, first_undef) struct internal_reloc n; arelent *q = p[i]; - memset ((PTR) & n, 0, sizeof (n)); + memset (& n, 0, sizeof (n)); /* Now we've renumbered the symbols we know where the undefined symbols live in the table. Check the reloc @@ -2522,11 +2500,12 @@ coff_write_relocs (abfd, first_undef) { const char *intable = outsyms[j]->name; - if (strcmp (intable, sname) == 0) { - /* Got a hit, so repoint the reloc. */ - q->sym_ptr_ptr = outsyms + j; - break; - } + if (strcmp (intable, sname) == 0) + { + /* Got a hit, so repoint the reloc. */ + q->sym_ptr_ptr = outsyms + j; + break; + } } } @@ -2543,7 +2522,7 @@ coff_write_relocs (abfd, first_undef) if (q->sym_ptr_ptr) { #ifdef SECTION_RELATIVE_ABSOLUTE_SYMBOL_P - if (SECTION_RELATIVE_ABSOLUTE_SYMBOL_P (q,s)) + if (SECTION_RELATIVE_ABSOLUTE_SYMBOL_P (q, s)) #else if ((*q->sym_ptr_ptr)->section == bfd_abs_section_ptr && ((*q->sym_ptr_ptr)->flags & BSF_SECTION_SYM) != 0) @@ -2573,7 +2552,7 @@ coff_write_relocs (abfd, first_undef) #endif coff_swap_reloc_out (abfd, &n, &dst); - if (bfd_bwrite ((PTR) & dst, (bfd_size_type) bfd_coff_relsz (abfd), + if (bfd_bwrite (& dst, (bfd_size_type) bfd_coff_relsz (abfd), abfd) != bfd_coff_relsz (abfd)) return FALSE; } @@ -2591,68 +2570,62 @@ coff_write_relocs (abfd, first_undef) type. Result is TRUE if we can represent the arch&type, FALSE if not. */ static bfd_boolean -coff_set_flags (abfd, magicp, flagsp) - bfd * abfd; - unsigned int *magicp ATTRIBUTE_UNUSED; - unsigned short *flagsp ATTRIBUTE_UNUSED; +coff_set_flags (bfd * abfd, + unsigned int *magicp ATTRIBUTE_UNUSED, + unsigned short *flagsp ATTRIBUTE_UNUSED) { switch (bfd_get_arch (abfd)) { -#ifdef Z8KMAGIC - case bfd_arch_z8k: - *magicp = Z8KMAGIC; +#ifdef Z80MAGIC + case bfd_arch_z80: + *magicp = Z80MAGIC; switch (bfd_get_mach (abfd)) { - case bfd_mach_z8001: - *flagsp = F_Z8001; - break; - case bfd_mach_z8002: - *flagsp = F_Z8002; + case 0: + case bfd_mach_z80strict: + case bfd_mach_z80: + case bfd_mach_z80full: + case bfd_mach_r800: + *flagsp = bfd_get_mach (abfd) << 12; break; default: return FALSE; } return TRUE; #endif -#ifdef I960ROMAGIC +#ifdef Z8KMAGIC + case bfd_arch_z8k: + *magicp = Z8KMAGIC; + + switch (bfd_get_mach (abfd)) + { + case bfd_mach_z8001: *flagsp = F_Z8001; break; + case bfd_mach_z8002: *flagsp = F_Z8002; break; + default: return FALSE; + } + return TRUE; +#endif + +#ifdef I960ROMAGIC case bfd_arch_i960: { unsigned flags; + *magicp = I960ROMAGIC; - /* - ((bfd_get_file_flags(abfd) & WP_TEXT) ? I960ROMAGIC : - I960RWMAGIC); FIXME??? - */ + switch (bfd_get_mach (abfd)) { - case bfd_mach_i960_core: - flags = F_I960CORE; - break; - case bfd_mach_i960_kb_sb: - flags = F_I960KB; - break; - case bfd_mach_i960_mc: - flags = F_I960MC; - break; - case bfd_mach_i960_xa: - flags = F_I960XA; - break; - case bfd_mach_i960_ca: - flags = F_I960CA; - break; - case bfd_mach_i960_ka_sa: - flags = F_I960KA; - break; - case bfd_mach_i960_jx: - flags = F_I960JX; - break; - case bfd_mach_i960_hx: - flags = F_I960HX; - break; - default: - return FALSE; + case bfd_mach_i960_core: flags = F_I960CORE; break; + case bfd_mach_i960_kb_sb: flags = F_I960KB; break; + case bfd_mach_i960_mc: flags = F_I960MC; break; + case bfd_mach_i960_xa: flags = F_I960XA; break; + case bfd_mach_i960_ca: flags = F_I960CA; break; + case bfd_mach_i960_ka_sa: flags = F_I960KA; break; + case bfd_mach_i960_jx: flags = F_I960JX; break; + case bfd_mach_i960_hx: flags = F_I960HX; break; + default: return FALSE; } *flagsp = flags; return TRUE; @@ -2698,6 +2671,7 @@ coff_set_flags (abfd, magicp, flagsp) *magicp = TIC80_ARCH_MAGIC; return TRUE; #endif + #ifdef ARMMAGIC case bfd_arch_arm: #ifdef ARM_WINCE @@ -2736,12 +2710,13 @@ coff_set_flags (abfd, magicp, flagsp) } return TRUE; #endif + #ifdef PPCMAGIC case bfd_arch_powerpc: *magicp = PPCMAGIC; return TRUE; - break; #endif + #ifdef I386MAGIC case bfd_arch_i386: *magicp = I386MAGIC; @@ -2750,20 +2725,20 @@ coff_set_flags (abfd, magicp, flagsp) *magicp = LYNXCOFFMAGIC; #endif return TRUE; - break; #endif + #ifdef I860MAGIC case bfd_arch_i860: *magicp = I860MAGIC; return TRUE; - break; #endif + #ifdef IA64MAGIC case bfd_arch_ia64: *magicp = IA64MAGIC; return TRUE; - break; #endif + #ifdef MC68MAGIC case bfd_arch_m68k: #ifdef APOLLOM68KMAGIC @@ -2781,34 +2756,24 @@ coff_set_flags (abfd, magicp, flagsp) *magicp = LYNXCOFFMAGIC; #endif return TRUE; - break; #endif #ifdef MC88MAGIC case bfd_arch_m88k: *magicp = MC88OMAGIC; return TRUE; - break; #endif + #ifdef H8300MAGIC case bfd_arch_h8300: switch (bfd_get_mach (abfd)) { - case bfd_mach_h8300: - *magicp = H8300MAGIC; - return TRUE; - case bfd_mach_h8300h: - *magicp = H8300HMAGIC; - return TRUE; - case bfd_mach_h8300s: - *magicp = H8300SMAGIC; - return TRUE; - case bfd_mach_h8300hn: - *magicp = H8300HNMAGIC; - return TRUE; - case bfd_mach_h8300sn: - *magicp = H8300SNMAGIC; - return TRUE; + case bfd_mach_h8300: *magicp = H8300MAGIC; return TRUE; + case bfd_mach_h8300h: *magicp = H8300HMAGIC; return TRUE; + case bfd_mach_h8300s: *magicp = H8300SMAGIC; return TRUE; + case bfd_mach_h8300hn: *magicp = H8300HNMAGIC; return TRUE; + case bfd_mach_h8300sn: *magicp = H8300SNMAGIC; return TRUE; + default: break; } break; #endif @@ -2824,14 +2789,12 @@ coff_set_flags (abfd, magicp, flagsp) *magicp = SH_ARCH_MAGIC_LITTLE; #endif return TRUE; - break; #endif #ifdef MIPS_ARCH_MAGIC_WINCE case bfd_arch_mips: *magicp = MIPS_ARCH_MAGIC_WINCE; return TRUE; - break; #endif #ifdef SPARCMAGIC @@ -2842,7 +2805,6 @@ coff_set_flags (abfd, magicp, flagsp) *magicp = LYNXCOFFMAGIC; #endif return TRUE; - break; #endif #ifdef H8500MAGIC @@ -2851,21 +2813,11 @@ coff_set_flags (abfd, magicp, flagsp) return TRUE; break; #endif -#ifdef A29K_MAGIC_BIG - case bfd_arch_a29k: - if (bfd_big_endian (abfd)) - *magicp = A29K_MAGIC_BIG; - else - *magicp = A29K_MAGIC_LITTLE; - return TRUE; - break; -#endif #ifdef WE32KMAGIC case bfd_arch_we32k: *magicp = WE32KMAGIC; return TRUE; - break; #endif #ifdef RS6000COFF_C @@ -2876,7 +2828,6 @@ coff_set_flags (abfd, magicp, flagsp) BFD_ASSERT (bfd_get_flavour (abfd) == bfd_target_xcoff_flavour); *magicp = bfd_xcoff_magic_number (abfd); return TRUE; - break; #endif #ifdef MCOREMAGIC @@ -2900,6 +2851,17 @@ coff_set_flags (abfd, magicp, flagsp) return TRUE; #endif +#ifdef MAXQ20MAGIC + case bfd_arch_maxq: + * magicp = MAXQ20MAGIC; + switch (bfd_get_mach (abfd)) + { + case bfd_mach_maxq10: * flagsp = F_MAXQ10; return TRUE; + case bfd_mach_maxq20: * flagsp = F_MAXQ20; return TRUE; + default: return FALSE; + } +#endif + default: /* Unknown architecture. */ /* Fall through to "return FALSE" below, to avoid "statement never reached" errors on the one below. */ @@ -2910,10 +2872,9 @@ coff_set_flags (abfd, magicp, flagsp) } static bfd_boolean -coff_set_arch_mach (abfd, arch, machine) - bfd * abfd; - enum bfd_architecture arch; - unsigned long machine; +coff_set_arch_mach (bfd * abfd, + enum bfd_architecture arch, + unsigned long machine) { unsigned dummy1; unsigned short dummy2; @@ -2923,9 +2884,9 @@ coff_set_arch_mach (abfd, arch, machine) if (arch != bfd_arch_unknown && ! coff_set_flags (abfd, &dummy1, &dummy2)) - return FALSE; /* We can't represent this type */ + return FALSE; /* We can't represent this type. */ - return TRUE; /* We're easy ... */ + return TRUE; /* We're easy... */ } #ifdef COFF_IMAGE_WITH_PE @@ -2933,12 +2894,8 @@ coff_set_arch_mach (abfd, arch, machine) /* This is used to sort sections by VMA, as required by PE image files. */ -static int sort_by_secaddr PARAMS ((const PTR, const PTR)); - static int -sort_by_secaddr (arg1, arg2) - const PTR arg1; - const PTR arg2; +sort_by_secaddr (const void * arg1, const void * arg2) { const asection *a = *(const asection **) arg1; const asection *b = *(const asection **) arg2; @@ -2947,8 +2904,8 @@ sort_by_secaddr (arg1, arg2) return -1; else if (a->vma > b->vma) return 1; - else - return 0; + + return 0; } #endif /* COFF_IMAGE_WITH_PE */ @@ -2963,11 +2920,10 @@ sort_by_secaddr (arg1, arg2) #endif static bfd_boolean -coff_compute_section_file_positions (abfd) - bfd * abfd; +coff_compute_section_file_positions (bfd * abfd) { asection *current; - asection *previous = (asection *) NULL; + asection *previous = NULL; file_ptr sofar = bfd_coff_filhsz (abfd); bfd_boolean align_adjust; #ifdef ALIGN_SECTIONS_IN_FILE @@ -3004,10 +2960,10 @@ coff_compute_section_file_positions (abfd) { asection *dsec; - dsec = bfd_make_section_old_way (abfd, ".debug"); + dsec = bfd_make_section_old_way (abfd, DOT_DEBUG); if (dsec == NULL) abort (); - dsec->_raw_size = sz; + dsec->size = sz; dsec->flags |= SEC_HAS_CONTENTS; } } @@ -3015,6 +2971,7 @@ coff_compute_section_file_positions (abfd) #ifdef COFF_IMAGE_WITH_PE int page_size; + if (coff_data (abfd)->link_info) { page_size = pe_data (abfd)->pe_opthdr.FileAlignment; @@ -3033,11 +2990,9 @@ coff_compute_section_file_positions (abfd) #endif if (bfd_get_start_address (abfd)) - { - /* A start address may have been added to the original file. In this - case it will need an optional header to record it. */ - abfd->flags |= EXEC_P; - } + /* A start address may have been added to the original file. In this + case it will need an optional header to record it. */ + abfd->flags |= EXEC_P; if (abfd->flags & EXEC_P) sofar += bfd_coff_aoutsz (abfd); @@ -3095,18 +3050,19 @@ coff_compute_section_file_positions (abfd) /* Rethread the linked list into sorted order; at the same time, assign target_index values. */ target_index = 1; - abfd->sections = section_list[0]; + abfd->sections = NULL; + abfd->section_last = NULL; for (i = 0; i < count; i++) { current = section_list[i]; - current->next = section_list[i + 1]; + bfd_section_list_append (abfd, current); /* Later, if the section has zero size, we'll be throwing it away, so we don't want to number it now. Note that having a zero size and having real contents are different concepts: .bss has no contents, but (usually) non-zero size. */ - if (current->_raw_size == 0) + if (current->size == 0) { /* Discard. However, it still might have (valid) symbols in it, so arbitrarily set it to section 1 (indexing is @@ -3118,7 +3074,6 @@ coff_compute_section_file_positions (abfd) else current->target_index = target_index++; } - abfd->section_tail = ¤t->next; free (section_list); } @@ -3135,7 +3090,7 @@ coff_compute_section_file_positions (abfd) align_adjust = FALSE; for (current = abfd->sections; - current != (asection *) NULL; + current != NULL; current = current->next) { #ifdef COFF_IMAGE_WITH_PE @@ -3144,20 +3099,21 @@ coff_compute_section_file_positions (abfd) if (coff_section_data (abfd, current) == NULL) { bfd_size_type amt = sizeof (struct coff_section_tdata); - current->used_by_bfd = (PTR) bfd_zalloc (abfd, amt); + + current->used_by_bfd = bfd_zalloc (abfd, amt); if (current->used_by_bfd == NULL) return FALSE; } if (pei_section_data (abfd, current) == NULL) { bfd_size_type amt = sizeof (struct pei_section_tdata); - coff_section_data (abfd, current)->tdata - = (PTR) bfd_zalloc (abfd, amt); + + coff_section_data (abfd, current)->tdata = bfd_zalloc (abfd, amt); if (coff_section_data (abfd, current)->tdata == NULL) return FALSE; } if (pei_section_data (abfd, current)->virt_size == 0) - pei_section_data (abfd, current)->virt_size = current->_raw_size; + pei_section_data (abfd, current)->virt_size = current->size; #endif /* Only deal with sections which have contents. */ @@ -3166,7 +3122,7 @@ coff_compute_section_file_positions (abfd) #ifdef COFF_IMAGE_WITH_PE /* Make sure we skip empty sections in a PE image. */ - if (current->_raw_size == 0) + if (current->size == 0) continue; #endif @@ -3179,8 +3135,8 @@ coff_compute_section_file_positions (abfd) { /* Make sure this section is aligned on the right boundary - by padding the previous section up if necessary. */ - old_sofar = sofar; + #ifdef RS6000COFF_C /* AIX loader checks the text section alignment of (vma - filepos) So even though the filepos may be aligned wrt the o_algntext, for @@ -3213,8 +3169,8 @@ coff_compute_section_file_positions (abfd) sofar = BFD_ALIGN (sofar, 1 << current->alignment_power); } #endif - if (previous != (asection *) NULL) - previous->_raw_size += sofar - old_sofar; + if (previous != NULL) + previous->size += sofar - old_sofar; } #endif @@ -3224,16 +3180,16 @@ coff_compute_section_file_positions (abfd) #ifdef COFF_PAGE_SIZE if ((abfd->flags & D_PAGED) != 0 && (current->flags & SEC_ALLOC) != 0) - sofar += (current->vma - sofar) % page_size; + sofar += (current->vma - (bfd_vma) sofar) % page_size; #endif current->filepos = sofar; #ifdef COFF_IMAGE_WITH_PE /* Set the padded size. */ - current->_raw_size = (current->_raw_size + page_size -1) & -page_size; + current->size = (current->size + page_size -1) & -page_size; #endif - sofar += current->_raw_size; + sofar += current->size; #ifdef ALIGN_SECTIONS_IN_FILE /* Make sure that this section is of the right size too. */ @@ -3241,26 +3197,26 @@ coff_compute_section_file_positions (abfd) { bfd_size_type old_size; - old_size = current->_raw_size; - current->_raw_size = BFD_ALIGN (current->_raw_size, - 1 << current->alignment_power); - align_adjust = current->_raw_size != old_size; - sofar += current->_raw_size - old_size; + old_size = current->size; + current->size = BFD_ALIGN (current->size, + 1 << current->alignment_power); + align_adjust = current->size != old_size; + sofar += current->size - old_size; } else { old_sofar = sofar; sofar = BFD_ALIGN (sofar, 1 << current->alignment_power); align_adjust = sofar != old_sofar; - current->_raw_size += sofar - old_sofar; + current->size += sofar - old_sofar; } #endif #ifdef COFF_IMAGE_WITH_PE /* For PE we need to make sure we pad out to the aligned - _raw_size, in case the caller only writes out data to the - unaligned _raw_size. */ - if (pei_section_data (abfd, current)->virt_size < current->_raw_size) + size, in case the caller only writes out data to the + unaligned size. */ + if (pei_section_data (abfd, current)->virt_size < current->size) align_adjust = TRUE; #endif @@ -3301,95 +3257,13 @@ coff_compute_section_file_positions (abfd) return TRUE; } -#if 0 - -/* This can never work, because it is called too late--after the - section positions have been set. I can't figure out what it is - for, so I am going to disable it--Ian Taylor 20 March 1996. */ - -/* If .file, .text, .data, .bss symbols are missing, add them. */ -/* @@ Should we only be adding missing symbols, or overriding the aux - values for existing section symbols? */ -static bfd_boolean -coff_add_missing_symbols (abfd) - bfd *abfd; -{ - unsigned int nsyms = bfd_get_symcount (abfd); - asymbol **sympp = abfd->outsymbols; - asymbol **sympp2; - unsigned int i; - int need_text = 1, need_data = 1, need_bss = 1, need_file = 1; - bfd_size_type amt; - - for (i = 0; i < nsyms; i++) - { - coff_symbol_type *csym = coff_symbol_from (abfd, sympp[i]); - const char *name; - - if (csym) - { - /* Only do this if there is a coff representation of the input - symbol. */ - if (csym->native && csym->native->u.syment.n_sclass == C_FILE) - { - need_file = 0; - continue; - } - name = csym->symbol.name; - if (!name) - continue; - if (!strcmp (name, _TEXT)) - need_text = 0; -#ifdef APOLLO_M68 - else if (!strcmp (name, ".wtext")) - need_text = 0; -#endif - else if (!strcmp (name, _DATA)) - need_data = 0; - else if (!strcmp (name, _BSS)) - need_bss = 0; - } - } - /* Now i == bfd_get_symcount (abfd). */ - /* @@ For now, don't deal with .file symbol. */ - need_file = 0; - - if (!need_text && !need_data && !need_bss && !need_file) - return TRUE; - nsyms += need_text + need_data + need_bss + need_file; - amt = nsyms; - amt *= sizeof (asymbol *); - sympp2 = (asymbol **) bfd_alloc (abfd, amt); - if (!sympp2) - return FALSE; - memcpy (sympp2, sympp, i * sizeof (asymbol *)); - - if (need_file) - /* @@ Generate fake .file symbol, in sympp2[i], and increment i. */ - abort (); - - if (need_text) - sympp2[i++] = coff_section_symbol (abfd, _TEXT); - if (need_data) - sympp2[i++] = coff_section_symbol (abfd, _DATA); - if (need_bss) - sympp2[i++] = coff_section_symbol (abfd, _BSS); - BFD_ASSERT (i == nsyms); - bfd_set_symtab (abfd, sympp2, nsyms); - return TRUE; -} - -#endif /* 0 */ - #ifdef COFF_IMAGE_WITH_PE static unsigned int pelength; static unsigned int peheader; static bfd_boolean -coff_read_word (abfd, value) - bfd *abfd; - unsigned int *value; +coff_read_word (bfd *abfd, unsigned int *value) { unsigned char b[2]; int status; @@ -3412,8 +3286,7 @@ coff_read_word (abfd, value) } static unsigned int -coff_compute_checksum (abfd) - bfd *abfd; +coff_compute_checksum (bfd *abfd) { bfd_boolean more_data; file_ptr filepos; @@ -3440,8 +3313,7 @@ coff_compute_checksum (abfd) } static bfd_boolean -coff_apply_checksum (abfd) - bfd *abfd; +coff_apply_checksum (bfd *abfd) { unsigned int computed; unsigned int checksum = 0; @@ -3475,11 +3347,8 @@ coff_apply_checksum (abfd) #endif /* COFF_IMAGE_WITH_PE */ -/* SUPPRESS 558 */ -/* SUPPRESS 529 */ static bfd_boolean -coff_write_object_contents (abfd) - bfd * abfd; +coff_write_object_contents (bfd * abfd) { asection *current; bfd_boolean hasrelocs = FALSE; @@ -3505,7 +3374,6 @@ coff_write_object_contents (abfd) /* Make a pass through the symbol table to count line number entries and put them into the correct asections. */ - lnno_size = coff_count_linenumbers (abfd) * bfd_coff_linesz (abfd); if (! abfd->output_has_begun) @@ -3545,9 +3413,8 @@ coff_write_object_contents (abfd) lineno_base += current->lineno_count * bfd_coff_linesz (abfd); } else - { - current->line_filepos = 0; - } + current->line_filepos = 0; + if (current->reloc_count) { current->rel_filepos = reloc_base; @@ -3559,9 +3426,7 @@ coff_write_object_contents (abfd) #endif } else - { - current->rel_filepos = 0; - } + current->rel_filepos = 0; } /* Write section headers to the file. */ @@ -3632,7 +3497,7 @@ coff_write_object_contents (abfd) #endif section.s_vaddr = current->vma; section.s_paddr = current->lma; - section.s_size = current->_raw_size; + section.s_size = current->size; #ifdef coff_get_section_load_page section.s_page = coff_get_section_load_page (current); #endif @@ -3651,8 +3516,8 @@ coff_write_object_contents (abfd) /* If this section has no size or is unloadable then the scnptr will be 0 too. */ - if (current->_raw_size == 0 || - (current->flags & (SEC_LOAD | SEC_HAS_CONTENTS)) == 0) + if (current->size == 0 + || (current->flags & (SEC_LOAD | SEC_HAS_CONTENTS)) == 0) section.s_scnptr = 0; else section.s_scnptr = current->filepos; @@ -3720,7 +3585,7 @@ coff_write_object_contents (abfd) bfd_size_type amt = bfd_coff_scnhsz (abfd); if (coff_swap_scnhdr_out (abfd, §ion, &buff) == 0 - || bfd_bwrite ((PTR) &buff, amt, abfd) != amt) + || bfd_bwrite (& buff, amt, abfd) != amt) return FALSE; } @@ -3844,7 +3709,7 @@ coff_write_object_contents (abfd) scnhdr.s_flags = STYP_OVRFLO; amt = bfd_coff_scnhsz (abfd); if (coff_swap_scnhdr_out (abfd, &scnhdr, &buff) == 0 - || bfd_bwrite ((PTR) &buff, amt, abfd) != amt) + || bfd_bwrite (& buff, amt, abfd) != amt) return FALSE; } } @@ -3886,6 +3751,8 @@ coff_write_object_contents (abfd) #ifdef COFF_IMAGE_WITH_PE if (! hasdebug) internal_f.f_flags |= IMAGE_FILE_DEBUG_STRIPPED; + if (pe_data (abfd)->real_flags & IMAGE_FILE_LARGE_ADDRESS_AWARE) + internal_f.f_flags |= IMAGE_FILE_LARGE_ADDRESS_AWARE; #endif #ifdef COFF_WITH_PE @@ -3928,18 +3795,6 @@ coff_write_object_contents (abfd) internal_f.f_flags |= flags; /* ...and the "opt"hdr... */ -#ifdef A29K -#ifdef ULTRA3 /* NYU's machine */ - /* FIXME: This is a bogus check. I really want to see if there - is a .shbss or a .shdata section, if so then set the magic - number to indicate a shared data executable. */ - if (internal_f.f_nscns >= 7) - internal_a.magic = SHMAGIC; /* Shared magic. */ - else -#endif /* ULTRA3 */ - internal_a.magic = NMAGIC; /* Assume separate i/d. */ -#define __A_MAGIC_SET__ -#endif /* A29K */ #ifdef TICOFF_AOUT_MAGIC internal_a.magic = TICOFF_AOUT_MAGIC; #define __A_MAGIC_SET__ @@ -4042,6 +3897,11 @@ coff_write_object_contents (abfd) internal_a.magic = NMAGIC; /* Assume separate i/d. */ #endif +#ifdef MAXQ20MAGIC +#define __A_MAGIC_SET__ + internal_a.magic = MAXQ20MAGIC; +#endif + #ifndef __A_MAGIC_SET__ #include "Your aouthdr magic number is not being set!" #else @@ -4058,10 +3918,7 @@ coff_write_object_contents (abfd) if (bfd_get_symcount (abfd) != 0) { int firstundef; -#if 0 - if (!coff_add_missing_symbols (abfd)) - return FALSE; -#endif + if (!coff_renumber_symbols (abfd, &firstundef)) return FALSE; coff_mangle_symbols (abfd); @@ -4122,17 +3979,17 @@ coff_write_object_contents (abfd) if (text_sec) { - internal_a.tsize = bfd_get_section_size_before_reloc (text_sec); + internal_a.tsize = text_sec->size; internal_a.text_start = internal_a.tsize ? text_sec->vma : 0; } if (data_sec) { - internal_a.dsize = bfd_get_section_size_before_reloc (data_sec); + internal_a.dsize = data_sec->size; internal_a.data_start = internal_a.dsize ? data_sec->vma : 0; } if (bss_sec) { - internal_a.bsize = bfd_get_section_size_before_reloc (bss_sec); + internal_a.bsize = bss_sec->size; if (internal_a.bsize && bss_sec->vma < internal_a.data_start) internal_a.data_start = bss_sec->vma; } @@ -4211,7 +4068,7 @@ coff_write_object_contents (abfd) } #endif - /* now write them */ + /* Now write them. */ if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) return FALSE; @@ -4223,8 +4080,8 @@ coff_write_object_contents (abfd) if (buff == NULL) return FALSE; - bfd_coff_swap_filehdr_out (abfd, (PTR) &internal_f, (PTR) buff); - amount = bfd_bwrite ((PTR) buff, amount, abfd); + bfd_coff_swap_filehdr_out (abfd, & internal_f, buff); + amount = bfd_bwrite (buff, amount, abfd); free (buff); @@ -4243,8 +4100,8 @@ coff_write_object_contents (abfd) if (buff == NULL) return FALSE; - coff_swap_aouthdr_out (abfd, (PTR) &internal_a, (PTR) buff); - amount = bfd_bwrite ((PTR) buff, amount, abfd); + coff_swap_aouthdr_out (abfd, & internal_a, buff); + amount = bfd_bwrite (buff, amount, abfd); free (buff); @@ -4263,12 +4120,12 @@ coff_write_object_contents (abfd) size_t size; /* XCOFF seems to always write at least a small a.out header. */ - coff_swap_aouthdr_out (abfd, (PTR) &internal_a, (PTR) &buff); + coff_swap_aouthdr_out (abfd, & internal_a, & buff); if (xcoff_data (abfd)->full_aouthdr) size = bfd_coff_aoutsz (abfd); else size = SMALL_AOUTSZ; - if (bfd_bwrite ((PTR) &buff, (bfd_size_type) size, abfd) != size) + if (bfd_bwrite (& buff, (bfd_size_type) size, abfd) != size) return FALSE; } #endif @@ -4277,12 +4134,11 @@ coff_write_object_contents (abfd) } static bfd_boolean -coff_set_section_contents (abfd, section, location, offset, count) - bfd * abfd; - sec_ptr section; - const PTR location; - file_ptr offset; - bfd_size_type count; +coff_set_section_contents (bfd * abfd, + sec_ptr section, + const void * location, + file_ptr offset, + bfd_size_type count) { if (! abfd->output_has_begun) /* Set by bfd.c handler. */ { @@ -4291,7 +4147,6 @@ coff_set_section_contents (abfd, section, location, offset, count) } #if defined(_LIB) && !defined(TARG_AUX) - /* The physical address field of a .lib section is used to hold the number of shared libraries in the section. This code counts the number of sections being written, and increments the lma field @@ -4312,7 +4167,6 @@ coff_set_section_contents (abfd, section, location, offset, count) (Thanks!). Gvran Uddeborg . */ - if (strcmp (section->name, _LIB) == 0) { bfd_byte *rec, *recend; @@ -4327,7 +4181,6 @@ coff_set_section_contents (abfd, section, location, offset, count) BFD_ASSERT (rec == recend); } - #endif /* Don't write out bss sections - one way to do this is to @@ -4343,47 +4196,19 @@ coff_set_section_contents (abfd, section, location, offset, count) return bfd_bwrite (location, count, abfd) == count; } -#if 0 -static bfd_boolean -coff_close_and_cleanup (abfd) - bfd *abfd; + +static void * +buy_and_read (bfd *abfd, file_ptr where, bfd_size_type size) { - if (!bfd_read_p (abfd)) - switch (abfd->format) - { - case bfd_archive: - if (!_bfd_write_archive_contents (abfd)) - return FALSE; - break; - case bfd_object: - if (!coff_write_object_contents (abfd)) - return FALSE; - break; - default: - bfd_set_error (bfd_error_invalid_operation); - return FALSE; - } + void * area = bfd_alloc (abfd, size); - /* We depend on bfd_close to free all the memory on the objalloc. */ - return TRUE; -} - -#endif - -static PTR -buy_and_read (abfd, where, size) - bfd *abfd; - file_ptr where; - bfd_size_type size; -{ - PTR area = (PTR) bfd_alloc (abfd, size); if (!area) return (NULL); if (bfd_seek (abfd, where, SEEK_SET) != 0 || bfd_bread (area, size, abfd) != size) return (NULL); return (area); -} /* buy_and_read() */ +} /* SUBSUBSECTION @@ -4406,31 +4231,27 @@ SUBSUBSECTION pointing its... How does this work ? - */ static bfd_boolean -coff_slurp_line_table (abfd, asect) - bfd *abfd; - asection *asect; +coff_slurp_line_table (bfd *abfd, asection *asect) { LINENO *native_lineno; alent *lineno_cache; bfd_size_type amt; - BFD_ASSERT (asect->lineno == (alent *) NULL); + BFD_ASSERT (asect->lineno == NULL); amt = (bfd_size_type) bfd_coff_linesz (abfd) * asect->lineno_count; native_lineno = (LINENO *) buy_and_read (abfd, asect->line_filepos, amt); if (native_lineno == NULL) { (*_bfd_error_handler) - (_("%s: warning: line number table read failed"), - bfd_archive_filename (abfd)); + (_("%B: warning: line number table read failed"), abfd); return FALSE; } amt = ((bfd_size_type) asect->lineno_count + 1) * sizeof (alent); - lineno_cache = (alent *) bfd_alloc (abfd, amt); + lineno_cache = bfd_alloc (abfd, amt); if (lineno_cache == NULL) return FALSE; else @@ -4458,8 +4279,8 @@ coff_slurp_line_table (abfd, asect) || (bfd_vma) symndx >= obj_raw_syment_count (abfd)) { (*_bfd_error_handler) - (_("%s: warning: illegal symbol index %ld in line numbers"), - bfd_archive_filename (abfd), dst.l_addr.l_symndx); + (_("%B: warning: illegal symbol index %ld in line numbers"), + abfd, dst.l_addr.l_symndx); symndx = 0; warned = TRUE; } @@ -4472,17 +4293,14 @@ coff_slurp_line_table (abfd, asect) if (sym->lineno != NULL && ! warned) { (*_bfd_error_handler) - (_("%s: warning: duplicate line number information for `%s'"), - bfd_archive_filename (abfd), - bfd_asymbol_name (&sym->symbol)); + (_("%B: warning: duplicate line number information for `%s'"), + abfd, bfd_asymbol_name (&sym->symbol)); } sym->lineno = cache_ptr; } else - { - cache_ptr->u.offset = dst.l_addr.l_paddr - - bfd_section_vma (abfd, asect); - } /* If no linenumber expect a symbol index */ + cache_ptr->u.offset = dst.l_addr.l_paddr + - bfd_section_vma (abfd, asect); cache_ptr++; src++; @@ -4501,8 +4319,7 @@ coff_slurp_line_table (abfd, asect) symbols via coff_link_add_symbols, rather than via this routine. */ static bfd_boolean -coff_slurp_symbol_table (abfd) - bfd * abfd; +coff_slurp_symbol_table (bfd * abfd) { combined_entry_type *native_symbols; coff_symbol_type *cached_area; @@ -4520,13 +4337,13 @@ coff_slurp_symbol_table (abfd) /* Allocate enough room for all the symbols in cached form. */ amt = obj_raw_syment_count (abfd); amt *= sizeof (coff_symbol_type); - cached_area = (coff_symbol_type *) bfd_alloc (abfd, amt); + cached_area = bfd_alloc (abfd, amt); if (cached_area == NULL) return FALSE; amt = obj_raw_syment_count (abfd); amt *= sizeof (unsigned int); - table_ptr = (unsigned int *) bfd_alloc (abfd, amt); + table_ptr = bfd_alloc (abfd, amt); if (table_ptr == NULL) return FALSE; @@ -4554,11 +4371,6 @@ coff_slurp_symbol_table (abfd) { #ifdef I960 case C_LEAFEXT: -#if 0 - dst->symbol.value = src->u.syment.n_value - dst->symbol.section->vma; - dst->symbol.flags = BSF_EXPORT | BSF_GLOBAL; - dst->symbol.flags |= BSF_NOT_AT_END | BSF_FUNCTION; -#endif /* Fall through to next case. */ #endif @@ -4593,11 +4405,9 @@ coff_slurp_symbol_table (abfd) - dst->symbol.section->vma); #endif if (ISFCN ((src->u.syment.n_type))) - { - /* A function ext does not go at the end of a - file. */ - dst->symbol.flags |= BSF_NOT_AT_END | BSF_FUNCTION; - } + /* A function ext does not go at the end of a + file. */ + dst->symbol.flags |= BSF_NOT_AT_END | BSF_FUNCTION; break; case COFF_SYMBOL_COMMON: @@ -4683,11 +4493,6 @@ coff_slurp_symbol_table (abfd) case C_MOS: /* Member of structure. */ case C_EOS: /* End of structure. */ -#ifdef NOTDEF /* C_AUTOARG has the same value. */ -#ifdef C_GLBLREG - case C_GLBLREG: /* A29k-specific storage class. */ -#endif -#endif case C_REGPARM: /* Register parameter. */ case C_REG: /* register variable. */ /* C_AUTOARG conflicts with TI COFF C_UEXT. */ @@ -4828,20 +4633,18 @@ coff_slurp_symbol_table (abfd) case C_HIDDEN: /* Ext symbol in dmert public lib. */ default: (*_bfd_error_handler) - (_("%s: Unrecognized storage class %d for %s symbol `%s'"), - bfd_archive_filename (abfd), src->u.syment.n_sclass, + (_("%B: Unrecognized storage class %d for %s symbol `%s'"), + abfd, src->u.syment.n_sclass, dst->symbol.section->name, dst->symbol.name); dst->symbol.flags = BSF_DEBUGGING; dst->symbol.value = (src->u.syment.n_value); break; } -/* BFD_ASSERT(dst->symbol.flags != 0);*/ - dst->native = src; dst->symbol.udata.i = 0; - dst->lineno = (alent *) NULL; + dst->lineno = NULL; this_index += (src->u.syment.n_numaux) + 1; dst++; number_of_symbols++; @@ -4866,16 +4669,15 @@ coff_slurp_symbol_table (abfd) } return TRUE; -} /* coff_slurp_symbol_table() */ +} /* Classify a COFF symbol. A couple of targets have globally visible symbols which are not class C_EXT, and this handles those. It also recognizes some special PE cases. */ static enum coff_symbol_classification -coff_classify_symbol (abfd, syment) - bfd *abfd; - struct internal_syment *syment; +coff_classify_symbol (bfd *abfd, + struct internal_syment *syment) { /* FIXME: This partially duplicates the switch in coff_slurp_symbol_table. */ @@ -4913,18 +4715,15 @@ coff_classify_symbol (abfd, syment) if (syment->n_sclass == C_STAT) { if (syment->n_scnum == 0) - { - /* The Microsoft compiler sometimes generates these if a - small static function is inlined every time it is used. - The function is discarded, but the symbol table entry - remains. */ - return COFF_SYMBOL_LOCAL; - } + /* The Microsoft compiler sometimes generates these if a + small static function is inlined every time it is used. + The function is discarded, but the symbol table entry + remains. */ + return COFF_SYMBOL_LOCAL; #ifdef STRICT_PE_FORMAT /* This is correct for Microsoft generated objects, but it breaks gas generated objects. */ - if (syment->n_value == 0) { asection *sec; @@ -4955,15 +4754,13 @@ coff_classify_symbol (abfd, syment) #endif /* COFF_WITH_PE */ /* If it is not a global symbol, we presume it is a local symbol. */ - if (syment->n_scnum == 0) { char buf[SYMNMLEN + 1]; (*_bfd_error_handler) - (_("warning: %s: local symbol `%s' has no section"), - bfd_archive_filename (abfd), - _bfd_coff_internal_syment_name (abfd, syment, buf)); + (_("warning: %B: local symbol `%s' has no section"), + abfd, _bfd_coff_internal_syment_name (abfd, syment, buf)); } return COFF_SYMBOL_LOCAL; @@ -4994,23 +4791,23 @@ SUBSUBSECTION and 960 use the @code{r_type} to directly produce an index into a howto table vector; the 88k subtracts a number from the @code{r_type} field and creates an addend field. - */ #ifndef CALC_ADDEND #define CALC_ADDEND(abfd, ptr, reloc, cache_ptr) \ { \ - coff_symbol_type *coffsym = (coff_symbol_type *) NULL; \ + coff_symbol_type *coffsym = 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 \ + if (coffsym != NULL \ && coffsym->native->u.syment.n_scnum == 0) \ cache_ptr->addend = 0; \ else if (ptr && bfd_asymbol_bfd (ptr) == abfd \ - && ptr->section != (asection *) NULL) \ + && ptr->section != NULL) \ cache_ptr->addend = - (ptr->section->vma + ptr->value); \ else \ cache_ptr->addend = 0; \ @@ -5018,10 +4815,7 @@ SUBSUBSECTION #endif static bfd_boolean -coff_slurp_reloc_table (abfd, asect, symbols) - bfd * abfd; - sec_ptr asect; - asymbol ** symbols; +coff_slurp_reloc_table (bfd * abfd, sec_ptr asect, asymbol ** symbols) { RELOC *native_relocs; arelent *reloc_cache; @@ -5037,12 +4831,13 @@ coff_slurp_reloc_table (abfd, asect, symbols) return TRUE; if (!coff_slurp_symbol_table (abfd)) return FALSE; + amt = (bfd_size_type) bfd_coff_relsz (abfd) * asect->reloc_count; native_relocs = (RELOC *) buy_and_read (abfd, asect->rel_filepos, amt); amt = (bfd_size_type) asect->reloc_count * sizeof (arelent); - reloc_cache = (arelent *) bfd_alloc (abfd, amt); + reloc_cache = bfd_alloc (abfd, amt); - if (reloc_cache == NULL) + if (reloc_cache == NULL || native_relocs == NULL) return FALSE; for (idx = 0; idx < asect->reloc_count; idx++) @@ -5068,8 +4863,8 @@ coff_slurp_reloc_table (abfd, asect, symbols) if (dst.r_symndx < 0 || dst.r_symndx >= obj_conv_table_size (abfd)) { (*_bfd_error_handler) - (_("%s: warning: illegal symbol index %ld in relocs"), - bfd_archive_filename (abfd), dst.r_symndx); + (_("%B: warning: illegal symbol index %ld in relocs"), + abfd, dst.r_symndx); cache_ptr->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; ptr = NULL; } @@ -5097,7 +4892,7 @@ coff_slurp_reloc_table (abfd, asect, symbols) CALC_ADDEND (abfd, ptr, dst, cache_ptr); cache_ptr->address -= asect->vma; -/* !! cache_ptr->section = (asection *) NULL;*/ + /* !! cache_ptr->section = NULL;*/ /* Fill in the cache_ptr->howto field from dst.r_type. */ RTYPE2HOWTO (cache_ptr, &dst); @@ -5106,8 +4901,8 @@ coff_slurp_reloc_table (abfd, asect, symbols) if (cache_ptr->howto == NULL) { (*_bfd_error_handler) - (_("%s: illegal relocation type %d at address 0x%lx"), - bfd_archive_filename (abfd), dst.r_type, (long) dst.r_vaddr); + (_("%B: illegal relocation type %d at address 0x%lx"), + abfd, dst.r_type, (long) dst.r_vaddr); bfd_set_error (bfd_error_bad_value); return FALSE; } @@ -5126,19 +4921,13 @@ coff_slurp_reloc_table (abfd, asect, symbols) always work. It is the responsibility of the including file to make sure it is reasonable if it is needed. */ -static reloc_howto_type *coff_rtype_to_howto - PARAMS ((bfd *, asection *, struct internal_reloc *, - struct coff_link_hash_entry *, struct internal_syment *, - bfd_vma *)); - static reloc_howto_type * -coff_rtype_to_howto (abfd, sec, rel, h, sym, addendp) - bfd *abfd ATTRIBUTE_UNUSED; - asection *sec ATTRIBUTE_UNUSED; - struct internal_reloc *rel; - struct coff_link_hash_entry *h ATTRIBUTE_UNUSED; - struct internal_syment *sym ATTRIBUTE_UNUSED; - bfd_vma *addendp ATTRIBUTE_UNUSED; +coff_rtype_to_howto (bfd *abfd ATTRIBUTE_UNUSED, + asection *sec ATTRIBUTE_UNUSED, + struct internal_reloc *rel, + struct coff_link_hash_entry *h ATTRIBUTE_UNUSED, + struct internal_syment *sym ATTRIBUTE_UNUSED, + bfd_vma *addendp ATTRIBUTE_UNUSED) { arelent genrel; @@ -5154,12 +4943,12 @@ coff_rtype_to_howto (abfd, sec, rel, h, sym, addendp) #endif /* ! defined (coff_rtype_to_howto) */ /* This is stupid. This function should be a boolean predicate. */ + static long -coff_canonicalize_reloc (abfd, section, relptr, symbols) - bfd * abfd; - sec_ptr section; - arelent ** relptr; - asymbol ** symbols; +coff_canonicalize_reloc (bfd * abfd, + sec_ptr section, + arelent ** relptr, + asymbol ** symbols) { arelent *tblptr = section->relocation; unsigned int count = 0; @@ -5191,29 +4980,15 @@ coff_canonicalize_reloc (abfd, section, relptr, symbols) return section->reloc_count; } -#ifdef GNU960 -file_ptr -coff_sym_filepos (abfd) - bfd *abfd; -{ - return obj_sym_filepos (abfd); -} -#endif - #ifndef coff_reloc16_estimate #define coff_reloc16_estimate dummy_reloc16_estimate -static int dummy_reloc16_estimate - PARAMS ((bfd *, asection *, arelent *, unsigned int, - struct bfd_link_info *)); - static int -dummy_reloc16_estimate (abfd, input_section, reloc, shrink, link_info) - bfd *abfd ATTRIBUTE_UNUSED; - asection *input_section ATTRIBUTE_UNUSED; - arelent *reloc ATTRIBUTE_UNUSED; - unsigned int shrink ATTRIBUTE_UNUSED; - struct bfd_link_info *link_info ATTRIBUTE_UNUSED; +dummy_reloc16_estimate (bfd *abfd ATTRIBUTE_UNUSED, + asection *input_section ATTRIBUTE_UNUSED, + arelent *reloc ATTRIBUTE_UNUSED, + unsigned int shrink ATTRIBUTE_UNUSED, + struct bfd_link_info *link_info ATTRIBUTE_UNUSED) { abort (); return 0; @@ -5227,20 +5002,14 @@ dummy_reloc16_estimate (abfd, input_section, reloc, shrink, link_info) /* This works even if abort is not declared in any header file. */ -static void dummy_reloc16_extra_cases - PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *, - bfd_byte *, unsigned int *, unsigned int *)); - static void -dummy_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr, - dst_ptr) - bfd *abfd ATTRIBUTE_UNUSED; - struct bfd_link_info *link_info ATTRIBUTE_UNUSED; - struct bfd_link_order *link_order ATTRIBUTE_UNUSED; - arelent *reloc ATTRIBUTE_UNUSED; - bfd_byte *data ATTRIBUTE_UNUSED; - unsigned int *src_ptr ATTRIBUTE_UNUSED; - unsigned int *dst_ptr ATTRIBUTE_UNUSED; +dummy_reloc16_extra_cases (bfd *abfd ATTRIBUTE_UNUSED, + struct bfd_link_info *link_info ATTRIBUTE_UNUSED, + struct bfd_link_order *link_order ATTRIBUTE_UNUSED, + arelent *reloc ATTRIBUTE_UNUSED, + bfd_byte *data ATTRIBUTE_UNUSED, + unsigned int *src_ptr ATTRIBUTE_UNUSED, + unsigned int *dst_ptr ATTRIBUTE_UNUSED) { abort (); } @@ -5252,7 +5021,9 @@ dummy_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr, /* If coff_relocate_section is defined, we can use the optimized COFF backend linker. Otherwise we must continue to use the old linker. */ + #ifdef coff_relocate_section + #ifndef coff_bfd_link_hash_table_create #define coff_bfd_link_hash_table_create _bfd_coff_link_hash_table_create #endif @@ -5262,7 +5033,9 @@ dummy_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr, #ifndef coff_bfd_final_link #define coff_bfd_final_link _bfd_coff_final_link #endif + #else /* ! defined (coff_relocate_section) */ + #define coff_relocate_section NULL #ifndef coff_bfd_link_hash_table_create #define coff_bfd_link_hash_table_create _bfd_generic_link_hash_table_create @@ -5271,9 +5044,10 @@ dummy_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr, #define coff_bfd_link_add_symbols _bfd_generic_link_add_symbols #endif #define coff_bfd_final_link _bfd_generic_final_link + #endif /* ! defined (coff_relocate_section) */ -#define coff_bfd_link_just_syms _bfd_generic_link_just_syms +#define coff_bfd_link_just_syms _bfd_generic_link_just_syms #define coff_bfd_link_split_section _bfd_generic_link_split_section #ifndef coff_start_final_link @@ -5290,13 +5064,9 @@ dummy_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr, #ifndef coff_link_output_has_begun -static bfd_boolean coff_link_output_has_begun - PARAMS ((bfd *, struct coff_final_link_info *)); - static bfd_boolean -coff_link_output_has_begun (abfd, info) - bfd * abfd; - struct coff_final_link_info * info ATTRIBUTE_UNUSED; +coff_link_output_has_begun (bfd * abfd, + struct coff_final_link_info * info ATTRIBUTE_UNUSED) { return abfd->output_has_begun; } @@ -5304,13 +5074,9 @@ coff_link_output_has_begun (abfd, info) #ifndef coff_final_link_postscript -static bfd_boolean coff_final_link_postscript - PARAMS ((bfd *, struct coff_final_link_info *)); - static bfd_boolean -coff_final_link_postscript (abfd, pfinfo) - bfd * abfd ATTRIBUTE_UNUSED; - struct coff_final_link_info * pfinfo ATTRIBUTE_UNUSED; +coff_final_link_postscript (bfd * abfd ATTRIBUTE_UNUSED, + struct coff_final_link_info * pfinfo ATTRIBUTE_UNUSED) { return TRUE; } @@ -5359,7 +5125,7 @@ coff_final_link_postscript (abfd, pfinfo) #define coff_SWAP_scnhdr_in coff_swap_scnhdr_in #endif -static const bfd_coff_backend_data bfd_coff_std_swap_table = +static const bfd_coff_backend_data bfd_coff_std_swap_table ATTRIBUTE_UNUSED = { coff_SWAP_aux_in, coff_SWAP_sym_in, coff_SWAP_lineno_in, coff_SWAP_aux_out, coff_SWAP_sym_out, @@ -5401,6 +5167,7 @@ static const bfd_coff_backend_data bfd_coff_std_swap_table = #ifdef TICOFF /* COFF0 differs in file/section header size and relocation entry size. */ + static const bfd_coff_backend_data ticoff0_swap_table = { coff_SWAP_aux_in, coff_SWAP_sym_in, coff_SWAP_lineno_in, @@ -5444,6 +5211,7 @@ static const bfd_coff_backend_data ticoff0_swap_table = #ifdef TICOFF /* COFF1 differs in section header size. */ + static const bfd_coff_backend_data ticoff1_swap_table = { coff_SWAP_aux_in, coff_SWAP_sym_in, coff_SWAP_lineno_in, @@ -5501,6 +5269,10 @@ static const bfd_coff_backend_data ticoff1_swap_table = #define coff_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data #endif +#ifndef coff_bfd_copy_private_header_data +#define coff_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data +#endif + #ifndef coff_bfd_copy_private_section_data #define coff_bfd_copy_private_section_data _bfd_generic_bfd_copy_private_section_data #endif @@ -5525,6 +5297,10 @@ static const bfd_coff_backend_data ticoff1_swap_table = #define coff_bfd_is_local_label_name _bfd_coff_is_local_label_name #endif +#ifndef coff_bfd_is_target_special_symbol +#define coff_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) +#endif + #ifndef coff_read_minisymbols #define coff_read_minisymbols _bfd_generic_read_minisymbols #endif @@ -5556,25 +5332,34 @@ static const bfd_coff_backend_data ticoff1_swap_table = #define coff_bfd_merge_sections bfd_generic_merge_sections #endif +#ifndef coff_bfd_is_group_section +#define coff_bfd_is_group_section bfd_generic_is_group_section +#endif + #ifndef coff_bfd_discard_group #define coff_bfd_discard_group bfd_generic_discard_group #endif +#ifndef coff_section_already_linked +#define coff_section_already_linked \ + _bfd_generic_section_already_linked +#endif + #define CREATE_BIG_COFF_TARGET_VEC(VAR, NAME, EXTRA_O_FLAGS, EXTRA_S_FLAGS, UNDER, ALTERNATIVE, SWAP_TABLE) \ const bfd_target VAR = \ { \ NAME , \ bfd_target_coff_flavour, \ - BFD_ENDIAN_BIG, /* data byte order is big */ \ - BFD_ENDIAN_BIG, /* header byte order is big */ \ + BFD_ENDIAN_BIG, /* Data byte order is big. */ \ + BFD_ENDIAN_BIG, /* Header byte order is big. */ \ /* object flags */ \ (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | \ HAS_SYMS | HAS_LOCALS | WP_TEXT | EXTRA_O_FLAGS), \ /* section flags */ \ (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | EXTRA_S_FLAGS),\ - UNDER, /* leading symbol underscore */ \ - '/', /* ar_pad_char */ \ - 15, /* ar_max_namelen */ \ + UNDER, /* Leading symbol underscore. */ \ + '/', /* AR_pad_char. */ \ + 15, /* AR_max_namelen. */ \ \ /* Data conversion functions. */ \ bfd_getb64, bfd_getb_signed_64, bfd_putb64, \ @@ -5586,12 +5371,12 @@ const bfd_target VAR = \ bfd_getb32, bfd_getb_signed_32, bfd_putb32, \ bfd_getb16, bfd_getb_signed_16, bfd_putb16, \ \ - /* bfd_check_format */ \ + /* bfd_check_format. */ \ { _bfd_dummy_target, coff_object_p, bfd_generic_archive_p, \ _bfd_dummy_target }, \ - /* bfd_set_format */ \ + /* bfd_set_format. */ \ { bfd_false, coff_mkobject, _bfd_generic_mkarchive, bfd_false }, \ - /* bfd_write_contents */ \ + /* bfd_write_contents. */ \ { bfd_false, coff_write_object_contents, _bfd_write_archive_contents, \ bfd_false }, \ \ @@ -5615,16 +5400,16 @@ const bfd_target VAR = \ { \ NAME , \ bfd_target_coff_flavour, \ - BFD_ENDIAN_LITTLE, /* data byte order is little */ \ - BFD_ENDIAN_BIG, /* header byte order is big */ \ + BFD_ENDIAN_LITTLE, /* Data byte order is little. */ \ + BFD_ENDIAN_BIG, /* Header byte order is big. */ \ /* object flags */ \ (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | \ HAS_SYMS | HAS_LOCALS | WP_TEXT | EXTRA_O_FLAGS), \ /* section flags */ \ (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | EXTRA_S_FLAGS),\ - UNDER, /* leading symbol underscore */ \ - '/', /* ar_pad_char */ \ - 15, /* ar_max_namelen */ \ + UNDER, /* Leading symbol underscore. */ \ + '/', /* AR_pad_char. */ \ + 15, /* AR_max_namelen. */ \ \ /* Data conversion functions. */ \ bfd_getb64, bfd_getb_signed_64, bfd_putb64, \ @@ -5636,12 +5421,12 @@ const bfd_target VAR = \ bfd_getb32, bfd_getb_signed_32, bfd_putb32, \ bfd_getb16, bfd_getb_signed_16, bfd_putb16, \ \ - /* bfd_check_format */ \ + /* bfd_check_format. */ \ { _bfd_dummy_target, coff_object_p, bfd_generic_archive_p, \ _bfd_dummy_target }, \ - /* bfd_set_format */ \ + /* bfd_set_format. */ \ { bfd_false, coff_mkobject, _bfd_generic_mkarchive, bfd_false }, \ - /* bfd_write_contents */ \ + /* bfd_write_contents. */ \ { bfd_false, coff_write_object_contents, _bfd_write_archive_contents, \ bfd_false }, \ \ @@ -5665,16 +5450,16 @@ const bfd_target VAR = \ { \ NAME , \ bfd_target_coff_flavour, \ - BFD_ENDIAN_LITTLE, /* data byte order is little */ \ - BFD_ENDIAN_LITTLE, /* header byte order is little */ \ + BFD_ENDIAN_LITTLE, /* Data byte order is little. */ \ + BFD_ENDIAN_LITTLE, /* Header byte order is little. */ \ /* object flags */ \ (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | \ HAS_SYMS | HAS_LOCALS | WP_TEXT | EXTRA_O_FLAGS), \ /* section flags */ \ (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | EXTRA_S_FLAGS),\ - UNDER, /* leading symbol underscore */ \ - '/', /* ar_pad_char */ \ - 15, /* ar_max_namelen */ \ + UNDER, /* Leading symbol underscore. */ \ + '/', /* AR_pad_char. */ \ + 15, /* AR_max_namelen. */ \ \ /* Data conversion functions. */ \ bfd_getl64, bfd_getl_signed_64, bfd_putl64, \ @@ -5684,12 +5469,12 @@ const bfd_target VAR = \ bfd_getl64, bfd_getl_signed_64, bfd_putl64, \ bfd_getl32, bfd_getl_signed_32, bfd_putl32, \ bfd_getl16, bfd_getl_signed_16, bfd_putl16, \ - /* bfd_check_format */ \ + /* bfd_check_format. */ \ { _bfd_dummy_target, coff_object_p, bfd_generic_archive_p, \ _bfd_dummy_target }, \ - /* bfd_set_format */ \ + /* bfd_set_format. */ \ { bfd_false, coff_mkobject, _bfd_generic_mkarchive, bfd_false }, \ - /* bfd_write_contents */ \ + /* bfd_write_contents. */ \ { bfd_false, coff_write_object_contents, _bfd_write_archive_contents, \ bfd_false }, \ \ diff --git a/contrib/binutils/bfd/coffgen.c b/contrib/binutils/bfd/coffgen.c index a712b4b36e3..c541e6a590e 100644 --- a/contrib/binutils/bfd/coffgen.c +++ b/contrib/binutils/bfd/coffgen.c @@ -1,24 +1,24 @@ /* Support for the generic parts of COFF, for BFD. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003 + 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. Written by Cygnus Support. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* Most of this hacked by Steve Chamberlain, sac@cygnus.com. Split out of coffcode.h by Ian Taylor, ian@cygnus.com. */ @@ -43,42 +43,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "coff/internal.h" #include "libcoff.h" -static void coff_fix_symbol_name - PARAMS ((bfd *, asymbol *, combined_entry_type *, bfd_size_type *, - asection **, bfd_size_type *)); -static bfd_boolean coff_write_symbol - PARAMS ((bfd *, asymbol *, combined_entry_type *, bfd_vma *, - bfd_size_type *, asection **, bfd_size_type *)); -static bfd_boolean coff_write_alien_symbol - PARAMS ((bfd *, asymbol *, bfd_vma *, bfd_size_type *, - asection **, bfd_size_type *)); -static bfd_boolean coff_write_native_symbol - PARAMS ((bfd *, coff_symbol_type *, bfd_vma *, bfd_size_type *, - asection **, bfd_size_type *)); -static void coff_pointerize_aux - PARAMS ((bfd *, combined_entry_type *, combined_entry_type *, - unsigned int, combined_entry_type *)); -static bfd_boolean make_a_section_from_file - PARAMS ((bfd *, struct internal_scnhdr *, unsigned int)); -static const bfd_target *coff_real_object_p - PARAMS ((bfd *, unsigned, struct internal_filehdr *, - struct internal_aouthdr *)); -static void fixup_symbol_value - PARAMS ((bfd *, coff_symbol_type *, struct internal_syment *)); -static char *build_debug_section - PARAMS ((bfd *)); -static char *copy_name - PARAMS ((bfd *, char *, size_t)); - -#define STRING_SIZE_SIZE (4) - /* Take a section header read from a coff file (in HOST byte order), and make a BFD "section" out of it. This is used by ECOFF. */ + static bfd_boolean -make_a_section_from_file (abfd, hdr, target_index) - bfd *abfd; - struct internal_scnhdr *hdr; - unsigned int target_index; +make_a_section_from_file (bfd *abfd, + struct internal_scnhdr *hdr, + unsigned int target_index) { asection *return_section; char *name; @@ -131,7 +102,7 @@ make_a_section_from_file (abfd, hdr, target_index) return_section->vma = hdr->s_vaddr; return_section->lma = hdr->s_paddr; - return_section->_raw_size = hdr->s_size; + return_section->size = hdr->s_size; return_section->filepos = hdr->s_scnptr; return_section->rel_filepos = hdr->s_relptr; return_section->reloc_count = hdr->s_nreloc; @@ -142,7 +113,7 @@ make_a_section_from_file (abfd, hdr, target_index) return_section->lineno_count = hdr->s_nlnno; return_section->userdata = NULL; - return_section->next = (asection *) NULL; + return_section->next = NULL; return_section->target_index = target_index; if (! bfd_coff_styp_to_sec_flags_hook (abfd, hdr, name, return_section, @@ -158,7 +129,7 @@ make_a_section_from_file (abfd, hdr, target_index) if (hdr->s_nreloc != 0) return_section->flags |= SEC_RELOC; - /* FIXME: should this check 'hdr->s_size > 0' */ + /* FIXME: should this check 'hdr->s_size > 0'. */ if (hdr->s_scnptr != 0) return_section->flags |= SEC_HAS_CONTENTS; @@ -169,17 +140,16 @@ make_a_section_from_file (abfd, hdr, target_index) ECOFF as well. */ static const bfd_target * -coff_real_object_p (abfd, nscns, internal_f, internal_a) - bfd *abfd; - unsigned nscns; - struct internal_filehdr *internal_f; - struct internal_aouthdr *internal_a; +coff_real_object_p (bfd *abfd, + unsigned nscns, + struct internal_filehdr *internal_f, + struct internal_aouthdr *internal_a) { flagword oflags = abfd->flags; bfd_vma ostart = bfd_get_start_address (abfd); - PTR tdata; - PTR tdata_save; - bfd_size_type readsize; /* length of file_info */ + void * tdata; + void * tdata_save; + bfd_size_type readsize; /* Length of file_info. */ unsigned int scnhsz; char *external_sections; @@ -208,22 +178,22 @@ coff_real_object_p (abfd, nscns, internal_f, internal_a) /* Set up the tdata area. ECOFF uses its own routine, and overrides abfd->flags. */ tdata_save = abfd->tdata.any; - tdata = bfd_coff_mkobject_hook (abfd, (PTR) internal_f, (PTR) internal_a); + tdata = bfd_coff_mkobject_hook (abfd, (void *) internal_f, (void *) internal_a); if (tdata == NULL) goto fail2; scnhsz = bfd_coff_scnhsz (abfd); readsize = (bfd_size_type) nscns * scnhsz; - external_sections = (char *) bfd_alloc (abfd, readsize); + external_sections = bfd_alloc (abfd, readsize); if (!external_sections) goto fail; - if (bfd_bread ((PTR) external_sections, readsize, abfd) != readsize) + if (bfd_bread ((void *) external_sections, readsize, abfd) != readsize) goto fail; /* Set the arch/mach *before* swapping in sections; section header swapping may depend on arch/mach info. */ - if (! bfd_coff_set_arch_mach_hook (abfd, (PTR) internal_f)) + if (! bfd_coff_set_arch_mach_hook (abfd, (void *) internal_f)) goto fail; /* Now copy data as required; construct all asections etc. */ @@ -234,8 +204,8 @@ coff_real_object_p (abfd, nscns, internal_f, internal_a) { struct internal_scnhdr tmp; bfd_coff_swap_scnhdr_in (abfd, - (PTR) (external_sections + i * scnhsz), - (PTR) & tmp); + (void *) (external_sections + i * scnhsz), + (void *) & tmp); if (! make_a_section_from_file (abfd, &tmp, i + 1)) goto fail; } @@ -256,17 +226,16 @@ coff_real_object_p (abfd, nscns, internal_f, internal_a) not a COFF file. This is also used by ECOFF. */ const bfd_target * -coff_object_p (abfd) - bfd *abfd; +coff_object_p (bfd *abfd) { bfd_size_type filhsz; bfd_size_type aoutsz; unsigned int nscns; - PTR filehdr; + void * filehdr; struct internal_filehdr internal_f; struct internal_aouthdr internal_a; - /* figure out how much to read */ + /* Figure out how much to read. */ filhsz = bfd_coff_filhsz (abfd); aoutsz = bfd_coff_aoutsz (abfd); @@ -301,7 +270,7 @@ coff_object_p (abfd) if (internal_f.f_opthdr) { - PTR opthdr; + void * opthdr; opthdr = bfd_alloc (abfd, aoutsz); if (opthdr == NULL) @@ -312,7 +281,7 @@ coff_object_p (abfd) bfd_release (abfd, opthdr); return NULL; } - bfd_coff_swap_aouthdr_in (abfd, opthdr, (PTR) &internal_a); + bfd_coff_swap_aouthdr_in (abfd, opthdr, (void *) &internal_a); bfd_release (abfd, opthdr); } @@ -325,9 +294,7 @@ coff_object_p (abfd) /* Get the BFD section from a COFF symbol section number. */ asection * -coff_section_from_bfd_index (abfd, index) - bfd *abfd; - int index; +coff_section_from_bfd_index (bfd *abfd, int index) { struct bfd_section *answer = abfd->sections; @@ -353,8 +320,7 @@ coff_section_from_bfd_index (abfd, index) /* Get the upper bound of a COFF symbol table. */ long -coff_get_symtab_upper_bound (abfd) - bfd *abfd; +coff_get_symtab_upper_bound (bfd *abfd) { if (!bfd_coff_slurp_symbol_table (abfd)) return -1; @@ -365,9 +331,7 @@ coff_get_symtab_upper_bound (abfd) /* Canonicalize a COFF symbol table. */ long -coff_canonicalize_symtab (abfd, alocation) - bfd *abfd; - asymbol **alocation; +coff_canonicalize_symtab (bfd *abfd, asymbol **alocation) { unsigned int counter; coff_symbol_type *symbase; @@ -390,10 +354,9 @@ coff_canonicalize_symtab (abfd, alocation) >= SYMNMLEN + 1. */ const char * -_bfd_coff_internal_syment_name (abfd, sym, buf) - bfd *abfd; - const struct internal_syment *sym; - char *buf; +_bfd_coff_internal_syment_name (bfd *abfd, + const struct internal_syment *sym, + char *buf) { /* FIXME: It's not clear this will work correctly if sizeof (_n_zeroes) != 4. */ @@ -430,14 +393,12 @@ _bfd_coff_internal_syment_name (abfd, sym, buf) value must be INTERNAL_RELOCS. The function returns NULL on error. */ struct internal_reloc * -_bfd_coff_read_internal_relocs (abfd, sec, cache, external_relocs, - require_internal, internal_relocs) - bfd *abfd; - asection *sec; - bfd_boolean cache; - bfd_byte *external_relocs; - bfd_boolean require_internal; - struct internal_reloc *internal_relocs; +_bfd_coff_read_internal_relocs (bfd *abfd, + asection *sec, + bfd_boolean cache, + bfd_byte *external_relocs, + bfd_boolean require_internal, + struct internal_reloc *internal_relocs) { bfd_size_type relsz; bfd_byte *free_external = NULL; @@ -462,7 +423,7 @@ _bfd_coff_read_internal_relocs (abfd, sec, cache, external_relocs, amt = sec->reloc_count * relsz; if (external_relocs == NULL) { - free_external = (bfd_byte *) bfd_malloc (amt); + free_external = bfd_malloc (amt); if (free_external == NULL && sec->reloc_count > 0) goto error_return; external_relocs = free_external; @@ -476,7 +437,7 @@ _bfd_coff_read_internal_relocs (abfd, sec, cache, external_relocs, { amt = sec->reloc_count; amt *= sizeof (struct internal_reloc); - free_internal = (struct internal_reloc *) bfd_malloc (amt); + free_internal = bfd_malloc (amt); if (free_internal == NULL && sec->reloc_count > 0) goto error_return; internal_relocs = free_internal; @@ -487,7 +448,7 @@ _bfd_coff_read_internal_relocs (abfd, sec, cache, external_relocs, erel_end = erel + relsz * sec->reloc_count; irel = internal_relocs; for (; erel < erel_end; erel += relsz, irel++) - bfd_coff_swap_reloc_in (abfd, (PTR) erel, (PTR) irel); + bfd_coff_swap_reloc_in (abfd, (void *) erel, (void *) irel); if (free_external != NULL) { @@ -500,7 +461,7 @@ _bfd_coff_read_internal_relocs (abfd, sec, cache, external_relocs, if (coff_section_data (abfd, sec) == NULL) { amt = sizeof (struct coff_section_tdata); - sec->used_by_bfd = (PTR) bfd_zalloc (abfd, amt); + sec->used_by_bfd = bfd_zalloc (abfd, amt); if (sec->used_by_bfd == NULL) goto error_return; coff_section_data (abfd, sec)->contents = NULL; @@ -521,8 +482,7 @@ _bfd_coff_read_internal_relocs (abfd, sec, cache, external_relocs, /* Set lineno_count for the output sections of a COFF file. */ int -coff_count_linenumbers (abfd) - bfd *abfd; +coff_count_linenumbers (bfd *abfd) { unsigned int limit = bfd_get_symcount (abfd); unsigned int i; @@ -583,9 +543,8 @@ coff_count_linenumbers (abfd) area of the symbol if there is one. */ coff_symbol_type * -coff_symbol_from (ignore_abfd, symbol) - bfd *ignore_abfd ATTRIBUTE_UNUSED; - asymbol *symbol; +coff_symbol_from (bfd *ignore_abfd ATTRIBUTE_UNUSED, + asymbol *symbol) { if (!bfd_family_coff (bfd_asymbol_bfd (symbol))) return (coff_symbol_type *) NULL; @@ -597,16 +556,14 @@ coff_symbol_from (ignore_abfd, symbol) } static void -fixup_symbol_value (abfd, coff_symbol_ptr, syment) - bfd *abfd; - coff_symbol_type *coff_symbol_ptr; - struct internal_syment *syment; +fixup_symbol_value (bfd *abfd, + coff_symbol_type *coff_symbol_ptr, + struct internal_syment *syment) { - - /* Normalize the symbol flags */ + /* Normalize the symbol flags. */ if (bfd_is_com_section (coff_symbol_ptr->symbol.section)) { - /* a common symbol is undefined with a value */ + /* A common symbol is undefined with a value. */ syment->n_scnum = N_UNDEF; syment->n_value = coff_symbol_ptr->symbol.value; } @@ -655,14 +612,12 @@ fixup_symbol_value (abfd, coff_symbol_ptr, syment) do that here too. */ bfd_boolean -coff_renumber_symbols (bfd_ptr, first_undef) - bfd *bfd_ptr; - int *first_undef; +coff_renumber_symbols (bfd *bfd_ptr, int *first_undef) { unsigned int symbol_count = bfd_get_symcount (bfd_ptr); asymbol **symbol_ptr_ptr = bfd_ptr->outsymbols; unsigned int native_index = 0; - struct internal_syment *last_file = (struct internal_syment *) NULL; + struct internal_syment *last_file = NULL; unsigned int symbol_index; /* COFF demands that undefined symbols come after all other symbols. @@ -681,7 +636,7 @@ coff_renumber_symbols (bfd_ptr, first_undef) bfd_size_type amt; amt = sizeof (asymbol *) * ((bfd_size_type) symbol_count + 1); - newsyms = (asymbol **) bfd_alloc (bfd_ptr, amt); + newsyms = bfd_alloc (bfd_ptr, amt); if (!newsyms) return FALSE; bfd_ptr->outsymbols = newsyms; @@ -724,26 +679,22 @@ coff_renumber_symbols (bfd_ptr, first_undef) if (s->u.syment.n_sclass == C_FILE) { - if (last_file != (struct internal_syment *) NULL) + if (last_file != NULL) last_file->n_value = native_index; last_file = &(s->u.syment); } else - { + /* Modify the symbol values according to their section and + type. */ + fixup_symbol_value (bfd_ptr, coff_symbol_ptr, &(s->u.syment)); - /* Modify the symbol values according to their section and - type */ - - fixup_symbol_value (bfd_ptr, coff_symbol_ptr, &(s->u.syment)); - } for (i = 0; i < s->u.syment.n_numaux + 1; i++) s[i].offset = native_index++; } else - { - native_index++; - } + native_index++; } + obj_conv_table_size (bfd_ptr) = native_index; return TRUE; @@ -754,8 +705,7 @@ coff_renumber_symbols (bfd_ptr, first_undef) symbol table. */ void -coff_mangle_symbols (bfd_ptr) - bfd *bfd_ptr; +coff_mangle_symbols (bfd *bfd_ptr) { unsigned int symbol_count = bfd_get_symcount (bfd_ptr); asymbol **symbol_ptr_ptr = bfd_ptr->outsymbols; @@ -818,22 +768,20 @@ coff_mangle_symbols (bfd_ptr) } static void -coff_fix_symbol_name (abfd, symbol, native, string_size_p, - debug_string_section_p, debug_string_size_p) - bfd *abfd; - asymbol *symbol; - combined_entry_type *native; - bfd_size_type *string_size_p; - asection **debug_string_section_p; - bfd_size_type *debug_string_size_p; +coff_fix_symbol_name (bfd *abfd, + asymbol *symbol, + combined_entry_type *native, + bfd_size_type *string_size_p, + asection **debug_string_section_p, + bfd_size_type *debug_string_size_p) { unsigned int name_length; union internal_auxent *auxent; char *name = (char *) (symbol->name); - if (name == (char *) NULL) + if (name == NULL) { - /* coff symbols always have names, so we'll make one up */ + /* COFF symbols always have names, so we'll make one up. */ symbol->name = "strange"; name = (char *) symbol->name; } @@ -861,9 +809,7 @@ coff_fix_symbol_name (abfd, symbol, native, string_size_p, if (bfd_coff_long_filenames (abfd)) { if (name_length <= filnmlen) - { - strncpy (auxent->x_file.x_fname, name, filnmlen); - } + strncpy (auxent->x_file.x_fname, name, filnmlen); else { auxent->x_file.x_n.x_offset = *string_size_p + STRING_SIZE_SIZE; @@ -881,10 +827,9 @@ coff_fix_symbol_name (abfd, symbol, native, string_size_p, else { if (name_length <= SYMNMLEN && !bfd_coff_force_symnames_in_strings (abfd)) - { - /* This name will fit into the symbol neatly */ - strncpy (native->u.syment._n._n_name, symbol->name, SYMNMLEN); - } + /* This name will fit into the symbol neatly. */ + strncpy (native->u.syment._n._n_name, symbol->name, SYMNMLEN); + else if (!bfd_coff_symname_in_debug (abfd, &native->u.syment)) { native->u.syment._n._n_n._n_offset = (*string_size_p @@ -913,12 +858,12 @@ coff_fix_symbol_name (abfd, symbol, native, string_size_p, if (!bfd_set_section_contents (abfd, *debug_string_section_p, - (PTR) buf, + (void *) buf, (file_ptr) *debug_string_size_p, (bfd_size_type) prefix_len) || !bfd_set_section_contents (abfd, *debug_string_section_p, - (PTR) symbol->name, + (void *) symbol->name, (file_ptr) (*debug_string_size_p + prefix_len), (bfd_size_type) name_length + 1)) @@ -942,20 +887,18 @@ coff_fix_symbol_name (abfd, symbol, native, string_size_p, /* Write a symbol out to a COFF file. */ static bfd_boolean -coff_write_symbol (abfd, symbol, native, written, string_size_p, - debug_string_section_p, debug_string_size_p) - bfd *abfd; - asymbol *symbol; - combined_entry_type *native; - bfd_vma *written; - bfd_size_type *string_size_p; - asection **debug_string_section_p; - bfd_size_type *debug_string_size_p; +coff_write_symbol (bfd *abfd, + asymbol *symbol, + combined_entry_type *native, + bfd_vma *written, + bfd_size_type *string_size_p, + asection **debug_string_section_p, + bfd_size_type *debug_string_size_p) { unsigned int numaux = native->u.syment.n_numaux; int type = native->u.syment.n_type; int class = native->u.syment.n_sclass; - PTR buf; + void * buf; bfd_size_type symesz; if (native->u.syment.n_sclass == C_FILE) @@ -963,22 +906,17 @@ coff_write_symbol (abfd, symbol, native, written, string_size_p, if (symbol->flags & BSF_DEBUGGING && bfd_is_abs_section (symbol->section)) - { - native->u.syment.n_scnum = N_DEBUG; - } + native->u.syment.n_scnum = N_DEBUG; + else if (bfd_is_abs_section (symbol->section)) - { - native->u.syment.n_scnum = N_ABS; - } + native->u.syment.n_scnum = N_ABS; + else if (bfd_is_und_section (symbol->section)) - { - native->u.syment.n_scnum = N_UNDEF; - } + native->u.syment.n_scnum = N_UNDEF; + else - { - native->u.syment.n_scnum = - symbol->section->output_section->target_index; - } + native->u.syment.n_scnum = + symbol->section->output_section->target_index; coff_fix_symbol_name (abfd, symbol, native, string_size_p, debug_string_section_p, debug_string_size_p); @@ -1005,9 +943,7 @@ coff_write_symbol (abfd, symbol, native, written, string_size_p, { bfd_coff_swap_aux_out (abfd, &((native + j + 1)->u.auxent), - type, - class, - (int) j, + type, class, (int) j, native->u.syment.n_numaux, buf); if (bfd_bwrite (buf, auxesz, abfd) != auxesz) @@ -1028,14 +964,12 @@ coff_write_symbol (abfd, symbol, native, written, string_size_p, or we may be linking a non COFF file to a COFF file. */ static bfd_boolean -coff_write_alien_symbol (abfd, symbol, written, string_size_p, - debug_string_section_p, debug_string_size_p) - bfd *abfd; - asymbol *symbol; - bfd_vma *written; - bfd_size_type *string_size_p; - asection **debug_string_section_p; - bfd_size_type *debug_string_size_p; +coff_write_alien_symbol (bfd *abfd, + asymbol *symbol, + bfd_vma *written, + bfd_size_type *string_size_p, + asection **debug_string_section_p, + bfd_size_type *debug_string_size_p) { combined_entry_type *native; combined_entry_type dummy; @@ -1096,14 +1030,12 @@ coff_write_alien_symbol (abfd, symbol, written, string_size_p, /* Write a native symbol to a COFF file. */ static bfd_boolean -coff_write_native_symbol (abfd, symbol, written, string_size_p, - debug_string_section_p, debug_string_size_p) - bfd *abfd; - coff_symbol_type *symbol; - bfd_vma *written; - bfd_size_type *string_size_p; - asection **debug_string_section_p; - bfd_size_type *debug_string_size_p; +coff_write_native_symbol (bfd *abfd, + coff_symbol_type *symbol, + bfd_vma *written, + bfd_size_type *string_size_p, + asection **debug_string_section_p, + bfd_size_type *debug_string_size_p) { combined_entry_type *native = symbol->native; alent *lineno = symbol->lineno; @@ -1114,6 +1046,7 @@ coff_write_native_symbol (abfd, symbol, written, string_size_p, if (lineno && !symbol->done_lineno && symbol->symbol.section->owner != NULL) { unsigned int count = 0; + lineno[count].u.offset = *written; if (native->u.syment.n_numaux) { @@ -1127,28 +1060,9 @@ coff_write_native_symbol (abfd, symbol, written, string_size_p, count++; while (lineno[count].line_number != 0) { -#if 0 - /* 13 april 92. sac - I've been told this, but still need proof: - > The second bug is also in `bfd/coffcode.h'. This bug - > causes the linker to screw up the pc-relocations for - > all the line numbers in COFF code. This bug isn't only - > specific to A29K implementations, but affects all - > systems using COFF format binaries. Note that in COFF - > object files, the line number core offsets output by - > the assembler are relative to the start of each - > procedure, not to the start of the .text section. This - > patch relocates the line numbers relative to the - > `native->u.syment.n_value' instead of the section - > virtual address. - > modular!olson@cs.arizona.edu (Jon Olson) - */ - lineno[count].u.offset += native->u.syment.n_value; -#else lineno[count].u.offset += (symbol->symbol.section->output_section->vma + symbol->symbol.section->output_offset); -#endif count++; } symbol->done_lineno = TRUE; @@ -1166,15 +1080,14 @@ coff_write_native_symbol (abfd, symbol, written, string_size_p, /* Write out the COFF symbols. */ bfd_boolean -coff_write_symbols (abfd) - bfd *abfd; +coff_write_symbols (bfd *abfd) { bfd_size_type string_size; asection *debug_string_section; bfd_size_type debug_string_size; unsigned int i; unsigned int limit = bfd_get_symcount (abfd); - bfd_signed_vma written = 0; + bfd_vma written = 0; asymbol **p; string_size = 0; @@ -1199,12 +1112,11 @@ coff_write_symbols (abfd) } } - /* Seek to the right place */ + /* Seek to the right place. */ if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0) return FALSE; - /* Output all the symbols we have */ - + /* Output all the symbols we have. */ written = 0; for (p = abfd->outsymbols, i = 0; i < limit; i++, p++) { @@ -1230,8 +1142,7 @@ coff_write_symbols (abfd) obj_raw_syment_count (abfd) = written; - /* Now write out strings */ - + /* Now write out strings. */ if (string_size != 0) { unsigned int size = string_size + STRING_SIZE_SIZE; @@ -1242,7 +1153,7 @@ coff_write_symbols (abfd) #else #error Change H_PUT_32 #endif - if (bfd_bwrite ((PTR) buffer, (bfd_size_type) sizeof (buffer), abfd) + if (bfd_bwrite ((void *) buffer, (bfd_size_type) sizeof (buffer), abfd) != sizeof (buffer)) return FALSE; @@ -1284,18 +1195,16 @@ coff_write_symbols (abfd) if (c_symbol == NULL || c_symbol->native == NULL) - { - /* This is not a COFF symbol, so it certainly is not a - file name, nor does it go in the .debug section. */ - maxlen = bfd_coff_force_symnames_in_strings (abfd) ? 0 : SYMNMLEN; - } + /* This is not a COFF symbol, so it certainly is not a + file name, nor does it go in the .debug section. */ + maxlen = bfd_coff_force_symnames_in_strings (abfd) ? 0 : SYMNMLEN; + else if (bfd_coff_symname_in_debug (abfd, &c_symbol->native->u.syment)) - { - /* This symbol name is in the XCOFF .debug section. - Don't write it into the string table. */ - maxlen = name_length; - } + /* This symbol name is in the XCOFF .debug section. + Don't write it into the string table. */ + maxlen = name_length; + else if (c_symbol->native->u.syment.n_sclass == C_FILE && c_symbol->native->u.syment.n_numaux > 0) { @@ -1311,7 +1220,7 @@ coff_write_symbols (abfd) if (name_length > maxlen) { - if (bfd_bwrite ((PTR) (q->name), (bfd_size_type) name_length + 1, + if (bfd_bwrite ((void *) (q->name), (bfd_size_type) name_length + 1, abfd) != name_length + 1) return FALSE; } @@ -1330,7 +1239,7 @@ coff_write_symbols (abfd) #else #error Change H_PUT_32 #endif - if (bfd_bwrite ((PTR) buffer, (bfd_size_type) STRING_SIZE_SIZE, abfd) + if (bfd_bwrite ((void *) buffer, (bfd_size_type) STRING_SIZE_SIZE, abfd) != STRING_SIZE_SIZE) return FALSE; } @@ -1344,18 +1253,17 @@ coff_write_symbols (abfd) || (debug_string_section != (asection *) NULL && (BFD_ALIGN (debug_string_size, 1 << debug_string_section->alignment_power) - == bfd_section_size (abfd, debug_string_section)))); + == debug_string_section->size))); return TRUE; } bfd_boolean -coff_write_linenumbers (abfd) - bfd *abfd; +coff_write_linenumbers (bfd *abfd) { asection *s; bfd_size_type linesz; - PTR buff; + void * buff; linesz = bfd_coff_linesz (abfd); buff = bfd_alloc (abfd, linesz); @@ -1368,7 +1276,7 @@ coff_write_linenumbers (abfd) asymbol **q = abfd->outsymbols; if (bfd_seek (abfd, s->line_filepos, SEEK_SET) != 0) return FALSE; - /* Find all the linenumbers in this section */ + /* Find all the linenumbers in this section. */ while (*q) { asymbol *p = *q; @@ -1379,9 +1287,9 @@ coff_write_linenumbers (abfd) (bfd_asymbol_bfd (p), p)); if (l) { - /* Found a linenumber entry, output */ + /* Found a linenumber entry, output. */ struct internal_lineno out; - memset ((PTR) & out, 0, sizeof (out)); + memset ((void *) & out, 0, sizeof (out)); out.l_lnno = 0; out.l_addr.l_symndx = l->u.offset; bfd_coff_swap_lineno_out (abfd, &out, buff); @@ -1410,76 +1318,20 @@ coff_write_linenumbers (abfd) } alent * -coff_get_lineno (ignore_abfd, symbol) - bfd *ignore_abfd ATTRIBUTE_UNUSED; - asymbol *symbol; +coff_get_lineno (bfd *ignore_abfd ATTRIBUTE_UNUSED, asymbol *symbol) { return coffsymbol (symbol)->lineno; } -#if 0 - -/* This is only called from coff_add_missing_symbols, which has been - disabled. */ - -asymbol * -coff_section_symbol (abfd, name) - bfd *abfd; - char *name; -{ - asection *sec = bfd_make_section_old_way (abfd, name); - asymbol *sym; - combined_entry_type *csym; - - sym = sec->symbol; - csym = coff_symbol_from (abfd, sym)->native; - /* Make sure back-end COFF stuff is there. */ - if (csym == 0) - { - struct foo - { - coff_symbol_type sym; - /* @@FIXME This shouldn't use a fixed size!! */ - combined_entry_type e[10]; - }; - struct foo *f; - - f = (struct foo *) bfd_zalloc (abfd, (bfd_size_type) sizeof (*f)); - if (!f) - { - bfd_set_error (bfd_error_no_error); - return NULL; - } - coff_symbol_from (abfd, sym)->native = csym = f->e; - } - csym[0].u.syment.n_sclass = C_STAT; - csym[0].u.syment.n_numaux = 1; -/* SF_SET_STATICS (sym); @@ ??? */ - csym[1].u.auxent.x_scn.x_scnlen = sec->_raw_size; - csym[1].u.auxent.x_scn.x_nreloc = sec->reloc_count; - csym[1].u.auxent.x_scn.x_nlinno = sec->lineno_count; - - if (sec->output_section == NULL) - { - sec->output_section = sec; - sec->output_offset = 0; - } - - return sym; -} - -#endif /* 0 */ - /* This function transforms the offsets into the symbol table into pointers to syments. */ static void -coff_pointerize_aux (abfd, table_base, symbol, indaux, auxent) - bfd *abfd; - combined_entry_type *table_base; - combined_entry_type *symbol; - unsigned int indaux; - combined_entry_type *auxent; +coff_pointerize_aux (bfd *abfd, + combined_entry_type *table_base, + combined_entry_type *symbol, + unsigned int indaux, + combined_entry_type *auxent) { unsigned int type = symbol->u.syment.n_type; unsigned int class = symbol->u.syment.n_sclass; @@ -1491,15 +1343,16 @@ coff_pointerize_aux (abfd, table_base, symbol, indaux, auxent) return; } - /* Don't bother if this is a file or a section */ + /* Don't bother if this is a file or a section. */ if (class == C_STAT && type == T_NULL) return; if (class == C_FILE) return; - /* Otherwise patch up */ -#define N_TMASK coff_data (abfd)->local_n_tmask + /* Otherwise patch up. */ +#define N_TMASK coff_data (abfd)->local_n_tmask #define N_BTSHFT coff_data (abfd)->local_n_btshft + if ((ISFCN (type) || ISTAG (class) || class == C_BLOCK || class == C_FCN) && auxent->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.l > 0) { @@ -1522,8 +1375,7 @@ coff_pointerize_aux (abfd, table_base, symbol, indaux, auxent) we didn't want to go to the trouble until someone needed it. */ static char * -build_debug_section (abfd) - bfd *abfd; +build_debug_section (bfd *abfd) { char *debug_section; file_ptr position; @@ -1537,8 +1389,8 @@ build_debug_section (abfd) return NULL; } - sec_size = bfd_get_section_size_before_reloc (sect); - debug_section = (PTR) bfd_alloc (abfd, sec_size); + sec_size = sect->size; + debug_section = bfd_alloc (abfd, sec_size); if (debug_section == NULL) return NULL; @@ -1557,25 +1409,20 @@ build_debug_section (abfd) /* Return a pointer to a malloc'd copy of 'name'. 'name' may not be \0-terminated, but will not exceed 'maxlen' characters. The copy *will* be \0-terminated. */ + static char * -copy_name (abfd, name, maxlen) - bfd *abfd; - char *name; - size_t maxlen; +copy_name (bfd *abfd, char *name, size_t maxlen) { size_t len; char *newname; for (len = 0; len < maxlen; ++len) - { - if (name[len] == '\0') - { - break; - } - } + if (name[len] == '\0') + break; + + if ((newname = bfd_alloc (abfd, (bfd_size_type) len + 1)) == NULL) + return NULL; - if ((newname = (PTR) bfd_alloc (abfd, (bfd_size_type) len + 1)) == NULL) - return (NULL); strncpy (newname, name, len); newname[len] = '\0'; return newname; @@ -1584,12 +1431,11 @@ copy_name (abfd, name, maxlen) /* Read in the external symbols. */ bfd_boolean -_bfd_coff_get_external_symbols (abfd) - bfd *abfd; +_bfd_coff_get_external_symbols (bfd *abfd) { bfd_size_type symesz; bfd_size_type size; - PTR syms; + void * syms; if (obj_coff_external_syms (abfd) != NULL) return TRUE; @@ -1598,7 +1444,7 @@ _bfd_coff_get_external_symbols (abfd) size = obj_raw_syment_count (abfd) * symesz; - syms = (PTR) bfd_malloc (size); + syms = bfd_malloc (size); if (syms == NULL && size != 0) return FALSE; @@ -1620,8 +1466,7 @@ _bfd_coff_get_external_symbols (abfd) detecting a missing string table in an archive. */ const char * -_bfd_coff_read_string_table (abfd) - bfd *abfd; +_bfd_coff_read_string_table (bfd *abfd) { char extstrsize[STRING_SIZE_SIZE]; bfd_size_type strsize; @@ -1663,13 +1508,12 @@ _bfd_coff_read_string_table (abfd) if (strsize < STRING_SIZE_SIZE) { (*_bfd_error_handler) - (_("%s: bad string table size %lu"), bfd_archive_filename (abfd), - (unsigned long) strsize); + (_("%B: bad string table size %lu"), abfd, (unsigned long) strsize); bfd_set_error (bfd_error_bad_value); return NULL; } - strings = (char *) bfd_malloc (strsize); + strings = bfd_malloc (strsize); if (strings == NULL) return NULL; @@ -1688,8 +1532,7 @@ _bfd_coff_read_string_table (abfd) /* Free up the external symbols and strings read from a COFF file. */ bfd_boolean -_bfd_coff_free_symbols (abfd) - bfd *abfd; +_bfd_coff_free_symbols (bfd *abfd) { if (obj_coff_external_syms (abfd) != NULL && ! obj_coff_keep_syms (abfd)) @@ -1712,8 +1555,7 @@ _bfd_coff_free_symbols (abfd) terminated string. */ combined_entry_type * -coff_get_normalized_symtab (abfd) - bfd *abfd; +coff_get_normalized_symtab (bfd *abfd) { combined_entry_type *internal; combined_entry_type *internal_ptr; @@ -1730,7 +1572,7 @@ coff_get_normalized_symtab (abfd) return obj_raw_syments (abfd); size = obj_raw_syment_count (abfd) * sizeof (combined_entry_type); - internal = (combined_entry_type *) bfd_zalloc (abfd, size); + internal = bfd_zalloc (abfd, size); if (internal == NULL && size != 0) return NULL; internal_end = internal + obj_raw_syment_count (abfd); @@ -1740,22 +1582,22 @@ coff_get_normalized_symtab (abfd) raw_src = (char *) obj_coff_external_syms (abfd); - /* mark the end of the symbols */ + /* Mark the end of the symbols. */ symesz = bfd_coff_symesz (abfd); raw_end = (char *) raw_src + obj_raw_syment_count (abfd) * symesz; /* FIXME SOMEDAY. A string table size of zero is very weird, but probably possible. If one shows up, it will probably kill us. */ - /* Swap all the raw entries */ + /* Swap all the raw entries. */ for (internal_ptr = internal; raw_src < raw_end; raw_src += symesz, internal_ptr++) { unsigned int i; - bfd_coff_swap_sym_in (abfd, (PTR) raw_src, - (PTR) & internal_ptr->u.syment); + bfd_coff_swap_sym_in (abfd, (void *) raw_src, + (void *) & internal_ptr->u.syment); symbol_ptr = internal_ptr; for (i = 0; @@ -1764,7 +1606,7 @@ coff_get_normalized_symtab (abfd) { internal_ptr++; raw_src += symesz; - bfd_coff_swap_aux_in (abfd, (PTR) raw_src, + bfd_coff_swap_aux_in (abfd, (void *) raw_src, symbol_ptr->u.syment.n_type, symbol_ptr->u.syment.n_sclass, (int) i, symbol_ptr->u.syment.n_numaux, @@ -1785,11 +1627,11 @@ coff_get_normalized_symtab (abfd) if (internal_ptr->u.syment.n_sclass == C_FILE && internal_ptr->u.syment.n_numaux > 0) { - /* make a file symbol point to the name in the auxent, since - the text ".file" is redundant */ + /* Make a file symbol point to the name in the auxent, since + the text ".file" is redundant. */ if ((internal_ptr + 1)->u.auxent.x_file.x_n.x_zeroes == 0) { - /* the filename is a long one, point into the string table */ + /* The filename is a long one, point into the string table. */ if (string_table == NULL) { string_table = _bfd_coff_read_string_table (abfd); @@ -1809,21 +1651,17 @@ coff_get_normalized_symtab (abfd) multiple AUX entries. */ if (internal_ptr->u.syment.n_numaux > 1 && coff_data (abfd)->pe) - { - internal_ptr->u.syment._n._n_n._n_offset = - ((long) - copy_name (abfd, - (internal_ptr + 1)->u.auxent.x_file.x_fname, - internal_ptr->u.syment.n_numaux * symesz)); - } + internal_ptr->u.syment._n._n_n._n_offset = + ((long) + copy_name (abfd, + (internal_ptr + 1)->u.auxent.x_file.x_fname, + internal_ptr->u.syment.n_numaux * symesz)); else - { - internal_ptr->u.syment._n._n_n._n_offset = - ((long) - copy_name (abfd, - (internal_ptr + 1)->u.auxent.x_file.x_fname, - (size_t) bfd_coff_filnmlen (abfd))); - } + internal_ptr->u.syment._n._n_n._n_offset = + ((long) + copy_name (abfd, + (internal_ptr + 1)->u.auxent.x_file.x_fname, + (size_t) bfd_coff_filnmlen (abfd))); } } else @@ -1834,15 +1672,15 @@ coff_get_normalized_symtab (abfd) size_t i; char *newstring; - /* find the length of this string without walking into memory + /* Find the length of this string without walking into memory that isn't ours. */ for (i = 0; i < 8; ++i) if (internal_ptr->u.syment._n._n_name[i] == '\0') break; - newstring = (PTR) bfd_zalloc (abfd, (bfd_size_type) (i + 1)); + newstring = bfd_zalloc (abfd, (bfd_size_type) (i + 1)); if (newstring == NULL) - return (NULL); + return NULL; strncpy (newstring, internal_ptr->u.syment._n._n_name, i); internal_ptr->u.syment._n._n_n._n_offset = (long int) newstring; internal_ptr->u.syment._n._n_n._n_zeroes = 0; @@ -1880,13 +1718,11 @@ coff_get_normalized_symtab (abfd) BFD_ASSERT (obj_raw_syment_count (abfd) == (unsigned int) (internal_ptr - internal)); - return (internal); -} /* coff_get_normalized_symtab() */ + return internal; +} long -coff_get_reloc_upper_bound (abfd, asect) - bfd *abfd; - sec_ptr asect; +coff_get_reloc_upper_bound (bfd *abfd, sec_ptr asect) { if (bfd_get_format (abfd) != bfd_object) { @@ -1897,69 +1733,66 @@ coff_get_reloc_upper_bound (abfd, asect) } asymbol * -coff_make_empty_symbol (abfd) - bfd *abfd; +coff_make_empty_symbol (bfd *abfd) { bfd_size_type amt = sizeof (coff_symbol_type); - coff_symbol_type *new = (coff_symbol_type *) bfd_zalloc (abfd, amt); + coff_symbol_type *new = bfd_zalloc (abfd, amt); + if (new == NULL) - return (NULL); + return NULL; new->symbol.section = 0; new->native = 0; - new->lineno = (alent *) NULL; + new->lineno = NULL; new->done_lineno = FALSE; new->symbol.the_bfd = abfd; - return &new->symbol; + + return & new->symbol; } /* Make a debugging symbol. */ asymbol * -coff_bfd_make_debug_symbol (abfd, ptr, sz) - bfd *abfd; - PTR ptr ATTRIBUTE_UNUSED; - unsigned long sz ATTRIBUTE_UNUSED; +coff_bfd_make_debug_symbol (bfd *abfd, + void * ptr ATTRIBUTE_UNUSED, + unsigned long sz ATTRIBUTE_UNUSED) { bfd_size_type amt = sizeof (coff_symbol_type); - coff_symbol_type *new = (coff_symbol_type *) bfd_alloc (abfd, amt); + coff_symbol_type *new = bfd_alloc (abfd, amt); + if (new == NULL) - return (NULL); + return NULL; /* @@ The 10 is a guess at a plausible maximum number of aux entries (but shouldn't be a constant). */ amt = sizeof (combined_entry_type) * 10; - new->native = (combined_entry_type *) bfd_zalloc (abfd, amt); + new->native = bfd_zalloc (abfd, amt); if (!new->native) - return (NULL); + return NULL; new->symbol.section = bfd_abs_section_ptr; new->symbol.flags = BSF_DEBUGGING; - new->lineno = (alent *) NULL; + new->lineno = NULL; new->done_lineno = FALSE; new->symbol.the_bfd = abfd; - return &new->symbol; + + return & new->symbol; } void -coff_get_symbol_info (abfd, symbol, ret) - bfd *abfd; - asymbol *symbol; - symbol_info *ret; +coff_get_symbol_info (bfd *abfd, asymbol *symbol, symbol_info *ret) { bfd_symbol_info (symbol, ret); + if (coffsymbol (symbol)->native != NULL && coffsymbol (symbol)->native->fix_value) - { - ret->value = coffsymbol (symbol)->native->u.syment.n_value - - (unsigned long) obj_raw_syments (abfd); - } + ret->value = coffsymbol (symbol)->native->u.syment.n_value - + (unsigned long) obj_raw_syments (abfd); } /* Return the COFF syment for a symbol. */ bfd_boolean -bfd_coff_get_syment (abfd, symbol, psyment) - bfd *abfd; - asymbol *symbol; - struct internal_syment *psyment; +bfd_coff_get_syment (bfd *abfd, + asymbol *symbol, + struct internal_syment *psyment) { coff_symbol_type *csym; @@ -1984,11 +1817,10 @@ bfd_coff_get_syment (abfd, symbol, psyment) /* Return the COFF auxent for a symbol. */ bfd_boolean -bfd_coff_get_auxent (abfd, symbol, indx, pauxent) - bfd *abfd; - asymbol *symbol; - int indx; - union internal_auxent *pauxent; +bfd_coff_get_auxent (bfd *abfd, + asymbol *symbol, + int indx, + union internal_auxent *pauxent) { coff_symbol_type *csym; combined_entry_type *ent; @@ -2028,13 +1860,12 @@ bfd_coff_get_auxent (abfd, symbol, indx, pauxent) /* Print out information about COFF symbol. */ void -coff_print_symbol (abfd, filep, symbol, how) - bfd *abfd; - PTR filep; - asymbol *symbol; - bfd_print_symbol_type how; +coff_print_symbol (bfd *abfd, + void * filep, + asymbol *symbol, + bfd_print_symbol_type how) { - FILE *file = (FILE *) filep; + FILE * file = (FILE *) filep; switch (how) { @@ -2064,28 +1895,14 @@ coff_print_symbol (abfd, filep, symbol, how) else val = combined->u.syment.n_value - (unsigned long) root; -#ifndef XCOFF64 - fprintf (file, - "(sec %2d)(fl 0x%02x)(ty %3x)(scl %3d) (nx %d) 0x%08lx %s", + fprintf (file, "(sec %2d)(fl 0x%02x)(ty %3x)(scl %3d) (nx %d) 0x", combined->u.syment.n_scnum, combined->u.syment.n_flags, combined->u.syment.n_type, combined->u.syment.n_sclass, - combined->u.syment.n_numaux, - (unsigned long) val, - symbol->name); -#else - /* Print out the wide, 64 bit, symbol value */ - fprintf (file, - "(sec %2d)(fl 0x%02x)(ty %3x)(scl %3d) (nx %d) 0x%016llx %s", - combined->u.syment.n_scnum, - combined->u.syment.n_flags, - combined->u.syment.n_type, - combined->u.syment.n_sclass, - combined->u.syment.n_numaux, - val, - symbol->name); -#endif + combined->u.syment.n_numaux); + fprintf_vma (file, val); + fprintf (file, " %s", symbol->name); for (aux = 0; aux < combined->u.syment.n_numaux; aux++) { @@ -2110,7 +1927,7 @@ coff_print_symbol (abfd, filep, symbol, how) case C_STAT: if (combined->u.syment.n_type == T_NULL) - /* probably a section symbol? */ + /* Probably a section symbol ? */ { fprintf (file, "AUX scnlen 0x%lx nreloc %d nlnno %d", (long) auxp->u.auxent.x_scn.x_scnlen, @@ -2125,7 +1942,7 @@ coff_print_symbol (abfd, filep, symbol, how) auxp->u.auxent.x_scn.x_comdat); break; } - /* else fall through */ + /* Otherwise fall through. */ case C_EXT: if (ISFCN (combined->u.syment.n_type)) { @@ -2143,7 +1960,7 @@ coff_print_symbol (abfd, filep, symbol, how) llnos, next); break; } - /* else fall through */ + /* Otherwise fall through. */ default: fprintf (file, "AUX lnno %d size 0x%x tagndx %ld", auxp->u.auxent.x_sym.x_misc.x_lnsz.x_lnno, @@ -2164,17 +1981,15 @@ coff_print_symbol (abfd, filep, symbol, how) l++; while (l->line_number) { - fprintf (file, "\n%4d : 0x%lx", - l->line_number, - ((unsigned long) - (l->u.offset + symbol->section->vma))); + fprintf (file, "\n%4d : ", l->line_number); + fprintf_vma (file, l->u.offset + symbol->section->vma); l++; } } } else { - bfd_print_symbol_vandf (abfd, (PTR) file, symbol); + bfd_print_symbol_vandf (abfd, (void *) file, symbol); fprintf (file, " %-5s %s %s %s", symbol->section->name, coffsymbol (symbol)->native ? "n" : "g", @@ -2190,9 +2005,8 @@ coff_print_symbol (abfd, filep, symbol, how) override it. */ bfd_boolean -_bfd_coff_is_local_label_name (abfd, name) - bfd *abfd ATTRIBUTE_UNUSED; - const char *name; +_bfd_coff_is_local_label_name (bfd *abfd ATTRIBUTE_UNUSED, + const char *name) { return name[0] == '.' && name[1] == 'L'; } @@ -2202,21 +2016,19 @@ _bfd_coff_is_local_label_name (abfd, name) nearest to the wanted location. */ bfd_boolean -coff_find_nearest_line (abfd, section, symbols, offset, filename_ptr, - functionname_ptr, line_ptr) - bfd *abfd; - asection *section; - asymbol **symbols; - bfd_vma offset; - const char **filename_ptr; - const char **functionname_ptr; - unsigned int *line_ptr; +coff_find_nearest_line (bfd *abfd, + asection *section, + asymbol **symbols, + bfd_vma offset, + const char **filename_ptr, + const char **functionname_ptr, + unsigned int *line_ptr) { bfd_boolean found; unsigned int i; unsigned int line_base; coff_data_type *cof = coff_data (abfd); - /* Run through the raw syments if available */ + /* Run through the raw syments if available. */ combined_entry_type *p; combined_entry_type *pend; alent *l; @@ -2245,7 +2057,7 @@ coff_find_nearest_line (abfd, section, symbols, offset, filename_ptr, *functionname_ptr = 0; *line_ptr = 0; - /* Don't try and find line numbers in a non coff file */ + /* Don't try and find line numbers in a non coff file. */ if (!bfd_family_coff (abfd)) return FALSE; @@ -2315,8 +2127,8 @@ coff_find_nearest_line (abfd, section, symbols, offset, filename_ptr, } } - /* Now wander though the raw linenumbers of the section */ - /* If we have been called on this section before, and the offset we + /* Now wander though the raw linenumbers of the section. */ + /* If we have been called on this section before, and th. e offset we want is further down then we can prime the lookup loop. */ sec_data = coff_section_data (abfd, section); if (sec_data != NULL @@ -2343,7 +2155,7 @@ coff_find_nearest_line (abfd, section, symbols, offset, filename_ptr, { if (l->line_number == 0) { - /* Get the symbol this line number points at */ + /* Get the symbol this line number points at. */ coff_symbol_type *coff = (coff_symbol_type *) (l->u.sym); if (coff->symbol.value > offset) break; @@ -2397,7 +2209,7 @@ coff_find_nearest_line (abfd, section, symbols, offset, filename_ptr, if (sec_data == NULL && section->owner == abfd) { amt = sizeof (struct coff_section_tdata); - section->used_by_bfd = (PTR) bfd_zalloc (abfd, amt); + section->used_by_bfd = bfd_zalloc (abfd, amt); sec_data = (struct coff_section_tdata *) section->used_by_bfd; } if (sec_data != NULL) @@ -2411,32 +2223,40 @@ coff_find_nearest_line (abfd, section, symbols, offset, filename_ptr, return TRUE; } +bfd_boolean +coff_find_inliner_info (bfd *abfd, + const char **filename_ptr, + const char **functionname_ptr, + unsigned int *line_ptr) +{ + bfd_boolean found; + + found = _bfd_dwarf2_find_inliner_info (abfd, filename_ptr, + functionname_ptr, line_ptr, + &coff_data(abfd)->dwarf2_find_line_info); + return (found); +} + int -coff_sizeof_headers (abfd, reloc) - bfd *abfd; - bfd_boolean reloc; +coff_sizeof_headers (bfd *abfd, bfd_boolean reloc) { size_t size; if (! reloc) - { - size = bfd_coff_filhsz (abfd) + bfd_coff_aoutsz (abfd); - } + size = bfd_coff_filhsz (abfd) + bfd_coff_aoutsz (abfd); else - { - size = bfd_coff_filhsz (abfd); - } + size = bfd_coff_filhsz (abfd); size += abfd->section_count * bfd_coff_scnhsz (abfd); return size; } /* Change the class of a coff symbol held by BFD. */ + bfd_boolean -bfd_coff_set_symbol_class (abfd, symbol, class) - bfd * abfd; - asymbol * symbol; - unsigned int class; +bfd_coff_set_symbol_class (bfd * abfd, + asymbol * symbol, + unsigned int class) { coff_symbol_type * csym; @@ -2456,7 +2276,7 @@ bfd_coff_set_symbol_class (abfd, symbol, class) combined_entry_type * native; bfd_size_type amt = sizeof (* native); - native = (combined_entry_type *) bfd_zalloc (abfd, amt); + native = bfd_zalloc (abfd, amt); if (native == NULL) return FALSE; @@ -2490,9 +2310,17 @@ bfd_coff_set_symbol_class (abfd, symbol, class) csym->native = native; } else - { - csym->native->u.syment.n_sclass = class; - } + csym->native->u.syment.n_sclass = class; return TRUE; } + +struct coff_comdat_info * +bfd_coff_get_comdat_section (bfd *abfd, struct bfd_section *sec) +{ + if (bfd_get_flavour (abfd) == bfd_target_coff_flavour + && coff_section_data (abfd, sec) != NULL) + return coff_section_data (abfd, sec)->comdat; + else + return NULL; +} diff --git a/contrib/binutils/bfd/cofflink.c b/contrib/binutils/bfd/cofflink.c index 4ad566cc22e..a1f6684bb61 100644 --- a/contrib/binutils/bfd/cofflink.c +++ b/contrib/binutils/bfd/cofflink.c @@ -1,6 +1,6 @@ /* COFF specific linker code. - Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 - Free Software Foundation, Inc. + Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, + 2004, 2005, 2006 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* This file contains the COFF backend linker code. */ @@ -94,10 +94,11 @@ _bfd_coff_link_hash_table_init (struct coff_link_hash_table *table, bfd *abfd, struct bfd_hash_entry *(*newfunc) (struct bfd_hash_entry *, struct bfd_hash_table *, - const char *)) + const char *), + unsigned int entsize) { - table->stab_info = NULL; - return _bfd_link_hash_table_init (&table->root, abfd, newfunc); + memset (&table->stab_info, 0, sizeof (table->stab_info)); + return _bfd_link_hash_table_init (&table->root, abfd, newfunc, entsize); } /* Create a COFF linker hash table. */ @@ -113,7 +114,8 @@ _bfd_coff_link_hash_table_create (bfd *abfd) return NULL; if (! _bfd_coff_link_hash_table_init (ret, abfd, - _bfd_coff_link_hash_newfunc)) + _bfd_coff_link_hash_newfunc, + sizeof (struct coff_link_hash_entry))) { free (ret); return (struct bfd_link_hash_table *) NULL; @@ -435,18 +437,19 @@ coff_link_add_symbols (bfd *abfd, if (obj_pe (abfd) && (classification == COFF_SYMBOL_GLOBAL || classification == COFF_SYMBOL_PE_SECTION) - && section->comdat != NULL + && coff_section_data (abfd, section) != NULL + && coff_section_data (abfd, section)->comdat != NULL && strncmp (name, "??_", 3) == 0 - && strcmp (name, section->comdat->name) == 0) + && strcmp (name, coff_section_data (abfd, section)->comdat->name) == 0) { if (*sym_hash == NULL) *sym_hash = coff_link_hash_lookup (coff_hash_table (info), name, FALSE, copy, FALSE); if (*sym_hash != NULL && (*sym_hash)->root.type == bfd_link_hash_defined - && (*sym_hash)->root.u.def.section->comdat != NULL - && strcmp ((*sym_hash)->root.u.def.section->comdat->name, - section->comdat->name) == 0) + && coff_section_data (abfd, (*sym_hash)->root.u.def.section)->comdat != NULL + && strcmp (coff_section_data (abfd, (*sym_hash)->root.u.def.section)->comdat->name, + coff_section_data (abfd, section)->comdat->name) == 0) addit = FALSE; } @@ -503,9 +506,8 @@ coff_link_add_symbols (bfd *abfd, && (BTYPE ((*sym_hash)->type) == T_NULL || BTYPE (sym.n_type) == T_NULL))) (*_bfd_error_handler) - (_("Warning: type of symbol `%s' changed from %d to %d in %s"), - name, (*sym_hash)->type, sym.n_type, - bfd_archive_filename (abfd)); + (_("Warning: type of symbol `%s' changed from %d to %d in %B"), + abfd, name, (*sym_hash)->type, sym.n_type); /* We don't want to change from a meaningful base type to a null one, but if we know @@ -551,8 +553,8 @@ coff_link_add_symbols (bfd *abfd, For example, it won't help objdump. This needs to be done when we swap in the section header. */ BFD_ASSERT ((*sym_hash)->numaux == 1); - if (section->_raw_size == 0) - section->_raw_size = (*sym_hash)->aux[0].x_scn.x_scnlen; + if (section->size == 0) + section->size = (*sym_hash)->aux[0].x_scn.x_scnlen; /* FIXME: We could test whether the section sizes matches the size in the aux entry, but apparently @@ -693,7 +695,7 @@ _bfd_coff_final_link (bfd *abfd, { o->reloc_count = 0; o->lineno_count = 0; - for (p = o->link_order_head; p != NULL; p = p->next) + for (p = o->map_head.link_order; p != NULL; p = p->next) { if (p->type == bfd_indirect_link_order) { @@ -714,8 +716,10 @@ _bfd_coff_final_link (bfd *abfd, if (info->relocatable) o->reloc_count += sec->reloc_count; - if (sec->_raw_size > max_contents_size) - max_contents_size = sec->_raw_size; + if (sec->rawsize > max_contents_size) + max_contents_size = sec->rawsize; + if (sec->size > max_contents_size) + max_contents_size = sec->size; if (sec->lineno_count > max_lineno_count) max_lineno_count = sec->lineno_count; if (sec->reloc_count > max_reloc_count) @@ -886,7 +890,7 @@ _bfd_coff_final_link (bfd *abfd, for (o = abfd->sections; o != NULL; o = o->next) { - for (p = o->link_order_head; p != NULL; p = p->next) + for (p = o->map_head.link_order; p != NULL; p = p->next) { if (p->type == bfd_indirect_link_order && bfd_family_coff (p->u.indirect.section->owner)) @@ -1080,7 +1084,7 @@ _bfd_coff_final_link (bfd *abfd, } /* If we have optimized stabs strings, output them. */ - if (coff_hash_table (info)->stab_info != NULL) + if (coff_hash_table (info)->stab_info.stabstr != NULL) { if (! _bfd_write_stab_strings (abfd, &coff_hash_table (info)->stab_info)) return FALSE; @@ -1208,30 +1212,27 @@ process_embedded_commands (bfd *output_bfd, asection *sec = bfd_get_section_by_name (abfd, ".drectve"); char *s; char *e; - char *copy; + bfd_byte *copy; if (!sec) return 1; - copy = bfd_malloc (sec->_raw_size); - if (!copy) - return 0; - - if (! bfd_get_section_contents (abfd, sec, copy, (bfd_vma) 0, sec->_raw_size)) + if (!bfd_malloc_and_get_section (abfd, sec, ©)) { - free (copy); + if (copy != NULL) + free (copy); return 0; } - e = copy + sec->_raw_size; + e = (char *) copy + sec->size; - for (s = copy; s < e ; ) + for (s = (char *) copy; s < e ; ) { - if (s[0]!= '-') + if (s[0] != '-') { s++; continue; } - if (strncmp (s,"-attr", 5) == 0) + if (strncmp (s, "-attr", 5) == 0) { char *name; char *attribs; @@ -1346,9 +1347,6 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *finfo, bfd *input_bfd) { unsigned int n_tmask = coff_data (input_bfd)->local_n_tmask; unsigned int n_btshft = coff_data (input_bfd)->local_n_btshft; -#if 0 - unsigned int n_btmask = coff_data (input_bfd)->local_n_btmask; -#endif bfd_boolean (*adjust_symndx) (bfd *, struct bfd_link_info *, bfd *, asection *, struct internal_reloc *, bfd_boolean *); @@ -1977,7 +1975,8 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *finfo, bfd *input_bfd) auxp->x_file.x_n.x_offset = STRING_SIZE_SIZE + indx; } } - else if (isymp->n_sclass != C_STAT || isymp->n_type != T_NULL) + else if ((isymp->n_sclass != C_STAT || isymp->n_type != T_NULL) + && isymp->n_sclass != C_NT_WEAK) { unsigned long indx; @@ -2283,16 +2282,18 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *finfo, bfd *input_bfd) /* This section was omitted from the link. */ continue; + if ((o->flags & SEC_LINKER_CREATED) != 0) + continue; + if ((o->flags & SEC_HAS_CONTENTS) == 0 - || (o->_raw_size == 0 && (o->flags & SEC_RELOC) == 0)) + || (o->size == 0 && (o->flags & SEC_RELOC) == 0)) { if ((o->flags & SEC_RELOC) != 0 && o->reloc_count != 0) { - ((*_bfd_error_handler) - (_("%s: relocs in section `%s', but it has no contents"), - bfd_archive_filename (input_bfd), - bfd_get_section_name (input_bfd, o))); + (*_bfd_error_handler) + (_("%B: relocs in section `%A', but it has no contents"), + input_bfd, o); bfd_set_error (bfd_error_no_contents); return FALSE; } @@ -2305,8 +2306,8 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *finfo, bfd *input_bfd) contents = secdata->contents; else { - if (! bfd_get_section_contents (input_bfd, o, finfo->contents, - (file_ptr) 0, o->_raw_size)) + bfd_size_type x = o->rawsize ? o->rawsize : o->size; + if (! bfd_get_section_contents (input_bfd, o, finfo->contents, 0, x)) return FALSE; contents = finfo->contents; } @@ -2431,10 +2432,8 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *finfo, bfd *input_bfd) if (secdata == NULL || secdata->stab_info == NULL) { file_ptr loc = o->output_offset * bfd_octets_per_byte (output_bfd); - bfd_size_type amt = (o->_cooked_size != 0 - ? o->_cooked_size : o->_raw_size); if (! bfd_set_section_contents (output_bfd, o->output_section, - contents, loc, amt)) + contents, loc, o->size)) return FALSE; } else @@ -2616,9 +2615,7 @@ _bfd_coff_write_global_sym (struct coff_link_hash_entry *h, void *data) sec = h->root.u.def.section->output_section; if (sec != NULL) { - auxp->x_scn.x_scnlen = (sec->_cooked_size != 0 - ? sec->_cooked_size - : sec->_raw_size); + auxp->x_scn.x_scnlen = sec->size; /* For PE, an overflow on the final link reportedly does not matter. FIXME: Why not? */ @@ -2738,7 +2735,7 @@ _bfd_coff_reloc_link_order (bfd *output_bfd, abort (); case bfd_reloc_overflow: if (! ((*finfo->info->callbacks->reloc_overflow) - (finfo->info, + (finfo->info, NULL, (link_order->type == bfd_section_reloc_link_order ? bfd_section_name (output_bfd, link_order->u.reloc.p->u.section) @@ -2863,8 +2860,7 @@ _bfd_coff_generic_relocate_section (bfd *output_bfd, || (unsigned long) symndx >= obj_raw_syment_count (input_bfd)) { (*_bfd_error_handler) - ("%s: illegal symbol index %ld in relocs", - bfd_archive_filename (input_bfd), symndx); + ("%B: illegal symbol index %ld in relocs", input_bfd, symndx); return FALSE; } else @@ -2925,16 +2921,50 @@ _bfd_coff_generic_relocate_section (bfd *output_bfd, if (h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak) { + /* Defined weak symbols are a GNU extension. */ asection *sec; sec = h->root.u.def.section; val = (h->root.u.def.value + sec->output_section->vma + sec->output_offset); - } + } else if (h->root.type == bfd_link_hash_undefweak) - val = 0; + { + if (h->class == C_NT_WEAK && h->numaux == 1) + { + /* See _Microsoft Portable Executable and Common Object + File Format Specification_, section 5.5.3. + Note that weak symbols without aux records are a GNU + extension. + FIXME: All weak externals are treated as having + characteristic IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY (1). + These behave as per SVR4 ABI: A library member + will resolve a weak external only if a normal + external causes the library member to be linked. + See also linker.c: generic_link_check_archive_element. */ + asection *sec; + struct coff_link_hash_entry *h2 = + input_bfd->tdata.coff_obj_data->sym_hashes[ + h->aux->x_sym.x_tagndx.l]; + + if (!h2 || h2->root.type == bfd_link_hash_undefined) + { + sec = bfd_abs_section_ptr; + val = 0; + } + else + { + sec = h2->root.u.def.section; + val = h2->root.u.def.value + + sec->output_section->vma + sec->output_offset; + } + } + else + /* This is a GNU extension. */ + val = 0; + } else if (! info->relocatable) { @@ -2984,10 +3014,8 @@ _bfd_coff_generic_relocate_section (bfd *output_bfd, break; case bfd_reloc_outofrange: (*_bfd_error_handler) - (_("%s: bad reloc address 0x%lx in section `%s'"), - bfd_archive_filename (input_bfd), - (unsigned long) rel->r_vaddr, - bfd_get_section_name (input_bfd, input_section)); + (_("%B: bad reloc address 0x%lx in section `%A'"), + input_bfd, input_section, (unsigned long) rel->r_vaddr); return FALSE; case bfd_reloc_overflow: { @@ -2997,7 +3025,7 @@ _bfd_coff_generic_relocate_section (bfd *output_bfd, if (symndx == -1) name = "*ABS*"; else if (h != NULL) - name = h->root.root.string; + name = NULL; else { name = _bfd_coff_internal_syment_name (input_bfd, sym, buf); @@ -3006,8 +3034,9 @@ _bfd_coff_generic_relocate_section (bfd *output_bfd, } if (! ((*info->callbacks->reloc_overflow) - (info, name, howto->name, (bfd_vma) 0, input_bfd, - input_section, rel->r_vaddr - input_section->vma))) + (info, (h ? &h->root : NULL), name, howto->name, + (bfd_vma) 0, input_bfd, input_section, + rel->r_vaddr - input_section->vma))) return FALSE; } } diff --git a/contrib/binutils/bfd/coffswap.h b/contrib/binutils/bfd/coffswap.h index 5f23ecc07b3..f0af329daea 100644 --- a/contrib/binutils/bfd/coffswap.h +++ b/contrib/binutils/bfd/coffswap.h @@ -1,6 +1,6 @@ /* Generic COFF swapping routines, for BFD. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000, - 2001, 2002 + 2001, 2002, 2005 Free Software Foundation, Inc. Written by Cygnus Support. @@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* This file contains routines used to swap COFF data. It is a header file because the details of swapping depend on the details of the @@ -210,41 +210,17 @@ #define PUT_RELOC_VADDR H_PUT_32 #endif -static void coff_swap_aouthdr_in PARAMS ((bfd *, PTR, PTR)); -static unsigned int coff_swap_aouthdr_out PARAMS ((bfd *, PTR, PTR)); -static void coff_swap_scnhdr_in PARAMS ((bfd *, PTR, PTR)); -static unsigned int coff_swap_scnhdr_out PARAMS ((bfd *, PTR, PTR)); -static void coff_swap_filehdr_in PARAMS ((bfd *, PTR, PTR)); -static unsigned int coff_swap_filehdr_out PARAMS ((bfd *, PTR, PTR)); -#ifndef NO_COFF_RELOCS -static void coff_swap_reloc_in PARAMS ((bfd *, PTR, PTR)); -static unsigned int coff_swap_reloc_out PARAMS ((bfd *, PTR, PTR)); -#endif /* NO_COFF_RELOCS */ -#ifndef NO_COFF_SYMBOLS -static void coff_swap_sym_in PARAMS ((bfd *, PTR, PTR)); -static unsigned int coff_swap_sym_out PARAMS ((bfd *, PTR, PTR)); -static void coff_swap_aux_in PARAMS ((bfd *, PTR, int, int, int, int, PTR)); -static unsigned int coff_swap_aux_out PARAMS ((bfd *, PTR, int, int, int, int, PTR)); -#endif /* NO_COFF_SYMBOLS */ -#ifndef NO_COFF_LINENOS -static void coff_swap_lineno_in PARAMS ((bfd *, PTR, PTR)); -static unsigned int coff_swap_lineno_out PARAMS ((bfd *, PTR, PTR)); -#endif /* NO_COFF_LINENOS */ - #ifndef NO_COFF_RELOCS static void -coff_swap_reloc_in (abfd, src, dst) - bfd *abfd; - PTR src; - PTR dst; +coff_swap_reloc_in (bfd * abfd, void * src, void * dst) { RELOC *reloc_src = (RELOC *) src; struct internal_reloc *reloc_dst = (struct internal_reloc *) dst; - reloc_dst->r_vaddr = GET_RELOC_VADDR (abfd, reloc_src->r_vaddr); + reloc_dst->r_vaddr = GET_RELOC_VADDR (abfd, reloc_src->r_vaddr); reloc_dst->r_symndx = H_GET_S32 (abfd, reloc_src->r_symndx); - reloc_dst->r_type = H_GET_16 (abfd, reloc_src->r_type); + reloc_dst->r_type = H_GET_16 (abfd, reloc_src->r_type); #ifdef SWAP_IN_RELOC_OFFSET reloc_dst->r_offset = SWAP_IN_RELOC_OFFSET (abfd, reloc_src->r_offset); @@ -252,13 +228,11 @@ coff_swap_reloc_in (abfd, src, dst) } static unsigned int -coff_swap_reloc_out (abfd, src, dst) - bfd *abfd; - PTR src; - PTR dst; +coff_swap_reloc_out (bfd * abfd, void * src, void * dst) { struct internal_reloc *reloc_src = (struct internal_reloc *) src; struct external_reloc *reloc_dst = (struct external_reloc *) dst; + PUT_RELOC_VADDR (abfd, reloc_src->r_vaddr, reloc_dst->r_vaddr); H_PUT_32 (abfd, reloc_src->r_symndx, reloc_dst->r_symndx); H_PUT_16 (abfd, reloc_src->r_type, reloc_dst->r_type); @@ -276,10 +250,7 @@ coff_swap_reloc_out (abfd, src, dst) #endif /* NO_COFF_RELOCS */ static void -coff_swap_filehdr_in (abfd, src, dst) - bfd *abfd; - PTR src; - PTR dst; +coff_swap_filehdr_in (bfd * abfd, void * src, void * dst) { FILHDR *filehdr_src = (FILHDR *) src; struct internal_filehdr *filehdr_dst = (struct internal_filehdr *) dst; @@ -287,13 +258,13 @@ coff_swap_filehdr_in (abfd, src, dst) #ifdef COFF_ADJUST_FILEHDR_IN_PRE COFF_ADJUST_FILEHDR_IN_PRE (abfd, src, dst); #endif - filehdr_dst->f_magic = H_GET_16 (abfd, filehdr_src->f_magic); - filehdr_dst->f_nscns = H_GET_16 (abfd, filehdr_src->f_nscns); + filehdr_dst->f_magic = H_GET_16 (abfd, filehdr_src->f_magic); + filehdr_dst->f_nscns = H_GET_16 (abfd, filehdr_src->f_nscns); filehdr_dst->f_timdat = H_GET_32 (abfd, filehdr_src->f_timdat); filehdr_dst->f_symptr = GET_FILEHDR_SYMPTR (abfd, filehdr_src->f_symptr); - filehdr_dst->f_nsyms = H_GET_32 (abfd, filehdr_src->f_nsyms); + filehdr_dst->f_nsyms = H_GET_32 (abfd, filehdr_src->f_nsyms); filehdr_dst->f_opthdr = H_GET_16 (abfd, filehdr_src->f_opthdr); - filehdr_dst->f_flags = H_GET_16 (abfd, filehdr_src->f_flags); + filehdr_dst->f_flags = H_GET_16 (abfd, filehdr_src->f_flags); #ifdef TIC80_TARGET_ID filehdr_dst->f_target_id = H_GET_16 (abfd, filehdr_src->f_target_id); #endif @@ -304,10 +275,7 @@ coff_swap_filehdr_in (abfd, src, dst) } static unsigned int -coff_swap_filehdr_out (abfd, in, out) - bfd *abfd; - PTR in; - PTR out; +coff_swap_filehdr_out (bfd *abfd, void * in, void * out) { struct internal_filehdr *filehdr_in = (struct internal_filehdr *) in; FILHDR *filehdr_out = (FILHDR *) out; @@ -335,10 +303,7 @@ coff_swap_filehdr_out (abfd, in, out) #ifndef NO_COFF_SYMBOLS static void -coff_swap_sym_in (abfd, ext1, in1) - bfd *abfd; - PTR ext1; - PTR in1; +coff_swap_sym_in (bfd * abfd, void * ext1, void * in1) { SYMENT *ext = (SYMENT *) ext1; struct internal_syment *in = (struct internal_syment *) in1; @@ -351,21 +316,18 @@ coff_swap_sym_in (abfd, ext1, in1) else { #if SYMNMLEN != E_SYMNMLEN - -> Error, we need to cope with truncating or extending SYMNMLEN!; +#error we need to cope with truncating or extending SYMNMLEN #else memcpy (in->_n._n_name, ext->e.e_name, SYMNMLEN); #endif } + in->n_value = H_GET_32 (abfd, ext->e_value); in->n_scnum = H_GET_16 (abfd, ext->e_scnum); if (sizeof (ext->e_type) == 2) - { - in->n_type = H_GET_16 (abfd, ext->e_type); - } + in->n_type = H_GET_16 (abfd, ext->e_type); else - { - in->n_type = H_GET_32 (abfd, ext->e_type); - } + in->n_type = H_GET_32 (abfd, ext->e_type); in->n_sclass = H_GET_8 (abfd, ext->e_sclass); in->n_numaux = H_GET_8 (abfd, ext->e_numaux); #ifdef COFF_ADJUST_SYM_IN_POST @@ -374,10 +336,7 @@ coff_swap_sym_in (abfd, ext1, in1) } static unsigned int -coff_swap_sym_out (abfd, inp, extp) - bfd *abfd; - PTR inp; - PTR extp; +coff_swap_sym_out (bfd * abfd, void * inp, void * extp) { struct internal_syment *in = (struct internal_syment *) inp; SYMENT *ext =(SYMENT *) extp; @@ -394,7 +353,7 @@ coff_swap_sym_out (abfd, inp, extp) else { #if SYMNMLEN != E_SYMNMLEN - -> Error, we need to cope with truncating or extending SYMNMLEN!; +#error we need to cope with truncating or extending SYMNMLEN #else memcpy (ext->e.e_name, in->_n._n_name, SYMNMLEN); #endif @@ -404,13 +363,9 @@ coff_swap_sym_out (abfd, inp, extp) H_PUT_16 (abfd, in->n_scnum, ext->e_scnum); if (sizeof (ext->e_type) == 2) - { - H_PUT_16 (abfd, in->n_type, ext->e_type); - } + H_PUT_16 (abfd, in->n_type, ext->e_type); else - { - H_PUT_32 (abfd, in->n_type, ext->e_type); - } + H_PUT_32 (abfd, in->n_type, ext->e_type); H_PUT_8 (abfd, in->n_sclass, ext->e_sclass); H_PUT_8 (abfd, in->n_numaux, ext->e_numaux); @@ -423,14 +378,13 @@ coff_swap_sym_out (abfd, inp, extp) } static void -coff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1) - bfd *abfd; - PTR ext1; - int type; - int class; - int indx; - int numaux; - PTR in1; +coff_swap_aux_in (bfd *abfd, + void * ext1, + int type, + int class, + int indx, + int numaux, + void * in1) { AUXENT *ext = (AUXENT *) ext1; union internal_auxent *in = (union internal_auxent *) in1; @@ -450,7 +404,7 @@ coff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1) else { #if FILNMLEN != E_FILNMLEN - -> Error, we need to cope with truncating or extending FILNMLEN!; +#error we need to cope with truncating or extending FILNMLEN #else if (numaux > 1) { @@ -512,9 +466,7 @@ coff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1) } if (ISFCN (type)) - { - in->x_sym.x_misc.x_fsize = H_GET_32 (abfd, ext->x_sym.x_misc.x_fsize); - } + in->x_sym.x_misc.x_fsize = H_GET_32 (abfd, ext->x_sym.x_misc.x_fsize); else { in->x_sym.x_misc.x_lnsz.x_lnno = GET_LNSZ_LNNO (abfd, ext); @@ -529,23 +481,22 @@ coff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1) } static unsigned int -coff_swap_aux_out (abfd, inp, type, class, indx, numaux, extp) - bfd *abfd; - PTR inp; - int type; - int class; - int indx ATTRIBUTE_UNUSED; - int numaux ATTRIBUTE_UNUSED; - PTR extp; +coff_swap_aux_out (bfd * abfd, + void * inp, + int type, + int class, + int indx ATTRIBUTE_UNUSED, + int numaux ATTRIBUTE_UNUSED, + void * extp) { - union internal_auxent *in = (union internal_auxent *) inp; + union internal_auxent * in = (union internal_auxent *) inp; AUXENT *ext = (AUXENT *) extp; #ifdef COFF_ADJUST_AUX_OUT_PRE COFF_ADJUST_AUX_OUT_PRE (abfd, inp, type, class, indx, numaux, extp); #endif - memset ((PTR)ext, 0, AUXESZ); + memset (ext, 0, AUXESZ); switch (class) { @@ -558,7 +509,7 @@ coff_swap_aux_out (abfd, inp, type, class, indx, numaux, extp) else { #if FILNMLEN != E_FILNMLEN - -> Error, we need to cope with truncating or extending FILNMLEN!; +#error we need to cope with truncating or extending FILNMLEN #else memcpy (ext->x_file.x_fname, in->x_file.x_fname, FILNMLEN); #endif @@ -625,10 +576,7 @@ coff_swap_aux_out (abfd, inp, type, class, indx, numaux, extp) #ifndef NO_COFF_LINENOS static void -coff_swap_lineno_in (abfd, ext1, in1) - bfd *abfd; - PTR ext1; - PTR in1; +coff_swap_lineno_in (bfd * abfd, void * ext1, void * in1) { LINENO *ext = (LINENO *) ext1; struct internal_lineno *in = (struct internal_lineno *) in1; @@ -638,10 +586,7 @@ coff_swap_lineno_in (abfd, ext1, in1) } static unsigned int -coff_swap_lineno_out (abfd, inp, outp) - bfd *abfd; - PTR inp; - PTR outp; +coff_swap_lineno_out (bfd * abfd, void * inp, void * outp) { struct internal_lineno *in = (struct internal_lineno *) inp; struct external_lineno *ext = (struct external_lineno *) outp; @@ -654,10 +599,7 @@ coff_swap_lineno_out (abfd, inp, outp) #endif /* NO_COFF_LINENOS */ static void -coff_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1) - bfd *abfd; - PTR aouthdr_ext1; - PTR aouthdr_int1; +coff_swap_aouthdr_in (bfd * abfd, void * aouthdr_ext1, void * aouthdr_int1) { AOUTHDR *aouthdr_ext; struct internal_aouthdr *aouthdr_int; @@ -730,10 +672,7 @@ coff_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1) } static unsigned int -coff_swap_aouthdr_out (abfd, in, out) - bfd *abfd; - PTR in; - PTR out; +coff_swap_aouthdr_out (bfd * abfd, void * in, void * out) { struct internal_aouthdr *aouthdr_in = (struct internal_aouthdr *) in; AOUTHDR *aouthdr_out = (AOUTHDR *) out; @@ -807,10 +746,7 @@ coff_swap_aouthdr_out (abfd, in, out) } static void -coff_swap_scnhdr_in (abfd, ext, in) - bfd *abfd; - PTR ext; - PTR in; +coff_swap_scnhdr_in (bfd * abfd, void * ext, void * in) { SCNHDR *scnhdr_ext = (SCNHDR *) ext; struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in; @@ -839,10 +775,7 @@ coff_swap_scnhdr_in (abfd, ext, in) } static unsigned int -coff_swap_scnhdr_out (abfd, in, out) - bfd *abfd; - PTR in; - PTR out; +coff_swap_scnhdr_out (bfd * abfd, void * in, void * out) { struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in; SCNHDR *scnhdr_ext = (SCNHDR *) out; diff --git a/contrib/binutils/bfd/config.bfd b/contrib/binutils/bfd/config.bfd index 2b06abee91d..b112f4b656f 100755 --- a/contrib/binutils/bfd/config.bfd +++ b/contrib/binutils/bfd/config.bfd @@ -31,8 +31,13 @@ targ_underscore=no # Catch obsolete configurations. case $targ in - vax-*-vms* \ - ) + m68*-apple-aux* | \ + m68*-apollo-* | \ + m68*-bull-sysv* | \ + m68*-*-rtemscoff* | \ + i960-*-rtems* | \ + or32-*-rtems* | \ + null) if test "x$enable_obsolete" != xyes; then echo "*** Configuration $targ is obsolete." >&2 echo "*** Specify --enable-obsolete to build it anyway." >&2 @@ -42,40 +47,64 @@ case $targ in fi;; esac +case $targ in + m68*-*-lynxos* | \ + sparc-*-lynxos* | \ + vax-*-vms* | \ + arm-*-oabi | \ + thumb-*-oabi | \ + a29k-* | \ + hppa*-*-rtems* | \ + *-go32-rtems* | \ + i[3-7]86*-*-rtemscoff* | \ + mips*el-*-rtems* | \ + powerpcle-*-rtems* | \ + sparc*-*-rtemsaout* | \ + null) + echo "*** Configuration $targ is obsolete." >&2 + echo "*** Support has been REMOVED." >&2 + exit 1 + ;; +esac targ_cpu=`echo $targ | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` case "${targ_cpu}" in -alpha*) targ_archs=bfd_alpha_arch ;; -arm*) targ_archs=bfd_arm_arch ;; -c30*) targ_archs=bfd_tic30_arch ;; -c4x*) targ_archs=bfd_tic4x_arch ;; -c54x*) targ_archs=bfd_tic54x_arch ;; +alpha*) targ_archs=bfd_alpha_arch ;; +arm*) targ_archs=bfd_arm_arch ;; +bfin*) targ_archs=bfd_bfin_arch ;; +c30*) targ_archs=bfd_tic30_arch ;; +c4x*) targ_archs=bfd_tic4x_arch ;; +c54x*) targ_archs=bfd_tic54x_arch ;; +crisv32) targ_archs=bfd_cris_arch ;; +crx*) targ_archs=bfd_crx_arch ;; dlx*) targ_archs=bfd_dlx_arch ;; -hppa*) targ_archs=bfd_hppa_arch ;; -i[3-7]86) targ_archs=bfd_i386_arch ;; -i370) targ_archs=bfd_i370_arch ;; +hppa*) targ_archs=bfd_hppa_arch ;; +i[3-7]86) targ_archs=bfd_i386_arch ;; +i370) targ_archs=bfd_i370_arch ;; m6811*|m68hc11*) targ_archs="bfd_m68hc11_arch bfd_m68hc12_arch" ;; m6812*|m68hc12*) targ_archs="bfd_m68hc12_arch bfd_m68hc11_arch" ;; -m68*) targ_archs=bfd_m68k_arch ;; -m88*) targ_archs=bfd_m88k_arch ;; -mips*) targ_archs=bfd_mips_arch ;; +m68*) targ_archs=bfd_m68k_arch ;; +m88*) targ_archs=bfd_m88k_arch ;; +maxq*) targ_archs=bfd_maxq_arch ;; +mips*) targ_archs=bfd_mips_arch ;; or32*) targ_archs=bfd_or32_arch ;; -pdp11*) targ_archs=bfd_pdp11_arch ;; -pj*) targ_archs="bfd_pj_arch bfd_i386_arch";; -powerpc*) targ_archs="bfd_rs6000_arch bfd_powerpc_arch" ;; -rs6000) targ_archs="bfd_rs6000_arch bfd_powerpc_arch" ;; -s390*) targ_archs=bfd_s390_arch ;; -sh*) targ_archs=bfd_sh_arch ;; -sparc*) targ_archs=bfd_sparc_arch ;; -strongarm*) targ_archs=bfd_arm_arch ;; -thumb*) targ_archs=bfd_arm_arch ;; -v850*) targ_archs=bfd_v850_arch ;; -x86_64) targ_archs=bfd_i386_arch ;; -xscale*) targ_archs=bfd_arm_arch ;; -xtensa*) targ_archs=bfd_xtensa_arch ;; -z8k*) targ_archs=bfd_z8k_arch ;; -am33_2.0) targ_archs=bfd_mn10300_arch ;; -*) targ_archs=bfd_${targ_cpu}_arch ;; +pdp11*) targ_archs=bfd_pdp11_arch ;; +pj*) targ_archs="bfd_pj_arch bfd_i386_arch";; +powerpc*) targ_archs="bfd_rs6000_arch bfd_powerpc_arch" ;; +rs6000) targ_archs="bfd_rs6000_arch bfd_powerpc_arch" ;; +s390*) targ_archs=bfd_s390_arch ;; +sh*) targ_archs=bfd_sh_arch ;; +sparc*) targ_archs=bfd_sparc_arch ;; +strongarm*) targ_archs=bfd_arm_arch ;; +thumb*) targ_archs=bfd_arm_arch ;; +v850*) targ_archs=bfd_v850_arch ;; +x86_64) targ_archs=bfd_i386_arch ;; +xscale*) targ_archs=bfd_arm_arch ;; +xtensa*) targ_archs=bfd_xtensa_arch ;; +z80|r800) targ_archs=bfd_z80_arch ;; +z8k*) targ_archs=bfd_z8k_arch ;; +am33_2.0) targ_archs=bfd_mn10300_arch ;; +*) targ_archs=bfd_${targ_cpu}_arch ;; esac @@ -126,7 +155,7 @@ case "${targ}" in targ_defvec=ecoffalpha_little_vec targ_selvecs=bfd_elf64_alpha_vec ;; - alpha*-*-linux-gnu* | alpha*-*-elf*) + alpha*-*-linux-* | alpha*-*-elf*) targ_defvec=bfd_elf64_alpha_vec targ_selvecs=ecoffalpha_little_vec ;; @@ -136,7 +165,7 @@ case "${targ}" in alpha*-*-*) targ_defvec=ecoffalpha_little_vec ;; - ia64*-*-freebsd* | ia64*-*-netbsd* | ia64*-*-linux-gnu* | ia64*-*-elf* | ia64*-*-kfreebsd*-gnu) + ia64*-*-freebsd* | ia64*-*-netbsd* | ia64*-*-linux-* | ia64*-*-elf* | ia64*-*-kfreebsd*-gnu) targ_defvec=bfd_elf64_ia64_little_vec targ_selvecs="bfd_elf64_ia64_big_vec bfd_efi_app_ia64_vec" ;; @@ -213,7 +242,7 @@ case "${targ}" in targ_defvec=bfd_elf32_littlearm_vec targ_selvecs=bfd_elf32_bigarm_vec ;; - armeb-*-elf | arm*b-*-linux-gnu*) + armeb-*-elf | arm*b-*-linux-*) targ_defvec=bfd_elf32_bigarm_vec targ_selvecs=bfd_elf32_littlearm_vec ;; @@ -225,29 +254,30 @@ case "${targ}" in targ_defvec=bfd_elf32_bigarm_vec targ_selvecs=bfd_elf32_littlearm_vec ;; - arm-*-elf | arm-*-freebsd* | arm*-*-linux-gnu* | arm*-*-conix* | \ - arm*-*-uclinux* | arm-*-kfreebsd*-gnu | arm-*-vxworks) + arm-*-elf | arm-*-freebsd* | arm*-*-linux-* | arm*-*-conix* | \ + arm*-*-uclinux* | arm-*-kfreebsd*-gnu | \ + arm*-*-eabi* ) targ_defvec=bfd_elf32_littlearm_vec targ_selvecs=bfd_elf32_bigarm_vec ;; + arm*-*-vxworks | arm*-*-windiss) + targ_defvec=bfd_elf32_littlearm_vxworks_vec + targ_selvecs=bfd_elf32_bigarm_vxworks_vec + ;; + arm*-*-symbianelf*) + targ_defvec=bfd_elf32_littlearm_symbian_vec + targ_selvecs=bfd_elf32_bigarm_symbian_vec + ;; arm9e-*-elf) targ_defvec=bfd_elf32_littlearm_vec targ_selvecs=bfd_elf32_bigarm_vec ;; - arm-*-oabi) - targ_defvec=bfd_elf32_littlearm_oabi_vec - targ_selvecs=bfd_elf32_bigarm_oabi_vec - ;; thumb-*-coff) targ_defvec=armcoff_little_vec targ_selvecs=armcoff_big_vec targ_underscore=yes ;; - thumb-*-oabi) - targ_defvec=bfd_elf32_littlearm_oabi_vec - targ_selvecs=bfd_elf32_bigarm_oabi_vec - ;; thumb-*-elf) targ_defvec=bfd_elf32_littlearm_vec targ_selvecs=bfd_elf32_bigarm_vec @@ -281,21 +311,16 @@ case "${targ}" in targ_underscore=yes ;; - a29k-*-ebmon* | a29k-*-udi* | a29k-*-coff* | a29k-*-sym1* | \ - a29k-*-vxworks* | a29k-*-sysv* | a29k-*rtems*) - targ_defvec=a29kcoff_big_vec - targ_selvecs=sunos_big_vec - targ_underscore=yes - ;; - a29k-*-aout* | a29k-*-bsd* | a29k-*-vsta*) - targ_defvec=sunos_big_vec - targ_underscore=yes - ;; - avr-*-*) targ_defvec=bfd_elf32_avr_vec ;; + bfin-*-*) + targ_defvec=bfd_elf32_bfin_vec + targ_selvecs=bfd_elf32_bfinfdpic_vec + targ_underscore=yes + ;; + c30-*-*aout* | tic30-*-*aout*) targ_defvec=tic30_aout_vec ;; @@ -315,12 +340,22 @@ case "${targ}" in targ_underscore=yes ;; - cris-*-*) + cr16c-*-elf*) + targ_defvec=bfd_elf32_cr16c_vec + targ_underscore=yes + ;; + + cris-*-* | crisv32-*-*) targ_defvec=cris_aout_vec targ_selvecs="bfd_elf32_us_cris_vec bfd_elf32_cris_vec ieee_vec" targ_underscore=yes # Note: not true for bfd_elf32_cris_vec. ;; + crx-*-elf*) + targ_defvec=bfd_elf32_crx_vec + targ_underscore=yes + ;; + d10v-*-*) targ_defvec=bfd_elf32_d10v_vec ;; @@ -348,7 +383,12 @@ case "${targ}" in targ_selvecs=bfd_elf32_frv_vec ;; - h8300*-*-elf) + h8300*-*-rtemscoff*) + targ_defvec=h8300coff_vec + targ_underscore=yes + ;; + + h8300*-*-elf | h8300*-*-rtems*) targ_defvec=bfd_elf32_h8300_vec targ_underscore=yes ;; @@ -364,7 +404,7 @@ case "${targ}" in ;; #ifdef BFD64 - hppa*64*-*-linux-gnu*) + hppa*64*-*-linux-*) targ_defvec=bfd_elf64_hppa_linux_vec targ_selvecs=bfd_elf64_hppa_vec ;; @@ -375,7 +415,7 @@ case "${targ}" in ;; #endif - hppa*-*-linux-gnu*) + hppa*-*-linux-*) targ_defvec=bfd_elf32_hppa_linux_vec targ_selvecs=bfd_elf32_hppa_vec ;; @@ -383,7 +423,7 @@ case "${targ}" in targ_defvec=bfd_elf32_hppa_nbsd_vec targ_selvecs="bfd_elf32_hppa_vec bfd_elf32_hppa_linux_vec" ;; - hppa*-*-*elf* | hppa*-*-lites* | hppa*-*-sysv4* | hppa*-*-rtems* | hppa*-*-openbsd*) + hppa*-*-*elf* | hppa*-*-lites* | hppa*-*-sysv4* | hppa*-*-openbsd*) targ_defvec=bfd_elf32_hppa_vec targ_selvecs=bfd_elf32_hppa_linux_vec ;; @@ -402,7 +442,7 @@ case "${targ}" in ;; #endif /* defined (HOST_HPPAHPUX) || defined (HOST_HPPABSD) || defined (HOST_HPPAOSF) */ - i370-*-*) + i370-*-*) targ_defvec=bfd_elf32_i370_vec targ_selvecs="bfd_elf32_i370_vec" ;; @@ -410,12 +450,18 @@ case "${targ}" in targ_defvec=i386coff_vec targ_selvecs=bfd_elf32_i386_vec ;; - i[3-7]86-*-sysv4* | i[3-7]86-*-unixware* | i[3-7]86-*-solaris2* | \ + i[3-7]86-*-sysv4* | i[3-7]86-*-unixware* | \ i[3-7]86-*-elf | i[3-7]86-*-sco3.2v5* | \ i[3-7]86-*-dgux* | i[3-7]86-*-sysv5*) targ_defvec=bfd_elf32_i386_vec targ_selvecs=i386coff_vec ;; + i[3-7]86-*-solaris2*) + targ_defvec=bfd_elf32_i386_vec + targ_selvecs=i386coff_vec + targ64_selvecs=bfd_elf64_x86_64_vec + want64=true + ;; i[3-7]86-*-kaos*) targ_defvec=bfd_elf32_i386_vec targ_selvecs=bfd_elf32_i386_vec @@ -430,7 +476,7 @@ case "${targ}" in i[3-7]86-*-chorus*) targ_defvec=bfd_elf32_i386_vec ;; - *-*-msdosdjgpp* | *-*-go32* | *-go32-rtems* ) + *-*-msdosdjgpp* | *-*-go32* ) targ_defvec=go32coff_vec targ_selvecs="go32stubbedcoff_vec i386aout_vec" ;; @@ -438,11 +484,7 @@ case "${targ}" in i[3-7]86-*-aix*) targ_defvec=i386coff_vec ;; - i[3-7]86*-*-rtemscoff*) - targ_defvec=i386coff_vec - targ_selvecs="bfd_elf32_i386_vec i386aout_vec" - ;; - i[3-7]86-*-rtemself* | i[3-7]86-*-rtems*) + i[3-7]86-*-rtems*) targ_defvec=bfd_elf32_i386_vec targ_selvecs="i386coff_vec i386aout_vec" ;; @@ -489,7 +531,7 @@ case "${targ}" in targ_selvecs="bfd_elf32_i386_vec i386bsd_vec" targ_underscore=yes ;; - i[3-7]86-*-openbsd*) + i[3-7]86-*-openbsd*) targ_defvec=bfd_elf32_i386_vec targ_selvecs=i386netbsd_vec ;; @@ -502,12 +544,16 @@ case "${targ}" in targ_selvecs=bfd_elf32_i386_vec targ_underscore=yes ;; - i[3-7]86-*-linux-gnu*) + i[3-7]86-*-linux-*) targ_defvec=bfd_elf32_i386_vec targ_selvecs="i386linux_vec bfd_efi_app_ia32_vec" targ64_selvecs=bfd_elf64_x86_64_vec ;; #ifdef BFD64 + x86_64-*-elf*) + targ_defvec=bfd_elf64_x86_64_vec + targ_selvecs="bfd_elf32_i386_vec i386coff_vec" + ;; x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu) targ_defvec=bfd_elf64_x86_64_vec targ_selvecs="bfd_elf32_i386_vec i386coff_vec bfd_efi_app_ia32_vec" @@ -516,14 +562,14 @@ case "${targ}" in targ_defvec=bfd_elf64_x86_64_vec targ_selvecs="bfd_elf32_i386_vec i386netbsd_vec i386coff_vec bfd_efi_app_ia32_vec" ;; - x86_64-*-linux-gnu*) + x86_64-*-linux-*) targ_defvec=bfd_elf64_x86_64_vec targ_selvecs="bfd_elf32_i386_vec i386linux_vec bfd_efi_app_ia32_vec" ;; #endif i[3-7]86-*-lynxos*) - targ_defvec=i386lynx_coff_vec - targ_selvecs=i386lynx_aout_vec + targ_defvec=bfd_elf32_i386_vec + targ_selvecs="i386lynx_coff_vec i386lynx_aout_vec" ;; i[3-7]86-*-gnu*) targ_defvec=bfd_elf32_i386_vec @@ -558,9 +604,14 @@ case "${targ}" in # FIXME: This should eventually be checked at runtime. targ_cflags=-DSTRICT_PE_FORMAT ;; + i[3-7]86-*-rdos*) + targ_defvec=bfd_elf32_i386_vec + targ_selvecs=i386coff_vec + ;; i[3-7]86-*-mingw32* | i[3-7]86-*-cygwin* | i[3-7]86-*-winnt | i[3-7]86-*-pe) targ_defvec=i386pe_vec targ_selvecs="i386pe_vec i386pei_vec bfd_elf32_i386_vec" + targ_underscore=yes ;; i[3-7]86-none-*) targ_defvec=i386coff_vec @@ -568,8 +619,8 @@ case "${targ}" in i[3-7]86-*-aout* | i[3-7]86*-*-vsta*) targ_defvec=i386aout_vec ;; - i[3-7]86-*-vxworks) - targ_defvec=bfd_elf32_i386_vec + i[3-7]86-*-vxworks*) + targ_defvec=bfd_elf32_i386_vxworks_vec targ_underscore=yes ;; i[3-7]86-*-chaos) @@ -616,16 +667,20 @@ case "${targ}" in targ_defvec=bfd_elf32_iq2000_vec ;; + m32c-*-elf) + targ_defvec=bfd_elf32_m32c_vec + ;; + m32r*le-*-linux*) targ_defvec=bfd_elf32_m32rlelin_vec targ_selvecs="bfd_elf32_m32rlin_vec bfd_elf32_m32rlelin_vec" ;; - + m32r*-*-linux*) targ_defvec=bfd_elf32_m32rlin_vec targ_selvecs="bfd_elf32_m32rlin_vec bfd_elf32_m32rlelin_vec" ;; - + m32r*le-*-*) targ_defvec=bfd_elf32_m32rle_vec targ_selvecs="bfd_elf32_m32r_vec bfd_elf32_m32rle_vec" @@ -691,7 +746,7 @@ case "${targ}" in targ_selvecs=bfd_elf32_m68k_vec targ_underscore=yes ;; - m68*-*-linux-gnu*) + m68*-*-linux-*) targ_defvec=bfd_elf32_m68k_vec targ_selvecs=m68klinux_vec ;; @@ -700,16 +755,12 @@ case "${targ}" in # targ_selvecs=m68kmach3_vec # targ_cflags=-DSTAT_FOR_EXEC ;; - m68*-*-lynxos*) - targ_defvec=m68klynx_coff_vec - targ_selvecs=m68klynx_aout_vec - ;; m68*-hp*-netbsd*) targ_defvec=m68k4knetbsd_vec targ_selvecs="m68knetbsd_vec hp300bsd_vec sunos_big_vec" targ_underscore=yes ;; - m68*-*-netbsdelf*) + m68*-*-netbsdelf*) targ_defvec=bfd_elf32_m68k_vec targ_selvecs="m68knetbsd_vec m68k4knetbsd_vec hp300bsd_vec sunos_big_vec" ;; @@ -754,11 +805,19 @@ case "${targ}" in targ_defvec=m88kmach3_vec targ_cflags=-DSTAT_FOR_EXEC ;; + m88*-*-openbsd*) + targ_defvec=m88kopenbsd_vec + targ_underscore=yes + ;; m88*-*-*) targ_defvec=m88kbcs_vec targ_underscore=yes ;; + maxq-*-coff) + targ_defvec=maxqcoff_vec + ;; + mcore-*-elf) targ_defvec=bfd_elf32_mcore_big_vec targ_selvecs="bfd_elf32_mcore_big_vec bfd_elf32_mcore_little_vec" @@ -773,16 +832,16 @@ case "${targ}" in targ_selvecs=ecoff_little_vec ;; mips*el-*-netbsd*) - targ_defvec=bfd_elf32_littlemips_vec - targ_selvecs="bfd_elf32_bigmips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec ecoff_little_vec ecoff_big_vec" + targ_defvec=bfd_elf32_tradlittlemips_vec + targ_selvecs="bfd_elf32_tradbigmips_vec bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec ecoff_little_vec ecoff_big_vec" ;; mips*-*-freebsd*) targ_defvec=bfd_elf32_tradbigmips_vec targ_selvecs="bfd_elf32_tradlittlemips_vec bfd_elf32_ntradbigmisp_vec bfd_elf32_ntradlittlemips_vec bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec ecoff_big_vec ecoff_little_vec" ;; mips*-*-netbsd*) - targ_defvec=bfd_elf32_bigmips_vec - targ_selvecs="bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec ecoff_big_vec ecoff_little_vec" + targ_defvec=bfd_elf32_tradbigmips_vec + targ_selvecs="bfd_elf32_tradlittlemips_vec bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec ecoff_big_vec ecoff_little_vec" ;; mips*-dec-* | mips*el-*-ecoff*) targ_defvec=ecoff_little_vec @@ -818,7 +877,17 @@ case "${targ}" in targ_defvec=ecoff_big_vec targ_selvecs=ecoff_little_vec ;; - mips*el-*-elf* | mips*el-*-rtems* | mips*el-*-vxworks* | mips*-*-chorus*) +#ifdef BFD64 + mips*el-*-vxworks*) + targ_defvec=bfd_elf32_littlemips_vxworks_vec + targ_selvecs="bfd_elf32_littlemips_vec bfd_elf32_bigmips_vxworks_vec bfd_elf32_bigmips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec" + ;; + mips*-*-vxworks*) + targ_defvec=bfd_elf32_bigmips_vxworks_vec + targ_selvecs="bfd_elf32_bigmips_vec bfd_elf32_littlemips_vxworks_vec bfd_elf32_bigmips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec" + ;; +#endif + mips*el-*-elf* | mips*el-*-vxworks* | mips*-*-chorus*) targ_defvec=bfd_elf32_littlemips_vec targ_selvecs="bfd_elf32_bigmips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec" ;; @@ -830,6 +899,12 @@ case "${targ}" in targ_defvec=bfd_elf32_bigmips_vec targ_selvecs="bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec" ;; +#ifdef BFD64 + mips64*-*-openbsd*) + targ_defvec=bfd_elf64_tradbigmips_vec + targ_selvecs="bfd_elf32_ntradlittlemips_vec bfd_elf32_ntradbigmips_vec bfd_elf32_tradlittlemips_vec bfd_elf32_tradbigmips_vec bfd_elf64_tradlittlemips_vec" + ;; +#endif mips*el-*-openbsd*) targ_defvec=bfd_elf32_littlemips_vec targ_selvecs="bfd_elf32_bigmips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec ecoff_little_vec ecoff_big_vec" @@ -873,6 +948,10 @@ case "${targ}" in targ_underscore=yes ;; + mt-*-elf) + targ_defvec=bfd_elf32_mt_vec + ;; + msp430-*-*) targ_defvec=bfd_elf32_msp430_vec ;; @@ -890,12 +969,12 @@ case "${targ}" in targ_defvec=bfd_elf32_openrisc_vec ;; - or32-*-coff) + or32-*-coff | or32-*-rtems* ) targ_defvec=or32coff_big_vec targ_underscore=yes ;; - or32-*-elf | or32-*-rtems*) + or32-*-elf) targ_defvec=bfd_elf32_or32_big_vec ;; @@ -945,7 +1024,7 @@ case "${targ}" in targ_defvec=rs6000coff_vec targ64_selvecs=rs6000coff64_vec case "${targ}" in - *-*-aix4.[3456789]* | *-*-aix[56789]*) + *-*-aix4.[3456789]* | *-*-aix[56789]*) want64=true;; *) targ_cflags=-DSMALL_ARCHIVE;; @@ -967,8 +1046,8 @@ case "${targ}" in ;; #endif powerpc-*-*bsd* | powerpc-*-elf* | powerpc-*-sysv4* | powerpc-*-eabi* | \ - powerpc-*-solaris2* | powerpc-*-linux-gnu* | powerpc-*-rtems* | \ - powerpc-*-chorus* | powerpc-*-vxworks* | powerpc-*-windiss*) + powerpc-*-solaris2* | powerpc-*-linux-* | powerpc-*-rtems* | \ + powerpc-*-chorus*) targ_defvec=bfd_elf32_powerpc_vec targ_selvecs="rs6000coff_vec bfd_elf32_powerpcle_vec ppcboot_vec" targ64_selvecs="bfd_elf64_powerpc_vec bfd_elf64_powerpcle_vec" @@ -983,9 +1062,14 @@ case "${targ}" in targ_selvecs="mach_o_be_vec mach_o_le_vec mach_o_fat_vec pef_vec pef_xlib_vec sym_vec" targ_archs="bfd_powerpc_arch bfd_rs6000_arch bfd_i386_arch" ;; - powerpc-*-macos* | powerpc-*-mpw*) + powerpc-*-macos*) targ_defvec=pmac_xcoff_vec ;; + powerpc-*-lynxos*) + targ_defvec=bfd_elf32_powerpc_vec + targ_selvecs="rs6000coff_vec" + targ_cflags=-DSMALL_ARCHIVE + ;; powerpc-*-netware*) targ_defvec=bfd_elf32_powerpc_vec targ_selvecs="nlm32_powerpc_vec rs6000coff_vec" @@ -994,13 +1078,17 @@ case "${targ}" in targ_defvec=bfd_elf32_powerpc_vec targ_selvecs="rs6000coff_vec bfd_elf32_powerpcle_vec ppcboot_vec" ;; + powerpc-*-vxworks* | powerpc-*-windiss*) + targ_defvec=bfd_elf32_powerpc_vxworks_vec + targ_selvecs="rs6000coff_vec bfd_elf32_powerpc_vec bfd_elf32_powerpcle_vec ppcboot_vec" + targ64_selvecs="bfd_elf64_powerpc_vec bfd_elf64_powerpcle_vec" + ;; powerpcle-*-nto*) targ_defvec=bfd_elf32_powerpcle_vec targ_selvecs="rs6000coff_vec bfd_elf32_powerpc_vec ppcboot_vec" ;; powerpcle-*-elf* | powerpcle-*-sysv4* | powerpcle-*-eabi* | \ - powerpcle-*-solaris2* | powerpcle-*-linux-gnu* | powerpcle-*-vxworks* |\ - powerpcle-*-rtems*) + powerpcle-*-solaris2* | powerpcle-*-linux-* | powerpcle-*-vxworks*) targ_defvec=bfd_elf32_powerpcle_vec targ_selvecs="rs6000coff_vec bfd_elf32_powerpc_vec ppcboot_vec" targ64_selvecs="bfd_elf64_powerpc_vec bfd_elf64_powerpcle_vec" @@ -1013,12 +1101,16 @@ case "${targ}" in s390-*-linux*) targ_defvec=bfd_elf32_s390_vec targ64_selvecs=bfd_elf64_s390_vec + want64=true ;; #ifdef BFD64 s390x-*-linux*) targ_defvec=bfd_elf64_s390_vec targ_selvecs=bfd_elf32_s390_vec ;; + s390x-*-tpf*) + targ_defvec=bfd_elf64_s390_vec + ;; #endif #ifdef BFD64 @@ -1061,20 +1153,20 @@ case "${targ}" in #ifdef BFD64 sh5le-*-netbsd*) targ_defvec=bfd_elf32_sh64lnbsd_vec - targ_selvecs="bfd_elf32_sh64nbsd_vec bfd_elf64_sh64lnbsd_vec bfd_elf64_sh64nbsd_vec" + targ_selvecs="bfd_elf32_sh64nbsd_vec bfd_elf64_sh64lnbsd_vec bfd_elf64_sh64nbsd_vec bfd_elf32_shnbsd_vec bfd_elf32_shlnbsd_vec" ;; sh5-*-netbsd*) targ_defvec=bfd_elf32_sh64nbsd_vec - targ_selvecs="bfd_elf32_sh64lnbsd_vec bfd_elf64_sh64lnbsd_vec bfd_elf64_sh64nbsd_vec" + targ_selvecs="bfd_elf32_sh64lnbsd_vec bfd_elf64_sh64lnbsd_vec bfd_elf64_sh64nbsd_vec bfd_elf32_shnbsd_vec bfd_elf32_shlnbsd_vec" ;; sh64le-*-netbsd*) targ_defvec=bfd_elf64_sh64lnbsd_vec - targ_selvecs="bfd_elf64_sh64nbsd_vec bfd_elf32_sh64lnbsd_vec bfd_elf32_sh64nbsd_vec" + targ_selvecs="bfd_elf64_sh64nbsd_vec bfd_elf32_sh64lnbsd_vec bfd_elf32_sh64nbsd_vec bfd_elf32_shnbsd_vec bfd_elf32_shlnbsd_vec" ;; sh64-*-netbsd*) targ_defvec=bfd_elf64_sh64nbsd_vec - targ_selvecs="bfd_elf64_sh64lnbsd_vec bfd_elf32_sh64lnbsd_vec bfd_elf32_sh64nbsd_vec" + targ_selvecs="bfd_elf64_sh64lnbsd_vec bfd_elf32_sh64lnbsd_vec bfd_elf32_sh64nbsd_vec bfd_elf32_shnbsd_vec bfd_elf32_shlnbsd_vec" ;; #endif @@ -1096,6 +1188,11 @@ case "${targ}" in targ_defvec=bfd_elf32_shnbsd_vec targ_selvecs="bfd_elf32_shlnbsd_vec shcoff_vec shlcoff_vec" ;; + sh*-*-symbianelf*) + targ_defvec=bfd_elf32_shl_symbian_vec + targ_selvecs="shlcoff_vec shlcoff_small_vec" + targ_underscore=yes + ;; shl*-*-elf* | sh[1234]l*-*-elf* | sh3el*-*-elf* | shl*-*-kaos*) targ_defvec=bfd_elf32_shl_vec targ_selvecs="bfd_elf32_sh_vec shlcoff_vec shcoff_vec shlcoff_small_vec shcoff_small_vec" @@ -1161,14 +1258,10 @@ case "${targ}" in targ_selvecs="bfd_elf32_sparc_vec sunos_big_vec" targ_underscore=yes ;; - sparc-*-linux-gnu*) + sparc-*-linux-*) targ_defvec=bfd_elf32_sparc_vec targ_selvecs="sparclinux_vec bfd_elf64_sparc_vec sunos_big_vec" ;; - sparc-*-lynxos*) - targ_defvec=sparclynx_coff_vec - targ_selvecs=sparclynx_aout_vec - ;; sparc-*-netbsdelf*) targ_defvec=bfd_elf32_sparc_vec targ_selvecs=sparcnetbsd_vec @@ -1199,6 +1292,10 @@ case "${targ}" in sparc-*-sysv4*) targ_defvec=bfd_elf32_sparc_vec ;; + sparc-*-vxworks*) + targ_defvec=bfd_elf32_sparc_vxworks_vec + targ_selvecs="bfd_elf32_sparc_vec sunos_big_vec" + ;; sparc-*-netware*) targ_defvec=bfd_elf32_sparc_vec targ_selvecs="nlm32_sparc_vec sunos_big_vec" @@ -1208,7 +1305,7 @@ case "${targ}" in targ_defvec=sunos_big_vec targ_underscore=yes ;; - sparc64-*-linux-gnu*) + sparc64-*-linux-*) targ_defvec=bfd_elf64_sparc_vec targ_selvecs="bfd_elf32_sparc_vec sparclinux_vec sunos_big_vec" ;; @@ -1220,16 +1317,11 @@ case "${targ}" in sparc*-*-coff*) targ_defvec=sparccoff_vec ;; - sparc*-*-rtemsaout*) - targ_defvec=sunos_big_vec - targ_selvecs="bfd_elf32_sparc_vec sparccoff_vec" - targ_underscore=yes - ;; - sparc*-*-rtems* | sparc*-*-rtemself*) + sparc*-*-rtems*) targ_defvec=bfd_elf32_sparc_vec targ_selvecs="sunos_big_vec sparccoff_vec" ;; - sparc*-*-* | sparc*-*-rtems*) + sparc*-*-*) targ_defvec=sunos_big_vec targ_underscore=yes ;; @@ -1277,7 +1369,7 @@ case "${targ}" in targ_underscore=yes ;; - vax-*-linux-gnu*) + vax-*-linux-*) targ_defvec=bfd_elf32_vax_vec ;; @@ -1301,6 +1393,14 @@ case "${targ}" in targ_defvec=bfd_elf32_xtensa_le_vec targ_selvecs=bfd_elf32_xtensa_be_vec ;; + xc16x-*-elf) + targ_defvec=bfd_elf32_xc16x_vec + ;; + + z80-*-*) + targ_defvec=z80coff_vec + targ_underscore=no + ;; z8k*-*-*) targ_defvec=z8kcoff_vec diff --git a/contrib/binutils/bfd/config.in b/contrib/binutils/bfd/config.in index ef9eca414fb..6c738257d98 100644 --- a/contrib/binutils/bfd/config.in +++ b/contrib/binutils/bfd/config.in @@ -1,288 +1,375 @@ -/* config.in. Generated automatically from configure.in by autoheader. */ +/* config.in. Generated from configure.in by autoheader. */ -/* Define if using alloca.c. */ -#undef C_ALLOCA - -/* Define to empty if the keyword does not work. */ -#undef const - -/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. - This function is required for alloca.c support on those systems. */ +/* 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 and it should be used (not on Ultrix). */ -#undef HAVE_ALLOCA_H - -/* Define if you have a working `mmap' system call. */ -#undef HAVE_MMAP - -/* Define as __inline if that's what the C compiler calls it. */ -#undef inline - -/* Define to `long' if doesn't define. */ -#undef off_t - -/* Define to `unsigned' if doesn't define. */ -#undef size_t - -/* If using the C implementation of alloca, define if you know the - direction of stack growth for your system; otherwise it will be - automatically deduced at run-time. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown - */ -#undef STACK_DIRECTION - -/* Define if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Define if you can safely include both and . */ -#undef TIME_WITH_SYS_TIME - -/* Define if you have the __argz_count function. */ -#undef HAVE___ARGZ_COUNT - -/* Define if you have the __argz_next function. */ -#undef HAVE___ARGZ_NEXT - -/* Define if you have the __argz_stringify function. */ -#undef HAVE___ARGZ_STRINGIFY - -/* Define if you have the dcgettext function. */ -#undef HAVE_DCGETTEXT - -/* Define if you have the fcntl function. */ -#undef HAVE_FCNTL - -/* Define if you have the fdopen function. */ -#undef HAVE_FDOPEN - -/* Define if you have the fseeko function. */ -#undef HAVE_FSEEKO - -/* Define if you have the fseeko64 function. */ -#undef HAVE_FSEEKO64 - -/* Define if you have the ftello function. */ -#undef HAVE_FTELLO - -/* Define if you have the ftello64 function. */ -#undef HAVE_FTELLO64 - -/* Define if you have the getcwd function. */ -#undef HAVE_GETCWD - -/* Define if you have the getgid function. */ -#undef HAVE_GETGID - -/* Define if you have the getpagesize function. */ -#undef HAVE_GETPAGESIZE - -/* Define if you have the getuid function. */ -#undef HAVE_GETUID - -/* Define if you have the madvise function. */ -#undef HAVE_MADVISE - -/* Define if you have the mprotect function. */ -#undef HAVE_MPROTECT - -/* Define if you have the munmap function. */ -#undef HAVE_MUNMAP - -/* Define if you have the putenv function. */ -#undef HAVE_PUTENV - -/* Define if you have the setenv function. */ -#undef HAVE_SETENV - -/* Define if you have the setitimer function. */ -#undef HAVE_SETITIMER - -/* Define if you have the setlocale function. */ -#undef HAVE_SETLOCALE - -/* Define if you have the stpcpy function. */ -#undef HAVE_STPCPY - -/* Define if you have the strcasecmp function. */ -#undef HAVE_STRCASECMP - -/* Define if you have the strchr function. */ -#undef HAVE_STRCHR - -/* Define if you have the strtoull function. */ -#undef HAVE_STRTOULL - -/* Define if you have the sysconf function. */ -#undef HAVE_SYSCONF - -/* Define if you have the header file. */ -#undef HAVE_ARGZ_H - -/* Define if you have the header file. */ -#undef HAVE_DIRENT_H - -/* Define if you have the header file. */ -#undef HAVE_FCNTL_H - -/* Define if you have the header file. */ -#undef HAVE_LIMITS_H - -/* Define if you have the header file. */ -#undef HAVE_LOCALE_H - -/* Define if you have the header file. */ -#undef HAVE_MALLOC_H - -/* Define if you have the header file. */ -#undef HAVE_NDIR_H - -/* Define if you have the header file. */ -#undef HAVE_NL_TYPES_H - -/* Define if you have the header file. */ -#undef HAVE_STDDEF_H - -/* Define if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define if you have the header file. */ -#undef HAVE_STRING_H - -/* Define if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_DIR_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_FILE_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_NDIR_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_PARAM_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_PROCFS_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_TIME_H - -/* Define if you have the header file. */ -#undef HAVE_TIME_H - -/* Define if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define if you have the header file. */ -#undef HAVE_VALUES_H - -/* Name of package */ -#undef PACKAGE - -/* Version number of package */ -#undef VERSION - -/* Define if you have the stpcpy function */ -#undef HAVE_STPCPY - -/* Define if your locale.h file contains LC_MESSAGES. */ -#undef HAVE_LC_MESSAGES +/* Define to 1 if using `alloca.c'. */ +#undef C_ALLOCA /* Define to 1 if NLS is requested */ #undef ENABLE_NLS +/* Define to 1 if you have `alloca', as a function or macro. */ +#undef HAVE_ALLOCA + +/* Define to 1 if you have and it should be used (not on Ultrix). + */ +#undef HAVE_ALLOCA_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_ARGZ_H + +/* Define to 1 if you have the `dcgettext' function. */ +#undef HAVE_DCGETTEXT + +/* Define to 1 if you have the declaration of `basename', and to 0 if you + don't. */ +#undef HAVE_DECL_BASENAME + +/* Define to 1 if you have the declaration of `ffs', and to 0 if you don't. */ +#undef HAVE_DECL_FFS + +/* Define to 1 if you have the declaration of `free', and to 0 if you don't. + */ +#undef HAVE_DECL_FREE + +/* Define to 1 if you have the declaration of `fseeko', and to 0 if you don't. + */ +#undef HAVE_DECL_FSEEKO + +/* Define to 1 if you have the declaration of `fseeko64', and to 0 if you + don't. */ +#undef HAVE_DECL_FSEEKO64 + +/* Define to 1 if you have the declaration of `ftello', and to 0 if you don't. + */ +#undef HAVE_DECL_FTELLO + +/* Define to 1 if you have the declaration of `ftello64', and to 0 if you + don't. */ +#undef HAVE_DECL_FTELLO64 + +/* Define to 1 if you have the declaration of `getenv', and to 0 if you don't. + */ +#undef HAVE_DECL_GETENV + +/* Define to 1 if you have the declaration of `malloc', and to 0 if you don't. + */ +#undef HAVE_DECL_MALLOC + +/* Define to 1 if you have the declaration of `realloc', and to 0 if you + don't. */ +#undef HAVE_DECL_REALLOC + +/* Define to 1 if you have the declaration of `snprintf', and to 0 if you + don't. */ +#undef HAVE_DECL_SNPRINTF + +/* Define to 1 if you have the declaration of `stpcpy', and to 0 if you don't. + */ +#undef HAVE_DECL_STPCPY + +/* Define to 1 if you have the declaration of `strstr', and to 0 if you don't. + */ +#undef HAVE_DECL_STRSTR + +/* Define to 1 if you have the declaration of `vsnprintf', and to 0 if you + don't. */ +#undef HAVE_DECL_VSNPRINTF + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#undef HAVE_DIRENT_H + +/* Define to 1 if you have the `fcntl' function. */ +#undef HAVE_FCNTL + +/* Define to 1 if you have the header file. */ +#undef HAVE_FCNTL_H + +/* Define to 1 if you have the `fdopen' function. */ +#undef HAVE_FDOPEN + +/* Define to 1 if you have the `fopen64' function. */ +#undef HAVE_FOPEN64 + +/* Define to 1 if you have the `fseeko' function. */ +#undef HAVE_FSEEKO + +/* Define to 1 if you have the `fseeko64' function. */ +#undef HAVE_FSEEKO64 + +/* Define to 1 if you have the `ftello' function. */ +#undef HAVE_FTELLO + +/* Define to 1 if you have the `ftello64' function. */ +#undef HAVE_FTELLO64 + +/* Define to 1 if you have the `getcwd' function. */ +#undef HAVE_GETCWD + +/* Define to 1 if you have the `getgid' function. */ +#undef HAVE_GETGID + +/* Define to 1 if you have the `getpagesize' function. */ +#undef HAVE_GETPAGESIZE + /* Define as 1 if you have gettext and don't want to use GNU gettext. */ #undef HAVE_GETTEXT -/* The number of bytes in type long long */ -#undef SIZEOF_LONG_LONG +/* Define to 1 if you have the `getuid' function. */ +#undef HAVE_GETUID -/* The number of bytes in type long */ -#undef SIZEOF_LONG +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H -/* Use b modifier when opening binary files? */ -#undef USE_BINARY_FOPEN +/* Define if your locale.h file contains LC_MESSAGES. */ +#undef HAVE_LC_MESSAGES -/* Define if strstr is not declared in system header files. */ -#undef NEED_DECLARATION_STRSTR +/* Define to 1 if you have the header file. */ +#undef HAVE_LIMITS_H -/* Define if malloc is not declared in system header files. */ -#undef NEED_DECLARATION_MALLOC - -/* Define if realloc is not declared in system header files. */ -#undef NEED_DECLARATION_REALLOC - -/* Define if free is not declared in system header files. */ -#undef NEED_DECLARATION_FREE - -/* Define if getenv is not declared in system header files. */ -#undef NEED_DECLARATION_GETENV - -/* Define if struct core_dumpx has member c_impl */ -#undef HAVE_ST_C_IMPL - -/* Define if has prstatus_t. */ -#undef HAVE_PRSTATUS_T - -/* Define if has prstatus32_t. */ -#undef HAVE_PRSTATUS32_T - -/* Define if has prstatus_t.pr_who. */ -#undef HAVE_PRSTATUS_T_PR_WHO - -/* Define if has prstatus32_t.pr_who. */ -#undef HAVE_PRSTATUS32_T_PR_WHO - -/* Define if has pstatus_t. */ -#undef HAVE_PSTATUS_T - -/* Define if has pxstatus_t. */ -#undef HAVE_PXSTATUS_T - -/* Define if has pstatus32_t. */ -#undef HAVE_PSTATUS32_T - -/* Define if has prpsinfo_t. */ -#undef HAVE_PRPSINFO_T - -/* Define if has prpsinfo32_t. */ -#undef HAVE_PRPSINFO32_T - -/* Define if has psinfo_t. */ -#undef HAVE_PSINFO_T - -/* Define if has psinfo32_t. */ -#undef HAVE_PSINFO32_T +/* Define to 1 if you have the header file. */ +#undef HAVE_LOCALE_H /* Define if has lwpstatus_t. */ #undef HAVE_LWPSTATUS_T -/* Define if has lwpxstatus_t. */ -#undef HAVE_LWPXSTATUS_T - /* Define if has lwpstatus_t.pr_context. */ #undef HAVE_LWPSTATUS_T_PR_CONTEXT /* Define if has lwpstatus_t.pr_reg. */ #undef HAVE_LWPSTATUS_T_PR_REG +/* Define if has lwpxstatus_t. */ +#undef HAVE_LWPXSTATUS_T + +/* Define to 1 if you have the `madvise' function. */ +#undef HAVE_MADVISE + +/* Define to 1 if you have the header file. */ +#undef HAVE_MALLOC_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have a working `mmap' system call. */ +#undef HAVE_MMAP + +/* Define to 1 if you have the `mprotect' function. */ +#undef HAVE_MPROTECT + +/* Define to 1 if you have the `munmap' function. */ +#undef HAVE_MUNMAP + +/* Define to 1 if you have the header file, and it defines `DIR'. */ +#undef HAVE_NDIR_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NL_TYPES_H + +/* Define if has prpsinfo32_t. */ +#undef HAVE_PRPSINFO32_T + +/* Define if has prpsinfo_t. */ +#undef HAVE_PRPSINFO_T + +/* Define if has prstatus32_t. */ +#undef HAVE_PRSTATUS32_T + +/* Define if has prstatus32_t.pr_who. */ +#undef HAVE_PRSTATUS32_T_PR_WHO + +/* Define if has prstatus_t. */ +#undef HAVE_PRSTATUS_T + +/* Define if has prstatus_t.pr_who. */ +#undef HAVE_PRSTATUS_T_PR_WHO + +/* Define if has psinfo32_t. */ +#undef HAVE_PSINFO32_T + +/* Define if has psinfo_t. */ +#undef HAVE_PSINFO_T + +/* Define if has pstatus32_t. */ +#undef HAVE_PSTATUS32_T + +/* Define if has pstatus_t. */ +#undef HAVE_PSTATUS_T + +/* Define to 1 if you have the `putenv' function. */ +#undef HAVE_PUTENV + +/* Define if has pxstatus_t. */ +#undef HAVE_PXSTATUS_T + +/* Define to 1 if you have the `setenv' function. */ +#undef HAVE_SETENV + +/* Define to 1 if you have the `setitimer' function. */ +#undef HAVE_SETITIMER + +/* Define to 1 if you have the `setlocale' function. */ +#undef HAVE_SETLOCALE + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDDEF_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define if you have the stpcpy function */ +#undef HAVE_STPCPY + +/* Define to 1 if you have the `strcasecmp' function. */ +#undef HAVE_STRCASECMP + +/* Define to 1 if you have the `strchr' function. */ +#undef HAVE_STRCHR + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the `strtoull' function. */ +#undef HAVE_STRTOULL + +/* Define if struct core_dumpx has member c_impl */ +#undef HAVE_ST_C_IMPL + +/* Define to 1 if you have the `sysconf' function. */ +#undef HAVE_SYSCONF + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#undef HAVE_SYS_DIR_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_FILE_H + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#undef HAVE_SYS_NDIR_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PROCFS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TIME_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_TIME_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_VALUES_H + /* Define if has win32_pstatus_t. */ #undef HAVE_WIN32_PSTATUS_T +/* Define to 1 if you have the `__argz_count' function. */ +#undef HAVE___ARGZ_COUNT + +/* Define to 1 if you have the `__argz_next' function. */ +#undef HAVE___ARGZ_NEXT + +/* Define to 1 if you have the `__argz_stringify' function. */ +#undef HAVE___ARGZ_STRINGIFY + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* The size of a `long', as computed by sizeof. */ +#undef SIZEOF_LONG + +/* The size of a `long long', as computed by sizeof. */ +#undef SIZEOF_LONG_LONG + +/* The size of a `off_t', as computed by sizeof. */ +#undef SIZEOF_OFF_T + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at run-time. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +#undef STACK_DIRECTION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define if you can safely include both and . */ +#undef STRING_WITH_STRINGS + +/* Define to 1 if you can safely include both and . */ +#undef TIME_WITH_SYS_TIME + /* Name of host specific header file to include in trad-core.c. */ #undef TRAD_HEADER -/* The number of bytes in type off_t */ -#undef SIZEOF_OFF_T +/* Use b modifier when opening binary files? */ +#undef USE_BINARY_FOPEN /* Use mmap if it's available? */ #undef USE_MMAP +/* Define if we should default to creating read-only plt entries */ +#undef USE_SECUREPLT + +/* Version number of package */ +#undef VERSION + +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# undef _GNU_SOURCE +#endif + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#undef inline +#endif + +/* Define to `long' if does not define. */ +#undef off_t + +/* Define to `unsigned' if does not define. */ +#undef size_t diff --git a/contrib/binutils/bfd/configure b/contrib/binutils/bfd/configure index 8c8ff3b25a0..af6c22b5a66 100755 --- a/contrib/binutils/bfd/configure +++ b/contrib/binutils/bfd/configure @@ -1,57 +1,325 @@ #! /bin/sh - # Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.13 -# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# Generated by GNU Autoconf 2.59. # +# Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## -# Defaults: -ac_help= +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi +DUALCASE=1; export DUALCASE # for MKS sh + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# ac_default_prefix=/usr/local -# Any additions from configure.in: -ac_help="$ac_help - --enable-shared[=PKGS] build shared libraries [default=no]" -ac_help="$ac_help - --enable-static[=PKGS] build static libraries [default=yes]" -ac_help="$ac_help - --enable-fast-install[=PKGS] optimize for fast installation [default=yes]" -ac_help="$ac_help - --with-gnu-ld assume the C compiler uses GNU ld [default=no]" -ac_help="$ac_help - --disable-libtool-lock avoid locking (might break parallel builds)" -ac_help="$ac_help - --with-pic try to use only PIC/non-PIC objects [default=use both]" -ac_help="$ac_help - --enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)" -ac_help="$ac_help - --enable-targets alternative target configurations" -ac_help="$ac_help - --enable-commonbfdlib build shared BFD/opcodes/libiberty library" -ac_help="$ac_help - --with-mmap try using mmap for BFD input files if available" -ac_help="$ac_help - --enable-build-warnings Enable build-time compiler warnings if gcc is used" -ac_help="$ac_help - --enable-maintainer-mode enable make rules and dependencies not useful - (and sometimes confusing) to the casual installer" -ac_help="$ac_help - --enable-install-libbfd controls installation of libbfd and related headers" -ac_help="$ac_help - --disable-nls do not use Native Language Support" -ac_help="$ac_help - --with-included-gettext use the GNU gettext library included here" +ac_config_libobj_dir=. +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +# Identity of this package. +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= + +ac_unique_file="libbfd.c" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_STAT_H +# include +#endif +#if STDC_HEADERS +# include +# include +#else +# if HAVE_STDLIB_H +# include +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include +# endif +# include +#endif +#if HAVE_STRINGS_H +# include +#endif +#if HAVE_INTTYPES_H +# include +#else +# if HAVE_STDINT_H +# include +# endif +#endif +#if HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE AR ac_ct_AR RANLIB ac_ct_RANLIB LN_S LIBTOOL WARN_CFLAGS NO_WERROR MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT INSTALL_LIBBFD_TRUE INSTALL_LIBBFD_FALSE host_noncanonical target_noncanonical bfdlibdir bfdincludedir CPP EGREP ALLOCA USE_NLS MSGFMT GMSGFMT XGETTEXT USE_INCLUDED_LIBINTL CATALOGS CATOBJEXT DATADIRNAME GMOFILES INSTOBJEXT INTLDEPS INTLLIBS INTLOBJS POFILES POSUB INCLUDE_LOCALE_H GT_NO GT_YES MKINSTALLDIRS l HDEFINES BFD_HOST_64BIT_LONG BFD_HOST_LONG_LONG BFD_HOST_64_BIT_DEFINED BFD_HOST_64_BIT BFD_HOST_U_64_BIT CC_FOR_BUILD EXEEXT_FOR_BUILD COREFILE COREFLAG WIN32LDFLAGS WIN32LIBADD TDEFINES wordsize bfd_libs all_backends bfd_backends bfd_machines bfd_default_target_size bfd_file_ptr bfd_ufile_ptr tdefaults datarootdir docdir htmldir LIBOBJS LTLIBOBJS' +ac_subst_files='' # Initialize some variables set by options. +ac_init_help= +ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. -build=NONE -cache_file=./config.cache +cache_file=/dev/null exec_prefix=NONE -host=NONE no_create= -nonopt=NONE no_recursion= prefix=NONE program_prefix=NONE @@ -60,10 +328,15 @@ program_transform_name=s,x,x, silent= site= srcdir= -target=NONE verbose= x_includes=NONE x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' @@ -77,17 +350,9 @@ 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" @@ -95,59 +360,59 @@ do continue fi - case "$ac_option" in - -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) ac_optarg= ;; - esac + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. - case "$ac_option" in + case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir="$ac_optarg" ;; + bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) - ac_prev=build ;; + ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build="$ac_optarg" ;; + build_alias=$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" ;; + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) - datadir="$ac_optarg" ;; + datadir=$ac_optarg ;; -disable-* | --disable-*) - ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + ac_feature=`expr "x$ac_option" : 'x-*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" ;; + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + 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/=.*//'` + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # 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 - *=*) ;; + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac - eval "enable_${ac_feature}='$ac_optarg'" ;; + eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ @@ -156,95 +421,47 @@ do -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) - exec_prefix="$ac_optarg" ;; + 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 ;; + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; -host | --host | --hos | --ho) - ac_prev=host ;; + ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) - host="$ac_optarg" ;; + host_alias=$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" ;; + includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir="$ac_optarg" ;; + infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir="$ac_optarg" ;; + 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" ;; + libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ @@ -253,19 +470,19 @@ EOF -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir="$ac_optarg" ;; + localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir="$ac_optarg" ;; + 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-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ @@ -279,26 +496,26 @@ EOF -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir="$ac_optarg" ;; + oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix="$ac_optarg" ;; + 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_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_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ @@ -315,7 +532,7 @@ EOF | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name="$ac_optarg" ;; + program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) @@ -325,7 +542,7 @@ EOF ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) - sbindir="$ac_optarg" ;; + sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ @@ -336,58 +553,57 @@ EOF | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) - sharedstatedir="$ac_optarg" ;; + sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) - site="$ac_optarg" ;; + site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir="$ac_optarg" ;; + 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" ;; + sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target ;; + ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target="$ac_optarg" ;; + target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; - -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.13" - exit 0 ;; + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; -with-* | --with-*) - ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # 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 + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac - eval "with_${ac_package}='$ac_optarg'" ;; + eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) - ac_package=`echo $ac_option|sed -e 's/-*without-//'` + ac_package=`expr "x$ac_option" : 'x-*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" ;; + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. @@ -398,99 +614,110 @@ EOF 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_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" ;; + x_libraries=$ac_optarg ;; - -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } ;; + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + *) - 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" + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$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; } + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); 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 +# Be sure to have absolute paths. +for ac_var in exec_prefix prefix 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" ;; + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; 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 +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done -# 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 +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null -# A filename unique to this package, relative to the directory that -# configure is in, which we can look for to find out if srcdir is correct. -ac_unique_file=libbfd.c # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. - ac_prog=$0 - ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` - test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + ac_confdir=`(dirname "$0") 2>/dev/null || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$0" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. @@ -500,13 +727,492 @@ else 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; } + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } else - { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } fi fi -srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` +(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || + { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 + { (exit 1); exit 1; }; } +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # 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 <<_ACEOF +\`configure' configures this package to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +_ACEOF + + cat <<_ACEOF +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data [PREFIX/share] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --infodir=DIR info documentation [PREFIX/info] + --mandir=DIR man documentation [PREFIX/man] +_ACEOF + + cat <<\_ACEOF + +Program names: + --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 + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] + --target=TARGET configure for building compilers for TARGET [HOST] +_ACEOF +fi + +if test -n "$ac_init_help"; then + + cat <<\_ACEOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors + --enable-shared=PKGS build shared libraries default=no + --enable-static=PKGS build static libraries default=yes + --enable-fast-install=PKGS optimize for fast installation default=yes + --disable-libtool-lock avoid locking (might break parallel builds) + --enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes) + --enable-targets alternative target configurations + --enable-commonbfdlib build shared BFD/opcodes/libiberty library + --enable-secureplt Default to creating read-only plt entries + --enable-werror treat compile warnings as errors + --enable-build-warnings Enable build-time compiler warnings + --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer + --enable-install-libbfd controls installation of libbfd and related headers + --disable-nls do not use Native Language Support + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-gnu-ld assume the C compiler uses GNU ld default=no + --with-pic try to use only PIC/non-PIC objects default=use both + --with-mmap try using mmap for BFD input files if available + --with-included-gettext use the GNU gettext library included here + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have + headers in a nonstandard directory + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +_ACEOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d $ac_dir || continue + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + cd $ac_dir + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_srcdir/configure.gnu; then + echo + $SHELL $ac_srcdir/configure.gnu --help=recursive + elif test -f $ac_srcdir/configure; then + echo + $SHELL $ac_srcdir/configure --help=recursive + elif test -f $ac_srcdir/configure.ac || + test -f $ac_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi + cd $ac_popdir + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\_ACEOF + +Copyright (C) 2003 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit 0 +fi +exec 5>config.log +cat >&5 <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by $as_me, which was +generated by GNU Autoconf 2.59. Invocation command line was + + $ $0 $@ + +_ACEOF +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + echo "PATH: $as_dir" +done + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_sep= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + # Get rid of the leading space. + ac_sep=" " + ;; + esac + done +done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Be sure not to use single quotes in there, as some shells, +# such as our DU 5.0 friend, will then `close' the trap. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} + echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------- ## +## Output files. ## +## ------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + sed "/^$/d" confdefs.h | sort + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core && + rm -rf conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# 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 + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then @@ -517,102 +1223,105 @@ if test -z "$CONFIG_SITE"; then fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then - echo "loading site script $ac_site_file" + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then - echo "loading cache $cache_file" - . $cache_file + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi else - echo "creating cache $cache_file" - > $cache_file + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" + eval ac_new_val="\$ac_env_${ac_var}_value" + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } fi ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + + + + -ac_exeext= -ac_objext=o -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi -echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 -echo "configure:556: checking for Cygwin environment" >&5 -if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_cygwin=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_cygwin=no -fi -rm -f conftest* -rm -f conftest* -fi -echo "$ac_t""$ac_cv_cygwin" 1>&6 -CYGWIN= -test "$ac_cv_cygwin" = yes && CYGWIN=yes -echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 -echo "configure:589: checking for mingw32 environment" >&5 -if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_mingw32=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_mingw32=no -fi -rm -f conftest* -rm -f conftest* -fi -echo "$ac_t""$ac_cv_mingw32" 1>&6 -MINGW32= -test "$ac_cv_mingw32" = yes && MINGW32=yes ac_aux_dir= @@ -625,149 +1334,1162 @@ for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break + elif test -f $ac_dir/shtool; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -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; } + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 +echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} + { (exit 1); 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. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + +# Make sure we can run config.sub. +$ac_config_sub sun4 >/dev/null 2>&1 || + { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 +echo "$as_me: error: cannot run $ac_config_sub" >&2;} + { (exit 1); exit 1; }; } + +echo "$as_me:$LINENO: checking build system type" >&5 +echo $ECHO_N "checking build system type... $ECHO_C" >&6 +if test "${ac_cv_build+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_build_alias=$build_alias +test -z "$ac_cv_build_alias" && + ac_cv_build_alias=`$ac_config_guess` +test -z "$ac_cv_build_alias" && + { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 +echo "$as_me: error: cannot guess build type; you must specify one" >&2;} + { (exit 1); exit 1; }; } +ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_build" >&5 +echo "${ECHO_T}$ac_cv_build" >&6 +build=$ac_cv_build +build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -# Do some error checking and defaulting for the host and target type. -# The inputs are: -# configure --host=HOST --target=TARGET --build=BUILD NONOPT -# -# The rules are: -# 1. You are not allowed to specify --host, --target, and nonopt at the -# same time. -# 2. Host defaults to nonopt. -# 3. If nonopt is not specified, then host defaults to the current host, -# as determined by config.guess. -# 4. Target and build default to nonopt. -# 5. If nonopt is not specified, then target and build default to host. +echo "$as_me:$LINENO: checking host system type" >&5 +echo $ECHO_N "checking host system type... $ECHO_C" >&6 +if test "${ac_cv_host+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_host_alias=$host_alias +test -z "$ac_cv_host_alias" && + ac_cv_host_alias=$ac_cv_build_alias +ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6 +host=$ac_cv_host +host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + +echo "$as_me:$LINENO: checking target system type" >&5 +echo $ECHO_N "checking target system type... $ECHO_C" >&6 +if test "${ac_cv_target+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_target_alias=$target_alias +test "x$ac_cv_target_alias" = "x" && + ac_cv_target_alias=$ac_cv_host_alias +ac_cv_target=`$ac_config_sub $ac_cv_target_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_target_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_target_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_target" >&5 +echo "${ECHO_T}$ac_cv_target" >&6 +target=$ac_cv_target +target_cpu=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +target_vendor=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +target_os=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + # The aliases save the names the user supplied, while $host etc. # will get canonicalized. -case $host---$target---$nonopt in -NONE---*---* | *---NONE---* | *---*---NONE) ;; -*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;; -esac - - -# Make sure we can run config.sub. -if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : -else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } -fi - -echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:666: checking host system type" >&5 - -host_alias=$host -case "$host_alias" in -NONE) - case $nonopt in - NONE) - if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : - else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } - fi ;; - *) host_alias=$nonopt ;; - esac ;; -esac - -host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` -host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$host" 1>&6 - -echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:687: checking target system type" >&5 - -target_alias=$target -case "$target_alias" in -NONE) - case $nonopt in - NONE) target_alias=$host_alias ;; - *) target_alias=$nonopt ;; - esac ;; -esac - -target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias` -target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$target" 1>&6 - -echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:705: checking build system type" >&5 - -build_alias=$build -case "$build_alias" in -NONE) - case $nonopt in - NONE) build_alias=$host_alias ;; - *) build_alias=$nonopt ;; - esac ;; -esac - -build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` -build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$build" 1>&6 - -test "$host_alias" != "$target_alias" && +test -n "$target_alias" && test "$program_prefix$program_suffix$program_transform_name" = \ NONENONEs,x,x, && program_prefix=${target_alias}- - - - echo $ac_n "checking for strerror in -lcposix""... $ac_c" 1>&6 -echo "configure:729: checking for strerror in -lcposix" >&5 -ac_lib_var=`echo cposix'_'strerror | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_LIBS="$LIBS" -LIBS="-lcposix $LIBS" -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. + +# Be careful to initialize this variable, since it used to be cached. +# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. +ac_cv_exeext= +# b.out is created by i960 compilers. +for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) + ;; + conftest.$ac_ext ) + # This is the source file. + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool, + # but it would be cool to find out if it's true. Does anybody + # maintain Libtool? --akim. + export ac_cv_exeext + break;; + * ) + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +rm -f a.out a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 + +echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cc_g=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std1 is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std1. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + '' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +#include +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +continue +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done rm -f conftest* -LIBS="$ac_save_LIBS" - +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - LIBS="$LIBS -lcposix" + else - echo "$ac_t""no" 1>&6 + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +echo "$as_me:$LINENO: checking for library containing strerror" >&5 +echo $ECHO_N "checking for library containing strerror... $ECHO_C" >&6 +if test "${ac_cv_search_strerror+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_func_search_save_LIBS=$LIBS +ac_cv_search_strerror=no +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char strerror (); +int +main () +{ +strerror (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_strerror="none required" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test "$ac_cv_search_strerror" = no; then + for ac_lib in cposix; do + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char strerror (); +int +main () +{ +strerror (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_strerror="-l$ac_lib" +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + done +fi +LIBS=$ac_func_search_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_search_strerror" >&5 +echo "${ECHO_T}$ac_cv_search_strerror" >&6 +if test "$ac_cv_search_strerror" != no; then + test "$ac_cv_search_strerror" = "none required" || LIBS="$ac_cv_search_strerror $LIBS" + fi - - -am__api_version="1.4" +am__api_version="1.9" # 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: @@ -775,348 +2497,742 @@ am__api_version="1.4" # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs # 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" +# OS/2's system install, which has a completely different semantic # ./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:784: checking for a BSD compatible install" >&5 +echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then -if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" - for ac_dir in $PATH; do - # Account for people who put trailing slashes in PATH elements. - case "$ac_dir/" in - /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - if test -f $ac_dir/$ac_prog; then + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ + /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 + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && - grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : else - ac_cv_path_install="$ac_dir/$ac_prog -c" - break 2 + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 fi fi done - ;; - esac - done - IFS="$ac_save_IFS" + done + ;; +esac +done + fi if test "${ac_cv_path_install+set}" = set; then - INSTALL="$ac_cv_path_install" + 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" + INSTALL=$ac_install_sh fi fi -echo "$ac_t""$INSTALL" 1>&6 +echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 -echo "configure:837: checking whether build environment is sane" >&5 +echo "$as_me:$LINENO: checking whether build environment is sane" >&5 +echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 # Just in case sleep 1 -echo timestamp > conftestfile +echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( - set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. - set X `ls -t $srcdir/configure conftestfile` + set X `ls -t $srcdir/configure conftest.file` fi - if test "$*" != "X $srcdir/configure conftestfile" \ - && test "$*" != "X conftestfile $srcdir/configure"; then + rm -f conftest.file + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". - { echo "configure: error: ls -t appears to fail. Make sure there is not a broken -alias in your environment" 1>&2; exit 1; } + { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&5 +echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&2;} + { (exit 1); exit 1; }; } fi - test "$2" = conftestfile + test "$2" = conftest.file ) then # Ok. : else - { echo "configure: error: newly created file is older than distributed files! -Check your system clock" 1>&2; exit 1; } -fi -rm -f conftest* -echo "$ac_t""yes" 1>&6 -if test "$program_transform_name" = s,x,x,; then - program_transform_name= -else - # Double any \ or $. echo might interpret backslashes. - cat <<\EOF_SED > conftestsed -s,\\,\\\\,g; s,\$,$$,g -EOF_SED - program_transform_name="`echo $program_transform_name|sed -f conftestsed`" - rm -f conftestsed + { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! +Check your system clock" >&5 +echo "$as_me: error: newly created file is older than distributed files! +Check your system clock" >&2;} + { (exit 1); exit 1; }; } fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 test "$program_prefix" != NONE && - program_transform_name="s,^,${program_prefix},; $program_transform_name" + program_transform_name="s,^,$program_prefix,;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && - program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" + program_transform_name="s,\$,$program_suffix,;$program_transform_name" +# Double any \ or $. echo might interpret backslashes. +# By default was `s,x,x', remove it if useless. +cat <<\_ACEOF >conftest.sed +s/[\\$]/&&/g;s/;s,x,x,$// +_ACEOF +program_transform_name=`echo $program_transform_name | sed -f conftest.sed` +rm conftest.sed -# sed with no file args requires a program. -test "$program_transform_name" = "" && program_transform_name="s,x,x," +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` -echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:894: checking whether ${MAKE-make} sets \${MAKE}" >&5 -set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " else - cat > conftestmake <<\EOF + am_missing_run= + { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 +echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} +fi + +if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then + # We used to keeping the `.' as first argument, in order to + # allow $(mkdir_p) to be used without argument. As in + # $(mkdir_p) $(somedir) + # where $(somedir) is conditionally defined. However this is wrong + # for two reasons: + # 1. if the package is installed by a user who cannot write `.' + # make install will fail, + # 2. the above comment should most certainly read + # $(mkdir_p) $(DESTDIR)$(somedir) + # so it does not work when $(somedir) is undefined and + # $(DESTDIR) is not. + # To support the latter case, we have to write + # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), + # so the `.' trick is pointless. + mkdir_p='mkdir -p --' +else + # On NextStep and OpenStep, the `mkdir' command does not + # recognize any option. It will interpret all options as + # directories to create, and then abort because `.' already + # exists. + for d in ./-p ./--version; + do + test -d $d && rmdir $d + done + # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. + if test -f "$ac_aux_dir/mkinstalldirs"; then + mkdir_p='$(mkinstalldirs)' + else + mkdir_p='$(install_sh) -d' + fi +fi + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_AWK+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AWK="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + echo "$as_me:$LINENO: result: $AWK" >&5 +echo "${ECHO_T}$AWK" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$AWK" && break +done + +echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.make <<\_ACEOF all: - @echo 'ac_maketemp="${MAKE}"' -EOF + @echo 'ac_maketemp="$(MAKE)"' +_ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. -eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi -rm -f conftestmake +rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$ac_t""yes" 1>&6 + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 SET_MAKE= else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi - -PACKAGE=bfd - -VERSION=2.15 - -if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then - { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ fi -cat >> confdefs.h </dev/null + +DEPDIR="${am__leading_dot}deps" + + ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 +echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6 +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi + + +echo "$as_me:$LINENO: result: $_am_result" >&5 +echo "${ECHO_T}$_am_result" >&6 +rm -f confinc confmf + +# Check whether --enable-dependency-tracking or --disable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then + enableval="$enable_dependency_tracking" + +fi; +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi + + +if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + + +# test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then + { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 +echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} + { (exit 1); exit 1; }; } +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE=bfd + VERSION=2.17 + + +cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" -EOF +_ACEOF -cat >> confdefs.h <>confdefs.h <<_ACEOF #define VERSION "$VERSION" -EOF +_ACEOF + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} -missing_dir=`cd $ac_aux_dir && pwd` -echo $ac_n "checking for working aclocal-${am__api_version}""... $ac_c" 1>&6 -echo "configure:940: checking for working aclocal-${am__api_version}" >&5 -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if (aclocal-${am__api_version} --version) < /dev/null > /dev/null 2>&1; then - ACLOCAL=aclocal-${am__api_version} - echo "$ac_t""found" 1>&6 + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + +install_sh=${install_sh-"$am_aux_dir/install-sh"} + +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ACLOCAL="$missing_dir/missing aclocal-${am__api_version}" - echo "$ac_t""missing" 1>&6 -fi - -echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 -echo "configure:953: checking for working autoconf" >&5 -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if (autoconf --version) < /dev/null > /dev/null 2>&1; then - AUTOCONF=autoconf - echo "$ac_t""found" 1>&6 + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else - AUTOCONF="$missing_dir/missing autoconf" - echo "$ac_t""missing" 1>&6 -fi +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done -echo $ac_n "checking for working automake-${am__api_version}""... $ac_c" 1>&6 -echo "configure:966: checking for working automake-${am__api_version}" >&5 -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if (automake-${am__api_version} --version) < /dev/null > /dev/null 2>&1; then - AUTOMAKE=automake-${am__api_version} - echo "$ac_t""found" 1>&6 +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + echo "$as_me:$LINENO: result: $STRIP" >&5 +echo "${ECHO_T}$STRIP" >&6 else - AUTOMAKE="$missing_dir/missing automake-${am__api_version}" - echo "$ac_t""missing" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi -echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 -echo "configure:979: checking for working autoheader" >&5 -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if (autoheader --version) < /dev/null > /dev/null 2>&1; then - AUTOHEADER=autoheader - echo "$ac_t""found" 1>&6 +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - AUTOHEADER="$missing_dir/missing autoheader" - echo "$ac_t""missing" 1>&6 -fi - -echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 -echo "configure:992: checking for working makeinfo" >&5 -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if (makeinfo --version) < /dev/null > /dev/null 2>&1; then - MAKEINFO=makeinfo - echo "$ac_t""found" 1>&6 + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else - MAKEINFO="$missing_dir/missing makeinfo" - echo "$ac_t""missing" 1>&6 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" fi - - -# Uncomment the next line to remove the date from the reported bfd version -#is_release=y - -bfd_version=`echo "${VERSION}" | sed -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$/\1\2\3\4\5/'` - -bfd_version_string="\"${VERSION}\"" -if test x${is_release} = x; then - bfd_version_date=`sed -n -e 's/.*DATE //p' < ${srcdir}/version.h` - bfd_version_string="\"${VERSION} ${bfd_version_date}\"" fi - - - -if test $host != $build; then - ac_tool_prefix=${host_alias}- +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 +echo "${ECHO_T}$ac_ct_STRIP" >&6 else - ac_tool_prefix= + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi -# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. + STRIP=$ac_ct_STRIP +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +# Always define AMTAR for backward compatibility. + +AMTAR=${AMTAR-"${am_missing_run}tar"} + +am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' + + + + +depcc="$CC" am_compiler_list= + +echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 +echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 +echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6 +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + + +if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1027: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_AR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_AR="${ac_tool_prefix}ar" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_AR" && ac_cv_prog_AR="ar" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AR="${ac_tool_prefix}ar" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + fi fi -AR="$ac_cv_prog_AR" +AR=$ac_cv_prog_AR if test -n "$AR"; then - echo "$ac_t""$AR" 1>&6 + echo "$as_me:$LINENO: result: $AR" >&5 +echo "${ECHO_T}$AR" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi +fi +if test -z "$ac_cv_prog_AR"; then + ac_ct_AR=$AR + # Extract the first word of "ar", so it can be a program name with args. +set dummy ar; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_AR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_AR="ar" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + echo "$as_me:$LINENO: result: $ac_ct_AR" >&5 +echo "${ECHO_T}$ac_ct_AR" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi -# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. + AR=$ac_ct_AR +else + AR="$ac_cv_prog_AR" +fi + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1059: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + fi fi -RANLIB="$ac_cv_prog_RANLIB" +RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then - echo "$ac_t""$RANLIB" 1>&6 + echo "$as_me:$LINENO: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - +fi if test -z "$ac_cv_prog_RANLIB"; then -if test -n "$ac_tool_prefix"; then + ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1091: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_RANLIB="ranlib" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" fi fi -RANLIB="$ac_cv_prog_RANLIB" -if test -n "$RANLIB"; then - echo "$ac_t""$RANLIB" 1>&6 +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 +echo "${ECHO_T}$ac_ct_RANLIB" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi + RANLIB=$ac_ct_RANLIB else - RANLIB=":" -fi + RANLIB="$ac_cv_prog_RANLIB" fi @@ -1141,8 +3257,7 @@ no) enable_shared=no ;; esac else enable_shared=no -fi - +fi; # Check whether --enable-static or --disable-static was given. if test "${enable_static+set}" = set; then @@ -1165,8 +3280,7 @@ no) enable_static=no ;; esac else enable_static=yes -fi - +fi; # Check whether --enable-fast-install or --disable-fast-install was given. if test "${enable_fast_install+set}" = set; then enableval="$enable_fast_install" @@ -1188,229 +3302,7 @@ no) enable_fast_install=no ;; esac else enable_fast_install=yes -fi - -# Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1197: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="gcc" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1227: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_prog_rejected=no - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - break - fi - done - IFS="$ac_save_ifs" -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# -gt 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - set dummy "$ac_dir/$ac_word" "$@" - shift - ac_cv_prog_CC="$@" - fi -fi -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - if test -z "$CC"; then - case "`uname -s`" in - *win32* | *WIN32*) - # Extract the first word of "cl", so it can be a program name with args. -set dummy cl; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1278: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="cl" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - ;; - esac - fi - test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } -fi - -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1310: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -cat > conftest.$ac_ext << EOF - -#line 1321 "configure" -#include "confdefs.h" - -main(){return(0);} -EOF -if { (eval echo configure:1326: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - ac_cv_prog_cc_works=yes - # If we can't run a trivial program, we are probably using a cross compiler. - if (./conftest; exit) 2>/dev/null; then - ac_cv_prog_cc_cross=no - else - ac_cv_prog_cc_cross=yes - fi -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_prog_cc_works=no -fi -rm -fr conftest* -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 -if test $ac_cv_prog_cc_works = no; then - { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } -fi -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1352: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 -echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 -cross_compiling=$ac_cv_prog_cc_cross - -echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:1357: checking whether we are using GNU C" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gcc=yes -else - ac_cv_prog_gcc=no -fi -fi - -echo "$ac_t""$ac_cv_prog_gcc" 1>&6 - -if test $ac_cv_prog_gcc = yes; then - GCC=yes -else - GCC= -fi - -ac_test_CFLAGS="${CFLAGS+set}" -ac_save_CFLAGS="$CFLAGS" -CFLAGS= -echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1385: checking whether ${CC-cc} accepts -g" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - echo 'void f(){}' > conftest.c -if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then - ac_cv_prog_cc_g=yes -else - ac_cv_prog_cc_g=no -fi -rm -f conftest* - -fi - -echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 -if test "$ac_test_CFLAGS" = set; then - CFLAGS="$ac_save_CFLAGS" -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi +fi; # Check whether --with-gnu-ld or --without-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then @@ -1418,13 +3310,12 @@ if test "${with_gnu_ld+set}" = set; then test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no -fi - +fi; ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. - echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6 -echo "configure:1428: checking for ld used by GCC" >&5 + echo "$as_me:$LINENO: checking for ld used by GCC" >&5 +echo $ECHO_N "checking for ld used by GCC... $ECHO_C" >&6 case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw @@ -1453,14 +3344,14 @@ echo "configure:1428: checking for ld used by GCC" >&5 ;; esac elif test "$with_gnu_ld" = yes; then - echo $ac_n "checking for GNU ld""... $ac_c" 1>&6 -echo "configure:1458: checking for GNU ld" >&5 + echo "$as_me:$LINENO: checking for GNU ld" >&5 +echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6 else - echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 -echo "configure:1461: checking for non-GNU ld" >&5 + echo "$as_me:$LINENO: checking for non-GNU ld" >&5 +echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6 fi -if eval "test \"`echo '$''{'lt_cv_path_LD'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +if test "${lt_cv_path_LD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$LD"; then IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" @@ -1486,15 +3377,19 @@ fi LD="$lt_cv_path_LD" if test -n "$LD"; then - echo "$ac_t""$LD" 1>&6 + echo "$as_me:$LINENO: result: $LD" >&5 +echo "${ECHO_T}$LD" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi -test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; } -echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6 -echo "configure:1496: checking if the linker ($LD) is GNU ld" >&5 -if eval "test \"`echo '$''{'lt_cv_prog_gnu_ld'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 +echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} + { (exit 1); exit 1; }; } +echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 +echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6 +if test "${lt_cv_prog_gnu_ld+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else # I'd rather use --version here, but apparently some GNU ld's only accept -v. if $LD -v 2>&1 &5; then @@ -1503,27 +3398,27 @@ else lt_cv_prog_gnu_ld=no fi fi - -echo "$ac_t""$lt_cv_prog_gnu_ld" 1>&6 +echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5 +echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 with_gnu_ld=$lt_cv_prog_gnu_ld -echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6 -echo "configure:1513: checking for $LD option to reload object files" >&5 -if eval "test \"`echo '$''{'lt_cv_ld_reload_flag'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5 +echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6 +if test "${lt_cv_ld_reload_flag+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_ld_reload_flag='-r' fi - -echo "$ac_t""$lt_cv_ld_reload_flag" 1>&6 +echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5 +echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6 reload_flag=$lt_cv_ld_reload_flag test -n "$reload_flag" && reload_flag=" $reload_flag" -echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6 -echo "configure:1525: checking for BSD-compatible nm" >&5 -if eval "test \"`echo '$''{'lt_cv_path_NM'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5 +echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6 +if test "${lt_cv_path_NM+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$NM"; then # Let the user override the test. @@ -1556,33 +3451,24 @@ fi fi NM="$lt_cv_path_NM" -echo "$ac_t""$NM" 1>&6 +echo "$as_me:$LINENO: result: $NM" >&5 +echo "${ECHO_T}$NM" >&6 -echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:1563: checking whether ln -s works" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking whether ln -s works" >&5 +echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6 +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 else - rm -f conftestdata -if ln -s X conftestdata 2>/dev/null -then - rm -f conftestdata - ac_cv_prog_LN_S="ln -s" -else - ac_cv_prog_LN_S=ln -fi -fi -LN_S="$ac_cv_prog_LN_S" -if test "$ac_cv_prog_LN_S" = "ln -s"; then - echo "$ac_t""yes" 1>&6 -else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no, using $LN_S" >&5 +echo "${ECHO_T}no, using $LN_S" >&6 fi -echo $ac_n "checking how to recognise dependant libraries""... $ac_c" 1>&6 -echo "configure:1584: checking how to recognise dependant libraries" >&5 -if eval "test \"`echo '$''{'lt_cv_deplibs_check_method'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking how to recognise dependant libraries" >&5 +echo $ECHO_N "checking how to recognise dependant libraries... $ECHO_C" >&6 +if test "${lt_cv_deplibs_check_method+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= @@ -1619,6 +3505,7 @@ cygwin* | mingw* |pw32*) ;; darwin* | rhapsody*) + # this will be overwritten by pass_all, but leave it in just in case lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' lt_cv_file_magic_cmd='/usr/bin/file -L' case "$host_os" in @@ -1629,9 +3516,10 @@ darwin* | rhapsody*) lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' ;; esac + lt_cv_deplibs_check_method=pass_all ;; -freebsd* ) +freebsd* | kfreebsd*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then case $host_cpu in i*86 ) @@ -1689,17 +3577,10 @@ irix5* | irix6*) # This must be Linux ELF. linux-gnu*) - case $host_cpu in - alpha* | mips* | hppa* | i*86 | powerpc* | sparc* | ia64* ) - lt_cv_deplibs_check_method=pass_all ;; - *) - # glibc up to 2.1.1 does not perform some relocations on ARM - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; - esac - lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` + lt_cv_deplibs_check_method=pass_all ;; -netbsd*) +netbsd* | knetbsd*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' else @@ -1747,78 +3628,85 @@ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) esac fi - -echo "$ac_t""$lt_cv_deplibs_check_method" 1>&6 +echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5 +echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6 file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method -echo $ac_n "checking for object suffix""... $ac_c" 1>&6 -echo "configure:1757: checking for object suffix" >&5 -if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - rm -f conftest* -echo 'int i = 1;' > conftest.$ac_ext -if { (eval echo configure:1763: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - for ac_file in conftest.*; do - case $ac_file in - *.c) ;; - *) ac_cv_objext=`echo $ac_file | sed -e s/conftest.//` ;; - esac - done -else - { echo "configure: error: installation or configuration problem; compiler does not work" 1>&2; exit 1; } -fi -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_objext" 1>&6 -OBJEXT=$ac_cv_objext -ac_objext=$ac_cv_objext -echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:1783: checking for executable suffix" >&5 -if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$CYGWIN" = yes || test "$MINGW32" = yes; then - ac_cv_exeext=.exe -else - rm -f conftest* - echo 'int main () { return 0; }' > conftest.$ac_ext - ac_cv_exeext= - if { (eval echo configure:1793: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then - for file in conftest.*; do - case $file in - *.c | *.o | *.obj) ;; - *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; - esac - done - else - { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; } - fi - rm -f conftest* - test x"${ac_cv_exeext}" = x && ac_cv_exeext=no -fi -fi - -EXEEXT="" -test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext} -echo "$ac_t""${ac_cv_exeext}" 1>&6 -ac_exeext=$EXEEXT - # Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! +# find the maximum length of command line arguments +echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5 +echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6 +if test "${lt_cv_sys_max_cmd_len+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + i=0 + teststring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + cygwin* | mingw*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for *BSD + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + esac + +fi + +if test -n "$lt_cv_sys_max_cmd_len" ; then + echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5 +echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6 +else + echo "$as_me:$LINENO: result: none" >&5 +echo "${ECHO_T}none" >&6 +fi + + # Only perform the check for file, if the check method requires it case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then - echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6 -echo "configure:1820: checking for ${ac_tool_prefix}file" >&5 -if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5 +echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6 +if test "${lt_cv_path_MAGIC_CMD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else case $MAGIC_CMD in /*) @@ -1870,17 +3758,19 @@ fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then - echo "$ac_t""$MAGIC_CMD" 1>&6 + echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 +echo "${ECHO_T}$MAGIC_CMD" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then - echo $ac_n "checking for file""... $ac_c" 1>&6 -echo "configure:1882: checking for file" >&5 -if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking for file" >&5 +echo $ECHO_N "checking for file... $ECHO_C" >&6 +if test "${lt_cv_path_MAGIC_CMD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else case $MAGIC_CMD in /*) @@ -1932,9 +3822,11 @@ fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then - echo "$ac_t""$MAGIC_CMD" 1>&6 + echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 +echo "${ECHO_T}$MAGIC_CMD" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi else @@ -1946,138 +3838,164 @@ fi ;; esac -# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1953: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + fi fi -RANLIB="$ac_cv_prog_RANLIB" +RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then - echo "$ac_t""$RANLIB" 1>&6 + echo "$as_me:$LINENO: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - +fi if test -z "$ac_cv_prog_RANLIB"; then -if test -n "$ac_tool_prefix"; then + ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1985: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_RANLIB="ranlib" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" fi fi -RANLIB="$ac_cv_prog_RANLIB" -if test -n "$RANLIB"; then - echo "$ac_t""$RANLIB" 1>&6 +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 +echo "${ECHO_T}$ac_ct_RANLIB" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi + RANLIB=$ac_ct_RANLIB else - RANLIB=":" -fi + RANLIB="$ac_cv_prog_RANLIB" fi -# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2020: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + fi fi -STRIP="$ac_cv_prog_STRIP" +STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then - echo "$ac_t""$STRIP" 1>&6 + echo "$as_me:$LINENO: result: $STRIP" >&5 +echo "${ECHO_T}$STRIP" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - +fi if test -z "$ac_cv_prog_STRIP"; then -if test -n "$ac_tool_prefix"; then + ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2052: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_STRIP="strip" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_STRIP" && ac_cv_prog_STRIP=":" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" fi fi -STRIP="$ac_cv_prog_STRIP" -if test -n "$STRIP"; then - echo "$ac_t""$STRIP" 1>&6 +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 +echo "${ECHO_T}$ac_ct_STRIP" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi + STRIP=$ac_ct_STRIP else - STRIP=":" -fi + STRIP="$ac_cv_prog_STRIP" fi @@ -2093,20 +4011,19 @@ test "$lt_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" # Check whether --enable-libtool-lock or --disable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then enableval="$enable_libtool_lock" - : -fi +fi; test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" + # Check whether --with-pic or --without-pic was given. if test "${with_pic+set}" = set; then withval="$with_pic" pic_mode="$withval" else pic_mode=default -fi - +fi; test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic" test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic" @@ -2115,8 +4032,12 @@ test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic" case $host in *-*-irix6*) # Find out which ABI we are using. - echo '#line 2119 "configure"' > conftest.$ac_ext - if { (eval echo configure:2120: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + echo '#line 4035 "configure"' > conftest.$ac_ext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) @@ -2149,7 +4070,11 @@ case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext - if { (eval echo configure:2153: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then case "`/usr/bin/file conftest.o`" in *ELF-32*) HPUX_IA64_MODE="32" @@ -2162,51 +4087,124 @@ ia64-*-hpux*) rm -rf conftest* ;; +x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + case "`/usr/bin/file conftest.o`" in + *32-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" - echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6 -echo "configure:2171: checking whether the C compiler needs -belf" >&5 -if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5 +echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6 +if test "${lt_cv_cc_needs_belf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - + + ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -int main() { +int +main () +{ -; return 0; } -EOF -if { (eval echo configure:2191: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then lt_cv_cc_needs_belf=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - lt_cv_cc_needs_belf=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +lt_cv_cc_needs_belf=no fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu fi - -echo "$ac_t""$lt_cv_cc_needs_belf" 1>&6 +echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5 +echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6 if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" @@ -2218,54 +4216,61 @@ esac # Save cache, so that ltconfig can load it -cat > confcache <<\EOF +cat >confcache <<\_ACEOF # 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. +# scripts and configure runs, see configure's option --config-cache. +# 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. +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. # -EOF +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. -(set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote substitution - # turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - -e "s/'/'\\\\''/g" \ - -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' - ;; - esac >> confcache -if cmp -s $cache_file confcache; then - : -else +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then - echo "updating cache $cache_file" - cat confcache > $cache_file + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache - # Actually configure libtool. ac_aux_dir is where install-sh is found. AR="$AR" LTCC="$CC" CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ @@ -2275,15 +4280,26 @@ objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ deplibs_check_method="$deplibs_check_method" file_magic_cmd="$file_magic_cmd" \ ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ $libtool_flags --no-verify --build="$build" $ac_aux_dir/ltmain.sh $host \ -|| { echo "configure: error: libtool configure failed" 1>&2; exit 1; } +|| { { echo "$as_me:$LINENO: error: libtool configure failed" >&5 +echo "$as_me: error: libtool configure failed" >&2;} + { (exit 1); exit 1; }; } # Reload cache, that may have been modified by ltconfig if test -r "$cache_file"; then - echo "loading cache $cache_file" - . $cache_file + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi else - echo "creating cache $cache_file" - > $cache_file + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file fi @@ -2297,11 +4313,11 @@ LIBTOOL='$(SHELL) $(top_builddir)/libtool' # clobbered by the next message. exec 5>>./config.log - - - - + + + + # Check whether --enable-64-bit-bfd or --disable-64-bit-bfd was given. if test "${enable_64_bit_bfd+set}" = set; then @@ -2309,85 +4325,142 @@ if test "${enable_64_bit_bfd+set}" = set; then case "${enableval}" in yes) want64=true ;; no) want64=false ;; - *) { echo "configure: error: bad value ${enableval} for 64-bit-bfd option" 1>&2; exit 1; } ;; + *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for 64-bit-bfd option" >&5 +echo "$as_me: error: bad value ${enableval} for 64-bit-bfd option" >&2;} + { (exit 1); exit 1; }; } ;; esac else want64=false -fi -# Check whether --enable-targets or --disable-targets was given. +fi; # Check whether --enable-targets or --disable-targets was given. if test "${enable_targets+set}" = set; then enableval="$enable_targets" case "${enableval}" in - yes | "") { echo "configure: error: enable-targets option must specify target names or 'all'" 1>&2; exit 1; } + yes | "") { { echo "$as_me:$LINENO: error: enable-targets option must specify target names or 'all'" >&5 +echo "$as_me: error: enable-targets option must specify target names or 'all'" >&2;} + { (exit 1); exit 1; }; } ;; no) enable_targets= ;; *) enable_targets=$enableval ;; esac -fi -# Check whether --enable-commonbfdlib or --disable-commonbfdlib was given. +fi; # Check whether --enable-commonbfdlib or --disable-commonbfdlib was given. if test "${enable_commonbfdlib+set}" = set; then enableval="$enable_commonbfdlib" case "${enableval}" in yes) commonbfdlib=true ;; no) commonbfdlib=false ;; - *) { echo "configure: error: bad value ${enableval} for BFD commonbfdlib option" 1>&2; exit 1; } ;; + *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for BFD commonbfdlib option" >&5 +echo "$as_me: error: bad value ${enableval} for BFD commonbfdlib option" >&2;} + { (exit 1); exit 1; }; } ;; esac -fi +fi; # Check whether --with-mmap or --without-mmap was given. if test "${with_mmap+set}" = set; then withval="$with_mmap" case "${withval}" in yes) want_mmap=true ;; no) want_mmap=false ;; - *) { echo "configure: error: bad value ${withval} for BFD with-mmap option" 1>&2; exit 1; } ;; + *) { { echo "$as_me:$LINENO: error: bad value ${withval} for BFD with-mmap option" >&5 +echo "$as_me: error: bad value ${withval} for BFD with-mmap option" >&2;} + { (exit 1); exit 1; }; } ;; esac else want_mmap=false +fi; +# Check whether --enable-secureplt or --disable-secureplt was given. +if test "${enable_secureplt+set}" = set; then + enableval="$enable_secureplt" + case "${enableval}" in + yes) use_secureplt=true ;; + no) use_secureplt=false ;; + *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for secureplt option" >&5 +echo "$as_me: error: bad value ${enableval} for secureplt option" >&2;} + { (exit 1); exit 1; }; } ;; +esac +else + use_secureplt=false +fi; if test $use_secureplt = true; then + +cat >>confdefs.h <<\_ACEOF +#define USE_SECUREPLT 1 +_ACEOF + +fi + + +GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes" + +# Check whether --enable-werror or --disable-werror was given. +if test "${enable_werror+set}" = set; then + enableval="$enable_werror" + case "${enableval}" in + yes | y) ERROR_ON_WARNING="yes" ;; + no | n) ERROR_ON_WARNING="no" ;; + *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-werror" >&5 +echo "$as_me: error: bad value ${enableval} for --enable-werror" >&2;} + { (exit 1); exit 1; }; } ;; + esac +fi; + +# Enable -Werror by default when using gcc +if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then + ERROR_ON_WARNING=yes +fi + +NO_WERROR= +if test "${ERROR_ON_WARNING}" = yes ; then + GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror" + NO_WERROR="-Wno-error" +fi + +if test "${GCC}" = yes ; then + WARN_CFLAGS="${GCC_WARN_CFLAGS}" fi -build_warnings="-W -Wall -Wstrict-prototypes -Wmissing-prototypes" # Check whether --enable-build-warnings or --disable-build-warnings was given. if test "${enable_build_warnings+set}" = set; then enableval="$enable_build_warnings" case "${enableval}" in - yes) ;; - no) build_warnings="-w";; + yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}";; + no) if test "${GCC}" = yes ; then + WARN_CFLAGS="-w" + fi;; ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"` - build_warnings="${build_warnings} ${t}";; + WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";; *,) t=`echo "${enableval}" | sed -e "s/,/ /g"` - build_warnings="${t} ${build_warnings}";; - *) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;; + WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";; + *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;; esac -if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then - echo "Setting warning flags = $build_warnings" 6>&1 -fi -fi -WARN_CFLAGS="" -if test "x${build_warnings}" != x && test "x$GCC" = xyes ; then - WARN_CFLAGS="${build_warnings}" +fi; + +if test x"$silent" != x"yes" && test x"$WARN_CFLAGS" != x""; then + echo "Setting warning flags = $WARN_CFLAGS" 6>&1 fi + ac_config_headers="$ac_config_headers config.h:config.in" + if test -z "$target" ; then - { echo "configure: error: Unrecognized target system type; please check config.sub." 1>&2; exit 1; } + { { echo "$as_me:$LINENO: error: Unrecognized target system type; please check config.sub." >&5 +echo "$as_me: error: Unrecognized target system type; please check config.sub." >&2;} + { (exit 1); exit 1; }; } fi -echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 -echo "configure:2381: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval="$enable_maintainer_mode" USE_MAINTAINER_MODE=$enableval else USE_MAINTAINER_MODE=no -fi +fi; + echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5 +echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6 - echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6 - if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= @@ -2396,11 +4469,27 @@ else MAINTAINER_MODE_TRUE='#' MAINTAINER_MODE_FALSE= fi - MAINT=$MAINTAINER_MODE_TRUE - -echo $ac_n "checking whether to install libbfd""... $ac_c" 1>&6 -echo "configure:2404: checking whether to install libbfd" >&5 + MAINT=$MAINTAINER_MODE_TRUE + + + case ${build_alias} in + "") build_noncanonical=${build} ;; + *) build_noncanonical=${build_alias} ;; +esac + + case ${host_alias} in + "") host_noncanonical=${build_noncanonical} ;; + *) host_noncanonical=${host_alias} ;; +esac + + case ${target_alias} in + "") target_noncanonical=${host_noncanonical} ;; + *) target_noncanonical=${target_alias} ;; +esac + +echo "$as_me:$LINENO: checking whether to install libbfd" >&5 +echo $ECHO_N "checking whether to install libbfd... $ECHO_C" >&6 # Check whether --enable-install-libbfd or --disable-install-libbfd was given. if test "${enable_install_libbfd+set}" = set; then enableval="$enable_install_libbfd" @@ -2411,10 +4500,10 @@ else else install_libbfd_p=no fi -fi +fi; + echo "$as_me:$LINENO: result: $install_libbfd_p" >&5 +echo "${ECHO_T}$install_libbfd_p" >&6 - echo "$ac_t""$install_libbfd_p" 1>&6 - if test $install_libbfd_p = yes; then INSTALL_LIBBFD_TRUE= @@ -2423,49 +4512,23 @@ else INSTALL_LIBBFD_TRUE='#' INSTALL_LIBBFD_FALSE= fi + + # Need _noncanonical variables for this. + + + + # libbfd.a is a host library containing target dependent code bfdlibdir='$(libdir)' bfdincludedir='$(includedir)' if test "${host}" != "${target}"; then - bfdlibdir='$(exec_prefix)/$(host_alias)/$(target_alias)/lib' - bfdincludedir='$(exec_prefix)/$(host_alias)/$(target_alias)/include' + bfdlibdir='$(exec_prefix)/$(host_noncanonical)/$(target_noncanonical)/lib' + bfdincludedir='$(exec_prefix)/$(host_noncanonical)/$(target_noncanonical)/include' fi - - -echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:2441: checking for executable suffix" >&5 -if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$CYGWIN" = yes || test "$MINGW32" = yes; then - ac_cv_exeext=.exe -else - rm -f conftest* - echo 'int main () { return 0; }' > conftest.$ac_ext - ac_cv_exeext= - if { (eval echo configure:2451: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then - for file in conftest.*; do - case $file in - *.c | *.o | *.obj) ;; - *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; - esac - done - else - { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; } - fi - rm -f conftest* - test x"${ac_cv_exeext}" = x && ac_cv_exeext=no -fi -fi - -EXEEXT="" -test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext} -echo "$ac_t""${ac_cv_exeext}" 1>&6 -ac_exeext=$EXEEXT host64=false @@ -2474,214 +4537,458 @@ bfd_default_target_size=32 # host stuff: -# Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2481: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="gcc" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + fi fi -CC="$ac_cv_prog_CC" +CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" fi if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2511: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_prog_rejected=no - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift - if test $# -gt 0; then + if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift - set dummy "$ac_dir/$ac_word" "$@" - shift - ac_cv_prog_CC="$@" + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi -CC="$ac_cv_prog_CC" +CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - if test -z "$CC"; then - case "`uname -s`" in - *win32* | *WIN32*) - # Extract the first word of "cl", so it can be a program name with args. -set dummy cl; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2562: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="cl" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + fi fi -CC="$ac_cv_prog_CC" +CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - ;; - esac + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 fi - test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +done +done + fi - -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:2594: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -cat > conftest.$ac_ext << EOF - -#line 2605 "configure" -#include "confdefs.h" - -main(){return(0);} -EOF -if { (eval echo configure:2610: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - ac_cv_prog_cc_works=yes - # If we can't run a trivial program, we are probably using a cross compiler. - if (./conftest; exit) 2>/dev/null; then - ac_cv_prog_cc_cross=no - else - ac_cv_prog_cc_cross=yes - fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_prog_cc_works=no + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi -rm -fr conftest* -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross -echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 -if test $ac_cv_prog_cc_works = no; then - { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC fi -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:2636: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 -echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 -cross_compiling=$ac_cv_prog_cc_cross -echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:2641: checking whether we are using GNU C" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.c <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me #endif -EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2650: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gcc=yes -else - ac_cv_prog_gcc=no -fi -fi -echo "$ac_t""$ac_cv_prog_gcc" 1>&6 - -if test $ac_cv_prog_gcc = yes; then - GCC=yes + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes else - GCC= + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu -ac_test_CFLAGS="${CFLAGS+set}" -ac_save_CFLAGS="$CFLAGS" -CFLAGS= -echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:2669: checking whether ${CC-cc} accepts -g" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - echo 'void f(){}' > conftest.c -if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else - ac_cv_prog_cc_g=no -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_prog_cc_g=no fi - -echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then - CFLAGS="$ac_save_CFLAGS" + CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" @@ -2695,159 +5002,678 @@ else CFLAGS= fi fi +echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std1 is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std1. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + '' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +#include +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +continue +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu -ALL_LINGUAS="fr tr ja es sv da zh_CN ro" -echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:2703: checking how to run the C preprocessor" >&5 +cat >>confdefs.h <<\_ACEOF +#define _GNU_SOURCE 1 +_ACEOF + + + +ALL_LINGUAS="fr tr ja es sv da zh_CN ro rw vi" +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + echo "$as_me:$LINENO: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 +echo "${ECHO_T}$ac_ct_RANLIB" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + RANLIB=$ac_ct_RANLIB +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then -if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - # This must be in double quotes, not single quotes, because CPP may get - # substituted into the Makefile and "${CC-cc}" will confuse make. - CPP="${CC-cc} -E" + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. - cat > conftest.$ac_ext < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2724: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then : else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -E -traditional-cpp" - cat > conftest.$ac_ext < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2741: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -nologo -E" - cat > conftest.$ac_ext < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2758: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP=/lib/cpp -fi -rm -f conftest* -fi -rm -f conftest* -fi -rm -f conftest* - ac_cv_prog_CPP="$CPP" -fi - CPP="$ac_cv_prog_CPP" -else - ac_cv_prog_CPP="$CPP" -fi -echo "$ac_t""$CPP" 1>&6 + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -# Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2785: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_RANLIB="ranlib" - break + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6 +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6 +if test "${ac_cv_prog_egrep+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if echo a | (grep -E '(a|b)') >/dev/null 2>&1 + then ac_cv_prog_egrep='grep -E' + else ac_cv_prog_egrep='egrep' fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" -fi -fi -RANLIB="$ac_cv_prog_RANLIB" -if test -n "$RANLIB"; then - echo "$ac_t""$RANLIB" 1>&6 -else - echo "$ac_t""no" 1>&6 fi +echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 +echo "${ECHO_T}$ac_cv_prog_egrep" >&6 + EGREP=$ac_cv_prog_egrep -echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:2813: checking for ANSI C header files" >&5 -if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + +echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #include #include #include -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2826: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_header_stdc=yes else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_header_stdc=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdc=no fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. -cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include -EOF + +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "memchr" >/dev/null 2>&1; then + $EGREP "memchr" >/dev/null 2>&1; then : else - rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* @@ -2856,16 +5682,19 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. -cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include -EOF + +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "free" >/dev/null 2>&1; then + $EGREP "free" >/dev/null 2>&1; then : else - rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* @@ -2874,269 +5703,530 @@ fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. -if test "$cross_compiling" = yes; then + if test "$cross_compiling" = yes; then : else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include -#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int main () { int i; for (i = 0; i < 256; i++) -if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); -exit (0); } +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif -EOF -if { (eval echo configure:2893: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then : else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_header_stdc=no -fi -rm -fr conftest* -fi + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi - -echo "$ac_t""$ac_cv_header_stdc" 1>&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 -EOF +_ACEOF fi -echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:2917: checking for working const" >&5 -if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 +echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 +if test "${ac_cv_c_const+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -int main() { +int +main () +{ +/* FIXME: Include the comments suggested by Paul. */ +#ifndef __cplusplus + /* Ultrix mips cc rejects this. */ + typedef int charset[2]; + const charset x; + /* SunOS 4.1.1 cc rejects this. */ + char const *const *ccp; + char **p; + /* NEC SVR4.0.2 mips cc rejects this. */ + struct point {int x, y;}; + static struct point const zero = {0,0}; + /* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in + an arm of an if-expression whose if-part is not a constant + expression */ + const char *g = "string"; + ccp = &g + (g ? g-g : 0); + /* HPUX 7.0 cc rejects these. */ + ++ccp; + p = (char**) ccp; + ccp = (char const *const *) p; + { /* SCO 3.2v4 cc rejects this. */ + char *t; + char const *s = 0 ? (char *) 0 : (char const *) 0; -/* Ultrix mips cc rejects this. */ -typedef int charset[2]; const charset x; -/* SunOS 4.1.1 cc rejects this. */ -char const *const *ccp; -char **p; -/* NEC SVR4.0.2 mips cc rejects this. */ -struct point {int x, y;}; -static struct point const zero = {0,0}; -/* AIX XL C 1.02.0.0 rejects this. - It does not let you subtract one const X* pointer from another in an arm - of an if-expression whose if-part is not a constant expression */ -const char *g = "string"; -ccp = &g + (g ? g-g : 0); -/* HPUX 7.0 cc rejects these. */ -++ccp; -p = (char**) ccp; -ccp = (char const *const *) p; -{ /* SCO 3.2v4 cc rejects this. */ - char *t; - char const *s = 0 ? (char *) 0 : (char const *) 0; + *t++ = 0; + } + { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; + } + { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; + } + { /* AIX XL C 1.02.0.0 rejects this saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; }; + struct s *b; b->j = 5; + } + { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; + } +#endif - *t++ = 0; + ; + return 0; } -{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ - int x[] = {25, 17}; - const int *foo = &x[0]; - ++foo; -} -{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ - typedef const int *iptr; - iptr p = 0; - ++p; -} -{ /* AIX XL C 1.02.0.0 rejects this saying - "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ - struct s { int j; const int *ap[3]; }; - struct s *b; b->j = 5; -} -{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ - const int foo = 10; -} - -; return 0; } -EOF -if { (eval echo configure:2971: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_c_const=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_c_const=no -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -echo "$ac_t""$ac_cv_c_const" 1>&6 +ac_cv_c_const=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 +echo "${ECHO_T}$ac_cv_c_const" >&6 if test $ac_cv_c_const = no; then - cat >> confdefs.h <<\EOF -#define const -EOF + +cat >>confdefs.h <<\_ACEOF +#define const +_ACEOF fi -echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:2992: checking for inline" >&5 -if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for inline" >&5 +echo $ECHO_N "checking for inline... $ECHO_C" >&6 +if test "${ac_cv_c_inline+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifndef __cplusplus +typedef int foo_t; +static $ac_kw foo_t static_foo () {return 0; } +$ac_kw foo_t foo () {return 0; } +#endif -int main() { -} $ac_kw foo() { -; return 0; } -EOF -if { (eval echo configure:3006: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_c_inline=$ac_kw; break else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done fi +echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5 +echo "${ECHO_T}$ac_cv_c_inline" >&6 -echo "$ac_t""$ac_cv_c_inline" 1>&6 -case "$ac_cv_c_inline" in + +case $ac_cv_c_inline in inline | yes) ;; - no) cat >> confdefs.h <<\EOF -#define inline -EOF - ;; - *) cat >> confdefs.h <>confdefs.h <<_ACEOF +#ifndef __cplusplus +#define inline $ac_val +#endif +_ACEOF + ;; esac -echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:3032: checking for off_t" >&5 -if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext < -#if STDC_HEADERS -#include -#include -#endif -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "(^|[^a-zA-Z_0-9])off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then - rm -rf conftest* + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +echo "$as_me:$LINENO: checking for off_t" >&5 +echo $ECHO_N "checking for off_t... $ECHO_C" >&6 +if test "${ac_cv_type_off_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if ((off_t *) 0) + return 0; +if (sizeof (off_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_type_off_t=yes else - rm -rf conftest* - ac_cv_type_off_t=no -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_type_off_t=no fi -echo "$ac_t""$ac_cv_type_off_t" 1>&6 -if test $ac_cv_type_off_t = no; then - cat >> confdefs.h <<\EOF -#define off_t long -EOF - +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi - -echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:3065: checking for size_t" >&5 -if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5 +echo "${ECHO_T}$ac_cv_type_off_t" >&6 +if test $ac_cv_type_off_t = yes; then + : else - cat > conftest.$ac_ext < -#if STDC_HEADERS -#include -#include -#endif -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then - rm -rf conftest* + +cat >>confdefs.h <<_ACEOF +#define off_t long +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for size_t" >&5 +echo $ECHO_N "checking for size_t... $ECHO_C" >&6 +if test "${ac_cv_type_size_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if ((size_t *) 0) + return 0; +if (sizeof (size_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_type_size_t=yes else - rm -rf conftest* - ac_cv_type_size_t=no -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_type_size_t=no fi -echo "$ac_t""$ac_cv_type_size_t" 1>&6 -if test $ac_cv_type_size_t = no; then - cat >> confdefs.h <<\EOF +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 +echo "${ECHO_T}$ac_cv_type_size_t" >&6 +if test $ac_cv_type_size_t = yes; then + : +else + +cat >>confdefs.h <<_ACEOF #define size_t unsigned -EOF +_ACEOF fi # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! -echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:3100: checking for working alloca.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for working alloca.h" >&5 +echo $ECHO_N "checking for working alloca.h... $ECHO_C" >&6 +if test "${ac_cv_working_alloca_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include -int main() { -char *p = alloca(2 * sizeof(int)); -; return 0; } -EOF -if { (eval echo configure:3112: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - ac_cv_header_alloca_h=yes +int +main () +{ +char *p = (char *) alloca (2 * sizeof (int)); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_working_alloca_h=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_header_alloca_h=no -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -echo "$ac_t""$ac_cv_header_alloca_h" 1>&6 -if test $ac_cv_header_alloca_h = yes; then - cat >> confdefs.h <<\EOF +ac_cv_working_alloca_h=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_working_alloca_h" >&5 +echo "${ECHO_T}$ac_cv_working_alloca_h" >&6 +if test $ac_cv_working_alloca_h = yes; then + +cat >>confdefs.h <<\_ACEOF #define HAVE_ALLOCA_H 1 -EOF +_ACEOF fi -echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:3133: checking for alloca" >&5 -if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for alloca" >&5 +echo $ECHO_N "checking for alloca... $ECHO_C" >&6 +if test "${ac_cv_func_alloca_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #ifdef __GNUC__ # define alloca __builtin_alloca #else @@ -3158,137 +6248,217 @@ char *alloca (); # endif #endif -int main() { -char *p = (char *) alloca(1); -; return 0; } -EOF -if { (eval echo configure:3166: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* +int +main () +{ +char *p = (char *) alloca (1); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_func_alloca_works=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_func_alloca_works=no -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_alloca_works=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_alloca_works" >&5 +echo "${ECHO_T}$ac_cv_func_alloca_works" >&6 -echo "$ac_t""$ac_cv_func_alloca_works" 1>&6 if test $ac_cv_func_alloca_works = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_ALLOCA 1 -EOF +_ACEOF -fi - -if test $ac_cv_func_alloca_works = no; then - # The SVR3 libPW and SVR4 libucb both contain incompatible functions - # that cause trouble. Some versions do not even contain alloca or - # contain a buggy version. If you still want to use their alloca, - # use ar to extract alloca.o from them instead of compiling alloca.c. - ALLOCA=alloca.${ac_objext} - cat >> confdefs.h <<\EOF -#define C_ALLOCA 1 -EOF - - -echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:3198: checking whether alloca needs Cray hooks" >&5 -if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 else - cat > conftest.$ac_ext <>confdefs.h <<\_ACEOF +#define C_ALLOCA 1 +_ACEOF + + +echo "$as_me:$LINENO: checking whether \`alloca.c' needs Cray hooks" >&5 +echo $ECHO_N "checking whether \`alloca.c' needs Cray hooks... $ECHO_C" >&6 +if test "${ac_cv_os_cray+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #if defined(CRAY) && ! defined(CRAY2) webecray #else wenotbecray #endif -EOF +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "webecray" >/dev/null 2>&1; then - rm -rf conftest* + $EGREP "webecray" >/dev/null 2>&1; then ac_cv_os_cray=yes else - rm -rf conftest* ac_cv_os_cray=no fi rm -f conftest* fi - -echo "$ac_t""$ac_cv_os_cray" 1>&6 +echo "$as_me:$LINENO: result: $ac_cv_os_cray" >&5 +echo "${ECHO_T}$ac_cv_os_cray" >&6 if test $ac_cv_os_cray = yes; then -for ac_func in _getb67 GETB67 getb67; do - echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3228: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + for ac_func in _getb67 GETB67 getb67; do + as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - + builtin and then its argument prototype would still apply. */ +char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif -; return 0; } -EOF -if { (eval echo configure:3256: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - cat >> confdefs.h <&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + +cat >>confdefs.h <<_ACEOF #define CRAY_STACKSEG_END $ac_func -EOF +_ACEOF - break -else - echo "$ac_t""no" 1>&6 + break fi -done + done fi -echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:3283: checking stack direction for C alloca" >&5 -if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking stack direction for C alloca" >&5 +echo $ECHO_N "checking stack direction for C alloca... $ECHO_C" >&6 +if test "${ac_cv_c_stack_direction+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_c_stack_direction=0 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +int find_stack_direction () { static char *addr = 0; @@ -3301,138 +6471,316 @@ find_stack_direction () else return (&dummy > addr) ? 1 : -1; } + +int main () { - exit (find_stack_direction() < 0); + exit (find_stack_direction () < 0); } -EOF -if { (eval echo configure:3310: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_c_stack_direction=1 else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_c_stack_direction=-1 -fi -rm -fr conftest* -fi + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +( exit $ac_status ) +ac_cv_c_stack_direction=-1 fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_c_stack_direction" >&5 +echo "${ECHO_T}$ac_cv_c_stack_direction" >&6 -echo "$ac_t""$ac_cv_c_stack_direction" 1>&6 -cat >> confdefs.h <>confdefs.h <<_ACEOF #define STACK_DIRECTION $ac_cv_c_stack_direction -EOF +_ACEOF + fi -for ac_hdr in unistd.h + + +for ac_header in stdlib.h unistd.h do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3335: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3345: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else - echo "$ac_t""no" 1>&6 + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + done + for ac_func in getpagesize do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3374: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - + builtin and then its argument prototype would still apply. */ +char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif -; return 0; } -EOF -if { (eval echo configure:3402: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 fi done -echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:3427: checking for working mmap" >&5 -if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for working mmap" >&5 +echo $ECHO_N "checking for working mmap... $ECHO_C" >&6 +if test "${ac_cv_func_mmap_fixed_mapped+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_func_mmap_fixed_mapped=no else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +/* malloc might have been renamed as rpl_malloc. */ +#undef malloc /* Thanks to Mike Haertel and Jim Avera for this test. Here is a matrix of mmap possibilities: @@ -3446,34 +6794,34 @@ else back from the file, nor mmap's back from the file at a different address. (There have been systems where private was not correctly implemented like the infamous i386 svr4.0, and systems where the - VM page cache was not coherent with the filesystem buffer cache + VM page cache was not coherent with the file system buffer cache like early versions of FreeBSD and possibly contemporary NetBSD.) For shared mappings, we should conversely verify that changes get - propogated back to all the places they're supposed to be. + propagated back to all the places they're supposed to be. Grep wants private fixed already mapped. The main things grep needs to know about mmap are: * does it exist and is it safe to write into the mmap'd area * how to use it (BSD variants) */ -#include + #include #include -/* This mess was copied from the GNU getpagesize.h. */ -#ifndef HAVE_GETPAGESIZE -# ifdef HAVE_UNISTD_H -# include -# endif +#if !STDC_HEADERS && !HAVE_STDLIB_H +char *malloc (); +#endif +/* This mess was copied from the GNU getpagesize.h. */ +#if !HAVE_GETPAGESIZE /* Assume that all systems that can run configure have sys/param.h. */ -# ifndef HAVE_SYS_PARAM_H +# if !HAVE_SYS_PARAM_H # define HAVE_SYS_PARAM_H 1 # endif # ifdef _SC_PAGESIZE # define getpagesize() sysconf(_SC_PAGESIZE) # else /* no _SC_PAGESIZE */ -# ifdef HAVE_SYS_PARAM_H +# if HAVE_SYS_PARAM_H # include # ifdef EXEC_PAGESIZE # define getpagesize() EXEC_PAGESIZE @@ -3500,469 +6848,910 @@ else #endif /* no HAVE_GETPAGESIZE */ -#ifdef __cplusplus -extern "C" { void *malloc(unsigned); } -#else -char *malloc(); -#endif - int -main() +main () { - char *data, *data2, *data3; - int i, pagesize; - int fd; + char *data, *data2, *data3; + int i, pagesize; + int fd; - pagesize = getpagesize(); + pagesize = getpagesize (); - /* - * First, make a file with some known garbage in it. - */ - data = malloc(pagesize); - if (!data) - exit(1); - for (i = 0; i < pagesize; ++i) - *(data + i) = rand(); - umask(0); - fd = creat("conftestmmap", 0600); - if (fd < 0) - exit(1); - if (write(fd, data, pagesize) != pagesize) - exit(1); - close(fd); + /* First, make a file with some known garbage in it. */ + data = (char *) malloc (pagesize); + if (!data) + exit (1); + for (i = 0; i < pagesize; ++i) + *(data + i) = rand (); + umask (0); + fd = creat ("conftest.mmap", 0600); + if (fd < 0) + exit (1); + if (write (fd, data, pagesize) != pagesize) + exit (1); + close (fd); - /* - * Next, try to mmap the file at a fixed address which - * already has something else allocated at it. If we can, - * also make sure that we see the same garbage. - */ - fd = open("conftestmmap", O_RDWR); - if (fd < 0) - exit(1); - data2 = malloc(2 * pagesize); - if (!data2) - exit(1); - data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1); - if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_FIXED, fd, 0L)) - exit(1); - for (i = 0; i < pagesize; ++i) - if (*(data + i) != *(data2 + i)) - exit(1); + /* Next, try to mmap the file at a fixed address which already has + something else allocated at it. If we can, also make sure that + we see the same garbage. */ + fd = open ("conftest.mmap", O_RDWR); + if (fd < 0) + exit (1); + data2 = (char *) malloc (2 * pagesize); + if (!data2) + exit (1); + data2 += (pagesize - ((long) data2 & (pagesize - 1))) & (pagesize - 1); + if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_FIXED, fd, 0L)) + exit (1); + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data2 + i)) + exit (1); - /* - * Finally, make sure that changes to the mapped area - * do not percolate back to the file as seen by read(). - * (This is a bug on some variants of i386 svr4.0.) - */ - for (i = 0; i < pagesize; ++i) - *(data2 + i) = *(data2 + i) + 1; - data3 = malloc(pagesize); - if (!data3) - exit(1); - if (read(fd, data3, pagesize) != pagesize) - exit(1); - for (i = 0; i < pagesize; ++i) - if (*(data + i) != *(data3 + i)) - exit(1); - close(fd); - unlink("conftestmmap"); - exit(0); + /* Finally, make sure that changes to the mapped area do not + percolate back to the file as seen by read(). (This is a bug on + some variants of i386 svr4.0.) */ + for (i = 0; i < pagesize; ++i) + *(data2 + i) = *(data2 + i) + 1; + data3 = (char *) malloc (pagesize); + if (!data3) + exit (1); + if (read (fd, data3, pagesize) != pagesize) + exit (1); + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data3 + i)) + exit (1); + close (fd); + exit (0); } - -EOF -if { (eval echo configure:3575: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_func_mmap_fixed_mapped=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_func_mmap_fixed_mapped=no -fi -rm -fr conftest* -fi + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +( exit $ac_status ) +ac_cv_func_mmap_fixed_mapped=no fi - -echo "$ac_t""$ac_cv_func_mmap_fixed_mapped" 1>&6 +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_func_mmap_fixed_mapped" >&5 +echo "${ECHO_T}$ac_cv_func_mmap_fixed_mapped" >&6 if test $ac_cv_func_mmap_fixed_mapped = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_MMAP 1 -EOF +_ACEOF fi +rm -f conftest.mmap - - for ac_hdr in argz.h limits.h locale.h nl_types.h malloc.h string.h \ + + + + + + + + + + +for ac_header in argz.h limits.h locale.h nl_types.h malloc.h string.h \ unistd.h values.h sys/param.h do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3603: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3613: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else - echo "$ac_t""no" 1>&6 + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + done - for ac_func in getcwd munmap putenv setenv setlocale strchr strcasecmp \ + + + + + + + + + + +for ac_func in getcwd munmap putenv setenv setlocale strchr strcasecmp \ __argz_count __argz_stringify __argz_next do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3643: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - + builtin and then its argument prototype would still apply. */ +char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif -; return 0; } -EOF -if { (eval echo configure:3671: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 fi done if test "${ac_cv_func_stpcpy+set}" != "set"; then - for ac_func in stpcpy + +for ac_func in stpcpy do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3700: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - + builtin and then its argument prototype would still apply. */ +char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif -; return 0; } -EOF -if { (eval echo configure:3728: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 fi done fi if test "${ac_cv_func_stpcpy}" = "yes"; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_STPCPY 1 -EOF +_ACEOF fi if test $ac_cv_header_locale_h = yes; then - echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6 -echo "configure:3762: checking for LC_MESSAGES" >&5 -if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking for LC_MESSAGES" >&5 +echo $ECHO_N "checking for LC_MESSAGES... $ECHO_C" >&6 +if test "${am_cv_val_LC_MESSAGES+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include -int main() { +int +main () +{ return LC_MESSAGES -; return 0; } -EOF -if { (eval echo configure:3774: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then am_cv_val_LC_MESSAGES=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - am_cv_val_LC_MESSAGES=no -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -echo "$ac_t""$am_cv_val_LC_MESSAGES" 1>&6 +am_cv_val_LC_MESSAGES=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $am_cv_val_LC_MESSAGES" >&5 +echo "${ECHO_T}$am_cv_val_LC_MESSAGES" >&6 if test $am_cv_val_LC_MESSAGES = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_LC_MESSAGES 1 -EOF +_ACEOF fi fi - echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6 -echo "configure:3795: checking whether NLS is requested" >&5 + echo "$as_me:$LINENO: checking whether NLS is requested" >&5 +echo $ECHO_N "checking whether NLS is requested... $ECHO_C" >&6 # Check whether --enable-nls or --disable-nls was given. if test "${enable_nls+set}" = set; then enableval="$enable_nls" USE_NLS=$enableval else USE_NLS=yes -fi +fi; + echo "$as_me:$LINENO: result: $USE_NLS" >&5 +echo "${ECHO_T}$USE_NLS" >&6 - echo "$ac_t""$USE_NLS" 1>&6 - USE_INCLUDED_LIBINTL=no if test "$USE_NLS" = "yes"; then - cat >> confdefs.h <<\EOF -#define ENABLE_NLS 1 -EOF + echo "$as_me:$LINENO: checking whether included gettext is requested" >&5 +echo $ECHO_N "checking whether included gettext is requested... $ECHO_C" >&6 - echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6 -echo "configure:3815: checking whether included gettext is requested" >&5 - # Check whether --with-included-gettext or --without-included-gettext was given. +# Check whether --with-included-gettext or --without-included-gettext was given. if test "${with_included_gettext+set}" = set; then withval="$with_included_gettext" nls_cv_force_use_gnu_gettext=$withval else nls_cv_force_use_gnu_gettext=no -fi - - echo "$ac_t""$nls_cv_force_use_gnu_gettext" 1>&6 +fi; + echo "$as_me:$LINENO: result: $nls_cv_force_use_gnu_gettext" >&5 +echo "${ECHO_T}$nls_cv_force_use_gnu_gettext" >&6 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" if test "$nls_cv_force_use_gnu_gettext" != "yes"; then nls_cv_header_intl= nls_cv_header_libgt= - CATOBJEXT=NONE + CATOBJEXT= - ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for libintl.h""... $ac_c" 1>&6 -echo "configure:3834: checking for libintl.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3844: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" + if test "${ac_cv_header_libintl_h+set}" = set; then + echo "$as_me:$LINENO: checking for libintl.h" >&5 +echo $ECHO_N "checking for libintl.h... $ECHO_C" >&6 +if test "${ac_cv_header_libintl_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - echo $ac_n "checking for gettext in libc""... $ac_c" 1>&6 -echo "configure:3861: checking for gettext in libc" >&5 -if eval "test \"`echo '$''{'gt_cv_func_gettext_libc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: result: $ac_cv_header_libintl_h" >&5 +echo "${ECHO_T}$ac_cv_header_libintl_h" >&6 else - cat > conftest.$ac_ext <&5 +echo $ECHO_N "checking libintl.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default #include -int main() { +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking libintl.h presence" >&5 +echo $ECHO_N "checking libintl.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: libintl.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: libintl.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: libintl.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: libintl.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: libintl.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: libintl.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: libintl.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: libintl.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: libintl.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: libintl.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: libintl.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: libintl.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: libintl.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: libintl.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: libintl.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: libintl.h: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for libintl.h" >&5 +echo $ECHO_N "checking for libintl.h... $ECHO_C" >&6 +if test "${ac_cv_header_libintl_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_libintl_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_libintl_h" >&5 +echo "${ECHO_T}$ac_cv_header_libintl_h" >&6 + +fi +if test $ac_cv_header_libintl_h = yes; then + echo "$as_me:$LINENO: checking for gettext in libc" >&5 +echo $ECHO_N "checking for gettext in libc... $ECHO_C" >&6 +if test "${gt_cv_func_gettext_libc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ return (int) gettext ("") -; return 0; } -EOF -if { (eval echo configure:3873: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then gt_cv_func_gettext_libc=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - gt_cv_func_gettext_libc=no -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -echo "$ac_t""$gt_cv_func_gettext_libc" 1>&6 +gt_cv_func_gettext_libc=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $gt_cv_func_gettext_libc" >&5 +echo "${ECHO_T}$gt_cv_func_gettext_libc" >&6 if test "$gt_cv_func_gettext_libc" != "yes"; then - echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6 -echo "configure:3889: checking for bindtextdomain in -lintl" >&5 -ac_lib_var=`echo intl'_'bindtextdomain | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking for bindtextdomain in -lintl" >&5 +echo $ECHO_N "checking for bindtextdomain in -lintl... $ECHO_C" >&6 +if test "${ac_cv_lib_intl_bindtextdomain+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_LIBS="$LIBS" + ac_check_lib_save_LIBS=$LIBS LIBS="-lintl $LIBS" -cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char bindtextdomain(); - -int main() { -bindtextdomain() -; return 0; } -EOF -if { (eval echo configure:3908: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" + builtin and then its argument prototype would still apply. */ +char bindtextdomain (); +int +main () +{ +bindtextdomain (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_intl_bindtextdomain=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_lib_intl_bindtextdomain=no fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - echo $ac_n "checking for gettext in libintl""... $ac_c" 1>&6 -echo "configure:3924: checking for gettext in libintl" >&5 -if eval "test \"`echo '$''{'gt_cv_func_gettext_libintl'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_intl_bindtextdomain" >&5 +echo "${ECHO_T}$ac_cv_lib_intl_bindtextdomain" >&6 +if test $ac_cv_lib_intl_bindtextdomain = yes; then + echo "$as_me:$LINENO: checking for gettext in libintl" >&5 +echo $ECHO_N "checking for gettext in libintl... $ECHO_C" >&6 +if test "${gt_cv_func_gettext_libintl+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -int main() { +int +main () +{ return (int) gettext ("") -; return 0; } -EOF -if { (eval echo configure:3936: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then gt_cv_func_gettext_libintl=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - gt_cv_func_gettext_libintl=no -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -echo "$ac_t""$gt_cv_func_gettext_libintl" 1>&6 -else - echo "$ac_t""no" 1>&6 +gt_cv_func_gettext_libintl=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $gt_cv_func_gettext_libintl" >&5 +echo "${ECHO_T}$gt_cv_func_gettext_libintl" >&6 fi fi if test "$gt_cv_func_gettext_libc" = "yes" \ || test "$gt_cv_func_gettext_libintl" = "yes"; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_GETTEXT 1 -EOF +_ACEOF # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3964: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_MSGFMT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else case "$MSGFMT" in /*) @@ -3986,108 +7775,161 @@ esac fi MSGFMT="$ac_cv_path_MSGFMT" if test -n "$MSGFMT"; then - echo "$ac_t""$MSGFMT" 1>&6 + echo "$as_me:$LINENO: result: $MSGFMT" >&5 +echo "${ECHO_T}$MSGFMT" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi if test "$MSGFMT" != "no"; then - for ac_func in dcgettext + +for ac_func in dcgettext do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3998: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - + builtin and then its argument prototype would still apply. */ +char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif -; return 0; } -EOF -if { (eval echo configure:4026: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 fi done # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4053: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_GMSGFMT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - case "$GMSGFMT" in - /*) + case $GMSGFMT in + [\\/]* | ?:[\\/]*) ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. ;; - ?:/*) - ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path. - ;; *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_path_GMSGFMT="$ac_dir/$ac_word" - break - fi - done - IFS="$ac_save_ifs" + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" ;; esac fi -GMSGFMT="$ac_cv_path_GMSGFMT" +GMSGFMT=$ac_cv_path_GMSGFMT + if test -n "$GMSGFMT"; then - echo "$ac_t""$GMSGFMT" 1>&6 + echo "$as_me:$LINENO: result: $GMSGFMT" >&5 +echo "${ECHO_T}$GMSGFMT" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4089: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_XGETTEXT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else case "$XGETTEXT" in /*) @@ -4111,44 +7953,75 @@ esac fi XGETTEXT="$ac_cv_path_XGETTEXT" if test -n "$XGETTEXT"; then - echo "$ac_t""$XGETTEXT" 1>&6 + echo "$as_me:$LINENO: result: $XGETTEXT" >&5 +echo "${ECHO_T}$XGETTEXT" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -int main() { +int +main () +{ extern int _nl_msg_cat_cntr; return _nl_msg_cat_cntr -; return 0; } -EOF -if { (eval echo configure:4129: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then CATOBJEXT=.gmo DATADIRNAME=share else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CATOBJEXT=.mo + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +CATOBJEXT=.mo DATADIRNAME=lib fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext INSTOBJEXT=.mo fi fi - -else - echo "$ac_t""no" 1>&6 + fi - - if test "$CATOBJEXT" = "NONE"; then - nls_cv_use_gnu_gettext=yes + + + if test x"$CATOBJEXT" = x && test -d $srcdir/../intl; then + # Neither gettext nor catgets in included in the C library. + # Fall back on GNU gettext library (assuming it is present). + nls_cv_use_gnu_gettext=yes fi fi @@ -4156,10 +8029,10 @@ fi INTLOBJS="\$(GETTOBJS)" # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4161: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_MSGFMT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else case "$MSGFMT" in /*) @@ -4183,53 +8056,59 @@ esac fi MSGFMT="$ac_cv_path_MSGFMT" if test -n "$MSGFMT"; then - echo "$ac_t""$MSGFMT" 1>&6 + echo "$as_me:$LINENO: result: $MSGFMT" >&5 +echo "${ECHO_T}$MSGFMT" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4195: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_GMSGFMT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - case "$GMSGFMT" in - /*) + case $GMSGFMT in + [\\/]* | ?:[\\/]*) ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. ;; - ?:/*) - ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path. - ;; *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_path_GMSGFMT="$ac_dir/$ac_word" - break - fi - done - IFS="$ac_save_ifs" + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" ;; esac fi -GMSGFMT="$ac_cv_path_GMSGFMT" +GMSGFMT=$ac_cv_path_GMSGFMT + if test -n "$GMSGFMT"; then - echo "$ac_t""$GMSGFMT" 1>&6 + echo "$as_me:$LINENO: result: $GMSGFMT" >&5 +echo "${ECHO_T}$GMSGFMT" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4231: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_XGETTEXT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else case "$XGETTEXT" in /*) @@ -4253,12 +8132,14 @@ esac fi XGETTEXT="$ac_cv_path_XGETTEXT" if test -n "$XGETTEXT"; then - echo "$ac_t""$XGETTEXT" 1>&6 + echo "$as_me:$LINENO: result: $XGETTEXT" >&5 +echo "${ECHO_T}$XGETTEXT" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - + USE_INCLUDED_LIBINTL=yes CATOBJEXT=.gmo INSTOBJEXT=.mo @@ -4274,7 +8155,8 @@ fi if $XGETTEXT --omit-header /dev/null 2> /dev/null; then : ; else - echo "$ac_t""found xgettext programs is not GNU xgettext; ignore it" 1>&6 + echo "$as_me:$LINENO: result: found xgettext programs is not GNU xgettext; ignore it" >&5 +echo "${ECHO_T}found xgettext programs is not GNU xgettext; ignore it" >&6 XGETTEXT=":" fi fi @@ -4299,25 +8181,32 @@ fi POFILES="$POFILES $lang.po" done - - - - - - - - - - - - + + + + + + + + + + + + if test "x$CATOBJEXT" != "x"; then + +cat >>confdefs.h <<\_ACEOF +#define ENABLE_NLS 1 +_ACEOF + + fi + if test "x$CATOBJEXT" != "x"; then if test "x$ALL_LINGUAS" = "x"; then LINGUAS= else - echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6 -echo "configure:4321: checking for catalogs to be installed" >&5 + echo "$as_me:$LINENO: checking for catalogs to be installed" >&5 +echo $ECHO_N "checking for catalogs to be installed... $ECHO_C" >&6 NEW_LINGUAS= for lang in ${LINGUAS=$ALL_LINGUAS}; do case "$ALL_LINGUAS" in @@ -4325,7 +8214,8 @@ echo "configure:4321: checking for catalogs to be installed" >&5 esac done LINGUAS=$NEW_LINGUAS - echo "$ac_t""$LINGUAS" 1>&6 + echo "$as_me:$LINENO: result: $LINGUAS" >&5 +echo "${ECHO_T}$LINGUAS" >&6 fi if test -n "$LINGUAS"; then @@ -4339,45 +8229,155 @@ echo "configure:4321: checking for catalogs to be installed" >&5 INCLUDE_LOCALE_H="\ /* The system does not provide the header . Take care yourself. */" fi - + if test -f $srcdir/po2tbl.sed.in; then if test "$CATOBJEXT" = ".cat"; then - ac_safe=`echo "linux/version.h" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for linux/version.h""... $ac_c" 1>&6 -echo "configure:4349: checking for linux/version.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + if test "${ac_cv_header_linux_version_h+set}" = set; then + echo "$as_me:$LINENO: checking for linux/version.h" >&5 +echo $ECHO_N "checking for linux/version.h... $ECHO_C" >&6 +if test "${ac_cv_header_linux_version_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_linux_version_h" >&5 +echo "${ECHO_T}$ac_cv_header_linux_version_h" >&6 else - cat > conftest.$ac_ext <&5 +echo $ECHO_N "checking linux/version.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default #include -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4359: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking linux/version.h presence" >&5 +echo $ECHO_N "checking linux/version.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: linux/version.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: linux/version.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: linux/version.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: linux/version.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: linux/version.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: linux/version.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: linux/version.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: linux/version.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: linux/version.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: linux/version.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: linux/version.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: linux/version.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: linux/version.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: linux/version.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: linux/version.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: linux/version.h: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for linux/version.h" >&5 +echo $ECHO_N "checking for linux/version.h... $ECHO_C" >&6 +if test "${ac_cv_header_linux_version_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_linux_version_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_linux_version_h" >&5 +echo "${ECHO_T}$ac_cv_header_linux_version_h" >&6 + +fi +if test $ac_cv_header_linux_version_h = yes; then msgformat=linux else - echo "$ac_t""no" 1>&6 -msgformat=xopen + msgformat=xopen fi + sed -e '/^#/d' $srcdir/$msgformat-msg.sed > po2msg.sed fi sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \ @@ -4391,14 +8391,14 @@ fi GT_NO= GT_YES="#YES#" fi - - + + MKINSTALLDIRS="\$(srcdir)/../../mkinstalldirs" - + l= - + if test -f $srcdir/po/POTFILES.in; then test -d po || mkdir po @@ -4415,7 +8415,7 @@ fi sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \ < $srcdir/po/POTFILES.in > po/POTFILES fi - + # Permit host specific settings. . ${srcdir}/configure.host @@ -4428,60 +8428,75 @@ fi # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs # 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" +# OS/2's system install, which has a completely different semantic # ./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:4437: checking for a BSD compatible install" >&5 +echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then -if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" - for ac_dir in $PATH; do - # Account for people who put trailing slashes in PATH elements. - case "$ac_dir/" in - /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - if test -f $ac_dir/$ac_prog; then + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ + /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 + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && - grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : else - ac_cv_path_install="$ac_dir/$ac_prog -c" - break 2 + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 fi fi done - ;; - esac - done - IFS="$ac_save_IFS" + done + ;; +esac +done + fi if test "${ac_cv_path_install+set}" = set; then - INSTALL="$ac_cv_path_install" + 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" + INSTALL=$ac_install_sh fi fi -echo "$ac_t""$INSTALL" 1>&6 +echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' @@ -4492,112 +8507,890 @@ BFD_HOST_64_BIT_DEFINED=0 BFD_HOST_64_BIT= BFD_HOST_U_64_BIT= -echo $ac_n "checking for long long""... $ac_c" 1>&6 -echo "configure:4497: checking for long long" >&5 -if eval "test \"`echo '$''{'bfd_cv_has_long_long'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for long long" >&5 +echo $ECHO_N "checking for long long... $ECHO_C" >&6 +if test "${bfd_cv_has_long_long+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -int main() { +int +main () +{ unsigned long long ll = 18446744073709551615ULL; -; return 0; } -EOF -if { (eval echo configure:4509: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then bfd_cv_has_long_long=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - bfd_cv_has_long_long=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +bfd_cv_has_long_long=no fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$ac_t""$bfd_cv_has_long_long" 1>&6 +echo "$as_me:$LINENO: result: $bfd_cv_has_long_long" >&5 +echo "${ECHO_T}$bfd_cv_has_long_long" >&6 if test $bfd_cv_has_long_long = yes; then BFD_HOST_LONG_LONG=1 - echo $ac_n "checking size of long long""... $ac_c" 1>&6 -echo "configure:4525: checking size of long long" >&5 -if eval "test \"`echo '$''{'ac_cv_sizeof_long_long'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking for long long" >&5 +echo $ECHO_N "checking for long long... $ECHO_C" >&6 +if test "${ac_cv_type_long_long+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence. - cat > conftest.$ac_ext < - - -int main() { -switch (0) case 0: case (sizeof (long long) == $ac_size):; -; return 0; } -EOF -if { (eval echo configure:4541: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_sizeof_long_long=$ac_size + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if ((long long *) 0) + return 0; +if (sizeof (long long)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_long_long=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_long_long=no fi -rm -f conftest* - if test x$ac_cv_sizeof_long_long != x ; then break; fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_long_long" >&5 +echo "${ECHO_T}$ac_cv_type_long_long" >&6 + +echo "$as_me:$LINENO: checking size of long long" >&5 +echo $ECHO_N "checking size of long long... $ECHO_C" >&6 +if test "${ac_cv_sizeof_long_long+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$ac_cv_type_long_long" = yes; then + # The cast to unsigned long works around a bug in the HP C Compiler + # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects + # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. + # This bug is HP SR number 8606223364. + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (long long))) >= 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (long long))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (long long))) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (long long))) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo= ac_hi= +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (long long))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo=`expr '(' $ac_mid ')' + 1` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done +case $ac_lo in +?*) ac_cv_sizeof_long_long=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long long), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (long long), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } ;; +esac +else + if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run test program while cross compiling +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +long longval () { return (long) (sizeof (long long)); } +unsigned long ulongval () { return (long) (sizeof (long long)); } +#include +#include +int +main () +{ -fi + FILE *f = fopen ("conftest.val", "w"); + if (! f) + exit (1); + if (((long) (sizeof (long long))) < 0) + { + long i = longval (); + if (i != ((long) (sizeof (long long)))) + exit (1); + fprintf (f, "%ld\n", i); + } + else + { + unsigned long i = ulongval (); + if (i != ((long) (sizeof (long long)))) + exit (1); + fprintf (f, "%lu\n", i); + } + exit (ferror (f) || fclose (f) != 0); -if test x$ac_cv_sizeof_long_long = x ; then - { echo "configure: error: cannot determine a size for long long" 1>&2; exit 1; } + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sizeof_long_long=`cat conftest.val` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (long long), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (long long), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } fi -echo "$ac_t""$ac_cv_sizeof_long_long" 1>&6 -cat >> confdefs.h <&5 +echo "${ECHO_T}$ac_cv_sizeof_long_long" >&6 +cat >>confdefs.h <<_ACEOF #define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long -EOF +_ACEOF fi -echo $ac_n "checking size of long""... $ac_c" 1>&6 -echo "configure:4566: checking size of long" >&5 -if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for long" >&5 +echo $ECHO_N "checking for long... $ECHO_C" >&6 +if test "${ac_cv_type_long+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence. - cat > conftest.$ac_ext < - - -int main() { -switch (0) case 0: case (sizeof (long) == $ac_size):; -; return 0; } -EOF -if { (eval echo configure:4582: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_sizeof_long=$ac_size + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if ((long *) 0) + return 0; +if (sizeof (long)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_long=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_long=no fi -rm -f conftest* - if test x$ac_cv_sizeof_long != x ; then break; fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_long" >&5 +echo "${ECHO_T}$ac_cv_type_long" >&6 + +echo "$as_me:$LINENO: checking size of long" >&5 +echo $ECHO_N "checking size of long... $ECHO_C" >&6 +if test "${ac_cv_sizeof_long+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$ac_cv_type_long" = yes; then + # The cast to unsigned long works around a bug in the HP C Compiler + # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects + # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. + # This bug is HP SR number 8606223364. + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (long))) >= 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (long))) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (long))) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo= ac_hi= +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo=`expr '(' $ac_mid ')' + 1` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done +case $ac_lo in +?*) ac_cv_sizeof_long=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (long), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } ;; +esac +else + if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run test program while cross compiling +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +long longval () { return (long) (sizeof (long)); } +unsigned long ulongval () { return (long) (sizeof (long)); } +#include +#include +int +main () +{ -fi + FILE *f = fopen ("conftest.val", "w"); + if (! f) + exit (1); + if (((long) (sizeof (long))) < 0) + { + long i = longval (); + if (i != ((long) (sizeof (long)))) + exit (1); + fprintf (f, "%ld\n", i); + } + else + { + unsigned long i = ulongval (); + if (i != ((long) (sizeof (long)))) + exit (1); + fprintf (f, "%lu\n", i); + } + exit (ferror (f) || fclose (f) != 0); -if test x$ac_cv_sizeof_long = x ; then - { echo "configure: error: cannot determine a size for long" 1>&2; exit 1; } + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sizeof_long=`cat conftest.val` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (long), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } fi -echo "$ac_t""$ac_cv_sizeof_long" 1>&6 -cat >> confdefs.h <&5 +echo "${ECHO_T}$ac_cv_sizeof_long" >&6 +cat >>confdefs.h <<_ACEOF #define SIZEOF_LONG $ac_cv_sizeof_long -EOF +_ACEOF if test "x${ac_cv_sizeof_long}" = "x8"; then @@ -4635,10 +9428,10 @@ fi if test "x$cross_compiling" = "xno"; then EXEEXT_FOR_BUILD='$(EXEEXT)' else - echo $ac_n "checking for build system executable suffix""... $ac_c" 1>&6 -echo "configure:4640: checking for build system executable suffix" >&5 -if eval "test \"`echo '$''{'bfd_cv_build_exeext'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking for build system executable suffix" >&5 +echo $ECHO_N "checking for build system executable suffix... $ECHO_C" >&6 +if test "${bfd_cv_build_exeext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else rm -f conftest* echo 'int main () { return 0; }' > conftest.c @@ -4653,609 +9446,2008 @@ else rm -f conftest* test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no fi - -echo "$ac_t""$bfd_cv_build_exeext" 1>&6 +echo "$as_me:$LINENO: result: $bfd_cv_build_exeext" >&5 +echo "${ECHO_T}$bfd_cv_build_exeext" >&6 EXEEXT_FOR_BUILD="" test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext} fi -for ac_hdr in stddef.h string.h strings.h stdlib.h time.h unistd.h + + + + + + +for ac_header in stddef.h string.h strings.h stdlib.h time.h unistd.h do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4668: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4678: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else - echo "$ac_t""no" 1>&6 + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + done -for ac_hdr in fcntl.h sys/file.h sys/time.h + + + +for ac_header in fcntl.h sys/file.h sys/time.h do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4708: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4718: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else - echo "$ac_t""no" 1>&6 + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + done -echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:4745: checking whether time.h and sys/time.h may both be included" >&5 -if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5 +echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6 +if test "${ac_cv_header_time+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #include #include -int main() { -struct tm *tp; -; return 0; } -EOF -if { (eval echo configure:4759: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + +int +main () +{ +if ((struct tm *) 0) +return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_header_time=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_header_time=no -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -echo "$ac_t""$ac_cv_header_time" 1>&6 +ac_cv_header_time=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5 +echo "${ECHO_T}$ac_cv_header_time" >&6 if test $ac_cv_header_time = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define TIME_WITH_SYS_TIME 1 -EOF +_ACEOF fi + + + + + ac_header_dirent=no -for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h -do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 -echo "configure:4784: checking for $ac_hdr that defines DIR" >&5 -if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do + as_ac_Header=`echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_hdr that defines DIR" >&5 +echo $ECHO_N "checking for $ac_hdr that defines DIR... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #include <$ac_hdr> -int main() { -DIR *dirp = 0; -; return 0; } -EOF -if { (eval echo configure:4797: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - eval "ac_cv_header_dirent_$ac_safe=yes" + +int +main () +{ +if ((DIR *) 0) +return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_dirent_$ac_safe=no" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Header=no" fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -if eval "test \"`echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <&6 +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_hdr" | $as_tr_cpp` 1 +_ACEOF + +ac_header_dirent=$ac_hdr; break fi + done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then -echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 -echo "configure:4822: checking for opendir in -ldir" >&5 -ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking for library containing opendir" >&5 +echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6 +if test "${ac_cv_search_opendir+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_LIBS="$LIBS" -LIBS="-ldir $LIBS" -cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char opendir(); - -int main() { -opendir() -; return 0; } -EOF -if { (eval echo configure:4841: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" + builtin and then its argument prototype would still apply. */ +char opendir (); +int +main () +{ +opendir (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_opendir="none required" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - LIBS="$LIBS -ldir" -else - echo "$ac_t""no" 1>&6 -fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test "$ac_cv_search_opendir" = no; then + for ac_lib in dir; do + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -else -echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 -echo "configure:4863: checking for opendir in -lx" >&5 -ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-lx $LIBS" -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" + builtin and then its argument prototype would still apply. */ +char opendir (); +int +main () +{ +opendir (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_opendir="-l$ac_lib" +break else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - LIBS="$LIBS -lx" +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + done +fi +LIBS=$ac_func_search_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 +echo "${ECHO_T}$ac_cv_search_opendir" >&6 +if test "$ac_cv_search_opendir" != no; then + test "$ac_cv_search_opendir" = "none required" || LIBS="$ac_cv_search_opendir $LIBS" + +fi + else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: checking for library containing opendir" >&5 +echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6 +if test "${ac_cv_search_opendir+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_func_search_save_LIBS=$LIBS +ac_cv_search_opendir=no +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char opendir (); +int +main () +{ +opendir (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_opendir="none required" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test "$ac_cv_search_opendir" = no; then + for ac_lib in x; do + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char opendir (); +int +main () +{ +opendir (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_opendir="-l$ac_lib" +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + done +fi +LIBS=$ac_func_search_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 +echo "${ECHO_T}$ac_cv_search_opendir" >&6 +if test "$ac_cv_search_opendir" != no; then + test "$ac_cv_search_opendir" = "none required" || LIBS="$ac_cv_search_opendir $LIBS" + fi fi +echo "$as_me:$LINENO: checking whether string.h and strings.h may both be included" >&5 +echo $ECHO_N "checking whether string.h and strings.h may both be included... $ECHO_C" >&6 +if test "${gcc_cv_header_string+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gcc_cv_header_string=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +gcc_cv_header_string=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $gcc_cv_header_string" >&5 +echo "${ECHO_T}$gcc_cv_header_string" >&6 +if test $gcc_cv_header_string = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STRING_WITH_STRINGS 1 +_ACEOF + +fi + + + + + + + + for ac_func in fcntl getpagesize setitimer sysconf fdopen getuid getgid do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4907: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - + builtin and then its argument prototype would still apply. */ +char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif -; return 0; } -EOF -if { (eval echo configure:4935: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 fi done + for ac_func in strtoull do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4962: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - + builtin and then its argument prototype would still apply. */ +char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif -; return 0; } -EOF -if { (eval echo configure:4990: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 fi done +echo "$as_me:$LINENO: checking whether basename is declared" >&5 +echo $ECHO_N "checking whether basename is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_basename+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef basename + char *p = (char *) basename; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_basename=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_basename=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_basename" >&5 +echo "${ECHO_T}$ac_cv_have_decl_basename" >&6 +if test $ac_cv_have_decl_basename = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_BASENAME 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_BASENAME 0 +_ACEOF + + +fi + + +echo "$as_me:$LINENO: checking whether ftello is declared" >&5 +echo $ECHO_N "checking whether ftello is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_ftello+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef ftello + char *p = (char *) ftello; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_ftello=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_ftello=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_ftello" >&5 +echo "${ECHO_T}$ac_cv_have_decl_ftello" >&6 +if test $ac_cv_have_decl_ftello = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FTELLO 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FTELLO 0 +_ACEOF + + +fi + + +echo "$as_me:$LINENO: checking whether ftello64 is declared" >&5 +echo $ECHO_N "checking whether ftello64 is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_ftello64+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef ftello64 + char *p = (char *) ftello64; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_ftello64=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_ftello64=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_ftello64" >&5 +echo "${ECHO_T}$ac_cv_have_decl_ftello64" >&6 +if test $ac_cv_have_decl_ftello64 = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FTELLO64 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FTELLO64 0 +_ACEOF + + +fi + + +echo "$as_me:$LINENO: checking whether fseeko is declared" >&5 +echo $ECHO_N "checking whether fseeko is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_fseeko+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef fseeko + char *p = (char *) fseeko; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_fseeko=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_fseeko=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_fseeko" >&5 +echo "${ECHO_T}$ac_cv_have_decl_fseeko" >&6 +if test $ac_cv_have_decl_fseeko = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FSEEKO 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FSEEKO 0 +_ACEOF + + +fi + + +echo "$as_me:$LINENO: checking whether fseeko64 is declared" >&5 +echo $ECHO_N "checking whether fseeko64 is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_fseeko64+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef fseeko64 + char *p = (char *) fseeko64; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_fseeko64=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_fseeko64=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_fseeko64" >&5 +echo "${ECHO_T}$ac_cv_have_decl_fseeko64" >&6 +if test $ac_cv_have_decl_fseeko64 = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FSEEKO64 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FSEEKO64 0 +_ACEOF + + +fi + + + case "${host}" in *-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*) - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define USE_BINARY_FOPEN 1 -EOF +_ACEOF ;; esac -echo $ac_n "checking whether strstr must be declared""... $ac_c" 1>&6 -echo "configure:5025: checking whether strstr must be declared" >&5 -if eval "test \"`echo '$''{'bfd_cv_decl_needed_strstr'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking whether ffs is declared" >&5 +echo $ECHO_N "checking whether ffs is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_ffs+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef ffs + char *p = (char *) ffs; +#endif -#include -#ifdef HAVE_STRING_H -#include -#else -#ifdef HAVE_STRINGS_H -#include -#endif -#endif -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif -int main() { -char *(*pfn) = (char *(*)) strstr -; return 0; } -EOF -if { (eval echo configure:5051: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - bfd_cv_decl_needed_strstr=no + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_ffs=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - bfd_cv_decl_needed_strstr=yes -fi -rm -f conftest* -fi - -echo "$ac_t""$bfd_cv_decl_needed_strstr" 1>&6 -if test $bfd_cv_decl_needed_strstr = yes; then - cat >> confdefs.h <<\EOF -#define NEED_DECLARATION_STRSTR 1 -EOF + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_have_decl_ffs=no fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_ffs" >&5 +echo "${ECHO_T}$ac_cv_have_decl_ffs" >&6 +if test $ac_cv_have_decl_ffs = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FFS 1 +_ACEOF + -echo $ac_n "checking whether malloc must be declared""... $ac_c" 1>&6 -echo "configure:5072: checking whether malloc must be declared" >&5 -if eval "test \"`echo '$''{'bfd_cv_decl_needed_malloc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 else - cat > conftest.$ac_ext <>confdefs.h <<_ACEOF +#define HAVE_DECL_FFS 0 +_ACEOF -#include -#ifdef HAVE_STRING_H -#include -#else -#ifdef HAVE_STRINGS_H -#include -#endif -#endif -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif -int main() { -char *(*pfn) = (char *(*)) malloc -; return 0; } -EOF -if { (eval echo configure:5098: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - bfd_cv_decl_needed_malloc=no + +fi + + +echo "$as_me:$LINENO: checking whether free is declared" >&5 +echo $ECHO_N "checking whether free is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_free+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - bfd_cv_decl_needed_malloc=yes -fi -rm -f conftest* -fi + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef free + char *p = (char *) free; +#endif -echo "$ac_t""$bfd_cv_decl_needed_malloc" 1>&6 -if test $bfd_cv_decl_needed_malloc = yes; then - cat >> confdefs.h <<\EOF -#define NEED_DECLARATION_MALLOC 1 -EOF - -fi - -echo $ac_n "checking whether realloc must be declared""... $ac_c" 1>&6 -echo "configure:5119: checking whether realloc must be declared" >&5 -if eval "test \"`echo '$''{'bfd_cv_decl_needed_realloc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_free=yes else - cat > conftest.$ac_ext <&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_free=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_free" >&5 +echo "${ECHO_T}$ac_cv_have_decl_free" >&6 +if test $ac_cv_have_decl_free = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FREE 1 +_ACEOF + -#include -#ifdef HAVE_STRING_H -#include -#else -#ifdef HAVE_STRINGS_H -#include -#endif -#endif -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif -int main() { -char *(*pfn) = (char *(*)) realloc -; return 0; } -EOF -if { (eval echo configure:5145: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - bfd_cv_decl_needed_realloc=no else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - bfd_cv_decl_needed_realloc=yes -fi -rm -f conftest* -fi + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FREE 0 +_ACEOF -echo "$ac_t""$bfd_cv_decl_needed_realloc" 1>&6 -if test $bfd_cv_decl_needed_realloc = yes; then - cat >> confdefs.h <<\EOF -#define NEED_DECLARATION_REALLOC 1 -EOF fi -echo $ac_n "checking whether free must be declared""... $ac_c" 1>&6 -echo "configure:5166: checking whether free must be declared" >&5 -if eval "test \"`echo '$''{'bfd_cv_decl_needed_free'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + +echo "$as_me:$LINENO: checking whether getenv is declared" >&5 +echo $ECHO_N "checking whether getenv is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_getenv+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef getenv + char *p = (char *) getenv; +#endif -#include -#ifdef HAVE_STRING_H -#include -#else -#ifdef HAVE_STRINGS_H -#include -#endif -#endif -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif -int main() { -char *(*pfn) = (char *(*)) free -; return 0; } -EOF -if { (eval echo configure:5192: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - bfd_cv_decl_needed_free=no + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_getenv=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - bfd_cv_decl_needed_free=yes -fi -rm -f conftest* -fi - -echo "$ac_t""$bfd_cv_decl_needed_free" 1>&6 -if test $bfd_cv_decl_needed_free = yes; then - cat >> confdefs.h <<\EOF -#define NEED_DECLARATION_FREE 1 -EOF + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_have_decl_getenv=no fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_getenv" >&5 +echo "${ECHO_T}$ac_cv_have_decl_getenv" >&6 +if test $ac_cv_have_decl_getenv = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_GETENV 1 +_ACEOF + -echo $ac_n "checking whether getenv must be declared""... $ac_c" 1>&6 -echo "configure:5213: checking whether getenv must be declared" >&5 -if eval "test \"`echo '$''{'bfd_cv_decl_needed_getenv'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 else - cat > conftest.$ac_ext <>confdefs.h <<_ACEOF +#define HAVE_DECL_GETENV 0 +_ACEOF -#include -#ifdef HAVE_STRING_H -#include -#else -#ifdef HAVE_STRINGS_H -#include -#endif -#endif -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif -int main() { -char *(*pfn) = (char *(*)) getenv -; return 0; } -EOF -if { (eval echo configure:5239: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - bfd_cv_decl_needed_getenv=no + +fi + + +echo "$as_me:$LINENO: checking whether malloc is declared" >&5 +echo $ECHO_N "checking whether malloc is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_malloc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - bfd_cv_decl_needed_getenv=yes -fi -rm -f conftest* -fi + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef malloc + char *p = (char *) malloc; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_malloc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_malloc=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_malloc" >&5 +echo "${ECHO_T}$ac_cv_have_decl_malloc" >&6 +if test $ac_cv_have_decl_malloc = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_MALLOC 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_MALLOC 0 +_ACEOF -echo "$ac_t""$bfd_cv_decl_needed_getenv" 1>&6 -if test $bfd_cv_decl_needed_getenv = yes; then - cat >> confdefs.h <<\EOF -#define NEED_DECLARATION_GETENV 1 -EOF fi +echo "$as_me:$LINENO: checking whether realloc is declared" >&5 +echo $ECHO_N "checking whether realloc is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_realloc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef realloc + char *p = (char *) realloc; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_realloc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_realloc=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_realloc" >&5 +echo "${ECHO_T}$ac_cv_have_decl_realloc" >&6 +if test $ac_cv_have_decl_realloc = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_REALLOC 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_REALLOC 0 +_ACEOF + + +fi + + +echo "$as_me:$LINENO: checking whether stpcpy is declared" >&5 +echo $ECHO_N "checking whether stpcpy is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_stpcpy+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef stpcpy + char *p = (char *) stpcpy; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_stpcpy=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_stpcpy=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_stpcpy" >&5 +echo "${ECHO_T}$ac_cv_have_decl_stpcpy" >&6 +if test $ac_cv_have_decl_stpcpy = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STPCPY 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STPCPY 0 +_ACEOF + + +fi + + +echo "$as_me:$LINENO: checking whether strstr is declared" >&5 +echo $ECHO_N "checking whether strstr is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_strstr+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef strstr + char *p = (char *) strstr; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_strstr=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_strstr=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_strstr" >&5 +echo "${ECHO_T}$ac_cv_have_decl_strstr" >&6 +if test $ac_cv_have_decl_strstr = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STRSTR 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STRSTR 0 +_ACEOF + + +fi + + +echo "$as_me:$LINENO: checking whether snprintf is declared" >&5 +echo $ECHO_N "checking whether snprintf is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_snprintf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef snprintf + char *p = (char *) snprintf; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_snprintf=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_snprintf=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_snprintf" >&5 +echo "${ECHO_T}$ac_cv_have_decl_snprintf" >&6 +if test $ac_cv_have_decl_snprintf = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SNPRINTF 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SNPRINTF 0 +_ACEOF + + +fi + + +echo "$as_me:$LINENO: checking whether vsnprintf is declared" >&5 +echo $ECHO_N "checking whether vsnprintf is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_vsnprintf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef vsnprintf + char *p = (char *) vsnprintf; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_vsnprintf=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_vsnprintf=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_vsnprintf" >&5 +echo "${ECHO_T}$ac_cv_have_decl_vsnprintf" >&6 +if test $ac_cv_have_decl_vsnprintf = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_VSNPRINTF 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_VSNPRINTF 0 +_ACEOF + + +fi + + + # If we are configured native, pick a core file support file. COREFILE= COREFLAG= @@ -5265,7 +11457,7 @@ if test "${target}" = "${host}"; then alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu) COREFILE='' ;; - alpha*-*-linux-gnu*) + alpha*-*-linux-*) COREFILE=trad-core.lo TRAD_HEADER='"hosts/alphalinux.h"' ;; @@ -5282,6 +11474,10 @@ if test "${target}" = "${host}"; then hppa*-*-mpeix*) COREFILE=hpux-core.lo ;; hppa*-*-bsd*) COREFILE="hpux-core.lo hppabsd-core.lo" COREFLAG="-DHPUX_CORE -DHPPABSD_CORE" ;; + hppa*-*-netbsd* | hppa*-*-openbsd*) + COREFILE=netbsd-core.lo + ;; + i370-*-*) COREFILE=trad-core.lo TRAD_HEADER='"hosts/i370linux.h"' @@ -5299,7 +11495,7 @@ if test "${target}" = "${host}"; then i[3-7]86-*-bsdi) COREFILE= ;; - i[3-7]86-*-bsd* | i[3-7]86-*-freebsd[123] | i[3-7]86-*-freebsd[123]\.* | i[3-7]86-*-freebsd4\.[01234]* | i[3-7]86-*-freebsd*aout*) + i[3-7]86-*-bsd* | i[3-7]86-*-freebsd[123] | i[3-7]86-*-freebsd[123]\.* | i[3-7]86-*-freebsd4\.[01234] | i[3-7]86-*-freebsd4\.[01234]\.* | i[3-7]86-*-freebsd*aout*) COREFILE=trad-core.lo TRAD_HEADER='"hosts/i386bsd.h"' ;; @@ -5325,7 +11521,7 @@ if test "${target}" = "${host}"; then COREFILE=trad-core.lo TRAD_HEADER='"hosts/i386mach3.h"' ;; - i[3-7]86-*-linux-gnu*) + i[3-7]86-*-linux-*) COREFILE=trad-core.lo TRAD_HEADER='"hosts/i386linux.h"' ;; @@ -5363,7 +11559,7 @@ if test "${target}" = "${host}"; then COREFILE=trad-core.lo TRAD_HEADER='"hosts/hp300bsd.h"' ;; - m68*-*-linux-gnu*) + m68*-*-linux-*) COREFILE=trad-core.lo TRAD_HEADER='"hosts/m68klinux.h"' ;; @@ -5391,6 +11587,9 @@ if test "${target}" = "${host}"; then COREFILE=trad-core.lo TRAD_HEADER='"hosts/m88kmach3.h"' ;; + m88*-*-openbsd*) + COREFILE=netbsd-core.lo + ;; ns32k-pc532-mach) COREFILE=trad-core.lo TRAD_HEADER='"hosts/pc532mach.h"' @@ -5410,30 +11609,60 @@ if test "${target}" = "${host}"; then COREFLAG="$COREFLAG -DAIX_CORE_DUMPX_CORE" # Not all versions of AIX with -DAIX_CORE_DUMPX_CORE # have c_impl as a member of struct core_dumpx - echo $ac_n "checking for c_impl in struct core_dumpx""... $ac_c" 1>&6 -echo "configure:5415: checking for c_impl in struct core_dumpx" >&5 - cat > conftest.$ac_ext <&5 +echo $ECHO_N "checking for c_impl in struct core_dumpx... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include -int main() { +int +main () +{ struct core_dumpx c; c.c_impl = 0; -; return 0; } -EOF -if { (eval echo configure:5424: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - cat >> confdefs.h <<\EOF -#define HAVE_ST_C_IMPL 1 -EOF + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then - echo "$ac_t""yes" 1>&6 +cat >>confdefs.h <<\_ACEOF +#define HAVE_ST_C_IMPL 1 +_ACEOF + + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - echo "$ac_t""no" 1>&6 + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ;; rs6000-*-aix4*) COREFILE=rs6000-core.lo ;; rs6000-*-*) COREFILE=rs6000-core.lo ;; @@ -5464,7 +11693,7 @@ rm -f conftest* COREFILE=trad-core.lo TRAD_HEADER='"hosts/vaxult2.h"' ;; - vax-*-linux-gnu*) + vax-*-linux-*) COREFILE=trad-core.lo TRAD_HEADER='"hosts/vaxlinux.h"' ;; @@ -5493,631 +11722,1206 @@ rm -f conftest* # ELF corefile support has several flavors, but all of # them use something called - for ac_hdr in sys/procfs.h + +for ac_header in sys/procfs.h do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5501: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5511: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else - echo "$ac_t""no" 1>&6 + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + done if test "$ac_cv_header_sys_procfs_h" = yes; then - echo $ac_n "checking for prstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5539: checking for prstatus_t in sys/procfs.h" >&5 - if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prstatus_t'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking for prstatus_t in sys/procfs.h" >&5 +echo $ECHO_N "checking for prstatus_t in sys/procfs.h... $ECHO_C" >&6 + if test "${bfd_cv_have_sys_procfs_type_prstatus_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #define _SYSCALL32 #include -int main() { +int +main () +{ prstatus_t avar -; return 0; } -EOF -if { (eval echo configure:5553: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then bfd_cv_have_sys_procfs_type_prstatus_t=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - bfd_cv_have_sys_procfs_type_prstatus_t=no - + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +bfd_cv_have_sys_procfs_type_prstatus_t=no + fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $bfd_cv_have_sys_procfs_type_prstatus_t = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_PRSTATUS_T 1 -EOF +_ACEOF fi - echo "$ac_t""$bfd_cv_have_sys_procfs_type_prstatus_t" 1>&6 + echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_prstatus_t" >&5 +echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_prstatus_t" >&6 - echo $ac_n "checking for prstatus32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5575: checking for prstatus32_t in sys/procfs.h" >&5 - if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prstatus32_t'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking for prstatus32_t in sys/procfs.h" >&5 +echo $ECHO_N "checking for prstatus32_t in sys/procfs.h... $ECHO_C" >&6 + if test "${bfd_cv_have_sys_procfs_type_prstatus32_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #define _SYSCALL32 #include -int main() { +int +main () +{ prstatus32_t avar -; return 0; } -EOF -if { (eval echo configure:5589: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then bfd_cv_have_sys_procfs_type_prstatus32_t=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - bfd_cv_have_sys_procfs_type_prstatus32_t=no - + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +bfd_cv_have_sys_procfs_type_prstatus32_t=no + fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $bfd_cv_have_sys_procfs_type_prstatus32_t = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_PRSTATUS32_T 1 -EOF +_ACEOF fi - echo "$ac_t""$bfd_cv_have_sys_procfs_type_prstatus32_t" 1>&6 + echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_prstatus32_t" >&5 +echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_prstatus32_t" >&6 - echo $ac_n "checking for prstatus_t.pr_who in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5611: checking for prstatus_t.pr_who in sys/procfs.h" >&5 - if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking for prstatus_t.pr_who in sys/procfs.h" >&5 +echo $ECHO_N "checking for prstatus_t.pr_who in sys/procfs.h... $ECHO_C" >&6 + if test "${bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #define _SYSCALL32 #include -int main() { +int +main () +{ prstatus_t avar; void* aref = (void*) &avar.pr_who -; return 0; } -EOF -if { (eval echo configure:5625: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who=no - + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who=no + fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_PRSTATUS_T_PR_WHO 1 -EOF +_ACEOF fi - echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who" 1>&6 + echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who" >&5 +echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who" >&6 - echo $ac_n "checking for prstatus32_t.pr_who in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5647: checking for prstatus32_t.pr_who in sys/procfs.h" >&5 - if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking for prstatus32_t.pr_who in sys/procfs.h" >&5 +echo $ECHO_N "checking for prstatus32_t.pr_who in sys/procfs.h... $ECHO_C" >&6 + if test "${bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #define _SYSCALL32 #include -int main() { +int +main () +{ prstatus32_t avar; void* aref = (void*) &avar.pr_who -; return 0; } -EOF -if { (eval echo configure:5661: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who=no - + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who=no + fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_PRSTATUS32_T_PR_WHO 1 -EOF +_ACEOF fi - echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who" 1>&6 + echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who" >&5 +echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who" >&6 - echo $ac_n "checking for pstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5683: checking for pstatus_t in sys/procfs.h" >&5 - if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pstatus_t'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking for pstatus_t in sys/procfs.h" >&5 +echo $ECHO_N "checking for pstatus_t in sys/procfs.h... $ECHO_C" >&6 + if test "${bfd_cv_have_sys_procfs_type_pstatus_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #define _SYSCALL32 #include -int main() { +int +main () +{ pstatus_t avar -; return 0; } -EOF -if { (eval echo configure:5697: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then bfd_cv_have_sys_procfs_type_pstatus_t=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - bfd_cv_have_sys_procfs_type_pstatus_t=no - + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +bfd_cv_have_sys_procfs_type_pstatus_t=no + fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $bfd_cv_have_sys_procfs_type_pstatus_t = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_PSTATUS_T 1 -EOF +_ACEOF fi - echo "$ac_t""$bfd_cv_have_sys_procfs_type_pstatus_t" 1>&6 + echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_pstatus_t" >&5 +echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_pstatus_t" >&6 - echo $ac_n "checking for pxstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5719: checking for pxstatus_t in sys/procfs.h" >&5 - if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pxstatus_t'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking for pxstatus_t in sys/procfs.h" >&5 +echo $ECHO_N "checking for pxstatus_t in sys/procfs.h... $ECHO_C" >&6 + if test "${bfd_cv_have_sys_procfs_type_pxstatus_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #define _SYSCALL32 #include -int main() { +int +main () +{ pxstatus_t avar -; return 0; } -EOF -if { (eval echo configure:5733: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then bfd_cv_have_sys_procfs_type_pxstatus_t=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - bfd_cv_have_sys_procfs_type_pxstatus_t=no - + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +bfd_cv_have_sys_procfs_type_pxstatus_t=no + fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $bfd_cv_have_sys_procfs_type_pxstatus_t = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_PXSTATUS_T 1 -EOF +_ACEOF fi - echo "$ac_t""$bfd_cv_have_sys_procfs_type_pxstatus_t" 1>&6 + echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_pxstatus_t" >&5 +echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_pxstatus_t" >&6 - echo $ac_n "checking for pstatus32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5755: checking for pstatus32_t in sys/procfs.h" >&5 - if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pstatus32_t'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking for pstatus32_t in sys/procfs.h" >&5 +echo $ECHO_N "checking for pstatus32_t in sys/procfs.h... $ECHO_C" >&6 + if test "${bfd_cv_have_sys_procfs_type_pstatus32_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #define _SYSCALL32 #include -int main() { +int +main () +{ pstatus32_t avar -; return 0; } -EOF -if { (eval echo configure:5769: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then bfd_cv_have_sys_procfs_type_pstatus32_t=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - bfd_cv_have_sys_procfs_type_pstatus32_t=no - + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +bfd_cv_have_sys_procfs_type_pstatus32_t=no + fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $bfd_cv_have_sys_procfs_type_pstatus32_t = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_PSTATUS32_T 1 -EOF +_ACEOF fi - echo "$ac_t""$bfd_cv_have_sys_procfs_type_pstatus32_t" 1>&6 + echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_pstatus32_t" >&5 +echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_pstatus32_t" >&6 - echo $ac_n "checking for prpsinfo_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5791: checking for prpsinfo_t in sys/procfs.h" >&5 - if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prpsinfo_t'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking for prpsinfo_t in sys/procfs.h" >&5 +echo $ECHO_N "checking for prpsinfo_t in sys/procfs.h... $ECHO_C" >&6 + if test "${bfd_cv_have_sys_procfs_type_prpsinfo_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #define _SYSCALL32 #include -int main() { +int +main () +{ prpsinfo_t avar -; return 0; } -EOF -if { (eval echo configure:5805: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then bfd_cv_have_sys_procfs_type_prpsinfo_t=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - bfd_cv_have_sys_procfs_type_prpsinfo_t=no - + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +bfd_cv_have_sys_procfs_type_prpsinfo_t=no + fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $bfd_cv_have_sys_procfs_type_prpsinfo_t = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_PRPSINFO_T 1 -EOF +_ACEOF fi - echo "$ac_t""$bfd_cv_have_sys_procfs_type_prpsinfo_t" 1>&6 + echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_prpsinfo_t" >&5 +echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_prpsinfo_t" >&6 - echo $ac_n "checking for prpsinfo32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5827: checking for prpsinfo32_t in sys/procfs.h" >&5 - if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prpsinfo32_t'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking for prpsinfo32_t in sys/procfs.h" >&5 +echo $ECHO_N "checking for prpsinfo32_t in sys/procfs.h... $ECHO_C" >&6 + if test "${bfd_cv_have_sys_procfs_type_prpsinfo32_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #define _SYSCALL32 #include -int main() { +int +main () +{ prpsinfo32_t avar -; return 0; } -EOF -if { (eval echo configure:5841: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then bfd_cv_have_sys_procfs_type_prpsinfo32_t=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - bfd_cv_have_sys_procfs_type_prpsinfo32_t=no - + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +bfd_cv_have_sys_procfs_type_prpsinfo32_t=no + fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $bfd_cv_have_sys_procfs_type_prpsinfo32_t = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_PRPSINFO32_T 1 -EOF +_ACEOF fi - echo "$ac_t""$bfd_cv_have_sys_procfs_type_prpsinfo32_t" 1>&6 + echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_prpsinfo32_t" >&5 +echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_prpsinfo32_t" >&6 - echo $ac_n "checking for psinfo_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5863: checking for psinfo_t in sys/procfs.h" >&5 - if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_psinfo_t'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking for psinfo_t in sys/procfs.h" >&5 +echo $ECHO_N "checking for psinfo_t in sys/procfs.h... $ECHO_C" >&6 + if test "${bfd_cv_have_sys_procfs_type_psinfo_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #define _SYSCALL32 #include -int main() { +int +main () +{ psinfo_t avar -; return 0; } -EOF -if { (eval echo configure:5877: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then bfd_cv_have_sys_procfs_type_psinfo_t=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - bfd_cv_have_sys_procfs_type_psinfo_t=no - + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +bfd_cv_have_sys_procfs_type_psinfo_t=no + fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $bfd_cv_have_sys_procfs_type_psinfo_t = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_PSINFO_T 1 -EOF +_ACEOF fi - echo "$ac_t""$bfd_cv_have_sys_procfs_type_psinfo_t" 1>&6 + echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_psinfo_t" >&5 +echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_psinfo_t" >&6 - echo $ac_n "checking for psinfo32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5899: checking for psinfo32_t in sys/procfs.h" >&5 - if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_psinfo32_t'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking for psinfo32_t in sys/procfs.h" >&5 +echo $ECHO_N "checking for psinfo32_t in sys/procfs.h... $ECHO_C" >&6 + if test "${bfd_cv_have_sys_procfs_type_psinfo32_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #define _SYSCALL32 #include -int main() { +int +main () +{ psinfo32_t avar -; return 0; } -EOF -if { (eval echo configure:5913: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then bfd_cv_have_sys_procfs_type_psinfo32_t=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - bfd_cv_have_sys_procfs_type_psinfo32_t=no - + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +bfd_cv_have_sys_procfs_type_psinfo32_t=no + fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $bfd_cv_have_sys_procfs_type_psinfo32_t = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_PSINFO32_T 1 -EOF +_ACEOF fi - echo "$ac_t""$bfd_cv_have_sys_procfs_type_psinfo32_t" 1>&6 + echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_psinfo32_t" >&5 +echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_psinfo32_t" >&6 - echo $ac_n "checking for lwpstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5935: checking for lwpstatus_t in sys/procfs.h" >&5 - if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_lwpstatus_t'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking for lwpstatus_t in sys/procfs.h" >&5 +echo $ECHO_N "checking for lwpstatus_t in sys/procfs.h... $ECHO_C" >&6 + if test "${bfd_cv_have_sys_procfs_type_lwpstatus_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #define _SYSCALL32 #include -int main() { +int +main () +{ lwpstatus_t avar -; return 0; } -EOF -if { (eval echo configure:5949: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then bfd_cv_have_sys_procfs_type_lwpstatus_t=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - bfd_cv_have_sys_procfs_type_lwpstatus_t=no - + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +bfd_cv_have_sys_procfs_type_lwpstatus_t=no + fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $bfd_cv_have_sys_procfs_type_lwpstatus_t = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_LWPSTATUS_T 1 -EOF +_ACEOF fi - echo "$ac_t""$bfd_cv_have_sys_procfs_type_lwpstatus_t" 1>&6 + echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_lwpstatus_t" >&5 +echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_lwpstatus_t" >&6 - echo $ac_n "checking for lwpxstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5971: checking for lwpxstatus_t in sys/procfs.h" >&5 - if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_lwpxstatus_t'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking for lwpxstatus_t in sys/procfs.h" >&5 +echo $ECHO_N "checking for lwpxstatus_t in sys/procfs.h... $ECHO_C" >&6 + if test "${bfd_cv_have_sys_procfs_type_lwpxstatus_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #define _SYSCALL32 #include -int main() { +int +main () +{ lwpxstatus_t avar -; return 0; } -EOF -if { (eval echo configure:5985: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then bfd_cv_have_sys_procfs_type_lwpxstatus_t=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - bfd_cv_have_sys_procfs_type_lwpxstatus_t=no - + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +bfd_cv_have_sys_procfs_type_lwpxstatus_t=no + fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $bfd_cv_have_sys_procfs_type_lwpxstatus_t = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_LWPXSTATUS_T 1 -EOF +_ACEOF fi - echo "$ac_t""$bfd_cv_have_sys_procfs_type_lwpxstatus_t" 1>&6 + echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_lwpxstatus_t" >&5 +echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_lwpxstatus_t" >&6 - echo $ac_n "checking for lwpstatus_t.pr_context in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:6007: checking for lwpstatus_t.pr_context in sys/procfs.h" >&5 - if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking for lwpstatus_t.pr_context in sys/procfs.h" >&5 +echo $ECHO_N "checking for lwpstatus_t.pr_context in sys/procfs.h... $ECHO_C" >&6 + if test "${bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #define _SYSCALL32 #include -int main() { +int +main () +{ lwpstatus_t avar; void* aref = (void*) &avar.pr_context -; return 0; } -EOF -if { (eval echo configure:6021: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context=no - + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context=no + fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_LWPSTATUS_T_PR_CONTEXT 1 -EOF +_ACEOF fi - echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context" 1>&6 + echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context" >&5 +echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context" >&6 - echo $ac_n "checking for lwpstatus_t.pr_reg in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:6043: checking for lwpstatus_t.pr_reg in sys/procfs.h" >&5 - if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking for lwpstatus_t.pr_reg in sys/procfs.h" >&5 +echo $ECHO_N "checking for lwpstatus_t.pr_reg in sys/procfs.h... $ECHO_C" >&6 + if test "${bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #define _SYSCALL32 #include -int main() { +int +main () +{ lwpstatus_t avar; void* aref = (void*) &avar.pr_reg -; return 0; } -EOF -if { (eval echo configure:6057: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg=no - + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg=no + fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_LWPSTATUS_T_PR_REG 1 -EOF +_ACEOF fi - echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg" 1>&6 + echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg" >&5 +echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg" >&6 - echo $ac_n "checking for win32_pstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:6079: checking for win32_pstatus_t in sys/procfs.h" >&5 - if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_win32_pstatus_t'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking for win32_pstatus_t in sys/procfs.h" >&5 +echo $ECHO_N "checking for win32_pstatus_t in sys/procfs.h... $ECHO_C" >&6 + if test "${bfd_cv_have_sys_procfs_type_win32_pstatus_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #define _SYSCALL32 #include -int main() { +int +main () +{ win32_pstatus_t avar -; return 0; } -EOF -if { (eval echo configure:6093: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then bfd_cv_have_sys_procfs_type_win32_pstatus_t=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - bfd_cv_have_sys_procfs_type_win32_pstatus_t=no - + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +bfd_cv_have_sys_procfs_type_win32_pstatus_t=no + fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $bfd_cv_have_sys_procfs_type_win32_pstatus_t = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_WIN32_PSTATUS_T 1 -EOF +_ACEOF fi - echo "$ac_t""$bfd_cv_have_sys_procfs_type_win32_pstatus_t" 1>&6 + echo "$as_me:$LINENO: result: $bfd_cv_have_sys_procfs_type_win32_pstatus_t" >&5 +echo "${ECHO_T}$bfd_cv_have_sys_procfs_type_win32_pstatus_t" >&6 fi fi if test -n "$TRAD_HEADER"; then - cat >> confdefs.h <>confdefs.h <<_ACEOF #define TRAD_HEADER $TRAD_HEADER -EOF +_ACEOF fi @@ -6243,7 +13047,6 @@ do # This list is alphabetized to make it easy to compare # with the two vector lists in targets.c. For the same reason, # use one entry per line, even though this leads to long lines. - a29kcoff_big_vec) tb="$tb coff-a29k.lo cofflink.lo" ;; a_out_adobe_vec) tb="$tb aout-adobe.lo aout32.lo" ;; aix5coff64_vec) tb="$tb coff64-rs6000.lo xcofflink.lo aix5ppc-core.lo"; target_size=64 ;; aout0_big_vec) tb="$tb aout0.lo aout32.lo" ;; @@ -6267,12 +13070,21 @@ do bfd_efi_app_ia64_vec) tb="$tb efi-app-ia64.lo pepigen.lo cofflink.lo"; target_size=64 ;; bfd_elf32_am33lin_vec) tb="$tb elf32-am33lin.lo elf32.lo $elf" ;; bfd_elf32_avr_vec) tb="$tb elf32-avr.lo elf32.lo $elf" ;; + bfd_elf32_bfin_vec) tb="$tb elf32-bfin.lo elf32.lo $elf" ;; + bfd_elf32_bfinfdpic_vec) tb="$tb elf32-bfin.lo elf32.lo $elf" ;; bfd_elf32_big_generic_vec) tb="$tb elf32-gen.lo elf32.lo $elf" ;; bfd_elf32_bigarc_vec) tb="$tb elf32-arc.lo elf32.lo $elf" ;; - bfd_elf32_bigarm_oabi_vec) tb="$tb elfarm-oabi.lo elf32.lo $elf" ;; - bfd_elf32_bigarm_vec) tb="$tb elfarm-nabi.lo elf32.lo $elf" ;; - bfd_elf32_bigmips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo" ;; + bfd_elf32_bigarm_vec) tb="$tb elf32-arm.lo elf32.lo elf-vxworks.lo $elf" ;; + bfd_elf32_bigarm_symbian_vec) + tb="$tb elf32-arm.lo elf32.lo elf-vxworks.lo $elf" ;; + bfd_elf32_bigarm_vxworks_vec) + tb="$tb elf32-arm.lo elf32.lo elf-vxworks.lo $elf" ;; + bfd_elf32_bigmips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;; + bfd_elf32_bigmips_vxworks_vec) + tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;; + bfd_elf32_cr16c_vec) tb="$tb elf32-cr16c.lo elf32.lo $elf" ;; bfd_elf32_cris_vec) tb="$tb elf32-cris.lo elf32.lo $elf" ;; + bfd_elf32_crx_vec) tb="$tb elf32-crx.lo elf32.lo $elf" ;; bfd_elf32_d10v_vec) tb="$tb elf32-d10v.lo elf32.lo $elf" ;; bfd_elf32_d30v_vec) tb="$tb elf32-d30v.lo elf32.lo $elf" ;; bfd_elf32_dlx_big_vec) tb="$tb elf32-dlx.lo elf32.lo $elf" ;; @@ -6284,8 +13096,9 @@ do bfd_elf32_hppa_nbsd_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;; bfd_elf32_hppa_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;; bfd_elf32_i370_vec) tb="$tb elf32-i370.lo elf32.lo $elf" ;; - bfd_elf32_i386_freebsd_vec) tb="$tb elf32-i386.lo elf32.lo $elf" ;; - bfd_elf32_i386_vec) tb="$tb elf32-i386.lo elf32.lo $elf" ;; + bfd_elf32_i386_freebsd_vec) tb="$tb elf32-i386.lo elf-vxworks.lo elf32.lo $elf" ;; + bfd_elf32_i386_vxworks_vec) tb="$tb elf32-i386.lo elf-vxworks.lo elf32.lo $elf" ;; + bfd_elf32_i386_vec) tb="$tb elf32-i386.lo elf-vxworks.lo elf32.lo $elf" ;; bfd_elf32_i860_little_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;; bfd_elf32_i860_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;; bfd_elf32_i960_vec) tb="$tb elf32-i960.lo elf32.lo $elf" ;; @@ -6295,9 +13108,15 @@ do bfd_elf32_iq2000_vec) tb="$tb elf32-iq2000.lo elf32.lo $elf" ;; bfd_elf32_little_generic_vec) tb="$tb elf32-gen.lo elf32.lo $elf" ;; bfd_elf32_littlearc_vec) tb="$tb elf32-arc.lo elf32.lo $elf" ;; - bfd_elf32_littlearm_oabi_vec) tb="$tb elfarm-oabi.lo elf32.lo $elf" ;; - bfd_elf32_littlearm_vec) tb="$tb elfarm-nabi.lo elf32.lo $elf" ;; - bfd_elf32_littlemips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo" ;; + bfd_elf32_littlearm_symbian_vec) + tb="$tb elf32-arm.lo elf32.lo elf-vxworks.lo $elf" ;; + bfd_elf32_littlearm_vxworks_vec) + tb="$tb elf32-arm.lo elf32.lo elf-vxworks.lo $elf" ;; + bfd_elf32_littlearm_vec) tb="$tb elf32-arm.lo elf32.lo elf-vxworks.lo $elf" ;; + bfd_elf32_littlemips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;; + bfd_elf32_littlemips_vxworks_vec) + tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;; + bfd_elf32_m32c_vec) tb="$tb elf32-m32c.lo elf32.lo $elf" ;; bfd_elf32_m32r_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;; bfd_elf32_m32rle_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;; bfd_elf32_m32rlin_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;; @@ -6310,17 +13129,19 @@ do bfd_elf32_mcore_little_vec) tb="$tb elf32-mcore.lo elf32.lo $elf" ;; bfd_elf32_mn10200_vec) tb="$tb elf-m10200.lo elf32.lo $elf" ;; bfd_elf32_mn10300_vec) tb="$tb elf-m10300.lo elf32.lo $elf" ;; + bfd_elf32_mt_vec) tb="$tb elf32-mt.lo elf32.lo $elf" ;; bfd_elf32_msp430_vec) tb="$tb elf32-msp430.lo elf32.lo $elf" ;; - bfd_elf32_nbigmips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; - bfd_elf32_nlittlemips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; - bfd_elf32_ntradbigmips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; - bfd_elf32_ntradlittlemips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; + bfd_elf32_nbigmips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; + bfd_elf32_nlittlemips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; + bfd_elf32_ntradbigmips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; + bfd_elf32_ntradlittlemips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; bfd_elf32_openrisc_vec) tb="$tb elf32-openrisc.lo elf32.lo $elf" ;; bfd_elf32_or32_big_vec) tb="$tb elf32-or32.lo elf32.lo $elf" ;; bfd_elf32_pj_vec) tb="$tb elf32-pj.lo elf32.lo $elf";; bfd_elf32_pjl_vec) tb="$tb elf32-pj.lo elf32.lo $elf";; - bfd_elf32_powerpc_vec) tb="$tb elf32-ppc.lo elf32.lo $elf" ;; - bfd_elf32_powerpcle_vec) tb="$tb elf32-ppc.lo elf32.lo $elf" ;; + bfd_elf32_powerpc_vec) tb="$tb elf32-ppc.lo elf-vxworks.lo elf32.lo $elf" ;; + bfd_elf32_powerpcle_vec) tb="$tb elf32-ppc.lo elf-vxworks.lo elf32.lo $elf" ;; + bfd_elf32_powerpc_vxworks_vec) tb="$tb elf32-ppc.lo elf-vxworks.lo elf32.lo $elf" ;; bfd_elf32_s390_vec) tb="$tb elf32-s390.lo elf32.lo $elf" ;; # FIXME: We include cofflink.lo not because it's needed for # bfd_elf32_sh64[l]_vec, but because we include bfd_elf32_sh[l]_vec @@ -6334,29 +13155,32 @@ do bfd_elf32_sh_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo" ;; bfd_elf32_shblin_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;; bfd_elf32_shl_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo" ;; + bfd_elf32_shl_symbian_vec) tb="$tb elf32-sh-symbian.lo elf32-sh64-com.lo elf32.lo $elf coff-sh.lo" ;; bfd_elf32_shlin_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;; bfd_elf32_shlnbsd_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;; bfd_elf32_shnbsd_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;; - bfd_elf32_sparc_vec) tb="$tb elf32-sparc.lo elf32.lo $elf" ;; - bfd_elf32_tradbigmips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo" ;; - bfd_elf32_tradlittlemips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo" ;; + bfd_elf32_sparc_vec) tb="$tb elf32-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf32.lo $elf" ;; + bfd_elf32_sparc_vxworks_vec) tb="$tb elf32-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf32.lo $elf" ;; + bfd_elf32_tradbigmips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;; + bfd_elf32_tradlittlemips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;; bfd_elf32_us_cris_vec) tb="$tb elf32-cris.lo elf32.lo $elf" ;; bfd_elf32_v850_vec) tb="$tb elf32-v850.lo elf32.lo $elf" ;; bfd_elf32_vax_vec) tb="$tb elf32-vax.lo elf32.lo $elf" ;; bfd_elf32_xstormy16_vec) tb="$tb elf32-xstormy16.lo elf32.lo $elf" ;; + bfd_elf32_xc16x_vec) tb="$tb elf32-xc16x.lo elf32.lo $elf" ;; bfd_elf32_xtensa_le_vec) tb="$tb xtensa-isa.lo xtensa-modules.lo elf32-xtensa.lo elf32.lo $elf" ;; bfd_elf32_xtensa_be_vec) tb="$tb xtensa-isa.lo xtensa-modules.lo elf32-xtensa.lo elf32.lo $elf" ;; bfd_elf64_alpha_freebsd_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;; bfd_elf64_alpha_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;; bfd_elf64_big_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"; target_size=64 ;; - bfd_elf64_bigmips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; + bfd_elf64_bigmips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; bfd_elf64_hppa_linux_vec) tb="$tb elf64-hppa.lo elf64.lo $elf"; target_size=64 ;; bfd_elf64_hppa_vec) tb="$tb elf64-hppa.lo elf64.lo $elf"; target_size=64 ;; bfd_elf64_ia64_big_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;; bfd_elf64_ia64_hpux_big_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;; bfd_elf64_ia64_little_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;; bfd_elf64_little_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"; target_size=64 ;; - bfd_elf64_littlemips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; + bfd_elf64_littlemips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; bfd_elf64_mmix_vec) tb="$tb elf64-mmix.lo elf64.lo $elf" target_size=64 ;; bfd_elf64_powerpc_vec) tb="$tb elf64-ppc.lo elf64-gen.lo elf64.lo $elf"; target_size=64 ;; bfd_elf64_powerpcle_vec) tb="$tb elf64-ppc.lo elf64-gen.lo elf64.lo $elf" target_size=64 ;; @@ -6367,9 +13191,9 @@ do bfd_elf64_sh64blin_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;; bfd_elf64_sh64lnbsd_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;; bfd_elf64_sh64nbsd_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;; - bfd_elf64_sparc_vec) tb="$tb elf64-sparc.lo elf64.lo $elf"; target_size=64 ;; - bfd_elf64_tradbigmips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; - bfd_elf64_tradlittlemips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; + bfd_elf64_sparc_vec) tb="$tb elf64-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf64.lo $elf"; target_size=64 ;; + bfd_elf64_tradbigmips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; + bfd_elf64_tradlittlemips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; bfd_elf64_x86_64_vec) tb="$tb elf64-x86-64.lo elf64.lo $elf"; target_size=64 ;; bfd_mmo_vec) tb="$tb mmo.lo" target_size=64 ;; bfd_powerpc_pe_vec) tb="$tb pe-ppc.lo peigen.lo cofflink.lo" ;; @@ -6412,12 +13236,12 @@ do m68kcoff_vec) tb="$tb coff-m68k.lo cofflink.lo" ;; m68kcoffun_vec) tb="$tb coff-u68k.lo coff-m68k.lo cofflink.lo" ;; m68klinux_vec) tb="$tb m68klinux.lo aout32.lo" ;; - m68klynx_aout_vec) tb="$tb m68klynx.lo lynx-core.lo aout32.lo" ;; - m68klynx_coff_vec) tb="$tb cf-m68klynx.lo coff-m68k.lo cofflink.lo lynx-core.lo" ;; m68knetbsd_vec) tb="$tb m68knetbsd.lo aout32.lo" ;; m68ksysvcoff_vec) tb="$tb coff-svm68k.lo cofflink.lo" ;; m88kbcs_vec) tb="$tb coff-m88k.lo" ;; m88kmach3_vec) tb="$tb m88kmach3.lo aout32.lo" ;; + m88kopenbsd_vec) tb="$tb m88kopenbsd.lo aout32.lo" ;; + maxqcoff_vec) tb="$tb coff-maxq.lo" ;; mach_o_be_vec) tb="$tb mach-o.lo" ;; mach_o_le_vec) tb="$tb mach-o.lo" ;; mach_o_fat_vec) tb="$tb mach-o.lo" ;; @@ -6481,7 +13305,8 @@ do vms_vax_vec) tb="$tb vms.lo vms-hdr.lo vms-gsd.lo vms-tir.lo vms-misc.lo" ;; w65_vec) tb="$tb coff-w65.lo reloc16.lo" ;; we32kcoff_vec) tb="$tb coff-we32k.lo" ;; - z8kcoff_vec) tb="$tb coff-z8k.lo reloc16.lo" ;; + z80coff_vec) tb="$tb coff-z80.lo reloc16.lo" ;; + z8kcoff_vec) tb="$tb coff-z8k.lo reloc16.lo cofflink.lo" ;; # These appear out of order in targets.c srec_vec) tb="$tb srec.lo" ;; @@ -6491,7 +13316,9 @@ do cisco_core_little_vec) tb="$tb cisco-core.lo" ;; "") ;; - *) { echo "configure: error: *** unknown target vector $vec" 1>&2; exit 1; } ;; + *) { { echo "$as_me:$LINENO: error: *** unknown target vector $vec" >&5 +echo "$as_me: error: *** unknown target vector $vec" >&2;} + { (exit 1); exit 1; }; } ;; esac if test ${target_size} = 64; then @@ -6555,32 +13382,39 @@ case ${host64}-${target64}-${want64} in bfd_libs='$(BFD64_LIBS) $(BFD32_LIBS)' all_backends='$(BFD64_BACKENDS) $(BFD32_BACKENDS)' if test $BFD_HOST_64_BIT_DEFINED = 0; then - echo "configure: warning: You have requested a 64 bit BFD configuration, but" 1>&2 - echo "configure: warning: your compiler may not have a 64 bit integral type" 1>&2 + { echo "$as_me:$LINENO: WARNING: You have requested a 64 bit BFD configuration, but" >&5 +echo "$as_me: WARNING: You have requested a 64 bit BFD configuration, but" >&2;} + { echo "$as_me:$LINENO: WARNING: your compiler may not have a 64 bit integral type" >&5 +echo "$as_me: WARNING: your compiler may not have a 64 bit integral type" >&2;} fi if test -n "$GCC" ; then bad_64bit_gcc=no; - echo $ac_n "checking for gcc version with buggy 64-bit support""... $ac_c" 1>&6 -echo "configure:6565: checking for gcc version with buggy 64-bit support" >&5 + echo "$as_me:$LINENO: checking for gcc version with buggy 64-bit support" >&5 +echo $ECHO_N "checking for gcc version with buggy 64-bit support... $ECHO_C" >&6 # Add more tests for gcc versions with non-working 64-bit support here. - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ :__GNUC__:__GNUC_MINOR__:__i386__: -EOF +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep ": 2 : 91 : 1 :" >/dev/null 2>&1; then - rm -rf conftest* + $EGREP ": 2 : 91 : 1 :" >/dev/null 2>&1; then bad_64bit_gcc=yes; - echo "$ac_t""yes: egcs-1.1.2 on ix86 spotted" 1>&6 + echo "$as_me:$LINENO: result: yes: egcs-1.1.2 on ix86 spotted" >&5 +echo "${ECHO_T}yes: egcs-1.1.2 on ix86 spotted" >&6 else - rm -rf conftest* - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi rm -f conftest* if test $bad_64bit_gcc = yes ; then - { echo "configure: error: A newer version of gcc is needed for the requested 64-bit BFD configuration" 1>&2; exit 1; } + { { echo "$as_me:$LINENO: error: A newer version of gcc is needed for the requested 64-bit BFD configuration" >&5 +echo "$as_me: error: A newer version of gcc is needed for the requested 64-bit BFD configuration" >&2;} + { (exit 1); exit 1; }; } fi fi ;; @@ -6603,104 +13437,530 @@ esac # fseeko, long. This assumes that sizeof off_t is .ge. sizeof long. # Hopefully a reasonable assumption since fseeko et.al. should be # upward compatible. -for ac_func in ftello ftello64 fseeko fseeko64 + + + + + +for ac_func in ftello ftello64 fseeko fseeko64 fopen64 do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6610: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - + builtin and then its argument prototype would still apply. */ +char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif -; return 0; } -EOF -if { (eval echo configure:6638: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 fi done if test x"$ac_cv_func_ftello" = xyes -a x"$ac_cv_func_fseeko" = xyes; then - echo $ac_n "checking size of off_t""... $ac_c" 1>&6 -echo "configure:6664: checking size of off_t" >&5 -if eval "test \"`echo '$''{'ac_cv_sizeof_off_t'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking for off_t" >&5 +echo $ECHO_N "checking for off_t... $ECHO_C" >&6 +if test "${ac_cv_type_off_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence. - cat > conftest.$ac_ext < - - -int main() { -switch (0) case 0: case (sizeof (off_t) == $ac_size):; -; return 0; } -EOF -if { (eval echo configure:6680: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_sizeof_off_t=$ac_size + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if ((off_t *) 0) + return 0; +if (sizeof (off_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_off_t=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_off_t=no fi -rm -f conftest* - if test x$ac_cv_sizeof_off_t != x ; then break; fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5 +echo "${ECHO_T}$ac_cv_type_off_t" >&6 + +echo "$as_me:$LINENO: checking size of off_t" >&5 +echo $ECHO_N "checking size of off_t... $ECHO_C" >&6 +if test "${ac_cv_sizeof_off_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$ac_cv_type_off_t" = yes; then + # The cast to unsigned long works around a bug in the HP C Compiler + # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects + # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. + # This bug is HP SR number 8606223364. + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (off_t))) >= 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (off_t))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (off_t))) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (off_t))) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo= ac_hi= +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (off_t))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo=`expr '(' $ac_mid ')' + 1` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done +case $ac_lo in +?*) ac_cv_sizeof_off_t=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (off_t), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (off_t), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } ;; +esac +else + if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run test program while cross compiling +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +long longval () { return (long) (sizeof (off_t)); } +unsigned long ulongval () { return (long) (sizeof (off_t)); } +#include +#include +int +main () +{ -fi + FILE *f = fopen ("conftest.val", "w"); + if (! f) + exit (1); + if (((long) (sizeof (off_t))) < 0) + { + long i = longval (); + if (i != ((long) (sizeof (off_t)))) + exit (1); + fprintf (f, "%ld\n", i); + } + else + { + unsigned long i = ulongval (); + if (i != ((long) (sizeof (off_t)))) + exit (1); + fprintf (f, "%lu\n", i); + } + exit (ferror (f) || fclose (f) != 0); -if test x$ac_cv_sizeof_off_t = x ; then - { echo "configure: error: cannot determine a size for off_t" 1>&2; exit 1; } + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sizeof_off_t=`cat conftest.val` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (off_t), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (off_t), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } fi -echo "$ac_t""$ac_cv_sizeof_off_t" 1>&6 -cat >> confdefs.h <&5 +echo "${ECHO_T}$ac_cv_sizeof_off_t" >&6 +cat >>confdefs.h <<_ACEOF #define SIZEOF_OFF_T $ac_cv_sizeof_off_t -EOF +_ACEOF fi -echo $ac_n "checking file_ptr type""... $ac_c" 1>&6 -echo "configure:6704: checking file_ptr type" >&5 +echo "$as_me:$LINENO: checking file_ptr type" >&5 +echo $ECHO_N "checking file_ptr type... $ECHO_C" >&6 bfd_file_ptr="long" bfd_ufile_ptr="unsigned long" if test x"$ac_cv_func_ftello64" = xyes -a x"$ac_cv_func_fseeko64" = xyes \ @@ -6708,7 +13968,8 @@ if test x"$ac_cv_func_ftello64" = xyes -a x"$ac_cv_func_fseeko64" = xyes \ bfd_file_ptr=BFD_HOST_64_BIT bfd_ufile_ptr=BFD_HOST_U_64_BIT fi -echo "$ac_t""$bfd_file_ptr" 1>&6 +echo "$as_me:$LINENO: result: $bfd_file_ptr" >&5 +echo "${ECHO_T}$bfd_file_ptr" >&6 @@ -6721,112 +13982,276 @@ test -n "${selarchs}" && tdefaults="${tdefaults} -DSELECT_ARCHITECTURES='${selar test -n "${havevecs}" && tdefaults="${tdefaults} ${havevecs}" -for ac_hdr in unistd.h + + +for ac_header in stdlib.h unistd.h do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6729: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6739: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else - echo "$ac_t""no" 1>&6 + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + done + for ac_func in getpagesize do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6768: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - + builtin and then its argument prototype would still apply. */ +char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif -; return 0; } -EOF -if { (eval echo configure:6796: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 fi done -echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:6821: checking for working mmap" >&5 -if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for working mmap" >&5 +echo $ECHO_N "checking for working mmap... $ECHO_C" >&6 +if test "${ac_cv_func_mmap_fixed_mapped+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_func_mmap_fixed_mapped=no else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +/* malloc might have been renamed as rpl_malloc. */ +#undef malloc /* Thanks to Mike Haertel and Jim Avera for this test. Here is a matrix of mmap possibilities: @@ -6840,34 +14265,34 @@ else back from the file, nor mmap's back from the file at a different address. (There have been systems where private was not correctly implemented like the infamous i386 svr4.0, and systems where the - VM page cache was not coherent with the filesystem buffer cache + VM page cache was not coherent with the file system buffer cache like early versions of FreeBSD and possibly contemporary NetBSD.) For shared mappings, we should conversely verify that changes get - propogated back to all the places they're supposed to be. + propagated back to all the places they're supposed to be. Grep wants private fixed already mapped. The main things grep needs to know about mmap are: * does it exist and is it safe to write into the mmap'd area * how to use it (BSD variants) */ -#include + #include #include -/* This mess was copied from the GNU getpagesize.h. */ -#ifndef HAVE_GETPAGESIZE -# ifdef HAVE_UNISTD_H -# include -# endif +#if !STDC_HEADERS && !HAVE_STDLIB_H +char *malloc (); +#endif +/* This mess was copied from the GNU getpagesize.h. */ +#if !HAVE_GETPAGESIZE /* Assume that all systems that can run configure have sys/param.h. */ -# ifndef HAVE_SYS_PARAM_H +# if !HAVE_SYS_PARAM_H # define HAVE_SYS_PARAM_H 1 # endif # ifdef _SC_PAGESIZE # define getpagesize() sysconf(_SC_PAGESIZE) # else /* no _SC_PAGESIZE */ -# ifdef HAVE_SYS_PARAM_H +# if HAVE_SYS_PARAM_H # include # ifdef EXEC_PAGESIZE # define getpagesize() EXEC_PAGESIZE @@ -6894,602 +14319,1705 @@ else #endif /* no HAVE_GETPAGESIZE */ -#ifdef __cplusplus -extern "C" { void *malloc(unsigned); } -#else -char *malloc(); -#endif - int -main() +main () { - char *data, *data2, *data3; - int i, pagesize; - int fd; + char *data, *data2, *data3; + int i, pagesize; + int fd; - pagesize = getpagesize(); + pagesize = getpagesize (); - /* - * First, make a file with some known garbage in it. - */ - data = malloc(pagesize); - if (!data) - exit(1); - for (i = 0; i < pagesize; ++i) - *(data + i) = rand(); - umask(0); - fd = creat("conftestmmap", 0600); - if (fd < 0) - exit(1); - if (write(fd, data, pagesize) != pagesize) - exit(1); - close(fd); + /* First, make a file with some known garbage in it. */ + data = (char *) malloc (pagesize); + if (!data) + exit (1); + for (i = 0; i < pagesize; ++i) + *(data + i) = rand (); + umask (0); + fd = creat ("conftest.mmap", 0600); + if (fd < 0) + exit (1); + if (write (fd, data, pagesize) != pagesize) + exit (1); + close (fd); - /* - * Next, try to mmap the file at a fixed address which - * already has something else allocated at it. If we can, - * also make sure that we see the same garbage. - */ - fd = open("conftestmmap", O_RDWR); - if (fd < 0) - exit(1); - data2 = malloc(2 * pagesize); - if (!data2) - exit(1); - data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1); - if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_FIXED, fd, 0L)) - exit(1); - for (i = 0; i < pagesize; ++i) - if (*(data + i) != *(data2 + i)) - exit(1); + /* Next, try to mmap the file at a fixed address which already has + something else allocated at it. If we can, also make sure that + we see the same garbage. */ + fd = open ("conftest.mmap", O_RDWR); + if (fd < 0) + exit (1); + data2 = (char *) malloc (2 * pagesize); + if (!data2) + exit (1); + data2 += (pagesize - ((long) data2 & (pagesize - 1))) & (pagesize - 1); + if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_FIXED, fd, 0L)) + exit (1); + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data2 + i)) + exit (1); - /* - * Finally, make sure that changes to the mapped area - * do not percolate back to the file as seen by read(). - * (This is a bug on some variants of i386 svr4.0.) - */ - for (i = 0; i < pagesize; ++i) - *(data2 + i) = *(data2 + i) + 1; - data3 = malloc(pagesize); - if (!data3) - exit(1); - if (read(fd, data3, pagesize) != pagesize) - exit(1); - for (i = 0; i < pagesize; ++i) - if (*(data + i) != *(data3 + i)) - exit(1); - close(fd); - unlink("conftestmmap"); - exit(0); + /* Finally, make sure that changes to the mapped area do not + percolate back to the file as seen by read(). (This is a bug on + some variants of i386 svr4.0.) */ + for (i = 0; i < pagesize; ++i) + *(data2 + i) = *(data2 + i) + 1; + data3 = (char *) malloc (pagesize); + if (!data3) + exit (1); + if (read (fd, data3, pagesize) != pagesize) + exit (1); + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data3 + i)) + exit (1); + close (fd); + exit (0); } - -EOF -if { (eval echo configure:6969: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_func_mmap_fixed_mapped=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_func_mmap_fixed_mapped=no -fi -rm -fr conftest* -fi + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +( exit $ac_status ) +ac_cv_func_mmap_fixed_mapped=no fi - -echo "$ac_t""$ac_cv_func_mmap_fixed_mapped" 1>&6 +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_func_mmap_fixed_mapped" >&5 +echo "${ECHO_T}$ac_cv_func_mmap_fixed_mapped" >&6 if test $ac_cv_func_mmap_fixed_mapped = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_MMAP 1 -EOF +_ACEOF fi +rm -f conftest.mmap + + for ac_func in madvise mprotect do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6994: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - + builtin and then its argument prototype would still apply. */ +char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif -; return 0; } -EOF -if { (eval echo configure:7022: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 fi done case ${want_mmap}+${ac_cv_func_mmap_fixed_mapped} in - true+yes ) cat >> confdefs.h <<\EOF + true+yes ) +cat >>confdefs.h <<\_ACEOF #define USE_MMAP 1 -EOF +_ACEOF ;; esac rm -f doc/config.status -trap '' 1 2 15 -cat > confcache <<\EOF + ac_config_files="$ac_config_files Makefile doc/Makefile bfd-in3.h:bfd-in2.h po/Makefile.in:po/Make-in" + + ac_config_commands="$ac_config_commands default" + + + + + + +cat >confcache <<\_ACEOF # 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. +# scripts and configure runs, see configure's option --config-cache. +# 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. +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. # -EOF +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. -(set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote substitution - # turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - -e "s/'/'\\\\''/g" \ - -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' - ;; - esac >> confcache -if cmp -s $cache_file confcache; then - : -else +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then - echo "updating cache $cache_file" - cat confcache > $cache_file + test "x$cache_file" != "x/dev/null" && 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. +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' fi -trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 - DEFS=-DHAVE_CONFIG_H -# Without the "./", some shells look in PATH for config.status. -: ${CONFIG_STATUS=./config.status} - -echo creating $CONFIG_STATUS -rm -f $CONFIG_STATUS -cat > $CONFIG_STATUS </dev/null | sed 1q`: -# -# $0 $ac_configure_args -# -# Compiler output produced by configure, useful for debugging -# configure, is in ./config.log if it exists. - -ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" -for ac_option -do - case "\$ac_option" in - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" - exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; - -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.13" - exit 0 ;; - -help | --help | --hel | --he | --h) - echo "\$ac_cs_usage"; exit 0 ;; - *) echo "\$ac_cs_usage"; exit 1 ;; - esac +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_i=`echo "$ac_i" | + sed 's/\$U\././;s/\.o$//;s/\.obj$//'` + # 2. Add them. + ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' done +LIBOBJS=$ac_libobjs -ac_given_srcdir=$srcdir -ac_given_INSTALL="$INSTALL" +LTLIBOBJS=$ac_ltlibobjs -trap 'rm -fr `echo "Makefile doc/Makefile bfd-in3.h:bfd-in2.h bfdver.h:version.h po/Makefile.in:po/Make-in config.h:config.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 -EOF -cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF -$ac_vpsub -$extrasub -s%@SHELL@%$SHELL%g -s%@CFLAGS@%$CFLAGS%g -s%@CPPFLAGS@%$CPPFLAGS%g -s%@CXXFLAGS@%$CXXFLAGS%g -s%@FFLAGS@%$FFLAGS%g -s%@DEFS@%$DEFS%g -s%@LDFLAGS@%$LDFLAGS%g -s%@LIBS@%$LIBS%g -s%@exec_prefix@%$exec_prefix%g -s%@prefix@%$prefix%g -s%@program_transform_name@%$program_transform_name%g -s%@bindir@%$bindir%g -s%@sbindir@%$sbindir%g -s%@libexecdir@%$libexecdir%g -s%@datadir@%$datadir%g -s%@sysconfdir@%$sysconfdir%g -s%@sharedstatedir@%$sharedstatedir%g -s%@localstatedir@%$localstatedir%g -s%@libdir@%$libdir%g -s%@includedir@%$includedir%g -s%@oldincludedir@%$oldincludedir%g -s%@infodir@%$infodir%g -s%@mandir@%$mandir%g -s%@host@%$host%g -s%@host_alias@%$host_alias%g -s%@host_cpu@%$host_cpu%g -s%@host_vendor@%$host_vendor%g -s%@host_os@%$host_os%g -s%@target@%$target%g -s%@target_alias@%$target_alias%g -s%@target_cpu@%$target_cpu%g -s%@target_vendor@%$target_vendor%g -s%@target_os@%$target_os%g -s%@build@%$build%g -s%@build_alias@%$build_alias%g -s%@build_cpu@%$build_cpu%g -s%@build_vendor@%$build_vendor%g -s%@build_os@%$build_os%g -s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g -s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g -s%@INSTALL_DATA@%$INSTALL_DATA%g -s%@PACKAGE@%$PACKAGE%g -s%@VERSION@%$VERSION%g -s%@ACLOCAL@%$ACLOCAL%g -s%@AUTOCONF@%$AUTOCONF%g -s%@AUTOMAKE@%$AUTOMAKE%g -s%@AUTOHEADER@%$AUTOHEADER%g -s%@MAKEINFO@%$MAKEINFO%g -s%@SET_MAKE@%$SET_MAKE%g -s%@bfd_version@%$bfd_version%g -s%@bfd_version_string@%$bfd_version_string%g -s%@AR@%$AR%g -s%@RANLIB@%$RANLIB%g -s%@CC@%$CC%g -s%@LN_S@%$LN_S%g -s%@OBJEXT@%$OBJEXT%g -s%@EXEEXT@%$EXEEXT%g -s%@STRIP@%$STRIP%g -s%@LIBTOOL@%$LIBTOOL%g -s%@WARN_CFLAGS@%$WARN_CFLAGS%g -s%@MAINTAINER_MODE_TRUE@%$MAINTAINER_MODE_TRUE%g -s%@MAINTAINER_MODE_FALSE@%$MAINTAINER_MODE_FALSE%g -s%@MAINT@%$MAINT%g -s%@INSTALL_LIBBFD_TRUE@%$INSTALL_LIBBFD_TRUE%g -s%@INSTALL_LIBBFD_FALSE@%$INSTALL_LIBBFD_FALSE%g -s%@bfdlibdir@%$bfdlibdir%g -s%@bfdincludedir@%$bfdincludedir%g -s%@CPP@%$CPP%g -s%@ALLOCA@%$ALLOCA%g -s%@USE_NLS@%$USE_NLS%g -s%@MSGFMT@%$MSGFMT%g -s%@GMSGFMT@%$GMSGFMT%g -s%@XGETTEXT@%$XGETTEXT%g -s%@USE_INCLUDED_LIBINTL@%$USE_INCLUDED_LIBINTL%g -s%@CATALOGS@%$CATALOGS%g -s%@CATOBJEXT@%$CATOBJEXT%g -s%@DATADIRNAME@%$DATADIRNAME%g -s%@GMOFILES@%$GMOFILES%g -s%@INSTOBJEXT@%$INSTOBJEXT%g -s%@INTLDEPS@%$INTLDEPS%g -s%@INTLLIBS@%$INTLLIBS%g -s%@INTLOBJS@%$INTLOBJS%g -s%@POFILES@%$POFILES%g -s%@POSUB@%$POSUB%g -s%@INCLUDE_LOCALE_H@%$INCLUDE_LOCALE_H%g -s%@GT_NO@%$GT_NO%g -s%@GT_YES@%$GT_YES%g -s%@MKINSTALLDIRS@%$MKINSTALLDIRS%g -s%@l@%$l%g -s%@HDEFINES@%$HDEFINES%g -s%@BFD_HOST_64BIT_LONG@%$BFD_HOST_64BIT_LONG%g -s%@BFD_HOST_LONG_LONG@%$BFD_HOST_LONG_LONG%g -s%@BFD_HOST_64_BIT_DEFINED@%$BFD_HOST_64_BIT_DEFINED%g -s%@BFD_HOST_64_BIT@%$BFD_HOST_64_BIT%g -s%@BFD_HOST_U_64_BIT@%$BFD_HOST_U_64_BIT%g -s%@CC_FOR_BUILD@%$CC_FOR_BUILD%g -s%@EXEEXT_FOR_BUILD@%$EXEEXT_FOR_BUILD%g -s%@COREFILE@%$COREFILE%g -s%@COREFLAG@%$COREFLAG%g -s%@WIN32LDFLAGS@%$WIN32LDFLAGS%g -s%@WIN32LIBADD@%$WIN32LIBADD%g -s%@TDEFINES@%$TDEFINES%g -s%@wordsize@%$wordsize%g -s%@bfd_libs@%$bfd_libs%g -s%@all_backends@%$all_backends%g -s%@bfd_backends@%$bfd_backends%g -s%@bfd_machines@%$bfd_machines%g -s%@bfd_default_target_size@%$bfd_default_target_size%g -s%@bfd_file_ptr@%$bfd_file_ptr%g -s%@bfd_ufile_ptr@%$bfd_ufile_ptr%g -s%@tdefaults@%$tdefaults%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 +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"MAINTAINER_MODE\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${INSTALL_LIBBFD_TRUE}" && test -z "${INSTALL_LIBBFD_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"INSTALL_LIBBFD\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"INSTALL_LIBBFD\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } fi -EOF -cat >> $CONFIG_STATUS <&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. -CONFIG_FILES=\${CONFIG_FILES-"Makefile doc/Makefile bfd-in3.h:bfd-in2.h bfdver.h:version.h po/Makefile.in:po/Make-in"} -EOF -cat >> $CONFIG_STATUS <<\EOF -for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` - ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - *) ac_file_in="${ac_file}.in" ;; +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi +DUALCASE=1; export DUALCASE # for MKS sh + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 +echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; esac - # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 +echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} + { (exit 1); exit 1; }; } - # 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'` + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' else - ac_dir_suffix= ac_dots= + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + +exec 6>&1 + +# Open the log real soon, to keep \$[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. Logging --version etc. is OK. +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX +} >&5 +cat >&5 <<_CSEOF + +This file was extended by $as_me, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +_CSEOF +echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 +echo >&5 +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\_ACEOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to ." +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +config.status +configured by $0, generated by GNU Autoconf 2.59, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + +Copyright (C) 2003 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir=$srcdir +INSTALL="$INSTALL" +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + ac_shift=: + ;; + -*) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_option=$1 + ac_need_defaults=false;; + esac + + case $ac_option in + # Handling of the options. +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:$LINENO: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + ac_need_defaults=false;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +if \$ac_cs_recheck; then + echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +# +# INIT-COMMANDS section. +# + +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" + + +_ACEOF + + + +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; + "bfd-in3.h" ) CONFIG_FILES="$CONFIG_FILES bfd-in3.h:bfd-in2.h" ;; + "po/Makefile.in" ) CONFIG_FILES="$CONFIG_FILES po/Makefile.in:po/Make-in" ;; + "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "default" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;; + "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h:config.in" ;; + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason to put it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./confstat$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF + +# +# CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "\$CONFIG_FILES"; then + # Protect against being on the right side of a sed subst in config.status. + sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@DEFS@,$DEFS,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@LIBS@,$LIBS,;t t +s,@build@,$build,;t t +s,@build_cpu@,$build_cpu,;t t +s,@build_vendor@,$build_vendor,;t t +s,@build_os@,$build_os,;t t +s,@host@,$host,;t t +s,@host_cpu@,$host_cpu,;t t +s,@host_vendor@,$host_vendor,;t t +s,@host_os@,$host_os,;t t +s,@target@,$target,;t t +s,@target_cpu@,$target_cpu,;t t +s,@target_vendor@,$target_vendor,;t t +s,@target_os@,$target_os,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@CYGPATH_W@,$CYGPATH_W,;t t +s,@PACKAGE@,$PACKAGE,;t t +s,@VERSION@,$VERSION,;t t +s,@ACLOCAL@,$ACLOCAL,;t t +s,@AUTOCONF@,$AUTOCONF,;t t +s,@AUTOMAKE@,$AUTOMAKE,;t t +s,@AUTOHEADER@,$AUTOHEADER,;t t +s,@MAKEINFO@,$MAKEINFO,;t t +s,@install_sh@,$install_sh,;t t +s,@STRIP@,$STRIP,;t t +s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t +s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t +s,@mkdir_p@,$mkdir_p,;t t +s,@AWK@,$AWK,;t t +s,@SET_MAKE@,$SET_MAKE,;t t +s,@am__leading_dot@,$am__leading_dot,;t t +s,@AMTAR@,$AMTAR,;t t +s,@am__tar@,$am__tar,;t t +s,@am__untar@,$am__untar,;t t +s,@DEPDIR@,$DEPDIR,;t t +s,@am__include@,$am__include,;t t +s,@am__quote@,$am__quote,;t t +s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t +s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t +s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t +s,@CCDEPMODE@,$CCDEPMODE,;t t +s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t +s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t +s,@AR@,$AR,;t t +s,@ac_ct_AR@,$ac_ct_AR,;t t +s,@RANLIB@,$RANLIB,;t t +s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t +s,@LN_S@,$LN_S,;t t +s,@LIBTOOL@,$LIBTOOL,;t t +s,@WARN_CFLAGS@,$WARN_CFLAGS,;t t +s,@NO_WERROR@,$NO_WERROR,;t t +s,@MAINTAINER_MODE_TRUE@,$MAINTAINER_MODE_TRUE,;t t +s,@MAINTAINER_MODE_FALSE@,$MAINTAINER_MODE_FALSE,;t t +s,@MAINT@,$MAINT,;t t +s,@INSTALL_LIBBFD_TRUE@,$INSTALL_LIBBFD_TRUE,;t t +s,@INSTALL_LIBBFD_FALSE@,$INSTALL_LIBBFD_FALSE,;t t +s,@host_noncanonical@,$host_noncanonical,;t t +s,@target_noncanonical@,$target_noncanonical,;t t +s,@bfdlibdir@,$bfdlibdir,;t t +s,@bfdincludedir@,$bfdincludedir,;t t +s,@CPP@,$CPP,;t t +s,@EGREP@,$EGREP,;t t +s,@ALLOCA@,$ALLOCA,;t t +s,@USE_NLS@,$USE_NLS,;t t +s,@MSGFMT@,$MSGFMT,;t t +s,@GMSGFMT@,$GMSGFMT,;t t +s,@XGETTEXT@,$XGETTEXT,;t t +s,@USE_INCLUDED_LIBINTL@,$USE_INCLUDED_LIBINTL,;t t +s,@CATALOGS@,$CATALOGS,;t t +s,@CATOBJEXT@,$CATOBJEXT,;t t +s,@DATADIRNAME@,$DATADIRNAME,;t t +s,@GMOFILES@,$GMOFILES,;t t +s,@INSTOBJEXT@,$INSTOBJEXT,;t t +s,@INTLDEPS@,$INTLDEPS,;t t +s,@INTLLIBS@,$INTLLIBS,;t t +s,@INTLOBJS@,$INTLOBJS,;t t +s,@POFILES@,$POFILES,;t t +s,@POSUB@,$POSUB,;t t +s,@INCLUDE_LOCALE_H@,$INCLUDE_LOCALE_H,;t t +s,@GT_NO@,$GT_NO,;t t +s,@GT_YES@,$GT_YES,;t t +s,@MKINSTALLDIRS@,$MKINSTALLDIRS,;t t +s,@l@,$l,;t t +s,@HDEFINES@,$HDEFINES,;t t +s,@BFD_HOST_64BIT_LONG@,$BFD_HOST_64BIT_LONG,;t t +s,@BFD_HOST_LONG_LONG@,$BFD_HOST_LONG_LONG,;t t +s,@BFD_HOST_64_BIT_DEFINED@,$BFD_HOST_64_BIT_DEFINED,;t t +s,@BFD_HOST_64_BIT@,$BFD_HOST_64_BIT,;t t +s,@BFD_HOST_U_64_BIT@,$BFD_HOST_U_64_BIT,;t t +s,@CC_FOR_BUILD@,$CC_FOR_BUILD,;t t +s,@EXEEXT_FOR_BUILD@,$EXEEXT_FOR_BUILD,;t t +s,@COREFILE@,$COREFILE,;t t +s,@COREFLAG@,$COREFLAG,;t t +s,@WIN32LDFLAGS@,$WIN32LDFLAGS,;t t +s,@WIN32LIBADD@,$WIN32LIBADD,;t t +s,@TDEFINES@,$TDEFINES,;t t +s,@wordsize@,$wordsize,;t t +s,@bfd_libs@,$bfd_libs,;t t +s,@all_backends@,$all_backends,;t t +s,@bfd_backends@,$bfd_backends,;t t +s,@bfd_machines@,$bfd_machines,;t t +s,@bfd_default_target_size@,$bfd_default_target_size,;t t +s,@bfd_file_ptr@,$bfd_file_ptr,;t t +s,@bfd_ufile_ptr@,$bfd_ufile_ptr,;t t +s,@tdefaults@,$tdefaults,;t t +s,@datarootdir@,$datarootdir,;t t +s,@docdir@,$docdir,;t t +s,@htmldir@,$htmldir,;t t +s,@LIBOBJS@,$LIBOBJS,;t t +s,@LTLIBOBJS@,$LTLIBOBJS,;t t +CEOF + +_ACEOF + + cat >>$CONFIG_STATUS <<\_ACEOF + # 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_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # 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" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_builddir$INSTALL ;; + esac + + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + configure_input= + else + configure_input="$ac_file. " + fi + configure_input=$configure_input"Generated from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo "$f";; + *) # Relative + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@abs_srcdir@,$ac_abs_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t +s,@builddir@,$ac_builddir,;t t +s,@abs_builddir@,$ac_abs_builddir,;t t +s,@top_builddir@,$ac_top_builddir,;t t +s,@abs_top_builddir@,$ac_abs_top_builddir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out 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 +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF - 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* +# +# CONFIG_HEADER section. +# # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. -ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' -ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' -ac_dC='\3' -ac_dD='%g' -# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". -ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_uB='\([ ]\)%\1#\2define\3' +ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='[ ].*$,\1#\2' +ac_dC=' ' +ac_dD=',;t' +# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='$,\1#\2define\3' ac_uC=' ' -ac_uD='\4%g' -# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". -ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_eB='$%\1#\2define\3' -ac_eC=' ' -ac_eD='%g' +ac_uD=',;t' -if test "${CONFIG_HEADERS+set}" != set; then -EOF -cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF -fi -for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then +for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue # 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" ;; + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; esac - echo creating $ac_file + test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} - rm -f conftest.frag conftest.in conftest.out - ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` - cat $ac_file_inputs > conftest.in + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + # Do quote $f, to prevent DOS paths from being IFS'd. + echo "$f";; + *) # Relative + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } + # Remove the trailing spaces. + sed 's/[ ]*$//' $ac_file_inputs >$tmp/in -EOF +_ACEOF -# Transform confdefs.h into a sed script conftest.vals that substitutes -# the proper values into config.h.in to produce config.h. And first: -# Protect against being on the right side of a sed subst in config.status. -# Protect against being in an unquoted here document in config.status. -rm -f conftest.vals -cat > conftest.hdr <<\EOF -s/[\\&%]/\\&/g -s%[\\$`]%\\&%g -s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp -s%ac_d%ac_u%gp -s%ac_u%ac_e%gp -EOF -sed -n -f conftest.hdr confdefs.h > conftest.vals -rm -f conftest.hdr +# Transform confdefs.h into two sed scripts, `conftest.defines' and +# `conftest.undefs', that substitutes the proper values into +# config.h.in to produce config.h. The first handles `#define' +# templates, and the second `#undef' templates. +# And first: Protect against being on the right side of a sed subst in +# config.status. Protect against being in an unquoted here document +# in config.status. +rm -f conftest.defines conftest.undefs +# Using a here document instead of a string reduces the quoting nightmare. +# Putting comments in sed scripts is not portable. +# +# `end' is used to avoid that the second main sed command (meant for +# 0-ary CPP macros) applies to n-ary macro definitions. +# See the Autoconf documentation for `clear'. +cat >confdef2sed.sed <<\_ACEOF +s/[\\&,]/\\&/g +s,[\\$`],\\&,g +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp +t end +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp +: end +_ACEOF +# If some macros were called several times there might be several times +# the same #defines, which is useless. Nevertheless, we may not want to +# sort them, since we want the *last* AC-DEFINE to be honored. +uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines +sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs +rm -f confdef2sed.sed # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. -cat >> conftest.vals <<\EOF -s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% -EOF - -# Break up conftest.vals because some shells have a limit on -# the size of here documents, and old seds have small limits too. +cat >>conftest.undefs <<\_ACEOF +s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, +_ACEOF +# Break up conftest.defines because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS +echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS +echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS +echo ' :' >>$CONFIG_STATUS rm -f conftest.tail -while : +while grep . conftest.defines >/dev/null do - ac_lines=`grep -c . conftest.vals` - # grep -c gives empty output for an empty file on some AIX systems. - if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi - # Write a limited-size here document to conftest.frag. - echo ' cat > conftest.frag <> $CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS + # Write a limited-size here document to $tmp/defines.sed. + echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#define' lines. + echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF - sed -f conftest.frag conftest.in > conftest.out - rm -f conftest.in - mv conftest.out conftest.in -' >> $CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail - rm -f conftest.vals - mv conftest.tail conftest.vals + sed -f $tmp/defines.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail + rm -f conftest.defines + mv conftest.tail conftest.defines done -rm -f conftest.vals +rm -f conftest.defines +echo ' fi # grep' >>$CONFIG_STATUS +echo >>$CONFIG_STATUS -cat >> $CONFIG_STATUS <<\EOF - rm -f conftest.frag conftest.h - echo "/* $ac_file. Generated automatically by configure. */" > conftest.h - cat conftest.in >> conftest.h - rm -f conftest.in - if cmp -s $ac_file conftest.h 2>/dev/null; then - echo "$ac_file is unchanged" - rm -f conftest.h +# Break up conftest.undefs because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #undef templates' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.undefs >/dev/null +do + # Write a limited-size here document to $tmp/undefs.sed. + echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#undef' + echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/undefs.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail + rm -f conftest.undefs + mv conftest.tail conftest.undefs +done +rm -f conftest.undefs + +cat >>$CONFIG_STATUS <<\_ACEOF + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + echo "/* Generated by configure. */" >$tmp/config.h else - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` - if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - # The file is in a subdirectory. - test ! -d "$ac_dir" && mkdir "$ac_dir" - fi - rm -f $ac_file - mv conftest.h $ac_file + echo "/* $ac_file. Generated by configure. */" >$tmp/config.h fi -fi; done + cat $tmp/in >>$tmp/config.h + rm -f $tmp/in + if test x"$ac_file" != x-; then + if diff $ac_file $tmp/config.h >/dev/null 2>&1; then + { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} + else + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } -EOF -cat >> $CONFIG_STATUS <`(dirname $ac_file) 2>/dev/null || +$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X$ac_file : 'X\(//\)[^/]' \| \ + X$ac_file : 'X\(//\)$' \| \ + X$ac_file : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X$ac_file | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'`/stamp-h$_am_stamp_count +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + +# +# CONFIG_COMMANDS section. +# +for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue + ac_dest=`echo "$ac_file" | sed 's,:.*,,'` + ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_dir=`(dirname "$ac_dest") 2>/dev/null || +$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_dest" : 'X\(//\)[^/]' \| \ + X"$ac_dest" : 'X\(//\)$' \| \ + X"$ac_dest" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_dest" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac -EOF -cat >> $CONFIG_STATUS <<\EOF -test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h -sed -e '/SRC-POTFILES =/r po/SRC-POTFILES' -e '/BLD-POTFILES =/r po/BLD-POTFILES' po/Makefile.in > po/Makefile -exit 0 -EOF + { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 +echo "$as_me: executing $ac_dest commands" >&6;} + case $ac_dest in + depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # So let's grep whole file. + if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + dirpart=`(dirname "$mf") 2>/dev/null || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`(dirname "$file") 2>/dev/null || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p $dirpart/$fdir + else + as_dir=$dirpart/$fdir + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5 +echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} + { (exit 1); exit 1; }; }; } + + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done + ;; + default ) sed -e '/SRC-POTFILES =/r po/SRC-POTFILES' -e '/BLD-POTFILES =/r po/BLD-POTFILES' po/Makefile.in > po/Makefile ;; + esac +done +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +{ (exit 0); exit 0; } +_ACEOF chmod +x $CONFIG_STATUS -rm -fr confdefs* $ac_clean_files -test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 +ac_clean_files=$ac_clean_files_save + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi diff --git a/contrib/binutils/bfd/configure.host b/contrib/binutils/bfd/configure.host index 024ed625420..11b42e0fc13 100644 --- a/contrib/binutils/bfd/configure.host +++ b/contrib/binutils/bfd/configure.host @@ -19,16 +19,20 @@ HOST_U_64BIT_TYPE= case "${host}" in -hppa*-*-hpux*) # HP/UX's ftello64 et.al. declarations are only +hppa*64*-*-hpux*) # HP/UX's ftello64 et.al. declarations are only # visible when _LARGEFILE64_SOURCE is defined. # Without those declarations, real_ftell et.al. # get mis-compiled. - HDEFINES="-DHOST_HPPAHPUX -D_LARGEFILE64_SOURCE" ;; + HDEFINES="-DHOST_HPPAHPUX -D_LARGEFILE64_SOURCE" + host64=true;; +hppa*-*-hpux*) HDEFINES="-DHOST_HPPAHPUX -D_LARGEFILE64_SOURCE" ;; hppa*-*-hiux*) HDEFINES=-DHOST_HPPAHPUX ;; hppa*-*-mpeix*) HDEFINES=-DHOST_HPPAMPEIX ;; hppa*-*-bsd*) HDEFINES=-DHOST_HPPABSD ;; hppa*-*-osf*) HDEFINES=-DHOST_HPPAOSF ;; +ia64-*-hpux*) HDEFINES=-D_LARGEFILE64_SOURCE + host64=true;; ia64-*-*) host64=true;; # Workaround for limitations on win9x where file contents are diff --git a/contrib/binutils/bfd/configure.in b/contrib/binutils/bfd/configure.in index 9ed695c1979..212f96142fd 100644 --- a/contrib/binutils/bfd/configure.in +++ b/contrib/binutils/bfd/configure.in @@ -1,27 +1,14 @@ dnl Process this file with autoconf to produce a configure script. dnl -AC_PREREQ(2.13) -AC_INIT(libbfd.c) +AC_PREREQ(2.59) +AC_INIT +AC_CONFIG_SRCDIR([libbfd.c]) -AC_CANONICAL_SYSTEM +AC_CANONICAL_TARGET AC_ISC_POSIX -AM_INIT_AUTOMAKE(bfd, 2.15) -# Uncomment the next line to remove the date from the reported bfd version -#is_release=y - -changequote(,)dnl -bfd_version=`echo "${VERSION}" | sed -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$/\1\2\3\4\5/'` -changequote([,])dnl - -bfd_version_string="\"${VERSION}\"" -if test x${is_release} = x; then - bfd_version_date=`sed -n -e 's/.*DATE //p' < ${srcdir}/version.h` - bfd_version_string="\"${VERSION} ${bfd_version_date}\"" -fi -AC_SUBST(bfd_version) -AC_SUBST(bfd_version_string) +AM_INIT_AUTOMAKE(bfd, 2.17) dnl These must be called before AM_PROG_LIBTOOL, because it may want dnl to call AC_CHECK_PROG. @@ -44,7 +31,7 @@ esac],[want64=false])dnl AC_ARG_ENABLE(targets, [ --enable-targets alternative target configurations], [case "${enableval}" in - yes | "") AC_ERROR(enable-targets option must specify target names or 'all') + yes | "") AC_MSG_ERROR([enable-targets option must specify target names or 'all']) ;; no) enable_targets= ;; *) enable_targets=$enableval ;; @@ -64,26 +51,19 @@ AC_ARG_WITH(mmap, *) AC_MSG_ERROR(bad value ${withval} for BFD with-mmap option) ;; esac],[want_mmap=false])dnl -build_warnings="-W -Wall -Wstrict-prototypes -Wmissing-prototypes" -AC_ARG_ENABLE(build-warnings, -[ --enable-build-warnings Enable build-time compiler warnings if gcc is used], +AC_ARG_ENABLE(secureplt, +[ --enable-secureplt Default to creating read-only plt entries], [case "${enableval}" in - yes) ;; - no) build_warnings="-w";; - ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"` - build_warnings="${build_warnings} ${t}";; - *,) t=`echo "${enableval}" | sed -e "s/,/ /g"` - build_warnings="${t} ${build_warnings}";; - *) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;; -esac -if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then - echo "Setting warning flags = $build_warnings" 6>&1 -fi])dnl -WARN_CFLAGS="" -if test "x${build_warnings}" != x && test "x$GCC" = xyes ; then - WARN_CFLAGS="${build_warnings}" + yes) use_secureplt=true ;; + no) use_secureplt=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for secureplt option) ;; +esac],[use_secureplt=false])dnl +if test $use_secureplt = true; then + AC_DEFINE(USE_SECUREPLT, 1, + [Define if we should default to creating read-only plt entries]) fi -AC_SUBST(WARN_CFLAGS) + +AM_BINUTILS_WARNINGS AM_CONFIG_HEADER(config.h:config.in) @@ -102,8 +82,9 @@ bfd_default_target_size=32 # host stuff: AC_PROG_CC +AC_GNU_SOURCE -ALL_LINGUAS="fr tr ja es sv da zh_CN ro" +ALL_LINGUAS="fr tr ja es sv da zh_CN ro rw vi" CY_GNU_GETTEXT # Permit host specific settings. @@ -120,16 +101,14 @@ BFD_HOST_U_64_BIT= AC_MSG_CHECKING([for long long]) AC_CACHE_VAL(bfd_cv_has_long_long, -[AC_TRY_COMPILE(, -[unsigned long long ll = 18446744073709551615ULL;], -bfd_cv_has_long_long=yes, bfd_cv_has_long_long=no)]) +[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[unsigned long long ll = 18446744073709551615ULL;]])],[bfd_cv_has_long_long=yes],[bfd_cv_has_long_long=no])]) AC_MSG_RESULT($bfd_cv_has_long_long) if test $bfd_cv_has_long_long = yes; then BFD_HOST_LONG_LONG=1 - AC_COMPILE_CHECK_SIZEOF(long long) + AC_CHECK_SIZEOF(long long) fi -AC_COMPILE_CHECK_SIZEOF(long) +AC_CHECK_SIZEOF(long) if test "x${ac_cv_sizeof_long}" = "x8"; then host64=true BFD_HOST_64BIT_LONG=1 @@ -158,16 +137,27 @@ AC_CHECK_HEADERS(stddef.h string.h strings.h stdlib.h time.h unistd.h) AC_CHECK_HEADERS(fcntl.h sys/file.h sys/time.h) AC_HEADER_TIME AC_HEADER_DIRENT +ACX_HEADER_STRING AC_CHECK_FUNCS(fcntl getpagesize setitimer sysconf fdopen getuid getgid) AC_CHECK_FUNCS(strtoull) +AC_CHECK_DECLS(basename) +AC_CHECK_DECLS(ftello) +AC_CHECK_DECLS(ftello64) +AC_CHECK_DECLS(fseeko) +AC_CHECK_DECLS(fseeko64) + BFD_BINARY_FOPEN -BFD_NEED_DECLARATION(strstr) -BFD_NEED_DECLARATION(malloc) -BFD_NEED_DECLARATION(realloc) -BFD_NEED_DECLARATION(free) -BFD_NEED_DECLARATION(getenv) +AC_CHECK_DECLS(ffs) +AC_CHECK_DECLS(free) +AC_CHECK_DECLS(getenv) +AC_CHECK_DECLS(malloc) +AC_CHECK_DECLS(realloc) +AC_CHECK_DECLS(stpcpy) +AC_CHECK_DECLS(strstr) +AC_CHECK_DECLS(snprintf) +AC_CHECK_DECLS(vsnprintf) # If we are configured native, pick a core file support file. COREFILE= @@ -178,7 +168,7 @@ if test "${target}" = "${host}"; then alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu) COREFILE='' ;; - alpha*-*-linux-gnu*) + alpha*-*-linux-*) COREFILE=trad-core.lo TRAD_HEADER='"hosts/alphalinux.h"' ;; @@ -195,6 +185,10 @@ if test "${target}" = "${host}"; then hppa*-*-mpeix*) COREFILE=hpux-core.lo ;; hppa*-*-bsd*) COREFILE="hpux-core.lo hppabsd-core.lo" COREFLAG="-DHPUX_CORE -DHPPABSD_CORE" ;; + hppa*-*-netbsd* | hppa*-*-openbsd*) + COREFILE=netbsd-core.lo + ;; + i370-*-*) COREFILE=trad-core.lo TRAD_HEADER='"hosts/i370linux.h"' @@ -219,7 +213,7 @@ changequote([,])dnl COREFILE= ;; changequote(,)dnl - i[3-7]86-*-bsd* | i[3-7]86-*-freebsd[123] | i[3-7]86-*-freebsd[123]\.* | i[3-7]86-*-freebsd4\.[01234]* | i[3-7]86-*-freebsd*aout*) + i[3-7]86-*-bsd* | i[3-7]86-*-freebsd[123] | i[3-7]86-*-freebsd[123]\.* | i[3-7]86-*-freebsd4\.[01234] | i[3-7]86-*-freebsd4\.[01234]\.* | i[3-7]86-*-freebsd*aout*) changequote([,])dnl COREFILE=trad-core.lo TRAD_HEADER='"hosts/i386bsd.h"' @@ -259,7 +253,7 @@ changequote([,])dnl TRAD_HEADER='"hosts/i386mach3.h"' ;; changequote(,)dnl - i[3-7]86-*-linux-gnu*) + i[3-7]86-*-linux-*) changequote([,])dnl COREFILE=trad-core.lo TRAD_HEADER='"hosts/i386linux.h"' @@ -300,7 +294,7 @@ changequote([,])dnl COREFILE=trad-core.lo TRAD_HEADER='"hosts/hp300bsd.h"' ;; - m68*-*-linux-gnu*) + m68*-*-linux-*) COREFILE=trad-core.lo TRAD_HEADER='"hosts/m68klinux.h"' ;; @@ -328,6 +322,9 @@ changequote([,])dnl COREFILE=trad-core.lo TRAD_HEADER='"hosts/m88kmach3.h"' ;; + m88*-*-openbsd*) + COREFILE=netbsd-core.lo + ;; ns32k-pc532-mach) COREFILE=trad-core.lo TRAD_HEADER='"hosts/pc532mach.h"' @@ -350,9 +347,7 @@ changequote([,])dnl # Not all versions of AIX with -DAIX_CORE_DUMPX_CORE # have c_impl as a member of struct core_dumpx AC_MSG_CHECKING([for c_impl in struct core_dumpx]) - AC_TRY_COMPILE([#include ], - [struct core_dumpx c; c.c_impl = 0;], - [AC_DEFINE(HAVE_ST_C_IMPL, 1, + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[struct core_dumpx c; c.c_impl = 0;]])],[AC_DEFINE(HAVE_ST_C_IMPL, 1, [Define if struct core_dumpx has member c_impl]) AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)]) ;; @@ -385,7 +380,7 @@ changequote([,])dnl COREFILE=trad-core.lo TRAD_HEADER='"hosts/vaxult2.h"' ;; - vax-*-linux-gnu*) + vax-*-linux-*) COREFILE=trad-core.lo TRAD_HEADER='"hosts/vaxlinux.h"' ;; @@ -565,7 +560,6 @@ do # This list is alphabetized to make it easy to compare # with the two vector lists in targets.c. For the same reason, # use one entry per line, even though this leads to long lines. - a29kcoff_big_vec) tb="$tb coff-a29k.lo cofflink.lo" ;; a_out_adobe_vec) tb="$tb aout-adobe.lo aout32.lo" ;; aix5coff64_vec) tb="$tb coff64-rs6000.lo xcofflink.lo aix5ppc-core.lo"; target_size=64 ;; aout0_big_vec) tb="$tb aout0.lo aout32.lo" ;; @@ -589,12 +583,21 @@ do bfd_efi_app_ia64_vec) tb="$tb efi-app-ia64.lo pepigen.lo cofflink.lo"; target_size=64 ;; bfd_elf32_am33lin_vec) tb="$tb elf32-am33lin.lo elf32.lo $elf" ;; bfd_elf32_avr_vec) tb="$tb elf32-avr.lo elf32.lo $elf" ;; + bfd_elf32_bfin_vec) tb="$tb elf32-bfin.lo elf32.lo $elf" ;; + bfd_elf32_bfinfdpic_vec) tb="$tb elf32-bfin.lo elf32.lo $elf" ;; bfd_elf32_big_generic_vec) tb="$tb elf32-gen.lo elf32.lo $elf" ;; bfd_elf32_bigarc_vec) tb="$tb elf32-arc.lo elf32.lo $elf" ;; - bfd_elf32_bigarm_oabi_vec) tb="$tb elfarm-oabi.lo elf32.lo $elf" ;; - bfd_elf32_bigarm_vec) tb="$tb elfarm-nabi.lo elf32.lo $elf" ;; - bfd_elf32_bigmips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo" ;; + bfd_elf32_bigarm_vec) tb="$tb elf32-arm.lo elf32.lo elf-vxworks.lo $elf" ;; + bfd_elf32_bigarm_symbian_vec) + tb="$tb elf32-arm.lo elf32.lo elf-vxworks.lo $elf" ;; + bfd_elf32_bigarm_vxworks_vec) + tb="$tb elf32-arm.lo elf32.lo elf-vxworks.lo $elf" ;; + bfd_elf32_bigmips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;; + bfd_elf32_bigmips_vxworks_vec) + tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;; + bfd_elf32_cr16c_vec) tb="$tb elf32-cr16c.lo elf32.lo $elf" ;; bfd_elf32_cris_vec) tb="$tb elf32-cris.lo elf32.lo $elf" ;; + bfd_elf32_crx_vec) tb="$tb elf32-crx.lo elf32.lo $elf" ;; bfd_elf32_d10v_vec) tb="$tb elf32-d10v.lo elf32.lo $elf" ;; bfd_elf32_d30v_vec) tb="$tb elf32-d30v.lo elf32.lo $elf" ;; bfd_elf32_dlx_big_vec) tb="$tb elf32-dlx.lo elf32.lo $elf" ;; @@ -606,8 +609,9 @@ do bfd_elf32_hppa_nbsd_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;; bfd_elf32_hppa_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;; bfd_elf32_i370_vec) tb="$tb elf32-i370.lo elf32.lo $elf" ;; - bfd_elf32_i386_freebsd_vec) tb="$tb elf32-i386.lo elf32.lo $elf" ;; - bfd_elf32_i386_vec) tb="$tb elf32-i386.lo elf32.lo $elf" ;; + bfd_elf32_i386_freebsd_vec) tb="$tb elf32-i386.lo elf-vxworks.lo elf32.lo $elf" ;; + bfd_elf32_i386_vxworks_vec) tb="$tb elf32-i386.lo elf-vxworks.lo elf32.lo $elf" ;; + bfd_elf32_i386_vec) tb="$tb elf32-i386.lo elf-vxworks.lo elf32.lo $elf" ;; bfd_elf32_i860_little_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;; bfd_elf32_i860_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;; bfd_elf32_i960_vec) tb="$tb elf32-i960.lo elf32.lo $elf" ;; @@ -617,9 +621,15 @@ do bfd_elf32_iq2000_vec) tb="$tb elf32-iq2000.lo elf32.lo $elf" ;; bfd_elf32_little_generic_vec) tb="$tb elf32-gen.lo elf32.lo $elf" ;; bfd_elf32_littlearc_vec) tb="$tb elf32-arc.lo elf32.lo $elf" ;; - bfd_elf32_littlearm_oabi_vec) tb="$tb elfarm-oabi.lo elf32.lo $elf" ;; - bfd_elf32_littlearm_vec) tb="$tb elfarm-nabi.lo elf32.lo $elf" ;; - bfd_elf32_littlemips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo" ;; + bfd_elf32_littlearm_symbian_vec) + tb="$tb elf32-arm.lo elf32.lo elf-vxworks.lo $elf" ;; + bfd_elf32_littlearm_vxworks_vec) + tb="$tb elf32-arm.lo elf32.lo elf-vxworks.lo $elf" ;; + bfd_elf32_littlearm_vec) tb="$tb elf32-arm.lo elf32.lo elf-vxworks.lo $elf" ;; + bfd_elf32_littlemips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;; + bfd_elf32_littlemips_vxworks_vec) + tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;; + bfd_elf32_m32c_vec) tb="$tb elf32-m32c.lo elf32.lo $elf" ;; bfd_elf32_m32r_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;; bfd_elf32_m32rle_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;; bfd_elf32_m32rlin_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;; @@ -632,17 +642,19 @@ do bfd_elf32_mcore_little_vec) tb="$tb elf32-mcore.lo elf32.lo $elf" ;; bfd_elf32_mn10200_vec) tb="$tb elf-m10200.lo elf32.lo $elf" ;; bfd_elf32_mn10300_vec) tb="$tb elf-m10300.lo elf32.lo $elf" ;; + bfd_elf32_mt_vec) tb="$tb elf32-mt.lo elf32.lo $elf" ;; bfd_elf32_msp430_vec) tb="$tb elf32-msp430.lo elf32.lo $elf" ;; - bfd_elf32_nbigmips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; - bfd_elf32_nlittlemips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; - bfd_elf32_ntradbigmips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; - bfd_elf32_ntradlittlemips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; + bfd_elf32_nbigmips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; + bfd_elf32_nlittlemips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; + bfd_elf32_ntradbigmips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; + bfd_elf32_ntradlittlemips_vec) tb="$tb elfn32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; bfd_elf32_openrisc_vec) tb="$tb elf32-openrisc.lo elf32.lo $elf" ;; bfd_elf32_or32_big_vec) tb="$tb elf32-or32.lo elf32.lo $elf" ;; bfd_elf32_pj_vec) tb="$tb elf32-pj.lo elf32.lo $elf";; bfd_elf32_pjl_vec) tb="$tb elf32-pj.lo elf32.lo $elf";; - bfd_elf32_powerpc_vec) tb="$tb elf32-ppc.lo elf32.lo $elf" ;; - bfd_elf32_powerpcle_vec) tb="$tb elf32-ppc.lo elf32.lo $elf" ;; + bfd_elf32_powerpc_vec) tb="$tb elf32-ppc.lo elf-vxworks.lo elf32.lo $elf" ;; + bfd_elf32_powerpcle_vec) tb="$tb elf32-ppc.lo elf-vxworks.lo elf32.lo $elf" ;; + bfd_elf32_powerpc_vxworks_vec) tb="$tb elf32-ppc.lo elf-vxworks.lo elf32.lo $elf" ;; bfd_elf32_s390_vec) tb="$tb elf32-s390.lo elf32.lo $elf" ;; # FIXME: We include cofflink.lo not because it's needed for # bfd_elf32_sh64[l]_vec, but because we include bfd_elf32_sh[l]_vec @@ -656,29 +668,32 @@ do bfd_elf32_sh_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo" ;; bfd_elf32_shblin_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;; bfd_elf32_shl_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo" ;; + bfd_elf32_shl_symbian_vec) tb="$tb elf32-sh-symbian.lo elf32-sh64-com.lo elf32.lo $elf coff-sh.lo" ;; bfd_elf32_shlin_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;; bfd_elf32_shlnbsd_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;; bfd_elf32_shnbsd_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo cofflink.lo" ;; - bfd_elf32_sparc_vec) tb="$tb elf32-sparc.lo elf32.lo $elf" ;; - bfd_elf32_tradbigmips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo" ;; - bfd_elf32_tradlittlemips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo" ;; + bfd_elf32_sparc_vec) tb="$tb elf32-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf32.lo $elf" ;; + bfd_elf32_sparc_vxworks_vec) tb="$tb elf32-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf32.lo $elf" ;; + bfd_elf32_tradbigmips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;; + bfd_elf32_tradlittlemips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;; bfd_elf32_us_cris_vec) tb="$tb elf32-cris.lo elf32.lo $elf" ;; bfd_elf32_v850_vec) tb="$tb elf32-v850.lo elf32.lo $elf" ;; bfd_elf32_vax_vec) tb="$tb elf32-vax.lo elf32.lo $elf" ;; bfd_elf32_xstormy16_vec) tb="$tb elf32-xstormy16.lo elf32.lo $elf" ;; + bfd_elf32_xc16x_vec) tb="$tb elf32-xc16x.lo elf32.lo $elf" ;; bfd_elf32_xtensa_le_vec) tb="$tb xtensa-isa.lo xtensa-modules.lo elf32-xtensa.lo elf32.lo $elf" ;; bfd_elf32_xtensa_be_vec) tb="$tb xtensa-isa.lo xtensa-modules.lo elf32-xtensa.lo elf32.lo $elf" ;; bfd_elf64_alpha_freebsd_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;; bfd_elf64_alpha_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;; bfd_elf64_big_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"; target_size=64 ;; - bfd_elf64_bigmips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; + bfd_elf64_bigmips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; bfd_elf64_hppa_linux_vec) tb="$tb elf64-hppa.lo elf64.lo $elf"; target_size=64 ;; bfd_elf64_hppa_vec) tb="$tb elf64-hppa.lo elf64.lo $elf"; target_size=64 ;; bfd_elf64_ia64_big_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;; bfd_elf64_ia64_hpux_big_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;; bfd_elf64_ia64_little_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;; bfd_elf64_little_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"; target_size=64 ;; - bfd_elf64_littlemips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; + bfd_elf64_littlemips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; bfd_elf64_mmix_vec) tb="$tb elf64-mmix.lo elf64.lo $elf" target_size=64 ;; bfd_elf64_powerpc_vec) tb="$tb elf64-ppc.lo elf64-gen.lo elf64.lo $elf"; target_size=64 ;; bfd_elf64_powerpcle_vec) tb="$tb elf64-ppc.lo elf64-gen.lo elf64.lo $elf" target_size=64 ;; @@ -689,9 +704,9 @@ do bfd_elf64_sh64blin_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;; bfd_elf64_sh64lnbsd_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;; bfd_elf64_sh64nbsd_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;; - bfd_elf64_sparc_vec) tb="$tb elf64-sparc.lo elf64.lo $elf"; target_size=64 ;; - bfd_elf64_tradbigmips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; - bfd_elf64_tradlittlemips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; + bfd_elf64_sparc_vec) tb="$tb elf64-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf64.lo $elf"; target_size=64 ;; + bfd_elf64_tradbigmips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; + bfd_elf64_tradlittlemips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;; bfd_elf64_x86_64_vec) tb="$tb elf64-x86-64.lo elf64.lo $elf"; target_size=64 ;; bfd_mmo_vec) tb="$tb mmo.lo" target_size=64 ;; bfd_powerpc_pe_vec) tb="$tb pe-ppc.lo peigen.lo cofflink.lo" ;; @@ -734,12 +749,12 @@ do m68kcoff_vec) tb="$tb coff-m68k.lo cofflink.lo" ;; m68kcoffun_vec) tb="$tb coff-u68k.lo coff-m68k.lo cofflink.lo" ;; m68klinux_vec) tb="$tb m68klinux.lo aout32.lo" ;; - m68klynx_aout_vec) tb="$tb m68klynx.lo lynx-core.lo aout32.lo" ;; - m68klynx_coff_vec) tb="$tb cf-m68klynx.lo coff-m68k.lo cofflink.lo lynx-core.lo" ;; m68knetbsd_vec) tb="$tb m68knetbsd.lo aout32.lo" ;; m68ksysvcoff_vec) tb="$tb coff-svm68k.lo cofflink.lo" ;; m88kbcs_vec) tb="$tb coff-m88k.lo" ;; m88kmach3_vec) tb="$tb m88kmach3.lo aout32.lo" ;; + m88kopenbsd_vec) tb="$tb m88kopenbsd.lo aout32.lo" ;; + maxqcoff_vec) tb="$tb coff-maxq.lo" ;; mach_o_be_vec) tb="$tb mach-o.lo" ;; mach_o_le_vec) tb="$tb mach-o.lo" ;; mach_o_fat_vec) tb="$tb mach-o.lo" ;; @@ -803,7 +818,8 @@ do vms_vax_vec) tb="$tb vms.lo vms-hdr.lo vms-gsd.lo vms-tir.lo vms-misc.lo" ;; w65_vec) tb="$tb coff-w65.lo reloc16.lo" ;; we32kcoff_vec) tb="$tb coff-we32k.lo" ;; - z8kcoff_vec) tb="$tb coff-z8k.lo reloc16.lo" ;; + z80coff_vec) tb="$tb coff-z80.lo reloc16.lo" ;; + z8kcoff_vec) tb="$tb coff-z8k.lo reloc16.lo cofflink.lo" ;; # These appear out of order in targets.c srec_vec) tb="$tb srec.lo" ;; @@ -889,7 +905,7 @@ case ${host64}-${target64}-${want64} in AC_MSG_RESULT([yes: egcs-1.1.2 on ix86 spotted]), AC_MSG_RESULT(no)) if test $bad_64bit_gcc = yes ; then - AC_ERROR([A newer version of gcc is needed for the requested 64-bit BFD configuration]) + AC_MSG_ERROR([A newer version of gcc is needed for the requested 64-bit BFD configuration]) fi fi ;; @@ -912,9 +928,9 @@ AC_SUBST(bfd_default_target_size) # fseeko, long. This assumes that sizeof off_t is .ge. sizeof long. # Hopefully a reasonable assumption since fseeko et.al. should be # upward compatible. -AC_CHECK_FUNCS(ftello ftello64 fseeko fseeko64) +AC_CHECK_FUNCS(ftello ftello64 fseeko fseeko64 fopen64) if test x"$ac_cv_func_ftello" = xyes -a x"$ac_cv_func_fseeko" = xyes; then - AC_COMPILE_CHECK_SIZEOF(off_t) + AC_CHECK_SIZEOF(off_t) fi AC_MSG_CHECKING([file_ptr type]) bfd_file_ptr="long" @@ -945,6 +961,13 @@ case ${want_mmap}+${ac_cv_func_mmap_fixed_mapped} in esac rm -f doc/config.status -AC_OUTPUT(Makefile doc/Makefile bfd-in3.h:bfd-in2.h bfdver.h:version.h po/Makefile.in:po/Make-in, -[sed -e '/SRC-POTFILES =/r po/SRC-POTFILES' -e '/BLD-POTFILES =/r po/BLD-POTFILES' po/Makefile.in > po/Makefile]) +AC_CONFIG_FILES([Makefile doc/Makefile bfd-in3.h:bfd-in2.h po/Makefile.in:po/Make-in]) +AC_CONFIG_COMMANDS([default],[[sed -e '/SRC-POTFILES =/r po/SRC-POTFILES' -e '/BLD-POTFILES =/r po/BLD-POTFILES' po/Makefile.in > po/Makefile]],[[]]) + +dnl Required by html and install-html +AC_SUBST(datarootdir) +AC_SUBST(docdir) +AC_SUBST(htmldir) + +AC_OUTPUT diff --git a/contrib/binutils/bfd/corefile.c b/contrib/binutils/bfd/corefile.c index 8af4f451784..602de911a2c 100644 --- a/contrib/binutils/bfd/corefile.c +++ b/contrib/binutils/bfd/corefile.c @@ -1,5 +1,5 @@ /* Core file generic interface routines for BFD. - Copyright 1990, 1991, 1992, 1993, 1994, 2000, 2001, 2002, 2003 + Copyright 1990, 1991, 1992, 1993, 1994, 2000, 2001, 2002, 2003, 2005 Free Software Foundation, Inc. Written by Cygnus Support. @@ -17,12 +17,15 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* SECTION Core files +SUBSECTION + Core file functions + DESCRIPTION These are functions pertaining to core files. */ @@ -104,3 +107,59 @@ core_file_matches_executable_p (bfd *core_bfd, bfd *exec_bfd) return BFD_SEND (core_bfd, _core_file_matches_executable_p, (core_bfd, exec_bfd)); } + +/* +FUNCTION + generic_core_file_matches_executable_p + +SYNOPSIS + bfd_boolean generic_core_file_matches_executable_p + (bfd *core_bfd, bfd *exec_bfd); + +DESCRIPTION + Return TRUE if the core file attached to @var{core_bfd} + was generated by a run of the executable file attached + to @var{exec_bfd}. The match is based on executable + basenames only. + + Note: When not able to determine the core file failing + command or the executable name, we still return TRUE even + though we're not sure that core file and executable match. + This is to avoid generating a false warning in situations + where we really don't know whether they match or not. +*/ + +bfd_boolean +generic_core_file_matches_executable_p (bfd *core_bfd, bfd *exec_bfd) +{ + char *exec; + char *core; + char *last_slash; + + if (exec_bfd == NULL || core_bfd == NULL) + return TRUE; + + /* The cast below is to avoid a compiler warning due to the assignment + of the const char * returned by bfd_core_file_failing_command to a + non-const char *. In this case, the assignement does not lead to + breaking the const, as we're only reading the string. */ + + core = (char *) bfd_core_file_failing_command (core_bfd); + if (core == NULL) + return TRUE; + + exec = bfd_get_filename (exec_bfd); + if (exec == NULL) + return TRUE; + + last_slash = strrchr (core, '/'); + if (last_slash != NULL) + core = last_slash + 1; + + last_slash = strrchr (exec, '/'); + if (last_slash != NULL) + exec = last_slash + 1; + + return strcmp (exec, core) == 0; +} + diff --git a/contrib/binutils/bfd/cpu-alpha.c b/contrib/binutils/bfd/cpu-alpha.c index c593fc38537..48b748d9f36 100644 --- a/contrib/binutils/bfd/cpu-alpha.c +++ b/contrib/binutils/bfd/cpu-alpha.c @@ -1,5 +1,6 @@ /* BFD support for the Alpha architecture. - Copyright 1992, 1993, 1998, 2000, 2002 Free Software Foundation, Inc. + Copyright 1992, 1993, 1998, 2000, 2002, 2003 + Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -15,7 +16,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" diff --git a/contrib/binutils/bfd/cpu-arc.c b/contrib/binutils/bfd/cpu-arc.c index c69df0e715c..ef97da0eda2 100644 --- a/contrib/binutils/bfd/cpu-arc.c +++ b/contrib/binutils/bfd/cpu-arc.c @@ -16,7 +16,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" diff --git a/contrib/binutils/bfd/cpu-arm.c b/contrib/binutils/bfd/cpu-arm.c index 17889f3b472..a28a1f9e8fc 100644 --- a/contrib/binutils/bfd/cpu-arm.c +++ b/contrib/binutils/bfd/cpu-arm.c @@ -1,5 +1,6 @@ /* BFD support for the ARM processor - Copyright 1994, 1997, 1999, 2000, 2002, 2003 Free Software Foundation, Inc. + Copyright 1994, 1997, 1999, 2000, 2002, 2003, 2004, 2005 + Free Software Foundation, Inc. Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org) This file is part of BFD, the Binary File Descriptor library. @@ -16,28 +17,19 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" #include "libbfd.h" #include "libiberty.h" -static const bfd_arch_info_type * compatible - PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *)); -static bfd_boolean scan - PARAMS ((const struct bfd_arch_info *, const char *)); -static bfd_boolean arm_check_note - PARAMS ((bfd *, char *, bfd_size_type, const char *, char **)); - /* This routine is provided two arch_infos and works out which ARM machine which would be compatible with both and returns a pointer to its info structure. */ static const bfd_arch_info_type * -compatible (a,b) - const bfd_arch_info_type * a; - const bfd_arch_info_type * b; +compatible (const bfd_arch_info_type *a, const bfd_arch_info_type *b) { /* If a & b are for different architecture we can do nothing. */ if (a->arch != b->arch) @@ -104,9 +96,7 @@ processors[] = }; static bfd_boolean -scan (info, string) - const struct bfd_arch_info * info; - const char * string; +scan (const struct bfd_arch_info *info, const char *string) { int i; @@ -161,9 +151,7 @@ const bfd_arch_info_type bfd_arm_arch = Returns TRUE if they were merged successfully or FALSE otherwise. */ bfd_boolean -bfd_arm_merge_machines (ibfd, obfd) - bfd * ibfd; - bfd * obfd; +bfd_arm_merge_machines (bfd *ibfd, bfd *obfd) { unsigned int in = bfd_get_mach (ibfd); unsigned int out = bfd_get_mach (obfd); @@ -194,9 +182,8 @@ bfd_arm_merge_machines (ibfd, obfd) && (out == bfd_mach_arm_XScale || out == bfd_mach_arm_iWMMXt)) { _bfd_error_handler (_("\ -ERROR: %s is compiled for the EP9312, whereas %s is compiled for XScale"), - bfd_archive_filename (ibfd), - bfd_get_filename (obfd)); +ERROR: %B is compiled for the EP9312, whereas %B is compiled for XScale"), + ibfd, obfd); bfd_set_error (bfd_error_wrong_format); return FALSE; } @@ -204,9 +191,8 @@ ERROR: %s is compiled for the EP9312, whereas %s is compiled for XScale"), && (in == bfd_mach_arm_XScale || in == bfd_mach_arm_iWMMXt)) { _bfd_error_handler (_("\ -ERROR: %s is compiled for the EP9312, whereas %s is compiled for XScale"), - bfd_archive_filename (obfd), - bfd_get_filename (ibfd)); +ERROR: %B is compiled for the EP9312, whereas %B is compiled for XScale"), + obfd, ibfd); bfd_set_error (bfd_error_wrong_format); return FALSE; } @@ -227,12 +213,11 @@ typedef struct } arm_Note; static bfd_boolean -arm_check_note (abfd, buffer, buffer_size, expected_name, description_return) - bfd * abfd; - char * buffer; - bfd_size_type buffer_size; - const char * expected_name; - char ** description_return; +arm_check_note (bfd *abfd, + bfd_byte *buffer, + bfd_size_type buffer_size, + const char *expected_name, + char **description_return) { unsigned long namesz; unsigned long descsz; @@ -247,7 +232,7 @@ arm_check_note (abfd, buffer, buffer_size, expected_name, description_return) namesz = bfd_get_32 (abfd, buffer); descsz = bfd_get_32 (abfd, buffer + offsetof (arm_Note, descsz)); type = bfd_get_32 (abfd, buffer + offsetof (arm_Note, type)); - descr = buffer + offsetof (arm_Note, name); + descr = (char *) buffer + offsetof (arm_Note, name); /* Check for buffer overflow. */ if (namesz + descsz + offsetof (arm_Note, name) > buffer_size) @@ -280,13 +265,11 @@ arm_check_note (abfd, buffer, buffer_size, expected_name, description_return) #define NOTE_ARCH_STRING "arch: " bfd_boolean -bfd_arm_update_notes (abfd, note_section) - bfd * abfd; - const char * note_section; +bfd_arm_update_notes (bfd *abfd, const char *note_section) { asection * arm_arch_section; bfd_size_type buffer_size; - char * buffer; + bfd_byte * buffer; char * arch_string; char * expected; @@ -298,16 +281,11 @@ bfd_arm_update_notes (abfd, note_section) if (arm_arch_section == NULL) return TRUE; - buffer_size = arm_arch_section->_raw_size; + buffer_size = arm_arch_section->size; if (buffer_size == 0) return FALSE; - buffer = bfd_malloc (buffer_size); - if (buffer == NULL) - return FALSE; - - if (! bfd_get_section_contents (abfd, arm_arch_section, buffer, - (file_ptr) 0, buffer_size)) + if (!bfd_malloc_and_get_section (abfd, arm_arch_section, &buffer)) goto FAIL; /* Parse the note. */ @@ -335,7 +313,9 @@ bfd_arm_update_notes (abfd, note_section) if (strcmp (arch_string, expected) != 0) { - strcpy (buffer + offsetof (arm_Note, name) + ((strlen (NOTE_ARCH_STRING) + 3) & ~3), expected); + strcpy ((char *) buffer + (offsetof (arm_Note, name) + + ((strlen (NOTE_ARCH_STRING) + 3) & ~3)), + expected); if (! bfd_set_section_contents (abfd, arm_arch_section, buffer, (file_ptr) 0, buffer_size)) @@ -351,7 +331,8 @@ bfd_arm_update_notes (abfd, note_section) return TRUE; FAIL: - free (buffer); + if (buffer != NULL) + free (buffer); return FALSE; } @@ -379,13 +360,11 @@ architectures[] = /* Extract the machine number stored in a note section. */ unsigned int -bfd_arm_get_mach_from_notes (abfd, note_section) - bfd * abfd; - const char * note_section; +bfd_arm_get_mach_from_notes (bfd *abfd, const char *note_section) { asection * arm_arch_section; bfd_size_type buffer_size; - char * buffer; + bfd_byte * buffer; char * arch_string; int i; @@ -397,16 +376,11 @@ bfd_arm_get_mach_from_notes (abfd, note_section) if (arm_arch_section == NULL) return bfd_mach_arm_unknown; - buffer_size = arm_arch_section->_raw_size; + buffer_size = arm_arch_section->size; if (buffer_size == 0) return bfd_mach_arm_unknown; - buffer = bfd_malloc (buffer_size); - if (buffer == NULL) - return bfd_mach_arm_unknown; - - if (! bfd_get_section_contents (abfd, arm_arch_section, buffer, - (file_ptr) 0, buffer_size)) + if (!bfd_malloc_and_get_section (abfd, arm_arch_section, &buffer)) goto FAIL; /* Parse the note. */ @@ -422,6 +396,20 @@ bfd_arm_get_mach_from_notes (abfd, note_section) } FAIL: - free (buffer); + if (buffer != NULL) + free (buffer); return bfd_mach_arm_unknown; } + +bfd_boolean +bfd_is_arm_mapping_symbol_name (const char * name) +{ + /* The ARM compiler outputs several obsolete forms. Recognize them + in addition to the standard $a, $t and $d. */ + return (name != NULL) + && (name[0] == '$') + && ((name[1] == 'a') || (name[1] == 't') || (name[1] == 'd') + || (name[1] == 'm') || (name[1] == 'f') || (name[1] == 'p')) + && (name[2] == 0 || name[2] == '.'); +} + diff --git a/contrib/binutils/bfd/cpu-i386.c b/contrib/binutils/bfd/cpu-i386.c index 272c7196242..8886c47d0a0 100644 --- a/contrib/binutils/bfd/cpu-i386.c +++ b/contrib/binutils/bfd/cpu-i386.c @@ -1,5 +1,5 @@ /* BFD support for the Intel 386 architecture. - Copyright 1992, 1994, 1995, 1996, 1998, 2000, 2001, 2002 + Copyright 1992, 1994, 1995, 1996, 1998, 2000, 2001, 2002, 2004 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -16,12 +16,28 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" #include "libbfd.h" +const bfd_arch_info_type bfd_x86_64_arch_intel_syntax = +{ + 64, /* 64 bits in a word */ + 64, /* 64 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_i386, + bfd_mach_x86_64_intel_syntax, + "i386:intel", + "i386:x86-64:intel", + 3, + FALSE, + bfd_default_compatible, + bfd_default_scan, + 0 +}; + const bfd_arch_info_type bfd_i386_arch_intel_syntax = { 32, /* 32 bits in a word */ @@ -34,25 +50,11 @@ const bfd_arch_info_type bfd_i386_arch_intel_syntax = 3, TRUE, bfd_default_compatible, - bfd_default_scan , - 0, + bfd_default_scan, + &bfd_x86_64_arch_intel_syntax }; -const bfd_arch_info_type bfd_x86_64_arch_intel_syntax = -{ - 64, /* 64 bits in a word */ - 64, /* 64 bits in an address */ - 8, /* 8 bits in a byte */ - bfd_arch_i386, - bfd_mach_x86_64_intel_syntax, - "i386:intel", - "i386:x86-64:intel", - 3, - TRUE, - bfd_default_compatible, - bfd_default_scan , - &bfd_i386_arch_intel_syntax, -}; -static const bfd_arch_info_type i8086_arch = + +const bfd_arch_info_type i8086_arch = { 32, /* 32 bits in a word */ 32, /* 32 bits in an address (well, not really) */ @@ -64,8 +66,8 @@ static const bfd_arch_info_type i8086_arch = 3, FALSE, bfd_default_compatible, - bfd_default_scan , - &bfd_x86_64_arch_intel_syntax, + bfd_default_scan, + &bfd_i386_arch_intel_syntax }; const bfd_arch_info_type bfd_x86_64_arch = @@ -78,10 +80,10 @@ const bfd_arch_info_type bfd_x86_64_arch = "i386", "i386:x86-64", 3, - TRUE, + FALSE, bfd_default_compatible, - bfd_default_scan , - &i8086_arch, + bfd_default_scan, + &i8086_arch }; const bfd_arch_info_type bfd_i386_arch = @@ -96,6 +98,6 @@ const bfd_arch_info_type bfd_i386_arch = 3, TRUE, bfd_default_compatible, - bfd_default_scan , + bfd_default_scan, &bfd_x86_64_arch }; diff --git a/contrib/binutils/bfd/cpu-ia64-opc.c b/contrib/binutils/bfd/cpu-ia64-opc.c index 740c2eeda1b..a3adc478886 100644 --- a/contrib/binutils/bfd/cpu-ia64-opc.c +++ b/contrib/binutils/bfd/cpu-ia64-opc.c @@ -1,4 +1,4 @@ -/* Copyright 1998, 1999, 2000, 2001, 2002, 2003 +/* Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006 Free Software Foundation, Inc. Contributed by David Mosberger-Tang @@ -16,7 +16,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* Logically, this code should be part of libopcode but since some of the operand insertion/extraction functions help bfd to implement @@ -113,6 +113,29 @@ ext_immu (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep) return 0; } +static const char* +ins_immu5b (const struct ia64_operand *self, ia64_insn value, + ia64_insn *code) +{ + if (value < 32 || value > 63) + return "value must be between 32 and 63"; + return ins_immu (self, value - 32, code); +} + +static const char* +ext_immu5b (const struct ia64_operand *self, ia64_insn code, + ia64_insn *valuep) +{ + const char *result; + + result = ext_immu (self, code, valuep); + if (result) + return result; + + *valuep = *valuep + 32; + return 0; +} + static const char* ins_immus8 (const struct ia64_operand *self, ia64_insn value, ia64_insn *code) { @@ -457,6 +480,10 @@ const struct ia64_operand elf64_ia64_operands[IA64_OPND_COUNT] = { REG, ins_reg, ext_reg, "r", {{ 2, 20}}, 0, /* R3_2 */ "a general register r0-r3" }, + /* memory operands: */ + { IND, ins_reg, ext_reg, "", {{7, 20}}, 0, /* MR3 */ + "a memory address" }, + /* indirect operands: */ { IND, ins_reg, ext_reg, "cpuid", {{7, 20}}, 0, /* CPUID_R3 */ "a cpuid register" }, @@ -468,8 +495,6 @@ const struct ia64_operand elf64_ia64_operands[IA64_OPND_COUNT] = "an itr register" }, { IND, ins_reg, ext_reg, "ibr", {{7, 20}}, 0, /* IBR_R3 */ "an ibr register" }, - { IND, ins_reg, ext_reg, "", {{7, 20}}, 0, /* MR3 */ - "an indirect memory address" }, { IND, ins_reg, ext_reg, "msr", {{7, 20}}, 0, /* MSR_R3 */ "an msr register" }, { IND, ins_reg, ext_reg, "pkr", {{7, 20}}, 0, /* PKR_R3 */ @@ -504,6 +529,8 @@ const struct ia64_operand elf64_ia64_operands[IA64_OPND_COUNT] = "a 1-bit integer (-1, 0)" }, { ABS, ins_immu, ext_immu, 0, {{ 2, 13}}, UDEC, /* IMMU2 */ "a 2-bit unsigned (0-3)" }, + { ABS, ins_immu5b, ext_immu5b, 0, {{ 5, 14}}, UDEC, /* IMMU5b */ + "a 5-bit unsigned (32 + (0-31))" }, { ABS, ins_immu, ext_immu, 0, {{ 7, 13}}, 0, /* IMMU7a */ "a 7-bit unsigned (0-127)" }, { ABS, ins_immu, ext_immu, 0, {{ 7, 20}}, 0, /* IMMU7b */ diff --git a/contrib/binutils/bfd/cpu-ia64.c b/contrib/binutils/bfd/cpu-ia64.c index 2185241e486..e172f5a85f2 100644 --- a/contrib/binutils/bfd/cpu-ia64.c +++ b/contrib/binutils/bfd/cpu-ia64.c @@ -16,7 +16,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" diff --git a/contrib/binutils/bfd/cpu-powerpc.c b/contrib/binutils/bfd/cpu-powerpc.c index a4e72d5bf30..2584d651162 100644 --- a/contrib/binutils/bfd/cpu-powerpc.c +++ b/contrib/binutils/bfd/cpu-powerpc.c @@ -1,5 +1,5 @@ /* BFD PowerPC CPU definition - Copyright 1994, 1995, 1996, 2000, 2001, 2002 + Copyright 1994, 1995, 1996, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Contributed by Ian Lance Taylor, Cygnus Support. @@ -17,7 +17,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" @@ -295,6 +295,20 @@ const bfd_arch_info_type bfd_powerpc_archs[] = FALSE, /* not the default */ powerpc_compatible, bfd_default_scan, + &bfd_powerpc_archs[15] + }, + { + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_powerpc, + bfd_mach_ppc_750, + "powerpc", + "powerpc:750", + 3, + FALSE, /* not the default */ + powerpc_compatible, + bfd_default_scan, 0 } }; diff --git a/contrib/binutils/bfd/cpu-rs6000.c b/contrib/binutils/bfd/cpu-rs6000.c index d94921ff748..43c7be7539f 100644 --- a/contrib/binutils/bfd/cpu-rs6000.c +++ b/contrib/binutils/bfd/cpu-rs6000.c @@ -22,7 +22,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" diff --git a/contrib/binutils/bfd/cpu-s390.c b/contrib/binutils/bfd/cpu-s390.c index 66fd2461f2e..e7c714f26dc 100644 --- a/contrib/binutils/bfd/cpu-s390.c +++ b/contrib/binutils/bfd/cpu-s390.c @@ -16,8 +16,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" diff --git a/contrib/binutils/bfd/cpu-sparc.c b/contrib/binutils/bfd/cpu-sparc.c index 3c0eae50fad..42153269a24 100644 --- a/contrib/binutils/bfd/cpu-sparc.c +++ b/contrib/binutils/bfd/cpu-sparc.c @@ -16,7 +16,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" diff --git a/contrib/binutils/bfd/demo64.c b/contrib/binutils/bfd/demo64.c index a8c0b32f4d7..d284850b9b5 100644 --- a/contrib/binutils/bfd/demo64.c +++ b/contrib/binutils/bfd/demo64.c @@ -17,7 +17,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #define ARCH_SIZE 64 diff --git a/contrib/binutils/bfd/dep-in.sed b/contrib/binutils/bfd/dep-in.sed index 90a2e6a7f06..2732d6b42e3 100644 --- a/contrib/binutils/bfd/dep-in.sed +++ b/contrib/binutils/bfd/dep-in.sed @@ -4,6 +4,7 @@ s/\\\n */ /g t loop s!\.o:!.lo:! +s! \./! !g s! @BFD_H@!!g s!@SRCDIR@/../include!$(INCDIR)!g s!@TOPDIR@/include!$(INCDIR)!g diff --git a/contrib/binutils/bfd/doc/ChangeLog b/contrib/binutils/bfd/doc/ChangeLog index fc0693343f3..7909268f98b 100644 --- a/contrib/binutils/bfd/doc/ChangeLog +++ b/contrib/binutils/bfd/doc/ChangeLog @@ -1,9 +1,104 @@ -2004-04-08 Alan Modra +2006-06-07 Joseph S. Myers + + * bfd.texinfo: Remove local @tex code. + +2006-04-06 Carlos O'Donell + + * Makefile.am: Add install-html and install-html-am targets. + Define datarootdir, docdir and htmldir. + * Makefile.in: Regenerate. + +2006-02-27 Carlos O'Donell + + * Makefile.am: Add html target. + * Makefile.in: Regenerate. + +2005-07-24 Daniel Jacobowitz + + * chew.c: Include . + +2005-07-22 DJ Delorie + + * chew.c: Include stdlib.h. + +2005-07-22 Kazu Hirata + + * chew.c: Don't include sysdep.h. + +2005-05-09 Daniel Jacobowitz + + * Makefile.am: Use a temporary file to build chew. + * Makefile.in: Regenerated. + +2005-05-04 Nick Clifton + + * chew.c: Update the address and phone number of the FSF + organization in the GPL notice. + +2005-05-05 H.J. Lu + + * Makefile.am (INCLUDES): Remove -D_GNU_SOURCE. + * Makefile.in: Regenerate. + +2005-04-29 Daniel Jacobowitz + + * Makefile.am: Remove stamp rules. Depend on chew.c + instead of $(MKDOC). + * Makefile.in: Regnerated. + +2005-04-21 H.J. Lu + + * Makefile.am (INCLUDES): New. Add -D_GNU_SOURCE. + (chew.o): Use it. + * Makefile.in: Regenerate. + +2005-04-14 Alan Modra + + * Makefile.in: Regenerate. + +2005-04-12 Alan Modra + + * Makefile.in: Regenerate. + +2005-02-21 Alan Modra + + * Makefile.in: Regenerate. + +2005-02-13 Maciej W. Rozycki + + * Makefile.am: Use CFLAGS_FOR_BUILD and LDFLAGS_FOR_BUILD for + building chew. + * Makefile.in: Regenerate. + +2005-02-01 Ben Elliston + + * chew.c: Remove #if 0'd code throughout. Similarly, collapse #if + 1'd code. + +2004-12-20 Ian Lance Taylor + + * Makefile.am: Use $(SHELL) whenever we run move-if-change. + * Makefile.in: Rebuild. + +2004-09-19 H.J. Lu + + * Makefile.am (AUTOMAKE_OPTIONS): Require 1.9. + (bfd.info): Rename the target to ... + ($(srcdir)/bfd.info): This. + * Makefile.in: Regenerated. + +2004-09-17 Alan Modra + + * Makefile.in: Regenerate. + +2004-03-27 Alan Modra - Apply from mainline. - 2004-03-27 Alan Modra * bfdint.texi: Remove all mention of elflink.h. +2004-03-19 Alan Modra + + * Makefile.in: Regenerate. + For older changes see ChangeLog-9103 Local Variables: diff --git a/contrib/binutils/bfd/doc/Makefile.am b/contrib/binutils/bfd/doc/Makefile.am index 4aaa341807c..6d221faad4a 100644 --- a/contrib/binutils/bfd/doc/Makefile.am +++ b/contrib/binutils/bfd/doc/Makefile.am @@ -1,6 +1,6 @@ ## Process this file with automake to generate Makefile.in -AUTOMAKE_OPTIONS = cygnus +AUTOMAKE_OPTIONS = 1.9 cygnus DOCFILES = aoutx.texi archive.texi archures.texi \ bfdt.texi cache.texi coffcode.texi \ @@ -54,159 +54,141 @@ info_TEXINFOS = bfd.texinfo MKDOC = chew$(EXEEXT_FOR_BUILD) -$(MKDOC): chew.o - $(CC_FOR_BUILD) -o $(MKDOC) chew.o $(CFLAGS) $(LOADLIBES) $(LDFLAGS) +INCLUDES = -I.. -I$(srcdir)/.. -I$(srcdir)/../../include \ + -I$(srcdir)/../../intl -I../../intl + +$(MKDOC): $(srcdir)/chew.c + $(CC_FOR_BUILD) -o chew.$$$$ $(srcdir)/chew.c \ + $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(H_CFLAGS) \ + $(INCLUDES); \ + $(SHELL) $(srcdir)/../../move-if-change chew.$$$$ $(MKDOC) chew.o: chew.c - $(CC_FOR_BUILD) -c -I.. -I$(srcdir)/.. -I$(srcdir)/../../include -I$(srcdir)/../../intl -I../../intl $(H_CFLAGS) $(CFLAGS) $(srcdir)/chew.c + $(CC_FOR_BUILD) -c $(INCLUDES) $(H_CFLAGS) $(CFLAGS_FOR_BUILD) $(srcdir)/chew.c protos: libbfd.h libcoff.h bfd.h -bfd.info bfd.dvi: $(DOCFILES) bfdsumm.texi bfd.texinfo +$(srcdir)/bfd.info bfd.dvi bfd.html: $(DOCFILES) bfdsumm.texi bfd.texinfo # We can't replace these rules with an implicit rule, because # makes without VPATH support couldn't find the .h files in `..'. -# We use s-XXX targets so that we can distribute the info files, -# and permit people to rebuild them, without requiring the makeinfo -# program. If somebody tries to rebuild info, but none of the .texi -# files have changed, then this Makefile will build chew, and will -# build all of the stamp files, but will not actually have to rebuild -# bfd.info. +# We do not depend on chew directly so that we can distribute the info +# files, and permit people to rebuild them, without requiring the makeinfo +# program. If somebody tries to rebuild info, but none of the .texi files +# have changed, then nothing will be rebuilt. -s-aoutx: $(MKDOC) $(srcdir)/../aoutx.h $(srcdir)/doc.str +aoutx.texi: chew.c $(srcdir)/../aoutx.h $(srcdir)/doc.str + $(MAKE) $(MKDOC) ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../aoutx.h >aoutx.tmp - $(srcdir)/../../move-if-change aoutx.tmp aoutx.texi - touch s-aoutx -aoutx.texi: s-aoutx + $(SHELL) $(srcdir)/../../move-if-change aoutx.tmp aoutx.texi -s-archive: $(MKDOC) $(srcdir)/../archive.c $(srcdir)/doc.str +archive.texi: chew.c $(srcdir)/../archive.c $(srcdir)/doc.str + $(MAKE) $(MKDOC) ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../archive.c >archive.tmp - $(srcdir)/../../move-if-change archive.tmp archive.texi - touch s-archive -archive.texi: s-archive + $(SHELL) $(srcdir)/../../move-if-change archive.tmp archive.texi -s-archures: $(MKDOC) $(srcdir)/../archures.c $(srcdir)/doc.str +archures.texi: chew.c $(srcdir)/../archures.c $(srcdir)/doc.str + $(MAKE) $(MKDOC) ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../archures.c >archures.tmp - $(srcdir)/../../move-if-change archures.tmp archures.texi - touch s-archures -archures.texi: s-archures + $(SHELL) $(srcdir)/../../move-if-change archures.tmp archures.texi # We use bfdt.texi, rather than bfd.texi, to avoid conflicting with # bfd.texinfo on an 8.3 filesystem. -s-bfd: $(MKDOC) $(srcdir)/../bfd.c $(srcdir)/doc.str +bfdt.texi: chew.c $(srcdir)/../bfd.c $(srcdir)/doc.str + $(MAKE) $(MKDOC) ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../bfd.c >bfd.tmp - $(srcdir)/../../move-if-change bfd.tmp bfdt.texi - touch s-bfd -bfdt.texi: s-bfd + $(SHELL) $(srcdir)/../../move-if-change bfd.tmp bfdt.texi -s-cache: $(MKDOC) $(srcdir)/../cache.c $(srcdir)/doc.str +cache.texi: chew.c $(srcdir)/../cache.c $(srcdir)/doc.str + $(MAKE) $(MKDOC) ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../cache.c >cache.tmp - $(srcdir)/../../move-if-change cache.tmp cache.texi - touch s-cache -cache.texi: s-cache + $(SHELL) $(srcdir)/../../move-if-change cache.tmp cache.texi -s-coffcode: $(MKDOC) $(srcdir)/../coffcode.h $(srcdir)/doc.str +coffcode.texi: chew.c $(srcdir)/../coffcode.h $(srcdir)/doc.str + $(MAKE) $(MKDOC) ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../coffcode.h >coffcode.tmp - $(srcdir)/../../move-if-change coffcode.tmp coffcode.texi - touch s-coffcode -coffcode.texi: s-coffcode + $(SHELL) $(srcdir)/../../move-if-change coffcode.tmp coffcode.texi -s-core: $(MKDOC) $(srcdir)/../corefile.c $(srcdir)/doc.str +core.texi: chew.c $(srcdir)/../corefile.c $(srcdir)/doc.str + $(MAKE) $(MKDOC) ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../corefile.c >core.tmp - $(srcdir)/../../move-if-change core.tmp core.texi - touch s-core -core.texi: s-core + $(SHELL) $(srcdir)/../../move-if-change core.tmp core.texi -s-elf: $(MKDOC) $(srcdir)/../elf.c $(srcdir)/doc.str +elf.texi: chew.c $(srcdir)/../elf.c $(srcdir)/doc.str + $(MAKE) $(MKDOC) ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../elf.c >elf.tmp - $(srcdir)/../../move-if-change elf.tmp elf.texi - touch s-elf -elf.texi: s-elf + $(SHELL) $(srcdir)/../../move-if-change elf.tmp elf.texi -s-elfcode: $(MKDOC) $(srcdir)/../elfcode.h $(srcdir)/doc.str +elfcode.texi: chew.c $(srcdir)/../elfcode.h $(srcdir)/doc.str + $(MAKE) $(MKDOC) ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../elfcode.h >elfcode.tmp - $(srcdir)/../../move-if-change elfcode.tmp elfcode.texi - touch s-elfcode -elfcode.texi: s-elfcode + $(SHELL) $(srcdir)/../../move-if-change elfcode.tmp elfcode.texi -s-mmo: $(MKDOC) $(srcdir)/../mmo.c $(srcdir)/doc.str +mmo.texi: chew.c $(srcdir)/../mmo.c $(srcdir)/doc.str + $(MAKE) $(MKDOC) ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../mmo.c >mmo.tmp - $(srcdir)/../../move-if-change mmo.tmp mmo.texi - touch s-mmo -mmo.texi: s-mmo + $(SHELL) $(srcdir)/../../move-if-change mmo.tmp mmo.texi -s-format: $(MKDOC) $(srcdir)/../format.c $(srcdir)/doc.str +format.texi: chew.c $(srcdir)/../format.c $(srcdir)/doc.str + $(MAKE) $(MKDOC) ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../format.c >format.tmp - $(srcdir)/../../move-if-change format.tmp format.texi - touch s-format -format.texi: s-format + $(SHELL) $(srcdir)/../../move-if-change format.tmp format.texi -s-libbfd: $(MKDOC) $(srcdir)/../libbfd.c $(srcdir)/doc.str +libbfd.texi: chew.c $(srcdir)/../libbfd.c $(srcdir)/doc.str + $(MAKE) $(MKDOC) ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../libbfd.c >libbfd.tmp - $(srcdir)/../../move-if-change libbfd.tmp libbfd.texi - touch s-libbfd -libbfd.texi: s-libbfd + $(SHELL) $(srcdir)/../../move-if-change libbfd.tmp libbfd.texi -s-bfdio: $(MKDOC) $(srcdir)/../bfdio.c $(srcdir)/doc.str +bfdio.texi: chew.c $(srcdir)/../bfdio.c $(srcdir)/doc.str + $(MAKE) $(MKDOC) ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../bfdio.c >bfdio.tmp - $(srcdir)/../../move-if-change bfdio.tmp bfdio.texi - touch s-bfdio -bfdio.texi: s-bfdio + $(SHELL) $(srcdir)/../../move-if-change bfdio.tmp bfdio.texi -s-bfdwin: $(MKDOC) $(srcdir)/../bfdwin.c $(srcdir)/doc.str +bfdwin.texi: chew.c $(srcdir)/../bfdwin.c $(srcdir)/doc.str + $(MAKE) $(MKDOC) ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../bfdwin.c >bfdwin.tmp - $(srcdir)/../../move-if-change bfdwin.tmp bfdwin.texi - touch s-bfdwin -bfdwin.texi: s-bfdwin + $(SHELL) $(srcdir)/../../move-if-change bfdwin.tmp bfdwin.texi -s-opncls: $(MKDOC) $(srcdir)/../opncls.c $(srcdir)/doc.str +opncls.texi: chew.c $(srcdir)/../opncls.c $(srcdir)/doc.str + $(MAKE) $(MKDOC) ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../opncls.c >opncls.tmp - $(srcdir)/../../move-if-change opncls.tmp opncls.texi - touch s-opncls -opncls.texi: s-opncls + $(SHELL) $(srcdir)/../../move-if-change opncls.tmp opncls.texi -s-reloc: $(MKDOC) $(srcdir)/../reloc.c $(srcdir)/doc.str +reloc.texi: chew.c $(srcdir)/../reloc.c $(srcdir)/doc.str + $(MAKE) $(MKDOC) ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../reloc.c >reloc.tmp - $(srcdir)/../../move-if-change reloc.tmp reloc.texi - touch s-reloc -reloc.texi: s-reloc + $(SHELL) $(srcdir)/../../move-if-change reloc.tmp reloc.texi -s-section: $(MKDOC) $(srcdir)/../section.c $(srcdir)/doc.str +section.texi: chew.c $(srcdir)/../section.c $(srcdir)/doc.str + $(MAKE) $(MKDOC) ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../section.c >section.tmp - $(srcdir)/../../move-if-change section.tmp section.texi - touch s-section -section.texi: s-section + $(SHELL) $(srcdir)/../../move-if-change section.tmp section.texi -s-syms: $(MKDOC) $(srcdir)/../syms.c $(srcdir)/doc.str +syms.texi: chew.c $(srcdir)/../syms.c $(srcdir)/doc.str + $(MAKE) $(MKDOC) ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../syms.c >syms.tmp - $(srcdir)/../../move-if-change syms.tmp syms.texi - touch s-syms -syms.texi: s-syms + $(SHELL) $(srcdir)/../../move-if-change syms.tmp syms.texi -s-targets: $(MKDOC) $(srcdir)/../targets.c $(srcdir)/doc.str +targets.texi: chew.c $(srcdir)/../targets.c $(srcdir)/doc.str + $(MAKE) $(MKDOC) ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../targets.c >targets.tmp - $(srcdir)/../../move-if-change targets.tmp targets.texi - touch s-targets -targets.texi: s-targets + $(SHELL) $(srcdir)/../../move-if-change targets.tmp targets.texi -s-init: $(MKDOC) $(srcdir)/../init.c $(srcdir)/doc.str +init.texi: chew.c $(srcdir)/../init.c $(srcdir)/doc.str + $(MAKE) $(MKDOC) ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../init.c >init.tmp - $(srcdir)/../../move-if-change init.tmp init.texi - touch s-init -init.texi: s-init + $(SHELL) $(srcdir)/../../move-if-change init.tmp init.texi -s-hash: $(MKDOC) $(srcdir)/../hash.c $(srcdir)/doc.str +hash.texi: chew.c $(srcdir)/../hash.c $(srcdir)/doc.str + $(MAKE) $(MKDOC) ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../hash.c >hash.tmp - $(srcdir)/../../move-if-change hash.tmp hash.texi - touch s-hash -hash.texi: s-hash + $(SHELL) $(srcdir)/../../move-if-change hash.tmp hash.texi -s-linker: $(MKDOC) $(srcdir)/../linker.c $(srcdir)/doc.str +linker.texi: chew.c $(srcdir)/../linker.c $(srcdir)/doc.str + $(MAKE) $(MKDOC) ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../linker.c >linker.tmp - $(srcdir)/../../move-if-change linker.tmp linker.texi - touch s-linker -linker.texi: s-linker + $(SHELL) $(srcdir)/../../move-if-change linker.tmp linker.texi LIBBFD_H_DEP = \ $(srcdir)/../libbfd-in.h \ @@ -296,7 +278,7 @@ noinst_TEXINFOS = bfdint.texi MOSTLYCLEANFILES = $(MKDOC) *.o -CLEANFILES = s-* *.p *.ip +CLEANFILES = *.p *.ip DISTCLEANFILES = bfd.?? bfd.??? bfd.h libbfd.h libcoff.h texput.log @@ -305,3 +287,28 @@ MAINTAINERCLEANFILES = $(DOCFILES) # We want install to imply install-info as per GNU standards, despite the # cygnus option. install: install-info + +html__strip_dir = `echo $$p | sed -e 's|^.*/||'`; + +install-html: install-html-am + +install-html-am: $(HTMLS) + @$(NORMAL_INSTALL) + test -z "$(htmldir)" || $(mkdir_p) "$(DESTDIR)$(htmldir)" + @list='$(HTMLS)'; for p in $$list; do \ + if test -f "$$p" || test -d "$$p"; then d=""; else d="$(srcdir)/"; fi; \ + f=$(html__strip_dir) \ + if test -d "$$d$$p"; then \ + echo " $(mkdir_p) '$(DESTDIR)$(htmldir)/$$f'"; \ + $(mkdir_p) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \ + echo " $(INSTALL_DATA) '$$d$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \ + $(INSTALL_DATA) "$$d$$p"/* "$(DESTDIR)$(htmldir)/$$f"; \ + else \ + echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(htmldir)/$$f'"; \ + $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(htmldir)/$$f"; \ + fi; \ + done + + + + diff --git a/contrib/binutils/bfd/doc/Makefile.in b/contrib/binutils/bfd/doc/Makefile.in index 85d64277e3c..ad81061ec7b 100644 --- a/contrib/binutils/bfd/doc/Makefile.in +++ b/contrib/binutils/bfd/doc/Makefile.in @@ -1,6 +1,8 @@ -# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am +# Makefile.in generated by automake 1.9.5 from Makefile.am. +# @configure_input@ -# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -10,61 +12,72 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. - -SHELL = @SHELL@ - +@SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -sbindir = @sbindir@ -libexecdir = @libexecdir@ -datadir = @datadir@ -sysconfdir = @sysconfdir@ -sharedstatedir = @sharedstatedir@ -localstatedir = @localstatedir@ -libdir = @libdir@ -infodir = @infodir@ -mandir = @mandir@ -includedir = @includedir@ -oldincludedir = /usr/include - -DESTDIR = - pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ - top_builddir = .. - -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -transform = @program_transform_name@ - +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : -build_alias = @build_alias@ build_triplet = @build@ -host_alias = @host_alias@ host_triplet = @host@ -target_alias = @target_alias@ target_triplet = @target@ +subdir = doc +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/../config/acx.m4 $(top_srcdir)/../bfd/bfd.m4 \ + $(top_srcdir)/../bfd/warning.m4 $(top_srcdir)/../libtool.m4 \ + $(top_srcdir)/../gettext.m4 $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +depcomp = +am__depfiles_maybe = +SOURCES = +INFO_DEPS = $(srcdir)/bfd.info +TEXINFO_TEX = $(top_srcdir)/../texinfo/texinfo.tex +am__TEXINFO_TEX_DIR = $(top_srcdir)/../texinfo +DVIS = bfd.dvi +PDFS = bfd.pdf +PSS = bfd.ps +HTMLS = bfd.html +TEXINFOS = bfd.texinfo +TEXI2DVI = `if test -f $(top_srcdir)/../texinfo/util/texi2dvi; then \ + echo $(top_srcdir)/../texinfo/util/texi2dvi; \ + else \ + echo texi2dvi; \ + fi` +TEXI2PDF = $(TEXI2DVI) --pdf --batch +MAKEINFOHTML = $(MAKEINFO) --html +AM_MAKEINFOHTMLFLAGS = $(AM_MAKEINFOFLAGS) +DVIPS = dvips +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ AR = @AR@ -AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ BFD_HOST_64BIT_LONG = @BFD_HOST_64BIT_LONG@ BFD_HOST_64_BIT = @BFD_HOST_64_BIT@ BFD_HOST_64_BIT_DEFINED = @BFD_HOST_64_BIT_DEFINED@ @@ -73,39 +86,65 @@ BFD_HOST_U_64_BIT = @BFD_HOST_U_64_BIT@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ +CCDEPMODE = @CCDEPMODE@ CC_FOR_BUILD = @CC_FOR_BUILD@ +CFLAGS = @CFLAGS@ COREFILE = @COREFILE@ COREFLAG = @COREFLAG@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ -DLLTOOL = @DLLTOOL@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ EXEEXT = @EXEEXT@ EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@ -GCJ = @GCJ@ -GCJFLAGS = @GCJFLAGS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GT_NO = @GT_NO@ GT_YES = @GT_YES@ HDEFINES = @HDEFINES@ INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_LIBBFD_FALSE = @INSTALL_LIBBFD_FALSE@ +INSTALL_LIBBFD_TRUE = @INSTALL_LIBBFD_TRUE@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLDEPS = @INTLDEPS@ INTLLIBS = @INTLLIBS@ INTLOBJS = @INTLOBJS@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MKINSTALLDIRS = @MKINSTALLDIRS@ MSGFMT = @MSGFMT@ -OBJDUMP = @OBJDUMP@ +NO_WERROR = @NO_WERROR@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ POFILES = @POFILES@ POSUB = @POSUB@ RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ STRIP = @STRIP@ TDEFINES = @TDEFINES@ USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ @@ -114,23 +153,68 @@ VERSION = @VERSION@ WARN_CFLAGS = @WARN_CFLAGS@ WIN32LDFLAGS = @WIN32LDFLAGS@ WIN32LIBADD = @WIN32LIBADD@ +XGETTEXT = @XGETTEXT@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ all_backends = @all_backends@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ bfd_backends = @bfd_backends@ bfd_default_target_size = @bfd_default_target_size@ bfd_file_ptr = @bfd_file_ptr@ bfd_libs = @bfd_libs@ bfd_machines = @bfd_machines@ bfd_ufile_ptr = @bfd_ufile_ptr@ -bfd_version = @bfd_version@ -bfd_version_string = @bfd_version_string@ bfdincludedir = @bfdincludedir@ bfdlibdir = @bfdlibdir@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_noncanonical = @host_noncanonical@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ l = @l@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_noncanonical = @target_noncanonical@ +target_os = @target_os@ +target_vendor = @target_vendor@ tdefaults = @tdefaults@ wordsize = @wordsize@ - -AUTOMAKE_OPTIONS = cygnus - +AUTOMAKE_OPTIONS = 1.9 cygnus DOCFILES = aoutx.texi archive.texi archures.texi \ bfdt.texi cache.texi coffcode.texi \ core.texi elf.texi elfcode.texi format.texi \ @@ -139,7 +223,6 @@ DOCFILES = aoutx.texi archive.texi archures.texi \ syms.texi targets.texi init.texi hash.texi linker.texi \ mmo.texi - PROTOS = archive.p archures.p bfd.p \ core.p format.p \ bfdio.p bfdwin.p \ @@ -147,7 +230,6 @@ PROTOS = archive.p archures.p bfd.p \ section.p syms.p targets.p \ format.p core.p init.p - IPROTOS = cache.ip libbfd.ip reloc.ip init.ip archures.ip coffcode.ip # SRCDOC, SRCPROT, SRCIPROT only used to sidestep Sun Make bug in interaction @@ -165,7 +247,6 @@ SRCDOC = $(srcdir)/../aoutx.h $(srcdir)/../archive.c \ $(srcdir)/../hash.c $(srcdir)/../linker.c \ $(srcdir)/../mmo.c - SRCPROT = $(srcdir)/../archive.c $(srcdir)/../archures.c \ $(srcdir)/../bfd.c $(srcdir)/../coffcode.h $(srcdir)/../corefile.c \ $(srcdir)/../format.c $(srcdir)/../libbfd.c \ @@ -174,19 +255,17 @@ SRCPROT = $(srcdir)/../archive.c $(srcdir)/../archures.c \ $(srcdir)/../section.c $(srcdir)/../syms.c \ $(srcdir)/../targets.c $(srcdir)/../init.c - SRCIPROT = $(srcdir)/../cache.c $(srcdir)/../libbfd.c \ $(srcdir)/../bfdio.c $(srcdir)/../bfdwin.c \ $(srcdir)/../reloc.c $(srcdir)/../cpu-h8300.c \ $(srcdir)/../cpu-i960.c $(srcdir)/../archures.c \ $(srcdir)/../init.c - TEXIDIR = $(srcdir)/../../texinfo/fsf - info_TEXINFOS = bfd.texinfo - MKDOC = chew$(EXEEXT_FOR_BUILD) +INCLUDES = -I.. -I$(srcdir)/.. -I$(srcdir)/../../include \ + -I$(srcdir)/../../intl -I../../intl LIBBFD_H_DEP = \ $(srcdir)/../libbfd-in.h \ @@ -202,7 +281,6 @@ LIBBFD_H_DEP = \ $(srcdir)/proto.str \ $(MKDOC) - LIBCOFF_H_DEP = \ $(srcdir)/../libcoff-in.h \ $(srcdir)/../coffcode.h \ @@ -210,7 +288,6 @@ LIBCOFF_H_DEP = \ $(srcdir)/proto.str \ $(MKDOC) - BFD_H_DEP = \ $(srcdir)/../bfd-in.h \ $(srcdir)/../init.c \ @@ -234,200 +311,178 @@ BFD_H_DEP = \ $(srcdir)/../version.h \ $(MKDOC) - noinst_TEXINFOS = bfdint.texi - MOSTLYCLEANFILES = $(MKDOC) *.o - -CLEANFILES = s-* *.p *.ip - +CLEANFILES = *.p *.ip DISTCLEANFILES = bfd.?? bfd.??? bfd.h libbfd.h libcoff.h texput.log - MAINTAINERCLEANFILES = $(DOCFILES) -mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs -CONFIG_HEADER = ../config.h -CONFIG_CLEAN_FILES = -TEXI2DVI = `if test -f $(top_srcdir)/../texinfo/util/texi2dvi; then echo $(top_srcdir)/../texinfo/util/texi2dvi; else echo texi2dvi; fi` -TEXINFO_TEX = $(top_srcdir)/../texinfo/texinfo.tex -INFO_DEPS = bfd.info -DVIS = bfd.dvi -TEXINFOS = bfd.texinfo -DIST_COMMON = ChangeLog Makefile.am Makefile.in +html__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +all: all-am - -DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) - -TAR = tar -GZIP_ENV = --best -all: all-redirect .SUFFIXES: -.SUFFIXES: .dvi .info .ps .texi .texinfo .txi -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --cygnus doc/Makefile +.SUFFIXES: .dvi .html .info .pdf .ps .texinfo +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign doc/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -bfd.info: bfd.texinfo -bfd.dvi: bfd.texinfo +mostlyclean-libtool: + -rm -f *.lo +clean-libtool: + -rm -rf .libs _libs -DVIPS = dvips - -.texi.info: - @rm -f $@ $@-[0-9] $@-[0-9][0-9] - $(MAKEINFO) -I $(srcdir) $< - -.texi.dvi: - TEXINPUTS=$(top_srcdir)/../texinfo/texinfo.tex:$$TEXINPUTS \ - MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $< - -.texi: - @rm -f $@ $@-[0-9] $@-[0-9][0-9] - $(MAKEINFO) -I $(srcdir) $< +distclean-libtool: + -rm -f libtool .texinfo.info: - @rm -f $@ $@-[0-9] $@-[0-9][0-9] - $(MAKEINFO) -I $(srcdir) $< - -.texinfo: - @rm -f $@ $@-[0-9] $@-[0-9][0-9] - $(MAKEINFO) -I $(srcdir) $< + restore=: && backupdir="$(am__leading_dot)am$$$$" && \ + am__cwd=`pwd` && cd $(srcdir) && \ + rm -rf $$backupdir && mkdir $$backupdir && \ + for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]; do \ + if test -f $$f; then mv $$f $$backupdir; restore=mv; else :; fi; \ + done; \ + cd "$$am__cwd"; \ + if $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \ + -o $@ $<; \ + then \ + rc=0; \ + cd $(srcdir); \ + else \ + rc=$$?; \ + cd $(srcdir) && \ + $$restore $$backupdir/* `echo "./$@" | sed 's|[^/]*$$||'`; \ + fi; \ + rm -rf $$backupdir; exit $$rc .texinfo.dvi: - TEXINPUTS=$(top_srcdir)/../texinfo/texinfo.tex:$$TEXINPUTS \ - MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $< + TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ + MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \ + $(TEXI2DVI) $< -.txi.info: - @rm -f $@ $@-[0-9] $@-[0-9][0-9] - $(MAKEINFO) -I $(srcdir) $< +.texinfo.pdf: + TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ + MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \ + $(TEXI2PDF) $< -.txi.dvi: - TEXINPUTS=$(top_srcdir)/../texinfo/texinfo.tex:$$TEXINPUTS \ - MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $< - -.txi: - @rm -f $@ $@-[0-9] $@-[0-9][0-9] - $(MAKEINFO) -I $(srcdir) $< +.texinfo.html: + rm -rf $(@:.html=.htp) + if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \ + -o $(@:.html=.htp) $<; \ + then \ + rm -rf $@; \ + if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \ + mv $(@:.html=) $@; else mv $(@:.html=.htp) $@; fi; \ + else \ + if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \ + rm -rf $(@:.html=); else rm -Rf $(@:.html=.htp) $@; fi; \ + exit 1; \ + fi +$(srcdir)/bfd.info: bfd.texinfo +bfd.dvi: bfd.texinfo +bfd.pdf: bfd.texinfo +bfd.html: bfd.texinfo .dvi.ps: - $(DVIPS) $< -o $@ + $(DVIPS) -o $@ $< -install-info-am: $(INFO_DEPS) - @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(infodir) - @list='$(INFO_DEPS)'; \ - for file in $$list; do \ - if test -f $$file; then d=.; else d=$(srcdir); fi; \ - for ifile in `cd $$d && echo $$file $$file-[0-9] $$file-[0-9][0-9]`; do \ - if test -f $$d/$$ifile; then \ - echo " $(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile"; \ - $(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile; \ - else : ; fi; \ - done; \ - done - @$(POST_INSTALL) - @if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \ +uninstall-info-am: + @$(PRE_UNINSTALL) + @if (install-info --version && \ + install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \ list='$(INFO_DEPS)'; \ for file in $$list; do \ - echo " install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file";\ - install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file || :;\ + relfile=`echo "$$file" | sed 's|^.*/||'`; \ + echo " install-info --info-dir='$(DESTDIR)$(infodir)' --remove '$(DESTDIR)$(infodir)/$$relfile'"; \ + install-info --info-dir="$(DESTDIR)$(infodir)" --remove "$(DESTDIR)$(infodir)/$$relfile"; \ done; \ - else : ; fi - -uninstall-info: - $(PRE_UNINSTALL) - @if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \ - ii=yes; \ - else ii=; fi; \ - list='$(INFO_DEPS)'; \ - for file in $$list; do \ - test -z "$$ii" \ - || install-info --info-dir=$(DESTDIR)$(infodir) --remove $$file; \ - done + else :; fi @$(NORMAL_UNINSTALL) - list='$(INFO_DEPS)'; \ + @list='$(INFO_DEPS)'; \ for file in $$list; do \ - (cd $(DESTDIR)$(infodir) && rm -f $$file $$file-[0-9] $$file-[0-9][0-9]); \ + relfile=`echo "$$file" | sed 's|^.*/||'`; \ + relfile_i=`echo "$$relfile" | sed 's|\.info$$||;s|$$|.i|'`; \ + (if cd "$(DESTDIR)$(infodir)"; then \ + echo " cd '$(DESTDIR)$(infodir)' && rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]"; \ + rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]; \ + else :; fi); \ done dist-info: $(INFO_DEPS) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ list='$(INFO_DEPS)'; \ for base in $$list; do \ + case $$base in \ + $(srcdir)/*) base=`echo "$$base" | sed "s|^$$srcdirstrip/||"`;; \ + esac; \ if test -f $$base; then d=.; else d=$(srcdir); fi; \ - for file in `cd $$d && eval echo $$base*`; do \ - test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file; \ + for file in $$d/$$base*; do \ + relfile=`expr "$$file" : "$$d/\(.*\)"`; \ + test -f $(distdir)/$$relfile || \ + cp -p $$file $(distdir)/$$relfile; \ done; \ done mostlyclean-aminfo: - -rm -f bfd.aux bfd.cp bfd.cps bfd.dvi bfd.fn bfd.fns bfd.ky bfd.kys \ - bfd.ps bfd.log bfd.pg bfd.toc bfd.tp bfd.tps bfd.vr bfd.vrs \ - bfd.op bfd.tr bfd.cv bfd.cn - -clean-aminfo: - -distclean-aminfo: + -rm -rf bfd.aux bfd.cp bfd.cps bfd.fn bfd.ky bfd.kys bfd.log bfd.pg bfd.pgs \ + bfd.tmp bfd.toc bfd.tp bfd.tps bfd.vr bfd.vrs bfd.dvi \ + bfd.pdf bfd.ps bfd.html maintainer-clean-aminfo: - for i in $(INFO_DEPS); do \ - rm -f $$i; \ - if test "`echo $$i-[0-9]*`" != "$$i-[0-9]*"; then \ - rm -f $$i-[0-9]*; \ - fi; \ + @list='$(INFO_DEPS)'; for i in $$list; do \ + i_i=`echo "$$i" | sed 's|\.info$$||;s|$$|.i|'`; \ + echo " rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]"; \ + rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]; \ done + clean-info: mostlyclean-aminfo tags: TAGS TAGS: +ctags: CTAGS +CTAGS: -distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) - -subdir = doc - -distdir: $(DISTFILES) - @for file in $(DISTFILES); do \ - if test -f $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - cp -pr $$d/$$file $(distdir)/$$file; \ - else \ - test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file || :; \ - fi; \ - done - $(MAKE) $(AM_MAKEFLAGS) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-info -info-am: $(INFO_DEPS) -info: info-am -dvi-am: $(DVIS) -dvi: dvi-am check-am: check: check-am -installcheck-am: -installcheck: installcheck-am -install-info-am: -install-info: install-info-am -install-exec-am: +all-am: Makefile +installdirs: install-exec: install-exec-am - -install-data-am: install-data: install-data-am +uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -install: install-am -uninstall-am: -uninstall: uninstall-am -all-am: Makefile -all-redirect: all-am + +installcheck: installcheck-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install -installdirs: - - + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) @@ -435,195 +490,237 @@ clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) - -rm -f config.cache config.log stamp-h stamp-h[0-9]* + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) -mostlyclean-am: mostlyclean-aminfo mostlyclean-generic +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-libtool + +dvi: dvi-am + +dvi-am: $(DVIS) + +html: html-am + +html-am: $(HTMLS) + +info: info-am + +info-am: $(INFO_DEPS) + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-info-am: $(INFO_DEPS) + @$(NORMAL_INSTALL) + test -z "$(infodir)" || $(mkdir_p) "$(DESTDIR)$(infodir)" + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + list='$(INFO_DEPS)'; \ + for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + esac; \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ + file_i=`echo "$$file" | sed 's|\.info$$||;s|$$|.i|'`; \ + for ifile in $$d/$$file $$d/$$file-[0-9] $$d/$$file-[0-9][0-9] \ + $$d/$$file_i[0-9] $$d/$$file_i[0-9][0-9] ; do \ + if test -f $$ifile; then \ + relfile=`echo "$$ifile" | sed 's|^.*/||'`; \ + echo " $(INSTALL_DATA) '$$ifile' '$(DESTDIR)$(infodir)/$$relfile'"; \ + $(INSTALL_DATA) "$$ifile" "$(DESTDIR)$(infodir)/$$relfile"; \ + else : ; fi; \ + done; \ + done + @$(POST_INSTALL) + @if (install-info --version && \ + install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \ + list='$(INFO_DEPS)'; \ + for file in $$list; do \ + relfile=`echo "$$file" | sed 's|^.*/||'`; \ + echo " install-info --info-dir='$(DESTDIR)$(infodir)' '$(DESTDIR)$(infodir)/$$relfile'";\ + install-info --info-dir="$(DESTDIR)$(infodir)" "$(DESTDIR)$(infodir)/$$relfile" || :;\ + done; \ + else : ; fi +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-aminfo \ + maintainer-clean-generic mostlyclean: mostlyclean-am -clean-am: clean-aminfo clean-generic mostlyclean-am +mostlyclean-am: mostlyclean-aminfo mostlyclean-generic \ + mostlyclean-libtool -clean: clean-am +pdf: pdf-am -distclean-am: distclean-aminfo distclean-generic clean-am - -rm -f libtool +pdf-am: $(PDFS) -distclean: distclean-am +ps: ps-am -maintainer-clean-am: maintainer-clean-aminfo maintainer-clean-generic \ - distclean-am - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." +ps-am: $(PSS) -maintainer-clean: maintainer-clean-am +uninstall-am: -.PHONY: install-info-am uninstall-info mostlyclean-aminfo \ -distclean-aminfo clean-aminfo maintainer-clean-aminfo tags distdir \ -info-am info dvi-am dvi check check-am installcheck-am installcheck \ -install-info-am install-info install-exec-am install-exec \ -install-data-am install-data install-am install uninstall-am uninstall \ -all-redirect all-am all installdirs mostlyclean-generic \ -distclean-generic clean-generic maintainer-clean-generic clean \ -mostlyclean distclean maintainer-clean +.PHONY: all all-am check check-am clean clean-generic clean-info \ + clean-libtool dist-info distclean distclean-generic \ + distclean-libtool dvi dvi-am html html-am info info-am install \ + install-am install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-aminfo \ + maintainer-clean-generic mostlyclean mostlyclean-aminfo \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + uninstall uninstall-am uninstall-info-am -$(MKDOC): chew.o - $(CC_FOR_BUILD) -o $(MKDOC) chew.o $(CFLAGS) $(LOADLIBES) $(LDFLAGS) +$(MKDOC): $(srcdir)/chew.c + $(CC_FOR_BUILD) -o chew.$$$$ $(srcdir)/chew.c \ + $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(H_CFLAGS) \ + $(INCLUDES); \ + $(SHELL) $(srcdir)/../../move-if-change chew.$$$$ $(MKDOC) chew.o: chew.c - $(CC_FOR_BUILD) -c -I.. -I$(srcdir)/.. -I$(srcdir)/../../include -I$(srcdir)/../../intl -I../../intl $(H_CFLAGS) $(CFLAGS) $(srcdir)/chew.c + $(CC_FOR_BUILD) -c $(INCLUDES) $(H_CFLAGS) $(CFLAGS_FOR_BUILD) $(srcdir)/chew.c protos: libbfd.h libcoff.h bfd.h -bfd.info bfd.dvi: $(DOCFILES) bfdsumm.texi bfd.texinfo +$(srcdir)/bfd.info bfd.dvi bfd.html: $(DOCFILES) bfdsumm.texi bfd.texinfo # We can't replace these rules with an implicit rule, because # makes without VPATH support couldn't find the .h files in `..'. -# We use s-XXX targets so that we can distribute the info files, -# and permit people to rebuild them, without requiring the makeinfo -# program. If somebody tries to rebuild info, but none of the .texi -# files have changed, then this Makefile will build chew, and will -# build all of the stamp files, but will not actually have to rebuild -# bfd.info. +# We do not depend on chew directly so that we can distribute the info +# files, and permit people to rebuild them, without requiring the makeinfo +# program. If somebody tries to rebuild info, but none of the .texi files +# have changed, then nothing will be rebuilt. -s-aoutx: $(MKDOC) $(srcdir)/../aoutx.h $(srcdir)/doc.str +aoutx.texi: chew.c $(srcdir)/../aoutx.h $(srcdir)/doc.str + $(MAKE) $(MKDOC) ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../aoutx.h >aoutx.tmp - $(srcdir)/../../move-if-change aoutx.tmp aoutx.texi - touch s-aoutx -aoutx.texi: s-aoutx + $(SHELL) $(srcdir)/../../move-if-change aoutx.tmp aoutx.texi -s-archive: $(MKDOC) $(srcdir)/../archive.c $(srcdir)/doc.str +archive.texi: chew.c $(srcdir)/../archive.c $(srcdir)/doc.str + $(MAKE) $(MKDOC) ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../archive.c >archive.tmp - $(srcdir)/../../move-if-change archive.tmp archive.texi - touch s-archive -archive.texi: s-archive + $(SHELL) $(srcdir)/../../move-if-change archive.tmp archive.texi -s-archures: $(MKDOC) $(srcdir)/../archures.c $(srcdir)/doc.str +archures.texi: chew.c $(srcdir)/../archures.c $(srcdir)/doc.str + $(MAKE) $(MKDOC) ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../archures.c >archures.tmp - $(srcdir)/../../move-if-change archures.tmp archures.texi - touch s-archures -archures.texi: s-archures + $(SHELL) $(srcdir)/../../move-if-change archures.tmp archures.texi # We use bfdt.texi, rather than bfd.texi, to avoid conflicting with # bfd.texinfo on an 8.3 filesystem. -s-bfd: $(MKDOC) $(srcdir)/../bfd.c $(srcdir)/doc.str +bfdt.texi: chew.c $(srcdir)/../bfd.c $(srcdir)/doc.str + $(MAKE) $(MKDOC) ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../bfd.c >bfd.tmp - $(srcdir)/../../move-if-change bfd.tmp bfdt.texi - touch s-bfd -bfdt.texi: s-bfd + $(SHELL) $(srcdir)/../../move-if-change bfd.tmp bfdt.texi -s-cache: $(MKDOC) $(srcdir)/../cache.c $(srcdir)/doc.str +cache.texi: chew.c $(srcdir)/../cache.c $(srcdir)/doc.str + $(MAKE) $(MKDOC) ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../cache.c >cache.tmp - $(srcdir)/../../move-if-change cache.tmp cache.texi - touch s-cache -cache.texi: s-cache + $(SHELL) $(srcdir)/../../move-if-change cache.tmp cache.texi -s-coffcode: $(MKDOC) $(srcdir)/../coffcode.h $(srcdir)/doc.str +coffcode.texi: chew.c $(srcdir)/../coffcode.h $(srcdir)/doc.str + $(MAKE) $(MKDOC) ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../coffcode.h >coffcode.tmp - $(srcdir)/../../move-if-change coffcode.tmp coffcode.texi - touch s-coffcode -coffcode.texi: s-coffcode + $(SHELL) $(srcdir)/../../move-if-change coffcode.tmp coffcode.texi -s-core: $(MKDOC) $(srcdir)/../corefile.c $(srcdir)/doc.str +core.texi: chew.c $(srcdir)/../corefile.c $(srcdir)/doc.str + $(MAKE) $(MKDOC) ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../corefile.c >core.tmp - $(srcdir)/../../move-if-change core.tmp core.texi - touch s-core -core.texi: s-core + $(SHELL) $(srcdir)/../../move-if-change core.tmp core.texi -s-elf: $(MKDOC) $(srcdir)/../elf.c $(srcdir)/doc.str +elf.texi: chew.c $(srcdir)/../elf.c $(srcdir)/doc.str + $(MAKE) $(MKDOC) ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../elf.c >elf.tmp - $(srcdir)/../../move-if-change elf.tmp elf.texi - touch s-elf -elf.texi: s-elf + $(SHELL) $(srcdir)/../../move-if-change elf.tmp elf.texi -s-elfcode: $(MKDOC) $(srcdir)/../elfcode.h $(srcdir)/doc.str +elfcode.texi: chew.c $(srcdir)/../elfcode.h $(srcdir)/doc.str + $(MAKE) $(MKDOC) ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../elfcode.h >elfcode.tmp - $(srcdir)/../../move-if-change elfcode.tmp elfcode.texi - touch s-elfcode -elfcode.texi: s-elfcode + $(SHELL) $(srcdir)/../../move-if-change elfcode.tmp elfcode.texi -s-mmo: $(MKDOC) $(srcdir)/../mmo.c $(srcdir)/doc.str +mmo.texi: chew.c $(srcdir)/../mmo.c $(srcdir)/doc.str + $(MAKE) $(MKDOC) ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../mmo.c >mmo.tmp - $(srcdir)/../../move-if-change mmo.tmp mmo.texi - touch s-mmo -mmo.texi: s-mmo + $(SHELL) $(srcdir)/../../move-if-change mmo.tmp mmo.texi -s-format: $(MKDOC) $(srcdir)/../format.c $(srcdir)/doc.str +format.texi: chew.c $(srcdir)/../format.c $(srcdir)/doc.str + $(MAKE) $(MKDOC) ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../format.c >format.tmp - $(srcdir)/../../move-if-change format.tmp format.texi - touch s-format -format.texi: s-format + $(SHELL) $(srcdir)/../../move-if-change format.tmp format.texi -s-libbfd: $(MKDOC) $(srcdir)/../libbfd.c $(srcdir)/doc.str +libbfd.texi: chew.c $(srcdir)/../libbfd.c $(srcdir)/doc.str + $(MAKE) $(MKDOC) ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../libbfd.c >libbfd.tmp - $(srcdir)/../../move-if-change libbfd.tmp libbfd.texi - touch s-libbfd -libbfd.texi: s-libbfd + $(SHELL) $(srcdir)/../../move-if-change libbfd.tmp libbfd.texi -s-bfdio: $(MKDOC) $(srcdir)/../bfdio.c $(srcdir)/doc.str +bfdio.texi: chew.c $(srcdir)/../bfdio.c $(srcdir)/doc.str + $(MAKE) $(MKDOC) ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../bfdio.c >bfdio.tmp - $(srcdir)/../../move-if-change bfdio.tmp bfdio.texi - touch s-bfdio -bfdio.texi: s-bfdio + $(SHELL) $(srcdir)/../../move-if-change bfdio.tmp bfdio.texi -s-bfdwin: $(MKDOC) $(srcdir)/../bfdwin.c $(srcdir)/doc.str +bfdwin.texi: chew.c $(srcdir)/../bfdwin.c $(srcdir)/doc.str + $(MAKE) $(MKDOC) ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../bfdwin.c >bfdwin.tmp - $(srcdir)/../../move-if-change bfdwin.tmp bfdwin.texi - touch s-bfdwin -bfdwin.texi: s-bfdwin + $(SHELL) $(srcdir)/../../move-if-change bfdwin.tmp bfdwin.texi -s-opncls: $(MKDOC) $(srcdir)/../opncls.c $(srcdir)/doc.str +opncls.texi: chew.c $(srcdir)/../opncls.c $(srcdir)/doc.str + $(MAKE) $(MKDOC) ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../opncls.c >opncls.tmp - $(srcdir)/../../move-if-change opncls.tmp opncls.texi - touch s-opncls -opncls.texi: s-opncls + $(SHELL) $(srcdir)/../../move-if-change opncls.tmp opncls.texi -s-reloc: $(MKDOC) $(srcdir)/../reloc.c $(srcdir)/doc.str +reloc.texi: chew.c $(srcdir)/../reloc.c $(srcdir)/doc.str + $(MAKE) $(MKDOC) ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../reloc.c >reloc.tmp - $(srcdir)/../../move-if-change reloc.tmp reloc.texi - touch s-reloc -reloc.texi: s-reloc + $(SHELL) $(srcdir)/../../move-if-change reloc.tmp reloc.texi -s-section: $(MKDOC) $(srcdir)/../section.c $(srcdir)/doc.str +section.texi: chew.c $(srcdir)/../section.c $(srcdir)/doc.str + $(MAKE) $(MKDOC) ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../section.c >section.tmp - $(srcdir)/../../move-if-change section.tmp section.texi - touch s-section -section.texi: s-section + $(SHELL) $(srcdir)/../../move-if-change section.tmp section.texi -s-syms: $(MKDOC) $(srcdir)/../syms.c $(srcdir)/doc.str +syms.texi: chew.c $(srcdir)/../syms.c $(srcdir)/doc.str + $(MAKE) $(MKDOC) ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../syms.c >syms.tmp - $(srcdir)/../../move-if-change syms.tmp syms.texi - touch s-syms -syms.texi: s-syms + $(SHELL) $(srcdir)/../../move-if-change syms.tmp syms.texi -s-targets: $(MKDOC) $(srcdir)/../targets.c $(srcdir)/doc.str +targets.texi: chew.c $(srcdir)/../targets.c $(srcdir)/doc.str + $(MAKE) $(MKDOC) ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../targets.c >targets.tmp - $(srcdir)/../../move-if-change targets.tmp targets.texi - touch s-targets -targets.texi: s-targets + $(SHELL) $(srcdir)/../../move-if-change targets.tmp targets.texi -s-init: $(MKDOC) $(srcdir)/../init.c $(srcdir)/doc.str +init.texi: chew.c $(srcdir)/../init.c $(srcdir)/doc.str + $(MAKE) $(MKDOC) ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../init.c >init.tmp - $(srcdir)/../../move-if-change init.tmp init.texi - touch s-init -init.texi: s-init + $(SHELL) $(srcdir)/../../move-if-change init.tmp init.texi -s-hash: $(MKDOC) $(srcdir)/../hash.c $(srcdir)/doc.str +hash.texi: chew.c $(srcdir)/../hash.c $(srcdir)/doc.str + $(MAKE) $(MKDOC) ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../hash.c >hash.tmp - $(srcdir)/../../move-if-change hash.tmp hash.texi - touch s-hash -hash.texi: s-hash + $(SHELL) $(srcdir)/../../move-if-change hash.tmp hash.texi -s-linker: $(MKDOC) $(srcdir)/../linker.c $(srcdir)/doc.str +linker.texi: chew.c $(srcdir)/../linker.c $(srcdir)/doc.str + $(MAKE) $(MKDOC) ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../linker.c >linker.tmp - $(srcdir)/../../move-if-change linker.tmp linker.texi - touch s-linker -linker.texi: s-linker + $(SHELL) $(srcdir)/../../move-if-change linker.tmp linker.texi libbfd.h: $(LIBBFD_H_DEP) echo "$(LIBBFD_H_DEP)" | sed -f $(srcdir)/header.sed > $@ @@ -669,6 +766,24 @@ bfd.h: $(BFD_H_DEP) # cygnus option. install: install-info +install-html: install-html-am + +install-html-am: $(HTMLS) + @$(NORMAL_INSTALL) + test -z "$(htmldir)" || $(mkdir_p) "$(DESTDIR)$(htmldir)" + @list='$(HTMLS)'; for p in $$list; do \ + if test -f "$$p" || test -d "$$p"; then d=""; else d="$(srcdir)/"; fi; \ + f=$(html__strip_dir) \ + if test -d "$$d$$p"; then \ + echo " $(mkdir_p) '$(DESTDIR)$(htmldir)/$$f'"; \ + $(mkdir_p) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \ + echo " $(INSTALL_DATA) '$$d$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \ + $(INSTALL_DATA) "$$d$$p"/* "$(DESTDIR)$(htmldir)/$$f"; \ + else \ + echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(htmldir)/$$f'"; \ + $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(htmldir)/$$f"; \ + fi; \ + done # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/contrib/binutils/bfd/doc/aoutx.texi b/contrib/binutils/bfd/doc/aoutx.texi index 0c4167b7775..7cf9787f106 100644 --- a/contrib/binutils/bfd/doc/aoutx.texi +++ b/contrib/binutils/bfd/doc/aoutx.texi @@ -121,7 +121,7 @@ turn by various format specific files (eg sunos.c). @example void aout_@var{size}_swap_exec_header_in, (bfd *abfd, - struct external_exec *raw_bytes, + struct external_exec *bytes, struct internal_exec *execp); @end example @strong{Description}@* @@ -148,7 +148,8 @@ Swap the information in an internal exec header structure @example const bfd_target *aout_@var{size}_some_aout_object_p (bfd *abfd, - const bfd_target *(*callback_to_real_object_p) ()); + struct internal_exec *execp, + const bfd_target *(*callback_to_real_object_p) (bfd *)); @end example @strong{Description}@* Some a.out variant thinks that the file open in @var{abfd} @@ -172,7 +173,8 @@ Initialize BFD @var{abfd} for use with a.out files. @example enum machine_type aout_@var{size}_machine_type (enum bfd_architecture arch, - unsigned long machine)); + unsigned long machine, + bfd_boolean *unknown); @end example @strong{Description}@* Keep track of machine architecture and machine type for @@ -190,7 +192,7 @@ is always understood. bfd_boolean aout_@var{size}_set_arch_mach, (bfd *, enum bfd_architecture arch, - unsigned long machine)); + unsigned long machine); @end example @strong{Description}@* Set the architecture and the machine of the BFD @var{abfd} to the @@ -203,7 +205,7 @@ can support the architecture required. @example bfd_boolean aout_@var{size}_new_section_hook, (bfd *abfd, - asection *newsect)); + asection *newsect); @end example @strong{Description}@* Called by the BFD in response to a @code{bfd_make_section} diff --git a/contrib/binutils/bfd/doc/archive.texi b/contrib/binutils/bfd/doc/archive.texi index e20906aa551..3d0a97d4b82 100644 --- a/contrib/binutils/bfd/doc/archive.texi +++ b/contrib/binutils/bfd/doc/archive.texi @@ -50,6 +50,9 @@ of a restriction. Archives are supported in BFD in @code{archive.c}. +@subsection Archive functions + + @findex bfd_get_next_mapent @subsubsection @code{bfd_get_next_mapent} @strong{Synopsis} diff --git a/contrib/binutils/bfd/doc/archures.texi b/contrib/binutils/bfd/doc/archures.texi index 06ee6d318ce..bf72179dad3 100644 --- a/contrib/binutils/bfd/doc/archures.texi +++ b/contrib/binutils/bfd/doc/archures.texi @@ -46,11 +46,22 @@ enum bfd_architecture #define bfd_mach_m68040 6 #define bfd_mach_m68060 7 #define bfd_mach_cpu32 8 -#define bfd_mach_mcf5200 9 -#define bfd_mach_mcf5206e 10 -#define bfd_mach_mcf5307 11 -#define bfd_mach_mcf5407 12 -#define bfd_mach_mcf528x 13 +#define bfd_mach_mcf_isa_a_nodiv 9 +#define bfd_mach_mcf_isa_a 10 +#define bfd_mach_mcf_isa_a_mac 11 +#define bfd_mach_mcf_isa_a_emac 12 +#define bfd_mach_mcf_isa_aplus 13 +#define bfd_mach_mcf_isa_aplus_mac 14 +#define bfd_mach_mcf_isa_aplus_emac 15 +#define bfd_mach_mcf_isa_b_nousp 16 +#define bfd_mach_mcf_isa_b_nousp_mac 17 +#define bfd_mach_mcf_isa_b_nousp_emac 18 +#define bfd_mach_mcf_isa_b 19 +#define bfd_mach_mcf_isa_b_mac 20 +#define bfd_mach_mcf_isa_b_emac 21 +#define bfd_mach_mcf_isa_b_float 22 +#define bfd_mach_mcf_isa_b_float_mac 23 +#define bfd_mach_mcf_isa_b_float_emac 24 bfd_arch_vax, /* DEC Vax */ bfd_arch_i960, /* Intel 960 */ /* The order of the following is important. @@ -72,7 +83,6 @@ enum bfd_architecture bfd_arch_or32, /* OpenRISC 32 */ - bfd_arch_a29k, /* AMD 29000 */ bfd_arch_sparc, /* SPARC */ #define bfd_mach_sparc 1 /* The difference between v8plus and v9 is that v9 is a true 64 bit env. */ @@ -89,6 +99,9 @@ enum bfd_architecture #define bfd_mach_sparc_v9_p(mach) \ ((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9b \ && (mach) != bfd_mach_sparc_sparclite_le) +/* Nonzero if MACH is a 64 bit sparc architecture. */ +#define bfd_mach_sparc_64bit_p(mach) \ + ((mach) >= bfd_mach_sparc_v9 && (mach) != bfd_mach_sparc_v8plusb) bfd_arch_mips, /* MIPS Rxxxx */ #define bfd_mach_mips3000 3000 #define bfd_mach_mips3900 3900 @@ -107,6 +120,7 @@ enum bfd_architecture #define bfd_mach_mips6000 6000 #define bfd_mach_mips7000 7000 #define bfd_mach_mips8000 8000 +#define bfd_mach_mips9000 9000 #define bfd_mach_mips10000 10000 #define bfd_mach_mips12000 12000 #define bfd_mach_mips16 16 @@ -127,7 +141,6 @@ enum bfd_architecture bfd_arch_i860, /* Intel 860 */ bfd_arch_i370, /* IBM 360/370 Mainframes */ bfd_arch_romp, /* IBM ROMP PC/RT */ - bfd_arch_alliant, /* Alliant */ bfd_arch_convex, /* Convex */ bfd_arch_m88k, /* Motorola 88xxx */ bfd_arch_m98k, /* Motorola 98xxx */ @@ -190,12 +203,20 @@ enum bfd_architecture #define bfd_mach_sh 1 #define bfd_mach_sh2 0x20 #define bfd_mach_sh_dsp 0x2d +#define bfd_mach_sh2a 0x2a +#define bfd_mach_sh2a_nofpu 0x2b +#define bfd_mach_sh2a_nofpu_or_sh4_nommu_nofpu 0x2a1 +#define bfd_mach_sh2a_nofpu_or_sh3_nommu 0x2a2 +#define bfd_mach_sh2a_or_sh4 0x2a3 +#define bfd_mach_sh2a_or_sh3e 0x2a4 #define bfd_mach_sh2e 0x2e #define bfd_mach_sh3 0x30 +#define bfd_mach_sh3_nommu 0x31 #define bfd_mach_sh3_dsp 0x3d #define bfd_mach_sh3e 0x3e #define bfd_mach_sh4 0x40 #define bfd_mach_sh4_nofpu 0x41 +#define bfd_mach_sh4_nommu_nofpu 0x42 #define bfd_mach_sh4a 0x4a #define bfd_mach_sh4a_nofpu 0x4b #define bfd_mach_sh4al_dsp 0x4d @@ -235,6 +256,9 @@ enum bfd_architecture #define bfd_mach_arc_6 6 #define bfd_mach_arc_7 7 #define bfd_mach_arc_8 8 + bfd_arch_m32c, /* Renesas M16C/M32C. */ +#define bfd_mach_m16c 0x75 +#define bfd_mach_m32c 0x78 bfd_arch_m32r, /* Renesas M32R (formerly Mitsubishi M32R/D) */ #define bfd_mach_m32r 1 /* For backwards compatibility. */ #define bfd_mach_m32rx 'x' @@ -251,6 +275,7 @@ enum bfd_architecture #define bfd_mach_frvsimple 2 #define bfd_mach_fr300 300 #define bfd_mach_fr400 400 +#define bfd_mach_fr450 450 #define bfd_mach_frvtomcat 499 /* fr500 prototype */ #define bfd_mach_fr500 500 #define bfd_mach_fr550 550 @@ -264,6 +289,10 @@ enum bfd_architecture bfd_arch_iq2000, /* Vitesse IQ2000. */ #define bfd_mach_iq2000 1 #define bfd_mach_iq10 2 + bfd_arch_mt, +#define bfd_mach_ms1 1 +#define bfd_mach_mrisc2 2 +#define bfd_mach_ms2 3 bfd_arch_pj, bfd_arch_avr, /* Atmel AVR microcontrollers. */ #define bfd_mach_avr1 1 @@ -271,7 +300,16 @@ enum bfd_architecture #define bfd_mach_avr3 3 #define bfd_mach_avr4 4 #define bfd_mach_avr5 5 + bfd_arch_bfin, /* ADI Blackfin */ +#define bfd_mach_bfin 1 + bfd_arch_cr16c, /* National Semiconductor CompactRISC. */ +#define bfd_mach_cr16c 1 + bfd_arch_crx, /* National Semiconductor CRX. */ +#define bfd_mach_crx 1 bfd_arch_cris, /* Axis CRIS */ +#define bfd_mach_cris_v0_v10 255 +#define bfd_mach_cris_v32 32 +#define bfd_mach_cris_v10_v32 1032 bfd_arch_s390, /* IBM s390 */ #define bfd_mach_s390_31 31 #define bfd_mach_s390_64 64 @@ -286,7 +324,8 @@ enum bfd_architecture #define bfd_mach_msp13 13 #define bfd_mach_msp14 14 #define bfd_mach_msp15 15 -#define bfd_mach_msp16 16 +#define bfd_mach_msp16 16 +#define bfd_mach_msp21 21 #define bfd_mach_msp31 31 #define bfd_mach_msp32 32 #define bfd_mach_msp33 33 @@ -294,8 +333,20 @@ enum bfd_architecture #define bfd_mach_msp42 42 #define bfd_mach_msp43 43 #define bfd_mach_msp44 44 + bfd_arch_xc16x, /* Infineon's XC16X Series. */ +#define bfd_mach_xc16x 1 +#define bfd_mach_xc16xl 2 +#define bfd_mach_xc16xs 3 bfd_arch_xtensa, /* Tensilica's Xtensa cores. */ #define bfd_mach_xtensa 1 + bfd_arch_maxq, /* Dallas MAXQ 10/20 */ +#define bfd_mach_maxq10 10 +#define bfd_mach_maxq20 20 + bfd_arch_z80, +#define bfd_mach_z80strict 1 /* No undocumented opcodes. */ +#define bfd_mach_z80 3 /* With ixl, ixh, iyl, and iyh. */ +#define bfd_mach_z80full 7 /* All undocumented instructions. */ +#define bfd_mach_r800 11 /* R800: successor with multiplication. */ bfd_arch_last @}; @end example diff --git a/contrib/binutils/bfd/doc/bfd.texinfo b/contrib/binutils/bfd/doc/bfd.texinfo index 3ed419476d1..432e0526449 100644 --- a/contrib/binutils/bfd/doc/bfd.texinfo +++ b/contrib/binutils/bfd/doc/bfd.texinfo @@ -1,22 +1,9 @@ \input texinfo.tex @setfilename bfd.info -@c Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1997, 2000, 2003 +@c Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1997, 2000, +@c 2001, 2002, 2003 @c Free Software Foundation, Inc. @c -@tex -% NOTE LOCAL KLUGE TO AVOID TOO MUCH WHITESPACE -\global\long\def\example{% -\begingroup -\let\aboveenvbreak=\par -\let\afterenvbreak=\par -\parskip=0pt -\lisp} -\global\long\def\Eexample{% -\Elisp -\endgroup -\vskip -\parskip% to cancel out effect of following \par -} -@end tex @synindex fn cp @ifinfo diff --git a/contrib/binutils/bfd/doc/bfdint.texi b/contrib/binutils/bfd/doc/bfdint.texi index 95c0096e468..98826fd5206 100644 --- a/contrib/binutils/bfd/doc/bfdint.texi +++ b/contrib/binutils/bfd/doc/bfdint.texi @@ -1,6 +1,6 @@ \input texinfo @c Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, -@c 2000, 2001, 2002, 2003 +@c 2000, 2001, 2002, 2003, 2004 @c Free Software Foundation, Inc. @setfilename bfdint.info diff --git a/contrib/binutils/bfd/doc/bfdio.texi b/contrib/binutils/bfd/doc/bfdio.texi index b8c79d30ccd..eb7e31df9d0 100644 --- a/contrib/binutils/bfd/doc/bfdio.texi +++ b/contrib/binutils/bfd/doc/bfdio.texi @@ -1,3 +1,34 @@ +@findex struct bfd_iovec +@subsubsection @code{struct bfd_iovec} +@strong{Description}@* +The @code{struct bfd_iovec} contains the internal file I/O class. +Each @code{BFD} has an instance of this class and all file I/O is +routed through it (it is assumed that the instance implements +all methods listed below). +@example +struct bfd_iovec +@{ + /* To avoid problems with macros, a "b" rather than "f" + prefix is prepended to each method name. */ + /* Attempt to read/write NBYTES on ABFD's IOSTREAM storing/fetching + bytes starting at PTR. Return the number of bytes actually + transfered (a read past end-of-file returns less than NBYTES), + or -1 (setting @code{bfd_error}) if an error occurs. */ + file_ptr (*bread) (struct bfd *abfd, void *ptr, file_ptr nbytes); + file_ptr (*bwrite) (struct bfd *abfd, const void *ptr, + file_ptr nbytes); + /* Return the current IOSTREAM file offset, or -1 (setting @code{bfd_error} + if an error occurs. */ + file_ptr (*btell) (struct bfd *abfd); + /* For the following, on successful completion a value of 0 is returned. + Otherwise, a value of -1 is returned (and @code{bfd_error} is set). */ + int (*bseek) (struct bfd *abfd, file_ptr offset, int whence); + int (*bclose) (struct bfd *abfd); + int (*bflush) (struct bfd *abfd); + int (*bstat) (struct bfd *abfd, struct stat *sb); +@}; +@end example + @findex bfd_get_mtime @subsubsection @code{bfd_get_mtime} @strong{Synopsis} diff --git a/contrib/binutils/bfd/doc/bfdt.texi b/contrib/binutils/bfd/doc/bfdt.texi index 74cace4a60a..a22fe3861d9 100644 --- a/contrib/binutils/bfd/doc/bfdt.texi +++ b/contrib/binutils/bfd/doc/bfdt.texi @@ -21,14 +21,10 @@ struct bfd /* 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. */ + /* The IOSTREAM, and corresponding IO vector that provide access + to the file backing the BFD. */ void *iostream; + const struct bfd_iovec *iovec; /* Is the file descriptor being cached? That is, can it be closed as needed, and re-opened when accessed later? */ @@ -91,8 +87,8 @@ struct bfd /* Pointer to linked list of sections. */ struct bfd_section *sections; - /* The place where we add to the section list. */ - struct bfd_section **section_tail; + /* The last section on the section list. */ + struct bfd_section *section_last; /* The number of sections. */ unsigned int section_count; @@ -113,6 +109,9 @@ struct bfd /* Pointer to structure which contains architecture information. */ const struct bfd_arch_info *arch_info; + /* Flag set if symbols from this BFD should not be exported. */ + bfd_boolean no_export; + /* Stuff only useful for archives. */ void *arelt_data; struct bfd *my_archive; /* The containing archive BFD. */ @@ -307,18 +306,10 @@ bfd_error_handler_type bfd_get_error_handler (void); @strong{Description}@* Return the BFD error handler function. -@findex bfd_archive_filename -@subsubsection @code{bfd_archive_filename} -@strong{Synopsis} -@example -const char *bfd_archive_filename (bfd *); -@end example -@strong{Description}@* -For a BFD that is a component of an archive, returns a string -with both the archive name and file name. For other BFDs, just -returns the file name. +@section Miscellaneous -@section Symbols + +@subsection Miscellaneous functions @findex bfd_get_reloc_upper_bound @@ -472,6 +463,31 @@ in octal if a leading zero is found, otherwise in decimal. If the value would overflow, the maximum @code{bfd_vma} value is returned. +@findex bfd_copy_private_header_data +@subsubsection @code{bfd_copy_private_header_data} +@strong{Synopsis} +@example +bfd_boolean bfd_copy_private_header_data (bfd *ibfd, bfd *obfd); +@end example +@strong{Description}@* +Copy private BFD header information from the BFD @var{ibfd} to the +the BFD @var{obfd}. This copies information that may require +sections to exist, but does not require symbol tables. 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_header_data(ibfd, obfd) \ + BFD_SEND (obfd, _bfd_copy_private_header_data, \ + (ibfd, obfd)) +@end example + @findex bfd_copy_private_bfd_data @subsubsection @code{bfd_copy_private_bfd_data} @strong{Synopsis} @@ -552,6 +568,14 @@ The following functions exist but have not yet been documented. BFD_SEND (abfd, _bfd_find_nearest_line, \ (abfd, sec, syms, off, file, func, line)) +#define bfd_find_line(abfd, syms, sym, file, line) \ + BFD_SEND (abfd, _bfd_find_line, \ + (abfd, syms, sym, file, line)) + +#define bfd_find_inliner_info(abfd, file, func, line) \ + BFD_SEND (abfd, _bfd_find_inliner_info, \ + (abfd, file, func, line)) + #define bfd_debug_info_start(abfd) \ BFD_SEND (abfd, _bfd_debug_info_start, (abfd)) @@ -579,6 +603,9 @@ The following functions exist but have not yet been documented. #define bfd_merge_sections(abfd, link_info) \ BFD_SEND (abfd, _bfd_merge_sections, (abfd, link_info)) +#define bfd_is_group_section(abfd, sec) \ + BFD_SEND (abfd, _bfd_is_group_section, (abfd, sec)) + #define bfd_discard_group(abfd, sec) \ BFD_SEND (abfd, _bfd_discard_group, (abfd, sec)) @@ -591,7 +618,7 @@ The following functions exist but have not yet been documented. #define bfd_link_add_symbols(abfd, info) \ BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info)) -#define bfd_link_just_syms(sec, info) \ +#define bfd_link_just_syms(abfd, sec, info) \ BFD_SEND (abfd, _bfd_link_just_syms, (sec, info)) #define bfd_final_link(abfd, info) \ @@ -609,6 +636,10 @@ The following functions exist but have not yet been documented. #define bfd_canonicalize_dynamic_symtab(abfd, asymbols) \ BFD_SEND (abfd, _bfd_canonicalize_dynamic_symtab, (abfd, asymbols)) +#define bfd_get_synthetic_symtab(abfd, count, syms, dyncount, dynsyms, ret) \ + BFD_SEND (abfd, _bfd_get_synthetic_symtab, (abfd, count, syms, \ + dyncount, dynsyms, ret)) + #define bfd_get_dynamic_reloc_upper_bound(abfd) \ BFD_SEND (abfd, _bfd_get_dynamic_reloc_upper_bound, (abfd)) @@ -643,7 +674,7 @@ struct bfd_preserve flagword flags; const struct bfd_arch_info *arch_info; struct bfd_section *sections; - struct bfd_section **section_tail; + struct bfd_section *section_last; unsigned int section_count; struct bfd_hash_table section_htab; @}; diff --git a/contrib/binutils/bfd/doc/cache.texi b/contrib/binutils/bfd/doc/cache.texi index 2bc3696b101..5820a2a6a1d 100644 --- a/contrib/binutils/bfd/doc/cache.texi +++ b/contrib/binutils/bfd/doc/cache.texi @@ -10,39 +10,8 @@ the required BFD is open. If not, then it chooses a file to close, closes it and opens the one wanted, returning its file handle. -@findex BFD_CACHE_MAX_OPEN macro -@subsubsection @code{BFD_CACHE_MAX_OPEN macro} -@strong{Description}@* -The maximum number of files which the cache will keep open at -one time. -@example -#define BFD_CACHE_MAX_OPEN 10 -@end example +@subsection Caching functions -@findex bfd_last_cache -@subsubsection @code{bfd_last_cache} -@strong{Synopsis} -@example -extern bfd *bfd_last_cache; -@end example -@strong{Description}@* -Zero, or a pointer to the topmost BFD on the chain. This is -used by the @code{bfd_cache_lookup} macro in @file{libbfd.h} to -determine when it can avoid a function call. - -@findex bfd_cache_lookup -@subsubsection @code{bfd_cache_lookup} -@strong{Description}@* -Check to see if the required BFD is the same as the last one -looked up. If so, then it can use the stream in the BFD with -impunity, since it can't have changed since the last lookup; -otherwise, it has to perform the complicated lookup function. -@example -#define bfd_cache_lookup(x) \ - ((x)==bfd_last_cache? \ - (FILE*) (bfd_last_cache->iostream): \ - bfd_cache_lookup_worker(x)) -@end example @findex bfd_cache_init @subsubsection @code{bfd_cache_init} @@ -67,6 +36,20 @@ then close it too. @code{FALSE} is returned if closing the file fails, @code{TRUE} is returned if all is well. +@findex bfd_cache_close_all +@subsubsection @code{bfd_cache_close_all} +@strong{Synopsis} +@example +bfd_boolean bfd_cache_close_all (void); +@end example +@strong{Description}@* +Remove all BFDs from the cache. If the attached file is open, +then close it too. + +@strong{Returns}@* +@code{FALSE} is returned if closing one of the file fails, @code{TRUE} is +returned if all is well. + @findex bfd_open_file @subsubsection @code{bfd_open_file} @strong{Synopsis} @@ -80,16 +63,3 @@ BFD so that future accesses know the file is open. If the @code{FILE *} returned is @code{NULL}, then it won't have been put in the cache, so it won't have to be removed from it. -@findex bfd_cache_lookup_worker -@subsubsection @code{bfd_cache_lookup_worker} -@strong{Synopsis} -@example -FILE *bfd_cache_lookup_worker (bfd *abfd); -@end example -@strong{Description}@* -Called when the macro @code{bfd_cache_lookup} fails to find a -quick answer. Find a file descriptor for @var{abfd}. If -necessary, it open it. If there are already more than -@code{BFD_CACHE_MAX_OPEN} files open, it tries to close one first, to -avoid running out of file descriptors. - diff --git a/contrib/binutils/bfd/doc/chew.c b/contrib/binutils/bfd/doc/chew.c index 7c060da2d1c..542fc2feb70 100644 --- a/contrib/binutils/bfd/doc/chew.c +++ b/contrib/binutils/bfd/doc/chew.c @@ -1,6 +1,6 @@ /* chew Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2001, - 2002, 2003 + 2002, 2003, 2005 Free Software Foundation, Inc. Contributed by steve chamberlain @cygnus @@ -18,7 +18,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* Yet another way of extracting documentation from source. No, I haven't finished it yet, but I hope you people like it better @@ -83,10 +83,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ Foo. */ #include "ansidecl.h" -#include "sysdep.h" #include #include #include +#include +#include #define DEF_SIZE 5000 #define STACK 50 @@ -588,45 +589,6 @@ translatecomments () pc++; } -#if 0 - -/* This is not currently used. */ - -/* turn everything not starting with a . into a comment */ - -static void -manglecomments () -{ - unsigned int idx = 0; - string_type out; - init_string (&out); - - while (at (tos, idx)) - { - if (at (tos, idx) == '\n' && at (tos, idx + 1) == '*') - { - cattext (&out, " /*"); - idx += 2; - } - else if (at (tos, idx) == '*' && at (tos, idx + 1) == '}') - { - cattext (&out, "*/"); - idx += 2; - } - else - { - catchar (&out, at (tos, idx)); - idx++; - } - } - - overwrite_string (tos, &out); - - pc++; -} - -#endif - /* Mod tos so that only lines with leading dots remain */ static void outputdots () diff --git a/contrib/binutils/bfd/doc/coffcode.texi b/contrib/binutils/bfd/doc/coffcode.texi index f9e15a62834..6689009c081 100644 --- a/contrib/binutils/bfd/doc/coffcode.texi +++ b/contrib/binutils/bfd/doc/coffcode.texi @@ -288,34 +288,34 @@ Special entry points for gdb to swap in coff symbol table parts: typedef struct @{ void (*_bfd_coff_swap_aux_in) - PARAMS ((bfd *, PTR, int, int, int, int, PTR)); + (bfd *, void *, int, int, int, int, void *); void (*_bfd_coff_swap_sym_in) - PARAMS ((bfd *, PTR, PTR)); + (bfd *, void *, void *); void (*_bfd_coff_swap_lineno_in) - PARAMS ((bfd *, PTR, PTR)); + (bfd *, void *, void *); unsigned int (*_bfd_coff_swap_aux_out) - PARAMS ((bfd *, PTR, int, int, int, int, PTR)); + (bfd *, void *, int, int, int, int, void *); unsigned int (*_bfd_coff_swap_sym_out) - PARAMS ((bfd *, PTR, PTR)); + (bfd *, void *, void *); unsigned int (*_bfd_coff_swap_lineno_out) - PARAMS ((bfd *, PTR, PTR)); + (bfd *, void *, void *); unsigned int (*_bfd_coff_swap_reloc_out) - PARAMS ((bfd *, PTR, PTR)); + (bfd *, void *, void *); unsigned int (*_bfd_coff_swap_filehdr_out) - PARAMS ((bfd *, PTR, PTR)); + (bfd *, void *, void *); unsigned int (*_bfd_coff_swap_aouthdr_out) - PARAMS ((bfd *, PTR, PTR)); + (bfd *, void *, void *); unsigned int (*_bfd_coff_swap_scnhdr_out) - PARAMS ((bfd *, PTR, PTR)); + (bfd *, void *, void *); unsigned int _bfd_filhsz; unsigned int _bfd_aoutsz; @@ -332,86 +332,86 @@ typedef struct unsigned int _bfd_coff_debug_string_prefix_length; void (*_bfd_coff_swap_filehdr_in) - PARAMS ((bfd *, PTR, PTR)); + (bfd *, void *, void *); void (*_bfd_coff_swap_aouthdr_in) - PARAMS ((bfd *, PTR, PTR)); + (bfd *, void *, void *); void (*_bfd_coff_swap_scnhdr_in) - PARAMS ((bfd *, PTR, PTR)); + (bfd *, void *, void *); void (*_bfd_coff_swap_reloc_in) - PARAMS ((bfd *abfd, PTR, PTR)); + (bfd *abfd, void *, void *); bfd_boolean (*_bfd_coff_bad_format_hook) - PARAMS ((bfd *, PTR)); + (bfd *, void *); bfd_boolean (*_bfd_coff_set_arch_mach_hook) - PARAMS ((bfd *, PTR)); + (bfd *, void *); - PTR (*_bfd_coff_mkobject_hook) - PARAMS ((bfd *, PTR, PTR)); + void * (*_bfd_coff_mkobject_hook) + (bfd *, void *, void *); bfd_boolean (*_bfd_styp_to_sec_flags_hook) - PARAMS ((bfd *, PTR, const char *, asection *, flagword *)); + (bfd *, void *, const char *, asection *, flagword *); void (*_bfd_set_alignment_hook) - PARAMS ((bfd *, asection *, PTR)); + (bfd *, asection *, void *); bfd_boolean (*_bfd_coff_slurp_symbol_table) - PARAMS ((bfd *)); + (bfd *); bfd_boolean (*_bfd_coff_symname_in_debug) - PARAMS ((bfd *, struct internal_syment *)); + (bfd *, struct internal_syment *); bfd_boolean (*_bfd_coff_pointerize_aux_hook) - PARAMS ((bfd *, combined_entry_type *, combined_entry_type *, - unsigned int, combined_entry_type *)); + (bfd *, combined_entry_type *, combined_entry_type *, + unsigned int, combined_entry_type *); bfd_boolean (*_bfd_coff_print_aux) - PARAMS ((bfd *, FILE *, combined_entry_type *, combined_entry_type *, - combined_entry_type *, unsigned int)); + (bfd *, FILE *, combined_entry_type *, combined_entry_type *, + combined_entry_type *, unsigned int); void (*_bfd_coff_reloc16_extra_cases) - PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *, - bfd_byte *, unsigned int *, unsigned int *)); + (bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *, + bfd_byte *, unsigned int *, unsigned int *); int (*_bfd_coff_reloc16_estimate) - PARAMS ((bfd *, asection *, arelent *, unsigned int, - struct bfd_link_info *)); + (bfd *, asection *, arelent *, unsigned int, + struct bfd_link_info *); enum coff_symbol_classification (*_bfd_coff_classify_symbol) - PARAMS ((bfd *, struct internal_syment *)); + (bfd *, struct internal_syment *); bfd_boolean (*_bfd_coff_compute_section_file_positions) - PARAMS ((bfd *)); + (bfd *); bfd_boolean (*_bfd_coff_start_final_link) - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); bfd_boolean (*_bfd_coff_relocate_section) - PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, - struct internal_reloc *, struct internal_syment *, asection **)); + (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, + struct internal_reloc *, struct internal_syment *, asection **); reloc_howto_type *(*_bfd_coff_rtype_to_howto) - PARAMS ((bfd *, asection *, struct internal_reloc *, + (bfd *, asection *, struct internal_reloc *, struct coff_link_hash_entry *, struct internal_syment *, - bfd_vma *)); + bfd_vma *); bfd_boolean (*_bfd_coff_adjust_symndx) - PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, - struct internal_reloc *, bfd_boolean *)); + (bfd *, struct bfd_link_info *, bfd *, asection *, + struct internal_reloc *, bfd_boolean *); bfd_boolean (*_bfd_coff_link_add_one_symbol) - PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword, + (struct bfd_link_info *, bfd *, const char *, flagword, asection *, bfd_vma, const char *, bfd_boolean, bfd_boolean, - struct bfd_link_hash_entry **)); + struct bfd_link_hash_entry **); bfd_boolean (*_bfd_coff_link_output_has_begun) - PARAMS ((bfd *, struct coff_final_link_info *)); + (bfd *, struct coff_final_link_info *); bfd_boolean (*_bfd_coff_final_link_postscript) - PARAMS ((bfd *, struct coff_final_link_info *)); + (bfd *, struct coff_final_link_info *); @} bfd_coff_backend_data; @@ -541,9 +541,9 @@ typedef struct (info, abfd, name, flags, section, value, string, cp, coll, hashp)) #define bfd_coff_link_output_has_begun(a,p) \ - ((coff_backend_info (a)->_bfd_coff_link_output_has_begun) (a,p)) + ((coff_backend_info (a)->_bfd_coff_link_output_has_begun) (a, p)) #define bfd_coff_final_link_postscript(a,p) \ - ((coff_backend_info (a)->_bfd_coff_final_link_postscript) (a,p)) + ((coff_backend_info (a)->_bfd_coff_final_link_postscript) (a, p)) @end example @subsubsection Writing relocations diff --git a/contrib/binutils/bfd/doc/core.texi b/contrib/binutils/bfd/doc/core.texi index e45759cf647..1f09445ef76 100644 --- a/contrib/binutils/bfd/doc/core.texi +++ b/contrib/binutils/bfd/doc/core.texi @@ -1,6 +1,9 @@ @section Core files +@subsection Core file functions + + @strong{Description}@* These are functions pertaining to core files. @@ -36,3 +39,22 @@ Return @code{TRUE} if the core file attached to @var{core_bfd} was generated by a run of the executable file attached to @var{exec_bfd}, @code{FALSE} otherwise. +@findex generic_core_file_matches_executable_p +@subsubsection @code{generic_core_file_matches_executable_p} +@strong{Synopsis} +@example +bfd_boolean generic_core_file_matches_executable_p + (bfd *core_bfd, bfd *exec_bfd); +@end example +@strong{Description}@* +Return TRUE if the core file attached to @var{core_bfd} +was generated by a run of the executable file attached +to @var{exec_bfd}. The match is based on executable +basenames only. + +Note: When not able to determine the core file failing +command or the executable name, we still return TRUE even +though we're not sure that core file and executable match. +This is to avoid generating a false warning in situations +where we really don't know whether they match or not. + diff --git a/contrib/binutils/bfd/doc/elf.texi b/contrib/binutils/bfd/doc/elf.texi index 101001c7d97..4f9434cf69d 100644 --- a/contrib/binutils/bfd/doc/elf.texi +++ b/contrib/binutils/bfd/doc/elf.texi @@ -1,6 +1,4 @@ -@section -ELF backends - +@section ELF backends BFD support for ELF formats is being worked on. Currently, the best supported back ends are for sparc and i386 (running svr4 or Solaris 2). diff --git a/contrib/binutils/bfd/doc/fdl.texi b/contrib/binutils/bfd/doc/fdl.texi index 176233cb1b0..a83ecf75b59 100644 --- a/contrib/binutils/bfd/doc/fdl.texi +++ b/contrib/binutils/bfd/doc/fdl.texi @@ -3,8 +3,8 @@ @center Version 1.1, March 2000 @display -Copyright (C) 2000, Free Software Foundation, Inc. -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +Copyright (C) 2000, 2003 Free Software Foundation, Inc. +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. diff --git a/contrib/binutils/bfd/doc/format.texi b/contrib/binutils/bfd/doc/format.texi index 32a1d751fcd..9674acff440 100644 --- a/contrib/binutils/bfd/doc/format.texi +++ b/contrib/binutils/bfd/doc/format.texi @@ -23,6 +23,9 @@ The BFD contains other BFDs and an optional index. @end itemize The BFD contains the result of an executable core dump. +@subsection File format functions + + @findex bfd_check_format @subsubsection @code{bfd_check_format} @strong{Synopsis} diff --git a/contrib/binutils/bfd/doc/hash.texi b/contrib/binutils/bfd/doc/hash.texi index 3e7372c88ad..88d9585cc40 100644 --- a/contrib/binutils/bfd/doc/hash.texi +++ b/contrib/binutils/bfd/doc/hash.texi @@ -55,6 +55,10 @@ Use @code{bfd_hash_table_free} to free up all the memory that has been allocated for a hash table. This will not free up the @code{struct bfd_hash_table} itself, which you must provide. +@findex bfd_hash_set_default_size +Use @code{bfd_hash_set_default_size} to set the default size of +hash table to use. + @node Looking Up or Entering a String, Traversing a Hash Table, Creating and Freeing a Hash Table, Hash Tables @subsection Looking up or entering a string @findex bfd_hash_lookup @@ -178,20 +182,18 @@ from. @example struct bfd_hash_entry * -@var{function_name} (entry, table, string) - struct bfd_hash_entry *entry; - struct bfd_hash_table *table; - const char *string; +@var{function_name} (struct bfd_hash_entry *entry, + struct bfd_hash_table *table, + const char *string) @{ struct @var{entry_type} *ret = (@var{entry_type} *) entry; /* Allocate the structure if it has not already been allocated by a derived class. */ - if (ret == (@var{entry_type} *) NULL) + if (ret == NULL) @{ - ret = ((@var{entry_type} *) - bfd_hash_allocate (table, sizeof (@var{entry_type}))); - if (ret == (@var{entry_type} *) NULL) + ret = bfd_hash_allocate (table, sizeof (* ret)); + if (ret == NULL) return NULL; @} diff --git a/contrib/binutils/bfd/doc/init.texi b/contrib/binutils/bfd/doc/init.texi index 0905f6bc4ca..ab735f8e986 100644 --- a/contrib/binutils/bfd/doc/init.texi +++ b/contrib/binutils/bfd/doc/init.texi @@ -1,4 +1,7 @@ @section Initialization + + +@subsection Initialization functions These are the functions that handle initializing a BFD. @findex bfd_init diff --git a/contrib/binutils/bfd/doc/libbfd.texi b/contrib/binutils/bfd/doc/libbfd.texi index 5c9ced01630..fef6e0e842e 100644 --- a/contrib/binutils/bfd/doc/libbfd.texi +++ b/contrib/binutils/bfd/doc/libbfd.texi @@ -1,4 +1,7 @@ -@section Internal functions +@section Implementation details + + +@subsection Internal functions @strong{Description}@* diff --git a/contrib/binutils/bfd/doc/linker.texi b/contrib/binutils/bfd/doc/linker.texi index f2e2bc1cb74..8a55006a187 100644 --- a/contrib/binutils/bfd/doc/linker.texi +++ b/contrib/binutils/bfd/doc/linker.texi @@ -258,7 +258,7 @@ link. These files are linked through the @code{link_next} field of the @code{bfd} structure. Each section in the output file will have a list of -@code{link_order} structures attached to the @code{link_order_head} +@code{link_order} structures attached to the @code{map_head.link_order} field (the @code{link_order} structure is defined in @code{bfdlink.h}). These structures describe how to create the contents of the output section in terms of the contents of @@ -363,3 +363,18 @@ reloceatable or final link. @end example +@findex bfd_section_already_linked +@subsubsection @code{bfd_section_already_linked} +@strong{Synopsis} +@example +void bfd_section_already_linked (bfd *abfd, asection *sec); +@end example +@strong{Description}@* +Check if @var{sec} has been already linked during a reloceatable +or final link. +@example +#define bfd_section_already_linked(abfd, sec) \ + BFD_SEND (abfd, _section_already_linked, (abfd, sec)) + +@end example + diff --git a/contrib/binutils/bfd/doc/mmo.texi b/contrib/binutils/bfd/doc/mmo.texi index c30895287fe..b0d726aad9c 100644 --- a/contrib/binutils/bfd/doc/mmo.texi +++ b/contrib/binutils/bfd/doc/mmo.texi @@ -32,6 +32,12 @@ it is used for code (and constants) and the area @samp{0x2000@dots{}00} to @samp{0x20ff@dots{}ff} is used for writable data. @xref{mmo section mapping}. +There is provision for specifying ``special data'' of 65536 +different types. We use type 80 (decimal), arbitrarily chosen the +same as the ELF @code{e_machine} number for MMIX, filling it with +section information normally found in ELF objects. @xref{mmo +section mapping}. + Contents is entered as 32-bit words, xor:ed over previous contents, always zero-initialized. A word that starts with the byte @samp{0x98} forms a command called a @samp{lopcode}, where @@ -42,12 +48,6 @@ various purposes different for each lopcode. As documented in @url{http://www-cs-faculty.stanford.edu/~knuth/mmixal-intro.ps.gz}, the lopcodes are: -There is provision for specifying ``special data'' of 65536 -different types. We use type 80 (decimal), arbitrarily chosen the -same as the ELF @code{e_machine} number for MMIX, filling it with -section information normally found in ELF objects. @xref{mmo -section mapping}. - @table @code @item lop_quote 0x98000001. The next word is contents, regardless of whether it diff --git a/contrib/binutils/bfd/doc/opncls.texi b/contrib/binutils/bfd/doc/opncls.texi index 8cd2ab9048b..6b47adfbb45 100644 --- a/contrib/binutils/bfd/doc/opncls.texi +++ b/contrib/binutils/bfd/doc/opncls.texi @@ -1,6 +1,32 @@ @section Opening and closing BFDs +@subsection Functions for opening and closing + + +@findex bfd_fopen +@subsubsection @code{bfd_fopen} +@strong{Synopsis} +@example +bfd *bfd_fopen (const char *filename, const char *target, + const char *mode, int fd); +@end example +@strong{Description}@* +Open the file @var{filename} with the target @var{target}. +Return a pointer to the created BFD. If @var{fd} is not -1, +then @code{fdopen} is used to open the file; otherwise, @code{fopen} +is used. @var{mode} is passed directly to @code{fopen} or +@code{fdopen}. + +Calls @code{bfd_find_target}, so @var{target} is interpreted as by +that function. + +The new BFD is marked as cacheable iff @var{fd} is -1. + +If @code{NULL} is returned then an error has occured. Possible errors +are @code{bfd_error_no_memory}, @code{bfd_error_invalid_target} or +@code{system_call} error. + @findex bfd_openr @subsubsection @code{bfd_openr} @strong{Synopsis} @@ -52,6 +78,50 @@ bfd *bfd_openstreamr (const char *, const char *, void *); Open a BFD for read access on an existing stdio stream. When the BFD is passed to @code{bfd_close}, the stream will be closed. +@findex bfd_openr_iovec +@subsubsection @code{bfd_openr_iovec} +@strong{Synopsis} +@example +bfd *bfd_openr_iovec (const char *filename, const char *target, + void *(*open) (struct bfd *nbfd, + void *open_closure), + void *open_closure, + file_ptr (*pread) (struct bfd *nbfd, + void *stream, + void *buf, + file_ptr nbytes, + file_ptr offset), + int (*close) (struct bfd *nbfd, + void *stream)); +@end example +@strong{Description}@* +Create and return a BFD backed by a read-only @var{stream}. +The @var{stream} is created using @var{open}, accessed using +@var{pread} and destroyed using @var{close}. + +Calls @code{bfd_find_target}, so @var{target} is interpreted as by +that function. + +Calls @var{open} (which can call @code{bfd_zalloc} and +@code{bfd_get_filename}) to obtain the read-only stream backing +the BFD. @var{open} either succeeds returning the +non-@code{NULL} @var{stream}, or fails returning @code{NULL} +(setting @code{bfd_error}). + +Calls @var{pread} to request @var{nbytes} of data from +@var{stream} starting at @var{offset} (e.g., via a call to +@code{bfd_read}). @var{pread} either succeeds returning the +number of bytes read (which can be less than @var{nbytes} when +end-of-file), or fails returning -1 (setting @code{bfd_error}). + +Calls @var{close} when the BFD is later closed using +@code{bfd_close}. @var{close} either succeeds returning 0, or +fails returning -1 (setting @code{bfd_error}). + +If @code{bfd_openr_iovec} returns @code{NULL} then an error has +occurred. Possible errors are @code{bfd_error_no_memory}, +@code{bfd_error_invalid_target} and @code{bfd_error_system_call}. + @findex bfd_openw @subsubsection @code{bfd_openw} @strong{Synopsis} @@ -151,12 +221,42 @@ direction. @subsubsection @code{bfd_alloc} @strong{Synopsis} @example -void *bfd_alloc (bfd *abfd, size_t wanted); +void *bfd_alloc (bfd *abfd, bfd_size_type wanted); @end example @strong{Description}@* Allocate a block of @var{wanted} bytes of memory attached to @code{abfd} and return a pointer to it. +@findex bfd_alloc2 +@subsubsection @code{bfd_alloc2} +@strong{Synopsis} +@example +void *bfd_alloc2 (bfd *abfd, bfd_size_type nmemb, bfd_size_type size); +@end example +@strong{Description}@* +Allocate a block of @var{nmemb} elements of @var{size} bytes each +of memory attached to @code{abfd} and return a pointer to it. + +@findex bfd_zalloc +@subsubsection @code{bfd_zalloc} +@strong{Synopsis} +@example +void *bfd_zalloc (bfd *abfd, bfd_size_type wanted); +@end example +@strong{Description}@* +Allocate a block of @var{wanted} bytes of zeroed memory +attached to @code{abfd} and return a pointer to it. + +@findex bfd_zalloc2 +@subsubsection @code{bfd_zalloc2} +@strong{Synopsis} +@example +void *bfd_zalloc2 (bfd *abfd, bfd_size_type nmemb, bfd_size_type size); +@end example +@strong{Description}@* +Allocate a block of @var{nmemb} elements of @var{size} bytes each +of zeroed memory attached to @code{abfd} and return a pointer to it. + @findex bfd_calc_gnu_debuglink_crc32 @subsubsection @code{bfd_calc_gnu_debuglink_crc32} @strong{Synopsis} diff --git a/contrib/binutils/bfd/doc/reloc.texi b/contrib/binutils/bfd/doc/reloc.texi index 9253a33f032..0540be86255 100644 --- a/contrib/binutils/bfd/doc/reloc.texi +++ b/contrib/binutils/bfd/doc/reloc.texi @@ -236,11 +236,12 @@ enum complain_overflow /* Do not complain on overflow. */ complain_overflow_dont, - /* Complain if the bitfield overflows, whether it is considered - as signed or unsigned. */ + /* Complain if the value overflows when considered as a signed + number one bit larger than the field. ie. A bitfield of N bits + is allowed to represent -2**n to 2**n-1. */ complain_overflow_bitfield, - /* Complain if the value overflows when considered as signed + /* Complain if the value overflows when considered as a signed number. */ complain_overflow_signed, @@ -486,7 +487,7 @@ assembler. @node howto manager, , typedef arelent, Relocations -@section The howto manager +@subsection The howto manager When an application wants to create a relocation, but doesn't know what the target machine might call it, it can find out by using this bit of code. @@ -526,6 +527,9 @@ the section containing the relocation. It depends on the specific target. The 24-bit relocation is used in some Intel 960 configurations. @end deffn +@deffn {} BFD_RELOC_32_SECREL +Section relative relocations. Some targets need this for DWARF2. +@end deffn @deffn {} BFD_RELOC_32_GOT_PCREL @deffnx {} BFD_RELOC_16_GOT_PCREL @deffnx {} BFD_RELOC_8_GOT_PCREL @@ -776,11 +780,26 @@ to compensate for the borrow when the low bits are added. @deffn {} BFD_RELOC_LO16 Low 16 bits. @end deffn -@deffn {} BFD_RELOC_PCREL_HI16_S -Like BFD_RELOC_HI16_S, but PC relative. +@deffn {} BFD_RELOC_HI16_PCREL +High 16 bits of 32-bit pc-relative value @end deffn -@deffn {} BFD_RELOC_PCREL_LO16 -Like BFD_RELOC_LO16, but PC relative. +@deffn {} BFD_RELOC_HI16_S_PCREL +High 16 bits of 32-bit pc-relative value, adjusted +@end deffn +@deffn {} BFD_RELOC_LO16_PCREL +Low 16 bits of pc-relative value +@end deffn +@deffn {} BFD_RELOC_MIPS16_HI16 +MIPS16 high 16 bits of 32-bit value. +@end deffn +@deffn {} BFD_RELOC_MIPS16_HI16_S +MIPS16 high 16 bits of 32-bit value but the low 16 bits will be sign +extended and added to form the final result. If the low 16 +bits form a negative number, we need to add one to the high value +to compensate for the borrow when the low bits are added. +@end deffn +@deffn {} BFD_RELOC_MIPS16_LO16 +MIPS16 low 16 bits. @end deffn @deffn {} BFD_RELOC_MIPS_LITERAL Relocation against a MIPS literal section. @@ -806,8 +825,25 @@ Relocation against a MIPS literal section. @deffnx {} BFD_RELOC_MIPS_REL16 @deffnx {} BFD_RELOC_MIPS_RELGOT @deffnx {} BFD_RELOC_MIPS_JALR +@deffnx {} BFD_RELOC_MIPS_TLS_DTPMOD32 +@deffnx {} BFD_RELOC_MIPS_TLS_DTPREL32 +@deffnx {} BFD_RELOC_MIPS_TLS_DTPMOD64 +@deffnx {} BFD_RELOC_MIPS_TLS_DTPREL64 +@deffnx {} BFD_RELOC_MIPS_TLS_GD +@deffnx {} BFD_RELOC_MIPS_TLS_LDM +@deffnx {} BFD_RELOC_MIPS_TLS_DTPREL_HI16 +@deffnx {} BFD_RELOC_MIPS_TLS_DTPREL_LO16 +@deffnx {} BFD_RELOC_MIPS_TLS_GOTTPREL +@deffnx {} BFD_RELOC_MIPS_TLS_TPREL32 +@deffnx {} BFD_RELOC_MIPS_TLS_TPREL64 +@deffnx {} BFD_RELOC_MIPS_TLS_TPREL_HI16 +@deffnx {} BFD_RELOC_MIPS_TLS_TPREL_LO16 MIPS ELF relocations. @end deffn +@deffn {} BFD_RELOC_MIPS_COPY +@deffnx {} BFD_RELOC_MIPS_JUMP_SLOT +MIPS ELF relocations (VxWorks extensions). +@end deffn @deffn {} BFD_RELOC_FRV_LABEL16 @deffnx {} BFD_RELOC_FRV_LABEL24 @deffnx {} BFD_RELOC_FRV_LO16 @@ -831,6 +867,22 @@ MIPS ELF relocations. @deffnx {} BFD_RELOC_FRV_GOTOFF12 @deffnx {} BFD_RELOC_FRV_GOTOFFHI @deffnx {} BFD_RELOC_FRV_GOTOFFLO +@deffnx {} BFD_RELOC_FRV_GETTLSOFF +@deffnx {} BFD_RELOC_FRV_TLSDESC_VALUE +@deffnx {} BFD_RELOC_FRV_GOTTLSDESC12 +@deffnx {} BFD_RELOC_FRV_GOTTLSDESCHI +@deffnx {} BFD_RELOC_FRV_GOTTLSDESCLO +@deffnx {} BFD_RELOC_FRV_TLSMOFF12 +@deffnx {} BFD_RELOC_FRV_TLSMOFFHI +@deffnx {} BFD_RELOC_FRV_TLSMOFFLO +@deffnx {} BFD_RELOC_FRV_GOTTLSOFF12 +@deffnx {} BFD_RELOC_FRV_GOTTLSOFFHI +@deffnx {} BFD_RELOC_FRV_GOTTLSOFFLO +@deffnx {} BFD_RELOC_FRV_TLSOFF +@deffnx {} BFD_RELOC_FRV_TLSDESC_RELAX +@deffnx {} BFD_RELOC_FRV_GETTLSOFF_RELAX +@deffnx {} BFD_RELOC_FRV_TLSOFF_RELAX +@deffnx {} BFD_RELOC_FRV_TLSMOFF Fujitsu Frv Relocations. @end deffn @deffn {} BFD_RELOC_MN10300_GOTOFF24 @@ -880,6 +932,9 @@ Adjust by program base. @deffnx {} BFD_RELOC_386_TLS_DTPMOD32 @deffnx {} BFD_RELOC_386_TLS_DTPOFF32 @deffnx {} BFD_RELOC_386_TLS_TPOFF32 +@deffnx {} BFD_RELOC_386_TLS_GOTDESC +@deffnx {} BFD_RELOC_386_TLS_DESC_CALL +@deffnx {} BFD_RELOC_386_TLS_DESC i386/elf relocations @end deffn @deffn {} BFD_RELOC_X86_64_GOT32 @@ -898,6 +953,16 @@ i386/elf relocations @deffnx {} BFD_RELOC_X86_64_DTPOFF32 @deffnx {} BFD_RELOC_X86_64_GOTTPOFF @deffnx {} BFD_RELOC_X86_64_TPOFF32 +@deffnx {} BFD_RELOC_X86_64_GOTOFF64 +@deffnx {} BFD_RELOC_X86_64_GOTPC32 +@deffnx {} BFD_RELOC_X86_64_GOT64 +@deffnx {} BFD_RELOC_X86_64_GOTPCREL64 +@deffnx {} BFD_RELOC_X86_64_GOTPC64 +@deffnx {} BFD_RELOC_X86_64_GOTPLT64 +@deffnx {} BFD_RELOC_X86_64_PLTOFF64 +@deffnx {} BFD_RELOC_X86_64_GOTPC32_TLSDESC +@deffnx {} BFD_RELOC_X86_64_TLSDESC_CALL +@deffnx {} BFD_RELOC_X86_64_TLSDESC x86-64/elf relocations @end deffn @deffn {} BFD_RELOC_NS32K_IMM_8 @@ -1045,38 +1110,104 @@ Thumb 22 bit pc-relative branch. The lowest bit must be zero and is not stored in the instruction. The 2nd lowest bit comes from a 1 bit field in the instruction. @end deffn +@deffn {} BFD_RELOC_ARM_PCREL_CALL +ARM 26-bit pc-relative branch for an unconditional BL or BLX instruction. +@end deffn +@deffn {} BFD_RELOC_ARM_PCREL_JUMP +ARM 26-bit pc-relative branch for B or conditional BL instruction. +@end deffn +@deffn {} BFD_RELOC_THUMB_PCREL_BRANCH7 +@deffnx {} BFD_RELOC_THUMB_PCREL_BRANCH9 +@deffnx {} BFD_RELOC_THUMB_PCREL_BRANCH12 +@deffnx {} BFD_RELOC_THUMB_PCREL_BRANCH20 +@deffnx {} BFD_RELOC_THUMB_PCREL_BRANCH23 +@deffnx {} BFD_RELOC_THUMB_PCREL_BRANCH25 +Thumb 7-, 9-, 12-, 20-, 23-, and 25-bit pc-relative branches. +The lowest bit must be zero and is not stored in the instruction. +Note that the corresponding ELF R_ARM_THM_JUMPnn constant has an +"nn" one smaller in all cases. Note further that BRANCH23 +corresponds to R_ARM_THM_CALL. +@end deffn +@deffn {} BFD_RELOC_ARM_OFFSET_IMM +12-bit immediate offset, used in ARM-format ldr and str instructions. +@end deffn +@deffn {} BFD_RELOC_ARM_THUMB_OFFSET +5-bit immediate offset, used in Thumb-format ldr and str instructions. +@end deffn +@deffn {} BFD_RELOC_ARM_TARGET1 +Pc-relative or absolute relocation depending on target. Used for +entries in .init_array sections. +@end deffn +@deffn {} BFD_RELOC_ARM_ROSEGREL32 +Read-only segment base relative address. +@end deffn +@deffn {} BFD_RELOC_ARM_SBREL32 +Data segment base relative address. +@end deffn +@deffn {} BFD_RELOC_ARM_TARGET2 +This reloc is used for references to RTTI data from exception handling +tables. The actual definition depends on the target. It may be a +pc-relative or some form of GOT-indirect relocation. +@end deffn +@deffn {} BFD_RELOC_ARM_PREL31 +31-bit PC relative address. +@end deffn +@deffn {} BFD_RELOC_ARM_JUMP_SLOT +@deffnx {} BFD_RELOC_ARM_GLOB_DAT +@deffnx {} BFD_RELOC_ARM_GOT32 +@deffnx {} BFD_RELOC_ARM_PLT32 +@deffnx {} BFD_RELOC_ARM_RELATIVE +@deffnx {} BFD_RELOC_ARM_GOTOFF +@deffnx {} BFD_RELOC_ARM_GOTPC +Relocations for setting up GOTs and PLTs for shared libraries. +@end deffn +@deffn {} BFD_RELOC_ARM_TLS_GD32 +@deffnx {} BFD_RELOC_ARM_TLS_LDO32 +@deffnx {} BFD_RELOC_ARM_TLS_LDM32 +@deffnx {} BFD_RELOC_ARM_TLS_DTPOFF32 +@deffnx {} BFD_RELOC_ARM_TLS_DTPMOD32 +@deffnx {} BFD_RELOC_ARM_TLS_TPOFF32 +@deffnx {} BFD_RELOC_ARM_TLS_IE32 +@deffnx {} BFD_RELOC_ARM_TLS_LE32 +ARM thread-local storage relocations. +@end deffn @deffn {} BFD_RELOC_ARM_IMMEDIATE @deffnx {} BFD_RELOC_ARM_ADRL_IMMEDIATE -@deffnx {} BFD_RELOC_ARM_OFFSET_IMM +@deffnx {} BFD_RELOC_ARM_T32_IMMEDIATE +@deffnx {} BFD_RELOC_ARM_T32_IMM12 +@deffnx {} BFD_RELOC_ARM_T32_ADD_PC12 @deffnx {} BFD_RELOC_ARM_SHIFT_IMM +@deffnx {} BFD_RELOC_ARM_SMC @deffnx {} BFD_RELOC_ARM_SWI @deffnx {} BFD_RELOC_ARM_MULTI @deffnx {} BFD_RELOC_ARM_CP_OFF_IMM @deffnx {} BFD_RELOC_ARM_CP_OFF_IMM_S2 +@deffnx {} BFD_RELOC_ARM_T32_CP_OFF_IMM +@deffnx {} BFD_RELOC_ARM_T32_CP_OFF_IMM_S2 @deffnx {} BFD_RELOC_ARM_ADR_IMM @deffnx {} BFD_RELOC_ARM_LDR_IMM @deffnx {} BFD_RELOC_ARM_LITERAL @deffnx {} BFD_RELOC_ARM_IN_POOL @deffnx {} BFD_RELOC_ARM_OFFSET_IMM8 +@deffnx {} BFD_RELOC_ARM_T32_OFFSET_U8 +@deffnx {} BFD_RELOC_ARM_T32_OFFSET_IMM @deffnx {} BFD_RELOC_ARM_HWLITERAL @deffnx {} BFD_RELOC_ARM_THUMB_ADD @deffnx {} BFD_RELOC_ARM_THUMB_IMM @deffnx {} BFD_RELOC_ARM_THUMB_SHIFT -@deffnx {} BFD_RELOC_ARM_THUMB_OFFSET -@deffnx {} BFD_RELOC_ARM_GOT12 -@deffnx {} BFD_RELOC_ARM_GOT32 -@deffnx {} BFD_RELOC_ARM_JUMP_SLOT -@deffnx {} BFD_RELOC_ARM_COPY -@deffnx {} BFD_RELOC_ARM_GLOB_DAT -@deffnx {} BFD_RELOC_ARM_PLT32 -@deffnx {} BFD_RELOC_ARM_RELATIVE -@deffnx {} BFD_RELOC_ARM_GOTOFF -@deffnx {} BFD_RELOC_ARM_GOTPC These relocs are only used within the ARM assembler. They are not (at present) written to any object files. @end deffn @deffn {} BFD_RELOC_SH_PCDISP8BY2 @deffnx {} BFD_RELOC_SH_PCDISP12BY2 +@deffnx {} BFD_RELOC_SH_IMM3 +@deffnx {} BFD_RELOC_SH_IMM3U +@deffnx {} BFD_RELOC_SH_DISP12 +@deffnx {} BFD_RELOC_SH_DISP12BY2 +@deffnx {} BFD_RELOC_SH_DISP12BY4 +@deffnx {} BFD_RELOC_SH_DISP12BY8 +@deffnx {} BFD_RELOC_SH_DISP20 +@deffnx {} BFD_RELOC_SH_DISP20BY8 @deffnx {} BFD_RELOC_SH_IMM4 @deffnx {} BFD_RELOC_SH_IMM4BY2 @deffnx {} BFD_RELOC_SH_IMM4BY4 @@ -1159,12 +1290,6 @@ These relocs are only used within the ARM assembler. They are not @deffnx {} BFD_RELOC_SH_TLS_TPOFF32 Renesas / SuperH SH relocs. Not all of these appear in object files. @end deffn -@deffn {} BFD_RELOC_THUMB_PCREL_BRANCH9 -@deffnx {} BFD_RELOC_THUMB_PCREL_BRANCH12 -@deffnx {} BFD_RELOC_THUMB_PCREL_BRANCH23 -Thumb 23-, 12- and 9-bit pc-relative branches. The lowest bit must -be zero and is not stored in the instruction. -@end deffn @deffn {} BFD_RELOC_ARC_B22_PCREL ARC Cores relocs. ARC 22 bit pc-relative branch. The lowest two bits must be zero and are @@ -1176,6 +1301,121 @@ ARC 26 bit absolute branch. The lowest two bits must be zero and are not stored in the instruction. The high 24 bits are installed in bits 23 through 0. @end deffn +@deffn {} BFD_RELOC_BFIN_16_IMM +ADI Blackfin 16 bit immediate absolute reloc. +@end deffn +@deffn {} BFD_RELOC_BFIN_16_HIGH +ADI Blackfin 16 bit immediate absolute reloc higher 16 bits. +@end deffn +@deffn {} BFD_RELOC_BFIN_4_PCREL +ADI Blackfin 'a' part of LSETUP. +@end deffn +@deffn {} BFD_RELOC_BFIN_5_PCREL +ADI Blackfin. +@end deffn +@deffn {} BFD_RELOC_BFIN_16_LOW +ADI Blackfin 16 bit immediate absolute reloc lower 16 bits. +@end deffn +@deffn {} BFD_RELOC_BFIN_10_PCREL +ADI Blackfin. +@end deffn +@deffn {} BFD_RELOC_BFIN_11_PCREL +ADI Blackfin 'b' part of LSETUP. +@end deffn +@deffn {} BFD_RELOC_BFIN_12_PCREL_JUMP +ADI Blackfin. +@end deffn +@deffn {} BFD_RELOC_BFIN_12_PCREL_JUMP_S +ADI Blackfin Short jump, pcrel. +@end deffn +@deffn {} BFD_RELOC_BFIN_24_PCREL_CALL_X +ADI Blackfin Call.x not implemented. +@end deffn +@deffn {} BFD_RELOC_BFIN_24_PCREL_JUMP_L +ADI Blackfin Long Jump pcrel. +@end deffn +@deffn {} BFD_RELOC_BFIN_GOT17M4 +@deffnx {} BFD_RELOC_BFIN_GOTHI +@deffnx {} BFD_RELOC_BFIN_GOTLO +@deffnx {} BFD_RELOC_BFIN_FUNCDESC +@deffnx {} BFD_RELOC_BFIN_FUNCDESC_GOT17M4 +@deffnx {} BFD_RELOC_BFIN_FUNCDESC_GOTHI +@deffnx {} BFD_RELOC_BFIN_FUNCDESC_GOTLO +@deffnx {} BFD_RELOC_BFIN_FUNCDESC_VALUE +@deffnx {} BFD_RELOC_BFIN_FUNCDESC_GOTOFF17M4 +@deffnx {} BFD_RELOC_BFIN_FUNCDESC_GOTOFFHI +@deffnx {} BFD_RELOC_BFIN_FUNCDESC_GOTOFFLO +@deffnx {} BFD_RELOC_BFIN_GOTOFF17M4 +@deffnx {} BFD_RELOC_BFIN_GOTOFFHI +@deffnx {} BFD_RELOC_BFIN_GOTOFFLO +ADI Blackfin FD-PIC relocations. +@end deffn +@deffn {} BFD_RELOC_BFIN_GOT +ADI Blackfin GOT relocation. +@end deffn +@deffn {} BFD_RELOC_BFIN_PLTPC +ADI Blackfin PLTPC relocation. +@end deffn +@deffn {} BFD_ARELOC_BFIN_PUSH +ADI Blackfin arithmetic relocation. +@end deffn +@deffn {} BFD_ARELOC_BFIN_CONST +ADI Blackfin arithmetic relocation. +@end deffn +@deffn {} BFD_ARELOC_BFIN_ADD +ADI Blackfin arithmetic relocation. +@end deffn +@deffn {} BFD_ARELOC_BFIN_SUB +ADI Blackfin arithmetic relocation. +@end deffn +@deffn {} BFD_ARELOC_BFIN_MULT +ADI Blackfin arithmetic relocation. +@end deffn +@deffn {} BFD_ARELOC_BFIN_DIV +ADI Blackfin arithmetic relocation. +@end deffn +@deffn {} BFD_ARELOC_BFIN_MOD +ADI Blackfin arithmetic relocation. +@end deffn +@deffn {} BFD_ARELOC_BFIN_LSHIFT +ADI Blackfin arithmetic relocation. +@end deffn +@deffn {} BFD_ARELOC_BFIN_RSHIFT +ADI Blackfin arithmetic relocation. +@end deffn +@deffn {} BFD_ARELOC_BFIN_AND +ADI Blackfin arithmetic relocation. +@end deffn +@deffn {} BFD_ARELOC_BFIN_OR +ADI Blackfin arithmetic relocation. +@end deffn +@deffn {} BFD_ARELOC_BFIN_XOR +ADI Blackfin arithmetic relocation. +@end deffn +@deffn {} BFD_ARELOC_BFIN_LAND +ADI Blackfin arithmetic relocation. +@end deffn +@deffn {} BFD_ARELOC_BFIN_LOR +ADI Blackfin arithmetic relocation. +@end deffn +@deffn {} BFD_ARELOC_BFIN_LEN +ADI Blackfin arithmetic relocation. +@end deffn +@deffn {} BFD_ARELOC_BFIN_NEG +ADI Blackfin arithmetic relocation. +@end deffn +@deffn {} BFD_ARELOC_BFIN_COMP +ADI Blackfin arithmetic relocation. +@end deffn +@deffn {} BFD_ARELOC_BFIN_PAGE +ADI Blackfin arithmetic relocation. +@end deffn +@deffn {} BFD_ARELOC_BFIN_HWPAGE +ADI Blackfin arithmetic relocation. +@end deffn +@deffn {} BFD_ARELOC_BFIN_ADDR +ADI Blackfin arithmetic relocation. +@end deffn @deffn {} BFD_RELOC_D10V_10_PCREL_R Mitsubishi D10V relocs. This is a 10-bit reloc with the right 2 bits @@ -1253,6 +1493,12 @@ DLX relocs @deffn {} BFD_RELOC_DLX_JMP26 DLX relocs @end deffn +@deffn {} BFD_RELOC_M32C_HI8 +@deffnx {} BFD_RELOC_M32C_RL_JUMP +@deffnx {} BFD_RELOC_M32C_RL_1ADDR +@deffnx {} BFD_RELOC_M32C_RL_2ADDR +Renesas M16C/M32C Relocations. +@end deffn @deffn {} BFD_RELOC_M32R_24 Renesas M32R (formerly Mitsubishi M32R) relocs. This is a 24 bit absolute address. @@ -1288,6 +1534,9 @@ add3, load, and store instructions. @deffnx {} BFD_RELOC_M32R_JMP_SLOT @deffnx {} BFD_RELOC_M32R_RELATIVE @deffnx {} BFD_RELOC_M32R_GOTOFF +@deffnx {} BFD_RELOC_M32R_GOTOFF_HI_ULO +@deffnx {} BFD_RELOC_M32R_GOTOFF_HI_SLO +@deffnx {} BFD_RELOC_M32R_GOTOFF_LO @deffnx {} BFD_RELOC_M32R_GOTPC24 @deffnx {} BFD_RELOC_M32R_GOT16_HI_ULO @deffnx {} BFD_RELOC_M32R_GOT16_HI_SLO @@ -1361,6 +1610,10 @@ Used for relaxing indirect jumps. @deffn {} BFD_RELOC_V850_ALIGN Used to maintain alignment whilst relaxing. @end deffn +@deffn {} BFD_RELOC_V850_LO16_SPLIT_OFFSET +This is a variation of BFD_RELOC_LO16 that can be used in v850e ld.bu +instructions. +@end deffn @deffn {} BFD_RELOC_MN10300_32_PCREL This is a 32bit pcrel reloc for the mn10300, offset by two bytes in the instruction. @@ -1509,6 +1762,10 @@ of data memory address) into 8 bit immediate value of LDI insn. This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit of program memory address) into 8 bit immediate value of LDI insn. @end deffn +@deffn {} BFD_RELOC_AVR_MS8_LDI +This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit +of 32 bit value) into 8 bit immediate value of LDI insn. +@end deffn @deffn {} BFD_RELOC_AVR_LO8_LDI_NEG This is a 16 bit reloc for the AVR that stores negated 8 bit value (usually data memory address) into 8 bit immediate value of SUBI insn. @@ -1523,6 +1780,10 @@ This is a 16 bit reloc for the AVR that stores negated 8 bit value (most high 8 bit of program memory address) into 8 bit immediate value of LDI or SUBI insn. @end deffn +@deffn {} BFD_RELOC_AVR_MS8_LDI_NEG +This is a 16 bit reloc for the AVR that stores negated 8 bit value (msb +of 32 bit value) into 8 bit immediate value of LDI insn. +@end deffn @deffn {} BFD_RELOC_AVR_LO8_LDI_PM This is a 16 bit reloc for the AVR that stores 8 bit value (usually command address) into 8 bit immediate value of LDI insn. @@ -1553,6 +1814,18 @@ value of SUBI insn. This is a 32 bit reloc for the AVR that stores 23 bit value into 22 bits. @end deffn +@deffn {} BFD_RELOC_AVR_LDI +This is a 16 bit reloc for the AVR that stores all needed bits +for absolute addressing with ldi with overflow check to linktime +@end deffn +@deffn {} BFD_RELOC_AVR_6 +This is a 6 bit reloc for the AVR that stores offset for ldd/std +instructions +@end deffn +@deffn {} BFD_RELOC_AVR_6_ADIW +This is a 6 bit reloc for the AVR that stores offset for adiw/sbiw +instructions +@end deffn @deffn {} BFD_RELOC_390_12 Direct 12 bit. @end deffn @@ -1841,10 +2114,79 @@ to follow the 16K memory bank of 68HC12 (seen as mapped in the window). Motorola 68HC12 reloc. This is the 5 bits of a value. @end deffn +@deffn {} BFD_RELOC_16C_NUM08 +@deffnx {} BFD_RELOC_16C_NUM08_C +@deffnx {} BFD_RELOC_16C_NUM16 +@deffnx {} BFD_RELOC_16C_NUM16_C +@deffnx {} BFD_RELOC_16C_NUM32 +@deffnx {} BFD_RELOC_16C_NUM32_C +@deffnx {} BFD_RELOC_16C_DISP04 +@deffnx {} BFD_RELOC_16C_DISP04_C +@deffnx {} BFD_RELOC_16C_DISP08 +@deffnx {} BFD_RELOC_16C_DISP08_C +@deffnx {} BFD_RELOC_16C_DISP16 +@deffnx {} BFD_RELOC_16C_DISP16_C +@deffnx {} BFD_RELOC_16C_DISP24 +@deffnx {} BFD_RELOC_16C_DISP24_C +@deffnx {} BFD_RELOC_16C_DISP24a +@deffnx {} BFD_RELOC_16C_DISP24a_C +@deffnx {} BFD_RELOC_16C_REG04 +@deffnx {} BFD_RELOC_16C_REG04_C +@deffnx {} BFD_RELOC_16C_REG04a +@deffnx {} BFD_RELOC_16C_REG04a_C +@deffnx {} BFD_RELOC_16C_REG14 +@deffnx {} BFD_RELOC_16C_REG14_C +@deffnx {} BFD_RELOC_16C_REG16 +@deffnx {} BFD_RELOC_16C_REG16_C +@deffnx {} BFD_RELOC_16C_REG20 +@deffnx {} BFD_RELOC_16C_REG20_C +@deffnx {} BFD_RELOC_16C_ABS20 +@deffnx {} BFD_RELOC_16C_ABS20_C +@deffnx {} BFD_RELOC_16C_ABS24 +@deffnx {} BFD_RELOC_16C_ABS24_C +@deffnx {} BFD_RELOC_16C_IMM04 +@deffnx {} BFD_RELOC_16C_IMM04_C +@deffnx {} BFD_RELOC_16C_IMM16 +@deffnx {} BFD_RELOC_16C_IMM16_C +@deffnx {} BFD_RELOC_16C_IMM20 +@deffnx {} BFD_RELOC_16C_IMM20_C +@deffnx {} BFD_RELOC_16C_IMM24 +@deffnx {} BFD_RELOC_16C_IMM24_C +@deffnx {} BFD_RELOC_16C_IMM32 +@deffnx {} BFD_RELOC_16C_IMM32_C +NS CR16C Relocations. +@end deffn +@deffn {} BFD_RELOC_CRX_REL4 +@deffnx {} BFD_RELOC_CRX_REL8 +@deffnx {} BFD_RELOC_CRX_REL8_CMP +@deffnx {} BFD_RELOC_CRX_REL16 +@deffnx {} BFD_RELOC_CRX_REL24 +@deffnx {} BFD_RELOC_CRX_REL32 +@deffnx {} BFD_RELOC_CRX_REGREL12 +@deffnx {} BFD_RELOC_CRX_REGREL22 +@deffnx {} BFD_RELOC_CRX_REGREL28 +@deffnx {} BFD_RELOC_CRX_REGREL32 +@deffnx {} BFD_RELOC_CRX_ABS16 +@deffnx {} BFD_RELOC_CRX_ABS32 +@deffnx {} BFD_RELOC_CRX_NUM8 +@deffnx {} BFD_RELOC_CRX_NUM16 +@deffnx {} BFD_RELOC_CRX_NUM32 +@deffnx {} BFD_RELOC_CRX_IMM16 +@deffnx {} BFD_RELOC_CRX_IMM32 +@deffnx {} BFD_RELOC_CRX_SWITCH8 +@deffnx {} BFD_RELOC_CRX_SWITCH16 +@deffnx {} BFD_RELOC_CRX_SWITCH32 +NS CRX Relocations. +@end deffn @deffn {} BFD_RELOC_CRIS_BDISP8 @deffnx {} BFD_RELOC_CRIS_UNSIGNED_5 @deffnx {} BFD_RELOC_CRIS_SIGNED_6 @deffnx {} BFD_RELOC_CRIS_UNSIGNED_6 +@deffnx {} BFD_RELOC_CRIS_SIGNED_8 +@deffnx {} BFD_RELOC_CRIS_UNSIGNED_8 +@deffnx {} BFD_RELOC_CRIS_SIGNED_16 +@deffnx {} BFD_RELOC_CRIS_UNSIGNED_16 +@deffnx {} BFD_RELOC_CRIS_LAPCQ_OFFSET @deffnx {} BFD_RELOC_CRIS_UNSIGNED_4 These relocs are only used within the CRIS assembler. They are not (at present) written to any object files. @@ -1927,16 +2269,42 @@ H8 elf Relocations. @deffnx {} BFD_RELOC_XSTORMY16_FPTR16 Sony Xstormy16 Relocations. @end deffn +@deffn {} BFD_RELOC_XC16X_PAG +@deffnx {} BFD_RELOC_XC16X_POF +@deffnx {} BFD_RELOC_XC16X_SEG +@deffnx {} BFD_RELOC_XC16X_SOF +Infineon Relocations. +@end deffn @deffn {} BFD_RELOC_VAX_GLOB_DAT @deffnx {} BFD_RELOC_VAX_JMP_SLOT @deffnx {} BFD_RELOC_VAX_RELATIVE Relocations used by VAX ELF. @end deffn +@deffn {} BFD_RELOC_MT_PC16 +Morpho MT - 16 bit immediate relocation. +@end deffn +@deffn {} BFD_RELOC_MT_HI16 +Morpho MT - Hi 16 bits of an address. +@end deffn +@deffn {} BFD_RELOC_MT_LO16 +Morpho MT - Low 16 bits of an address. +@end deffn +@deffn {} BFD_RELOC_MT_GNU_VTINHERIT +Morpho MT - Used to tell the linker which vtable entries are used. +@end deffn +@deffn {} BFD_RELOC_MT_GNU_VTENTRY +Morpho MT - Used to tell the linker which vtable entries are used. +@end deffn +@deffn {} BFD_RELOC_MT_PCINSN8 +Morpho MT - 8 bit immediate relocation. +@end deffn @deffn {} BFD_RELOC_MSP430_10_PCREL @deffnx {} BFD_RELOC_MSP430_16_PCREL @deffnx {} BFD_RELOC_MSP430_16 @deffnx {} BFD_RELOC_MSP430_16_PCREL_BYTE @deffnx {} BFD_RELOC_MSP430_16_BYTE +@deffnx {} BFD_RELOC_MSP430_2X_PCREL +@deffnx {} BFD_RELOC_MSP430_RL_PCREL msp430 specific relocation codes @end deffn @deffn {} BFD_RELOC_IQ2000_OFFSET_16 @@ -1958,24 +2326,83 @@ Xtensa relocations for ELF shared objects. Xtensa relocation used in ELF object files for symbols that may require PLT entries. Otherwise, this is just a generic 32-bit relocation. @end deffn +@deffn {} BFD_RELOC_XTENSA_DIFF8 +@deffnx {} BFD_RELOC_XTENSA_DIFF16 +@deffnx {} BFD_RELOC_XTENSA_DIFF32 +Xtensa relocations to mark the difference of two local symbols. +These are only needed to support linker relaxation and can be ignored +when not relaxing. The field is set to the value of the difference +assuming no relaxation. The relocation encodes the position of the +first symbol so the linker can determine whether to adjust the field +value. +@end deffn +@deffn {} BFD_RELOC_XTENSA_SLOT0_OP +@deffnx {} BFD_RELOC_XTENSA_SLOT1_OP +@deffnx {} BFD_RELOC_XTENSA_SLOT2_OP +@deffnx {} BFD_RELOC_XTENSA_SLOT3_OP +@deffnx {} BFD_RELOC_XTENSA_SLOT4_OP +@deffnx {} BFD_RELOC_XTENSA_SLOT5_OP +@deffnx {} BFD_RELOC_XTENSA_SLOT6_OP +@deffnx {} BFD_RELOC_XTENSA_SLOT7_OP +@deffnx {} BFD_RELOC_XTENSA_SLOT8_OP +@deffnx {} BFD_RELOC_XTENSA_SLOT9_OP +@deffnx {} BFD_RELOC_XTENSA_SLOT10_OP +@deffnx {} BFD_RELOC_XTENSA_SLOT11_OP +@deffnx {} BFD_RELOC_XTENSA_SLOT12_OP +@deffnx {} BFD_RELOC_XTENSA_SLOT13_OP +@deffnx {} BFD_RELOC_XTENSA_SLOT14_OP +Generic Xtensa relocations for instruction operands. Only the slot +number is encoded in the relocation. The relocation applies to the +last PC-relative immediate operand, or if there are no PC-relative +immediates, to the last immediate operand. +@end deffn +@deffn {} BFD_RELOC_XTENSA_SLOT0_ALT +@deffnx {} BFD_RELOC_XTENSA_SLOT1_ALT +@deffnx {} BFD_RELOC_XTENSA_SLOT2_ALT +@deffnx {} BFD_RELOC_XTENSA_SLOT3_ALT +@deffnx {} BFD_RELOC_XTENSA_SLOT4_ALT +@deffnx {} BFD_RELOC_XTENSA_SLOT5_ALT +@deffnx {} BFD_RELOC_XTENSA_SLOT6_ALT +@deffnx {} BFD_RELOC_XTENSA_SLOT7_ALT +@deffnx {} BFD_RELOC_XTENSA_SLOT8_ALT +@deffnx {} BFD_RELOC_XTENSA_SLOT9_ALT +@deffnx {} BFD_RELOC_XTENSA_SLOT10_ALT +@deffnx {} BFD_RELOC_XTENSA_SLOT11_ALT +@deffnx {} BFD_RELOC_XTENSA_SLOT12_ALT +@deffnx {} BFD_RELOC_XTENSA_SLOT13_ALT +@deffnx {} BFD_RELOC_XTENSA_SLOT14_ALT +Alternate Xtensa relocations. Only the slot is encoded in the +relocation. The meaning of these relocations is opcode-specific. +@end deffn @deffn {} BFD_RELOC_XTENSA_OP0 @deffnx {} BFD_RELOC_XTENSA_OP1 @deffnx {} BFD_RELOC_XTENSA_OP2 -Generic Xtensa relocations. Only the operand number is encoded -in the relocation. The details are determined by extracting the -instruction opcode. +Xtensa relocations for backward compatibility. These have all been +replaced by BFD_RELOC_XTENSA_SLOT0_OP. @end deffn @deffn {} BFD_RELOC_XTENSA_ASM_EXPAND -Xtensa relocation to mark that the assembler expanded the +Xtensa relocation to mark that the assembler expanded the instructions from an original target. The expansion size is encoded in the reloc size. @end deffn @deffn {} BFD_RELOC_XTENSA_ASM_SIMPLIFY -Xtensa relocation to mark that the linker should simplify -assembler-expanded instructions. This is commonly used -internally by the linker after analysis of a +Xtensa relocation to mark that the linker should simplify +assembler-expanded instructions. This is commonly used +internally by the linker after analysis of a BFD_RELOC_XTENSA_ASM_EXPAND. @end deffn +@deffn {} BFD_RELOC_Z80_DISP8 +8 bit signed offset in (ix+d) or (iy+d). +@end deffn +@deffn {} BFD_RELOC_Z8K_DISP7 +DJNZ offset. +@end deffn +@deffn {} BFD_RELOC_Z8K_CALLR +CALR offset. +@end deffn +@deffn {} BFD_RELOC_Z8K_IMM4L +4 bit value. +@end deffn @example @@ -2025,8 +2452,7 @@ bfd_boolean bfd_generic_relax_section @end example @strong{Description}@* Provides default handling for relaxing for back ends which -don't do relaxing -- i.e., does nothing except make sure that the -final size of the section is set. +don't do relaxing. @findex bfd_generic_gc_sections @subsubsection @code{bfd_generic_gc_sections} diff --git a/contrib/binutils/bfd/doc/section.texi b/contrib/binutils/bfd/doc/section.texi index b1501f9bbb4..4347679ef49 100644 --- a/contrib/binutils/bfd/doc/section.texi +++ b/contrib/binutils/bfd/doc/section.texi @@ -107,23 +107,6 @@ Here is the section structure: @example -/* This structure is used for a comdat section, as in PE. A comdat - section is associated with a particular symbol. When the linker - sees a comdat section, it keeps only one of the sections with a - given name and associated with a given symbol. */ - -struct bfd_comdat_info -@{ - /* The name of the symbol associated with a comdat section. */ - const char *name; - - /* The local symbol table index of the symbol associated with a - comdat section. This is only meaningful to the object file format - specific code; it is not an index into the list returned by - bfd_canonicalize_symtab. */ - long symbol; -@}; - typedef struct bfd_section @{ /* The name of the section; the name isn't a copy, the pointer is @@ -139,6 +122,9 @@ typedef struct bfd_section /* The next section in the list belonging to the BFD, or NULL. */ struct bfd_section *next; + /* The previous section in the list belonging to the BFD, or NULL. */ + struct bfd_section *prev; + /* The field flags contains attributes of the section. Some flags are read in from the object file, and some are synthesized from other information. */ @@ -158,23 +144,17 @@ typedef struct bfd_section some relocation information too. */ #define SEC_RELOC 0x004 - /* ELF reserves 4 processor specific bits and 8 operating system - specific bits in sh_flags; at present we can get away with just - one in communicating between the assembler and BFD, but this - isn't a good long-term solution. */ -#define SEC_ARCH_BIT_0 0x008 - /* A signal to the OS that the section contains read only data. */ -#define SEC_READONLY 0x010 +#define SEC_READONLY 0x008 /* The section contains code only. */ -#define SEC_CODE 0x020 +#define SEC_CODE 0x010 /* The section contains data only. */ -#define SEC_DATA 0x040 +#define SEC_DATA 0x020 /* The section will reside in ROM. */ -#define SEC_ROM 0x080 +#define SEC_ROM 0x040 /* The section contains constructor information. This section type is used by the linker to create lists of constructors and @@ -186,16 +166,110 @@ typedef struct bfd_section sections called @code{__CTOR_LIST__} and relocate the data contained within - exactly the operations it would peform on standard data. */ -#define SEC_CONSTRUCTOR 0x100 +#define SEC_CONSTRUCTOR 0x080 /* The section has contents - a data section could be @code{SEC_ALLOC} | @code{SEC_HAS_CONTENTS}; a debug section could be @code{SEC_HAS_CONTENTS} */ -#define SEC_HAS_CONTENTS 0x200 +#define SEC_HAS_CONTENTS 0x100 /* An instruction to the linker to not output the section even if it has information which would normally be written. */ -#define SEC_NEVER_LOAD 0x400 +#define SEC_NEVER_LOAD 0x200 + + /* The section contains thread local data. */ +#define SEC_THREAD_LOCAL 0x400 + + /* The section has GOT references. This flag is only for the + linker, and is currently only used by the elf32-hppa back end. + It will be set if global offset table references were detected + in this section, which indicate to the linker that the section + contains PIC code, and must be handled specially when doing a + static link. */ +#define SEC_HAS_GOT_REF 0x800 + + /* The section contains common symbols (symbols may be defined + multiple times, the value of a symbol is the amount of + space it requires, and the largest symbol value is the one + used). Most targets have exactly one of these (which we + translate to bfd_com_section_ptr), but ECOFF has two. */ +#define SEC_IS_COMMON 0x1000 + + /* The section contains only debugging information. For + example, this is set for ELF .debug and .stab sections. + strip tests this flag to see if a section can be + discarded. */ +#define SEC_DEBUGGING 0x2000 + + /* The contents of this section are held in memory pointed to + by the contents field. This is checked by bfd_get_section_contents, + and the data is retrieved from memory if appropriate. */ +#define SEC_IN_MEMORY 0x4000 + + /* The contents of this section are to be excluded by the + linker for executable and shared objects unless those + objects are to be further relocated. */ +#define SEC_EXCLUDE 0x8000 + + /* The contents of this section are to be sorted based on the sum of + the symbol and addend values specified by the associated relocation + entries. Entries without associated relocation entries will be + appended to the end of the section in an unspecified order. */ +#define SEC_SORT_ENTRIES 0x10000 + + /* When linking, duplicate sections of the same name should be + discarded, rather than being combined into a single section as + is usually done. This is similar to how common symbols are + handled. See SEC_LINK_DUPLICATES below. */ +#define SEC_LINK_ONCE 0x20000 + + /* If SEC_LINK_ONCE is set, this bitfield describes how the linker + should handle duplicate sections. */ +#define SEC_LINK_DUPLICATES 0x40000 + + /* This value for SEC_LINK_DUPLICATES means that duplicate + sections with the same name should simply be discarded. */ +#define SEC_LINK_DUPLICATES_DISCARD 0x0 + + /* This value for SEC_LINK_DUPLICATES means that the linker + should warn if there are any duplicate sections, although + it should still only link one copy. */ +#define SEC_LINK_DUPLICATES_ONE_ONLY 0x80000 + + /* This value for SEC_LINK_DUPLICATES means that the linker + should warn if any duplicate sections are a different size. */ +#define SEC_LINK_DUPLICATES_SAME_SIZE 0x100000 + + /* This value for SEC_LINK_DUPLICATES means that the linker + should warn if any duplicate sections contain different + contents. */ +#define SEC_LINK_DUPLICATES_SAME_CONTENTS \ + (SEC_LINK_DUPLICATES_ONE_ONLY | SEC_LINK_DUPLICATES_SAME_SIZE) + + /* This section was created by the linker as part of dynamic + relocation or other arcane processing. It is skipped when + going through the first-pass output, trusting that someone + else up the line will take care of it later. */ +#define SEC_LINKER_CREATED 0x200000 + + /* This section should not be subject to garbage collection. */ +#define SEC_KEEP 0x400000 + + /* This section contains "short" data, and should be placed + "near" the GP. */ +#define SEC_SMALL_DATA 0x800000 + + /* Attempt to merge identical entities in the section. + Entity size is given in the entsize field. */ +#define SEC_MERGE 0x1000000 + + /* If given with SEC_MERGE, entities to merge are zero terminated + strings where entsize specifies character size instead of fixed + size entries. */ +#define SEC_STRINGS 0x2000000 + + /* This section contains data about section groups. */ +#define SEC_GROUP 0x4000000 /* The section is a COFF shared library section. This flag is only for the linker. If this type of section appears in @@ -206,114 +280,23 @@ typedef struct bfd_section might be cleaner to have some more general mechanism to allow the back end to control what the linker does with sections. */ -#define SEC_COFF_SHARED_LIBRARY 0x800 - - /* The section contains thread local data. */ -#define SEC_THREAD_LOCAL 0x1000 - - /* The section has GOT references. This flag is only for the - linker, and is currently only used by the elf32-hppa back end. - It will be set if global offset table references were detected - in this section, which indicate to the linker that the section - contains PIC code, and must be handled specially when doing a - static link. */ -#define SEC_HAS_GOT_REF 0x4000 - - /* The section contains common symbols (symbols may be defined - multiple times, the value of a symbol is the amount of - space it requires, and the largest symbol value is the one - used). Most targets have exactly one of these (which we - translate to bfd_com_section_ptr), but ECOFF has two. */ -#define SEC_IS_COMMON 0x8000 - - /* The section contains only debugging information. For - example, this is set for ELF .debug and .stab sections. - strip tests this flag to see if a section can be - discarded. */ -#define SEC_DEBUGGING 0x10000 - - /* The contents of this section are held in memory pointed to - by the contents field. This is checked by bfd_get_section_contents, - and the data is retrieved from memory if appropriate. */ -#define SEC_IN_MEMORY 0x20000 - - /* The contents of this section are to be excluded by the - linker for executable and shared objects unless those - objects are to be further relocated. */ -#define SEC_EXCLUDE 0x40000 - - /* The contents of this section are to be sorted based on the sum of - the symbol and addend values specified by the associated relocation - entries. Entries without associated relocation entries will be - appended to the end of the section in an unspecified order. */ -#define SEC_SORT_ENTRIES 0x80000 - - /* When linking, duplicate sections of the same name should be - discarded, rather than being combined into a single section as - is usually done. This is similar to how common symbols are - handled. See SEC_LINK_DUPLICATES below. */ -#define SEC_LINK_ONCE 0x100000 - - /* If SEC_LINK_ONCE is set, this bitfield describes how the linker - should handle duplicate sections. */ -#define SEC_LINK_DUPLICATES 0x600000 - - /* This value for SEC_LINK_DUPLICATES means that duplicate - sections with the same name should simply be discarded. */ -#define SEC_LINK_DUPLICATES_DISCARD 0x0 - - /* This value for SEC_LINK_DUPLICATES means that the linker - should warn if there are any duplicate sections, although - it should still only link one copy. */ -#define SEC_LINK_DUPLICATES_ONE_ONLY 0x200000 - - /* This value for SEC_LINK_DUPLICATES means that the linker - should warn if any duplicate sections are a different size. */ -#define SEC_LINK_DUPLICATES_SAME_SIZE 0x400000 - - /* This value for SEC_LINK_DUPLICATES means that the linker - should warn if any duplicate sections contain different - contents. */ -#define SEC_LINK_DUPLICATES_SAME_CONTENTS 0x600000 - - /* This section was created by the linker as part of dynamic - relocation or other arcane processing. It is skipped when - going through the first-pass output, trusting that someone - else up the line will take care of it later. */ -#define SEC_LINKER_CREATED 0x800000 - - /* This section should not be subject to garbage collection. */ -#define SEC_KEEP 0x1000000 - - /* This section contains "short" data, and should be placed - "near" the GP. */ -#define SEC_SMALL_DATA 0x2000000 +#define SEC_COFF_SHARED_LIBRARY 0x10000000 /* This section contains data which may be shared with other - executables or shared objects. */ -#define SEC_SHARED 0x4000000 + executables or shared objects. This is for COFF only. */ +#define SEC_COFF_SHARED 0x20000000 /* When a section with this flag is being linked, then if the size of the input section is less than a page, it should not cross a page - boundary. If the size of the input section is one page or more, it - should be aligned on a page boundary. */ -#define SEC_BLOCK 0x8000000 + boundary. If the size of the input section is one page or more, + it should be aligned on a page boundary. This is for TI + TMS320C54X only. */ +#define SEC_TIC54X_BLOCK 0x40000000 /* Conditionally link this section; do not link if there are no - references found to any symbol in the section. */ -#define SEC_CLINK 0x10000000 - - /* Attempt to merge identical entities in the section. - Entity size is given in the entsize field. */ -#define SEC_MERGE 0x20000000 - - /* If given with SEC_MERGE, entities to merge are zero terminated - strings where entsize specifies character size instead of fixed - size entries. */ -#define SEC_STRINGS 0x40000000 - - /* This section contains data about section groups. */ -#define SEC_GROUP 0x80000000 + references found to any symbol in the section. This is for TI + TMS320C54X only. */ +#define SEC_TIC54X_CLINK 0x80000000 /* End of section flags. */ @@ -322,9 +305,6 @@ typedef struct bfd_section /* See the vma field. */ unsigned int user_set_vma : 1; - /* Whether relocations have been processed. */ - unsigned int reloc_done : 1; - /* A mark flag used by some of the linker backends. */ unsigned int linker_mark : 1; @@ -332,8 +312,9 @@ typedef struct bfd_section output sections that have an input section. */ unsigned int linker_has_input : 1; - /* A mark flag used by some linker backends for garbage collection. */ + /* Mark flags used by some linker backends for garbage collection. */ unsigned int gc_mark : 1; + unsigned int gc_mark_from_eh : 1; /* The following flags are used by the ELF linker. */ @@ -351,22 +332,20 @@ typedef struct bfd_section /* Nonzero if this section uses RELA relocations, rather than REL. */ unsigned int use_rela_p:1; - /* Bits used by various backends. */ - unsigned int has_tls_reloc:1; + /* Bits used by various backends. The generic code doesn't touch + these fields. */ - /* Nonzero if this section needs the relax finalize pass. */ - unsigned int need_finalize_relax:1; + /* Nonzero if this section has TLS related relocations. */ + unsigned int has_tls_reloc:1; /* Nonzero if this section has a gp reloc. */ unsigned int has_gp_reloc:1; - /* Unused bits. */ - unsigned int flag13:1; - unsigned int flag14:1; - unsigned int flag15:1; - unsigned int flag16:4; - unsigned int flag20:4; - unsigned int flag24:8; + /* Nonzero if this section needs the relax finalize pass. */ + unsigned int need_finalize_relax:1; + + /* Whether relocations have been processed. */ + unsigned int reloc_done : 1; /* End of internal packed boolean fields. */ @@ -385,13 +364,18 @@ typedef struct bfd_section /* The size of the section in octets, as it will be output. Contains a value even if the section has no contents (e.g., the - size of @code{.bss}). This will be filled in after relocation. */ - bfd_size_type _cooked_size; + size of @code{.bss}). */ + bfd_size_type size; - /* The original size on disk of the section, in octets. Normally this - value is the same as the size, but if some relaxing has - been done, then this value will be bigger. */ - bfd_size_type _raw_size; + /* For input sections, the original size on disk of the section, in + octets. This field is used by the linker relaxation code. It is + currently only set for sections where the linker relaxation scheme + doesn't cache altered section and reloc contents (stabs, eh_frame, + SEC_MERGE, some coff relaxing targets), and thus the original size + needs to be kept to read the section multiple times. + For output sections, rawsize holds the section size calculated on + a previous linker relaxation pass. */ + bfd_size_type rawsize; /* If this section is going to be output, then this value is the offset in *bytes* into the output section of the first byte in the @@ -448,9 +432,6 @@ typedef struct bfd_section /* Entity size for merging purposes. */ unsigned int entsize; - /* Optional information about a COMDAT entry; NULL if not COMDAT. */ - struct bfd_comdat_info *comdat; - /* Points to the kept section if this section is a link-once section, and is discarded. */ struct bfd_section *kept_section; @@ -475,8 +456,14 @@ typedef struct bfd_section struct bfd_symbol *symbol; struct bfd_symbol **symbol_ptr_ptr; - struct bfd_link_order *link_order_head; - struct bfd_link_order *link_order_tail; + /* Early in the link process, map_head and map_tail are used to build + a list of input sections attached to an output section. Later, + output sections use these fields for a list of bfd_link_order + structs. */ + union @{ + struct bfd_link_order *link_order; + struct bfd_section *s; + @} map_head, map_tail; @} asection; /* These sections are global, and are managed by BFD. The application @@ -515,36 +502,137 @@ extern const struct bfd_symbol * const bfd_abs_symbol; extern const struct bfd_symbol * const bfd_com_symbol; extern const struct bfd_symbol * const bfd_und_symbol; extern const struct bfd_symbol * const bfd_ind_symbol; -#define bfd_get_section_size_before_reloc(section) \ - ((section)->_raw_size) -#define bfd_get_section_size_after_reloc(section) \ - ((section)->reloc_done ? (section)->_cooked_size \ - : (abort (), (bfd_size_type) 1)) /* Macros to handle insertion and deletion of a bfd's sections. These only handle the list pointers, ie. do not adjust section_count, target_index etc. */ -#define bfd_section_list_remove(ABFD, PS) \ +#define bfd_section_list_remove(ABFD, S) \ do \ @{ \ - asection **_ps = PS; \ - asection *_s = *_ps; \ - *_ps = _s->next; \ - if (_s->next == NULL) \ - (ABFD)->section_tail = _ps; \ - @} \ - while (0) -#define bfd_section_list_insert(ABFD, PS, S) \ - do \ - @{ \ - asection **_ps = PS; \ asection *_s = S; \ - _s->next = *_ps; \ - *_ps = _s; \ - if (_s->next == NULL) \ - (ABFD)->section_tail = &_s->next; \ + asection *_next = _s->next; \ + asection *_prev = _s->prev; \ + if (_prev) \ + _prev->next = _next; \ + else \ + (ABFD)->sections = _next; \ + if (_next) \ + _next->prev = _prev; \ + else \ + (ABFD)->section_last = _prev; \ @} \ while (0) +#define bfd_section_list_append(ABFD, S) \ + do \ + @{ \ + asection *_s = S; \ + bfd *_abfd = ABFD; \ + _s->next = NULL; \ + if (_abfd->section_last) \ + @{ \ + _s->prev = _abfd->section_last; \ + _abfd->section_last->next = _s; \ + @} \ + else \ + @{ \ + _s->prev = NULL; \ + _abfd->sections = _s; \ + @} \ + _abfd->section_last = _s; \ + @} \ + while (0) +#define bfd_section_list_prepend(ABFD, S) \ + do \ + @{ \ + asection *_s = S; \ + bfd *_abfd = ABFD; \ + _s->prev = NULL; \ + if (_abfd->sections) \ + @{ \ + _s->next = _abfd->sections; \ + _abfd->sections->prev = _s; \ + @} \ + else \ + @{ \ + _s->next = NULL; \ + _abfd->section_last = _s; \ + @} \ + _abfd->sections = _s; \ + @} \ + while (0) +#define bfd_section_list_insert_after(ABFD, A, S) \ + do \ + @{ \ + asection *_a = A; \ + asection *_s = S; \ + asection *_next = _a->next; \ + _s->next = _next; \ + _s->prev = _a; \ + _a->next = _s; \ + if (_next) \ + _next->prev = _s; \ + else \ + (ABFD)->section_last = _s; \ + @} \ + while (0) +#define bfd_section_list_insert_before(ABFD, B, S) \ + do \ + @{ \ + asection *_b = B; \ + asection *_s = S; \ + asection *_prev = _b->prev; \ + _s->prev = _prev; \ + _s->next = _b; \ + _b->prev = _s; \ + if (_prev) \ + _prev->next = _s; \ + else \ + (ABFD)->sections = _s; \ + @} \ + while (0) +#define bfd_section_removed_from_list(ABFD, S) \ + ((S)->next == NULL ? (ABFD)->section_last != (S) : (S)->next->prev != (S)) + +#define BFD_FAKE_SECTION(SEC, FLAGS, SYM, SYM_PTR, NAME, IDX) \ + /* name, id, index, next, prev, flags, user_set_vma, */ \ + @{ NAME, IDX, 0, NULL, NULL, FLAGS, 0, \ + \ + /* linker_mark, linker_has_input, gc_mark, gc_mark_from_eh, */ \ + 0, 0, 1, 0, \ + \ + /* segment_mark, sec_info_type, use_rela_p, has_tls_reloc, */ \ + 0, 0, 0, 0, \ + \ + /* has_gp_reloc, need_finalize_relax, reloc_done, */ \ + 0, 0, 0, \ + \ + /* vma, lma, size, rawsize */ \ + 0, 0, 0, 0, \ + \ + /* output_offset, output_section, alignment_power, */ \ + 0, (struct bfd_section *) &SEC, 0, \ + \ + /* relocation, orelocation, reloc_count, filepos, rel_filepos, */ \ + NULL, NULL, 0, 0, 0, \ + \ + /* line_filepos, userdata, contents, lineno, lineno_count, */ \ + 0, NULL, NULL, NULL, 0, \ + \ + /* entsize, kept_section, moving_line_filepos, */ \ + 0, NULL, 0, \ + \ + /* target_index, used_by_bfd, constructor_chain, owner, */ \ + 0, NULL, NULL, NULL, \ + \ + /* symbol, */ \ + (struct bfd_symbol *) SYM, \ + \ + /* symbol_ptr_ptr, */ \ + (struct bfd_symbol **) SYM_PTR, \ + \ + /* map_head, map_tail */ \ + @{ NULL @}, @{ NULL @} \ + @} @end example @@ -578,6 +666,29 @@ all sections of a given name is to use @code{bfd_map_over_sections} and @code{strcmp} on the name (or better yet, base it on the section flags or something else) for each section. +@findex bfd_get_section_by_name_if +@subsubsection @code{bfd_get_section_by_name_if} +@strong{Synopsis} +@example +asection *bfd_get_section_by_name_if + (bfd *abfd, + const char *name, + bfd_boolean (*func) (bfd *abfd, asection *sect, void *obj), + void *obj); +@end example +@strong{Description}@* +Call the provided function @var{func} for each section +attached to the BFD @var{abfd} whose name matches @var{name}, +passing @var{obj} as an argument. The function will be called +as if by + +@example + func (abfd, the_section, obj); +@end example + +It returns the first section for which @var{func} returns true, +otherwise @code{NULL}. + @findex bfd_get_unique_section_name @subsubsection @code{bfd_get_unique_section_name} @strong{Synopsis} @@ -619,6 +730,28 @@ If output has already started for this BFD. If memory allocation fails. @end itemize +@findex bfd_make_section_anyway_with_flags +@subsubsection @code{bfd_make_section_anyway_with_flags} +@strong{Synopsis} +@example +asection *bfd_make_section_anyway_with_flags + (bfd *abfd, const char *name, flagword flags); +@end example +@strong{Description}@* +Create a new empty section called @var{name} and attach it to the end of +the chain of sections for @var{abfd}. Create a new section even if there +is already a section with that name. Also set the attributes of the +new section to the value @var{flags}. + +Return @code{NULL} and set @code{bfd_error} on error; possible errors are: +@itemize @bullet + +@item +@code{bfd_error_invalid_operation} - If output has already started for @var{abfd}. +@item +@code{bfd_error_no_memory} - If memory allocation fails. +@end itemize + @findex bfd_make_section_anyway @subsubsection @code{bfd_make_section_anyway} @strong{Synopsis} @@ -639,6 +772,20 @@ Return @code{NULL} and set @code{bfd_error} on error; possible errors are: @code{bfd_error_no_memory} - If memory allocation fails. @end itemize +@findex bfd_make_section_with_flags +@subsubsection @code{bfd_make_section_with_flags} +@strong{Synopsis} +@example +asection *bfd_make_section_with_flags + (bfd *, const char *name, flagword flags); +@end example +@strong{Description}@* +Like @code{bfd_make_section_anyway}, but return @code{NULL} (without calling +bfd_set_error ()) without changing the section chain if there is already a +section named @var{name}. Also set the attributes of the new section to +the value @var{flags}. If there is an error, return @code{NULL} and set +@code{bfd_error}. + @findex bfd_make_section @subsubsection @code{bfd_make_section} @strong{Synopsis} @@ -699,6 +846,26 @@ alternative would be to use a loop: func (abfd, p, ...) @end example +@findex bfd_sections_find_if +@subsubsection @code{bfd_sections_find_if} +@strong{Synopsis} +@example +asection *bfd_sections_find_if + (bfd *abfd, + bfd_boolean (*operation) (bfd *abfd, asection *sect, void *obj), + void *obj); +@end example +@strong{Description}@* +Call the provided function @var{operation} for each section +attached to the BFD @var{abfd}, passing @var{obj} as an +argument. The function will be called as if by + +@example + operation (abfd, the_section, obj); +@end example + +It returns the first section for which @var{operation} returns true. + @findex bfd_set_section_size @subsubsection @code{bfd_set_section_size} @strong{Synopsis} @@ -766,6 +933,17 @@ flag set are requested or if the section does not have the with zeroes. If no errors occur, @code{TRUE} is returned, else @code{FALSE}. +@findex bfd_malloc_and_get_section +@subsubsection @code{bfd_malloc_and_get_section} +@strong{Synopsis} +@example +bfd_boolean bfd_malloc_and_get_section + (bfd *abfd, asection *section, bfd_byte **buf); +@end example +@strong{Description}@* +Read all data from @var{section} in BFD @var{abfd} +into a buffer, *@var{buf}, malloc'd by this function. + @findex bfd_copy_private_section_data @subsubsection @code{bfd_copy_private_section_data} @strong{Synopsis} @@ -791,20 +969,14 @@ Not enough memory exists to create private data for @var{osec}. (ibfd, isection, obfd, osection)) @end example -@findex _bfd_strip_section_from_output -@subsubsection @code{_bfd_strip_section_from_output} +@findex bfd_generic_is_group_section +@subsubsection @code{bfd_generic_is_group_section} @strong{Synopsis} @example -void _bfd_strip_section_from_output - (struct bfd_link_info *info, asection *section); +bfd_boolean bfd_generic_is_group_section (bfd *, const asection *sec); @end example @strong{Description}@* -Remove @var{section} from the output. If the output section -becomes empty, remove it from the output bfd. - -This function won't actually do anything except twiddle flags -if called too late in the linking process, when it's not safe -to remove sections. +Returns TRUE if @var{sec} is a member of a group. @findex bfd_generic_discard_group @subsubsection @code{bfd_generic_discard_group} diff --git a/contrib/binutils/bfd/doc/syms.texi b/contrib/binutils/bfd/doc/syms.texi index 415d1569880..dc56bbc7e1b 100644 --- a/contrib/binutils/bfd/doc/syms.texi +++ b/contrib/binutils/bfd/doc/syms.texi @@ -309,6 +309,22 @@ local label. @end example +@findex bfd_is_target_special_symbol +@subsubsection @code{bfd_is_target_special_symbol} +@strong{Synopsis} +@example +bfd_boolean bfd_is_target_special_symbol (bfd *abfd, asymbol *sym); +@end example +@strong{Description}@* +Return TRUE iff a symbol @var{sym} in the BFD @var{abfd} is something +special to the particular target represented by the BFD. Such symbols +should normally not be mentioned to the user. +@example +#define bfd_is_target_special_symbol(abfd, sym) \ + BFD_SEND (abfd, _bfd_is_target_special_symbol, (abfd, sym)) + +@end example + @findex bfd_canonicalize_symtab @subsubsection @code{bfd_canonicalize_symtab} @strong{Description}@* diff --git a/contrib/binutils/bfd/doc/targets.texi b/contrib/binutils/bfd/doc/targets.texi index 9b499cf4199..a85c8491108 100644 --- a/contrib/binutils/bfd/doc/targets.texi +++ b/contrib/binutils/bfd/doc/targets.texi @@ -178,7 +178,7 @@ typedef struct bfd_target unsigned short ar_max_namelen; /* Entries for byte swapping for data. These are different from the - other entry points, since they don't take a BFD asthe first argument. + other entry points, since they don't take a BFD as the first argument. Certain other handlers could do the same. */ bfd_uint64_t (*bfd_getx64) (const void *); bfd_int64_t (*bfd_getx_signed_64) (const void *); @@ -242,8 +242,10 @@ BFD_JUMP_TABLE macros. #define BFD_JUMP_TABLE_COPY(NAME) \ NAME##_bfd_copy_private_bfd_data, \ NAME##_bfd_merge_private_bfd_data, \ + _bfd_generic_init_private_section_data, \ NAME##_bfd_copy_private_section_data, \ NAME##_bfd_copy_private_symbol_data, \ + NAME##_bfd_copy_private_header_data, \ NAME##_bfd_set_private_flags, \ NAME##_bfd_print_private_bfd_data @@ -253,6 +255,12 @@ BFD_JUMP_TABLE macros. /* Called to merge BFD general private data from one object file to a common output file when linking. */ bfd_boolean (*_bfd_merge_private_bfd_data) (bfd *, bfd *); + /* Called to initialize BFD private section data from one object file + to another. */ +#define bfd_init_private_section_data(ibfd, isec, obfd, osec, link_info) \ + BFD_SEND (obfd, _bfd_init_private_section_data, (ibfd, isec, obfd, osec, link_info)) + bfd_boolean (*_bfd_init_private_section_data) + (bfd *, sec_ptr, bfd *, sec_ptr, struct bfd_link_info *); /* Called to copy BFD private section data from one object file to another. */ bfd_boolean (*_bfd_copy_private_section_data) @@ -261,6 +269,10 @@ BFD_JUMP_TABLE macros. to another. */ bfd_boolean (*_bfd_copy_private_symbol_data) (bfd *, asymbol *, bfd *, asymbol *); + /* Called to copy BFD private header data from one object file + to another. */ + bfd_boolean (*_bfd_copy_private_header_data) + (bfd *, bfd *); /* Called to set private backend flags. */ bfd_boolean (*_bfd_set_private_flags) (bfd *, flagword); @@ -312,8 +324,11 @@ BFD_JUMP_TABLE macros. NAME##_print_symbol, \ NAME##_get_symbol_info, \ NAME##_bfd_is_local_label_name, \ + NAME##_bfd_is_target_special_symbol, \ NAME##_get_lineno, \ NAME##_find_nearest_line, \ + _bfd_generic_find_line, \ + NAME##_find_inliner_info, \ NAME##_bfd_make_debug_symbol, \ NAME##_read_minisymbols, \ NAME##_minisymbol_to_symbol @@ -330,11 +345,16 @@ BFD_JUMP_TABLE macros. (bfd *, struct bfd_symbol *, symbol_info *); #define bfd_get_symbol_info(b,p,e) BFD_SEND (b, _bfd_get_symbol_info, (b,p,e)) bfd_boolean (*_bfd_is_local_label_name) (bfd *, const char *); - + bfd_boolean (*_bfd_is_target_special_symbol) (bfd *, asymbol *); alent * (*_get_lineno) (bfd *, struct bfd_symbol *); bfd_boolean (*_bfd_find_nearest_line) (bfd *, struct bfd_section *, struct bfd_symbol **, bfd_vma, const char **, const char **, unsigned int *); + bfd_boolean (*_bfd_find_line) + (bfd *, struct bfd_symbol **, struct bfd_symbol *, + const char **, unsigned int *); + bfd_boolean (*_bfd_find_inliner_info) + (bfd *, const char **, const char **, unsigned int *); /* Back-door to allow format-aware applications to create debug symbols while using BFD for everything else. Currently used by the assembler when creating COFF files. */ @@ -385,7 +405,9 @@ BFD_JUMP_TABLE macros. NAME##_bfd_link_split_section, \ NAME##_bfd_gc_sections, \ NAME##_bfd_merge_sections, \ - NAME##_bfd_discard_group + NAME##_bfd_is_group_section, \ + NAME##_bfd_discard_group, \ + NAME##_section_already_linked \ int (*_bfd_sizeof_headers) (bfd *, bfd_boolean); bfd_byte * (*_bfd_get_relocated_section_contents) @@ -422,13 +444,21 @@ BFD_JUMP_TABLE macros. /* Attempt to merge SEC_MERGE sections. */ bfd_boolean (*_bfd_merge_sections) (bfd *, struct bfd_link_info *); + /* Is this section a member of a group? */ + bfd_boolean (*_bfd_is_group_section) (bfd *, const struct bfd_section *); + /* Discard members of a group. */ bfd_boolean (*_bfd_discard_group) (bfd *, struct bfd_section *); + /* Check if SEC has been already linked during a reloceatable or + final link. */ + void (*_section_already_linked) (bfd *, struct bfd_section *); + /* Routines to handle dynamic symbols and relocs. */ #define BFD_JUMP_TABLE_DYNAMIC(NAME) \ NAME##_get_dynamic_symtab_upper_bound, \ NAME##_canonicalize_dynamic_symtab, \ + NAME##_get_synthetic_symtab, \ NAME##_get_dynamic_reloc_upper_bound, \ NAME##_canonicalize_dynamic_reloc @@ -437,6 +467,10 @@ BFD_JUMP_TABLE macros. /* Read in the dynamic symbols. */ long (*_bfd_canonicalize_dynamic_symtab) (bfd *, struct bfd_symbol **); + /* Create synthetized symbols. */ + long (*_bfd_get_synthetic_symtab) + (bfd *, long, struct bfd_symbol **, long, struct bfd_symbol **, + struct bfd_symbol **); /* Get the amount of memory required to hold the dynamic relocs. */ long (*_bfd_get_dynamic_reloc_upper_bound) (bfd *); /* Read in the dynamic relocs. */ diff --git a/contrib/binutils/bfd/dwarf1.c b/contrib/binutils/bfd/dwarf1.c index 1047ebfc2e9..5d6c1e359e5 100644 --- a/contrib/binutils/bfd/dwarf1.c +++ b/contrib/binutils/bfd/dwarf1.c @@ -1,23 +1,24 @@ /* DWARF 1 find nearest line (_bfd_dwarf1_find_nearest_line). - Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright 1998, 1999, 2000, 2001, 2002, 2004, 2005 + Free Software Foundation, Inc. -Written by Gavin Romig-Koch of Cygnus Solutions (gavin@cygnus.com). + Written by Gavin Romig-Koch of Cygnus Solutions (gavin@cygnus.com). -This file is part of BFD. + This file is part of BFD. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or (at -your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or (at + your option) any later version. -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" @@ -28,8 +29,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* dwarf1_debug is the starting point for all dwarf1 info. */ -struct dwarf1_debug { - +struct dwarf1_debug +{ /* The bfd we are working with. */ bfd* abfd; @@ -55,7 +56,8 @@ struct dwarf1_debug { /* One dwarf1_unit for each parsed compilation unit die. */ -struct dwarf1_unit { +struct dwarf1_unit +{ /* Linked starting from stash->lastUnit. */ struct dwarf1_unit* prev; @@ -66,7 +68,7 @@ struct dwarf1_unit { unsigned long low_pc; unsigned long high_pc; - /* Does this unit have a statement list? */ + /* Does this unit have a statement list? */ int has_stmt_list; /* If any, the offset of the line number table in the .line section. */ @@ -75,7 +77,7 @@ struct dwarf1_unit { /* If non-zero, a pointer to the first child of this unit. */ char* first_child; - /* How many line entries? */ + /* How many line entries? */ unsigned long line_count; /* The decoded line number table (line_count entries). */ @@ -87,7 +89,8 @@ struct dwarf1_unit { /* One dwarf1_func for each parsed function die. */ -struct dwarf1_func { +struct dwarf1_func +{ /* Linked starting from aUnit->func_list. */ struct dwarf1_func* prev; @@ -100,7 +103,8 @@ struct dwarf1_func { }; /* Used to return info about a parsed die. */ -struct die_info { +struct die_info +{ unsigned long length; unsigned long sibling; unsigned long low_pc; @@ -115,7 +119,8 @@ struct die_info { }; /* Parsed line number information. */ -struct linenumber { +struct linenumber +{ /* First address in the line. */ unsigned long addr; @@ -124,32 +129,17 @@ struct linenumber { }; /* Find the form of an attr, from the attr field. */ -#define FORM_FROM_ATTR(attr) ((attr) & 0xF) /* Implicitly specified */ - -static struct dwarf1_unit *alloc_dwarf1_unit - PARAMS ((struct dwarf1_debug *)); -static struct dwarf1_func *alloc_dwarf1_func - PARAMS ((struct dwarf1_debug *, struct dwarf1_unit *)); -static bfd_boolean parse_die - PARAMS ((bfd *, struct die_info *, char *, char *)); -static bfd_boolean parse_line_table - PARAMS ((struct dwarf1_debug *, struct dwarf1_unit *)); -static bfd_boolean parse_functions_in_unit - PARAMS ((struct dwarf1_debug *, struct dwarf1_unit *)); -static bfd_boolean dwarf1_unit_find_nearest_line - PARAMS ((struct dwarf1_debug *, struct dwarf1_unit *, unsigned long, - const char **, const char **, unsigned int *)); +#define FORM_FROM_ATTR(attr) ((attr) & 0xF) /* Implicitly specified. */ /* Return a newly allocated dwarf1_unit. It should be cleared and then attached into the 'stash' at 'stash->lastUnit'. */ static struct dwarf1_unit* -alloc_dwarf1_unit (stash) - struct dwarf1_debug* stash; +alloc_dwarf1_unit (struct dwarf1_debug* stash) { bfd_size_type amt = sizeof (struct dwarf1_unit); - struct dwarf1_unit* x = (struct dwarf1_unit*) bfd_zalloc (stash->abfd, amt); + struct dwarf1_unit* x = bfd_zalloc (stash->abfd, amt); x->prev = stash->lastUnit; stash->lastUnit = x; @@ -159,14 +149,12 @@ alloc_dwarf1_unit (stash) /* Return a newly allocated dwarf1_func. It must be cleared and attached into 'aUnit' at 'aUnit->func_list'. */ -static struct dwarf1_func* -alloc_dwarf1_func (stash, aUnit) - struct dwarf1_debug* stash; - struct dwarf1_unit* aUnit; +static struct dwarf1_func * +alloc_dwarf1_func (struct dwarf1_debug* stash, struct dwarf1_unit* aUnit) { bfd_size_type amt = sizeof (struct dwarf1_func); - struct dwarf1_func* x = (struct dwarf1_func*) bfd_zalloc (stash->abfd, amt); + struct dwarf1_func* x = bfd_zalloc (stash->abfd, amt); x->prev = aUnit->func_list; aUnit->func_list = x; @@ -181,16 +169,15 @@ alloc_dwarf1_func (stash, aUnit) Return FALSE if the die is invalidly formatted; TRUE otherwise. */ static bfd_boolean -parse_die (abfd, aDieInfo, aDiePtr, aDiePtrEnd) - bfd* abfd; - struct die_info* aDieInfo; - char* aDiePtr; - char* aDiePtrEnd; +parse_die (bfd * abfd, + struct die_info * aDieInfo, + char * aDiePtr, + char * aDiePtrEnd) { char* this_die = aDiePtr; char* xptr = this_die; - memset (aDieInfo,0,sizeof (*aDieInfo)); + memset (aDieInfo, 0, sizeof (* aDieInfo)); /* First comes the length. */ aDieInfo->length = bfd_get_32 (abfd, (bfd_byte *) xptr); @@ -217,7 +204,6 @@ parse_die (abfd, aDieInfo, aDiePtr, aDiePtrEnd) /* Parse the attribute based on its form. This section must handle all dwarf1 forms, but need only handle the actual attributes that we care about. */ - attr = bfd_get_16 (abfd, (bfd_byte *) xptr); xptr += 2; @@ -269,9 +255,7 @@ parse_die (abfd, aDieInfo, aDiePtr, aDiePtrEnd) occurs; TRUE otherwise. */ static bfd_boolean -parse_line_table (stash, aUnit) - struct dwarf1_debug* stash; - struct dwarf1_unit* aUnit; +parse_line_table (struct dwarf1_debug* stash, struct dwarf1_unit* aUnit) { char* xptr; @@ -285,14 +269,14 @@ parse_line_table (stash, aUnit) if (! msec) return FALSE; - size = bfd_get_section_size_before_reloc (msec); - stash->line_section = (char *) bfd_alloc (stash->abfd, size); + size = msec->rawsize ? msec->rawsize : msec->size; + stash->line_section = bfd_alloc (stash->abfd, size); if (! stash->line_section) return FALSE; if (! bfd_get_section_contents (stash->abfd, msec, stash->line_section, - (bfd_vma) 0, size)) + 0, size)) { stash->line_section = 0; return FALSE; @@ -318,13 +302,12 @@ parse_line_table (stash, aUnit) xptr += 4; /* How many line entrys? - 10 = 4 (line number) + 2 (pos in line) + 4 (address in line) */ + 10 = 4 (line number) + 2 (pos in line) + 4 (address in line). */ aUnit->line_count = (tblend - xptr) / 10; /* Allocate an array for the entries. */ amt = sizeof (struct linenumber) * aUnit->line_count; - aUnit->linenumber_table = ((struct linenumber *) - bfd_alloc (stash->abfd, amt)); + aUnit->linenumber_table = bfd_alloc (stash->abfd, amt); for (eachLine = 0; eachLine < aUnit->line_count; eachLine++) { @@ -352,15 +335,13 @@ parse_line_table (stash, aUnit) Return FALSE if error; TRUE otherwise. */ static bfd_boolean -parse_functions_in_unit (stash, aUnit) - struct dwarf1_debug* stash; - struct dwarf1_unit* aUnit; +parse_functions_in_unit (struct dwarf1_debug* stash, struct dwarf1_unit* aUnit) { char* eachDie; if (aUnit->first_child) for (eachDie = aUnit->first_child; - eachDie < stash->debug_section_end; + eachDie < stash->debug_section_end; ) { struct die_info eachDieInfo; @@ -395,15 +376,12 @@ parse_functions_in_unit (stash, aUnit) Return whether we found the line (or a function) without error. */ static bfd_boolean -dwarf1_unit_find_nearest_line (stash, aUnit, addr, - filename_ptr, functionname_ptr, - linenumber_ptr) - struct dwarf1_debug* stash; - struct dwarf1_unit* aUnit; - unsigned long addr; - const char **filename_ptr; - const char **functionname_ptr; - unsigned int *linenumber_ptr; +dwarf1_unit_find_nearest_line (struct dwarf1_debug* stash, + struct dwarf1_unit* aUnit, + unsigned long addr, + const char **filename_ptr, + const char **functionname_ptr, + unsigned int *linenumber_ptr) { int line_p = FALSE; int func_p = FALSE; @@ -461,15 +439,13 @@ dwarf1_unit_find_nearest_line (stash, aUnit, addr, Return TRUE if the line is found without error. */ bfd_boolean -_bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset, - filename_ptr, functionname_ptr, linenumber_ptr) - bfd *abfd; - asection *section; - asymbol **symbols ATTRIBUTE_UNUSED; - bfd_vma offset; - const char **filename_ptr; - const char **functionname_ptr; - unsigned int *linenumber_ptr; +_bfd_dwarf1_find_nearest_line (bfd *abfd, + asection *section, + asymbol **symbols ATTRIBUTE_UNUSED, + bfd_vma offset, + const char **filename_ptr, + const char **functionname_ptr, + unsigned int *linenumber_ptr) { struct dwarf1_debug *stash = elf_tdata (abfd)->dwarf1_find_line_info; @@ -488,28 +464,26 @@ _bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset, bfd_size_type size = sizeof (struct dwarf1_debug); stash = elf_tdata (abfd)->dwarf1_find_line_info - = (struct dwarf1_debug *) bfd_zalloc (abfd, size); + = bfd_zalloc (abfd, size); if (! stash) return FALSE; msec = bfd_get_section_by_name (abfd, ".debug"); if (! msec) - { - /* No dwarf1 info. Note that at this point the stash - has been allocated, but contains zeros, this lets - future calls to this function fail quicker. */ - return FALSE; - } + /* No dwarf1 info. Note that at this point the stash + has been allocated, but contains zeros, this lets + future calls to this function fail quicker. */ + return FALSE; - size = bfd_get_section_size_before_reloc (msec); - stash->debug_section = (char *) bfd_alloc (abfd, size); + size = msec->rawsize ? msec->rawsize : msec->size; + stash->debug_section = bfd_alloc (abfd, size); if (! stash->debug_section) return FALSE; if (! bfd_get_section_contents (abfd, msec, stash->debug_section, - (bfd_vma) 0, size)) + 0, size)) { stash->debug_section = 0; return FALSE; @@ -529,13 +503,11 @@ _bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset, /* Look at the previously parsed units to see if any contain the addr. */ for (eachUnit = stash->lastUnit; eachUnit; eachUnit = eachUnit->prev) - { - if (eachUnit->low_pc <= addr && addr < eachUnit->high_pc) - return dwarf1_unit_find_nearest_line (stash, eachUnit, addr, - filename_ptr, - functionname_ptr, - linenumber_ptr); - } + if (eachUnit->low_pc <= addr && addr < eachUnit->high_pc) + return dwarf1_unit_find_nearest_line (stash, eachUnit, addr, + filename_ptr, + functionname_ptr, + linenumber_ptr); while (stash->currentDie < stash->debug_section_end) { @@ -582,5 +554,3 @@ _bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset, return FALSE; } - -/* EOF */ diff --git a/contrib/binutils/bfd/dwarf2.c b/contrib/binutils/bfd/dwarf2.c index 6182ea9ac35..ae68d188681 100644 --- a/contrib/binutils/bfd/dwarf2.c +++ b/contrib/binutils/bfd/dwarf2.c @@ -1,6 +1,6 @@ /* DWARF 2 support. Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, - 2004 Free Software Foundation, Inc. + 2004, 2005, 2006 Free Software Foundation, Inc. Adapted from gdb/dwarf2read.c by Gavin Koch of Cygnus Solutions (gavin@cygnus.com). @@ -27,7 +27,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" @@ -71,47 +71,71 @@ struct attribute struct dwarf_block { unsigned int size; - char *data; + bfd_byte *data; +}; + +struct loadable_section +{ + asection *section; + bfd_vma adj_vma; }; struct dwarf2_debug { /* A list of all previously read comp_units. */ - struct comp_unit* all_comp_units; + struct comp_unit *all_comp_units; /* The next unread compilation unit within the .debug_info section. Zero indicates that the .debug_info section has not been loaded into a buffer yet. */ - char* info_ptr; + bfd_byte *info_ptr; /* Pointer to the end of the .debug_info section memory buffer. */ - char* info_ptr_end; + bfd_byte *info_ptr_end; /* Pointer to the section and address of the beginning of the section. */ - asection* sec; - char* sec_info_ptr; + asection *sec; + bfd_byte *sec_info_ptr; /* Pointer to the symbol table. */ - asymbol** syms; + asymbol **syms; /* Pointer to the .debug_abbrev section loaded into memory. */ - char* dwarf_abbrev_buffer; + bfd_byte *dwarf_abbrev_buffer; /* Length of the loaded .debug_abbrev section. */ unsigned long dwarf_abbrev_size; /* Buffer for decode_line_info. */ - char *dwarf_line_buffer; + bfd_byte *dwarf_line_buffer; /* Length of the loaded .debug_line section. */ unsigned long dwarf_line_size; /* Pointer to the .debug_str section loaded into memory. */ - char* dwarf_str_buffer; + bfd_byte *dwarf_str_buffer; /* Length of the loaded .debug_str section. */ unsigned long dwarf_str_size; + + /* Pointer to the .debug_ranges section loaded into memory. */ + bfd_byte *dwarf_ranges_buffer; + + /* Length of the loaded .debug_ranges section. */ + unsigned long dwarf_ranges_size; + + /* If the most recent call to bfd_find_nearest_line was given an + address in an inlined function, preserve a pointer into the + calling chain for subsequent calls to bfd_find_inliner_info to + use. */ + struct funcinfo *inliner_chain; + + /* Number of loadable sections. */ + unsigned int loadable_section_count; + + /* Array of loadable sections. */ + struct loadable_section *loadable_sections; }; struct arange @@ -127,44 +151,51 @@ struct arange struct comp_unit { /* Chain the previously read compilation units. */ - struct comp_unit* next_unit; + struct comp_unit *next_unit; - /* Keep the bdf convenient (for memory allocation). */ - bfd* abfd; + /* Keep the bfd convenient (for memory allocation). */ + bfd *abfd; - /* The lowest and higest addresses contained in this compilation + /* The lowest and highest addresses contained in this compilation unit as specified in the compilation unit header. */ struct arange arange; /* The DW_AT_name attribute (for error messages). */ - char* name; + char *name; /* The abbrev hash table. */ - struct abbrev_info** abbrevs; + struct abbrev_info **abbrevs; /* Note that an error was found by comp_unit_find_nearest_line. */ int error; /* The DW_AT_comp_dir attribute. */ - char* comp_dir; + char *comp_dir; /* TRUE if there is a line number table associated with this comp. unit. */ int stmtlist; + /* Pointer to the current comp_unit so that we can find a given entry + by its reference. */ + bfd_byte *info_ptr_unit; + /* The offset into .debug_line of the line number table. */ unsigned long line_offset; /* Pointer to the first child die for the comp unit. */ - char *first_child_die_ptr; + bfd_byte *first_child_die_ptr; /* The end of the comp unit. */ - char *end_ptr; + bfd_byte *end_ptr; /* The decoded line number, NULL if not yet decoded. */ - struct line_info_table* line_table; + struct line_info_table *line_table; /* A list of the functions found in this comp. unit. */ - struct funcinfo* function_table; + struct funcinfo *function_table; + + /* A list of the variables found in this comp. unit. */ + struct varinfo *variable_table; /* Pointer to dwarf2_debug structure. */ struct dwarf2_debug *stash; @@ -174,6 +205,10 @@ struct comp_unit /* Offset size for this unit - from unit header. */ unsigned char offset_size; + + /* Base address for this unit - from DW_AT_low_pc attribute of + DW_TAG_compile_unit DIE */ + bfd_vma base_address; }; /* This data structure holds the information of an abbrev. */ @@ -207,38 +242,38 @@ struct attr_abbrev /* Read dwarf information from a buffer. */ static unsigned int -read_1_byte (bfd *abfd ATTRIBUTE_UNUSED, char *buf) +read_1_byte (bfd *abfd ATTRIBUTE_UNUSED, bfd_byte *buf) { return bfd_get_8 (abfd, buf); } static int -read_1_signed_byte (bfd *abfd ATTRIBUTE_UNUSED, char *buf) +read_1_signed_byte (bfd *abfd ATTRIBUTE_UNUSED, bfd_byte *buf) { return bfd_get_signed_8 (abfd, buf); } static unsigned int -read_2_bytes (bfd *abfd, char *buf) +read_2_bytes (bfd *abfd, bfd_byte *buf) { return bfd_get_16 (abfd, buf); } static unsigned int -read_4_bytes (bfd *abfd, char *buf) +read_4_bytes (bfd *abfd, bfd_byte *buf) { return bfd_get_32 (abfd, buf); } static bfd_uint64_t -read_8_bytes (bfd *abfd, char *buf) +read_8_bytes (bfd *abfd, bfd_byte *buf) { return bfd_get_64 (abfd, buf); } -static char * +static bfd_byte * read_n_bytes (bfd *abfd ATTRIBUTE_UNUSED, - char *buf, + bfd_byte *buf, unsigned int size ATTRIBUTE_UNUSED) { /* If the size of a host char is 8 bits, we can return a pointer @@ -249,27 +284,29 @@ read_n_bytes (bfd *abfd ATTRIBUTE_UNUSED, static char * read_string (bfd *abfd ATTRIBUTE_UNUSED, - char *buf, + bfd_byte *buf, unsigned int *bytes_read_ptr) { /* Return a pointer to the embedded string. */ - if (*buf == '\0') + char *str = (char *) buf; + if (*str == '\0') { *bytes_read_ptr = 1; return NULL; } - *bytes_read_ptr = strlen (buf) + 1; - return buf; + *bytes_read_ptr = strlen (str) + 1; + return str; } static char * read_indirect_string (struct comp_unit* unit, - char *buf, + bfd_byte *buf, unsigned int *bytes_read_ptr) { bfd_uint64_t offset; struct dwarf2_debug *stash = unit->stash; + char *str; if (unit->offset_size == 4) offset = read_4_bytes (unit->abfd, buf); @@ -281,6 +318,7 @@ read_indirect_string (struct comp_unit* unit, { asection *msec; bfd *abfd = unit->abfd; + bfd_size_type sz; msec = bfd_get_section_by_name (abfd, ".debug_str"); if (! msec) @@ -291,13 +329,14 @@ read_indirect_string (struct comp_unit* unit, return NULL; } - stash->dwarf_str_size = msec->_raw_size; - stash->dwarf_str_buffer = bfd_alloc (abfd, msec->_raw_size); - if (! stash->dwarf_abbrev_buffer) + sz = msec->rawsize ? msec->rawsize : msec->size; + stash->dwarf_str_size = sz; + stash->dwarf_str_buffer = bfd_alloc (abfd, sz); + if (! stash->dwarf_str_buffer) return NULL; if (! bfd_get_section_contents (abfd, msec, stash->dwarf_str_buffer, - 0, msec->_raw_size)) + 0, sz)) return NULL; } @@ -309,88 +348,46 @@ read_indirect_string (struct comp_unit* unit, return NULL; } - buf = stash->dwarf_str_buffer + offset; - if (*buf == '\0') + str = (char *) stash->dwarf_str_buffer + offset; + if (*str == '\0') return NULL; - return buf; -} - -static unsigned int -read_unsigned_leb128 (bfd *abfd ATTRIBUTE_UNUSED, - char *buf, - unsigned int *bytes_read_ptr) -{ - unsigned int result; - unsigned int num_read; - int shift; - unsigned char byte; - - result = 0; - shift = 0; - num_read = 0; - - do - { - byte = bfd_get_8 (abfd, buf); - buf ++; - num_read ++; - result |= ((byte & 0x7f) << shift); - shift += 7; - } - while (byte & 0x80); - - * bytes_read_ptr = num_read; - - return result; -} - -static int -read_signed_leb128 (bfd *abfd ATTRIBUTE_UNUSED, - char *buf, - unsigned int * bytes_read_ptr) -{ - int result; - int shift; - int num_read; - unsigned char byte; - - result = 0; - shift = 0; - num_read = 0; - - do - { - byte = bfd_get_8 (abfd, buf); - buf ++; - num_read ++; - result |= ((byte & 0x7f) << shift); - shift += 7; - } - while (byte & 0x80); - - if ((shift < 32) && (byte & 0x40)) - result |= -(1 << shift); - - * bytes_read_ptr = num_read; - - return result; + return str; } /* END VERBATIM */ static bfd_uint64_t -read_address (struct comp_unit *unit, char *buf) +read_address (struct comp_unit *unit, bfd_byte *buf) { - switch (unit->addr_size) + int signed_vma = get_elf_backend_data (unit->abfd)->sign_extend_vma; + + if (signed_vma) { - case 8: - return bfd_get_64 (unit->abfd, buf); - case 4: - return bfd_get_32 (unit->abfd, buf); - case 2: - return bfd_get_16 (unit->abfd, buf); - default: - abort (); + switch (unit->addr_size) + { + case 8: + return bfd_get_signed_64 (unit->abfd, buf); + case 4: + return bfd_get_signed_32 (unit->abfd, buf); + case 2: + return bfd_get_signed_16 (unit->abfd, buf); + default: + abort (); + } + } + else + { + switch (unit->addr_size) + { + case 8: + return bfd_get_64 (unit->abfd, buf); + case 4: + return bfd_get_32 (unit->abfd, buf); + case 2: + return bfd_get_16 (unit->abfd, buf); + default: + abort (); + } } } @@ -425,7 +422,7 @@ static struct abbrev_info** read_abbrevs (bfd *abfd, bfd_uint64_t offset, struct dwarf2_debug *stash) { struct abbrev_info **abbrevs; - char *abbrev_ptr; + bfd_byte *abbrev_ptr; struct abbrev_info *cur_abbrev; unsigned int abbrev_number, bytes_read, abbrev_name; unsigned int abbrev_form, hash_number; @@ -443,7 +440,7 @@ read_abbrevs (bfd *abfd, bfd_uint64_t offset, struct dwarf2_debug *stash) return 0; } - stash->dwarf_abbrev_size = msec->_raw_size; + stash->dwarf_abbrev_size = msec->size; stash->dwarf_abbrev_buffer = bfd_simple_get_relocated_section_contents (abfd, msec, NULL, stash->syms); @@ -490,11 +487,28 @@ read_abbrevs (bfd *abfd, bfd_uint64_t offset, struct dwarf2_debug *stash) { if ((cur_abbrev->num_attrs % ATTR_ALLOC_CHUNK) == 0) { + struct attr_abbrev *tmp; + amt = cur_abbrev->num_attrs + ATTR_ALLOC_CHUNK; amt *= sizeof (struct attr_abbrev); - cur_abbrev->attrs = bfd_realloc (cur_abbrev->attrs, amt); - if (! cur_abbrev->attrs) - return 0; + tmp = bfd_realloc (cur_abbrev->attrs, amt); + if (tmp == NULL) + { + size_t i; + + for (i = 0; i < ABBREV_HASH_SIZE; i++) + { + struct abbrev_info *abbrev = abbrevs[i]; + + while (abbrev) + { + free (abbrev->attrs); + abbrev = abbrev->next; + } + } + return NULL; + } + cur_abbrev->attrs = tmp; } cur_abbrev->attrs[cur_abbrev->num_attrs].name @@ -519,7 +533,7 @@ read_abbrevs (bfd *abfd, bfd_uint64_t offset, struct dwarf2_debug *stash) for the next compile unit) or if the end of the abbreviation table is reached. */ if ((unsigned int) (abbrev_ptr - stash->dwarf_abbrev_buffer) - >= stash->dwarf_abbrev_size) + >= stash->dwarf_abbrev_size) break; abbrev_number = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read); abbrev_ptr += bytes_read; @@ -532,11 +546,11 @@ read_abbrevs (bfd *abfd, bfd_uint64_t offset, struct dwarf2_debug *stash) /* Read an attribute value described by an attribute form. */ -static char * +static bfd_byte * read_attribute_value (struct attribute *attr, unsigned form, struct comp_unit *unit, - char *info_ptr) + bfd_byte *info_ptr) { bfd *abfd = unit->abfd; unsigned int bytes_read; @@ -660,11 +674,11 @@ read_attribute_value (struct attribute *attr, /* Read an attribute described by an abbreviated attribute. */ -static char * +static bfd_byte * read_attribute (struct attribute *attr, struct attr_abbrev *abbrev, struct comp_unit *unit, - char *info_ptr) + bfd_byte *info_ptr) { attr->name = abbrev->name; info_ptr = read_attribute_value (attr, abbrev->form, unit, info_ptr); @@ -680,7 +694,7 @@ struct line_info { struct line_info* prev_line; bfd_vma address; - char* filename; + char *filename; unsigned int line; unsigned int column; int end_sequence; /* End of (sequential) code sequence. */ @@ -699,21 +713,60 @@ struct line_info_table bfd* abfd; unsigned int num_files; unsigned int num_dirs; - char* comp_dir; - char** dirs; + char *comp_dir; + char **dirs; struct fileinfo* files; struct line_info* last_line; /* largest VMA */ struct line_info* lcl_head; /* local head; used in 'add_line_info' */ }; +/* Remember some information about each function. If the function is + inlined (DW_TAG_inlined_subroutine) it may have two additional + attributes, DW_AT_call_file and DW_AT_call_line, which specify the + source code location where this function was inlined. */ + struct funcinfo { - struct funcinfo *prev_func; - char* name; - bfd_vma low; - bfd_vma high; + struct funcinfo *prev_func; /* Pointer to previous function in list of all functions */ + struct funcinfo *caller_func; /* Pointer to function one scope higher */ + char *caller_file; /* Source location file name where caller_func inlines this func */ + int caller_line; /* Source location line number where caller_func inlines this func */ + char *file; /* Source location file name */ + int line; /* Source location line number */ + int tag; + char *name; + struct arange arange; + asection *sec; /* Where the symbol is defined */ }; +struct varinfo +{ + /* Pointer to previous variable in list of all variables */ + struct varinfo *prev_var; + /* Source location file name */ + char *file; + /* Source location line number */ + int line; + int tag; + char *name; + bfd_vma addr; + /* Where the symbol is defined */ + asection *sec; + /* Is this a stack variable? */ + unsigned int stack: 1; +}; + +/* Return TRUE if NEW_LINE should sort after LINE. */ + +static inline bfd_boolean +new_line_sorts_after (struct line_info *new_line, struct line_info *line) +{ + return (new_line->address > line->address + || (new_line->address == line->address + && new_line->end_sequence < line->end_sequence)); +} + + /* Adds a new entry to the line_info list in the line_info_table, ensuring that the list is sorted. Note that the line_info list is sorted from highest to lowest VMA (with possible duplicates); that is, @@ -730,6 +783,21 @@ add_line_info (struct line_info_table *table, bfd_size_type amt = sizeof (struct line_info); struct line_info* info = bfd_alloc (table->abfd, amt); + /* Set member data of 'info'. */ + info->address = address; + info->line = line; + info->column = column; + info->end_sequence = end_sequence; + + if (filename && filename[0]) + { + info->filename = bfd_alloc (table->abfd, strlen (filename) + 1); + if (info->filename) + strcpy (info->filename, filename); + } + else + info->filename = NULL; + /* Find the correct location for 'info'. Normally we will receive new line_info data 1) in order and 2) with increasing VMAs. However some compilers break the rules (cf. decode_line_info) and @@ -745,70 +813,45 @@ add_line_info (struct line_info_table *table, Note: we may receive duplicate entries from 'decode_line_info'. */ - while (1) - if (!table->last_line - || address >= table->last_line->address) - { - /* Normal case: add 'info' to the beginning of the list */ - info->prev_line = table->last_line; - table->last_line = info; - - /* lcl_head: initialize to head a *possible* sequence at the end. */ - if (!table->lcl_head) - table->lcl_head = info; - break; - } - else if (!table->lcl_head->prev_line - && table->lcl_head->address > address) - { - /* Abnormal but easy: lcl_head is 1) at the *end* of the line - list and 2) the head of 'info'. */ - info->prev_line = NULL; - table->lcl_head->prev_line = info; - break; - } - else if (table->lcl_head->prev_line - && table->lcl_head->address > address - && address >= table->lcl_head->prev_line->address) - { - /* Abnormal but easy: lcl_head is 1) in the *middle* of the line - list and 2) the head of 'info'. */ - info->prev_line = table->lcl_head->prev_line; - table->lcl_head->prev_line = info; - break; - } - else - { - /* Abnormal and hard: Neither 'last_line' nor 'lcl_head' are valid - heads for 'info'. Reset 'lcl_head' and repeat. */ - struct line_info* li2 = table->last_line; /* always non-NULL */ - struct line_info* li1 = li2->prev_line; - - while (li1) - { - if (li2->address > address && address >= li1->address) - break; - - li2 = li1; /* always non-NULL */ - li1 = li1->prev_line; - } - table->lcl_head = li2; - } - - /* Set member data of 'info'. */ - info->address = address; - info->line = line; - info->column = column; - info->end_sequence = end_sequence; - - if (filename && filename[0]) + if (!table->last_line + || new_line_sorts_after (info, table->last_line)) { - info->filename = bfd_alloc (table->abfd, strlen (filename) + 1); - if (info->filename) - strcpy (info->filename, filename); + /* Normal case: add 'info' to the beginning of the list */ + info->prev_line = table->last_line; + table->last_line = info; + + /* lcl_head: initialize to head a *possible* sequence at the end. */ + if (!table->lcl_head) + table->lcl_head = info; + } + else if (!new_line_sorts_after (info, table->lcl_head) + && (!table->lcl_head->prev_line + || new_line_sorts_after (info, table->lcl_head->prev_line))) + { + /* Abnormal but easy: lcl_head is the head of 'info'. */ + info->prev_line = table->lcl_head->prev_line; + table->lcl_head->prev_line = info; } else - info->filename = NULL; + { + /* Abnormal and hard: Neither 'last_line' nor 'lcl_head' are valid + heads for 'info'. Reset 'lcl_head'. */ + struct line_info* li2 = table->last_line; /* always non-NULL */ + struct line_info* li1 = li2->prev_line; + + while (li1) + { + if (!new_line_sorts_after (info, li2) + && new_line_sorts_after (info, li1)) + break; + + li2 = li1; /* always non-NULL */ + li1 = li1->prev_line; + } + table->lcl_head = li2; + info->prev_line = table->lcl_head->prev_line; + table->lcl_head->prev_line = info; + } } /* Extract a fully qualified filename from a line info table. @@ -818,12 +861,14 @@ add_line_info (struct line_info_table *table, static char * concat_filename (struct line_info_table *table, unsigned int file) { - char* filename; + char *filename; if (file - 1 >= table->num_files) { - (*_bfd_error_handler) - (_("Dwarf Error: mangled line number section (bad file number).")); + /* FILE == 0 means unknown. */ + if (file) + (*_bfd_error_handler) + (_("Dwarf Error: mangled line number section (bad file number).")); return strdup (""); } @@ -831,7 +876,7 @@ concat_filename (struct line_info_table *table, unsigned int file) if (! IS_ABSOLUTE_PATH (filename)) { - char* dirname = (table->files[file - 1].dir + char *dirname = (table->files[file - 1].dir ? table->dirs[table->files[file - 1].dir - 1] : table->comp_dir); @@ -853,13 +898,20 @@ concat_filename (struct line_info_table *table, unsigned int file) } static void -arange_add (struct comp_unit *unit, bfd_vma low_pc, bfd_vma high_pc) +arange_add (bfd *abfd, struct arange *first_arange, bfd_vma low_pc, bfd_vma high_pc) { struct arange *arange; - /* First see if we can cheaply extend an existing range. */ - arange = &unit->arange; + /* If the first arange is empty, use it. */ + if (first_arange->high == 0) + { + first_arange->low = low_pc; + first_arange->high = high_pc; + return; + } + /* Next see if we can cheaply extend an existing range. */ + arange = first_arange; do { if (low_pc == arange->high) @@ -876,22 +928,13 @@ arange_add (struct comp_unit *unit, bfd_vma low_pc, bfd_vma high_pc) } while (arange); - if (unit->arange.high == 0) - { - /* This is the first address range: store it in unit->arange. */ - unit->arange.next = 0; - unit->arange.low = low_pc; - unit->arange.high = high_pc; - return; - } - - /* Need to allocate a new arange and insert it into the arange list. */ - arange = bfd_zalloc (unit->abfd, sizeof (*arange)); + /* Need to allocate a new arange and insert it into the arange list. + Order isn't significant, so just insert after the first arange. */ + arange = bfd_zalloc (abfd, sizeof (*arange)); arange->low = low_pc; arange->high = high_pc; - - arange->next = unit->arange.next; - unit->arange.next = arange; + arange->next = first_arange->next; + first_arange->next = arange; } /* Decode the line number information for UNIT. */ @@ -901,8 +944,8 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash) { bfd *abfd = unit->abfd; struct line_info_table* table; - char *line_ptr; - char *line_end; + bfd_byte *line_ptr; + bfd_byte *line_end; struct line_head lh; unsigned int i, bytes_read, offset_size; char *cur_file, *cur_dir; @@ -921,7 +964,7 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash) return 0; } - stash->dwarf_line_size = msec->_raw_size; + stash->dwarf_line_size = msec->size; stash->dwarf_line_buffer = bfd_simple_get_relocated_section_contents (abfd, msec, NULL, stash->syms); @@ -1009,11 +1052,18 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash) if ((table->num_dirs % DIR_ALLOC_CHUNK) == 0) { + char **tmp; + amt = table->num_dirs + DIR_ALLOC_CHUNK; amt *= sizeof (char *); - table->dirs = bfd_realloc (table->dirs, amt); - if (! table->dirs) - return 0; + + tmp = bfd_realloc (table->dirs, amt); + if (tmp == NULL) + { + free (table->dirs); + return NULL; + } + table->dirs = tmp; } table->dirs[table->num_dirs++] = cur_dir; @@ -1028,11 +1078,19 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash) if ((table->num_files % FILE_ALLOC_CHUNK) == 0) { + struct fileinfo *tmp; + amt = table->num_files + FILE_ALLOC_CHUNK; amt *= sizeof (struct fileinfo); - table->files = bfd_realloc (table->files, amt); - if (! table->files) - return 0; + + tmp = bfd_realloc (table->files, amt); + if (tmp == NULL) + { + free (table->files); + free (table->dirs); + return NULL; + } + table->files = tmp; } table->files[table->num_files].name = cur_file; @@ -1066,7 +1124,7 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash) order using DW_LNE_set_address (e.g. Intel C++ 6.0 compiler for ia64-Linux). Thus, to determine the low and high address, we must compare on every DW_LNS_copy, etc. */ - bfd_vma low_pc = 0; + bfd_vma low_pc = (bfd_vma) -1; bfd_vma high_pc = 0; /* Decode the table. */ @@ -1085,7 +1143,7 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash) /* Append row to matrix using current values. */ add_line_info (table, address, filename, line, column, 0); basic_block = 1; - if (low_pc == 0 || address < low_pc) + if (address < low_pc) low_pc = address; if (address > high_pc) high_pc = address; @@ -1104,11 +1162,11 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash) end_sequence = 1; add_line_info (table, address, filename, line, column, end_sequence); - if (low_pc == 0 || address < low_pc) + if (address < low_pc) low_pc = address; if (address > high_pc) high_pc = address; - arange_add (unit, low_pc, high_pc); + arange_add (unit->abfd, &unit->arange, low_pc, high_pc); break; case DW_LNE_set_address: address = read_address (unit, line_ptr); @@ -1119,11 +1177,19 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash) line_ptr += bytes_read; if ((table->num_files % FILE_ALLOC_CHUNK) == 0) { + struct fileinfo *tmp; + amt = table->num_files + FILE_ALLOC_CHUNK; amt *= sizeof (struct fileinfo); - table->files = bfd_realloc (table->files, amt); - if (! table->files) - return 0; + tmp = bfd_realloc (table->files, amt); + if (tmp == NULL) + { + free (table->files); + free (table->dirs); + free (filename); + return NULL; + } + table->files = tmp; } table->files[table->num_files].name = cur_file; table->files[table->num_files].dir = @@ -1140,13 +1206,16 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash) default: (*_bfd_error_handler) (_("Dwarf Error: mangled line number section.")); bfd_set_error (bfd_error_bad_value); - return 0; + free (filename); + free (table->files); + free (table->dirs); + return NULL; } break; case DW_LNS_copy: add_line_info (table, address, filename, line, column, 0); basic_block = 0; - if (low_pc == 0 || address < low_pc) + if (address < low_pc) low_pc = address; if (address > high_pc) high_pc = address; @@ -1244,7 +1313,7 @@ lookup_address_in_line_info_table (struct line_info_table *table, to return as good as results as possible for strange debugging info. */ bfd_boolean addr_match = FALSE; - if (each_line->address <= addr && addr <= next_line->address) + if (each_line->address <= addr && addr < next_line->address) { addr_match = TRUE; @@ -1252,12 +1321,34 @@ lookup_address_in_line_info_table (struct line_info_table *table, later function, return the first line of that function instead of the last line of the earlier one. This check is for GCC 2.95, which emits the first line number for a function late. */ - if (function != NULL - && each_line->address < function->low - && next_line->address > function->low) + + if (function != NULL) { - *filename_ptr = next_line->filename; - *linenumber_ptr = next_line->line; + bfd_vma lowest_pc; + struct arange *arange; + + /* Find the lowest address in the function's range list */ + lowest_pc = function->arange.low; + for (arange = &function->arange; + arange; + arange = arange->next) + { + if (function->arange.low < lowest_pc) + lowest_pc = function->arange.low; + } + /* Check for spanning function and set outgoing line info */ + if (addr >= lowest_pc + && each_line->address < lowest_pc + && next_line->address > lowest_pc) + { + *filename_ptr = next_line->filename; + *linenumber_ptr = next_line->line; + } + else + { + *filename_ptr = each_line->filename; + *linenumber_ptr = each_line->line; + } } else { @@ -1289,44 +1380,276 @@ lookup_address_in_line_info_table (struct line_info_table *table, return FALSE; } -/* Function table functions. */ - -/* If ADDR is within TABLE, set FUNCTIONNAME_PTR, and return TRUE. */ +/* Read in the .debug_ranges section for future reference */ static bfd_boolean -lookup_address_in_function_table (struct funcinfo *table, +read_debug_ranges (struct comp_unit *unit) +{ + struct dwarf2_debug *stash = unit->stash; + if (! stash->dwarf_ranges_buffer) + { + bfd *abfd = unit->abfd; + asection *msec; + + msec = bfd_get_section_by_name (abfd, ".debug_ranges"); + if (! msec) + { + (*_bfd_error_handler) (_("Dwarf Error: Can't find .debug_ranges section.")); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + + stash->dwarf_ranges_size = msec->size; + stash->dwarf_ranges_buffer + = bfd_simple_get_relocated_section_contents (abfd, msec, NULL, + stash->syms); + if (! stash->dwarf_ranges_buffer) + return FALSE; + } + return TRUE; +} + +/* Function table functions. */ + +/* If ADDR is within TABLE, set FUNCTIONNAME_PTR, and return TRUE. + Note that we need to find the function that has the smallest + range that contains ADDR, to handle inlined functions without + depending upon them being ordered in TABLE by increasing range. */ + +static bfd_boolean +lookup_address_in_function_table (struct comp_unit *unit, bfd_vma addr, struct funcinfo **function_ptr, const char **functionname_ptr) { struct funcinfo* each_func; + struct funcinfo* best_fit = NULL; + struct arange *arange; - for (each_func = table; + for (each_func = unit->function_table; each_func; each_func = each_func->prev_func) { - if (addr >= each_func->low && addr < each_func->high) + for (arange = &each_func->arange; + arange; + arange = arange->next) { - *functionname_ptr = each_func->name; - *function_ptr = each_func; - return TRUE; + if (addr >= arange->low && addr < arange->high) + { + if (!best_fit || + ((arange->high - arange->low) < (best_fit->arange.high - best_fit->arange.low))) + best_fit = each_func; + } } } - return FALSE; + if (best_fit) + { + *functionname_ptr = best_fit->name; + *function_ptr = best_fit; + return TRUE; + } + else + { + return FALSE; + } +} + +/* If SYM at ADDR is within function table of UNIT, set FILENAME_PTR + and LINENUMBER_PTR, and return TRUE. */ + +static bfd_boolean +lookup_symbol_in_function_table (struct comp_unit *unit, + asymbol *sym, + bfd_vma addr, + const char **filename_ptr, + unsigned int *linenumber_ptr) +{ + struct funcinfo* each_func; + struct funcinfo* best_fit = NULL; + struct arange *arange; + const char *name = bfd_asymbol_name (sym); + asection *sec = bfd_get_section (sym); + + for (each_func = unit->function_table; + each_func; + each_func = each_func->prev_func) + { + for (arange = &each_func->arange; + arange; + arange = arange->next) + { + if ((!each_func->sec || each_func->sec == sec) + && addr >= arange->low + && addr < arange->high + && each_func->name + && strcmp (name, each_func->name) == 0 + && (!best_fit + || ((arange->high - arange->low) + < (best_fit->arange.high - best_fit->arange.low)))) + best_fit = each_func; + } + } + + if (best_fit) + { + best_fit->sec = sec; + *filename_ptr = best_fit->file; + *linenumber_ptr = best_fit->line; + return TRUE; + } + else + return FALSE; +} + +/* Variable table functions. */ + +/* If SYM is within variable table of UNIT, set FILENAME_PTR and + LINENUMBER_PTR, and return TRUE. */ + +static bfd_boolean +lookup_symbol_in_variable_table (struct comp_unit *unit, + asymbol *sym, + bfd_vma addr, + const char **filename_ptr, + unsigned int *linenumber_ptr) +{ + const char *name = bfd_asymbol_name (sym); + asection *sec = bfd_get_section (sym); + struct varinfo* each; + + for (each = unit->variable_table; each; each = each->prev_var) + if (each->stack == 0 + && each->file != NULL + && each->name != NULL + && each->addr == addr + && (!each->sec || each->sec == sec) + && strcmp (name, each->name) == 0) + break; + + if (each) + { + each->sec = sec; + *filename_ptr = each->file; + *linenumber_ptr = each->line; + return TRUE; + } + else + return FALSE; +} + +static char * +find_abstract_instance_name (struct comp_unit *unit, bfd_uint64_t die_ref) +{ + bfd *abfd = unit->abfd; + bfd_byte *info_ptr; + unsigned int abbrev_number, bytes_read, i; + struct abbrev_info *abbrev; + struct attribute attr; + char *name = 0; + + info_ptr = unit->info_ptr_unit + die_ref; + abbrev_number = read_unsigned_leb128 (abfd, info_ptr, &bytes_read); + info_ptr += bytes_read; + + if (abbrev_number) + { + abbrev = lookup_abbrev (abbrev_number, unit->abbrevs); + if (! abbrev) + { + (*_bfd_error_handler) (_("Dwarf Error: Could not find abbrev number %u."), + abbrev_number); + bfd_set_error (bfd_error_bad_value); + } + else + { + for (i = 0; i < abbrev->num_attrs; ++i) + { + info_ptr = read_attribute (&attr, &abbrev->attrs[i], unit, info_ptr); + switch (attr.name) + { + case DW_AT_name: + /* Prefer DW_AT_MIPS_linkage_name over DW_AT_name. */ + if (name == NULL) + name = attr.u.str; + break; + case DW_AT_specification: + name = find_abstract_instance_name (unit, attr.u.val); + break; + case DW_AT_MIPS_linkage_name: + name = attr.u.str; + break; + default: + break; + } + } + } + } + return (name); +} + +static void +read_rangelist (struct comp_unit *unit, struct arange *arange, bfd_uint64_t offset) +{ + bfd_byte *ranges_ptr; + bfd_vma base_address = unit->base_address; + + if (! unit->stash->dwarf_ranges_buffer) + { + if (! read_debug_ranges (unit)) + return; + } + ranges_ptr = unit->stash->dwarf_ranges_buffer + offset; + + for (;;) + { + bfd_vma low_pc; + bfd_vma high_pc; + + if (unit->addr_size == 4) + { + low_pc = read_4_bytes (unit->abfd, ranges_ptr); + ranges_ptr += 4; + high_pc = read_4_bytes (unit->abfd, ranges_ptr); + ranges_ptr += 4; + } + else + { + low_pc = read_8_bytes (unit->abfd, ranges_ptr); + ranges_ptr += 8; + high_pc = read_8_bytes (unit->abfd, ranges_ptr); + ranges_ptr += 8; + } + if (low_pc == 0 && high_pc == 0) + break; + if (low_pc == -1UL && high_pc != -1UL) + base_address = high_pc; + else + arange_add (unit->abfd, arange, base_address + low_pc, base_address + high_pc); + } } /* DWARF2 Compilation unit functions. */ /* Scan over each die in a comp. unit looking for functions to add - to the function table. */ + to the function table and variables to the variable table. */ static bfd_boolean -scan_unit_for_functions (struct comp_unit *unit) +scan_unit_for_symbols (struct comp_unit *unit) { bfd *abfd = unit->abfd; - char *info_ptr = unit->first_child_die_ptr; + bfd_byte *info_ptr = unit->first_child_die_ptr; int nesting_level = 1; + struct funcinfo **nested_funcs; + int nested_funcs_size; + + /* Maintain a stack of in-scope functions and inlined functions, which we + can use to set the caller_func field. */ + nested_funcs_size = 32; + nested_funcs = bfd_malloc (nested_funcs_size * sizeof (struct funcinfo *)); + if (nested_funcs == NULL) + return FALSE; + nested_funcs[nesting_level] = 0; while (nesting_level) { @@ -1334,7 +1657,9 @@ scan_unit_for_functions (struct comp_unit *unit) struct abbrev_info *abbrev; struct attribute attr; struct funcinfo *func; - char* name = 0; + struct varinfo *var; + bfd_vma low_pc = 0; + bfd_vma high_pc = 0; abbrev_number = read_unsigned_leb128 (abfd, info_ptr, &bytes_read); info_ptr += bytes_read; @@ -1351,18 +1676,46 @@ scan_unit_for_functions (struct comp_unit *unit) (*_bfd_error_handler) (_("Dwarf Error: Could not find abbrev number %u."), abbrev_number); bfd_set_error (bfd_error_bad_value); + free (nested_funcs); return FALSE; } - if (abbrev->tag == DW_TAG_subprogram) + var = NULL; + if (abbrev->tag == DW_TAG_subprogram + || abbrev->tag == DW_TAG_entry_point + || abbrev->tag == DW_TAG_inlined_subroutine) { bfd_size_type amt = sizeof (struct funcinfo); func = bfd_zalloc (abfd, amt); + func->tag = abbrev->tag; func->prev_func = unit->function_table; unit->function_table = func; + + if (func->tag == DW_TAG_inlined_subroutine) + for (i = nesting_level - 1; i >= 1; i--) + if (nested_funcs[i]) + { + func->caller_func = nested_funcs[i]; + break; + } + nested_funcs[nesting_level] = func; } else - func = NULL; + { + func = NULL; + if (abbrev->tag == DW_TAG_variable) + { + bfd_size_type amt = sizeof (struct varinfo); + var = bfd_zalloc (abfd, amt); + var->tag = abbrev->tag; + var->stack = 1; + var->prev_var = unit->variable_table; + unit->variable_table = var; + } + + /* No inline function in scope at this nesting level. */ + nested_funcs[nesting_level] = 0; + } for (i = 0; i < abbrev->num_attrs; ++i) { @@ -1372,10 +1725,19 @@ scan_unit_for_functions (struct comp_unit *unit) { switch (attr.name) { + case DW_AT_call_file: + func->caller_file = concat_filename (unit->line_table, attr.u.val); + break; + + case DW_AT_call_line: + func->caller_line = attr.u.val; + break; + + case DW_AT_abstract_origin: + func->name = find_abstract_instance_name (unit, attr.u.val); + break; + case DW_AT_name: - - name = attr.u.str; - /* Prefer DW_AT_MIPS_linkage_name over DW_AT_name. */ if (func->name == NULL) func->name = attr.u.str; @@ -1386,23 +1748,79 @@ scan_unit_for_functions (struct comp_unit *unit) break; case DW_AT_low_pc: - func->low = attr.u.val; + low_pc = attr.u.val; break; case DW_AT_high_pc: - func->high = attr.u.val; + high_pc = attr.u.val; + break; + + case DW_AT_ranges: + read_rangelist (unit, &func->arange, attr.u.val); + break; + + case DW_AT_decl_file: + func->file = concat_filename (unit->line_table, + attr.u.val); + break; + + case DW_AT_decl_line: + func->line = attr.u.val; break; default: break; } } - else + else if (var) { switch (attr.name) { case DW_AT_name: - name = attr.u.str; + var->name = attr.u.str; + break; + + case DW_AT_decl_file: + var->file = concat_filename (unit->line_table, + attr.u.val); + break; + + case DW_AT_decl_line: + var->line = attr.u.val; + break; + + case DW_AT_external: + if (attr.u.val != 0) + var->stack = 0; + break; + + case DW_AT_location: + switch (attr.form) + { + case DW_FORM_block: + case DW_FORM_block1: + case DW_FORM_block2: + case DW_FORM_block4: + if (*attr.u.blk->data == DW_OP_addr) + { + var->stack = 0; + + /* Verify that DW_OP_addr is the only opcode in the + location, in which case the block size will be 1 + plus the address size. */ + /* ??? For TLS variables, gcc can emit + DW_OP_addr DW_OP_GNU_push_tls_address + which we don't handle here yet. */ + if (attr.u.blk->size == unit->addr_size + 1U) + var->addr = bfd_get (unit->addr_size * 8, + unit->abfd, + attr.u.blk->data + 1); + } + break; + + default: + break; + } break; default: @@ -1411,10 +1829,35 @@ scan_unit_for_functions (struct comp_unit *unit) } } + if (func && high_pc != 0) + { + arange_add (unit->abfd, &func->arange, low_pc, high_pc); + } + if (abbrev->has_children) - nesting_level++; + { + nesting_level++; + + if (nesting_level >= nested_funcs_size) + { + struct funcinfo **tmp; + + nested_funcs_size *= 2; + tmp = bfd_realloc (nested_funcs, + (nested_funcs_size + * sizeof (struct funcinfo *))); + if (tmp == NULL) + { + free (nested_funcs); + return FALSE; + } + nested_funcs = tmp; + } + nested_funcs[nesting_level] = 0; + } } + free (nested_funcs); return TRUE; } @@ -1431,6 +1874,7 @@ static struct comp_unit * parse_comp_unit (bfd *abfd, struct dwarf2_debug *stash, bfd_vma unit_length, + bfd_byte *info_ptr_unit, unsigned int offset_size) { struct comp_unit* unit; @@ -1441,9 +1885,11 @@ parse_comp_unit (bfd *abfd, unsigned int abbrev_number, bytes_read, i; struct abbrev_info *abbrev; struct attribute attr; - char *info_ptr = stash->info_ptr; - char *end_ptr = info_ptr + unit_length; + bfd_byte *info_ptr = stash->info_ptr; + bfd_byte *end_ptr = info_ptr + unit_length; bfd_size_type amt; + bfd_vma low_pc = 0; + bfd_vma high_pc = 0; version = read_2_bytes (abfd, info_ptr); info_ptr += 2; @@ -1511,6 +1957,7 @@ parse_comp_unit (bfd *abfd, unit->abbrevs = abbrevs; unit->end_ptr = end_ptr; unit->stash = stash; + unit->info_ptr_unit = info_ptr_unit; for (i = 0; i < abbrev->num_attrs; ++i) { @@ -1530,16 +1977,24 @@ parse_comp_unit (bfd *abfd, break; case DW_AT_low_pc: - unit->arange.low = attr.u.val; + low_pc = attr.u.val; + /* If the compilation unit DIE has a DW_AT_low_pc attribute, + this is the base address to use when reading location + lists or range lists. */ + unit->base_address = low_pc; break; case DW_AT_high_pc: - unit->arange.high = attr.u.val; + high_pc = attr.u.val; + break; + + case DW_AT_ranges: + read_rangelist (unit, &unit->arange, attr.u.val); break; case DW_AT_comp_dir: { - char* comp_dir = attr.u.str; + char *comp_dir = attr.u.str; if (comp_dir) { /* Irix 6.2 native cc prepends .: to the compilation @@ -1557,12 +2012,20 @@ parse_comp_unit (bfd *abfd, break; } } + if (high_pc != 0) + { + arange_add (unit->abfd, &unit->arange, low_pc, high_pc); + } unit->first_child_die_ptr = info_ptr; return unit; } -/* Return TRUE if UNIT contains the address given by ADDR. */ +/* Return TRUE if UNIT may contain the address given by ADDR. When + there are functions written entirely with inline asm statements, the + range info in the compilation unit header may not be correct. We + need to consult the line info table to see if a compilation unit + really contains the given address. */ static bfd_boolean comp_unit_contains_address (struct comp_unit *unit, bfd_vma addr) @@ -1624,7 +2087,7 @@ comp_unit_find_nearest_line (struct comp_unit *unit, } if (unit->first_child_die_ptr < unit->end_ptr - && ! scan_unit_for_functions (unit)) + && ! scan_unit_for_symbols (unit)) { unit->error = 1; return FALSE; @@ -1632,14 +2095,69 @@ comp_unit_find_nearest_line (struct comp_unit *unit, } function = NULL; - func_p = lookup_address_in_function_table (unit->function_table, addr, + func_p = lookup_address_in_function_table (unit, addr, &function, functionname_ptr); + if (func_p && (function->tag == DW_TAG_inlined_subroutine)) + stash->inliner_chain = function; line_p = lookup_address_in_line_info_table (unit->line_table, addr, function, filename_ptr, linenumber_ptr); return line_p || func_p; } +/* If UNIT contains SYM at ADDR, set the output parameters to the + values for the line containing SYM. The output parameters, + FILENAME_PTR, and LINENUMBER_PTR, are pointers to the objects to be + filled in. + + Return TRUE if UNIT contains SYM, and no errors were encountered; + FALSE otherwise. */ + +static bfd_boolean +comp_unit_find_line (struct comp_unit *unit, + asymbol *sym, + bfd_vma addr, + const char **filename_ptr, + unsigned int *linenumber_ptr, + struct dwarf2_debug *stash) +{ + if (unit->error) + return FALSE; + + if (! unit->line_table) + { + if (! unit->stmtlist) + { + unit->error = 1; + return FALSE; + } + + unit->line_table = decode_line_info (unit, stash); + + if (! unit->line_table) + { + unit->error = 1; + return FALSE; + } + + if (unit->first_child_die_ptr < unit->end_ptr + && ! scan_unit_for_symbols (unit)) + { + unit->error = 1; + return FALSE; + } + } + + if (sym->flags & BSF_FUNCTION) + return lookup_symbol_in_function_table (unit, sym, addr, + filename_ptr, + linenumber_ptr); + else + return lookup_symbol_in_variable_table (unit, sym, addr, + filename_ptr, + linenumber_ptr); +} + /* Locate a section in a BFD containing debugging info. The search starts from the section after AFTER_SEC, or from the first section in the BFD if AFTER_SEC is NULL. The search works by examining the names of the @@ -1676,7 +2194,98 @@ find_debug_info (bfd *abfd, asection *after_sec) return NULL; } -/* The DWARF2 version of find_nearest line. Return TRUE if the line +/* Unset vmas for loadable sections in STASH. */ + +static void +unset_sections (struct dwarf2_debug *stash) +{ + unsigned int i; + struct loadable_section *p; + + i = stash->loadable_section_count; + p = stash->loadable_sections; + for (; i > 0; i--, p++) + p->section->vma = 0; +} + +/* Set unique vmas for loadable sections in ABFD and save vmas in + STASH for unset_sections. */ + +static bfd_boolean +place_sections (bfd *abfd, struct dwarf2_debug *stash) +{ + struct loadable_section *p; + unsigned int i; + + if (stash->loadable_section_count != 0) + { + i = stash->loadable_section_count; + p = stash->loadable_sections; + for (; i > 0; i--, p++) + p->section->vma = p->adj_vma; + } + else + { + asection *sect; + bfd_vma last_vma = 0; + bfd_size_type amt; + struct loadable_section *p; + + i = 0; + for (sect = abfd->sections; sect != NULL; sect = sect->next) + { + bfd_size_type sz; + + if (sect->vma != 0 || (sect->flags & SEC_LOAD) == 0) + continue; + + sz = sect->rawsize ? sect->rawsize : sect->size; + if (sz == 0) + continue; + + i++; + } + + amt = i * sizeof (struct loadable_section); + p = (struct loadable_section *) bfd_zalloc (abfd, amt); + if (! p) + return FALSE; + + stash->loadable_sections = p; + stash->loadable_section_count = i; + + for (sect = abfd->sections; sect != NULL; sect = sect->next) + { + bfd_size_type sz; + + if (sect->vma != 0 || (sect->flags & SEC_LOAD) == 0) + continue; + + sz = sect->rawsize ? sect->rawsize : sect->size; + if (sz == 0) + continue; + + p->section = sect; + if (last_vma != 0) + { + /* Align the new address to the current section + alignment. */ + last_vma = ((last_vma + + ~((bfd_vma) -1 << sect->alignment_power)) + & ((bfd_vma) -1 << sect->alignment_power)); + sect->vma = last_vma; + } + p->adj_vma = sect->vma; + last_vma += sect->vma + sz; + + p++; + } + } + + return TRUE; +} + +/* The DWARF2 version of find_nearest_line. Return TRUE if the line is found without error. ADDR_SIZE is the number of bytes in the initial .debug_info length field and in the abbreviation offset. You may use zero to indicate that the default value should be @@ -1701,13 +2310,39 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd, We keep a list of all the previously read compilation units, and a pointer to the next un-read compilation unit. Check the previously read units before reading more. */ - struct dwarf2_debug *stash = *pinfo; + struct dwarf2_debug *stash; /* What address are we looking for? */ - bfd_vma addr = offset + section->vma; + bfd_vma addr; struct comp_unit* each; + bfd_vma found = FALSE; + + stash = *pinfo; + + if (! stash) + { + bfd_size_type amt = sizeof (struct dwarf2_debug); + + stash = bfd_zalloc (abfd, amt); + if (! stash) + return FALSE; + } + + /* In a relocatable file, 2 functions may have the same address. + We change the section vma so that they won't overlap. */ + if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0) + { + if (! place_sections (abfd, stash)) + return FALSE; + } + + addr = offset; + if (section->output_section) + addr += section->output_section->vma + section->output_offset; + else + addr += section->vma; *filename_ptr = NULL; *functionname_ptr = NULL; *linenumber_ptr = 0; @@ -1719,15 +2354,10 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd, addr_size = 4; BFD_ASSERT (addr_size == 4 || addr_size == 8); - if (! stash) + if (! *pinfo) { bfd_size_type total_size; asection *msec; - bfd_size_type amt = sizeof (struct dwarf2_debug); - - stash = bfd_zalloc (abfd, amt); - if (! stash) - return FALSE; *pinfo = stash; @@ -1736,7 +2366,7 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd, /* No dwarf2 info. Note that at this point the stash has been allocated, but contains zeros, this lets future calls to this function fail quicker. */ - return FALSE; + goto done; /* There can be more than one DWARF2 info section in a BFD these days. Read them all in and produce one large stash. We do this in two @@ -1744,11 +2374,11 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd, In the second pass we read in the section's contents. The allows us to avoid reallocing the data as we add sections to the stash. */ for (total_size = 0; msec; msec = find_debug_info (abfd, msec)) - total_size += msec->_raw_size; + total_size += msec->size; stash->info_ptr = bfd_alloc (abfd, total_size); if (stash->info_ptr == NULL) - return FALSE; + goto done; stash->info_ptr_end = stash->info_ptr; @@ -1759,7 +2389,7 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd, bfd_size_type size; bfd_size_type start; - size = msec->_raw_size; + size = msec->size; if (size == 0) continue; @@ -1782,21 +2412,27 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd, /* A null info_ptr indicates that there is no dwarf2 info (or that an error occured while setting up the stash). */ if (! stash->info_ptr) - return FALSE; + goto done; + + stash->inliner_chain = NULL; /* Check the previously read comp. units first. */ for (each = stash->all_comp_units; each; each = each->next_unit) - if (comp_unit_contains_address (each, addr)) - return comp_unit_find_nearest_line (each, addr, filename_ptr, - functionname_ptr, linenumber_ptr, - stash); + if (comp_unit_contains_address (each, addr) + && comp_unit_find_nearest_line (each, addr, filename_ptr, + functionname_ptr, + linenumber_ptr, stash)) + { + found = TRUE; + goto done; + } /* Read each remaining comp. units checking each as they are read. */ while (stash->info_ptr < stash->info_ptr_end) { bfd_vma length; - bfd_boolean found; unsigned int offset_size = addr_size; + bfd_byte *info_ptr_unit = stash->info_ptr; length = read_4_bytes (abfd, stash->info_ptr); /* A 0xffffff length is the DWARF3 way of indicating we use @@ -1829,11 +2465,12 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd, if (length > 0) { - each = parse_comp_unit (abfd, stash, length, offset_size); + each = parse_comp_unit (abfd, stash, length, info_ptr_unit, + offset_size); stash->info_ptr += length; if ((bfd_vma) (stash->info_ptr - stash->sec_info_ptr) - == stash->sec->_raw_size) + == stash->sec->size) { stash->sec = find_debug_info (abfd, stash->sec); stash->sec_info_ptr = stash->info_ptr; @@ -1849,28 +2486,313 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd, unit->high == 0), we need to consult the line info table to see if a compilation unit contains the given address. */ - if (each->arange.high > 0) + if ((each->arange.high == 0 + || comp_unit_contains_address (each, addr)) + && comp_unit_find_nearest_line (each, addr, + filename_ptr, + functionname_ptr, + linenumber_ptr, + stash)) { - if (comp_unit_contains_address (each, addr)) - return comp_unit_find_nearest_line (each, addr, - filename_ptr, - functionname_ptr, - linenumber_ptr, - stash); - } - else - { - found = comp_unit_find_nearest_line (each, addr, - filename_ptr, - functionname_ptr, - linenumber_ptr, - stash); - if (found) - return TRUE; + found = TRUE; + goto done; } } } } - return FALSE; +done: + if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0) + unset_sections (stash); + + return found; +} + +/* The DWARF2 version of find_line. Return TRUE if the line is found + without error. */ + +bfd_boolean +_bfd_dwarf2_find_line (bfd *abfd, + asymbol **symbols, + asymbol *symbol, + const char **filename_ptr, + unsigned int *linenumber_ptr, + unsigned int addr_size, + void **pinfo) +{ + /* Read each compilation unit from the section .debug_info, and check + to see if it contains the address we are searching for. If yes, + lookup the address, and return the line number info. If no, go + on to the next compilation unit. + + We keep a list of all the previously read compilation units, and + a pointer to the next un-read compilation unit. Check the + previously read units before reading more. */ + struct dwarf2_debug *stash; + + /* What address are we looking for? */ + bfd_vma addr; + + struct comp_unit* each; + + asection *section; + + bfd_boolean found = FALSE; + + section = bfd_get_section (symbol); + + stash = *pinfo; + + if (! stash) + { + bfd_size_type amt = sizeof (struct dwarf2_debug); + + stash = bfd_zalloc (abfd, amt); + if (! stash) + return FALSE; + } + + /* In a relocatable file, 2 functions may have the same address. + We change the section vma so that they won't overlap. */ + if (!stash && (abfd->flags & (EXEC_P | DYNAMIC)) == 0) + { + if (! place_sections (abfd, stash)) + return FALSE; + } + + addr = symbol->value; + if (section->output_section) + addr += section->output_section->vma + section->output_offset; + else + addr += section->vma; + + *filename_ptr = NULL; + *filename_ptr = NULL; + *linenumber_ptr = 0; + + if (! *pinfo) + { + bfd_size_type total_size; + asection *msec; + + *pinfo = stash; + + msec = find_debug_info (abfd, NULL); + if (! msec) + /* No dwarf2 info. Note that at this point the stash + has been allocated, but contains zeros, this lets + future calls to this function fail quicker. */ + goto done; + + /* There can be more than one DWARF2 info section in a BFD these days. + Read them all in and produce one large stash. We do this in two + passes - in the first pass we just accumulate the section sizes. + In the second pass we read in the section's contents. The allows + us to avoid reallocing the data as we add sections to the stash. */ + for (total_size = 0; msec; msec = find_debug_info (abfd, msec)) + total_size += msec->size; + + stash->info_ptr = bfd_alloc (abfd, total_size); + if (stash->info_ptr == NULL) + goto done; + + stash->info_ptr_end = stash->info_ptr; + + for (msec = find_debug_info (abfd, NULL); + msec; + msec = find_debug_info (abfd, msec)) + { + bfd_size_type size; + bfd_size_type start; + + size = msec->size; + if (size == 0) + continue; + + start = stash->info_ptr_end - stash->info_ptr; + + if ((bfd_simple_get_relocated_section_contents + (abfd, msec, stash->info_ptr + start, symbols)) == NULL) + continue; + + stash->info_ptr_end = stash->info_ptr + start + size; + } + + BFD_ASSERT (stash->info_ptr_end == stash->info_ptr + total_size); + + stash->sec = find_debug_info (abfd, NULL); + stash->sec_info_ptr = stash->info_ptr; + stash->syms = symbols; + } + + /* A null info_ptr indicates that there is no dwarf2 info + (or that an error occured while setting up the stash). */ + if (! stash->info_ptr) + goto done; + + stash->inliner_chain = NULL; + + /* Check the previously read comp. units first. */ + for (each = stash->all_comp_units; each; each = each->next_unit) + if ((symbol->flags & BSF_FUNCTION) == 0 + || comp_unit_contains_address (each, addr)) + { + found = comp_unit_find_line (each, symbol, addr, filename_ptr, + linenumber_ptr, stash); + if (found) + goto done; + } + + /* The DWARF2 spec says that the initial length field, and the + offset of the abbreviation table, should both be 4-byte values. + However, some compilers do things differently. */ + if (addr_size == 0) + addr_size = 4; + BFD_ASSERT (addr_size == 4 || addr_size == 8); + + /* Read each remaining comp. units checking each as they are read. */ + while (stash->info_ptr < stash->info_ptr_end) + { + bfd_vma length; + unsigned int offset_size = addr_size; + bfd_byte *info_ptr_unit = stash->info_ptr; + + length = read_4_bytes (abfd, stash->info_ptr); + /* A 0xffffff length is the DWARF3 way of indicating we use + 64-bit offsets, instead of 32-bit offsets. */ + if (length == 0xffffffff) + { + offset_size = 8; + length = read_8_bytes (abfd, stash->info_ptr + 4); + stash->info_ptr += 12; + } + /* A zero length is the IRIX way of indicating 64-bit offsets, + mostly because the 64-bit length will generally fit in 32 + bits, and the endianness helps. */ + else if (length == 0) + { + offset_size = 8; + length = read_4_bytes (abfd, stash->info_ptr + 4); + stash->info_ptr += 8; + } + /* In the absence of the hints above, we assume addr_size-sized + offsets, for backward-compatibility with pre-DWARF3 64-bit + platforms. */ + else if (addr_size == 8) + { + length = read_8_bytes (abfd, stash->info_ptr); + stash->info_ptr += 8; + } + else + stash->info_ptr += 4; + + if (length > 0) + { + each = parse_comp_unit (abfd, stash, length, info_ptr_unit, + offset_size); + stash->info_ptr += length; + + if ((bfd_vma) (stash->info_ptr - stash->sec_info_ptr) + == stash->sec->size) + { + stash->sec = find_debug_info (abfd, stash->sec); + stash->sec_info_ptr = stash->info_ptr; + } + + if (each) + { + each->next_unit = stash->all_comp_units; + stash->all_comp_units = each; + + /* DW_AT_low_pc and DW_AT_high_pc are optional for + compilation units. If we don't have them (i.e., + unit->high == 0), we need to consult the line info + table to see if a compilation unit contains the given + address. */ + found = (((symbol->flags & BSF_FUNCTION) == 0 + || each->arange.high <= 0 + || comp_unit_contains_address (each, addr)) + && comp_unit_find_line (each, symbol, addr, + filename_ptr, + linenumber_ptr, + stash)); + if (found) + goto done; + } + } + } + +done: + if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0) + unset_sections (stash); + + return found; +} + +bfd_boolean +_bfd_dwarf2_find_inliner_info (bfd *abfd ATTRIBUTE_UNUSED, + const char **filename_ptr, + const char **functionname_ptr, + unsigned int *linenumber_ptr, + void **pinfo) +{ + struct dwarf2_debug *stash; + + stash = *pinfo; + if (stash) + { + struct funcinfo *func = stash->inliner_chain; + if (func && func->caller_func) + { + *filename_ptr = func->caller_file; + *functionname_ptr = func->caller_func->name; + *linenumber_ptr = func->caller_line; + stash->inliner_chain = func->caller_func; + return (TRUE); + } + } + + return (FALSE); +} + +void +_bfd_dwarf2_cleanup_debug_info (bfd *abfd) +{ + struct comp_unit *each; + struct dwarf2_debug *stash; + + if (abfd == NULL || elf_tdata (abfd) == NULL) + return; + + stash = elf_tdata (abfd)->dwarf2_find_line_info; + + if (stash == NULL) + return; + + for (each = stash->all_comp_units; each; each = each->next_unit) + { + struct abbrev_info **abbrevs = each->abbrevs; + size_t i; + + for (i = 0; i < ABBREV_HASH_SIZE; i++) + { + struct abbrev_info *abbrev = abbrevs[i]; + + while (abbrev) + { + free (abbrev->attrs); + abbrev = abbrev->next; + } + } + + if (each->line_table) + { + free (each->line_table->dirs); + free (each->line_table->files); + } + } + + free (stash->dwarf_abbrev_buffer); + free (stash->dwarf_line_buffer); + free (stash->dwarf_ranges_buffer); } diff --git a/contrib/binutils/bfd/ecoff.c b/contrib/binutils/bfd/ecoff.c index cfc5ae1b9fa..75e1cc2a398 100644 --- a/contrib/binutils/bfd/ecoff.c +++ b/contrib/binutils/bfd/ecoff.c @@ -1,6 +1,6 @@ /* Generic ECOFF (Extended-COFF) routines. Copyright 1990, 1991, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, - 2002, 2003 Free Software Foundation, Inc. + 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Original version by Per Bothner. Full support added by Ian Lance Taylor, ian@cygnus.com. @@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" @@ -43,79 +43,51 @@ #include "coff/ecoff.h" #include "libcoff.h" #include "libecoff.h" - -/* Prototypes for static functions. */ +#include "libiberty.h" + +#define streq(a, b) (strcmp ((a), (b)) == 0) +#define strneq(a, b, n) (strncmp ((a), (b), (n)) == 0) -static int ecoff_get_magic - PARAMS ((bfd *)); -static long ecoff_sec_to_styp_flags - PARAMS ((const char *, flagword)); -static bfd_boolean ecoff_slurp_symbolic_header - PARAMS ((bfd *)); -static bfd_boolean ecoff_set_symbol_info - PARAMS ((bfd *, SYMR *, asymbol *, int, int)); -static void ecoff_emit_aggregate - PARAMS ((bfd *, FDR *, char *, RNDXR *, long, const char *)); -static char *ecoff_type_to_string - PARAMS ((bfd *, FDR *, unsigned int)); -static bfd_boolean ecoff_slurp_reloc_table - PARAMS ((bfd *, asection *, asymbol **)); -static int ecoff_sort_hdrs - PARAMS ((const PTR, const PTR)); -static bfd_boolean ecoff_compute_section_file_positions - PARAMS ((bfd *)); -static bfd_size_type ecoff_compute_reloc_file_positions - PARAMS ((bfd *)); -static bfd_boolean ecoff_get_extr - PARAMS ((asymbol *, EXTR *)); -static void ecoff_set_index - PARAMS ((asymbol *, bfd_size_type)); -static unsigned int ecoff_armap_hash - PARAMS ((const char *, unsigned int *, unsigned int, unsigned int)); /* This stuff is somewhat copied from coffcode.h. */ - static asection bfd_debug_section = { - /* name, id, index, next, flags, user_set_vma, reloc_done, */ - "*DEBUG*", 0, 0, NULL, 0, 0, 0, - /* linker_mark, linker_has_input, gc_mark, segment_mark, */ - 0, 0, 0, 0, - /* sec_info_type, use_rela_p, has_tls_reloc, */ - 0, 0, 0, - /* need_finalize_relax, has_gp_reloc, */ - 0, 0, - /* flag13, flag14, flag15, flag16, flag20, flag24, */ - 0, 0, 0, 0, 0, 0, - /* vma, lma, _cooked_size, _raw_size, */ - 0, 0, 0, 0, + /* name, id, index, next, prev, flags, user_set_vma, */ + "*DEBUG*", 0, 0, NULL, NULL, 0, 0, + /* linker_mark, linker_has_input, gc_mark, gc_mark_from_eh, */ + 0, 0, 1, 0, + /* segment_mark, sec_info_type, use_rela_p, has_tls_reloc, */ + 0, 0, 0, 0, + /* has_gp_reloc, need_finalize_relax, reloc_done, */ + 0, 0, 0, + /* vma, lma, size, rawsize, */ + 0, 0, 0, 0, /* output_offset, output_section, alignment_power, */ 0, NULL, 0, /* relocation, orelocation, reloc_count, filepos, rel_filepos, */ NULL, NULL, 0, 0, 0, /* line_filepos, userdata, contents, lineno, lineno_count, */ 0, NULL, NULL, NULL, 0, - /* entsize, comdat, kept_section, moving_line_filepos, */ - 0, NULL, NULL, 0, + /* entsize, kept_section, moving_line_filepos, */ + 0, NULL, 0, /* target_index, used_by_bfd, constructor_chain, owner, */ 0, NULL, NULL, NULL, /* symbol, */ - (struct bfd_symbol *) NULL, + NULL, /* symbol_ptr_ptr, */ - (struct bfd_symbol **) NULL, - /* link_order_head, link_order_tail */ - NULL, NULL + NULL, + /* map_head, map_tail */ + { NULL }, { NULL } }; /* Create an ECOFF object. */ bfd_boolean -_bfd_ecoff_mkobject (abfd) - bfd *abfd; +_bfd_ecoff_mkobject (bfd *abfd) { bfd_size_type amt = sizeof (ecoff_data_type); - abfd->tdata.ecoff_obj_data = (struct ecoff_tdata *) bfd_zalloc (abfd, amt); + abfd->tdata.ecoff_obj_data = bfd_zalloc (abfd, amt); if (abfd->tdata.ecoff_obj_data == NULL) return FALSE; @@ -125,11 +97,8 @@ _bfd_ecoff_mkobject (abfd) /* This is a hook called by coff_real_object_p to create any backend specific information. */ -PTR -_bfd_ecoff_mkobject_hook (abfd, filehdr, aouthdr) - bfd *abfd; - PTR filehdr; - PTR aouthdr; +void * +_bfd_ecoff_mkobject_hook (bfd *abfd, void * filehdr, void * aouthdr) { struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr; struct internal_aouthdr *internal_a = (struct internal_aouthdr *) aouthdr; @@ -142,7 +111,7 @@ _bfd_ecoff_mkobject_hook (abfd, filehdr, aouthdr) ecoff->gp_size = 8; ecoff->sym_filepos = internal_f->f_symptr; - if (internal_a != (struct internal_aouthdr *) NULL) + if (internal_a != NULL) { int i; @@ -165,37 +134,48 @@ _bfd_ecoff_mkobject_hook (abfd, filehdr, aouthdr) fprmask) and let the swapping routines ensure that only relevant information is written out. */ - return (PTR) ecoff; + return (void *) ecoff; } /* Initialize a new section. */ bfd_boolean -_bfd_ecoff_new_section_hook (abfd, section) - bfd *abfd ATTRIBUTE_UNUSED; - asection *section; +_bfd_ecoff_new_section_hook (bfd *abfd ATTRIBUTE_UNUSED, + asection *section) { + unsigned int i; + static struct + { + const char * name; + flagword flags; + } + section_flags [] = + { + { _TEXT, SEC_ALLOC | SEC_CODE | SEC_LOAD }, + { _INIT, SEC_ALLOC | SEC_CODE | SEC_LOAD }, + { _FINI, SEC_ALLOC | SEC_CODE | SEC_LOAD }, + { _DATA, SEC_ALLOC | SEC_DATA | SEC_LOAD }, + { _SDATA, SEC_ALLOC | SEC_DATA | SEC_LOAD }, + { _RDATA, SEC_ALLOC | SEC_DATA | SEC_LOAD | SEC_READONLY}, + { _LIT8, SEC_ALLOC | SEC_DATA | SEC_LOAD | SEC_READONLY}, + { _LIT4, SEC_ALLOC | SEC_DATA | SEC_LOAD | SEC_READONLY}, + { _RCONST, SEC_ALLOC | SEC_DATA | SEC_LOAD | SEC_READONLY}, + { _PDATA, SEC_ALLOC | SEC_DATA | SEC_LOAD | SEC_READONLY}, + { _BSS, SEC_ALLOC}, + { _SBSS, SEC_ALLOC}, + /* An Irix 4 shared libary. */ + { _LIB, SEC_COFF_SHARED_LIBRARY} + }; + section->alignment_power = 4; - if (strcmp (section->name, _TEXT) == 0 - || strcmp (section->name, _INIT) == 0 - || strcmp (section->name, _FINI) == 0) - section->flags |= SEC_CODE | SEC_LOAD | SEC_ALLOC; - else if (strcmp (section->name, _DATA) == 0 - || strcmp (section->name, _SDATA) == 0) - section->flags |= SEC_DATA | SEC_LOAD | SEC_ALLOC; - else if (strcmp (section->name, _RDATA) == 0 - || strcmp (section->name, _LIT8) == 0 - || strcmp (section->name, _LIT4) == 0 - || strcmp (section->name, _RCONST) == 0 - || strcmp (section->name, _PDATA) == 0) - section->flags |= SEC_DATA | SEC_LOAD | SEC_ALLOC | SEC_READONLY; - else if (strcmp (section->name, _BSS) == 0 - || strcmp (section->name, _SBSS) == 0) - section->flags |= SEC_ALLOC; - else if (strcmp (section->name, _LIB) == 0) - /* An Irix 4 shared libary. */ - section->flags |= SEC_COFF_SHARED_LIBRARY; + for (i = 0; i < ARRAY_SIZE (section_flags); i++) + if (streq (section->name, section_flags[i].name)) + { + section->flags |= section_flags[i].flags; + break; + } + /* Probably any other section name is SEC_NEVER_LOAD, but I'm uncertain about .init on some systems and I don't know how shared @@ -210,11 +190,9 @@ _bfd_ecoff_new_section_hook (abfd, section) for each target, but there aren't all that many ECOFF targets. */ bfd_boolean -_bfd_ecoff_set_arch_mach_hook (abfd, filehdr) - bfd *abfd; - PTR filehdr; +_bfd_ecoff_set_arch_mach_hook (bfd *abfd, void * filehdr) { - struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr; + struct internal_filehdr *internal_f = filehdr; enum bfd_architecture arch; unsigned long mach; @@ -259,8 +237,7 @@ _bfd_ecoff_set_arch_mach_hook (abfd, filehdr) This is the inverse of _bfd_ecoff_set_arch_mach_hook, above. */ static int -ecoff_get_magic (abfd) - bfd *abfd; +ecoff_get_magic (bfd *abfd) { int big, little; @@ -301,75 +278,67 @@ ecoff_get_magic (abfd) /* Get the section s_flags to use for a section. */ static long -ecoff_sec_to_styp_flags (name, flags) - const char *name; - flagword flags; +ecoff_sec_to_styp_flags (const char *name, flagword flags) { - long styp; + unsigned int i; + static struct + { + const char * name; + long flags; + } + styp_flags [] = + { + { _TEXT, STYP_TEXT }, + { _DATA, STYP_DATA }, + { _SDATA, STYP_SDATA }, + { _RDATA, STYP_RDATA }, + { _LITA, STYP_LITA }, + { _LIT8, STYP_LIT8 }, + { _LIT4, STYP_LIT4 }, + { _BSS, STYP_BSS }, + { _SBSS, STYP_SBSS }, + { _INIT, STYP_ECOFF_INIT }, + { _FINI, STYP_ECOFF_FINI }, + { _PDATA, STYP_PDATA }, + { _XDATA, STYP_XDATA }, + { _LIB, STYP_ECOFF_LIB }, + { _GOT, STYP_GOT }, + { _HASH, STYP_HASH }, + { _DYNAMIC, STYP_DYNAMIC }, + { _LIBLIST, STYP_LIBLIST }, + { _RELDYN, STYP_RELDYN }, + { _CONFLIC, STYP_CONFLIC }, + { _DYNSTR, STYP_DYNSTR }, + { _DYNSYM, STYP_DYNSYM }, + { _RCONST, STYP_RCONST } + }; + long styp = 0; - styp = 0; + for (i = 0; i < ARRAY_SIZE (styp_flags); i++) + if (streq (name, styp_flags[i].name)) + { + styp = styp_flags[i].flags; + break; + } - if (strcmp (name, _TEXT) == 0) - styp = STYP_TEXT; - else if (strcmp (name, _DATA) == 0) - styp = STYP_DATA; - else if (strcmp (name, _SDATA) == 0) - styp = STYP_SDATA; - else if (strcmp (name, _RDATA) == 0) - styp = STYP_RDATA; - else if (strcmp (name, _LITA) == 0) - styp = STYP_LITA; - else if (strcmp (name, _LIT8) == 0) - styp = STYP_LIT8; - else if (strcmp (name, _LIT4) == 0) - styp = STYP_LIT4; - else if (strcmp (name, _BSS) == 0) - styp = STYP_BSS; - else if (strcmp (name, _SBSS) == 0) - styp = STYP_SBSS; - else if (strcmp (name, _INIT) == 0) - styp = STYP_ECOFF_INIT; - else if (strcmp (name, _FINI) == 0) - styp = STYP_ECOFF_FINI; - else if (strcmp (name, _PDATA) == 0) - styp = STYP_PDATA; - else if (strcmp (name, _XDATA) == 0) - styp = STYP_XDATA; - else if (strcmp (name, _LIB) == 0) - styp = STYP_ECOFF_LIB; - else if (strcmp (name, _GOT) == 0) - styp = STYP_GOT; - else if (strcmp (name, _HASH) == 0) - styp = STYP_HASH; - else if (strcmp (name, _DYNAMIC) == 0) - styp = STYP_DYNAMIC; - else if (strcmp (name, _LIBLIST) == 0) - styp = STYP_LIBLIST; - else if (strcmp (name, _RELDYN) == 0) - styp = STYP_RELDYN; - else if (strcmp (name, _CONFLIC) == 0) - styp = STYP_CONFLIC; - else if (strcmp (name, _DYNSTR) == 0) - styp = STYP_DYNSTR; - else if (strcmp (name, _DYNSYM) == 0) - styp = STYP_DYNSYM; - else if (strcmp (name, _COMMENT) == 0) + if (styp == 0) { - styp = STYP_COMMENT; - flags &=~ SEC_NEVER_LOAD; + if (streq (name, _COMMENT)) + { + styp = STYP_COMMENT; + flags &=~ SEC_NEVER_LOAD; + } + else if (flags & SEC_CODE) + styp = STYP_TEXT; + else if (flags & SEC_DATA) + styp = STYP_DATA; + else if (flags & SEC_READONLY) + styp = STYP_RDATA; + else if (flags & SEC_LOAD) + styp = STYP_REG; + else + styp = STYP_BSS; } - else if (strcmp (name, _RCONST) == 0) - styp = STYP_RCONST; - else if (flags & SEC_CODE) - styp = STYP_TEXT; - else if (flags & SEC_DATA) - styp = STYP_DATA; - else if (flags & SEC_READONLY) - styp = STYP_RDATA; - else if (flags & SEC_LOAD) - styp = STYP_REG; - else - styp = STYP_BSS; if (flags & SEC_NEVER_LOAD) styp |= STYP_NOLOAD; @@ -380,14 +349,13 @@ ecoff_sec_to_styp_flags (name, flags) /* Get the BFD flags to use for a section. */ bfd_boolean -_bfd_ecoff_styp_to_sec_flags (abfd, hdr, name, section, flags_ptr) - bfd *abfd ATTRIBUTE_UNUSED; - PTR hdr; - const char *name ATTRIBUTE_UNUSED; - asection *section ATTRIBUTE_UNUSED; - flagword * flags_ptr; +_bfd_ecoff_styp_to_sec_flags (bfd *abfd ATTRIBUTE_UNUSED, + void * hdr, + const char *name ATTRIBUTE_UNUSED, + asection *section ATTRIBUTE_UNUSED, + flagword * flags_ptr) { - struct internal_scnhdr *internal_s = (struct internal_scnhdr *) hdr; + struct internal_scnhdr *internal_s = hdr; long styp_flags = internal_s->s_flags; flagword sec_flags = 0; @@ -450,12 +418,11 @@ _bfd_ecoff_styp_to_sec_flags (abfd, hdr, name, section, flags_ptr) /* Read in the symbolic header for an ECOFF object file. */ static bfd_boolean -ecoff_slurp_symbolic_header (abfd) - bfd *abfd; +ecoff_slurp_symbolic_header (bfd *abfd) { const struct ecoff_backend_data * const backend = ecoff_backend (abfd); bfd_size_type external_hdr_size; - PTR raw = NULL; + void * raw = NULL; HDRR *internal_symhdr; /* See if we've already read it in. */ @@ -482,7 +449,7 @@ ecoff_slurp_symbolic_header (abfd) } /* Read the symbolic information header. */ - raw = (PTR) bfd_malloc (external_hdr_size); + raw = bfd_malloc (external_hdr_size); if (raw == NULL) goto error_return; @@ -516,16 +483,15 @@ ecoff_slurp_symbolic_header (abfd) point in the backend structure. */ bfd_boolean -_bfd_ecoff_slurp_symbolic_info (abfd, ignore, debug) - bfd *abfd; - asection *ignore ATTRIBUTE_UNUSED; - struct ecoff_debug_info *debug; +_bfd_ecoff_slurp_symbolic_info (bfd *abfd, + asection *ignore ATTRIBUTE_UNUSED, + struct ecoff_debug_info *debug) { const struct ecoff_backend_data * const backend = ecoff_backend (abfd); HDRR *internal_symhdr; bfd_size_type raw_base; bfd_size_type raw_size; - PTR raw; + void * raw; bfd_size_type external_fdr_size; char *fraw_src; char *fraw_end; @@ -539,7 +505,7 @@ _bfd_ecoff_slurp_symbolic_info (abfd, ignore, debug) /* Check whether we've already gotten it, and whether there's any to get. */ - if (ecoff_data (abfd)->raw_syments != (PTR) NULL) + if (ecoff_data (abfd)->raw_syments != NULL) return TRUE; if (ecoff_data (abfd)->sym_filepos == 0) { @@ -573,7 +539,7 @@ _bfd_ecoff_slurp_symbolic_info (abfd, ignore, debug) UPDATE_RAW_END (cbPdOffset, ipdMax, backend->debug_swap.external_pdr_size); UPDATE_RAW_END (cbSymOffset, isymMax, backend->debug_swap.external_sym_size); /* eraxxon@alumni.rice.edu: ioptMax refers to the size of the - optimization symtab, not the number of entries */ + optimization symtab, not the number of entries. */ UPDATE_RAW_END (cbOptOffset, ioptMax, sizeof (char)); UPDATE_RAW_END (cbAuxOffset, iauxMax, sizeof (union aux_ext)); UPDATE_RAW_END (cbSsOffset, issMax, sizeof (char)); @@ -590,7 +556,7 @@ _bfd_ecoff_slurp_symbolic_info (abfd, ignore, debug) ecoff_data (abfd)->sym_filepos = 0; return TRUE; } - raw = (PTR) bfd_alloc (abfd, raw_size); + raw = bfd_alloc (abfd, raw_size); if (raw == NULL) return FALSE; @@ -606,25 +572,25 @@ _bfd_ecoff_slurp_symbolic_info (abfd, ignore, debug) ecoff_data (abfd)->raw_syments = raw; /* Get pointers for the numeric offsets in the HDRR structure. */ -#define FIX(off1, off2, type) \ - if (internal_symhdr->off1 == 0) \ - debug->off2 = (type) NULL; \ - else \ - debug->off2 = (type) ((char *) raw \ - + (internal_symhdr->off1 \ +#define FIX(off1, off2, type) \ + if (internal_symhdr->off1 == 0) \ + debug->off2 = NULL; \ + else \ + debug->off2 = (type) ((char *) raw \ + + (internal_symhdr->off1 \ - raw_base)) FIX (cbLineOffset, line, unsigned char *); - FIX (cbDnOffset, external_dnr, PTR); - FIX (cbPdOffset, external_pdr, PTR); - FIX (cbSymOffset, external_sym, PTR); - FIX (cbOptOffset, external_opt, PTR); + FIX (cbDnOffset, external_dnr, void *); + FIX (cbPdOffset, external_pdr, void *); + FIX (cbSymOffset, external_sym, void *); + FIX (cbOptOffset, external_opt, void *); FIX (cbAuxOffset, external_aux, union aux_ext *); FIX (cbSsOffset, ss, char *); FIX (cbSsExtOffset, ssext, char *); - FIX (cbFdOffset, external_fdr, PTR); - FIX (cbRfdOffset, external_rfd, PTR); - FIX (cbExtOffset, external_ext, PTR); + FIX (cbFdOffset, external_fdr, void *); + FIX (cbRfdOffset, external_rfd, void *); + FIX (cbExtOffset, external_ext, void *); #undef FIX /* I don't want to always swap all the data, because it will just @@ -637,7 +603,7 @@ _bfd_ecoff_slurp_symbolic_info (abfd, ignore, debug) the symbols, so we swap them here. */ amt = internal_symhdr->ifdMax; amt *= sizeof (struct fdr); - debug->fdr = (struct fdr *) bfd_alloc (abfd, amt); + debug->fdr = bfd_alloc (abfd, amt); if (debug->fdr == NULL) return FALSE; external_fdr_size = backend->debug_swap.external_fdr_size; @@ -645,7 +611,7 @@ _bfd_ecoff_slurp_symbolic_info (abfd, ignore, debug) fraw_src = (char *) debug->external_fdr; fraw_end = fraw_src + internal_symhdr->ifdMax * external_fdr_size; for (; fraw_src < fraw_end; fraw_src += external_fdr_size, fdr_ptr++) - (*backend->debug_swap.swap_fdr_in) (abfd, (PTR) fraw_src, fdr_ptr); + (*backend->debug_swap.swap_fdr_in) (abfd, (void *) fraw_src, fdr_ptr); return TRUE; } @@ -665,17 +631,16 @@ static asymbol *ecoff_scom_symbol_ptr; /* Create an empty symbol. */ asymbol * -_bfd_ecoff_make_empty_symbol (abfd) - bfd *abfd; +_bfd_ecoff_make_empty_symbol (bfd *abfd) { ecoff_symbol_type *new; bfd_size_type amt = sizeof (ecoff_symbol_type); - new = (ecoff_symbol_type *) bfd_zalloc (abfd, amt); - if (new == (ecoff_symbol_type *) NULL) - return (asymbol *) NULL; - new->symbol.section = (asection *) NULL; - new->fdr = (FDR *) NULL; + new = bfd_zalloc (abfd, amt); + if (new == NULL) + return NULL; + new->symbol.section = NULL; + new->fdr = NULL; new->local = FALSE; new->native = NULL; new->symbol.the_bfd = abfd; @@ -685,12 +650,11 @@ _bfd_ecoff_make_empty_symbol (abfd) /* Set the BFD flags and section for an ECOFF symbol. */ static bfd_boolean -ecoff_set_symbol_info (abfd, ecoff_sym, asym, ext, weak) - bfd *abfd; - SYMR *ecoff_sym; - asymbol *asym; - int ext; - int weak; +ecoff_set_symbol_info (bfd *abfd, + SYMR *ecoff_sym, + asymbol *asym, + int ext, + int weak) { asym->the_bfd = abfd; asym->value = ecoff_sym->value; @@ -750,15 +714,15 @@ ecoff_set_symbol_info (abfd, ecoff_sym, asym, ext, weak) asym->flags = BSF_LOCAL; break; case scText: - asym->section = bfd_make_section_old_way (abfd, ".text"); + asym->section = bfd_make_section_old_way (abfd, _TEXT); asym->value -= asym->section->vma; break; case scData: - asym->section = bfd_make_section_old_way (abfd, ".data"); + asym->section = bfd_make_section_old_way (abfd, _DATA); asym->value -= asym->section->vma; break; case scBss: - asym->section = bfd_make_section_old_way (abfd, ".bss"); + asym->section = bfd_make_section_old_way (abfd, _BSS); asym->value -= asym->section->vma; break; case scRegister: @@ -864,77 +828,8 @@ ecoff_set_symbol_info (abfd, ecoff_sym, asym, ext, weak) case N_SETT: case N_SETD: case N_SETB: - { - /* This code is no longer needed. It used to be used to - make the linker handle set symbols, but they are now - handled in the add_symbols routine instead. */ -#if 0 - const char *name; - asection *section; - arelent_chain *reloc_chain; - unsigned int bitsize; - bfd_size_type amt; - - /* Get a section with the same name as the symbol (usually - __CTOR_LIST__ or __DTOR_LIST__). FIXME: gcc uses the - name ___CTOR_LIST (three underscores). We need - __CTOR_LIST (two underscores), since ECOFF doesn't use - a leading underscore. This should be handled by gcc, - but instead we do it here. Actually, this should all - be done differently anyhow. */ - name = bfd_asymbol_name (asym); - if (name[0] == '_' && name[1] == '_' && name[2] == '_') - { - ++name; - asym->name = name; - } - section = bfd_get_section_by_name (abfd, name); - if (section == (asection *) NULL) - { - char *copy; - - amt = strlen (name) + 1; - copy = (char *) bfd_alloc (abfd, amt); - if (!copy) - return FALSE; - strcpy (copy, name); - section = bfd_make_section (abfd, copy); - } - - /* Build a reloc pointing to this constructor. */ - amt = sizeof (arelent_chain); - reloc_chain = (arelent_chain *) bfd_alloc (abfd, amt); - if (!reloc_chain) - return FALSE; - reloc_chain->relent.sym_ptr_ptr = - bfd_get_section (asym)->symbol_ptr_ptr; - reloc_chain->relent.address = section->_raw_size; - reloc_chain->relent.addend = asym->value; - reloc_chain->relent.howto = - ecoff_backend (abfd)->constructor_reloc; - - /* Set up the constructor section to hold the reloc. */ - section->flags = SEC_CONSTRUCTOR; - ++section->reloc_count; - - /* Constructor sections must be rounded to a boundary - based on the bitsize. These are not real sections-- - they are handled specially by the linker--so the ECOFF - 16 byte alignment restriction does not apply. */ - bitsize = ecoff_backend (abfd)->constructor_bitsize; - section->alignment_power = 1; - while ((1 << section->alignment_power) < bitsize / 8) - ++section->alignment_power; - - reloc_chain->next = section->constructor_chain; - section->constructor_chain = reloc_chain; - section->_raw_size += bitsize / 8; - -#endif /* 0 */ - - /* Mark the symbol as a constructor. */ - asym->flags |= BSF_CONSTRUCTOR; - } + /* Mark the symbol as a constructor. */ + asym->flags |= BSF_CONSTRUCTOR; break; } } @@ -944,17 +839,16 @@ ecoff_set_symbol_info (abfd, ecoff_sym, asym, ext, weak) /* Read an ECOFF symbol table. */ bfd_boolean -_bfd_ecoff_slurp_symbol_table (abfd) - bfd *abfd; +_bfd_ecoff_slurp_symbol_table (bfd *abfd) { const struct ecoff_backend_data * const backend = ecoff_backend (abfd); const bfd_size_type external_ext_size = backend->debug_swap.external_ext_size; const bfd_size_type external_sym_size = backend->debug_swap.external_sym_size; - void (* const swap_ext_in) PARAMS ((bfd *, PTR, EXTR *)) + void (* const swap_ext_in) (bfd *, void *, EXTR *) = backend->debug_swap.swap_ext_in; - void (* const swap_sym_in) PARAMS ((bfd *, PTR, SYMR *)) + void (* const swap_sym_in) (bfd *, void *, SYMR *) = backend->debug_swap.swap_sym_in; bfd_size_type internal_size; ecoff_symbol_type *internal; @@ -969,7 +863,7 @@ _bfd_ecoff_slurp_symbol_table (abfd) return TRUE; /* Get the symbolic information. */ - if (! _bfd_ecoff_slurp_symbolic_info (abfd, (asection *) NULL, + if (! _bfd_ecoff_slurp_symbolic_info (abfd, NULL, &ecoff_data (abfd)->debug_info)) return FALSE; if (bfd_get_symcount (abfd) == 0) @@ -977,7 +871,7 @@ _bfd_ecoff_slurp_symbol_table (abfd) internal_size = bfd_get_symcount (abfd); internal_size *= sizeof (ecoff_symbol_type); - internal = (ecoff_symbol_type *) bfd_alloc (abfd, internal_size); + internal = bfd_alloc (abfd, internal_size); if (internal == NULL) return FALSE; @@ -990,7 +884,7 @@ _bfd_ecoff_slurp_symbol_table (abfd) { EXTR internal_esym; - (*swap_ext_in) (abfd, (PTR) eraw_src, &internal_esym); + (*swap_ext_in) (abfd, (void *) eraw_src, &internal_esym); internal_ptr->symbol.name = (ecoff_data (abfd)->debug_info.ssext + internal_esym.asym.iss); if (!ecoff_set_symbol_info (abfd, &internal_esym.asym, @@ -1004,7 +898,7 @@ _bfd_ecoff_slurp_symbol_table (abfd) else internal_ptr->fdr = NULL; internal_ptr->local = FALSE; - internal_ptr->native = (PTR) eraw_src; + internal_ptr->native = (void *) eraw_src; } /* The local symbols must be accessed via the fdr's, because the @@ -1025,7 +919,7 @@ _bfd_ecoff_slurp_symbol_table (abfd) { SYMR internal_sym; - (*swap_sym_in) (abfd, (PTR) lraw_src, &internal_sym); + (*swap_sym_in) (abfd, (void *) lraw_src, &internal_sym); internal_ptr->symbol.name = (ecoff_data (abfd)->debug_info.ss + fdr_ptr->issBase + internal_sym.iss); @@ -1034,7 +928,7 @@ _bfd_ecoff_slurp_symbol_table (abfd) return FALSE; internal_ptr->fdr = fdr_ptr; internal_ptr->local = TRUE; - internal_ptr->native = (PTR) lraw_src; + internal_ptr->native = (void *) lraw_src; } } @@ -1046,10 +940,9 @@ _bfd_ecoff_slurp_symbol_table (abfd) /* Return the amount of space needed for the canonical symbols. */ long -_bfd_ecoff_get_symtab_upper_bound (abfd) - bfd *abfd; +_bfd_ecoff_get_symtab_upper_bound (bfd *abfd) { - if (! _bfd_ecoff_slurp_symbolic_info (abfd, (asection *) NULL, + if (! _bfd_ecoff_slurp_symbolic_info (abfd, NULL, &ecoff_data (abfd)->debug_info)) return -1; @@ -1062,9 +955,7 @@ _bfd_ecoff_get_symtab_upper_bound (abfd) /* Get the canonical symbols. */ long -_bfd_ecoff_canonicalize_symtab (abfd, alocation) - bfd *abfd; - asymbol **alocation; +_bfd_ecoff_canonicalize_symtab (bfd *abfd, asymbol **alocation) { unsigned int counter = 0; ecoff_symbol_type *symbase; @@ -1081,7 +972,7 @@ _bfd_ecoff_canonicalize_symtab (abfd, alocation) *(location++) = symbase++; counter++; } - *location++ = (ecoff_symbol_type *) NULL; + *location++ = NULL; return bfd_get_symcount (abfd); } @@ -1092,13 +983,12 @@ _bfd_ecoff_canonicalize_symtab (abfd, alocation) /* Write aggregate information to a string. */ static void -ecoff_emit_aggregate (abfd, fdr, string, rndx, isym, which) - bfd *abfd; - FDR *fdr; - char *string; - RNDXR *rndx; - long isym; - const char *which; +ecoff_emit_aggregate (bfd *abfd, + FDR *fdr, + char *string, + RNDXR *rndx, + long isym, + const char *which) { const struct ecoff_debug_swap * const debug_swap = &ecoff_backend (abfd)->debug_swap; @@ -1155,15 +1045,13 @@ ecoff_emit_aggregate (abfd, fdr, string, rndx, isym, which) /* Convert the type information to string format. */ static char * -ecoff_type_to_string (abfd, fdr, indx) - bfd *abfd; - FDR *fdr; - unsigned int indx; +ecoff_type_to_string (bfd *abfd, FDR *fdr, unsigned int indx) { union aux_ext *aux_ptr; int bigendian; AUXU u; - struct qual { + struct qual + { unsigned int type; int low_bound; int high_bound; @@ -1452,10 +1340,9 @@ ecoff_type_to_string (abfd, fdr, indx) /* Return information about ECOFF symbol SYMBOL in RET. */ void -_bfd_ecoff_get_symbol_info (abfd, symbol, ret) - bfd *abfd ATTRIBUTE_UNUSED; - asymbol *symbol; - symbol_info *ret; +_bfd_ecoff_get_symbol_info (bfd *abfd ATTRIBUTE_UNUSED, + asymbol *symbol, + symbol_info *ret) { bfd_symbol_info (symbol, ret); } @@ -1463,9 +1350,8 @@ _bfd_ecoff_get_symbol_info (abfd, symbol, ret) /* Return whether this is a local label. */ bfd_boolean -_bfd_ecoff_bfd_is_local_label_name (abfd, name) - bfd *abfd ATTRIBUTE_UNUSED; - const char *name; +_bfd_ecoff_bfd_is_local_label_name (bfd *abfd ATTRIBUTE_UNUSED, + const char *name) { return name[0] == '$'; } @@ -1473,11 +1359,10 @@ _bfd_ecoff_bfd_is_local_label_name (abfd, name) /* Print information about an ECOFF symbol. */ void -_bfd_ecoff_print_symbol (abfd, filep, symbol, how) - bfd *abfd; - PTR filep; - asymbol *symbol; - bfd_print_symbol_type how; +_bfd_ecoff_print_symbol (bfd *abfd, + void * filep, + asymbol *symbol, + bfd_print_symbol_type how) { const struct ecoff_debug_swap * const debug_swap = &ecoff_backend (abfd)->debug_swap; @@ -1662,10 +1547,9 @@ _bfd_ecoff_print_symbol (abfd, filep, symbol, how) /* Read in the relocs for a section. */ static bfd_boolean -ecoff_slurp_reloc_table (abfd, section, symbols) - bfd *abfd; - asection *section; - asymbol **symbols; +ecoff_slurp_reloc_table (bfd *abfd, + asection *section, + asymbol **symbols) { const struct ecoff_backend_data * const backend = ecoff_backend (abfd); arelent *internal_relocs; @@ -1675,7 +1559,7 @@ ecoff_slurp_reloc_table (abfd, section, symbols) arelent *rptr; unsigned int i; - if (section->relocation != (arelent *) NULL + if (section->relocation != NULL || section->reloc_count == 0 || (section->flags & SEC_CONSTRUCTOR) != 0) return TRUE; @@ -1685,13 +1569,12 @@ ecoff_slurp_reloc_table (abfd, section, symbols) amt = section->reloc_count; amt *= sizeof (arelent); - internal_relocs = (arelent *) bfd_alloc (abfd, amt); + internal_relocs = bfd_alloc (abfd, amt); external_reloc_size = backend->external_reloc_size; amt = external_reloc_size * section->reloc_count; - external_relocs = (char *) bfd_alloc (abfd, amt); - if (internal_relocs == (arelent *) NULL - || external_relocs == (char *) NULL) + external_relocs = bfd_alloc (abfd, amt); + if (internal_relocs == NULL || external_relocs == NULL) return FALSE; if (bfd_seek (abfd, section->rel_filepos, SEEK_SET) != 0) return FALSE; @@ -1730,25 +1613,25 @@ ecoff_slurp_reloc_table (abfd, section, symbols) /* r_symndx is a section key. */ switch (intern.r_symndx) { - case RELOC_SECTION_TEXT: sec_name = ".text"; break; - case RELOC_SECTION_RDATA: sec_name = ".rdata"; break; - case RELOC_SECTION_DATA: sec_name = ".data"; break; - case RELOC_SECTION_SDATA: sec_name = ".sdata"; break; - case RELOC_SECTION_SBSS: sec_name = ".sbss"; break; - case RELOC_SECTION_BSS: sec_name = ".bss"; break; - case RELOC_SECTION_INIT: sec_name = ".init"; break; - case RELOC_SECTION_LIT8: sec_name = ".lit8"; break; - case RELOC_SECTION_LIT4: sec_name = ".lit4"; break; - case RELOC_SECTION_XDATA: sec_name = ".xdata"; break; - case RELOC_SECTION_PDATA: sec_name = ".pdata"; break; - case RELOC_SECTION_FINI: sec_name = ".fini"; break; - case RELOC_SECTION_LITA: sec_name = ".lita"; break; - case RELOC_SECTION_RCONST: sec_name = ".rconst"; break; + case RELOC_SECTION_TEXT: sec_name = _TEXT; break; + case RELOC_SECTION_RDATA: sec_name = _RDATA; break; + case RELOC_SECTION_DATA: sec_name = _DATA; break; + case RELOC_SECTION_SDATA: sec_name = _SDATA; break; + case RELOC_SECTION_SBSS: sec_name = _SBSS; break; + case RELOC_SECTION_BSS: sec_name = _BSS; break; + case RELOC_SECTION_INIT: sec_name = _INIT; break; + case RELOC_SECTION_LIT8: sec_name = _LIT8; break; + case RELOC_SECTION_LIT4: sec_name = _LIT4; break; + case RELOC_SECTION_XDATA: sec_name = _XDATA; break; + case RELOC_SECTION_PDATA: sec_name = _PDATA; break; + case RELOC_SECTION_FINI: sec_name = _FINI; break; + case RELOC_SECTION_LITA: sec_name = _LITA; break; + case RELOC_SECTION_RCONST: sec_name = _RCONST; break; default: abort (); } sec = bfd_get_section_by_name (abfd, sec_name); - if (sec == (asection *) NULL) + if (sec == NULL) abort (); rptr->sym_ptr_ptr = sec->symbol_ptr_ptr; @@ -1772,11 +1655,10 @@ ecoff_slurp_reloc_table (abfd, section, symbols) /* Get a canonical list of relocs. */ long -_bfd_ecoff_canonicalize_reloc (abfd, section, relptr, symbols) - bfd *abfd; - asection *section; - arelent **relptr; - asymbol **symbols; +_bfd_ecoff_canonicalize_reloc (bfd *abfd, + asection *section, + arelent **relptr, + asymbol **symbols) { unsigned int count; @@ -1805,7 +1687,7 @@ _bfd_ecoff_canonicalize_reloc (abfd, section, relptr, symbols) *relptr++ = tblptr++; } - *relptr = (arelent *) NULL; + *relptr = NULL; return section->reloc_count; } @@ -1815,15 +1697,13 @@ _bfd_ecoff_canonicalize_reloc (abfd, section, relptr, symbols) wanted location. */ bfd_boolean -_bfd_ecoff_find_nearest_line (abfd, section, ignore_symbols, offset, - filename_ptr, functionname_ptr, retline_ptr) - bfd *abfd; - asection *section; - asymbol **ignore_symbols ATTRIBUTE_UNUSED; - bfd_vma offset; - const char **filename_ptr; - const char **functionname_ptr; - unsigned int *retline_ptr; +_bfd_ecoff_find_nearest_line (bfd *abfd, + asection *section, + asymbol **ignore_symbols ATTRIBUTE_UNUSED, + bfd_vma offset, + const char **filename_ptr, + const char **functionname_ptr, + unsigned int *retline_ptr) { const struct ecoff_debug_swap * const debug_swap = &ecoff_backend (abfd)->debug_swap; @@ -1831,15 +1711,15 @@ _bfd_ecoff_find_nearest_line (abfd, section, ignore_symbols, offset, struct ecoff_find_line *line_info; /* Make sure we have the FDR's. */ - if (! _bfd_ecoff_slurp_symbolic_info (abfd, (asection *) NULL, debug_info) + if (! _bfd_ecoff_slurp_symbolic_info (abfd, NULL, debug_info) || bfd_get_symcount (abfd) == 0) return FALSE; if (ecoff_data (abfd)->find_line_info == NULL) { bfd_size_type amt = sizeof (struct ecoff_find_line); - ecoff_data (abfd)->find_line_info - = (struct ecoff_find_line *) bfd_zalloc (abfd, amt); + + ecoff_data (abfd)->find_line_info = bfd_zalloc (abfd, amt); if (ecoff_data (abfd)->find_line_info == NULL) return FALSE; } @@ -1864,13 +1744,11 @@ _bfd_ecoff_find_nearest_line (abfd, section, ignore_symbols, offset, information. */ bfd_boolean -_bfd_ecoff_bfd_copy_private_bfd_data (ibfd, obfd) - bfd *ibfd; - bfd *obfd; +_bfd_ecoff_bfd_copy_private_bfd_data (bfd *ibfd, bfd *obfd) { struct ecoff_debug_info *iinfo = &ecoff_data (ibfd)->debug_info; struct ecoff_debug_info *oinfo = &ecoff_data (obfd)->debug_info; - register int i; + int i; asymbol **sym_ptr_ptr; size_t c; bfd_boolean local; @@ -1894,7 +1772,7 @@ _bfd_ecoff_bfd_copy_private_bfd_data (ibfd, obfd) /* If there are no symbols, don't copy any debugging information. */ c = bfd_get_symcount (obfd); sym_ptr_ptr = bfd_get_outsymbols (obfd); - if (c == 0 || sym_ptr_ptr == (asymbol **) NULL) + if (c == 0 || sym_ptr_ptr == NULL) return TRUE; /* See if there are any local symbols. */ @@ -1974,10 +1852,9 @@ _bfd_ecoff_bfd_copy_private_bfd_data (ibfd, obfd) callers ignore the return value. */ bfd_boolean -_bfd_ecoff_set_arch_mach (abfd, arch, machine) - bfd *abfd; - enum bfd_architecture arch; - unsigned long machine; +_bfd_ecoff_set_arch_mach (bfd *abfd, + enum bfd_architecture arch, + unsigned long machine) { bfd_default_set_arch_mach (abfd, arch, machine); return arch == ecoff_backend (abfd)->arch; @@ -1986,9 +1863,7 @@ _bfd_ecoff_set_arch_mach (abfd, arch, machine) /* Get the size of the section headers. */ int -_bfd_ecoff_sizeof_headers (abfd, reloc) - bfd *abfd; - bfd_boolean reloc ATTRIBUTE_UNUSED; +_bfd_ecoff_sizeof_headers (bfd *abfd, bfd_boolean reloc ATTRIBUTE_UNUSED) { asection *current; int c; @@ -1996,7 +1871,7 @@ _bfd_ecoff_sizeof_headers (abfd, reloc) c = 0; for (current = abfd->sections; - current != (asection *)NULL; + current != NULL; current = current->next) ++c; @@ -2009,12 +1884,11 @@ _bfd_ecoff_sizeof_headers (abfd, reloc) /* Get the contents of a section. */ bfd_boolean -_bfd_ecoff_get_section_contents (abfd, section, location, offset, count) - bfd *abfd; - asection *section; - PTR location; - file_ptr offset; - bfd_size_type count; +_bfd_ecoff_get_section_contents (bfd *abfd, + asection *section, + void * location, + file_ptr offset, + bfd_size_type count) { return _bfd_generic_get_section_contents (abfd, section, location, offset, count); @@ -2024,9 +1898,7 @@ _bfd_ecoff_get_section_contents (abfd, section, location, offset, count) called via qsort. */ static int -ecoff_sort_hdrs (arg1, arg2) - const PTR arg1; - const PTR arg2; +ecoff_sort_hdrs (const void * arg1, const void * arg2) { const asection *hdr1 = *(const asection **) arg1; const asection *hdr2 = *(const asection **) arg2; @@ -2053,8 +1925,7 @@ ecoff_sort_hdrs (arg1, arg2) reloc_filepos. */ static bfd_boolean -ecoff_compute_section_file_positions (abfd) - bfd *abfd; +ecoff_compute_section_file_positions (bfd *abfd) { file_ptr sofar, file_sofar; asection **sorted_hdrs; @@ -2072,7 +1943,7 @@ ecoff_compute_section_file_positions (abfd) /* Sort the sections by VMA. */ amt = abfd->section_count; amt *= sizeof (asection *); - sorted_hdrs = (asection **) bfd_malloc (amt); + sorted_hdrs = bfd_malloc (amt); if (sorted_hdrs == NULL) return FALSE; for (current = abfd->sections, i = 0; @@ -2092,11 +1963,11 @@ ecoff_compute_section_file_positions (abfd) for (i = 0; i < abfd->section_count; i++) { current = sorted_hdrs[i]; - if (strcmp (current->name, _RDATA) == 0) + if (streq (current->name, _RDATA)) break; if ((current->flags & SEC_CODE) == 0 - && strcmp (current->name, _PDATA) != 0 - && strcmp (current->name, _RCONST) != 0) + && ! streq (current->name, _PDATA) + && ! streq (current->name, _RCONST)) { rdata_in_text = FALSE; break; @@ -2117,8 +1988,8 @@ ecoff_compute_section_file_positions (abfd) supposed to indicate the number of .pdata entries that are really in the section. Each entry is 8 bytes. We store this away in line_filepos before increasing the section size. */ - if (strcmp (current->name, _PDATA) == 0) - current->line_filepos = current->_raw_size / 8; + if (streq (current->name, _PDATA)) + current->line_filepos = current->size / 8; alignment_power = current->alignment_power; @@ -2133,15 +2004,15 @@ ecoff_compute_section_file_positions (abfd) && ! first_data && (current->flags & SEC_CODE) == 0 && (! rdata_in_text - || strcmp (current->name, _RDATA) != 0) - && strcmp (current->name, _PDATA) != 0 - && strcmp (current->name, _RCONST) != 0) + || ! streq (current->name, _RDATA)) + && ! streq (current->name, _PDATA) + && ! streq (current->name, _RCONST)) { sofar = (sofar + round - 1) &~ (round - 1); file_sofar = (file_sofar + round - 1) &~ (round - 1); first_data = FALSE; } - else if (strcmp (current->name, _LIB) == 0) + else if (streq (current->name, _LIB)) { /* On Irix 4, the location of contents of the .lib section from a shared library section is also rounded up to a @@ -2179,16 +2050,16 @@ ecoff_compute_section_file_positions (abfd) if ((current->flags & (SEC_HAS_CONTENTS | SEC_LOAD)) != 0) current->filepos = file_sofar; - sofar += current->_raw_size; + sofar += current->size; if ((current->flags & SEC_HAS_CONTENTS) != 0) - file_sofar += current->_raw_size; + file_sofar += current->size; /* Make sure that this section is of the right size too. */ old_sofar = sofar; sofar = BFD_ALIGN (sofar, 1 << alignment_power); if ((current->flags & SEC_HAS_CONTENTS) != 0) file_sofar = BFD_ALIGN (file_sofar, 1 << alignment_power); - current->_raw_size += sofar - old_sofar; + current->size += sofar - old_sofar; } free (sorted_hdrs); @@ -2204,8 +2075,7 @@ ecoff_compute_section_file_positions (abfd) information. */ static bfd_size_type -ecoff_compute_reloc_file_positions (abfd) - bfd *abfd; +ecoff_compute_reloc_file_positions (bfd *abfd) { const bfd_size_type external_reloc_size = ecoff_backend (abfd)->external_reloc_size; @@ -2225,7 +2095,7 @@ ecoff_compute_reloc_file_positions (abfd) reloc_size = 0; for (current = abfd->sections; - current != (asection *)NULL; + current != NULL; current = current->next) { if (current->reloc_count == 0) @@ -2259,26 +2129,23 @@ ecoff_compute_reloc_file_positions (abfd) /* Set the contents of a section. */ bfd_boolean -_bfd_ecoff_set_section_contents (abfd, section, location, offset, count) - bfd *abfd; - asection *section; - const PTR location; - file_ptr offset; - bfd_size_type count; +_bfd_ecoff_set_section_contents (bfd *abfd, + asection *section, + const void * location, + file_ptr offset, + bfd_size_type count) { file_ptr pos; /* This must be done first, because bfd_set_section_contents is going to set output_has_begun to TRUE. */ - if (! abfd->output_has_begun) - { - if (! ecoff_compute_section_file_positions (abfd)) - return FALSE; - } + if (! abfd->output_has_begun + && ! ecoff_compute_section_file_positions (abfd)) + return FALSE; /* Handle the .lib section specially so that Irix 4 shared libraries work out. See coff_set_section_contents in coffcode.h. */ - if (strcmp (section->name, _LIB) == 0) + if (streq (section->name, _LIB)) { bfd_byte *rec, *recend; @@ -2308,8 +2175,7 @@ _bfd_ecoff_set_section_contents (abfd, section, location, offset, count) nlmconv. */ bfd_vma -bfd_ecoff_get_gp_value (abfd) - bfd *abfd; +bfd_ecoff_get_gp_value (bfd *abfd) { if (bfd_get_flavour (abfd) != bfd_target_ecoff_flavour || bfd_get_format (abfd) != bfd_object) @@ -2325,9 +2191,7 @@ bfd_ecoff_get_gp_value (abfd) assembler. */ bfd_boolean -bfd_ecoff_set_gp_value (abfd, gp_value) - bfd *abfd; - bfd_vma gp_value; +bfd_ecoff_set_gp_value (bfd *abfd, bfd_vma gp_value) { if (bfd_get_flavour (abfd) != bfd_target_ecoff_flavour || bfd_get_format (abfd) != bfd_object) @@ -2345,11 +2209,10 @@ bfd_ecoff_set_gp_value (abfd, gp_value) the assembler. */ bfd_boolean -bfd_ecoff_set_regmasks (abfd, gprmask, fprmask, cprmask) - bfd *abfd; - unsigned long gprmask; - unsigned long fprmask; - unsigned long *cprmask; +bfd_ecoff_set_regmasks (bfd *abfd, + unsigned long gprmask, + unsigned long fprmask, + unsigned long *cprmask) { ecoff_data_type *tdata; @@ -2363,7 +2226,7 @@ bfd_ecoff_set_regmasks (abfd, gprmask, fprmask, cprmask) tdata = ecoff_data (abfd); tdata->gprmask = gprmask; tdata->fprmask = fprmask; - if (cprmask != (unsigned long *) NULL) + if (cprmask != NULL) { int i; @@ -2378,9 +2241,7 @@ bfd_ecoff_set_regmasks (abfd, gprmask, fprmask, cprmask) is passed to bfd_ecoff_debug_externals. */ static bfd_boolean -ecoff_get_extr (sym, esym) - asymbol *sym; - EXTR *esym; +ecoff_get_extr (asymbol *sym, EXTR *esym) { ecoff_symbol_type *ecoff_sym_ptr; bfd *input_bfd; @@ -2432,7 +2293,7 @@ ecoff_get_extr (sym, esym) input_debug = &ecoff_data (input_bfd)->debug_info; BFD_ASSERT (esym->ifd < input_debug->symbolic_header.ifdMax); - if (input_debug->ifdmap != (RFDT *) NULL) + if (input_debug->ifdmap != NULL) esym->ifd = input_debug->ifdmap[esym->ifd]; } @@ -2443,9 +2304,7 @@ ecoff_get_extr (sym, esym) bfd_ecoff_debug_externals. */ static void -ecoff_set_index (sym, indx) - asymbol *sym; - bfd_size_type indx; +ecoff_set_index (asymbol *sym, bfd_size_type indx) { ecoff_set_sym_index (sym, indx); } @@ -2453,8 +2312,7 @@ ecoff_set_index (sym, indx) /* Write out an ECOFF file. */ bfd_boolean -_bfd_ecoff_write_object_contents (abfd) - bfd *abfd; +_bfd_ecoff_write_object_contents (bfd *abfd) { const struct ecoff_backend_data * const backend = ecoff_backend (abfd); const bfd_vma round = backend->round; @@ -2464,11 +2322,9 @@ _bfd_ecoff_write_object_contents (abfd) const bfd_size_type external_hdr_size = backend->debug_swap.external_hdr_size; const bfd_size_type external_reloc_size = backend->external_reloc_size; - void (* const adjust_reloc_out) - PARAMS ((bfd *, const arelent *, struct internal_reloc *)) + void (* const adjust_reloc_out) (bfd *, const arelent *, struct internal_reloc *) = backend->adjust_reloc_out; - void (* const swap_reloc_out) - PARAMS ((bfd *, const struct internal_reloc *, PTR)) + void (* const swap_reloc_out) (bfd *, const struct internal_reloc *, void *) = backend->swap_reloc_out; struct ecoff_debug_info * const debug = &ecoff_data (abfd)->debug_info; HDRR * const symhdr = &debug->symbolic_header; @@ -2482,8 +2338,8 @@ _bfd_ecoff_write_object_contents (abfd) bfd_vma data_start; bfd_boolean set_data_start; bfd_size_type bss_size; - PTR buff = NULL; - PTR reloc_buff = NULL; + void * buff = NULL; + void * reloc_buff = NULL; struct internal_filehdr internal_f; struct internal_aouthdr internal_a; int i; @@ -2494,7 +2350,7 @@ _bfd_ecoff_write_object_contents (abfd) count = 1; for (current = abfd->sections; - current != (asection *)NULL; + current != NULL; current = current->next) { current->target_index = count; @@ -2518,12 +2374,13 @@ _bfd_ecoff_write_object_contents (abfd) file header, or a.out header. */ { bfd_size_type siz; + siz = scnhsz; if (siz < filhsz) siz = filhsz; if (siz < aoutsz) siz = aoutsz; - buff = (PTR) bfd_malloc (siz); + buff = bfd_malloc (siz); if (buff == NULL) goto error_return; } @@ -2531,8 +2388,9 @@ _bfd_ecoff_write_object_contents (abfd) internal_f.f_nscns = 0; if (bfd_seek (abfd, (file_ptr) (filhsz + aoutsz), SEEK_SET) != 0) goto error_return; + for (current = abfd->sections; - current != (asection *) NULL; + current != NULL; current = current->next) { struct internal_scnhdr section; @@ -2544,13 +2402,13 @@ _bfd_ecoff_write_object_contents (abfd) /* This seems to be correct for Irix 4 shared libraries. */ vma = bfd_get_section_vma (abfd, current); - if (strcmp (current->name, _LIB) == 0) + if (streq (current->name, _LIB)) section.s_vaddr = 0; else section.s_vaddr = vma; section.s_paddr = current->lma; - section.s_size = bfd_get_section_size_before_reloc (current); + section.s_size = current->size; /* If this section is unloadable then the scnptr will be 0. */ if ((current->flags & (SEC_LOAD | SEC_HAS_CONTENTS)) == 0) @@ -2566,7 +2424,7 @@ _bfd_ecoff_write_object_contents (abfd) want the linker to compute the best size to use, or something. I don't know what happens if the information is not present. */ - if (strcmp (current->name, _PDATA) != 0) + if (! streq (current->name, _PDATA)) section.s_lnnoptr = 0; else { @@ -2582,7 +2440,7 @@ _bfd_ecoff_write_object_contents (abfd) section.s_flags = ecoff_sec_to_styp_flags (current->name, current->flags); - if (bfd_coff_swap_scnhdr_out (abfd, (PTR) §ion, buff) == 0 + if (bfd_coff_swap_scnhdr_out (abfd, (void *) §ion, buff) == 0 || bfd_bwrite (buff, scnhsz, abfd) != scnhsz) goto error_return; @@ -2601,7 +2459,7 @@ _bfd_ecoff_write_object_contents (abfd) || (section.s_flags & STYP_ECOFF_FINI) != 0 || section.s_flags == STYP_RCONST) { - text_size += bfd_get_section_size_before_reloc (current); + text_size += current->size; if (! set_text_start || text_start > vma) { text_start = vma; @@ -2617,7 +2475,7 @@ _bfd_ecoff_write_object_contents (abfd) || section.s_flags == STYP_XDATA || (section.s_flags & STYP_GOT) != 0) { - data_size += bfd_get_section_size_before_reloc (current); + data_size += current->size; if (! set_data_start || data_start > vma) { data_start = vma; @@ -2626,7 +2484,7 @@ _bfd_ecoff_write_object_contents (abfd) } else if ((section.s_flags & STYP_BSS) != 0 || (section.s_flags & STYP_SBSS) != 0) - bss_size += bfd_get_section_size_before_reloc (current); + bss_size += current->size; else if (section.s_flags == 0 || (section.s_flags & STYP_ECOFF_LIB) != 0 || section.s_flags == STYP_COMMENT) @@ -2731,11 +2589,11 @@ _bfd_ecoff_write_object_contents (abfd) if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) goto error_return; - bfd_coff_swap_filehdr_out (abfd, (PTR) &internal_f, buff); + bfd_coff_swap_filehdr_out (abfd, (void *) &internal_f, buff); if (bfd_bwrite (buff, filhsz, abfd) != filhsz) goto error_return; - bfd_coff_swap_aouthdr_out (abfd, (PTR) &internal_a, buff); + bfd_coff_swap_aouthdr_out (abfd, (void *) &internal_a, buff); if (bfd_bwrite (buff, aoutsz, abfd) != aoutsz) goto error_return; @@ -2756,7 +2614,7 @@ _bfd_ecoff_write_object_contents (abfd) /* Write out the relocs. */ for (current = abfd->sections; - current != (asection *) NULL; + current != NULL; current = current->next) { arelent **reloc_ptr_ptr; @@ -2775,6 +2633,7 @@ _bfd_ecoff_write_object_contents (abfd) reloc_ptr_ptr = current->orelocation; reloc_end = reloc_ptr_ptr + current->reloc_count; out_ptr = (char *) reloc_buff; + for (; reloc_ptr_ptr < reloc_end; reloc_ptr_ptr++, out_ptr += external_reloc_size) @@ -2783,11 +2642,16 @@ _bfd_ecoff_write_object_contents (abfd) asymbol *sym; struct internal_reloc in; - memset ((PTR) &in, 0, sizeof in); + memset ((void *) &in, 0, sizeof in); reloc = *reloc_ptr_ptr; sym = *reloc->sym_ptr_ptr; + /* If the howto field has not been initialised then skip this reloc. + This assumes that an error message has been issued elsewhere. */ + if (reloc->howto == NULL) + continue; + in.r_vaddr = (reloc->address + bfd_get_section_vma (abfd, current)); in.r_type = reloc->howto->type; @@ -2800,46 +2664,48 @@ _bfd_ecoff_write_object_contents (abfd) else { const char *name; + unsigned int i; + static struct + { + const char * name; + long r_symndx; + } + section_symndx [] = + { + { _TEXT, RELOC_SECTION_TEXT }, + { _RDATA, RELOC_SECTION_RDATA }, + { _DATA, RELOC_SECTION_DATA }, + { _SDATA, RELOC_SECTION_SDATA }, + { _SBSS, RELOC_SECTION_SBSS }, + { _BSS, RELOC_SECTION_BSS }, + { _INIT, RELOC_SECTION_INIT }, + { _LIT8, RELOC_SECTION_LIT8 }, + { _LIT4, RELOC_SECTION_LIT4 }, + { _XDATA, RELOC_SECTION_XDATA }, + { _PDATA, RELOC_SECTION_PDATA }, + { _FINI, RELOC_SECTION_FINI }, + { _LITA, RELOC_SECTION_LITA }, + { "*ABS*", RELOC_SECTION_ABS }, + { _RCONST, RELOC_SECTION_RCONST } + }; name = bfd_get_section_name (abfd, bfd_get_section (sym)); - if (strcmp (name, ".text") == 0) - in.r_symndx = RELOC_SECTION_TEXT; - else if (strcmp (name, ".rdata") == 0) - in.r_symndx = RELOC_SECTION_RDATA; - else if (strcmp (name, ".data") == 0) - in.r_symndx = RELOC_SECTION_DATA; - else if (strcmp (name, ".sdata") == 0) - in.r_symndx = RELOC_SECTION_SDATA; - else if (strcmp (name, ".sbss") == 0) - in.r_symndx = RELOC_SECTION_SBSS; - else if (strcmp (name, ".bss") == 0) - in.r_symndx = RELOC_SECTION_BSS; - else if (strcmp (name, ".init") == 0) - in.r_symndx = RELOC_SECTION_INIT; - else if (strcmp (name, ".lit8") == 0) - in.r_symndx = RELOC_SECTION_LIT8; - else if (strcmp (name, ".lit4") == 0) - in.r_symndx = RELOC_SECTION_LIT4; - else if (strcmp (name, ".xdata") == 0) - in.r_symndx = RELOC_SECTION_XDATA; - else if (strcmp (name, ".pdata") == 0) - in.r_symndx = RELOC_SECTION_PDATA; - else if (strcmp (name, ".fini") == 0) - in.r_symndx = RELOC_SECTION_FINI; - else if (strcmp (name, ".lita") == 0) - in.r_symndx = RELOC_SECTION_LITA; - else if (strcmp (name, "*ABS*") == 0) - in.r_symndx = RELOC_SECTION_ABS; - else if (strcmp (name, ".rconst") == 0) - in.r_symndx = RELOC_SECTION_RCONST; - else + + for (i = 0; i < ARRAY_SIZE (section_symndx); i++) + if (streq (name, section_symndx[i].name)) + { + in.r_symndx = section_symndx[i].r_symndx; + break; + } + + if (i == ARRAY_SIZE (section_symndx)) abort (); in.r_extern = 0; } (*adjust_reloc_out) (abfd, reloc, &in); - (*swap_reloc_out) (abfd, &in, (PTR) out_ptr); + (*swap_reloc_out) (abfd, &in, (void *) out_ptr); } if (bfd_seek (abfd, current->rel_filepos, SEEK_SET) != 0) @@ -2926,19 +2792,19 @@ _bfd_ecoff_write_object_contents (abfd) The Alpha seems to use ________64E[BL]E[BL]_. */ -#define ARMAP_BIG_ENDIAN 'B' -#define ARMAP_LITTLE_ENDIAN 'L' -#define ARMAP_MARKER 'E' -#define ARMAP_START_LENGTH 10 -#define ARMAP_HEADER_MARKER_INDEX 10 -#define ARMAP_HEADER_ENDIAN_INDEX 11 -#define ARMAP_OBJECT_MARKER_INDEX 12 -#define ARMAP_OBJECT_ENDIAN_INDEX 13 -#define ARMAP_END_INDEX 14 -#define ARMAP_END "_ " +#define ARMAP_BIG_ENDIAN 'B' +#define ARMAP_LITTLE_ENDIAN 'L' +#define ARMAP_MARKER 'E' +#define ARMAP_START_LENGTH 10 +#define ARMAP_HEADER_MARKER_INDEX 10 +#define ARMAP_HEADER_ENDIAN_INDEX 11 +#define ARMAP_OBJECT_MARKER_INDEX 12 +#define ARMAP_OBJECT_ENDIAN_INDEX 13 +#define ARMAP_END_INDEX 14 +#define ARMAP_END "_ " /* This is a magic number used in the hashing algorithm. */ -#define ARMAP_HASH_MAGIC 0x9dd68ab5 +#define ARMAP_HASH_MAGIC 0x9dd68ab5 /* This returns the hash value to use for a string. It also sets *REHASH to the rehash adjustment if the first slot is taken. SIZE @@ -2946,11 +2812,10 @@ _bfd_ecoff_write_object_contents (abfd) base 2 of SIZE. */ static unsigned int -ecoff_armap_hash (s, rehash, size, hlog) - const char *s; - unsigned int *rehash; - unsigned int size; - unsigned int hlog; +ecoff_armap_hash (const char *s, + unsigned int *rehash, + unsigned int size, + unsigned int hlog) { unsigned int hash; @@ -2967,8 +2832,7 @@ ecoff_armap_hash (s, rehash, size, hlog) /* Read in the armap. */ bfd_boolean -_bfd_ecoff_slurp_armap (abfd) - bfd *abfd; +_bfd_ecoff_slurp_armap (bfd *abfd) { char nextname[17]; unsigned int i; @@ -2983,7 +2847,7 @@ _bfd_ecoff_slurp_armap (abfd) bfd_size_type amt; /* Get the name of the first element. */ - i = bfd_bread ((PTR) nextname, (bfd_size_type) 16, abfd); + i = bfd_bread ((void *) nextname, (bfd_size_type) 16, abfd); if (i == 0) return TRUE; if (i != 16) @@ -2997,20 +2861,18 @@ _bfd_ecoff_slurp_armap (abfd) bfd_slurp_armap, but that seems inappropriate since no other target uses this format. Instead, we check directly for a COFF armap. */ - if (strncmp (nextname, "/ ", 16) == 0) + if (strneq (nextname, "/ ", 16)) return bfd_slurp_armap (abfd); /* See if the first element is an armap. */ - if (strncmp (nextname, ecoff_backend (abfd)->armap_start, - ARMAP_START_LENGTH) != 0 + if (! strneq (nextname, ecoff_backend (abfd)->armap_start, ARMAP_START_LENGTH) || nextname[ARMAP_HEADER_MARKER_INDEX] != ARMAP_MARKER || (nextname[ARMAP_HEADER_ENDIAN_INDEX] != ARMAP_BIG_ENDIAN && nextname[ARMAP_HEADER_ENDIAN_INDEX] != ARMAP_LITTLE_ENDIAN) || nextname[ARMAP_OBJECT_MARKER_INDEX] != ARMAP_MARKER || (nextname[ARMAP_OBJECT_ENDIAN_INDEX] != ARMAP_BIG_ENDIAN && nextname[ARMAP_OBJECT_ENDIAN_INDEX] != ARMAP_LITTLE_ENDIAN) - || strncmp (nextname + ARMAP_END_INDEX, - ARMAP_END, sizeof ARMAP_END - 1) != 0) + || ! strneq (nextname + ARMAP_END_INDEX, ARMAP_END, sizeof ARMAP_END - 1)) { bfd_has_map (abfd) = FALSE; return TRUE; @@ -3029,29 +2891,29 @@ _bfd_ecoff_slurp_armap (abfd) /* Read in the armap. */ ardata = bfd_ardata (abfd); mapdata = (struct areltdata *) _bfd_read_ar_hdr (abfd); - if (mapdata == (struct areltdata *) NULL) + if (mapdata == NULL) return FALSE; parsed_size = mapdata->parsed_size; - bfd_release (abfd, (PTR) mapdata); + bfd_release (abfd, (void *) mapdata); - raw_armap = (char *) bfd_alloc (abfd, parsed_size); - if (raw_armap == (char *) NULL) + raw_armap = bfd_alloc (abfd, parsed_size); + if (raw_armap == NULL) return FALSE; - if (bfd_bread ((PTR) raw_armap, parsed_size, abfd) != parsed_size) + if (bfd_bread ((void *) raw_armap, parsed_size, abfd) != parsed_size) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_malformed_archive); - bfd_release (abfd, (PTR) raw_armap); + bfd_release (abfd, (void *) raw_armap); return FALSE; } - ardata->tdata = (PTR) raw_armap; + ardata->tdata = (void *) raw_armap; count = H_GET_32 (abfd, raw_armap); ardata->symdef_count = 0; - ardata->cache = (struct ar_cache *) NULL; + ardata->cache = NULL; /* This code used to overlay the symdefs over the raw archive data, but that doesn't work on a 64 bit host. */ @@ -3101,7 +2963,7 @@ _bfd_ecoff_slurp_armap (abfd) amt = ardata->symdef_count; amt *= sizeof (struct symdef); - symdef_ptr = (struct symdef *) bfd_alloc (abfd, amt); + symdef_ptr = bfd_alloc (abfd, amt); if (!symdef_ptr) return FALSE; @@ -3133,12 +2995,11 @@ _bfd_ecoff_slurp_armap (abfd) /* Write out an armap. */ bfd_boolean -_bfd_ecoff_write_armap (abfd, elength, map, orl_count, stridx) - bfd *abfd; - unsigned int elength; - struct orl *map; - unsigned int orl_count; - int stridx; +_bfd_ecoff_write_armap (bfd *abfd, + unsigned int elength, + struct orl *map, + unsigned int orl_count, + int stridx) { unsigned int hashsize, hashlog; bfd_size_type symdefsize; @@ -3169,7 +3030,7 @@ _bfd_ecoff_write_armap (abfd, elength, map, orl_count, stridx) firstreal = SARMAG + sizeof (struct ar_hdr) + mapsize + elength; - memset ((PTR) &hdr, 0, sizeof hdr); + memset ((void *) &hdr, 0, sizeof hdr); /* Work out the ECOFF armap name. */ strcpy (hdr.ar_name, ecoff_backend (abfd)->armap_start); @@ -3195,14 +3056,10 @@ _bfd_ecoff_write_armap (abfd, elength, map, orl_count, stridx) armap. */ hdr.ar_uid[0] = '0'; hdr.ar_gid[0] = '0'; -#if 0 - hdr.ar_mode[0] = '0'; -#else /* Building gcc ends up extracting the armap as a file - twice. */ hdr.ar_mode[0] = '6'; hdr.ar_mode[1] = '4'; hdr.ar_mode[2] = '4'; -#endif sprintf (hdr.ar_size, "%-10d", (int) mapsize); @@ -3214,15 +3071,15 @@ _bfd_ecoff_write_armap (abfd, elength, map, orl_count, stridx) if (((char *) (&hdr))[i] == '\0') (((char *) (&hdr))[i]) = ' '; - if (bfd_bwrite ((PTR) &hdr, (bfd_size_type) sizeof (struct ar_hdr), abfd) + if (bfd_bwrite ((void *) &hdr, (bfd_size_type) sizeof (struct ar_hdr), abfd) != sizeof (struct ar_hdr)) return FALSE; H_PUT_32 (abfd, hashsize, temp); - if (bfd_bwrite ((PTR) temp, (bfd_size_type) 4, abfd) != 4) + if (bfd_bwrite ((void *) temp, (bfd_size_type) 4, abfd) != 4) return FALSE; - hashtable = (bfd_byte *) bfd_zalloc (abfd, symdefsize); + hashtable = bfd_zalloc (abfd, symdefsize); if (!hashtable) return FALSE; @@ -3268,21 +3125,21 @@ _bfd_ecoff_write_armap (abfd, elength, map, orl_count, stridx) H_PUT_32 (abfd, firstreal, (hashtable + hash * 8 + 4)); } - if (bfd_bwrite ((PTR) hashtable, symdefsize, abfd) != symdefsize) + if (bfd_bwrite ((void *) hashtable, symdefsize, abfd) != symdefsize) return FALSE; bfd_release (abfd, hashtable); /* Now write the strings. */ H_PUT_32 (abfd, stringsize, temp); - if (bfd_bwrite ((PTR) temp, (bfd_size_type) 4, abfd) != 4) + if (bfd_bwrite ((void *) temp, (bfd_size_type) 4, abfd) != 4) return FALSE; for (i = 0; i < orl_count; i++) { bfd_size_type len; len = strlen (*map[i].name) + 1; - if (bfd_bwrite ((PTR) (*map[i].name), len, abfd) != len) + if (bfd_bwrite ((void *) (*map[i].name), len, abfd) != len) return FALSE; } @@ -3301,21 +3158,20 @@ _bfd_ecoff_write_armap (abfd, elength, map, orl_count, stridx) and the extended name table. */ const bfd_target * -_bfd_ecoff_archive_p (abfd) - bfd *abfd; +_bfd_ecoff_archive_p (bfd *abfd) { struct artdata *tdata_hold; char armag[SARMAG + 1]; bfd_size_type amt; - if (bfd_bread ((PTR) armag, (bfd_size_type) SARMAG, abfd) != SARMAG) + if (bfd_bread ((void *) armag, (bfd_size_type) SARMAG, abfd) != SARMAG) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); - return (const bfd_target *) NULL; + return NULL; } - if (strncmp (armag, ARMAG, SARMAG) != 0) + if (! strneq (armag, ARMAG, SARMAG)) { bfd_set_error (bfd_error_wrong_format); return NULL; @@ -3324,26 +3180,28 @@ _bfd_ecoff_archive_p (abfd) tdata_hold = bfd_ardata (abfd); amt = sizeof (struct artdata); - bfd_ardata (abfd) = (struct artdata *) bfd_zalloc (abfd, amt); - if (bfd_ardata (abfd) == (struct artdata *) NULL) + bfd_ardata (abfd) = bfd_zalloc (abfd, amt); + if (bfd_ardata (abfd) == NULL) { bfd_ardata (abfd) = tdata_hold; - return (const bfd_target *) NULL; + return NULL; } bfd_ardata (abfd)->first_file_filepos = SARMAG; - bfd_ardata (abfd)->cache = NULL; - bfd_ardata (abfd)->archive_head = NULL; - bfd_ardata (abfd)->symdefs = NULL; - bfd_ardata (abfd)->extended_names = NULL; - bfd_ardata (abfd)->tdata = NULL; + /* Already cleared by bfd_zalloc above. + bfd_ardata (abfd)->cache = NULL; + bfd_ardata (abfd)->archive_head = NULL; + bfd_ardata (abfd)->symdefs = NULL; + bfd_ardata (abfd)->extended_names = NULL; + bfd_ardata (abfd)->extended_names_size = 0; + bfd_ardata (abfd)->tdata = NULL; */ if (! _bfd_ecoff_slurp_armap (abfd) || ! _bfd_ecoff_slurp_extended_name_table (abfd)) { bfd_release (abfd, bfd_ardata (abfd)); bfd_ardata (abfd) = tdata_hold; - return (const bfd_target *) NULL; + return NULL; } if (bfd_has_map (abfd)) @@ -3357,21 +3215,17 @@ _bfd_ecoff_archive_p (abfd) the first file is not an object file, somebody is doing something weird, and we permit it so that ar -t will work. */ - first = bfd_openr_next_archived_file (abfd, (bfd *) NULL); + first = bfd_openr_next_archived_file (abfd, NULL); if (first != NULL) { first->target_defaulted = FALSE; if (bfd_check_format (first, bfd_object) && first->xvec != abfd->xvec) { -#if 0 /* We ought to close `first' here, but we can't, because we have no way to remove it from the archive cache. - It's close to impossible to figure out when we can + It's almost impossible to figure out when we can release bfd_ardata. FIXME. */ - (void) bfd_close (first); - bfd_release (abfd, bfd_ardata (abfd)); -#endif bfd_set_error (bfd_error_wrong_object_format); bfd_ardata (abfd) = tdata_hold; return NULL; @@ -3385,35 +3239,21 @@ _bfd_ecoff_archive_p (abfd) /* ECOFF linker code. */ -static struct bfd_hash_entry *ecoff_link_hash_newfunc - PARAMS ((struct bfd_hash_entry *entry, - struct bfd_hash_table *table, - const char *string)); -static bfd_boolean ecoff_link_add_archive_symbols - PARAMS ((bfd *, struct bfd_link_info *)); -static bfd_boolean ecoff_link_check_archive_element - PARAMS ((bfd *, struct bfd_link_info *, bfd_boolean *pneeded)); -static bfd_boolean ecoff_link_add_object_symbols - PARAMS ((bfd *, struct bfd_link_info *)); -static bfd_boolean ecoff_link_add_externals - PARAMS ((bfd *, struct bfd_link_info *, PTR, char *)); - /* Routine to create an entry in an ECOFF link hash table. */ static struct bfd_hash_entry * -ecoff_link_hash_newfunc (entry, table, string) - struct bfd_hash_entry *entry; - struct bfd_hash_table *table; - const char *string; +ecoff_link_hash_newfunc (struct bfd_hash_entry *entry, + struct bfd_hash_table *table, + const char *string) { struct ecoff_link_hash_entry *ret = (struct ecoff_link_hash_entry *) entry; /* Allocate the structure if it has not already been allocated by a subclass. */ - if (ret == (struct ecoff_link_hash_entry *) NULL) + if (ret == NULL) ret = ((struct ecoff_link_hash_entry *) bfd_hash_allocate (table, sizeof (struct ecoff_link_hash_entry))); - if (ret == (struct ecoff_link_hash_entry *) NULL) + if (ret == NULL) return NULL; /* Call the allocation method of the superclass. */ @@ -3429,7 +3269,7 @@ ecoff_link_hash_newfunc (entry, table, string) ret->written = 0; ret->small = 0; } - memset ((PTR) &ret->esym, 0, sizeof ret->esym); + memset ((void *) &ret->esym, 0, sizeof ret->esym); return (struct bfd_hash_entry *) ret; } @@ -3437,20 +3277,20 @@ ecoff_link_hash_newfunc (entry, table, string) /* Create an ECOFF link hash table. */ struct bfd_link_hash_table * -_bfd_ecoff_bfd_link_hash_table_create (abfd) - bfd *abfd; +_bfd_ecoff_bfd_link_hash_table_create (bfd *abfd) { struct ecoff_link_hash_table *ret; bfd_size_type amt = sizeof (struct ecoff_link_hash_table); - ret = (struct ecoff_link_hash_table *) bfd_malloc (amt); + ret = bfd_malloc (amt); if (ret == NULL) return NULL; - if (! _bfd_link_hash_table_init (&ret->root, abfd, - ecoff_link_hash_newfunc)) + if (!_bfd_link_hash_table_init (&ret->root, abfd, + ecoff_link_hash_newfunc, + sizeof (struct ecoff_link_hash_entry))) { free (ret); - return (struct bfd_link_hash_table *) NULL; + return NULL; } return &ret->root; } @@ -3466,7 +3306,7 @@ _bfd_ecoff_bfd_link_hash_table_create (abfd) #define ecoff_link_hash_traverse(table, func, info) \ (bfd_link_hash_traverse \ (&(table)->root, \ - (bfd_boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \ + (bfd_boolean (*) (struct bfd_link_hash_entry *, void *)) (func), \ (info))) /* Get the ECOFF link hash table from the info structure. This is @@ -3474,368 +3314,6 @@ _bfd_ecoff_bfd_link_hash_table_create (abfd) #define ecoff_hash_table(p) ((struct ecoff_link_hash_table *) ((p)->hash)) -/* Given an ECOFF BFD, add symbols to the global hash table as - appropriate. */ - -bfd_boolean -_bfd_ecoff_bfd_link_add_symbols (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - switch (bfd_get_format (abfd)) - { - case bfd_object: - return ecoff_link_add_object_symbols (abfd, info); - case bfd_archive: - return ecoff_link_add_archive_symbols (abfd, info); - default: - bfd_set_error (bfd_error_wrong_format); - return FALSE; - } -} - -/* Add the symbols from an archive file to the global hash table. - This looks through the undefined symbols, looks each one up in the - archive hash table, and adds any associated object file. We do not - use _bfd_generic_link_add_archive_symbols because ECOFF archives - already have a hash table, so there is no reason to construct - another one. */ - -static bfd_boolean -ecoff_link_add_archive_symbols (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - const struct ecoff_backend_data * const backend = ecoff_backend (abfd); - const bfd_byte *raw_armap; - struct bfd_link_hash_entry **pundef; - unsigned int armap_count; - unsigned int armap_log; - unsigned int i; - const bfd_byte *hashtable; - const char *stringbase; - - if (! bfd_has_map (abfd)) - { - /* An empty archive is a special case. */ - if (bfd_openr_next_archived_file (abfd, (bfd *) NULL) == NULL) - return TRUE; - bfd_set_error (bfd_error_no_armap); - return FALSE; - } - - /* If we don't have any raw data for this archive, as can happen on - Irix 4.0.5F, we call the generic routine. - FIXME: We should be more clever about this, since someday tdata - may get to something for a generic archive. */ - raw_armap = (const bfd_byte *) bfd_ardata (abfd)->tdata; - if (raw_armap == (bfd_byte *) NULL) - return (_bfd_generic_link_add_archive_symbols - (abfd, info, ecoff_link_check_archive_element)); - - armap_count = H_GET_32 (abfd, raw_armap); - - armap_log = 0; - for (i = 1; i < armap_count; i <<= 1) - armap_log++; - BFD_ASSERT (i == armap_count); - - hashtable = raw_armap + 4; - stringbase = (const char *) raw_armap + armap_count * 8 + 8; - - /* Look through the list of undefined symbols. */ - pundef = &info->hash->undefs; - while (*pundef != (struct bfd_link_hash_entry *) NULL) - { - struct bfd_link_hash_entry *h; - unsigned int hash, rehash; - unsigned int file_offset; - const char *name; - bfd *element; - - h = *pundef; - - /* When a symbol is defined, it is not necessarily removed from - the list. */ - if (h->type != bfd_link_hash_undefined - && h->type != bfd_link_hash_common) - { - /* Remove this entry from the list, for general cleanliness - and because we are going to look through the list again - if we search any more libraries. We can't remove the - entry if it is the tail, because that would lose any - entries we add to the list later on. */ - if (*pundef != info->hash->undefs_tail) - *pundef = (*pundef)->und_next; - else - pundef = &(*pundef)->und_next; - continue; - } - - /* Native ECOFF linkers do not pull in archive elements merely - to satisfy common definitions, so neither do we. We leave - them on the list, though, in case we are linking against some - other object format. */ - if (h->type != bfd_link_hash_undefined) - { - pundef = &(*pundef)->und_next; - continue; - } - - /* Look for this symbol in the archive hash table. */ - hash = ecoff_armap_hash (h->root.string, &rehash, armap_count, - armap_log); - - file_offset = H_GET_32 (abfd, hashtable + (hash * 8) + 4); - if (file_offset == 0) - { - /* Nothing in this slot. */ - pundef = &(*pundef)->und_next; - continue; - } - - name = stringbase + H_GET_32 (abfd, hashtable + (hash * 8)); - if (name[0] != h->root.string[0] - || strcmp (name, h->root.string) != 0) - { - unsigned int srch; - bfd_boolean found; - - /* That was the wrong symbol. Try rehashing. */ - found = FALSE; - for (srch = (hash + rehash) & (armap_count - 1); - srch != hash; - srch = (srch + rehash) & (armap_count - 1)) - { - file_offset = H_GET_32 (abfd, hashtable + (srch * 8) + 4); - if (file_offset == 0) - break; - name = stringbase + H_GET_32 (abfd, hashtable + (srch * 8)); - if (name[0] == h->root.string[0] - && strcmp (name, h->root.string) == 0) - { - found = TRUE; - break; - } - } - - if (! found) - { - pundef = &(*pundef)->und_next; - continue; - } - - hash = srch; - } - - element = (*backend->get_elt_at_filepos) (abfd, (file_ptr) file_offset); - if (element == (bfd *) NULL) - return FALSE; - - if (! bfd_check_format (element, bfd_object)) - return FALSE; - - /* Unlike the generic linker, we know that this element provides - a definition for an undefined symbol and we know that we want - to include it. We don't need to check anything. */ - if (! (*info->callbacks->add_archive_element) (info, element, name)) - return FALSE; - if (! ecoff_link_add_object_symbols (element, info)) - return FALSE; - - pundef = &(*pundef)->und_next; - } - - return TRUE; -} - -/* This is called if we used _bfd_generic_link_add_archive_symbols - because we were not dealing with an ECOFF archive. */ - -static bfd_boolean -ecoff_link_check_archive_element (abfd, info, pneeded) - bfd *abfd; - struct bfd_link_info *info; - bfd_boolean *pneeded; -{ - const struct ecoff_backend_data * const backend = ecoff_backend (abfd); - void (* const swap_ext_in) PARAMS ((bfd *, PTR, EXTR *)) - = backend->debug_swap.swap_ext_in; - HDRR *symhdr; - bfd_size_type external_ext_size; - PTR external_ext = NULL; - bfd_size_type esize; - char *ssext = NULL; - char *ext_ptr; - char *ext_end; - - *pneeded = FALSE; - - if (! ecoff_slurp_symbolic_header (abfd)) - goto error_return; - - /* If there are no symbols, we don't want it. */ - if (bfd_get_symcount (abfd) == 0) - goto successful_return; - - symhdr = &ecoff_data (abfd)->debug_info.symbolic_header; - - /* Read in the external symbols and external strings. */ - external_ext_size = backend->debug_swap.external_ext_size; - esize = symhdr->iextMax * external_ext_size; - external_ext = (PTR) bfd_malloc (esize); - if (external_ext == NULL && esize != 0) - goto error_return; - - if (bfd_seek (abfd, (file_ptr) symhdr->cbExtOffset, SEEK_SET) != 0 - || bfd_bread (external_ext, esize, abfd) != esize) - goto error_return; - - ssext = (char *) bfd_malloc ((bfd_size_type) symhdr->issExtMax); - if (ssext == NULL && symhdr->issExtMax != 0) - goto error_return; - - if (bfd_seek (abfd, (file_ptr) symhdr->cbSsExtOffset, SEEK_SET) != 0 - || (bfd_bread (ssext, (bfd_size_type) symhdr->issExtMax, abfd) - != (bfd_size_type) symhdr->issExtMax)) - goto error_return; - - /* Look through the external symbols to see if they define some - symbol that is currently undefined. */ - ext_ptr = (char *) external_ext; - ext_end = ext_ptr + esize; - for (; ext_ptr < ext_end; ext_ptr += external_ext_size) - { - EXTR esym; - bfd_boolean def; - const char *name; - struct bfd_link_hash_entry *h; - - (*swap_ext_in) (abfd, (PTR) ext_ptr, &esym); - - /* See if this symbol defines something. */ - if (esym.asym.st != stGlobal - && esym.asym.st != stLabel - && esym.asym.st != stProc) - continue; - - switch (esym.asym.sc) - { - case scText: - case scData: - case scBss: - case scAbs: - case scSData: - case scSBss: - case scRData: - case scCommon: - case scSCommon: - case scInit: - case scFini: - case scRConst: - def = TRUE; - break; - default: - def = FALSE; - break; - } - - if (! def) - continue; - - name = ssext + esym.asym.iss; - h = bfd_link_hash_lookup (info->hash, name, FALSE, FALSE, TRUE); - - /* Unlike the generic linker, we do not pull in elements because - of common symbols. */ - if (h == (struct bfd_link_hash_entry *) NULL - || h->type != bfd_link_hash_undefined) - continue; - - /* Include this element. */ - if (! (*info->callbacks->add_archive_element) (info, abfd, name)) - goto error_return; - if (! ecoff_link_add_externals (abfd, info, external_ext, ssext)) - goto error_return; - - *pneeded = TRUE; - goto successful_return; - } - - successful_return: - if (external_ext != NULL) - free (external_ext); - if (ssext != NULL) - free (ssext); - return TRUE; - error_return: - if (external_ext != NULL) - free (external_ext); - if (ssext != NULL) - free (ssext); - return FALSE; -} - -/* Add symbols from an ECOFF object file to the global linker hash - table. */ - -static bfd_boolean -ecoff_link_add_object_symbols (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - HDRR *symhdr; - bfd_size_type external_ext_size; - PTR external_ext = NULL; - bfd_size_type esize; - char *ssext = NULL; - bfd_boolean result; - - if (! ecoff_slurp_symbolic_header (abfd)) - return FALSE; - - /* If there are no symbols, we don't want it. */ - if (bfd_get_symcount (abfd) == 0) - return TRUE; - - symhdr = &ecoff_data (abfd)->debug_info.symbolic_header; - - /* Read in the external symbols and external strings. */ - external_ext_size = ecoff_backend (abfd)->debug_swap.external_ext_size; - esize = symhdr->iextMax * external_ext_size; - external_ext = (PTR) bfd_malloc (esize); - if (external_ext == NULL && esize != 0) - goto error_return; - - if (bfd_seek (abfd, (file_ptr) symhdr->cbExtOffset, SEEK_SET) != 0 - || bfd_bread (external_ext, esize, abfd) != esize) - goto error_return; - - ssext = (char *) bfd_malloc ((bfd_size_type) symhdr->issExtMax); - if (ssext == NULL && symhdr->issExtMax != 0) - goto error_return; - - if (bfd_seek (abfd, (file_ptr) symhdr->cbSsExtOffset, SEEK_SET) != 0 - || (bfd_bread (ssext, (bfd_size_type) symhdr->issExtMax, abfd) - != (bfd_size_type) symhdr->issExtMax)) - goto error_return; - - result = ecoff_link_add_externals (abfd, info, external_ext, ssext); - - if (ssext != NULL) - free (ssext); - if (external_ext != NULL) - free (external_ext); - return result; - - error_return: - if (ssext != NULL) - free (ssext); - if (external_ext != NULL) - free (external_ext); - return FALSE; -} - /* Add the external symbols of an object file to the global linker hash table. The external symbols and strings we are passed are just allocated on the stack, and will be discarded. We must @@ -3843,14 +3321,13 @@ ecoff_link_add_object_symbols (abfd, info) We do not want to read the external symbol information again. */ static bfd_boolean -ecoff_link_add_externals (abfd, info, external_ext, ssext) - bfd *abfd; - struct bfd_link_info *info; - PTR external_ext; - char *ssext; +ecoff_link_add_externals (bfd *abfd, + struct bfd_link_info *info, + void * external_ext, + char *ssext) { const struct ecoff_backend_data * const backend = ecoff_backend (abfd); - void (* const swap_ext_in) PARAMS ((bfd *, PTR, EXTR *)) + void (* const swap_ext_in) (bfd *, void *, EXTR *) = backend->debug_swap.swap_ext_in; bfd_size_type external_ext_size = backend->debug_swap.external_ext_size; unsigned long ext_count; @@ -3863,7 +3340,7 @@ ecoff_link_add_externals (abfd, info, external_ext, ssext) amt = ext_count; amt *= sizeof (struct bfd_link_hash_entry *); - sym_hash = (struct bfd_link_hash_entry **) bfd_alloc (abfd, amt); + sym_hash = bfd_alloc (abfd, amt); if (!sym_hash) return FALSE; ecoff_data (abfd)->sym_hashes = (struct ecoff_link_hash_entry **) sym_hash; @@ -3881,7 +3358,7 @@ ecoff_link_add_externals (abfd, info, external_ext, ssext) *sym_hash = NULL; - (*swap_ext_in) (abfd, (PTR) ext_ptr, &esym); + (*swap_ext_in) (abfd, (void *) ext_ptr, &esym); /* Skip debugging symbols. */ skip = FALSE; @@ -3923,15 +3400,15 @@ ecoff_link_add_externals (abfd, info, external_ext, ssext) section = NULL; break; case scText: - section = bfd_make_section_old_way (abfd, ".text"); + section = bfd_make_section_old_way (abfd, _TEXT); value -= section->vma; break; case scData: - section = bfd_make_section_old_way (abfd, ".data"); + section = bfd_make_section_old_way (abfd, _DATA); value -= section->vma; break; case scBss: - section = bfd_make_section_old_way (abfd, ".bss"); + section = bfd_make_section_old_way (abfd, _BSS); value -= section->vma; break; case scAbs: @@ -3941,15 +3418,15 @@ ecoff_link_add_externals (abfd, info, external_ext, ssext) section = bfd_und_section_ptr; break; case scSData: - section = bfd_make_section_old_way (abfd, ".sdata"); + section = bfd_make_section_old_way (abfd, _SDATA); value -= section->vma; break; case scSBss: - section = bfd_make_section_old_way (abfd, ".sbss"); + section = bfd_make_section_old_way (abfd, _SBSS); value -= section->vma; break; case scRData: - section = bfd_make_section_old_way (abfd, ".rdata"); + section = bfd_make_section_old_way (abfd, _RDATA); value -= section->vma; break; case scCommon: @@ -3979,20 +3456,20 @@ ecoff_link_add_externals (abfd, info, external_ext, ssext) section = bfd_und_section_ptr; break; case scInit: - section = bfd_make_section_old_way (abfd, ".init"); + section = bfd_make_section_old_way (abfd, _INIT); value -= section->vma; break; case scFini: - section = bfd_make_section_old_way (abfd, ".fini"); + section = bfd_make_section_old_way (abfd, _FINI); value -= section->vma; break; case scRConst: - section = bfd_make_section_old_way (abfd, ".rconst"); + section = bfd_make_section_old_way (abfd, _RCONST); value -= section->vma; break; } - if (section == (asection *) NULL) + if (section == NULL) continue; name = ssext + esym.asym.iss; @@ -4000,7 +3477,7 @@ ecoff_link_add_externals (abfd, info, external_ext, ssext) if (! (_bfd_generic_link_add_one_symbol (info, abfd, name, (flagword) (esym.weakext ? BSF_WEAK : BSF_GLOBAL), - section, value, (const char *) NULL, TRUE, TRUE, sym_hash))) + section, value, NULL, TRUE, TRUE, sym_hash))) return FALSE; h = (struct ecoff_link_hash_entry *) *sym_hash; @@ -4009,7 +3486,7 @@ ecoff_link_add_externals (abfd, info, external_ext, ssext) symbol information. */ if (info->hash->creator->flavour == bfd_get_flavour (abfd)) { - if (h->abfd == (bfd *) NULL + if (h->abfd == NULL || (! bfd_is_und_section (section) && (! bfd_is_com_section (section) || (h->root.type != bfd_link_hash_defined @@ -4030,7 +3507,7 @@ ecoff_link_add_externals (abfd, info, external_ext, ssext) on Ultrix 4.2 to handle the symbol cred in -lckrb. */ if (h->small && h->root.type == bfd_link_hash_common - && strcmp (h->root.u.c.p->section->name, SCOMMON) != 0) + && streq (h->root.u.c.p->section->name, SCOMMON)) { h->root.u.c.p->section = bfd_make_section_old_way (abfd, SCOMMON); @@ -4043,21 +3520,365 @@ ecoff_link_add_externals (abfd, info, external_ext, ssext) return TRUE; } + +/* Add symbols from an ECOFF object file to the global linker hash + table. */ + +static bfd_boolean +ecoff_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) +{ + HDRR *symhdr; + bfd_size_type external_ext_size; + void * external_ext = NULL; + bfd_size_type esize; + char *ssext = NULL; + bfd_boolean result; + + if (! ecoff_slurp_symbolic_header (abfd)) + return FALSE; + + /* If there are no symbols, we don't want it. */ + if (bfd_get_symcount (abfd) == 0) + return TRUE; + + symhdr = &ecoff_data (abfd)->debug_info.symbolic_header; + + /* Read in the external symbols and external strings. */ + external_ext_size = ecoff_backend (abfd)->debug_swap.external_ext_size; + esize = symhdr->iextMax * external_ext_size; + external_ext = bfd_malloc (esize); + if (external_ext == NULL && esize != 0) + goto error_return; + + if (bfd_seek (abfd, (file_ptr) symhdr->cbExtOffset, SEEK_SET) != 0 + || bfd_bread (external_ext, esize, abfd) != esize) + goto error_return; + + ssext = bfd_malloc ((bfd_size_type) symhdr->issExtMax); + if (ssext == NULL && symhdr->issExtMax != 0) + goto error_return; + + if (bfd_seek (abfd, (file_ptr) symhdr->cbSsExtOffset, SEEK_SET) != 0 + || (bfd_bread (ssext, (bfd_size_type) symhdr->issExtMax, abfd) + != (bfd_size_type) symhdr->issExtMax)) + goto error_return; + + result = ecoff_link_add_externals (abfd, info, external_ext, ssext); + + if (ssext != NULL) + free (ssext); + if (external_ext != NULL) + free (external_ext); + return result; + + error_return: + if (ssext != NULL) + free (ssext); + if (external_ext != NULL) + free (external_ext); + return FALSE; +} + +/* This is called if we used _bfd_generic_link_add_archive_symbols + because we were not dealing with an ECOFF archive. */ + +static bfd_boolean +ecoff_link_check_archive_element (bfd *abfd, + struct bfd_link_info *info, + bfd_boolean *pneeded) +{ + const struct ecoff_backend_data * const backend = ecoff_backend (abfd); + void (* const swap_ext_in) (bfd *, void *, EXTR *) + = backend->debug_swap.swap_ext_in; + HDRR *symhdr; + bfd_size_type external_ext_size; + void * external_ext = NULL; + bfd_size_type esize; + char *ssext = NULL; + char *ext_ptr; + char *ext_end; + + *pneeded = FALSE; + + if (! ecoff_slurp_symbolic_header (abfd)) + goto error_return; + + /* If there are no symbols, we don't want it. */ + if (bfd_get_symcount (abfd) == 0) + goto successful_return; + + symhdr = &ecoff_data (abfd)->debug_info.symbolic_header; + + /* Read in the external symbols and external strings. */ + external_ext_size = backend->debug_swap.external_ext_size; + esize = symhdr->iextMax * external_ext_size; + external_ext = bfd_malloc (esize); + if (external_ext == NULL && esize != 0) + goto error_return; + + if (bfd_seek (abfd, (file_ptr) symhdr->cbExtOffset, SEEK_SET) != 0 + || bfd_bread (external_ext, esize, abfd) != esize) + goto error_return; + + ssext = bfd_malloc ((bfd_size_type) symhdr->issExtMax); + if (ssext == NULL && symhdr->issExtMax != 0) + goto error_return; + + if (bfd_seek (abfd, (file_ptr) symhdr->cbSsExtOffset, SEEK_SET) != 0 + || (bfd_bread (ssext, (bfd_size_type) symhdr->issExtMax, abfd) + != (bfd_size_type) symhdr->issExtMax)) + goto error_return; + + /* Look through the external symbols to see if they define some + symbol that is currently undefined. */ + ext_ptr = (char *) external_ext; + ext_end = ext_ptr + esize; + for (; ext_ptr < ext_end; ext_ptr += external_ext_size) + { + EXTR esym; + bfd_boolean def; + const char *name; + struct bfd_link_hash_entry *h; + + (*swap_ext_in) (abfd, (void *) ext_ptr, &esym); + + /* See if this symbol defines something. */ + if (esym.asym.st != stGlobal + && esym.asym.st != stLabel + && esym.asym.st != stProc) + continue; + + switch (esym.asym.sc) + { + case scText: + case scData: + case scBss: + case scAbs: + case scSData: + case scSBss: + case scRData: + case scCommon: + case scSCommon: + case scInit: + case scFini: + case scRConst: + def = TRUE; + break; + default: + def = FALSE; + break; + } + + if (! def) + continue; + + name = ssext + esym.asym.iss; + h = bfd_link_hash_lookup (info->hash, name, FALSE, FALSE, TRUE); + + /* Unlike the generic linker, we do not pull in elements because + of common symbols. */ + if (h == NULL + || h->type != bfd_link_hash_undefined) + continue; + + /* Include this element. */ + if (! (*info->callbacks->add_archive_element) (info, abfd, name)) + goto error_return; + if (! ecoff_link_add_externals (abfd, info, external_ext, ssext)) + goto error_return; + + *pneeded = TRUE; + goto successful_return; + } + + successful_return: + if (external_ext != NULL) + free (external_ext); + if (ssext != NULL) + free (ssext); + return TRUE; + error_return: + if (external_ext != NULL) + free (external_ext); + if (ssext != NULL) + free (ssext); + return FALSE; +} + +/* Add the symbols from an archive file to the global hash table. + This looks through the undefined symbols, looks each one up in the + archive hash table, and adds any associated object file. We do not + use _bfd_generic_link_add_archive_symbols because ECOFF archives + already have a hash table, so there is no reason to construct + another one. */ + +static bfd_boolean +ecoff_link_add_archive_symbols (bfd *abfd, struct bfd_link_info *info) +{ + const struct ecoff_backend_data * const backend = ecoff_backend (abfd); + const bfd_byte *raw_armap; + struct bfd_link_hash_entry **pundef; + unsigned int armap_count; + unsigned int armap_log; + unsigned int i; + const bfd_byte *hashtable; + const char *stringbase; + + if (! bfd_has_map (abfd)) + { + /* An empty archive is a special case. */ + if (bfd_openr_next_archived_file (abfd, NULL) == NULL) + return TRUE; + bfd_set_error (bfd_error_no_armap); + return FALSE; + } + + /* If we don't have any raw data for this archive, as can happen on + Irix 4.0.5F, we call the generic routine. + FIXME: We should be more clever about this, since someday tdata + may get to something for a generic archive. */ + raw_armap = (const bfd_byte *) bfd_ardata (abfd)->tdata; + if (raw_armap == NULL) + return (_bfd_generic_link_add_archive_symbols + (abfd, info, ecoff_link_check_archive_element)); + + armap_count = H_GET_32 (abfd, raw_armap); + + armap_log = 0; + for (i = 1; i < armap_count; i <<= 1) + armap_log++; + BFD_ASSERT (i == armap_count); + + hashtable = raw_armap + 4; + stringbase = (const char *) raw_armap + armap_count * 8 + 8; + + /* Look through the list of undefined symbols. */ + pundef = &info->hash->undefs; + while (*pundef != NULL) + { + struct bfd_link_hash_entry *h; + unsigned int hash, rehash; + unsigned int file_offset; + const char *name; + bfd *element; + + h = *pundef; + + /* When a symbol is defined, it is not necessarily removed from + the list. */ + if (h->type != bfd_link_hash_undefined + && h->type != bfd_link_hash_common) + { + /* Remove this entry from the list, for general cleanliness + and because we are going to look through the list again + if we search any more libraries. We can't remove the + entry if it is the tail, because that would lose any + entries we add to the list later on. */ + if (*pundef != info->hash->undefs_tail) + *pundef = (*pundef)->u.undef.next; + else + pundef = &(*pundef)->u.undef.next; + continue; + } + + /* Native ECOFF linkers do not pull in archive elements merely + to satisfy common definitions, so neither do we. We leave + them on the list, though, in case we are linking against some + other object format. */ + if (h->type != bfd_link_hash_undefined) + { + pundef = &(*pundef)->u.undef.next; + continue; + } + + /* Look for this symbol in the archive hash table. */ + hash = ecoff_armap_hash (h->root.string, &rehash, armap_count, + armap_log); + + file_offset = H_GET_32 (abfd, hashtable + (hash * 8) + 4); + if (file_offset == 0) + { + /* Nothing in this slot. */ + pundef = &(*pundef)->u.undef.next; + continue; + } + + name = stringbase + H_GET_32 (abfd, hashtable + (hash * 8)); + if (name[0] != h->root.string[0] + || ! streq (name, h->root.string)) + { + unsigned int srch; + bfd_boolean found; + + /* That was the wrong symbol. Try rehashing. */ + found = FALSE; + for (srch = (hash + rehash) & (armap_count - 1); + srch != hash; + srch = (srch + rehash) & (armap_count - 1)) + { + file_offset = H_GET_32 (abfd, hashtable + (srch * 8) + 4); + if (file_offset == 0) + break; + name = stringbase + H_GET_32 (abfd, hashtable + (srch * 8)); + if (name[0] == h->root.string[0] + && streq (name, h->root.string)) + { + found = TRUE; + break; + } + } + + if (! found) + { + pundef = &(*pundef)->u.undef.next; + continue; + } + + hash = srch; + } + + element = (*backend->get_elt_at_filepos) (abfd, (file_ptr) file_offset); + if (element == NULL) + return FALSE; + + if (! bfd_check_format (element, bfd_object)) + return FALSE; + + /* Unlike the generic linker, we know that this element provides + a definition for an undefined symbol and we know that we want + to include it. We don't need to check anything. */ + if (! (*info->callbacks->add_archive_element) (info, element, name)) + return FALSE; + if (! ecoff_link_add_object_symbols (element, info)) + return FALSE; + + pundef = &(*pundef)->u.undef.next; + } + + return TRUE; +} + +/* Given an ECOFF BFD, add symbols to the global hash table as + appropriate. */ + +bfd_boolean +_bfd_ecoff_bfd_link_add_symbols (bfd *abfd, struct bfd_link_info *info) +{ + switch (bfd_get_format (abfd)) + { + case bfd_object: + return ecoff_link_add_object_symbols (abfd, info); + case bfd_archive: + return ecoff_link_add_archive_symbols (abfd, info); + default: + bfd_set_error (bfd_error_wrong_format); + return FALSE; + } +} + /* ECOFF final link routines. */ -static bfd_boolean ecoff_final_link_debug_accumulate - PARAMS ((bfd *output_bfd, bfd *input_bfd, struct bfd_link_info *, - PTR handle)); -static bfd_boolean ecoff_link_write_external - PARAMS ((struct ecoff_link_hash_entry *, PTR)); -static bfd_boolean ecoff_indirect_link_order - PARAMS ((bfd *, struct bfd_link_info *, asection *, - struct bfd_link_order *)); -static bfd_boolean ecoff_reloc_link_order - PARAMS ((bfd *, struct bfd_link_info *, asection *, - struct bfd_link_order *)); - /* Structure used to pass information to ecoff_link_write_external. */ struct extsym_info @@ -4066,220 +3887,15 @@ struct extsym_info struct bfd_link_info *info; }; -/* ECOFF final link routine. This looks through all the input BFDs - and gathers together all the debugging information, and then - processes all the link order information. This may cause it to - close and reopen some input BFDs; I'll see how bad this is. */ - -bfd_boolean -_bfd_ecoff_bfd_final_link (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - const struct ecoff_backend_data * const backend = ecoff_backend (abfd); - struct ecoff_debug_info * const debug = &ecoff_data (abfd)->debug_info; - HDRR *symhdr; - PTR handle; - register bfd *input_bfd; - asection *o; - struct bfd_link_order *p; - struct extsym_info einfo; - - /* We accumulate the debugging information counts in the symbolic - header. */ - symhdr = &debug->symbolic_header; - symhdr->vstamp = 0; - symhdr->ilineMax = 0; - symhdr->cbLine = 0; - symhdr->idnMax = 0; - symhdr->ipdMax = 0; - symhdr->isymMax = 0; - symhdr->ioptMax = 0; - symhdr->iauxMax = 0; - symhdr->issMax = 0; - symhdr->issExtMax = 0; - symhdr->ifdMax = 0; - symhdr->crfd = 0; - symhdr->iextMax = 0; - - /* We accumulate the debugging information itself in the debug_info - structure. */ - debug->line = NULL; - debug->external_dnr = NULL; - debug->external_pdr = NULL; - debug->external_sym = NULL; - debug->external_opt = NULL; - debug->external_aux = NULL; - debug->ss = NULL; - debug->ssext = debug->ssext_end = NULL; - debug->external_fdr = NULL; - debug->external_rfd = NULL; - debug->external_ext = debug->external_ext_end = NULL; - - handle = bfd_ecoff_debug_init (abfd, debug, &backend->debug_swap, info); - if (handle == (PTR) NULL) - return FALSE; - - /* Accumulate the debugging symbols from each input BFD. */ - for (input_bfd = info->input_bfds; - input_bfd != (bfd *) NULL; - input_bfd = input_bfd->link_next) - { - bfd_boolean ret; - - if (bfd_get_flavour (input_bfd) == bfd_target_ecoff_flavour) - { - /* Arbitrarily set the symbolic header vstamp to the vstamp - of the first object file in the link. */ - if (symhdr->vstamp == 0) - symhdr->vstamp - = ecoff_data (input_bfd)->debug_info.symbolic_header.vstamp; - ret = ecoff_final_link_debug_accumulate (abfd, input_bfd, info, - handle); - } - else - ret = bfd_ecoff_debug_accumulate_other (handle, abfd, - debug, &backend->debug_swap, - input_bfd, info); - if (! ret) - return FALSE; - - /* Combine the register masks. */ - ecoff_data (abfd)->gprmask |= ecoff_data (input_bfd)->gprmask; - ecoff_data (abfd)->fprmask |= ecoff_data (input_bfd)->fprmask; - ecoff_data (abfd)->cprmask[0] |= ecoff_data (input_bfd)->cprmask[0]; - ecoff_data (abfd)->cprmask[1] |= ecoff_data (input_bfd)->cprmask[1]; - ecoff_data (abfd)->cprmask[2] |= ecoff_data (input_bfd)->cprmask[2]; - ecoff_data (abfd)->cprmask[3] |= ecoff_data (input_bfd)->cprmask[3]; - } - - /* Write out the external symbols. */ - einfo.abfd = abfd; - einfo.info = info; - ecoff_link_hash_traverse (ecoff_hash_table (info), - ecoff_link_write_external, - (PTR) &einfo); - - if (info->relocatable) - { - /* We need to make a pass over the link_orders to count up the - number of relocations we will need to output, so that we know - how much space they will take up. */ - for (o = abfd->sections; o != (asection *) NULL; o = o->next) - { - o->reloc_count = 0; - for (p = o->link_order_head; - p != (struct bfd_link_order *) NULL; - p = p->next) - if (p->type == bfd_indirect_link_order) - o->reloc_count += p->u.indirect.section->reloc_count; - else if (p->type == bfd_section_reloc_link_order - || p->type == bfd_symbol_reloc_link_order) - ++o->reloc_count; - } - } - - /* Compute the reloc and symbol file positions. */ - ecoff_compute_reloc_file_positions (abfd); - - /* Write out the debugging information. */ - if (! bfd_ecoff_write_accumulated_debug (handle, abfd, debug, - &backend->debug_swap, info, - ecoff_data (abfd)->sym_filepos)) - return FALSE; - - bfd_ecoff_debug_free (handle, abfd, debug, &backend->debug_swap, info); - - if (info->relocatable) - { - /* Now reset the reloc_count field of the sections in the output - BFD to 0, so that we can use them to keep track of how many - relocs we have output thus far. */ - for (o = abfd->sections; o != (asection *) NULL; o = o->next) - o->reloc_count = 0; - } - - /* Get a value for the GP register. */ - if (ecoff_data (abfd)->gp == 0) - { - struct bfd_link_hash_entry *h; - - h = bfd_link_hash_lookup (info->hash, "_gp", FALSE, FALSE, TRUE); - if (h != (struct bfd_link_hash_entry *) NULL - && h->type == bfd_link_hash_defined) - ecoff_data (abfd)->gp = (h->u.def.value - + h->u.def.section->output_section->vma - + h->u.def.section->output_offset); - else if (info->relocatable) - { - bfd_vma lo; - - /* Make up a value. */ - lo = (bfd_vma) -1; - for (o = abfd->sections; o != (asection *) NULL; o = o->next) - { - if (o->vma < lo - && (strcmp (o->name, _SBSS) == 0 - || strcmp (o->name, _SDATA) == 0 - || strcmp (o->name, _LIT4) == 0 - || strcmp (o->name, _LIT8) == 0 - || strcmp (o->name, _LITA) == 0)) - lo = o->vma; - } - ecoff_data (abfd)->gp = lo + 0x8000; - } - else - { - /* If the relocate_section function needs to do a reloc - involving the GP value, it should make a reloc_dangerous - callback to warn that GP is not defined. */ - } - } - - for (o = abfd->sections; o != (asection *) NULL; o = o->next) - { - for (p = o->link_order_head; - p != (struct bfd_link_order *) NULL; - p = p->next) - { - if (p->type == bfd_indirect_link_order - && (bfd_get_flavour (p->u.indirect.section->owner) - == bfd_target_ecoff_flavour)) - { - if (! ecoff_indirect_link_order (abfd, info, o, p)) - return FALSE; - } - else if (p->type == bfd_section_reloc_link_order - || p->type == bfd_symbol_reloc_link_order) - { - if (! ecoff_reloc_link_order (abfd, info, o, p)) - return FALSE; - } - else - { - if (! _bfd_default_link_order (abfd, info, o, p)) - return FALSE; - } - } - } - - bfd_get_symcount (abfd) = symhdr->iextMax + symhdr->isymMax; - - ecoff_data (abfd)->linker = TRUE; - - return TRUE; -} - /* Accumulate the debugging information for an input BFD into the output BFD. This must read in the symbolic information of the input BFD. */ static bfd_boolean -ecoff_final_link_debug_accumulate (output_bfd, input_bfd, info, handle) - bfd *output_bfd; - bfd *input_bfd; - struct bfd_link_info *info; - PTR handle; +ecoff_final_link_debug_accumulate (bfd *output_bfd, + bfd *input_bfd, + struct bfd_link_info *info, + void * handle) { struct ecoff_debug_info * const debug = &ecoff_data (input_bfd)->debug_info; const struct ecoff_debug_swap * const swap = @@ -4293,7 +3909,7 @@ ecoff_final_link_debug_accumulate (output_bfd, input_bfd, info, handle) else \ { \ bfd_size_type amt = (bfd_size_type) size * symhdr->count; \ - debug->ptr = (type) bfd_malloc (amt); \ + debug->ptr = bfd_malloc (amt); \ if (debug->ptr == NULL) \ { \ ret = FALSE; \ @@ -4313,15 +3929,15 @@ ecoff_final_link_debug_accumulate (output_bfd, input_bfd, info, handle) { READ (line, cbLineOffset, cbLine, sizeof (unsigned char), unsigned char *); - READ (external_dnr, cbDnOffset, idnMax, swap->external_dnr_size, PTR); - READ (external_pdr, cbPdOffset, ipdMax, swap->external_pdr_size, PTR); - READ (external_sym, cbSymOffset, isymMax, swap->external_sym_size, PTR); - READ (external_opt, cbOptOffset, ioptMax, swap->external_opt_size, PTR); + READ (external_dnr, cbDnOffset, idnMax, swap->external_dnr_size, void *); + READ (external_pdr, cbPdOffset, ipdMax, swap->external_pdr_size, void *); + READ (external_sym, cbSymOffset, isymMax, swap->external_sym_size, void *); + READ (external_opt, cbOptOffset, ioptMax, swap->external_opt_size, void *); READ (external_aux, cbAuxOffset, iauxMax, sizeof (union aux_ext), union aux_ext *); READ (ss, cbSsOffset, issMax, sizeof (char), char *); - READ (external_fdr, cbFdOffset, ifdMax, swap->external_fdr_size, PTR); - READ (external_rfd, cbRfdOffset, crfd, swap->external_rfd_size, PTR); + READ (external_fdr, cbFdOffset, ifdMax, swap->external_fdr_size, void *); + READ (external_rfd, cbRfdOffset, crfd, swap->external_rfd_size, void *); } #undef READ @@ -4370,13 +3986,308 @@ ecoff_final_link_debug_accumulate (output_bfd, input_bfd, info, handle) return ret; } +/* Relocate and write an ECOFF section into an ECOFF output file. */ + +static bfd_boolean +ecoff_indirect_link_order (bfd *output_bfd, + struct bfd_link_info *info, + asection *output_section, + struct bfd_link_order *link_order) +{ + asection *input_section; + bfd *input_bfd; + bfd_byte *contents = NULL; + bfd_size_type external_reloc_size; + bfd_size_type external_relocs_size; + void * external_relocs = NULL; + + BFD_ASSERT ((output_section->flags & SEC_HAS_CONTENTS) != 0); + + input_section = link_order->u.indirect.section; + input_bfd = input_section->owner; + if (input_section->size == 0) + return TRUE; + + BFD_ASSERT (input_section->output_section == output_section); + BFD_ASSERT (input_section->output_offset == link_order->offset); + BFD_ASSERT (input_section->size == link_order->size); + + /* Get the section contents. */ + if (!bfd_malloc_and_get_section (input_bfd, input_section, &contents)) + goto error_return; + + /* Get the relocs. If we are relaxing MIPS code, they will already + have been read in. Otherwise, we read them in now. */ + external_reloc_size = ecoff_backend (input_bfd)->external_reloc_size; + external_relocs_size = external_reloc_size * input_section->reloc_count; + + external_relocs = bfd_malloc (external_relocs_size); + if (external_relocs == NULL && external_relocs_size != 0) + goto error_return; + + if (bfd_seek (input_bfd, input_section->rel_filepos, SEEK_SET) != 0 + || (bfd_bread (external_relocs, external_relocs_size, input_bfd) + != external_relocs_size)) + goto error_return; + + /* Relocate the section contents. */ + if (! ((*ecoff_backend (input_bfd)->relocate_section) + (output_bfd, info, input_bfd, input_section, contents, + external_relocs))) + goto error_return; + + /* Write out the relocated section. */ + if (! bfd_set_section_contents (output_bfd, + output_section, + contents, + input_section->output_offset, + input_section->size)) + goto error_return; + + /* If we are producing relocatable output, the relocs were + modified, and we write them out now. We use the reloc_count + field of output_section to keep track of the number of relocs we + have output so far. */ + if (info->relocatable) + { + file_ptr pos = (output_section->rel_filepos + + output_section->reloc_count * external_reloc_size); + if (bfd_seek (output_bfd, pos, SEEK_SET) != 0 + || (bfd_bwrite (external_relocs, external_relocs_size, output_bfd) + != external_relocs_size)) + goto error_return; + output_section->reloc_count += input_section->reloc_count; + } + + if (contents != NULL) + free (contents); + if (external_relocs != NULL) + free (external_relocs); + return TRUE; + + error_return: + if (contents != NULL) + free (contents); + if (external_relocs != NULL) + free (external_relocs); + return FALSE; +} + +/* Generate a reloc when linking an ECOFF file. This is a reloc + requested by the linker, and does come from any input file. This + is used to build constructor and destructor tables when linking + with -Ur. */ + +static bfd_boolean +ecoff_reloc_link_order (bfd *output_bfd, + struct bfd_link_info *info, + asection *output_section, + struct bfd_link_order *link_order) +{ + enum bfd_link_order_type type; + asection *section; + bfd_vma addend; + arelent rel; + struct internal_reloc in; + bfd_size_type external_reloc_size; + bfd_byte *rbuf; + bfd_boolean ok; + file_ptr pos; + + type = link_order->type; + section = NULL; + addend = link_order->u.reloc.p->addend; + + /* We set up an arelent to pass to the backend adjust_reloc_out + routine. */ + rel.address = link_order->offset; + + rel.howto = bfd_reloc_type_lookup (output_bfd, link_order->u.reloc.p->reloc); + if (rel.howto == 0) + { + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + + if (type == bfd_section_reloc_link_order) + { + section = link_order->u.reloc.p->u.section; + rel.sym_ptr_ptr = section->symbol_ptr_ptr; + } + else + { + struct bfd_link_hash_entry *h; + + /* Treat a reloc against a defined symbol as though it were + actually against the section. */ + h = bfd_wrapped_link_hash_lookup (output_bfd, info, + link_order->u.reloc.p->u.name, + FALSE, FALSE, FALSE); + if (h != NULL + && (h->type == bfd_link_hash_defined + || h->type == bfd_link_hash_defweak)) + { + type = bfd_section_reloc_link_order; + section = h->u.def.section->output_section; + /* It seems that we ought to add the symbol value to the + addend here, but in practice it has already been added + because it was passed to constructor_callback. */ + addend += section->vma + h->u.def.section->output_offset; + } + else + { + /* We can't set up a reloc against a symbol correctly, + because we have no asymbol structure. Currently no + adjust_reloc_out routine cares. */ + rel.sym_ptr_ptr = NULL; + } + } + + /* All ECOFF relocs are in-place. Put the addend into the object + file. */ + + BFD_ASSERT (rel.howto->partial_inplace); + if (addend != 0) + { + bfd_size_type size; + bfd_reloc_status_type rstat; + bfd_byte *buf; + + size = bfd_get_reloc_size (rel.howto); + buf = bfd_zmalloc (size); + if (buf == NULL) + return FALSE; + rstat = _bfd_relocate_contents (rel.howto, output_bfd, + (bfd_vma) addend, buf); + switch (rstat) + { + case bfd_reloc_ok: + break; + default: + case bfd_reloc_outofrange: + abort (); + case bfd_reloc_overflow: + if (! ((*info->callbacks->reloc_overflow) + (info, NULL, + (link_order->type == bfd_section_reloc_link_order + ? bfd_section_name (output_bfd, section) + : link_order->u.reloc.p->u.name), + rel.howto->name, addend, NULL, + NULL, (bfd_vma) 0))) + { + free (buf); + return FALSE; + } + break; + } + ok = bfd_set_section_contents (output_bfd, output_section, (void *) buf, + (file_ptr) link_order->offset, size); + free (buf); + if (! ok) + return FALSE; + } + + rel.addend = 0; + + /* Move the information into an internal_reloc structure. */ + in.r_vaddr = (rel.address + + bfd_get_section_vma (output_bfd, output_section)); + in.r_type = rel.howto->type; + + if (type == bfd_symbol_reloc_link_order) + { + struct ecoff_link_hash_entry *h; + + h = ((struct ecoff_link_hash_entry *) + bfd_wrapped_link_hash_lookup (output_bfd, info, + link_order->u.reloc.p->u.name, + FALSE, FALSE, TRUE)); + if (h != NULL + && h->indx != -1) + in.r_symndx = h->indx; + else + { + if (! ((*info->callbacks->unattached_reloc) + (info, link_order->u.reloc.p->u.name, NULL, + NULL, (bfd_vma) 0))) + return FALSE; + in.r_symndx = 0; + } + in.r_extern = 1; + } + else + { + const char *name; + unsigned int i; + static struct + { + const char * name; + long r_symndx; + } + section_symndx [] = + { + { _TEXT, RELOC_SECTION_TEXT }, + { _RDATA, RELOC_SECTION_RDATA }, + { _DATA, RELOC_SECTION_DATA }, + { _SDATA, RELOC_SECTION_SDATA }, + { _SBSS, RELOC_SECTION_SBSS }, + { _BSS, RELOC_SECTION_BSS }, + { _INIT, RELOC_SECTION_INIT }, + { _LIT8, RELOC_SECTION_LIT8 }, + { _LIT4, RELOC_SECTION_LIT4 }, + { _XDATA, RELOC_SECTION_XDATA }, + { _PDATA, RELOC_SECTION_PDATA }, + { _FINI, RELOC_SECTION_FINI }, + { _LITA, RELOC_SECTION_LITA }, + { "*ABS*", RELOC_SECTION_ABS }, + { _RCONST, RELOC_SECTION_RCONST } + }; + + name = bfd_get_section_name (output_bfd, section); + + for (i = 0; i < ARRAY_SIZE (section_symndx); i++) + if (streq (name, section_symndx[i].name)) + { + in.r_symndx = section_symndx[i].r_symndx; + break; + } + + if (i == ARRAY_SIZE (section_symndx)) + abort (); + + in.r_extern = 0; + } + + /* Let the BFD backend adjust the reloc. */ + (*ecoff_backend (output_bfd)->adjust_reloc_out) (output_bfd, &rel, &in); + + /* Get some memory and swap out the reloc. */ + external_reloc_size = ecoff_backend (output_bfd)->external_reloc_size; + rbuf = bfd_malloc (external_reloc_size); + if (rbuf == NULL) + return FALSE; + + (*ecoff_backend (output_bfd)->swap_reloc_out) (output_bfd, &in, (void *) rbuf); + + pos = (output_section->rel_filepos + + output_section->reloc_count * external_reloc_size); + ok = (bfd_seek (output_bfd, pos, SEEK_SET) == 0 + && (bfd_bwrite ((void *) rbuf, external_reloc_size, output_bfd) + == external_reloc_size)); + + if (ok) + ++output_section->reloc_count; + + free (rbuf); + + return ok; +} + /* Put out information for an external symbol. These come only from the hash table. */ static bfd_boolean -ecoff_link_write_external (h, data) - struct ecoff_link_hash_entry *h; - PTR data; +ecoff_link_write_external (struct ecoff_link_hash_entry *h, void * data) { struct extsym_info *einfo = (struct extsym_info *) data; bfd *output_bfd = einfo->abfd; @@ -4405,7 +4316,7 @@ ecoff_link_write_external (h, data) if (strip || h->written) return TRUE; - if (h->abfd == (bfd *) NULL) + if (h->abfd == NULL) { h->esym.jmptbl = 0; h->esym.cobol_main = 0; @@ -4422,33 +4333,38 @@ ecoff_link_write_external (h, data) { asection *output_section; const char *name; + unsigned int i; + static struct + { + const char * name; + int sc; + } + section_storage_classes [] = + { + { _TEXT, scText }, + { _DATA, scData }, + { _SDATA, scSData }, + { _RDATA, scRData }, + { _BSS, scBss }, + { _SBSS, scSBss }, + { _INIT, scInit }, + { _FINI, scFini }, + { _PDATA, scPData }, + { _XDATA, scXData }, + { _RCONST, scRConst } + }; output_section = h->root.u.def.section->output_section; name = bfd_section_name (output_section->owner, output_section); - if (strcmp (name, _TEXT) == 0) - h->esym.asym.sc = scText; - else if (strcmp (name, _DATA) == 0) - h->esym.asym.sc = scData; - else if (strcmp (name, _SDATA) == 0) - h->esym.asym.sc = scSData; - else if (strcmp (name, _RDATA) == 0) - h->esym.asym.sc = scRData; - else if (strcmp (name, _BSS) == 0) - h->esym.asym.sc = scBss; - else if (strcmp (name, _SBSS) == 0) - h->esym.asym.sc = scSBss; - else if (strcmp (name, _INIT) == 0) - h->esym.asym.sc = scInit; - else if (strcmp (name, _FINI) == 0) - h->esym.asym.sc = scFini; - else if (strcmp (name, _PDATA) == 0) - h->esym.asym.sc = scPData; - else if (strcmp (name, _XDATA) == 0) - h->esym.asym.sc = scXData; - else if (strcmp (name, _RCONST) == 0) - h->esym.asym.sc = scRConst; - else + for (i = 0; i < ARRAY_SIZE (section_storage_classes); i++) + if (streq (name, section_storage_classes[i].name)) + { + h->esym.asym.sc = section_storage_classes[i].sc; + break; + } + + if (i == ARRAY_SIZE (section_storage_classes)) h->esym.asym.sc = scAbs; } @@ -4515,332 +4431,204 @@ ecoff_link_write_external (h, data) &h->esym)); } -/* Relocate and write an ECOFF section into an ECOFF output file. */ +/* ECOFF final link routine. This looks through all the input BFDs + and gathers together all the debugging information, and then + processes all the link order information. This may cause it to + close and reopen some input BFDs; I'll see how bad this is. */ -static bfd_boolean -ecoff_indirect_link_order (output_bfd, info, output_section, link_order) - bfd *output_bfd; - struct bfd_link_info *info; - asection *output_section; - struct bfd_link_order *link_order; +bfd_boolean +_bfd_ecoff_bfd_final_link (bfd *abfd, struct bfd_link_info *info) { - asection *input_section; + const struct ecoff_backend_data * const backend = ecoff_backend (abfd); + struct ecoff_debug_info * const debug = &ecoff_data (abfd)->debug_info; + HDRR *symhdr; + void * handle; bfd *input_bfd; - struct ecoff_section_tdata *section_tdata; - bfd_size_type raw_size; - bfd_size_type cooked_size; - bfd_byte *contents = NULL; - bfd_size_type external_reloc_size; - bfd_size_type external_relocs_size; - PTR external_relocs = NULL; - bfd_size_type amt; + asection *o; + struct bfd_link_order *p; + struct extsym_info einfo; - BFD_ASSERT ((output_section->flags & SEC_HAS_CONTENTS) != 0); + /* We accumulate the debugging information counts in the symbolic + header. */ + symhdr = &debug->symbolic_header; + symhdr->vstamp = 0; + symhdr->ilineMax = 0; + symhdr->cbLine = 0; + symhdr->idnMax = 0; + symhdr->ipdMax = 0; + symhdr->isymMax = 0; + symhdr->ioptMax = 0; + symhdr->iauxMax = 0; + symhdr->issMax = 0; + symhdr->issExtMax = 0; + symhdr->ifdMax = 0; + symhdr->crfd = 0; + symhdr->iextMax = 0; - if (link_order->size == 0) - return TRUE; + /* 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; - input_section = link_order->u.indirect.section; - input_bfd = input_section->owner; - section_tdata = ecoff_section_data (input_bfd, input_section); + handle = bfd_ecoff_debug_init (abfd, debug, &backend->debug_swap, info); + if (handle == NULL) + return FALSE; - raw_size = input_section->_raw_size; - cooked_size = input_section->_cooked_size; - if (cooked_size == 0) - cooked_size = raw_size; - - BFD_ASSERT (input_section->output_section == output_section); - BFD_ASSERT (input_section->output_offset == link_order->offset); - BFD_ASSERT (cooked_size == link_order->size); - - /* Get the section contents. We allocate memory for the larger of - the size before relocating and the size after relocating. */ - amt = raw_size >= cooked_size ? raw_size : cooked_size; - contents = (bfd_byte *) bfd_malloc (amt); - if (contents == NULL && amt != 0) - goto error_return; - - /* If we are relaxing, the contents may have already been read into - memory, in which case we copy them into our new buffer. We don't - simply reuse the old buffer in case cooked_size > raw_size. */ - if (section_tdata != (struct ecoff_section_tdata *) NULL - && section_tdata->contents != (bfd_byte *) NULL) - memcpy (contents, section_tdata->contents, (size_t) raw_size); - else + /* Accumulate the debugging symbols from each input BFD. */ + for (input_bfd = info->input_bfds; + input_bfd != NULL; + input_bfd = input_bfd->link_next) { - if (! bfd_get_section_contents (input_bfd, input_section, - (PTR) contents, - (file_ptr) 0, raw_size)) - goto error_return; + bfd_boolean ret; + + if (bfd_get_flavour (input_bfd) == bfd_target_ecoff_flavour) + { + /* Arbitrarily set the symbolic header vstamp to the vstamp + of the first object file in the link. */ + if (symhdr->vstamp == 0) + symhdr->vstamp + = ecoff_data (input_bfd)->debug_info.symbolic_header.vstamp; + ret = ecoff_final_link_debug_accumulate (abfd, input_bfd, info, + handle); + } + else + ret = bfd_ecoff_debug_accumulate_other (handle, abfd, + debug, &backend->debug_swap, + input_bfd, info); + if (! ret) + return FALSE; + + /* Combine the register masks. */ + ecoff_data (abfd)->gprmask |= ecoff_data (input_bfd)->gprmask; + ecoff_data (abfd)->fprmask |= ecoff_data (input_bfd)->fprmask; + ecoff_data (abfd)->cprmask[0] |= ecoff_data (input_bfd)->cprmask[0]; + ecoff_data (abfd)->cprmask[1] |= ecoff_data (input_bfd)->cprmask[1]; + ecoff_data (abfd)->cprmask[2] |= ecoff_data (input_bfd)->cprmask[2]; + ecoff_data (abfd)->cprmask[3] |= ecoff_data (input_bfd)->cprmask[3]; } - /* Get the relocs. If we are relaxing MIPS code, they will already - have been read in. Otherwise, we read them in now. */ - external_reloc_size = ecoff_backend (input_bfd)->external_reloc_size; - external_relocs_size = external_reloc_size * input_section->reloc_count; + /* Write out the external symbols. */ + einfo.abfd = abfd; + einfo.info = info; + ecoff_link_hash_traverse (ecoff_hash_table (info), + ecoff_link_write_external, + (void *) &einfo); - if (section_tdata != (struct ecoff_section_tdata *) NULL - && section_tdata->external_relocs != NULL) - external_relocs = section_tdata->external_relocs; - else - { - external_relocs = (PTR) bfd_malloc (external_relocs_size); - if (external_relocs == NULL && external_relocs_size != 0) - goto error_return; - - if (bfd_seek (input_bfd, input_section->rel_filepos, SEEK_SET) != 0 - || (bfd_bread (external_relocs, external_relocs_size, input_bfd) - != external_relocs_size)) - goto error_return; - } - - /* Relocate the section contents. */ - if (! ((*ecoff_backend (input_bfd)->relocate_section) - (output_bfd, info, input_bfd, input_section, contents, - external_relocs))) - goto error_return; - - /* Write out the relocated section. */ - if (! bfd_set_section_contents (output_bfd, - output_section, - (PTR) contents, - (file_ptr) input_section->output_offset, - cooked_size)) - goto error_return; - - /* If we are producing relocatable output, the relocs were - modified, and we write them out now. We use the reloc_count - field of output_section to keep track of the number of relocs we - have output so far. */ if (info->relocatable) { - file_ptr pos = (output_section->rel_filepos - + output_section->reloc_count * external_reloc_size); - if (bfd_seek (output_bfd, pos, SEEK_SET) != 0 - || (bfd_bwrite (external_relocs, external_relocs_size, output_bfd) - != external_relocs_size)) - goto error_return; - output_section->reloc_count += input_section->reloc_count; + /* We need to make a pass over the link_orders to count up the + number of relocations we will need to output, so that we know + how much space they will take up. */ + for (o = abfd->sections; o != NULL; o = o->next) + { + o->reloc_count = 0; + for (p = o->map_head.link_order; + p != NULL; + p = p->next) + if (p->type == bfd_indirect_link_order) + o->reloc_count += p->u.indirect.section->reloc_count; + else if (p->type == bfd_section_reloc_link_order + || p->type == bfd_symbol_reloc_link_order) + ++o->reloc_count; + } } - if (contents != NULL) - free (contents); - if (external_relocs != NULL && section_tdata == NULL) - free (external_relocs); - return TRUE; + /* Compute the reloc and symbol file positions. */ + ecoff_compute_reloc_file_positions (abfd); - error_return: - if (contents != NULL) - free (contents); - if (external_relocs != NULL && section_tdata == NULL) - free (external_relocs); - return FALSE; -} + /* Write out the debugging information. */ + if (! bfd_ecoff_write_accumulated_debug (handle, abfd, debug, + &backend->debug_swap, info, + ecoff_data (abfd)->sym_filepos)) + return FALSE; -/* Generate a reloc when linking an ECOFF file. This is a reloc - requested by the linker, and does come from any input file. This - is used to build constructor and destructor tables when linking - with -Ur. */ + bfd_ecoff_debug_free (handle, abfd, debug, &backend->debug_swap, info); -static bfd_boolean -ecoff_reloc_link_order (output_bfd, info, output_section, link_order) - bfd *output_bfd; - struct bfd_link_info *info; - asection *output_section; - struct bfd_link_order *link_order; -{ - enum bfd_link_order_type type; - asection *section; - bfd_vma addend; - arelent rel; - struct internal_reloc in; - bfd_size_type external_reloc_size; - bfd_byte *rbuf; - bfd_boolean ok; - file_ptr pos; - - type = link_order->type; - section = NULL; - addend = link_order->u.reloc.p->addend; - - /* We set up an arelent to pass to the backend adjust_reloc_out - routine. */ - rel.address = link_order->offset; - - rel.howto = bfd_reloc_type_lookup (output_bfd, link_order->u.reloc.p->reloc); - if (rel.howto == 0) + if (info->relocatable) { - bfd_set_error (bfd_error_bad_value); - return FALSE; + /* Now reset the reloc_count field of the sections in the output + BFD to 0, so that we can use them to keep track of how many + relocs we have output thus far. */ + for (o = abfd->sections; o != NULL; o = o->next) + o->reloc_count = 0; } - if (type == bfd_section_reloc_link_order) - { - section = link_order->u.reloc.p->u.section; - rel.sym_ptr_ptr = section->symbol_ptr_ptr; - } - else + /* Get a value for the GP register. */ + if (ecoff_data (abfd)->gp == 0) { struct bfd_link_hash_entry *h; - /* Treat a reloc against a defined symbol as though it were - actually against the section. */ - h = bfd_wrapped_link_hash_lookup (output_bfd, info, - link_order->u.reloc.p->u.name, - FALSE, FALSE, FALSE); + h = bfd_link_hash_lookup (info->hash, "_gp", FALSE, FALSE, TRUE); if (h != NULL - && (h->type == bfd_link_hash_defined - || h->type == bfd_link_hash_defweak)) + && h->type == bfd_link_hash_defined) + ecoff_data (abfd)->gp = (h->u.def.value + + h->u.def.section->output_section->vma + + h->u.def.section->output_offset); + else if (info->relocatable) { - type = bfd_section_reloc_link_order; - section = h->u.def.section->output_section; - /* It seems that we ought to add the symbol value to the - addend here, but in practice it has already been added - because it was passed to constructor_callback. */ - addend += section->vma + h->u.def.section->output_offset; - } - else - { - /* We can't set up a reloc against a symbol correctly, - because we have no asymbol structure. Currently no - adjust_reloc_out routine cares. */ - rel.sym_ptr_ptr = (asymbol **) NULL; - } - } + bfd_vma lo; - /* All ECOFF relocs are in-place. Put the addend into the object - file. */ - - BFD_ASSERT (rel.howto->partial_inplace); - if (addend != 0) - { - bfd_size_type size; - bfd_reloc_status_type rstat; - bfd_byte *buf; - - size = bfd_get_reloc_size (rel.howto); - buf = (bfd_byte *) bfd_zmalloc (size); - if (buf == (bfd_byte *) NULL) - return FALSE; - rstat = _bfd_relocate_contents (rel.howto, output_bfd, - (bfd_vma) addend, buf); - switch (rstat) - { - case bfd_reloc_ok: - break; - default: - case bfd_reloc_outofrange: - abort (); - case bfd_reloc_overflow: - if (! ((*info->callbacks->reloc_overflow) - (info, - (link_order->type == bfd_section_reloc_link_order - ? bfd_section_name (output_bfd, section) - : link_order->u.reloc.p->u.name), - rel.howto->name, addend, (bfd *) NULL, - (asection *) NULL, (bfd_vma) 0))) + /* Make up a value. */ + lo = (bfd_vma) -1; + for (o = abfd->sections; o != NULL; o = o->next) { - free (buf); - return FALSE; + if (o->vma < lo + && (streq (o->name, _SBSS) + || streq (o->name, _SDATA) + || streq (o->name, _LIT4) + || streq (o->name, _LIT8) + || streq (o->name, _LITA))) + lo = o->vma; } - break; + ecoff_data (abfd)->gp = lo + 0x8000; } - ok = bfd_set_section_contents (output_bfd, output_section, (PTR) buf, - (file_ptr) link_order->offset, size); - free (buf); - if (! ok) - return FALSE; - } - - rel.addend = 0; - - /* Move the information into an internal_reloc structure. */ - in.r_vaddr = (rel.address - + bfd_get_section_vma (output_bfd, output_section)); - in.r_type = rel.howto->type; - - if (type == bfd_symbol_reloc_link_order) - { - struct ecoff_link_hash_entry *h; - - h = ((struct ecoff_link_hash_entry *) - bfd_wrapped_link_hash_lookup (output_bfd, info, - link_order->u.reloc.p->u.name, - FALSE, FALSE, TRUE)); - if (h != (struct ecoff_link_hash_entry *) NULL - && h->indx != -1) - in.r_symndx = h->indx; else { - if (! ((*info->callbacks->unattached_reloc) - (info, link_order->u.reloc.p->u.name, (bfd *) NULL, - (asection *) NULL, (bfd_vma) 0))) - return FALSE; - in.r_symndx = 0; + /* 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. */ } - in.r_extern = 1; } - else + + for (o = abfd->sections; o != NULL; o = o->next) { - const char *name; - - name = bfd_get_section_name (output_bfd, section); - if (strcmp (name, ".text") == 0) - in.r_symndx = RELOC_SECTION_TEXT; - else if (strcmp (name, ".rdata") == 0) - in.r_symndx = RELOC_SECTION_RDATA; - else if (strcmp (name, ".data") == 0) - in.r_symndx = RELOC_SECTION_DATA; - else if (strcmp (name, ".sdata") == 0) - in.r_symndx = RELOC_SECTION_SDATA; - else if (strcmp (name, ".sbss") == 0) - in.r_symndx = RELOC_SECTION_SBSS; - else if (strcmp (name, ".bss") == 0) - in.r_symndx = RELOC_SECTION_BSS; - else if (strcmp (name, ".init") == 0) - in.r_symndx = RELOC_SECTION_INIT; - else if (strcmp (name, ".lit8") == 0) - in.r_symndx = RELOC_SECTION_LIT8; - else if (strcmp (name, ".lit4") == 0) - in.r_symndx = RELOC_SECTION_LIT4; - else if (strcmp (name, ".xdata") == 0) - in.r_symndx = RELOC_SECTION_XDATA; - else if (strcmp (name, ".pdata") == 0) - in.r_symndx = RELOC_SECTION_PDATA; - else if (strcmp (name, ".fini") == 0) - in.r_symndx = RELOC_SECTION_FINI; - else if (strcmp (name, ".lita") == 0) - in.r_symndx = RELOC_SECTION_LITA; - else if (strcmp (name, "*ABS*") == 0) - in.r_symndx = RELOC_SECTION_ABS; - else if (strcmp (name, ".rconst") == 0) - in.r_symndx = RELOC_SECTION_RCONST; - else - abort (); - in.r_extern = 0; + for (p = o->map_head.link_order; + p != NULL; + p = p->next) + { + if (p->type == bfd_indirect_link_order + && (bfd_get_flavour (p->u.indirect.section->owner) + == bfd_target_ecoff_flavour)) + { + if (! ecoff_indirect_link_order (abfd, info, o, p)) + return FALSE; + } + else if (p->type == bfd_section_reloc_link_order + || p->type == bfd_symbol_reloc_link_order) + { + if (! ecoff_reloc_link_order (abfd, info, o, p)) + return FALSE; + } + else + { + if (! _bfd_default_link_order (abfd, info, o, p)) + return FALSE; + } + } } - /* Let the BFD backend adjust the reloc. */ - (*ecoff_backend (output_bfd)->adjust_reloc_out) (output_bfd, &rel, &in); + bfd_get_symcount (abfd) = symhdr->iextMax + symhdr->isymMax; - /* Get some memory and swap out the reloc. */ - external_reloc_size = ecoff_backend (output_bfd)->external_reloc_size; - rbuf = (bfd_byte *) bfd_malloc (external_reloc_size); - if (rbuf == (bfd_byte *) NULL) - return FALSE; + ecoff_data (abfd)->linker = TRUE; - (*ecoff_backend (output_bfd)->swap_reloc_out) (output_bfd, &in, (PTR) rbuf); - - pos = (output_section->rel_filepos - + output_section->reloc_count * external_reloc_size); - ok = (bfd_seek (output_bfd, pos, SEEK_SET) == 0 - && (bfd_bwrite ((PTR) rbuf, external_reloc_size, output_bfd) - == external_reloc_size)); - - if (ok) - ++output_section->reloc_count; - - free (rbuf); - - return ok; + return TRUE; } diff --git a/contrib/binutils/bfd/ecofflink.c b/contrib/binutils/bfd/ecofflink.c index 9e23848fda7..4246e94f393 100644 --- a/contrib/binutils/bfd/ecofflink.c +++ b/contrib/binutils/bfd/ecofflink.c @@ -1,6 +1,6 @@ /* Routines to link ECOFF debugging information. - Copyright 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2002, 2003 - Free Software Foundation, Inc. + Copyright 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003, + 2004, 2005, 2006 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support, . This file is part of BFD, the Binary File Descriptor library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" @@ -501,8 +501,8 @@ bfd_ecoff_debug_init (output_bfd, output_debug, output_swap, info) ainfo = (struct accumulate *) bfd_malloc (amt); if (!ainfo) return NULL; - if (! bfd_hash_table_init_n (&ainfo->fdr_hash.table, string_hash_newfunc, - 1021)) + if (!bfd_hash_table_init_n (&ainfo->fdr_hash.table, string_hash_newfunc, + sizeof (struct string_hash_entry), 1021)) return NULL; ainfo->line = NULL; @@ -528,7 +528,8 @@ bfd_ecoff_debug_init (output_bfd, output_debug, output_swap, info) if (! info->relocatable) { - if (! bfd_hash_table_init (&ainfo->str_hash.table, string_hash_newfunc)) + if (!bfd_hash_table_init (&ainfo->str_hash.table, string_hash_newfunc, + sizeof (struct string_hash_entry))) return NULL; /* The first entry in the string table is the empty string. */ @@ -800,20 +801,6 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap, fdr_adr = fdr.adr; - /* Adjust the FDR address for any changes that may have been - made by relaxing. */ - if (input_debug->adjust != (struct ecoff_value_adjust *) NULL) - { - struct ecoff_value_adjust *adjust; - - for (adjust = input_debug->adjust; - adjust != (struct ecoff_value_adjust *) NULL; - adjust = adjust->next) - if (fdr_adr >= adjust->start - && fdr_adr < adjust->end) - fdr.adr += adjust->adjust; - } - /* FIXME: It is conceivable that this FDR points to the .init or .fini section, in which case this will not do the right thing. */ @@ -856,19 +843,6 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap, case stLabel: case stProc: case stStaticProc: - if (input_debug->adjust != (struct ecoff_value_adjust *) NULL) - { - bfd_vma value; - struct ecoff_value_adjust *adjust; - - value = internal_sym.value; - for (adjust = input_debug->adjust; - adjust != (struct ecoff_value_adjust *) NULL; - adjust = adjust->next) - if (value >= adjust->start - && value < adjust->end) - internal_sym.value += adjust->adjust; - } internal_sym.value += section_adjust[internal_sym.sc]; break; @@ -978,9 +952,8 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap, output_symhdr->issMax += fdr.cbSs; } - if ((output_bfd->xvec->header_byteorder - == input_bfd->xvec->header_byteorder) - && input_debug->adjust == (struct ecoff_value_adjust *) NULL) + if (output_bfd->xvec->header_byteorder + == input_bfd->xvec->header_byteorder) { /* The two BFD's have the same endianness, and we don't have to adjust the PDR addresses, so simply copying the @@ -1036,23 +1009,6 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap, PDR pdr; (*input_swap->swap_pdr_in) (input_bfd, (PTR) in, &pdr); - - /* If we have been relaxing, we may have to adjust the - address. */ - if (input_debug->adjust != (struct ecoff_value_adjust *) NULL) - { - bfd_vma adr; - struct ecoff_value_adjust *adjust; - - adr = fdr_adr + pdr.adr; - for (adjust = input_debug->adjust; - adjust != (struct ecoff_value_adjust *) NULL; - adjust = adjust->next) - if (adr >= adjust->start - && adr < adjust->end) - pdr.adr += adjust->adjust; - } - (*output_swap->swap_pdr_out) (output_bfd, &pdr, (PTR) out); } @@ -1199,7 +1155,7 @@ bfd_ecoff_debug_accumulate_other (handle, output_bfd, output_debug, fdr.issBase = output_symhdr->issMax; fdr.cbSs = 0; fdr.rss = ecoff_add_string (ainfo, info, output_debug, &fdr, - bfd_archive_filename (input_bfd)); + input_bfd->filename); if (fdr.rss == -1) return FALSE; fdr.isymBase = output_symhdr->isymMax; @@ -1383,10 +1339,14 @@ bfd_ecoff_debug_one_external (abfd, debug, swap, name, esym) - (char *) debug->external_ext) < (symhdr->iextMax + 1) * external_ext_size) { - if (! ecoff_add_bytes ((char **) &debug->external_ext, - (char **) &debug->external_ext_end, + char *external_ext = debug->external_ext; + char *external_ext_end = debug->external_ext_end; + if (! ecoff_add_bytes ((char **) &external_ext, + (char **) &external_ext_end, (symhdr->iextMax + 1) * (size_t) external_ext_size)) return FALSE; + debug->external_ext = external_ext; + debug->external_ext_end = external_ext_end; } esym->asym.iss = symhdr->issExtMax; @@ -1884,24 +1844,9 @@ mk_fdrtab (abfd, debug_info, debug_swap, line_info) addresses do not equal the FDR vma, but they (the PDR address) are still vma's and not offsets. Cf. comments in 'lookup_line'. */ -#if 0 - bfd_size_type external_pdr_size; - char *pdr_ptr; - PDR pdr; - - external_pdr_size = debug_swap->external_pdr_size; - - pdr_ptr = ((char *) debug_info->external_pdr - + fdr_ptr->ipdFirst * external_pdr_size); - (*debug_swap->swap_pdr_in) (abfd, (PTR) pdr_ptr, &pdr); - /* The address of the first PDR is the offset of that - procedure relative to the beginning of file FDR. */ - tab->base_addr = fdr_ptr->adr - pdr.adr; -#else /* The address of the first PDR is the offset of that procedure relative to the beginning of file FDR. */ tab->base_addr = fdr_ptr->adr; -#endif } else { @@ -2160,11 +2105,6 @@ lookup_line (abfd, debug_info, debug_swap, line_info) considerably, which is undesirable. */ external_pdr_size = debug_swap->external_pdr_size; -#if 0 /* eraxxon: PDR addresses (pdr.adr) are not relative to FDRs! - Leave 'offset' alone. */ - /* Make offset relative to object file's start-address. */ - offset -= tab[i].base_addr; -#endif /* eraxxon: The Horrible Hack: Because of the problems above, set 'i' to 0 so we look through all FDRs. diff --git a/contrib/binutils/bfd/ecoffswap.h b/contrib/binutils/bfd/ecoffswap.h index 7ea03943bb0..4d93d9dd2d2 100644 --- a/contrib/binutils/bfd/ecoffswap.h +++ b/contrib/binutils/bfd/ecoffswap.h @@ -1,5 +1,5 @@ /* Generic ECOFF swapping routines, for BFD. - Copyright 1992, 1993, 1994, 1995, 1996, 2000, 2001, 2002 + Copyright 1992, 1993, 1994, 1995, 1996, 2000, 2001, 2002, 2004, 2005 Free Software Foundation, Inc. Written by Cygnus Support. @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* NOTE: This is a header file, but it contains executable routines. This is done this way because these routines are substantially @@ -65,40 +65,37 @@ for all ECOFF targets, so they are defined in ecofflink.c. */ extern void _bfd_ecoff_swap_tir_in - PARAMS ((int, const struct tir_ext *, TIR *)); + (int, const struct tir_ext *, TIR *); extern void _bfd_ecoff_swap_tir_out - PARAMS ((int, const TIR *, struct tir_ext *)); + (int, const TIR *, struct tir_ext *); extern void _bfd_ecoff_swap_rndx_in - PARAMS ((int, const struct rndx_ext *, RNDXR *)); + (int, const struct rndx_ext *, RNDXR *); extern void _bfd_ecoff_swap_rndx_out - PARAMS ((int, const RNDXR *, struct rndx_ext *)); + (int, const RNDXR *, struct rndx_ext *); /* Prototypes for functions defined in this file. */ -static void ecoff_swap_hdr_in PARAMS ((bfd *, PTR, HDRR *)); -static void ecoff_swap_hdr_out PARAMS ((bfd *, const HDRR *, PTR)); -static void ecoff_swap_fdr_in PARAMS ((bfd *, PTR, FDR *)); -static void ecoff_swap_fdr_out PARAMS ((bfd *, const FDR *, PTR)); -static void ecoff_swap_pdr_in PARAMS ((bfd *, PTR, PDR *)); -static void ecoff_swap_pdr_out PARAMS ((bfd *, const PDR *, PTR)); -static void ecoff_swap_sym_in PARAMS ((bfd *, PTR, SYMR *)); -static void ecoff_swap_sym_out PARAMS ((bfd *, const SYMR *, PTR)); -static void ecoff_swap_ext_in PARAMS ((bfd *, PTR, EXTR *)); -static void ecoff_swap_ext_out PARAMS ((bfd *, const EXTR *, PTR)); -static void ecoff_swap_rfd_in PARAMS ((bfd *, PTR, RFDT *)); -static void ecoff_swap_rfd_out PARAMS ((bfd *, const RFDT *, PTR)); -static void ecoff_swap_opt_in PARAMS ((bfd *, PTR, OPTR *)); -static void ecoff_swap_opt_out PARAMS ((bfd *, const OPTR *, PTR)); -static void ecoff_swap_dnr_in PARAMS ((bfd *, PTR, DNR *)); -static void ecoff_swap_dnr_out PARAMS ((bfd *, const DNR *, PTR)); +static void ecoff_swap_hdr_in (bfd *, void *, HDRR *); +static void ecoff_swap_hdr_out (bfd *, const HDRR *, void *); +static void ecoff_swap_fdr_in (bfd *, void *, FDR *); +static void ecoff_swap_fdr_out (bfd *, const FDR *, void *); +static void ecoff_swap_pdr_in (bfd *, void *, PDR *); +static void ecoff_swap_pdr_out (bfd *, const PDR *, void *); +static void ecoff_swap_sym_in (bfd *, void *, SYMR *); +static void ecoff_swap_sym_out (bfd *, const SYMR *, void *); +static void ecoff_swap_ext_in (bfd *, void *, EXTR *); +static void ecoff_swap_ext_out (bfd *, const EXTR *, void *); +static void ecoff_swap_rfd_in (bfd *, void *, RFDT *); +static void ecoff_swap_rfd_out (bfd *, const RFDT *, void *); +static void ecoff_swap_opt_in (bfd *, void *, OPTR *); +static void ecoff_swap_opt_out (bfd *, const OPTR *, void *); +static void ecoff_swap_dnr_in (bfd *, void *, DNR *); +static void ecoff_swap_dnr_out (bfd *, const DNR *, void *); /* Swap in the symbolic header. */ static void -ecoff_swap_hdr_in (abfd, ext_copy, intern) - bfd *abfd; - PTR ext_copy; - HDRR *intern; +ecoff_swap_hdr_in (bfd *abfd, void * ext_copy, HDRR *intern) { struct hdr_ext ext[1]; @@ -131,7 +128,7 @@ ecoff_swap_hdr_in (abfd, ext_copy, intern) intern->cbExtOffset = ECOFF_GET_OFF (abfd, ext->h_cbExtOffset); #ifdef TEST - if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) + if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0) abort (); #endif } @@ -139,10 +136,7 @@ ecoff_swap_hdr_in (abfd, ext_copy, intern) /* Swap out the symbolic header. */ static void -ecoff_swap_hdr_out (abfd, intern_copy, ext_ptr) - bfd *abfd; - const HDRR *intern_copy; - PTR ext_ptr; +ecoff_swap_hdr_out (bfd *abfd, const HDRR *intern_copy, void * ext_ptr) { struct hdr_ext *ext = (struct hdr_ext *) ext_ptr; HDRR intern[1]; @@ -184,10 +178,7 @@ ecoff_swap_hdr_out (abfd, intern_copy, ext_ptr) /* Swap in the file descriptor record. */ static void -ecoff_swap_fdr_in (abfd, ext_copy, intern) - bfd *abfd; - PTR ext_copy; - FDR *intern; +ecoff_swap_fdr_in (bfd *abfd, void * ext_copy, FDR *intern) { struct fdr_ext ext[1]; @@ -247,7 +238,7 @@ ecoff_swap_fdr_in (abfd, ext_copy, intern) intern->cbLine = ECOFF_GET_OFF (abfd, ext->f_cbLine); #ifdef TEST - if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) + if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0) abort (); #endif } @@ -255,10 +246,7 @@ ecoff_swap_fdr_in (abfd, ext_copy, intern) /* Swap out the file descriptor record. */ static void -ecoff_swap_fdr_out (abfd, intern_copy, ext_ptr) - bfd *abfd; - const FDR *intern_copy; - PTR ext_ptr; +ecoff_swap_fdr_out (bfd *abfd, const FDR *intern_copy, void * ext_ptr) { struct fdr_ext *ext = (struct fdr_ext *) ext_ptr; FDR intern[1]; @@ -319,26 +307,21 @@ ecoff_swap_fdr_out (abfd, intern_copy, ext_ptr) ECOFF_PUT_OFF (abfd, intern->cbLine, ext->f_cbLine); #ifdef TEST - if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) + if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0) abort (); #endif } -#ifndef MPW_C - /* Swap in the procedure descriptor record. */ static void -ecoff_swap_pdr_in (abfd, ext_copy, intern) - bfd *abfd; - PTR ext_copy; - PDR *intern; +ecoff_swap_pdr_in (bfd *abfd, void * ext_copy, PDR *intern) { struct pdr_ext ext[1]; *ext = *(struct pdr_ext *) ext_copy; - memset ((PTR) intern, 0, sizeof (*intern)); + memset ((void *) intern, 0, sizeof (*intern)); intern->adr = ECOFF_GET_OFF (abfd, ext->p_adr); intern->isym = H_GET_32 (abfd, ext->p_isym); @@ -386,7 +369,7 @@ ecoff_swap_pdr_in (abfd, ext_copy, intern) #endif #ifdef TEST - if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) + if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0) abort (); #endif } @@ -394,10 +377,7 @@ ecoff_swap_pdr_in (abfd, ext_copy, intern) /* Swap out the procedure descriptor record. */ static void -ecoff_swap_pdr_out (abfd, intern_copy, ext_ptr) - bfd *abfd; - const PDR *intern_copy; - PTR ext_ptr; +ecoff_swap_pdr_out (bfd *abfd, const PDR *intern_copy, void * ext_ptr) { struct pdr_ext *ext = (struct pdr_ext *) ext_ptr; PDR intern[1]; @@ -449,90 +429,15 @@ ecoff_swap_pdr_out (abfd, intern_copy, ext_ptr) #endif #ifdef TEST - if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) + if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0) abort (); #endif } -#else /* MPW_C */ -/* Same routines, but with ECOFF_64 code removed, so ^&%$#&! MPW C doesn't - corrupt itself and then freak out. */ -/* Swap in the procedure descriptor record. */ - -static void -ecoff_swap_pdr_in (abfd, ext_copy, intern) - bfd *abfd; - PTR ext_copy; - PDR *intern; -{ - struct pdr_ext ext[1]; - - *ext = *(struct pdr_ext *) ext_copy; - - intern->adr = ECOFF_GET_OFF (abfd, ext->p_adr); - intern->isym = H_GET_32 (abfd, ext->p_isym); - intern->iline = H_GET_32 (abfd, ext->p_iline); - intern->regmask = H_GET_32 (abfd, ext->p_regmask); - intern->regoffset = H_GET_S32 (abfd, ext->p_regoffset); - intern->iopt = H_GET_S32 (abfd, ext->p_iopt); - intern->fregmask = H_GET_32 (abfd, ext->p_fregmask); - intern->fregoffset = H_GET_S32 (abfd, ext->p_fregoffset); - intern->frameoffset = H_GET_S32 (abfd, ext->p_frameoffset); - intern->framereg = H_GET_16 (abfd, ext->p_framereg); - intern->pcreg = H_GET_16 (abfd, ext->p_pcreg); - intern->lnLow = H_GET_32 (abfd, ext->p_lnLow); - intern->lnHigh = H_GET_32 (abfd, ext->p_lnHigh); - intern->cbLineOffset = ECOFF_GET_OFF (abfd, ext->p_cbLineOffset); - -#ifdef TEST - if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) - abort (); -#endif -} - -/* Swap out the procedure descriptor record. */ - -static void -ecoff_swap_pdr_out (abfd, intern_copy, ext_ptr) - bfd *abfd; - const PDR *intern_copy; - PTR ext_ptr; -{ - struct pdr_ext *ext = (struct pdr_ext *) ext_ptr; - PDR intern[1]; - - /* Make it reasonable to do in-place. */ - *intern = *intern_copy; - - ECOFF_PUT_OFF (abfd, intern->adr, ext->p_adr); - H_PUT_32 (abfd, intern->isym, ext->p_isym); - H_PUT_32 (abfd, intern->iline, ext->p_iline); - H_PUT_32 (abfd, intern->regmask, ext->p_regmask); - H_PUT_32 (abfd, intern->regoffset, ext->p_regoffset); - H_PUT_32 (abfd, intern->iopt, ext->p_iopt); - H_PUT_32 (abfd, intern->fregmask, ext->p_fregmask); - H_PUT_32 (abfd, intern->fregoffset, ext->p_fregoffset); - H_PUT_32 (abfd, intern->frameoffset, ext->p_frameoffset); - H_PUT_16 (abfd, intern->framereg, ext->p_framereg); - H_PUT_16 (abfd, intern->pcreg, ext->p_pcreg); - H_PUT_32 (abfd, intern->lnLow, ext->p_lnLow); - H_PUT_32 (abfd, intern->lnHigh, ext->p_lnHigh); - ECOFF_PUT_OFF (abfd, intern->cbLineOffset, ext->p_cbLineOffset); - -#ifdef TEST - if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) - abort (); -#endif -} -#endif /* MPW_C */ - /* Swap in a symbol record. */ static void -ecoff_swap_sym_in (abfd, ext_copy, intern) - bfd *abfd; - PTR ext_copy; - SYMR *intern; +ecoff_swap_sym_in (bfd *abfd, void * ext_copy, SYMR *intern) { struct sym_ext ext[1]; @@ -578,7 +483,7 @@ ecoff_swap_sym_in (abfd, ext_copy, intern) } #ifdef TEST - if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) + if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0) abort (); #endif } @@ -586,10 +491,7 @@ ecoff_swap_sym_in (abfd, ext_copy, intern) /* Swap out a symbol record. */ static void -ecoff_swap_sym_out (abfd, intern_copy, ext_ptr) - bfd *abfd; - const SYMR *intern_copy; - PTR ext_ptr; +ecoff_swap_sym_out (bfd *abfd, const SYMR *intern_copy, void * ext_ptr) { struct sym_ext *ext = (struct sym_ext *) ext_ptr; SYMR intern[1]; @@ -631,7 +533,7 @@ ecoff_swap_sym_out (abfd, intern_copy, ext_ptr) } #ifdef TEST - if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) + if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0) abort (); #endif } @@ -639,10 +541,7 @@ ecoff_swap_sym_out (abfd, intern_copy, ext_ptr) /* Swap in an external symbol record. */ static void -ecoff_swap_ext_in (abfd, ext_copy, intern) - bfd *abfd; - PTR ext_copy; - EXTR *intern; +ecoff_swap_ext_in (bfd *abfd, void * ext_copy, EXTR *intern) { struct ext_ext ext[1]; @@ -673,7 +572,7 @@ ecoff_swap_ext_in (abfd, ext_copy, intern) ecoff_swap_sym_in (abfd, &ext->es_asym, &intern->asym); #ifdef TEST - if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) + if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0) abort (); #endif } @@ -681,10 +580,7 @@ ecoff_swap_ext_in (abfd, ext_copy, intern) /* Swap out an external symbol record. */ static void -ecoff_swap_ext_out (abfd, intern_copy, ext_ptr) - bfd *abfd; - const EXTR *intern_copy; - PTR ext_ptr; +ecoff_swap_ext_out (bfd *abfd, const EXTR *intern_copy, void * ext_ptr) { struct ext_ext *ext = (struct ext_ext *) ext_ptr; EXTR intern[1]; @@ -726,7 +622,7 @@ ecoff_swap_ext_out (abfd, intern_copy, ext_ptr) ecoff_swap_sym_out (abfd, &intern->asym, &ext->es_asym); #ifdef TEST - if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) + if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0) abort (); #endif } @@ -734,17 +630,14 @@ ecoff_swap_ext_out (abfd, intern_copy, ext_ptr) /* Swap in a relative file descriptor. */ static void -ecoff_swap_rfd_in (abfd, ext_ptr, intern) - bfd *abfd; - PTR ext_ptr; - RFDT *intern; +ecoff_swap_rfd_in (bfd *abfd, void * ext_ptr, RFDT *intern) { struct rfd_ext *ext = (struct rfd_ext *) ext_ptr; *intern = H_GET_32 (abfd, ext->rfd); #ifdef TEST - if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) + if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0) abort (); #endif } @@ -752,17 +645,14 @@ ecoff_swap_rfd_in (abfd, ext_ptr, intern) /* Swap out a relative file descriptor. */ static void -ecoff_swap_rfd_out (abfd, intern, ext_ptr) - bfd *abfd; - const RFDT *intern; - PTR ext_ptr; +ecoff_swap_rfd_out (bfd *abfd, const RFDT *intern, void * ext_ptr) { struct rfd_ext *ext = (struct rfd_ext *) ext_ptr; H_PUT_32 (abfd, *intern, ext->rfd); #ifdef TEST - if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) + if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0) abort (); #endif } @@ -770,10 +660,7 @@ ecoff_swap_rfd_out (abfd, intern, ext_ptr) /* Swap in an optimization symbol. */ static void -ecoff_swap_opt_in (abfd, ext_copy, intern) - bfd *abfd; - PTR ext_copy; - OPTR *intern; +ecoff_swap_opt_in (bfd *abfd, void * ext_copy, OPTR * intern) { struct opt_ext ext[1]; @@ -803,7 +690,7 @@ ecoff_swap_opt_in (abfd, ext_copy, intern) intern->offset = H_GET_32 (abfd, ext->o_offset); #ifdef TEST - if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) + if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0) abort (); #endif } @@ -811,10 +698,7 @@ ecoff_swap_opt_in (abfd, ext_copy, intern) /* Swap out an optimization symbol. */ static void -ecoff_swap_opt_out (abfd, intern_copy, ext_ptr) - bfd *abfd; - const OPTR *intern_copy; - PTR ext_ptr; +ecoff_swap_opt_out (bfd *abfd, const OPTR *intern_copy, void * ext_ptr) { struct opt_ext *ext = (struct opt_ext *) ext_ptr; OPTR intern[1]; @@ -843,7 +727,7 @@ ecoff_swap_opt_out (abfd, intern_copy, ext_ptr) H_PUT_32 (abfd, intern->value, ext->o_offset); #ifdef TEST - if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) + if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0) abort (); #endif } @@ -851,10 +735,7 @@ ecoff_swap_opt_out (abfd, intern_copy, ext_ptr) /* Swap in a dense number. */ static void -ecoff_swap_dnr_in (abfd, ext_copy, intern) - bfd *abfd; - PTR ext_copy; - DNR *intern; +ecoff_swap_dnr_in (bfd *abfd, void * ext_copy, DNR *intern) { struct dnr_ext ext[1]; @@ -864,7 +745,7 @@ ecoff_swap_dnr_in (abfd, ext_copy, intern) intern->index = H_GET_32 (abfd, ext->d_index); #ifdef TEST - if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) + if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0) abort (); #endif } @@ -872,10 +753,7 @@ ecoff_swap_dnr_in (abfd, ext_copy, intern) /* Swap out a dense number. */ static void -ecoff_swap_dnr_out (abfd, intern_copy, ext_ptr) - bfd *abfd; - const DNR *intern_copy; - PTR ext_ptr; +ecoff_swap_dnr_out (bfd *abfd, const DNR *intern_copy, void * ext_ptr) { struct dnr_ext *ext = (struct dnr_ext *) ext_ptr; DNR intern[1]; @@ -887,7 +765,7 @@ ecoff_swap_dnr_out (abfd, intern_copy, ext_ptr) H_PUT_32 (abfd, intern->index, ext->d_index); #ifdef TEST - if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) + if (memcmp ((char *) ext, (char *) intern, sizeof (*intern)) != 0) abort (); #endif } diff --git a/contrib/binutils/bfd/efi-app-ia32.c b/contrib/binutils/bfd/efi-app-ia32.c index 92a17ef043b..b186f907ce6 100644 --- a/contrib/binutils/bfd/efi-app-ia32.c +++ b/contrib/binutils/bfd/efi-app-ia32.c @@ -16,7 +16,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" diff --git a/contrib/binutils/bfd/efi-app-ia64.c b/contrib/binutils/bfd/efi-app-ia64.c index c7e9bcfc33c..c2a77aca55b 100644 --- a/contrib/binutils/bfd/efi-app-ia64.c +++ b/contrib/binutils/bfd/efi-app-ia64.c @@ -16,7 +16,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" diff --git a/contrib/binutils/bfd/elf-bfd.h b/contrib/binutils/bfd/elf-bfd.h index 110dd696c54..3fba1c228f0 100644 --- a/contrib/binutils/bfd/elf-bfd.h +++ b/contrib/binutils/bfd/elf-bfd.h @@ -1,6 +1,6 @@ /* BFD back-end data structures for ELF files. Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, - 2002, 2003, 2004 Free Software Foundation, Inc. + 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _LIBELF_H_ #define _LIBELF_H_ 1 @@ -104,40 +104,6 @@ struct elf_link_hash_entry not visible outside this DSO. */ long dynindx; - /* String table index in .dynstr if this is a dynamic symbol. */ - unsigned long dynstr_index; - - /* Hash value of the name computed using the ELF hash function. */ - unsigned long elf_hash_value; - - /* If this is a weak defined symbol from a dynamic object, this - field points to a defined symbol with the same value, if there is - one. Otherwise it is NULL. */ - struct elf_link_hash_entry *weakdef; - - /* Version information. */ - union - { - /* This field is used for a symbol which is not defined in a - regular object. It points to the version information read in - from the dynamic object. */ - Elf_Internal_Verdef *verdef; - /* This field is used for a symbol which is defined in a regular - object. It is set up in size_dynamic_sections. It points to - the version information we should write out for this symbol. */ - struct bfd_elf_version_tree *vertree; - } verinfo; - - /* Virtual table entry use information. This array is nominally of size - size/sizeof(target_void_pointer), though we have to be able to assume - and track a size while the symbol is still undefined. It is indexed - via offset/sizeof(target_void_pointer). */ - size_t vtable_entries_size; - bfd_boolean *vtable_entries_used; - - /* Virtual table derivation info. */ - struct elf_link_hash_entry *vtable_parent; - /* If this symbol requires an entry in the global offset table, the processor specific backend uses this field to track usage and final offset. Two schemes are supported: The first assumes that @@ -162,47 +128,89 @@ struct elf_link_hash_entry bfd_size_type size; /* Symbol type (STT_NOTYPE, STT_OBJECT, etc.). */ - char type; + unsigned int type : 8; /* Symbol st_other value, symbol visibility. */ - unsigned char other; + unsigned int other : 8; - /* Some flags; legal values follow. */ - unsigned short elf_link_hash_flags; /* Symbol is referenced by a non-shared object. */ -#define ELF_LINK_HASH_REF_REGULAR 01 + unsigned int ref_regular : 1; /* Symbol is defined by a non-shared object. */ -#define ELF_LINK_HASH_DEF_REGULAR 02 + unsigned int def_regular : 1; /* Symbol is referenced by a shared object. */ -#define ELF_LINK_HASH_REF_DYNAMIC 04 + unsigned int ref_dynamic : 1; /* Symbol is defined by a shared object. */ -#define ELF_LINK_HASH_DEF_DYNAMIC 010 + unsigned int def_dynamic : 1; /* Symbol has a non-weak reference from a non-shared object. */ -#define ELF_LINK_HASH_REF_REGULAR_NONWEAK 020 + unsigned int ref_regular_nonweak : 1; /* Dynamic symbol has been adjustd. */ -#define ELF_LINK_HASH_DYNAMIC_ADJUSTED 040 + unsigned int dynamic_adjusted : 1; /* Symbol needs a copy reloc. */ -#define ELF_LINK_HASH_NEEDS_COPY 0100 + unsigned int needs_copy : 1; /* Symbol needs a procedure linkage table entry. */ -#define ELF_LINK_HASH_NEEDS_PLT 0200 + unsigned int needs_plt : 1; /* Symbol appears in a non-ELF input file. */ -#define ELF_LINK_NON_ELF 0400 + unsigned int non_elf : 1; /* Symbol should be marked as hidden in the version information. */ -#define ELF_LINK_HIDDEN 01000 + unsigned int hidden : 1; /* Symbol was forced to local scope due to a version script file. */ -#define ELF_LINK_FORCED_LOCAL 02000 + unsigned int forced_local : 1; /* Symbol was marked during garbage collection. */ -#define ELF_LINK_HASH_MARK 04000 + unsigned int mark : 1; /* Symbol is referenced by a non-GOT/non-PLT relocation. This is not currently set by all the backends. */ -#define ELF_LINK_NON_GOT_REF 010000 - /* Symbol has a definition in a shared object. */ -#define ELF_LINK_DYNAMIC_DEF 020000 + unsigned int non_got_ref : 1; + /* Symbol has a definition in a shared object. + FIXME: There is no real need for this field if def_dynamic is never + cleared and all places that test def_dynamic also test def_regular. */ + unsigned int dynamic_def : 1; /* Symbol is weak in all shared objects. */ -#define ELF_LINK_DYNAMIC_WEAK 040000 + unsigned int dynamic_weak : 1; /* Symbol is referenced with a relocation where C/C++ pointer equality matters. */ -#define ELF_LINK_POINTER_EQUALITY_NEEDED 0100000 + unsigned int pointer_equality_needed : 1; + + /* String table index in .dynstr if this is a dynamic symbol. */ + unsigned long dynstr_index; + + union + { + /* If this is a weak defined symbol from a dynamic object, this + field points to a defined symbol with the same value, if there is + one. Otherwise it is NULL. */ + struct elf_link_hash_entry *weakdef; + + /* Hash value of the name computed using the ELF hash function. + Used part way through size_dynamic_sections, after we've finished + with weakdefs. */ + unsigned long elf_hash_value; + } u; + + /* Version information. */ + union + { + /* This field is used for a symbol which is not defined in a + regular object. It points to the version information read in + from the dynamic object. */ + Elf_Internal_Verdef *verdef; + /* This field is used for a symbol which is defined in a regular + object. It is set up in size_dynamic_sections. It points to + the version information we should write out for this symbol. */ + struct bfd_elf_version_tree *vertree; + } verinfo; + + struct + { + /* Virtual table entry use information. This array is nominally of size + size/sizeof(target_void_pointer), though we have to be able to assume + and track a size while the symbol is still undefined. It is indexed + via offset/sizeof(target_void_pointer). */ + size_t size; + bfd_boolean *used; + + /* Virtual table derivation info. */ + struct elf_link_hash_entry *parent; + } *vtable; }; /* Will references to this symbol always reference the symbol @@ -218,6 +226,13 @@ struct elf_link_hash_entry #define SYMBOL_CALLS_LOCAL(INFO, H) \ _bfd_elf_symbol_refs_local_p (H, INFO, 1) +/* Common symbols that are turned into definitions don't have the + DEF_REGULAR flag set, so they might appear to be undefined. */ +#define ELF_COMMON_DEF_P(H) \ + (!(H)->def_regular \ + && !(H)->def_dynamic \ + && (H)->root.type == bfd_link_hash_defined) + /* Records local symbols to be emitted in the dynamic symbol table. */ struct elf_link_local_dynamic_entry @@ -254,11 +269,11 @@ struct cie { struct cie_header hdr; unsigned char version; - unsigned char augmentation[20]; - unsigned int code_align; - int data_align; - unsigned int ra_column; - unsigned int augmentation_size; + char augmentation[20]; + bfd_vma code_align; + bfd_signed_vma data_align; + bfd_vma ra_column; + bfd_vma augmentation_size; struct elf_link_hash_entry *personality; unsigned char per_encoding; unsigned char lsda_encoding; @@ -271,18 +286,22 @@ struct cie struct eh_cie_fde { - unsigned int offset; + /* For FDEs, this points to the CIE used. */ + struct eh_cie_fde *cie_inf; unsigned int size; - asection *sec; + unsigned int offset; unsigned int new_offset; unsigned char fde_encoding; unsigned char lsda_encoding; unsigned char lsda_offset; - unsigned char cie : 1; - unsigned char removed : 1; - unsigned char make_relative : 1; - unsigned char make_lsda_relative : 1; - unsigned char per_encoding_relative : 1; + unsigned int cie : 1; + unsigned int removed : 1; + unsigned int add_augmentation_size : 1; + unsigned int add_fde_encoding : 1; + unsigned int make_relative : 1; + unsigned int make_lsda_relative : 1; + unsigned int need_lsda_relative : 1; + unsigned int per_encoding_relative : 1; }; struct eh_frame_sec_info @@ -302,14 +321,15 @@ struct eh_frame_hdr_info { struct cie last_cie; asection *last_cie_sec; + struct eh_cie_fde *last_cie_inf; asection *hdr_sec; - unsigned int last_cie_offset; unsigned int fde_count, array_count; struct eh_frame_array_ent *array; /* TRUE if .eh_frame_hdr should contain the sorted search table. We build it if we successfully read all .eh_frame input sections and recognize them. */ bfd_boolean table; + bfd_boolean offsets_adjusted; }; /* ELF linker hash table. */ @@ -329,13 +349,15 @@ struct elf_link_hash_table /* The value to use when initialising got.refcount/offset and plt.refcount/offset in an elf_link_hash_entry. Set to zero when - the values are refcounts. Set to init_offset in - size_dynamic_sections when the values may be offsets. */ - union gotplt_union init_refcount; + the values are refcounts. Set to init_got_offset/init_plt_offset + in size_dynamic_sections when the values may be offsets. */ + union gotplt_union init_got_refcount; + union gotplt_union init_plt_refcount; /* The value to use for got.refcount/offset and plt.refcount/offset when the values may be offsets. Normally (bfd_vma) -1. */ - union gotplt_union init_offset; + union gotplt_union init_got_offset; + union gotplt_union init_plt_offset; /* The number of symbols found in the link which must be put into the .dynsym section. */ @@ -356,12 +378,15 @@ struct elf_link_hash_table /* The _GLOBAL_OFFSET_TABLE_ symbol. */ struct elf_link_hash_entry *hgot; - /* A pointer to information used to link stabs in sections. */ - void *stab_info; + /* The _PROCEDURE_LINKAGE_TABLE_ symbol. */ + struct elf_link_hash_entry *hplt; /* A pointer to information used to merge SEC_MERGE sections. */ void *merge_info; + /* Used to link stabs in sections. */ + struct stab_info stab_info; + /* Used by eh_frame code when editing .eh_frame. */ struct eh_frame_hdr_info eh_info; @@ -378,6 +403,10 @@ struct elf_link_hash_table /* A linked list of BFD's loaded in the link. */ struct elf_link_loaded_list *loaded; + + /* True if this target has relocatable executables, so needs dynamic + section symbols. */ + bfd_boolean is_relocatable_executable; }; /* Look up an entry in an ELF linker hash table. */ @@ -520,6 +549,12 @@ struct bfd_elf_special_section int attr; }; +enum action_discarded + { + COMPLAIN = 1, + PRETEND = 2 + }; + struct elf_backend_data { /* The architecture for this backend. */ @@ -531,6 +566,14 @@ struct elf_backend_data /* The maximum page size for this backend. */ bfd_vma maxpagesize; + /* The minimum page size for this backend. An input object will not be + considered page aligned unless its sections are correctly aligned for + pages at least this large. May be smaller than maxpagesize. */ + bfd_vma minpagesize; + + /* The BFD flags applied to sections created for dynamic linking. */ + flagword dynamic_sec_flags; + /* A function to translate an ELF RELA relocation to a BFD arelent structure. */ void (*elf_info_to_howto) @@ -572,11 +615,16 @@ struct elf_backend_data bfd_boolean (*elf_backend_symbol_table_processing) (bfd *, elf_symbol_type *, unsigned int); - /* A function to set the type of the info field. Processor-specific + /* A function to set the type of the info field. Processor-specific types should be handled here. */ int (*elf_backend_get_symbol_type) (Elf_Internal_Sym *, int); + /* A function to return the linker hash table entry of a symbol that + might be satisfied by an archive symbol. */ + struct elf_link_hash_entry * (*elf_backend_archive_symbol_lookup) + (bfd *, struct bfd_link_info *, const char *); + /* Return true if local section symbols should have a non-null st_name. NULL implies false. */ bfd_boolean (*elf_backend_name_local_section_symbols) @@ -592,17 +640,22 @@ struct elf_backend_data /* A function to handle unusual section types when creating BFD sections from ELF sections. */ bfd_boolean (*elf_backend_section_from_shdr) - (bfd *, Elf_Internal_Shdr *, const char *); + (bfd *, Elf_Internal_Shdr *, const char *, int); - /* A function to convert machine dependent section header flags to + /* A function to convert machine dependent ELF section header flags to BFD internal section header flags. */ bfd_boolean (*elf_backend_section_flags) - (flagword *, Elf_Internal_Shdr *); + (flagword *, const Elf_Internal_Shdr *); + + /* A function that returns a struct containing ELF section flags and + type for the given BFD section. */ + const struct bfd_elf_special_section * (*get_sec_type_attr) + (bfd *, asection *); /* A function to handle unusual program segment types when creating BFD sections from ELF program segments. */ bfd_boolean (*elf_backend_section_from_phdr) - (bfd *, Elf_Internal_Phdr *, int); + (bfd *, Elf_Internal_Phdr *, int, const char *); /* A function to set up the ELF section header for a BFD section in preparation for writing it out. This is where the flags and type @@ -646,6 +699,11 @@ struct elf_backend_data bfd_boolean (*elf_backend_create_dynamic_sections) (bfd *abfd, struct bfd_link_info *info); + /* When creating a shared library, determine whether to omit the + dynamic symbol for the section. */ + bfd_boolean (*elf_backend_omit_section_dynsym) + (bfd *output_bfd, struct bfd_link_info *info, asection *osec); + /* The CHECK_RELOCS function is called by the add_symbols phase of the ELF backend linker. It is called once for each section with relocs of an object file, just after the symbols for the object @@ -660,6 +718,13 @@ struct elf_backend_data (bfd *abfd, struct bfd_link_info *info, asection *o, const Elf_Internal_Rela *relocs); + /* The CHECK_DIRECTIVES function is called once per input file by + the add_symbols phase of the ELF backend linker. The function + must inspect the bfd and create any additional symbols according + to any custom directives in the bfd. */ + bfd_boolean (*check_directives) + (bfd *abfd, struct bfd_link_info *info); + /* The ADJUST_DYNAMIC_SYMBOL function is called by the ELF backend linker for every symbol which is defined by a dynamic object and referenced by a regular object. This is called after all the @@ -768,6 +833,11 @@ struct elf_backend_data bfd_boolean (*elf_backend_modify_segment_map) (bfd *, struct bfd_link_info *); + /* This function is called during section garbage collection to + mark sections that define global symbols. */ + bfd_boolean (*gc_mark_dynamic_ref) + (struct elf_link_hash_entry *h, void *inf); + /* This function is called during section gc to discover the section a particular relocation refers to. */ asection * (*gc_mark_hook) @@ -808,7 +878,7 @@ struct elf_backend_data newly created and plt/got refcounts and dynamic indices should not be copied. */ void (*elf_backend_copy_indirect_symbol) - (const struct elf_backend_data *, struct elf_link_hash_entry *, + (struct bfd_link_info *, struct elf_link_hash_entry *, struct elf_link_hash_entry *); /* Modify any information related to dynamic linking such that the @@ -816,15 +886,26 @@ struct elf_backend_data void (*elf_backend_hide_symbol) (struct bfd_link_info *, struct elf_link_hash_entry *, bfd_boolean); + /* A function to do additional symbol fixup, called by + _bfd_elf_fix_symbol_flags. */ + bfd_boolean (*elf_backend_fixup_symbol) + (struct bfd_link_info *, struct elf_link_hash_entry *); + /* Merge the backend specific symbol attribute. */ void (*elf_backend_merge_symbol_attribute) (struct elf_link_hash_entry *, const Elf_Internal_Sym *, bfd_boolean, bfd_boolean); + /* Decide whether an undefined symbol is special and can be ignored. + This is the case for OPTIONAL symbols on IRIX. */ + bfd_boolean (*elf_backend_ignore_undef_symbol) + (struct elf_link_hash_entry *); + /* Emit relocations. Overrides default routine for emitting relocs, except during a relocatable link, or if all relocs are being emitted. */ bfd_boolean (*elf_backend_emit_relocs) - (bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *); + (bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *, + struct elf_link_hash_entry **); /* Count relocations. Not called for relocatable links or if all relocs are being preserved in the output. */ @@ -861,6 +942,17 @@ struct elf_backend_data bfd_boolean (*elf_backend_ignore_discarded_relocs) (asection *); + /* What to do when ld finds relocations against symbols defined in + discarded sections. */ + unsigned int (*action_discarded) + (asection *); + + /* This function returns the width of FDE pointers in bytes, or 0 if + that can't be determined for some reason. The default definition + goes by the bfd's EI_CLASS. */ + unsigned int (*elf_backend_eh_frame_address_size) + (bfd *, asection *); + /* These functions tell elf-eh-frame whether to attempt to turn absolute or lsda encodings into pc-relative ones. The default definition enables these transformations. */ @@ -900,7 +992,41 @@ struct elf_backend_data see elf.c, elfcode.h. */ bfd *(*elf_backend_bfd_from_remote_memory) (bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep, - int (*target_read_memory) (bfd_vma vma, char *myaddr, int len)); + int (*target_read_memory) (bfd_vma vma, bfd_byte *myaddr, int len)); + + /* This function is used by `_bfd_elf_get_synthetic_symtab'; + see elf.c. */ + bfd_vma (*plt_sym_val) (bfd_vma, const asection *, const arelent *); + + /* Is symbol defined in common section? */ + bfd_boolean (*common_definition) (Elf_Internal_Sym *); + + /* Return a common section index for section. */ + unsigned int (*common_section_index) (asection *); + + /* Return a common section for section. */ + asection *(*common_section) (asection *); + + /* Return TRUE if we can merge 2 definitions. */ + bfd_boolean (*merge_symbol) (struct bfd_link_info *, + struct elf_link_hash_entry **, + struct elf_link_hash_entry *, + Elf_Internal_Sym *, asection **, + bfd_vma *, unsigned int *, + bfd_boolean *, bfd_boolean *, + bfd_boolean *, bfd_boolean *, + bfd_boolean *, bfd_boolean *, + bfd_boolean *, bfd_boolean *, + bfd *, asection **, + bfd_boolean *, bfd_boolean *, + bfd_boolean *, bfd_boolean *, + bfd *, asection **); + + /* Used to handle bad SHF_LINK_ORDER input. */ + bfd_error_handler_type link_order_error_handler; + + /* Name of the PLT relocation section. */ + const char *relplt_name; /* Alternate EM_xxxx machine codes for this backend. */ int elf_machine_alt1; @@ -908,13 +1034,9 @@ struct elf_backend_data const struct elf_size_info *s; - /* An array of target specific special section map. */ + /* An array of target specific special sections. */ const struct bfd_elf_special_section *special_sections; - /* offset of the _GLOBAL_OFFSET_TABLE_ symbol from the start of the - .got section */ - bfd_vma got_symbol_offset; - /* The size in bytes of the header for the GOT. This includes the so-called reserved entries on some systems. */ bfd_vma got_header_size; @@ -994,8 +1116,7 @@ struct bfd_elf_section_data /* The number of relocations currently assigned to REL_HDR2. */ unsigned int rel_count2; - /* The ELF section number of this section. Only used for an output - file. */ + /* The ELF section number of this section. */ int this_idx; /* The ELF section number of the reloc section indicated by @@ -1012,6 +1133,9 @@ struct bfd_elf_section_data no dynamic symbol for this section. */ int dynindx; + /* A pointer to the linked-to section for SHF_LINK_ORDER. */ + asection *linked_to; + /* Used by the backend linker to store the symbol hash table entries associated with relocs against global symbols. */ struct elf_link_hash_entry **rel_hashes; @@ -1036,6 +1160,10 @@ struct bfd_elf_section_data struct bfd_symbol *id; } group; + /* Optional information about section group; NULL if it doesn't + belongs to any section group. */ + asection *sec_group; + /* A linked list of sections in the group. Circular when used by the linker. */ asection *next_in_group; @@ -1044,19 +1172,21 @@ struct bfd_elf_section_data void *sec_info; }; -#define elf_section_data(sec) ((struct bfd_elf_section_data*)sec->used_by_bfd) +#define elf_section_data(sec) ((struct bfd_elf_section_data*)(sec)->used_by_bfd) +#define elf_linked_to_section(sec) (elf_section_data(sec)->linked_to) #define elf_section_type(sec) (elf_section_data(sec)->this_hdr.sh_type) #define elf_section_flags(sec) (elf_section_data(sec)->this_hdr.sh_flags) #define elf_group_name(sec) (elf_section_data(sec)->group.name) #define elf_group_id(sec) (elf_section_data(sec)->group.id) #define elf_next_in_group(sec) (elf_section_data(sec)->next_in_group) +#define elf_sec_group(sec) (elf_section_data(sec)->sec_group) /* Return TRUE if section has been discarded. */ #define elf_discarded_section(sec) \ (!bfd_is_abs_section (sec) \ && bfd_is_abs_section ((sec)->output_section) \ - && sec->sec_info_type != ELF_INFO_TYPE_MERGE \ - && sec->sec_info_type != ELF_INFO_TYPE_JUST_SYMS) + && (sec)->sec_info_type != ELF_INFO_TYPE_MERGE \ + && (sec)->sec_info_type != ELF_INFO_TYPE_JUST_SYMS) #define get_elf_backend_data(abfd) \ ((const struct elf_backend_data *) (abfd)->xvec->backend_data) @@ -1202,7 +1332,10 @@ struct elf_obj_tdata unsigned int cverrefs; /* Segment flags for the PT_GNU_STACK segment. */ - unsigned int stack_flags; + unsigned int stack_flags; + + /* Should the PT_GNU_RELRO segment be emitted? */ + bfd_boolean relro; /* Symbol version definitions in external objects. */ Elf_Internal_Verdef *verdef; @@ -1295,8 +1428,8 @@ extern char *bfd_elf_get_str_section extern Elf_Internal_Sym *bfd_elf_get_elf_syms (bfd *, Elf_Internal_Shdr *, size_t, size_t, Elf_Internal_Sym *, void *, Elf_External_Sym_Shndx *); -extern const char *bfd_elf_local_sym_name - (bfd *, Elf_Internal_Sym *); +extern const char *bfd_elf_sym_name + (bfd *, Elf_Internal_Shdr *, Elf_Internal_Sym *, asection *); extern bfd_boolean _bfd_elf_copy_private_bfd_data (bfd *, bfd *); @@ -1305,15 +1438,13 @@ extern bfd_boolean _bfd_elf_print_private_bfd_data extern void bfd_elf_print_symbol (bfd *, void *, asymbol *, bfd_print_symbol_type); -#define elf_string_from_elf_strtab(abfd, strindex) \ - bfd_elf_string_from_elf_section (abfd, elf_elfheader(abfd)->e_shstrndx, \ - strindex) - extern void _bfd_elf_sprintf_vma (bfd *, char *, bfd_vma); extern void _bfd_elf_fprintf_vma (bfd *, void *, bfd_vma); +extern unsigned int _bfd_elf_eh_frame_address_size + (bfd *, asection *); extern bfd_byte _bfd_elf_encode_eh_address (bfd *abfd, struct bfd_link_info *info, asection *osec, bfd_vma offset, asection *loc_sec, bfd_vma loc_offset, bfd_vma *encoded); @@ -1341,7 +1472,7 @@ extern bfd_boolean bfd_elf_mkcorefile extern Elf_Internal_Shdr *bfd_elf_find_section (bfd *, char *); extern bfd_boolean _bfd_elf_make_section_from_shdr - (bfd *, Elf_Internal_Shdr *, const char *); + (bfd *, Elf_Internal_Shdr *, const char *, int); extern bfd_boolean _bfd_elf_make_section_from_phdr (bfd *, Elf_Internal_Phdr *, int, const char *); extern struct bfd_hash_entry *_bfd_elf_link_hash_newfunc @@ -1349,26 +1480,41 @@ extern struct bfd_hash_entry *_bfd_elf_link_hash_newfunc extern struct bfd_link_hash_table *_bfd_elf_link_hash_table_create (bfd *); extern void _bfd_elf_link_hash_copy_indirect - (const struct elf_backend_data *, struct elf_link_hash_entry *, + (struct bfd_link_info *, struct elf_link_hash_entry *, struct elf_link_hash_entry *); extern void _bfd_elf_link_hash_hide_symbol (struct bfd_link_info *, struct elf_link_hash_entry *, bfd_boolean); +extern bfd_boolean _bfd_elf_link_hash_fixup_symbol + (struct bfd_link_info *, struct elf_link_hash_entry *); extern bfd_boolean _bfd_elf_link_hash_table_init (struct elf_link_hash_table *, bfd *, struct bfd_hash_entry *(*) - (struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); + (struct bfd_hash_entry *, struct bfd_hash_table *, const char *), + unsigned int); extern bfd_boolean _bfd_elf_slurp_version_tables - (bfd *); + (bfd *, bfd_boolean); extern bfd_boolean _bfd_elf_merge_sections (bfd *, struct bfd_link_info *); -extern bfd_boolean bfd_elf_discard_group +extern bfd_boolean _bfd_elf_match_sections_by_type + (bfd *, const asection *, bfd *, const asection *); +extern bfd_boolean bfd_elf_is_group_section + (bfd *, const struct bfd_section *); +extern void _bfd_elf_section_already_linked (bfd *, struct bfd_section *); extern void bfd_elf_set_group_contents (bfd *, asection *, void *); +extern asection *_bfd_elf_check_kept_section + (asection *); extern void _bfd_elf_link_just_syms (asection *, struct bfd_link_info *); +extern bfd_boolean _bfd_elf_copy_private_header_data + (bfd *, bfd *); extern bfd_boolean _bfd_elf_copy_private_symbol_data (bfd *, asymbol *, bfd *, asymbol *); +#define _bfd_generic_init_private_section_data \ + _bfd_elf_init_private_section_data +extern bfd_boolean _bfd_elf_init_private_section_data + (bfd *, asection *, bfd *, asection *, struct bfd_link_info *); extern bfd_boolean _bfd_elf_copy_private_section_data (bfd *, asection *, bfd *, asection *); extern bfd_boolean _bfd_elf_write_object_contents @@ -1385,6 +1531,8 @@ extern long _bfd_elf_get_dynamic_symtab_upper_bound (bfd *); extern long _bfd_elf_canonicalize_dynamic_symtab (bfd *, asymbol **); +extern long _bfd_elf_get_synthetic_symtab + (bfd *, long, asymbol **, long, asymbol **, asymbol **); extern long _bfd_elf_get_reloc_upper_bound (bfd *, sec_ptr); extern long _bfd_elf_canonicalize_reloc @@ -1406,6 +1554,11 @@ extern bfd_boolean _bfd_elf_set_arch_mach extern bfd_boolean _bfd_elf_find_nearest_line (bfd *, asection *, asymbol **, bfd_vma, const char **, const char **, unsigned int *); +extern bfd_boolean _bfd_elf_find_line + (bfd *, asymbol **, asymbol *, const char **, unsigned int *); +#define _bfd_generic_find_line _bfd_elf_find_line +extern bfd_boolean _bfd_elf_find_inliner_info + (bfd *, const char **, const char **, unsigned int *); #define _bfd_elf_read_minisymbols _bfd_generic_read_minisymbols #define _bfd_elf_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol extern int _bfd_elf_sizeof_headers @@ -1414,8 +1567,10 @@ extern bfd_boolean _bfd_elf_new_section_hook (bfd *, asection *); extern bfd_boolean _bfd_elf_init_reloc_shdr (bfd *, Elf_Internal_Shdr *, asection *, bfd_boolean); +extern const struct bfd_elf_special_section *_bfd_elf_get_special_section + (const char *, const struct bfd_elf_special_section *, unsigned int); extern const struct bfd_elf_special_section *_bfd_elf_get_sec_type_attr - (bfd *, const char *); + (bfd *, asection *); /* If the target doesn't have reloc handling written yet: */ extern void _bfd_elf_no_info_to_howto @@ -1463,7 +1618,7 @@ extern bfd_boolean _bfd_elf_discard_section_eh_frame extern bfd_boolean _bfd_elf_discard_section_eh_frame_hdr (bfd *, struct bfd_link_info *); extern bfd_vma _bfd_elf_eh_frame_section_offset - (bfd *, asection *, bfd_vma); + (bfd *, struct bfd_link_info *, asection *, bfd_vma); extern bfd_boolean _bfd_elf_write_section_eh_frame (bfd *, struct bfd_link_info *, asection *, bfd_byte *); extern bfd_boolean _bfd_elf_write_section_eh_frame_hdr @@ -1473,7 +1628,8 @@ extern bfd_boolean _bfd_elf_maybe_strip_eh_frame_hdr extern bfd_boolean _bfd_elf_merge_symbol (bfd *, struct bfd_link_info *, const char *, Elf_Internal_Sym *, - asection **, bfd_vma *, struct elf_link_hash_entry **, bfd_boolean *, + asection **, bfd_vma *, unsigned int *, + struct elf_link_hash_entry **, bfd_boolean *, bfd_boolean *, bfd_boolean *, bfd_boolean *); extern bfd_boolean _bfd_elf_add_default_symbol @@ -1504,12 +1660,14 @@ extern bfd_boolean _bfd_elf_validate_reloc extern bfd_boolean _bfd_elf_link_create_dynamic_sections (bfd *, struct bfd_link_info *); +extern bfd_boolean _bfd_elf_link_omit_section_dynsym + (bfd *, struct bfd_link_info *, asection *); extern bfd_boolean _bfd_elf_create_dynamic_sections (bfd *, struct bfd_link_info *); extern bfd_boolean _bfd_elf_create_got_section (bfd *, struct bfd_link_info *); -extern unsigned long _bfd_elf_link_renumber_dynsyms - (bfd *, struct bfd_link_info *); +extern struct elf_link_hash_entry *_bfd_elf_define_linkage_sym + (bfd *, struct bfd_link_info *, asection *, const char *); extern bfd_boolean _bfd_elfcore_make_pseudosection (bfd *, char *, size_t, ufile_ptr); @@ -1523,7 +1681,8 @@ extern bfd_boolean _bfd_elf_link_size_reloc_section (bfd *, Elf_Internal_Shdr *, asection *); extern bfd_boolean _bfd_elf_link_output_relocs - (bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *); + (bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *, + struct elf_link_hash_entry **); extern bfd_boolean _bfd_elf_fix_symbol_flags (struct elf_link_hash_entry *, struct elf_info_failed *); @@ -1540,6 +1699,12 @@ extern bfd_boolean _bfd_elf_dynamic_symbol_p extern bfd_boolean _bfd_elf_symbol_refs_local_p (struct elf_link_hash_entry *, struct bfd_link_info *, bfd_boolean); +extern bfd_boolean bfd_elf_match_symbols_in_sections + (asection *sec1, asection *sec2); + +extern bfd_boolean _bfd_elf_setup_sections + (bfd *); + extern const bfd_target *bfd_elf32_object_p (bfd *); extern const bfd_target *bfd_elf32_core_file_p @@ -1624,6 +1789,8 @@ extern void bfd_elf64_write_relocs extern bfd_boolean bfd_elf64_slurp_reloc_table (bfd *, asection *, asymbol **, bfd_boolean); +extern struct elf_link_hash_entry *_bfd_elf_archive_symbol_lookup + (bfd *, struct bfd_link_info *, const char *); extern bfd_boolean bfd_elf_link_add_symbols (bfd *, struct bfd_link_info *); extern bfd_boolean _bfd_elf_add_dynamic_entry @@ -1637,6 +1804,19 @@ extern int bfd_elf_link_record_local_dynamic_symbol extern bfd_boolean _bfd_elf_close_and_cleanup (bfd *); + +extern bfd_boolean _bfd_elf_common_definition + (Elf_Internal_Sym *); + +extern unsigned int _bfd_elf_common_section_index + (asection *); + +extern asection *_bfd_elf_common_section + (asection *); + +extern void _bfd_dwarf2_cleanup_debug_info + (bfd *); + extern bfd_reloc_status_type _bfd_elf_rel_vtable_reloc_fn (bfd *, arelent *, struct bfd_symbol *, void *, asection *, bfd *, char **); @@ -1644,6 +1824,9 @@ extern bfd_reloc_status_type _bfd_elf_rel_vtable_reloc_fn extern bfd_boolean bfd_elf_final_link (bfd *, struct bfd_link_info *); +extern bfd_boolean bfd_elf_gc_mark_dynamic_ref_symbol + (struct elf_link_hash_entry *h, void *inf); + extern bfd_boolean bfd_elf_gc_sections (bfd *, struct bfd_link_info *); @@ -1653,6 +1836,11 @@ extern bfd_boolean bfd_elf_gc_record_vtinherit extern bfd_boolean bfd_elf_gc_record_vtentry (bfd *, asection *, struct elf_link_hash_entry *, bfd_vma); +extern bfd_boolean _bfd_elf_gc_mark + (struct bfd_link_info *, asection *, + asection * (*) (asection *, struct bfd_link_info *, Elf_Internal_Rela *, + struct elf_link_hash_entry *, Elf_Internal_Sym *)); + extern bfd_boolean bfd_elf_gc_common_finalize_got_offsets (bfd *, struct bfd_link_info *); @@ -1662,6 +1850,10 @@ extern bfd_boolean bfd_elf_gc_common_final_link extern bfd_boolean bfd_elf_reloc_symbol_deleted_p (bfd_vma, void *); +extern struct elf_segment_map * +_bfd_elf_make_dynamic_segment + (bfd *, asection *); + /* Exported interface for writing elf corefile notes. */ extern char *elfcore_write_note (bfd *, char *, int *, const char *, int, const void *, int); @@ -1680,10 +1872,13 @@ extern char *elfcore_write_lwpstatus extern bfd *_bfd_elf32_bfd_from_remote_memory (bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep, - int (*target_read_memory) (bfd_vma, char *, int)); + int (*target_read_memory) (bfd_vma, bfd_byte *, int)); extern bfd *_bfd_elf64_bfd_from_remote_memory (bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep, - int (*target_read_memory) (bfd_vma, char *, int)); + int (*target_read_memory) (bfd_vma, bfd_byte *, int)); + +/* Large common section. */ +extern asection _bfd_elf_large_com_section; /* SH ELF specific routine. */ @@ -1695,10 +1890,8 @@ extern bfd_boolean _sh_elf_set_mach_from_flags about initializing any .plt and .got entries in relocate_section. */ #define WILL_CALL_FINISH_DYNAMIC_SYMBOL(DYN, SHARED, H) \ ((DYN) \ - && ((SHARED) \ - || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) \ - && ((H)->dynindx != -1 \ - || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)) + && ((SHARED) || !(H)->forced_local) \ + && ((H)->dynindx != -1 || (H)->forced_local)) /* This macro is to avoid lots of duplicated code in the body of xxx_relocate_section() in the various elfxx-xxxx.c files. */ diff --git a/contrib/binutils/bfd/elf-eh-frame.c b/contrib/binutils/bfd/elf-eh-frame.c index d3777b44118..5100e72938d 100644 --- a/contrib/binutils/bfd/elf-eh-frame.c +++ b/contrib/binutils/bfd/elf-eh-frame.c @@ -1,5 +1,5 @@ /* .eh_frame section optimization. - Copyright 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Written by Jakub Jelinek . This file is part of BFD, the Binary File Descriptor library. @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" @@ -26,79 +26,85 @@ #define EH_FRAME_HDR_SIZE 8 -/* Helper function for reading uleb128 encoded data. */ +/* If *ITER hasn't reached END yet, read the next byte into *RESULT and + move onto the next byte. Return true on success. */ -static bfd_vma -read_unsigned_leb128 (bfd *abfd ATTRIBUTE_UNUSED, - char *buf, - unsigned int *bytes_read_ptr) +static inline bfd_boolean +read_byte (bfd_byte **iter, bfd_byte *end, unsigned char *result) { - bfd_vma result; - unsigned int num_read; - int shift; - unsigned char byte; - - result = 0; - shift = 0; - num_read = 0; - do - { - byte = bfd_get_8 (abfd, (bfd_byte *) buf); - buf++; - num_read++; - result |= (((bfd_vma) byte & 0x7f) << shift); - shift += 7; - } - while (byte & 0x80); - *bytes_read_ptr = num_read; - return result; + if (*iter >= end) + return FALSE; + *result = *((*iter)++); + return TRUE; } -/* Helper function for reading sleb128 encoded data. */ +/* Move *ITER over LENGTH bytes, or up to END, whichever is closer. + Return true it was possible to move LENGTH bytes. */ -static bfd_signed_vma -read_signed_leb128 (bfd *abfd ATTRIBUTE_UNUSED, - char *buf, - unsigned int * bytes_read_ptr) +static inline bfd_boolean +skip_bytes (bfd_byte **iter, bfd_byte *end, bfd_size_type length) { - bfd_vma result; - int shift; - int num_read; - unsigned char byte; - - result = 0; - shift = 0; - num_read = 0; - do + if ((bfd_size_type) (end - *iter) < length) { - byte = bfd_get_8 (abfd, (bfd_byte *) buf); - buf ++; - num_read ++; - result |= (((bfd_vma) byte & 0x7f) << shift); - shift += 7; + *iter = end; + return FALSE; } - while (byte & 0x80); - if (byte & 0x40) - result |= (((bfd_vma) -1) << (shift - 7)) << 7; - *bytes_read_ptr = num_read; - return result; + *iter += length; + return TRUE; } -#define read_uleb128(VAR, BUF) \ -do \ - { \ - (VAR) = read_unsigned_leb128 (abfd, buf, &leb128_tmp); \ - (BUF) += leb128_tmp; \ - } \ -while (0) +/* Move *ITER over an leb128, stopping at END. Return true if the end + of the leb128 was found. */ -#define read_sleb128(VAR, BUF) \ -do \ - { \ - (VAR) = read_signed_leb128 (abfd, buf, &leb128_tmp); \ - (BUF) += leb128_tmp; \ - } \ -while (0) +static bfd_boolean +skip_leb128 (bfd_byte **iter, bfd_byte *end) +{ + unsigned char byte; + do + if (!read_byte (iter, end, &byte)) + return FALSE; + while (byte & 0x80); + return TRUE; +} + +/* Like skip_leb128, but treat the leb128 as an unsigned value and + store it in *VALUE. */ + +static bfd_boolean +read_uleb128 (bfd_byte **iter, bfd_byte *end, bfd_vma *value) +{ + bfd_byte *start, *p; + + start = *iter; + if (!skip_leb128 (iter, end)) + return FALSE; + + p = *iter; + *value = *--p; + while (p > start) + *value = (*value << 7) | (*--p & 0x7f); + + return TRUE; +} + +/* Like read_uleb128, but for signed values. */ + +static bfd_boolean +read_sleb128 (bfd_byte **iter, bfd_byte *end, bfd_signed_vma *value) +{ + bfd_byte *start, *p; + + start = *iter; + if (!skip_leb128 (iter, end)) + return FALSE; + + p = *iter; + *value = ((*--p & 0x7f) ^ 0x40) - 0x40; + while (p > start) + *value = (*value << 7) | (*--p & 0x7f); + + return TRUE; +} /* Return 0 if either encoding is variable width, or not yet known to bfd. */ @@ -200,6 +206,156 @@ int cie_compare (struct cie *c1, struct cie *c2) return 1; } +/* Return the number of extra bytes that we'll be inserting into + ENTRY's augmentation string. */ + +static INLINE unsigned int +extra_augmentation_string_bytes (struct eh_cie_fde *entry) +{ + unsigned int size = 0; + if (entry->cie) + { + if (entry->add_augmentation_size) + size++; + if (entry->add_fde_encoding) + size++; + } + return size; +} + +/* Likewise ENTRY's augmentation data. */ + +static INLINE unsigned int +extra_augmentation_data_bytes (struct eh_cie_fde *entry) +{ + unsigned int size = 0; + if (entry->cie) + { + if (entry->add_augmentation_size) + size++; + if (entry->add_fde_encoding) + size++; + } + else + { + if (entry->cie_inf->add_augmentation_size) + size++; + } + return size; +} + +/* Return the size that ENTRY will have in the output. ALIGNMENT is the + required alignment of ENTRY in bytes. */ + +static unsigned int +size_of_output_cie_fde (struct eh_cie_fde *entry, unsigned int alignment) +{ + if (entry->removed) + return 0; + if (entry->size == 4) + return 4; + return (entry->size + + extra_augmentation_string_bytes (entry) + + extra_augmentation_data_bytes (entry) + + alignment - 1) & -alignment; +} + +/* Assume that the bytes between *ITER and END are CFA instructions. + Try to move *ITER past the first instruction and return true on + success. ENCODED_PTR_WIDTH gives the width of pointer entries. */ + +static bfd_boolean +skip_cfa_op (bfd_byte **iter, bfd_byte *end, unsigned int encoded_ptr_width) +{ + bfd_byte op; + bfd_vma length; + + if (!read_byte (iter, end, &op)) + return FALSE; + + switch (op & 0x80 ? op & 0xc0 : op) + { + case DW_CFA_nop: + case DW_CFA_advance_loc: + case DW_CFA_restore: + /* No arguments. */ + return TRUE; + + case DW_CFA_offset: + case DW_CFA_restore_extended: + case DW_CFA_undefined: + case DW_CFA_same_value: + case DW_CFA_def_cfa_register: + case DW_CFA_def_cfa_offset: + case DW_CFA_def_cfa_offset_sf: + case DW_CFA_GNU_args_size: + /* One leb128 argument. */ + return skip_leb128 (iter, end); + + case DW_CFA_offset_extended: + case DW_CFA_register: + case DW_CFA_def_cfa: + case DW_CFA_offset_extended_sf: + case DW_CFA_GNU_negative_offset_extended: + case DW_CFA_def_cfa_sf: + /* Two leb128 arguments. */ + return (skip_leb128 (iter, end) + && skip_leb128 (iter, end)); + + case DW_CFA_def_cfa_expression: + /* A variable-length argument. */ + return (read_uleb128 (iter, end, &length) + && skip_bytes (iter, end, length)); + + case DW_CFA_expression: + /* A leb128 followed by a variable-length argument. */ + return (skip_leb128 (iter, end) + && read_uleb128 (iter, end, &length) + && skip_bytes (iter, end, length)); + + case DW_CFA_set_loc: + return skip_bytes (iter, end, encoded_ptr_width); + + case DW_CFA_advance_loc1: + return skip_bytes (iter, end, 1); + + case DW_CFA_advance_loc2: + return skip_bytes (iter, end, 2); + + case DW_CFA_advance_loc4: + return skip_bytes (iter, end, 4); + + case DW_CFA_MIPS_advance_loc8: + return skip_bytes (iter, end, 8); + + default: + return FALSE; + } +} + +/* Try to interpret the bytes between BUF and END as CFA instructions. + If every byte makes sense, return a pointer to the first DW_CFA_nop + padding byte, or END if there is no padding. Return null otherwise. + ENCODED_PTR_WIDTH is as for skip_cfa_op. */ + +static bfd_byte * +skip_non_nops (bfd_byte *buf, bfd_byte *end, unsigned int encoded_ptr_width) +{ + bfd_byte *last; + + last = buf; + while (buf < end) + if (*buf == DW_CFA_nop) + buf++; + else + { + if (!skip_cfa_op (&buf, end, encoded_ptr_width)) + return 0; + last = buf; + } + return last; +} + /* This function is called for each input file before the .eh_frame section is relocated. It discards duplicate CIEs and FDEs for discarded functions. The function returns TRUE iff any entries have been @@ -211,20 +367,24 @@ _bfd_elf_discard_section_eh_frame bfd_boolean (*reloc_symbol_deleted_p) (bfd_vma, void *), struct elf_reloc_cookie *cookie) { +#define REQUIRE(COND) \ + do \ + if (!(COND)) \ + goto free_no_table; \ + while (0) + bfd_byte *ehbuf = NULL, *buf; bfd_byte *last_cie, *last_fde; + struct eh_cie_fde *ent, *last_cie_inf, *this_inf; struct cie_header hdr; struct cie cie; struct elf_link_hash_table *htab; struct eh_frame_hdr_info *hdr_info; struct eh_frame_sec_info *sec_info = NULL; - unsigned int leb128_tmp; - unsigned int cie_usage_count, last_cie_ndx, i, offset; - unsigned int make_relative, make_lsda_relative; - bfd_size_type new_size; + unsigned int cie_usage_count, offset; unsigned int ptr_size; - if (sec->_raw_size == 0) + if (sec->size == 0) { /* This file does not contain .eh_frame information. */ return FALSE; @@ -234,7 +394,7 @@ _bfd_elf_discard_section_eh_frame && bfd_is_abs_section (sec->output_section))) { /* At least one of the sections is being discarded from the - link, so we should just ignore them. */ + link, so we should just ignore them. */ return FALSE; } @@ -243,14 +403,9 @@ _bfd_elf_discard_section_eh_frame /* Read the frame unwind information from abfd. */ - ehbuf = bfd_malloc (sec->_raw_size); - if (ehbuf == NULL) - goto free_no_table; + REQUIRE (bfd_malloc_and_get_section (abfd, sec, &ehbuf)); - if (! bfd_get_section_contents (abfd, sec, ehbuf, 0, sec->_raw_size)) - goto free_no_table; - - if (sec->_raw_size >= 4 + if (sec->size >= 4 && bfd_get_32 (abfd, ehbuf) == 0 && cookie->rel == cookie->relend) { @@ -261,90 +416,97 @@ _bfd_elf_discard_section_eh_frame /* If .eh_frame section size doesn't fit into int, we cannot handle it (it would need to use 64-bit .eh_frame format anyway). */ - if (sec->_raw_size != (unsigned int) sec->_raw_size) - goto free_no_table; + REQUIRE (sec->size == (unsigned int) sec->size); + + ptr_size = (get_elf_backend_data (abfd) + ->elf_backend_eh_frame_address_size (abfd, sec)); + REQUIRE (ptr_size != 0); - ptr_size = (elf_elfheader (abfd)->e_ident[EI_CLASS] - == ELFCLASS64) ? 8 : 4; buf = ehbuf; last_cie = NULL; - last_cie_ndx = 0; + last_cie_inf = NULL; memset (&cie, 0, sizeof (cie)); cie_usage_count = 0; - new_size = sec->_raw_size; - make_relative = hdr_info->last_cie.make_relative; - make_lsda_relative = hdr_info->last_cie.make_lsda_relative; sec_info = bfd_zmalloc (sizeof (struct eh_frame_sec_info) + 99 * sizeof (struct eh_cie_fde)); - if (sec_info == NULL) - goto free_no_table; + REQUIRE (sec_info); + sec_info->alloced = 100; #define ENSURE_NO_RELOCS(buf) \ - if (cookie->rel < cookie->relend \ - && (cookie->rel->r_offset \ - < (bfd_size_type) ((buf) - ehbuf)) \ - && cookie->rel->r_info != 0) \ - goto free_no_table + REQUIRE (!(cookie->rel < cookie->relend \ + && (cookie->rel->r_offset \ + < (bfd_size_type) ((buf) - ehbuf)) \ + && cookie->rel->r_info != 0)) #define SKIP_RELOCS(buf) \ while (cookie->rel < cookie->relend \ - && (cookie->rel->r_offset \ + && (cookie->rel->r_offset \ < (bfd_size_type) ((buf) - ehbuf))) \ cookie->rel++ #define GET_RELOC(buf) \ ((cookie->rel < cookie->relend \ && (cookie->rel->r_offset \ - == (bfd_size_type) ((buf) - ehbuf))) \ + == (bfd_size_type) ((buf) - ehbuf))) \ ? cookie->rel : NULL) for (;;) { - unsigned char *aug; + char *aug; + bfd_byte *start, *end, *insns; + bfd_size_type length; if (sec_info->count == sec_info->alloced) { + struct eh_cie_fde *old_entry = sec_info->entry; sec_info = bfd_realloc (sec_info, sizeof (struct eh_frame_sec_info) - + (sec_info->alloced + 99) - * sizeof (struct eh_cie_fde)); - if (sec_info == NULL) - goto free_no_table; + + ((sec_info->alloced + 99) + * sizeof (struct eh_cie_fde))); + REQUIRE (sec_info); memset (&sec_info->entry[sec_info->alloced], 0, 100 * sizeof (struct eh_cie_fde)); sec_info->alloced += 100; + + /* Now fix any pointers into the array. */ + if (last_cie_inf >= old_entry + && last_cie_inf < old_entry + sec_info->count) + last_cie_inf = sec_info->entry + (last_cie_inf - old_entry); } + this_inf = sec_info->entry + sec_info->count; last_fde = buf; /* If we are at the end of the section, we still need to decide on whether to output or discard last encountered CIE (if any). */ - if ((bfd_size_type) (buf - ehbuf) == sec->_raw_size) - hdr.id = (unsigned int) -1; + if ((bfd_size_type) (buf - ehbuf) == sec->size) + { + hdr.length = 0; + hdr.id = (unsigned int) -1; + end = buf; + } else { - if ((bfd_size_type) (buf + 4 - ehbuf) > sec->_raw_size) - /* No space for CIE/FDE header length. */ - goto free_no_table; + /* Read the length of the entry. */ + REQUIRE (skip_bytes (&buf, ehbuf + sec->size, 4)); + hdr.length = bfd_get_32 (abfd, buf - 4); - hdr.length = bfd_get_32 (abfd, buf); - if (hdr.length == 0xffffffff) - /* 64-bit .eh_frame is not supported. */ - goto free_no_table; - buf += 4; - if ((bfd_size_type) (buf - ehbuf) + hdr.length > sec->_raw_size) - /* CIE/FDE not contained fully in this .eh_frame input section. */ - goto free_no_table; + /* 64-bit .eh_frame is not supported. */ + REQUIRE (hdr.length != 0xffffffff); - sec_info->entry[sec_info->count].offset = last_fde - ehbuf; - sec_info->entry[sec_info->count].size = 4 + hdr.length; + /* The CIE/FDE must be fully contained in this input section. */ + REQUIRE ((bfd_size_type) (buf - ehbuf) + hdr.length <= sec->size); + end = buf + hdr.length; + + this_inf->offset = last_fde - ehbuf; + this_inf->size = 4 + hdr.length; if (hdr.length == 0) { - /* CIE with length 0 must be only the last in the section. */ - if ((bfd_size_type) (buf - ehbuf) < sec->_raw_size) - goto free_no_table; + /* A zero-length CIE should only be found at the end of + the section. */ + REQUIRE ((bfd_size_type) (buf - ehbuf) == sec->size); ENSURE_NO_RELOCS (buf); sec_info->count++; /* Now just finish last encountered CIE processing and break @@ -353,10 +515,9 @@ _bfd_elf_discard_section_eh_frame } else { - hdr.id = bfd_get_32 (abfd, buf); - buf += 4; - if (hdr.id == (unsigned int) -1) - goto free_no_table; + REQUIRE (skip_bytes (&buf, end, 4)); + hdr.id = bfd_get_32 (abfd, buf - 4); + REQUIRE (hdr.id != (unsigned int) -1); } } @@ -377,23 +538,14 @@ _bfd_elf_discard_section_eh_frame == hdr_info->last_cie_sec->output_section) && cie_compare (&cie, &hdr_info->last_cie) == 0) || cie_usage_count == 0) - { - new_size -= cie.hdr.length + 4; - sec_info->entry[last_cie_ndx].removed = 1; - sec_info->entry[last_cie_ndx].sec = hdr_info->last_cie_sec; - sec_info->entry[last_cie_ndx].new_offset - = hdr_info->last_cie_offset; - } + last_cie_inf->removed = 1; else { hdr_info->last_cie = cie; hdr_info->last_cie_sec = sec; - hdr_info->last_cie_offset = last_cie - ehbuf; - sec_info->entry[last_cie_ndx].make_relative - = cie.make_relative; - sec_info->entry[last_cie_ndx].make_lsda_relative - = cie.make_lsda_relative; - sec_info->entry[last_cie_ndx].per_encoding_relative + last_cie_inf->make_relative = cie.make_relative; + last_cie_inf->make_lsda_relative = cie.make_lsda_relative; + last_cie_inf->per_encoding_relative = (cie.per_encoding & 0x70) == DW_EH_PE_pcrel; } } @@ -401,22 +553,20 @@ _bfd_elf_discard_section_eh_frame if (hdr.id == (unsigned int) -1) break; - last_cie_ndx = sec_info->count; - sec_info->entry[sec_info->count].cie = 1; + last_cie_inf = this_inf; + this_inf->cie = 1; cie_usage_count = 0; memset (&cie, 0, sizeof (cie)); cie.hdr = hdr; - cie.version = *buf++; + REQUIRE (read_byte (&buf, end, &cie.version)); /* Cannot handle unknown versions. */ - if (cie.version != 1) - goto free_no_table; - if (strlen (buf) > sizeof (cie.augmentation) - 1) - goto free_no_table; + REQUIRE (cie.version == 1 || cie.version == 3); + REQUIRE (strlen ((char *) buf) < sizeof (cie.augmentation)); - strcpy (cie.augmentation, buf); - buf = strchr (buf, '\0') + 1; + strcpy (cie.augmentation, (char *) buf); + buf = (bfd_byte *) strchr ((char *) buf, '\0') + 1; ENSURE_NO_RELOCS (buf); if (buf[0] == 'e' && buf[1] == 'h') { @@ -424,17 +574,18 @@ _bfd_elf_discard_section_eh_frame /* We cannot merge "eh" CIEs because __EXCEPTION_TABLE__ is private to each CIE, so we don't need it for anything. Just skip it. */ - buf += ptr_size; + REQUIRE (skip_bytes (&buf, end, ptr_size)); SKIP_RELOCS (buf); } - read_uleb128 (cie.code_align, buf); - read_sleb128 (cie.data_align, buf); - /* Note - in DWARF2 the return address column is an unsigned byte. - In DWARF3 it is a ULEB128. We are following DWARF3. For most - ports this will not matter as the value will be less than 128. - For the others (eg FRV, SH, MMIX, IA64) they need a fixed GCC - which conforms to the DWARF3 standard. */ - read_uleb128 (cie.ra_column, buf); + REQUIRE (read_uleb128 (&buf, end, &cie.code_align)); + REQUIRE (read_sleb128 (&buf, end, &cie.data_align)); + if (cie.version == 1) + { + REQUIRE (buf < end); + cie.ra_column = *buf++; + } + else + REQUIRE (read_uleb128 (&buf, end, &cie.ra_column)); ENSURE_NO_RELOCS (buf); cie.lsda_encoding = DW_EH_PE_omit; cie.fde_encoding = DW_EH_PE_omit; @@ -445,7 +596,7 @@ _bfd_elf_discard_section_eh_frame if (*aug == 'z') { aug++; - read_uleb128 (cie.augmentation_size, buf); + REQUIRE (read_uleb128 (&buf, end, &cie.augmentation_size)); ENSURE_NO_RELOCS (buf); } @@ -453,30 +604,30 @@ _bfd_elf_discard_section_eh_frame switch (*aug++) { case 'L': - cie.lsda_encoding = *buf++; + REQUIRE (read_byte (&buf, end, &cie.lsda_encoding)); ENSURE_NO_RELOCS (buf); - if (get_DW_EH_PE_width (cie.lsda_encoding, ptr_size) == 0) - goto free_no_table; + REQUIRE (get_DW_EH_PE_width (cie.lsda_encoding, ptr_size)); break; case 'R': - cie.fde_encoding = *buf++; + REQUIRE (read_byte (&buf, end, &cie.fde_encoding)); ENSURE_NO_RELOCS (buf); - if (get_DW_EH_PE_width (cie.fde_encoding, ptr_size) == 0) - goto free_no_table; + REQUIRE (get_DW_EH_PE_width (cie.fde_encoding, ptr_size)); + break; + case 'S': break; case 'P': { int per_width; - cie.per_encoding = *buf++; + REQUIRE (read_byte (&buf, end, &cie.per_encoding)); per_width = get_DW_EH_PE_width (cie.per_encoding, ptr_size); - if (per_width == 0) - goto free_no_table; + REQUIRE (per_width); if ((cie.per_encoding & 0xf0) == DW_EH_PE_aligned) - buf = (ehbuf - + ((buf - ehbuf + per_width - 1) - & ~((bfd_size_type) per_width - 1))); + { + length = -(buf - ehbuf) & (per_width - 1); + REQUIRE (skip_bytes (&buf, end, length)); + } ENSURE_NO_RELOCS (buf); /* Ensure we have a reloc here, against a global symbol. */ @@ -504,9 +655,12 @@ _bfd_elf_discard_section_eh_frame cie.personality = h; } - cookie->rel++; + /* Cope with MIPS-style composite relocations. */ + do + cookie->rel++; + while (GET_RELOC (buf) != NULL); } - buf += per_width; + REQUIRE (skip_bytes (&buf, end, per_width)); } break; default: @@ -517,12 +671,25 @@ _bfd_elf_discard_section_eh_frame /* For shared libraries, try to get rid of as many RELATIVE relocs as possible. */ - if (info->shared + if (info->shared && (get_elf_backend_data (abfd) ->elf_backend_can_make_relative_eh_frame - (abfd, info, sec)) - && (cie.fde_encoding & 0xf0) == DW_EH_PE_absptr) - cie.make_relative = 1; + (abfd, info, sec))) + { + if ((cie.fde_encoding & 0xf0) == DW_EH_PE_absptr) + cie.make_relative = 1; + /* If the CIE doesn't already have an 'R' entry, it's fairly + easy to add one, provided that there's no aligned data + after the augmentation string. */ + else if (cie.fde_encoding == DW_EH_PE_omit + && (cie.per_encoding & 0xf0) != DW_EH_PE_aligned) + { + if (*cie.augmentation == 0) + this_inf->add_augmentation_size = 1; + this_inf->add_fde_encoding = 1; + cie.make_relative = 1; + } + } if (info->shared && (get_elf_backend_data (abfd) @@ -536,12 +703,13 @@ _bfd_elf_discard_section_eh_frame if (cie.fde_encoding == DW_EH_PE_omit) cie.fde_encoding = DW_EH_PE_absptr; - initial_insn_length = cie.hdr.length - (buf - last_fde - 4); + initial_insn_length = end - buf; if (initial_insn_length <= 50) { cie.initial_insn_length = initial_insn_length; memcpy (cie.initial_instructions, buf, initial_insn_length); } + insns = buf; buf += initial_insn_length; ENSURE_NO_RELOCS (buf); last_cie = last_fde; @@ -549,21 +717,16 @@ _bfd_elf_discard_section_eh_frame else { /* Ensure this FDE uses the last CIE encountered. */ - if (last_cie == NULL - || hdr.id != (unsigned int) (buf - 4 - last_cie)) - goto free_no_table; + REQUIRE (last_cie); + REQUIRE (hdr.id == (unsigned int) (buf - 4 - last_cie)); ENSURE_NO_RELOCS (buf); - if (GET_RELOC (buf) == NULL) - /* This should not happen. */ - goto free_no_table; + REQUIRE (GET_RELOC (buf)); + if ((*reloc_symbol_deleted_p) (buf - ehbuf, cookie)) - { - /* This is a FDE against a discarded section. It should - be deleted. */ - new_size -= hdr.length + 4; - sec_info->entry[sec_info->count].removed = 1; - } + /* This is a FDE against a discarded section. It should + be deleted. */ + this_inf->removed = 1; else { if (info->shared @@ -580,24 +743,47 @@ _bfd_elf_discard_section_eh_frame cie_usage_count++; hdr_info->fde_count++; } + /* Skip the initial location and address range. */ + start = buf; + length = get_DW_EH_PE_width (cie.fde_encoding, ptr_size); + REQUIRE (skip_bytes (&buf, end, 2 * length)); + + /* Skip the augmentation size, if present. */ + if (cie.augmentation[0] == 'z') + REQUIRE (read_uleb128 (&buf, end, &length)); + else + length = 0; + + /* Of the supported augmentation characters above, only 'L' + adds augmentation data to the FDE. This code would need to + be adjusted if any future augmentations do the same thing. */ if (cie.lsda_encoding != DW_EH_PE_omit) { - unsigned int dummy; - - aug = buf; - buf += 2 * get_DW_EH_PE_width (cie.fde_encoding, ptr_size); - if (cie.augmentation[0] == 'z') - read_uleb128 (dummy, buf); - /* If some new augmentation data is added before LSDA - in FDE augmentation area, this need to be adjusted. */ - sec_info->entry[sec_info->count].lsda_offset = (buf - aug); + this_inf->lsda_offset = buf - start; + /* If there's no 'z' augmentation, we don't know where the + CFA insns begin. Assume no padding. */ + if (cie.augmentation[0] != 'z') + length = end - buf; } + + /* Skip over the augmentation data. */ + REQUIRE (skip_bytes (&buf, end, length)); + insns = buf; + buf = last_fde + 4 + hdr.length; SKIP_RELOCS (buf); } - sec_info->entry[sec_info->count].fde_encoding = cie.fde_encoding; - sec_info->entry[sec_info->count].lsda_encoding = cie.lsda_encoding; + /* Try to interpret the CFA instructions and find the first + padding nop. Shrink this_inf's size so that it doesn't + including the padding. */ + length = get_DW_EH_PE_width (cie.fde_encoding, ptr_size); + insns = skip_non_nops (insns, end, length); + if (insns != 0) + this_inf->size -= end - insns; + + this_inf->fde_encoding = cie.fde_encoding; + this_inf->lsda_encoding = cie.lsda_encoding; sec_info->count++; } @@ -606,54 +792,27 @@ _bfd_elf_discard_section_eh_frame /* Ok, now we can assign new offsets. */ offset = 0; - last_cie_ndx = 0; - for (i = 0; i < sec_info->count; i++) - { - if (! sec_info->entry[i].removed) - { - sec_info->entry[i].new_offset = offset; - offset += sec_info->entry[i].size; - if (sec_info->entry[i].cie) - { - last_cie_ndx = i; - make_relative = sec_info->entry[i].make_relative; - make_lsda_relative = sec_info->entry[i].make_lsda_relative; - } - else - { - sec_info->entry[i].make_relative = make_relative; - sec_info->entry[i].make_lsda_relative = make_lsda_relative; - sec_info->entry[i].per_encoding_relative = 0; - } - } - else if (sec_info->entry[i].cie && sec_info->entry[i].sec == sec) - { - /* Need to adjust new_offset too. */ - BFD_ASSERT (sec_info->entry[last_cie_ndx].offset - == sec_info->entry[i].new_offset); - sec_info->entry[i].new_offset - = sec_info->entry[last_cie_ndx].new_offset; - } - } - if (hdr_info->last_cie_sec == sec) - { - BFD_ASSERT (sec_info->entry[last_cie_ndx].offset - == hdr_info->last_cie_offset); - hdr_info->last_cie_offset = sec_info->entry[last_cie_ndx].new_offset; - } + last_cie_inf = hdr_info->last_cie_inf; + for (ent = sec_info->entry; ent < sec_info->entry + sec_info->count; ++ent) + if (!ent->removed) + { + if (ent->cie) + last_cie_inf = ent; + else + ent->cie_inf = last_cie_inf; + ent->new_offset = offset; + offset += size_of_output_cie_fde (ent, ptr_size); + } + hdr_info->last_cie_inf = last_cie_inf; - /* FIXME: Currently it is not possible to shrink sections to zero size at - this point, so build a fake minimal CIE. */ - if (new_size == 0) - new_size = 16; - - /* Shrink the sec as needed. */ - sec->_cooked_size = new_size; - if (sec->_cooked_size == 0) + /* Resize the sec as needed. */ + sec->rawsize = sec->size; + sec->size = offset; + if (sec->size == 0) sec->flags |= SEC_EXCLUDE; free (ehbuf); - return new_size != sec->_raw_size; + return offset != sec->rawsize; free_no_table: if (ehbuf) @@ -663,6 +822,8 @@ free_no_table: hdr_info->table = FALSE; hdr_info->last_cie.hdr.length = 0; return FALSE; + +#undef REQUIRE } /* This function is called for .eh_frame_hdr section after @@ -682,9 +843,9 @@ _bfd_elf_discard_section_eh_frame_hdr (bfd *abfd, struct bfd_link_info *info) if (sec == NULL) return FALSE; - sec->_cooked_size = EH_FRAME_HDR_SIZE; + sec->size = EH_FRAME_HDR_SIZE; if (hdr_info->table) - sec->_cooked_size += 4 + hdr_info->fde_count * 8; + sec->size += 4 + hdr_info->fde_count * 8; /* Request program headers to be recalculated. */ elf_tdata (abfd)->program_header_size = 0; @@ -694,8 +855,8 @@ _bfd_elf_discard_section_eh_frame_hdr (bfd *abfd, struct bfd_link_info *info) /* This function is called from size_dynamic_sections. It needs to decide whether .eh_frame_hdr should be output or not, - because later on it is too late for calling _bfd_strip_section_from_output, - since dynamic symbol table has been sized. */ + because when the dynamic symbol table has been sized it is too late + to strip sections. */ bfd_boolean _bfd_elf_maybe_strip_eh_frame_hdr (struct bfd_link_info *info) @@ -723,13 +884,13 @@ _bfd_elf_maybe_strip_eh_frame_hdr (struct bfd_link_info *info) /* Count only sections which have at least a single CIE or FDE. There cannot be any CIE or FDE <= 8 bytes. */ o = bfd_get_section_by_name (abfd, ".eh_frame"); - if (o && o->_raw_size > 8 && !bfd_is_abs_section (o->output_section)) + if (o && o->size > 8 && !bfd_is_abs_section (o->output_section)) break; } if (abfd == NULL) { - _bfd_strip_section_from_output (info, hdr_info->hdr_sec); + hdr_info->hdr_sec->flags |= SEC_EXCLUDE; hdr_info->hdr_sec = NULL; return TRUE; } @@ -745,18 +906,26 @@ _bfd_elf_maybe_strip_eh_frame_hdr (struct bfd_link_info *info) bfd_vma _bfd_elf_eh_frame_section_offset (bfd *output_bfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info, asection *sec, bfd_vma offset) { struct eh_frame_sec_info *sec_info; + struct elf_link_hash_table *htab; + struct eh_frame_hdr_info *hdr_info; unsigned int lo, hi, mid; if (sec->sec_info_type != ELF_INFO_TYPE_EH_FRAME) return offset; sec_info = elf_section_data (sec)->sec_info; - if (offset >= sec->_raw_size) - return offset - (sec->_cooked_size - sec->_raw_size); + if (offset >= sec->rawsize) + return offset - sec->rawsize + sec->size; + + htab = elf_hash_table (info); + hdr_info = &htab->eh_info; + if (hdr_info->offsets_adjusted) + offset += sec->output_offset; lo = 0; hi = sec_info->count; @@ -781,21 +950,31 @@ _bfd_elf_eh_frame_section_offset (bfd *output_bfd ATTRIBUTE_UNUSED, /* If converting to DW_EH_PE_pcrel, there will be no need for run-time relocation against FDE's initial_location field. */ - if (sec_info->entry[mid].make_relative - && ! sec_info->entry[mid].cie + if (!sec_info->entry[mid].cie + && sec_info->entry[mid].cie_inf->make_relative && offset == sec_info->entry[mid].offset + 8) return (bfd_vma) -2; /* If converting LSDA pointers to DW_EH_PE_pcrel, there will be no need for run-time relocation against LSDA field. */ - if (sec_info->entry[mid].make_lsda_relative - && ! sec_info->entry[mid].cie + if (!sec_info->entry[mid].cie + && sec_info->entry[mid].cie_inf->make_lsda_relative && (offset == (sec_info->entry[mid].offset + 8 - + sec_info->entry[mid].lsda_offset))) - return (bfd_vma) -2; + + sec_info->entry[mid].lsda_offset)) + && (sec_info->entry[mid].cie_inf->need_lsda_relative + || !hdr_info->offsets_adjusted)) + { + sec_info->entry[mid].cie_inf->need_lsda_relative = 1; + return (bfd_vma) -2; + } + if (hdr_info->offsets_adjusted) + offset -= sec->output_offset; + /* Any new augmentation bytes go before the first relocation. */ return (offset + sec_info->entry[mid].new_offset - - sec_info->entry[mid].offset); + - sec_info->entry[mid].offset + + extra_augmentation_string_bytes (sec_info->entry + mid) + + extra_augmentation_data_bytes (sec_info->entry + mid)); } /* Write out .eh_frame section. This is called with the relocated @@ -810,89 +989,160 @@ _bfd_elf_write_section_eh_frame (bfd *abfd, struct eh_frame_sec_info *sec_info; struct elf_link_hash_table *htab; struct eh_frame_hdr_info *hdr_info; - unsigned int i; - bfd_byte *p, *buf; - unsigned int leb128_tmp; - unsigned int cie_offset = 0; unsigned int ptr_size; - - ptr_size = (elf_elfheader (sec->owner)->e_ident[EI_CLASS] - == ELFCLASS64) ? 8 : 4; + struct eh_cie_fde *ent; if (sec->sec_info_type != ELF_INFO_TYPE_EH_FRAME) return bfd_set_section_contents (abfd, sec->output_section, contents, - sec->output_offset, sec->_raw_size); + sec->output_offset, sec->size); + + ptr_size = (get_elf_backend_data (abfd) + ->elf_backend_eh_frame_address_size (abfd, sec)); + BFD_ASSERT (ptr_size != 0); + sec_info = elf_section_data (sec)->sec_info; htab = elf_hash_table (info); hdr_info = &htab->eh_info; + + /* First convert all offsets to output section offsets, so that a + CIE offset is valid if the CIE is used by a FDE from some other + section. This can happen when duplicate CIEs are deleted in + _bfd_elf_discard_section_eh_frame. We do all sections here because + this function might not be called on sections in the same order as + _bfd_elf_discard_section_eh_frame. */ + if (!hdr_info->offsets_adjusted) + { + bfd *ibfd; + asection *eh; + struct eh_frame_sec_info *eh_inf; + + for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) + { + if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour + || (ibfd->flags & DYNAMIC) != 0) + continue; + + eh = bfd_get_section_by_name (ibfd, ".eh_frame"); + if (eh == NULL || eh->sec_info_type != ELF_INFO_TYPE_EH_FRAME) + continue; + + eh_inf = elf_section_data (eh)->sec_info; + for (ent = eh_inf->entry; ent < eh_inf->entry + eh_inf->count; ++ent) + { + ent->offset += eh->output_offset; + ent->new_offset += eh->output_offset; + } + } + hdr_info->offsets_adjusted = TRUE; + } + if (hdr_info->table && hdr_info->array == NULL) hdr_info->array = bfd_malloc (hdr_info->fde_count * sizeof(*hdr_info->array)); if (hdr_info->array == NULL) hdr_info = NULL; - p = contents; - for (i = 0; i < sec_info->count; ++i) + /* The new offsets can be bigger or smaller than the original offsets. + We therefore need to make two passes over the section: one backward + pass to move entries up and one forward pass to move entries down. + The two passes won't interfere with each other because entries are + not reordered */ + for (ent = sec_info->entry + sec_info->count; ent-- != sec_info->entry;) + if (!ent->removed && ent->new_offset > ent->offset) + memmove (contents + ent->new_offset - sec->output_offset, + contents + ent->offset - sec->output_offset, ent->size); + + for (ent = sec_info->entry; ent < sec_info->entry + sec_info->count; ++ent) + if (!ent->removed && ent->new_offset < ent->offset) + memmove (contents + ent->new_offset - sec->output_offset, + contents + ent->offset - sec->output_offset, ent->size); + + for (ent = sec_info->entry; ent < sec_info->entry + sec_info->count; ++ent) { - if (sec_info->entry[i].removed) + unsigned char *buf, *end; + unsigned int new_size; + + if (ent->removed) + continue; + + if (ent->size == 4) { - if (sec_info->entry[i].cie) - { - /* If CIE is removed due to no remaining FDEs referencing it - and there were no CIEs kept before it, sec_info->entry[i].sec - will be zero. */ - if (sec_info->entry[i].sec == NULL) - cie_offset = 0; - else - { - cie_offset = sec_info->entry[i].new_offset; - cie_offset += (sec_info->entry[i].sec->output_section->vma - + sec_info->entry[i].sec->output_offset - - sec->output_section->vma - - sec->output_offset); - } - } + /* Any terminating FDE must be at the end of the section. */ + BFD_ASSERT (ent == sec_info->entry + sec_info->count - 1); continue; } - if (sec_info->entry[i].cie) + buf = contents + ent->new_offset - sec->output_offset; + end = buf + ent->size; + new_size = size_of_output_cie_fde (ent, ptr_size); + + /* Update the size. It may be shrinked. */ + bfd_put_32 (abfd, new_size - 4, buf); + + /* Filling the extra bytes with DW_CFA_nops. */ + if (new_size != ent->size) + memset (end, 0, new_size - ent->size); + + if (ent->cie) { /* CIE */ - cie_offset = sec_info->entry[i].new_offset; - if (sec_info->entry[i].make_relative - || sec_info->entry[i].make_lsda_relative - || sec_info->entry[i].per_encoding_relative) + if (ent->make_relative + || ent->need_lsda_relative + || ent->per_encoding_relative) { - unsigned char *aug; - unsigned int action; - unsigned int dummy, per_width, per_encoding; + char *aug; + unsigned int action, extra_string, extra_data; + unsigned int per_width, per_encoding; /* Need to find 'R' or 'L' augmentation's argument and modify DW_EH_PE_* value. */ - action = (sec_info->entry[i].make_relative ? 1 : 0) - | (sec_info->entry[i].make_lsda_relative ? 2 : 0) - | (sec_info->entry[i].per_encoding_relative ? 4 : 0); - buf = contents + sec_info->entry[i].offset; + action = ((ent->make_relative ? 1 : 0) + | (ent->need_lsda_relative ? 2 : 0) + | (ent->per_encoding_relative ? 4 : 0)); + extra_string = extra_augmentation_string_bytes (ent); + extra_data = extra_augmentation_data_bytes (ent); + /* Skip length, id and version. */ buf += 9; - aug = buf; - buf = strchr (buf, '\0') + 1; - read_uleb128 (dummy, buf); - read_sleb128 (dummy, buf); - read_uleb128 (dummy, buf); + aug = (char *) buf; + buf += strlen (aug) + 1; + skip_leb128 (&buf, end); + skip_leb128 (&buf, end); + skip_leb128 (&buf, end); if (*aug == 'z') { - read_uleb128 (dummy, buf); + /* The uleb128 will always be a single byte for the kind + of augmentation strings that we're prepared to handle. */ + *buf++ += extra_data; aug++; } + /* Make room for the new augmentation string and data bytes. */ + memmove (buf + extra_string + extra_data, buf, end - buf); + memmove (aug + extra_string, aug, buf - (bfd_byte *) aug); + buf += extra_string; + end += extra_string + extra_data; + + if (ent->add_augmentation_size) + { + *aug++ = 'z'; + *buf++ = extra_data - 1; + } + if (ent->add_fde_encoding) + { + BFD_ASSERT (action & 1); + *aug++ = 'R'; + *buf++ = DW_EH_PE_pcrel; + action &= ~1; + } + while (action) switch (*aug++) { case 'L': if (action & 2) { - BFD_ASSERT (*buf == sec_info->entry[i].lsda_encoding); + BFD_ASSERT (*buf == ent->lsda_encoding); *buf |= DW_EH_PE_pcrel; action &= ~2; } @@ -900,25 +1150,23 @@ _bfd_elf_write_section_eh_frame (bfd *abfd, break; case 'P': per_encoding = *buf++; - per_width = get_DW_EH_PE_width (per_encoding, - ptr_size); + per_width = get_DW_EH_PE_width (per_encoding, ptr_size); BFD_ASSERT (per_width != 0); BFD_ASSERT (((per_encoding & 0x70) == DW_EH_PE_pcrel) - == sec_info->entry[i].per_encoding_relative); + == ent->per_encoding_relative); if ((per_encoding & 0xf0) == DW_EH_PE_aligned) buf = (contents + ((buf - contents + per_width - 1) & ~((bfd_size_type) per_width - 1))); if (action & 4) { - bfd_vma value; + bfd_vma val; - value = read_value (abfd, buf, per_width, - get_DW_EH_PE_signed - (per_encoding)); - value += (sec_info->entry[i].offset - - sec_info->entry[i].new_offset); - write_value (abfd, buf, value, per_width); + val = read_value (abfd, buf, per_width, + get_DW_EH_PE_signed (per_encoding)); + val += ent->offset - ent->new_offset; + val -= extra_string + extra_data; + write_value (abfd, buf, val, per_width); action &= ~4; } buf += per_width; @@ -926,37 +1174,37 @@ _bfd_elf_write_section_eh_frame (bfd *abfd, case 'R': if (action & 1) { - BFD_ASSERT (*buf == sec_info->entry[i].fde_encoding); + BFD_ASSERT (*buf == ent->fde_encoding); *buf |= DW_EH_PE_pcrel; action &= ~1; } buf++; break; + case 'S': + break; default: BFD_FAIL (); } } } - else if (sec_info->entry[i].size > 4) + else { /* FDE */ - bfd_vma value = 0, address; + bfd_vma value, address; unsigned int width; - buf = contents + sec_info->entry[i].offset; /* Skip length. */ buf += 4; - bfd_put_32 (abfd, - sec_info->entry[i].new_offset + 4 - cie_offset, buf); + value = ent->new_offset + 4 - ent->cie_inf->new_offset; + bfd_put_32 (abfd, value, buf); buf += 4; - width = get_DW_EH_PE_width (sec_info->entry[i].fde_encoding, - ptr_size); - address = value = read_value (abfd, buf, width, - get_DW_EH_PE_signed - (sec_info->entry[i].fde_encoding)); + width = get_DW_EH_PE_width (ent->fde_encoding, ptr_size); + value = read_value (abfd, buf, width, + get_DW_EH_PE_signed (ent->fde_encoding)); + address = value; if (value) { - switch (sec_info->entry[i].fde_encoding & 0xf0) + switch (ent->fde_encoding & 0xf0) { case DW_EH_PE_indirect: case DW_EH_PE_textrel: @@ -971,15 +1219,12 @@ _bfd_elf_write_section_eh_frame (bfd *abfd, } break; case DW_EH_PE_pcrel: - value += (sec_info->entry[i].offset - - sec_info->entry[i].new_offset); - address += (sec->output_section->vma + sec->output_offset - + sec_info->entry[i].offset + 8); + value += ent->offset - ent->new_offset; + address += sec->output_section->vma + ent->offset + 8; break; } - if (sec_info->entry[i].make_relative) - value -= (sec->output_section->vma + sec->output_offset - + sec_info->entry[i].new_offset + 8); + if (ent->cie_inf->make_relative) + value -= sec->output_section->vma + ent->new_offset + 8; write_value (abfd, buf, value, width); } @@ -987,96 +1232,48 @@ _bfd_elf_write_section_eh_frame (bfd *abfd, { hdr_info->array[hdr_info->array_count].initial_loc = address; hdr_info->array[hdr_info->array_count++].fde - = (sec->output_section->vma + sec->output_offset - + sec_info->entry[i].new_offset); + = sec->output_section->vma + ent->new_offset; } - if ((sec_info->entry[i].lsda_encoding & 0xf0) == DW_EH_PE_pcrel - || sec_info->entry[i].make_lsda_relative) + if ((ent->lsda_encoding & 0xf0) == DW_EH_PE_pcrel + || ent->cie_inf->need_lsda_relative) { - buf += sec_info->entry[i].lsda_offset; - width = get_DW_EH_PE_width (sec_info->entry[i].lsda_encoding, - ptr_size); + buf += ent->lsda_offset; + width = get_DW_EH_PE_width (ent->lsda_encoding, ptr_size); value = read_value (abfd, buf, width, - get_DW_EH_PE_signed - (sec_info->entry[i].lsda_encoding)); + get_DW_EH_PE_signed (ent->lsda_encoding)); if (value) { - if ((sec_info->entry[i].lsda_encoding & 0xf0) - == DW_EH_PE_pcrel) - value += (sec_info->entry[i].offset - - sec_info->entry[i].new_offset); - else if (sec_info->entry[i].make_lsda_relative) - value -= (sec->output_section->vma + sec->output_offset - + sec_info->entry[i].new_offset + 8 - + sec_info->entry[i].lsda_offset); + if ((ent->lsda_encoding & 0xf0) == DW_EH_PE_pcrel) + value += ent->offset - ent->new_offset; + else if (ent->cie_inf->need_lsda_relative) + value -= (sec->output_section->vma + ent->new_offset + 8 + + ent->lsda_offset); write_value (abfd, buf, value, width); } } - } - else - /* Terminating FDE must be at the end of .eh_frame section only. */ - BFD_ASSERT (i == sec_info->count - 1); - - BFD_ASSERT (p == contents + sec_info->entry[i].new_offset); - memmove (p, contents + sec_info->entry[i].offset, - sec_info->entry[i].size); - p += sec_info->entry[i].size; - } - - /* FIXME: Once _bfd_elf_discard_section_eh_frame will be able to - shrink sections to zero size, this won't be needed any more. */ - if (p == contents && sec->_cooked_size == 16) - { - bfd_put_32 (abfd, 12, p); /* Fake CIE length */ - bfd_put_32 (abfd, 0, p + 4); /* Fake CIE id */ - p[8] = 1; /* Fake CIE version */ - memset (p + 9, 0, 7); /* Fake CIE augmentation, 3xleb128 - and 3xDW_CFA_nop as pad */ - p += 16; - } - else - { - unsigned int alignment = 1 << sec->alignment_power; - unsigned int pad = sec->_cooked_size % alignment; - - /* Don't pad beyond the raw size of the output section. It - can happen at the last input section. */ - if (pad - && ((sec->output_offset + sec->_cooked_size + pad) - <= sec->output_section->_raw_size)) - { - /* Find the last CIE/FDE. */ - for (i = sec_info->count - 1; i > 0; i--) - if (! sec_info->entry[i].removed) - break; - - /* The size of the last CIE/FDE must be at least 4. */ - if (sec_info->entry[i].removed - || sec_info->entry[i].size < 4) - abort (); - - pad = alignment - pad; - - buf = contents + sec_info->entry[i].new_offset; - - /* Update length. */ - sec_info->entry[i].size += pad; - bfd_put_32 (abfd, sec_info->entry[i].size - 4, buf); - - /* Pad it with DW_CFA_nop */ - memset (p, 0, pad); - p += pad; - - sec->_cooked_size += pad; + else if (ent->cie_inf->add_augmentation_size) + { + /* Skip the PC and length and insert a zero byte for the + augmentation size. */ + buf += width * 2; + memmove (buf + 1, buf, end - buf); + *buf = 0; + } } } - BFD_ASSERT ((bfd_size_type) (p - contents) == sec->_cooked_size); + /* We don't align the section to its section alignment since the + runtime library only expects all CIE/FDE records aligned at + the pointer size. _bfd_elf_discard_section_eh_frame should + have padded CIE/FDE records to multiple of pointer size with + size_of_output_cie_fde. */ + if ((sec->size % ptr_size) != 0) + abort (); return bfd_set_section_contents (abfd, sec->output_section, - contents, (file_ptr) sec->output_offset, - sec->_cooked_size); + contents, (file_ptr) sec->output_offset, + sec->size); } /* Helper function used to sort .eh_frame_hdr search table by increasing @@ -1187,11 +1384,19 @@ _bfd_elf_write_section_eh_frame_hdr (bfd *abfd, struct bfd_link_info *info) retval = bfd_set_section_contents (abfd, sec->output_section, contents, (file_ptr) sec->output_offset, - sec->_cooked_size); + sec->size); free (contents); return retval; } +/* Return the width of FDE addresses. This is the default implementation. */ + +unsigned int +_bfd_elf_eh_frame_address_size (bfd *abfd, asection *sec ATTRIBUTE_UNUSED) +{ + return elf_elfheader (abfd)->e_ident[EI_CLASS] == ELFCLASS64 ? 8 : 4; +} + /* Decide whether we can use a PC-relative encoding within the given EH frame section. This is the default implementation. */ diff --git a/contrib/binutils/bfd/elf-strtab.c b/contrib/binutils/bfd/elf-strtab.c index 673b9d77ac9..a0ce1d79ea8 100644 --- a/contrib/binutils/bfd/elf-strtab.c +++ b/contrib/binutils/bfd/elf-strtab.c @@ -1,5 +1,5 @@ /* ELF strtab with GC and suffix merging support. - Copyright 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright 2001, 2002, 2003, 2005, 2006 Free Software Foundation, Inc. Written by Jakub Jelinek . This file is part of BFD, the Binary File Descriptor library. @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" @@ -99,7 +99,8 @@ _bfd_elf_strtab_init (void) if (table == NULL) return NULL; - if (! bfd_hash_table_init (&table->table, elf_strtab_hash_newfunc)) + if (!bfd_hash_table_init (&table->table, elf_strtab_hash_newfunc, + sizeof (struct elf_strtab_hash_entry))) { free (table); return NULL; @@ -263,8 +264,8 @@ strrevcmp (const void *a, const void *b) struct elf_strtab_hash_entry *B = *(struct elf_strtab_hash_entry **) b; unsigned int lenA = A->len; unsigned int lenB = B->len; - const unsigned char *s = A->root.string + lenA - 1; - const unsigned char *t = B->root.string + lenB - 1; + const unsigned char *s = (const unsigned char *) A->root.string + lenA - 1; + const unsigned char *t = (const unsigned char *) B->root.string + lenB - 1; int l = lenA < lenB ? lenA : lenB; while (l) diff --git a/contrib/binutils/bfd/elf-vxworks.c b/contrib/binutils/bfd/elf-vxworks.c new file mode 100644 index 00000000000..90e620a9055 --- /dev/null +++ b/contrib/binutils/bfd/elf-vxworks.c @@ -0,0 +1,213 @@ +/* VxWorks support for ELF + Copyright 2005 Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* This file provides routines used by all VxWorks targets. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "elf-bfd.h" +#include "elf-vxworks.h" + +/* Tweak magic VxWorks symbols as they are loaded. */ +bfd_boolean +elf_vxworks_add_symbol_hook (bfd *abfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info, + Elf_Internal_Sym *sym, + const char **namep, + flagword *flagsp, + asection **secp ATTRIBUTE_UNUSED, + bfd_vma *valp ATTRIBUTE_UNUSED) +{ + /* Ideally these "magic" symbols would be exported by libc.so.1 + which would be found via a DT_NEEDED tag, and then handled + specially by the linker at runtime. Except shared libraries + don't even link to libc.so.1 by default... + If the symbol is imported from, or will be put in a shared library, + give the symbol weak binding to get the desired samantics. + This transformation will be undone in + elf_i386_vxworks_link_output_symbol_hook. */ + if ((info->shared || abfd->flags & DYNAMIC) + && (strcmp (*namep, "__GOTT_INDEX__") == 0 + || strcmp (*namep, "__GOTT_BASE__") == 0)) + { + sym->st_info = ELF_ST_INFO (STB_WEAK, ELF_ST_TYPE (sym->st_info)); + *flagsp |= BSF_WEAK; + } + + return TRUE; +} + +/* Perform VxWorks-specific handling of the create_dynamic_sections hook. + When creating an executable, set *SRELPLT2_OUT to the .rel(a).plt.unloaded + section. */ + +bfd_boolean +elf_vxworks_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info, + asection **srelplt2_out) +{ + struct elf_link_hash_table *htab; + const struct elf_backend_data *bed; + asection *s; + + htab = elf_hash_table (info); + bed = get_elf_backend_data (dynobj); + + if (!info->shared) + { + s = bfd_make_section_with_flags (dynobj, + bed->default_use_rela_p + ? ".rela.plt.unloaded" + : ".rel.plt.unloaded", + SEC_HAS_CONTENTS | SEC_IN_MEMORY + | SEC_READONLY | SEC_LINKER_CREATED); + if (s == NULL + || !bfd_set_section_alignment (dynobj, s, bed->s->log_file_align)) + return FALSE; + + *srelplt2_out = s; + } + + /* Mark the GOT and PLT symbols as having relocations; they might + not, but we won't know for sure until we build the GOT in + finish_dynamic_symbol. Also make sure that the GOT symbol + is entered into the dynamic symbol table; the loader uses it + to initialize __GOTT_BASE__[__GOTT_INDEX__]. */ + if (htab->hgot) + { + htab->hgot->indx = -2; + htab->hgot->other &= ~ELF_ST_VISIBILITY (-1); + htab->hgot->forced_local = 0; + if (!bfd_elf_link_record_dynamic_symbol (info, htab->hgot)) + return FALSE; + } + if (htab->hplt) + { + htab->hplt->indx = -2; + htab->hplt->type = STT_FUNC; + } + + return TRUE; +} + +/* Tweak magic VxWorks symbols as they are written to the output file. */ +bfd_boolean +elf_vxworks_link_output_symbol_hook (struct bfd_link_info *info + ATTRIBUTE_UNUSED, + const char *name, + Elf_Internal_Sym *sym, + asection *input_sec ATTRIBUTE_UNUSED, + struct elf_link_hash_entry *h + ATTRIBUTE_UNUSED) +{ + /* Ignore the first dummy symbol. */ + if (!name) + return TRUE; + + /* Reverse the effects of the hack in elf_vxworks_add_symbol_hook. */ + if (strcmp (name, "__GOTT_INDEX__") == 0 + || strcmp (name, "__GOTT_BASE__") == 0) + sym->st_info = ELF_ST_INFO (STB_GLOBAL, ELF_ST_TYPE (sym->st_info)); + + return TRUE; +} + + +/* Copy relocations into the output file. Fixes up relocations againt PLT + entries, then calls the generic routine. */ + +bfd_boolean +elf_vxworks_emit_relocs (bfd *output_bfd, + asection *input_section, + Elf_Internal_Shdr *input_rel_hdr, + Elf_Internal_Rela *internal_relocs, + struct elf_link_hash_entry **rel_hash) +{ + const struct elf_backend_data *bed; + Elf_Internal_Rela *irela; + Elf_Internal_Rela *irelaend; + int j; + + bed = get_elf_backend_data (output_bfd); + + irela = internal_relocs; + irelaend = irela + (NUM_SHDR_ENTRIES (input_rel_hdr) + * bed->s->int_rels_per_ext_rel); + while (irela < irelaend) + { + if ((output_bfd->flags & (DYNAMIC|EXEC_P)) + && *rel_hash + && (*rel_hash)->def_dynamic + && !(*rel_hash)->def_regular + && (*rel_hash)->root.type == bfd_link_hash_defined + && (*rel_hash)->root.u.def.section->output_section != NULL) + { + /* This is a relocation from an executable or shared library + against a symbol in a different shared library. We are + creating a definition in the output file but it does not come + from any of our normal (.o) files. ie. a PLT stub. + Normally this would be a relocation against against SHN_UNDEF + with the VMA of the PLT stub. This upsets the VxWorks loader. + Convert it to a section-relative relocation. + This gets some other symbols (for instance .dynbss), + but is conservatively correct. */ + for (j = 0; j < bed->s->int_rels_per_ext_rel; j++) + { + asection *sec = (*rel_hash)->root.u.def.section; + int this_idx = + elf_section_data (sec->output_section)->this_idx; + + irela[j].r_info = ELF32_R_INFO (this_idx, + ELF32_R_TYPE (irela[j].r_info)); + irela[j].r_addend += (*rel_hash)->root.u.def.value; + irela[j].r_addend += sec->output_offset; + } + /* Stop the generic routine adjusting this entry. */ + *rel_hash = NULL; + } + irela += bed->s->int_rels_per_ext_rel; + rel_hash++; + } + return _bfd_elf_link_output_relocs (output_bfd, input_section, + input_rel_hdr, internal_relocs, + rel_hash); +} + + +/* Set the sh_link and sh_info fields on the static plt relocation secton. */ + +void +elf_vxworks_final_write_processing (bfd *abfd, + bfd_boolean linker ATTRIBUTE_UNUSED) +{ + asection * sec; + struct bfd_elf_section_data *d; + + sec = bfd_get_section_by_name (abfd, ".rel.plt.unloaded"); + if (!sec) + sec = bfd_get_section_by_name (abfd, ".rela.plt.unloaded"); + if (!sec) + return; + d = elf_section_data (sec); + d->this_hdr.sh_link = elf_tdata (abfd)->symtab_section; + sec = bfd_get_section_by_name (abfd, ".plt"); + if (sec) + d->this_hdr.sh_info = elf_section_data (sec)->this_idx; +} diff --git a/contrib/binutils/bfd/elf-vxworks.h b/contrib/binutils/bfd/elf-vxworks.h new file mode 100644 index 00000000000..c8ea0094eea --- /dev/null +++ b/contrib/binutils/bfd/elf-vxworks.h @@ -0,0 +1,35 @@ +/* VxWorks support for ELF + Copyright 2005 Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "elf/common.h" +#include "elf/internal.h" + +bfd_boolean elf_vxworks_add_symbol_hook + (bfd *, struct bfd_link_info *, Elf_Internal_Sym *, const char **, + flagword *, asection **, bfd_vma *); +bfd_boolean elf_vxworks_link_output_symbol_hook + (struct bfd_link_info *, const char *name, Elf_Internal_Sym *, + asection *, struct elf_link_hash_entry *); +bfd_boolean elf_vxworks_emit_relocs + (bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *, + struct elf_link_hash_entry **); +void elf_vxworks_final_write_processing (bfd *, bfd_boolean); +bfd_boolean elf_vxworks_create_dynamic_sections + (bfd *, struct bfd_link_info *, asection **); diff --git a/contrib/binutils/bfd/elf.c b/contrib/binutils/bfd/elf.c index 654d65136c3..68888809fe4 100644 --- a/contrib/binutils/bfd/elf.c +++ b/contrib/binutils/bfd/elf.c @@ -1,7 +1,7 @@ /* ELF executable support for BFD. Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, - 2002, 2003, 2004 Free Software Foundation, Inc. + 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -17,14 +17,14 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* $FreeBSD$ */ -/* SECTION - +/* +SECTION ELF backends BFD support for ELF formats is being worked on. @@ -210,28 +210,6 @@ bfd_elf_hash (const char *namearg) return h & 0xffffffff; } -/* Read a specified number of bytes at a specified offset in an ELF - file, into a newly allocated buffer, and return a pointer to the - buffer. */ - -static char * -elf_read (bfd *abfd, file_ptr offset, bfd_size_type size) -{ - char *buf; - - if ((buf = bfd_alloc (abfd, size)) == NULL) - return NULL; - if (bfd_seek (abfd, offset, SEEK_SET) != 0) - return NULL; - if (bfd_bread (buf, size, abfd) != size) - { - if (bfd_get_error () != bfd_error_system_call) - bfd_set_error (bfd_error_file_truncated); - return NULL; - } - return buf; -} - bfd_boolean bfd_elf_mkobject (bfd *abfd) { @@ -257,24 +235,38 @@ char * bfd_elf_get_str_section (bfd *abfd, unsigned int shindex) { Elf_Internal_Shdr **i_shdrp; - char *shstrtab = NULL; + bfd_byte *shstrtab = NULL; file_ptr offset; bfd_size_type shstrtabsize; i_shdrp = elf_elfsections (abfd); if (i_shdrp == 0 || i_shdrp[shindex] == 0) - return 0; + return NULL; - shstrtab = (char *) i_shdrp[shindex]->contents; + shstrtab = i_shdrp[shindex]->contents; if (shstrtab == NULL) { /* No cached one, attempt to read, and cache what we read. */ offset = i_shdrp[shindex]->sh_offset; shstrtabsize = i_shdrp[shindex]->sh_size; - shstrtab = elf_read (abfd, offset, shstrtabsize); + + /* Allocate and clear an extra byte at the end, to prevent crashes + in case the string table is not terminated. */ + if (shstrtabsize + 1 == 0 + || (shstrtab = bfd_alloc (abfd, shstrtabsize + 1)) == NULL + || bfd_seek (abfd, offset, SEEK_SET) != 0) + shstrtab = NULL; + else if (bfd_bread (shstrtab, shstrtabsize, abfd) != shstrtabsize) + { + if (bfd_get_error () != bfd_error_system_call) + bfd_set_error (bfd_error_file_truncated); + shstrtab = NULL; + } + else + shstrtab[shstrtabsize] = '\0'; i_shdrp[shindex]->contents = shstrtab; } - return shstrtab; + return (char *) shstrtab; } char * @@ -295,13 +287,13 @@ bfd_elf_string_from_elf_section (bfd *abfd, if (strindex >= hdr->sh_size) { + unsigned int shstrndx = elf_elfheader(abfd)->e_shstrndx; (*_bfd_error_handler) - (_("%s: invalid string offset %u >= %lu for section `%s'"), - bfd_archive_filename (abfd), strindex, (unsigned long) hdr->sh_size, - ((shindex == elf_elfheader(abfd)->e_shstrndx - && strindex == hdr->sh_name) + (_("%B: invalid string offset %u >= %lu for section `%s'"), + abfd, strindex, (unsigned long) hdr->sh_size, + (shindex == shstrndx && strindex == hdr->sh_name ? ".shstrtab" - : elf_string_from_elf_strtab (abfd, hdr->sh_name))); + : bfd_elf_string_from_elf_section (abfd, shstrndx, hdr->sh_name))); return ""; } @@ -352,7 +344,7 @@ bfd_elf_get_elf_syms (bfd *ibfd, pos = symtab_hdr->sh_offset + symoffset * extsym_size; if (extsym_buf == NULL) { - alloc_ext = bfd_malloc (amt); + alloc_ext = bfd_malloc2 (symcount, extsym_size); extsym_buf = alloc_ext; } if (extsym_buf == NULL @@ -371,7 +363,8 @@ bfd_elf_get_elf_syms (bfd *ibfd, pos = shndx_hdr->sh_offset + symoffset * sizeof (Elf_External_Sym_Shndx); if (extshndx_buf == NULL) { - alloc_extshndx = bfd_malloc (amt); + alloc_extshndx = bfd_malloc2 (symcount, + sizeof (Elf_External_Sym_Shndx)); extshndx_buf = alloc_extshndx; } if (extshndx_buf == NULL @@ -385,8 +378,7 @@ bfd_elf_get_elf_syms (bfd *ibfd, if (intsym_buf == NULL) { - bfd_size_type amt = symcount * sizeof (Elf_Internal_Sym); - intsym_buf = bfd_malloc (amt); + intsym_buf = bfd_malloc2 (symcount, sizeof (Elf_Internal_Sym)); if (intsym_buf == NULL) goto out; } @@ -409,17 +401,31 @@ bfd_elf_get_elf_syms (bfd *ibfd, /* Look up a symbol name. */ const char * -bfd_elf_local_sym_name (bfd *abfd, Elf_Internal_Sym *isym) +bfd_elf_sym_name (bfd *abfd, + Elf_Internal_Shdr *symtab_hdr, + Elf_Internal_Sym *isym, + asection *sym_sec) { + const char *name; unsigned int iname = isym->st_name; - unsigned int shindex = elf_tdata (abfd)->symtab_hdr.sh_link; - if (iname == 0 && ELF_ST_TYPE (isym->st_info) == STT_SECTION) + unsigned int shindex = symtab_hdr->sh_link; + + if (iname == 0 && ELF_ST_TYPE (isym->st_info) == STT_SECTION + /* Check for a bogus st_shndx to avoid crashing. */ + && isym->st_shndx < elf_numsections (abfd) + && !(isym->st_shndx >= SHN_LORESERVE && isym->st_shndx <= SHN_HIRESERVE)) { iname = elf_elfsections (abfd)[isym->st_shndx]->sh_name; shindex = elf_elfheader (abfd)->e_shstrndx; } - return bfd_elf_string_from_elf_section (abfd, shindex, iname); + name = bfd_elf_string_from_elf_section (abfd, shindex, iname); + if (name == NULL) + name = "(null)"; + else if (sym_sec && *name == '\0') + name = bfd_section_name (abfd, sym_sec); + + return name; } /* Elf_Internal_Shdr->contents is an array of these for SHT_GROUP @@ -442,8 +448,11 @@ group_signature (bfd *abfd, Elf_Internal_Shdr *ghdr) Elf_External_Sym_Shndx eshndx; Elf_Internal_Sym isym; - /* First we need to ensure the symbol table is available. */ - if (! bfd_section_from_shdr (abfd, ghdr->sh_link)) + /* First we need to ensure the symbol table is available. Make sure + that it is a symbol table section. */ + hdr = elf_elfsections (abfd) [ghdr->sh_link]; + if (hdr->sh_type != SHT_SYMTAB + || ! bfd_section_from_shdr (abfd, ghdr->sh_link)) return NULL; /* Go read the symbol. */ @@ -452,7 +461,7 @@ group_signature (bfd *abfd, Elf_Internal_Shdr *ghdr) &isym, esym, &eshndx) == NULL) return NULL; - return bfd_elf_local_sym_name (abfd, &isym); + return bfd_elf_sym_name (abfd, hdr, &isym, NULL); } /* Set next_in_group list pointer, and group name for NEWSECT. */ @@ -480,15 +489,19 @@ setup_group (bfd *abfd, Elf_Internal_Shdr *hdr, asection *newsect) } if (num_group == 0) - num_group = (unsigned) -1; - elf_tdata (abfd)->num_group = num_group; - - if (num_group > 0) + { + num_group = (unsigned) -1; + elf_tdata (abfd)->num_group = num_group; + } + else { /* We keep a list of elf section headers for group sections, so we can find them quickly. */ - bfd_size_type amt = num_group * sizeof (Elf_Internal_Shdr *); - elf_tdata (abfd)->group_sect_ptr = bfd_alloc (abfd, amt); + bfd_size_type amt; + + elf_tdata (abfd)->num_group = num_group; + elf_tdata (abfd)->group_sect_ptr + = bfd_alloc2 (abfd, num_group, sizeof (Elf_Internal_Shdr *)); if (elf_tdata (abfd)->group_sect_ptr == NULL) return FALSE; @@ -508,7 +521,8 @@ setup_group (bfd *abfd, Elf_Internal_Shdr *hdr, asection *newsect) /* Read the raw contents. */ BFD_ASSERT (sizeof (*dest) >= 4); amt = shdr->sh_size * sizeof (*dest) / 4; - shdr->contents = bfd_alloc (abfd, amt); + shdr->contents = bfd_alloc2 (abfd, shdr->sh_size, + sizeof (*dest) / 4); if (shdr->contents == NULL || bfd_seek (abfd, shdr->sh_offset, SEEK_SET) != 0 || (bfd_bread (shdr->contents, shdr->sh_size, abfd) @@ -539,8 +553,7 @@ setup_group (bfd *abfd, Elf_Internal_Shdr *hdr, asection *newsect) if (idx >= shnum) { ((*_bfd_error_handler) - (_("%s: invalid SHT_GROUP entry"), - bfd_archive_filename (abfd))); + (_("%B: invalid SHT_GROUP entry"), abfd)); idx = 0; } dest->shdr = elf_elfsections (abfd)[idx]; @@ -610,27 +623,105 @@ setup_group (bfd *abfd, Elf_Internal_Shdr *hdr, asection *newsect) if (elf_group_name (newsect) == NULL) { - (*_bfd_error_handler) (_("%s: no group info for section %s"), - bfd_archive_filename (abfd), newsect->name); + (*_bfd_error_handler) (_("%B: no group info for section %A"), + abfd, newsect); } return TRUE; } bfd_boolean -bfd_elf_discard_group (bfd *abfd ATTRIBUTE_UNUSED, asection *group) +_bfd_elf_setup_sections (bfd *abfd) { - asection *first = elf_next_in_group (group); - asection *s = first; + unsigned int i; + unsigned int num_group = elf_tdata (abfd)->num_group; + bfd_boolean result = TRUE; + asection *s; - while (s != NULL) + /* Process SHF_LINK_ORDER. */ + for (s = abfd->sections; s != NULL; s = s->next) { - s->output_section = bfd_abs_section_ptr; - s = elf_next_in_group (s); - /* These lists are circular. */ - if (s == first) - break; + Elf_Internal_Shdr *this_hdr = &elf_section_data (s)->this_hdr; + if ((this_hdr->sh_flags & SHF_LINK_ORDER) != 0) + { + unsigned int elfsec = this_hdr->sh_link; + /* FIXME: The old Intel compiler and old strip/objcopy may + not set the sh_link or sh_info fields. Hence we could + get the situation where elfsec is 0. */ + if (elfsec == 0) + { + const struct elf_backend_data *bed + = get_elf_backend_data (abfd); + if (bed->link_order_error_handler) + bed->link_order_error_handler + (_("%B: warning: sh_link not set for section `%A'"), + abfd, s); + } + else + { + asection *link; + + this_hdr = elf_elfsections (abfd)[elfsec]; + + /* PR 1991, 2008: + Some strip/objcopy may leave an incorrect value in + sh_link. We don't want to proceed. */ + link = this_hdr->bfd_section; + if (link == NULL) + { + (*_bfd_error_handler) + (_("%B: sh_link [%d] in section `%A' is incorrect"), + s->owner, s, elfsec); + result = FALSE; + } + + elf_linked_to_section (s) = link; + } + } } - return TRUE; + + /* Process section groups. */ + if (num_group == (unsigned) -1) + return result; + + for (i = 0; i < num_group; i++) + { + Elf_Internal_Shdr *shdr = elf_tdata (abfd)->group_sect_ptr[i]; + Elf_Internal_Group *idx = (Elf_Internal_Group *) shdr->contents; + unsigned int n_elt = shdr->sh_size / 4; + + while (--n_elt != 0) + if ((++idx)->shdr->bfd_section) + elf_sec_group (idx->shdr->bfd_section) = shdr->bfd_section; + else if (idx->shdr->sh_type == SHT_RELA + || idx->shdr->sh_type == SHT_REL) + /* We won't include relocation sections in section groups in + output object files. We adjust the group section size here + so that relocatable link will work correctly when + relocation sections are in section group in input object + files. */ + shdr->bfd_section->size -= 4; + else + { + /* There are some unknown sections in the group. */ + (*_bfd_error_handler) + (_("%B: unknown [%d] section `%s' in group [%s]"), + abfd, + (unsigned int) idx->shdr->sh_type, + bfd_elf_string_from_elf_section (abfd, + (elf_elfheader (abfd) + ->e_shstrndx), + idx->shdr->sh_name), + shdr->bfd_section->name); + result = FALSE; + } + } + return result; +} + +bfd_boolean +bfd_elf_is_group_section (bfd *abfd ATTRIBUTE_UNUSED, const asection *sec) +{ + return elf_next_in_group (sec) != NULL; } /* Make a BFD section from an ELF section. We store a pointer to the @@ -639,7 +730,8 @@ bfd_elf_discard_group (bfd *abfd ATTRIBUTE_UNUSED, asection *group) bfd_boolean _bfd_elf_make_section_from_shdr (bfd *abfd, Elf_Internal_Shdr *hdr, - const char *name) + const char *name, + int shindex) { asection *newsect; flagword flags; @@ -656,6 +748,10 @@ _bfd_elf_make_section_from_shdr (bfd *abfd, if (newsect == NULL) return FALSE; + hdr->bfd_section = newsect; + elf_section_data (newsect)->this_hdr = *hdr; + elf_section_data (newsect)->this_idx = shindex; + /* Always use the real type/flags. */ elf_section_type (newsect) = hdr->sh_type; elf_section_flags (newsect) = hdr->sh_flags; @@ -698,25 +794,45 @@ _bfd_elf_make_section_from_shdr (bfd *abfd, if ((hdr->sh_flags & SHF_TLS) != 0) flags |= SEC_THREAD_LOCAL; - /* The debugging sections appear to be recognized only by name, not - any sort of flag. */ - { - static const char *debug_sec_names [] = + if ((flags & SEC_ALLOC) == 0) { - ".debug", - ".gnu.linkonce.wi.", - ".line", - ".stab" - }; - int i; - - for (i = ARRAY_SIZE (debug_sec_names); i--;) - if (strncmp (name, debug_sec_names[i], strlen (debug_sec_names[i])) == 0) - break; - - if (i >= 0) - flags |= SEC_DEBUGGING; - } + /* The debugging sections appear to be recognized only by name, + not any sort of flag. Their SEC_ALLOC bits are cleared. */ + static const struct + { + const char *name; + int len; + } debug_sections [] = + { + { "debug", 5 }, /* 'd' */ + { NULL, 0 }, /* 'e' */ + { NULL, 0 }, /* 'f' */ + { "gnu.linkonce.wi.", 17 }, /* 'g' */ + { NULL, 0 }, /* 'h' */ + { NULL, 0 }, /* 'i' */ + { NULL, 0 }, /* 'j' */ + { NULL, 0 }, /* 'k' */ + { "line", 4 }, /* 'l' */ + { NULL, 0 }, /* 'm' */ + { NULL, 0 }, /* 'n' */ + { NULL, 0 }, /* 'o' */ + { NULL, 0 }, /* 'p' */ + { NULL, 0 }, /* 'q' */ + { NULL, 0 }, /* 'r' */ + { "stab", 4 } /* 's' */ + }; + + if (name [0] == '.') + { + int i = name [1] - 'd'; + if (i >= 0 + && i < (int) ARRAY_SIZE (debug_sections) + && debug_sections [i].name != NULL + && strncmp (&name [1], debug_sections [i].name, + debug_sections [i].len) == 0) + flags |= SEC_DEBUGGING; + } + } /* As a GNU extension, if the name begins with .gnu.linkonce, we only link a single copy of the section. This is used to support @@ -802,9 +918,6 @@ _bfd_elf_make_section_from_shdr (bfd *abfd, } } - hdr->bfd_section = newsect; - elf_section_data (newsect)->this_hdr = *hdr; - return TRUE; } @@ -899,10 +1012,31 @@ merge_sections_remove_hook (bfd *abfd ATTRIBUTE_UNUSED, bfd_boolean _bfd_elf_merge_sections (bfd *abfd, struct bfd_link_info *info) { + bfd *ibfd; + asection *sec; + if (!is_elf_hash_table (info->hash)) return FALSE; - if (elf_hash_table (info)->merge_info) - _bfd_merge_sections (abfd, elf_hash_table (info)->merge_info, + + for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) + if ((ibfd->flags & DYNAMIC) == 0) + for (sec = ibfd->sections; sec != NULL; sec = sec->next) + if ((sec->flags & SEC_MERGE) != 0 + && !bfd_is_abs_section (sec->output_section)) + { + struct bfd_elf_section_data *secdata; + + secdata = elf_section_data (sec); + if (! _bfd_add_merge_section (abfd, + &elf_hash_table (info)->merge_info, + sec, &secdata->sec_info)) + return FALSE; + else if (secdata->sec_info) + sec->sec_info_type = ELF_INFO_TYPE_MERGE; + } + + if (elf_hash_table (info)->merge_info != NULL) + _bfd_merge_sections (abfd, info, elf_hash_table (info)->merge_info, merge_sections_remove_hook); return TRUE; } @@ -938,6 +1072,28 @@ _bfd_elf_copy_private_bfd_data (bfd *ibfd, bfd *obfd) return TRUE; } +static const char * +get_segment_type (unsigned int p_type) +{ + const char *pt; + switch (p_type) + { + case PT_NULL: pt = "NULL"; break; + case PT_LOAD: pt = "LOAD"; break; + case PT_DYNAMIC: pt = "DYNAMIC"; break; + case PT_INTERP: pt = "INTERP"; break; + case PT_NOTE: pt = "NOTE"; break; + case PT_SHLIB: pt = "SHLIB"; break; + case PT_PHDR: pt = "PHDR"; break; + case PT_TLS: pt = "TLS"; break; + case PT_GNU_EH_FRAME: pt = "EH_FRAME"; break; + case PT_GNU_STACK: pt = "STACK"; break; + case PT_GNU_RELRO: pt = "RELRO"; break; + default: pt = NULL; break; + } + return pt; +} + /* Print out the program headers. */ bfd_boolean @@ -957,22 +1113,13 @@ _bfd_elf_print_private_bfd_data (bfd *abfd, void *farg) c = elf_elfheader (abfd)->e_phnum; for (i = 0; i < c; i++, p++) { - const char *pt; + const char *pt = get_segment_type (p->p_type); char buf[20]; - switch (p->p_type) + if (pt == NULL) { - case PT_NULL: pt = "NULL"; break; - case PT_LOAD: pt = "LOAD"; break; - case PT_DYNAMIC: pt = "DYNAMIC"; break; - case PT_INTERP: pt = "INTERP"; break; - case PT_NOTE: pt = "NOTE"; break; - case PT_SHLIB: pt = "SHLIB"; break; - case PT_PHDR: pt = "PHDR"; break; - case PT_TLS: pt = "TLS"; break; - case PT_GNU_EH_FRAME: pt = "EH_FRAME"; break; - case PT_GNU_STACK: pt = "STACK"; break; - default: sprintf (buf, "0x%lx", p->p_type); pt = buf; break; + sprintf (buf, "0x%lx", p->p_type); + pt = buf; } fprintf (f, "%8s off 0x", pt); bfd_fprintf_vma (abfd, f, p->p_offset); @@ -1006,10 +1153,7 @@ _bfd_elf_print_private_bfd_data (bfd *abfd, void *farg) fprintf (f, _("\nDynamic Section:\n")); - dynbuf = bfd_malloc (s->_raw_size); - if (dynbuf == NULL) - goto error_return; - if (! bfd_get_section_contents (abfd, s, dynbuf, 0, s->_raw_size)) + if (!bfd_malloc_and_get_section (abfd, s, &dynbuf)) goto error_return; elfsec = _bfd_elf_section_from_bfd_section (abfd, s); @@ -1021,7 +1165,7 @@ _bfd_elf_print_private_bfd_data (bfd *abfd, void *farg) swap_dyn_in = get_elf_backend_data (abfd)->s->swap_dyn_in; extdyn = dynbuf; - extdynend = extdyn + s->_raw_size; + extdynend = extdyn + s->size; for (; extdyn < extdynend; extdyn += extdynsize) { Elf_Internal_Dyn dyn; @@ -1124,7 +1268,7 @@ _bfd_elf_print_private_bfd_data (bfd *abfd, void *farg) if ((elf_dynverdef (abfd) != 0 && elf_tdata (abfd)->verdef == NULL) || (elf_dynverref (abfd) != 0 && elf_tdata (abfd)->verref == NULL)) { - if (! _bfd_elf_slurp_version_tables (abfd)) + if (! _bfd_elf_slurp_version_tables (abfd, FALSE)) return FALSE; } @@ -1136,8 +1280,9 @@ _bfd_elf_print_private_bfd_data (bfd *abfd, void *farg) for (t = elf_tdata (abfd)->verdef; t != NULL; t = t->vd_nextdef) { fprintf (f, "%d 0x%2.2x 0x%8.8lx %s\n", t->vd_ndx, - t->vd_flags, t->vd_hash, t->vd_nodename); - if (t->vd_auxptr->vda_nextptr != NULL) + t->vd_flags, t->vd_hash, + t->vd_nodename ? t->vd_nodename : ""); + if (t->vd_auxptr != NULL && t->vd_auxptr->vda_nextptr != NULL) { Elf_Internal_Verdaux *a; @@ -1145,7 +1290,8 @@ _bfd_elf_print_private_bfd_data (bfd *abfd, void *farg) for (a = t->vd_auxptr->vda_nextptr; a != NULL; a = a->vda_nextptr) - fprintf (f, "%s ", a->vda_nodename); + fprintf (f, "%s ", + a->vda_nodename ? a->vda_nodename : ""); fprintf (f, "\n"); } } @@ -1160,10 +1306,12 @@ _bfd_elf_print_private_bfd_data (bfd *abfd, void *farg) { Elf_Internal_Vernaux *a; - fprintf (f, _(" required from %s:\n"), t->vn_filename); + fprintf (f, _(" required from %s:\n"), + t->vn_filename ? t->vn_filename : ""); for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr) fprintf (f, " 0x%8.8lx 0x%2.2x %2.2d %s\n", a->vna_hash, - a->vna_flags, a->vna_other, a->vna_nodename); + a->vna_flags, a->vna_other, + a->vna_nodename ? a->vna_nodename : ""); } } @@ -1323,23 +1471,15 @@ _bfd_elf_link_hash_newfunc (struct bfd_hash_entry *entry, /* Set local fields. */ ret->indx = -1; ret->dynindx = -1; - ret->dynstr_index = 0; - ret->elf_hash_value = 0; - ret->weakdef = NULL; - ret->verinfo.verdef = NULL; - ret->vtable_entries_size = 0; - ret->vtable_entries_used = NULL; - ret->vtable_parent = NULL; - ret->got = htab->init_refcount; - ret->plt = htab->init_refcount; - ret->size = 0; - ret->type = STT_NOTYPE; - ret->other = 0; + ret->got = htab->init_got_refcount; + ret->plt = htab->init_plt_refcount; + memset (&ret->size, 0, (sizeof (struct elf_link_hash_entry) + - offsetof (struct elf_link_hash_entry, size))); /* Assume that we have been called by a non-ELF symbol reader. This flag is then reset by the code which reads an ELF input file. This ensures that a symbol created by a non-ELF symbol reader will have the flag set correctly. */ - ret->elf_link_hash_flags = ELF_LINK_NON_ELF; + ret->non_elf = 1; } return entry; @@ -1349,56 +1489,53 @@ _bfd_elf_link_hash_newfunc (struct bfd_hash_entry *entry, old indirect symbol. Also used for copying flags to a weakdef. */ void -_bfd_elf_link_hash_copy_indirect (const struct elf_backend_data *bed, +_bfd_elf_link_hash_copy_indirect (struct bfd_link_info *info, struct elf_link_hash_entry *dir, struct elf_link_hash_entry *ind) { - bfd_signed_vma tmp; - bfd_signed_vma lowest_valid = bed->can_refcount; + struct elf_link_hash_table *htab; /* Copy down any references that we may have already seen to the symbol which just became indirect. */ - dir->elf_link_hash_flags - |= ind->elf_link_hash_flags & (ELF_LINK_HASH_REF_DYNAMIC - | ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_REF_REGULAR_NONWEAK - | ELF_LINK_NON_GOT_REF - | ELF_LINK_HASH_NEEDS_PLT - | ELF_LINK_POINTER_EQUALITY_NEEDED); + dir->ref_dynamic |= ind->ref_dynamic; + dir->ref_regular |= ind->ref_regular; + dir->ref_regular_nonweak |= ind->ref_regular_nonweak; + dir->non_got_ref |= ind->non_got_ref; + dir->needs_plt |= ind->needs_plt; + dir->pointer_equality_needed |= ind->pointer_equality_needed; if (ind->root.type != bfd_link_hash_indirect) return; /* Copy over the global and procedure linkage table refcount entries. These may have been already set up by a check_relocs routine. */ - tmp = dir->got.refcount; - if (tmp < lowest_valid) + htab = elf_hash_table (info); + if (ind->got.refcount > htab->init_got_refcount.refcount) { - dir->got.refcount = ind->got.refcount; - ind->got.refcount = tmp; + if (dir->got.refcount < 0) + dir->got.refcount = 0; + dir->got.refcount += ind->got.refcount; + ind->got.refcount = htab->init_got_refcount.refcount; } - else - BFD_ASSERT (ind->got.refcount < lowest_valid); - tmp = dir->plt.refcount; - if (tmp < lowest_valid) + if (ind->plt.refcount > htab->init_plt_refcount.refcount) { - dir->plt.refcount = ind->plt.refcount; - ind->plt.refcount = tmp; + if (dir->plt.refcount < 0) + dir->plt.refcount = 0; + dir->plt.refcount += ind->plt.refcount; + ind->plt.refcount = htab->init_plt_refcount.refcount; } - else - BFD_ASSERT (ind->plt.refcount < lowest_valid); - if (dir->dynindx == -1) + if (ind->dynindx != -1) { + if (dir->dynindx != -1) + _bfd_elf_strtab_delref (htab->dynstr, dir->dynstr_index); dir->dynindx = ind->dynindx; dir->dynstr_index = ind->dynstr_index; ind->dynindx = -1; ind->dynstr_index = 0; } - else - BFD_ASSERT (ind->dynindx == -1); } void @@ -1406,11 +1543,11 @@ _bfd_elf_link_hash_hide_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *h, bfd_boolean force_local) { - h->plt = elf_hash_table (info)->init_offset; - h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; + h->plt = elf_hash_table (info)->init_plt_offset; + h->needs_plt = 0; if (force_local) { - h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL; + h->forced_local = 1; if (h->dynindx != -1) { h->dynindx = -1; @@ -1428,33 +1565,35 @@ _bfd_elf_link_hash_table_init bfd *abfd, struct bfd_hash_entry *(*newfunc) (struct bfd_hash_entry *, struct bfd_hash_table *, - const char *)) + const char *), + unsigned int entsize) { bfd_boolean ret; + int can_refcount = get_elf_backend_data (abfd)->can_refcount; table->dynamic_sections_created = FALSE; table->dynobj = NULL; - /* Make sure can_refcount is extended to the width and signedness of - init_refcount before we subtract one from it. */ - table->init_refcount.refcount = get_elf_backend_data (abfd)->can_refcount; - table->init_refcount.refcount -= 1; - table->init_offset.offset = -(bfd_vma) 1; + table->init_got_refcount.refcount = can_refcount - 1; + table->init_plt_refcount.refcount = can_refcount - 1; + table->init_got_offset.offset = -(bfd_vma) 1; + table->init_plt_offset.offset = -(bfd_vma) 1; /* The first dynamic symbol is a dummy. */ table->dynsymcount = 1; table->dynstr = NULL; table->bucketcount = 0; table->needed = NULL; table->hgot = NULL; - table->stab_info = NULL; table->merge_info = NULL; + memset (&table->stab_info, 0, sizeof (table->stab_info)); memset (&table->eh_info, 0, sizeof (table->eh_info)); table->dynlocal = NULL; table->runpath = NULL; table->tls_sec = NULL; table->tls_size = 0; table->loaded = NULL; + table->is_relocatable_executable = FALSE; - ret = _bfd_link_hash_table_init (&table->root, abfd, newfunc); + ret = _bfd_link_hash_table_init (&table->root, abfd, newfunc, entsize); table->root.type = bfd_link_elf_hash_table; return ret; @@ -1472,7 +1611,8 @@ _bfd_elf_link_hash_table_create (bfd *abfd) if (ret == NULL) return NULL; - if (! _bfd_elf_link_hash_table_init (ret, abfd, _bfd_elf_link_hash_newfunc)) + if (! _bfd_elf_link_hash_table_init (ret, abfd, _bfd_elf_link_hash_newfunc, + sizeof (struct elf_link_hash_entry))) { free (ret); return NULL; @@ -1493,6 +1633,18 @@ bfd_elf_set_dt_needed_name (bfd *abfd, const char *name) elf_dt_name (abfd) = name; } +int +bfd_elf_get_dyn_lib_class (bfd *abfd) +{ + int lib_class; + if (bfd_get_flavour (abfd) == bfd_target_elf_flavour + && bfd_get_format (abfd) == bfd_object) + lib_class = elf_dyn_lib_class (abfd); + else + lib_class = 0; + return lib_class; +} + void bfd_elf_set_dyn_lib_class (bfd *abfd, int lib_class) { @@ -1560,14 +1712,10 @@ bfd_elf_get_bfd_needed_list (bfd *abfd, return TRUE; s = bfd_get_section_by_name (abfd, ".dynamic"); - if (s == NULL || s->_raw_size == 0) + if (s == NULL || s->size == 0) return TRUE; - dynbuf = bfd_malloc (s->_raw_size); - if (dynbuf == NULL) - goto error_return; - - if (! bfd_get_section_contents (abfd, s, dynbuf, 0, s->_raw_size)) + if (!bfd_malloc_and_get_section (abfd, s, &dynbuf)) goto error_return; elfsec = _bfd_elf_section_from_bfd_section (abfd, s); @@ -1580,7 +1728,7 @@ bfd_elf_get_bfd_needed_list (bfd *abfd, swap_dyn_in = get_elf_backend_data (abfd)->s->swap_dyn_in; extdyn = dynbuf; - extdynend = extdyn + s->_raw_size; + extdynend = extdyn + s->size; for (; extdyn < extdynend; extdyn += extdynsize) { Elf_Internal_Dyn dyn; @@ -1658,7 +1806,11 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex) const struct elf_backend_data *bed = get_elf_backend_data (abfd); const char *name; - name = elf_string_from_elf_strtab (abfd, hdr->sh_name); + name = bfd_elf_string_from_elf_section (abfd, + elf_elfheader (abfd)->e_shstrndx, + hdr->sh_name); + if (name == NULL) + return FALSE; switch (hdr->sh_type) { @@ -1673,10 +1825,14 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex) case SHT_INIT_ARRAY: /* .init_array section. */ case SHT_FINI_ARRAY: /* .fini_array section. */ case SHT_PREINIT_ARRAY: /* .preinit_array section. */ - return _bfd_elf_make_section_from_shdr (abfd, hdr, name); + case SHT_GNU_LIBLIST: /* .gnu.liblist section. */ + return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex); case SHT_DYNAMIC: /* Dynamic linking information. */ - if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name)) + if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex)) + return FALSE; + if (hdr->sh_link > elf_numsections (abfd) + || elf_elfsections (abfd)[hdr->sh_link] == NULL) return FALSE; if (elf_elfsections (abfd)[hdr->sh_link]->sh_type != SHT_STRTAB) { @@ -1712,7 +1868,8 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex) if (elf_onesymtab (abfd) == shindex) return TRUE; - BFD_ASSERT (hdr->sh_entsize == bed->s->sizeof_sym); + if (hdr->sh_entsize != bed->s->sizeof_sym) + return FALSE; BFD_ASSERT (elf_onesymtab (abfd) == 0); elf_onesymtab (abfd) = shindex; elf_tdata (abfd)->symtab_hdr = *hdr; @@ -1727,16 +1884,44 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex) linker. */ if ((hdr->sh_flags & SHF_ALLOC) != 0 && (abfd->flags & DYNAMIC) != 0 - && ! _bfd_elf_make_section_from_shdr (abfd, hdr, name)) + && ! _bfd_elf_make_section_from_shdr (abfd, hdr, name, + shindex)) return FALSE; + /* Go looking for SHT_SYMTAB_SHNDX too, since if there is one we + can't read symbols without that section loaded as well. It + is most likely specified by the next section header. */ + if (elf_elfsections (abfd)[elf_symtab_shndx (abfd)]->sh_link != shindex) + { + unsigned int i, num_sec; + + num_sec = elf_numsections (abfd); + for (i = shindex + 1; i < num_sec; i++) + { + Elf_Internal_Shdr *hdr2 = elf_elfsections (abfd)[i]; + if (hdr2->sh_type == SHT_SYMTAB_SHNDX + && hdr2->sh_link == shindex) + break; + } + if (i == num_sec) + for (i = 1; i < shindex; i++) + { + Elf_Internal_Shdr *hdr2 = elf_elfsections (abfd)[i]; + if (hdr2->sh_type == SHT_SYMTAB_SHNDX + && hdr2->sh_link == shindex) + break; + } + if (i != shindex) + return bfd_section_from_shdr (abfd, i); + } return TRUE; case SHT_DYNSYM: /* A dynamic symbol table */ if (elf_dynsymtab (abfd) == shindex) return TRUE; - BFD_ASSERT (hdr->sh_entsize == bed->s->sizeof_sym); + if (hdr->sh_entsize != bed->s->sizeof_sym) + return FALSE; BFD_ASSERT (elf_dynsymtab (abfd) == 0); elf_dynsymtab (abfd) = shindex; elf_tdata (abfd)->dynsymtab_hdr = *hdr; @@ -1745,17 +1930,13 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex) /* Besides being a symbol table, we also treat this as a regular section, so that objcopy can handle it. */ - return _bfd_elf_make_section_from_shdr (abfd, hdr, name); + return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex); case SHT_SYMTAB_SHNDX: /* Symbol section indices when >64k sections */ if (elf_symtab_shndx (abfd) == shindex) return TRUE; - /* Get the associated symbol table. */ - if (! bfd_section_from_shdr (abfd, hdr->sh_link) - || hdr->sh_link != elf_onesymtab (abfd)) - return FALSE; - + BFD_ASSERT (elf_symtab_shndx (abfd) == 0); elf_symtab_shndx (abfd) = shindex; elf_tdata (abfd)->symtab_shndx_hdr = *hdr; elf_elfsections (abfd)[shindex] = &elf_tdata (abfd)->symtab_shndx_hdr; @@ -1770,49 +1951,51 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex) elf_elfsections (abfd)[shindex] = &elf_tdata (abfd)->shstrtab_hdr; return TRUE; } - { - unsigned int i, num_sec; + if (elf_elfsections (abfd)[elf_onesymtab (abfd)]->sh_link == shindex) + { + symtab_strtab: + elf_tdata (abfd)->strtab_hdr = *hdr; + elf_elfsections (abfd)[shindex] = &elf_tdata (abfd)->strtab_hdr; + return TRUE; + } + if (elf_elfsections (abfd)[elf_dynsymtab (abfd)]->sh_link == shindex) + { + dynsymtab_strtab: + elf_tdata (abfd)->dynstrtab_hdr = *hdr; + hdr = &elf_tdata (abfd)->dynstrtab_hdr; + elf_elfsections (abfd)[shindex] = hdr; + /* We also treat this as a regular section, so that objcopy + can handle it. */ + return _bfd_elf_make_section_from_shdr (abfd, hdr, name, + shindex); + } - num_sec = elf_numsections (abfd); - for (i = 1; i < num_sec; i++) - { - Elf_Internal_Shdr *hdr2 = elf_elfsections (abfd)[i]; - if (hdr2->sh_link == shindex) - { - if (! bfd_section_from_shdr (abfd, i)) - return FALSE; - if (elf_onesymtab (abfd) == i) - { - elf_tdata (abfd)->strtab_hdr = *hdr; - elf_elfsections (abfd)[shindex] = - &elf_tdata (abfd)->strtab_hdr; - return TRUE; - } - if (elf_dynsymtab (abfd) == i) - { - elf_tdata (abfd)->dynstrtab_hdr = *hdr; - elf_elfsections (abfd)[shindex] = hdr = - &elf_tdata (abfd)->dynstrtab_hdr; - /* We also treat this as a regular section, so - that objcopy can handle it. */ - break; - } -#if 0 /* Not handling other string tables specially right now. */ - hdr2 = elf_elfsections (abfd)[i]; /* in case it moved */ - /* We have a strtab for some random other section. */ - newsect = (asection *) hdr2->bfd_section; - if (!newsect) - break; - hdr->bfd_section = newsect; - hdr2 = &elf_section_data (newsect)->str_hdr; - *hdr2 = *hdr; - elf_elfsections (abfd)[shindex] = hdr2; -#endif - } - } - } + /* If the string table isn't one of the above, then treat it as a + regular section. We need to scan all the headers to be sure, + just in case this strtab section appeared before the above. */ + if (elf_onesymtab (abfd) == 0 || elf_dynsymtab (abfd) == 0) + { + unsigned int i, num_sec; - return _bfd_elf_make_section_from_shdr (abfd, hdr, name); + num_sec = elf_numsections (abfd); + for (i = 1; i < num_sec; i++) + { + Elf_Internal_Shdr *hdr2 = elf_elfsections (abfd)[i]; + if (hdr2->sh_link == shindex) + { + /* Prevent endless recursion on broken objects. */ + if (i == shindex) + return FALSE; + if (! bfd_section_from_shdr (abfd, i)) + return FALSE; + if (elf_onesymtab (abfd) == i) + goto symtab_strtab; + if (elf_dynsymtab (abfd) == i) + goto dynsymtab_strtab; + } + } + } + return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex); case SHT_REL: case SHT_RELA: @@ -1822,14 +2005,20 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex) Elf_Internal_Shdr *hdr2; unsigned int num_sec = elf_numsections (abfd); + if (hdr->sh_entsize + != (bfd_size_type) (hdr->sh_type == SHT_REL + ? bed->s->sizeof_rel : bed->s->sizeof_rela)) + return FALSE; + /* Check for a bogus link to avoid crashing. */ if ((hdr->sh_link >= SHN_LORESERVE && hdr->sh_link <= SHN_HIRESERVE) || hdr->sh_link >= num_sec) { ((*_bfd_error_handler) - (_("%s: invalid link %lu for reloc section %s (index %u)"), - bfd_archive_filename (abfd), hdr->sh_link, name, shindex)); - return _bfd_elf_make_section_from_shdr (abfd, hdr, name); + (_("%B: invalid link %lu for reloc section %s (index %u)"), + abfd, hdr->sh_link, name, shindex)); + return _bfd_elf_make_section_from_shdr (abfd, hdr, name, + shindex); } /* For some incomprehensible reason Oracle distributes @@ -1864,7 +2053,8 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex) } /* Get the symbol table. */ - if (elf_elfsections (abfd)[hdr->sh_link]->sh_type == SHT_SYMTAB + if ((elf_elfsections (abfd)[hdr->sh_link]->sh_type == SHT_SYMTAB + || elf_elfsections (abfd)[hdr->sh_link]->sh_type == SHT_DYNSYM) && ! bfd_section_from_shdr (abfd, hdr->sh_link)) return FALSE; @@ -1873,9 +2063,15 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex) represent such a section, so at least for now, we don't try. We just present it as a normal section. We also can't use it as a reloc section if it points to the null - section. */ - if (hdr->sh_link != elf_onesymtab (abfd) || hdr->sh_info == SHN_UNDEF) - return _bfd_elf_make_section_from_shdr (abfd, hdr, name); + section, an invalid section, or another reloc section. */ + if (hdr->sh_link != elf_onesymtab (abfd) + || hdr->sh_info == SHN_UNDEF + || (hdr->sh_info >= SHN_LORESERVE && hdr->sh_info <= SHN_HIRESERVE) + || hdr->sh_info >= num_sec + || elf_elfsections (abfd)[hdr->sh_info]->sh_type == SHT_REL + || elf_elfsections (abfd)[hdr->sh_info]->sh_type == SHT_RELA) + return _bfd_elf_make_section_from_shdr (abfd, hdr, name, + shindex); if (! bfd_section_from_shdr (abfd, hdr->sh_info)) return FALSE; @@ -1912,19 +2108,21 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex) case SHT_GNU_verdef: elf_dynverdef (abfd) = shindex; elf_tdata (abfd)->dynverdef_hdr = *hdr; - return _bfd_elf_make_section_from_shdr (abfd, hdr, name); + return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex); break; case SHT_GNU_versym: + if (hdr->sh_entsize != sizeof (Elf_External_Versym)) + return FALSE; elf_dynversym (abfd) = shindex; elf_tdata (abfd)->dynversym_hdr = *hdr; - return _bfd_elf_make_section_from_shdr (abfd, hdr, name); + return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex); break; case SHT_GNU_verneed: elf_dynverref (abfd) = shindex; elf_tdata (abfd)->dynverref_hdr = *hdr; - return _bfd_elf_make_section_from_shdr (abfd, hdr, name); + return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex); break; case SHT_SHLIB: @@ -1934,10 +2132,12 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex) /* We need a BFD section for objcopy and relocatable linking, and it's handy to have the signature available as the section name. */ + if (hdr->sh_entsize != GRP_ENTRY_SIZE) + return FALSE; name = group_signature (abfd, hdr); if (name == NULL) return FALSE; - if (!_bfd_elf_make_section_from_shdr (abfd, hdr, name)) + if (!_bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex)) return FALSE; if (hdr->contents != NULL) { @@ -1949,8 +2149,10 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex) hdr->bfd_section->flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD; + /* We try to keep the same section order as it comes in. */ + idx += n_elt; while (--n_elt != 0) - if ((s = (++idx)->shdr->bfd_section) != NULL + if ((s = (--idx)->shdr->bfd_section) != NULL && elf_next_in_group (s) != NULL) { elf_next_in_group (hdr->bfd_section) = s; @@ -1961,11 +2163,8 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex) default: /* Check for any processor-specific section types. */ - { - if (bed->elf_backend_section_from_shdr) - (*bed->elf_backend_section_from_shdr) (abfd, hdr, name); - } - break; + return bed->elf_backend_section_from_shdr (abfd, hdr, name, + shindex); } return TRUE; @@ -2023,25 +2222,23 @@ bfd_section_from_elf_index (bfd *abfd, unsigned int index) return elf_elfsections (abfd)[index]->bfd_section; } -static struct bfd_elf_special_section const special_sections[] = +static const struct bfd_elf_special_section special_sections_b[] = { { ".bss", 4, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, - { ".gnu.linkonce.b",15, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, + { NULL, 0, 0, 0, 0 } +}; + +static const struct bfd_elf_special_section special_sections_c[] = +{ { ".comment", 8, 0, SHT_PROGBITS, 0 }, + { NULL, 0, 0, 0, 0 } +}; + +static const struct bfd_elf_special_section special_sections_d[] = +{ { ".data", 5, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, { ".data1", 6, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, { ".debug", 6, 0, SHT_PROGBITS, 0 }, - { ".fini", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR }, - { ".init", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR }, - { ".line", 5, 0, SHT_PROGBITS, 0 }, - { ".rodata", 7, -2, SHT_PROGBITS, SHF_ALLOC }, - { ".rodata1", 8, 0, SHT_PROGBITS, SHF_ALLOC }, - { ".tbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_TLS }, - { ".tdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_TLS }, - { ".text", 5, -2, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR }, - { ".init_array", 11, 0, SHT_INIT_ARRAY, SHF_ALLOC + SHF_WRITE }, - { ".fini_array", 11, 0, SHT_FINI_ARRAY, SHF_ALLOC + SHF_WRITE }, - { ".preinit_array", 14, 0, SHT_PREINIT_ARRAY, SHF_ALLOC + SHF_WRITE }, { ".debug_line", 11, 0, SHT_PROGBITS, 0 }, { ".debug_info", 11, 0, SHT_PROGBITS, 0 }, { ".debug_abbrev", 13, 0, SHT_PROGBITS, 0 }, @@ -2049,42 +2246,132 @@ static struct bfd_elf_special_section const special_sections[] = { ".dynamic", 8, 0, SHT_DYNAMIC, SHF_ALLOC }, { ".dynstr", 7, 0, SHT_STRTAB, SHF_ALLOC }, { ".dynsym", 7, 0, SHT_DYNSYM, SHF_ALLOC }, + { NULL, 0, 0, 0, 0 } +}; + +static const struct bfd_elf_special_section special_sections_f[] = +{ + { ".fini", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR }, + { ".fini_array", 11, 0, SHT_FINI_ARRAY, SHF_ALLOC + SHF_WRITE }, + { NULL, 0, 0, 0, 0 } +}; + +static const struct bfd_elf_special_section special_sections_g[] = +{ + { ".gnu.linkonce.b",15, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, { ".got", 4, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, - { ".hash", 5, 0, SHT_HASH, SHF_ALLOC }, - { ".interp", 7, 0, SHT_PROGBITS, 0 }, - { ".plt", 4, 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR }, - { ".shstrtab", 9, 0, SHT_STRTAB, 0 }, - { ".strtab", 7, 0, SHT_STRTAB, 0 }, - { ".symtab", 7, 0, SHT_SYMTAB, 0 }, { ".gnu.version", 12, 0, SHT_GNU_versym, 0 }, { ".gnu.version_d", 14, 0, SHT_GNU_verdef, 0 }, { ".gnu.version_r", 14, 0, SHT_GNU_verneed, 0 }, + { ".gnu.liblist", 12, 0, SHT_GNU_LIBLIST, SHF_ALLOC }, + { ".gnu.conflict", 13, 0, SHT_RELA, SHF_ALLOC }, + { NULL, 0, 0, 0, 0 } +}; + +static const struct bfd_elf_special_section special_sections_h[] = +{ + { ".hash", 5, 0, SHT_HASH, SHF_ALLOC }, + { NULL, 0, 0, 0, 0 } +}; + +static const struct bfd_elf_special_section special_sections_i[] = +{ + { ".init", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR }, + { ".init_array", 11, 0, SHT_INIT_ARRAY, SHF_ALLOC + SHF_WRITE }, + { ".interp", 7, 0, SHT_PROGBITS, 0 }, + { NULL, 0, 0, 0, 0 } +}; + +static const struct bfd_elf_special_section special_sections_l[] = +{ + { ".line", 5, 0, SHT_PROGBITS, 0 }, + { NULL, 0, 0, 0, 0 } +}; + +static const struct bfd_elf_special_section special_sections_n[] = +{ + { ".note.GNU-stack",15, 0, SHT_PROGBITS, 0 }, { ".note", 5, -1, SHT_NOTE, 0 }, + { NULL, 0, 0, 0, 0 } +}; + +static const struct bfd_elf_special_section special_sections_p[] = +{ + { ".preinit_array", 14, 0, SHT_PREINIT_ARRAY, SHF_ALLOC + SHF_WRITE }, + { ".plt", 4, 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR }, + { NULL, 0, 0, 0, 0 } +}; + +static const struct bfd_elf_special_section special_sections_r[] = +{ + { ".rodata", 7, -2, SHT_PROGBITS, SHF_ALLOC }, + { ".rodata1", 8, 0, SHT_PROGBITS, SHF_ALLOC }, { ".rela", 5, -1, SHT_RELA, 0 }, { ".rel", 4, -1, SHT_REL, 0 }, + { NULL, 0, 0, 0, 0 } +}; + +static const struct bfd_elf_special_section special_sections_s[] = +{ + { ".shstrtab", 9, 0, SHT_STRTAB, 0 }, + { ".strtab", 7, 0, SHT_STRTAB, 0 }, + { ".symtab", 7, 0, SHT_SYMTAB, 0 }, { ".stabstr", 5, 3, SHT_STRTAB, 0 }, { NULL, 0, 0, 0, 0 } }; -static const struct bfd_elf_special_section * -get_special_section (const char *name, - const struct bfd_elf_special_section *special_sections, - unsigned int rela) +static const struct bfd_elf_special_section special_sections_t[] = +{ + { ".text", 5, -2, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR }, + { ".tbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_TLS }, + { ".tdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_TLS }, + { NULL, 0, 0, 0, 0 } +}; + +static const struct bfd_elf_special_section *special_sections[] = +{ + special_sections_b, /* 'b' */ + special_sections_c, /* 'b' */ + special_sections_d, /* 'd' */ + NULL, /* 'e' */ + special_sections_f, /* 'f' */ + special_sections_g, /* 'g' */ + special_sections_h, /* 'h' */ + special_sections_i, /* 'i' */ + NULL, /* 'j' */ + NULL, /* 'k' */ + special_sections_l, /* 'l' */ + NULL, /* 'm' */ + special_sections_n, /* 'n' */ + NULL, /* 'o' */ + special_sections_p, /* 'p' */ + NULL, /* 'q' */ + special_sections_r, /* 'r' */ + special_sections_s, /* 's' */ + special_sections_t, /* 't' */ +}; + +const struct bfd_elf_special_section * +_bfd_elf_get_special_section (const char *name, + const struct bfd_elf_special_section *spec, + unsigned int rela) { int i; - int len = strlen (name); + int len; - for (i = 0; special_sections[i].prefix != NULL; i++) + len = strlen (name); + + for (i = 0; spec[i].prefix != NULL; i++) { int suffix_len; - int prefix_len = special_sections[i].prefix_length; + int prefix_len = spec[i].prefix_length; if (len < prefix_len) continue; - if (memcmp (name, special_sections[i].prefix, prefix_len) != 0) + if (memcmp (name, spec[i].prefix, prefix_len) != 0) continue; - suffix_len = special_sections[i].suffix_length; + suffix_len = spec[i].suffix_length; if (suffix_len <= 0) { if (name[prefix_len] != 0) @@ -2093,7 +2380,7 @@ get_special_section (const char *name, continue; if (name[prefix_len] != '.' && (suffix_len == -2 - || (rela && special_sections[i].type == SHT_REL))) + || (rela && spec[i].type == SHT_REL))) continue; } } @@ -2102,41 +2389,58 @@ get_special_section (const char *name, if (len < prefix_len + suffix_len) continue; if (memcmp (name + len - suffix_len, - special_sections[i].prefix + prefix_len, + spec[i].prefix + prefix_len, suffix_len) != 0) continue; } - return &special_sections[i]; + return &spec[i]; } return NULL; } const struct bfd_elf_special_section * -_bfd_elf_get_sec_type_attr (bfd *abfd, const char *name) +_bfd_elf_get_sec_type_attr (bfd *abfd, asection *sec) { - const struct elf_backend_data *bed = get_elf_backend_data (abfd); - const struct bfd_elf_special_section *ssect = NULL; + int i; + const struct bfd_elf_special_section *spec; + const struct elf_backend_data *bed; /* See if this is one of the special sections. */ - if (name) + if (sec->name == NULL) + return NULL; + + bed = get_elf_backend_data (abfd); + spec = bed->special_sections; + if (spec) { - unsigned int rela = bed->default_use_rela_p; - - if (bed->special_sections) - ssect = get_special_section (name, bed->special_sections, rela); - - if (! ssect) - ssect = get_special_section (name, special_sections, rela); + spec = _bfd_elf_get_special_section (sec->name, + bed->special_sections, + sec->use_rela_p); + if (spec != NULL) + return spec; } - return ssect; + if (sec->name[0] != '.') + return NULL; + + i = sec->name[1] - 'b'; + if (i < 0 || i > 't' - 'b') + return NULL; + + spec = special_sections[i]; + + if (spec == NULL) + return NULL; + + return _bfd_elf_get_special_section (sec->name, spec, sec->use_rela_p); } bfd_boolean _bfd_elf_new_section_hook (bfd *abfd, asection *sec) { struct bfd_elf_section_data *sdata; + const struct elf_backend_data *bed; const struct bfd_elf_special_section *ssect; sdata = (struct bfd_elf_section_data *) sec->used_by_bfd; @@ -2148,16 +2452,23 @@ _bfd_elf_new_section_hook (bfd *abfd, asection *sec) sec->used_by_bfd = sdata; } - elf_section_type (sec) = SHT_NULL; - ssect = _bfd_elf_get_sec_type_attr (abfd, sec->name); - if (ssect != NULL) - { - elf_section_type (sec) = ssect->type; - elf_section_flags (sec) = ssect->attr; - } - /* Indicate whether or not this section should use RELA relocations. */ - sec->use_rela_p = get_elf_backend_data (abfd)->default_use_rela_p; + bed = get_elf_backend_data (abfd); + sec->use_rela_p = bed->default_use_rela_p; + + /* When we read a file, we don't need section type and flags unless + it is a linker created section. They will be overridden in + _bfd_elf_make_section_from_shdr anyway. */ + if (abfd->direction != read_direction + || (sec->flags & SEC_LINKER_CREATED) != 0) + { + ssect = (*bed->get_sec_type_attr) (abfd, sec); + if (ssect != NULL) + { + elf_section_type (sec) = ssect->type; + elf_section_flags (sec) = ssect->attr; + } + } return TRUE; } @@ -2210,7 +2521,7 @@ _bfd_elf_make_section_from_phdr (bfd *abfd, return FALSE; newsect->vma = hdr->p_vaddr; newsect->lma = hdr->p_paddr; - newsect->_raw_size = hdr->p_filesz; + newsect->size = hdr->p_filesz; newsect->filepos = hdr->p_offset; newsect->flags |= SEC_HAS_CONTENTS; newsect->alignment_power = bfd_log2 (hdr->p_align); @@ -2243,7 +2554,7 @@ _bfd_elf_make_section_from_phdr (bfd *abfd, return FALSE; newsect->vma = hdr->p_vaddr + hdr->p_filesz; newsect->lma = hdr->p_paddr + hdr->p_filesz; - newsect->_raw_size = hdr->p_memsz - hdr->p_filesz; + newsect->size = hdr->p_memsz - hdr->p_filesz; if (hdr->p_type == PT_LOAD) { newsect->flags |= SEC_ALLOC; @@ -2296,14 +2607,13 @@ bfd_section_from_phdr (bfd *abfd, Elf_Internal_Phdr *hdr, int index) case PT_GNU_STACK: return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "stack"); + case PT_GNU_RELRO: + return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "relro"); + default: - /* Check for any processor-specific program segment types. - If no handler for them, default to making "segment" sections. */ + /* Check for any processor-specific program segment types. */ bed = get_elf_backend_data (abfd); - if (bed->elf_backend_section_from_phdr) - return (*bed->elf_backend_section_from_phdr) (abfd, hdr, index); - else - return _bfd_elf_make_section_from_phdr (abfd, hdr, index, "segment"); + return bed->elf_backend_section_from_phdr (abfd, hdr, index, "proc"); } } @@ -2369,7 +2679,7 @@ elf_fake_sections (bfd *abfd, asection *asect, void *failedptrarg) return; } - this_hdr->sh_flags = 0; + /* Don't clear sh_flags. Assembler may set additional bits. */ if ((asect->flags & SEC_ALLOC) != 0 || asect->user_set_vma) @@ -2378,7 +2688,7 @@ elf_fake_sections (bfd *abfd, asection *asect, void *failedptrarg) this_hdr->sh_addr = 0; this_hdr->sh_offset = 0; - this_hdr->sh_size = asect->_raw_size; + this_hdr->sh_size = asect->size; this_hdr->sh_link = 0; this_hdr->sh_addralign = 1 << asect->alignment_power; /* The sh_entsize and sh_info fields may have been set already by @@ -2391,7 +2701,9 @@ elf_fake_sections (bfd *abfd, asection *asect, void *failedptrarg) asect->flags. */ if (this_hdr->sh_type == SHT_NULL) { - if ((asect->flags & SEC_ALLOC) != 0 + if ((asect->flags & SEC_GROUP) != 0) + this_hdr->sh_type = SHT_GROUP; + else if ((asect->flags & SEC_ALLOC) != 0 && (((asect->flags & (SEC_LOAD | SEC_HAS_CONTENTS)) == 0) || (asect->flags & SEC_NEVER_LOAD) != 0)) this_hdr->sh_type = SHT_NOBITS; @@ -2486,16 +2798,18 @@ elf_fake_sections (bfd *abfd, asection *asect, void *failedptrarg) if ((asect->flags & SEC_THREAD_LOCAL) != 0) { this_hdr->sh_flags |= SHF_TLS; - if (asect->_raw_size == 0 && (asect->flags & SEC_HAS_CONTENTS) == 0) + if (asect->size == 0 + && (asect->flags & SEC_HAS_CONTENTS) == 0) { - struct bfd_link_order *o; + struct bfd_link_order *o = asect->map_tail.link_order; this_hdr->sh_size = 0; - for (o = asect->link_order_head; o != NULL; o = o->next) - if (this_hdr->sh_size < o->offset + o->size) + if (o != NULL) + { this_hdr->sh_size = o->offset + o->size; - if (this_hdr->sh_size) - this_hdr->sh_type = SHT_NOBITS; + if (this_hdr->sh_size != 0) + this_hdr->sh_type = SHT_NOBITS; + } } } @@ -2525,10 +2839,11 @@ bfd_elf_set_group_contents (bfd *abfd, asection *sec, void *failedptrarg) unsigned long symindx; asection *elt, *first; unsigned char *loc; - struct bfd_link_order *l; bfd_boolean gas; - if (elf_section_data (sec)->this_hdr.sh_type != SHT_GROUP + /* Ignore linker created group section. See elfNN_ia64_object_p in + elfxx-ia64.c. */ + if (((sec->flags & (SEC_GROUP | SEC_LINKER_CREATED)) != SEC_GROUP) || *failedptr) return; @@ -2552,7 +2867,7 @@ bfd_elf_set_group_contents (bfd *abfd, asection *sec, void *failedptrarg) if (sec->contents == NULL) { gas = FALSE; - sec->contents = bfd_alloc (abfd, sec->_raw_size); + sec->contents = bfd_alloc (abfd, sec->size); /* Arrange for the section to be written out. */ elf_section_data (sec)->this_hdr.contents = sec->contents; @@ -2563,7 +2878,7 @@ bfd_elf_set_group_contents (bfd *abfd, asection *sec, void *failedptrarg) } } - loc = sec->contents + sec->_raw_size; + loc = sec->contents + sec->size; /* Get the pointer to the first section in the group that gas squirreled away here. objcopy arranges for this to be set to the @@ -2592,29 +2907,7 @@ bfd_elf_set_group_contents (bfd *abfd, asection *sec, void *failedptrarg) break; } - /* If this is a relocatable link, then the above did nothing because - SEC is the output section. Look through the input sections - instead. */ - for (l = sec->link_order_head; l != NULL; l = l->next) - if (l->type == bfd_indirect_link_order - && (elt = elf_next_in_group (l->u.indirect.section)) != NULL) - do - { - loc -= 4; - H_PUT_32 (abfd, - elf_section_data (elt->output_section)->this_idx, loc); - elt = elf_next_in_group (elt); - /* During a relocatable link, the lists are circular. */ - } - while (elt != elf_next_in_group (l->u.indirect.section)); - - /* With ld -r, merging SHT_GROUP sections results in wasted space - due to allowing for the flag word on each input. We may well - duplicate entries too. */ - while ((loc -= 4) > sec->contents) - H_PUT_32 (abfd, 0, loc); - - if (loc != sec->contents) + if ((loc -= 4) != sec->contents) abort (); H_PUT_32 (abfd, sec->flags & SEC_LINK_ONCE ? GRP_COMDAT : 0, loc); @@ -2625,25 +2918,54 @@ bfd_elf_set_group_contents (bfd *abfd, asection *sec, void *failedptrarg) in here too, while we're at it. */ static bfd_boolean -assign_section_numbers (bfd *abfd) +assign_section_numbers (bfd *abfd, struct bfd_link_info *link_info) { struct elf_obj_tdata *t = elf_tdata (abfd); asection *sec; unsigned int section_number, secn; Elf_Internal_Shdr **i_shdrp; - bfd_size_type amt; + struct bfd_elf_section_data *d; section_number = 1; _bfd_elf_strtab_clear_all_refs (elf_shstrtab (abfd)); + /* SHT_GROUP sections are in relocatable files only. */ + if (link_info == NULL || link_info->relocatable) + { + /* Put SHT_GROUP sections first. */ + for (sec = abfd->sections; sec != NULL; sec = sec->next) + { + d = elf_section_data (sec); + + if (d->this_hdr.sh_type == SHT_GROUP) + { + if (sec->flags & SEC_LINKER_CREATED) + { + /* Remove the linker created SHT_GROUP sections. */ + bfd_section_list_remove (abfd, sec); + abfd->section_count--; + } + else + { + if (section_number == SHN_LORESERVE) + section_number += SHN_HIRESERVE + 1 - SHN_LORESERVE; + d->this_idx = section_number++; + } + } + } + } + for (sec = abfd->sections; sec; sec = sec->next) { - struct bfd_elf_section_data *d = elf_section_data (sec); + d = elf_section_data (sec); - if (section_number == SHN_LORESERVE) - section_number += SHN_HIRESERVE + 1 - SHN_LORESERVE; - d->this_idx = section_number++; + if (d->this_hdr.sh_type != SHT_GROUP) + { + if (section_number == SHN_LORESERVE) + section_number += SHN_HIRESERVE + 1 - SHN_LORESERVE; + d->this_idx = section_number++; + } _bfd_elf_strtab_addref (elf_shstrtab (abfd), d->this_hdr.sh_name); if ((sec->flags & SEC_RELOC) == 0) d->rel_idx = 0; @@ -2705,13 +3027,11 @@ assign_section_numbers (bfd *abfd) /* Set up the list of section header pointers, in agreement with the indices. */ - amt = section_number * sizeof (Elf_Internal_Shdr *); - i_shdrp = bfd_zalloc (abfd, amt); + i_shdrp = bfd_zalloc2 (abfd, section_number, sizeof (Elf_Internal_Shdr *)); if (i_shdrp == NULL) return FALSE; - amt = sizeof (Elf_Internal_Shdr); - i_shdrp[0] = bfd_zalloc (abfd, amt); + i_shdrp[0] = bfd_zalloc (abfd, sizeof (Elf_Internal_Shdr)); if (i_shdrp[0] == NULL) { bfd_release (abfd, i_shdrp); @@ -2732,6 +3052,7 @@ assign_section_numbers (bfd *abfd) i_shdrp[t->strtab_section] = &t->strtab_hdr; t->symtab_hdr.sh_link = t->strtab_section; } + for (sec = abfd->sections; sec; sec = sec->next) { struct bfd_elf_section_data *d = elf_section_data (sec); @@ -2760,6 +3081,68 @@ assign_section_numbers (bfd *abfd) d->rel_hdr2->sh_info = d->this_idx; } + /* We need to set up sh_link for SHF_LINK_ORDER. */ + if ((d->this_hdr.sh_flags & SHF_LINK_ORDER) != 0) + { + s = elf_linked_to_section (sec); + if (s) + { + /* elf_linked_to_section points to the input section. */ + if (link_info != NULL) + { + /* Check discarded linkonce section. */ + if (elf_discarded_section (s)) + { + asection *kept; + (*_bfd_error_handler) + (_("%B: sh_link of section `%A' points to discarded section `%A' of `%B'"), + abfd, d->this_hdr.bfd_section, + s, s->owner); + /* Point to the kept section if it has the same + size as the discarded one. */ + kept = _bfd_elf_check_kept_section (s); + if (kept == NULL) + { + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + s = kept; + } + + s = s->output_section; + BFD_ASSERT (s != NULL); + } + else + { + /* Handle objcopy. */ + if (s->output_section == NULL) + { + (*_bfd_error_handler) + (_("%B: sh_link of section `%A' points to removed section `%A' of `%B'"), + abfd, d->this_hdr.bfd_section, s, s->owner); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + s = s->output_section; + } + d->this_hdr.sh_link = elf_section_data (s)->this_idx; + } + else + { + /* PR 290: + The Intel C compiler generates SHT_IA_64_UNWIND with + SHF_LINK_ORDER. But it doesn't set the sh_link or + sh_info fields. Hence we could get the situation + where s is NULL. */ + const struct elf_backend_data *bed + = get_elf_backend_data (abfd); + if (bed->link_order_error_handler) + bed->link_order_error_handler + (_("%B: warning: sh_link not set for section `%A'"), + abfd, sec); + } + } + switch (d->this_hdr.sh_type) { case SHT_REL: @@ -2828,6 +3211,17 @@ assign_section_numbers (bfd *abfd) d->this_hdr.sh_link = elf_section_data (s)->this_idx; break; + case SHT_GNU_LIBLIST: + /* sh_link is the section header index of the prelink library + list + used for the dynamic entries, or the symbol table, or the + version strings. */ + s = bfd_get_section_by_name (abfd, (sec->flags & SEC_ALLOC) + ? ".dynstr" : ".gnu.libstr"); + if (s != NULL) + d->this_hdr.sh_link = elf_section_data (s)->this_idx; + break; + case SHT_HASH: case SHT_GNU_versym: /* sh_link is the section header index of the symbol table @@ -2881,7 +3275,6 @@ elf_map_symbols (bfd *abfd) unsigned int idx; asection *asect; asymbol **new_syms; - bfd_size_type amt; #ifdef DEBUG fprintf (stderr, "elf_map_symbols\n"); @@ -2895,8 +3288,7 @@ elf_map_symbols (bfd *abfd) } max_index++; - amt = max_index * sizeof (asymbol *); - sect_syms = bfd_zalloc (abfd, amt); + sect_syms = bfd_zalloc2 (abfd, max_index, sizeof (asymbol *)); if (sect_syms == NULL) return FALSE; elf_section_syms (abfd) = sect_syms; @@ -2969,8 +3361,7 @@ elf_map_symbols (bfd *abfd) } /* Now sort the symbols so the local symbols are first. */ - amt = (num_locals + num_globals) * sizeof (asymbol *); - new_syms = bfd_alloc (abfd, amt); + new_syms = bfd_alloc2 (abfd, num_locals + num_globals, sizeof (asymbol *)); if (new_syms == NULL) return FALSE; @@ -3054,7 +3445,7 @@ _bfd_elf_compute_section_file_positions (bfd *abfd, { const struct elf_backend_data *bed = get_elf_backend_data (abfd); bfd_boolean failed; - struct bfd_strtab_hash *strtab; + struct bfd_strtab_hash *strtab = NULL; Elf_Internal_Shdr *shstrtab_hdr; if (abfd->output_has_begun) @@ -3076,7 +3467,7 @@ _bfd_elf_compute_section_file_positions (bfd *abfd, if (failed) return FALSE; - if (!assign_section_numbers (abfd)) + if (!assign_section_numbers (abfd, link_info)) return FALSE; /* The backend linker builds symbol table information itself. */ @@ -3178,6 +3569,25 @@ make_mapping (bfd *abfd, return m; } +/* Create the PT_DYNAMIC segment, which includes DYNSEC. Returns NULL + on failure. */ + +struct elf_segment_map * +_bfd_elf_make_dynamic_segment (bfd *abfd, asection *dynsec) +{ + struct elf_segment_map *m; + + m = bfd_zalloc (abfd, sizeof (struct elf_segment_map)); + if (m == NULL) + return NULL; + m->next = NULL; + m->p_type = PT_DYNAMIC; + m->count = 1; + m->sections[0] = dynsec; + + return m; +} + /* Set up a mapping from BFD sections to program segments. */ static bfd_boolean @@ -3210,8 +3620,7 @@ map_sections_to_segments (bfd *abfd) /* Select the allocated sections, and sort them. */ - amt = bfd_count_sections (abfd) * sizeof (asection *); - sections = bfd_malloc (amt); + sections = bfd_malloc2 (bfd_count_sections (abfd), sizeof (asection *)); if (sections == NULL) goto error_return; @@ -3370,7 +3779,7 @@ map_sections_to_segments (bfd *abfd) last_hdr = hdr; /* .tbss sections effectively have zero size. */ if ((hdr->flags & (SEC_THREAD_LOCAL | SEC_LOAD)) != SEC_THREAD_LOCAL) - last_size = hdr->_raw_size; + last_size = hdr->size; else last_size = 0; continue; @@ -3394,7 +3803,7 @@ map_sections_to_segments (bfd *abfd) last_hdr = hdr; /* .tbss sections effectively have zero size. */ if ((hdr->flags & (SEC_THREAD_LOCAL | SEC_LOAD)) != SEC_THREAD_LOCAL) - last_size = hdr->_raw_size; + last_size = hdr->size; else last_size = 0; phdr_index = i; @@ -3415,15 +3824,9 @@ map_sections_to_segments (bfd *abfd) /* If there is a .dynamic section, throw in a PT_DYNAMIC segment. */ if (dynsec != NULL) { - amt = sizeof (struct elf_segment_map); - m = bfd_zalloc (abfd, amt); + m = _bfd_elf_make_dynamic_segment (abfd, dynsec); if (m == NULL) goto error_return; - m->next = NULL; - m->p_type = PT_DYNAMIC; - m->count = 1; - m->sections[0] = dynsec; - *pm = m; pm = &m->next; } @@ -3519,6 +3922,21 @@ map_sections_to_segments (bfd *abfd) pm = &m->next; } + if (elf_tdata (abfd)->relro) + { + amt = sizeof (struct elf_segment_map); + m = bfd_zalloc (abfd, amt); + if (m == NULL) + goto error_return; + m->next = NULL; + m->p_type = PT_GNU_RELRO; + m->p_flags = PF_R; + m->p_flags_valid = 1; + + *pm = m; + pm = &m->next; + } + free (sections); sections = NULL; @@ -3578,8 +3996,8 @@ elf_sort_sections (const void *arg1, const void *arg2) /* Sort by size, to put zero sized sections before others at the same address. */ - size1 = (sec1->flags & SEC_LOAD) ? sec1->_raw_size : 0; - size2 = (sec2->flags & SEC_LOAD) ? sec2->_raw_size : 0; + size1 = (sec1->flags & SEC_LOAD) ? sec1->size : 0; + size2 = (sec2->flags & SEC_LOAD) ? sec2->size : 0; if (size1 < size2) return -1; @@ -3618,6 +4036,42 @@ vma_page_aligned_bias (bfd_vma vma, ufile_ptr off, bfd_vma maxpagesize) return ((vma - off) % maxpagesize); } +static void +print_segment_map (bfd *abfd) +{ + struct elf_segment_map *m; + unsigned int i, j; + + fprintf (stderr, _(" Section to Segment mapping:\n")); + fprintf (stderr, _(" Segment Sections...\n")); + + for (i= 0, m = elf_tdata (abfd)->segment_map; + m != NULL; + i++, m = m->next) + { + const char *pt = get_segment_type (m->p_type); + char buf[32]; + + if (pt == NULL) + { + if (m->p_type >= PT_LOPROC && m->p_type <= PT_HIPROC) + sprintf (buf, "LOPROC+%7.7x", + (unsigned int) (m->p_type - PT_LOPROC)); + else if (m->p_type >= PT_LOOS && m->p_type <= PT_HIOS) + sprintf (buf, "LOOS+%7.7x", + (unsigned int) (m->p_type - PT_LOOS)); + else + snprintf (buf, sizeof (buf), "%8.8x", + (unsigned int) m->p_type); + pt = buf; + } + fprintf (stderr, " %2.2d: %14.14s: ", i, pt); + for (j = 0; j < m->count; j++) + fprintf (stderr, "%s ", m->sections [j]->name); + putc ('\n',stderr); + } +} + /* Assign file positions to the sections based on the mapping from sections to segments. This function also sets up some fields in the file header, and writes out the program headers. */ @@ -3634,7 +4088,6 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info) bfd_vma filehdr_vaddr, filehdr_paddr; bfd_vma phdrs_vaddr, phdrs_paddr; Elf_Internal_Phdr *p; - bfd_size_type amt; if (elf_tdata (abfd)->segment_map == NULL) { @@ -3645,7 +4098,8 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info) { /* The placement algorithm assumes that non allocated sections are not in PT_LOAD segments. We ensure this here by removing such - sections from the segment map. */ + sections from the segment map. We also remove excluded + sections. */ for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next) @@ -3653,13 +4107,12 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info) unsigned int new_count; unsigned int i; - if (m->p_type != PT_LOAD) - continue; - new_count = 0; for (i = 0; i < m->count; i ++) { - if ((m->sections[i]->flags & SEC_ALLOC) != 0) + if ((m->sections[i]->flags & SEC_EXCLUDE) == 0 + && ((m->sections[i]->flags & SEC_ALLOC) != 0 + || m->p_type != PT_LOAD)) { if (i != new_count) m->sections[new_count] = m->sections[i]; @@ -3688,7 +4141,10 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info) elf_elfheader (abfd)->e_phnum = count; if (count == 0) - return TRUE; + { + elf_tdata (abfd)->next_file_pos = bed->s->sizeof_ehdr; + return TRUE; + } /* If we already counted the number of program segments, make sure that we allocated enough space. This happens when SIZEOF_HEADERS @@ -3697,8 +4153,9 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info) if (alloc != 0 && count > alloc) { ((*_bfd_error_handler) - (_("%s: Not enough room for program headers (allocated %u, need %u)"), - bfd_get_filename (abfd), alloc, count)); + (_("%B: Not enough room for program headers (allocated %u, need %u)"), + abfd, alloc, count)); + print_segment_map (abfd); bfd_set_error (bfd_error_bad_value); return FALSE; } @@ -3706,8 +4163,7 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info) if (alloc == 0) alloc = count; - amt = alloc * sizeof (Elf_Internal_Phdr); - phdrs = bfd_alloc (abfd, amt); + phdrs = bfd_alloc2 (abfd, alloc, sizeof (Elf_Internal_Phdr)); if (phdrs == NULL) return FALSE; @@ -3737,33 +4193,74 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info) qsort (m->sections, (size_t) m->count, sizeof (asection *), elf_sort_sections); + /* An ELF segment (described by Elf_Internal_Phdr) may contain a + number of sections with contents contributing to both p_filesz + and p_memsz, followed by a number of sections with no contents + that just contribute to p_memsz. In this loop, OFF tracks next + available file offset for PT_LOAD and PT_NOTE segments. VOFF is + an adjustment we use for segments that have no file contents + but need zero filled memory allocation. */ + voff = 0; p->p_type = m->p_type; p->p_flags = m->p_flags; if (p->p_type == PT_LOAD - && m->count > 0 - && (m->sections[0]->flags & SEC_ALLOC) != 0) + && m->count > 0) { - if ((abfd->flags & D_PAGED) != 0) - off += vma_page_aligned_bias (m->sections[0]->vma, off, - bed->maxpagesize); - else + bfd_size_type align; + bfd_vma adjust; + unsigned int align_power = 0; + + for (i = 0, secpp = m->sections; i < m->count; i++, secpp++) { - bfd_size_type align; + unsigned int secalign; - align = 0; - for (i = 0, secpp = m->sections; i < m->count; i++, secpp++) - { - bfd_size_type secalign; - - secalign = bfd_get_section_alignment (abfd, *secpp); - if (secalign > align) - align = secalign; - } - - off += vma_page_aligned_bias (m->sections[0]->vma, off, - 1 << align); + secalign = bfd_get_section_alignment (abfd, *secpp); + if (secalign > align_power) + align_power = secalign; } + align = (bfd_size_type) 1 << align_power; + + if ((abfd->flags & D_PAGED) != 0 && bed->maxpagesize > align) + align = bed->maxpagesize; + + adjust = vma_page_aligned_bias (m->sections[0]->vma, off, align); + off += adjust; + if (adjust != 0 + && !m->includes_filehdr + && !m->includes_phdrs + && (ufile_ptr) off >= align) + { + /* If the first section isn't loadable, the same holds for + any other sections. Since the segment won't need file + space, we can make p_offset overlap some prior segment. + However, .tbss is special. If a segment starts with + .tbss, we need to look at the next section to decide + whether the segment has any loadable sections. */ + i = 0; + while ((m->sections[i]->flags & SEC_LOAD) == 0) + { + if ((m->sections[i]->flags & SEC_THREAD_LOCAL) == 0 + || ++i >= m->count) + { + off -= adjust; + voff = adjust - align; + break; + } + } + } + } + /* Make sure the .dynamic section is the first section in the + PT_DYNAMIC segment. */ + else if (p->p_type == PT_DYNAMIC + && m->count > 1 + && strcmp (m->sections[0]->name, ".dynamic") != 0) + { + _bfd_error_handler + (_("%B: The first section in the PT_DYNAMIC segment is not the .dynamic section"), + abfd); + bfd_set_error (bfd_error_bad_value); + return FALSE; } if (m->count == 0) @@ -3804,8 +4301,8 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info) if (p->p_vaddr < (bfd_vma) off) { (*_bfd_error_handler) - (_("%s: Not enough room for program headers, try linking with -N"), - bfd_get_filename (abfd)); + (_("%B: Not enough room for program headers, try linking with -N"), + abfd); bfd_set_error (bfd_error_bad_value); return FALSE; } @@ -3863,7 +4360,7 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info) || (p->p_type == PT_NOTE && bfd_get_format (abfd) == bfd_core)) { if (! m->includes_filehdr && ! m->includes_phdrs) - p->p_offset = off; + p->p_offset = off + voff; else { file_ptr adjust; @@ -3874,8 +4371,6 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info) } } - voff = off; - for (i = 0, secpp = m->sections; i < m->count; i++, secpp++) { asection *sec; @@ -3886,130 +4381,111 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info) flags = sec->flags; align = 1 << bfd_get_section_alignment (abfd, sec); - /* The section may have artificial alignment forced by a - link script. Notice this case by the gap between the - cumulative phdr lma and the section's lma. */ - if (p->p_paddr + p->p_memsz < sec->lma) - { - bfd_vma adjust = sec->lma - (p->p_paddr + p->p_memsz); - - p->p_memsz += adjust; - if (p->p_type == PT_LOAD - || (p->p_type == PT_NOTE - && bfd_get_format (abfd) == bfd_core)) - { - off += adjust; - voff += adjust; - } - if ((flags & SEC_LOAD) != 0 - || (flags & SEC_THREAD_LOCAL) != 0) - p->p_filesz += adjust; - } - - if (p->p_type == PT_LOAD) + if (p->p_type == PT_LOAD + || p->p_type == PT_TLS) { bfd_signed_vma adjust; if ((flags & SEC_LOAD) != 0) { - adjust = sec->lma - (p->p_paddr + p->p_memsz); + adjust = sec->lma - (p->p_paddr + p->p_filesz); if (adjust < 0) - adjust = 0; + { + (*_bfd_error_handler) + (_("%B: section %A lma 0x%lx overlaps previous sections"), + abfd, sec, (unsigned long) sec->lma); + adjust = 0; + } + off += adjust; + p->p_filesz += adjust; + p->p_memsz += adjust; } - else if ((flags & SEC_ALLOC) != 0) + /* .tbss is special. It doesn't contribute to p_memsz of + normal segments. */ + else if ((flags & SEC_THREAD_LOCAL) == 0 + || p->p_type == PT_TLS) { /* The section VMA must equal the file position - modulo the page size. FIXME: I'm not sure if - this adjustment is really necessary. We used to - not have the SEC_LOAD case just above, and then - this was necessary, but now I'm not sure. */ - if ((abfd->flags & D_PAGED) != 0) - adjust = vma_page_aligned_bias (sec->vma, voff, - bed->maxpagesize); - else - adjust = vma_page_aligned_bias (sec->vma, voff, - align); - } - else - adjust = 0; - - if (adjust != 0) - { - if (i == 0) - { - (* _bfd_error_handler) (_("\ -Error: First section in segment (%s) starts at 0x%x whereas the segment starts at 0x%x"), - bfd_section_name (abfd, sec), - sec->lma, - p->p_paddr); - return FALSE; - } + modulo the page size. */ + bfd_size_type page = align; + if ((abfd->flags & D_PAGED) != 0 && bed->maxpagesize > page) + page = bed->maxpagesize; + adjust = vma_page_aligned_bias (sec->vma, + p->p_vaddr + p->p_memsz, + page); p->p_memsz += adjust; - off += adjust; - voff += adjust; - if ((flags & SEC_LOAD) != 0) - p->p_filesz += adjust; } - - sec->filepos = off; - - /* We check SEC_HAS_CONTENTS here because if NOLOAD is - used in a linker script we may have a section with - SEC_LOAD clear but which is supposed to have - contents. */ - if ((flags & SEC_LOAD) != 0 - || (flags & SEC_HAS_CONTENTS) != 0) - off += sec->_raw_size; - - if ((flags & SEC_ALLOC) != 0 - && ((flags & SEC_LOAD) != 0 - || (flags & SEC_THREAD_LOCAL) == 0)) - voff += sec->_raw_size; } if (p->p_type == PT_NOTE && bfd_get_format (abfd) == bfd_core) { - /* The actual "note" segment has i == 0. - This is the one that actually contains everything. */ + /* The section at i == 0 is the one that actually contains + everything. */ if (i == 0) { sec->filepos = off; - p->p_filesz = sec->_raw_size; - off += sec->_raw_size; - voff = off; + off += sec->size; + p->p_filesz = sec->size; + p->p_memsz = 0; + p->p_align = 1; } else { - /* Fake sections -- don't need to be written. */ + /* The rest are fake sections that shouldn't be written. */ sec->filepos = 0; - sec->_raw_size = 0; - flags = sec->flags = 0; + sec->size = 0; + sec->flags = 0; + continue; } - p->p_memsz = 0; - p->p_align = 1; } else { - if ((sec->flags & SEC_LOAD) != 0 - || (sec->flags & SEC_THREAD_LOCAL) == 0 - || p->p_type == PT_TLS) - p->p_memsz += sec->_raw_size; + if (p->p_type == PT_LOAD) + { + sec->filepos = off; + /* FIXME: The SEC_HAS_CONTENTS test here dates back to + 1997, and the exact reason for it isn't clear. One + plausible explanation is that it is to work around + a problem we have with linker scripts using data + statements in NOLOAD sections. I don't think it + makes a great deal of sense to have such a section + assigned to a PT_LOAD segment, but apparently + people do this. The data statement results in a + bfd_data_link_order being built, and these need + section contents to write into. Eventually, we get + to _bfd_elf_write_object_contents which writes any + section with contents to the output. Make room + here for the write, so that following segments are + not trashed. */ + if ((flags & SEC_LOAD) != 0 + || (flags & SEC_HAS_CONTENTS) != 0) + off += sec->size; + } if ((flags & SEC_LOAD) != 0) - p->p_filesz += sec->_raw_size; + { + p->p_filesz += sec->size; + p->p_memsz += sec->size; + } + /* PR ld/594: Sections in note segments which are not loaded + contribute to the file size but not the in-memory size. */ + else if (p->p_type == PT_NOTE + && (flags & SEC_HAS_CONTENTS) != 0) + p->p_filesz += sec->size; + + /* .tbss is special. It doesn't contribute to p_memsz of + normal segments. */ + else if ((flags & SEC_THREAD_LOCAL) == 0 + || p->p_type == PT_TLS) + p->p_memsz += sec->size; if (p->p_type == PT_TLS - && sec->_raw_size == 0 + && sec->size == 0 && (sec->flags & SEC_HAS_CONTENTS) == 0) { - struct bfd_link_order *o; - bfd_vma tbss_size = 0; - - for (o = sec->link_order_head; o != NULL; o = o->next) - if (tbss_size < o->offset + o->size) - tbss_size = o->offset + o->size; - - p->p_memsz += tbss_size; + struct bfd_link_order *o = sec->map_tail.link_order; + if (o != NULL) + p->p_memsz += o->offset + o->size; } if (align > p->p_align @@ -4037,6 +4513,22 @@ Error: First section in segment (%s) starts at 0x%x whereas the segment starts a if (p->p_type != PT_LOAD && m->count > 0) { BFD_ASSERT (! m->includes_filehdr && ! m->includes_phdrs); + /* If the section has not yet been assigned a file position, + do so now. The ARM BPABI requires that .dynamic section + not be marked SEC_ALLOC because it is not part of any + PT_LOAD segment, so it will not be processed above. */ + if (p->p_type == PT_DYNAMIC && m->sections[0]->filepos == 0) + { + unsigned int i; + Elf_Internal_Shdr ** const i_shdrpp = elf_elfsections (abfd); + + i = 1; + while (i_shdrpp[i]->bfd_section != m->sections[0]) + ++i; + off = (_bfd_elf_assign_file_position_for_section + (i_shdrpp[i], off, TRUE)); + p->p_filesz = m->sections[0]->size; + } p->p_offset = m->sections[0]->filepos; } if (m->count == 0) @@ -4053,6 +4545,37 @@ Error: First section in segment (%s) starts at 0x%x whereas the segment starts a if (! m->p_paddr_valid) p->p_paddr = phdrs_paddr; } + else if (p->p_type == PT_GNU_RELRO) + { + Elf_Internal_Phdr *lp; + + for (lp = phdrs; lp < phdrs + count; ++lp) + { + if (lp->p_type == PT_LOAD + && lp->p_vaddr <= link_info->relro_end + && lp->p_vaddr >= link_info->relro_start + && lp->p_vaddr + lp->p_filesz + >= link_info->relro_end) + break; + } + + if (lp < phdrs + count + && link_info->relro_end > lp->p_vaddr) + { + p->p_vaddr = lp->p_vaddr; + p->p_paddr = lp->p_paddr; + p->p_offset = lp->p_offset; + p->p_filesz = link_info->relro_end - lp->p_vaddr; + p->p_memsz = p->p_filesz; + p->p_align = 1; + p->p_flags = (lp->p_flags & ~PF_W); + } + else + { + memset (p, 0, sizeof *p); + p->p_type = PT_NULL; + } + } } } @@ -4140,6 +4663,12 @@ get_program_header_size (bfd *abfd) ++segs; } + if (elf_tdata (abfd)->relro) + { + /* We need a PT_GNU_RELRO segment. */ + ++segs; + } + for (s = abfd->sections; s != NULL; s = s->next) { if ((s->flags & SEC_LOAD) != 0 @@ -4179,10 +4708,13 @@ get_program_header_size (bfd *abfd) _bfd_elf_compute_section_file_positions. All the section sizes and VMAs must be known before this is called. - We do not consider reloc sections at this point, unless they form - part of the loadable image. Reloc sections are assigned file - positions in assign_file_positions_for_relocs, which is called by - write_object_contents and final_link. + Reloc sections come in two flavours: Those processed specially as + "side-channel" data attached to a section to which they apply, and + those that bfd doesn't process as relocations. The latter sort are + stored in a normal bfd section by bfd_section_from_shdr. We don't + consider the former sort here, unless they form part of the loadable + image. Reloc sections not assigned here will be handled later by + assign_file_positions_for_relocs. We also don't set the positions of the .symtab and .strtab here. */ @@ -4256,8 +4788,8 @@ assign_file_positions_except_relocs (bfd *abfd, else if ((hdr->sh_flags & SHF_ALLOC) != 0) { ((*_bfd_error_handler) - (_("%s: warning: allocated section `%s' not in segment"), - bfd_get_filename (abfd), + (_("%B: warning: allocated section `%s' not in segment"), + abfd, (hdr->bfd_section == NULL ? "*unknown*" : hdr->bfd_section->name))); @@ -4368,18 +4900,8 @@ prep_headers (bfd *abfd) /* If we're building an executable, we'll need a program header table. */ if (abfd->flags & EXEC_P) - { - /* It all happens later. */ -#if 0 - i_ehdrp->e_phentsize = sizeof (Elf_External_Phdr); - - /* elf_build_phdrs() returns a (NULL-terminated) array of - Elf_Internal_Phdrs. */ - i_phdrp = elf_build_phdrs (abfd, i_ehdrp, i_shdrp, &i_ehdrp->e_phnum); - i_ehdrp->e_phoff = outbase; - outbase += i_ehdrp->e_phentsize * i_ehdrp->e_phnum; -#endif - } + /* It all happens later. */ + ; else { i_ehdrp->e_phentsize = 0; @@ -4469,8 +4991,9 @@ _bfd_elf_write_object_contents (bfd *abfd) } /* Write out the section header names. */ - if (bfd_seek (abfd, elf_tdata (abfd)->shstrtab_hdr.sh_offset, SEEK_SET) != 0 - || ! _bfd_elf_strtab_emit (abfd, elf_shstrtab (abfd))) + if (elf_shstrtab (abfd) != NULL + && (bfd_seek (abfd, elf_tdata (abfd)->shstrtab_hdr.sh_offset, SEEK_SET) != 0 + || ! _bfd_elf_strtab_emit (abfd, elf_shstrtab (abfd)))) return FALSE; if (bed->elf_backend_final_write_processing) @@ -4506,19 +5029,7 @@ _bfd_elf_section_from_bfd_section (bfd *abfd, struct bfd_section *asect) else if (bfd_is_und_section (asect)) index = SHN_UNDEF; else - { - Elf_Internal_Shdr **i_shdrp = elf_elfsections (abfd); - int maxindex = elf_numsections (abfd); - - for (index = 1; index < maxindex; index++) - { - Elf_Internal_Shdr *hdr = i_shdrp[index]; - - if (hdr != NULL && hdr->bfd_section == asect) - return index; - } - index = -1; - } + index = -1; bed = get_elf_backend_data (abfd); if (bed->elf_backend_section_from_bfd_section) @@ -4572,8 +5083,8 @@ _bfd_elf_symbol_from_bfd_symbol (bfd *abfd, asymbol **asym_ptr_ptr) /* This case can occur when using --strip-symbol on a symbol which is used in a relocation entry. */ (*_bfd_error_handler) - (_("%s: symbol `%s' required but not present"), - bfd_archive_filename (abfd), bfd_asymbol_name (asym_ptr)); + (_("%B: symbol `%s' required but not present"), + abfd, bfd_asymbol_name (asym_ptr)); bfd_set_error (bfd_error_no_symbols); return -1; } @@ -4591,10 +5102,10 @@ _bfd_elf_symbol_from_bfd_symbol (bfd *abfd, asymbol **asym_ptr_ptr) return idx; } -/* Copy private BFD data. This copies any program header information. */ +/* Rewrite program header information. */ static bfd_boolean -copy_private_bfd_data (bfd *ibfd, bfd *obfd) +rewrite_elf_program_header (bfd *ibfd, bfd *obfd) { Elf_Internal_Ehdr *iehdr; struct elf_segment_map *map; @@ -4610,13 +5121,6 @@ copy_private_bfd_data (bfd *ibfd, bfd *obfd) unsigned int phdr_adjust_num = 0; const struct elf_backend_data *bed; - if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour - || bfd_get_flavour (obfd) != bfd_target_elf_flavour) - return TRUE; - - if (elf_tdata (ibfd)->phdr == NULL) - return TRUE; - bed = get_elf_backend_data (ibfd); iehdr = elf_elfheader (ibfd); @@ -4634,7 +5138,7 @@ copy_private_bfd_data (bfd *ibfd, bfd *obfd) #define SECTION_SIZE(section, segment) \ (((section->flags & (SEC_HAS_CONTENTS | SEC_THREAD_LOCAL)) \ != SEC_THREAD_LOCAL || segment->p_type == PT_TLS) \ - ? section->_raw_size : 0) + ? section->size : 0) /* Returns TRUE if the given section is contained within the given segment. VMA addresses are compared. */ @@ -4656,7 +5160,7 @@ copy_private_bfd_data (bfd *ibfd, bfd *obfd) && bfd_get_format (ibfd) == bfd_core \ && s->vma == 0 && s->lma == 0 \ && (bfd_vma) s->filepos >= p->p_offset \ - && ((bfd_vma) s->filepos + s->_raw_size \ + && ((bfd_vma) s->filepos + s->size \ <= p->p_offset + p->p_filesz)) /* The complicated case when p_vaddr is 0 is to handle the Solaris @@ -4668,9 +5172,9 @@ copy_private_bfd_data (bfd *ibfd, bfd *obfd) && p->p_memsz == 0 \ && p->p_filesz > 0 \ && (s->flags & SEC_HAS_CONTENTS) != 0 \ - && s->_raw_size > 0 \ + && s->size > 0 \ && (bfd_vma) s->filepos >= p->p_offset \ - && ((bfd_vma) s->filepos + s->_raw_size \ + && ((bfd_vma) s->filepos + s->size \ <= p->p_offset + p->p_filesz)) /* Decide if the given section should be included in the given segment. @@ -4682,7 +5186,9 @@ copy_private_bfd_data (bfd *ibfd, bfd *obfd) 4. The section has not already been allocated to a previous segment. 5. PT_GNU_STACK segments do not include any sections. 6. PT_TLS segment includes only SHF_TLS sections. - 7. SHF_TLS sections are only in PT_TLS or PT_LOAD segments. */ + 7. SHF_TLS sections are only in PT_TLS or PT_LOAD segments. + 8. PT_DYNAMIC should not contain empty sections at the beginning + (with the possible exception of .dynamic). */ #define INCLUDE_SECTION_IN_SEGMENT(section, segment, bed) \ ((((segment->p_paddr \ ? IS_CONTAINED_BY_LMA (section, segment, segment->p_paddr) \ @@ -4696,6 +5202,13 @@ copy_private_bfd_data (bfd *ibfd, bfd *obfd) && (segment->p_type == PT_LOAD \ || segment->p_type == PT_TLS \ || (section->flags & SEC_THREAD_LOCAL) == 0) \ + && (segment->p_type != PT_DYNAMIC \ + || SECTION_SIZE (section, segment) > 0 \ + || (segment->p_paddr \ + ? segment->p_paddr != section->lma \ + : segment->p_vaddr != section->vma) \ + || (strcmp (bfd_get_section_name (ibfd, section), ".dynamic") \ + == 0)) \ && ! section->segment_mark) /* Returns TRUE iff seg1 starts after the end of seg2. */ @@ -4860,8 +5373,8 @@ copy_private_bfd_data (bfd *ibfd, bfd *obfd) a warning is produced. */ if (segment->p_type == PT_LOAD) (*_bfd_error_handler) - (_("%s: warning: Empty loadable segment detected, is this intentional ?\n"), - bfd_archive_filename (ibfd)); + (_("%B: warning: Empty loadable segment detected, is this intentional ?\n"), + ibfd); map->count = 0; *pointer_to_map = map; @@ -4900,8 +5413,7 @@ copy_private_bfd_data (bfd *ibfd, bfd *obfd) /* Gcc 2.96 miscompiles this code on mips. Don't do casting here to work around this long long bug. */ - amt = section_count * sizeof (asection *); - sections = bfd_malloc (amt); + sections = bfd_malloc2 (section_count, sizeof (asection *)); if (sections == NULL) return FALSE; @@ -5068,10 +5580,10 @@ copy_private_bfd_data (bfd *ibfd, bfd *obfd) /* If the gap between the end of the previous section and the start of this section is more than maxpagesize then we need to start a new segment. */ - if ((BFD_ALIGN (prev_sec->lma + prev_sec->_raw_size, + if ((BFD_ALIGN (prev_sec->lma + prev_sec->size, maxpagesize) < BFD_ALIGN (output_section->lma, maxpagesize)) - || ((prev_sec->lma + prev_sec->_raw_size) + || ((prev_sec->lma + prev_sec->size) > output_section->lma)) { if (suggested_lma == 0) @@ -5156,31 +5668,6 @@ copy_private_bfd_data (bfd *ibfd, bfd *obfd) -= (count - phdr_adjust_num) * iehdr->e_phentsize; } -#if 0 - /* Final Step: Sort the segments into ascending order of physical - address. */ - if (map_first != NULL) - { - struct elf_segment_map *prev; - - prev = map_first; - for (map = map_first->next; map != NULL; prev = map, map = map->next) - { - /* Yes I know - its a bubble sort.... */ - if (map->next != NULL && (map->next->p_paddr < map->p_paddr)) - { - /* Swap map and map->next. */ - prev->next = map->next; - map->next = map->next->next; - prev->next->next = map; - - /* Restart loop. */ - map = map_first; - } - } - } -#endif - #undef SEGMENT_END #undef SECTION_SIZE #undef IS_CONTAINED_BY_VMA @@ -5193,6 +5680,241 @@ copy_private_bfd_data (bfd *ibfd, bfd *obfd) return TRUE; } +/* Copy ELF program header information. */ + +static bfd_boolean +copy_elf_program_header (bfd *ibfd, bfd *obfd) +{ + Elf_Internal_Ehdr *iehdr; + struct elf_segment_map *map; + struct elf_segment_map *map_first; + struct elf_segment_map **pointer_to_map; + Elf_Internal_Phdr *segment; + unsigned int i; + unsigned int num_segments; + bfd_boolean phdr_included = FALSE; + + iehdr = elf_elfheader (ibfd); + + map_first = NULL; + pointer_to_map = &map_first; + + num_segments = elf_elfheader (ibfd)->e_phnum; + for (i = 0, segment = elf_tdata (ibfd)->phdr; + i < num_segments; + i++, segment++) + { + asection *section; + unsigned int section_count; + bfd_size_type amt; + Elf_Internal_Shdr *this_hdr; + + /* FIXME: Do we need to copy PT_NULL segment? */ + if (segment->p_type == PT_NULL) + continue; + + /* Compute how many sections are in this segment. */ + for (section = ibfd->sections, section_count = 0; + section != NULL; + section = section->next) + { + this_hdr = &(elf_section_data(section)->this_hdr); + if (ELF_IS_SECTION_IN_SEGMENT_FILE (this_hdr, segment)) + section_count++; + } + + /* Allocate a segment map big enough to contain + all of the sections we have selected. */ + amt = sizeof (struct elf_segment_map); + if (section_count != 0) + amt += ((bfd_size_type) section_count - 1) * sizeof (asection *); + map = bfd_alloc (obfd, amt); + if (map == NULL) + return FALSE; + + /* Initialize the fields of the output segment map with the + input segment. */ + map->next = NULL; + map->p_type = segment->p_type; + map->p_flags = segment->p_flags; + map->p_flags_valid = 1; + map->p_paddr = segment->p_paddr; + map->p_paddr_valid = 1; + + /* Determine if this segment contains the ELF file header + and if it contains the program headers themselves. */ + map->includes_filehdr = (segment->p_offset == 0 + && segment->p_filesz >= iehdr->e_ehsize); + + map->includes_phdrs = 0; + if (! phdr_included || segment->p_type != PT_LOAD) + { + map->includes_phdrs = + (segment->p_offset <= (bfd_vma) iehdr->e_phoff + && (segment->p_offset + segment->p_filesz + >= ((bfd_vma) iehdr->e_phoff + + iehdr->e_phnum * iehdr->e_phentsize))); + + if (segment->p_type == PT_LOAD && map->includes_phdrs) + phdr_included = TRUE; + } + + if (section_count != 0) + { + unsigned int isec = 0; + + for (section = ibfd->sections; + section != NULL; + section = section->next) + { + this_hdr = &(elf_section_data(section)->this_hdr); + if (ELF_IS_SECTION_IN_SEGMENT_FILE (this_hdr, segment)) + map->sections[isec++] = section->output_section; + } + } + + map->count = section_count; + *pointer_to_map = map; + pointer_to_map = &map->next; + } + + elf_tdata (obfd)->segment_map = map_first; + return TRUE; +} + +/* Copy private BFD data. This copies or rewrites ELF program header + information. */ + +static bfd_boolean +copy_private_bfd_data (bfd *ibfd, bfd *obfd) +{ + if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour + || bfd_get_flavour (obfd) != bfd_target_elf_flavour) + return TRUE; + + if (elf_tdata (ibfd)->phdr == NULL) + return TRUE; + + if (ibfd->xvec == obfd->xvec) + { + /* Check if any sections in the input BFD covered by ELF program + header are changed. */ + Elf_Internal_Phdr *segment; + asection *section, *osec; + unsigned int i, num_segments; + Elf_Internal_Shdr *this_hdr; + + /* Initialize the segment mark field. */ + for (section = obfd->sections; section != NULL; + section = section->next) + section->segment_mark = FALSE; + + num_segments = elf_elfheader (ibfd)->e_phnum; + for (i = 0, segment = elf_tdata (ibfd)->phdr; + i < num_segments; + i++, segment++) + { + for (section = ibfd->sections; + section != NULL; section = section->next) + { + /* We mark the output section so that we know it comes + from the input BFD. */ + osec = section->output_section; + if (osec) + osec->segment_mark = TRUE; + + /* Check if this section is covered by the segment. */ + this_hdr = &(elf_section_data(section)->this_hdr); + if (ELF_IS_SECTION_IN_SEGMENT_FILE (this_hdr, segment)) + { + /* FIXME: Check if its output section is changed or + removed. What else do we need to check? */ + if (osec == NULL + || section->flags != osec->flags + || section->lma != osec->lma + || section->vma != osec->vma + || section->size != osec->size + || section->rawsize != osec->rawsize + || section->alignment_power != osec->alignment_power) + goto rewrite; + } + } + } + + /* Check to see if any output section doesn't come from the + input BFD. */ + for (section = obfd->sections; section != NULL; + section = section->next) + { + if (section->segment_mark == FALSE) + goto rewrite; + else + section->segment_mark = FALSE; + } + + return copy_elf_program_header (ibfd, obfd); + } + +rewrite: + return rewrite_elf_program_header (ibfd, obfd); +} + +/* Initialize private output section information from input section. */ + +bfd_boolean +_bfd_elf_init_private_section_data (bfd *ibfd, + asection *isec, + bfd *obfd, + asection *osec, + struct bfd_link_info *link_info) + +{ + Elf_Internal_Shdr *ihdr, *ohdr; + bfd_boolean need_group = link_info == NULL || link_info->relocatable; + + if (ibfd->xvec->flavour != bfd_target_elf_flavour + || obfd->xvec->flavour != bfd_target_elf_flavour) + return TRUE; + + /* FIXME: What if the output ELF section type has been set to + something different? */ + if (elf_section_type (osec) == SHT_NULL) + elf_section_type (osec) = elf_section_type (isec); + + /* Set things up for objcopy and relocatable link. The output + SHT_GROUP section will have its elf_next_in_group pointing back + to the input group members. Ignore linker created group section. + See elfNN_ia64_object_p in elfxx-ia64.c. */ + + if (need_group) + { + if (elf_sec_group (isec) == NULL + || (elf_sec_group (isec)->flags & SEC_LINKER_CREATED) == 0) + { + if (elf_section_flags (isec) & SHF_GROUP) + elf_section_flags (osec) |= SHF_GROUP; + elf_next_in_group (osec) = elf_next_in_group (isec); + elf_group_name (osec) = elf_group_name (isec); + } + } + + ihdr = &elf_section_data (isec)->this_hdr; + + /* We need to handle elf_linked_to_section for SHF_LINK_ORDER. We + don't use the output section of the linked-to section since it + may be NULL at this point. */ + if ((ihdr->sh_flags & SHF_LINK_ORDER) != 0) + { + ohdr = &elf_section_data (osec)->this_hdr; + ohdr->sh_flags |= SHF_LINK_ORDER; + elf_linked_to_section (osec) = elf_linked_to_section (isec); + } + + osec->use_rela_p = isec->use_rela_p; + + return TRUE; +} + /* Copy private section information. This copies over the entsize field, and sometimes the info field. */ @@ -5208,24 +5930,6 @@ _bfd_elf_copy_private_section_data (bfd *ibfd, || obfd->xvec->flavour != bfd_target_elf_flavour) return TRUE; - if (elf_tdata (obfd)->segment_map == NULL && elf_tdata (ibfd)->phdr != NULL) - { - asection *s; - - /* Only set up the segments if there are no more SEC_ALLOC - sections. FIXME: This won't do the right thing if objcopy is - used to remove the last SEC_ALLOC section, since objcopy - won't call this routine in that case. */ - for (s = isec->next; s != NULL; s = s->next) - if ((s->flags & SEC_ALLOC) != 0) - break; - if (s == NULL) - { - if (! copy_private_bfd_data (ibfd, obfd)) - return FALSE; - } - } - ihdr = &elf_section_data (isec)->this_hdr; ohdr = &elf_section_data (osec)->this_hdr; @@ -5237,13 +5941,29 @@ _bfd_elf_copy_private_section_data (bfd *ibfd, || ihdr->sh_type == SHT_GNU_verdef) ohdr->sh_info = ihdr->sh_info; - /* Set things up for objcopy. The output SHT_GROUP section will - have its elf_next_in_group pointing back to the input group - members. */ - elf_next_in_group (osec) = elf_next_in_group (isec); - elf_group_name (osec) = elf_group_name (isec); + return _bfd_elf_init_private_section_data (ibfd, isec, obfd, osec, + NULL); +} - osec->use_rela_p = isec->use_rela_p; +/* Copy private header information. */ + +bfd_boolean +_bfd_elf_copy_private_header_data (bfd *ibfd, bfd *obfd) +{ + if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour + || bfd_get_flavour (obfd) != bfd_target_elf_flavour) + return TRUE; + + /* Copy over private BFD data if it has not already been copied. + This must be done here, rather than in the copy_private_bfd_data + entry point, because the latter is called after the section + contents have been set, which means that the program headers have + already been worked out. */ + if (elf_tdata (obfd)->segment_map == NULL && elf_tdata (ibfd)->phdr != NULL) + { + if (! copy_private_bfd_data (ibfd, obfd)) + return FALSE; + } return TRUE; } @@ -5312,8 +6032,8 @@ swap_out_syms (bfd *abfd, Elf_Internal_Shdr *symtab_hdr; Elf_Internal_Shdr *symtab_shndx_hdr; Elf_Internal_Shdr *symstrtab_hdr; - char *outbound_syms; - char *outbound_shndx; + bfd_byte *outbound_syms; + bfd_byte *outbound_shndx; int idx; bfd_size_type amt; bfd_boolean name_local_sections; @@ -5338,8 +6058,7 @@ swap_out_syms (bfd *abfd, symstrtab_hdr = &elf_tdata (abfd)->strtab_hdr; symstrtab_hdr->sh_type = SHT_STRTAB; - amt = (bfd_size_type) (1 + symcount) * bed->s->sizeof_sym; - outbound_syms = bfd_alloc (abfd, amt); + outbound_syms = bfd_alloc2 (abfd, 1 + symcount, bed->s->sizeof_sym); if (outbound_syms == NULL) { _bfd_stringtab_free (stt); @@ -5352,7 +6071,8 @@ swap_out_syms (bfd *abfd, if (symtab_shndx_hdr->sh_name != 0) { amt = (bfd_size_type) (1 + symcount) * sizeof (Elf_External_Sym_Shndx); - outbound_shndx = bfd_zalloc (abfd, amt); + outbound_shndx = bfd_zalloc2 (abfd, 1 + symcount, + sizeof (Elf_External_Sym_Shndx)); if (outbound_shndx == NULL) { _bfd_stringtab_free (stt); @@ -5680,10 +6400,10 @@ _bfd_elf_canonicalize_dynamic_symtab (bfd *abfd, return symcount; } -/* Return the size required for the dynamic reloc entries. Any - section that was actually installed in the BFD, and has type - SHT_REL or SHT_RELA, and uses the dynamic symbol table, is - considered to be a dynamic reloc section. */ +/* Return the size required for the dynamic reloc entries. Any loadable + section that was actually installed in the BFD, and has type SHT_REL + or SHT_RELA, and uses the dynamic symbol table, is considered to be a + dynamic reloc section. */ long _bfd_elf_get_dynamic_reloc_upper_bound (bfd *abfd) @@ -5699,23 +6419,23 @@ _bfd_elf_get_dynamic_reloc_upper_bound (bfd *abfd) ret = sizeof (arelent *); for (s = abfd->sections; s != NULL; s = s->next) - if (elf_section_data (s)->this_hdr.sh_link == elf_dynsymtab (abfd) + if ((s->flags & SEC_LOAD) != 0 + && elf_section_data (s)->this_hdr.sh_link == elf_dynsymtab (abfd) && (elf_section_data (s)->this_hdr.sh_type == SHT_REL || elf_section_data (s)->this_hdr.sh_type == SHT_RELA)) - ret += ((s->_raw_size / elf_section_data (s)->this_hdr.sh_entsize) + ret += ((s->size / elf_section_data (s)->this_hdr.sh_entsize) * sizeof (arelent *)); return ret; } -/* Canonicalize the dynamic relocation entries. Note that we return - the dynamic relocations as a single block, although they are - actually associated with particular sections; the interface, which - was designed for SunOS style shared libraries, expects that there - is only one set of dynamic relocs. Any section that was actually - installed in the BFD, and has type SHT_REL or SHT_RELA, and uses - the dynamic symbol table, is considered to be a dynamic reloc - section. */ +/* Canonicalize the dynamic relocation entries. Note that we return the + dynamic relocations as a single block, although they are actually + associated with particular sections; the interface, which was + designed for SunOS style shared libraries, expects that there is only + one set of dynamic relocs. Any loadable section that was actually + installed in the BFD, and has type SHT_REL or SHT_RELA, and uses the + dynamic symbol table, is considered to be a dynamic reloc section. */ long _bfd_elf_canonicalize_dynamic_reloc (bfd *abfd, @@ -5736,7 +6456,8 @@ _bfd_elf_canonicalize_dynamic_reloc (bfd *abfd, ret = 0; for (s = abfd->sections; s != NULL; s = s->next) { - if (elf_section_data (s)->this_hdr.sh_link == elf_dynsymtab (abfd) + if ((s->flags & SEC_LOAD) != 0 + && elf_section_data (s)->this_hdr.sh_link == elf_dynsymtab (abfd) && (elf_section_data (s)->this_hdr.sh_type == SHT_REL || elf_section_data (s)->this_hdr.sh_type == SHT_RELA)) { @@ -5745,7 +6466,7 @@ _bfd_elf_canonicalize_dynamic_reloc (bfd *abfd, if (! (*slurp_relocs) (abfd, s, syms, TRUE)) return -1; - count = s->_raw_size / elf_section_data (s)->this_hdr.sh_entsize; + count = s->size / elf_section_data (s)->this_hdr.sh_entsize; p = s->relocation; for (i = 0; i < count; i++) *storage++ = p++; @@ -5761,109 +6482,10 @@ _bfd_elf_canonicalize_dynamic_reloc (bfd *abfd, /* Read in the version information. */ bfd_boolean -_bfd_elf_slurp_version_tables (bfd *abfd) +_bfd_elf_slurp_version_tables (bfd *abfd, bfd_boolean default_imported_symver) { bfd_byte *contents = NULL; - bfd_size_type amt; - - if (elf_dynverdef (abfd) != 0) - { - Elf_Internal_Shdr *hdr; - Elf_External_Verdef *everdef; - Elf_Internal_Verdef *iverdef; - Elf_Internal_Verdef *iverdefarr; - Elf_Internal_Verdef iverdefmem; - unsigned int i; - unsigned int maxidx; - - hdr = &elf_tdata (abfd)->dynverdef_hdr; - - contents = bfd_malloc (hdr->sh_size); - if (contents == NULL) - goto error_return; - if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) != 0 - || bfd_bread (contents, hdr->sh_size, abfd) != hdr->sh_size) - goto error_return; - - /* We know the number of entries in the section but not the maximum - index. Therefore we have to run through all entries and find - the maximum. */ - everdef = (Elf_External_Verdef *) contents; - maxidx = 0; - for (i = 0; i < hdr->sh_info; ++i) - { - _bfd_elf_swap_verdef_in (abfd, everdef, &iverdefmem); - - if ((iverdefmem.vd_ndx & ((unsigned) VERSYM_VERSION)) > maxidx) - maxidx = iverdefmem.vd_ndx & ((unsigned) VERSYM_VERSION); - - everdef = ((Elf_External_Verdef *) - ((bfd_byte *) everdef + iverdefmem.vd_next)); - } - - amt = (bfd_size_type) maxidx * sizeof (Elf_Internal_Verdef); - elf_tdata (abfd)->verdef = bfd_zalloc (abfd, amt); - if (elf_tdata (abfd)->verdef == NULL) - goto error_return; - - elf_tdata (abfd)->cverdefs = maxidx; - - everdef = (Elf_External_Verdef *) contents; - iverdefarr = elf_tdata (abfd)->verdef; - for (i = 0; i < hdr->sh_info; i++) - { - Elf_External_Verdaux *everdaux; - Elf_Internal_Verdaux *iverdaux; - unsigned int j; - - _bfd_elf_swap_verdef_in (abfd, everdef, &iverdefmem); - - iverdef = &iverdefarr[(iverdefmem.vd_ndx & VERSYM_VERSION) - 1]; - memcpy (iverdef, &iverdefmem, sizeof (Elf_Internal_Verdef)); - - iverdef->vd_bfd = abfd; - - amt = (bfd_size_type) iverdef->vd_cnt * sizeof (Elf_Internal_Verdaux); - iverdef->vd_auxptr = bfd_alloc (abfd, amt); - if (iverdef->vd_auxptr == NULL) - goto error_return; - - everdaux = ((Elf_External_Verdaux *) - ((bfd_byte *) everdef + iverdef->vd_aux)); - iverdaux = iverdef->vd_auxptr; - for (j = 0; j < iverdef->vd_cnt; j++, iverdaux++) - { - _bfd_elf_swap_verdaux_in (abfd, everdaux, iverdaux); - - iverdaux->vda_nodename = - bfd_elf_string_from_elf_section (abfd, hdr->sh_link, - iverdaux->vda_name); - if (iverdaux->vda_nodename == NULL) - goto error_return; - - if (j + 1 < iverdef->vd_cnt) - iverdaux->vda_nextptr = iverdaux + 1; - else - iverdaux->vda_nextptr = NULL; - - everdaux = ((Elf_External_Verdaux *) - ((bfd_byte *) everdaux + iverdaux->vda_next)); - } - - iverdef->vd_nodename = iverdef->vd_auxptr->vda_nodename; - - if (i + 1 < hdr->sh_info) - iverdef->vd_nextdef = iverdef + 1; - else - iverdef->vd_nextdef = NULL; - - everdef = ((Elf_External_Verdef *) - ((bfd_byte *) everdef + iverdef->vd_next)); - } - - free (contents); - contents = NULL; - } + unsigned int freeidx = 0; if (elf_dynverref (abfd) != 0) { @@ -5871,11 +6493,12 @@ _bfd_elf_slurp_version_tables (bfd *abfd) Elf_External_Verneed *everneed; Elf_Internal_Verneed *iverneed; unsigned int i; + bfd_byte *contents_end; hdr = &elf_tdata (abfd)->dynverref_hdr; - amt = (bfd_size_type) hdr->sh_info * sizeof (Elf_Internal_Verneed); - elf_tdata (abfd)->verref = bfd_zalloc (abfd, amt); + elf_tdata (abfd)->verref = bfd_zalloc2 (abfd, hdr->sh_info, + sizeof (Elf_Internal_Verneed)); if (elf_tdata (abfd)->verref == NULL) goto error_return; @@ -5883,11 +6506,22 @@ _bfd_elf_slurp_version_tables (bfd *abfd) contents = bfd_malloc (hdr->sh_size); if (contents == NULL) - goto error_return; + { +error_return_verref: + elf_tdata (abfd)->verref = NULL; + elf_tdata (abfd)->cverrefs = 0; + goto error_return; + } if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) != 0 || bfd_bread (contents, hdr->sh_size, abfd) != hdr->sh_size) - goto error_return; + goto error_return_verref; + if (hdr->sh_info && hdr->sh_size < sizeof (Elf_External_Verneed)) + goto error_return_verref; + + BFD_ASSERT (sizeof (Elf_External_Verneed) + == sizeof (Elf_External_Vernaux)); + contents_end = contents + hdr->sh_size - sizeof (Elf_External_Verneed); everneed = (Elf_External_Verneed *) contents; iverneed = elf_tdata (abfd)->verref; for (i = 0; i < hdr->sh_info; i++, iverneed++) @@ -5904,11 +6538,21 @@ _bfd_elf_slurp_version_tables (bfd *abfd) bfd_elf_string_from_elf_section (abfd, hdr->sh_link, iverneed->vn_file); if (iverneed->vn_filename == NULL) - goto error_return; + goto error_return_verref; - amt = iverneed->vn_cnt; - amt *= sizeof (Elf_Internal_Vernaux); - iverneed->vn_auxptr = bfd_alloc (abfd, amt); + if (iverneed->vn_cnt == 0) + iverneed->vn_auxptr = NULL; + else + { + iverneed->vn_auxptr = bfd_alloc2 (abfd, iverneed->vn_cnt, + sizeof (Elf_Internal_Vernaux)); + if (iverneed->vn_auxptr == NULL) + goto error_return_verref; + } + + if (iverneed->vn_aux + > (size_t) (contents_end - (bfd_byte *) everneed)) + goto error_return_verref; evernaux = ((Elf_External_Vernaux *) ((bfd_byte *) everneed + iverneed->vn_aux)); @@ -5921,15 +6565,22 @@ _bfd_elf_slurp_version_tables (bfd *abfd) bfd_elf_string_from_elf_section (abfd, hdr->sh_link, ivernaux->vna_name); if (ivernaux->vna_nodename == NULL) - goto error_return; + goto error_return_verref; if (j + 1 < iverneed->vn_cnt) ivernaux->vna_nextptr = ivernaux + 1; else ivernaux->vna_nextptr = NULL; + if (ivernaux->vna_next + > (size_t) (contents_end - (bfd_byte *) evernaux)) + goto error_return_verref; + evernaux = ((Elf_External_Vernaux *) ((bfd_byte *) evernaux + ivernaux->vna_next)); + + if (ivernaux->vna_other > freeidx) + freeidx = ivernaux->vna_other; } if (i + 1 < hdr->sh_info) @@ -5937,6 +6588,10 @@ _bfd_elf_slurp_version_tables (bfd *abfd) else iverneed->vn_nextref = NULL; + if (iverneed->vn_next + > (size_t) (contents_end - (bfd_byte *) everneed)) + goto error_return_verref; + everneed = ((Elf_External_Verneed *) ((bfd_byte *) everneed + iverneed->vn_next)); } @@ -5945,6 +6600,191 @@ _bfd_elf_slurp_version_tables (bfd *abfd) contents = NULL; } + if (elf_dynverdef (abfd) != 0) + { + Elf_Internal_Shdr *hdr; + Elf_External_Verdef *everdef; + Elf_Internal_Verdef *iverdef; + Elf_Internal_Verdef *iverdefarr; + Elf_Internal_Verdef iverdefmem; + unsigned int i; + unsigned int maxidx; + bfd_byte *contents_end_def, *contents_end_aux; + + hdr = &elf_tdata (abfd)->dynverdef_hdr; + + contents = bfd_malloc (hdr->sh_size); + if (contents == NULL) + goto error_return; + if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) != 0 + || bfd_bread (contents, hdr->sh_size, abfd) != hdr->sh_size) + goto error_return; + + if (hdr->sh_info && hdr->sh_size < sizeof (Elf_External_Verdef)) + goto error_return; + + BFD_ASSERT (sizeof (Elf_External_Verdef) + >= sizeof (Elf_External_Verdaux)); + contents_end_def = contents + hdr->sh_size + - sizeof (Elf_External_Verdef); + contents_end_aux = contents + hdr->sh_size + - sizeof (Elf_External_Verdaux); + + /* We know the number of entries in the section but not the maximum + index. Therefore we have to run through all entries and find + the maximum. */ + everdef = (Elf_External_Verdef *) contents; + maxidx = 0; + for (i = 0; i < hdr->sh_info; ++i) + { + _bfd_elf_swap_verdef_in (abfd, everdef, &iverdefmem); + + if ((iverdefmem.vd_ndx & ((unsigned) VERSYM_VERSION)) > maxidx) + maxidx = iverdefmem.vd_ndx & ((unsigned) VERSYM_VERSION); + + if (iverdefmem.vd_next + > (size_t) (contents_end_def - (bfd_byte *) everdef)) + goto error_return; + + everdef = ((Elf_External_Verdef *) + ((bfd_byte *) everdef + iverdefmem.vd_next)); + } + + if (default_imported_symver) + { + if (freeidx > maxidx) + maxidx = ++freeidx; + else + freeidx = ++maxidx; + } + elf_tdata (abfd)->verdef = bfd_zalloc2 (abfd, maxidx, + sizeof (Elf_Internal_Verdef)); + if (elf_tdata (abfd)->verdef == NULL) + goto error_return; + + elf_tdata (abfd)->cverdefs = maxidx; + + everdef = (Elf_External_Verdef *) contents; + iverdefarr = elf_tdata (abfd)->verdef; + for (i = 0; i < hdr->sh_info; i++) + { + Elf_External_Verdaux *everdaux; + Elf_Internal_Verdaux *iverdaux; + unsigned int j; + + _bfd_elf_swap_verdef_in (abfd, everdef, &iverdefmem); + + if ((iverdefmem.vd_ndx & VERSYM_VERSION) == 0) + { +error_return_verdef: + elf_tdata (abfd)->verdef = NULL; + elf_tdata (abfd)->cverdefs = 0; + goto error_return; + } + + iverdef = &iverdefarr[(iverdefmem.vd_ndx & VERSYM_VERSION) - 1]; + memcpy (iverdef, &iverdefmem, sizeof (Elf_Internal_Verdef)); + + iverdef->vd_bfd = abfd; + + if (iverdef->vd_cnt == 0) + iverdef->vd_auxptr = NULL; + else + { + iverdef->vd_auxptr = bfd_alloc2 (abfd, iverdef->vd_cnt, + sizeof (Elf_Internal_Verdaux)); + if (iverdef->vd_auxptr == NULL) + goto error_return_verdef; + } + + if (iverdef->vd_aux + > (size_t) (contents_end_aux - (bfd_byte *) everdef)) + goto error_return_verdef; + + everdaux = ((Elf_External_Verdaux *) + ((bfd_byte *) everdef + iverdef->vd_aux)); + iverdaux = iverdef->vd_auxptr; + for (j = 0; j < iverdef->vd_cnt; j++, iverdaux++) + { + _bfd_elf_swap_verdaux_in (abfd, everdaux, iverdaux); + + iverdaux->vda_nodename = + bfd_elf_string_from_elf_section (abfd, hdr->sh_link, + iverdaux->vda_name); + if (iverdaux->vda_nodename == NULL) + goto error_return_verdef; + + if (j + 1 < iverdef->vd_cnt) + iverdaux->vda_nextptr = iverdaux + 1; + else + iverdaux->vda_nextptr = NULL; + + if (iverdaux->vda_next + > (size_t) (contents_end_aux - (bfd_byte *) everdaux)) + goto error_return_verdef; + + everdaux = ((Elf_External_Verdaux *) + ((bfd_byte *) everdaux + iverdaux->vda_next)); + } + + if (iverdef->vd_cnt) + iverdef->vd_nodename = iverdef->vd_auxptr->vda_nodename; + + if ((size_t) (iverdef - iverdefarr) + 1 < maxidx) + iverdef->vd_nextdef = iverdef + 1; + else + iverdef->vd_nextdef = NULL; + + everdef = ((Elf_External_Verdef *) + ((bfd_byte *) everdef + iverdef->vd_next)); + } + + free (contents); + contents = NULL; + } + else if (default_imported_symver) + { + if (freeidx < 3) + freeidx = 3; + else + freeidx++; + + elf_tdata (abfd)->verdef = bfd_zalloc2 (abfd, freeidx, + sizeof (Elf_Internal_Verdef)); + if (elf_tdata (abfd)->verdef == NULL) + goto error_return; + + elf_tdata (abfd)->cverdefs = freeidx; + } + + /* Create a default version based on the soname. */ + if (default_imported_symver) + { + Elf_Internal_Verdef *iverdef; + Elf_Internal_Verdaux *iverdaux; + + iverdef = &elf_tdata (abfd)->verdef[freeidx - 1];; + + iverdef->vd_version = VER_DEF_CURRENT; + iverdef->vd_flags = 0; + iverdef->vd_ndx = freeidx; + iverdef->vd_cnt = 1; + + iverdef->vd_bfd = abfd; + + iverdef->vd_nodename = bfd_elf_get_dt_soname (abfd); + if (iverdef->vd_nodename == NULL) + goto error_return_verdef; + iverdef->vd_nextdef = NULL; + iverdef->vd_auxptr = bfd_alloc (abfd, sizeof (Elf_Internal_Verdaux)); + if (iverdef->vd_auxptr == NULL) + goto error_return_verdef; + + iverdaux = iverdef->vd_auxptr; + iverdaux->vda_nodename = iverdef->vd_nodename; + iverdaux->vda_nextptr = NULL; + } + return TRUE; error_return: @@ -6041,13 +6881,24 @@ elf_find_function (bfd *abfd ATTRIBUTE_UNUSED, const char **functionname_ptr) { const char *filename; - asymbol *func; + asymbol *func, *file; bfd_vma low_func; asymbol **p; + /* ??? Given multiple file symbols, it is impossible to reliably + choose the right file name for global symbols. File symbols are + local symbols, and thus all file symbols must sort before any + global symbols. The ELF spec may be interpreted to say that a + file symbol must sort before other local symbols, but currently + ld -r doesn't do this. So, for ld -r output, it is possible to + make a better choice of file name for local symbols by ignoring + file symbols appearing after a given local symbol. */ + enum { nothing_seen, symbol_seen, file_after_symbol_seen } state; filename = NULL; func = NULL; + file = NULL; low_func = 0; + state = nothing_seen; for (p = symbols; *p != NULL; p++) { @@ -6055,27 +6906,33 @@ elf_find_function (bfd *abfd ATTRIBUTE_UNUSED, q = (elf_symbol_type *) *p; - if (bfd_get_section (&q->symbol) != section) - continue; - switch (ELF_ST_TYPE (q->internal_elf_sym.st_info)) { default: break; case STT_FILE: - filename = bfd_asymbol_name (&q->symbol); - break; + file = &q->symbol; + if (state == symbol_seen) + state = file_after_symbol_seen; + continue; case STT_NOTYPE: case STT_FUNC: - if (q->symbol.section == section + if (bfd_get_section (&q->symbol) == section && q->symbol.value >= low_func && q->symbol.value <= offset) { func = (asymbol *) q; low_func = q->symbol.value; + filename = NULL; + if (file != NULL + && (ELF_ST_BIND (q->internal_elf_sym.st_info) == STB_LOCAL + || state != file_after_symbol_seen)) + filename = bfd_asymbol_name (file); } break; } + if (state == nothing_seen) + state = symbol_seen; } if (func == NULL) @@ -6147,6 +7004,36 @@ _bfd_elf_find_nearest_line (bfd *abfd, return TRUE; } +/* Find the line for a symbol. */ + +bfd_boolean +_bfd_elf_find_line (bfd *abfd, asymbol **symbols, asymbol *symbol, + const char **filename_ptr, unsigned int *line_ptr) +{ + return _bfd_dwarf2_find_line (abfd, symbols, symbol, + filename_ptr, line_ptr, 0, + &elf_tdata (abfd)->dwarf2_find_line_info); +} + +/* After a call to bfd_find_nearest_line, successive calls to + bfd_find_inliner_info can be used to get source information about + each level of function inlining that terminated at the address + passed to bfd_find_nearest_line. Currently this is only supported + for DWARF2 with appropriate DWARF3 extensions. */ + +bfd_boolean +_bfd_elf_find_inliner_info (bfd *abfd, + const char **filename_ptr, + const char **functionname_ptr, + unsigned int *line_ptr) +{ + bfd_boolean found; + found = _bfd_dwarf2_find_inliner_info (abfd, filename_ptr, + functionname_ptr, line_ptr, + & elf_tdata (abfd)->dwarf2_find_line_info); + return found; +} + int _bfd_elf_sizeof_headers (bfd *abfd, bfd_boolean reloc) { @@ -6279,8 +7166,8 @@ _bfd_elf_validate_reloc (bfd *abfd, arelent *areloc) fail: (*_bfd_error_handler) - (_("%s: unsupported relocation type %s"), - bfd_archive_filename (abfd), areloc->howto->name); + (_("%B: unsupported relocation type %s"), + abfd, areloc->howto->name); bfd_set_error (bfd_error_bad_value); return FALSE; } @@ -6292,6 +7179,7 @@ _bfd_elf_close_and_cleanup (bfd *abfd) { if (elf_shstrtab (abfd) != NULL) _bfd_elf_strtab_free (elf_shstrtab (abfd)); + _bfd_dwarf2_cleanup_debug_info (abfd); } return _bfd_generic_close_and_cleanup (abfd); @@ -6347,7 +7235,7 @@ elfcore_maybe_make_sect (bfd *abfd, char *name, asection *sect) if (sect2 == NULL) return FALSE; - sect2->_raw_size = sect->_raw_size; + sect2->size = sect->size; sect2->filepos = sect->filepos; sect2->flags = sect->flags; sect2->alignment_power = sect->alignment_power; @@ -6384,7 +7272,7 @@ _bfd_elfcore_make_pseudosection (bfd *abfd, sect = bfd_make_section_anyway (abfd, threaded_name); if (sect == NULL) return FALSE; - sect->_raw_size = size; + sect->size = size; sect->filepos = filepos; sect->flags = SEC_HAS_CONTENTS; sect->alignment_power = 2; @@ -6403,14 +7291,14 @@ _bfd_elfcore_make_pseudosection (bfd *abfd, static bfd_boolean elfcore_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) { - size_t raw_size; + size_t size; int offset; if (note->descsz == sizeof (prstatus_t)) { prstatus_t prstat; - raw_size = sizeof (prstat.pr_reg); + size = sizeof (prstat.pr_reg); offset = offsetof (prstatus_t, pr_reg); memcpy (&prstat, note->descdata, sizeof (prstat)); @@ -6436,7 +7324,7 @@ elfcore_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) /* 64-bit host, 32-bit corefile */ prstatus32_t prstat; - raw_size = sizeof (prstat.pr_reg); + size = sizeof (prstat.pr_reg); offset = offsetof (prstatus32_t, pr_reg); memcpy (&prstat, note->descdata, sizeof (prstat)); @@ -6466,7 +7354,7 @@ elfcore_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) /* Make a ".reg/999" section and a ".reg" section. */ return _bfd_elfcore_make_pseudosection (abfd, ".reg", - raw_size, note->descpos + offset); + size, note->descpos + offset); } #endif /* defined (HAVE_PRSTATUS_T) */ @@ -6670,13 +7558,13 @@ elfcore_grok_lwpstatus (bfd *abfd, Elf_Internal_Note *note) return FALSE; #if defined (HAVE_LWPSTATUS_T_PR_CONTEXT) - sect->_raw_size = sizeof (lwpstat.pr_context.uc_mcontext.gregs); + sect->size = sizeof (lwpstat.pr_context.uc_mcontext.gregs); sect->filepos = note->descpos + offsetof (lwpstatus_t, pr_context.uc_mcontext.gregs); #endif #if defined (HAVE_LWPSTATUS_T_PR_REG) - sect->_raw_size = sizeof (lwpstat.pr_reg); + sect->size = sizeof (lwpstat.pr_reg); sect->filepos = note->descpos + offsetof (lwpstatus_t, pr_reg); #endif @@ -6700,13 +7588,13 @@ elfcore_grok_lwpstatus (bfd *abfd, Elf_Internal_Note *note) return FALSE; #if defined (HAVE_LWPSTATUS_T_PR_CONTEXT) - sect->_raw_size = sizeof (lwpstat.pr_context.uc_mcontext.fpregs); + sect->size = sizeof (lwpstat.pr_context.uc_mcontext.fpregs); sect->filepos = note->descpos + offsetof (lwpstatus_t, pr_context.uc_mcontext.fpregs); #endif #if defined (HAVE_LWPSTATUS_T_PR_FPREG) - sect->_raw_size = sizeof (lwpstat.pr_fpreg); + sect->size = sizeof (lwpstat.pr_fpreg); sect->filepos = note->descpos + offsetof (lwpstatus_t, pr_fpreg); #endif @@ -6742,7 +7630,7 @@ elfcore_grok_win32pstatus (bfd *abfd, Elf_Internal_Note *note) case NOTE_INFO_THREAD: /* Make a ".reg/999" section. */ - sprintf (buf, ".reg/%d", pstatus.data.thread_info.tid); + sprintf (buf, ".reg/%ld", (long) pstatus.data.thread_info.tid); len = strlen (buf) + 1; name = bfd_alloc (abfd, len); @@ -6755,7 +7643,7 @@ elfcore_grok_win32pstatus (bfd *abfd, Elf_Internal_Note *note) if (sect == NULL) return FALSE; - sect->_raw_size = sizeof (pstatus.data.thread_info.thread_context); + sect->size = sizeof (pstatus.data.thread_info.thread_context); sect->filepos = (note->descpos + offsetof (struct win32_pstatus, data.thread_info.thread_context)); @@ -6769,7 +7657,8 @@ elfcore_grok_win32pstatus (bfd *abfd, Elf_Internal_Note *note) case NOTE_INFO_MODULE: /* Make a ".module/xxxxxxxx" section. */ - sprintf (buf, ".module/%08x", pstatus.data.module_info.base_address); + sprintf (buf, ".module/%08lx", + (long) pstatus.data.module_info.base_address); len = strlen (buf) + 1; name = bfd_alloc (abfd, len); @@ -6783,7 +7672,7 @@ elfcore_grok_win32pstatus (bfd *abfd, Elf_Internal_Note *note) if (sect == NULL) return FALSE; - sect->_raw_size = note->descsz; + sect->size = note->descsz; sect->filepos = note->descpos; sect->flags = SEC_HAS_CONTENTS; sect->alignment_power = 2; @@ -6859,7 +7748,7 @@ elfcore_grok_note (bfd *abfd, Elf_Internal_Note *note) if (sect == NULL) return FALSE; - sect->_raw_size = note->descsz; + sect->size = note->descsz; sect->filepos = note->descpos; sect->flags = SEC_HAS_CONTENTS; sect->alignment_power = 1 + bfd_get_arch_size (abfd) / 32; @@ -7001,7 +7890,7 @@ elfcore_grok_nto_status (bfd *abfd, Elf_Internal_Note *note, pid_t *tid) elf_tdata (abfd)->core_lwpid = *tid; /* Make a ".qnx_core_status/%d" section. */ - sprintf (buf, ".qnx_core_status/%d", *tid); + sprintf (buf, ".qnx_core_status/%ld", (long) *tid); name = bfd_alloc (abfd, strlen (buf) + 1); if (name == NULL) @@ -7012,7 +7901,7 @@ elfcore_grok_nto_status (bfd *abfd, Elf_Internal_Note *note, pid_t *tid) if (sect == NULL) return FALSE; - sect->_raw_size = note->descsz; + sect->size = note->descsz; sect->filepos = note->descpos; sect->flags = SEC_HAS_CONTENTS; sect->alignment_power = 2; @@ -7021,14 +7910,17 @@ elfcore_grok_nto_status (bfd *abfd, Elf_Internal_Note *note, pid_t *tid) } static bfd_boolean -elfcore_grok_nto_gregs (bfd *abfd, Elf_Internal_Note *note, pid_t tid) +elfcore_grok_nto_regs (bfd *abfd, + Elf_Internal_Note *note, + pid_t tid, + char *base) { char buf[100]; char *name; asection *sect; - /* Make a ".reg/%d" section. */ - sprintf (buf, ".reg/%d", tid); + /* Make a "(base)/%d" section. */ + sprintf (buf, "%s/%ld", base, (long) tid); name = bfd_alloc (abfd, strlen (buf) + 1); if (name == NULL) @@ -7039,14 +7931,14 @@ elfcore_grok_nto_gregs (bfd *abfd, Elf_Internal_Note *note, pid_t tid) if (sect == NULL) return FALSE; - sect->_raw_size = note->descsz; + sect->size = note->descsz; sect->filepos = note->descpos; sect->flags = SEC_HAS_CONTENTS; sect->alignment_power = 2; /* This is the current thread. */ if (elf_tdata (abfd)->core_lwpid == tid) - return elfcore_maybe_make_sect (abfd, ".reg", sect); + return elfcore_maybe_make_sect (abfd, base, sect); return TRUE; } @@ -7066,11 +7958,16 @@ elfcore_grok_nto_note (bfd *abfd, Elf_Internal_Note *note) switch (note->type) { - case BFD_QNT_CORE_INFO: return elfcore_make_note_pseudosection (abfd, ".qnx_core_info", note); - case BFD_QNT_CORE_STATUS: return elfcore_grok_nto_status (abfd, note, &tid); - case BFD_QNT_CORE_GREG: return elfcore_grok_nto_gregs (abfd, note, tid); - case BFD_QNT_CORE_FPREG: return elfcore_grok_prfpreg (abfd, note); - default: return TRUE; + case BFD_QNT_CORE_INFO: + return elfcore_make_note_pseudosection (abfd, ".qnx_core_info", note); + case BFD_QNT_CORE_STATUS: + return elfcore_grok_nto_status (abfd, note, &tid); + case BFD_QNT_CORE_GREG: + return elfcore_grok_nto_regs (abfd, note, tid, ".reg"); + case BFD_QNT_CORE_FPREG: + return elfcore_grok_nto_regs (abfd, note, tid, ".reg2"); + default: + return TRUE; } } @@ -7221,8 +8118,8 @@ elfcore_write_pstatus (bfd *abfd, char *buf, int *bufsiz, long pid, - int cursig, - const void *gregs) + int cursig ATTRIBUTE_UNUSED, + const void *gregs ATTRIBUTE_UNUSED) { pstatus_t pstat; char *note_name = "CORE"; @@ -7450,9 +8347,18 @@ _bfd_elf_rela_local_sym (bfd *abfd, rel->r_addend = _bfd_merged_section_offset (abfd, psec, elf_section_data (sec)->sec_info, - sym->st_value + rel->r_addend, - 0); - sec = *psec; + sym->st_value + rel->r_addend); + if (sec != *psec) + { + /* If we have changed the section, and our original section is + marked with SEC_EXCLUDE, it means that the original + SEC_MERGE section has been completely subsumed in some + other SEC_MERGE section. In this case, we need to leave + some info around for --emit-relocs. */ + if ((sec->flags & SEC_EXCLUDE) != 0) + sec->kept_section = *psec; + sec = *psec; + } rel->r_addend -= relocation; rel->r_addend += sec->output_section->vma + sec->output_offset; } @@ -7472,7 +8378,7 @@ _bfd_elf_rel_local_sym (bfd *abfd, return _bfd_merged_section_offset (abfd, psec, elf_section_data (sec)->sec_info, - sym->st_value + addend, 0); + sym->st_value + addend); } bfd_vma @@ -7481,17 +8387,13 @@ _bfd_elf_section_offset (bfd *abfd, asection *sec, bfd_vma offset) { - struct bfd_elf_section_data *sec_data; - - sec_data = elf_section_data (sec); switch (sec->sec_info_type) { case ELF_INFO_TYPE_STABS: - return _bfd_stab_section_offset (abfd, - &elf_hash_table (info)->merge_info, - sec, &sec_data->sec_info, offset); + return _bfd_stab_section_offset (sec, elf_section_data (sec)->sec_info, + offset); case ELF_INFO_TYPE_EH_FRAME: - return _bfd_elf_eh_frame_section_offset (abfd, sec, offset); + return _bfd_elf_eh_frame_section_offset (abfd, info, sec, offset); default: return offset; } @@ -7515,8 +8417,330 @@ bfd_elf_bfd_from_remote_memory (bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep, - int (*target_read_memory) (bfd_vma, char *, int)) + int (*target_read_memory) (bfd_vma, bfd_byte *, int)) { return (*get_elf_backend_data (templ)->elf_backend_bfd_from_remote_memory) (templ, ehdr_vma, loadbasep, target_read_memory); } + +long +_bfd_elf_get_synthetic_symtab (bfd *abfd, + long symcount ATTRIBUTE_UNUSED, + asymbol **syms ATTRIBUTE_UNUSED, + long dynsymcount, + asymbol **dynsyms, + asymbol **ret) +{ + const struct elf_backend_data *bed = get_elf_backend_data (abfd); + asection *relplt; + asymbol *s; + const char *relplt_name; + bfd_boolean (*slurp_relocs) (bfd *, asection *, asymbol **, bfd_boolean); + arelent *p; + long count, i, n; + size_t size; + Elf_Internal_Shdr *hdr; + char *names; + asection *plt; + + *ret = NULL; + + if ((abfd->flags & (DYNAMIC | EXEC_P)) == 0) + return 0; + + if (dynsymcount <= 0) + return 0; + + if (!bed->plt_sym_val) + return 0; + + relplt_name = bed->relplt_name; + if (relplt_name == NULL) + relplt_name = bed->default_use_rela_p ? ".rela.plt" : ".rel.plt"; + relplt = bfd_get_section_by_name (abfd, relplt_name); + if (relplt == NULL) + return 0; + + hdr = &elf_section_data (relplt)->this_hdr; + if (hdr->sh_link != elf_dynsymtab (abfd) + || (hdr->sh_type != SHT_REL && hdr->sh_type != SHT_RELA)) + return 0; + + plt = bfd_get_section_by_name (abfd, ".plt"); + if (plt == NULL) + return 0; + + slurp_relocs = get_elf_backend_data (abfd)->s->slurp_reloc_table; + if (! (*slurp_relocs) (abfd, relplt, dynsyms, TRUE)) + return -1; + + count = relplt->size / hdr->sh_entsize; + size = count * sizeof (asymbol); + p = relplt->relocation; + for (i = 0; i < count; i++, s++, p++) + size += strlen ((*p->sym_ptr_ptr)->name) + sizeof ("@plt"); + + s = *ret = bfd_malloc (size); + if (s == NULL) + return -1; + + names = (char *) (s + count); + p = relplt->relocation; + n = 0; + for (i = 0; i < count; i++, s++, p++) + { + size_t len; + bfd_vma addr; + + addr = bed->plt_sym_val (i, plt, p); + if (addr == (bfd_vma) -1) + continue; + + *s = **p->sym_ptr_ptr; + /* Undefined syms won't have BSF_LOCAL or BSF_GLOBAL set. Since + we are defining a symbol, ensure one of them is set. */ + if ((s->flags & BSF_LOCAL) == 0) + s->flags |= BSF_GLOBAL; + s->section = plt; + s->value = addr - plt->vma; + s->name = names; + len = strlen ((*p->sym_ptr_ptr)->name); + memcpy (names, (*p->sym_ptr_ptr)->name, len); + names += len; + memcpy (names, "@plt", sizeof ("@plt")); + names += sizeof ("@plt"); + ++n; + } + + return n; +} + +/* Sort symbol by binding and section. We want to put definitions + sorted by section at the beginning. */ + +static int +elf_sort_elf_symbol (const void *arg1, const void *arg2) +{ + const Elf_Internal_Sym *s1; + const Elf_Internal_Sym *s2; + int shndx; + + /* Make sure that undefined symbols are at the end. */ + s1 = (const Elf_Internal_Sym *) arg1; + if (s1->st_shndx == SHN_UNDEF) + return 1; + s2 = (const Elf_Internal_Sym *) arg2; + if (s2->st_shndx == SHN_UNDEF) + return -1; + + /* Sorted by section index. */ + shndx = s1->st_shndx - s2->st_shndx; + if (shndx != 0) + return shndx; + + /* Sorted by binding. */ + return ELF_ST_BIND (s1->st_info) - ELF_ST_BIND (s2->st_info); +} + +struct elf_symbol +{ + Elf_Internal_Sym *sym; + const char *name; +}; + +static int +elf_sym_name_compare (const void *arg1, const void *arg2) +{ + const struct elf_symbol *s1 = (const struct elf_symbol *) arg1; + const struct elf_symbol *s2 = (const struct elf_symbol *) arg2; + return strcmp (s1->name, s2->name); +} + +/* Check if 2 sections define the same set of local and global + symbols. */ + +bfd_boolean +bfd_elf_match_symbols_in_sections (asection *sec1, asection *sec2) +{ + bfd *bfd1, *bfd2; + const struct elf_backend_data *bed1, *bed2; + Elf_Internal_Shdr *hdr1, *hdr2; + bfd_size_type symcount1, symcount2; + Elf_Internal_Sym *isymbuf1, *isymbuf2; + Elf_Internal_Sym *isymstart1 = NULL, *isymstart2 = NULL, *isym; + Elf_Internal_Sym *isymend; + struct elf_symbol *symp, *symtable1 = NULL, *symtable2 = NULL; + bfd_size_type count1, count2, i; + int shndx1, shndx2; + bfd_boolean result; + + bfd1 = sec1->owner; + bfd2 = sec2->owner; + + /* If both are .gnu.linkonce sections, they have to have the same + section name. */ + if (strncmp (sec1->name, ".gnu.linkonce", + sizeof ".gnu.linkonce" - 1) == 0 + && strncmp (sec2->name, ".gnu.linkonce", + sizeof ".gnu.linkonce" - 1) == 0) + return strcmp (sec1->name + sizeof ".gnu.linkonce", + sec2->name + sizeof ".gnu.linkonce") == 0; + + /* Both sections have to be in ELF. */ + if (bfd_get_flavour (bfd1) != bfd_target_elf_flavour + || bfd_get_flavour (bfd2) != bfd_target_elf_flavour) + return FALSE; + + if (elf_section_type (sec1) != elf_section_type (sec2)) + return FALSE; + + if ((elf_section_flags (sec1) & SHF_GROUP) != 0 + && (elf_section_flags (sec2) & SHF_GROUP) != 0) + { + /* If both are members of section groups, they have to have the + same group name. */ + if (strcmp (elf_group_name (sec1), elf_group_name (sec2)) != 0) + return FALSE; + } + + shndx1 = _bfd_elf_section_from_bfd_section (bfd1, sec1); + shndx2 = _bfd_elf_section_from_bfd_section (bfd2, sec2); + if (shndx1 == -1 || shndx2 == -1) + return FALSE; + + bed1 = get_elf_backend_data (bfd1); + bed2 = get_elf_backend_data (bfd2); + hdr1 = &elf_tdata (bfd1)->symtab_hdr; + symcount1 = hdr1->sh_size / bed1->s->sizeof_sym; + hdr2 = &elf_tdata (bfd2)->symtab_hdr; + symcount2 = hdr2->sh_size / bed2->s->sizeof_sym; + + if (symcount1 == 0 || symcount2 == 0) + return FALSE; + + isymbuf1 = bfd_elf_get_elf_syms (bfd1, hdr1, symcount1, 0, + NULL, NULL, NULL); + isymbuf2 = bfd_elf_get_elf_syms (bfd2, hdr2, symcount2, 0, + NULL, NULL, NULL); + + result = FALSE; + if (isymbuf1 == NULL || isymbuf2 == NULL) + goto done; + + /* Sort symbols by binding and section. Global definitions are at + the beginning. */ + qsort (isymbuf1, symcount1, sizeof (Elf_Internal_Sym), + elf_sort_elf_symbol); + qsort (isymbuf2, symcount2, sizeof (Elf_Internal_Sym), + elf_sort_elf_symbol); + + /* Count definitions in the section. */ + count1 = 0; + for (isym = isymbuf1, isymend = isym + symcount1; + isym < isymend; isym++) + { + if (isym->st_shndx == (unsigned int) shndx1) + { + if (count1 == 0) + isymstart1 = isym; + count1++; + } + + if (count1 && isym->st_shndx != (unsigned int) shndx1) + break; + } + + count2 = 0; + for (isym = isymbuf2, isymend = isym + symcount2; + isym < isymend; isym++) + { + if (isym->st_shndx == (unsigned int) shndx2) + { + if (count2 == 0) + isymstart2 = isym; + count2++; + } + + if (count2 && isym->st_shndx != (unsigned int) shndx2) + break; + } + + if (count1 == 0 || count2 == 0 || count1 != count2) + goto done; + + symtable1 = bfd_malloc (count1 * sizeof (struct elf_symbol)); + symtable2 = bfd_malloc (count1 * sizeof (struct elf_symbol)); + + if (symtable1 == NULL || symtable2 == NULL) + goto done; + + symp = symtable1; + for (isym = isymstart1, isymend = isym + count1; + isym < isymend; isym++) + { + symp->sym = isym; + symp->name = bfd_elf_string_from_elf_section (bfd1, + hdr1->sh_link, + isym->st_name); + symp++; + } + + symp = symtable2; + for (isym = isymstart2, isymend = isym + count1; + isym < isymend; isym++) + { + symp->sym = isym; + symp->name = bfd_elf_string_from_elf_section (bfd2, + hdr2->sh_link, + isym->st_name); + symp++; + } + + /* Sort symbol by name. */ + qsort (symtable1, count1, sizeof (struct elf_symbol), + elf_sym_name_compare); + qsort (symtable2, count1, sizeof (struct elf_symbol), + elf_sym_name_compare); + + for (i = 0; i < count1; i++) + /* Two symbols must have the same binding, type and name. */ + if (symtable1 [i].sym->st_info != symtable2 [i].sym->st_info + || symtable1 [i].sym->st_other != symtable2 [i].sym->st_other + || strcmp (symtable1 [i].name, symtable2 [i].name) != 0) + goto done; + + result = TRUE; + +done: + if (symtable1) + free (symtable1); + if (symtable2) + free (symtable2); + if (isymbuf1) + free (isymbuf1); + if (isymbuf2) + free (isymbuf2); + + return result; +} + +/* It is only used by x86-64 so far. */ +asection _bfd_elf_large_com_section + = BFD_FAKE_SECTION (_bfd_elf_large_com_section, + SEC_IS_COMMON, NULL, NULL, "LARGE_COMMON", + 0); + +/* Return TRUE if 2 section types are compatible. */ + +bfd_boolean +_bfd_elf_match_sections_by_type (bfd *abfd, const asection *asec, + bfd *bbfd, const asection *bsec) +{ + if (asec == NULL + || bsec == NULL + || abfd->xvec->flavour != bfd_target_elf_flavour + || bbfd->xvec->flavour != bfd_target_elf_flavour) + return TRUE; + + return elf_section_type (asec) == elf_section_type (bsec); +} diff --git a/contrib/binutils/bfd/elf32-arc.c b/contrib/binutils/bfd/elf32-arc.c index 27c163981a0..a6011bdb32d 100644 --- a/contrib/binutils/bfd/elf32-arc.c +++ b/contrib/binutils/bfd/elf32-arc.c @@ -1,5 +1,5 @@ /* ARC-specific support for 32-bit ELF - Copyright 1994, 1995, 1997, 1999, 2001, 2002 + Copyright 1994, 1995, 1997, 1999, 2001, 2002, 2005 Free Software Foundation, Inc. Contributed by Doug Evans (dje@cygnus.com). @@ -17,7 +17,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, + MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" @@ -26,83 +27,94 @@ #include "elf/arc.h" #include "libiberty.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 *, Elf_Internal_Rela *)); -static bfd_boolean arc_elf_object_p - PARAMS ((bfd *)); -static void arc_elf_final_write_processing - PARAMS ((bfd *, bfd_boolean)); -static bfd_reloc_status_type arc_elf_b22_pcrel - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); - /* 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 1 +static bfd_reloc_status_type +arc_elf_b22_pcrel (bfd * abfd, + arelent * reloc_entry, + asymbol * symbol, + void * data, + asection * input_section, + bfd * output_bfd, + char ** error_message) +{ + /* If linking, back up the final symbol address by the address of the + reloc. This cannot be accomplished by setting the pcrel_offset + field to TRUE, as bfd_install_relocation will detect this and refuse + to install the offset in the first place, but bfd_perform_relocation + will still insist on removing it. */ + if (output_bfd == NULL) + reloc_entry->addend -= reloc_entry->address; + + /* Fall through to the default elf reloc handler. */ + return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message); +} + 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 */ - TRUE, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - FALSE), /* pcrel_offset */ + 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. */ + TRUE, /* 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 */ - TRUE, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - FALSE), /* pcrel_offset */ + 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. */ + TRUE, /* 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 */ - TRUE, /* partial_inplace */ - 0x00ffffff, /* src_mask */ - 0x00ffffff, /* dst_mask */ - FALSE), /* pcrel_offset */ + 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. */ + TRUE, /* 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 */ - arc_elf_b22_pcrel, /* special_function */ - "R_ARC_B22_PCREL", /* name */ - TRUE, /* partial_inplace */ - 0x07ffff80, /* src_mask */ - 0x07ffff80, /* dst_mask */ - FALSE), /* pcrel_offset */ + 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. */ + arc_elf_b22_pcrel, /* Special_function. */ + "R_ARC_B22_PCREL", /* Name. */ + TRUE, /* Partial_inplace. */ + 0x07ffff80, /* Src_mask. */ + 0x07ffff80, /* Dst_mask. */ + FALSE), /* PCrel_offset. */ }; /* Map BFD reloc types to ARC ELF reloc types. */ @@ -123,9 +135,8 @@ static const struct arc_reloc_map arc_reloc_map[] = }; static reloc_howto_type * -bfd_elf32_bfd_reloc_type_lookup (abfd, code) - bfd *abfd ATTRIBUTE_UNUSED; - bfd_reloc_code_real_type code; +bfd_elf32_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, + bfd_reloc_code_real_type code) { unsigned int i; @@ -139,10 +150,9 @@ bfd_elf32_bfd_reloc_type_lookup (abfd, code) /* 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; - Elf_Internal_Rela *dst; +arc_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED, + arelent *cache_ptr, + Elf_Internal_Rela *dst) { unsigned int r_type; @@ -154,8 +164,7 @@ arc_info_to_howto_rel (abfd, cache_ptr, dst) /* Set the right machine number for an ARC ELF file. */ static bfd_boolean -arc_elf_object_p (abfd) - bfd *abfd; +arc_elf_object_p (bfd *abfd) { unsigned int mach = bfd_mach_arc_6; @@ -187,9 +196,8 @@ arc_elf_object_p (abfd) This gets the ARC architecture right based on the machine number. */ static void -arc_elf_final_write_processing (abfd, linker) - bfd *abfd; - bfd_boolean linker ATTRIBUTE_UNUSED; +arc_elf_final_write_processing (bfd *abfd, + bfd_boolean linker ATTRIBUTE_UNUSED) { unsigned long val; @@ -213,41 +221,17 @@ arc_elf_final_write_processing (abfd, linker) elf_elfheader (abfd)->e_flags |= val; } -bfd_reloc_status_type -arc_elf_b22_pcrel (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 linking, back up the final symbol address by the address of the - reloc. This cannot be accomplished by setting the pcrel_offset - field to TRUE, as bfd_install_relocation will detect this and refuse - to install the offset in the first place, but bfd_perform_relocation - will still insist on removing it. */ - if (output_bfd == (bfd *) NULL) - reloc_entry->addend -= reloc_entry->address; +#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_ARC +#define ELF_MAXPAGESIZE 0x1000 - /* Fall through to the default elf reloc handler. */ - return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, - input_section, output_bfd, error_message); -} - -#define TARGET_LITTLE_SYM bfd_elf32_littlearc_vec -#define TARGET_LITTLE_NAME "elf32-littlearc" -#define TARGET_BIG_SYM bfd_elf32_bigarc_vec -#define TARGET_BIG_NAME "elf32-bigarc" -#define ELF_ARCH bfd_arch_arc -#define ELF_MACHINE_CODE EM_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 +#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-arm.c b/contrib/binutils/bfd/elf32-arm.c new file mode 100644 index 00000000000..4c65de1663a --- /dev/null +++ b/contrib/binutils/bfd/elf32-arm.c @@ -0,0 +1,8376 @@ +/* 32-bit ELF support for ARM + Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libiberty.h" +#include "libbfd.h" +#include "elf-bfd.h" +#include "elf-vxworks.h" +#include "elf/arm.h" + +#ifndef NUM_ELEM +#define NUM_ELEM(a) (sizeof (a) / (sizeof (a)[0])) +#endif + +/* Return the relocation section associated with NAME. HTAB is the + bfd's elf32_arm_link_hash_entry. */ +#define RELOC_SECTION(HTAB, NAME) \ + ((HTAB)->use_rel ? ".rel" NAME : ".rela" NAME) + +/* Return size of a relocation entry. HTAB is the bfd's + elf32_arm_link_hash_entry. */ +#define RELOC_SIZE(HTAB) \ + ((HTAB)->use_rel \ + ? sizeof (Elf32_External_Rel) \ + : sizeof (Elf32_External_Rela)) + +/* Return function to swap relocations in. HTAB is the bfd's + elf32_arm_link_hash_entry. */ +#define SWAP_RELOC_IN(HTAB) \ + ((HTAB)->use_rel \ + ? bfd_elf32_swap_reloc_in \ + : bfd_elf32_swap_reloca_in) + +/* Return function to swap relocations out. HTAB is the bfd's + elf32_arm_link_hash_entry. */ +#define SWAP_RELOC_OUT(HTAB) \ + ((HTAB)->use_rel \ + ? bfd_elf32_swap_reloc_out \ + : bfd_elf32_swap_reloca_out) + +#define elf_info_to_howto 0 +#define elf_info_to_howto_rel elf32_arm_info_to_howto + +#define ARM_ELF_ABI_VERSION 0 +#ifdef __FreeBSD__ +#define ARM_ELF_OS_ABI_VERSION ELFOSABI_FREEBSD +#else +#define ARM_ELF_OS_ABI_VERSION ELFOSABI_ARM +#endif + +static const struct elf_backend_data elf32_arm_vxworks_bed; + +/* Note: code such as elf32_arm_reloc_type_lookup expect to use e.g. + R_ARM_PC24 as an index into this, and find the R_ARM_PC24 HOWTO + in that slot. */ + +static reloc_howto_type elf32_arm_howto_table_1[] = +{ + /* No relocation */ + HOWTO (R_ARM_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_ARM_NONE", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_ARM_PC24, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 24, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_PC24", /* name */ + FALSE, /* partial_inplace */ + 0x00ffffff, /* src_mask */ + 0x00ffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* 32 bit absolute */ + HOWTO (R_ARM_ABS32, /* 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_ARM_ABS32", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* standard 32bit pc-relative reloc */ + HOWTO (R_ARM_REL32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_REL32", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* 8 bit absolute - R_ARM_LDR_PC_G0 in AAELF */ + HOWTO (R_ARM_PC13, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_PC13", /* name */ + FALSE, /* partial_inplace */ + 0x000000ff, /* src_mask */ + 0x000000ff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 16 bit absolute */ + HOWTO (R_ARM_ABS16, /* 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_ARM_ABS16", /* name */ + FALSE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 12 bit absolute */ + HOWTO (R_ARM_ABS12, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 12, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_ABS12", /* name */ + FALSE, /* partial_inplace */ + 0x00000fff, /* src_mask */ + 0x00000fff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_ARM_THM_ABS5, /* type */ + 6, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 5, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_THM_ABS5", /* name */ + FALSE, /* partial_inplace */ + 0x000007e0, /* src_mask */ + 0x000007e0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* 8 bit absolute */ + HOWTO (R_ARM_ABS8, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_ABS8", /* name */ + FALSE, /* partial_inplace */ + 0x000000ff, /* src_mask */ + 0x000000ff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_ARM_SBREL32, /* 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_ARM_SBREL32", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* FIXME: Has two more bits of offset in Thumb32. */ + HOWTO (R_ARM_THM_CALL, /* type */ + 1, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 23, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_THM_CALL", /* name */ + FALSE, /* partial_inplace */ + 0x07ff07ff, /* src_mask */ + 0x07ff07ff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_ARM_THM_PC8, /* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_THM_PC8", /* name */ + FALSE, /* partial_inplace */ + 0x000000ff, /* src_mask */ + 0x000000ff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_ARM_BREL_ADJ, /* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_BREL_ADJ", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_ARM_SWI24, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_SWI24", /* name */ + FALSE, /* partial_inplace */ + 0x00000000, /* src_mask */ + 0x00000000, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_ARM_THM_SWI8, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_SWI8", /* name */ + FALSE, /* partial_inplace */ + 0x00000000, /* src_mask */ + 0x00000000, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* BLX instruction for the ARM. */ + HOWTO (R_ARM_XPC25, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 25, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_XPC25", /* name */ + FALSE, /* partial_inplace */ + 0x00ffffff, /* src_mask */ + 0x00ffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* BLX instruction for the Thumb. */ + HOWTO (R_ARM_THM_XPC22, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 22, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_THM_XPC22", /* name */ + FALSE, /* partial_inplace */ + 0x07ff07ff, /* src_mask */ + 0x07ff07ff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* Dynamic TLS relocations. */ + + HOWTO (R_ARM_TLS_DTPMOD32, /* 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_ARM_TLS_DTPMOD32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_ARM_TLS_DTPOFF32, /* 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_ARM_TLS_DTPOFF32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_ARM_TLS_TPOFF32, /* 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_ARM_TLS_TPOFF32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* Relocs used in ARM Linux */ + + HOWTO (R_ARM_COPY, /* 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_ARM_COPY", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_ARM_GLOB_DAT, /* 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_ARM_GLOB_DAT", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_ARM_JUMP_SLOT, /* 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_ARM_JUMP_SLOT", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_ARM_RELATIVE, /* 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_ARM_RELATIVE", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_ARM_GOTOFF32, /* 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_ARM_GOTOFF32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_ARM_GOTPC, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_GOTPC", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_ARM_GOT32, /* 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_ARM_GOT32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_ARM_PLT32, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 24, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_PLT32", /* name */ + FALSE, /* partial_inplace */ + 0x00ffffff, /* src_mask */ + 0x00ffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_ARM_CALL, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 24, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_CALL", /* name */ + FALSE, /* partial_inplace */ + 0x00ffffff, /* src_mask */ + 0x00ffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_ARM_JUMP24, /* type */ + 2, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 24, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_JUMP24", /* name */ + FALSE, /* partial_inplace */ + 0x00ffffff, /* src_mask */ + 0x00ffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_ARM_THM_JUMP24, /* type */ + 1, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 24, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_THM_JUMP24", /* name */ + FALSE, /* partial_inplace */ + 0x07ff2fff, /* src_mask */ + 0x07ff2fff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_ARM_BASE_ABS, /* 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_ARM_BASE_ABS", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_ARM_ALU_PCREL7_0, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 12, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_ALU_PCREL_7_0", /* name */ + FALSE, /* partial_inplace */ + 0x00000fff, /* src_mask */ + 0x00000fff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_ARM_ALU_PCREL15_8, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 12, /* bitsize */ + TRUE, /* pc_relative */ + 8, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_ALU_PCREL_15_8",/* name */ + FALSE, /* partial_inplace */ + 0x00000fff, /* src_mask */ + 0x00000fff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_ARM_ALU_PCREL23_15, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 12, /* bitsize */ + TRUE, /* pc_relative */ + 16, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_ALU_PCREL_23_15",/* name */ + FALSE, /* partial_inplace */ + 0x00000fff, /* src_mask */ + 0x00000fff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_ARM_LDR_SBREL_11_0, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 12, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_LDR_SBREL_11_0",/* name */ + FALSE, /* partial_inplace */ + 0x00000fff, /* src_mask */ + 0x00000fff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_ARM_ALU_SBREL_19_12, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 12, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_ALU_SBREL_19_12",/* name */ + FALSE, /* partial_inplace */ + 0x000ff000, /* src_mask */ + 0x000ff000, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_ARM_ALU_SBREL_27_20, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 20, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_ALU_SBREL_27_20",/* name */ + FALSE, /* partial_inplace */ + 0x0ff00000, /* src_mask */ + 0x0ff00000, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_ARM_TARGET1, /* 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_ARM_TARGET1", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_ARM_ROSEGREL32, /* 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_ARM_ROSEGREL32", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_ARM_V4BX, /* 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_ARM_V4BX", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_ARM_TARGET2, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_TARGET2", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_ARM_PREL31, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 31, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_PREL31", /* name */ + FALSE, /* partial_inplace */ + 0x7fffffff, /* src_mask */ + 0x7fffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_ARM_MOVW_ABS_NC, /* 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_ARM_MOVW_ABS_NC", /* name */ + FALSE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_ARM_MOVT_ABS, /* 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_ARM_MOVT_ABS", /* name */ + FALSE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_ARM_MOVW_PREL_NC, /* 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_elf_generic_reloc, /* special_function */ + "R_ARM_MOVW_PREL_NC", /* name */ + FALSE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_ARM_MOVT_PREL, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_MOVT_PREL", /* name */ + FALSE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_ARM_THM_MOVW_ABS_NC, /* 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_ARM_THM_MOVW_ABS_NC",/* name */ + FALSE, /* partial_inplace */ + 0x040f70ff, /* src_mask */ + 0x040f70ff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_ARM_THM_MOVT_ABS, /* 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_ARM_THM_MOVT_ABS", /* name */ + FALSE, /* partial_inplace */ + 0x040f70ff, /* src_mask */ + 0x040f70ff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_ARM_THM_MOVW_PREL_NC,/* 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_elf_generic_reloc, /* special_function */ + "R_ARM_THM_MOVW_PREL_NC",/* name */ + FALSE, /* partial_inplace */ + 0x040f70ff, /* src_mask */ + 0x040f70ff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_ARM_THM_MOVT_PREL, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_THM_MOVT_PREL", /* name */ + FALSE, /* partial_inplace */ + 0x040f70ff, /* src_mask */ + 0x040f70ff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_ARM_THM_JUMP19, /* type */ + 1, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 19, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_THM_JUMP19", /* name */ + FALSE, /* partial_inplace */ + 0x043f2fff, /* src_mask */ + 0x043f2fff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_ARM_THM_JUMP6, /* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 6, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_unsigned,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_THM_JUMP6", /* name */ + FALSE, /* partial_inplace */ + 0x02f8, /* src_mask */ + 0x02f8, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* These are declared as 13-bit signed relocations because we can + address -4095 .. 4095(base) by altering ADDW to SUBW or vice + versa. */ + HOWTO (R_ARM_THM_ALU_PREL_11_0,/* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 13, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_THM_ALU_PREL_11_0",/* name */ + FALSE, /* partial_inplace */ + 0x040070ff, /* src_mask */ + 0x040070ff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_ARM_THM_PC12, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 13, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_THM_PC12", /* name */ + FALSE, /* partial_inplace */ + 0x040070ff, /* src_mask */ + 0x040070ff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_ARM_ABS32_NOI, /* 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_ARM_ABS32_NOI", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_ARM_REL32_NOI, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_REL32_NOI", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ +}; + +/* Relocations 57 .. 83 are the "group relocations" which we do not + support. */ + +static reloc_howto_type elf32_arm_howto_table_2[] = +{ + HOWTO (R_ARM_MOVW_BREL_NC, /* 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_ARM_MOVW_BREL_NC", /* name */ + FALSE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_ARM_MOVT_BREL, /* 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_ARM_MOVT_BREL", /* name */ + FALSE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_ARM_MOVW_BREL, /* 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_ARM_MOVW_BREL", /* name */ + FALSE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_ARM_THM_MOVW_BREL_NC,/* 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_ARM_THM_MOVW_BREL_NC",/* name */ + FALSE, /* partial_inplace */ + 0x040f70ff, /* src_mask */ + 0x040f70ff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_ARM_THM_MOVT_BREL, /* 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_ARM_THM_MOVT_BREL", /* name */ + FALSE, /* partial_inplace */ + 0x040f70ff, /* src_mask */ + 0x040f70ff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_ARM_THM_MOVW_BREL, /* 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_ARM_THM_MOVW_BREL", /* name */ + FALSE, /* partial_inplace */ + 0x040f70ff, /* src_mask */ + 0x040f70ff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + EMPTY_HOWTO (90), /* unallocated */ + EMPTY_HOWTO (91), + EMPTY_HOWTO (92), + EMPTY_HOWTO (93), + + HOWTO (R_ARM_PLT32_ABS, /* 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_ARM_PLT32_ABS", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_ARM_GOT_ABS, /* 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_ARM_GOT_ABS", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_ARM_GOT_PREL, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_GOT_PREL", /* name */ + FALSE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_ARM_GOT_BREL12, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 12, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_GOT_BREL12", /* name */ + FALSE, /* partial_inplace */ + 0x00000fff, /* src_mask */ + 0x00000fff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_ARM_GOTOFF12, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 12, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_GOTOFF12", /* name */ + FALSE, /* partial_inplace */ + 0x00000fff, /* src_mask */ + 0x00000fff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + EMPTY_HOWTO (R_ARM_GOTRELAX), /* reserved for future GOT-load optimizations */ + + /* GNU extension to record C++ vtable member usage */ + HOWTO (R_ARM_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_ARM_GNU_VTENTRY", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* GNU extension to record C++ vtable hierarchy */ + HOWTO (R_ARM_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_ARM_GNU_VTINHERIT", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_ARM_THM_JUMP11, /* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 11, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_THM_JUMP11", /* name */ + FALSE, /* partial_inplace */ + 0x000007ff, /* src_mask */ + 0x000007ff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + HOWTO (R_ARM_THM_JUMP8, /* type */ + 1, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_THM_JUMP8", /* name */ + FALSE, /* partial_inplace */ + 0x000000ff, /* src_mask */ + 0x000000ff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* TLS relocations */ + HOWTO (R_ARM_TLS_GD32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield,/* complain_on_overflow */ + NULL, /* special_function */ + "R_ARM_TLS_GD32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_ARM_TLS_LDM32, /* 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_ARM_TLS_LDM32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_ARM_TLS_LDO32, /* 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_ARM_TLS_LDO32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_ARM_TLS_IE32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield,/* complain_on_overflow */ + NULL, /* special_function */ + "R_ARM_TLS_IE32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_ARM_TLS_LE32, /* 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_ARM_TLS_LE32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_ARM_TLS_LDO12, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 12, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_TLS_LDO12", /* name */ + FALSE, /* partial_inplace */ + 0x00000fff, /* src_mask */ + 0x00000fff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_ARM_TLS_LE12, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 12, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_TLS_LE12", /* name */ + FALSE, /* partial_inplace */ + 0x00000fff, /* src_mask */ + 0x00000fff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_ARM_TLS_IE12GP, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 12, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_ARM_TLS_IE12GP", /* name */ + FALSE, /* partial_inplace */ + 0x00000fff, /* src_mask */ + 0x00000fff, /* dst_mask */ + FALSE), /* pcrel_offset */ +}; + +/* 112-127 private relocations + 128 R_ARM_ME_TOO, obsolete + 129-255 unallocated in AAELF. + + 249-255 extended, currently unused, relocations: */ + +static reloc_howto_type elf32_arm_howto_table_3[4] = +{ + HOWTO (R_ARM_RREL32, /* 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_ARM_RREL32", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_ARM_RABS32, /* 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_ARM_RABS32", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_ARM_RPC24, /* 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_ARM_RPC24", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_ARM_RBASE, /* 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_ARM_RBASE", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + FALSE) /* pcrel_offset */ +}; + +static reloc_howto_type * +elf32_arm_howto_from_type (unsigned int r_type) +{ + if (r_type < NUM_ELEM (elf32_arm_howto_table_1)) + return &elf32_arm_howto_table_1[r_type]; + + if (r_type >= R_ARM_MOVW_BREL_NC + && r_type < R_ARM_MOVW_BREL_NC + NUM_ELEM (elf32_arm_howto_table_2)) + return &elf32_arm_howto_table_2[r_type - R_ARM_MOVW_BREL_NC]; + + if (r_type >= R_ARM_RREL32 + && r_type < R_ARM_RREL32 + NUM_ELEM (elf32_arm_howto_table_2)) + return &elf32_arm_howto_table_3[r_type - R_ARM_RREL32]; + + return NULL; +} + +static void +elf32_arm_info_to_howto (bfd * abfd ATTRIBUTE_UNUSED, arelent * bfd_reloc, + Elf_Internal_Rela * elf_reloc) +{ + unsigned int r_type; + + r_type = ELF32_R_TYPE (elf_reloc->r_info); + bfd_reloc->howto = elf32_arm_howto_from_type (r_type); +} + +struct elf32_arm_reloc_map + { + bfd_reloc_code_real_type bfd_reloc_val; + unsigned char elf_reloc_val; + }; + +/* All entries in this list must also be present in elf32_arm_howto_table. */ +static const struct elf32_arm_reloc_map elf32_arm_reloc_map[] = + { + {BFD_RELOC_NONE, R_ARM_NONE}, + {BFD_RELOC_ARM_PCREL_BRANCH, R_ARM_PC24}, + {BFD_RELOC_ARM_PCREL_CALL, R_ARM_CALL}, + {BFD_RELOC_ARM_PCREL_JUMP, R_ARM_JUMP24}, + {BFD_RELOC_ARM_PCREL_BLX, R_ARM_XPC25}, + {BFD_RELOC_THUMB_PCREL_BLX, R_ARM_THM_XPC22}, + {BFD_RELOC_32, R_ARM_ABS32}, + {BFD_RELOC_32_PCREL, R_ARM_REL32}, + {BFD_RELOC_8, R_ARM_ABS8}, + {BFD_RELOC_16, R_ARM_ABS16}, + {BFD_RELOC_ARM_OFFSET_IMM, R_ARM_ABS12}, + {BFD_RELOC_ARM_THUMB_OFFSET, R_ARM_THM_ABS5}, + {BFD_RELOC_THUMB_PCREL_BRANCH25, R_ARM_THM_JUMP24}, + {BFD_RELOC_THUMB_PCREL_BRANCH23, R_ARM_THM_CALL}, + {BFD_RELOC_THUMB_PCREL_BRANCH12, R_ARM_THM_JUMP11}, + {BFD_RELOC_THUMB_PCREL_BRANCH20, R_ARM_THM_JUMP19}, + {BFD_RELOC_THUMB_PCREL_BRANCH9, R_ARM_THM_JUMP8}, + {BFD_RELOC_THUMB_PCREL_BRANCH7, R_ARM_THM_JUMP6}, + {BFD_RELOC_ARM_GLOB_DAT, R_ARM_GLOB_DAT}, + {BFD_RELOC_ARM_JUMP_SLOT, R_ARM_JUMP_SLOT}, + {BFD_RELOC_ARM_RELATIVE, R_ARM_RELATIVE}, + {BFD_RELOC_ARM_GOTOFF, R_ARM_GOTOFF32}, + {BFD_RELOC_ARM_GOTPC, R_ARM_GOTPC}, + {BFD_RELOC_ARM_GOT32, R_ARM_GOT32}, + {BFD_RELOC_ARM_PLT32, R_ARM_PLT32}, + {BFD_RELOC_ARM_TARGET1, R_ARM_TARGET1}, + {BFD_RELOC_ARM_ROSEGREL32, R_ARM_ROSEGREL32}, + {BFD_RELOC_ARM_SBREL32, R_ARM_SBREL32}, + {BFD_RELOC_ARM_PREL31, R_ARM_PREL31}, + {BFD_RELOC_ARM_TARGET2, R_ARM_TARGET2}, + {BFD_RELOC_ARM_PLT32, R_ARM_PLT32}, + {BFD_RELOC_ARM_TLS_GD32, R_ARM_TLS_GD32}, + {BFD_RELOC_ARM_TLS_LDO32, R_ARM_TLS_LDO32}, + {BFD_RELOC_ARM_TLS_LDM32, R_ARM_TLS_LDM32}, + {BFD_RELOC_ARM_TLS_DTPMOD32, R_ARM_TLS_DTPMOD32}, + {BFD_RELOC_ARM_TLS_DTPOFF32, R_ARM_TLS_DTPOFF32}, + {BFD_RELOC_ARM_TLS_TPOFF32, R_ARM_TLS_TPOFF32}, + {BFD_RELOC_ARM_TLS_IE32, R_ARM_TLS_IE32}, + {BFD_RELOC_ARM_TLS_LE32, R_ARM_TLS_LE32}, + {BFD_RELOC_VTABLE_INHERIT, R_ARM_GNU_VTINHERIT}, + {BFD_RELOC_VTABLE_ENTRY, R_ARM_GNU_VTENTRY}, + }; + +static reloc_howto_type * +elf32_arm_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, + bfd_reloc_code_real_type code) +{ + unsigned int i; + for (i = 0; i < NUM_ELEM (elf32_arm_reloc_map); i ++) + if (elf32_arm_reloc_map[i].bfd_reloc_val == code) + return elf32_arm_howto_from_type (elf32_arm_reloc_map[i].elf_reloc_val); + + return NULL; +} + +/* Support for core dump NOTE sections */ +static bfd_boolean +elf32_arm_nabi_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) +{ + int offset; + size_t size; + + switch (note->descsz) + { + default: + return FALSE; + + case 148: /* Linux/ARM 32-bit*/ + /* pr_cursig */ + elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12); + + /* pr_pid */ + elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24); + + /* pr_reg */ + offset = 72; + size = 72; + + break; + + case 96: /* FreeBSD/ARM */ + /* pr_cursig */ + if (elf_tdata(abfd)->core_signal == 0) + elf_tdata (abfd)->core_signal = ((int *)(note->descdata))[5]; + + /* pr_pid */ + elf_tdata (abfd)->core_pid = ((int *)(note->descdata))[6]; + + /* pr_reg */ + offset = 28; + size = 68; + break; + } + + /* Make a ".reg/999" section. */ + return _bfd_elfcore_make_pseudosection (abfd, ".reg", + size, note->descpos + offset); +} + +static bfd_boolean +elf32_arm_nabi_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) +{ + switch (note->descsz) + { + default: + return FALSE; + + case 124: /* Linux/ARM elf_prpsinfo */ + elf_tdata (abfd)->core_program + = _bfd_elfcore_strndup (abfd, note->descdata + 28, 16); + elf_tdata (abfd)->core_command + = _bfd_elfcore_strndup (abfd, note->descdata + 44, 80); + } + + /* Note that for some reason, a spurious space is tacked + onto the end of the args in some (at least one anyway) + implementations, so strip it off if it exists. */ + + { + char *command = elf_tdata (abfd)->core_command; + int n = strlen (command); + + if (0 < n && command[n - 1] == ' ') + command[n - 1] = '\0'; + } + + return TRUE; +} + +#define TARGET_LITTLE_SYM bfd_elf32_littlearm_vec +#define TARGET_LITTLE_NAME "elf32-littlearm" +#define TARGET_BIG_SYM bfd_elf32_bigarm_vec +#define TARGET_BIG_NAME "elf32-bigarm" + +#define elf_backend_grok_prstatus elf32_arm_nabi_grok_prstatus +#define elf_backend_grok_psinfo elf32_arm_nabi_grok_psinfo + +typedef unsigned long int insn32; +typedef unsigned short int insn16; + +/* In lieu of proper flags, assume all EABIv4 or later objects are + interworkable. */ +#define INTERWORK_FLAG(abfd) \ + (EF_ARM_EABI_VERSION (elf_elfheader (abfd)->e_flags) >= EF_ARM_EABI_VER4 \ + || (elf_elfheader (abfd)->e_flags & EF_ARM_INTERWORK)) + +/* The linker script knows the section names for placement. + The entry_names are used to do simple name mangling on the stubs. + Given a function name, and its type, the stub can be found. The + name can be changed. The only requirement is the %s be present. */ +#define THUMB2ARM_GLUE_SECTION_NAME ".glue_7t" +#define THUMB2ARM_GLUE_ENTRY_NAME "__%s_from_thumb" + +#define ARM2THUMB_GLUE_SECTION_NAME ".glue_7" +#define ARM2THUMB_GLUE_ENTRY_NAME "__%s_from_arm" + +/* The name of the dynamic interpreter. This is put in the .interp + section. */ +#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1" + +#ifdef FOUR_WORD_PLT + +/* The first entry in a procedure linkage table looks like + this. It is set up so that any shared library function that is + called before the relocation has been set up calls the dynamic + linker first. */ +static const bfd_vma elf32_arm_plt0_entry [] = + { + 0xe52de004, /* str lr, [sp, #-4]! */ + 0xe59fe010, /* ldr lr, [pc, #16] */ + 0xe08fe00e, /* add lr, pc, lr */ + 0xe5bef008, /* ldr pc, [lr, #8]! */ + }; + +/* Subsequent entries in a procedure linkage table look like + this. */ +static const bfd_vma elf32_arm_plt_entry [] = + { + 0xe28fc600, /* add ip, pc, #NN */ + 0xe28cca00, /* add ip, ip, #NN */ + 0xe5bcf000, /* ldr pc, [ip, #NN]! */ + 0x00000000, /* unused */ + }; + +#else + +/* The first entry in a procedure linkage table looks like + this. It is set up so that any shared library function that is + called before the relocation has been set up calls the dynamic + linker first. */ +static const bfd_vma elf32_arm_plt0_entry [] = + { + 0xe52de004, /* str lr, [sp, #-4]! */ + 0xe59fe004, /* ldr lr, [pc, #4] */ + 0xe08fe00e, /* add lr, pc, lr */ + 0xe5bef008, /* ldr pc, [lr, #8]! */ + 0x00000000, /* &GOT[0] - . */ + }; + +/* Subsequent entries in a procedure linkage table look like + this. */ +static const bfd_vma elf32_arm_plt_entry [] = + { + 0xe28fc600, /* add ip, pc, #0xNN00000 */ + 0xe28cca00, /* add ip, ip, #0xNN000 */ + 0xe5bcf000, /* ldr pc, [ip, #0xNNN]! */ + }; + +#endif + +/* The format of the first entry in the procedure linkage table + for a VxWorks executable. */ +static const bfd_vma elf32_arm_vxworks_exec_plt0_entry[] = + { + 0xe52dc008, /* str ip,[sp,#-8]! */ + 0xe59fc000, /* ldr ip,[pc] */ + 0xe59cf008, /* ldr pc,[ip,#8] */ + 0x00000000, /* .long _GLOBAL_OFFSET_TABLE_ */ + }; + +/* The format of subsequent entries in a VxWorks executable. */ +static const bfd_vma elf32_arm_vxworks_exec_plt_entry[] = + { + 0xe59fc000, /* ldr ip,[pc] */ + 0xe59cf000, /* ldr pc,[ip] */ + 0x00000000, /* .long @got */ + 0xe59fc000, /* ldr ip,[pc] */ + 0xea000000, /* b _PLT */ + 0x00000000, /* .long @pltindex*sizeof(Elf32_Rela) */ + }; + +/* The format of entries in a VxWorks shared library. */ +static const bfd_vma elf32_arm_vxworks_shared_plt_entry[] = + { + 0xe59fc000, /* ldr ip,[pc] */ + 0xe79cf009, /* ldr pc,[ip,r9] */ + 0x00000000, /* .long @got */ + 0xe59fc000, /* ldr ip,[pc] */ + 0xe599f008, /* ldr pc,[r9,#8] */ + 0x00000000, /* .long @pltindex*sizeof(Elf32_Rela) */ + }; + +/* An initial stub used if the PLT entry is referenced from Thumb code. */ +#define PLT_THUMB_STUB_SIZE 4 +static const bfd_vma elf32_arm_plt_thumb_stub [] = + { + 0x4778, /* bx pc */ + 0x46c0 /* nop */ + }; + +/* The entries in a PLT when using a DLL-based target with multiple + address spaces. */ +static const bfd_vma elf32_arm_symbian_plt_entry [] = + { + 0xe51ff004, /* ldr pc, [pc, #-4] */ + 0x00000000, /* dcd R_ARM_GLOB_DAT(X) */ + }; + +/* Used to build a map of a section. This is required for mixed-endian + code/data. */ + +typedef struct elf32_elf_section_map +{ + bfd_vma vma; + char type; +} +elf32_arm_section_map; + +typedef struct _arm_elf_section_data +{ + struct bfd_elf_section_data elf; + unsigned int mapcount; + elf32_arm_section_map *map; +} +_arm_elf_section_data; + +#define elf32_arm_section_data(sec) \ + ((_arm_elf_section_data *) elf_section_data (sec)) + +/* The size of the thread control block. */ +#define TCB_SIZE 8 + +#define NUM_KNOWN_ATTRIBUTES 32 + +typedef struct aeabi_attribute +{ + int type; + unsigned int i; + char *s; +} aeabi_attribute; + +typedef struct aeabi_attribute_list +{ + struct aeabi_attribute_list *next; + int tag; + aeabi_attribute attr; +} aeabi_attribute_list; + +struct elf32_arm_obj_tdata +{ + struct elf_obj_tdata root; + + /* tls_type for each local got entry. */ + char *local_got_tls_type; + + aeabi_attribute known_eabi_attributes[NUM_KNOWN_ATTRIBUTES]; + aeabi_attribute_list *other_eabi_attributes; +}; + +#define elf32_arm_tdata(abfd) \ + ((struct elf32_arm_obj_tdata *) (abfd)->tdata.any) + +#define elf32_arm_local_got_tls_type(abfd) \ + (elf32_arm_tdata (abfd)->local_got_tls_type) + +static bfd_boolean +elf32_arm_mkobject (bfd *abfd) +{ + bfd_size_type amt = sizeof (struct elf32_arm_obj_tdata); + abfd->tdata.any = bfd_zalloc (abfd, amt); + if (abfd->tdata.any == NULL) + return FALSE; + return TRUE; +} + +/* The ARM linker needs to keep track of the number of relocs that it + decides to copy in check_relocs for each symbol. This is so that + it can discard PC relative relocs if it doesn't need them when + linking with -Bsymbolic. We store the information in a field + extending the regular ELF linker hash table. */ + +/* This structure keeps track of the number of relocs we have copied + for a given symbol. */ +struct elf32_arm_relocs_copied + { + /* Next section. */ + struct elf32_arm_relocs_copied * next; + /* A section in dynobj. */ + asection * section; + /* Number of relocs copied in this section. */ + bfd_size_type count; + /* Number of PC-relative relocs copied in this section. */ + bfd_size_type pc_count; + }; + +#define elf32_arm_hash_entry(ent) ((struct elf32_arm_link_hash_entry *)(ent)) + +/* Arm ELF linker hash entry. */ +struct elf32_arm_link_hash_entry + { + struct elf_link_hash_entry root; + + /* Number of PC relative relocs copied for this symbol. */ + struct elf32_arm_relocs_copied * relocs_copied; + + /* We reference count Thumb references to a PLT entry separately, + so that we can emit the Thumb trampoline only if needed. */ + bfd_signed_vma plt_thumb_refcount; + + /* Since PLT entries have variable size if the Thumb prologue is + used, we need to record the index into .got.plt instead of + recomputing it from the PLT offset. */ + bfd_signed_vma plt_got_offset; + +#define GOT_UNKNOWN 0 +#define GOT_NORMAL 1 +#define GOT_TLS_GD 2 +#define GOT_TLS_IE 4 + unsigned char tls_type; + }; + +/* Traverse an arm ELF linker hash table. */ +#define elf32_arm_link_hash_traverse(table, func, info) \ + (elf_link_hash_traverse \ + (&(table)->root, \ + (bfd_boolean (*) (struct elf_link_hash_entry *, void *)) (func), \ + (info))) + +/* Get the ARM elf linker hash table from a link_info structure. */ +#define elf32_arm_hash_table(info) \ + ((struct elf32_arm_link_hash_table *) ((info)->hash)) + +/* ARM ELF linker hash table. */ +struct elf32_arm_link_hash_table + { + /* The main hash table. */ + struct elf_link_hash_table root; + + /* The size in bytes of the section containing the Thumb-to-ARM glue. */ + bfd_size_type thumb_glue_size; + + /* The size in bytes of the section containing the ARM-to-Thumb glue. */ + bfd_size_type arm_glue_size; + + /* An arbitrary input BFD chosen to hold the glue sections. */ + bfd * bfd_of_glue_owner; + + /* Nonzero to output a BE8 image. */ + int byteswap_code; + + /* Zero if R_ARM_TARGET1 means R_ARM_ABS32. + Nonzero if R_ARM_TARGET1 means R_ARM_ABS32. */ + int target1_is_rel; + + /* The relocation to use for R_ARM_TARGET2 relocations. */ + int target2_reloc; + + /* Nonzero to fix BX instructions for ARMv4 targets. */ + int fix_v4bx; + + /* Nonzero if the ARM/Thumb BLX instructions are available for use. */ + int use_blx; + + /* The number of bytes in the initial entry in the PLT. */ + bfd_size_type plt_header_size; + + /* The number of bytes in the subsequent PLT etries. */ + bfd_size_type plt_entry_size; + + /* True if the target system is VxWorks. */ + int vxworks_p; + + /* True if the target system is Symbian OS. */ + int symbian_p; + + /* True if the target uses REL relocations. */ + int use_rel; + + /* Short-cuts to get to dynamic linker sections. */ + asection *sgot; + asection *sgotplt; + asection *srelgot; + asection *splt; + asection *srelplt; + asection *sdynbss; + asection *srelbss; + + /* The (unloaded but important) VxWorks .rela.plt.unloaded section. */ + asection *srelplt2; + + /* Data for R_ARM_TLS_LDM32 relocations. */ + union { + bfd_signed_vma refcount; + bfd_vma offset; + } tls_ldm_got; + + /* Small local sym to section mapping cache. */ + struct sym_sec_cache sym_sec; + + /* For convenience in allocate_dynrelocs. */ + bfd * obfd; + }; + +/* Create an entry in an ARM ELF linker hash table. */ + +static struct bfd_hash_entry * +elf32_arm_link_hash_newfunc (struct bfd_hash_entry * entry, + struct bfd_hash_table * table, + const char * string) +{ + struct elf32_arm_link_hash_entry * ret = + (struct elf32_arm_link_hash_entry *) entry; + + /* Allocate the structure if it has not already been allocated by a + subclass. */ + if (ret == (struct elf32_arm_link_hash_entry *) NULL) + ret = bfd_hash_allocate (table, sizeof (struct elf32_arm_link_hash_entry)); + if (ret == NULL) + return (struct bfd_hash_entry *) ret; + + /* Call the allocation method of the superclass. */ + ret = ((struct elf32_arm_link_hash_entry *) + _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret, + table, string)); + if (ret != NULL) + { + ret->relocs_copied = NULL; + ret->tls_type = GOT_UNKNOWN; + ret->plt_thumb_refcount = 0; + ret->plt_got_offset = -1; + } + + return (struct bfd_hash_entry *) ret; +} + +/* Return true if NAME is the name of the relocation section associated + with S. */ + +static bfd_boolean +reloc_section_p (struct elf32_arm_link_hash_table *htab, + const char *name, asection *s) +{ + if (htab->use_rel) + return strncmp (name, ".rel", 4) == 0 && strcmp (s->name, name + 4) == 0; + else + return strncmp (name, ".rela", 5) == 0 && strcmp (s->name, name + 5) == 0; +} + +/* Create .got, .gotplt, and .rel(a).got sections in DYNOBJ, and set up + shortcuts to them in our hash table. */ + +static bfd_boolean +create_got_section (bfd *dynobj, struct bfd_link_info *info) +{ + struct elf32_arm_link_hash_table *htab; + + htab = elf32_arm_hash_table (info); + /* BPABI objects never have a GOT, or associated sections. */ + if (htab->symbian_p) + return TRUE; + + if (! _bfd_elf_create_got_section (dynobj, info)) + return FALSE; + + htab->sgot = bfd_get_section_by_name (dynobj, ".got"); + htab->sgotplt = bfd_get_section_by_name (dynobj, ".got.plt"); + if (!htab->sgot || !htab->sgotplt) + abort (); + + htab->srelgot = bfd_make_section_with_flags (dynobj, + RELOC_SECTION (htab, ".got"), + (SEC_ALLOC | SEC_LOAD + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_LINKER_CREATED + | SEC_READONLY)); + if (htab->srelgot == NULL + || ! bfd_set_section_alignment (dynobj, htab->srelgot, 2)) + return FALSE; + return TRUE; +} + +/* Create .plt, .rel(a).plt, .got, .got.plt, .rel(a).got, .dynbss, and + .rel(a).bss sections in DYNOBJ, and set up shortcuts to them in our + hash table. */ + +static bfd_boolean +elf32_arm_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info) +{ + struct elf32_arm_link_hash_table *htab; + + htab = elf32_arm_hash_table (info); + if (!htab->sgot && !create_got_section (dynobj, info)) + return FALSE; + + if (!_bfd_elf_create_dynamic_sections (dynobj, info)) + return FALSE; + + htab->splt = bfd_get_section_by_name (dynobj, ".plt"); + htab->srelplt = bfd_get_section_by_name (dynobj, + RELOC_SECTION (htab, ".plt")); + htab->sdynbss = bfd_get_section_by_name (dynobj, ".dynbss"); + if (!info->shared) + htab->srelbss = bfd_get_section_by_name (dynobj, + RELOC_SECTION (htab, ".bss")); + + if (htab->vxworks_p) + { + if (!elf_vxworks_create_dynamic_sections (dynobj, info, &htab->srelplt2)) + return FALSE; + + if (info->shared) + { + htab->plt_header_size = 0; + htab->plt_entry_size + = 4 * ARRAY_SIZE (elf32_arm_vxworks_shared_plt_entry); + } + else + { + htab->plt_header_size + = 4 * ARRAY_SIZE (elf32_arm_vxworks_exec_plt0_entry); + htab->plt_entry_size + = 4 * ARRAY_SIZE (elf32_arm_vxworks_exec_plt_entry); + } + } + + if (!htab->splt + || !htab->srelplt + || !htab->sdynbss + || (!info->shared && !htab->srelbss)) + abort (); + + return TRUE; +} + +/* Copy the extra info we tack onto an elf_link_hash_entry. */ + +static void +elf32_arm_copy_indirect_symbol (struct bfd_link_info *info, + struct elf_link_hash_entry *dir, + struct elf_link_hash_entry *ind) +{ + struct elf32_arm_link_hash_entry *edir, *eind; + + edir = (struct elf32_arm_link_hash_entry *) dir; + eind = (struct elf32_arm_link_hash_entry *) ind; + + if (eind->relocs_copied != NULL) + { + if (edir->relocs_copied != NULL) + { + struct elf32_arm_relocs_copied **pp; + struct elf32_arm_relocs_copied *p; + + /* Add reloc counts against the indirect sym to the direct sym + list. Merge any entries against the same section. */ + for (pp = &eind->relocs_copied; (p = *pp) != NULL; ) + { + struct elf32_arm_relocs_copied *q; + + for (q = edir->relocs_copied; q != NULL; q = q->next) + if (q->section == p->section) + { + q->pc_count += p->pc_count; + q->count += p->count; + *pp = p->next; + break; + } + if (q == NULL) + pp = &p->next; + } + *pp = edir->relocs_copied; + } + + edir->relocs_copied = eind->relocs_copied; + eind->relocs_copied = NULL; + } + + /* Copy over PLT info. */ + edir->plt_thumb_refcount += eind->plt_thumb_refcount; + eind->plt_thumb_refcount = 0; + + if (ind->root.type == bfd_link_hash_indirect + && dir->got.refcount <= 0) + { + edir->tls_type = eind->tls_type; + eind->tls_type = GOT_UNKNOWN; + } + + _bfd_elf_link_hash_copy_indirect (info, dir, ind); +} + +/* Create an ARM elf linker hash table. */ + +static struct bfd_link_hash_table * +elf32_arm_link_hash_table_create (bfd *abfd) +{ + struct elf32_arm_link_hash_table *ret; + bfd_size_type amt = sizeof (struct elf32_arm_link_hash_table); + + ret = bfd_malloc (amt); + if (ret == NULL) + return NULL; + + if (!_bfd_elf_link_hash_table_init (& ret->root, abfd, + elf32_arm_link_hash_newfunc, + sizeof (struct elf32_arm_link_hash_entry))) + { + free (ret); + return NULL; + } + + ret->sgot = NULL; + ret->sgotplt = NULL; + ret->srelgot = NULL; + ret->splt = NULL; + ret->srelplt = NULL; + ret->sdynbss = NULL; + ret->srelbss = NULL; + ret->srelplt2 = NULL; + ret->thumb_glue_size = 0; + ret->arm_glue_size = 0; + ret->bfd_of_glue_owner = NULL; + ret->byteswap_code = 0; + ret->target1_is_rel = 0; + ret->target2_reloc = R_ARM_NONE; +#ifdef FOUR_WORD_PLT + ret->plt_header_size = 16; + ret->plt_entry_size = 16; +#else + ret->plt_header_size = 20; + ret->plt_entry_size = 12; +#endif + ret->fix_v4bx = 0; + ret->use_blx = 0; + ret->vxworks_p = 0; + ret->symbian_p = 0; + ret->use_rel = 1; + ret->sym_sec.abfd = NULL; + ret->obfd = abfd; + ret->tls_ldm_got.refcount = 0; + + return &ret->root.root; +} + +/* Locate the Thumb encoded calling stub for NAME. */ + +static struct elf_link_hash_entry * +find_thumb_glue (struct bfd_link_info *link_info, + const char *name, + bfd *input_bfd) +{ + char *tmp_name; + struct elf_link_hash_entry *hash; + struct elf32_arm_link_hash_table *hash_table; + + /* We need a pointer to the armelf specific hash table. */ + hash_table = elf32_arm_hash_table (link_info); + + tmp_name = bfd_malloc ((bfd_size_type) strlen (name) + + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1); + + BFD_ASSERT (tmp_name); + + sprintf (tmp_name, THUMB2ARM_GLUE_ENTRY_NAME, name); + + hash = elf_link_hash_lookup + (&(hash_table)->root, tmp_name, FALSE, FALSE, TRUE); + + if (hash == NULL) + /* xgettext:c-format */ + (*_bfd_error_handler) (_("%B: unable to find THUMB glue '%s' for `%s'"), + input_bfd, tmp_name, name); + + free (tmp_name); + + return hash; +} + +/* Locate the ARM encoded calling stub for NAME. */ + +static struct elf_link_hash_entry * +find_arm_glue (struct bfd_link_info *link_info, + const char *name, + bfd *input_bfd) +{ + char *tmp_name; + struct elf_link_hash_entry *myh; + struct elf32_arm_link_hash_table *hash_table; + + /* We need a pointer to the elfarm specific hash table. */ + hash_table = elf32_arm_hash_table (link_info); + + tmp_name = bfd_malloc ((bfd_size_type) strlen (name) + + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1); + + BFD_ASSERT (tmp_name); + + sprintf (tmp_name, ARM2THUMB_GLUE_ENTRY_NAME, name); + + myh = elf_link_hash_lookup + (&(hash_table)->root, tmp_name, FALSE, FALSE, TRUE); + + if (myh == NULL) + /* xgettext:c-format */ + (*_bfd_error_handler) (_("%B: unable to find ARM glue '%s' for `%s'"), + input_bfd, tmp_name, name); + + free (tmp_name); + + return myh; +} + +/* ARM->Thumb glue (static images): + + .arm + __func_from_arm: + ldr r12, __func_addr + bx r12 + __func_addr: + .word func @ behave as if you saw a ARM_32 reloc. + + (relocatable images) + .arm + __func_from_arm: + ldr r12, __func_offset + add r12, r12, pc + bx r12 + __func_offset: + .word func - . + */ + +#define ARM2THUMB_STATIC_GLUE_SIZE 12 +static const insn32 a2t1_ldr_insn = 0xe59fc000; +static const insn32 a2t2_bx_r12_insn = 0xe12fff1c; +static const insn32 a2t3_func_addr_insn = 0x00000001; + +#define ARM2THUMB_PIC_GLUE_SIZE 16 +static const insn32 a2t1p_ldr_insn = 0xe59fc004; +static const insn32 a2t2p_add_pc_insn = 0xe08cc00f; +static const insn32 a2t3p_bx_r12_insn = 0xe12fff1c; + +/* Thumb->ARM: Thumb->(non-interworking aware) ARM + + .thumb .thumb + .align 2 .align 2 + __func_from_thumb: __func_from_thumb: + bx pc push {r6, lr} + nop ldr r6, __func_addr + .arm mov lr, pc + __func_change_to_arm: bx r6 + b func .arm + __func_back_to_thumb: + ldmia r13! {r6, lr} + bx lr + __func_addr: + .word func */ + +#define THUMB2ARM_GLUE_SIZE 8 +static const insn16 t2a1_bx_pc_insn = 0x4778; +static const insn16 t2a2_noop_insn = 0x46c0; +static const insn32 t2a3_b_insn = 0xea000000; + +#ifndef ELFARM_NABI_C_INCLUDED +bfd_boolean +bfd_elf32_arm_allocate_interworking_sections (struct bfd_link_info * info) +{ + asection * s; + bfd_byte * foo; + struct elf32_arm_link_hash_table * globals; + + globals = elf32_arm_hash_table (info); + + BFD_ASSERT (globals != NULL); + + if (globals->arm_glue_size != 0) + { + BFD_ASSERT (globals->bfd_of_glue_owner != NULL); + + s = bfd_get_section_by_name (globals->bfd_of_glue_owner, + ARM2THUMB_GLUE_SECTION_NAME); + + BFD_ASSERT (s != NULL); + + foo = bfd_alloc (globals->bfd_of_glue_owner, globals->arm_glue_size); + + s->size = globals->arm_glue_size; + s->contents = foo; + } + + if (globals->thumb_glue_size != 0) + { + BFD_ASSERT (globals->bfd_of_glue_owner != NULL); + + s = bfd_get_section_by_name + (globals->bfd_of_glue_owner, THUMB2ARM_GLUE_SECTION_NAME); + + BFD_ASSERT (s != NULL); + + foo = bfd_alloc (globals->bfd_of_glue_owner, globals->thumb_glue_size); + + s->size = globals->thumb_glue_size; + s->contents = foo; + } + + return TRUE; +} + +static void +record_arm_to_thumb_glue (struct bfd_link_info * link_info, + struct elf_link_hash_entry * h) +{ + const char * name = h->root.root.string; + asection * s; + char * tmp_name; + struct elf_link_hash_entry * myh; + struct bfd_link_hash_entry * bh; + struct elf32_arm_link_hash_table * globals; + bfd_vma val; + + globals = elf32_arm_hash_table (link_info); + + BFD_ASSERT (globals != NULL); + BFD_ASSERT (globals->bfd_of_glue_owner != NULL); + + s = bfd_get_section_by_name + (globals->bfd_of_glue_owner, ARM2THUMB_GLUE_SECTION_NAME); + + BFD_ASSERT (s != NULL); + + tmp_name = bfd_malloc ((bfd_size_type) strlen (name) + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1); + + BFD_ASSERT (tmp_name); + + sprintf (tmp_name, ARM2THUMB_GLUE_ENTRY_NAME, name); + + myh = elf_link_hash_lookup + (&(globals)->root, tmp_name, FALSE, FALSE, TRUE); + + if (myh != NULL) + { + /* We've already seen this guy. */ + free (tmp_name); + return; + } + + /* The only trick here is using hash_table->arm_glue_size as the value. + Even though the section isn't allocated yet, this is where we will be + putting it. */ + bh = NULL; + val = globals->arm_glue_size + 1; + _bfd_generic_link_add_one_symbol (link_info, globals->bfd_of_glue_owner, + tmp_name, BSF_GLOBAL, s, val, + NULL, TRUE, FALSE, &bh); + + myh = (struct elf_link_hash_entry *) bh; + myh->type = ELF_ST_INFO (STB_LOCAL, STT_FUNC); + myh->forced_local = 1; + + free (tmp_name); + + if ((link_info->shared || globals->root.is_relocatable_executable)) + globals->arm_glue_size += ARM2THUMB_PIC_GLUE_SIZE; + else + globals->arm_glue_size += ARM2THUMB_STATIC_GLUE_SIZE; + + return; +} + +static void +record_thumb_to_arm_glue (struct bfd_link_info *link_info, + struct elf_link_hash_entry *h) +{ + const char *name = h->root.root.string; + asection *s; + char *tmp_name; + struct elf_link_hash_entry *myh; + struct bfd_link_hash_entry *bh; + struct elf32_arm_link_hash_table *hash_table; + bfd_vma val; + + hash_table = elf32_arm_hash_table (link_info); + + BFD_ASSERT (hash_table != NULL); + BFD_ASSERT (hash_table->bfd_of_glue_owner != NULL); + + s = bfd_get_section_by_name + (hash_table->bfd_of_glue_owner, THUMB2ARM_GLUE_SECTION_NAME); + + BFD_ASSERT (s != NULL); + + tmp_name = bfd_malloc ((bfd_size_type) strlen (name) + + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1); + + BFD_ASSERT (tmp_name); + + sprintf (tmp_name, THUMB2ARM_GLUE_ENTRY_NAME, name); + + myh = elf_link_hash_lookup + (&(hash_table)->root, tmp_name, FALSE, FALSE, TRUE); + + if (myh != NULL) + { + /* We've already seen this guy. */ + free (tmp_name); + return; + } + + bh = NULL; + val = hash_table->thumb_glue_size + 1; + _bfd_generic_link_add_one_symbol (link_info, hash_table->bfd_of_glue_owner, + tmp_name, BSF_GLOBAL, s, val, + NULL, TRUE, FALSE, &bh); + + /* If we mark it 'Thumb', the disassembler will do a better job. */ + myh = (struct elf_link_hash_entry *) bh; + myh->type = ELF_ST_INFO (STB_LOCAL, STT_ARM_TFUNC); + myh->forced_local = 1; + + free (tmp_name); + +#define CHANGE_TO_ARM "__%s_change_to_arm" +#define BACK_FROM_ARM "__%s_back_from_arm" + + /* Allocate another symbol to mark where we switch to Arm mode. */ + tmp_name = bfd_malloc ((bfd_size_type) strlen (name) + + strlen (CHANGE_TO_ARM) + 1); + + BFD_ASSERT (tmp_name); + + sprintf (tmp_name, CHANGE_TO_ARM, name); + + bh = NULL; + val = hash_table->thumb_glue_size + 4, + _bfd_generic_link_add_one_symbol (link_info, hash_table->bfd_of_glue_owner, + tmp_name, BSF_LOCAL, s, val, + NULL, TRUE, FALSE, &bh); + + free (tmp_name); + + hash_table->thumb_glue_size += THUMB2ARM_GLUE_SIZE; + + return; +} + +/* Add the glue sections to ABFD. This function is called from the + linker scripts in ld/emultempl/{armelf}.em. */ + +bfd_boolean +bfd_elf32_arm_add_glue_sections_to_bfd (bfd *abfd, + struct bfd_link_info *info) +{ + flagword flags; + asection *sec; + + /* If we are only performing a partial + link do not bother adding the glue. */ + if (info->relocatable) + return TRUE; + + sec = bfd_get_section_by_name (abfd, ARM2THUMB_GLUE_SECTION_NAME); + + if (sec == NULL) + { + /* Note: we do not include the flag SEC_LINKER_CREATED, as this + will prevent elf_link_input_bfd() from processing the contents + of this section. */ + flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_CODE | SEC_READONLY; + + sec = bfd_make_section_with_flags (abfd, + ARM2THUMB_GLUE_SECTION_NAME, + flags); + + if (sec == NULL + || !bfd_set_section_alignment (abfd, sec, 2)) + return FALSE; + + /* Set the gc mark to prevent the section from being removed by garbage + collection, despite the fact that no relocs refer to this section. */ + sec->gc_mark = 1; + } + + sec = bfd_get_section_by_name (abfd, THUMB2ARM_GLUE_SECTION_NAME); + + if (sec == NULL) + { + flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY + | SEC_CODE | SEC_READONLY; + + sec = bfd_make_section_with_flags (abfd, + THUMB2ARM_GLUE_SECTION_NAME, + flags); + + if (sec == NULL + || !bfd_set_section_alignment (abfd, sec, 2)) + return FALSE; + + sec->gc_mark = 1; + } + + return TRUE; +} + +/* Select a BFD to be used to hold the sections used by the glue code. + This function is called from the linker scripts in ld/emultempl/ + {armelf/pe}.em */ + +bfd_boolean +bfd_elf32_arm_get_bfd_for_interworking (bfd *abfd, struct bfd_link_info *info) +{ + struct elf32_arm_link_hash_table *globals; + + /* If we are only performing a partial link + do not bother getting a bfd to hold the glue. */ + if (info->relocatable) + return TRUE; + + /* Make sure we don't attach the glue sections to a dynamic object. */ + BFD_ASSERT (!(abfd->flags & DYNAMIC)); + + globals = elf32_arm_hash_table (info); + + BFD_ASSERT (globals != NULL); + + if (globals->bfd_of_glue_owner != NULL) + return TRUE; + + /* Save the bfd for later use. */ + globals->bfd_of_glue_owner = abfd; + + return TRUE; +} + +static void check_use_blx(struct elf32_arm_link_hash_table *globals) +{ + if (elf32_arm_get_eabi_attr_int (globals->obfd, Tag_CPU_arch) > 2) + globals->use_blx = 1; +} + +bfd_boolean +bfd_elf32_arm_process_before_allocation (bfd *abfd, + struct bfd_link_info *link_info, + int byteswap_code) +{ + Elf_Internal_Shdr *symtab_hdr; + Elf_Internal_Rela *internal_relocs = NULL; + Elf_Internal_Rela *irel, *irelend; + bfd_byte *contents = NULL; + + asection *sec; + struct elf32_arm_link_hash_table *globals; + + /* If we are only performing a partial link do not bother + to construct any glue. */ + if (link_info->relocatable) + return TRUE; + + /* Here we have a bfd that is to be included on the link. We have a hook + to do reloc rummaging, before section sizes are nailed down. */ + globals = elf32_arm_hash_table (link_info); + check_use_blx (globals); + + BFD_ASSERT (globals != NULL); + BFD_ASSERT (globals->bfd_of_glue_owner != NULL); + + if (byteswap_code && !bfd_big_endian (abfd)) + { + _bfd_error_handler (_("%B: BE8 images only valid in big-endian mode."), + abfd); + return FALSE; + } + globals->byteswap_code = byteswap_code; + + /* Rummage around all the relocs and map the glue vectors. */ + sec = abfd->sections; + + if (sec == NULL) + return TRUE; + + for (; sec != NULL; sec = sec->next) + { + if (sec->reloc_count == 0) + continue; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + + /* Load the relocs. */ + internal_relocs + = _bfd_elf_link_read_relocs (abfd, sec, (void *) NULL, + (Elf_Internal_Rela *) NULL, FALSE); + + if (internal_relocs == NULL) + goto error_return; + + irelend = internal_relocs + sec->reloc_count; + for (irel = internal_relocs; irel < irelend; irel++) + { + long r_type; + unsigned long r_index; + + struct elf_link_hash_entry *h; + + r_type = ELF32_R_TYPE (irel->r_info); + r_index = ELF32_R_SYM (irel->r_info); + + /* These are the only relocation types we care about. */ + if ( r_type != R_ARM_PC24 + && r_type != R_ARM_PLT32 + && r_type != R_ARM_CALL + && r_type != R_ARM_JUMP24 + && r_type != R_ARM_THM_CALL) + continue; + + /* Get the section contents if we haven't done so already. */ + if (contents == NULL) + { + /* Get cached copy if it exists. */ + if (elf_section_data (sec)->this_hdr.contents != NULL) + contents = elf_section_data (sec)->this_hdr.contents; + else + { + /* Go get them off disk. */ + if (! bfd_malloc_and_get_section (abfd, sec, &contents)) + goto error_return; + } + } + + /* If the relocation is not against a symbol it cannot concern us. */ + h = NULL; + + /* We don't care about local symbols. */ + if (r_index < symtab_hdr->sh_info) + continue; + + /* This is an external symbol. */ + r_index -= symtab_hdr->sh_info; + h = (struct elf_link_hash_entry *) + elf_sym_hashes (abfd)[r_index]; + + /* If the relocation is against a static symbol it must be within + the current section and so cannot be a cross ARM/Thumb relocation. */ + if (h == NULL) + continue; + + /* If the call will go through a PLT entry then we do not need + glue. */ + if (globals->splt != NULL && h->plt.offset != (bfd_vma) -1) + continue; + + switch (r_type) + { + case R_ARM_PC24: + case R_ARM_PLT32: + case R_ARM_CALL: + case R_ARM_JUMP24: + /* This one is a call from arm code. We need to look up + the target of the call. If it is a thumb target, we + insert glue. */ + if (ELF_ST_TYPE(h->type) == STT_ARM_TFUNC + && !(r_type == R_ARM_CALL && globals->use_blx)) + record_arm_to_thumb_glue (link_info, h); + break; + + case R_ARM_THM_CALL: + /* This one is a call from thumb code. We look + up the target of the call. If it is not a thumb + target, we insert glue. */ + if (ELF_ST_TYPE (h->type) != STT_ARM_TFUNC && !globals->use_blx) + record_thumb_to_arm_glue (link_info, h); + break; + + default: + abort (); + } + } + + if (contents != NULL + && elf_section_data (sec)->this_hdr.contents != contents) + free (contents); + contents = NULL; + + if (internal_relocs != NULL + && elf_section_data (sec)->relocs != internal_relocs) + free (internal_relocs); + internal_relocs = NULL; + } + + return TRUE; + +error_return: + if (contents != NULL + && elf_section_data (sec)->this_hdr.contents != contents) + free (contents); + if (internal_relocs != NULL + && elf_section_data (sec)->relocs != internal_relocs) + free (internal_relocs); + + return FALSE; +} +#endif + + +/* Set target relocation values needed during linking. */ + +void +bfd_elf32_arm_set_target_relocs (struct bfd_link_info *link_info, + int target1_is_rel, + char * target2_type, + int fix_v4bx, + int use_blx) +{ + struct elf32_arm_link_hash_table *globals; + + globals = elf32_arm_hash_table (link_info); + + globals->target1_is_rel = target1_is_rel; + if (strcmp (target2_type, "rel") == 0) + globals->target2_reloc = R_ARM_REL32; + else if (strcmp (target2_type, "abs") == 0) + globals->target2_reloc = R_ARM_ABS32; + else if (strcmp (target2_type, "got-rel") == 0) + globals->target2_reloc = R_ARM_GOT_PREL; + else + { + _bfd_error_handler (_("Invalid TARGET2 relocation type '%s'."), + target2_type); + } + globals->fix_v4bx = fix_v4bx; + globals->use_blx |= use_blx; +} + +/* The thumb form of a long branch is a bit finicky, because the offset + encoding is split over two fields, each in it's own instruction. They + can occur in any order. So given a thumb form of long branch, and an + offset, insert the offset into the thumb branch and return finished + instruction. + + It takes two thumb instructions to encode the target address. Each has + 11 bits to invest. The upper 11 bits are stored in one (identified by + H-0.. see below), the lower 11 bits are stored in the other (identified + by H-1). + + Combine together and shifted left by 1 (it's a half word address) and + there you have it. + + Op: 1111 = F, + H-0, upper address-0 = 000 + Op: 1111 = F, + H-1, lower address-0 = 800 + + They can be ordered either way, but the arm tools I've seen always put + the lower one first. It probably doesn't matter. krk@cygnus.com + + XXX: Actually the order does matter. The second instruction (H-1) + moves the computed address into the PC, so it must be the second one + in the sequence. The problem, however is that whilst little endian code + stores the instructions in HI then LOW order, big endian code does the + reverse. nickc@cygnus.com. */ + +#define LOW_HI_ORDER 0xF800F000 +#define HI_LOW_ORDER 0xF000F800 + +static insn32 +insert_thumb_branch (insn32 br_insn, int rel_off) +{ + unsigned int low_bits; + unsigned int high_bits; + + BFD_ASSERT ((rel_off & 1) != 1); + + rel_off >>= 1; /* Half word aligned address. */ + low_bits = rel_off & 0x000007FF; /* The bottom 11 bits. */ + high_bits = (rel_off >> 11) & 0x000007FF; /* The top 11 bits. */ + + if ((br_insn & LOW_HI_ORDER) == LOW_HI_ORDER) + br_insn = LOW_HI_ORDER | (low_bits << 16) | high_bits; + else if ((br_insn & HI_LOW_ORDER) == HI_LOW_ORDER) + br_insn = HI_LOW_ORDER | (high_bits << 16) | low_bits; + else + /* FIXME: abort is probably not the right call. krk@cygnus.com */ + abort (); /* Error - not a valid branch instruction form. */ + + return br_insn; +} + +/* Thumb code calling an ARM function. */ + +static int +elf32_thumb_to_arm_stub (struct bfd_link_info * info, + const char * name, + bfd * input_bfd, + bfd * output_bfd, + asection * input_section, + bfd_byte * hit_data, + asection * sym_sec, + bfd_vma offset, + bfd_signed_vma addend, + bfd_vma val) +{ + asection * s = 0; + bfd_vma my_offset; + unsigned long int tmp; + long int ret_offset; + struct elf_link_hash_entry * myh; + struct elf32_arm_link_hash_table * globals; + + myh = find_thumb_glue (info, name, input_bfd); + if (myh == NULL) + return FALSE; + + globals = elf32_arm_hash_table (info); + + BFD_ASSERT (globals != NULL); + BFD_ASSERT (globals->bfd_of_glue_owner != NULL); + + my_offset = myh->root.u.def.value; + + s = bfd_get_section_by_name (globals->bfd_of_glue_owner, + THUMB2ARM_GLUE_SECTION_NAME); + + BFD_ASSERT (s != NULL); + BFD_ASSERT (s->contents != NULL); + BFD_ASSERT (s->output_section != NULL); + + if ((my_offset & 0x01) == 0x01) + { + if (sym_sec != NULL + && sym_sec->owner != NULL + && !INTERWORK_FLAG (sym_sec->owner)) + { + (*_bfd_error_handler) + (_("%B(%s): warning: interworking not enabled.\n" + " first occurrence: %B: thumb call to arm"), + sym_sec->owner, input_bfd, name); + + return FALSE; + } + + --my_offset; + myh->root.u.def.value = my_offset; + + bfd_put_16 (output_bfd, (bfd_vma) t2a1_bx_pc_insn, + s->contents + my_offset); + + bfd_put_16 (output_bfd, (bfd_vma) t2a2_noop_insn, + s->contents + my_offset + 2); + + ret_offset = + /* Address of destination of the stub. */ + ((bfd_signed_vma) val) + - ((bfd_signed_vma) + /* Offset from the start of the current section + to the start of the stubs. */ + (s->output_offset + /* Offset of the start of this stub from the start of the stubs. */ + + my_offset + /* Address of the start of the current section. */ + + s->output_section->vma) + /* The branch instruction is 4 bytes into the stub. */ + + 4 + /* ARM branches work from the pc of the instruction + 8. */ + + 8); + + bfd_put_32 (output_bfd, + (bfd_vma) t2a3_b_insn | ((ret_offset >> 2) & 0x00FFFFFF), + s->contents + my_offset + 4); + } + + BFD_ASSERT (my_offset <= globals->thumb_glue_size); + + /* Now go back and fix up the original BL insn to point to here. */ + ret_offset = + /* Address of where the stub is located. */ + (s->output_section->vma + s->output_offset + my_offset) + /* Address of where the BL is located. */ + - (input_section->output_section->vma + input_section->output_offset + + offset) + /* Addend in the relocation. */ + - addend + /* Biassing for PC-relative addressing. */ + - 8; + + tmp = bfd_get_32 (input_bfd, hit_data + - input_section->vma); + + bfd_put_32 (output_bfd, + (bfd_vma) insert_thumb_branch (tmp, ret_offset), + hit_data - input_section->vma); + + return TRUE; +} + +/* Arm code calling a Thumb function. */ + +static int +elf32_arm_to_thumb_stub (struct bfd_link_info * info, + const char * name, + bfd * input_bfd, + bfd * output_bfd, + asection * input_section, + bfd_byte * hit_data, + asection * sym_sec, + bfd_vma offset, + bfd_signed_vma addend, + bfd_vma val) +{ + unsigned long int tmp; + bfd_vma my_offset; + asection * s; + long int ret_offset; + struct elf_link_hash_entry * myh; + struct elf32_arm_link_hash_table * globals; + + myh = find_arm_glue (info, name, input_bfd); + if (myh == NULL) + return FALSE; + + globals = elf32_arm_hash_table (info); + + BFD_ASSERT (globals != NULL); + BFD_ASSERT (globals->bfd_of_glue_owner != NULL); + + my_offset = myh->root.u.def.value; + s = bfd_get_section_by_name (globals->bfd_of_glue_owner, + ARM2THUMB_GLUE_SECTION_NAME); + BFD_ASSERT (s != NULL); + BFD_ASSERT (s->contents != NULL); + BFD_ASSERT (s->output_section != NULL); + + if ((my_offset & 0x01) == 0x01) + { + if (sym_sec != NULL + && sym_sec->owner != NULL + && !INTERWORK_FLAG (sym_sec->owner)) + { + (*_bfd_error_handler) + (_("%B(%s): warning: interworking not enabled.\n" + " first occurrence: %B: arm call to thumb"), + sym_sec->owner, input_bfd, name); + } + + --my_offset; + myh->root.u.def.value = my_offset; + + if ((info->shared || globals->root.is_relocatable_executable)) + { + /* For relocatable objects we can't use absolute addresses, + so construct the address from a relative offset. */ + /* TODO: If the offset is small it's probably worth + constructing the address with adds. */ + bfd_put_32 (output_bfd, (bfd_vma) a2t1p_ldr_insn, + s->contents + my_offset); + bfd_put_32 (output_bfd, (bfd_vma) a2t2p_add_pc_insn, + s->contents + my_offset + 4); + bfd_put_32 (output_bfd, (bfd_vma) a2t3p_bx_r12_insn, + s->contents + my_offset + 8); + /* Adjust the offset by 4 for the position of the add, + and 8 for the pipeline offset. */ + ret_offset = (val - (s->output_offset + + s->output_section->vma + + my_offset + 12)) + | 1; + bfd_put_32 (output_bfd, ret_offset, + s->contents + my_offset + 12); + } + else + { + bfd_put_32 (output_bfd, (bfd_vma) a2t1_ldr_insn, + s->contents + my_offset); + + bfd_put_32 (output_bfd, (bfd_vma) a2t2_bx_r12_insn, + s->contents + my_offset + 4); + + /* It's a thumb address. Add the low order bit. */ + bfd_put_32 (output_bfd, val | a2t3_func_addr_insn, + s->contents + my_offset + 8); + } + } + + BFD_ASSERT (my_offset <= globals->arm_glue_size); + + tmp = bfd_get_32 (input_bfd, hit_data); + tmp = tmp & 0xFF000000; + + /* Somehow these are both 4 too far, so subtract 8. */ + ret_offset = (s->output_offset + + my_offset + + s->output_section->vma + - (input_section->output_offset + + input_section->output_section->vma + + offset + addend) + - 8); + + tmp = tmp | ((ret_offset >> 2) & 0x00FFFFFF); + + bfd_put_32 (output_bfd, (bfd_vma) tmp, hit_data - input_section->vma); + + return TRUE; +} + +/* Some relocations map to different relocations depending on the + target. Return the real relocation. */ +static int +arm_real_reloc_type (struct elf32_arm_link_hash_table * globals, + int r_type) +{ + switch (r_type) + { + case R_ARM_TARGET1: + if (globals->target1_is_rel) + return R_ARM_REL32; + else + return R_ARM_ABS32; + + case R_ARM_TARGET2: + return globals->target2_reloc; + + default: + return r_type; + } +} + +/* Return the base VMA address which should be subtracted from real addresses + when resolving @dtpoff relocation. + This is PT_TLS segment p_vaddr. */ + +static bfd_vma +dtpoff_base (struct bfd_link_info *info) +{ + /* If tls_sec is NULL, we should have signalled an error already. */ + if (elf_hash_table (info)->tls_sec == NULL) + return 0; + return elf_hash_table (info)->tls_sec->vma; +} + +/* Return the relocation value for @tpoff relocation + if STT_TLS virtual address is ADDRESS. */ + +static bfd_vma +tpoff (struct bfd_link_info *info, bfd_vma address) +{ + struct elf_link_hash_table *htab = elf_hash_table (info); + bfd_vma base; + + /* If tls_sec is NULL, we should have signalled an error already. */ + if (htab->tls_sec == NULL) + return 0; + base = align_power ((bfd_vma) TCB_SIZE, htab->tls_sec->alignment_power); + return address - htab->tls_sec->vma + base; +} + +/* Perform an R_ARM_ABS12 relocation on the field pointed to by DATA. + VALUE is the relocation value. */ + +static bfd_reloc_status_type +elf32_arm_abs12_reloc (bfd *abfd, void *data, bfd_vma value) +{ + if (value > 0xfff) + return bfd_reloc_overflow; + + value |= bfd_get_32 (abfd, data) & 0xfffff000; + bfd_put_32 (abfd, value, data); + return bfd_reloc_ok; +} + +/* Perform a relocation as part of a final link. */ + +static bfd_reloc_status_type +elf32_arm_final_link_relocate (reloc_howto_type * howto, + bfd * input_bfd, + bfd * output_bfd, + asection * input_section, + bfd_byte * contents, + Elf_Internal_Rela * rel, + bfd_vma value, + struct bfd_link_info * info, + asection * sym_sec, + const char * sym_name, + int sym_flags, + struct elf_link_hash_entry * h, + bfd_boolean * unresolved_reloc_p) +{ + unsigned long r_type = howto->type; + unsigned long r_symndx; + bfd_byte * hit_data = contents + rel->r_offset; + bfd * dynobj = NULL; + Elf_Internal_Shdr * symtab_hdr; + struct elf_link_hash_entry ** sym_hashes; + bfd_vma * local_got_offsets; + asection * sgot = NULL; + asection * splt = NULL; + asection * sreloc = NULL; + bfd_vma addend; + bfd_signed_vma signed_addend; + struct elf32_arm_link_hash_table * globals; + + globals = elf32_arm_hash_table (info); + + /* Some relocation type map to different relocations depending on the + target. We pick the right one here. */ + r_type = arm_real_reloc_type (globals, r_type); + if (r_type != howto->type) + howto = elf32_arm_howto_from_type (r_type); + + /* If the start address has been set, then set the EF_ARM_HASENTRY + flag. Setting this more than once is redundant, but the cost is + not too high, and it keeps the code simple. + + The test is done here, rather than somewhere else, because the + start address is only set just before the final link commences. + + Note - if the user deliberately sets a start address of 0, the + flag will not be set. */ + if (bfd_get_start_address (output_bfd) != 0) + elf_elfheader (output_bfd)->e_flags |= EF_ARM_HASENTRY; + + dynobj = elf_hash_table (info)->dynobj; + if (dynobj) + { + sgot = bfd_get_section_by_name (dynobj, ".got"); + splt = bfd_get_section_by_name (dynobj, ".plt"); + } + symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (input_bfd); + local_got_offsets = elf_local_got_offsets (input_bfd); + r_symndx = ELF32_R_SYM (rel->r_info); + + if (globals->use_rel) + { + addend = bfd_get_32 (input_bfd, hit_data) & howto->src_mask; + + if (addend & ((howto->src_mask + 1) >> 1)) + { + signed_addend = -1; + signed_addend &= ~ howto->src_mask; + signed_addend |= addend; + } + else + signed_addend = addend; + } + else + addend = signed_addend = rel->r_addend; + + switch (r_type) + { + case R_ARM_NONE: + /* We don't need to find a value for this symbol. It's just a + marker. */ + *unresolved_reloc_p = FALSE; + return bfd_reloc_ok; + + case R_ARM_ABS12: + if (!globals->vxworks_p) + return elf32_arm_abs12_reloc (input_bfd, hit_data, value + addend); + + case R_ARM_PC24: + case R_ARM_ABS32: + case R_ARM_REL32: + case R_ARM_CALL: + case R_ARM_JUMP24: + case R_ARM_XPC25: + case R_ARM_PREL31: + case R_ARM_PLT32: + /* r_symndx will be zero only for relocs against symbols + from removed linkonce sections, or sections discarded by + a linker script. */ + if (r_symndx == 0) + return bfd_reloc_ok; + + /* Handle relocations which should use the PLT entry. ABS32/REL32 + will use the symbol's value, which may point to a PLT entry, but we + don't need to handle that here. If we created a PLT entry, all + branches in this object should go to it. */ + if ((r_type != R_ARM_ABS32 && r_type != R_ARM_REL32) + && h != NULL + && splt != NULL + && h->plt.offset != (bfd_vma) -1) + { + /* If we've created a .plt section, and assigned a PLT entry to + this function, it should not be known to bind locally. If + it were, we would have cleared the PLT entry. */ + BFD_ASSERT (!SYMBOL_CALLS_LOCAL (info, h)); + + value = (splt->output_section->vma + + splt->output_offset + + h->plt.offset); + *unresolved_reloc_p = FALSE; + return _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, rel->r_offset, value, + rel->r_addend); + } + + /* When generating a shared object or relocatable executable, these + relocations are copied into the output file to be resolved at + run time. */ + if ((info->shared || globals->root.is_relocatable_executable) + && (input_section->flags & SEC_ALLOC) + && (r_type != R_ARM_REL32 + || !SYMBOL_CALLS_LOCAL (info, h)) + && (h == NULL + || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT + || h->root.type != bfd_link_hash_undefweak) + && r_type != R_ARM_PC24 + && r_type != R_ARM_CALL + && r_type != R_ARM_JUMP24 + && r_type != R_ARM_PREL31 + && r_type != R_ARM_PLT32) + { + Elf_Internal_Rela outrel; + bfd_byte *loc; + bfd_boolean skip, relocate; + + *unresolved_reloc_p = FALSE; + + if (sreloc == NULL) + { + const char * name; + + name = (bfd_elf_string_from_elf_section + (input_bfd, + elf_elfheader (input_bfd)->e_shstrndx, + elf_section_data (input_section)->rel_hdr.sh_name)); + if (name == NULL) + return bfd_reloc_notsupported; + + BFD_ASSERT (reloc_section_p (globals, name, input_section)); + + sreloc = bfd_get_section_by_name (dynobj, name); + BFD_ASSERT (sreloc != NULL); + } + + skip = FALSE; + relocate = FALSE; + + outrel.r_addend = addend; + outrel.r_offset = + _bfd_elf_section_offset (output_bfd, info, input_section, + rel->r_offset); + if (outrel.r_offset == (bfd_vma) -1) + skip = TRUE; + else if (outrel.r_offset == (bfd_vma) -2) + skip = TRUE, relocate = TRUE; + outrel.r_offset += (input_section->output_section->vma + + input_section->output_offset); + + if (skip) + memset (&outrel, 0, sizeof outrel); + else if (h != NULL + && h->dynindx != -1 + && (!info->shared + || !info->symbolic + || !h->def_regular)) + outrel.r_info = ELF32_R_INFO (h->dynindx, r_type); + else + { + int symbol; + + /* This symbol is local, or marked to become local. */ + if (sym_flags == STT_ARM_TFUNC) + value |= 1; + if (globals->symbian_p) + { + /* On Symbian OS, the data segment and text segement + can be relocated independently. Therefore, we + must indicate the segment to which this + relocation is relative. The BPABI allows us to + use any symbol in the right segment; we just use + the section symbol as it is convenient. (We + cannot use the symbol given by "h" directly as it + will not appear in the dynamic symbol table.) */ + if (sym_sec) + symbol = elf_section_data (sym_sec->output_section)->dynindx; + else + symbol = elf_section_data (input_section->output_section)->dynindx; + BFD_ASSERT (symbol != 0); + } + else + /* On SVR4-ish systems, the dynamic loader cannot + relocate the text and data segments independently, + so the symbol does not matter. */ + symbol = 0; + outrel.r_info = ELF32_R_INFO (symbol, R_ARM_RELATIVE); + if (globals->use_rel) + relocate = TRUE; + else + outrel.r_addend += value; + } + + loc = sreloc->contents; + loc += sreloc->reloc_count++ * RELOC_SIZE (globals); + SWAP_RELOC_OUT (globals) (output_bfd, &outrel, loc); + + /* If this reloc is against an external symbol, we do not want to + fiddle with the addend. Otherwise, we need to include the symbol + value so that it becomes an addend for the dynamic reloc. */ + if (! relocate) + return bfd_reloc_ok; + + return _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, rel->r_offset, value, + (bfd_vma) 0); + } + else switch (r_type) + { + case R_ARM_ABS12: + return elf32_arm_abs12_reloc (input_bfd, hit_data, value + addend); + + case R_ARM_XPC25: /* Arm BLX instruction. */ + case R_ARM_CALL: + case R_ARM_JUMP24: + case R_ARM_PC24: /* Arm B/BL instruction */ + case R_ARM_PLT32: + if (r_type == R_ARM_XPC25) + { + /* Check for Arm calling Arm function. */ + /* FIXME: Should we translate the instruction into a BL + instruction instead ? */ + if (sym_flags != STT_ARM_TFUNC) + (*_bfd_error_handler) + (_("\%B: Warning: Arm BLX instruction targets Arm function '%s'."), + input_bfd, + h ? h->root.root.string : "(local)"); + } + else if (r_type != R_ARM_CALL || !globals->use_blx) + { + /* Check for Arm calling Thumb function. */ + if (sym_flags == STT_ARM_TFUNC) + { + elf32_arm_to_thumb_stub (info, sym_name, input_bfd, + output_bfd, input_section, + hit_data, sym_sec, rel->r_offset, + signed_addend, value); + return bfd_reloc_ok; + } + } + + /* The ARM ELF ABI says that this reloc is computed as: S - P + A + where: + S is the address of the symbol in the relocation. + P is address of the instruction being relocated. + A is the addend (extracted from the instruction) in bytes. + + S is held in 'value'. + P is the base address of the section containing the + instruction plus the offset of the reloc into that + section, ie: + (input_section->output_section->vma + + input_section->output_offset + + rel->r_offset). + A is the addend, converted into bytes, ie: + (signed_addend * 4) + + Note: None of these operations have knowledge of the pipeline + size of the processor, thus it is up to the assembler to + encode this information into the addend. */ + value -= (input_section->output_section->vma + + input_section->output_offset); + value -= rel->r_offset; + if (globals->use_rel) + value += (signed_addend << howto->size); + else + /* RELA addends do not have to be adjusted by howto->size. */ + value += signed_addend; + + signed_addend = value; + signed_addend >>= howto->rightshift; + + /* It is not an error for an undefined weak reference to be + out of range. Any program that branches to such a symbol + is going to crash anyway, so there is no point worrying + about getting the destination exactly right. */ + if (! h || h->root.type != bfd_link_hash_undefweak) + { + /* Perform a signed range check. */ + if ( signed_addend > ((bfd_signed_vma) (howto->dst_mask >> 1)) + || signed_addend < - ((bfd_signed_vma) ((howto->dst_mask + 1) >> 1))) + return bfd_reloc_overflow; + } + + addend = (value & 2); + + value = (signed_addend & howto->dst_mask) + | (bfd_get_32 (input_bfd, hit_data) & (~ howto->dst_mask)); + + /* Set the H bit in the BLX instruction. */ + if (sym_flags == STT_ARM_TFUNC) + { + if (addend) + value |= (1 << 24); + else + value &= ~(bfd_vma)(1 << 24); + } + if (r_type == R_ARM_CALL) + { + /* Select the correct instruction (BL or BLX). */ + if (sym_flags == STT_ARM_TFUNC) + value |= (1 << 28); + else + { + value &= ~(bfd_vma)(1 << 28); + value |= (1 << 24); + } + } + break; + + case R_ARM_ABS32: + value += addend; + if (sym_flags == STT_ARM_TFUNC) + value |= 1; + break; + + case R_ARM_REL32: + value += addend; + if (sym_flags == STT_ARM_TFUNC) + value |= 1; + value -= (input_section->output_section->vma + + input_section->output_offset + rel->r_offset); + break; + + case R_ARM_PREL31: + value -= (input_section->output_section->vma + + input_section->output_offset + rel->r_offset); + value += signed_addend; + if (! h || h->root.type != bfd_link_hash_undefweak) + { + /* Check for overflow */ + if ((value ^ (value >> 1)) & (1 << 30)) + return bfd_reloc_overflow; + } + value &= 0x7fffffff; + value |= (bfd_get_32 (input_bfd, hit_data) & 0x80000000); + if (sym_flags == STT_ARM_TFUNC) + value |= 1; + break; + } + + bfd_put_32 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + case R_ARM_ABS8: + value += addend; + if ((long) value > 0x7f || (long) value < -0x80) + return bfd_reloc_overflow; + + bfd_put_8 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + case R_ARM_ABS16: + value += addend; + + if ((long) value > 0x7fff || (long) value < -0x8000) + return bfd_reloc_overflow; + + bfd_put_16 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + case R_ARM_THM_ABS5: + /* Support ldr and str instructions for the thumb. */ + if (globals->use_rel) + { + /* Need to refetch addend. */ + addend = bfd_get_16 (input_bfd, hit_data) & howto->src_mask; + /* ??? Need to determine shift amount from operand size. */ + addend >>= howto->rightshift; + } + value += addend; + + /* ??? Isn't value unsigned? */ + if ((long) value > 0x1f || (long) value < -0x10) + return bfd_reloc_overflow; + + /* ??? Value needs to be properly shifted into place first. */ + value |= bfd_get_16 (input_bfd, hit_data) & 0xf83f; + bfd_put_16 (input_bfd, value, hit_data); + return bfd_reloc_ok; + + case R_ARM_THM_XPC22: + case R_ARM_THM_CALL: + /* Thumb BL (branch long instruction). */ + { + bfd_vma relocation; + bfd_boolean overflow = FALSE; + bfd_vma upper_insn = bfd_get_16 (input_bfd, hit_data); + bfd_vma lower_insn = bfd_get_16 (input_bfd, hit_data + 2); + bfd_signed_vma reloc_signed_max = ((1 << (howto->bitsize - 1)) - 1) >> howto->rightshift; + bfd_signed_vma reloc_signed_min = ~ reloc_signed_max; + bfd_vma check; + bfd_signed_vma signed_check; + + /* Need to refetch the addend and squish the two 11 bit pieces + together. */ + if (globals->use_rel) + { + bfd_vma upper = upper_insn & 0x7ff; + bfd_vma lower = lower_insn & 0x7ff; + upper = (upper ^ 0x400) - 0x400; /* Sign extend. */ + addend = (upper << 12) | (lower << 1); + signed_addend = addend; + } + + if (r_type == R_ARM_THM_XPC22) + { + /* Check for Thumb to Thumb call. */ + /* FIXME: Should we translate the instruction into a BL + instruction instead ? */ + if (sym_flags == STT_ARM_TFUNC) + (*_bfd_error_handler) + (_("%B: Warning: Thumb BLX instruction targets thumb function '%s'."), + input_bfd, + h ? h->root.root.string : "(local)"); + } + else + { + /* If it is not a call to Thumb, assume call to Arm. + If it is a call relative to a section name, then it is not a + function call at all, but rather a long jump. Calls through + the PLT do not require stubs. */ + if (sym_flags != STT_ARM_TFUNC && sym_flags != STT_SECTION + && (h == NULL || splt == NULL + || h->plt.offset == (bfd_vma) -1)) + { + if (globals->use_blx) + { + /* Convert BL to BLX. */ + lower_insn = (lower_insn & ~0x1000) | 0x0800; + } + else if (elf32_thumb_to_arm_stub + (info, sym_name, input_bfd, output_bfd, input_section, + hit_data, sym_sec, rel->r_offset, signed_addend, value)) + return bfd_reloc_ok; + else + return bfd_reloc_dangerous; + } + else if (sym_flags == STT_ARM_TFUNC && globals->use_blx) + { + /* Make sure this is a BL. */ + lower_insn |= 0x1800; + } + } + + /* Handle calls via the PLT. */ + if (h != NULL && splt != NULL && h->plt.offset != (bfd_vma) -1) + { + value = (splt->output_section->vma + + splt->output_offset + + h->plt.offset); + if (globals->use_blx) + { + /* If the Thumb BLX instruction is available, convert the + BL to a BLX instruction to call the ARM-mode PLT entry. */ + lower_insn = (lower_insn & ~0x1000) | 0x0800; + } + else + /* Target the Thumb stub before the ARM PLT entry. */ + value -= PLT_THUMB_STUB_SIZE; + *unresolved_reloc_p = FALSE; + } + + relocation = value + signed_addend; + + relocation -= (input_section->output_section->vma + + input_section->output_offset + + rel->r_offset); + + check = relocation >> howto->rightshift; + + /* If this is a signed value, the rightshift just dropped + leading 1 bits (assuming twos complement). */ + if ((bfd_signed_vma) relocation >= 0) + signed_check = check; + else + signed_check = check | ~((bfd_vma) -1 >> howto->rightshift); + + /* Assumes two's complement. */ + if (signed_check > reloc_signed_max || signed_check < reloc_signed_min) + overflow = TRUE; + + if ((lower_insn & 0x1800) == 0x0800) + /* For a BLX instruction, make sure that the relocation is rounded up + to a word boundary. This follows the semantics of the instruction + which specifies that bit 1 of the target address will come from bit + 1 of the base address. */ + relocation = (relocation + 2) & ~ 3; + + /* Put RELOCATION back into the insn. */ + upper_insn = (upper_insn & ~(bfd_vma) 0x7ff) | ((relocation >> 12) & 0x7ff); + lower_insn = (lower_insn & ~(bfd_vma) 0x7ff) | ((relocation >> 1) & 0x7ff); + + /* Put the relocated value back in the object file: */ + bfd_put_16 (input_bfd, upper_insn, hit_data); + bfd_put_16 (input_bfd, lower_insn, hit_data + 2); + + return (overflow ? bfd_reloc_overflow : bfd_reloc_ok); + } + break; + + case R_ARM_THM_JUMP24: + /* Thumb32 unconditional branch instruction. */ + { + bfd_vma relocation; + bfd_boolean overflow = FALSE; + bfd_vma upper_insn = bfd_get_16 (input_bfd, hit_data); + bfd_vma lower_insn = bfd_get_16 (input_bfd, hit_data + 2); + bfd_signed_vma reloc_signed_max = ((1 << (howto->bitsize - 1)) - 1) >> howto->rightshift; + bfd_signed_vma reloc_signed_min = ~ reloc_signed_max; + bfd_vma check; + bfd_signed_vma signed_check; + + /* Need to refetch the addend, reconstruct the top three bits, and glue the + two pieces together. */ + if (globals->use_rel) + { + bfd_vma S = (upper_insn & 0x0400) >> 10; + bfd_vma hi = (upper_insn & 0x03ff); + bfd_vma I1 = (lower_insn & 0x2000) >> 13; + bfd_vma I2 = (lower_insn & 0x0800) >> 11; + bfd_vma lo = (lower_insn & 0x07ff); + + I1 = !(I1 ^ S); + I2 = !(I2 ^ S); + S = !S; + + signed_addend = (S << 24) | (I1 << 23) | (I2 << 22) | (hi << 12) | (lo << 1); + signed_addend -= (1 << 24); /* Sign extend. */ + } + + /* ??? Should handle interworking? GCC might someday try to + use this for tail calls. */ + + relocation = value + signed_addend; + relocation -= (input_section->output_section->vma + + input_section->output_offset + + rel->r_offset); + + check = relocation >> howto->rightshift; + + /* If this is a signed value, the rightshift just dropped + leading 1 bits (assuming twos complement). */ + if ((bfd_signed_vma) relocation >= 0) + signed_check = check; + else + signed_check = check | ~((bfd_vma) -1 >> howto->rightshift); + + /* Assumes two's complement. */ + if (signed_check > reloc_signed_max || signed_check < reloc_signed_min) + overflow = TRUE; + + /* Put RELOCATION back into the insn. */ + { + bfd_vma S = (relocation & 0x01000000) >> 24; + bfd_vma I1 = (relocation & 0x00800000) >> 23; + bfd_vma I2 = (relocation & 0x00400000) >> 22; + bfd_vma hi = (relocation & 0x003ff000) >> 12; + bfd_vma lo = (relocation & 0x00000ffe) >> 1; + + I1 = !(I1 ^ S); + I2 = !(I2 ^ S); + + upper_insn = (upper_insn & (bfd_vma) 0xf800) | (S << 10) | hi; + lower_insn = (lower_insn & (bfd_vma) 0xd000) | (I1 << 13) | (I2 << 11) | lo; + } + + /* Put the relocated value back in the object file: */ + bfd_put_16 (input_bfd, upper_insn, hit_data); + bfd_put_16 (input_bfd, lower_insn, hit_data + 2); + + return (overflow ? bfd_reloc_overflow : bfd_reloc_ok); + } + + case R_ARM_THM_JUMP19: + /* Thumb32 conditional branch instruction. */ + { + bfd_vma relocation; + bfd_boolean overflow = FALSE; + bfd_vma upper_insn = bfd_get_16 (input_bfd, hit_data); + bfd_vma lower_insn = bfd_get_16 (input_bfd, hit_data + 2); + bfd_signed_vma reloc_signed_max = ((1 << (howto->bitsize - 1)) - 1) >> howto->rightshift; + bfd_signed_vma reloc_signed_min = ~ reloc_signed_max; + bfd_vma check; + bfd_signed_vma signed_check; + + /* Need to refetch the addend, reconstruct the top three bits, + and squish the two 11 bit pieces together. */ + if (globals->use_rel) + { + bfd_vma S = (upper_insn & 0x0400) >> 10; + bfd_vma upper = (upper_insn & 0x001f); + bfd_vma J1 = (lower_insn & 0x2000) >> 13; + bfd_vma J2 = (lower_insn & 0x0800) >> 11; + bfd_vma lower = (lower_insn & 0x07ff); + + upper |= J2 << 6; + upper |= J1 << 7; + upper |= ~S << 8; + upper -= 0x0100; /* Sign extend. */ + + addend = (upper << 12) | (lower << 1); + signed_addend = addend; + } + + /* ??? Should handle interworking? GCC might someday try to + use this for tail calls. */ + + relocation = value + signed_addend; + relocation -= (input_section->output_section->vma + + input_section->output_offset + + rel->r_offset); + + check = relocation >> howto->rightshift; + + /* If this is a signed value, the rightshift just dropped + leading 1 bits (assuming twos complement). */ + if ((bfd_signed_vma) relocation >= 0) + signed_check = check; + else + signed_check = check | ~((bfd_vma) -1 >> howto->rightshift); + + /* Assumes two's complement. */ + if (signed_check > reloc_signed_max || signed_check < reloc_signed_min) + overflow = TRUE; + + /* Put RELOCATION back into the insn. */ + { + bfd_vma S = (relocation & 0x00100000) >> 20; + bfd_vma J2 = (relocation & 0x00080000) >> 19; + bfd_vma J1 = (relocation & 0x00040000) >> 18; + bfd_vma hi = (relocation & 0x0003f000) >> 12; + bfd_vma lo = (relocation & 0x00000ffe) >> 1; + + upper_insn = (upper_insn & 0xfb30) | (S << 10) | hi; + lower_insn = (lower_insn & 0xd000) | (J1 << 13) | (J2 << 11) | lo; + } + + /* Put the relocated value back in the object file: */ + bfd_put_16 (input_bfd, upper_insn, hit_data); + bfd_put_16 (input_bfd, lower_insn, hit_data + 2); + + return (overflow ? bfd_reloc_overflow : bfd_reloc_ok); + } + + case R_ARM_THM_JUMP11: + case R_ARM_THM_JUMP8: + case R_ARM_THM_JUMP6: + /* Thumb B (branch) instruction). */ + { + bfd_signed_vma relocation; + bfd_signed_vma reloc_signed_max = (1 << (howto->bitsize - 1)) - 1; + bfd_signed_vma reloc_signed_min = ~ reloc_signed_max; + bfd_signed_vma signed_check; + + /* CZB cannot jump backward. */ + if (r_type == R_ARM_THM_JUMP6) + reloc_signed_min = 0; + + if (globals->use_rel) + { + /* Need to refetch addend. */ + addend = bfd_get_16 (input_bfd, hit_data) & howto->src_mask; + if (addend & ((howto->src_mask + 1) >> 1)) + { + signed_addend = -1; + signed_addend &= ~ howto->src_mask; + signed_addend |= addend; + } + else + signed_addend = addend; + /* The value in the insn has been right shifted. We need to + undo this, so that we can perform the address calculation + in terms of bytes. */ + signed_addend <<= howto->rightshift; + } + relocation = value + signed_addend; + + relocation -= (input_section->output_section->vma + + input_section->output_offset + + rel->r_offset); + + relocation >>= howto->rightshift; + signed_check = relocation; + + if (r_type == R_ARM_THM_JUMP6) + relocation = ((relocation & 0x0020) << 4) | ((relocation & 0x001f) << 3); + else + relocation &= howto->dst_mask; + relocation |= (bfd_get_16 (input_bfd, hit_data) & (~ howto->dst_mask)); + + bfd_put_16 (input_bfd, relocation, hit_data); + + /* Assumes two's complement. */ + if (signed_check > reloc_signed_max || signed_check < reloc_signed_min) + return bfd_reloc_overflow; + + return bfd_reloc_ok; + } + + case R_ARM_ALU_PCREL7_0: + case R_ARM_ALU_PCREL15_8: + case R_ARM_ALU_PCREL23_15: + { + bfd_vma insn; + bfd_vma relocation; + + insn = bfd_get_32 (input_bfd, hit_data); + if (globals->use_rel) + { + /* Extract the addend. */ + addend = (insn & 0xff) << ((insn & 0xf00) >> 7); + signed_addend = addend; + } + relocation = value + signed_addend; + + relocation -= (input_section->output_section->vma + + input_section->output_offset + + rel->r_offset); + insn = (insn & ~0xfff) + | ((howto->bitpos << 7) & 0xf00) + | ((relocation >> howto->bitpos) & 0xff); + bfd_put_32 (input_bfd, value, hit_data); + } + return bfd_reloc_ok; + + case R_ARM_GNU_VTINHERIT: + case R_ARM_GNU_VTENTRY: + return bfd_reloc_ok; + + case R_ARM_GOTOFF32: + /* Relocation is relative to the start of the + global offset table. */ + + BFD_ASSERT (sgot != NULL); + if (sgot == NULL) + return bfd_reloc_notsupported; + + /* If we are addressing a Thumb function, we need to adjust the + address by one, so that attempts to call the function pointer will + correctly interpret it as Thumb code. */ + if (sym_flags == STT_ARM_TFUNC) + value += 1; + + /* Note that sgot->output_offset is not involved in this + calculation. We always want the start of .got. If we + define _GLOBAL_OFFSET_TABLE in a different way, as is + permitted by the ABI, we might have to change this + calculation. */ + value -= sgot->output_section->vma; + return _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, rel->r_offset, value, + rel->r_addend); + + case R_ARM_GOTPC: + /* Use global offset table as symbol value. */ + BFD_ASSERT (sgot != NULL); + + if (sgot == NULL) + return bfd_reloc_notsupported; + + *unresolved_reloc_p = FALSE; + value = sgot->output_section->vma; + return _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, rel->r_offset, value, + rel->r_addend); + + case R_ARM_GOT32: + case R_ARM_GOT_PREL: + /* Relocation is to the entry for this symbol in the + global offset table. */ + if (sgot == NULL) + return bfd_reloc_notsupported; + + if (h != NULL) + { + bfd_vma off; + bfd_boolean dyn; + + off = h->got.offset; + BFD_ASSERT (off != (bfd_vma) -1); + dyn = globals->root.dynamic_sections_created; + + if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h) + || (info->shared + && SYMBOL_REFERENCES_LOCAL (info, h)) + || (ELF_ST_VISIBILITY (h->other) + && h->root.type == bfd_link_hash_undefweak)) + { + /* This is actually a static link, or it is a -Bsymbolic link + and the symbol is defined locally. We must initialize this + entry in the global offset table. Since the offset must + always be a multiple of 4, we use the least significant bit + to record whether we have initialized it already. + + When doing a dynamic link, we create a .rel(a).got relocation + entry to initialize the value. This is done in the + finish_dynamic_symbol routine. */ + if ((off & 1) != 0) + off &= ~1; + else + { + /* If we are addressing a Thumb function, we need to + adjust the address by one, so that attempts to + call the function pointer will correctly + interpret it as Thumb code. */ + if (sym_flags == STT_ARM_TFUNC) + value |= 1; + + bfd_put_32 (output_bfd, value, sgot->contents + off); + h->got.offset |= 1; + } + } + else + *unresolved_reloc_p = FALSE; + + value = sgot->output_offset + off; + } + else + { + bfd_vma off; + + BFD_ASSERT (local_got_offsets != NULL && + local_got_offsets[r_symndx] != (bfd_vma) -1); + + off = local_got_offsets[r_symndx]; + + /* The offset must always be a multiple of 4. We use the + least significant bit to record whether we have already + generated the necessary reloc. */ + if ((off & 1) != 0) + off &= ~1; + else + { + /* If we are addressing a Thumb function, we need to + adjust the address by one, so that attempts to + call the function pointer will correctly + interpret it as Thumb code. */ + if (sym_flags == STT_ARM_TFUNC) + value |= 1; + + if (globals->use_rel) + bfd_put_32 (output_bfd, value, sgot->contents + off); + + if (info->shared) + { + asection * srelgot; + Elf_Internal_Rela outrel; + bfd_byte *loc; + + srelgot = (bfd_get_section_by_name + (dynobj, RELOC_SECTION (globals, ".got"))); + BFD_ASSERT (srelgot != NULL); + + outrel.r_addend = addend + value; + outrel.r_offset = (sgot->output_section->vma + + sgot->output_offset + + off); + outrel.r_info = ELF32_R_INFO (0, R_ARM_RELATIVE); + loc = srelgot->contents; + loc += srelgot->reloc_count++ * RELOC_SIZE (globals); + SWAP_RELOC_OUT (globals) (output_bfd, &outrel, loc); + } + + local_got_offsets[r_symndx] |= 1; + } + + value = sgot->output_offset + off; + } + if (r_type != R_ARM_GOT32) + value += sgot->output_section->vma; + + return _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, rel->r_offset, value, + rel->r_addend); + + case R_ARM_TLS_LDO32: + value = value - dtpoff_base (info); + + return _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, rel->r_offset, value, + rel->r_addend); + + case R_ARM_TLS_LDM32: + { + bfd_vma off; + + if (globals->sgot == NULL) + abort (); + + off = globals->tls_ldm_got.offset; + + if ((off & 1) != 0) + off &= ~1; + else + { + /* If we don't know the module number, create a relocation + for it. */ + if (info->shared) + { + Elf_Internal_Rela outrel; + bfd_byte *loc; + + if (globals->srelgot == NULL) + abort (); + + outrel.r_addend = 0; + outrel.r_offset = (globals->sgot->output_section->vma + + globals->sgot->output_offset + off); + outrel.r_info = ELF32_R_INFO (0, R_ARM_TLS_DTPMOD32); + + if (globals->use_rel) + bfd_put_32 (output_bfd, outrel.r_addend, + globals->sgot->contents + off); + + loc = globals->srelgot->contents; + loc += globals->srelgot->reloc_count++ * RELOC_SIZE (globals); + SWAP_RELOC_OUT (globals) (output_bfd, &outrel, loc); + } + else + bfd_put_32 (output_bfd, 1, globals->sgot->contents + off); + + globals->tls_ldm_got.offset |= 1; + } + + value = globals->sgot->output_section->vma + globals->sgot->output_offset + off + - (input_section->output_section->vma + input_section->output_offset + rel->r_offset); + + return _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, rel->r_offset, value, + rel->r_addend); + } + + case R_ARM_TLS_GD32: + case R_ARM_TLS_IE32: + { + bfd_vma off; + int indx; + char tls_type; + + if (globals->sgot == NULL) + abort (); + + indx = 0; + if (h != NULL) + { + bfd_boolean dyn; + dyn = globals->root.dynamic_sections_created; + if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h) + && (!info->shared + || !SYMBOL_REFERENCES_LOCAL (info, h))) + { + *unresolved_reloc_p = FALSE; + indx = h->dynindx; + } + off = h->got.offset; + tls_type = ((struct elf32_arm_link_hash_entry *) h)->tls_type; + } + else + { + if (local_got_offsets == NULL) + abort (); + off = local_got_offsets[r_symndx]; + tls_type = elf32_arm_local_got_tls_type (input_bfd)[r_symndx]; + } + + if (tls_type == GOT_UNKNOWN) + abort (); + + if ((off & 1) != 0) + off &= ~1; + else + { + bfd_boolean need_relocs = FALSE; + Elf_Internal_Rela outrel; + bfd_byte *loc = NULL; + int cur_off = off; + + /* The GOT entries have not been initialized yet. Do it + now, and emit any relocations. If both an IE GOT and a + GD GOT are necessary, we emit the GD first. */ + + if ((info->shared || indx != 0) + && (h == NULL + || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT + || h->root.type != bfd_link_hash_undefweak)) + { + need_relocs = TRUE; + if (globals->srelgot == NULL) + abort (); + loc = globals->srelgot->contents; + loc += globals->srelgot->reloc_count * RELOC_SIZE (globals); + } + + if (tls_type & GOT_TLS_GD) + { + if (need_relocs) + { + outrel.r_addend = 0; + outrel.r_offset = (globals->sgot->output_section->vma + + globals->sgot->output_offset + + cur_off); + outrel.r_info = ELF32_R_INFO (indx, R_ARM_TLS_DTPMOD32); + + if (globals->use_rel) + bfd_put_32 (output_bfd, outrel.r_addend, + globals->sgot->contents + cur_off); + + SWAP_RELOC_OUT (globals) (output_bfd, &outrel, loc); + globals->srelgot->reloc_count++; + loc += RELOC_SIZE (globals); + + if (indx == 0) + bfd_put_32 (output_bfd, value - dtpoff_base (info), + globals->sgot->contents + cur_off + 4); + else + { + outrel.r_addend = 0; + outrel.r_info = ELF32_R_INFO (indx, + R_ARM_TLS_DTPOFF32); + outrel.r_offset += 4; + + if (globals->use_rel) + bfd_put_32 (output_bfd, outrel.r_addend, + globals->sgot->contents + cur_off + 4); + + + SWAP_RELOC_OUT (globals) (output_bfd, &outrel, loc); + globals->srelgot->reloc_count++; + loc += RELOC_SIZE (globals); + } + } + else + { + /* If we are not emitting relocations for a + general dynamic reference, then we must be in a + static link or an executable link with the + symbol binding locally. Mark it as belonging + to module 1, the executable. */ + bfd_put_32 (output_bfd, 1, + globals->sgot->contents + cur_off); + bfd_put_32 (output_bfd, value - dtpoff_base (info), + globals->sgot->contents + cur_off + 4); + } + + cur_off += 8; + } + + if (tls_type & GOT_TLS_IE) + { + if (need_relocs) + { + if (indx == 0) + outrel.r_addend = value - dtpoff_base (info); + else + outrel.r_addend = 0; + outrel.r_offset = (globals->sgot->output_section->vma + + globals->sgot->output_offset + + cur_off); + outrel.r_info = ELF32_R_INFO (indx, R_ARM_TLS_TPOFF32); + + if (globals->use_rel) + bfd_put_32 (output_bfd, outrel.r_addend, + globals->sgot->contents + cur_off); + + SWAP_RELOC_OUT (globals) (output_bfd, &outrel, loc); + globals->srelgot->reloc_count++; + loc += RELOC_SIZE (globals); + } + else + bfd_put_32 (output_bfd, tpoff (info, value), + globals->sgot->contents + cur_off); + cur_off += 4; + } + + if (h != NULL) + h->got.offset |= 1; + else + local_got_offsets[r_symndx] |= 1; + } + + if ((tls_type & GOT_TLS_GD) && r_type != R_ARM_TLS_GD32) + off += 8; + value = globals->sgot->output_section->vma + globals->sgot->output_offset + off + - (input_section->output_section->vma + input_section->output_offset + rel->r_offset); + + return _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, rel->r_offset, value, + rel->r_addend); + } + + case R_ARM_TLS_LE32: + if (info->shared) + { + (*_bfd_error_handler) + (_("%B(%A+0x%lx): R_ARM_TLS_LE32 relocation not permitted in shared object"), + input_bfd, input_section, + (long) rel->r_offset, howto->name); + return FALSE; + } + else + value = tpoff (info, value); + + return _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, rel->r_offset, value, + rel->r_addend); + + case R_ARM_V4BX: + if (globals->fix_v4bx) + { + bfd_vma insn = bfd_get_32 (input_bfd, hit_data); + + /* Ensure that we have a BX instruction. */ + BFD_ASSERT ((insn & 0x0ffffff0) == 0x012fff10); + + /* Preserve Rm (lowest four bits) and the condition code + (highest four bits). Other bits encode MOV PC,Rm. */ + insn = (insn & 0xf000000f) | 0x01a0f000; + + bfd_put_32 (input_bfd, insn, hit_data); + } + return bfd_reloc_ok; + + default: + return bfd_reloc_notsupported; + } +} + + +static int +uleb128_size (unsigned int i) +{ + int size; + size = 1; + while (i >= 0x80) + { + i >>= 7; + size++; + } + return size; +} + +/* Return TRUE if the attribute has the default value (0/""). */ +static bfd_boolean +is_default_attr (aeabi_attribute *attr) +{ + if ((attr->type & 1) && attr->i != 0) + return FALSE; + if ((attr->type & 2) && attr->s && *attr->s) + return FALSE; + + return TRUE; +} + +/* Return the size of a single attribute. */ +static bfd_vma +eabi_attr_size(int tag, aeabi_attribute *attr) +{ + bfd_vma size; + + if (is_default_attr (attr)) + return 0; + + size = uleb128_size (tag); + if (attr->type & 1) + size += uleb128_size (attr->i); + if (attr->type & 2) + size += strlen ((char *)attr->s) + 1; + return size; +} + +/* Returns the size of the eabi object attributess section. */ +bfd_vma +elf32_arm_eabi_attr_size (bfd *abfd) +{ + bfd_vma size; + aeabi_attribute *attr; + aeabi_attribute_list *list; + int i; + + attr = elf32_arm_tdata (abfd)->known_eabi_attributes; + size = 16; /* 'A' "aeabi" 0x1 . */ + for (i = 4; i < NUM_KNOWN_ATTRIBUTES; i++) + size += eabi_attr_size (i, &attr[i]); + + for (list = elf32_arm_tdata (abfd)->other_eabi_attributes; + list; + list = list->next) + size += eabi_attr_size (list->tag, &list->attr); + + return size; +} + +static bfd_byte * +write_uleb128 (bfd_byte *p, unsigned int val) +{ + bfd_byte c; + do + { + c = val & 0x7f; + val >>= 7; + if (val) + c |= 0x80; + *(p++) = c; + } + while (val); + return p; +} + +/* Write attribute ATTR to butter P, and return a pointer to the following + byte. */ +static bfd_byte * +write_eabi_attribute (bfd_byte *p, int tag, aeabi_attribute *attr) +{ + /* Suppress default entries. */ + if (is_default_attr(attr)) + return p; + + p = write_uleb128 (p, tag); + if (attr->type & 1) + p = write_uleb128 (p, attr->i); + if (attr->type & 2) + { + int len; + + len = strlen (attr->s) + 1; + memcpy (p, attr->s, len); + p += len; + } + + return p; +} + +/* Write the contents of the eabi attributes section to p. */ +void +elf32_arm_set_eabi_attr_contents (bfd *abfd, bfd_byte *contents, bfd_vma size) +{ + bfd_byte *p; + aeabi_attribute *attr; + aeabi_attribute_list *list; + int i; + + p = contents; + *(p++) = 'A'; + bfd_put_32 (abfd, size - 1, p); + p += 4; + memcpy (p, "aeabi", 6); + p += 6; + *(p++) = Tag_File; + bfd_put_32 (abfd, size - 11, p); + p += 4; + + attr = elf32_arm_tdata (abfd)->known_eabi_attributes; + for (i = 4; i < NUM_KNOWN_ATTRIBUTES; i++) + p = write_eabi_attribute (p, i, &attr[i]); + + for (list = elf32_arm_tdata (abfd)->other_eabi_attributes; + list; + list = list->next) + p = write_eabi_attribute (p, list->tag, &list->attr); +} + +/* Override final_link to handle EABI object attribute sections. */ + +static bfd_boolean +elf32_arm_bfd_final_link (bfd *abfd, struct bfd_link_info *info) +{ + asection *o; + struct bfd_link_order *p; + asection *attr_section = NULL; + bfd_byte *contents; + bfd_vma size = 0; + + /* elf32_arm_merge_private_bfd_data will already have merged the + object attributes. Remove the input sections from the link, and set + the contents of the output secton. */ + for (o = abfd->sections; o != NULL; o = o->next) + { + if (strcmp (o->name, ".ARM.attributes") == 0) + { + for (p = o->map_head.link_order; p != NULL; p = p->next) + { + asection *input_section; + + if (p->type != bfd_indirect_link_order) + continue; + 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; + } + + size = elf32_arm_eabi_attr_size (abfd); + bfd_set_section_size (abfd, o, size); + attr_section = o; + /* Skip this section later on. */ + o->map_head.link_order = NULL; + } + } + /* Invoke the ELF linker to do all the work. */ + if (!bfd_elf_final_link (abfd, info)) + return FALSE; + + if (attr_section) + { + contents = bfd_malloc(size); + if (contents == NULL) + return FALSE; + elf32_arm_set_eabi_attr_contents (abfd, contents, size); + bfd_set_section_contents (abfd, attr_section, contents, 0, size); + free (contents); + } + return TRUE; +} + + +/* Add INCREMENT to the reloc (of type HOWTO) at ADDRESS. */ +static void +arm_add_to_rel (bfd * abfd, + bfd_byte * address, + reloc_howto_type * howto, + bfd_signed_vma increment) +{ + bfd_signed_vma addend; + + if (howto->type == R_ARM_THM_CALL) + { + int upper_insn, lower_insn; + int upper, lower; + + upper_insn = bfd_get_16 (abfd, address); + lower_insn = bfd_get_16 (abfd, address + 2); + upper = upper_insn & 0x7ff; + lower = lower_insn & 0x7ff; + + addend = (upper << 12) | (lower << 1); + addend += increment; + addend >>= 1; + + upper_insn = (upper_insn & 0xf800) | ((addend >> 11) & 0x7ff); + lower_insn = (lower_insn & 0xf800) | (addend & 0x7ff); + + bfd_put_16 (abfd, (bfd_vma) upper_insn, address); + bfd_put_16 (abfd, (bfd_vma) lower_insn, address + 2); + } + else + { + bfd_vma contents; + + contents = bfd_get_32 (abfd, address); + + /* Get the (signed) value from the instruction. */ + addend = contents & howto->src_mask; + if (addend & ((howto->src_mask + 1) >> 1)) + { + bfd_signed_vma mask; + + mask = -1; + mask &= ~ howto->src_mask; + addend |= mask; + } + + /* Add in the increment, (which is a byte value). */ + switch (howto->type) + { + default: + addend += increment; + break; + + case R_ARM_PC24: + case R_ARM_PLT32: + case R_ARM_CALL: + case R_ARM_JUMP24: + addend <<= howto->size; + addend += increment; + + /* Should we check for overflow here ? */ + + /* Drop any undesired bits. */ + addend >>= howto->rightshift; + break; + } + + contents = (contents & ~ howto->dst_mask) | (addend & howto->dst_mask); + + bfd_put_32 (abfd, contents, address); + } +} + +#define IS_ARM_TLS_RELOC(R_TYPE) \ + ((R_TYPE) == R_ARM_TLS_GD32 \ + || (R_TYPE) == R_ARM_TLS_LDO32 \ + || (R_TYPE) == R_ARM_TLS_LDM32 \ + || (R_TYPE) == R_ARM_TLS_DTPOFF32 \ + || (R_TYPE) == R_ARM_TLS_DTPMOD32 \ + || (R_TYPE) == R_ARM_TLS_TPOFF32 \ + || (R_TYPE) == R_ARM_TLS_LE32 \ + || (R_TYPE) == R_ARM_TLS_IE32) + +/* Relocate an ARM ELF section. */ +static bfd_boolean +elf32_arm_relocate_section (bfd * output_bfd, + struct bfd_link_info * info, + bfd * input_bfd, + asection * input_section, + bfd_byte * contents, + Elf_Internal_Rela * relocs, + Elf_Internal_Sym * local_syms, + asection ** local_sections) +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + Elf_Internal_Rela *rel; + Elf_Internal_Rela *relend; + const char *name; + struct elf32_arm_link_hash_table * globals; + + globals = elf32_arm_hash_table (info); + if (info->relocatable && !globals->use_rel) + return TRUE; + + 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; + arelent bfd_reloc; + char sym_type; + bfd_boolean unresolved_reloc = FALSE; + + r_symndx = ELF32_R_SYM (rel->r_info); + r_type = ELF32_R_TYPE (rel->r_info); + r_type = arm_real_reloc_type (globals, r_type); + + if ( r_type == R_ARM_GNU_VTENTRY + || r_type == R_ARM_GNU_VTINHERIT) + continue; + + bfd_reloc.howto = elf32_arm_howto_from_type (r_type); + howto = bfd_reloc.howto; + + if (info->relocatable && globals->use_rel) + { + /* This is a relocatable link. We don't have to change + anything, unless the reloc is against a section symbol, + in which case we have to adjust according to where the + section symbol winds up in the output section. */ + if (r_symndx < symtab_hdr->sh_info) + { + sym = local_syms + r_symndx; + if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) + { + sec = local_sections[r_symndx]; + arm_add_to_rel (input_bfd, contents + rel->r_offset, + howto, + (bfd_signed_vma) (sec->output_offset + + sym->st_value)); + } + } + + continue; + } + + /* This is a final link. */ + h = NULL; + sym = NULL; + sec = NULL; + + if (r_symndx < symtab_hdr->sh_info) + { + sym = local_syms + r_symndx; + sym_type = ELF32_ST_TYPE (sym->st_info); + sec = local_sections[r_symndx]; + if (globals->use_rel) + { + relocation = (sec->output_section->vma + + sec->output_offset + + sym->st_value); + if ((sec->flags & SEC_MERGE) + && ELF_ST_TYPE (sym->st_info) == STT_SECTION) + { + asection *msec; + bfd_vma addend, value; + + if (howto->rightshift) + { + (*_bfd_error_handler) + (_("%B(%A+0x%lx): %s relocation against SEC_MERGE section"), + input_bfd, input_section, + (long) rel->r_offset, howto->name); + return FALSE; + } + + value = bfd_get_32 (input_bfd, contents + rel->r_offset); + + /* Get the (signed) value from the instruction. */ + addend = value & howto->src_mask; + if (addend & ((howto->src_mask + 1) >> 1)) + { + bfd_signed_vma mask; + + mask = -1; + mask &= ~ howto->src_mask; + addend |= mask; + } + msec = sec; + addend = + _bfd_elf_rel_local_sym (output_bfd, sym, &msec, addend) + - relocation; + addend += msec->output_section->vma + msec->output_offset; + value = (value & ~ howto->dst_mask) | (addend & howto->dst_mask); + bfd_put_32 (input_bfd, value, contents + rel->r_offset); + } + } + else + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + } + else + { + bfd_boolean warned; + + RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel, + r_symndx, symtab_hdr, sym_hashes, + h, sec, relocation, + unresolved_reloc, warned); + + sym_type = h->type; + } + + 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 || *name == '\0') + name = bfd_section_name (input_bfd, sec); + } + + if (r_symndx != 0 + && r_type != R_ARM_NONE + && (h == NULL + || h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + && IS_ARM_TLS_RELOC (r_type) != (sym_type == STT_TLS)) + { + (*_bfd_error_handler) + ((sym_type == STT_TLS + ? _("%B(%A+0x%lx): %s used with TLS symbol %s") + : _("%B(%A+0x%lx): %s used with non-TLS symbol %s")), + input_bfd, + input_section, + (long) rel->r_offset, + howto->name, + name); + } + + r = elf32_arm_final_link_relocate (howto, input_bfd, output_bfd, + input_section, contents, rel, + relocation, info, sec, name, + (h ? ELF_ST_TYPE (h->type) : + ELF_ST_TYPE (sym->st_info)), h, + &unresolved_reloc); + + /* Dynamic relocs are not propagated for SEC_DEBUGGING sections + because such sections are not SEC_ALLOC and thus ld.so will + not process them. */ + if (unresolved_reloc + && !((input_section->flags & SEC_DEBUGGING) != 0 + && h->def_dynamic)) + { + (*_bfd_error_handler) + (_("%B(%A+0x%lx): unresolvable %s relocation against symbol `%s'"), + input_bfd, + input_section, + (long) rel->r_offset, + howto->name, + h->root.root.string); + return FALSE; + } + + if (r != bfd_reloc_ok) + { + const char * msg = (const char *) 0; + + switch (r) + { + case bfd_reloc_overflow: + /* If the overflowing reloc was to an undefined symbol, + we have already printed one error message and there + is no point complaining again. */ + if ((! h || + h->root.type != bfd_link_hash_undefined) + && (!((*info->callbacks->reloc_overflow) + (info, (h ? &h->root : NULL), name, howto->name, + (bfd_vma) 0, input_bfd, input_section, + rel->r_offset)))) + return FALSE; + break; + + case bfd_reloc_undefined: + if (!((*info->callbacks->undefined_symbol) + (info, name, input_bfd, input_section, + rel->r_offset, TRUE))) + return FALSE; + break; + + case bfd_reloc_outofrange: + msg = _("internal error: out of range error"); + goto common_error; + + case bfd_reloc_notsupported: + msg = _("internal error: unsupported relocation error"); + goto common_error; + + case bfd_reloc_dangerous: + msg = _("internal error: dangerous error"); + goto common_error; + + default: + msg = _("internal error: unknown error"); + /* fall through */ + + common_error: + if (!((*info->callbacks->warning) + (info, msg, name, input_bfd, input_section, + rel->r_offset))) + return FALSE; + break; + } + } + } + + return TRUE; +} + +/* Allocate/find an object attribute. */ +static aeabi_attribute * +elf32_arm_new_eabi_attr (bfd *abfd, int tag) +{ + aeabi_attribute *attr; + aeabi_attribute_list *list; + aeabi_attribute_list *p; + aeabi_attribute_list **lastp; + + + if (tag < NUM_KNOWN_ATTRIBUTES) + { + /* Knwon tags are preallocated. */ + attr = &elf32_arm_tdata (abfd)->known_eabi_attributes[tag]; + } + else + { + /* Create a new tag. */ + list = (aeabi_attribute_list *) + bfd_alloc (abfd, sizeof (aeabi_attribute_list)); + memset (list, 0, sizeof (aeabi_attribute_list)); + list->tag = tag; + /* Keep the tag list in order. */ + lastp = &elf32_arm_tdata (abfd)->other_eabi_attributes; + for (p = *lastp; p; p = p->next) + { + if (tag < p->tag) + break; + lastp = &p->next; + } + list->next = *lastp; + *lastp = list; + attr = &list->attr; + } + + return attr; +} + +int +elf32_arm_get_eabi_attr_int (bfd *abfd, int tag) +{ + aeabi_attribute_list *p; + + if (tag < NUM_KNOWN_ATTRIBUTES) + { + /* Knwon tags are preallocated. */ + return elf32_arm_tdata (abfd)->known_eabi_attributes[tag].i; + } + else + { + for (p = elf32_arm_tdata (abfd)->other_eabi_attributes; + p; + p = p->next) + { + if (tag == p->tag) + return p->attr.i; + if (tag < p->tag) + break; + } + return 0; + } +} + +void +elf32_arm_add_eabi_attr_int (bfd *abfd, int tag, unsigned int i) +{ + aeabi_attribute *attr; + + attr = elf32_arm_new_eabi_attr (abfd, tag); + attr->type = 1; + attr->i = i; +} + +static char * +attr_strdup (bfd *abfd, const char * s) +{ + char * p; + int len; + + len = strlen (s) + 1; + p = (char *)bfd_alloc(abfd, len); + return memcpy (p, s, len); +} + +void +elf32_arm_add_eabi_attr_string (bfd *abfd, int tag, const char *s) +{ + aeabi_attribute *attr; + + attr = elf32_arm_new_eabi_attr (abfd, tag); + attr->type = 2; + attr->s = attr_strdup (abfd, s); +} + +void +elf32_arm_add_eabi_attr_compat (bfd *abfd, unsigned int i, const char *s) +{ + aeabi_attribute_list *list; + aeabi_attribute_list *p; + aeabi_attribute_list **lastp; + + list = (aeabi_attribute_list *) + bfd_alloc (abfd, sizeof (aeabi_attribute_list)); + memset (list, 0, sizeof (aeabi_attribute_list)); + list->tag = Tag_compatibility; + list->attr.type = 3; + list->attr.i = i; + list->attr.s = attr_strdup (abfd, s); + + lastp = &elf32_arm_tdata (abfd)->other_eabi_attributes; + for (p = *lastp; p; p = p->next) + { + int cmp; + if (p->tag != Tag_compatibility) + break; + cmp = strcmp(s, p->attr.s); + if (cmp < 0 || (cmp == 0 && i < p->attr.i)) + break; + lastp = &p->next; + } + list->next = *lastp; + *lastp = list; +} + +/* Set the right machine number. */ + +static bfd_boolean +elf32_arm_object_p (bfd *abfd) +{ + unsigned int mach; + + mach = bfd_arm_get_mach_from_notes (abfd, ARM_NOTE_SECTION); + + if (mach != bfd_mach_arm_unknown) + bfd_default_set_arch_mach (abfd, bfd_arch_arm, mach); + + else if (elf_elfheader (abfd)->e_flags & EF_ARM_MAVERICK_FLOAT) + bfd_default_set_arch_mach (abfd, bfd_arch_arm, bfd_mach_arm_ep9312); + + else + bfd_default_set_arch_mach (abfd, bfd_arch_arm, mach); + + return TRUE; +} + +/* Function to keep ARM specific flags in the ELF header. */ + +static bfd_boolean +elf32_arm_set_private_flags (bfd *abfd, flagword flags) +{ + if (elf_flags_init (abfd) + && elf_elfheader (abfd)->e_flags != flags) + { + if (EF_ARM_EABI_VERSION (flags) == EF_ARM_EABI_UNKNOWN) + { + if (flags & EF_ARM_INTERWORK) + (*_bfd_error_handler) + (_("Warning: Not setting interworking flag of %B since it has already been specified as non-interworking"), + abfd); + else + _bfd_error_handler + (_("Warning: Clearing the interworking flag of %B due to outside request"), + abfd); + } + } + else + { + elf_elfheader (abfd)->e_flags = flags; + elf_flags_init (abfd) = TRUE; + } + + return TRUE; +} + +/* Copy the eabi object attribute from IBFD to OBFD. */ +static void +copy_eabi_attributes (bfd *ibfd, bfd *obfd) +{ + aeabi_attribute *in_attr; + aeabi_attribute *out_attr; + aeabi_attribute_list *list; + int i; + + in_attr = elf32_arm_tdata (ibfd)->known_eabi_attributes; + out_attr = elf32_arm_tdata (obfd)->known_eabi_attributes; + for (i = 4; i < NUM_KNOWN_ATTRIBUTES; i++) + { + out_attr->i = in_attr->i; + if (in_attr->s && *in_attr->s) + out_attr->s = attr_strdup (obfd, in_attr->s); + in_attr++; + out_attr++; + } + + for (list = elf32_arm_tdata (ibfd)->other_eabi_attributes; + list; + list = list->next) + { + in_attr = &list->attr; + switch (in_attr->type) + { + case 1: + elf32_arm_add_eabi_attr_int (obfd, list->tag, in_attr->i); + break; + case 2: + elf32_arm_add_eabi_attr_string (obfd, list->tag, in_attr->s); + break; + case 3: + elf32_arm_add_eabi_attr_compat (obfd, in_attr->i, in_attr->s); + break; + default: + abort(); + } + } +} + + +/* Copy backend specific data from one object module to another. */ + +static bfd_boolean +elf32_arm_copy_private_bfd_data (bfd *ibfd, bfd *obfd) +{ + flagword in_flags; + flagword out_flags; + + if ( bfd_get_flavour (ibfd) != bfd_target_elf_flavour + || bfd_get_flavour (obfd) != bfd_target_elf_flavour) + return TRUE; + + in_flags = elf_elfheader (ibfd)->e_flags; + out_flags = elf_elfheader (obfd)->e_flags; + + if (elf_flags_init (obfd) + && EF_ARM_EABI_VERSION (out_flags) == EF_ARM_EABI_UNKNOWN + && in_flags != out_flags) + { + /* Cannot mix APCS26 and APCS32 code. */ + if ((in_flags & EF_ARM_APCS_26) != (out_flags & EF_ARM_APCS_26)) + return FALSE; + + /* Cannot mix float APCS and non-float APCS code. */ + if ((in_flags & EF_ARM_APCS_FLOAT) != (out_flags & EF_ARM_APCS_FLOAT)) + return FALSE; + + /* If the src and dest have different interworking flags + then turn off the interworking bit. */ + if ((in_flags & EF_ARM_INTERWORK) != (out_flags & EF_ARM_INTERWORK)) + { + if (out_flags & EF_ARM_INTERWORK) + _bfd_error_handler + (_("Warning: Clearing the interworking flag of %B because non-interworking code in %B has been linked with it"), + obfd, ibfd); + + in_flags &= ~EF_ARM_INTERWORK; + } + + /* Likewise for PIC, though don't warn for this case. */ + if ((in_flags & EF_ARM_PIC) != (out_flags & EF_ARM_PIC)) + in_flags &= ~EF_ARM_PIC; + } + + elf_elfheader (obfd)->e_flags = in_flags; + elf_flags_init (obfd) = TRUE; + + /* Also copy the EI_OSABI field. */ + elf_elfheader (obfd)->e_ident[EI_OSABI] = + elf_elfheader (ibfd)->e_ident[EI_OSABI]; + + /* Copy EABI object attributes. */ + copy_eabi_attributes (ibfd, obfd); + + return TRUE; +} + +/* Values for Tag_ABI_PCS_R9_use. */ +enum +{ + AEABI_R9_V6, + AEABI_R9_SB, + AEABI_R9_TLS, + AEABI_R9_unused +}; + +/* Values for Tag_ABI_PCS_RW_data. */ +enum +{ + AEABI_PCS_RW_data_absolute, + AEABI_PCS_RW_data_PCrel, + AEABI_PCS_RW_data_SBrel, + AEABI_PCS_RW_data_unused +}; + +/* Values for Tag_ABI_enum_size. */ +enum +{ + AEABI_enum_unused, + AEABI_enum_short, + AEABI_enum_wide, + AEABI_enum_forced_wide +}; + +/* Merge EABI object attributes from IBFD into OBFD. Raise an error if there + are conflicting attributes. */ +static bfd_boolean +elf32_arm_merge_eabi_attributes (bfd *ibfd, bfd *obfd) +{ + aeabi_attribute *in_attr; + aeabi_attribute *out_attr; + aeabi_attribute_list *in_list; + aeabi_attribute_list *out_list; + /* Some tags have 0 = don't care, 1 = strong requirement, + 2 = weak requirement. */ + static const int order_312[3] = {3, 1, 2}; + int i; + + if (!elf32_arm_tdata (ibfd)->known_eabi_attributes[0].i) + { + /* This is the first object. Copy the attributes. */ + copy_eabi_attributes (ibfd, obfd); + return TRUE; + } + + /* Use the Tag_null value to indicate the attributes have been + initialized. */ + elf32_arm_tdata (ibfd)->known_eabi_attributes[0].i = 1; + + in_attr = elf32_arm_tdata (ibfd)->known_eabi_attributes; + out_attr = elf32_arm_tdata (obfd)->known_eabi_attributes; + /* This needs to happen before Tag_ABI_FP_number_model is merged. */ + if (in_attr[Tag_ABI_VFP_args].i != out_attr[Tag_ABI_VFP_args].i) + { + /* Ignore mismatches if teh object doesn't use floating point. */ + if (out_attr[Tag_ABI_FP_number_model].i == 0) + out_attr[Tag_ABI_VFP_args].i = in_attr[Tag_ABI_VFP_args].i; + else if (in_attr[Tag_ABI_FP_number_model].i != 0) + { + _bfd_error_handler + (_("ERROR: %B uses VFP register arguments, %B does not"), + ibfd, obfd); + return FALSE; + } + } + + for (i = 4; i < NUM_KNOWN_ATTRIBUTES; i++) + { + /* Merge this attribute with existing attributes. */ + switch (i) + { + case Tag_CPU_raw_name: + case Tag_CPU_name: + /* Use whichever has the greatest architecture requirements. */ + if (in_attr[Tag_CPU_arch].i > out_attr[Tag_CPU_arch].i) + out_attr[i].s = attr_strdup(obfd, in_attr[i].s); + break; + + case Tag_ABI_optimization_goals: + case Tag_ABI_FP_optimization_goals: + /* Use the first value seen. */ + break; + + case Tag_CPU_arch: + case Tag_ARM_ISA_use: + case Tag_THUMB_ISA_use: + case Tag_VFP_arch: + case Tag_WMMX_arch: + case Tag_NEON_arch: + /* ??? Do NEON and WMMX conflict? */ + case Tag_ABI_FP_rounding: + case Tag_ABI_FP_denormal: + case Tag_ABI_FP_exceptions: + case Tag_ABI_FP_user_exceptions: + case Tag_ABI_FP_number_model: + case Tag_ABI_align8_preserved: + case Tag_ABI_HardFP_use: + /* Use the largest value specified. */ + if (in_attr[i].i > out_attr[i].i) + out_attr[i].i = in_attr[i].i; + break; + + case Tag_CPU_arch_profile: + /* Warn if conflicting architecture profiles used. */ + if (out_attr[i].i && in_attr[i].i && in_attr[i].i != out_attr[i].i) + { + _bfd_error_handler + (_("ERROR: %B: Conflicting architecture profiles %c/%c"), + ibfd, in_attr[i].i, out_attr[i].i); + return FALSE; + } + if (in_attr[i].i) + out_attr[i].i = in_attr[i].i; + break; + case Tag_PCS_config: + if (out_attr[i].i == 0) + out_attr[i].i = in_attr[i].i; + else if (in_attr[i].i != 0 && out_attr[i].i != 0) + { + /* It's sometimes ok to mix different configs, so this is only + a warning. */ + _bfd_error_handler + (_("Warning: %B: Conflicting platform configuration"), ibfd); + } + break; + case Tag_ABI_PCS_R9_use: + if (out_attr[i].i != AEABI_R9_unused + && in_attr[i].i != AEABI_R9_unused) + { + _bfd_error_handler + (_("ERROR: %B: Conflicting use of R9"), ibfd); + return FALSE; + } + if (out_attr[i].i == AEABI_R9_unused) + out_attr[i].i = in_attr[i].i; + break; + case Tag_ABI_PCS_RW_data: + if (in_attr[i].i == AEABI_PCS_RW_data_SBrel + && out_attr[Tag_ABI_PCS_R9_use].i != AEABI_R9_SB + && out_attr[Tag_ABI_PCS_R9_use].i != AEABI_R9_unused) + { + _bfd_error_handler + (_("ERROR: %B: SB relative addressing conflicts with use of R9"), + ibfd); + return FALSE; + } + /* Use the smallest value specified. */ + if (in_attr[i].i < out_attr[i].i) + out_attr[i].i = in_attr[i].i; + break; + case Tag_ABI_PCS_RO_data: + /* Use the smallest value specified. */ + if (in_attr[i].i < out_attr[i].i) + out_attr[i].i = in_attr[i].i; + break; + case Tag_ABI_PCS_GOT_use: + if (in_attr[i].i > 2 || out_attr[i].i > 2 + || order_312[in_attr[i].i] < order_312[out_attr[i].i]) + out_attr[i].i = in_attr[i].i; + break; + case Tag_ABI_PCS_wchar_t: + if (out_attr[i].i && in_attr[i].i && out_attr[i].i != in_attr[i].i) + { + _bfd_error_handler + (_("ERROR: %B: Conflicting definitions of wchar_t"), ibfd); + return FALSE; + } + if (in_attr[i].i) + out_attr[i].i = in_attr[i].i; + break; + case Tag_ABI_align8_needed: + /* ??? Check against Tag_ABI_align8_preserved. */ + if (in_attr[i].i > 2 || out_attr[i].i > 2 + || order_312[in_attr[i].i] < order_312[out_attr[i].i]) + out_attr[i].i = in_attr[i].i; + break; + case Tag_ABI_enum_size: + if (in_attr[i].i != AEABI_enum_unused) + { + if (out_attr[i].i == AEABI_enum_unused + || out_attr[i].i == AEABI_enum_forced_wide) + { + /* The existing object is compatible with anything. + Use whatever requirements the new object has. */ + out_attr[i].i = in_attr[i].i; + } + else if (in_attr[i].i != AEABI_enum_forced_wide + && out_attr[i].i != in_attr[i].i) + { + _bfd_error_handler + (_("ERROR: %B: Conflicting enum sizes"), ibfd); + } + } + break; + case Tag_ABI_VFP_args: + /* Aready done. */ + break; + case Tag_ABI_WMMX_args: + if (in_attr[i].i != out_attr[i].i) + { + _bfd_error_handler + (_("ERROR: %B uses iWMMXt register arguments, %B does not"), + ibfd, obfd); + return FALSE; + } + break; + default: /* All known attributes should be explicitly covered. */ + abort (); + } + } + + in_list = elf32_arm_tdata (ibfd)->other_eabi_attributes; + out_list = elf32_arm_tdata (ibfd)->other_eabi_attributes; + while (in_list && in_list->tag == Tag_compatibility) + { + in_attr = &in_list->attr; + if (in_attr->i == 0) + continue; + if (in_attr->i == 1) + { + _bfd_error_handler + (_("ERROR: %B: Must be processed by '%s' toolchain"), + ibfd, in_attr->s); + return FALSE; + } + if (!out_list || out_list->tag != Tag_compatibility + || strcmp (in_attr->s, out_list->attr.s) != 0) + { + /* Add this compatibility tag to the output. */ + elf32_arm_add_eabi_attr_compat (obfd, in_attr->i, in_attr->s); + continue; + } + out_attr = &out_list->attr; + /* Check all the input tags with the same identifier. */ + for (;;) + { + if (out_list->tag != Tag_compatibility + || in_attr->i != out_attr->i + || strcmp (in_attr->s, out_attr->s) != 0) + { + _bfd_error_handler + (_("ERROR: %B: Incompatible object tag '%s':%d"), + ibfd, in_attr->s, in_attr->i); + return FALSE; + } + in_list = in_list->next; + if (in_list->tag != Tag_compatibility + || strcmp (in_attr->s, in_list->attr.s) != 0) + break; + in_attr = &in_list->attr; + out_list = out_list->next; + if (out_list) + out_attr = &out_list->attr; + } + + /* Check the output doesn't have extra tags with this identifier. */ + if (out_list && out_list->tag == Tag_compatibility + && strcmp (in_attr->s, out_list->attr.s) == 0) + { + _bfd_error_handler + (_("ERROR: %B: Incompatible object tag '%s':%d"), + ibfd, in_attr->s, out_list->attr.i); + return FALSE; + } + } + + for (; in_list; in_list = in_list->next) + { + if ((in_list->tag & 128) < 64) + { + _bfd_error_handler + (_("Warning: %B: Unknown EABI object attribute %d"), + ibfd, in_list->tag); + break; + } + } + return TRUE; +} + + +/* Return TRUE if the two EABI versions are incompatible. */ + +static bfd_boolean +elf32_arm_versions_compatible (unsigned iver, unsigned over) +{ + /* v4 and v5 are the same spec before and after it was released, + so allow mixing them. */ + if ((iver == EF_ARM_EABI_VER4 && over == EF_ARM_EABI_VER5) + || (iver == EF_ARM_EABI_VER5 && over == EF_ARM_EABI_VER4)) + return TRUE; + + return (iver == over); +} + +/* Merge backend specific data from an object file to the output + object file when linking. */ + +static bfd_boolean +elf32_arm_merge_private_bfd_data (bfd * ibfd, bfd * obfd) +{ + flagword out_flags; + flagword in_flags; + bfd_boolean flags_compatible = TRUE; + asection *sec; + + /* Check if we have the same endianess. */ + if (! _bfd_generic_verify_endian_match (ibfd, obfd)) + return FALSE; + + if ( bfd_get_flavour (ibfd) != bfd_target_elf_flavour + || bfd_get_flavour (obfd) != bfd_target_elf_flavour) + return TRUE; + + if (!elf32_arm_merge_eabi_attributes (ibfd, obfd)) + return FALSE; + + /* The input BFD must have had its flags initialised. */ + /* The following seems bogus to me -- The flags are initialized in + the assembler but I don't think an elf_flags_init field is + written into the object. */ + /* BFD_ASSERT (elf_flags_init (ibfd)); */ + + in_flags = elf_elfheader (ibfd)->e_flags; + out_flags = elf_elfheader (obfd)->e_flags; + + if (!elf_flags_init (obfd)) + { + /* If the input is the default architecture and had the default + flags then do not bother setting the flags for the output + architecture, instead allow future merges to do this. If no + future merges ever set these flags then they will retain their + uninitialised values, which surprise surprise, correspond + to the default values. */ + if (bfd_get_arch_info (ibfd)->the_default + && elf_elfheader (ibfd)->e_flags == 0) + return TRUE; + + elf_flags_init (obfd) = TRUE; + elf_elfheader (obfd)->e_flags = in_flags; + + if (bfd_get_arch (obfd) == bfd_get_arch (ibfd) + && bfd_get_arch_info (obfd)->the_default) + return bfd_set_arch_mach (obfd, bfd_get_arch (ibfd), bfd_get_mach (ibfd)); + + return TRUE; + } + + /* Determine what should happen if the input ARM architecture + does not match the output ARM architecture. */ + if (! bfd_arm_merge_machines (ibfd, obfd)) + return FALSE; + + /* Identical flags must be compatible. */ + if (in_flags == out_flags) + return TRUE; + + /* Check to see if the input BFD actually contains any sections. If + not, its flags may not have been initialised either, but it + cannot actually cause any incompatiblity. Do not short-circuit + dynamic objects; their section list may be emptied by + elf_link_add_object_symbols. + + Also check to see if there are no code sections in the input. + In this case there is no need to check for code specific flags. + XXX - do we need to worry about floating-point format compatability + in data sections ? */ + if (!(ibfd->flags & DYNAMIC)) + { + bfd_boolean null_input_bfd = TRUE; + bfd_boolean only_data_sections = TRUE; + + for (sec = ibfd->sections; sec != NULL; sec = sec->next) + { + /* Ignore synthetic glue sections. */ + if (strcmp (sec->name, ".glue_7") + && strcmp (sec->name, ".glue_7t")) + { + if ((bfd_get_section_flags (ibfd, sec) + & (SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS)) + == (SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS)) + only_data_sections = FALSE; + + null_input_bfd = FALSE; + break; + } + } + + if (null_input_bfd || only_data_sections) + return TRUE; + } + + /* Complain about various flag mismatches. */ + if (!elf32_arm_versions_compatible (EF_ARM_EABI_VERSION (in_flags), + EF_ARM_EABI_VERSION (out_flags))) + { + _bfd_error_handler + (_("ERROR: Source object %B has EABI version %d, but target %B has EABI version %d"), + ibfd, obfd, + (in_flags & EF_ARM_EABIMASK) >> 24, + (out_flags & EF_ARM_EABIMASK) >> 24); + return FALSE; + } + + /* Not sure what needs to be checked for EABI versions >= 1. */ + /* VxWorks libraries do not use these flags. */ + if (get_elf_backend_data (obfd) != &elf32_arm_vxworks_bed + && get_elf_backend_data (ibfd) != &elf32_arm_vxworks_bed + && EF_ARM_EABI_VERSION (in_flags) == EF_ARM_EABI_UNKNOWN) + { + if ((in_flags & EF_ARM_APCS_26) != (out_flags & EF_ARM_APCS_26)) + { + _bfd_error_handler + (_("ERROR: %B is compiled for APCS-%d, whereas target %B uses APCS-%d"), + ibfd, obfd, + in_flags & EF_ARM_APCS_26 ? 26 : 32, + out_flags & EF_ARM_APCS_26 ? 26 : 32); + flags_compatible = FALSE; + } + + if ((in_flags & EF_ARM_APCS_FLOAT) != (out_flags & EF_ARM_APCS_FLOAT)) + { + if (in_flags & EF_ARM_APCS_FLOAT) + _bfd_error_handler + (_("ERROR: %B passes floats in float registers, whereas %B passes them in integer registers"), + ibfd, obfd); + else + _bfd_error_handler + (_("ERROR: %B passes floats in integer registers, whereas %B passes them in float registers"), + ibfd, obfd); + + flags_compatible = FALSE; + } + + if ((in_flags & EF_ARM_VFP_FLOAT) != (out_flags & EF_ARM_VFP_FLOAT)) + { + if (in_flags & EF_ARM_VFP_FLOAT) + _bfd_error_handler + (_("ERROR: %B uses VFP instructions, whereas %B does not"), + ibfd, obfd); + else + _bfd_error_handler + (_("ERROR: %B uses FPA instructions, whereas %B does not"), + ibfd, obfd); + + flags_compatible = FALSE; + } + + if ((in_flags & EF_ARM_MAVERICK_FLOAT) != (out_flags & EF_ARM_MAVERICK_FLOAT)) + { + if (in_flags & EF_ARM_MAVERICK_FLOAT) + _bfd_error_handler + (_("ERROR: %B uses Maverick instructions, whereas %B does not"), + ibfd, obfd); + else + _bfd_error_handler + (_("ERROR: %B does not use Maverick instructions, whereas %B does"), + ibfd, obfd); + + flags_compatible = FALSE; + } + +#ifdef EF_ARM_SOFT_FLOAT + if ((in_flags & EF_ARM_SOFT_FLOAT) != (out_flags & EF_ARM_SOFT_FLOAT)) + { + /* We can allow interworking between code that is VFP format + layout, and uses either soft float or integer regs for + passing floating point arguments and results. We already + know that the APCS_FLOAT flags match; similarly for VFP + flags. */ + if ((in_flags & EF_ARM_APCS_FLOAT) != 0 + || (in_flags & EF_ARM_VFP_FLOAT) == 0) + { + if (in_flags & EF_ARM_SOFT_FLOAT) + _bfd_error_handler + (_("ERROR: %B uses software FP, whereas %B uses hardware FP"), + ibfd, obfd); + else + _bfd_error_handler + (_("ERROR: %B uses hardware FP, whereas %B uses software FP"), + ibfd, obfd); + + flags_compatible = FALSE; + } + } +#endif + + /* Interworking mismatch is only a warning. */ + if ((in_flags & EF_ARM_INTERWORK) != (out_flags & EF_ARM_INTERWORK)) + { + if (in_flags & EF_ARM_INTERWORK) + { + _bfd_error_handler + (_("Warning: %B supports interworking, whereas %B does not"), + ibfd, obfd); + } + else + { + _bfd_error_handler + (_("Warning: %B does not support interworking, whereas %B does"), + ibfd, obfd); + } + } + } + + return flags_compatible; +} + +/* Display the flags field. */ + +static bfd_boolean +elf32_arm_print_private_bfd_data (bfd *abfd, void * ptr) +{ + FILE * file = (FILE *) ptr; + unsigned long flags; + + BFD_ASSERT (abfd != NULL && ptr != NULL); + + /* Print normal ELF private data. */ + _bfd_elf_print_private_bfd_data (abfd, ptr); + + flags = elf_elfheader (abfd)->e_flags; + /* Ignore init flag - it may not be set, despite the flags field + containing valid data. */ + + /* xgettext:c-format */ + fprintf (file, _("private flags = %lx:"), elf_elfheader (abfd)->e_flags); + + switch (EF_ARM_EABI_VERSION (flags)) + { + case EF_ARM_EABI_UNKNOWN: + /* The following flag bits are GNU extensions and not part of the + official ARM ELF extended ABI. Hence they are only decoded if + the EABI version is not set. */ + if (flags & EF_ARM_INTERWORK) + fprintf (file, _(" [interworking enabled]")); + + if (flags & EF_ARM_APCS_26) + fprintf (file, " [APCS-26]"); + else + fprintf (file, " [APCS-32]"); + + if (flags & EF_ARM_VFP_FLOAT) + fprintf (file, _(" [VFP float format]")); + else if (flags & EF_ARM_MAVERICK_FLOAT) + fprintf (file, _(" [Maverick float format]")); + else + fprintf (file, _(" [FPA float format]")); + + if (flags & EF_ARM_APCS_FLOAT) + fprintf (file, _(" [floats passed in float registers]")); + + if (flags & EF_ARM_PIC) + fprintf (file, _(" [position independent]")); + + if (flags & EF_ARM_NEW_ABI) + fprintf (file, _(" [new ABI]")); + + if (flags & EF_ARM_OLD_ABI) + fprintf (file, _(" [old ABI]")); + + if (flags & EF_ARM_SOFT_FLOAT) + fprintf (file, _(" [software FP]")); + + flags &= ~(EF_ARM_INTERWORK | EF_ARM_APCS_26 | EF_ARM_APCS_FLOAT + | EF_ARM_PIC | EF_ARM_NEW_ABI | EF_ARM_OLD_ABI + | EF_ARM_SOFT_FLOAT | EF_ARM_VFP_FLOAT + | EF_ARM_MAVERICK_FLOAT); + break; + + case EF_ARM_EABI_VER1: + fprintf (file, _(" [Version1 EABI]")); + + if (flags & EF_ARM_SYMSARESORTED) + fprintf (file, _(" [sorted symbol table]")); + else + fprintf (file, _(" [unsorted symbol table]")); + + flags &= ~ EF_ARM_SYMSARESORTED; + break; + + case EF_ARM_EABI_VER2: + fprintf (file, _(" [Version2 EABI]")); + + if (flags & EF_ARM_SYMSARESORTED) + fprintf (file, _(" [sorted symbol table]")); + else + fprintf (file, _(" [unsorted symbol table]")); + + if (flags & EF_ARM_DYNSYMSUSESEGIDX) + fprintf (file, _(" [dynamic symbols use segment index]")); + + if (flags & EF_ARM_MAPSYMSFIRST) + fprintf (file, _(" [mapping symbols precede others]")); + + flags &= ~(EF_ARM_SYMSARESORTED | EF_ARM_DYNSYMSUSESEGIDX + | EF_ARM_MAPSYMSFIRST); + break; + + case EF_ARM_EABI_VER3: + fprintf (file, _(" [Version3 EABI]")); + break; + + case EF_ARM_EABI_VER4: + fprintf (file, _(" [Version4 EABI]")); + goto eabi; + + case EF_ARM_EABI_VER5: + fprintf (file, _(" [Version5 EABI]")); + eabi: + if (flags & EF_ARM_BE8) + fprintf (file, _(" [BE8]")); + + if (flags & EF_ARM_LE8) + fprintf (file, _(" [LE8]")); + + flags &= ~(EF_ARM_LE8 | EF_ARM_BE8); + break; + + default: + fprintf (file, _(" ")); + break; + } + + flags &= ~ EF_ARM_EABIMASK; + + if (flags & EF_ARM_RELEXEC) + fprintf (file, _(" [relocatable executable]")); + + if (flags & EF_ARM_HASENTRY) + fprintf (file, _(" [has entry point]")); + + flags &= ~ (EF_ARM_RELEXEC | EF_ARM_HASENTRY); + + if (flags) + fprintf (file, _("")); + + fputc ('\n', file); + + return TRUE; +} + +static int +elf32_arm_get_symbol_type (Elf_Internal_Sym * elf_sym, int type) +{ + switch (ELF_ST_TYPE (elf_sym->st_info)) + { + case STT_ARM_TFUNC: + return ELF_ST_TYPE (elf_sym->st_info); + + case STT_ARM_16BIT: + /* If the symbol is not an object, return the STT_ARM_16BIT flag. + This allows us to distinguish between data used by Thumb instructions + and non-data (which is probably code) inside Thumb regions of an + executable. */ + if (type != STT_OBJECT && type != STT_TLS) + return ELF_ST_TYPE (elf_sym->st_info); + break; + + default: + break; + } + + return type; +} + +static asection * +elf32_arm_gc_mark_hook (asection * sec, + struct bfd_link_info * info ATTRIBUTE_UNUSED, + Elf_Internal_Rela * rel, + struct elf_link_hash_entry * h, + Elf_Internal_Sym * sym) +{ + if (h != NULL) + { + switch (ELF32_R_TYPE (rel->r_info)) + { + case R_ARM_GNU_VTINHERIT: + case R_ARM_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 + return bfd_section_from_elf_index (sec->owner, sym->st_shndx); + + return NULL; +} + +/* Update the got entry reference counts for the section being removed. */ + +static bfd_boolean +elf32_arm_gc_sweep_hook (bfd * abfd, + struct bfd_link_info * info, + asection * sec, + const Elf_Internal_Rela * relocs) +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + bfd_signed_vma *local_got_refcounts; + const Elf_Internal_Rela *rel, *relend; + struct elf32_arm_link_hash_table * globals; + + globals = elf32_arm_hash_table (info); + + elf_section_data (sec)->local_dynrel = NULL; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (abfd); + local_got_refcounts = elf_local_got_refcounts (abfd); + + relend = relocs + sec->reloc_count; + for (rel = relocs; rel < relend; rel++) + { + unsigned long r_symndx; + struct elf_link_hash_entry *h = NULL; + int r_type; + + r_symndx = ELF32_R_SYM (rel->r_info); + if (r_symndx >= symtab_hdr->sh_info) + { + 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; + } + + r_type = ELF32_R_TYPE (rel->r_info); + r_type = arm_real_reloc_type (globals, r_type); + switch (r_type) + { + case R_ARM_GOT32: + case R_ARM_GOT_PREL: + case R_ARM_TLS_GD32: + case R_ARM_TLS_IE32: + if (h != NULL) + { + if (h->got.refcount > 0) + h->got.refcount -= 1; + } + else if (local_got_refcounts != NULL) + { + if (local_got_refcounts[r_symndx] > 0) + local_got_refcounts[r_symndx] -= 1; + } + break; + + case R_ARM_TLS_LDM32: + elf32_arm_hash_table (info)->tls_ldm_got.refcount -= 1; + break; + + case R_ARM_ABS32: + case R_ARM_REL32: + case R_ARM_PC24: + case R_ARM_PLT32: + case R_ARM_CALL: + case R_ARM_JUMP24: + case R_ARM_PREL31: + case R_ARM_THM_CALL: + /* Should the interworking branches be here also? */ + + if (h != NULL) + { + struct elf32_arm_link_hash_entry *eh; + struct elf32_arm_relocs_copied **pp; + struct elf32_arm_relocs_copied *p; + + eh = (struct elf32_arm_link_hash_entry *) h; + + if (h->plt.refcount > 0) + { + h->plt.refcount -= 1; + if (ELF32_R_TYPE (rel->r_info) == R_ARM_THM_CALL) + eh->plt_thumb_refcount--; + } + + if (r_type == R_ARM_ABS32 + || r_type == R_ARM_REL32) + { + for (pp = &eh->relocs_copied; (p = *pp) != NULL; + pp = &p->next) + if (p->section == sec) + { + p->count -= 1; + if (ELF32_R_TYPE (rel->r_info) == R_ARM_REL32) + p->pc_count -= 1; + if (p->count == 0) + *pp = p->next; + break; + } + } + } + break; + + default: + break; + } + } + + return TRUE; +} + +/* Look through the relocs for a section during the first phase. */ + +static bfd_boolean +elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info, + asection *sec, const Elf_Internal_Rela *relocs) +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + struct elf_link_hash_entry **sym_hashes_end; + const Elf_Internal_Rela *rel; + const Elf_Internal_Rela *rel_end; + bfd *dynobj; + asection *sreloc; + bfd_vma *local_got_offsets; + struct elf32_arm_link_hash_table *htab; + + if (info->relocatable) + return TRUE; + + htab = elf32_arm_hash_table (info); + sreloc = NULL; + + /* Create dynamic sections for relocatable executables so that we can + copy relocations. */ + if (htab->root.is_relocatable_executable + && ! htab->root.dynamic_sections_created) + { + if (! _bfd_elf_link_create_dynamic_sections (abfd, info)) + return FALSE; + } + + dynobj = elf_hash_table (info)->dynobj; + local_got_offsets = elf_local_got_offsets (abfd); + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (abfd); + sym_hashes_end = sym_hashes + + symtab_hdr->sh_size / sizeof (Elf32_External_Sym); + + if (!elf_bad_symtab (abfd)) + sym_hashes_end -= symtab_hdr->sh_info; + + rel_end = relocs + sec->reloc_count; + for (rel = relocs; rel < rel_end; rel++) + { + struct elf_link_hash_entry *h; + struct elf32_arm_link_hash_entry *eh; + unsigned long r_symndx; + int r_type; + + r_symndx = ELF32_R_SYM (rel->r_info); + r_type = ELF32_R_TYPE (rel->r_info); + r_type = arm_real_reloc_type (htab, r_type); + + if (r_symndx >= NUM_SHDR_ENTRIES (symtab_hdr)) + { + (*_bfd_error_handler) (_("%B: bad symbol index: %d"), abfd, + r_symndx); + return FALSE; + } + + if (r_symndx < symtab_hdr->sh_info) + h = NULL; + 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; + } + + eh = (struct elf32_arm_link_hash_entry *) h; + + switch (r_type) + { + case R_ARM_GOT32: + case R_ARM_GOT_PREL: + case R_ARM_TLS_GD32: + case R_ARM_TLS_IE32: + /* This symbol requires a global offset table entry. */ + { + int tls_type, old_tls_type; + + switch (r_type) + { + case R_ARM_TLS_GD32: tls_type = GOT_TLS_GD; break; + case R_ARM_TLS_IE32: tls_type = GOT_TLS_IE; break; + default: tls_type = GOT_NORMAL; break; + } + + if (h != NULL) + { + h->got.refcount++; + old_tls_type = elf32_arm_hash_entry (h)->tls_type; + } + else + { + bfd_signed_vma *local_got_refcounts; + + /* This is a global offset table entry for a local symbol. */ + local_got_refcounts = elf_local_got_refcounts (abfd); + if (local_got_refcounts == NULL) + { + bfd_size_type size; + + size = symtab_hdr->sh_info; + size *= (sizeof (bfd_signed_vma) + sizeof(char)); + local_got_refcounts = bfd_zalloc (abfd, size); + if (local_got_refcounts == NULL) + return FALSE; + elf_local_got_refcounts (abfd) = local_got_refcounts; + elf32_arm_local_got_tls_type (abfd) + = (char *) (local_got_refcounts + symtab_hdr->sh_info); + } + local_got_refcounts[r_symndx] += 1; + old_tls_type = elf32_arm_local_got_tls_type (abfd) [r_symndx]; + } + + /* We will already have issued an error message if there is a + TLS / non-TLS mismatch, based on the symbol type. We don't + support any linker relaxations. So just combine any TLS + types needed. */ + if (old_tls_type != GOT_UNKNOWN && old_tls_type != GOT_NORMAL + && tls_type != GOT_NORMAL) + tls_type |= old_tls_type; + + if (old_tls_type != tls_type) + { + if (h != NULL) + elf32_arm_hash_entry (h)->tls_type = tls_type; + else + elf32_arm_local_got_tls_type (abfd) [r_symndx] = tls_type; + } + } + /* Fall through */ + + case R_ARM_TLS_LDM32: + if (r_type == R_ARM_TLS_LDM32) + htab->tls_ldm_got.refcount++; + /* Fall through */ + + case R_ARM_GOTOFF32: + case R_ARM_GOTPC: + if (htab->sgot == NULL) + { + if (htab->root.dynobj == NULL) + htab->root.dynobj = abfd; + if (!create_got_section (htab->root.dynobj, info)) + return FALSE; + } + break; + + case R_ARM_ABS12: + /* VxWorks uses dynamic R_ARM_ABS12 relocations for + ldr __GOTT_INDEX__ offsets. */ + if (!htab->vxworks_p) + break; + /* Fall through */ + + case R_ARM_ABS32: + case R_ARM_REL32: + case R_ARM_PC24: + case R_ARM_PLT32: + case R_ARM_CALL: + case R_ARM_JUMP24: + case R_ARM_PREL31: + case R_ARM_THM_CALL: + /* Should the interworking branches be listed here? */ + if (h != NULL) + { + /* If this reloc is in a read-only section, we might + need a copy reloc. We can't check reliably at this + stage whether the section is read-only, as input + sections have not yet been mapped to output sections. + Tentatively set the flag for now, and correct in + adjust_dynamic_symbol. */ + if (!info->shared) + h->non_got_ref = 1; + + /* We may need a .plt entry if the function this reloc + refers to is in a different object. We can't tell for + sure yet, because something later might force the + symbol local. */ + if (r_type == R_ARM_PC24 + || r_type == R_ARM_CALL + || r_type == R_ARM_JUMP24 + || r_type == R_ARM_PREL31 + || r_type == R_ARM_PLT32 + || r_type == R_ARM_THM_CALL) + h->needs_plt = 1; + + /* If we create a PLT entry, this relocation will reference + it, even if it's an ABS32 relocation. */ + h->plt.refcount += 1; + + if (r_type == R_ARM_THM_CALL) + eh->plt_thumb_refcount += 1; + } + + /* If we are creating a shared library or relocatable executable, + and this is a reloc against a global symbol, or a non PC + relative reloc against a local symbol, then we need to copy + the reloc into the shared library. However, if we are linking + with -Bsymbolic, we do not need to copy a reloc against a + global symbol which is defined in an object we are + including in the link (i.e., DEF_REGULAR is set). At + this point we have not seen all the input files, so it is + possible that DEF_REGULAR is not set now but will be set + later (it is never cleared). We account for that + possibility below by storing information in the + relocs_copied field of the hash table entry. */ + if ((info->shared || htab->root.is_relocatable_executable) + && (sec->flags & SEC_ALLOC) != 0 + && (r_type == R_ARM_ABS32 + || (h != NULL && ! h->needs_plt + && (! info->symbolic || ! h->def_regular)))) + { + struct elf32_arm_relocs_copied *p, **head; + + /* When creating a shared object, we must copy these + reloc types into the output file. We create a reloc + section in dynobj and make room for this reloc. */ + if (sreloc == NULL) + { + const char * name; + + name = (bfd_elf_string_from_elf_section + (abfd, + elf_elfheader (abfd)->e_shstrndx, + elf_section_data (sec)->rel_hdr.sh_name)); + if (name == NULL) + return FALSE; + + BFD_ASSERT (reloc_section_p (htab, name, sec)); + + sreloc = bfd_get_section_by_name (dynobj, name); + if (sreloc == NULL) + { + flagword flags; + + flags = (SEC_HAS_CONTENTS | SEC_READONLY + | SEC_IN_MEMORY | SEC_LINKER_CREATED); + if ((sec->flags & SEC_ALLOC) != 0 + /* BPABI objects never have dynamic + relocations mapped. */ + && !htab->symbian_p) + flags |= SEC_ALLOC | SEC_LOAD; + sreloc = bfd_make_section_with_flags (dynobj, + name, + flags); + if (sreloc == NULL + || ! bfd_set_section_alignment (dynobj, sreloc, 2)) + return FALSE; + } + + elf_section_data (sec)->sreloc = sreloc; + } + + /* If this is a global symbol, we count the number of + relocations we need for this symbol. */ + if (h != NULL) + { + head = &((struct elf32_arm_link_hash_entry *) h)->relocs_copied; + } + else + { + /* Track dynamic relocs needed for local syms too. + We really need local syms available to do this + easily. Oh well. */ + + asection *s; + void *vpp; + + s = bfd_section_from_r_symndx (abfd, &htab->sym_sec, + sec, r_symndx); + if (s == NULL) + return FALSE; + + vpp = &elf_section_data (s)->local_dynrel; + head = (struct elf32_arm_relocs_copied **) vpp; + } + + p = *head; + if (p == NULL || p->section != sec) + { + bfd_size_type amt = sizeof *p; + + p = bfd_alloc (htab->root.dynobj, amt); + if (p == NULL) + return FALSE; + p->next = *head; + *head = p; + p->section = sec; + p->count = 0; + p->pc_count = 0; + } + + if (r_type == R_ARM_REL32) + p->pc_count += 1; + p->count += 1; + } + break; + + /* This relocation describes the C++ object vtable hierarchy. + Reconstruct it for later use during GC. */ + case R_ARM_GNU_VTINHERIT: + if (!bfd_elf_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_ARM_GNU_VTENTRY: + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_offset)) + return FALSE; + break; + } + } + + return TRUE; +} + +/* Treat mapping symbols as special target symbols. */ + +static bfd_boolean +elf32_arm_is_target_special_symbol (bfd * abfd ATTRIBUTE_UNUSED, asymbol * sym) +{ + return bfd_is_arm_mapping_symbol_name (sym->name); +} + +/* This is a copy of elf_find_function() from elf.c except that + ARM mapping symbols are ignored when looking for function names + and STT_ARM_TFUNC is considered to a function type. */ + +static bfd_boolean +arm_elf_find_function (bfd * abfd ATTRIBUTE_UNUSED, + asection * section, + asymbol ** symbols, + bfd_vma offset, + const char ** filename_ptr, + const char ** functionname_ptr) +{ + const char * filename = NULL; + asymbol * func = NULL; + bfd_vma low_func = 0; + asymbol ** p; + + for (p = symbols; *p != NULL; p++) + { + elf_symbol_type *q; + + q = (elf_symbol_type *) *p; + + switch (ELF_ST_TYPE (q->internal_elf_sym.st_info)) + { + default: + break; + case STT_FILE: + filename = bfd_asymbol_name (&q->symbol); + break; + case STT_FUNC: + case STT_ARM_TFUNC: + case STT_NOTYPE: + /* Skip $a and $t symbols. */ + if ((q->symbol.flags & BSF_LOCAL) + && bfd_is_arm_mapping_symbol_name (q->symbol.name)) + continue; + /* Fall through. */ + if (bfd_get_section (&q->symbol) == section + && q->symbol.value >= low_func + && q->symbol.value <= offset) + { + func = (asymbol *) q; + low_func = q->symbol.value; + } + break; + } + } + + if (func == NULL) + return FALSE; + + if (filename_ptr) + *filename_ptr = filename; + if (functionname_ptr) + *functionname_ptr = bfd_asymbol_name (func); + + return TRUE; +} + + +/* Find the nearest line to a particular section and offset, for error + reporting. This code is a duplicate of the code in elf.c, except + that it uses arm_elf_find_function. */ + +static bfd_boolean +elf32_arm_find_nearest_line (bfd * abfd, + asection * section, + asymbol ** symbols, + bfd_vma offset, + const char ** filename_ptr, + const char ** functionname_ptr, + unsigned int * line_ptr) +{ + bfd_boolean found = FALSE; + + /* We skip _bfd_dwarf1_find_nearest_line since no known ARM toolchain uses it. */ + + if (_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset, + filename_ptr, functionname_ptr, + line_ptr, 0, + & elf_tdata (abfd)->dwarf2_find_line_info)) + { + if (!*functionname_ptr) + arm_elf_find_function (abfd, section, symbols, offset, + *filename_ptr ? NULL : filename_ptr, + functionname_ptr); + + return TRUE; + } + + if (! _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, + & found, filename_ptr, + functionname_ptr, line_ptr, + & elf_tdata (abfd)->line_info)) + return FALSE; + + if (found && (*functionname_ptr || *line_ptr)) + return TRUE; + + if (symbols == NULL) + return FALSE; + + if (! arm_elf_find_function (abfd, section, symbols, offset, + filename_ptr, functionname_ptr)) + return FALSE; + + *line_ptr = 0; + return TRUE; +} + +static bfd_boolean +elf32_arm_find_inliner_info (bfd * abfd, + const char ** filename_ptr, + const char ** functionname_ptr, + unsigned int * line_ptr) +{ + bfd_boolean found; + found = _bfd_dwarf2_find_inliner_info (abfd, filename_ptr, + functionname_ptr, line_ptr, + & elf_tdata (abfd)->dwarf2_find_line_info); + return found; +} + +/* Adjust a symbol defined by a dynamic object and referenced by a + regular object. The current definition is in some section of the + dynamic object, but we're not including those sections. We have to + change the definition to something the rest of the link can + understand. */ + +static bfd_boolean +elf32_arm_adjust_dynamic_symbol (struct bfd_link_info * info, + struct elf_link_hash_entry * h) +{ + bfd * dynobj; + asection * s; + unsigned int power_of_two; + struct elf32_arm_link_hash_entry * eh; + struct elf32_arm_link_hash_table *globals; + + globals = elf32_arm_hash_table (info); + dynobj = elf_hash_table (info)->dynobj; + + /* Make sure we know what is going on here. */ + BFD_ASSERT (dynobj != NULL + && (h->needs_plt + || h->u.weakdef != NULL + || (h->def_dynamic + && h->ref_regular + && !h->def_regular))); + + eh = (struct elf32_arm_link_hash_entry *) h; + + /* If this is a function, put it in the procedure linkage table. We + will fill in the contents of the procedure linkage table later, + when we know the address of the .got section. */ + if (h->type == STT_FUNC || h->type == STT_ARM_TFUNC + || h->needs_plt) + { + if (h->plt.refcount <= 0 + || SYMBOL_CALLS_LOCAL (info, h) + || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT + && h->root.type == bfd_link_hash_undefweak)) + { + /* This case can occur if we saw a PLT32 reloc in an input + file, but the symbol was never referred to by a dynamic + object, or if all references were garbage collected. In + such a case, we don't actually need to build a procedure + linkage table, and we can just do a PC24 reloc instead. */ + h->plt.offset = (bfd_vma) -1; + eh->plt_thumb_refcount = 0; + h->needs_plt = 0; + } + + return TRUE; + } + else + { + /* It's possible that we incorrectly decided a .plt reloc was + needed for an R_ARM_PC24 or similar reloc to a non-function sym + in check_relocs. We can't decide accurately between function + and non-function syms in check-relocs; Objects loaded later in + the link may change h->type. So fix it now. */ + h->plt.offset = (bfd_vma) -1; + eh->plt_thumb_refcount = 0; + } + + /* 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->u.weakdef != NULL) + { + BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined + || h->u.weakdef->root.type == bfd_link_hash_defweak); + h->root.u.def.section = h->u.weakdef->root.u.def.section; + h->root.u.def.value = h->u.weakdef->root.u.def.value; + return TRUE; + } + + /* If there are no non-GOT references, we do not need a copy + relocation. */ + if (!h->non_got_ref) + return TRUE; + + /* This is a reference to a symbol defined by a dynamic object which + is not a function. */ + + /* If we are creating a shared library, we must presume that the + only references to the symbol are via the global offset table. + For such cases we need not do anything here; the relocations will + be handled correctly by relocate_section. Relocatable executables + can reference data in shared objects directly, so we don't need to + do anything here. */ + if (info->shared || globals->root.is_relocatable_executable) + return TRUE; + + if (h->size == 0) + { + (*_bfd_error_handler) (_("dynamic variable `%s' is zero size"), + h->root.root.string); + return TRUE; + } + + /* We must allocate the symbol in our .dynbss section, which will + become part of the .bss section of the executable. There will be + an entry for this symbol in the .dynsym section. The dynamic + object will contain position independent code, so all references + from the dynamic object to this symbol will go through the global + offset table. The dynamic linker will use the .dynsym entry to + determine the address it must put in the global offset table, so + both the dynamic object and the regular object will refer to the + same memory location for the variable. */ + s = bfd_get_section_by_name (dynobj, ".dynbss"); + BFD_ASSERT (s != NULL); + + /* We must generate a R_ARM_COPY reloc to tell the dynamic linker to + copy the initial value out of the dynamic object and into the + runtime process image. We need to remember the offset into the + .rel(a).bss section we are going to use. */ + if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) + { + asection *srel; + + srel = bfd_get_section_by_name (dynobj, RELOC_SECTION (globals, ".bss")); + BFD_ASSERT (srel != NULL); + srel->size += RELOC_SIZE (globals); + h->needs_copy = 1; + } + + /* We need to figure out the alignment required for this symbol. I + have no idea how ELF linkers handle this. */ + power_of_two = bfd_log2 (h->size); + if (power_of_two > 3) + power_of_two = 3; + + /* Apply the required alignment. */ + s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two)); + if (power_of_two > bfd_get_section_alignment (dynobj, s)) + { + if (! bfd_set_section_alignment (dynobj, s, power_of_two)) + return FALSE; + } + + /* Define the symbol as being at this point in the section. */ + h->root.u.def.section = s; + h->root.u.def.value = s->size; + + /* Increment the section size to make room for the symbol. */ + s->size += h->size; + + return TRUE; +} + +/* Allocate space in .plt, .got and associated reloc sections for + dynamic relocs. */ + +static bfd_boolean +allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) +{ + struct bfd_link_info *info; + struct elf32_arm_link_hash_table *htab; + struct elf32_arm_link_hash_entry *eh; + struct elf32_arm_relocs_copied *p; + + eh = (struct elf32_arm_link_hash_entry *) h; + + if (h->root.type == bfd_link_hash_indirect) + return TRUE; + + if (h->root.type == bfd_link_hash_warning) + /* When warning symbols are created, they **replace** the "real" + entry in the hash table, thus we never get to see the real + symbol in a hash traversal. So look at it now. */ + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + info = (struct bfd_link_info *) inf; + htab = elf32_arm_hash_table (info); + + if (htab->root.dynamic_sections_created + && h->plt.refcount > 0) + { + /* Make sure this symbol is output as a dynamic symbol. + Undefined weak syms won't yet be marked as dynamic. */ + if (h->dynindx == -1 + && !h->forced_local) + { + if (! bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } + + if (info->shared + || WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h)) + { + asection *s = htab->splt; + + /* If this is the first .plt entry, make room for the special + first entry. */ + if (s->size == 0) + s->size += htab->plt_header_size; + + h->plt.offset = s->size; + + /* If we will insert a Thumb trampoline before this PLT, leave room + for it. */ + if (!htab->use_blx && eh->plt_thumb_refcount > 0) + { + h->plt.offset += PLT_THUMB_STUB_SIZE; + s->size += PLT_THUMB_STUB_SIZE; + } + + /* If this symbol is not defined in a regular file, and we are + not generating a shared library, then set the symbol to this + location in the .plt. This is required to make function + pointers compare as equal between the normal executable and + the shared library. */ + if (! info->shared + && !h->def_regular) + { + h->root.u.def.section = s; + h->root.u.def.value = h->plt.offset; + + /* Make sure the function is not marked as Thumb, in case + it is the target of an ABS32 relocation, which will + point to the PLT entry. */ + if (ELF_ST_TYPE (h->type) == STT_ARM_TFUNC) + h->type = ELF_ST_INFO (ELF_ST_BIND (h->type), STT_FUNC); + } + + /* Make room for this entry. */ + s->size += htab->plt_entry_size; + + if (!htab->symbian_p) + { + /* We also need to make an entry in the .got.plt section, which + will be placed in the .got section by the linker script. */ + eh->plt_got_offset = htab->sgotplt->size; + htab->sgotplt->size += 4; + } + + /* We also need to make an entry in the .rel(a).plt section. */ + htab->srelplt->size += RELOC_SIZE (htab); + + /* VxWorks executables have a second set of relocations for + each PLT entry. They go in a separate relocation section, + which is processed by the kernel loader. */ + if (htab->vxworks_p && !info->shared) + { + /* There is a relocation for the initial PLT entry: + an R_ARM_32 relocation for _GLOBAL_OFFSET_TABLE_. */ + if (h->plt.offset == htab->plt_header_size) + htab->srelplt2->size += RELOC_SIZE (htab); + + /* There are two extra relocations for each subsequent + PLT entry: an R_ARM_32 relocation for the GOT entry, + and an R_ARM_32 relocation for the PLT entry. */ + htab->srelplt2->size += RELOC_SIZE (htab) * 2; + } + } + else + { + h->plt.offset = (bfd_vma) -1; + h->needs_plt = 0; + } + } + else + { + h->plt.offset = (bfd_vma) -1; + h->needs_plt = 0; + } + + if (h->got.refcount > 0) + { + asection *s; + bfd_boolean dyn; + int tls_type = elf32_arm_hash_entry (h)->tls_type; + int indx; + + /* Make sure this symbol is output as a dynamic symbol. + Undefined weak syms won't yet be marked as dynamic. */ + if (h->dynindx == -1 + && !h->forced_local) + { + if (! bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } + + if (!htab->symbian_p) + { + s = htab->sgot; + h->got.offset = s->size; + + if (tls_type == GOT_UNKNOWN) + abort (); + + if (tls_type == GOT_NORMAL) + /* Non-TLS symbols need one GOT slot. */ + s->size += 4; + else + { + if (tls_type & GOT_TLS_GD) + /* R_ARM_TLS_GD32 needs 2 consecutive GOT slots. */ + s->size += 8; + if (tls_type & GOT_TLS_IE) + /* R_ARM_TLS_IE32 needs one GOT slot. */ + s->size += 4; + } + + dyn = htab->root.dynamic_sections_created; + + indx = 0; + if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h) + && (!info->shared + || !SYMBOL_REFERENCES_LOCAL (info, h))) + indx = h->dynindx; + + if (tls_type != GOT_NORMAL + && (info->shared || indx != 0) + && (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT + || h->root.type != bfd_link_hash_undefweak)) + { + if (tls_type & GOT_TLS_IE) + htab->srelgot->size += RELOC_SIZE (htab); + + if (tls_type & GOT_TLS_GD) + htab->srelgot->size += RELOC_SIZE (htab); + + if ((tls_type & GOT_TLS_GD) && indx != 0) + htab->srelgot->size += RELOC_SIZE (htab); + } + else if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT + || h->root.type != bfd_link_hash_undefweak) + && (info->shared + || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h))) + htab->srelgot->size += RELOC_SIZE (htab); + } + } + else + h->got.offset = (bfd_vma) -1; + + if (eh->relocs_copied == NULL) + return TRUE; + + /* In the shared -Bsymbolic case, discard space allocated for + dynamic pc-relative relocs against symbols which turn out to be + defined in regular objects. For the normal shared case, discard + space for pc-relative relocs that have become local due to symbol + visibility changes. */ + + if (info->shared || htab->root.is_relocatable_executable) + { + /* The only reloc that uses pc_count is R_ARM_REL32, which will + appear on something like ".long foo - .". We want calls to + protected symbols to resolve directly to the function rather + than going via the plt. If people want function pointer + comparisons to work as expected then they should avoid + writing assembly like ".long foo - .". */ + if (SYMBOL_CALLS_LOCAL (info, h)) + { + struct elf32_arm_relocs_copied **pp; + + for (pp = &eh->relocs_copied; (p = *pp) != NULL; ) + { + p->count -= p->pc_count; + p->pc_count = 0; + if (p->count == 0) + *pp = p->next; + else + pp = &p->next; + } + } + + /* Also discard relocs on undefined weak syms with non-default + visibility. */ + if (eh->relocs_copied != NULL + && h->root.type == bfd_link_hash_undefweak) + { + if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT) + eh->relocs_copied = NULL; + + /* Make sure undefined weak symbols are output as a dynamic + symbol in PIEs. */ + else if (h->dynindx == -1 + && !h->forced_local) + { + if (! bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } + } + + else if (htab->root.is_relocatable_executable && h->dynindx == -1 + && h->root.type == bfd_link_hash_new) + { + /* Output absolute symbols so that we can create relocations + against them. For normal symbols we output a relocation + against the section that contains them. */ + if (! bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } + + } + else + { + /* For the non-shared case, discard space for relocs against + symbols which turn out to need copy relocs or are not + dynamic. */ + + if (!h->non_got_ref + && ((h->def_dynamic + && !h->def_regular) + || (htab->root.dynamic_sections_created + && (h->root.type == bfd_link_hash_undefweak + || h->root.type == bfd_link_hash_undefined)))) + { + /* Make sure this symbol is output as a dynamic symbol. + Undefined weak syms won't yet be marked as dynamic. */ + if (h->dynindx == -1 + && !h->forced_local) + { + if (! bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } + + /* If that succeeded, we know we'll be keeping all the + relocs. */ + if (h->dynindx != -1) + goto keep; + } + + eh->relocs_copied = NULL; + + keep: ; + } + + /* Finally, allocate space. */ + for (p = eh->relocs_copied; p != NULL; p = p->next) + { + asection *sreloc = elf_section_data (p->section)->sreloc; + sreloc->size += p->count * RELOC_SIZE (htab); + } + + return TRUE; +} + +/* Find any dynamic relocs that apply to read-only sections. */ + +static bfd_boolean +elf32_arm_readonly_dynrelocs (struct elf_link_hash_entry *h, PTR inf) +{ + struct elf32_arm_link_hash_entry *eh; + struct elf32_arm_relocs_copied *p; + + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + eh = (struct elf32_arm_link_hash_entry *) h; + for (p = eh->relocs_copied; p != NULL; p = p->next) + { + asection *s = p->section; + + if (s != NULL && (s->flags & SEC_READONLY) != 0) + { + struct bfd_link_info *info = (struct bfd_link_info *) inf; + + info->flags |= DF_TEXTREL; + + /* Not an error, just cut short the traversal. */ + return FALSE; + } + } + return TRUE; +} + +/* Set the sizes of the dynamic sections. */ + +static bfd_boolean +elf32_arm_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED, + struct bfd_link_info * info) +{ + bfd * dynobj; + asection * s; + bfd_boolean plt; + bfd_boolean relocs; + bfd *ibfd; + struct elf32_arm_link_hash_table *htab; + + htab = elf32_arm_hash_table (info); + dynobj = elf_hash_table (info)->dynobj; + BFD_ASSERT (dynobj != NULL); + check_use_blx (htab); + + if (elf_hash_table (info)->dynamic_sections_created) + { + /* Set the contents of the .interp section to the interpreter. */ + if (info->executable) + { + s = bfd_get_section_by_name (dynobj, ".interp"); + BFD_ASSERT (s != NULL); + s->size = sizeof ELF_DYNAMIC_INTERPRETER; + s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER; + } + } + + /* Set up .got offsets for local syms, and space for local dynamic + relocs. */ + for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) + { + bfd_signed_vma *local_got; + bfd_signed_vma *end_local_got; + char *local_tls_type; + bfd_size_type locsymcount; + Elf_Internal_Shdr *symtab_hdr; + asection *srel; + + if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour) + continue; + + for (s = ibfd->sections; s != NULL; s = s->next) + { + struct elf32_arm_relocs_copied *p; + + for (p = elf_section_data (s)->local_dynrel; p != NULL; p = p->next) + { + if (!bfd_is_abs_section (p->section) + && bfd_is_abs_section (p->section->output_section)) + { + /* Input section has been discarded, either because + it is a copy of a linkonce section or due to + linker script /DISCARD/, so we'll be discarding + the relocs too. */ + } + else if (p->count != 0) + { + srel = elf_section_data (p->section)->sreloc; + srel->size += p->count * RELOC_SIZE (htab); + if ((p->section->output_section->flags & SEC_READONLY) != 0) + info->flags |= DF_TEXTREL; + } + } + } + + local_got = elf_local_got_refcounts (ibfd); + if (!local_got) + continue; + + symtab_hdr = &elf_tdata (ibfd)->symtab_hdr; + locsymcount = symtab_hdr->sh_info; + end_local_got = local_got + locsymcount; + local_tls_type = elf32_arm_local_got_tls_type (ibfd); + s = htab->sgot; + srel = htab->srelgot; + for (; local_got < end_local_got; ++local_got, ++local_tls_type) + { + if (*local_got > 0) + { + *local_got = s->size; + if (*local_tls_type & GOT_TLS_GD) + /* TLS_GD relocs need an 8-byte structure in the GOT. */ + s->size += 8; + if (*local_tls_type & GOT_TLS_IE) + s->size += 4; + if (*local_tls_type == GOT_NORMAL) + s->size += 4; + + if (info->shared || *local_tls_type == GOT_TLS_GD) + srel->size += RELOC_SIZE (htab); + } + else + *local_got = (bfd_vma) -1; + } + } + + if (htab->tls_ldm_got.refcount > 0) + { + /* Allocate two GOT entries and one dynamic relocation (if necessary) + for R_ARM_TLS_LDM32 relocations. */ + htab->tls_ldm_got.offset = htab->sgot->size; + htab->sgot->size += 8; + if (info->shared) + htab->srelgot->size += RELOC_SIZE (htab); + } + else + htab->tls_ldm_got.offset = -1; + + /* Allocate global sym .plt and .got entries, and space for global + sym dynamic relocs. */ + elf_link_hash_traverse (& htab->root, allocate_dynrelocs, info); + + /* The check_relocs and adjust_dynamic_symbol entry points have + determined the sizes of the various dynamic sections. Allocate + memory for them. */ + plt = FALSE; + relocs = FALSE; + for (s = dynobj->sections; s != NULL; s = s->next) + { + const char * name; + + if ((s->flags & SEC_LINKER_CREATED) == 0) + continue; + + /* It's OK to base decisions on the section name, because none + of the dynobj section names depend upon the input files. */ + name = bfd_get_section_name (dynobj, s); + + if (strcmp (name, ".plt") == 0) + { + /* Remember whether there is a PLT. */ + plt = s->size != 0; + } + else if (strncmp (name, ".rel", 4) == 0) + { + if (s->size != 0) + { + /* Remember whether there are any reloc sections other + than .rel(a).plt and .rela.plt.unloaded. */ + if (s != htab->srelplt && s != htab->srelplt2) + relocs = TRUE; + + /* We use the reloc_count field as a counter if we need + to copy relocs into the output file. */ + s->reloc_count = 0; + } + } + else if (strncmp (name, ".got", 4) != 0 + && strcmp (name, ".dynbss") != 0) + { + /* It's not one of our sections, so don't allocate space. */ + continue; + } + + if (s->size == 0) + { + /* If we don't need this section, strip it from the + output file. This is mostly to handle .rel(a).bss and + .rel(a).plt. We must create both sections in + create_dynamic_sections, because they must be created + before the linker maps input sections to output + sections. The linker does that before + adjust_dynamic_symbol is called, and it is that + function which decides whether anything needs to go + into these sections. */ + s->flags |= SEC_EXCLUDE; + continue; + } + + if ((s->flags & SEC_HAS_CONTENTS) == 0) + continue; + + /* Allocate memory for the section contents. */ + s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->size); + if (s->contents == NULL) + return FALSE; + } + + if (elf_hash_table (info)->dynamic_sections_created) + { + /* Add some entries to the .dynamic section. We fill in the + values later, in elf32_arm_finish_dynamic_sections, but we + must add the entries now so that we get the correct size for + the .dynamic section. The DT_DEBUG entry is filled in by the + dynamic linker and used by the debugger. */ +#define add_dynamic_entry(TAG, VAL) \ + _bfd_elf_add_dynamic_entry (info, TAG, VAL) + + if (info->executable) + { + if (!add_dynamic_entry (DT_DEBUG, 0)) + return FALSE; + } + + if (plt) + { + if ( !add_dynamic_entry (DT_PLTGOT, 0) + || !add_dynamic_entry (DT_PLTRELSZ, 0) + || !add_dynamic_entry (DT_PLTREL, + htab->use_rel ? DT_REL : DT_RELA) + || !add_dynamic_entry (DT_JMPREL, 0)) + return FALSE; + } + + if (relocs) + { + if (htab->use_rel) + { + if (!add_dynamic_entry (DT_REL, 0) + || !add_dynamic_entry (DT_RELSZ, 0) + || !add_dynamic_entry (DT_RELENT, RELOC_SIZE (htab))) + return FALSE; + } + else + { + if (!add_dynamic_entry (DT_RELA, 0) + || !add_dynamic_entry (DT_RELASZ, 0) + || !add_dynamic_entry (DT_RELAENT, RELOC_SIZE (htab))) + return FALSE; + } + } + + /* If any dynamic relocs apply to a read-only section, + then we need a DT_TEXTREL entry. */ + if ((info->flags & DF_TEXTREL) == 0) + elf_link_hash_traverse (&htab->root, elf32_arm_readonly_dynrelocs, + (PTR) info); + + if ((info->flags & DF_TEXTREL) != 0) + { + if (!add_dynamic_entry (DT_TEXTREL, 0)) + return FALSE; + } + } +#undef add_dynamic_entry + + return TRUE; +} + +/* Finish up dynamic symbol handling. We set the contents of various + dynamic sections here. */ + +static bfd_boolean +elf32_arm_finish_dynamic_symbol (bfd * output_bfd, struct bfd_link_info * info, + struct elf_link_hash_entry * h, Elf_Internal_Sym * sym) +{ + bfd * dynobj; + struct elf32_arm_link_hash_table *htab; + struct elf32_arm_link_hash_entry *eh; + + dynobj = elf_hash_table (info)->dynobj; + htab = elf32_arm_hash_table (info); + eh = (struct elf32_arm_link_hash_entry *) h; + + if (h->plt.offset != (bfd_vma) -1) + { + asection * splt; + asection * srel; + bfd_byte *loc; + bfd_vma plt_index; + Elf_Internal_Rela rel; + + /* This symbol has an entry in the procedure linkage table. Set + it up. */ + + BFD_ASSERT (h->dynindx != -1); + + splt = bfd_get_section_by_name (dynobj, ".plt"); + srel = bfd_get_section_by_name (dynobj, RELOC_SECTION (htab, ".plt")); + BFD_ASSERT (splt != NULL && srel != NULL); + + /* Fill in the entry in the procedure linkage table. */ + if (htab->symbian_p) + { + unsigned i; + for (i = 0; i < htab->plt_entry_size / 4; ++i) + bfd_put_32 (output_bfd, + elf32_arm_symbian_plt_entry[i], + splt->contents + h->plt.offset + 4 * i); + + /* Fill in the entry in the .rel.plt section. */ + rel.r_offset = (splt->output_section->vma + + splt->output_offset + + h->plt.offset + 4 * (i - 1)); + rel.r_info = ELF32_R_INFO (h->dynindx, R_ARM_GLOB_DAT); + + /* Get the index in the procedure linkage table which + corresponds to this symbol. This is the index of this symbol + in all the symbols for which we are making plt entries. The + first entry in the procedure linkage table is reserved. */ + plt_index = ((h->plt.offset - htab->plt_header_size) + / htab->plt_entry_size); + } + else + { + bfd_vma got_offset, got_address, plt_address; + bfd_vma got_displacement; + asection * sgot; + + sgot = bfd_get_section_by_name (dynobj, ".got.plt"); + BFD_ASSERT (sgot != NULL); + + /* Get the offset into the .got.plt table of the entry that + corresponds to this function. */ + got_offset = eh->plt_got_offset; + + /* Get the index in the procedure linkage table which + corresponds to this symbol. This is the index of this symbol + in all the symbols for which we are making plt entries. The + first three entries in .got.plt are reserved; after that + symbols appear in the same order as in .plt. */ + plt_index = (got_offset - 12) / 4; + + /* Calculate the address of the GOT entry. */ + got_address = (sgot->output_section->vma + + sgot->output_offset + + got_offset); + + /* ...and the address of the PLT entry. */ + plt_address = (splt->output_section->vma + + splt->output_offset + + h->plt.offset); + + if (htab->vxworks_p && info->shared) + { + unsigned int i; + bfd_vma val; + + for (i = 0; i != htab->plt_entry_size / 4; i++) + { + val = elf32_arm_vxworks_shared_plt_entry[i]; + if (i == 2) + val |= got_address - sgot->output_section->vma; + if (i == 5) + val |= plt_index * RELOC_SIZE (htab); + bfd_put_32 (output_bfd, val, + htab->splt->contents + h->plt.offset + i * 4); + } + } + else if (htab->vxworks_p) + { + unsigned int i; + bfd_vma val; + + for (i = 0; i != htab->plt_entry_size / 4; i++) + { + val = elf32_arm_vxworks_exec_plt_entry[i]; + if (i == 2) + val |= got_address; + if (i == 4) + val |= 0xffffff & -((h->plt.offset + i * 4 + 8) >> 2); + if (i == 5) + val |= plt_index * RELOC_SIZE (htab); + bfd_put_32 (output_bfd, val, + htab->splt->contents + h->plt.offset + i * 4); + } + + loc = (htab->srelplt2->contents + + (plt_index * 2 + 1) * RELOC_SIZE (htab)); + + /* Create the .rela.plt.unloaded R_ARM_ABS32 relocation + referencing the GOT for this PLT entry. */ + rel.r_offset = plt_address + 8; + rel.r_info = ELF32_R_INFO (htab->root.hgot->indx, R_ARM_ABS32); + rel.r_addend = got_offset; + SWAP_RELOC_OUT (htab) (output_bfd, &rel, loc); + loc += RELOC_SIZE (htab); + + /* Create the R_ARM_ABS32 relocation referencing the + beginning of the PLT for this GOT entry. */ + rel.r_offset = got_address; + rel.r_info = ELF32_R_INFO (htab->root.hplt->indx, R_ARM_ABS32); + rel.r_addend = 0; + SWAP_RELOC_OUT (htab) (output_bfd, &rel, loc); + } + else + { + /* Calculate the displacement between the PLT slot and the + entry in the GOT. The eight-byte offset accounts for the + value produced by adding to pc in the first instruction + of the PLT stub. */ + got_displacement = got_address - (plt_address + 8); + + BFD_ASSERT ((got_displacement & 0xf0000000) == 0); + + if (!htab->use_blx && eh->plt_thumb_refcount > 0) + { + bfd_put_16 (output_bfd, elf32_arm_plt_thumb_stub[0], + splt->contents + h->plt.offset - 4); + bfd_put_16 (output_bfd, elf32_arm_plt_thumb_stub[1], + splt->contents + h->plt.offset - 2); + } + + bfd_put_32 (output_bfd, + elf32_arm_plt_entry[0] + | ((got_displacement & 0x0ff00000) >> 20), + splt->contents + h->plt.offset + 0); + bfd_put_32 (output_bfd, + elf32_arm_plt_entry[1] + | ((got_displacement & 0x000ff000) >> 12), + splt->contents + h->plt.offset + 4); + bfd_put_32 (output_bfd, + elf32_arm_plt_entry[2] + | (got_displacement & 0x00000fff), + splt->contents + h->plt.offset + 8); +#ifdef FOUR_WORD_PLT + bfd_put_32 (output_bfd, elf32_arm_plt_entry[3], + splt->contents + h->plt.offset + 12); +#endif + } + + /* Fill in the entry in the global offset table. */ + bfd_put_32 (output_bfd, + (splt->output_section->vma + + splt->output_offset), + sgot->contents + got_offset); + + /* Fill in the entry in the .rel(a).plt section. */ + rel.r_addend = 0; + rel.r_offset = got_address; + rel.r_info = ELF32_R_INFO (h->dynindx, R_ARM_JUMP_SLOT); + } + + loc = srel->contents + plt_index * RELOC_SIZE (htab); + SWAP_RELOC_OUT (htab) (output_bfd, &rel, loc); + + if (!h->def_regular) + { + /* Mark the symbol as undefined, rather than as defined in + the .plt section. Leave the value alone. */ + sym->st_shndx = SHN_UNDEF; + /* If the symbol is weak, we do need to clear the value. + Otherwise, the PLT entry would provide a definition for + the symbol even if the symbol wasn't defined anywhere, + and so the symbol would never be NULL. */ + if (!h->ref_regular_nonweak) + sym->st_value = 0; + } + } + + if (h->got.offset != (bfd_vma) -1 + && (elf32_arm_hash_entry (h)->tls_type & GOT_TLS_GD) == 0 + && (elf32_arm_hash_entry (h)->tls_type & GOT_TLS_IE) == 0) + { + asection * sgot; + asection * srel; + Elf_Internal_Rela rel; + bfd_byte *loc; + bfd_vma offset; + + /* This symbol has an entry in the global offset table. Set it + up. */ + sgot = bfd_get_section_by_name (dynobj, ".got"); + srel = bfd_get_section_by_name (dynobj, RELOC_SECTION (htab, ".got")); + BFD_ASSERT (sgot != NULL && srel != NULL); + + offset = (h->got.offset & ~(bfd_vma) 1); + rel.r_addend = 0; + rel.r_offset = (sgot->output_section->vma + + sgot->output_offset + + offset); + + /* If this is a static link, or it is a -Bsymbolic link and the + symbol is defined locally or was forced to be local because + of a version file, we just want to emit a RELATIVE reloc. + The entry in the global offset table will already have been + initialized in the relocate_section function. */ + if (info->shared + && SYMBOL_REFERENCES_LOCAL (info, h)) + { + BFD_ASSERT((h->got.offset & 1) != 0); + rel.r_info = ELF32_R_INFO (0, R_ARM_RELATIVE); + if (!htab->use_rel) + { + rel.r_addend = bfd_get_32 (output_bfd, sgot->contents + offset); + bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + offset); + } + } + else + { + BFD_ASSERT((h->got.offset & 1) == 0); + bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + offset); + rel.r_info = ELF32_R_INFO (h->dynindx, R_ARM_GLOB_DAT); + } + + loc = srel->contents + srel->reloc_count++ * RELOC_SIZE (htab); + SWAP_RELOC_OUT (htab) (output_bfd, &rel, loc); + } + + if (h->needs_copy) + { + asection * s; + Elf_Internal_Rela rel; + bfd_byte *loc; + + /* This symbol needs a copy reloc. Set it up. */ + BFD_ASSERT (h->dynindx != -1 + && (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak)); + + s = bfd_get_section_by_name (h->root.u.def.section->owner, + RELOC_SECTION (htab, ".bss")); + BFD_ASSERT (s != NULL); + + rel.r_addend = 0; + rel.r_offset = (h->root.u.def.value + + h->root.u.def.section->output_section->vma + + h->root.u.def.section->output_offset); + rel.r_info = ELF32_R_INFO (h->dynindx, R_ARM_COPY); + loc = s->contents + s->reloc_count++ * RELOC_SIZE (htab); + SWAP_RELOC_OUT (htab) (output_bfd, &rel, loc); + } + + /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. On VxWorks, + the _GLOBAL_OFFSET_TABLE_ symbol is not absolute: it is relative + to the ".got" section. */ + if (strcmp (h->root.root.string, "_DYNAMIC") == 0 + || (!htab->vxworks_p && h == htab->root.hgot)) + sym->st_shndx = SHN_ABS; + + return TRUE; +} + +/* Finish up the dynamic sections. */ + +static bfd_boolean +elf32_arm_finish_dynamic_sections (bfd * output_bfd, struct bfd_link_info * info) +{ + bfd * dynobj; + asection * sgot; + asection * sdyn; + + dynobj = elf_hash_table (info)->dynobj; + + sgot = bfd_get_section_by_name (dynobj, ".got.plt"); + BFD_ASSERT (elf32_arm_hash_table (info)->symbian_p || sgot != NULL); + sdyn = bfd_get_section_by_name (dynobj, ".dynamic"); + + if (elf_hash_table (info)->dynamic_sections_created) + { + asection *splt; + Elf32_External_Dyn *dyncon, *dynconend; + struct elf32_arm_link_hash_table *htab; + + htab = elf32_arm_hash_table (info); + splt = bfd_get_section_by_name (dynobj, ".plt"); + BFD_ASSERT (splt != NULL && sdyn != NULL); + + dyncon = (Elf32_External_Dyn *) sdyn->contents; + dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->size); + + for (; dyncon < dynconend; dyncon++) + { + Elf_Internal_Dyn dyn; + const char * name; + asection * s; + + bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn); + + switch (dyn.d_tag) + { + unsigned int type; + + default: + break; + + case DT_HASH: + name = ".hash"; + goto get_vma_if_bpabi; + case DT_STRTAB: + name = ".dynstr"; + goto get_vma_if_bpabi; + case DT_SYMTAB: + name = ".dynsym"; + goto get_vma_if_bpabi; + case DT_VERSYM: + name = ".gnu.version"; + goto get_vma_if_bpabi; + case DT_VERDEF: + name = ".gnu.version_d"; + goto get_vma_if_bpabi; + case DT_VERNEED: + name = ".gnu.version_r"; + goto get_vma_if_bpabi; + + case DT_PLTGOT: + name = ".got"; + goto get_vma; + case DT_JMPREL: + name = RELOC_SECTION (htab, ".plt"); + get_vma: + s = bfd_get_section_by_name (output_bfd, name); + BFD_ASSERT (s != NULL); + if (!htab->symbian_p) + dyn.d_un.d_ptr = s->vma; + else + /* In the BPABI, tags in the PT_DYNAMIC section point + at the file offset, not the memory address, for the + convenience of the post linker. */ + dyn.d_un.d_ptr = s->filepos; + bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + break; + + get_vma_if_bpabi: + if (htab->symbian_p) + goto get_vma; + break; + + case DT_PLTRELSZ: + s = bfd_get_section_by_name (output_bfd, + RELOC_SECTION (htab, ".plt")); + BFD_ASSERT (s != NULL); + dyn.d_un.d_val = s->size; + bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + break; + + case DT_RELSZ: + case DT_RELASZ: + if (!htab->symbian_p) + { + /* My reading of the SVR4 ABI indicates that the + procedure linkage table relocs (DT_JMPREL) should be + included in the overall relocs (DT_REL). This is + what Solaris does. However, UnixWare can not handle + that case. Therefore, we override the DT_RELSZ entry + here to make it not include the JMPREL relocs. Since + the linker script arranges for .rel(a).plt to follow all + other relocation sections, we don't have to worry + about changing the DT_REL entry. */ + s = bfd_get_section_by_name (output_bfd, + RELOC_SECTION (htab, ".plt")); + if (s != NULL) + dyn.d_un.d_val -= s->size; + bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + break; + } + /* Fall through */ + + case DT_REL: + case DT_RELA: + /* In the BPABI, the DT_REL tag must point at the file + offset, not the VMA, of the first relocation + section. So, we use code similar to that in + elflink.c, but do not check for SHF_ALLOC on the + relcoation section, since relocations sections are + never allocated under the BPABI. The comments above + about Unixware notwithstanding, we include all of the + relocations here. */ + if (htab->symbian_p) + { + unsigned int i; + type = ((dyn.d_tag == DT_REL || dyn.d_tag == DT_RELSZ) + ? SHT_REL : SHT_RELA); + dyn.d_un.d_val = 0; + for (i = 1; i < elf_numsections (output_bfd); i++) + { + Elf_Internal_Shdr *hdr + = elf_elfsections (output_bfd)[i]; + if (hdr->sh_type == type) + { + if (dyn.d_tag == DT_RELSZ + || dyn.d_tag == DT_RELASZ) + dyn.d_un.d_val += hdr->sh_size; + else if ((ufile_ptr) hdr->sh_offset + <= dyn.d_un.d_val - 1) + dyn.d_un.d_val = hdr->sh_offset; + } + } + bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + } + break; + + /* Set the bottom bit of DT_INIT/FINI if the + corresponding function is Thumb. */ + case DT_INIT: + name = info->init_function; + goto get_sym; + case DT_FINI: + name = info->fini_function; + get_sym: + /* If it wasn't set by elf_bfd_final_link + then there is nothing to adjust. */ + if (dyn.d_un.d_val != 0) + { + struct elf_link_hash_entry * eh; + + eh = elf_link_hash_lookup (elf_hash_table (info), name, + FALSE, FALSE, TRUE); + if (eh != (struct elf_link_hash_entry *) NULL + && ELF_ST_TYPE (eh->type) == STT_ARM_TFUNC) + { + dyn.d_un.d_val |= 1; + bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + } + } + break; + } + } + + /* Fill in the first entry in the procedure linkage table. */ + if (splt->size > 0 && elf32_arm_hash_table (info)->plt_header_size) + { + const bfd_vma *plt0_entry; + bfd_vma got_address, plt_address, got_displacement; + + /* Calculate the addresses of the GOT and PLT. */ + got_address = sgot->output_section->vma + sgot->output_offset; + plt_address = splt->output_section->vma + splt->output_offset; + + if (htab->vxworks_p) + { + /* The VxWorks GOT is relocated by the dynamic linker. + Therefore, we must emit relocations rather than simply + computing the values now. */ + Elf_Internal_Rela rel; + + plt0_entry = elf32_arm_vxworks_exec_plt0_entry; + bfd_put_32 (output_bfd, plt0_entry[0], splt->contents + 0); + bfd_put_32 (output_bfd, plt0_entry[1], splt->contents + 4); + bfd_put_32 (output_bfd, plt0_entry[2], splt->contents + 8); + bfd_put_32 (output_bfd, got_address, splt->contents + 12); + + /* Generate a relocation for _GLOBAL_OFFSET_TABLE_. */ + rel.r_offset = plt_address + 12; + rel.r_info = ELF32_R_INFO (htab->root.hgot->indx, R_ARM_ABS32); + rel.r_addend = 0; + SWAP_RELOC_OUT (htab) (output_bfd, &rel, + htab->srelplt2->contents); + } + else + { + got_displacement = got_address - (plt_address + 16); + + plt0_entry = elf32_arm_plt0_entry; + bfd_put_32 (output_bfd, plt0_entry[0], splt->contents + 0); + bfd_put_32 (output_bfd, plt0_entry[1], splt->contents + 4); + bfd_put_32 (output_bfd, plt0_entry[2], splt->contents + 8); + bfd_put_32 (output_bfd, plt0_entry[3], splt->contents + 12); + +#ifdef FOUR_WORD_PLT + /* The displacement value goes in the otherwise-unused + last word of the second entry. */ + bfd_put_32 (output_bfd, got_displacement, splt->contents + 28); +#else + bfd_put_32 (output_bfd, got_displacement, splt->contents + 16); +#endif + } + } + + /* UnixWare sets the entsize of .plt to 4, although that doesn't + really seem like the right value. */ + elf_section_data (splt->output_section)->this_hdr.sh_entsize = 4; + + if (htab->vxworks_p && !info->shared && htab->splt->size > 0) + { + /* Correct the .rel(a).plt.unloaded relocations. They will have + incorrect symbol indexes. */ + int num_plts; + unsigned char *p; + + num_plts = ((htab->splt->size - htab->plt_header_size) + / htab->plt_entry_size); + p = htab->srelplt2->contents + RELOC_SIZE (htab); + + for (; num_plts; num_plts--) + { + Elf_Internal_Rela rel; + + SWAP_RELOC_IN (htab) (output_bfd, p, &rel); + rel.r_info = ELF32_R_INFO (htab->root.hgot->indx, R_ARM_ABS32); + SWAP_RELOC_OUT (htab) (output_bfd, &rel, p); + p += RELOC_SIZE (htab); + + SWAP_RELOC_IN (htab) (output_bfd, p, &rel); + rel.r_info = ELF32_R_INFO (htab->root.hplt->indx, R_ARM_ABS32); + SWAP_RELOC_OUT (htab) (output_bfd, &rel, p); + p += RELOC_SIZE (htab); + } + } + } + + /* Fill in the first three entries in the global offset table. */ + if (sgot) + { + if (sgot->size > 0) + { + if (sdyn == NULL) + bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents); + else + bfd_put_32 (output_bfd, + sdyn->output_section->vma + sdyn->output_offset, + sgot->contents); + bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + 4); + bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + 8); + } + + elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4; + } + + return TRUE; +} + +static void +elf32_arm_post_process_headers (bfd * abfd, struct bfd_link_info * link_info ATTRIBUTE_UNUSED) +{ + Elf_Internal_Ehdr * i_ehdrp; /* ELF file header, internal form. */ + struct elf32_arm_link_hash_table *globals; + + i_ehdrp = elf_elfheader (abfd); + + if (EF_ARM_EABI_VERSION (i_ehdrp->e_flags) == EF_ARM_EABI_UNKNOWN) + i_ehdrp->e_ident[EI_OSABI] = ARM_ELF_OS_ABI_VERSION; + else + i_ehdrp->e_ident[EI_OSABI] = 0; + i_ehdrp->e_ident[EI_ABIVERSION] = ARM_ELF_ABI_VERSION; + + if (link_info) + { + globals = elf32_arm_hash_table (link_info); + if (globals->byteswap_code) + i_ehdrp->e_flags |= EF_ARM_BE8; + } +} + +static enum elf_reloc_type_class +elf32_arm_reloc_type_class (const Elf_Internal_Rela *rela) +{ + switch ((int) ELF32_R_TYPE (rela->r_info)) + { + case R_ARM_RELATIVE: + return reloc_class_relative; + case R_ARM_JUMP_SLOT: + return reloc_class_plt; + case R_ARM_COPY: + return reloc_class_copy; + default: + return reloc_class_normal; + } +} + +/* Set the right machine number for an Arm ELF file. */ + +static bfd_boolean +elf32_arm_section_flags (flagword *flags, const Elf_Internal_Shdr *hdr) +{ + if (hdr->sh_type == SHT_NOTE) + *flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_SAME_CONTENTS; + + return TRUE; +} + +static void +elf32_arm_final_write_processing (bfd *abfd, bfd_boolean linker ATTRIBUTE_UNUSED) +{ + bfd_arm_update_notes (abfd, ARM_NOTE_SECTION); +} + +/* Return TRUE if this is an unwinding table entry. */ + +static bfd_boolean +is_arm_elf_unwind_section_name (bfd * abfd ATTRIBUTE_UNUSED, const char * name) +{ + size_t len1, len2; + + len1 = sizeof (ELF_STRING_ARM_unwind) - 1; + len2 = sizeof (ELF_STRING_ARM_unwind_once) - 1; + return (strncmp (name, ELF_STRING_ARM_unwind, len1) == 0 + || strncmp (name, ELF_STRING_ARM_unwind_once, len2) == 0); +} + + +/* Set the type and flags for an ARM section. We do this by + the section name, which is a hack, but ought to work. */ + +static bfd_boolean +elf32_arm_fake_sections (bfd * abfd, Elf_Internal_Shdr * hdr, asection * sec) +{ + const char * name; + + name = bfd_get_section_name (abfd, sec); + + if (is_arm_elf_unwind_section_name (abfd, name)) + { + hdr->sh_type = SHT_ARM_EXIDX; + hdr->sh_flags |= SHF_LINK_ORDER; + } + else if (strcmp(name, ".ARM.attributes") == 0) + { + hdr->sh_type = SHT_ARM_ATTRIBUTES; + } + return TRUE; +} + +/* Parse an Arm EABI attributes section. */ +static void +elf32_arm_parse_attributes (bfd *abfd, Elf_Internal_Shdr * hdr) +{ + bfd_byte *contents; + bfd_byte *p; + bfd_vma len; + + contents = bfd_malloc (hdr->sh_size); + if (!contents) + return; + if (!bfd_get_section_contents (abfd, hdr->bfd_section, contents, 0, + hdr->sh_size)) + { + free (contents); + return; + } + p = contents; + if (*(p++) == 'A') + { + len = hdr->sh_size - 1; + while (len > 0) + { + int namelen; + bfd_vma section_len; + + section_len = bfd_get_32 (abfd, p); + p += 4; + if (section_len > len) + section_len = len; + len -= section_len; + namelen = strlen ((char *)p) + 1; + section_len -= namelen + 4; + if (strcmp((char *)p, "aeabi") != 0) + { + /* Vendor section. Ignore it. */ + p += namelen + section_len; + } + else + { + p += namelen; + while (section_len > 0) + { + int tag; + unsigned int n; + unsigned int val; + bfd_vma subsection_len; + bfd_byte *end; + + tag = read_unsigned_leb128 (abfd, p, &n); + p += n; + subsection_len = bfd_get_32 (abfd, p); + p += 4; + if (subsection_len > section_len) + subsection_len = section_len; + section_len -= subsection_len; + subsection_len -= n + 4; + end = p + subsection_len; + switch (tag) + { + case Tag_File: + while (p < end) + { + bfd_boolean is_string; + + tag = read_unsigned_leb128 (abfd, p, &n); + p += n; + if (tag == 4 || tag == 5) + is_string = 1; + else if (tag < 32) + is_string = 0; + else + is_string = (tag & 1) != 0; + if (tag == Tag_compatibility) + { + val = read_unsigned_leb128 (abfd, p, &n); + p += n; + elf32_arm_add_eabi_attr_compat (abfd, val, + (char *)p); + p += strlen ((char *)p) + 1; + } + else if (is_string) + { + elf32_arm_add_eabi_attr_string (abfd, tag, + (char *)p); + p += strlen ((char *)p) + 1; + } + else + { + val = read_unsigned_leb128 (abfd, p, &n); + p += n; + elf32_arm_add_eabi_attr_int (abfd, tag, val); + } + } + break; + case Tag_Section: + case Tag_Symbol: + /* Don't have anywhere convenient to attach these. + Fall through for now. */ + default: + /* Ignore things we don't kow about. */ + p += subsection_len; + subsection_len = 0; + break; + } + } + } + } + } + free (contents); +} + +/* Handle an ARM specific section when reading an object file. This is + called when bfd_section_from_shdr finds a section with an unknown + type. */ + +static bfd_boolean +elf32_arm_section_from_shdr (bfd *abfd, + Elf_Internal_Shdr * hdr, + const char *name, + int shindex) +{ + /* 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 + names for all the ARM specific sections, so we will probably get + away with this. */ + switch (hdr->sh_type) + { + case SHT_ARM_EXIDX: + case SHT_ARM_PREEMPTMAP: + case SHT_ARM_ATTRIBUTES: + break; + + default: + return FALSE; + } + + if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex)) + return FALSE; + + if (hdr->sh_type == SHT_ARM_ATTRIBUTES) + elf32_arm_parse_attributes(abfd, hdr); + return TRUE; +} + +/* A structure used to record a list of sections, independently + of the next and prev fields in the asection structure. */ +typedef struct section_list +{ + asection * sec; + struct section_list * next; + struct section_list * prev; +} +section_list; + +/* Unfortunately we need to keep a list of sections for which + an _arm_elf_section_data structure has been allocated. This + is because it is possible for functions like elf32_arm_write_section + to be called on a section which has had an elf_data_structure + allocated for it (and so the used_by_bfd field is valid) but + for which the ARM extended version of this structure - the + _arm_elf_section_data structure - has not been allocated. */ +static section_list * sections_with_arm_elf_section_data = NULL; + +static void +record_section_with_arm_elf_section_data (asection * sec) +{ + struct section_list * entry; + + entry = bfd_malloc (sizeof (* entry)); + if (entry == NULL) + return; + entry->sec = sec; + entry->next = sections_with_arm_elf_section_data; + entry->prev = NULL; + if (entry->next != NULL) + entry->next->prev = entry; + sections_with_arm_elf_section_data = entry; +} + +static struct section_list * +find_arm_elf_section_entry (asection * sec) +{ + struct section_list * entry; + static struct section_list * last_entry = NULL; + + /* This is a short cut for the typical case where the sections are added + to the sections_with_arm_elf_section_data list in forward order and + then looked up here in backwards order. This makes a real difference + to the ld-srec/sec64k.exp linker test. */ + entry = sections_with_arm_elf_section_data; + if (last_entry != NULL) + { + if (last_entry->sec == sec) + entry = last_entry; + else if (last_entry->next != NULL + && last_entry->next->sec == sec) + entry = last_entry->next; + } + + for (; entry; entry = entry->next) + if (entry->sec == sec) + break; + + if (entry) + /* Record the entry prior to this one - it is the entry we are most + likely to want to locate next time. Also this way if we have been + called from unrecord_section_with_arm_elf_section_data() we will not + be caching a pointer that is about to be freed. */ + last_entry = entry->prev; + + return entry; +} + +static _arm_elf_section_data * +get_arm_elf_section_data (asection * sec) +{ + struct section_list * entry; + + entry = find_arm_elf_section_entry (sec); + + if (entry) + return elf32_arm_section_data (entry->sec); + else + return NULL; +} + +static void +unrecord_section_with_arm_elf_section_data (asection * sec) +{ + struct section_list * entry; + + entry = find_arm_elf_section_entry (sec); + + if (entry) + { + if (entry->prev != NULL) + entry->prev->next = entry->next; + if (entry->next != NULL) + entry->next->prev = entry->prev; + if (entry == sections_with_arm_elf_section_data) + sections_with_arm_elf_section_data = entry->next; + free (entry); + } +} + +/* Called for each symbol. Builds a section map based on mapping symbols. + Does not alter any of the symbols. */ + +static bfd_boolean +elf32_arm_output_symbol_hook (struct bfd_link_info *info, + const char *name, + Elf_Internal_Sym *elfsym, + asection *input_sec, + struct elf_link_hash_entry *h) +{ + int mapcount; + elf32_arm_section_map *map; + elf32_arm_section_map *newmap; + _arm_elf_section_data *arm_data; + struct elf32_arm_link_hash_table *globals; + + globals = elf32_arm_hash_table (info); + if (globals->vxworks_p + && !elf_vxworks_link_output_symbol_hook (info, name, elfsym, + input_sec, h)) + return FALSE; + + /* Only do this on final link. */ + if (info->relocatable) + return TRUE; + + /* Only build a map if we need to byteswap code. */ + if (!globals->byteswap_code) + return TRUE; + + /* We only want mapping symbols. */ + if (! bfd_is_arm_mapping_symbol_name (name)) + return TRUE; + + /* If this section has not been allocated an _arm_elf_section_data + structure then we cannot record anything. */ + arm_data = get_arm_elf_section_data (input_sec); + if (arm_data == NULL) + return TRUE; + + mapcount = arm_data->mapcount + 1; + map = arm_data->map; + + /* TODO: This may be inefficient, but we probably don't usually have many + mapping symbols per section. */ + newmap = bfd_realloc (map, mapcount * sizeof (* map)); + if (newmap != NULL) + { + arm_data->map = newmap; + arm_data->mapcount = mapcount; + + newmap[mapcount - 1].vma = elfsym->st_value; + newmap[mapcount - 1].type = name[1]; + } + + return TRUE; +} + +/* Allocate target specific section data. */ + +static bfd_boolean +elf32_arm_new_section_hook (bfd *abfd, asection *sec) +{ + _arm_elf_section_data *sdata; + bfd_size_type amt = sizeof (*sdata); + + sdata = bfd_zalloc (abfd, amt); + if (sdata == NULL) + return FALSE; + sec->used_by_bfd = sdata; + + record_section_with_arm_elf_section_data (sec); + + return _bfd_elf_new_section_hook (abfd, sec); +} + + +/* Used to order a list of mapping symbols by address. */ + +static int +elf32_arm_compare_mapping (const void * a, const void * b) +{ + return ((const elf32_arm_section_map *) a)->vma + > ((const elf32_arm_section_map *) b)->vma; +} + + +/* Do code byteswapping. Return FALSE afterwards so that the section is + written out as normal. */ + +static bfd_boolean +elf32_arm_write_section (bfd *output_bfd ATTRIBUTE_UNUSED, asection *sec, + bfd_byte *contents) +{ + int mapcount; + _arm_elf_section_data *arm_data; + elf32_arm_section_map *map; + bfd_vma ptr; + bfd_vma end; + bfd_vma offset; + bfd_byte tmp; + int i; + + /* If this section has not been allocated an _arm_elf_section_data + structure then we cannot record anything. */ + arm_data = get_arm_elf_section_data (sec); + if (arm_data == NULL) + return FALSE; + + mapcount = arm_data->mapcount; + map = arm_data->map; + + if (mapcount == 0) + return FALSE; + + qsort (map, mapcount, sizeof (* map), elf32_arm_compare_mapping); + + offset = sec->output_section->vma + sec->output_offset; + ptr = map[0].vma - offset; + for (i = 0; i < mapcount; i++) + { + if (i == mapcount - 1) + end = sec->size; + else + end = map[i + 1].vma - offset; + + switch (map[i].type) + { + case 'a': + /* Byte swap code words. */ + while (ptr + 3 < end) + { + tmp = contents[ptr]; + contents[ptr] = contents[ptr + 3]; + contents[ptr + 3] = tmp; + tmp = contents[ptr + 1]; + contents[ptr + 1] = contents[ptr + 2]; + contents[ptr + 2] = tmp; + ptr += 4; + } + break; + + case 't': + /* Byte swap code halfwords. */ + while (ptr + 1 < end) + { + tmp = contents[ptr]; + contents[ptr] = contents[ptr + 1]; + contents[ptr + 1] = tmp; + ptr += 2; + } + break; + + case 'd': + /* Leave data alone. */ + break; + } + ptr = end; + } + + free (map); + arm_data->mapcount = 0; + arm_data->map = NULL; + unrecord_section_with_arm_elf_section_data (sec); + + return FALSE; +} + +static void +unrecord_section_via_map_over_sections (bfd * abfd ATTRIBUTE_UNUSED, + asection * sec, + void * ignore ATTRIBUTE_UNUSED) +{ + unrecord_section_with_arm_elf_section_data (sec); +} + +static bfd_boolean +elf32_arm_close_and_cleanup (bfd * abfd) +{ + bfd_map_over_sections (abfd, unrecord_section_via_map_over_sections, NULL); + + return _bfd_elf_close_and_cleanup (abfd); +} + +/* Display STT_ARM_TFUNC symbols as functions. */ + +static void +elf32_arm_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED, + asymbol *asym) +{ + elf_symbol_type *elfsym = (elf_symbol_type *) asym; + + if (ELF_ST_TYPE (elfsym->internal_elf_sym.st_info) == STT_ARM_TFUNC) + elfsym->symbol.flags |= BSF_FUNCTION; +} + + +/* Mangle thumb function symbols as we read them in. */ + +static void +elf32_arm_swap_symbol_in (bfd * abfd, + const void *psrc, + const void *pshn, + Elf_Internal_Sym *dst) +{ + bfd_elf32_swap_symbol_in (abfd, psrc, pshn, dst); + + /* New EABI objects mark thumb function symbols by setting the low bit of + the address. Turn these into STT_ARM_TFUNC. */ + if (ELF_ST_TYPE (dst->st_info) == STT_FUNC + && (dst->st_value & 1)) + { + dst->st_info = ELF_ST_INFO (ELF_ST_BIND (dst->st_info), STT_ARM_TFUNC); + dst->st_value &= ~(bfd_vma) 1; + } +} + + +/* Mangle thumb function symbols as we write them out. */ + +static void +elf32_arm_swap_symbol_out (bfd *abfd, + const Elf_Internal_Sym *src, + void *cdst, + void *shndx) +{ + Elf_Internal_Sym newsym; + + /* We convert STT_ARM_TFUNC symbols into STT_FUNC with the low bit + of the address set, as per the new EABI. We do this unconditionally + because objcopy does not set the elf header flags until after + it writes out the symbol table. */ + if (ELF_ST_TYPE (src->st_info) == STT_ARM_TFUNC) + { + newsym = *src; + newsym.st_info = ELF_ST_INFO (ELF_ST_BIND (src->st_info), STT_FUNC); + newsym.st_value |= 1; + + src = &newsym; + } + bfd_elf32_swap_symbol_out (abfd, src, cdst, shndx); +} + +/* Add the PT_ARM_EXIDX program header. */ + +static bfd_boolean +elf32_arm_modify_segment_map (bfd *abfd, + struct bfd_link_info *info ATTRIBUTE_UNUSED) +{ + struct elf_segment_map *m; + asection *sec; + + sec = bfd_get_section_by_name (abfd, ".ARM.exidx"); + if (sec != NULL && (sec->flags & SEC_LOAD) != 0) + { + /* If there is already a PT_ARM_EXIDX header, then we do not + want to add another one. This situation arises when running + "strip"; the input binary already has the header. */ + m = elf_tdata (abfd)->segment_map; + while (m && m->p_type != PT_ARM_EXIDX) + m = m->next; + if (!m) + { + m = bfd_zalloc (abfd, sizeof (struct elf_segment_map)); + if (m == NULL) + return FALSE; + m->p_type = PT_ARM_EXIDX; + m->count = 1; + m->sections[0] = sec; + + m->next = elf_tdata (abfd)->segment_map; + elf_tdata (abfd)->segment_map = m; + } + } + + return TRUE; +} + +/* We may add a PT_ARM_EXIDX program header. */ + +static int +elf32_arm_additional_program_headers (bfd *abfd) +{ + asection *sec; + + sec = bfd_get_section_by_name (abfd, ".ARM.exidx"); + if (sec != NULL && (sec->flags & SEC_LOAD) != 0) + return 1; + else + return 0; +} + +/* We use this to override swap_symbol_in and swap_symbol_out. */ +const struct elf_size_info elf32_arm_size_info = { + sizeof (Elf32_External_Ehdr), + sizeof (Elf32_External_Phdr), + sizeof (Elf32_External_Shdr), + sizeof (Elf32_External_Rel), + sizeof (Elf32_External_Rela), + sizeof (Elf32_External_Sym), + sizeof (Elf32_External_Dyn), + sizeof (Elf_External_Note), + 4, + 1, + 32, 2, + ELFCLASS32, EV_CURRENT, + bfd_elf32_write_out_phdrs, + bfd_elf32_write_shdrs_and_ehdr, + bfd_elf32_write_relocs, + elf32_arm_swap_symbol_in, + elf32_arm_swap_symbol_out, + bfd_elf32_slurp_reloc_table, + bfd_elf32_slurp_symbol_table, + bfd_elf32_swap_dyn_in, + bfd_elf32_swap_dyn_out, + bfd_elf32_swap_reloc_in, + bfd_elf32_swap_reloc_out, + bfd_elf32_swap_reloca_in, + bfd_elf32_swap_reloca_out +}; + +#define ELF_ARCH bfd_arch_arm +#define ELF_MACHINE_CODE EM_ARM +#ifdef __QNXTARGET__ +#define ELF_MAXPAGESIZE 0x1000 +#else +#define ELF_MAXPAGESIZE 0x8000 +#endif +#define ELF_MINPAGESIZE 0x1000 + +#define bfd_elf32_mkobject elf32_arm_mkobject + +#define bfd_elf32_bfd_copy_private_bfd_data elf32_arm_copy_private_bfd_data +#define bfd_elf32_bfd_merge_private_bfd_data elf32_arm_merge_private_bfd_data +#define bfd_elf32_bfd_set_private_flags elf32_arm_set_private_flags +#define bfd_elf32_bfd_print_private_bfd_data elf32_arm_print_private_bfd_data +#define bfd_elf32_bfd_link_hash_table_create elf32_arm_link_hash_table_create +#define bfd_elf32_bfd_reloc_type_lookup elf32_arm_reloc_type_lookup +#define bfd_elf32_find_nearest_line elf32_arm_find_nearest_line +#define bfd_elf32_find_inliner_info elf32_arm_find_inliner_info +#define bfd_elf32_new_section_hook elf32_arm_new_section_hook +#define bfd_elf32_bfd_is_target_special_symbol elf32_arm_is_target_special_symbol +#define bfd_elf32_close_and_cleanup elf32_arm_close_and_cleanup +#define bfd_elf32_bfd_final_link elf32_arm_bfd_final_link + +#define elf_backend_get_symbol_type elf32_arm_get_symbol_type +#define elf_backend_gc_mark_hook elf32_arm_gc_mark_hook +#define elf_backend_gc_sweep_hook elf32_arm_gc_sweep_hook +#define elf_backend_check_relocs elf32_arm_check_relocs +#define elf_backend_relocate_section elf32_arm_relocate_section +#define elf_backend_write_section elf32_arm_write_section +#define elf_backend_adjust_dynamic_symbol elf32_arm_adjust_dynamic_symbol +#define elf_backend_create_dynamic_sections elf32_arm_create_dynamic_sections +#define elf_backend_finish_dynamic_symbol elf32_arm_finish_dynamic_symbol +#define elf_backend_finish_dynamic_sections elf32_arm_finish_dynamic_sections +#define elf_backend_link_output_symbol_hook elf32_arm_output_symbol_hook +#define elf_backend_size_dynamic_sections elf32_arm_size_dynamic_sections +#define elf_backend_post_process_headers elf32_arm_post_process_headers +#define elf_backend_reloc_type_class elf32_arm_reloc_type_class +#define elf_backend_object_p elf32_arm_object_p +#define elf_backend_section_flags elf32_arm_section_flags +#define elf_backend_fake_sections elf32_arm_fake_sections +#define elf_backend_section_from_shdr elf32_arm_section_from_shdr +#define elf_backend_final_write_processing elf32_arm_final_write_processing +#define elf_backend_copy_indirect_symbol elf32_arm_copy_indirect_symbol +#define elf_backend_symbol_processing elf32_arm_symbol_processing +#define elf_backend_size_info elf32_arm_size_info +#define elf_backend_modify_segment_map elf32_arm_modify_segment_map +#define elf_backend_additional_program_headers \ + elf32_arm_additional_program_headers + +#define elf_backend_can_refcount 1 +#define elf_backend_can_gc_sections 1 +#define elf_backend_plt_readonly 1 +#define elf_backend_want_got_plt 1 +#define elf_backend_want_plt_sym 0 +#define elf_backend_may_use_rel_p 1 +#define elf_backend_may_use_rela_p 0 +#define elf_backend_default_use_rela_p 0 +#define elf_backend_rela_normal 0 + +#define elf_backend_got_header_size 12 + +#include "elf32-target.h" + +/* VxWorks Targets */ + +#undef TARGET_LITTLE_SYM +#define TARGET_LITTLE_SYM bfd_elf32_littlearm_vxworks_vec +#undef TARGET_LITTLE_NAME +#define TARGET_LITTLE_NAME "elf32-littlearm-vxworks" +#undef TARGET_BIG_SYM +#define TARGET_BIG_SYM bfd_elf32_bigarm_vxworks_vec +#undef TARGET_BIG_NAME +#define TARGET_BIG_NAME "elf32-bigarm-vxworks" + +/* Like elf32_arm_link_hash_table_create -- but overrides + appropriately for VxWorks. */ +static struct bfd_link_hash_table * +elf32_arm_vxworks_link_hash_table_create (bfd *abfd) +{ + struct bfd_link_hash_table *ret; + + ret = elf32_arm_link_hash_table_create (abfd); + if (ret) + { + struct elf32_arm_link_hash_table *htab + = (struct elf32_arm_link_hash_table *) ret; + htab->use_rel = 0; + htab->vxworks_p = 1; + } + return ret; +} + +static void +elf32_arm_vxworks_final_write_processing (bfd *abfd, bfd_boolean linker) +{ + elf32_arm_final_write_processing (abfd, linker); + elf_vxworks_final_write_processing (abfd, linker); +} + +#undef elf32_bed +#define elf32_bed elf32_arm_vxworks_bed + +#undef bfd_elf32_bfd_link_hash_table_create +#define bfd_elf32_bfd_link_hash_table_create \ + elf32_arm_vxworks_link_hash_table_create +#undef elf_backend_add_symbol_hook +#define elf_backend_add_symbol_hook \ + elf_vxworks_add_symbol_hook +#undef elf_backend_final_write_processing +#define elf_backend_final_write_processing \ + elf32_arm_vxworks_final_write_processing +#undef elf_backend_emit_relocs +#define elf_backend_emit_relocs \ + elf_vxworks_emit_relocs + +#undef elf_backend_may_use_rel_p +#define elf_backend_may_use_rel_p 0 +#undef elf_backend_may_use_rela_p +#define elf_backend_may_use_rela_p 1 +#undef elf_backend_default_use_rela_p +#define elf_backend_default_use_rela_p 1 +#undef elf_backend_rela_normal +#define elf_backend_rela_normal 1 +#undef elf_backend_want_plt_sym +#define elf_backend_want_plt_sym 1 +#undef ELF_MAXPAGESIZE +#define ELF_MAXPAGESIZE 0x1000 + +#include "elf32-target.h" + + +/* Symbian OS Targets */ + +#undef TARGET_LITTLE_SYM +#define TARGET_LITTLE_SYM bfd_elf32_littlearm_symbian_vec +#undef TARGET_LITTLE_NAME +#define TARGET_LITTLE_NAME "elf32-littlearm-symbian" +#undef TARGET_BIG_SYM +#define TARGET_BIG_SYM bfd_elf32_bigarm_symbian_vec +#undef TARGET_BIG_NAME +#define TARGET_BIG_NAME "elf32-bigarm-symbian" + +/* Like elf32_arm_link_hash_table_create -- but overrides + appropriately for Symbian OS. */ +static struct bfd_link_hash_table * +elf32_arm_symbian_link_hash_table_create (bfd *abfd) +{ + struct bfd_link_hash_table *ret; + + ret = elf32_arm_link_hash_table_create (abfd); + if (ret) + { + struct elf32_arm_link_hash_table *htab + = (struct elf32_arm_link_hash_table *)ret; + /* There is no PLT header for Symbian OS. */ + htab->plt_header_size = 0; + /* The PLT entries are each three instructions. */ + htab->plt_entry_size = 4 * NUM_ELEM (elf32_arm_symbian_plt_entry); + htab->symbian_p = 1; + /* Symbian uses armv5t or above, so use_blx is always true. */ + htab->use_blx = 1; + htab->root.is_relocatable_executable = 1; + } + return ret; +} + +static const struct bfd_elf_special_section +elf32_arm_symbian_special_sections[] = +{ + /* In a BPABI executable, the dynamic linking sections do not go in + the loadable read-only segment. The post-linker may wish to + refer to these sections, but they are not part of the final + program image. */ + { ".dynamic", 8, 0, SHT_DYNAMIC, 0 }, + { ".dynstr", 7, 0, SHT_STRTAB, 0 }, + { ".dynsym", 7, 0, SHT_DYNSYM, 0 }, + { ".got", 4, 0, SHT_PROGBITS, 0 }, + { ".hash", 5, 0, SHT_HASH, 0 }, + /* These sections do not need to be writable as the SymbianOS + postlinker will arrange things so that no dynamic relocation is + required. */ + { ".init_array", 11, 0, SHT_INIT_ARRAY, SHF_ALLOC }, + { ".fini_array", 11, 0, SHT_FINI_ARRAY, SHF_ALLOC }, + { ".preinit_array", 14, 0, SHT_PREINIT_ARRAY, SHF_ALLOC }, + { NULL, 0, 0, 0, 0 } +}; + +static void +elf32_arm_symbian_begin_write_processing (bfd *abfd, + struct bfd_link_info *link_info + ATTRIBUTE_UNUSED) +{ + /* BPABI objects are never loaded directly by an OS kernel; they are + processed by a postlinker first, into an OS-specific format. If + the D_PAGED bit is set on the file, BFD will align segments on + page boundaries, so that an OS can directly map the file. With + BPABI objects, that just results in wasted space. In addition, + because we clear the D_PAGED bit, map_sections_to_segments will + recognize that the program headers should not be mapped into any + loadable segment. */ + abfd->flags &= ~D_PAGED; +} + +static bfd_boolean +elf32_arm_symbian_modify_segment_map (bfd *abfd, + struct bfd_link_info *info) +{ + struct elf_segment_map *m; + asection *dynsec; + + /* BPABI shared libraries and executables should have a PT_DYNAMIC + segment. However, because the .dynamic section is not marked + with SEC_LOAD, the generic ELF code will not create such a + segment. */ + dynsec = bfd_get_section_by_name (abfd, ".dynamic"); + if (dynsec) + { + m = _bfd_elf_make_dynamic_segment (abfd, dynsec); + m->next = elf_tdata (abfd)->segment_map; + elf_tdata (abfd)->segment_map = m; + } + + /* Also call the generic arm routine. */ + return elf32_arm_modify_segment_map (abfd, info); +} + +#undef elf32_bed +#define elf32_bed elf32_arm_symbian_bed + +/* The dynamic sections are not allocated on SymbianOS; the postlinker + will process them and then discard them. */ +#undef ELF_DYNAMIC_SEC_FLAGS +#define ELF_DYNAMIC_SEC_FLAGS \ + (SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED) + +#undef bfd_elf32_bfd_link_hash_table_create +#define bfd_elf32_bfd_link_hash_table_create \ + elf32_arm_symbian_link_hash_table_create +#undef elf_backend_add_symbol_hook + +#undef elf_backend_special_sections +#define elf_backend_special_sections elf32_arm_symbian_special_sections + +#undef elf_backend_begin_write_processing +#define elf_backend_begin_write_processing \ + elf32_arm_symbian_begin_write_processing +#undef elf_backend_final_write_processing +#define elf_backend_final_write_processing \ + elf32_arm_final_write_processing +#undef elf_backend_emit_relocs + +#undef elf_backend_modify_segment_map +#define elf_backend_modify_segment_map elf32_arm_symbian_modify_segment_map + +/* There is no .got section for BPABI objects, and hence no header. */ +#undef elf_backend_got_header_size +#define elf_backend_got_header_size 0 + +/* Similarly, there is no .got.plt section. */ +#undef elf_backend_want_got_plt +#define elf_backend_want_got_plt 0 + +#undef elf_backend_may_use_rel_p +#define elf_backend_may_use_rel_p 1 +#undef elf_backend_may_use_rela_p +#define elf_backend_may_use_rela_p 0 +#undef elf_backend_default_use_rela_p +#define elf_backend_default_use_rela_p 0 +#undef elf_backend_rela_normal +#define elf_backend_rela_normal 0 +#undef elf_backend_want_plt_sym +#define elf_backend_want_plt_sym 0 +#undef ELF_MAXPAGESIZE +#define ELF_MAXPAGESIZE 0x8000 + +#include "elf32-target.h" diff --git a/contrib/binutils/bfd/elf32-arm.h b/contrib/binutils/bfd/elf32-arm.h deleted file mode 100644 index 8c1acc0625c..00000000000 --- a/contrib/binutils/bfd/elf32-arm.h +++ /dev/null @@ -1,4108 +0,0 @@ -/* 32-bit ELF support for ARM - Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 - 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 USE_REL -#define USE_REL 0 -#endif - -typedef unsigned long int insn32; -typedef unsigned short int insn16; - -static bfd_boolean elf32_arm_set_private_flags - PARAMS ((bfd *, flagword)); -static bfd_boolean elf32_arm_copy_private_bfd_data - PARAMS ((bfd *, bfd *)); -static bfd_boolean elf32_arm_merge_private_bfd_data - PARAMS ((bfd *, bfd *)); -static bfd_boolean elf32_arm_print_private_bfd_data - PARAMS ((bfd *, PTR)); -static int elf32_arm_get_symbol_type - PARAMS (( Elf_Internal_Sym *, int)); -static struct bfd_link_hash_table *elf32_arm_link_hash_table_create - PARAMS ((bfd *)); -static bfd_reloc_status_type elf32_arm_final_link_relocate - PARAMS ((reloc_howto_type *, bfd *, bfd *, asection *, bfd_byte *, - Elf_Internal_Rela *, bfd_vma, struct bfd_link_info *, asection *, - const char *, int, struct elf_link_hash_entry *)); -static insn32 insert_thumb_branch - PARAMS ((insn32, int)); -static struct elf_link_hash_entry *find_thumb_glue - PARAMS ((struct bfd_link_info *, const char *, bfd *)); -static struct elf_link_hash_entry *find_arm_glue - PARAMS ((struct bfd_link_info *, const char *, bfd *)); -static void elf32_arm_post_process_headers - PARAMS ((bfd *, struct bfd_link_info *)); -static int elf32_arm_to_thumb_stub - PARAMS ((struct bfd_link_info *, const char *, bfd *, bfd *, asection *, - bfd_byte *, asection *, bfd_vma, bfd_signed_vma, bfd_vma)); -static int elf32_thumb_to_arm_stub - PARAMS ((struct bfd_link_info *, const char *, bfd *, bfd *, asection *, - bfd_byte *, asection *, bfd_vma, bfd_signed_vma, bfd_vma)); -static bfd_boolean elf32_arm_relocate_section - PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, - Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); -static asection * elf32_arm_gc_mark_hook - PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *, - struct elf_link_hash_entry *, Elf_Internal_Sym *)); -static bfd_boolean elf32_arm_gc_sweep_hook - PARAMS ((bfd *, struct bfd_link_info *, asection *, - const Elf_Internal_Rela *)); -static bfd_boolean elf32_arm_check_relocs - PARAMS ((bfd *, struct bfd_link_info *, asection *, - const Elf_Internal_Rela *)); -static bfd_boolean elf32_arm_find_nearest_line - PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **, - const char **, unsigned int *)); -static bfd_boolean elf32_arm_adjust_dynamic_symbol - PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *)); -static bfd_boolean elf32_arm_size_dynamic_sections - PARAMS ((bfd *, struct bfd_link_info *)); -static bfd_boolean elf32_arm_finish_dynamic_symbol - PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, - Elf_Internal_Sym *)); -static bfd_boolean elf32_arm_finish_dynamic_sections - PARAMS ((bfd *, struct bfd_link_info *)); -static struct bfd_hash_entry * elf32_arm_link_hash_newfunc - PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); -#if USE_REL -static void arm_add_to_rel - PARAMS ((bfd *, bfd_byte *, reloc_howto_type *, bfd_signed_vma)); -#endif -static bfd_boolean allocate_dynrelocs - PARAMS ((struct elf_link_hash_entry *h, PTR inf)); -static bfd_boolean create_got_section - PARAMS ((bfd * dynobj, struct bfd_link_info * info)); -static bfd_boolean elf32_arm_create_dynamic_sections - PARAMS ((bfd * dynobj, struct bfd_link_info * info)); -static enum elf_reloc_type_class elf32_arm_reloc_type_class - PARAMS ((const Elf_Internal_Rela *)); -static bfd_boolean elf32_arm_object_p - PARAMS ((bfd *)); - -#ifndef ELFARM_NABI_C_INCLUDED -static void record_arm_to_thumb_glue - PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *)); -static void record_thumb_to_arm_glue - PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *)); -bfd_boolean bfd_elf32_arm_allocate_interworking_sections - PARAMS ((struct bfd_link_info *)); -bfd_boolean bfd_elf32_arm_get_bfd_for_interworking - PARAMS ((bfd *, struct bfd_link_info *)); -bfd_boolean bfd_elf32_arm_process_before_allocation - PARAMS ((bfd *, struct bfd_link_info *, int)); -#endif - - -#define INTERWORK_FLAG(abfd) (elf_elfheader (abfd)->e_flags & EF_ARM_INTERWORK) - -/* The linker script knows the section names for placement. - The entry_names are used to do simple name mangling on the stubs. - Given a function name, and its type, the stub can be found. The - name can be changed. The only requirement is the %s be present. */ -#define THUMB2ARM_GLUE_SECTION_NAME ".glue_7t" -#define THUMB2ARM_GLUE_ENTRY_NAME "__%s_from_thumb" - -#define ARM2THUMB_GLUE_SECTION_NAME ".glue_7" -#define ARM2THUMB_GLUE_ENTRY_NAME "__%s_from_arm" - -/* The name of the dynamic interpreter. This is put in the .interp - section. */ -#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1" - -#ifdef FOUR_WORD_PLT - -/* The size in bytes of the special first entry in the procedure - linkage table. */ -#define PLT_HEADER_SIZE 16 - -/* The size in bytes of an entry in the procedure linkage table. */ -#define PLT_ENTRY_SIZE 16 - -/* The first entry in a procedure linkage table looks like - this. It is set up so that any shared library function that is - called before the relocation has been set up calls the dynamic - linker first. */ -static const bfd_vma elf32_arm_plt0_entry [PLT_HEADER_SIZE / 4] = - { - 0xe52de004, /* str lr, [sp, #-4]! */ - 0xe59fe010, /* ldr lr, [pc, #16] */ - 0xe08fe00e, /* add lr, pc, lr */ - 0xe5bef008, /* ldr pc, [lr, #8]! */ - }; - -/* Subsequent entries in a procedure linkage table look like - this. */ -static const bfd_vma elf32_arm_plt_entry [PLT_ENTRY_SIZE / 4] = - { - 0xe28fc600, /* add ip, pc, #NN */ - 0xe28cca00, /* add ip, ip, #NN */ - 0xe5bcf000, /* ldr pc, [ip, #NN]! */ - 0x00000000, /* unused */ - }; - -#else - -/* The size in bytes of the special first entry in the procedure - linkage table. */ -#define PLT_HEADER_SIZE 20 - -/* The size in bytes of an entry in the procedure linkage table. */ -#define PLT_ENTRY_SIZE 12 - -/* The first entry in a procedure linkage table looks like - this. It is set up so that any shared library function that is - called before the relocation has been set up calls the dynamic - linker first. */ -static const bfd_vma elf32_arm_plt0_entry [PLT_HEADER_SIZE / 4] = - { - 0xe52de004, /* str lr, [sp, #-4]! */ - 0xe59fe004, /* ldr lr, [pc, #4] */ - 0xe08fe00e, /* add lr, pc, lr */ - 0xe5bef008, /* ldr pc, [lr, #8]! */ - 0x00000000, /* &GOT[0] - . */ - }; - -/* Subsequent entries in a procedure linkage table look like - this. */ -static const bfd_vma elf32_arm_plt_entry [PLT_ENTRY_SIZE / 4] = - { - 0xe28fc600, /* add ip, pc, #0xNN00000 */ - 0xe28cca00, /* add ip, ip, #0xNN000 */ - 0xe5bcf000, /* ldr pc, [ip, #0xNNN]! */ - }; - -#endif - -/* The ARM linker needs to keep track of the number of relocs that it - decides to copy in check_relocs for each symbol. This is so that - it can discard PC relative relocs if it doesn't need them when - linking with -Bsymbolic. We store the information in a field - extending the regular ELF linker hash table. */ - -/* This structure keeps track of the number of PC relative relocs we - have copied for a given symbol. */ -struct elf32_arm_relocs_copied - { - /* Next section. */ - struct elf32_arm_relocs_copied * next; - /* A section in dynobj. */ - asection * section; - /* Number of relocs copied in this section. */ - bfd_size_type count; - }; - -/* Arm ELF linker hash entry. */ -struct elf32_arm_link_hash_entry - { - struct elf_link_hash_entry root; - - /* Number of PC relative relocs copied for this symbol. */ - struct elf32_arm_relocs_copied * relocs_copied; - }; - -/* Traverse an arm ELF linker hash table. */ -#define elf32_arm_link_hash_traverse(table, func, info) \ - (elf_link_hash_traverse \ - (&(table)->root, \ - (bfd_boolean (*) PARAMS ((struct elf_link_hash_entry *, PTR))) (func), \ - (info))) - -/* Get the ARM elf linker hash table from a link_info structure. */ -#define elf32_arm_hash_table(info) \ - ((struct elf32_arm_link_hash_table *) ((info)->hash)) - -/* ARM ELF linker hash table. */ -struct elf32_arm_link_hash_table - { - /* The main hash table. */ - struct elf_link_hash_table root; - - /* The size in bytes of the section containing the Thumb-to-ARM glue. */ - bfd_size_type thumb_glue_size; - - /* The size in bytes of the section containing the ARM-to-Thumb glue. */ - bfd_size_type arm_glue_size; - - /* An arbitrary input BFD chosen to hold the glue sections. */ - bfd * bfd_of_glue_owner; - - /* A boolean indicating whether knowledge of the ARM's pipeline - length should be applied by the linker. */ - int no_pipeline_knowledge; - - /* Short-cuts to get to dynamic linker sections. */ - asection *sgot; - asection *sgotplt; - asection *srelgot; - asection *splt; - asection *srelplt; - asection *sdynbss; - asection *srelbss; - - /* Small local sym to section mapping cache. */ - struct sym_sec_cache sym_sec; - }; - -/* Create an entry in an ARM ELF linker hash table. */ - -static struct bfd_hash_entry * -elf32_arm_link_hash_newfunc (entry, table, string) - struct bfd_hash_entry * entry; - struct bfd_hash_table * table; - const char * string; -{ - struct elf32_arm_link_hash_entry * ret = - (struct elf32_arm_link_hash_entry *) entry; - - /* Allocate the structure if it has not already been allocated by a - subclass. */ - if (ret == (struct elf32_arm_link_hash_entry *) NULL) - ret = ((struct elf32_arm_link_hash_entry *) - bfd_hash_allocate (table, - sizeof (struct elf32_arm_link_hash_entry))); - if (ret == (struct elf32_arm_link_hash_entry *) NULL) - return (struct bfd_hash_entry *) ret; - - /* Call the allocation method of the superclass. */ - ret = ((struct elf32_arm_link_hash_entry *) - _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret, - table, string)); - if (ret != (struct elf32_arm_link_hash_entry *) NULL) - ret->relocs_copied = NULL; - - return (struct bfd_hash_entry *) ret; -} - -/* Create .got, .gotplt, and .rel.got sections in DYNOBJ, and set up - shortcuts to them in our hash table. */ - -static bfd_boolean -create_got_section (dynobj, info) - bfd *dynobj; - struct bfd_link_info *info; -{ - struct elf32_arm_link_hash_table *htab; - - if (! _bfd_elf_create_got_section (dynobj, info)) - return FALSE; - - htab = elf32_arm_hash_table (info); - htab->sgot = bfd_get_section_by_name (dynobj, ".got"); - htab->sgotplt = bfd_get_section_by_name (dynobj, ".got.plt"); - if (!htab->sgot || !htab->sgotplt) - abort (); - - htab->srelgot = bfd_make_section (dynobj, ".rel.got"); - if (htab->srelgot == NULL - || ! bfd_set_section_flags (dynobj, htab->srelgot, - (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS - | SEC_IN_MEMORY | SEC_LINKER_CREATED - | SEC_READONLY)) - || ! bfd_set_section_alignment (dynobj, htab->srelgot, 2)) - return FALSE; - return TRUE; -} - -/* Create .plt, .rel.plt, .got, .got.plt, .rel.got, .dynbss, and - .rel.bss sections in DYNOBJ, and set up shortcuts to them in our - hash table. */ - -static bfd_boolean -elf32_arm_create_dynamic_sections (dynobj, info) - bfd *dynobj; - struct bfd_link_info *info; -{ - struct elf32_arm_link_hash_table *htab; - - htab = elf32_arm_hash_table (info); - if (!htab->sgot && !create_got_section (dynobj, info)) - return FALSE; - - if (!_bfd_elf_create_dynamic_sections (dynobj, info)) - return FALSE; - - htab->splt = bfd_get_section_by_name (dynobj, ".plt"); - htab->srelplt = bfd_get_section_by_name (dynobj, ".rel.plt"); - htab->sdynbss = bfd_get_section_by_name (dynobj, ".dynbss"); - if (!info->shared) - htab->srelbss = bfd_get_section_by_name (dynobj, ".rel.bss"); - - if (!htab->splt || !htab->srelplt || !htab->sdynbss - || (!info->shared && !htab->srelbss)) - abort (); - - return TRUE; -} - -/* Copy the extra info we tack onto an elf_link_hash_entry. */ - -static void -elf32_arm_copy_indirect_symbol (const struct elf_backend_data *bed, - struct elf_link_hash_entry *dir, - struct elf_link_hash_entry *ind) -{ - struct elf32_arm_link_hash_entry *edir, *eind; - - edir = (struct elf32_arm_link_hash_entry *) dir; - eind = (struct elf32_arm_link_hash_entry *) ind; - - if (eind->relocs_copied != NULL) - { - if (edir->relocs_copied != NULL) - { - struct elf32_arm_relocs_copied **pp; - struct elf32_arm_relocs_copied *p; - - if (ind->root.type == bfd_link_hash_indirect) - abort (); - - /* Add reloc counts against the weak sym to the strong sym - list. Merge any entries against the same section. */ - for (pp = &eind->relocs_copied; (p = *pp) != NULL; ) - { - struct elf32_arm_relocs_copied *q; - - for (q = edir->relocs_copied; q != NULL; q = q->next) - if (q->section == p->section) - { - q->count += p->count; - *pp = p->next; - break; - } - if (q == NULL) - pp = &p->next; - } - *pp = edir->relocs_copied; - } - - edir->relocs_copied = eind->relocs_copied; - eind->relocs_copied = NULL; - } - - _bfd_elf_link_hash_copy_indirect (bed, dir, ind); -} - -/* Create an ARM elf linker hash table. */ - -static struct bfd_link_hash_table * -elf32_arm_link_hash_table_create (abfd) - bfd *abfd; -{ - struct elf32_arm_link_hash_table *ret; - bfd_size_type amt = sizeof (struct elf32_arm_link_hash_table); - - ret = (struct elf32_arm_link_hash_table *) bfd_malloc (amt); - if (ret == (struct elf32_arm_link_hash_table *) NULL) - return NULL; - - if (!_bfd_elf_link_hash_table_init (&ret->root, abfd, - elf32_arm_link_hash_newfunc)) - { - free (ret); - return NULL; - } - - ret->sgot = NULL; - ret->sgotplt = NULL; - ret->srelgot = NULL; - ret->splt = NULL; - ret->srelplt = NULL; - ret->sdynbss = NULL; - ret->srelbss = NULL; - ret->thumb_glue_size = 0; - ret->arm_glue_size = 0; - ret->bfd_of_glue_owner = NULL; - ret->no_pipeline_knowledge = 0; - ret->sym_sec.abfd = NULL; - - return &ret->root.root; -} - -/* Locate the Thumb encoded calling stub for NAME. */ - -static struct elf_link_hash_entry * -find_thumb_glue (link_info, name, input_bfd) - struct bfd_link_info *link_info; - const char *name; - bfd *input_bfd; -{ - char *tmp_name; - struct elf_link_hash_entry *hash; - struct elf32_arm_link_hash_table *hash_table; - - /* We need a pointer to the armelf specific hash table. */ - hash_table = elf32_arm_hash_table (link_info); - - tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen (name) - + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1); - - BFD_ASSERT (tmp_name); - - sprintf (tmp_name, THUMB2ARM_GLUE_ENTRY_NAME, name); - - hash = elf_link_hash_lookup - (&(hash_table)->root, tmp_name, FALSE, FALSE, TRUE); - - if (hash == NULL) - /* xgettext:c-format */ - (*_bfd_error_handler) (_("%s: unable to find THUMB glue '%s' for `%s'"), - bfd_archive_filename (input_bfd), tmp_name, name); - - free (tmp_name); - - return hash; -} - -/* Locate the ARM encoded calling stub for NAME. */ - -static struct elf_link_hash_entry * -find_arm_glue (link_info, name, input_bfd) - struct bfd_link_info *link_info; - const char *name; - bfd *input_bfd; -{ - char *tmp_name; - struct elf_link_hash_entry *myh; - struct elf32_arm_link_hash_table *hash_table; - - /* We need a pointer to the elfarm specific hash table. */ - hash_table = elf32_arm_hash_table (link_info); - - tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen (name) - + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1); - - BFD_ASSERT (tmp_name); - - sprintf (tmp_name, ARM2THUMB_GLUE_ENTRY_NAME, name); - - myh = elf_link_hash_lookup - (&(hash_table)->root, tmp_name, FALSE, FALSE, TRUE); - - if (myh == NULL) - /* xgettext:c-format */ - (*_bfd_error_handler) (_("%s: unable to find ARM glue '%s' for `%s'"), - bfd_archive_filename (input_bfd), tmp_name, name); - - free (tmp_name); - - return myh; -} - -/* ARM->Thumb glue: - - .arm - __func_from_arm: - ldr r12, __func_addr - bx r12 - __func_addr: - .word func @ behave as if you saw a ARM_32 reloc. */ - -#define ARM2THUMB_GLUE_SIZE 12 -static const insn32 a2t1_ldr_insn = 0xe59fc000; -static const insn32 a2t2_bx_r12_insn = 0xe12fff1c; -static const insn32 a2t3_func_addr_insn = 0x00000001; - -/* Thumb->ARM: Thumb->(non-interworking aware) ARM - - .thumb .thumb - .align 2 .align 2 - __func_from_thumb: __func_from_thumb: - bx pc push {r6, lr} - nop ldr r6, __func_addr - .arm mov lr, pc - __func_change_to_arm: bx r6 - b func .arm - __func_back_to_thumb: - ldmia r13! {r6, lr} - bx lr - __func_addr: - .word func */ - -#define THUMB2ARM_GLUE_SIZE 8 -static const insn16 t2a1_bx_pc_insn = 0x4778; -static const insn16 t2a2_noop_insn = 0x46c0; -static const insn32 t2a3_b_insn = 0xea000000; - -#ifndef ELFARM_NABI_C_INCLUDED -bfd_boolean -bfd_elf32_arm_allocate_interworking_sections (info) - struct bfd_link_info * info; -{ - asection * s; - bfd_byte * foo; - struct elf32_arm_link_hash_table * globals; - - globals = elf32_arm_hash_table (info); - - BFD_ASSERT (globals != NULL); - - if (globals->arm_glue_size != 0) - { - BFD_ASSERT (globals->bfd_of_glue_owner != NULL); - - s = bfd_get_section_by_name (globals->bfd_of_glue_owner, - ARM2THUMB_GLUE_SECTION_NAME); - - BFD_ASSERT (s != NULL); - - foo = (bfd_byte *) bfd_alloc (globals->bfd_of_glue_owner, - globals->arm_glue_size); - - s->_raw_size = s->_cooked_size = globals->arm_glue_size; - s->contents = foo; - } - - if (globals->thumb_glue_size != 0) - { - BFD_ASSERT (globals->bfd_of_glue_owner != NULL); - - s = bfd_get_section_by_name - (globals->bfd_of_glue_owner, THUMB2ARM_GLUE_SECTION_NAME); - - BFD_ASSERT (s != NULL); - - foo = (bfd_byte *) bfd_alloc (globals->bfd_of_glue_owner, - globals->thumb_glue_size); - - s->_raw_size = s->_cooked_size = globals->thumb_glue_size; - s->contents = foo; - } - - return TRUE; -} - -static void -record_arm_to_thumb_glue (link_info, h) - struct bfd_link_info * link_info; - struct elf_link_hash_entry * h; -{ - const char * name = h->root.root.string; - asection * s; - char * tmp_name; - struct elf_link_hash_entry * myh; - struct bfd_link_hash_entry * bh; - struct elf32_arm_link_hash_table * globals; - bfd_vma val; - - globals = elf32_arm_hash_table (link_info); - - BFD_ASSERT (globals != NULL); - BFD_ASSERT (globals->bfd_of_glue_owner != NULL); - - s = bfd_get_section_by_name - (globals->bfd_of_glue_owner, ARM2THUMB_GLUE_SECTION_NAME); - - BFD_ASSERT (s != NULL); - - tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen (name) - + strlen (ARM2THUMB_GLUE_ENTRY_NAME) + 1); - - BFD_ASSERT (tmp_name); - - sprintf (tmp_name, ARM2THUMB_GLUE_ENTRY_NAME, name); - - myh = elf_link_hash_lookup - (&(globals)->root, tmp_name, FALSE, FALSE, TRUE); - - if (myh != NULL) - { - /* We've already seen this guy. */ - free (tmp_name); - return; - } - - /* The only trick here is using hash_table->arm_glue_size as the value. Even - though the section isn't allocated yet, this is where we will be putting - it. */ - bh = NULL; - val = globals->arm_glue_size + 1; - _bfd_generic_link_add_one_symbol (link_info, globals->bfd_of_glue_owner, - tmp_name, BSF_GLOBAL, s, val, - NULL, TRUE, FALSE, &bh); - - free (tmp_name); - - globals->arm_glue_size += ARM2THUMB_GLUE_SIZE; - - return; -} - -static void -record_thumb_to_arm_glue (link_info, h) - struct bfd_link_info *link_info; - struct elf_link_hash_entry *h; -{ - const char *name = h->root.root.string; - asection *s; - char *tmp_name; - struct elf_link_hash_entry *myh; - struct bfd_link_hash_entry *bh; - struct elf32_arm_link_hash_table *hash_table; - char bind; - bfd_vma val; - - hash_table = elf32_arm_hash_table (link_info); - - BFD_ASSERT (hash_table != NULL); - BFD_ASSERT (hash_table->bfd_of_glue_owner != NULL); - - s = bfd_get_section_by_name - (hash_table->bfd_of_glue_owner, THUMB2ARM_GLUE_SECTION_NAME); - - BFD_ASSERT (s != NULL); - - tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen (name) - + strlen (THUMB2ARM_GLUE_ENTRY_NAME) + 1); - - BFD_ASSERT (tmp_name); - - sprintf (tmp_name, THUMB2ARM_GLUE_ENTRY_NAME, name); - - myh = elf_link_hash_lookup - (&(hash_table)->root, tmp_name, FALSE, FALSE, TRUE); - - if (myh != NULL) - { - /* We've already seen this guy. */ - free (tmp_name); - return; - } - - bh = NULL; - val = hash_table->thumb_glue_size + 1; - _bfd_generic_link_add_one_symbol (link_info, hash_table->bfd_of_glue_owner, - tmp_name, BSF_GLOBAL, s, val, - NULL, TRUE, FALSE, &bh); - - /* If we mark it 'Thumb', the disassembler will do a better job. */ - myh = (struct elf_link_hash_entry *) bh; - bind = ELF_ST_BIND (myh->type); - myh->type = ELF_ST_INFO (bind, STT_ARM_TFUNC); - - free (tmp_name); - -#define CHANGE_TO_ARM "__%s_change_to_arm" -#define BACK_FROM_ARM "__%s_back_from_arm" - - /* Allocate another symbol to mark where we switch to Arm mode. */ - tmp_name = (char *) bfd_malloc ((bfd_size_type) strlen (name) - + strlen (CHANGE_TO_ARM) + 1); - - BFD_ASSERT (tmp_name); - - sprintf (tmp_name, CHANGE_TO_ARM, name); - - bh = NULL; - val = hash_table->thumb_glue_size + 4, - _bfd_generic_link_add_one_symbol (link_info, hash_table->bfd_of_glue_owner, - tmp_name, BSF_LOCAL, s, val, - NULL, TRUE, FALSE, &bh); - - free (tmp_name); - - hash_table->thumb_glue_size += THUMB2ARM_GLUE_SIZE; - - return; -} - -/* Add the glue sections to ABFD. This function is called from the - linker scripts in ld/emultempl/{armelf}.em. */ - -bfd_boolean -bfd_elf32_arm_add_glue_sections_to_bfd (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - flagword flags; - asection *sec; - - /* If we are only performing a partial - link do not bother adding the glue. */ - if (info->relocatable) - return TRUE; - - sec = bfd_get_section_by_name (abfd, ARM2THUMB_GLUE_SECTION_NAME); - - if (sec == NULL) - { - /* Note: we do not include the flag SEC_LINKER_CREATED, as this - will prevent elf_link_input_bfd() from processing the contents - of this section. */ - flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_CODE | SEC_READONLY; - - sec = bfd_make_section (abfd, ARM2THUMB_GLUE_SECTION_NAME); - - if (sec == NULL - || !bfd_set_section_flags (abfd, sec, flags) - || !bfd_set_section_alignment (abfd, sec, 2)) - return FALSE; - - /* Set the gc mark to prevent the section from being removed by garbage - collection, despite the fact that no relocs refer to this section. */ - sec->gc_mark = 1; - } - - sec = bfd_get_section_by_name (abfd, THUMB2ARM_GLUE_SECTION_NAME); - - if (sec == NULL) - { - flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_CODE | SEC_READONLY; - - sec = bfd_make_section (abfd, THUMB2ARM_GLUE_SECTION_NAME); - - if (sec == NULL - || !bfd_set_section_flags (abfd, sec, flags) - || !bfd_set_section_alignment (abfd, sec, 2)) - return FALSE; - - sec->gc_mark = 1; - } - - return TRUE; -} - -/* Select a BFD to be used to hold the sections used by the glue code. - This function is called from the linker scripts in ld/emultempl/ - {armelf/pe}.em */ - -bfd_boolean -bfd_elf32_arm_get_bfd_for_interworking (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - struct elf32_arm_link_hash_table *globals; - - /* If we are only performing a partial link - do not bother getting a bfd to hold the glue. */ - if (info->relocatable) - return TRUE; - - globals = elf32_arm_hash_table (info); - - BFD_ASSERT (globals != NULL); - - if (globals->bfd_of_glue_owner != NULL) - return TRUE; - - /* Save the bfd for later use. */ - globals->bfd_of_glue_owner = abfd; - - return TRUE; -} - -bfd_boolean -bfd_elf32_arm_process_before_allocation (abfd, link_info, no_pipeline_knowledge) - bfd *abfd; - struct bfd_link_info *link_info; - int no_pipeline_knowledge; -{ - Elf_Internal_Shdr *symtab_hdr; - Elf_Internal_Rela *internal_relocs = NULL; - Elf_Internal_Rela *irel, *irelend; - bfd_byte *contents = NULL; - - asection *sec; - struct elf32_arm_link_hash_table *globals; - - /* If we are only performing a partial link do not bother - to construct any glue. */ - if (link_info->relocatable) - return TRUE; - - /* Here we have a bfd that is to be included on the link. We have a hook - to do reloc rummaging, before section sizes are nailed down. */ - globals = elf32_arm_hash_table (link_info); - - BFD_ASSERT (globals != NULL); - BFD_ASSERT (globals->bfd_of_glue_owner != NULL); - - globals->no_pipeline_knowledge = no_pipeline_knowledge; - - /* Rummage around all the relocs and map the glue vectors. */ - sec = abfd->sections; - - if (sec == NULL) - return TRUE; - - for (; sec != NULL; sec = sec->next) - { - if (sec->reloc_count == 0) - continue; - - symtab_hdr = &elf_tdata (abfd)->symtab_hdr; - - /* Load the relocs. */ - internal_relocs - = _bfd_elf_link_read_relocs (abfd, sec, (PTR) NULL, - (Elf_Internal_Rela *) NULL, FALSE); - - if (internal_relocs == NULL) - goto error_return; - - irelend = internal_relocs + sec->reloc_count; - for (irel = internal_relocs; irel < irelend; irel++) - { - long r_type; - unsigned long r_index; - - struct elf_link_hash_entry *h; - - r_type = ELF32_R_TYPE (irel->r_info); - r_index = ELF32_R_SYM (irel->r_info); - - /* These are the only relocation types we care about. */ - if ( r_type != R_ARM_PC24 - && r_type != R_ARM_THM_PC22) - continue; - - /* Get the section contents if we haven't done so already. */ - if (contents == NULL) - { - /* Get cached copy if it exists. */ - if (elf_section_data (sec)->this_hdr.contents != NULL) - contents = elf_section_data (sec)->this_hdr.contents; - else - { - /* Go get them off disk. */ - contents = (bfd_byte *) bfd_malloc (sec->_raw_size); - if (contents == NULL) - goto error_return; - - if (!bfd_get_section_contents (abfd, sec, contents, - (file_ptr) 0, sec->_raw_size)) - goto error_return; - } - } - - /* If the relocation is not against a symbol it cannot concern us. */ - h = NULL; - - /* We don't care about local symbols. */ - if (r_index < symtab_hdr->sh_info) - continue; - - /* This is an external symbol. */ - r_index -= symtab_hdr->sh_info; - h = (struct elf_link_hash_entry *) - elf_sym_hashes (abfd)[r_index]; - - /* If the relocation is against a static symbol it must be within - the current section and so cannot be a cross ARM/Thumb relocation. */ - if (h == NULL) - continue; - - switch (r_type) - { - case R_ARM_PC24: - /* This one is a call from arm code. We need to look up - the target of the call. If it is a thumb target, we - insert glue. */ - if (ELF_ST_TYPE(h->type) == STT_ARM_TFUNC) - record_arm_to_thumb_glue (link_info, h); - break; - - case R_ARM_THM_PC22: - /* This one is a call from thumb code. We look - up the target of the call. If it is not a thumb - target, we insert glue. */ - if (ELF_ST_TYPE (h->type) != STT_ARM_TFUNC) - record_thumb_to_arm_glue (link_info, h); - break; - - default: - break; - } - } - - if (contents != NULL - && elf_section_data (sec)->this_hdr.contents != contents) - free (contents); - contents = NULL; - - if (internal_relocs != NULL - && elf_section_data (sec)->relocs != internal_relocs) - free (internal_relocs); - internal_relocs = NULL; - } - - return TRUE; - -error_return: - if (contents != NULL - && elf_section_data (sec)->this_hdr.contents != contents) - free (contents); - if (internal_relocs != NULL - && elf_section_data (sec)->relocs != internal_relocs) - free (internal_relocs); - - return FALSE; -} -#endif - -/* The thumb form of a long branch is a bit finicky, because the offset - encoding is split over two fields, each in it's own instruction. They - can occur in any order. So given a thumb form of long branch, and an - offset, insert the offset into the thumb branch and return finished - instruction. - - It takes two thumb instructions to encode the target address. Each has - 11 bits to invest. The upper 11 bits are stored in one (identified by - H-0.. see below), the lower 11 bits are stored in the other (identified - by H-1). - - Combine together and shifted left by 1 (it's a half word address) and - there you have it. - - Op: 1111 = F, - H-0, upper address-0 = 000 - Op: 1111 = F, - H-1, lower address-0 = 800 - - They can be ordered either way, but the arm tools I've seen always put - the lower one first. It probably doesn't matter. krk@cygnus.com - - XXX: Actually the order does matter. The second instruction (H-1) - moves the computed address into the PC, so it must be the second one - in the sequence. The problem, however is that whilst little endian code - stores the instructions in HI then LOW order, big endian code does the - reverse. nickc@cygnus.com. */ - -#define LOW_HI_ORDER 0xF800F000 -#define HI_LOW_ORDER 0xF000F800 - -static insn32 -insert_thumb_branch (br_insn, rel_off) - insn32 br_insn; - int rel_off; -{ - unsigned int low_bits; - unsigned int high_bits; - - BFD_ASSERT ((rel_off & 1) != 1); - - rel_off >>= 1; /* Half word aligned address. */ - low_bits = rel_off & 0x000007FF; /* The bottom 11 bits. */ - high_bits = (rel_off >> 11) & 0x000007FF; /* The top 11 bits. */ - - if ((br_insn & LOW_HI_ORDER) == LOW_HI_ORDER) - br_insn = LOW_HI_ORDER | (low_bits << 16) | high_bits; - else if ((br_insn & HI_LOW_ORDER) == HI_LOW_ORDER) - br_insn = HI_LOW_ORDER | (high_bits << 16) | low_bits; - else - /* FIXME: abort is probably not the right call. krk@cygnus.com */ - abort (); /* error - not a valid branch instruction form. */ - - return br_insn; -} - -/* Thumb code calling an ARM function. */ - -static int -elf32_thumb_to_arm_stub (info, name, input_bfd, output_bfd, input_section, - hit_data, sym_sec, offset, addend, val) - struct bfd_link_info * info; - const char * name; - bfd * input_bfd; - bfd * output_bfd; - asection * input_section; - bfd_byte * hit_data; - asection * sym_sec; - bfd_vma offset; - bfd_signed_vma addend; - bfd_vma val; -{ - asection * s = 0; - bfd_vma my_offset; - unsigned long int tmp; - long int ret_offset; - struct elf_link_hash_entry * myh; - struct elf32_arm_link_hash_table * globals; - - myh = find_thumb_glue (info, name, input_bfd); - if (myh == NULL) - return FALSE; - - globals = elf32_arm_hash_table (info); - - BFD_ASSERT (globals != NULL); - BFD_ASSERT (globals->bfd_of_glue_owner != NULL); - - my_offset = myh->root.u.def.value; - - s = bfd_get_section_by_name (globals->bfd_of_glue_owner, - THUMB2ARM_GLUE_SECTION_NAME); - - BFD_ASSERT (s != NULL); - BFD_ASSERT (s->contents != NULL); - BFD_ASSERT (s->output_section != NULL); - - if ((my_offset & 0x01) == 0x01) - { - if (sym_sec != NULL - && sym_sec->owner != NULL - && !INTERWORK_FLAG (sym_sec->owner)) - { - (*_bfd_error_handler) - (_("%s(%s): warning: interworking not enabled."), - bfd_archive_filename (sym_sec->owner), name); - (*_bfd_error_handler) - (_(" first occurrence: %s: thumb call to arm"), - bfd_archive_filename (input_bfd)); - - return FALSE; - } - - --my_offset; - myh->root.u.def.value = my_offset; - - bfd_put_16 (output_bfd, (bfd_vma) t2a1_bx_pc_insn, - s->contents + my_offset); - - bfd_put_16 (output_bfd, (bfd_vma) t2a2_noop_insn, - s->contents + my_offset + 2); - - ret_offset = - /* Address of destination of the stub. */ - ((bfd_signed_vma) val) - - ((bfd_signed_vma) - /* Offset from the start of the current section to the start of the stubs. */ - (s->output_offset - /* Offset of the start of this stub from the start of the stubs. */ - + my_offset - /* Address of the start of the current section. */ - + s->output_section->vma) - /* The branch instruction is 4 bytes into the stub. */ - + 4 - /* ARM branches work from the pc of the instruction + 8. */ - + 8); - - bfd_put_32 (output_bfd, - (bfd_vma) t2a3_b_insn | ((ret_offset >> 2) & 0x00FFFFFF), - s->contents + my_offset + 4); - } - - BFD_ASSERT (my_offset <= globals->thumb_glue_size); - - /* Now go back and fix up the original BL insn to point to here. */ - ret_offset = - /* Address of where the stub is located. */ - (s->output_section->vma + s->output_offset + my_offset) - /* Address of where the BL is located. */ - - (input_section->output_section->vma + input_section->output_offset + offset) - /* Addend in the relocation. */ - - addend - /* Biassing for PC-relative addressing. */ - - 8; - - tmp = bfd_get_32 (input_bfd, hit_data - - input_section->vma); - - bfd_put_32 (output_bfd, - (bfd_vma) insert_thumb_branch (tmp, ret_offset), - hit_data - input_section->vma); - - return TRUE; -} - -/* Arm code calling a Thumb function. */ - -static int -elf32_arm_to_thumb_stub (info, name, input_bfd, output_bfd, input_section, - hit_data, sym_sec, offset, addend, val) - struct bfd_link_info * info; - const char * name; - bfd * input_bfd; - bfd * output_bfd; - asection * input_section; - bfd_byte * hit_data; - asection * sym_sec; - bfd_vma offset; - bfd_signed_vma addend; - bfd_vma val; -{ - unsigned long int tmp; - bfd_vma my_offset; - asection * s; - long int ret_offset; - struct elf_link_hash_entry * myh; - struct elf32_arm_link_hash_table * globals; - - myh = find_arm_glue (info, name, input_bfd); - if (myh == NULL) - return FALSE; - - globals = elf32_arm_hash_table (info); - - BFD_ASSERT (globals != NULL); - BFD_ASSERT (globals->bfd_of_glue_owner != NULL); - - my_offset = myh->root.u.def.value; - s = bfd_get_section_by_name (globals->bfd_of_glue_owner, - ARM2THUMB_GLUE_SECTION_NAME); - BFD_ASSERT (s != NULL); - BFD_ASSERT (s->contents != NULL); - BFD_ASSERT (s->output_section != NULL); - - if ((my_offset & 0x01) == 0x01) - { - if (sym_sec != NULL - && sym_sec->owner != NULL - && !INTERWORK_FLAG (sym_sec->owner)) - { - (*_bfd_error_handler) - (_("%s(%s): warning: interworking not enabled."), - bfd_archive_filename (sym_sec->owner), name); - (*_bfd_error_handler) - (_(" first occurrence: %s: arm call to thumb"), - bfd_archive_filename (input_bfd)); - } - - --my_offset; - myh->root.u.def.value = my_offset; - - bfd_put_32 (output_bfd, (bfd_vma) a2t1_ldr_insn, - s->contents + my_offset); - - bfd_put_32 (output_bfd, (bfd_vma) a2t2_bx_r12_insn, - s->contents + my_offset + 4); - - /* It's a thumb address. Add the low order bit. */ - bfd_put_32 (output_bfd, val | a2t3_func_addr_insn, - s->contents + my_offset + 8); - } - - BFD_ASSERT (my_offset <= globals->arm_glue_size); - - tmp = bfd_get_32 (input_bfd, hit_data); - tmp = tmp & 0xFF000000; - - /* Somehow these are both 4 too far, so subtract 8. */ - ret_offset = (s->output_offset - + my_offset - + s->output_section->vma - - (input_section->output_offset - + input_section->output_section->vma - + offset + addend) - - 8); - - tmp = tmp | ((ret_offset >> 2) & 0x00FFFFFF); - - bfd_put_32 (output_bfd, (bfd_vma) tmp, hit_data - input_section->vma); - - return TRUE; -} - -/* Perform a relocation as part of a final link. */ - -static bfd_reloc_status_type -elf32_arm_final_link_relocate (howto, input_bfd, output_bfd, - input_section, contents, rel, value, - info, sym_sec, sym_name, sym_flags, h) - reloc_howto_type * howto; - bfd * input_bfd; - bfd * output_bfd; - asection * input_section; - bfd_byte * contents; - Elf_Internal_Rela * rel; - bfd_vma value; - struct bfd_link_info * info; - asection * sym_sec; - const char * sym_name; - int sym_flags; - struct elf_link_hash_entry * h; -{ - unsigned long r_type = howto->type; - unsigned long r_symndx; - bfd_byte * hit_data = contents + rel->r_offset; - bfd * dynobj = NULL; - Elf_Internal_Shdr * symtab_hdr; - struct elf_link_hash_entry ** sym_hashes; - bfd_vma * local_got_offsets; - asection * sgot = NULL; - asection * splt = NULL; - asection * sreloc = NULL; - bfd_vma addend; - bfd_signed_vma signed_addend; - struct elf32_arm_link_hash_table * globals; - - /* If the start address has been set, then set the EF_ARM_HASENTRY - flag. Setting this more than once is redundant, but the cost is - not too high, and it keeps the code simple. - - The test is done here, rather than somewhere else, because the - start address is only set just before the final link commences. - - Note - if the user deliberately sets a start address of 0, the - flag will not be set. */ - if (bfd_get_start_address (output_bfd) != 0) - elf_elfheader (output_bfd)->e_flags |= EF_ARM_HASENTRY; - - globals = elf32_arm_hash_table (info); - - dynobj = elf_hash_table (info)->dynobj; - if (dynobj) - { - sgot = bfd_get_section_by_name (dynobj, ".got"); - splt = bfd_get_section_by_name (dynobj, ".plt"); - } - symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr; - sym_hashes = elf_sym_hashes (input_bfd); - local_got_offsets = elf_local_got_offsets (input_bfd); - r_symndx = ELF32_R_SYM (rel->r_info); - -#if USE_REL - addend = bfd_get_32 (input_bfd, hit_data) & howto->src_mask; - - if (addend & ((howto->src_mask + 1) >> 1)) - { - signed_addend = -1; - signed_addend &= ~ howto->src_mask; - signed_addend |= addend; - } - else - signed_addend = addend; -#else - addend = signed_addend = rel->r_addend; -#endif - - switch (r_type) - { - case R_ARM_NONE: - return bfd_reloc_ok; - - case R_ARM_PC24: - case R_ARM_ABS32: - case R_ARM_REL32: -#ifndef OLD_ARM_ABI - case R_ARM_XPC25: -#endif - case R_ARM_PLT32: - /* r_symndx will be zero only for relocs against symbols - from removed linkonce sections, or sections discarded by - a linker script. */ - if (r_symndx == 0) - return bfd_reloc_ok; - - /* Handle relocations which should use the PLT entry. ABS32/REL32 - will use the symbol's value, which may point to a PLT entry, but we - don't need to handle that here. If we created a PLT entry, all - branches in this object should go to it. */ - if ((r_type != R_ARM_ABS32 && r_type != R_ARM_REL32) - && h != NULL - && splt != NULL - && h->plt.offset != (bfd_vma) -1) - { - /* If we've created a .plt section, and assigned a PLT entry to - this function, it should not be known to bind locally. If - it were, we would have cleared the PLT entry. */ - BFD_ASSERT (!SYMBOL_CALLS_LOCAL (info, h)); - - value = (splt->output_section->vma - + splt->output_offset - + h->plt.offset); - return _bfd_final_link_relocate (howto, input_bfd, input_section, - contents, rel->r_offset, value, - (bfd_vma) 0); - } - - /* When generating a shared object, these relocations are copied - into the output file to be resolved at run time. */ - if (info->shared - && (input_section->flags & SEC_ALLOC) - && (r_type != R_ARM_REL32 - || !SYMBOL_CALLS_LOCAL (info, h)) - && (h == NULL - || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT - || h->root.type != bfd_link_hash_undefweak) - && r_type != R_ARM_PC24 - && r_type != R_ARM_PLT32) - { - Elf_Internal_Rela outrel; - bfd_byte *loc; - bfd_boolean skip, relocate; - - if (sreloc == NULL) - { - const char * name; - - name = (bfd_elf_string_from_elf_section - (input_bfd, - elf_elfheader (input_bfd)->e_shstrndx, - elf_section_data (input_section)->rel_hdr.sh_name)); - if (name == NULL) - return bfd_reloc_notsupported; - - BFD_ASSERT (strncmp (name, ".rel", 4) == 0 - && strcmp (bfd_get_section_name (input_bfd, - input_section), - name + 4) == 0); - - sreloc = bfd_get_section_by_name (dynobj, name); - BFD_ASSERT (sreloc != NULL); - } - - skip = FALSE; - relocate = FALSE; - - outrel.r_offset = - _bfd_elf_section_offset (output_bfd, info, input_section, - rel->r_offset); - if (outrel.r_offset == (bfd_vma) -1) - skip = TRUE; - else if (outrel.r_offset == (bfd_vma) -2) - skip = TRUE, relocate = TRUE; - outrel.r_offset += (input_section->output_section->vma - + input_section->output_offset); - - if (skip) - memset (&outrel, 0, sizeof outrel); - else if (h != NULL - && h->dynindx != -1 - && (!info->shared - || !info->symbolic - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0)) - outrel.r_info = ELF32_R_INFO (h->dynindx, r_type); - else - { - /* This symbol is local, or marked to become local. */ - relocate = TRUE; - outrel.r_info = ELF32_R_INFO (0, R_ARM_RELATIVE); - } - - loc = sreloc->contents; - loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rel); - bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc); - - /* If this reloc is against an external symbol, we do not want to - fiddle with the addend. Otherwise, we need to include the symbol - value so that it becomes an addend for the dynamic reloc. */ - if (! relocate) - return bfd_reloc_ok; - - return _bfd_final_link_relocate (howto, input_bfd, input_section, - contents, rel->r_offset, value, - (bfd_vma) 0); - } - else switch (r_type) - { -#ifndef OLD_ARM_ABI - case R_ARM_XPC25: /* Arm BLX instruction. */ -#endif - case R_ARM_PC24: /* Arm B/BL instruction */ - case R_ARM_PLT32: -#ifndef OLD_ARM_ABI - if (r_type == R_ARM_XPC25) - { - /* Check for Arm calling Arm function. */ - /* FIXME: Should we translate the instruction into a BL - instruction instead ? */ - if (sym_flags != STT_ARM_TFUNC) - (*_bfd_error_handler) (_("\ -%s: Warning: Arm BLX instruction targets Arm function '%s'."), - bfd_archive_filename (input_bfd), - h ? h->root.root.string : "(local)"); - } - else -#endif - { - /* Check for Arm calling Thumb function. */ - if (sym_flags == STT_ARM_TFUNC) - { - elf32_arm_to_thumb_stub (info, sym_name, input_bfd, output_bfd, - input_section, hit_data, sym_sec, rel->r_offset, - signed_addend, value); - return bfd_reloc_ok; - } - } - - if ( strcmp (bfd_get_target (input_bfd), "elf32-littlearm-oabi") == 0 - || strcmp (bfd_get_target (input_bfd), "elf32-bigarm-oabi") == 0) - { - /* The old way of doing things. Trearing the addend as a - byte sized field and adding in the pipeline offset. */ - value -= (input_section->output_section->vma - + input_section->output_offset); - value -= rel->r_offset; - value += addend; - - if (! globals->no_pipeline_knowledge) - value -= 8; - } - else - { - /* The ARM ELF ABI says that this reloc is computed as: S - P + A - where: - S is the address of the symbol in the relocation. - P is address of the instruction being relocated. - A is the addend (extracted from the instruction) in bytes. - - S is held in 'value'. - P is the base address of the section containing the instruction - plus the offset of the reloc into that section, ie: - (input_section->output_section->vma + - input_section->output_offset + - rel->r_offset). - A is the addend, converted into bytes, ie: - (signed_addend * 4) - - Note: None of these operations have knowledge of the pipeline - size of the processor, thus it is up to the assembler to encode - this information into the addend. */ - value -= (input_section->output_section->vma - + input_section->output_offset); - value -= rel->r_offset; - value += (signed_addend << howto->size); - - /* Previous versions of this code also used to add in the pipeline - offset here. This is wrong because the linker is not supposed - to know about such things, and one day it might change. In order - to support old binaries that need the old behaviour however, so - we attempt to detect which ABI was used to create the reloc. */ - if (! globals->no_pipeline_knowledge) - { - Elf_Internal_Ehdr * i_ehdrp; /* Elf file header, internal form */ - - i_ehdrp = elf_elfheader (input_bfd); - - if (i_ehdrp->e_ident[EI_OSABI] == 0) - value -= 8; - } - } - - signed_addend = value; - signed_addend >>= howto->rightshift; - - /* It is not an error for an undefined weak reference to be - out of range. Any program that branches to such a symbol - is going to crash anyway, so there is no point worrying - about getting the destination exactly right. */ - if (! h || h->root.type != bfd_link_hash_undefweak) - { - /* Perform a signed range check. */ - if ( signed_addend > ((bfd_signed_vma) (howto->dst_mask >> 1)) - || signed_addend < - ((bfd_signed_vma) ((howto->dst_mask + 1) >> 1))) - return bfd_reloc_overflow; - } - -#ifndef OLD_ARM_ABI - /* If necessary set the H bit in the BLX instruction. */ - if (r_type == R_ARM_XPC25 && ((value & 2) == 2)) - value = (signed_addend & howto->dst_mask) - | (bfd_get_32 (input_bfd, hit_data) & (~ howto->dst_mask)) - | (1 << 24); - else -#endif - value = (signed_addend & howto->dst_mask) - | (bfd_get_32 (input_bfd, hit_data) & (~ howto->dst_mask)); - break; - - case R_ARM_ABS32: - value += addend; - if (sym_flags == STT_ARM_TFUNC) - value |= 1; - break; - - case R_ARM_REL32: - value -= (input_section->output_section->vma - + input_section->output_offset + rel->r_offset); - value += addend; - break; - } - - bfd_put_32 (input_bfd, value, hit_data); - return bfd_reloc_ok; - - case R_ARM_ABS8: - value += addend; - if ((long) value > 0x7f || (long) value < -0x80) - return bfd_reloc_overflow; - - bfd_put_8 (input_bfd, value, hit_data); - return bfd_reloc_ok; - - case R_ARM_ABS16: - value += addend; - - if ((long) value > 0x7fff || (long) value < -0x8000) - return bfd_reloc_overflow; - - bfd_put_16 (input_bfd, value, hit_data); - return bfd_reloc_ok; - - case R_ARM_ABS12: - /* Support ldr and str instruction for the arm */ - /* Also thumb b (unconditional branch). ??? Really? */ - value += addend; - - if ((long) value > 0x7ff || (long) value < -0x800) - return bfd_reloc_overflow; - - value |= (bfd_get_32 (input_bfd, hit_data) & 0xfffff000); - bfd_put_32 (input_bfd, value, hit_data); - return bfd_reloc_ok; - - case R_ARM_THM_ABS5: - /* Support ldr and str instructions for the thumb. */ -#if USE_REL - /* Need to refetch addend. */ - addend = bfd_get_16 (input_bfd, hit_data) & howto->src_mask; - /* ??? Need to determine shift amount from operand size. */ - addend >>= howto->rightshift; -#endif - value += addend; - - /* ??? Isn't value unsigned? */ - if ((long) value > 0x1f || (long) value < -0x10) - return bfd_reloc_overflow; - - /* ??? Value needs to be properly shifted into place first. */ - value |= bfd_get_16 (input_bfd, hit_data) & 0xf83f; - bfd_put_16 (input_bfd, value, hit_data); - return bfd_reloc_ok; - -#ifndef OLD_ARM_ABI - case R_ARM_THM_XPC22: -#endif - case R_ARM_THM_PC22: - /* Thumb BL (branch long instruction). */ - { - bfd_vma relocation; - bfd_boolean overflow = FALSE; - bfd_vma upper_insn = bfd_get_16 (input_bfd, hit_data); - bfd_vma lower_insn = bfd_get_16 (input_bfd, hit_data + 2); - bfd_signed_vma reloc_signed_max = ((1 << (howto->bitsize - 1)) - 1) >> howto->rightshift; - bfd_signed_vma reloc_signed_min = ~ reloc_signed_max; - bfd_vma check; - bfd_signed_vma signed_check; - -#if USE_REL - /* Need to refetch the addend and squish the two 11 bit pieces - together. */ - { - bfd_vma upper = upper_insn & 0x7ff; - bfd_vma lower = lower_insn & 0x7ff; - upper = (upper ^ 0x400) - 0x400; /* Sign extend. */ - addend = (upper << 12) | (lower << 1); - signed_addend = addend; - } -#endif -#ifndef OLD_ARM_ABI - if (r_type == R_ARM_THM_XPC22) - { - /* Check for Thumb to Thumb call. */ - /* FIXME: Should we translate the instruction into a BL - instruction instead ? */ - if (sym_flags == STT_ARM_TFUNC) - (*_bfd_error_handler) (_("\ -%s: Warning: Thumb BLX instruction targets thumb function '%s'."), - bfd_archive_filename (input_bfd), - h ? h->root.root.string : "(local)"); - } - else -#endif - { - /* If it is not a call to Thumb, assume call to Arm. - If it is a call relative to a section name, then it is not a - function call at all, but rather a long jump. */ - if (sym_flags != STT_ARM_TFUNC && sym_flags != STT_SECTION) - { - if (elf32_thumb_to_arm_stub - (info, sym_name, input_bfd, output_bfd, input_section, - hit_data, sym_sec, rel->r_offset, signed_addend, value)) - return bfd_reloc_ok; - else - return bfd_reloc_dangerous; - } - } - - relocation = value + signed_addend; - - relocation -= (input_section->output_section->vma - + input_section->output_offset - + rel->r_offset); - - if (! globals->no_pipeline_knowledge) - { - Elf_Internal_Ehdr * i_ehdrp; /* Elf file header, internal form. */ - - i_ehdrp = elf_elfheader (input_bfd); - - /* Previous versions of this code also used to add in the pipline - offset here. This is wrong because the linker is not supposed - to know about such things, and one day it might change. In order - to support old binaries that need the old behaviour however, so - we attempt to detect which ABI was used to create the reloc. */ - if ( strcmp (bfd_get_target (input_bfd), "elf32-littlearm-oabi") == 0 - || strcmp (bfd_get_target (input_bfd), "elf32-bigarm-oabi") == 0 - || i_ehdrp->e_ident[EI_OSABI] == 0) - relocation += 4; - } - - check = relocation >> howto->rightshift; - - /* If this is a signed value, the rightshift just dropped - leading 1 bits (assuming twos complement). */ - if ((bfd_signed_vma) relocation >= 0) - signed_check = check; - else - signed_check = check | ~((bfd_vma) -1 >> howto->rightshift); - - /* Assumes two's complement. */ - if (signed_check > reloc_signed_max || signed_check < reloc_signed_min) - overflow = TRUE; - -#ifndef OLD_ARM_ABI - if (r_type == R_ARM_THM_XPC22 - && ((lower_insn & 0x1800) == 0x0800)) - /* For a BLX instruction, make sure that the relocation is rounded up - to a word boundary. This follows the semantics of the instruction - which specifies that bit 1 of the target address will come from bit - 1 of the base address. */ - relocation = (relocation + 2) & ~ 3; -#endif - /* Put RELOCATION back into the insn. */ - upper_insn = (upper_insn & ~(bfd_vma) 0x7ff) | ((relocation >> 12) & 0x7ff); - lower_insn = (lower_insn & ~(bfd_vma) 0x7ff) | ((relocation >> 1) & 0x7ff); - - /* Put the relocated value back in the object file: */ - bfd_put_16 (input_bfd, upper_insn, hit_data); - bfd_put_16 (input_bfd, lower_insn, hit_data + 2); - - return (overflow ? bfd_reloc_overflow : bfd_reloc_ok); - } - break; - - case R_ARM_THM_PC11: - /* Thumb B (branch) instruction). */ - { - bfd_signed_vma relocation; - bfd_signed_vma reloc_signed_max = (1 << (howto->bitsize - 1)) - 1; - bfd_signed_vma reloc_signed_min = ~ reloc_signed_max; - bfd_signed_vma signed_check; - -#if USE_REL - /* Need to refetch addend. */ - addend = bfd_get_16 (input_bfd, hit_data) & howto->src_mask; - if (addend & ((howto->src_mask + 1) >> 1)) - { - signed_addend = -1; - signed_addend &= ~ howto->src_mask; - signed_addend |= addend; - } - else - signed_addend = addend; - /* The value in the insn has been right shifted. We need to - undo this, so that we can perform the address calculation - in terms of bytes. */ - signed_addend <<= howto->rightshift; -#endif - relocation = value + signed_addend; - - relocation -= (input_section->output_section->vma - + input_section->output_offset - + rel->r_offset); - - relocation >>= howto->rightshift; - signed_check = relocation; - relocation &= howto->dst_mask; - relocation |= (bfd_get_16 (input_bfd, hit_data) & (~ howto->dst_mask)); - - bfd_put_16 (input_bfd, relocation, hit_data); - - /* Assumes two's complement. */ - if (signed_check > reloc_signed_max || signed_check < reloc_signed_min) - return bfd_reloc_overflow; - - return bfd_reloc_ok; - } - - case R_ARM_GNU_VTINHERIT: - case R_ARM_GNU_VTENTRY: - return bfd_reloc_ok; - - case R_ARM_COPY: - return bfd_reloc_notsupported; - - case R_ARM_GLOB_DAT: - return bfd_reloc_notsupported; - - case R_ARM_JUMP_SLOT: - return bfd_reloc_notsupported; - - case R_ARM_RELATIVE: - return bfd_reloc_notsupported; - - case R_ARM_GOTOFF: - /* Relocation is relative to the start of the - global offset table. */ - - BFD_ASSERT (sgot != NULL); - if (sgot == NULL) - return bfd_reloc_notsupported; - - /* If we are addressing a Thumb function, we need to adjust the - address by one, so that attempts to call the function pointer will - correctly interpret it as Thumb code. */ - if (sym_flags == STT_ARM_TFUNC) - value += 1; - - /* Note that sgot->output_offset is not involved in this - calculation. We always want the start of .got. If we - define _GLOBAL_OFFSET_TABLE in a different way, as is - permitted by the ABI, we might have to change this - calculation. */ - value -= sgot->output_section->vma; - return _bfd_final_link_relocate (howto, input_bfd, input_section, - contents, rel->r_offset, value, - (bfd_vma) 0); - - case R_ARM_GOTPC: - /* Use global offset table as symbol value. */ - BFD_ASSERT (sgot != NULL); - - if (sgot == NULL) - return bfd_reloc_notsupported; - - value = sgot->output_section->vma; - return _bfd_final_link_relocate (howto, input_bfd, input_section, - contents, rel->r_offset, value, - (bfd_vma) 0); - - case R_ARM_GOT32: - /* Relocation is to the entry for this symbol in the - global offset table. */ - if (sgot == NULL) - return bfd_reloc_notsupported; - - if (h != NULL) - { - bfd_vma off; - bfd_boolean dyn; - - off = h->got.offset; - BFD_ASSERT (off != (bfd_vma) -1); - dyn = globals->root.dynamic_sections_created; - - if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h) - || (info->shared - && SYMBOL_REFERENCES_LOCAL (info, h)) - || (ELF_ST_VISIBILITY (h->other) - && h->root.type == bfd_link_hash_undefweak)) - { - /* This is actually a static link, or it is a -Bsymbolic link - and the symbol is defined locally. We must initialize this - entry in the global offset table. Since the offset must - always be a multiple of 4, we use the least significant bit - to record whether we have initialized it already. - - When doing a dynamic link, we create a .rel.got relocation - entry to initialize the value. This is done in the - finish_dynamic_symbol routine. */ - if ((off & 1) != 0) - off &= ~1; - else - { - /* If we are addressing a Thumb function, we need to - adjust the address by one, so that attempts to - call the function pointer will correctly - interpret it as Thumb code. */ - if (sym_flags == STT_ARM_TFUNC) - value |= 1; - - bfd_put_32 (output_bfd, value, sgot->contents + off); - h->got.offset |= 1; - } - } - - value = sgot->output_offset + off; - } - else - { - bfd_vma off; - - BFD_ASSERT (local_got_offsets != NULL && - local_got_offsets[r_symndx] != (bfd_vma) -1); - - off = local_got_offsets[r_symndx]; - - /* The offset must always be a multiple of 4. We use the - least significant bit to record whether we have already - generated the necessary reloc. */ - if ((off & 1) != 0) - off &= ~1; - else - { - bfd_put_32 (output_bfd, value, sgot->contents + off); - - if (info->shared) - { - asection * srelgot; - Elf_Internal_Rela outrel; - bfd_byte *loc; - - srelgot = bfd_get_section_by_name (dynobj, ".rel.got"); - BFD_ASSERT (srelgot != NULL); - - outrel.r_offset = (sgot->output_section->vma - + sgot->output_offset - + off); - outrel.r_info = ELF32_R_INFO (0, R_ARM_RELATIVE); - loc = srelgot->contents; - loc += srelgot->reloc_count++ * sizeof (Elf32_External_Rel); - bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc); - } - - local_got_offsets[r_symndx] |= 1; - } - - value = sgot->output_offset + off; - } - - return _bfd_final_link_relocate (howto, input_bfd, input_section, - contents, rel->r_offset, value, - (bfd_vma) 0); - - case R_ARM_SBREL32: - return bfd_reloc_notsupported; - - case R_ARM_AMP_VCALL9: - return bfd_reloc_notsupported; - - case R_ARM_RSBREL32: - return bfd_reloc_notsupported; - - case R_ARM_THM_RPC22: - return bfd_reloc_notsupported; - - case R_ARM_RREL32: - return bfd_reloc_notsupported; - - case R_ARM_RABS32: - return bfd_reloc_notsupported; - - case R_ARM_RPC24: - return bfd_reloc_notsupported; - - case R_ARM_RBASE: - return bfd_reloc_notsupported; - - default: - return bfd_reloc_notsupported; - } -} - -#if USE_REL -/* Add INCREMENT to the reloc (of type HOWTO) at ADDRESS. */ -static void -arm_add_to_rel (abfd, address, howto, increment) - bfd * abfd; - bfd_byte * address; - reloc_howto_type * howto; - bfd_signed_vma increment; -{ - bfd_signed_vma addend; - - if (howto->type == R_ARM_THM_PC22) - { - int upper_insn, lower_insn; - int upper, lower; - - upper_insn = bfd_get_16 (abfd, address); - lower_insn = bfd_get_16 (abfd, address + 2); - upper = upper_insn & 0x7ff; - lower = lower_insn & 0x7ff; - - addend = (upper << 12) | (lower << 1); - addend += increment; - addend >>= 1; - - upper_insn = (upper_insn & 0xf800) | ((addend >> 11) & 0x7ff); - lower_insn = (lower_insn & 0xf800) | (addend & 0x7ff); - - bfd_put_16 (abfd, (bfd_vma) upper_insn, address); - bfd_put_16 (abfd, (bfd_vma) lower_insn, address + 2); - } - else - { - bfd_vma contents; - - contents = bfd_get_32 (abfd, address); - - /* Get the (signed) value from the instruction. */ - addend = contents & howto->src_mask; - if (addend & ((howto->src_mask + 1) >> 1)) - { - bfd_signed_vma mask; - - mask = -1; - mask &= ~ howto->src_mask; - addend |= mask; - } - - /* Add in the increment, (which is a byte value). */ - switch (howto->type) - { - default: - addend += increment; - break; - - case R_ARM_PC24: - addend <<= howto->size; - addend += increment; - - /* Should we check for overflow here ? */ - - /* Drop any undesired bits. */ - addend >>= howto->rightshift; - break; - } - - contents = (contents & ~ howto->dst_mask) | (addend & howto->dst_mask); - - bfd_put_32 (abfd, contents, address); - } -} -#endif /* USE_REL */ - -/* Relocate an ARM ELF section. */ -static bfd_boolean -elf32_arm_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; - Elf_Internal_Rela *relend; - const char *name; - -#if !USE_REL - if (info->relocatable) - return TRUE; -#endif - - 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; - arelent bfd_reloc; - - r_symndx = ELF32_R_SYM (rel->r_info); - r_type = ELF32_R_TYPE (rel->r_info); - - if ( r_type == R_ARM_GNU_VTENTRY - || r_type == R_ARM_GNU_VTINHERIT) - continue; - - elf32_arm_info_to_howto (input_bfd, & bfd_reloc, rel); - howto = bfd_reloc.howto; - -#if USE_REL - if (info->relocatable) - { - /* This is a relocatable link. We don't have to change - anything, unless the reloc is against a section symbol, - in which case we have to adjust according to where the - section symbol winds up in the output section. */ - if (r_symndx < symtab_hdr->sh_info) - { - sym = local_syms + r_symndx; - if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) - { - sec = local_sections[r_symndx]; - arm_add_to_rel (input_bfd, contents + rel->r_offset, - howto, - (bfd_signed_vma) (sec->output_offset - + sym->st_value)); - } - } - - continue; - } -#endif - - /* This is a final link. */ - h = NULL; - sym = NULL; - sec = NULL; - - if (r_symndx < symtab_hdr->sh_info) - { - sym = local_syms + r_symndx; - sec = local_sections[r_symndx]; -#if USE_REL - relocation = (sec->output_section->vma - + sec->output_offset - + sym->st_value); - if ((sec->flags & SEC_MERGE) - && ELF_ST_TYPE (sym->st_info) == STT_SECTION) - { - asection *msec; - bfd_vma addend, value; - - if (howto->rightshift) - { - (*_bfd_error_handler) - (_("%s(%s+0x%lx): %s relocation against SEC_MERGE section"), - bfd_archive_filename (input_bfd), - bfd_get_section_name (input_bfd, input_section), - (long) rel->r_offset, howto->name); - return FALSE; - } - - value = bfd_get_32 (input_bfd, contents + rel->r_offset); - - /* Get the (signed) value from the instruction. */ - addend = value & howto->src_mask; - if (addend & ((howto->src_mask + 1) >> 1)) - { - bfd_signed_vma mask; - - mask = -1; - mask &= ~ howto->src_mask; - addend |= mask; - } - msec = sec; - addend = - _bfd_elf_rel_local_sym (output_bfd, sym, &msec, addend) - - relocation; - addend += msec->output_section->vma + msec->output_offset; - value = (value & ~ howto->dst_mask) | (addend & howto->dst_mask); - bfd_put_32 (input_bfd, value, contents + rel->r_offset); - } -#else - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); -#endif - } - else - { - bfd_boolean warned; - bfd_boolean unresolved_reloc; - - RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel, - r_symndx, symtab_hdr, sym_hashes, - h, sec, relocation, - unresolved_reloc, warned); - - if (unresolved_reloc || relocation != 0) - { - /* In these cases, we don't need the relocation value. - We check specially because in some obscure cases - sec->output_section will be NULL. */ - switch (r_type) - { - case R_ARM_PC24: - case R_ARM_ABS32: - case R_ARM_THM_PC22: - case R_ARM_PLT32: - - if (info->shared - && ( - (!info->symbolic && h->dynindx != -1) - || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0 - ) - && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT - && ((input_section->flags & SEC_ALLOC) != 0 - /* DWARF will emit R_ARM_ABS32 relocations in its - sections against symbols defined externally - in shared libraries. We can't do anything - with them here. */ - || ((input_section->flags & SEC_DEBUGGING) != 0 - && (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_DYNAMIC) != 0)) - ) - relocation = 0; - break; - - case R_ARM_GOTPC: - relocation = 0; - break; - - case R_ARM_GOT32: - if ((WILL_CALL_FINISH_DYNAMIC_SYMBOL - (elf_hash_table (info)->dynamic_sections_created, - info->shared, h)) - && (!info->shared - || (!info->symbolic && h->dynindx != -1) - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0)) - relocation = 0; - break; - - default: - if (unresolved_reloc) - _bfd_error_handler - (_("%s: warning: unresolvable relocation %d against symbol `%s' from %s section"), - bfd_archive_filename (input_bfd), - r_type, - h->root.root.string, - bfd_get_section_name (input_bfd, input_section)); - break; - } - } - } - - 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 || *name == '\0') - name = bfd_section_name (input_bfd, sec); - } - - r = elf32_arm_final_link_relocate (howto, input_bfd, output_bfd, - input_section, contents, rel, - relocation, info, sec, name, - (h ? ELF_ST_TYPE (h->type) : - ELF_ST_TYPE (sym->st_info)), h); - - if (r != bfd_reloc_ok) - { - const char * msg = (const char *) 0; - - switch (r) - { - case bfd_reloc_overflow: - /* If the overflowing reloc was to an undefined symbol, - we have already printed one error message and there - is no point complaining again. */ - if ((! h || - h->root.type != bfd_link_hash_undefined) - && (!((*info->callbacks->reloc_overflow) - (info, name, howto->name, (bfd_vma) 0, - input_bfd, input_section, rel->r_offset)))) - return FALSE; - break; - - case bfd_reloc_undefined: - if (!((*info->callbacks->undefined_symbol) - (info, name, input_bfd, input_section, - rel->r_offset, TRUE))) - return FALSE; - break; - - case bfd_reloc_outofrange: - msg = _("internal error: out of range error"); - goto common_error; - - case bfd_reloc_notsupported: - msg = _("internal error: unsupported relocation error"); - goto common_error; - - case bfd_reloc_dangerous: - msg = _("internal error: dangerous error"); - goto common_error; - - default: - msg = _("internal error: unknown error"); - /* fall through */ - - common_error: - if (!((*info->callbacks->warning) - (info, msg, name, input_bfd, input_section, - rel->r_offset))) - return FALSE; - break; - } - } - } - - return TRUE; -} - -/* Set the right machine number. */ - -static bfd_boolean -elf32_arm_object_p (abfd) - bfd *abfd; -{ - unsigned int mach; - - mach = bfd_arm_get_mach_from_notes (abfd, ARM_NOTE_SECTION); - - if (mach != bfd_mach_arm_unknown) - bfd_default_set_arch_mach (abfd, bfd_arch_arm, mach); - - else if (elf_elfheader (abfd)->e_flags & EF_ARM_MAVERICK_FLOAT) - bfd_default_set_arch_mach (abfd, bfd_arch_arm, bfd_mach_arm_ep9312); - - else - bfd_default_set_arch_mach (abfd, bfd_arch_arm, mach); - - return TRUE; -} - -/* Function to keep ARM specific flags in the ELF header. */ -static bfd_boolean -elf32_arm_set_private_flags (abfd, flags) - bfd *abfd; - flagword flags; -{ - if (elf_flags_init (abfd) - && elf_elfheader (abfd)->e_flags != flags) - { - if (EF_ARM_EABI_VERSION (flags) == EF_ARM_EABI_UNKNOWN) - { - if (flags & EF_ARM_INTERWORK) - (*_bfd_error_handler) (_("\ -Warning: Not setting interworking flag of %s since it has already been specified as non-interworking"), - bfd_archive_filename (abfd)); - else - _bfd_error_handler (_("\ -Warning: Clearing the interworking flag of %s due to outside request"), - bfd_archive_filename (abfd)); - } - } - else - { - elf_elfheader (abfd)->e_flags = flags; - elf_flags_init (abfd) = TRUE; - } - - return TRUE; -} - -/* Copy backend specific data from one object module to another. */ - -static bfd_boolean -elf32_arm_copy_private_bfd_data (ibfd, obfd) - bfd *ibfd; - bfd *obfd; -{ - flagword in_flags; - flagword out_flags; - - if ( bfd_get_flavour (ibfd) != bfd_target_elf_flavour - || bfd_get_flavour (obfd) != bfd_target_elf_flavour) - return TRUE; - - in_flags = elf_elfheader (ibfd)->e_flags; - out_flags = elf_elfheader (obfd)->e_flags; - - if (elf_flags_init (obfd) - && EF_ARM_EABI_VERSION (out_flags) == EF_ARM_EABI_UNKNOWN - && in_flags != out_flags) - { - /* Cannot mix APCS26 and APCS32 code. */ - if ((in_flags & EF_ARM_APCS_26) != (out_flags & EF_ARM_APCS_26)) - return FALSE; - - /* Cannot mix float APCS and non-float APCS code. */ - if ((in_flags & EF_ARM_APCS_FLOAT) != (out_flags & EF_ARM_APCS_FLOAT)) - return FALSE; - - /* If the src and dest have different interworking flags - then turn off the interworking bit. */ - if ((in_flags & EF_ARM_INTERWORK) != (out_flags & EF_ARM_INTERWORK)) - { - if (out_flags & EF_ARM_INTERWORK) - _bfd_error_handler (_("\ -Warning: Clearing the interworking flag of %s because non-interworking code in %s has been linked with it"), - bfd_get_filename (obfd), - bfd_archive_filename (ibfd)); - - in_flags &= ~EF_ARM_INTERWORK; - } - - /* Likewise for PIC, though don't warn for this case. */ - if ((in_flags & EF_ARM_PIC) != (out_flags & EF_ARM_PIC)) - in_flags &= ~EF_ARM_PIC; - } - - elf_elfheader (obfd)->e_flags = in_flags; - elf_flags_init (obfd) = TRUE; - - return TRUE; -} - -/* Merge backend specific data from an object file to the output - object file when linking. */ - -static bfd_boolean -elf32_arm_merge_private_bfd_data (ibfd, obfd) - bfd * ibfd; - bfd * obfd; -{ - flagword out_flags; - flagword in_flags; - bfd_boolean flags_compatible = TRUE; - asection *sec; - - /* Check if we have the same endianess. */ - if (! _bfd_generic_verify_endian_match (ibfd, obfd)) - return FALSE; - - if ( bfd_get_flavour (ibfd) != bfd_target_elf_flavour - || bfd_get_flavour (obfd) != bfd_target_elf_flavour) - return TRUE; - - /* The input BFD must have had its flags initialised. */ - /* The following seems bogus to me -- The flags are initialized in - the assembler but I don't think an elf_flags_init field is - written into the object. */ - /* BFD_ASSERT (elf_flags_init (ibfd)); */ - - in_flags = elf_elfheader (ibfd)->e_flags; - out_flags = elf_elfheader (obfd)->e_flags; - - if (!elf_flags_init (obfd)) - { - /* If the input is the default architecture and had the default - flags then do not bother setting the flags for the output - architecture, instead allow future merges to do this. If no - future merges ever set these flags then they will retain their - uninitialised values, which surprise surprise, correspond - to the default values. */ - if (bfd_get_arch_info (ibfd)->the_default - && elf_elfheader (ibfd)->e_flags == 0) - return TRUE; - - elf_flags_init (obfd) = TRUE; - elf_elfheader (obfd)->e_flags = in_flags; - - if (bfd_get_arch (obfd) == bfd_get_arch (ibfd) - && bfd_get_arch_info (obfd)->the_default) - return bfd_set_arch_mach (obfd, bfd_get_arch (ibfd), bfd_get_mach (ibfd)); - - return TRUE; - } - - /* Determine what should happen if the input ARM architecture - does not match the output ARM architecture. */ - if (! bfd_arm_merge_machines (ibfd, obfd)) - return FALSE; - - /* Identical flags must be compatible. */ - if (in_flags == out_flags) - return TRUE; - - /* Check to see if the input BFD actually contains any sections. If - not, its flags may not have been initialised either, but it - cannot actually cause any incompatibility. Do not short-circuit - dynamic objects; their section list may be emptied by - elf_link_add_object_symbols. - - Also check to see if there are no code sections in the input. - In this case there is no need to check for code specific flags. - XXX - do we need to worry about floating-point format compatability - in data sections ? */ - if (!(ibfd->flags & DYNAMIC)) - { - bfd_boolean null_input_bfd = TRUE; - bfd_boolean only_data_sections = TRUE; - - for (sec = ibfd->sections; sec != NULL; sec = sec->next) - { - /* Ignore synthetic glue sections. */ - if (strcmp (sec->name, ".glue_7") - && strcmp (sec->name, ".glue_7t")) - { - if ((bfd_get_section_flags (ibfd, sec) - & (SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS)) - == (SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS)) - only_data_sections = FALSE; - - null_input_bfd = FALSE; - break; - } - } - - if (null_input_bfd || only_data_sections) - return TRUE; - } - - /* Complain about various flag mismatches. */ - if (EF_ARM_EABI_VERSION (in_flags) != EF_ARM_EABI_VERSION (out_flags)) - { - _bfd_error_handler (_("\ -ERROR: %s is compiled for EABI version %d, whereas %s is compiled for version %d"), - bfd_archive_filename (ibfd), - (in_flags & EF_ARM_EABIMASK) >> 24, - bfd_get_filename (obfd), - (out_flags & EF_ARM_EABIMASK) >> 24); - return FALSE; - } - - /* Not sure what needs to be checked for EABI versions >= 1. */ - if (EF_ARM_EABI_VERSION (in_flags) == EF_ARM_EABI_UNKNOWN) - { - if ((in_flags & EF_ARM_APCS_26) != (out_flags & EF_ARM_APCS_26)) - { - _bfd_error_handler (_("\ -ERROR: %s is compiled for APCS-%d, whereas target %s uses APCS-%d"), - bfd_archive_filename (ibfd), - in_flags & EF_ARM_APCS_26 ? 26 : 32, - bfd_get_filename (obfd), - out_flags & EF_ARM_APCS_26 ? 26 : 32); - flags_compatible = FALSE; - } - - if ((in_flags & EF_ARM_APCS_FLOAT) != (out_flags & EF_ARM_APCS_FLOAT)) - { - if (in_flags & EF_ARM_APCS_FLOAT) - _bfd_error_handler (_("\ -ERROR: %s passes floats in float registers, whereas %s passes them in integer registers"), - bfd_archive_filename (ibfd), - bfd_get_filename (obfd)); - else - _bfd_error_handler (_("\ -ERROR: %s passes floats in integer registers, whereas %s passes them in float registers"), - bfd_archive_filename (ibfd), - bfd_get_filename (obfd)); - - flags_compatible = FALSE; - } - - if ((in_flags & EF_ARM_VFP_FLOAT) != (out_flags & EF_ARM_VFP_FLOAT)) - { - if (in_flags & EF_ARM_VFP_FLOAT) - _bfd_error_handler (_("\ -ERROR: %s uses VFP instructions, whereas %s does not"), - bfd_archive_filename (ibfd), - bfd_get_filename (obfd)); - else - _bfd_error_handler (_("\ -ERROR: %s uses FPA instructions, whereas %s does not"), - bfd_archive_filename (ibfd), - bfd_get_filename (obfd)); - - flags_compatible = FALSE; - } - - if ((in_flags & EF_ARM_MAVERICK_FLOAT) != (out_flags & EF_ARM_MAVERICK_FLOAT)) - { - if (in_flags & EF_ARM_MAVERICK_FLOAT) - _bfd_error_handler (_("\ -ERROR: %s uses Maverick instructions, whereas %s does not"), - bfd_archive_filename (ibfd), - bfd_get_filename (obfd)); - else - _bfd_error_handler (_("\ -ERROR: %s does not use Maverick instructions, whereas %s does"), - bfd_archive_filename (ibfd), - bfd_get_filename (obfd)); - - flags_compatible = FALSE; - } - -#ifdef EF_ARM_SOFT_FLOAT - if ((in_flags & EF_ARM_SOFT_FLOAT) != (out_flags & EF_ARM_SOFT_FLOAT)) - { - /* We can allow interworking between code that is VFP format - layout, and uses either soft float or integer regs for - passing floating point arguments and results. We already - know that the APCS_FLOAT flags match; similarly for VFP - flags. */ - if ((in_flags & EF_ARM_APCS_FLOAT) != 0 - || (in_flags & EF_ARM_VFP_FLOAT) == 0) - { - if (in_flags & EF_ARM_SOFT_FLOAT) - _bfd_error_handler (_("\ -ERROR: %s uses software FP, whereas %s uses hardware FP"), - bfd_archive_filename (ibfd), - bfd_get_filename (obfd)); - else - _bfd_error_handler (_("\ -ERROR: %s uses hardware FP, whereas %s uses software FP"), - bfd_archive_filename (ibfd), - bfd_get_filename (obfd)); - - flags_compatible = FALSE; - } - } -#endif - - /* Interworking mismatch is only a warning. */ - if ((in_flags & EF_ARM_INTERWORK) != (out_flags & EF_ARM_INTERWORK)) - { - if (in_flags & EF_ARM_INTERWORK) - { - _bfd_error_handler (_("\ -Warning: %s supports interworking, whereas %s does not"), - bfd_archive_filename (ibfd), - bfd_get_filename (obfd)); - } - else - { - _bfd_error_handler (_("\ -Warning: %s does not support interworking, whereas %s does"), - bfd_archive_filename (ibfd), - bfd_get_filename (obfd)); - } - } - } - - return flags_compatible; -} - -/* Display the flags field. */ - -static bfd_boolean -elf32_arm_print_private_bfd_data (abfd, ptr) - bfd *abfd; - PTR ptr; -{ - FILE * file = (FILE *) ptr; - unsigned long flags; - - BFD_ASSERT (abfd != NULL && ptr != NULL); - - /* Print normal ELF private data. */ - _bfd_elf_print_private_bfd_data (abfd, ptr); - - flags = elf_elfheader (abfd)->e_flags; - /* Ignore init flag - it may not be set, despite the flags field - containing valid data. */ - - /* xgettext:c-format */ - fprintf (file, _("private flags = %lx:"), elf_elfheader (abfd)->e_flags); - - switch (EF_ARM_EABI_VERSION (flags)) - { - case EF_ARM_EABI_UNKNOWN: - /* The following flag bits are GNU extensions and not part of the - official ARM ELF extended ABI. Hence they are only decoded if - the EABI version is not set. */ - if (flags & EF_ARM_INTERWORK) - fprintf (file, _(" [interworking enabled]")); - - if (flags & EF_ARM_APCS_26) - fprintf (file, " [APCS-26]"); - else - fprintf (file, " [APCS-32]"); - - if (flags & EF_ARM_VFP_FLOAT) - fprintf (file, _(" [VFP float format]")); - else if (flags & EF_ARM_MAVERICK_FLOAT) - fprintf (file, _(" [Maverick float format]")); - else - fprintf (file, _(" [FPA float format]")); - - if (flags & EF_ARM_APCS_FLOAT) - fprintf (file, _(" [floats passed in float registers]")); - - if (flags & EF_ARM_PIC) - fprintf (file, _(" [position independent]")); - - if (flags & EF_ARM_NEW_ABI) - fprintf (file, _(" [new ABI]")); - - if (flags & EF_ARM_OLD_ABI) - fprintf (file, _(" [old ABI]")); - - if (flags & EF_ARM_SOFT_FLOAT) - fprintf (file, _(" [software FP]")); - - flags &= ~(EF_ARM_INTERWORK | EF_ARM_APCS_26 | EF_ARM_APCS_FLOAT - | EF_ARM_PIC | EF_ARM_NEW_ABI | EF_ARM_OLD_ABI - | EF_ARM_SOFT_FLOAT | EF_ARM_VFP_FLOAT - | EF_ARM_MAVERICK_FLOAT); - break; - - case EF_ARM_EABI_VER1: - fprintf (file, _(" [Version1 EABI]")); - - if (flags & EF_ARM_SYMSARESORTED) - fprintf (file, _(" [sorted symbol table]")); - else - fprintf (file, _(" [unsorted symbol table]")); - - flags &= ~ EF_ARM_SYMSARESORTED; - break; - - case EF_ARM_EABI_VER2: - fprintf (file, _(" [Version2 EABI]")); - - if (flags & EF_ARM_SYMSARESORTED) - fprintf (file, _(" [sorted symbol table]")); - else - fprintf (file, _(" [unsorted symbol table]")); - - if (flags & EF_ARM_DYNSYMSUSESEGIDX) - fprintf (file, _(" [dynamic symbols use segment index]")); - - if (flags & EF_ARM_MAPSYMSFIRST) - fprintf (file, _(" [mapping symbols precede others]")); - - flags &= ~(EF_ARM_SYMSARESORTED | EF_ARM_DYNSYMSUSESEGIDX - | EF_ARM_MAPSYMSFIRST); - break; - - default: - fprintf (file, _(" ")); - break; - } - - flags &= ~ EF_ARM_EABIMASK; - - if (flags & EF_ARM_RELEXEC) - fprintf (file, _(" [relocatable executable]")); - - if (flags & EF_ARM_HASENTRY) - fprintf (file, _(" [has entry point]")); - - flags &= ~ (EF_ARM_RELEXEC | EF_ARM_HASENTRY); - - if (flags) - fprintf (file, _("")); - - fputc ('\n', file); - - return TRUE; -} - -static int -elf32_arm_get_symbol_type (elf_sym, type) - Elf_Internal_Sym * elf_sym; - int type; -{ - switch (ELF_ST_TYPE (elf_sym->st_info)) - { - case STT_ARM_TFUNC: - return ELF_ST_TYPE (elf_sym->st_info); - - case STT_ARM_16BIT: - /* If the symbol is not an object, return the STT_ARM_16BIT flag. - This allows us to distinguish between data used by Thumb instructions - and non-data (which is probably code) inside Thumb regions of an - executable. */ - if (type != STT_OBJECT) - return ELF_ST_TYPE (elf_sym->st_info); - break; - - default: - break; - } - - return type; -} - -static asection * -elf32_arm_gc_mark_hook (sec, info, rel, h, sym) - asection *sec; - struct bfd_link_info *info ATTRIBUTE_UNUSED; - Elf_Internal_Rela *rel; - struct elf_link_hash_entry *h; - Elf_Internal_Sym *sym; -{ - if (h != NULL) - { - switch (ELF32_R_TYPE (rel->r_info)) - { - case R_ARM_GNU_VTINHERIT: - case R_ARM_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 - return bfd_section_from_elf_index (sec->owner, sym->st_shndx); - - return NULL; -} - -/* Update the got entry reference counts for the section being removed. */ - -static bfd_boolean -elf32_arm_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; -{ - 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; - - elf_section_data (sec)->local_dynrel = NULL; - - symtab_hdr = &elf_tdata (abfd)->symtab_hdr; - sym_hashes = elf_sym_hashes (abfd); - local_got_refcounts = elf_local_got_refcounts (abfd); - - relend = relocs + sec->reloc_count; - for (rel = relocs; rel < relend; rel++) - switch (ELF32_R_TYPE (rel->r_info)) - { - case R_ARM_GOT32: - r_symndx = ELF32_R_SYM (rel->r_info); - if (r_symndx >= symtab_hdr->sh_info) - { - h = sym_hashes[r_symndx - symtab_hdr->sh_info]; - if (h->got.refcount > 0) - h->got.refcount -= 1; - } - else if (local_got_refcounts != NULL) - { - if (local_got_refcounts[r_symndx] > 0) - local_got_refcounts[r_symndx] -= 1; - } - break; - - case R_ARM_ABS32: - case R_ARM_REL32: - case R_ARM_PC24: - case R_ARM_PLT32: - r_symndx = ELF32_R_SYM (rel->r_info); - if (r_symndx >= symtab_hdr->sh_info) - { - struct elf32_arm_link_hash_entry *eh; - struct elf32_arm_relocs_copied **pp; - struct elf32_arm_relocs_copied *p; - - h = sym_hashes[r_symndx - symtab_hdr->sh_info]; - - if (h->plt.refcount > 0) - h->plt.refcount -= 1; - - if (ELF32_R_TYPE (rel->r_info) == R_ARM_ABS32 - || ELF32_R_TYPE (rel->r_info) == R_ARM_REL32) - { - eh = (struct elf32_arm_link_hash_entry *) h; - - for (pp = &eh->relocs_copied; (p = *pp) != NULL; - pp = &p->next) - if (p->section == sec) - { - p->count -= 1; - if (p->count == 0) - *pp = p->next; - break; - } - } - } - break; - - default: - break; - } - - return TRUE; -} - -/* Look through the relocs for a section during the first phase. */ - -static bfd_boolean -elf32_arm_check_relocs (abfd, info, sec, relocs) - bfd *abfd; - struct bfd_link_info *info; - asection *sec; - const Elf_Internal_Rela *relocs; -{ - Elf_Internal_Shdr *symtab_hdr; - struct elf_link_hash_entry **sym_hashes; - struct elf_link_hash_entry **sym_hashes_end; - const Elf_Internal_Rela *rel; - const Elf_Internal_Rela *rel_end; - bfd *dynobj; - asection *sreloc; - bfd_vma *local_got_offsets; - struct elf32_arm_link_hash_table *htab; - - if (info->relocatable) - return TRUE; - - htab = elf32_arm_hash_table (info); - sreloc = NULL; - - dynobj = elf_hash_table (info)->dynobj; - local_got_offsets = elf_local_got_offsets (abfd); - - symtab_hdr = &elf_tdata (abfd)->symtab_hdr; - sym_hashes = elf_sym_hashes (abfd); - sym_hashes_end = sym_hashes - + symtab_hdr->sh_size / sizeof (Elf32_External_Sym); - - if (!elf_bad_symtab (abfd)) - sym_hashes_end -= symtab_hdr->sh_info; - - rel_end = relocs + sec->reloc_count; - for (rel = relocs; rel < rel_end; rel++) - { - struct elf_link_hash_entry *h; - unsigned long r_symndx; - - r_symndx = ELF32_R_SYM (rel->r_info); - if (r_symndx < symtab_hdr->sh_info) - h = NULL; - else - h = sym_hashes[r_symndx - symtab_hdr->sh_info]; - - switch (ELF32_R_TYPE (rel->r_info)) - { - case R_ARM_GOT32: - /* This symbol requires a global offset table entry. */ - if (h != NULL) - { - h->got.refcount++; - } - else - { - bfd_signed_vma *local_got_refcounts; - - /* This is a global offset table entry for a local symbol. */ - local_got_refcounts = elf_local_got_refcounts (abfd); - if (local_got_refcounts == NULL) - { - bfd_size_type size; - - size = symtab_hdr->sh_info; - size *= (sizeof (bfd_signed_vma) + sizeof(char)); - local_got_refcounts = ((bfd_signed_vma *) - bfd_zalloc (abfd, size)); - if (local_got_refcounts == NULL) - return FALSE; - elf_local_got_refcounts (abfd) = local_got_refcounts; - } - local_got_refcounts[r_symndx] += 1; - } - break; - - case R_ARM_GOTOFF: - case R_ARM_GOTPC: - if (htab->sgot == NULL) - { - if (htab->root.dynobj == NULL) - htab->root.dynobj = abfd; - if (!create_got_section (htab->root.dynobj, info)) - return FALSE; - } - break; - - case R_ARM_ABS32: - case R_ARM_REL32: - case R_ARM_PC24: - case R_ARM_PLT32: - if (h != NULL) - { - /* If this reloc is in a read-only section, we might - need a copy reloc. We can't check reliably at this - stage whether the section is read-only, as input - sections have not yet been mapped to output sections. - Tentatively set the flag for now, and correct in - adjust_dynamic_symbol. */ - if (!info->shared) - h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF; - - /* We may need a .plt entry if the function this reloc - refers to is in a different object. We can't tell for - sure yet, because something later might force the - symbol local. */ - if (ELF32_R_TYPE (rel->r_info) == R_ARM_PC24 - || ELF32_R_TYPE (rel->r_info) == R_ARM_PLT32) - h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; - - /* If we create a PLT entry, this relocation will reference - it, even if it's an ABS32 relocation. */ - h->plt.refcount += 1; - } - - /* If we are creating a shared library, and this is a reloc - against a global symbol, or a non PC relative reloc - against a local symbol, then we need to copy the reloc - into the shared library. However, if we are linking with - -Bsymbolic, we do not need to copy a reloc against a - global symbol which is defined in an object we are - including in the link (i.e., DEF_REGULAR is set). At - this point we have not seen all the input files, so it is - possible that DEF_REGULAR is not set now but will be set - later (it is never cleared). We account for that - possibility below by storing information in the - relocs_copied field of the hash table entry. */ - if (info->shared - && (sec->flags & SEC_ALLOC) != 0 - && ((ELF32_R_TYPE (rel->r_info) != R_ARM_PC24 - && ELF32_R_TYPE (rel->r_info) != R_ARM_PLT32 - && ELF32_R_TYPE (rel->r_info) != R_ARM_REL32) - || (h != NULL - && (! info->symbolic - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0)))) - { - struct elf32_arm_relocs_copied *p, **head; - - /* When creating a shared object, we must copy these - reloc types into the output file. We create a reloc - section in dynobj and make room for this reloc. */ - if (sreloc == NULL) - { - const char * name; - - name = (bfd_elf_string_from_elf_section - (abfd, - elf_elfheader (abfd)->e_shstrndx, - elf_section_data (sec)->rel_hdr.sh_name)); - if (name == NULL) - return FALSE; - - BFD_ASSERT (strncmp (name, ".rel", 4) == 0 - && strcmp (bfd_get_section_name (abfd, sec), - name + 4) == 0); - - sreloc = bfd_get_section_by_name (dynobj, name); - if (sreloc == NULL) - { - flagword flags; - - sreloc = bfd_make_section (dynobj, name); - flags = (SEC_HAS_CONTENTS | SEC_READONLY - | SEC_IN_MEMORY | SEC_LINKER_CREATED); - if ((sec->flags & SEC_ALLOC) != 0) - flags |= SEC_ALLOC | SEC_LOAD; - if (sreloc == NULL - || ! bfd_set_section_flags (dynobj, sreloc, flags) - || ! bfd_set_section_alignment (dynobj, sreloc, 2)) - return FALSE; - } - - elf_section_data (sec)->sreloc = sreloc; - } - - /* If this is a global symbol, we count the number of - relocations we need for this symbol. */ - if (h != NULL) - { - head = &((struct elf32_arm_link_hash_entry *) h)->relocs_copied; - } - else - { - /* Track dynamic relocs needed for local syms too. - We really need local syms available to do this - easily. Oh well. */ - - asection *s; - s = bfd_section_from_r_symndx (abfd, &htab->sym_sec, - sec, r_symndx); - if (s == NULL) - return FALSE; - - head = ((struct elf32_arm_relocs_copied **) - &elf_section_data (s)->local_dynrel); - } - - p = *head; - if (p == NULL || p->section != sec) - { - bfd_size_type amt = sizeof *p; - p = bfd_alloc (htab->root.dynobj, amt); - if (p == NULL) - return FALSE; - p->next = *head; - *head = p; - p->section = sec; - p->count = 0; - } - - if (ELF32_R_TYPE (rel->r_info) == R_ARM_ABS32 - || ELF32_R_TYPE (rel->r_info) == R_ARM_REL32) - p->count += 1; - } - break; - - /* This relocation describes the C++ object vtable hierarchy. - Reconstruct it for later use during GC. */ - case R_ARM_GNU_VTINHERIT: - if (!bfd_elf_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_ARM_GNU_VTENTRY: - if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_offset)) - return FALSE; - break; - } - } - - return TRUE; -} - -/* Find the nearest line to a particular section and offset, for error - reporting. This code is a duplicate of the code in elf.c, except - that it also accepts STT_ARM_TFUNC as a symbol that names a function. */ - -static bfd_boolean -elf32_arm_find_nearest_line - (abfd, section, symbols, offset, filename_ptr, functionname_ptr, line_ptr) - bfd *abfd; - asection *section; - asymbol **symbols; - bfd_vma offset; - const char **filename_ptr; - const char **functionname_ptr; - unsigned int *line_ptr; -{ - bfd_boolean found; - const char *filename; - asymbol *func; - bfd_vma low_func; - asymbol **p; - - if (_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset, - filename_ptr, functionname_ptr, - line_ptr, 0, - &elf_tdata (abfd)->dwarf2_find_line_info)) - return TRUE; - - if (! _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, - &found, filename_ptr, - functionname_ptr, line_ptr, - &elf_tdata (abfd)->line_info)) - return FALSE; - - if (found) - return TRUE; - - if (symbols == NULL) - return FALSE; - - filename = NULL; - func = NULL; - low_func = 0; - - for (p = symbols; *p != NULL; p++) - { - elf_symbol_type *q; - - q = (elf_symbol_type *) *p; - - if (bfd_get_section (&q->symbol) != section) - continue; - - switch (ELF_ST_TYPE (q->internal_elf_sym.st_info)) - { - default: - break; - case STT_FILE: - filename = bfd_asymbol_name (&q->symbol); - break; - case STT_NOTYPE: - case STT_FUNC: - case STT_ARM_TFUNC: - if (q->symbol.section == section - && q->symbol.value >= low_func - && q->symbol.value <= offset) - { - func = (asymbol *) q; - low_func = q->symbol.value; - } - break; - } - } - - if (func == NULL) - return FALSE; - - *filename_ptr = filename; - *functionname_ptr = bfd_asymbol_name (func); - *line_ptr = 0; - - return TRUE; -} - -/* Adjust a symbol defined by a dynamic object and referenced by a - regular object. The current definition is in some section of the - dynamic object, but we're not including those sections. We have to - change the definition to something the rest of the link can - understand. */ - -static bfd_boolean -elf32_arm_adjust_dynamic_symbol (info, h) - struct bfd_link_info * info; - struct elf_link_hash_entry * h; -{ - bfd * dynobj; - asection * s; - unsigned int power_of_two; - - dynobj = elf_hash_table (info)->dynobj; - - /* Make sure we know what is going on here. */ - BFD_ASSERT (dynobj != NULL - && ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) - || h->weakdef != NULL - || ((h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - && (h->elf_link_hash_flags - & ELF_LINK_HASH_REF_REGULAR) != 0 - && (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0))); - - /* If this is a function, put it in the procedure linkage table. We - will fill in the contents of the procedure linkage table later, - when we know the address of the .got section. */ - if (h->type == STT_FUNC - || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0) - { - if (h->plt.refcount <= 0 - || SYMBOL_CALLS_LOCAL (info, h) - || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT - && h->root.type == bfd_link_hash_undefweak)) - { - /* This case can occur if we saw a PLT32 reloc in an input - file, but the symbol was never referred to by a dynamic - object, or if all references were garbage collected. In - such a case, we don't actually need to build a procedure - linkage table, and we can just do a PC24 reloc instead. */ - h->plt.offset = (bfd_vma) -1; - h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; - } - - return TRUE; - } - else - /* It's possible that we incorrectly decided a .plt reloc was - needed for an R_ARM_PC24 reloc to a non-function sym in - check_relocs. We can't decide accurately between function and - non-function syms in check-relocs; Objects loaded later in - the link may change h->type. So fix it now. */ - h->plt.offset = (bfd_vma) -1; - - /* If this is a weak symbol, and there is a real definition, the - processor independent code will have arranged for us to see the - real definition first, and we can just use the same value. */ - if (h->weakdef != NULL) - { - BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined - || h->weakdef->root.type == bfd_link_hash_defweak); - h->root.u.def.section = h->weakdef->root.u.def.section; - h->root.u.def.value = h->weakdef->root.u.def.value; - return TRUE; - } - - /* This is a reference to a symbol defined by a dynamic object which - is not a function. */ - - /* If we are creating a shared library, we must presume that the - only references to the symbol are via the global offset table. - For such cases we need not do anything here; the relocations will - be handled correctly by relocate_section. */ - if (info->shared) - return TRUE; - - /* We must allocate the symbol in our .dynbss section, which will - become part of the .bss section of the executable. There will be - an entry for this symbol in the .dynsym section. The dynamic - object will contain position independent code, so all references - from the dynamic object to this symbol will go through the global - offset table. The dynamic linker will use the .dynsym entry to - determine the address it must put in the global offset table, so - both the dynamic object and the regular object will refer to the - same memory location for the variable. */ - s = bfd_get_section_by_name (dynobj, ".dynbss"); - BFD_ASSERT (s != NULL); - - /* We must generate a R_ARM_COPY reloc to tell the dynamic linker to - copy the initial value out of the dynamic object and into the - runtime process image. We need to remember the offset into the - .rel.bss section we are going to use. */ - if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) - { - asection *srel; - - srel = bfd_get_section_by_name (dynobj, ".rel.bss"); - BFD_ASSERT (srel != NULL); - srel->_raw_size += sizeof (Elf32_External_Rel); - h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY; - } - - /* We need to figure out the alignment required for this symbol. I - have no idea how ELF linkers handle this. */ - power_of_two = bfd_log2 (h->size); - if (power_of_two > 3) - power_of_two = 3; - - /* Apply the required alignment. */ - s->_raw_size = BFD_ALIGN (s->_raw_size, - (bfd_size_type) (1 << power_of_two)); - if (power_of_two > bfd_get_section_alignment (dynobj, s)) - { - if (! bfd_set_section_alignment (dynobj, s, power_of_two)) - return FALSE; - } - - /* Define the symbol as being at this point in the section. */ - h->root.u.def.section = s; - h->root.u.def.value = s->_raw_size; - - /* Increment the section size to make room for the symbol. */ - s->_raw_size += h->size; - - return TRUE; -} - -/* Allocate space in .plt, .got and associated reloc sections for - dynamic relocs. */ - -static bfd_boolean -allocate_dynrelocs (h, inf) - struct elf_link_hash_entry *h; - PTR inf; -{ - struct bfd_link_info *info; - struct elf32_arm_link_hash_table *htab; - struct elf32_arm_link_hash_entry *eh; - struct elf32_arm_relocs_copied *p; - - if (h->root.type == bfd_link_hash_indirect) - return TRUE; - - if (h->root.type == bfd_link_hash_warning) - /* When warning symbols are created, they **replace** the "real" - entry in the hash table, thus we never get to see the real - symbol in a hash traversal. So look at it now. */ - h = (struct elf_link_hash_entry *) h->root.u.i.link; - - info = (struct bfd_link_info *) inf; - htab = elf32_arm_hash_table (info); - - if (htab->root.dynamic_sections_created - && h->plt.refcount > 0) - { - /* Make sure this symbol is output as a dynamic symbol. - Undefined weak syms won't yet be marked as dynamic. */ - if (h->dynindx == -1 - && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) - { - if (! bfd_elf_link_record_dynamic_symbol (info, h)) - return FALSE; - } - - if (info->shared - || WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h)) - { - asection *s = htab->splt; - - /* If this is the first .plt entry, make room for the special - first entry. */ - if (s->_raw_size == 0) - s->_raw_size += PLT_HEADER_SIZE; - - h->plt.offset = s->_raw_size; - - /* If this symbol is not defined in a regular file, and we are - not generating a shared library, then set the symbol to this - location in the .plt. This is required to make function - pointers compare as equal between the normal executable and - the shared library. */ - if (! info->shared - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) - { - h->root.u.def.section = s; - h->root.u.def.value = h->plt.offset; - } - - /* Make room for this entry. */ - s->_raw_size += PLT_ENTRY_SIZE; - - /* We also need to make an entry in the .got.plt section, which - will be placed in the .got section by the linker script. */ - htab->sgotplt->_raw_size += 4; - - /* We also need to make an entry in the .rel.plt section. */ - htab->srelplt->_raw_size += sizeof (Elf32_External_Rel); - } - else - { - h->plt.offset = (bfd_vma) -1; - h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; - } - } - else - { - h->plt.offset = (bfd_vma) -1; - h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; - } - - if (h->got.refcount > 0) - { - asection *s; - bfd_boolean dyn; - - /* Make sure this symbol is output as a dynamic symbol. - Undefined weak syms won't yet be marked as dynamic. */ - if (h->dynindx == -1 - && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) - { - if (! bfd_elf_link_record_dynamic_symbol (info, h)) - return FALSE; - } - - s = htab->sgot; - h->got.offset = s->_raw_size; - s->_raw_size += 4; - dyn = htab->root.dynamic_sections_created; - if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT - || h->root.type != bfd_link_hash_undefweak) - && (info->shared - || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h))) - htab->srelgot->_raw_size += sizeof (Elf32_External_Rel); - } - else - h->got.offset = (bfd_vma) -1; - - eh = (struct elf32_arm_link_hash_entry *) h; - if (eh->relocs_copied == NULL) - return TRUE; - - /* In the shared -Bsymbolic case, discard space allocated for - dynamic pc-relative relocs against symbols which turn out to be - defined in regular objects. For the normal shared case, discard - space for pc-relative relocs that have become local due to symbol - visibility changes. */ - - if (info->shared) - { - /* Discard relocs on undefined weak syms with non-default - visibility. */ - if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT - && h->root.type == bfd_link_hash_undefweak) - eh->relocs_copied = NULL; - } - else - { - /* For the non-shared case, discard space for relocs against - symbols which turn out to need copy relocs or are not - dynamic. */ - - if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0 - && (((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) - || (htab->root.dynamic_sections_created - && (h->root.type == bfd_link_hash_undefweak - || h->root.type == bfd_link_hash_undefined)))) - { - /* Make sure this symbol is output as a dynamic symbol. - Undefined weak syms won't yet be marked as dynamic. */ - if (h->dynindx == -1 - && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) - { - if (! bfd_elf_link_record_dynamic_symbol (info, h)) - return FALSE; - } - - /* If that succeeded, we know we'll be keeping all the - relocs. */ - if (h->dynindx != -1) - goto keep; - } - - eh->relocs_copied = NULL; - - keep: ; - } - - /* Finally, allocate space. */ - for (p = eh->relocs_copied; p != NULL; p = p->next) - { - asection *sreloc = elf_section_data (p->section)->sreloc; - sreloc->_raw_size += p->count * sizeof (Elf32_External_Rel); - } - - return TRUE; -} - -/* Set the sizes of the dynamic sections. */ - -static bfd_boolean -elf32_arm_size_dynamic_sections (output_bfd, info) - bfd * output_bfd ATTRIBUTE_UNUSED; - struct bfd_link_info * info; -{ - bfd * dynobj; - asection * s; - bfd_boolean plt; - bfd_boolean relocs; - bfd *ibfd; - struct elf32_arm_link_hash_table *htab; - - htab = elf32_arm_hash_table (info); - 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->executable) - { - s = bfd_get_section_by_name (dynobj, ".interp"); - BFD_ASSERT (s != NULL); - s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER; - s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER; - } - } - - /* Set up .got offsets for local syms, and space for local dynamic - relocs. */ - for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) - { - bfd_signed_vma *local_got; - bfd_signed_vma *end_local_got; - char *local_tls_type; - bfd_size_type locsymcount; - Elf_Internal_Shdr *symtab_hdr; - asection *srel; - - if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour) - continue; - - for (s = ibfd->sections; s != NULL; s = s->next) - { - struct elf32_arm_relocs_copied *p; - - for (p = *((struct elf32_arm_relocs_copied **) - &elf_section_data (s)->local_dynrel); - p != NULL; - p = p->next) - { - if (!bfd_is_abs_section (p->section) - && bfd_is_abs_section (p->section->output_section)) - { - /* Input section has been discarded, either because - it is a copy of a linkonce section or due to - linker script /DISCARD/, so we'll be discarding - the relocs too. */ - } - else if (p->count != 0) - { - srel = elf_section_data (p->section)->sreloc; - srel->_raw_size += p->count * sizeof (Elf32_External_Rel); - if ((p->section->output_section->flags & SEC_READONLY) != 0) - info->flags |= DF_TEXTREL; - } - } - } - - local_got = elf_local_got_refcounts (ibfd); - if (!local_got) - continue; - - symtab_hdr = &elf_tdata (ibfd)->symtab_hdr; - locsymcount = symtab_hdr->sh_info; - end_local_got = local_got + locsymcount; - s = htab->sgot; - srel = htab->srelgot; - for (; local_got < end_local_got; ++local_got, ++local_tls_type) - { - if (*local_got > 0) - { - *local_got = s->_raw_size; - s->_raw_size += 4; - if (info->shared) - srel->_raw_size += sizeof (Elf32_External_Rel); - } - else - *local_got = (bfd_vma) -1; - } - } - - /* Allocate global sym .plt and .got entries, and space for global - sym dynamic relocs. */ - elf_link_hash_traverse (&htab->root, allocate_dynrelocs, (PTR) info); - - /* The check_relocs and adjust_dynamic_symbol entry points have - determined the sizes of the various dynamic sections. Allocate - memory for them. */ - plt = FALSE; - relocs = FALSE; - for (s = dynobj->sections; s != NULL; s = s->next) - { - const char * name; - bfd_boolean strip; - - if ((s->flags & SEC_LINKER_CREATED) == 0) - continue; - - /* It's OK to base decisions on the section name, because none - of the dynobj section names depend upon the input files. */ - name = bfd_get_section_name (dynobj, s); - - strip = FALSE; - - if (strcmp (name, ".plt") == 0) - { - if (s->_raw_size == 0) - { - /* Strip this section if we don't need it; see the - comment below. */ - strip = TRUE; - } - else - { - /* Remember whether there is a PLT. */ - plt = TRUE; - } - } - else if (strncmp (name, ".rel", 4) == 0) - { - if (s->_raw_size == 0) - { - /* If we don't need this section, strip it from the - output file. This is mostly to handle .rel.bss and - .rel.plt. We must create both sections in - create_dynamic_sections, because they must be created - before the linker maps input sections to output - sections. The linker does that before - adjust_dynamic_symbol is called, and it is that - function which decides whether anything needs to go - into these sections. */ - strip = TRUE; - } - else - { - /* Remember whether there are any reloc sections other - than .rel.plt. */ - if (strcmp (name, ".rel.plt") != 0) - relocs = TRUE; - - /* We use the reloc_count field as a counter if we need - to copy relocs into the output file. */ - s->reloc_count = 0; - } - } - else if (strncmp (name, ".got", 4) != 0) - { - /* It's not one of our sections, so don't allocate space. */ - continue; - } - - if (strip) - { - _bfd_strip_section_from_output (info, s); - continue; - } - - /* Allocate memory for the section contents. */ - s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size); - if (s->contents == NULL && s->_raw_size != 0) - return FALSE; - } - - if (elf_hash_table (info)->dynamic_sections_created) - { - /* Add some entries to the .dynamic section. We fill in the - values later, in elf32_arm_finish_dynamic_sections, but we - must add the entries now so that we get the correct size for - the .dynamic section. The DT_DEBUG entry is filled in by the - dynamic linker and used by the debugger. */ -#define add_dynamic_entry(TAG, VAL) \ - _bfd_elf_add_dynamic_entry (info, TAG, VAL) - - if (!info->shared) - { - if (!add_dynamic_entry (DT_DEBUG, 0)) - return FALSE; - } - - if (plt) - { - if ( !add_dynamic_entry (DT_PLTGOT, 0) - || !add_dynamic_entry (DT_PLTRELSZ, 0) - || !add_dynamic_entry (DT_PLTREL, DT_REL) - || !add_dynamic_entry (DT_JMPREL, 0)) - return FALSE; - } - - if (relocs) - { - if ( !add_dynamic_entry (DT_REL, 0) - || !add_dynamic_entry (DT_RELSZ, 0) - || !add_dynamic_entry (DT_RELENT, sizeof (Elf32_External_Rel))) - return FALSE; - } - - if ((info->flags & DF_TEXTREL) != 0) - { - if (!add_dynamic_entry (DT_TEXTREL, 0)) - return FALSE; - info->flags |= DF_TEXTREL; - } - } -#undef add_synamic_entry - - return TRUE; -} - -/* Finish up dynamic symbol handling. We set the contents of various - dynamic sections here. */ - -static bfd_boolean -elf32_arm_finish_dynamic_symbol (output_bfd, info, h, sym) - bfd * output_bfd; - struct bfd_link_info * info; - struct elf_link_hash_entry * h; - Elf_Internal_Sym * sym; -{ - bfd * dynobj; - - dynobj = elf_hash_table (info)->dynobj; - - if (h->plt.offset != (bfd_vma) -1) - { - asection * splt; - asection * sgot; - asection * srel; - bfd_vma plt_index; - bfd_vma got_offset; - Elf_Internal_Rela rel; - bfd_byte *loc; - bfd_vma got_displacement; - - /* This symbol has an entry in the procedure linkage table. Set - it up. */ - - BFD_ASSERT (h->dynindx != -1); - - splt = bfd_get_section_by_name (dynobj, ".plt"); - sgot = bfd_get_section_by_name (dynobj, ".got.plt"); - srel = bfd_get_section_by_name (dynobj, ".rel.plt"); - BFD_ASSERT (splt != NULL && sgot != NULL && srel != NULL); - - /* Get the index in the procedure linkage table which - corresponds to this symbol. This is the index of this symbol - in all the symbols for which we are making plt entries. The - first entry in the procedure linkage table is reserved. */ - plt_index = (h->plt.offset - PLT_HEADER_SIZE) / PLT_ENTRY_SIZE; - - /* Get the offset into the .got table of the entry that - corresponds to this function. Each .got entry is 4 bytes. - The first three are reserved. */ - got_offset = (plt_index + 3) * 4; - - /* Calculate the displacement between the PLT slot and the - entry in the GOT. */ - got_displacement = (sgot->output_section->vma - + sgot->output_offset - + got_offset - - splt->output_section->vma - - splt->output_offset - - h->plt.offset - - 8); - - BFD_ASSERT ((got_displacement & 0xf0000000) == 0); - - /* Fill in the entry in the procedure linkage table. */ - bfd_put_32 (output_bfd, elf32_arm_plt_entry[0] | ((got_displacement & 0x0ff00000) >> 20), - splt->contents + h->plt.offset + 0); - bfd_put_32 (output_bfd, elf32_arm_plt_entry[1] | ((got_displacement & 0x000ff000) >> 12), - splt->contents + h->plt.offset + 4); - bfd_put_32 (output_bfd, elf32_arm_plt_entry[2] | (got_displacement & 0x00000fff), - splt->contents + h->plt.offset + 8); -#ifdef FOUR_WORD_PLT - bfd_put_32 (output_bfd, elf32_arm_plt_entry[3], - splt->contents + h->plt.offset + 12); -#endif - - /* Fill in the entry in the global offset table. */ - bfd_put_32 (output_bfd, - (splt->output_section->vma - + splt->output_offset), - sgot->contents + got_offset); - - /* Fill in the entry in the .rel.plt section. */ - rel.r_offset = (sgot->output_section->vma - + sgot->output_offset - + got_offset); - rel.r_info = ELF32_R_INFO (h->dynindx, R_ARM_JUMP_SLOT); - loc = srel->contents + plt_index * sizeof (Elf32_External_Rel); - bfd_elf32_swap_reloc_out (output_bfd, &rel, loc); - - if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) - { - /* Mark the symbol as undefined, rather than as defined in - the .plt section. Leave the value alone. */ - sym->st_shndx = SHN_UNDEF; - /* If the symbol is weak, we do need to clear the value. - Otherwise, the PLT entry would provide a definition for - the symbol even if the symbol wasn't defined anywhere, - and so the symbol would never be NULL. */ - if ((h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR_NONWEAK) - == 0) - sym->st_value = 0; - } - } - - if (h->got.offset != (bfd_vma) -1) - { - asection * sgot; - asection * srel; - Elf_Internal_Rela rel; - bfd_byte *loc; - - /* This symbol has an entry in the global offset table. Set it - up. */ - sgot = bfd_get_section_by_name (dynobj, ".got"); - srel = bfd_get_section_by_name (dynobj, ".rel.got"); - BFD_ASSERT (sgot != NULL && srel != NULL); - - rel.r_offset = (sgot->output_section->vma - + sgot->output_offset - + (h->got.offset &~ (bfd_vma) 1)); - - /* If this is a static link, or it is a -Bsymbolic link and the - symbol is defined locally or was forced to be local because - of a version file, we just want to emit a RELATIVE reloc. - The entry in the global offset table will already have been - initialized in the relocate_section function. */ - if (info->shared - && SYMBOL_REFERENCES_LOCAL (info, h)) - { - BFD_ASSERT((h->got.offset & 1) != 0); - rel.r_info = ELF32_R_INFO (0, R_ARM_RELATIVE); - } - else - { - BFD_ASSERT((h->got.offset & 1) == 0); - bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + h->got.offset); - rel.r_info = ELF32_R_INFO (h->dynindx, R_ARM_GLOB_DAT); - } - - loc = srel->contents + srel->reloc_count++ * sizeof (Elf32_External_Rel); - bfd_elf32_swap_reloc_out (output_bfd, &rel, loc); - } - - if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0) - { - asection * s; - Elf_Internal_Rela rel; - bfd_byte *loc; - - /* This symbol needs a copy reloc. Set it up. */ - BFD_ASSERT (h->dynindx != -1 - && (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak)); - - s = bfd_get_section_by_name (h->root.u.def.section->owner, - ".rel.bss"); - BFD_ASSERT (s != NULL); - - rel.r_offset = (h->root.u.def.value - + h->root.u.def.section->output_section->vma - + h->root.u.def.section->output_offset); - rel.r_info = ELF32_R_INFO (h->dynindx, R_ARM_COPY); - loc = s->contents + s->reloc_count++ * sizeof (Elf32_External_Rel); - bfd_elf32_swap_reloc_out (output_bfd, &rel, loc); - } - - /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */ - if (strcmp (h->root.root.string, "_DYNAMIC") == 0 - || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0) - sym->st_shndx = SHN_ABS; - - return TRUE; -} - -/* Finish up the dynamic sections. */ - -static bfd_boolean -elf32_arm_finish_dynamic_sections (output_bfd, info) - bfd * output_bfd; - struct bfd_link_info * info; -{ - bfd * dynobj; - asection * sgot; - asection * sdyn; - - dynobj = elf_hash_table (info)->dynobj; - - sgot = bfd_get_section_by_name (dynobj, ".got.plt"); - BFD_ASSERT (sgot != NULL); - sdyn = bfd_get_section_by_name (dynobj, ".dynamic"); - - if (elf_hash_table (info)->dynamic_sections_created) - { - asection *splt; - Elf32_External_Dyn *dyncon, *dynconend; - - splt = bfd_get_section_by_name (dynobj, ".plt"); - BFD_ASSERT (splt != NULL && sdyn != NULL); - - dyncon = (Elf32_External_Dyn *) sdyn->contents; - dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->_raw_size); - - for (; dyncon < dynconend; dyncon++) - { - Elf_Internal_Dyn dyn; - const char * name; - asection * s; - - bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn); - - switch (dyn.d_tag) - { - default: - break; - - case DT_PLTGOT: - name = ".got"; - goto get_vma; - case DT_JMPREL: - name = ".rel.plt"; - get_vma: - s = bfd_get_section_by_name (output_bfd, name); - BFD_ASSERT (s != NULL); - dyn.d_un.d_ptr = s->vma; - bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); - break; - - case DT_PLTRELSZ: - s = bfd_get_section_by_name (output_bfd, ".rel.plt"); - BFD_ASSERT (s != NULL); - if (s->_cooked_size != 0) - dyn.d_un.d_val = s->_cooked_size; - else - dyn.d_un.d_val = s->_raw_size; - bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); - break; - - case DT_RELSZ: - /* My reading of the SVR4 ABI indicates that the - procedure linkage table relocs (DT_JMPREL) should be - included in the overall relocs (DT_REL). This is - what Solaris does. However, UnixWare can not handle - that case. Therefore, we override the DT_RELSZ entry - here to make it not include the JMPREL relocs. Since - the linker script arranges for .rel.plt to follow all - other relocation sections, we don't have to worry - about changing the DT_REL entry. */ - s = bfd_get_section_by_name (output_bfd, ".rel.plt"); - if (s != NULL) - { - if (s->_cooked_size != 0) - dyn.d_un.d_val -= s->_cooked_size; - else - dyn.d_un.d_val -= s->_raw_size; - } - bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); - break; - - /* Set the bottom bit of DT_INIT/FINI if the - corresponding function is Thumb. */ - case DT_INIT: - name = info->init_function; - goto get_sym; - case DT_FINI: - name = info->fini_function; - get_sym: - /* If it wasn't set by elf_bfd_final_link - then there is nothing to adjust. */ - if (dyn.d_un.d_val != 0) - { - struct elf_link_hash_entry * eh; - - eh = elf_link_hash_lookup (elf_hash_table (info), name, - FALSE, FALSE, TRUE); - if (eh != (struct elf_link_hash_entry *) NULL - && ELF_ST_TYPE (eh->type) == STT_ARM_TFUNC) - { - dyn.d_un.d_val |= 1; - bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); - } - } - break; - } - } - - /* Fill in the first entry in the procedure linkage table. */ - if (splt->_raw_size > 0) - { - bfd_vma got_displacement; - - /* Calculate the displacement between the PLT slot and &GOT[0]. */ - got_displacement = (sgot->output_section->vma - + sgot->output_offset - - splt->output_section->vma - - splt->output_offset - - 16); - - bfd_put_32 (output_bfd, elf32_arm_plt0_entry[0], splt->contents + 0); - bfd_put_32 (output_bfd, elf32_arm_plt0_entry[1], splt->contents + 4); - bfd_put_32 (output_bfd, elf32_arm_plt0_entry[2], splt->contents + 8); - bfd_put_32 (output_bfd, elf32_arm_plt0_entry[3], splt->contents + 12); -#ifdef FOUR_WORD_PLT - /* The displacement value goes in the otherwise-unused last word of - the second entry. */ - bfd_put_32 (output_bfd, got_displacement, splt->contents + 28); -#else - bfd_put_32 (output_bfd, got_displacement, splt->contents + 16); -#endif - } - - /* UnixWare sets the entsize of .plt to 4, although that doesn't - really seem like the right value. */ - elf_section_data (splt->output_section)->this_hdr.sh_entsize = 4; - } - - /* Fill in the first three entries in the global offset table. */ - if (sgot->_raw_size > 0) - { - if (sdyn == NULL) - bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents); - else - bfd_put_32 (output_bfd, - sdyn->output_section->vma + sdyn->output_offset, - sgot->contents); - bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + 4); - bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + 8); - } - - elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4; - - return TRUE; -} - -static void -elf32_arm_post_process_headers (abfd, link_info) - bfd * abfd; - struct bfd_link_info * link_info ATTRIBUTE_UNUSED; -{ - Elf_Internal_Ehdr * i_ehdrp; /* ELF file header, internal form. */ - - i_ehdrp = elf_elfheader (abfd); - - i_ehdrp->e_ident[EI_OSABI] = ARM_ELF_OS_ABI_VERSION; - i_ehdrp->e_ident[EI_ABIVERSION] = ARM_ELF_ABI_VERSION; -} - -static enum elf_reloc_type_class -elf32_arm_reloc_type_class (rela) - const Elf_Internal_Rela *rela; -{ - switch ((int) ELF32_R_TYPE (rela->r_info)) - { - case R_ARM_RELATIVE: - return reloc_class_relative; - case R_ARM_JUMP_SLOT: - return reloc_class_plt; - case R_ARM_COPY: - return reloc_class_copy; - default: - return reloc_class_normal; - } -} - -static bfd_boolean elf32_arm_section_flags PARAMS ((flagword *, Elf_Internal_Shdr *)); -static void elf32_arm_final_write_processing PARAMS ((bfd *, bfd_boolean)); - -/* Set the right machine number for an Arm ELF file. */ - -static bfd_boolean -elf32_arm_section_flags (flags, hdr) - flagword *flags; - Elf_Internal_Shdr *hdr; -{ - if (hdr->sh_type == SHT_NOTE) - *flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_SAME_CONTENTS; - - return TRUE; -} - -void -elf32_arm_final_write_processing (abfd, linker) - bfd *abfd; - bfd_boolean linker ATTRIBUTE_UNUSED; -{ - bfd_arm_update_notes (abfd, ARM_NOTE_SECTION); -} - -#define ELF_ARCH bfd_arch_arm -#define ELF_MACHINE_CODE EM_ARM -#ifdef __QNXTARGET__ -#define ELF_MAXPAGESIZE 0x1000 -#else -#define ELF_MAXPAGESIZE 0x8000 -#endif - -#define bfd_elf32_bfd_copy_private_bfd_data elf32_arm_copy_private_bfd_data -#define bfd_elf32_bfd_merge_private_bfd_data elf32_arm_merge_private_bfd_data -#define bfd_elf32_bfd_set_private_flags elf32_arm_set_private_flags -#define bfd_elf32_bfd_print_private_bfd_data elf32_arm_print_private_bfd_data -#define bfd_elf32_bfd_link_hash_table_create elf32_arm_link_hash_table_create -#define bfd_elf32_bfd_reloc_type_lookup elf32_arm_reloc_type_lookup -#define bfd_elf32_find_nearest_line elf32_arm_find_nearest_line - -#define elf_backend_get_symbol_type elf32_arm_get_symbol_type -#define elf_backend_gc_mark_hook elf32_arm_gc_mark_hook -#define elf_backend_gc_sweep_hook elf32_arm_gc_sweep_hook -#define elf_backend_check_relocs elf32_arm_check_relocs -#define elf_backend_relocate_section elf32_arm_relocate_section -#define elf_backend_adjust_dynamic_symbol elf32_arm_adjust_dynamic_symbol -#define elf_backend_create_dynamic_sections elf32_arm_create_dynamic_sections -#define elf_backend_finish_dynamic_symbol elf32_arm_finish_dynamic_symbol -#define elf_backend_finish_dynamic_sections elf32_arm_finish_dynamic_sections -#define elf_backend_size_dynamic_sections elf32_arm_size_dynamic_sections -#define elf_backend_post_process_headers elf32_arm_post_process_headers -#define elf_backend_reloc_type_class elf32_arm_reloc_type_class -#define elf_backend_object_p elf32_arm_object_p -#define elf_backend_section_flags elf32_arm_section_flags -#define elf_backend_final_write_processing elf32_arm_final_write_processing -#define elf_backend_copy_indirect_symbol elf32_arm_copy_indirect_symbol - -#define elf_backend_can_refcount 1 -#define elf_backend_can_gc_sections 1 -#define elf_backend_plt_readonly 1 -#define elf_backend_want_got_plt 1 -#define elf_backend_want_plt_sym 0 -#if !USE_REL -#define elf_backend_rela_normal 1 -#endif - -#define elf_backend_got_header_size 12 - -#include "elf32-target.h" - diff --git a/contrib/binutils/bfd/elf32-gen.c b/contrib/binutils/bfd/elf32-gen.c index f2edf69da6b..23c74767799 100644 --- a/contrib/binutils/bfd/elf32-gen.c +++ b/contrib/binutils/bfd/elf32-gen.c @@ -1,22 +1,22 @@ /* Generic support for 32-bit ELF - Copyright 1993, 1995, 1998, 1999, 2001, 2002, 2004 + Copyright 1993, 1995, 1998, 1999, 2001, 2002, 2004, 2005 Free Software Foundation, Inc. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" @@ -41,53 +41,48 @@ static reloc_howto_type dummy = 0, /* dst_mask */ FALSE); /* pcrel_offset */ -static void elf_generic_info_to_howto - PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); -static void elf_generic_info_to_howto_rel - PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); -static bfd_boolean elf32_generic_link_add_symbols - PARAMS ((bfd *, struct bfd_link_info *)); - static void -elf_generic_info_to_howto (abfd, bfd_reloc, elf_reloc) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *bfd_reloc; - Elf_Internal_Rela *elf_reloc ATTRIBUTE_UNUSED; +elf_generic_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, + arelent *bfd_reloc, + Elf_Internal_Rela *elf_reloc ATTRIBUTE_UNUSED) { bfd_reloc->howto = &dummy; } static void -elf_generic_info_to_howto_rel (abfd, bfd_reloc, elf_reloc) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *bfd_reloc; - Elf_Internal_Rela *elf_reloc ATTRIBUTE_UNUSED; +elf_generic_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED, + arelent *bfd_reloc, + Elf_Internal_Rela *elf_reloc ATTRIBUTE_UNUSED) { bfd_reloc->howto = &dummy; } +static void +check_for_relocs (bfd * abfd, asection * o, void * failed) +{ + if ((o->flags & SEC_RELOC) != 0) + { + Elf_Internal_Ehdr *ehdrp; + + ehdrp = elf_elfheader (abfd); + _bfd_error_handler (_("%B: Relocations in generic ELF (EM: %d)"), + abfd, ehdrp->e_machine); + + bfd_set_error (bfd_error_wrong_format); + * (bfd_boolean *) failed = TRUE; + } +} + static bfd_boolean -elf32_generic_link_add_symbols (abfd, info) - bfd *abfd; - struct bfd_link_info *info; +elf32_generic_link_add_symbols (bfd *abfd, struct bfd_link_info *info) { - asection *o; + bfd_boolean failed = FALSE; /* Check if there are any relocations. */ - for (o = abfd->sections; o != NULL; o = o->next) - if ((o->flags & SEC_RELOC) != 0) - { - Elf_Internal_Ehdr *ehdrp; - - ehdrp = elf_elfheader (abfd); - (*_bfd_error_handler) (_("%s: Relocations in generic ELF (EM: %d)"), - bfd_archive_filename (abfd), - ehdrp->e_machine); - - bfd_set_error (bfd_error_wrong_format); - return FALSE; - } + bfd_map_over_sections (abfd, check_for_relocs, & failed); + if (failed) + return FALSE; return bfd_elf_link_add_symbols (abfd, info); } diff --git a/contrib/binutils/bfd/elf32-i386.c b/contrib/binutils/bfd/elf32-i386.c index 7b173e4485c..754aa52254d 100644 --- a/contrib/binutils/bfd/elf32-i386.c +++ b/contrib/binutils/bfd/elf32-i386.c @@ -1,6 +1,6 @@ /* Intel 80386/80486-specific support for 32-bit ELF Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003, 2004 Free Software Foundation, Inc. + 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -16,13 +16,14 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" #include "bfdlink.h" #include "libbfd.h" #include "elf-bfd.h" +#include "elf-vxworks.h" /* 386 uses REL relocations instead of RELA. */ #define USE_REL 1 @@ -125,9 +126,19 @@ static reloc_howto_type elf_howto_table[]= HOWTO(R_386_TLS_TPOFF32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_386_TLS_TPOFF32", TRUE, 0xffffffff, 0xffffffff, FALSE), + EMPTY_HOWTO (38), + HOWTO(R_386_TLS_GOTDESC, 0, 2, 32, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_386_TLS_GOTDESC", + TRUE, 0xffffffff, 0xffffffff, FALSE), + HOWTO(R_386_TLS_DESC_CALL, 0, 0, 0, FALSE, 0, complain_overflow_dont, + bfd_elf_generic_reloc, "R_386_TLS_DESC_CALL", + FALSE, 0, 0, FALSE), + HOWTO(R_386_TLS_DESC, 0, 2, 32, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_386_TLS_DESC", + TRUE, 0xffffffff, 0xffffffff, FALSE), /* Another gap. */ -#define R_386_tls (R_386_TLS_TPOFF32 + 1 - R_386_tls_offset) +#define R_386_tls (R_386_TLS_DESC + 1 - R_386_tls_offset) #define R_386_vt_offset (R_386_GNU_VTINHERIT - R_386_tls) /* GNU extension to record C++ vtable hierarchy. */ @@ -291,6 +302,18 @@ elf_i386_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, TRACE ("BFD_RELOC_386_TLS_TPOFF32"); return &elf_howto_table[R_386_TLS_TPOFF32 - R_386_tls_offset]; + case BFD_RELOC_386_TLS_GOTDESC: + TRACE ("BFD_RELOC_386_TLS_GOTDESC"); + return &elf_howto_table[R_386_TLS_GOTDESC - R_386_tls_offset]; + + case BFD_RELOC_386_TLS_DESC_CALL: + TRACE ("BFD_RELOC_386_TLS_DESC_CALL"); + return &elf_howto_table[R_386_TLS_DESC_CALL - R_386_tls_offset]; + + case BFD_RELOC_386_TLS_DESC: + TRACE ("BFD_RELOC_386_TLS_DESC"); + return &elf_howto_table[R_386_TLS_DESC - R_386_tls_offset]; + case BFD_RELOC_VTABLE_INHERIT: TRACE ("BFD_RELOC_VTABLE_INHERIT"); return &elf_howto_table[R_386_GNU_VTINHERIT - R_386_vt_offset]; @@ -323,8 +346,8 @@ elf_i386_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED, && ((indx = r_type - R_386_vt_offset) - R_386_tls >= R_386_vt - R_386_tls)) { - (*_bfd_error_handler) (_("%s: invalid relocation type %d"), - bfd_archive_filename (abfd), (int) r_type); + (*_bfd_error_handler) (_("%B: invalid relocation type %d"), + abfd, (int) r_type); indx = R_386_NONE; } cache_ptr->howto = &elf_howto_table[indx]; @@ -351,7 +374,7 @@ static bfd_boolean elf_i386_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) { int offset; - size_t raw_size; + size_t size; if (note->namesz == 8 && strcmp (note->namedata, "FreeBSD") == 0) { @@ -368,7 +391,7 @@ elf_i386_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) /* pr_reg */ offset = 28; - raw_size = bfd_get_32 (abfd, note->descdata + 8); + size = bfd_get_32 (abfd, note->descdata + 8); } else { @@ -386,7 +409,7 @@ elf_i386_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) /* pr_reg */ offset = 72; - raw_size = 68; + size = 68; break; } @@ -394,7 +417,7 @@ elf_i386_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) /* Make a ".reg/999" section. */ return _bfd_elfcore_make_pseudosection (abfd, ".reg", - raw_size, note->descpos + offset); + size, note->descpos + offset); } static bfd_boolean @@ -471,15 +494,15 @@ elf_i386_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) #define PLT_ENTRY_SIZE 16 /* The first entry in an absolute procedure linkage table looks like - this. See the SVR4 ABI i386 supplement to see how this works. */ + this. See the SVR4 ABI i386 supplement to see how this works. + Will be padded to PLT_ENTRY_SIZE with htab->plt0_pad_byte. */ -static const bfd_byte elf_i386_plt0_entry[PLT_ENTRY_SIZE] = +static const bfd_byte elf_i386_plt0_entry[12] = { 0xff, 0x35, /* pushl contents of address */ 0, 0, 0, 0, /* replaced with address of .got + 4. */ 0xff, 0x25, /* jmp indirect */ - 0, 0, 0, 0, /* replaced with address of .got + 8. */ - 0, 0, 0, 0 /* pad out to 16 bytes. */ + 0, 0, 0, 0 /* replaced with address of .got + 8. */ }; /* Subsequent entries in an absolute procedure linkage table look like @@ -495,13 +518,13 @@ static const bfd_byte elf_i386_plt_entry[PLT_ENTRY_SIZE] = 0, 0, 0, 0 /* replaced with offset to start of .plt. */ }; -/* The first entry in a PIC procedure linkage table look like this. */ +/* The first entry in a PIC procedure linkage table look like this. + Will be padded to PLT_ENTRY_SIZE with htab->plt0_pad_byte. */ -static const bfd_byte elf_i386_pic_plt0_entry[PLT_ENTRY_SIZE] = +static const bfd_byte elf_i386_pic_plt0_entry[12] = { 0xff, 0xb3, 4, 0, 0, 0, /* pushl 4(%ebx) */ - 0xff, 0xa3, 8, 0, 0, 0, /* jmp *8(%ebx) */ - 0, 0, 0, 0 /* pad out to 16 bytes. */ + 0xff, 0xa3, 8, 0, 0, 0 /* jmp *8(%ebx) */ }; /* Subsequent entries in a PIC procedure linkage table look like this. */ @@ -516,6 +539,12 @@ static const bfd_byte elf_i386_pic_plt_entry[PLT_ENTRY_SIZE] = 0, 0, 0, 0 /* replaced with offset to start of .plt. */ }; +/* On VxWorks, the .rel.plt.unloaded section has absolute relocations + for the PLTResolve stub and then for each PLT entry. */ +#define PLTRESOLVE_RELOCS_SHLIB 0 +#define PLTRESOLVE_RELOCS 2 +#define PLT_NON_JUMP_SLOT_RELOCS 2 + /* The i386 linker needs to keep track of the number of relocs that it decides to copy as dynamic relocs in check_relocs for each symbol. This is so that it can later discard them if they are found to be @@ -552,7 +581,24 @@ struct elf_i386_link_hash_entry #define GOT_TLS_IE_POS 5 #define GOT_TLS_IE_NEG 6 #define GOT_TLS_IE_BOTH 7 +#define GOT_TLS_GDESC 8 +#define GOT_TLS_MASK 0x0f +#define GOT_TLS_IE_IE 0x10 +#define GOT_TLS_IE_GD 0x20 +#define GOT_TLS_IE_MASK 0x30 +#define GOT_TLS_GD_BOTH_P(type) \ + ((type) == (GOT_TLS_GD | GOT_TLS_GDESC)) +#define GOT_TLS_GD_P(type) \ + ((type) == GOT_TLS_GD || GOT_TLS_GD_BOTH_P (type)) +#define GOT_TLS_GDESC_P(type) \ + ((type) == GOT_TLS_GDESC || GOT_TLS_GD_BOTH_P (type)) +#define GOT_TLS_GD_ANY_P(type) \ + (GOT_TLS_GD_P (type) || GOT_TLS_GDESC_P (type)) unsigned char tls_type; + + /* Offset of the GOTPLT entry reserved for the TLS descriptor, + starting at the end of the jump table. */ + bfd_vma tlsdesc_got; }; #define elf_i386_hash_entry(ent) ((struct elf_i386_link_hash_entry *)(ent)) @@ -563,6 +609,9 @@ struct elf_i386_obj_tdata /* tls_type for each local got entry. */ char *local_got_tls_type; + + /* GOTPLT entries for TLS descriptors. */ + bfd_vma *local_tlsdesc_gotent; }; #define elf_i386_tdata(abfd) \ @@ -571,6 +620,9 @@ struct elf_i386_obj_tdata #define elf_i386_local_got_tls_type(abfd) \ (elf_i386_tdata (abfd)->local_got_tls_type) +#define elf_i386_local_tlsdesc_gotent(abfd) \ + (elf_i386_tdata (abfd)->local_tlsdesc_gotent) + static bfd_boolean elf_i386_mkobject (bfd *abfd) { @@ -596,11 +648,27 @@ struct elf_i386_link_hash_table asection *sdynbss; asection *srelbss; + /* The (unloaded but important) .rel.plt.unloaded section on VxWorks. */ + asection *srelplt2; + + /* True if the target system is VxWorks. */ + int is_vxworks; + + /* Value used to fill the last word of the first plt entry. */ + bfd_byte plt0_pad_byte; + + /* The index of the next unused R_386_TLS_DESC slot in .rel.plt. */ + bfd_vma next_tls_desc_index; + union { bfd_signed_vma refcount; bfd_vma offset; } tls_ldm_got; + /* The amount of space used by the reserved portion of the sgotplt + section, plus whatever space is used by the jump slots. */ + bfd_vma sgotplt_jump_table_size; + /* Small local sym to section mapping cache. */ struct sym_sec_cache sym_sec; }; @@ -610,6 +678,9 @@ struct elf_i386_link_hash_table #define elf_i386_hash_table(p) \ ((struct elf_i386_link_hash_table *) ((p)->hash)) +#define elf_i386_compute_jump_table_size(htab) \ + ((htab)->next_tls_desc_index * 4) + /* Create an entry in an i386 ELF linker hash table. */ static struct bfd_hash_entry * @@ -636,6 +707,7 @@ link_hash_newfunc (struct bfd_hash_entry *entry, eh = (struct elf_i386_link_hash_entry *) entry; eh->dyn_relocs = NULL; eh->tls_type = GOT_UNKNOWN; + eh->tlsdesc_got = (bfd_vma) -1; } return entry; @@ -653,7 +725,8 @@ elf_i386_link_hash_table_create (bfd *abfd) if (ret == NULL) return NULL; - if (! _bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc)) + if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc, + sizeof (struct elf_i386_link_hash_entry))) { free (ret); return NULL; @@ -667,7 +740,12 @@ elf_i386_link_hash_table_create (bfd *abfd) ret->sdynbss = NULL; ret->srelbss = NULL; ret->tls_ldm_got.refcount = 0; + ret->next_tls_desc_index = 0; + ret->sgotplt_jump_table_size = 0; ret->sym_sec.abfd = NULL; + ret->is_vxworks = 0; + ret->srelplt2 = NULL; + ret->plt0_pad_byte = 0; return &ret->elf.root; } @@ -689,12 +767,13 @@ create_got_section (bfd *dynobj, struct bfd_link_info *info) if (!htab->sgot || !htab->sgotplt) abort (); - htab->srelgot = bfd_make_section (dynobj, ".rel.got"); + htab->srelgot = bfd_make_section_with_flags (dynobj, ".rel.got", + (SEC_ALLOC | SEC_LOAD + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_LINKER_CREATED + | SEC_READONLY)); if (htab->srelgot == NULL - || ! bfd_set_section_flags (dynobj, htab->srelgot, - (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS - | SEC_IN_MEMORY | SEC_LINKER_CREATED - | SEC_READONLY)) || ! bfd_set_section_alignment (dynobj, htab->srelgot, 2)) return FALSE; return TRUE; @@ -726,13 +805,17 @@ elf_i386_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info) || (!info->shared && !htab->srelbss)) abort (); + if (htab->is_vxworks + && !elf_vxworks_create_dynamic_sections (dynobj, info, &htab->srelplt2)) + return FALSE; + return TRUE; } /* Copy the extra info we tack onto an elf_link_hash_entry. */ static void -elf_i386_copy_indirect_symbol (const struct elf_backend_data *bed, +elf_i386_copy_indirect_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *dir, struct elf_link_hash_entry *ind) { @@ -748,10 +831,7 @@ elf_i386_copy_indirect_symbol (const struct elf_backend_data *bed, struct elf_i386_dyn_relocs **pp; struct elf_i386_dyn_relocs *p; - if (ind->root.type == bfd_link_hash_indirect) - abort (); - - /* Add reloc counts against the weak sym to the strong sym + /* Add reloc counts against the indirect sym to the direct sym list. Merge any entries against the same section. */ for (pp = &eind->dyn_relocs; (p = *pp) != NULL; ) { @@ -784,18 +864,19 @@ elf_i386_copy_indirect_symbol (const struct elf_backend_data *bed, if (ELIMINATE_COPY_RELOCS && ind->root.type != bfd_link_hash_indirect - && (dir->elf_link_hash_flags & ELF_LINK_HASH_DYNAMIC_ADJUSTED) != 0) - /* If called to transfer flags for a weakdef during processing - of elf_adjust_dynamic_symbol, don't copy ELF_LINK_NON_GOT_REF. - We clear it ourselves for ELIMINATE_COPY_RELOCS. */ - dir->elf_link_hash_flags |= - (ind->elf_link_hash_flags & (ELF_LINK_HASH_REF_DYNAMIC - | ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_REF_REGULAR_NONWEAK - | ELF_LINK_HASH_NEEDS_PLT - | ELF_LINK_POINTER_EQUALITY_NEEDED)); + && dir->dynamic_adjusted) + { + /* If called to transfer flags for a weakdef during processing + of elf_adjust_dynamic_symbol, don't copy non_got_ref. + We clear it ourselves for ELIMINATE_COPY_RELOCS. */ + dir->ref_dynamic |= ind->ref_dynamic; + dir->ref_regular |= ind->ref_regular; + dir->ref_regular_nonweak |= ind->ref_regular_nonweak; + dir->needs_plt |= ind->needs_plt; + dir->pointer_equality_needed |= ind->pointer_equality_needed; + } else - _bfd_elf_link_hash_copy_indirect (bed, dir, ind); + _bfd_elf_link_hash_copy_indirect (info, dir, ind); } static int @@ -807,6 +888,8 @@ elf_i386_tls_transition (struct bfd_link_info *info, int r_type, int is_local) switch (r_type) { case R_386_TLS_GD: + case R_386_TLS_GOTDESC: + case R_386_TLS_DESC_CALL: case R_386_TLS_IE_32: if (is_local) return R_386_TLS_LE_32; @@ -861,8 +944,8 @@ elf_i386_check_relocs (bfd *abfd, if (r_symndx >= NUM_SHDR_ENTRIES (symtab_hdr)) { - (*_bfd_error_handler) (_("%s: bad symbol index: %d"), - bfd_archive_filename (abfd), + (*_bfd_error_handler) (_("%B: bad symbol index: %d"), + abfd, r_symndx); return FALSE; } @@ -870,7 +953,12 @@ elf_i386_check_relocs (bfd *abfd, if (r_symndx < symtab_hdr->sh_info) h = NULL; else - h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + { + 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; + } r_type = elf_i386_tls_transition (info, r_type, h == NULL); @@ -893,7 +981,7 @@ elf_i386_check_relocs (bfd *abfd, if (h == NULL) continue; - h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; + h->needs_plt = 1; h->plt.refcount += 1; break; @@ -906,6 +994,8 @@ elf_i386_check_relocs (bfd *abfd, case R_386_GOT32: case R_386_TLS_GD: + case R_386_TLS_GOTDESC: + case R_386_TLS_DESC_CALL: /* This symbol requires a global offset table entry. */ { int tls_type, old_tls_type; @@ -915,15 +1005,31 @@ elf_i386_check_relocs (bfd *abfd, default: case R_386_GOT32: tls_type = GOT_NORMAL; break; case R_386_TLS_GD: tls_type = GOT_TLS_GD; break; + case R_386_TLS_GOTDESC: + case R_386_TLS_DESC_CALL: + tls_type = GOT_TLS_GDESC; break; case R_386_TLS_IE_32: if (ELF32_R_TYPE (rel->r_info) == r_type) tls_type = GOT_TLS_IE_NEG; + else if (h + && ELF32_R_TYPE (rel->r_info) == R_386_TLS_GD) + /* If this is a GD->IE transition, we may use either + of R_386_TLS_TPOFF and R_386_TLS_TPOFF32. But if + we may have both R_386_TLS_IE and R_386_TLS_GD, + we can't share the same R_386_TLS_TPOFF since + they require different offsets. So we remember + it comes from R_386_TLS_GD. */ + tls_type = GOT_TLS_IE | GOT_TLS_IE_GD; else - /* If this is a GD->IE transition, we may use either of - R_386_TLS_TPOFF and R_386_TLS_TPOFF32. */ tls_type = GOT_TLS_IE; break; case R_386_TLS_IE: + if (h) + { + /* We remember it comes from R_386_TLS_IE. */ + tls_type = GOT_TLS_IE_POS | GOT_TLS_IE_IE; + break; + } case R_386_TLS_GOTIE: tls_type = GOT_TLS_IE_POS; break; } @@ -944,13 +1050,16 @@ elf_i386_check_relocs (bfd *abfd, bfd_size_type size; size = symtab_hdr->sh_info; - size *= (sizeof (bfd_signed_vma) + sizeof(char)); + size *= (sizeof (bfd_signed_vma) + + sizeof (bfd_vma) + sizeof(char)); local_got_refcounts = bfd_zalloc (abfd, size); if (local_got_refcounts == NULL) return FALSE; elf_local_got_refcounts (abfd) = local_got_refcounts; + elf_i386_local_tlsdesc_gotent (abfd) + = (bfd_vma *) (local_got_refcounts + symtab_hdr->sh_info); elf_i386_local_got_tls_type (abfd) - = (char *) (local_got_refcounts + symtab_hdr->sh_info); + = (char *) (local_got_refcounts + 2 * symtab_hdr->sh_info); } local_got_refcounts[r_symndx] += 1; old_tls_type = elf_i386_local_got_tls_type (abfd) [r_symndx]; @@ -960,18 +1069,22 @@ elf_i386_check_relocs (bfd *abfd, tls_type |= old_tls_type; /* If a TLS symbol is accessed using IE at least once, there is no point to use dynamic model for it. */ - else if (old_tls_type != tls_type && old_tls_type != GOT_UNKNOWN - && (old_tls_type != GOT_TLS_GD + else if (old_tls_type != tls_type + && old_tls_type != GOT_UNKNOWN + && (! GOT_TLS_GD_ANY_P (old_tls_type) || (tls_type & GOT_TLS_IE) == 0)) { - if ((old_tls_type & GOT_TLS_IE) && tls_type == GOT_TLS_GD) + if ((old_tls_type & GOT_TLS_IE) && GOT_TLS_GD_ANY_P (tls_type)) tls_type = old_tls_type; + else if (GOT_TLS_GD_ANY_P (old_tls_type) + && GOT_TLS_GD_ANY_P (tls_type)) + tls_type |= old_tls_type; else { (*_bfd_error_handler) - (_("%s: `%s' accessed both as normal and " + (_("%B: `%s' accessed both as normal and " "thread local symbol"), - bfd_archive_filename (abfd), + abfd, h ? h->root.root.string : ""); return FALSE; } @@ -1018,13 +1131,13 @@ elf_i386_check_relocs (bfd *abfd, sections have not yet been mapped to output sections. Tentatively set the flag for now, and correct in adjust_dynamic_symbol. */ - h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF; + h->non_got_ref = 1; /* We may need a .plt entry if the function this reloc refers to is in a shared lib. */ h->plt.refcount += 1; if (r_type != R_386_PC32) - h->elf_link_hash_flags |= ELF_LINK_POINTER_EQUALITY_NEEDED; + h->pointer_equality_needed = 1; } /* If we are creating a shared library, and this is a reloc @@ -1054,15 +1167,13 @@ elf_i386_check_relocs (bfd *abfd, || (h != NULL && (! info->symbolic || h->root.type == bfd_link_hash_defweak - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0)))) + || !h->def_regular)))) || (ELIMINATE_COPY_RELOCS && !info->shared && (sec->flags & SEC_ALLOC) != 0 && h != NULL && (h->root.type == bfd_link_hash_defweak - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0))) + || !h->def_regular))) { struct elf_i386_dyn_relocs *p; struct elf_i386_dyn_relocs **head; @@ -1086,8 +1197,8 @@ elf_i386_check_relocs (bfd *abfd, name + 4) != 0) { (*_bfd_error_handler) - (_("%s: bad relocation section name `%s\'"), - bfd_archive_filename (abfd), name); + (_("%B: bad relocation section name `%s\'"), + abfd, name); } if (htab->elf.dynobj == NULL) @@ -1099,13 +1210,14 @@ elf_i386_check_relocs (bfd *abfd, { flagword flags; - sreloc = bfd_make_section (dynobj, name); flags = (SEC_HAS_CONTENTS | SEC_READONLY | SEC_IN_MEMORY | SEC_LINKER_CREATED); if ((sec->flags & SEC_ALLOC) != 0) flags |= SEC_ALLOC | SEC_LOAD; + sreloc = bfd_make_section_with_flags (dynobj, + name, + flags); if (sreloc == NULL - || ! bfd_set_section_flags (dynobj, sreloc, flags) || ! bfd_set_section_alignment (dynobj, sreloc, 2)) return FALSE; } @@ -1120,6 +1232,7 @@ elf_i386_check_relocs (bfd *abfd, } else { + void **vpp; /* Track dynamic relocs needed for local syms too. We really need local syms available to do this easily. Oh well. */ @@ -1130,8 +1243,8 @@ elf_i386_check_relocs (bfd *abfd, if (s == NULL) return FALSE; - head = ((struct elf_i386_dyn_relocs **) - &elf_section_data (s)->local_dynrel); + vpp = &elf_section_data (s)->local_dynrel; + head = (struct elf_i386_dyn_relocs **)vpp; } p = *head; @@ -1249,6 +1362,9 @@ elf_i386_gc_sweep_hook (bfd *abfd, struct elf_i386_dyn_relocs *p; 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; eh = (struct elf_i386_link_hash_entry *) h; for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next) @@ -1270,6 +1386,8 @@ elf_i386_gc_sweep_hook (bfd *abfd, break; case R_386_TLS_GD: + case R_386_TLS_GOTDESC: + case R_386_TLS_DESC_CALL: case R_386_TLS_IE_32: case R_386_TLS_IE: case R_386_TLS_GOTIE: @@ -1326,7 +1444,7 @@ elf_i386_adjust_dynamic_symbol (struct bfd_link_info *info, will fill in the contents of the procedure linkage table later, when we know the address of the .got section. */ if (h->type == STT_FUNC - || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0) + || h->needs_plt) { if (h->plt.refcount <= 0 || SYMBOL_CALLS_LOCAL (info, h) @@ -1339,7 +1457,7 @@ elf_i386_adjust_dynamic_symbol (struct bfd_link_info *info, such a case, we don't actually need to build a procedure linkage table, and we can just do a PC32 reloc instead. */ h->plt.offset = (bfd_vma) -1; - h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; + h->needs_plt = 0; } return TRUE; @@ -1355,16 +1473,14 @@ elf_i386_adjust_dynamic_symbol (struct bfd_link_info *info, /* 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) + if (h->u.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; + BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined + || h->u.weakdef->root.type == bfd_link_hash_defweak); + h->root.u.def.section = h->u.weakdef->root.u.def.section; + h->root.u.def.value = h->u.weakdef->root.u.def.value; if (ELIMINATE_COPY_RELOCS || info->nocopyreloc) - h->elf_link_hash_flags - = ((h->elf_link_hash_flags & ~ELF_LINK_NON_GOT_REF) - | (h->weakdef->elf_link_hash_flags & ELF_LINK_NON_GOT_REF)); + h->non_got_ref = h->u.weakdef->non_got_ref; return TRUE; } @@ -1380,17 +1496,23 @@ elf_i386_adjust_dynamic_symbol (struct bfd_link_info *info, /* If there are no references to this symbol that do not use the GOT, we don't need to generate a copy reloc. */ - if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0) + if (!h->non_got_ref) return TRUE; /* If -z nocopyreloc was given, we won't generate them either. */ if (info->nocopyreloc) { - h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF; + h->non_got_ref = 0; return TRUE; } - if (ELIMINATE_COPY_RELOCS) + htab = elf_i386_hash_table (info); + + /* If there aren't any dynamic relocs in read-only sections, then + we can keep the dynamic relocs and avoid the copy reloc. This + doesn't work on VxWorks, where we can not have dynamic relocations + (other than copy and jump slot relocations) in an executable. */ + if (ELIMINATE_COPY_RELOCS && !htab->is_vxworks) { struct elf_i386_link_hash_entry * eh; struct elf_i386_dyn_relocs *p; @@ -1403,15 +1525,20 @@ elf_i386_adjust_dynamic_symbol (struct bfd_link_info *info, break; } - /* If we didn't find any dynamic relocs in read-only sections, then - we'll be keeping the dynamic relocs and avoiding the copy reloc. */ if (p == NULL) { - h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF; + h->non_got_ref = 0; return TRUE; } } + if (h->size == 0) + { + (*_bfd_error_handler) (_("dynamic variable `%s' is zero size"), + h->root.root.string); + return TRUE; + } + /* We must allocate the symbol in our .dynbss section, which will become part of the .bss section of the executable. There will be an entry for this symbol in the .dynsym section. The dynamic @@ -1422,15 +1549,13 @@ elf_i386_adjust_dynamic_symbol (struct bfd_link_info *info, both the dynamic object and the regular object will refer to the same memory location for the variable. */ - htab = elf_i386_hash_table (info); - /* We must generate a R_386_COPY reloc to tell the dynamic linker to copy the initial value out of the dynamic object and into the runtime process image. */ if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) { - htab->srelbss->_raw_size += sizeof (Elf32_External_Rel); - h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY; + htab->srelbss->size += sizeof (Elf32_External_Rel); + h->needs_copy = 1; } /* We need to figure out the alignment required for this symbol. I @@ -1441,7 +1566,7 @@ elf_i386_adjust_dynamic_symbol (struct bfd_link_info *info, /* Apply the required alignment. */ s = htab->sdynbss; - s->_raw_size = BFD_ALIGN (s->_raw_size, (bfd_size_type) (1 << power_of_two)); + s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two)); if (power_of_two > bfd_get_section_alignment (htab->elf.dynobj, s)) { if (! bfd_set_section_alignment (htab->elf.dynobj, s, power_of_two)) @@ -1450,10 +1575,10 @@ elf_i386_adjust_dynamic_symbol (struct bfd_link_info *info, /* Define the symbol as being at this point in the section. */ h->root.u.def.section = s; - h->root.u.def.value = s->_raw_size; + h->root.u.def.value = s->size; /* Increment the section size to make room for the symbol. */ - s->_raw_size += h->size; + s->size += h->size; return TRUE; } @@ -1487,7 +1612,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) /* Make sure this symbol is output as a dynamic symbol. Undefined weak syms won't yet be marked as dynamic. */ if (h->dynindx == -1 - && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) + && !h->forced_local) { if (! bfd_elf_link_record_dynamic_symbol (info, h)) return FALSE; @@ -1500,10 +1625,10 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) /* If this is the first .plt entry, make room for the special first entry. */ - if (s->_raw_size == 0) - s->_raw_size += PLT_ENTRY_SIZE; + if (s->size == 0) + s->size += PLT_ENTRY_SIZE; - h->plt.offset = s->_raw_size; + h->plt.offset = s->size; /* If this symbol is not defined in a regular file, and we are not generating a shared library, then set the symbol to this @@ -1511,34 +1636,58 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) pointers compare as equal between the normal executable and the shared library. */ if (! info->shared - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + && !h->def_regular) { h->root.u.def.section = s; h->root.u.def.value = h->plt.offset; } /* Make room for this entry. */ - s->_raw_size += PLT_ENTRY_SIZE; + s->size += PLT_ENTRY_SIZE; /* We also need to make an entry in the .got.plt section, which will be placed in the .got section by the linker script. */ - htab->sgotplt->_raw_size += 4; + htab->sgotplt->size += 4; /* We also need to make an entry in the .rel.plt section. */ - htab->srelplt->_raw_size += sizeof (Elf32_External_Rel); + htab->srelplt->size += sizeof (Elf32_External_Rel); + htab->next_tls_desc_index++; + + if (htab->is_vxworks && !info->shared) + { + /* VxWorks has a second set of relocations for each PLT entry + in executables. They go in a separate relocation section, + which is processed by the kernel loader. */ + + /* There are two relocations for the initial PLT entry: an + R_386_32 relocation for _GLOBAL_OFFSET_TABLE_ + 4 and an + R_386_32 relocation for _GLOBAL_OFFSET_TABLE_ + 8. */ + + if (h->plt.offset == PLT_ENTRY_SIZE) + htab->srelplt2->size += (sizeof (Elf32_External_Rel) * 2); + + /* There are two extra relocations for each subsequent PLT entry: + an R_386_32 relocation for the GOT entry, and an R_386_32 + relocation for the PLT entry. */ + + htab->srelplt2->size += (sizeof (Elf32_External_Rel) * 2); + } } else { h->plt.offset = (bfd_vma) -1; - h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; + h->needs_plt = 0; } } else { h->plt.offset = (bfd_vma) -1; - h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; + h->needs_plt = 0; } + eh = (struct elf_i386_link_hash_entry *) h; + eh->tlsdesc_got = (bfd_vma) -1; + /* If R_386_TLS_{IE_32,IE,GOTIE} symbol is now local to the binary, make it a R_386_TLS_LE_32 requiring no TLS entry. */ if (h->got.refcount > 0 @@ -1551,22 +1700,41 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) asection *s; bfd_boolean dyn; int tls_type = elf_i386_hash_entry(h)->tls_type; + + /* If we have both R_386_TLS_IE and R_386_TLS_GD, GOT_TLS_IE_BOTH + should be used. */ + if ((tls_type & GOT_TLS_IE_MASK) + == (GOT_TLS_IE_IE | GOT_TLS_IE_GD)) + tls_type = GOT_TLS_IE_BOTH; + else + tls_type &= GOT_TLS_MASK; /* Make sure this symbol is output as a dynamic symbol. Undefined weak syms won't yet be marked as dynamic. */ if (h->dynindx == -1 - && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) + && !h->forced_local) { if (! bfd_elf_link_record_dynamic_symbol (info, h)) return FALSE; } s = htab->sgot; - h->got.offset = s->_raw_size; - s->_raw_size += 4; - /* R_386_TLS_GD needs 2 consecutive GOT slots. */ - if (tls_type == GOT_TLS_GD || tls_type == GOT_TLS_IE_BOTH) - s->_raw_size += 4; + if (GOT_TLS_GDESC_P (tls_type)) + { + eh->tlsdesc_got = htab->sgotplt->size + - elf_i386_compute_jump_table_size (htab); + htab->sgotplt->size += 8; + h->got.offset = (bfd_vma) -2; + } + if (! GOT_TLS_GDESC_P (tls_type) + || GOT_TLS_GD_P (tls_type)) + { + h->got.offset = s->size; + s->size += 4; + /* R_386_TLS_GD needs 2 consecutive GOT slots. */ + if (GOT_TLS_GD_P (tls_type) || tls_type == GOT_TLS_IE_BOTH) + s->size += 4; + } dyn = htab->elf.dynamic_sections_created; /* R_386_TLS_IE_32 needs one dynamic relocation, R_386_TLS_IE resp. R_386_TLS_GOTIE needs one dynamic relocation, @@ -1574,22 +1742,24 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) need two), R_386_TLS_GD needs one if local symbol and two if global. */ if (tls_type == GOT_TLS_IE_BOTH) - htab->srelgot->_raw_size += 2 * sizeof (Elf32_External_Rel); - else if ((tls_type == GOT_TLS_GD && h->dynindx == -1) + htab->srelgot->size += 2 * sizeof (Elf32_External_Rel); + else if ((GOT_TLS_GD_P (tls_type) && h->dynindx == -1) || (tls_type & GOT_TLS_IE)) - htab->srelgot->_raw_size += sizeof (Elf32_External_Rel); - else if (tls_type == GOT_TLS_GD) - htab->srelgot->_raw_size += 2 * sizeof (Elf32_External_Rel); - else if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT - || h->root.type != bfd_link_hash_undefweak) + htab->srelgot->size += sizeof (Elf32_External_Rel); + else if (GOT_TLS_GD_P (tls_type)) + htab->srelgot->size += 2 * sizeof (Elf32_External_Rel); + else if (! GOT_TLS_GDESC_P (tls_type) + && (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT + || h->root.type != bfd_link_hash_undefweak) && (info->shared || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h))) - htab->srelgot->_raw_size += sizeof (Elf32_External_Rel); + htab->srelgot->size += sizeof (Elf32_External_Rel); + if (GOT_TLS_GDESC_P (tls_type)) + htab->srelplt->size += sizeof (Elf32_External_Rel); } else h->got.offset = (bfd_vma) -1; - eh = (struct elf_i386_link_hash_entry *) h; if (eh->dyn_relocs == NULL) return TRUE; @@ -1624,9 +1794,21 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) /* Also discard relocs on undefined weak syms with non-default visibility. */ - if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT + if (eh->dyn_relocs != NULL && h->root.type == bfd_link_hash_undefweak) - eh->dyn_relocs = NULL; + { + if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT) + eh->dyn_relocs = NULL; + + /* Make sure undefined weak symbols are output as a dynamic + symbol in PIEs. */ + else if (h->dynindx == -1 + && !h->forced_local) + { + if (! bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } + } } else if (ELIMINATE_COPY_RELOCS) { @@ -1634,9 +1816,9 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) symbols which turn out to need copy relocs or are not dynamic. */ - if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0 - && (((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + if (!h->non_got_ref + && ((h->def_dynamic + && !h->def_regular) || (htab->elf.dynamic_sections_created && (h->root.type == bfd_link_hash_undefweak || h->root.type == bfd_link_hash_undefined)))) @@ -1644,7 +1826,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) /* Make sure this symbol is output as a dynamic symbol. Undefined weak syms won't yet be marked as dynamic. */ if (h->dynindx == -1 - && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) + && !h->forced_local) { if (! bfd_elf_link_record_dynamic_symbol (info, h)) return FALSE; @@ -1665,7 +1847,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) for (p = eh->dyn_relocs; p != NULL; p = p->next) { asection *sreloc = elf_section_data (p->sec)->sreloc; - sreloc->_raw_size += p->count * sizeof (Elf32_External_Rel); + sreloc->size += p->count * sizeof (Elf32_External_Rel); } return TRUE; @@ -1725,7 +1907,7 @@ elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, s = bfd_get_section_by_name (dynobj, ".interp"); if (s == NULL) abort (); - s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER; + s->size = sizeof ELF_DYNAMIC_INTERPRETER; s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER; } } @@ -1737,6 +1919,7 @@ elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, bfd_signed_vma *local_got; bfd_signed_vma *end_local_got; char *local_tls_type; + bfd_vma *local_tlsdesc_gotent; bfd_size_type locsymcount; Elf_Internal_Shdr *symtab_hdr; asection *srel; @@ -1748,8 +1931,8 @@ elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, { struct elf_i386_dyn_relocs *p; - for (p = *((struct elf_i386_dyn_relocs **) - &elf_section_data (s)->local_dynrel); + for (p = ((struct elf_i386_dyn_relocs *) + elf_section_data (s)->local_dynrel); p != NULL; p = p->next) { @@ -1764,7 +1947,7 @@ elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, else if (p->count != 0) { srel = elf_section_data (p->sec)->sreloc; - srel->_raw_size += p->count * sizeof (Elf32_External_Rel); + srel->size += p->count * sizeof (Elf32_External_Rel); if ((p->sec->output_section->flags & SEC_READONLY) != 0) info->flags |= DF_TEXTREL; } @@ -1779,25 +1962,42 @@ elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, locsymcount = symtab_hdr->sh_info; end_local_got = local_got + locsymcount; local_tls_type = elf_i386_local_got_tls_type (ibfd); + local_tlsdesc_gotent = elf_i386_local_tlsdesc_gotent (ibfd); s = htab->sgot; srel = htab->srelgot; - for (; local_got < end_local_got; ++local_got, ++local_tls_type) + for (; local_got < end_local_got; + ++local_got, ++local_tls_type, ++local_tlsdesc_gotent) { + *local_tlsdesc_gotent = (bfd_vma) -1; if (*local_got > 0) { - *local_got = s->_raw_size; - s->_raw_size += 4; - if (*local_tls_type == GOT_TLS_GD - || *local_tls_type == GOT_TLS_IE_BOTH) - s->_raw_size += 4; + if (GOT_TLS_GDESC_P (*local_tls_type)) + { + *local_tlsdesc_gotent = htab->sgotplt->size + - elf_i386_compute_jump_table_size (htab); + htab->sgotplt->size += 8; + *local_got = (bfd_vma) -2; + } + if (! GOT_TLS_GDESC_P (*local_tls_type) + || GOT_TLS_GD_P (*local_tls_type)) + { + *local_got = s->size; + s->size += 4; + if (GOT_TLS_GD_P (*local_tls_type) + || *local_tls_type == GOT_TLS_IE_BOTH) + s->size += 4; + } if (info->shared - || *local_tls_type == GOT_TLS_GD + || GOT_TLS_GD_ANY_P (*local_tls_type) || (*local_tls_type & GOT_TLS_IE)) { if (*local_tls_type == GOT_TLS_IE_BOTH) - srel->_raw_size += 2 * sizeof (Elf32_External_Rel); - else - srel->_raw_size += sizeof (Elf32_External_Rel); + srel->size += 2 * sizeof (Elf32_External_Rel); + else if (GOT_TLS_GD_P (*local_tls_type) + || ! GOT_TLS_GDESC_P (*local_tls_type)) + srel->size += sizeof (Elf32_External_Rel); + if (GOT_TLS_GDESC_P (*local_tls_type)) + htab->srelplt->size += sizeof (Elf32_External_Rel); } } else @@ -1809,9 +2009,9 @@ elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, { /* Allocate 2 got entries and 1 dynamic reloc for R_386_TLS_LDM relocs. */ - htab->tls_ldm_got.offset = htab->sgot->_raw_size; - htab->sgot->_raw_size += 8; - htab->srelgot->_raw_size += sizeof (Elf32_External_Rel); + htab->tls_ldm_got.offset = htab->sgot->size; + htab->sgot->size += 8; + htab->srelgot->size += sizeof (Elf32_External_Rel); } else htab->tls_ldm_got.offset = -1; @@ -1820,24 +2020,41 @@ elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, sym dynamic relocs. */ elf_link_hash_traverse (&htab->elf, allocate_dynrelocs, (PTR) info); + /* For every jump slot reserved in the sgotplt, reloc_count is + incremented. However, when we reserve space for TLS descriptors, + it's not incremented, so in order to compute the space reserved + for them, it suffices to multiply the reloc count by the jump + slot size. */ + if (htab->srelplt) + htab->sgotplt_jump_table_size = htab->next_tls_desc_index * 4; + /* We now have determined the sizes of the various dynamic sections. Allocate memory for them. */ relocs = FALSE; for (s = dynobj->sections; s != NULL; s = s->next) { + bfd_boolean strip_section = TRUE; + if ((s->flags & SEC_LINKER_CREATED) == 0) continue; if (s == htab->splt || s == htab->sgot - || s == htab->sgotplt) + || s == htab->sgotplt + || s == htab->sdynbss) { /* Strip this section if we don't need it; see the comment below. */ + /* We'd like to strip these sections if they aren't needed, but if + we've exported dynamic symbols from them we must leave them. + It's too late to tell BFD to get rid of the symbols. */ + + if (htab->elf.hplt != NULL) + strip_section = FALSE; } else if (strncmp (bfd_get_section_name (dynobj, s), ".rel", 4) == 0) { - if (s->_raw_size != 0 && s != htab->srelplt) + if (s->size != 0 && s != htab->srelplt && s != htab->srelplt2) relocs = TRUE; /* We use the reloc_count field as a counter if we need @@ -1850,7 +2067,7 @@ elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, continue; } - if (s->_raw_size == 0) + if (s->size == 0) { /* If we don't need this section, strip it from the output file. This is mostly to handle .rel.bss and @@ -1861,17 +2078,20 @@ elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, adjust_dynamic_symbol is called, and it is that function which decides whether anything needs to go into these sections. */ - - _bfd_strip_section_from_output (info, s); + if (strip_section) + s->flags |= SEC_EXCLUDE; continue; } + if ((s->flags & SEC_HAS_CONTENTS) == 0) + continue; + /* Allocate memory for the section contents. We use bfd_zalloc here in case unused entries are not reclaimed before the section's contents are written out. This should not happen, but this way if it does, we get a R_386_NONE reloc instead of garbage. */ - s->contents = bfd_zalloc (dynobj, s->_raw_size); + s->contents = bfd_zalloc (dynobj, s->size); if (s->contents == NULL) return FALSE; } @@ -1892,7 +2112,7 @@ elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, return FALSE; } - if (htab->splt->_raw_size != 0) + if (htab->splt->size != 0) { if (!add_dynamic_entry (DT_PLTGOT, 0) || !add_dynamic_entry (DT_PLTRELSZ, 0) @@ -1926,6 +2146,41 @@ elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, return TRUE; } +static bfd_boolean +elf_i386_always_size_sections (bfd *output_bfd, + struct bfd_link_info *info) +{ + asection *tls_sec = elf_hash_table (info)->tls_sec; + + if (tls_sec) + { + struct elf_link_hash_entry *tlsbase; + + tlsbase = elf_link_hash_lookup (elf_hash_table (info), + "_TLS_MODULE_BASE_", + FALSE, FALSE, FALSE); + + if (tlsbase && tlsbase->type == STT_TLS) + { + struct bfd_link_hash_entry *bh = NULL; + const struct elf_backend_data *bed + = get_elf_backend_data (output_bfd); + + if (!(_bfd_generic_link_add_one_symbol + (info, output_bfd, "_TLS_MODULE_BASE_", BSF_LOCAL, + tls_sec, 0, NULL, FALSE, + bed->collect, &bh))) + return FALSE; + tlsbase = (struct elf_link_hash_entry *)bh; + tlsbase->def_regular = 1; + tlsbase->other = STV_HIDDEN; + (*bed->elf_backend_hide_symbol) (info, tlsbase, TRUE); + } + } + + return TRUE; +} + /* Set the correct type for an x86 ELF section. We do this by the section name, which is a hack, but ought to work. */ @@ -2003,6 +2258,7 @@ elf_i386_relocate_section (bfd *output_bfd, Elf_Internal_Shdr *symtab_hdr; struct elf_link_hash_entry **sym_hashes; bfd_vma *local_got_offsets; + bfd_vma *local_tlsdesc_gotents; Elf_Internal_Rela *rel; Elf_Internal_Rela *relend; @@ -2010,6 +2266,7 @@ elf_i386_relocate_section (bfd *output_bfd, symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; sym_hashes = elf_sym_hashes (input_bfd); local_got_offsets = elf_local_got_offsets (input_bfd); + local_tlsdesc_gotents = elf_i386_local_tlsdesc_gotent (input_bfd); rel = relocs; relend = relocs + input_section->reloc_count; @@ -2021,7 +2278,7 @@ elf_i386_relocate_section (bfd *output_bfd, struct elf_link_hash_entry *h; Elf_Internal_Sym *sym; asection *sec; - bfd_vma off; + bfd_vma off, offplt; bfd_vma relocation; bfd_boolean unresolved_reloc; bfd_reloc_status_type r; @@ -2039,6 +2296,9 @@ elf_i386_relocate_section (bfd *output_bfd, && ((indx = r_type - R_386_tls_offset) - R_386_ext >= R_386_tls - R_386_ext)) { + (*_bfd_error_handler) + (_("%B: unrecognized relocation (0x%x) in section `%A'"), + input_bfd, input_section, r_type); bfd_set_error (bfd_error_bad_value); return FALSE; } @@ -2174,6 +2434,21 @@ elf_i386_relocate_section (bfd *output_bfd, unresolved_reloc, warned); } + if (r_symndx == 0) + { + /* r_symndx will be zero only for relocs against symbols from + removed linkonce sections, or sections discarded by a linker + script. For these relocs, we just want the section contents + zeroed. Avoid any special processing in the switch below. */ + r_type = R_386_NONE; + + relocation = 0; + if (howto->pc_relative) + relocation = (input_section->output_section->vma + + input_section->output_offset + + rel->r_offset); + } + switch (r_type) { case R_386_GOT32: @@ -2261,24 +2536,46 @@ elf_i386_relocate_section (bfd *output_bfd, if (off >= (bfd_vma) -2) abort (); - relocation = htab->sgot->output_offset + off; + relocation = htab->sgot->output_section->vma + + htab->sgot->output_offset + off + - htab->sgotplt->output_section->vma + - htab->sgotplt->output_offset; break; case R_386_GOTOFF: /* Relocation is relative to the start of the global offset table. */ - /* Note that sgot->output_offset is not involved in this - calculation. We always want the start of .got. If we - defined _GLOBAL_OFFSET_TABLE in a different way, as is + /* Check to make sure it isn't a protected function symbol + for shared library since it may not be local when used + as function address. */ + if (info->shared + && !info->executable + && h + && h->def_regular + && h->type == STT_FUNC + && ELF_ST_VISIBILITY (h->other) == STV_PROTECTED) + { + (*_bfd_error_handler) + (_("%B: relocation R_386_GOTOFF against protected function `%s' can not be used when making a shared object"), + input_bfd, h->root.root.string); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + + /* Note that sgot is not involved in this + calculation. We always want the start of .got.plt. If we + defined _GLOBAL_OFFSET_TABLE_ in a different way, as is permitted by the ABI, we might have to change this calculation. */ - relocation -= htab->sgot->output_section->vma; + relocation -= htab->sgotplt->output_section->vma + + htab->sgotplt->output_offset; break; case R_386_GOTPC: /* Use global offset table as symbol value. */ - relocation = htab->sgot->output_section->vma; + relocation = htab->sgotplt->output_section->vma + + htab->sgotplt->output_offset; unresolved_reloc = FALSE; break; @@ -2308,11 +2605,7 @@ elf_i386_relocate_section (bfd *output_bfd, case R_386_32: case R_386_PC32: - /* r_symndx will be zero only for relocs against symbols - from removed linkonce sections, or sections discarded by - a linker script. */ - if (r_symndx == 0 - || (input_section->flags & SEC_ALLOC) == 0) + if ((input_section->flags & SEC_ALLOC) == 0) break; if ((info->shared @@ -2325,11 +2618,9 @@ elf_i386_relocate_section (bfd *output_bfd, && !info->shared && h != NULL && h->dynindx != -1 - && (h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0 - && (((h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - && (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0) + && !h->non_got_ref + && ((h->def_dynamic + && !h->def_regular) || h->root.type == bfd_link_hash_undefweak || h->root.type == bfd_link_hash_undefined))) { @@ -2362,8 +2653,7 @@ elf_i386_relocate_section (bfd *output_bfd, && (r_type == R_386_PC32 || !info->shared || !info->symbolic - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0)) + || !h->def_regular)) outrel.r_info = ELF32_R_INFO (h->dynindx, r_type); else { @@ -2410,6 +2700,8 @@ elf_i386_relocate_section (bfd *output_bfd, /* Fall through */ case R_386_TLS_GD: + case R_386_TLS_GOTDESC: + case R_386_TLS_DESC_CALL: case R_386_TLS_IE_32: case R_386_TLS_GOTIE: r_type = elf_i386_tls_transition (info, r_type, h == NULL); @@ -2419,12 +2711,21 @@ elf_i386_relocate_section (bfd *output_bfd, else if (h != NULL) { tls_type = elf_i386_hash_entry(h)->tls_type; + /* If we have both R_386_TLS_IE and R_386_TLS_GD, + GOT_TLS_IE_BOTH should be used. */ + if ((tls_type & GOT_TLS_IE_MASK) + == (GOT_TLS_IE_IE | GOT_TLS_IE_GD)) + tls_type = GOT_TLS_IE_BOTH; + else + tls_type &= GOT_TLS_MASK; if (!info->shared && h->dynindx == -1 && (tls_type & GOT_TLS_IE)) r_type = R_386_TLS_LE_32; } if (tls_type == GOT_TLS_IE) tls_type = GOT_TLS_IE_NEG; - if (r_type == R_386_TLS_GD) + if (r_type == R_386_TLS_GD + || r_type == R_386_TLS_GOTDESC + || r_type == R_386_TLS_DESC_CALL) { if (tls_type == GOT_TLS_IE_POS) r_type = R_386_TLS_GOTIE; @@ -2444,7 +2745,7 @@ elf_i386_relocate_section (bfd *output_bfd, BFD_ASSERT (rel->r_offset >= 2); type = bfd_get_8 (input_bfd, contents + rel->r_offset - 2); BFD_ASSERT (type == 0x8d || type == 0x04); - BFD_ASSERT (rel->r_offset + 9 <= input_section->_raw_size); + BFD_ASSERT (rel->r_offset + 9 <= input_section->size); BFD_ASSERT (bfd_get_8 (input_bfd, contents + rel->r_offset + 4) == 0xe8); @@ -2470,7 +2771,7 @@ elf_i386_relocate_section (bfd *output_bfd, else { BFD_ASSERT ((val & 0xf8) == 0x80 && (val & 7) != 4); - if (rel->r_offset + 10 <= input_section->_raw_size + if (rel->r_offset + 10 <= input_section->size && bfd_get_8 (input_bfd, contents + rel->r_offset + 9) == 0x90) { @@ -2498,6 +2799,63 @@ elf_i386_relocate_section (bfd *output_bfd, rel++; continue; } + else if (ELF32_R_TYPE (rel->r_info) == R_386_TLS_GOTDESC) + { + /* GDesc -> LE transition. + It's originally something like: + leal x@tlsdesc(%ebx), %eax + + leal x@ntpoff, %eax + + Registers other than %eax may be set up here. */ + + unsigned int val, type; + bfd_vma roff; + + /* First, make sure it's a leal adding ebx to a + 32-bit offset into any register, although it's + probably almost always going to be eax. */ + roff = rel->r_offset; + BFD_ASSERT (roff >= 2); + type = bfd_get_8 (input_bfd, contents + roff - 2); + BFD_ASSERT (type == 0x8d); + val = bfd_get_8 (input_bfd, contents + roff - 1); + BFD_ASSERT ((val & 0xc7) == 0x83); + BFD_ASSERT (roff + 4 <= input_section->size); + + /* Now modify the instruction as appropriate. */ + /* aoliva FIXME: remove the above and xor the byte + below with 0x86. */ + bfd_put_8 (output_bfd, val ^ 0x86, + contents + roff - 1); + bfd_put_32 (output_bfd, -tpoff (info, relocation), + contents + roff); + continue; + } + else if (ELF32_R_TYPE (rel->r_info) == R_386_TLS_DESC_CALL) + { + /* GDesc -> LE transition. + It's originally: + call *(%eax) + Turn it into: + nop; nop */ + + unsigned int val, type; + bfd_vma roff; + + /* First, make sure it's a call *(%eax). */ + roff = rel->r_offset; + BFD_ASSERT (roff + 2 <= input_section->size); + type = bfd_get_8 (input_bfd, contents + roff); + BFD_ASSERT (type == 0xff); + val = bfd_get_8 (input_bfd, contents + roff + 1); + BFD_ASSERT (val == 0x10); + + /* Now modify the instruction as appropriate. */ + bfd_put_8 (output_bfd, 0x90, contents + roff); + bfd_put_8 (output_bfd, 0x90, contents + roff + 1); + continue; + } else if (ELF32_R_TYPE (rel->r_info) == R_386_TLS_IE) { unsigned int val, type; @@ -2513,7 +2871,7 @@ elf_i386_relocate_section (bfd *output_bfd, addl $foo, %reg. */ BFD_ASSERT (rel->r_offset >= 1); val = bfd_get_8 (input_bfd, contents + rel->r_offset - 1); - BFD_ASSERT (rel->r_offset + 4 <= input_section->_raw_size); + BFD_ASSERT (rel->r_offset + 4 <= input_section->size); if (val == 0xa1) { /* movl foo, %eax. */ @@ -2570,7 +2928,7 @@ elf_i386_relocate_section (bfd *output_bfd, BFD_ASSERT (rel->r_offset >= 2); type = bfd_get_8 (input_bfd, contents + rel->r_offset - 2); val = bfd_get_8 (input_bfd, contents + rel->r_offset - 1); - BFD_ASSERT (rel->r_offset + 4 <= input_section->_raw_size); + BFD_ASSERT (rel->r_offset + 4 <= input_section->size); BFD_ASSERT ((val & 0xc0) == 0x80 && (val & 7) != 4); if (type == 0x8b) { @@ -2612,13 +2970,17 @@ elf_i386_relocate_section (bfd *output_bfd, abort (); if (h != NULL) - off = h->got.offset; + { + off = h->got.offset; + offplt = elf_i386_hash_entry (h)->tlsdesc_got; + } else { if (local_got_offsets == NULL) abort (); off = local_got_offsets[r_symndx]; + offplt = local_tlsdesc_gotents[r_symndx]; } if ((off & 1) != 0) @@ -2628,35 +2990,77 @@ elf_i386_relocate_section (bfd *output_bfd, Elf_Internal_Rela outrel; bfd_byte *loc; int dr_type, indx; + asection *sreloc; if (htab->srelgot == NULL) abort (); + indx = h && h->dynindx != -1 ? h->dynindx : 0; + + if (GOT_TLS_GDESC_P (tls_type)) + { + outrel.r_info = ELF32_R_INFO (indx, R_386_TLS_DESC); + BFD_ASSERT (htab->sgotplt_jump_table_size + offplt + 8 + <= htab->sgotplt->size); + outrel.r_offset = (htab->sgotplt->output_section->vma + + htab->sgotplt->output_offset + + offplt + + htab->sgotplt_jump_table_size); + sreloc = htab->srelplt; + loc = sreloc->contents; + loc += (htab->next_tls_desc_index++ + * sizeof (Elf32_External_Rel)); + BFD_ASSERT (loc + sizeof (Elf32_External_Rel) + <= sreloc->contents + sreloc->size); + bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc); + if (indx == 0) + { + BFD_ASSERT (! unresolved_reloc); + bfd_put_32 (output_bfd, + relocation - dtpoff_base (info), + htab->sgotplt->contents + offplt + + htab->sgotplt_jump_table_size + 4); + } + else + { + bfd_put_32 (output_bfd, 0, + htab->sgotplt->contents + offplt + + htab->sgotplt_jump_table_size + 4); + } + } + + sreloc = htab->srelgot; + outrel.r_offset = (htab->sgot->output_section->vma + htab->sgot->output_offset + off); - indx = h && h->dynindx != -1 ? h->dynindx : 0; - if (r_type == R_386_TLS_GD) + if (GOT_TLS_GD_P (tls_type)) dr_type = R_386_TLS_DTPMOD32; + else if (GOT_TLS_GDESC_P (tls_type)) + goto dr_done; else if (tls_type == GOT_TLS_IE_POS) dr_type = R_386_TLS_TPOFF; else dr_type = R_386_TLS_TPOFF32; + if (dr_type == R_386_TLS_TPOFF && indx == 0) bfd_put_32 (output_bfd, relocation - dtpoff_base (info), htab->sgot->contents + off); else if (dr_type == R_386_TLS_TPOFF32 && indx == 0) bfd_put_32 (output_bfd, dtpoff_base (info) - relocation, htab->sgot->contents + off); - else + else if (dr_type != R_386_TLS_DESC) bfd_put_32 (output_bfd, 0, htab->sgot->contents + off); outrel.r_info = ELF32_R_INFO (indx, dr_type); - loc = htab->srelgot->contents; - loc += htab->srelgot->reloc_count++ * sizeof (Elf32_External_Rel); + + loc = sreloc->contents; + loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rel); + BFD_ASSERT (loc + sizeof (Elf32_External_Rel) + <= sreloc->contents + sreloc->size); bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc); - if (r_type == R_386_TLS_GD) + if (GOT_TLS_GD_P (tls_type)) { if (indx == 0) { @@ -2672,8 +3076,10 @@ elf_i386_relocate_section (bfd *output_bfd, outrel.r_info = ELF32_R_INFO (indx, R_386_TLS_DTPOFF32); outrel.r_offset += 4; - htab->srelgot->reloc_count++; + sreloc->reloc_count++; loc += sizeof (Elf32_External_Rel); + BFD_ASSERT (loc + sizeof (Elf32_External_Rel) + <= sreloc->contents + sreloc->size); bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc); } } @@ -2684,30 +3090,41 @@ elf_i386_relocate_section (bfd *output_bfd, htab->sgot->contents + off + 4); outrel.r_info = ELF32_R_INFO (indx, R_386_TLS_TPOFF); outrel.r_offset += 4; - htab->srelgot->reloc_count++; + sreloc->reloc_count++; loc += sizeof (Elf32_External_Rel); bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc); } + dr_done: if (h != NULL) h->got.offset |= 1; else local_got_offsets[r_symndx] |= 1; } - if (off >= (bfd_vma) -2) + if (off >= (bfd_vma) -2 + && ! GOT_TLS_GDESC_P (tls_type)) abort (); - if (r_type == ELF32_R_TYPE (rel->r_info)) + if (r_type == R_386_TLS_GOTDESC + || r_type == R_386_TLS_DESC_CALL) { - relocation = htab->sgot->output_offset + off; + relocation = htab->sgotplt_jump_table_size + offplt; + unresolved_reloc = FALSE; + } + else if (r_type == ELF32_R_TYPE (rel->r_info)) + { + bfd_vma g_o_t = htab->sgotplt->output_section->vma + + htab->sgotplt->output_offset; + relocation = htab->sgot->output_section->vma + + htab->sgot->output_offset + off - g_o_t; if ((r_type == R_386_TLS_IE || r_type == R_386_TLS_GOTIE) && tls_type == GOT_TLS_IE_BOTH) relocation += 4; if (r_type == R_386_TLS_IE) - relocation += htab->sgot->output_section->vma; + relocation += g_o_t; unresolved_reloc = FALSE; } - else + else if (ELF32_R_TYPE (rel->r_info) == R_386_TLS_GD) { unsigned int val, type; bfd_vma roff; @@ -2716,7 +3133,7 @@ elf_i386_relocate_section (bfd *output_bfd, BFD_ASSERT (rel->r_offset >= 2); type = bfd_get_8 (input_bfd, contents + rel->r_offset - 2); BFD_ASSERT (type == 0x8d || type == 0x04); - BFD_ASSERT (rel->r_offset + 9 <= input_section->_raw_size); + BFD_ASSERT (rel->r_offset + 9 <= input_section->size); BFD_ASSERT (bfd_get_8 (input_bfd, contents + rel->r_offset + 4) == 0xe8); BFD_ASSERT (rel + 1 < relend); @@ -2740,7 +3157,7 @@ elf_i386_relocate_section (bfd *output_bfd, /* leal foo(%reg), %eax; call ___tls_get_addr; nop Change it into: movl %gs:0, %eax; subl $foo@gottpoff(%reg), %eax. */ - BFD_ASSERT (rel->r_offset + 10 <= input_section->_raw_size); + BFD_ASSERT (rel->r_offset + 10 <= input_section->size); BFD_ASSERT ((val & 0xf8) == 0x80 && (val & 7) != 4); BFD_ASSERT (bfd_get_8 (input_bfd, contents + rel->r_offset + 9) @@ -2761,12 +3178,104 @@ elf_i386_relocate_section (bfd *output_bfd, if (tls_type == GOT_TLS_IE_BOTH) off += 4; } - bfd_put_32 (output_bfd, htab->sgot->output_offset + off, + bfd_put_32 (output_bfd, + htab->sgot->output_section->vma + + htab->sgot->output_offset + off + - htab->sgotplt->output_section->vma + - htab->sgotplt->output_offset, contents + roff + 8); /* Skip R_386_PLT32. */ rel++; continue; } + else if (ELF32_R_TYPE (rel->r_info) == R_386_TLS_GOTDESC) + { + /* GDesc -> IE transition. + It's originally something like: + leal x@tlsdesc(%ebx), %eax + + Change it to: + movl x@gotntpoff(%ebx), %eax # before nop; nop + or: + movl x@gottpoff(%ebx), %eax # before negl %eax + + Registers other than %eax may be set up here. */ + + unsigned int val, type; + bfd_vma roff; + + /* First, make sure it's a leal adding ebx to a 32-bit + offset into any register, although it's probably + almost always going to be eax. */ + roff = rel->r_offset; + BFD_ASSERT (roff >= 2); + type = bfd_get_8 (input_bfd, contents + roff - 2); + BFD_ASSERT (type == 0x8d); + val = bfd_get_8 (input_bfd, contents + roff - 1); + BFD_ASSERT ((val & 0xc7) == 0x83); + BFD_ASSERT (roff + 4 <= input_section->size); + + /* Now modify the instruction as appropriate. */ + /* To turn a leal into a movl in the form we use it, it + suffices to change the first byte from 0x8d to 0x8b. + aoliva FIXME: should we decide to keep the leal, all + we have to do is remove the statement below, and + adjust the relaxation of R_386_TLS_DESC_CALL. */ + bfd_put_8 (output_bfd, 0x8b, contents + roff - 2); + + if (tls_type == GOT_TLS_IE_BOTH) + off += 4; + + bfd_put_32 (output_bfd, + htab->sgot->output_section->vma + + htab->sgot->output_offset + off + - htab->sgotplt->output_section->vma + - htab->sgotplt->output_offset, + contents + roff); + continue; + } + else if (ELF32_R_TYPE (rel->r_info) == R_386_TLS_DESC_CALL) + { + /* GDesc -> IE transition. + It's originally: + call *(%eax) + + Change it to: + nop; nop + or + negl %eax + depending on how we transformed the TLS_GOTDESC above. + */ + + unsigned int val, type; + bfd_vma roff; + + /* First, make sure it's a call *(%eax). */ + roff = rel->r_offset; + BFD_ASSERT (roff + 2 <= input_section->size); + type = bfd_get_8 (input_bfd, contents + roff); + BFD_ASSERT (type == 0xff); + val = bfd_get_8 (input_bfd, contents + roff + 1); + BFD_ASSERT (val == 0x10); + + /* Now modify the instruction as appropriate. */ + if (tls_type != GOT_TLS_IE_NEG) + { + /* nop; nop */ + bfd_put_8 (output_bfd, 0x90, contents + roff); + bfd_put_8 (output_bfd, 0x90, contents + roff + 1); + } + else + { + /* negl %eax */ + bfd_put_8 (output_bfd, 0xf7, contents + roff); + bfd_put_8 (output_bfd, 0xd8, contents + roff + 1); + } + + continue; + } + else + BFD_ASSERT (FALSE); break; case R_386_TLS_LDM: @@ -2784,7 +3293,7 @@ elf_i386_relocate_section (bfd *output_bfd, == 0x8d); val = bfd_get_8 (input_bfd, contents + rel->r_offset - 1); BFD_ASSERT ((val & 0xf8) == 0x80 && (val & 7) != 4); - BFD_ASSERT (rel->r_offset + 9 <= input_section->_raw_size); + BFD_ASSERT (rel->r_offset + 9 <= input_section->size); BFD_ASSERT (bfd_get_8 (input_bfd, contents + rel->r_offset + 4) == 0xe8); BFD_ASSERT (rel + 1 < relend); @@ -2823,7 +3332,10 @@ elf_i386_relocate_section (bfd *output_bfd, bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc); htab->tls_ldm_got.offset |= 1; } - relocation = htab->sgot->output_offset + off; + relocation = htab->sgot->output_section->vma + + htab->sgot->output_offset + off + - htab->sgotplt->output_section->vma + - htab->sgotplt->output_offset; unresolved_reloc = FALSE; break; @@ -2883,13 +3395,14 @@ elf_i386_relocate_section (bfd *output_bfd, not process them. */ if (unresolved_reloc && !((input_section->flags & SEC_DEBUGGING) != 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0)) + && h->def_dynamic)) { (*_bfd_error_handler) - (_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"), - bfd_archive_filename (input_bfd), - bfd_get_section_name (input_bfd, input_section), + (_("%B(%A+0x%lx): unresolvable %s relocation against symbol `%s'"), + input_bfd, + input_section, (long) rel->r_offset, + howto->name, h->root.root.string); return FALSE; } @@ -2918,16 +3431,16 @@ elf_i386_relocate_section (bfd *output_bfd, if (r == bfd_reloc_overflow) { if (! ((*info->callbacks->reloc_overflow) - (info, name, howto->name, 0, - input_bfd, input_section, rel->r_offset))) + (info, (h ? &h->root : NULL), name, howto->name, + (bfd_vma) 0, input_bfd, input_section, + rel->r_offset))) return FALSE; } else { (*_bfd_error_handler) - (_("%s(%s+0x%lx): reloc against `%s': error %d"), - bfd_archive_filename (input_bfd), - bfd_get_section_name (input_bfd, input_section), + (_("%B(%A+0x%lx): reloc against `%s': error %d"), + input_bfd, input_section, (long) rel->r_offset, name, (int) r); return FALSE; } @@ -2987,6 +3500,42 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd, + htab->sgotplt->output_offset + got_offset), htab->splt->contents + h->plt.offset + 2); + + if (htab->is_vxworks) + { + int s, k, reloc_index; + + /* Create the R_386_32 relocation referencing the GOT + for this PLT entry. */ + + /* S: Current slot number (zero-based). */ + s = (h->plt.offset - PLT_ENTRY_SIZE) / PLT_ENTRY_SIZE; + /* K: Number of relocations for PLTResolve. */ + if (info->shared) + k = PLTRESOLVE_RELOCS_SHLIB; + else + k = PLTRESOLVE_RELOCS; + /* Skip the PLTresolve relocations, and the relocations for + the other PLT slots. */ + reloc_index = k + s * PLT_NON_JUMP_SLOT_RELOCS; + loc = (htab->srelplt2->contents + reloc_index + * sizeof (Elf32_External_Rel)); + + rel.r_offset = (htab->splt->output_section->vma + + htab->splt->output_offset + + h->plt.offset + 2), + rel.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_386_32); + bfd_elf32_swap_reloc_out (output_bfd, &rel, loc); + + /* Create the R_386_32 relocation referencing the beginning of + the PLT for this GOT entry. */ + rel.r_offset = (htab->sgotplt->output_section->vma + + htab->sgotplt->output_offset + + got_offset); + rel.r_info = ELF32_R_INFO (htab->elf.hplt->indx, R_386_32); + bfd_elf32_swap_reloc_out (output_bfd, &rel, + loc + sizeof (Elf32_External_Rel)); + } } else { @@ -3017,7 +3566,7 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd, loc = htab->srelplt->contents + plt_index * sizeof (Elf32_External_Rel); bfd_elf32_swap_reloc_out (output_bfd, &rel, loc); - if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + if (!h->def_regular) { /* Mark the symbol as undefined, rather than as defined in the .plt section. Leave the value if there were any @@ -3028,13 +3577,13 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd, called from a binary, there is no need to slow down shared libraries because of that. */ sym->st_shndx = SHN_UNDEF; - if ((h->elf_link_hash_flags & ELF_LINK_POINTER_EQUALITY_NEEDED) == 0) + if (!h->pointer_equality_needed) sym->st_value = 0; } } if (h->got.offset != (bfd_vma) -1 - && elf_i386_hash_entry(h)->tls_type != GOT_TLS_GD + && ! GOT_TLS_GD_ANY_P (elf_i386_hash_entry(h)->tls_type) && (elf_i386_hash_entry(h)->tls_type & GOT_TLS_IE) == 0) { Elf_Internal_Rela rel; @@ -3074,7 +3623,7 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd, bfd_elf32_swap_reloc_out (output_bfd, &rel, loc); } - if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0) + if (h->needs_copy) { Elf_Internal_Rela rel; bfd_byte *loc; @@ -3096,9 +3645,11 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd, bfd_elf32_swap_reloc_out (output_bfd, &rel, loc); } - /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */ + /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. + On VxWorks, the _GLOBAL_OFFSET_TABLE_ symbol is not absolute: it + is relative to the ".got" section. */ if (strcmp (h->root.root.string, "_DYNAMIC") == 0 - || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0) + || (!htab->is_vxworks && h == htab->elf.hgot)) sym->st_shndx = SHN_ABS; return TRUE; @@ -3145,7 +3696,7 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd, abort (); dyncon = (Elf32_External_Dyn *) sdyn->contents; - dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->_raw_size); + dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->size); for (; dyncon < dynconend; dyncon++) { Elf_Internal_Dyn dyn; @@ -3159,7 +3710,8 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd, continue; case DT_PLTGOT: - dyn.d_un.d_ptr = htab->sgot->output_section->vma; + s = htab->sgotplt; + dyn.d_un.d_ptr = s->output_section->vma + s->output_offset; break; case DT_JMPREL: @@ -3169,7 +3721,7 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd, case DT_PLTRELSZ: s = htab->srelplt; - dyn.d_un.d_val = s->_raw_size; + dyn.d_un.d_val = s->size; break; case DT_RELSZ: @@ -3182,7 +3734,7 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd, s = htab->srelplt; if (s == NULL) continue; - dyn.d_un.d_val -= s->_raw_size; + dyn.d_un.d_val -= s->size; break; case DT_REL: @@ -3194,7 +3746,7 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd, continue; if (dyn.d_un.d_ptr != s->output_section->vma + s->output_offset) continue; - dyn.d_un.d_ptr += s->_raw_size; + dyn.d_un.d_ptr += s->size; break; } @@ -3202,15 +3754,23 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd, } /* Fill in the first entry in the procedure linkage table. */ - if (htab->splt && htab->splt->_raw_size > 0) + if (htab->splt && htab->splt->size > 0) { if (info->shared) - memcpy (htab->splt->contents, - elf_i386_pic_plt0_entry, PLT_ENTRY_SIZE); + { + memcpy (htab->splt->contents, elf_i386_pic_plt0_entry, + sizeof (elf_i386_pic_plt0_entry)); + memset (htab->splt->contents + sizeof (elf_i386_pic_plt0_entry), + htab->plt0_pad_byte, + PLT_ENTRY_SIZE - sizeof (elf_i386_pic_plt0_entry)); + } else { - memcpy (htab->splt->contents, - elf_i386_plt0_entry, PLT_ENTRY_SIZE); + memcpy (htab->splt->contents, elf_i386_plt0_entry, + sizeof(elf_i386_plt0_entry)); + memset (htab->splt->contents + sizeof (elf_i386_plt0_entry), + htab->plt0_pad_byte, + PLT_ENTRY_SIZE - sizeof (elf_i386_plt0_entry)); bfd_put_32 (output_bfd, (htab->sgotplt->output_section->vma + htab->sgotplt->output_offset @@ -3221,19 +3781,69 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd, + htab->sgotplt->output_offset + 8), htab->splt->contents + 8); + + if (htab->is_vxworks) + { + Elf_Internal_Rela rel; + + /* Generate a relocation for _GLOBAL_OFFSET_TABLE_ + 4. + On IA32 we use REL relocations so the addend goes in + the PLT directly. */ + rel.r_offset = (htab->splt->output_section->vma + + htab->splt->output_offset + + 2); + rel.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_386_32); + bfd_elf32_swap_reloc_out (output_bfd, &rel, + htab->srelplt2->contents); + /* Generate a relocation for _GLOBAL_OFFSET_TABLE_ + 8. */ + rel.r_offset = (htab->splt->output_section->vma + + htab->splt->output_offset + + 8); + rel.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_386_32); + bfd_elf32_swap_reloc_out (output_bfd, &rel, + htab->srelplt2->contents + + sizeof (Elf32_External_Rel)); + } } /* UnixWare sets the entsize of .plt to 4, although that doesn't really seem like the right value. */ elf_section_data (htab->splt->output_section) ->this_hdr.sh_entsize = 4; + + /* Correct the .rel.plt.unloaded relocations. */ + if (htab->is_vxworks && !info->shared) + { + int num_plts = (htab->splt->size / PLT_ENTRY_SIZE) - 1; + unsigned char *p; + + p = htab->srelplt2->contents; + if (info->shared) + p += PLTRESOLVE_RELOCS_SHLIB * sizeof (Elf32_External_Rel); + else + p += PLTRESOLVE_RELOCS * sizeof (Elf32_External_Rel); + + for (; num_plts; num_plts--) + { + Elf_Internal_Rela rel; + bfd_elf32_swap_reloc_in (output_bfd, p, &rel); + rel.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_386_32); + bfd_elf32_swap_reloc_out (output_bfd, &rel, p); + p += sizeof (Elf32_External_Rel); + + bfd_elf32_swap_reloc_in (output_bfd, p, &rel); + rel.r_info = ELF32_R_INFO (htab->elf.hplt->indx, R_386_32); + bfd_elf32_swap_reloc_out (output_bfd, &rel, p); + p += sizeof (Elf32_External_Rel); + } + } } } if (htab->sgotplt) { /* Fill in the first three entries in the global offset table. */ - if (htab->sgotplt->_raw_size > 0) + if (htab->sgotplt->size > 0) { bfd_put_32 (output_bfd, (sdyn == NULL ? 0 @@ -3245,9 +3855,24 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd, elf_section_data (htab->sgotplt->output_section)->this_hdr.sh_entsize = 4; } + + if (htab->sgot && htab->sgot->size > 0) + elf_section_data (htab->sgot->output_section)->this_hdr.sh_entsize = 4; + return TRUE; } +/* Return address for Ith PLT stub in section PLT, for relocation REL + or (bfd_vma) -1 if it should not be included. */ + +static bfd_vma +elf_i386_plt_sym_val (bfd_vma i, const asection *plt, + const arelent *rel ATTRIBUTE_UNUSED) +{ + return plt->vma + (i + 1) * PLT_ENTRY_SIZE; +} + + #define TARGET_LITTLE_SYM bfd_elf32_i386_vec #define TARGET_LITTLE_NAME "elf32-i386" #define ELF_ARCH bfd_arch_i386 @@ -3285,6 +3910,8 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd, #define elf_backend_reloc_type_class elf_i386_reloc_type_class #define elf_backend_relocate_section elf_i386_relocate_section #define elf_backend_size_dynamic_sections elf_i386_size_dynamic_sections +#define elf_backend_always_size_sections elf_i386_always_size_sections +#define elf_backend_plt_sym_val elf_i386_plt_sym_val #include "elf32-target.h" @@ -3321,3 +3948,57 @@ elf_i386_post_process_headers (bfd *abfd, #define elf32_bed elf32_i386_fbsd_bed #include "elf32-target.h" + +/* VxWorks support. */ + +#undef TARGET_LITTLE_SYM +#define TARGET_LITTLE_SYM bfd_elf32_i386_vxworks_vec +#undef TARGET_LITTLE_NAME +#define TARGET_LITTLE_NAME "elf32-i386-vxworks" + + +/* Like elf_i386_link_hash_table_create but with tweaks for VxWorks. */ + +static struct bfd_link_hash_table * +elf_i386_vxworks_link_hash_table_create (bfd *abfd) +{ + struct bfd_link_hash_table *ret; + struct elf_i386_link_hash_table *htab; + + ret = elf_i386_link_hash_table_create (abfd); + if (ret) + { + htab = (struct elf_i386_link_hash_table *) ret; + htab->is_vxworks = 1; + htab->plt0_pad_byte = 0x90; + } + + return ret; +} + + +#undef elf_backend_post_process_headers +#undef bfd_elf32_bfd_link_hash_table_create +#define bfd_elf32_bfd_link_hash_table_create \ + elf_i386_vxworks_link_hash_table_create +#undef elf_backend_add_symbol_hook +#define elf_backend_add_symbol_hook \ + elf_vxworks_add_symbol_hook +#undef elf_backend_link_output_symbol_hook +#define elf_backend_link_output_symbol_hook \ + elf_vxworks_link_output_symbol_hook +#undef elf_backend_emit_relocs +#define elf_backend_emit_relocs elf_vxworks_emit_relocs +#undef elf_backend_final_write_processing +#define elf_backend_final_write_processing \ + elf_vxworks_final_write_processing + +/* On VxWorks, we emit relocations against _PROCEDURE_LINKAGE_TABLE_, so + define it. */ +#undef elf_backend_want_plt_sym +#define elf_backend_want_plt_sym 1 + +#undef elf32_bed +#define elf32_bed elf32_i386_vxworks_bed + +#include "elf32-target.h" diff --git a/contrib/binutils/bfd/elf32-mips.c b/contrib/binutils/bfd/elf32-mips.c index a0480f09700..6ed4ad35f62 100644 --- a/contrib/binutils/bfd/elf32-mips.c +++ b/contrib/binutils/bfd/elf32-mips.c @@ -1,6 +1,6 @@ /* MIPS-specific support for 32-bit ELF Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003 Free Software Foundation, Inc. + 2003, 2004, 2005 Free Software Foundation, Inc. Most of the information added by Ian Lance Taylor, Cygnus Support, . @@ -23,7 +23,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* This file handles MIPS ELF targets. SGI Irix 5 uses a slightly different MIPS ELF from other targets. This matters when linking. @@ -37,6 +37,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "elf-bfd.h" #include "elfxx-mips.h" #include "elf/mips.h" +#include "elf-vxworks.h" /* Get the ECOFF swapping routines. */ #include "coff/sym.h" @@ -257,9 +258,11 @@ static reloc_howto_type elf_mips_howto_table_rel[] = 0x0000ffff, /* dst_mask */ FALSE), /* pcrel_offset */ - /* 16 bit PC relative reference. */ + /* 16 bit PC relative reference. Note that the ABI document has a typo + and claims R_MIPS_PC16 to be not rightshifted, rendering it useless. + We do the right thing here. */ HOWTO (R_MIPS_PC16, /* type */ - 0, /* rightshift */ + 2, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 16, /* bitsize */ TRUE, /* pc_relative */ @@ -545,6 +548,160 @@ static reloc_howto_type elf_mips_howto_table_rel[] = 0x00000000, /* src_mask */ 0x00000000, /* dst_mask */ FALSE), /* pcrel_offset */ + + /* TLS GD/LD dynamic relocations. */ + HOWTO (R_MIPS_TLS_DTPMOD32, /* 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_mips_elf_generic_reloc, /* special_function */ + "R_MIPS_TLS_DTPMOD32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_MIPS_TLS_DTPREL32, /* 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_mips_elf_generic_reloc, /* special_function */ + "R_MIPS_TLS_DTPREL32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + EMPTY_HOWTO (R_MIPS_TLS_DTPMOD64), + EMPTY_HOWTO (R_MIPS_TLS_DTPREL64), + + /* TLS general dynamic variable reference. */ + HOWTO (R_MIPS_TLS_GD, /* 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_generic_reloc, /* special_function */ + "R_MIPS_TLS_GD", /* name */ + TRUE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* TLS local dynamic variable reference. */ + HOWTO (R_MIPS_TLS_LDM, /* 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_generic_reloc, /* special_function */ + "R_MIPS_TLS_LDM", /* name */ + TRUE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* TLS local dynamic offset. */ + HOWTO (R_MIPS_TLS_DTPREL_HI16, /* 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_generic_reloc, /* special_function */ + "R_MIPS_TLS_DTPREL_HI16", /* name */ + TRUE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* TLS local dynamic offset. */ + HOWTO (R_MIPS_TLS_DTPREL_LO16, /* 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_generic_reloc, /* special_function */ + "R_MIPS_TLS_DTPREL_LO16", /* name */ + TRUE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* TLS thread pointer offset. */ + HOWTO (R_MIPS_TLS_GOTTPREL, /* 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_generic_reloc, /* special_function */ + "R_MIPS_TLS_GOTTPREL", /* name */ + TRUE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* TLS IE dynamic relocations. */ + HOWTO (R_MIPS_TLS_TPREL32, /* 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_mips_elf_generic_reloc, /* special_function */ + "R_MIPS_TLS_TPREL32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + EMPTY_HOWTO (R_MIPS_TLS_TPREL64), + + /* TLS thread pointer offset. */ + HOWTO (R_MIPS_TLS_TPREL_HI16, /* 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_generic_reloc, /* special_function */ + "R_MIPS_TLS_TPREL_HI16", /* name */ + TRUE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* TLS thread pointer offset. */ + HOWTO (R_MIPS_TLS_TPREL_LO16, /* 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_generic_reloc, /* special_function */ + "R_MIPS_TLS_TPREL_LO16", /* name */ + TRUE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ }; /* The reloc used for BFD_RELOC_CTOR when doing a 64 bit link. This @@ -564,8 +721,9 @@ static reloc_howto_type elf_mips_ctor64_howto = 0xffffffff, /* dst_mask */ FALSE); /* pcrel_offset */ -/* The reloc used for the mips16 jump instruction. */ -static reloc_howto_type elf_mips16_jump_howto = +static reloc_howto_type elf_mips16_howto_table_rel[] = +{ + /* The reloc used for the mips16 jump instruction. */ HOWTO (R_MIPS16_26, /* type */ 2, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ @@ -581,10 +739,9 @@ static reloc_howto_type elf_mips16_jump_howto = TRUE, /* partial_inplace */ 0x3ffffff, /* src_mask */ 0x3ffffff, /* dst_mask */ - FALSE); /* pcrel_offset */ + FALSE), /* pcrel_offset */ -/* The reloc used for the mips16 gprel instruction. */ -static reloc_howto_type elf_mips16_gprel_howto = + /* The reloc used for the mips16 gprel instruction. */ HOWTO (R_MIPS16_GPREL, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ @@ -595,42 +752,46 @@ static reloc_howto_type elf_mips16_gprel_howto = mips16_gprel_reloc, /* special_function */ "R_MIPS16_GPREL", /* name */ TRUE, /* partial_inplace */ - 0x07ff001f, /* src_mask */ - 0x07ff001f, /* dst_mask */ - FALSE); /* pcrel_offset */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* 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 */ + /* A placeholder for MIPS16 reference to global offset table. */ + EMPTY_HOWTO (R_MIPS16_GOT16), + + /* A placeholder for MIPS16 16 bit call through global offset table. */ + EMPTY_HOWTO (R_MIPS16_CALL16), + + /* MIPS16 high 16 bits of symbol value. */ + HOWTO (R_MIPS16_HI16, /* type */ 16, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 16, /* bitsize */ - TRUE, /* pc_relative */ + FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ _bfd_mips_elf_hi16_reloc, /* special_function */ - "R_MIPS_GNU_REL_HI16", /* name */ + "R_MIPS16_HI16", /* name */ TRUE, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - TRUE); /* pcrel_offset */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* 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 */ + /* MIPS16 low 16 bits of symbol value. */ + HOWTO (R_MIPS16_LO16, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 16, /* bitsize */ - TRUE, /* pc_relative */ + FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ _bfd_mips_elf_lo16_reloc, /* special_function */ - "R_MIPS_GNU_REL_LO16", /* name */ + "R_MIPS16_LO16", /* name */ TRUE, /* partial_inplace */ - 0xffff, /* src_mask */ - 0xffff, /* dst_mask */ - TRUE); /* pcrel_offset */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ +}; /* 16 bit offset for pc-relative branches. */ static reloc_howto_type elf_mips_gnu_rel16_s2 = @@ -648,23 +809,10 @@ static reloc_howto_type elf_mips_gnu_rel16_s2 = 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_mips_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. */ +/* 32 bit pc-relative. This was a GNU extension used by embedded-PIC. + It was co-opted by mips-linux for exception-handling data. It is no + longer used, but should continue to be supported by the linker for + backward compatibility. (GCC stopped using it in May, 2004.) */ static reloc_howto_type elf_mips_gnu_pcrel32 = HOWTO (R_MIPS_PC32, /* type */ 0, /* rightshift */ @@ -816,6 +964,17 @@ _bfd_mips_elf32_gprel16_reloc (bfd *abfd, arelent *reloc_entry, bfd_reloc_status_type ret; bfd_vma gp; + /* R_MIPS_LITERAL relocations are defined for local symbols only. */ + if (reloc_entry->howto->type == R_MIPS_LITERAL + && output_bfd != NULL + && (symbol->flags & BSF_SECTION_SYM) == 0 + && (symbol->flags & BSF_LOCAL) != 0) + { + *error_message = (char *) + _("literal relocation occurs for an external symbol"); + return bfd_reloc_outofrange; + } + if (output_bfd != NULL) relocatable = TRUE; else @@ -846,6 +1005,16 @@ mips_elf_gprel32_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, bfd_reloc_status_type ret; bfd_vma gp; + /* R_MIPS_GPREL32 relocations are defined for local symbols only. */ + if (output_bfd != NULL + && (symbol->flags & BSF_SECTION_SYM) == 0 + && (symbol->flags & BSF_LOCAL) != 0) + { + *error_message = (char *) + _("32bits gp relative relocation occurs for an external symbol"); + return bfd_reloc_outofrange; + } + if (output_bfd != NULL) relocatable = TRUE; else @@ -879,7 +1048,7 @@ gprel32_with_gp (bfd *abfd, asymbol *symbol, arelent *reloc_entry, relocation += symbol->section->output_section->vma; relocation += symbol->section->output_offset; - if (reloc_entry->address > input_section->_cooked_size) + if (reloc_entry->address > bfd_get_section_limit (abfd, input_section)) return bfd_reloc_outofrange; /* Set val to the offset into the section or symbol. */ @@ -982,11 +1151,8 @@ mips16_gprel_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, { bfd_boolean relocatable; bfd_reloc_status_type ret; + bfd_byte *location; bfd_vma gp; - unsigned short extend = 0; - unsigned short insn = 0; - bfd_signed_vma val; - bfd_vma relocation; /* If we're relocating, and this is an external symbol, we don't want to change anything. */ @@ -1011,55 +1177,16 @@ mips16_gprel_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, if (ret != bfd_reloc_ok) return ret; - if (reloc_entry->address > input_section->_cooked_size) - return bfd_reloc_outofrange; + location = (bfd_byte *) data + reloc_entry->address; + _bfd_mips16_elf_reloc_unshuffle (abfd, reloc_entry->howto->type, FALSE, + location); + ret = _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry, + input_section, relocatable, + data, gp); + _bfd_mips16_elf_reloc_shuffle (abfd, reloc_entry->howto->type, !relocatable, + location); - if (bfd_is_com_section (symbol->section)) - relocation = 0; - else - relocation = symbol->value; - - relocation += symbol->section->output_section->vma; - relocation += symbol->section->output_offset; - - /* Set val to the offset into the section or symbol. */ - val = reloc_entry->addend; - - if (reloc_entry->howto->partial_inplace) - { - /* 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); - val += ((extend & 0x1f) << 11) | (extend & 0x7e0) | (insn & 0x1f); - } - - _bfd_mips_elf_sign_extend(val, 16); - - /* Adjust val for the final section location and GP value. If we - are producing relocatable output, we don't want to do this for - an external symbol. */ - if (! relocatable - || (symbol->flags & BSF_SECTION_SYM) != 0) - val += relocation - gp; - - if (reloc_entry->howto->partial_inplace) - { - bfd_put_16 (abfd, - (extend & 0xf800) | ((val >> 11) & 0x1f) | (val & 0x7e0), - (bfd_byte *) data + reloc_entry->address); - bfd_put_16 (abfd, - (insn & 0xffe0) | (val & 0x1f), - (bfd_byte *) data + reloc_entry->address + 2); - } - else - reloc_entry->addend = val; - - if (relocatable) - reloc_entry->address += input_section->output_offset; - else if (((val & ~0xffff) != ~0xffff) && ((val & ~0xffff) != 0)) - return bfd_reloc_overflow; - - return bfd_reloc_ok; + return ret; } /* A mapping from BFD reloc types to MIPS ELF reloc types. */ @@ -1082,7 +1209,7 @@ static const struct elf_reloc_map mips_reloc_map[] = { BFD_RELOC_GPREL16, 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_16_PCREL_S2, R_MIPS_PC16 }, { BFD_RELOC_MIPS_CALL16, R_MIPS_CALL16 }, { BFD_RELOC_GPREL32, R_MIPS_GPREL32 }, { BFD_RELOC_MIPS_GOT_HI16, R_MIPS_GOT_HI16 }, @@ -1092,7 +1219,28 @@ static const struct elf_reloc_map mips_reloc_map[] = { 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 } + { BFD_RELOC_MIPS_GOT_DISP, R_MIPS_GOT_DISP }, + { BFD_RELOC_MIPS_TLS_DTPMOD32, R_MIPS_TLS_DTPMOD32 }, + { BFD_RELOC_MIPS_TLS_DTPREL32, R_MIPS_TLS_DTPREL32 }, + { BFD_RELOC_MIPS_TLS_DTPMOD64, R_MIPS_TLS_DTPMOD64 }, + { BFD_RELOC_MIPS_TLS_DTPREL64, R_MIPS_TLS_DTPREL64 }, + { BFD_RELOC_MIPS_TLS_GD, R_MIPS_TLS_GD }, + { BFD_RELOC_MIPS_TLS_LDM, R_MIPS_TLS_LDM }, + { BFD_RELOC_MIPS_TLS_DTPREL_HI16, R_MIPS_TLS_DTPREL_HI16 }, + { BFD_RELOC_MIPS_TLS_DTPREL_LO16, R_MIPS_TLS_DTPREL_LO16 }, + { BFD_RELOC_MIPS_TLS_GOTTPREL, R_MIPS_TLS_GOTTPREL }, + { BFD_RELOC_MIPS_TLS_TPREL32, R_MIPS_TLS_TPREL32 }, + { BFD_RELOC_MIPS_TLS_TPREL64, R_MIPS_TLS_TPREL64 }, + { BFD_RELOC_MIPS_TLS_TPREL_HI16, R_MIPS_TLS_TPREL_HI16 }, + { BFD_RELOC_MIPS_TLS_TPREL_LO16, R_MIPS_TLS_TPREL_LO16 } +}; + +static const struct elf_reloc_map mips16_reloc_map[] = +{ + { BFD_RELOC_MIPS16_JMP, R_MIPS16_26 - R_MIPS16_min }, + { BFD_RELOC_MIPS16_GPREL, R_MIPS16_GPREL - R_MIPS16_min }, + { BFD_RELOC_MIPS16_HI16_S, R_MIPS16_HI16 - R_MIPS16_min }, + { BFD_RELOC_MIPS16_LO16, R_MIPS16_LO16 - R_MIPS16_min }, }; /* Given a BFD reloc type, return a howto structure. */ @@ -1102,6 +1250,7 @@ bfd_elf32_bfd_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code) { unsigned int i; reloc_howto_type *howto_table = elf_mips_howto_table_rel; + reloc_howto_type *howto16_table = elf_mips16_howto_table_rel; for (i = 0; i < sizeof (mips_reloc_map) / sizeof (struct elf_reloc_map); i++) @@ -1110,6 +1259,13 @@ bfd_elf32_bfd_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code) return &howto_table[(int) mips_reloc_map[i].elf_val]; } + for (i = 0; i < sizeof (mips16_reloc_map) / sizeof (struct elf_reloc_map); + i++) + { + if (mips16_reloc_map[i].bfd_val == code) + return &howto16_table[(int) mips16_reloc_map[i].elf_val]; + } + switch (code) { default: @@ -1126,22 +1282,10 @@ bfd_elf32_bfd_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code) else return &howto_table[(int) R_MIPS_32]; - 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; } @@ -1155,25 +1299,17 @@ mips_elf32_rtype_to_howto (unsigned int r_type, { switch (r_type) { - case R_MIPS16_26: - return &elf_mips16_jump_howto; - case R_MIPS16_GPREL: - return &elf_mips16_gprel_howto; case R_MIPS_GNU_VTINHERIT: return &elf_mips_gnu_vtinherit_howto; case R_MIPS_GNU_VTENTRY: return &elf_mips_gnu_vtentry_howto; - case R_MIPS_GNU_REL_HI16: - return &elf_mips_gnu_rel_hi16; - case R_MIPS_GNU_REL_LO16: - return &elf_mips_gnu_rel_lo16; case R_MIPS_GNU_REL16_S2: return &elf_mips_gnu_rel16_s2; - case R_MIPS_PC64: - return &elf_mips_gnu_pcrel64; case R_MIPS_PC32: return &elf_mips_gnu_pcrel32; default: + if (r_type >= R_MIPS16_min && r_type < R_MIPS16_max) + return &elf_mips16_howto_table_rel[r_type - R_MIPS16_min]; BFD_ASSERT (r_type < (unsigned int) R_MIPS_max); return &elf_mips_howto_table_rel[r_type]; } @@ -1184,10 +1320,12 @@ mips_elf32_rtype_to_howto (unsigned int r_type, static void mips_info_to_howto_rel (bfd *abfd, arelent *cache_ptr, Elf_Internal_Rela *dst) { + const struct elf_backend_data *bed; unsigned int r_type; r_type = ELF32_R_TYPE (dst->r_info); - cache_ptr->howto = mips_elf32_rtype_to_howto (r_type, FALSE); + bed = get_elf_backend_data (abfd); + cache_ptr->howto = bed->elf_backend_mips_rtype_to_howto (r_type, FALSE); /* The addend for a GPREL16 or LITERAL relocation comes from the GP value for the object file. We get the addend now, rather than @@ -1267,7 +1405,7 @@ static bfd_boolean elf32_mips_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) { int offset; - unsigned int raw_size; + unsigned int size; switch (note->descsz) { @@ -1283,14 +1421,14 @@ elf32_mips_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) /* pr_reg */ offset = 72; - raw_size = 180; + size = 180; break; } /* Make a ".reg/999" section. */ return _bfd_elfcore_make_pseudosection (abfd, ".reg", - raw_size, note->descpos + offset); + size, note->descpos + offset); } static bfd_boolean @@ -1335,139 +1473,6 @@ elf32_mips_irix_compat (bfd *abfd) return ict_none; } -/* Given a data section and an in-memory embedded reloc section, store - relocation information into the embedded reloc section which can be - used at runtime to relocate the data 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. */ - -bfd_boolean -bfd_mips_elf32_create_embedded_relocs (bfd *abfd, struct bfd_link_info *info, - asection *datasec, asection *relsec, - char **errmsg) -{ - Elf_Internal_Shdr *symtab_hdr; - Elf_Internal_Sym *isymbuf = NULL; - Elf_Internal_Rela *internal_relocs = NULL; - Elf_Internal_Rela *irel, *irelend; - bfd_byte *p; - - BFD_ASSERT (! info->relocatable); - - *errmsg = NULL; - - if (datasec->reloc_count == 0) - return TRUE; - - /* Read this BFD's symbols if we haven't done so already, or get the cached - copy if it exists. */ - symtab_hdr = &elf_tdata (abfd)->symtab_hdr; - if (symtab_hdr->sh_info != 0) - { - isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents; - if (isymbuf == NULL) - isymbuf = bfd_elf_get_elf_syms (abfd, symtab_hdr, - symtab_hdr->sh_info, 0, - NULL, NULL, NULL); - if (isymbuf == NULL) - goto error_return; - } - - /* Get a copy of the native relocations. */ - internal_relocs = _bfd_elf_link_read_relocs (abfd, datasec, NULL, NULL, - info->keep_memory); - if (internal_relocs == NULL) - goto error_return; - - relsec->contents = bfd_alloc (abfd, datasec->reloc_count * 12); - if (relsec->contents == NULL) - goto error_return; - - p = relsec->contents; - - irelend = internal_relocs + datasec->reloc_count; - - for (irel = internal_relocs; irel < irelend; irel++, p += 12) - { - asection *targetsec; - - /* We are going to write a four byte longword into the runtime - reloc section. The longword will be the address in the data - section which must be relocated. It is followed by the name - of the target section NUL-padded or truncated to 8 - characters. */ - - /* We can only relocate absolute longword relocs at run time. */ - if ((ELF32_R_TYPE (irel->r_info) != (int) R_MIPS_32) && - (ELF32_R_TYPE (irel->r_info) != (int) R_MIPS_64)) - { - *errmsg = _("unsupported reloc type"); - bfd_set_error (bfd_error_bad_value); - goto error_return; - } - /* Get the target section referred to by the reloc. */ - if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info) - { - Elf_Internal_Sym *isym; - - /* A local symbol. */ - isym = isymbuf + ELF32_R_SYM (irel->r_info); - targetsec = bfd_section_from_elf_index (abfd, isym->st_shndx); - } - else - { - unsigned long indx; - struct elf_link_hash_entry *h; - - /* An external symbol. */ - indx = ELF32_R_SYM (irel->r_info); - h = elf_sym_hashes (abfd)[indx]; - targetsec = NULL; - /* - For some reason, in certain programs, the symbol will - not be in the hash table. It seems to happen when you - declare a static table of pointers to const external structures. - In this case, the relocs are relative to data, not - text, so just treating it like an undefined link - should be sufficient. */ - BFD_ASSERT(h != NULL); - if (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - targetsec = h->root.u.def.section; - } - - - /* - Set the low bit of the relocation offset if it's a MIPS64 reloc. - Relocations will always be on (at least) 32-bit boundaries. */ - - bfd_put_32 (abfd, ((irel->r_offset + datasec->output_offset) + - ((ELF32_R_TYPE (irel->r_info) == (int) R_MIPS_64) ? 1 : 0)), - p); - memset (p + 4, 0, 8); - if (targetsec != NULL) - strncpy (p + 4, targetsec->output_section->name, 8); - } - - if (internal_relocs != NULL - && elf_section_data (datasec)->relocs != internal_relocs) - free (internal_relocs); - if (isymbuf != NULL - && symtab_hdr->contents != (unsigned char *) isymbuf) - free (isymbuf); - return TRUE; - - error_return: - if (internal_relocs != NULL - && elf_section_data (datasec)->relocs != internal_relocs) - free (internal_relocs); - if (isymbuf != NULL - && symtab_hdr->contents != (unsigned char *) isymbuf) - free (isymbuf); - return FALSE; -} - /* 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 = { @@ -1571,6 +1576,7 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = { #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_find_inliner_info _bfd_mips_elf_find_inliner_info #define bfd_elf32_new_section_hook _bfd_mips_elf_new_section_hook #define bfd_elf32_set_section_contents _bfd_mips_elf_set_section_contents #define bfd_elf32_bfd_get_relocated_section_contents \ @@ -1616,3 +1622,147 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = { /* Include the target file again for this target. */ #include "elf32-target.h" + + +/* Specific to VxWorks. */ +static reloc_howto_type mips_vxworks_copy_howto_rela = + HOWTO (R_MIPS_COPY, /* 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_COPY", /* name */ + FALSE, /* partial_inplace */ + 0x0, /* src_mask */ + 0x0, /* dst_mask */ + FALSE); /* pcrel_offset */ + +/* Specific to VxWorks. */ +static reloc_howto_type mips_vxworks_jump_slot_howto_rela = + HOWTO (R_MIPS_JUMP_SLOT, /* 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_JUMP_SLOT", /* name */ + FALSE, /* partial_inplace */ + 0x0, /* src_mask */ + 0x0, /* dst_mask */ + FALSE); /* pcrel_offset */ + +/* Implement elf_backend_bfd_reloc_type_lookup for VxWorks. */ + +static reloc_howto_type * +mips_vxworks_bfd_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code) +{ + switch (code) + { + case BFD_RELOC_MIPS_COPY: + return &mips_vxworks_copy_howto_rela; + case BFD_RELOC_MIPS_JUMP_SLOT: + return &mips_vxworks_jump_slot_howto_rela; + default: + return bfd_elf32_bfd_reloc_type_lookup (abfd, code); + } +} + +/* Implement elf_backend_mips_rtype_to_lookup for VxWorks. */ + +static reloc_howto_type * +mips_vxworks_rtype_to_howto (unsigned int r_type, bfd_boolean rela_p) +{ + switch (r_type) + { + case R_MIPS_COPY: + return &mips_vxworks_copy_howto_rela; + case R_MIPS_JUMP_SLOT: + return &mips_vxworks_jump_slot_howto_rela; + default: + return mips_elf32_rtype_to_howto (r_type, rela_p); + } +} + +/* Implement elf_backend_final_write_processing for VxWorks. */ + +static void +mips_vxworks_final_write_processing (bfd *abfd, bfd_boolean linker) +{ + _bfd_mips_elf_final_write_processing (abfd, linker); + elf_vxworks_final_write_processing (abfd, linker); +} + +#undef TARGET_LITTLE_SYM +#undef TARGET_LITTLE_NAME +#undef TARGET_BIG_SYM +#undef TARGET_BIG_NAME + +#define TARGET_LITTLE_SYM bfd_elf32_littlemips_vxworks_vec +#define TARGET_LITTLE_NAME "elf32-littlemips-vxworks" +#define TARGET_BIG_SYM bfd_elf32_bigmips_vxworks_vec +#define TARGET_BIG_NAME "elf32-bigmips-vxworks" + +#undef elf32_bed +#define elf32_bed elf32_mips_vxworks_bed + +#undef ELF_MAXPAGESIZE +#define ELF_MAXPAGESIZE 0x1000 + +#undef elf_backend_want_got_plt +#define elf_backend_want_got_plt 1 +#undef elf_backend_want_plt_sym +#define elf_backend_want_plt_sym 1 +#undef elf_backend_got_symbol_offset +#define elf_backend_got_symbol_offset 0 +#undef elf_backend_want_dynbss +#define elf_backend_want_dynbss 1 +#undef elf_backend_may_use_rel_p +#define elf_backend_may_use_rel_p 0 +#undef elf_backend_may_use_rela_p +#define elf_backend_may_use_rela_p 1 +#undef elf_backend_default_use_rela_p +#define elf_backend_default_use_rela_p 1 +#undef elf_backend_got_header_size +#define elf_backend_got_header_size (4 * 3) +#undef elf_backend_plt_readonly +#define elf_backend_plt_readonly 1 + +#undef bfd_elf32_bfd_reloc_type_lookup +#define bfd_elf32_bfd_reloc_type_lookup \ + mips_vxworks_bfd_reloc_type_lookup +#undef elf_backend_mips_rtype_to_howto +#define elf_backend_mips_rtype_to_howto \ + mips_vxworks_rtype_to_howto +#undef elf_backend_adjust_dynamic_symbol +#define elf_backend_adjust_dynamic_symbol \ + _bfd_mips_vxworks_adjust_dynamic_symbol +#undef elf_backend_finish_dynamic_symbol +#define elf_backend_finish_dynamic_symbol \ + _bfd_mips_vxworks_finish_dynamic_symbol +#undef bfd_elf32_bfd_link_hash_table_create +#define bfd_elf32_bfd_link_hash_table_create \ + _bfd_mips_vxworks_link_hash_table_create +#undef elf_backend_add_symbol_hook +#define elf_backend_add_symbol_hook \ + elf_vxworks_add_symbol_hook +#undef elf_backend_link_output_symbol_hook +#define elf_backend_link_output_symbol_hook \ + elf_vxworks_link_output_symbol_hook +#undef elf_backend_emit_relocs +#define elf_backend_emit_relocs \ + elf_vxworks_emit_relocs +#undef elf_backend_final_write_processing +#define elf_backend_final_write_processing \ + mips_vxworks_final_write_processing + +#undef elf_backend_additional_program_headers +#undef elf_backend_modify_segment_map +#undef elf_backend_symbol_processing +/* NOTE: elf_backend_rela_normal is not defined for MIPS. */ + +#include "elf32-target.h" diff --git a/contrib/binutils/bfd/elf32-ppc.c b/contrib/binutils/bfd/elf32-ppc.c index 4eb08ad3e67..53d1046bb8c 100644 --- a/contrib/binutils/bfd/elf32-ppc.c +++ b/contrib/binutils/bfd/elf32-ppc.c @@ -1,6 +1,6 @@ /* PowerPC-specific support for 32-bit ELF Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, - 2004 Free Software Foundation, Inc. + 2004, 2005, 2006 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -17,8 +17,8 @@ You 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. */ + Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, + Boston, MA 02110-1301, USA. */ /* This file is based on a preliminary PowerPC ELF ABI. The information may not match the final PowerPC ELF ABI. It includes @@ -32,6 +32,7 @@ #include "elf-bfd.h" #include "elf/ppc.h" #include "elf32-ppc.h" +#include "elf-vxworks.h" /* RELA relocations are used here. */ @@ -51,296 +52,109 @@ static bfd_reloc_status_type ppc_elf_unhandled_reloc section. */ #define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1" -/* The size in bytes of an entry in the procedure linkage table. */ -#define PLT_ENTRY_SIZE 12 -/* The initial size of the plt reserved for the dynamic linker. */ -#define PLT_INITIAL_ENTRY_SIZE 72 -/* The size of the gap between entries in the PLT. */ -#define PLT_SLOT_SIZE 8 +/* For old-style PLT. */ /* The number of single-slot PLT entries (the rest use two slots). */ #define PLT_NUM_SINGLE_ENTRIES 8192 -/* Some nop instructions. */ +/* For new-style .glink and .plt. */ +#define GLINK_PLTRESOLVE 16*4 +#define GLINK_ENTRY_SIZE 4*4 + +/* VxWorks uses its own plt layout, filled in by the static linker. */ + +/* The standard VxWorks PLT entry. */ +#define VXWORKS_PLT_ENTRY_SIZE 32 +static const bfd_vma ppc_elf_vxworks_plt_entry + [VXWORKS_PLT_ENTRY_SIZE / 4] = + { + 0x3d800000, /* lis r12,0 */ + 0x818c0000, /* lwz r12,0(r12) */ + 0x7d8903a6, /* mtctr r12 */ + 0x4e800420, /* bctr */ + 0x39600000, /* li r11,0 */ + 0x48000000, /* b 14 <.PLT0resolve+0x4> */ + 0x60000000, /* nop */ + 0x60000000, /* nop */ + }; +static const bfd_vma ppc_elf_vxworks_pic_plt_entry + [VXWORKS_PLT_ENTRY_SIZE / 4] = + { + 0x3d9e0000, /* addis r12,r30,0 */ + 0x818c0000, /* lwz r12,0(r12) */ + 0x7d8903a6, /* mtctr r12 */ + 0x4e800420, /* bctr */ + 0x39600000, /* li r11,0 */ + 0x48000000, /* b 14 <.PLT0resolve+0x4> 14: R_PPC_REL24 .PLTresolve */ + 0x60000000, /* nop */ + 0x60000000, /* nop */ + }; + +/* The initial VxWorks PLT entry. */ +#define VXWORKS_PLT_INITIAL_ENTRY_SIZE 32 +static const bfd_vma ppc_elf_vxworks_plt0_entry + [VXWORKS_PLT_INITIAL_ENTRY_SIZE / 4] = + { + 0x3d800000, /* lis r12,0 */ + 0x398c0000, /* addi r12,r12,0 */ + 0x800c0008, /* lwz r0,8(r12) */ + 0x7c0903a6, /* mtctr r0 */ + 0x818c0004, /* lwz r12,4(r12) */ + 0x4e800420, /* bctr */ + 0x60000000, /* nop */ + 0x60000000, /* nop */ + }; +static const bfd_vma ppc_elf_vxworks_pic_plt0_entry + [VXWORKS_PLT_INITIAL_ENTRY_SIZE / 4] = + { + 0x819e0008, /* lwz r12,8(r30) */ + 0x7d8903a6, /* mtctr r12 */ + 0x819e0004, /* lwz r12,4(r30) */ + 0x4e800420, /* bctr */ + 0x60000000, /* nop */ + 0x60000000, /* nop */ + 0x60000000, /* nop */ + 0x60000000, /* nop */ + }; + +/* For executables, we have some additional relocations in + .rela.plt.unloaded, for the kernel loader. */ + +/* The number of non-JMP_SLOT relocations per PLT0 slot. */ +#define VXWORKS_PLT_NON_JMP_SLOT_RELOCS 3 +/* The number of relocations in the PLTResolve slot. */ +#define VXWORKS_PLTRESOLVE_RELOCS 2 +/* The number of relocations in the PLTResolve slot when when creating + a shared library. */ +#define VXWORKS_PLTRESOLVE_RELOCS_SHLIB 0 + +/* Some instructions. */ +#define ADDIS_11_11 0x3d6b0000 +#define ADDIS_11_30 0x3d7e0000 +#define ADDIS_12_12 0x3d8c0000 +#define ADDI_11_11 0x396b0000 +#define ADD_0_11_11 0x7c0b5a14 +#define ADD_11_0_11 0x7d605a14 +#define B 0x48000000 +#define BCL_20_31 0x429f0005 +#define BCTR 0x4e800420 +#define LIS_11 0x3d600000 +#define LIS_12 0x3d800000 +#define LWZU_0_12 0x840c0000 +#define LWZ_0_12 0x800c0000 +#define LWZ_11_11 0x816b0000 +#define LWZ_11_30 0x817e0000 +#define LWZ_12_12 0x818c0000 +#define MFLR_0 0x7c0802a6 +#define MFLR_12 0x7d8802a6 +#define MTCTR_0 0x7c0903a6 +#define MTCTR_11 0x7d6903a6 +#define MTLR_0 0x7c0803a6 #define NOP 0x60000000 -#define CROR_151515 0x4def7b82 -#define CROR_313131 0x4ffffb82 +#define SUB_11_11_12 0x7d6c5850 /* Offset of tp and dtp pointers from start of TLS block. */ #define TP_OFFSET 0x7000 #define DTP_OFFSET 0x8000 - - -/* Enumeration to specify the special section. */ -enum elf_linker_section_enum -{ - LINKER_SECTION_SDATA, - LINKER_SECTION_SDATA2 -}; - -/* Sections created by the linker. */ - -typedef struct elf_linker_section -{ - /* pointer to the section */ - asection *section; - /* pointer to the relocations needed for this section */ - asection *rel_section; - /* pointer to the created symbol hash value */ - struct elf_link_hash_entry *sym_hash; - /* offset of symbol from beginning of section */ - bfd_vma sym_offset; -} elf_linker_section_t; - -/* Linked list of allocated pointer entries. This hangs off of the - symbol lists, and provides allows us to return different pointers, - based on different addend's. */ - -typedef struct elf_linker_section_pointers -{ - /* next allocated pointer for this symbol */ - struct elf_linker_section_pointers *next; - /* offset of pointer from beginning of section */ - bfd_vma offset; - /* addend used */ - bfd_vma addend; - /* which linker section this is */ - elf_linker_section_t *lsect; - /* whether address was written yet */ - bfd_boolean written_address_p; -} elf_linker_section_pointers_t; - -struct ppc_elf_obj_tdata -{ - struct elf_obj_tdata elf; - - /* A mapping from local symbols to offsets into the various linker - sections added. This is index by the symbol index. */ - elf_linker_section_pointers_t **linker_section_pointers; -}; - -#define ppc_elf_tdata(bfd) \ - ((struct ppc_elf_obj_tdata *) (bfd)->tdata.any) - -#define elf_local_ptr_offsets(bfd) \ - (ppc_elf_tdata (bfd)->linker_section_pointers) - -/* Override the generic function because we store some extras. */ - -static bfd_boolean -ppc_elf_mkobject (bfd *abfd) -{ - bfd_size_type amt = sizeof (struct ppc_elf_obj_tdata); - abfd->tdata.any = bfd_zalloc (abfd, amt); - if (abfd->tdata.any == NULL) - return FALSE; - return TRUE; -} - -/* The PPC linker needs to keep track of the number of relocs that it - decides to copy as dynamic relocs in check_relocs for each symbol. - This is so that it can later discard them if they are found to be - unnecessary. We store the information in a field extending the - regular ELF linker hash table. */ - -struct ppc_elf_dyn_relocs -{ - struct ppc_elf_dyn_relocs *next; - - /* The input section of the reloc. */ - asection *sec; - - /* Total number of relocs copied for the input section. */ - bfd_size_type count; - - /* Number of pc-relative relocs copied for the input section. */ - bfd_size_type pc_count; -}; - -/* PPC ELF linker hash entry. */ - -struct ppc_elf_link_hash_entry -{ - struct elf_link_hash_entry elf; - - /* If this symbol is used in the linker created sections, the processor - specific backend uses this field to map the field into the offset - from the beginning of the section. */ - elf_linker_section_pointers_t *linker_section_pointer; - - /* Track dynamic relocs copied for this symbol. */ - struct ppc_elf_dyn_relocs *dyn_relocs; - - /* Contexts in which symbol is used in the GOT (or TOC). - TLS_GD .. TLS_TLS bits are or'd into the mask as the - corresponding relocs are encountered during check_relocs. - tls_optimize clears TLS_GD .. TLS_TPREL when optimizing to - indicate the corresponding GOT entry type is not needed. */ -#define TLS_GD 1 /* GD reloc. */ -#define TLS_LD 2 /* LD reloc. */ -#define TLS_TPREL 4 /* TPREL reloc, => IE. */ -#define TLS_DTPREL 8 /* DTPREL reloc, => LD. */ -#define TLS_TLS 16 /* Any TLS reloc. */ -#define TLS_TPRELGD 32 /* TPREL reloc resulting from GD->IE. */ - char tls_mask; -}; - -#define ppc_elf_hash_entry(ent) ((struct ppc_elf_link_hash_entry *) (ent)) - -/* PPC ELF linker hash table. */ - -struct ppc_elf_link_hash_table -{ - struct elf_link_hash_table elf; - - /* Short-cuts to get to dynamic linker sections. */ - asection *got; - asection *relgot; - asection *plt; - asection *relplt; - asection *dynbss; - asection *relbss; - asection *dynsbss; - asection *relsbss; - elf_linker_section_t *sdata; - elf_linker_section_t *sdata2; - asection *sbss; - - /* Shortcut to .__tls_get_addr. */ - struct elf_link_hash_entry *tls_get_addr; - - /* TLS local dynamic got entry handling. */ - union { - bfd_signed_vma refcount; - bfd_vma offset; - } tlsld_got; - - /* Small local sym to section mapping cache. */ - struct sym_sec_cache sym_sec; -}; - -/* Get the PPC ELF linker hash table from a link_info structure. */ - -#define ppc_elf_hash_table(p) \ - ((struct ppc_elf_link_hash_table *) (p)->hash) - -/* Create an entry in a PPC ELF linker hash table. */ - -static struct bfd_hash_entry * -ppc_elf_link_hash_newfunc (struct bfd_hash_entry *entry, - struct bfd_hash_table *table, - const char *string) -{ - /* Allocate the structure if it has not already been allocated by a - subclass. */ - if (entry == NULL) - { - entry = bfd_hash_allocate (table, - sizeof (struct ppc_elf_link_hash_entry)); - if (entry == NULL) - return entry; - } - - /* Call the allocation method of the superclass. */ - entry = _bfd_elf_link_hash_newfunc (entry, table, string); - if (entry != NULL) - { - ppc_elf_hash_entry (entry)->linker_section_pointer = NULL; - ppc_elf_hash_entry (entry)->dyn_relocs = NULL; - ppc_elf_hash_entry (entry)->tls_mask = 0; - } - - return entry; -} - -/* Create a PPC ELF linker hash table. */ - -static struct bfd_link_hash_table * -ppc_elf_link_hash_table_create (bfd *abfd) -{ - struct ppc_elf_link_hash_table *ret; - - ret = bfd_zmalloc (sizeof (struct ppc_elf_link_hash_table)); - if (ret == NULL) - return NULL; - - if (! _bfd_elf_link_hash_table_init (&ret->elf, abfd, - ppc_elf_link_hash_newfunc)) - { - free (ret); - return NULL; - } - - return &ret->elf.root; -} - -/* If ELIMINATE_COPY_RELOCS is non-zero, the linker will try to avoid - copying dynamic variables from a shared lib into an app's dynbss - section, and instead use a dynamic relocation to point into the - shared lib. */ -#define ELIMINATE_COPY_RELOCS 1 - -/* Copy the extra info we tack onto an elf_link_hash_entry. */ - -static void -ppc_elf_copy_indirect_symbol (const struct elf_backend_data *bed, - struct elf_link_hash_entry *dir, - struct elf_link_hash_entry *ind) -{ - struct ppc_elf_link_hash_entry *edir, *eind; - - edir = (struct ppc_elf_link_hash_entry *) dir; - eind = (struct ppc_elf_link_hash_entry *) ind; - - if (eind->dyn_relocs != NULL) - { - if (edir->dyn_relocs != NULL) - { - struct ppc_elf_dyn_relocs **pp; - struct ppc_elf_dyn_relocs *p; - - if (ind->root.type == bfd_link_hash_indirect) - abort (); - - /* Add reloc counts against the weak sym to the strong sym - list. Merge any entries against the same section. */ - for (pp = &eind->dyn_relocs; (p = *pp) != NULL; ) - { - struct ppc_elf_dyn_relocs *q; - - for (q = edir->dyn_relocs; q != NULL; q = q->next) - if (q->sec == p->sec) - { - q->pc_count += p->pc_count; - q->count += p->count; - *pp = p->next; - break; - } - if (q == NULL) - pp = &p->next; - } - *pp = edir->dyn_relocs; - } - - edir->dyn_relocs = eind->dyn_relocs; - eind->dyn_relocs = NULL; - } - - edir->tls_mask |= eind->tls_mask; - - if (ELIMINATE_COPY_RELOCS - && ind->root.type != bfd_link_hash_indirect - && (dir->elf_link_hash_flags & ELF_LINK_HASH_DYNAMIC_ADJUSTED) != 0) - /* If called to transfer flags for a weakdef during processing - of elf_adjust_dynamic_symbol, don't copy ELF_LINK_NON_GOT_REF. - We clear it ourselves for ELIMINATE_COPY_RELOCS. */ - dir->elf_link_hash_flags |= - (ind->elf_link_hash_flags & (ELF_LINK_HASH_REF_DYNAMIC - | ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_REF_REGULAR_NONWEAK - | ELF_LINK_HASH_NEEDS_PLT)); - else - _bfd_elf_link_hash_copy_indirect (bed, dir, ind); -} static reloc_howto_type *ppc_elf_howto_table[R_PPC_max]; @@ -1532,34 +1346,66 @@ static reloc_howto_type ppc_elf_howto_raw[] = { 0xffff, /* dst_mask */ FALSE), /* pcrel_offset */ - /* Phony relocs to handle branch stubs. */ - HOWTO (R_PPC_RELAX32, /* type */ + /* A 16 bit relative relocation. */ + HOWTO (R_PPC_REL16, /* type */ 0, /* rightshift */ - 0, /* size */ - 0, /* bitsize */ - FALSE, /* pc_relative */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + TRUE, /* pc_relative */ 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ + complain_overflow_bitfield, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ - "R_PPC_RELAX32", /* name */ + "R_PPC_REL16", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ - 0, /* dst_mask */ - FALSE), /* pcrel_offset */ + 0xffff, /* dst_mask */ + TRUE), /* pcrel_offset */ - HOWTO (R_PPC_RELAX32PC, /* type */ + /* A 16 bit relative relocation without overflow. */ + HOWTO (R_PPC_REL16_LO, /* type */ 0, /* rightshift */ - 0, /* size */ - 0, /* bitsize */ - FALSE, /* pc_relative */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_PPC_REL16_LO", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* The high order 16 bits of a relative address. */ + HOWTO (R_PPC_REL16_HI, /* type */ + 16, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + TRUE, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ - "R_PPC_RELAX32PC", /* name */ + "R_PPC_REL16_HI", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ - 0, /* dst_mask */ - FALSE), /* pcrel_offset */ + 0xffff, /* dst_mask */ + TRUE), /* pcrel_offset */ + + /* The high order 16 bits of a relative address, plus 1 if the contents of + the low 16 bits, treated as a signed number, is negative. */ + HOWTO (R_PPC_REL16_HA, /* type */ + 16, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + ppc_elf_addr16_ha_reloc, /* special_function */ + "R_PPC_REL16_HA", /* name */ + FALSE, /* partial_inplace */ + 0, /* src_mask */ + 0xffff, /* dst_mask */ + TRUE), /* pcrel_offset */ /* GNU extension to record C++ vtable hierarchy. */ HOWTO (R_PPC_GNU_VTINHERIT, /* type */ @@ -1625,381 +1471,7 @@ ppc_elf_howto_init (void) ppc_elf_howto_table[type] = &ppc_elf_howto_raw[i]; } } - -#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0])) -static const int shared_stub_entry[] = - { - 0x7c0802a6, /* mflr 0 */ - 0x429f0005, /* bcl 20, 31, .Lxxx */ - 0x7d6802a6, /* mflr 11 */ - 0x3d6b0000, /* addis 11, 11, (xxx-.Lxxx)@ha */ - 0x396b0018, /* addi 11, 11, (xxx-.Lxxx)@l */ - 0x7c0803a6, /* mtlr 0 */ - 0x7d6903a6, /* mtctr 11 */ - 0x4e800420, /* bctr */ - }; - -static const int stub_entry[] = - { - 0x3d600000, /* lis 11,xxx@ha */ - 0x396b0000, /* addi 11,11,xxx@l */ - 0x7d6903a6, /* mtctr 11 */ - 0x4e800420, /* bctr */ - }; - - -static bfd_boolean -ppc_elf_relax_section (bfd *abfd, - asection *isec, - struct bfd_link_info *link_info, - bfd_boolean *again) -{ - struct one_fixup - { - struct one_fixup *next; - asection *tsec; - bfd_vma toff; - bfd_vma trampoff; - }; - - Elf_Internal_Shdr *symtab_hdr; - bfd_byte *contents = NULL; - Elf_Internal_Sym *isymbuf = NULL; - Elf_Internal_Rela *internal_relocs = NULL; - Elf_Internal_Rela *irel, *irelend; - struct one_fixup *fixups = NULL; - bfd_boolean changed; - struct ppc_elf_link_hash_table *ppc_info; - bfd_size_type trampoff; - - *again = FALSE; - - /* Nothing to do if there are no relocations. */ - if ((isec->flags & SEC_RELOC) == 0 || isec->reloc_count == 0) - return TRUE; - - /* If needed, initialize this section's cooked size. */ - if (isec->_cooked_size == 0) - isec->_cooked_size = isec->_raw_size; - - trampoff = (isec->_cooked_size + 3) & (bfd_vma) -4; - /* Space for a branch around any trampolines. */ - trampoff += 4; - - symtab_hdr = &elf_tdata (abfd)->symtab_hdr; - - /* Get a copy of the native relocations. */ - internal_relocs = _bfd_elf_link_read_relocs (abfd, isec, NULL, NULL, - link_info->keep_memory); - if (internal_relocs == NULL) - goto error_return; - - ppc_info = ppc_elf_hash_table (link_info); - irelend = internal_relocs + isec->reloc_count; - - /* Get the section contents. */ - /* Get cached copy if it exists. */ - if (elf_section_data (isec)->this_hdr.contents != NULL) - contents = elf_section_data (isec)->this_hdr.contents; - else - { - /* Go get them off disk. */ - contents = bfd_malloc (isec->_raw_size); - if (contents == NULL) - goto error_return; - - if (!bfd_get_section_contents (abfd, isec, contents, 0, isec->_raw_size)) - goto error_return; - } - - for (irel = internal_relocs; irel < irelend; irel++) - { - unsigned long r_type = ELF32_R_TYPE (irel->r_info); - bfd_vma symaddr, reladdr, toff, roff; - asection *tsec; - struct one_fixup *f; - size_t insn_offset = 0; - bfd_vma max_branch_offset, val; - bfd_byte *hit_addr; - unsigned long t0; - - switch (r_type) - { - case R_PPC_REL24: - case R_PPC_LOCAL24PC: - case R_PPC_PLTREL24: - max_branch_offset = 1 << 25; - break; - - case R_PPC_REL14: - case R_PPC_REL14_BRTAKEN: - case R_PPC_REL14_BRNTAKEN: - max_branch_offset = 1 << 15; - break; - - default: - continue; - } - - /* Get the value of the symbol referred to by the reloc. */ - if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info) - { - /* A local symbol. */ - Elf_Internal_Sym *isym; - - /* Read this BFD's local symbols. */ - if (isymbuf == NULL) - { - isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents; - if (isymbuf == NULL) - isymbuf = bfd_elf_get_elf_syms (abfd, symtab_hdr, - symtab_hdr->sh_info, 0, - NULL, NULL, NULL); - if (isymbuf == 0) - goto error_return; - } - isym = isymbuf + ELF32_R_SYM (irel->r_info); - if (isym->st_shndx == SHN_UNDEF) - continue; /* We can't do anything with undefined symbols. */ - else if (isym->st_shndx == SHN_ABS) - tsec = bfd_abs_section_ptr; - else if (isym->st_shndx == SHN_COMMON) - tsec = bfd_com_section_ptr; - else - tsec = bfd_section_from_elf_index (abfd, isym->st_shndx); - - toff = isym->st_value; - } - else - { - /* Global symbol handling. */ - unsigned long indx; - struct elf_link_hash_entry *h; - - indx = ELF32_R_SYM (irel->r_info) - symtab_hdr->sh_info; - h = elf_sym_hashes (abfd)[indx]; - - 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 (r_type == R_PPC_PLTREL24 - && ppc_info->plt != NULL - && h->plt.offset != (bfd_vma) -1) - { - tsec = ppc_info->plt; - toff = h->plt.offset; - } - else if (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - { - tsec = h->root.u.def.section; - toff = h->root.u.def.value; - } - else - continue; - } - - /* If the branch and target are in the same section, you have - no hope of adding stubs. We'll error out later should the - branch overflow. */ - if (tsec == isec) - continue; - - toff += irel->r_addend; - if (tsec->sec_info_type == ELF_INFO_TYPE_MERGE) - toff = _bfd_merged_section_offset (abfd, &tsec, - elf_section_data (tsec)->sec_info, - toff, 0); - - symaddr = tsec->output_section->vma + tsec->output_offset + toff; - - roff = irel->r_offset; - reladdr = isec->output_section->vma + isec->output_offset + roff; - - /* If the branch is in range, no need to do anything. */ - if (symaddr - reladdr + max_branch_offset < 2 * max_branch_offset) - continue; - - /* Look for an existing fixup to this address. */ - for (f = fixups; f ; f = f->next) - if (f->tsec == tsec && f->toff == toff) - break; - - if (f == NULL) - { - size_t size; - unsigned long stub_rtype; - - val = trampoff - roff; - if (val >= max_branch_offset) - /* Oh dear, we can't reach a trampoline. Don't try to add - one. We'll report an error later. */ - continue; - - if (link_info->shared) - { - size = 4 * ARRAY_SIZE (shared_stub_entry); - insn_offset = 12; - stub_rtype = R_PPC_RELAX32PC; - } - else - { - size = 4 * ARRAY_SIZE (stub_entry); - insn_offset = 0; - stub_rtype = R_PPC_RELAX32; - } - - /* Hijack the old relocation. Since we need two - relocations for this use a "composite" reloc. */ - irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), - stub_rtype); - irel->r_offset = trampoff + insn_offset; - - /* Record the fixup so we don't do it again this section. */ - f = bfd_malloc (sizeof (*f)); - f->next = fixups; - f->tsec = tsec; - f->toff = toff; - f->trampoff = trampoff; - fixups = f; - - trampoff += size; - } - else - { - val = f->trampoff - roff; - if (val >= max_branch_offset) - continue; - - /* Nop out the reloc, since we're finalizing things here. */ - irel->r_info = ELF32_R_INFO (0, R_PPC_NONE); - } - - /* Fix up the existing branch to hit the trampoline. */ - hit_addr = contents + roff; - switch (r_type) - { - case R_PPC_REL24: - case R_PPC_LOCAL24PC: - case R_PPC_PLTREL24: - t0 = bfd_get_32 (abfd, hit_addr); - t0 &= ~0x3fffffc; - t0 |= val & 0x3fffffc; - bfd_put_32 (abfd, t0, hit_addr); - break; - - case R_PPC_REL14: - case R_PPC_REL14_BRTAKEN: - case R_PPC_REL14_BRNTAKEN: - t0 = bfd_get_32 (abfd, hit_addr); - t0 &= ~0xfffc; - t0 |= val & 0xfffc; - bfd_put_32 (abfd, t0, hit_addr); - break; - } - } - - /* Write out the trampolines. */ - changed = fixups != NULL; - if (fixups != NULL) - { - const int *stub; - bfd_byte *dest; - bfd_vma val; - int i, size; - - do - { - struct one_fixup *f = fixups; - fixups = fixups->next; - free (f); - } - while (fixups); - - contents = bfd_realloc (contents, trampoff); - if (contents == NULL) - goto error_return; - - isec->_cooked_size = (isec->_cooked_size + 3) & (bfd_vma) -4; - /* Branch around the trampolines. */ - val = trampoff - isec->_cooked_size + 0x48000000; - dest = contents + isec->_cooked_size; - isec->_cooked_size = trampoff; - bfd_put_32 (abfd, val, dest); - dest += 4; - - if (link_info->shared) - { - stub = shared_stub_entry; - size = ARRAY_SIZE (shared_stub_entry); - } - else - { - stub = stub_entry; - size = ARRAY_SIZE (stub_entry); - } - - i = 0; - while (dest < contents + trampoff) - { - bfd_put_32 (abfd, stub[i], dest); - i++; - if (i == size) - i = 0; - dest += 4; - } - BFD_ASSERT (i == 0); - } - - if (isymbuf != NULL - && symtab_hdr->contents != (unsigned char *) isymbuf) - { - if (! link_info->keep_memory) - free (isymbuf); - else - { - /* Cache the symbols for elf_link_input_bfd. */ - symtab_hdr->contents = (unsigned char *) isymbuf; - } - } - - if (contents != NULL - && elf_section_data (isec)->this_hdr.contents != contents) - { - if (!changed && !link_info->keep_memory) - free (contents); - else - { - /* Cache the section contents for elf_link_input_bfd. */ - elf_section_data (isec)->this_hdr.contents = contents; - } - } - - if (elf_section_data (isec)->relocs != internal_relocs) - { - if (!changed) - free (internal_relocs); - else - elf_section_data (isec)->relocs = internal_relocs; - } - - *again = changed; - return TRUE; - - error_return: - if (isymbuf != NULL && (unsigned char *) isymbuf != symtab_hdr->contents) - free (isymbuf); - if (contents != NULL - && elf_section_data (isec)->this_hdr.contents != contents) - free (contents); - if (internal_relocs != NULL - && elf_section_data (isec)->relocs != internal_relocs) - free (internal_relocs); - return FALSE; -} - static reloc_howto_type * ppc_elf_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, bfd_reloc_code_real_type code) @@ -2094,6 +1566,10 @@ ppc_elf_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, case BFD_RELOC_PPC_EMB_RELST_HA: r = R_PPC_EMB_RELST_HA; break; case BFD_RELOC_PPC_EMB_BIT_FLD: r = R_PPC_EMB_BIT_FLD; break; case BFD_RELOC_PPC_EMB_RELSDA: r = R_PPC_EMB_RELSDA; break; + case BFD_RELOC_16_PCREL: r = R_PPC_REL16; break; + case BFD_RELOC_LO16_PCREL: r = R_PPC_REL16_LO; break; + case BFD_RELOC_HI16_PCREL: r = R_PPC_REL16_HI; break; + case BFD_RELOC_HI16_S_PCREL: r = R_PPC_REL16_HA; break; case BFD_RELOC_VTABLE_INHERIT: r = R_PPC_GNU_VTINHERIT; break; case BFD_RELOC_VTABLE_ENTRY: r = R_PPC_GNU_VTENTRY; break; } @@ -2116,7 +1592,7 @@ ppc_elf_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, cache_ptr->howto = ppc_elf_howto_table[ELF32_R_TYPE (dst->r_info)]; } -/* Handle the R_PPC_ADDR16_HA reloc. */ +/* Handle the R_PPC_ADDR16_HA and R_PPC_REL16_HA relocs. */ static bfd_reloc_status_type ppc_elf_addr16_ha_reloc (bfd *abfd ATTRIBUTE_UNUSED, @@ -2135,7 +1611,7 @@ ppc_elf_addr16_ha_reloc (bfd *abfd ATTRIBUTE_UNUSED, return bfd_reloc_ok; } - if (reloc_entry->address > input_section->_cooked_size) + if (reloc_entry->address > bfd_get_section_limit (abfd, input_section)) return bfd_reloc_outofrange; if (bfd_is_com_section (symbol->section)) @@ -2146,6 +1622,8 @@ ppc_elf_addr16_ha_reloc (bfd *abfd ATTRIBUTE_UNUSED, relocation += symbol->section->output_section->vma; relocation += symbol->section->output_offset; relocation += reloc_entry->addend; + if (reloc_entry->howto->pc_relative) + relocation -= reloc_entry->address; reloc_entry->addend += (relocation & 0x8000) << 1; @@ -2177,6 +1655,65 @@ ppc_elf_unhandled_reloc (bfd *abfd, } return bfd_reloc_dangerous; } + +/* Sections created by the linker. */ + +typedef struct elf_linker_section +{ + /* Pointer to the bfd section. */ + asection *section; + /* Section name. */ + const char *name; + /* Associated bss section name. */ + const char *bss_name; + /* Associated symbol name. */ + const char *sym_name; + /* Associated symbol. */ + struct elf_link_hash_entry *sym; +} elf_linker_section_t; + +/* Linked list of allocated pointer entries. This hangs off of the + symbol lists, and provides allows us to return different pointers, + based on different addend's. */ + +typedef struct elf_linker_section_pointers +{ + /* next allocated pointer for this symbol */ + struct elf_linker_section_pointers *next; + /* offset of pointer from beginning of section */ + bfd_vma offset; + /* addend used */ + bfd_vma addend; + /* which linker section this is */ + elf_linker_section_t *lsect; +} elf_linker_section_pointers_t; + +struct ppc_elf_obj_tdata +{ + struct elf_obj_tdata elf; + + /* A mapping from local symbols to offsets into the various linker + sections added. This is index by the symbol index. */ + elf_linker_section_pointers_t **linker_section_pointers; +}; + +#define ppc_elf_tdata(bfd) \ + ((struct ppc_elf_obj_tdata *) (bfd)->tdata.any) + +#define elf_local_ptr_offsets(bfd) \ + (ppc_elf_tdata (bfd)->linker_section_pointers) + +/* Override the generic function because we store some extras. */ + +static bfd_boolean +ppc_elf_mkobject (bfd *abfd) +{ + bfd_size_type amt = sizeof (struct ppc_elf_obj_tdata); + abfd->tdata.any = bfd_zalloc (abfd, amt); + if (abfd->tdata.any == NULL) + return FALSE; + return TRUE; +} /* Fix bad default arch selected for a 32 bit input bfd when the default is 64 bit. */ @@ -2211,110 +1748,93 @@ ppc_elf_set_private_flags (bfd *abfd, flagword flags) return TRUE; } -/* Merge backend specific data from an object file to the output - object file when linking. */ +/* Support for core dump NOTE sections. */ static bfd_boolean -ppc_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) +ppc_elf_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) { - flagword old_flags; - flagword new_flags; - bfd_boolean error; + int offset; + unsigned int size; - /* Check if we have the same endianess. */ - if (! _bfd_generic_verify_endian_match (ibfd, obfd)) - 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; - old_flags = elf_elfheader (obfd)->e_flags; - if (!elf_flags_init (obfd)) + switch (note->descsz) { - /* First call, no flags set. */ - elf_flags_init (obfd) = TRUE; - elf_elfheader (obfd)->e_flags = new_flags; + default: + return FALSE; + + case 268: /* Linux/PPC. */ + /* pr_cursig */ + elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12); + + /* pr_pid */ + elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24); + + /* pr_reg */ + offset = 72; + size = 192; + + break; } - /* Compatible flags are ok. */ - else if (new_flags == old_flags) - ; + /* Make a ".reg/999" section. */ + return _bfd_elfcore_make_pseudosection (abfd, ".reg", + size, note->descpos + offset); +} - /* Incompatible flags. */ - else +static bfd_boolean +ppc_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) +{ + switch (note->descsz) { - /* Warn about -mrelocatable mismatch. Allow -mrelocatable-lib - to be linked with either. */ - error = FALSE; - if ((new_flags & EF_PPC_RELOCATABLE) != 0 - && (old_flags & (EF_PPC_RELOCATABLE | EF_PPC_RELOCATABLE_LIB)) == 0) - { - error = TRUE; - (*_bfd_error_handler) - (_("%s: compiled with -mrelocatable and linked with " - "modules compiled normally"), - bfd_archive_filename (ibfd)); - } - else if ((new_flags & (EF_PPC_RELOCATABLE | EF_PPC_RELOCATABLE_LIB)) == 0 - && (old_flags & EF_PPC_RELOCATABLE) != 0) - { - error = TRUE; - (*_bfd_error_handler) - (_("%s: compiled normally and linked with " - "modules compiled with -mrelocatable"), - bfd_archive_filename (ibfd)); - } + default: + return FALSE; - /* The output is -mrelocatable-lib iff both the input files are. */ - if (! (new_flags & EF_PPC_RELOCATABLE_LIB)) - elf_elfheader (obfd)->e_flags &= ~EF_PPC_RELOCATABLE_LIB; - - /* The output is -mrelocatable iff it can't be -mrelocatable-lib, - but each input file is either -mrelocatable or -mrelocatable-lib. */ - if (! (elf_elfheader (obfd)->e_flags & EF_PPC_RELOCATABLE_LIB) - && (new_flags & (EF_PPC_RELOCATABLE_LIB | EF_PPC_RELOCATABLE)) - && (old_flags & (EF_PPC_RELOCATABLE_LIB | EF_PPC_RELOCATABLE))) - elf_elfheader (obfd)->e_flags |= EF_PPC_RELOCATABLE; - - /* Do not warn about eabi vs. V.4 mismatch, just or in the bit if - any module uses it. */ - elf_elfheader (obfd)->e_flags |= (new_flags & EF_PPC_EMB); - - new_flags &= ~(EF_PPC_RELOCATABLE | EF_PPC_RELOCATABLE_LIB | EF_PPC_EMB); - old_flags &= ~(EF_PPC_RELOCATABLE | EF_PPC_RELOCATABLE_LIB | EF_PPC_EMB); - - /* Warn about any other mismatches. */ - if (new_flags != old_flags) - { - error = TRUE; - (*_bfd_error_handler) - (_("%s: uses different e_flags (0x%lx) fields " - "than previous modules (0x%lx)"), - bfd_archive_filename (ibfd), (long) new_flags, (long) old_flags); - } - - if (error) - { - bfd_set_error (bfd_error_bad_value); - return FALSE; - } + case 128: /* Linux/PPC elf_prpsinfo. */ + elf_tdata (abfd)->core_program + = _bfd_elfcore_strndup (abfd, note->descdata + 32, 16); + elf_tdata (abfd)->core_command + = _bfd_elfcore_strndup (abfd, note->descdata + 48, 80); } + /* Note that for some reason, a spurious space is tacked + onto the end of the args in some (at least one anyway) + implementations, so strip it off if it exists. */ + + { + char *command = elf_tdata (abfd)->core_command; + int n = strlen (command); + + if (0 < n && command[n - 1] == ' ') + command[n - 1] = '\0'; + } + return TRUE; } - + +/* Return address for Ith PLT stub in section PLT, for relocation REL + or (bfd_vma) -1 if it should not be included. */ + +static bfd_vma +ppc_elf_plt_sym_val (bfd_vma i ATTRIBUTE_UNUSED, + const asection *plt ATTRIBUTE_UNUSED, + const arelent *rel) +{ + return rel->address; +} + /* Handle a PowerPC specific section when reading an object file. This - is called when elfcode.h finds a section with an unknown type. */ + is called when bfd_section_from_shdr finds a section with an unknown + type. */ static bfd_boolean -ppc_elf_section_from_shdr (bfd *abfd, Elf_Internal_Shdr *hdr, const char *name) +ppc_elf_section_from_shdr (bfd *abfd, + Elf_Internal_Shdr *hdr, + const char *name, + int shindex) { asection *newsect; flagword flags; - if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name)) + if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex)) return FALSE; newsect = hdr->bfd_section; @@ -2328,7 +1848,7 @@ ppc_elf_section_from_shdr (bfd *abfd, Elf_Internal_Shdr *hdr, const char *name) bfd_set_section_flags (abfd, newsect, flags); return TRUE; } - + /* Set up any other section flags and such that may be necessary. */ static bfd_boolean @@ -2336,7 +1856,7 @@ ppc_elf_fake_sections (bfd *abfd ATTRIBUTE_UNUSED, Elf_Internal_Shdr *shdr, asection *asect) { - if ((asect->flags & SEC_EXCLUDE) != 0) + if ((asect->flags & (SEC_GROUP | SEC_EXCLUDE)) == SEC_EXCLUDE) shdr->sh_flags |= SHF_EXCLUDE; if ((asect->flags & SEC_SORT_ENTRIES) != 0) @@ -2344,7 +1864,916 @@ ppc_elf_fake_sections (bfd *abfd ATTRIBUTE_UNUSED, return TRUE; } + +/* If we have .sbss2 or .PPC.EMB.sbss0 output sections, we + need to bump up the number of section headers. */ + +static int +ppc_elf_additional_program_headers (bfd *abfd) +{ + asection *s; + int ret = 0; + + s = bfd_get_section_by_name (abfd, ".sbss2"); + if (s != NULL && (s->flags & SEC_ALLOC) != 0) + ++ret; + + s = bfd_get_section_by_name (abfd, ".PPC.EMB.sbss0"); + if (s != NULL && (s->flags & SEC_ALLOC) != 0) + ++ret; + + return ret; +} + +/* Add extra PPC sections -- Note, for now, make .sbss2 and + .PPC.EMB.sbss0 a normal section, and not a bss section so + that the linker doesn't crater when trying to make more than + 2 sections. */ + +static const struct bfd_elf_special_section ppc_elf_special_sections[] = +{ + { ".plt", 4, 0, SHT_NOBITS, SHF_ALLOC + SHF_EXECINSTR }, + { ".sbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, + { ".sbss2", 6, -2, SHT_PROGBITS, SHF_ALLOC }, + { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, + { ".sdata2", 7, -2, SHT_PROGBITS, SHF_ALLOC }, + { ".tags", 5, 0, SHT_ORDERED, SHF_ALLOC }, + { ".PPC.EMB.apuinfo", 16, 0, SHT_NOTE, 0 }, + { ".PPC.EMB.sbss0", 14, 0, SHT_PROGBITS, SHF_ALLOC }, + { ".PPC.EMB.sdata0", 15, 0, SHT_PROGBITS, SHF_ALLOC }, + { NULL, 0, 0, 0, 0 } +}; + +/* This is what we want for new plt/got. */ +static struct bfd_elf_special_section ppc_alt_plt = + { ".plt", 4, 0, SHT_PROGBITS, SHF_ALLOC }; + +static const struct bfd_elf_special_section * +ppc_elf_get_sec_type_attr (bfd *abfd ATTRIBUTE_UNUSED, asection *sec) +{ + const struct bfd_elf_special_section *ssect; + + /* See if this is one of the special sections. */ + if (sec->name == NULL) + return NULL; + + ssect = _bfd_elf_get_special_section (sec->name, ppc_elf_special_sections, + sec->use_rela_p); + if (ssect != NULL) + { + if (ssect == ppc_elf_special_sections && (sec->flags & SEC_LOAD) != 0) + ssect = &ppc_alt_plt; + return ssect; + } + + return _bfd_elf_get_sec_type_attr (abfd, sec); +} +/* Very simple linked list structure for recording apuinfo values. */ +typedef struct apuinfo_list +{ + struct apuinfo_list *next; + unsigned long value; +} +apuinfo_list; + +static apuinfo_list *head; + + +static void +apuinfo_list_init (void) +{ + head = NULL; +} + +static void +apuinfo_list_add (unsigned long value) +{ + apuinfo_list *entry = head; + + while (entry != NULL) + { + if (entry->value == value) + return; + entry = entry->next; + } + + entry = bfd_malloc (sizeof (* entry)); + if (entry == NULL) + return; + + entry->value = value; + entry->next = head; + head = entry; +} + +static unsigned +apuinfo_list_length (void) +{ + apuinfo_list *entry; + unsigned long count; + + for (entry = head, count = 0; + entry; + entry = entry->next) + ++ count; + + return count; +} + +static inline unsigned long +apuinfo_list_element (unsigned long number) +{ + apuinfo_list * entry; + + for (entry = head; + entry && number --; + entry = entry->next) + ; + + return entry ? entry->value : 0; +} + +static void +apuinfo_list_finish (void) +{ + apuinfo_list *entry; + + for (entry = head; entry;) + { + apuinfo_list *next = entry->next; + free (entry); + entry = next; + } + + head = NULL; +} + +#define APUINFO_SECTION_NAME ".PPC.EMB.apuinfo" +#define APUINFO_LABEL "APUinfo" + +/* Scan the input BFDs and create a linked list of + the APUinfo values that will need to be emitted. */ + +static void +ppc_elf_begin_write_processing (bfd *abfd, struct bfd_link_info *link_info) +{ + bfd *ibfd; + asection *asec; + char *buffer; + unsigned num_input_sections; + bfd_size_type output_section_size; + unsigned i; + unsigned num_entries; + unsigned long offset; + unsigned long length; + const char *error_message = NULL; + + if (link_info == NULL) + return; + + /* Scan the input bfds, looking for apuinfo sections. */ + num_input_sections = 0; + output_section_size = 0; + + for (ibfd = link_info->input_bfds; ibfd; ibfd = ibfd->link_next) + { + asec = bfd_get_section_by_name (ibfd, APUINFO_SECTION_NAME); + if (asec) + { + ++ num_input_sections; + output_section_size += asec->size; + } + } + + /* We need at least one input sections + in order to make merging worthwhile. */ + if (num_input_sections < 1) + return; + + /* Just make sure that the output section exists as well. */ + asec = bfd_get_section_by_name (abfd, APUINFO_SECTION_NAME); + if (asec == NULL) + return; + + /* Allocate a buffer for the contents of the input sections. */ + buffer = bfd_malloc (output_section_size); + if (buffer == NULL) + return; + + offset = 0; + apuinfo_list_init (); + + /* Read in the input sections contents. */ + for (ibfd = link_info->input_bfds; ibfd; ibfd = ibfd->link_next) + { + unsigned long datum; + char *ptr; + + asec = bfd_get_section_by_name (ibfd, APUINFO_SECTION_NAME); + if (asec == NULL) + continue; + + length = asec->size; + if (length < 24) + { + error_message = _("corrupt or empty %s section in %B"); + goto fail; + } + + if (bfd_seek (ibfd, asec->filepos, SEEK_SET) != 0 + || (bfd_bread (buffer + offset, length, ibfd) != length)) + { + error_message = _("unable to read in %s section from %B"); + goto fail; + } + + /* Process the contents of the section. */ + ptr = buffer + offset; + error_message = _("corrupt %s section in %B"); + + /* Verify the contents of the header. Note - we have to + extract the values this way in order to allow for a + host whose endian-ness is different from the target. */ + datum = bfd_get_32 (ibfd, ptr); + if (datum != sizeof APUINFO_LABEL) + goto fail; + + datum = bfd_get_32 (ibfd, ptr + 8); + if (datum != 0x2) + goto fail; + + if (strcmp (ptr + 12, APUINFO_LABEL) != 0) + goto fail; + + /* Get the number of bytes used for apuinfo entries. */ + datum = bfd_get_32 (ibfd, ptr + 4); + if (datum + 20 != length) + goto fail; + + /* Make sure that we do not run off the end of the section. */ + if (offset + length > output_section_size) + goto fail; + + /* Scan the apuinfo section, building a list of apuinfo numbers. */ + for (i = 0; i < datum; i += 4) + apuinfo_list_add (bfd_get_32 (ibfd, ptr + 20 + i)); + + /* Update the offset. */ + offset += length; + } + + error_message = NULL; + + /* Compute the size of the output section. */ + num_entries = apuinfo_list_length (); + output_section_size = 20 + num_entries * 4; + + asec = bfd_get_section_by_name (abfd, APUINFO_SECTION_NAME); + + if (! bfd_set_section_size (abfd, asec, output_section_size)) + ibfd = abfd, + error_message = _("warning: unable to set size of %s section in %B"); + + fail: + free (buffer); + + if (error_message) + (*_bfd_error_handler) (error_message, ibfd, APUINFO_SECTION_NAME); +} + +/* Prevent the output section from accumulating the input sections' + contents. We have already stored this in our linked list structure. */ + +static bfd_boolean +ppc_elf_write_section (bfd *abfd ATTRIBUTE_UNUSED, + asection *asec, + bfd_byte *contents ATTRIBUTE_UNUSED) +{ + return (apuinfo_list_length () + && strcmp (asec->name, APUINFO_SECTION_NAME) == 0); +} + +/* Finally we can generate the output section. */ + +static void +ppc_elf_final_write_processing (bfd *abfd, bfd_boolean linker ATTRIBUTE_UNUSED) +{ + bfd_byte *buffer; + asection *asec; + unsigned i; + unsigned num_entries; + bfd_size_type length; + + asec = bfd_get_section_by_name (abfd, APUINFO_SECTION_NAME); + if (asec == NULL) + return; + + if (apuinfo_list_length () == 0) + return; + + length = asec->size; + if (length < 20) + return; + + buffer = bfd_malloc (length); + if (buffer == NULL) + { + (*_bfd_error_handler) + (_("failed to allocate space for new APUinfo section.")); + return; + } + + /* Create the apuinfo header. */ + num_entries = apuinfo_list_length (); + bfd_put_32 (abfd, sizeof APUINFO_LABEL, buffer); + bfd_put_32 (abfd, num_entries * 4, buffer + 4); + bfd_put_32 (abfd, 0x2, buffer + 8); + strcpy ((char *) buffer + 12, APUINFO_LABEL); + + length = 20; + for (i = 0; i < num_entries; i++) + { + bfd_put_32 (abfd, apuinfo_list_element (i), buffer + length); + length += 4; + } + + if (length != asec->size) + (*_bfd_error_handler) (_("failed to compute new APUinfo section.")); + + if (! bfd_set_section_contents (abfd, asec, buffer, (file_ptr) 0, length)) + (*_bfd_error_handler) (_("failed to install new APUinfo section.")); + + free (buffer); + + apuinfo_list_finish (); +} + +/* The following functions are specific to the ELF linker, while + functions above are used generally. They appear in this file more + or less in the order in which they are called. eg. + ppc_elf_check_relocs is called early in the link process, + ppc_elf_finish_dynamic_sections is one of the last functions + called. */ + +/* The PPC linker needs to keep track of the number of relocs that it + decides to copy as dynamic relocs in check_relocs for each symbol. + This is so that it can later discard them if they are found to be + unnecessary. We store the information in a field extending the + regular ELF linker hash table. */ + +struct ppc_elf_dyn_relocs +{ + struct ppc_elf_dyn_relocs *next; + + /* The input section of the reloc. */ + asection *sec; + + /* Total number of relocs copied for the input section. */ + bfd_size_type count; + + /* Number of pc-relative relocs copied for the input section. */ + bfd_size_type pc_count; +}; + +/* Track PLT entries needed for a given symbol. We might need more + than one glink entry per symbol. */ +struct plt_entry +{ + struct plt_entry *next; + + /* -fPIC uses multiple GOT sections, one per file, called ".got2". + This field stores the offset into .got2 used to initialise the + GOT pointer reg. It will always be at least 32768 (and for + current gcc this is the only offset used). */ + bfd_vma addend; + + /* The .got2 section. */ + asection *sec; + + /* PLT refcount or offset. */ + union + { + bfd_signed_vma refcount; + bfd_vma offset; + } plt; + + /* .glink stub offset. */ + bfd_vma glink_offset; +}; + +/* Of those relocs that might be copied as dynamic relocs, this macro + selects those that must be copied when linking a shared library, + even when the symbol is local. */ + +#define MUST_BE_DYN_RELOC(RTYPE) \ + ((RTYPE) != R_PPC_REL24 \ + && (RTYPE) != R_PPC_REL14 \ + && (RTYPE) != R_PPC_REL14_BRTAKEN \ + && (RTYPE) != R_PPC_REL14_BRNTAKEN \ + && (RTYPE) != R_PPC_REL32) + +/* If ELIMINATE_COPY_RELOCS is non-zero, the linker will try to avoid + copying dynamic variables from a shared lib into an app's dynbss + section, and instead use a dynamic relocation to point into the + shared lib. */ +#define ELIMINATE_COPY_RELOCS 1 + +/* PPC ELF linker hash entry. */ + +struct ppc_elf_link_hash_entry +{ + struct elf_link_hash_entry elf; + + /* If this symbol is used in the linker created sections, the processor + specific backend uses this field to map the field into the offset + from the beginning of the section. */ + elf_linker_section_pointers_t *linker_section_pointer; + + /* Track dynamic relocs copied for this symbol. */ + struct ppc_elf_dyn_relocs *dyn_relocs; + + /* Contexts in which symbol is used in the GOT (or TOC). + TLS_GD .. TLS_TLS bits are or'd into the mask as the + corresponding relocs are encountered during check_relocs. + tls_optimize clears TLS_GD .. TLS_TPREL when optimizing to + indicate the corresponding GOT entry type is not needed. */ +#define TLS_GD 1 /* GD reloc. */ +#define TLS_LD 2 /* LD reloc. */ +#define TLS_TPREL 4 /* TPREL reloc, => IE. */ +#define TLS_DTPREL 8 /* DTPREL reloc, => LD. */ +#define TLS_TLS 16 /* Any TLS reloc. */ +#define TLS_TPRELGD 32 /* TPREL reloc resulting from GD->IE. */ + char tls_mask; + + /* Nonzero if we have seen a small data relocation referring to this + symbol. */ + unsigned char has_sda_refs; +}; + +#define ppc_elf_hash_entry(ent) ((struct ppc_elf_link_hash_entry *) (ent)) + +enum ppc_elf_plt_type { + PLT_UNSET, + PLT_OLD, + PLT_NEW, + PLT_VXWORKS +}; + +/* PPC ELF linker hash table. */ + +struct ppc_elf_link_hash_table +{ + struct elf_link_hash_table elf; + + /* Short-cuts to get to dynamic linker sections. */ + asection *got; + asection *relgot; + asection *glink; + asection *plt; + asection *relplt; + asection *dynbss; + asection *relbss; + asection *dynsbss; + asection *relsbss; + elf_linker_section_t sdata[2]; + asection *sbss; + + /* Shortcut to .__tls_get_addr. */ + struct elf_link_hash_entry *tls_get_addr; + + /* TLS local dynamic got entry handling. */ + union { + bfd_signed_vma refcount; + bfd_vma offset; + } tlsld_got; + + /* Offset of PltResolve function in glink. */ + bfd_vma glink_pltresolve; + + /* Size of reserved GOT entries. */ + unsigned int got_header_size; + /* Non-zero if allocating the header left a gap. */ + unsigned int got_gap; + + /* The type of PLT we have chosen to use. */ + enum ppc_elf_plt_type plt_type; + + /* Whether we can use the new PLT layout. */ + unsigned int can_use_new_plt:1; + + /* Set if we should emit symbols for stubs. */ + unsigned int emit_stub_syms:1; + + /* Small local sym to section mapping cache. */ + struct sym_sec_cache sym_sec; + + /* The (unloaded but important) .rela.plt.unloaded on VxWorks. */ + asection *srelplt2; + + /* The .got.plt section (VxWorks only)*/ + asection *sgotplt; + + /* True if the target system is VxWorks. */ + int is_vxworks; + + /* The size of PLT entries. */ + int plt_entry_size; + /* The distance between adjacent PLT slots. */ + int plt_slot_size; + /* The size of the first PLT entry. */ + int plt_initial_entry_size; +}; + +/* Get the PPC ELF linker hash table from a link_info structure. */ + +#define ppc_elf_hash_table(p) \ + ((struct ppc_elf_link_hash_table *) (p)->hash) + +/* Create an entry in a PPC ELF linker hash table. */ + +static struct bfd_hash_entry * +ppc_elf_link_hash_newfunc (struct bfd_hash_entry *entry, + struct bfd_hash_table *table, + const char *string) +{ + /* Allocate the structure if it has not already been allocated by a + subclass. */ + if (entry == NULL) + { + entry = bfd_hash_allocate (table, + sizeof (struct ppc_elf_link_hash_entry)); + if (entry == NULL) + return entry; + } + + /* Call the allocation method of the superclass. */ + entry = _bfd_elf_link_hash_newfunc (entry, table, string); + if (entry != NULL) + { + ppc_elf_hash_entry (entry)->linker_section_pointer = NULL; + ppc_elf_hash_entry (entry)->dyn_relocs = NULL; + ppc_elf_hash_entry (entry)->tls_mask = 0; + } + + return entry; +} + +/* Create a PPC ELF linker hash table. */ + +static struct bfd_link_hash_table * +ppc_elf_link_hash_table_create (bfd *abfd) +{ + struct ppc_elf_link_hash_table *ret; + + ret = bfd_zmalloc (sizeof (struct ppc_elf_link_hash_table)); + if (ret == NULL) + return NULL; + + if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd, + ppc_elf_link_hash_newfunc, + sizeof (struct ppc_elf_link_hash_entry))) + { + free (ret); + return NULL; + } + + ret->elf.init_plt_refcount.refcount = 0; + ret->elf.init_plt_refcount.glist = NULL; + ret->elf.init_plt_offset.offset = 0; + ret->elf.init_plt_offset.glist = NULL; + + ret->sdata[0].name = ".sdata"; + ret->sdata[0].sym_name = "_SDA_BASE_"; + ret->sdata[0].bss_name = ".sbss"; + + ret->sdata[1].name = ".sdata2"; + ret->sdata[1].sym_name = "_SDA2_BASE_"; + ret->sdata[1].bss_name = ".sbss2"; + + ret->plt_entry_size = 12; + ret->plt_slot_size = 8; + ret->plt_initial_entry_size = 72; + + ret->is_vxworks = 0; + + return &ret->elf.root; +} + +/* Create .got and the related sections. */ + +static bfd_boolean +ppc_elf_create_got (bfd *abfd, struct bfd_link_info *info) +{ + struct ppc_elf_link_hash_table *htab; + asection *s; + flagword flags; + + if (!_bfd_elf_create_got_section (abfd, info)) + return FALSE; + + htab = ppc_elf_hash_table (info); + htab->got = s = bfd_get_section_by_name (abfd, ".got"); + if (s == NULL) + abort (); + + if (htab->is_vxworks) + { + htab->sgotplt = bfd_get_section_by_name (abfd, ".got.plt"); + if (!htab->sgotplt) + abort (); + } + else + { + /* The powerpc .got has a blrl instruction in it. Mark it + executable. */ + flags = (SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS + | SEC_IN_MEMORY | SEC_LINKER_CREATED); + if (!bfd_set_section_flags (abfd, s, flags)) + return FALSE; + } + + flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY + | SEC_LINKER_CREATED | SEC_READONLY); + htab->relgot = bfd_make_section_with_flags (abfd, ".rela.got", flags); + if (!htab->relgot + || ! bfd_set_section_alignment (abfd, htab->relgot, 2)) + return FALSE; + + return TRUE; +} + +/* We have to create .dynsbss and .rela.sbss here so that they get mapped + to output sections (just like _bfd_elf_create_dynamic_sections has + to create .dynbss and .rela.bss). */ + +static bfd_boolean +ppc_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) +{ + struct ppc_elf_link_hash_table *htab; + asection *s; + flagword flags; + + htab = ppc_elf_hash_table (info); + + if (htab->got == NULL + && !ppc_elf_create_got (abfd, info)) + return FALSE; + + if (!_bfd_elf_create_dynamic_sections (abfd, info)) + return FALSE; + + flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_HAS_CONTENTS + | SEC_IN_MEMORY | SEC_LINKER_CREATED); + + s = bfd_make_section_anyway_with_flags (abfd, ".glink", flags | SEC_CODE); + htab->glink = s; + if (s == NULL + || !bfd_set_section_alignment (abfd, s, 4)) + return FALSE; + + htab->dynbss = bfd_get_section_by_name (abfd, ".dynbss"); + s = bfd_make_section_with_flags (abfd, ".dynsbss", + SEC_ALLOC | SEC_LINKER_CREATED); + htab->dynsbss = s; + if (s == NULL) + return FALSE; + + if (! info->shared) + { + htab->relbss = bfd_get_section_by_name (abfd, ".rela.bss"); + s = bfd_make_section_with_flags (abfd, ".rela.sbss", flags); + htab->relsbss = s; + if (s == NULL + || ! bfd_set_section_alignment (abfd, s, 2)) + return FALSE; + } + + if (htab->is_vxworks + && !elf_vxworks_create_dynamic_sections (abfd, info, &htab->srelplt2)) + return FALSE; + + htab->relplt = bfd_get_section_by_name (abfd, ".rela.plt"); + htab->plt = s = bfd_get_section_by_name (abfd, ".plt"); + if (s == NULL) + abort (); + + flags = SEC_ALLOC | SEC_CODE | SEC_LINKER_CREATED; + if (htab->plt_type == PLT_VXWORKS) + /* The VxWorks PLT is a loaded section with contents. */ + flags |= SEC_HAS_CONTENTS | SEC_LOAD | SEC_READONLY; + return bfd_set_section_flags (abfd, s, flags); +} + +/* Copy the extra info we tack onto an elf_link_hash_entry. */ + +static void +ppc_elf_copy_indirect_symbol (struct bfd_link_info *info, + struct elf_link_hash_entry *dir, + struct elf_link_hash_entry *ind) +{ + struct ppc_elf_link_hash_entry *edir, *eind; + + edir = (struct ppc_elf_link_hash_entry *) dir; + eind = (struct ppc_elf_link_hash_entry *) ind; + + if (eind->dyn_relocs != NULL) + { + if (edir->dyn_relocs != NULL) + { + struct ppc_elf_dyn_relocs **pp; + struct ppc_elf_dyn_relocs *p; + + /* Add reloc counts against the indirect sym to the direct sym + list. Merge any entries against the same section. */ + for (pp = &eind->dyn_relocs; (p = *pp) != NULL; ) + { + struct ppc_elf_dyn_relocs *q; + + for (q = edir->dyn_relocs; q != NULL; q = q->next) + if (q->sec == p->sec) + { + q->pc_count += p->pc_count; + q->count += p->count; + *pp = p->next; + break; + } + if (q == NULL) + pp = &p->next; + } + *pp = edir->dyn_relocs; + } + + edir->dyn_relocs = eind->dyn_relocs; + eind->dyn_relocs = NULL; + } + + edir->tls_mask |= eind->tls_mask; + edir->has_sda_refs |= eind->has_sda_refs; + + /* If called to transfer flags for a weakdef during processing + of elf_adjust_dynamic_symbol, don't copy non_got_ref. + We clear it ourselves for ELIMINATE_COPY_RELOCS. */ + if (!(ELIMINATE_COPY_RELOCS + && eind->elf.root.type != bfd_link_hash_indirect + && edir->elf.dynamic_adjusted)) + edir->elf.non_got_ref |= eind->elf.non_got_ref; + + edir->elf.ref_dynamic |= eind->elf.ref_dynamic; + edir->elf.ref_regular |= eind->elf.ref_regular; + edir->elf.ref_regular_nonweak |= eind->elf.ref_regular_nonweak; + edir->elf.needs_plt |= eind->elf.needs_plt; + + /* If we were called to copy over info for a weak sym, that's all. */ + if (eind->elf.root.type != bfd_link_hash_indirect) + return; + + /* Copy over the GOT refcount entries that we may have already seen to + the symbol which just became indirect. */ + edir->elf.got.refcount += eind->elf.got.refcount; + eind->elf.got.refcount = 0; + + /* And plt entries. */ + if (eind->elf.plt.plist != NULL) + { + if (edir->elf.plt.plist != NULL) + { + struct plt_entry **entp; + struct plt_entry *ent; + + for (entp = &eind->elf.plt.plist; (ent = *entp) != NULL; ) + { + struct plt_entry *dent; + + for (dent = edir->elf.plt.plist; dent != NULL; dent = dent->next) + if (dent->sec == ent->sec && dent->addend == ent->addend) + { + dent->plt.refcount += ent->plt.refcount; + *entp = ent->next; + break; + } + if (dent == NULL) + entp = &ent->next; + } + *entp = edir->elf.plt.plist; + } + + edir->elf.plt.plist = eind->elf.plt.plist; + eind->elf.plt.plist = NULL; + } + + if (eind->elf.dynindx != -1) + { + if (edir->elf.dynindx != -1) + _bfd_elf_strtab_delref (elf_hash_table (info)->dynstr, + edir->elf.dynstr_index); + edir->elf.dynindx = eind->elf.dynindx; + edir->elf.dynstr_index = eind->elf.dynstr_index; + eind->elf.dynindx = -1; + eind->elf.dynstr_index = 0; + } +} + +/* Return 1 if target is one of ours. */ + +static bfd_boolean +is_ppc_elf_target (const struct bfd_target *targ) +{ + extern const bfd_target bfd_elf32_powerpc_vec; + extern const bfd_target bfd_elf32_powerpc_vxworks_vec; + extern const bfd_target bfd_elf32_powerpcle_vec; + + return (targ == &bfd_elf32_powerpc_vec + || targ == &bfd_elf32_powerpc_vxworks_vec + || targ == &bfd_elf32_powerpcle_vec); +} + +/* Hook called by the linker routine which adds symbols from an object + file. We use it to put .comm items in .sbss, and not .bss. */ + +static bfd_boolean +ppc_elf_add_symbol_hook (bfd *abfd, + struct bfd_link_info *info, + Elf_Internal_Sym *sym, + const char **namep ATTRIBUTE_UNUSED, + flagword *flagsp ATTRIBUTE_UNUSED, + asection **secp, + bfd_vma *valp) +{ + if (sym->st_shndx == SHN_COMMON + && !info->relocatable + && sym->st_size <= elf_gp_size (abfd) + && is_ppc_elf_target (info->hash->creator)) + { + /* Common symbols less than or equal to -G nn bytes are automatically + put into .sbss. */ + struct ppc_elf_link_hash_table *htab; + + htab = ppc_elf_hash_table (info); + if (htab->sbss == NULL) + { + flagword flags = SEC_IS_COMMON | SEC_LINKER_CREATED; + + if (!htab->elf.dynobj) + htab->elf.dynobj = abfd; + + htab->sbss = bfd_make_section_anyway_with_flags (htab->elf.dynobj, + ".sbss", + flags); + if (htab->sbss == NULL) + return FALSE; + } + + *secp = htab->sbss; + *valp = sym->st_size; + } + + return TRUE; +} + +static bfd_boolean +create_sdata_sym (struct ppc_elf_link_hash_table *htab, + elf_linker_section_t *lsect) +{ + lsect->sym = elf_link_hash_lookup (&htab->elf, lsect->sym_name, + TRUE, FALSE, TRUE); + if (lsect->sym == NULL) + return FALSE; + if (lsect->sym->root.type == bfd_link_hash_new) + lsect->sym->non_elf = 0; + lsect->sym->ref_regular = 1; + return TRUE; +} + +/* Create a special linker section. */ + +static bfd_boolean +ppc_elf_create_linker_section (bfd *abfd, + struct bfd_link_info *info, + flagword flags, + elf_linker_section_t *lsect) +{ + struct ppc_elf_link_hash_table *htab = ppc_elf_hash_table (info); + asection *s; + + flags |= (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY + | SEC_LINKER_CREATED); + + /* Record the first bfd that needs the special sections. */ + if (!htab->elf.dynobj) + htab->elf.dynobj = abfd; + + s = bfd_make_section_anyway_with_flags (htab->elf.dynobj, + lsect->name, + flags); + if (s == NULL + || !bfd_set_section_alignment (htab->elf.dynobj, s, 2)) + return FALSE; + lsect->section = s; + + return create_sdata_sym (htab, lsect); +} + /* Find a linker generated pointer with a given addend and type. */ static elf_linker_section_pointers_t * @@ -2359,12 +2788,11 @@ elf_find_pointer_linker_section return NULL; } - + /* Allocate a pointer to live in a linker created section. */ static bfd_boolean elf_create_pointer_linker_section (bfd *abfd, - struct bfd_link_info *info, elf_linker_section_t *lsect, struct elf_link_hash_entry *h, const Elf_Internal_Rela *rel) @@ -2389,15 +2817,6 @@ elf_create_pointer_linker_section (bfd *abfd, return TRUE; ptr_linker_section_ptr = &eh->linker_section_pointer; - /* Make sure this symbol is output as a dynamic symbol. */ - if (h->dynindx == -1) - { - if (! bfd_elf_link_record_dynamic_symbol (info, h)) - return FALSE; - } - - if (lsect->rel_section) - lsect->rel_section->_raw_size += sizeof (Elf32_External_Rela); } else { @@ -2426,15 +2845,6 @@ elf_create_pointer_linker_section (bfd *abfd, return TRUE; ptr_linker_section_ptr = &ptr[r_symndx]; - - if (info->shared) - { - /* If we are generating a shared object, we need to - output a R__RELATIVE reloc so that the - dynamic linker can adjust this GOT entry. */ - BFD_ASSERT (lsect->rel_section != NULL); - lsect->rel_section->_raw_size += sizeof (Elf32_External_Rela); - } } /* Allocate space for a pointer in the linker section, and allocate @@ -2449,1058 +2859,21 @@ elf_create_pointer_linker_section (bfd *abfd, linker_section_ptr->next = *ptr_linker_section_ptr; linker_section_ptr->addend = rel->r_addend; linker_section_ptr->lsect = lsect; - linker_section_ptr->written_address_p = FALSE; *ptr_linker_section_ptr = linker_section_ptr; - linker_section_ptr->offset = lsect->section->_raw_size; - lsect->section->_raw_size += 4; + linker_section_ptr->offset = lsect->section->size; + lsect->section->size += 4; #ifdef DEBUG fprintf (stderr, "Create pointer in linker section %s, offset = %ld, section size = %ld\n", lsect->name, (long) linker_section_ptr->offset, - (long) lsect->section->_raw_size); + (long) lsect->section->size); #endif return TRUE; } - -#define bfd_put_ptr(BFD, VAL, ADDR) bfd_put_32 (BFD, VAL, ADDR) -/* Fill in the address for a pointer generated in a linker section. */ - -static bfd_vma -elf_finish_pointer_linker_section (bfd *output_bfd, - bfd *input_bfd, - struct bfd_link_info *info, - elf_linker_section_t *lsect, - struct elf_link_hash_entry *h, - bfd_vma relocation, - const Elf_Internal_Rela *rel, - int relative_reloc) -{ - elf_linker_section_pointers_t *linker_section_ptr; - - BFD_ASSERT (lsect != NULL); - - if (h != NULL) - { - /* Handle global symbol. */ - struct ppc_elf_link_hash_entry *eh; - - eh = (struct ppc_elf_link_hash_entry *) h; - linker_section_ptr - = elf_find_pointer_linker_section (eh->linker_section_pointer, - rel->r_addend, - lsect); - - BFD_ASSERT (linker_section_ptr != NULL); - - if (! elf_hash_table (info)->dynamic_sections_created - || (info->shared - && info->symbolic - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))) - { - /* This is actually a static link, or it is a - -Bsymbolic link and the symbol is defined - locally. We must initialize this entry in the - global section. - - When doing a dynamic link, we create a .rela. - relocation entry to initialize the value. This - is done in the finish_dynamic_symbol routine. */ - if (!linker_section_ptr->written_address_p) - { - linker_section_ptr->written_address_p = TRUE; - bfd_put_ptr (output_bfd, - relocation + linker_section_ptr->addend, - (lsect->section->contents - + linker_section_ptr->offset)); - } - } - } - else - { - /* Handle local symbol. */ - unsigned long r_symndx = ELF32_R_SYM (rel->r_info); - BFD_ASSERT (elf_local_ptr_offsets (input_bfd) != NULL); - BFD_ASSERT (elf_local_ptr_offsets (input_bfd)[r_symndx] != NULL); - linker_section_ptr = (elf_find_pointer_linker_section - (elf_local_ptr_offsets (input_bfd)[r_symndx], - rel->r_addend, - lsect)); - - BFD_ASSERT (linker_section_ptr != NULL); - - /* Write out pointer if it hasn't been rewritten out before. */ - if (!linker_section_ptr->written_address_p) - { - linker_section_ptr->written_address_p = TRUE; - bfd_put_ptr (output_bfd, relocation + linker_section_ptr->addend, - lsect->section->contents + linker_section_ptr->offset); - - if (info->shared) - { - /* We need to generate a relative reloc for the dynamic - linker. */ - - asection *srel = lsect->rel_section; - Elf_Internal_Rela outrel[MAX_INT_RELS_PER_EXT_REL]; - bfd_byte *erel; - const struct elf_backend_data *bed; - unsigned int i; - - BFD_ASSERT (srel != NULL); - - bed = get_elf_backend_data (output_bfd); - for (i = 0; i < bed->s->int_rels_per_ext_rel; i++) - { - outrel[i].r_offset = (lsect->section->output_section->vma - + lsect->section->output_offset - + linker_section_ptr->offset); - outrel[i].r_info = 0; - outrel[i].r_addend = 0; - } - outrel[0].r_info = ELF32_R_INFO (0, relative_reloc); - erel = lsect->section->contents; - erel += (elf_section_data (lsect->section)->rel_count++ - * sizeof (Elf32_External_Rela)); - bfd_elf32_swap_reloca_out (output_bfd, outrel, erel); - } - } - } - - relocation = (lsect->section->output_offset - + linker_section_ptr->offset - - lsect->sym_offset); - -#ifdef DEBUG - fprintf (stderr, - "Finish pointer in linker section %s, offset = %ld (0x%lx)\n", - lsect->name, (long) relocation, (long) relocation); -#endif - - /* Subtract out the addend, because it will get added back in by the normal - processing. */ - return relocation - linker_section_ptr->addend; -} - -/* Create a special linker section */ -static elf_linker_section_t * -ppc_elf_create_linker_section (bfd *abfd, - struct bfd_link_info *info, - enum elf_linker_section_enum which) -{ - elf_linker_section_t *lsect; - struct ppc_elf_link_hash_table *htab = ppc_elf_hash_table (info); - asection *s; - bfd_size_type amt; - flagword flags; - const char *name; - const char *rel_name; - const char *sym_name; - bfd_vma sym_offset; - - /* Both of these sections are (technically) created by the user - putting data in them, so they shouldn't be marked - SEC_LINKER_CREATED. - - The linker creates them so it has somewhere to attach their - respective symbols. In fact, if they were empty it would - be OK to leave the symbol set to 0 (or any random number), because - the appropriate register should never be used. */ - flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY; - sym_offset = 32768; - - switch (which) - { - default: - abort (); - return NULL; - - case LINKER_SECTION_SDATA: /* .sdata/.sbss section */ - name = ".sdata"; - rel_name = ".rela.sdata"; - sym_name = "_SDA_BASE_"; - break; - - case LINKER_SECTION_SDATA2: /* .sdata2/.sbss2 section */ - name = ".sdata2"; - rel_name = ".rela.sdata2"; - sym_name = "_SDA2_BASE_"; - flags |= SEC_READONLY; - break; - } - - /* Record the first bfd that needs the special sections. */ - if (!htab->elf.dynobj) - htab->elf.dynobj = abfd; - - amt = sizeof (elf_linker_section_t); - lsect = bfd_zalloc (htab->elf.dynobj, amt); - - lsect->sym_offset = sym_offset; - - /* See if the sections already exist. */ - s = bfd_get_section_by_name (htab->elf.dynobj, name); - if (s == NULL || (s->flags & flags) != flags) - { - s = bfd_make_section_anyway (htab->elf.dynobj, name); - if (s == NULL - || !bfd_set_section_flags (htab->elf.dynobj, s, flags)) - return NULL; - } - lsect->section = s; - - if (bfd_get_section_alignment (htab->elf.dynobj, s) < 2 - && !bfd_set_section_alignment (htab->elf.dynobj, s, 2)) - return NULL; - - s->_raw_size = align_power (s->_raw_size, 2); - -#ifdef DEBUG - fprintf (stderr, "Creating section %s, current size = %ld\n", - name, (long) s->_raw_size); -#endif - - if (sym_name) - { - struct elf_link_hash_entry *h; - struct bfd_link_hash_entry *bh; - -#ifdef DEBUG - fprintf (stderr, "Adding %s to section %s\n", sym_name, name); -#endif - bh = bfd_link_hash_lookup (info->hash, sym_name, - FALSE, FALSE, FALSE); - - if ((bh == NULL || bh->type == bfd_link_hash_undefined) - && !(_bfd_generic_link_add_one_symbol - (info, abfd, sym_name, BSF_GLOBAL, s, sym_offset, NULL, - FALSE, get_elf_backend_data (abfd)->collect, &bh))) - return NULL; - h = (struct elf_link_hash_entry *) bh; - - h->type = STT_OBJECT; - lsect->sym_hash = h; - - if (info->shared - && ! bfd_elf_link_record_dynamic_symbol (info, h)) - return NULL; - } - - if (info->shared) - { - s = bfd_make_section_anyway (htab->elf.dynobj, rel_name); - lsect->rel_section = s; - flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY - | SEC_LINKER_CREATED | SEC_READONLY); - if (s == NULL - || ! bfd_set_section_flags (htab->elf.dynobj, s, flags) - || ! bfd_set_section_alignment (htab->elf.dynobj, s, 2)) - return NULL; - } - - return lsect; -} - -/* If we have a non-zero sized .sbss2 or .PPC.EMB.sbss0 sections, we - need to bump up the number of section headers. */ - -static int -ppc_elf_additional_program_headers (bfd *abfd) -{ - asection *s; - int ret; - - ret = 0; - - s = bfd_get_section_by_name (abfd, ".interp"); - if (s != NULL) - ++ret; - - s = bfd_get_section_by_name (abfd, ".sbss2"); - if (s != NULL && (s->flags & SEC_LOAD) != 0 && s->_raw_size > 0) - ++ret; - - s = bfd_get_section_by_name (abfd, ".PPC.EMB.sbss0"); - if (s != NULL && (s->flags & SEC_LOAD) != 0 && s->_raw_size > 0) - ++ret; - - return ret; -} - -/* Modify the segment map if needed. */ - -static bfd_boolean -ppc_elf_modify_segment_map (bfd *abfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info ATTRIBUTE_UNUSED) -{ - return TRUE; -} - -/* The powerpc .got has a blrl instruction in it. Mark it executable. */ - -static bfd_boolean -ppc_elf_create_got (bfd *abfd, struct bfd_link_info *info) -{ - struct ppc_elf_link_hash_table *htab; - asection *s; - flagword flags; - - if (!_bfd_elf_create_got_section (abfd, info)) - return FALSE; - - htab = ppc_elf_hash_table (info); - htab->got = s = bfd_get_section_by_name (abfd, ".got"); - if (s == NULL) - abort (); - - flags = (SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS | SEC_IN_MEMORY - | SEC_LINKER_CREATED); - if (!bfd_set_section_flags (abfd, s, flags)) - return FALSE; - - htab->relgot = bfd_make_section (abfd, ".rela.got"); - if (!htab->relgot - || ! bfd_set_section_flags (abfd, htab->relgot, - (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS - | SEC_IN_MEMORY | SEC_LINKER_CREATED - | SEC_READONLY)) - || ! bfd_set_section_alignment (abfd, htab->relgot, 2)) - return FALSE; - - return TRUE; -} - -/* We have to create .dynsbss and .rela.sbss here so that they get mapped - to output sections (just like _bfd_elf_create_dynamic_sections has - to create .dynbss and .rela.bss). */ - -static bfd_boolean -ppc_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) -{ - struct ppc_elf_link_hash_table *htab; - asection *s; - flagword flags; - - htab = ppc_elf_hash_table (info); - - if (htab->got == NULL - && !ppc_elf_create_got (abfd, info)) - return FALSE; - - if (!_bfd_elf_create_dynamic_sections (abfd, info)) - return FALSE; - - flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY - | SEC_LINKER_CREATED); - - htab->dynbss = bfd_get_section_by_name (abfd, ".dynbss"); - htab->dynsbss = s = bfd_make_section (abfd, ".dynsbss"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, SEC_ALLOC)) - return FALSE; - - if (! info->shared) - { - htab->relbss = bfd_get_section_by_name (abfd, ".rela.bss"); - htab->relsbss = s = bfd_make_section (abfd, ".rela.sbss"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) - || ! bfd_set_section_alignment (abfd, s, 2)) - return FALSE; - } - - htab->relplt = bfd_get_section_by_name (abfd, ".rela.plt"); - htab->plt = s = bfd_get_section_by_name (abfd, ".plt"); - if (s == NULL) - abort (); - - flags = SEC_ALLOC | SEC_CODE | SEC_IN_MEMORY | SEC_LINKER_CREATED; - return bfd_set_section_flags (abfd, s, flags); -} - -/* Adjust a symbol defined by a dynamic object and referenced by a - regular object. The current definition is in some section of the - dynamic object, but we're not including those sections. We have to - change the definition to something the rest of the link can - understand. */ - -static bfd_boolean -ppc_elf_adjust_dynamic_symbol (struct bfd_link_info *info, - struct elf_link_hash_entry *h) -{ - struct ppc_elf_link_hash_table *htab; - asection *s; - unsigned int power_of_two; - -#ifdef DEBUG - fprintf (stderr, "ppc_elf_adjust_dynamic_symbol called for %s\n", - h->root.root.string); -#endif - - /* Make sure we know what is going on here. */ - htab = ppc_elf_hash_table (info); - BFD_ASSERT (htab->elf.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))); - - /* Deal with function syms. */ - if (h->type == STT_FUNC - || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0) - { - /* Clear procedure linkage table information for any symbol that - won't need a .plt entry. */ - if (h->plt.refcount <= 0 - || SYMBOL_CALLS_LOCAL (info, h) - || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT - && h->root.type == bfd_link_hash_undefweak)) - { - /* A PLT entry is not required/allowed when: - - 1. We are not using ld.so; because then the PLT entry - can't be set up, so we can't use one. In this case, - ppc_elf_adjust_dynamic_symbol won't even be called. - - 2. GC has rendered the entry unused. - - 3. We know for certain that a call to this symbol - will go to this object, or will remain undefined. */ - h->plt.offset = (bfd_vma) -1; - h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; - } - return TRUE; - } - else - h->plt.offset = (bfd_vma) -1; - - /* If this is a weak symbol, and there is a real definition, the - processor independent code will have arranged for us to see the - real definition first, and we can just use the same value. */ - if (h->weakdef != NULL) - { - BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined - || h->weakdef->root.type == bfd_link_hash_defweak); - h->root.u.def.section = h->weakdef->root.u.def.section; - h->root.u.def.value = h->weakdef->root.u.def.value; - if (ELIMINATE_COPY_RELOCS) - h->elf_link_hash_flags - = ((h->elf_link_hash_flags & ~ELF_LINK_NON_GOT_REF) - | (h->weakdef->elf_link_hash_flags & ELF_LINK_NON_GOT_REF)); - return TRUE; - } - - /* This is a reference to a symbol defined by a dynamic object which - is not a function. */ - - /* If we are creating a shared library, we must presume that the - only references to the symbol are via the global offset table. - For such cases we need not do anything here; the relocations will - be handled correctly by relocate_section. */ - if (info->shared) - return TRUE; - - /* If there are no references to this symbol that do not use the - GOT, we don't need to generate a copy reloc. */ - if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0) - return TRUE; - - if (ELIMINATE_COPY_RELOCS) - { - struct ppc_elf_dyn_relocs *p; - for (p = ppc_elf_hash_entry (h)->dyn_relocs; p != NULL; p = p->next) - { - s = p->sec->output_section; - if (s != NULL && (s->flags & SEC_READONLY) != 0) - break; - } - - /* If we didn't find any dynamic relocs in read-only sections, then - we'll be keeping the dynamic relocs and avoiding the copy reloc. */ - if (p == NULL) - { - h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF; - return TRUE; - } - } - - /* We must allocate the symbol in our .dynbss section, which will - become part of the .bss section of the executable. There will be - an entry for this symbol in the .dynsym section. The dynamic - object will contain position independent code, so all references - from the dynamic object to this symbol will go through the global - offset table. The dynamic linker will use the .dynsym entry to - determine the address it must put in the global offset table, so - both the dynamic object and the regular object will refer to the - same memory location for the variable. - - Of course, if the symbol is sufficiently small, we must instead - allocate it in .sbss. FIXME: It would be better to do this if and - only if there were actually SDAREL relocs for that symbol. */ - - if (h->size <= elf_gp_size (htab->elf.dynobj)) - s = htab->dynsbss; - else - s = htab->dynbss; - BFD_ASSERT (s != NULL); - - /* We must generate a R_PPC_COPY reloc to tell the dynamic linker to - copy the initial value out of the dynamic object and into the - runtime process image. We need to remember the offset into the - .rela.bss section we are going to use. */ - if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) - { - asection *srel; - - if (h->size <= elf_gp_size (htab->elf.dynobj)) - srel = htab->relsbss; - else - srel = htab->relbss; - BFD_ASSERT (srel != NULL); - srel->_raw_size += sizeof (Elf32_External_Rela); - h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY; - } - - /* We need to figure out the alignment required for this symbol. I - have no idea how ELF linkers handle this. */ - power_of_two = bfd_log2 (h->size); - if (power_of_two > 4) - power_of_two = 4; - - /* Apply the required alignment. */ - s->_raw_size = BFD_ALIGN (s->_raw_size, - (bfd_size_type) (1 << power_of_two)); - if (power_of_two > bfd_get_section_alignment (htab->elf.dynobj, s)) - { - if (! bfd_set_section_alignment (htab->elf.dynobj, s, power_of_two)) - return FALSE; - } - - /* Define the symbol as being at this point in the section. */ - h->root.u.def.section = s; - h->root.u.def.value = s->_raw_size; - - /* Increment the section size to make room for the symbol. */ - s->_raw_size += h->size; - - return TRUE; -} - -/* Of those relocs that might be copied as dynamic relocs, this macro - selects those that must be copied when linking a shared library, - even when the symbol is local. */ - -#define MUST_BE_DYN_RELOC(RTYPE) \ - ((RTYPE) != R_PPC_REL24 \ - && (RTYPE) != R_PPC_REL14 \ - && (RTYPE) != R_PPC_REL14_BRTAKEN \ - && (RTYPE) != R_PPC_REL14_BRNTAKEN \ - && (RTYPE) != R_PPC_REL32) - -/* Allocate space in associated reloc sections for dynamic relocs. */ - -static bfd_boolean -allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) -{ - struct bfd_link_info *info = inf; - struct ppc_elf_link_hash_entry *eh; - struct ppc_elf_link_hash_table *htab; - struct ppc_elf_dyn_relocs *p; - - if (h->root.type == bfd_link_hash_indirect) - return TRUE; - - if (h->root.type == bfd_link_hash_warning) - /* When warning symbols are created, they **replace** the "real" - entry in the hash table, thus we never get to see the real - symbol in a hash traversal. So look at it now. */ - h = (struct elf_link_hash_entry *) h->root.u.i.link; - - htab = ppc_elf_hash_table (info); - if (htab->elf.dynamic_sections_created - && h->plt.refcount > 0) - { - /* Make sure this symbol is output as a dynamic symbol. */ - if (h->dynindx == -1 - && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) - { - if (! bfd_elf_link_record_dynamic_symbol (info, h)) - return FALSE; - } - - if (info->shared - || WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h)) - { - asection *s = htab->plt; - - /* If this is the first .plt entry, make room for the special - first entry. */ - if (s->_raw_size == 0) - s->_raw_size += PLT_INITIAL_ENTRY_SIZE; - - /* The PowerPC PLT is actually composed of two parts, the - first part is 2 words (for a load and a jump), and then - there is a remaining word available at the end. */ - h->plt.offset = (PLT_INITIAL_ENTRY_SIZE - + (PLT_SLOT_SIZE - * ((s->_raw_size - PLT_INITIAL_ENTRY_SIZE) - / PLT_ENTRY_SIZE))); - - /* If this symbol is not defined in a regular file, and we - are not generating a shared library, then set the symbol - to this location in the .plt. This is required to make - function pointers compare as equal between the normal - executable and the shared library. */ - if (! info->shared - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) - { - h->root.u.def.section = s; - h->root.u.def.value = h->plt.offset; - } - - /* Make room for this entry. After the 8192nd entry, room - for two entries is allocated. */ - s->_raw_size += PLT_ENTRY_SIZE; - if ((s->_raw_size - PLT_INITIAL_ENTRY_SIZE) / PLT_ENTRY_SIZE - > PLT_NUM_SINGLE_ENTRIES) - s->_raw_size += PLT_ENTRY_SIZE; - - /* We also need to make an entry in the .rela.plt section. */ - htab->relplt->_raw_size += sizeof (Elf32_External_Rela); - } - else - { - h->plt.offset = (bfd_vma) -1; - h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; - } - } - else - { - h->plt.offset = (bfd_vma) -1; - h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; - } - - eh = (struct ppc_elf_link_hash_entry *) h; - if (eh->elf.got.refcount > 0) - { - /* Make sure this symbol is output as a dynamic symbol. */ - if (eh->elf.dynindx == -1 - && (eh->elf.elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) - { - if (!bfd_elf_link_record_dynamic_symbol (info, &eh->elf)) - return FALSE; - } - - if (eh->tls_mask == (TLS_TLS | TLS_LD) - && !(eh->elf.elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC)) - /* If just an LD reloc, we'll just use htab->tlsld_got.offset. */ - eh->elf.got.offset = (bfd_vma) -1; - else - { - bfd_boolean dyn; - eh->elf.got.offset = htab->got->_raw_size; - if ((eh->tls_mask & TLS_TLS) != 0) - { - if ((eh->tls_mask & TLS_LD) != 0) - htab->got->_raw_size += 8; - if ((eh->tls_mask & TLS_GD) != 0) - htab->got->_raw_size += 8; - if ((eh->tls_mask & (TLS_TPREL | TLS_TPRELGD)) != 0) - htab->got->_raw_size += 4; - if ((eh->tls_mask & TLS_DTPREL) != 0) - htab->got->_raw_size += 4; - } - else - htab->got->_raw_size += 4; - dyn = htab->elf.dynamic_sections_created; - if ((info->shared - || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, &eh->elf)) - && (ELF_ST_VISIBILITY (eh->elf.other) == STV_DEFAULT - || eh->elf.root.type != bfd_link_hash_undefweak)) - { - /* All the entries we allocated need relocs. */ - htab->relgot->_raw_size - += ((htab->got->_raw_size - eh->elf.got.offset) / 4 - * sizeof (Elf32_External_Rela)); - /* Except LD only needs one. */ - if ((eh->tls_mask & TLS_LD) != 0) - htab->relgot->_raw_size -= sizeof (Elf32_External_Rela); - } - } - } - else - eh->elf.got.offset = (bfd_vma) -1; - - if (eh->dyn_relocs == NULL) - return TRUE; - - /* In the shared -Bsymbolic case, discard space allocated for - dynamic pc-relative relocs against symbols which turn out to be - defined in regular objects. For the normal shared case, discard - space for relocs that have become local due to symbol visibility - changes. */ - - if (info->shared) - { - /* Relocs that use pc_count are those that appear on a call insn, - or certain REL relocs (see MUST_BE_DYN_RELOC) that can be - generated via assembly. We want calls to protected symbols to - resolve directly to the function rather than going via the plt. - If people want function pointer comparisons to work as expected - then they should avoid writing weird assembly. */ - if (SYMBOL_CALLS_LOCAL (info, h)) - { - struct ppc_elf_dyn_relocs **pp; - - for (pp = &eh->dyn_relocs; (p = *pp) != NULL; ) - { - p->count -= p->pc_count; - p->pc_count = 0; - if (p->count == 0) - *pp = p->next; - else - pp = &p->next; - } - } - - /* Also discard relocs on undefined weak syms with non-default - visibility. */ - if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT - && h->root.type == bfd_link_hash_undefweak) - eh->dyn_relocs = NULL; - - /* Make sure undefined weak symbols are output as a dynamic symbol - in PIEs. */ - if (info->pie - && eh->dyn_relocs != NULL - && h->dynindx == -1 - && h->root.type == bfd_link_hash_undefweak - && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) - { - if (! bfd_elf_link_record_dynamic_symbol (info, h)) - return FALSE; - } - } - else if (ELIMINATE_COPY_RELOCS) - { - /* For the non-shared case, discard space for relocs against - symbols which turn out to need copy relocs or are not - dynamic. */ - - if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) - { - /* Make sure this symbol is output as a dynamic symbol. - Undefined weak syms won't yet be marked as dynamic. */ - if (h->dynindx == -1 - && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) - { - if (! bfd_elf_link_record_dynamic_symbol (info, h)) - return FALSE; - } - - /* If that succeeded, we know we'll be keeping all the - relocs. */ - if (h->dynindx != -1) - goto keep; - } - - eh->dyn_relocs = NULL; - - keep: ; - } - - /* Finally, allocate space. */ - for (p = eh->dyn_relocs; p != NULL; p = p->next) - { - asection *sreloc = elf_section_data (p->sec)->sreloc; - sreloc->_raw_size += p->count * sizeof (Elf32_External_Rela); - } - - return TRUE; -} - -/* Find any dynamic relocs that apply to read-only sections. */ - -static bfd_boolean -readonly_dynrelocs (struct elf_link_hash_entry *h, void *info) -{ - struct ppc_elf_dyn_relocs *p; - - if (h->root.type == bfd_link_hash_indirect) - return TRUE; - - if (h->root.type == bfd_link_hash_warning) - h = (struct elf_link_hash_entry *) h->root.u.i.link; - - for (p = ppc_elf_hash_entry (h)->dyn_relocs; p != NULL; p = p->next) - { - asection *s = p->sec->output_section; - - if (s != NULL - && ((s->flags & (SEC_READONLY | SEC_ALLOC)) - == (SEC_READONLY | SEC_ALLOC))) - { - ((struct bfd_link_info *) info)->flags |= DF_TEXTREL; - - /* Not an error, just cut short the traversal. */ - return FALSE; - } - } - return TRUE; -} - -/* Set the sizes of the dynamic sections. */ - -static bfd_boolean -ppc_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info) -{ - struct ppc_elf_link_hash_table *htab; - asection *s; - bfd_boolean relocs; - bfd *ibfd; - -#ifdef DEBUG - fprintf (stderr, "ppc_elf_size_dynamic_sections called\n"); -#endif - - htab = ppc_elf_hash_table (info); - BFD_ASSERT (htab->elf.dynobj != NULL); - - if (elf_hash_table (info)->dynamic_sections_created) - { - /* Set the contents of the .interp section to the interpreter. */ - if (info->executable) - { - s = bfd_get_section_by_name (htab->elf.dynobj, ".interp"); - BFD_ASSERT (s != NULL); - s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER; - s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER; - } - } - - if (htab->tlsld_got.refcount > 0) - { - htab->tlsld_got.offset = htab->got->_raw_size; - htab->got->_raw_size += 8; - if (info->shared) - htab->relgot->_raw_size += sizeof (Elf32_External_Rela); - } - else - htab->tlsld_got.offset = (bfd_vma) -1; - - /* Set up .got offsets for local syms, and space for local dynamic - relocs. */ - for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) - { - bfd_signed_vma *local_got; - bfd_signed_vma *end_local_got; - char *lgot_masks; - bfd_size_type locsymcount; - Elf_Internal_Shdr *symtab_hdr; - asection *srel; - - if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour) - continue; - - for (s = ibfd->sections; s != NULL; s = s->next) - { - struct ppc_elf_dyn_relocs *p; - - for (p = ((struct ppc_elf_dyn_relocs *) - elf_section_data (s)->local_dynrel); - p != NULL; - p = p->next) - { - if (!bfd_is_abs_section (p->sec) - && bfd_is_abs_section (p->sec->output_section)) - { - /* Input section has been discarded, either because - it is a copy of a linkonce section or due to - linker script /DISCARD/, so we'll be discarding - the relocs too. */ - } - else if (p->count != 0) - { - elf_section_data (p->sec)->sreloc->_raw_size - += p->count * sizeof (Elf32_External_Rela); - if ((p->sec->output_section->flags - & (SEC_READONLY | SEC_ALLOC)) - == (SEC_READONLY | SEC_ALLOC)) - info->flags |= DF_TEXTREL; - } - } - } - - local_got = elf_local_got_refcounts (ibfd); - if (!local_got) - continue; - - symtab_hdr = &elf_tdata (ibfd)->symtab_hdr; - locsymcount = symtab_hdr->sh_info; - end_local_got = local_got + locsymcount; - lgot_masks = (char *) end_local_got; - s = htab->got; - srel = htab->relgot; - for (; local_got < end_local_got; ++local_got, ++lgot_masks) - if (*local_got > 0) - { - if (*lgot_masks == (TLS_TLS | TLS_LD)) - { - /* If just an LD reloc, we'll just use - htab->tlsld_got.offset. */ - if (htab->tlsld_got.offset == (bfd_vma) -1) - { - htab->tlsld_got.offset = s->_raw_size; - s->_raw_size += 8; - if (info->shared) - srel->_raw_size += sizeof (Elf32_External_Rela); - } - *local_got = (bfd_vma) -1; - } - else - { - *local_got = s->_raw_size; - if ((*lgot_masks & TLS_TLS) != 0) - { - if ((*lgot_masks & TLS_GD) != 0) - s->_raw_size += 8; - if ((*lgot_masks & (TLS_TPREL | TLS_TPRELGD)) != 0) - s->_raw_size += 4; - if ((*lgot_masks & TLS_DTPREL) != 0) - s->_raw_size += 4; - } - else - s->_raw_size += 4; - if (info->shared) - srel->_raw_size += ((s->_raw_size - *local_got) / 4 - * sizeof (Elf32_External_Rela)); - } - } - else - *local_got = (bfd_vma) -1; - } - - /* Allocate space for global sym dynamic relocs. */ - elf_link_hash_traverse (elf_hash_table (info), allocate_dynrelocs, info); - - /* We've now determined the sizes of the various dynamic sections. - Allocate memory for them. */ - relocs = FALSE; - for (s = htab->elf.dynobj->sections; s != NULL; s = s->next) - { - if ((s->flags & SEC_LINKER_CREATED) == 0) - continue; - - if (s == htab->plt - || s == htab->got - || (htab->sdata != NULL && s == htab->sdata->section) - || (htab->sdata2 != NULL && s == htab->sdata2->section)) - { - /* Strip this section if we don't need it; see the - comment below. */ - } - else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0) - { - if (s->_raw_size == 0) - { - /* If we don't need this section, strip it from the - output file. This is mostly to handle .rela.bss and - .rela.plt. We must create both sections in - create_dynamic_sections, because they must be created - before the linker maps input sections to output - sections. The linker does that before - adjust_dynamic_symbol is called, and it is that - function which decides whether anything needs to go - into these sections. */ - } - else - { - /* Remember whether there are any relocation sections. */ - relocs = TRUE; - - /* We use the reloc_count field as a counter if we need - to copy relocs into the output file. */ - s->reloc_count = 0; - } - } - else - { - /* It's not one of our sections, so don't allocate space. */ - continue; - } - - if (s->_raw_size == 0) - { - _bfd_strip_section_from_output (info, s); - continue; - } - - /* Allocate memory for the section contents. */ - s->contents = bfd_zalloc (htab->elf.dynobj, s->_raw_size); - if (s->contents == NULL) - return FALSE; - } - - if (htab->elf.dynamic_sections_created) - { - /* Add some entries to the .dynamic section. We fill in the - values later, in ppc_elf_finish_dynamic_sections, but we - must add the entries now so that we get the correct size for - the .dynamic section. The DT_DEBUG entry is filled in by the - dynamic linker and used by the debugger. */ -#define add_dynamic_entry(TAG, VAL) \ - _bfd_elf_add_dynamic_entry (info, TAG, VAL) - - if (info->executable) - { - if (!add_dynamic_entry (DT_DEBUG, 0)) - return FALSE; - } - - if (htab->plt != NULL && htab->plt->_raw_size != 0) - { - if (!add_dynamic_entry (DT_PLTGOT, 0) - || !add_dynamic_entry (DT_PLTRELSZ, 0) - || !add_dynamic_entry (DT_PLTREL, DT_RELA) - || !add_dynamic_entry (DT_JMPREL, 0)) - return FALSE; - } - - if (relocs) - { - if (!add_dynamic_entry (DT_RELA, 0) - || !add_dynamic_entry (DT_RELASZ, 0) - || !add_dynamic_entry (DT_RELAENT, sizeof (Elf32_External_Rela))) - return FALSE; - } - - /* If any dynamic relocs apply to a read-only section, then we - need a DT_TEXTREL entry. */ - if ((info->flags & DF_TEXTREL) == 0) - elf_link_hash_traverse (elf_hash_table (info), readonly_dynrelocs, - info); - - if ((info->flags & DF_TEXTREL) != 0) - { - if (!add_dynamic_entry (DT_TEXTREL, 0)) - return FALSE; - } - } -#undef add_dynamic_entry - - return TRUE; -} - static bfd_boolean update_local_sym_info (bfd *abfd, Elf_Internal_Shdr *symtab_hdr, @@ -3527,12 +2900,52 @@ update_local_sym_info (bfd *abfd, return TRUE; } +static bfd_boolean +update_plt_info (bfd *abfd, struct elf_link_hash_entry *h, + asection *sec, bfd_vma addend) +{ + struct plt_entry *ent; + + if (addend < 32768) + sec = NULL; + for (ent = h->plt.plist; ent != NULL; ent = ent->next) + if (ent->sec == sec && ent->addend == addend) + break; + if (ent == NULL) + { + bfd_size_type amt = sizeof (*ent); + ent = bfd_alloc (abfd, amt); + if (ent == NULL) + return FALSE; + ent->next = h->plt.plist; + ent->sec = sec; + ent->addend = addend; + ent->plt.refcount = 0; + h->plt.plist = ent; + } + ent->plt.refcount += 1; + return TRUE; +} + +static struct plt_entry * +find_plt_ent (struct elf_link_hash_entry *h, asection *sec, bfd_vma addend) +{ + struct plt_entry *ent; + + if (addend < 32768) + sec = NULL; + for (ent = h->plt.plist; ent != NULL; ent = ent->next) + if (ent->sec == sec && ent->addend == addend) + break; + return ent; +} + static void bad_shared_reloc (bfd *abfd, enum elf_ppc_reloc_type r_type) { (*_bfd_error_handler) - (_("%s: relocation %s cannot be used when making a shared object"), - bfd_archive_filename (abfd), + (_("%B: relocation %s cannot be used when making a shared object"), + abfd, ppc_elf_howto_table[r_type]->name); bfd_set_error (bfd_error_bad_value); } @@ -3552,42 +2965,33 @@ ppc_elf_check_relocs (bfd *abfd, struct elf_link_hash_entry **sym_hashes; const Elf_Internal_Rela *rel; const Elf_Internal_Rela *rel_end; - asection *sreloc; + asection *got2, *sreloc; if (info->relocatable) return TRUE; + /* Don't do anything special with non-loaded, non-alloced sections. + In particular, any relocs in such sections should not affect GOT + and PLT reference counting (ie. we don't allow them to create GOT + or PLT entries), there's no possibility or desire to optimize TLS + relocs, and there's not much point in propagating relocs to shared + libs that the dynamic linker won't relocate. */ + if ((sec->flags & SEC_ALLOC) == 0) + return TRUE; + #ifdef DEBUG - fprintf (stderr, "ppc_elf_check_relocs called for section %s in %s\n", - bfd_get_section_name (abfd, sec), - bfd_archive_filename (abfd)); + _bfd_error_handler ("ppc_elf_check_relocs called for section %A in %B", + sec, abfd); #endif /* Initialize howto table if not already done. */ if (!ppc_elf_howto_table[R_PPC_ADDR32]) ppc_elf_howto_init (); - /* Create the linker generated sections all the time so that the - special symbols are created. */ htab = ppc_elf_hash_table (info); - if (htab->sdata == NULL) - { - htab->sdata = ppc_elf_create_linker_section (abfd, info, - LINKER_SECTION_SDATA); - if (htab->sdata == NULL) - return FALSE; - } - - if (htab->sdata2 == NULL) - { - htab->sdata2 = ppc_elf_create_linker_section (abfd, info, - LINKER_SECTION_SDATA2); - if (htab->sdata2 == NULL) - return FALSE; - } - symtab_hdr = &elf_tdata (abfd)->symtab_hdr; sym_hashes = elf_sym_hashes (abfd); + got2 = bfd_get_section_by_name (abfd, ".got2"); sreloc = NULL; rel_end = relocs + sec->reloc_count; @@ -3602,20 +3006,25 @@ ppc_elf_check_relocs (bfd *abfd, if (r_symndx < symtab_hdr->sh_info) h = NULL; else - h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + { + 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 a relocation refers to _GLOBAL_OFFSET_TABLE_, create the .got. This shows up in particular in an R_PPC_ADDR32 in the eabi startup code. */ - if (h && strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0) + if (h != NULL + && htab->got == NULL + && strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0) { - if (htab->got == NULL) - { - if (htab->elf.dynobj == NULL) - htab->elf.dynobj = abfd; - if (!ppc_elf_create_got (htab->elf.dynobj, info)) - return FALSE; - } + if (htab->elf.dynobj == NULL) + htab->elf.dynobj = abfd; + if (!ppc_elf_create_got (htab->elf.dynobj, info)) + return FALSE; + BFD_ASSERT (h == htab->elf.hgot); } r_type = ELF32_R_TYPE (rel->r_info); @@ -3685,9 +3094,18 @@ ppc_elf_check_relocs (bfd *abfd, bad_shared_reloc (abfd, r_type); return FALSE; } - if (!elf_create_pointer_linker_section (abfd, info, - htab->sdata, h, rel)) + if (htab->sdata[0].section == NULL + && !ppc_elf_create_linker_section (abfd, info, 0, + &htab->sdata[0])) return FALSE; + if (!elf_create_pointer_linker_section (abfd, &htab->sdata[0], + h, rel)) + return FALSE; + if (h != NULL) + { + ppc_elf_hash_entry (h)->has_sda_refs = TRUE; + h->non_got_ref = TRUE; + } break; /* Indirect .sdata2 relocation. */ @@ -3697,15 +3115,72 @@ ppc_elf_check_relocs (bfd *abfd, bad_shared_reloc (abfd, r_type); return FALSE; } - if (!elf_create_pointer_linker_section (abfd, info, - htab->sdata2, h, rel)) + if (htab->sdata[1].section == NULL + && !ppc_elf_create_linker_section (abfd, info, SEC_READONLY, + &htab->sdata[1])) return FALSE; + if (!elf_create_pointer_linker_section (abfd, &htab->sdata[1], + h, rel)) + return FALSE; + if (h != NULL) + { + ppc_elf_hash_entry (h)->has_sda_refs = TRUE; + h->non_got_ref = TRUE; + } break; case R_PPC_SDAREL16: + if (info->shared) + { + bad_shared_reloc (abfd, r_type); + return FALSE; + } + if (htab->sdata[0].sym == NULL + && !create_sdata_sym (htab, &htab->sdata[0])) + return FALSE; + if (h != NULL) + { + ppc_elf_hash_entry (h)->has_sda_refs = TRUE; + h->non_got_ref = TRUE; + } + break; + case R_PPC_EMB_SDA2REL: + if (info->shared) + { + bad_shared_reloc (abfd, r_type); + return FALSE; + } + if (htab->sdata[1].sym == NULL + && !create_sdata_sym (htab, &htab->sdata[1])) + return FALSE; + if (h != NULL) + { + ppc_elf_hash_entry (h)->has_sda_refs = TRUE; + h->non_got_ref = TRUE; + } + break; + case R_PPC_EMB_SDA21: case R_PPC_EMB_RELSDA: + if (info->shared) + { + bad_shared_reloc (abfd, r_type); + return FALSE; + } + if (htab->sdata[0].sym == NULL + && !create_sdata_sym (htab, &htab->sdata[0])) + return FALSE; + if (htab->sdata[1].sym == NULL + && !create_sdata_sym (htab, &htab->sdata[1])) + return FALSE; + if (h != NULL) + { + ppc_elf_hash_entry (h)->has_sda_refs = TRUE; + h->non_got_ref = TRUE; + } + break; + case R_PPC_EMB_NADDR32: case R_PPC_EMB_NADDR16: case R_PPC_EMB_NADDR16_LO: @@ -3716,6 +3191,8 @@ ppc_elf_check_relocs (bfd *abfd, bad_shared_reloc (abfd, r_type); return FALSE; } + if (h != NULL) + h->non_got_ref = TRUE; break; case R_PPC_PLT32: @@ -3737,18 +3214,23 @@ ppc_elf_check_relocs (bfd *abfd, { /* It does not make sense to have a procedure linkage table entry for a local symbol. */ - (*_bfd_error_handler) (_("%s(%s+0x%lx): %s reloc against " + (*_bfd_error_handler) (_("%B(%A+0x%lx): %s reloc against " "local symbol"), - bfd_archive_filename (abfd), - sec->name, + abfd, + sec, (long) rel->r_offset, ppc_elf_howto_table[r_type]->name); bfd_set_error (bfd_error_bad_value); return FALSE; } + else + { + bfd_vma addend = r_type == R_PPC_PLTREL24 ? rel->r_addend : 0; - h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; - h->plt.refcount++; + h->needs_plt = 1; + if (!update_plt_info (abfd, h, got2, addend)) + return FALSE; + } break; /* The following relocations don't need to propagate the @@ -3765,7 +3247,14 @@ ppc_elf_check_relocs (bfd *abfd, case R_PPC_TOC16: break; - /* This are just markers. */ + case R_PPC_REL16: + case R_PPC_REL16_LO: + case R_PPC_REL16_HI: + case R_PPC_REL16_HA: + htab->can_use_new_plt = 1; + break; + + /* These are just markers. */ case R_PPC_TLS: case R_PPC_EMB_MRKREF: case R_PPC_NONE: @@ -3790,6 +3279,8 @@ ppc_elf_check_relocs (bfd *abfd, /* This refers only to functions defined in the shared library. */ case R_PPC_LOCAL24PC: + if (h && h == htab->elf.hgot && htab->plt_type == PLT_UNSET) + htab->plt_type = PLT_OLD; break; /* This relocation describes the C++ object vtable hierarchy. @@ -3825,17 +3316,42 @@ ppc_elf_check_relocs (bfd *abfd, info->flags |= DF_STATIC_TLS; goto dodyn; - /* When creating a shared object, we must copy these - relocs into the output file. We create a reloc - section in dynobj and make room for the reloc. */ + case R_PPC_REL32: + if (h == NULL + && got2 != NULL + && (sec->flags & SEC_CODE) != 0 + && (info->shared || info->pie) + && htab->plt_type == PLT_UNSET) + { + /* Old -fPIC gcc code has .long LCTOC1-LCFx just before + the start of a function, which assembles to a REL32 + reference to .got2. If we detect one of these, then + force the old PLT layout because the linker cannot + reliably deduce the GOT pointer value needed for + PLT call stubs. */ + asection *s; + + s = bfd_section_from_r_symndx (abfd, &htab->sym_sec, sec, + r_symndx); + if (s == got2) + htab->plt_type = PLT_OLD; + } + if (h == NULL || h == htab->elf.hgot) + break; + goto dodyn1; + case R_PPC_REL24: case R_PPC_REL14: case R_PPC_REL14_BRTAKEN: case R_PPC_REL14_BRNTAKEN: - case R_PPC_REL32: - if (h == NULL - || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0) + if (h == NULL) break; + if (h == htab->elf.hgot) + { + if (htab->plt_type == PLT_UNSET) + htab->plt_type = PLT_OLD; + break; + } /* fall through */ case R_PPC_ADDR32: @@ -3849,14 +3365,16 @@ ppc_elf_check_relocs (bfd *abfd, case R_PPC_ADDR14_BRNTAKEN: case R_PPC_UADDR32: case R_PPC_UADDR16: + dodyn1: if (h != NULL && !info->shared) { /* We may need a plt entry if the symbol turns out to be a function defined in a dynamic object. */ - h->plt.refcount++; + if (!update_plt_info (abfd, h, NULL, 0)) + return FALSE; /* We may need a copy reloc too. */ - h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF; + h->non_got_ref = 1; } dodyn: @@ -3886,15 +3404,12 @@ ppc_elf_check_relocs (bfd *abfd, || (h != NULL && (! info->symbolic || h->root.type == bfd_link_hash_defweak - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0)))) + || !h->def_regular)))) || (ELIMINATE_COPY_RELOCS && !info->shared - && (sec->flags & SEC_ALLOC) != 0 && h != NULL && (h->root.type == bfd_link_hash_defweak - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0))) + || !h->def_regular))) { struct ppc_elf_dyn_relocs *p; struct ppc_elf_dyn_relocs **head; @@ -3921,19 +3436,20 @@ ppc_elf_check_relocs (bfd *abfd, && strcmp (bfd_get_section_name (abfd, sec), name + 5) == 0); + if (htab->elf.dynobj == NULL) + htab->elf.dynobj = abfd; sreloc = bfd_get_section_by_name (htab->elf.dynobj, name); if (sreloc == NULL) { flagword flags; - sreloc = bfd_make_section (htab->elf.dynobj, name); flags = (SEC_HAS_CONTENTS | SEC_READONLY - | SEC_IN_MEMORY | SEC_LINKER_CREATED); - if ((sec->flags & SEC_ALLOC) != 0) - flags |= SEC_ALLOC | SEC_LOAD; + | SEC_IN_MEMORY | SEC_LINKER_CREATED + | SEC_ALLOC | SEC_LOAD); + sreloc = bfd_make_section_with_flags (htab->elf.dynobj, + name, + flags); if (sreloc == NULL - || ! bfd_set_section_flags (htab->elf.dynobj, - sreloc, flags) || ! bfd_set_section_alignment (htab->elf.dynobj, sreloc, 2)) return FALSE; @@ -3954,13 +3470,15 @@ ppc_elf_check_relocs (bfd *abfd, easily. Oh well. */ asection *s; + void *vpp; + s = bfd_section_from_r_symndx (abfd, &htab->sym_sec, sec, r_symndx); if (s == NULL) return FALSE; - head = ((struct ppc_elf_dyn_relocs **) - &elf_section_data (s)->local_dynrel); + vpp = &elf_section_data (s)->local_dynrel; + head = (struct ppc_elf_dyn_relocs **) vpp; } p = *head; @@ -3987,7 +3505,145 @@ ppc_elf_check_relocs (bfd *abfd, return TRUE; } + +/* Merge backend specific data from an object file to the output + object file when linking. */ +static bfd_boolean +ppc_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) +{ + flagword old_flags; + flagword new_flags; + bfd_boolean error; + + if (!is_ppc_elf_target (ibfd->xvec) + || !is_ppc_elf_target (obfd->xvec)) + return TRUE; + + /* Check if we have the same endianess. */ + if (! _bfd_generic_verify_endian_match (ibfd, obfd)) + return FALSE; + + new_flags = elf_elfheader (ibfd)->e_flags; + old_flags = elf_elfheader (obfd)->e_flags; + if (!elf_flags_init (obfd)) + { + /* First call, no flags set. */ + elf_flags_init (obfd) = TRUE; + elf_elfheader (obfd)->e_flags = new_flags; + } + + /* Compatible flags are ok. */ + else if (new_flags == old_flags) + ; + + /* Incompatible flags. */ + else + { + /* Warn about -mrelocatable mismatch. Allow -mrelocatable-lib + to be linked with either. */ + error = FALSE; + if ((new_flags & EF_PPC_RELOCATABLE) != 0 + && (old_flags & (EF_PPC_RELOCATABLE | EF_PPC_RELOCATABLE_LIB)) == 0) + { + error = TRUE; + (*_bfd_error_handler) + (_("%B: compiled with -mrelocatable and linked with " + "modules compiled normally"), ibfd); + } + else if ((new_flags & (EF_PPC_RELOCATABLE | EF_PPC_RELOCATABLE_LIB)) == 0 + && (old_flags & EF_PPC_RELOCATABLE) != 0) + { + error = TRUE; + (*_bfd_error_handler) + (_("%B: compiled normally and linked with " + "modules compiled with -mrelocatable"), ibfd); + } + + /* The output is -mrelocatable-lib iff both the input files are. */ + if (! (new_flags & EF_PPC_RELOCATABLE_LIB)) + elf_elfheader (obfd)->e_flags &= ~EF_PPC_RELOCATABLE_LIB; + + /* The output is -mrelocatable iff it can't be -mrelocatable-lib, + but each input file is either -mrelocatable or -mrelocatable-lib. */ + if (! (elf_elfheader (obfd)->e_flags & EF_PPC_RELOCATABLE_LIB) + && (new_flags & (EF_PPC_RELOCATABLE_LIB | EF_PPC_RELOCATABLE)) + && (old_flags & (EF_PPC_RELOCATABLE_LIB | EF_PPC_RELOCATABLE))) + elf_elfheader (obfd)->e_flags |= EF_PPC_RELOCATABLE; + + /* Do not warn about eabi vs. V.4 mismatch, just or in the bit if + any module uses it. */ + elf_elfheader (obfd)->e_flags |= (new_flags & EF_PPC_EMB); + + new_flags &= ~(EF_PPC_RELOCATABLE | EF_PPC_RELOCATABLE_LIB | EF_PPC_EMB); + old_flags &= ~(EF_PPC_RELOCATABLE | EF_PPC_RELOCATABLE_LIB | EF_PPC_EMB); + + /* Warn about any other mismatches. */ + if (new_flags != old_flags) + { + error = TRUE; + (*_bfd_error_handler) + (_("%B: uses different e_flags (0x%lx) fields " + "than previous modules (0x%lx)"), + ibfd, (long) new_flags, (long) old_flags); + } + + if (error) + { + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + } + + return TRUE; +} + +/* Choose which PLT scheme to use, and set .plt flags appropriately. + Returns -1 on error, 0 for old PLT, 1 for new PLT. */ +int +ppc_elf_select_plt_layout (bfd *output_bfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info, + int force_old_plt, + int emit_stub_syms) +{ + struct ppc_elf_link_hash_table *htab; + flagword flags; + + htab = ppc_elf_hash_table (info); + + if (htab->plt_type == PLT_UNSET) + htab->plt_type = (force_old_plt || !htab->can_use_new_plt + ? PLT_OLD : PLT_NEW); + + htab->emit_stub_syms = emit_stub_syms; + + BFD_ASSERT (htab->plt_type != PLT_VXWORKS); + + if (htab->plt_type == PLT_NEW) + { + flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS + | SEC_IN_MEMORY | SEC_LINKER_CREATED); + + /* The new PLT is a loaded section. */ + if (htab->plt != NULL + && !bfd_set_section_flags (htab->elf.dynobj, htab->plt, flags)) + return -1; + + /* The new GOT is not executable. */ + if (htab->got != NULL + && !bfd_set_section_flags (htab->elf.dynobj, htab->got, flags)) + return -1; + } + else + { + /* Stop an unused .glink section from affecting .text alignment. */ + if (htab->glink != NULL + && !bfd_set_section_alignment (htab->elf.dynobj, htab->glink, 0)) + return -1; + } + return htab->plt_type == PLT_NEW; +} + /* Return the section that should be marked against GC for a given relocation. */ @@ -4041,6 +3697,10 @@ ppc_elf_gc_sweep_hook (bfd *abfd, struct elf_link_hash_entry **sym_hashes; bfd_signed_vma *local_got_refcounts; const Elf_Internal_Rela *rel, *relend; + asection *got2; + + if ((sec->flags & SEC_ALLOC) == 0) + return TRUE; elf_section_data (sec)->local_dynrel = NULL; @@ -4048,6 +3708,7 @@ ppc_elf_gc_sweep_hook (bfd *abfd, symtab_hdr = &elf_tdata (abfd)->symtab_hdr; sym_hashes = elf_sym_hashes (abfd); local_got_refcounts = elf_local_got_refcounts (abfd); + got2 = bfd_get_section_by_name (abfd, ".got2"); relend = relocs + sec->reloc_count; for (rel = relocs; rel < relend; rel++) @@ -4063,6 +3724,9 @@ ppc_elf_gc_sweep_hook (bfd *abfd, struct ppc_elf_link_hash_entry *eh; 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; eh = (struct ppc_elf_link_hash_entry *) h; for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next) @@ -4117,8 +3781,7 @@ ppc_elf_gc_sweep_hook (bfd *abfd, case R_PPC_REL14_BRTAKEN: case R_PPC_REL14_BRNTAKEN: case R_PPC_REL32: - if (h == NULL - || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0) + if (h == NULL || h == htab->elf.hgot) break; /* Fall thru */ @@ -4133,15 +3796,21 @@ ppc_elf_gc_sweep_hook (bfd *abfd, case R_PPC_ADDR14_BRNTAKEN: case R_PPC_UADDR32: case R_PPC_UADDR16: + if (info->shared) + break; + case R_PPC_PLT32: case R_PPC_PLTREL24: + case R_PPC_PLTREL32: case R_PPC_PLT16_LO: case R_PPC_PLT16_HI: case R_PPC_PLT16_HA: if (h != NULL) { - if (h->plt.refcount > 0) - h->plt.refcount--; + bfd_vma addend = r_type == R_PPC_PLTREL24 ? rel->r_addend : 0; + struct plt_entry *ent = find_plt_ent (h, got2, addend); + if (ent->plt.refcount > 0) + ent->plt.refcount -= 1; } break; @@ -4151,7 +3820,7 @@ ppc_elf_gc_sweep_hook (bfd *abfd, } return TRUE; } - + /* Set htab->tls_get_addr and call the generic ELF tls_setup function. */ asection * @@ -4160,9 +3829,16 @@ ppc_elf_tls_setup (bfd *obfd, struct bfd_link_info *info) struct ppc_elf_link_hash_table *htab; htab = ppc_elf_hash_table (info); + if (htab->plt_type == PLT_NEW + && htab->plt != NULL + && htab->plt->output_section != NULL) + { + elf_section_type (htab->plt->output_section) = SHT_PROGBITS; + elf_section_flags (htab->plt->output_section) = SHF_ALLOC + SHF_WRITE; + } + htab->tls_get_addr = elf_link_hash_lookup (&htab->elf, "__tls_get_addr", FALSE, FALSE, TRUE); - return _bfd_elf_tls_setup (obfd, info); } @@ -4223,7 +3899,7 @@ ppc_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED, is_local = FALSE; if (h == NULL - || !(h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC)) + || !h->def_dynamic) is_local = TRUE; r_type = ELF32_R_TYPE (rel->r_info); @@ -4284,8 +3960,9 @@ ppc_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED, && h != NULL && h == htab->tls_get_addr) { - if (h->plt.refcount > 0) - h->plt.refcount -= 1; + struct plt_entry *ent = find_plt_ent (h, NULL, 0); + if (ent != NULL && ent->plt.refcount > 0) + ent->plt.refcount -= 1; } expecting_tls_get_addr = 0; continue; @@ -4359,230 +4036,1439 @@ ppc_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED, return TRUE; } -/* Hook called by the linker routine which adds symbols from an object - file. We use it to put .comm items in .sbss, and not .bss. */ +/* Adjust a symbol defined by a dynamic object and referenced by a + regular object. The current definition is in some section of the + dynamic object, but we're not including those sections. We have to + change the definition to something the rest of the link can + understand. */ static bfd_boolean -ppc_elf_add_symbol_hook (bfd *abfd, - struct bfd_link_info *info, - Elf_Internal_Sym *sym, - const char **namep ATTRIBUTE_UNUSED, - flagword *flagsp ATTRIBUTE_UNUSED, - asection **secp, - bfd_vma *valp) +ppc_elf_adjust_dynamic_symbol (struct bfd_link_info *info, + struct elf_link_hash_entry *h) { - if (sym->st_shndx == SHN_COMMON - && !info->relocatable - && sym->st_size <= elf_gp_size (abfd) - && (info->hash->creator == abfd->xvec - || info->hash->creator == abfd->xvec->alternative_target)) + struct ppc_elf_link_hash_table *htab; + asection *s; + unsigned int power_of_two; + +#ifdef DEBUG + fprintf (stderr, "ppc_elf_adjust_dynamic_symbol called for %s\n", + h->root.root.string); +#endif + + /* Make sure we know what is going on here. */ + htab = ppc_elf_hash_table (info); + BFD_ASSERT (htab->elf.dynobj != NULL + && (h->needs_plt + || h->u.weakdef != NULL + || (h->def_dynamic + && h->ref_regular + && !h->def_regular))); + + /* Deal with function syms. */ + if (h->type == STT_FUNC + || h->needs_plt) { - /* Common symbols less than or equal to -G nn bytes are automatically - put into .sbss. */ - struct ppc_elf_link_hash_table *htab; - - htab = ppc_elf_hash_table (info); - if (htab->sbss == NULL) + /* Clear procedure linkage table information for any symbol that + won't need a .plt entry. */ + struct plt_entry *ent; + for (ent = h->plt.plist; ent != NULL; ent = ent->next) + if (ent->plt.refcount > 0) + break; + if (ent == NULL + || SYMBOL_CALLS_LOCAL (info, h) + || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT + && h->root.type == bfd_link_hash_undefweak)) { - flagword flags = SEC_IS_COMMON; + /* A PLT entry is not required/allowed when: - htab->sbss = bfd_make_section_anyway (abfd, ".sbss"); - if (htab->sbss == NULL - || ! bfd_set_section_flags (abfd, htab->sbss, flags)) - return FALSE; + 1. We are not using ld.so; because then the PLT entry + can't be set up, so we can't use one. In this case, + ppc_elf_adjust_dynamic_symbol won't even be called. + + 2. GC has rendered the entry unused. + + 3. We know for certain that a call to this symbol + will go to this object, or will remain undefined. */ + h->plt.plist = NULL; + h->needs_plt = 0; + } + return TRUE; + } + else + h->plt.plist = NULL; + + /* 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->u.weakdef != NULL) + { + BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined + || h->u.weakdef->root.type == bfd_link_hash_defweak); + h->root.u.def.section = h->u.weakdef->root.u.def.section; + h->root.u.def.value = h->u.weakdef->root.u.def.value; + if (ELIMINATE_COPY_RELOCS) + h->non_got_ref = h->u.weakdef->non_got_ref; + return TRUE; + } + + /* This is a reference to a symbol defined by a dynamic object which + is not a function. */ + + /* If we are creating a shared library, we must presume that the + only references to the symbol are via the global offset table. + For such cases we need not do anything here; the relocations will + be handled correctly by relocate_section. */ + if (info->shared) + return TRUE; + + /* If there are no references to this symbol that do not use the + GOT, we don't need to generate a copy reloc. */ + if (!h->non_got_ref) + return TRUE; + + /* If we didn't find any dynamic relocs in read-only sections, then we'll + be keeping the dynamic relocs and avoiding the copy reloc. We can't + do this if there are any small data relocations. */ + if (ELIMINATE_COPY_RELOCS + && !ppc_elf_hash_entry (h)->has_sda_refs) + { + struct ppc_elf_dyn_relocs *p; + for (p = ppc_elf_hash_entry (h)->dyn_relocs; p != NULL; p = p->next) + { + s = p->sec->output_section; + if (s != NULL && (s->flags & SEC_READONLY) != 0) + break; } - *secp = htab->sbss; - *valp = sym->st_size; + if (p == NULL) + { + h->non_got_ref = 0; + return TRUE; + } } + if (h->size == 0) + { + (*_bfd_error_handler) (_("dynamic variable `%s' is zero size"), + h->root.root.string); + return TRUE; + } + + /* We must allocate the symbol in our .dynbss section, which will + become part of the .bss section of the executable. There will be + an entry for this symbol in the .dynsym section. The dynamic + object will contain position independent code, so all references + from the dynamic object to this symbol will go through the global + offset table. The dynamic linker will use the .dynsym entry to + determine the address it must put in the global offset table, so + both the dynamic object and the regular object will refer to the + same memory location for the variable. + + Of course, if the symbol is referenced using SDAREL relocs, we + must instead allocate it in .sbss. */ + + if (ppc_elf_hash_entry (h)->has_sda_refs) + s = htab->dynsbss; + else + s = htab->dynbss; + BFD_ASSERT (s != NULL); + + /* We must generate a R_PPC_COPY reloc to tell the dynamic linker to + copy the initial value out of the dynamic object and into the + runtime process image. We need to remember the offset into the + .rela.bss section we are going to use. */ + if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) + { + asection *srel; + + if (ppc_elf_hash_entry (h)->has_sda_refs) + srel = htab->relsbss; + else + srel = htab->relbss; + BFD_ASSERT (srel != NULL); + srel->size += sizeof (Elf32_External_Rela); + h->needs_copy = 1; + } + + /* We need to figure out the alignment required for this symbol. I + have no idea how ELF linkers handle this. */ + power_of_two = bfd_log2 (h->size); + if (power_of_two > 4) + power_of_two = 4; + + /* Apply the required alignment. */ + s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two)); + if (power_of_two > bfd_get_section_alignment (htab->elf.dynobj, s)) + { + if (! bfd_set_section_alignment (htab->elf.dynobj, s, power_of_two)) + return FALSE; + } + + /* Define the symbol as being at this point in the section. */ + h->root.u.def.section = s; + h->root.u.def.value = s->size; + + /* Increment the section size to make room for the symbol. */ + s->size += h->size; + return TRUE; } -/* Finish up dynamic symbol handling. We set the contents of various - dynamic sections here. */ +/* Generate a symbol to mark plt call stubs. For non-PIC code the sym is + xxxxxxxx.plt_call32. where xxxxxxxx is a hex number, usually 0, + specifying the addend on the plt relocation. For -fpic code, the sym + is xxxxxxxx.plt_pic32., and for -fPIC + xxxxxxxx.got2.plt_pic32.. */ static bfd_boolean -ppc_elf_finish_dynamic_symbol (bfd *output_bfd, - struct bfd_link_info *info, - struct elf_link_hash_entry *h, - Elf_Internal_Sym *sym) +add_stub_sym (struct plt_entry *ent, + struct elf_link_hash_entry *h, + struct bfd_link_info *info) +{ + struct elf_link_hash_entry *sh; + size_t len1, len2, len3; + char *name; + const char *stub; + struct ppc_elf_link_hash_table *htab = ppc_elf_hash_table (info); + + if (info->shared || info->pie) + stub = ".plt_pic32."; + else + stub = ".plt_call32."; + + len1 = strlen (h->root.root.string); + len2 = strlen (stub); + len3 = 0; + if (ent->sec) + len3 = strlen (ent->sec->name); + name = bfd_malloc (len1 + len2 + len3 + 9); + if (name == NULL) + return FALSE; + sprintf (name, "%08x", (unsigned) ent->addend & 0xffffffff); + if (ent->sec) + memcpy (name + 8, ent->sec->name, len3); + memcpy (name + 8 + len3, stub, len2); + memcpy (name + 8 + len3 + len2, h->root.root.string, len1 + 1); + sh = elf_link_hash_lookup (&htab->elf, name, TRUE, FALSE, FALSE); + if (sh == NULL) + return FALSE; + if (sh->root.type == bfd_link_hash_new) + { + sh->root.type = bfd_link_hash_defined; + sh->root.u.def.section = htab->glink; + sh->root.u.def.value = ent->glink_offset; + sh->ref_regular = 1; + sh->def_regular = 1; + sh->ref_regular_nonweak = 1; + sh->forced_local = 1; + sh->non_elf = 0; + } + return TRUE; +} + +/* Allocate NEED contiguous space in .got, and return the offset. + Handles allocation of the got header when crossing 32k. */ + +static bfd_vma +allocate_got (struct ppc_elf_link_hash_table *htab, unsigned int need) +{ + bfd_vma where; + unsigned int max_before_header; + + if (htab->plt_type == PLT_VXWORKS) + { + where = htab->got->size; + htab->got->size += need; + } + else + { + max_before_header = htab->plt_type == PLT_NEW ? 32768 : 32764; + if (need <= htab->got_gap) + { + where = max_before_header - htab->got_gap; + htab->got_gap -= need; + } + else + { + if (htab->got->size + need > max_before_header + && htab->got->size <= max_before_header) + { + htab->got_gap = max_before_header - htab->got->size; + htab->got->size = max_before_header + htab->got_header_size; + } + where = htab->got->size; + htab->got->size += need; + } + } + return where; +} + +/* Allocate space in associated reloc sections for dynamic relocs. */ + +static bfd_boolean +allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) +{ + struct bfd_link_info *info = inf; + struct ppc_elf_link_hash_entry *eh; + struct ppc_elf_link_hash_table *htab; + struct ppc_elf_dyn_relocs *p; + + if (h->root.type == bfd_link_hash_indirect) + return TRUE; + + if (h->root.type == bfd_link_hash_warning) + /* When warning symbols are created, they **replace** the "real" + entry in the hash table, thus we never get to see the real + symbol in a hash traversal. So look at it now. */ + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + htab = ppc_elf_hash_table (info); + if (htab->elf.dynamic_sections_created) + { + struct plt_entry *ent; + bfd_boolean doneone = FALSE; + bfd_vma plt_offset = 0, glink_offset = 0; + + for (ent = h->plt.plist; ent != NULL; ent = ent->next) + if (ent->plt.refcount > 0) + { + /* Make sure this symbol is output as a dynamic symbol. */ + if (h->dynindx == -1 + && !h->forced_local) + { + if (! bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } + + if (info->shared + || WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h)) + { + asection *s = htab->plt; + + if (htab->plt_type == PLT_NEW) + { + if (!doneone) + { + plt_offset = s->size; + s->size += 4; + } + ent->plt.offset = plt_offset; + + s = htab->glink; + if (!doneone || info->shared || info->pie) + { + glink_offset = s->size; + s->size += GLINK_ENTRY_SIZE; + } + if (!doneone + && !info->shared + && !h->def_regular) + { + h->root.u.def.section = s; + h->root.u.def.value = glink_offset; + } + ent->glink_offset = glink_offset; + + if (htab->emit_stub_syms + && !add_stub_sym (ent, h, info)) + return FALSE; + } + else + { + if (!doneone) + { + /* If this is the first .plt entry, make room + for the special first entry. */ + if (s->size == 0) + s->size += htab->plt_initial_entry_size; + + /* The PowerPC PLT is actually composed of two + parts, the first part is 2 words (for a load + and a jump), and then there is a remaining + word available at the end. */ + plt_offset = (htab->plt_initial_entry_size + + (htab->plt_slot_size + * ((s->size + - htab->plt_initial_entry_size) + / htab->plt_entry_size))); + + /* If this symbol is not defined in a regular + file, and we are not generating a shared + library, then set the symbol to this location + in the .plt. This is required to make + function pointers compare as equal between + the normal executable and the shared library. */ + if (! info->shared + && !h->def_regular) + { + h->root.u.def.section = s; + h->root.u.def.value = plt_offset; + } + + /* Make room for this entry. */ + s->size += htab->plt_entry_size; + /* After the 8192nd entry, room for two entries + is allocated. */ + if (htab->plt_type == PLT_OLD + && (s->size - htab->plt_initial_entry_size) + / htab->plt_entry_size + > PLT_NUM_SINGLE_ENTRIES) + s->size += htab->plt_entry_size; + } + ent->plt.offset = plt_offset; + } + + /* We also need to make an entry in the .rela.plt section. */ + if (!doneone) + { + htab->relplt->size += sizeof (Elf32_External_Rela); + + if (htab->plt_type == PLT_VXWORKS) + { + /* Allocate space for the unloaded relocations. */ + if (!info->shared) + { + if (ent->plt.offset + == (bfd_vma) htab->plt_initial_entry_size) + { + htab->srelplt2->size + += sizeof (Elf32_External_Rela) + * VXWORKS_PLTRESOLVE_RELOCS; + } + + htab->srelplt2->size + += sizeof (Elf32_External_Rela) + * VXWORKS_PLT_NON_JMP_SLOT_RELOCS; + } + + /* Every PLT entry has an associated GOT entry in + .got.plt. */ + htab->sgotplt->size += 4; + } + doneone = TRUE; + } + } + else + ent->plt.offset = (bfd_vma) -1; + + if (!doneone) + { + h->plt.plist = NULL; + h->needs_plt = 0; + } + } + } + else + { + h->plt.plist = NULL; + h->needs_plt = 0; + } + + eh = (struct ppc_elf_link_hash_entry *) h; + if (eh->elf.got.refcount > 0) + { + /* Make sure this symbol is output as a dynamic symbol. */ + if (eh->elf.dynindx == -1 + && !eh->elf.forced_local) + { + if (!bfd_elf_link_record_dynamic_symbol (info, &eh->elf)) + return FALSE; + } + + if (eh->tls_mask == (TLS_TLS | TLS_LD) + && !eh->elf.def_dynamic) + /* If just an LD reloc, we'll just use htab->tlsld_got.offset. */ + eh->elf.got.offset = (bfd_vma) -1; + else + { + bfd_boolean dyn; + unsigned int need = 0; + if ((eh->tls_mask & TLS_TLS) != 0) + { + if ((eh->tls_mask & TLS_LD) != 0) + need += 8; + if ((eh->tls_mask & TLS_GD) != 0) + need += 8; + if ((eh->tls_mask & (TLS_TPREL | TLS_TPRELGD)) != 0) + need += 4; + if ((eh->tls_mask & TLS_DTPREL) != 0) + need += 4; + } + else + need += 4; + eh->elf.got.offset = allocate_got (htab, need); + dyn = htab->elf.dynamic_sections_created; + if ((info->shared + || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, &eh->elf)) + && (ELF_ST_VISIBILITY (eh->elf.other) == STV_DEFAULT + || eh->elf.root.type != bfd_link_hash_undefweak)) + { + /* All the entries we allocated need relocs. + Except LD only needs one. */ + if ((eh->tls_mask & TLS_LD) != 0) + need -= 4; + htab->relgot->size += need * (sizeof (Elf32_External_Rela) / 4); + } + } + } + else + eh->elf.got.offset = (bfd_vma) -1; + + if (eh->dyn_relocs == NULL) + return TRUE; + + /* In the shared -Bsymbolic case, discard space allocated for + dynamic pc-relative relocs against symbols which turn out to be + defined in regular objects. For the normal shared case, discard + space for relocs that have become local due to symbol visibility + changes. */ + + if (info->shared) + { + /* Relocs that use pc_count are those that appear on a call insn, + or certain REL relocs (see MUST_BE_DYN_RELOC) that can be + generated via assembly. We want calls to protected symbols to + resolve directly to the function rather than going via the plt. + If people want function pointer comparisons to work as expected + then they should avoid writing weird assembly. */ + if (SYMBOL_CALLS_LOCAL (info, h)) + { + struct ppc_elf_dyn_relocs **pp; + + for (pp = &eh->dyn_relocs; (p = *pp) != NULL; ) + { + p->count -= p->pc_count; + p->pc_count = 0; + if (p->count == 0) + *pp = p->next; + else + pp = &p->next; + } + } + + /* Also discard relocs on undefined weak syms with non-default + visibility. */ + if (eh->dyn_relocs != NULL + && h->root.type == bfd_link_hash_undefweak) + { + if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT) + eh->dyn_relocs = NULL; + + /* Make sure undefined weak symbols are output as a dynamic + symbol in PIEs. */ + else if (h->dynindx == -1 + && !h->forced_local) + { + if (! bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } + } + } + else if (ELIMINATE_COPY_RELOCS) + { + /* For the non-shared case, discard space for relocs against + symbols which turn out to need copy relocs or are not + dynamic. */ + + if (!h->non_got_ref + && h->def_dynamic + && !h->def_regular) + { + /* Make sure this symbol is output as a dynamic symbol. + Undefined weak syms won't yet be marked as dynamic. */ + if (h->dynindx == -1 + && !h->forced_local) + { + if (! bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } + + /* If that succeeded, we know we'll be keeping all the + relocs. */ + if (h->dynindx != -1) + goto keep; + } + + eh->dyn_relocs = NULL; + + keep: ; + } + + /* Finally, allocate space. */ + for (p = eh->dyn_relocs; p != NULL; p = p->next) + { + asection *sreloc = elf_section_data (p->sec)->sreloc; + sreloc->size += p->count * sizeof (Elf32_External_Rela); + } + + return TRUE; +} + +/* Find any dynamic relocs that apply to read-only sections. */ + +static bfd_boolean +readonly_dynrelocs (struct elf_link_hash_entry *h, void *info) +{ + struct ppc_elf_dyn_relocs *p; + + if (h->root.type == bfd_link_hash_indirect) + return TRUE; + + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + for (p = ppc_elf_hash_entry (h)->dyn_relocs; p != NULL; p = p->next) + { + asection *s = p->sec->output_section; + + if (s != NULL + && ((s->flags & (SEC_READONLY | SEC_ALLOC)) + == (SEC_READONLY | SEC_ALLOC))) + { + ((struct bfd_link_info *) info)->flags |= DF_TEXTREL; + + /* Not an error, just cut short the traversal. */ + return FALSE; + } + } + return TRUE; +} + +/* Set the sizes of the dynamic sections. */ + +static bfd_boolean +ppc_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info) { struct ppc_elf_link_hash_table *htab; + asection *s; + bfd_boolean relocs; + bfd *ibfd; #ifdef DEBUG - fprintf (stderr, "ppc_elf_finish_dynamic_symbol called for %s", - h->root.root.string); + fprintf (stderr, "ppc_elf_size_dynamic_sections called\n"); #endif htab = ppc_elf_hash_table (info); BFD_ASSERT (htab->elf.dynobj != NULL); - if (h->plt.offset != (bfd_vma) -1) + if (elf_hash_table (info)->dynamic_sections_created) { - Elf_Internal_Rela rela; - bfd_byte *loc; - bfd_vma reloc_index; - -#ifdef DEBUG - fprintf (stderr, ", plt_offset = %d", h->plt.offset); -#endif - - /* This symbol has an entry in the procedure linkage table. Set - it up. */ - - BFD_ASSERT (h->dynindx != -1); - BFD_ASSERT (htab->plt != NULL && htab->relplt != NULL); - - /* We don't need to fill in the .plt. The ppc dynamic linker - will fill it in. */ - - /* Fill in the entry in the .rela.plt section. */ - rela.r_offset = (htab->plt->output_section->vma - + htab->plt->output_offset - + h->plt.offset); - rela.r_info = ELF32_R_INFO (h->dynindx, R_PPC_JMP_SLOT); - rela.r_addend = 0; - - reloc_index = (h->plt.offset - PLT_INITIAL_ENTRY_SIZE) / PLT_SLOT_SIZE; - if (reloc_index > PLT_NUM_SINGLE_ENTRIES) - reloc_index -= (reloc_index - PLT_NUM_SINGLE_ENTRIES) / 2; - loc = (htab->relplt->contents - + reloc_index * sizeof (Elf32_External_Rela)); - bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); - - if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + /* Set the contents of the .interp section to the interpreter. */ + if (info->executable) { - /* Mark the symbol as undefined, rather than as defined in - the .plt section. Leave the value alone. */ - sym->st_shndx = SHN_UNDEF; - /* If the symbol is weak, we do need to clear the value. - Otherwise, the PLT entry would provide a definition for - the symbol even if the symbol wasn't defined anywhere, - and so the symbol would never be NULL. */ - if ((h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR_NONWEAK) - == 0) - sym->st_value = 0; + s = bfd_get_section_by_name (htab->elf.dynobj, ".interp"); + BFD_ASSERT (s != NULL); + s->size = sizeof ELF_DYNAMIC_INTERPRETER; + s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER; } } - if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0) + if (htab->plt_type == PLT_OLD) + htab->got_header_size = 16; + else if (htab->plt_type == PLT_NEW) + htab->got_header_size = 12; + + /* Set up .got offsets for local syms, and space for local dynamic + relocs. */ + for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) { - asection *s; - Elf_Internal_Rela rela; - bfd_byte *loc; + bfd_signed_vma *local_got; + bfd_signed_vma *end_local_got; + char *lgot_masks; + bfd_size_type locsymcount; + Elf_Internal_Shdr *symtab_hdr; - /* This symbols needs a copy reloc. Set it up. */ + if (!is_ppc_elf_target (ibfd->xvec)) + continue; -#ifdef DEBUG - fprintf (stderr, ", copy"); -#endif + for (s = ibfd->sections; s != NULL; s = s->next) + { + struct ppc_elf_dyn_relocs *p; - BFD_ASSERT (h->dynindx != -1); + for (p = ((struct ppc_elf_dyn_relocs *) + elf_section_data (s)->local_dynrel); + p != NULL; + p = p->next) + { + if (!bfd_is_abs_section (p->sec) + && bfd_is_abs_section (p->sec->output_section)) + { + /* Input section has been discarded, either because + it is a copy of a linkonce section or due to + linker script /DISCARD/, so we'll be discarding + the relocs too. */ + } + else if (p->count != 0) + { + elf_section_data (p->sec)->sreloc->size + += p->count * sizeof (Elf32_External_Rela); + if ((p->sec->output_section->flags + & (SEC_READONLY | SEC_ALLOC)) + == (SEC_READONLY | SEC_ALLOC)) + info->flags |= DF_TEXTREL; + } + } + } - if (h->size <= elf_gp_size (htab->elf.dynobj)) - s = htab->relsbss; - else - s = htab->relbss; - BFD_ASSERT (s != NULL); + local_got = elf_local_got_refcounts (ibfd); + if (!local_got) + continue; - rela.r_offset = (h->root.u.def.value - + h->root.u.def.section->output_section->vma - + h->root.u.def.section->output_offset); - rela.r_info = ELF32_R_INFO (h->dynindx, R_PPC_COPY); - rela.r_addend = 0; - loc = s->contents + s->reloc_count++ * sizeof (Elf32_External_Rela); - bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); + symtab_hdr = &elf_tdata (ibfd)->symtab_hdr; + locsymcount = symtab_hdr->sh_info; + end_local_got = local_got + locsymcount; + lgot_masks = (char *) end_local_got; + for (; local_got < end_local_got; ++local_got, ++lgot_masks) + if (*local_got > 0) + { + if (*lgot_masks == (TLS_TLS | TLS_LD)) + { + /* If just an LD reloc, we'll just use + htab->tlsld_got.offset. */ + htab->tlsld_got.refcount += 1; + *local_got = (bfd_vma) -1; + } + else + { + unsigned int need = 0; + if ((*lgot_masks & TLS_TLS) != 0) + { + if ((*lgot_masks & TLS_GD) != 0) + need += 8; + if ((*lgot_masks & (TLS_TPREL | TLS_TPRELGD)) != 0) + need += 4; + if ((*lgot_masks & TLS_DTPREL) != 0) + need += 4; + } + else + need += 4; + *local_got = allocate_got (htab, need); + if (info->shared) + htab->relgot->size += (need + * (sizeof (Elf32_External_Rela) / 4)); + } + } + else + *local_got = (bfd_vma) -1; } -#ifdef DEBUG - fprintf (stderr, "\n"); -#endif + if (htab->tlsld_got.refcount > 0) + { + htab->tlsld_got.offset = allocate_got (htab, 8); + if (info->shared) + htab->relgot->size += sizeof (Elf32_External_Rela); + } + else + htab->tlsld_got.offset = (bfd_vma) -1; - /* Mark some specially defined symbols as absolute. */ - if (strcmp (h->root.root.string, "_DYNAMIC") == 0 - || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0 - || strcmp (h->root.root.string, "_PROCEDURE_LINKAGE_TABLE_") == 0) - sym->st_shndx = SHN_ABS; + /* Allocate space for global sym dynamic relocs. */ + elf_link_hash_traverse (elf_hash_table (info), allocate_dynrelocs, info); - return TRUE; -} - -/* Finish up the dynamic sections. */ + if (htab->got != NULL && htab->plt_type != PLT_VXWORKS) + { + unsigned int g_o_t = 32768; -static bfd_boolean -ppc_elf_finish_dynamic_sections (bfd *output_bfd, - struct bfd_link_info *info) -{ - asection *sdyn; - struct ppc_elf_link_hash_table *htab; + /* If we haven't allocated the header, do so now. When we get here, + for old plt/got the got size will be 0 to 32764 (not allocated), + or 32780 to 65536 (header allocated). For new plt/got, the + corresponding ranges are 0 to 32768 and 32780 to 65536. */ + if (htab->got->size <= 32768) + { + g_o_t = htab->got->size; + if (htab->plt_type == PLT_OLD) + g_o_t += 4; + htab->got->size += htab->got_header_size; + } -#ifdef DEBUG - fprintf (stderr, "ppc_elf_finish_dynamic_sections called\n"); -#endif + htab->elf.hgot->root.u.def.value = g_o_t; + } - htab = ppc_elf_hash_table (info); - sdyn = bfd_get_section_by_name (htab->elf.dynobj, ".dynamic"); + if (htab->glink != NULL && htab->glink->size != 0) + { + htab->glink_pltresolve = htab->glink->size; + /* Space for the branch table. */ + htab->glink->size += htab->glink->size / (GLINK_ENTRY_SIZE / 4) - 4; + /* Pad out to align the start of PLTresolve. */ + htab->glink->size += -htab->glink->size & 15; + htab->glink->size += GLINK_PLTRESOLVE; + + if (htab->emit_stub_syms) + { + struct elf_link_hash_entry *sh; + sh = elf_link_hash_lookup (&htab->elf, "__glink", + TRUE, FALSE, FALSE); + if (sh == NULL) + return FALSE; + if (sh->root.type == bfd_link_hash_new) + { + sh->root.type = bfd_link_hash_defined; + sh->root.u.def.section = htab->glink; + sh->root.u.def.value = htab->glink_pltresolve; + sh->ref_regular = 1; + sh->def_regular = 1; + sh->ref_regular_nonweak = 1; + sh->forced_local = 1; + sh->non_elf = 0; + } + sh = elf_link_hash_lookup (&htab->elf, "__glink_PLTresolve", + TRUE, FALSE, FALSE); + if (sh == NULL) + return FALSE; + if (sh->root.type == bfd_link_hash_new) + { + sh->root.type = bfd_link_hash_defined; + sh->root.u.def.section = htab->glink; + sh->root.u.def.value = htab->glink->size - GLINK_PLTRESOLVE; + sh->ref_regular = 1; + sh->def_regular = 1; + sh->ref_regular_nonweak = 1; + sh->forced_local = 1; + sh->non_elf = 0; + } + } + } + + /* We've now determined the sizes of the various dynamic sections. + Allocate memory for them. */ + relocs = FALSE; + for (s = htab->elf.dynobj->sections; s != NULL; s = s->next) + { + bfd_boolean strip_section = TRUE; + + if ((s->flags & SEC_LINKER_CREATED) == 0) + continue; + + if (s == htab->plt + || s == htab->glink + || s == htab->got + || s == htab->sgotplt + || s == htab->sbss + || s == htab->dynbss + || s == htab->dynsbss) + { + /* We'd like to strip these sections if they aren't needed, but if + we've exported dynamic symbols from them we must leave them. + It's too late to tell BFD to get rid of the symbols. */ + if ((s == htab->plt || s == htab->got) && htab->elf.hplt != NULL) + strip_section = FALSE; + /* Strip this section if we don't need it; see the + comment below. */ + } + else if (s == htab->sdata[0].section + || s == htab->sdata[1].section) + { + /* Strip these too. */ + } + else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0) + { + if (s->size != 0) + { + /* Remember whether there are any relocation sections. */ + relocs = TRUE; + + /* We use the reloc_count field as a counter if we need + to copy relocs into the output file. */ + s->reloc_count = 0; + } + } + else + { + /* It's not one of our sections, so don't allocate space. */ + continue; + } + + if (s->size == 0 && strip_section) + { + /* If we don't need this section, strip it from the + output file. This is mostly to handle .rela.bss and + .rela.plt. We must create both sections in + create_dynamic_sections, because they must be created + before the linker maps input sections to output + sections. The linker does that before + adjust_dynamic_symbol is called, and it is that + function which decides whether anything needs to go + into these sections. */ + s->flags |= SEC_EXCLUDE; + continue; + } + + if ((s->flags & SEC_HAS_CONTENTS) == 0) + continue; + + /* Allocate memory for the section contents. */ + s->contents = bfd_zalloc (htab->elf.dynobj, s->size); + if (s->contents == NULL) + return FALSE; + } if (htab->elf.dynamic_sections_created) { - Elf32_External_Dyn *dyncon, *dynconend; + /* Add some entries to the .dynamic section. We fill in the + values later, in ppc_elf_finish_dynamic_sections, but we + must add the entries now so that we get the correct size for + the .dynamic section. The DT_DEBUG entry is filled in by the + dynamic linker and used by the debugger. */ +#define add_dynamic_entry(TAG, VAL) \ + _bfd_elf_add_dynamic_entry (info, TAG, VAL) - BFD_ASSERT (htab->plt != NULL && sdyn != NULL); - - dyncon = (Elf32_External_Dyn *) sdyn->contents; - dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->_raw_size); - for (; dyncon < dynconend; dyncon++) + if (info->executable) { - Elf_Internal_Dyn dyn; - asection *s; + if (!add_dynamic_entry (DT_DEBUG, 0)) + return FALSE; + } - bfd_elf32_swap_dyn_in (htab->elf.dynobj, dyncon, &dyn); + if (htab->plt != NULL && htab->plt->size != 0) + { + if (!add_dynamic_entry (DT_PLTGOT, 0) + || !add_dynamic_entry (DT_PLTRELSZ, 0) + || !add_dynamic_entry (DT_PLTREL, DT_RELA) + || !add_dynamic_entry (DT_JMPREL, 0)) + return FALSE; + } - switch (dyn.d_tag) - { - case DT_PLTGOT: - s = htab->plt; - dyn.d_un.d_ptr = s->output_section->vma + s->output_offset; - break; + if (htab->glink != NULL && htab->glink->size != 0) + { + if (!add_dynamic_entry (DT_PPC_GOT, 0)) + return FALSE; + } - case DT_PLTRELSZ: - dyn.d_un.d_val = htab->relplt->_raw_size; - break; + if (relocs) + { + if (!add_dynamic_entry (DT_RELA, 0) + || !add_dynamic_entry (DT_RELASZ, 0) + || !add_dynamic_entry (DT_RELAENT, sizeof (Elf32_External_Rela))) + return FALSE; + } - case DT_JMPREL: - s = htab->relplt; - dyn.d_un.d_ptr = s->output_section->vma + s->output_offset; - break; + /* If any dynamic relocs apply to a read-only section, then we + need a DT_TEXTREL entry. */ + if ((info->flags & DF_TEXTREL) == 0) + elf_link_hash_traverse (elf_hash_table (info), readonly_dynrelocs, + info); - default: - continue; - } - - bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + if ((info->flags & DF_TEXTREL) != 0) + { + if (!add_dynamic_entry (DT_TEXTREL, 0)) + return FALSE; } } - - /* Add a blrl instruction at _GLOBAL_OFFSET_TABLE_-4 so that a function can - easily find the address of the _GLOBAL_OFFSET_TABLE_. */ - if (htab->got) - { - unsigned char *contents = htab->got->contents; - bfd_put_32 (output_bfd, 0x4e800021 /* blrl */, contents); - - if (sdyn == NULL) - bfd_put_32 (output_bfd, 0, contents + 4); - else - bfd_put_32 (output_bfd, - sdyn->output_section->vma + sdyn->output_offset, - contents + 4); - - elf_section_data (htab->got->output_section)->this_hdr.sh_entsize = 4; - } +#undef add_dynamic_entry return TRUE; } +#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0])) + +static const int shared_stub_entry[] = + { + 0x7c0802a6, /* mflr 0 */ + 0x429f0005, /* bcl 20, 31, .Lxxx */ + 0x7d6802a6, /* mflr 11 */ + 0x3d6b0000, /* addis 11, 11, (xxx-.Lxxx)@ha */ + 0x396b0018, /* addi 11, 11, (xxx-.Lxxx)@l */ + 0x7c0803a6, /* mtlr 0 */ + 0x7d6903a6, /* mtctr 11 */ + 0x4e800420, /* bctr */ + }; + +static const int stub_entry[] = + { + 0x3d600000, /* lis 11,xxx@ha */ + 0x396b0000, /* addi 11,11,xxx@l */ + 0x7d6903a6, /* mtctr 11 */ + 0x4e800420, /* bctr */ + }; + +static bfd_boolean +ppc_elf_relax_section (bfd *abfd, + asection *isec, + struct bfd_link_info *link_info, + bfd_boolean *again) +{ + struct one_fixup + { + struct one_fixup *next; + asection *tsec; + bfd_vma toff; + bfd_vma trampoff; + }; + + Elf_Internal_Shdr *symtab_hdr; + bfd_byte *contents = NULL; + Elf_Internal_Sym *isymbuf = NULL; + Elf_Internal_Rela *internal_relocs = NULL; + Elf_Internal_Rela *irel, *irelend; + struct one_fixup *fixups = NULL; + bfd_boolean changed; + struct ppc_elf_link_hash_table *htab; + bfd_size_type trampoff; + asection *got2; + + *again = FALSE; + + /* Nothing to do if there are no relocations, and no need to do + anything with non-alloc sections. */ + if ((isec->flags & SEC_ALLOC) == 0 + || (isec->flags & SEC_RELOC) == 0 + || isec->reloc_count == 0) + return TRUE; + + trampoff = (isec->size + 3) & (bfd_vma) -4; + /* Space for a branch around any trampolines. */ + trampoff += 4; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + + /* Get a copy of the native relocations. */ + internal_relocs = _bfd_elf_link_read_relocs (abfd, isec, NULL, NULL, + link_info->keep_memory); + if (internal_relocs == NULL) + goto error_return; + + htab = ppc_elf_hash_table (link_info); + got2 = bfd_get_section_by_name (abfd, ".got2"); + + irelend = internal_relocs + isec->reloc_count; + for (irel = internal_relocs; irel < irelend; irel++) + { + unsigned long r_type = ELF32_R_TYPE (irel->r_info); + bfd_vma symaddr, reladdr, toff, roff; + asection *tsec; + struct one_fixup *f; + size_t insn_offset = 0; + bfd_vma max_branch_offset, val; + bfd_byte *hit_addr; + unsigned long t0; + unsigned char sym_type; + + switch (r_type) + { + case R_PPC_REL24: + case R_PPC_LOCAL24PC: + case R_PPC_PLTREL24: + max_branch_offset = 1 << 25; + break; + + case R_PPC_REL14: + case R_PPC_REL14_BRTAKEN: + case R_PPC_REL14_BRNTAKEN: + max_branch_offset = 1 << 15; + break; + + default: + continue; + } + + /* Get the value of the symbol referred to by the reloc. */ + if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info) + { + /* A local symbol. */ + Elf_Internal_Sym *isym; + + /* Read this BFD's local symbols. */ + if (isymbuf == NULL) + { + isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents; + if (isymbuf == NULL) + isymbuf = bfd_elf_get_elf_syms (abfd, symtab_hdr, + symtab_hdr->sh_info, 0, + NULL, NULL, NULL); + if (isymbuf == 0) + goto error_return; + } + isym = isymbuf + ELF32_R_SYM (irel->r_info); + if (isym->st_shndx == SHN_UNDEF) + continue; /* We can't do anything with undefined symbols. */ + else if (isym->st_shndx == SHN_ABS) + tsec = bfd_abs_section_ptr; + else if (isym->st_shndx == SHN_COMMON) + tsec = bfd_com_section_ptr; + else + tsec = bfd_section_from_elf_index (abfd, isym->st_shndx); + + toff = isym->st_value; + sym_type = ELF_ST_TYPE (isym->st_info); + } + else + { + /* Global symbol handling. */ + unsigned long indx; + struct elf_link_hash_entry *h; + + indx = ELF32_R_SYM (irel->r_info) - symtab_hdr->sh_info; + h = elf_sym_hashes (abfd)[indx]; + + 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; + + tsec = NULL; + toff = 0; + if (r_type == R_PPC_PLTREL24 + && htab->plt != NULL) + { + struct plt_entry *ent = find_plt_ent (h, got2, irel->r_addend); + + if (ent != NULL) + { + if (htab->plt_type == PLT_NEW) + { + tsec = htab->glink; + toff = ent->glink_offset; + } + else + { + tsec = htab->plt; + toff = ent->plt.offset; + } + } + } + if (tsec != NULL) + ; + else if (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + { + tsec = h->root.u.def.section; + toff = h->root.u.def.value; + } + else + continue; + + sym_type = h->type; + } + + /* If the branch and target are in the same section, you have + no hope of adding stubs. We'll error out later should the + branch overflow. */ + if (tsec == isec) + continue; + + /* There probably isn't any reason to handle symbols in + SEC_MERGE sections; SEC_MERGE doesn't seem a likely + attribute for a code section, and we are only looking at + branches. However, implement it correctly here as a + reference for other target relax_section functions. */ + if (0 && tsec->sec_info_type == ELF_INFO_TYPE_MERGE) + { + /* At this stage in linking, no SEC_MERGE symbol has been + adjusted, so all references to such symbols need to be + passed through _bfd_merged_section_offset. (Later, in + relocate_section, all SEC_MERGE symbols *except* for + section symbols have been adjusted.) + + gas may reduce relocations against symbols in SEC_MERGE + sections to a relocation against the section symbol when + the original addend was zero. When the reloc is against + a section symbol we should include the addend in the + offset passed to _bfd_merged_section_offset, since the + location of interest is the original symbol. On the + other hand, an access to "sym+addend" where "sym" is not + a section symbol should not include the addend; Such an + access is presumed to be an offset from "sym"; The + location of interest is just "sym". */ + if (sym_type == STT_SECTION) + toff += irel->r_addend; + + toff = _bfd_merged_section_offset (abfd, &tsec, + elf_section_data (tsec)->sec_info, + toff); + + if (sym_type != STT_SECTION) + toff += irel->r_addend; + } + /* PLTREL24 addends are special. */ + else if (r_type != R_PPC_PLTREL24) + toff += irel->r_addend; + + /* Attempted -shared link of non-pic code loses. */ + if (tsec->output_section == NULL) + continue; + + symaddr = tsec->output_section->vma + tsec->output_offset + toff; + + roff = irel->r_offset; + reladdr = isec->output_section->vma + isec->output_offset + roff; + + /* If the branch is in range, no need to do anything. */ + if (symaddr - reladdr + max_branch_offset < 2 * max_branch_offset) + continue; + + /* Look for an existing fixup to this address. */ + for (f = fixups; f ; f = f->next) + if (f->tsec == tsec && f->toff == toff) + break; + + if (f == NULL) + { + size_t size; + unsigned long stub_rtype; + + val = trampoff - roff; + if (val >= max_branch_offset) + /* Oh dear, we can't reach a trampoline. Don't try to add + one. We'll report an error later. */ + continue; + + if (link_info->shared) + { + size = 4 * ARRAY_SIZE (shared_stub_entry); + insn_offset = 12; + stub_rtype = R_PPC_RELAX32PC; + } + else + { + size = 4 * ARRAY_SIZE (stub_entry); + insn_offset = 0; + stub_rtype = R_PPC_RELAX32; + } + + if (R_PPC_RELAX32_PLT - R_PPC_RELAX32 + != R_PPC_RELAX32PC_PLT - R_PPC_RELAX32PC) + abort (); + if (tsec == htab->plt + || tsec == htab->glink) + stub_rtype += R_PPC_RELAX32_PLT - R_PPC_RELAX32; + + /* Hijack the old relocation. Since we need two + relocations for this use a "composite" reloc. */ + irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), + stub_rtype); + irel->r_offset = trampoff + insn_offset; + + /* Record the fixup so we don't do it again this section. */ + f = bfd_malloc (sizeof (*f)); + f->next = fixups; + f->tsec = tsec; + f->toff = toff; + f->trampoff = trampoff; + fixups = f; + + trampoff += size; + } + else + { + val = f->trampoff - roff; + if (val >= max_branch_offset) + continue; + + /* Nop out the reloc, since we're finalizing things here. */ + irel->r_info = ELF32_R_INFO (0, R_PPC_NONE); + } + + /* Get the section contents. */ + if (contents == NULL) + { + /* Get cached copy if it exists. */ + if (elf_section_data (isec)->this_hdr.contents != NULL) + contents = elf_section_data (isec)->this_hdr.contents; + else + { + /* Go get them off disk. */ + if (!bfd_malloc_and_get_section (abfd, isec, &contents)) + goto error_return; + } + } + + /* Fix up the existing branch to hit the trampoline. */ + hit_addr = contents + roff; + switch (r_type) + { + case R_PPC_REL24: + case R_PPC_LOCAL24PC: + case R_PPC_PLTREL24: + t0 = bfd_get_32 (abfd, hit_addr); + t0 &= ~0x3fffffc; + t0 |= val & 0x3fffffc; + bfd_put_32 (abfd, t0, hit_addr); + break; + + case R_PPC_REL14: + case R_PPC_REL14_BRTAKEN: + case R_PPC_REL14_BRNTAKEN: + t0 = bfd_get_32 (abfd, hit_addr); + t0 &= ~0xfffc; + t0 |= val & 0xfffc; + bfd_put_32 (abfd, t0, hit_addr); + break; + } + } + + /* Write out the trampolines. */ + changed = fixups != NULL; + if (fixups != NULL) + { + const int *stub; + bfd_byte *dest; + bfd_vma val; + int i, size; + + do + { + struct one_fixup *f = fixups; + fixups = fixups->next; + free (f); + } + while (fixups); + + contents = bfd_realloc (contents, trampoff); + if (contents == NULL) + goto error_return; + + isec->size = (isec->size + 3) & (bfd_vma) -4; + /* Branch around the trampolines. */ + val = trampoff - isec->size + 0x48000000; + dest = contents + isec->size; + isec->size = trampoff; + bfd_put_32 (abfd, val, dest); + dest += 4; + + if (link_info->shared) + { + stub = shared_stub_entry; + size = ARRAY_SIZE (shared_stub_entry); + } + else + { + stub = stub_entry; + size = ARRAY_SIZE (stub_entry); + } + + i = 0; + while (dest < contents + trampoff) + { + bfd_put_32 (abfd, stub[i], dest); + i++; + if (i == size) + i = 0; + dest += 4; + } + BFD_ASSERT (i == 0); + } + + if (isymbuf != NULL + && symtab_hdr->contents != (unsigned char *) isymbuf) + { + if (! link_info->keep_memory) + free (isymbuf); + else + { + /* Cache the symbols for elf_link_input_bfd. */ + symtab_hdr->contents = (unsigned char *) isymbuf; + } + } + + if (contents != NULL + && elf_section_data (isec)->this_hdr.contents != contents) + { + if (!changed && !link_info->keep_memory) + free (contents); + else + { + /* Cache the section contents for elf_link_input_bfd. */ + elf_section_data (isec)->this_hdr.contents = contents; + } + } + + if (elf_section_data (isec)->relocs != internal_relocs) + { + if (!changed) + free (internal_relocs); + else + elf_section_data (isec)->relocs = internal_relocs; + } + + *again = changed; + return TRUE; + + error_return: + if (isymbuf != NULL && (unsigned char *) isymbuf != symtab_hdr->contents) + free (isymbuf); + if (contents != NULL + && elf_section_data (isec)->this_hdr.contents != contents) + free (contents); + if (internal_relocs != NULL + && elf_section_data (isec)->relocs != internal_relocs) + free (internal_relocs); + return FALSE; +} + +/* What to do when ld finds relocations against symbols defined in + discarded sections. */ + +static unsigned int +ppc_elf_action_discarded (asection *sec) +{ + if (strcmp (".fixup", sec->name) == 0) + return 0; + + if (strcmp (".got2", sec->name) == 0) + return 0; + + return _bfd_elf_default_action_discarded (sec); +} + +/* Fill in the address for a pointer generated in a linker section. */ + +static bfd_vma +elf_finish_pointer_linker_section (bfd *input_bfd, + elf_linker_section_t *lsect, + struct elf_link_hash_entry *h, + bfd_vma relocation, + const Elf_Internal_Rela *rel) +{ + elf_linker_section_pointers_t *linker_section_ptr; + + BFD_ASSERT (lsect != NULL); + + if (h != NULL) + { + /* Handle global symbol. */ + struct ppc_elf_link_hash_entry *eh; + + eh = (struct ppc_elf_link_hash_entry *) h; + BFD_ASSERT (eh->elf.def_regular); + linker_section_ptr = eh->linker_section_pointer; + } + else + { + /* Handle local symbol. */ + unsigned long r_symndx = ELF32_R_SYM (rel->r_info); + + BFD_ASSERT (elf_local_ptr_offsets (input_bfd) != NULL); + linker_section_ptr = elf_local_ptr_offsets (input_bfd)[r_symndx]; + } + + linker_section_ptr = elf_find_pointer_linker_section (linker_section_ptr, + rel->r_addend, + lsect); + BFD_ASSERT (linker_section_ptr != NULL); + + /* Offset will always be a multiple of four, so use the bottom bit + as a "written" flag. */ + if ((linker_section_ptr->offset & 1) == 0) + { + bfd_put_32 (lsect->section->owner, + relocation + linker_section_ptr->addend, + lsect->section->contents + linker_section_ptr->offset); + linker_section_ptr->offset += 1; + } + + relocation = (lsect->section->output_offset + + linker_section_ptr->offset - 1 + - 0x8000); + +#ifdef DEBUG + fprintf (stderr, + "Finish pointer in linker section %s, offset = %ld (0x%lx)\n", + lsect->name, (long) relocation, (long) relocation); +#endif + + /* Subtract out the addend, because it will get added back in by the normal + processing. */ + return relocation - linker_section_ptr->addend; +} + /* The RELOCATE_SECTION function is called by the ELF backend linker to handle the relocations for a section. @@ -4629,21 +5515,42 @@ ppc_elf_relocate_section (bfd *output_bfd, Elf_Internal_Rela *relend; Elf_Internal_Rela outrel; bfd_byte *loc; - asection *sreloc = NULL; + asection *got2, *sreloc = NULL; bfd_vma *local_got_offsets; bfd_boolean ret = TRUE; #ifdef DEBUG - fprintf (stderr, "ppc_elf_relocate_section called for %s section %s, " - "%ld relocations%s\n", - bfd_archive_filename (input_bfd), - bfd_section_name(input_bfd, input_section), - (long) input_section->reloc_count, - (info->relocatable) ? " (relocatable)" : ""); + _bfd_error_handler ("ppc_elf_relocate_section called for %B section %A, " + "%ld relocations%s", + input_bfd, input_section, + (long) input_section->reloc_count, + (info->relocatable) ? " (relocatable)" : ""); #endif + got2 = bfd_get_section_by_name (input_bfd, ".got2"); + if (info->relocatable) - return TRUE; + { + if (got2 == NULL) + return TRUE; + + rel = relocs; + relend = relocs + input_section->reloc_count; + for (; rel < relend; rel++) + { + enum elf_ppc_reloc_type r_type; + + r_type = ELF32_R_TYPE (rel->r_info); + if (r_type == R_PPC_PLTREL24 + && rel->r_addend >= 32768) + { + /* R_PPC_PLTREL24 is rather special. If non-zero, the + addend specifies the GOT pointer offset within .got2. */ + rel->r_addend += got2->output_offset; + } + } + return TRUE; + } /* Initialize howto table if not already done. */ if (!ppc_elf_howto_table[R_PPC_ADDR32]) @@ -4684,7 +5591,7 @@ ppc_elf_relocate_section (bfd *output_bfd, { sym = local_syms + r_symndx; sec = local_sections[r_symndx]; - sym_name = bfd_elf_local_sym_name (input_bfd, sym); + sym_name = bfd_elf_sym_name (input_bfd, symtab_hdr, sym, sec); relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); } @@ -4865,6 +5772,7 @@ ppc_elf_relocate_section (bfd *output_bfd, insn1 |= 32 << 26; /* lwz */ insn2 = 0x7c631214; /* add 3,3,2 */ rel[1].r_info = ELF32_R_INFO (r_symndx2, R_PPC_NONE); + rel[1].r_addend = 0; r_type = (((r_type - (R_PPC_GOT_TLSGD16 & 3)) & 3) + R_PPC_GOT_TPREL16); rel->r_info = ELF32_R_INFO (r_symndx, r_type); @@ -4879,13 +5787,13 @@ ppc_elf_relocate_section (bfd *output_bfd, /* Was an LD reloc. */ r_symndx = 0; rel->r_addend = htab->elf.tls_sec->vma + DTP_OFFSET; - rel[1].r_addend = htab->elf.tls_sec->vma + DTP_OFFSET; } r_type = R_PPC_TPREL16_HA; rel->r_info = ELF32_R_INFO (r_symndx, r_type); rel[1].r_info = ELF32_R_INFO (r_symndx, R_PPC_TPREL16_LO); rel[1].r_offset += 2; + rel[1].r_addend = rel->r_addend; } bfd_put_32 (output_bfd, insn1, contents + rel->r_offset - 2); bfd_put_32 (output_bfd, insn2, contents + offset); @@ -4942,8 +5850,8 @@ ppc_elf_relocate_section (bfd *output_bfd, { default: (*_bfd_error_handler) - (_("%s: unknown relocation type %d for symbol %s"), - bfd_archive_filename (input_bfd), (int) r_type, sym_name); + (_("%B: unknown relocation type %d for symbol %s"), + input_bfd, (int) r_type, sym_name); bfd_set_error (bfd_error_bad_value); ret = FALSE; @@ -5006,7 +5914,7 @@ ppc_elf_relocate_section (bfd *output_bfd, indx = 0; if (tls_type == (TLS_TLS | TLS_LD) && (h == NULL - || !(h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC))) + || !h->def_dynamic)) offp = &htab->tlsld_got.offset; else if (h != NULL) { @@ -5049,8 +5957,7 @@ ppc_elf_relocate_section (bfd *output_bfd, if (offp == &htab->tlsld_got.offset) tls_m = TLS_LD; else if (h == NULL - || !(h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_DYNAMIC)) + || !h->def_dynamic) tls_m &= ~TLS_LD; /* We might have multiple got entries for this sym. @@ -5169,8 +6076,7 @@ ppc_elf_relocate_section (bfd *output_bfd, { if ((tls_mask & TLS_LD) != 0 && !(h == NULL - || !(h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_DYNAMIC))) + || !h->def_dynamic)) off += 8; if (tls_type != (TLS_TLS | TLS_GD)) { @@ -5185,7 +6091,8 @@ ppc_elf_relocate_section (bfd *output_bfd, } } - relocation = htab->got->output_offset + off - 4; + relocation = htab->got->output_offset + off; + relocation -= htab->elf.hgot->root.u.def.value; /* Addends on got relocations don't make much sense. x+off@got is actually x@got+off, and since the got is @@ -5193,9 +6100,9 @@ ppc_elf_relocate_section (bfd *output_bfd, got at entry m+n bears little relation to the entry m. */ if (addend != 0) (*_bfd_error_handler) - (_("%s(%s+0x%lx): non-zero addend on %s reloc against `%s'"), - bfd_archive_filename (input_bfd), - bfd_get_section_name (input_bfd, input_section), + (_("%B(%A+0x%lx): non-zero addend on %s reloc against `%s'"), + input_bfd, + input_section, (long) rel->r_offset, howto->name, sym_name); @@ -5251,6 +6158,12 @@ ppc_elf_relocate_section (bfd *output_bfd, addend = 0; goto dodyn; + case R_PPC_REL16: + case R_PPC_REL16_LO: + case R_PPC_REL16_HI: + case R_PPC_REL16_HA: + break; + case R_PPC_REL24: case R_PPC_REL32: case R_PPC_REL14: @@ -5259,7 +6172,7 @@ ppc_elf_relocate_section (bfd *output_bfd, /* If these relocations are not to a named symbol, they can be handled right here, no need to bother the dynamic linker. */ if (SYMBOL_REFERENCES_LOCAL (info, h) - || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0) + || h == htab->elf.hgot) break; /* fall through */ @@ -5284,6 +6197,10 @@ ppc_elf_relocate_section (bfd *output_bfd, break; /* Fall thru. */ + if ((input_section->flags & SEC_ALLOC) == 0) + break; + /* Fall thru. */ + if ((info->shared && (h == NULL || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT @@ -5292,12 +6209,11 @@ ppc_elf_relocate_section (bfd *output_bfd, || !SYMBOL_CALLS_LOCAL (info, h))) || (ELIMINATE_COPY_RELOCS && !info->shared - && (input_section->flags & SEC_ALLOC) != 0 && h != NULL && h->dynindx != -1 - && (h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)) + && !h->non_got_ref + && h->def_dynamic + && !h->def_regular)) { int skip; @@ -5411,12 +6327,33 @@ ppc_elf_relocate_section (bfd *output_bfd, } break; + case R_PPC_RELAX32PC_PLT: + case R_PPC_RELAX32_PLT: + { + struct plt_entry *ent = find_plt_ent (h, got2, addend); + + if (htab->plt_type == PLT_NEW) + relocation = (htab->glink->output_section->vma + + htab->glink->output_offset + + ent->glink_offset); + else + relocation = (htab->plt->output_section->vma + + htab->plt->output_offset + + ent->plt.offset); + addend = 0; + } + if (r_type == R_PPC_RELAX32_PLT) + goto relax32; + /* Fall thru */ + case R_PPC_RELAX32PC: relocation -= (input_section->output_section->vma + input_section->output_offset + rel->r_offset - 4); /* Fall thru */ + case R_PPC_RELAX32: + relax32: { unsigned long t0; unsigned long t1; @@ -5441,20 +6378,18 @@ ppc_elf_relocate_section (bfd *output_bfd, /* Indirect .sdata relocation. */ case R_PPC_EMB_SDAI16: - BFD_ASSERT (htab->sdata != NULL); + BFD_ASSERT (htab->sdata[0].section != NULL); relocation - = elf_finish_pointer_linker_section (output_bfd, input_bfd, info, - htab->sdata, h, relocation, - rel, R_PPC_RELATIVE); + = elf_finish_pointer_linker_section (input_bfd, &htab->sdata[0], + h, relocation, rel); break; /* Indirect .sdata2 relocation. */ case R_PPC_EMB_SDA2I16: - BFD_ASSERT (htab->sdata2 != NULL); + BFD_ASSERT (htab->sdata[1].section != NULL); relocation - = elf_finish_pointer_linker_section (output_bfd, input_bfd, info, - htab->sdata2, h, relocation, - rel, R_PPC_RELATIVE); + = elf_finish_pointer_linker_section (input_bfd, &htab->sdata[1], + h, relocation, rel); break; /* Handle the TOC16 reloc. We want to use the offset within the .got @@ -5465,7 +6400,7 @@ ppc_elf_relocate_section (bfd *output_bfd, BFD_ASSERT (sec != NULL); BFD_ASSERT (bfd_is_und_section (sec) || strcmp (bfd_get_section_name (abfd, sec), ".got") == 0 - || strcmp (bfd_get_section_name (abfd, sec), ".cgot") == 0) + || strcmp (bfd_get_section_name (abfd, sec), ".cgot") == 0); addend -= sec->output_section->vma + sec->output_offset + 0x8000; break; @@ -5473,28 +6408,36 @@ ppc_elf_relocate_section (bfd *output_bfd, case R_PPC_PLTREL24: /* Relocation is to the entry for this symbol in the procedure linkage table. */ - BFD_ASSERT (h != NULL); + { + struct plt_entry *ent = find_plt_ent (h, got2, addend); - if (h->plt.offset == (bfd_vma) -1 - || htab->plt == NULL) - { - /* We didn't make a PLT entry for this symbol. This - happens when statically linking PIC code, or when - using -Bsymbolic. */ - break; - } + addend = 0; + if (ent == NULL + || htab->plt == NULL) + { + /* We didn't make a PLT entry for this symbol. This + happens when statically linking PIC code, or when + using -Bsymbolic. */ + break; + } - unresolved_reloc = FALSE; - relocation = (htab->plt->output_section->vma - + htab->plt->output_offset - + h->plt.offset); + unresolved_reloc = FALSE; + if (htab->plt_type == PLT_NEW) + relocation = (htab->glink->output_section->vma + + htab->glink->output_offset + + ent->glink_offset); + else + relocation = (htab->plt->output_section->vma + + htab->plt->output_offset + + ent->plt.offset); + } break; /* Relocate against _SDA_BASE_. */ case R_PPC_SDAREL16: { const char *name; - const struct elf_link_hash_entry *sh; + struct elf_link_hash_entry *sh; BFD_ASSERT (sec != NULL); name = bfd_get_section_name (abfd, sec->output_section); @@ -5504,17 +6447,17 @@ ppc_elf_relocate_section (bfd *output_bfd, && (name[5] == 0 || name[5] == '.')))) { (*_bfd_error_handler) - (_("%s: the target (%s) of a %s relocation is " + (_("%B: the target (%s) of a %s relocation is " "in the wrong output section (%s)"), - bfd_archive_filename (input_bfd), + input_bfd, sym_name, howto->name, name); } - sh = htab->sdata->sym_hash; + sh = htab->sdata[0].sym; addend -= (sh->root.u.def.value - + sh->root.u.def.section->output_section->vma - + sh->root.u.def.section->output_offset); + + sh->root.u.def.section->output_offset + + sh->root.u.def.section->output_section->vma); } break; @@ -5522,7 +6465,7 @@ ppc_elf_relocate_section (bfd *output_bfd, case R_PPC_EMB_SDA2REL: { const char *name; - const struct elf_link_hash_entry *sh; + struct elf_link_hash_entry *sh; BFD_ASSERT (sec != NULL); name = bfd_get_section_name (abfd, sec->output_section); @@ -5530,9 +6473,9 @@ ppc_elf_relocate_section (bfd *output_bfd, || strncmp (name, ".sbss2", 6) == 0)) { (*_bfd_error_handler) - (_("%s: the target (%s) of a %s relocation is " + (_("%B: the target (%s) of a %s relocation is " "in the wrong output section (%s)"), - bfd_archive_filename (input_bfd), + input_bfd, sym_name, howto->name, name); @@ -5541,10 +6484,10 @@ ppc_elf_relocate_section (bfd *output_bfd, ret = FALSE; continue; } - sh = htab->sdata2->sym_hash; + sh = htab->sdata[1].sym; addend -= (sh->root.u.def.value - + sh->root.u.def.section->output_section->vma - + sh->root.u.def.section->output_offset); + + sh->root.u.def.section->output_offset + + sh->root.u.def.section->output_section->vma); } break; @@ -5553,8 +6496,8 @@ ppc_elf_relocate_section (bfd *output_bfd, case R_PPC_EMB_RELSDA: { const char *name; - const struct elf_link_hash_entry *sh; int reg; + struct elf_link_hash_entry *sh; BFD_ASSERT (sec != NULL); name = bfd_get_section_name (abfd, sec->output_section); @@ -5564,20 +6507,20 @@ ppc_elf_relocate_section (bfd *output_bfd, && (name[5] == 0 || name[5] == '.')))) { reg = 13; - sh = htab->sdata->sym_hash; + sh = htab->sdata[0].sym; addend -= (sh->root.u.def.value - + sh->root.u.def.section->output_section->vma - + sh->root.u.def.section->output_offset); + + sh->root.u.def.section->output_offset + + sh->root.u.def.section->output_section->vma); } else if (strncmp (name, ".sdata2", 7) == 0 || strncmp (name, ".sbss2", 6) == 0) { reg = 2; - sh = htab->sdata2->sym_hash; + sh = htab->sdata[1].sym; addend -= (sh->root.u.def.value - + sh->root.u.def.section->output_section->vma - + sh->root.u.def.section->output_offset); + + sh->root.u.def.section->output_offset + + sh->root.u.def.section->output_section->vma); } else if (strcmp (name, ".PPC.EMB.sdata0") == 0 @@ -5589,9 +6532,9 @@ ppc_elf_relocate_section (bfd *output_bfd, else { (*_bfd_error_handler) - (_("%s: the target (%s) of a %s relocation is " + (_("%B: the target (%s) of a %s relocation is " "in the wrong output section (%s)"), - bfd_archive_filename (input_bfd), + input_bfd, sym_name, howto->name, name); @@ -5644,8 +6587,8 @@ ppc_elf_relocate_section (bfd *output_bfd, case R_PPC_EMB_RELST_HA: case R_PPC_EMB_BIT_FLD: (*_bfd_error_handler) - (_("%s: relocation %s is not yet supported for symbol %s."), - bfd_archive_filename (input_bfd), + (_("%B: relocation %s is not yet supported for symbol %s."), + input_bfd, howto->name, sym_name); @@ -5661,6 +6604,7 @@ ppc_elf_relocate_section (bfd *output_bfd, break; case R_PPC_ADDR16_HA: + case R_PPC_REL16_HA: case R_PPC_GOT16_HA: case R_PPC_PLT16_HA: case R_PPC_SECTOFF_HA: @@ -5696,12 +6640,12 @@ ppc_elf_relocate_section (bfd *output_bfd, if (unresolved_reloc && !((input_section->flags & SEC_DEBUGGING) != 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0)) + && h->def_dynamic)) { (*_bfd_error_handler) - (_("%s(%s+0x%lx): unresolvable %s relocation against symbol `%s'"), - bfd_archive_filename (input_bfd), - bfd_get_section_name (input_bfd, input_section), + (_("%B(%A+0x%lx): unresolvable %s relocation against symbol `%s'"), + input_bfd, + input_section, (long) rel->r_offset, howto->name, sym_name); @@ -5718,8 +6662,6 @@ ppc_elf_relocate_section (bfd *output_bfd, if (r != bfd_reloc_ok) { - if (sym_name == NULL) - sym_name = "(null)"; if (r == bfd_reloc_overflow) { if (warned) @@ -5738,6 +6680,7 @@ ppc_elf_relocate_section (bfd *output_bfd, } if (! (*info->callbacks->reloc_overflow) (info, + (h ? &h->root : NULL), sym_name, howto->name, rel->r_addend, @@ -5749,9 +6692,8 @@ ppc_elf_relocate_section (bfd *output_bfd, else { (*_bfd_error_handler) - (_("%s(%s+0x%lx): %s reloc against `%s': error %d"), - bfd_archive_filename (input_bfd), - bfd_get_section_name (input_bfd, input_section), + (_("%B(%A+0x%lx): %s reloc against `%s': error %d"), + input_bfd, input_section, (long) rel->r_offset, howto->name, sym_name, (int) r); ret = FALSE; } @@ -5764,7 +6706,338 @@ ppc_elf_relocate_section (bfd *output_bfd, return ret; } + +#define PPC_LO(v) ((v) & 0xffff) +#define PPC_HI(v) (((v) >> 16) & 0xffff) +#define PPC_HA(v) PPC_HI ((v) + 0x8000) +/* Finish up dynamic symbol handling. We set the contents of various + dynamic sections here. */ + +static bfd_boolean +ppc_elf_finish_dynamic_symbol (bfd *output_bfd, + struct bfd_link_info *info, + struct elf_link_hash_entry *h, + Elf_Internal_Sym *sym) +{ + struct ppc_elf_link_hash_table *htab; + struct plt_entry *ent; + bfd_boolean doneone; + +#ifdef DEBUG + fprintf (stderr, "ppc_elf_finish_dynamic_symbol called for %s", + h->root.root.string); +#endif + + htab = ppc_elf_hash_table (info); + BFD_ASSERT (htab->elf.dynobj != NULL); + + doneone = FALSE; + for (ent = h->plt.plist; ent != NULL; ent = ent->next) + if (ent->plt.offset != (bfd_vma) -1) + { + if (!doneone) + { + Elf_Internal_Rela rela; + bfd_byte *loc; + bfd_vma reloc_index; + + if (htab->plt_type == PLT_NEW) + reloc_index = ent->plt.offset / 4; + else + { + reloc_index = ((ent->plt.offset - htab->plt_initial_entry_size) + / htab->plt_slot_size); + if (reloc_index > PLT_NUM_SINGLE_ENTRIES + && htab->plt_type == PLT_OLD) + reloc_index -= (reloc_index - PLT_NUM_SINGLE_ENTRIES) / 2; + } + + /* This symbol has an entry in the procedure linkage table. + Set it up. */ + if (htab->plt_type == PLT_VXWORKS) + { + bfd_vma got_offset; + const bfd_vma *plt_entry; + + /* The first three entries in .got.plt are reserved. */ + got_offset = (reloc_index + 3) * 4; + + /* Use the right PLT. */ + plt_entry = info->shared ? ppc_elf_vxworks_pic_plt_entry + : ppc_elf_vxworks_plt_entry; + + /* Fill in the .plt on VxWorks. */ + if (info->shared) + { + bfd_vma got_offset_hi = (got_offset >> 16) + + ((got_offset & 0x8000) >> 15); + + bfd_put_32 (output_bfd, + plt_entry[0] | (got_offset_hi & 0xffff), + htab->plt->contents + ent->plt.offset + 0); + bfd_put_32 (output_bfd, + plt_entry[1] | (got_offset & 0xffff), + htab->plt->contents + ent->plt.offset + 4); + } + else + { + bfd_vma got_loc + = (got_offset + + htab->elf.hgot->root.u.def.value + + htab->elf.hgot->root.u.def.section->output_offset + + htab->elf.hgot->root.u.def.section->output_section->vma); + bfd_vma got_loc_hi = (got_loc >> 16) + + ((got_loc & 0x8000) >> 15); + + bfd_put_32 (output_bfd, + plt_entry[0] | (got_loc_hi & 0xffff), + htab->plt->contents + ent->plt.offset + 0); + bfd_put_32 (output_bfd, + plt_entry[1] | (got_loc & 0xffff), + htab->plt->contents + ent->plt.offset + 4); + } + + bfd_put_32 (output_bfd, plt_entry[2], + htab->plt->contents + ent->plt.offset + 8); + bfd_put_32 (output_bfd, plt_entry[3], + htab->plt->contents + ent->plt.offset + 12); + + /* This instruction is an immediate load. The value loaded is + the byte offset of the R_PPC_JMP_SLOT relocation from the + start of the .rela.plt section. The value is stored in the + low-order 16 bits of the load instruction. */ + /* NOTE: It appears that this is now an index rather than a + prescaled offset. */ + bfd_put_32 (output_bfd, + plt_entry[4] | reloc_index, + htab->plt->contents + ent->plt.offset + 16); + /* This instruction is a PC-relative branch whose target is + the start of the PLT section. The address of this branch + instruction is 20 bytes beyond the start of this PLT entry. + The address is encoded in bits 6-29, inclusive. The value + stored is right-shifted by two bits, permitting a 26-bit + offset. */ + bfd_put_32 (output_bfd, + (plt_entry[5] + | (-(ent->plt.offset + 20) & 0x03fffffc)), + htab->plt->contents + ent->plt.offset + 20); + bfd_put_32 (output_bfd, plt_entry[6], + htab->plt->contents + ent->plt.offset + 24); + bfd_put_32 (output_bfd, plt_entry[7], + htab->plt->contents + ent->plt.offset + 28); + + /* Fill in the GOT entry corresponding to this PLT slot with + the address immediately after the the "bctr" instruction + in this PLT entry. */ + bfd_put_32 (output_bfd, (htab->plt->output_section->vma + + htab->plt->output_offset + + ent->plt.offset + 16), + htab->sgotplt->contents + got_offset); + + if (!info->shared) + { + /* Fill in a couple of entries in .rela.plt.unloaded. */ + loc = htab->srelplt2->contents + + ((VXWORKS_PLTRESOLVE_RELOCS + reloc_index + * VXWORKS_PLT_NON_JMP_SLOT_RELOCS) + * sizeof (Elf32_External_Rela)); + + /* Provide the @ha relocation for the first instruction. */ + rela.r_offset = (htab->plt->output_section->vma + + htab->plt->output_offset + + ent->plt.offset + 2); + rela.r_info = ELF32_R_INFO (htab->elf.hgot->indx, + R_PPC_ADDR16_HA); + rela.r_addend = got_offset; + bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); + loc += sizeof (Elf32_External_Rela); + + /* Provide the @l relocation for the second instruction. */ + rela.r_offset = (htab->plt->output_section->vma + + htab->plt->output_offset + + ent->plt.offset + 6); + rela.r_info = ELF32_R_INFO (htab->elf.hgot->indx, + R_PPC_ADDR16_LO); + rela.r_addend = got_offset; + bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); + loc += sizeof (Elf32_External_Rela); + + /* Provide a relocation for the GOT entry corresponding to this + PLT slot. Point it at the middle of the .plt entry. */ + rela.r_offset = (htab->sgotplt->output_section->vma + + htab->sgotplt->output_offset + + got_offset); + rela.r_info = ELF32_R_INFO (htab->elf.hplt->indx, + R_PPC_ADDR32); + rela.r_addend = ent->plt.offset + 16; + bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); + } + + /* VxWorks uses non-standard semantics for R_PPC_JMP_SLOT. + In particular, the offset for the relocation is not the + address of the PLT entry for this function, as specified + by the ABI. Instead, the offset is set to the address of + the GOT slot for this function. See EABI 4.4.4.1. */ + rela.r_offset = (htab->sgotplt->output_section->vma + + htab->sgotplt->output_offset + + got_offset); + + } + else + { + rela.r_offset = (htab->plt->output_section->vma + + htab->plt->output_offset + + ent->plt.offset); + if (htab->plt_type == PLT_OLD) + { + /* We don't need to fill in the .plt. The ppc dynamic + linker will fill it in. */ + } + else + { + bfd_vma val = (htab->glink_pltresolve + ent->plt.offset + + htab->glink->output_section->vma + + htab->glink->output_offset); + bfd_put_32 (output_bfd, val, + htab->plt->contents + ent->plt.offset); + } + } + + /* Fill in the entry in the .rela.plt section. */ + rela.r_info = ELF32_R_INFO (h->dynindx, R_PPC_JMP_SLOT); + rela.r_addend = 0; + + loc = (htab->relplt->contents + + reloc_index * sizeof (Elf32_External_Rela)); + bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); + + if (!h->def_regular) + { + /* Mark the symbol as undefined, rather than as defined in + the .plt section. Leave the value alone. */ + sym->st_shndx = SHN_UNDEF; + /* If the symbol is weak, we do need to clear the value. + Otherwise, the PLT entry would provide a definition for + the symbol even if the symbol wasn't defined anywhere, + and so the symbol would never be NULL. */ + if (!h->ref_regular_nonweak) + sym->st_value = 0; + } + doneone = TRUE; + } + + if (htab->plt_type == PLT_NEW) + { + bfd_vma plt; + unsigned char *p; + + plt = (ent->plt.offset + + htab->plt->output_section->vma + + htab->plt->output_offset); + p = (unsigned char *) htab->glink->contents + ent->glink_offset; + + if (info->shared || info->pie) + { + bfd_vma got = 0; + + if (ent->addend >= 32768) + got = (ent->addend + + ent->sec->output_section->vma + + ent->sec->output_offset); + else if (htab->elf.hgot != NULL) + got = (htab->elf.hgot->root.u.def.value + + htab->elf.hgot->root.u.def.section->output_section->vma + + htab->elf.hgot->root.u.def.section->output_offset); + + plt -= got; + + if (plt + 0x8000 < 0x10000) + { + bfd_put_32 (output_bfd, LWZ_11_30 + PPC_LO (plt), p); + p += 4; + bfd_put_32 (output_bfd, MTCTR_11, p); + p += 4; + bfd_put_32 (output_bfd, BCTR, p); + p += 4; + bfd_put_32 (output_bfd, NOP, p); + p += 4; + } + else + { + bfd_put_32 (output_bfd, ADDIS_11_30 + PPC_HA (plt), p); + p += 4; + bfd_put_32 (output_bfd, LWZ_11_11 + PPC_LO (plt), p); + p += 4; + bfd_put_32 (output_bfd, MTCTR_11, p); + p += 4; + bfd_put_32 (output_bfd, BCTR, p); + p += 4; + } + } + else + { + bfd_put_32 (output_bfd, LIS_11 + PPC_HA (plt), p); + p += 4; + bfd_put_32 (output_bfd, LWZ_11_11 + PPC_LO (plt), p); + p += 4; + bfd_put_32 (output_bfd, MTCTR_11, p); + p += 4; + bfd_put_32 (output_bfd, BCTR, p); + p += 4; + + /* We only need one non-PIC glink stub. */ + break; + } + } + else + break; + } + + if (h->needs_copy) + { + asection *s; + Elf_Internal_Rela rela; + bfd_byte *loc; + + /* This symbols needs a copy reloc. Set it up. */ + +#ifdef DEBUG + fprintf (stderr, ", copy"); +#endif + + BFD_ASSERT (h->dynindx != -1); + + if (ppc_elf_hash_entry (h)->has_sda_refs) + s = htab->relsbss; + else + s = htab->relbss; + BFD_ASSERT (s != NULL); + + rela.r_offset = (h->root.u.def.value + + h->root.u.def.section->output_section->vma + + h->root.u.def.section->output_offset); + rela.r_info = ELF32_R_INFO (h->dynindx, R_PPC_COPY); + rela.r_addend = 0; + loc = s->contents + s->reloc_count++ * sizeof (Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); + } + +#ifdef DEBUG + fprintf (stderr, "\n"); +#endif + + /* Mark some specially defined symbols as absolute. */ + if (strcmp (h->root.root.string, "_DYNAMIC") == 0 + || (!htab->is_vxworks + && (h == htab->elf.hgot + || strcmp (h->root.root.string, + "_PROCEDURE_LINKAGE_TABLE_") == 0))) + sym->st_shndx = SHN_ABS; + + return TRUE; +} + static enum elf_reloc_type_class ppc_elf_reloc_type_class (const Elf_Internal_Rela *rela) { @@ -5783,370 +7056,374 @@ ppc_elf_reloc_type_class (const Elf_Internal_Rela *rela) } } -/* Support for core dump NOTE sections. */ +/* Finish up the dynamic sections. */ static bfd_boolean -ppc_elf_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) +ppc_elf_finish_dynamic_sections (bfd *output_bfd, + struct bfd_link_info *info) { - int offset; - unsigned int raw_size; + asection *sdyn; + asection *splt; + struct ppc_elf_link_hash_table *htab; + bfd_vma got; + bfd * dynobj; - switch (note->descsz) +#ifdef DEBUG + fprintf (stderr, "ppc_elf_finish_dynamic_sections called\n"); +#endif + + htab = ppc_elf_hash_table (info); + dynobj = elf_hash_table (info)->dynobj; + sdyn = bfd_get_section_by_name (dynobj, ".dynamic"); + if (htab->is_vxworks) + splt = bfd_get_section_by_name (dynobj, ".plt"); + else + splt = NULL; + + got = 0; + if (htab->elf.hgot != NULL) + got = (htab->elf.hgot->root.u.def.value + + htab->elf.hgot->root.u.def.section->output_section->vma + + htab->elf.hgot->root.u.def.section->output_offset); + + if (htab->elf.dynamic_sections_created) { - default: - return FALSE; + Elf32_External_Dyn *dyncon, *dynconend; - case 268: /* Linux/PPC. */ - /* pr_cursig */ - elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12); + BFD_ASSERT (htab->plt != NULL && sdyn != NULL); - /* pr_pid */ - elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24); + dyncon = (Elf32_External_Dyn *) sdyn->contents; + dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->size); + for (; dyncon < dynconend; dyncon++) + { + Elf_Internal_Dyn dyn; + asection *s; - /* pr_reg */ - offset = 72; - raw_size = 192; + bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn); - break; + switch (dyn.d_tag) + { + case DT_PLTGOT: + if (htab->is_vxworks) + s = htab->sgotplt; + else + s = htab->plt; + dyn.d_un.d_ptr = s->output_section->vma + s->output_offset; + break; + + case DT_PLTRELSZ: + dyn.d_un.d_val = htab->relplt->size; + break; + + case DT_JMPREL: + s = htab->relplt; + dyn.d_un.d_ptr = s->output_section->vma + s->output_offset; + break; + + case DT_PPC_GOT: + dyn.d_un.d_ptr = got; + break; + + case DT_RELASZ: + if (htab->is_vxworks) + { + if (htab->relplt) + dyn.d_un.d_ptr -= htab->relplt->size; + break; + } + continue; + + default: + continue; + } + + bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + } } - /* Make a ".reg/999" section. */ - return _bfd_elfcore_make_pseudosection (abfd, ".reg", - raw_size, note->descpos + offset); -} - -static bfd_boolean -ppc_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) -{ - switch (note->descsz) + /* Add a blrl instruction at _GLOBAL_OFFSET_TABLE_-4 so that a function can + easily find the address of the _GLOBAL_OFFSET_TABLE_. */ + if (htab->got != NULL) { - default: - return FALSE; + unsigned char *p = htab->got->contents; + bfd_vma val; - case 128: /* Linux/PPC elf_prpsinfo. */ - elf_tdata (abfd)->core_program - = _bfd_elfcore_strndup (abfd, note->descdata + 32, 16); - elf_tdata (abfd)->core_command - = _bfd_elfcore_strndup (abfd, note->descdata + 48, 80); + p += htab->elf.hgot->root.u.def.value; + if (htab->plt_type == PLT_OLD) + bfd_put_32 (output_bfd, 0x4e800021 /* blrl */, p - 4); + + val = 0; + if (sdyn != NULL) + val = sdyn->output_section->vma + sdyn->output_offset; + bfd_put_32 (output_bfd, val, p); + + elf_section_data (htab->got->output_section)->this_hdr.sh_entsize = 4; } - /* Note that for some reason, a spurious space is tacked - onto the end of the args in some (at least one anyway) - implementations, so strip it off if it exists. */ + /* Fill in the first entry in the VxWorks procedure linkage table. */ + if (splt && splt->size > 0) + { + /* Use the right PLT. */ + static const bfd_vma *plt_entry = NULL; + plt_entry = info->shared ? + ppc_elf_vxworks_pic_plt0_entry : ppc_elf_vxworks_plt0_entry; - { - char *command = elf_tdata (abfd)->core_command; - int n = strlen (command); + if (!info->shared) + { + bfd_vma got_value = + (htab->elf.hgot->root.u.def.section->output_section->vma + + htab->elf.hgot->root.u.def.section->output_offset + + htab->elf.hgot->root.u.def.value); + bfd_vma got_hi = (got_value >> 16) + ((got_value & 0x8000) >> 15); - if (0 < n && command[n - 1] == ' ') - command[n - 1] = '\0'; - } + bfd_put_32 (output_bfd, plt_entry[0] | (got_hi & 0xffff), + splt->contents + 0); + bfd_put_32 (output_bfd, plt_entry[1] | (got_value & 0xffff), + splt->contents + 4); + } + else + { + bfd_put_32 (output_bfd, plt_entry[0], splt->contents + 0); + bfd_put_32 (output_bfd, plt_entry[1], splt->contents + 4); + } + bfd_put_32 (output_bfd, plt_entry[2], splt->contents + 8); + bfd_put_32 (output_bfd, plt_entry[3], splt->contents + 12); + bfd_put_32 (output_bfd, plt_entry[4], splt->contents + 16); + bfd_put_32 (output_bfd, plt_entry[5], splt->contents + 20); + bfd_put_32 (output_bfd, plt_entry[6], splt->contents + 24); + bfd_put_32 (output_bfd, plt_entry[7], splt->contents + 28); + + if (! info->shared) + { + Elf_Internal_Rela rela; + bfd_byte *loc; + + loc = htab->srelplt2->contents; + + /* Output the @ha relocation for the first instruction. */ + rela.r_offset = (htab->plt->output_section->vma + + htab->plt->output_offset + + 2); + rela.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_PPC_ADDR16_HA); + rela.r_addend = 0; + bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); + loc += sizeof (Elf32_External_Rela); + + /* Output the @l relocation for the second instruction. */ + rela.r_offset = (htab->plt->output_section->vma + + htab->plt->output_offset + + 6); + rela.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_PPC_ADDR16_LO); + rela.r_addend = 0; + bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); + loc += sizeof (Elf32_External_Rela); + + /* Fix up the remaining relocations. They may have the wrong + symbol index for _G_O_T_ or _P_L_T_ depending on the order + in which symbols were output. */ + while (loc < htab->srelplt2->contents + htab->srelplt2->size) + { + Elf_Internal_Rela rel; + + bfd_elf32_swap_reloc_in (output_bfd, loc, &rel); + rel.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_PPC_ADDR16_HA); + bfd_elf32_swap_reloc_out (output_bfd, &rel, loc); + loc += sizeof (Elf32_External_Rela); + + bfd_elf32_swap_reloc_in (output_bfd, loc, &rel); + rel.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_PPC_ADDR16_LO); + bfd_elf32_swap_reloc_out (output_bfd, &rel, loc); + loc += sizeof (Elf32_External_Rela); + + bfd_elf32_swap_reloc_in (output_bfd, loc, &rel); + rel.r_info = ELF32_R_INFO (htab->elf.hplt->indx, R_PPC_ADDR32); + bfd_elf32_swap_reloc_out (output_bfd, &rel, loc); + loc += sizeof (Elf32_External_Rela); + } + } + } + + if (htab->glink != NULL && htab->glink->contents != NULL) + { + unsigned char *p; + unsigned char *endp; + bfd_vma res0; + unsigned int i; + + /* + * PIC glink code is the following: + * + * # ith PLT code stub. + * addis 11,30,(plt+(i-1)*4-got)@ha + * lwz 11,(plt+(i-1)*4-got)@l(11) + * mtctr 11 + * bctr + * + * # A table of branches, one for each plt entry. + * # The idea is that the plt call stub loads ctr (and r11) with these + * # addresses, so (r11 - res_0) gives the plt index * 4. + * res_0: b PLTresolve + * res_1: b PLTresolve + * . + * # Some number of entries towards the end can be nops + * res_n_m3: nop + * res_n_m2: nop + * res_n_m1: + * + * PLTresolve: + * addis 11,11,(1f-res_0)@ha + * mflr 0 + * bcl 20,31,1f + * 1: addi 11,11,(1b-res_0)@l + * mflr 12 + * mtlr 0 + * sub 11,11,12 # r11 = index * 4 + * addis 12,12,(got+4-1b)@ha + * lwz 0,(got+4-1b)@l(12) # got[1] address of dl_runtime_resolve + * lwz 12,(got+8-1b)@l(12) # got[2] contains the map address + * mtctr 0 + * add 0,11,11 + * add 11,0,11 # r11 = index * 12 = reloc offset. + * bctr + */ + static const unsigned int pic_plt_resolve[] = + { + ADDIS_11_11, + MFLR_0, + BCL_20_31, + ADDI_11_11, + MFLR_12, + MTLR_0, + SUB_11_11_12, + ADDIS_12_12, + LWZ_0_12, + LWZ_12_12, + MTCTR_0, + ADD_0_11_11, + ADD_11_0_11, + BCTR, + NOP, + NOP + }; + + static const unsigned int plt_resolve[] = + { + LIS_12, + ADDIS_11_11, + LWZ_0_12, + ADDI_11_11, + MTCTR_0, + ADD_0_11_11, + LWZ_12_12, + ADD_11_0_11, + BCTR, + NOP, + NOP, + NOP, + NOP, + NOP, + NOP, + NOP + }; + + if (ARRAY_SIZE (pic_plt_resolve) != GLINK_PLTRESOLVE / 4) + abort (); + if (ARRAY_SIZE (plt_resolve) != GLINK_PLTRESOLVE / 4) + abort (); + + /* Build the branch table, one for each plt entry (less one), + and perhaps some padding. */ + p = htab->glink->contents; + p += htab->glink_pltresolve; + endp = htab->glink->contents; + endp += htab->glink->size - GLINK_PLTRESOLVE; + while (p < endp - 8 * 4) + { + bfd_put_32 (output_bfd, B + endp - p, p); + p += 4; + } + while (p < endp) + { + bfd_put_32 (output_bfd, NOP, p); + p += 4; + } + + res0 = (htab->glink_pltresolve + + htab->glink->output_section->vma + + htab->glink->output_offset); + + /* Last comes the PLTresolve stub. */ + if (info->shared || info->pie) + { + bfd_vma bcl; + + for (i = 0; i < ARRAY_SIZE (pic_plt_resolve); i++) + { + bfd_put_32 (output_bfd, pic_plt_resolve[i], p); + p += 4; + } + p -= 4 * ARRAY_SIZE (pic_plt_resolve); + + bcl = (htab->glink->size - GLINK_PLTRESOLVE + 3*4 + + htab->glink->output_section->vma + + htab->glink->output_offset); + + bfd_put_32 (output_bfd, + ADDIS_11_11 + PPC_HA (bcl - res0), p + 0*4); + bfd_put_32 (output_bfd, + ADDI_11_11 + PPC_LO (bcl - res0), p + 3*4); + bfd_put_32 (output_bfd, + ADDIS_12_12 + PPC_HA (got + 4 - bcl), p + 7*4); + if (PPC_HA (got + 4 - bcl) == PPC_HA (got + 8 - bcl)) + { + bfd_put_32 (output_bfd, + LWZ_0_12 + PPC_LO (got + 4 - bcl), p + 8*4); + bfd_put_32 (output_bfd, + LWZ_12_12 + PPC_LO (got + 8 - bcl), p + 9*4); + } + else + { + bfd_put_32 (output_bfd, + LWZU_0_12 + PPC_LO (got + 4 - bcl), p + 8*4); + bfd_put_32 (output_bfd, + LWZ_12_12 + 4, p + 9*4); + } + } + else + { + for (i = 0; i < ARRAY_SIZE (plt_resolve); i++) + { + bfd_put_32 (output_bfd, plt_resolve[i], p); + p += 4; + } + p -= 4 * ARRAY_SIZE (plt_resolve); + + bfd_put_32 (output_bfd, + LIS_12 + PPC_HA (got + 4), p + 0*4); + bfd_put_32 (output_bfd, + ADDIS_11_11 + PPC_HA (-res0), p + 1*4); + bfd_put_32 (output_bfd, + ADDI_11_11 + PPC_LO (-res0), p + 3*4); + if (PPC_HA (got + 4) == PPC_HA (got + 8)) + { + bfd_put_32 (output_bfd, + LWZ_0_12 + PPC_LO (got + 4), p + 2*4); + bfd_put_32 (output_bfd, + LWZ_12_12 + PPC_LO (got + 8), p + 6*4); + } + else + { + bfd_put_32 (output_bfd, + LWZU_0_12 + PPC_LO (got + 4), p + 2*4); + bfd_put_32 (output_bfd, + LWZ_12_12 + 4, p + 6*4); + } + } + } return TRUE; } -/* Very simple linked list structure for recording apuinfo values. */ -typedef struct apuinfo_list -{ - struct apuinfo_list *next; - unsigned long value; -} -apuinfo_list; - -static apuinfo_list *head; - - -static void -apuinfo_list_init (void) -{ - head = NULL; -} - -static void -apuinfo_list_add (unsigned long value) -{ - apuinfo_list *entry = head; - - while (entry != NULL) - { - if (entry->value == value) - return; - entry = entry->next; - } - - entry = bfd_malloc (sizeof (* entry)); - if (entry == NULL) - return; - - entry->value = value; - entry->next = head; - head = entry; -} - -static unsigned -apuinfo_list_length (void) -{ - apuinfo_list *entry; - unsigned long count; - - for (entry = head, count = 0; - entry; - entry = entry->next) - ++ count; - - return count; -} - -static inline unsigned long -apuinfo_list_element (unsigned long number) -{ - apuinfo_list * entry; - - for (entry = head; - entry && number --; - entry = entry->next) - ; - - return entry ? entry->value : 0; -} - -static void -apuinfo_list_finish (void) -{ - apuinfo_list *entry; - - for (entry = head; entry;) - { - apuinfo_list *next = entry->next; - free (entry); - entry = next; - } - - head = NULL; -} - -#define APUINFO_SECTION_NAME ".PPC.EMB.apuinfo" -#define APUINFO_LABEL "APUinfo" - -/* Scan the input BFDs and create a linked list of - the APUinfo values that will need to be emitted. */ - -static void -ppc_elf_begin_write_processing (bfd *abfd, struct bfd_link_info *link_info) -{ - bfd *ibfd; - asection *asec; - char *buffer; - unsigned num_input_sections; - bfd_size_type output_section_size; - unsigned i; - unsigned num_entries; - unsigned long offset; - unsigned long length; - const char *error_message = NULL; - - if (link_info == NULL) - return; - - /* Scan the input bfds, looking for apuinfo sections. */ - num_input_sections = 0; - output_section_size = 0; - - for (ibfd = link_info->input_bfds; ibfd; ibfd = ibfd->link_next) - { - asec = bfd_get_section_by_name (ibfd, APUINFO_SECTION_NAME); - if (asec) - { - ++ num_input_sections; - output_section_size += asec->_raw_size; - } - } - - /* We need at least one input sections - in order to make merging worthwhile. */ - if (num_input_sections < 1) - return; - - /* Just make sure that the output section exists as well. */ - asec = bfd_get_section_by_name (abfd, APUINFO_SECTION_NAME); - if (asec == NULL) - return; - - /* Allocate a buffer for the contents of the input sections. */ - buffer = bfd_malloc (output_section_size); - if (buffer == NULL) - return; - - offset = 0; - apuinfo_list_init (); - - /* Read in the input sections contents. */ - for (ibfd = link_info->input_bfds; ibfd; ibfd = ibfd->link_next) - { - unsigned long datum; - char *ptr; - - asec = bfd_get_section_by_name (ibfd, APUINFO_SECTION_NAME); - if (asec == NULL) - continue; - - length = asec->_raw_size; - if (length < 24) - { - error_message = _("corrupt or empty %s section in %s"); - goto fail; - } - - if (bfd_seek (ibfd, asec->filepos, SEEK_SET) != 0 - || (bfd_bread (buffer + offset, length, ibfd) != length)) - { - error_message = _("unable to read in %s section from %s"); - goto fail; - } - - /* Process the contents of the section. */ - ptr = buffer + offset; - error_message = _("corrupt %s section in %s"); - - /* Verify the contents of the header. Note - we have to - extract the values this way in order to allow for a - host whose endian-ness is different from the target. */ - datum = bfd_get_32 (ibfd, ptr); - if (datum != sizeof APUINFO_LABEL) - goto fail; - - datum = bfd_get_32 (ibfd, ptr + 8); - if (datum != 0x2) - goto fail; - - if (strcmp (ptr + 12, APUINFO_LABEL) != 0) - goto fail; - - /* Get the number of bytes used for apuinfo entries. */ - datum = bfd_get_32 (ibfd, ptr + 4); - if (datum + 20 != length) - goto fail; - - /* Make sure that we do not run off the end of the section. */ - if (offset + length > output_section_size) - goto fail; - - /* Scan the apuinfo section, building a list of apuinfo numbers. */ - for (i = 0; i < datum; i += 4) - apuinfo_list_add (bfd_get_32 (ibfd, ptr + 20 + i)); - - /* Update the offset. */ - offset += length; - } - - error_message = NULL; - - /* Compute the size of the output section. */ - num_entries = apuinfo_list_length (); - output_section_size = 20 + num_entries * 4; - - asec = bfd_get_section_by_name (abfd, APUINFO_SECTION_NAME); - - if (! bfd_set_section_size (abfd, asec, output_section_size)) - ibfd = abfd, - error_message = _("warning: unable to set size of %s section in %s"); - - fail: - free (buffer); - - if (error_message) - (*_bfd_error_handler) (error_message, APUINFO_SECTION_NAME, - bfd_archive_filename (ibfd)); -} - - -/* Prevent the output section from accumulating the input sections' - contents. We have already stored this in our linked list structure. */ - -static bfd_boolean -ppc_elf_write_section (bfd *abfd ATTRIBUTE_UNUSED, - asection *asec, - bfd_byte *contents ATTRIBUTE_UNUSED) -{ - return (apuinfo_list_length () - && strcmp (asec->name, APUINFO_SECTION_NAME) == 0); -} - - -/* Finally we can generate the output section. */ - -static void -ppc_elf_final_write_processing (bfd *abfd, bfd_boolean linker ATTRIBUTE_UNUSED) -{ - bfd_byte *buffer; - asection *asec; - unsigned i; - unsigned num_entries; - bfd_size_type length; - - asec = bfd_get_section_by_name (abfd, APUINFO_SECTION_NAME); - if (asec == NULL) - return; - - if (apuinfo_list_length () == 0) - return; - - length = asec->_raw_size; - if (length < 20) - return; - - buffer = bfd_malloc (length); - if (buffer == NULL) - { - (*_bfd_error_handler) - (_("failed to allocate space for new APUinfo section.")); - return; - } - - /* Create the apuinfo header. */ - num_entries = apuinfo_list_length (); - bfd_put_32 (abfd, sizeof APUINFO_LABEL, buffer); - bfd_put_32 (abfd, num_entries * 4, buffer + 4); - bfd_put_32 (abfd, 0x2, buffer + 8); - strcpy (buffer + 12, APUINFO_LABEL); - - length = 20; - for (i = 0; i < num_entries; i++) - { - bfd_put_32 (abfd, apuinfo_list_element (i), buffer + length); - length += 4; - } - - if (length != asec->_raw_size) - (*_bfd_error_handler) (_("failed to compute new APUinfo section.")); - - if (! bfd_set_section_contents (abfd, asec, buffer, (file_ptr) 0, length)) - (*_bfd_error_handler) (_("failed to install new APUinfo section.")); - - free (buffer); - - apuinfo_list_finish (); -} - -/* Add extra PPC sections -- Note, for now, make .sbss2 and - .PPC.EMB.sbss0 a normal section, and not a bss section so - that the linker doesn't crater when trying to make more than - 2 sections. */ - -static struct bfd_elf_special_section const ppc_elf_special_sections[]= -{ - { ".tags", 5, 0, SHT_ORDERED, SHF_ALLOC }, - { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, - { ".sbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, - { ".sdata2", 7, -2, SHT_PROGBITS, SHF_ALLOC }, - { ".sbss2", 6, -2, SHT_PROGBITS, SHF_ALLOC }, - { ".PPC.EMB.apuinfo", 16, 0, SHT_NOTE, 0 }, - { ".PPC.EMB.sdata0", 15, 0, SHT_PROGBITS, SHF_ALLOC }, - { ".PPC.EMB.sbss0", 14, 0, SHT_PROGBITS, SHF_ALLOC }, - { ".plt", 4, 0, SHT_NOBITS, SHF_ALLOC + SHF_EXECINSTR }, - { NULL, 0, 0, 0, 0 } -}; - #define TARGET_LITTLE_SYM bfd_elf32_powerpcle_vec #define TARGET_LITTLE_NAME "elf32-powerpcle" #define TARGET_BIG_SYM bfd_elf32_powerpc_vec @@ -6158,6 +7435,7 @@ static struct bfd_elf_special_section const ppc_elf_special_sections[]= #else #define ELF_MAXPAGESIZE 0x10000 #endif +#define ELF_MINPAGESIZE 0x1000 #define elf_info_to_howto ppc_elf_info_to_howto #ifdef EM_CYGNUS_POWERPC @@ -6169,10 +7447,8 @@ static struct bfd_elf_special_section const ppc_elf_special_sections[]= #endif #define elf_backend_plt_not_loaded 1 -#define elf_backend_got_symbol_offset 4 #define elf_backend_can_gc_sections 1 #define elf_backend_can_refcount 1 -#define elf_backend_got_header_size 12 #define elf_backend_rela_normal 1 #define bfd_elf32_mkobject ppc_elf_mkobject @@ -6197,13 +7473,121 @@ static struct bfd_elf_special_section const ppc_elf_special_sections[]= #define elf_backend_finish_dynamic_sections ppc_elf_finish_dynamic_sections #define elf_backend_fake_sections ppc_elf_fake_sections #define elf_backend_additional_program_headers ppc_elf_additional_program_headers -#define elf_backend_modify_segment_map ppc_elf_modify_segment_map #define elf_backend_grok_prstatus ppc_elf_grok_prstatus #define elf_backend_grok_psinfo ppc_elf_grok_psinfo #define elf_backend_reloc_type_class ppc_elf_reloc_type_class #define elf_backend_begin_write_processing ppc_elf_begin_write_processing #define elf_backend_final_write_processing ppc_elf_final_write_processing #define elf_backend_write_section ppc_elf_write_section -#define elf_backend_special_sections ppc_elf_special_sections +#define elf_backend_get_sec_type_attr ppc_elf_get_sec_type_attr +#define elf_backend_plt_sym_val ppc_elf_plt_sym_val +#define elf_backend_action_discarded ppc_elf_action_discarded + +#include "elf32-target.h" + +/* VxWorks Target */ + +#undef TARGET_LITTLE_SYM +#undef TARGET_LITTLE_NAME + +#undef TARGET_BIG_SYM +#define TARGET_BIG_SYM bfd_elf32_powerpc_vxworks_vec +#undef TARGET_BIG_NAME +#define TARGET_BIG_NAME "elf32-powerpc-vxworks" + +/* VxWorks uses the elf default section flags for .plt. */ +static const struct bfd_elf_special_section * +ppc_elf_vxworks_get_sec_type_attr (bfd *abfd ATTRIBUTE_UNUSED, asection *sec) +{ + if (sec->name == NULL) + return NULL; + + if (strcmp (sec->name, ".plt") == 0) + return _bfd_elf_get_sec_type_attr (abfd, sec); + + return ppc_elf_get_sec_type_attr (abfd, sec); +} + +/* Like ppc_elf_link_hash_table_create, but overrides + appropriately for VxWorks. */ +static struct bfd_link_hash_table * +ppc_elf_vxworks_link_hash_table_create (bfd *abfd) +{ + struct bfd_link_hash_table *ret; + + ret = ppc_elf_link_hash_table_create (abfd); + if (ret) + { + struct ppc_elf_link_hash_table *htab + = (struct ppc_elf_link_hash_table *)ret; + htab->is_vxworks = 1; + htab->plt_type = PLT_VXWORKS; + htab->plt_entry_size = VXWORKS_PLT_ENTRY_SIZE; + htab->plt_slot_size = VXWORKS_PLT_ENTRY_SIZE; + htab->plt_initial_entry_size = VXWORKS_PLT_INITIAL_ENTRY_SIZE; + } + return ret; +} + +/* Tweak magic VxWorks symbols as they are loaded. */ +static bfd_boolean +ppc_elf_vxworks_add_symbol_hook (bfd *abfd, + struct bfd_link_info *info, + Elf_Internal_Sym *sym, + const char **namep ATTRIBUTE_UNUSED, + flagword *flagsp ATTRIBUTE_UNUSED, + asection **secp, + bfd_vma *valp) +{ + if (!elf_vxworks_add_symbol_hook(abfd, info, sym,namep, flagsp, secp, + valp)) + return FALSE; + + return ppc_elf_add_symbol_hook(abfd, info, sym,namep, flagsp, secp, valp); +} + +static void +ppc_elf_vxworks_final_write_processing (bfd *abfd, bfd_boolean linker) +{ + ppc_elf_final_write_processing(abfd, linker); + elf_vxworks_final_write_processing(abfd, linker); +} + +/* On VxWorks, we emit relocations against _PROCEDURE_LINKAGE_TABLE_, so + define it. */ +#undef elf_backend_want_plt_sym +#define elf_backend_want_plt_sym 1 +#undef elf_backend_want_got_plt +#define elf_backend_want_got_plt 1 +#undef elf_backend_got_symbol_offset +#define elf_backend_got_symbol_offset 0 +#undef elf_backend_plt_not_loaded +#define elf_backend_plt_not_loaded 0 +#undef elf_backend_plt_readonly +#define elf_backend_plt_readonly 1 +#undef elf_backend_got_header_size +#define elf_backend_got_header_size 12 + +#undef bfd_elf32_bfd_link_hash_table_create +#define bfd_elf32_bfd_link_hash_table_create \ + ppc_elf_vxworks_link_hash_table_create +#undef elf_backend_add_symbol_hook +#define elf_backend_add_symbol_hook \ + ppc_elf_vxworks_add_symbol_hook +#undef elf_backend_link_output_symbol_hook +#define elf_backend_link_output_symbol_hook \ + elf_vxworks_link_output_symbol_hook +#undef elf_backend_final_write_processing +#define elf_backend_final_write_processing \ + ppc_elf_vxworks_final_write_processing +#undef elf_backend_get_sec_type_attr +#define elf_backend_get_sec_type_attr \ + ppc_elf_vxworks_get_sec_type_attr +#undef elf_backend_emit_relocs +#define elf_backend_emit_relocs \ + elf_vxworks_emit_relocs + +#undef elf32_bed +#define elf32_bed ppc_elf_vxworks_bed #include "elf32-target.h" diff --git a/contrib/binutils/bfd/elf32-ppc.h b/contrib/binutils/bfd/elf32-ppc.h index fa2c585610b..5f8f63a38a5 100644 --- a/contrib/binutils/bfd/elf32-ppc.h +++ b/contrib/binutils/bfd/elf32-ppc.h @@ -1,5 +1,5 @@ /* PowerPC-specific support for 64-bit ELF. - Copyright 2003 Free Software Foundation, Inc. + Copyright 2003, 2005 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -15,7 +15,9 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ +int ppc_elf_select_plt_layout (bfd *, struct bfd_link_info *, int, int); asection *ppc_elf_tls_setup (bfd *, struct bfd_link_info *); bfd_boolean ppc_elf_tls_optimize (bfd *, struct bfd_link_info *); +void ppc_elf_set_sdata_syms (bfd *, struct bfd_link_info *); diff --git a/contrib/binutils/bfd/elf32-s390.c b/contrib/binutils/bfd/elf32-s390.c index 074c1089342..eb8e1724fc1 100644 --- a/contrib/binutils/bfd/elf32-s390.c +++ b/contrib/binutils/bfd/elf32-s390.c @@ -1,5 +1,6 @@ /* IBM S/390-specific support for 32-bit ELF - Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. Contributed by Carl B. Pedersen and Martin Schwidefsky. This file is part of BFD, the Binary File Descriptor library. @@ -16,8 +17,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" @@ -40,7 +41,7 @@ static bfd_boolean create_got_section static bfd_boolean elf_s390_create_dynamic_sections PARAMS((bfd *, struct bfd_link_info *)); static void elf_s390_copy_indirect_symbol - PARAMS ((const struct elf_backend_data *, struct elf_link_hash_entry *, + PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, struct elf_link_hash_entry *)); static bfd_boolean elf_s390_check_relocs PARAMS ((bfd *, struct bfd_link_info *, asection *, @@ -350,7 +351,8 @@ elf_s390_info_to_howto (abfd, cache_ptr, dst) arelent *cache_ptr; Elf_Internal_Rela *dst; { - switch (ELF32_R_TYPE(dst->r_info)) + unsigned int r_type = ELF32_R_TYPE(dst->r_info); + switch (r_type) { case R_390_GNU_VTINHERIT: cache_ptr->howto = &elf32_s390_vtinherit_howto; @@ -361,8 +363,13 @@ elf_s390_info_to_howto (abfd, cache_ptr, dst) break; default: - BFD_ASSERT (ELF32_R_TYPE(dst->r_info) < (unsigned int) R_390_max); - cache_ptr->howto = &elf_howto_table[ELF32_R_TYPE(dst->r_info)]; + if (r_type >= sizeof (elf_howto_table) / sizeof (elf_howto_table[0])) + { + (*_bfd_error_handler) (_("%B: invalid relocation type %d"), + abfd, (int) r_type); + r_type = R_390_NONE; + } + cache_ptr->howto = &elf_howto_table[r_type]; } } @@ -411,7 +418,7 @@ s390_elf_ldisp_reloc (abfd, reloc_entry, symbol, data, input_section, if (output_bfd != NULL) return bfd_reloc_continue; - if (reloc_entry->address > input_section->_cooked_size) + if (reloc_entry->address > bfd_get_section_limit (abfd, input_section)) return bfd_reloc_outofrange; relocation = (symbol->value @@ -764,7 +771,8 @@ elf_s390_link_hash_table_create (abfd) if (ret == NULL) return NULL; - if (! _bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc)) + if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc, + sizeof (struct elf_s390_link_hash_entry))) { free (ret); return NULL; @@ -802,12 +810,13 @@ create_got_section (dynobj, info) if (!htab->sgot || !htab->sgotplt) abort (); - htab->srelgot = bfd_make_section (dynobj, ".rela.got"); + htab->srelgot = bfd_make_section_with_flags (dynobj, ".rela.got", + (SEC_ALLOC | SEC_LOAD + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_LINKER_CREATED + | SEC_READONLY)); if (htab->srelgot == NULL - || ! bfd_set_section_flags (dynobj, htab->srelgot, - (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS - | SEC_IN_MEMORY | SEC_LINKER_CREATED - | SEC_READONLY)) || ! bfd_set_section_alignment (dynobj, htab->srelgot, 2)) return FALSE; return TRUE; @@ -847,8 +856,8 @@ elf_s390_create_dynamic_sections (dynobj, info) /* Copy the extra info we tack onto an elf_link_hash_entry. */ static void -elf_s390_copy_indirect_symbol (bed, dir, ind) - const struct elf_backend_data *bed; +elf_s390_copy_indirect_symbol (info, dir, ind) + struct bfd_link_info *info; struct elf_link_hash_entry *dir, *ind; { struct elf_s390_link_hash_entry *edir, *eind; @@ -863,10 +872,7 @@ elf_s390_copy_indirect_symbol (bed, dir, ind) struct elf_s390_dyn_relocs **pp; struct elf_s390_dyn_relocs *p; - if (ind->root.type == bfd_link_hash_indirect) - abort (); - - /* Add reloc counts against the weak sym to the strong sym + /* Add reloc counts against the indirect sym to the direct sym list. Merge any entries against the same section. */ for (pp = &eind->dyn_relocs; (p = *pp) != NULL; ) { @@ -899,17 +905,18 @@ elf_s390_copy_indirect_symbol (bed, dir, ind) if (ELIMINATE_COPY_RELOCS && ind->root.type != bfd_link_hash_indirect - && (dir->elf_link_hash_flags & ELF_LINK_HASH_DYNAMIC_ADJUSTED) != 0) - /* If called to transfer flags for a weakdef during processing - of elf_adjust_dynamic_symbol, don't copy ELF_LINK_NON_GOT_REF. - We clear it ourselves for ELIMINATE_COPY_RELOCS. */ - dir->elf_link_hash_flags |= - (ind->elf_link_hash_flags & (ELF_LINK_HASH_REF_DYNAMIC - | ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_REF_REGULAR_NONWEAK - | ELF_LINK_HASH_NEEDS_PLT)); + && dir->dynamic_adjusted) + { + /* If called to transfer flags for a weakdef during processing + of elf_adjust_dynamic_symbol, don't copy non_got_ref. + We clear it ourselves for ELIMINATE_COPY_RELOCS. */ + dir->ref_dynamic |= ind->ref_dynamic; + dir->ref_regular |= ind->ref_regular; + dir->ref_regular_nonweak |= ind->ref_regular_nonweak; + dir->needs_plt |= ind->needs_plt; + } else - _bfd_elf_link_hash_copy_indirect (bed, dir, ind); + _bfd_elf_link_hash_copy_indirect (info, dir, ind); } static int @@ -980,16 +987,20 @@ elf_s390_check_relocs (abfd, info, sec, relocs) if (r_symndx >= NUM_SHDR_ENTRIES (symtab_hdr)) { - (*_bfd_error_handler) (_("%s: bad symbol index: %d"), - bfd_archive_filename (abfd), - r_symndx); + (*_bfd_error_handler) (_("%B: bad symbol index: %d"), + abfd, r_symndx); return FALSE; } if (r_symndx < symtab_hdr->sh_info) h = NULL; else - h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + { + 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; + } /* Create got section and local_got_refcounts array if they are needed. */ @@ -1069,7 +1080,7 @@ elf_s390_check_relocs (abfd, info, sec, relocs) creating a procedure linkage table entry. */ if (h != NULL) { - h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; + h->needs_plt = 1; h->plt.refcount += 1; } break; @@ -1090,7 +1101,7 @@ elf_s390_check_relocs (abfd, info, sec, relocs) if (h != NULL) { ((struct elf_s390_link_hash_entry *) h)->gotplt_refcount++; - h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; + h->needs_plt = 1; h->plt.refcount += 1; } else @@ -1158,8 +1169,8 @@ elf_s390_check_relocs (abfd, info, sec, relocs) if (old_tls_type == GOT_NORMAL || tls_type == GOT_NORMAL) { (*_bfd_error_handler) - (_("%s: `%s' accessed both as normal and thread local symbol"), - bfd_archive_filename (abfd), h->root.root.string); + (_("%B: `%s' accessed both as normal and thread local symbol"), + abfd, h->root.root.string); return FALSE; } if (old_tls_type > tls_type) @@ -1199,7 +1210,7 @@ elf_s390_check_relocs (abfd, info, sec, relocs) sections have not yet been mapped to output sections. Tentatively set the flag for now, and correct in adjust_dynamic_symbol. */ - h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF; + h->non_got_ref = 1; /* We may need a .plt entry if the function this reloc refers to is in a shared lib. */ @@ -1236,15 +1247,13 @@ elf_s390_check_relocs (abfd, info, sec, relocs) || (h != NULL && (! info->symbolic || h->root.type == bfd_link_hash_defweak - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0)))) + || !h->def_regular)))) || (ELIMINATE_COPY_RELOCS && !info->shared && (sec->flags & SEC_ALLOC) != 0 && h != NULL && (h->root.type == bfd_link_hash_defweak - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0))) + || !h->def_regular))) { struct elf_s390_dyn_relocs *p; struct elf_s390_dyn_relocs **head; @@ -1269,8 +1278,8 @@ elf_s390_check_relocs (abfd, info, sec, relocs) name + 5) != 0) { (*_bfd_error_handler) - (_("%s: bad relocation section name `%s\'"), - bfd_archive_filename (abfd), name); + (_("%B: bad relocation section name `%s\'"), + abfd, name); } if (htab->elf.dynobj == NULL) @@ -1282,13 +1291,14 @@ elf_s390_check_relocs (abfd, info, sec, relocs) { flagword flags; - sreloc = bfd_make_section (dynobj, name); flags = (SEC_HAS_CONTENTS | SEC_READONLY | SEC_IN_MEMORY | SEC_LINKER_CREATED); if ((sec->flags & SEC_ALLOC) != 0) flags |= SEC_ALLOC | SEC_LOAD; + sreloc = bfd_make_section_with_flags (dynobj, + name, + flags); if (sreloc == NULL - || ! bfd_set_section_flags (dynobj, sreloc, flags) || ! bfd_set_section_alignment (dynobj, sreloc, 2)) return FALSE; } @@ -1307,14 +1317,15 @@ elf_s390_check_relocs (abfd, info, sec, relocs) We really need local syms available to do this easily. Oh well. */ asection *s; + void *vpp; s = bfd_section_from_r_symndx (abfd, &htab->sym_sec, sec, r_symndx); if (s == NULL) return FALSE; - head = ((struct elf_s390_dyn_relocs **) - &elf_section_data (s)->local_dynrel); + vpp = &elf_section_data (s)->local_dynrel; + head = (struct elf_s390_dyn_relocs **) vpp; } p = *head; @@ -1439,6 +1450,9 @@ elf_s390_gc_sweep_hook (abfd, info, sec, relocs) struct elf_s390_dyn_relocs *p; 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; eh = (struct elf_s390_link_hash_entry *) h; for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next) @@ -1581,12 +1595,12 @@ elf_s390_adjust_dynamic_symbol (info, h) will fill in the contents of the procedure linkage table later (although we could actually do it here). */ if (h->type == STT_FUNC - || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0) + || h->needs_plt) { if (h->plt.refcount <= 0 || (! info->shared - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0 + && !h->def_dynamic + && !h->ref_dynamic && h->root.type != bfd_link_hash_undefweak && h->root.type != bfd_link_hash_undefined)) { @@ -1596,7 +1610,7 @@ elf_s390_adjust_dynamic_symbol (info, h) such a case, we don't actually need to build a procedure linkage table, and we can just do a PC32 reloc instead. */ h->plt.offset = (bfd_vma) -1; - h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; + h->needs_plt = 0; elf_s390_adjust_gotplt((struct elf_s390_link_hash_entry *) h); } @@ -1613,16 +1627,14 @@ elf_s390_adjust_dynamic_symbol (info, h) /* 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) + if (h->u.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; + BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined + || h->u.weakdef->root.type == bfd_link_hash_defweak); + h->root.u.def.section = h->u.weakdef->root.u.def.section; + h->root.u.def.value = h->u.weakdef->root.u.def.value; if (ELIMINATE_COPY_RELOCS || info->nocopyreloc) - h->elf_link_hash_flags - = ((h->elf_link_hash_flags & ~ELF_LINK_NON_GOT_REF) - | (h->weakdef->elf_link_hash_flags & ELF_LINK_NON_GOT_REF)); + h->non_got_ref = h->u.weakdef->non_got_ref; return TRUE; } @@ -1638,13 +1650,13 @@ elf_s390_adjust_dynamic_symbol (info, h) /* If there are no references to this symbol that do not use the GOT, we don't need to generate a copy reloc. */ - if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0) + if (!h->non_got_ref) return TRUE; /* If -z nocopyreloc was given, we won't generate them either. */ if (info->nocopyreloc) { - h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF; + h->non_got_ref = 0; return TRUE; } @@ -1665,11 +1677,18 @@ elf_s390_adjust_dynamic_symbol (info, h) we'll be keeping the dynamic relocs and avoiding the copy reloc. */ if (p == NULL) { - h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF; + h->non_got_ref = 0; return TRUE; } } + if (h->size == 0) + { + (*_bfd_error_handler) (_("dynamic variable `%s' is zero size"), + h->root.root.string); + return TRUE; + } + /* We must allocate the symbol in our .dynbss section, which will become part of the .bss section of the executable. There will be an entry for this symbol in the .dynsym section. The dynamic @@ -1687,8 +1706,8 @@ elf_s390_adjust_dynamic_symbol (info, h) runtime process image. */ if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) { - htab->srelbss->_raw_size += sizeof (Elf32_External_Rela); - h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY; + htab->srelbss->size += sizeof (Elf32_External_Rela); + h->needs_copy = 1; } /* We need to figure out the alignment required for this symbol. I @@ -1699,7 +1718,7 @@ elf_s390_adjust_dynamic_symbol (info, h) /* Apply the required alignment. */ s = htab->sdynbss; - s->_raw_size = BFD_ALIGN (s->_raw_size, (bfd_size_type) (1 << power_of_two)); + s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two)); if (power_of_two > bfd_get_section_alignment (htab->elf.dynobj, s)) { if (! bfd_set_section_alignment (htab->elf.dynobj, s, power_of_two)) @@ -1708,10 +1727,10 @@ elf_s390_adjust_dynamic_symbol (info, h) /* Define the symbol as being at this point in the section. */ h->root.u.def.section = s; - h->root.u.def.value = s->_raw_size; + h->root.u.def.value = s->size; /* Increment the section size to make room for the symbol. */ - s->_raw_size += h->size; + s->size += h->size; return TRUE; } @@ -1749,7 +1768,7 @@ allocate_dynrelocs (h, inf) /* Make sure this symbol is output as a dynamic symbol. Undefined weak syms won't yet be marked as dynamic. */ if (h->dynindx == -1 - && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) + && !h->forced_local) { if (! bfd_elf_link_record_dynamic_symbol (info, h)) return FALSE; @@ -1762,10 +1781,10 @@ allocate_dynrelocs (h, inf) /* If this is the first .plt entry, make room for the special first entry. */ - if (s->_raw_size == 0) - s->_raw_size += PLT_FIRST_ENTRY_SIZE; + if (s->size == 0) + s->size += PLT_FIRST_ENTRY_SIZE; - h->plt.offset = s->_raw_size; + h->plt.offset = s->size; /* If this symbol is not defined in a regular file, and we are not generating a shared library, then set the symbol to this @@ -1773,33 +1792,33 @@ allocate_dynrelocs (h, inf) pointers compare as equal between the normal executable and the shared library. */ if (! info->shared - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + && !h->def_regular) { h->root.u.def.section = s; h->root.u.def.value = h->plt.offset; } /* Make room for this entry. */ - s->_raw_size += PLT_ENTRY_SIZE; + s->size += PLT_ENTRY_SIZE; /* We also need to make an entry in the .got.plt section, which will be placed in the .got section by the linker script. */ - htab->sgotplt->_raw_size += GOT_ENTRY_SIZE; + htab->sgotplt->size += GOT_ENTRY_SIZE; /* We also need to make an entry in the .rela.plt section. */ - htab->srelplt->_raw_size += sizeof (Elf32_External_Rela); + htab->srelplt->size += sizeof (Elf32_External_Rela); } else { h->plt.offset = (bfd_vma) -1; - h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; + h->needs_plt = 0; elf_s390_adjust_gotplt((struct elf_s390_link_hash_entry *) h); } } else { h->plt.offset = (bfd_vma) -1; - h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; + h->needs_plt = 0; elf_s390_adjust_gotplt((struct elf_s390_link_hash_entry *) h); } @@ -1817,8 +1836,8 @@ allocate_dynrelocs (h, inf) to be stored somewhere. The immediate value in the instruction is not bit enough so the value is stored in the got. */ { - h->got.offset = htab->sgot->_raw_size; - htab->sgot->_raw_size += GOT_ENTRY_SIZE; + h->got.offset = htab->sgot->size; + htab->sgot->size += GOT_ENTRY_SIZE; } else h->got.offset = (bfd_vma) -1; @@ -1832,31 +1851,31 @@ allocate_dynrelocs (h, inf) /* Make sure this symbol is output as a dynamic symbol. Undefined weak syms won't yet be marked as dynamic. */ if (h->dynindx == -1 - && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) + && !h->forced_local) { if (! bfd_elf_link_record_dynamic_symbol (info, h)) return FALSE; } s = htab->sgot; - h->got.offset = s->_raw_size; - s->_raw_size += GOT_ENTRY_SIZE; + h->got.offset = s->size; + s->size += GOT_ENTRY_SIZE; /* R_390_TLS_GD32 needs 2 consecutive GOT slots. */ if (tls_type == GOT_TLS_GD) - s->_raw_size += GOT_ENTRY_SIZE; + s->size += GOT_ENTRY_SIZE; dyn = htab->elf.dynamic_sections_created; /* R_390_TLS_IE32 needs one dynamic relocation, R_390_TLS_GD32 needs one if local symbol and two if global. */ if ((tls_type == GOT_TLS_GD && h->dynindx == -1) || tls_type >= GOT_TLS_IE) - htab->srelgot->_raw_size += sizeof (Elf32_External_Rela); + htab->srelgot->size += sizeof (Elf32_External_Rela); else if (tls_type == GOT_TLS_GD) - htab->srelgot->_raw_size += 2 * sizeof (Elf32_External_Rela); + htab->srelgot->size += 2 * sizeof (Elf32_External_Rela); else if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT || h->root.type != bfd_link_hash_undefweak) && (info->shared || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h))) - htab->srelgot->_raw_size += sizeof (Elf32_External_Rela); + htab->srelgot->size += sizeof (Elf32_External_Rela); } else h->got.offset = (bfd_vma) -1; @@ -1890,9 +1909,21 @@ allocate_dynrelocs (h, inf) /* Also discard relocs on undefined weak syms with non-default visibility. */ - if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT + if (eh->dyn_relocs != NULL && h->root.type == bfd_link_hash_undefweak) - eh->dyn_relocs = NULL; + { + if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT) + eh->dyn_relocs = NULL; + + /* Make sure undefined weak symbols are output as a dynamic + symbol in PIEs. */ + else if (h->dynindx == -1 + && !h->forced_local) + { + if (! bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } + } } else if (ELIMINATE_COPY_RELOCS) { @@ -1900,9 +1931,9 @@ allocate_dynrelocs (h, inf) symbols which turn out to need copy relocs or are not dynamic. */ - if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0 - && (((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + if (!h->non_got_ref + && ((h->def_dynamic + && !h->def_regular) || (htab->elf.dynamic_sections_created && (h->root.type == bfd_link_hash_undefweak || h->root.type == bfd_link_hash_undefined)))) @@ -1910,7 +1941,7 @@ allocate_dynrelocs (h, inf) /* Make sure this symbol is output as a dynamic symbol. Undefined weak syms won't yet be marked as dynamic. */ if (h->dynindx == -1 - && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) + && !h->forced_local) { if (! bfd_elf_link_record_dynamic_symbol (info, h)) return FALSE; @@ -1932,7 +1963,7 @@ allocate_dynrelocs (h, inf) { asection *sreloc = elf_section_data (p->sec)->sreloc; - sreloc->_raw_size += p->count * sizeof (Elf32_External_Rela); + sreloc->size += p->count * sizeof (Elf32_External_Rela); } return TRUE; @@ -1995,7 +2026,7 @@ elf_s390_size_dynamic_sections (output_bfd, info) s = bfd_get_section_by_name (dynobj, ".interp"); if (s == NULL) abort (); - s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER; + s->size = sizeof ELF_DYNAMIC_INTERPRETER; s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER; } } @@ -2018,10 +2049,7 @@ elf_s390_size_dynamic_sections (output_bfd, info) { struct elf_s390_dyn_relocs *p; - for (p = *((struct elf_s390_dyn_relocs **) - &elf_section_data (s)->local_dynrel); - p != NULL; - p = p->next) + for (p = elf_section_data (s)->local_dynrel; p != NULL; p = p->next) { if (!bfd_is_abs_section (p->sec) && bfd_is_abs_section (p->sec->output_section)) @@ -2034,7 +2062,7 @@ elf_s390_size_dynamic_sections (output_bfd, info) else if (p->count != 0) { srela = elf_section_data (p->sec)->sreloc; - srela->_raw_size += p->count * sizeof (Elf32_External_Rela); + srela->size += p->count * sizeof (Elf32_External_Rela); if ((p->sec->output_section->flags & SEC_READONLY) != 0) info->flags |= DF_TEXTREL; } @@ -2055,12 +2083,12 @@ elf_s390_size_dynamic_sections (output_bfd, info) { if (*local_got > 0) { - *local_got = s->_raw_size; - s->_raw_size += GOT_ENTRY_SIZE; + *local_got = s->size; + s->size += GOT_ENTRY_SIZE; if (*local_tls_type == GOT_TLS_GD) - s->_raw_size += GOT_ENTRY_SIZE; + s->size += GOT_ENTRY_SIZE; if (info->shared) - srela->_raw_size += sizeof (Elf32_External_Rela); + srela->size += sizeof (Elf32_External_Rela); } else *local_got = (bfd_vma) -1; @@ -2071,9 +2099,9 @@ elf_s390_size_dynamic_sections (output_bfd, info) { /* Allocate 2 got entries and 1 dynamic reloc for R_390_TLS_LDM32 relocs. */ - htab->tls_ldm_got.offset = htab->sgot->_raw_size; - htab->sgot->_raw_size += 2 * GOT_ENTRY_SIZE; - htab->srelgot->_raw_size += sizeof (Elf32_External_Rela); + htab->tls_ldm_got.offset = htab->sgot->size; + htab->sgot->size += 2 * GOT_ENTRY_SIZE; + htab->srelgot->size += sizeof (Elf32_External_Rela); } else htab->tls_ldm_got.offset = -1; @@ -2092,14 +2120,15 @@ elf_s390_size_dynamic_sections (output_bfd, info) if (s == htab->splt || s == htab->sgot - || s == htab->sgotplt) + || s == htab->sgotplt + || s == htab->sdynbss) { /* Strip this section if we don't need it; see the comment below. */ } else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0) { - if (s->_raw_size != 0) + if (s->size != 0) relocs = TRUE; /* We use the reloc_count field as a counter if we need @@ -2112,7 +2141,7 @@ elf_s390_size_dynamic_sections (output_bfd, info) continue; } - if (s->_raw_size == 0) + if (s->size == 0) { /* If we don't need this section, strip it from the output file. This is to handle .rela.bss and @@ -2124,16 +2153,19 @@ elf_s390_size_dynamic_sections (output_bfd, info) function which decides whether anything needs to go into these sections. */ - _bfd_strip_section_from_output (info, s); + s->flags |= SEC_EXCLUDE; continue; } + if ((s->flags & SEC_HAS_CONTENTS) == 0) + continue; + /* Allocate memory for the section contents. We use bfd_zalloc here in case unused entries are not reclaimed before the section's contents are written out. This should not happen, but this way if it does, we get a R_390_NONE reloc instead of garbage. */ - s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size); + s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->size); if (s->contents == NULL) return FALSE; } @@ -2154,7 +2186,7 @@ elf_s390_size_dynamic_sections (output_bfd, info) return FALSE; } - if (htab->splt->_raw_size != 0) + if (htab->splt->size != 0) { if (!add_dynamic_entry (DT_PLTGOT, 0) || !add_dynamic_entry (DT_PLTRELSZ, 0) @@ -2231,9 +2263,9 @@ invalid_tls_insn (input_bfd, input_section, rel) howto = elf_howto_table + ELF32_R_TYPE (rel->r_info); (*_bfd_error_handler) - (_("%s(%s+0x%lx): invalid instruction for TLS relocation %s"), - bfd_archive_filename (input_bfd), - bfd_get_section_name (input_bfd, input_section), + (_("%B(%A+0x%lx): invalid instruction for TLS relocation %s"), + input_bfd, + input_section, (long) rel->r_offset, howto->name); } @@ -2373,8 +2405,8 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, || (info->shared && (info->symbolic || h->dynindx == -1 - || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL)) - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)) + || h->forced_local) + && h->def_regular) || (ELF_ST_VISIBILITY (h->other) && h->root.type == bfd_link_hash_undefweak)) { @@ -2554,11 +2586,9 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, && !info->shared && h != NULL && h->dynindx != -1 - && (h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0 - && (((h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - && (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0) + && !h->non_got_ref + && ((h->def_dynamic + && !h->def_regular) || h->root.type == bfd_link_hash_undefweak || h->root.type == bfd_link_hash_undefined))) { @@ -2594,8 +2624,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, || r_type == R_390_PC32 || !info->shared || !info->symbolic - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0)) + || !h->def_regular)) { outrel.r_info = ELF32_R_INFO (h->dynindx, r_type); outrel.r_addend = rel->r_addend; @@ -2991,12 +3020,13 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, not process them. */ if (unresolved_reloc && !((input_section->flags & SEC_DEBUGGING) != 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0)) + && h->def_dynamic)) (*_bfd_error_handler) - (_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"), - bfd_archive_filename (input_bfd), - bfd_get_section_name (input_bfd, input_section), + (_("%B(%A+0x%lx): unresolvable %s relocation against symbol `%s'"), + input_bfd, + input_section, (long) rel->r_offset, + howto->name, h->root.root.string); if (r_type == R_390_20 @@ -3036,16 +3066,16 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, { if (! ((*info->callbacks->reloc_overflow) - (info, name, howto->name, (bfd_vma) 0, - input_bfd, input_section, rel->r_offset))) + (info, (h ? &h->root : NULL), name, howto->name, + (bfd_vma) 0, input_bfd, input_section, + rel->r_offset))) return FALSE; } else { (*_bfd_error_handler) - (_("%s(%s+0x%lx): reloc against `%s': error %d"), - bfd_archive_filename (input_bfd), - bfd_get_section_name (input_bfd, input_section), + (_("%B(%A+0x%lx): reloc against `%s': error %d"), + input_bfd, input_section, (long) rel->r_offset, name, (int) r); return FALSE; } @@ -3196,7 +3226,7 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym) loc = htab->srelplt->contents + plt_index * sizeof (Elf32_External_Rela); bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); - if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + if (!h->def_regular) { /* Mark the symbol as undefined, rather than as defined in the .plt section. Leave the value alone. This is a clue @@ -3233,8 +3263,8 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym) if (info->shared && (info->symbolic || h->dynindx == -1 - || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL)) - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)) + || h->forced_local) + && h->def_regular) { BFD_ASSERT((h->got.offset & 1) != 0); rela.r_info = ELF32_R_INFO (0, R_390_RELATIVE); @@ -3255,7 +3285,7 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym) bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); } - if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0) + if (h->needs_copy) { Elf_Internal_Rela rela; bfd_byte *loc; @@ -3280,8 +3310,8 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym) /* Mark some specially defined symbols as absolute. */ if (strcmp (h->root.root.string, "_DYNAMIC") == 0 - || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0 - || strcmp (h->root.root.string, "_PROCEDURE_LINKAGE_TABLE_") == 0) + || h == htab->elf.hgot + || h == htab->elf.hplt) sym->st_shndx = SHN_ABS; return TRUE; @@ -3330,7 +3360,7 @@ elf_s390_finish_dynamic_sections (output_bfd, info) abort (); dyncon = (Elf32_External_Dyn *) sdyn->contents; - dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->_raw_size); + dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->size); for (; dyncon < dynconend; dyncon++) { Elf_Internal_Dyn dyn; @@ -3353,10 +3383,7 @@ elf_s390_finish_dynamic_sections (output_bfd, info) case DT_PLTRELSZ: s = htab->srelplt->output_section; - if (s->_cooked_size != 0) - dyn.d_un.d_val = s->_cooked_size; - else - dyn.d_un.d_val = s->_raw_size; + dyn.d_un.d_val = s->size; break; } @@ -3364,7 +3391,7 @@ elf_s390_finish_dynamic_sections (output_bfd, info) } /* Fill in the special first entry in the procedure linkage table. */ - if (htab->splt && htab->splt->_raw_size > 0) + if (htab->splt && htab->splt->size > 0) { memset (htab->splt->contents, 0, PLT_FIRST_ENTRY_SIZE); if (info->shared) @@ -3408,7 +3435,7 @@ elf_s390_finish_dynamic_sections (output_bfd, info) if (htab->sgotplt) { /* Fill in the first three entries in the global offset table. */ - if (htab->sgotplt->_raw_size > 0) + if (htab->sgotplt->size > 0) { bfd_put_32 (output_bfd, (sdyn == NULL ? (bfd_vma) 0 @@ -3432,7 +3459,7 @@ elf_s390_grok_prstatus (abfd, note) Elf_Internal_Note * note; { int offset; - unsigned int raw_size; + unsigned int size; switch (note->descsz) { @@ -3448,15 +3475,26 @@ elf_s390_grok_prstatus (abfd, note) /* pr_reg */ offset = 72; - raw_size = 144; + size = 144; break; } /* Make a ".reg/999" section. */ return _bfd_elfcore_make_pseudosection (abfd, ".reg", - raw_size, note->descpos + offset); + size, note->descpos + offset); } +/* Return address for Ith PLT stub in section PLT, for relocation REL + or (bfd_vma) -1 if it should not be included. */ + +static bfd_vma +elf_s390_plt_sym_val (bfd_vma i, const asection *plt, + const arelent *rel ATTRIBUTE_UNUSED) +{ + return plt->vma + PLT_FIRST_ENTRY_SIZE + i * PLT_ENTRY_SIZE; +} + + #define TARGET_BIG_SYM bfd_elf32_s390_vec #define TARGET_BIG_NAME "elf32-s390" #define ELF_ARCH bfd_arch_s390 @@ -3491,6 +3529,7 @@ elf_s390_grok_prstatus (abfd, note) #define elf_backend_size_dynamic_sections elf_s390_size_dynamic_sections #define elf_backend_reloc_type_class elf_s390_reloc_type_class #define elf_backend_grok_prstatus elf_s390_grok_prstatus +#define elf_backend_plt_sym_val elf_s390_plt_sym_val #define bfd_elf32_mkobject elf_s390_mkobject #define elf_backend_object_p elf_s390_object_p diff --git a/contrib/binutils/bfd/elf32-sparc.c b/contrib/binutils/bfd/elf32-sparc.c index 0f94f5f31bb..3bfb38a3d44 100644 --- a/contrib/binutils/bfd/elf32-sparc.c +++ b/contrib/binutils/bfd/elf32-sparc.c @@ -1,6 +1,6 @@ /* SPARC-specific support for 32-bit ELF Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003, 2004 Free Software Foundation, Inc. + 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" @@ -25,483 +25,9 @@ #include "elf-bfd.h" #include "elf/sparc.h" #include "opcode/sparc.h" +#include "elfxx-sparc.h" +#include "elf-vxworks.h" -static reloc_howto_type *elf32_sparc_reloc_type_lookup - PARAMS ((bfd *, bfd_reloc_code_real_type)); -static void elf32_sparc_info_to_howto - PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); -static bfd_boolean elf32_sparc_check_relocs - PARAMS ((bfd *, struct bfd_link_info *, asection *, - const Elf_Internal_Rela *)); -static bfd_boolean elf32_sparc_adjust_dynamic_symbol - PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *)); -static bfd_boolean allocate_dynrelocs - PARAMS ((struct elf_link_hash_entry *, PTR)); -static bfd_boolean readonly_dynrelocs - PARAMS ((struct elf_link_hash_entry *, PTR)); -static bfd_boolean elf32_sparc_size_dynamic_sections - PARAMS ((bfd *, struct bfd_link_info *)); -static bfd_boolean elf32_sparc_new_section_hook - PARAMS ((bfd *, asection *)); -static bfd_boolean elf32_sparc_relax_section - PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *)); -static bfd_vma dtpoff_base - PARAMS ((struct bfd_link_info *)); -static bfd_vma tpoff - PARAMS ((struct bfd_link_info *, bfd_vma)); -static bfd_boolean elf32_sparc_relocate_section - PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, - Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); -static bfd_boolean elf32_sparc_finish_dynamic_symbol - PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, - Elf_Internal_Sym *)); -static bfd_boolean elf32_sparc_finish_dynamic_sections - PARAMS ((bfd *, struct bfd_link_info *)); -static bfd_boolean elf32_sparc_merge_private_bfd_data - PARAMS ((bfd *, bfd *)); -static struct bfd_hash_entry *link_hash_newfunc - PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); -static struct bfd_link_hash_table *elf32_sparc_link_hash_table_create - PARAMS ((bfd *)); -static bfd_boolean create_got_section - PARAMS ((bfd *, struct bfd_link_info *)); -static bfd_boolean elf32_sparc_create_dynamic_sections - PARAMS ((bfd *, struct bfd_link_info *)); -static void elf32_sparc_copy_indirect_symbol - PARAMS ((const struct elf_backend_data *, struct elf_link_hash_entry *, - struct elf_link_hash_entry *)); -static int elf32_sparc_tls_transition - PARAMS ((struct bfd_link_info *, bfd *, int, int)); - -static bfd_boolean elf32_sparc_mkobject - PARAMS ((bfd *)); -static bfd_boolean elf32_sparc_object_p - PARAMS ((bfd *)); -static void elf32_sparc_final_write_processing - PARAMS ((bfd *, bfd_boolean)); -static enum elf_reloc_type_class elf32_sparc_reloc_type_class - PARAMS ((const Elf_Internal_Rela *)); -static asection * elf32_sparc_gc_mark_hook - PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *, - struct elf_link_hash_entry *, Elf_Internal_Sym *)); -static bfd_boolean elf32_sparc_gc_sweep_hook - PARAMS ((bfd *, struct bfd_link_info *, asection *, - const Elf_Internal_Rela *)); - -/* The relocation "howto" table. */ - -static bfd_reloc_status_type sparc_elf_notsupported_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static bfd_reloc_status_type sparc_elf_wdisp16_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static bfd_reloc_status_type sparc_elf_hix22_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static bfd_reloc_status_type sparc_elf_lox10_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); - -reloc_howto_type _bfd_sparc_elf_howto_table[] = -{ - HOWTO(R_SPARC_NONE, 0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_NONE", FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_8, 0,0, 8,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_8", FALSE,0,0x000000ff,TRUE), - HOWTO(R_SPARC_16, 0,1,16,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_16", FALSE,0,0x0000ffff,TRUE), - HOWTO(R_SPARC_32, 0,2,32,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_32", FALSE,0,0xffffffff,TRUE), - HOWTO(R_SPARC_DISP8, 0,0, 8,TRUE, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_DISP8", FALSE,0,0x000000ff,TRUE), - HOWTO(R_SPARC_DISP16, 0,1,16,TRUE, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_DISP16", FALSE,0,0x0000ffff,TRUE), - HOWTO(R_SPARC_DISP32, 0,2,32,TRUE, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_DISP32", FALSE,0,0xffffffff,TRUE), - HOWTO(R_SPARC_WDISP30, 2,2,30,TRUE, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_WDISP30", FALSE,0,0x3fffffff,TRUE), - HOWTO(R_SPARC_WDISP22, 2,2,22,TRUE, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_WDISP22", FALSE,0,0x003fffff,TRUE), - HOWTO(R_SPARC_HI22, 10,2,22,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_HI22", FALSE,0,0x003fffff,TRUE), - HOWTO(R_SPARC_22, 0,2,22,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_22", FALSE,0,0x003fffff,TRUE), - HOWTO(R_SPARC_13, 0,2,13,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_13", FALSE,0,0x00001fff,TRUE), - HOWTO(R_SPARC_LO10, 0,2,10,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_LO10", FALSE,0,0x000003ff,TRUE), - HOWTO(R_SPARC_GOT10, 0,2,10,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_GOT10", FALSE,0,0x000003ff,TRUE), - HOWTO(R_SPARC_GOT13, 0,2,13,FALSE,0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_GOT13", FALSE,0,0x00001fff,TRUE), - HOWTO(R_SPARC_GOT22, 10,2,22,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_GOT22", FALSE,0,0x003fffff,TRUE), - HOWTO(R_SPARC_PC10, 0,2,10,TRUE, 0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_PC10", FALSE,0,0x000003ff,TRUE), - HOWTO(R_SPARC_PC22, 10,2,22,TRUE, 0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_PC22", FALSE,0,0x003fffff,TRUE), - HOWTO(R_SPARC_WPLT30, 2,2,30,TRUE, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_WPLT30", FALSE,0,0x3fffffff,TRUE), - HOWTO(R_SPARC_COPY, 0,0,00,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_COPY", FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_GLOB_DAT, 0,0,00,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_GLOB_DAT",FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_JMP_SLOT, 0,0,00,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_JMP_SLOT",FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_RELATIVE, 0,0,00,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_RELATIVE",FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_UA32, 0,2,32,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_UA32", FALSE,0,0xffffffff,TRUE), - HOWTO(R_SPARC_PLT32, 0,0,00,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_PLT32", FALSE,0,0xffffffff,TRUE), - HOWTO(R_SPARC_HIPLT22, 0,0,00,FALSE,0,complain_overflow_dont, sparc_elf_notsupported_reloc, "R_SPARC_HIPLT22", FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_LOPLT10, 0,0,00,FALSE,0,complain_overflow_dont, sparc_elf_notsupported_reloc, "R_SPARC_LOPLT10", FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_PCPLT32, 0,0,00,FALSE,0,complain_overflow_dont, sparc_elf_notsupported_reloc, "R_SPARC_PCPLT32", FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_PCPLT22, 0,0,00,FALSE,0,complain_overflow_dont, sparc_elf_notsupported_reloc, "R_SPARC_PCPLT22", FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_PCPLT10, 0,0,00,FALSE,0,complain_overflow_dont, sparc_elf_notsupported_reloc, "R_SPARC_PCPLT10", FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_10, 0,2,10,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_10", FALSE,0,0x000003ff,TRUE), - HOWTO(R_SPARC_11, 0,2,11,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_11", FALSE,0,0x000007ff,TRUE), - /* These are for sparc64 in a 64 bit environment. - Values need to be here because the table is indexed by reloc number. */ - HOWTO(R_SPARC_64, 0,0,00,FALSE,0,complain_overflow_dont, sparc_elf_notsupported_reloc, "R_SPARC_64", FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_OLO10, 0,0,00,FALSE,0,complain_overflow_dont, sparc_elf_notsupported_reloc, "R_SPARC_OLO10", FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_HH22, 0,0,00,FALSE,0,complain_overflow_dont, sparc_elf_notsupported_reloc, "R_SPARC_HH22", FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_HM10, 0,0,00,FALSE,0,complain_overflow_dont, sparc_elf_notsupported_reloc, "R_SPARC_HM10", FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_LM22, 0,0,00,FALSE,0,complain_overflow_dont, sparc_elf_notsupported_reloc, "R_SPARC_LM22", FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_PC_HH22, 0,0,00,FALSE,0,complain_overflow_dont, sparc_elf_notsupported_reloc, "R_SPARC_PC_HH22", FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_PC_HM10, 0,0,00,FALSE,0,complain_overflow_dont, sparc_elf_notsupported_reloc, "R_SPARC_PC_HM10", FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_PC_LM22, 0,0,00,FALSE,0,complain_overflow_dont, sparc_elf_notsupported_reloc, "R_SPARC_PC_LM22", FALSE,0,0x00000000,TRUE), - /* End sparc64 in 64 bit environment values. - The following are for sparc64 in a 32 bit environment. */ - HOWTO(R_SPARC_WDISP16, 2,2,16,TRUE, 0,complain_overflow_signed, sparc_elf_wdisp16_reloc,"R_SPARC_WDISP16", FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_WDISP19, 2,2,19,TRUE, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_WDISP19", FALSE,0,0x0007ffff,TRUE), - HOWTO(R_SPARC_UNUSED_42, 0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_UNUSED_42",FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_7, 0,2, 7,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_7", FALSE,0,0x0000007f,TRUE), - HOWTO(R_SPARC_5, 0,2, 5,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_5", FALSE,0,0x0000001f,TRUE), - HOWTO(R_SPARC_6, 0,2, 6,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_6", FALSE,0,0x0000003f,TRUE), - HOWTO(R_SPARC_NONE, 0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_NONE", FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_NONE, 0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_NONE", FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_NONE, 0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_NONE", FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_NONE, 0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_NONE", FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_NONE, 0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_NONE", FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_NONE, 0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_NONE", FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_NONE, 0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_NONE", FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_NONE, 0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_NONE", FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_UA64, 0,0, 0,FALSE,0,complain_overflow_dont, sparc_elf_notsupported_reloc, "R_SPARC_UA64", FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_UA16, 0,1,16,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_UA16", FALSE,0,0x0000ffff,TRUE), - HOWTO(R_SPARC_TLS_GD_HI22,10,2,22,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_GD_HI22",FALSE,0,0x003fffff,TRUE), - HOWTO(R_SPARC_TLS_GD_LO10,0,2,10,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_GD_LO10",FALSE,0,0x000003ff,TRUE), - HOWTO(R_SPARC_TLS_GD_ADD,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_GD_ADD",FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_TLS_GD_CALL,2,2,30,TRUE,0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_TLS_GD_CALL",FALSE,0,0x3fffffff,TRUE), - HOWTO(R_SPARC_TLS_LDM_HI22,10,2,22,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_LDM_HI22",FALSE,0,0x003fffff,TRUE), - HOWTO(R_SPARC_TLS_LDM_LO10,0,2,10,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_LDM_LO10",FALSE,0,0x000003ff,TRUE), - HOWTO(R_SPARC_TLS_LDM_ADD,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_LDM_ADD",FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_TLS_LDM_CALL,2,2,30,TRUE,0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_TLS_LDM_CALL",FALSE,0,0x3fffffff,TRUE), - HOWTO(R_SPARC_TLS_LDO_HIX22,0,2,0,FALSE,0,complain_overflow_bitfield,sparc_elf_hix22_reloc,"R_SPARC_TLS_LDO_HIX22",FALSE,0,0x003fffff, FALSE), - HOWTO(R_SPARC_TLS_LDO_LOX10,0,2,0,FALSE,0,complain_overflow_dont, sparc_elf_lox10_reloc, "R_SPARC_TLS_LDO_LOX10",FALSE,0,0x000003ff, FALSE), - HOWTO(R_SPARC_TLS_LDO_ADD,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_LDO_ADD",FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_TLS_IE_HI22,10,2,22,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_IE_HI22",FALSE,0,0x003fffff,TRUE), - HOWTO(R_SPARC_TLS_IE_LO10,0,2,10,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_IE_LO10",FALSE,0,0x000003ff,TRUE), - HOWTO(R_SPARC_TLS_IE_LD,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_IE_LD",FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_TLS_IE_LDX,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_IE_LDX",FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_TLS_IE_ADD,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_IE_ADD",FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_TLS_LE_HIX22,0,2,0,FALSE,0,complain_overflow_bitfield,sparc_elf_hix22_reloc, "R_SPARC_TLS_LE_HIX22",FALSE,0,0x003fffff, FALSE), - HOWTO(R_SPARC_TLS_LE_LOX10,0,2,0,FALSE,0,complain_overflow_dont, sparc_elf_lox10_reloc, "R_SPARC_TLS_LE_LOX10",FALSE,0,0x000003ff, FALSE), - HOWTO(R_SPARC_TLS_DTPMOD32,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_DTPMOD32",FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_TLS_DTPMOD64,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_DTPMOD64",FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_TLS_DTPOFF32,0,2,32,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc,"R_SPARC_TLS_DTPOFF32",FALSE,0,0xffffffff,TRUE), - HOWTO(R_SPARC_TLS_DTPOFF64,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_DTPOFF64",FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_TLS_TPOFF32,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_TPOFF32",FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_TLS_TPOFF64,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_TPOFF64",FALSE,0,0x00000000,TRUE) -}; -static reloc_howto_type elf32_sparc_vtinherit_howto = - HOWTO (R_SPARC_GNU_VTINHERIT, 0,2,0,FALSE,0,complain_overflow_dont, NULL, "R_SPARC_GNU_VTINHERIT", FALSE,0, 0, FALSE); -static reloc_howto_type elf32_sparc_vtentry_howto = - HOWTO (R_SPARC_GNU_VTENTRY, 0,2,0,FALSE,0,complain_overflow_dont, _bfd_elf_rel_vtable_reloc_fn,"R_SPARC_GNU_VTENTRY", FALSE,0,0, FALSE); -static reloc_howto_type elf32_sparc_rev32_howto = - HOWTO(R_SPARC_REV32, 0,2,32,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_REV32", FALSE,0,0xffffffff,TRUE); - -struct elf_reloc_map { - bfd_reloc_code_real_type bfd_reloc_val; - unsigned char elf_reloc_val; -}; - -static const struct elf_reloc_map sparc_reloc_map[] = -{ - { BFD_RELOC_NONE, R_SPARC_NONE, }, - { BFD_RELOC_16, R_SPARC_16, }, - { BFD_RELOC_16_PCREL, R_SPARC_DISP16 }, - { BFD_RELOC_8, R_SPARC_8 }, - { BFD_RELOC_8_PCREL, R_SPARC_DISP8 }, - { BFD_RELOC_CTOR, R_SPARC_32 }, - { BFD_RELOC_32, R_SPARC_32 }, - { BFD_RELOC_32_PCREL, R_SPARC_DISP32 }, - { BFD_RELOC_HI22, R_SPARC_HI22 }, - { BFD_RELOC_LO10, R_SPARC_LO10, }, - { BFD_RELOC_32_PCREL_S2, R_SPARC_WDISP30 }, - { BFD_RELOC_SPARC_PLT32, R_SPARC_PLT32 }, - { BFD_RELOC_SPARC22, R_SPARC_22 }, - { BFD_RELOC_SPARC13, R_SPARC_13 }, - { BFD_RELOC_SPARC_GOT10, R_SPARC_GOT10 }, - { BFD_RELOC_SPARC_GOT13, R_SPARC_GOT13 }, - { BFD_RELOC_SPARC_GOT22, R_SPARC_GOT22 }, - { BFD_RELOC_SPARC_PC10, R_SPARC_PC10 }, - { BFD_RELOC_SPARC_PC22, R_SPARC_PC22 }, - { BFD_RELOC_SPARC_WPLT30, R_SPARC_WPLT30 }, - { BFD_RELOC_SPARC_COPY, R_SPARC_COPY }, - { BFD_RELOC_SPARC_GLOB_DAT, R_SPARC_GLOB_DAT }, - { BFD_RELOC_SPARC_JMP_SLOT, R_SPARC_JMP_SLOT }, - { BFD_RELOC_SPARC_RELATIVE, R_SPARC_RELATIVE }, - { BFD_RELOC_SPARC_WDISP22, R_SPARC_WDISP22 }, - { BFD_RELOC_SPARC_UA16, R_SPARC_UA16 }, - { BFD_RELOC_SPARC_UA32, R_SPARC_UA32 }, - { BFD_RELOC_SPARC_UA64, R_SPARC_UA64 }, - { BFD_RELOC_SPARC_10, R_SPARC_10 }, - { BFD_RELOC_SPARC_11, R_SPARC_11 }, - { BFD_RELOC_SPARC_64, R_SPARC_64 }, - { BFD_RELOC_SPARC_OLO10, R_SPARC_OLO10 }, - { BFD_RELOC_SPARC_HH22, R_SPARC_HH22 }, - { BFD_RELOC_SPARC_HM10, R_SPARC_HM10 }, - { BFD_RELOC_SPARC_LM22, R_SPARC_LM22 }, - { BFD_RELOC_SPARC_PC_HH22, R_SPARC_PC_HH22 }, - { BFD_RELOC_SPARC_PC_HM10, R_SPARC_PC_HM10 }, - { BFD_RELOC_SPARC_PC_LM22, R_SPARC_PC_LM22 }, - { BFD_RELOC_SPARC_WDISP16, R_SPARC_WDISP16 }, - { BFD_RELOC_SPARC_WDISP19, R_SPARC_WDISP19 }, - { BFD_RELOC_SPARC_7, R_SPARC_7 }, - { BFD_RELOC_SPARC_5, R_SPARC_5 }, - { BFD_RELOC_SPARC_6, R_SPARC_6 }, - { BFD_RELOC_SPARC_TLS_GD_HI22, R_SPARC_TLS_GD_HI22 }, - { BFD_RELOC_SPARC_TLS_GD_LO10, R_SPARC_TLS_GD_LO10 }, - { BFD_RELOC_SPARC_TLS_GD_ADD, R_SPARC_TLS_GD_ADD }, - { BFD_RELOC_SPARC_TLS_GD_CALL, R_SPARC_TLS_GD_CALL }, - { BFD_RELOC_SPARC_TLS_LDM_HI22, R_SPARC_TLS_LDM_HI22 }, - { BFD_RELOC_SPARC_TLS_LDM_LO10, R_SPARC_TLS_LDM_LO10 }, - { BFD_RELOC_SPARC_TLS_LDM_ADD, R_SPARC_TLS_LDM_ADD }, - { BFD_RELOC_SPARC_TLS_LDM_CALL, R_SPARC_TLS_LDM_CALL }, - { BFD_RELOC_SPARC_TLS_LDO_HIX22, R_SPARC_TLS_LDO_HIX22 }, - { BFD_RELOC_SPARC_TLS_LDO_LOX10, R_SPARC_TLS_LDO_LOX10 }, - { BFD_RELOC_SPARC_TLS_LDO_ADD, R_SPARC_TLS_LDO_ADD }, - { BFD_RELOC_SPARC_TLS_IE_HI22, R_SPARC_TLS_IE_HI22 }, - { BFD_RELOC_SPARC_TLS_IE_LO10, R_SPARC_TLS_IE_LO10 }, - { BFD_RELOC_SPARC_TLS_IE_LD, R_SPARC_TLS_IE_LD }, - { BFD_RELOC_SPARC_TLS_IE_LDX, R_SPARC_TLS_IE_LDX }, - { BFD_RELOC_SPARC_TLS_IE_ADD, R_SPARC_TLS_IE_ADD }, - { BFD_RELOC_SPARC_TLS_LE_HIX22, R_SPARC_TLS_LE_HIX22 }, - { BFD_RELOC_SPARC_TLS_LE_LOX10, R_SPARC_TLS_LE_LOX10 }, - { BFD_RELOC_SPARC_TLS_DTPMOD32, R_SPARC_TLS_DTPMOD32 }, - { BFD_RELOC_SPARC_TLS_DTPMOD64, R_SPARC_TLS_DTPMOD64 }, - { BFD_RELOC_SPARC_TLS_DTPOFF32, R_SPARC_TLS_DTPOFF32 }, - { BFD_RELOC_SPARC_TLS_DTPOFF64, R_SPARC_TLS_DTPOFF64 }, - { BFD_RELOC_SPARC_TLS_TPOFF32, R_SPARC_TLS_TPOFF32 }, - { BFD_RELOC_SPARC_TLS_TPOFF64, R_SPARC_TLS_TPOFF64 }, - { BFD_RELOC_VTABLE_INHERIT, R_SPARC_GNU_VTINHERIT }, - { BFD_RELOC_VTABLE_ENTRY, R_SPARC_GNU_VTENTRY }, - { BFD_RELOC_SPARC_REV32, R_SPARC_REV32 } -}; - -static reloc_howto_type * -elf32_sparc_reloc_type_lookup (abfd, code) - bfd *abfd ATTRIBUTE_UNUSED; - bfd_reloc_code_real_type code; -{ - unsigned int i; - - switch (code) - { - case BFD_RELOC_VTABLE_INHERIT: - return &elf32_sparc_vtinherit_howto; - - case BFD_RELOC_VTABLE_ENTRY: - return &elf32_sparc_vtentry_howto; - - case BFD_RELOC_SPARC_REV32: - return &elf32_sparc_rev32_howto; - - default: - for (i = 0; - i < sizeof (sparc_reloc_map) / sizeof (struct elf_reloc_map); - i++) - { - if (sparc_reloc_map[i].bfd_reloc_val == code) - return (_bfd_sparc_elf_howto_table - + (int) sparc_reloc_map[i].elf_reloc_val); - } - } - bfd_set_error (bfd_error_bad_value); - return NULL; -} - -/* We need to use ELF32_R_TYPE so we have our own copy of this function, - and elf64-sparc.c has its own copy. */ - -static void -elf32_sparc_info_to_howto (abfd, cache_ptr, dst) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *cache_ptr; - Elf_Internal_Rela *dst; -{ - switch (ELF32_R_TYPE(dst->r_info)) - { - case R_SPARC_GNU_VTINHERIT: - cache_ptr->howto = &elf32_sparc_vtinherit_howto; - break; - - case R_SPARC_GNU_VTENTRY: - cache_ptr->howto = &elf32_sparc_vtentry_howto; - break; - - case R_SPARC_REV32: - cache_ptr->howto = &elf32_sparc_rev32_howto; - break; - - default: - BFD_ASSERT (ELF32_R_TYPE(dst->r_info) < (unsigned int) R_SPARC_max_std); - cache_ptr->howto = &_bfd_sparc_elf_howto_table[ELF32_R_TYPE(dst->r_info)]; - } -} - -/* For unsupported relocs. */ - -static bfd_reloc_status_type -sparc_elf_notsupported_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_notsupported; -} - -/* Handle the WDISP16 reloc. */ - -static bfd_reloc_status_type -sparc_elf_wdisp16_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 ATTRIBUTE_UNUSED; -{ - bfd_vma relocation; - bfd_vma x; - - if (output_bfd != (bfd *) NULL - && (symbol->flags & BSF_SECTION_SYM) == 0 - && (! reloc_entry->howto->partial_inplace - || reloc_entry->addend == 0)) - { - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - if (output_bfd != NULL) - return bfd_reloc_continue; - - if (reloc_entry->address > input_section->_cooked_size) - return bfd_reloc_outofrange; - - relocation = (symbol->value - + symbol->section->output_section->vma - + symbol->section->output_offset); - relocation += reloc_entry->addend; - relocation -= (input_section->output_section->vma - + input_section->output_offset); - relocation -= reloc_entry->address; - - x = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address); - x |= ((((relocation >> 2) & 0xc000) << 6) - | ((relocation >> 2) & 0x3fff)); - bfd_put_32 (abfd, x, (bfd_byte *) data + reloc_entry->address); - - if ((bfd_signed_vma) relocation < - 0x40000 - || (bfd_signed_vma) relocation > 0x3ffff) - return bfd_reloc_overflow; - else - return bfd_reloc_ok; -} - -/* Handle the HIX22 reloc. */ - -static bfd_reloc_status_type -sparc_elf_hix22_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 ATTRIBUTE_UNUSED; -{ - bfd_vma relocation; - bfd_vma insn; - - if (output_bfd != (bfd *) NULL - && (symbol->flags & BSF_SECTION_SYM) == 0) - { - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - if (output_bfd != NULL) - return bfd_reloc_continue; - - if (reloc_entry->address > input_section->_cooked_size) - return bfd_reloc_outofrange; - - relocation = (symbol->value - + symbol->section->output_section->vma - + symbol->section->output_offset); - relocation += reloc_entry->addend; - insn = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address); - - insn = (insn &~ (bfd_vma) 0x3fffff) | (((~relocation) >> 10) & 0x3fffff); - bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address); - - return bfd_reloc_ok; -} - -/* Handle the LOX10 reloc. */ - -static bfd_reloc_status_type -sparc_elf_lox10_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 ATTRIBUTE_UNUSED; -{ - bfd_vma relocation; - bfd_vma insn; - - if (output_bfd != (bfd *) NULL - && (symbol->flags & BSF_SECTION_SYM) == 0) - { - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - if (output_bfd != NULL) - return bfd_reloc_continue; - - if (reloc_entry->address > input_section->_cooked_size) - return bfd_reloc_outofrange; - - relocation = (symbol->value - + symbol->section->output_section->vma - + symbol->section->output_offset); - relocation += reloc_entry->addend; - insn = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address); - - insn = (insn &~ (bfd_vma) 0x1fff) | 0x1c00 | (relocation & 0x3ff); - bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address); - - return bfd_reloc_ok; -} - /* Support for core dump NOTE sections. */ static bfd_boolean @@ -530,2766 +56,6 @@ elf32_sparc_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) return TRUE; } - -/* Functions for the SPARC ELF linker. */ - -/* The name of the dynamic interpreter. This is put in the .interp - section. */ - -#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1" - -/* The nop opcode we use. */ - -#define SPARC_NOP 0x01000000 - -/* The size in bytes of an entry in the procedure linkage table. */ - -#define PLT_ENTRY_SIZE 12 - -/* The first four entries in a procedure linkage table are reserved, - and the initial contents are unimportant (we zero them out). - Subsequent entries look like this. See the SVR4 ABI SPARC - supplement to see how this works. */ - -/* sethi %hi(.-.plt0),%g1. We fill in the address later. */ -#define PLT_ENTRY_WORD0 0x03000000 -/* b,a .plt0. We fill in the offset later. */ -#define PLT_ENTRY_WORD1 0x30800000 -/* nop. */ -#define PLT_ENTRY_WORD2 SPARC_NOP - -/* The SPARC linker needs to keep track of the number of relocs that it - decides to copy as dynamic relocs in check_relocs for each symbol. - This is so that it can later discard them if they are found to be - unnecessary. We store the information in a field extending the - regular ELF linker hash table. */ - -struct elf32_sparc_dyn_relocs -{ - struct elf32_sparc_dyn_relocs *next; - - /* The input section of the reloc. */ - asection *sec; - - /* Total number of relocs copied for the input section. */ - bfd_size_type count; - - /* Number of pc-relative relocs copied for the input section. */ - bfd_size_type pc_count; -}; - -/* SPARC ELF linker hash entry. */ - -struct elf32_sparc_link_hash_entry -{ - struct elf_link_hash_entry elf; - - /* Track dynamic relocs copied for this symbol. */ - struct elf32_sparc_dyn_relocs *dyn_relocs; - -#define GOT_UNKNOWN 0 -#define GOT_NORMAL 1 -#define GOT_TLS_GD 2 -#define GOT_TLS_IE 3 - unsigned char tls_type; -}; - -#define elf32_sparc_hash_entry(ent) ((struct elf32_sparc_link_hash_entry *)(ent)) - -struct elf32_sparc_obj_tdata -{ - struct elf_obj_tdata root; - - /* tls_type for each local got entry. */ - char *local_got_tls_type; - - /* TRUE if TLS GD relocs has been seen for this object. */ - bfd_boolean has_tlsgd; -}; - -#define elf32_sparc_tdata(abfd) \ - ((struct elf32_sparc_obj_tdata *) (abfd)->tdata.any) - -#define elf32_sparc_local_got_tls_type(abfd) \ - (elf32_sparc_tdata (abfd)->local_got_tls_type) - -static bfd_boolean -elf32_sparc_mkobject (abfd) - bfd *abfd; -{ - bfd_size_type amt = sizeof (struct elf32_sparc_obj_tdata); - abfd->tdata.any = bfd_zalloc (abfd, amt); - if (abfd->tdata.any == NULL) - return FALSE; - return TRUE; -} - -/* SPARC ELF linker hash table. */ - -struct elf32_sparc_link_hash_table -{ - struct elf_link_hash_table elf; - - /* Short-cuts to get to dynamic linker sections. */ - asection *sgot; - asection *srelgot; - asection *splt; - asection *srelplt; - asection *sdynbss; - asection *srelbss; - - union { - bfd_signed_vma refcount; - bfd_vma offset; - } tls_ldm_got; - - /* Small local sym to section mapping cache. */ - struct sym_sec_cache sym_sec; -}; - -/* Get the SPARC ELF linker hash table from a link_info structure. */ - -#define elf32_sparc_hash_table(p) \ - ((struct elf32_sparc_link_hash_table *) ((p)->hash)) - -/* Create an entry in an i386 ELF linker hash table. */ - -static struct bfd_hash_entry * -link_hash_newfunc (entry, table, string) - struct bfd_hash_entry *entry; - struct bfd_hash_table *table; - const char *string; -{ - /* Allocate the structure if it has not already been allocated by a - subclass. */ - if (entry == NULL) - { - entry = bfd_hash_allocate (table, - sizeof (struct elf32_sparc_link_hash_entry)); - if (entry == NULL) - return entry; - } - - /* Call the allocation method of the superclass. */ - entry = _bfd_elf_link_hash_newfunc (entry, table, string); - if (entry != NULL) - { - struct elf32_sparc_link_hash_entry *eh; - - eh = (struct elf32_sparc_link_hash_entry *) entry; - eh->dyn_relocs = NULL; - eh->tls_type = GOT_UNKNOWN; - } - - return entry; -} - -/* Create a SPARC ELF linker hash table. */ - -static struct bfd_link_hash_table * -elf32_sparc_link_hash_table_create (abfd) - bfd *abfd; -{ - struct elf32_sparc_link_hash_table *ret; - bfd_size_type amt = sizeof (struct elf32_sparc_link_hash_table); - - ret = (struct elf32_sparc_link_hash_table *) bfd_malloc (amt); - if (ret == NULL) - return NULL; - - if (! _bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc)) - { - free (ret); - return NULL; - } - - ret->sgot = NULL; - ret->srelgot = NULL; - ret->splt = NULL; - ret->srelplt = NULL; - ret->sdynbss = NULL; - ret->srelbss = NULL; - ret->tls_ldm_got.refcount = 0; - ret->sym_sec.abfd = NULL; - - return &ret->elf.root; -} - -/* Create .got and .rela.got sections in DYNOBJ, and set up - shortcuts to them in our hash table. */ - -static bfd_boolean -create_got_section (dynobj, info) - bfd *dynobj; - struct bfd_link_info *info; -{ - struct elf32_sparc_link_hash_table *htab; - - if (! _bfd_elf_create_got_section (dynobj, info)) - return FALSE; - - htab = elf32_sparc_hash_table (info); - htab->sgot = bfd_get_section_by_name (dynobj, ".got"); - if (!htab->sgot) - abort (); - - htab->srelgot = bfd_make_section (dynobj, ".rela.got"); - if (htab->srelgot == NULL - || ! bfd_set_section_flags (dynobj, htab->srelgot, - (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS - | SEC_IN_MEMORY | SEC_LINKER_CREATED - | SEC_READONLY)) - || ! bfd_set_section_alignment (dynobj, htab->srelgot, 2)) - return FALSE; - return TRUE; -} - -/* Create .plt, .rela.plt, .got, .rela.got, .dynbss, and - .rela.bss sections in DYNOBJ, and set up shortcuts to them in our - hash table. */ - -static bfd_boolean -elf32_sparc_create_dynamic_sections (dynobj, info) - bfd *dynobj; - struct bfd_link_info *info; -{ - struct elf32_sparc_link_hash_table *htab; - - htab = elf32_sparc_hash_table (info); - if (!htab->sgot && !create_got_section (dynobj, info)) - return FALSE; - - if (!_bfd_elf_create_dynamic_sections (dynobj, info)) - return FALSE; - - htab->splt = bfd_get_section_by_name (dynobj, ".plt"); - htab->srelplt = bfd_get_section_by_name (dynobj, ".rela.plt"); - htab->sdynbss = bfd_get_section_by_name (dynobj, ".dynbss"); - if (!info->shared) - htab->srelbss = bfd_get_section_by_name (dynobj, ".rela.bss"); - - if (!htab->splt || !htab->srelplt || !htab->sdynbss - || (!info->shared && !htab->srelbss)) - abort (); - - return TRUE; -} - -/* Copy the extra info we tack onto an elf_link_hash_entry. */ - -static void -elf32_sparc_copy_indirect_symbol (bed, dir, ind) - const struct elf_backend_data *bed; - struct elf_link_hash_entry *dir, *ind; -{ - struct elf32_sparc_link_hash_entry *edir, *eind; - - edir = (struct elf32_sparc_link_hash_entry *) dir; - eind = (struct elf32_sparc_link_hash_entry *) ind; - - if (eind->dyn_relocs != NULL) - { - if (edir->dyn_relocs != NULL) - { - struct elf32_sparc_dyn_relocs **pp; - struct elf32_sparc_dyn_relocs *p; - - if (ind->root.type == bfd_link_hash_indirect) - abort (); - - /* Add reloc counts against the weak sym to the strong sym - list. Merge any entries against the same section. */ - for (pp = &eind->dyn_relocs; (p = *pp) != NULL; ) - { - struct elf32_sparc_dyn_relocs *q; - - for (q = edir->dyn_relocs; q != NULL; q = q->next) - if (q->sec == p->sec) - { - q->pc_count += p->pc_count; - q->count += p->count; - *pp = p->next; - break; - } - if (q == NULL) - pp = &p->next; - } - *pp = edir->dyn_relocs; - } - - edir->dyn_relocs = eind->dyn_relocs; - eind->dyn_relocs = NULL; - } - - if (ind->root.type == bfd_link_hash_indirect - && dir->got.refcount <= 0) - { - edir->tls_type = eind->tls_type; - eind->tls_type = GOT_UNKNOWN; - } - _bfd_elf_link_hash_copy_indirect (bed, dir, ind); -} - -static int -elf32_sparc_tls_transition (info, abfd, r_type, is_local) - struct bfd_link_info *info; - bfd *abfd; - int r_type; - int is_local; -{ - if (r_type == R_SPARC_TLS_GD_HI22 - && ! elf32_sparc_tdata (abfd)->has_tlsgd) - r_type = R_SPARC_REV32; - - if (info->shared) - return r_type; - - switch (r_type) - { - case R_SPARC_TLS_GD_HI22: - if (is_local) - return R_SPARC_TLS_LE_HIX22; - return R_SPARC_TLS_IE_HI22; - case R_SPARC_TLS_GD_LO10: - if (is_local) - return R_SPARC_TLS_LE_LOX10; - return R_SPARC_TLS_IE_LO10; - case R_SPARC_TLS_IE_HI22: - if (is_local) - return R_SPARC_TLS_LE_HIX22; - return r_type; - case R_SPARC_TLS_IE_LO10: - if (is_local) - return R_SPARC_TLS_LE_LOX10; - return r_type; - case R_SPARC_TLS_LDM_HI22: - return R_SPARC_TLS_LE_HIX22; - case R_SPARC_TLS_LDM_LO10: - return R_SPARC_TLS_LE_LOX10; - } - - return r_type; -} - -/* Look through the relocs for a section during the first phase, and - allocate space in the global offset table or procedure linkage - table. */ - -static bfd_boolean -elf32_sparc_check_relocs (abfd, info, sec, relocs) - bfd *abfd; - struct bfd_link_info *info; - asection *sec; - const Elf_Internal_Rela *relocs; -{ - struct elf32_sparc_link_hash_table *htab; - Elf_Internal_Shdr *symtab_hdr; - struct elf_link_hash_entry **sym_hashes; - bfd_vma *local_got_offsets; - const Elf_Internal_Rela *rel; - const Elf_Internal_Rela *rel_end; - asection *sreloc; - bfd_boolean checked_tlsgd = FALSE; - - if (info->relocatable) - return TRUE; - - htab = elf32_sparc_hash_table (info); - symtab_hdr = &elf_tdata (abfd)->symtab_hdr; - sym_hashes = elf_sym_hashes (abfd); - local_got_offsets = elf_local_got_offsets (abfd); - - sreloc = NULL; - - rel_end = relocs + sec->reloc_count; - for (rel = relocs; rel < rel_end; rel++) - { - unsigned int r_type; - unsigned long r_symndx; - struct elf_link_hash_entry *h; - - r_symndx = ELF32_R_SYM (rel->r_info); - r_type = ELF32_R_TYPE (rel->r_info); - - if (r_symndx >= NUM_SHDR_ENTRIES (symtab_hdr)) - { - (*_bfd_error_handler) (_("%s: bad symbol index: %d"), - bfd_archive_filename (abfd), - r_symndx); - return FALSE; - } - - if (r_symndx < symtab_hdr->sh_info) - h = NULL; - else - h = sym_hashes[r_symndx - symtab_hdr->sh_info]; - - /* Compatibility with old R_SPARC_REV32 reloc conflicting - with R_SPARC_TLS_GD_HI22. */ - if (! checked_tlsgd) - switch (r_type) - { - case R_SPARC_TLS_GD_HI22: - { - const Elf_Internal_Rela *relt; - - for (relt = rel + 1; relt < rel_end; relt++) - if (ELF32_R_TYPE (relt->r_info) == R_SPARC_TLS_GD_LO10 - || ELF32_R_TYPE (relt->r_info) == R_SPARC_TLS_GD_ADD - || ELF32_R_TYPE (relt->r_info) == R_SPARC_TLS_GD_CALL) - break; - checked_tlsgd = TRUE; - elf32_sparc_tdata (abfd)->has_tlsgd = relt < rel_end; - } - break; - case R_SPARC_TLS_GD_LO10: - case R_SPARC_TLS_GD_ADD: - case R_SPARC_TLS_GD_CALL: - checked_tlsgd = TRUE; - elf32_sparc_tdata (abfd)->has_tlsgd = TRUE; - break; - } - - r_type = elf32_sparc_tls_transition (info, abfd, r_type, h == NULL); - switch (r_type) - { - case R_SPARC_TLS_LDM_HI22: - case R_SPARC_TLS_LDM_LO10: - htab->tls_ldm_got.refcount += 1; - break; - - case R_SPARC_TLS_LE_HIX22: - case R_SPARC_TLS_LE_LOX10: - if (info->shared) - goto r_sparc_plt32; - break; - - case R_SPARC_TLS_IE_HI22: - case R_SPARC_TLS_IE_LO10: - if (info->shared) - info->flags |= DF_STATIC_TLS; - /* Fall through */ - - case R_SPARC_GOT10: - case R_SPARC_GOT13: - case R_SPARC_GOT22: - case R_SPARC_TLS_GD_HI22: - case R_SPARC_TLS_GD_LO10: - /* This symbol requires a global offset table entry. */ - { - int tls_type, old_tls_type; - - switch (r_type) - { - default: - case R_SPARC_GOT10: - case R_SPARC_GOT13: - case R_SPARC_GOT22: - tls_type = GOT_NORMAL; - break; - case R_SPARC_TLS_GD_HI22: - case R_SPARC_TLS_GD_LO10: - tls_type = GOT_TLS_GD; - break; - case R_SPARC_TLS_IE_HI22: - case R_SPARC_TLS_IE_LO10: - tls_type = GOT_TLS_IE; - break; - } - - if (h != NULL) - { - h->got.refcount += 1; - old_tls_type = elf32_sparc_hash_entry(h)->tls_type; - } - else - { - bfd_signed_vma *local_got_refcounts; - - /* This is a global offset table entry for a local symbol. */ - local_got_refcounts = elf_local_got_refcounts (abfd); - if (local_got_refcounts == NULL) - { - bfd_size_type size; - - size = symtab_hdr->sh_info; - size *= (sizeof (bfd_signed_vma) + sizeof(char)); - local_got_refcounts = ((bfd_signed_vma *) - bfd_zalloc (abfd, size)); - if (local_got_refcounts == NULL) - return FALSE; - elf_local_got_refcounts (abfd) = local_got_refcounts; - elf32_sparc_local_got_tls_type (abfd) - = (char *) (local_got_refcounts + symtab_hdr->sh_info); - } - local_got_refcounts[r_symndx] += 1; - old_tls_type = elf32_sparc_local_got_tls_type (abfd) [r_symndx]; - } - - /* If a TLS symbol is accessed using IE at least once, - there is no point to use dynamic model for it. */ - if (old_tls_type != tls_type && old_tls_type != GOT_UNKNOWN - && (old_tls_type != GOT_TLS_GD - || tls_type != GOT_TLS_IE)) - { - if (old_tls_type == GOT_TLS_IE && tls_type == GOT_TLS_GD) - tls_type = old_tls_type; - else - { - (*_bfd_error_handler) - (_("%s: `%s' accessed both as normal and thread local symbol"), - bfd_archive_filename (abfd), - h ? h->root.root.string : ""); - return FALSE; - } - } - - if (old_tls_type != tls_type) - { - if (h != NULL) - elf32_sparc_hash_entry (h)->tls_type = tls_type; - else - elf32_sparc_local_got_tls_type (abfd) [r_symndx] = tls_type; - } - } - - if (htab->sgot == NULL) - { - if (htab->elf.dynobj == NULL) - htab->elf.dynobj = abfd; - if (!create_got_section (htab->elf.dynobj, info)) - return FALSE; - } - break; - - case R_SPARC_TLS_GD_CALL: - case R_SPARC_TLS_LDM_CALL: - if (info->shared) - { - /* These are basically R_SPARC_TLS_WPLT30 relocs against - __tls_get_addr. */ - struct bfd_link_hash_entry *bh = NULL; - if (! _bfd_generic_link_add_one_symbol (info, abfd, - "__tls_get_addr", 0, - bfd_und_section_ptr, 0, - NULL, FALSE, FALSE, - &bh)) - return FALSE; - h = (struct elf_link_hash_entry *) bh; - } - else - break; - /* Fall through */ - - case R_SPARC_PLT32: - case R_SPARC_WPLT30: - /* This symbol requires a procedure linkage table entry. We - actually build the entry in adjust_dynamic_symbol, - because this might be a case of linking PIC code without - linking in any dynamic objects, in which case we don't - need to generate a procedure linkage table after all. */ - - if (h == NULL) - { - /* The Solaris native assembler will generate a WPLT30 - reloc for a local symbol if you assemble a call from - one section to another when using -K pic. We treat - it as WDISP30. */ - if (ELF32_R_TYPE (rel->r_info) == R_SPARC_PLT32) - goto r_sparc_plt32; - break; - } - - h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; - - if (ELF32_R_TYPE (rel->r_info) == R_SPARC_PLT32) - goto r_sparc_plt32; - h->plt.refcount += 1; - break; - - case R_SPARC_PC10: - case R_SPARC_PC22: - if (h != NULL) - h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF; - - if (h != NULL - && strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0) - break; - /* Fall through. */ - - case R_SPARC_DISP8: - case R_SPARC_DISP16: - case R_SPARC_DISP32: - case R_SPARC_WDISP30: - case R_SPARC_WDISP22: - case R_SPARC_WDISP19: - case R_SPARC_WDISP16: - case R_SPARC_8: - case R_SPARC_16: - case R_SPARC_32: - case R_SPARC_HI22: - case R_SPARC_22: - case R_SPARC_13: - case R_SPARC_LO10: - case R_SPARC_UA16: - case R_SPARC_UA32: - if (h != NULL) - h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF; - - r_sparc_plt32: - if (h != NULL && !info->shared) - { - /* We may need a .plt entry if the function this reloc - refers to is in a shared lib. */ - h->plt.refcount += 1; - } - - /* If we are creating a shared library, and this is a reloc - against a global symbol, or a non PC relative reloc - against a local symbol, then we need to copy the reloc - into the shared library. However, if we are linking with - -Bsymbolic, we do not need to copy a reloc against a - global symbol which is defined in an object we are - including in the link (i.e., DEF_REGULAR is set). At - this point we have not seen all the input files, so it is - possible that DEF_REGULAR is not set now but will be set - later (it is never cleared). In case of a weak definition, - DEF_REGULAR may be cleared later by a strong definition in - a shared library. We account for that possibility below by - storing information in the relocs_copied field of the hash - table entry. A similar situation occurs when creating - shared libraries and symbol visibility changes render the - symbol local. - - If on the other hand, we are creating an executable, we - may need to keep relocations for symbols satisfied by a - dynamic library if we manage to avoid copy relocs for the - symbol. */ - if ((info->shared - && (sec->flags & SEC_ALLOC) != 0 - && (! _bfd_sparc_elf_howto_table[r_type].pc_relative - || (h != NULL - && (! info->symbolic - || h->root.type == bfd_link_hash_defweak - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0)))) - || (!info->shared - && (sec->flags & SEC_ALLOC) != 0 - && h != NULL - && (h->root.type == bfd_link_hash_defweak - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0))) - { - struct elf32_sparc_dyn_relocs *p; - struct elf32_sparc_dyn_relocs **head; - - /* When creating a shared object, we must copy these - relocs into the output file. We create a reloc - section in dynobj and make room for the reloc. */ - if (sreloc == NULL) - { - const char *name; - bfd *dynobj; - - name = (bfd_elf_string_from_elf_section - (abfd, - elf_elfheader (abfd)->e_shstrndx, - elf_section_data (sec)->rel_hdr.sh_name)); - if (name == NULL) - return FALSE; - - BFD_ASSERT (strncmp (name, ".rela", 5) == 0 - && strcmp (bfd_get_section_name (abfd, sec), - name + 5) == 0); - - if (htab->elf.dynobj == NULL) - htab->elf.dynobj = abfd; - dynobj = htab->elf.dynobj; - - sreloc = bfd_get_section_by_name (dynobj, name); - if (sreloc == NULL) - { - flagword flags; - - sreloc = bfd_make_section (dynobj, name); - flags = (SEC_HAS_CONTENTS | SEC_READONLY - | SEC_IN_MEMORY | SEC_LINKER_CREATED); - if ((sec->flags & SEC_ALLOC) != 0) - flags |= SEC_ALLOC | SEC_LOAD; - if (sreloc == NULL - || ! bfd_set_section_flags (dynobj, sreloc, flags) - || ! bfd_set_section_alignment (dynobj, sreloc, 2)) - return FALSE; - } - elf_section_data (sec)->sreloc = sreloc; - } - - /* If this is a global symbol, we count the number of - relocations we need for this symbol. */ - if (h != NULL) - head = &((struct elf32_sparc_link_hash_entry *) h)->dyn_relocs; - else - { - /* Track dynamic relocs needed for local syms too. - We really need local syms available to do this - easily. Oh well. */ - - asection *s; - s = bfd_section_from_r_symndx (abfd, &htab->sym_sec, - sec, r_symndx); - if (s == NULL) - return FALSE; - - head = ((struct elf32_sparc_dyn_relocs **) - &elf_section_data (s)->local_dynrel); - } - - p = *head; - if (p == NULL || p->sec != sec) - { - bfd_size_type amt = sizeof *p; - p = ((struct elf32_sparc_dyn_relocs *) - bfd_alloc (htab->elf.dynobj, amt)); - if (p == NULL) - return FALSE; - p->next = *head; - *head = p; - p->sec = sec; - p->count = 0; - p->pc_count = 0; - } - - p->count += 1; - if (_bfd_sparc_elf_howto_table[r_type].pc_relative) - p->pc_count += 1; - } - - break; - - case R_SPARC_GNU_VTINHERIT: - if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset)) - return FALSE; - break; - - case R_SPARC_GNU_VTENTRY: - if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) - return FALSE; - break; - - default: - break; - } - } - - return TRUE; -} - -static asection * -elf32_sparc_gc_mark_hook (sec, info, rel, h, sym) - asection *sec; - struct bfd_link_info *info ATTRIBUTE_UNUSED; - Elf_Internal_Rela *rel; - struct elf_link_hash_entry *h; - Elf_Internal_Sym *sym; -{ - if (h != NULL) - { - switch (ELF32_R_TYPE (rel->r_info)) - { - case R_SPARC_GNU_VTINHERIT: - case R_SPARC_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 - return bfd_section_from_elf_index (sec->owner, sym->st_shndx); - - return NULL; -} - -/* Update the got entry reference counts for the section being removed. */ -static bfd_boolean -elf32_sparc_gc_sweep_hook (abfd, info, sec, relocs) - bfd *abfd; - struct bfd_link_info *info ATTRIBUTE_UNUSED; - asection *sec; - const Elf_Internal_Rela *relocs; -{ - Elf_Internal_Shdr *symtab_hdr; - struct elf_link_hash_entry **sym_hashes; - bfd_signed_vma *local_got_refcounts; - const Elf_Internal_Rela *rel, *relend; - - elf_section_data (sec)->local_dynrel = NULL; - - symtab_hdr = &elf_tdata (abfd)->symtab_hdr; - sym_hashes = elf_sym_hashes (abfd); - local_got_refcounts = elf_local_got_refcounts (abfd); - - relend = relocs + sec->reloc_count; - for (rel = relocs; rel < relend; rel++) - { - unsigned long r_symndx; - unsigned int r_type; - struct elf_link_hash_entry *h = NULL; - - r_symndx = ELF32_R_SYM (rel->r_info); - if (r_symndx >= symtab_hdr->sh_info) - { - struct elf32_sparc_link_hash_entry *eh; - struct elf32_sparc_dyn_relocs **pp; - struct elf32_sparc_dyn_relocs *p; - - h = sym_hashes[r_symndx - symtab_hdr->sh_info]; - eh = (struct elf32_sparc_link_hash_entry *) h; - for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next) - if (p->sec == sec) - { - /* Everything must go for SEC. */ - *pp = p->next; - break; - } - } - - r_type = ELF32_R_TYPE (rel->r_info); - r_type = elf32_sparc_tls_transition (info, abfd, r_type, h != NULL); - switch (r_type) - { - case R_SPARC_TLS_LDM_HI22: - case R_SPARC_TLS_LDM_LO10: - if (elf32_sparc_hash_table (info)->tls_ldm_got.refcount > 0) - elf32_sparc_hash_table (info)->tls_ldm_got.refcount -= 1; - break; - - case R_SPARC_TLS_GD_HI22: - case R_SPARC_TLS_GD_LO10: - case R_SPARC_TLS_IE_HI22: - case R_SPARC_TLS_IE_LO10: - case R_SPARC_GOT10: - case R_SPARC_GOT13: - case R_SPARC_GOT22: - if (h != NULL) - { - if (h->got.refcount > 0) - h->got.refcount--; - } - else - { - if (local_got_refcounts[r_symndx] > 0) - local_got_refcounts[r_symndx]--; - } - break; - - case R_SPARC_PC10: - case R_SPARC_PC22: - if (h != NULL - && strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0) - break; - /* Fall through. */ - - case R_SPARC_DISP8: - case R_SPARC_DISP16: - case R_SPARC_DISP32: - case R_SPARC_WDISP30: - case R_SPARC_WDISP22: - case R_SPARC_WDISP19: - case R_SPARC_WDISP16: - case R_SPARC_8: - case R_SPARC_16: - case R_SPARC_32: - case R_SPARC_HI22: - case R_SPARC_22: - case R_SPARC_13: - case R_SPARC_LO10: - case R_SPARC_UA16: - case R_SPARC_UA32: - case R_SPARC_PLT32: - if (info->shared) - break; - /* Fall through. */ - - case R_SPARC_WPLT30: - if (h != NULL) - { - if (h->plt.refcount > 0) - h->plt.refcount--; - } - break; - - default: - break; - } - } - - return TRUE; -} - -/* Adjust a symbol defined by a dynamic object and referenced by a - regular object. The current definition is in some section of the - dynamic object, but we're not including those sections. We have to - change the definition to something the rest of the link can - understand. */ - -static bfd_boolean -elf32_sparc_adjust_dynamic_symbol (info, h) - struct bfd_link_info *info; - struct elf_link_hash_entry *h; -{ - struct elf32_sparc_link_hash_table *htab; - struct elf32_sparc_link_hash_entry * eh; - struct elf32_sparc_dyn_relocs *p; - asection *s; - unsigned int power_of_two; - - htab = elf32_sparc_hash_table (info); - - /* Make sure we know what is going on here. */ - BFD_ASSERT (htab->elf.dynobj != NULL - && ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) - || h->weakdef != NULL - || ((h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - && (h->elf_link_hash_flags - & ELF_LINK_HASH_REF_REGULAR) != 0 - && (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0))); - - /* If this is a function, put it in the procedure linkage table. We - will fill in the contents of the procedure linkage table later - (although we could actually do it here). The STT_NOTYPE - condition is a hack specifically for the Oracle libraries - delivered for Solaris; for some inexplicable reason, they define - some of their functions as STT_NOTYPE when they really should be - STT_FUNC. */ - if (h->type == STT_FUNC - || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0 - || (h->type == STT_NOTYPE - && (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - && (h->root.u.def.section->flags & SEC_CODE) != 0)) - { - if (h->plt.refcount <= 0 - || (! info->shared - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0 - && h->root.type != bfd_link_hash_undefweak - && h->root.type != bfd_link_hash_undefined)) - { - /* This case can occur if we saw a WPLT30 reloc in an input - file, but the symbol was never referred to by a dynamic - object, or if all references were garbage collected. In - such a case, we don't actually need to build a procedure - linkage table, and we can just do a WDISP30 reloc instead. */ - h->plt.offset = (bfd_vma) -1; - h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; - } - - return TRUE; - } - else - h->plt.offset = (bfd_vma) -1; - - /* If this is a weak symbol, and there is a real definition, the - processor independent code will have arranged for us to see the - real definition first, and we can just use the same value. */ - if (h->weakdef != NULL) - { - BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined - || h->weakdef->root.type == bfd_link_hash_defweak); - h->root.u.def.section = h->weakdef->root.u.def.section; - h->root.u.def.value = h->weakdef->root.u.def.value; - return TRUE; - } - - /* This is a reference to a symbol defined by a dynamic object which - is not a function. */ - - /* If we are creating a shared library, we must presume that the - only references to the symbol are via the global offset table. - For such cases we need not do anything here; the relocations will - be handled correctly by relocate_section. */ - if (info->shared) - return TRUE; - - /* If there are no references to this symbol that do not use the - GOT, we don't need to generate a copy reloc. */ - if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0) - return TRUE; - - eh = (struct elf32_sparc_link_hash_entry *) h; - for (p = eh->dyn_relocs; p != NULL; p = p->next) - { - s = p->sec->output_section; - if (s != NULL && (s->flags & SEC_READONLY) != 0) - break; - } - - /* If we didn't find any dynamic relocs in read-only sections, then - we'll be keeping the dynamic relocs and avoiding the copy reloc. */ - if (p == NULL) - { - h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF; - return TRUE; - } - - /* We must allocate the symbol in our .dynbss section, which will - become part of the .bss section of the executable. There will be - an entry for this symbol in the .dynsym section. The dynamic - object will contain position independent code, so all references - from the dynamic object to this symbol will go through the global - offset table. The dynamic linker will use the .dynsym entry to - determine the address it must put in the global offset table, so - both the dynamic object and the regular object will refer to the - same memory location for the variable. */ - - /* We must generate a R_SPARC_COPY reloc to tell the dynamic linker - to copy the initial value out of the dynamic object and into the - runtime process image. We need to remember the offset into the - .rel.bss section we are going to use. */ - if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) - { - htab->srelbss->_raw_size += sizeof (Elf32_External_Rela); - h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY; - } - - /* We need to figure out the alignment required for this symbol. I - have no idea how ELF linkers handle this. */ - power_of_two = bfd_log2 (h->size); - if (power_of_two > 3) - power_of_two = 3; - - /* Apply the required alignment. */ - s = htab->sdynbss; - s->_raw_size = BFD_ALIGN (s->_raw_size, - (bfd_size_type) (1 << power_of_two)); - if (power_of_two > bfd_get_section_alignment (dynobj, s)) - { - if (! bfd_set_section_alignment (dynobj, s, power_of_two)) - return FALSE; - } - - /* Define the symbol as being at this point in the section. */ - h->root.u.def.section = s; - h->root.u.def.value = s->_raw_size; - - /* Increment the section size to make room for the symbol. */ - s->_raw_size += h->size; - - return TRUE; -} - -/* Allocate space in .plt, .got and associated reloc sections for - dynamic relocs. */ - -static bfd_boolean -allocate_dynrelocs (h, inf) - struct elf_link_hash_entry *h; - PTR inf; -{ - struct bfd_link_info *info; - struct elf32_sparc_link_hash_table *htab; - struct elf32_sparc_link_hash_entry *eh; - struct elf32_sparc_dyn_relocs *p; - - if (h->root.type == bfd_link_hash_indirect) - return TRUE; - - if (h->root.type == bfd_link_hash_warning) - /* When warning symbols are created, they **replace** the "real" - entry in the hash table, thus we never get to see the real - symbol in a hash traversal. So look at it now. */ - h = (struct elf_link_hash_entry *) h->root.u.i.link; - - info = (struct bfd_link_info *) inf; - htab = elf32_sparc_hash_table (info); - - if (htab->elf.dynamic_sections_created - && h->plt.refcount > 0) - { - /* Make sure this symbol is output as a dynamic symbol. - Undefined weak syms won't yet be marked as dynamic. */ - if (h->dynindx == -1 - && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) - { - if (! bfd_elf_link_record_dynamic_symbol (info, h)) - return FALSE; - } - - if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info->shared, h)) - { - asection *s = htab->splt; - - /* The first four entries in .plt are reserved. */ - if (s->_raw_size == 0) - s->_raw_size = 4 * PLT_ENTRY_SIZE; - - /* The procedure linkage table has a maximum size. */ - if (s->_raw_size >= 0x400000) - { - bfd_set_error (bfd_error_bad_value); - return FALSE; - } - - h->plt.offset = s->_raw_size; - - /* If this symbol is not defined in a regular file, and we are - not generating a shared library, then set the symbol to this - location in the .plt. This is required to make function - pointers compare as equal between the normal executable and - the shared library. */ - if (! info->shared - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) - { - h->root.u.def.section = s; - h->root.u.def.value = h->plt.offset; - } - - /* Make room for this entry. */ - s->_raw_size += PLT_ENTRY_SIZE; - - /* We also need to make an entry in the .rela.plt section. */ - htab->srelplt->_raw_size += sizeof (Elf32_External_Rela); - } - else - { - h->plt.offset = (bfd_vma) -1; - h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; - } - } - else - { - h->plt.offset = (bfd_vma) -1; - h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; - } - - /* If R_SPARC_TLS_IE_{HI22,LO10} symbol is now local to the binary, - make it a R_SPARC_TLS_LE_{HI22,LO10} requiring no TLS entry. */ - if (h->got.refcount > 0 - && !info->shared - && h->dynindx == -1 - && elf32_sparc_hash_entry(h)->tls_type == GOT_TLS_IE) - h->got.offset = (bfd_vma) -1; - else if (h->got.refcount > 0) - { - asection *s; - bfd_boolean dyn; - int tls_type = elf32_sparc_hash_entry(h)->tls_type; - - /* Make sure this symbol is output as a dynamic symbol. - Undefined weak syms won't yet be marked as dynamic. */ - if (h->dynindx == -1 - && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) - { - if (! bfd_elf_link_record_dynamic_symbol (info, h)) - return FALSE; - } - - s = htab->sgot; - h->got.offset = s->_raw_size; - s->_raw_size += 4; - /* R_SPARC_TLS_GD_HI{22,LO10} needs 2 consecutive GOT slots. */ - if (tls_type == GOT_TLS_GD) - s->_raw_size += 4; - dyn = htab->elf.dynamic_sections_created; - /* R_SPARC_TLS_IE_{HI22,LO10} needs one dynamic relocation, - R_SPARC_TLS_GD_{HI22,LO10} needs one if local symbol and two if - global. */ - if ((tls_type == GOT_TLS_GD && h->dynindx == -1) - || tls_type == GOT_TLS_IE) - htab->srelgot->_raw_size += sizeof (Elf32_External_Rela); - else if (tls_type == GOT_TLS_GD) - htab->srelgot->_raw_size += 2 * sizeof (Elf32_External_Rela); - else if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)) - htab->srelgot->_raw_size += sizeof (Elf32_External_Rela); - } - else - h->got.offset = (bfd_vma) -1; - - eh = (struct elf32_sparc_link_hash_entry *) h; - if (eh->dyn_relocs == NULL) - return TRUE; - - /* In the shared -Bsymbolic case, discard space allocated for - dynamic pc-relative relocs against symbols which turn out to be - defined in regular objects. For the normal shared case, discard - space for pc-relative relocs that have become local due to symbol - visibility changes. */ - - if (info->shared) - { - if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0 - && ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0 - || info->symbolic)) - { - struct elf32_sparc_dyn_relocs **pp; - - for (pp = &eh->dyn_relocs; (p = *pp) != NULL; ) - { - p->count -= p->pc_count; - p->pc_count = 0; - if (p->count == 0) - *pp = p->next; - else - pp = &p->next; - } - } - } - else - { - /* For the non-shared case, discard space for relocs against - symbols which turn out to need copy relocs or are not - dynamic. */ - - if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0 - && (((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) - || (htab->elf.dynamic_sections_created - && (h->root.type == bfd_link_hash_undefweak - || h->root.type == bfd_link_hash_undefined)))) - { - /* Make sure this symbol is output as a dynamic symbol. - Undefined weak syms won't yet be marked as dynamic. */ - if (h->dynindx == -1 - && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) - { - if (! bfd_elf_link_record_dynamic_symbol (info, h)) - return FALSE; - } - - /* If that succeeded, we know we'll be keeping all the - relocs. */ - if (h->dynindx != -1) - goto keep; - } - - eh->dyn_relocs = NULL; - - keep: ; - } - - /* Finally, allocate space. */ - for (p = eh->dyn_relocs; p != NULL; p = p->next) - { - asection *sreloc = elf_section_data (p->sec)->sreloc; - sreloc->_raw_size += p->count * sizeof (Elf32_External_Rela); - } - - return TRUE; -} - -/* Find any dynamic relocs that apply to read-only sections. */ - -static bfd_boolean -readonly_dynrelocs (h, inf) - struct elf_link_hash_entry *h; - PTR inf; -{ - struct elf32_sparc_link_hash_entry *eh; - struct elf32_sparc_dyn_relocs *p; - - if (h->root.type == bfd_link_hash_warning) - h = (struct elf_link_hash_entry *) h->root.u.i.link; - - eh = (struct elf32_sparc_link_hash_entry *) h; - for (p = eh->dyn_relocs; p != NULL; p = p->next) - { - asection *s = p->sec->output_section; - - if (s != NULL && (s->flags & SEC_READONLY) != 0) - { - struct bfd_link_info *info = (struct bfd_link_info *) inf; - - info->flags |= DF_TEXTREL; - - /* Not an error, just cut short the traversal. */ - return FALSE; - } - } - return TRUE; -} - -/* Set the sizes of the dynamic sections. */ - -static bfd_boolean -elf32_sparc_size_dynamic_sections (output_bfd, info) - bfd *output_bfd ATTRIBUTE_UNUSED; - struct bfd_link_info *info; -{ - struct elf32_sparc_link_hash_table *htab; - bfd *dynobj; - asection *s; - bfd *ibfd; - - htab = elf32_sparc_hash_table (info); - dynobj = htab->elf.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->executable) - { - s = bfd_get_section_by_name (dynobj, ".interp"); - BFD_ASSERT (s != NULL); - s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER; - s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER; - } - } - - /* Set up .got offsets for local syms, and space for local dynamic - relocs. */ - for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) - { - bfd_signed_vma *local_got; - bfd_signed_vma *end_local_got; - char *local_tls_type; - bfd_size_type locsymcount; - Elf_Internal_Shdr *symtab_hdr; - asection *srel; - - if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour) - continue; - - for (s = ibfd->sections; s != NULL; s = s->next) - { - struct elf32_sparc_dyn_relocs *p; - - for (p = *((struct elf32_sparc_dyn_relocs **) - &elf_section_data (s)->local_dynrel); - p != NULL; - p = p->next) - { - if (!bfd_is_abs_section (p->sec) - && bfd_is_abs_section (p->sec->output_section)) - { - /* Input section has been discarded, either because - it is a copy of a linkonce section or due to - linker script /DISCARD/, so we'll be discarding - the relocs too. */ - } - else if (p->count != 0) - { - srel = elf_section_data (p->sec)->sreloc; - srel->_raw_size += p->count * sizeof (Elf32_External_Rela); - if ((p->sec->output_section->flags & SEC_READONLY) != 0) - info->flags |= DF_TEXTREL; - } - } - } - - local_got = elf_local_got_refcounts (ibfd); - if (!local_got) - continue; - - symtab_hdr = &elf_tdata (ibfd)->symtab_hdr; - locsymcount = symtab_hdr->sh_info; - end_local_got = local_got + locsymcount; - local_tls_type = elf32_sparc_local_got_tls_type (ibfd); - s = htab->sgot; - srel = htab->srelgot; - for (; local_got < end_local_got; ++local_got, ++local_tls_type) - { - if (*local_got > 0) - { - *local_got = s->_raw_size; - s->_raw_size += 4; - if (*local_tls_type == GOT_TLS_GD) - s->_raw_size += 4; - if (info->shared - || *local_tls_type == GOT_TLS_GD - || *local_tls_type == GOT_TLS_IE) - srel->_raw_size += sizeof (Elf32_External_Rela); - } - else - *local_got = (bfd_vma) -1; - } - } - - if (htab->tls_ldm_got.refcount > 0) - { - /* Allocate 2 got entries and 1 dynamic reloc for - R_SPARC_TLS_LDM_{HI22,LO10} relocs. */ - htab->tls_ldm_got.offset = htab->sgot->_raw_size; - htab->sgot->_raw_size += 8; - htab->srelgot->_raw_size += sizeof (Elf32_External_Rela); - } - else - htab->tls_ldm_got.offset = -1; - - /* Allocate global sym .plt and .got entries, and space for global - sym dynamic relocs. */ - elf_link_hash_traverse (&htab->elf, allocate_dynrelocs, (PTR) info); - - if (elf_hash_table (info)->dynamic_sections_created) - { - /* Make space for the trailing nop in .plt. */ - if (htab->splt->_raw_size > 0) - htab->splt->_raw_size += 4; - - /* If the .got section is more than 0x1000 bytes, we add - 0x1000 to the value of _GLOBAL_OFFSET_TABLE_, so that 13 - bit relocations have a greater chance of working. */ - if (htab->sgot->_raw_size >= 0x1000 - && elf_hash_table (info)->hgot->root.u.def.value == 0) - elf_hash_table (info)->hgot->root.u.def.value = 0x1000; - } - - /* The check_relocs and adjust_dynamic_symbol entry points have - determined the sizes of the various dynamic sections. Allocate - memory for them. */ - for (s = dynobj->sections; s != NULL; s = s->next) - { - const char *name; - bfd_boolean strip = FALSE; - - if ((s->flags & SEC_LINKER_CREATED) == 0) - continue; - - /* It's OK to base decisions on the section name, because none - of the dynobj section names depend upon the input files. */ - name = bfd_get_section_name (dynobj, s); - - if (strncmp (name, ".rela", 5) == 0) - { - if (s->_raw_size == 0) - { - /* If we don't need this section, strip it from the - output file. This is to handle .rela.bss and - .rel.plt. We must create it in - create_dynamic_sections, because it must be created - before the linker maps input sections to output - sections. The linker does that before - adjust_dynamic_symbol is called, and it is that - function which decides whether anything needs to go - into these sections. */ - strip = TRUE; - } - else - { - /* We use the reloc_count field as a counter if we need - to copy relocs into the output file. */ - s->reloc_count = 0; - } - } - else if (s != htab->splt && s != htab->sgot) - { - /* 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. */ - /* FIXME: This should be a call to bfd_alloc not bfd_zalloc. - Unused entries should be reclaimed before the section's contents - are written out, but at the moment this does not happen. Thus in - order to prevent writing out garbage, we initialise the section's - contents to zero. */ - s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size); - if (s->contents == NULL && s->_raw_size != 0) - return FALSE; - } - - if (elf_hash_table (info)->dynamic_sections_created) - { - /* Add some entries to the .dynamic section. We fill in the - values later, in elf32_sparc_finish_dynamic_sections, but we - must add the entries now so that we get the correct size for - the .dynamic section. The DT_DEBUG entry is filled in by the - dynamic linker and used by the debugger. */ -#define add_dynamic_entry(TAG, VAL) \ - _bfd_elf_add_dynamic_entry (info, TAG, VAL) - - if (info->executable) - { - if (!add_dynamic_entry (DT_DEBUG, 0)) - return FALSE; - } - - if (htab->srelplt->_raw_size != 0) - { - if (!add_dynamic_entry (DT_PLTGOT, 0) - || !add_dynamic_entry (DT_PLTRELSZ, 0) - || !add_dynamic_entry (DT_PLTREL, DT_RELA) - || !add_dynamic_entry (DT_JMPREL, 0)) - return FALSE; - } - - if (!add_dynamic_entry (DT_RELA, 0) - || !add_dynamic_entry (DT_RELASZ, 0) - || !add_dynamic_entry (DT_RELAENT, sizeof (Elf32_External_Rela))) - return FALSE; - - /* If any dynamic relocs apply to a read-only section, - then we need a DT_TEXTREL entry. */ - if ((info->flags & DF_TEXTREL) == 0) - elf_link_hash_traverse (&htab->elf, readonly_dynrelocs, - (PTR) info); - - if (info->flags & DF_TEXTREL) - { - if (!add_dynamic_entry (DT_TEXTREL, 0)) - return FALSE; - } - } -#undef add_dynamic_entry - - return TRUE; -} - -struct elf32_sparc_section_data -{ - struct bfd_elf_section_data elf; - unsigned int do_relax; -}; - -#define sec_do_relax(sec) \ - ((struct elf32_sparc_section_data *) elf_section_data (sec))->do_relax - -static bfd_boolean -elf32_sparc_new_section_hook (abfd, sec) - bfd *abfd; - asection *sec; -{ - struct elf32_sparc_section_data *sdata; - bfd_size_type amt = sizeof (*sdata); - - sdata = (struct elf32_sparc_section_data *) bfd_zalloc (abfd, amt); - if (sdata == NULL) - return FALSE; - sec->used_by_bfd = (PTR) sdata; - - return _bfd_elf_new_section_hook (abfd, sec); -} - -static bfd_boolean -elf32_sparc_relax_section (abfd, section, link_info, again) - bfd *abfd ATTRIBUTE_UNUSED; - asection *section ATTRIBUTE_UNUSED; - struct bfd_link_info *link_info ATTRIBUTE_UNUSED; - bfd_boolean *again; -{ - *again = FALSE; - sec_do_relax (section) = 1; - return TRUE; -} - -/* Return the base VMA address which should be subtracted from real addresses - when resolving @dtpoff relocation. - This is PT_TLS segment p_vaddr. */ - -static bfd_vma -dtpoff_base (info) - struct bfd_link_info *info; -{ - /* If tls_sec is NULL, we should have signalled an error already. */ - if (elf_hash_table (info)->tls_sec == NULL) - return 0; - return elf_hash_table (info)->tls_sec->vma; -} - -/* Return the relocation value for @tpoff relocation - if STT_TLS virtual address is ADDRESS. */ - -static bfd_vma -tpoff (info, address) - struct bfd_link_info *info; - bfd_vma address; -{ - struct elf_link_hash_table *htab = elf_hash_table (info); - - /* If tls_sec is NULL, we should have signalled an error already. */ - if (htab->tls_sec == NULL) - return 0; - return address - htab->tls_size - htab->tls_sec->vma; -} - -/* Relocate a SPARC ELF section. */ - -static bfd_boolean -elf32_sparc_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; -{ - struct elf32_sparc_link_hash_table *htab; - Elf_Internal_Shdr *symtab_hdr; - struct elf_link_hash_entry **sym_hashes; - bfd_vma *local_got_offsets; - bfd_vma got_base; - asection *sreloc; - Elf_Internal_Rela *rel; - Elf_Internal_Rela *relend; - - if (info->relocatable) - return TRUE; - - htab = elf32_sparc_hash_table (info); - symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; - sym_hashes = elf_sym_hashes (input_bfd); - local_got_offsets = elf_local_got_offsets (input_bfd); - - if (elf_hash_table (info)->hgot == NULL) - got_base = 0; - else - got_base = elf_hash_table (info)->hgot->root.u.def.value; - - sreloc = elf_section_data (input_section)->sreloc; - - rel = relocs; - relend = relocs + input_section->reloc_count; - for (; rel < relend; rel++) - { - int r_type, tls_type; - reloc_howto_type *howto; - unsigned long r_symndx; - struct elf_link_hash_entry *h; - Elf_Internal_Sym *sym; - asection *sec; - bfd_vma relocation, off; - bfd_reloc_status_type r; - bfd_boolean is_plt = FALSE; - bfd_boolean unresolved_reloc; - - r_type = ELF32_R_TYPE (rel->r_info); - - if (r_type == R_SPARC_GNU_VTINHERIT - || r_type == R_SPARC_GNU_VTENTRY) - continue; - - if (r_type < 0 || r_type >= (int) R_SPARC_max_std) - { - bfd_set_error (bfd_error_bad_value); - return FALSE; - } - howto = _bfd_sparc_elf_howto_table + r_type; - - /* This is a final link. */ - r_symndx = ELF32_R_SYM (rel->r_info); - h = NULL; - sym = NULL; - sec = NULL; - unresolved_reloc = FALSE; - if (r_symndx < symtab_hdr->sh_info) - { - sym = local_syms + r_symndx; - sec = local_sections[r_symndx]; - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); - } - else - { - bfd_boolean warned ATTRIBUTE_UNUSED; - - RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel, - r_symndx, symtab_hdr, sym_hashes, - h, sec, relocation, - unresolved_reloc, warned); - } - - switch (r_type) - { - case R_SPARC_GOT10: - case R_SPARC_GOT13: - case R_SPARC_GOT22: - /* Relocation is to the entry for this symbol in the global - offset table. */ - if (htab->sgot == NULL) - abort (); - - if (h != NULL) - { - bfd_boolean dyn; - - off = h->got.offset; - BFD_ASSERT (off != (bfd_vma) -1); - dyn = elf_hash_table (info)->dynamic_sections_created; - - if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h) - || (info->shared - && (info->symbolic - || h->dynindx == -1 - || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL)) - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))) - { - /* This is actually a static link, or it is a - -Bsymbolic link and the symbol is defined - locally, or the symbol was forced to be local - because of a version file. We must initialize - this entry in the global offset table. Since the - offset must always be a multiple of 4, we use the - least significant bit to record whether we have - initialized it already. - - When doing a dynamic link, we create a .rela.got - relocation entry to initialize the value. This - is done in the finish_dynamic_symbol routine. */ - if ((off & 1) != 0) - off &= ~1; - else - { - bfd_put_32 (output_bfd, relocation, - htab->sgot->contents + off); - h->got.offset |= 1; - } - } - else - unresolved_reloc = FALSE; - } - else - { - BFD_ASSERT (local_got_offsets != NULL - && local_got_offsets[r_symndx] != (bfd_vma) -1); - - off = local_got_offsets[r_symndx]; - - /* The offset must always be a multiple of 4. We use - the least significant bit to record whether we have - already processed this entry. */ - if ((off & 1) != 0) - off &= ~1; - else - { - - if (info->shared) - { - asection *s; - Elf_Internal_Rela outrel; - bfd_byte *loc; - - /* We need to generate a R_SPARC_RELATIVE reloc - for the dynamic linker. */ - s = htab->srelgot; - BFD_ASSERT (s != NULL); - - outrel.r_offset = (htab->sgot->output_section->vma - + htab->sgot->output_offset - + off); - outrel.r_info = ELF32_R_INFO (0, R_SPARC_RELATIVE); - outrel.r_addend = relocation; - relocation = 0; - loc = s->contents; - loc += s->reloc_count++ * sizeof (Elf32_External_Rela); - bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); - } - - bfd_put_32 (output_bfd, relocation, - htab->sgot->contents + off); - local_got_offsets[r_symndx] |= 1; - } - } - relocation = htab->sgot->output_offset + off - got_base; - break; - - case R_SPARC_PLT32: - if (h == NULL || h->plt.offset == (bfd_vma) -1) - { - r_type = R_SPARC_32; - goto r_sparc_plt32; - } - /* Fall through. */ - case R_SPARC_WPLT30: - r_sparc_wplt30: - /* Relocation is to the entry for this symbol in the - procedure linkage table. */ - - /* The Solaris native assembler will generate a WPLT30 reloc - for a local symbol if you assemble a call from one - section to another when using -K pic. We treat it as - WDISP30. */ - if (h == NULL) - break; - - if (h->plt.offset == (bfd_vma) -1 || htab->splt == NULL) - { - /* We didn't make a PLT entry for this symbol. This - happens when statically linking PIC code, or when - using -Bsymbolic. */ - break; - } - - relocation = (htab->splt->output_section->vma - + htab->splt->output_offset - + h->plt.offset); - unresolved_reloc = FALSE; - if (r_type == R_SPARC_PLT32) - { - r_type = R_SPARC_32; - is_plt = TRUE; - goto r_sparc_plt32; - } - break; - - case R_SPARC_PC10: - case R_SPARC_PC22: - if (h != NULL - && strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0) - break; - /* Fall through. */ - case R_SPARC_DISP8: - case R_SPARC_DISP16: - case R_SPARC_DISP32: - case R_SPARC_WDISP30: - case R_SPARC_WDISP22: - case R_SPARC_WDISP19: - case R_SPARC_WDISP16: - case R_SPARC_8: - case R_SPARC_16: - case R_SPARC_32: - case R_SPARC_HI22: - case R_SPARC_22: - case R_SPARC_13: - case R_SPARC_LO10: - case R_SPARC_UA16: - case R_SPARC_UA32: - r_sparc_plt32: - /* r_symndx will be zero only for relocs against symbols - from removed linkonce sections, or sections discarded by - a linker script. */ - if (r_symndx == 0 - || (input_section->flags & SEC_ALLOC) == 0) - break; - - if ((info->shared - && (! howto->pc_relative - || (h != NULL - && h->dynindx != -1 - && (! info->symbolic - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0)))) - || (!info->shared - && h != NULL - && h->dynindx != -1 - && (h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0 - && (((h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - && (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0) - || h->root.type == bfd_link_hash_undefweak - || h->root.type == bfd_link_hash_undefined))) - { - Elf_Internal_Rela outrel; - bfd_byte *loc; - bfd_boolean skip, relocate = FALSE; - - /* When generating a shared object, these relocations - are copied into the output file to be resolved at run - time. */ - - BFD_ASSERT (sreloc != NULL); - - skip = FALSE; - - outrel.r_offset = - _bfd_elf_section_offset (output_bfd, info, input_section, - rel->r_offset); - if (outrel.r_offset == (bfd_vma) -1) - skip = TRUE; - else if (outrel.r_offset == (bfd_vma) -2) - skip = TRUE, relocate = TRUE; - outrel.r_offset += (input_section->output_section->vma - + input_section->output_offset); - - /* Optimize unaligned reloc usage now that we know where - it finally resides. */ - switch (r_type) - { - case R_SPARC_16: - if (outrel.r_offset & 1) - r_type = R_SPARC_UA16; - break; - case R_SPARC_UA16: - if (!(outrel.r_offset & 1)) - r_type = R_SPARC_16; - break; - case R_SPARC_32: - if (outrel.r_offset & 3) - r_type = R_SPARC_UA32; - break; - case R_SPARC_UA32: - if (!(outrel.r_offset & 3)) - r_type = R_SPARC_32; - break; - case R_SPARC_DISP8: - case R_SPARC_DISP16: - case R_SPARC_DISP32: - /* If the symbol is not dynamic, we should not keep - a dynamic relocation. But an .rela.* slot has been - allocated for it, output R_SPARC_NONE. - FIXME: Add code tracking needed dynamic relocs as - e.g. i386 has. */ - if (h->dynindx == -1) - skip = TRUE, relocate = TRUE; - break; - } - - if (skip) - memset (&outrel, 0, sizeof outrel); - /* h->dynindx may be -1 if the symbol was marked to - become local. */ - else if (h != NULL && ! is_plt - && ((! info->symbolic && h->dynindx != -1) - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0)) - { - BFD_ASSERT (h->dynindx != -1); - outrel.r_info = ELF32_R_INFO (h->dynindx, r_type); - outrel.r_addend = rel->r_addend; - } - else - { - if (r_type == R_SPARC_32) - { - outrel.r_info = ELF32_R_INFO (0, R_SPARC_RELATIVE); - outrel.r_addend = relocation + rel->r_addend; - } - else - { - long indx; - - if (is_plt) - sec = htab->splt; - - if (bfd_is_abs_section (sec)) - indx = 0; - else if (sec == NULL || sec->owner == NULL) - { - bfd_set_error (bfd_error_bad_value); - return FALSE; - } - else - { - asection *osec; - - osec = sec->output_section; - indx = elf_section_data (osec)->dynindx; - - /* FIXME: we really should be able to link non-pic - shared libraries. */ - if (indx == 0) - { - BFD_FAIL (); - (*_bfd_error_handler) - (_("%s: probably compiled without -fPIC?"), - bfd_archive_filename (input_bfd)); - bfd_set_error (bfd_error_bad_value); - return FALSE; - } - } - - outrel.r_info = ELF32_R_INFO (indx, r_type); - outrel.r_addend = relocation + rel->r_addend; - } - } - - loc = sreloc->contents; - loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela); - bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc); - - /* This reloc will be computed at runtime, so there's no - need to do anything now. */ - if (! relocate) - continue; - } - break; - - case R_SPARC_TLS_GD_HI22: - if (! elf32_sparc_tdata (input_bfd)->has_tlsgd) - { - /* R_SPARC_REV32 used the same reloc number as - R_SPARC_TLS_GD_HI22. */ - r_type = R_SPARC_REV32; - break; - } - /* Fall through */ - - case R_SPARC_TLS_GD_LO10: - case R_SPARC_TLS_IE_HI22: - case R_SPARC_TLS_IE_LO10: - r_type = elf32_sparc_tls_transition (info, input_bfd, r_type, - h == NULL); - tls_type = GOT_UNKNOWN; - if (h == NULL && local_got_offsets) - tls_type = elf32_sparc_local_got_tls_type (input_bfd) [r_symndx]; - else if (h != NULL) - { - tls_type = elf32_sparc_hash_entry(h)->tls_type; - if (!info->shared && h->dynindx == -1 && tls_type == GOT_TLS_IE) - switch (ELF32_R_TYPE (rel->r_info)) - { - case R_SPARC_TLS_GD_HI22: - case R_SPARC_TLS_IE_HI22: - r_type = R_SPARC_TLS_LE_HIX22; - break; - default: - r_type = R_SPARC_TLS_LE_LOX10; - break; - } - } - if (tls_type == GOT_TLS_IE) - switch (r_type) - { - case R_SPARC_TLS_GD_HI22: - r_type = R_SPARC_TLS_IE_HI22; - break; - case R_SPARC_TLS_GD_LO10: - r_type = R_SPARC_TLS_IE_LO10; - break; - } - - if (r_type == R_SPARC_TLS_LE_HIX22) - { - relocation = tpoff (info, relocation); - break; - } - if (r_type == R_SPARC_TLS_LE_LOX10) - { - /* Change add into xor. */ - relocation = tpoff (info, relocation); - bfd_put_32 (output_bfd, (bfd_get_32 (input_bfd, - contents + rel->r_offset) - | 0x80182000), contents + rel->r_offset); - break; - } - - if (h != NULL) - { - off = h->got.offset; - h->got.offset |= 1; - } - else - { - BFD_ASSERT (local_got_offsets != NULL); - off = local_got_offsets[r_symndx]; - local_got_offsets[r_symndx] |= 1; - } - - r_sparc_tlsldm: - if (htab->sgot == NULL) - abort (); - - if ((off & 1) != 0) - off &= ~1; - else - { - Elf_Internal_Rela outrel; - Elf32_External_Rela *loc; - int dr_type, indx; - - if (htab->srelgot == NULL) - abort (); - - bfd_put_32 (output_bfd, 0, htab->sgot->contents + off); - outrel.r_offset = (htab->sgot->output_section->vma - + htab->sgot->output_offset + off); - indx = h && h->dynindx != -1 ? h->dynindx : 0; - if (r_type == R_SPARC_TLS_IE_HI22 - || r_type == R_SPARC_TLS_IE_LO10) - dr_type = R_SPARC_TLS_TPOFF32; - else - dr_type = R_SPARC_TLS_DTPMOD32; - if (dr_type == R_SPARC_TLS_TPOFF32 && indx == 0) - outrel.r_addend = relocation - dtpoff_base (info); - else - outrel.r_addend = 0; - outrel.r_info = ELF32_R_INFO (indx, dr_type); - loc = (Elf32_External_Rela *) htab->srelgot->contents; - loc += htab->srelgot->reloc_count++; - bfd_elf32_swap_reloca_out (output_bfd, &outrel, - (bfd_byte *) loc); - - if (r_type == R_SPARC_TLS_GD_HI22 - || r_type == R_SPARC_TLS_GD_LO10) - { - if (indx == 0) - { - BFD_ASSERT (! unresolved_reloc); - bfd_put_32 (output_bfd, - relocation - dtpoff_base (info), - htab->sgot->contents + off + 4); - } - else - { - bfd_put_32 (output_bfd, 0, - htab->sgot->contents + off + 4); - outrel.r_info = ELF32_R_INFO (indx, - R_SPARC_TLS_DTPOFF32); - outrel.r_offset += 4; - htab->srelgot->reloc_count++; - loc++; - bfd_elf32_swap_reloca_out (output_bfd, &outrel, - (bfd_byte *) loc); - } - } - else if (dr_type == R_SPARC_TLS_DTPMOD32) - { - bfd_put_32 (output_bfd, 0, - htab->sgot->contents + off + 4); - } - } - - if (off >= (bfd_vma) -2) - abort (); - - relocation = htab->sgot->output_offset + off - got_base; - unresolved_reloc = FALSE; - howto = _bfd_sparc_elf_howto_table + r_type; - break; - - case R_SPARC_TLS_LDM_HI22: - case R_SPARC_TLS_LDM_LO10: - if (! info->shared) - { - bfd_put_32 (output_bfd, SPARC_NOP, contents + rel->r_offset); - continue; - } - off = htab->tls_ldm_got.offset; - htab->tls_ldm_got.offset |= 1; - goto r_sparc_tlsldm; - - case R_SPARC_TLS_LDO_HIX22: - case R_SPARC_TLS_LDO_LOX10: - if (info->shared) - relocation -= dtpoff_base (info); - else - relocation = tpoff (info, relocation); - break; - - case R_SPARC_TLS_LE_HIX22: - case R_SPARC_TLS_LE_LOX10: - if (info->shared) - { - Elf_Internal_Rela outrel; - bfd_boolean skip, relocate = FALSE; - - BFD_ASSERT (sreloc != NULL); - skip = FALSE; - outrel.r_offset = - _bfd_elf_section_offset (output_bfd, info, input_section, - rel->r_offset); - if (outrel.r_offset == (bfd_vma) -1) - skip = TRUE; - else if (outrel.r_offset == (bfd_vma) -2) - skip = TRUE, relocate = TRUE; - outrel.r_offset += (input_section->output_section->vma - + input_section->output_offset); - if (skip) - memset (&outrel, 0, sizeof outrel); - else - { - outrel.r_info = ELF32_R_INFO (0, r_type); - outrel.r_addend = relocation - dtpoff_base (info) - + rel->r_addend; - } - - bfd_elf32_swap_reloca_out (output_bfd, &outrel, - (bfd_byte *) (((Elf32_External_Rela *) - sreloc->contents) - + sreloc->reloc_count)); - ++sreloc->reloc_count; - continue; - } - relocation = tpoff (info, relocation); - break; - - case R_SPARC_TLS_LDM_CALL: - if (! info->shared) - { - /* mov %g0, %o0 */ - bfd_put_32 (output_bfd, 0x90100000, contents + rel->r_offset); - continue; - } - /* Fall through */ - - case R_SPARC_TLS_GD_CALL: - tls_type = GOT_UNKNOWN; - if (h == NULL && local_got_offsets) - tls_type = elf32_sparc_local_got_tls_type (input_bfd) [r_symndx]; - else if (h != NULL) - tls_type = elf32_sparc_hash_entry(h)->tls_type; - if (! info->shared - || (r_type == R_SPARC_TLS_GD_CALL && tls_type == GOT_TLS_IE)) - { - bfd_vma insn; - - if (!info->shared && (h == NULL || h->dynindx == -1)) - { - /* GD -> LE */ - bfd_put_32 (output_bfd, SPARC_NOP, contents + rel->r_offset); - continue; - } - - /* GD -> IE */ - if (rel + 1 < relend - && ELF32_R_TYPE (rel[1].r_info) == R_SPARC_TLS_GD_ADD - && rel[1].r_offset == rel->r_offset + 4 - && ELF32_R_SYM (rel[1].r_info) == r_symndx - && (((insn = bfd_get_32 (input_bfd, - contents + rel[1].r_offset)) - >> 25) & 0x1f) == 8) - { - /* We have - call __tls_get_addr, %tgd_call(foo) - add %reg1, %reg2, %o0, %tgd_add(foo) - and change it into IE: - ld [%reg1 + %reg2], %o0, %tie_ld(foo) - add %g7, %o0, %o0, %tie_add(foo). - add is 0x80000000 | (rd << 25) | (rs1 << 14) | rs2, - ld is 0xc0000000 | (rd << 25) | (rs1 << 14) | rs2. */ - bfd_put_32 (output_bfd, insn | 0xc0000000, - contents + rel->r_offset); - bfd_put_32 (output_bfd, 0x9001c008, - contents + rel->r_offset + 4); - rel++; - continue; - } - - bfd_put_32 (output_bfd, 0x9001c008, contents + rel->r_offset); - continue; - } - - h = (struct elf_link_hash_entry *) - bfd_link_hash_lookup (info->hash, "__tls_get_addr", FALSE, - FALSE, TRUE); - BFD_ASSERT (h != NULL); - r_type = R_SPARC_WPLT30; - howto = _bfd_sparc_elf_howto_table + r_type; - goto r_sparc_wplt30; - - case R_SPARC_TLS_GD_ADD: - tls_type = GOT_UNKNOWN; - if (h == NULL && local_got_offsets) - tls_type = elf32_sparc_local_got_tls_type (input_bfd) [r_symndx]; - else if (h != NULL) - tls_type = elf32_sparc_hash_entry(h)->tls_type; - if (! info->shared || tls_type == GOT_TLS_IE) - { - /* add %reg1, %reg2, %reg3, %tgd_add(foo) - changed into IE: - ld [%reg1 + %reg2], %reg3, %tie_ld(foo) - or LE: - add %g7, %reg2, %reg3. */ - bfd_vma insn = bfd_get_32 (input_bfd, contents + rel->r_offset); - if ((h != NULL && h->dynindx != -1) || info->shared) - relocation = insn | 0xc0000000; - else - relocation = (insn & ~0x7c000) | 0x1c000; - bfd_put_32 (output_bfd, relocation, contents + rel->r_offset); - } - continue; - - case R_SPARC_TLS_LDM_ADD: - if (! info->shared) - bfd_put_32 (output_bfd, SPARC_NOP, contents + rel->r_offset); - continue; - - case R_SPARC_TLS_LDO_ADD: - if (! info->shared) - { - /* Change rs1 into %g7. */ - bfd_vma insn = bfd_get_32 (input_bfd, contents + rel->r_offset); - insn = (insn & ~0x7c000) | 0x1c000; - bfd_put_32 (output_bfd, insn, contents + rel->r_offset); - } - continue; - - case R_SPARC_TLS_IE_LD: - case R_SPARC_TLS_IE_LDX: - if (! info->shared && (h == NULL || h->dynindx == -1)) - { - bfd_vma insn = bfd_get_32 (input_bfd, contents + rel->r_offset); - int rs2 = insn & 0x1f; - int rd = (insn >> 25) & 0x1f; - - if (rs2 == rd) - relocation = SPARC_NOP; - else - relocation = 0x80100000 | (insn & 0x3e00001f); - bfd_put_32 (output_bfd, relocation, contents + rel->r_offset); - } - continue; - - case R_SPARC_TLS_IE_ADD: - /* Totally useless relocation. */ - continue; - - case R_SPARC_TLS_DTPOFF32: - relocation -= dtpoff_base (info); - break; - - default: - break; - } - - /* Dynamic relocs are not propagated for SEC_DEBUGGING sections - because such sections are not SEC_ALLOC and thus ld.so will - not process them. */ - if (unresolved_reloc - && !((input_section->flags & SEC_DEBUGGING) != 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0)) - (*_bfd_error_handler) - (_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"), - bfd_archive_filename (input_bfd), - bfd_get_section_name (input_bfd, input_section), - (long) rel->r_offset, - h->root.root.string); - - r = bfd_reloc_continue; - if (r_type == R_SPARC_WDISP16) - { - bfd_vma x; - - relocation += rel->r_addend; - relocation -= (input_section->output_section->vma - + input_section->output_offset); - relocation -= rel->r_offset; - - x = bfd_get_32 (input_bfd, contents + rel->r_offset); - x |= ((((relocation >> 2) & 0xc000) << 6) - | ((relocation >> 2) & 0x3fff)); - bfd_put_32 (input_bfd, x, contents + rel->r_offset); - - if ((bfd_signed_vma) relocation < - 0x40000 - || (bfd_signed_vma) relocation > 0x3ffff) - r = bfd_reloc_overflow; - else - r = bfd_reloc_ok; - } - else if (r_type == R_SPARC_REV32) - { - bfd_vma x; - - relocation = relocation + rel->r_addend; - - x = bfd_get_32 (input_bfd, contents + rel->r_offset); - x = x + relocation; - bfd_putl32 (/*input_bfd,*/ x, contents + rel->r_offset); - r = bfd_reloc_ok; - } - else if (r_type == R_SPARC_TLS_LDO_HIX22 - || r_type == R_SPARC_TLS_LE_HIX22) - { - bfd_vma x; - - relocation += rel->r_addend; - relocation = relocation ^ 0xffffffff; - - x = bfd_get_32 (input_bfd, contents + rel->r_offset); - x = (x & ~(bfd_vma) 0x3fffff) | ((relocation >> 10) & 0x3fffff); - bfd_put_32 (input_bfd, x, contents + rel->r_offset); - r = bfd_reloc_ok; - } - else if (r_type == R_SPARC_TLS_LDO_LOX10 - || r_type == R_SPARC_TLS_LE_LOX10) - { - bfd_vma x; - - relocation += rel->r_addend; - relocation = (relocation & 0x3ff) | 0x1c00; - - x = bfd_get_32 (input_bfd, contents + rel->r_offset); - x = (x & ~(bfd_vma) 0x1fff) | relocation; - bfd_put_32 (input_bfd, x, contents + rel->r_offset); - - r = bfd_reloc_ok; - } - else if ((r_type == R_SPARC_WDISP30 || r_type == R_SPARC_WPLT30) - && sec_do_relax (input_section) - && rel->r_offset + 4 < input_section->_raw_size) - { -#define G0 0 -#define O7 15 -#define XCC (2 << 20) -#define COND(x) (((x)&0xf)<<25) -#define CONDA COND(0x8) -#define INSN_BPA (F2(0,1) | CONDA | BPRED | XCC) -#define INSN_BA (F2(0,2) | CONDA) -#define INSN_OR F3(2, 0x2, 0) -#define INSN_NOP F2(0,4) - - bfd_vma x, y; - - /* If the instruction is a call with either: - restore - arithmetic instruction with rd == %o7 - where rs1 != %o7 and rs2 if it is register != %o7 - then we can optimize if the call destination is near - by changing the call into a branch always. */ - x = bfd_get_32 (input_bfd, contents + rel->r_offset); - y = bfd_get_32 (input_bfd, contents + rel->r_offset + 4); - if ((x & OP(~0)) == OP(1) && (y & OP(~0)) == OP(2)) - { - if (((y & OP3(~0)) == OP3(0x3d) /* restore */ - || ((y & OP3(0x28)) == 0 /* arithmetic */ - && (y & RD(~0)) == RD(O7))) - && (y & RS1(~0)) != RS1(O7) - && ((y & F3I(~0)) - || (y & RS2(~0)) != RS2(O7))) - { - bfd_vma reloc; - - reloc = relocation + rel->r_addend - rel->r_offset; - reloc -= (input_section->output_section->vma - + input_section->output_offset); - - /* Ensure the reloc fits into simm22. */ - if ((reloc & 3) == 0 - && ((reloc & ~(bfd_vma)0x7fffff) == 0 - || ((reloc | 0x7fffff) == ~(bfd_vma)0))) - { - reloc >>= 2; - - /* Check whether it fits into simm19 on v9. */ - if (((reloc & 0x3c0000) == 0 - || (reloc & 0x3c0000) == 0x3c0000) - && (elf_elfheader (output_bfd)->e_flags & EF_SPARC_32PLUS)) - x = INSN_BPA | (reloc & 0x7ffff); /* ba,pt %xcc */ - else - x = INSN_BA | (reloc & 0x3fffff); /* ba */ - bfd_put_32 (input_bfd, x, contents + rel->r_offset); - r = bfd_reloc_ok; - if (rel->r_offset >= 4 - && (y & (0xffffffff ^ RS1(~0))) - == (INSN_OR | RD(O7) | RS2(G0))) - { - bfd_vma z; - unsigned int reg; - - z = bfd_get_32 (input_bfd, - contents + rel->r_offset - 4); - if ((z & (0xffffffff ^ RD(~0))) - != (INSN_OR | RS1(O7) | RS2(G0))) - break; - - /* The sequence was - or %o7, %g0, %rN - call foo - or %rN, %g0, %o7 - - If call foo was replaced with ba, replace - or %rN, %g0, %o7 with nop. */ - - reg = (y & RS1(~0)) >> 14; - if (reg != ((z & RD(~0)) >> 25) - || reg == G0 || reg == O7) - break; - - bfd_put_32 (input_bfd, (bfd_vma) INSN_NOP, - contents + rel->r_offset + 4); - } - - } - } - } - } - - if (r == bfd_reloc_continue) - r = _bfd_final_link_relocate (howto, input_bfd, input_section, - contents, rel->r_offset, - relocation, rel->r_addend); - - if (r != bfd_reloc_ok) - { - switch (r) - { - default: - case bfd_reloc_outofrange: - abort (); - case bfd_reloc_overflow: - { - const char *name; - - if (h != NULL) - name = h->root.root.string; - else - { - name = bfd_elf_string_from_elf_section (input_bfd, - symtab_hdr->sh_link, - sym->st_name); - if (name == NULL) - return FALSE; - if (*name == '\0') - name = bfd_section_name (input_bfd, sec); - } - if (! ((*info->callbacks->reloc_overflow) - (info, name, howto->name, (bfd_vma) 0, - input_bfd, input_section, rel->r_offset))) - return FALSE; - } - break; - } - } - } - - return TRUE; -} - -/* Finish up dynamic symbol handling. We set the contents of various - dynamic sections here. */ - -static bfd_boolean -elf32_sparc_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; - struct elf32_sparc_link_hash_table *htab; - - htab = elf32_sparc_hash_table (info); - dynobj = htab->elf.dynobj; - - if (h->plt.offset != (bfd_vma) -1) - { - asection *splt; - asection *srela; - Elf_Internal_Rela rela; - bfd_byte *loc; - - /* This symbol has an entry in the procedure linkage table. Set - it up. */ - - BFD_ASSERT (h->dynindx != -1); - - splt = htab->splt; - srela = htab->srelplt; - BFD_ASSERT (splt != NULL && srela != NULL); - - /* Fill in the entry in the procedure linkage table. */ - bfd_put_32 (output_bfd, - PLT_ENTRY_WORD0 + h->plt.offset, - splt->contents + h->plt.offset); - bfd_put_32 (output_bfd, - (PLT_ENTRY_WORD1 - + (((- (h->plt.offset + 4)) >> 2) & 0x3fffff)), - splt->contents + h->plt.offset + 4); - bfd_put_32 (output_bfd, (bfd_vma) PLT_ENTRY_WORD2, - splt->contents + h->plt.offset + 8); - - /* Fill in the entry in the .rela.plt section. */ - rela.r_offset = (splt->output_section->vma - + splt->output_offset - + h->plt.offset); - rela.r_info = ELF32_R_INFO (h->dynindx, R_SPARC_JMP_SLOT); - rela.r_addend = 0; - loc = srela->contents; - loc += (h->plt.offset / PLT_ENTRY_SIZE - 4) * sizeof (Elf32_External_Rela); - bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); - - if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) - { - /* Mark the symbol as undefined, rather than as defined in - the .plt section. Leave the value alone. */ - sym->st_shndx = SHN_UNDEF; - /* If the symbol is weak, we do need to clear the value. - Otherwise, the PLT entry would provide a definition for - the symbol even if the symbol wasn't defined anywhere, - and so the symbol would never be NULL. */ - if ((h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR_NONWEAK) - == 0) - sym->st_value = 0; - } - } - - if (h->got.offset != (bfd_vma) -1 - && elf32_sparc_hash_entry(h)->tls_type != GOT_TLS_GD - && elf32_sparc_hash_entry(h)->tls_type != GOT_TLS_IE) - { - asection *sgot; - asection *srela; - Elf_Internal_Rela rela; - bfd_byte *loc; - - /* This symbol has an entry in the global offset table. Set it - up. */ - - sgot = htab->sgot; - srela = htab->srelgot; - BFD_ASSERT (sgot != NULL && srela != NULL); - - rela.r_offset = (sgot->output_section->vma - + sgot->output_offset - + (h->got.offset &~ (bfd_vma) 1)); - - /* If this is a -Bsymbolic link, and the symbol is defined - locally, we just want to emit a RELATIVE reloc. Likewise if - the symbol was forced to be local because of a version file. - The entry in the global offset table will already have been - initialized in the relocate_section function. */ - if (info->shared - && (info->symbolic || h->dynindx == -1) - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)) - { - asection *sec = h->root.u.def.section; - rela.r_info = ELF32_R_INFO (0, R_SPARC_RELATIVE); - rela.r_addend = (h->root.u.def.value - + sec->output_section->vma - + sec->output_offset); - } - else - { - rela.r_info = ELF32_R_INFO (h->dynindx, R_SPARC_GLOB_DAT); - rela.r_addend = 0; - } - - bfd_put_32 (output_bfd, (bfd_vma) 0, - sgot->contents + (h->got.offset &~ (bfd_vma) 1)); - loc = srela->contents; - loc += srela->reloc_count++ * sizeof (Elf32_External_Rela); - bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); - } - - if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0) - { - asection *s; - Elf_Internal_Rela rela; - bfd_byte *loc; - - /* This symbols needs a copy reloc. Set it up. */ - - BFD_ASSERT (h->dynindx != -1); - - s = bfd_get_section_by_name (h->root.u.def.section->owner, - ".rela.bss"); - BFD_ASSERT (s != NULL); - - rela.r_offset = (h->root.u.def.value - + h->root.u.def.section->output_section->vma - + h->root.u.def.section->output_offset); - rela.r_info = ELF32_R_INFO (h->dynindx, R_SPARC_COPY); - rela.r_addend = 0; - loc = s->contents + s->reloc_count++ * sizeof (Elf32_External_Rela); - bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); - } - - /* Mark some specially defined symbols as absolute. */ - if (strcmp (h->root.root.string, "_DYNAMIC") == 0 - || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0 - || strcmp (h->root.root.string, "_PROCEDURE_LINKAGE_TABLE_") == 0) - sym->st_shndx = SHN_ABS; - - return TRUE; -} - -/* Finish up the dynamic sections. */ - -static bfd_boolean -elf32_sparc_finish_dynamic_sections (output_bfd, info) - bfd *output_bfd; - struct bfd_link_info *info; -{ - bfd *dynobj; - asection *sdyn; - struct elf32_sparc_link_hash_table *htab; - - htab = elf32_sparc_hash_table (info); - dynobj = htab->elf.dynobj; - - sdyn = bfd_get_section_by_name (dynobj, ".dynamic"); - - if (elf_hash_table (info)->dynamic_sections_created) - { - asection *splt; - Elf32_External_Dyn *dyncon, *dynconend; - - splt = bfd_get_section_by_name (dynobj, ".plt"); - BFD_ASSERT (splt != NULL && sdyn != NULL); - - dyncon = (Elf32_External_Dyn *) sdyn->contents; - dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->_raw_size); - for (; dyncon < dynconend; dyncon++) - { - Elf_Internal_Dyn dyn; - const char *name; - bfd_boolean size; - - bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn); - - switch (dyn.d_tag) - { - case DT_PLTGOT: name = ".plt"; size = FALSE; break; - case DT_PLTRELSZ: name = ".rela.plt"; size = TRUE; break; - case DT_JMPREL: name = ".rela.plt"; size = FALSE; break; - default: name = NULL; size = FALSE; break; - } - - if (name != NULL) - { - asection *s; - - s = bfd_get_section_by_name (output_bfd, name); - if (s == NULL) - dyn.d_un.d_val = 0; - else - { - if (! size) - dyn.d_un.d_ptr = s->vma; - else - { - if (s->_cooked_size != 0) - dyn.d_un.d_val = s->_cooked_size; - else - dyn.d_un.d_val = s->_raw_size; - } - } - bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); - } - } - - /* Clear the first four entries in the procedure linkage table, - and put a nop in the last four bytes. */ - if (splt->_raw_size > 0) - { - memset (splt->contents, 0, 4 * PLT_ENTRY_SIZE); - bfd_put_32 (output_bfd, (bfd_vma) SPARC_NOP, - splt->contents + splt->_raw_size - 4); - } - - elf_section_data (splt->output_section)->this_hdr.sh_entsize = 0; - } - - /* Set the first entry in the global offset table to the address of - the dynamic section. */ - if (htab->sgot && htab->sgot->_raw_size > 0) - { - if (sdyn == NULL) - bfd_put_32 (output_bfd, (bfd_vma) 0, htab->sgot->contents); - else - bfd_put_32 (output_bfd, - sdyn->output_section->vma + sdyn->output_offset, - htab->sgot->contents); - } - - if (htab->sgot) - elf_section_data (htab->sgot->output_section)->this_hdr.sh_entsize = 4; - - return TRUE; -} - /* Functions for dealing with the e_flags field. We don't define set_private_flags or copy_private_bfd_data because @@ -3301,11 +67,10 @@ elf32_sparc_finish_dynamic_sections (output_bfd, info) object file when linking. */ static bfd_boolean -elf32_sparc_merge_private_bfd_data (ibfd, obfd) - bfd *ibfd; - bfd *obfd; +elf32_sparc_merge_private_bfd_data (bfd *ibfd, bfd *obfd) { bfd_boolean error; + unsigned long ibfd_mach; /* FIXME: This should not be static. */ static unsigned long previous_ibfd_e_flags = (unsigned long) -1; @@ -3315,17 +80,17 @@ elf32_sparc_merge_private_bfd_data (ibfd, obfd) error = FALSE; - if (bfd_get_mach (ibfd) >= bfd_mach_sparc_v9) + ibfd_mach = bfd_get_mach (ibfd); + if (bfd_mach_sparc_64bit_p (ibfd_mach)) { error = TRUE; (*_bfd_error_handler) - (_("%s: compiled for a 64 bit system and target is 32 bit"), - bfd_archive_filename (ibfd)); + (_("%B: compiled for a 64 bit system and target is 32 bit"), ibfd); } else if ((ibfd->flags & DYNAMIC) == 0) { - if (bfd_get_mach (obfd) < bfd_get_mach (ibfd)) - bfd_set_arch_mach (obfd, bfd_arch_sparc, bfd_get_mach (ibfd)); + if (bfd_get_mach (obfd) < ibfd_mach) + bfd_set_arch_mach (obfd, bfd_arch_sparc, ibfd_mach); } if (((elf_elfheader (ibfd)->e_flags & EF_SPARC_LEDATA) @@ -3333,8 +98,7 @@ elf32_sparc_merge_private_bfd_data (ibfd, obfd) && previous_ibfd_e_flags != (unsigned long) -1) { (*_bfd_error_handler) - (_("%s: linking little endian files with big endian files"), - bfd_archive_filename (ibfd)); + (_("%B: linking little endian files with big endian files"), ibfd); error = TRUE; } previous_ibfd_e_flags = elf_elfheader (ibfd)->e_flags & EF_SPARC_LEDATA; @@ -3347,45 +111,19 @@ elf32_sparc_merge_private_bfd_data (ibfd, obfd) return TRUE; } - -/* Set the right machine number. */ - -static bfd_boolean -elf32_sparc_object_p (abfd) - bfd *abfd; -{ - if (elf_elfheader (abfd)->e_machine == EM_SPARC32PLUS) - { - if (elf_elfheader (abfd)->e_flags & EF_SPARC_SUN_US3) - return bfd_default_set_arch_mach (abfd, bfd_arch_sparc, - bfd_mach_sparc_v8plusb); - else if (elf_elfheader (abfd)->e_flags & EF_SPARC_SUN_US1) - return bfd_default_set_arch_mach (abfd, bfd_arch_sparc, - bfd_mach_sparc_v8plusa); - else if (elf_elfheader (abfd)->e_flags & EF_SPARC_32PLUS) - return bfd_default_set_arch_mach (abfd, bfd_arch_sparc, - bfd_mach_sparc_v8plus); - else - return FALSE; - } - else if (elf_elfheader (abfd)->e_flags & EF_SPARC_LEDATA) - return bfd_default_set_arch_mach (abfd, bfd_arch_sparc, - bfd_mach_sparc_sparclite_le); - else - return bfd_default_set_arch_mach (abfd, bfd_arch_sparc, bfd_mach_sparc); -} /* The final processing done just before writing out the object file. We need to set the e_machine field appropriately. */ static void -elf32_sparc_final_write_processing (abfd, linker) - bfd *abfd; - bfd_boolean linker ATTRIBUTE_UNUSED; +elf32_sparc_final_write_processing (bfd *abfd, + bfd_boolean linker ATTRIBUTE_UNUSED) { switch (bfd_get_mach (abfd)) { case bfd_mach_sparc : + case bfd_mach_sparc_sparclet : + case bfd_mach_sparc_sparclite : break; /* nothing to do */ case bfd_mach_sparc_v8plus : elf_elfheader (abfd)->e_machine = EM_SPARC32PLUS; @@ -3404,7 +142,6 @@ elf32_sparc_final_write_processing (abfd, linker) | EF_SPARC_SUN_US3; break; case bfd_mach_sparc_sparclite_le : - elf_elfheader (abfd)->e_machine = EM_SPARC; elf_elfheader (abfd)->e_flags |= EF_SPARC_LEDATA; break; default : @@ -3414,8 +151,7 @@ elf32_sparc_final_write_processing (abfd, linker) } static enum elf_reloc_type_class -elf32_sparc_reloc_type_class (rela) - const Elf_Internal_Rela *rela; +elf32_sparc_reloc_type_class (const Elf_Internal_Rela *rela) { switch ((int) ELF32_R_TYPE (rela->r_info)) { @@ -3429,7 +165,7 @@ elf32_sparc_reloc_type_class (rela) return reloc_class_normal; } } - + #define TARGET_BIG_SYM bfd_elf32_sparc_vec #define TARGET_BIG_NAME "elf32-sparc" #define ELF_ARCH bfd_arch_sparc @@ -3437,37 +173,40 @@ elf32_sparc_reloc_type_class (rela) #define ELF_MACHINE_ALT1 EM_SPARC32PLUS #define ELF_MAXPAGESIZE 0x10000 -#define bfd_elf32_bfd_reloc_type_lookup elf32_sparc_reloc_type_lookup -#define bfd_elf32_bfd_link_hash_table_create \ - elf32_sparc_link_hash_table_create -#define bfd_elf32_bfd_relax_section elf32_sparc_relax_section -#define bfd_elf32_new_section_hook elf32_sparc_new_section_hook -#define elf_info_to_howto elf32_sparc_info_to_howto -#define elf_backend_copy_indirect_symbol \ - elf32_sparc_copy_indirect_symbol -#define elf_backend_create_dynamic_sections \ - elf32_sparc_create_dynamic_sections -#define elf_backend_check_relocs elf32_sparc_check_relocs -#define elf_backend_adjust_dynamic_symbol \ - elf32_sparc_adjust_dynamic_symbol -#define elf_backend_size_dynamic_sections \ - elf32_sparc_size_dynamic_sections -#define elf_backend_relocate_section elf32_sparc_relocate_section -#define elf_backend_finish_dynamic_symbol \ - elf32_sparc_finish_dynamic_symbol -#define elf_backend_finish_dynamic_sections \ - elf32_sparc_finish_dynamic_sections #define bfd_elf32_bfd_merge_private_bfd_data \ elf32_sparc_merge_private_bfd_data -#define bfd_elf32_mkobject elf32_sparc_mkobject -#define elf_backend_object_p elf32_sparc_object_p #define elf_backend_final_write_processing \ elf32_sparc_final_write_processing -#define elf_backend_gc_mark_hook elf32_sparc_gc_mark_hook -#define elf_backend_gc_sweep_hook elf32_sparc_gc_sweep_hook #define elf_backend_grok_psinfo elf32_sparc_grok_psinfo #define elf_backend_reloc_type_class elf32_sparc_reloc_type_class +#define elf_info_to_howto _bfd_sparc_elf_info_to_howto +#define bfd_elf32_bfd_reloc_type_lookup _bfd_sparc_elf_reloc_type_lookup +#define bfd_elf32_bfd_link_hash_table_create \ + _bfd_sparc_elf_link_hash_table_create +#define bfd_elf32_bfd_relax_section _bfd_sparc_elf_relax_section +#define bfd_elf32_new_section_hook _bfd_sparc_elf_new_section_hook +#define elf_backend_copy_indirect_symbol \ + _bfd_sparc_elf_copy_indirect_symbol +#define elf_backend_create_dynamic_sections \ + _bfd_sparc_elf_create_dynamic_sections +#define elf_backend_check_relocs _bfd_sparc_elf_check_relocs +#define elf_backend_adjust_dynamic_symbol \ + _bfd_sparc_elf_adjust_dynamic_symbol +#define elf_backend_omit_section_dynsym _bfd_sparc_elf_omit_section_dynsym +#define elf_backend_size_dynamic_sections \ + _bfd_sparc_elf_size_dynamic_sections +#define elf_backend_relocate_section _bfd_sparc_elf_relocate_section +#define elf_backend_finish_dynamic_symbol \ + _bfd_sparc_elf_finish_dynamic_symbol +#define elf_backend_finish_dynamic_sections \ + _bfd_sparc_elf_finish_dynamic_sections +#define bfd_elf32_mkobject _bfd_sparc_elf_mkobject +#define elf_backend_object_p _bfd_sparc_elf_object_p +#define elf_backend_gc_mark_hook _bfd_sparc_elf_gc_mark_hook +#define elf_backend_gc_sweep_hook _bfd_sparc_elf_gc_sweep_hook +#define elf_backend_plt_sym_val _bfd_sparc_elf_plt_sym_val + #define elf_backend_can_gc_sections 1 #define elf_backend_can_refcount 1 #define elf_backend_want_got_plt 0 @@ -3477,3 +216,68 @@ elf32_sparc_reloc_type_class (rela) #define elf_backend_rela_normal 1 #include "elf32-target.h" + +/* A wrapper around _bfd_sparc_elf_link_hash_table_create that identifies + the target system as VxWorks. */ + +static struct bfd_link_hash_table * +elf32_sparc_vxworks_link_hash_table_create (bfd *abfd) +{ + struct bfd_link_hash_table *ret; + + ret = _bfd_sparc_elf_link_hash_table_create (abfd); + if (ret) + { + struct _bfd_sparc_elf_link_hash_table *htab; + + htab = (struct _bfd_sparc_elf_link_hash_table *) ret; + htab->is_vxworks = 1; + } + return ret; +} + +/* A final_write_processing hook that does both the SPARC- and VxWorks- + specific handling. */ + +static void +elf32_sparc_vxworks_final_write_processing (bfd *abfd, bfd_boolean linker) +{ + elf32_sparc_final_write_processing (abfd, linker); + elf_vxworks_final_write_processing (abfd, linker); +} + +#undef TARGET_BIG_SYM +#define TARGET_BIG_SYM bfd_elf32_sparc_vxworks_vec +#undef TARGET_BIG_NAME +#define TARGET_BIG_NAME "elf32-sparc-vxworks" + +#undef ELF_MINPAGESIZE +#define ELF_MINPAGESIZE 0x1000 + +#undef bfd_elf32_bfd_link_hash_table_create +#define bfd_elf32_bfd_link_hash_table_create \ + elf32_sparc_vxworks_link_hash_table_create + +#undef elf_backend_want_got_plt +#define elf_backend_want_got_plt 1 +#undef elf_backend_plt_readonly +#define elf_backend_plt_readonly 1 +#undef elf_backend_got_header_size +#define elf_backend_got_header_size 12 +#undef elf_backend_add_symbol_hook +#define elf_backend_add_symbol_hook \ + elf_vxworks_add_symbol_hook +#undef elf_backend_link_output_symbol_hook +#define elf_backend_link_output_symbol_hook \ + elf_vxworks_link_output_symbol_hook +#undef elf_backend_emit_relocs +#define elf_backend_emit_relocs \ + elf_vxworks_emit_relocs +#undef elf_backend_final_write_processing +#define elf_backend_final_write_processing \ + elf32_sparc_vxworks_final_write_processing + +#undef elf32_bed +#define elf32_bed sparc_elf_vxworks_bed + +#include "elf32-target.h" diff --git a/contrib/binutils/bfd/elf32.c b/contrib/binutils/bfd/elf32.c index bfadd5cb016..6221f0ae1dc 100644 --- a/contrib/binutils/bfd/elf32.c +++ b/contrib/binutils/bfd/elf32.c @@ -15,7 +15,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #define ARCH_SIZE 32 diff --git a/contrib/binutils/bfd/elf64-alpha.c b/contrib/binutils/bfd/elf64-alpha.c index 2d4715b4e14..76d0661a116 100644 --- a/contrib/binutils/bfd/elf64-alpha.c +++ b/contrib/binutils/bfd/elf64-alpha.c @@ -1,6 +1,6 @@ /* Alpha specific support for 64-bit ELF - Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 - Free Software Foundation, Inc. + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, + 2006 Free Software Foundation, Inc. Contributed by Richard Henderson . This file is part of BFD, the Binary File Descriptor library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* We need a published ABI spec for this. Until one comes out, don't assume this'll remain unchanged forever. */ @@ -47,116 +47,59 @@ #define ECOFF_64 #include "ecoffswap.h" -static bfd_boolean alpha_elf_dynamic_symbol_p - PARAMS ((struct elf_link_hash_entry *, struct bfd_link_info *)); -static struct bfd_hash_entry * elf64_alpha_link_hash_newfunc - PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); -static struct bfd_link_hash_table * elf64_alpha_bfd_link_hash_table_create - PARAMS ((bfd *)); + +/* Instruction data for plt generation and relaxation. */ -static bfd_reloc_status_type elf64_alpha_reloc_nil - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static bfd_reloc_status_type elf64_alpha_reloc_bad - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static bfd_reloc_status_type elf64_alpha_do_reloc_gpdisp - PARAMS ((bfd *, bfd_vma, bfd_byte *, bfd_byte *)); -static bfd_reloc_status_type elf64_alpha_reloc_gpdisp - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +#define OP_LDA 0x08 +#define OP_LDAH 0x09 +#define OP_LDQ 0x29 +#define OP_BR 0x30 +#define OP_BSR 0x34 -static reloc_howto_type * elf64_alpha_bfd_reloc_type_lookup - PARAMS ((bfd *, bfd_reloc_code_real_type)); -static void elf64_alpha_info_to_howto - PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); +#define INSN_LDA (OP_LDA << 26) +#define INSN_LDAH (OP_LDAH << 26) +#define INSN_LDQ (OP_LDQ << 26) +#define INSN_BR (OP_BR << 26) -static bfd_boolean elf64_alpha_mkobject - PARAMS ((bfd *)); -static bfd_boolean elf64_alpha_object_p - PARAMS ((bfd *)); -static bfd_boolean elf64_alpha_section_from_shdr - PARAMS ((bfd *, Elf_Internal_Shdr *, const char *)); -static bfd_boolean elf64_alpha_section_flags - PARAMS ((flagword *, Elf_Internal_Shdr *)); -static bfd_boolean elf64_alpha_fake_sections - PARAMS ((bfd *, Elf_Internal_Shdr *, asection *)); -static bfd_boolean elf64_alpha_create_got_section - PARAMS ((bfd *, struct bfd_link_info *)); -static bfd_boolean elf64_alpha_create_dynamic_sections - PARAMS ((bfd *, struct bfd_link_info *)); +#define INSN_ADDQ 0x40000400 +#define INSN_RDUNIQ 0x0000009e +#define INSN_SUBQ 0x40000520 +#define INSN_S4SUBQ 0x40000560 +#define INSN_UNOP 0x2ffe0000 -static bfd_boolean elf64_alpha_read_ecoff_info - PARAMS ((bfd *, asection *, struct ecoff_debug_info *)); -static bfd_boolean elf64_alpha_is_local_label_name - PARAMS ((bfd *, const char *)); -static bfd_boolean elf64_alpha_find_nearest_line - PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **, - const char **, unsigned int *)); +#define INSN_JSR 0x68004000 +#define INSN_JMP 0x68000000 +#define INSN_JSR_MASK 0xfc00c000 -#if defined(__STDC__) || defined(ALMOST_STDC) -struct alpha_elf_link_hash_entry; +#define INSN_A(I,A) (I | (A << 21)) +#define INSN_AB(I,A,B) (I | (A << 21) | (B << 16)) +#define INSN_ABC(I,A,B,C) (I | (A << 21) | (B << 16) | C) +#define INSN_ABO(I,A,B,O) (I | (A << 21) | (B << 16) | ((O) & 0xffff)) +#define INSN_AD(I,A,D) (I | (A << 21) | (((D) >> 2) & 0x1fffff)) + +/* PLT/GOT Stuff */ + +/* Set by ld emulation. Putting this into the link_info or hash structure + is simply working too hard. */ +#ifdef USE_SECUREPLT +bfd_boolean elf64_alpha_use_secureplt = TRUE; +#else +bfd_boolean elf64_alpha_use_secureplt = FALSE; #endif -static bfd_boolean elf64_alpha_output_extsym - PARAMS ((struct alpha_elf_link_hash_entry *, PTR)); +#define OLD_PLT_HEADER_SIZE 32 +#define OLD_PLT_ENTRY_SIZE 12 +#define NEW_PLT_HEADER_SIZE 36 +#define NEW_PLT_ENTRY_SIZE 4 -static bfd_boolean elf64_alpha_can_merge_gots - PARAMS ((bfd *, bfd *)); -static void elf64_alpha_merge_gots - PARAMS ((bfd *, bfd *)); -static bfd_boolean elf64_alpha_calc_got_offsets_for_symbol - PARAMS ((struct alpha_elf_link_hash_entry *, PTR)); -static void elf64_alpha_calc_got_offsets - PARAMS ((struct bfd_link_info *)); -static bfd_boolean elf64_alpha_size_got_sections - PARAMS ((struct bfd_link_info *)); -static bfd_boolean elf64_alpha_size_plt_section - PARAMS ((struct bfd_link_info *)); -static bfd_boolean elf64_alpha_size_plt_section_1 - PARAMS ((struct alpha_elf_link_hash_entry *, PTR)); -static bfd_boolean elf64_alpha_always_size_sections - PARAMS ((bfd *, struct bfd_link_info *)); -static int alpha_dynamic_entries_for_reloc - PARAMS ((int, int, int)); -static bfd_boolean elf64_alpha_calc_dynrel_sizes - PARAMS ((struct alpha_elf_link_hash_entry *, struct bfd_link_info *)); -static bfd_boolean elf64_alpha_size_rela_got_section - PARAMS ((struct bfd_link_info *)); -static bfd_boolean elf64_alpha_size_rela_got_1 - PARAMS ((struct alpha_elf_link_hash_entry *, struct bfd_link_info *)); -static bfd_boolean elf64_alpha_add_symbol_hook - PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Sym *, - const char **, flagword *, asection **, bfd_vma *)); -static struct alpha_elf_got_entry *get_got_entry - PARAMS ((bfd *, struct alpha_elf_link_hash_entry *, unsigned long, - unsigned long, bfd_vma)); -static bfd_boolean elf64_alpha_check_relocs - PARAMS ((bfd *, struct bfd_link_info *, asection *sec, - const Elf_Internal_Rela *)); -static bfd_boolean elf64_alpha_adjust_dynamic_symbol - PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *)); -static bfd_boolean elf64_alpha_size_dynamic_sections - PARAMS ((bfd *, struct bfd_link_info *)); -static void elf64_alpha_emit_dynrel - PARAMS ((bfd *, struct bfd_link_info *, asection *, asection *, - bfd_vma, long, long, bfd_vma)); -static bfd_boolean elf64_alpha_relocate_section_r - PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, - Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); -static bfd_boolean elf64_alpha_relocate_section - PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, - Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); -static bfd_boolean elf64_alpha_finish_dynamic_symbol - PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, - Elf_Internal_Sym *)); -static bfd_boolean elf64_alpha_finish_dynamic_sections - PARAMS ((bfd *, struct bfd_link_info *)); -static bfd_boolean elf64_alpha_final_link - PARAMS ((bfd *, struct bfd_link_info *)); -static bfd_boolean elf64_alpha_merge_ind_symbols - PARAMS ((struct alpha_elf_link_hash_entry *, PTR)); -static Elf_Internal_Rela * elf64_alpha_find_reloc_at_ofs - PARAMS ((Elf_Internal_Rela *, Elf_Internal_Rela *, bfd_vma, int)); -static enum elf_reloc_type_class elf64_alpha_reloc_type_class - PARAMS ((const Elf_Internal_Rela *)); +#define PLT_HEADER_SIZE \ + (elf64_alpha_use_secureplt ? NEW_PLT_HEADER_SIZE : OLD_PLT_HEADER_SIZE) +#define PLT_ENTRY_SIZE \ + (elf64_alpha_use_secureplt ? NEW_PLT_ENTRY_SIZE : OLD_PLT_ENTRY_SIZE) + +#define MAX_GOT_SIZE (64*1024) + +#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so" struct alpha_elf_link_hash_entry { @@ -169,19 +112,15 @@ struct alpha_elf_link_hash_entry int flags; /* Contexts in which a literal was referenced. */ -#define ALPHA_ELF_LINK_HASH_LU_ADDR 0x01 -#define ALPHA_ELF_LINK_HASH_LU_MEM 0x02 -#define ALPHA_ELF_LINK_HASH_LU_BYTE 0x04 -#define ALPHA_ELF_LINK_HASH_LU_JSR 0x08 -#define ALPHA_ELF_LINK_HASH_LU_TLSGD 0x10 -#define ALPHA_ELF_LINK_HASH_LU_TLSLDM 0x20 -#define ALPHA_ELF_LINK_HASH_LU_FUNC 0x38 -#define ALPHA_ELF_LINK_HASH_TLS_IE 0x40 -#define ALPHA_ELF_LINK_HASH_PLT_LOC 0x80 - - /* Used to undo the localization of a plt symbol. */ - asection *plt_old_section; - bfd_vma plt_old_value; +#define ALPHA_ELF_LINK_HASH_LU_ADDR 0x01 +#define ALPHA_ELF_LINK_HASH_LU_MEM 0x02 +#define ALPHA_ELF_LINK_HASH_LU_BYTE 0x04 +#define ALPHA_ELF_LINK_HASH_LU_JSR 0x08 +#define ALPHA_ELF_LINK_HASH_LU_TLSGD 0x10 +#define ALPHA_ELF_LINK_HASH_LU_TLSLDM 0x20 +#define ALPHA_ELF_LINK_HASH_LU_JSRDIRECT 0x40 +#define ALPHA_ELF_LINK_HASH_LU_PLT 0x38 +#define ALPHA_ELF_LINK_HASH_TLS_IE 0x80 /* Used to implement multiple .got subsections. */ struct alpha_elf_got_entry @@ -197,6 +136,9 @@ struct alpha_elf_link_hash_entry /* The .got offset for this entry. */ int got_offset; + /* The .plt offset for this entry. */ + int plt_offset; + /* How many references to this entry? */ int use_count; @@ -256,7 +198,7 @@ struct alpha_elf_link_hash_table #define alpha_elf_link_hash_traverse(table, func, info) \ (elf_link_hash_traverse \ (&(table)->root, \ - (bfd_boolean (*) PARAMS ((struct elf_link_hash_entry *, PTR))) (func), \ + (bfd_boolean (*) (struct elf_link_hash_entry *, PTR)) (func), \ (info))) /* Get the Alpha ELF linker hash table from a link_info structure. */ @@ -275,9 +217,8 @@ struct alpha_elf_link_hash_table address is ever taken. */ static inline bfd_boolean -alpha_elf_dynamic_symbol_p (h, info) - struct elf_link_hash_entry *h; - struct bfd_link_info *info; +alpha_elf_dynamic_symbol_p (struct elf_link_hash_entry *h, + struct bfd_link_info *info) { return _bfd_elf_dynamic_symbol_p (h, info, 0); } @@ -285,10 +226,9 @@ alpha_elf_dynamic_symbol_p (h, info) /* Create an entry in a Alpha ELF linker hash table. */ static struct bfd_hash_entry * -elf64_alpha_link_hash_newfunc (entry, table, string) - struct bfd_hash_entry *entry; - struct bfd_hash_table *table; - const char *string; +elf64_alpha_link_hash_newfunc (struct bfd_hash_entry *entry, + struct bfd_hash_table *table, + const char *string) { struct alpha_elf_link_hash_entry *ret = (struct alpha_elf_link_hash_entry *) entry; @@ -324,8 +264,7 @@ elf64_alpha_link_hash_newfunc (entry, table, string) /* Create a Alpha ELF linker hash table. */ static struct bfd_link_hash_table * -elf64_alpha_bfd_link_hash_table_create (abfd) - bfd *abfd; +elf64_alpha_bfd_link_hash_table_create (bfd *abfd) { struct alpha_elf_link_hash_table *ret; bfd_size_type amt = sizeof (struct alpha_elf_link_hash_table); @@ -334,8 +273,9 @@ elf64_alpha_bfd_link_hash_table_create (abfd) if (ret == (struct alpha_elf_link_hash_table *) NULL) return NULL; - if (! _bfd_elf_link_hash_table_init (&ret->root, abfd, - elf64_alpha_link_hash_newfunc)) + if (!_bfd_elf_link_hash_table_init (&ret->root, abfd, + elf64_alpha_link_hash_newfunc, + sizeof (struct alpha_elf_link_hash_entry))) { free (ret); return NULL; @@ -379,8 +319,7 @@ struct alpha_elf_obj_tdata ((struct alpha_elf_obj_tdata *) (abfd)->tdata.any) static bfd_boolean -elf64_alpha_mkobject (abfd) - bfd *abfd; +elf64_alpha_mkobject (bfd *abfd) { bfd_size_type amt = sizeof (struct alpha_elf_obj_tdata); abfd->tdata.any = bfd_zalloc (abfd, amt); @@ -390,13 +329,123 @@ elf64_alpha_mkobject (abfd) } static bfd_boolean -elf64_alpha_object_p (abfd) - bfd *abfd; +elf64_alpha_object_p (bfd *abfd) { /* Set the right machine number for an Alpha ELF file. */ return bfd_default_set_arch_mach (abfd, bfd_arch_alpha, 0); } +/* A relocation function which doesn't do anything. */ + +static bfd_reloc_status_type +elf64_alpha_reloc_nil (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc, + asymbol *sym ATTRIBUTE_UNUSED, + PTR data ATTRIBUTE_UNUSED, asection *sec, + bfd *output_bfd, char **error_message ATTRIBUTE_UNUSED) +{ + if (output_bfd) + reloc->address += sec->output_offset; + return bfd_reloc_ok; +} + +/* A relocation function used for an unsupported reloc. */ + +static bfd_reloc_status_type +elf64_alpha_reloc_bad (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc, + asymbol *sym ATTRIBUTE_UNUSED, + PTR data ATTRIBUTE_UNUSED, asection *sec, + bfd *output_bfd, char **error_message ATTRIBUTE_UNUSED) +{ + if (output_bfd) + reloc->address += sec->output_offset; + return bfd_reloc_notsupported; +} + +/* Do the work of the GPDISP relocation. */ + +static bfd_reloc_status_type +elf64_alpha_do_reloc_gpdisp (bfd *abfd, bfd_vma gpdisp, bfd_byte *p_ldah, + bfd_byte *p_lda) +{ + bfd_reloc_status_type ret = bfd_reloc_ok; + bfd_vma addend; + unsigned long i_ldah, i_lda; + + i_ldah = bfd_get_32 (abfd, p_ldah); + i_lda = bfd_get_32 (abfd, p_lda); + + /* Complain if the instructions are not correct. */ + if (((i_ldah >> 26) & 0x3f) != 0x09 + || ((i_lda >> 26) & 0x3f) != 0x08) + ret = bfd_reloc_dangerous; + + /* Extract the user-supplied offset, mirroring the sign extensions + that the instructions perform. */ + addend = ((i_ldah & 0xffff) << 16) | (i_lda & 0xffff); + addend = (addend ^ 0x80008000) - 0x80008000; + + gpdisp += addend; + + if ((bfd_signed_vma) gpdisp < -(bfd_signed_vma) 0x80000000 + || (bfd_signed_vma) gpdisp >= (bfd_signed_vma) 0x7fff8000) + ret = bfd_reloc_overflow; + + /* compensate for the sign extension again. */ + i_ldah = ((i_ldah & 0xffff0000) + | (((gpdisp >> 16) + ((gpdisp >> 15) & 1)) & 0xffff)); + i_lda = (i_lda & 0xffff0000) | (gpdisp & 0xffff); + + bfd_put_32 (abfd, (bfd_vma) i_ldah, p_ldah); + bfd_put_32 (abfd, (bfd_vma) i_lda, p_lda); + + return ret; +} + +/* The special function for the GPDISP reloc. */ + +static bfd_reloc_status_type +elf64_alpha_reloc_gpdisp (bfd *abfd, arelent *reloc_entry, + asymbol *sym ATTRIBUTE_UNUSED, PTR data, + asection *input_section, bfd *output_bfd, + char **err_msg) +{ + bfd_reloc_status_type ret; + bfd_vma gp, relocation; + bfd_vma high_address; + bfd_byte *p_ldah, *p_lda; + + /* Don't do anything if we're not doing a final link. */ + if (output_bfd) + { + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; + } + + high_address = bfd_get_section_limit (abfd, input_section); + if (reloc_entry->address > high_address + || reloc_entry->address + reloc_entry->addend > high_address) + return bfd_reloc_outofrange; + + /* The gp used in the portion of the output object to which this + input object belongs is cached on the input bfd. */ + gp = _bfd_get_gp_value (abfd); + + relocation = (input_section->output_section->vma + + input_section->output_offset + + reloc_entry->address); + + p_ldah = (bfd_byte *) data + reloc_entry->address; + p_lda = p_ldah + reloc_entry->addend; + + ret = elf64_alpha_do_reloc_gpdisp (abfd, gp - relocation, p_ldah, p_lda); + + /* Complain if the instructions are not correct. */ + if (ret == bfd_reloc_dangerous) + *err_msg = _("GPDISP relocation did not find ldah and lda instructions"); + + return ret; +} + /* 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) @@ -944,131 +993,6 @@ static reloc_howto_type elf64_alpha_howto_table[] = FALSE), /* pcrel_offset */ }; -/* A relocation function which doesn't do anything. */ - -static bfd_reloc_status_type -elf64_alpha_reloc_nil (abfd, reloc, sym, data, sec, output_bfd, error_message) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *reloc; - asymbol *sym ATTRIBUTE_UNUSED; - PTR data ATTRIBUTE_UNUSED; - asection *sec; - bfd *output_bfd; - char **error_message ATTRIBUTE_UNUSED; -{ - if (output_bfd) - reloc->address += sec->output_offset; - return bfd_reloc_ok; -} - -/* A relocation function used for an unsupported reloc. */ - -static bfd_reloc_status_type -elf64_alpha_reloc_bad (abfd, reloc, sym, data, sec, output_bfd, error_message) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *reloc; - asymbol *sym ATTRIBUTE_UNUSED; - PTR data ATTRIBUTE_UNUSED; - asection *sec; - bfd *output_bfd; - char **error_message ATTRIBUTE_UNUSED; -{ - if (output_bfd) - reloc->address += sec->output_offset; - return bfd_reloc_notsupported; -} - -/* Do the work of the GPDISP relocation. */ - -static bfd_reloc_status_type -elf64_alpha_do_reloc_gpdisp (abfd, gpdisp, p_ldah, p_lda) - bfd *abfd; - bfd_vma gpdisp; - bfd_byte *p_ldah; - bfd_byte *p_lda; -{ - bfd_reloc_status_type ret = bfd_reloc_ok; - bfd_vma addend; - unsigned long i_ldah, i_lda; - - i_ldah = bfd_get_32 (abfd, p_ldah); - i_lda = bfd_get_32 (abfd, p_lda); - - /* Complain if the instructions are not correct. */ - if (((i_ldah >> 26) & 0x3f) != 0x09 - || ((i_lda >> 26) & 0x3f) != 0x08) - ret = bfd_reloc_dangerous; - - /* Extract the user-supplied offset, mirroring the sign extensions - that the instructions perform. */ - addend = ((i_ldah & 0xffff) << 16) | (i_lda & 0xffff); - addend = (addend ^ 0x80008000) - 0x80008000; - - gpdisp += addend; - - if ((bfd_signed_vma) gpdisp < -(bfd_signed_vma) 0x80000000 - || (bfd_signed_vma) gpdisp >= (bfd_signed_vma) 0x7fff8000) - ret = bfd_reloc_overflow; - - /* compensate for the sign extension again. */ - i_ldah = ((i_ldah & 0xffff0000) - | (((gpdisp >> 16) + ((gpdisp >> 15) & 1)) & 0xffff)); - i_lda = (i_lda & 0xffff0000) | (gpdisp & 0xffff); - - bfd_put_32 (abfd, (bfd_vma) i_ldah, p_ldah); - bfd_put_32 (abfd, (bfd_vma) i_lda, p_lda); - - return ret; -} - -/* The special function for the GPDISP reloc. */ - -static bfd_reloc_status_type -elf64_alpha_reloc_gpdisp (abfd, reloc_entry, sym, data, input_section, - output_bfd, err_msg) - bfd *abfd; - arelent *reloc_entry; - asymbol *sym ATTRIBUTE_UNUSED; - PTR data; - asection *input_section; - bfd *output_bfd; - char **err_msg; -{ - bfd_reloc_status_type ret; - bfd_vma gp, relocation; - bfd_byte *p_ldah, *p_lda; - - /* Don't do anything if we're not doing a final link. */ - if (output_bfd) - { - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - if (reloc_entry->address > input_section->_cooked_size || - reloc_entry->address + reloc_entry->addend > input_section->_cooked_size) - return bfd_reloc_outofrange; - - /* The gp used in the portion of the output object to which this - input object belongs is cached on the input bfd. */ - gp = _bfd_get_gp_value (abfd); - - relocation = (input_section->output_section->vma - + input_section->output_offset - + reloc_entry->address); - - p_ldah = (bfd_byte *) data + reloc_entry->address; - p_lda = p_ldah + reloc_entry->addend; - - ret = elf64_alpha_do_reloc_gpdisp (abfd, gp - relocation, p_ldah, p_lda); - - /* Complain if the instructions are not correct. */ - if (ret == bfd_reloc_dangerous) - *err_msg = _("GPDISP relocation did not find ldah and lda instructions"); - - return ret; -} - /* A mapping from BFD reloc types to Alpha ELF reloc types. */ struct elf_reloc_map @@ -1114,9 +1038,8 @@ static const struct elf_reloc_map elf64_alpha_reloc_map[] = /* Given a BFD reloc type, return a HOWTO structure. */ static reloc_howto_type * -elf64_alpha_bfd_reloc_type_lookup (abfd, code) - bfd *abfd ATTRIBUTE_UNUSED; - bfd_reloc_code_real_type code; +elf64_alpha_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, + bfd_reloc_code_real_type code) { const struct elf_reloc_map *i, *e; i = e = elf64_alpha_reloc_map; @@ -1132,14 +1055,10 @@ elf64_alpha_bfd_reloc_type_lookup (abfd, code) /* Given an Alpha ELF reloc type, fill in an arelent structure. */ static void -elf64_alpha_info_to_howto (abfd, cache_ptr, dst) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *cache_ptr; - Elf_Internal_Rela *dst; +elf64_alpha_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, arelent *cache_ptr, + Elf_Internal_Rela *dst) { - unsigned r_type; - - r_type = ELF64_R_TYPE(dst->r_info); + unsigned r_type = ELF64_R_TYPE(dst->r_info); BFD_ASSERT (r_type < (unsigned int) R_ALPHA_max); cache_ptr->howto = &elf64_alpha_howto_table[r_type]; } @@ -1159,6 +1078,1771 @@ elf64_alpha_info_to_howto (abfd, cache_ptr, dst) - align_power ((bfd_vma) 16, \ elf_hash_table (info)->tls_sec->alignment_power)) +/* Handle an Alpha specific section when reading an object file. This + is called when bfd_section_from_shdr finds a section with an unknown + type. + FIXME: We need to handle the SHF_ALPHA_GPREL flag, but I'm not sure + how to. */ + +static bfd_boolean +elf64_alpha_section_from_shdr (bfd *abfd, + Elf_Internal_Shdr *hdr, + const char *name, + int shindex) +{ + asection *newsect; + + /* 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_ALPHA_DEBUG: + if (strcmp (name, ".mdebug") != 0) + return FALSE; + break; + default: + return FALSE; + } + + if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex)) + return FALSE; + newsect = hdr->bfd_section; + + if (hdr->sh_type == SHT_ALPHA_DEBUG) + { + if (! bfd_set_section_flags (abfd, newsect, + (bfd_get_section_flags (abfd, newsect) + | SEC_DEBUGGING))) + return FALSE; + } + + return TRUE; +} + +/* Convert Alpha specific section flags to bfd internal section flags. */ + +static bfd_boolean +elf64_alpha_section_flags (flagword *flags, const Elf_Internal_Shdr *hdr) +{ + if (hdr->sh_flags & SHF_ALPHA_GPREL) + *flags |= SEC_SMALL_DATA; + + return TRUE; +} + +/* Set the correct type for an Alpha ELF section. We do this by the + section name, which is a hack, but ought to work. */ + +static bfd_boolean +elf64_alpha_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec) +{ + register const char *name; + + name = bfd_get_section_name (abfd, sec); + + if (strcmp (name, ".mdebug") == 0) + { + hdr->sh_type = SHT_ALPHA_DEBUG; + /* In a shared object on Irix 5.3, the .mdebug section has an + entsize of 0. FIXME: Does this matter? */ + if ((abfd->flags & DYNAMIC) != 0 ) + hdr->sh_entsize = 0; + else + hdr->sh_entsize = 1; + } + else if ((sec->flags & SEC_SMALL_DATA) + || strcmp (name, ".sdata") == 0 + || strcmp (name, ".sbss") == 0 + || strcmp (name, ".lit4") == 0 + || strcmp (name, ".lit8") == 0) + hdr->sh_flags |= SHF_ALPHA_GPREL; + + return TRUE; +} + +/* Hook called by the linker routine which adds symbols from an object + file. We use it to put .comm items in .sbss, and not .bss. */ + +static bfd_boolean +elf64_alpha_add_symbol_hook (bfd *abfd, struct bfd_link_info *info, + Elf_Internal_Sym *sym, + const char **namep ATTRIBUTE_UNUSED, + flagword *flagsp ATTRIBUTE_UNUSED, + asection **secp, bfd_vma *valp) +{ + if (sym->st_shndx == SHN_COMMON + && !info->relocatable + && sym->st_size <= elf_gp_size (abfd)) + { + /* Common symbols less than or equal to -G nn bytes are + automatically put into .sbss. */ + + asection *scomm = bfd_get_section_by_name (abfd, ".scommon"); + + if (scomm == NULL) + { + scomm = bfd_make_section_with_flags (abfd, ".scommon", + (SEC_ALLOC + | SEC_IS_COMMON + | SEC_LINKER_CREATED)); + if (scomm == NULL) + return FALSE; + } + + *secp = scomm; + *valp = sym->st_size; + } + + return TRUE; +} + +/* Create the .got section. */ + +static bfd_boolean +elf64_alpha_create_got_section (bfd *abfd, + struct bfd_link_info *info ATTRIBUTE_UNUSED) +{ + flagword flags; + asection *s; + + flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY + | SEC_LINKER_CREATED); + s = bfd_make_section_anyway_with_flags (abfd, ".got", flags); + if (s == NULL + || !bfd_set_section_alignment (abfd, s, 3)) + return FALSE; + + alpha_elf_tdata (abfd)->got = s; + + /* Make sure the object's gotobj is set to itself so that we default + to every object with its own .got. We'll merge .gots later once + we've collected each object's info. */ + alpha_elf_tdata (abfd)->gotobj = abfd; + + return TRUE; +} + +/* Create all the dynamic sections. */ + +static bfd_boolean +elf64_alpha_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) +{ + asection *s; + flagword flags; + struct elf_link_hash_entry *h; + + /* We need to create .plt, .rela.plt, .got, and .rela.got sections. */ + + flags = (SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS | SEC_IN_MEMORY + | SEC_LINKER_CREATED + | (elf64_alpha_use_secureplt ? SEC_READONLY : 0)); + s = bfd_make_section_anyway_with_flags (abfd, ".plt", flags); + if (s == NULL || ! bfd_set_section_alignment (abfd, s, 4)) + return FALSE; + + /* Define the symbol _PROCEDURE_LINKAGE_TABLE_ at the start of the + .plt section. */ + h = _bfd_elf_define_linkage_sym (abfd, info, s, + "_PROCEDURE_LINKAGE_TABLE_"); + elf_hash_table (info)->hplt = h; + if (h == NULL) + return FALSE; + + flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY + | SEC_LINKER_CREATED | SEC_READONLY); + s = bfd_make_section_anyway_with_flags (abfd, ".rela.plt", flags); + if (s == NULL || ! bfd_set_section_alignment (abfd, s, 3)) + return FALSE; + + if (elf64_alpha_use_secureplt) + { + flags = SEC_ALLOC | SEC_LINKER_CREATED; + s = bfd_make_section_anyway_with_flags (abfd, ".got.plt", flags); + if (s == NULL || ! bfd_set_section_alignment (abfd, s, 3)) + return FALSE; + } + + /* We may or may not have created a .got section for this object, but + we definitely havn't done the rest of the work. */ + + if (alpha_elf_tdata(abfd)->gotobj == NULL) + { + if (!elf64_alpha_create_got_section (abfd, info)) + return FALSE; + } + + flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY + | SEC_LINKER_CREATED | SEC_READONLY); + s = bfd_make_section_anyway_with_flags (abfd, ".rela.got", flags); + if (s == NULL + || !bfd_set_section_alignment (abfd, s, 3)) + return FALSE; + + /* Define the symbol _GLOBAL_OFFSET_TABLE_ at the start of the + dynobj's .got section. 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 = _bfd_elf_define_linkage_sym (abfd, info, alpha_elf_tdata(abfd)->got, + "_GLOBAL_OFFSET_TABLE_"); + elf_hash_table (info)->hgot = h; + if (h == NULL) + return FALSE; + + return TRUE; +} + +/* Read ECOFF debugging information from a .mdebug section into a + ecoff_debug_info structure. */ + +static bfd_boolean +elf64_alpha_read_ecoff_info (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 (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)) + 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 \ + { \ + bfd_size_type amt = (bfd_size_type) size * symhdr->count; \ + debug->ptr = (type) bfd_malloc (amt); \ + if (debug->ptr == NULL) \ + goto error_return; \ + if (bfd_seek (abfd, (file_ptr) symhdr->offset, SEEK_SET) != 0 \ + || bfd_bread (debug->ptr, amt, abfd) != amt) \ + goto error_return; \ + } + + READ (line, cbLineOffset, cbLine, sizeof (unsigned char), unsigned char *); + READ (external_dnr, cbDnOffset, idnMax, swap->external_dnr_size, PTR); + READ (external_pdr, cbPdOffset, ipdMax, swap->external_pdr_size, PTR); + READ (external_sym, cbSymOffset, isymMax, swap->external_sym_size, PTR); + READ (external_opt, cbOptOffset, ioptMax, swap->external_opt_size, PTR); + READ (external_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; + + 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; +} + +/* Alpha ELF local labels start with '$'. */ + +static bfd_boolean +elf64_alpha_is_local_label_name (bfd *abfd ATTRIBUTE_UNUSED, const char *name) +{ + return name[0] == '$'; +} + +/* Alpha ELF follows MIPS ELF in using a special find_nearest_line + routine in order to handle the ECOFF debugging information. We + still call this mips_elf_find_line because of the slot + find_line_info in elf_obj_tdata is declared that way. */ + +struct mips_elf_find_line +{ + struct ecoff_debug_info d; + struct ecoff_find_line i; +}; + +static bfd_boolean +elf64_alpha_find_nearest_line (bfd *abfd, asection *section, asymbol **symbols, + bfd_vma offset, const char **filename_ptr, + const char **functionname_ptr, + unsigned int *line_ptr) +{ + asection *msec; + + if (_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset, + filename_ptr, functionname_ptr, + line_ptr, 0, + &elf_tdata (abfd)->dwarf2_find_line_info)) + 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, alpha_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; + bfd_size_type amt = sizeof (struct mips_elf_find_line); + + fi = (struct mips_elf_find_line *) bfd_zalloc (abfd, amt); + if (fi == NULL) + { + msec->flags = origflags; + return FALSE; + } + + if (!elf64_alpha_read_ecoff_info (abfd, msec, &fi->d)) + { + msec->flags = origflags; + return FALSE; + } + + /* Swap in the FDR information. */ + amt = fi->d.symbolic_header.ifdMax * sizeof (struct fdr); + fi->d.fdr = (struct fdr *) bfd_alloc (abfd, amt); + 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); +} + +/* Structure used to pass information to alpha_elf_output_extsym. */ + +struct extsym_info +{ + bfd *abfd; + struct bfd_link_info *info; + struct ecoff_debug_info *debug; + const struct ecoff_debug_swap *swap; + bfd_boolean failed; +}; + +static bfd_boolean +elf64_alpha_output_extsym (struct alpha_elf_link_hash_entry *h, PTR data) +{ + struct extsym_info *einfo = (struct extsym_info *) data; + bfd_boolean strip; + asection *sec, *output_section; + + if (h->root.root.type == bfd_link_hash_warning) + h = (struct alpha_elf_link_hash_entry *) h->root.root.u.i.link; + + if (h->root.indx == -2) + strip = FALSE; + else if ((h->root.def_dynamic + || h->root.ref_dynamic + || h->root.root.type == bfd_link_hash_new) + && !h->root.def_regular + && !h->root.ref_regular) + 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 (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; + } + + 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; +} + +/* Search for and possibly create a got entry. */ + +static struct alpha_elf_got_entry * +get_got_entry (bfd *abfd, struct alpha_elf_link_hash_entry *h, + unsigned long r_type, unsigned long r_symndx, + bfd_vma r_addend) +{ + struct alpha_elf_got_entry *gotent; + struct alpha_elf_got_entry **slot; + + if (h) + slot = &h->got_entries; + else + { + /* This is a local .got entry -- record for merge. */ + + struct alpha_elf_got_entry **local_got_entries; + + local_got_entries = alpha_elf_tdata(abfd)->local_got_entries; + if (!local_got_entries) + { + bfd_size_type size; + Elf_Internal_Shdr *symtab_hdr; + + symtab_hdr = &elf_tdata(abfd)->symtab_hdr; + size = symtab_hdr->sh_info; + size *= sizeof (struct alpha_elf_got_entry *); + + local_got_entries + = (struct alpha_elf_got_entry **) bfd_zalloc (abfd, size); + if (!local_got_entries) + return NULL; + + alpha_elf_tdata (abfd)->local_got_entries = local_got_entries; + } + + slot = &local_got_entries[r_symndx]; + } + + for (gotent = *slot; gotent ; gotent = gotent->next) + if (gotent->gotobj == abfd + && gotent->reloc_type == r_type + && gotent->addend == r_addend) + break; + + if (!gotent) + { + int entry_size; + bfd_size_type amt; + + amt = sizeof (struct alpha_elf_got_entry); + gotent = (struct alpha_elf_got_entry *) bfd_alloc (abfd, amt); + if (!gotent) + return NULL; + + gotent->gotobj = abfd; + gotent->addend = r_addend; + gotent->got_offset = -1; + gotent->plt_offset = -1; + gotent->use_count = 1; + gotent->reloc_type = r_type; + gotent->reloc_done = 0; + gotent->reloc_xlated = 0; + + gotent->next = *slot; + *slot = gotent; + + entry_size = alpha_got_entry_size (r_type); + alpha_elf_tdata (abfd)->total_got_size += entry_size; + if (!h) + alpha_elf_tdata(abfd)->local_got_size += entry_size; + } + else + gotent->use_count += 1; + + return gotent; +} + +static bfd_boolean +elf64_alpha_want_plt (struct alpha_elf_link_hash_entry *ah) +{ + return ((ah->root.type == STT_FUNC + || ah->root.root.type == bfd_link_hash_undefweak + || ah->root.root.type == bfd_link_hash_undefined) + && (ah->flags & ALPHA_ELF_LINK_HASH_LU_PLT) != 0 + && (ah->flags & ~ALPHA_ELF_LINK_HASH_LU_PLT) == 0); +} + +/* Handle dynamic relocations when doing an Alpha ELF link. */ + +static bfd_boolean +elf64_alpha_check_relocs (bfd *abfd, struct bfd_link_info *info, + asection *sec, const Elf_Internal_Rela *relocs) +{ + bfd *dynobj; + asection *sreloc; + const char *rel_sec_name; + Elf_Internal_Shdr *symtab_hdr; + struct alpha_elf_link_hash_entry **sym_hashes; + const Elf_Internal_Rela *rel, *relend; + bfd_size_type amt; + + if (info->relocatable) + return TRUE; + + /* Don't do anything special with non-loaded, non-alloced sections. + In particular, any relocs in such sections should not affect GOT + and PLT reference counting (ie. we don't allow them to create GOT + or PLT entries), there's no possibility or desire to optimize TLS + relocs, and there's not much point in propagating relocs to shared + libs that the dynamic linker won't relocate. */ + if ((sec->flags & SEC_ALLOC) == 0) + return TRUE; + + dynobj = elf_hash_table(info)->dynobj; + if (dynobj == NULL) + elf_hash_table(info)->dynobj = dynobj = abfd; + + sreloc = NULL; + rel_sec_name = NULL; + symtab_hdr = &elf_tdata(abfd)->symtab_hdr; + sym_hashes = alpha_elf_sym_hashes(abfd); + + relend = relocs + sec->reloc_count; + for (rel = relocs; rel < relend; ++rel) + { + enum { + NEED_GOT = 1, + NEED_GOT_ENTRY = 2, + NEED_DYNREL = 4 + }; + + unsigned long r_symndx, r_type; + struct alpha_elf_link_hash_entry *h; + unsigned int gotent_flags; + bfd_boolean maybe_dynamic; + unsigned int need; + bfd_vma addend; + + r_symndx = ELF64_R_SYM (rel->r_info); + if (r_symndx < symtab_hdr->sh_info) + h = NULL; + else + { + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + + while (h->root.root.type == bfd_link_hash_indirect + || h->root.root.type == bfd_link_hash_warning) + h = (struct alpha_elf_link_hash_entry *)h->root.root.u.i.link; + + h->root.ref_regular = 1; + } + + /* We can only get preliminary data on whether a symbol is + locally or externally defined, as not all of the input files + have yet been processed. Do something with what we know, as + this may help reduce memory usage and processing time later. */ + maybe_dynamic = FALSE; + if (h && ((info->shared + && (!info->symbolic + || info->unresolved_syms_in_shared_libs == RM_IGNORE)) + || !h->root.def_regular + || h->root.root.type == bfd_link_hash_defweak)) + maybe_dynamic = TRUE; + + need = 0; + gotent_flags = 0; + r_type = ELF64_R_TYPE (rel->r_info); + addend = rel->r_addend; + + switch (r_type) + { + case R_ALPHA_LITERAL: + need = NEED_GOT | NEED_GOT_ENTRY; + + /* Remember how this literal is used from its LITUSEs. + This will be important when it comes to decide if we can + create a .plt entry for a function symbol. */ + while (++rel < relend && ELF64_R_TYPE (rel->r_info) == R_ALPHA_LITUSE) + if (rel->r_addend >= 1 && rel->r_addend <= 6) + gotent_flags |= 1 << rel->r_addend; + --rel; + + /* No LITUSEs -- presumably the address is used somehow. */ + if (gotent_flags == 0) + gotent_flags = ALPHA_ELF_LINK_HASH_LU_ADDR; + break; + + case R_ALPHA_GPDISP: + case R_ALPHA_GPREL16: + case R_ALPHA_GPREL32: + case R_ALPHA_GPRELHIGH: + case R_ALPHA_GPRELLOW: + case R_ALPHA_BRSGP: + need = NEED_GOT; + break; + + case R_ALPHA_REFLONG: + case R_ALPHA_REFQUAD: + if (info->shared || maybe_dynamic) + need = NEED_DYNREL; + break; + + case R_ALPHA_TLSLDM: + /* The symbol for a TLSLDM reloc is ignored. Collapse the + reloc to the 0 symbol so that they all match. */ + r_symndx = 0; + h = 0; + maybe_dynamic = FALSE; + /* FALLTHRU */ + + case R_ALPHA_TLSGD: + case R_ALPHA_GOTDTPREL: + need = NEED_GOT | NEED_GOT_ENTRY; + break; + + case R_ALPHA_GOTTPREL: + need = NEED_GOT | NEED_GOT_ENTRY; + gotent_flags = ALPHA_ELF_LINK_HASH_TLS_IE; + if (info->shared) + info->flags |= DF_STATIC_TLS; + break; + + case R_ALPHA_TPREL64: + if (info->shared || maybe_dynamic) + need = NEED_DYNREL; + if (info->shared) + info->flags |= DF_STATIC_TLS; + break; + } + + if (need & NEED_GOT) + { + if (alpha_elf_tdata(abfd)->gotobj == NULL) + { + if (!elf64_alpha_create_got_section (abfd, info)) + return FALSE; + } + } + + if (need & NEED_GOT_ENTRY) + { + struct alpha_elf_got_entry *gotent; + + gotent = get_got_entry (abfd, h, r_type, r_symndx, addend); + if (!gotent) + return FALSE; + + if (gotent_flags) + { + gotent->flags |= gotent_flags; + if (h) + { + gotent_flags |= h->flags; + h->flags = gotent_flags; + + /* Make a guess as to whether a .plt entry is needed. */ + /* ??? It appears that we won't make it into + adjust_dynamic_symbol for symbols that remain + totally undefined. Copying this check here means + we can create a plt entry for them too. */ + h->root.needs_plt + = (maybe_dynamic && elf64_alpha_want_plt (h)); + } + } + } + + if (need & NEED_DYNREL) + { + if (rel_sec_name == NULL) + { + rel_sec_name = (bfd_elf_string_from_elf_section + (abfd, elf_elfheader(abfd)->e_shstrndx, + elf_section_data(sec)->rel_hdr.sh_name)); + if (rel_sec_name == NULL) + return FALSE; + + BFD_ASSERT (strncmp (rel_sec_name, ".rela", 5) == 0 + && strcmp (bfd_get_section_name (abfd, sec), + rel_sec_name+5) == 0); + } + + /* We need to create the section here now whether we eventually + use it or not so that it gets mapped to an output section by + the linker. If not used, we'll kill it in + size_dynamic_sections. */ + if (sreloc == NULL) + { + sreloc = bfd_get_section_by_name (dynobj, rel_sec_name); + if (sreloc == NULL) + { + flagword flags; + + flags = (SEC_HAS_CONTENTS | SEC_IN_MEMORY + | SEC_LINKER_CREATED | SEC_READONLY); + if (sec->flags & SEC_ALLOC) + flags |= SEC_ALLOC | SEC_LOAD; + sreloc = bfd_make_section_with_flags (dynobj, + rel_sec_name, + flags); + if (sreloc == NULL + || !bfd_set_section_alignment (dynobj, sreloc, 3)) + return FALSE; + } + } + + if (h) + { + /* Since we havn't seen all of the input symbols yet, we + don't know whether we'll actually need a dynamic relocation + entry for this reloc. So make a record of it. Once we + find out if this thing needs dynamic relocation we'll + expand the relocation sections by the appropriate amount. */ + + struct alpha_elf_reloc_entry *rent; + + for (rent = h->reloc_entries; rent; rent = rent->next) + if (rent->rtype == r_type && rent->srel == sreloc) + break; + + if (!rent) + { + amt = sizeof (struct alpha_elf_reloc_entry); + rent = (struct alpha_elf_reloc_entry *) bfd_alloc (abfd, amt); + if (!rent) + return FALSE; + + rent->srel = sreloc; + rent->rtype = r_type; + rent->count = 1; + rent->reltext = (sec->flags & SEC_READONLY) != 0; + + rent->next = h->reloc_entries; + h->reloc_entries = rent; + } + else + rent->count++; + } + else if (info->shared) + { + /* If this is a shared library, and the section is to be + loaded into memory, we need a RELATIVE reloc. */ + sreloc->size += sizeof (Elf64_External_Rela); + if (sec->flags & SEC_READONLY) + info->flags |= DF_TEXTREL; + } + } + } + + return TRUE; +} + +/* Adjust a symbol defined by a dynamic object and referenced by a + regular object. The current definition is in some section of the + dynamic object, but we're not including those sections. We have to + change the definition to something the rest of the link can + understand. */ + +static bfd_boolean +elf64_alpha_adjust_dynamic_symbol (struct bfd_link_info *info, + struct elf_link_hash_entry *h) +{ + bfd *dynobj; + asection *s; + struct alpha_elf_link_hash_entry *ah; + + dynobj = elf_hash_table(info)->dynobj; + ah = (struct alpha_elf_link_hash_entry *)h; + + /* Now that we've seen all of the input symbols, finalize our decision + about whether this symbol should get a .plt entry. Irritatingly, it + is common for folk to leave undefined symbols in shared libraries, + and they still expect lazy binding; accept undefined symbols in lieu + of STT_FUNC. */ + if (alpha_elf_dynamic_symbol_p (h, info) && elf64_alpha_want_plt (ah)) + { + h->needs_plt = TRUE; + + s = bfd_get_section_by_name(dynobj, ".plt"); + if (!s && !elf64_alpha_create_dynamic_sections (dynobj, info)) + return FALSE; + + /* We need one plt entry per got subsection. Delay allocation of + the actual plt entries until size_plt_section, called from + size_dynamic_sections or during relaxation. */ + + return TRUE; + } + else + h->needs_plt = FALSE; + + /* 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->u.weakdef != NULL) + { + BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined + || h->u.weakdef->root.type == bfd_link_hash_defweak); + h->root.u.def.section = h->u.weakdef->root.u.def.section; + h->root.u.def.value = h->u.weakdef->root.u.def.value; + return TRUE; + } + + /* This is a reference to a symbol defined by a dynamic object which + is not a function. The Alpha, since it uses .got entries for all + symbols even in regular objects, does not need the hackery of a + .dynbss section and COPY dynamic relocations. */ + + return TRUE; +} + +/* Symbol versioning can create new symbols, and make our old symbols + indirect to the new ones. Consolidate the got and reloc information + in these situations. */ + +static bfd_boolean +elf64_alpha_merge_ind_symbols (struct alpha_elf_link_hash_entry *hi, + PTR dummy ATTRIBUTE_UNUSED) +{ + struct alpha_elf_link_hash_entry *hs; + + if (hi->root.root.type != bfd_link_hash_indirect) + return TRUE; + hs = hi; + do { + hs = (struct alpha_elf_link_hash_entry *)hs->root.root.u.i.link; + } while (hs->root.root.type == bfd_link_hash_indirect); + + /* Merge the flags. Whee. */ + + hs->flags |= hi->flags; + + /* Merge the .got entries. Cannibalize the old symbol's list in + doing so, since we don't need it anymore. */ + + if (hs->got_entries == NULL) + hs->got_entries = hi->got_entries; + else + { + struct alpha_elf_got_entry *gi, *gs, *gin, *gsh; + + gsh = hs->got_entries; + for (gi = hi->got_entries; gi ; gi = gin) + { + gin = gi->next; + for (gs = gsh; gs ; gs = gs->next) + if (gi->gotobj == gs->gotobj + && gi->reloc_type == gs->reloc_type + && gi->addend == gs->addend) + { + gi->use_count += gs->use_count; + goto got_found; + } + gi->next = hs->got_entries; + hs->got_entries = gi; + got_found:; + } + } + hi->got_entries = NULL; + + /* And similar for the reloc entries. */ + + if (hs->reloc_entries == NULL) + hs->reloc_entries = hi->reloc_entries; + else + { + struct alpha_elf_reloc_entry *ri, *rs, *rin, *rsh; + + rsh = hs->reloc_entries; + for (ri = hi->reloc_entries; ri ; ri = rin) + { + rin = ri->next; + for (rs = rsh; rs ; rs = rs->next) + if (ri->rtype == rs->rtype && ri->srel == rs->srel) + { + rs->count += ri->count; + goto found_reloc; + } + ri->next = hs->reloc_entries; + hs->reloc_entries = ri; + found_reloc:; + } + } + hi->reloc_entries = NULL; + + return TRUE; +} + +/* Is it possible to merge two object file's .got tables? */ + +static bfd_boolean +elf64_alpha_can_merge_gots (bfd *a, bfd *b) +{ + int total = alpha_elf_tdata (a)->total_got_size; + bfd *bsub; + + /* Trivial quick fallout test. */ + if (total + alpha_elf_tdata (b)->total_got_size <= MAX_GOT_SIZE) + return TRUE; + + /* By their nature, local .got entries cannot be merged. */ + if ((total += alpha_elf_tdata (b)->local_got_size) > MAX_GOT_SIZE) + return FALSE; + + /* Failing the common trivial comparison, we must effectively + perform the merge. Not actually performing the merge means that + we don't have to store undo information in case we fail. */ + for (bsub = b; bsub ; bsub = alpha_elf_tdata (bsub)->in_got_link_next) + { + struct alpha_elf_link_hash_entry **hashes = alpha_elf_sym_hashes (bsub); + Elf_Internal_Shdr *symtab_hdr = &elf_tdata (bsub)->symtab_hdr; + int i, n; + + n = NUM_SHDR_ENTRIES (symtab_hdr) - symtab_hdr->sh_info; + for (i = 0; i < n; ++i) + { + struct alpha_elf_got_entry *ae, *be; + struct alpha_elf_link_hash_entry *h; + + h = hashes[i]; + while (h->root.root.type == bfd_link_hash_indirect + || h->root.root.type == bfd_link_hash_warning) + h = (struct alpha_elf_link_hash_entry *)h->root.root.u.i.link; + + for (be = h->got_entries; be ; be = be->next) + { + if (be->use_count == 0) + continue; + if (be->gotobj != b) + continue; + + for (ae = h->got_entries; ae ; ae = ae->next) + if (ae->gotobj == a + && ae->reloc_type == be->reloc_type + && ae->addend == be->addend) + goto global_found; + + total += alpha_got_entry_size (be->reloc_type); + if (total > MAX_GOT_SIZE) + return FALSE; + global_found:; + } + } + } + + return TRUE; +} + +/* Actually merge two .got tables. */ + +static void +elf64_alpha_merge_gots (bfd *a, bfd *b) +{ + int total = alpha_elf_tdata (a)->total_got_size; + bfd *bsub; + + /* Remember local expansion. */ + { + int e = alpha_elf_tdata (b)->local_got_size; + total += e; + alpha_elf_tdata (a)->local_got_size += e; + } + + for (bsub = b; bsub ; bsub = alpha_elf_tdata (bsub)->in_got_link_next) + { + struct alpha_elf_got_entry **local_got_entries; + struct alpha_elf_link_hash_entry **hashes; + Elf_Internal_Shdr *symtab_hdr; + int i, n; + + /* Let the local .got entries know they are part of a new subsegment. */ + local_got_entries = alpha_elf_tdata (bsub)->local_got_entries; + if (local_got_entries) + { + n = elf_tdata (bsub)->symtab_hdr.sh_info; + for (i = 0; i < n; ++i) + { + struct alpha_elf_got_entry *ent; + for (ent = local_got_entries[i]; ent; ent = ent->next) + ent->gotobj = a; + } + } + + /* Merge the global .got entries. */ + hashes = alpha_elf_sym_hashes (bsub); + symtab_hdr = &elf_tdata (bsub)->symtab_hdr; + + n = NUM_SHDR_ENTRIES (symtab_hdr) - symtab_hdr->sh_info; + for (i = 0; i < n; ++i) + { + struct alpha_elf_got_entry *ae, *be, **pbe, **start; + struct alpha_elf_link_hash_entry *h; + + h = hashes[i]; + while (h->root.root.type == bfd_link_hash_indirect + || h->root.root.type == bfd_link_hash_warning) + h = (struct alpha_elf_link_hash_entry *)h->root.root.u.i.link; + + pbe = start = &h->got_entries; + while ((be = *pbe) != NULL) + { + if (be->use_count == 0) + { + *pbe = be->next; + memset (be, 0xa5, sizeof (*be)); + goto kill; + } + if (be->gotobj != b) + goto next; + + for (ae = *start; ae ; ae = ae->next) + if (ae->gotobj == a + && ae->reloc_type == be->reloc_type + && ae->addend == be->addend) + { + ae->flags |= be->flags; + ae->use_count += be->use_count; + *pbe = be->next; + memset (be, 0xa5, sizeof (*be)); + goto kill; + } + be->gotobj = a; + total += alpha_got_entry_size (be->reloc_type); + + next:; + pbe = &be->next; + kill:; + } + } + + alpha_elf_tdata (bsub)->gotobj = a; + } + alpha_elf_tdata (a)->total_got_size = total; + + /* Merge the two in_got chains. */ + { + bfd *next; + + bsub = a; + while ((next = alpha_elf_tdata (bsub)->in_got_link_next) != NULL) + bsub = next; + + alpha_elf_tdata (bsub)->in_got_link_next = b; + } +} + +/* Calculate the offsets for the got entries. */ + +static bfd_boolean +elf64_alpha_calc_got_offsets_for_symbol (struct alpha_elf_link_hash_entry *h, + PTR arg ATTRIBUTE_UNUSED) +{ + struct alpha_elf_got_entry *gotent; + + if (h->root.root.type == bfd_link_hash_warning) + h = (struct alpha_elf_link_hash_entry *) h->root.root.u.i.link; + + for (gotent = h->got_entries; gotent; gotent = gotent->next) + if (gotent->use_count > 0) + { + struct alpha_elf_obj_tdata *td; + bfd_size_type *plge; + + td = alpha_elf_tdata (gotent->gotobj); + plge = &td->got->size; + gotent->got_offset = *plge; + *plge += alpha_got_entry_size (gotent->reloc_type); + } + + return TRUE; +} + +static void +elf64_alpha_calc_got_offsets (struct bfd_link_info *info) +{ + bfd *i, *got_list = alpha_elf_hash_table(info)->got_list; + + /* First, zero out the .got sizes, as we may be recalculating the + .got after optimizing it. */ + for (i = got_list; i ; i = alpha_elf_tdata(i)->got_link_next) + alpha_elf_tdata(i)->got->size = 0; + + /* Next, fill in the offsets for all the global entries. */ + alpha_elf_link_hash_traverse (alpha_elf_hash_table (info), + elf64_alpha_calc_got_offsets_for_symbol, + NULL); + + /* Finally, fill in the offsets for the local entries. */ + for (i = got_list; i ; i = alpha_elf_tdata(i)->got_link_next) + { + bfd_size_type got_offset = alpha_elf_tdata(i)->got->size; + bfd *j; + + for (j = i; j ; j = alpha_elf_tdata(j)->in_got_link_next) + { + struct alpha_elf_got_entry **local_got_entries, *gotent; + int k, n; + + local_got_entries = alpha_elf_tdata(j)->local_got_entries; + if (!local_got_entries) + continue; + + for (k = 0, n = elf_tdata(j)->symtab_hdr.sh_info; k < n; ++k) + for (gotent = local_got_entries[k]; gotent; gotent = gotent->next) + if (gotent->use_count > 0) + { + gotent->got_offset = got_offset; + got_offset += alpha_got_entry_size (gotent->reloc_type); + } + } + + alpha_elf_tdata(i)->got->size = got_offset; + } +} + +/* Constructs the gots. */ + +static bfd_boolean +elf64_alpha_size_got_sections (struct bfd_link_info *info) +{ + bfd *i, *got_list, *cur_got_obj = NULL; + int something_changed = 0; + + got_list = alpha_elf_hash_table (info)->got_list; + + /* On the first time through, pretend we have an existing got list + consisting of all of the input files. */ + if (got_list == NULL) + { + for (i = info->input_bfds; i ; i = i->link_next) + { + bfd *this_got = alpha_elf_tdata (i)->gotobj; + if (this_got == NULL) + continue; + + /* We are assuming no merging has yet occurred. */ + BFD_ASSERT (this_got == i); + + if (alpha_elf_tdata (this_got)->total_got_size > MAX_GOT_SIZE) + { + /* Yikes! A single object file has too many entries. */ + (*_bfd_error_handler) + (_("%B: .got subsegment exceeds 64K (size %d)"), + i, alpha_elf_tdata (this_got)->total_got_size); + return FALSE; + } + + if (got_list == NULL) + got_list = this_got; + else + alpha_elf_tdata(cur_got_obj)->got_link_next = this_got; + cur_got_obj = this_got; + } + + /* Strange degenerate case of no got references. */ + if (got_list == NULL) + return TRUE; + + alpha_elf_hash_table (info)->got_list = got_list; + + /* Force got offsets to be recalculated. */ + something_changed = 1; + } + + cur_got_obj = got_list; + i = alpha_elf_tdata(cur_got_obj)->got_link_next; + while (i != NULL) + { + if (elf64_alpha_can_merge_gots (cur_got_obj, i)) + { + elf64_alpha_merge_gots (cur_got_obj, i); + + alpha_elf_tdata(i)->got->size = 0; + i = alpha_elf_tdata(i)->got_link_next; + alpha_elf_tdata(cur_got_obj)->got_link_next = i; + + something_changed = 1; + } + else + { + cur_got_obj = i; + i = alpha_elf_tdata(i)->got_link_next; + } + } + + /* Once the gots have been merged, fill in the got offsets for + everything therein. */ + if (1 || something_changed) + elf64_alpha_calc_got_offsets (info); + + return TRUE; +} + +static bfd_boolean +elf64_alpha_size_plt_section_1 (struct alpha_elf_link_hash_entry *h, PTR data) +{ + asection *splt = (asection *) data; + struct alpha_elf_got_entry *gotent; + bfd_boolean saw_one = FALSE; + + /* If we didn't need an entry before, we still don't. */ + if (!h->root.needs_plt) + return TRUE; + + /* For each LITERAL got entry still in use, allocate a plt entry. */ + for (gotent = h->got_entries; gotent ; gotent = gotent->next) + if (gotent->reloc_type == R_ALPHA_LITERAL + && gotent->use_count > 0) + { + if (splt->size == 0) + splt->size = PLT_HEADER_SIZE; + gotent->plt_offset = splt->size; + splt->size += PLT_ENTRY_SIZE; + saw_one = TRUE; + } + + /* If there weren't any, there's no longer a need for the PLT entry. */ + if (!saw_one) + h->root.needs_plt = FALSE; + + return TRUE; +} + +/* Called from relax_section to rebuild the PLT in light of + potential changes in the function's status. */ + +static bfd_boolean +elf64_alpha_size_plt_section (struct bfd_link_info *info) +{ + asection *splt, *spltrel, *sgotplt; + unsigned long entries; + bfd *dynobj; + + dynobj = elf_hash_table(info)->dynobj; + splt = bfd_get_section_by_name (dynobj, ".plt"); + if (splt == NULL) + return TRUE; + + splt->size = 0; + + alpha_elf_link_hash_traverse (alpha_elf_hash_table (info), + elf64_alpha_size_plt_section_1, splt); + + /* Every plt entry requires a JMP_SLOT relocation. */ + spltrel = bfd_get_section_by_name (dynobj, ".rela.plt"); + if (splt->size) + { + if (elf64_alpha_use_secureplt) + entries = (splt->size - NEW_PLT_HEADER_SIZE) / NEW_PLT_ENTRY_SIZE; + else + entries = (splt->size - OLD_PLT_HEADER_SIZE) / OLD_PLT_ENTRY_SIZE; + } + else + entries = 0; + spltrel->size = entries * sizeof (Elf64_External_Rela); + + /* When using the secureplt, we need two words somewhere in the data + segment for the dynamic linker to tell us where to go. This is the + entire contents of the .got.plt section. */ + if (elf64_alpha_use_secureplt) + { + sgotplt = bfd_get_section_by_name (dynobj, ".got.plt"); + sgotplt->size = entries ? 16 : 0; + } + + return TRUE; +} + +static bfd_boolean +elf64_alpha_always_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info) +{ + bfd *i; + + if (info->relocatable) + return TRUE; + + /* First, take care of the indirect symbols created by versioning. */ + alpha_elf_link_hash_traverse (alpha_elf_hash_table (info), + elf64_alpha_merge_ind_symbols, + NULL); + + if (!elf64_alpha_size_got_sections (info)) + return FALSE; + + /* Allocate space for all of the .got subsections. */ + i = alpha_elf_hash_table (info)->got_list; + for ( ; i ; i = alpha_elf_tdata(i)->got_link_next) + { + asection *s = alpha_elf_tdata(i)->got; + if (s->size > 0) + { + s->contents = (bfd_byte *) bfd_zalloc (i, s->size); + if (s->contents == NULL) + return FALSE; + } + } + + return TRUE; +} + +/* The number of dynamic relocations required by a static relocation. */ + +static int +alpha_dynamic_entries_for_reloc (int r_type, int dynamic, int shared) +{ + switch (r_type) + { + /* May appear in GOT entries. */ + case R_ALPHA_TLSGD: + return (dynamic ? 2 : shared ? 1 : 0); + case R_ALPHA_TLSLDM: + return shared; + case R_ALPHA_LITERAL: + case R_ALPHA_GOTTPREL: + return dynamic || shared; + case R_ALPHA_GOTDTPREL: + return dynamic; + + /* May appear in data sections. */ + case R_ALPHA_REFLONG: + case R_ALPHA_REFQUAD: + case R_ALPHA_TPREL64: + return dynamic || shared; + + /* Everything else is illegal. We'll issue an error during + relocate_section. */ + default: + return 0; + } +} + +/* Work out the sizes of the dynamic relocation entries. */ + +static bfd_boolean +elf64_alpha_calc_dynrel_sizes (struct alpha_elf_link_hash_entry *h, + struct bfd_link_info *info) +{ + bfd_boolean dynamic; + struct alpha_elf_reloc_entry *relent; + unsigned long entries; + + if (h->root.root.type == bfd_link_hash_warning) + h = (struct alpha_elf_link_hash_entry *) h->root.root.u.i.link; + + /* If the symbol was defined as a common symbol in a regular object + file, and there was no definition in any dynamic object, then the + linker will have allocated space for the symbol in a common + section but the ELF_LINK_HASH_DEF_REGULAR flag will not have been + set. This is done for dynamic symbols in + elf_adjust_dynamic_symbol but this is not done for non-dynamic + symbols, somehow. */ + if (!h->root.def_regular + && h->root.ref_regular + && !h->root.def_dynamic + && (h->root.root.type == bfd_link_hash_defined + || h->root.root.type == bfd_link_hash_defweak) + && !(h->root.root.u.def.section->owner->flags & DYNAMIC)) + h->root.def_regular = 1; + + /* If the symbol is dynamic, we'll need all the relocations in their + natural form. If this is a shared object, and it has been forced + local, we'll need the same number of RELATIVE relocations. */ + dynamic = alpha_elf_dynamic_symbol_p (&h->root, info); + + /* If the symbol is a hidden undefined weak, then we never have any + relocations. Avoid the loop which may want to add RELATIVE relocs + based on info->shared. */ + if (h->root.root.type == bfd_link_hash_undefweak && !dynamic) + return TRUE; + + for (relent = h->reloc_entries; relent; relent = relent->next) + { + entries = alpha_dynamic_entries_for_reloc (relent->rtype, dynamic, + info->shared); + if (entries) + { + relent->srel->size += + entries * sizeof (Elf64_External_Rela) * relent->count; + if (relent->reltext) + info->flags |= DT_TEXTREL; + } + } + + return TRUE; +} + +/* Subroutine of elf64_alpha_size_rela_got_section for doing the + global symbols. */ + +static bfd_boolean +elf64_alpha_size_rela_got_1 (struct alpha_elf_link_hash_entry *h, + struct bfd_link_info *info) +{ + bfd_boolean dynamic; + struct alpha_elf_got_entry *gotent; + unsigned long entries; + + if (h->root.root.type == bfd_link_hash_warning) + h = (struct alpha_elf_link_hash_entry *) h->root.root.u.i.link; + + /* If we're using a plt for this symbol, then all of its relocations + for its got entries go into .rela.plt. */ + if (h->root.needs_plt) + return TRUE; + + /* If the symbol is dynamic, we'll need all the relocations in their + natural form. If this is a shared object, and it has been forced + local, we'll need the same number of RELATIVE relocations. */ + dynamic = alpha_elf_dynamic_symbol_p (&h->root, info); + + /* If the symbol is a hidden undefined weak, then we never have any + relocations. Avoid the loop which may want to add RELATIVE relocs + based on info->shared. */ + if (h->root.root.type == bfd_link_hash_undefweak && !dynamic) + return TRUE; + + entries = 0; + for (gotent = h->got_entries; gotent ; gotent = gotent->next) + if (gotent->use_count > 0) + entries += alpha_dynamic_entries_for_reloc (gotent->reloc_type, + dynamic, info->shared); + + if (entries > 0) + { + bfd *dynobj = elf_hash_table(info)->dynobj; + asection *srel = bfd_get_section_by_name (dynobj, ".rela.got"); + BFD_ASSERT (srel != NULL); + srel->size += sizeof (Elf64_External_Rela) * entries; + } + + return TRUE; +} + +/* Set the sizes of the dynamic relocation sections. */ + +static bfd_boolean +elf64_alpha_size_rela_got_section (struct bfd_link_info *info) +{ + unsigned long entries; + bfd *i, *dynobj; + asection *srel; + + /* Shared libraries often require RELATIVE relocs, and some relocs + require attention for the main application as well. */ + + entries = 0; + for (i = alpha_elf_hash_table(info)->got_list; + i ; i = alpha_elf_tdata(i)->got_link_next) + { + bfd *j; + + for (j = i; j ; j = alpha_elf_tdata(j)->in_got_link_next) + { + struct alpha_elf_got_entry **local_got_entries, *gotent; + int k, n; + + local_got_entries = alpha_elf_tdata(j)->local_got_entries; + if (!local_got_entries) + continue; + + for (k = 0, n = elf_tdata(j)->symtab_hdr.sh_info; k < n; ++k) + for (gotent = local_got_entries[k]; + gotent ; gotent = gotent->next) + if (gotent->use_count > 0) + entries += (alpha_dynamic_entries_for_reloc + (gotent->reloc_type, 0, info->shared)); + } + } + + dynobj = elf_hash_table(info)->dynobj; + srel = bfd_get_section_by_name (dynobj, ".rela.got"); + if (!srel) + { + BFD_ASSERT (entries == 0); + return TRUE; + } + srel->size = sizeof (Elf64_External_Rela) * entries; + + /* Now do the non-local symbols. */ + alpha_elf_link_hash_traverse (alpha_elf_hash_table (info), + elf64_alpha_size_rela_got_1, info); + + return TRUE; +} + +/* Set the sizes of the dynamic sections. */ + +static bfd_boolean +elf64_alpha_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info) +{ + bfd *dynobj; + asection *s; + bfd_boolean relplt; + + 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->executable) + { + s = bfd_get_section_by_name (dynobj, ".interp"); + BFD_ASSERT (s != NULL); + s->size = sizeof ELF_DYNAMIC_INTERPRETER; + s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER; + } + + /* Now that we've seen all of the input files, we can decide which + symbols need dynamic relocation entries and which don't. We've + collected information in check_relocs that we can now apply to + size the dynamic relocation sections. */ + alpha_elf_link_hash_traverse (alpha_elf_hash_table (info), + elf64_alpha_calc_dynrel_sizes, info); + + elf64_alpha_size_rela_got_section (info); + elf64_alpha_size_plt_section (info); + } + /* else we're not dynamic and by definition we don't need such things. */ + + /* The check_relocs and adjust_dynamic_symbol entry points have + determined the sizes of the various dynamic sections. Allocate + memory for them. */ + relplt = FALSE; + for (s = dynobj->sections; s != NULL; s = s->next) + { + const char *name; + + if (!(s->flags & SEC_LINKER_CREATED)) + continue; + + /* It's OK to base decisions on the section name, because none + of the dynobj section names depend upon the input files. */ + name = bfd_get_section_name (dynobj, s); + + if (strncmp (name, ".rela", 5) == 0) + { + if (s->size != 0) + { + if (strcmp (name, ".rela.plt") == 0) + relplt = TRUE; + + /* We use the reloc_count field as a counter if we need + to copy relocs into the output file. */ + s->reloc_count = 0; + } + } + else if (strncmp (name, ".got", 4) != 0 + && strcmp (name, ".plt") != 0 + && strcmp (name, ".dynbss") != 0) + { + /* It's not one of our dynamic sections, so don't allocate space. */ + continue; + } + + if (s->size == 0) + { + /* If we don't need this section, strip it from the output file. + This is to handle .rela.bss and .rela.plt. We must create it + in create_dynamic_sections, because it must be created before + the linker maps input sections to output sections. The + linker does that before adjust_dynamic_symbol is called, and + it is that function which decides whether anything needs to + go into these sections. */ + s->flags |= SEC_EXCLUDE; + } + else if ((s->flags & SEC_HAS_CONTENTS) != 0) + { + /* Allocate memory for the section contents. */ + s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->size); + if (s->contents == NULL) + return FALSE; + } + } + + if (elf_hash_table (info)->dynamic_sections_created) + { + /* Add some entries to the .dynamic section. We fill in the + values later, in elf64_alpha_finish_dynamic_sections, but we + must add the entries now so that we get the correct size for + the .dynamic section. The DT_DEBUG entry is filled in by the + dynamic linker and used by the debugger. */ +#define add_dynamic_entry(TAG, VAL) \ + _bfd_elf_add_dynamic_entry (info, TAG, VAL) + + if (info->executable) + { + if (!add_dynamic_entry (DT_DEBUG, 0)) + return FALSE; + } + + if (relplt) + { + if (!add_dynamic_entry (DT_PLTGOT, 0) + || !add_dynamic_entry (DT_PLTRELSZ, 0) + || !add_dynamic_entry (DT_PLTREL, DT_RELA) + || !add_dynamic_entry (DT_JMPREL, 0)) + return FALSE; + + if (elf64_alpha_use_secureplt + && !add_dynamic_entry (DT_ALPHA_PLTRO, 1)) + return FALSE; + } + + if (!add_dynamic_entry (DT_RELA, 0) + || !add_dynamic_entry (DT_RELASZ, 0) + || !add_dynamic_entry (DT_RELAENT, sizeof (Elf64_External_Rela))) + return FALSE; + + if (info->flags & DF_TEXTREL) + { + if (!add_dynamic_entry (DT_TEXTREL, 0)) + return FALSE; + } + } +#undef add_dynamic_entry + + return TRUE; +} + /* These functions do relaxation for Alpha ELF. Currently I'm only handling what I can do with existing compiler @@ -1172,17 +2856,6 @@ elf64_alpha_info_to_howto (abfd, cache_ptr, dst) related to Alpha in particular. They are by David Wall, then of DEC WRL. */ -#define OP_LDA 0x08 -#define OP_LDAH 0x09 -#define INSN_JSR 0x68004000 -#define INSN_JSR_MASK 0xfc00c000 -#define OP_LDQ 0x29 -#define OP_BR 0x30 -#define OP_BSR 0x34 -#define INSN_UNOP 0x2ffe0000 -#define INSN_ADDQ 0x40000400 -#define INSN_RDUNIQ 0x0000009e - struct alpha_relax_info { bfd *abfd; @@ -1202,29 +2875,10 @@ struct alpha_relax_info unsigned char other; }; -static bfd_boolean elf64_alpha_relax_with_lituse - PARAMS((struct alpha_relax_info *info, bfd_vma symval, - Elf_Internal_Rela *irel)); -static bfd_vma elf64_alpha_relax_opt_call - PARAMS((struct alpha_relax_info *info, bfd_vma symval)); -static bfd_boolean elf64_alpha_relax_got_load - PARAMS((struct alpha_relax_info *info, bfd_vma symval, - Elf_Internal_Rela *irel, unsigned long)); -static bfd_boolean elf64_alpha_relax_gprelhilo - PARAMS((struct alpha_relax_info *info, bfd_vma symval, - Elf_Internal_Rela *irel, bfd_boolean)); -static bfd_boolean elf64_alpha_relax_tls_get_addr - PARAMS((struct alpha_relax_info *info, bfd_vma symval, - Elf_Internal_Rela *irel, bfd_boolean)); -static bfd_boolean elf64_alpha_relax_section - PARAMS((bfd *abfd, asection *sec, struct bfd_link_info *link_info, - bfd_boolean *again)); - static Elf_Internal_Rela * -elf64_alpha_find_reloc_at_ofs (rel, relend, offset, type) - Elf_Internal_Rela *rel, *relend; - bfd_vma offset; - int type; +elf64_alpha_find_reloc_at_ofs (Elf_Internal_Rela *rel, + Elf_Internal_Rela *relend, + bfd_vma offset, int type) { while (rel < relend) { @@ -1237,10 +2891,187 @@ elf64_alpha_find_reloc_at_ofs (rel, relend, offset, type) } static bfd_boolean -elf64_alpha_relax_with_lituse (info, symval, irel) - struct alpha_relax_info *info; - bfd_vma symval; - Elf_Internal_Rela *irel; +elf64_alpha_relax_got_load (struct alpha_relax_info *info, bfd_vma symval, + Elf_Internal_Rela *irel, unsigned long r_type) +{ + unsigned int insn; + bfd_signed_vma disp; + + /* Get the instruction. */ + insn = bfd_get_32 (info->abfd, info->contents + irel->r_offset); + + if (insn >> 26 != OP_LDQ) + { + reloc_howto_type *howto = elf64_alpha_howto_table + r_type; + ((*_bfd_error_handler) + ("%B: %A+0x%lx: warning: %s relocation against unexpected insn", + info->abfd, info->sec, + (unsigned long) irel->r_offset, howto->name)); + return TRUE; + } + + /* Can't relax dynamic symbols. */ + if (alpha_elf_dynamic_symbol_p (&info->h->root, info->link_info)) + return TRUE; + + /* Can't use local-exec relocations in shared libraries. */ + if (r_type == R_ALPHA_GOTTPREL && info->link_info->shared) + return TRUE; + + if (r_type == R_ALPHA_LITERAL) + { + /* Look for nice constant addresses. This includes the not-uncommon + special case of 0 for undefweak symbols. */ + if ((info->h && info->h->root.root.type == bfd_link_hash_undefweak) + || (!info->link_info->shared + && (symval >= (bfd_vma)-0x8000 || symval < 0x8000))) + { + disp = 0; + insn = (OP_LDA << 26) | (insn & (31 << 21)) | (31 << 16); + insn |= (symval & 0xffff); + r_type = R_ALPHA_NONE; + } + else + { + disp = symval - info->gp; + insn = (OP_LDA << 26) | (insn & 0x03ff0000); + r_type = R_ALPHA_GPREL16; + } + } + else + { + bfd_vma dtp_base, tp_base; + + BFD_ASSERT (elf_hash_table (info->link_info)->tls_sec != NULL); + dtp_base = alpha_get_dtprel_base (info->link_info); + tp_base = alpha_get_tprel_base (info->link_info); + disp = symval - (r_type == R_ALPHA_GOTDTPREL ? dtp_base : tp_base); + + insn = (OP_LDA << 26) | (insn & (31 << 21)) | (31 << 16); + + switch (r_type) + { + case R_ALPHA_GOTDTPREL: + r_type = R_ALPHA_DTPREL16; + break; + case R_ALPHA_GOTTPREL: + r_type = R_ALPHA_TPREL16; + break; + default: + BFD_ASSERT (0); + return FALSE; + } + } + + if (disp < -0x8000 || disp >= 0x8000) + return TRUE; + + bfd_put_32 (info->abfd, (bfd_vma) insn, info->contents + irel->r_offset); + info->changed_contents = TRUE; + + /* Reduce the use count on this got entry by one, possibly + eliminating it. */ + if (--info->gotent->use_count == 0) + { + int sz = alpha_got_entry_size (r_type); + alpha_elf_tdata (info->gotobj)->total_got_size -= sz; + if (!info->h) + alpha_elf_tdata (info->gotobj)->local_got_size -= sz; + } + + /* Smash the existing GOT relocation for its 16-bit immediate pair. */ + irel->r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info), r_type); + info->changed_relocs = TRUE; + + /* ??? Search forward through this basic block looking for insns + that use the target register. Stop after an insn modifying the + register is seen, or after a branch or call. + + Any such memory load insn may be substituted by a load directly + off the GP. This allows the memory load insn to be issued before + the calculated GP register would otherwise be ready. + + Any such jsr insn can be replaced by a bsr if it is in range. + + This would mean that we'd have to _add_ relocations, the pain of + which gives one pause. */ + + return TRUE; +} + +static bfd_vma +elf64_alpha_relax_opt_call (struct alpha_relax_info *info, bfd_vma symval) +{ + /* If the function has the same gp, and we can identify that the + function does not use its function pointer, we can eliminate the + address load. */ + + /* If the symbol is marked NOPV, we are being told the function never + needs its procedure value. */ + if ((info->other & STO_ALPHA_STD_GPLOAD) == STO_ALPHA_NOPV) + return symval; + + /* If the symbol is marked STD_GP, we are being told the function does + a normal ldgp in the first two words. */ + else if ((info->other & STO_ALPHA_STD_GPLOAD) == STO_ALPHA_STD_GPLOAD) + ; + + /* Otherwise, we may be able to identify a GP load in the first two + words, which we can then skip. */ + else + { + Elf_Internal_Rela *tsec_relocs, *tsec_relend, *tsec_free, *gpdisp; + bfd_vma ofs; + + /* Load the relocations from the section that the target symbol is in. */ + if (info->sec == info->tsec) + { + tsec_relocs = info->relocs; + tsec_relend = info->relend; + tsec_free = NULL; + } + else + { + tsec_relocs = (_bfd_elf_link_read_relocs + (info->abfd, info->tsec, (PTR) NULL, + (Elf_Internal_Rela *) NULL, + info->link_info->keep_memory)); + if (tsec_relocs == NULL) + return 0; + tsec_relend = tsec_relocs + info->tsec->reloc_count; + tsec_free = (info->link_info->keep_memory ? NULL : tsec_relocs); + } + + /* Recover the symbol's offset within the section. */ + ofs = (symval - info->tsec->output_section->vma + - info->tsec->output_offset); + + /* Look for a GPDISP reloc. */ + gpdisp = (elf64_alpha_find_reloc_at_ofs + (tsec_relocs, tsec_relend, ofs, R_ALPHA_GPDISP)); + + if (!gpdisp || gpdisp->r_addend != 4) + { + if (tsec_free) + free (tsec_free); + return 0; + } + if (tsec_free) + free (tsec_free); + } + + /* We've now determined that we can skip an initial gp load. Verify + that the call and the target use the same gp. */ + if (info->link_info->hash->creator != info->tsec->owner->xvec + || info->gotobj != alpha_elf_tdata (info->tsec->owner)->gotobj) + return 0; + + return symval + 8; +} + +static bfd_boolean +elf64_alpha_relax_with_lituse (struct alpha_relax_info *info, + bfd_vma symval, Elf_Internal_Rela *irel) { Elf_Internal_Rela *urel, *irelend = info->relend; int flags, count, i; @@ -1255,8 +3086,8 @@ elf64_alpha_relax_with_lituse (info, symval, irel) if (lit_insn >> 26 != OP_LDQ) { ((*_bfd_error_handler) - ("%s: %s+0x%lx: warning: LITERAL relocation against unexpected insn", - bfd_archive_filename (info->abfd), info->sec->name, + ("%B: %A+0x%lx: warning: LITERAL relocation against unexpected insn", + info->abfd, info->sec, (unsigned long) irel->r_offset)); return TRUE; } @@ -1270,7 +3101,7 @@ elf64_alpha_relax_with_lituse (info, symval, irel) { if (ELF64_R_TYPE (urel->r_info) != R_ALPHA_LITUSE) break; - if (urel->r_addend <= 3) + if (urel->r_addend <= 6) flags |= 1 << urel->r_addend; } @@ -1300,9 +3131,7 @@ elf64_alpha_relax_with_lituse (info, symval, irel) /* Extract the displacement from the instruction, sign-extending it if necessary, then test whether it is within 16 or 32 bits displacement from GP. */ - insn_disp = insn & 0x0000ffff; - if (insn_disp & 0x8000) - insn_disp |= ~0xffff; /* Negative: sign-extend. */ + insn_disp = ((insn & 0xffff) ^ 0x8000) - 0x8000; xdisp = disp + insn_disp; fits16 = (xdisp >= - (bfd_signed_vma) 0x8000 && xdisp < 0x8000); @@ -1367,10 +3196,24 @@ elf64_alpha_relax_with_lituse (info, symval, irel) case LITUSE_ALPHA_JSR: case LITUSE_ALPHA_TLSGD: case LITUSE_ALPHA_TLSLDM: + case LITUSE_ALPHA_JSRDIRECT: { bfd_vma optdest, org; bfd_signed_vma odisp; + /* For undefined weak symbols, we're mostly interested in getting + rid of the got entry whenever possible, so optimize this to a + use of the zero register. */ + if (info->h && info->h->root.root.type == bfd_link_hash_undefweak) + { + insn |= 31 << 16; + bfd_put_32 (info->abfd, (bfd_vma) insn, + info->contents + urel->r_offset); + + info->changed_contents = TRUE; + break; + } + /* If not zero, place to jump without needing pv. */ optdest = elf64_alpha_relax_opt_call (info, symval); org = (info->sec->output_section->vma @@ -1474,245 +3317,16 @@ elf64_alpha_relax_with_lituse (info, symval, irel) info->contents + irel->r_offset); info->changed_contents = TRUE; } - } - return TRUE; -} - -static bfd_vma -elf64_alpha_relax_opt_call (info, symval) - struct alpha_relax_info *info; - bfd_vma symval; -{ - /* If the function has the same gp, and we can identify that the - function does not use its function pointer, we can eliminate the - address load. */ - - /* If the symbol is marked NOPV, we are being told the function never - needs its procedure value. */ - if ((info->other & STO_ALPHA_STD_GPLOAD) == STO_ALPHA_NOPV) - return symval; - - /* If the symbol is marked STD_GP, we are being told the function does - a normal ldgp in the first two words. */ - else if ((info->other & STO_ALPHA_STD_GPLOAD) == STO_ALPHA_STD_GPLOAD) - ; - - /* Otherwise, we may be able to identify a GP load in the first two - words, which we can then skip. */ - else - { - Elf_Internal_Rela *tsec_relocs, *tsec_relend, *tsec_free, *gpdisp; - bfd_vma ofs; - - /* Load the relocations from the section that the target symbol is in. */ - if (info->sec == info->tsec) - { - tsec_relocs = info->relocs; - tsec_relend = info->relend; - tsec_free = NULL; - } - else - { - tsec_relocs = (_bfd_elf_link_read_relocs - (info->abfd, info->tsec, (PTR) NULL, - (Elf_Internal_Rela *) NULL, - info->link_info->keep_memory)); - if (tsec_relocs == NULL) - return 0; - tsec_relend = tsec_relocs + info->tsec->reloc_count; - tsec_free = (info->link_info->keep_memory ? NULL : tsec_relocs); - } - - /* Recover the symbol's offset within the section. */ - ofs = (symval - info->tsec->output_section->vma - - info->tsec->output_offset); - - /* Look for a GPDISP reloc. */ - gpdisp = (elf64_alpha_find_reloc_at_ofs - (tsec_relocs, tsec_relend, ofs, R_ALPHA_GPDISP)); - - if (!gpdisp || gpdisp->r_addend != 4) - { - if (tsec_free) - free (tsec_free); - return 0; - } - if (tsec_free) - free (tsec_free); - } - - /* We've now determined that we can skip an initial gp load. Verify - that the call and the target use the same gp. */ - if (info->link_info->hash->creator != info->tsec->owner->xvec - || info->gotobj != alpha_elf_tdata (info->tsec->owner)->gotobj) - return 0; - - return symval + 8; -} - -static bfd_boolean -elf64_alpha_relax_got_load (info, symval, irel, r_type) - struct alpha_relax_info *info; - bfd_vma symval; - Elf_Internal_Rela *irel; - unsigned long r_type; -{ - unsigned int insn; - bfd_signed_vma disp; - - /* Get the instruction. */ - insn = bfd_get_32 (info->abfd, info->contents + irel->r_offset); - - if (insn >> 26 != OP_LDQ) - { - reloc_howto_type *howto = elf64_alpha_howto_table + r_type; - ((*_bfd_error_handler) - ("%s: %s+0x%lx: warning: %s relocation against unexpected insn", - bfd_archive_filename (info->abfd), info->sec->name, - (unsigned long) irel->r_offset, howto->name)); return TRUE; } - - /* Can't relax dynamic symbols. */ - if (alpha_elf_dynamic_symbol_p (&info->h->root, info->link_info)) - return TRUE; - - /* Can't use local-exec relocations in shared libraries. */ - if (r_type == R_ALPHA_GOTTPREL && info->link_info->shared) - return TRUE; - - if (r_type == R_ALPHA_LITERAL) - disp = symval - info->gp; else - { - bfd_vma dtp_base, tp_base; - - BFD_ASSERT (elf_hash_table (info->link_info)->tls_sec != NULL); - dtp_base = alpha_get_dtprel_base (info->link_info); - tp_base = alpha_get_tprel_base (info->link_info); - disp = symval - (r_type == R_ALPHA_GOTDTPREL ? dtp_base : tp_base); - } - - if (disp < -0x8000 || disp >= 0x8000) - return TRUE; - - /* Exchange LDQ for LDA. In the case of the TLS relocs, we're loading - a constant, so force the base register to be $31. */ - if (r_type == R_ALPHA_LITERAL) - insn = (OP_LDA << 26) | (insn & 0x03ff0000); - else - insn = (OP_LDA << 26) | (insn & (31 << 21)) | (31 << 16); - bfd_put_32 (info->abfd, (bfd_vma) insn, info->contents + irel->r_offset); - info->changed_contents = TRUE; - - /* Reduce the use count on this got entry by one, possibly - eliminating it. */ - if (--info->gotent->use_count == 0) - { - int sz = alpha_got_entry_size (r_type); - alpha_elf_tdata (info->gotobj)->total_got_size -= sz; - if (!info->h) - alpha_elf_tdata (info->gotobj)->local_got_size -= sz; - } - - /* Smash the existing GOT relocation for its 16-bit immediate pair. */ - switch (r_type) - { - case R_ALPHA_LITERAL: - r_type = R_ALPHA_GPREL16; - break; - case R_ALPHA_GOTDTPREL: - r_type = R_ALPHA_DTPREL16; - break; - case R_ALPHA_GOTTPREL: - r_type = R_ALPHA_TPREL16; - break; - default: - BFD_ASSERT (0); - return FALSE; - } - - irel->r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info), r_type); - info->changed_relocs = TRUE; - - /* ??? Search forward through this basic block looking for insns - that use the target register. Stop after an insn modifying the - register is seen, or after a branch or call. - - Any such memory load insn may be substituted by a load directly - off the GP. This allows the memory load insn to be issued before - the calculated GP register would otherwise be ready. - - Any such jsr insn can be replaced by a bsr if it is in range. - - This would mean that we'd have to _add_ relocations, the pain of - which gives one pause. */ - - return TRUE; + return elf64_alpha_relax_got_load (info, symval, irel, R_ALPHA_LITERAL); } static bfd_boolean -elf64_alpha_relax_gprelhilo (info, symval, irel, hi) - struct alpha_relax_info *info; - bfd_vma symval; - Elf_Internal_Rela *irel; - bfd_boolean hi; -{ - unsigned int insn; - bfd_signed_vma disp; - bfd_byte *pos = info->contents + irel->r_offset; - - /* ??? This assumes that the compiler doesn't render - - array[i] - as - ldah t, array(gp) !gprelhigh - s8addl i, t, t - ldq r, array(t) !gprellow - - which would indeed be the most efficient way to implement this. */ - - return TRUE; - - disp = symval - info->gp; - if (disp < -0x8000 || disp >= 0x8000) - return TRUE; - - if (hi) - { - /* Nop out the high instruction. */ - - bfd_put_32 (info->abfd, (bfd_vma) INSN_UNOP, pos); - info->changed_contents = TRUE; - - irel->r_info = ELF64_R_INFO (0, R_ALPHA_NONE); - irel->r_addend = 0; - info->changed_relocs = TRUE; - } - else - { - /* Adjust the low instruction to reference GP directly. */ - - insn = bfd_get_32 (info->abfd, pos); - insn = (insn & 0xffe00000) | (29 << 16); - bfd_put_32 (info->abfd, (bfd_vma) insn, pos); - info->changed_contents = TRUE; - - irel->r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info), - R_ALPHA_GPREL16); - info->changed_relocs = TRUE; - } - - return TRUE; -} - -static bfd_boolean -elf64_alpha_relax_tls_get_addr (info, symval, irel, is_gd) - struct alpha_relax_info *info; - bfd_vma symval; - Elf_Internal_Rela *irel; - bfd_boolean is_gd; +elf64_alpha_relax_tls_get_addr (struct alpha_relax_info *info, bfd_vma symval, + Elf_Internal_Rela *irel, bfd_boolean is_gd) { bfd_byte *pos[5]; unsigned int insn; @@ -1806,23 +3420,23 @@ elf64_alpha_relax_tls_get_addr (info, symval, irel, is_gd) /* Change - lda $16,x($gp) !tlsgd!1 - ldq $27,__tls_get_addr($gp) !literal!1 - jsr $26,($27)__tls_get_addr !lituse_tlsgd!1 - ldah $29,0($26) !gpdisp!2 - lda $29,0($29) !gpdisp!2 + lda $16,x($gp) !tlsgd!1 + ldq $27,__tls_get_addr($gp) !literal!1 + jsr $26,($27),__tls_get_addr !lituse_tlsgd!1 + ldah $29,0($26) !gpdisp!2 + lda $29,0($29) !gpdisp!2 to - ldq $16,x($gp) !gottprel + ldq $16,x($gp) !gottprel unop call_pal rduniq addq $16,$0,$0 unop or the first pair to - lda $16,x($gp) !tprel + lda $16,x($gp) !tprel unop or - ldah $16,x($gp) !tprelhi - lda $16,x($16) !tprello + ldah $16,x($gp) !tprelhi + lda $16,x($16) !tprello as appropriate. */ @@ -1952,11 +3566,8 @@ elf64_alpha_relax_tls_get_addr (info, symval, irel, is_gd) } static bfd_boolean -elf64_alpha_relax_section (abfd, sec, link_info, again) - bfd *abfd; - asection *sec; - struct bfd_link_info *link_info; - bfd_boolean *again; +elf64_alpha_relax_section (bfd *abfd, asection *sec, + struct bfd_link_info *link_info, bfd_boolean *again) { Elf_Internal_Shdr *symtab_hdr; Elf_Internal_Rela *internal_relocs; @@ -1969,15 +3580,11 @@ elf64_alpha_relax_section (abfd, sec, link_info, again) *again = FALSE; if (link_info->relocatable - || (sec->flags & SEC_RELOC) == 0 + || ((sec->flags & (SEC_CODE | SEC_RELOC | SEC_ALLOC)) + != (SEC_CODE | SEC_RELOC | SEC_ALLOC)) || 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; local_got_entries = alpha_elf_tdata(abfd)->local_got_entries; @@ -2012,12 +3619,7 @@ elf64_alpha_relax_section (abfd, sec, link_info, again) info.contents = elf_section_data (sec)->this_hdr.contents; else { - info.contents = (bfd_byte *) bfd_malloc (sec->_raw_size); - if (info.contents == NULL) - goto error_return; - - if (! bfd_get_section_contents (abfd, sec, info.contents, - (file_ptr) 0, sec->_raw_size)) + if (!bfd_malloc_and_get_section (abfd, sec, &info.contents)) goto error_return; } @@ -2113,13 +3715,17 @@ elf64_alpha_relax_section (abfd, sec, link_info, again) h = (struct alpha_elf_link_hash_entry *)h->root.root.u.i.link; /* If the symbol is undefined, we can't do anything with it. */ - if (h->root.root.type == bfd_link_hash_undefweak - || h->root.root.type == bfd_link_hash_undefined) + if (h->root.root.type == bfd_link_hash_undefined) continue; - /* If the symbol isn't defined in the current module, again - we can't do anything. */ - if (!(h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)) + /* If the symbol isn't defined in the current module, + again we can't do anything. */ + if (h->root.root.type == bfd_link_hash_undefweak) + { + info.tsec = bfd_abs_section_ptr; + symval = 0; + } + else if (!h->root.def_regular) { /* Except for TLSGD relocs, which can sometimes be relaxed to GOTTPREL relocs. */ @@ -2171,13 +3777,6 @@ elf64_alpha_relax_section (abfd, sec, link_info, again) } break; - case R_ALPHA_GPRELHIGH: - case R_ALPHA_GPRELLOW: - if (!elf64_alpha_relax_gprelhilo (&info, symval, irel, - r_type == R_ALPHA_GPRELHIGH)) - goto error_return; - break; - case R_ALPHA_GOTDTPREL: case R_ALPHA_GOTTPREL: BFD_ASSERT(info.gotent != NULL); @@ -2251,1892 +3850,13 @@ elf64_alpha_relax_section (abfd, sec, link_info, again) return FALSE; } -/* PLT/GOT Stuff */ -#define PLT_HEADER_SIZE 32 -#define PLT_HEADER_WORD1 (bfd_vma) 0xc3600000 /* br $27,.+4 */ -#define PLT_HEADER_WORD2 (bfd_vma) 0xa77b000c /* ldq $27,12($27) */ -#define PLT_HEADER_WORD3 (bfd_vma) 0x47ff041f /* nop */ -#define PLT_HEADER_WORD4 (bfd_vma) 0x6b7b0000 /* jmp $27,($27) */ - -#define PLT_ENTRY_SIZE 12 -#define PLT_ENTRY_WORD1 0xc3800000 /* br $28, plt0 */ -#define PLT_ENTRY_WORD2 0 -#define PLT_ENTRY_WORD3 0 - -#define MAX_GOT_SIZE (64*1024) - -#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so" - -/* Handle an Alpha specific section when reading an object file. This - is called when elfcode.h finds a section with an unknown type. - FIXME: We need to handle the SHF_ALPHA_GPREL flag, but I'm not sure - how to. */ - -static bfd_boolean -elf64_alpha_section_from_shdr (abfd, hdr, name) - bfd *abfd; - Elf_Internal_Shdr *hdr; - const char *name; -{ - asection *newsect; - - /* 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_ALPHA_DEBUG: - if (strcmp (name, ".mdebug") != 0) - return FALSE; - break; - default: - return FALSE; - } - - if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name)) - return FALSE; - newsect = hdr->bfd_section; - - if (hdr->sh_type == SHT_ALPHA_DEBUG) - { - if (! bfd_set_section_flags (abfd, newsect, - (bfd_get_section_flags (abfd, newsect) - | SEC_DEBUGGING))) - return FALSE; - } - - return TRUE; -} - -/* Convert Alpha specific section flags to bfd internal section flags. */ - -static bfd_boolean -elf64_alpha_section_flags (flags, hdr) - flagword *flags; - Elf_Internal_Shdr *hdr; -{ - if (hdr->sh_flags & SHF_ALPHA_GPREL) - *flags |= SEC_SMALL_DATA; - - return TRUE; -} - -/* Set the correct type for an Alpha ELF section. We do this by the - section name, which is a hack, but ought to work. */ - -static bfd_boolean -elf64_alpha_fake_sections (abfd, hdr, sec) - bfd *abfd; - Elf_Internal_Shdr *hdr; - asection *sec; -{ - register const char *name; - - name = bfd_get_section_name (abfd, sec); - - if (strcmp (name, ".mdebug") == 0) - { - hdr->sh_type = SHT_ALPHA_DEBUG; - /* In a shared object on Irix 5.3, the .mdebug section has an - entsize of 0. FIXME: Does this matter? */ - if ((abfd->flags & DYNAMIC) != 0 ) - hdr->sh_entsize = 0; - else - hdr->sh_entsize = 1; - } - else if ((sec->flags & SEC_SMALL_DATA) - || strcmp (name, ".sdata") == 0 - || strcmp (name, ".sbss") == 0 - || strcmp (name, ".lit4") == 0 - || strcmp (name, ".lit8") == 0) - hdr->sh_flags |= SHF_ALPHA_GPREL; - - return TRUE; -} - -/* Hook called by the linker routine which adds symbols from an object - file. We use it to put .comm items in .sbss, and not .bss. */ - -static bfd_boolean -elf64_alpha_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) - bfd *abfd; - struct bfd_link_info *info; - Elf_Internal_Sym *sym; - const char **namep ATTRIBUTE_UNUSED; - flagword *flagsp ATTRIBUTE_UNUSED; - asection **secp; - bfd_vma *valp; -{ - if (sym->st_shndx == SHN_COMMON - && !info->relocatable - && sym->st_size <= elf_gp_size (abfd)) - { - /* Common symbols less than or equal to -G nn bytes are - automatically put into .sbss. */ - - asection *scomm = bfd_get_section_by_name (abfd, ".scommon"); - - if (scomm == NULL) - { - scomm = bfd_make_section (abfd, ".scommon"); - if (scomm == NULL - || !bfd_set_section_flags (abfd, scomm, (SEC_ALLOC - | SEC_IS_COMMON - | SEC_LINKER_CREATED))) - return FALSE; - } - - *secp = scomm; - *valp = sym->st_size; - } - - return TRUE; -} - -/* Create the .got section. */ - -static bfd_boolean -elf64_alpha_create_got_section(abfd, info) - bfd *abfd; - struct bfd_link_info *info ATTRIBUTE_UNUSED; -{ - asection *s; - - if ((s = bfd_get_section_by_name (abfd, ".got"))) - { - /* Check for a non-linker created .got? */ - if (alpha_elf_tdata (abfd)->got == NULL) - alpha_elf_tdata (abfd)->got = s; - return TRUE; - } - - s = bfd_make_section (abfd, ".got"); - if (s == NULL - || !bfd_set_section_flags (abfd, s, (SEC_ALLOC | SEC_LOAD - | SEC_HAS_CONTENTS - | SEC_IN_MEMORY - | SEC_LINKER_CREATED)) - || !bfd_set_section_alignment (abfd, s, 3)) - return FALSE; - - alpha_elf_tdata (abfd)->got = s; - - return TRUE; -} - -/* Create all the dynamic sections. */ - -static bfd_boolean -elf64_alpha_create_dynamic_sections (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - asection *s; - struct elf_link_hash_entry *h; - struct bfd_link_hash_entry *bh; - - /* We need to create .plt, .rela.plt, .got, and .rela.got sections. */ - - s = bfd_make_section (abfd, ".plt"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, (SEC_ALLOC | SEC_LOAD - | SEC_HAS_CONTENTS - | SEC_IN_MEMORY - | SEC_LINKER_CREATED - | SEC_CODE)) - || ! bfd_set_section_alignment (abfd, s, 3)) - return FALSE; - - /* Define the symbol _PROCEDURE_LINKAGE_TABLE_ at the start of the - .plt section. */ - bh = NULL; - if (! (_bfd_generic_link_add_one_symbol - (info, abfd, "_PROCEDURE_LINKAGE_TABLE_", BSF_GLOBAL, s, - (bfd_vma) 0, (const char *) NULL, FALSE, - get_elf_backend_data (abfd)->collect, &bh))) - return FALSE; - h = (struct elf_link_hash_entry *) bh; - h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; - h->type = STT_OBJECT; - - if (info->shared - && ! bfd_elf_link_record_dynamic_symbol (info, h)) - return FALSE; - - s = bfd_make_section (abfd, ".rela.plt"); - if (s == NULL - || !bfd_set_section_flags (abfd, s, (SEC_ALLOC | SEC_LOAD - | SEC_HAS_CONTENTS - | SEC_IN_MEMORY - | SEC_LINKER_CREATED - | SEC_READONLY)) - || ! bfd_set_section_alignment (abfd, s, 3)) - return FALSE; - - /* We may or may not have created a .got section for this object, but - we definitely havn't done the rest of the work. */ - - if (!elf64_alpha_create_got_section (abfd, info)) - return FALSE; - - s = bfd_make_section(abfd, ".rela.got"); - if (s == NULL - || !bfd_set_section_flags (abfd, s, (SEC_ALLOC | SEC_LOAD - | SEC_HAS_CONTENTS - | SEC_IN_MEMORY - | SEC_LINKER_CREATED - | SEC_READONLY)) - || !bfd_set_section_alignment (abfd, s, 3)) - return FALSE; - - /* Define the symbol _GLOBAL_OFFSET_TABLE_ at the start of the - dynobj's .got section. 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. */ - bh = NULL; - if (!(_bfd_generic_link_add_one_symbol - (info, abfd, "_GLOBAL_OFFSET_TABLE_", BSF_GLOBAL, - alpha_elf_tdata(abfd)->got, (bfd_vma) 0, (const char *) NULL, - FALSE, get_elf_backend_data (abfd)->collect, &bh))) - return FALSE; - h = (struct elf_link_hash_entry *) bh; - h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; - h->type = STT_OBJECT; - - if (info->shared - && ! bfd_elf_link_record_dynamic_symbol (info, h)) - return FALSE; - - elf_hash_table (info)->hgot = h; - - return TRUE; -} - -/* Read ECOFF debugging information from a .mdebug section into a - ecoff_debug_info structure. */ - -static bfd_boolean -elf64_alpha_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 (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)) - 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 \ - { \ - bfd_size_type amt = (bfd_size_type) size * symhdr->count; \ - debug->ptr = (type) bfd_malloc (amt); \ - if (debug->ptr == NULL) \ - goto error_return; \ - if (bfd_seek (abfd, (file_ptr) symhdr->offset, SEEK_SET) != 0 \ - || bfd_bread (debug->ptr, amt, abfd) != amt) \ - goto error_return; \ - } - - READ (line, cbLineOffset, cbLine, sizeof (unsigned char), unsigned char *); - READ (external_dnr, cbDnOffset, idnMax, swap->external_dnr_size, PTR); - READ (external_pdr, cbPdOffset, ipdMax, swap->external_pdr_size, PTR); - READ (external_sym, cbSymOffset, isymMax, swap->external_sym_size, PTR); - READ (external_opt, cbOptOffset, ioptMax, swap->external_opt_size, PTR); - READ (external_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; -} - -/* Alpha ELF local labels start with '$'. */ - -static bfd_boolean -elf64_alpha_is_local_label_name (abfd, name) - bfd *abfd ATTRIBUTE_UNUSED; - const char *name; -{ - return name[0] == '$'; -} - -/* Alpha ELF follows MIPS ELF in using a special find_nearest_line - routine in order to handle the ECOFF debugging information. We - still call this mips_elf_find_line because of the slot - find_line_info in elf_obj_tdata is declared that way. */ - -struct mips_elf_find_line -{ - struct ecoff_debug_info d; - struct ecoff_find_line i; -}; - -static bfd_boolean -elf64_alpha_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_dwarf2_find_nearest_line (abfd, section, symbols, offset, - filename_ptr, functionname_ptr, - line_ptr, 0, - &elf_tdata (abfd)->dwarf2_find_line_info)) - 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, alpha_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; - bfd_size_type amt = sizeof (struct mips_elf_find_line); - - fi = (struct mips_elf_find_line *) bfd_zalloc (abfd, amt); - if (fi == NULL) - { - msec->flags = origflags; - return FALSE; - } - - if (!elf64_alpha_read_ecoff_info (abfd, msec, &fi->d)) - { - msec->flags = origflags; - return FALSE; - } - - /* Swap in the FDR information. */ - amt = fi->d.symbolic_header.ifdMax * sizeof (struct fdr); - fi->d.fdr = (struct fdr *) bfd_alloc (abfd, amt); - 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); -} - -/* Structure used to pass information to alpha_elf_output_extsym. */ - -struct extsym_info -{ - bfd *abfd; - struct bfd_link_info *info; - struct ecoff_debug_info *debug; - const struct ecoff_debug_swap *swap; - bfd_boolean failed; -}; - -static bfd_boolean -elf64_alpha_output_extsym (h, data) - struct alpha_elf_link_hash_entry *h; - PTR data; -{ - struct extsym_info *einfo = (struct extsym_info *) data; - bfd_boolean strip; - asection *sec, *output_section; - - if (h->root.root.type == bfd_link_hash_warning) - h = (struct alpha_elf_link_hash_entry *) h->root.root.u.i.link; - - if (h->root.indx == -2) - strip = FALSE; - else if (((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - || (h->root.elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0) - && (h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0 - && (h->root.elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0) - 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 (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 = bfd_get_section_by_name (einfo->abfd, ".plt"); - 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 (! 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; -} - -/* Search for and possibly create a got entry. */ - -static struct alpha_elf_got_entry * -get_got_entry (abfd, h, r_type, r_symndx, r_addend) - bfd *abfd; - struct alpha_elf_link_hash_entry *h; - unsigned long r_type, r_symndx; - bfd_vma r_addend; -{ - struct alpha_elf_got_entry *gotent; - struct alpha_elf_got_entry **slot; - - if (h) - slot = &h->got_entries; - else - { - /* This is a local .got entry -- record for merge. */ - - struct alpha_elf_got_entry **local_got_entries; - - local_got_entries = alpha_elf_tdata(abfd)->local_got_entries; - if (!local_got_entries) - { - bfd_size_type size; - Elf_Internal_Shdr *symtab_hdr; - - symtab_hdr = &elf_tdata(abfd)->symtab_hdr; - size = symtab_hdr->sh_info; - size *= sizeof (struct alpha_elf_got_entry *); - - local_got_entries - = (struct alpha_elf_got_entry **) bfd_zalloc (abfd, size); - if (!local_got_entries) - return NULL; - - alpha_elf_tdata (abfd)->local_got_entries = local_got_entries; - } - - slot = &local_got_entries[r_symndx]; - } - - for (gotent = *slot; gotent ; gotent = gotent->next) - if (gotent->gotobj == abfd - && gotent->reloc_type == r_type - && gotent->addend == r_addend) - break; - - if (!gotent) - { - int entry_size; - bfd_size_type amt; - - amt = sizeof (struct alpha_elf_got_entry); - gotent = (struct alpha_elf_got_entry *) bfd_alloc (abfd, amt); - if (!gotent) - return NULL; - - gotent->gotobj = abfd; - gotent->addend = r_addend; - gotent->got_offset = -1; - gotent->use_count = 1; - gotent->reloc_type = r_type; - gotent->reloc_done = 0; - gotent->reloc_xlated = 0; - - gotent->next = *slot; - *slot = gotent; - - entry_size = alpha_got_entry_size (r_type); - alpha_elf_tdata (abfd)->total_got_size += entry_size; - if (!h) - alpha_elf_tdata(abfd)->local_got_size += entry_size; - } - else - gotent->use_count += 1; - - return gotent; -} - -/* Handle dynamic relocations when doing an Alpha ELF link. */ - -static bfd_boolean -elf64_alpha_check_relocs (abfd, info, sec, relocs) - bfd *abfd; - struct bfd_link_info *info; - asection *sec; - const Elf_Internal_Rela *relocs; -{ - bfd *dynobj; - asection *sreloc; - const char *rel_sec_name; - Elf_Internal_Shdr *symtab_hdr; - struct alpha_elf_link_hash_entry **sym_hashes; - const Elf_Internal_Rela *rel, *relend; - bfd_boolean got_created; - bfd_size_type amt; - - if (info->relocatable) - return TRUE; - - dynobj = elf_hash_table(info)->dynobj; - if (dynobj == NULL) - elf_hash_table(info)->dynobj = dynobj = abfd; - - sreloc = NULL; - rel_sec_name = NULL; - symtab_hdr = &elf_tdata(abfd)->symtab_hdr; - sym_hashes = alpha_elf_sym_hashes(abfd); - got_created = FALSE; - - relend = relocs + sec->reloc_count; - for (rel = relocs; rel < relend; ++rel) - { - enum { - NEED_GOT = 1, - NEED_GOT_ENTRY = 2, - NEED_DYNREL = 4 - }; - - unsigned long r_symndx, r_type; - struct alpha_elf_link_hash_entry *h; - unsigned int gotent_flags; - bfd_boolean maybe_dynamic; - unsigned int need; - bfd_vma addend; - - r_symndx = ELF64_R_SYM (rel->r_info); - if (r_symndx < symtab_hdr->sh_info) - h = NULL; - else - { - h = sym_hashes[r_symndx - symtab_hdr->sh_info]; - - while (h->root.root.type == bfd_link_hash_indirect - || h->root.root.type == bfd_link_hash_warning) - h = (struct alpha_elf_link_hash_entry *)h->root.root.u.i.link; - - h->root.elf_link_hash_flags |= ELF_LINK_HASH_REF_REGULAR; - } - - /* We can only get preliminary data on whether a symbol is - locally or externally defined, as not all of the input files - have yet been processed. Do something with what we know, as - this may help reduce memory usage and processing time later. */ - maybe_dynamic = FALSE; - if (h && ((info->shared - && (!info->symbolic || info->unresolved_syms_in_shared_libs == RM_IGNORE)) - || ! (h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) - || h->root.root.type == bfd_link_hash_defweak)) - maybe_dynamic = TRUE; - - need = 0; - gotent_flags = 0; - r_type = ELF64_R_TYPE (rel->r_info); - addend = rel->r_addend; - - switch (r_type) - { - case R_ALPHA_LITERAL: - need = NEED_GOT | NEED_GOT_ENTRY; - - /* Remember how this literal is used from its LITUSEs. - This will be important when it comes to decide if we can - create a .plt entry for a function symbol. */ - while (++rel < relend && ELF64_R_TYPE (rel->r_info) == R_ALPHA_LITUSE) - if (rel->r_addend >= 1 && rel->r_addend <= 5) - gotent_flags |= 1 << rel->r_addend; - --rel; - - /* No LITUSEs -- presumably the address is used somehow. */ - if (gotent_flags == 0) - gotent_flags = ALPHA_ELF_LINK_HASH_LU_ADDR; - break; - - case R_ALPHA_GPDISP: - case R_ALPHA_GPREL16: - case R_ALPHA_GPREL32: - case R_ALPHA_GPRELHIGH: - case R_ALPHA_GPRELLOW: - case R_ALPHA_BRSGP: - need = NEED_GOT; - break; - - case R_ALPHA_REFLONG: - case R_ALPHA_REFQUAD: - if ((info->shared && (sec->flags & SEC_ALLOC)) || maybe_dynamic) - need = NEED_DYNREL; - break; - - case R_ALPHA_TLSLDM: - /* The symbol for a TLSLDM reloc is ignored. Collapse the - reloc to the 0 symbol so that they all match. */ - r_symndx = 0; - h = 0; - maybe_dynamic = FALSE; - /* FALLTHRU */ - - case R_ALPHA_TLSGD: - case R_ALPHA_GOTDTPREL: - need = NEED_GOT | NEED_GOT_ENTRY; - break; - - case R_ALPHA_GOTTPREL: - need = NEED_GOT | NEED_GOT_ENTRY; - gotent_flags = ALPHA_ELF_LINK_HASH_TLS_IE; - if (info->shared) - info->flags |= DF_STATIC_TLS; - break; - - case R_ALPHA_TPREL64: - if (info->shared || maybe_dynamic) - need = NEED_DYNREL; - if (info->shared) - info->flags |= DF_STATIC_TLS; - break; - } - - if (need & NEED_GOT) - { - if (!got_created) - { - if (!elf64_alpha_create_got_section (abfd, info)) - return FALSE; - - /* Make sure the object's gotobj is set to itself so - that we default to every object with its own .got. - We'll merge .gots later once we've collected each - object's info. */ - alpha_elf_tdata(abfd)->gotobj = abfd; - - got_created = 1; - } - } - - if (need & NEED_GOT_ENTRY) - { - struct alpha_elf_got_entry *gotent; - - gotent = get_got_entry (abfd, h, r_type, r_symndx, addend); - if (!gotent) - return FALSE; - - if (gotent_flags) - { - gotent->flags |= gotent_flags; - if (h) - { - gotent_flags |= h->flags; - h->flags = gotent_flags; - - /* Make a guess as to whether a .plt entry is needed. */ - if ((gotent_flags & ALPHA_ELF_LINK_HASH_LU_FUNC) - && !(gotent_flags & ~ALPHA_ELF_LINK_HASH_LU_FUNC)) - h->root.elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; - else - h->root.elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; - } - } - } - - if (need & NEED_DYNREL) - { - if (rel_sec_name == NULL) - { - rel_sec_name = (bfd_elf_string_from_elf_section - (abfd, elf_elfheader(abfd)->e_shstrndx, - elf_section_data(sec)->rel_hdr.sh_name)); - if (rel_sec_name == NULL) - return FALSE; - - BFD_ASSERT (strncmp (rel_sec_name, ".rela", 5) == 0 - && strcmp (bfd_get_section_name (abfd, sec), - rel_sec_name+5) == 0); - } - - /* We need to create the section here now whether we eventually - use it or not so that it gets mapped to an output section by - the linker. If not used, we'll kill it in - size_dynamic_sections. */ - if (sreloc == NULL) - { - sreloc = bfd_get_section_by_name (dynobj, rel_sec_name); - if (sreloc == NULL) - { - flagword flags; - - sreloc = bfd_make_section (dynobj, rel_sec_name); - flags = (SEC_HAS_CONTENTS | SEC_IN_MEMORY - | SEC_LINKER_CREATED | SEC_READONLY); - if (sec->flags & SEC_ALLOC) - flags |= SEC_ALLOC | SEC_LOAD; - if (sreloc == NULL - || !bfd_set_section_flags (dynobj, sreloc, flags) - || !bfd_set_section_alignment (dynobj, sreloc, 3)) - return FALSE; - } - } - - if (h) - { - /* Since we havn't seen all of the input symbols yet, we - don't know whether we'll actually need a dynamic relocation - entry for this reloc. So make a record of it. Once we - find out if this thing needs dynamic relocation we'll - expand the relocation sections by the appropriate amount. */ - - struct alpha_elf_reloc_entry *rent; - - for (rent = h->reloc_entries; rent; rent = rent->next) - if (rent->rtype == r_type && rent->srel == sreloc) - break; - - if (!rent) - { - amt = sizeof (struct alpha_elf_reloc_entry); - rent = (struct alpha_elf_reloc_entry *) bfd_alloc (abfd, amt); - if (!rent) - return FALSE; - - rent->srel = sreloc; - rent->rtype = r_type; - rent->count = 1; - rent->reltext = ((sec->flags & (SEC_READONLY | SEC_ALLOC)) - == (SEC_READONLY | SEC_ALLOC)); - - rent->next = h->reloc_entries; - h->reloc_entries = rent; - } - else - rent->count++; - } - else if (info->shared) - { - /* If this is a shared library, and the section is to be - loaded into memory, we need a RELATIVE reloc. */ - sreloc->_raw_size += sizeof (Elf64_External_Rela); - if ((sec->flags & (SEC_READONLY | SEC_ALLOC)) - == (SEC_READONLY | SEC_ALLOC)) - info->flags |= DF_TEXTREL; - } - } - } - - return TRUE; -} - -/* Adjust a symbol defined by a dynamic object and referenced by a - regular object. The current definition is in some section of the - dynamic object, but we're not including those sections. We have to - change the definition to something the rest of the link can - understand. */ - -static bfd_boolean -elf64_alpha_adjust_dynamic_symbol (info, h) - struct bfd_link_info *info; - struct elf_link_hash_entry *h; -{ - bfd *dynobj; - asection *s; - struct alpha_elf_link_hash_entry *ah; - - dynobj = elf_hash_table(info)->dynobj; - ah = (struct alpha_elf_link_hash_entry *)h; - - /* Now that we've seen all of the input symbols, finalize our decision - about whether this symbol should get a .plt entry. */ - - if (alpha_elf_dynamic_symbol_p (h, info) - && ((h->type == STT_FUNC - && !(ah->flags & ALPHA_ELF_LINK_HASH_LU_ADDR)) - || (h->type == STT_NOTYPE - && (ah->flags & ALPHA_ELF_LINK_HASH_LU_FUNC) - && !(ah->flags & ~ALPHA_ELF_LINK_HASH_LU_FUNC))) - /* Don't prevent otherwise valid programs from linking by attempting - to create a new .got entry somewhere. A Correct Solution would be - to add a new .got section to a new object file and let it be merged - somewhere later. But for now don't bother. */ - && ah->got_entries) - { - h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; - - s = bfd_get_section_by_name(dynobj, ".plt"); - if (!s && !elf64_alpha_create_dynamic_sections (dynobj, info)) - return FALSE; - - /* The first bit of the .plt is reserved. */ - if (s->_raw_size == 0) - s->_raw_size = PLT_HEADER_SIZE; - - h->plt.offset = s->_raw_size; - s->_raw_size += PLT_ENTRY_SIZE; - - /* If this symbol is not defined in a regular file, and we are not - generating a shared library, then set the symbol to the location - in the .plt. This is required to make function pointers compare - equal between the normal executable and the shared library. */ - if (! info->shared - && h->root.type != bfd_link_hash_defweak) - { - ah->plt_old_section = h->root.u.def.section; - ah->plt_old_value = h->root.u.def.value; - ah->flags |= ALPHA_ELF_LINK_HASH_PLT_LOC; - h->root.u.def.section = s; - h->root.u.def.value = h->plt.offset; - } - - /* We also need a JMP_SLOT entry in the .rela.plt section. */ - s = bfd_get_section_by_name (dynobj, ".rela.plt"); - BFD_ASSERT (s != NULL); - s->_raw_size += sizeof (Elf64_External_Rela); - - return TRUE; - } - else - h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; - - /* 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. The Alpha, since it uses .got entries for all - symbols even in regular objects, does not need the hackery of a - .dynbss section and COPY dynamic relocations. */ - - return TRUE; -} - -/* Symbol versioning can create new symbols, and make our old symbols - indirect to the new ones. Consolidate the got and reloc information - in these situations. */ - -static bfd_boolean -elf64_alpha_merge_ind_symbols (hi, dummy) - struct alpha_elf_link_hash_entry *hi; - PTR dummy ATTRIBUTE_UNUSED; -{ - struct alpha_elf_link_hash_entry *hs; - - if (hi->root.root.type != bfd_link_hash_indirect) - return TRUE; - hs = hi; - do { - hs = (struct alpha_elf_link_hash_entry *)hs->root.root.u.i.link; - } while (hs->root.root.type == bfd_link_hash_indirect); - - /* Merge the flags. Whee. */ - - hs->flags |= hi->flags; - - /* Merge the .got entries. Cannibalize the old symbol's list in - doing so, since we don't need it anymore. */ - - if (hs->got_entries == NULL) - hs->got_entries = hi->got_entries; - else - { - struct alpha_elf_got_entry *gi, *gs, *gin, *gsh; - - gsh = hs->got_entries; - for (gi = hi->got_entries; gi ; gi = gin) - { - gin = gi->next; - for (gs = gsh; gs ; gs = gs->next) - if (gi->gotobj == gs->gotobj - && gi->reloc_type == gs->reloc_type - && gi->addend == gs->addend) - { - gi->use_count += gs->use_count; - goto got_found; - } - gi->next = hs->got_entries; - hs->got_entries = gi; - got_found:; - } - } - hi->got_entries = NULL; - - /* And similar for the reloc entries. */ - - if (hs->reloc_entries == NULL) - hs->reloc_entries = hi->reloc_entries; - else - { - struct alpha_elf_reloc_entry *ri, *rs, *rin, *rsh; - - rsh = hs->reloc_entries; - for (ri = hi->reloc_entries; ri ; ri = rin) - { - rin = ri->next; - for (rs = rsh; rs ; rs = rs->next) - if (ri->rtype == rs->rtype && ri->srel == rs->srel) - { - rs->count += ri->count; - goto found_reloc; - } - ri->next = hs->reloc_entries; - hs->reloc_entries = ri; - found_reloc:; - } - } - hi->reloc_entries = NULL; - - return TRUE; -} - -/* Is it possible to merge two object file's .got tables? */ - -static bfd_boolean -elf64_alpha_can_merge_gots (a, b) - bfd *a, *b; -{ - int total = alpha_elf_tdata (a)->total_got_size; - bfd *bsub; - - /* Trivial quick fallout test. */ - if (total + alpha_elf_tdata (b)->total_got_size <= MAX_GOT_SIZE) - return TRUE; - - /* By their nature, local .got entries cannot be merged. */ - if ((total += alpha_elf_tdata (b)->local_got_size) > MAX_GOT_SIZE) - return FALSE; - - /* Failing the common trivial comparison, we must effectively - perform the merge. Not actually performing the merge means that - we don't have to store undo information in case we fail. */ - for (bsub = b; bsub ; bsub = alpha_elf_tdata (bsub)->in_got_link_next) - { - struct alpha_elf_link_hash_entry **hashes = alpha_elf_sym_hashes (bsub); - Elf_Internal_Shdr *symtab_hdr = &elf_tdata (bsub)->symtab_hdr; - int i, n; - - n = NUM_SHDR_ENTRIES (symtab_hdr) - symtab_hdr->sh_info; - for (i = 0; i < n; ++i) - { - struct alpha_elf_got_entry *ae, *be; - struct alpha_elf_link_hash_entry *h; - - h = hashes[i]; - while (h->root.root.type == bfd_link_hash_indirect - || h->root.root.type == bfd_link_hash_warning) - h = (struct alpha_elf_link_hash_entry *)h->root.root.u.i.link; - - for (be = h->got_entries; be ; be = be->next) - { - if (be->use_count == 0) - continue; - if (be->gotobj != b) - continue; - - for (ae = h->got_entries; ae ; ae = ae->next) - if (ae->gotobj == a - && ae->reloc_type == be->reloc_type - && ae->addend == be->addend) - goto global_found; - - total += alpha_got_entry_size (be->reloc_type); - if (total > MAX_GOT_SIZE) - return FALSE; - global_found:; - } - } - } - - return TRUE; -} - -/* Actually merge two .got tables. */ - -static void -elf64_alpha_merge_gots (a, b) - bfd *a, *b; -{ - int total = alpha_elf_tdata (a)->total_got_size; - bfd *bsub; - - /* Remember local expansion. */ - { - int e = alpha_elf_tdata (b)->local_got_size; - total += e; - alpha_elf_tdata (a)->local_got_size += e; - } - - for (bsub = b; bsub ; bsub = alpha_elf_tdata (bsub)->in_got_link_next) - { - struct alpha_elf_got_entry **local_got_entries; - struct alpha_elf_link_hash_entry **hashes; - Elf_Internal_Shdr *symtab_hdr; - int i, n; - - /* Let the local .got entries know they are part of a new subsegment. */ - local_got_entries = alpha_elf_tdata (bsub)->local_got_entries; - if (local_got_entries) - { - n = elf_tdata (bsub)->symtab_hdr.sh_info; - for (i = 0; i < n; ++i) - { - struct alpha_elf_got_entry *ent; - for (ent = local_got_entries[i]; ent; ent = ent->next) - ent->gotobj = a; - } - } - - /* Merge the global .got entries. */ - hashes = alpha_elf_sym_hashes (bsub); - symtab_hdr = &elf_tdata (bsub)->symtab_hdr; - - n = NUM_SHDR_ENTRIES (symtab_hdr) - symtab_hdr->sh_info; - for (i = 0; i < n; ++i) - { - struct alpha_elf_got_entry *ae, *be, **pbe, **start; - struct alpha_elf_link_hash_entry *h; - - h = hashes[i]; - while (h->root.root.type == bfd_link_hash_indirect - || h->root.root.type == bfd_link_hash_warning) - h = (struct alpha_elf_link_hash_entry *)h->root.root.u.i.link; - - start = &h->got_entries; - for (pbe = start, be = *start; be ; pbe = &be->next, be = be->next) - { - if (be->use_count == 0) - { - *pbe = be->next; - continue; - } - if (be->gotobj != b) - continue; - - for (ae = *start; ae ; ae = ae->next) - if (ae->gotobj == a - && ae->reloc_type == be->reloc_type - && ae->addend == be->addend) - { - ae->flags |= be->flags; - ae->use_count += be->use_count; - *pbe = be->next; - goto global_found; - } - be->gotobj = a; - total += alpha_got_entry_size (be->reloc_type); - - global_found:; - } - } - - alpha_elf_tdata (bsub)->gotobj = a; - } - alpha_elf_tdata (a)->total_got_size = total; - - /* Merge the two in_got chains. */ - { - bfd *next; - - bsub = a; - while ((next = alpha_elf_tdata (bsub)->in_got_link_next) != NULL) - bsub = next; - - alpha_elf_tdata (bsub)->in_got_link_next = b; - } -} - -/* Calculate the offsets for the got entries. */ - -static bfd_boolean -elf64_alpha_calc_got_offsets_for_symbol (h, arg) - struct alpha_elf_link_hash_entry *h; - PTR arg ATTRIBUTE_UNUSED; -{ - bfd_boolean result = TRUE; - struct alpha_elf_got_entry *gotent; - - if (h->root.root.type == bfd_link_hash_warning) - h = (struct alpha_elf_link_hash_entry *) h->root.root.u.i.link; - - for (gotent = h->got_entries; gotent; gotent = gotent->next) - if (gotent->use_count > 0) - { - struct alpha_elf_obj_tdata *td; - bfd_size_type *plge; - - td = alpha_elf_tdata (gotent->gotobj); - if (td == NULL) - { - _bfd_error_handler (_("Symbol %s has no GOT subsection for offset 0x%x"), - h->root.root.root.string, gotent->got_offset); - result = FALSE; - continue; - } - plge = &td->got->_raw_size; - gotent->got_offset = *plge; - *plge += alpha_got_entry_size (gotent->reloc_type); - } - - return result; -} - -static void -elf64_alpha_calc_got_offsets (info) - struct bfd_link_info *info; -{ - bfd *i, *got_list = alpha_elf_hash_table(info)->got_list; - - /* First, zero out the .got sizes, as we may be recalculating the - .got after optimizing it. */ - for (i = got_list; i ; i = alpha_elf_tdata(i)->got_link_next) - alpha_elf_tdata(i)->got->_raw_size = 0; - - /* Next, fill in the offsets for all the global entries. */ - alpha_elf_link_hash_traverse (alpha_elf_hash_table (info), - elf64_alpha_calc_got_offsets_for_symbol, - NULL); - - /* Finally, fill in the offsets for the local entries. */ - for (i = got_list; i ; i = alpha_elf_tdata(i)->got_link_next) - { - bfd_size_type got_offset = alpha_elf_tdata(i)->got->_raw_size; - bfd *j; - - for (j = i; j ; j = alpha_elf_tdata(j)->in_got_link_next) - { - struct alpha_elf_got_entry **local_got_entries, *gotent; - int k, n; - - local_got_entries = alpha_elf_tdata(j)->local_got_entries; - if (!local_got_entries) - continue; - - for (k = 0, n = elf_tdata(j)->symtab_hdr.sh_info; k < n; ++k) - for (gotent = local_got_entries[k]; gotent; gotent = gotent->next) - if (gotent->use_count > 0) - { - gotent->got_offset = got_offset; - got_offset += alpha_got_entry_size (gotent->reloc_type); - } - } - - alpha_elf_tdata(i)->got->_raw_size = got_offset; - alpha_elf_tdata(i)->got->_cooked_size = got_offset; - } -} - -/* Constructs the gots. */ - -static bfd_boolean -elf64_alpha_size_got_sections (info) - struct bfd_link_info *info; -{ - bfd *i, *got_list, *cur_got_obj = NULL; - int something_changed = 0; - - got_list = alpha_elf_hash_table (info)->got_list; - - /* On the first time through, pretend we have an existing got list - consisting of all of the input files. */ - if (got_list == NULL) - { - for (i = info->input_bfds; i ; i = i->link_next) - { - bfd *this_got = alpha_elf_tdata (i)->gotobj; - if (this_got == NULL) - continue; - - /* We are assuming no merging has yet occurred. */ - BFD_ASSERT (this_got == i); - - if (alpha_elf_tdata (this_got)->total_got_size > MAX_GOT_SIZE) - { - /* Yikes! A single object file has too many entries. */ - (*_bfd_error_handler) - (_("%s: .got subsegment exceeds 64K (size %d)"), - bfd_archive_filename (i), - alpha_elf_tdata (this_got)->total_got_size); - return FALSE; - } - - if (got_list == NULL) - got_list = this_got; - else - alpha_elf_tdata(cur_got_obj)->got_link_next = this_got; - cur_got_obj = this_got; - } - - /* Strange degenerate case of no got references. */ - if (got_list == NULL) - return TRUE; - - alpha_elf_hash_table (info)->got_list = got_list; - - /* Force got offsets to be recalculated. */ - something_changed = 1; - } - - cur_got_obj = got_list; - i = alpha_elf_tdata(cur_got_obj)->got_link_next; - while (i != NULL) - { - if (elf64_alpha_can_merge_gots (cur_got_obj, i)) - { - elf64_alpha_merge_gots (cur_got_obj, i); - i = alpha_elf_tdata(i)->got_link_next; - alpha_elf_tdata(cur_got_obj)->got_link_next = i; - something_changed = 1; - } - else - { - cur_got_obj = i; - i = alpha_elf_tdata(i)->got_link_next; - } - } - - /* Once the gots have been merged, fill in the got offsets for - everything therein. */ - if (1 || something_changed) - elf64_alpha_calc_got_offsets (info); - - return TRUE; -} - -/* Called from relax_section to rebuild the PLT in light of - potential changes in the function's status. */ - -static bfd_boolean -elf64_alpha_size_plt_section (info) - struct bfd_link_info *info; -{ - asection *splt, *spltrel; - unsigned long entries; - bfd *dynobj; - - dynobj = elf_hash_table(info)->dynobj; - splt = bfd_get_section_by_name(dynobj, ".plt"); - if (splt == NULL) - return TRUE; - - splt->_raw_size = 0; - - alpha_elf_link_hash_traverse (alpha_elf_hash_table (info), - elf64_alpha_size_plt_section_1, splt); - - splt->_cooked_size = splt->_raw_size; - - /* Every plt entry requires a JMP_SLOT relocation. */ - spltrel = bfd_get_section_by_name (dynobj, ".rela.plt"); - if (splt->_raw_size) - entries = (splt->_raw_size - PLT_HEADER_SIZE) / PLT_ENTRY_SIZE; - else - entries = 0; - spltrel->_raw_size = entries * sizeof (Elf64_External_Rela); - spltrel->_cooked_size = spltrel->_raw_size; - - return TRUE; -} - -static bfd_boolean -elf64_alpha_size_plt_section_1 (h, data) - struct alpha_elf_link_hash_entry *h; - PTR data; -{ - asection *splt = (asection *) data; - struct alpha_elf_got_entry *gotent; - - /* If we didn't need an entry before, we still don't. */ - if (!(h->root.elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT)) - return TRUE; - - /* There must still be a LITERAL got entry for the function. */ - for (gotent = h->got_entries; gotent ; gotent = gotent->next) - if (gotent->reloc_type == R_ALPHA_LITERAL - && gotent->use_count > 0) - break; - - /* If there is, reset the PLT offset. If not, there's no longer - a need for the PLT entry. */ - if (gotent) - { - if (splt->_raw_size == 0) - splt->_raw_size = PLT_HEADER_SIZE; - h->root.plt.offset = splt->_raw_size; - splt->_raw_size += PLT_ENTRY_SIZE; - } - else - { - h->root.elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; - h->root.plt.offset = -1; - - /* Undo the definition frobbing begun in adjust_dynamic_symbol. */ - if (h->flags & ALPHA_ELF_LINK_HASH_PLT_LOC) - { - h->root.root.u.def.section = h->plt_old_section; - h->root.root.u.def.value = h->plt_old_value; - h->flags &= ~ALPHA_ELF_LINK_HASH_PLT_LOC; - } - } - - return TRUE; -} - -static bfd_boolean -elf64_alpha_always_size_sections (output_bfd, info) - bfd *output_bfd ATTRIBUTE_UNUSED; - struct bfd_link_info *info; -{ - bfd *i; - - if (info->relocatable) - return TRUE; - - /* First, take care of the indirect symbols created by versioning. */ - alpha_elf_link_hash_traverse (alpha_elf_hash_table (info), - elf64_alpha_merge_ind_symbols, - NULL); - - if (!elf64_alpha_size_got_sections (info)) - return FALSE; - - /* Allocate space for all of the .got subsections. */ - i = alpha_elf_hash_table (info)->got_list; - for ( ; i ; i = alpha_elf_tdata(i)->got_link_next) - { - asection *s = alpha_elf_tdata(i)->got; - if (s->_raw_size > 0) - { - s->contents = (bfd_byte *) bfd_zalloc (i, s->_raw_size); - if (s->contents == NULL) - return FALSE; - } - } - - return TRUE; -} - -/* The number of dynamic relocations required by a static relocation. */ - -static int -alpha_dynamic_entries_for_reloc (r_type, dynamic, shared) - int r_type, dynamic, shared; -{ - switch (r_type) - { - /* May appear in GOT entries. */ - case R_ALPHA_TLSGD: - return (dynamic ? 2 : shared ? 1 : 0); - case R_ALPHA_TLSLDM: - return shared; - case R_ALPHA_LITERAL: - case R_ALPHA_GOTTPREL: - return dynamic || shared; - case R_ALPHA_GOTDTPREL: - return dynamic; - - /* May appear in data sections. */ - case R_ALPHA_REFLONG: - case R_ALPHA_REFQUAD: - case R_ALPHA_TPREL64: - return dynamic || shared; - - /* Everything else is illegal. We'll issue an error during - relocate_section. */ - default: - return 0; - } -} - -/* Work out the sizes of the dynamic relocation entries. */ - -static bfd_boolean -elf64_alpha_calc_dynrel_sizes (h, info) - struct alpha_elf_link_hash_entry *h; - struct bfd_link_info *info; -{ - bfd_boolean dynamic; - struct alpha_elf_reloc_entry *relent; - unsigned long entries; - - if (h->root.root.type == bfd_link_hash_warning) - h = (struct alpha_elf_link_hash_entry *) h->root.root.u.i.link; - - /* If the symbol was defined as a common symbol in a regular object - file, and there was no definition in any dynamic object, then the - linker will have allocated space for the symbol in a common - section but the ELF_LINK_HASH_DEF_REGULAR flag will not have been - set. This is done for dynamic symbols in - elf_adjust_dynamic_symbol but this is not done for non-dynamic - symbols, somehow. */ - if (((h->root.elf_link_hash_flags - & (ELF_LINK_HASH_DEF_REGULAR - | ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_DEF_DYNAMIC)) - == ELF_LINK_HASH_REF_REGULAR) - && (h->root.root.type == bfd_link_hash_defined - || h->root.root.type == bfd_link_hash_defweak) - && !(h->root.root.u.def.section->owner->flags & DYNAMIC)) - h->root.elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; - - /* If the symbol is dynamic, we'll need all the relocations in their - natural form. If this is a shared object, and it has been forced - local, we'll need the same number of RELATIVE relocations. */ - - dynamic = alpha_elf_dynamic_symbol_p (&h->root, info); - - for (relent = h->reloc_entries; relent; relent = relent->next) - { - entries = alpha_dynamic_entries_for_reloc (relent->rtype, dynamic, - info->shared); - if (entries) - { - relent->srel->_raw_size += - entries * sizeof (Elf64_External_Rela) * relent->count; - if (relent->reltext) - info->flags |= DT_TEXTREL; - } - } - - return TRUE; -} - -/* Set the sizes of the dynamic relocation sections. */ - -static bfd_boolean -elf64_alpha_size_rela_got_section (info) - struct bfd_link_info *info; -{ - unsigned long entries; - bfd *i, *dynobj; - asection *srel; - - /* Shared libraries often require RELATIVE relocs, and some relocs - require attention for the main application as well. */ - - entries = 0; - for (i = alpha_elf_hash_table(info)->got_list; - i ; i = alpha_elf_tdata(i)->got_link_next) - { - bfd *j; - - for (j = i; j ; j = alpha_elf_tdata(j)->in_got_link_next) - { - struct alpha_elf_got_entry **local_got_entries, *gotent; - int k, n; - - local_got_entries = alpha_elf_tdata(j)->local_got_entries; - if (!local_got_entries) - continue; - - for (k = 0, n = elf_tdata(j)->symtab_hdr.sh_info; k < n; ++k) - for (gotent = local_got_entries[k]; - gotent ; gotent = gotent->next) - if (gotent->use_count > 0) - entries += (alpha_dynamic_entries_for_reloc - (gotent->reloc_type, 0, info->shared)); - } - } - - dynobj = elf_hash_table(info)->dynobj; - srel = bfd_get_section_by_name (dynobj, ".rela.got"); - if (!srel) - { - BFD_ASSERT (entries == 0); - return TRUE; - } - srel->_raw_size = sizeof (Elf64_External_Rela) * entries; - - /* Now do the non-local symbols. */ - alpha_elf_link_hash_traverse (alpha_elf_hash_table (info), - elf64_alpha_size_rela_got_1, info); - - srel->_cooked_size = srel->_raw_size; - - return TRUE; -} - -/* Subroutine of elf64_alpha_size_rela_got_section for doing the - global symbols. */ - -static bfd_boolean -elf64_alpha_size_rela_got_1 (h, info) - struct alpha_elf_link_hash_entry *h; - struct bfd_link_info *info; -{ - bfd_boolean dynamic; - struct alpha_elf_got_entry *gotent; - unsigned long entries; - - if (h->root.root.type == bfd_link_hash_warning) - h = (struct alpha_elf_link_hash_entry *) h->root.root.u.i.link; - - /* If the symbol is dynamic, we'll need all the relocations in their - natural form. If this is a shared object, and it has been forced - local, we'll need the same number of RELATIVE relocations. */ - - dynamic = alpha_elf_dynamic_symbol_p (&h->root, info); - - entries = 0; - for (gotent = h->got_entries; gotent ; gotent = gotent->next) - if (gotent->use_count > 0) - entries += alpha_dynamic_entries_for_reloc (gotent->reloc_type, - dynamic, info->shared); - - /* If we are using a .plt entry, subtract one, as the first - reference uses a .rela.plt entry instead. */ - if (h->root.plt.offset != MINUS_ONE) - entries--; - - if (entries > 0) - { - bfd *dynobj = elf_hash_table(info)->dynobj; - asection *srel = bfd_get_section_by_name (dynobj, ".rela.got"); - BFD_ASSERT (srel != NULL); - srel->_raw_size += sizeof (Elf64_External_Rela) * entries; - } - - return TRUE; -} - -/* Set the sizes of the dynamic sections. */ - -static bfd_boolean -elf64_alpha_size_dynamic_sections (output_bfd, info) - bfd *output_bfd ATTRIBUTE_UNUSED; - struct bfd_link_info *info; -{ - bfd *dynobj; - asection *s; - bfd_boolean relplt; - - 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->executable) - { - s = bfd_get_section_by_name (dynobj, ".interp"); - BFD_ASSERT (s != NULL); - s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER; - s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER; - } - - /* Now that we've seen all of the input files, we can decide which - symbols need dynamic relocation entries and which don't. We've - collected information in check_relocs that we can now apply to - size the dynamic relocation sections. */ - alpha_elf_link_hash_traverse (alpha_elf_hash_table (info), - elf64_alpha_calc_dynrel_sizes, info); - - elf64_alpha_size_rela_got_section (info); - } - /* else we're not dynamic and by definition we don't need such things. */ - - /* The check_relocs and adjust_dynamic_symbol entry points have - determined the sizes of the various dynamic sections. Allocate - memory for them. */ - relplt = FALSE; - for (s = dynobj->sections; s != NULL; s = s->next) - { - const char *name; - bfd_boolean strip; - - if (!(s->flags & SEC_LINKER_CREATED)) - continue; - - /* It's OK to base decisions on the section name, because none - of the dynobj section names depend upon the input files. */ - name = bfd_get_section_name (dynobj, s); - - /* If we don't need this section, strip it from the output file. - This is to handle .rela.bss and .rela.plt. We must create it - in create_dynamic_sections, because it must be created before - the linker maps input sections to output sections. The - linker does that before adjust_dynamic_symbol is called, and - it is that function which decides whether anything needs to - go into these sections. */ - - strip = FALSE; - - if (strncmp (name, ".rela", 5) == 0) - { - strip = (s->_raw_size == 0); - - if (!strip) - { - if (strcmp(name, ".rela.plt") == 0) - relplt = TRUE; - - /* We use the reloc_count field as a counter if we need - to copy relocs into the output file. */ - s->reloc_count = 0; - } - } - else if (strcmp (name, ".plt") != 0) - { - /* It's not one of our dynamic sections, so don't allocate space. */ - continue; - } - - if (strip) - _bfd_strip_section_from_output (info, s); - else - { - /* Allocate memory for the section contents. */ - s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size); - if (s->contents == NULL && s->_raw_size != 0) - return FALSE; - } - } - - if (elf_hash_table (info)->dynamic_sections_created) - { - /* Add some entries to the .dynamic section. We fill in the - values later, in elf64_alpha_finish_dynamic_sections, but we - must add the entries now so that we get the correct size for - the .dynamic section. The DT_DEBUG entry is filled in by the - dynamic linker and used by the debugger. */ -#define add_dynamic_entry(TAG, VAL) \ - _bfd_elf_add_dynamic_entry (info, TAG, VAL) - - if (info->executable) - { - if (!add_dynamic_entry (DT_DEBUG, 0)) - return FALSE; - } - - if (relplt) - { - if (!add_dynamic_entry (DT_PLTGOT, 0) - || !add_dynamic_entry (DT_PLTRELSZ, 0) - || !add_dynamic_entry (DT_PLTREL, DT_RELA) - || !add_dynamic_entry (DT_JMPREL, 0)) - return FALSE; - } - - if (!add_dynamic_entry (DT_RELA, 0) - || !add_dynamic_entry (DT_RELASZ, 0) - || !add_dynamic_entry (DT_RELAENT, sizeof (Elf64_External_Rela))) - return FALSE; - - if (info->flags & DF_TEXTREL) - { - if (!add_dynamic_entry (DT_TEXTREL, 0)) - return FALSE; - } - } -#undef add_dynamic_entry - - return TRUE; -} - /* Emit a dynamic relocation for (DYNINDX, RTYPE, ADDEND) at (SEC, OFFSET) into the next available slot in SREL. */ static void -elf64_alpha_emit_dynrel (abfd, info, sec, srel, offset, dynindx, rtype, addend) - bfd *abfd; - struct bfd_link_info *info; - asection *sec, *srel; - bfd_vma offset, addend; - long dynindx, rtype; +elf64_alpha_emit_dynrel (bfd *abfd, struct bfd_link_info *info, + asection *sec, asection *srel, bfd_vma offset, + long dynindx, long rtype, bfd_vma addend) { Elf_Internal_Rela outrel; bfd_byte *loc; @@ -4155,8 +3875,7 @@ elf64_alpha_emit_dynrel (abfd, info, sec, srel, offset, dynindx, rtype, addend) loc = srel->contents; loc += srel->reloc_count++ * sizeof (Elf64_External_Rela); bfd_elf64_swap_reloca_out (abfd, &outrel, loc); - BFD_ASSERT (sizeof (Elf64_External_Rela) * srel->reloc_count - <= srel->_cooked_size); + BFD_ASSERT (sizeof (Elf64_External_Rela) * srel->reloc_count <= srel->size); } /* Relocate an Alpha ELF section for a relocatable link. @@ -4166,16 +3885,13 @@ elf64_alpha_emit_dynrel (abfd, info, sec, srel, offset, dynindx, rtype, addend) symbol winds up in the output section. */ static bfd_boolean -elf64_alpha_relocate_section_r (output_bfd, info, input_bfd, input_section, - contents, relocs, local_syms, local_sections) - bfd *output_bfd ATTRIBUTE_UNUSED; - struct bfd_link_info *info ATTRIBUTE_UNUSED; - bfd *input_bfd; - asection *input_section; - bfd_byte *contents ATTRIBUTE_UNUSED; - Elf_Internal_Rela *relocs; - Elf_Internal_Sym *local_syms; - asection **local_sections; +elf64_alpha_relocate_section_r (bfd *output_bfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info ATTRIBUTE_UNUSED, + bfd *input_bfd, asection *input_section, + bfd_byte *contents ATTRIBUTE_UNUSED, + Elf_Internal_Rela *relocs, + Elf_Internal_Sym *local_syms, + asection **local_sections) { unsigned long symtab_hdr_sh_info; Elf_Internal_Rela *rel; @@ -4196,8 +3912,8 @@ elf64_alpha_relocate_section_r (output_bfd, info, input_bfd, input_section, if (r_type >= R_ALPHA_max) { (*_bfd_error_handler) - (_("%s: unknown relocation type %d"), - bfd_archive_filename (input_bfd), (int)r_type); + (_("%B: unknown relocation type %d"), + input_bfd, (int) r_type); bfd_set_error (bfd_error_bad_value); ret_val = FALSE; continue; @@ -4227,16 +3943,11 @@ elf64_alpha_relocate_section_r (output_bfd, info, input_bfd, input_section, /* Relocate an Alpha ELF section. */ static bfd_boolean -elf64_alpha_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; +elf64_alpha_relocate_section (bfd *output_bfd, struct bfd_link_info *info, + bfd *input_bfd, asection *input_section, + bfd_byte *contents, Elf_Internal_Rela *relocs, + Elf_Internal_Sym *local_syms, + asection **local_sections) { Elf_Internal_Shdr *symtab_hdr; Elf_Internal_Rela *rel; @@ -4246,7 +3957,6 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, bfd_vma gp, tp_base, dtp_base; struct alpha_elf_got_entry **local_got_entries; bfd_boolean ret_val; - const char *section_name; /* Handle relocatable links with a smaller loop. */ if (info->relocatable) @@ -4266,11 +3976,17 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, else srelgot = NULL; - section_name = (bfd_elf_string_from_elf_section - (input_bfd, elf_elfheader(input_bfd)->e_shstrndx, - elf_section_data(input_section)->rel_hdr.sh_name)); - BFD_ASSERT(section_name != NULL); - srel = bfd_get_section_by_name (dynobj, section_name); + if (input_section->flags & SEC_ALLOC) + { + const char *section_name; + section_name = (bfd_elf_string_from_elf_section + (input_bfd, elf_elfheader(input_bfd)->e_shstrndx, + elf_section_data(input_section)->rel_hdr.sh_name)); + BFD_ASSERT(section_name != NULL); + srel = bfd_get_section_by_name (dynobj, section_name); + } + else + srel = NULL; /* Find the gp value for this input bfd. */ gotobj = alpha_elf_tdata (input_bfd)->gotobj; @@ -4322,8 +4038,8 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, if (r_type >= R_ALPHA_max) { (*_bfd_error_handler) - (_("%s: unknown relocation type %d"), - bfd_archive_filename (input_bfd), (int)r_type); + (_("%B: unknown relocation type %d"), + input_bfd, (int) r_type); bfd_set_error (bfd_error_bad_value); ret_val = FALSE; continue; @@ -4347,7 +4063,7 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, /* If this is a tp-relative relocation against sym 0, this is hackery from relax_section. Force the value to - be the tls base. */ + be the tls module base. */ if (r_symndx == 0 && (r_type == R_ALPHA_TLSLDM || r_type == R_ALPHA_GOTTPREL @@ -4355,7 +4071,7 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, || r_type == R_ALPHA_TPRELHI || r_type == R_ALPHA_TPRELLO || r_type == R_ALPHA_TPREL16)) - value = tp_base; + value = dtp_base; if (local_got_entries) gotent = local_got_entries[r_symndx]; @@ -4382,8 +4098,7 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, _bfd_merged_section_offset (output_bfd, &msec, elf_section_data (sec)-> sec_info, - sym->st_value + ent->addend, - (bfd_vma) 0); + sym->st_value + ent->addend); ent->addend -= sym->st_value; ent->addend += msec->output_section->vma + msec->output_offset @@ -4465,7 +4180,7 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, /* If the symbol has been forced local, output a RELATIVE reloc, otherwise it will be handled in finish_dynamic_symbol. */ - if (info->shared && !dynamic_symbol_p) + if (info->shared && !dynamic_symbol_p && !undef_weak_ref) elf64_alpha_emit_dynrel (output_bfd, info, sgot, srelgot, gotent->got_offset, 0, R_ALPHA_RELATIVE, value); @@ -4495,8 +4210,8 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, if (dynamic_symbol_p) { (*_bfd_error_handler) - (_("%s: gp-relative relocation against dynamic symbol %s"), - bfd_archive_filename (input_bfd), h->root.root.root.string); + (_("%B: gp-relative relocation against dynamic symbol %s"), + input_bfd, h->root.root.root.string); ret_val = FALSE; } BFD_ASSERT(gp != 0); @@ -4507,8 +4222,8 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, if (dynamic_symbol_p) { (*_bfd_error_handler) - (_("%s: gp-relative relocation against dynamic symbol %s"), - bfd_archive_filename (input_bfd), h->root.root.root.string); + (_("%B: gp-relative relocation against dynamic symbol %s"), + input_bfd, h->root.root.root.string); ret_val = FALSE; } BFD_ASSERT(gp != 0); @@ -4533,8 +4248,8 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, if (dynamic_symbol_p) { (*_bfd_error_handler) - (_("%s: pc-relative relocation against dynamic symbol %s"), - bfd_archive_filename (input_bfd), h->root.root.root.string); + (_("%B: pc-relative relocation against dynamic symbol %s"), + input_bfd, h->root.root.root.string); ret_val = FALSE; } /* The regular PC-relative stuff measures from the start of @@ -4561,8 +4276,8 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, && gotobj != alpha_elf_tdata (sec->owner)->gotobj) { (*_bfd_error_handler) - (_("%s: change in gp: BRSGP %s"), - bfd_archive_filename (input_bfd), h->root.root.root.string); + (_("%B: change in gp: BRSGP %s"), + input_bfd, h->root.root.root.string); ret_val = FALSE; } @@ -4591,8 +4306,8 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, name = bfd_section_name (input_bfd, sec); } (*_bfd_error_handler) - (_("%s: !samegp reloc against symbol without .prologue: %s"), - bfd_archive_filename (input_bfd), name); + (_("%B: !samegp reloc against symbol without .prologue: %s"), + input_bfd, name); ret_val = FALSE; break; } @@ -4637,13 +4352,14 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, } else if (info->shared && r_symndx != 0 - && (input_section->flags & SEC_ALLOC)) + && (input_section->flags & SEC_ALLOC) + && !undef_weak_ref) { if (r_type == R_ALPHA_REFLONG) { (*_bfd_error_handler) - (_("%s: unhandled dynamic relocation against %s"), - bfd_archive_filename (input_bfd), + (_("%B: unhandled dynamic relocation against %s"), + input_bfd, h->root.root.root.string); ret_val = FALSE; } @@ -4654,9 +4370,10 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, else goto default_reloc; - elf64_alpha_emit_dynrel (output_bfd, info, input_section, - srel, rel->r_offset, dynindx, - dyntype, dynaddend); + if (input_section->flags & SEC_ALLOC) + elf64_alpha_emit_dynrel (output_bfd, info, input_section, + srel, rel->r_offset, dynindx, + dyntype, dynaddend); } goto default_reloc; @@ -4666,10 +4383,18 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, if (dynamic_symbol_p) { (*_bfd_error_handler) - (_("%s: pc-relative relocation against dynamic symbol %s"), - bfd_archive_filename (input_bfd), h->root.root.root.string); + (_("%B: pc-relative relocation against dynamic symbol %s"), + input_bfd, h->root.root.root.string); ret_val = FALSE; } + else if ((info->shared || info->pie) && undef_weak_ref) + { + (*_bfd_error_handler) + (_("%B: pc-relative relocation against undefined weak symbol %s"), + input_bfd, h->root.root.root.string); + ret_val = FALSE; + } + /* ??? .eh_frame references to discarded sections will be smashed to relocations against SHN_UNDEF. The .eh_frame format allows @@ -4725,8 +4450,8 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, if (dynamic_symbol_p) { (*_bfd_error_handler) - (_("%s: dtp-relative relocation against dynamic symbol %s"), - bfd_archive_filename (input_bfd), h->root.root.root.string); + (_("%B: dtp-relative relocation against dynamic symbol %s"), + input_bfd, h->root.root.root.string); ret_val = FALSE; } BFD_ASSERT (elf_hash_table (info)->tls_sec != NULL); @@ -4741,15 +4466,15 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, if (info->shared) { (*_bfd_error_handler) - (_("%s: TLS local exec code cannot be linked into shared objects"), - bfd_archive_filename (input_bfd)); + (_("%B: TLS local exec code cannot be linked into shared objects"), + input_bfd); ret_val = FALSE; } else if (dynamic_symbol_p) { (*_bfd_error_handler) - (_("%s: tp-relative relocation against dynamic symbol %s"), - bfd_archive_filename (input_bfd), h->root.root.root.string); + (_("%B: tp-relative relocation against dynamic symbol %s"), + input_bfd, h->root.root.root.string); ret_val = FALSE; } BFD_ASSERT (elf_hash_table (info)->tls_sec != NULL); @@ -4823,7 +4548,7 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, break; if (h != NULL) - name = h->root.root.root.string; + name = NULL; else { name = (bfd_elf_string_from_elf_section @@ -4834,8 +4559,9 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, 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))) + (info, (h ? &h->root.root : NULL), name, howto->name, + (bfd_vma) 0, input_bfd, input_section, + rel->r_offset))) ret_val = FALSE; } break; @@ -4853,15 +4579,14 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, dynamic sections here. */ static bfd_boolean -elf64_alpha_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; +elf64_alpha_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info, + struct elf_link_hash_entry *h, + Elf_Internal_Sym *sym) { + struct alpha_elf_link_hash_entry *ah = (struct alpha_elf_link_hash_entry *)h; bfd *dynobj = elf_hash_table(info)->dynobj; - if (h->plt.offset != MINUS_ONE) + if (h->needs_plt) { /* Fill in the .plt entry for this symbol. */ asection *splt, *sgot, *srel; @@ -4873,83 +4598,71 @@ elf64_alpha_finish_dynamic_symbol (output_bfd, info, h, sym) BFD_ASSERT (h->dynindx != -1); - /* The first .got entry will be updated by the .plt with the - address of the target function. */ - gotent = ((struct alpha_elf_link_hash_entry *) h)->got_entries; - BFD_ASSERT (gotent && gotent->addend == 0); - splt = bfd_get_section_by_name (dynobj, ".plt"); BFD_ASSERT (splt != NULL); srel = bfd_get_section_by_name (dynobj, ".rela.plt"); BFD_ASSERT (srel != NULL); - sgot = alpha_elf_tdata (gotent->gotobj)->got; - BFD_ASSERT (sgot != NULL); - got_addr = (sgot->output_section->vma - + sgot->output_offset - + gotent->got_offset); - plt_addr = (splt->output_section->vma - + splt->output_offset - + h->plt.offset); + for (gotent = ah->got_entries; gotent ; gotent = gotent->next) + if (gotent->reloc_type == R_ALPHA_LITERAL + && gotent->use_count > 0) + { + unsigned int insn; + int disp; - plt_index = (h->plt.offset - PLT_HEADER_SIZE) / PLT_ENTRY_SIZE; + sgot = alpha_elf_tdata (gotent->gotobj)->got; + BFD_ASSERT (sgot != NULL); - /* Fill in the entry in the procedure linkage table. */ - { - bfd_vma insn1, insn2, insn3; + BFD_ASSERT (gotent->got_offset != -1); + BFD_ASSERT (gotent->plt_offset != -1); - insn1 = PLT_ENTRY_WORD1 | ((-(h->plt.offset + 4) >> 2) & 0x1fffff); - insn2 = PLT_ENTRY_WORD2; - insn3 = PLT_ENTRY_WORD3; + got_addr = (sgot->output_section->vma + + sgot->output_offset + + gotent->got_offset); + plt_addr = (splt->output_section->vma + + splt->output_offset + + gotent->plt_offset); - bfd_put_32 (output_bfd, insn1, splt->contents + h->plt.offset); - bfd_put_32 (output_bfd, insn2, splt->contents + h->plt.offset + 4); - bfd_put_32 (output_bfd, insn3, splt->contents + h->plt.offset + 8); - } + plt_index = (gotent->plt_offset-PLT_HEADER_SIZE) / PLT_ENTRY_SIZE; - /* Fill in the entry in the .rela.plt section. */ - outrel.r_offset = got_addr; - outrel.r_info = ELF64_R_INFO(h->dynindx, R_ALPHA_JMP_SLOT); - outrel.r_addend = 0; + /* Fill in the entry in the procedure linkage table. */ + if (elf64_alpha_use_secureplt) + { + disp = (PLT_HEADER_SIZE - 4) - (gotent->plt_offset + 4); + insn = INSN_AD (INSN_BR, 31, disp); + bfd_put_32 (output_bfd, insn, + splt->contents + gotent->plt_offset); - loc = srel->contents + plt_index * sizeof (Elf64_External_Rela); - bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc); + plt_index = ((gotent->plt_offset - NEW_PLT_HEADER_SIZE) + / NEW_PLT_ENTRY_SIZE); + } + else + { + disp = -(gotent->plt_offset + 4); + insn = INSN_AD (INSN_BR, 28, disp); + bfd_put_32 (output_bfd, insn, + splt->contents + gotent->plt_offset); + bfd_put_32 (output_bfd, INSN_UNOP, + splt->contents + gotent->plt_offset + 4); + bfd_put_32 (output_bfd, INSN_UNOP, + splt->contents + gotent->plt_offset + 8); - if (!(h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)) - { - /* Mark the symbol as undefined, rather than as defined in the - .plt section. Leave the value alone. */ - sym->st_shndx = SHN_UNDEF; - } + plt_index = ((gotent->plt_offset - OLD_PLT_HEADER_SIZE) + / OLD_PLT_ENTRY_SIZE); + } - /* Fill in the entries in the .got. */ - bfd_put_64 (output_bfd, plt_addr, sgot->contents + gotent->got_offset); + /* Fill in the entry in the .rela.plt section. */ + outrel.r_offset = got_addr; + outrel.r_info = ELF64_R_INFO(h->dynindx, R_ALPHA_JMP_SLOT); + outrel.r_addend = 0; - /* Subsequent .got entries will continue to bounce through the .plt. */ - if (gotent->next) - { - srel = bfd_get_section_by_name (dynobj, ".rela.got"); - BFD_ASSERT (! info->shared || srel != NULL); + loc = srel->contents + plt_index * sizeof (Elf64_External_Rela); + bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc); - gotent = gotent->next; - do - { - sgot = alpha_elf_tdata(gotent->gotobj)->got; - BFD_ASSERT(sgot != NULL); - BFD_ASSERT(gotent->addend == 0); - - bfd_put_64 (output_bfd, plt_addr, - sgot->contents + gotent->got_offset); - - if (info->shared) - elf64_alpha_emit_dynrel (output_bfd, info, sgot, srel, - gotent->got_offset, 0, - R_ALPHA_RELATIVE, plt_addr); - - gotent = gotent->next; - } - while (gotent != NULL); - } + /* Fill in the entry in the .got. */ + bfd_put_64 (output_bfd, plt_addr, + sgot->contents + gotent->got_offset); + } } else if (alpha_elf_dynamic_symbol_p (h, info)) { @@ -5005,8 +4718,8 @@ elf64_alpha_finish_dynamic_symbol (output_bfd, info, h, sym) /* Mark some specially defined symbols as absolute. */ if (strcmp (h->root.root.string, "_DYNAMIC") == 0 - || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0 - || strcmp (h->root.root.string, "_PROCEDURE_LINKAGE_TABLE_") == 0) + || h == elf_hash_table (info)->hgot + || h == elf_hash_table (info)->hplt) sym->st_shndx = SHN_ABS; return TRUE; @@ -5015,9 +4728,8 @@ elf64_alpha_finish_dynamic_symbol (output_bfd, info, h, sym) /* Finish up the dynamic sections. */ static bfd_boolean -elf64_alpha_finish_dynamic_sections (output_bfd, info) - bfd *output_bfd; - struct bfd_link_info *info; +elf64_alpha_finish_dynamic_sections (bfd *output_bfd, + struct bfd_link_info *info) { bfd *dynobj; asection *sdyn; @@ -5027,33 +4739,45 @@ elf64_alpha_finish_dynamic_sections (output_bfd, info) if (elf_hash_table (info)->dynamic_sections_created) { - asection *splt; + asection *splt, *sgotplt, *srelaplt; Elf64_External_Dyn *dyncon, *dynconend; + bfd_vma plt_vma, gotplt_vma; splt = bfd_get_section_by_name (dynobj, ".plt"); + srelaplt = bfd_get_section_by_name (output_bfd, ".rela.plt"); BFD_ASSERT (splt != NULL && sdyn != NULL); + plt_vma = splt->output_section->vma + splt->output_offset; + + gotplt_vma = 0; + if (elf64_alpha_use_secureplt) + { + sgotplt = bfd_get_section_by_name (dynobj, ".got.plt"); + BFD_ASSERT (sgotplt != NULL); + if (sgotplt->size > 0) + gotplt_vma = sgotplt->output_section->vma + sgotplt->output_offset; + } + dyncon = (Elf64_External_Dyn *) sdyn->contents; - dynconend = (Elf64_External_Dyn *) (sdyn->contents + sdyn->_raw_size); + dynconend = (Elf64_External_Dyn *) (sdyn->contents + sdyn->size); for (; dyncon < dynconend; dyncon++) { Elf_Internal_Dyn dyn; - const char *name; - asection *s; bfd_elf64_swap_dyn_in (dynobj, dyncon, &dyn); switch (dyn.d_tag) { case DT_PLTGOT: - name = ".plt"; - goto get_vma; + dyn.d_un.d_ptr + = elf64_alpha_use_secureplt ? gotplt_vma : plt_vma; + break; case DT_PLTRELSZ: - name = ".rela.plt"; - goto get_size; + dyn.d_un.d_val = srelaplt ? srelaplt->size : 0; + break; case DT_JMPREL: - name = ".rela.plt"; - goto get_vma; + dyn.d_un.d_ptr = srelaplt ? srelaplt->vma : 0; + break; case DT_RELASZ: /* My interpretation of the TIS v1.1 ELF document indicates @@ -5061,40 +4785,69 @@ elf64_alpha_finish_dynamic_sections (output_bfd, info) the rest of the BFD does. It is, however, what the glibc ld.so wants. Do this fixup here until we found out who is right. */ - s = bfd_get_section_by_name (output_bfd, ".rela.plt"); - if (s) - { - dyn.d_un.d_val -= - (s->_cooked_size ? s->_cooked_size : s->_raw_size); - } - break; - - get_vma: - s = bfd_get_section_by_name (output_bfd, name); - dyn.d_un.d_ptr = (s ? s->vma : 0); - break; - - get_size: - s = bfd_get_section_by_name (output_bfd, name); - dyn.d_un.d_val = - (s->_cooked_size ? s->_cooked_size : s->_raw_size); + if (srelaplt) + dyn.d_un.d_val -= srelaplt->size; break; } bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon); } - /* Initialize the PLT0 entry. */ - if (splt->_raw_size > 0) + /* Initialize the plt header. */ + if (splt->size > 0) { - bfd_put_32 (output_bfd, PLT_HEADER_WORD1, splt->contents); - bfd_put_32 (output_bfd, PLT_HEADER_WORD2, splt->contents + 4); - bfd_put_32 (output_bfd, PLT_HEADER_WORD3, splt->contents + 8); - bfd_put_32 (output_bfd, PLT_HEADER_WORD4, splt->contents + 12); + unsigned int insn; + int ofs; - /* The next two words will be filled in by ld.so */ - bfd_put_64 (output_bfd, (bfd_vma) 0, splt->contents + 16); - bfd_put_64 (output_bfd, (bfd_vma) 0, splt->contents + 24); + if (elf64_alpha_use_secureplt) + { + ofs = gotplt_vma - (plt_vma + PLT_HEADER_SIZE); + + insn = INSN_ABC (INSN_SUBQ, 27, 28, 25); + bfd_put_32 (output_bfd, insn, splt->contents); + + insn = INSN_ABO (INSN_LDAH, 28, 28, (ofs + 0x8000) >> 16); + bfd_put_32 (output_bfd, insn, splt->contents + 4); + + insn = INSN_ABC (INSN_S4SUBQ, 25, 25, 25); + bfd_put_32 (output_bfd, insn, splt->contents + 8); + + insn = INSN_ABO (INSN_LDA, 28, 28, ofs); + bfd_put_32 (output_bfd, insn, splt->contents + 12); + + insn = INSN_ABO (INSN_LDQ, 27, 28, 0); + bfd_put_32 (output_bfd, insn, splt->contents + 16); + + insn = INSN_ABC (INSN_ADDQ, 25, 25, 25); + bfd_put_32 (output_bfd, insn, splt->contents + 20); + + insn = INSN_ABO (INSN_LDQ, 28, 28, 8); + bfd_put_32 (output_bfd, insn, splt->contents + 24); + + insn = INSN_AB (INSN_JMP, 31, 27); + bfd_put_32 (output_bfd, insn, splt->contents + 28); + + insn = INSN_AD (INSN_BR, 28, -PLT_HEADER_SIZE); + bfd_put_32 (output_bfd, insn, splt->contents + 32); + } + else + { + insn = INSN_AD (INSN_BR, 27, 0); /* br $27, .+4 */ + bfd_put_32 (output_bfd, insn, splt->contents); + + insn = INSN_ABO (INSN_LDQ, 27, 27, 12); + bfd_put_32 (output_bfd, insn, splt->contents + 4); + + insn = INSN_UNOP; + bfd_put_32 (output_bfd, insn, splt->contents + 8); + + insn = INSN_AB (INSN_JMP, 27, 27); + bfd_put_32 (output_bfd, insn, splt->contents + 12); + + /* The next two words will be filled in by ld.so. */ + bfd_put_64 (output_bfd, 0, splt->contents + 16); + bfd_put_64 (output_bfd, 0, splt->contents + 24); + } elf_section_data (splt->output_section)->this_hdr.sh_entsize = 0; } @@ -5108,9 +4861,7 @@ elf64_alpha_finish_dynamic_sections (output_bfd, info) them all out sequentially. */ static bfd_boolean -elf64_alpha_final_link (abfd, info) - bfd *abfd; - struct bfd_link_info *info; +elf64_alpha_final_link (bfd *abfd, struct bfd_link_info *info) { asection *o; struct bfd_link_order *p; @@ -5196,7 +4947,7 @@ elf64_alpha_final_link (abfd, info) if (s != NULL) { esym.asym.value = s->vma; - last = s->vma + s->_raw_size; + last = s->vma + s->size; } else esym.asym.value = last; @@ -5207,7 +4958,7 @@ elf64_alpha_final_link (abfd, info) } } - for (p = o->link_order_head; + for (p = o->map_head.link_order; p != (struct bfd_link_order *) NULL; p = p->next) { @@ -5241,7 +4992,7 @@ elf64_alpha_final_link (abfd, info) input_swap = (get_elf_backend_data (input_bfd) ->elf_backend_ecoff_debug_swap); - BFD_ASSERT (p->size == input_section->_raw_size); + BFD_ASSERT (p->size == input_section->size); /* The ECOFF linking code expects that we have already read in the debugging information and set up an @@ -5324,11 +5075,11 @@ elf64_alpha_final_link (abfd, info) return FALSE; /* Set the size of the .mdebug section. */ - o->_raw_size = bfd_ecoff_debug_size (abfd, &debug, swap); + o->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; + o->map_head.link_order = (struct bfd_link_order *) NULL; mdebug_sec = o; } @@ -5357,7 +5108,7 @@ elf64_alpha_final_link (abfd, info) if (! bfd_set_section_contents (abfd, sgot->output_section, sgot->contents, (file_ptr) sgot->output_offset, - sgot->_raw_size)) + sgot->size)) return FALSE; } } @@ -5377,8 +5128,7 @@ elf64_alpha_final_link (abfd, info) } static enum elf_reloc_type_class -elf64_alpha_reloc_type_class (rela) - const Elf_Internal_Rela *rela; +elf64_alpha_reloc_type_class (const Elf_Internal_Rela *rela) { switch ((int) ELF64_R_TYPE (rela->r_info)) { @@ -5393,10 +5143,10 @@ elf64_alpha_reloc_type_class (rela) } } -static struct bfd_elf_special_section const elf64_alpha_special_sections[]= +static const struct bfd_elf_special_section elf64_alpha_special_sections[] = { - { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_ALPHA_GPREL }, { ".sbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_ALPHA_GPREL }, + { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_ALPHA_GPREL }, { NULL, 0, 0, 0, 0 } }; @@ -5560,13 +5310,9 @@ static const struct elf_size_info alpha_elf_size_info = "FreeBSD" label in the ELF header. So we put this label on all executables and (for simplicity) also all other object files. */ -static void elf64_alpha_fbsd_post_process_headers - PARAMS ((bfd *, struct bfd_link_info *)); - static void -elf64_alpha_fbsd_post_process_headers (abfd, link_info) - bfd * abfd; - struct bfd_link_info * link_info ATTRIBUTE_UNUSED; +elf64_alpha_fbsd_post_process_headers (bfd * abfd, + struct bfd_link_info * link_info ATTRIBUTE_UNUSED) { Elf_Internal_Ehdr * i_ehdrp; /* ELF file header, internal form. */ diff --git a/contrib/binutils/bfd/elf64-gen.c b/contrib/binutils/bfd/elf64-gen.c index be1dc3e00ed..49b8d9c5528 100644 --- a/contrib/binutils/bfd/elf64-gen.c +++ b/contrib/binutils/bfd/elf64-gen.c @@ -1,22 +1,22 @@ /* Generic support for 64-bit ELF - Copyright 1993, 1995, 1998, 1999, 2001, 2002, 2004 + Copyright 1993, 1995, 1998, 1999, 2001, 2002, 2004, 2005 Free Software Foundation, Inc. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" @@ -41,53 +41,48 @@ static reloc_howto_type dummy = 0, /* dst_mask */ FALSE); /* pcrel_offset */ -static void elf_generic_info_to_howto - PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); -static void elf_generic_info_to_howto_rel - PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); -static bfd_boolean elf64_generic_link_add_symbols - PARAMS ((bfd *, struct bfd_link_info *)); - static void -elf_generic_info_to_howto (abfd, bfd_reloc, elf_reloc) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *bfd_reloc; - Elf_Internal_Rela *elf_reloc ATTRIBUTE_UNUSED; +elf_generic_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, + arelent *bfd_reloc, + Elf_Internal_Rela *elf_reloc ATTRIBUTE_UNUSED) { bfd_reloc->howto = &dummy; } static void -elf_generic_info_to_howto_rel (abfd, bfd_reloc, elf_reloc) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *bfd_reloc; - Elf_Internal_Rela *elf_reloc ATTRIBUTE_UNUSED; +elf_generic_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED, + arelent *bfd_reloc, + Elf_Internal_Rela *elf_reloc ATTRIBUTE_UNUSED) { bfd_reloc->howto = &dummy; } +static void +check_for_relocs (bfd * abfd, asection * o, void * failed) +{ + if ((o->flags & SEC_RELOC) != 0) + { + Elf_Internal_Ehdr *ehdrp; + + ehdrp = elf_elfheader (abfd); + _bfd_error_handler (_("%B: Relocations in generic ELF (EM: %d)"), + abfd, ehdrp->e_machine); + + bfd_set_error (bfd_error_wrong_format); + * (bfd_boolean *) failed = TRUE; + } +} + static bfd_boolean -elf64_generic_link_add_symbols (abfd, info) - bfd *abfd; - struct bfd_link_info *info; +elf64_generic_link_add_symbols (bfd *abfd, struct bfd_link_info *info) { - asection *o; + bfd_boolean failed = FALSE; /* Check if there are any relocations. */ - for (o = abfd->sections; o != NULL; o = o->next) - if ((o->flags & SEC_RELOC) != 0) - { - Elf_Internal_Ehdr *ehdrp; - - ehdrp = elf_elfheader (abfd); - (*_bfd_error_handler) (_("%s: Relocations in generic ELF (EM: %d)"), - bfd_archive_filename (abfd), - ehdrp->e_machine); - - bfd_set_error (bfd_error_wrong_format); - return FALSE; - } + bfd_map_over_sections (abfd, check_for_relocs, & failed); + if (failed) + return FALSE; return bfd_elf_link_add_symbols (abfd, info); } diff --git a/contrib/binutils/bfd/elf64-mips.c b/contrib/binutils/bfd/elf64-mips.c index fa3b494b998..c8f3127e3c9 100644 --- a/contrib/binutils/bfd/elf64-mips.c +++ b/contrib/binutils/bfd/elf64-mips.c @@ -1,5 +1,5 @@ /* MIPS-specific support for 64-bit ELF - Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. Ian Lance Taylor, Cygnus Support Linker support added by Mark Mitchell, CodeSourcery, LLC. @@ -19,7 +19,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* This file supports the 64-bit MIPS ELF ABI. @@ -299,9 +299,11 @@ static reloc_howto_type mips_elf64_howto_table_rel[] = 0x0000ffff, /* dst_mask */ FALSE), /* pcrel_offset */ - /* 16 bit PC relative reference. */ + /* 16 bit PC relative reference. Note that the ABI document has a typo + and claims R_MIPS_PC16 to be not rightshifted, rendering it useless. + We do the right thing here. */ HOWTO (R_MIPS_PC16, /* type */ - 0, /* rightshift */ + 2, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 16, /* bitsize */ TRUE, /* pc_relative */ @@ -622,7 +624,7 @@ static reloc_howto_type mips_elf64_howto_table_rel[] = /* Protected jump conversion. This is an optimization hint. No relocation is required for correctness. */ - HOWTO (R_MIPS_JALR, /* type */ + HOWTO (R_MIPS_JALR, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 32, /* bitsize */ @@ -630,11 +632,165 @@ static reloc_howto_type mips_elf64_howto_table_rel[] = 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ _bfd_mips_elf_generic_reloc, /* special_function */ - "R_MIPS_JALR", /* name */ + "R_MIPS_JALR", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ 0x00000000, /* dst_mask */ FALSE), /* pcrel_offset */ + + /* TLS relocations. */ + EMPTY_HOWTO (R_MIPS_TLS_DTPMOD32), + EMPTY_HOWTO (R_MIPS_TLS_DTPREL32), + + HOWTO (R_MIPS_TLS_DTPMOD64, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + _bfd_mips_elf_generic_reloc, /* special_function */ + "R_MIPS_TLS_DTPMOD64", /* name */ + TRUE, /* partial_inplace */ + MINUS_ONE, /* src_mask */ + MINUS_ONE, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_MIPS_TLS_DTPREL64, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + _bfd_mips_elf_generic_reloc, /* special_function */ + "R_MIPS_TLS_DTPREL64", /* name */ + TRUE, /* partial_inplace */ + MINUS_ONE, /* src_mask */ + MINUS_ONE, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* TLS general dynamic variable reference. */ + HOWTO (R_MIPS_TLS_GD, /* 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_generic_reloc, /* special_function */ + "R_MIPS_TLS_GD", /* name */ + TRUE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* TLS local dynamic variable reference. */ + HOWTO (R_MIPS_TLS_LDM, /* 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_generic_reloc, /* special_function */ + "R_MIPS_TLS_LDM", /* name */ + TRUE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* TLS local dynamic offset. */ + HOWTO (R_MIPS_TLS_DTPREL_HI16, /* 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_generic_reloc, /* special_function */ + "R_MIPS_TLS_DTPREL_HI16", /* name */ + TRUE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* TLS local dynamic offset. */ + HOWTO (R_MIPS_TLS_DTPREL_LO16, /* 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_generic_reloc, /* special_function */ + "R_MIPS_TLS_DTPREL_LO16", /* name */ + TRUE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* TLS thread pointer offset. */ + HOWTO (R_MIPS_TLS_GOTTPREL, /* 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_generic_reloc, /* special_function */ + "R_MIPS_TLS_GOTTPREL", /* name */ + TRUE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* TLS IE dynamic relocations. */ + EMPTY_HOWTO (R_MIPS_TLS_TPREL32), + + HOWTO (R_MIPS_TLS_TPREL64, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + _bfd_mips_elf_generic_reloc, /* special_function */ + "R_MIPS_TLS_TPREL64", /* name */ + TRUE, /* partial_inplace */ + MINUS_ONE, /* src_mask */ + MINUS_ONE, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* TLS thread pointer offset. */ + HOWTO (R_MIPS_TLS_TPREL_HI16, /* 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_generic_reloc, /* special_function */ + "R_MIPS_TLS_TPREL_HI16", /* name */ + TRUE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* TLS thread pointer offset. */ + HOWTO (R_MIPS_TLS_TPREL_LO16, /* 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_generic_reloc, /* special_function */ + "R_MIPS_TLS_TPREL_LO16", /* name */ + TRUE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ }; /* The relocation table used for SHT_RELA sections. */ @@ -794,9 +950,11 @@ static reloc_howto_type mips_elf64_howto_table_rela[] = 0x0000ffff, /* dst_mask */ FALSE), /* pcrel_offset */ - /* 16 bit PC relative reference. */ + /* 16 bit PC relative reference. Note that the ABI document has a typo + and claims R_MIPS_PC16 to be not rightshifted, rendering it useless. + We do the right thing here. */ HOWTO (R_MIPS_PC16, /* type */ - 0, /* rightshift */ + 2, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 16, /* bitsize */ TRUE, /* pc_relative */ @@ -1138,7 +1296,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] = /* Protected jump conversion. This is an optimization hint. No relocation is required for correctness. */ - HOWTO (R_MIPS_JALR, /* type */ + HOWTO (R_MIPS_JALR, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 32, /* bitsize */ @@ -1146,15 +1304,130 @@ static reloc_howto_type mips_elf64_howto_table_rela[] = 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ _bfd_mips_elf_generic_reloc, /* special_function */ - "R_MIPS_JALR", /* name */ + "R_MIPS_JALR", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ 0x00000000, /* dst_mask */ FALSE), /* pcrel_offset */ + + /* TLS relocations. */ + EMPTY_HOWTO (R_MIPS_TLS_DTPMOD32), + EMPTY_HOWTO (R_MIPS_TLS_DTPREL32), + EMPTY_HOWTO (R_MIPS_TLS_DTPMOD64), + EMPTY_HOWTO (R_MIPS_TLS_DTPREL64), + + /* TLS general dynamic variable reference. */ + HOWTO (R_MIPS_TLS_GD, /* 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_generic_reloc, /* special_function */ + "R_MIPS_TLS_GD", /* name */ + TRUE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* TLS local dynamic variable reference. */ + HOWTO (R_MIPS_TLS_LDM, /* 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_generic_reloc, /* special_function */ + "R_MIPS_TLS_LDM", /* name */ + TRUE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* TLS local dynamic offset. */ + HOWTO (R_MIPS_TLS_DTPREL_HI16, /* 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_generic_reloc, /* special_function */ + "R_MIPS_TLS_DTPREL_HI16", /* name */ + TRUE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* TLS local dynamic offset. */ + HOWTO (R_MIPS_TLS_DTPREL_LO16, /* 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_generic_reloc, /* special_function */ + "R_MIPS_TLS_DTPREL_LO16", /* name */ + TRUE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* TLS thread pointer offset. */ + HOWTO (R_MIPS_TLS_GOTTPREL, /* 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_generic_reloc, /* special_function */ + "R_MIPS_TLS_GOTTPREL", /* name */ + TRUE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + EMPTY_HOWTO (R_MIPS_TLS_TPREL32), + EMPTY_HOWTO (R_MIPS_TLS_TPREL64), + + /* TLS thread pointer offset. */ + HOWTO (R_MIPS_TLS_TPREL_HI16, /* 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_generic_reloc, /* special_function */ + "R_MIPS_TLS_TPREL_HI16", /* name */ + TRUE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* TLS thread pointer offset. */ + HOWTO (R_MIPS_TLS_TPREL_LO16, /* 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_generic_reloc, /* special_function */ + "R_MIPS_TLS_TPREL_LO16", /* name */ + TRUE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ }; -/* The reloc used for the mips16 jump instruction. */ -static reloc_howto_type elf_mips16_jump_howto = +static reloc_howto_type mips16_elf64_howto_table_rel[] = +{ + /* The reloc used for the mips16 jump instruction. */ HOWTO (R_MIPS16_26, /* type */ 2, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ @@ -1170,10 +1443,9 @@ static reloc_howto_type elf_mips16_jump_howto = TRUE, /* partial_inplace */ 0x3ffffff, /* src_mask */ 0x3ffffff, /* dst_mask */ - FALSE); /* pcrel_offset */ + FALSE), /* pcrel_offset */ -/* The reloc used for the mips16 gprel instruction. */ -static reloc_howto_type elf_mips16_gprel_howto = + /* The reloc used for the mips16 gprel instruction. */ HOWTO (R_MIPS16_GPREL, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ @@ -1184,9 +1456,118 @@ static reloc_howto_type elf_mips16_gprel_howto = mips16_gprel_reloc, /* special_function */ "R_MIPS16_GPREL", /* name */ TRUE, /* partial_inplace */ - 0x07ff001f, /* src_mask */ - 0x07ff001f, /* dst_mask */ - FALSE); /* pcrel_offset */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A placeholder for MIPS16 reference to global offset table. */ + EMPTY_HOWTO (R_MIPS16_GOT16), + + /* A placeholder for MIPS16 16 bit call through global offset table. */ + EMPTY_HOWTO (R_MIPS16_CALL16), + + /* MIPS16 high 16 bits of symbol value. */ + HOWTO (R_MIPS16_HI16, /* type */ + 16, /* 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_MIPS16_HI16", /* name */ + TRUE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* MIPS16 low 16 bits of symbol value. */ + HOWTO (R_MIPS16_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_MIPS16_LO16", /* name */ + TRUE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ +}; + +static reloc_howto_type mips16_elf64_howto_table_rela[] = +{ + /* The reloc used for the mips16 jump instruction. */ + 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 */ + FALSE, /* partial_inplace */ + 0x3ffffff, /* src_mask */ + 0x3ffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* The reloc used for the mips16 gprel instruction. */ + 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 */ + FALSE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A placeholder for MIPS16 reference to global offset table. */ + EMPTY_HOWTO (R_MIPS16_GOT16), + + /* A placeholder for MIPS16 16 bit call through global offset table. */ + EMPTY_HOWTO (R_MIPS16_CALL16), + + /* MIPS16 high 16 bits of symbol value. */ + HOWTO (R_MIPS16_HI16, /* type */ + 16, /* 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_MIPS16_HI16", /* name */ + FALSE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* MIPS16 low 16 bits of symbol value. */ + HOWTO (R_MIPS16_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_MIPS16_LO16", /* name */ + FALSE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ +}; /* GNU extension to record C++ vtable hierarchy */ static reloc_howto_type elf_mips_gnu_vtinherit_howto = @@ -1367,9 +1748,6 @@ mips_elf64_be_swap_reloc_out (bfd *abfd, const Elf_Internal_Rela *src, mirel.r_offset = src[0].r_offset; BFD_ASSERT(src[0].r_offset == src[1].r_offset); -#if 0 - BFD_ASSERT(src[0].r_offset == src[2].r_offset); -#endif mirel.r_type = ELF64_MIPS_R_TYPE (src[0].r_info); mirel.r_sym = ELF64_R_SYM (src[0].r_info); @@ -1546,14 +1924,14 @@ mips_elf64_literal_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, bfd_reloc_status_type ret; bfd_vma gp; - /* If we're relocating, and this is an external symbol, we don't - want to change anything. */ + /* R_MIPS_LITERAL relocations are defined for local symbols only. */ if (output_bfd != NULL && (symbol->flags & BSF_SECTION_SYM) == 0 && (symbol->flags & BSF_LOCAL) != 0) { - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; + *error_message = (char *) + _("literal relocation occurs for an external symbol"); + return bfd_reloc_outofrange; } /* FIXME: The entries in the .lit8 and .lit4 sections should be merged. */ @@ -1589,8 +1967,7 @@ mips_elf64_gprel32_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, bfd_vma relocation; bfd_vma val; - /* If we're relocating, and this is an external symbol, we don't want - to change anything. */ + /* R_MIPS_GPREL32 relocations are defined for local symbols only. */ if (output_bfd != NULL && (symbol->flags & BSF_SECTION_SYM) == 0 && (symbol->flags & BSF_LOCAL) != 0) @@ -1608,10 +1985,10 @@ mips_elf64_gprel32_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, output_bfd = symbol->section->output_section->owner; } - ret = mips_elf64_final_gp (output_bfd, symbol, relocatable, - error_message, &gp); - if (ret != bfd_reloc_ok) - return ret; + ret = mips_elf64_final_gp (output_bfd, symbol, relocatable, + error_message, &gp); + if (ret != bfd_reloc_ok) + return ret; if (bfd_is_com_section (symbol->section)) relocation = 0; @@ -1621,7 +1998,7 @@ mips_elf64_gprel32_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, relocation += symbol->section->output_section->vma; relocation += symbol->section->output_offset; - if (reloc_entry->address > input_section->_cooked_size) + if (reloc_entry->address > bfd_get_section_limit (abfd, input_section)) return bfd_reloc_outofrange; /* Set val to the offset into the section or symbol. */ @@ -1707,14 +2084,11 @@ mips16_gprel_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, { bfd_boolean relocatable; bfd_reloc_status_type ret; + bfd_byte *location; bfd_vma gp; - unsigned short extend = 0; - unsigned short insn = 0; - bfd_signed_vma val; - bfd_vma relocation; - /* If we're relocating, and this is an external symbol with no - addend, we don't want to change anything. */ + /* If we're relocating, and this is an external symbol, we don't want + to change anything. */ if (output_bfd != NULL && (symbol->flags & BSF_SECTION_SYM) == 0 && (symbol->flags & BSF_LOCAL) != 0) @@ -1736,55 +2110,16 @@ mips16_gprel_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, if (ret != bfd_reloc_ok) return ret; - if (reloc_entry->address > input_section->_cooked_size) - return bfd_reloc_outofrange; + location = (bfd_byte *) data + reloc_entry->address; + _bfd_mips16_elf_reloc_unshuffle (abfd, reloc_entry->howto->type, FALSE, + location); + ret = _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry, + input_section, relocatable, + data, gp); + _bfd_mips16_elf_reloc_shuffle (abfd, reloc_entry->howto->type, !relocatable, + location); - if (bfd_is_com_section (symbol->section)) - relocation = 0; - else - relocation = symbol->value; - - relocation += symbol->section->output_section->vma; - relocation += symbol->section->output_offset; - - /* Set val to the offset into the section or symbol. */ - val = reloc_entry->addend; - - if (reloc_entry->howto->partial_inplace) - { - /* 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); - val += ((extend & 0x1f) << 11) | (extend & 0x7e0) | (insn & 0x1f); - } - - _bfd_mips_elf_sign_extend(val, 16); - - /* Adjust val for the final section location and GP value. If we - are producing relocatable output, we don't want to do this for - an external symbol. */ - if (! relocatable - || (symbol->flags & BSF_SECTION_SYM) != 0) - val += relocation - gp; - - if (reloc_entry->howto->partial_inplace) - { - bfd_put_16 (abfd, - (extend & 0xf800) | ((val >> 11) & 0x1f) | (val & 0x7e0), - (bfd_byte *) data + reloc_entry->address); - bfd_put_16 (abfd, - (insn & 0xffe0) | (val & 0x1f), - (bfd_byte *) data + reloc_entry->address + 2); - } - else - reloc_entry->addend = val; - - if (relocatable) - reloc_entry->address += input_section->output_offset; - else if (((val & ~0xffff) != ~0xffff) && ((val & ~0xffff) != 0)) - return bfd_reloc_overflow; - - return bfd_reloc_ok; + return ret; } /* A mapping from BFD reloc types to MIPS ELF reloc types. */ @@ -1802,7 +2137,7 @@ static const struct elf_reloc_map mips_reloc_map[] = /* There is no BFD reloc for R_MIPS_REL32. */ { BFD_RELOC_64, R_MIPS_64 }, { BFD_RELOC_CTOR, R_MIPS_64 }, - { BFD_RELOC_16_PCREL, R_MIPS_PC16 }, + { BFD_RELOC_16_PCREL_S2, R_MIPS_PC16 }, { BFD_RELOC_HI16_S, R_MIPS_HI16 }, { BFD_RELOC_LO16, R_MIPS_LO16 }, { BFD_RELOC_GPREL16, R_MIPS_GPREL16 }, @@ -1830,7 +2165,28 @@ static const struct elf_reloc_map mips_reloc_map[] = { BFD_RELOC_MIPS_REL16, R_MIPS_REL16 }, /* Use of R_MIPS_ADD_IMMEDIATE and R_MIPS_PJUMP is deprecated. */ { BFD_RELOC_MIPS_RELGOT, R_MIPS_RELGOT }, - { BFD_RELOC_MIPS_JALR, R_MIPS_JALR } + { BFD_RELOC_MIPS_JALR, R_MIPS_JALR }, + { BFD_RELOC_MIPS_TLS_DTPMOD32, R_MIPS_TLS_DTPMOD32 }, + { BFD_RELOC_MIPS_TLS_DTPREL32, R_MIPS_TLS_DTPREL32 }, + { BFD_RELOC_MIPS_TLS_DTPMOD64, R_MIPS_TLS_DTPMOD64 }, + { BFD_RELOC_MIPS_TLS_DTPREL64, R_MIPS_TLS_DTPREL64 }, + { BFD_RELOC_MIPS_TLS_GD, R_MIPS_TLS_GD }, + { BFD_RELOC_MIPS_TLS_LDM, R_MIPS_TLS_LDM }, + { BFD_RELOC_MIPS_TLS_DTPREL_HI16, R_MIPS_TLS_DTPREL_HI16 }, + { BFD_RELOC_MIPS_TLS_DTPREL_LO16, R_MIPS_TLS_DTPREL_LO16 }, + { BFD_RELOC_MIPS_TLS_GOTTPREL, R_MIPS_TLS_GOTTPREL }, + { BFD_RELOC_MIPS_TLS_TPREL32, R_MIPS_TLS_TPREL32 }, + { BFD_RELOC_MIPS_TLS_TPREL64, R_MIPS_TLS_TPREL64 }, + { BFD_RELOC_MIPS_TLS_TPREL_HI16, R_MIPS_TLS_TPREL_HI16 }, + { BFD_RELOC_MIPS_TLS_TPREL_LO16, R_MIPS_TLS_TPREL_LO16 } +}; + +static const struct elf_reloc_map mips16_reloc_map[] = +{ + { BFD_RELOC_MIPS16_JMP, R_MIPS16_26 - R_MIPS16_min }, + { BFD_RELOC_MIPS16_GPREL, R_MIPS16_GPREL - R_MIPS16_min }, + { BFD_RELOC_MIPS16_HI16_S, R_MIPS16_HI16 - R_MIPS16_min }, + { BFD_RELOC_MIPS16_LO16, R_MIPS16_LO16 - R_MIPS16_min }, }; /* Given a BFD reloc type, return a howto structure. */ @@ -1843,6 +2199,7 @@ bfd_elf64_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, /* FIXME: We default to RELA here instead of choosing the right relocation variant. */ reloc_howto_type *howto_table = mips_elf64_howto_table_rela; + reloc_howto_type *howto16_table = mips16_elf64_howto_table_rela; for (i = 0; i < sizeof (mips_reloc_map) / sizeof (struct elf_reloc_map); i++) @@ -1851,18 +2208,19 @@ bfd_elf64_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, return &howto_table[(int) mips_reloc_map[i].elf_val]; } + for (i = 0; i < sizeof (mips16_reloc_map) / sizeof (struct elf_reloc_map); + i++) + { + if (mips16_reloc_map[i].bfd_val == code) + return &howto16_table[(int) mips16_reloc_map[i].elf_val]; + } + switch (code) { - 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_16_PCREL_S2: - return &elf_mips_gnu_rela16_s2; default: bfd_set_error (bfd_error_bad_value); return NULL; @@ -1876,10 +2234,6 @@ mips_elf64_rtype_to_howto (unsigned int r_type, bfd_boolean rela_p) { switch (r_type) { - case R_MIPS16_26: - return &elf_mips16_jump_howto; - case R_MIPS16_GPREL: - return &elf_mips16_gprel_howto; case R_MIPS_GNU_VTINHERIT: return &elf_mips_gnu_vtinherit_howto; case R_MIPS_GNU_VTENTRY: @@ -1890,6 +2244,13 @@ mips_elf64_rtype_to_howto (unsigned int r_type, bfd_boolean rela_p) else return &elf_mips_gnu_rel16_s2; default: + if (r_type >= R_MIPS16_min && r_type < R_MIPS16_max) + { + if (rela_p) + return &mips16_elf64_howto_table_rela[r_type - R_MIPS16_min]; + else + return &mips16_elf64_howto_table_rel[r_type - R_MIPS16_min]; + } BFD_ASSERT (r_type < (unsigned int) R_MIPS_max); if (rela_p) return &mips_elf64_howto_table_rela[r_type]; @@ -1984,7 +2345,7 @@ mips_elf64_canonicalize_dynamic_reloc (bfd *abfd, arelent **storage, if (! (*slurp_relocs) (abfd, s, syms, TRUE)) return -1; - count = s->_raw_size / elf_section_data (s)->this_hdr.sh_entsize * 3; + count = s->size / elf_section_data (s)->this_hdr.sh_entsize * 3; p = s->relocation; for (i = 0; i < count; i++) *storage++ = p++; @@ -2120,7 +2481,7 @@ mips_elf64_slurp_one_reloc_table (bfd *abfd, asection *asect, case RSS_GP0: case RSS_LOC: /* FIXME: I think these need to be handled using - special howto structures. */ + special howto structures. */ BFD_ASSERT (0); break; @@ -2210,7 +2571,7 @@ mips_elf64_slurp_reloc_table (bfd *abfd, asection *asect, case because relocations against this section may use the dynamic symbol table, and in that case bfd_section_from_shdr in elf.c does not update the RELOC_COUNT. */ - if (asect->_raw_size == 0) + if (asect->size == 0) return TRUE; rel_hdr = &d->this_hdr; @@ -2352,6 +2713,8 @@ mips_elf64_write_rel (bfd *abfd, asection *sec, sym = *ptr->sym_ptr_ptr; if (sym == last_sym) n = last_sym_idx; + else if (bfd_is_abs_section (sym->section) && sym->value == 0) + n = STN_UNDEF; else { last_sym = sym; @@ -2448,6 +2811,8 @@ mips_elf64_write_rela (bfd *abfd, asection *sec, sym = *ptr->sym_ptr_ptr; if (sym == last_sym) n = last_sym_idx; + else if (bfd_is_abs_section (sym->section) && sym->value == 0) + n = STN_UNDEF; else { last_sym = sym; @@ -2539,7 +2904,7 @@ static bfd_boolean elf64_mips_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) { int offset; - unsigned int raw_size; + unsigned int size; switch (note->descsz) { @@ -2555,14 +2920,14 @@ elf64_mips_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) /* pr_reg */ offset = 112; - raw_size = 360; + size = 360; break; } /* Make a ".reg/999" section. */ return _bfd_elfcore_make_pseudosection (abfd, ".reg", - raw_size, note->descpos + offset); + size, note->descpos + offset); } static bfd_boolean @@ -2652,8 +3017,8 @@ const struct elf_size_info mips_elf64_size_info = sizeof (Elf64_External_Sym), sizeof (Elf64_External_Dyn), sizeof (Elf_External_Note), - 4, /* hash-table entry size */ - 3, /* internal relocations per external relocations */ + 4, /* hash-table entry size */ + 3, /* internal relocations per external relocations */ 64, /* arch_size */ 3, /* log_file_align */ ELFCLASS64, @@ -2739,6 +3104,7 @@ const struct elf_size_info mips_elf64_size_info = 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_find_inliner_info _bfd_mips_elf_find_inliner_info #define bfd_elf64_new_section_hook _bfd_mips_elf_new_section_hook #define bfd_elf64_set_section_contents _bfd_mips_elf_set_section_contents #define bfd_elf64_bfd_get_relocated_section_contents \ @@ -2801,10 +3167,10 @@ extern bfd_boolean bfd_elf64_archive_write_armap #undef ELF_MAXPAGESIZE -#define TARGET_LITTLE_SYM bfd_elf64_tradlittlemips_vec -#define TARGET_LITTLE_NAME "elf64-tradlittlemips" -#define TARGET_BIG_SYM bfd_elf64_tradbigmips_vec -#define TARGET_BIG_NAME "elf64-tradbigmips" +#define TARGET_LITTLE_SYM bfd_elf64_tradlittlemips_vec +#define TARGET_LITTLE_NAME "elf64-tradlittlemips" +#define TARGET_BIG_SYM bfd_elf64_tradbigmips_vec +#define TARGET_BIG_NAME "elf64-tradbigmips" /* The SVR4 MIPS ABI says that this should be 0x10000, and Linux uses page sizes of up to that limit, so we need to respect it. */ diff --git a/contrib/binutils/bfd/elf64-ppc.c b/contrib/binutils/bfd/elf64-ppc.c index bc9e0a765dc..f61ed8a8310 100644 --- a/contrib/binutils/bfd/elf64-ppc.c +++ b/contrib/binutils/bfd/elf64-ppc.c @@ -1,5 +1,5 @@ /* PowerPC64-specific support for 64-bit ELF. - Copyright 1999, 2000, 2001, 2002, 2003, 2004 + Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Written by Linus Nordberg, Swox AB , based on elf32-ppc.c by Ian Lance Taylor. @@ -19,7 +19,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* The 64-bit PowerPC ELF ABI may be found at http://www.linuxbase.org/spec/ELF/ppc64/PPC-elf64abi.txt, and @@ -35,6 +35,8 @@ static bfd_reloc_status_type ppc64_elf_ha_reloc (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); +static bfd_reloc_status_type ppc64_elf_branch_reloc + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type ppc64_elf_brtaken_reloc (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type ppc64_elf_sectoff_reloc @@ -49,7 +51,8 @@ static bfd_reloc_status_type ppc64_elf_toc64_reloc (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type ppc64_elf_unhandled_reloc (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); - +static bfd_vma opd_entry_value + (asection *, bfd_vma, asection **, bfd_vma *); #define TARGET_LITTLE_SYM bfd_elf64_powerpcle_vec #define TARGET_LITTLE_NAME "elf64-powerpcle" @@ -64,7 +67,6 @@ static bfd_reloc_status_type ppc64_elf_unhandled_reloc #define elf_backend_want_plt_sym 0 #define elf_backend_plt_alignment 3 #define elf_backend_plt_not_loaded 1 -#define elf_backend_got_symbol_offset 0 #define elf_backend_got_header_size 8 #define elf_backend_can_gc_sections 1 #define elf_backend_can_refcount 1 @@ -76,6 +78,7 @@ static bfd_reloc_status_type ppc64_elf_unhandled_reloc #define bfd_elf64_new_section_hook ppc64_elf_new_section_hook #define bfd_elf64_bfd_link_hash_table_create ppc64_elf_link_hash_table_create #define bfd_elf64_bfd_link_hash_table_free ppc64_elf_link_hash_table_free +#define bfd_elf64_get_synthetic_symtab ppc64_elf_get_synthetic_symtab #define elf_backend_object_p ppc64_elf_object_p #define elf_backend_grok_prstatus ppc64_elf_grok_prstatus @@ -83,13 +86,17 @@ static bfd_reloc_status_type ppc64_elf_unhandled_reloc #define elf_backend_create_dynamic_sections ppc64_elf_create_dynamic_sections #define elf_backend_copy_indirect_symbol ppc64_elf_copy_indirect_symbol #define elf_backend_add_symbol_hook ppc64_elf_add_symbol_hook +#define elf_backend_check_directives ppc64_elf_check_directives +#define elf_backend_archive_symbol_lookup ppc64_elf_archive_symbol_lookup #define elf_backend_check_relocs ppc64_elf_check_relocs +#define elf_backend_gc_mark_dynamic_ref ppc64_elf_gc_mark_dynamic_ref #define elf_backend_gc_mark_hook ppc64_elf_gc_mark_hook #define elf_backend_gc_sweep_hook ppc64_elf_gc_sweep_hook #define elf_backend_adjust_dynamic_symbol ppc64_elf_adjust_dynamic_symbol #define elf_backend_hide_symbol ppc64_elf_hide_symbol #define elf_backend_always_size_sections ppc64_elf_func_desc_adjust #define elf_backend_size_dynamic_sections ppc64_elf_size_dynamic_sections +#define elf_backend_action_discarded ppc64_elf_action_discarded #define elf_backend_relocate_section ppc64_elf_relocate_section #define elf_backend_finish_dynamic_symbol ppc64_elf_finish_dynamic_symbol #define elf_backend_reloc_type_class ppc64_elf_reloc_type_class @@ -168,9 +175,17 @@ static bfd_reloc_status_type ppc64_elf_unhandled_reloc #define LIS_R0_0 0x3c000000 /* lis %r0,0 */ #define ORI_R0_R0_0 0x60000000 /* ori %r0,%r0,0 */ -/* Instructions to save and restore floating point regs. */ +/* Instructions used by the save and restore reg functions. */ +#define STD_R0_0R1 0xf8010000 /* std %r0,0(%r1) */ +#define STD_R0_0R12 0xf80c0000 /* std %r0,0(%r12) */ +#define LD_R0_0R1 0xe8010000 /* ld %r0,0(%r1) */ +#define LD_R0_0R12 0xe80c0000 /* ld %r0,0(%r12) */ #define STFD_FR0_0R1 0xd8010000 /* stfd %fr0,0(%r1) */ #define LFD_FR0_0R1 0xc8010000 /* lfd %fr0,0(%r1) */ +#define LI_R12_0 0x39800000 /* li %r12,0 */ +#define STVX_VR0_R12_R0 0x7c0c01ce /* stvx %v0,%r12,%r0 */ +#define LVX_VR0_R12_R0 0x7c0c00ce /* lvx %v0,%r12,%r0 */ +#define MTLR_R0 0x7c0803a6 /* mtlr %r0 */ #define BLR 0x4e800020 /* blr */ /* Since .opd is an array of descriptors and each entry will end up @@ -303,7 +318,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = { FALSE, /* pc_relative */ 0, /* bitpos */ complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + ppc64_elf_branch_reloc, /* special_function */ "R_PPC64_ADDR14", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -352,7 +367,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = { TRUE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + ppc64_elf_branch_reloc, /* special_function */ "R_PPC64_REL24", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -367,7 +382,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = { TRUE, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ + ppc64_elf_branch_reloc, /* special_function */ "R_PPC64_REL14", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ @@ -2104,8 +2119,13 @@ ppc64_elf_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, arelent *cache_ptr, ppc_howto_init (); type = ELF64_R_TYPE (dst->r_info); - BFD_ASSERT (type < (sizeof (ppc64_elf_howto_table) - / sizeof (ppc64_elf_howto_table[0]))); + if (type >= (sizeof (ppc64_elf_howto_table) + / sizeof (ppc64_elf_howto_table[0]))) + { + (*_bfd_error_handler) (_("%B: invalid relocation type %d"), + abfd, (int) type); + type = R_PPC64_NONE; + } cache_ptr->howto = ppc64_elf_howto_table[type]; } @@ -2130,6 +2150,29 @@ ppc64_elf_ha_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, return bfd_reloc_continue; } +static bfd_reloc_status_type +ppc64_elf_branch_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, + void *data, asection *input_section, + bfd *output_bfd, char **error_message) +{ + if (output_bfd != NULL) + return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message); + + if (strcmp (symbol->section->name, ".opd") == 0 + && (symbol->section->owner->flags & DYNAMIC) == 0) + { + bfd_vma dest = opd_entry_value (symbol->section, + symbol->value + reloc_entry->addend, + NULL, NULL); + if (dest != (bfd_vma) -1) + reloc_entry->addend = dest - (symbol->value + + symbol->section->output_section->vma + + symbol->section->output_offset); + } + return bfd_reloc_continue; +} + static bfd_reloc_status_type ppc64_elf_brtaken_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, void *data, asection *input_section, @@ -2166,7 +2209,7 @@ ppc64_elf_brtaken_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, else if ((insn & (0x14 << 21)) == (0x10 << 21)) insn |= 0x08 << 21; else - return bfd_reloc_continue; + goto out; } else { @@ -2188,7 +2231,9 @@ ppc64_elf_brtaken_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, insn ^= 0x01 << 21; } bfd_put_32 (abfd, insn, (bfd_byte *) data + octets); - return bfd_reloc_continue; + out: + return ppc64_elf_branch_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message); } static bfd_reloc_status_type @@ -2331,12 +2376,24 @@ struct ppc64_elf_obj_tdata asection *got; asection *relgot; + union { + /* Used during garbage collection. We attach global symbols defined + on removed .opd entries to this section so that the sym is removed. */ + asection *deleted_section; + + /* Used when adding symbols. */ + bfd_boolean has_dotsym; + } u; + /* TLS local dynamic got entry handling. Suppose for multiple GOT sections means we potentially need one of these for each input bfd. */ union { bfd_signed_vma refcount; bfd_vma offset; } tlsld_got; + + /* A copy of relocs before they are modified for --emit-relocs. */ + Elf_Internal_Rela *opd_relocs; }; #define ppc64_elf_tdata(bfd) \ @@ -2357,6 +2414,17 @@ ppc64_elf_mkobject (bfd *abfd) return TRUE; } +/* Return 1 if target is one of ours. */ + +static bfd_boolean +is_ppc64_elf_target (const struct bfd_target *targ) +{ + extern const bfd_target bfd_elf64_powerpc_vec; + extern const bfd_target bfd_elf64_powerpcle_vec; + + return targ == &bfd_elf64_powerpc_vec || targ == &bfd_elf64_powerpcle_vec; +} + /* Fix bad default arch selected for a 64 bit input bfd when the default is 32 bit. */ @@ -2382,7 +2450,7 @@ ppc64_elf_object_p (bfd *abfd) static bfd_boolean ppc64_elf_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) { - size_t offset, raw_size; + size_t offset, size; if (note->descsz != 504) return FALSE; @@ -2395,11 +2463,11 @@ ppc64_elf_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) /* pr_reg */ offset = 112; - raw_size = 384; + size = 384; /* Make a ".reg/999" section. */ return _bfd_elfcore_make_pseudosection (abfd, ".reg", - raw_size, note->descpos + offset); + size, note->descpos + offset); } static bfd_boolean @@ -2430,13 +2498,13 @@ ppc64_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) const char *msg; if (bfd_big_endian (ibfd)) - msg = _("%s: compiled for a big endian system " + msg = _("%B: compiled for a big endian system " "and target is little endian"); else - msg = _("%s: compiled for a little endian system " + msg = _("%B: compiled for a little endian system " "and target is big endian"); - (*_bfd_error_handler) (msg, bfd_archive_filename (ibfd)); + (*_bfd_error_handler) (msg, ibfd); bfd_set_error (bfd_error_wrong_format); return FALSE; @@ -2447,11 +2515,11 @@ ppc64_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) /* Add extra PPC sections. */ -static struct bfd_elf_special_section const ppc64_elf_special_sections[]= +static const struct bfd_elf_special_section ppc64_elf_special_sections[]= { - { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, - { ".sbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, { ".plt", 4, 0, SHT_NOBITS, 0 }, + { ".sbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, + { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, { ".toc", 4, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, { ".toc1", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, { ".tocbss", 7, 0, SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, @@ -2492,6 +2560,415 @@ ppc64_elf_new_section_hook (bfd *abfd, asection *sec) return _bfd_elf_new_section_hook (abfd, sec); } + +static void * +get_opd_info (asection * sec) +{ + if (sec != NULL + && ppc64_elf_section_data (sec) != NULL + && ppc64_elf_section_data (sec)->opd.adjust != NULL) + return ppc64_elf_section_data (sec)->opd.adjust; + return NULL; +} + +/* Parameters for the qsort hook. */ +static asection *synthetic_opd; +static bfd_boolean synthetic_relocatable; + +/* qsort comparison function for ppc64_elf_get_synthetic_symtab. */ + +static int +compare_symbols (const void *ap, const void *bp) +{ + const asymbol *a = * (const asymbol **) ap; + const asymbol *b = * (const asymbol **) bp; + + /* Section symbols first. */ + if ((a->flags & BSF_SECTION_SYM) && !(b->flags & BSF_SECTION_SYM)) + return -1; + if (!(a->flags & BSF_SECTION_SYM) && (b->flags & BSF_SECTION_SYM)) + return 1; + + /* then .opd symbols. */ + if (a->section == synthetic_opd && b->section != synthetic_opd) + return -1; + if (a->section != synthetic_opd && b->section == synthetic_opd) + return 1; + + /* then other code symbols. */ + if ((a->section->flags & (SEC_CODE | SEC_ALLOC | SEC_THREAD_LOCAL)) + == (SEC_CODE | SEC_ALLOC) + && (b->section->flags & (SEC_CODE | SEC_ALLOC | SEC_THREAD_LOCAL)) + != (SEC_CODE | SEC_ALLOC)) + return -1; + + if ((a->section->flags & (SEC_CODE | SEC_ALLOC | SEC_THREAD_LOCAL)) + != (SEC_CODE | SEC_ALLOC) + && (b->section->flags & (SEC_CODE | SEC_ALLOC | SEC_THREAD_LOCAL)) + == (SEC_CODE | SEC_ALLOC)) + return 1; + + if (synthetic_relocatable) + { + if (a->section->id < b->section->id) + return -1; + + if (a->section->id > b->section->id) + return 1; + } + + if (a->value + a->section->vma < b->value + b->section->vma) + return -1; + + if (a->value + a->section->vma > b->value + b->section->vma) + return 1; + + /* For syms with the same value, prefer strong dynamic global function + syms over other syms. */ + if ((a->flags & BSF_GLOBAL) != 0 && (b->flags & BSF_GLOBAL) == 0) + return -1; + + if ((a->flags & BSF_GLOBAL) == 0 && (b->flags & BSF_GLOBAL) != 0) + return 1; + + if ((a->flags & BSF_FUNCTION) != 0 && (b->flags & BSF_FUNCTION) == 0) + return -1; + + if ((a->flags & BSF_FUNCTION) == 0 && (b->flags & BSF_FUNCTION) != 0) + return 1; + + if ((a->flags & BSF_WEAK) == 0 && (b->flags & BSF_WEAK) != 0) + return -1; + + if ((a->flags & BSF_WEAK) != 0 && (b->flags & BSF_WEAK) == 0) + return 1; + + if ((a->flags & BSF_DYNAMIC) != 0 && (b->flags & BSF_DYNAMIC) == 0) + return -1; + + if ((a->flags & BSF_DYNAMIC) == 0 && (b->flags & BSF_DYNAMIC) != 0) + return 1; + + return 0; +} + +/* Search SYMS for a symbol of the given VALUE. */ + +static asymbol * +sym_exists_at (asymbol **syms, long lo, long hi, int id, bfd_vma value) +{ + long mid; + + if (id == -1) + { + while (lo < hi) + { + mid = (lo + hi) >> 1; + if (syms[mid]->value + syms[mid]->section->vma < value) + lo = mid + 1; + else if (syms[mid]->value + syms[mid]->section->vma > value) + hi = mid; + else + return syms[mid]; + } + } + else + { + while (lo < hi) + { + mid = (lo + hi) >> 1; + if (syms[mid]->section->id < id) + lo = mid + 1; + else if (syms[mid]->section->id > id) + hi = mid; + else if (syms[mid]->value < value) + lo = mid + 1; + else if (syms[mid]->value > value) + hi = mid; + else + return syms[mid]; + } + } + return NULL; +} + +/* Create synthetic symbols, effectively restoring "dot-symbol" function + entry syms. */ + +static long +ppc64_elf_get_synthetic_symtab (bfd *abfd, + long static_count, asymbol **static_syms, + long dyn_count, asymbol **dyn_syms, + asymbol **ret) +{ + asymbol *s; + long i; + long count; + char *names; + long symcount, codesecsym, codesecsymend, secsymend, opdsymend; + asection *opd; + bfd_boolean relocatable = (abfd->flags & (EXEC_P | DYNAMIC)) == 0; + asymbol **syms; + + *ret = NULL; + + opd = bfd_get_section_by_name (abfd, ".opd"); + if (opd == NULL) + return 0; + + symcount = static_count; + if (!relocatable) + symcount += dyn_count; + if (symcount == 0) + return 0; + + syms = bfd_malloc ((symcount + 1) * sizeof (*syms)); + if (syms == NULL) + return -1; + + if (!relocatable && static_count != 0 && dyn_count != 0) + { + /* Use both symbol tables. */ + memcpy (syms, static_syms, static_count * sizeof (*syms)); + memcpy (syms + static_count, dyn_syms, (dyn_count + 1) * sizeof (*syms)); + } + else if (!relocatable && static_count == 0) + memcpy (syms, dyn_syms, (symcount + 1) * sizeof (*syms)); + else + memcpy (syms, static_syms, (symcount + 1) * sizeof (*syms)); + + synthetic_opd = opd; + synthetic_relocatable = relocatable; + qsort (syms, symcount, sizeof (*syms), compare_symbols); + + if (!relocatable && symcount > 1) + { + long j; + /* Trim duplicate syms, since we may have merged the normal and + dynamic symbols. Actually, we only care about syms that have + different values, so trim any with the same value. */ + for (i = 1, j = 1; i < symcount; ++i) + if (syms[i - 1]->value + syms[i - 1]->section->vma + != syms[i]->value + syms[i]->section->vma) + syms[j++] = syms[i]; + symcount = j; + } + + i = 0; + if (syms[i]->section == opd) + ++i; + codesecsym = i; + + for (; i < symcount; ++i) + if (((syms[i]->section->flags & (SEC_CODE | SEC_ALLOC | SEC_THREAD_LOCAL)) + != (SEC_CODE | SEC_ALLOC)) + || (syms[i]->flags & BSF_SECTION_SYM) == 0) + break; + codesecsymend = i; + + for (; i < symcount; ++i) + if ((syms[i]->flags & BSF_SECTION_SYM) == 0) + break; + secsymend = i; + + for (; i < symcount; ++i) + if (syms[i]->section != opd) + break; + opdsymend = i; + + for (; i < symcount; ++i) + if ((syms[i]->section->flags & (SEC_CODE | SEC_ALLOC | SEC_THREAD_LOCAL)) + != (SEC_CODE | SEC_ALLOC)) + break; + symcount = i; + + count = 0; + if (opdsymend == secsymend) + goto done; + + if (relocatable) + { + bfd_boolean (*slurp_relocs) (bfd *, asection *, asymbol **, bfd_boolean); + arelent *r; + size_t size; + long relcount; + + slurp_relocs = get_elf_backend_data (abfd)->s->slurp_reloc_table; + relcount = (opd->flags & SEC_RELOC) ? opd->reloc_count : 0; + if (relcount == 0) + goto done; + + if (!(*slurp_relocs) (abfd, opd, static_syms, FALSE)) + { + count = -1; + goto done; + } + + size = 0; + for (i = secsymend, r = opd->relocation; i < opdsymend; ++i) + { + asymbol *sym; + + while (r < opd->relocation + relcount + && r->address < syms[i]->value + opd->vma) + ++r; + + if (r == opd->relocation + relcount) + break; + + if (r->address != syms[i]->value + opd->vma) + continue; + + if (r->howto->type != R_PPC64_ADDR64) + continue; + + sym = *r->sym_ptr_ptr; + if (!sym_exists_at (syms, opdsymend, symcount, + sym->section->id, sym->value + r->addend)) + { + ++count; + size += sizeof (asymbol); + size += strlen (syms[i]->name) + 2; + } + } + + s = *ret = bfd_malloc (size); + if (s == NULL) + { + count = -1; + goto done; + } + + names = (char *) (s + count); + + for (i = secsymend, r = opd->relocation; i < opdsymend; ++i) + { + asymbol *sym; + + while (r < opd->relocation + relcount + && r->address < syms[i]->value + opd->vma) + ++r; + + if (r == opd->relocation + relcount) + break; + + if (r->address != syms[i]->value + opd->vma) + continue; + + if (r->howto->type != R_PPC64_ADDR64) + continue; + + sym = *r->sym_ptr_ptr; + if (!sym_exists_at (syms, opdsymend, symcount, + sym->section->id, sym->value + r->addend)) + { + size_t len; + + *s = *syms[i]; + s->section = sym->section; + s->value = sym->value + r->addend; + s->name = names; + *names++ = '.'; + len = strlen (syms[i]->name); + memcpy (names, syms[i]->name, len + 1); + names += len + 1; + s++; + } + } + } + else + { + bfd_byte *contents; + size_t size; + + if (!bfd_malloc_and_get_section (abfd, opd, &contents)) + { + if (contents) + { + free_contents_and_exit: + free (contents); + } + count = -1; + goto done; + } + + size = 0; + for (i = secsymend; i < opdsymend; ++i) + { + bfd_vma ent; + + ent = bfd_get_64 (abfd, contents + syms[i]->value); + if (!sym_exists_at (syms, opdsymend, symcount, -1, ent)) + { + ++count; + size += sizeof (asymbol); + size += strlen (syms[i]->name) + 2; + } + } + + s = *ret = bfd_malloc (size); + if (s == NULL) + goto free_contents_and_exit; + + names = (char *) (s + count); + + for (i = secsymend; i < opdsymend; ++i) + { + bfd_vma ent; + + ent = bfd_get_64 (abfd, contents + syms[i]->value); + if (!sym_exists_at (syms, opdsymend, symcount, -1, ent)) + { + long lo, hi; + size_t len; + asection *sec = abfd->sections; + + *s = *syms[i]; + lo = codesecsym; + hi = codesecsymend; + while (lo < hi) + { + long mid = (lo + hi) >> 1; + if (syms[mid]->section->vma < ent) + lo = mid + 1; + else if (syms[mid]->section->vma > ent) + hi = mid; + else + { + sec = syms[mid]->section; + break; + } + } + + if (lo >= hi && lo > codesecsym) + sec = syms[lo - 1]->section; + + for (; sec != NULL; sec = sec->next) + { + if (sec->vma > ent) + break; + if ((sec->flags & SEC_ALLOC) == 0 + || (sec->flags & SEC_LOAD) == 0) + break; + if ((sec->flags & SEC_CODE) != 0) + s->section = sec; + } + s->value = ent - s->section->vma; + s->name = names; + *names++ = '.'; + len = strlen (syms[i]->name); + memcpy (names, syms[i]->name, len + 1); + names += len + 1; + s++; + } + } + free (contents); + } + + done: + free (syms); + return count; +} /* The following functions are specific to the ELF linker, while functions above are used generally. Those named ppc64_elf_* are @@ -2559,7 +3036,11 @@ ppc64_elf_new_section_hook (bfd *abfd, asection *sec) creating a shared library containing foo, we need to have both symbols dynamic so that references to .foo are satisfied during the early stages of linking. Otherwise the linker might decide to pull in a - definition from some other object, eg. a static library. */ + definition from some other object, eg. a static library. + + Update: As of August 2004, we support a new convention. Function + calls may use the function descriptor symbol, ie. "bl foo". This + behaves exactly as "bl .foo". */ /* The linker needs to keep track of the number of relocs that it decides to copy as dynamic relocs in check_relocs for each symbol. @@ -2669,7 +3150,10 @@ struct plt_entry . bctr ppc_stub_plt_call: - Used to call a function in a shared library. + Used to call a function in a shared library. If it so happens that + the plt entry referenced crosses a 64k boundary, then an extra + "addis %r12,%r12,1" will be inserted before the load at xxx+8 or + xxx+16 as appropriate. . addis %r12,%r2,xxx@toc@ha . std %r2,40(%r1) . ld %r11,xxx+0@toc@l(%r12) @@ -2739,7 +3223,7 @@ struct ppc_branch_hash_entry { /* Base hash table entry structure. */ struct bfd_hash_entry root; - /* Offset within .branch_lt. */ + /* Offset within branch lookup table. */ unsigned int offset; /* Generation marker. */ @@ -2758,16 +3242,21 @@ struct ppc_link_hash_entry struct ppc_dyn_relocs *dyn_relocs; /* Link between function code and descriptor symbols. */ - struct elf_link_hash_entry *oh; + struct ppc_link_hash_entry *oh; /* Flag function code and descriptor symbols. */ unsigned int is_func:1; unsigned int is_func_descriptor:1; - unsigned int is_entry:1; + unsigned int fake:1; - /* Whether global opd sym has been adjusted or not. */ + /* Whether global opd/toc sym has been adjusted or not. + After ppc64_elf_edit_opd/ppc64_elf_edit_toc has run, this flag + should be set for all globals defined in any opd/toc section. */ unsigned int adjust_done:1; + /* Set if we twiddled this symbol to weak at some stage. */ + unsigned int was_undefined:1; + /* Contexts in which symbol is used in the GOT (or TOC). TLS_GD .. TLS_EXPLICIT bits are or'd into the mask as the corresponding relocs are encountered during check_relocs. @@ -2816,10 +3305,6 @@ struct ppc_link_hash_table bfd_vma toc_off; } *stub_group; - /* Support for multiple toc sections. */ - unsigned int no_multi_toc; - unsigned int multi_toc_needed; - /* Temp used when calculating TOC pointers. */ bfd_vma toc_curr; @@ -2843,24 +3328,32 @@ struct ppc_link_hash_table asection *brlt; asection *relbrlt; - /* Shortcut to .__tls_get_addr. */ - struct elf_link_hash_entry *tls_get_addr; + /* Shortcut to .__tls_get_addr and __tls_get_addr. */ + struct ppc_link_hash_entry *tls_get_addr; + struct ppc_link_hash_entry *tls_get_addr_fd; /* Statistics. */ unsigned long stub_count[ppc_stub_plt_call]; + /* Number of stubs against global syms. */ + unsigned long stub_globals; + /* Set if we should emit symbols for stubs. */ - unsigned int emit_stub_syms; + unsigned int emit_stub_syms:1; + + /* Support for multiple toc sections. */ + unsigned int no_multi_toc:1; + unsigned int multi_toc_needed:1; /* Set on error. */ - unsigned int stub_error; + unsigned int stub_error:1; /* Flag set when small branches are detected. Used to select suitable defaults for the stub group size. */ - unsigned int has_14bit_branch; + unsigned int has_14bit_branch:1; - /* Set if we detect a reference undefined weak symbol. */ - unsigned int have_undefweak; + /* Temp used by ppc64_elf_check_directives. */ + unsigned int twiddled_syms:1; /* Incremented every time we size stubs. */ unsigned int stub_iteration; @@ -2869,6 +3362,12 @@ struct ppc_link_hash_table struct sym_sec_cache sym_sec; }; +/* Rename some of the generic section flags to better document how they + are used here. */ +#define has_toc_reloc has_gp_reloc +#define makes_toc_func_call need_finalize_relax +#define call_check_in_progress reloc_done + /* Get the ppc64 ELF linker hash table from a link_info structure. */ #define ppc_hash_table(p) \ @@ -2971,14 +3470,9 @@ link_hash_newfunc (struct bfd_hash_entry *entry, { struct ppc_link_hash_entry *eh = (struct ppc_link_hash_entry *) entry; - eh->stub_cache = NULL; - eh->dyn_relocs = NULL; - eh->oh = NULL; - eh->is_func = 0; - eh->is_func_descriptor = 0; - eh->is_entry = 0; - eh->adjust_done = 0; - eh->tls_mask = 0; + memset (&eh->stub_cache, 0, + (sizeof (struct ppc_link_hash_entry) + - offsetof (struct ppc_link_hash_entry, stub_cache))); } return entry; @@ -2996,28 +3490,35 @@ ppc64_elf_link_hash_table_create (bfd *abfd) if (htab == NULL) return NULL; - if (! _bfd_elf_link_hash_table_init (&htab->elf, abfd, link_hash_newfunc)) + if (!_bfd_elf_link_hash_table_init (&htab->elf, abfd, link_hash_newfunc, + sizeof (struct ppc_link_hash_entry))) { free (htab); return NULL; } /* Init the stub hash table too. */ - if (!bfd_hash_table_init (&htab->stub_hash_table, stub_hash_newfunc)) + if (!bfd_hash_table_init (&htab->stub_hash_table, stub_hash_newfunc, + sizeof (struct ppc_stub_hash_entry))) return NULL; /* And the branch hash table. */ - if (!bfd_hash_table_init (&htab->branch_hash_table, branch_hash_newfunc)) + if (!bfd_hash_table_init (&htab->branch_hash_table, branch_hash_newfunc, + sizeof (struct ppc_branch_hash_entry))) return NULL; /* Initializing two fields of the union is just cosmetic. We really only care about glist, but when compiled on a 32-bit host the bfd_vma fields are larger. Setting the bfd_vma to zero makes debugger inspection of these fields look nicer. */ - htab->elf.init_refcount.refcount = 0; - htab->elf.init_refcount.glist = NULL; - htab->elf.init_offset.offset = 0; - htab->elf.init_offset.glist = NULL; + htab->elf.init_got_refcount.refcount = 0; + htab->elf.init_got_refcount.glist = NULL; + htab->elf.init_plt_refcount.refcount = 0; + htab->elf.init_plt_refcount.glist = NULL; + htab->elf.init_got_offset.offset = 0; + htab->elf.init_got_offset.glist = NULL; + htab->elf.init_plt_offset.offset = 0; + htab->elf.init_plt_offset.glist = NULL; return &htab->elf.root; } @@ -3071,27 +3572,29 @@ ppc_stub_name (const asection *input_section, { len = 8 + 1 + strlen (h->elf.root.root.string) + 1 + 8 + 1; stub_name = bfd_malloc (len); - if (stub_name != NULL) - { - sprintf (stub_name, "%08x.%s+%x", - input_section->id & 0xffffffff, - h->elf.root.root.string, - (int) rel->r_addend & 0xffffffff); - } + if (stub_name == NULL) + return stub_name; + + sprintf (stub_name, "%08x.%s+%x", + input_section->id & 0xffffffff, + h->elf.root.root.string, + (int) rel->r_addend & 0xffffffff); } else { len = 8 + 1 + 8 + 1 + 8 + 1 + 8 + 1; stub_name = bfd_malloc (len); - if (stub_name != NULL) - { - sprintf (stub_name, "%08x.%x:%x+%x", - input_section->id & 0xffffffff, - sym_sec->id & 0xffffffff, - (int) ELF64_R_SYM (rel->r_info) & 0xffffffff, - (int) rel->r_addend & 0xffffffff); - } + if (stub_name == NULL) + return stub_name; + + sprintf (stub_name, "%08x.%x:%x+%x", + input_section->id & 0xffffffff, + sym_sec->id & 0xffffffff, + (int) ELF64_R_SYM (rel->r_info) & 0xffffffff, + (int) rel->r_addend & 0xffffffff); } + if (stub_name[len - 2] == '+' && stub_name[len - 1] == '0') + stub_name[len - 2] = 0; return stub_name; } @@ -3101,12 +3604,11 @@ ppc_stub_name (const asection *input_section, static struct ppc_stub_hash_entry * ppc_get_stub_entry (const asection *input_section, const asection *sym_sec, - struct elf_link_hash_entry *hash, + struct ppc_link_hash_entry *h, const Elf_Internal_Rela *rel, struct ppc_link_hash_table *htab) { struct ppc_stub_hash_entry *stub_entry; - struct ppc_link_hash_entry *h = (struct ppc_link_hash_entry *) hash; const asection *id_sec; /* If this input section is part of a group of sections sharing one @@ -3185,9 +3687,8 @@ ppc_add_stub (const char *stub_name, TRUE, FALSE); if (stub_entry == NULL) { - (*_bfd_error_handler) (_("%s: cannot create stub entry %s"), - bfd_archive_filename (section->owner), - stub_name); + (*_bfd_error_handler) (_("%B: cannot create stub entry %s"), + section->owner, stub_name); return NULL; } @@ -3210,25 +3711,37 @@ create_linkage_sections (bfd *dynobj, struct bfd_link_info *info) /* Create .sfpr for code to save and restore fp regs. */ flags = (SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_READONLY | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED); - htab->sfpr = bfd_make_section_anyway (dynobj, ".sfpr"); + htab->sfpr = bfd_make_section_anyway_with_flags (dynobj, ".sfpr", + flags); if (htab->sfpr == NULL - || ! bfd_set_section_flags (dynobj, htab->sfpr, flags) || ! bfd_set_section_alignment (dynobj, htab->sfpr, 2)) return FALSE; /* Create .glink for lazy dynamic linking support. */ - htab->glink = bfd_make_section_anyway (dynobj, ".glink"); + htab->glink = bfd_make_section_anyway_with_flags (dynobj, ".glink", + flags); if (htab->glink == NULL - || ! bfd_set_section_flags (dynobj, htab->glink, flags) || ! bfd_set_section_alignment (dynobj, htab->glink, 2)) return FALSE; - /* Create .branch_lt for plt_branch stubs. */ - flags = (SEC_ALLOC | SEC_LOAD - | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED); - htab->brlt = bfd_make_section_anyway (dynobj, ".branch_lt"); + /* Create branch lookup table for plt_branch stubs. */ + if (info->shared) + { + flags = (SEC_ALLOC | SEC_LOAD + | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED); + htab->brlt + = bfd_make_section_anyway_with_flags (dynobj, ".data.rel.ro.brlt", + flags); + } + else + { + flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY + | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED); + htab->brlt + = bfd_make_section_anyway_with_flags (dynobj, ".rodata.brlt", flags); + } + if (htab->brlt == NULL - || ! bfd_set_section_flags (dynobj, htab->brlt, flags) || ! bfd_set_section_alignment (dynobj, htab->brlt, 3)) return FALSE; @@ -3236,12 +3749,25 @@ create_linkage_sections (bfd *dynobj, struct bfd_link_info *info) { flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED); - htab->relbrlt = bfd_make_section_anyway (dynobj, ".rela.branch_lt"); - if (!htab->relbrlt - || ! bfd_set_section_flags (dynobj, htab->relbrlt, flags) - || ! bfd_set_section_alignment (dynobj, htab->relbrlt, 3)) - return FALSE; + htab->relbrlt + = bfd_make_section_anyway_with_flags (dynobj, ".rela.data.rel.ro.brlt", + flags); } + else if (info->emitrelocations) + { + flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY + | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED); + htab->relbrlt + = bfd_make_section_anyway_with_flags (dynobj, ".rela.rodata.brlt", + flags); + } + else + return TRUE; + + if (!htab->relbrlt + || ! bfd_set_section_alignment (dynobj, htab->relbrlt, 3)) + return FALSE; + return TRUE; } @@ -3268,15 +3794,14 @@ create_got_section (bfd *abfd, struct bfd_link_info *info) flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED); - got = bfd_make_section_anyway (abfd, ".got"); + got = bfd_make_section_anyway_with_flags (abfd, ".got", flags); if (!got - || !bfd_set_section_flags (abfd, got, flags) || !bfd_set_section_alignment (abfd, got, 3)) return FALSE; - relgot = bfd_make_section_anyway (abfd, ".rela.got"); + relgot = bfd_make_section_anyway_with_flags (abfd, ".rela.got", + flags | SEC_READONLY); if (!relgot - || ! bfd_set_section_flags (abfd, relgot, flags | SEC_READONLY) || ! bfd_set_section_alignment (abfd, relgot, 3)) return FALSE; @@ -3311,16 +3836,49 @@ ppc64_elf_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info) return TRUE; } +/* Merge PLT info on FROM with that on TO. */ + +static void +move_plt_plist (struct ppc_link_hash_entry *from, + struct ppc_link_hash_entry *to) +{ + if (from->elf.plt.plist != NULL) + { + if (to->elf.plt.plist != NULL) + { + struct plt_entry **entp; + struct plt_entry *ent; + + for (entp = &from->elf.plt.plist; (ent = *entp) != NULL; ) + { + struct plt_entry *dent; + + for (dent = to->elf.plt.plist; dent != NULL; dent = dent->next) + if (dent->addend == ent->addend) + { + dent->plt.refcount += ent->plt.refcount; + *entp = ent->next; + break; + } + if (dent == NULL) + entp = &ent->next; + } + *entp = to->elf.plt.plist; + } + + to->elf.plt.plist = from->elf.plt.plist; + from->elf.plt.plist = NULL; + } +} + /* Copy the extra info we tack onto an elf_link_hash_entry. */ static void -ppc64_elf_copy_indirect_symbol - (const struct elf_backend_data *bed ATTRIBUTE_UNUSED, - struct elf_link_hash_entry *dir, - struct elf_link_hash_entry *ind) +ppc64_elf_copy_indirect_symbol (struct bfd_link_info *info, + struct elf_link_hash_entry *dir, + struct elf_link_hash_entry *ind) { struct ppc_link_hash_entry *edir, *eind; - flagword mask; edir = (struct ppc_link_hash_entry *) dir; eind = (struct ppc_link_hash_entry *) ind; @@ -3333,10 +3891,7 @@ ppc64_elf_copy_indirect_symbol struct ppc_dyn_relocs **pp; struct ppc_dyn_relocs *p; - if (eind->elf.root.type == bfd_link_hash_indirect) - abort (); - - /* Add reloc counts against the weak sym to the strong sym + /* Add reloc counts against the indirect sym to the direct sym list. Merge any entries against the same section. */ for (pp = &eind->dyn_relocs; (p = *pp) != NULL; ) { @@ -3362,21 +3917,20 @@ ppc64_elf_copy_indirect_symbol edir->is_func |= eind->is_func; edir->is_func_descriptor |= eind->is_func_descriptor; - edir->is_entry |= eind->is_entry; edir->tls_mask |= eind->tls_mask; - mask = (ELF_LINK_HASH_REF_DYNAMIC | ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_REF_REGULAR_NONWEAK | ELF_LINK_NON_GOT_REF - | ELF_LINK_HASH_NEEDS_PLT); /* If called to transfer flags for a weakdef during processing - of elf_adjust_dynamic_symbol, don't copy ELF_LINK_NON_GOT_REF. + of elf_adjust_dynamic_symbol, don't copy NON_GOT_REF. We clear it ourselves for ELIMINATE_COPY_RELOCS. */ - if (ELIMINATE_COPY_RELOCS - && eind->elf.root.type != bfd_link_hash_indirect - && (edir->elf.elf_link_hash_flags & ELF_LINK_HASH_DYNAMIC_ADJUSTED) != 0) - mask &= ~ELF_LINK_NON_GOT_REF; + if (!(ELIMINATE_COPY_RELOCS + && eind->elf.root.type != bfd_link_hash_indirect + && edir->elf.dynamic_adjusted)) + edir->elf.non_got_ref |= eind->elf.non_got_ref; - edir->elf.elf_link_hash_flags |= eind->elf.elf_link_hash_flags & mask; + edir->elf.ref_dynamic |= eind->elf.ref_dynamic; + edir->elf.ref_regular |= eind->elf.ref_regular; + edir->elf.ref_regular_nonweak |= eind->elf.ref_regular_nonweak; + edir->elf.needs_plt |= eind->elf.needs_plt; /* If we were called to copy over info for a weak sym, that's all. */ if (eind->elf.root.type != bfd_link_hash_indirect) @@ -3415,82 +3969,261 @@ ppc64_elf_copy_indirect_symbol } /* And plt entries. */ - if (eind->elf.plt.plist != NULL) - { - if (edir->elf.plt.plist != NULL) - { - struct plt_entry **entp; - struct plt_entry *ent; - - for (entp = &eind->elf.plt.plist; (ent = *entp) != NULL; ) - { - struct plt_entry *dent; - - for (dent = edir->elf.plt.plist; dent != NULL; dent = dent->next) - if (dent->addend == ent->addend) - { - dent->plt.refcount += ent->plt.refcount; - *entp = ent->next; - break; - } - if (dent == NULL) - entp = &ent->next; - } - *entp = edir->elf.plt.plist; - } - - edir->elf.plt.plist = eind->elf.plt.plist; - eind->elf.plt.plist = NULL; - } - - if (edir->elf.dynindx == -1) + move_plt_plist (eind, edir); + + if (eind->elf.dynindx != -1) { + if (edir->elf.dynindx != -1) + _bfd_elf_strtab_delref (elf_hash_table (info)->dynstr, + edir->elf.dynstr_index); edir->elf.dynindx = eind->elf.dynindx; edir->elf.dynstr_index = eind->elf.dynstr_index; eind->elf.dynindx = -1; eind->elf.dynstr_index = 0; } - else - BFD_ASSERT (eind->elf.dynindx == -1); } -/* Set a flag, used by ppc64_elf_gc_mark_hook, on the entry symbol and - symbols undefined on the command-line. */ +/* Find the function descriptor hash entry from the given function code + hash entry FH. Link the entries via their OH fields. */ -bfd_boolean -ppc64_elf_mark_entry_syms (struct bfd_link_info *info) +static struct ppc_link_hash_entry * +get_fdh (struct ppc_link_hash_entry *fh, struct ppc_link_hash_table *htab) { - struct ppc_link_hash_table *htab; - struct bfd_sym_chain *sym; + struct ppc_link_hash_entry *fdh = fh->oh; - htab = ppc_hash_table (info); - for (sym = info->gc_sym_list; sym; sym = sym->next) + if (fdh == NULL) { - struct elf_link_hash_entry *h; + const char *fd_name = fh->elf.root.root.string + 1; - h = elf_link_hash_lookup (&htab->elf, sym->name, FALSE, FALSE, FALSE); - if (h != NULL) - ((struct ppc_link_hash_entry *) h)->is_entry = 1; + fdh = (struct ppc_link_hash_entry *) + elf_link_hash_lookup (&htab->elf, fd_name, FALSE, FALSE, FALSE); + if (fdh != NULL) + { + fdh->is_func_descriptor = 1; + fdh->oh = fh; + fh->is_func = 1; + fh->oh = fdh; + } } - return TRUE; + + return fdh; } -/* Hack symbols defined in .opd sections to be function type. */ +/* Make a fake function descriptor sym for the code sym FH. */ + +static struct ppc_link_hash_entry * +make_fdh (struct bfd_link_info *info, + struct ppc_link_hash_entry *fh) +{ + bfd *abfd; + asymbol *newsym; + struct bfd_link_hash_entry *bh; + struct ppc_link_hash_entry *fdh; + + abfd = fh->elf.root.u.undef.abfd; + newsym = bfd_make_empty_symbol (abfd); + newsym->name = fh->elf.root.root.string + 1; + newsym->section = bfd_und_section_ptr; + newsym->value = 0; + newsym->flags = BSF_WEAK; + + bh = NULL; + if (!_bfd_generic_link_add_one_symbol (info, abfd, newsym->name, + newsym->flags, newsym->section, + newsym->value, NULL, FALSE, FALSE, + &bh)) + return NULL; + + fdh = (struct ppc_link_hash_entry *) bh; + fdh->elf.non_elf = 0; + fdh->fake = 1; + fdh->is_func_descriptor = 1; + fdh->oh = fh; + fh->is_func = 1; + fh->oh = fdh; + return fdh; +} + +/* Hacks to support old ABI code. + When making function calls, old ABI code references function entry + points (dot symbols), while new ABI code references the function + descriptor symbol. We need to make any combination of reference and + definition work together, without breaking archive linking. + + For a defined function "foo" and an undefined call to "bar": + An old object defines "foo" and ".foo", references ".bar" (possibly + "bar" too). + A new object defines "foo" and references "bar". + + A new object thus has no problem with its undefined symbols being + satisfied by definitions in an old object. On the other hand, the + old object won't have ".bar" satisfied by a new object. */ + +/* Fix function descriptor symbols defined in .opd sections to be + function type. */ static bfd_boolean -ppc64_elf_add_symbol_hook (bfd *ibfd ATTRIBUTE_UNUSED, +ppc64_elf_add_symbol_hook (bfd *ibfd, struct bfd_link_info *info ATTRIBUTE_UNUSED, Elf_Internal_Sym *isym, - const char **name ATTRIBUTE_UNUSED, + const char **name, flagword *flags ATTRIBUTE_UNUSED, asection **sec, bfd_vma *value ATTRIBUTE_UNUSED) { - if (strcmp (bfd_get_section_name (ibfd, *sec), ".opd") == 0) + if (*sec != NULL + && strcmp (bfd_get_section_name (ibfd, *sec), ".opd") == 0) isym->st_info = ELF_ST_INFO (ELF_ST_BIND (isym->st_info), STT_FUNC); + + if ((*name)[0] == '.' + && ELF_ST_BIND (isym->st_info) == STB_GLOBAL + && ELF_ST_TYPE (isym->st_info) < STT_SECTION + && is_ppc64_elf_target (ibfd->xvec)) + ppc64_elf_tdata (ibfd)->u.has_dotsym = 1; + return TRUE; } +/* This function makes an old ABI object reference to ".bar" cause the + inclusion of a new ABI object archive that defines "bar". + NAME is a symbol defined in an archive. Return a symbol in the hash + table that might be satisfied by the archive symbols. */ + +static struct elf_link_hash_entry * +ppc64_elf_archive_symbol_lookup (bfd *abfd, + struct bfd_link_info *info, + const char *name) +{ + struct elf_link_hash_entry *h; + char *dot_name; + size_t len; + + h = _bfd_elf_archive_symbol_lookup (abfd, info, name); + if (h != NULL + /* Don't return this sym if it is a fake function descriptor + created by add_symbol_adjust. */ + && !(h->root.type == bfd_link_hash_undefweak + && ((struct ppc_link_hash_entry *) h)->fake)) + return h; + + if (name[0] == '.') + return h; + + len = strlen (name); + dot_name = bfd_alloc (abfd, len + 2); + if (dot_name == NULL) + return (struct elf_link_hash_entry *) 0 - 1; + dot_name[0] = '.'; + memcpy (dot_name + 1, name, len + 1); + h = _bfd_elf_archive_symbol_lookup (abfd, info, dot_name); + bfd_release (abfd, dot_name); + return h; +} + +/* This function satisfies all old ABI object references to ".bar" if a + new ABI object defines "bar". Well, at least, undefined dot symbols + are made weak. This stops later archive searches from including an + object if we already have a function descriptor definition. It also + prevents the linker complaining about undefined symbols. + We also check and correct mismatched symbol visibility here. The + most restrictive visibility of the function descriptor and the + function entry symbol is used. */ + +struct add_symbol_adjust_data +{ + struct bfd_link_info *info; + bfd_boolean ok; +}; + +static bfd_boolean +add_symbol_adjust (struct elf_link_hash_entry *h, void *inf) +{ + struct add_symbol_adjust_data *data; + struct ppc_link_hash_table *htab; + struct ppc_link_hash_entry *eh; + struct ppc_link_hash_entry *fdh; + + if (h->root.type == bfd_link_hash_indirect) + return TRUE; + + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + if (h->root.root.string[0] != '.') + return TRUE; + + data = inf; + htab = ppc_hash_table (data->info); + eh = (struct ppc_link_hash_entry *) h; + fdh = get_fdh (eh, htab); + if (fdh == NULL + && !data->info->relocatable + && (eh->elf.root.type == bfd_link_hash_undefined + || eh->elf.root.type == bfd_link_hash_undefweak) + && eh->elf.ref_regular) + { + /* Make an undefweak function descriptor sym, which is enough to + pull in an --as-needed shared lib, but won't cause link + errors. Archives are handled elsewhere. */ + fdh = make_fdh (data->info, eh); + if (fdh == NULL) + data->ok = FALSE; + else + fdh->elf.ref_regular = 1; + } + else if (fdh != NULL) + { + unsigned entry_vis = ELF_ST_VISIBILITY (eh->elf.other) - 1; + unsigned descr_vis = ELF_ST_VISIBILITY (fdh->elf.other) - 1; + if (entry_vis < descr_vis) + fdh->elf.other += entry_vis - descr_vis; + else if (entry_vis > descr_vis) + eh->elf.other += descr_vis - entry_vis; + + if ((fdh->elf.root.type == bfd_link_hash_defined + || fdh->elf.root.type == bfd_link_hash_defweak) + && eh->elf.root.type == bfd_link_hash_undefined) + { + eh->elf.root.type = bfd_link_hash_undefweak; + eh->was_undefined = 1; + htab->twiddled_syms = 1; + } + } + + return TRUE; +} + +static bfd_boolean +ppc64_elf_check_directives (bfd *abfd, struct bfd_link_info *info) +{ + struct ppc_link_hash_table *htab; + struct add_symbol_adjust_data data; + + if (!is_ppc64_elf_target (abfd->xvec)) + return TRUE; + + if (!ppc64_elf_tdata (abfd)->u.has_dotsym) + return TRUE; + ppc64_elf_tdata (abfd)->u.deleted_section = NULL; + + htab = ppc_hash_table (info); + if (!is_ppc64_elf_target (htab->elf.root.creator)) + return TRUE; + + data.info = info; + data.ok = TRUE; + elf_link_hash_traverse (&htab->elf, add_symbol_adjust, &data); + + /* We need to fix the undefs list for any syms we have twiddled to + undef_weak. */ + if (htab->twiddled_syms) + { + bfd_link_repair_undef_list (&htab->elf.root); + htab->twiddled_syms = 0; + } + return data.ok; +} + static bfd_boolean update_local_sym_info (bfd *abfd, Elf_Internal_Shdr *symtab_hdr, unsigned long r_symndx, bfd_vma r_addend, int tls_type) @@ -3559,36 +4292,13 @@ update_plt_info (bfd *abfd, struct ppc_link_hash_entry *eh, bfd_vma addend) eh->elf.plt.plist = ent; } ent->plt.refcount += 1; - eh->elf.elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; - eh->is_func = 1; + eh->elf.needs_plt = 1; + if (eh->elf.root.root.string[0] == '.' + && eh->elf.root.root.string[1] != '\0') + eh->is_func = 1; return TRUE; } -/* Find the function descriptor hash entry from the given function code - hash entry FH. Link the entries via their OH fields. */ -static struct ppc_link_hash_entry * -get_fdh (struct ppc_link_hash_entry *fh, struct ppc_link_hash_table *htab) -{ - struct ppc_link_hash_entry *fdh = (struct ppc_link_hash_entry *) fh->oh; - - if (fdh == NULL) - { - const char *fd_name = fh->elf.root.root.string + 1; - - fdh = (struct ppc_link_hash_entry *) - elf_link_hash_lookup (&htab->elf, fd_name, FALSE, FALSE, FALSE); - if (fdh != NULL) - { - fdh->is_func_descriptor = 1; - fdh->oh = &fh->elf; - fh->is_func = 1; - fh->oh = &fdh->elf; - } - } - - return fdh; -} - /* Look through the relocs for a section during the first phase, and calculate needed space in the global offset table, procedure linkage table, and dynamic reloc sections. */ @@ -3644,7 +4354,7 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, }; bfd_size_type amt; - amt = sec->_raw_size * sizeof (union opd_info) / 24; + amt = sec->size * sizeof (union opd_info) / 8; opd_sym_map = bfd_zalloc (abfd, amt); if (opd_sym_map == NULL) return FALSE; @@ -3667,7 +4377,12 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, if (r_symndx < symtab_hdr->sh_info) h = NULL; else - h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + { + 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; + } r_type = ELF64_R_TYPE (rel->r_info); switch (r_type) @@ -3712,7 +4427,7 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, case R_PPC64_GOT16_LO: case R_PPC64_GOT16_LO_DS: /* This symbol requires a global offset table entry. */ - sec->has_gp_reloc = 1; + sec->has_toc_reloc = 1; if (ppc64_elf_tdata (abfd)->got == NULL && !create_got_section (abfd, info)) return FALSE; @@ -3802,7 +4517,7 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, case R_PPC64_TOC16_HA: case R_PPC64_TOC16_DS: case R_PPC64_TOC16_LO_DS: - sec->has_gp_reloc = 1; + sec->has_toc_reloc = 1; break; /* This relocation describes the C++ object vtable hierarchy. @@ -3822,27 +4537,51 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, case R_PPC64_REL14: case R_PPC64_REL14_BRTAKEN: case R_PPC64_REL14_BRNTAKEN: - htab->has_14bit_branch = 1; + { + asection *dest = NULL; + + /* Heuristic: If jumping outside our section, chances are + we are going to need a stub. */ + if (h != NULL) + { + /* If the sym is weak it may be overridden later, so + don't assume we know where a weak sym lives. */ + if (h->root.type == bfd_link_hash_defined) + dest = h->root.u.def.section; + } + else + dest = bfd_section_from_r_symndx (abfd, &htab->sym_sec, + sec, r_symndx); + if (dest != sec) + htab->has_14bit_branch = 1; + } /* Fall through. */ case R_PPC64_REL24: - if (h != NULL - && h->root.root.string[0] == '.' - && h->root.root.string[1] != 0) + if (h != NULL) { /* We may need a .plt entry if the function this reloc refers to is in a shared lib. */ if (!update_plt_info (abfd, (struct ppc_link_hash_entry *) h, rel->r_addend)) return FALSE; - if (h == htab->tls_get_addr) + if (h == &htab->tls_get_addr->elf + || h == &htab->tls_get_addr_fd->elf) sec->has_tls_reloc = 1; - else if ((strncmp (h->root.root.string, ".__tls_get_addr", 15) - == 0) + else if (htab->tls_get_addr == NULL + && !strncmp (h->root.root.string, ".__tls_get_addr", 15) && (h->root.root.string[15] == 0 || h->root.root.string[15] == '@')) { - htab->tls_get_addr = h; + htab->tls_get_addr = (struct ppc_link_hash_entry *) h; + sec->has_tls_reloc = 1; + } + else if (htab->tls_get_addr_fd == NULL + && !strncmp (h->root.root.string, "__tls_get_addr", 14) + && (h->root.root.string[14] == 0 + || h->root.root.string[14] == '@')) + { + htab->tls_get_addr_fd = (struct ppc_link_hash_entry *) h; sec->has_tls_reloc = 1; } } @@ -3888,7 +4627,7 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, if (ppc64_elf_section_data (sec)->t_symndx == NULL) { /* One extra to simplify get_tls_mask. */ - bfd_size_type amt = sec->_raw_size * sizeof (unsigned) / 8 + 1; + bfd_size_type amt = sec->size * sizeof (unsigned) / 8 + 1; ppc64_elf_section_data (sec)->t_symndx = bfd_zalloc (abfd, amt); if (ppc64_elf_section_data (sec)->t_symndx == NULL) return FALSE; @@ -3923,24 +4662,29 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, case R_PPC64_ADDR64: if (opd_sym_map != NULL - && h != NULL - && h->root.root.string[0] == '.' - && h->root.root.string[1] != 0) - get_fdh ((struct ppc_link_hash_entry *) h, htab); - - if (opd_sym_map != NULL - && h == NULL && rel + 1 < rel_end && ELF64_R_TYPE ((rel + 1)->r_info) == R_PPC64_TOC) { - asection *s; + if (h != NULL) + { + if (h->root.root.string[0] == '.' + && h->root.root.string[1] != 0 + && get_fdh ((struct ppc_link_hash_entry *) h, htab)) + ; + else + ((struct ppc_link_hash_entry *) h)->is_func = 1; + } + else + { + asection *s; - s = bfd_section_from_r_symndx (abfd, &htab->sym_sec, sec, - r_symndx); - if (s == NULL) - return FALSE; - else if (s != sec) - opd_sym_map[rel->r_offset / 24] = s; + s = bfd_section_from_r_symndx (abfd, &htab->sym_sec, sec, + r_symndx); + if (s == NULL) + return FALSE; + else if (s != sec) + opd_sym_map[rel->r_offset / 8] = s; + } } /* Fall through. */ @@ -3968,7 +4712,7 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, case R_PPC64_TOC: if (h != NULL && !info->shared) /* We may need a copy reloc. */ - h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF; + h->non_got_ref = 1; /* Don't propagate .opd relocs. */ if (NO_OPD_RELOCS && opd_sym_map != NULL) @@ -4001,14 +4745,12 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, || (h != NULL && (! info->symbolic || h->root.type == bfd_link_hash_defweak - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0)))) + || !h->def_regular)))) || (ELIMINATE_COPY_RELOCS && !info->shared && h != NULL && (h->root.type == bfd_link_hash_defweak - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0))) + || !h->def_regular))) { struct ppc_dyn_relocs *p; struct ppc_dyn_relocs **head; @@ -4033,8 +4775,8 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, name + 5) != 0) { (*_bfd_error_handler) - (_("%s: bad relocation section name `%s\'"), - bfd_archive_filename (abfd), name); + (_("%B: bad relocation section name `%s\'"), + abfd, name); bfd_set_error (bfd_error_bad_value); } @@ -4044,13 +4786,13 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, { flagword flags; - sreloc = bfd_make_section (dynobj, name); flags = (SEC_HAS_CONTENTS | SEC_READONLY - | SEC_IN_MEMORY | SEC_LINKER_CREATED); - if ((sec->flags & SEC_ALLOC) != 0) - flags |= SEC_ALLOC | SEC_LOAD; + | SEC_IN_MEMORY | SEC_LINKER_CREATED + | SEC_ALLOC | SEC_LOAD); + sreloc = bfd_make_section_with_flags (dynobj, + name, + flags); if (sreloc == NULL - || ! bfd_set_section_flags (dynobj, sreloc, flags) || ! bfd_set_section_alignment (dynobj, sreloc, 3)) return FALSE; } @@ -4070,13 +4812,15 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, easily. Oh well. */ asection *s; + void *vpp; + s = bfd_section_from_r_symndx (abfd, &htab->sym_sec, sec, r_symndx); if (s == NULL) return FALSE; - head = ((struct ppc_dyn_relocs **) - &elf_section_data (s)->local_dynrel); + vpp = &elf_section_data (s)->local_dynrel; + head = (struct ppc_dyn_relocs **) vpp; } p = *head; @@ -4106,22 +4850,235 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, return TRUE; } +/* OFFSET in OPD_SEC specifies a function descriptor. Return the address + of the code entry point, and its section. */ + +static bfd_vma +opd_entry_value (asection *opd_sec, + bfd_vma offset, + asection **code_sec, + bfd_vma *code_off) +{ + bfd *opd_bfd = opd_sec->owner; + Elf_Internal_Rela *relocs; + Elf_Internal_Rela *lo, *hi, *look; + bfd_vma val; + + /* No relocs implies we are linking a --just-symbols object. */ + if (opd_sec->reloc_count == 0) + { + bfd_vma val; + + if (!bfd_get_section_contents (opd_bfd, opd_sec, &val, offset, 8)) + return (bfd_vma) -1; + + if (code_sec != NULL) + { + asection *sec, *likely = NULL; + for (sec = opd_bfd->sections; sec != NULL; sec = sec->next) + if (sec->vma <= val + && (sec->flags & SEC_LOAD) != 0 + && (sec->flags & SEC_ALLOC) != 0) + likely = sec; + if (likely != NULL) + { + *code_sec = likely; + if (code_off != NULL) + *code_off = val - likely->vma; + } + } + return val; + } + + relocs = ppc64_elf_tdata (opd_bfd)->opd_relocs; + if (relocs == NULL) + relocs = _bfd_elf_link_read_relocs (opd_bfd, opd_sec, NULL, NULL, TRUE); + + /* Go find the opd reloc at the sym address. */ + lo = relocs; + BFD_ASSERT (lo != NULL); + hi = lo + opd_sec->reloc_count - 1; /* ignore last reloc */ + val = (bfd_vma) -1; + while (lo < hi) + { + look = lo + (hi - lo) / 2; + if (look->r_offset < offset) + lo = look + 1; + else if (look->r_offset > offset) + hi = look; + else + { + Elf_Internal_Shdr *symtab_hdr = &elf_tdata (opd_bfd)->symtab_hdr; + if (ELF64_R_TYPE (look->r_info) == R_PPC64_ADDR64 + && ELF64_R_TYPE ((look + 1)->r_info) == R_PPC64_TOC) + { + unsigned long symndx = ELF64_R_SYM (look->r_info); + asection *sec; + + if (symndx < symtab_hdr->sh_info) + { + Elf_Internal_Sym *sym; + + sym = (Elf_Internal_Sym *) symtab_hdr->contents; + if (sym == NULL) + { + sym = bfd_elf_get_elf_syms (opd_bfd, symtab_hdr, + symtab_hdr->sh_info, + 0, NULL, NULL, NULL); + if (sym == NULL) + break; + symtab_hdr->contents = (bfd_byte *) sym; + } + + sym += symndx; + val = sym->st_value; + sec = NULL; + if ((sym->st_shndx != SHN_UNDEF + && sym->st_shndx < SHN_LORESERVE) + || sym->st_shndx > SHN_HIRESERVE) + sec = bfd_section_from_elf_index (opd_bfd, sym->st_shndx); + BFD_ASSERT ((sec->flags & SEC_MERGE) == 0); + } + else + { + struct elf_link_hash_entry **sym_hashes; + struct elf_link_hash_entry *rh; + + sym_hashes = elf_sym_hashes (opd_bfd); + rh = sym_hashes[symndx - symtab_hdr->sh_info]; + while (rh->root.type == bfd_link_hash_indirect + || rh->root.type == bfd_link_hash_warning) + rh = ((struct elf_link_hash_entry *) rh->root.u.i.link); + BFD_ASSERT (rh->root.type == bfd_link_hash_defined + || rh->root.type == bfd_link_hash_defweak); + val = rh->root.u.def.value; + sec = rh->root.u.def.section; + } + val += look->r_addend; + if (code_off != NULL) + *code_off = val; + if (code_sec != NULL) + *code_sec = sec; + if (sec != NULL && sec->output_section != NULL) + val += sec->output_section->vma + sec->output_offset; + } + break; + } + } + + return val; +} + +/* Mark sections containing dynamically referenced symbols. When + building shared libraries, we must assume that any visible symbol is + referenced. */ + +static bfd_boolean +ppc64_elf_gc_mark_dynamic_ref (struct elf_link_hash_entry *h, void *inf) +{ + struct bfd_link_info *info = (struct bfd_link_info *) inf; + struct ppc_link_hash_entry *eh = (struct ppc_link_hash_entry *) h; + + if (eh->elf.root.type == bfd_link_hash_warning) + eh = (struct ppc_link_hash_entry *) eh->elf.root.u.i.link; + + /* Dynamic linking info is on the func descriptor sym. */ + if (eh->oh != NULL + && eh->oh->is_func_descriptor + && (eh->oh->elf.root.type == bfd_link_hash_defined + || eh->oh->elf.root.type == bfd_link_hash_defweak)) + eh = eh->oh; + + if ((eh->elf.root.type == bfd_link_hash_defined + || eh->elf.root.type == bfd_link_hash_defweak) + && (eh->elf.ref_dynamic + || (!info->executable + && eh->elf.def_regular + && ELF_ST_VISIBILITY (eh->elf.other) != STV_INTERNAL + && ELF_ST_VISIBILITY (eh->elf.other) != STV_HIDDEN))) + { + asection *code_sec; + + eh->elf.root.u.def.section->flags |= SEC_KEEP; + + /* Function descriptor syms cause the associated + function code sym section to be marked. */ + if (eh->is_func_descriptor + && (eh->oh->elf.root.type == bfd_link_hash_defined + || eh->oh->elf.root.type == bfd_link_hash_defweak)) + eh->oh->elf.root.u.def.section->flags |= SEC_KEEP; + else if (get_opd_info (eh->elf.root.u.def.section) != NULL + && opd_entry_value (eh->elf.root.u.def.section, + eh->elf.root.u.def.value, + &code_sec, NULL) != (bfd_vma) -1) + code_sec->flags |= SEC_KEEP; + } + + return TRUE; +} + /* Return the section that should be marked against GC for a given relocation. */ static asection * ppc64_elf_gc_mark_hook (asection *sec, - struct bfd_link_info *info ATTRIBUTE_UNUSED, + struct bfd_link_info *info, Elf_Internal_Rela *rel, struct elf_link_hash_entry *h, Elf_Internal_Sym *sym) { - asection *rsec = NULL; + asection *rsec; + + /* First mark all our entry sym sections. */ + if (info->gc_sym_list != NULL) + { + struct ppc_link_hash_table *htab = ppc_hash_table (info); + struct bfd_sym_chain *sym = info->gc_sym_list; + + info->gc_sym_list = NULL; + for (; sym != NULL; sym = sym->next) + { + struct ppc_link_hash_entry *eh; + + eh = (struct ppc_link_hash_entry *) + elf_link_hash_lookup (&htab->elf, sym->name, FALSE, FALSE, FALSE); + if (eh == NULL) + continue; + if (eh->elf.root.type != bfd_link_hash_defined + && eh->elf.root.type != bfd_link_hash_defweak) + continue; + + if (eh->is_func_descriptor + && (eh->oh->elf.root.type == bfd_link_hash_defined + || eh->oh->elf.root.type == bfd_link_hash_defweak)) + rsec = eh->oh->elf.root.u.def.section; + else if (get_opd_info (eh->elf.root.u.def.section) != NULL + && opd_entry_value (eh->elf.root.u.def.section, + eh->elf.root.u.def.value, + &rsec, NULL) != (bfd_vma) -1) + ; + else + continue; + + if (!rsec->gc_mark) + _bfd_elf_gc_mark (info, rsec, ppc64_elf_gc_mark_hook); + + rsec = eh->elf.root.u.def.section; + if (!rsec->gc_mark) + _bfd_elf_gc_mark (info, rsec, ppc64_elf_gc_mark_hook); + } + } + + /* Syms return NULL if we're marking .opd, so we avoid marking all + function sections, as all functions are referenced in .opd. */ + rsec = NULL; + if (get_opd_info (sec) != NULL) + return rsec; if (h != NULL) { enum elf_ppc64_reloc_type r_type; - struct ppc_link_hash_entry *fdh; + struct ppc_link_hash_entry *eh; r_type = ELF64_R_TYPE (rel->r_info); switch (r_type) @@ -4135,20 +5092,36 @@ ppc64_elf_gc_mark_hook (asection *sec, { case bfd_link_hash_defined: case bfd_link_hash_defweak: - fdh = (struct ppc_link_hash_entry *) h; + eh = (struct ppc_link_hash_entry *) h; + if (eh->oh != NULL + && eh->oh->is_func_descriptor + && (eh->oh->elf.root.type == bfd_link_hash_defined + || eh->oh->elf.root.type == bfd_link_hash_defweak)) + eh = eh->oh; /* Function descriptor syms cause the associated function code sym section to be marked. */ - if (fdh->is_func_descriptor) - rsec = fdh->oh->root.u.def.section; + if (eh->is_func_descriptor + && (eh->oh->elf.root.type == bfd_link_hash_defined + || eh->oh->elf.root.type == bfd_link_hash_defweak)) + { + /* They also mark their opd section. */ + if (!eh->elf.root.u.def.section->gc_mark) + _bfd_elf_gc_mark (info, eh->elf.root.u.def.section, + ppc64_elf_gc_mark_hook); - /* Function entry syms return NULL if they are in .opd - and are not ._start (or others undefined on the ld - command line). Thus we avoid marking all function - sections, as all functions are referenced in .opd. */ - else if ((fdh->oh != NULL - && ((struct ppc_link_hash_entry *) fdh->oh)->is_entry) - || ppc64_elf_section_data (sec)->opd.func_sec == NULL) + rsec = eh->oh->elf.root.u.def.section; + } + else if (get_opd_info (eh->elf.root.u.def.section) != NULL + && opd_entry_value (eh->elf.root.u.def.section, + eh->elf.root.u.def.value, + &rsec, NULL) != (bfd_vma) -1) + { + if (!eh->elf.root.u.def.section->gc_mark) + _bfd_elf_gc_mark (info, eh->elf.root.u.def.section, + ppc64_elf_gc_mark_hook); + } + else rsec = h->root.u.def.section; break; @@ -4166,11 +5139,14 @@ ppc64_elf_gc_mark_hook (asection *sec, asection **opd_sym_section; rsec = bfd_section_from_elf_index (sec->owner, sym->st_shndx); - opd_sym_section = ppc64_elf_section_data (rsec)->opd.func_sec; + opd_sym_section = get_opd_info (rsec); if (opd_sym_section != NULL) - rsec = opd_sym_section[sym->st_value / 24]; - else if (ppc64_elf_section_data (sec)->opd.func_sec != NULL) - rsec = NULL; + { + if (!rsec->gc_mark) + _bfd_elf_gc_mark (info, rsec, ppc64_elf_gc_mark_hook); + + rsec = opd_sym_section[(sym->st_value + rel->r_addend) / 8]; + } } return rsec; @@ -4216,6 +5192,9 @@ ppc64_elf_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info, struct ppc_dyn_relocs *p; 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; eh = (struct ppc_link_hash_entry *) h; for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next) @@ -4315,9 +5294,235 @@ ppc64_elf_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info, return TRUE; } +/* The maximum size of .sfpr. */ +#define SFPR_MAX (218*4) + +struct sfpr_def_parms +{ + const char name[12]; + unsigned char lo, hi; + bfd_byte * (*write_ent) (bfd *, bfd_byte *, int); + bfd_byte * (*write_tail) (bfd *, bfd_byte *, int); +}; + +/* Auto-generate _save*, _rest* functions in .sfpr. */ + +static unsigned int +sfpr_define (struct bfd_link_info *info, const struct sfpr_def_parms *parm) +{ + struct ppc_link_hash_table *htab = ppc_hash_table (info); + unsigned int i; + size_t len = strlen (parm->name); + bfd_boolean writing = FALSE; + char sym[16]; + + memcpy (sym, parm->name, len); + sym[len + 2] = 0; + + for (i = parm->lo; i <= parm->hi; i++) + { + struct elf_link_hash_entry *h; + + sym[len + 0] = i / 10 + '0'; + sym[len + 1] = i % 10 + '0'; + h = elf_link_hash_lookup (&htab->elf, sym, FALSE, FALSE, TRUE); + if (h != NULL + && !h->def_regular) + { + h->root.type = bfd_link_hash_defined; + h->root.u.def.section = htab->sfpr; + h->root.u.def.value = htab->sfpr->size; + h->type = STT_FUNC; + h->def_regular = 1; + _bfd_elf_link_hash_hide_symbol (info, h, TRUE); + writing = TRUE; + if (htab->sfpr->contents == NULL) + { + htab->sfpr->contents = bfd_alloc (htab->elf.dynobj, SFPR_MAX); + if (htab->sfpr->contents == NULL) + return FALSE; + } + } + if (writing) + { + bfd_byte *p = htab->sfpr->contents + htab->sfpr->size; + if (i != parm->hi) + p = (*parm->write_ent) (htab->elf.dynobj, p, i); + else + p = (*parm->write_tail) (htab->elf.dynobj, p, i); + htab->sfpr->size = p - htab->sfpr->contents; + } + } + + return TRUE; +} + +static bfd_byte * +savegpr0 (bfd *abfd, bfd_byte *p, int r) +{ + bfd_put_32 (abfd, STD_R0_0R1 + (r << 21) + (1 << 16) - (32 - r) * 8, p); + return p + 4; +} + +static bfd_byte * +savegpr0_tail (bfd *abfd, bfd_byte *p, int r) +{ + p = savegpr0 (abfd, p, r); + bfd_put_32 (abfd, STD_R0_0R1 + 16, p); + p = p + 4; + bfd_put_32 (abfd, BLR, p); + return p + 4; +} + +static bfd_byte * +restgpr0 (bfd *abfd, bfd_byte *p, int r) +{ + bfd_put_32 (abfd, LD_R0_0R1 + (r << 21) + (1 << 16) - (32 - r) * 8, p); + return p + 4; +} + +static bfd_byte * +restgpr0_tail (bfd *abfd, bfd_byte *p, int r) +{ + bfd_put_32 (abfd, LD_R0_0R1 + 16, p); + p = p + 4; + p = restgpr0 (abfd, p, r); + bfd_put_32 (abfd, MTLR_R0, p); + p = p + 4; + if (r == 29) + { + p = restgpr0 (abfd, p, 30); + p = restgpr0 (abfd, p, 31); + } + bfd_put_32 (abfd, BLR, p); + return p + 4; +} + +static bfd_byte * +savegpr1 (bfd *abfd, bfd_byte *p, int r) +{ + bfd_put_32 (abfd, STD_R0_0R12 + (r << 21) + (1 << 16) - (32 - r) * 8, p); + return p + 4; +} + +static bfd_byte * +savegpr1_tail (bfd *abfd, bfd_byte *p, int r) +{ + p = savegpr1 (abfd, p, r); + bfd_put_32 (abfd, BLR, p); + return p + 4; +} + +static bfd_byte * +restgpr1 (bfd *abfd, bfd_byte *p, int r) +{ + bfd_put_32 (abfd, LD_R0_0R12 + (r << 21) + (1 << 16) - (32 - r) * 8, p); + return p + 4; +} + +static bfd_byte * +restgpr1_tail (bfd *abfd, bfd_byte *p, int r) +{ + p = restgpr1 (abfd, p, r); + bfd_put_32 (abfd, BLR, p); + return p + 4; +} + +static bfd_byte * +savefpr (bfd *abfd, bfd_byte *p, int r) +{ + bfd_put_32 (abfd, STFD_FR0_0R1 + (r << 21) + (1 << 16) - (32 - r) * 8, p); + return p + 4; +} + +static bfd_byte * +savefpr0_tail (bfd *abfd, bfd_byte *p, int r) +{ + p = savefpr (abfd, p, r); + bfd_put_32 (abfd, STD_R0_0R1 + 16, p); + p = p + 4; + bfd_put_32 (abfd, BLR, p); + return p + 4; +} + +static bfd_byte * +restfpr (bfd *abfd, bfd_byte *p, int r) +{ + bfd_put_32 (abfd, LFD_FR0_0R1 + (r << 21) + (1 << 16) - (32 - r) * 8, p); + return p + 4; +} + +static bfd_byte * +restfpr0_tail (bfd *abfd, bfd_byte *p, int r) +{ + bfd_put_32 (abfd, LD_R0_0R1 + 16, p); + p = p + 4; + p = restfpr (abfd, p, r); + bfd_put_32 (abfd, MTLR_R0, p); + p = p + 4; + if (r == 29) + { + p = restfpr (abfd, p, 30); + p = restfpr (abfd, p, 31); + } + bfd_put_32 (abfd, BLR, p); + return p + 4; +} + +static bfd_byte * +savefpr1_tail (bfd *abfd, bfd_byte *p, int r) +{ + p = savefpr (abfd, p, r); + bfd_put_32 (abfd, BLR, p); + return p + 4; +} + +static bfd_byte * +restfpr1_tail (bfd *abfd, bfd_byte *p, int r) +{ + p = restfpr (abfd, p, r); + bfd_put_32 (abfd, BLR, p); + return p + 4; +} + +static bfd_byte * +savevr (bfd *abfd, bfd_byte *p, int r) +{ + bfd_put_32 (abfd, LI_R12_0 + (1 << 16) - (32 - r) * 16, p); + p = p + 4; + bfd_put_32 (abfd, STVX_VR0_R12_R0 + (r << 21), p); + return p + 4; +} + +static bfd_byte * +savevr_tail (bfd *abfd, bfd_byte *p, int r) +{ + p = savevr (abfd, p, r); + bfd_put_32 (abfd, BLR, p); + return p + 4; +} + +static bfd_byte * +restvr (bfd *abfd, bfd_byte *p, int r) +{ + bfd_put_32 (abfd, LI_R12_0 + (1 << 16) - (32 - r) * 16, p); + p = p + 4; + bfd_put_32 (abfd, LVX_VR0_R12_R0 + (r << 21), p); + return p + 4; +} + +static bfd_byte * +restvr_tail (bfd *abfd, bfd_byte *p, int r) +{ + p = restvr (abfd, p, r); + bfd_put_32 (abfd, BLR, p); + return p + 4; +} + /* Called via elf_link_hash_traverse to transfer dynamic linking information on function code symbol entries to their corresponding function descriptor symbol entries. */ + static bfd_boolean func_desc_adjust (struct elf_link_hash_entry *h, void *inf) { @@ -4338,15 +5543,29 @@ func_desc_adjust (struct elf_link_hash_entry *h, void *inf) info = inf; htab = ppc_hash_table (info); + /* Resolve undefined references to dot-symbols as the value + in the function descriptor, if we have one in a regular object. + This is to satisfy cases like ".quad .foo". Calls to functions + in dynamic objects are handled elsewhere. */ + if (fh->elf.root.type == bfd_link_hash_undefweak + && fh->was_undefined + && (fh->oh->elf.root.type == bfd_link_hash_defined + || fh->oh->elf.root.type == bfd_link_hash_defweak) + && get_opd_info (fh->oh->elf.root.u.def.section) != NULL + && opd_entry_value (fh->oh->elf.root.u.def.section, + fh->oh->elf.root.u.def.value, + &fh->elf.root.u.def.section, + &fh->elf.root.u.def.value) != (bfd_vma) -1) + { + fh->elf.root.type = fh->oh->elf.root.type; + fh->elf.forced_local = 1; + } + /* If this is a function code symbol, transfer dynamic linking information to the function descriptor symbol. */ if (!fh->is_func) return TRUE; - if (fh->elf.root.type == bfd_link_hash_undefweak - && (fh->elf.elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR)) - htab->have_undefweak = TRUE; - for (ent = fh->elf.plt.plist; ent != NULL; ent = ent->next) if (ent->plt.refcount > 0) break; @@ -4369,56 +5588,56 @@ func_desc_adjust (struct elf_link_hash_entry *h, void *inf) && (fh->elf.root.type == bfd_link_hash_undefined || fh->elf.root.type == bfd_link_hash_undefweak)) { - bfd *abfd; - asymbol *newsym; - struct bfd_link_hash_entry *bh; + fdh = make_fdh (info, fh); + if (fdh == NULL) + return FALSE; + } - abfd = fh->elf.root.u.undef.abfd; - newsym = bfd_make_empty_symbol (abfd); - newsym->name = fh->elf.root.root.string + 1; - newsym->section = bfd_und_section_ptr; - newsym->value = 0; - newsym->flags = BSF_OBJECT; - if (fh->elf.root.type == bfd_link_hash_undefweak) - newsym->flags |= BSF_WEAK; + /* Fake function descriptors are made undefweak. If the function + code symbol is strong undefined, make the fake sym the same. + If the function code symbol is defined, then force the fake + descriptor local; We can't support overriding of symbols in a + shared library on a fake descriptor. */ - bh = &fdh->elf.root; - if ( !(_bfd_generic_link_add_one_symbol - (info, abfd, newsym->name, newsym->flags, - newsym->section, newsym->value, NULL, FALSE, FALSE, &bh))) + if (fdh != NULL + && fdh->fake + && fdh->elf.root.type == bfd_link_hash_undefweak) + { + if (fh->elf.root.type == bfd_link_hash_undefined) { - return FALSE; + fdh->elf.root.type = bfd_link_hash_undefined; + bfd_link_add_undef (&htab->elf.root, &fdh->elf.root); + } + else if (fh->elf.root.type == bfd_link_hash_defined + || fh->elf.root.type == bfd_link_hash_defweak) + { + _bfd_elf_link_hash_hide_symbol (info, &fdh->elf, TRUE); } - fdh = (struct ppc_link_hash_entry *) bh; - fdh->elf.elf_link_hash_flags &= ~ELF_LINK_NON_ELF; - fdh->elf.size = 24; - fdh->elf.type = STT_OBJECT; } if (fdh != NULL - && (fdh->elf.elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0 + && !fdh->elf.forced_local && (info->shared - || (fdh->elf.elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - || (fdh->elf.elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0 + || fdh->elf.def_dynamic + || fdh->elf.ref_dynamic || (fdh->elf.root.type == bfd_link_hash_undefweak && ELF_ST_VISIBILITY (fdh->elf.other) == STV_DEFAULT))) { if (fdh->elf.dynindx == -1) if (! bfd_elf_link_record_dynamic_symbol (info, &fdh->elf)) return FALSE; - fdh->elf.elf_link_hash_flags - |= (fh->elf.elf_link_hash_flags & (ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_REF_DYNAMIC - | ELF_LINK_HASH_REF_REGULAR_NONWEAK - | ELF_LINK_NON_GOT_REF)); + fdh->elf.ref_regular |= fh->elf.ref_regular; + fdh->elf.ref_dynamic |= fh->elf.ref_dynamic; + fdh->elf.ref_regular_nonweak |= fh->elf.ref_regular_nonweak; + fdh->elf.non_got_ref |= fh->elf.non_got_ref; if (ELF_ST_VISIBILITY (fh->elf.other) == STV_DEFAULT) { - fdh->elf.plt.plist = fh->elf.plt.plist; - fdh->elf.elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; + move_plt_plist (fh, fdh); + fdh->elf.needs_plt = 1; } fdh->is_func_descriptor = 1; - fdh->oh = &fh->elf; - fh->oh = &fdh->elf; + fdh->oh = fh; + fh->oh = fdh; } /* Now that the info is on the function descriptor, clear the @@ -4428,130 +5647,57 @@ func_desc_adjust (struct elf_link_hash_entry *h, void *inf) been imported from another library. Function code syms that are really in the library we must leave global to prevent the linker dragging in a definition from a static library. */ - force_local - = (info->shared - && ((fh->elf.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0 - || fdh == NULL - || (fdh->elf.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0 - || (fdh->elf.elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)); + force_local = (!fh->elf.def_regular + || fdh == NULL + || !fdh->elf.def_regular + || fdh->elf.forced_local); _bfd_elf_link_hash_hide_symbol (info, &fh->elf, force_local); return TRUE; } -#define MIN_SAVE_FPR 14 -#define MAX_SAVE_FPR 31 - /* Called near the start of bfd_elf_size_dynamic_sections. We use this hook to a) provide some gcc support functions, and b) transfer dynamic linking information gathered so far on function code symbol entries, to their corresponding function descriptor symbol entries. */ + static bfd_boolean ppc64_elf_func_desc_adjust (bfd *obfd ATTRIBUTE_UNUSED, struct bfd_link_info *info) { struct ppc_link_hash_table *htab; - unsigned int lowest_savef = MAX_SAVE_FPR + 2; - unsigned int lowest_restf = MAX_SAVE_FPR + 2; unsigned int i; - struct elf_link_hash_entry *h; - bfd_byte *p; - char sym[10]; + const struct sfpr_def_parms funcs[] = + { + { "_savegpr0_", 14, 31, savegpr0, savegpr0_tail }, + { "_restgpr0_", 14, 29, restgpr0, restgpr0_tail }, + { "_restgpr0_", 30, 31, restgpr0, restgpr0_tail }, + { "_savegpr1_", 14, 31, savegpr1, savegpr1_tail }, + { "_restgpr1_", 14, 31, restgpr1, restgpr1_tail }, + { "_savefpr_", 14, 31, savefpr, savefpr0_tail }, + { "_restfpr_", 14, 29, restfpr, restfpr0_tail }, + { "_restfpr_", 30, 31, restfpr, restfpr0_tail }, + { "._savef", 14, 31, savefpr, savefpr1_tail }, + { "._restf", 14, 31, restfpr, restfpr1_tail }, + { "_savevr_", 20, 31, savevr, savevr_tail }, + { "_restvr_", 20, 31, restvr, restvr_tail } + }; htab = ppc_hash_table (info); - if (htab->sfpr == NULL) /* We don't have any relocs. */ return TRUE; - /* First provide any missing ._savef* and ._restf* functions. */ - memcpy (sym, "._savef14", 10); - for (i = MIN_SAVE_FPR; i <= MAX_SAVE_FPR; i++) - { - sym[7] = i / 10 + '0'; - sym[8] = i % 10 + '0'; - h = elf_link_hash_lookup (&htab->elf, sym, FALSE, FALSE, TRUE); - if (h != NULL - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) - { - if (lowest_savef > i) - lowest_savef = i; - h->root.type = bfd_link_hash_defined; - h->root.u.def.section = htab->sfpr; - h->root.u.def.value = (i - lowest_savef) * 4; - h->type = STT_FUNC; - h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; - _bfd_elf_link_hash_hide_symbol (info, h, TRUE); - } - } - - memcpy (sym, "._restf14", 10); - for (i = MIN_SAVE_FPR; i <= MAX_SAVE_FPR; i++) - { - sym[7] = i / 10 + '0'; - sym[8] = i % 10 + '0'; - h = elf_link_hash_lookup (&htab->elf, sym, FALSE, FALSE, TRUE); - if (h != NULL - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) - { - if (lowest_restf > i) - lowest_restf = i; - h->root.type = bfd_link_hash_defined; - h->root.u.def.section = htab->sfpr; - h->root.u.def.value = ((MAX_SAVE_FPR + 2 - lowest_savef) * 4 - + (i - lowest_restf) * 4); - h->type = STT_FUNC; - h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; - _bfd_elf_link_hash_hide_symbol (info, h, TRUE); - } - } + /* Provide any missing _save* and _rest* functions. */ + htab->sfpr->size = 0; + for (i = 0; i < sizeof (funcs) / sizeof (funcs[0]); i++) + if (!sfpr_define (info, &funcs[i])) + return FALSE; elf_link_hash_traverse (&htab->elf, func_desc_adjust, info); - htab->sfpr->_raw_size = ((MAX_SAVE_FPR + 2 - lowest_savef) * 4 - + (MAX_SAVE_FPR + 2 - lowest_restf) * 4); - - if (htab->sfpr->_raw_size == 0) - { - if (!htab->have_undefweak) - { - _bfd_strip_section_from_output (info, htab->sfpr); - return TRUE; - } - - htab->sfpr->_raw_size = 4; - } - - p = bfd_alloc (htab->elf.dynobj, htab->sfpr->_raw_size); - if (p == NULL) - return FALSE; - htab->sfpr->contents = p; - - for (i = lowest_savef; i <= MAX_SAVE_FPR; i++) - { - unsigned int fpr = i << 21; - unsigned int stackoff = (1 << 16) - (MAX_SAVE_FPR + 1 - i) * 8; - bfd_put_32 (htab->elf.dynobj, STFD_FR0_0R1 + fpr + stackoff, p); - p += 4; - } - if (lowest_savef <= MAX_SAVE_FPR) - { - bfd_put_32 (htab->elf.dynobj, BLR, p); - p += 4; - } - - for (i = lowest_restf; i <= MAX_SAVE_FPR; i++) - { - unsigned int fpr = i << 21; - unsigned int stackoff = (1 << 16) - (MAX_SAVE_FPR + 1 - i) * 8; - bfd_put_32 (htab->elf.dynobj, LFD_FR0_0R1 + fpr + stackoff, p); - p += 4; - } - if (lowest_restf <= MAX_SAVE_FPR - || htab->sfpr->_raw_size == 4) - { - bfd_put_32 (htab->elf.dynobj, BLR, p); - } + if (htab->sfpr->size == 0) + htab->sfpr->flags |= SEC_EXCLUDE; return TRUE; } @@ -4574,7 +5720,7 @@ ppc64_elf_adjust_dynamic_symbol (struct bfd_link_info *info, /* Deal with function syms. */ if (h->type == STT_FUNC - || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0) + || h->needs_plt) { /* Clear procedure linkage table information for any symbol that won't need a .plt entry. */ @@ -4582,14 +5728,13 @@ ppc64_elf_adjust_dynamic_symbol (struct bfd_link_info *info, for (ent = h->plt.plist; ent != NULL; ent = ent->next) if (ent->plt.refcount > 0) break; - if (!((struct ppc_link_hash_entry *) h)->is_func_descriptor - || ent == NULL + if (ent == NULL || SYMBOL_CALLS_LOCAL (info, h) || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT && h->root.type == bfd_link_hash_undefweak)) { h->plt.plist = NULL; - h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; + h->needs_plt = 0; } } else @@ -4598,16 +5743,14 @@ ppc64_elf_adjust_dynamic_symbol (struct bfd_link_info *info, /* 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) + if (h->u.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; + BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined + || h->u.weakdef->root.type == bfd_link_hash_defweak); + h->root.u.def.section = h->u.weakdef->root.u.def.section; + h->root.u.def.value = h->u.weakdef->root.u.def.value; if (ELIMINATE_COPY_RELOCS) - h->elf_link_hash_flags - = ((h->elf_link_hash_flags & ~ELF_LINK_NON_GOT_REF) - | (h->weakdef->elf_link_hash_flags & ELF_LINK_NON_GOT_REF)); + h->non_got_ref = h->u.weakdef->non_got_ref; return TRUE; } @@ -4620,7 +5763,7 @@ ppc64_elf_adjust_dynamic_symbol (struct bfd_link_info *info, /* If there are no references to this symbol that do not use the GOT, we don't need to generate a copy reloc. */ - if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0) + if (!h->non_got_ref) return TRUE; if (ELIMINATE_COPY_RELOCS) @@ -4640,7 +5783,7 @@ ppc64_elf_adjust_dynamic_symbol (struct bfd_link_info *info, we'll be keeping the dynamic relocs and avoiding the copy reloc. */ if (p == NULL) { - h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF; + h->non_got_ref = 0; return TRUE; } } @@ -4661,6 +5804,13 @@ ppc64_elf_adjust_dynamic_symbol (struct bfd_link_info *info, /* This is a reference to a symbol defined by a dynamic object which is not a function. */ + if (h->size == 0) + { + (*_bfd_error_handler) (_("dynamic variable `%s' is zero size"), + h->root.root.string); + return TRUE; + } + /* We must allocate the symbol in our .dynbss section, which will become part of the .bss section of the executable. There will be an entry for this symbol in the .dynsym section. The dynamic @@ -4677,8 +5827,8 @@ ppc64_elf_adjust_dynamic_symbol (struct bfd_link_info *info, .rela.bss section we are going to use. */ if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) { - htab->relbss->_raw_size += sizeof (Elf64_External_Rela); - h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY; + htab->relbss->size += sizeof (Elf64_External_Rela); + h->needs_copy = 1; } /* We need to figure out the alignment required for this symbol. I @@ -4689,7 +5839,7 @@ ppc64_elf_adjust_dynamic_symbol (struct bfd_link_info *info, /* Apply the required alignment. */ s = htab->dynbss; - s->_raw_size = BFD_ALIGN (s->_raw_size, (bfd_size_type) (1 << power_of_two)); + s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two)); if (power_of_two > bfd_get_section_alignment (htab->elf.dynobj, s)) { if (! bfd_set_section_alignment (htab->elf.dynobj, s, power_of_two)) @@ -4698,10 +5848,10 @@ ppc64_elf_adjust_dynamic_symbol (struct bfd_link_info *info, /* Define the symbol as being at this point in the section. */ h->root.u.def.section = s; - h->root.u.def.value = s->_raw_size; + h->root.u.def.value = s->size; /* Increment the section size to make room for the symbol. */ - s->_raw_size += h->size; + s->size += h->size; return TRUE; } @@ -4713,11 +5863,13 @@ ppc64_elf_hide_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *h, bfd_boolean force_local) { + struct ppc_link_hash_entry *eh; _bfd_elf_link_hash_hide_symbol (info, h, force_local); - if (((struct ppc_link_hash_entry *) h)->is_func_descriptor) + eh = (struct ppc_link_hash_entry *) h; + if (eh->is_func_descriptor) { - struct elf_link_hash_entry *fh = ((struct ppc_link_hash_entry *) h)->oh; + struct ppc_link_hash_entry *fh = eh->oh; if (fh == NULL) { @@ -4731,14 +5883,15 @@ ppc64_elf_hide_symbol (struct bfd_link_info *info, when it runs out of memory. This function doesn't have a return status, so there's no way to gracefully return an error. So cheat. We know that string[-1] can be safely - dereferenced; It's either a string in an ELF string - table, or allocated in an objalloc structure. */ + accessed; It's either a string in an ELF string table, + or allocated in an objalloc structure. */ - p = h->root.root.string - 1; + p = eh->elf.root.root.string - 1; save = *p; *(char *) p = '.'; htab = ppc_hash_table (info); - fh = elf_link_hash_lookup (&htab->elf, p, FALSE, FALSE, FALSE); + fh = (struct ppc_link_hash_entry *) + elf_link_hash_lookup (&htab->elf, p, FALSE, FALSE, FALSE); *(char *) p = save; /* Unfortunately, if it so happens that the string we were @@ -4747,27 +5900,32 @@ ppc64_elf_hide_symbol (struct bfd_link_info *info, reason the lookup should fail. */ if (fh == NULL) { - q = h->root.root.string + strlen (h->root.root.string); - while (q >= h->root.root.string && *q == *p) + q = eh->elf.root.root.string + strlen (eh->elf.root.root.string); + while (q >= eh->elf.root.root.string && *q == *p) --q, --p; - if (q < h->root.root.string && *p == '.') - fh = elf_link_hash_lookup (&htab->elf, p, FALSE, FALSE, FALSE); + if (q < eh->elf.root.root.string && *p == '.') + fh = (struct ppc_link_hash_entry *) + elf_link_hash_lookup (&htab->elf, p, FALSE, FALSE, FALSE); } if (fh != NULL) { - ((struct ppc_link_hash_entry *) h)->oh = fh; - ((struct ppc_link_hash_entry *) fh)->oh = h; + eh->oh = fh; + fh->oh = eh; } } if (fh != NULL) - _bfd_elf_link_hash_hide_symbol (info, fh, force_local); + _bfd_elf_link_hash_hide_symbol (info, &fh->elf, force_local); } } static bfd_boolean -get_sym_h (struct elf_link_hash_entry **hp, Elf_Internal_Sym **symp, - asection **symsecp, char **tls_maskp, Elf_Internal_Sym **locsymsp, - unsigned long r_symndx, bfd *ibfd) +get_sym_h (struct elf_link_hash_entry **hp, + Elf_Internal_Sym **symp, + asection **symsecp, + char **tls_maskp, + Elf_Internal_Sym **locsymsp, + unsigned long r_symndx, + bfd *ibfd) { Elf_Internal_Shdr *symtab_hdr = &elf_tdata (ibfd)->symtab_hdr; @@ -4900,15 +6058,14 @@ get_tls_mask (char **tls_maskp, unsigned long *toc_symndx, if ((h == NULL || ((h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak) - && !(h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC))) + && !h->def_dynamic)) && (next_r == -1 || next_r == -2)) return 1 - next_r; return 1; } /* Adjust all global syms defined in opd sections. In gcc generated - code these will already have been done, but I suppose we have to - cater for all sorts of hand written assembly. */ + code for the old ABI, these will already have been done. */ static bfd_boolean adjust_opd_syms (struct elf_link_hash_entry *h, void *inf ATTRIBUTE_UNUSED) @@ -4932,16 +6089,167 @@ adjust_opd_syms (struct elf_link_hash_entry *h, void *inf ATTRIBUTE_UNUSED) return TRUE; sym_sec = eh->elf.root.u.def.section; - if (sym_sec != NULL - && elf_section_data (sym_sec) != NULL - && (opd_adjust = ppc64_elf_section_data (sym_sec)->opd.adjust) != NULL) + opd_adjust = get_opd_info (sym_sec); + if (opd_adjust != NULL) { - eh->elf.root.u.def.value += opd_adjust[eh->elf.root.u.def.value / 24]; + long adjust = opd_adjust[eh->elf.root.u.def.value / 8]; + if (adjust == -1) + { + /* This entry has been deleted. */ + asection *dsec = ppc64_elf_tdata (sym_sec->owner)->u.deleted_section; + if (dsec == NULL) + { + for (dsec = sym_sec->owner->sections; dsec; dsec = dsec->next) + if (elf_discarded_section (dsec)) + { + ppc64_elf_tdata (sym_sec->owner)->u.deleted_section = dsec; + break; + } + } + eh->elf.root.u.def.value = 0; + eh->elf.root.u.def.section = dsec; + } + else + eh->elf.root.u.def.value += adjust; eh->adjust_done = 1; } return TRUE; } +/* Handles decrementing dynamic reloc counts for the reloc specified by + R_INFO in section SEC. If LOCAL_SYMS is NULL, then H and SYM_SEC + have already been determined. */ + +static bfd_boolean +dec_dynrel_count (bfd_vma r_info, + asection *sec, + struct bfd_link_info *info, + Elf_Internal_Sym **local_syms, + struct elf_link_hash_entry *h, + asection *sym_sec) +{ + enum elf_ppc64_reloc_type r_type; + struct ppc_dyn_relocs *p; + struct ppc_dyn_relocs **pp; + + /* Can this reloc be dynamic? This switch, and later tests here + should be kept in sync with the code in check_relocs. */ + r_type = ELF64_R_TYPE (r_info); + switch (r_type) + { + default: + return TRUE; + + case R_PPC64_TPREL16: + case R_PPC64_TPREL16_LO: + case R_PPC64_TPREL16_HI: + case R_PPC64_TPREL16_HA: + case R_PPC64_TPREL16_DS: + case R_PPC64_TPREL16_LO_DS: + case R_PPC64_TPREL16_HIGHER: + case R_PPC64_TPREL16_HIGHERA: + case R_PPC64_TPREL16_HIGHEST: + case R_PPC64_TPREL16_HIGHESTA: + if (!info->shared) + return TRUE; + + case R_PPC64_TPREL64: + case R_PPC64_DTPMOD64: + case R_PPC64_DTPREL64: + case R_PPC64_ADDR64: + case R_PPC64_REL30: + case R_PPC64_REL32: + case R_PPC64_REL64: + case R_PPC64_ADDR14: + case R_PPC64_ADDR14_BRNTAKEN: + case R_PPC64_ADDR14_BRTAKEN: + case R_PPC64_ADDR16: + case R_PPC64_ADDR16_DS: + case R_PPC64_ADDR16_HA: + case R_PPC64_ADDR16_HI: + case R_PPC64_ADDR16_HIGHER: + case R_PPC64_ADDR16_HIGHERA: + case R_PPC64_ADDR16_HIGHEST: + case R_PPC64_ADDR16_HIGHESTA: + case R_PPC64_ADDR16_LO: + case R_PPC64_ADDR16_LO_DS: + case R_PPC64_ADDR24: + case R_PPC64_ADDR32: + case R_PPC64_UADDR16: + case R_PPC64_UADDR32: + case R_PPC64_UADDR64: + case R_PPC64_TOC: + break; + } + + if (local_syms != NULL) + { + unsigned long r_symndx; + Elf_Internal_Sym *sym; + bfd *ibfd = sec->owner; + + r_symndx = ELF64_R_SYM (r_info); + if (!get_sym_h (&h, &sym, &sym_sec, NULL, local_syms, r_symndx, ibfd)) + return FALSE; + } + + if ((info->shared + && (MUST_BE_DYN_RELOC (r_type) + || (h != NULL + && (!info->symbolic + || h->root.type == bfd_link_hash_defweak + || !h->def_regular)))) + || (ELIMINATE_COPY_RELOCS + && !info->shared + && h != NULL + && (h->root.type == bfd_link_hash_defweak + || !h->def_regular))) + ; + else + return TRUE; + + if (h != NULL) + pp = &((struct ppc_link_hash_entry *) h)->dyn_relocs; + else + { + if (sym_sec != NULL) + { + void *vpp = &elf_section_data (sym_sec)->local_dynrel; + pp = (struct ppc_dyn_relocs **) vpp; + } + else + { + void *vpp = &elf_section_data (sec)->local_dynrel; + pp = (struct ppc_dyn_relocs **) vpp; + } + + /* elf_gc_sweep may have already removed all dyn relocs associated + with local syms for a given section. Don't report a dynreloc + miscount. */ + if (*pp == NULL) + return TRUE; + } + + while ((p = *pp) != NULL) + { + if (p->sec == sec) + { + if (!MUST_BE_DYN_RELOC (r_type)) + p->pc_count -= 1; + p->count -= 1; + if (p->count == 0) + *pp = p->next; + return TRUE; + } + pp = &p->next; + } + + (*_bfd_error_handler) (_("dynreloc miscount for %B, section %A"), + sec->owner, sec); + bfd_set_error (bfd_error_bad_value); + return FALSE; +} + /* Remove unused Official Procedure Descriptor entries. Currently we only remove those associated with functions in discarded link-once sections, or weakly defined functions that have been overridden. It @@ -4949,10 +6257,13 @@ adjust_opd_syms (struct elf_link_hash_entry *h, void *inf ATTRIBUTE_UNUSED) applications. */ bfd_boolean -ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info) +ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info, + bfd_boolean no_opd_opt, + bfd_boolean non_overlapping) { bfd *ibfd; bfd_boolean some_edited = FALSE; + asection *need_pad = NULL; for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) { @@ -4963,23 +6274,32 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info) struct elf_link_hash_entry **sym_hashes; bfd_vma offset; bfd_size_type amt; - long *adjust; - bfd_boolean need_edit; + long *opd_adjust; + bfd_boolean need_edit, add_aux_fields; + bfd_size_type cnt_16b = 0; sec = bfd_get_section_by_name (ibfd, ".opd"); - if (sec == NULL) + if (sec == NULL || sec->size == 0) continue; - amt = sec->_raw_size * sizeof (long) / 24; - adjust = ppc64_elf_section_data (sec)->opd.adjust; - if (adjust == NULL) + amt = sec->size * sizeof (long) / 8; + opd_adjust = get_opd_info (sec); + if (opd_adjust == NULL) { - /* Must be a ld -r link. ie. check_relocs hasn't been - called. */ - adjust = bfd_zalloc (obfd, amt); - ppc64_elf_section_data (sec)->opd.adjust = adjust; + /* check_relocs hasn't been called. Must be a ld -r link + or --just-symbols object. */ + opd_adjust = bfd_alloc (obfd, amt); + if (opd_adjust == NULL) + return FALSE; + ppc64_elf_section_data (sec)->opd.adjust = opd_adjust; } - memset (adjust, 0, amt); + memset (opd_adjust, 0, amt); + + if (no_opd_opt) + continue; + + if (sec->sec_info_type == ELF_INFO_TYPE_JUST_SYMS) + continue; if (sec->output_section == bfd_abs_section_ptr) continue; @@ -5001,6 +6321,7 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info) /* First run through the relocs to check they are sane, and to determine whether we need to edit this opd section. */ need_edit = FALSE; + need_pad = sec; offset = 0; relend = relstart + sec->reloc_count; for (rel = relstart; rel < relend; ) @@ -5011,7 +6332,7 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info) struct elf_link_hash_entry *h; Elf_Internal_Sym *sym; - /* .opd contains a regular array of 24 byte entries. We're + /* .opd contains a regular array of 16 or 24 byte entries. We're only interested in the reloc pointing to a function entry point. */ if (rel->r_offset != offset @@ -5023,9 +6344,9 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info) Also, there's nothing to prevent someone putting something silly in .opd with the assembler. No .opd optimization for them! */ + broken_opd: (*_bfd_error_handler) - (_("%s: .opd is not a regular array of opd entries"), - bfd_archive_filename (ibfd)); + (_("%B: .opd is not a regular array of opd entries"), ibfd); need_edit = FALSE; break; } @@ -5034,8 +6355,8 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info) || (r_type = ELF64_R_TYPE ((rel + 1)->r_info)) != R_PPC64_TOC) { (*_bfd_error_handler) - (_("%s: unexpected reloc type %u in .opd section"), - bfd_archive_filename (ibfd), r_type); + (_("%B: unexpected reloc type %u in .opd section"), + ibfd, r_type); need_edit = FALSE; break; } @@ -5051,12 +6372,12 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info) if (h != NULL) sym_name = h->root.root.string; else - sym_name = bfd_elf_local_sym_name (ibfd, sym); + sym_name = bfd_elf_sym_name (ibfd, symtab_hdr, sym, + sym_sec); (*_bfd_error_handler) - (_("%s: undefined sym `%s' in .opd section"), - bfd_archive_filename (ibfd), - sym_name); + (_("%B: undefined sym `%s' in .opd section"), + ibfd, sym_name); need_edit = FALSE; break; } @@ -5072,19 +6393,54 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info) || sym_sec->output_section == bfd_abs_section_ptr) need_edit = TRUE; - offset += 24; rel += 2; - /* Allow for the possibility of a reloc on the third word. */ - if (rel < relend - && rel->r_offset == offset - 8) - rel += 1; + if (rel == relend + || (rel + 1 == relend && rel->r_offset == offset + 16)) + { + if (sec->size == offset + 24) + { + need_pad = NULL; + break; + } + if (rel == relend && sec->size == offset + 16) + { + cnt_16b++; + break; + } + goto broken_opd; + } + + if (rel->r_offset == offset + 24) + offset += 24; + else if (rel->r_offset != offset + 16) + goto broken_opd; + else if (rel + 1 < relend + && ELF64_R_TYPE (rel[0].r_info) == R_PPC64_ADDR64 + && ELF64_R_TYPE (rel[1].r_info) == R_PPC64_TOC) + { + offset += 16; + cnt_16b++; + } + else if (rel + 2 < relend + && ELF64_R_TYPE (rel[1].r_info) == R_PPC64_ADDR64 + && ELF64_R_TYPE (rel[2].r_info) == R_PPC64_TOC) + { + offset += 24; + rel += 1; + } + else + goto broken_opd; } - if (need_edit) + add_aux_fields = non_overlapping && cnt_16b > 0; + + if (need_edit || add_aux_fields) { Elf_Internal_Rela *write_rel; bfd_byte *rptr, *wptr; + bfd_byte *new_contents = NULL; bfd_boolean skip; + long opd_ent_size; /* This seems a waste of time as input .opd sections are all zeros as generated by gcc, but I suppose there's no reason @@ -5092,11 +6448,11 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info) the third word of .opd entries. */ if ((sec->flags & SEC_IN_MEMORY) == 0) { - bfd_byte *loc = bfd_alloc (ibfd, sec->_raw_size); - if (loc == NULL - || !bfd_get_section_contents (ibfd, sec, loc, 0, - sec->_raw_size)) + bfd_byte *loc; + if (!bfd_malloc_and_get_section (ibfd, sec, &loc)) { + if (loc != NULL) + free (loc); error_ret: if (local_syms != NULL && symtab_hdr->contents != (unsigned char *) local_syms) @@ -5111,11 +6467,21 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info) elf_section_data (sec)->relocs = relstart; - wptr = sec->contents; + new_contents = sec->contents; + if (add_aux_fields) + { + new_contents = bfd_malloc (sec->size + cnt_16b * 8); + if (new_contents == NULL) + return FALSE; + need_pad = FALSE; + } + wptr = new_contents; rptr = sec->contents; + write_rel = relstart; skip = FALSE; offset = 0; + opd_ent_size = 0; for (rel = relstart; rel < relend; rel++) { unsigned long r_symndx; @@ -5131,27 +6497,48 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info) if (rel->r_offset == offset) { struct ppc_link_hash_entry *fdh = NULL; - if (h != NULL) - fdh = get_fdh ((struct ppc_link_hash_entry *) h, - ppc_hash_table (info)); + + /* See if the .opd entry is full 24 byte or + 16 byte (with fd_aux entry overlapped with next + fd_func). */ + opd_ent_size = 24; + if ((rel + 2 == relend && sec->size == offset + 16) + || (rel + 3 < relend + && rel[2].r_offset == offset + 16 + && rel[3].r_offset == offset + 24 + && ELF64_R_TYPE (rel[2].r_info) == R_PPC64_ADDR64 + && ELF64_R_TYPE (rel[3].r_info) == R_PPC64_TOC)) + opd_ent_size = 16; + + if (h != NULL + && h->root.root.string[0] == '.') + { + fdh = get_fdh ((struct ppc_link_hash_entry *) h, + ppc_hash_table (info)); + if (fdh != NULL + && fdh->elf.root.type != bfd_link_hash_defined + && fdh->elf.root.type != bfd_link_hash_defweak) + fdh = NULL; + } skip = (sym_sec->owner != ibfd || sym_sec->output_section == bfd_abs_section_ptr); if (skip) { - if (h != NULL && sym_sec->owner == ibfd) + if (fdh != NULL && sym_sec->owner == ibfd) { /* Arrange for the function descriptor sym to be dropped. */ fdh->elf.root.u.def.value = 0; fdh->elf.root.u.def.section = sym_sec; } + opd_adjust[rel->r_offset / 8] = -1; } else { /* We'll be keeping this opd entry. */ - if (h != NULL) + if (fdh != NULL) { /* Redefine the function descriptor symbol to this location in the opd section. It is @@ -5160,7 +6547,7 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info) for local symbols, because various places in the generic ELF code use the value stored in u.def.value. */ - fdh->elf.root.u.def.value = wptr - sec->contents; + fdh->elf.root.u.def.value = wptr - new_contents; fdh->adjust_done = 1; } @@ -5170,60 +6557,50 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info) for the function descriptor sym which we don't have at the moment. So keep an array of adjustments. */ - adjust[rel->r_offset / 24] = wptr - rptr; + opd_adjust[rel->r_offset / 8] + = (wptr - new_contents) - (rptr - sec->contents); if (wptr != rptr) - memcpy (wptr, rptr, 24); - wptr += 24; + memcpy (wptr, rptr, opd_ent_size); + wptr += opd_ent_size; + if (add_aux_fields && opd_ent_size == 16) + { + memset (wptr, '\0', 8); + wptr += 8; + } } - rptr += 24; - offset += 24; + rptr += opd_ent_size; + offset += opd_ent_size; } if (skip) { - BFD_ASSERT (MUST_BE_DYN_RELOC (ELF64_R_TYPE (rel->r_info))); - if (info->shared) - { - /* We won't be needing dynamic relocs here. */ - struct ppc_dyn_relocs **pp; - struct ppc_dyn_relocs *p; - - if (h != NULL) - pp = &((struct ppc_link_hash_entry *) h)->dyn_relocs; - else if (sym_sec != NULL) - pp = ((struct ppc_dyn_relocs **) - &elf_section_data (sym_sec)->local_dynrel); - else - pp = ((struct ppc_dyn_relocs **) - &elf_section_data (sec)->local_dynrel); - while ((p = *pp) != NULL) - { - if (p->sec == sec) - { - p->count -= 1; - if (p->count == 0) - *pp = p->next; - break; - } - pp = &p->next; - } - } + if (!NO_OPD_RELOCS + && !info->relocatable + && !dec_dynrel_count (rel->r_info, sec, info, + NULL, h, sym_sec)) + goto error_ret; } else { /* We need to adjust any reloc offsets to point to the new opd entries. While we're at it, we may as well remove redundant relocs. */ - rel->r_offset += wptr - rptr; + rel->r_offset += opd_adjust[(offset - opd_ent_size) / 8]; if (write_rel != rel) memcpy (write_rel, rel, sizeof (*rel)); ++write_rel; } } - sec->_cooked_size = wptr - sec->contents; + sec->size = wptr - new_contents; sec->reloc_count = write_rel - relstart; + if (add_aux_fields) + { + free (sec->contents); + sec->contents = new_contents; + } + /* Fudge the size too, as this is used later in elf_bfd_final_link if we are emitting relocs. */ elf_section_data (sec)->rel_hdr.sh_size @@ -5247,6 +6624,40 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info) if (some_edited) elf_link_hash_traverse (elf_hash_table (info), adjust_opd_syms, NULL); + /* If we are doing a final link and the last .opd entry is just 16 byte + long, add a 8 byte padding after it. */ + if (need_pad != NULL && !info->relocatable) + { + bfd_byte *p; + + if ((need_pad->flags & SEC_IN_MEMORY) == 0) + { + BFD_ASSERT (need_pad->size > 0); + + p = bfd_malloc (need_pad->size + 8); + if (p == NULL) + return FALSE; + + if (! bfd_get_section_contents (need_pad->owner, need_pad, + p, 0, need_pad->size)) + return FALSE; + + need_pad->contents = p; + need_pad->flags |= (SEC_IN_MEMORY | SEC_HAS_CONTENTS); + } + else + { + p = bfd_realloc (need_pad->contents, need_pad->size + 8); + if (p == NULL) + return FALSE; + + need_pad->contents = p; + } + + memset (need_pad->contents + need_pad->size, 0, 8); + need_pad->size += 8; + } + return TRUE; } @@ -5260,13 +6671,31 @@ ppc64_elf_tls_setup (bfd *obfd, struct bfd_link_info *info) htab = ppc_hash_table (info); if (htab->tls_get_addr != NULL) { - struct elf_link_hash_entry *h = htab->tls_get_addr; + struct ppc_link_hash_entry *h = htab->tls_get_addr; - 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; + while (h->elf.root.type == bfd_link_hash_indirect + || h->elf.root.type == bfd_link_hash_warning) + h = (struct ppc_link_hash_entry *) h->elf.root.u.i.link; htab->tls_get_addr = h; + + if (htab->tls_get_addr_fd == NULL + && h->oh != NULL + && h->oh->is_func_descriptor + && (h->oh->elf.root.type == bfd_link_hash_defined + || h->oh->elf.root.type == bfd_link_hash_defweak)) + htab->tls_get_addr_fd = h->oh; + } + + if (htab->tls_get_addr_fd != NULL) + { + struct ppc_link_hash_entry *h = htab->tls_get_addr_fd; + + while (h->elf.root.type == bfd_link_hash_indirect + || h->elf.root.type == bfd_link_hash_warning) + h = (struct ppc_link_hash_entry *) h->elf.root.u.i.link; + + htab->tls_get_addr_fd = h; } return _bfd_elf_tls_setup (obfd, info); @@ -5293,12 +6722,22 @@ ppc64_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED, struct bfd_link_info *info) for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) { Elf_Internal_Sym *locsyms = NULL; + asection *toc = bfd_get_section_by_name (ibfd, ".toc"); + unsigned char *toc_ref = NULL; - for (sec = ibfd->sections; sec != NULL; sec = sec->next) + /* Look at all the sections for this file, with TOC last. */ + for (sec = (ibfd->sections == toc && toc && toc->next ? toc->next + : ibfd->sections); + sec != NULL; + sec = (sec == toc ? NULL + : sec->next == NULL ? toc + : sec->next == toc && toc->next ? toc->next + : sec->next)) if (sec->has_tls_reloc && !bfd_is_abs_section (sec->output_section)) { Elf_Internal_Rela *relstart, *rel, *relend; int expecting_tls_get_addr; + long toc_ref_index = 0; /* Read the relocations. */ relstart = _bfd_elf_link_read_relocs (ibfd, sec, NULL, NULL, @@ -5327,6 +6766,8 @@ ppc64_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED, struct bfd_link_info *info) err_free_rel: if (elf_section_data (sec)->relocs != relstart) free (relstart); + if (toc_ref != NULL) + free (toc_ref); if (locsyms != NULL && (elf_tdata (ibfd)->symtab_hdr.contents != (unsigned char *) locsyms)) @@ -5342,22 +6783,14 @@ ppc64_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED, struct bfd_link_info *info) value = h->root.u.def.value; } else - { - value = sym->st_value; - - if (elf_section_data (sym_sec) != NULL) - { - long *adjust; - adjust = ppc64_elf_section_data (sym_sec)->opd.adjust; - if (adjust != NULL) - value += adjust[value / 24]; - } - } + /* Symbols referenced by TLS relocs must be of type + STT_TLS. So no need for .opd local sym adjust. */ + value = sym->st_value; ok_tprel = FALSE; is_local = FALSE; if (h == NULL - || !(h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC)) + || !h->def_dynamic) { is_local = TRUE; value += sym_sec->output_offset; @@ -5424,7 +6857,8 @@ ppc64_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED, struct bfd_link_info *info) case R_PPC64_REL14_BRNTAKEN: case R_PPC64_REL24: if (h != NULL - && h == htab->tls_get_addr) + && (h == &htab->tls_get_addr->elf + || h == &htab->tls_get_addr_fd->elf)) { if (!expecting_tls_get_addr && rel != relstart @@ -5441,8 +6875,12 @@ ppc64_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED, struct bfd_link_info *info) rel - 1, ibfd); if (retval == 0) goto err_free_rel; - if (toc_tls != NULL) - expecting_tls_get_addr = retval > 1; + if (retval > 1 && toc_tls != NULL) + { + expecting_tls_get_addr = 1; + if (toc_ref != NULL) + toc_ref[toc_ref_index] = 1; + } } if (expecting_tls_get_addr) @@ -5460,8 +6898,40 @@ ppc64_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED, struct bfd_link_info *info) expecting_tls_get_addr = 0; continue; + case R_PPC64_TOC16: + case R_PPC64_TOC16_LO: + case R_PPC64_TLS: + expecting_tls_get_addr = 0; + if (sym_sec == toc && toc != NULL) + { + /* Mark this toc entry as referenced by a TLS + code sequence. We can do that now in the + case of R_PPC64_TLS, and after checking for + tls_get_addr for the TOC16 relocs. */ + if (toc_ref == NULL) + { + toc_ref = bfd_zmalloc (toc->size / 8); + if (toc_ref == NULL) + goto err_free_rel; + } + if (h != NULL) + value = h->root.u.def.value; + else + value = sym->st_value; + value += rel->r_addend; + BFD_ASSERT (value < toc->size && value % 8 == 0); + toc_ref_index = value / 8; + if (r_type == R_PPC64_TLS) + toc_ref[toc_ref_index] = 1; + } + continue; + case R_PPC64_TPREL64: expecting_tls_get_addr = 0; + if (sec != toc + || toc_ref == NULL + || !toc_ref[rel->r_offset / 8]) + continue; if (ok_tprel) { /* IE -> LE */ @@ -5474,6 +6944,10 @@ ppc64_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED, struct bfd_link_info *info) case R_PPC64_DTPMOD64: expecting_tls_get_addr = 0; + if (sec != toc + || toc_ref == NULL + || !toc_ref[rel->r_offset / 8]) + continue; if (rel + 1 < relend && (rel[1].r_info == ELF64_R_INFO (r_symndx, R_PPC64_DTPREL64)) @@ -5528,29 +7002,20 @@ ppc64_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED, struct bfd_link_info *info) ent->got.refcount -= 1; } } - else if (h != NULL) + else { - struct ppc_link_hash_entry * eh; - struct ppc_dyn_relocs **pp; - struct ppc_dyn_relocs *p; + /* If we got rid of a DTPMOD/DTPREL reloc pair then + we'll lose one or two dyn relocs. */ + if (!dec_dynrel_count (rel->r_info, sec, info, + NULL, h, sym_sec)) + return FALSE; - /* Adjust dynamic relocs. */ - eh = (struct ppc_link_hash_entry *) h; - for (pp = &eh->dyn_relocs; - (p = *pp) != NULL; - pp = &p->next) - if (p->sec == sec) - { - /* If we got rid of a DTPMOD/DTPREL reloc - pair then we'll lose one or two dyn - relocs. */ - if (tls_set == (TLS_EXPLICIT | TLS_GD)) - p->count -= 1; - p->count -= 1; - if (p->count == 0) - *pp = p->next; - break; - } + if (tls_set == (TLS_EXPLICIT | TLS_GD)) + { + if (!dec_dynrel_count ((rel + 1)->r_info, sec, info, + NULL, h, sym_sec)) + return FALSE; + } } *tls_mask |= tls_set; @@ -5561,6 +7026,9 @@ ppc64_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED, struct bfd_link_info *info) free (relstart); } + if (toc_ref != NULL) + free (toc_ref); + if (locsyms != NULL && (elf_tdata (ibfd)->symtab_hdr.contents != (unsigned char *) locsyms)) @@ -5574,6 +7042,462 @@ ppc64_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED, struct bfd_link_info *info) return TRUE; } +/* Called via elf_link_hash_traverse from ppc64_elf_edit_toc to adjust + the values of any global symbols in a toc section that has been + edited. Globals in toc sections should be a rarity, so this function + sets a flag if any are found in toc sections other than the one just + edited, so that futher hash table traversals can be avoided. */ + +struct adjust_toc_info +{ + asection *toc; + unsigned long *skip; + bfd_boolean global_toc_syms; +}; + +static bfd_boolean +adjust_toc_syms (struct elf_link_hash_entry *h, void *inf) +{ + struct ppc_link_hash_entry *eh; + struct adjust_toc_info *toc_inf = (struct adjust_toc_info *) inf; + + if (h->root.type == bfd_link_hash_indirect) + return TRUE; + + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + if (h->root.type != bfd_link_hash_defined + && h->root.type != bfd_link_hash_defweak) + return TRUE; + + eh = (struct ppc_link_hash_entry *) h; + if (eh->adjust_done) + return TRUE; + + if (eh->elf.root.u.def.section == toc_inf->toc) + { + unsigned long skip = toc_inf->skip[eh->elf.root.u.def.value >> 3]; + if (skip != (unsigned long) -1) + eh->elf.root.u.def.value -= skip; + else + { + (*_bfd_error_handler) + (_("%s defined in removed toc entry"), eh->elf.root.root.string); + eh->elf.root.u.def.section = &bfd_abs_section; + eh->elf.root.u.def.value = 0; + } + eh->adjust_done = 1; + } + else if (strcmp (eh->elf.root.u.def.section->name, ".toc") == 0) + toc_inf->global_toc_syms = TRUE; + + return TRUE; +} + +/* Examine all relocs referencing .toc sections in order to remove + unused .toc entries. */ + +bfd_boolean +ppc64_elf_edit_toc (bfd *obfd ATTRIBUTE_UNUSED, struct bfd_link_info *info) +{ + bfd *ibfd; + struct adjust_toc_info toc_inf; + + toc_inf.global_toc_syms = TRUE; + for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) + { + asection *toc, *sec; + Elf_Internal_Shdr *symtab_hdr; + Elf_Internal_Sym *local_syms; + struct elf_link_hash_entry **sym_hashes; + Elf_Internal_Rela *relstart, *rel; + unsigned long *skip, *drop; + unsigned char *used; + unsigned char *keep, last, some_unused; + + toc = bfd_get_section_by_name (ibfd, ".toc"); + if (toc == NULL + || toc->size == 0 + || toc->sec_info_type == ELF_INFO_TYPE_JUST_SYMS + || elf_discarded_section (toc)) + continue; + + local_syms = NULL; + symtab_hdr = &elf_tdata (ibfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (ibfd); + + /* Look at sections dropped from the final link. */ + skip = NULL; + relstart = NULL; + for (sec = ibfd->sections; sec != NULL; sec = sec->next) + { + if (sec->reloc_count == 0 + || !elf_discarded_section (sec) + || get_opd_info (sec) + || (sec->flags & SEC_ALLOC) == 0 + || (sec->flags & SEC_DEBUGGING) != 0) + continue; + + relstart = _bfd_elf_link_read_relocs (ibfd, sec, NULL, NULL, FALSE); + if (relstart == NULL) + goto error_ret; + + /* Run through the relocs to see which toc entries might be + unused. */ + for (rel = relstart; rel < relstart + sec->reloc_count; ++rel) + { + enum elf_ppc64_reloc_type r_type; + unsigned long r_symndx; + asection *sym_sec; + struct elf_link_hash_entry *h; + Elf_Internal_Sym *sym; + bfd_vma val; + + r_type = ELF64_R_TYPE (rel->r_info); + switch (r_type) + { + default: + continue; + + case R_PPC64_TOC16: + case R_PPC64_TOC16_LO: + case R_PPC64_TOC16_HI: + case R_PPC64_TOC16_HA: + case R_PPC64_TOC16_DS: + case R_PPC64_TOC16_LO_DS: + break; + } + + r_symndx = ELF64_R_SYM (rel->r_info); + if (!get_sym_h (&h, &sym, &sym_sec, NULL, &local_syms, + r_symndx, ibfd)) + goto error_ret; + + if (sym_sec != toc) + continue; + + if (h != NULL) + val = h->root.u.def.value; + else + val = sym->st_value; + val += rel->r_addend; + + if (val >= toc->size) + continue; + + /* Anything in the toc ought to be aligned to 8 bytes. + If not, don't mark as unused. */ + if (val & 7) + continue; + + if (skip == NULL) + { + skip = bfd_zmalloc (sizeof (*skip) * (toc->size + 7) / 8); + if (skip == NULL) + goto error_ret; + } + + skip[val >> 3] = 1; + } + + if (elf_section_data (sec)->relocs != relstart) + free (relstart); + } + + if (skip == NULL) + continue; + + used = bfd_zmalloc (sizeof (*used) * (toc->size + 7) / 8); + if (used == NULL) + { + error_ret: + if (local_syms != NULL + && symtab_hdr->contents != (unsigned char *) local_syms) + free (local_syms); + if (sec != NULL + && relstart != NULL + && elf_section_data (sec)->relocs != relstart) + free (relstart); + if (skip != NULL) + free (skip); + return FALSE; + } + + /* Now check all kept sections that might reference the toc. + Check the toc itself last. */ + for (sec = (ibfd->sections == toc && toc->next ? toc->next + : ibfd->sections); + sec != NULL; + sec = (sec == toc ? NULL + : sec->next == NULL ? toc + : sec->next == toc && toc->next ? toc->next + : sec->next)) + { + int repeat; + + if (sec->reloc_count == 0 + || elf_discarded_section (sec) + || get_opd_info (sec) + || (sec->flags & SEC_ALLOC) == 0 + || (sec->flags & SEC_DEBUGGING) != 0) + continue; + + relstart = _bfd_elf_link_read_relocs (ibfd, sec, NULL, NULL, TRUE); + if (relstart == NULL) + goto error_ret; + + /* Mark toc entries referenced as used. */ + repeat = 0; + do + for (rel = relstart; rel < relstart + sec->reloc_count; ++rel) + { + enum elf_ppc64_reloc_type r_type; + unsigned long r_symndx; + asection *sym_sec; + struct elf_link_hash_entry *h; + Elf_Internal_Sym *sym; + bfd_vma val; + + r_type = ELF64_R_TYPE (rel->r_info); + switch (r_type) + { + case R_PPC64_TOC16: + case R_PPC64_TOC16_LO: + case R_PPC64_TOC16_HI: + case R_PPC64_TOC16_HA: + case R_PPC64_TOC16_DS: + case R_PPC64_TOC16_LO_DS: + /* In case we're taking addresses of toc entries. */ + case R_PPC64_ADDR64: + break; + + default: + continue; + } + + r_symndx = ELF64_R_SYM (rel->r_info); + if (!get_sym_h (&h, &sym, &sym_sec, NULL, &local_syms, + r_symndx, ibfd)) + { + free (used); + goto error_ret; + } + + if (sym_sec != toc) + continue; + + if (h != NULL) + val = h->root.u.def.value; + else + val = sym->st_value; + val += rel->r_addend; + + if (val >= toc->size) + continue; + + /* For the toc section, we only mark as used if + this entry itself isn't unused. */ + if (sec == toc + && !used[val >> 3] + && (used[rel->r_offset >> 3] + || !skip[rel->r_offset >> 3])) + /* Do all the relocs again, to catch reference + chains. */ + repeat = 1; + + used[val >> 3] = 1; + } + while (repeat); + } + + /* Merge the used and skip arrays. Assume that TOC + doublewords not appearing as either used or unused belong + to to an entry more than one doubleword in size. */ + for (drop = skip, keep = used, last = 0, some_unused = 0; + drop < skip + (toc->size + 7) / 8; + ++drop, ++keep) + { + if (*keep) + { + *drop = 0; + last = 0; + } + else if (*drop) + { + some_unused = 1; + last = 1; + } + else + *drop = last; + } + + free (used); + + if (some_unused) + { + bfd_byte *contents, *src; + unsigned long off; + + /* Shuffle the toc contents, and at the same time convert the + skip array from booleans into offsets. */ + if (!bfd_malloc_and_get_section (ibfd, toc, &contents)) + goto error_ret; + + elf_section_data (toc)->this_hdr.contents = contents; + + for (src = contents, off = 0, drop = skip; + src < contents + toc->size; + src += 8, ++drop) + { + if (*drop) + { + *drop = (unsigned long) -1; + off += 8; + } + else if (off != 0) + { + *drop = off; + memcpy (src - off, src, 8); + } + } + toc->rawsize = toc->size; + toc->size = src - contents - off; + + if (toc->reloc_count != 0) + { + Elf_Internal_Rela *wrel; + bfd_size_type sz; + + /* Read toc relocs. */ + relstart = _bfd_elf_link_read_relocs (ibfd, toc, NULL, NULL, + TRUE); + if (relstart == NULL) + goto error_ret; + + /* Remove unused toc relocs, and adjust those we keep. */ + wrel = relstart; + for (rel = relstart; rel < relstart + toc->reloc_count; ++rel) + if (skip[rel->r_offset >> 3] != (unsigned long) -1) + { + wrel->r_offset = rel->r_offset - skip[rel->r_offset >> 3]; + wrel->r_info = rel->r_info; + wrel->r_addend = rel->r_addend; + ++wrel; + } + else if (!dec_dynrel_count (rel->r_info, toc, info, + &local_syms, NULL, NULL)) + goto error_ret; + + toc->reloc_count = wrel - relstart; + sz = elf_section_data (toc)->rel_hdr.sh_entsize; + elf_section_data (toc)->rel_hdr.sh_size = toc->reloc_count * sz; + BFD_ASSERT (elf_section_data (toc)->rel_hdr2 == NULL); + } + + /* Adjust addends for relocs against the toc section sym. */ + for (sec = ibfd->sections; sec != NULL; sec = sec->next) + { + if (sec->reloc_count == 0 + || elf_discarded_section (sec)) + continue; + + relstart = _bfd_elf_link_read_relocs (ibfd, sec, NULL, NULL, + TRUE); + if (relstart == NULL) + goto error_ret; + + for (rel = relstart; rel < relstart + sec->reloc_count; ++rel) + { + enum elf_ppc64_reloc_type r_type; + unsigned long r_symndx; + asection *sym_sec; + struct elf_link_hash_entry *h; + Elf_Internal_Sym *sym; + + r_type = ELF64_R_TYPE (rel->r_info); + switch (r_type) + { + default: + continue; + + case R_PPC64_TOC16: + case R_PPC64_TOC16_LO: + case R_PPC64_TOC16_HI: + case R_PPC64_TOC16_HA: + case R_PPC64_TOC16_DS: + case R_PPC64_TOC16_LO_DS: + case R_PPC64_ADDR64: + break; + } + + r_symndx = ELF64_R_SYM (rel->r_info); + if (!get_sym_h (&h, &sym, &sym_sec, NULL, &local_syms, + r_symndx, ibfd)) + goto error_ret; + + if (sym_sec != toc || h != NULL || sym->st_value != 0) + continue; + + rel->r_addend -= skip[rel->r_addend >> 3]; + } + } + + /* We shouldn't have local or global symbols defined in the TOC, + but handle them anyway. */ + if (local_syms != NULL) + { + Elf_Internal_Sym *sym; + + for (sym = local_syms; + sym < local_syms + symtab_hdr->sh_info; + ++sym) + if (sym->st_shndx != SHN_UNDEF + && (sym->st_shndx < SHN_LORESERVE + || sym->st_shndx > SHN_HIRESERVE) + && sym->st_value != 0 + && bfd_section_from_elf_index (ibfd, sym->st_shndx) == toc) + { + if (skip[sym->st_value >> 3] != (unsigned long) -1) + sym->st_value -= skip[sym->st_value >> 3]; + else + { + (*_bfd_error_handler) + (_("%s defined in removed toc entry"), + bfd_elf_sym_name (ibfd, symtab_hdr, sym, + NULL)); + sym->st_value = 0; + sym->st_shndx = SHN_ABS; + } + symtab_hdr->contents = (unsigned char *) local_syms; + } + } + + /* Finally, adjust any global syms defined in the toc. */ + if (toc_inf.global_toc_syms) + { + toc_inf.toc = toc; + toc_inf.skip = skip; + toc_inf.global_toc_syms = FALSE; + elf_link_hash_traverse (elf_hash_table (info), adjust_toc_syms, + &toc_inf); + } + } + + if (local_syms != NULL + && symtab_hdr->contents != (unsigned char *) local_syms) + { + if (!info->keep_memory) + free (local_syms); + else + symtab_hdr->contents = (unsigned char *) local_syms; + } + free (skip); + } + + return TRUE; +} + /* Allocate space in .plt, .got and associated reloc sections for dynamic relocs. */ @@ -5605,31 +7529,29 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) for (pent = h->plt.plist; pent != NULL; pent = pent->next) if (pent->plt.refcount > 0) { - BFD_ASSERT (((struct ppc_link_hash_entry *) h)->is_func_descriptor); - /* If this is the first .plt entry, make room for the special first entry. */ s = htab->plt; - if (s->_raw_size == 0) - s->_raw_size += PLT_INITIAL_ENTRY_SIZE; + if (s->size == 0) + s->size += PLT_INITIAL_ENTRY_SIZE; - pent->plt.offset = s->_raw_size; + pent->plt.offset = s->size; /* Make room for this entry. */ - s->_raw_size += PLT_ENTRY_SIZE; + s->size += PLT_ENTRY_SIZE; /* Make room for the .glink code. */ s = htab->glink; - if (s->_raw_size == 0) - s->_raw_size += GLINK_CALL_STUB_SIZE; + if (s->size == 0) + s->size += GLINK_CALL_STUB_SIZE; /* We need bigger stubs past index 32767. */ - if (s->_raw_size >= GLINK_CALL_STUB_SIZE + 32768*2*4) - s->_raw_size += 4; - s->_raw_size += 2*4; + if (s->size >= GLINK_CALL_STUB_SIZE + 32768*2*4) + s->size += 4; + s->size += 2*4; /* We also need to make an entry in the .rela.plt section. */ s = htab->relplt; - s->_raw_size += sizeof (Elf64_External_Rela); + s->size += sizeof (Elf64_External_Rela); doneone = TRUE; } else @@ -5637,13 +7559,13 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) if (!doneone) { h->plt.plist = NULL; - h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; + h->needs_plt = 0; } } else { h->plt.plist = NULL; - h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; + h->needs_plt = 0; } eh = (struct ppc_link_hash_entry *) h; @@ -5681,29 +7603,29 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) Undefined weak syms won't yet be marked as dynamic, nor will all TLS symbols. */ if (h->dynindx == -1 - && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) + && !h->forced_local) { if (! bfd_elf_link_record_dynamic_symbol (info, h)) return FALSE; } if ((gent->tls_type & TLS_LD) != 0 - && !(h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC)) + && !h->def_dynamic) { gent->got.offset = ppc64_tlsld_got (gent->owner)->offset; continue; } s = ppc64_elf_tdata (gent->owner)->got; - gent->got.offset = s->_raw_size; - s->_raw_size + gent->got.offset = s->size; + s->size += (gent->tls_type & eh->tls_mask & (TLS_GD | TLS_LD)) ? 16 : 8; dyn = htab->elf.dynamic_sections_created; if ((info->shared || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h)) && (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT || h->root.type != bfd_link_hash_undefweak)) - ppc64_elf_tdata (gent->owner)->relgot->_raw_size + ppc64_elf_tdata (gent->owner)->relgot->size += (gent->tls_type & eh->tls_mask & TLS_GD ? 2 * sizeof (Elf64_External_Rela) : sizeof (Elf64_External_Rela)); @@ -5745,9 +7667,21 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) /* Also discard relocs on undefined weak syms with non-default visibility. */ - if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT + if (eh->dyn_relocs != NULL && h->root.type == bfd_link_hash_undefweak) - eh->dyn_relocs = NULL; + { + if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT) + eh->dyn_relocs = NULL; + + /* Make sure this symbol is output as a dynamic symbol. + Undefined weak syms won't yet be marked as dynamic. */ + else if (h->dynindx == -1 + && !h->forced_local) + { + if (! bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } + } } else if (ELIMINATE_COPY_RELOCS) { @@ -5755,14 +7689,14 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) symbols which turn out to need copy relocs or are not dynamic. */ - if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + if (!h->non_got_ref + && h->def_dynamic + && !h->def_regular) { /* Make sure this symbol is output as a dynamic symbol. Undefined weak syms won't yet be marked as dynamic. */ if (h->dynindx == -1 - && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) + && !h->forced_local) { if (! bfd_elf_link_record_dynamic_symbol (info, h)) return FALSE; @@ -5783,7 +7717,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) for (p = eh->dyn_relocs; p != NULL; p = p->next) { asection *sreloc = elf_section_data (p->sec)->sreloc; - sreloc->_raw_size += p->count * sizeof (Elf64_External_Rela); + sreloc->size += p->count * sizeof (Elf64_External_Rela); } return TRUE; @@ -5843,7 +7777,7 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, s = bfd_get_section_by_name (dynobj, ".interp"); if (s == NULL) abort (); - s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER; + s->size = sizeof ELF_DYNAMIC_INTERPRETER; s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER; } } @@ -5859,18 +7793,18 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, Elf_Internal_Shdr *symtab_hdr; asection *srel; - if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour) + if (!is_ppc64_elf_target (ibfd->xvec)) continue; if (ppc64_tlsld_got (ibfd)->refcount > 0) { s = ppc64_elf_tdata (ibfd)->got; - ppc64_tlsld_got (ibfd)->offset = s->_raw_size; - s->_raw_size += 16; + ppc64_tlsld_got (ibfd)->offset = s->size; + s->size += 16; if (info->shared) { srel = ppc64_elf_tdata (ibfd)->relgot; - srel->_raw_size += sizeof (Elf64_External_Rela); + srel->size += sizeof (Elf64_External_Rela); } } else @@ -5880,10 +7814,7 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, { struct ppc_dyn_relocs *p; - for (p = *((struct ppc_dyn_relocs **) - &elf_section_data (s)->local_dynrel); - p != NULL; - p = p->next) + for (p = elf_section_data (s)->local_dynrel; p != NULL; p = p->next) { if (!bfd_is_abs_section (p->sec) && bfd_is_abs_section (p->sec->output_section)) @@ -5896,7 +7827,7 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, else if (p->count != 0) { srel = elf_section_data (p->sec)->sreloc; - srel->_raw_size += p->count * sizeof (Elf64_External_Rela); + srel->size += p->count * sizeof (Elf64_External_Rela); if ((p->sec->output_section->flags & SEC_READONLY) != 0) info->flags |= DF_TEXTREL; } @@ -5924,27 +7855,27 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, { if (ppc64_tlsld_got (ibfd)->offset == (bfd_vma) -1) { - ppc64_tlsld_got (ibfd)->offset = s->_raw_size; - s->_raw_size += 16; + ppc64_tlsld_got (ibfd)->offset = s->size; + s->size += 16; if (info->shared) - srel->_raw_size += sizeof (Elf64_External_Rela); + srel->size += sizeof (Elf64_External_Rela); } ent->got.offset = ppc64_tlsld_got (ibfd)->offset; } else { - ent->got.offset = s->_raw_size; + ent->got.offset = s->size; if ((ent->tls_type & *lgot_masks & TLS_GD) != 0) { - s->_raw_size += 16; + s->size += 16; if (info->shared) - srel->_raw_size += 2 * sizeof (Elf64_External_Rela); + srel->size += 2 * sizeof (Elf64_External_Rela); } else { - s->_raw_size += 8; + s->size += 8; if (info->shared) - srel->_raw_size += sizeof (Elf64_External_Rela); + srel->size += sizeof (Elf64_External_Rela); } } } @@ -5965,35 +7896,20 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, if ((s->flags & SEC_LINKER_CREATED) == 0) continue; - /* Reset _cooked_size since prelim layout will set it wrongly, - and a non-zero _cooked_size sticks. */ - s->_cooked_size = 0; - if (s == htab->brlt || s == htab->relbrlt) /* These haven't been allocated yet; don't strip. */ continue; else if (s == htab->got || s == htab->plt - || s == htab->glink) + || s == htab->glink + || s == htab->dynbss) { /* Strip this section if we don't need it; see the comment below. */ } else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0) { - if (s->_raw_size == 0) - { - /* If we don't need this section, strip it from the - output file. This is mostly to handle .rela.bss and - .rela.plt. We must create both sections in - create_dynamic_sections, because they must be created - before the linker maps input sections to output - sections. The linker does that before - adjust_dynamic_symbol is called, and it is that - function which decides whether anything needs to go - into these sections. */ - } - else + if (s->size != 0) { if (s != htab->relplt) relocs = TRUE; @@ -6009,14 +7925,22 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, continue; } - if (s->_raw_size == 0) + if (s->size == 0) { - _bfd_strip_section_from_output (info, s); + /* If we don't need this section, strip it from the + output file. This is mostly to handle .rela.bss and + .rela.plt. We must create both sections in + create_dynamic_sections, because they must be created + before the linker maps input sections to output + sections. The linker does that before + adjust_dynamic_symbol is called, and it is that + function which decides whether anything needs to go + into these sections. */ + s->flags |= SEC_EXCLUDE; continue; } - /* .plt is in the bss section. We don't initialise it. */ - if (s == htab->plt) + if ((s->flags & SEC_HAS_CONTENTS) == 0) continue; /* Allocate memory for the section contents. We use bfd_zalloc @@ -6026,26 +7950,24 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, sections instead of garbage. We also rely on the section contents being zero when writing the GOT. */ - s->contents = bfd_zalloc (dynobj, s->_raw_size); + s->contents = bfd_zalloc (dynobj, s->size); if (s->contents == NULL) return FALSE; } for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) { - /* Skip this BFD if it is not ELF */ - if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour) + if (!is_ppc64_elf_target (ibfd->xvec)) continue; s = ppc64_elf_tdata (ibfd)->got; if (s != NULL && s != htab->got) { - s->_cooked_size = 0; - if (s->_raw_size == 0) - _bfd_strip_section_from_output (info, s); + if (s->size == 0) + s->flags |= SEC_EXCLUDE; else { - s->contents = bfd_zalloc (ibfd, s->_raw_size); + s->contents = bfd_zalloc (ibfd, s->size); if (s->contents == NULL) return FALSE; } @@ -6053,12 +7975,11 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, s = ppc64_elf_tdata (ibfd)->relgot; if (s != NULL) { - s->_cooked_size = 0; - if (s->_raw_size == 0) - _bfd_strip_section_from_output (info, s); + if (s->size == 0) + s->flags |= SEC_EXCLUDE; else { - s->contents = bfd_zalloc (ibfd, s->_raw_size); + s->contents = bfd_zalloc (ibfd, s->size); if (s->contents == NULL) return FALSE; relocs = TRUE; @@ -6083,7 +8004,7 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, return FALSE; } - if (htab->plt != NULL && htab->plt->_raw_size != 0) + if (htab->plt != NULL && htab->plt->size != 0) { if (!add_dynamic_entry (DT_PLTGOT, 0) || !add_dynamic_entry (DT_PLTRELSZ, 0) @@ -6140,22 +8061,34 @@ ppc_type_of_stub (asection *input_sec, if (h != NULL) { - if (h->oh != NULL - && h->oh->dynindx != -1) + struct ppc_link_hash_entry *fdh = h; + if (fdh->oh != NULL + && fdh->oh->is_func_descriptor) + fdh = fdh->oh; + + if (fdh->elf.dynindx != -1) { struct plt_entry *ent; - for (ent = h->oh->plt.plist; ent != NULL; ent = ent->next) + + for (ent = fdh->elf.plt.plist; ent != NULL; ent = ent->next) if (ent->addend == rel->r_addend && ent->plt.offset != (bfd_vma) -1) { - *hash = (struct ppc_link_hash_entry *) h->oh; + *hash = fdh; return ppc_stub_plt_call; } } - if (!(h->elf.root.type == bfd_link_hash_defined - || h->elf.root.type == bfd_link_hash_defweak) - || h->elf.root.u.def.section->output_section == NULL) + /* Here, we know we don't have a plt entry. If we don't have a + either a defined function descriptor or a defined entry symbol + in a regular object file, then it is pointless trying to make + any other type of stub. */ + if (!((fdh->elf.root.type == bfd_link_hash_defined + || fdh->elf.root.type == bfd_link_hash_defweak) + && fdh->elf.root.u.def.section->output_section != NULL) + && !((h->elf.root.type == bfd_link_hash_defined + || h->elf.root.type == bfd_link_hash_defweak) + && h->elf.root.u.def.section->output_section != NULL)) return ppc_stub_none; } @@ -6216,7 +8149,7 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) bfd_byte *p; unsigned int indx; struct plt_entry *ent; - bfd_vma off; + bfd_vma dest, off; int size; /* Massage our args to the form they really have. */ @@ -6226,7 +8159,7 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) htab = ppc_hash_table (info); /* Make a note of the offset within the stubs for this entry. */ - stub_entry->stub_offset = stub_entry->stub_sec->_cooked_size; + stub_entry->stub_offset = stub_entry->stub_sec->size; loc = stub_entry->stub_sec->contents + stub_entry->stub_offset; htab->stub_count[stub_entry->stub_type - 1] += 1; @@ -6235,9 +8168,9 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) case ppc_stub_long_branch: case ppc_stub_long_branch_r2off: /* Branches are relative. This is where we are going to. */ - off = (stub_entry->target_value - + stub_entry->target_section->output_offset - + stub_entry->target_section->output_section->vma); + off = dest = (stub_entry->target_value + + stub_entry->target_section->output_offset + + stub_entry->target_section->output_section->vma); /* And this is where we are coming from. */ off -= (stub_entry->stub_offset @@ -6263,7 +8196,74 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) } bfd_put_32 (htab->stub_bfd, B_DOT | (off & 0x3fffffc), loc); - BFD_ASSERT (off + (1 << 25) < (bfd_vma) (1 << 26)); + if (off + (1 << 25) >= (bfd_vma) (1 << 26)) + { + (*_bfd_error_handler) (_("long branch stub `%s' offset overflow"), + stub_entry->root.string); + htab->stub_error = TRUE; + return FALSE; + } + + if (info->emitrelocations) + { + Elf_Internal_Rela *relocs, *r; + struct bfd_elf_section_data *elfsec_data; + + elfsec_data = elf_section_data (stub_entry->stub_sec); + relocs = elfsec_data->relocs; + if (relocs == NULL) + { + bfd_size_type relsize; + relsize = stub_entry->stub_sec->reloc_count * sizeof (*relocs); + relocs = bfd_alloc (htab->stub_bfd, relsize); + if (relocs == NULL) + return FALSE; + elfsec_data->relocs = relocs; + elfsec_data->rel_hdr.sh_size = relsize; + elfsec_data->rel_hdr.sh_entsize = 24; + stub_entry->stub_sec->reloc_count = 0; + } + r = relocs + stub_entry->stub_sec->reloc_count; + stub_entry->stub_sec->reloc_count += 1; + r->r_offset = loc - stub_entry->stub_sec->contents; + r->r_info = ELF64_R_INFO (0, R_PPC64_REL24); + r->r_addend = dest; + if (stub_entry->h != NULL) + { + struct elf_link_hash_entry **hashes; + unsigned long symndx; + struct ppc_link_hash_entry *h; + + hashes = elf_sym_hashes (htab->stub_bfd); + if (hashes == NULL) + { + bfd_size_type hsize; + + hsize = (htab->stub_globals + 1) * sizeof (*hashes); + hashes = bfd_zalloc (htab->stub_bfd, hsize); + if (hashes == NULL) + return FALSE; + elf_sym_hashes (htab->stub_bfd) = hashes; + htab->stub_globals = 1; + } + symndx = htab->stub_globals++; + h = stub_entry->h; + hashes[symndx] = &h->elf; + r->r_info = ELF64_R_INFO (symndx, R_PPC64_REL24); + if (h->oh != NULL && h->oh->is_func) + h = h->oh; + if (h->elf.root.u.def.section != stub_entry->target_section) + /* H is an opd symbol. The addend must be zero. */ + r->r_addend = 0; + else + { + off = (h->elf.root.u.def.value + + h->elf.root.u.def.section->output_offset + + h->elf.root.u.def.section->output_section->vma); + r->r_addend -= off; + } + } + } break; case ppc_stub_plt_branch: @@ -6274,7 +8274,7 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) if (br_entry == NULL) { (*_bfd_error_handler) (_("can't find branch stub `%s'"), - stub_entry->root.string + 9); + stub_entry->root.string); htab->stub_error = TRUE; return FALSE; } @@ -6286,7 +8286,7 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) bfd_put_64 (htab->brlt->owner, off, htab->brlt->contents + br_entry->offset); - if (info->shared) + if (htab->relbrlt != NULL) { /* Create a reloc for the branch lookup table entry. */ Elf_Internal_Rela rela; @@ -6354,17 +8354,18 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) /* Do the best we can for shared libraries built without exporting ".foo" for each "foo". This can happen when symbol versioning scripts strip all bar a subset of symbols. */ - if (stub_entry->h->oh->root.type != bfd_link_hash_defined - && stub_entry->h->oh->root.type != bfd_link_hash_defweak) + if (stub_entry->h->oh != NULL + && stub_entry->h->oh->elf.root.type != bfd_link_hash_defined + && stub_entry->h->oh->elf.root.type != bfd_link_hash_defweak) { /* Point the symbol at the stub. There may be multiple stubs, we don't really care; The main thing is to make this sym defined somewhere. Maybe defining the symbol in the stub section is a silly idea. If we didn't do this, htab->top_id could disappear. */ - stub_entry->h->oh->root.type = bfd_link_hash_defined; - stub_entry->h->oh->root.u.def.section = stub_entry->stub_sec; - stub_entry->h->oh->root.u.def.value = stub_entry->stub_offset; + stub_entry->h->oh->elf.root.type = bfd_link_hash_defined; + stub_entry->h->oh->elf.root.u.def.section = stub_entry->stub_sec; + stub_entry->h->oh->elf.root.u.def.value = stub_entry->stub_offset; } /* Now build the stub. */ @@ -6403,17 +8404,28 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) return FALSE; } - stub_entry->stub_sec->_cooked_size += size; + stub_entry->stub_sec->size += size; - if (htab->emit_stub_syms - && !(stub_entry->stub_type == ppc_stub_plt_call - && stub_entry->h->oh->root.type == bfd_link_hash_defined - && stub_entry->h->oh->root.u.def.section == stub_entry->stub_sec - && stub_entry->h->oh->root.u.def.value == stub_entry->stub_offset)) + if (htab->emit_stub_syms) { struct elf_link_hash_entry *h; - h = elf_link_hash_lookup (&htab->elf, stub_entry->root.string, - TRUE, FALSE, FALSE); + size_t len1, len2; + char *name; + const char *const stub_str[] = { "long_branch", + "long_branch_r2off", + "plt_branch", + "plt_branch_r2off", + "plt_call" }; + + len1 = strlen (stub_str[stub_entry->stub_type - 1]); + len2 = strlen (stub_entry->root.string); + name = bfd_malloc (len1 + len2 + 2); + if (name == NULL) + return FALSE; + memcpy (name, stub_entry->root.string, 9); + memcpy (name + 9, stub_str[stub_entry->stub_type - 1], len1); + memcpy (name + len1 + 9, stub_entry->root.string + 8, len2 - 8 + 1); + h = elf_link_hash_lookup (&htab->elf, name, TRUE, FALSE, FALSE); if (h == NULL) return FALSE; if (h->root.type == bfd_link_hash_new) @@ -6421,10 +8433,11 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) h->root.type = bfd_link_hash_defined; h->root.u.def.section = stub_entry->stub_sec; h->root.u.def.value = stub_entry->stub_offset; - h->elf_link_hash_flags = (ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_DEF_REGULAR - | ELF_LINK_HASH_REF_REGULAR_NONWEAK - | ELF_LINK_FORCED_LOCAL); + h->ref_regular = 1; + h->def_regular = 1; + h->ref_regular_nonweak = 1; + h->forced_local = 1; + h->non_elf = 0; } } @@ -6478,7 +8491,7 @@ ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) off = (stub_entry->target_value + stub_entry->target_section->output_offset + stub_entry->target_section->output_section->vma); - off -= (stub_entry->stub_sec->_raw_size + off -= (stub_entry->stub_sec->size + stub_entry->stub_sec->output_offset + stub_entry->stub_sec->output_section->vma); @@ -6505,7 +8518,7 @@ ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) if (br_entry == NULL) { (*_bfd_error_handler) (_("can't build branch stub `%s'"), - stub_entry->root.string + 9); + stub_entry->root.string); htab->stub_error = TRUE; return FALSE; } @@ -6513,11 +8526,11 @@ ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) if (br_entry->iter != htab->stub_iteration) { br_entry->iter = htab->stub_iteration; - br_entry->offset = htab->brlt->_raw_size; - htab->brlt->_raw_size += 8; + br_entry->offset = htab->brlt->size; + htab->brlt->size += 8; - if (info->shared) - htab->relbrlt->_raw_size += sizeof (Elf64_External_Rela); + if (htab->relbrlt != NULL) + htab->relbrlt->size += sizeof (Elf64_External_Rela); } stub_entry->stub_type += ppc_stub_plt_branch - ppc_stub_long_branch; @@ -6525,9 +8538,14 @@ ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) if (stub_entry->stub_type != ppc_stub_plt_branch) size = 28; } + + if (info->emitrelocations + && (stub_entry->stub_type == ppc_stub_long_branch + || stub_entry->stub_type == ppc_stub_long_branch_r2off)) + stub_entry->stub_sec->reloc_count += 1; } - stub_entry->stub_sec->_raw_size += size; + stub_entry->stub_sec->size += size; return TRUE; } @@ -6536,7 +8554,9 @@ ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) 0 when no stubs will be needed, and 1 on success. */ int -ppc64_elf_setup_section_lists (bfd *output_bfd, struct bfd_link_info *info) +ppc64_elf_setup_section_lists (bfd *output_bfd, + struct bfd_link_info *info, + int no_multi_toc) { bfd *input_bfd; int top_id, top_index, id; @@ -6545,6 +8565,8 @@ ppc64_elf_setup_section_lists (bfd *output_bfd, struct bfd_link_info *info) bfd_size_type amt; struct ppc_link_hash_table *htab = ppc_hash_table (info); + htab->no_multi_toc = no_multi_toc; + if (htab->brlt == NULL) return 0; @@ -6576,7 +8598,7 @@ ppc64_elf_setup_section_lists (bfd *output_bfd, struct bfd_link_info *info) /* We can't use output_bfd->section_count here to find the top output section index as some sections may have been removed, and - _bfd_strip_section_from_output doesn't renumber the indices. */ + strip_excluded_output_sections doesn't renumber the indices. */ for (section = output_bfd->sections, top_index = 0; section != NULL; section = section->next) @@ -6609,11 +8631,10 @@ ppc64_elf_next_toc_section (struct bfd_link_info *info, asection *isec) { bfd_vma addr = isec->output_offset + isec->output_section->vma; bfd_vma off = addr - htab->toc_curr; - if (off + isec->_raw_size > 0x10000) - { - htab->toc_curr = addr; - htab->multi_toc_needed = 1; - } + + if (off + isec->size > 0x10000) + htab->toc_curr = addr; + elf_gp (isec->owner) = (htab->toc_curr - elf_gp (isec->output_section->owner) + TOC_BASE_OFF); @@ -6623,11 +8644,12 @@ ppc64_elf_next_toc_section (struct bfd_link_info *info, asection *isec) /* Called after the last call to the above function. */ void -ppc64_elf_reinit_toc (bfd *output_bfd ATTRIBUTE_UNUSED, - struct bfd_link_info *info) +ppc64_elf_reinit_toc (bfd *output_bfd, struct bfd_link_info *info) { struct ppc_link_hash_table *htab = ppc_hash_table (info); + htab->multi_toc_needed = htab->toc_curr != elf_gp (output_bfd); + /* toc_curr tracks the TOC offset used for code sections below in ppc64_elf_next_input_section. Start off at 0x8000. */ htab->toc_curr = TOC_BASE_OFF; @@ -6636,64 +8658,208 @@ ppc64_elf_reinit_toc (bfd *output_bfd ATTRIBUTE_UNUSED, /* No toc references were found in ISEC. If the code in ISEC makes no calls, then there's no need to use toc adjusting stubs when branching into ISEC. Actually, indirect calls from ISEC are OK as they will - load r2. */ + load r2. Returns -1 on error, 0 for no stub needed, 1 for stub + needed, and 2 if a cyclical call-graph was found but no other reason + for a stub was detected. If called from the top level, a return of + 2 means the same as a return of 0. */ static int toc_adjusting_stub_needed (struct bfd_link_info *info, asection *isec) { - bfd_byte *contents; - bfd_size_type i; + Elf_Internal_Rela *relstart, *rel; + Elf_Internal_Sym *local_syms; int ret; - int branch_ok; + struct ppc_link_hash_table *htab; /* We know none of our code bearing sections will need toc stubs. */ if ((isec->flags & SEC_LINKER_CREATED) != 0) return 0; - if (isec->_raw_size == 0) + if (isec->size == 0) + return 0; + + if (isec->output_section == NULL) return 0; /* Hack for linux kernel. .fixup contains branches, but only back to the function that hit an exception. */ - branch_ok = strcmp (isec->name, ".fixup") == 0; + if (strcmp (isec->name, ".fixup") == 0) + return 0; - contents = elf_section_data (isec)->this_hdr.contents; - if (contents == NULL) - { - contents = bfd_malloc (isec->_raw_size); - if (contents == NULL) - return -1; - if (! bfd_get_section_contents (isec->owner, isec, contents, - 0, isec->_raw_size)) - { - free (contents); - return -1; - } - if (info->keep_memory) - elf_section_data (isec)->this_hdr.contents = contents; - } + if (isec->reloc_count == 0) + return 0; - /* Code scan, because we don't necessarily have relocs on calls to - static functions. */ + relstart = _bfd_elf_link_read_relocs (isec->owner, isec, NULL, NULL, + info->keep_memory); + if (relstart == NULL) + return -1; + + /* Look for branches to outside of this section. */ + local_syms = NULL; ret = 0; - for (i = 0; i < isec->_raw_size; i += 4) + htab = ppc_hash_table (info); + for (rel = relstart; rel < relstart + isec->reloc_count; ++rel) { - unsigned long insn = bfd_get_32 (isec->owner, contents + i); - /* Is this a branch? */ - if ((insn & (0x3f << 26)) == (18 << 26) - /* If branch and link, it's a function call. */ - && ((insn & 1) != 0 - /* Sibling calls use a plain branch. I don't know a way - of deciding whether a branch is really a sibling call. */ - || !branch_ok)) + enum elf_ppc64_reloc_type r_type; + unsigned long r_symndx; + struct elf_link_hash_entry *h; + Elf_Internal_Sym *sym; + asection *sym_sec; + long *opd_adjust; + bfd_vma sym_value; + bfd_vma dest; + + r_type = ELF64_R_TYPE (rel->r_info); + if (r_type != R_PPC64_REL24 + && r_type != R_PPC64_REL14 + && r_type != R_PPC64_REL14_BRTAKEN + && r_type != R_PPC64_REL14_BRNTAKEN) + continue; + + r_symndx = ELF64_R_SYM (rel->r_info); + if (!get_sym_h (&h, &sym, &sym_sec, NULL, &local_syms, r_symndx, + isec->owner)) + { + ret = -1; + break; + } + + /* Calls to dynamic lib functions go through a plt call stub + that uses r2. Branches to undefined symbols might be a call + using old-style dot symbols that can be satisfied by a plt + call into a new-style dynamic library. */ + if (sym_sec == NULL) + { + struct ppc_link_hash_entry *eh = (struct ppc_link_hash_entry *) h; + if (eh != NULL + && eh->oh != NULL + && eh->oh->elf.plt.plist != NULL) + { + ret = 1; + break; + } + + /* Ignore other undefined symbols. */ + continue; + } + + /* Assume branches to other sections not included in the link need + stubs too, to cover -R and absolute syms. */ + if (sym_sec->output_section == NULL) { ret = 1; break; } + + if (h == NULL) + sym_value = sym->st_value; + else + { + if (h->root.type != bfd_link_hash_defined + && h->root.type != bfd_link_hash_defweak) + abort (); + sym_value = h->root.u.def.value; + } + sym_value += rel->r_addend; + + /* If this branch reloc uses an opd sym, find the code section. */ + opd_adjust = get_opd_info (sym_sec); + if (opd_adjust != NULL) + { + if (h == NULL) + { + long adjust; + + adjust = opd_adjust[sym->st_value / 8]; + if (adjust == -1) + /* Assume deleted functions won't ever be called. */ + continue; + sym_value += adjust; + } + + dest = opd_entry_value (sym_sec, sym_value, &sym_sec, NULL); + if (dest == (bfd_vma) -1) + continue; + } + else + dest = (sym_value + + sym_sec->output_offset + + sym_sec->output_section->vma); + + /* Ignore branch to self. */ + if (sym_sec == isec) + continue; + + /* If the called function uses the toc, we need a stub. */ + if (sym_sec->has_toc_reloc + || sym_sec->makes_toc_func_call) + { + ret = 1; + break; + } + + /* Assume any branch that needs a long branch stub might in fact + need a plt_branch stub. A plt_branch stub uses r2. */ + else if (dest - (isec->output_offset + + isec->output_section->vma + + rel->r_offset) + (1 << 25) >= (2 << 25)) + { + ret = 1; + break; + } + + /* If calling back to a section in the process of being tested, we + can't say for sure that no toc adjusting stubs are needed, so + don't return zero. */ + else if (sym_sec->call_check_in_progress) + ret = 2; + + /* Branches to another section that itself doesn't have any TOC + references are OK. Recursively call ourselves to check. */ + else if (sym_sec->id <= htab->top_id + && htab->stub_group[sym_sec->id].toc_off == 0) + { + int recur; + + /* Mark current section as indeterminate, so that other + sections that call back to current won't be marked as + known. */ + isec->call_check_in_progress = 1; + recur = toc_adjusting_stub_needed (info, sym_sec); + isec->call_check_in_progress = 0; + + if (recur < 0) + { + /* An error. Exit. */ + ret = -1; + break; + } + else if (recur <= 1) + { + /* Known result. Mark as checked and set section flag. */ + htab->stub_group[sym_sec->id].toc_off = 1; + if (recur != 0) + { + sym_sec->makes_toc_func_call = 1; + ret = 1; + break; + } + } + else + { + /* Unknown result. Continue checking. */ + ret = 2; + } + } } - if (elf_section_data (isec)->this_hdr.contents != contents) - free (contents); + if (local_syms != NULL + && (elf_tdata (isec->owner)->symtab_hdr.contents + != (unsigned char *) local_syms)) + free (local_syms); + if (elf_section_data (isec)->relocs != relstart) + free (relstart); + return ret; } @@ -6706,7 +8872,6 @@ bfd_boolean ppc64_elf_next_input_section (struct bfd_link_info *info, asection *isec) { struct ppc_link_hash_table *htab = ppc_hash_table (info); - int ret; if ((isec->output_section->flags & SEC_CODE) != 0 && isec->output_section->index <= htab->top_index) @@ -6720,19 +8885,26 @@ ppc64_elf_next_input_section (struct bfd_link_info *info, asection *isec) *list = isec; } - /* If a code section has a function that uses the TOC then we need - to use the right TOC (obviously). Also, make sure that .opd gets - the correct TOC value for R_PPC64_TOC relocs that don't have or - can't find their function symbol (shouldn't ever happen now). */ - if (isec->has_gp_reloc || (isec->flags & SEC_CODE) == 0) + if (htab->multi_toc_needed) { - if (elf_gp (isec->owner) != 0) - htab->toc_curr = elf_gp (isec->owner); + /* If a code section has a function that uses the TOC then we need + to use the right TOC (obviously). Also, make sure that .opd gets + the correct TOC value for R_PPC64_TOC relocs that don't have or + can't find their function symbol (shouldn't ever happen now). */ + if (isec->has_toc_reloc || (isec->flags & SEC_CODE) == 0) + { + if (elf_gp (isec->owner) != 0) + htab->toc_curr = elf_gp (isec->owner); + } + else if (htab->stub_group[isec->id].toc_off == 0) + { + int ret = toc_adjusting_stub_needed (info, isec); + if (ret < 0) + return FALSE; + else + isec->makes_toc_func_call = ret & 1; + } } - else if ((ret = toc_adjusting_stub_needed (info, isec)) < 0) - return FALSE; - else - isec->has_gp_reloc = ret; /* Functions that don't use the TOC can belong in any TOC group. Use the last TOC base. This happens to make _init and _fini @@ -6766,11 +8938,11 @@ group_sections (struct ppc_link_hash_table *htab, bfd_vma curr_toc; curr = tail; - if (tail->_cooked_size) - total = tail->_cooked_size; - else - total = tail->_raw_size; - big_sec = total >= stub_group_size; + total = tail->size; + big_sec = total > stub_group_size; + if (big_sec) + (*_bfd_error_handler) (_("%B section %A exceeds stub group size"), + tail->owner, tail); curr_toc = htab->stub_group[tail->id].toc_off; while ((prev = PREV_SEC (curr)) != NULL @@ -6872,10 +9044,8 @@ ppc64_elf_size_stubs (bfd *output_bfd, bfd *input_bfd; unsigned int bfd_indx; asection *stub_sec; - bfd_boolean stub_changed; htab->stub_iteration += 1; - stub_changed = FALSE; for (input_bfd = info->input_bfds, bfd_indx = 0; input_bfd != NULL; @@ -6885,6 +9055,9 @@ ppc64_elf_size_stubs (bfd *output_bfd, asection *section; Elf_Internal_Sym *local_syms = NULL; + if (!is_ppc64_elf_target (input_bfd->xvec)) + continue; + /* We'll need the symbol table in a second. */ symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; if (symtab_hdr->sh_info == 0) @@ -6925,14 +9098,17 @@ ppc64_elf_size_stubs (bfd *output_bfd, unsigned int r_indx; enum ppc_stub_type stub_type; struct ppc_stub_hash_entry *stub_entry; - asection *sym_sec; + asection *sym_sec, *code_sec; bfd_vma sym_value; bfd_vma destination; + bfd_boolean ok_dest; struct ppc_link_hash_entry *hash; + struct ppc_link_hash_entry *fdh; struct elf_link_hash_entry *h; Elf_Internal_Sym *sym; char *stub_name; const asection *id_sec; + long *opd_adjust; r_type = ELF64_R_TYPE (irela->r_info); r_indx = ELF64_R_SYM (irela->r_info); @@ -6952,41 +9128,88 @@ ppc64_elf_size_stubs (bfd *output_bfd, /* Now determine the call target, its name, value, section. */ - destination = 0; if (!get_sym_h (&h, &sym, &sym_sec, NULL, &local_syms, r_indx, input_bfd)) goto error_ret_free_internal; hash = (struct ppc_link_hash_entry *) h; + ok_dest = FALSE; + fdh = NULL; + sym_value = 0; if (hash == NULL) { - /* It's a local symbol. */ sym_value = sym->st_value; - destination = (sym_value + irela->r_addend - + sym_sec->output_offset - + sym_sec->output_section->vma); + ok_dest = TRUE; + } + else if (hash->elf.root.type == bfd_link_hash_defined + || hash->elf.root.type == bfd_link_hash_defweak) + { + sym_value = hash->elf.root.u.def.value; + if (sym_sec->output_section != NULL) + ok_dest = TRUE; + } + else if (hash->elf.root.type == bfd_link_hash_undefweak + || hash->elf.root.type == bfd_link_hash_undefined) + { + /* Recognise an old ABI func code entry sym, and + use the func descriptor sym instead if it is + defined. */ + if (hash->elf.root.root.string[0] == '.' + && (fdh = get_fdh (hash, htab)) != NULL) + { + if (fdh->elf.root.type == bfd_link_hash_defined + || fdh->elf.root.type == bfd_link_hash_defweak) + { + sym_sec = fdh->elf.root.u.def.section; + sym_value = fdh->elf.root.u.def.value; + if (sym_sec->output_section != NULL) + ok_dest = TRUE; + } + else + fdh = NULL; + } } else { - /* It's an external symbol. */ - sym_value = 0; - if (hash->elf.root.type == bfd_link_hash_defined - || hash->elf.root.type == bfd_link_hash_defweak) + bfd_set_error (bfd_error_bad_value); + goto error_ret_free_internal; + } + + destination = 0; + if (ok_dest) + { + sym_value += irela->r_addend; + destination = (sym_value + + sym_sec->output_offset + + sym_sec->output_section->vma); + } + + code_sec = sym_sec; + opd_adjust = get_opd_info (sym_sec); + if (opd_adjust != NULL) + { + bfd_vma dest; + + if (hash == NULL) { - sym_value = hash->elf.root.u.def.value; - if (sym_sec->output_section != NULL) - destination = (sym_value + irela->r_addend - + sym_sec->output_offset - + sym_sec->output_section->vma); + long adjust = opd_adjust[sym_value / 8]; + if (adjust == -1) + continue; + sym_value += adjust; } - else if (hash->elf.root.type == bfd_link_hash_undefweak) - ; - else if (hash->elf.root.type == bfd_link_hash_undefined) - ; - else + dest = opd_entry_value (sym_sec, sym_value, + &code_sec, &sym_value); + if (dest != (bfd_vma) -1) { - bfd_set_error (bfd_error_bad_value); - goto error_ret_free_internal; + destination = dest; + if (fdh != NULL) + { + /* Fixup old ABI sym to point at code + entry. */ + hash->elf.root.type = bfd_link_hash_defweak; + hash->elf.root.u.def.section = code_sec; + hash->elf.root.u.def.value = sym_value; + } } } @@ -7002,12 +9225,12 @@ ppc64_elf_size_stubs (bfd *output_bfd, _init and _fini functions, it may be that a call to what looks like a local sym is in fact a call needing a TOC adjustment. */ - if (sym_sec != NULL - && sym_sec->output_section != NULL - && (htab->stub_group[sym_sec->id].toc_off + if (code_sec != NULL + && code_sec->output_section != NULL + && (htab->stub_group[code_sec->id].toc_off != htab->stub_group[section->id].toc_off) - && sym_sec->has_gp_reloc - && section->has_gp_reloc) + && (code_sec->has_toc_reloc + || code_sec->makes_toc_func_call)) stub_type = ppc_stub_long_branch_r2off; } @@ -7017,7 +9240,8 @@ ppc64_elf_size_stubs (bfd *output_bfd, /* __tls_get_addr calls might be eliminated. */ if (stub_type != ppc_stub_plt_call && hash != NULL - && &hash->elf == htab->tls_get_addr + && (hash == htab->tls_get_addr + || hash == htab->tls_get_addr_fd) && section->has_tls_reloc && irela != internal_relocs) { @@ -7065,10 +9289,12 @@ ppc64_elf_size_stubs (bfd *output_bfd, stub_entry->stub_type = stub_type; stub_entry->target_value = sym_value; - stub_entry->target_section = sym_sec; + stub_entry->target_section = code_sec; stub_entry->h = hash; stub_entry->addend = irela->r_addend; - stub_changed = TRUE; + + if (stub_entry->h != NULL) + htab->stub_globals += 1; } /* We're done with the internal relocs, free them. */ @@ -7086,34 +9312,41 @@ ppc64_elf_size_stubs (bfd *output_bfd, } } - if (!stub_changed) - break; - - /* OK, we've added some stubs. Find out the new size of the + /* We may have added some stubs. Find out the new size of the stub sections. */ for (stub_sec = htab->stub_bfd->sections; stub_sec != NULL; stub_sec = stub_sec->next) if ((stub_sec->flags & SEC_LINKER_CREATED) == 0) { - stub_sec->_raw_size = 0; - stub_sec->_cooked_size = 0; + stub_sec->rawsize = stub_sec->size; + stub_sec->size = 0; + stub_sec->reloc_count = 0; } - htab->brlt->_raw_size = 0; - htab->brlt->_cooked_size = 0; - if (info->shared) - { - htab->relbrlt->_raw_size = 0; - htab->relbrlt->_cooked_size = 0; - } + + htab->brlt->size = 0; + if (htab->relbrlt != NULL) + htab->relbrlt->size = 0; bfd_hash_traverse (&htab->stub_hash_table, ppc_size_one_stub, info); + for (stub_sec = htab->stub_bfd->sections; + stub_sec != NULL; + stub_sec = stub_sec->next) + if ((stub_sec->flags & SEC_LINKER_CREATED) == 0 + && stub_sec->rawsize != stub_sec->size) + break; + + /* Exit from this loop when no stubs have been added, and no stubs + have changed size. */ + if (stub_sec == NULL) + break; + /* Ask the linker to do its stuff. */ (*htab->layout_sections_again) (); } - /* It would be nice to strip .branch_lt from the output if the + /* It would be nice to strip htab->brlt from the output if the section is empty, but it's too late. If we strip sections here, the dynamic symbol table is corrupted since the section symbol for the stripped section isn't written. */ @@ -7192,22 +9425,21 @@ ppc64_elf_build_stubs (bfd_boolean emit_stub_syms, int stub_sec_count = 0; htab->emit_stub_syms = emit_stub_syms; + + /* Allocate memory to hold the linker stubs. */ for (stub_sec = htab->stub_bfd->sections; stub_sec != NULL; stub_sec = stub_sec->next) - if ((stub_sec->flags & SEC_LINKER_CREATED) == 0) + if ((stub_sec->flags & SEC_LINKER_CREATED) == 0 + && stub_sec->size != 0) { - bfd_size_type size; - - /* Allocate memory to hold the linker stubs. */ - size = stub_sec->_raw_size; - if (size != 0) - { - stub_sec->contents = bfd_zalloc (htab->stub_bfd, size); - if (stub_sec->contents == NULL) - return FALSE; - } - stub_sec->_cooked_size = 0; + stub_sec->contents = bfd_zalloc (htab->stub_bfd, stub_sec->size); + if (stub_sec->contents == NULL) + return FALSE; + /* We want to check that built size is the same as calculated + size. rawsize is a convenient location to use. */ + stub_sec->rawsize = stub_sec->size; + stub_sec->size = 0; } if (htab->glink != NULL && htab->glink->contents != NULL) @@ -7239,10 +9471,11 @@ ppc64_elf_build_stubs (bfd_boolean emit_stub_syms, h->root.type = bfd_link_hash_defined; h->root.u.def.section = htab->glink; h->root.u.def.value = 0; - h->elf_link_hash_flags = (ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_DEF_REGULAR - | ELF_LINK_HASH_REF_REGULAR_NONWEAK - | ELF_LINK_FORCED_LOCAL); + h->ref_regular = 1; + h->def_regular = 1; + h->ref_regular_nonweak = 1; + h->forced_local = 1; + h->non_elf = 0; } } p = htab->glink->contents; @@ -7281,7 +9514,7 @@ ppc64_elf_build_stubs (bfd_boolean emit_stub_syms, /* Build the .glink lazy link call stubs. */ indx = 0; - while (p < htab->glink->contents + htab->glink->_raw_size) + while (p < htab->glink->contents + htab->glink->size) { if (indx < 0x8000) { @@ -7300,20 +9533,20 @@ ppc64_elf_build_stubs (bfd_boolean emit_stub_syms, indx++; p += 4; } - htab->glink->_cooked_size = p - htab->glink->contents; + htab->glink->rawsize = p - htab->glink->contents; } - if (htab->brlt->_raw_size != 0) + if (htab->brlt->size != 0) { htab->brlt->contents = bfd_zalloc (htab->brlt->owner, - htab->brlt->_raw_size); + htab->brlt->size); if (htab->brlt->contents == NULL) return FALSE; } - if (info->shared && htab->relbrlt->_raw_size != 0) + if (htab->relbrlt != NULL && htab->relbrlt->size != 0) { htab->relbrlt->contents = bfd_zalloc (htab->relbrlt->owner, - htab->relbrlt->_raw_size); + htab->relbrlt->size); if (htab->relbrlt->contents == NULL) return FALSE; } @@ -7327,12 +9560,12 @@ ppc64_elf_build_stubs (bfd_boolean emit_stub_syms, if ((stub_sec->flags & SEC_LINKER_CREATED) == 0) { stub_sec_count += 1; - if (stub_sec->_raw_size != stub_sec->_cooked_size) + if (stub_sec->rawsize != stub_sec->size) break; } if (stub_sec != NULL - || htab->glink->_raw_size != htab->glink->_cooked_size) + || htab->glink->rawsize != htab->glink->size) { htab->stub_error = TRUE; (*_bfd_error_handler) (_("stubs don't match calculated size")); @@ -7347,13 +9580,14 @@ ppc64_elf_build_stubs (bfd_boolean emit_stub_syms, if (*stats == NULL) return FALSE; - sprintf (*stats, _("linker stubs in %u groups\n" + sprintf (*stats, _("linker stubs in %u group%s\n" " branch %lu\n" " toc adjust %lu\n" " long branch %lu\n" " long toc adj %lu\n" " plt call %lu"), stub_sec_count, + stub_sec_count == 1 ? "" : "s", htab->stub_count[ppc_stub_long_branch - 1], htab->stub_count[ppc_stub_long_branch_r2off - 1], htab->stub_count[ppc_stub_plt_branch - 1], @@ -7363,6 +9597,52 @@ ppc64_elf_build_stubs (bfd_boolean emit_stub_syms, return TRUE; } +/* This function undoes the changes made by add_symbol_adjust. */ + +static bfd_boolean +undo_symbol_twiddle (struct elf_link_hash_entry *h, void *inf ATTRIBUTE_UNUSED) +{ + struct ppc_link_hash_entry *eh; + + if (h->root.type == bfd_link_hash_indirect) + return TRUE; + + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + eh = (struct ppc_link_hash_entry *) h; + if (eh->elf.root.type != bfd_link_hash_undefweak || !eh->was_undefined) + return TRUE; + + eh->elf.root.type = bfd_link_hash_undefined; + return TRUE; +} + +void +ppc64_elf_restore_symbols (struct bfd_link_info *info) +{ + struct ppc_link_hash_table *htab = ppc_hash_table (info); + elf_link_hash_traverse (&htab->elf, undo_symbol_twiddle, info); +} + +/* What to do when ld finds relocations against symbols defined in + discarded sections. */ + +static unsigned int +ppc64_elf_action_discarded (asection *sec) +{ + if (strcmp (".opd", sec->name) == 0) + return 0; + + if (strcmp (".toc", sec->name) == 0) + return 0; + + if (strcmp (".toc1", sec->name) == 0) + return 0; + + return _bfd_elf_default_action_discarded (sec); +} + /* The RELOCATE_SECTION function is called by the ELF backend linker to handle the relocations for a section. @@ -7416,14 +9696,16 @@ ppc64_elf_relocate_section (bfd *output_bfd, /* Disabled until we sort out how ld should choose 'y' vs 'at'. */ bfd_boolean is_power4 = FALSE; - if (info->relocatable) - return TRUE; - /* Initialize howto table if needed. */ if (!ppc64_elf_howto_table[R_PPC64_ADDR32]) ppc_howto_init (); htab = ppc_hash_table (info); + + /* Don't relocate stub sections. */ + if (input_section->owner == htab->stub_bfd) + return TRUE; + local_got_ents = elf_local_got_ents (input_bfd); TOCstart = elf_gp (output_bfd); symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; @@ -7435,12 +9717,13 @@ ppc64_elf_relocate_section (bfd *output_bfd, for (; rel < relend; rel++) { enum elf_ppc64_reloc_type r_type; - bfd_vma addend; + bfd_vma addend, orig_addend; bfd_reloc_status_type r; Elf_Internal_Sym *sym; asection *sec; - struct elf_link_hash_entry *h; - struct elf_link_hash_entry *fdh; + struct elf_link_hash_entry *h_elf; + struct ppc_link_hash_entry *h; + struct ppc_link_hash_entry *fdh; const char *sym_name; unsigned long r_symndx, toc_symndx; char tls_mask, tls_gd, tls_type; @@ -7467,37 +9750,56 @@ ppc64_elf_relocate_section (bfd *output_bfd, sym = NULL; sec = NULL; - h = NULL; + h_elf = NULL; sym_name = NULL; unresolved_reloc = FALSE; warned = FALSE; + orig_addend = rel->r_addend; if (r_symndx < symtab_hdr->sh_info) { /* It's a local symbol. */ + long *opd_adjust; + sym = local_syms + r_symndx; sec = local_sections[r_symndx]; - sym_name = bfd_elf_local_sym_name (input_bfd, sym); + sym_name = bfd_elf_sym_name (input_bfd, symtab_hdr, sym, sec); sym_type = ELF64_ST_TYPE (sym->st_info); relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); - if (elf_section_data (sec) != NULL) + opd_adjust = get_opd_info (sec); + if (opd_adjust != NULL) { - long *opd_sym_adjust; - - opd_sym_adjust = ppc64_elf_section_data (sec)->opd.adjust; - if (opd_sym_adjust != NULL) - relocation += opd_sym_adjust[sym->st_value / 24]; + long adjust = opd_adjust[(sym->st_value + rel->r_addend) / 8]; + if (adjust == -1) + relocation = 0; + else + { + /* If this is a relocation against the opd section sym + and we have edited .opd, adjust the reloc addend so + that ld -r and ld --emit-relocs output is correct. + If it is a reloc against some other .opd symbol, + then the symbol value will be adjusted later. */ + if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) + rel->r_addend += adjust; + else + relocation += adjust; + } } + if (info->relocatable) + continue; } else { + if (info->relocatable) + continue; RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel, r_symndx, symtab_hdr, sym_hashes, - h, sec, relocation, + h_elf, sec, relocation, unresolved_reloc, warned); - sym_name = h->root.root.string; - sym_type = h->type; + sym_name = h_elf->root.root.string; + sym_type = h_elf->type; } + h = (struct ppc_link_hash_entry *) h_elf; /* TLS optimizations. Replace instruction sequences and relocs based on information we collected in tls_optimize. We edit @@ -7509,7 +9811,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, if (IS_PPC64_TLS_RELOC (r_type)) { if (h != NULL) - tls_mask = ((struct ppc_link_hash_entry *) h)->tls_mask; + tls_mask = h->tls_mask; else if (local_got_ents != NULL) { char *lgot_masks; @@ -7535,8 +9837,8 @@ ppc64_elf_relocate_section (bfd *output_bfd, if (r_symndx != 0 && r_type != R_PPC64_NONE && (h == NULL - || h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) + || h->elf.root.type == bfd_link_hash_defined + || h->elf.root.type == bfd_link_hash_defweak) && IS_PPC64_TLS_RELOC (r_type) != (sym_type == STT_TLS)) { if (r_type == R_PPC64_TLS && tls_mask != 0) @@ -7545,10 +9847,10 @@ ppc64_elf_relocate_section (bfd *output_bfd, else (*_bfd_error_handler) (sym_type == STT_TLS - ? _("%s(%s+0x%lx): %s used with TLS symbol %s") - : _("%s(%s+0x%lx): %s used with non-TLS symbol %s"), - bfd_archive_filename (input_bfd), - input_section->name, + ? _("%B(%A+0x%lx): %s used with TLS symbol %s") + : _("%B(%A+0x%lx): %s used with non-TLS symbol %s"), + input_bfd, + input_section, (long) rel->r_offset, ppc64_elf_howto_table[r_type]->name, sym_name); @@ -7753,7 +10055,8 @@ ppc64_elf_relocate_section (bfd *output_bfd, while (h2->root.type == bfd_link_hash_indirect || h2->root.type == bfd_link_hash_warning) h2 = (struct elf_link_hash_entry *) h2->root.u.i.link; - if (h2 == NULL || h2 != htab->tls_get_addr) + if (h2 == NULL || (h2 != &htab->tls_get_addr->elf + && h2 != &htab->tls_get_addr_fd->elf)) break; /* OK, it checks out. Replace the call. */ @@ -7857,6 +10160,8 @@ ppc64_elf_relocate_section (bfd *output_bfd, /* Handle other relocations that tweak non-addend part of insn. */ insn = 0; + max_br_offset = 1 << 25; + addend = rel->r_addend; switch (r_type) { default: @@ -7873,31 +10178,11 @@ ppc64_elf_relocate_section (bfd *output_bfd, case R_PPC64_REL14_BRNTAKEN: insn |= bfd_get_32 (output_bfd, contents + rel->r_offset) & ~(0x01 << 21); - if (is_power4) - { - /* Set 'a' bit. This is 0b00010 in BO field for branch - on CR(BI) insns (BO == 001at or 011at), and 0b01000 - for branch on CTR insns (BO == 1a00t or 1a01t). */ - if ((insn & (0x14 << 21)) == (0x04 << 21)) - insn |= 0x02 << 21; - else if ((insn & (0x14 << 21)) == (0x10 << 21)) - insn |= 0x08 << 21; - else - break; - } - else - { - from = (rel->r_offset - + input_section->output_offset - + input_section->output_section->vma); + /* Fall thru. */ - /* Invert 'y' bit if not the default. */ - if ((bfd_signed_vma) (relocation + rel->r_addend - from) < 0) - insn ^= 0x01 << 21; - } - - bfd_put_32 (output_bfd, insn, contents + rel->r_offset); - break; + case R_PPC64_REL14: + max_br_offset = 1 << 15; + /* Fall thru. */ case R_PPC64_REL24: /* Calls to functions with a different TOC, such as calls to @@ -7906,11 +10191,15 @@ ppc64_elf_relocate_section (bfd *output_bfd, linkage stubs needs to be followed by a nop, as the nop will be replaced with an instruction to restore the TOC base pointer. */ + stub_entry = NULL; + fdh = h; if (((h != NULL - && (fdh = ((struct ppc_link_hash_entry *) h)->oh) != NULL - && fdh->plt.plist != NULL) - || ((fdh = h, sec) != NULL + && (((fdh = h->oh) != NULL + && fdh->elf.plt.plist != NULL) + || (fdh = h)->elf.plt.plist != NULL)) + || (sec != NULL && sec->output_section != NULL + && sec->id <= htab->top_id && (htab->stub_group[sec->id].toc_off != htab->stub_group[input_section->id].toc_off))) && (stub_entry = ppc_get_stub_entry (input_section, sec, fdh, @@ -7919,17 +10208,18 @@ ppc64_elf_relocate_section (bfd *output_bfd, || stub_entry->stub_type == ppc_stub_plt_branch_r2off || stub_entry->stub_type == ppc_stub_long_branch_r2off)) { - bfd_boolean can_plt_call = 0; + bfd_boolean can_plt_call = FALSE; - if (rel->r_offset + 8 <= input_section->_cooked_size) + if (rel->r_offset + 8 <= input_section->size) { - insn = bfd_get_32 (input_bfd, contents + rel->r_offset + 4); - if (insn == NOP - || insn == CROR_151515 || insn == CROR_313131) + unsigned long nop; + nop = bfd_get_32 (input_bfd, contents + rel->r_offset + 4); + if (nop == NOP + || nop == CROR_151515 || nop == CROR_313131) { bfd_put_32 (input_bfd, LD_R2_40R1, contents + rel->r_offset + 4); - can_plt_call = 1; + can_plt_call = TRUE; } } @@ -7938,17 +10228,22 @@ ppc64_elf_relocate_section (bfd *output_bfd, if (stub_entry->stub_type == ppc_stub_plt_call) { /* If this is a plain branch rather than a branch - and link, don't require a nop. */ - insn = bfd_get_32 (input_bfd, contents + rel->r_offset); - if ((insn & 1) == 0) - can_plt_call = 1; + and link, don't require a nop. However, don't + allow tail calls in a shared library as they + will result in r2 being corrupted. */ + unsigned long br; + br = bfd_get_32 (input_bfd, contents + rel->r_offset); + if (info->executable && (br & 1) == 0) + can_plt_call = TRUE; + else + stub_entry = NULL; } else if (h != NULL - && strcmp (h->root.root.string, + && strcmp (h->elf.root.root.string, ".__libc_start_main") == 0) { /* Allow crt1 branch to go via a toc adjusting stub. */ - can_plt_call = 1; + can_plt_call = TRUE; } else { @@ -7957,21 +10252,21 @@ ppc64_elf_relocate_section (bfd *output_bfd, || strcmp (input_section->output_section->name, ".fini") == 0) (*_bfd_error_handler) - (_("%s(%s+0x%lx): automatic multiple TOCs " + (_("%B(%A+0x%lx): automatic multiple TOCs " "not supported using your crt files; " "recompile with -mminimal-toc or upgrade gcc"), - bfd_archive_filename (input_bfd), - input_section->name, + input_bfd, + input_section, (long) rel->r_offset); else (*_bfd_error_handler) - (_("%s(%s+0x%lx): sibling call optimization to `%s' " + (_("%B(%A+0x%lx): sibling call optimization to `%s' " "does not allow automatic multiple TOCs; " "recompile with -mminimal-toc or " "-fno-optimize-sibling-calls, " "or make `%s' extern"), - bfd_archive_filename (input_bfd), - input_section->name, + input_bfd, + input_section, (long) rel->r_offset, sym_name, sym_name); @@ -7980,51 +10275,97 @@ ppc64_elf_relocate_section (bfd *output_bfd, } } - if (can_plt_call) + if (can_plt_call + && stub_entry->stub_type == ppc_stub_plt_call) + unresolved_reloc = FALSE; + } + + if (stub_entry == NULL + && get_opd_info (sec) != NULL) + { + /* The branch destination is the value of the opd entry. */ + bfd_vma off = (relocation + addend + - sec->output_section->vma + - sec->output_offset); + bfd_vma dest = opd_entry_value (sec, off, NULL, NULL); + if (dest != (bfd_vma) -1) { - relocation = (stub_entry->stub_offset - + stub_entry->stub_sec->output_offset - + stub_entry->stub_sec->output_section->vma); - if (stub_entry->stub_type == ppc_stub_plt_call) - unresolved_reloc = FALSE; + relocation = dest; + addend = 0; } } - if (h != NULL - && h->root.type == bfd_link_hash_undefweak - && relocation == 0 - && rel->r_addend == 0) - { - /* Tweak calls to undefined weak functions to point at a - blr. We can thus call a weak function without first - checking whether the function is defined. We have a - blr at the end of .sfpr. */ - BFD_ASSERT (htab->sfpr->_raw_size != 0); - relocation = (htab->sfpr->_raw_size - 4 - + htab->sfpr->output_offset - + htab->sfpr->output_section->vma); - from = (rel->r_offset - + input_section->output_offset - + input_section->output_section->vma); + /* If the branch is out of reach we ought to have a long + branch stub. */ + from = (rel->r_offset + + input_section->output_offset + + input_section->output_section->vma); - /* But let's not be silly about it. If the blr isn't in - reach, just go to the next instruction. */ - if (relocation - from + (1 << 25) >= (1 << 26) - || htab->sfpr->_raw_size == 0) - relocation = from + 4; + if (stub_entry == NULL + && (relocation + addend - from + max_br_offset + >= 2 * max_br_offset) + && r_type != R_PPC64_ADDR14_BRTAKEN + && r_type != R_PPC64_ADDR14_BRNTAKEN) + stub_entry = ppc_get_stub_entry (input_section, sec, h, rel, + htab); + + if (stub_entry != NULL) + { + /* Munge up the value and addend so that we call the stub + rather than the procedure directly. */ + relocation = (stub_entry->stub_offset + + stub_entry->stub_sec->output_offset + + stub_entry->stub_sec->output_section->vma); + addend = 0; + } + + if (insn != 0) + { + if (is_power4) + { + /* Set 'a' bit. This is 0b00010 in BO field for branch + on CR(BI) insns (BO == 001at or 011at), and 0b01000 + for branch on CTR insns (BO == 1a00t or 1a01t). */ + if ((insn & (0x14 << 21)) == (0x04 << 21)) + insn |= 0x02 << 21; + else if ((insn & (0x14 << 21)) == (0x10 << 21)) + insn |= 0x08 << 21; + else + break; + } + else + { + /* Invert 'y' bit if not the default. */ + if ((bfd_signed_vma) (relocation + addend - from) < 0) + insn ^= 0x01 << 21; + } + + bfd_put_32 (output_bfd, insn, contents + rel->r_offset); + } + + /* NOP out calls to undefined weak functions. + We can thus call a weak function without first + checking whether the function is defined. */ + else if (h != NULL + && h->elf.root.type == bfd_link_hash_undefweak + && r_type == R_PPC64_REL24 + && relocation == 0 + && addend == 0) + { + bfd_put_32 (output_bfd, NOP, contents + rel->r_offset); + continue; } break; } /* Set `addend'. */ tls_type = 0; - addend = rel->r_addend; switch (r_type) { default: (*_bfd_error_handler) - (_("%s: unknown relocation type %d for symbol %s"), - bfd_archive_filename (input_bfd), (int) r_type, sym_name); + (_("%B: unknown relocation type %d for symbol %s"), + input_bfd, (int) r_type, sym_name); bfd_set_error (bfd_error_bad_value); ret = FALSE; @@ -8085,7 +10426,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, if (tls_type == (TLS_TLS | TLS_LD) && (h == NULL - || !(h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC))) + || !h->elf.def_dynamic)) offp = &ppc64_tlsld_got (input_bfd)->offset; else { @@ -8094,9 +10435,10 @@ ppc64_elf_relocate_section (bfd *output_bfd, if (h != NULL) { bfd_boolean dyn = htab->elf.dynamic_sections_created; - if (!WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h) + if (!WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, + &h->elf) || (info->shared - && SYMBOL_REFERENCES_LOCAL (info, h))) + && SYMBOL_REFERENCES_LOCAL (info, &h->elf))) /* This is actually a static link, or it is a -Bsymbolic link and the symbol is defined locally, or the symbol was forced to be local @@ -8104,10 +10446,10 @@ ppc64_elf_relocate_section (bfd *output_bfd, ; else { - indx = h->dynindx; + indx = h->elf.dynindx; unresolved_reloc = FALSE; } - ent = h->got.glist; + ent = h->elf.got.glist; } else { @@ -8117,7 +10459,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, } for (; ent != NULL; ent = ent->next) - if (ent->addend == rel->r_addend + if (ent->addend == orig_addend && ent->owner == input_bfd && ent->tls_type == tls_type) break; @@ -8146,13 +10488,13 @@ ppc64_elf_relocate_section (bfd *output_bfd, *offp = off | 1; if ((info->shared || indx != 0) && (h == NULL - || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT - || h->root.type != bfd_link_hash_undefweak)) + || ELF_ST_VISIBILITY (h->elf.other) == STV_DEFAULT + || h->elf.root.type != bfd_link_hash_undefweak)) { outrel.r_offset = (got->output_section->vma + got->output_offset + off); - outrel.r_addend = rel->r_addend; + outrel.r_addend = addend; if (tls_type & (TLS_LD | TLS_GD)) { outrel.r_addend = 0; @@ -8165,7 +10507,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc); outrel.r_offset += 8; - outrel.r_addend = rel->r_addend; + outrel.r_addend = addend; outrel.r_info = ELF64_R_INFO (indx, R_PPC64_DTPREL64); } @@ -8203,7 +10545,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, emitting a reloc. */ else { - relocation += rel->r_addend; + relocation += addend; if (tls_type == (TLS_TLS | TLS_LD)) relocation = 1; else if (tls_type != 0) @@ -8255,8 +10597,8 @@ ppc64_elf_relocate_section (bfd *output_bfd, if (htab->plt != NULL) { struct plt_entry *ent; - for (ent = h->plt.plist; ent != NULL; ent = ent->next) - if (ent->addend == rel->r_addend + for (ent = h->elf.plt.plist; ent != NULL; ent = ent->next) + if (ent->addend == orig_addend && ent->plt.offset != (bfd_vma) -1) { relocation = (htab->plt->output_section->vma @@ -8395,17 +10737,17 @@ ppc64_elf_relocate_section (bfd *output_bfd, if ((info->shared && (h == NULL - || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT - || h->root.type != bfd_link_hash_undefweak) + || ELF_ST_VISIBILITY (h->elf.other) == STV_DEFAULT + || h->elf.root.type != bfd_link_hash_undefweak) && (MUST_BE_DYN_RELOC (r_type) - || !SYMBOL_CALLS_LOCAL (info, h))) + || !SYMBOL_CALLS_LOCAL (info, &h->elf))) || (ELIMINATE_COPY_RELOCS && !info->shared && h != NULL - && h->dynindx != -1 - && (h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)) + && h->elf.dynindx != -1 + && !h->elf.non_got_ref + && h->elf.def_dynamic + && !h->elf.def_regular)) { Elf_Internal_Rela outrel; bfd_boolean skip, relocate; @@ -8444,10 +10786,10 @@ ppc64_elf_relocate_section (bfd *output_bfd, if (skip) memset (&outrel, 0, sizeof outrel); - else if (!SYMBOL_REFERENCES_LOCAL (info, h) + else if (!SYMBOL_REFERENCES_LOCAL (info, &h->elf) && !is_opd && r_type != R_PPC64_TOC) - outrel.r_info = ELF64_R_INFO (h->dynindx, r_type); + outrel.r_info = ELF64_R_INFO (h->elf.dynindx, r_type); else { /* This symbol is local, or marked to become local, @@ -8512,6 +10854,9 @@ ppc64_elf_relocate_section (bfd *output_bfd, if (sreloc == NULL) abort (); + if (sreloc->reloc_count * sizeof (Elf64_External_Rela) + >= sreloc->size) + abort (); loc = sreloc->contents; loc += sreloc->reloc_count++ * sizeof (Elf64_External_Rela); bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc); @@ -8563,8 +10908,8 @@ ppc64_elf_relocate_section (bfd *output_bfd, /* These ones haven't been implemented yet. */ (*_bfd_error_handler) - (_("%s: relocation %s is not supported for symbol %s."), - bfd_archive_filename (input_bfd), + (_("%B: relocation %s is not supported for symbol %s."), + input_bfd, ppc64_elf_howto_table[r_type]->name, sym_name); bfd_set_error (bfd_error_invalid_operation); @@ -8642,8 +10987,8 @@ ppc64_elf_relocate_section (bfd *output_bfd, if (((relocation + addend) & mask) != 0) { (*_bfd_error_handler) - (_("%s: error: relocation %s not a multiple of %d"), - bfd_archive_filename (input_bfd), + (_("%B: error: relocation %s not a multiple of %d"), + input_bfd, ppc64_elf_howto_table[r_type]->name, mask + 1); bfd_set_error (bfd_error_bad_value); @@ -8651,40 +10996,6 @@ ppc64_elf_relocate_section (bfd *output_bfd, continue; } break; - - case R_PPC64_REL14: - case R_PPC64_REL14_BRNTAKEN: - case R_PPC64_REL14_BRTAKEN: - max_br_offset = 1 << 15; - goto branch_check; - - case R_PPC64_REL24: - max_br_offset = 1 << 25; - - branch_check: - /* If the branch is out of reach or the TOC register needs - adjusting, then redirect the call to the local stub for - this function. */ - from = (rel->r_offset - + input_section->output_offset - + input_section->output_section->vma); - if ((relocation + addend - from + max_br_offset >= 2 * max_br_offset - || (sec != NULL - && sec->output_section != NULL - && sec->id <= htab->top_id - && (htab->stub_group[sec->id].toc_off - != htab->stub_group[input_section->id].toc_off))) - && (stub_entry = ppc_get_stub_entry (input_section, sec, h, - rel, htab)) != NULL) - { - /* Munge up the value and addend so that we call the stub - rather than the procedure directly. */ - relocation = (stub_entry->stub_offset - + stub_entry->stub_sec->output_offset - + stub_entry->stub_sec->output_section->vma); - addend = 0; - } - break; } /* Dynamic relocs are not propagated for SEC_DEBUGGING sections @@ -8692,15 +11003,15 @@ ppc64_elf_relocate_section (bfd *output_bfd, not process them. */ if (unresolved_reloc && !((input_section->flags & SEC_DEBUGGING) != 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0)) + && h->elf.def_dynamic)) { (*_bfd_error_handler) - (_("%s(%s+0x%lx): unresolvable %s relocation against symbol `%s'"), - bfd_archive_filename (input_bfd), - bfd_get_section_name (input_bfd, input_section), + (_("%B(%A+0x%lx): unresolvable %s relocation against symbol `%s'"), + input_bfd, + input_section, (long) rel->r_offset, ppc64_elf_howto_table[(int) r_type]->name, - h->root.root.string); + h->elf.root.root.string); ret = FALSE; } @@ -8721,7 +11032,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, if (warned) continue; if (h != NULL - && h->root.type == bfd_link_hash_undefweak + && h->elf.root.type == bfd_link_hash_undefweak && ppc64_elf_howto_table[r_type]->pc_relative) { /* Assume this is a call protected by other code that @@ -8734,16 +11045,17 @@ ppc64_elf_relocate_section (bfd *output_bfd, } if (!((*info->callbacks->reloc_overflow) - (info, sym_name, ppc64_elf_howto_table[r_type]->name, - rel->r_addend, input_bfd, input_section, rel->r_offset))) + (info, (h ? &h->elf.root : NULL), sym_name, + ppc64_elf_howto_table[r_type]->name, + orig_addend, input_bfd, input_section, rel->r_offset))) return FALSE; } else { (*_bfd_error_handler) - (_("%s(%s+0x%lx): %s reloc against `%s': error %d"), - bfd_archive_filename (input_bfd), - bfd_get_section_name (input_bfd, input_section), + (_("%B(%A+0x%lx): %s reloc against `%s': error %d"), + input_bfd, + input_section, (long) rel->r_offset, ppc64_elf_howto_table[r_type]->name, sym_name, @@ -8753,6 +11065,22 @@ ppc64_elf_relocate_section (bfd *output_bfd, } } + /* If we're emitting relocations, then shortly after this function + returns, reloc offsets and addends for this section will be + adjusted. Worse, reloc symbol indices will be for the output + file rather than the input. Save a copy of the relocs for + opd_entry_value. */ + if (is_opd && (info->emitrelocations || info->relocatable)) + { + bfd_size_type amt; + amt = input_section->reloc_count * sizeof (Elf_Internal_Rela); + rel = bfd_alloc (input_bfd, amt); + BFD_ASSERT (ppc64_elf_tdata (input_bfd)->opd_relocs == NULL); + ppc64_elf_tdata (input_bfd)->opd_relocs = rel; + if (rel == NULL) + return FALSE; + memcpy (rel, relocs, amt); + } return ret; } @@ -8765,20 +11093,25 @@ ppc64_elf_output_symbol_hook (struct bfd_link_info *info, asection *input_sec, struct elf_link_hash_entry *h) { - long *adjust; + long *opd_adjust, adjust; bfd_vma value; - if (h != NULL - || input_sec == NULL - || ppc64_elf_section_data (input_sec) == NULL - || (adjust = ppc64_elf_section_data (input_sec)->opd.adjust) == NULL) + if (h != NULL) + return TRUE; + + opd_adjust = get_opd_info (input_sec); + if (opd_adjust == NULL) return TRUE; value = elfsym->st_value - input_sec->output_offset; if (!info->relocatable) value -= input_sec->output_section->vma; - elfsym->st_value += adjust[value / 24]; + adjust = opd_adjust[value / 8]; + if (adjust == -1) + elfsym->st_value = 0; + else + elfsym->st_value += adjust; return TRUE; } @@ -8793,43 +11126,39 @@ ppc64_elf_finish_dynamic_symbol (bfd *output_bfd, { struct ppc_link_hash_table *htab; bfd *dynobj; + struct plt_entry *ent; + Elf_Internal_Rela rela; + bfd_byte *loc; htab = ppc_hash_table (info); dynobj = htab->elf.dynobj; - if (((struct ppc_link_hash_entry *) h)->is_func_descriptor) - { - struct plt_entry *ent; - Elf_Internal_Rela rela; - bfd_byte *loc; + for (ent = h->plt.plist; ent != NULL; ent = ent->next) + if (ent->plt.offset != (bfd_vma) -1) + { + /* This symbol has an entry in the procedure linkage + table. Set it up. */ - for (ent = h->plt.plist; ent != NULL; ent = ent->next) - if (ent->plt.offset != (bfd_vma) -1) - { - /* This symbol has an entry in the procedure linkage - table. Set it up. */ + if (htab->plt == NULL + || htab->relplt == NULL + || htab->glink == NULL) + abort (); - if (htab->plt == NULL - || htab->relplt == NULL - || htab->glink == NULL) - abort (); + /* Create a JMP_SLOT reloc to inform the dynamic linker to + fill in the PLT entry. */ + rela.r_offset = (htab->plt->output_section->vma + + htab->plt->output_offset + + ent->plt.offset); + rela.r_info = ELF64_R_INFO (h->dynindx, R_PPC64_JMP_SLOT); + rela.r_addend = ent->addend; - /* Create a JMP_SLOT reloc to inform the dynamic linker to - fill in the PLT entry. */ - rela.r_offset = (htab->plt->output_section->vma - + htab->plt->output_offset - + ent->plt.offset); - rela.r_info = ELF64_R_INFO (h->dynindx, R_PPC64_JMP_SLOT); - rela.r_addend = ent->addend; + loc = htab->relplt->contents; + loc += ((ent->plt.offset - PLT_INITIAL_ENTRY_SIZE) / PLT_ENTRY_SIZE + * sizeof (Elf64_External_Rela)); + bfd_elf64_swap_reloca_out (output_bfd, &rela, loc); + } - loc = htab->relplt->contents; - loc += ((ent->plt.offset - PLT_INITIAL_ENTRY_SIZE) / PLT_ENTRY_SIZE - * sizeof (Elf64_External_Rela)); - bfd_elf64_swap_reloca_out (output_bfd, &rela, loc); - } - } - - if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0) + if (h->needs_copy) { Elf_Internal_Rela rela; bfd_byte *loc; @@ -8903,7 +11232,7 @@ ppc64_elf_finish_dynamic_sections (bfd *output_bfd, abort (); dyncon = (Elf64_External_Dyn *) sdyn->contents; - dynconend = (Elf64_External_Dyn *) (sdyn->contents + sdyn->_raw_size); + dynconend = (Elf64_External_Dyn *) (sdyn->contents + sdyn->size); for (; dyncon < dynconend; dyncon++) { Elf_Internal_Dyn dyn; @@ -8937,7 +11266,7 @@ ppc64_elf_finish_dynamic_sections (bfd *output_bfd, s = bfd_get_section_by_name (output_bfd, ".opd"); if (s == NULL) continue; - dyn.d_un.d_val = s->_raw_size; + dyn.d_un.d_val = s->size; break; case DT_PLTGOT: @@ -8951,7 +11280,7 @@ ppc64_elf_finish_dynamic_sections (bfd *output_bfd, break; case DT_PLTRELSZ: - dyn.d_un.d_val = htab->relplt->_raw_size; + dyn.d_un.d_val = htab->relplt->size; break; case DT_RELASZ: @@ -8960,7 +11289,7 @@ ppc64_elf_finish_dynamic_sections (bfd *output_bfd, s = htab->relplt; if (s == NULL) continue; - dyn.d_un.d_val -= s->_raw_size; + dyn.d_un.d_val -= s->size; break; case DT_RELA: @@ -8972,7 +11301,7 @@ ppc64_elf_finish_dynamic_sections (bfd *output_bfd, continue; if (dyn.d_un.d_ptr != s->output_section->vma + s->output_offset) continue; - dyn.d_un.d_ptr += s->_raw_size; + dyn.d_un.d_ptr += s->size; break; } @@ -8980,7 +11309,7 @@ ppc64_elf_finish_dynamic_sections (bfd *output_bfd, } } - if (htab->got != NULL && htab->got->_raw_size != 0) + if (htab->got != NULL && htab->got->size != 0) { /* Fill in the first entry in the global offset table. We use it to hold the link-time TOCbase. */ @@ -8992,7 +11321,7 @@ ppc64_elf_finish_dynamic_sections (bfd *output_bfd, elf_section_data (htab->got->output_section)->this_hdr.sh_entsize = 8; } - if (htab->plt != NULL && htab->plt->_raw_size != 0) + if (htab->plt != NULL && htab->plt->size != 0) { /* Set .plt entry size. */ elf_section_data (htab->plt->output_section)->this_hdr.sh_entsize @@ -9000,29 +11329,30 @@ ppc64_elf_finish_dynamic_sections (bfd *output_bfd, } /* We need to handle writing out multiple GOT sections ourselves, - since we didn't add them to DYNOBJ. */ + since we didn't add them to DYNOBJ. We know dynobj is the first + bfd. */ while ((dynobj = dynobj->link_next) != NULL) { asection *s; - if (bfd_get_flavour (dynobj) != bfd_target_elf_flavour) + if (!is_ppc64_elf_target (dynobj->xvec)) continue; s = ppc64_elf_tdata (dynobj)->got; if (s != NULL - && s->_raw_size != 0 + && s->size != 0 && s->output_section != bfd_abs_section_ptr && !bfd_set_section_contents (output_bfd, s->output_section, s->contents, s->output_offset, - s->_raw_size)) + s->size)) return FALSE; s = ppc64_elf_tdata (dynobj)->relgot; if (s != NULL - && s->_raw_size != 0 + && s->size != 0 && s->output_section != bfd_abs_section_ptr && !bfd_set_section_contents (output_bfd, s->output_section, s->contents, s->output_offset, - s->_raw_size)) + s->size)) return FALSE; } diff --git a/contrib/binutils/bfd/elf64-ppc.h b/contrib/binutils/bfd/elf64-ppc.h index 998e7e13e0e..a27e93e95de 100644 --- a/contrib/binutils/bfd/elf64-ppc.h +++ b/contrib/binutils/bfd/elf64-ppc.h @@ -1,5 +1,5 @@ /* PowerPC64-specific support for 64-bit ELF. - Copyright 2002, 2003 Free Software Foundation, Inc. + Copyright 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -15,22 +15,22 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ void ppc64_elf_init_stub_bfd (bfd *, struct bfd_link_info *); -bfd_boolean ppc64_elf_mark_entry_syms - (struct bfd_link_info *); bfd_boolean ppc64_elf_edit_opd - (bfd *, struct bfd_link_info *); + (bfd *, struct bfd_link_info *, bfd_boolean, bfd_boolean); asection *ppc64_elf_tls_setup (bfd *, struct bfd_link_info *); bfd_boolean ppc64_elf_tls_optimize (bfd *, struct bfd_link_info *); +bfd_boolean ppc64_elf_edit_toc + (bfd *, struct bfd_link_info *); bfd_vma ppc64_elf_toc (bfd *); int ppc64_elf_setup_section_lists - (bfd *, struct bfd_link_info *); + (bfd *, struct bfd_link_info *, int); void ppc64_elf_next_toc_section (struct bfd_link_info *, asection *); void ppc64_elf_reinit_toc @@ -42,3 +42,5 @@ bfd_boolean ppc64_elf_size_stubs asection *(*) (const char *, asection *), void (*) (void)); bfd_boolean ppc64_elf_build_stubs (bfd_boolean, struct bfd_link_info *, char **); +void ppc64_elf_restore_symbols + (struct bfd_link_info *info); diff --git a/contrib/binutils/bfd/elf64-s390.c b/contrib/binutils/bfd/elf64-s390.c index 63a261a8e88..1fe0c6ca915 100644 --- a/contrib/binutils/bfd/elf64-s390.c +++ b/contrib/binutils/bfd/elf64-s390.c @@ -1,5 +1,6 @@ /* IBM S/390-specific support for 64-bit ELF - Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. Contributed Martin Schwidefsky (schwidefsky@de.ibm.com). This file is part of BFD, the Binary File Descriptor library. @@ -16,8 +17,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" @@ -40,7 +41,7 @@ static bfd_boolean create_got_section static bfd_boolean elf_s390_create_dynamic_sections PARAMS((bfd *, struct bfd_link_info *)); static void elf_s390_copy_indirect_symbol - PARAMS ((const struct elf_backend_data *, struct elf_link_hash_entry *, + PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, struct elf_link_hash_entry *)); static bfd_boolean elf_s390_check_relocs PARAMS ((bfd *, struct bfd_link_info *, asection *, @@ -372,7 +373,8 @@ elf_s390_info_to_howto (abfd, cache_ptr, dst) arelent *cache_ptr; Elf_Internal_Rela *dst; { - switch (ELF64_R_TYPE(dst->r_info)) + unsigned int r_type = ELF64_R_TYPE(dst->r_info); + switch (r_type) { case R_390_GNU_VTINHERIT: cache_ptr->howto = &elf64_s390_vtinherit_howto; @@ -383,8 +385,13 @@ elf_s390_info_to_howto (abfd, cache_ptr, dst) break; default: - BFD_ASSERT (ELF64_R_TYPE(dst->r_info) < (unsigned int) R_390_max); - cache_ptr->howto = &elf_howto_table[ELF64_R_TYPE(dst->r_info)]; + if (r_type >= sizeof (elf_howto_table) / sizeof (elf_howto_table[0])) + { + (*_bfd_error_handler) (_("%B: invalid relocation type %d"), + abfd, (int) r_type); + r_type = R_390_NONE; + } + cache_ptr->howto = &elf_howto_table[r_type]; } } @@ -432,7 +439,7 @@ s390_elf_ldisp_reloc (abfd, reloc_entry, symbol, data, input_section, if (output_bfd != NULL) return bfd_reloc_continue; - if (reloc_entry->address > input_section->_cooked_size) + if (reloc_entry->address > bfd_get_section_limit (abfd, input_section)) return bfd_reloc_outofrange; relocation = (symbol->value @@ -717,7 +724,8 @@ elf_s390_link_hash_table_create (abfd) if (ret == NULL) return NULL; - if (! _bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc)) + if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc, + sizeof (struct elf_s390_link_hash_entry))) { free (ret); return NULL; @@ -755,12 +763,13 @@ create_got_section (dynobj, info) if (!htab->sgot || !htab->sgotplt) abort (); - htab->srelgot = bfd_make_section (dynobj, ".rela.got"); + htab->srelgot = bfd_make_section_with_flags (dynobj, ".rela.got", + (SEC_ALLOC | SEC_LOAD + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_LINKER_CREATED + | SEC_READONLY)); if (htab->srelgot == NULL - || ! bfd_set_section_flags (dynobj, htab->srelgot, - (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS - | SEC_IN_MEMORY | SEC_LINKER_CREATED - | SEC_READONLY)) || ! bfd_set_section_alignment (dynobj, htab->srelgot, 3)) return FALSE; return TRUE; @@ -800,8 +809,8 @@ elf_s390_create_dynamic_sections (dynobj, info) /* Copy the extra info we tack onto an elf_link_hash_entry. */ static void -elf_s390_copy_indirect_symbol (bed, dir, ind) - const struct elf_backend_data *bed; +elf_s390_copy_indirect_symbol (info, dir, ind) + struct bfd_link_info *info; struct elf_link_hash_entry *dir, *ind; { struct elf_s390_link_hash_entry *edir, *eind; @@ -816,10 +825,7 @@ elf_s390_copy_indirect_symbol (bed, dir, ind) struct elf_s390_dyn_relocs **pp; struct elf_s390_dyn_relocs *p; - if (ind->root.type == bfd_link_hash_indirect) - abort (); - - /* Add reloc counts against the weak sym to the strong sym + /* Add reloc counts against the indirect sym to the direct sym list. Merge any entries against the same section. */ for (pp = &eind->dyn_relocs; (p = *pp) != NULL; ) { @@ -852,17 +858,18 @@ elf_s390_copy_indirect_symbol (bed, dir, ind) if (ELIMINATE_COPY_RELOCS && ind->root.type != bfd_link_hash_indirect - && (dir->elf_link_hash_flags & ELF_LINK_HASH_DYNAMIC_ADJUSTED) != 0) - /* If called to transfer flags for a weakdef during processing - of elf_adjust_dynamic_symbol, don't copy ELF_LINK_NON_GOT_REF. - We clear it ourselves for ELIMINATE_COPY_RELOCS. */ - dir->elf_link_hash_flags |= - (ind->elf_link_hash_flags & (ELF_LINK_HASH_REF_DYNAMIC - | ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_REF_REGULAR_NONWEAK - | ELF_LINK_HASH_NEEDS_PLT)); + && dir->dynamic_adjusted) + { + /* If called to transfer flags for a weakdef during processing + of elf_adjust_dynamic_symbol, don't copy non_got_ref. + We clear it ourselves for ELIMINATE_COPY_RELOCS. */ + dir->ref_dynamic |= ind->ref_dynamic; + dir->ref_regular |= ind->ref_regular; + dir->ref_regular_nonweak |= ind->ref_regular_nonweak; + dir->needs_plt |= ind->needs_plt; + } else - _bfd_elf_link_hash_copy_indirect (bed, dir, ind); + _bfd_elf_link_hash_copy_indirect (info, dir, ind); } static int @@ -933,8 +940,8 @@ elf_s390_check_relocs (abfd, info, sec, relocs) if (r_symndx >= NUM_SHDR_ENTRIES (symtab_hdr)) { - (*_bfd_error_handler) (_("%s: bad symbol index: %d"), - bfd_archive_filename (abfd), + (*_bfd_error_handler) (_("%B: bad symbol index: %d"), + abfd, r_symndx); return FALSE; } @@ -942,7 +949,12 @@ elf_s390_check_relocs (abfd, info, sec, relocs) if (r_symndx < symtab_hdr->sh_info) h = NULL; else - h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + { + 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; + } /* Create got section and local_got_refcounts array if they are needed. */ @@ -1028,7 +1040,7 @@ elf_s390_check_relocs (abfd, info, sec, relocs) creating a procedure linkage table entry. */ if (h != NULL) { - h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; + h->needs_plt = 1; h->plt.refcount += 1; } break; @@ -1050,7 +1062,7 @@ elf_s390_check_relocs (abfd, info, sec, relocs) if (h != NULL) { ((struct elf_s390_link_hash_entry *) h)->gotplt_refcount++; - h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; + h->needs_plt = 1; h->plt.refcount += 1; } else @@ -1119,8 +1131,8 @@ elf_s390_check_relocs (abfd, info, sec, relocs) if (old_tls_type == GOT_NORMAL || tls_type == GOT_NORMAL) { (*_bfd_error_handler) - (_("%s: `%s' accessed both as normal and thread local symbol"), - bfd_archive_filename (abfd), h->root.root.string); + (_("%B: `%s' accessed both as normal and thread local symbol"), + abfd, h->root.root.string); return FALSE; } if (old_tls_type > tls_type) @@ -1162,7 +1174,7 @@ elf_s390_check_relocs (abfd, info, sec, relocs) sections have not yet been mapped to output sections. Tentatively set the flag for now, and correct in adjust_dynamic_symbol. */ - h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF; + h->non_got_ref = 1; /* We may need a .plt entry if the function this reloc refers to is in a shared lib. */ @@ -1200,15 +1212,13 @@ elf_s390_check_relocs (abfd, info, sec, relocs) || (h != NULL && (! info->symbolic || h->root.type == bfd_link_hash_defweak - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0)))) + || !h->def_regular)))) || (ELIMINATE_COPY_RELOCS && !info->shared && (sec->flags & SEC_ALLOC) != 0 && h != NULL && (h->root.type == bfd_link_hash_defweak - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0))) + || !h->def_regular))) { struct elf_s390_dyn_relocs *p; struct elf_s390_dyn_relocs **head; @@ -1233,8 +1243,8 @@ elf_s390_check_relocs (abfd, info, sec, relocs) name + 5) != 0) { (*_bfd_error_handler) - (_("%s: bad relocation section name `%s\'"), - bfd_archive_filename (abfd), name); + (_("%B: bad relocation section name `%s\'"), + abfd, name); } if (htab->elf.dynobj == NULL) @@ -1246,13 +1256,14 @@ elf_s390_check_relocs (abfd, info, sec, relocs) { flagword flags; - sreloc = bfd_make_section (dynobj, name); flags = (SEC_HAS_CONTENTS | SEC_READONLY | SEC_IN_MEMORY | SEC_LINKER_CREATED); if ((sec->flags & SEC_ALLOC) != 0) flags |= SEC_ALLOC | SEC_LOAD; + sreloc = bfd_make_section_with_flags (dynobj, + name, + flags); if (sreloc == NULL - || ! bfd_set_section_flags (dynobj, sreloc, flags) || ! bfd_set_section_alignment (dynobj, sreloc, 3)) return FALSE; } @@ -1272,13 +1283,15 @@ elf_s390_check_relocs (abfd, info, sec, relocs) easily. Oh well. */ asection *s; + void *vpp; + s = bfd_section_from_r_symndx (abfd, &htab->sym_sec, sec, r_symndx); if (s == NULL) return FALSE; - head = ((struct elf_s390_dyn_relocs **) - &elf_section_data (s)->local_dynrel); + vpp = &elf_section_data (s)->local_dynrel; + head = (struct elf_s390_dyn_relocs **) vpp; } p = *head; @@ -1403,6 +1416,9 @@ elf_s390_gc_sweep_hook (abfd, info, sec, relocs) struct elf_s390_dyn_relocs *p; 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; eh = (struct elf_s390_link_hash_entry *) h; for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next) @@ -1552,12 +1568,12 @@ elf_s390_adjust_dynamic_symbol (info, h) will fill in the contents of the procedure linkage table later (although we could actually do it here). */ if (h->type == STT_FUNC - || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0) + || h->needs_plt) { if (h->plt.refcount <= 0 || (! info->shared - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0 + && !h->def_dynamic + && !h->ref_dynamic && h->root.type != bfd_link_hash_undefweak && h->root.type != bfd_link_hash_undefined)) { @@ -1567,7 +1583,7 @@ elf_s390_adjust_dynamic_symbol (info, h) such a case, we don't actually need to build a procedure linkage table, and we can just do a PC32 reloc instead. */ h->plt.offset = (bfd_vma) -1; - h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; + h->needs_plt = 0; elf_s390_adjust_gotplt((struct elf_s390_link_hash_entry *) h); } @@ -1584,16 +1600,14 @@ elf_s390_adjust_dynamic_symbol (info, h) /* 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) + if (h->u.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; + BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined + || h->u.weakdef->root.type == bfd_link_hash_defweak); + h->root.u.def.section = h->u.weakdef->root.u.def.section; + h->root.u.def.value = h->u.weakdef->root.u.def.value; if (ELIMINATE_COPY_RELOCS || info->nocopyreloc) - h->elf_link_hash_flags - = ((h->elf_link_hash_flags & ~ELF_LINK_NON_GOT_REF) - | (h->weakdef->elf_link_hash_flags & ELF_LINK_NON_GOT_REF)); + h->non_got_ref = h->u.weakdef->non_got_ref; return TRUE; } @@ -1609,13 +1623,13 @@ elf_s390_adjust_dynamic_symbol (info, h) /* If there are no references to this symbol that do not use the GOT, we don't need to generate a copy reloc. */ - if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0) + if (!h->non_got_ref) return TRUE; /* If -z nocopyreloc was given, we won't generate them either. */ if (info->nocopyreloc) { - h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF; + h->non_got_ref = 0; return TRUE; } @@ -1636,11 +1650,18 @@ elf_s390_adjust_dynamic_symbol (info, h) we'll be keeping the dynamic relocs and avoiding the copy reloc. */ if (p == NULL) { - h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF; + h->non_got_ref = 0; return TRUE; } } + if (h->size == 0) + { + (*_bfd_error_handler) (_("dynamic variable `%s' is zero size"), + h->root.root.string); + return TRUE; + } + /* We must allocate the symbol in our .dynbss section, which will become part of the .bss section of the executable. There will be an entry for this symbol in the .dynsym section. The dynamic @@ -1658,8 +1679,8 @@ elf_s390_adjust_dynamic_symbol (info, h) runtime process image. */ if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) { - htab->srelbss->_raw_size += sizeof (Elf64_External_Rela); - h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY; + htab->srelbss->size += sizeof (Elf64_External_Rela); + h->needs_copy = 1; } /* We need to figure out the alignment required for this symbol. I @@ -1670,7 +1691,7 @@ elf_s390_adjust_dynamic_symbol (info, h) /* Apply the required alignment. */ s = htab->sdynbss; - s->_raw_size = BFD_ALIGN (s->_raw_size, (bfd_size_type) (1 << power_of_two)); + s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two)); if (power_of_two > bfd_get_section_alignment (htab->elf.dynobj, s)) { if (! bfd_set_section_alignment (htab->elf.dynobj, s, power_of_two)) @@ -1679,10 +1700,10 @@ elf_s390_adjust_dynamic_symbol (info, h) /* Define the symbol as being at this point in the section. */ h->root.u.def.section = s; - h->root.u.def.value = s->_raw_size; + h->root.u.def.value = s->size; /* Increment the section size to make room for the symbol. */ - s->_raw_size += h->size; + s->size += h->size; return TRUE; } @@ -1720,7 +1741,7 @@ allocate_dynrelocs (h, inf) /* Make sure this symbol is output as a dynamic symbol. Undefined weak syms won't yet be marked as dynamic. */ if (h->dynindx == -1 - && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) + && !h->forced_local) { if (! bfd_elf_link_record_dynamic_symbol (info, h)) return FALSE; @@ -1733,10 +1754,10 @@ allocate_dynrelocs (h, inf) /* If this is the first .plt entry, make room for the special first entry. */ - if (s->_raw_size == 0) - s->_raw_size += PLT_FIRST_ENTRY_SIZE; + if (s->size == 0) + s->size += PLT_FIRST_ENTRY_SIZE; - h->plt.offset = s->_raw_size; + h->plt.offset = s->size; /* If this symbol is not defined in a regular file, and we are not generating a shared library, then set the symbol to this @@ -1744,33 +1765,33 @@ allocate_dynrelocs (h, inf) pointers compare as equal between the normal executable and the shared library. */ if (! info->shared - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + && !h->def_regular) { h->root.u.def.section = s; h->root.u.def.value = h->plt.offset; } /* Make room for this entry. */ - s->_raw_size += PLT_ENTRY_SIZE; + s->size += PLT_ENTRY_SIZE; /* We also need to make an entry in the .got.plt section, which will be placed in the .got section by the linker script. */ - htab->sgotplt->_raw_size += GOT_ENTRY_SIZE; + htab->sgotplt->size += GOT_ENTRY_SIZE; /* We also need to make an entry in the .rela.plt section. */ - htab->srelplt->_raw_size += sizeof (Elf64_External_Rela); + htab->srelplt->size += sizeof (Elf64_External_Rela); } else { h->plt.offset = (bfd_vma) -1; - h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; + h->needs_plt = 0; elf_s390_adjust_gotplt((struct elf_s390_link_hash_entry *) h); } } else { h->plt.offset = (bfd_vma) -1; - h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; + h->needs_plt = 0; elf_s390_adjust_gotplt((struct elf_s390_link_hash_entry *) h); } @@ -1788,8 +1809,8 @@ allocate_dynrelocs (h, inf) to be stored somewhere. The immediate value in the instruction is not bit enough so the value is stored in the got. */ { - h->got.offset = htab->sgot->_raw_size; - htab->sgot->_raw_size += GOT_ENTRY_SIZE; + h->got.offset = htab->sgot->size; + htab->sgot->size += GOT_ENTRY_SIZE; } else h->got.offset = (bfd_vma) -1; @@ -1803,31 +1824,31 @@ allocate_dynrelocs (h, inf) /* Make sure this symbol is output as a dynamic symbol. Undefined weak syms won't yet be marked as dynamic. */ if (h->dynindx == -1 - && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) + && !h->forced_local) { if (! bfd_elf_link_record_dynamic_symbol (info, h)) return FALSE; } s = htab->sgot; - h->got.offset = s->_raw_size; - s->_raw_size += GOT_ENTRY_SIZE; + h->got.offset = s->size; + s->size += GOT_ENTRY_SIZE; /* R_390_TLS_GD64 needs 2 consecutive GOT slots. */ if (tls_type == GOT_TLS_GD) - s->_raw_size += GOT_ENTRY_SIZE; + s->size += GOT_ENTRY_SIZE; dyn = htab->elf.dynamic_sections_created; /* R_390_TLS_IE64 needs one dynamic relocation, R_390_TLS_GD64 needs one if local symbol and two if global. */ if ((tls_type == GOT_TLS_GD && h->dynindx == -1) || tls_type >= GOT_TLS_IE) - htab->srelgot->_raw_size += sizeof (Elf64_External_Rela); + htab->srelgot->size += sizeof (Elf64_External_Rela); else if (tls_type == GOT_TLS_GD) - htab->srelgot->_raw_size += 2 * sizeof (Elf64_External_Rela); + htab->srelgot->size += 2 * sizeof (Elf64_External_Rela); else if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT || h->root.type != bfd_link_hash_undefweak) && (info->shared || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h))) - htab->srelgot->_raw_size += sizeof (Elf64_External_Rela); + htab->srelgot->size += sizeof (Elf64_External_Rela); } else h->got.offset = (bfd_vma) -1; @@ -1861,9 +1882,21 @@ allocate_dynrelocs (h, inf) /* Also discard relocs on undefined weak syms with non-default visibility. */ - if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT + if (eh->dyn_relocs != NULL && h->root.type == bfd_link_hash_undefweak) - eh->dyn_relocs = NULL; + { + if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT) + eh->dyn_relocs = NULL; + + /* Make sure undefined weak symbols are output as a dynamic + symbol in PIEs. */ + else if (h->dynindx == -1 + && !h->forced_local) + { + if (! bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } + } } else if (ELIMINATE_COPY_RELOCS) { @@ -1871,9 +1904,9 @@ allocate_dynrelocs (h, inf) symbols which turn out to need copy relocs or are not dynamic. */ - if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0 - && (((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + if (!h->non_got_ref + && ((h->def_dynamic + && !h->def_regular) || (htab->elf.dynamic_sections_created && (h->root.type == bfd_link_hash_undefweak || h->root.type == bfd_link_hash_undefined)))) @@ -1881,7 +1914,7 @@ allocate_dynrelocs (h, inf) /* Make sure this symbol is output as a dynamic symbol. Undefined weak syms won't yet be marked as dynamic. */ if (h->dynindx == -1 - && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) + && !h->forced_local) { if (! bfd_elf_link_record_dynamic_symbol (info, h)) return FALSE; @@ -1902,7 +1935,7 @@ allocate_dynrelocs (h, inf) for (p = eh->dyn_relocs; p != NULL; p = p->next) { asection *sreloc = elf_section_data (p->sec)->sreloc; - sreloc->_raw_size += p->count * sizeof (Elf64_External_Rela); + sreloc->size += p->count * sizeof (Elf64_External_Rela); } return TRUE; @@ -1965,7 +1998,7 @@ elf_s390_size_dynamic_sections (output_bfd, info) s = bfd_get_section_by_name (dynobj, ".interp"); if (s == NULL) abort (); - s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER; + s->size = sizeof ELF_DYNAMIC_INTERPRETER; s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER; } } @@ -1988,10 +2021,7 @@ elf_s390_size_dynamic_sections (output_bfd, info) { struct elf_s390_dyn_relocs *p; - for (p = *((struct elf_s390_dyn_relocs **) - &elf_section_data (s)->local_dynrel); - p != NULL; - p = p->next) + for (p = elf_section_data (s)->local_dynrel; p != NULL; p = p->next) { if (!bfd_is_abs_section (p->sec) && bfd_is_abs_section (p->sec->output_section)) @@ -2004,7 +2034,7 @@ elf_s390_size_dynamic_sections (output_bfd, info) else if (p->count != 0) { srela = elf_section_data (p->sec)->sreloc; - srela->_raw_size += p->count * sizeof (Elf64_External_Rela); + srela->size += p->count * sizeof (Elf64_External_Rela); if ((p->sec->output_section->flags & SEC_READONLY) != 0) info->flags |= DF_TEXTREL; } @@ -2025,12 +2055,12 @@ elf_s390_size_dynamic_sections (output_bfd, info) { if (*local_got > 0) { - *local_got = s->_raw_size; - s->_raw_size += GOT_ENTRY_SIZE; + *local_got = s->size; + s->size += GOT_ENTRY_SIZE; if (*local_tls_type == GOT_TLS_GD) - s->_raw_size += GOT_ENTRY_SIZE; + s->size += GOT_ENTRY_SIZE; if (info->shared) - srela->_raw_size += sizeof (Elf64_External_Rela); + srela->size += sizeof (Elf64_External_Rela); } else *local_got = (bfd_vma) -1; @@ -2041,9 +2071,9 @@ elf_s390_size_dynamic_sections (output_bfd, info) { /* Allocate 2 got entries and 1 dynamic reloc for R_390_TLS_LDM64 relocs. */ - htab->tls_ldm_got.offset = htab->sgot->_raw_size; - htab->sgot->_raw_size += 2 * GOT_ENTRY_SIZE; - htab->srelgot->_raw_size += sizeof (Elf64_External_Rela); + htab->tls_ldm_got.offset = htab->sgot->size; + htab->sgot->size += 2 * GOT_ENTRY_SIZE; + htab->srelgot->size += sizeof (Elf64_External_Rela); } else htab->tls_ldm_got.offset = -1; @@ -2062,14 +2092,15 @@ elf_s390_size_dynamic_sections (output_bfd, info) if (s == htab->splt || s == htab->sgot - || s == htab->sgotplt) + || s == htab->sgotplt + || s == htab->sdynbss) { /* Strip this section if we don't need it; see the comment below. */ } else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0) { - if (s->_raw_size != 0 && s != htab->srelplt) + if (s->size != 0 && s != htab->srelplt) relocs = TRUE; /* We use the reloc_count field as a counter if we need @@ -2082,7 +2113,7 @@ elf_s390_size_dynamic_sections (output_bfd, info) continue; } - if (s->_raw_size == 0) + if (s->size == 0) { /* If we don't need this section, strip it from the output file. This is to handle .rela.bss and @@ -2094,16 +2125,19 @@ elf_s390_size_dynamic_sections (output_bfd, info) function which decides whether anything needs to go into these sections. */ - _bfd_strip_section_from_output (info, s); + s->flags |= SEC_EXCLUDE; continue; } + if ((s->flags & SEC_HAS_CONTENTS) == 0) + continue; + /* Allocate memory for the section contents. We use bfd_zalloc here in case unused entries are not reclaimed before the section's contents are written out. This should not happen, but this way if it does, we get a R_390_NONE reloc instead of garbage. */ - s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size); + s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->size); if (s->contents == NULL) return FALSE; } @@ -2124,7 +2158,7 @@ elf_s390_size_dynamic_sections (output_bfd, info) return FALSE; } - if (htab->splt->_raw_size != 0) + if (htab->splt->size != 0) { if (!add_dynamic_entry (DT_PLTGOT, 0) || !add_dynamic_entry (DT_PLTRELSZ, 0) @@ -2201,9 +2235,9 @@ invalid_tls_insn (input_bfd, input_section, rel) howto = elf_howto_table + ELF64_R_TYPE (rel->r_info); (*_bfd_error_handler) - (_("%s(%s+0x%lx): invalid instruction for TLS relocation %s"), - bfd_archive_filename (input_bfd), - bfd_get_section_name (input_bfd, input_section), + (_("%B(%A+0x%lx): invalid instruction for TLS relocation %s"), + input_bfd, + input_section, (long) rel->r_offset, howto->name); } @@ -2345,8 +2379,8 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, || (info->shared && (info->symbolic || h->dynindx == -1 - || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL)) - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)) + || h->forced_local) + && h->def_regular) || (ELF_ST_VISIBILITY (h->other) && h->root.type == bfd_link_hash_undefweak)) { @@ -2532,11 +2566,9 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, && !info->shared && h != NULL && h->dynindx != -1 - && (h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0 - && (((h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - && (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0) + && !h->non_got_ref + && ((h->def_dynamic + && !h->def_regular) || h->root.type == bfd_link_hash_undefweak || h->root.type == bfd_link_hash_undefined))) { @@ -2573,8 +2605,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, || r_type == R_390_PC64 || !info->shared || !info->symbolic - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0)) + || !h->def_regular)) { outrel.r_info = ELF64_R_INFO (h->dynindx, r_type); outrel.r_addend = rel->r_addend; @@ -2987,12 +3018,13 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, not process them. */ if (unresolved_reloc && !((input_section->flags & SEC_DEBUGGING) != 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0)) + && h->def_dynamic)) (*_bfd_error_handler) - (_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"), - bfd_archive_filename (input_bfd), - bfd_get_section_name (input_bfd, input_section), + (_("%B(%A+0x%lx): unresolvable %s relocation against symbol `%s'"), + input_bfd, + input_section, (long) rel->r_offset, + howto->name, h->root.root.string); if (r_type == R_390_20 @@ -3032,16 +3064,16 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, { if (! ((*info->callbacks->reloc_overflow) - (info, name, howto->name, (bfd_vma) 0, - input_bfd, input_section, rel->r_offset))) + (info, (h ? &h->root : NULL), name, howto->name, + (bfd_vma) 0, input_bfd, input_section, + rel->r_offset))) return FALSE; } else { (*_bfd_error_handler) - (_("%s(%s+0x%lx): reloc against `%s': error %d"), - bfd_archive_filename (input_bfd), - bfd_get_section_name (input_bfd, input_section), + (_("%B(%A+0x%lx): reloc against `%s': error %d"), + input_bfd, input_section, (long) rel->r_offset, name, (int) r); return FALSE; } @@ -3138,7 +3170,7 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym) loc = htab->srelplt->contents + plt_index * sizeof (Elf64_External_Rela); bfd_elf64_swap_reloca_out (output_bfd, &rela, loc); - if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + if (!h->def_regular) { /* Mark the symbol as undefined, rather than as defined in the .plt section. Leave the value alone. This is a clue @@ -3174,8 +3206,8 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym) if (info->shared && (info->symbolic || h->dynindx == -1 - || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL)) - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)) + || h->forced_local) + && h->def_regular) { BFD_ASSERT((h->got.offset & 1) != 0); rela.r_info = ELF64_R_INFO (0, R_390_RELATIVE); @@ -3196,7 +3228,7 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym) bfd_elf64_swap_reloca_out (output_bfd, &rela, loc); } - if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0) + if (h->needs_copy) { Elf_Internal_Rela rela; bfd_byte *loc; @@ -3221,8 +3253,8 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym) /* Mark some specially defined symbols as absolute. */ if (strcmp (h->root.root.string, "_DYNAMIC") == 0 - || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0 - || strcmp (h->root.root.string, "_PROCEDURE_LINKAGE_TABLE_") == 0) + || h == htab->elf.hgot + || h == htab->elf.hplt) sym->st_shndx = SHN_ABS; return TRUE; @@ -3271,7 +3303,7 @@ elf_s390_finish_dynamic_sections (output_bfd, info) abort (); dyncon = (Elf64_External_Dyn *) sdyn->contents; - dynconend = (Elf64_External_Dyn *) (sdyn->contents + sdyn->_raw_size); + dynconend = (Elf64_External_Dyn *) (sdyn->contents + sdyn->size); for (; dyncon < dynconend; dyncon++) { Elf_Internal_Dyn dyn; @@ -3294,10 +3326,7 @@ elf_s390_finish_dynamic_sections (output_bfd, info) case DT_PLTRELSZ: s = htab->srelplt->output_section; - if (s->_cooked_size != 0) - dyn.d_un.d_val = s->_cooked_size; - else - dyn.d_un.d_val = s->_raw_size; + dyn.d_un.d_val = s->size; break; case DT_RELASZ: @@ -3309,10 +3338,7 @@ elf_s390_finish_dynamic_sections (output_bfd, info) other relocation sections, we don't have to worry about changing the DT_RELA entry. */ s = htab->srelplt->output_section; - if (s->_cooked_size != 0) - dyn.d_un.d_val -= s->_cooked_size; - else - dyn.d_un.d_val -= s->_raw_size; + dyn.d_un.d_val -= s->size; break; } @@ -3320,7 +3346,7 @@ elf_s390_finish_dynamic_sections (output_bfd, info) } /* Fill in the special first entry in the procedure linkage table. */ - if (htab->splt && htab->splt->_raw_size > 0) + if (htab->splt && htab->splt->size > 0) { /* fill in blueprint for plt 0 entry */ bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD0, @@ -3351,7 +3377,7 @@ elf_s390_finish_dynamic_sections (output_bfd, info) if (htab->sgotplt) { /* Fill in the first three entries in the global offset table. */ - if (htab->sgotplt->_raw_size > 0) + if (htab->sgotplt->size > 0) { bfd_put_64 (output_bfd, (sdyn == NULL ? (bfd_vma) 0 @@ -3369,6 +3395,17 @@ elf_s390_finish_dynamic_sections (output_bfd, info) return TRUE; } +/* Return address for Ith PLT stub in section PLT, for relocation REL + or (bfd_vma) -1 if it should not be included. */ + +static bfd_vma +elf_s390_plt_sym_val (bfd_vma i, const asection *plt, + const arelent *rel ATTRIBUTE_UNUSED) +{ + return plt->vma + PLT_FIRST_ENTRY_SIZE + i * PLT_ENTRY_SIZE; +} + + /* Why was the hash table entry size definition changed from ARCH_SIZE/8 to 4? This breaks the 64 bit dynamic linker and this is the only reason for the s390_elf64_size_info structure. */ @@ -3438,6 +3475,7 @@ const struct elf_size_info s390_elf64_size_info = #define elf_backend_relocate_section elf_s390_relocate_section #define elf_backend_size_dynamic_sections elf_s390_size_dynamic_sections #define elf_backend_reloc_type_class elf_s390_reloc_type_class +#define elf_backend_plt_sym_val elf_s390_plt_sym_val #define bfd_elf64_mkobject elf_s390_mkobject #define elf_backend_object_p elf_s390_object_p diff --git a/contrib/binutils/bfd/elf64-sparc.c b/contrib/binutils/bfd/elf64-sparc.c index 464c4979a9d..dd1c302174a 100644 --- a/contrib/binutils/bfd/elf64-sparc.c +++ b/contrib/binutils/bfd/elf64-sparc.c @@ -1,6 +1,6 @@ /* SPARC-specific support for 64-bit ELF Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003, 2004 Free Software Foundation, Inc. + 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -16,330 +16,31 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" #include "libbfd.h" #include "elf-bfd.h" -#include "opcode/sparc.h" - -/* This is defined if one wants to build upward compatible binaries - with the original sparc64-elf toolchain. The support is kept in for - now but is turned off by default. dje 970930 */ -/*#define SPARC64_OLD_RELOCS*/ - #include "elf/sparc.h" +#include "opcode/sparc.h" +#include "elfxx-sparc.h" /* In case we're on a 32-bit machine, construct a 64-bit "-1" value. */ #define MINUS_ONE (~ (bfd_vma) 0) -static struct bfd_link_hash_table * sparc64_elf_bfd_link_hash_table_create - PARAMS ((bfd *)); -static bfd_reloc_status_type init_insn_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, - bfd *, bfd_vma *, bfd_vma *)); -static reloc_howto_type *sparc64_elf_reloc_type_lookup - PARAMS ((bfd *, bfd_reloc_code_real_type)); -static void sparc64_elf_info_to_howto - PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); - -static void sparc64_elf_build_plt - PARAMS ((bfd *, unsigned char *, int)); -static bfd_vma sparc64_elf_plt_entry_offset - PARAMS ((bfd_vma)); -static bfd_vma sparc64_elf_plt_ptr_offset - PARAMS ((bfd_vma, bfd_vma)); - -static bfd_boolean sparc64_elf_check_relocs - PARAMS ((bfd *, struct bfd_link_info *, asection *sec, - const Elf_Internal_Rela *)); -static bfd_boolean sparc64_elf_adjust_dynamic_symbol - PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *)); -static bfd_boolean sparc64_elf_size_dynamic_sections - PARAMS ((bfd *, struct bfd_link_info *)); -static int sparc64_elf_get_symbol_type - PARAMS (( Elf_Internal_Sym *, int)); -static bfd_boolean sparc64_elf_add_symbol_hook - PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Sym *, - const char **, flagword *, asection **, bfd_vma *)); -static bfd_boolean sparc64_elf_output_arch_syms - PARAMS ((bfd *, struct bfd_link_info *, PTR, - bfd_boolean (*) (PTR, const char *, Elf_Internal_Sym *, - asection *, struct elf_link_hash_entry *))); -static void sparc64_elf_symbol_processing - PARAMS ((bfd *, asymbol *)); - -static bfd_boolean sparc64_elf_merge_private_bfd_data - PARAMS ((bfd *, bfd *)); - -static bfd_boolean sparc64_elf_fake_sections - PARAMS ((bfd *, Elf_Internal_Shdr *, asection *)); - -static const char *sparc64_elf_print_symbol_all - PARAMS ((bfd *, PTR, asymbol *)); -static bfd_boolean sparc64_elf_new_section_hook - PARAMS ((bfd *, asection *)); -static bfd_boolean sparc64_elf_relax_section - PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *)); -static bfd_boolean sparc64_elf_relocate_section - PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, - Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); -static bfd_boolean sparc64_elf_finish_dynamic_symbol - PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, - Elf_Internal_Sym *)); -static bfd_boolean sparc64_elf_finish_dynamic_sections - PARAMS ((bfd *, struct bfd_link_info *)); -static bfd_boolean sparc64_elf_object_p PARAMS ((bfd *)); -static long sparc64_elf_get_reloc_upper_bound PARAMS ((bfd *, asection *)); -static long sparc64_elf_get_dynamic_reloc_upper_bound PARAMS ((bfd *)); -static bfd_boolean sparc64_elf_slurp_one_reloc_table - PARAMS ((bfd *, asection *, Elf_Internal_Shdr *, asymbol **, bfd_boolean)); -static bfd_boolean sparc64_elf_slurp_reloc_table - PARAMS ((bfd *, asection *, asymbol **, bfd_boolean)); -static long sparc64_elf_canonicalize_reloc - PARAMS ((bfd *, asection *, arelent **, asymbol **)); -static long sparc64_elf_canonicalize_dynamic_reloc - PARAMS ((bfd *, arelent **, asymbol **)); -static void sparc64_elf_write_relocs PARAMS ((bfd *, asection *, PTR)); -static enum elf_reloc_type_class sparc64_elf_reloc_type_class - PARAMS ((const Elf_Internal_Rela *)); - -/* The relocation "howto" table. */ - -static bfd_reloc_status_type sparc_elf_notsup_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static bfd_reloc_status_type sparc_elf_wdisp16_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static bfd_reloc_status_type sparc_elf_hix22_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static bfd_reloc_status_type sparc_elf_lox10_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); - -static reloc_howto_type sparc64_elf_howto_table[] = -{ - HOWTO(R_SPARC_NONE, 0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_NONE", FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_8, 0,0, 8,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_8", FALSE,0,0x000000ff,TRUE), - HOWTO(R_SPARC_16, 0,1,16,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_16", FALSE,0,0x0000ffff,TRUE), - HOWTO(R_SPARC_32, 0,2,32,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_32", FALSE,0,0xffffffff,TRUE), - HOWTO(R_SPARC_DISP8, 0,0, 8,TRUE, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_DISP8", FALSE,0,0x000000ff,TRUE), - HOWTO(R_SPARC_DISP16, 0,1,16,TRUE, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_DISP16", FALSE,0,0x0000ffff,TRUE), - HOWTO(R_SPARC_DISP32, 0,2,32,TRUE, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_DISP32", FALSE,0,0xffffffff,TRUE), - HOWTO(R_SPARC_WDISP30, 2,2,30,TRUE, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_WDISP30", FALSE,0,0x3fffffff,TRUE), - HOWTO(R_SPARC_WDISP22, 2,2,22,TRUE, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_WDISP22", FALSE,0,0x003fffff,TRUE), - HOWTO(R_SPARC_HI22, 10,2,22,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_HI22", FALSE,0,0x003fffff,TRUE), - HOWTO(R_SPARC_22, 0,2,22,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_22", FALSE,0,0x003fffff,TRUE), - HOWTO(R_SPARC_13, 0,2,13,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_13", FALSE,0,0x00001fff,TRUE), - HOWTO(R_SPARC_LO10, 0,2,10,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_LO10", FALSE,0,0x000003ff,TRUE), - HOWTO(R_SPARC_GOT10, 0,2,10,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_GOT10", FALSE,0,0x000003ff,TRUE), - HOWTO(R_SPARC_GOT13, 0,2,13,FALSE,0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_GOT13", FALSE,0,0x00001fff,TRUE), - HOWTO(R_SPARC_GOT22, 10,2,22,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_GOT22", FALSE,0,0x003fffff,TRUE), - HOWTO(R_SPARC_PC10, 0,2,10,TRUE, 0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_PC10", FALSE,0,0x000003ff,TRUE), - HOWTO(R_SPARC_PC22, 10,2,22,TRUE, 0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_PC22", FALSE,0,0x003fffff,TRUE), - HOWTO(R_SPARC_WPLT30, 2,2,30,TRUE, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_WPLT30", FALSE,0,0x3fffffff,TRUE), - HOWTO(R_SPARC_COPY, 0,0,00,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_COPY", FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_GLOB_DAT, 0,0,00,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_GLOB_DAT",FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_JMP_SLOT, 0,0,00,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_JMP_SLOT",FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_RELATIVE, 0,0,00,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_RELATIVE",FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_UA32, 0,2,32,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_UA32", FALSE,0,0xffffffff,TRUE), -#ifndef SPARC64_OLD_RELOCS - HOWTO(R_SPARC_PLT32, 0,2,32,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_PLT32", FALSE,0,0xffffffff,TRUE), - /* These aren't implemented yet. */ - HOWTO(R_SPARC_HIPLT22, 0,0,00,FALSE,0,complain_overflow_dont, sparc_elf_notsup_reloc, "R_SPARC_HIPLT22", FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_LOPLT10, 0,0,00,FALSE,0,complain_overflow_dont, sparc_elf_notsup_reloc, "R_SPARC_LOPLT10", FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_PCPLT32, 0,0,00,FALSE,0,complain_overflow_dont, sparc_elf_notsup_reloc, "R_SPARC_PCPLT32", FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_PCPLT22, 0,0,00,FALSE,0,complain_overflow_dont, sparc_elf_notsup_reloc, "R_SPARC_PCPLT22", FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_PCPLT10, 0,0,00,FALSE,0,complain_overflow_dont, sparc_elf_notsup_reloc, "R_SPARC_PCPLT10", FALSE,0,0x00000000,TRUE), -#endif - HOWTO(R_SPARC_10, 0,2,10,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_10", FALSE,0,0x000003ff,TRUE), - HOWTO(R_SPARC_11, 0,2,11,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_11", FALSE,0,0x000007ff,TRUE), - HOWTO(R_SPARC_64, 0,4,64,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_64", FALSE,0,MINUS_ONE, TRUE), - HOWTO(R_SPARC_OLO10, 0,2,13,FALSE,0,complain_overflow_signed, sparc_elf_notsup_reloc, "R_SPARC_OLO10", FALSE,0,0x00001fff,TRUE), - HOWTO(R_SPARC_HH22, 42,2,22,FALSE,0,complain_overflow_unsigned,bfd_elf_generic_reloc, "R_SPARC_HH22", FALSE,0,0x003fffff,TRUE), - HOWTO(R_SPARC_HM10, 32,2,10,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_HM10", FALSE,0,0x000003ff,TRUE), - HOWTO(R_SPARC_LM22, 10,2,22,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_LM22", FALSE,0,0x003fffff,TRUE), - HOWTO(R_SPARC_PC_HH22, 42,2,22,TRUE, 0,complain_overflow_unsigned,bfd_elf_generic_reloc, "R_SPARC_PC_HH22", FALSE,0,0x003fffff,TRUE), - HOWTO(R_SPARC_PC_HM10, 32,2,10,TRUE, 0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_PC_HM10", FALSE,0,0x000003ff,TRUE), - HOWTO(R_SPARC_PC_LM22, 10,2,22,TRUE, 0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_PC_LM22", FALSE,0,0x003fffff,TRUE), - HOWTO(R_SPARC_WDISP16, 2,2,16,TRUE, 0,complain_overflow_signed, sparc_elf_wdisp16_reloc,"R_SPARC_WDISP16", FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_WDISP19, 2,2,19,TRUE, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_WDISP19", FALSE,0,0x0007ffff,TRUE), - HOWTO(R_SPARC_UNUSED_42, 0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_UNUSED_42",FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_7, 0,2, 7,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_7", FALSE,0,0x0000007f,TRUE), - HOWTO(R_SPARC_5, 0,2, 5,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_5", FALSE,0,0x0000001f,TRUE), - HOWTO(R_SPARC_6, 0,2, 6,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_6", FALSE,0,0x0000003f,TRUE), - HOWTO(R_SPARC_DISP64, 0,4,64,TRUE, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_DISP64", FALSE,0,MINUS_ONE, TRUE), - HOWTO(R_SPARC_PLT64, 0,4,64,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_PLT64", FALSE,0,MINUS_ONE, TRUE), - HOWTO(R_SPARC_HIX22, 0,4, 0,FALSE,0,complain_overflow_bitfield,sparc_elf_hix22_reloc, "R_SPARC_HIX22", FALSE,0,MINUS_ONE, FALSE), - HOWTO(R_SPARC_LOX10, 0,4, 0,FALSE,0,complain_overflow_dont, sparc_elf_lox10_reloc, "R_SPARC_LOX10", FALSE,0,MINUS_ONE, FALSE), - HOWTO(R_SPARC_H44, 22,2,22,FALSE,0,complain_overflow_unsigned,bfd_elf_generic_reloc, "R_SPARC_H44", FALSE,0,0x003fffff,FALSE), - HOWTO(R_SPARC_M44, 12,2,10,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_M44", FALSE,0,0x000003ff,FALSE), - HOWTO(R_SPARC_L44, 0,2,13,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_L44", FALSE,0,0x00000fff,FALSE), - HOWTO(R_SPARC_REGISTER, 0,4, 0,FALSE,0,complain_overflow_bitfield,sparc_elf_notsup_reloc, "R_SPARC_REGISTER",FALSE,0,MINUS_ONE, FALSE), - HOWTO(R_SPARC_UA64, 0,4,64,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_UA64", FALSE,0,MINUS_ONE, TRUE), - HOWTO(R_SPARC_UA16, 0,1,16,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_UA16", FALSE,0,0x0000ffff,TRUE), - HOWTO(R_SPARC_TLS_GD_HI22,10,2,22,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_GD_HI22",FALSE,0,0x003fffff,TRUE), - HOWTO(R_SPARC_TLS_GD_LO10,0,2,10,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_GD_LO10",FALSE,0,0x000003ff,TRUE), - HOWTO(R_SPARC_TLS_GD_ADD,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_GD_ADD",FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_TLS_GD_CALL,2,2,30,TRUE,0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_TLS_GD_CALL",FALSE,0,0x3fffffff,TRUE), - HOWTO(R_SPARC_TLS_LDM_HI22,10,2,22,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_LDM_HI22",FALSE,0,0x003fffff,TRUE), - HOWTO(R_SPARC_TLS_LDM_LO10,0,2,10,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_LDM_LO10",FALSE,0,0x000003ff,TRUE), - HOWTO(R_SPARC_TLS_LDM_ADD,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_LDM_ADD",FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_TLS_LDM_CALL,2,2,30,TRUE,0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_TLS_LDM_CALL",FALSE,0,0x3fffffff,TRUE), - HOWTO(R_SPARC_TLS_LDO_HIX22,0,2,0,FALSE,0,complain_overflow_bitfield,sparc_elf_hix22_reloc,"R_SPARC_TLS_LDO_HIX22",FALSE,0,0x003fffff, FALSE), - HOWTO(R_SPARC_TLS_LDO_LOX10,0,2,0,FALSE,0,complain_overflow_dont, sparc_elf_lox10_reloc, "R_SPARC_TLS_LDO_LOX10",FALSE,0,0x000003ff, FALSE), - HOWTO(R_SPARC_TLS_LDO_ADD,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_LDO_ADD",FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_TLS_IE_HI22,10,2,22,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_IE_HI22",FALSE,0,0x003fffff,TRUE), - HOWTO(R_SPARC_TLS_IE_LO10,0,2,10,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_IE_LO10",FALSE,0,0x000003ff,TRUE), - HOWTO(R_SPARC_TLS_IE_LD,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_IE_LD",FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_TLS_IE_LDX,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_IE_LDX",FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_TLS_IE_ADD,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_IE_ADD",FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_TLS_LE_HIX22,0,2,0,FALSE,0,complain_overflow_bitfield,sparc_elf_hix22_reloc, "R_SPARC_TLS_LE_HIX22",FALSE,0,0x003fffff, FALSE), - HOWTO(R_SPARC_TLS_LE_LOX10,0,2,0,FALSE,0,complain_overflow_dont, sparc_elf_lox10_reloc, "R_SPARC_TLS_LE_LOX10",FALSE,0,0x000003ff, FALSE), - HOWTO(R_SPARC_TLS_DTPMOD32,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_DTPMOD32",FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_TLS_DTPMOD64,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_DTPMOD64",FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_TLS_DTPOFF32,0,2,32,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc,"R_SPARC_TLS_DTPOFF32",FALSE,0,0xffffffff,TRUE), - HOWTO(R_SPARC_TLS_DTPOFF64,0,4,64,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc,"R_SPARC_TLS_DTPOFF64",FALSE,0,MINUS_ONE,TRUE), - HOWTO(R_SPARC_TLS_TPOFF32,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_TPOFF32",FALSE,0,0x00000000,TRUE), - HOWTO(R_SPARC_TLS_TPOFF64,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_TPOFF64",FALSE,0,0x00000000,TRUE) -}; - -struct elf_reloc_map { - bfd_reloc_code_real_type bfd_reloc_val; - unsigned char elf_reloc_val; -}; - -static const struct elf_reloc_map sparc_reloc_map[] = -{ - { BFD_RELOC_NONE, R_SPARC_NONE, }, - { BFD_RELOC_16, R_SPARC_16, }, - { BFD_RELOC_16_PCREL, R_SPARC_DISP16 }, - { BFD_RELOC_8, R_SPARC_8 }, - { BFD_RELOC_8_PCREL, R_SPARC_DISP8 }, - { BFD_RELOC_CTOR, R_SPARC_64 }, - { BFD_RELOC_32, R_SPARC_32 }, - { BFD_RELOC_32_PCREL, R_SPARC_DISP32 }, - { BFD_RELOC_HI22, R_SPARC_HI22 }, - { BFD_RELOC_LO10, R_SPARC_LO10, }, - { BFD_RELOC_32_PCREL_S2, R_SPARC_WDISP30 }, - { BFD_RELOC_64_PCREL, R_SPARC_DISP64 }, - { BFD_RELOC_SPARC22, R_SPARC_22 }, - { BFD_RELOC_SPARC13, R_SPARC_13 }, - { BFD_RELOC_SPARC_GOT10, R_SPARC_GOT10 }, - { BFD_RELOC_SPARC_GOT13, R_SPARC_GOT13 }, - { BFD_RELOC_SPARC_GOT22, R_SPARC_GOT22 }, - { BFD_RELOC_SPARC_PC10, R_SPARC_PC10 }, - { BFD_RELOC_SPARC_PC22, R_SPARC_PC22 }, - { BFD_RELOC_SPARC_WPLT30, R_SPARC_WPLT30 }, - { BFD_RELOC_SPARC_COPY, R_SPARC_COPY }, - { BFD_RELOC_SPARC_GLOB_DAT, R_SPARC_GLOB_DAT }, - { BFD_RELOC_SPARC_JMP_SLOT, R_SPARC_JMP_SLOT }, - { BFD_RELOC_SPARC_RELATIVE, R_SPARC_RELATIVE }, - { BFD_RELOC_SPARC_WDISP22, R_SPARC_WDISP22 }, - { BFD_RELOC_SPARC_UA16, R_SPARC_UA16 }, - { BFD_RELOC_SPARC_UA32, R_SPARC_UA32 }, - { BFD_RELOC_SPARC_UA64, R_SPARC_UA64 }, - { BFD_RELOC_SPARC_10, R_SPARC_10 }, - { BFD_RELOC_SPARC_11, R_SPARC_11 }, - { BFD_RELOC_SPARC_64, R_SPARC_64 }, - { BFD_RELOC_SPARC_OLO10, R_SPARC_OLO10 }, - { BFD_RELOC_SPARC_HH22, R_SPARC_HH22 }, - { BFD_RELOC_SPARC_HM10, R_SPARC_HM10 }, - { BFD_RELOC_SPARC_LM22, R_SPARC_LM22 }, - { BFD_RELOC_SPARC_PC_HH22, R_SPARC_PC_HH22 }, - { BFD_RELOC_SPARC_PC_HM10, R_SPARC_PC_HM10 }, - { BFD_RELOC_SPARC_PC_LM22, R_SPARC_PC_LM22 }, - { BFD_RELOC_SPARC_WDISP16, R_SPARC_WDISP16 }, - { BFD_RELOC_SPARC_WDISP19, R_SPARC_WDISP19 }, - { BFD_RELOC_SPARC_7, R_SPARC_7 }, - { BFD_RELOC_SPARC_5, R_SPARC_5 }, - { BFD_RELOC_SPARC_6, R_SPARC_6 }, - { BFD_RELOC_SPARC_DISP64, R_SPARC_DISP64 }, - { BFD_RELOC_SPARC_TLS_GD_HI22, R_SPARC_TLS_GD_HI22 }, - { BFD_RELOC_SPARC_TLS_GD_LO10, R_SPARC_TLS_GD_LO10 }, - { BFD_RELOC_SPARC_TLS_GD_ADD, R_SPARC_TLS_GD_ADD }, - { BFD_RELOC_SPARC_TLS_GD_CALL, R_SPARC_TLS_GD_CALL }, - { BFD_RELOC_SPARC_TLS_LDM_HI22, R_SPARC_TLS_LDM_HI22 }, - { BFD_RELOC_SPARC_TLS_LDM_LO10, R_SPARC_TLS_LDM_LO10 }, - { BFD_RELOC_SPARC_TLS_LDM_ADD, R_SPARC_TLS_LDM_ADD }, - { BFD_RELOC_SPARC_TLS_LDM_CALL, R_SPARC_TLS_LDM_CALL }, - { BFD_RELOC_SPARC_TLS_LDO_HIX22, R_SPARC_TLS_LDO_HIX22 }, - { BFD_RELOC_SPARC_TLS_LDO_LOX10, R_SPARC_TLS_LDO_LOX10 }, - { BFD_RELOC_SPARC_TLS_LDO_ADD, R_SPARC_TLS_LDO_ADD }, - { BFD_RELOC_SPARC_TLS_IE_HI22, R_SPARC_TLS_IE_HI22 }, - { BFD_RELOC_SPARC_TLS_IE_LO10, R_SPARC_TLS_IE_LO10 }, - { BFD_RELOC_SPARC_TLS_IE_LD, R_SPARC_TLS_IE_LD }, - { BFD_RELOC_SPARC_TLS_IE_LDX, R_SPARC_TLS_IE_LDX }, - { BFD_RELOC_SPARC_TLS_IE_ADD, R_SPARC_TLS_IE_ADD }, - { BFD_RELOC_SPARC_TLS_LE_HIX22, R_SPARC_TLS_LE_HIX22 }, - { BFD_RELOC_SPARC_TLS_LE_LOX10, R_SPARC_TLS_LE_LOX10 }, - { BFD_RELOC_SPARC_TLS_DTPMOD32, R_SPARC_TLS_DTPMOD32 }, - { BFD_RELOC_SPARC_TLS_DTPMOD64, R_SPARC_TLS_DTPMOD64 }, - { BFD_RELOC_SPARC_TLS_DTPOFF32, R_SPARC_TLS_DTPOFF32 }, - { BFD_RELOC_SPARC_TLS_DTPOFF64, R_SPARC_TLS_DTPOFF64 }, - { BFD_RELOC_SPARC_TLS_TPOFF32, R_SPARC_TLS_TPOFF32 }, - { BFD_RELOC_SPARC_TLS_TPOFF64, R_SPARC_TLS_TPOFF64 }, -#ifndef SPARC64_OLD_RELOCS - { BFD_RELOC_SPARC_PLT32, R_SPARC_PLT32 }, -#endif - { BFD_RELOC_SPARC_PLT64, R_SPARC_PLT64 }, - { BFD_RELOC_SPARC_HIX22, R_SPARC_HIX22 }, - { BFD_RELOC_SPARC_LOX10, R_SPARC_LOX10 }, - { BFD_RELOC_SPARC_H44, R_SPARC_H44 }, - { BFD_RELOC_SPARC_M44, R_SPARC_M44 }, - { BFD_RELOC_SPARC_L44, R_SPARC_L44 }, - { BFD_RELOC_SPARC_REGISTER, R_SPARC_REGISTER } -}; - -static reloc_howto_type * -sparc64_elf_reloc_type_lookup (abfd, code) - bfd *abfd ATTRIBUTE_UNUSED; - bfd_reloc_code_real_type code; -{ - unsigned int i; - for (i = 0; i < sizeof (sparc_reloc_map) / sizeof (struct elf_reloc_map); i++) - { - if (sparc_reloc_map[i].bfd_reloc_val == code) - return &sparc64_elf_howto_table[(int) sparc_reloc_map[i].elf_reloc_val]; - } - return 0; -} - -static void -sparc64_elf_info_to_howto (abfd, cache_ptr, dst) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *cache_ptr; - Elf_Internal_Rela *dst; -{ - BFD_ASSERT (ELF64_R_TYPE_ID (dst->r_info) < (unsigned int) R_SPARC_max_std); - cache_ptr->howto = &sparc64_elf_howto_table[ELF64_R_TYPE_ID (dst->r_info)]; -} - -struct sparc64_elf_section_data -{ - struct bfd_elf_section_data elf; - unsigned int do_relax, reloc_count; -}; - -#define sec_do_relax(sec) \ - ((struct sparc64_elf_section_data *) elf_section_data (sec))->do_relax -#define canon_reloc_count(sec) \ - ((struct sparc64_elf_section_data *) elf_section_data (sec))->reloc_count - /* Due to the way how we handle R_SPARC_OLO10, each entry in a SHT_RELA section can represent up to two relocs, we must tell the user to allocate more space. */ static long -sparc64_elf_get_reloc_upper_bound (abfd, sec) - bfd *abfd ATTRIBUTE_UNUSED; - asection *sec; +elf64_sparc_get_reloc_upper_bound (bfd *abfd ATTRIBUTE_UNUSED, asection *sec) { return (sec->reloc_count * 2 + 1) * sizeof (arelent *); } static long -sparc64_elf_get_dynamic_reloc_upper_bound (abfd) - bfd *abfd; +elf64_sparc_get_dynamic_reloc_upper_bound (bfd *abfd) { return _bfd_elf_get_dynamic_reloc_upper_bound (abfd) * 2; } @@ -350,12 +51,9 @@ sparc64_elf_get_dynamic_reloc_upper_bound (abfd) for the same location, R_SPARC_LO10 and R_SPARC_13. */ static bfd_boolean -sparc64_elf_slurp_one_reloc_table (abfd, asect, rel_hdr, symbols, dynamic) - bfd *abfd; - asection *asect; - Elf_Internal_Shdr *rel_hdr; - asymbol **symbols; - bfd_boolean dynamic; +elf64_sparc_slurp_one_reloc_table (bfd *abfd, asection *asect, + Elf_Internal_Shdr *rel_hdr, + asymbol **symbols, bfd_boolean dynamic) { PTR allocated = NULL; bfd_byte *native_relocs; @@ -386,6 +84,7 @@ sparc64_elf_slurp_one_reloc_table (abfd, asect, rel_hdr, symbols, dynamic) i++, relent++, native_relocs += entsize) { Elf_Internal_Rela rela; + unsigned int r_type; bfd_elf64_swap_reloca_in (abfd, native_relocs, &rela); @@ -416,18 +115,18 @@ sparc64_elf_slurp_one_reloc_table (abfd, asect, rel_hdr, symbols, dynamic) relent->addend = rela.r_addend; - BFD_ASSERT (ELF64_R_TYPE_ID (rela.r_info) < (unsigned int) R_SPARC_max_std); - if (ELF64_R_TYPE_ID (rela.r_info) == R_SPARC_OLO10) + r_type = ELF64_R_TYPE_ID (rela.r_info); + if (r_type == R_SPARC_OLO10) { - relent->howto = &sparc64_elf_howto_table[R_SPARC_LO10]; + relent->howto = _bfd_sparc_elf_info_to_howto_ptr (R_SPARC_LO10); relent[1].address = relent->address; relent++; relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; relent->addend = ELF64_R_TYPE_DATA (rela.r_info); - relent->howto = &sparc64_elf_howto_table[R_SPARC_13]; + relent->howto = _bfd_sparc_elf_info_to_howto_ptr (R_SPARC_13); } else - relent->howto = &sparc64_elf_howto_table[ELF64_R_TYPE_ID (rela.r_info)]; + relent->howto = _bfd_sparc_elf_info_to_howto_ptr (r_type); } canon_reloc_count (asect) += relent - relents; @@ -446,11 +145,8 @@ sparc64_elf_slurp_one_reloc_table (abfd, asect, rel_hdr, symbols, dynamic) /* Read in and swap the external relocs. */ static bfd_boolean -sparc64_elf_slurp_reloc_table (abfd, asect, symbols, dynamic) - bfd *abfd; - asection *asect; - asymbol **symbols; - bfd_boolean dynamic; +elf64_sparc_slurp_reloc_table (bfd *abfd, asection *asect, + asymbol **symbols, bfd_boolean dynamic) { struct bfd_elf_section_data * const d = elf_section_data (asect); Elf_Internal_Shdr *rel_hdr; @@ -478,7 +174,7 @@ sparc64_elf_slurp_reloc_table (abfd, asect, symbols, dynamic) case because relocations against this section may use the dynamic symbol table, and in that case bfd_section_from_shdr in elf.c does not update the RELOC_COUNT. */ - if (asect->_raw_size == 0) + if (asect->size == 0) return TRUE; rel_hdr = &d->this_hdr; @@ -492,16 +188,16 @@ sparc64_elf_slurp_reloc_table (abfd, asect, symbols, dynamic) if (asect->relocation == NULL) return FALSE; - /* The sparc64_elf_slurp_one_reloc_table routine increments + /* The elf64_sparc_slurp_one_reloc_table routine increments canon_reloc_count. */ canon_reloc_count (asect) = 0; - if (!sparc64_elf_slurp_one_reloc_table (abfd, asect, rel_hdr, symbols, + if (!elf64_sparc_slurp_one_reloc_table (abfd, asect, rel_hdr, symbols, dynamic)) return FALSE; if (rel_hdr2 - && !sparc64_elf_slurp_one_reloc_table (abfd, asect, rel_hdr2, symbols, + && !elf64_sparc_slurp_one_reloc_table (abfd, asect, rel_hdr2, symbols, dynamic)) return FALSE; @@ -511,11 +207,8 @@ sparc64_elf_slurp_reloc_table (abfd, asect, symbols, dynamic) /* Canonicalize the relocs. */ static long -sparc64_elf_canonicalize_reloc (abfd, section, relptr, symbols) - bfd *abfd; - sec_ptr section; - arelent **relptr; - asymbol **symbols; +elf64_sparc_canonicalize_reloc (bfd *abfd, sec_ptr section, + arelent **relptr, asymbol **symbols) { arelent *tblptr; unsigned int i; @@ -544,10 +237,8 @@ sparc64_elf_canonicalize_reloc (abfd, section, relptr, symbols) section. */ static long -sparc64_elf_canonicalize_dynamic_reloc (abfd, storage, syms) - bfd *abfd; - arelent **storage; - asymbol **syms; +elf64_sparc_canonicalize_dynamic_reloc (bfd *abfd, arelent **storage, + asymbol **syms) { asection *s; long ret; @@ -567,7 +258,7 @@ sparc64_elf_canonicalize_dynamic_reloc (abfd, storage, syms) arelent *p; long count, i; - if (! sparc64_elf_slurp_reloc_table (abfd, s, syms, TRUE)) + if (! elf64_sparc_slurp_reloc_table (abfd, s, syms, TRUE)) return -1; count = canon_reloc_count (s); p = s->relocation; @@ -585,13 +276,11 @@ sparc64_elf_canonicalize_dynamic_reloc (abfd, storage, syms) /* Write out the relocs. */ static void -sparc64_elf_write_relocs (abfd, sec, data) - bfd *abfd; - asection *sec; - PTR data; +elf64_sparc_write_relocs (bfd *abfd, asection *sec, PTR data) { bfd_boolean *failedp = (bfd_boolean *) data; Elf_Internal_Shdr *rela_hdr; + bfd_vma addr_offset; Elf64_External_Rela *outbound_relocas, *src_rela; unsigned int idx, count; asymbol *last_sym = 0; @@ -649,6 +338,13 @@ sparc64_elf_write_relocs (abfd, sec, data) if (rela_hdr->sh_type != SHT_RELA) abort (); + /* 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. */ + addr_offset = 0; + if ((abfd->flags & (EXEC_P | DYNAMIC)) != 0) + addr_offset = sec->vma; + /* orelocation has the data, reloc_count has the count... */ outbound_relocas = (Elf64_External_Rela *) rela_hdr->contents; src_rela = outbound_relocas; @@ -661,15 +357,6 @@ sparc64_elf_write_relocs (abfd, sec, data) int n; 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) - dst_rela.r_offset = ptr->address; - else - dst_rela.r_offset = ptr->address + sec->vma; - sym = *ptr->sym_ptr_ptr; if (sym == last_sym) n = last_sym_idx; @@ -716,687 +403,30 @@ sparc64_elf_write_relocs (abfd, sec, data) else dst_rela.r_info = ELF64_R_INFO (n, ptr->howto->type); + dst_rela.r_offset = ptr->address + addr_offset; dst_rela.r_addend = ptr->addend; + bfd_elf64_swap_reloca_out (abfd, &dst_rela, (bfd_byte *) src_rela); ++src_rela; } } -/* Sparc64 ELF linker hash table. */ - -struct sparc64_elf_app_reg -{ - unsigned char bind; - unsigned short shndx; - bfd *abfd; - char *name; -}; - -struct sparc64_elf_link_hash_table -{ - struct elf_link_hash_table root; - - struct sparc64_elf_app_reg app_regs [4]; -}; - -/* Get the Sparc64 ELF linker hash table from a link_info structure. */ - -#define sparc64_elf_hash_table(p) \ - ((struct sparc64_elf_link_hash_table *) ((p)->hash)) - -/* Create a Sparc64 ELF linker hash table. */ - -static struct bfd_link_hash_table * -sparc64_elf_bfd_link_hash_table_create (abfd) - bfd *abfd; -{ - struct sparc64_elf_link_hash_table *ret; - bfd_size_type amt = sizeof (struct sparc64_elf_link_hash_table); - - ret = (struct sparc64_elf_link_hash_table *) bfd_zmalloc (amt); - if (ret == (struct sparc64_elf_link_hash_table *) NULL) - return NULL; - - if (! _bfd_elf_link_hash_table_init (&ret->root, abfd, - _bfd_elf_link_hash_newfunc)) - { - free (ret); - return NULL; - } - - return &ret->root.root; -} - -/* Utility for performing the standard initial work of an instruction - relocation. - *PRELOCATION will contain the relocated item. - *PINSN will contain the instruction from the input stream. - If the result is `bfd_reloc_other' the caller can continue with - performing the relocation. Otherwise it must stop and return the - value to its caller. */ - -static bfd_reloc_status_type -init_insn_reloc (abfd, - reloc_entry, - symbol, - data, - input_section, - output_bfd, - prelocation, - pinsn) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - bfd_vma *prelocation; - bfd_vma *pinsn; -{ - bfd_vma relocation; - reloc_howto_type *howto = reloc_entry->howto; - - if (output_bfd != (bfd *) NULL - && (symbol->flags & BSF_SECTION_SYM) == 0 - && (! howto->partial_inplace - || reloc_entry->addend == 0)) - { - reloc_entry->address += input_section->output_offset; - return bfd_reloc_ok; - } - - /* This works because partial_inplace is FALSE. */ - if (output_bfd != NULL) - return bfd_reloc_continue; - - if (reloc_entry->address > input_section->_cooked_size) - return bfd_reloc_outofrange; - - relocation = (symbol->value - + symbol->section->output_section->vma - + symbol->section->output_offset); - relocation += reloc_entry->addend; - if (howto->pc_relative) - { - relocation -= (input_section->output_section->vma - + input_section->output_offset); - relocation -= reloc_entry->address; - } - - *prelocation = relocation; - *pinsn = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address); - return bfd_reloc_other; -} - -/* For unsupported relocs. */ - -static bfd_reloc_status_type -sparc_elf_notsup_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_notsupported; -} - -/* Handle the WDISP16 reloc. */ - -static bfd_reloc_status_type -sparc_elf_wdisp16_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 ATTRIBUTE_UNUSED; -{ - bfd_vma relocation; - bfd_vma insn; - bfd_reloc_status_type status; - - status = init_insn_reloc (abfd, reloc_entry, symbol, data, - input_section, output_bfd, &relocation, &insn); - if (status != bfd_reloc_other) - return status; - - insn &= ~ (bfd_vma) 0x303fff; - insn |= (((relocation >> 2) & 0xc000) << 6) | ((relocation >> 2) & 0x3fff); - bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address); - - if ((bfd_signed_vma) relocation < - 0x40000 - || (bfd_signed_vma) relocation > 0x3ffff) - return bfd_reloc_overflow; - else - return bfd_reloc_ok; -} - -/* Handle the HIX22 reloc. */ - -static bfd_reloc_status_type -sparc_elf_hix22_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 ATTRIBUTE_UNUSED; -{ - bfd_vma relocation; - bfd_vma insn; - bfd_reloc_status_type status; - - status = init_insn_reloc (abfd, reloc_entry, symbol, data, - input_section, output_bfd, &relocation, &insn); - if (status != bfd_reloc_other) - return status; - - relocation ^= MINUS_ONE; - insn = (insn &~ (bfd_vma) 0x3fffff) | ((relocation >> 10) & 0x3fffff); - bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address); - - if ((relocation & ~ (bfd_vma) 0xffffffff) != 0) - return bfd_reloc_overflow; - else - return bfd_reloc_ok; -} - -/* Handle the LOX10 reloc. */ - -static bfd_reloc_status_type -sparc_elf_lox10_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 ATTRIBUTE_UNUSED; -{ - bfd_vma relocation; - bfd_vma insn; - bfd_reloc_status_type status; - - status = init_insn_reloc (abfd, reloc_entry, symbol, data, - input_section, output_bfd, &relocation, &insn); - if (status != bfd_reloc_other) - return status; - - insn = (insn &~ (bfd_vma) 0x1fff) | 0x1c00 | (relocation & 0x3ff); - bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address); - - return bfd_reloc_ok; -} - -/* PLT/GOT stuff */ - -/* Both the headers and the entries are icache aligned. */ -#define PLT_ENTRY_SIZE 32 -#define PLT_HEADER_SIZE (4 * PLT_ENTRY_SIZE) -#define LARGE_PLT_THRESHOLD 32768 -#define GOT_RESERVED_ENTRIES 1 - -#define ELF_DYNAMIC_INTERPRETER "/usr/lib/sparcv9/ld.so.1" - -/* Fill in the .plt section. */ - -static void -sparc64_elf_build_plt (output_bfd, contents, nentries) - bfd *output_bfd; - unsigned char *contents; - int nentries; -{ - const unsigned int nop = 0x01000000; - int i, j; - - /* The first four entries are reserved, and are initially undefined. - We fill them with `illtrap 0' to force ld.so to do something. */ - - for (i = 0; i < PLT_HEADER_SIZE/4; ++i) - bfd_put_32 (output_bfd, (bfd_vma) 0, contents+i*4); - - /* The first 32768 entries are close enough to plt1 to get there via - a straight branch. */ - - for (i = 4; i < LARGE_PLT_THRESHOLD && i < nentries; ++i) - { - unsigned char *entry = contents + i * PLT_ENTRY_SIZE; - unsigned int sethi, ba; - - /* sethi (. - plt0), %g1 */ - sethi = 0x03000000 | (i * PLT_ENTRY_SIZE); - - /* ba,a,pt %xcc, plt1 */ - ba = 0x30680000 | (((contents+PLT_ENTRY_SIZE) - (entry+4)) / 4 & 0x7ffff); - - bfd_put_32 (output_bfd, (bfd_vma) sethi, entry); - bfd_put_32 (output_bfd, (bfd_vma) ba, entry + 4); - bfd_put_32 (output_bfd, (bfd_vma) nop, entry + 8); - bfd_put_32 (output_bfd, (bfd_vma) nop, entry + 12); - bfd_put_32 (output_bfd, (bfd_vma) nop, entry + 16); - bfd_put_32 (output_bfd, (bfd_vma) nop, entry + 20); - bfd_put_32 (output_bfd, (bfd_vma) nop, entry + 24); - bfd_put_32 (output_bfd, (bfd_vma) nop, entry + 28); - } - - /* Now the tricky bit. Entries 32768 and higher are grouped in blocks of - 160: 160 entries and 160 pointers. This is to separate code from data, - which is much friendlier on the cache. */ - - for (; i < nentries; i += 160) - { - int block = (i + 160 <= nentries ? 160 : nentries - i); - for (j = 0; j < block; ++j) - { - unsigned char *entry, *ptr; - unsigned int ldx; - - entry = contents + i*PLT_ENTRY_SIZE + j*4*6; - ptr = contents + i*PLT_ENTRY_SIZE + block*4*6 + j*8; - - /* ldx [%o7 + ptr - (entry+4)], %g1 */ - ldx = 0xc25be000 | ((ptr - (entry+4)) & 0x1fff); - - /* mov %o7,%g5 - call .+8 - nop - ldx [%o7+P],%g1 - jmpl %o7+%g1,%g1 - mov %g5,%o7 */ - bfd_put_32 (output_bfd, (bfd_vma) 0x8a10000f, entry); - bfd_put_32 (output_bfd, (bfd_vma) 0x40000002, entry + 4); - bfd_put_32 (output_bfd, (bfd_vma) nop, entry + 8); - bfd_put_32 (output_bfd, (bfd_vma) ldx, entry + 12); - bfd_put_32 (output_bfd, (bfd_vma) 0x83c3c001, entry + 16); - bfd_put_32 (output_bfd, (bfd_vma) 0x9e100005, entry + 20); - - bfd_put_64 (output_bfd, (bfd_vma) (contents - (entry + 4)), ptr); - } - } -} - -/* Return the offset of a particular plt entry within the .plt section. */ - -static bfd_vma -sparc64_elf_plt_entry_offset (index) - bfd_vma index; -{ - bfd_vma block, ofs; - - if (index < LARGE_PLT_THRESHOLD) - return index * PLT_ENTRY_SIZE; - - /* See above for details. */ - - block = (index - LARGE_PLT_THRESHOLD) / 160; - ofs = (index - LARGE_PLT_THRESHOLD) % 160; - - return (LARGE_PLT_THRESHOLD + block * 160) * PLT_ENTRY_SIZE + ofs * 6 * 4; -} - -static bfd_vma -sparc64_elf_plt_ptr_offset (index, max) - bfd_vma index; - bfd_vma max; -{ - bfd_vma block, ofs, last; - - BFD_ASSERT(index >= LARGE_PLT_THRESHOLD); - - /* See above for details. */ - - block = (((index - LARGE_PLT_THRESHOLD) / 160) * 160) + LARGE_PLT_THRESHOLD; - ofs = index - block; - if (block + 160 > max) - last = (max - LARGE_PLT_THRESHOLD) % 160; - else - last = 160; - - return (block * PLT_ENTRY_SIZE - + last * 6*4 - + ofs * 8); -} - -/* Look through the relocs for a section during the first phase, and - allocate space in the global offset table or procedure linkage - table. */ - -static bfd_boolean -sparc64_elf_check_relocs (abfd, info, sec, relocs) - bfd *abfd; - struct bfd_link_info *info; - asection *sec; - const Elf_Internal_Rela *relocs; -{ - bfd *dynobj; - Elf_Internal_Shdr *symtab_hdr; - struct elf_link_hash_entry **sym_hashes; - bfd_vma *local_got_offsets; - const Elf_Internal_Rela *rel; - const Elf_Internal_Rela *rel_end; - asection *sgot; - asection *srelgot; - asection *sreloc; - - if (info->relocatable || !(sec->flags & SEC_ALLOC)) - return TRUE; - - dynobj = elf_hash_table (info)->dynobj; - symtab_hdr = &elf_tdata (abfd)->symtab_hdr; - sym_hashes = elf_sym_hashes (abfd); - local_got_offsets = elf_local_got_offsets (abfd); - - sgot = NULL; - srelgot = NULL; - sreloc = NULL; - - rel_end = relocs + NUM_SHDR_ENTRIES (& elf_section_data (sec)->rel_hdr); - for (rel = relocs; rel < rel_end; rel++) - { - unsigned long r_symndx; - struct elf_link_hash_entry *h; - - r_symndx = ELF64_R_SYM (rel->r_info); - if (r_symndx < symtab_hdr->sh_info) - h = NULL; - else - h = sym_hashes[r_symndx - symtab_hdr->sh_info]; - - switch (ELF64_R_TYPE_ID (rel->r_info)) - { - case R_SPARC_GOT10: - case R_SPARC_GOT13: - case R_SPARC_GOT22: - /* This symbol requires a global offset table entry. */ - - if (dynobj == NULL) - { - /* Create the .got section. */ - elf_hash_table (info)->dynobj = dynobj = abfd; - if (! _bfd_elf_create_got_section (dynobj, info)) - return FALSE; - } - - if (sgot == NULL) - { - sgot = bfd_get_section_by_name (dynobj, ".got"); - BFD_ASSERT (sgot != NULL); - } - - if (srelgot == NULL && (h != NULL || info->shared)) - { - srelgot = bfd_get_section_by_name (dynobj, ".rela.got"); - if (srelgot == NULL) - { - srelgot = bfd_make_section (dynobj, ".rela.got"); - if (srelgot == NULL - || ! bfd_set_section_flags (dynobj, srelgot, - (SEC_ALLOC - | SEC_LOAD - | SEC_HAS_CONTENTS - | SEC_IN_MEMORY - | SEC_LINKER_CREATED - | SEC_READONLY)) - || ! bfd_set_section_alignment (dynobj, srelgot, 3)) - return FALSE; - } - } - - if (h != NULL) - { - if (h->got.offset != (bfd_vma) -1) - { - /* We have already allocated space in the .got. */ - break; - } - h->got.offset = sgot->_raw_size; - - /* Make sure this symbol is output as a dynamic symbol. */ - if (h->dynindx == -1) - { - if (! bfd_elf_link_record_dynamic_symbol (info, h)) - return FALSE; - } - - srelgot->_raw_size += sizeof (Elf64_External_Rela); - } - else - { - /* This is a global offset table entry for a local - symbol. */ - if (local_got_offsets == NULL) - { - bfd_size_type size; - register unsigned int i; - - size = symtab_hdr->sh_info; - size *= sizeof (bfd_vma); - local_got_offsets = (bfd_vma *) bfd_alloc (abfd, size); - if (local_got_offsets == NULL) - return FALSE; - elf_local_got_offsets (abfd) = local_got_offsets; - for (i = 0; i < symtab_hdr->sh_info; i++) - local_got_offsets[i] = (bfd_vma) -1; - } - if (local_got_offsets[r_symndx] != (bfd_vma) -1) - { - /* We have already allocated space in the .got. */ - break; - } - local_got_offsets[r_symndx] = sgot->_raw_size; - - if (info->shared) - { - /* If we are generating a shared object, we need to - output a R_SPARC_RELATIVE reloc so that the - dynamic linker can adjust this GOT entry. */ - srelgot->_raw_size += sizeof (Elf64_External_Rela); - } - } - - sgot->_raw_size += 8; - -#if 0 - /* Doesn't work for 64-bit -fPIC, since sethi/or builds - unsigned numbers. If we permit ourselves to modify - code so we get sethi/xor, this could work. - Question: do we consider conditionally re-enabling - this for -fpic, once we know about object code models? */ - /* If the .got section is more than 0x1000 bytes, we add - 0x1000 to the value of _GLOBAL_OFFSET_TABLE_, so that 13 - bit relocations have a greater chance of working. */ - if (sgot->_raw_size >= 0x1000 - && elf_hash_table (info)->hgot->root.u.def.value == 0) - elf_hash_table (info)->hgot->root.u.def.value = 0x1000; -#endif - - break; - - case R_SPARC_WPLT30: - case R_SPARC_PLT32: - case R_SPARC_HIPLT22: - case R_SPARC_LOPLT10: - case R_SPARC_PCPLT32: - case R_SPARC_PCPLT22: - case R_SPARC_PCPLT10: - case R_SPARC_PLT64: - /* This symbol requires a procedure linkage table entry. We - actually build the entry in adjust_dynamic_symbol, - because this might be a case of linking PIC code without - linking in any dynamic objects, in which case we don't - need to generate a procedure linkage table after all. */ - - if (h == NULL) - { - /* It does not make sense to have a procedure linkage - table entry for a local symbol. */ - bfd_set_error (bfd_error_bad_value); - return FALSE; - } - - /* Make sure this symbol is output as a dynamic symbol. */ - if (h->dynindx == -1) - { - if (! bfd_elf_link_record_dynamic_symbol (info, h)) - return FALSE; - } - - h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; - if (ELF64_R_TYPE_ID (rel->r_info) != R_SPARC_PLT32 - && ELF64_R_TYPE_ID (rel->r_info) != R_SPARC_PLT64) - break; - /* Fall through. */ - case R_SPARC_PC10: - case R_SPARC_PC22: - case R_SPARC_PC_HH22: - case R_SPARC_PC_HM10: - case R_SPARC_PC_LM22: - if (h != NULL - && strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0) - break; - /* Fall through. */ - case R_SPARC_DISP8: - case R_SPARC_DISP16: - case R_SPARC_DISP32: - case R_SPARC_DISP64: - case R_SPARC_WDISP30: - case R_SPARC_WDISP22: - case R_SPARC_WDISP19: - case R_SPARC_WDISP16: - if (h == NULL) - break; - /* Fall through. */ - case R_SPARC_8: - case R_SPARC_16: - case R_SPARC_32: - case R_SPARC_HI22: - case R_SPARC_22: - case R_SPARC_13: - case R_SPARC_LO10: - case R_SPARC_UA32: - case R_SPARC_10: - case R_SPARC_11: - case R_SPARC_64: - case R_SPARC_OLO10: - case R_SPARC_HH22: - case R_SPARC_HM10: - case R_SPARC_LM22: - case R_SPARC_7: - case R_SPARC_5: - case R_SPARC_6: - case R_SPARC_HIX22: - case R_SPARC_LOX10: - case R_SPARC_H44: - case R_SPARC_M44: - case R_SPARC_L44: - case R_SPARC_UA64: - case R_SPARC_UA16: - /* When creating a shared object, we must copy these relocs - into the output file. We create a reloc section in - dynobj and make room for the reloc. - - But don't do this for debugging sections -- this shows up - with DWARF2 -- first because they are not loaded, and - second because DWARF sez the debug info is not to be - biased by the load address. */ - if (info->shared && (sec->flags & SEC_ALLOC)) - { - if (sreloc == NULL) - { - const char *name; - - name = (bfd_elf_string_from_elf_section - (abfd, - elf_elfheader (abfd)->e_shstrndx, - elf_section_data (sec)->rel_hdr.sh_name)); - if (name == NULL) - return FALSE; - - BFD_ASSERT (strncmp (name, ".rela", 5) == 0 - && strcmp (bfd_get_section_name (abfd, sec), - name + 5) == 0); - - sreloc = bfd_get_section_by_name (dynobj, name); - if (sreloc == NULL) - { - flagword flags; - - sreloc = bfd_make_section (dynobj, name); - flags = (SEC_HAS_CONTENTS | SEC_READONLY - | SEC_IN_MEMORY | SEC_LINKER_CREATED); - if ((sec->flags & SEC_ALLOC) != 0) - flags |= SEC_ALLOC | SEC_LOAD; - if (sreloc == NULL - || ! bfd_set_section_flags (dynobj, sreloc, flags) - || ! bfd_set_section_alignment (dynobj, sreloc, 3)) - return FALSE; - } - if (sec->flags & SEC_READONLY) - info->flags |= DF_TEXTREL; - } - - sreloc->_raw_size += sizeof (Elf64_External_Rela); - } - break; - - case R_SPARC_REGISTER: - /* Nothing to do. */ - break; - - default: - (*_bfd_error_handler) (_("%s: check_relocs: unhandled reloc type %d"), - bfd_archive_filename (abfd), - ELF64_R_TYPE_ID (rel->r_info)); - return FALSE; - } - } - - return TRUE; -} - /* Hook called by the linker routine which adds symbols from an object file. We use it for STT_REGISTER symbols. */ static bfd_boolean -sparc64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) - bfd *abfd; - struct bfd_link_info *info; - Elf_Internal_Sym *sym; - const char **namep; - flagword *flagsp ATTRIBUTE_UNUSED; - asection **secp ATTRIBUTE_UNUSED; - bfd_vma *valp ATTRIBUTE_UNUSED; +elf64_sparc_add_symbol_hook (bfd *abfd, struct bfd_link_info *info, + Elf_Internal_Sym *sym, const char **namep, + flagword *flagsp ATTRIBUTE_UNUSED, + asection **secp ATTRIBUTE_UNUSED, + bfd_vma *valp ATTRIBUTE_UNUSED) { static const char *const stt_types[] = { "NOTYPE", "OBJECT", "FUNCTION" }; if (ELF_ST_TYPE (sym->st_info) == STT_REGISTER) { int reg; - struct sparc64_elf_app_reg *p; + struct _bfd_sparc_elf_app_reg *p; reg = (int)sym->st_value; switch (reg & ~1) @@ -1405,8 +435,8 @@ sparc64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) case 6: reg -= 4; break; default: (*_bfd_error_handler) - (_("%s: Only registers %%g[2367] can be declared using STT_REGISTER"), - bfd_archive_filename (abfd)); + (_("%B: Only registers %%g[2367] can be declared using STT_REGISTER"), + abfd); return FALSE; } @@ -1420,15 +450,15 @@ sparc64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) return TRUE; } - p = sparc64_elf_hash_table(info)->app_regs + reg; + p = _bfd_sparc_elf_hash_table(info)->app_regs + reg; if (p->name != NULL && strcmp (p->name, *namep)) { (*_bfd_error_handler) - (_("Register %%g%d used incompatibly: %s in %s, previously %s in %s"), - (int) sym->st_value, - **namep ? *namep : "#scratch", bfd_archive_filename (abfd), - *p->name ? p->name : "#scratch", bfd_archive_filename (p->abfd)); + (_("Register %%g%d used incompatibly: %s in %B, previously %s in %B"), + abfd, p->abfd, (int) sym->st_value, + **namep ? *namep : "#scratch", + *p->name ? p->name : "#scratch"); return FALSE; } @@ -1448,9 +478,8 @@ sparc64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) if (type > STT_FUNC) type = 0; (*_bfd_error_handler) - (_("Symbol `%s' has differing types: REGISTER in %s, previously %s in %s"), - *namep, bfd_archive_filename (abfd), - stt_types[type], bfd_archive_filename (p->abfd)); + (_("Symbol `%s' has differing types: REGISTER in %B, previously %s in %B"), + abfd, p->abfd, *namep, stt_types[type]); return FALSE; } @@ -1483,9 +512,9 @@ sparc64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) && info->hash->creator == abfd->xvec) { int i; - struct sparc64_elf_app_reg *p; + struct _bfd_sparc_elf_app_reg *p; - p = sparc64_elf_hash_table(info)->app_regs; + p = _bfd_sparc_elf_hash_table(info)->app_regs; for (i = 0; i < 4; i++, p++) if (p->name != NULL && ! strcmp (p->name, *namep)) { @@ -1494,9 +523,8 @@ sparc64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) if (type > STT_FUNC) type = 0; (*_bfd_error_handler) - (_("Symbol `%s' has differing types: %s in %s, previously REGISTER in %s"), - *namep, stt_types[type], bfd_archive_filename (abfd), - bfd_archive_filename (p->abfd)); + (_("Symbol `%s' has differing types: %s in %B, previously REGISTER in %B"), + abfd, p->abfd, *namep, stt_types[type]); return FALSE; } } @@ -1507,17 +535,16 @@ sparc64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) which we cannot easily keep in the symbol hash table. */ static bfd_boolean -sparc64_elf_output_arch_syms (output_bfd, info, finfo, func) - bfd *output_bfd ATTRIBUTE_UNUSED; - struct bfd_link_info *info; - PTR finfo; - bfd_boolean (*func) - PARAMS ((PTR, const char *, Elf_Internal_Sym *, asection *, - struct elf_link_hash_entry *)); +elf64_sparc_output_arch_syms (bfd *output_bfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info, + PTR finfo, bfd_boolean (*func) (PTR, const char *, + Elf_Internal_Sym *, + asection *, + struct elf_link_hash_entry *)) { int reg; - struct sparc64_elf_app_reg *app_regs = - sparc64_elf_hash_table(info)->app_regs; + struct _bfd_sparc_elf_app_reg *app_regs = + _bfd_sparc_elf_hash_table(info)->app_regs; Elf_Internal_Sym sym; /* We arranged in size_dynamic_sections to put the STT_REGISTER entries @@ -1568,9 +595,7 @@ sparc64_elf_output_arch_syms (output_bfd, info, finfo, func) } static int -sparc64_elf_get_symbol_type (elf_sym, type) - Elf_Internal_Sym * elf_sym; - int type; +elf64_sparc_get_symbol_type (Elf_Internal_Sym *elf_sym, int type) { if (ELF_ST_TYPE (elf_sym->st_info) == STT_REGISTER) return STT_REGISTER; @@ -1582,9 +607,7 @@ sparc64_elf_get_symbol_type (elf_sym, type) even in SHN_UNDEF section. */ static void -sparc64_elf_symbol_processing (abfd, asym) - bfd *abfd ATTRIBUTE_UNUSED; - asymbol *asym; +elf64_sparc_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED, asymbol *asym) { elf_symbol_type *elfsym; @@ -1596,1363 +619,6 @@ sparc64_elf_symbol_processing (abfd, asym) } } -/* Adjust a symbol defined by a dynamic object and referenced by a - regular object. The current definition is in some section of the - dynamic object, but we're not including those sections. We have to - change the definition to something the rest of the link can - understand. */ - -static bfd_boolean -sparc64_elf_adjust_dynamic_symbol (info, h) - struct bfd_link_info *info; - struct elf_link_hash_entry *h; -{ - bfd *dynobj; - asection *s; - unsigned int power_of_two; - - dynobj = elf_hash_table (info)->dynobj; - - /* Make sure we know what is going on here. */ - BFD_ASSERT (dynobj != NULL - && ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) - || h->weakdef != NULL - || ((h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - && (h->elf_link_hash_flags - & ELF_LINK_HASH_REF_REGULAR) != 0 - && (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0))); - - /* If this is a function, put it in the procedure linkage table. We - will fill in the contents of the procedure linkage table later - (although we could actually do it here). The STT_NOTYPE - condition is a hack specifically for the Oracle libraries - delivered for Solaris; for some inexplicable reason, they define - some of their functions as STT_NOTYPE when they really should be - STT_FUNC. */ - if (h->type == STT_FUNC - || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0 - || (h->type == STT_NOTYPE - && (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - && (h->root.u.def.section->flags & SEC_CODE) != 0)) - { - if (! info->shared - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0 - && h->root.type != bfd_link_hash_undefweak - && h->root.type != bfd_link_hash_undefined) - { - /* This case can occur if we saw a WPLT30 reloc in an input - file, but none of the input files were dynamic objects. - In such a case, we don't actually need to build a - procedure linkage table, and we can just do a WDISP30 - reloc instead. */ - BFD_ASSERT ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0); - return TRUE; - } - - s = bfd_get_section_by_name (dynobj, ".plt"); - BFD_ASSERT (s != NULL); - - /* The first four bit in .plt is reserved. */ - if (s->_raw_size == 0) - s->_raw_size = PLT_HEADER_SIZE; - - /* To simplify matters later, just store the plt index here. */ - h->plt.offset = s->_raw_size / PLT_ENTRY_SIZE; - - /* If this symbol is not defined in a regular file, and we are - not generating a shared library, then set the symbol to this - location in the .plt. This is required to make function - pointers compare as equal between the normal executable and - the shared library. */ - if (! info->shared - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) - { - h->root.u.def.section = s; - h->root.u.def.value = sparc64_elf_plt_entry_offset (h->plt.offset); - } - - /* Make room for this entry. */ - s->_raw_size += PLT_ENTRY_SIZE; - - /* We also need to make an entry in the .rela.plt section. */ - - s = bfd_get_section_by_name (dynobj, ".rela.plt"); - BFD_ASSERT (s != NULL); - - s->_raw_size += sizeof (Elf64_External_Rela); - - /* The procedure linkage table size is bounded by the magnitude - of the offset we can describe in the entry. */ - if (s->_raw_size >= (bfd_vma)1 << 32) - { - bfd_set_error (bfd_error_bad_value); - return FALSE; - } - - 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. */ - - /* If we are creating a shared library, we must presume that the - only references to the symbol are via the global offset table. - For such cases we need not do anything here; the relocations will - be handled correctly by relocate_section. */ - if (info->shared) - return TRUE; - - /* We must allocate the symbol in our .dynbss section, which will - become part of the .bss section of the executable. There will be - an entry for this symbol in the .dynsym section. The dynamic - object will contain position independent code, so all references - from the dynamic object to this symbol will go through the global - offset table. The dynamic linker will use the .dynsym entry to - determine the address it must put in the global offset table, so - both the dynamic object and the regular object will refer to the - same memory location for the variable. */ - - s = bfd_get_section_by_name (dynobj, ".dynbss"); - BFD_ASSERT (s != NULL); - - /* We must generate a R_SPARC_COPY reloc to tell the dynamic linker - to copy the initial value out of the dynamic object and into the - runtime process image. We need to remember the offset into the - .rel.bss section we are going to use. */ - if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) - { - asection *srel; - - srel = bfd_get_section_by_name (dynobj, ".rela.bss"); - BFD_ASSERT (srel != NULL); - srel->_raw_size += sizeof (Elf64_External_Rela); - h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY; - } - - /* We need to figure out the alignment required for this symbol. I - have no idea how ELF linkers handle this. 16-bytes is the size - of the largest type that requires hard alignment -- long double. */ - power_of_two = bfd_log2 (h->size); - if (power_of_two > 4) - power_of_two = 4; - - /* Apply the required alignment. */ - s->_raw_size = BFD_ALIGN (s->_raw_size, - (bfd_size_type) (1 << power_of_two)); - if (power_of_two > bfd_get_section_alignment (dynobj, s)) - { - if (! bfd_set_section_alignment (dynobj, s, power_of_two)) - return FALSE; - } - - /* Define the symbol as being at this point in the section. */ - h->root.u.def.section = s; - h->root.u.def.value = s->_raw_size; - - /* Increment the section size to make room for the symbol. */ - s->_raw_size += h->size; - - return TRUE; -} - -/* Set the sizes of the dynamic sections. */ - -static bfd_boolean -sparc64_elf_size_dynamic_sections (output_bfd, info) - bfd *output_bfd; - struct bfd_link_info *info; -{ - bfd *dynobj; - asection *s; - bfd_boolean relplt; - - 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->executable) - { - s = bfd_get_section_by_name (dynobj, ".interp"); - BFD_ASSERT (s != NULL); - s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER; - s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER; - } - } - else - { - /* We may have created entries in the .rela.got section. - However, if we are not creating the dynamic sections, we will - not actually use these entries. Reset the size of .rela.got, - which will cause it to get stripped from the output file - below. */ - s = bfd_get_section_by_name (dynobj, ".rela.got"); - if (s != NULL) - s->_raw_size = 0; - } - - /* The check_relocs and adjust_dynamic_symbol entry points have - determined the sizes of the various dynamic sections. Allocate - memory for them. */ - relplt = FALSE; - for (s = dynobj->sections; s != NULL; s = s->next) - { - const char *name; - bfd_boolean strip; - - if ((s->flags & SEC_LINKER_CREATED) == 0) - continue; - - /* It's OK to base decisions on the section name, because none - of the dynobj section names depend upon the input files. */ - name = bfd_get_section_name (dynobj, s); - - strip = FALSE; - - if (strncmp (name, ".rela", 5) == 0) - { - if (s->_raw_size == 0) - { - /* If we don't need this section, strip it from the - output file. This is to handle .rela.bss and - .rel.plt. We must create it in - create_dynamic_sections, because it must be created - before the linker maps input sections to output - sections. The linker does that before - adjust_dynamic_symbol is called, and it is that - function which decides whether anything needs to go - into these sections. */ - strip = TRUE; - } - else - { - if (strcmp (name, ".rela.plt") == 0) - relplt = TRUE; - - /* We use the reloc_count field as a counter if we need - to copy relocs into the output file. */ - s->reloc_count = 0; - } - } - else if (strcmp (name, ".plt") != 0 - && strncmp (name, ".got", 4) != 0) - { - /* It's not one of our sections, so don't allocate space. */ - continue; - } - - if (strip) - { - _bfd_strip_section_from_output (info, s); - continue; - } - - /* Allocate memory for the section contents. Zero the memory - for the benefit of .rela.plt, which has 4 unused entries - at the beginning, and we don't want garbage. */ - s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size); - if (s->contents == NULL && s->_raw_size != 0) - return FALSE; - } - - if (elf_hash_table (info)->dynamic_sections_created) - { - /* Add some entries to the .dynamic section. We fill in the - values later, in sparc64_elf_finish_dynamic_sections, but we - must add the entries now so that we get the correct size for - the .dynamic section. The DT_DEBUG entry is filled in by the - dynamic linker and used by the debugger. */ -#define add_dynamic_entry(TAG, VAL) \ - _bfd_elf_add_dynamic_entry (info, TAG, VAL) - - int reg; - struct sparc64_elf_app_reg * app_regs; - struct elf_strtab_hash *dynstr; - struct elf_link_hash_table *eht = elf_hash_table (info); - - if (info->executable) - { - if (!add_dynamic_entry (DT_DEBUG, 0)) - return FALSE; - } - - if (relplt) - { - if (!add_dynamic_entry (DT_PLTGOT, 0) - || !add_dynamic_entry (DT_PLTRELSZ, 0) - || !add_dynamic_entry (DT_PLTREL, DT_RELA) - || !add_dynamic_entry (DT_JMPREL, 0)) - return FALSE; - } - - if (!add_dynamic_entry (DT_RELA, 0) - || !add_dynamic_entry (DT_RELASZ, 0) - || !add_dynamic_entry (DT_RELAENT, sizeof (Elf64_External_Rela))) - return FALSE; - - if (info->flags & DF_TEXTREL) - { - if (!add_dynamic_entry (DT_TEXTREL, 0)) - return FALSE; - } - - /* Add dynamic STT_REGISTER symbols and corresponding DT_SPARC_REGISTER - entries if needed. */ - app_regs = sparc64_elf_hash_table (info)->app_regs; - dynstr = eht->dynstr; - - for (reg = 0; reg < 4; reg++) - if (app_regs [reg].name != NULL) - { - struct elf_link_local_dynamic_entry *entry, *e; - - if (!add_dynamic_entry (DT_SPARC_REGISTER, 0)) - return FALSE; - - entry = (struct elf_link_local_dynamic_entry *) - bfd_hash_allocate (&info->hash->table, sizeof (*entry)); - if (entry == NULL) - return FALSE; - - /* We cheat here a little bit: the symbol will not be local, so we - put it at the end of the dynlocal linked list. We will fix it - later on, as we have to fix other fields anyway. */ - entry->isym.st_value = reg < 2 ? reg + 2 : reg + 4; - entry->isym.st_size = 0; - if (*app_regs [reg].name != '\0') - entry->isym.st_name - = _bfd_elf_strtab_add (dynstr, app_regs[reg].name, FALSE); - else - entry->isym.st_name = 0; - entry->isym.st_other = 0; - entry->isym.st_info = ELF_ST_INFO (app_regs [reg].bind, - STT_REGISTER); - entry->isym.st_shndx = app_regs [reg].shndx; - entry->next = NULL; - entry->input_bfd = output_bfd; - entry->input_indx = -1; - - if (eht->dynlocal == NULL) - eht->dynlocal = entry; - else - { - for (e = eht->dynlocal; e->next; e = e->next) - ; - e->next = entry; - } - eht->dynsymcount++; - } - } -#undef add_dynamic_entry - - return TRUE; -} - -static bfd_boolean -sparc64_elf_new_section_hook (abfd, sec) - bfd *abfd; - asection *sec; -{ - struct sparc64_elf_section_data *sdata; - bfd_size_type amt = sizeof (*sdata); - - sdata = (struct sparc64_elf_section_data *) bfd_zalloc (abfd, amt); - if (sdata == NULL) - return FALSE; - sec->used_by_bfd = (PTR) sdata; - - return _bfd_elf_new_section_hook (abfd, sec); -} - -static bfd_boolean -sparc64_elf_relax_section (abfd, section, link_info, again) - bfd *abfd ATTRIBUTE_UNUSED; - asection *section ATTRIBUTE_UNUSED; - struct bfd_link_info *link_info ATTRIBUTE_UNUSED; - bfd_boolean *again; -{ - *again = FALSE; - sec_do_relax (section) = 1; - return TRUE; -} - -/* Relocate a SPARC64 ELF section. */ - -static bfd_boolean -sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, - contents, relocs, local_syms, local_sections) - bfd *output_bfd; - struct bfd_link_info *info; - bfd *input_bfd; - asection *input_section; - bfd_byte *contents; - Elf_Internal_Rela *relocs; - Elf_Internal_Sym *local_syms; - asection **local_sections; -{ - bfd *dynobj; - Elf_Internal_Shdr *symtab_hdr; - struct elf_link_hash_entry **sym_hashes; - bfd_vma *local_got_offsets; - bfd_vma got_base; - asection *sgot; - asection *splt; - asection *sreloc; - Elf_Internal_Rela *rel; - Elf_Internal_Rela *relend; - - if (info->relocatable) - return TRUE; - - dynobj = elf_hash_table (info)->dynobj; - symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; - sym_hashes = elf_sym_hashes (input_bfd); - local_got_offsets = elf_local_got_offsets (input_bfd); - - if (elf_hash_table(info)->hgot == NULL) - got_base = 0; - else - got_base = elf_hash_table (info)->hgot->root.u.def.value; - - sgot = splt = sreloc = NULL; - if (dynobj != NULL) - splt = bfd_get_section_by_name (dynobj, ".plt"); - - rel = relocs; - relend = relocs + NUM_SHDR_ENTRIES (& elf_section_data (input_section)->rel_hdr); - for (; rel < relend; rel++) - { - int r_type; - reloc_howto_type *howto; - unsigned long r_symndx; - struct elf_link_hash_entry *h; - Elf_Internal_Sym *sym; - asection *sec; - bfd_vma relocation, off; - bfd_reloc_status_type r; - bfd_boolean is_plt = FALSE; - bfd_boolean unresolved_reloc; - - r_type = ELF64_R_TYPE_ID (rel->r_info); - if (r_type < 0 || r_type >= (int) R_SPARC_max_std) - { - bfd_set_error (bfd_error_bad_value); - return FALSE; - } - howto = sparc64_elf_howto_table + r_type; - - /* This is a final link. */ - r_symndx = ELF64_R_SYM (rel->r_info); - h = NULL; - sym = NULL; - sec = NULL; - unresolved_reloc = FALSE; - if (r_symndx < symtab_hdr->sh_info) - { - sym = local_syms + r_symndx; - sec = local_sections[r_symndx]; - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); - } - else - { - bfd_boolean warned; - - RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel, - r_symndx, symtab_hdr, sym_hashes, - h, sec, relocation, - unresolved_reloc, warned); - if (warned) - { - /* To avoid generating warning messages about truncated - relocations, set the relocation's address to be the same as - the start of this section. */ - if (input_section->output_section != NULL) - relocation = input_section->output_section->vma; - else - relocation = 0; - } - } - - do_dynreloc: - /* When generating a shared object, these relocations are copied - into the output file to be resolved at run time. */ - if (info->shared && r_symndx != 0 && (input_section->flags & SEC_ALLOC)) - { - switch (r_type) - { - case R_SPARC_PC10: - case R_SPARC_PC22: - case R_SPARC_PC_HH22: - case R_SPARC_PC_HM10: - case R_SPARC_PC_LM22: - if (h != NULL - && !strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_")) - break; - /* Fall through. */ - case R_SPARC_DISP8: - case R_SPARC_DISP16: - case R_SPARC_DISP32: - case R_SPARC_DISP64: - case R_SPARC_WDISP30: - case R_SPARC_WDISP22: - case R_SPARC_WDISP19: - case R_SPARC_WDISP16: - if (h == NULL) - break; - /* Fall through. */ - case R_SPARC_8: - case R_SPARC_16: - case R_SPARC_32: - case R_SPARC_HI22: - case R_SPARC_22: - case R_SPARC_13: - case R_SPARC_LO10: - case R_SPARC_UA32: - case R_SPARC_10: - case R_SPARC_11: - case R_SPARC_64: - case R_SPARC_OLO10: - case R_SPARC_HH22: - case R_SPARC_HM10: - case R_SPARC_LM22: - case R_SPARC_7: - case R_SPARC_5: - case R_SPARC_6: - case R_SPARC_HIX22: - case R_SPARC_LOX10: - case R_SPARC_H44: - case R_SPARC_M44: - case R_SPARC_L44: - case R_SPARC_UA64: - case R_SPARC_UA16: - { - Elf_Internal_Rela outrel; - bfd_byte *loc; - bfd_boolean skip, relocate; - - if (sreloc == NULL) - { - const char *name = - (bfd_elf_string_from_elf_section - (input_bfd, - elf_elfheader (input_bfd)->e_shstrndx, - elf_section_data (input_section)->rel_hdr.sh_name)); - - if (name == NULL) - return FALSE; - - BFD_ASSERT (strncmp (name, ".rela", 5) == 0 - && strcmp (bfd_get_section_name(input_bfd, - input_section), - name + 5) == 0); - - sreloc = bfd_get_section_by_name (dynobj, name); - BFD_ASSERT (sreloc != NULL); - } - - skip = FALSE; - relocate = FALSE; - - outrel.r_offset = - _bfd_elf_section_offset (output_bfd, info, input_section, - rel->r_offset); - if (outrel.r_offset == (bfd_vma) -1) - skip = TRUE; - else if (outrel.r_offset == (bfd_vma) -2) - skip = TRUE, relocate = TRUE; - - outrel.r_offset += (input_section->output_section->vma - + input_section->output_offset); - - /* Optimize unaligned reloc usage now that we know where - it finally resides. */ - switch (r_type) - { - case R_SPARC_16: - if (outrel.r_offset & 1) r_type = R_SPARC_UA16; - break; - case R_SPARC_UA16: - if (!(outrel.r_offset & 1)) r_type = R_SPARC_16; - break; - case R_SPARC_32: - if (outrel.r_offset & 3) r_type = R_SPARC_UA32; - break; - case R_SPARC_UA32: - if (!(outrel.r_offset & 3)) r_type = R_SPARC_32; - break; - case R_SPARC_64: - if (outrel.r_offset & 7) r_type = R_SPARC_UA64; - break; - case R_SPARC_UA64: - if (!(outrel.r_offset & 7)) r_type = R_SPARC_64; - break; - case R_SPARC_DISP8: - case R_SPARC_DISP16: - case R_SPARC_DISP32: - case R_SPARC_DISP64: - /* If the symbol is not dynamic, we should not keep - a dynamic relocation. But an .rela.* slot has been - allocated for it, output R_SPARC_NONE. - FIXME: Add code tracking needed dynamic relocs as - e.g. i386 has. */ - if (h->dynindx == -1) - skip = TRUE, relocate = TRUE; - break; - } - - if (skip) - memset (&outrel, 0, sizeof outrel); - /* h->dynindx may be -1 if the symbol was marked to - become local. */ - else if (h != NULL && ! is_plt - && ((! info->symbolic && h->dynindx != -1) - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0)) - { - BFD_ASSERT (h->dynindx != -1); - outrel.r_info - = ELF64_R_INFO (h->dynindx, - ELF64_R_TYPE_INFO ( - ELF64_R_TYPE_DATA (rel->r_info), - r_type)); - outrel.r_addend = rel->r_addend; - } - else - { - outrel.r_addend = relocation + rel->r_addend; - if (r_type == R_SPARC_64) - outrel.r_info = ELF64_R_INFO (0, R_SPARC_RELATIVE); - else - { - long indx; - - if (is_plt) - sec = splt; - - if (bfd_is_abs_section (sec)) - indx = 0; - else if (sec == NULL || sec->owner == NULL) - { - bfd_set_error (bfd_error_bad_value); - return FALSE; - } - else - { - asection *osec; - - osec = sec->output_section; - indx = elf_section_data (osec)->dynindx; - - /* We are turning this relocation into one - against a section symbol, so subtract out - the output section's address but not the - offset of the input section in the output - section. */ - outrel.r_addend -= osec->vma; - - /* FIXME: we really should be able to link non-pic - shared libraries. */ - if (indx == 0) - { - BFD_FAIL (); - (*_bfd_error_handler) - (_("%s: probably compiled without -fPIC?"), - bfd_archive_filename (input_bfd)); - bfd_set_error (bfd_error_bad_value); - return FALSE; - } - } - - outrel.r_info - = ELF64_R_INFO (indx, - ELF64_R_TYPE_INFO ( - ELF64_R_TYPE_DATA (rel->r_info), - r_type)); - } - } - - loc = sreloc->contents; - loc += sreloc->reloc_count++ * sizeof (Elf64_External_Rela); - bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc); - - /* This reloc will be computed at runtime, so there's no - need to do anything now. */ - if (! relocate) - continue; - } - break; - } - } - - switch (r_type) - { - case R_SPARC_GOT10: - case R_SPARC_GOT13: - case R_SPARC_GOT22: - /* Relocation is to the entry for this symbol in the global - offset table. */ - if (sgot == NULL) - { - sgot = bfd_get_section_by_name (dynobj, ".got"); - BFD_ASSERT (sgot != NULL); - } - - if (h != NULL) - { - bfd_boolean dyn; - - off = h->got.offset; - BFD_ASSERT (off != (bfd_vma) -1); - dyn = elf_hash_table (info)->dynamic_sections_created; - - if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h) - || (info->shared - && (info->symbolic - || h->dynindx == -1 - || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL)) - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))) - { - /* This is actually a static link, or it is a -Bsymbolic - link and the symbol is defined locally, or the symbol - was forced to be local because of a version file. We - must initialize this entry in the global offset table. - Since the offset must always be a multiple of 8, we - use the least significant bit to record whether we - have initialized it already. - - When doing a dynamic link, we create a .rela.got - relocation entry to initialize the value. This is - done in the finish_dynamic_symbol routine. */ - - if ((off & 1) != 0) - off &= ~1; - else - { - bfd_put_64 (output_bfd, relocation, - sgot->contents + off); - h->got.offset |= 1; - } - } - else - unresolved_reloc = FALSE; - } - else - { - BFD_ASSERT (local_got_offsets != NULL); - off = local_got_offsets[r_symndx]; - BFD_ASSERT (off != (bfd_vma) -1); - - /* The offset must always be a multiple of 8. We use - the least significant bit to record whether we have - already processed this entry. */ - if ((off & 1) != 0) - off &= ~1; - else - { - local_got_offsets[r_symndx] |= 1; - - if (info->shared) - { - asection *s; - Elf_Internal_Rela outrel; - bfd_byte *loc; - - /* The Solaris 2.7 64-bit linker adds the contents - of the location to the value of the reloc. - Note this is different behaviour to the - 32-bit linker, which both adds the contents - and ignores the addend. So clear the location. */ - bfd_put_64 (output_bfd, (bfd_vma) 0, - sgot->contents + off); - - /* We need to generate a R_SPARC_RELATIVE reloc - for the dynamic linker. */ - s = bfd_get_section_by_name(dynobj, ".rela.got"); - BFD_ASSERT (s != NULL); - - outrel.r_offset = (sgot->output_section->vma - + sgot->output_offset - + off); - outrel.r_info = ELF64_R_INFO (0, R_SPARC_RELATIVE); - outrel.r_addend = relocation; - loc = s->contents; - loc += s->reloc_count++ * sizeof (Elf64_External_Rela); - bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc); - } - else - bfd_put_64 (output_bfd, relocation, sgot->contents + off); - } - } - relocation = sgot->output_offset + off - got_base; - goto do_default; - - case R_SPARC_WPLT30: - case R_SPARC_PLT32: - case R_SPARC_HIPLT22: - case R_SPARC_LOPLT10: - case R_SPARC_PCPLT32: - case R_SPARC_PCPLT22: - case R_SPARC_PCPLT10: - case R_SPARC_PLT64: - /* Relocation is to the entry for this symbol in the - procedure linkage table. */ - BFD_ASSERT (h != NULL); - - if (h->plt.offset == (bfd_vma) -1 || splt == NULL) - { - /* We didn't make a PLT entry for this symbol. This - happens when statically linking PIC code, or when - using -Bsymbolic. */ - goto do_default; - } - - relocation = (splt->output_section->vma - + splt->output_offset - + sparc64_elf_plt_entry_offset (h->plt.offset)); - unresolved_reloc = FALSE; - if (r_type == R_SPARC_WPLT30) - goto do_wplt30; - if (r_type == R_SPARC_PLT32 || r_type == R_SPARC_PLT64) - { - r_type = r_type == R_SPARC_PLT32 ? R_SPARC_32 : R_SPARC_64; - is_plt = TRUE; - goto do_dynreloc; - } - goto do_default; - - case R_SPARC_OLO10: - { - bfd_vma x; - - relocation += rel->r_addend; - relocation = (relocation & 0x3ff) + ELF64_R_TYPE_DATA (rel->r_info); - - x = bfd_get_32 (input_bfd, contents + rel->r_offset); - x = (x & ~(bfd_vma) 0x1fff) | (relocation & 0x1fff); - bfd_put_32 (input_bfd, x, contents + rel->r_offset); - - r = bfd_check_overflow (howto->complain_on_overflow, - howto->bitsize, howto->rightshift, - bfd_arch_bits_per_address (input_bfd), - relocation); - } - break; - - case R_SPARC_WDISP16: - { - bfd_vma x; - - relocation += rel->r_addend; - /* Adjust for pc-relative-ness. */ - relocation -= (input_section->output_section->vma - + input_section->output_offset); - relocation -= rel->r_offset; - - x = bfd_get_32 (input_bfd, contents + rel->r_offset); - x &= ~(bfd_vma) 0x303fff; - x |= ((((relocation >> 2) & 0xc000) << 6) - | ((relocation >> 2) & 0x3fff)); - bfd_put_32 (input_bfd, x, contents + rel->r_offset); - - r = bfd_check_overflow (howto->complain_on_overflow, - howto->bitsize, howto->rightshift, - bfd_arch_bits_per_address (input_bfd), - relocation); - } - break; - - case R_SPARC_HIX22: - { - bfd_vma x; - - relocation += rel->r_addend; - relocation = relocation ^ MINUS_ONE; - - x = bfd_get_32 (input_bfd, contents + rel->r_offset); - x = (x & ~(bfd_vma) 0x3fffff) | ((relocation >> 10) & 0x3fffff); - bfd_put_32 (input_bfd, x, contents + rel->r_offset); - - r = bfd_check_overflow (howto->complain_on_overflow, - howto->bitsize, howto->rightshift, - bfd_arch_bits_per_address (input_bfd), - relocation); - } - break; - - case R_SPARC_LOX10: - { - bfd_vma x; - - relocation += rel->r_addend; - relocation = (relocation & 0x3ff) | 0x1c00; - - x = bfd_get_32 (input_bfd, contents + rel->r_offset); - x = (x & ~(bfd_vma) 0x1fff) | relocation; - bfd_put_32 (input_bfd, x, contents + rel->r_offset); - - r = bfd_reloc_ok; - } - break; - - case R_SPARC_WDISP30: - do_wplt30: - if (sec_do_relax (input_section) - && rel->r_offset + 4 < input_section->_raw_size) - { -#define G0 0 -#define O7 15 -#define XCC (2 << 20) -#define COND(x) (((x)&0xf)<<25) -#define CONDA COND(0x8) -#define INSN_BPA (F2(0,1) | CONDA | BPRED | XCC) -#define INSN_BA (F2(0,2) | CONDA) -#define INSN_OR F3(2, 0x2, 0) -#define INSN_NOP F2(0,4) - - bfd_vma x, y; - - /* If the instruction is a call with either: - restore - arithmetic instruction with rd == %o7 - where rs1 != %o7 and rs2 if it is register != %o7 - then we can optimize if the call destination is near - by changing the call into a branch always. */ - x = bfd_get_32 (input_bfd, contents + rel->r_offset); - y = bfd_get_32 (input_bfd, contents + rel->r_offset + 4); - if ((x & OP(~0)) == OP(1) && (y & OP(~0)) == OP(2)) - { - if (((y & OP3(~0)) == OP3(0x3d) /* restore */ - || ((y & OP3(0x28)) == 0 /* arithmetic */ - && (y & RD(~0)) == RD(O7))) - && (y & RS1(~0)) != RS1(O7) - && ((y & F3I(~0)) - || (y & RS2(~0)) != RS2(O7))) - { - bfd_vma reloc; - - reloc = relocation + rel->r_addend - rel->r_offset; - reloc -= (input_section->output_section->vma - + input_section->output_offset); - if (reloc & 3) - goto do_default; - - /* Ensure the branch fits into simm22. */ - if ((reloc & ~(bfd_vma)0x7fffff) - && ((reloc | 0x7fffff) != MINUS_ONE)) - goto do_default; - reloc >>= 2; - - /* Check whether it fits into simm19. */ - if ((reloc & 0x3c0000) == 0 - || (reloc & 0x3c0000) == 0x3c0000) - x = INSN_BPA | (reloc & 0x7ffff); /* ba,pt %xcc */ - else - x = INSN_BA | (reloc & 0x3fffff); /* ba */ - bfd_put_32 (input_bfd, x, contents + rel->r_offset); - r = bfd_reloc_ok; - if (rel->r_offset >= 4 - && (y & (0xffffffff ^ RS1(~0))) - == (INSN_OR | RD(O7) | RS2(G0))) - { - bfd_vma z; - unsigned int reg; - - z = bfd_get_32 (input_bfd, - contents + rel->r_offset - 4); - if ((z & (0xffffffff ^ RD(~0))) - != (INSN_OR | RS1(O7) | RS2(G0))) - break; - - /* The sequence was - or %o7, %g0, %rN - call foo - or %rN, %g0, %o7 - - If call foo was replaced with ba, replace - or %rN, %g0, %o7 with nop. */ - - reg = (y & RS1(~0)) >> 14; - if (reg != ((z & RD(~0)) >> 25) - || reg == G0 || reg == O7) - break; - - bfd_put_32 (input_bfd, (bfd_vma) INSN_NOP, - contents + rel->r_offset + 4); - } - break; - } - } - } - /* Fall through. */ - - default: - do_default: - r = _bfd_final_link_relocate (howto, input_bfd, input_section, - contents, rel->r_offset, - relocation, rel->r_addend); - break; - } - - /* Dynamic relocs are not propagated for SEC_DEBUGGING sections - because such sections are not SEC_ALLOC and thus ld.so will - not process them. */ - if (unresolved_reloc - && !((input_section->flags & SEC_DEBUGGING) != 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0)) - (*_bfd_error_handler) - (_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"), - bfd_archive_filename (input_bfd), - bfd_get_section_name (input_bfd, input_section), - (long) rel->r_offset, - h->root.root.string); - - switch (r) - { - case bfd_reloc_ok: - break; - - default: - case bfd_reloc_outofrange: - abort (); - - case bfd_reloc_overflow: - { - const char *name; - - /* The Solaris native linker silently disregards - overflows. We don't, but this breaks stabs debugging - info, whose relocations are only 32-bits wide. Ignore - overflows in this case and also for discarded entries. */ - if ((r_type == R_SPARC_32 || r_type == R_SPARC_DISP32) - && (((input_section->flags & SEC_DEBUGGING) != 0 - && strcmp (bfd_section_name (input_bfd, input_section), - ".stab") == 0) - || _bfd_elf_section_offset (output_bfd, info, - input_section, - rel->r_offset) == (bfd_vma)-1)) - break; - - if (h != NULL) - { - if (h->root.type == bfd_link_hash_undefweak - && howto->pc_relative) - { - /* Assume this is a call protected by other code that - detect the symbol is undefined. If this is the case, - we can safely ignore the overflow. If not, the - program is hosed anyway, and a little warning isn't - going to help. */ - break; - } - - name = h->root.root.string; - } - else - { - name = (bfd_elf_string_from_elf_section - (input_bfd, - symtab_hdr->sh_link, - sym->st_name)); - if (name == NULL) - return FALSE; - if (*name == '\0') - name = bfd_section_name (input_bfd, sec); - } - if (! ((*info->callbacks->reloc_overflow) - (info, name, howto->name, (bfd_vma) 0, - input_bfd, input_section, rel->r_offset))) - return FALSE; - } - break; - } - } - - return TRUE; -} - -/* Finish up dynamic symbol handling. We set the contents of various - dynamic sections here. */ - -static bfd_boolean -sparc64_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; - - dynobj = elf_hash_table (info)->dynobj; - - if (h->plt.offset != (bfd_vma) -1) - { - asection *splt; - asection *srela; - Elf_Internal_Rela rela; - bfd_byte *loc; - - /* This symbol has an entry in the PLT. Set it up. */ - - BFD_ASSERT (h->dynindx != -1); - - splt = bfd_get_section_by_name (dynobj, ".plt"); - srela = bfd_get_section_by_name (dynobj, ".rela.plt"); - BFD_ASSERT (splt != NULL && srela != NULL); - - /* Fill in the entry in the .rela.plt section. */ - - if (h->plt.offset < LARGE_PLT_THRESHOLD) - { - rela.r_offset = sparc64_elf_plt_entry_offset (h->plt.offset); - rela.r_addend = 0; - } - else - { - bfd_vma max = splt->_raw_size / PLT_ENTRY_SIZE; - rela.r_offset = sparc64_elf_plt_ptr_offset (h->plt.offset, max); - rela.r_addend = -(sparc64_elf_plt_entry_offset (h->plt.offset) + 4) - -(splt->output_section->vma + splt->output_offset); - } - rela.r_offset += (splt->output_section->vma + splt->output_offset); - rela.r_info = ELF64_R_INFO (h->dynindx, R_SPARC_JMP_SLOT); - - /* Adjust for the first 4 reserved elements in the .plt section - when setting the offset in the .rela.plt section. - Sun forgot to read their own ABI and copied elf32-sparc behaviour, - thus .plt[4] has corresponding .rela.plt[0] and so on. */ - - loc = srela->contents; - loc += (h->plt.offset - 4) * sizeof (Elf64_External_Rela); - bfd_elf64_swap_reloca_out (output_bfd, &rela, loc); - - if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) - { - /* Mark the symbol as undefined, rather than as defined in - the .plt section. Leave the value alone. */ - sym->st_shndx = SHN_UNDEF; - /* If the symbol is weak, we do need to clear the value. - Otherwise, the PLT entry would provide a definition for - the symbol even if the symbol wasn't defined anywhere, - and so the symbol would never be NULL. */ - if ((h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR_NONWEAK) - == 0) - sym->st_value = 0; - } - } - - if (h->got.offset != (bfd_vma) -1) - { - asection *sgot; - asection *srela; - Elf_Internal_Rela rela; - bfd_byte *loc; - - /* This symbol has an entry in the GOT. Set it up. */ - - sgot = bfd_get_section_by_name (dynobj, ".got"); - srela = bfd_get_section_by_name (dynobj, ".rela.got"); - BFD_ASSERT (sgot != NULL && srela != NULL); - - rela.r_offset = (sgot->output_section->vma - + sgot->output_offset - + (h->got.offset &~ (bfd_vma) 1)); - - /* If this is a -Bsymbolic link, and the symbol is defined - locally, we just want to emit a RELATIVE reloc. Likewise if - the symbol was forced to be local because of a version file. - The entry in the global offset table will already have been - initialized in the relocate_section function. */ - if (info->shared - && (info->symbolic || h->dynindx == -1) - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)) - { - asection *sec = h->root.u.def.section; - rela.r_info = ELF64_R_INFO (0, R_SPARC_RELATIVE); - rela.r_addend = (h->root.u.def.value - + sec->output_section->vma - + sec->output_offset); - } - else - { - rela.r_info = ELF64_R_INFO (h->dynindx, R_SPARC_GLOB_DAT); - rela.r_addend = 0; - } - - bfd_put_64 (output_bfd, (bfd_vma) 0, - sgot->contents + (h->got.offset &~ (bfd_vma) 1)); - loc = srela->contents; - loc += srela->reloc_count++ * sizeof (Elf64_External_Rela); - bfd_elf64_swap_reloca_out (output_bfd, &rela, loc); - } - - if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0) - { - asection *s; - Elf_Internal_Rela rela; - bfd_byte *loc; - - /* This symbols needs a copy reloc. Set it up. */ - BFD_ASSERT (h->dynindx != -1); - - s = bfd_get_section_by_name (h->root.u.def.section->owner, - ".rela.bss"); - BFD_ASSERT (s != NULL); - - rela.r_offset = (h->root.u.def.value - + h->root.u.def.section->output_section->vma - + h->root.u.def.section->output_offset); - rela.r_info = ELF64_R_INFO (h->dynindx, R_SPARC_COPY); - rela.r_addend = 0; - loc = s->contents + s->reloc_count++ * sizeof (Elf64_External_Rela); - bfd_elf64_swap_reloca_out (output_bfd, &rela, loc); - } - - /* Mark some specially defined symbols as absolute. */ - if (strcmp (h->root.root.string, "_DYNAMIC") == 0 - || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0 - || strcmp (h->root.root.string, "_PROCEDURE_LINKAGE_TABLE_") == 0) - sym->st_shndx = SHN_ABS; - - return TRUE; -} - -/* Finish up the dynamic sections. */ - -static bfd_boolean -sparc64_elf_finish_dynamic_sections (output_bfd, info) - bfd *output_bfd; - struct bfd_link_info *info; -{ - bfd *dynobj; - int stt_regidx = -1; - asection *sdyn; - asection *sgot; - - dynobj = elf_hash_table (info)->dynobj; - - sdyn = bfd_get_section_by_name (dynobj, ".dynamic"); - - if (elf_hash_table (info)->dynamic_sections_created) - { - asection *splt; - Elf64_External_Dyn *dyncon, *dynconend; - - splt = bfd_get_section_by_name (dynobj, ".plt"); - BFD_ASSERT (splt != NULL && sdyn != NULL); - - dyncon = (Elf64_External_Dyn *) sdyn->contents; - dynconend = (Elf64_External_Dyn *) (sdyn->contents + sdyn->_raw_size); - for (; dyncon < dynconend; dyncon++) - { - Elf_Internal_Dyn dyn; - const char *name; - bfd_boolean size; - - bfd_elf64_swap_dyn_in (dynobj, dyncon, &dyn); - - switch (dyn.d_tag) - { - case DT_PLTGOT: name = ".plt"; size = FALSE; break; - case DT_PLTRELSZ: name = ".rela.plt"; size = TRUE; break; - case DT_JMPREL: name = ".rela.plt"; size = FALSE; break; - case DT_SPARC_REGISTER: - if (stt_regidx == -1) - { - stt_regidx = - _bfd_elf_link_lookup_local_dynindx (info, output_bfd, -1); - if (stt_regidx == -1) - return FALSE; - } - dyn.d_un.d_val = stt_regidx++; - bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon); - /* fallthrough */ - default: name = NULL; size = FALSE; break; - } - - if (name != NULL) - { - asection *s; - - s = bfd_get_section_by_name (output_bfd, name); - if (s == NULL) - dyn.d_un.d_val = 0; - else - { - if (! size) - dyn.d_un.d_ptr = s->vma; - else - { - if (s->_cooked_size != 0) - dyn.d_un.d_val = s->_cooked_size; - else - dyn.d_un.d_val = s->_raw_size; - } - } - bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon); - } - } - - /* Initialize the contents of the .plt section. */ - if (splt->_raw_size > 0) - sparc64_elf_build_plt (output_bfd, splt->contents, - (int) (splt->_raw_size / PLT_ENTRY_SIZE)); - - elf_section_data (splt->output_section)->this_hdr.sh_entsize = - PLT_ENTRY_SIZE; - } - - /* Set the first entry in the global offset table to the address of - the dynamic section. */ - sgot = bfd_get_section_by_name (dynobj, ".got"); - BFD_ASSERT (sgot != NULL); - if (sgot->_raw_size > 0) - { - if (sdyn == NULL) - bfd_put_64 (output_bfd, (bfd_vma) 0, sgot->contents); - else - bfd_put_64 (output_bfd, - sdyn->output_section->vma + sdyn->output_offset, - sgot->contents); - } - - elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 8; - - return TRUE; -} - -static enum elf_reloc_type_class -sparc64_elf_reloc_type_class (rela) - const Elf_Internal_Rela *rela; -{ - switch ((int) ELF64_R_TYPE (rela->r_info)) - { - case R_SPARC_RELATIVE: - return reloc_class_relative; - case R_SPARC_JMP_SLOT: - return reloc_class_plt; - case R_SPARC_COPY: - return reloc_class_copy; - default: - return reloc_class_normal; - } -} /* Functions for dealing with the e_flags field. */ @@ -2960,9 +626,7 @@ sparc64_elf_reloc_type_class (rela) object file when linking. */ static bfd_boolean -sparc64_elf_merge_private_bfd_data (ibfd, obfd) - bfd *ibfd; - bfd *obfd; +elf64_sparc_merge_private_bfd_data (bfd *ibfd, bfd *obfd) { bfd_boolean error; flagword new_flags, old_flags; @@ -3010,8 +674,8 @@ sparc64_elf_merge_private_bfd_data (ibfd, obfd) { error = TRUE; (*_bfd_error_handler) - (_("%s: linking UltraSPARC specific with HAL specific code"), - bfd_archive_filename (ibfd)); + (_("%B: linking UltraSPARC specific with HAL specific code"), + ibfd); } /* Choose the most restrictive memory ordering. */ old_mm = (old_flags & EF_SPARCV9_MM); @@ -3029,8 +693,8 @@ sparc64_elf_merge_private_bfd_data (ibfd, obfd) { error = TRUE; (*_bfd_error_handler) - (_("%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"), - bfd_archive_filename (ibfd), (long) new_flags, (long) old_flags); + (_("%B: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"), + ibfd, (long) new_flags, (long) old_flags); } elf_elfheader (obfd)->e_flags = old_flags; @@ -3047,10 +711,9 @@ sparc64_elf_merge_private_bfd_data (ibfd, obfd) /* MARCO: Set the correct entry size for the .stab section. */ static bfd_boolean -sparc64_elf_fake_sections (abfd, hdr, sec) - bfd *abfd ATTRIBUTE_UNUSED; - Elf_Internal_Shdr *hdr ATTRIBUTE_UNUSED; - asection *sec; +elf64_sparc_fake_sections (bfd *abfd ATTRIBUTE_UNUSED, + Elf_Internal_Shdr *hdr ATTRIBUTE_UNUSED, + asection *sec) { const char *name; @@ -3068,10 +731,8 @@ sparc64_elf_fake_sections (abfd, hdr, sec) /* Print a STT_REGISTER symbol to file FILE. */ static const char * -sparc64_elf_print_symbol_all (abfd, filep, symbol) - bfd *abfd ATTRIBUTE_UNUSED; - PTR filep; - asymbol *symbol; +elf64_sparc_print_symbol_all (bfd *abfd ATTRIBUTE_UNUSED, PTR filep, + asymbol *symbol) { FILE *file = (FILE *) filep; int reg, type; @@ -3093,19 +754,20 @@ sparc64_elf_print_symbol_all (abfd, filep, symbol) return symbol->name; } -/* Set the right machine number for a SPARC64 ELF file. */ - -static bfd_boolean -sparc64_elf_object_p (abfd) - bfd *abfd; +static enum elf_reloc_type_class +elf64_sparc_reloc_type_class (const Elf_Internal_Rela *rela) { - unsigned long mach = bfd_mach_sparc_v9; - - if (elf_elfheader (abfd)->e_flags & EF_SPARC_SUN_US3) - mach = bfd_mach_sparc_v9b; - else if (elf_elfheader (abfd)->e_flags & EF_SPARC_SUN_US1) - mach = bfd_mach_sparc_v9a; - return bfd_default_set_arch_mach (abfd, bfd_arch_sparc, mach); + switch ((int) ELF64_R_TYPE (rela->r_info)) + { + case R_SPARC_RELATIVE: + return reloc_class_relative; + case R_SPARC_JMP_SLOT: + return reloc_class_plt; + case R_SPARC_COPY: + return reloc_class_copy; + default: + return reloc_class_normal; + } } /* Relocations in the 64 bit SPARC ELF ABI are more complex than in @@ -3113,7 +775,7 @@ sparc64_elf_object_p (abfd) ELF64_R_TYPE_DATA field. This structure is used to redirect the relocation handling routines. */ -const struct elf_size_info sparc64_elf_size_info = +const struct elf_size_info elf64_sparc_size_info = { sizeof (Elf64_External_Ehdr), sizeof (Elf64_External_Phdr), @@ -3135,10 +797,10 @@ const struct elf_size_info sparc64_elf_size_info = EV_CURRENT, bfd_elf64_write_out_phdrs, bfd_elf64_write_shdrs_and_ehdr, - sparc64_elf_write_relocs, + elf64_sparc_write_relocs, bfd_elf64_swap_symbol_in, bfd_elf64_swap_symbol_out, - sparc64_elf_slurp_reloc_table, + elf64_sparc_slurp_reloc_table, bfd_elf64_slurp_symbol_table, bfd_elf64_swap_dyn_in, bfd_elf64_swap_dyn_out, @@ -3159,70 +821,83 @@ const struct elf_size_info sparc64_elf_size_info = /* This is the value that we used before the ABI was released. */ #define ELF_MACHINE_ALT1 EM_OLD_SPARCV9 -#define bfd_elf64_bfd_link_hash_table_create \ - sparc64_elf_bfd_link_hash_table_create - -#define elf_info_to_howto \ - sparc64_elf_info_to_howto +#define elf_backend_reloc_type_class \ + elf64_sparc_reloc_type_class #define bfd_elf64_get_reloc_upper_bound \ - sparc64_elf_get_reloc_upper_bound + elf64_sparc_get_reloc_upper_bound #define bfd_elf64_get_dynamic_reloc_upper_bound \ - sparc64_elf_get_dynamic_reloc_upper_bound + elf64_sparc_get_dynamic_reloc_upper_bound #define bfd_elf64_canonicalize_reloc \ - sparc64_elf_canonicalize_reloc + elf64_sparc_canonicalize_reloc #define bfd_elf64_canonicalize_dynamic_reloc \ - sparc64_elf_canonicalize_dynamic_reloc + elf64_sparc_canonicalize_dynamic_reloc +#define elf_backend_add_symbol_hook \ + elf64_sparc_add_symbol_hook +#define elf_backend_get_symbol_type \ + elf64_sparc_get_symbol_type +#define elf_backend_symbol_processing \ + elf64_sparc_symbol_processing +#define elf_backend_print_symbol_all \ + elf64_sparc_print_symbol_all +#define elf_backend_output_arch_syms \ + elf64_sparc_output_arch_syms +#define bfd_elf64_bfd_merge_private_bfd_data \ + elf64_sparc_merge_private_bfd_data +#define elf_backend_fake_sections \ + elf64_sparc_fake_sections +#define elf_backend_size_info \ + elf64_sparc_size_info + +#define elf_backend_plt_sym_val \ + _bfd_sparc_elf_plt_sym_val +#define bfd_elf64_bfd_link_hash_table_create \ + _bfd_sparc_elf_link_hash_table_create +#define elf_info_to_howto \ + _bfd_sparc_elf_info_to_howto +#define elf_backend_copy_indirect_symbol \ + _bfd_sparc_elf_copy_indirect_symbol #define bfd_elf64_bfd_reloc_type_lookup \ - sparc64_elf_reloc_type_lookup + _bfd_sparc_elf_reloc_type_lookup #define bfd_elf64_bfd_relax_section \ - sparc64_elf_relax_section + _bfd_sparc_elf_relax_section #define bfd_elf64_new_section_hook \ - sparc64_elf_new_section_hook + _bfd_sparc_elf_new_section_hook #define elf_backend_create_dynamic_sections \ - _bfd_elf_create_dynamic_sections -#define elf_backend_add_symbol_hook \ - sparc64_elf_add_symbol_hook -#define elf_backend_get_symbol_type \ - sparc64_elf_get_symbol_type -#define elf_backend_symbol_processing \ - sparc64_elf_symbol_processing + _bfd_sparc_elf_create_dynamic_sections #define elf_backend_check_relocs \ - sparc64_elf_check_relocs + _bfd_sparc_elf_check_relocs #define elf_backend_adjust_dynamic_symbol \ - sparc64_elf_adjust_dynamic_symbol + _bfd_sparc_elf_adjust_dynamic_symbol +#define elf_backend_omit_section_dynsym \ + _bfd_sparc_elf_omit_section_dynsym #define elf_backend_size_dynamic_sections \ - sparc64_elf_size_dynamic_sections + _bfd_sparc_elf_size_dynamic_sections #define elf_backend_relocate_section \ - sparc64_elf_relocate_section + _bfd_sparc_elf_relocate_section #define elf_backend_finish_dynamic_symbol \ - sparc64_elf_finish_dynamic_symbol + _bfd_sparc_elf_finish_dynamic_symbol #define elf_backend_finish_dynamic_sections \ - sparc64_elf_finish_dynamic_sections -#define elf_backend_print_symbol_all \ - sparc64_elf_print_symbol_all -#define elf_backend_output_arch_syms \ - sparc64_elf_output_arch_syms -#define bfd_elf64_bfd_merge_private_bfd_data \ - sparc64_elf_merge_private_bfd_data -#define elf_backend_fake_sections \ - sparc64_elf_fake_sections + _bfd_sparc_elf_finish_dynamic_sections -#define elf_backend_size_info \ - sparc64_elf_size_info +#define bfd_elf64_mkobject \ + _bfd_sparc_elf_mkobject #define elf_backend_object_p \ - sparc64_elf_object_p -#define elf_backend_reloc_type_class \ - sparc64_elf_reloc_type_class + _bfd_sparc_elf_object_p +#define elf_backend_gc_mark_hook \ + _bfd_sparc_elf_gc_mark_hook +#define elf_backend_gc_sweep_hook \ + _bfd_sparc_elf_gc_sweep_hook +#define elf_backend_can_gc_sections 1 +#define elf_backend_can_refcount 1 #define elf_backend_want_got_plt 0 #define elf_backend_plt_readonly 0 #define elf_backend_want_plt_sym 1 +#define elf_backend_got_header_size 8 #define elf_backend_rela_normal 1 /* Section 5.2.4 of the ABI specifies a 256-byte boundary for the table. */ #define elf_backend_plt_alignment 8 -#define elf_backend_got_header_size 8 - #include "elf64-target.h" diff --git a/contrib/binutils/bfd/elf64-x86-64.c b/contrib/binutils/bfd/elf64-x86-64.c index a1d62501f96..9befd69c5df 100644 --- a/contrib/binutils/bfd/elf64-x86-64.c +++ b/contrib/binutils/bfd/elf64-x86-64.c @@ -1,5 +1,6 @@ /* X86-64 specific support for 64-bit ELF - Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. Contributed by Jan Hubicka . This file is part of BFD, the Binary File Descriptor library. @@ -16,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" @@ -30,8 +31,8 @@ #define MINUS_ONE (~ (bfd_vma) 0) /* The relocation "howto" table. Order of fields: - type, size, bitsize, pc_relative, complain_on_overflow, - special_function, name, partial_inplace, src_mask, dst_pack, pcrel_offset. */ + type, rightshift, size, bitsize, pc_relative, bitpos, complain_on_overflow, + special_function, name, partial_inplace, src_mask, dst_mask, pcrel_offset. */ static reloc_howto_type x86_64_elf_howto_table[] = { HOWTO(R_X86_64_NONE, 0, 0, 0, FALSE, 0, complain_overflow_dont, @@ -74,7 +75,7 @@ static reloc_howto_type x86_64_elf_howto_table[] = bfd_elf_generic_reloc, "R_X86_64_16", FALSE, 0xffff, 0xffff, FALSE), HOWTO(R_X86_64_PC16,0, 1, 16, TRUE, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_X86_64_PC16", FALSE, 0xffff, 0xffff, TRUE), - HOWTO(R_X86_64_8, 0, 0, 8, FALSE, 0, complain_overflow_signed, + HOWTO(R_X86_64_8, 0, 0, 8, FALSE, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_X86_64_8", FALSE, 0xff, 0xff, FALSE), HOWTO(R_X86_64_PC8, 0, 0, 8, TRUE, 0, complain_overflow_signed, bfd_elf_generic_reloc, "R_X86_64_PC8", FALSE, 0xff, 0xff, TRUE), @@ -93,7 +94,7 @@ static reloc_howto_type x86_64_elf_howto_table[] = HOWTO(R_X86_64_TLSLD, 0, 2, 32, TRUE, 0, complain_overflow_signed, bfd_elf_generic_reloc, "R_X86_64_TLSLD", FALSE, 0xffffffff, 0xffffffff, TRUE), - HOWTO(R_X86_64_DTPOFF32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield, + HOWTO(R_X86_64_DTPOFF32, 0, 2, 32, FALSE, 0, complain_overflow_signed, bfd_elf_generic_reloc, "R_X86_64_DTPOFF32", FALSE, 0xffffffff, 0xffffffff, FALSE), HOWTO(R_X86_64_GOTTPOFF, 0, 2, 32, TRUE, 0, complain_overflow_signed, @@ -102,6 +103,51 @@ static reloc_howto_type x86_64_elf_howto_table[] = HOWTO(R_X86_64_TPOFF32, 0, 2, 32, FALSE, 0, complain_overflow_signed, bfd_elf_generic_reloc, "R_X86_64_TPOFF32", FALSE, 0xffffffff, 0xffffffff, FALSE), + HOWTO(R_X86_64_PC64, 0, 4, 64, TRUE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_X86_64_PC64", FALSE, MINUS_ONE, MINUS_ONE, + TRUE), + HOWTO(R_X86_64_GOTOFF64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_X86_64_GOTOFF64", + FALSE, MINUS_ONE, MINUS_ONE, FALSE), + HOWTO(R_X86_64_GOTPC32, 0, 2, 32, TRUE, 0, complain_overflow_signed, + bfd_elf_generic_reloc, "R_X86_64_GOTPC32", + FALSE, 0xffffffff, 0xffffffff, TRUE), + HOWTO(R_X86_64_GOT64, 0, 4, 64, FALSE, 0, complain_overflow_signed, + bfd_elf_generic_reloc, "R_X86_64_GOT64", FALSE, MINUS_ONE, MINUS_ONE, + FALSE), + HOWTO(R_X86_64_GOTPCREL64, 0, 4, 64, TRUE, 0, complain_overflow_signed, + bfd_elf_generic_reloc, "R_X86_64_GOTPCREL64", FALSE, MINUS_ONE, + MINUS_ONE, TRUE), + HOWTO(R_X86_64_GOTPC64, 0, 4, 64, TRUE, 0, complain_overflow_signed, + bfd_elf_generic_reloc, "R_X86_64_GOTPC64", + FALSE, MINUS_ONE, MINUS_ONE, TRUE), + HOWTO(R_X86_64_GOTPLT64, 0, 4, 64, FALSE, 0, complain_overflow_signed, + bfd_elf_generic_reloc, "R_X86_64_GOTPLT64", FALSE, MINUS_ONE, + MINUS_ONE, FALSE), + HOWTO(R_X86_64_PLTOFF64, 0, 4, 64, FALSE, 0, complain_overflow_signed, + bfd_elf_generic_reloc, "R_X86_64_PLTOFF64", FALSE, MINUS_ONE, + MINUS_ONE, FALSE), + EMPTY_HOWTO (32), + EMPTY_HOWTO (33), + HOWTO(R_X86_64_GOTPC32_TLSDESC, 0, 2, 32, TRUE, 0, + complain_overflow_bitfield, bfd_elf_generic_reloc, + "R_X86_64_GOTPC32_TLSDESC", + FALSE, 0xffffffff, 0xffffffff, TRUE), + HOWTO(R_X86_64_TLSDESC_CALL, 0, 0, 0, FALSE, 0, + complain_overflow_dont, bfd_elf_generic_reloc, + "R_X86_64_TLSDESC_CALL", + FALSE, 0, 0, FALSE), + HOWTO(R_X86_64_TLSDESC, 0, 4, 64, FALSE, 0, + complain_overflow_bitfield, bfd_elf_generic_reloc, + "R_X86_64_TLSDESC", + FALSE, MINUS_ONE, MINUS_ONE, FALSE), + + /* We have a gap in the reloc numbers here. + R_X86_64_standard counts the number up to this point, and + R_X86_64_vt_offset is the value to subtract from a reloc type of + R_X86_64_GNU_VT* to form an index into this table. */ +#define R_X86_64_standard (R_X86_64_TLSDESC + 1) +#define R_X86_64_vt_offset (R_X86_64_GNU_VTINHERIT - R_X86_64_standard) /* GNU extension to record C++ vtable hierarchy. */ HOWTO (R_X86_64_GNU_VTINHERIT, 0, 4, 0, FALSE, 0, complain_overflow_dont, @@ -146,14 +192,46 @@ static const struct elf_reloc_map x86_64_reloc_map[] = { BFD_RELOC_X86_64_DTPOFF32, R_X86_64_DTPOFF32, }, { BFD_RELOC_X86_64_GOTTPOFF, R_X86_64_GOTTPOFF, }, { BFD_RELOC_X86_64_TPOFF32, R_X86_64_TPOFF32, }, + { BFD_RELOC_64_PCREL, R_X86_64_PC64, }, + { BFD_RELOC_X86_64_GOTOFF64, R_X86_64_GOTOFF64, }, + { BFD_RELOC_X86_64_GOTPC32, R_X86_64_GOTPC32, }, + { BFD_RELOC_X86_64_GOT64, R_X86_64_GOT64, }, + { BFD_RELOC_X86_64_GOTPCREL64,R_X86_64_GOTPCREL64, }, + { BFD_RELOC_X86_64_GOTPC64, R_X86_64_GOTPC64, }, + { BFD_RELOC_X86_64_GOTPLT64, R_X86_64_GOTPLT64, }, + { BFD_RELOC_X86_64_PLTOFF64, R_X86_64_PLTOFF64, }, + { BFD_RELOC_X86_64_GOTPC32_TLSDESC, R_X86_64_GOTPC32_TLSDESC, }, + { BFD_RELOC_X86_64_TLSDESC_CALL, R_X86_64_TLSDESC_CALL, }, + { BFD_RELOC_X86_64_TLSDESC, R_X86_64_TLSDESC, }, { BFD_RELOC_VTABLE_INHERIT, R_X86_64_GNU_VTINHERIT, }, { BFD_RELOC_VTABLE_ENTRY, R_X86_64_GNU_VTENTRY, }, }; +static reloc_howto_type * +elf64_x86_64_rtype_to_howto (bfd *abfd, unsigned r_type) +{ + unsigned i; + + if (r_type < (unsigned int) R_X86_64_GNU_VTINHERIT + || r_type >= (unsigned int) R_X86_64_max) + { + if (r_type >= (unsigned int) R_X86_64_standard) + { + (*_bfd_error_handler) (_("%B: invalid relocation type %d"), + abfd, (int) r_type); + r_type = R_X86_64_NONE; + } + i = r_type; + } + else + i = r_type - (unsigned int) R_X86_64_vt_offset; + BFD_ASSERT (x86_64_elf_howto_table[i].type == r_type); + return &x86_64_elf_howto_table[i]; +} /* Given a BFD reloc type, return a HOWTO structure. */ static reloc_howto_type * -elf64_x86_64_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, +elf64_x86_64_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code) { unsigned int i; @@ -162,7 +240,8 @@ elf64_x86_64_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, i++) { if (x86_64_reloc_map[i].bfd_reloc_val == code) - return &x86_64_elf_howto_table[i]; + return elf64_x86_64_rtype_to_howto (abfd, + x86_64_reloc_map[i].elf_reloc_val); } return 0; } @@ -173,20 +252,10 @@ static void elf64_x86_64_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, arelent *cache_ptr, Elf_Internal_Rela *dst) { - unsigned r_type, i; + unsigned r_type; r_type = ELF64_R_TYPE (dst->r_info); - if (r_type < (unsigned int) R_X86_64_GNU_VTINHERIT) - { - BFD_ASSERT (r_type <= (unsigned int) R_X86_64_TPOFF32); - i = r_type; - } - else - { - BFD_ASSERT (r_type < (unsigned int) R_X86_64_max); - i = r_type - ((unsigned int) R_X86_64_GNU_VTINHERIT - R_X86_64_TPOFF32 - 1); - } - cache_ptr->howto = &x86_64_elf_howto_table[i]; + cache_ptr->howto = elf64_x86_64_rtype_to_howto (abfd, r_type); BFD_ASSERT (r_type == cache_ptr->howto->type); } @@ -195,7 +264,7 @@ static bfd_boolean elf64_x86_64_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) { int offset; - size_t raw_size; + size_t size; switch (note->descsz) { @@ -213,14 +282,14 @@ elf64_x86_64_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) /* pr_reg */ offset = 112; - raw_size = 216; + size = 216; break; } /* Make a ".reg/999" section. */ return _bfd_elfcore_make_pseudosection (abfd, ".reg", - raw_size, note->descpos + offset); + size, note->descpos + offset); } static bfd_boolean @@ -330,7 +399,20 @@ struct elf64_x86_64_link_hash_entry #define GOT_NORMAL 1 #define GOT_TLS_GD 2 #define GOT_TLS_IE 3 +#define GOT_TLS_GDESC 4 +#define GOT_TLS_GD_BOTH_P(type) \ + ((type) == (GOT_TLS_GD | GOT_TLS_GDESC)) +#define GOT_TLS_GD_P(type) \ + ((type) == GOT_TLS_GD || GOT_TLS_GD_BOTH_P (type)) +#define GOT_TLS_GDESC_P(type) \ + ((type) == GOT_TLS_GDESC || GOT_TLS_GD_BOTH_P (type)) +#define GOT_TLS_GD_ANY_P(type) \ + (GOT_TLS_GD_P (type) || GOT_TLS_GDESC_P (type)) unsigned char tls_type; + + /* Offset of the GOTPLT entry reserved for the TLS descriptor, + starting at the end of the jump table. */ + bfd_vma tlsdesc_got; }; #define elf64_x86_64_hash_entry(ent) \ @@ -342,6 +424,9 @@ struct elf64_x86_64_obj_tdata /* tls_type for each local got entry. */ char *local_got_tls_type; + + /* GOTPLT entries for TLS descriptors. */ + bfd_vma *local_tlsdesc_gotent; }; #define elf64_x86_64_tdata(abfd) \ @@ -350,6 +435,8 @@ struct elf64_x86_64_obj_tdata #define elf64_x86_64_local_got_tls_type(abfd) \ (elf64_x86_64_tdata (abfd)->local_got_tls_type) +#define elf64_x86_64_local_tlsdesc_gotent(abfd) \ + (elf64_x86_64_tdata (abfd)->local_tlsdesc_gotent) /* x86-64 ELF linker hash table. */ @@ -366,11 +453,23 @@ struct elf64_x86_64_link_hash_table asection *sdynbss; asection *srelbss; + /* The offset into splt of the PLT entry for the TLS descriptor + resolver. Special values are 0, if not necessary (or not found + to be necessary yet), and -1 if needed but not determined + yet. */ + bfd_vma tlsdesc_plt; + /* The offset into sgot of the GOT entry used by the PLT entry + above. */ + bfd_vma tlsdesc_got; + union { bfd_signed_vma refcount; bfd_vma offset; } tls_ld_got; + /* The amount of space used by the jump slots in the GOT. */ + bfd_vma sgotplt_jump_table_size; + /* Small local sym to section mapping cache. */ struct sym_sec_cache sym_sec; }; @@ -380,6 +479,9 @@ struct elf64_x86_64_link_hash_table #define elf64_x86_64_hash_table(p) \ ((struct elf64_x86_64_link_hash_table *) ((p)->hash)) +#define elf64_x86_64_compute_jump_table_size(htab) \ + ((htab)->srelplt->reloc_count * GOT_ENTRY_SIZE) + /* Create an entry in an x86-64 ELF linker hash table. */ static struct bfd_hash_entry * @@ -405,6 +507,7 @@ link_hash_newfunc (struct bfd_hash_entry *entry, struct bfd_hash_table *table, eh = (struct elf64_x86_64_link_hash_entry *) entry; eh->dyn_relocs = NULL; eh->tls_type = GOT_UNKNOWN; + eh->tlsdesc_got = (bfd_vma) -1; } return entry; @@ -422,7 +525,8 @@ elf64_x86_64_link_hash_table_create (bfd *abfd) if (ret == NULL) return NULL; - if (! _bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc)) + if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc, + sizeof (struct elf64_x86_64_link_hash_entry))) { free (ret); return NULL; @@ -436,7 +540,10 @@ elf64_x86_64_link_hash_table_create (bfd *abfd) ret->sdynbss = NULL; ret->srelbss = NULL; ret->sym_sec.abfd = NULL; + ret->tlsdesc_plt = 0; + ret->tlsdesc_got = 0; ret->tls_ld_got.refcount = 0; + ret->sgotplt_jump_table_size = 0; return &ret->elf.root; } @@ -458,12 +565,13 @@ create_got_section (bfd *dynobj, struct bfd_link_info *info) if (!htab->sgot || !htab->sgotplt) abort (); - htab->srelgot = bfd_make_section (dynobj, ".rela.got"); + htab->srelgot = bfd_make_section_with_flags (dynobj, ".rela.got", + (SEC_ALLOC | SEC_LOAD + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_LINKER_CREATED + | SEC_READONLY)); if (htab->srelgot == NULL - || ! bfd_set_section_flags (dynobj, htab->srelgot, - (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS - | SEC_IN_MEMORY | SEC_LINKER_CREATED - | SEC_READONLY)) || ! bfd_set_section_alignment (dynobj, htab->srelgot, 3)) return FALSE; return TRUE; @@ -501,7 +609,7 @@ elf64_x86_64_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info) /* Copy the extra info we tack onto an elf_link_hash_entry. */ static void -elf64_x86_64_copy_indirect_symbol (const struct elf_backend_data *bed, +elf64_x86_64_copy_indirect_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *dir, struct elf_link_hash_entry *ind) { @@ -517,10 +625,7 @@ elf64_x86_64_copy_indirect_symbol (const struct elf_backend_data *bed, struct elf64_x86_64_dyn_relocs **pp; struct elf64_x86_64_dyn_relocs *p; - if (ind->root.type == bfd_link_hash_indirect) - abort (); - - /* Add reloc counts against the weak sym to the strong sym + /* Add reloc counts against the indirect sym to the direct sym list. Merge any entries against the same section. */ for (pp = &eind->dyn_relocs; (p = *pp) != NULL; ) { @@ -553,17 +658,19 @@ elf64_x86_64_copy_indirect_symbol (const struct elf_backend_data *bed, if (ELIMINATE_COPY_RELOCS && ind->root.type != bfd_link_hash_indirect - && (dir->elf_link_hash_flags & ELF_LINK_HASH_DYNAMIC_ADJUSTED) != 0) - /* If called to transfer flags for a weakdef during processing - of elf_adjust_dynamic_symbol, don't copy ELF_LINK_NON_GOT_REF. - We clear it ourselves for ELIMINATE_COPY_RELOCS. */ - dir->elf_link_hash_flags |= - (ind->elf_link_hash_flags & (ELF_LINK_HASH_REF_DYNAMIC - | ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_REF_REGULAR_NONWEAK - | ELF_LINK_HASH_NEEDS_PLT)); + && dir->dynamic_adjusted) + { + /* If called to transfer flags for a weakdef during processing + of elf_adjust_dynamic_symbol, don't copy non_got_ref. + We clear it ourselves for ELIMINATE_COPY_RELOCS. */ + dir->ref_dynamic |= ind->ref_dynamic; + dir->ref_regular |= ind->ref_regular; + dir->ref_regular_nonweak |= ind->ref_regular_nonweak; + dir->needs_plt |= ind->needs_plt; + dir->pointer_equality_needed |= ind->pointer_equality_needed; + } else - _bfd_elf_link_hash_copy_indirect (bed, dir, ind); + _bfd_elf_link_hash_copy_indirect (info, dir, ind); } static bfd_boolean @@ -593,6 +700,8 @@ elf64_x86_64_tls_transition (struct bfd_link_info *info, int r_type, int is_loca switch (r_type) { case R_X86_64_TLSGD: + case R_X86_64_GOTPC32_TLSDESC: + case R_X86_64_TLSDESC_CALL: case R_X86_64_GOTTPOFF: if (is_local) return R_X86_64_TPOFF32; @@ -640,16 +749,20 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, if (r_symndx >= NUM_SHDR_ENTRIES (symtab_hdr)) { - (*_bfd_error_handler) (_("%s: bad symbol index: %d"), - bfd_archive_filename (abfd), - r_symndx); + (*_bfd_error_handler) (_("%B: bad symbol index: %d"), + abfd, r_symndx); return FALSE; } if (r_symndx < symtab_hdr->sh_info) h = NULL; else - h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + { + 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; + } r_type = elf64_x86_64_tls_transition (info, r_type, h == NULL); switch (r_type) @@ -662,9 +775,10 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, if (info->shared) { (*_bfd_error_handler) - (_("%s: relocation %s can not be used when making a shared object; recompile with -fPIC"), - bfd_archive_filename (abfd), - x86_64_elf_howto_table[r_type].name); + (_("%B: relocation %s against `%s' can not be used when making a shared object; recompile with -fPIC"), + abfd, + x86_64_elf_howto_table[r_type].name, + (h) ? h->root.root.string : "a local symbol"); bfd_set_error (bfd_error_bad_value); return FALSE; } @@ -678,6 +792,11 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, case R_X86_64_GOT32: case R_X86_64_GOTPCREL: case R_X86_64_TLSGD: + case R_X86_64_GOT64: + case R_X86_64_GOTPCREL64: + case R_X86_64_GOTPLT64: + case R_X86_64_GOTPC32_TLSDESC: + case R_X86_64_TLSDESC_CALL: /* This symbol requires a global offset table entry. */ { int tls_type, old_tls_type; @@ -687,10 +806,21 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, default: tls_type = GOT_NORMAL; break; case R_X86_64_TLSGD: tls_type = GOT_TLS_GD; break; case R_X86_64_GOTTPOFF: tls_type = GOT_TLS_IE; break; + case R_X86_64_GOTPC32_TLSDESC: + case R_X86_64_TLSDESC_CALL: + tls_type = GOT_TLS_GDESC; break; } if (h != NULL) { + if (r_type == R_X86_64_GOTPLT64) + { + /* This relocation indicates that we also need + a PLT entry, as this is a function. We don't need + a PLT entry for local symbols. */ + h->needs_plt = 1; + h->plt.refcount += 1; + } h->got.refcount += 1; old_tls_type = elf64_x86_64_hash_entry (h)->tls_type; } @@ -705,14 +835,17 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, bfd_size_type size; size = symtab_hdr->sh_info; - size *= sizeof (bfd_signed_vma) + sizeof (char); + size *= sizeof (bfd_signed_vma) + + sizeof (bfd_vma) + sizeof (char); local_got_refcounts = ((bfd_signed_vma *) bfd_zalloc (abfd, size)); if (local_got_refcounts == NULL) return FALSE; elf_local_got_refcounts (abfd) = local_got_refcounts; + elf64_x86_64_local_tlsdesc_gotent (abfd) + = (bfd_vma *) (local_got_refcounts + symtab_hdr->sh_info); elf64_x86_64_local_got_tls_type (abfd) - = (char *) (local_got_refcounts + symtab_hdr->sh_info); + = (char *) (local_got_refcounts + 2 * symtab_hdr->sh_info); } local_got_refcounts[r_symndx] += 1; old_tls_type @@ -722,16 +855,19 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, /* If a TLS symbol is accessed using IE at least once, there is no point to use dynamic model for it. */ if (old_tls_type != tls_type && old_tls_type != GOT_UNKNOWN - && (old_tls_type != GOT_TLS_GD || tls_type != GOT_TLS_IE)) + && (! GOT_TLS_GD_ANY_P (old_tls_type) + || tls_type != GOT_TLS_IE)) { - if (old_tls_type == GOT_TLS_IE && tls_type == GOT_TLS_GD) + if (old_tls_type == GOT_TLS_IE && GOT_TLS_GD_ANY_P (tls_type)) tls_type = old_tls_type; + else if (GOT_TLS_GD_ANY_P (old_tls_type) + && GOT_TLS_GD_ANY_P (tls_type)) + tls_type |= old_tls_type; else { (*_bfd_error_handler) - (_("%s: %s' accessed both as normal and thread local symbol"), - bfd_archive_filename (abfd), - h ? h->root.root.string : ""); + (_("%B: %s' accessed both as normal and thread local symbol"), + abfd, h ? h->root.root.string : ""); return FALSE; } } @@ -746,7 +882,9 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, } /* Fall through */ - //case R_X86_64_GOTPCREL: + case R_X86_64_GOTOFF64: + case R_X86_64_GOTPC32: + case R_X86_64_GOTPC64: create_got: if (htab->sgot == NULL) { @@ -770,10 +908,20 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, if (h == NULL) continue; - h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; + h->needs_plt = 1; h->plt.refcount += 1; break; + case R_X86_64_PLTOFF64: + /* This tries to form the 'address' of a function relative + to GOT. For global symbols we need a PLT entry. */ + if (h != NULL) + { + h->needs_plt = 1; + h->plt.refcount += 1; + } + goto create_got; + case R_X86_64_8: case R_X86_64_16: case R_X86_64_32: @@ -787,9 +935,10 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, && (sec->flags & SEC_READONLY) != 0) { (*_bfd_error_handler) - (_("%s: relocation %s can not be used when making a shared object; recompile with -fPIC"), - bfd_archive_filename (abfd), - x86_64_elf_howto_table[r_type].name); + (_("%B: relocation %s against `%s' can not be used when making a shared object; recompile with -fPIC"), + abfd, + x86_64_elf_howto_table[r_type].name, + (h) ? h->root.root.string : "a local symbol"); bfd_set_error (bfd_error_bad_value); return FALSE; } @@ -798,6 +947,7 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, case R_X86_64_PC8: case R_X86_64_PC16: case R_X86_64_PC32: + case R_X86_64_PC64: case R_X86_64_64: if (h != NULL && !info->shared) { @@ -807,11 +957,13 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, sections have not yet been mapped to output sections. Tentatively set the flag for now, and correct in adjust_dynamic_symbol. */ - h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF; + h->non_got_ref = 1; /* We may need a .plt entry if the function this reloc refers to is in a shared lib. */ h->plt.refcount += 1; + if (r_type != R_X86_64_PC32 && r_type != R_X86_64_PC64) + h->pointer_equality_needed = 1; } /* If we are creating a shared library, and this is a reloc @@ -839,19 +991,18 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, && (sec->flags & SEC_ALLOC) != 0 && (((r_type != R_X86_64_PC8) && (r_type != R_X86_64_PC16) - && (r_type != R_X86_64_PC32)) + && (r_type != R_X86_64_PC32) + && (r_type != R_X86_64_PC64)) || (h != NULL && (! info->symbolic || h->root.type == bfd_link_hash_defweak - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0)))) + || !h->def_regular)))) || (ELIMINATE_COPY_RELOCS && !info->shared && (sec->flags & SEC_ALLOC) != 0 && h != NULL && (h->root.type == bfd_link_hash_defweak - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0))) + || !h->def_regular))) { struct elf64_x86_64_dyn_relocs *p; struct elf64_x86_64_dyn_relocs **head; @@ -876,8 +1027,8 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, name + 5) != 0) { (*_bfd_error_handler) - (_("%s: bad relocation section name `%s\'"), - bfd_archive_filename (abfd), name); + (_("%B: bad relocation section name `%s\'"), + abfd, name); } if (htab->elf.dynobj == NULL) @@ -890,13 +1041,14 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, { flagword flags; - sreloc = bfd_make_section (dynobj, name); flags = (SEC_HAS_CONTENTS | SEC_READONLY | SEC_IN_MEMORY | SEC_LINKER_CREATED); if ((sec->flags & SEC_ALLOC) != 0) flags |= SEC_ALLOC | SEC_LOAD; + sreloc = bfd_make_section_with_flags (dynobj, + name, + flags); if (sreloc == NULL - || ! bfd_set_section_flags (dynobj, sreloc, flags) || ! bfd_set_section_alignment (dynobj, sreloc, 3)) return FALSE; } @@ -911,6 +1063,7 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, } else { + void **vpp; /* Track dynamic relocs needed for local syms too. We really need local syms available to do this easily. Oh well. */ @@ -921,8 +1074,10 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, if (s == NULL) return FALSE; - head = ((struct elf64_x86_64_dyn_relocs **) - &elf_section_data (s)->local_dynrel); + /* Beware of type punned pointers vs strict aliasing + rules. */ + vpp = &(elf_section_data (s)->local_dynrel); + head = (struct elf64_x86_64_dyn_relocs **)vpp; } p = *head; @@ -943,7 +1098,8 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, p->count += 1; if (r_type == R_X86_64_PC8 || r_type == R_X86_64_PC16 - || r_type == R_X86_64_PC32) + || r_type == R_X86_64_PC32 + || r_type == R_X86_64_PC64) p->pc_count += 1; } break; @@ -1041,6 +1197,9 @@ elf64_x86_64_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info, struct elf64_x86_64_dyn_relocs *p; 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; eh = (struct elf64_x86_64_link_hash_entry *) h; for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next) @@ -1062,11 +1221,18 @@ elf64_x86_64_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info, break; case R_X86_64_TLSGD: + case R_X86_64_GOTPC32_TLSDESC: + case R_X86_64_TLSDESC_CALL: case R_X86_64_GOTTPOFF: case R_X86_64_GOT32: case R_X86_64_GOTPCREL: + case R_X86_64_GOT64: + case R_X86_64_GOTPCREL64: + case R_X86_64_GOTPLT64: if (h != NULL) { + if (r_type == R_X86_64_GOTPLT64 && h->plt.refcount > 0) + h->plt.refcount -= 1; if (h->got.refcount > 0) h->got.refcount -= 1; } @@ -1085,11 +1251,13 @@ elf64_x86_64_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info, case R_X86_64_PC8: case R_X86_64_PC16: case R_X86_64_PC32: + case R_X86_64_PC64: if (info->shared) break; /* Fall thru */ case R_X86_64_PLT32: + case R_X86_64_PLTOFF64: if (h != NULL) { if (h->plt.refcount > 0) @@ -1123,7 +1291,7 @@ elf64_x86_64_adjust_dynamic_symbol (struct bfd_link_info *info, will fill in the contents of the procedure linkage table later, when we know the address of the .got section. */ if (h->type == STT_FUNC - || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0) + || h->needs_plt) { if (h->plt.refcount <= 0 || SYMBOL_CALLS_LOCAL (info, h) @@ -1136,7 +1304,7 @@ elf64_x86_64_adjust_dynamic_symbol (struct bfd_link_info *info, such a case, we don't actually need to build a procedure linkage table, and we can just do a PC32 reloc instead. */ h->plt.offset = (bfd_vma) -1; - h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; + h->needs_plt = 0; } return TRUE; @@ -1152,16 +1320,14 @@ elf64_x86_64_adjust_dynamic_symbol (struct bfd_link_info *info, /* 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) + if (h->u.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; + BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined + || h->u.weakdef->root.type == bfd_link_hash_defweak); + h->root.u.def.section = h->u.weakdef->root.u.def.section; + h->root.u.def.value = h->u.weakdef->root.u.def.value; if (ELIMINATE_COPY_RELOCS || info->nocopyreloc) - h->elf_link_hash_flags - = ((h->elf_link_hash_flags & ~ELF_LINK_NON_GOT_REF) - | (h->weakdef->elf_link_hash_flags & ELF_LINK_NON_GOT_REF)); + h->non_got_ref = h->u.weakdef->non_got_ref; return TRUE; } @@ -1177,13 +1343,13 @@ elf64_x86_64_adjust_dynamic_symbol (struct bfd_link_info *info, /* If there are no references to this symbol that do not use the GOT, we don't need to generate a copy reloc. */ - if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0) + if (!h->non_got_ref) return TRUE; /* If -z nocopyreloc was given, we won't generate them either. */ if (info->nocopyreloc) { - h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF; + h->non_got_ref = 0; return TRUE; } @@ -1204,11 +1370,18 @@ elf64_x86_64_adjust_dynamic_symbol (struct bfd_link_info *info, we'll be keeping the dynamic relocs and avoiding the copy reloc. */ if (p == NULL) { - h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF; + h->non_got_ref = 0; return TRUE; } } + if (h->size == 0) + { + (*_bfd_error_handler) (_("dynamic variable `%s' is zero size"), + h->root.root.string); + return TRUE; + } + /* We must allocate the symbol in our .dynbss section, which will become part of the .bss section of the executable. There will be an entry for this symbol in the .dynsym section. The dynamic @@ -1226,8 +1399,8 @@ elf64_x86_64_adjust_dynamic_symbol (struct bfd_link_info *info, runtime process image. */ if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) { - htab->srelbss->_raw_size += sizeof (Elf64_External_Rela); - h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY; + htab->srelbss->size += sizeof (Elf64_External_Rela); + h->needs_copy = 1; } /* We need to figure out the alignment required for this symbol. I @@ -1241,7 +1414,7 @@ elf64_x86_64_adjust_dynamic_symbol (struct bfd_link_info *info, /* Apply the required alignment. */ s = htab->sdynbss; - s->_raw_size = BFD_ALIGN (s->_raw_size, (bfd_size_type) (1 << power_of_two)); + s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two)); if (power_of_two > bfd_get_section_alignment (htab->elf.dynobj, s)) { if (! bfd_set_section_alignment (htab->elf.dynobj, s, power_of_two)) @@ -1250,10 +1423,10 @@ elf64_x86_64_adjust_dynamic_symbol (struct bfd_link_info *info, /* Define the symbol as being at this point in the section. */ h->root.u.def.section = s; - h->root.u.def.value = s->_raw_size; + h->root.u.def.value = s->size; /* Increment the section size to make room for the symbol. */ - s->_raw_size += h->size; + s->size += h->size; return TRUE; } @@ -1284,7 +1457,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) /* Make sure this symbol is output as a dynamic symbol. Undefined weak syms won't yet be marked as dynamic. */ if (h->dynindx == -1 - && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) + && !h->forced_local) { if (! bfd_elf_link_record_dynamic_symbol (info, h)) return FALSE; @@ -1297,10 +1470,10 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) /* If this is the first .plt entry, make room for the special first entry. */ - if (s->_raw_size == 0) - s->_raw_size += PLT_ENTRY_SIZE; + if (s->size == 0) + s->size += PLT_ENTRY_SIZE; - h->plt.offset = s->_raw_size; + h->plt.offset = s->size; /* If this symbol is not defined in a regular file, and we are not generating a shared library, then set the symbol to this @@ -1308,34 +1481,38 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) pointers compare as equal between the normal executable and the shared library. */ if (! info->shared - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + && !h->def_regular) { h->root.u.def.section = s; h->root.u.def.value = h->plt.offset; } /* Make room for this entry. */ - s->_raw_size += PLT_ENTRY_SIZE; + s->size += PLT_ENTRY_SIZE; /* We also need to make an entry in the .got.plt section, which will be placed in the .got section by the linker script. */ - htab->sgotplt->_raw_size += GOT_ENTRY_SIZE; + htab->sgotplt->size += GOT_ENTRY_SIZE; /* We also need to make an entry in the .rela.plt section. */ - htab->srelplt->_raw_size += sizeof (Elf64_External_Rela); + htab->srelplt->size += sizeof (Elf64_External_Rela); + htab->srelplt->reloc_count++; } else { h->plt.offset = (bfd_vma) -1; - h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; + h->needs_plt = 0; } } else { h->plt.offset = (bfd_vma) -1; - h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; + h->needs_plt = 0; } + eh = (struct elf64_x86_64_link_hash_entry *) h; + eh->tlsdesc_got = (bfd_vma) -1; + /* If R_X86_64_GOTTPOFF symbol is now local to the binary, make it a R_X86_64_TPOFF32 requiring no GOT entry. */ if (h->got.refcount > 0 @@ -1352,37 +1529,52 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) /* Make sure this symbol is output as a dynamic symbol. Undefined weak syms won't yet be marked as dynamic. */ if (h->dynindx == -1 - && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) + && !h->forced_local) { if (! bfd_elf_link_record_dynamic_symbol (info, h)) return FALSE; } - s = htab->sgot; - h->got.offset = s->_raw_size; - s->_raw_size += GOT_ENTRY_SIZE; - /* R_X86_64_TLSGD needs 2 consecutive GOT slots. */ - if (tls_type == GOT_TLS_GD) - s->_raw_size += GOT_ENTRY_SIZE; + if (GOT_TLS_GDESC_P (tls_type)) + { + eh->tlsdesc_got = htab->sgotplt->size + - elf64_x86_64_compute_jump_table_size (htab); + htab->sgotplt->size += 2 * GOT_ENTRY_SIZE; + h->got.offset = (bfd_vma) -2; + } + if (! GOT_TLS_GDESC_P (tls_type) + || GOT_TLS_GD_P (tls_type)) + { + s = htab->sgot; + h->got.offset = s->size; + s->size += GOT_ENTRY_SIZE; + if (GOT_TLS_GD_P (tls_type)) + s->size += GOT_ENTRY_SIZE; + } dyn = htab->elf.dynamic_sections_created; /* R_X86_64_TLSGD needs one dynamic relocation if local symbol and two if global. R_X86_64_GOTTPOFF needs one dynamic relocation. */ - if ((tls_type == GOT_TLS_GD && h->dynindx == -1) + if ((GOT_TLS_GD_P (tls_type) && h->dynindx == -1) || tls_type == GOT_TLS_IE) - htab->srelgot->_raw_size += sizeof (Elf64_External_Rela); - else if (tls_type == GOT_TLS_GD) - htab->srelgot->_raw_size += 2 * sizeof (Elf64_External_Rela); - else if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT - || h->root.type != bfd_link_hash_undefweak) + htab->srelgot->size += sizeof (Elf64_External_Rela); + else if (GOT_TLS_GD_P (tls_type)) + htab->srelgot->size += 2 * sizeof (Elf64_External_Rela); + else if (! GOT_TLS_GDESC_P (tls_type) + && (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT + || h->root.type != bfd_link_hash_undefweak) && (info->shared || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h))) - htab->srelgot->_raw_size += sizeof (Elf64_External_Rela); + htab->srelgot->size += sizeof (Elf64_External_Rela); + if (GOT_TLS_GDESC_P (tls_type)) + { + htab->srelplt->size += sizeof (Elf64_External_Rela); + htab->tlsdesc_plt = (bfd_vma) -1; + } } else h->got.offset = (bfd_vma) -1; - eh = (struct elf64_x86_64_link_hash_entry *) h; if (eh->dyn_relocs == NULL) return TRUE; @@ -1417,9 +1609,21 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) /* Also discard relocs on undefined weak syms with non-default visibility. */ - if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT + if (eh->dyn_relocs != NULL && h->root.type == bfd_link_hash_undefweak) - eh->dyn_relocs = NULL; + { + if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT) + eh->dyn_relocs = NULL; + + /* Make sure undefined weak symbols are output as a dynamic + symbol in PIEs. */ + else if (h->dynindx == -1 + && !h->forced_local) + { + if (! bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } + } } else if (ELIMINATE_COPY_RELOCS) { @@ -1427,9 +1631,9 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) symbols which turn out to need copy relocs or are not dynamic. */ - if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0 - && (((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + if (!h->non_got_ref + && ((h->def_dynamic + && !h->def_regular) || (htab->elf.dynamic_sections_created && (h->root.type == bfd_link_hash_undefweak || h->root.type == bfd_link_hash_undefined)))) @@ -1437,7 +1641,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) /* Make sure this symbol is output as a dynamic symbol. Undefined weak syms won't yet be marked as dynamic. */ if (h->dynindx == -1 - && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) + && !h->forced_local) { if (! bfd_elf_link_record_dynamic_symbol (info, h)) return FALSE; @@ -1458,7 +1662,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) for (p = eh->dyn_relocs; p != NULL; p = p->next) { asection *sreloc = elf_section_data (p->sec)->sreloc; - sreloc->_raw_size += p->count * sizeof (Elf64_External_Rela); + sreloc->size += p->count * sizeof (Elf64_External_Rela); } return TRUE; @@ -1518,7 +1722,7 @@ elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, s = bfd_get_section_by_name (dynobj, ".interp"); if (s == NULL) abort (); - s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER; + s->size = sizeof ELF_DYNAMIC_INTERPRETER; s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER; } } @@ -1530,6 +1734,7 @@ elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, bfd_signed_vma *local_got; bfd_signed_vma *end_local_got; char *local_tls_type; + bfd_vma *local_tlsdesc_gotent; bfd_size_type locsymcount; Elf_Internal_Shdr *symtab_hdr; asection *srel; @@ -1541,8 +1746,8 @@ elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, { struct elf64_x86_64_dyn_relocs *p; - for (p = *((struct elf64_x86_64_dyn_relocs **) - &elf_section_data (s)->local_dynrel); + for (p = (struct elf64_x86_64_dyn_relocs *) + (elf_section_data (s)->local_dynrel); p != NULL; p = p->next) { @@ -1557,7 +1762,7 @@ elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, else if (p->count != 0) { srel = elf_section_data (p->sec)->sreloc; - srel->_raw_size += p->count * sizeof (Elf64_External_Rela); + srel->size += p->count * sizeof (Elf64_External_Rela); if ((p->sec->output_section->flags & SEC_READONLY) != 0) info->flags |= DF_TEXTREL; @@ -1573,20 +1778,43 @@ elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, locsymcount = symtab_hdr->sh_info; end_local_got = local_got + locsymcount; local_tls_type = elf64_x86_64_local_got_tls_type (ibfd); + local_tlsdesc_gotent = elf64_x86_64_local_tlsdesc_gotent (ibfd); s = htab->sgot; srel = htab->srelgot; - for (; local_got < end_local_got; ++local_got, ++local_tls_type) + for (; local_got < end_local_got; + ++local_got, ++local_tls_type, ++local_tlsdesc_gotent) { + *local_tlsdesc_gotent = (bfd_vma) -1; if (*local_got > 0) { - *local_got = s->_raw_size; - s->_raw_size += GOT_ENTRY_SIZE; - if (*local_tls_type == GOT_TLS_GD) - s->_raw_size += GOT_ENTRY_SIZE; + if (GOT_TLS_GDESC_P (*local_tls_type)) + { + *local_tlsdesc_gotent = htab->sgotplt->size + - elf64_x86_64_compute_jump_table_size (htab); + htab->sgotplt->size += 2 * GOT_ENTRY_SIZE; + *local_got = (bfd_vma) -2; + } + if (! GOT_TLS_GDESC_P (*local_tls_type) + || GOT_TLS_GD_P (*local_tls_type)) + { + *local_got = s->size; + s->size += GOT_ENTRY_SIZE; + if (GOT_TLS_GD_P (*local_tls_type)) + s->size += GOT_ENTRY_SIZE; + } if (info->shared - || *local_tls_type == GOT_TLS_GD + || GOT_TLS_GD_ANY_P (*local_tls_type) || *local_tls_type == GOT_TLS_IE) - srel->_raw_size += sizeof (Elf64_External_Rela); + { + if (GOT_TLS_GDESC_P (*local_tls_type)) + { + htab->srelplt->size += sizeof (Elf64_External_Rela); + htab->tlsdesc_plt = (bfd_vma) -1; + } + if (! GOT_TLS_GDESC_P (*local_tls_type) + || GOT_TLS_GD_P (*local_tls_type)) + srel->size += sizeof (Elf64_External_Rela); + } } else *local_got = (bfd_vma) -1; @@ -1597,9 +1825,9 @@ elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, { /* Allocate 2 got entries and 1 dynamic reloc for R_X86_64_TLSLD relocs. */ - htab->tls_ld_got.offset = htab->sgot->_raw_size; - htab->sgot->_raw_size += 2 * GOT_ENTRY_SIZE; - htab->srelgot->_raw_size += sizeof (Elf64_External_Rela); + htab->tls_ld_got.offset = htab->sgot->size; + htab->sgot->size += 2 * GOT_ENTRY_SIZE; + htab->srelgot->size += sizeof (Elf64_External_Rela); } else htab->tls_ld_got.offset = -1; @@ -1608,6 +1836,34 @@ elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, sym dynamic relocs. */ elf_link_hash_traverse (&htab->elf, allocate_dynrelocs, (PTR) info); + /* For every jump slot reserved in the sgotplt, reloc_count is + incremented. However, when we reserve space for TLS descriptors, + it's not incremented, so in order to compute the space reserved + for them, it suffices to multiply the reloc count by the jump + slot size. */ + if (htab->srelplt) + htab->sgotplt_jump_table_size + = elf64_x86_64_compute_jump_table_size (htab); + + if (htab->tlsdesc_plt) + { + /* If we're not using lazy TLS relocations, don't generate the + PLT and GOT entries they require. */ + if ((info->flags & DF_BIND_NOW)) + htab->tlsdesc_plt = 0; + else + { + htab->tlsdesc_got = htab->sgot->size; + htab->sgot->size += GOT_ENTRY_SIZE; + /* Reserve room for the initial entry. + FIXME: we could probably do away with it in this case. */ + if (htab->splt->size == 0) + htab->splt->size += PLT_ENTRY_SIZE; + htab->tlsdesc_plt = htab->splt->size; + htab->splt->size += PLT_ENTRY_SIZE; + } + } + /* We now have determined the sizes of the various dynamic sections. Allocate memory for them. */ relocs = FALSE; @@ -1618,19 +1874,21 @@ elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, if (s == htab->splt || s == htab->sgot - || s == htab->sgotplt) + || s == htab->sgotplt + || s == htab->sdynbss) { /* Strip this section if we don't need it; see the comment below. */ } else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0) { - if (s->_raw_size != 0 && s != htab->srelplt) + if (s->size != 0 && s != htab->srelplt) relocs = TRUE; /* We use the reloc_count field as a counter if we need to copy relocs into the output file. */ - s->reloc_count = 0; + if (s != htab->srelplt) + s->reloc_count = 0; } else { @@ -1638,7 +1896,7 @@ elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, continue; } - if (s->_raw_size == 0) + if (s->size == 0) { /* If we don't need this section, strip it from the output file. This is mostly to handle .rela.bss and @@ -1650,16 +1908,19 @@ elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, function which decides whether anything needs to go into these sections. */ - _bfd_strip_section_from_output (info, s); + s->flags |= SEC_EXCLUDE; continue; } + if ((s->flags & SEC_HAS_CONTENTS) == 0) + continue; + /* Allocate memory for the section contents. We use bfd_zalloc here in case unused entries are not reclaimed before the section's contents are written out. This should not happen, but this way if it does, we get a R_X86_64_NONE reloc instead of garbage. */ - s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size); + s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->size); if (s->contents == NULL) return FALSE; } @@ -1680,13 +1941,18 @@ elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, return FALSE; } - if (htab->splt->_raw_size != 0) + if (htab->splt->size != 0) { if (!add_dynamic_entry (DT_PLTGOT, 0) || !add_dynamic_entry (DT_PLTRELSZ, 0) || !add_dynamic_entry (DT_PLTREL, DT_RELA) || !add_dynamic_entry (DT_JMPREL, 0)) return FALSE; + + if (htab->tlsdesc_plt + && (!add_dynamic_entry (DT_TLSDESC_PLT, 0) + || !add_dynamic_entry (DT_TLSDESC_GOT, 0))) + return FALSE; } if (relocs) @@ -1714,6 +1980,41 @@ elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, return TRUE; } +static bfd_boolean +elf64_x86_64_always_size_sections (bfd *output_bfd, + struct bfd_link_info *info) +{ + asection *tls_sec = elf_hash_table (info)->tls_sec; + + if (tls_sec) + { + struct elf_link_hash_entry *tlsbase; + + tlsbase = elf_link_hash_lookup (elf_hash_table (info), + "_TLS_MODULE_BASE_", + FALSE, FALSE, FALSE); + + if (tlsbase && tlsbase->type == STT_TLS) + { + struct bfd_link_hash_entry *bh = NULL; + const struct elf_backend_data *bed + = get_elf_backend_data (output_bfd); + + if (!(_bfd_generic_link_add_one_symbol + (info, output_bfd, "_TLS_MODULE_BASE_", BSF_LOCAL, + tls_sec, 0, NULL, FALSE, + bed->collect, &bh))) + return FALSE; + tlsbase = (struct elf_link_hash_entry *)bh; + tlsbase->def_regular = 1; + tlsbase->other = STV_HIDDEN; + (*bed->elf_backend_hide_symbol) (info, tlsbase, TRUE); + } + } + + return TRUE; +} + /* Return the base VMA address which should be subtracted from real addresses when resolving @dtpoff relocation. This is PT_TLS segment p_vaddr. */ @@ -1741,6 +2042,24 @@ tpoff (struct bfd_link_info *info, bfd_vma address) return address - htab->tls_size - htab->tls_sec->vma; } +/* Is the instruction before OFFSET in CONTENTS a 32bit relative + branch? */ + +static bfd_boolean +is_32bit_relative_branch (bfd_byte *contents, bfd_vma offset) +{ + /* Opcode Instruction + 0xe8 call + 0xe9 jump + 0x0f 0x8x conditional jump */ + return ((offset > 0 + && (contents [offset - 1] == 0xe8 + || contents [offset - 1] == 0xe9)) + || (offset > 1 + && contents [offset - 2] == 0x0f + && (contents [offset - 1] & 0xf0) == 0x80)); +} + /* Relocate an x86_64 ELF section. */ static bfd_boolean @@ -1754,6 +2073,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, Elf_Internal_Shdr *symtab_hdr; struct elf_link_hash_entry **sym_hashes; bfd_vma *local_got_offsets; + bfd_vma *local_tlsdesc_gotents; Elf_Internal_Rela *rel; Elf_Internal_Rela *relend; @@ -1764,6 +2084,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; sym_hashes = elf_sym_hashes (input_bfd); local_got_offsets = elf_local_got_offsets (input_bfd); + local_tlsdesc_gotents = elf64_x86_64_local_tlsdesc_gotent (input_bfd); rel = relocs; relend = relocs + input_section->reloc_count; @@ -1775,7 +2096,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, struct elf_link_hash_entry *h; Elf_Internal_Sym *sym; asection *sec; - bfd_vma off; + bfd_vma off, offplt; bfd_vma relocation; bfd_boolean unresolved_reloc; bfd_reloc_status_type r; @@ -1818,11 +2139,23 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, copied into the output file to be resolved at run time. */ switch (r_type) { + asection *base_got; case R_X86_64_GOT32: + case R_X86_64_GOT64: /* Relocation is to the entry for this symbol in the global offset table. */ case R_X86_64_GOTPCREL: - /* Use global offset table as symbol value. */ + case R_X86_64_GOTPCREL64: + /* Use global offset table entry as symbol value. */ + case R_X86_64_GOTPLT64: + /* This is the same as GOT64 for relocation purposes, but + indicates the existence of a PLT entry. The difficulty is, + that we must calculate the GOT slot offset from the PLT + offset, if this symbol got a PLT entry (it was global). + Additionally if it's computed from the PLT entry, then that + GOT offset is relative to .got.plt, not to .got. */ + base_got = htab->sgot; + if (htab->sgot == NULL) abort (); @@ -1831,6 +2164,19 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, bfd_boolean dyn; off = h->got.offset; + if (h->needs_plt + && h->plt.offset != (bfd_vma)-1 + && off == (bfd_vma)-1) + { + /* We can't use h->got.offset here to save + state, or even just remember the offset, as + finish_dynamic_symbol would use that as offset into + .got. */ + bfd_vma plt_index = h->plt.offset / PLT_ENTRY_SIZE - 1; + off = (plt_index + 3) * GOT_ENTRY_SIZE; + base_got = htab->sgotplt; + } + dyn = htab->elf.dynamic_sections_created; if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h) @@ -1855,7 +2201,9 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, else { bfd_put_64 (output_bfd, relocation, - htab->sgot->contents + off); + base_got->contents + off); + /* Note that this is harmless for the GOTPLT64 case, + as -1 | 1 still is -1. */ h->got.offset |= 1; } } @@ -1877,7 +2225,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, else { bfd_put_64 (output_bfd, relocation, - htab->sgot->contents + off); + base_got->contents + off); if (info->shared) { @@ -1891,8 +2239,8 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, if (s == NULL) abort (); - outrel.r_offset = (htab->sgot->output_section->vma - + htab->sgot->output_offset + outrel.r_offset = (base_got->output_section->vma + + base_got->output_offset + off); outrel.r_info = ELF64_R_INFO (0, R_X86_64_RELATIVE); outrel.r_addend = relocation; @@ -1908,12 +2256,69 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, if (off >= (bfd_vma) -2) abort (); - relocation = htab->sgot->output_offset + off; - if (r_type == R_X86_64_GOTPCREL) - relocation += htab->sgot->output_section->vma; + relocation = base_got->output_section->vma + + base_got->output_offset + off; + if (r_type != R_X86_64_GOTPCREL && r_type != R_X86_64_GOTPCREL64) + relocation -= htab->sgotplt->output_section->vma + - htab->sgotplt->output_offset; break; + case R_X86_64_GOTOFF64: + /* Relocation is relative to the start of the global offset + table. */ + + /* Check to make sure it isn't a protected function symbol + for shared library since it may not be local when used + as function address. */ + if (info->shared + && h + && h->def_regular + && h->type == STT_FUNC + && ELF_ST_VISIBILITY (h->other) == STV_PROTECTED) + { + (*_bfd_error_handler) + (_("%B: relocation R_X86_64_GOTOFF64 against protected function `%s' can not be used when making a shared object"), + input_bfd, h->root.root.string); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + + /* Note that sgot is not involved in this + calculation. We always want the start of .got.plt. If we + defined _GLOBAL_OFFSET_TABLE_ in a different way, as is + permitted by the ABI, we might have to change this + calculation. */ + relocation -= htab->sgotplt->output_section->vma + + htab->sgotplt->output_offset; + break; + + case R_X86_64_GOTPC32: + case R_X86_64_GOTPC64: + /* Use global offset table as symbol value. */ + relocation = htab->sgotplt->output_section->vma + + htab->sgotplt->output_offset; + unresolved_reloc = FALSE; + break; + + case R_X86_64_PLTOFF64: + /* Relocation is PLT entry relative to GOT. For local + symbols it's the symbol itself relative to GOT. */ + if (h != NULL + /* See PLT32 handling. */ + && h->plt.offset != (bfd_vma) -1 + && htab->splt != NULL) + { + relocation = (htab->splt->output_section->vma + + htab->splt->output_offset + + h->plt.offset); + unresolved_reloc = FALSE; + } + + relocation -= htab->sgotplt->output_section->vma + + htab->sgotplt->output_offset; + break; + case R_X86_64_PLT32: /* Relocation is to the entry for this symbol in the procedure linkage table. */ @@ -1941,9 +2346,38 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, case R_X86_64_PC8: case R_X86_64_PC16: case R_X86_64_PC32: + if (info->shared + && !SYMBOL_REFERENCES_LOCAL (info, h) + && (input_section->flags & SEC_ALLOC) != 0 + && (input_section->flags & SEC_READONLY) != 0 + && (!h->def_regular + || r_type != R_X86_64_PC32 + || h->type != STT_FUNC + || ELF_ST_VISIBILITY (h->other) != STV_PROTECTED + || !is_32bit_relative_branch (contents, + rel->r_offset))) + { + if (h->def_regular + && r_type == R_X86_64_PC32 + && h->type == STT_FUNC + && ELF_ST_VISIBILITY (h->other) == STV_PROTECTED) + (*_bfd_error_handler) + (_("%B: relocation R_X86_64_PC32 against protected function `%s' can not be used when making a shared object"), + input_bfd, h->root.root.string); + else + (*_bfd_error_handler) + (_("%B: relocation %s against `%s' can not be used when making a shared object; recompile with -fPIC"), + input_bfd, x86_64_elf_howto_table[r_type].name, + h->root.root.string); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + /* Fall through. */ + case R_X86_64_8: case R_X86_64_16: case R_X86_64_32: + case R_X86_64_PC64: case R_X86_64_64: /* FIXME: The ABI says the linker should make sure the value is the same when it's zeroextended to 64 bit. */ @@ -1961,17 +2395,16 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, || h->root.type != bfd_link_hash_undefweak) && ((r_type != R_X86_64_PC8 && r_type != R_X86_64_PC16 - && r_type != R_X86_64_PC32) + && r_type != R_X86_64_PC32 + && r_type != R_X86_64_PC64) || !SYMBOL_CALLS_LOCAL (info, h))) || (ELIMINATE_COPY_RELOCS && !info->shared && h != NULL && h->dynindx != -1 - && (h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0 - && (((h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - && (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0) + && !h->non_got_ref + && ((h->def_dynamic + && !h->def_regular) || h->root.type == bfd_link_hash_undefweak || h->root.type == bfd_link_hash_undefined))) { @@ -2007,10 +2440,10 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, && (r_type == R_X86_64_PC8 || r_type == R_X86_64_PC16 || r_type == R_X86_64_PC32 + || r_type == R_X86_64_PC64 || !info->shared || !info->symbolic - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0)) + || !h->def_regular)) { outrel.r_info = ELF64_R_INFO (h->dynindx, r_type); outrel.r_addend = rel->r_addend; @@ -2068,6 +2501,8 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, break; case R_X86_64_TLSGD: + case R_X86_64_GOTPC32_TLSDESC: + case R_X86_64_TLSDESC_CALL: case R_X86_64_GOTTPOFF: r_type = elf64_x86_64_tls_transition (info, r_type, h == NULL); tls_type = GOT_UNKNOWN; @@ -2079,7 +2514,9 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, if (!info->shared && h->dynindx == -1 && tls_type == GOT_TLS_IE) r_type = R_X86_64_TPOFF32; } - if (r_type == R_X86_64_TLSGD) + if (r_type == R_X86_64_TLSGD + || r_type == R_X86_64_GOTPC32_TLSDESC + || r_type == R_X86_64_TLSDESC_CALL) { if (tls_type == GOT_TLS_IE) r_type = R_X86_64_GOTTPOFF; @@ -2105,7 +2542,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, BFD_ASSERT (bfd_get_8 (input_bfd, contents + rel->r_offset - 4 + i) == tlsgd[i]); - BFD_ASSERT (rel->r_offset + 12 <= input_section->_raw_size); + BFD_ASSERT (rel->r_offset + 12 <= input_section->size); for (i = 0; i < 4; i++) BFD_ASSERT (bfd_get_8 (input_bfd, contents + rel->r_offset + 4 + i) @@ -2121,6 +2558,67 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, rel++; continue; } + else if (ELF64_R_TYPE (rel->r_info) == R_X86_64_GOTPC32_TLSDESC) + { + /* GDesc -> LE transition. + It's originally something like: + leaq x@tlsdesc(%rip), %rax + + Change it to: + movl $x@tpoff, %rax + + Registers other than %rax may be set up here. */ + + unsigned int val, type, type2; + bfd_vma roff; + + /* First, make sure it's a leaq adding rip to a + 32-bit offset into any register, although it's + probably almost always going to be rax. */ + roff = rel->r_offset; + BFD_ASSERT (roff >= 3); + type = bfd_get_8 (input_bfd, contents + roff - 3); + BFD_ASSERT ((type & 0xfb) == 0x48); + type2 = bfd_get_8 (input_bfd, contents + roff - 2); + BFD_ASSERT (type2 == 0x8d); + val = bfd_get_8 (input_bfd, contents + roff - 1); + BFD_ASSERT ((val & 0xc7) == 0x05); + BFD_ASSERT (roff + 4 <= input_section->size); + + /* Now modify the instruction as appropriate. */ + bfd_put_8 (output_bfd, 0x48 | ((type >> 2) & 1), + contents + roff - 3); + bfd_put_8 (output_bfd, 0xc7, contents + roff - 2); + bfd_put_8 (output_bfd, 0xc0 | ((val >> 3) & 7), + contents + roff - 1); + bfd_put_32 (output_bfd, tpoff (info, relocation), + contents + roff); + continue; + } + else if (ELF64_R_TYPE (rel->r_info) == R_X86_64_TLSDESC_CALL) + { + /* GDesc -> LE transition. + It's originally: + call *(%rax) + Turn it into: + nop; nop. */ + + unsigned int val, type; + bfd_vma roff; + + /* First, make sure it's a call *(%rax). */ + roff = rel->r_offset; + BFD_ASSERT (roff + 2 <= input_section->size); + type = bfd_get_8 (input_bfd, contents + roff); + BFD_ASSERT (type == 0xff); + val = bfd_get_8 (input_bfd, contents + roff + 1); + BFD_ASSERT (val == 0x10); + + /* Now modify the instruction as appropriate. */ + bfd_put_8 (output_bfd, 0x90, contents + roff); + bfd_put_8 (output_bfd, 0x90, contents + roff + 1); + continue; + } else { unsigned int val, type, reg; @@ -2141,7 +2639,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, reg = bfd_get_8 (input_bfd, contents + rel->r_offset - 1); BFD_ASSERT ((reg & 0xc7) == 5); reg >>= 3; - BFD_ASSERT (rel->r_offset + 4 <= input_section->_raw_size); + BFD_ASSERT (rel->r_offset + 4 <= input_section->size); if (type == 0x8b) { /* movq */ @@ -2186,13 +2684,17 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, abort (); if (h != NULL) - off = h->got.offset; + { + off = h->got.offset; + offplt = elf64_x86_64_hash_entry (h)->tlsdesc_got; + } else { if (local_got_offsets == NULL) abort (); off = local_got_offsets[r_symndx]; + offplt = local_tlsdesc_gotents[r_symndx]; } if ((off & 1) != 0) @@ -2202,30 +2704,61 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, Elf_Internal_Rela outrel; bfd_byte *loc; int dr_type, indx; + asection *sreloc; if (htab->srelgot == NULL) abort (); + indx = h && h->dynindx != -1 ? h->dynindx : 0; + + if (GOT_TLS_GDESC_P (tls_type)) + { + outrel.r_info = ELF64_R_INFO (indx, R_X86_64_TLSDESC); + BFD_ASSERT (htab->sgotplt_jump_table_size + offplt + + 2 * GOT_ENTRY_SIZE <= htab->sgotplt->size); + outrel.r_offset = (htab->sgotplt->output_section->vma + + htab->sgotplt->output_offset + + offplt + + htab->sgotplt_jump_table_size); + sreloc = htab->srelplt; + loc = sreloc->contents; + loc += sreloc->reloc_count++ + * sizeof (Elf64_External_Rela); + BFD_ASSERT (loc + sizeof (Elf64_External_Rela) + <= sreloc->contents + sreloc->size); + if (indx == 0) + outrel.r_addend = relocation - dtpoff_base (info); + else + outrel.r_addend = 0; + bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc); + } + + sreloc = htab->srelgot; + outrel.r_offset = (htab->sgot->output_section->vma + htab->sgot->output_offset + off); - indx = h && h->dynindx != -1 ? h->dynindx : 0; - if (r_type == R_X86_64_TLSGD) + if (GOT_TLS_GD_P (tls_type)) dr_type = R_X86_64_DTPMOD64; + else if (GOT_TLS_GDESC_P (tls_type)) + goto dr_done; else dr_type = R_X86_64_TPOFF64; bfd_put_64 (output_bfd, 0, htab->sgot->contents + off); outrel.r_addend = 0; - if (dr_type == R_X86_64_TPOFF64 && indx == 0) + if ((dr_type == R_X86_64_TPOFF64 + || dr_type == R_X86_64_TLSDESC) && indx == 0) outrel.r_addend = relocation - dtpoff_base (info); outrel.r_info = ELF64_R_INFO (indx, dr_type); - loc = htab->srelgot->contents; - loc += htab->srelgot->reloc_count++ * sizeof (Elf64_External_Rela); + loc = sreloc->contents; + loc += sreloc->reloc_count++ * sizeof (Elf64_External_Rela); + BFD_ASSERT (loc + sizeof (Elf64_External_Rela) + <= sreloc->contents + sreloc->size); bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc); - if (r_type == R_X86_64_TLSGD) + if (GOT_TLS_GD_P (tls_type)) { if (indx == 0) { @@ -2241,27 +2774,37 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, outrel.r_info = ELF64_R_INFO (indx, R_X86_64_DTPOFF64); outrel.r_offset += GOT_ENTRY_SIZE; - htab->srelgot->reloc_count++; + sreloc->reloc_count++; loc += sizeof (Elf64_External_Rela); + BFD_ASSERT (loc + sizeof (Elf64_External_Rela) + <= sreloc->contents + sreloc->size); bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc); } } + dr_done: if (h != NULL) h->got.offset |= 1; else local_got_offsets[r_symndx] |= 1; } - if (off >= (bfd_vma) -2) + if (off >= (bfd_vma) -2 + && ! GOT_TLS_GDESC_P (tls_type)) abort (); if (r_type == ELF64_R_TYPE (rel->r_info)) { - relocation = htab->sgot->output_section->vma - + htab->sgot->output_offset + off; + if (r_type == R_X86_64_GOTPC32_TLSDESC + || r_type == R_X86_64_TLSDESC_CALL) + relocation = htab->sgotplt->output_section->vma + + htab->sgotplt->output_offset + + offplt + htab->sgotplt_jump_table_size; + else + relocation = htab->sgot->output_section->vma + + htab->sgot->output_offset + off; unresolved_reloc = FALSE; } - else + else if (ELF64_R_TYPE (rel->r_info) == R_X86_64_TLSGD) { unsigned int i; static unsigned char tlsgd[8] @@ -2278,7 +2821,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, BFD_ASSERT (bfd_get_8 (input_bfd, contents + rel->r_offset - 4 + i) == tlsgd[i]); - BFD_ASSERT (rel->r_offset + 12 <= input_section->_raw_size); + BFD_ASSERT (rel->r_offset + 12 <= input_section->size); for (i = 0; i < 4; i++) BFD_ASSERT (bfd_get_8 (input_bfd, contents + rel->r_offset + 4 + i) @@ -2301,6 +2844,77 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, rel++; continue; } + else if (ELF64_R_TYPE (rel->r_info) == R_X86_64_GOTPC32_TLSDESC) + { + /* GDesc -> IE transition. + It's originally something like: + leaq x@tlsdesc(%rip), %rax + + Change it to: + movq x@gottpoff(%rip), %rax # before nop; nop + + Registers other than %rax may be set up here. */ + + unsigned int val, type, type2; + bfd_vma roff; + + /* First, make sure it's a leaq adding rip to a 32-bit + offset into any register, although it's probably + almost always going to be rax. */ + roff = rel->r_offset; + BFD_ASSERT (roff >= 3); + type = bfd_get_8 (input_bfd, contents + roff - 3); + BFD_ASSERT ((type & 0xfb) == 0x48); + type2 = bfd_get_8 (input_bfd, contents + roff - 2); + BFD_ASSERT (type2 == 0x8d); + val = bfd_get_8 (input_bfd, contents + roff - 1); + BFD_ASSERT ((val & 0xc7) == 0x05); + BFD_ASSERT (roff + 4 <= input_section->size); + + /* Now modify the instruction as appropriate. */ + /* To turn a leaq into a movq in the form we use it, it + suffices to change the second byte from 0x8d to + 0x8b. */ + bfd_put_8 (output_bfd, 0x8b, contents + roff - 2); + + bfd_put_32 (output_bfd, + htab->sgot->output_section->vma + + htab->sgot->output_offset + off + - rel->r_offset + - input_section->output_section->vma + - input_section->output_offset + - 4, + contents + roff); + continue; + } + else if (ELF64_R_TYPE (rel->r_info) == R_X86_64_TLSDESC_CALL) + { + /* GDesc -> IE transition. + It's originally: + call *(%rax) + + Change it to: + nop; nop. */ + + unsigned int val, type; + bfd_vma roff; + + /* First, make sure it's a call *(%eax). */ + roff = rel->r_offset; + BFD_ASSERT (roff + 2 <= input_section->size); + type = bfd_get_8 (input_bfd, contents + roff); + BFD_ASSERT (type == 0xff); + val = bfd_get_8 (input_bfd, contents + roff + 1); + BFD_ASSERT (val == 0x10); + + /* Now modify the instruction as appropriate. */ + bfd_put_8 (output_bfd, 0x90, contents + roff); + bfd_put_8 (output_bfd, 0x90, contents + roff + 1); + + continue; + } + else + BFD_ASSERT (FALSE); break; case R_X86_64_TLSLD: @@ -2318,7 +2932,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, == 0x8d); BFD_ASSERT (bfd_get_8 (input_bfd, contents + rel->r_offset - 1) == 0x3d); - BFD_ASSERT (rel->r_offset + 9 <= input_section->_raw_size); + BFD_ASSERT (rel->r_offset + 9 <= input_section->size); BFD_ASSERT (bfd_get_8 (input_bfd, contents + rel->r_offset + 4) == 0xe8); BFD_ASSERT (rel + 1 < relend); @@ -2384,12 +2998,13 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, not process them. */ if (unresolved_reloc && !((input_section->flags & SEC_DEBUGGING) != 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0)) + && h->def_dynamic)) (*_bfd_error_handler) - (_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"), - bfd_archive_filename (input_bfd), - bfd_get_section_name (input_bfd, input_section), + (_("%B(%A+0x%lx): unresolvable %s relocation against symbol `%s'"), + input_bfd, + input_section, (long) rel->r_offset, + howto->name, h->root.root.string); r = _bfd_final_link_relocate (howto, input_bfd, input_section, @@ -2415,18 +3030,23 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, if (r == bfd_reloc_overflow) { + if (h != NULL + && h->root.type == bfd_link_hash_undefweak + && howto->pc_relative) + /* Ignore reloc overflow on branches to undefweak syms. */ + continue; if (! ((*info->callbacks->reloc_overflow) - (info, name, howto->name, (bfd_vma) 0, - input_bfd, input_section, rel->r_offset))) + (info, (h ? &h->root : NULL), name, howto->name, + (bfd_vma) 0, input_bfd, input_section, + rel->r_offset))) return FALSE; } else { (*_bfd_error_handler) - (_("%s(%s+0x%lx): reloc against `%s': error %d"), - bfd_archive_filename (input_bfd), - bfd_get_section_name (input_bfd, input_section), + (_("%B(%A+0x%lx): reloc against `%s': error %d"), + input_bfd, input_section, (long) rel->r_offset, name, (int) r); return FALSE; } @@ -2516,19 +3136,24 @@ elf64_x86_64_finish_dynamic_symbol (bfd *output_bfd, loc = htab->srelplt->contents + plt_index * sizeof (Elf64_External_Rela); bfd_elf64_swap_reloca_out (output_bfd, &rela, loc); - if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + if (!h->def_regular) { /* Mark the symbol as undefined, rather than as defined in - the .plt section. Leave the value alone. This is a clue + the .plt section. Leave the value if there were any + relocations where pointer equality matters (this is a clue for the dynamic linker, to make function pointer comparisons work between an application and shared - library. */ + library), otherwise set it to zero. If a function is only + called from a binary, there is no need to slow down + shared libraries because of that. */ sym->st_shndx = SHN_UNDEF; + if (!h->pointer_equality_needed) + sym->st_value = 0; } } if (h->got.offset != (bfd_vma) -1 - && elf64_x86_64_hash_entry (h)->tls_type != GOT_TLS_GD + && ! GOT_TLS_GD_ANY_P (elf64_x86_64_hash_entry (h)->tls_type) && elf64_x86_64_hash_entry (h)->tls_type != GOT_TLS_IE) { Elf_Internal_Rela rela; @@ -2571,7 +3196,7 @@ elf64_x86_64_finish_dynamic_symbol (bfd *output_bfd, bfd_elf64_swap_reloca_out (output_bfd, &rela, loc); } - if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0) + if (h->needs_copy) { Elf_Internal_Rela rela; bfd_byte *loc; @@ -2596,7 +3221,7 @@ elf64_x86_64_finish_dynamic_symbol (bfd *output_bfd, /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */ if (strcmp (h->root.root.string, "_DYNAMIC") == 0 - || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0) + || h == htab->elf.hgot) sym->st_shndx = SHN_ABS; return TRUE; @@ -2642,7 +3267,7 @@ elf64_x86_64_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *inf abort (); dyncon = (Elf64_External_Dyn *) sdyn->contents; - dynconend = (Elf64_External_Dyn *) (sdyn->contents + sdyn->_raw_size); + dynconend = (Elf64_External_Dyn *) (sdyn->contents + sdyn->size); for (; dyncon < dynconend; dyncon++) { Elf_Internal_Dyn dyn; @@ -2656,7 +3281,8 @@ elf64_x86_64_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *inf continue; case DT_PLTGOT: - dyn.d_un.d_ptr = htab->sgot->output_section->vma; + s = htab->sgotplt; + dyn.d_un.d_ptr = s->output_section->vma + s->output_offset; break; case DT_JMPREL: @@ -2665,10 +3291,7 @@ elf64_x86_64_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *inf case DT_PLTRELSZ: s = htab->srelplt->output_section; - if (s->_cooked_size != 0) - dyn.d_un.d_val = s->_cooked_size; - else - dyn.d_un.d_val = s->_raw_size; + dyn.d_un.d_val = s->size; break; case DT_RELASZ: @@ -2682,19 +3305,28 @@ elf64_x86_64_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *inf if (htab->srelplt != NULL) { s = htab->srelplt->output_section; - if (s->_cooked_size != 0) - dyn.d_un.d_val -= s->_cooked_size; - else - dyn.d_un.d_val -= s->_raw_size; + dyn.d_un.d_val -= s->size; } break; + + case DT_TLSDESC_PLT: + s = htab->splt; + dyn.d_un.d_ptr = s->output_section->vma + s->output_offset + + htab->tlsdesc_plt; + break; + + case DT_TLSDESC_GOT: + s = htab->sgot; + dyn.d_un.d_ptr = s->output_section->vma + s->output_offset + + htab->tlsdesc_got; + break; } bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon); } /* Fill in the special first entry in the procedure linkage table. */ - if (htab->splt && htab->splt->_raw_size > 0) + if (htab->splt && htab->splt->size > 0) { /* Fill in the first entry in the procedure linkage table. */ memcpy (htab->splt->contents, elf64_x86_64_plt0_entry, @@ -2722,13 +3354,47 @@ elf64_x86_64_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *inf elf_section_data (htab->splt->output_section)->this_hdr.sh_entsize = PLT_ENTRY_SIZE; + + if (htab->tlsdesc_plt) + { + bfd_put_64 (output_bfd, (bfd_vma) 0, + htab->sgot->contents + htab->tlsdesc_got); + + memcpy (htab->splt->contents + htab->tlsdesc_plt, + elf64_x86_64_plt0_entry, + PLT_ENTRY_SIZE); + + /* Add offset for pushq GOT+8(%rip), since the + instruction uses 6 bytes subtract this value. */ + bfd_put_32 (output_bfd, + (htab->sgotplt->output_section->vma + + htab->sgotplt->output_offset + + 8 + - htab->splt->output_section->vma + - htab->splt->output_offset + - htab->tlsdesc_plt + - 6), + htab->splt->contents + htab->tlsdesc_plt + 2); + /* Add offset for jmp *GOT+TDG(%rip), where TGD stands for + htab->tlsdesc_got. The 12 is the offset to the end of + the instruction. */ + bfd_put_32 (output_bfd, + (htab->sgot->output_section->vma + + htab->sgot->output_offset + + htab->tlsdesc_got + - htab->splt->output_section->vma + - htab->splt->output_offset + - htab->tlsdesc_plt + - 12), + htab->splt->contents + htab->tlsdesc_plt + 8); + } } } if (htab->sgotplt) { /* Fill in the first three entries in the global offset table. */ - if (htab->sgotplt->_raw_size > 0) + if (htab->sgotplt->size > 0) { /* Set the first entry in the global offset table to the address of the dynamic section. */ @@ -2747,9 +3413,218 @@ elf64_x86_64_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *inf GOT_ENTRY_SIZE; } + if (htab->sgot && htab->sgot->size > 0) + elf_section_data (htab->sgot->output_section)->this_hdr.sh_entsize + = GOT_ENTRY_SIZE; + return TRUE; } +/* Return address for Ith PLT stub in section PLT, for relocation REL + or (bfd_vma) -1 if it should not be included. */ + +static bfd_vma +elf64_x86_64_plt_sym_val (bfd_vma i, const asection *plt, + const arelent *rel ATTRIBUTE_UNUSED) +{ + return plt->vma + (i + 1) * PLT_ENTRY_SIZE; +} + +/* Handle an x86-64 specific section when reading an object file. This + is called when elfcode.h finds a section with an unknown type. */ + +static bfd_boolean +elf64_x86_64_section_from_shdr (bfd *abfd, + Elf_Internal_Shdr *hdr, + const char *name, + int shindex) +{ + if (hdr->sh_type != SHT_X86_64_UNWIND) + return FALSE; + + if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex)) + return FALSE; + + return TRUE; +} + +/* Hook called by the linker routine which adds symbols from an object + file. We use it to put SHN_X86_64_LCOMMON items in .lbss, instead + of .bss. */ + +static bfd_boolean +elf64_x86_64_add_symbol_hook (bfd *abfd, + struct bfd_link_info *info ATTRIBUTE_UNUSED, + Elf_Internal_Sym *sym, + const char **namep ATTRIBUTE_UNUSED, + flagword *flagsp ATTRIBUTE_UNUSED, + asection **secp, bfd_vma *valp) +{ + asection *lcomm; + + switch (sym->st_shndx) + { + case SHN_X86_64_LCOMMON: + lcomm = bfd_get_section_by_name (abfd, "LARGE_COMMON"); + if (lcomm == NULL) + { + lcomm = bfd_make_section_with_flags (abfd, + "LARGE_COMMON", + (SEC_ALLOC + | SEC_IS_COMMON + | SEC_LINKER_CREATED)); + if (lcomm == NULL) + return FALSE; + elf_section_flags (lcomm) |= SHF_X86_64_LARGE; + } + *secp = lcomm; + *valp = sym->st_size; + break; + } + return TRUE; +} + + +/* Given a BFD section, try to locate the corresponding ELF section + index. */ + +static bfd_boolean +elf64_x86_64_elf_section_from_bfd_section (bfd *abfd ATTRIBUTE_UNUSED, + asection *sec, int *index) +{ + if (sec == &_bfd_elf_large_com_section) + { + *index = SHN_X86_64_LCOMMON; + return TRUE; + } + return FALSE; +} + +/* Process a symbol. */ + +static void +elf64_x86_64_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED, + asymbol *asym) +{ + elf_symbol_type *elfsym = (elf_symbol_type *) asym; + + switch (elfsym->internal_elf_sym.st_shndx) + { + case SHN_X86_64_LCOMMON: + asym->section = &_bfd_elf_large_com_section; + asym->value = elfsym->internal_elf_sym.st_size; + /* Common symbol doesn't set BSF_GLOBAL. */ + asym->flags &= ~BSF_GLOBAL; + break; + } +} + +static bfd_boolean +elf64_x86_64_common_definition (Elf_Internal_Sym *sym) +{ + return (sym->st_shndx == SHN_COMMON + || sym->st_shndx == SHN_X86_64_LCOMMON); +} + +static unsigned int +elf64_x86_64_common_section_index (asection *sec) +{ + if ((elf_section_flags (sec) & SHF_X86_64_LARGE) == 0) + return SHN_COMMON; + else + return SHN_X86_64_LCOMMON; +} + +static asection * +elf64_x86_64_common_section (asection *sec) +{ + if ((elf_section_flags (sec) & SHF_X86_64_LARGE) == 0) + return bfd_com_section_ptr; + else + return &_bfd_elf_large_com_section; +} + +static bfd_boolean +elf64_x86_64_merge_symbol (struct bfd_link_info *info ATTRIBUTE_UNUSED, + struct elf_link_hash_entry **sym_hash ATTRIBUTE_UNUSED, + struct elf_link_hash_entry *h, + Elf_Internal_Sym *sym, + asection **psec, + bfd_vma *pvalue ATTRIBUTE_UNUSED, + unsigned int *pold_alignment ATTRIBUTE_UNUSED, + bfd_boolean *skip ATTRIBUTE_UNUSED, + bfd_boolean *override ATTRIBUTE_UNUSED, + bfd_boolean *type_change_ok ATTRIBUTE_UNUSED, + bfd_boolean *size_change_ok ATTRIBUTE_UNUSED, + bfd_boolean *newdef ATTRIBUTE_UNUSED, + bfd_boolean *newdyn, + bfd_boolean *newdyncommon ATTRIBUTE_UNUSED, + bfd_boolean *newweak ATTRIBUTE_UNUSED, + bfd *abfd ATTRIBUTE_UNUSED, + asection **sec, + bfd_boolean *olddef ATTRIBUTE_UNUSED, + bfd_boolean *olddyn, + bfd_boolean *olddyncommon ATTRIBUTE_UNUSED, + bfd_boolean *oldweak ATTRIBUTE_UNUSED, + bfd *oldbfd, + asection **oldsec) +{ + /* A normal common symbol and a large common symbol result in a + normal common symbol. We turn the large common symbol into a + normal one. */ + if (!*olddyn + && h->root.type == bfd_link_hash_common + && !*newdyn + && bfd_is_com_section (*sec) + && *oldsec != *sec) + { + if (sym->st_shndx == SHN_COMMON + && (elf_section_flags (*oldsec) & SHF_X86_64_LARGE) != 0) + { + h->root.u.c.p->section + = bfd_make_section_old_way (oldbfd, "COMMON"); + h->root.u.c.p->section->flags = SEC_ALLOC; + } + else if (sym->st_shndx == SHN_X86_64_LCOMMON + && (elf_section_flags (*oldsec) & SHF_X86_64_LARGE) == 0) + *psec = *sec = bfd_com_section_ptr; + } + + return TRUE; +} + +static int +elf64_x86_64_additional_program_headers (bfd *abfd) +{ + asection *s; + int count = 0; + + /* Check to see if we need a large readonly segment. */ + s = bfd_get_section_by_name (abfd, ".lrodata"); + if (s && (s->flags & SEC_LOAD)) + count++; + + /* Check to see if we need a large data segment. Since .lbss sections + is placed right after the .bss section, there should be no need for + a large data segment just because of .lbss. */ + s = bfd_get_section_by_name (abfd, ".ldata"); + if (s && (s->flags & SEC_LOAD)) + count++; + + return count; +} + +static const struct bfd_elf_special_section + elf64_x86_64_special_sections[]= +{ + { ".gnu.linkonce.lb", 16, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_X86_64_LARGE}, + { ".gnu.linkonce.lr", 16, -2, SHT_PROGBITS, SHF_ALLOC + SHF_X86_64_LARGE}, + { ".gnu.linkonce.lt", 16, -2, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR + SHF_X86_64_LARGE}, + { ".lbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_X86_64_LARGE}, + { ".ldata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_X86_64_LARGE}, + { ".lrodata", 8, -2, SHT_PROGBITS, SHF_ALLOC + SHF_X86_64_LARGE}, + { NULL, 0, 0, 0, 0 } +}; #define TARGET_LITTLE_SYM bfd_elf64_x86_64_vec #define TARGET_LITTLE_NAME "elf64-x86-64" @@ -2784,7 +3659,31 @@ elf64_x86_64_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *inf #define elf_backend_reloc_type_class elf64_x86_64_reloc_type_class #define elf_backend_relocate_section elf64_x86_64_relocate_section #define elf_backend_size_dynamic_sections elf64_x86_64_size_dynamic_sections +#define elf_backend_always_size_sections elf64_x86_64_always_size_sections +#define elf_backend_plt_sym_val elf64_x86_64_plt_sym_val #define elf_backend_object_p elf64_x86_64_elf_object_p #define bfd_elf64_mkobject elf64_x86_64_mkobject +#define elf_backend_section_from_shdr \ + elf64_x86_64_section_from_shdr + +#define elf_backend_section_from_bfd_section \ + elf64_x86_64_elf_section_from_bfd_section +#define elf_backend_add_symbol_hook \ + elf64_x86_64_add_symbol_hook +#define elf_backend_symbol_processing \ + elf64_x86_64_symbol_processing +#define elf_backend_common_section_index \ + elf64_x86_64_common_section_index +#define elf_backend_common_section \ + elf64_x86_64_common_section +#define elf_backend_common_definition \ + elf64_x86_64_common_definition +#define elf_backend_merge_symbol \ + elf64_x86_64_merge_symbol +#define elf_backend_special_sections \ + elf64_x86_64_special_sections +#define elf_backend_additional_program_headers \ + elf64_x86_64_additional_program_headers + #include "elf64-target.h" diff --git a/contrib/binutils/bfd/elf64.c b/contrib/binutils/bfd/elf64.c index 69fb5b5e6e1..5058c0c1987 100644 --- a/contrib/binutils/bfd/elf64.c +++ b/contrib/binutils/bfd/elf64.c @@ -15,7 +15,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #define ARCH_SIZE 64 diff --git a/contrib/binutils/bfd/elfarm-nabi.c b/contrib/binutils/bfd/elfarm-nabi.c deleted file mode 100644 index 5ecbe8e3e62..00000000000 --- a/contrib/binutils/bfd/elfarm-nabi.c +++ /dev/null @@ -1,752 +0,0 @@ -/* 32-bit ELF support for ARM new abi option. - Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. - - This file is part of BFD, the Binary File Descriptor library. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include "elf/arm.h" -#include "bfd.h" -#include "sysdep.h" -#include "libbfd.h" -#include "elf-bfd.h" - -#ifndef NUM_ELEM -#define NUM_ELEM(a) (sizeof (a) / (sizeof (a)[0])) -#endif - -#define USE_REL 1 - -#define TARGET_LITTLE_SYM bfd_elf32_littlearm_vec -#define TARGET_LITTLE_NAME "elf32-littlearm" -#define TARGET_BIG_SYM bfd_elf32_bigarm_vec -#define TARGET_BIG_NAME "elf32-bigarm" - -#define elf_info_to_howto 0 -#define elf_info_to_howto_rel elf32_arm_info_to_howto - -#define ARM_ELF_ABI_VERSION 0 -#define ARM_ELF_OS_ABI_VERSION ELFOSABI_ARM - -static reloc_howto_type * elf32_arm_reloc_type_lookup - PARAMS ((bfd * abfd, bfd_reloc_code_real_type code)); -static bfd_boolean elf32_arm_nabi_grok_prstatus - PARAMS ((bfd *abfd, Elf_Internal_Note *note)); -static bfd_boolean elf32_arm_nabi_grok_psinfo - PARAMS ((bfd *abfd, Elf_Internal_Note *note)); - -/* Note: code such as elf32_arm_reloc_type_lookup expect to use e.g. - R_ARM_PC24 as an index into this, and find the R_ARM_PC24 HOWTO - in that slot. */ - -static reloc_howto_type elf32_arm_howto_table[] = -{ - /* No relocation */ - HOWTO (R_ARM_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_ARM_NONE", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_ARM_PC24, /* type */ - 2, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 24, /* bitsize */ - TRUE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed,/* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_ARM_PC24", /* name */ - FALSE, /* partial_inplace */ - 0x00ffffff, /* src_mask */ - 0x00ffffff, /* dst_mask */ - TRUE), /* pcrel_offset */ - - /* 32 bit absolute */ - HOWTO (R_ARM_ABS32, /* 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_ARM_ABS32", /* name */ - FALSE, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - FALSE), /* pcrel_offset */ - - /* standard 32bit pc-relative reloc */ - HOWTO (R_ARM_REL32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - TRUE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield,/* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_ARM_REL32", /* name */ - FALSE, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - TRUE), /* pcrel_offset */ - - /* 8 bit absolute */ - HOWTO (R_ARM_PC13, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield,/* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_ARM_PC13", /* name */ - FALSE, /* partial_inplace */ - 0x000000ff, /* src_mask */ - 0x000000ff, /* dst_mask */ - FALSE), /* pcrel_offset */ - - /* 16 bit absolute */ - HOWTO (R_ARM_ABS16, /* 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_ARM_ABS16", /* name */ - FALSE, /* partial_inplace */ - 0x0000ffff, /* src_mask */ - 0x0000ffff, /* dst_mask */ - FALSE), /* pcrel_offset */ - - /* 12 bit absolute */ - HOWTO (R_ARM_ABS12, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 12, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield,/* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_ARM_ABS12", /* name */ - FALSE, /* partial_inplace */ - 0x000008ff, /* src_mask */ - 0x000008ff, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_ARM_THM_ABS5, /* type */ - 6, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 5, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield,/* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_ARM_THM_ABS5", /* name */ - FALSE, /* partial_inplace */ - 0x000007e0, /* src_mask */ - 0x000007e0, /* dst_mask */ - FALSE), /* pcrel_offset */ - - /* 8 bit absolute */ - HOWTO (R_ARM_ABS8, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield,/* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_ARM_ABS8", /* name */ - FALSE, /* partial_inplace */ - 0x000000ff, /* src_mask */ - 0x000000ff, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_ARM_SBREL32, /* 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_ARM_SBREL32", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_ARM_THM_PC22, /* type */ - 1, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 23, /* bitsize */ - TRUE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed,/* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_ARM_THM_PC22", /* name */ - FALSE, /* partial_inplace */ - 0x07ff07ff, /* src_mask */ - 0x07ff07ff, /* dst_mask */ - TRUE), /* pcrel_offset */ - - HOWTO (R_ARM_THM_PC8, /* type */ - 1, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - TRUE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed,/* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_ARM_THM_PC8", /* name */ - FALSE, /* partial_inplace */ - 0x000000ff, /* src_mask */ - 0x000000ff, /* dst_mask */ - TRUE), /* pcrel_offset */ - - HOWTO (R_ARM_AMP_VCALL9, /* type */ - 1, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - TRUE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed,/* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_ARM_AMP_VCALL9", /* name */ - FALSE, /* partial_inplace */ - 0x000000ff, /* src_mask */ - 0x000000ff, /* dst_mask */ - TRUE), /* pcrel_offset */ - - HOWTO (R_ARM_SWI24, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed,/* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_ARM_SWI24", /* name */ - FALSE, /* partial_inplace */ - 0x00000000, /* src_mask */ - 0x00000000, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_ARM_THM_SWI8, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 0, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed,/* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_ARM_SWI8", /* name */ - FALSE, /* partial_inplace */ - 0x00000000, /* src_mask */ - 0x00000000, /* dst_mask */ - FALSE), /* pcrel_offset */ - - /* BLX instruction for the ARM. */ - HOWTO (R_ARM_XPC25, /* type */ - 2, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 25, /* bitsize */ - TRUE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed,/* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_ARM_XPC25", /* name */ - FALSE, /* partial_inplace */ - 0x00ffffff, /* src_mask */ - 0x00ffffff, /* dst_mask */ - TRUE), /* pcrel_offset */ - - /* BLX instruction for the Thumb. */ - HOWTO (R_ARM_THM_XPC22, /* type */ - 2, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 22, /* bitsize */ - TRUE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed,/* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_ARM_THM_XPC22", /* name */ - FALSE, /* partial_inplace */ - 0x07ff07ff, /* src_mask */ - 0x07ff07ff, /* dst_mask */ - TRUE), /* pcrel_offset */ - - /* These next three relocs are not defined, but we need to fill the space. */ - - HOWTO (R_ARM_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_ARM_unknown_17", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_ARM_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_ARM_unknown_18", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_ARM_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_ARM_unknown_19", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - FALSE), /* pcrel_offset */ - - /* Relocs used in ARM Linux */ - - HOWTO (R_ARM_COPY, /* 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_ARM_COPY", /* name */ - TRUE, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_ARM_GLOB_DAT, /* 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_ARM_GLOB_DAT", /* name */ - TRUE, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_ARM_JUMP_SLOT, /* 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_ARM_JUMP_SLOT", /* name */ - TRUE, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_ARM_RELATIVE, /* 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_ARM_RELATIVE", /* name */ - TRUE, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_ARM_GOTOFF, /* 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_ARM_GOTOFF", /* name */ - TRUE, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_ARM_GOTPC, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - TRUE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield,/* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_ARM_GOTPC", /* name */ - TRUE, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - TRUE), /* pcrel_offset */ - - HOWTO (R_ARM_GOT32, /* 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_ARM_GOT32", /* name */ - TRUE, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_ARM_PLT32, /* type */ - 2, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 26, /* bitsize */ - TRUE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield,/* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_ARM_PLT32", /* name */ - TRUE, /* partial_inplace */ - 0x00ffffff, /* src_mask */ - 0x00ffffff, /* dst_mask */ - TRUE), /* pcrel_offset */ - - /* End of relocs used in ARM Linux */ - - HOWTO (R_ARM_RREL32, /* 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_ARM_RREL32", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_ARM_RABS32, /* 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_ARM_RABS32", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_ARM_RPC24, /* 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_ARM_RPC24", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_ARM_RBASE, /* 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_ARM_RBASE", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - FALSE), /* pcrel_offset */ - -}; - - /* GNU extension to record C++ vtable hierarchy */ -static reloc_howto_type elf32_arm_vtinherit_howto = - HOWTO (R_ARM_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_ARM_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 elf32_arm_vtentry_howto = - HOWTO (R_ARM_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_ARM_GNU_VTENTRY", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - FALSE); /* pcrel_offset */ - - /* 12 bit pc relative */ -static reloc_howto_type elf32_arm_thm_pc11_howto = - HOWTO (R_ARM_THM_PC11, /* type */ - 1, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 11, /* bitsize */ - TRUE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_ARM_THM_PC11", /* name */ - FALSE, /* partial_inplace */ - 0x000007ff, /* src_mask */ - 0x000007ff, /* dst_mask */ - TRUE); /* pcrel_offset */ - - /* 12 bit pc relative */ -static reloc_howto_type elf32_arm_thm_pc9_howto = - HOWTO (R_ARM_THM_PC9, /* type */ - 1, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - TRUE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_ARM_THM_PC9", /* name */ - FALSE, /* partial_inplace */ - 0x000000ff, /* src_mask */ - 0x000000ff, /* dst_mask */ - TRUE); /* pcrel_offset */ - -static void elf32_arm_info_to_howto - PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); - -static void -elf32_arm_info_to_howto (abfd, bfd_reloc, elf_reloc) - bfd * abfd ATTRIBUTE_UNUSED; - arelent * bfd_reloc; - Elf_Internal_Rela * elf_reloc; -{ - unsigned int r_type; - - r_type = ELF32_R_TYPE (elf_reloc->r_info); - - switch (r_type) - { - case R_ARM_GNU_VTINHERIT: - bfd_reloc->howto = & elf32_arm_vtinherit_howto; - break; - - case R_ARM_GNU_VTENTRY: - bfd_reloc->howto = & elf32_arm_vtentry_howto; - break; - - case R_ARM_THM_PC11: - bfd_reloc->howto = & elf32_arm_thm_pc11_howto; - break; - - case R_ARM_THM_PC9: - bfd_reloc->howto = & elf32_arm_thm_pc9_howto; - break; - - default: - if (r_type >= NUM_ELEM (elf32_arm_howto_table)) - bfd_reloc->howto = NULL; - else - bfd_reloc->howto = & elf32_arm_howto_table[r_type]; - break; - } -} - -struct elf32_arm_reloc_map - { - bfd_reloc_code_real_type bfd_reloc_val; - unsigned char elf_reloc_val; - }; - -static const struct elf32_arm_reloc_map elf32_arm_reloc_map[] = - { - {BFD_RELOC_NONE, R_ARM_NONE}, - {BFD_RELOC_ARM_PCREL_BRANCH, R_ARM_PC24}, - {BFD_RELOC_ARM_PCREL_BLX, R_ARM_XPC25}, - {BFD_RELOC_THUMB_PCREL_BLX, R_ARM_THM_XPC22}, - {BFD_RELOC_32, R_ARM_ABS32}, - {BFD_RELOC_32_PCREL, R_ARM_REL32}, - {BFD_RELOC_8, R_ARM_ABS8}, - {BFD_RELOC_16, R_ARM_ABS16}, - {BFD_RELOC_ARM_OFFSET_IMM, R_ARM_ABS12}, - {BFD_RELOC_ARM_THUMB_OFFSET, R_ARM_THM_ABS5}, - {BFD_RELOC_THUMB_PCREL_BRANCH23, R_ARM_THM_PC22}, - {BFD_RELOC_ARM_COPY, R_ARM_COPY}, - {BFD_RELOC_ARM_GLOB_DAT, R_ARM_GLOB_DAT}, - {BFD_RELOC_ARM_JUMP_SLOT, R_ARM_JUMP_SLOT}, - {BFD_RELOC_ARM_RELATIVE, R_ARM_RELATIVE}, - {BFD_RELOC_ARM_GOTOFF, R_ARM_GOTOFF}, - {BFD_RELOC_ARM_GOTPC, R_ARM_GOTPC}, - {BFD_RELOC_ARM_GOT32, R_ARM_GOT32}, - {BFD_RELOC_ARM_PLT32, R_ARM_PLT32} - }; - -static reloc_howto_type * -elf32_arm_reloc_type_lookup (abfd, code) - bfd *abfd ATTRIBUTE_UNUSED; - bfd_reloc_code_real_type code; -{ - unsigned int i; - - switch (code) - { - case BFD_RELOC_VTABLE_INHERIT: - return & elf32_arm_vtinherit_howto; - - case BFD_RELOC_VTABLE_ENTRY: - return & elf32_arm_vtentry_howto; - - case BFD_RELOC_THUMB_PCREL_BRANCH12: - return & elf32_arm_thm_pc11_howto; - - case BFD_RELOC_THUMB_PCREL_BRANCH9: - return & elf32_arm_thm_pc9_howto; - - default: - for (i = 0; i < NUM_ELEM (elf32_arm_reloc_map); i ++) - if (elf32_arm_reloc_map[i].bfd_reloc_val == code) - return & elf32_arm_howto_table[elf32_arm_reloc_map[i].elf_reloc_val]; - - return NULL; - } -} - -/* Support for core dump NOTE sections */ -static bfd_boolean -elf32_arm_nabi_grok_prstatus (abfd, note) - bfd *abfd; - Elf_Internal_Note *note; -{ - int offset; - size_t raw_size; - - switch (note->descsz) - { - default: - return FALSE; - - case 148: /* Linux/ARM 32-bit*/ - /* pr_cursig */ - elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12); - - /* pr_pid */ - elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24); - - /* pr_reg */ - offset = 72; - raw_size = 72; - - break; - } - - /* Make a ".reg/999" section. */ - return _bfd_elfcore_make_pseudosection (abfd, ".reg", - raw_size, note->descpos + offset); -} - -static bfd_boolean -elf32_arm_nabi_grok_psinfo (abfd, note) - bfd *abfd; - Elf_Internal_Note *note; -{ - switch (note->descsz) - { - default: - return FALSE; - - case 124: /* Linux/ARM elf_prpsinfo */ - elf_tdata (abfd)->core_program - = _bfd_elfcore_strndup (abfd, note->descdata + 28, 16); - elf_tdata (abfd)->core_command - = _bfd_elfcore_strndup (abfd, note->descdata + 44, 80); - } - - /* Note that for some reason, a spurious space is tacked - onto the end of the args in some (at least one anyway) - implementations, so strip it off if it exists. */ - - { - char *command = elf_tdata (abfd)->core_command; - int n = strlen (command); - - if (0 < n && command[n - 1] == ' ') - command[n - 1] = '\0'; - } - - return TRUE; -} - -#define elf_backend_grok_prstatus elf32_arm_nabi_grok_prstatus -#define elf_backend_grok_psinfo elf32_arm_nabi_grok_psinfo - -#include "elf32-arm.h" diff --git a/contrib/binutils/bfd/elfarm-oabi.c b/contrib/binutils/bfd/elfarm-oabi.c deleted file mode 100644 index 08ba41e1ea7..00000000000 --- a/contrib/binutils/bfd/elfarm-oabi.c +++ /dev/null @@ -1,426 +0,0 @@ -/* 32-bit ELF support for ARM old abi option. - Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. - - This file is part of BFD, the Binary File Descriptor library. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#define OLD_ARM_ABI -#define bfd_elf32_arm_allocate_interworking_sections \ - bfd_elf32_arm_oabi_allocate_interworking_sections -#define bfd_elf32_arm_get_bfd_for_interworking \ - bfd_elf32_arm_oabi_get_bfd_for_interworking -#define bfd_elf32_arm_process_before_allocation \ - bfd_elf32_arm_oabi_process_before_allocation -#define bfd_elf32_arm_add_glue_sections_to_bfd \ - bfd_elf32_arm_oabi_add_glue_sections_to_bfd - -#include "elf/arm.h" -#include "bfd.h" -#include "sysdep.h" -#include "libbfd.h" -#include "elf-bfd.h" - -#ifndef NUM_ELEM -#define NUM_ELEM(a) (sizeof (a) / sizeof (a)[0]) -#endif - -#define TARGET_LITTLE_SYM bfd_elf32_littlearm_oabi_vec -#define TARGET_LITTLE_NAME "elf32-littlearm-oabi" -#define TARGET_BIG_SYM bfd_elf32_bigarm_oabi_vec -#define TARGET_BIG_NAME "elf32-bigarm-oabi" - -#define elf_info_to_howto elf32_arm_info_to_howto -#define elf_info_to_howto_rel 0 - -#define ARM_ELF_ABI_VERSION 0 -#define ARM_ELF_OS_ABI_VERSION 0 - -static reloc_howto_type * find_howto PARAMS ((unsigned int)); -static void elf32_arm_info_to_howto PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); -static reloc_howto_type * elf32_arm_reloc_type_lookup PARAMS ((bfd *, bfd_reloc_code_real_type)); - -static reloc_howto_type elf32_arm_howto_table[] = - { - /* No relocation. */ - HOWTO (R_ARM_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_ARM_NONE", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_ARM_PC24, /* type */ - 2, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 24, /* bitsize */ - TRUE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_ARM_PC24", /* name */ - FALSE, /* partial_inplace */ - 0x00ffffff, /* src_mask */ - 0x00ffffff, /* dst_mask */ - TRUE), /* pcrel_offset */ - - /* 32 bit absolute. */ - HOWTO (R_ARM_ABS32, /* 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_ARM_ABS32", /* name */ - FALSE, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - FALSE), /* pcrel_offset */ - - /* Standard 32bit pc-relative reloc. */ - HOWTO (R_ARM_REL32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - TRUE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_ARM_REL32", /* name */ - FALSE, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - TRUE), /* pcrel_offset */ - - /* 8 bit absolute. */ - HOWTO (R_ARM_ABS8, /* type */ - 0, /* rightshift */ - 0, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_ARM_ABS8", /* name */ - FALSE, /* partial_inplace */ - 0x000000ff, /* src_mask */ - 0x000000ff, /* dst_mask */ - FALSE), /* pcrel_offset */ - - /* 16 bit absolute. */ - HOWTO (R_ARM_ABS16, /* 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_ARM_ABS16", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - FALSE), /* pcrel_offset */ - - /* 12 bit absolute. */ - HOWTO (R_ARM_ABS12, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 12, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_ARM_ABS12", /* name */ - FALSE, /* partial_inplace */ - 0x000008ff, /* src_mask */ - 0x000008ff, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_ARM_THM_ABS5, /* type */ - 6, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 5, /* bitsize */ - FALSE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_ARM_THM_ABS5", /* name */ - FALSE, /* partial_inplace */ - 0x000007e0, /* src_mask */ - 0x000007e0, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_ARM_THM_PC22, /* type */ - 1, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 23, /* bitsize */ - TRUE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_ARM_THM_PC22", /* name */ - FALSE, /* partial_inplace */ - 0x07ff07ff, /* src_mask */ - 0x07ff07ff, /* dst_mask */ - TRUE), /* pcrel_offset */ - - HOWTO (R_ARM_SBREL32, /* 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_ARM_SBREL32", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_ARM_AMP_VCALL9, /* type */ - 1, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - TRUE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_ARM_AMP_VCALL9", /* name */ - FALSE, /* partial_inplace */ - 0x000000ff, /* src_mask */ - 0x000000ff, /* dst_mask */ - TRUE), /* pcrel_offset */ - - /* 12 bit pc relative. */ - HOWTO (R_ARM_THM_PC11, /* type */ - 1, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 11, /* bitsize */ - TRUE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_ARM_THM_PC11", /* name */ - FALSE, /* partial_inplace */ - 0x000007ff, /* src_mask */ - 0x000007ff, /* dst_mask */ - TRUE), /* pcrel_offset */ - - /* 12 bit pc relative. */ - HOWTO (R_ARM_THM_PC9, /* type */ - 1, /* rightshift */ - 1, /* size (0 = byte, 1 = short, 2 = long) */ - 8, /* bitsize */ - TRUE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_ARM_THM_PC9", /* name */ - FALSE, /* partial_inplace */ - 0x000000ff, /* src_mask */ - 0x000000ff, /* dst_mask */ - TRUE), /* pcrel_offset */ - - /* GNU extension to record C++ vtable hierarchy. */ - HOWTO (R_ARM_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_ARM_GNU_VTINHERIT", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - FALSE), /* pcrel_offset */ - - /* GNU extension to record C++ vtable member usage. */ - HOWTO (R_ARM_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_ARM_GNU_VTENTRY", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - FALSE), /* pcrel_offset */ - - /* XXX - gap in index numbering here. */ - - HOWTO (R_ARM_PLT32, /* type */ - 2, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 26, /* bitsize */ - TRUE, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_bitfield,/* complain_on_overflow */ - bfd_elf_generic_reloc, /* special_function */ - "R_ARM_PLT32", /* name */ - TRUE, /* partial_inplace */ - 0x00ffffff, /* src_mask */ - 0x00ffffff, /* dst_mask */ - TRUE), /* pcrel_offset */ - - /* XXX - gap in index numbering here. */ - - HOWTO (R_ARM_RREL32, /* 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_ARM_RREL32", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_ARM_RABS32, /* 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_ARM_RABS32", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_ARM_RPC24, /* 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_ARM_RPC24", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - FALSE), /* pcrel_offset */ - - HOWTO (R_ARM_RBASE, /* 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_ARM_RBASE", /* name */ - FALSE, /* partial_inplace */ - 0, /* src_mask */ - 0, /* dst_mask */ - FALSE) /* pcrel_offset */ - }; - -/* Locate a reloc in the howto table. This function must be used - when the entry number is is > R_ARM_GNU_VTINHERIT. */ - -static reloc_howto_type * -find_howto (r_type) - unsigned int r_type; -{ - int i; - - for (i = NUM_ELEM (elf32_arm_howto_table); i--;) - if (elf32_arm_howto_table [i].type == r_type) - return elf32_arm_howto_table + i; - - return NULL; -} - -static void -elf32_arm_info_to_howto (abfd, bfd_reloc, elf_reloc) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *bfd_reloc; - Elf_Internal_Rela *elf_reloc; -{ - unsigned int r_type; - - r_type = ELF32_R_TYPE (elf_reloc->r_info); - - if (r_type <= R_ARM_GNU_VTINHERIT) - bfd_reloc->howto = & elf32_arm_howto_table[r_type]; - else - bfd_reloc->howto = find_howto (r_type); -} - -struct elf32_arm_reloc_map - { - bfd_reloc_code_real_type bfd_reloc_val; - unsigned char elf_reloc_val; - }; - -static const struct elf32_arm_reloc_map elf32_arm_reloc_map[] = - { - {BFD_RELOC_NONE, R_ARM_NONE }, - {BFD_RELOC_ARM_PCREL_BRANCH, R_ARM_PC24 }, - {BFD_RELOC_32, R_ARM_ABS32 }, - {BFD_RELOC_32_PCREL, R_ARM_REL32 }, - {BFD_RELOC_8, R_ARM_ABS8 }, - {BFD_RELOC_16, R_ARM_ABS16 }, - {BFD_RELOC_ARM_OFFSET_IMM, R_ARM_ABS12 }, - {BFD_RELOC_ARM_THUMB_OFFSET, R_ARM_THM_ABS5 }, - {BFD_RELOC_THUMB_PCREL_BRANCH23, R_ARM_THM_PC22 }, - {BFD_RELOC_NONE, R_ARM_SBREL32 }, - {BFD_RELOC_NONE, R_ARM_AMP_VCALL9 }, - {BFD_RELOC_THUMB_PCREL_BRANCH12, R_ARM_THM_PC11 }, - {BFD_RELOC_THUMB_PCREL_BRANCH9, R_ARM_THM_PC9 }, - {BFD_RELOC_VTABLE_INHERIT, R_ARM_GNU_VTINHERIT }, - {BFD_RELOC_VTABLE_ENTRY, R_ARM_GNU_VTENTRY } - }; - -static reloc_howto_type * -elf32_arm_reloc_type_lookup (abfd, code) - bfd * abfd ATTRIBUTE_UNUSED; - bfd_reloc_code_real_type code; -{ - unsigned int i; - - for (i = NUM_ELEM (elf32_arm_reloc_map); i--;) - if (elf32_arm_reloc_map[i].bfd_reloc_val == code) - return & elf32_arm_howto_table [elf32_arm_reloc_map[i].elf_reloc_val]; - - if (code == BFD_RELOC_ARM_PLT32) - return find_howto (R_ARM_PLT32); - - return NULL; -} - -#include "elf32-arm.h" diff --git a/contrib/binutils/bfd/elfcode.h b/contrib/binutils/bfd/elfcode.h index bc69d48db4d..1f8ec2b2b2c 100644 --- a/contrib/binutils/bfd/elfcode.h +++ b/contrib/binutils/bfd/elfcode.h @@ -1,6 +1,6 @@ /* ELF executable support for BFD. Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003 Free Software Foundation, Inc. + 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. Written by Fred Fish @ Cygnus Support, from information published in "UNIX System V Release 4, Programmers Guide: ANSI C and @@ -28,12 +28,12 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* Problems and other issues to resolve. (1) BFD expects there to be some fixed number of "sections" in - the object file. I.E. there is a "section_count" variable in the + the object file. I.E. there is a "section_count" variable in the bfd structure which contains the number of sections. However, ELF supports multiple "views" of a file. In particular, with current implementations, executable files typically have two tables, a @@ -105,6 +105,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define elf_canonicalize_symtab NAME(bfd_elf,canonicalize_symtab) #define elf_canonicalize_dynamic_symtab \ NAME(bfd_elf,canonicalize_dynamic_symtab) +#define elf_get_synthetic_symtab \ + NAME(bfd_elf,get_synthetic_symtab) #define elf_make_empty_symbol NAME(bfd_elf,make_empty_symbol) #define elf_get_symbol_info NAME(bfd_elf,get_symbol_info) #define elf_get_lineno NAME(bfd_elf,get_lineno) @@ -456,6 +458,25 @@ elf_file_p (Elf_External_Ehdr *x_ehdrp) && (x_ehdrp->e_ident[EI_MAG3] == ELFMAG3)); } +/* Determines if a given section index is valid. */ + +static inline bfd_boolean +valid_section_index_p (unsigned index, unsigned num_sections) +{ + /* Note: We allow SHN_UNDEF as a valid section index. */ + if (index < SHN_LORESERVE || index > SHN_HIRESERVE) + return index < num_sections; + + /* We disallow the use of reserved indcies, except for those + with OS or Application specific meaning. The test make use + of the knowledge that: + SHN_LORESERVE == SHN_LOPROC + and + SHN_HIPROC == SHN_LOOS - 1 */ + /* XXX - Should we allow SHN_XINDEX as a valid index here ? */ + return (index >= SHN_LOPROC && index <= SHN_HIOS); +} + /* Check to see if the file associated with ABFD matches the target vector that ABFD points to. @@ -473,7 +494,6 @@ elf_object_p (bfd *abfd) Elf_Internal_Shdr i_shdr; Elf_Internal_Shdr *i_shdrp; /* Section header table, internal form */ unsigned int shindex; - char *shstrtab; /* Internal copy of section header stringtab */ const struct elf_backend_data *ebd; struct bfd_preserve preserve; asection *s; @@ -544,7 +564,7 @@ elf_object_p (bfd *abfd) if (i_ehdrp->e_shoff == 0 && i_ehdrp->e_type == ET_REL) goto got_wrong_format_error; - /* As a simple sanity check, verify that the what BFD thinks is the + /* As a simple sanity check, verify that what BFD thinks is the size of each section header table entry actually matches the size recorded in the file, but only if there are any sections. */ if (i_ehdrp->e_shentsize != sizeof (x_shdr) && i_ehdrp->e_shnum != 0) @@ -606,13 +626,15 @@ elf_object_p (bfd *abfd) goto got_no_match; } - /* Remember the entry point specified in the ELF file header. */ - bfd_set_start_address (abfd, i_ehdrp->e_entry); - if (i_ehdrp->e_shoff != 0) { + bfd_signed_vma where = i_ehdrp->e_shoff; + + if (where != (file_ptr) where) + goto got_wrong_format_error; + /* Seek to the section header table in the file. */ - if (bfd_seek (abfd, (file_ptr) i_ehdrp->e_shoff, SEEK_SET) != 0) + if (bfd_seek (abfd, (file_ptr) where, SEEK_SET) != 0) goto got_no_match; /* Read the first section header at index 0, and convert to internal @@ -624,11 +646,46 @@ elf_object_p (bfd *abfd) /* If the section count is zero, the actual count is in the first section header. */ if (i_ehdrp->e_shnum == SHN_UNDEF) - i_ehdrp->e_shnum = i_shdr.sh_size; + { + i_ehdrp->e_shnum = i_shdr.sh_size; + if (i_ehdrp->e_shnum != i_shdr.sh_size + || i_ehdrp->e_shnum == 0) + goto got_wrong_format_error; + } /* And similarly for the string table index. */ if (i_ehdrp->e_shstrndx == SHN_XINDEX) - i_ehdrp->e_shstrndx = i_shdr.sh_link; + { + i_ehdrp->e_shstrndx = i_shdr.sh_link; + if (i_ehdrp->e_shstrndx != i_shdr.sh_link) + goto got_wrong_format_error; + } + + /* Sanity check that we can read all of the section headers. + It ought to be good enough to just read the last one. */ + if (i_ehdrp->e_shnum != 1) + { + /* Check that we don't have a totally silly number of sections. */ + if (i_ehdrp->e_shnum > (unsigned int) -1 / sizeof (x_shdr) + || i_ehdrp->e_shnum > (unsigned int) -1 / sizeof (i_shdr)) + goto got_wrong_format_error; + + where += (i_ehdrp->e_shnum - 1) * sizeof (x_shdr); + if (where != (file_ptr) where) + goto got_wrong_format_error; + if ((bfd_size_type) where <= i_ehdrp->e_shoff) + goto got_wrong_format_error; + + if (bfd_seek (abfd, (file_ptr) where, SEEK_SET) != 0) + goto got_no_match; + if (bfd_bread (&x_shdr, sizeof x_shdr, abfd) != sizeof (x_shdr)) + goto got_no_match; + + /* Back to where we were. */ + where = i_ehdrp->e_shoff + sizeof (x_shdr); + if (bfd_seek (abfd, (file_ptr) where, SEEK_SET) != 0) + goto got_no_match; + } } /* Allocate space for a copy of the section header table in @@ -672,23 +729,45 @@ elf_object_p (bfd *abfd) goto got_no_match; elf_swap_shdr_in (abfd, &x_shdr, i_shdrp + shindex); + /* Sanity check sh_link and sh_info. */ + if (! valid_section_index_p (i_shdrp[shindex].sh_link, num_sec)) + goto got_wrong_format_error; + + if (((i_shdrp[shindex].sh_flags & SHF_INFO_LINK) + || i_shdrp[shindex].sh_type == SHT_RELA + || i_shdrp[shindex].sh_type == SHT_REL) + && ! valid_section_index_p (i_shdrp[shindex].sh_info, num_sec)) + goto got_wrong_format_error; + /* If the section is loaded, but not page aligned, clear D_PAGED. */ if (i_shdrp[shindex].sh_size != 0 && (i_shdrp[shindex].sh_flags & SHF_ALLOC) != 0 && i_shdrp[shindex].sh_type != SHT_NOBITS && (((i_shdrp[shindex].sh_addr - i_shdrp[shindex].sh_offset) - % ebd->maxpagesize) + % ebd->minpagesize) != 0)) abfd->flags &= ~D_PAGED; } } - if (i_ehdrp->e_shstrndx && i_ehdrp->e_shoff) + /* A further sanity check. */ + if (i_ehdrp->e_shnum != 0) { - if (! bfd_section_from_shdr (abfd, i_ehdrp->e_shstrndx)) - goto got_no_match; + if (! valid_section_index_p (i_ehdrp->e_shstrndx, elf_numsections (abfd))) + { + /* PR 2257: + We used to just goto got_wrong_format_error here + but there are binaries in existance for which this test + will prevent the binutils from working with them at all. + So we are kind, and reset the string index value to 0 + so that at least some processing can be done. */ + i_ehdrp->e_shstrndx = SHN_UNDEF; + _bfd_error_handler (_("warning: %s has a corrupt string table index - ignoring"), abfd->filename); + } } + else if (i_ehdrp->e_shstrndx != SHN_UNDEF) + goto got_wrong_format_error; /* Read in the program headers. */ if (i_ehdrp->e_phnum == 0) @@ -715,20 +794,10 @@ elf_object_p (bfd *abfd) } } - /* Read in the string table containing the names of the sections. We - will need the base pointer to this table later. */ - /* We read this inline now, so that we don't have to go through - bfd_section_from_shdr with it (since this particular strtab is - used to find all of the ELF section names.) */ - - if (i_ehdrp->e_shstrndx != 0 && i_ehdrp->e_shoff) + if (i_ehdrp->e_shstrndx != 0 && i_ehdrp->e_shoff != 0) { unsigned int num_sec; - shstrtab = bfd_elf_get_str_section (abfd, i_ehdrp->e_shstrndx); - if (!shstrtab) - goto got_no_match; - /* Once all of the section headers have been read and converted, we can start processing them. Note that the first section header is a dummy placeholder entry, so we ignore it. */ @@ -740,6 +809,10 @@ elf_object_p (bfd *abfd) if (shindex == SHN_LORESERVE - 1) shindex += SHN_HIRESERVE + 1 - SHN_LORESERVE; } + + /* Set up ELF sections for SHF_GROUP and SHF_LINK_ORDER. */ + if (! _bfd_elf_setup_sections (abfd)) + goto got_wrong_format_error; } /* Let the backend double check the format and override global @@ -750,6 +823,9 @@ elf_object_p (bfd *abfd) goto got_wrong_format_error; } + /* Remember the entry point specified in the ELF file header. */ + bfd_set_start_address (abfd, i_ehdrp->e_entry); + /* If we have created any reloc sections that are associated with debugging sections, mark the reloc sections as debugging as well. */ for (s = abfd->sections; s != NULL; s = s->next) @@ -821,6 +897,12 @@ elf_write_relocs (bfd *abfd, asection *sec, void *data) if (sec->reloc_count == 0) return; + /* If we have opened an existing file for update, reloc_count may be + set even though we are not linking. In that case we have nothing + to do. */ + if (sec->orelocation == NULL) + return; + rela_hdr = &elf_section_data (sec)->rel_hdr; rela_hdr->sh_size = rela_hdr->sh_entsize * sec->reloc_count; @@ -1020,7 +1102,7 @@ elf_slurp_symbol_table (bfd *abfd, asymbol **symptrs, bfd_boolean dynamic) || (elf_tdata (abfd)->dynverref_section != 0 && elf_tdata (abfd)->verref == NULL)) { - if (! _bfd_elf_slurp_version_tables (abfd)) + if (!_bfd_elf_slurp_version_tables (abfd, FALSE)) return -1; } } @@ -1053,7 +1135,7 @@ elf_slurp_symbol_table (bfd *abfd, asymbol **symptrs, bfd_boolean dynamic) symcount); /* Slurp in the symbols without the version information, - since that is more helpful than just quitting. */ + since that is more helpful than just quitting. */ verhdr = NULL; } @@ -1080,9 +1162,7 @@ elf_slurp_symbol_table (bfd *abfd, asymbol **symptrs, bfd_boolean dynamic) memcpy (&sym->internal_elf_sym, isym, sizeof (Elf_Internal_Sym)); sym->symbol.the_bfd = abfd; - sym->symbol.name = bfd_elf_string_from_elf_section (abfd, - hdr->sh_link, - isym->st_name); + sym->symbol.name = bfd_elf_sym_name (abfd, hdr, isym, NULL); sym->symbol.value = isym->st_value; @@ -1120,7 +1200,7 @@ elf_slurp_symbol_table (bfd *abfd, asymbol **symptrs, bfd_boolean dynamic) sym->symbol.section = bfd_abs_section_ptr; /* If this is a relocatable file, then the symbol value is - already section relative. */ + already section relative. */ if ((abfd->flags & (EXEC_P | DYNAMIC)) != 0) sym->symbol.value -= sym->symbol.section->vma; @@ -1152,6 +1232,9 @@ elf_slurp_symbol_table (bfd *abfd, asymbol **symptrs, bfd_boolean dynamic) case STT_OBJECT: sym->symbol.flags |= BSF_OBJECT; break; + case STT_TLS: + sym->symbol.flags |= BSF_THREAD_LOCAL; + break; } if (dynamic) @@ -1208,7 +1291,7 @@ error_return: return -1; } -/* Read relocations for ASECT from REL_HDR. There are RELOC_COUNT of +/* Read relocations for ASECT from REL_HDR. There are RELOC_COUNT of them. */ static bfd_boolean @@ -1279,16 +1362,11 @@ elf_slurp_reloc_table_from_section (bfd *abfd, } else { - asymbol **ps, *s; + asymbol **ps; ps = symbols + ELF_R_SYM (rela.r_info) - 1; - s = *ps; - /* Canonicalize ELF section symbols. FIXME: Why? */ - if ((s->flags & BSF_SECTION_SYM) == 0) - relent->sym_ptr_ptr = ps; - else - relent->sym_ptr_ptr = s->section->symbol_ptr_ptr; + relent->sym_ptr_ptr = ps; } relent->addend = rela.r_addend; @@ -1353,7 +1431,7 @@ elf_slurp_reloc_table (bfd *abfd, case because relocations against this section may use the dynamic symbol table, and in that case bfd_section_from_shdr in elf.c does not update the RELOC_COUNT. */ - if (asect->_raw_size == 0) + if (asect->size == 0) return TRUE; rel_hdr = &d->this_hdr; @@ -1513,7 +1591,7 @@ NAME(_bfd_elf,bfd_from_remote_memory) (bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep, - int (*target_read_memory) (bfd_vma, char *, int)) + int (*target_read_memory) (bfd_vma, bfd_byte *, int)) { Elf_External_Ehdr x_ehdr; /* Elf file header, external form */ Elf_Internal_Ehdr i_ehdr; /* Elf file header, internal form */ @@ -1522,13 +1600,13 @@ NAME(_bfd_elf,bfd_from_remote_memory) bfd *nbfd; struct bfd_in_memory *bim; int contents_size; - char *contents; + bfd_byte *contents; int err; unsigned int i; bfd_vma loadbase; /* Read in the ELF header in external format. */ - err = target_read_memory (ehdr_vma, (char *) &x_ehdr, sizeof x_ehdr); + err = target_read_memory (ehdr_vma, (bfd_byte *) &x_ehdr, sizeof x_ehdr); if (err) { bfd_set_error (bfd_error_system_call); @@ -1588,7 +1666,7 @@ NAME(_bfd_elf,bfd_from_remote_memory) bfd_set_error (bfd_error_no_memory); return NULL; } - err = target_read_memory (ehdr_vma + i_ehdr.e_phoff, (char *) x_phdrs, + err = target_read_memory (ehdr_vma + i_ehdr.e_phoff, (bfd_byte *) x_phdrs, i_ehdr.e_phnum * sizeof x_phdrs[0]); if (err) { @@ -1605,7 +1683,10 @@ NAME(_bfd_elf,bfd_from_remote_memory) for (i = 0; i < i_ehdr.e_phnum; ++i) { elf_swap_phdr_in (templ, &x_phdrs[i], &i_phdrs[i]); - if (i_phdrs[i].p_type == PT_LOAD) + /* IA-64 vDSO may have two mappings for one segment, where one mapping + is executable only, and one is read only. We must not use the + executable one. */ + if (i_phdrs[i].p_type == PT_LOAD && (i_phdrs[i].p_flags & PF_R)) { bfd_vma segment_end; segment_end = (i_phdrs[i].p_offset + i_phdrs[i].p_filesz @@ -1652,7 +1733,10 @@ NAME(_bfd_elf,bfd_from_remote_memory) } for (i = 0; i < i_ehdr.e_phnum; ++i) - if (i_phdrs[i].p_type == PT_LOAD) + /* IA-64 vDSO may have two mappings for one segment, where one mapping + is executable only, and one is read only. We must not use the + executable one. */ + if (i_phdrs[i].p_type == PT_LOAD && (i_phdrs[i].p_flags & PF_R)) { bfd_vma start = i_phdrs[i].p_offset & -i_phdrs[i].p_align; bfd_vma end = (i_phdrs[i].p_offset + i_phdrs[i].p_filesz diff --git a/contrib/binutils/bfd/elfcore.h b/contrib/binutils/bfd/elfcore.h index 81c4cff1139..b1cf42d79fa 100644 --- a/contrib/binutils/bfd/elfcore.h +++ b/contrib/binutils/bfd/elfcore.h @@ -1,5 +1,5 @@ /* ELF core file support for BFD. - Copyright 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003 + Copyright 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2005 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ char* elf_core_file_failing_command (bfd *abfd) @@ -207,12 +207,19 @@ elf_core_file_p (bfd *abfd) /* Set the machine architecture. Do this before processing the program headers since we need to know the architecture type when processing the notes of some systems' core files. */ - if (! bfd_default_set_arch_mach (abfd, ebd->arch, 0)) - { + if (! bfd_default_set_arch_mach (abfd, ebd->arch, 0) /* It's OK if this fails for the generic target. */ - if (ebd->elf_machine_code != EM_NONE) - goto fail; - } + && ebd->elf_machine_code != EM_NONE) + goto fail; + + /* Let the backend double check the format and override global + information. We do this before processing the program headers + to allow the correct machine (as opposed to just the default + machine) to be set, making it possible for grok_prstatus and + grok_psinfo to rely on the mach setting. */ + if (ebd->elf_backend_object_p != NULL + && ! ebd->elf_backend_object_p (abfd)) + goto wrong; /* Process each program header. */ for (phindex = 0; phindex < i_ehdrp->e_phnum; ++phindex) @@ -222,12 +229,6 @@ elf_core_file_p (bfd *abfd) /* Save the entry point from the ELF header. */ bfd_get_start_address (abfd) = i_ehdrp->e_entry; - /* Let the backend double check the format and override global - information. */ - if (ebd->elf_backend_object_p - && (! (*ebd->elf_backend_object_p) (abfd))) - goto wrong; - bfd_preserve_finish (abfd, &preserve); return abfd->xvec; diff --git a/contrib/binutils/bfd/elflink.c b/contrib/binutils/bfd/elflink.c index 0353bdcb5f3..59d9c3f1389 100644 --- a/contrib/binutils/bfd/elflink.c +++ b/contrib/binutils/bfd/elflink.c @@ -1,22 +1,22 @@ /* ELF linking support for BFD. - Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 - Free Software Foundation, Inc. + Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, + 2005, 2006 Free Software Foundation, Inc. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" @@ -26,6 +26,45 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "elf-bfd.h" #include "safe-ctype.h" #include "libiberty.h" +#include "objalloc.h" + +/* Define a symbol in a dynamic linkage section. */ + +struct elf_link_hash_entry * +_bfd_elf_define_linkage_sym (bfd *abfd, + struct bfd_link_info *info, + asection *sec, + const char *name) +{ + struct elf_link_hash_entry *h; + struct bfd_link_hash_entry *bh; + const struct elf_backend_data *bed; + + h = elf_link_hash_lookup (elf_hash_table (info), name, FALSE, FALSE, FALSE); + if (h != NULL) + { + /* Zap symbol defined in an as-needed lib that wasn't linked. + This is a symptom of a larger problem: Absolute symbols + defined in shared libraries can't be overridden, because we + lose the link to the bfd which is via the symbol section. */ + h->root.type = bfd_link_hash_new; + } + + bh = &h->root; + if (!_bfd_generic_link_add_one_symbol (info, abfd, name, BSF_GLOBAL, + sec, 0, NULL, FALSE, + get_elf_backend_data (abfd)->collect, + &bh)) + return NULL; + h = (struct elf_link_hash_entry *) bh; + h->def_regular = 1; + h->type = STT_OBJECT; + h->other = (h->other & ~ELF_ST_VISIBILITY (-1)) | STV_HIDDEN; + + bed = get_elf_backend_data (abfd); + (*bed->elf_backend_hide_symbol) (info, h, TRUE); + return h; +} bfd_boolean _bfd_elf_create_got_section (bfd *abfd, struct bfd_link_info *info) @@ -33,7 +72,6 @@ _bfd_elf_create_got_section (bfd *abfd, struct bfd_link_info *info) flagword flags; asection *s; struct elf_link_hash_entry *h; - struct bfd_link_hash_entry *bh; const struct elf_backend_data *bed = get_elf_backend_data (abfd); int ptralign; @@ -57,20 +95,17 @@ _bfd_elf_create_got_section (bfd *abfd, struct bfd_link_info *info) return FALSE; } - flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY - | SEC_LINKER_CREATED); + flags = bed->dynamic_sec_flags; - s = bfd_make_section (abfd, ".got"); + s = bfd_make_section_with_flags (abfd, ".got", flags); if (s == NULL - || !bfd_set_section_flags (abfd, s, flags) || !bfd_set_section_alignment (abfd, s, ptralign)) return FALSE; if (bed->want_got_plt) { - s = bfd_make_section (abfd, ".got.plt"); + s = bfd_make_section_with_flags (abfd, ".got.plt", flags); if (s == NULL - || !bfd_set_section_flags (abfd, s, flags) || !bfd_set_section_alignment (abfd, s, ptralign)) return FALSE; } @@ -81,28 +116,37 @@ _bfd_elf_create_got_section (bfd *abfd, struct bfd_link_info *info) (or .got.plt) section. 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. */ - bh = NULL; - if (!(_bfd_generic_link_add_one_symbol - (info, abfd, "_GLOBAL_OFFSET_TABLE_", BSF_GLOBAL, s, - bed->got_symbol_offset, NULL, FALSE, bed->collect, &bh))) - return FALSE; - h = (struct elf_link_hash_entry *) bh; - h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; - h->type = STT_OBJECT; - - if (! info->executable - && ! bfd_elf_link_record_dynamic_symbol (info, h)) - return FALSE; - + h = _bfd_elf_define_linkage_sym (abfd, info, s, "_GLOBAL_OFFSET_TABLE_"); elf_hash_table (info)->hgot = h; + if (h == NULL) + return FALSE; } /* The first bit of the global offset table is the header. */ - s->_raw_size += bed->got_header_size + bed->got_symbol_offset; + s->size += bed->got_header_size; return TRUE; } +/* Create a strtab to hold the dynamic symbol names. */ +static bfd_boolean +_bfd_elf_link_create_dynstrtab (bfd *abfd, struct bfd_link_info *info) +{ + struct elf_link_hash_table *hash_table; + + hash_table = elf_hash_table (info); + if (hash_table->dynobj == NULL) + hash_table->dynobj = abfd; + + if (hash_table->dynstr == NULL) + { + hash_table->dynstr = _bfd_elf_strtab_init (); + if (hash_table->dynstr == NULL) + return FALSE; + } + return TRUE; +} + /* Create some sections which will be filled in with dynamic linking information. ABFD is an input file which requires dynamic sections to be created. The dynamic sections take up virtual memory space @@ -115,8 +159,6 @@ _bfd_elf_link_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) { flagword flags; register asection *s; - struct elf_link_hash_entry *h; - struct bfd_link_hash_entry *bh; const struct elf_backend_data *bed; if (! is_elf_hash_table (info->hash)) @@ -125,108 +167,82 @@ _bfd_elf_link_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) if (elf_hash_table (info)->dynamic_sections_created) return TRUE; - /* Make sure that all dynamic sections use the same input BFD. */ - if (elf_hash_table (info)->dynobj == NULL) - elf_hash_table (info)->dynobj = abfd; - else - abfd = elf_hash_table (info)->dynobj; + if (!_bfd_elf_link_create_dynstrtab (abfd, info)) + return FALSE; - /* Note that we set the SEC_IN_MEMORY flag for all of these - sections. */ - flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS - | SEC_IN_MEMORY | SEC_LINKER_CREATED); + abfd = elf_hash_table (info)->dynobj; + bed = get_elf_backend_data (abfd); + + flags = bed->dynamic_sec_flags; /* A dynamically linked executable has a .interp section, but a shared library does not. */ if (info->executable) { - s = bfd_make_section (abfd, ".interp"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)) + s = bfd_make_section_with_flags (abfd, ".interp", + flags | SEC_READONLY); + if (s == NULL) return FALSE; } if (! info->traditional_format) { - s = bfd_make_section (abfd, ".eh_frame_hdr"); + s = bfd_make_section_with_flags (abfd, ".eh_frame_hdr", + flags | SEC_READONLY); if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) || ! bfd_set_section_alignment (abfd, s, 2)) return FALSE; elf_hash_table (info)->eh_info.hdr_sec = s; } - bed = get_elf_backend_data (abfd); - /* Create sections to hold version informations. These are removed if they are not needed. */ - s = bfd_make_section (abfd, ".gnu.version_d"); + s = bfd_make_section_with_flags (abfd, ".gnu.version_d", + flags | SEC_READONLY); if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align)) return FALSE; - s = bfd_make_section (abfd, ".gnu.version"); + s = bfd_make_section_with_flags (abfd, ".gnu.version", + flags | SEC_READONLY); if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) || ! bfd_set_section_alignment (abfd, s, 1)) return FALSE; - s = bfd_make_section (abfd, ".gnu.version_r"); + s = bfd_make_section_with_flags (abfd, ".gnu.version_r", + flags | SEC_READONLY); if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align)) return FALSE; - s = bfd_make_section (abfd, ".dynsym"); + s = bfd_make_section_with_flags (abfd, ".dynsym", + flags | SEC_READONLY); if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align)) return FALSE; - s = bfd_make_section (abfd, ".dynstr"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)) + s = bfd_make_section_with_flags (abfd, ".dynstr", + flags | SEC_READONLY); + if (s == NULL) return FALSE; - /* Create a strtab to hold the dynamic symbol names. */ - if (elf_hash_table (info)->dynstr == NULL) - { - elf_hash_table (info)->dynstr = _bfd_elf_strtab_init (); - if (elf_hash_table (info)->dynstr == NULL) - return FALSE; - } - - s = bfd_make_section (abfd, ".dynamic"); + s = bfd_make_section_with_flags (abfd, ".dynamic", flags); if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags) || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align)) return FALSE; /* The special symbol _DYNAMIC is always set to the start of the - .dynamic section. This call occurs before we have processed the - symbols for any dynamic object, so we don't have to worry about - overriding a dynamic definition. We could set _DYNAMIC in a - linker script, but we only want to define it if we are, in fact, - creating a .dynamic section. We don't want to define it if there - is no .dynamic section, since on some ELF platforms the start up - code examines it to decide how to initialize the process. */ - bh = NULL; - if (! (_bfd_generic_link_add_one_symbol - (info, abfd, "_DYNAMIC", BSF_GLOBAL, s, 0, NULL, FALSE, - get_elf_backend_data (abfd)->collect, &bh))) - return FALSE; - h = (struct elf_link_hash_entry *) bh; - h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; - h->type = STT_OBJECT; - - if (! info->executable - && ! bfd_elf_link_record_dynamic_symbol (info, h)) + .dynamic section. We could set _DYNAMIC in a linker script, but we + only want to define it if we are, in fact, creating a .dynamic + section. We don't want to define it if there is no .dynamic + section, since on some ELF platforms the start up code examines it + to decide how to initialize the process. */ + if (!_bfd_elf_define_linkage_sym (abfd, info, s, "_DYNAMIC")) return FALSE; - s = bfd_make_section (abfd, ".hash"); + s = bfd_make_section_with_flags (abfd, ".hash", + flags | SEC_READONLY); if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align)) return FALSE; elf_section_data (s)->this_hdr.sh_entsize = bed->s->sizeof_hash_entry; @@ -248,52 +264,46 @@ bfd_boolean _bfd_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) { flagword flags, pltflags; + struct elf_link_hash_entry *h; asection *s; const struct elf_backend_data *bed = get_elf_backend_data (abfd); /* We need to create .plt, .rel[a].plt, .got, .got.plt, .dynbss, and .rel[a].bss sections. */ - - flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY - | SEC_LINKER_CREATED); + flags = bed->dynamic_sec_flags; pltflags = flags; - pltflags |= SEC_CODE; if (bed->plt_not_loaded) + /* We do not clear SEC_ALLOC here because we still want the OS to + allocate space for the section; it's just that there's nothing + to read in from the object file. */ pltflags &= ~ (SEC_CODE | SEC_LOAD | SEC_HAS_CONTENTS); + else + pltflags |= SEC_ALLOC | SEC_CODE | SEC_LOAD; if (bed->plt_readonly) pltflags |= SEC_READONLY; - s = bfd_make_section (abfd, ".plt"); + s = bfd_make_section_with_flags (abfd, ".plt", pltflags); if (s == NULL - || ! bfd_set_section_flags (abfd, s, pltflags) || ! bfd_set_section_alignment (abfd, s, bed->plt_alignment)) return FALSE; + /* Define the symbol _PROCEDURE_LINKAGE_TABLE_ at the start of the + .plt section. */ if (bed->want_plt_sym) { - /* Define the symbol _PROCEDURE_LINKAGE_TABLE_ at the start of the - .plt section. */ - struct elf_link_hash_entry *h; - struct bfd_link_hash_entry *bh = NULL; - - if (! (_bfd_generic_link_add_one_symbol - (info, abfd, "_PROCEDURE_LINKAGE_TABLE_", BSF_GLOBAL, s, 0, NULL, - FALSE, get_elf_backend_data (abfd)->collect, &bh))) - return FALSE; - h = (struct elf_link_hash_entry *) bh; - h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; - h->type = STT_OBJECT; - - if (! info->executable - && ! bfd_elf_link_record_dynamic_symbol (info, h)) + h = _bfd_elf_define_linkage_sym (abfd, info, s, + "_PROCEDURE_LINKAGE_TABLE_"); + elf_hash_table (info)->hplt = h; + if (h == NULL) return FALSE; } - s = bfd_make_section (abfd, - bed->default_use_rela_p ? ".rela.plt" : ".rel.plt"); + s = bfd_make_section_with_flags (abfd, + (bed->default_use_rela_p + ? ".rela.plt" : ".rel.plt"), + flags | SEC_READONLY); if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align)) return FALSE; @@ -308,29 +318,30 @@ _bfd_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) image and use a R_*_COPY reloc to tell the dynamic linker to initialize them at run time. The linker script puts the .dynbss section into the .bss section of the final image. */ - s = bfd_make_section (abfd, ".dynbss"); - if (s == NULL - || ! bfd_set_section_flags (abfd, s, SEC_ALLOC | SEC_LINKER_CREATED)) + s = bfd_make_section_with_flags (abfd, ".dynbss", + (SEC_ALLOC + | SEC_LINKER_CREATED)); + if (s == NULL) return FALSE; /* The .rel[a].bss section holds copy relocs. This section is not - normally needed. We need to create it here, though, so that the - linker will map it to an output section. We can't just create it - only if we need it, because we will not know whether we need it - until we have seen all the input files, and the first time the - main linker code calls BFD after examining all the input files - (size_dynamic_sections) the input sections have already been - mapped to the output sections. If the section turns out not to - be needed, we can discard it later. We will never need this - section when generating a shared object, since they do not use - copy relocs. */ + normally needed. We need to create it here, though, so that the + linker will map it to an output section. We can't just create it + only if we need it, because we will not know whether we need it + until we have seen all the input files, and the first time the + main linker code calls BFD after examining all the input files + (size_dynamic_sections) the input sections have already been + mapped to the output sections. If the section turns out not to + be needed, we can discard it later. We will never need this + section when generating a shared object, since they do not use + copy relocs. */ if (! info->shared) { - s = bfd_make_section (abfd, - (bed->default_use_rela_p - ? ".rela.bss" : ".rel.bss")); + s = bfd_make_section_with_flags (abfd, + (bed->default_use_rela_p + ? ".rela.bss" : ".rel.bss"), + flags | SEC_READONLY); if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY) || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align)) return FALSE; } @@ -369,8 +380,9 @@ bfd_elf_link_record_dynamic_symbol (struct bfd_link_info *info, if (h->root.type != bfd_link_hash_undefined && h->root.type != bfd_link_hash_undefweak) { - h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL; - return TRUE; + h->forced_local = 1; + if (!elf_hash_table (info)->is_relocatable_executable) + return TRUE; } default: @@ -418,37 +430,44 @@ bfd_elf_link_record_dynamic_symbol (struct bfd_link_info *info, this in case some dynamic object refers to this symbol. */ bfd_boolean -bfd_elf_record_link_assignment (bfd *output_bfd ATTRIBUTE_UNUSED, +bfd_elf_record_link_assignment (bfd *output_bfd, struct bfd_link_info *info, const char *name, - bfd_boolean provide) + bfd_boolean provide, + bfd_boolean hidden) { struct elf_link_hash_entry *h; + struct elf_link_hash_table *htab; if (!is_elf_hash_table (info->hash)) return TRUE; - h = elf_link_hash_lookup (elf_hash_table (info), name, TRUE, TRUE, FALSE); + htab = elf_hash_table (info); + h = elf_link_hash_lookup (htab, name, !provide, TRUE, FALSE); if (h == NULL) - return FALSE; + return provide; /* Since we're defining the symbol, don't let it seem to have not been defined. record_dynamic_symbol and size_dynamic_sections may depend on this. */ if (h->root.type == bfd_link_hash_undefweak || h->root.type == bfd_link_hash_undefined) - h->root.type = bfd_link_hash_new; + { + h->root.type = bfd_link_hash_new; + if (h->root.u.undef.next != NULL || htab->root.undefs_tail == &h->root) + bfd_link_repair_undef_list (&htab->root); + } if (h->root.type == bfd_link_hash_new) - h->elf_link_hash_flags &= ~ELF_LINK_NON_ELF; + h->non_elf = 0; /* If this symbol is being provided by the linker script, and it is currently defined by a dynamic object, but not by a regular object, then mark it as undefined so that the generic linker will force the correct value. */ if (provide - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + && h->def_dynamic + && !h->def_regular) h->root.type = bfd_link_hash_undefined; /* If this symbol is not being provided by the linker script, and it is @@ -456,15 +475,32 @@ bfd_elf_record_link_assignment (bfd *output_bfd ATTRIBUTE_UNUSED, then clear out any version information because the symbol will not be associated with the dynamic object any more. */ if (!provide - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + && h->def_dynamic + && !h->def_regular) h->verinfo.verdef = NULL; - h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; + h->def_regular = 1; - if (((h->elf_link_hash_flags & (ELF_LINK_HASH_DEF_DYNAMIC - | ELF_LINK_HASH_REF_DYNAMIC)) != 0 - || info->shared) + if (provide && hidden) + { + const struct elf_backend_data *bed = get_elf_backend_data (output_bfd); + + h->other = (h->other & ~ELF_ST_VISIBILITY (-1)) | STV_HIDDEN; + (*bed->elf_backend_hide_symbol) (info, h, TRUE); + } + + /* STV_HIDDEN and STV_INTERNAL symbols must be STB_LOCAL in shared objects + and executables. */ + if (!info->relocatable + && h->dynindx != -1 + && (ELF_ST_VISIBILITY (h->other) == STV_HIDDEN + || ELF_ST_VISIBILITY (h->other) == STV_INTERNAL)) + h->forced_local = 1; + + if ((h->def_dynamic + || h->ref_dynamic + || info->shared + || (info->executable && elf_hash_table (info)->is_relocatable_executable)) && h->dynindx == -1) { if (! bfd_elf_link_record_dynamic_symbol (info, h)) @@ -473,10 +509,10 @@ bfd_elf_record_link_assignment (bfd *output_bfd ATTRIBUTE_UNUSED, /* If this is a weak defined symbol, and we know a corresponding real symbol from the same dynamic object, make sure the real symbol is also made into a dynamic symbol. */ - if (h->weakdef != NULL - && h->weakdef->dynindx == -1) + if (h->u.weakdef != NULL + && h->u.weakdef->dynindx == -1) { - if (! bfd_elf_link_record_dynamic_symbol (info, h->weakdef)) + if (! bfd_elf_link_record_dynamic_symbol (info, h->u.weakdef)) return FALSE; } } @@ -602,29 +638,101 @@ elf_link_renumber_hash_table_dynsyms (struct elf_link_hash_entry *h, if (h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; + if (h->forced_local) + return TRUE; + if (h->dynindx != -1) h->dynindx = ++(*count); return TRUE; } -/* Assign dynsym indices. In a shared library we generate a section - symbol for each output section, which come first. Next come all of - the back-end allocated local dynamic syms, followed by the rest of - the global symbols. */ -unsigned long -_bfd_elf_link_renumber_dynsyms (bfd *output_bfd, struct bfd_link_info *info) +/* Like elf_link_renumber_hash_table_dynsyms, but just number symbols with + STB_LOCAL binding. */ + +static bfd_boolean +elf_link_renumber_local_hash_table_dynsyms (struct elf_link_hash_entry *h, + void *data) +{ + size_t *count = data; + + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + if (!h->forced_local) + return TRUE; + + if (h->dynindx != -1) + h->dynindx = ++(*count); + + return TRUE; +} + +/* Return true if the dynamic symbol for a given section should be + omitted when creating a shared library. */ +bfd_boolean +_bfd_elf_link_omit_section_dynsym (bfd *output_bfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info, + asection *p) +{ + switch (elf_section_data (p)->this_hdr.sh_type) + { + case SHT_PROGBITS: + case SHT_NOBITS: + /* If sh_type is yet undecided, assume it could be + SHT_PROGBITS/SHT_NOBITS. */ + case SHT_NULL: + if (strcmp (p->name, ".got") == 0 + || strcmp (p->name, ".got.plt") == 0 + || strcmp (p->name, ".plt") == 0) + { + asection *ip; + bfd *dynobj = elf_hash_table (info)->dynobj; + + if (dynobj != NULL + && (ip = bfd_get_section_by_name (dynobj, p->name)) != NULL + && (ip->flags & SEC_LINKER_CREATED) + && ip->output_section == p) + return TRUE; + } + return FALSE; + + /* There shouldn't be section relative relocations + against any other section. */ + default: + return TRUE; + } +} + +/* Assign dynsym indices. In a shared library we generate a section + symbol for each output section, which come first. Next come symbols + which have been forced to local binding. Then all of the back-end + allocated local dynamic syms, followed by the rest of the global + symbols. */ + +static unsigned long +_bfd_elf_link_renumber_dynsyms (bfd *output_bfd, + struct bfd_link_info *info, + unsigned long *section_sym_count) { unsigned long dynsymcount = 0; - if (info->shared) + if (info->shared || elf_hash_table (info)->is_relocatable_executable) { + const struct elf_backend_data *bed = get_elf_backend_data (output_bfd); asection *p; for (p = output_bfd->sections; p ; p = p->next) - if ((p->flags & SEC_EXCLUDE) == 0) + if ((p->flags & SEC_EXCLUDE) == 0 + && (p->flags & SEC_ALLOC) != 0 + && !(*bed->elf_backend_omit_section_dynsym) (output_bfd, info, p)) elf_section_data (p)->dynindx = ++dynsymcount; } + *section_sym_count = dynsymcount; + + elf_link_hash_traverse (elf_hash_table (info), + elf_link_renumber_local_hash_table_dynsyms, + &dynsymcount); if (elf_hash_table (info)->dynlocal) { @@ -643,7 +751,8 @@ _bfd_elf_link_renumber_dynsyms (bfd *output_bfd, struct bfd_link_info *info) if (dynsymcount != 0) ++dynsymcount; - return elf_hash_table (info)->dynsymcount = dynsymcount; + elf_hash_table (info)->dynsymcount = dynsymcount; + return dynsymcount; } /* This function is called when we want to define a new symbol. It @@ -655,7 +764,8 @@ _bfd_elf_link_renumber_dynsyms (bfd *output_bfd, struct bfd_link_info *info) TYPE_CHANGE_OK if it is OK for the type to change. We set SIZE_CHANGE_OK if it is OK for the size to change. By OK to change, we mean that we shouldn't warn if the type or size does - change. */ + change. We set POLD_ALIGNMENT if an old common symbol in a dynamic + object is overridden by a regular object. */ bfd_boolean _bfd_elf_merge_symbol (bfd *abfd, @@ -664,19 +774,21 @@ _bfd_elf_merge_symbol (bfd *abfd, Elf_Internal_Sym *sym, asection **psec, bfd_vma *pvalue, + unsigned int *pold_alignment, struct elf_link_hash_entry **sym_hash, bfd_boolean *skip, bfd_boolean *override, bfd_boolean *type_change_ok, bfd_boolean *size_change_ok) { - asection *sec; + asection *sec, *oldsec; struct elf_link_hash_entry *h; struct elf_link_hash_entry *flip; int bind; bfd *oldbfd; bfd_boolean newdyn, olddyn, olddef, newdef, newdyncommon, olddyncommon; bfd_boolean newweak, oldweak; + const struct elf_backend_data *bed; *skip = FALSE; *override = FALSE; @@ -710,30 +822,35 @@ _bfd_elf_merge_symbol (bfd *abfd, if (h->root.type == bfd_link_hash_new) { - h->elf_link_hash_flags &=~ ELF_LINK_NON_ELF; + h->non_elf = 0; return TRUE; } - /* OLDBFD is a BFD associated with the existing symbol. */ + /* OLDBFD and OLDSEC are a BFD and an ASECTION associated with the + existing symbol. */ switch (h->root.type) { default: oldbfd = NULL; + oldsec = NULL; break; case bfd_link_hash_undefined: case bfd_link_hash_undefweak: oldbfd = h->root.u.undef.abfd; + oldsec = NULL; break; case bfd_link_hash_defined: case bfd_link_hash_defweak: oldbfd = h->root.u.def.section->owner; + oldsec = h->root.u.def.section; break; case bfd_link_hash_common: oldbfd = h->root.u.c.p->section->owner; + oldsec = h->root.u.c.p->section; break; } @@ -745,81 +862,122 @@ _bfd_elf_merge_symbol (bfd *abfd, dynamic object, which we do want to handle here. */ if (abfd == oldbfd && ((abfd->flags & DYNAMIC) == 0 - || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)) + || !h->def_regular)) return TRUE; /* NEWDYN and OLDDYN indicate whether the new or old symbol, respectively, is from a dynamic object. */ - if ((abfd->flags & DYNAMIC) != 0) - newdyn = TRUE; - else - newdyn = FALSE; + newdyn = (abfd->flags & DYNAMIC) != 0; + olddyn = FALSE; if (oldbfd != NULL) olddyn = (oldbfd->flags & DYNAMIC) != 0; - else + else if (oldsec != NULL) { - asection *hsec; - - /* This code handles the special SHN_MIPS_{TEXT,DATA} section + /* This handles the special SHN_MIPS_{TEXT,DATA} section indices used by MIPS ELF. */ - switch (h->root.type) - { - default: - hsec = NULL; - break; - - case bfd_link_hash_defined: - case bfd_link_hash_defweak: - hsec = h->root.u.def.section; - break; - - case bfd_link_hash_common: - hsec = h->root.u.c.p->section; - break; - } - - if (hsec == NULL) - olddyn = FALSE; - else - olddyn = (hsec->symbol->flags & BSF_DYNAMIC) != 0; + olddyn = (oldsec->symbol->flags & BSF_DYNAMIC) != 0; } /* NEWDEF and OLDDEF indicate whether the new or old symbol, respectively, appear to be a definition rather than reference. */ - if (bfd_is_und_section (sec) || bfd_is_com_section (sec)) - newdef = FALSE; - else - newdef = TRUE; + newdef = !bfd_is_und_section (sec) && !bfd_is_com_section (sec); - if (h->root.type == bfd_link_hash_undefined - || h->root.type == bfd_link_hash_undefweak - || h->root.type == bfd_link_hash_common) - olddef = FALSE; - else - olddef = TRUE; + olddef = (h->root.type != bfd_link_hash_undefined + && h->root.type != bfd_link_hash_undefweak + && h->root.type != bfd_link_hash_common); + + /* When we try to create a default indirect symbol from the dynamic + definition with the default version, we skip it if its type and + the type of existing regular definition mismatch. We only do it + if the existing regular definition won't be dynamic. */ + if (pold_alignment == NULL + && !info->shared + && !info->export_dynamic + && !h->ref_dynamic + && newdyn + && newdef + && !olddyn + && (olddef || h->root.type == bfd_link_hash_common) + && ELF_ST_TYPE (sym->st_info) != h->type + && ELF_ST_TYPE (sym->st_info) != STT_NOTYPE + && h->type != STT_NOTYPE) + { + *skip = TRUE; + return TRUE; + } + + /* Check TLS symbol. We don't check undefined symbol introduced by + "ld -u". */ + if ((ELF_ST_TYPE (sym->st_info) == STT_TLS || h->type == STT_TLS) + && ELF_ST_TYPE (sym->st_info) != h->type + && oldbfd != NULL) + { + bfd *ntbfd, *tbfd; + bfd_boolean ntdef, tdef; + asection *ntsec, *tsec; + + if (h->type == STT_TLS) + { + ntbfd = abfd; + ntsec = sec; + ntdef = newdef; + tbfd = oldbfd; + tsec = oldsec; + tdef = olddef; + } + else + { + ntbfd = oldbfd; + ntsec = oldsec; + ntdef = olddef; + tbfd = abfd; + tsec = sec; + tdef = newdef; + } + + if (tdef && ntdef) + (*_bfd_error_handler) + (_("%s: TLS definition in %B section %A mismatches non-TLS definition in %B section %A"), + tbfd, tsec, ntbfd, ntsec, h->root.root.string); + else if (!tdef && !ntdef) + (*_bfd_error_handler) + (_("%s: TLS reference in %B mismatches non-TLS reference in %B"), + tbfd, ntbfd, h->root.root.string); + else if (tdef) + (*_bfd_error_handler) + (_("%s: TLS definition in %B section %A mismatches non-TLS reference in %B"), + tbfd, tsec, ntbfd, h->root.root.string); + else + (*_bfd_error_handler) + (_("%s: TLS reference in %B mismatches non-TLS definition in %B section %A"), + tbfd, ntbfd, ntsec, h->root.root.string); + + bfd_set_error (bfd_error_bad_value); + return FALSE; + } /* We need to remember if a symbol has a definition in a dynamic object or is weak in all dynamic objects. Internal and hidden visibility will make it unavailable to dynamic objects. */ - if (newdyn && (h->elf_link_hash_flags & ELF_LINK_DYNAMIC_DEF) == 0) + if (newdyn && !h->dynamic_def) { if (!bfd_is_und_section (sec)) - h->elf_link_hash_flags |= ELF_LINK_DYNAMIC_DEF; + h->dynamic_def = 1; else { /* Check if this symbol is weak in all dynamic objects. If it is the first time we see it in a dynamic object, we mark if it is weak. Otherwise, we clear it. */ - if ((h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0) + if (!h->ref_dynamic) { if (bind == STB_WEAK) - h->elf_link_hash_flags |= ELF_LINK_DYNAMIC_WEAK; + h->dynamic_weak = 1; } else if (bind != STB_WEAK) - h->elf_link_hash_flags &= ~ELF_LINK_DYNAMIC_WEAK; + h->dynamic_weak = 0; } } @@ -831,7 +989,7 @@ _bfd_elf_merge_symbol (bfd *abfd, { *skip = TRUE; /* Make sure this symbol is dynamic. */ - h->elf_link_hash_flags |= ELF_LINK_HASH_REF_DYNAMIC; + h->ref_dynamic = 1; /* A protected symbol has external availability. Make sure it is recorded as dynamic. @@ -843,7 +1001,7 @@ _bfd_elf_merge_symbol (bfd *abfd, } else if (!newdyn && ELF_ST_VISIBILITY (sym->st_other) != STV_DEFAULT - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0) + && h->def_dynamic) { /* If the new symbol with non-default visibility comes from a relocatable file and the old definition comes from a dynamic @@ -851,17 +1009,16 @@ _bfd_elf_merge_symbol (bfd *abfd, if ((*sym_hash)->root.type == bfd_link_hash_indirect) h = *sym_hash; - if ((h->root.und_next || info->hash->undefs_tail == &h->root) + if ((h->root.u.undef.next || info->hash->undefs_tail == &h->root) && bfd_is_und_section (sec)) { /* If the new symbol is undefined and the old symbol was also undefined before, we need to make sure _bfd_generic_link_add_one_symbol doesn't mess - up the linker hash table undefs list. Since the old + up the linker hash table undefs list. Since the old definition came from a dynamic object, it is still on the undefs list. */ h->root.type = bfd_link_hash_undefined; - /* FIXME: What if the new symbol is weak undefined? */ h->root.u.undef.abfd = abfd; } else @@ -870,11 +1027,11 @@ _bfd_elf_merge_symbol (bfd *abfd, h->root.u.undef.abfd = NULL; } - if (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) + if (h->def_dynamic) { - h->elf_link_hash_flags &= ~ELF_LINK_HASH_DEF_DYNAMIC; - h->elf_link_hash_flags |= (ELF_LINK_HASH_REF_DYNAMIC - | ELF_LINK_DYNAMIC_DEF); + h->def_dynamic = 0; + h->ref_dynamic = 1; + h->dynamic_def = 1; } /* FIXME: Should we check type and size for protected symbol? */ h->size = 0; @@ -957,7 +1114,7 @@ _bfd_elf_merge_symbol (bfd *abfd, if (olddyn && olddef && h->root.type == bfd_link_hash_defined - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 + && h->def_dynamic && (h->root.u.def.section->flags & SEC_ALLOC) != 0 && (h->root.u.def.section->flags & SEC_LOAD) == 0 && h->size > 0 @@ -966,6 +1123,19 @@ _bfd_elf_merge_symbol (bfd *abfd, else olddyncommon = FALSE; + /* We now know everything about the old and new symbols. We ask the + backend to check if we can merge them. */ + bed = get_elf_backend_data (abfd); + if (bed->merge_symbol + && !bed->merge_symbol (info, sym_hash, h, sym, psec, pvalue, + pold_alignment, skip, override, + type_change_ok, size_change_ok, + &newdyn, &newdef, &newdyncommon, &newweak, + abfd, &sec, + &olddyn, &olddef, &olddyncommon, &oldweak, + oldbfd, &oldsec)) + return FALSE; + /* If both the old and the new symbols look like common symbols in a dynamic object, set the size of the symbol to the larger of the two. */ @@ -1032,8 +1202,8 @@ _bfd_elf_merge_symbol (bfd *abfd, /* Handle the special case of an old common symbol merging with a new symbol which looks like a common symbol in a shared object. We change *PSEC and *PVALUE to make the new symbol look like a - common symbol, and let _bfd_generic_link_add_one_symbol will do - the right thing. */ + common symbol, and let _bfd_generic_link_add_one_symbol do the + right thing. */ if (newdyncommon && h->root.type == bfd_link_hash_common) @@ -1042,10 +1212,14 @@ _bfd_elf_merge_symbol (bfd *abfd, newdef = FALSE; newdyncommon = FALSE; *pvalue = sym->st_size; - *psec = sec = bfd_com_section_ptr; + *psec = sec = bed->common_section (oldsec); *size_change_ok = TRUE; } + /* Skip weak definitions of symbols that are already defined. */ + if (newdef && olddef && newweak) + *skip = TRUE; + /* If the old symbol is from a dynamic object, and the new symbol is a definition which is not from a dynamic object, then the new symbol overrides the old symbol. Symbols from regular files @@ -1057,14 +1231,14 @@ _bfd_elf_merge_symbol (bfd *abfd, symbol is a function or is weak. */ flip = NULL; - if (! newdyn + if (!newdyn && (newdef || (bfd_is_com_section (sec) && (oldweak || h->type == STT_FUNC))) && olddyn && olddef - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0) + && h->def_dynamic) { /* Change the hash table entry to undefined, and let _bfd_generic_link_add_one_symbol do the right thing with the @@ -1116,9 +1290,10 @@ _bfd_elf_merge_symbol (bfd *abfd, if (h->size > *pvalue) *pvalue = h->size; - /* FIXME: We no longer know the alignment required by the symbol - in the dynamic object, so we just wind up using the one from - the regular object. */ + /* We need to remember the alignment required by the symbol + in the dynamic object. */ + BFD_ASSERT (pold_alignment); + *pold_alignment = h->root.u.def.section->alignment_power; olddef = FALSE; olddyncommon = FALSE; @@ -1144,12 +1319,12 @@ _bfd_elf_merge_symbol (bfd *abfd, flip->root.type = h->root.type; h->root.type = bfd_link_hash_indirect; h->root.u.i.link = (struct bfd_link_hash_entry *) flip; - (*bed->elf_backend_copy_indirect_symbol) (bed, flip, h); + (*bed->elf_backend_copy_indirect_symbol) (info, flip, h); flip->root.u.undef.abfd = h->root.u.undef.abfd; - if (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) + if (h->def_dynamic) { - h->elf_link_hash_flags &= ~ELF_LINK_HASH_DEF_DYNAMIC; - flip->elf_link_hash_flags |= ELF_LINK_HASH_REF_DYNAMIC; + h->def_dynamic = 0; + flip->ref_dynamic = 1; } } @@ -1230,8 +1405,8 @@ _bfd_elf_add_default_symbol (bfd *abfd, size_change_ok = FALSE; sec = *psec; if (!_bfd_elf_merge_symbol (abfd, info, shortname, sym, &sec, value, - &hi, &skip, &override, &type_change_ok, - &size_change_ok)) + NULL, &hi, &skip, &override, + &type_change_ok, &size_change_ok)) return FALSE; if (skip) @@ -1272,13 +1447,12 @@ _bfd_elf_add_default_symbol (bfd *abfd, h->root.type = bfd_link_hash_indirect; h->root.u.i.link = (struct bfd_link_hash_entry *) hi; - if (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) + if (h->def_dynamic) { - h->elf_link_hash_flags &=~ ELF_LINK_HASH_DEF_DYNAMIC; - hi->elf_link_hash_flags |= ELF_LINK_HASH_REF_DYNAMIC; - if (hi->elf_link_hash_flags - & (ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_DEF_REGULAR)) + h->def_dynamic = 0; + hi->ref_dynamic = 1; + if (hi->ref_regular + || hi->def_regular) { if (! bfd_elf_link_record_dynamic_symbol (info, hi)) return FALSE; @@ -1299,7 +1473,7 @@ _bfd_elf_add_default_symbol (bfd *abfd, struct elf_link_hash_entry *ht; ht = (struct elf_link_hash_entry *) hi->root.u.i.link; - (*bed->elf_backend_copy_indirect_symbol) (bed, ht, hi); + (*bed->elf_backend_copy_indirect_symbol) (info, ht, hi); /* See if the new flags lead us to realize that the symbol must be dynamic. */ @@ -1308,14 +1482,12 @@ _bfd_elf_add_default_symbol (bfd *abfd, if (! dynamic) { if (info->shared - || ((hi->elf_link_hash_flags - & ELF_LINK_HASH_REF_DYNAMIC) != 0)) + || hi->ref_dynamic) *dynsym = TRUE; } else { - if ((hi->elf_link_hash_flags - & ELF_LINK_HASH_REF_REGULAR) != 0) + if (hi->ref_regular) *dynsym = TRUE; } } @@ -1337,8 +1509,8 @@ nondefault: size_change_ok = FALSE; sec = *psec; if (!_bfd_elf_merge_symbol (abfd, info, shortname, sym, &sec, value, - &hi, &skip, &override, &type_change_ok, - &size_change_ok)) + NULL, &hi, &skip, &override, + &type_change_ok, &size_change_ok)) return FALSE; if (skip) @@ -1352,8 +1524,8 @@ nondefault: if (hi->root.type != bfd_link_hash_defined && hi->root.type != bfd_link_hash_defweak) (*_bfd_error_handler) - (_("%s: warning: unexpected redefinition of indirect versioned symbol `%s'"), - bfd_archive_filename (abfd), shortname); + (_("%B: unexpected redefinition of indirect versioned symbol `%s'"), + abfd, shortname); } else { @@ -1370,7 +1542,7 @@ nondefault: if (hi->root.type == bfd_link_hash_indirect) { - (*bed->elf_backend_copy_indirect_symbol) (bed, h, hi); + (*bed->elf_backend_copy_indirect_symbol) (info, h, hi); /* See if the new flags lead us to realize that the symbol must be dynamic. */ @@ -1379,14 +1551,12 @@ nondefault: if (! dynamic) { if (info->shared - || ((hi->elf_link_hash_flags - & ELF_LINK_HASH_REF_DYNAMIC) != 0)) + || hi->ref_dynamic) *dynsym = TRUE; } else { - if ((hi->elf_link_hash_flags - & ELF_LINK_HASH_REF_REGULAR) != 0) + if (hi->ref_regular) *dynsym = TRUE; } } @@ -1412,8 +1582,8 @@ _bfd_elf_export_symbol (struct elf_link_hash_entry *h, void *data) h = (struct elf_link_hash_entry *) h->root.u.i.link; if (h->dynindx == -1 - && (h->elf_link_hash_flags - & (ELF_LINK_HASH_DEF_REGULAR | ELF_LINK_HASH_REF_REGULAR)) != 0) + && (h->def_regular + || h->ref_regular)) { struct bfd_elf_version_tree *t; struct bfd_elf_version_expr *d; @@ -1468,8 +1638,8 @@ _bfd_elf_link_find_version_dependencies (struct elf_link_hash_entry *h, /* We only care about symbols defined in shared objects with version information. */ - if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0 - || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0 + if (!h->def_dynamic + || h->def_regular || h->dynindx == -1 || h->verinfo.verdef == NULL) return TRUE; @@ -1559,7 +1729,7 @@ _bfd_elf_link_assign_sym_version (struct elf_link_hash_entry *h, void *data) /* We only need version numbers for symbols defined in regular objects. */ - if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + if (!h->def_regular) return TRUE; bed = get_elf_backend_data (sinfo->output_bfd); @@ -1584,7 +1754,7 @@ _bfd_elf_link_assign_sym_version (struct elf_link_hash_entry *h, void *data) if (*p == '\0') { if (hidden) - h->elf_link_hash_flags |= ELF_LINK_HIDDEN; + h->hidden = 1; return TRUE; } @@ -1620,7 +1790,6 @@ _bfd_elf_link_assign_sym_version (struct elf_link_hash_entry *h, void *data) d = (*t->match) (&t->locals, NULL, alc); if (d != NULL && h->dynindx != -1 - && info->shared && ! info->export_dynamic) (*bed->elf_backend_hide_symbol) (info, h, TRUE); } @@ -1671,15 +1840,15 @@ _bfd_elf_link_assign_sym_version (struct elf_link_hash_entry *h, void *data) /* We could not find the version for a symbol when generating a shared archive. Return an error. */ (*_bfd_error_handler) - (_("%s: undefined versioned symbol name %s"), - bfd_get_filename (sinfo->output_bfd), h->root.root.string); + (_("%B: undefined versioned symbol name %s"), + sinfo->output_bfd, h->root.root.string); bfd_set_error (bfd_error_bad_value); sinfo->failed = TRUE; return FALSE; } if (hidden) - h->elf_link_hash_flags |= ELF_LINK_HIDDEN; + h->hidden = 1; } /* If we don't have a version for this symbol, see if we can find @@ -1747,7 +1916,6 @@ _bfd_elf_link_assign_sym_version (struct elf_link_hash_entry *h, void *data) { h->verinfo.vertree = local_ver; if (h->dynindx != -1 - && info->shared && ! info->export_dynamic) { (*bed->elf_backend_hide_symbol) (info, h, TRUE); @@ -1820,9 +1988,10 @@ elf_link_read_relocs_from_section (bfd *abfd, if ((size_t) r_symndx >= nsyms) { (*_bfd_error_handler) - (_("%s: bad reloc symbol index (0x%lx >= 0x%lx) for offset 0x%lx in section `%s'"), - bfd_archive_filename (abfd), (unsigned long) r_symndx, - (unsigned long) nsyms, irela->r_offset, sec->name); + (_("%B: bad reloc symbol index (0x%lx >= 0x%lx)" + " for offset 0x%lx in section `%A'"), + abfd, sec, + (unsigned long) r_symndx, (unsigned long) nsyms, irela->r_offset); bfd_set_error (bfd_error_bad_value); return FALSE; } @@ -1979,7 +2148,9 @@ bfd_boolean _bfd_elf_link_output_relocs (bfd *output_bfd, asection *input_section, Elf_Internal_Shdr *input_rel_hdr, - Elf_Internal_Rela *internal_relocs) + Elf_Internal_Rela *internal_relocs, + struct elf_link_hash_entry **rel_hash + ATTRIBUTE_UNUSED) { Elf_Internal_Rela *irela; Elf_Internal_Rela *irelaend; @@ -2009,10 +2180,8 @@ _bfd_elf_link_output_relocs (bfd *output_bfd, else { (*_bfd_error_handler) - (_("%s: relocation size mismatch in %s section %s"), - bfd_get_filename (output_bfd), - bfd_archive_filename (input_section->owner), - input_section->name); + (_("%B: relocation size mismatch in %B section %A"), + output_bfd, input_section->owner, input_section); bfd_set_error (bfd_error_wrong_object_format); return FALSE; } @@ -2044,6 +2213,20 @@ _bfd_elf_link_output_relocs (bfd *output_bfd, return TRUE; } +/* Make weak undefined symbols in PIE dynamic. */ + +bfd_boolean +_bfd_elf_link_hash_fixup_symbol (struct bfd_link_info *info, + struct elf_link_hash_entry *h) +{ + if (info->pie + && h->dynindx == -1 + && h->root.type == bfd_link_hash_undefweak) + return bfd_elf_link_record_dynamic_symbol (info, h); + + return TRUE; +} + /* Fix up the flags for a symbol. This handles various cases which can only be fixed after all the input files are seen. This is currently called by both adjust_dynamic_symbol and @@ -2054,33 +2237,39 @@ bfd_boolean _bfd_elf_fix_symbol_flags (struct elf_link_hash_entry *h, struct elf_info_failed *eif) { + const struct elf_backend_data *bed = NULL; + /* If this symbol was mentioned in a non-ELF file, try to set DEF_REGULAR and REF_REGULAR correctly. This is the only way to permit a non-ELF file to correctly refer to a symbol defined in an ELF dynamic object. */ - if ((h->elf_link_hash_flags & ELF_LINK_NON_ELF) != 0) + if (h->non_elf) { while (h->root.type == bfd_link_hash_indirect) 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) - h->elf_link_hash_flags |= (ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_REF_REGULAR_NONWEAK); + { + h->ref_regular = 1; + h->ref_regular_nonweak = 1; + } else { if (h->root.u.def.section->owner != NULL && (bfd_get_flavour (h->root.u.def.section->owner) == bfd_target_elf_flavour)) - h->elf_link_hash_flags |= (ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_REF_REGULAR_NONWEAK); + { + h->ref_regular = 1; + h->ref_regular_nonweak = 1; + } else - h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; + h->def_regular = 1; } if (h->dynindx == -1 - && ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - || (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0)) + && (h->def_dynamic + || h->ref_dynamic)) { if (! bfd_elf_link_record_dynamic_symbol (eif->info, h)) { @@ -2091,7 +2280,7 @@ _bfd_elf_fix_symbol_flags (struct elf_link_hash_entry *h, } else { - /* Unfortunately, ELF_LINK_NON_ELF is only correct if the symbol + /* Unfortunately, NON_ELF is only correct if the symbol was first seen in a non-ELF file. Fortunately, if the symbol was first seen in an ELF file, we're probably OK unless the symbol was defined in a non-ELF file. Catch that case here. @@ -2099,27 +2288,35 @@ _bfd_elf_fix_symbol_flags (struct elf_link_hash_entry *h, a dynamic object, and then later in a non-ELF regular object. */ if ((h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak) - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0 + && !h->def_regular && (h->root.u.def.section->owner != NULL ? (bfd_get_flavour (h->root.u.def.section->owner) != bfd_target_elf_flavour) : (bfd_is_abs_section (h->root.u.def.section) - && (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_DYNAMIC) == 0))) - h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; + && !h->def_dynamic))) + h->def_regular = 1; + } + + /* Backend specific symbol fixup. */ + if (elf_hash_table (eif->info)->dynobj) + { + bed = get_elf_backend_data (elf_hash_table (eif->info)->dynobj); + if (bed->elf_backend_fixup_symbol + && !(*bed->elf_backend_fixup_symbol) (eif->info, h)) + return FALSE; } /* If this is a final link, and the symbol was defined as a common symbol in a regular object file, and there was no definition in any dynamic object, then the linker will have allocated space for - the symbol in a common section but the ELF_LINK_HASH_DEF_REGULAR + the symbol in a common section but the DEF_REGULAR flag will not have been set. */ if (h->root.type == bfd_link_hash_defined - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) != 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0 + && !h->def_regular + && h->ref_regular + && !h->def_dynamic && (h->root.u.def.section->owner->flags & DYNAMIC) == 0) - h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; + h->def_regular = 1; /* If -Bsymbolic was used (which means to bind references to global symbols to the definition within the shared object), and this @@ -2127,18 +2324,15 @@ _bfd_elf_fix_symbol_flags (struct elf_link_hash_entry *h, need a PLT entry. Likewise, if the symbol has non-default visibility. If the symbol has hidden or internal visibility, we will force it local. */ - if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0 + if (h->needs_plt && eif->info->shared && is_elf_hash_table (eif->info->hash) && (eif->info->symbolic || ELF_ST_VISIBILITY (h->other) != STV_DEFAULT) - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0) + && h->def_regular) { - const struct elf_backend_data *bed; bfd_boolean force_local; - bed = get_elf_backend_data (elf_hash_table (eif->info)->dynobj); - force_local = (ELF_ST_VISIBILITY (h->other) == STV_INTERNAL || ELF_ST_VISIBILITY (h->other) == STV_HIDDEN); (*bed->elf_backend_hide_symbol) (eif->info, h, force_local); @@ -2157,11 +2351,11 @@ _bfd_elf_fix_symbol_flags (struct elf_link_hash_entry *h, /* If this is a weak defined symbol in a dynamic object, and we know the real definition in the dynamic object, copy interesting flags over to the real definition. */ - if (h->weakdef != NULL) + if (h->u.weakdef != NULL) { struct elf_link_hash_entry *weakdef; - weakdef = h->weakdef; + weakdef = h->u.weakdef; if (h->root.type == bfd_link_hash_indirect) h = (struct elf_link_hash_entry *) h->root.u.i.link; @@ -2169,20 +2363,16 @@ _bfd_elf_fix_symbol_flags (struct elf_link_hash_entry *h, || h->root.type == bfd_link_hash_defweak); BFD_ASSERT (weakdef->root.type == bfd_link_hash_defined || weakdef->root.type == bfd_link_hash_defweak); - BFD_ASSERT (weakdef->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC); + BFD_ASSERT (weakdef->def_dynamic); /* If the real definition is defined by a regular object file, don't do anything special. See the longer description in _bfd_elf_adjust_dynamic_symbol, below. */ - if ((weakdef->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0) - h->weakdef = NULL; + if (weakdef->def_regular) + h->u.weakdef = NULL; else - { - const struct elf_backend_data *bed; - - bed = get_elf_backend_data (elf_hash_table (eif->info)->dynobj); - (*bed->elf_backend_copy_indirect_symbol) (bed, weakdef, h); - } + (*bed->elf_backend_copy_indirect_symbol) (eif->info, weakdef, + h); } return TRUE; @@ -2204,8 +2394,8 @@ _bfd_elf_adjust_dynamic_symbol (struct elf_link_hash_entry *h, void *data) if (h->root.type == bfd_link_hash_warning) { - h->plt = elf_hash_table (eif->info)->init_offset; - h->got = elf_hash_table (eif->info)->init_offset; + h->got = elf_hash_table (eif->info)->init_got_offset; + h->plt = elf_hash_table (eif->info)->init_plt_offset; /* When warning symbols are created, they **replace** the "real" entry in the hash table, thus we never get to see the real @@ -2228,26 +2418,26 @@ _bfd_elf_adjust_dynamic_symbol (struct elf_link_hash_entry *h, void *data) to the dynamic symbol table. FIXME: Do we normally need to worry about symbols which are defined by one dynamic object and referenced by another one? */ - if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) == 0 - && ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0 - || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0 - || ((h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0 - && (h->weakdef == NULL || h->weakdef->dynindx == -1)))) + if (!h->needs_plt + && (h->def_regular + || !h->def_dynamic + || (!h->ref_regular + && (h->u.weakdef == NULL || h->u.weakdef->dynindx == -1)))) { - h->plt = elf_hash_table (eif->info)->init_offset; + h->plt = elf_hash_table (eif->info)->init_plt_offset; return TRUE; } /* If we've already adjusted this symbol, don't do it again. This can happen via a recursive call. */ - if ((h->elf_link_hash_flags & ELF_LINK_HASH_DYNAMIC_ADJUSTED) != 0) + if (h->dynamic_adjusted) return TRUE; /* Don't look at this symbol again. Note that we must set this after checking the above conditions, because we may look at a symbol once, decide not to do anything, and then get called recursively later after REF_REGULAR is set below. */ - h->elf_link_hash_flags |= ELF_LINK_HASH_DYNAMIC_ADJUSTED; + h->dynamic_adjusted = 1; /* If this is a weak definition, and we know a real definition, and the real symbol is not itself defined by a regular object file, @@ -2277,15 +2467,15 @@ _bfd_elf_adjust_dynamic_symbol (struct elf_link_hash_entry *h, void *data) wind up at different memory locations. The tzset call will set _timezone, leaving timezone unchanged. */ - if (h->weakdef != NULL) + if (h->u.weakdef != NULL) { /* If we get to this point, we know there is an implicit reference by a regular object file via the weak symbol H. FIXME: Is this really true? What if the traversal finds - H->WEAKDEF before it finds H? */ - h->weakdef->elf_link_hash_flags |= ELF_LINK_HASH_REF_REGULAR; + H->U.WEAKDEF before it finds H? */ + h->u.weakdef->ref_regular = 1; - if (! _bfd_elf_adjust_dynamic_symbol (h->weakdef, eif)) + if (! _bfd_elf_adjust_dynamic_symbol (h->u.weakdef, eif)) return FALSE; } @@ -2296,7 +2486,7 @@ _bfd_elf_adjust_dynamic_symbol (struct elf_link_hash_entry *h, void *data) code, and the assembly code fails to set the symbol type. */ if (h->size == 0 && h->type == STT_NOTYPE - && (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) == 0) + && !h->needs_plt) (*_bfd_error_handler) (_("warning: type and size of dynamic symbol `%s' are not defined"), h->root.root.string); @@ -2334,7 +2524,7 @@ _bfd_elf_link_sec_merge_syms (struct elf_link_hash_entry *h, void *data) _bfd_merged_section_offset (output_bfd, &h->root.u.def.section, elf_section_data (sec)->sec_info, - h->root.u.def.value, 0); + h->root.u.def.value); } return TRUE; @@ -2361,7 +2551,7 @@ _bfd_elf_dynamic_symbol_p (struct elf_link_hash_entry *h, /* If it was forced local, then clearly it's not dynamic. */ if (h->dynindx == -1) return FALSE; - if (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) + if (h->forced_local) return FALSE; /* Identify the cases where name binding rules say that a @@ -2378,7 +2568,7 @@ _bfd_elf_dynamic_symbol_p (struct elf_link_hash_entry *h, /* Proper resolution for function pointer equality may require that these symbols perhaps be resolved dynamically, even though we should be resolving them to the current module. */ - if (!ignore_protected) + if (!ignore_protected || h->type != STT_FUNC) binding_stays_local_p = TRUE; break; @@ -2387,7 +2577,7 @@ _bfd_elf_dynamic_symbol_p (struct elf_link_hash_entry *h, } /* If it isn't defined locally, then clearly it's dynamic. */ - if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + if (!h->def_regular) return TRUE; /* Otherwise, the symbol is dynamic if binding rules don't tell @@ -2409,13 +2599,17 @@ _bfd_elf_symbol_refs_local_p (struct elf_link_hash_entry *h, if (h == NULL) return TRUE; + /* Common symbols that become definitions don't get the DEF_REGULAR + flag set, so test it first, and don't bail out. */ + if (ELF_COMMON_DEF_P (h)) + /* Do nothing. */; /* If we don't have a definition in a regular file, then we can't resolve locally. The sym is either undefined or dynamic. */ - if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + else if (!h->def_regular) return FALSE; /* Forced local symbols resolve locally. */ - if ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0) + if (h->forced_local) return TRUE; /* As do non-dynamic symbols. */ @@ -2437,6 +2631,10 @@ _bfd_elf_symbol_refs_local_p (struct elf_link_hash_entry *h, if (ELF_ST_VISIBILITY (h->other) != STV_PROTECTED) return TRUE; + /* STV_PROTECTED non-function symbols are local. */ + if (h->type != STT_FUNC) + return TRUE; + /* Function pointer equality tests may require that STV_PROTECTED symbols be treated as dynamic symbols, even when we know that the dynamic linker will resolve them locally. */ @@ -2476,6 +2674,8 @@ static bfd_boolean is_global_data_symbol_definition (bfd *abfd ATTRIBUTE_UNUSED, Elf_Internal_Sym *sym) { + const struct elf_backend_data *bed; + /* Local symbols do not count, but target specific ones might. */ if (ELF_ST_BIND (sym->st_info) != STB_GLOBAL && ELF_ST_BIND (sym->st_info) < STB_LOOS) @@ -2491,7 +2691,8 @@ is_global_data_symbol_definition (bfd *abfd ATTRIBUTE_UNUSED, /* If the symbol is defined in the common section, then it is a common definition and so does not count. */ - if (sym->st_shndx == SHN_COMMON) + bed = get_elf_backend_data (abfd); + if (bed->common_definition (sym)) return FALSE; /* If the symbol is in a target specific section then we @@ -2613,16 +2814,16 @@ _bfd_elf_add_dynamic_entry (struct bfd_link_info *info, s = bfd_get_section_by_name (hash_table->dynobj, ".dynamic"); BFD_ASSERT (s != NULL); - newsize = s->_raw_size + bed->s->sizeof_dyn; + newsize = s->size + bed->s->sizeof_dyn; newcontents = bfd_realloc (s->contents, newsize); if (newcontents == NULL) return FALSE; dyn.d_tag = tag; dyn.d_un.d_val = val; - bed->s->swap_dyn_out (hash_table->dynobj, &dyn, newcontents + s->_raw_size); + bed->s->swap_dyn_out (hash_table->dynobj, &dyn, newcontents + s->size); - s->_raw_size = newsize; + s->size = newsize; s->contents = newcontents; return TRUE; @@ -2633,7 +2834,8 @@ _bfd_elf_add_dynamic_entry (struct bfd_link_info *info, 1 if a DT_NEEDED tag already exists, and 0 on success. */ static int -elf_add_dt_needed_tag (struct bfd_link_info *info, +elf_add_dt_needed_tag (bfd *abfd, + struct bfd_link_info *info, const char *soname, bfd_boolean do_it) { @@ -2641,6 +2843,9 @@ elf_add_dt_needed_tag (struct bfd_link_info *info, bfd_size_type oldsize; bfd_size_type strindex; + if (!_bfd_elf_link_create_dynstrtab (abfd, info)) + return -1; + hash_table = elf_hash_table (info); oldsize = _bfd_elf_strtab_size (hash_table->dynstr); strindex = _bfd_elf_strtab_add (hash_table->dynstr, soname, FALSE); @@ -2655,26 +2860,28 @@ elf_add_dt_needed_tag (struct bfd_link_info *info, bed = get_elf_backend_data (hash_table->dynobj); sdyn = bfd_get_section_by_name (hash_table->dynobj, ".dynamic"); - BFD_ASSERT (sdyn != NULL); + if (sdyn != NULL) + for (extdyn = sdyn->contents; + extdyn < sdyn->contents + sdyn->size; + extdyn += bed->s->sizeof_dyn) + { + Elf_Internal_Dyn dyn; - for (extdyn = sdyn->contents; - extdyn < sdyn->contents + sdyn->_raw_size; - extdyn += bed->s->sizeof_dyn) - { - Elf_Internal_Dyn dyn; - - bed->s->swap_dyn_in (hash_table->dynobj, extdyn, &dyn); - if (dyn.d_tag == DT_NEEDED - && dyn.d_un.d_val == strindex) - { - _bfd_elf_strtab_delref (hash_table->dynstr, strindex); - return 1; - } - } + bed->s->swap_dyn_in (hash_table->dynobj, extdyn, &dyn); + if (dyn.d_tag == DT_NEEDED + && dyn.d_un.d_val == strindex) + { + _bfd_elf_strtab_delref (hash_table->dynstr, strindex); + return 1; + } + } } if (do_it) { + if (!_bfd_elf_link_create_dynamic_sections (hash_table->dynobj, info)) + return -1; + if (!_bfd_elf_add_dynamic_entry (info, DT_NEEDED, strindex)) return -1; } @@ -2747,7 +2954,7 @@ elf_finalize_dynstr (bfd *output_bfd, struct bfd_link_info *info) /* Update all .dynamic entries referencing .dynstr strings. */ for (extdyn = sdyn->contents; - extdyn < sdyn->contents + sdyn->_raw_size; + extdyn < sdyn->contents + sdyn->size; extdyn += bed->s->sizeof_dyn) { Elf_Internal_Dyn dyn; @@ -2796,6 +3003,8 @@ elf_finalize_dynstr (bfd *output_bfd, struct bfd_link_info *info) _bfd_elf_swap_verdef_in (output_bfd, (Elf_External_Verdef *) p, &def); p += sizeof (Elf_External_Verdef); + if (def.vd_aux != sizeof (Elf_External_Verdef)) + continue; for (i = 0; i < def.vd_cnt; ++i) { _bfd_elf_swap_verdaux_in (output_bfd, @@ -2852,12 +3061,6 @@ elf_finalize_dynstr (bfd *output_bfd, struct bfd_link_info *info) static bfd_boolean elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) { - bfd_boolean (*add_symbol_hook) - (bfd *, struct bfd_link_info *, Elf_Internal_Sym *, - const char **, flagword *, asection **, bfd_vma *); - bfd_boolean (*check_relocs) - (bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *); - bfd_boolean collect; Elf_Internal_Shdr *hdr; bfd_size_type symcount; bfd_size_type extsymcount; @@ -2874,14 +3077,20 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) Elf_Internal_Sym *isymend; const struct elf_backend_data *bed; bfd_boolean add_needed; - struct elf_link_hash_table * hash_table; + struct elf_link_hash_table *htab; bfd_size_type amt; + void *alloc_mark = NULL; + void *old_tab = NULL; + void *old_hash; + void *old_ent; + struct bfd_link_hash_entry *old_undefs = NULL; + struct bfd_link_hash_entry *old_undefs_tail = NULL; + long old_dynsymcount = 0; + size_t tabsize = 0; + size_t hashsize = 0; - hash_table = elf_hash_table (info); - + htab = elf_hash_table (info); bed = get_elf_backend_data (abfd); - add_symbol_hook = bed->elf_add_symbol_hook; - collect = bed->collect; if ((abfd->flags & DYNAMIC) == 0) dynamic = FALSE; @@ -2893,10 +3102,13 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) hope of using a dynamic object which does not exactly match the format of the output file. */ if (info->relocatable - || !is_elf_hash_table (hash_table) - || hash_table->root.creator != abfd->xvec) + || !is_elf_hash_table (htab) + || htab->root.creator != abfd->xvec) { - bfd_set_error (bfd_error_invalid_operation); + if (info->relocatable) + bfd_set_error (bfd_error_invalid_operation); + else + bfd_set_error (bfd_error_wrong_format); goto error_return; } } @@ -2918,8 +3130,6 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) { char *msg; bfd_size_type sz; - bfd_size_type prefix_len; - const char * gnu_warning_prefix = _("warning: "); name += sizeof ".gnu.warning." - 1; @@ -2936,8 +3146,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) { struct elf_link_hash_entry *h; - h = elf_link_hash_lookup (hash_table, name, - FALSE, FALSE, TRUE); + h = elf_link_hash_lookup (htab, name, FALSE, FALSE, TRUE); /* FIXME: What about bfd_link_hash_common? */ if (h != NULL @@ -2947,35 +3156,35 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) /* We don't want to issue this warning. Clobber the section size so that the warning does not get copied into the output file. */ - s->_raw_size = 0; - s->_cooked_size = 0; + s->size = 0; continue; } } - sz = bfd_section_size (abfd, s); - prefix_len = strlen (gnu_warning_prefix); - msg = bfd_alloc (abfd, prefix_len + sz + 1); + sz = s->size; + msg = bfd_alloc (abfd, sz + 1); if (msg == NULL) goto error_return; - strcpy (msg, gnu_warning_prefix); - if (! bfd_get_section_contents (abfd, s, msg + prefix_len, 0, sz)) + if (! bfd_get_section_contents (abfd, s, msg, 0, sz)) goto error_return; - msg[prefix_len + sz] = '\0'; + msg[sz] = '\0'; if (! (_bfd_generic_link_add_one_symbol (info, abfd, name, BSF_WARNING, s, 0, msg, - FALSE, collect, NULL))) + FALSE, bed->collect, NULL))) goto error_return; if (! info->relocatable) { /* Clobber the section size so that the warning does not get copied into the output file. */ - s->_raw_size = 0; - s->_cooked_size = 0; + s->size = 0; + + /* Also set SEC_EXCLUDE, so that symbols defined in + the warning section don't get copied to the output. */ + s->flags |= SEC_EXCLUDE; } } } @@ -2990,15 +3199,15 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) format. FIXME: If there are no input BFD's of the same format as the output, we can't make a shared library. */ if (info->shared - && is_elf_hash_table (hash_table) - && hash_table->root.creator == abfd->xvec - && ! hash_table->dynamic_sections_created) + && is_elf_hash_table (htab) + && htab->root.creator == abfd->xvec + && !htab->dynamic_sections_created) { if (! _bfd_elf_link_create_dynamic_sections (abfd, info)) goto error_return; } } - else if (!is_elf_hash_table (hash_table)) + else if (!is_elf_hash_table (htab)) goto error_return; else { @@ -3008,17 +3217,21 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) int ret; /* ld --just-symbols and dynamic objects don't mix very well. - Test for --just-symbols by looking at info set up by - _bfd_elf_link_just_syms. */ + ld shouldn't allow it. */ if ((s = abfd->sections) != NULL && s->sec_info_type == ELF_INFO_TYPE_JUST_SYMS) - goto error_return; + abort (); /* If this dynamic lib was specified on the command line with --as-needed in effect, then we don't want to add a DT_NEEDED tag unless the lib is actually used. Similary for libs brought - in by another lib's DT_NEEDED. */ - add_needed = elf_dyn_lib_class (abfd) == DYN_NORMAL; + in by another lib's DT_NEEDED. When --no-add-needed is used + on a dynamic lib, we don't want to add a DT_NEEDED entry for + any dynamic library in DT_NEEDED tags in the dynamic lib at + all. */ + add_needed = (elf_dyn_lib_class (abfd) + & (DYN_AS_NEEDED | DYN_DT_NEEDED + | DYN_NO_NEEDED)) == 0; s = bfd_get_section_by_name (abfd, ".dynamic"); if (s != NULL) @@ -3028,11 +3241,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) int elfsec; unsigned long shlink; - dynbuf = bfd_malloc (s->_raw_size); - if (dynbuf == NULL) - goto error_return; - - if (! bfd_get_section_contents (abfd, s, dynbuf, 0, s->_raw_size)) + if (!bfd_malloc_and_get_section (abfd, s, &dynbuf)) goto error_free_dyn; elfsec = _bfd_elf_section_from_bfd_section (abfd, s); @@ -3041,7 +3250,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) shlink = elf_elfsections (abfd)[elfsec]->sh_link; for (extdyn = dynbuf; - extdyn < dynbuf + s->_raw_size; + extdyn < dynbuf + s->size; extdyn += bed->s->sizeof_dyn) { Elf_Internal_Dyn dyn; @@ -3073,9 +3282,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) n->name = anm; n->by = abfd; n->next = NULL; - for (pn = & hash_table->needed; - *pn != NULL; - pn = &(*pn)->next) + for (pn = &htab->needed; *pn != NULL; pn = &(*pn)->next) ; *pn = n; } @@ -3147,9 +3354,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) if (rpath) { struct bfd_link_needed_list **pn; - for (pn = & hash_table->runpath; - *pn != NULL; - pn = &(*pn)->next) + for (pn = &htab->runpath; *pn != NULL; pn = &(*pn)->next) ; *pn = rpath; } @@ -3163,11 +3368,6 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) file. */ bfd_section_list_clear (abfd); - /* If this is the first dynamic object found in the link, create - the special sections required for dynamic linking. */ - if (! _bfd_elf_link_create_dynamic_sections (abfd, info)) - goto error_return; - /* Find the name to use in a DT_NEEDED entry that refers to this object. If the object has a DT_SONAME entry, we use it. Otherwise, if the generic linker stuck something in @@ -3184,7 +3384,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) will need to know it. */ elf_dt_name (abfd) = soname; - ret = elf_add_dt_needed_tag (info, soname, add_needed); + ret = elf_add_dt_needed_tag (abfd, info, soname, add_needed); if (ret < 0) goto error_return; @@ -3241,7 +3441,8 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) if (dynamic) { /* Read in any version definitions. */ - if (! _bfd_elf_slurp_version_tables (abfd)) + if (!_bfd_elf_slurp_version_tables (abfd, + info->default_imported_symver)) goto error_free_sym; /* Read in the symbol versions, but don't bother to convert them @@ -3261,8 +3462,77 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) } } - weaks = NULL; + /* If we are loading an as-needed shared lib, save the symbol table + state before we start adding symbols. If the lib turns out + to be unneeded, restore the state. */ + if ((elf_dyn_lib_class (abfd) & DYN_AS_NEEDED) != 0) + { + unsigned int i; + size_t entsize; + for (entsize = 0, i = 0; i < htab->root.table.size; i++) + { + struct bfd_hash_entry *p; + struct elf_link_hash_entry *h; + + for (p = htab->root.table.table[i]; p != NULL; p = p->next) + { + h = (struct elf_link_hash_entry *) p; + entsize += htab->root.table.entsize; + if (h->root.type == bfd_link_hash_warning) + entsize += htab->root.table.entsize; + } + } + + tabsize = htab->root.table.size * sizeof (struct bfd_hash_entry *); + hashsize = extsymcount * sizeof (struct elf_link_hash_entry *); + old_tab = bfd_malloc (tabsize + entsize + hashsize); + if (old_tab == NULL) + goto error_free_vers; + + /* Remember the current objalloc pointer, so that all mem for + symbols added can later be reclaimed. */ + alloc_mark = bfd_hash_allocate (&htab->root.table, 1); + if (alloc_mark == NULL) + goto error_free_vers; + + /* Make a special call to the linker "notice" function to + tell it that we are about to handle an as-needed lib. */ + if (!(*info->callbacks->notice) (info, NULL, abfd, NULL, + notice_as_needed)) + return FALSE; + + + /* Clone the symbol table and sym hashes. Remember some + pointers into the symbol table, and dynamic symbol count. */ + old_hash = (char *) old_tab + tabsize; + old_ent = (char *) old_hash + hashsize; + memcpy (old_tab, htab->root.table.table, tabsize); + memcpy (old_hash, sym_hash, hashsize); + old_undefs = htab->root.undefs; + old_undefs_tail = htab->root.undefs_tail; + old_dynsymcount = htab->dynsymcount; + + for (i = 0; i < htab->root.table.size; i++) + { + struct bfd_hash_entry *p; + struct elf_link_hash_entry *h; + + for (p = htab->root.table.table[i]; p != NULL; p = p->next) + { + memcpy (old_ent, p, htab->root.table.entsize); + old_ent = (char *) old_ent + htab->root.table.entsize; + h = (struct elf_link_hash_entry *) p; + if (h->root.type == bfd_link_hash_warning) + { + memcpy (old_ent, h->root.u.i.link, htab->root.table.entsize); + old_ent = (char *) old_ent + htab->root.table.entsize; + } + } + } + } + + weaks = NULL; ever = extversym != NULL ? extversym + extsymoff : NULL; for (isym = isymbuf, isymend = isymbuf + extsymcount; isym < isymend; @@ -3270,7 +3540,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) { int bind; bfd_vma value; - asection *sec; + asection *sec, *new_sec; flagword flags; const char *name; struct elf_link_hash_entry *h; @@ -3279,6 +3549,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) bfd_boolean type_change_ok; bfd_boolean new_weakdef; bfd_boolean override; + bfd_boolean common; unsigned int old_alignment; bfd *old_bfd; @@ -3288,6 +3559,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) sec = NULL; value = isym->st_value; *sym_hash = NULL; + common = bed->common_definition (isym); bind = ELF_ST_BIND (isym->st_info); if (bind == STB_LOCAL) @@ -3300,8 +3572,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) } else if (bind == STB_GLOBAL) { - if (isym->st_shndx != SHN_UNDEF - && isym->st_shndx != SHN_COMMON) + if (isym->st_shndx != SHN_UNDEF && !common) flags = BSF_GLOBAL; } else if (bind == STB_WEAK) @@ -3313,11 +3584,21 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) if (isym->st_shndx == SHN_UNDEF) sec = bfd_und_section_ptr; - else if (isym->st_shndx < SHN_LORESERVE || isym->st_shndx > SHN_HIRESERVE) + else if (isym->st_shndx < SHN_LORESERVE + || isym->st_shndx > SHN_HIRESERVE) { sec = bfd_section_from_elf_index (abfd, isym->st_shndx); if (sec == NULL) sec = bfd_abs_section_ptr; + else if (sec->kept_section) + { + /* Symbols from discarded section are undefined, and have + default visibility. */ + sec = bfd_und_section_ptr; + isym->st_shndx = SHN_UNDEF; + isym->st_other = (STV_DEFAULT + | (isym->st_other & ~ ELF_ST_VISIBILITY (-1))); + } else if ((abfd->flags & (EXEC_P | DYNAMIC)) != 0) value -= sec->vma; } @@ -3347,20 +3628,20 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) if (tcomm == NULL) { - tcomm = bfd_make_section (abfd, ".tcommon"); - if (tcomm == NULL - || !bfd_set_section_flags (abfd, tcomm, (SEC_ALLOC - | SEC_IS_COMMON - | SEC_LINKER_CREATED - | SEC_THREAD_LOCAL))) + tcomm = bfd_make_section_with_flags (abfd, ".tcommon", + (SEC_ALLOC + | SEC_IS_COMMON + | SEC_LINKER_CREATED + | SEC_THREAD_LOCAL)); + if (tcomm == NULL) goto error_free_vers; } sec = tcomm; } - else if (add_symbol_hook) + else if (bed->elf_add_symbol_hook) { - if (! (*add_symbol_hook) (abfd, info, isym, &name, &flags, &sec, - &value)) + if (! (*bed->elf_add_symbol_hook) (abfd, info, isym, &name, &flags, + &sec, &value)) goto error_free_vers; /* The hook function sets the name to NULL if this symbol @@ -3383,112 +3664,125 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) definition = TRUE; size_change_ok = FALSE; - type_change_ok = get_elf_backend_data (abfd)->type_change_ok; + type_change_ok = bed->type_change_ok; old_alignment = 0; old_bfd = NULL; + new_sec = sec; - if (is_elf_hash_table (hash_table)) + if (is_elf_hash_table (htab)) { Elf_Internal_Versym iver; unsigned int vernum = 0; bfd_boolean skip; - if (ever != NULL) + if (ever == NULL) { - _bfd_elf_swap_versym_in (abfd, ever, &iver); - vernum = iver.vs_vers & VERSYM_VERSION; + if (info->default_imported_symver) + /* Use the default symbol version created earlier. */ + iver.vs_vers = elf_tdata (abfd)->cverdefs; + else + iver.vs_vers = 0; + } + else + _bfd_elf_swap_versym_in (abfd, ever, &iver); - /* If this is a hidden symbol, or if it is not version - 1, we append the version name to the symbol name. - However, we do not modify a non-hidden absolute - symbol, because it might be the version symbol - itself. FIXME: What if it isn't? */ - if ((iver.vs_vers & VERSYM_HIDDEN) != 0 - || (vernum > 1 && ! bfd_is_abs_section (sec))) + vernum = iver.vs_vers & VERSYM_VERSION; + + /* If this is a hidden symbol, or if it is not version + 1, we append the version name to the symbol name. + However, we do not modify a non-hidden absolute symbol + if it is not a function, because it might be the version + symbol itself. FIXME: What if it isn't? */ + if ((iver.vs_vers & VERSYM_HIDDEN) != 0 + || (vernum > 1 && (! bfd_is_abs_section (sec) + || ELF_ST_TYPE (isym->st_info) == STT_FUNC))) + { + const char *verstr; + size_t namelen, verlen, newlen; + char *newname, *p; + + if (isym->st_shndx != SHN_UNDEF) { - const char *verstr; - size_t namelen, verlen, newlen; - char *newname, *p; - - if (isym->st_shndx != SHN_UNDEF) - { - if (vernum > elf_tdata (abfd)->dynverdef_hdr.sh_info) - { - (*_bfd_error_handler) - (_("%s: %s: invalid version %u (max %d)"), - bfd_archive_filename (abfd), name, vernum, - elf_tdata (abfd)->dynverdef_hdr.sh_info); - bfd_set_error (bfd_error_bad_value); - goto error_free_vers; - } - else if (vernum > 1) - verstr = - elf_tdata (abfd)->verdef[vernum - 1].vd_nodename; - else - verstr = ""; - } + if (vernum > elf_tdata (abfd)->cverdefs) + verstr = NULL; + else if (vernum > 1) + verstr = + elf_tdata (abfd)->verdef[vernum - 1].vd_nodename; else + verstr = ""; + + if (verstr == NULL) { - /* We cannot simply test for the number of - entries in the VERNEED section since the - numbers for the needed versions do not start - at 0. */ - Elf_Internal_Verneed *t; - - verstr = NULL; - for (t = elf_tdata (abfd)->verref; - t != NULL; - t = t->vn_nextref) - { - Elf_Internal_Vernaux *a; - - for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr) - { - if (a->vna_other == vernum) - { - verstr = a->vna_nodename; - break; - } - } - if (a != NULL) - break; - } - if (verstr == NULL) - { - (*_bfd_error_handler) - (_("%s: %s: invalid needed version %d"), - bfd_archive_filename (abfd), name, vernum); - bfd_set_error (bfd_error_bad_value); - goto error_free_vers; - } + (*_bfd_error_handler) + (_("%B: %s: invalid version %u (max %d)"), + abfd, name, vernum, + elf_tdata (abfd)->cverdefs); + bfd_set_error (bfd_error_bad_value); + goto error_free_vers; } - - namelen = strlen (name); - verlen = strlen (verstr); - newlen = namelen + verlen + 2; - if ((iver.vs_vers & VERSYM_HIDDEN) == 0 - && isym->st_shndx != SHN_UNDEF) - ++newlen; - - newname = bfd_alloc (abfd, newlen); - if (newname == NULL) - goto error_free_vers; - memcpy (newname, name, namelen); - p = newname + namelen; - *p++ = ELF_VER_CHR; - /* If this is a defined non-hidden version symbol, - we add another @ to the name. This indicates the - default version of the symbol. */ - if ((iver.vs_vers & VERSYM_HIDDEN) == 0 - && isym->st_shndx != SHN_UNDEF) - *p++ = ELF_VER_CHR; - memcpy (p, verstr, verlen + 1); - - name = newname; } + else + { + /* We cannot simply test for the number of + entries in the VERNEED section since the + numbers for the needed versions do not start + at 0. */ + Elf_Internal_Verneed *t; + + verstr = NULL; + for (t = elf_tdata (abfd)->verref; + t != NULL; + t = t->vn_nextref) + { + Elf_Internal_Vernaux *a; + + for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr) + { + if (a->vna_other == vernum) + { + verstr = a->vna_nodename; + break; + } + } + if (a != NULL) + break; + } + if (verstr == NULL) + { + (*_bfd_error_handler) + (_("%B: %s: invalid needed version %d"), + abfd, name, vernum); + bfd_set_error (bfd_error_bad_value); + goto error_free_vers; + } + } + + namelen = strlen (name); + verlen = strlen (verstr); + newlen = namelen + verlen + 2; + if ((iver.vs_vers & VERSYM_HIDDEN) == 0 + && isym->st_shndx != SHN_UNDEF) + ++newlen; + + newname = bfd_hash_allocate (&htab->root.table, newlen); + if (newname == NULL) + goto error_free_vers; + memcpy (newname, name, namelen); + p = newname + namelen; + *p++ = ELF_VER_CHR; + /* If this is a defined non-hidden version symbol, + we add another @ to the name. This indicates the + default version of the symbol. */ + if ((iver.vs_vers & VERSYM_HIDDEN) == 0 + && isym->st_shndx != SHN_UNDEF) + *p++ = ELF_VER_CHR; + memcpy (p, verstr, verlen + 1); + + name = newname; } - if (!_bfd_elf_merge_symbol (abfd, info, name, isym, &sec, &value, + if (!_bfd_elf_merge_symbol (abfd, info, name, isym, &sec, + &value, &old_alignment, sym_hash, &skip, &override, &type_change_ok, &size_change_ok)) goto error_free_vers; @@ -3534,7 +3828,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) } if (! (_bfd_generic_link_add_one_symbol - (info, abfd, name, flags, sec, value, NULL, FALSE, collect, + (info, abfd, name, flags, sec, value, NULL, FALSE, bed->collect, (struct bfd_link_hash_entry **) sym_hash))) goto error_free_vers; @@ -3549,8 +3843,8 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) && definition && (flags & BSF_WEAK) != 0 && ELF_ST_TYPE (isym->st_info) != STT_FUNC - && is_elf_hash_table (hash_table) - && h->weakdef == NULL) + && is_elf_hash_table (htab) + && h->u.weakdef == NULL) { /* Keep a list of all weak defined non function symbols from a dynamic object, using the weakdef field. Later in this @@ -3564,18 +3858,25 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) dynamic object, and we will be using that previous definition anyhow. */ - h->weakdef = weaks; + h->u.weakdef = weaks; weaks = h; new_weakdef = TRUE; } /* Set the alignment of a common symbol. */ - if (isym->st_shndx == SHN_COMMON + if ((common || bfd_is_com_section (sec)) && h->root.type == bfd_link_hash_common) { unsigned int align; - align = bfd_log2 (isym->st_value); + if (common) + align = bfd_log2 (isym->st_value); + else + { + /* The new symbol is a common symbol in a shared object. + We need to get the alignment from the section. */ + align = new_sec->alignment_power; + } if (align > old_alignment /* Permit an alignment power of zero if an alignment of one is specified and no other alignments have been specified. */ @@ -3585,18 +3886,16 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) h->root.u.c.p->alignment_power = old_alignment; } - if (is_elf_hash_table (hash_table)) + if (is_elf_hash_table (htab)) { - int old_flags; bfd_boolean dynsym; - int new_flag; /* Check the alignment when a common symbol is involved. This can change when a common symbol is overridden by a normal definition or a common symbol is ignored due to the old normal definition. We need to make sure the maximum alignment is maintained. */ - if ((old_alignment || isym->st_shndx == SHN_COMMON) + if ((old_alignment || common) && h->root.type != bfd_link_hash_common) { unsigned int common_align; @@ -3631,12 +3930,10 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) if (normal_align < common_align) (*_bfd_error_handler) - (_("Warning: alignment %u of symbol `%s' in %s is smaller than %u in %s"), - 1 << normal_align, - name, - bfd_archive_filename (normal_bfd), - 1 << common_align, - bfd_archive_filename (common_bfd)); + (_("Warning: alignment %u of symbol `%s' in %B" + " is smaller than %u in %B"), + normal_bfd, common_bfd, + 1 << normal_align, name, 1 << common_align); } /* Remember the symbol size and type. */ @@ -3645,11 +3942,11 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) { if (h->size != 0 && h->size != isym->st_size && ! size_change_ok) (*_bfd_error_handler) - (_("Warning: size of symbol `%s' changed from %lu in %s to %lu in %s"), + (_("Warning: size of symbol `%s' changed" + " from %lu in %B to %lu in %B"), + old_bfd, abfd, name, (unsigned long) h->size, - bfd_archive_filename (old_bfd), - (unsigned long) isym->st_size, - bfd_archive_filename (abfd)); + (unsigned long) isym->st_size); h->size = isym->st_size; } @@ -3669,9 +3966,9 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) && h->type != ELF_ST_TYPE (isym->st_info) && ! type_change_ok) (*_bfd_error_handler) - (_("Warning: type of symbol `%s' changed from %d to %d in %s"), - name, h->type, ELF_ST_TYPE (isym->st_info), - bfd_archive_filename (abfd)); + (_("Warning: type of symbol `%s' changed" + " from %d to %d in %B"), + abfd, name, h->type, ELF_ST_TYPE (isym->st_info)); h->type = ELF_ST_TYPE (isym->st_info); } @@ -3683,6 +3980,15 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) (*bed->elf_backend_merge_symbol_attribute) (h, isym, definition, dynamic); + /* If this symbol has default visibility and the user has requested + we not re-export it, then mark it as hidden. */ + if (definition && !dynamic + && (abfd->no_export + || (abfd->my_archive && abfd->my_archive->no_export)) + && ELF_ST_VISIBILITY (isym->st_other) != STV_INTERNAL) + isym->st_other = (STV_HIDDEN + | (isym->st_other & ~ELF_ST_VISIBILITY (-1))); + if (isym->st_other != 0 && !dynamic) { unsigned char hvis, symvis, other, nvis; @@ -3709,39 +4015,36 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) 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. */ - old_flags = h->elf_link_hash_flags; dynsym = FALSE; if (! dynamic) { if (! definition) { - new_flag = ELF_LINK_HASH_REF_REGULAR; + h->ref_regular = 1; if (bind != STB_WEAK) - new_flag |= ELF_LINK_HASH_REF_REGULAR_NONWEAK; + h->ref_regular_nonweak = 1; } else - new_flag = ELF_LINK_HASH_DEF_REGULAR; + h->def_regular = 1; if (! info->executable - || (old_flags & (ELF_LINK_HASH_DEF_DYNAMIC - | ELF_LINK_HASH_REF_DYNAMIC)) != 0) + || h->def_dynamic + || h->ref_dynamic) dynsym = TRUE; } else { if (! definition) - new_flag = ELF_LINK_HASH_REF_DYNAMIC; + h->ref_dynamic = 1; else - new_flag = ELF_LINK_HASH_DEF_DYNAMIC; - if ((old_flags & (ELF_LINK_HASH_DEF_REGULAR - | ELF_LINK_HASH_REF_REGULAR)) != 0 - || (h->weakdef != NULL + h->def_dynamic = 1; + if (h->def_regular + || h->ref_regular + || (h->u.weakdef != NULL && ! new_weakdef - && h->weakdef->dynindx != -1)) + && h->u.weakdef->dynindx != -1)) dynsym = TRUE; } - h->elf_link_hash_flags |= new_flag; - /* Check to see if we need to add an indirect symbol for the default name. */ if (definition || h->root.type == bfd_link_hash_common) @@ -3757,13 +4060,13 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) { /* Queue non-default versions so that .symver x, x@FOO aliases can be checked. */ - if (! nondeflt_vers) + if (!nondeflt_vers) { - amt = (isymend - isym + 1) - * sizeof (struct elf_link_hash_entry *); + amt = ((isymend - isym + 1) + * sizeof (struct elf_link_hash_entry *)); nondeflt_vers = bfd_malloc (amt); } - nondeflt_vers [nondeflt_vers_cnt++] = h; + nondeflt_vers[nondeflt_vers_cnt++] = h; } } @@ -3771,11 +4074,11 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) { if (! bfd_elf_link_record_dynamic_symbol (info, h)) goto error_free_vers; - if (h->weakdef != NULL + if (h->u.weakdef != NULL && ! new_weakdef - && h->weakdef->dynindx == -1) + && h->u.weakdef->dynindx == -1) { - if (! bfd_elf_link_record_dynamic_symbol (info, h->weakdef)) + if (!bfd_elf_link_record_dynamic_symbol (info, h->u.weakdef)) goto error_free_vers; } } @@ -3795,17 +4098,28 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) if (!add_needed && definition && dynsym - && (h->elf_link_hash_flags - & ELF_LINK_HASH_REF_REGULAR) != 0) + && h->ref_regular) { int ret; const char *soname = elf_dt_name (abfd); /* A symbol from a library loaded via DT_NEEDED of some other library is referenced by a regular object. - Add a DT_NEEDED entry for it. */ + Add a DT_NEEDED entry for it. Issue an error if + --no-add-needed is used. */ + if ((elf_dyn_lib_class (abfd) & DYN_NO_NEEDED) != 0) + { + (*_bfd_error_handler) + (_("%s: invalid DSO for symbol `%s' definition"), + abfd, name); + bfd_set_error (bfd_error_bad_value); + goto error_free_vers; + } + + elf_dyn_lib_class (abfd) &= ~DYN_AS_NEEDED; + add_needed = TRUE; - ret = elf_add_dt_needed_tag (info, soname, add_needed); + ret = elf_add_dt_needed_tag (abfd, info, soname, add_needed); if (ret < 0) goto error_free_vers; @@ -3814,6 +4128,77 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) } } + if (extversym != NULL) + { + free (extversym); + extversym = NULL; + } + + if (isymbuf != NULL) + { + free (isymbuf); + isymbuf = NULL; + } + + if ((elf_dyn_lib_class (abfd) & DYN_AS_NEEDED) != 0) + { + unsigned int i; + + /* Restore the symbol table. */ + old_hash = (char *) old_tab + tabsize; + old_ent = (char *) old_hash + hashsize; + sym_hash = elf_sym_hashes (abfd); + memcpy (htab->root.table.table, old_tab, tabsize); + memcpy (sym_hash, old_hash, hashsize); + htab->root.undefs = old_undefs; + htab->root.undefs_tail = old_undefs_tail; + for (i = 0; i < htab->root.table.size; i++) + { + struct bfd_hash_entry *p; + struct elf_link_hash_entry *h; + + for (p = htab->root.table.table[i]; p != NULL; p = p->next) + { + h = (struct elf_link_hash_entry *) p; + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + if (h->dynindx >= old_dynsymcount) + _bfd_elf_strtab_delref (htab->dynstr, h->dynstr_index); + + memcpy (p, old_ent, htab->root.table.entsize); + old_ent = (char *) old_ent + htab->root.table.entsize; + h = (struct elf_link_hash_entry *) p; + if (h->root.type == bfd_link_hash_warning) + { + memcpy (h->root.u.i.link, old_ent, htab->root.table.entsize); + old_ent = (char *) old_ent + htab->root.table.entsize; + } + } + } + + /* Make a special call to the linker "notice" function to + tell it that symbols added for crefs may need to be removed. */ + if (!(*info->callbacks->notice) (info, NULL, abfd, NULL, + notice_not_needed)) + return FALSE; + + free (old_tab); + objalloc_free_block ((struct objalloc *) htab->root.table.memory, + alloc_mark); + if (nondeflt_vers != NULL) + free (nondeflt_vers); + return TRUE; + } + + if (old_tab != NULL) + { + if (!(*info->callbacks->notice) (info, NULL, abfd, NULL, + notice_needed)) + return FALSE; + free (old_tab); + old_tab = NULL; + } + /* Now that all the symbols from this input file are created, handle .symver foo, foo@BAR such that any relocs against foo become foo@BAR. */ if (nondeflt_vers != NULL) @@ -3837,7 +4222,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) shortname[amt] = '\0'; hi = (struct elf_link_hash_entry *) - bfd_link_hash_lookup (&hash_table->root, shortname, + bfd_link_hash_lookup (&htab->root, shortname, FALSE, FALSE, FALSE); if (hi != NULL && hi->root.type == h->root.type @@ -3847,7 +4232,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) (*bed->elf_backend_hide_symbol) (info, hi, TRUE); hi->root.type = bfd_link_hash_indirect; hi->root.u.i.link = (struct bfd_link_hash_entry *) h; - (*bed->elf_backend_copy_indirect_symbol) (bed, h, hi); + (*bed->elf_backend_copy_indirect_symbol) (info, h, hi); sym_hash = elf_sym_hashes (abfd); if (sym_hash) for (symidx = 0; symidx < extsymcount; ++symidx) @@ -3863,16 +4248,6 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) nondeflt_vers = NULL; } - if (extversym != NULL) - { - free (extversym); - extversym = NULL; - } - - if (isymbuf != NULL) - free (isymbuf); - isymbuf = NULL; - /* Now set the weakdefs field correctly for all the weak defined symbols we found. The only way to do this is to search all the symbols. Since we only need the information for non functions in @@ -3931,8 +4306,8 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) size_t i, j, idx; hlook = weaks; - weaks = hlook->weakdef; - hlook->weakdef = NULL; + weaks = hlook->u.weakdef; + hlook->u.weakdef = NULL; BFD_ASSERT (hlook->root.type == bfd_link_hash_defined || hlook->root.type == bfd_link_hash_defweak @@ -3983,7 +4358,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) break; else if (h != hlook) { - hlook->weakdef = h; + hlook->u.weakdef = h; /* If the weak definition is in the list of dynamic symbols, make sure the real definition is put @@ -4012,6 +4387,9 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) free (sorted_sym_hash); } + if (bed->check_directives) + (*bed->check_directives) (abfd, info); + /* If this object is the same format as the output object, and it is not a shared library, then let the backend look through the relocs. @@ -4029,11 +4407,10 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) I have no idea how to handle linking PIC code into a file of a different format. It probably can't be done. */ - check_relocs = get_elf_backend_data (abfd)->check_relocs; if (! dynamic - && is_elf_hash_table (hash_table) - && hash_table->root.creator == abfd->xvec - && check_relocs != NULL) + && is_elf_hash_table (htab) + && htab->root.creator == abfd->xvec + && bed->check_relocs != NULL) { asection *o; @@ -4054,7 +4431,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) if (internal_relocs == NULL) goto error_return; - ok = (*check_relocs) (abfd, info, o, internal_relocs); + ok = (*bed->check_relocs) (abfd, info, o, internal_relocs); if (elf_section_data (o)->relocs != internal_relocs) free (internal_relocs); @@ -4068,7 +4445,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) of the .stab/.stabstr sections. */ if (! dynamic && ! info->traditional_format - && is_elf_hash_table (hash_table) + && is_elf_hash_table (htab) && (info->strip != strip_all && info->strip != strip_debugger)) { asection *stabstr; @@ -4089,10 +4466,8 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) struct bfd_elf_section_data *secdata; secdata = elf_section_data (stab); - if (! _bfd_link_section_stabs (abfd, - & hash_table->stab_info, - stab, stabstr, - &secdata->sec_info, + if (! _bfd_link_section_stabs (abfd, &htab->stab_info, stab, + stabstr, &secdata->sec_info, &string_offset)) goto error_return; if (secdata->sec_info) @@ -4101,29 +4476,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) } } - if (! info->relocatable - && ! dynamic - && is_elf_hash_table (hash_table)) - { - asection *s; - - for (s = abfd->sections; s != NULL; s = s->next) - if ((s->flags & SEC_MERGE) != 0 - && !bfd_is_abs_section (s->output_section)) - { - struct bfd_elf_section_data *secdata; - - secdata = elf_section_data (s); - if (! _bfd_merge_section (abfd, - & hash_table->merge_info, - s, &secdata->sec_info)) - goto error_return; - else if (secdata->sec_info) - s->sec_info_type = ELF_INFO_TYPE_MERGE; - } - } - - if (is_elf_hash_table (hash_table)) + if (is_elf_hash_table (htab) && add_needed) { /* Add this bfd to the loaded list. */ struct elf_link_loaded_list *n; @@ -4132,13 +4485,15 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) if (n == NULL) goto error_return; n->abfd = abfd; - n->next = hash_table->loaded; - hash_table->loaded = n; + n->next = htab->loaded; + htab->loaded = n; } return TRUE; error_free_vers: + if (old_tab != NULL) + free (old_tab); if (nondeflt_vers != NULL) free (nondeflt_vers); if (extversym != NULL) @@ -4150,6 +4505,55 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) return FALSE; } +/* Return the linker hash table entry of a symbol that might be + satisfied by an archive symbol. Return -1 on error. */ + +struct elf_link_hash_entry * +_bfd_elf_archive_symbol_lookup (bfd *abfd, + struct bfd_link_info *info, + const char *name) +{ + struct elf_link_hash_entry *h; + char *p, *copy; + size_t len, first; + + h = elf_link_hash_lookup (elf_hash_table (info), name, FALSE, FALSE, FALSE); + if (h != NULL) + return h; + + /* If this is a default version (the name contains @@), look up the + symbol again with only one `@' as well as without the version. + The effect is that references to the symbol with and without the + version will be matched by the default symbol in the archive. */ + + p = strchr (name, ELF_VER_CHR); + if (p == NULL || p[1] != ELF_VER_CHR) + return h; + + /* First check with only one `@'. */ + len = strlen (name); + copy = bfd_alloc (abfd, len); + if (copy == NULL) + return (struct elf_link_hash_entry *) 0 - 1; + + first = p - name + 1; + memcpy (copy, name, first); + memcpy (copy + first, name + first + 1, len - first); + + h = elf_link_hash_lookup (elf_hash_table (info), copy, FALSE, FALSE, FALSE); + if (h == NULL) + { + /* We also need to check references to the symbol without the + version. */ + copy[first - 1] = '\0'; + h = elf_link_hash_lookup (elf_hash_table (info), copy, + FALSE, FALSE, FALSE); + } + + bfd_release (abfd, copy); + return h; +} + /* Add symbols from an ELF archive file to the linker hash table. We don't use _bfd_generic_link_add_archive_symbols because of a problem which arises on UnixWare. The UnixWare libc.so is an @@ -4184,6 +4588,9 @@ elf_link_add_archive_symbols (bfd *abfd, struct bfd_link_info *info) carsym *symdefs; bfd_boolean loop; bfd_size_type amt; + const struct elf_backend_data *bed; + struct elf_link_hash_entry * (*archive_symbol_lookup) + (bfd *, struct bfd_link_info *, const char *); if (! bfd_has_map (abfd)) { @@ -4208,6 +4615,8 @@ elf_link_add_archive_symbols (bfd *abfd, struct bfd_link_info *info) goto error_return; symdefs = bfd_ardata (abfd)->symdefs; + bed = get_elf_backend_data (abfd); + archive_symbol_lookup = bed->elf_backend_archive_symbol_lookup; do { @@ -4236,48 +4645,9 @@ elf_link_add_archive_symbols (bfd *abfd, struct bfd_link_info *info) continue; } - h = elf_link_hash_lookup (elf_hash_table (info), symdef->name, - FALSE, FALSE, FALSE); - - if (h == NULL) - { - char *p, *copy; - size_t len, first; - - /* If this is a default version (the name contains @@), - look up the symbol again with only one `@' as well - as without the version. The effect is that references - to the symbol with and without the version will be - matched by the default symbol in the archive. */ - - p = strchr (symdef->name, ELF_VER_CHR); - if (p == NULL || p[1] != ELF_VER_CHR) - continue; - - /* First check with only one `@'. */ - len = strlen (symdef->name); - copy = bfd_alloc (abfd, len); - if (copy == NULL) - goto error_return; - first = p - symdef->name + 1; - memcpy (copy, symdef->name, first); - memcpy (copy + first, symdef->name + first + 1, len - first); - - h = elf_link_hash_lookup (elf_hash_table (info), copy, - FALSE, FALSE, FALSE); - - if (h == NULL) - { - /* We also need to check references to the symbol - without the version. */ - - copy[first - 1] = '\0'; - h = elf_link_hash_lookup (elf_hash_table (info), - copy, FALSE, FALSE, FALSE); - } - - bfd_release (abfd, copy); - } + h = archive_symbol_lookup (abfd, info, symdef->name); + if (h == (struct elf_link_hash_entry *) 0 - 1) + goto error_return; if (h == NULL) continue; @@ -4429,7 +4799,7 @@ elf_collect_hash_codes (struct elf_link_hash_entry *h, void *data) /* And store it in the struct so that we can put it in the hash table later. */ - h->elf_hash_value = ha; + h->u.elf_hash_value = ha; if (alc != NULL) free (alc); @@ -4623,6 +4993,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, if (!is_elf_hash_table (info->hash)) return TRUE; + elf_tdata (output_bfd)->relro = info->relro; if (info->execstack) elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | PF_X; else if (info->noexecstack) @@ -4639,7 +5010,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, { asection *s; - if (inputobj->flags & DYNAMIC) + if (inputobj->flags & (DYNAMIC | BFD_LINKER_CREATED)) continue; s = bfd_get_section_by_name (inputobj, ".note.GNU-stack"); if (s) @@ -4662,7 +5033,10 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, /* Any syms created from now on start with -1 in got.refcount/offset and plt.refcount/offset. */ - elf_hash_table (info)->init_refcount = elf_hash_table (info)->init_offset; + elf_hash_table (info)->init_got_refcount + = elf_hash_table (info)->init_got_offset; + elf_hash_table (info)->init_plt_refcount + = elf_hash_table (info)->init_plt_offset; /* The backend may have to create some sections regardless of whether we're dynamic or not. */ @@ -4688,6 +5062,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, asection *dynstr; struct bfd_elf_version_tree *t; struct bfd_elf_version_expr *d; + asection *s; bfd_boolean all_defined; *sinterpptr = bfd_get_section_by_name (dynobj, ".interp"); @@ -4813,8 +5188,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, /* Mark this version if there is a definition and it is not defined in a shared object. */ if (newh != NULL - && ((newh->elf_link_hash_flags - & ELF_LINK_HASH_DEF_DYNAMIC) == 0) + && !newh->def_dynamic && (newh->root.type == bfd_link_hash_defined || newh->root.type == bfd_link_hash_defweak)) d->symver = 1; @@ -4862,7 +5236,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, return FALSE; /* Add some entries to the .dynamic section. We fill in some of the - values later, in elf_bfd_final_link, but we must add the entries + values later, in bfd_elf_final_link, but we must add the entries now so that we know the final size of the .dynamic section. */ /* If there are initialization and/or finalization functions to @@ -4873,8 +5247,8 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, FALSE, FALSE) : NULL); if (h != NULL - && (h->elf_link_hash_flags & (ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_DEF_REGULAR)) != 0) + && (h->ref_regular + || h->def_regular)) { if (!_bfd_elf_add_dynamic_entry (info, DT_INIT, 0)) return FALSE; @@ -4885,14 +5259,15 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, FALSE, FALSE) : NULL); if (h != NULL - && (h->elf_link_hash_flags & (ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_DEF_REGULAR)) != 0) + && (h->ref_regular + || h->def_regular)) { if (!_bfd_elf_add_dynamic_entry (info, DT_FINI, 0)) return FALSE; } - if (bfd_get_section_by_name (output_bfd, ".preinit_array") != NULL) + s = bfd_get_section_by_name (output_bfd, ".preinit_array"); + if (s != NULL && s->linker_has_input) { /* DT_PREINIT_ARRAY is not allowed in shared library. */ if (! info->executable) @@ -4907,8 +5282,8 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, == SHT_PREINIT_ARRAY) { (*_bfd_error_handler) - (_("%s: .preinit_array section is not allowed in DSO"), - bfd_archive_filename (sub)); + (_("%B: .preinit_array section is not allowed in DSO"), + sub); break; } @@ -4920,13 +5295,15 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, || !_bfd_elf_add_dynamic_entry (info, DT_PREINIT_ARRAYSZ, 0)) return FALSE; } - if (bfd_get_section_by_name (output_bfd, ".init_array") != NULL) + s = bfd_get_section_by_name (output_bfd, ".init_array"); + if (s != NULL && s->linker_has_input) { if (!_bfd_elf_add_dynamic_entry (info, DT_INIT_ARRAY, 0) || !_bfd_elf_add_dynamic_entry (info, DT_INIT_ARRAYSZ, 0)) return FALSE; } - if (bfd_get_section_by_name (output_bfd, ".fini_array") != NULL) + s = bfd_get_section_by_name (output_bfd, ".fini_array"); + if (s != NULL && s->linker_has_input) { if (!_bfd_elf_add_dynamic_entry (info, DT_FINI_ARRAY, 0) || !_bfd_elf_add_dynamic_entry (info, DT_FINI_ARRAYSZ, 0)) @@ -4961,11 +5338,8 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, if (elf_hash_table (info)->dynamic_sections_created) { - bfd_size_type dynsymcount; + unsigned long section_sym_count; asection *s; - size_t bucketcount = 0; - size_t hash_entry_size; - unsigned int dtagcount; /* Set up the version definition section. */ s = bfd_get_section_by_name (dynobj, ".gnu.version_d"); @@ -4979,8 +5353,8 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, if (verdefs != NULL && verdefs->vernum == 0) verdefs = verdefs->next; - if (verdefs == NULL) - _bfd_strip_section_from_output (info, s); + if (verdefs == NULL && !info->create_default_symver) + s->flags |= SEC_EXCLUDE; else { unsigned int cdefs; @@ -4989,6 +5363,9 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, bfd_byte *p; Elf_Internal_Verdef def; Elf_Internal_Verdaux defaux; + struct bfd_link_hash_entry *bh; + struct elf_link_hash_entry *h; + const char *name; cdefs = 0; size = 0; @@ -4998,6 +5375,13 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, size += sizeof (Elf_External_Verdaux); ++cdefs; + /* Make space for the default version. */ + if (info->create_default_symver) + { + size += sizeof (Elf_External_Verdef); + ++cdefs; + } + for (t = verdefs; t != NULL; t = t->next) { struct bfd_elf_version_deps *n; @@ -5010,9 +5394,9 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, size += sizeof (Elf_External_Verdaux); } - s->_raw_size = size; - s->contents = bfd_alloc (output_bfd, s->_raw_size); - if (s->contents == NULL && s->_raw_size != 0) + s->size = size; + s->contents = bfd_alloc (output_bfd, s->size); + if (s->contents == NULL && s->size != 0) return FALSE; /* Fill in the version definition section. */ @@ -5023,9 +5407,17 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, def.vd_flags = VER_FLG_BASE; def.vd_ndx = 1; def.vd_cnt = 1; - def.vd_aux = sizeof (Elf_External_Verdef); - def.vd_next = (sizeof (Elf_External_Verdef) - + sizeof (Elf_External_Verdaux)); + if (info->create_default_symver) + { + def.vd_aux = 2 * sizeof (Elf_External_Verdef); + def.vd_next = sizeof (Elf_External_Verdef); + } + else + { + def.vd_aux = sizeof (Elf_External_Verdef); + def.vd_next = (sizeof (Elf_External_Verdef) + + sizeof (Elf_External_Verdaux)); + } if (soname_indx != (bfd_size_type) -1) { @@ -5033,13 +5425,13 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, soname_indx); def.vd_hash = bfd_elf_hash (soname); defaux.vda_name = soname_indx; + name = soname; } else { - const char *name; bfd_size_type indx; - name = basename (output_bfd->filename); + name = lbasename (output_bfd->filename); def.vd_hash = bfd_elf_hash (name); indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr, name, FALSE); @@ -5052,6 +5444,38 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, _bfd_elf_swap_verdef_out (output_bfd, &def, (Elf_External_Verdef *) p); p += sizeof (Elf_External_Verdef); + if (info->create_default_symver) + { + /* Add a symbol representing this version. */ + bh = NULL; + if (! (_bfd_generic_link_add_one_symbol + (info, dynobj, name, BSF_GLOBAL, bfd_abs_section_ptr, + 0, NULL, FALSE, + get_elf_backend_data (dynobj)->collect, &bh))) + return FALSE; + h = (struct elf_link_hash_entry *) bh; + h->non_elf = 0; + h->def_regular = 1; + h->type = STT_OBJECT; + h->verinfo.vertree = NULL; + + if (! bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + + /* Create a duplicate of the base version with the same + aux block, but different flags. */ + def.vd_flags = 0; + def.vd_ndx = 2; + def.vd_aux = sizeof (Elf_External_Verdef); + if (verdefs) + def.vd_next = (sizeof (Elf_External_Verdef) + + sizeof (Elf_External_Verdaux)); + else + def.vd_next = 0; + _bfd_elf_swap_verdef_out (output_bfd, &def, + (Elf_External_Verdef *) p); + p += sizeof (Elf_External_Verdef); + } _bfd_elf_swap_verdaux_out (output_bfd, &defaux, (Elf_External_Verdaux *) p); p += sizeof (Elf_External_Verdaux); @@ -5060,8 +5484,6 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, { unsigned int cdeps; struct bfd_elf_version_deps *n; - struct elf_link_hash_entry *h; - struct bfd_link_hash_entry *bh; cdeps = 0; for (n = t->deps; n != NULL; n = n->next) @@ -5075,8 +5497,8 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, get_elf_backend_data (dynobj)->collect, &bh))) return FALSE; h = (struct elf_link_hash_entry *) bh; - h->elf_link_hash_flags &= ~ ELF_LINK_NON_ELF; - h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; + h->non_elf = 0; + h->def_regular = 1; h->type = STT_OBJECT; h->verinfo.vertree = t; @@ -5089,7 +5511,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, && t->locals.list == NULL && ! t->used) def.vd_flags |= VER_FLG_WEAK; - def.vd_ndx = t->vernum + 1; + def.vd_ndx = t->vernum + (info->create_default_symver ? 2 : 1); def.vd_cnt = cdeps + 1; def.vd_hash = bfd_elf_hash (t->name); def.vd_aux = sizeof (Elf_External_Verdef); @@ -5186,7 +5608,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, &sinfo); if (elf_tdata (output_bfd)->verref == NULL) - _bfd_strip_section_from_output (info, s); + s->flags |= SEC_EXCLUDE; else { Elf_Internal_Verneed *t; @@ -5209,8 +5631,8 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, size += sizeof (Elf_External_Vernaux); } - s->_raw_size = size; - s->contents = bfd_alloc (output_bfd, s->_raw_size); + s->size = size; + s->contents = bfd_alloc (output_bfd, s->size); if (s->contents == NULL) return FALSE; @@ -5232,7 +5654,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr, elf_dt_name (t->vn_bfd) != NULL ? elf_dt_name (t->vn_bfd) - : basename (t->vn_bfd->filename), + : lbasename (t->vn_bfd->filename), FALSE); if (indx == (bfd_size_type) -1) return FALSE; @@ -5275,28 +5697,53 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, } } + if ((elf_tdata (output_bfd)->cverrefs == 0 + && elf_tdata (output_bfd)->cverdefs == 0) + || _bfd_elf_link_renumber_dynsyms (output_bfd, info, + §ion_sym_count) == 0) + { + s = bfd_get_section_by_name (dynobj, ".gnu.version"); + s->flags |= SEC_EXCLUDE; + } + } + return TRUE; +} + +bfd_boolean +bfd_elf_size_dynsym_hash_dynstr (bfd *output_bfd, struct bfd_link_info *info) +{ + if (!is_elf_hash_table (info->hash)) + return TRUE; + + if (elf_hash_table (info)->dynamic_sections_created) + { + bfd *dynobj; + const struct elf_backend_data *bed; + asection *s; + bfd_size_type dynsymcount; + unsigned long section_sym_count; + size_t bucketcount = 0; + size_t hash_entry_size; + unsigned int dtagcount; + + dynobj = elf_hash_table (info)->dynobj; + /* Assign dynsym indicies. In a shared library we generate a section symbol for each output section, which come first. Next come all of the back-end allocated local dynamic syms, followed by the rest of the global symbols. */ - dynsymcount = _bfd_elf_link_renumber_dynsyms (output_bfd, info); + dynsymcount = _bfd_elf_link_renumber_dynsyms (output_bfd, info, + §ion_sym_count); /* Work out the size of the symbol version section. */ s = bfd_get_section_by_name (dynobj, ".gnu.version"); BFD_ASSERT (s != NULL); - if (dynsymcount == 0 - || (verdefs == NULL && elf_tdata (output_bfd)->verref == NULL)) + if (dynsymcount != 0 + && (s->flags & SEC_EXCLUDE) == 0) { - _bfd_strip_section_from_output (info, s); - /* The DYNSYMCOUNT might have changed if we were going to - output a dynamic symbol table entry for S. */ - dynsymcount = _bfd_elf_link_renumber_dynsyms (output_bfd, info); - } - else - { - s->_raw_size = dynsymcount * sizeof (Elf_External_Versym); - s->contents = bfd_zalloc (output_bfd, s->_raw_size); + s->size = dynsymcount * sizeof (Elf_External_Versym); + s->contents = bfd_zalloc (output_bfd, s->size); if (s->contents == NULL) return FALSE; @@ -5312,23 +5759,19 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, section as we went along in elf_link_add_object_symbols. */ s = bfd_get_section_by_name (dynobj, ".dynsym"); BFD_ASSERT (s != NULL); - s->_raw_size = dynsymcount * bed->s->sizeof_sym; - s->contents = bfd_alloc (output_bfd, s->_raw_size); - if (s->contents == NULL && s->_raw_size != 0) - return FALSE; + bed = get_elf_backend_data (output_bfd); + s->size = dynsymcount * bed->s->sizeof_sym; if (dynsymcount != 0) { - Elf_Internal_Sym isym; + s->contents = bfd_alloc (output_bfd, s->size); + if (s->contents == NULL) + return FALSE; - /* The first entry in .dynsym is a dummy symbol. */ - isym.st_value = 0; - isym.st_size = 0; - isym.st_name = 0; - isym.st_info = 0; - isym.st_other = 0; - isym.st_shndx = 0; - bed->s->swap_symbol_out (output_bfd, &isym, s->contents, 0); + /* The first entry in .dynsym is a dummy symbol. + Clear all the section syms, in case we don't output them all. */ + ++section_sym_count; + memset (s->contents, 0, section_sym_count * bed->s->sizeof_sym); } /* Compute the size of the hashing table. As a side effect this @@ -5338,8 +5781,8 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, s = bfd_get_section_by_name (dynobj, ".hash"); BFD_ASSERT (s != NULL); hash_entry_size = elf_section_data (s)->this_hdr.sh_entsize; - s->_raw_size = ((2 + bucketcount + dynsymcount) * hash_entry_size); - s->contents = bfd_zalloc (output_bfd, s->_raw_size); + s->size = ((2 + bucketcount + dynsymcount) * hash_entry_size); + s->contents = bfd_zalloc (output_bfd, s->size); if (s->contents == NULL) return FALSE; @@ -5354,7 +5797,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, elf_finalize_dynstr (output_bfd, info); - s->_raw_size = _bfd_elf_strtab_size (elf_hash_table (info)->dynstr); + s->size = _bfd_elf_strtab_size (elf_hash_table (info)->dynstr); for (dtagcount = 0; dtagcount <= info->spare_dynamic_tags; ++dtagcount) if (!_bfd_elf_add_dynamic_entry (info, DT_NULL, 0)) @@ -5564,10 +6007,10 @@ elf_link_sort_relocs (bfd *abfd, struct bfd_link_info *info, asection **psec) bfd_vma r_sym_mask; reldyn = bfd_get_section_by_name (abfd, ".rela.dyn"); - if (reldyn == NULL || reldyn->_raw_size == 0) + if (reldyn == NULL || reldyn->size == 0) { reldyn = bfd_get_section_by_name (abfd, ".rel.dyn"); - if (reldyn == NULL || reldyn->_raw_size == 0) + if (reldyn == NULL || reldyn->size == 0) return 0; ext_size = bed->s->sizeof_rel; swap_in = bed->s->swap_reloc_in; @@ -5579,17 +6022,17 @@ elf_link_sort_relocs (bfd *abfd, struct bfd_link_info *info, asection **psec) swap_in = bed->s->swap_reloca_in; swap_out = bed->s->swap_reloca_out; } - count = reldyn->_raw_size / ext_size; + count = reldyn->size / ext_size; size = 0; - for (lo = reldyn->link_order_head; lo != NULL; lo = lo->next) + for (lo = reldyn->map_head.link_order; lo != NULL; lo = lo->next) if (lo->type == bfd_indirect_link_order) { asection *o = lo->u.indirect.section; - size += o->_raw_size; + size += o->size; } - if (size != reldyn->_raw_size) + if (size != reldyn->size) return 0; sort_elt = (sizeof (struct elf_link_sort_rela) @@ -5607,14 +6050,22 @@ elf_link_sort_relocs (bfd *abfd, struct bfd_link_info *info, asection **psec) else r_sym_mask = ~(bfd_vma) 0xffffffff; - for (lo = reldyn->link_order_head; lo != NULL; lo = lo->next) + for (lo = reldyn->map_head.link_order; lo != NULL; lo = lo->next) if (lo->type == bfd_indirect_link_order) { bfd_byte *erel, *erelend; asection *o = lo->u.indirect.section; + if (o->contents == NULL && o->size != 0) + { + /* This is a reloc section that is being handled as a normal + section. See bfd_section_from_shdr. We can't combine + relocs in this case. */ + free (sort); + return 0; + } erel = o->contents; - erelend = o->contents + o->_raw_size; + erelend = o->contents + o->size; p = sort + o->output_offset / ext_size * sort_elt; while (erel < erelend) { @@ -5649,14 +6100,14 @@ elf_link_sort_relocs (bfd *abfd, struct bfd_link_info *info, asection **psec) qsort (s_non_relative, count - ret, sort_elt, elf_link_sort_cmp2); - for (lo = reldyn->link_order_head; lo != NULL; lo = lo->next) + for (lo = reldyn->map_head.link_order; lo != NULL; lo = lo->next) if (lo->type == bfd_indirect_link_order) { bfd_byte *erel, *erelend; asection *o = lo->u.indirect.section; erel = o->contents; - erelend = o->contents + o->_raw_size; + erelend = o->contents + o->size; p = sort + o->output_offset / ext_size * sort_elt; while (erel < erelend) { @@ -5765,6 +6216,24 @@ elf_link_output_sym (struct elf_final_link_info *finfo, return TRUE; } +/* Return TRUE if the dynamic symbol SYM in ABFD is supported. */ + +static bfd_boolean +check_dynsym (bfd *abfd, Elf_Internal_Sym *sym) +{ + if (sym->st_shndx > SHN_HIRESERVE) + { + /* The gABI doesn't support dynamic symbols in output sections + beyond 64k. */ + (*_bfd_error_handler) + (_("%B: Too many sections: %d (>= %d)"), + abfd, bfd_count_sections (abfd), SHN_LORESERVE); + bfd_set_error (bfd_error_nonrepresentable_section); + return FALSE; + } + return TRUE; +} + /* For DSOs loaded in via a DT_NEEDED entry, emulate ld.so in allowing an unsatisfied unversioned symbol in the DSO to match a versioned symbol that would normally require an explicit version. @@ -5792,7 +6261,7 @@ elf_link_check_versioned_symbol (struct bfd_link_info *info, case bfd_link_hash_undefweak: abfd = h->root.u.undef.abfd; if ((abfd->flags & DYNAMIC) == 0 - || elf_dyn_lib_class (abfd) != DYN_DT_NEEDED) + || (elf_dyn_lib_class (abfd) & DYN_DT_NEEDED) == 0) return FALSE; break; @@ -5940,33 +6409,43 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data) /* Decide whether to output this symbol in this pass. */ if (eoinfo->localsyms) { - if ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) + if (!h->forced_local) return TRUE; } else { - if ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0) + if (h->forced_local) return TRUE; } bed = get_elf_backend_data (finfo->output_bfd); - /* If we have an undefined symbol reference here then it must have - come from a shared library that is being linked in. (Undefined - references in regular files have already been handled). If we - are reporting errors for this situation then do so now. */ - if (h->root.type == bfd_link_hash_undefined - && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0 - && ! elf_link_check_versioned_symbol (finfo->info, bed, h) - && finfo->info->unresolved_syms_in_shared_libs != RM_IGNORE) + if (h->root.type == bfd_link_hash_undefined) { - if (! ((*finfo->info->callbacks->undefined_symbol) - (finfo->info, h->root.root.string, h->root.u.undef.abfd, - NULL, 0, finfo->info->unresolved_syms_in_shared_libs == RM_GENERATE_ERROR))) + /* If we have an undefined symbol reference here then it must have + come from a shared library that is being linked in. (Undefined + references in regular files have already been handled). */ + bfd_boolean ignore_undef = FALSE; + + /* Some symbols may be special in that the fact that they're + undefined can be safely ignored - let backend determine that. */ + if (bed->elf_backend_ignore_undef_symbol) + ignore_undef = bed->elf_backend_ignore_undef_symbol (h); + + /* If we are reporting errors for this situation then do so now. */ + if (ignore_undef == FALSE + && h->ref_dynamic + && ! h->ref_regular + && ! elf_link_check_versioned_symbol (finfo->info, bed, h) + && finfo->info->unresolved_syms_in_shared_libs != RM_IGNORE) { - eoinfo->failed = TRUE; - return FALSE; + if (! (finfo->info->callbacks->undefined_symbol + (finfo->info, h->root.root.string, h->root.u.undef.abfd, + NULL, 0, finfo->info->unresolved_syms_in_shared_libs == RM_GENERATE_ERROR))) + { + eoinfo->failed = TRUE; + return FALSE; + } } } @@ -5974,20 +6453,22 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data) shared libraries. */ if (! finfo->info->relocatable && (! finfo->info->shared) - && (h->elf_link_hash_flags - & (ELF_LINK_FORCED_LOCAL | ELF_LINK_HASH_REF_DYNAMIC | ELF_LINK_DYNAMIC_DEF | ELF_LINK_DYNAMIC_WEAK)) - == (ELF_LINK_FORCED_LOCAL | ELF_LINK_HASH_REF_DYNAMIC) + && h->forced_local + && h->ref_dynamic + && !h->dynamic_def + && !h->dynamic_weak && ! elf_link_check_versioned_symbol (finfo->info, bed, h)) { (*_bfd_error_handler) - (_("%s: %s symbol `%s' in %s is referenced by DSO"), - bfd_get_filename (finfo->output_bfd), + (_("%B: %s symbol `%s' in %B is referenced by DSO"), + finfo->output_bfd, + h->root.u.def.section == bfd_abs_section_ptr + ? finfo->output_bfd : h->root.u.def.section->owner, ELF_ST_VISIBILITY (h->other) == STV_INTERNAL ? "internal" : ELF_ST_VISIBILITY (h->other) == STV_HIDDEN - ? "hidden" : "local", - h->root.root.string, - bfd_archive_filename (h->root.u.def.section->owner)); + ? "hidden" : "local", + h->root.root.string); eoinfo->failed = TRUE; return FALSE; } @@ -5998,10 +6479,11 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data) output it. */ if (h->indx == -2) strip = FALSE; - else if (((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 - || (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0) - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0 - && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0) + else if ((h->def_dynamic + || h->ref_dynamic + || h->root.type == bfd_link_hash_new) + && !h->def_regular + && !h->ref_regular) strip = TRUE; else if (finfo->info->strip == strip_all) strip = TRUE; @@ -6021,13 +6503,13 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data) nothing else to do unless it is a forced local symbol. */ if (strip && h->dynindx == -1 - && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) + && !h->forced_local) return TRUE; sym.st_value = 0; sym.st_size = h->size; sym.st_other = h->other; - if ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0) + if (h->forced_local) sym.st_info = ELF_ST_INFO (STB_LOCAL, h->type); else if (h->root.type == bfd_link_hash_undefweak || h->root.type == bfd_link_hash_defweak) @@ -6061,10 +6543,8 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data) if (sym.st_shndx == SHN_BAD) { (*_bfd_error_handler) - (_("%s: could not find output section %s for input section %s"), - bfd_get_filename (finfo->output_bfd), - input_sec->output_section->name, - input_sec->name); + (_("%B: could not find output section %A for input section %A"), + finfo->output_bfd, input_sec->output_section, input_sec); eoinfo->failed = TRUE; return FALSE; } @@ -6097,7 +6577,7 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data) case bfd_link_hash_common: input_sec = h->root.u.c.p->section; - sym.st_shndx = SHN_COMMON; + sym.st_shndx = bed->common_section_index (input_sec); sym.st_value = 1 << h->root.u.c.p->alignment_power; break; @@ -6116,11 +6596,11 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data) symbol. FIXME: Not calling elf_backend_finish_dynamic_symbol for forced local syms when non-shared is due to a historical quirk. */ if ((h->dynindx != -1 - || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0) + || h->forced_local) && ((finfo->info->shared && (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT || h->root.type != bfd_link_hash_undefweak)) - || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) + || !h->forced_local) && elf_hash_table (finfo->info)->dynamic_sections_created) { if (! ((*bed->elf_backend_finish_dynamic_symbol) @@ -6138,13 +6618,13 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data) because it might not be marked as undefined until the finish_dynamic_symbol routine gets through with it. */ if (sym.st_shndx == SHN_UNDEF - && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) != 0 + && h->ref_regular && (ELF_ST_BIND (sym.st_info) == STB_GLOBAL || ELF_ST_BIND (sym.st_info) == STB_WEAK)) { int bindtype; - if ((h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR_NONWEAK) != 0) + if (h->ref_regular_nonweak) bindtype = STB_GLOBAL; else bindtype = STB_WEAK; @@ -6157,16 +6637,16 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data) && ELF_ST_VISIBILITY (sym.st_other) != STV_DEFAULT && ELF_ST_BIND (sym.st_info) != STB_WEAK && h->root.type == bfd_link_hash_undefined - && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + && !h->def_regular) { (*_bfd_error_handler) - (_("%s: %s symbol `%s' isn't defined"), - bfd_get_filename (finfo->output_bfd), - ELF_ST_VISIBILITY (sym.st_other) == STV_PROTECTED - ? "protected" - : ELF_ST_VISIBILITY (sym.st_other) == STV_INTERNAL - ? "internal" : "hidden", - h->root.root.string); + (_("%B: %s symbol `%s' isn't defined"), + finfo->output_bfd, + ELF_ST_VISIBILITY (sym.st_other) == STV_PROTECTED + ? "protected" + : ELF_ST_VISIBILITY (sym.st_other) == STV_INTERNAL + ? "internal" : "hidden", + h->root.root.string); eoinfo->failed = TRUE; return FALSE; } @@ -6186,10 +6666,15 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data) sym.st_name = h->dynstr_index; esym = finfo->dynsym_sec->contents + h->dynindx * bed->s->sizeof_sym; + if (! check_dynsym (finfo->output_bfd, &sym)) + { + eoinfo->failed = TRUE; + return FALSE; + } bed->s->swap_symbol_out (finfo->output_bfd, &sym, esym, 0); bucketcount = elf_hash_table (finfo->info)->bucketcount; - bucket = h->elf_hash_value % bucketcount; + bucket = h->u.elf_hash_value % bucketcount; hash_entry_size = elf_section_data (finfo->hash_sec)->this_hdr.sh_entsize; bucketpos = ((bfd_byte *) finfo->hash_sec->contents @@ -6205,7 +6690,7 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data) Elf_Internal_Versym iversym; Elf_External_Versym *eversym; - if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + if (!h->def_regular) { if (h->verinfo.verdef == NULL) iversym.vs_vers = 0; @@ -6218,9 +6703,11 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data) iversym.vs_vers = 1; else iversym.vs_vers = h->verinfo.vertree->vernum + 1; + if (finfo->info->create_default_symver) + iversym.vs_vers++; } - if ((h->elf_link_hash_flags & ELF_LINK_HIDDEN) != 0) + if (h->hidden) iversym.vs_vers |= VERSYM_HIDDEN; eversym = (Elf_External_Versym *) finfo->symver_sec->contents; @@ -6245,6 +6732,9 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data) return TRUE; } +/* Return TRUE if special handling is done for relocs in SEC against + symbols defined in discarded sections. */ + static bfd_boolean elf_section_ignore_discarded_relocs (asection *sec) { @@ -6267,6 +6757,71 @@ elf_section_ignore_discarded_relocs (asection *sec) return FALSE; } +/* Return a mask saying how ld should treat relocations in SEC against + symbols defined in discarded sections. If this function returns + COMPLAIN set, ld will issue a warning message. If this function + returns PRETEND set, and the discarded section was link-once and the + same size as the kept link-once section, ld will pretend that the + symbol was actually defined in the kept section. Otherwise ld will + zero the reloc (at least that is the intent, but some cooperation by + the target dependent code is needed, particularly for REL targets). */ + +unsigned int +_bfd_elf_default_action_discarded (asection *sec) +{ + if (sec->flags & SEC_DEBUGGING) + return PRETEND; + + if (strcmp (".eh_frame", sec->name) == 0) + return 0; + + if (strcmp (".gcc_except_table", sec->name) == 0) + return 0; + + return COMPLAIN | PRETEND; +} + +/* Find a match between a section and a member of a section group. */ + +static asection * +match_group_member (asection *sec, asection *group) +{ + asection *first = elf_next_in_group (group); + asection *s = first; + + while (s != NULL) + { + if (bfd_elf_match_symbols_in_sections (s, sec)) + return s; + + s = elf_next_in_group (s); + if (s == first) + break; + } + + return NULL; +} + +/* Check if the kept section of a discarded section SEC can be used + to replace it. Return the replacement if it is OK. Otherwise return + NULL. */ + +asection * +_bfd_elf_check_kept_section (asection *sec) +{ + asection *kept; + + kept = sec->kept_section; + if (kept != NULL) + { + if (elf_sec_group (sec) != NULL) + kept = match_group_member (sec, kept); + if (kept != NULL && sec->size != kept->size) + kept = NULL; + } + return kept; +} + /* Link an input file into the linker output file. This function handles all the sections and relocations of the input file at once. This is so that we only have to read the local symbols once, and @@ -6303,8 +6858,7 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd) return TRUE; emit_relocs = (finfo->info->relocatable - || finfo->info->emitrelocations - || bed->elf_backend_emit_relocs); + || finfo->info->emitrelocations); symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; if (elf_bad_symtab (input_bfd)) @@ -6365,7 +6919,7 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd) isym->st_value = _bfd_merged_section_offset (output_bfd, &isec, elf_section_data (isec)->sec_info, - isym->st_value, 0); + isym->st_value); } else if (isym->st_shndx == SHN_ABS) isec = bfd_abs_section_ptr; @@ -6373,8 +6927,10 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd) isec = bfd_com_section_ptr; else { - /* Who knows? */ - isec = NULL; + /* Don't attempt to output symbols with st_shnx in the + reserved range other than SHN_ABS and SHN_COMMON. */ + *ppsection = NULL; + continue; } *ppsection = isec; @@ -6405,15 +6961,12 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd) continue; /* If this symbol is defined in a section which we are - discarding, we don't need to keep it, but note that - linker_mark is only reliable for sections that have contents. - For the benefit of the MIPS ELF linker, we check SEC_EXCLUDE - as well as linker_mark. */ - if ((isym->st_shndx < SHN_LORESERVE || isym->st_shndx > SHN_HIRESERVE) - && isec != NULL - && ((! isec->linker_mark && (isec->flags & SEC_HAS_CONTENTS) != 0) - || (! finfo->info->relocatable - && (isec->flags & SEC_EXCLUDE) != 0))) + discarding, we don't need to keep it. */ + if (isym->st_shndx != SHN_UNDEF + && (isym->st_shndx < SHN_LORESERVE || isym->st_shndx > SHN_HIRESERVE) + && (isec == NULL + || bfd_section_removed_from_list (output_bfd, + isec->output_section))) continue; /* Get the name of the symbol. */ @@ -6480,7 +7033,7 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd) } if ((o->flags & SEC_HAS_CONTENTS) == 0 - || (o->_raw_size == 0 && (o->flags & SEC_RELOC) == 0)) + || (o->size == 0 && (o->flags & SEC_RELOC) == 0)) continue; if ((o->flags & SEC_LINKER_CREATED) != 0) @@ -6498,9 +7051,10 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd) contents = elf_section_data (o)->this_hdr.contents; else { + bfd_size_type amt = o->rawsize ? o->rawsize : o->size; + contents = finfo->contents; - if (! bfd_get_section_contents (input_bfd, o, contents, 0, - o->_raw_size)) + if (! bfd_get_section_contents (input_bfd, o, contents, 0, amt)) return FALSE; } @@ -6533,100 +7087,104 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd) from discarded sections and section symbols from removed link-once sections. Complain about relocs against discarded sections. Zero relocs against removed - link-once sections. Preserve debug information as much - as we can. */ + link-once sections. */ if (!elf_section_ignore_discarded_relocs (o)) { Elf_Internal_Rela *rel, *relend; + unsigned int action = (*bed->action_discarded) (o); rel = internal_relocs; relend = rel + o->reloc_count * bed->s->int_rels_per_ext_rel; for ( ; rel < relend; rel++) { unsigned long r_symndx = rel->r_info >> r_sym_shift; - asection *sec; + asection **ps, *sec; + struct elf_link_hash_entry *h = NULL; + const char *sym_name; + + if (r_symndx == STN_UNDEF) + continue; if (r_symndx >= locsymcount || (elf_bad_symtab (input_bfd) && finfo->sections[r_symndx] == NULL)) { - struct elf_link_hash_entry *h; - h = sym_hashes[r_symndx - extsymoff]; + + /* Badly formatted input files can contain relocs that + reference non-existant symbols. Check here so that + we do not seg fault. */ + if (h == NULL) + { + char buffer [32]; + + sprintf_vma (buffer, rel->r_info); + (*_bfd_error_handler) + (_("error: %B contains a reloc (0x%s) for section %A " + "that references a non-existent global symbol"), + input_bfd, o, buffer); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + 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; - /* Complain if the definition comes from a - discarded section. */ - sec = h->root.u.def.section; - if ((h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - && elf_discarded_section (sec)) - { - if ((o->flags & SEC_DEBUGGING) != 0) - { - BFD_ASSERT (r_symndx != 0); - /* Try to preserve debug information. */ - if ((o->flags & SEC_DEBUGGING) != 0 - && sec->kept_section != NULL - && sec->_raw_size == sec->kept_section->_raw_size) - h->root.u.def.section - = sec->kept_section; - else - memset (rel, 0, sizeof (*rel)); - } - else - finfo->info->callbacks->error_handler - (LD_DEFINITION_IN_DISCARDED_SECTION, - _("%T: discarded in section `%s' from %s\n"), - h->root.root.string, - h->root.root.string, - h->root.u.def.section->name, - bfd_archive_filename (h->root.u.def.section->owner)); - } + if (h->root.type != bfd_link_hash_defined + && h->root.type != bfd_link_hash_defweak) + continue; + + ps = &h->root.u.def.section; + sym_name = h->root.root.string; } else { - sec = finfo->sections[r_symndx]; + Elf_Internal_Sym *sym = isymbuf + r_symndx; + ps = &finfo->sections[r_symndx]; + sym_name = bfd_elf_sym_name (input_bfd, + symtab_hdr, + sym, *ps); + } - if (sec != NULL && elf_discarded_section (sec)) + /* Complain if the definition comes from a + discarded section. */ + if ((sec = *ps) != NULL && elf_discarded_section (sec)) + { + BFD_ASSERT (r_symndx != 0); + if (action & COMPLAIN) + (*finfo->info->callbacks->einfo) + (_("%X`%s' referenced in section `%A' of %B: " + "defined in discarded section `%A' of %B\n"), + sym_name, o, input_bfd, sec, sec->owner); + + /* Try to do the best we can to support buggy old + versions of gcc. Pretend that the symbol is + really defined in the kept linkonce section. + FIXME: This is quite broken. Modifying the + symbol here means we will be changing all later + uses of the symbol, not just in this section. */ + if (action & PRETEND) { - if ((o->flags & SEC_DEBUGGING) != 0 - || (sec->flags & SEC_LINK_ONCE) != 0) - { - BFD_ASSERT (r_symndx != 0); - /* Try to preserve debug information. */ - if ((o->flags & SEC_DEBUGGING) != 0 - && sec->kept_section != NULL - && sec->_raw_size == sec->kept_section->_raw_size) - finfo->sections[r_symndx] - = sec->kept_section; - else - { - rel->r_info &= r_type_mask; - rel->r_addend = 0; - } - } - else - { - static int count; - int ok; - char *buf; + asection *kept; - ok = asprintf (&buf, "local symbol %d", - count++); - if (ok <= 0) - buf = (char *) "local symbol"; - finfo->info->callbacks->error_handler - (LD_DEFINITION_IN_DISCARDED_SECTION, - _("%T: discarded in section `%s' from %s\n"), - buf, buf, sec->name, - bfd_archive_filename (input_bfd)); - if (ok != -1) - free (buf); + kept = _bfd_elf_check_kept_section (sec); + if (kept != NULL) + { + *ps = kept; + continue; } } + + /* Remove the symbol reference from the reloc, but + don't kill the reloc completely. This is so that + a zero value will be written into the section, + which may have non-zero contents put there by the + assembler. Zero in things like an eh_frame fde + pc_begin allows stack unwinders to recognize the + fde as bogus. */ + rel->r_info &= r_type_mask; + rel->r_addend = 0; } } } @@ -6664,10 +7222,9 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd) Elf_Internal_Rela *irelaend; bfd_vma last_offset; struct elf_link_hash_entry **rel_hash; + struct elf_link_hash_entry **rel_hash_list; Elf_Internal_Shdr *input_rel_hdr, *input_rel_hdr2; unsigned int next_erel; - bfd_boolean (*reloc_emitter) - (bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *); bfd_boolean rela_normal; input_rel_hdr = &elf_section_data (o)->rel_hdr; @@ -6682,6 +7239,7 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd) rel_hash = (elf_section_data (o->output_section)->rel_hashes + elf_section_data (o->output_section)->rel_count + elf_section_data (o->output_section)->rel_count2); + rel_hash_list = rel_hash; last_offset = o->output_offset; if (!finfo->info->relocatable) last_offset += o->output_section->vma; @@ -6738,7 +7296,7 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd) symbol. We set the rel_hash entry for this reloc to point to the global hash table entry for this symbol. The symbol index is then - set at the end of elf_bfd_final_link. */ + set at the end of bfd_elf_final_link. */ indx = r_symndx - extsymoff; rh = elf_sym_hashes (input_bfd)[indx]; while (rh->root.type == bfd_link_hash_indirect @@ -6765,13 +7323,10 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd) { /* I suppose the backend ought to fill in the section of any STT_SECTION symbol against a - processor specific section. If we have - discarded a section, the output_section will - be the absolute section. */ - if (bfd_is_abs_section (sec) - || (sec != NULL - && bfd_is_abs_section (sec->output_section))) - r_symndx = 0; + processor specific section. */ + r_symndx = 0; + if (bfd_is_abs_section (sec)) + ; else if (sec == NULL || sec->owner == NULL) { bfd_set_error (bfd_error_bad_value); @@ -6779,8 +7334,25 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd) } else { - r_symndx = sec->output_section->target_index; - BFD_ASSERT (r_symndx != 0); + asection *osec = sec->output_section; + + /* If we have discarded a section, the output + section will be the absolute section. In + case of discarded link-once and discarded + SEC_MERGE sections, use the kept section. */ + if (bfd_is_abs_section (osec) + && sec->kept_section != NULL + && sec->kept_section->output_section != NULL) + { + osec = sec->kept_section->output_section; + irela->r_addend -= osec->vma; + } + + if (!bfd_is_abs_section (osec)) + { + r_symndx = osec->target_index; + BFD_ASSERT (r_symndx != 0); + } } /* Adjust the addend according to where the @@ -6850,16 +7422,11 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd) } /* Swap out the relocs. */ - if (bed->elf_backend_emit_relocs - && !(finfo->info->relocatable - || finfo->info->emitrelocations)) - reloc_emitter = bed->elf_backend_emit_relocs; - else - reloc_emitter = _bfd_elf_link_output_relocs; - if (input_rel_hdr->sh_size != 0 - && ! (*reloc_emitter) (output_bfd, o, input_rel_hdr, - internal_relocs)) + && !bed->elf_backend_emit_relocs (output_bfd, o, + input_rel_hdr, + internal_relocs, + rel_hash_list)) return FALSE; input_rel_hdr2 = elf_section_data (o)->rel_hdr2; @@ -6867,8 +7434,11 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd) { internal_relocs += (NUM_SHDR_ENTRIES (input_rel_hdr) * bed->s->int_rels_per_ext_rel); - if (! (*reloc_emitter) (output_bfd, o, input_rel_hdr2, - internal_relocs)) + rel_hash_list += NUM_SHDR_ENTRIES (input_rel_hdr); + if (!bed->elf_backend_emit_relocs (output_bfd, o, + input_rel_hdr2, + internal_relocs, + rel_hash_list)) return FALSE; } } @@ -6903,14 +7473,11 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd) break; default: { - bfd_size_type sec_size; - - sec_size = (o->_cooked_size != 0 ? o->_cooked_size : o->_raw_size); if (! (o->flags & SEC_EXCLUDE) && ! bfd_set_section_contents (output_bfd, o->output_section, contents, (file_ptr) o->output_offset, - sec_size)) + o->size)) return FALSE; } break; @@ -6921,7 +7488,7 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd) } /* Generate a reloc when linking an ELF file. This is a reloc - requested by the linker, and does come from any input file. This + requested by the linker, and does not come from any input file. This is used to build constructor and destructor tables when linking with -Ur. */ @@ -7033,7 +7600,8 @@ elf_reloc_link_order (bfd *output_bfd, else sym_name = link_order->u.reloc.p->u.name; if (! ((*info->callbacks->reloc_overflow) - (info, sym_name, howto->name, addend, NULL, NULL, 0))) + (info, NULL, sym_name, howto->name, addend, NULL, + NULL, (bfd_vma) 0))) { free (buf); return FALSE; @@ -7086,6 +7654,151 @@ elf_reloc_link_order (bfd *output_bfd, return TRUE; } + +/* Get the output vma of the section pointed to by the sh_link field. */ + +static bfd_vma +elf_get_linked_section_vma (struct bfd_link_order *p) +{ + Elf_Internal_Shdr **elf_shdrp; + asection *s; + int elfsec; + + s = p->u.indirect.section; + elf_shdrp = elf_elfsections (s->owner); + elfsec = _bfd_elf_section_from_bfd_section (s->owner, s); + elfsec = elf_shdrp[elfsec]->sh_link; + /* PR 290: + The Intel C compiler generates SHT_IA_64_UNWIND with + SHF_LINK_ORDER. But it doesn't set the sh_link or + sh_info fields. Hence we could get the situation + where elfsec is 0. */ + if (elfsec == 0) + { + const struct elf_backend_data *bed + = get_elf_backend_data (s->owner); + if (bed->link_order_error_handler) + bed->link_order_error_handler + (_("%B: warning: sh_link not set for section `%A'"), s->owner, s); + return 0; + } + else + { + s = elf_shdrp[elfsec]->bfd_section; + return s->output_section->vma + s->output_offset; + } +} + + +/* Compare two sections based on the locations of the sections they are + linked to. Used by elf_fixup_link_order. */ + +static int +compare_link_order (const void * a, const void * b) +{ + bfd_vma apos; + bfd_vma bpos; + + apos = elf_get_linked_section_vma (*(struct bfd_link_order **)a); + bpos = elf_get_linked_section_vma (*(struct bfd_link_order **)b); + if (apos < bpos) + return -1; + return apos > bpos; +} + + +/* Looks for sections with SHF_LINK_ORDER set. Rearranges them into the same + order as their linked sections. Returns false if this could not be done + because an output section includes both ordered and unordered + sections. Ideally we'd do this in the linker proper. */ + +static bfd_boolean +elf_fixup_link_order (bfd *abfd, asection *o) +{ + int seen_linkorder; + int seen_other; + int n; + struct bfd_link_order *p; + bfd *sub; + const struct elf_backend_data *bed = get_elf_backend_data (abfd); + unsigned elfsec; + struct bfd_link_order **sections; + asection *s, *other_sec, *linkorder_sec; + bfd_vma offset; + + other_sec = NULL; + linkorder_sec = NULL; + seen_other = 0; + seen_linkorder = 0; + for (p = o->map_head.link_order; p != NULL; p = p->next) + { + if (p->type == bfd_indirect_link_order) + { + s = p->u.indirect.section; + sub = s->owner; + if (bfd_get_flavour (sub) == bfd_target_elf_flavour + && elf_elfheader (sub)->e_ident[EI_CLASS] == bed->s->elfclass + && (elfsec = _bfd_elf_section_from_bfd_section (sub, s)) + && elfsec < elf_numsections (sub) + && elf_elfsections (sub)[elfsec]->sh_flags & SHF_LINK_ORDER) + { + seen_linkorder++; + linkorder_sec = s; + } + else + { + seen_other++; + other_sec = s; + } + } + else + seen_other++; + + if (seen_other && seen_linkorder) + { + if (other_sec && linkorder_sec) + (*_bfd_error_handler) (_("%A has both ordered [`%A' in %B] and unordered [`%A' in %B] sections"), + o, linkorder_sec, + linkorder_sec->owner, other_sec, + other_sec->owner); + else + (*_bfd_error_handler) (_("%A has both ordered and unordered sections"), + o); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + } + + if (!seen_linkorder) + return TRUE; + + sections = (struct bfd_link_order **) + xmalloc (seen_linkorder * sizeof (struct bfd_link_order *)); + seen_linkorder = 0; + + for (p = o->map_head.link_order; p != NULL; p = p->next) + { + sections[seen_linkorder++] = p; + } + /* Sort the input sections in the order of their linked section. */ + qsort (sections, seen_linkorder, sizeof (struct bfd_link_order *), + compare_link_order); + + /* Change the offsets of the sections. */ + offset = 0; + for (n = 0; n < seen_linkorder; n++) + { + s = sections[n]->u.indirect.section; + offset &= ~(bfd_vma)((1 << s->alignment_power) - 1); + s->output_offset = offset; + sections[n]->offset = offset; + offset += sections[n]->size; + } + + return TRUE; +} + + /* Do the final step of an ELF link. */ bfd_boolean @@ -7126,8 +7839,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) dynobj = elf_hash_table (info)->dynobj; emit_relocs = (info->relocatable - || info->emitrelocations - || bed->elf_backend_emit_relocs); + || info->emitrelocations); finfo.info = info; finfo.output_bfd = abfd; @@ -7177,7 +7889,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) struct bfd_elf_section_data *esdo = elf_section_data (o); o->reloc_count = 0; - for (p = o->link_order_head; p != NULL; p = p->next) + for (p = o->map_head.link_order; p != NULL; p = p->next) { unsigned int reloc_count = 0; struct bfd_elf_section_data *esdi = NULL; @@ -7217,10 +7929,10 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) free (relocs); } - if (sec->_raw_size > max_contents_size) - max_contents_size = sec->_raw_size; - if (sec->_cooked_size > max_contents_size) - max_contents_size = sec->_cooked_size; + if (sec->rawsize > max_contents_size) + max_contents_size = sec->rawsize; + if (sec->size > max_contents_size) + max_contents_size = sec->size; /* We are interested in just local symbols, not all symbols. */ @@ -7336,8 +8048,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) if (! _bfd_elf_compute_section_file_positions (abfd, info)) goto error_return; - /* That created the reloc sections. Set their sizes, and assign - them file positions, and allocate some buffers. */ + /* Set sizes, and assign file positions for reloc sections. */ for (o = abfd->sections; o != NULL; o = o->next) { if ((o->flags & SEC_RELOC) != 0) @@ -7419,22 +8130,6 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) goto error_return; } -#if 0 - /* Some standard ELF linkers do this, but we don't because it causes - bootstrap comparison failures. */ - /* Output a file symbol for the output file as the second symbol. - We output this even if we are discarding local symbols, although - I'm not sure if this is correct. */ - elfsym.st_value = 0; - elfsym.st_size = 0; - elfsym.st_info = ELF_ST_INFO (STB_LOCAL, STT_FILE); - elfsym.st_other = 0; - elfsym.st_shndx = SHN_ABS; - if (! elf_link_output_sym (&finfo, bfd_get_filename (abfd), - &elfsym, bfd_abs_section_ptr, NULL)) - goto error_return; -#endif - /* Output a symbol for each section. We output these even if we are discarding local symbols, since they are used for relocs. These symbols have no names. We store the index of each one in the @@ -7528,15 +8223,14 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) sec && (sec->flags & SEC_THREAD_LOCAL); sec = sec->next) { - bfd_vma size = sec->_raw_size; + bfd_size_type size = sec->size; - if (size == 0 && (sec->flags & SEC_HAS_CONTENTS) == 0) + if (size == 0 + && (sec->flags & SEC_HAS_CONTENTS) == 0) { - struct bfd_link_order *o; - - for (o = sec->link_order_head; o != NULL; o = o->next) - if (size < o->offset + o->size) - size = o->offset + o->size; + struct bfd_link_order *o = sec->map_tail.link_order; + if (o != NULL) + size = o->offset + o->size; } end = sec->vma + size; } @@ -7545,6 +8239,13 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) elf_hash_table (info)->tls_size = end - base; } + /* Reorder SHF_LINK_ORDER sections. */ + for (o = abfd->sections; o != NULL; o = o->next) + { + if (!elf_fixup_link_order (abfd, o)) + return FALSE; + } + /* Since ELF permits relocations to be against local symbols, we must have the local symbols available when we do the relocations. Since we would rather only read the local symbols once, and we @@ -7569,7 +8270,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) sub->output_has_begun = FALSE; for (o = abfd->sections; o != NULL; o = o->next) { - for (p = o->link_order_head; p != NULL; p = p->next) + for (p = o->map_head.link_order; p != NULL; p = p->next) { if (p->type == bfd_indirect_link_order && (bfd_get_flavour ((sub = p->u.indirect.section->owner)) @@ -7627,7 +8328,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) long last_local = 0; /* Write out the section symbols for the output sections. */ - if (info->shared) + if (info->shared || elf_hash_table (info)->is_relocatable_executable) { asection *s; @@ -7642,16 +8343,20 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) bfd_byte *dest; long dynindx; - indx = elf_section_data (s)->this_idx; dynindx = elf_section_data (s)->dynindx; + if (dynindx <= 0) + continue; + indx = elf_section_data (s)->this_idx; BFD_ASSERT (indx > 0); sym.st_shndx = indx; + if (! check_dynsym (abfd, &sym)) + return FALSE; sym.st_value = s->vma; dest = dynsym + dynindx * bed->s->sizeof_sym; + if (last_local < dynindx) + last_local = dynindx; bed->s->swap_symbol_out (abfd, &sym, dest, 0); } - - last_local = bfd_count_sections (abfd); } /* Write out the local dynsyms. */ @@ -7680,6 +8385,8 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) sym.st_shndx = elf_section_data (s->output_section)->this_idx; + if (! check_dynsym (abfd, &sym)) + return FALSE; sym.st_value = (s->output_section->vma + s->output_offset + e->isym.st_value); @@ -7802,7 +8509,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) BFD_ASSERT (o != NULL); dyncon = o->contents; - dynconend = o->contents + o->_raw_size; + dynconend = o->contents + o->size; for (; dyncon < dynconend; dyncon += bed->s->sizeof_dyn) { Elf_Internal_Dyn dyn; @@ -7874,14 +8581,13 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) if (o == NULL) { (*_bfd_error_handler) - (_("%s: could not find output section %s"), - bfd_get_filename (abfd), name); + (_("%B: could not find output section %s"), abfd, name); goto error_return; } - if (o->_raw_size == 0) + if (o->size == 0) (*_bfd_error_handler) (_("warning: %s section has zero size"), name); - dyn.d_un.d_val = o->_raw_size; + dyn.d_un.d_val = o->size; break; case DT_PREINIT_ARRAY: @@ -7916,8 +8622,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) if (o == NULL) { (*_bfd_error_handler) - (_("%s: could not find output section %s"), - bfd_get_filename (abfd), name); + (_("%B: could not find output section %s"), abfd, name); goto error_return; } dyn.d_un.d_ptr = o->vma; @@ -7962,10 +8667,36 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) if (! (*bed->elf_backend_finish_dynamic_sections) (abfd, info)) goto error_return; + /* Check for DT_TEXTREL (late, in case the backend removes it). */ + if (info->warn_shared_textrel && info->shared) + { + bfd_byte *dyncon, *dynconend; + + /* Fix up .dynamic entries. */ + o = bfd_get_section_by_name (dynobj, ".dynamic"); + BFD_ASSERT (o != NULL); + + dyncon = o->contents; + dynconend = o->contents + o->size; + for (; dyncon < dynconend; dyncon += bed->s->sizeof_dyn) + { + Elf_Internal_Dyn dyn; + + bed->s->swap_dyn_in (dynobj, dyncon, &dyn); + + if (dyn.d_tag == DT_TEXTREL) + { + _bfd_error_handler + (_("warning: creating a DT_TEXTREL in a shared object.")); + break; + } + } + } + for (o = dynobj->sections; o != NULL; o = o->next) { if ((o->flags & SEC_HAS_CONTENTS) == 0 - || o->_raw_size == 0 + || o->size == 0 || o->output_section == bfd_abs_section_ptr) continue; if ((o->flags & SEC_LINKER_CREATED) == 0) @@ -7974,6 +8705,10 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) created by _bfd_elf_link_create_dynamic_sections. */ continue; } + if (elf_hash_table (info)->stab_info.stabstr == o) + continue; + if (elf_hash_table (info)->eh_info.hdr_sec == o) + continue; if ((elf_section_data (o->output_section)->this_hdr.sh_type != SHT_STRTAB) || strcmp (bfd_get_section_name (abfd, o), ".dynstr") != 0) @@ -7981,7 +8716,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) if (! bfd_set_section_contents (abfd, o->output_section, o->contents, (file_ptr) o->output_offset, - o->_raw_size)) + o->size)) goto error_return; } else @@ -8007,7 +8742,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) } /* If we have optimized stabs strings, output them. */ - if (elf_hash_table (info)->stab_info != NULL) + if (elf_hash_table (info)->stab_info.stabstr != NULL) { if (! _bfd_write_stab_strings (abfd, &elf_hash_table (info)->stab_info)) goto error_return; @@ -8095,12 +8830,13 @@ typedef asection * (*gc_mark_hook_fn) (asection *, struct bfd_link_info *, Elf_Internal_Rela *, struct elf_link_hash_entry *, Elf_Internal_Sym *); -static bfd_boolean -elf_gc_mark (struct bfd_link_info *info, - asection *sec, - gc_mark_hook_fn gc_mark_hook) +bfd_boolean +_bfd_elf_gc_mark (struct bfd_link_info *info, + asection *sec, + gc_mark_hook_fn gc_mark_hook) { bfd_boolean ret; + bfd_boolean is_eh; asection *group_sec; sec->gc_mark = 1; @@ -8108,11 +8844,12 @@ elf_gc_mark (struct bfd_link_info *info, /* Mark all the sections in the group. */ group_sec = elf_section_data (sec)->next_in_group; if (group_sec && !group_sec->gc_mark) - if (!elf_gc_mark (info, group_sec, gc_mark_hook)) + if (!_bfd_elf_gc_mark (info, group_sec, gc_mark_hook)) return FALSE; /* Look through the section relocs. */ ret = TRUE; + is_eh = strcmp (sec->name, ".eh_frame") == 0; if ((sec->flags & SEC_RELOC) != 0 && sec->reloc_count > 0) { Elf_Internal_Rela *relstart, *rel, *relend; @@ -8175,6 +8912,9 @@ elf_gc_mark (struct bfd_link_info *info, || ELF_ST_BIND (isym[r_symndx].st_info) != STB_LOCAL) { h = sym_hashes[r_symndx - extsymoff]; + 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; rsec = (*gc_mark_hook) (sec, info, rel, h, NULL); } else @@ -8186,7 +8926,9 @@ elf_gc_mark (struct bfd_link_info *info, { if (bfd_get_flavour (rsec->owner) != bfd_target_elf_flavour) rsec->gc_mark = 1; - else if (!elf_gc_mark (info, rsec, gc_mark_hook)) + else if (is_eh) + rsec->gc_mark_from_eh = 1; + else if (!_bfd_elf_gc_mark (info, rsec, gc_mark_hook)) { ret = FALSE; goto out2; @@ -8212,19 +8954,26 @@ elf_gc_mark (struct bfd_link_info *info, /* Sweep symbols in swept sections. Called via elf_link_hash_traverse. */ -static bfd_boolean -elf_gc_sweep_symbol (struct elf_link_hash_entry *h, void *idxptr) -{ - int *idx = idxptr; +struct elf_gc_sweep_symbol_info { + struct bfd_link_info *info; + void (*hide_symbol) (struct bfd_link_info *, struct elf_link_hash_entry *, + bfd_boolean); +}; +static bfd_boolean +elf_gc_sweep_symbol (struct elf_link_hash_entry *h, void *data) +{ if (h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; - if (h->dynindx != -1 - && ((h->root.type != bfd_link_hash_defined - && h->root.type != bfd_link_hash_defweak) - || h->root.u.def.section->gc_mark)) - h->dynindx = (*idx)++; + if ((h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + && !h->root.u.def.section->gc_mark + && !(h->root.u.def.section->owner->flags & DYNAMIC)) + { + struct elf_gc_sweep_symbol_info *inf = data; + (*inf->hide_symbol) (inf->info, h, TRUE); + } return TRUE; } @@ -8235,9 +8984,13 @@ typedef bfd_boolean (*gc_sweep_hook_fn) (bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *); static bfd_boolean -elf_gc_sweep (struct bfd_link_info *info, gc_sweep_hook_fn gc_sweep_hook) +elf_gc_sweep (bfd *abfd, struct bfd_link_info *info) { bfd *sub; + const struct elf_backend_data *bed = get_elf_backend_data (abfd); + gc_sweep_hook_fn gc_sweep_hook = bed->gc_sweep_hook; + unsigned long section_sym_count; + struct elf_gc_sweep_symbol_info sweep_info; for (sub = info->input_bfds; sub != NULL; sub = sub->link_next) { @@ -8248,9 +9001,9 @@ elf_gc_sweep (struct bfd_link_info *info, gc_sweep_hook_fn gc_sweep_hook) for (o = sub->sections; o != NULL; o = o->next) { - /* Keep special sections. Keep .debug sections. */ - if ((o->flags & SEC_LINKER_CREATED) - || (o->flags & SEC_DEBUGGING)) + /* Keep debug and special sections. */ + if ((o->flags & (SEC_DEBUGGING | SEC_LINKER_CREATED)) != 0 + || (o->flags & (SEC_ALLOC | SEC_LOAD | SEC_RELOC)) == 0) o->gc_mark = 1; if (o->gc_mark) @@ -8267,7 +9020,9 @@ elf_gc_sweep (struct bfd_link_info *info, gc_sweep_hook_fn gc_sweep_hook) /* But we also have to update some of the relocation info we collected before. */ if (gc_sweep_hook - && (o->flags & SEC_RELOC) && o->reloc_count > 0) + && (o->flags & SEC_RELOC) != 0 + && o->reloc_count > 0 + && !bfd_is_abs_section (o->output_section)) { Elf_Internal_Rela *internal_relocs; bfd_boolean r; @@ -8292,14 +9047,12 @@ elf_gc_sweep (struct bfd_link_info *info, gc_sweep_hook_fn gc_sweep_hook) /* Remove the symbols that were in the swept sections from the dynamic symbol table. GCFIXME: Anyone know how to get them out of the static symbol table as well? */ - { - int i = 0; - - elf_link_hash_traverse (elf_hash_table (info), elf_gc_sweep_symbol, &i); - - elf_hash_table (info)->dynsymcount = i; - } + sweep_info.info = info; + sweep_info.hide_symbol = bed->elf_backend_hide_symbol; + elf_link_hash_traverse (elf_hash_table (info), elf_gc_sweep_symbol, + &sweep_info); + _bfd_elf_link_renumber_dynsyms (abfd, info, §ion_sym_count); return TRUE; } @@ -8313,26 +9066,26 @@ elf_gc_propagate_vtable_entries_used (struct elf_link_hash_entry *h, void *okp) h = (struct elf_link_hash_entry *) h->root.u.i.link; /* Those that are not vtables. */ - if (h->vtable_parent == NULL) + if (h->vtable == NULL || h->vtable->parent == NULL) return TRUE; /* Those vtables that do not have parents, we cannot merge. */ - if (h->vtable_parent == (struct elf_link_hash_entry *) -1) + if (h->vtable->parent == (struct elf_link_hash_entry *) -1) return TRUE; /* If we've already been done, exit. */ - if (h->vtable_entries_used && h->vtable_entries_used[-1]) + if (h->vtable->used && h->vtable->used[-1]) return TRUE; /* Make sure the parent's table is up to date. */ - elf_gc_propagate_vtable_entries_used (h->vtable_parent, okp); + elf_gc_propagate_vtable_entries_used (h->vtable->parent, okp); - if (h->vtable_entries_used == NULL) + if (h->vtable->used == NULL) { /* None of this table's entries were referenced. Re-use the parent's table. */ - h->vtable_entries_used = h->vtable_parent->vtable_entries_used; - h->vtable_entries_size = h->vtable_parent->vtable_entries_size; + h->vtable->used = h->vtable->parent->vtable->used; + h->vtable->size = h->vtable->parent->vtable->size; } else { @@ -8340,9 +9093,9 @@ elf_gc_propagate_vtable_entries_used (struct elf_link_hash_entry *h, void *okp) bfd_boolean *cu, *pu; /* Or the parent's entries into ours. */ - cu = h->vtable_entries_used; + cu = h->vtable->used; cu[-1] = TRUE; - pu = h->vtable_parent->vtable_entries_used; + pu = h->vtable->parent->vtable->used; if (pu != NULL) { const struct elf_backend_data *bed; @@ -8350,7 +9103,7 @@ elf_gc_propagate_vtable_entries_used (struct elf_link_hash_entry *h, void *okp) bed = get_elf_backend_data (h->root.u.def.section->owner); log_file_align = bed->s->log_file_align; - n = h->vtable_parent->vtable_entries_size >> log_file_align; + n = h->vtable->parent->vtable->size >> log_file_align; while (n--) { if (*pu) @@ -8378,7 +9131,7 @@ elf_gc_smash_unused_vtentry_relocs (struct elf_link_hash_entry *h, void *okp) /* Take care of both those symbols that do not describe vtables as well as those that are not loaded. */ - if (h->vtable_parent == NULL) + if (h->vtable == NULL || h->vtable->parent == NULL) return TRUE; BFD_ASSERT (h->root.type == bfd_link_hash_defined @@ -8400,11 +9153,11 @@ elf_gc_smash_unused_vtentry_relocs (struct elf_link_hash_entry *h, void *okp) if (rel->r_offset >= hstart && rel->r_offset < hend) { /* If the entry is in use, do nothing. */ - if (h->vtable_entries_used - && (rel->r_offset - hstart) < h->vtable_entries_size) + if (h->vtable->used + && (rel->r_offset - hstart) < h->vtable->size) { bfd_vma entry = (rel->r_offset - hstart) >> log_file_align; - if (h->vtable_entries_used[entry]) + if (h->vtable->used[entry]) continue; } /* Otherwise, kill it. */ @@ -8414,6 +9167,30 @@ elf_gc_smash_unused_vtentry_relocs (struct elf_link_hash_entry *h, void *okp) return TRUE; } +/* Mark sections containing dynamically referenced symbols. When + building shared libraries, we must assume that any visible symbol is + referenced. */ + +bfd_boolean +bfd_elf_gc_mark_dynamic_ref_symbol (struct elf_link_hash_entry *h, void *inf) +{ + struct bfd_link_info *info = (struct bfd_link_info *) inf; + + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + if ((h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + && (h->ref_dynamic + || (!info->executable + && h->def_regular + && ELF_ST_VISIBILITY (h->other) != STV_INTERNAL + && ELF_ST_VISIBILITY (h->other) != STV_HIDDEN))) + h->root.u.def.section->flags |= SEC_KEEP; + + return TRUE; +} + /* Do mark and sweep of unused sections. */ bfd_boolean @@ -8424,12 +9201,12 @@ bfd_elf_gc_sections (bfd *abfd, struct bfd_link_info *info) asection * (*gc_mark_hook) (asection *, struct bfd_link_info *, Elf_Internal_Rela *, struct elf_link_hash_entry *h, Elf_Internal_Sym *); + const struct elf_backend_data *bed = get_elf_backend_data (abfd); - if (!get_elf_backend_data (abfd)->can_gc_sections + if (!bed->can_gc_sections || info->relocatable || info->emitrelocations - || !is_elf_hash_table (info->hash) - || elf_hash_table (info)->dynamic_sections_created) + || !is_elf_hash_table (info->hash)) { (*_bfd_error_handler)(_("Warning: gc-sections option ignored")); return TRUE; @@ -8449,9 +9226,14 @@ bfd_elf_gc_sections (bfd *abfd, struct bfd_link_info *info) if (!ok) return FALSE; - /* Grovel through relocs to find out who stays ... */ + /* Mark dynamically referenced symbols. */ + if (elf_hash_table (info)->dynamic_sections_created) + elf_link_hash_traverse (elf_hash_table (info), + bed->gc_mark_dynamic_ref, + info); - gc_mark_hook = get_elf_backend_data (abfd)->gc_mark_hook; + /* Grovel through relocs to find out who stays ... */ + gc_mark_hook = bed->gc_mark_hook; for (sub = info->input_bfds; sub != NULL; sub = sub->link_next) { asection *o; @@ -8460,18 +9242,67 @@ bfd_elf_gc_sections (bfd *abfd, struct bfd_link_info *info) continue; for (o = sub->sections; o != NULL; o = o->next) - { - if (o->flags & SEC_KEEP) - if (!elf_gc_mark (info, o, gc_mark_hook)) + if ((o->flags & SEC_KEEP) != 0 && !o->gc_mark) + if (!_bfd_elf_gc_mark (info, o, gc_mark_hook)) + return FALSE; + } + + /* ... again for sections marked from eh_frame. */ + for (sub = info->input_bfds; sub != NULL; sub = sub->link_next) + { + asection *o; + + if (bfd_get_flavour (sub) != bfd_target_elf_flavour) + continue; + + /* Keep .gcc_except_table.* if the associated .text.* (or the + associated .gnu.linkonce.t.* if .text.* doesn't exist) is + marked. This isn't very nice, but the proper solution, + splitting .eh_frame up and using comdat doesn't pan out + easily due to needing special relocs to handle the + difference of two symbols in separate sections. + Don't keep code sections referenced by .eh_frame. */ + for (o = sub->sections; o != NULL; o = o->next) + if (!o->gc_mark && o->gc_mark_from_eh && (o->flags & SEC_CODE) == 0) + { + if (strncmp (o->name, ".gcc_except_table.", 18) == 0) + { + unsigned long len; + char *fn_name; + asection *fn_text; + + len = strlen (o->name + 18) + 1; + fn_name = bfd_malloc (len + 16); + if (fn_name == NULL) + return FALSE; + + /* Try the first prefix. */ + memcpy (fn_name, ".text.", 6); + memcpy (fn_name + 6, o->name + 18, len); + fn_text = bfd_get_section_by_name (sub, fn_name); + + /* Try the second prefix. */ + if (fn_text == NULL) + { + memcpy (fn_name, ".gnu.linkonce.t.", 16); + memcpy (fn_name + 16, o->name + 18, len); + fn_text = bfd_get_section_by_name (sub, fn_name); + } + + free (fn_name); + if (fn_text == NULL || !fn_text->gc_mark) + continue; + } + + /* If not using specially named exception table section, + then keep whatever we are using. */ + if (!_bfd_elf_gc_mark (info, o, gc_mark_hook)) return FALSE; - } + } } /* ... and mark SEC_EXCLUDE for those that go. */ - if (!elf_gc_sweep (info, get_elf_backend_data (abfd)->gc_sweep_hook)) - return FALSE; - - return TRUE; + return elf_gc_sweep (abfd, info); } /* Called from check_relocs to record the existence of a VTINHERIT reloc. */ @@ -8509,13 +9340,18 @@ bfd_elf_gc_record_vtinherit (bfd *abfd, goto win; } - (*_bfd_error_handler) ("%s: %s+%lu: No symbol found for INHERIT", - bfd_archive_filename (abfd), sec->name, - (unsigned long) offset); + (*_bfd_error_handler) ("%B: %A+%lu: No symbol found for INHERIT", + abfd, sec, (unsigned long) offset); bfd_set_error (bfd_error_invalid_operation); return FALSE; win: + if (!child->vtable) + { + child->vtable = bfd_zalloc (abfd, sizeof (*child->vtable)); + if (!child->vtable) + return FALSE; + } if (!h) { /* This *should* only be the absolute section. It could potentially @@ -8523,10 +9359,10 @@ bfd_elf_gc_record_vtinherit (bfd *abfd, would be bad. It isn't worth paging in the local symbols to be sure though; that case should simply be handled by the assembler. */ - child->vtable_parent = (struct elf_link_hash_entry *) -1; + child->vtable->parent = (struct elf_link_hash_entry *) -1; } else - child->vtable_parent = h; + child->vtable->parent = h; return TRUE; } @@ -8542,10 +9378,17 @@ bfd_elf_gc_record_vtentry (bfd *abfd ATTRIBUTE_UNUSED, const struct elf_backend_data *bed = get_elf_backend_data (abfd); unsigned int log_file_align = bed->s->log_file_align; - if (addend >= h->vtable_entries_size) + if (!h->vtable) + { + h->vtable = bfd_zalloc (abfd, sizeof (*h->vtable)); + if (!h->vtable) + return FALSE; + } + + if (addend >= h->vtable->size) { size_t size, bytes, file_align; - bfd_boolean *ptr = h->vtable_entries_used; + bfd_boolean *ptr = h->vtable->used; /* While the symbol is undefined, we have to be prepared to handle a zero size. */ @@ -8576,7 +9419,7 @@ bfd_elf_gc_record_vtentry (bfd *abfd ATTRIBUTE_UNUSED, { size_t oldbytes; - oldbytes = (((h->vtable_entries_size >> log_file_align) + 1) + oldbytes = (((h->vtable->size >> log_file_align) + 1) * sizeof (bfd_boolean)); memset (((char *) ptr) + oldbytes, 0, bytes - oldbytes); } @@ -8588,11 +9431,11 @@ bfd_elf_gc_record_vtentry (bfd *abfd ATTRIBUTE_UNUSED, return FALSE; /* And arrange for that done flag to be at index -1. */ - h->vtable_entries_used = ptr + 1; - h->vtable_entries_size = size; + h->vtable->used = ptr + 1; + h->vtable->size = size; } - h->vtable_entries_used[addend >> log_file_align] = TRUE; + h->vtable->used[addend >> log_file_align] = TRUE; return TRUE; } @@ -8797,13 +9640,13 @@ bfd_elf_discard_info (bfd *output_bfd, struct bfd_link_info *info) eh = bfd_get_section_by_name (abfd, ".eh_frame"); if (info->relocatable || (eh != NULL - && (eh->_raw_size == 0 + && (eh->size == 0 || bfd_is_abs_section (eh->output_section)))) eh = NULL; stab = bfd_get_section_by_name (abfd, ".stab"); if (stab != NULL - && (stab->_raw_size == 0 + && (stab->size == 0 || bfd_is_abs_section (stab->output_section) || stab->sec_info_type != ELF_INFO_TYPE_STABS)) stab = NULL; @@ -8908,3 +9751,221 @@ bfd_elf_discard_info (bfd *output_bfd, struct bfd_link_info *info) return ret; } + +void +_bfd_elf_section_already_linked (bfd *abfd, struct bfd_section * sec) +{ + flagword flags; + const char *name, *p; + struct bfd_section_already_linked *l; + struct bfd_section_already_linked_hash_entry *already_linked_list; + asection *group; + + /* A single member comdat group section may be discarded by a + linkonce section. See below. */ + if (sec->output_section == bfd_abs_section_ptr) + return; + + flags = sec->flags; + + /* Check if it belongs to a section group. */ + group = elf_sec_group (sec); + + /* Return if it isn't a linkonce section nor a member of a group. A + comdat group section also has SEC_LINK_ONCE set. */ + if ((flags & SEC_LINK_ONCE) == 0 && group == NULL) + return; + + if (group) + { + /* If this is the member of a single member comdat group, check if + the group should be discarded. */ + if (elf_next_in_group (sec) == sec + && (group->flags & SEC_LINK_ONCE) != 0) + sec = group; + else + return; + } + + /* FIXME: When doing a relocatable link, we may have trouble + copying relocations in other sections that refer to local symbols + in the section being discarded. Those relocations will have to + be converted somehow; as of this writing I'm not sure that any of + the backends handle that correctly. + + It is tempting to instead not discard link once sections when + doing a relocatable link (technically, they should be discarded + whenever we are building constructors). However, that fails, + because the linker winds up combining all the link once sections + into a single large link once section, which defeats the purpose + of having link once sections in the first place. + + Also, not merging link once sections in a relocatable link + causes trouble for MIPS ELF, which relies on link once semantics + to handle the .reginfo section correctly. */ + + name = bfd_get_section_name (abfd, sec); + + if (strncmp (name, ".gnu.linkonce.", sizeof (".gnu.linkonce.") - 1) == 0 + && (p = strchr (name + sizeof (".gnu.linkonce.") - 1, '.')) != NULL) + p++; + else + p = name; + + already_linked_list = bfd_section_already_linked_table_lookup (p); + + for (l = already_linked_list->entry; l != NULL; l = l->next) + { + /* We may have 3 different sections on the list: group section, + comdat section and linkonce section. SEC may be a linkonce or + group section. We match a group section with a group section, + a linkonce section with a linkonce section, and ignore comdat + section. */ + if ((flags & SEC_GROUP) == (l->sec->flags & SEC_GROUP) + && strcmp (name, l->sec->name) == 0 + && bfd_coff_get_comdat_section (l->sec->owner, l->sec) == NULL) + { + /* The section has already been linked. See if we should + issue a warning. */ + switch (flags & SEC_LINK_DUPLICATES) + { + default: + abort (); + + case SEC_LINK_DUPLICATES_DISCARD: + break; + + case SEC_LINK_DUPLICATES_ONE_ONLY: + (*_bfd_error_handler) + (_("%B: ignoring duplicate section `%A'"), + abfd, sec); + break; + + case SEC_LINK_DUPLICATES_SAME_SIZE: + if (sec->size != l->sec->size) + (*_bfd_error_handler) + (_("%B: duplicate section `%A' has different size"), + abfd, sec); + break; + + case SEC_LINK_DUPLICATES_SAME_CONTENTS: + if (sec->size != l->sec->size) + (*_bfd_error_handler) + (_("%B: duplicate section `%A' has different size"), + abfd, sec); + else if (sec->size != 0) + { + bfd_byte *sec_contents, *l_sec_contents; + + if (!bfd_malloc_and_get_section (abfd, sec, &sec_contents)) + (*_bfd_error_handler) + (_("%B: warning: could not read contents of section `%A'"), + abfd, sec); + else if (!bfd_malloc_and_get_section (l->sec->owner, l->sec, + &l_sec_contents)) + (*_bfd_error_handler) + (_("%B: warning: could not read contents of section `%A'"), + l->sec->owner, l->sec); + else if (memcmp (sec_contents, l_sec_contents, sec->size) != 0) + (*_bfd_error_handler) + (_("%B: warning: duplicate section `%A' has different contents"), + abfd, sec); + + if (sec_contents) + free (sec_contents); + if (l_sec_contents) + free (l_sec_contents); + } + break; + } + + /* Set the output_section field so that lang_add_section + does not create a lang_input_section structure for this + section. Since there might be a symbol in the section + being discarded, we must retain a pointer to the section + which we are really going to use. */ + sec->output_section = bfd_abs_section_ptr; + sec->kept_section = l->sec; + + if (flags & SEC_GROUP) + { + asection *first = elf_next_in_group (sec); + asection *s = first; + + while (s != NULL) + { + s->output_section = bfd_abs_section_ptr; + /* Record which group discards it. */ + s->kept_section = l->sec; + s = elf_next_in_group (s); + /* These lists are circular. */ + if (s == first) + break; + } + } + + return; + } + } + + if (group) + { + /* If this is the member of a single member comdat group and the + group hasn't be discarded, we check if it matches a linkonce + section. We only record the discarded comdat group. Otherwise + the undiscarded group will be discarded incorrectly later since + itself has been recorded. */ + for (l = already_linked_list->entry; l != NULL; l = l->next) + if ((l->sec->flags & SEC_GROUP) == 0 + && bfd_coff_get_comdat_section (l->sec->owner, l->sec) == NULL + && bfd_elf_match_symbols_in_sections (l->sec, + elf_next_in_group (sec))) + { + elf_next_in_group (sec)->output_section = bfd_abs_section_ptr; + elf_next_in_group (sec)->kept_section = l->sec; + group->output_section = bfd_abs_section_ptr; + break; + } + if (l == NULL) + return; + } + else + /* There is no direct match. But for linkonce section, we should + check if there is a match with comdat group member. We always + record the linkonce section, discarded or not. */ + for (l = already_linked_list->entry; l != NULL; l = l->next) + if (l->sec->flags & SEC_GROUP) + { + asection *first = elf_next_in_group (l->sec); + + if (first != NULL + && elf_next_in_group (first) == first + && bfd_elf_match_symbols_in_sections (first, sec)) + { + sec->output_section = bfd_abs_section_ptr; + sec->kept_section = l->sec; + break; + } + } + + /* This is the first section with this name. Record it. */ + bfd_section_already_linked_table_insert (already_linked_list, sec); +} + +bfd_boolean +_bfd_elf_common_definition (Elf_Internal_Sym *sym) +{ + return sym->st_shndx == SHN_COMMON; +} + +unsigned int +_bfd_elf_common_section_index (asection *sec ATTRIBUTE_UNUSED) +{ + return SHN_COMMON; +} + +asection * +_bfd_elf_common_section (asection *sec ATTRIBUTE_UNUSED) +{ + return bfd_com_section_ptr; +} diff --git a/contrib/binutils/bfd/elfn32-mips.c b/contrib/binutils/bfd/elfn32-mips.c index 973edd52daf..b1211f0c65e 100644 --- a/contrib/binutils/bfd/elfn32-mips.c +++ b/contrib/binutils/bfd/elfn32-mips.c @@ -1,6 +1,6 @@ /* MIPS-specific support for 32-bit ELF Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003 Free Software Foundation, Inc. + 2003, 2004, 2005 Free Software Foundation, Inc. Most of the information added by Ian Lance Taylor, Cygnus Support, . @@ -23,7 +23,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* This file handles MIPS ELF targets. SGI Irix 5 uses a slightly different MIPS ELF from other targets. This matters when linking. @@ -262,9 +262,11 @@ static reloc_howto_type elf_mips_howto_table_rel[] = 0x0000ffff, /* dst_mask */ FALSE), /* pcrel_offset */ - /* 16 bit PC relative reference. */ + /* 16 bit PC relative reference. Note that the ABI document has a typo + and claims R_MIPS_PC16 to be not rightshifted, rendering it useless. + We do the right thing here. */ HOWTO (R_MIPS_PC16, /* type */ - 0, /* rightshift */ + 2, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 16, /* bitsize */ TRUE, /* pc_relative */ @@ -502,7 +504,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] = a) It means building the addend from a R_MIPS_HIGHEST/R_MIPS_HIGHER/ R_MIPS_HI16/R_MIPS_LO16 sequence with varying ordering, using fallable heuristics. - b) No other NEwABI toolchain actually emits such relocations. */ + b) No other NewABI toolchain actually emits such relocations. */ EMPTY_HOWTO (R_MIPS_HIGHER), EMPTY_HOWTO (R_MIPS_HIGHEST), @@ -600,6 +602,160 @@ static reloc_howto_type elf_mips_howto_table_rel[] = 0x00000000, /* src_mask */ 0x00000000, /* dst_mask */ FALSE), /* pcrel_offset */ + + /* TLS GD/LD dynamic relocations. */ + HOWTO (R_MIPS_TLS_DTPMOD32, /* 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_mips_elf_generic_reloc, /* special_function */ + "R_MIPS_TLS_DTPMOD32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + HOWTO (R_MIPS_TLS_DTPREL32, /* 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_mips_elf_generic_reloc, /* special_function */ + "R_MIPS_TLS_DTPREL32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + EMPTY_HOWTO (R_MIPS_TLS_DTPMOD64), + EMPTY_HOWTO (R_MIPS_TLS_DTPREL64), + + /* TLS general dynamic variable reference. */ + HOWTO (R_MIPS_TLS_GD, /* 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_generic_reloc, /* special_function */ + "R_MIPS_TLS_GD", /* name */ + TRUE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* TLS local dynamic variable reference. */ + HOWTO (R_MIPS_TLS_LDM, /* 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_generic_reloc, /* special_function */ + "R_MIPS_TLS_LDM", /* name */ + TRUE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* TLS local dynamic offset. */ + HOWTO (R_MIPS_TLS_DTPREL_HI16, /* 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_generic_reloc, /* special_function */ + "R_MIPS_TLS_DTPREL_HI16", /* name */ + TRUE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* TLS local dynamic offset. */ + HOWTO (R_MIPS_TLS_DTPREL_LO16, /* 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_generic_reloc, /* special_function */ + "R_MIPS_TLS_DTPREL_LO16", /* name */ + TRUE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* TLS thread pointer offset. */ + HOWTO (R_MIPS_TLS_GOTTPREL, /* 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_generic_reloc, /* special_function */ + "R_MIPS_TLS_GOTTPREL", /* name */ + TRUE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* TLS IE dynamic relocations. */ + HOWTO (R_MIPS_TLS_TPREL32, /* 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_mips_elf_generic_reloc, /* special_function */ + "R_MIPS_TLS_TPREL32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + EMPTY_HOWTO (R_MIPS_TLS_TPREL64), + + /* TLS thread pointer offset. */ + HOWTO (R_MIPS_TLS_TPREL_HI16, /* 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_generic_reloc, /* special_function */ + "R_MIPS_TLS_TPREL_HI16", /* name */ + TRUE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* TLS thread pointer offset. */ + HOWTO (R_MIPS_TLS_TPREL_LO16, /* 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_generic_reloc, /* special_function */ + "R_MIPS_TLS_TPREL_LO16", /* name */ + TRUE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ }; /* The relocation table used for SHT_RELA sections. */ @@ -759,9 +915,11 @@ static reloc_howto_type elf_mips_howto_table_rela[] = 0x0000ffff, /* dst_mask */ FALSE), /* pcrel_offset */ - /* 16 bit PC relative reference. */ + /* 16 bit PC relative reference. Note that the ABI document has a typo + and claims R_MIPS_PC16 to be not rightshifted, rendering it useless. + We do the right thing here. */ HOWTO (R_MIPS_PC16, /* type */ - 0, /* rightshift */ + 2, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 16, /* bitsize */ TRUE, /* pc_relative */ @@ -1115,12 +1273,167 @@ static reloc_howto_type elf_mips_howto_table_rela[] = "R_MIPS_JALR", /* name */ FALSE, /* partial_inplace */ 0, /* src_mask */ + 0, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* TLS GD/LD dynamic relocations. */ + HOWTO (R_MIPS_TLS_DTPMOD32, /* 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_mips_elf_generic_reloc, /* special_function */ + "R_MIPS_TLS_DTPMOD32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ 0xffffffff, /* dst_mask */ FALSE), /* pcrel_offset */ + + HOWTO (R_MIPS_TLS_DTPREL32, /* 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_mips_elf_generic_reloc, /* special_function */ + "R_MIPS_TLS_DTPREL32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + EMPTY_HOWTO (R_MIPS_TLS_DTPMOD64), + EMPTY_HOWTO (R_MIPS_TLS_DTPREL64), + + /* TLS general dynamic variable reference. */ + HOWTO (R_MIPS_TLS_GD, /* 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_generic_reloc, /* special_function */ + "R_MIPS_TLS_GD", /* name */ + TRUE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* TLS local dynamic variable reference. */ + HOWTO (R_MIPS_TLS_LDM, /* 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_generic_reloc, /* special_function */ + "R_MIPS_TLS_LDM", /* name */ + TRUE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* TLS local dynamic offset. */ + HOWTO (R_MIPS_TLS_DTPREL_HI16, /* 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_generic_reloc, /* special_function */ + "R_MIPS_TLS_DTPREL_HI16", /* name */ + TRUE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* TLS local dynamic offset. */ + HOWTO (R_MIPS_TLS_DTPREL_LO16, /* 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_generic_reloc, /* special_function */ + "R_MIPS_TLS_DTPREL_LO16", /* name */ + TRUE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* TLS thread pointer offset. */ + HOWTO (R_MIPS_TLS_GOTTPREL, /* 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_generic_reloc, /* special_function */ + "R_MIPS_TLS_GOTTPREL", /* name */ + TRUE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* TLS IE dynamic relocations. */ + HOWTO (R_MIPS_TLS_TPREL32, /* 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_mips_elf_generic_reloc, /* special_function */ + "R_MIPS_TLS_TPREL32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + EMPTY_HOWTO (R_MIPS_TLS_TPREL64), + + /* TLS thread pointer offset. */ + HOWTO (R_MIPS_TLS_TPREL_HI16, /* 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_generic_reloc, /* special_function */ + "R_MIPS_TLS_TPREL_HI16", /* name */ + TRUE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* TLS thread pointer offset. */ + HOWTO (R_MIPS_TLS_TPREL_LO16, /* 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_generic_reloc, /* special_function */ + "R_MIPS_TLS_TPREL_LO16", /* name */ + TRUE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ }; -/* The reloc used for the mips16 jump instruction. */ -static reloc_howto_type elf_mips16_jump_howto = +static reloc_howto_type elf_mips16_howto_table_rel[] = +{ + /* The reloc used for the mips16 jump instruction. */ HOWTO (R_MIPS16_26, /* type */ 2, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ @@ -1136,10 +1449,9 @@ static reloc_howto_type elf_mips16_jump_howto = TRUE, /* partial_inplace */ 0x3ffffff, /* src_mask */ 0x3ffffff, /* dst_mask */ - FALSE); /* pcrel_offset */ + FALSE), /* pcrel_offset */ -/* The reloc used for the mips16 gprel instruction. */ -static reloc_howto_type elf_mips16_gprel_howto = + /* The reloc used for the mips16 gprel instruction. */ HOWTO (R_MIPS16_GPREL, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ @@ -1150,9 +1462,118 @@ static reloc_howto_type elf_mips16_gprel_howto = mips16_gprel_reloc, /* special_function */ "R_MIPS16_GPREL", /* name */ TRUE, /* partial_inplace */ - 0x07ff001f, /* src_mask */ - 0x07ff001f, /* dst_mask */ - FALSE); /* pcrel_offset */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A placeholder for MIPS16 reference to global offset table. */ + EMPTY_HOWTO (R_MIPS16_GOT16), + + /* A placeholder for MIPS16 16 bit call through global offset table. */ + EMPTY_HOWTO (R_MIPS16_CALL16), + + /* MIPS16 high 16 bits of symbol value. */ + HOWTO (R_MIPS16_HI16, /* type */ + 16, /* 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_MIPS16_HI16", /* name */ + TRUE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* MIPS16 low 16 bits of symbol value. */ + HOWTO (R_MIPS16_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_MIPS16_LO16", /* name */ + TRUE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ +}; + +static reloc_howto_type elf_mips16_howto_table_rela[] = +{ + /* The reloc used for the mips16 jump instruction. */ + 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 */ + FALSE, /* partial_inplace */ + 0x3ffffff, /* src_mask */ + 0x3ffffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* The reloc used for the mips16 gprel instruction. */ + 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 */ + FALSE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* A placeholder for MIPS16 reference to global offset table. */ + EMPTY_HOWTO (R_MIPS16_GOT16), + + /* A placeholder for MIPS16 16 bit call through global offset table. */ + EMPTY_HOWTO (R_MIPS16_CALL16), + + /* MIPS16 high 16 bits of symbol value. */ + HOWTO (R_MIPS16_HI16, /* type */ + 16, /* 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_MIPS16_HI16", /* name */ + FALSE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ + + /* MIPS16 low 16 bits of symbol value. */ + HOWTO (R_MIPS16_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_MIPS16_LO16", /* name */ + FALSE, /* partial_inplace */ + 0x0000ffff, /* src_mask */ + 0x0000ffff, /* dst_mask */ + FALSE), /* pcrel_offset */ +}; /* GNU extension to record C++ vtable hierarchy */ static reloc_howto_type elf_mips_gnu_vtinherit_howto = @@ -1348,6 +1769,16 @@ mips_elf_literal_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, bfd_reloc_status_type ret; bfd_vma gp; + /* R_MIPS_LITERAL relocations are defined for local symbols only. */ + if (output_bfd != NULL + && (symbol->flags & BSF_SECTION_SYM) == 0 + && (symbol->flags & BSF_LOCAL) != 0) + { + *error_message = (char *) + _("literal relocation occurs for an external symbol"); + return bfd_reloc_outofrange; + } + /* FIXME: The entries in the .lit8 and .lit4 sections should be merged. */ if (output_bfd != NULL) relocatable = TRUE; @@ -1425,7 +1856,7 @@ gprel32_with_gp (bfd *abfd, asymbol *symbol, arelent *reloc_entry, relocation += symbol->section->output_section->vma; relocation += symbol->section->output_offset; - if (reloc_entry->address > input_section->_cooked_size) + if (reloc_entry->address > bfd_get_section_limit (abfd, input_section)) return bfd_reloc_outofrange; if (reloc_entry->howto->src_mask == 0) @@ -1501,11 +1932,18 @@ mips16_gprel_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, { bfd_boolean relocatable; bfd_reloc_status_type ret; + bfd_byte *location; bfd_vma gp; - unsigned short extend = 0; - unsigned short insn = 0; - bfd_signed_vma val; - bfd_vma relocation; + + /* If we're relocating, and this is an external symbol, we don't want + to change anything. */ + if (output_bfd != NULL + && (symbol->flags & BSF_SECTION_SYM) == 0 + && (symbol->flags & BSF_LOCAL) != 0) + { + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; + } if (output_bfd != NULL) relocatable = TRUE; @@ -1520,55 +1958,16 @@ mips16_gprel_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, if (ret != bfd_reloc_ok) return ret; - if (reloc_entry->address > input_section->_cooked_size) - return bfd_reloc_outofrange; + location = (bfd_byte *) data + reloc_entry->address; + _bfd_mips16_elf_reloc_unshuffle (abfd, reloc_entry->howto->type, FALSE, + location); + ret = _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry, + input_section, relocatable, + data, gp); + _bfd_mips16_elf_reloc_shuffle (abfd, reloc_entry->howto->type, !relocatable, + location); - if (bfd_is_com_section (symbol->section)) - relocation = 0; - else - relocation = symbol->value; - - relocation += symbol->section->output_section->vma; - relocation += symbol->section->output_offset; - - /* Set val to the offset into the section or symbol. */ - val = reloc_entry->addend; - - if (reloc_entry->howto->partial_inplace) - { - /* 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); - val += ((extend & 0x1f) << 11) | (extend & 0x7e0) | (insn & 0x1f); - } - - _bfd_mips_elf_sign_extend(val, 16); - - /* Adjust val for the final section location and GP value. If we - are producing relocatable output, we don't want to do this for - an external symbol. */ - if (! relocatable - || (symbol->flags & BSF_SECTION_SYM) != 0) - val += relocation - gp; - - if (reloc_entry->howto->partial_inplace) - { - bfd_put_16 (abfd, - (extend & 0xf800) | ((val >> 11) & 0x1f) | (val & 0x7e0), - (bfd_byte *) data + reloc_entry->address); - bfd_put_16 (abfd, - (insn & 0xffe0) | (val & 0x1f), - (bfd_byte *) data + reloc_entry->address + 2); - } - else - reloc_entry->addend = val; - - if (relocatable) - reloc_entry->address += input_section->output_offset; - else if (((val & ~0xffff) != ~0xffff) && ((val & ~0xffff) != 0)) - return bfd_reloc_overflow; - - return bfd_reloc_ok; + return ret; } /* A mapping from BFD reloc types to MIPS ELF reloc types. */ @@ -1586,7 +1985,7 @@ static const struct elf_reloc_map mips_reloc_map[] = /* There is no BFD reloc for R_MIPS_REL32. */ { BFD_RELOC_CTOR, R_MIPS_32 }, { BFD_RELOC_64, R_MIPS_64 }, - { BFD_RELOC_16_PCREL, R_MIPS_PC16 }, + { BFD_RELOC_16_PCREL_S2, R_MIPS_PC16 }, { BFD_RELOC_HI16_S, R_MIPS_HI16 }, { BFD_RELOC_LO16, R_MIPS_LO16 }, { BFD_RELOC_GPREL16, R_MIPS_GPREL16 }, @@ -1614,7 +2013,28 @@ static const struct elf_reloc_map mips_reloc_map[] = { BFD_RELOC_MIPS_REL16, R_MIPS_REL16 }, /* Use of R_MIPS_ADD_IMMEDIATE and R_MIPS_PJUMP is deprecated. */ { BFD_RELOC_MIPS_RELGOT, R_MIPS_RELGOT }, - { BFD_RELOC_MIPS_JALR, R_MIPS_JALR } + { BFD_RELOC_MIPS_JALR, R_MIPS_JALR }, + { BFD_RELOC_MIPS_TLS_DTPMOD32, R_MIPS_TLS_DTPMOD32 }, + { BFD_RELOC_MIPS_TLS_DTPREL32, R_MIPS_TLS_DTPREL32 }, + { BFD_RELOC_MIPS_TLS_DTPMOD64, R_MIPS_TLS_DTPMOD64 }, + { BFD_RELOC_MIPS_TLS_DTPREL64, R_MIPS_TLS_DTPREL64 }, + { BFD_RELOC_MIPS_TLS_GD, R_MIPS_TLS_GD }, + { BFD_RELOC_MIPS_TLS_LDM, R_MIPS_TLS_LDM }, + { BFD_RELOC_MIPS_TLS_DTPREL_HI16, R_MIPS_TLS_DTPREL_HI16 }, + { BFD_RELOC_MIPS_TLS_DTPREL_LO16, R_MIPS_TLS_DTPREL_LO16 }, + { BFD_RELOC_MIPS_TLS_GOTTPREL, R_MIPS_TLS_GOTTPREL }, + { BFD_RELOC_MIPS_TLS_TPREL32, R_MIPS_TLS_TPREL32 }, + { BFD_RELOC_MIPS_TLS_TPREL64, R_MIPS_TLS_TPREL64 }, + { BFD_RELOC_MIPS_TLS_TPREL_HI16, R_MIPS_TLS_TPREL_HI16 }, + { BFD_RELOC_MIPS_TLS_TPREL_LO16, R_MIPS_TLS_TPREL_LO16 } +}; + +static const struct elf_reloc_map mips16_reloc_map[] = +{ + { BFD_RELOC_MIPS16_JMP, R_MIPS16_26 - R_MIPS16_min }, + { BFD_RELOC_MIPS16_GPREL, R_MIPS16_GPREL - R_MIPS16_min }, + { BFD_RELOC_MIPS16_HI16_S, R_MIPS16_HI16 - R_MIPS16_min }, + { BFD_RELOC_MIPS16_LO16, R_MIPS16_LO16 - R_MIPS16_min }, }; /* Given a BFD reloc type, return a howto structure. */ @@ -1627,6 +2047,7 @@ bfd_elf32_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, /* FIXME: We default to RELA here instead of choosing the right relocation variant. */ reloc_howto_type *howto_table = elf_mips_howto_table_rela; + reloc_howto_type *howto16_table = elf_mips16_howto_table_rela; for (i = 0; i < sizeof (mips_reloc_map) / sizeof (struct elf_reloc_map); i++) @@ -1635,18 +2056,19 @@ bfd_elf32_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, return &howto_table[(int) mips_reloc_map[i].elf_val]; } + for (i = 0; i < sizeof (mips16_reloc_map) / sizeof (struct elf_reloc_map); + i++) + { + if (mips16_reloc_map[i].bfd_val == code) + return &howto16_table[(int) mips16_reloc_map[i].elf_val]; + } + switch (code) { - 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_16_PCREL_S2: - return &elf_mips_gnu_rela16_s2; default: bfd_set_error (bfd_error_bad_value); return NULL; @@ -1660,10 +2082,6 @@ mips_elf_n32_rtype_to_howto (unsigned int r_type, bfd_boolean rela_p) { switch (r_type) { - case R_MIPS16_26: - return &elf_mips16_jump_howto; - case R_MIPS16_GPREL: - return &elf_mips16_gprel_howto; case R_MIPS_GNU_VTINHERIT: return &elf_mips_gnu_vtinherit_howto; case R_MIPS_GNU_VTENTRY: @@ -1674,6 +2092,13 @@ mips_elf_n32_rtype_to_howto (unsigned int r_type, bfd_boolean rela_p) else return &elf_mips_gnu_rel16_s2; default: + if (r_type >= R_MIPS16_min && r_type < R_MIPS16_max) + { + if (rela_p) + return &elf_mips16_howto_table_rela[r_type - R_MIPS16_min]; + else + return &elf_mips16_howto_table_rel[r_type - R_MIPS16_min]; + } BFD_ASSERT (r_type < (unsigned int) R_MIPS_max); if (rela_p) return &elf_mips_howto_table_rela[r_type]; @@ -1760,7 +2185,7 @@ static bfd_boolean elf32_mips_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) { int offset; - unsigned int raw_size; + unsigned int size; switch (note->descsz) { @@ -1776,13 +2201,13 @@ elf32_mips_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) /* pr_reg */ offset = 72; - raw_size = 360; + size = 360; break; } /* Make a ".reg/999" section. */ - return _bfd_elfcore_make_pseudosection (abfd, ".reg", raw_size, + return _bfd_elfcore_make_pseudosection (abfd, ".reg", size, note->descpos + offset); } @@ -1933,6 +2358,7 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = { #define elf_backend_mips_irix_compat elf_n32_mips_irix_compat #define elf_backend_mips_rtype_to_howto mips_elf_n32_rtype_to_howto #define bfd_elf32_find_nearest_line _bfd_mips_elf_find_nearest_line +#define bfd_elf32_find_inliner_info _bfd_mips_elf_find_inliner_info #define bfd_elf32_new_section_hook _bfd_mips_elf_new_section_hook #define bfd_elf32_set_section_contents _bfd_mips_elf_set_section_contents #define bfd_elf32_bfd_get_relocated_section_contents \ diff --git a/contrib/binutils/bfd/elfxx-ia64.c b/contrib/binutils/bfd/elfxx-ia64.c index b19aac2c55d..6b3257afdf1 100644 --- a/contrib/binutils/bfd/elfxx-ia64.c +++ b/contrib/binutils/bfd/elfxx-ia64.c @@ -1,5 +1,5 @@ /* IA-64 support for 64-bit ELF - Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 + Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Contributed by David Mosberger-Tang @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" @@ -28,6 +28,16 @@ #include "objalloc.h" #include "hashtab.h" +#define ARCH_SIZE NN + +#if ARCH_SIZE == 64 +#define LOG_SECTION_ALIGN 3 +#endif + +#if ARCH_SIZE == 32 +#define LOG_SECTION_ALIGN 2 +#endif + /* THE RULES for all the stuff the linker creates -- GOT Entries created in response to LTOFF or LTOFF_FPTR @@ -70,9 +80,6 @@ struct elfNN_ia64_dyn_sym_info /* The addend for which this entry is relevant. */ bfd_vma addend; - /* Next addend in the list. */ - struct elfNN_ia64_dyn_sym_info *next; - bfd_vma got_offset; bfd_vma fptr_offset; bfd_vma pltoff_offset; @@ -123,6 +130,13 @@ struct elfNN_ia64_local_hash_entry { int id; unsigned int r_sym; + /* The number of elements in elfNN_ia64_dyn_sym_info array. */ + unsigned int count; + /* The number of sorted elements in elfNN_ia64_dyn_sym_info array. */ + unsigned int sorted_count; + /* The size of elfNN_ia64_dyn_sym_info array. */ + unsigned int size; + /* The array of elfNN_ia64_dyn_sym_info. */ struct elfNN_ia64_dyn_sym_info *info; /* TRUE if this hash entry's addends was translated for @@ -133,6 +147,13 @@ struct elfNN_ia64_local_hash_entry struct elfNN_ia64_link_hash_entry { struct elf_link_hash_entry root; + /* The number of elements in elfNN_ia64_dyn_sym_info array. */ + unsigned int count; + /* The number of sorted elements in elfNN_ia64_dyn_sym_info array. */ + unsigned int sorted_count; + /* The size of elfNN_ia64_dyn_sym_info array. */ + unsigned int size; + /* The array of elfNN_ia64_dyn_sym_info. */ struct elfNN_ia64_dyn_sym_info *info; }; @@ -162,6 +183,7 @@ struct elfNN_ia64_allocate_data { struct bfd_link_info *info; bfd_size_type ofs; + bfd_boolean only_got; }; #define elfNN_ia64_hash_table(p) \ @@ -180,13 +202,11 @@ static bfd_boolean elfNN_ia64_relax_section PARAMS((bfd *abfd, asection *sec, struct bfd_link_info *link_info, bfd_boolean *again)); static void elfNN_ia64_relax_ldxmov - PARAMS((bfd *abfd, bfd_byte *contents, bfd_vma off)); + PARAMS((bfd_byte *contents, bfd_vma off)); static bfd_boolean is_unwind_section_name PARAMS ((bfd *abfd, const char *)); -static bfd_boolean elfNN_ia64_section_from_shdr - PARAMS ((bfd *, Elf_Internal_Shdr *, const char *)); static bfd_boolean elfNN_ia64_section_flags - PARAMS ((flagword *, Elf_Internal_Shdr *)); + PARAMS ((flagword *, const Elf_Internal_Shdr *)); static bfd_boolean elfNN_ia64_fake_sections PARAMS ((bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec)); static void elfNN_ia64_final_write_processing @@ -207,7 +227,7 @@ static struct bfd_hash_entry *elfNN_ia64_new_elf_hash_entry PARAMS ((struct bfd_hash_entry *entry, struct bfd_hash_table *table, const char *string)); static void elfNN_ia64_hash_copy_indirect - PARAMS ((const struct elf_backend_data *, struct elf_link_hash_entry *, + PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, struct elf_link_hash_entry *)); static void elfNN_ia64_hash_hide_symbol PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, bfd_boolean)); @@ -273,7 +293,7 @@ static bfd_boolean allocate_dynrel_entries static bfd_boolean elfNN_ia64_size_dynamic_sections PARAMS ((bfd *output_bfd, struct bfd_link_info *info)); static bfd_reloc_status_type elfNN_ia64_install_value - PARAMS ((bfd *abfd, bfd_byte *hit_addr, bfd_vma val, unsigned int r_type)); + PARAMS ((bfd_byte *hit_addr, bfd_vma val, unsigned int r_type)); static void elfNN_ia64_install_dyn_reloc PARAMS ((bfd *abfd, struct bfd_link_info *info, asection *sec, asection *srel, bfd_vma offset, unsigned int type, @@ -445,8 +465,8 @@ static reloc_howto_type ia64_howto_table[] = IA64_HOWTO (R_IA64_TPREL64LSB, "TPREL64LSB", 4, FALSE, FALSE), IA64_HOWTO (R_IA64_LTOFF_TPREL22, "LTOFF_TPREL22", 0, FALSE, FALSE), - IA64_HOWTO (R_IA64_DTPMOD64MSB, "TPREL64MSB", 4, FALSE, FALSE), - IA64_HOWTO (R_IA64_DTPMOD64LSB, "TPREL64LSB", 4, FALSE, FALSE), + IA64_HOWTO (R_IA64_DTPMOD64MSB, "DTPMOD64MSB", 4, FALSE, FALSE), + IA64_HOWTO (R_IA64_DTPMOD64LSB, "DTPMOD64LSB", 4, FALSE, FALSE), IA64_HOWTO (R_IA64_LTOFF_DTPMOD22, "LTOFF_DTPMOD22", 0, FALSE, FALSE), IA64_HOWTO (R_IA64_DTPREL14, "DTPREL14", 0, FALSE, FALSE), @@ -479,7 +499,8 @@ lookup_howto (rtype) elf_code_to_howto_index[ia64_howto_table[i].type] = i; } - BFD_ASSERT (rtype <= R_IA64_MAX_RELOC_CODE); + if (rtype > R_IA64_MAX_RELOC_CODE) + return 0; i = elf_code_to_howto_index[rtype]; if (i >= NELEMS (ia64_howto_table)) return 0; @@ -673,8 +694,146 @@ bfd_elfNN_ia64_after_parse (int itanium) oor_branch_size = itanium ? sizeof (oor_ip) : sizeof (oor_brl); } +#define BTYPE_SHIFT 6 +#define Y_SHIFT 26 +#define X6_SHIFT 27 +#define X4_SHIFT 27 +#define X3_SHIFT 33 +#define X2_SHIFT 31 +#define X_SHIFT 33 +#define OPCODE_SHIFT 37 + +#define OPCODE_BITS (0xfLL << OPCODE_SHIFT) +#define X6_BITS (0x3fLL << X6_SHIFT) +#define X4_BITS (0xfLL << X4_SHIFT) +#define X3_BITS (0x7LL << X3_SHIFT) +#define X2_BITS (0x3LL << X2_SHIFT) +#define X_BITS (0x1LL << X_SHIFT) +#define Y_BITS (0x1LL << Y_SHIFT) +#define BTYPE_BITS (0x7LL << BTYPE_SHIFT) +#define PREDICATE_BITS (0x3fLL) + +#define IS_NOP_B(i) \ + (((i) & (OPCODE_BITS | X6_BITS)) == (2LL << OPCODE_SHIFT)) +#define IS_NOP_F(i) \ + (((i) & (OPCODE_BITS | X_BITS | X6_BITS | Y_BITS)) \ + == (0x1LL << X6_SHIFT)) +#define IS_NOP_I(i) \ + (((i) & (OPCODE_BITS | X3_BITS | X6_BITS | Y_BITS)) \ + == (0x1LL << X6_SHIFT)) +#define IS_NOP_M(i) \ + (((i) & (OPCODE_BITS | X3_BITS | X2_BITS | X4_BITS | Y_BITS)) \ + == (0x1LL << X4_SHIFT)) +#define IS_BR_COND(i) \ + (((i) & (OPCODE_BITS | BTYPE_BITS)) == (0x4LL << OPCODE_SHIFT)) +#define IS_BR_CALL(i) \ + (((i) & OPCODE_BITS) == (0x5LL << OPCODE_SHIFT)) + +static bfd_boolean +elfNN_ia64_relax_br (bfd_byte *contents, bfd_vma off) +{ + unsigned int template, mlx; + bfd_vma t0, t1, s0, s1, s2, br_code; + long br_slot; + bfd_byte *hit_addr; + + hit_addr = (bfd_byte *) (contents + off); + br_slot = (long) hit_addr & 0x3; + hit_addr -= br_slot; + t0 = bfd_getl64 (hit_addr + 0); + t1 = bfd_getl64 (hit_addr + 8); + + /* Check if we can turn br into brl. A label is always at the start + of the bundle. Even if there are predicates on NOPs, we still + perform this optimization. */ + template = t0 & 0x1e; + s0 = (t0 >> 5) & 0x1ffffffffffLL; + s1 = ((t0 >> 46) | (t1 << 18)) & 0x1ffffffffffLL; + s2 = (t1 >> 23) & 0x1ffffffffffLL; + switch (br_slot) + { + case 0: + /* Check if slot 1 and slot 2 are NOPs. Possible template is + BBB. We only need to check nop.b. */ + if (!(IS_NOP_B (s1) && IS_NOP_B (s2))) + return FALSE; + br_code = s0; + break; + case 1: + /* Check if slot 2 is NOP. Possible templates are MBB and BBB. + For BBB, slot 0 also has to be nop.b. */ + if (!((template == 0x12 /* MBB */ + && IS_NOP_B (s2)) + || (template == 0x16 /* BBB */ + && IS_NOP_B (s0) + && IS_NOP_B (s2)))) + return FALSE; + br_code = s1; + break; + case 2: + /* Check if slot 1 is NOP. Possible templates are MIB, MBB, BBB, + MMB and MFB. For BBB, slot 0 also has to be nop.b. */ + if (!((template == 0x10 /* MIB */ + && IS_NOP_I (s1)) + || (template == 0x12 /* MBB */ + && IS_NOP_B (s1)) + || (template == 0x16 /* BBB */ + && IS_NOP_B (s0) + && IS_NOP_B (s1)) + || (template == 0x18 /* MMB */ + && IS_NOP_M (s1)) + || (template == 0x1c /* MFB */ + && IS_NOP_F (s1)))) + return FALSE; + br_code = s2; + break; + default: + /* It should never happen. */ + abort (); + } + + /* We can turn br.cond/br.call into brl.cond/brl.call. */ + if (!(IS_BR_COND (br_code) || IS_BR_CALL (br_code))) + return FALSE; + + /* Turn br into brl by setting bit 40. */ + br_code |= 0x1LL << 40; + + /* Turn the old bundle into a MLX bundle with the same stop-bit + variety. */ + if (t0 & 0x1) + mlx = 0x5; + else + mlx = 0x4; + + if (template == 0x16) + { + /* For BBB, we need to put nop.m in slot 0. We keep the original + predicate only if slot 0 isn't br. */ + if (br_slot == 0) + t0 = 0LL; + else + t0 &= PREDICATE_BITS << 5; + t0 |= 0x1LL << (X4_SHIFT + 5); + } + else + { + /* Keep the original instruction in slot 0. */ + t0 &= 0x1ffffffffffLL << 5; + } + + t0 |= mlx; + + /* Put brl in slot 1. */ + t1 = br_code << 23; + + bfd_putl64 (t0, hit_addr); + bfd_putl64 (t1, hit_addr + 8); + return TRUE; +} + static void -elfNN_ia64_relax_brl (bfd *abfd, bfd_byte *contents, bfd_vma off) +elfNN_ia64_relax_brl (bfd_byte *contents, bfd_vma off) { int template; bfd_byte *hit_addr; @@ -682,8 +841,8 @@ elfNN_ia64_relax_brl (bfd *abfd, bfd_byte *contents, bfd_vma off) hit_addr = (bfd_byte *) (contents + off); hit_addr -= (long) hit_addr & 0x3; - t0 = bfd_get_64 (abfd, hit_addr); - t1 = bfd_get_64 (abfd, hit_addr + 8); + t0 = bfd_getl64 (hit_addr); + t1 = bfd_getl64 (hit_addr + 8); /* Keep the instruction in slot 0. */ i0 = (t0 >> 5) & 0x1ffffffffffLL; @@ -694,15 +853,22 @@ elfNN_ia64_relax_brl (bfd *abfd, bfd_byte *contents, bfd_vma off) /* Turn a MLX bundle into a MBB bundle with the same stop-bit variety. */ - template = 0x12; - if ((t0 & 0x1fLL) == 5) - template += 1; + if (t0 & 0x1) + template = 0x13; + else + template = 0x12; t0 = (i1 << 46) | (i0 << 5) | template; t1 = (i2 << 23) | (i1 >> 18); - bfd_put_64 (abfd, t0, hit_addr); - bfd_put_64 (abfd, t1, hit_addr + 8); + bfd_putl64 (t0, hit_addr); + bfd_putl64 (t1, hit_addr + 8); } + +/* Rename some of the generic section flags to better document how they + are used here. */ +#define skip_relax_pass_0 need_finalize_relax +#define skip_relax_pass_1 has_gp_reloc + /* These functions do relaxation for IA-64 ELF. */ @@ -731,6 +897,8 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) bfd_boolean changed_contents = FALSE; bfd_boolean changed_relocs = FALSE; bfd_boolean changed_got = FALSE; + bfd_boolean skip_relax_pass_0 = TRUE; + bfd_boolean skip_relax_pass_1 = TRUE; bfd_vma gp = 0; /* Assume we're not going to change any sizes, and we'll only need @@ -742,18 +910,13 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) return FALSE; /* Nothing to do if there are no relocations or there is no need for - the relax finalize pass. */ + the current pass. */ if ((sec->flags & SEC_RELOC) == 0 || sec->reloc_count == 0 - || (!link_info->need_relax_finalize - && sec->need_finalize_relax == 0)) + || (link_info->relax_pass == 0 && sec->skip_relax_pass_0) + || (link_info->relax_pass == 1 && sec->skip_relax_pass_1)) 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; /* Load the relocations for this section. */ @@ -771,12 +934,7 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) contents = elf_section_data (sec)->this_hdr.contents; else { - contents = (bfd_byte *) bfd_malloc (sec->_raw_size); - if (contents == NULL) - goto error_return; - - if (! bfd_get_section_contents (abfd, sec, contents, - (file_ptr) 0, sec->_raw_size)) + if (!bfd_malloc_and_get_section (abfd, sec, &contents)) goto error_return; } @@ -789,6 +947,7 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) bfd_size_type amt; bfd_boolean is_branch; struct elfNN_ia64_dyn_sym_info *dyn_i; + char symtype; switch (r_type) { @@ -796,20 +955,19 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) case R_IA64_PCREL21BI: case R_IA64_PCREL21M: case R_IA64_PCREL21F: - /* In the finalize pass, all br relaxations are done. We can - skip it. */ - if (!link_info->need_relax_finalize) + /* In pass 1, all br relaxations are done. We can skip it. */ + if (link_info->relax_pass == 1) continue; + skip_relax_pass_0 = FALSE; is_branch = TRUE; break; case R_IA64_PCREL60B: - /* We can't optimize brl to br before the finalize pass since - br relaxations will increase the code size. Defer it to - the finalize pass. */ - if (link_info->need_relax_finalize) + /* We can't optimize brl to br in pass 0 since br relaxations + will increase the code size. Defer it to pass 1. */ + if (link_info->relax_pass == 0) { - sec->need_finalize_relax = 1; + skip_relax_pass_1 = FALSE; continue; } is_branch = TRUE; @@ -817,12 +975,11 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) case R_IA64_LTOFF22X: case R_IA64_LDXMOV: - /* We can't relax ldx/mov before the finalize pass since - br relaxations will increase the code size. Defer it to - the finalize pass. */ - if (link_info->need_relax_finalize) + /* We can't relax ldx/mov in pass 0 since br relaxations will + increase the code size. Defer it to pass 1. */ + if (link_info->relax_pass == 0) { - sec->need_finalize_relax = 1; + skip_relax_pass_1 = FALSE; continue; } is_branch = FALSE; @@ -864,6 +1021,7 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) toff = isym->st_value; dyn_i = get_dyn_sym_info (ia64_info, NULL, abfd, irel, FALSE); + symtype = ELF_ST_TYPE (isym->st_info); } else { @@ -908,13 +1066,38 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) tsec = h->root.u.def.section; toff = h->root.u.def.value; } + + symtype = h->type; } if (tsec->sec_info_type == ELF_INFO_TYPE_MERGE) - toff = _bfd_merged_section_offset (abfd, &tsec, - elf_section_data (tsec)->sec_info, - toff + irel->r_addend, - (bfd_vma) 0); + { + /* At this stage in linking, no SEC_MERGE symbol has been + adjusted, so all references to such symbols need to be + passed through _bfd_merged_section_offset. (Later, in + relocate_section, all SEC_MERGE symbols *except* for + section symbols have been adjusted.) + + gas may reduce relocations against symbols in SEC_MERGE + sections to a relocation against the section symbol when + the original addend was zero. When the reloc is against + a section symbol we should include the addend in the + offset passed to _bfd_merged_section_offset, since the + location of interest is the original symbol. On the + other hand, an access to "sym+addend" where "sym" is not + a section symbol should not include the addend; Such an + access is presumed to be an offset from "sym"; The + location of interest is just "sym". */ + if (symtype == STT_SECTION) + toff += irel->r_addend; + + toff = _bfd_merged_section_offset (abfd, &tsec, + elf_section_data (tsec)->sec_info, + toff); + + if (symtype != STT_SECTION) + toff += irel->r_addend; + } else toff += irel->r_addend; @@ -937,10 +1120,10 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) /* If the 60-bit branch is in 21-bit range, optimize it. */ if (r_type == R_IA64_PCREL60B) { - elfNN_ia64_relax_brl (abfd, contents, roff); + elfNN_ia64_relax_brl (contents, roff); irel->r_info - = ELF64_R_INFO (ELF64_R_SYM (irel->r_info), + = ELFNN_R_INFO (ELFNN_R_SYM (irel->r_info), R_IA64_PCREL21B); /* If the original relocation offset points to slot @@ -953,11 +1136,34 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) } else if (r_type == R_IA64_PCREL60B) continue; + else if (elfNN_ia64_relax_br (contents, roff)) + { + irel->r_info + = ELFNN_R_INFO (ELFNN_R_SYM (irel->r_info), + R_IA64_PCREL60B); + + /* Make the relocation offset point to slot 1. */ + irel->r_offset = (irel->r_offset & ~((bfd_vma) 0x3)) + 1; + continue; + } + + /* We can't put a trampoline in a .init/.fini section. Issue + an error. */ + if (strcmp (sec->output_section->name, ".init") == 0 + || strcmp (sec->output_section->name, ".fini") == 0) + { + (*_bfd_error_handler) + (_("%B: Can't relax br at 0x%lx in section `%A'. Please use brl or indirect branch."), + sec->owner, sec, (unsigned long) roff); + bfd_set_error (bfd_error_bad_value); + goto error_return; + } /* If the branch and target are in the same section, you've - got one honking big section and we can't help you. You'll - get an error message later. */ - if (tsec == sec) + got one honking big section and we can't help you unless + you are branching backwards. You'll get an error message + later. */ + if (tsec == sec && toff > roff) continue; /* Look for an existing fixup to this address. */ @@ -979,7 +1185,7 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) size = oor_branch_size; /* Resize the current section to make room for the new branch. */ - trampoff = (sec->_cooked_size + 15) & (bfd_vma) -16; + trampoff = (sec->size + 15) & (bfd_vma) -16; /* If trampoline is out of range, there is nothing we can do. */ @@ -991,7 +1197,7 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) contents = (bfd_byte *) bfd_realloc (contents, amt); if (contents == NULL) goto error_return; - sec->_cooked_size = amt; + sec->size = amt; if (tsec == ia64_info->plt_sec) { @@ -1044,8 +1250,8 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) } /* Fix up the existing branch to hit the trampoline. */ - if (elfNN_ia64_install_value (abfd, contents + roff, offset, - r_type) != bfd_reloc_ok) + if (elfNN_ia64_install_value (contents + roff, offset, r_type) + != bfd_reloc_ok) goto error_return; changed_contents = TRUE; @@ -1084,7 +1290,7 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) } else { - elfNN_ia64_relax_ldxmov (abfd, contents, roff); + elfNN_ia64_relax_ldxmov (contents, roff); irel->r_info = ELFNN_R_INFO (0, R_IA64_NONE); changed_contents = TRUE; changed_relocs = TRUE; @@ -1096,7 +1302,7 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) enough that the data segment moves, which will change the GP. Reset the GP so that we re-calculate next round. We need to do this at the _beginning_ of the next round; now will not do. */ - + /* Clean up and go home. */ while (fixups) { @@ -1147,14 +1353,28 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_global_data_got, &data); elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_global_fptr_got, &data); elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_local_got, &data); - ia64_info->got_sec->_raw_size = data.ofs; - ia64_info->got_sec->_cooked_size = data.ofs; + ia64_info->got_sec->size = data.ofs; - /* ??? Resize .rela.got too. */ + if (ia64_info->root.dynamic_sections_created + && ia64_info->rel_got_sec != NULL) + { + /* Resize .rela.got. */ + ia64_info->rel_got_sec->size = 0; + if (link_info->shared + && ia64_info->self_dtpmod_offset != (bfd_vma) -1) + ia64_info->rel_got_sec->size += sizeof (ElfNN_External_Rela); + data.only_got = TRUE; + elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_dynrel_entries, + &data); + } } - if (!link_info->need_relax_finalize) - sec->need_finalize_relax = 0; + if (link_info->relax_pass == 0) + { + /* Pass 0 is only needed to relax br. */ + sec->skip_relax_pass_0 = skip_relax_pass_0; + sec->skip_relax_pass_1 = skip_relax_pass_1; + } *again = changed_contents || changed_relocs; return TRUE; @@ -1170,10 +1390,11 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) free (internal_relocs); return FALSE; } +#undef skip_relax_pass_0 +#undef skip_relax_pass_1 static void -elfNN_ia64_relax_ldxmov (abfd, contents, off) - bfd *abfd; +elfNN_ia64_relax_ldxmov (contents, off) bfd_byte *contents; bfd_vma off; { @@ -1189,7 +1410,7 @@ elfNN_ia64_relax_ldxmov (abfd, contents, off) abort (); } - dword = bfd_get_64 (abfd, contents + off); + dword = bfd_getl64 (contents + off); insn = (dword >> shift) & 0x1ffffffffffLL; r1 = (insn >> 6) & 127; @@ -1201,7 +1422,7 @@ elfNN_ia64_relax_ldxmov (abfd, contents, off) dword &= ~(0x1ffffffffffLL << shift); dword |= (insn << shift); - bfd_put_64 (abfd, dword, contents + off); + bfd_putl64 (dword, contents + off); } /* Return TRUE if NAME is an unwind table section name. */ @@ -1226,13 +1447,14 @@ is_unwind_section_name (abfd, name) } /* Handle an IA-64 specific section when reading an object file. This - is called when elfcode.h finds a section with an unknown type. */ + is called when bfd_section_from_shdr finds a section with an unknown + type. */ static bfd_boolean -elfNN_ia64_section_from_shdr (abfd, hdr, name) - bfd *abfd; - Elf_Internal_Shdr *hdr; - const char *name; +elfNN_ia64_section_from_shdr (bfd *abfd, + Elf_Internal_Shdr *hdr, + const char *name, + int shindex) { asection *newsect; @@ -1256,7 +1478,7 @@ elfNN_ia64_section_from_shdr (abfd, hdr, name) return FALSE; } - if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name)) + if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex)) return FALSE; newsect = hdr->bfd_section; @@ -1271,7 +1493,7 @@ elfNN_ia64_section_from_shdr (abfd, hdr, name) static bfd_boolean elfNN_ia64_section_flags (flags, hdr) flagword *flags; - Elf_Internal_Shdr *hdr; + const Elf_Internal_Shdr *hdr; { if (hdr->sh_flags & SHF_IA_64_SHORT) *flags |= SEC_SMALL_DATA; @@ -1325,6 +1547,11 @@ elfNN_ia64_fake_sections (abfd, hdr, sec) if (sec->flags & SEC_SMALL_DATA) hdr->sh_flags |= SHF_IA_64_SHORT; + /* Some HP linkers look for the SHF_IA_64_HP_TLS flag instead of SHF_TLS. */ + + if (elfNN_ia64_hpux_vec (abfd->xvec) && (sec->flags & SHF_TLS)) + hdr->sh_flags |= SHF_IA_64_HP_TLS; + return TRUE; } @@ -1337,9 +1564,7 @@ elfNN_ia64_final_write_processing (abfd, linker) bfd_boolean linker ATTRIBUTE_UNUSED; { Elf_Internal_Shdr *hdr; - const char *sname; - asection *text_sect, *s; - size_t len; + asection *s; for (s = abfd->sections; s; s = s->next) { @@ -1347,64 +1572,11 @@ elfNN_ia64_final_write_processing (abfd, linker) switch (hdr->sh_type) { case SHT_IA_64_UNWIND: - /* See comments in gas/config/tc-ia64.c:dot_endp on why we - have to do this. */ - sname = bfd_get_section_name (abfd, s); - len = sizeof (ELF_STRING_ia64_unwind) - 1; - if (sname && strncmp (sname, ELF_STRING_ia64_unwind, len) == 0) - { - sname += len; - - if (sname[0] == '\0') - /* .IA_64.unwind -> .text */ - text_sect = bfd_get_section_by_name (abfd, ".text"); - else - /* .IA_64.unwindFOO -> FOO */ - text_sect = bfd_get_section_by_name (abfd, sname); - } - else if (sname - && (len = sizeof (ELF_STRING_ia64_unwind_once) - 1, - strncmp (sname, ELF_STRING_ia64_unwind_once, len)) == 0) - { - /* .gnu.linkonce.ia64unw.FOO -> .gnu.linkonce.t.FOO */ - size_t len2 = sizeof (".gnu.linkonce.t.") - 1; - char *once_name = bfd_malloc (len2 + strlen (sname + len) + 1); - - if (once_name != NULL) - { - memcpy (once_name, ".gnu.linkonce.t.", len2); - strcpy (once_name + len2, sname + len); - text_sect = bfd_get_section_by_name (abfd, once_name); - free (once_name); - } - else - /* Should only happen if we run out of memory, in - which case we're probably toast anyway. Try to - cope by finding the section the slow way. */ - for (text_sect = abfd->sections; - text_sect != NULL; - text_sect = text_sect->next) - { - if (strncmp (bfd_section_name (abfd, text_sect), - ".gnu.linkonce.t.", len2) == 0 - && strcmp (bfd_section_name (abfd, text_sect) + len2, - sname + len) == 0) - break; - } - } - else - /* last resort: fall back on .text */ - text_sect = bfd_get_section_by_name (abfd, ".text"); - - if (text_sect) - { - /* The IA-64 processor-specific ABI requires setting - sh_link to the unwind section, whereas HP-UX requires - sh_info to do so. For maximum compatibility, we'll - set both for now... */ - hdr->sh_link = elf_section_data (text_sect)->this_idx; - hdr->sh_info = elf_section_data (text_sect)->this_idx; - } + /* The IA-64 processor-specific ABI requires setting sh_link + to the unwind section, whereas HP-UX requires sh_info to + do so. For maximum compatibility, we'll set both for + now... */ + hdr->sh_info = hdr->sh_link; break; } } @@ -1447,11 +1619,11 @@ elfNN_ia64_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) if (scomm == NULL) { - scomm = bfd_make_section (abfd, ".scommon"); - if (scomm == NULL - || !bfd_set_section_flags (abfd, scomm, (SEC_ALLOC - | SEC_IS_COMMON - | SEC_LINKER_CREATED))) + scomm = bfd_make_section_with_flags (abfd, ".scommon", + (SEC_ALLOC + | SEC_IS_COMMON + | SEC_LINKER_CREATED)); + if (scomm == NULL) return FALSE; } @@ -1579,7 +1751,7 @@ elfNN_ia64_modify_segment_map (abfd, info) int i; for (i = m->count - 1; i >= 0; --i) { - struct bfd_link_order *order = m->sections[i]->link_order_head; + struct bfd_link_order *order = m->sections[i]->map_head.link_order; while (order) { if (order->type == bfd_indirect_link_order) @@ -1644,21 +1816,21 @@ elfNN_ia64_new_elf_hash_entry (entry, table, string) if (!ret) return 0; - /* Initialize our local data. All zeros, and definitely easier - than setting a handful of bit fields. */ - memset (ret, 0, sizeof (*ret)); - /* Call the allocation method of the superclass. */ ret = ((struct elfNN_ia64_link_hash_entry *) _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret, table, string)); + ret->info = NULL; + ret->count = 0; + ret->sorted_count = 0; + ret->size = 0; return (struct bfd_hash_entry *) ret; } static void -elfNN_ia64_hash_copy_indirect (bed, xdir, xind) - const struct elf_backend_data *bed ATTRIBUTE_UNUSED; +elfNN_ia64_hash_copy_indirect (info, xdir, xind) + struct bfd_link_info *info; struct elf_link_hash_entry *xdir, *xind; { struct elfNN_ia64_link_hash_entry *dir, *ind; @@ -1669,12 +1841,10 @@ elfNN_ia64_hash_copy_indirect (bed, xdir, xind) /* Copy down any references that we may have already seen to the symbol which just became indirect. */ - dir->root.elf_link_hash_flags |= - (ind->root.elf_link_hash_flags - & (ELF_LINK_HASH_REF_DYNAMIC - | ELF_LINK_HASH_REF_REGULAR - | ELF_LINK_HASH_REF_REGULAR_NONWEAK - | ELF_LINK_HASH_NEEDS_PLT)); + dir->root.ref_dynamic |= ind->root.ref_dynamic; + dir->root.ref_regular |= ind->root.ref_regular; + dir->root.ref_regular_nonweak |= ind->root.ref_regular_nonweak; + dir->root.needs_plt |= ind->root.needs_plt; if (ind->root.root.type != bfd_link_hash_indirect) return; @@ -1682,29 +1852,43 @@ elfNN_ia64_hash_copy_indirect (bed, xdir, xind) /* Copy over the got and plt data. This would have been done by check_relocs. */ - if (dir->info == NULL) + if (ind->info != NULL) { struct elfNN_ia64_dyn_sym_info *dyn_i; + unsigned int count; + + if (dir->info) + free (dir->info); + + dir->info = ind->info; + dir->count = ind->count; + dir->sorted_count = ind->sorted_count; + dir->size = ind->size; - dir->info = dyn_i = ind->info; ind->info = NULL; + ind->count = 0; + ind->sorted_count = 0; + ind->size = 0; /* Fix up the dyn_sym_info pointers to the global symbol. */ - for (; dyn_i; dyn_i = dyn_i->next) + for (count = dir->count, dyn_i = dir->info; + count != 0; + count--, dyn_i++) dyn_i->h = &dir->root; } - BFD_ASSERT (ind->info == NULL); /* Copy over the dynindx. */ - if (dir->root.dynindx == -1) + if (ind->root.dynindx != -1) { + if (dir->root.dynindx != -1) + _bfd_elf_strtab_delref (elf_hash_table (info)->dynstr, + dir->root.dynstr_index); dir->root.dynindx = ind->root.dynindx; dir->root.dynstr_index = ind->root.dynstr_index; ind->root.dynindx = -1; ind->root.dynstr_index = 0; } - BFD_ASSERT (ind->root.dynindx == -1); } static void @@ -1715,12 +1899,15 @@ elfNN_ia64_hash_hide_symbol (info, xh, force_local) { struct elfNN_ia64_link_hash_entry *h; struct elfNN_ia64_dyn_sym_info *dyn_i; + unsigned int count; h = (struct elfNN_ia64_link_hash_entry *)xh; _bfd_elf_link_hash_hide_symbol (info, &h->root, force_local); - for (dyn_i = h->info; dyn_i; dyn_i = dyn_i->next) + for (count = h->count, dyn_i = h->info; + count != 0; + count--, dyn_i++) { dyn_i->want_plt2 = 0; dyn_i->want_plt = 0; @@ -1769,7 +1956,8 @@ elfNN_ia64_hash_table_create (abfd) return 0; if (!_bfd_elf_link_hash_table_init (&ret->root, abfd, - elfNN_ia64_new_elf_hash_entry)) + elfNN_ia64_new_elf_hash_entry, + sizeof (struct elfNN_ia64_link_hash_entry))) { free (ret); return 0; @@ -1787,6 +1975,51 @@ elfNN_ia64_hash_table_create (abfd) return &ret->root.root; } +/* Free the global elfNN_ia64_dyn_sym_info array. */ + +static bfd_boolean +elfNN_ia64_global_dyn_info_free (void **xentry, + PTR unused ATTRIBUTE_UNUSED) +{ + struct elfNN_ia64_link_hash_entry *entry + = (struct elfNN_ia64_link_hash_entry *) xentry; + + if (entry->root.root.type == bfd_link_hash_warning) + entry = (struct elfNN_ia64_link_hash_entry *) entry->root.root.u.i.link; + + if (entry->info) + { + free (entry->info); + entry->info = NULL; + entry->count = 0; + entry->sorted_count = 0; + entry->size = 0; + } + + return TRUE; +} + +/* Free the local elfNN_ia64_dyn_sym_info array. */ + +static bfd_boolean +elfNN_ia64_local_dyn_info_free (void **slot, + PTR unused ATTRIBUTE_UNUSED) +{ + struct elfNN_ia64_local_hash_entry *entry + = (struct elfNN_ia64_local_hash_entry *) *slot; + + if (entry->info) + { + free (entry->info); + entry->info = NULL; + entry->count = 0; + entry->sorted_count = 0; + entry->size = 0; + } + + return TRUE; +} + /* Destroy IA-64 linker hash table. */ static void @@ -1796,9 +2029,15 @@ elfNN_ia64_hash_table_free (hash) struct elfNN_ia64_link_hash_table *ia64_info = (struct elfNN_ia64_link_hash_table *) hash; if (ia64_info->loc_hash_table) - htab_delete (ia64_info->loc_hash_table); + { + htab_traverse (ia64_info->loc_hash_table, + elfNN_ia64_local_dyn_info_free, NULL); + htab_delete (ia64_info->loc_hash_table); + } if (ia64_info->loc_hash_memory) objalloc_free ((struct objalloc *) ia64_info->loc_hash_memory); + elf_link_hash_traverse (&ia64_info->root, + elfNN_ia64_global_dyn_info_free, NULL); _bfd_generic_link_hash_table_free (hash); } @@ -1820,11 +2059,14 @@ elfNN_ia64_global_dyn_sym_thunk (xentry, xdata) struct elfNN_ia64_dyn_sym_traverse_data *data = (struct elfNN_ia64_dyn_sym_traverse_data *) xdata; struct elfNN_ia64_dyn_sym_info *dyn_i; + unsigned int count; if (entry->root.root.type == bfd_link_hash_warning) entry = (struct elfNN_ia64_link_hash_entry *) entry->root.root.u.i.link; - for (dyn_i = entry->info; dyn_i; dyn_i = dyn_i->next) + for (count = entry->count, dyn_i = entry->info; + count != 0; + count--, dyn_i++) if (! (*data->func) (dyn_i, data->data)) return FALSE; return TRUE; @@ -1840,11 +2082,14 @@ elfNN_ia64_local_dyn_sym_thunk (slot, xdata) struct elfNN_ia64_dyn_sym_traverse_data *data = (struct elfNN_ia64_dyn_sym_traverse_data *) xdata; struct elfNN_ia64_dyn_sym_info *dyn_i; + unsigned int count; - for (dyn_i = entry->info; dyn_i; dyn_i = dyn_i->next) + for (count = entry->count, dyn_i = entry->info; + count != 0; + count--, dyn_i++) if (! (*data->func) (dyn_i, data->data)) - return 0; - return 1; + return FALSE; + return TRUE; } static void @@ -1890,25 +2135,25 @@ elfNN_ia64_create_dynamic_sections (abfd, info) if (!get_pltoff (abfd, info, ia64_info)) return FALSE; - s = bfd_make_section(abfd, ".rela.IA_64.pltoff"); + s = bfd_make_section_with_flags (abfd, ".rela.IA_64.pltoff", + (SEC_ALLOC | SEC_LOAD + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_LINKER_CREATED + | SEC_READONLY)); if (s == NULL - || !bfd_set_section_flags (abfd, s, (SEC_ALLOC | SEC_LOAD - | SEC_HAS_CONTENTS - | SEC_IN_MEMORY - | SEC_LINKER_CREATED - | SEC_READONLY)) - || !bfd_set_section_alignment (abfd, s, 3)) + || !bfd_set_section_alignment (abfd, s, LOG_SECTION_ALIGN)) return FALSE; ia64_info->rel_pltoff_sec = s; - s = bfd_make_section(abfd, ".rela.got"); + s = bfd_make_section_with_flags (abfd, ".rela.got", + (SEC_ALLOC | SEC_LOAD + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_LINKER_CREATED + | SEC_READONLY)); if (s == NULL - || !bfd_set_section_flags (abfd, s, (SEC_ALLOC | SEC_LOAD - | SEC_HAS_CONTENTS - | SEC_IN_MEMORY - | SEC_LINKER_CREATED - | SEC_READONLY)) - || !bfd_set_section_alignment (abfd, s, 3)) + || !bfd_set_section_alignment (abfd, s, LOG_SECTION_ALIGN)) return FALSE; ia64_info->rel_got_sec = s; @@ -1953,8 +2198,129 @@ get_local_sym_hash (ia64_info, abfd, rel, create) return ret; } +/* Used to sort elfNN_ia64_dyn_sym_info array. */ + +static int +addend_compare (const void *xp, const void *yp) +{ + const struct elfNN_ia64_dyn_sym_info *x + = (const struct elfNN_ia64_dyn_sym_info *) xp; + const struct elfNN_ia64_dyn_sym_info *y + = (const struct elfNN_ia64_dyn_sym_info *) yp; + + return x->addend - y->addend; +} + +/* Sort elfNN_ia64_dyn_sym_info array and remove duplicates. */ + +static unsigned int +sort_dyn_sym_info (struct elfNN_ia64_dyn_sym_info *info, + unsigned int count) +{ + bfd_vma curr, prev; + unsigned int i, dup, diff, dest, src, len; + + qsort (info, count, sizeof (*info), addend_compare); + + /* Find the first duplicate. */ + prev = info [0].addend; + for (i = 1; i < count; i++) + { + curr = info [i].addend; + if (curr == prev) + break; + prev = curr; + } + + /* Remove duplicates. */ + if (i < count) + { + /* We need to move a block of elements to here. */ + dest = i++; + while (i < count) + { + curr = info [i].addend; + + /* Move a block of elements whose first one is different from + the previous. */ + if (curr == prev) + { + for (src = i + 1; src < count; src++) + if (info [src].addend != curr) + break; + } + else + src = i; + + if (src >= count) + break; + + /* Find the next duplicate. */ + prev = info [src].addend; + for (dup = src + 1; dup < count; dup++) + { + curr = info [dup].addend; + if (curr == prev) + break; + prev = curr; + } + + /* How much to move. */ + len = dup - src; + i = dup + 1; + + if (len == 1 && dup < count) + { + /* If we only move 1 element, we combine it with the next + one. Find the next different one. */ + for (diff = dup + 1, src++; diff < count; diff++, src++) + if (info [diff].addend != curr) + break; + + if (diff < count) + { + /* Find the next duplicate. */ + prev = info [diff].addend; + for (dup = diff + 1; dup < count; dup++) + { + curr = info [dup].addend; + if (curr == prev) + break; + prev = curr; + diff++; + } + + len = diff - src + 1; + i = diff + 1; + } + } + + memmove (&info [dest], &info [src], len * sizeof (*info)); + + dest += len; + } + + count = dest; + } + + return count; +} + /* Find and/or create a descriptor for dynamic symbol info. This will - vary based on global or local symbol, and the addend to the reloc. */ + vary based on global or local symbol, and the addend to the reloc. + + We don't sort when inserting. Also, we sort and eliminate + duplicates if there is an unsorted section. Typically, this will + only happen once, because we do all insertions before lookups. We + then use bsearch to do a lookup. This also allows lookups to be + fast. So we have fast insertion (O(log N) due to duplicate check), + fast lookup (O(log N)) and one sort (O(N log N) expected time). + Previously, all lookups were O(N) because of the use of the linked + list and also all insertions were O(N) because of the check for + duplicates. There are some complications here because the array + size grows occasionally, which may add an O(N) factor, but this + should be rare. Also, we free the excess array allocation, which + requires a copy which is O(N), but this only happens once. */ static struct elfNN_ia64_dyn_sym_info * get_dyn_sym_info (ia64_info, h, abfd, rel, create) @@ -1964,12 +2330,22 @@ get_dyn_sym_info (ia64_info, h, abfd, rel, create) const Elf_Internal_Rela *rel; bfd_boolean create; { - struct elfNN_ia64_dyn_sym_info **pp; - struct elfNN_ia64_dyn_sym_info *dyn_i; + struct elfNN_ia64_dyn_sym_info **info_p, *info, *dyn_i, key; + unsigned int *count_p, *sorted_count_p, *size_p; + unsigned int count, sorted_count, size; bfd_vma addend = rel ? rel->r_addend : 0; + bfd_size_type amt; if (h) - pp = &((struct elfNN_ia64_link_hash_entry *)h)->info; + { + struct elfNN_ia64_link_hash_entry *global_h; + + global_h = (struct elfNN_ia64_link_hash_entry *) h; + info_p = &global_h->info; + count_p = &global_h->count; + sorted_count_p = &global_h->sorted_count; + size_p = &global_h->size; + } else { struct elfNN_ia64_local_hash_entry *loc_h; @@ -1981,18 +2357,107 @@ get_dyn_sym_info (ia64_info, h, abfd, rel, create) return NULL; } - pp = &loc_h->info; + info_p = &loc_h->info; + count_p = &loc_h->count; + sorted_count_p = &loc_h->sorted_count; + size_p = &loc_h->size; } - for (dyn_i = *pp; dyn_i && dyn_i->addend != addend; dyn_i = *pp) - pp = &dyn_i->next; - - if (dyn_i == NULL && create) + count = *count_p; + sorted_count = *sorted_count_p; + size = *size_p; + info = *info_p; + if (create) { - dyn_i = ((struct elfNN_ia64_dyn_sym_info *) - bfd_zalloc (abfd, (bfd_size_type) sizeof *dyn_i)); - *pp = dyn_i; + /* When we create the array, we don't check for duplicates, + except in the previously sorted section if one exists, and + against the last inserted entry. This allows insertions to + be fast. */ + if (info) + { + if (sorted_count) + { + /* Try bsearch first on the sorted section. */ + key.addend = addend; + dyn_i = bsearch (&key, info, sorted_count, + sizeof (*info), addend_compare); + + if (dyn_i) + { + return dyn_i; + } + } + + /* Do a quick check for the last inserted entry. */ + dyn_i = info + count - 1; + if (dyn_i->addend == addend) + { + return dyn_i; + } + } + + if (size == 0) + { + /* It is the very first element. We create the array of size + 1. */ + size = 1; + amt = size * sizeof (*info); + info = bfd_malloc (amt); + } + else if (size <= count) + { + /* We double the array size every time when we reach the + size limit. */ + size += size; + amt = size * sizeof (*info); + info = bfd_realloc (info, amt); + } + else + goto has_space; + + if (info == NULL) + return NULL; + *size_p = size; + *info_p = info; + +has_space: + /* Append the new one to the array. */ + dyn_i = info + count; + memset (dyn_i, 0, sizeof (*dyn_i)); dyn_i->addend = addend; + + /* We increment count only since the new ones are unsorted and + may have duplicate. */ + (*count_p)++; + } + else + { + /* It is a lookup without insertion. Sort array if part of the + array isn't sorted. */ + if (count != sorted_count) + { + count = sort_dyn_sym_info (info, count); + *count_p = count; + *sorted_count_p = count; + } + + /* Free unused memory. */ + if (size != count) + { + amt = count * sizeof (*info); + info = bfd_malloc (amt); + if (info != NULL) + { + memcpy (info, *info_p, amt); + free (*info_p); + *size_p = count; + *info_p = info; + } + } + + key.addend = addend; + dyn_i = bsearch (&key, info, count, + sizeof (*info), addend_compare); } return dyn_i; @@ -2054,15 +2519,14 @@ get_fptr (abfd, info, ia64_info) if (!dynobj) ia64_info->root.dynobj = dynobj = abfd; - fptr = bfd_make_section (dynobj, ".opd"); + fptr = bfd_make_section_with_flags (dynobj, ".opd", + (SEC_ALLOC + | SEC_LOAD + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | (info->pie ? 0 : SEC_READONLY) + | SEC_LINKER_CREATED)); if (!fptr - || !bfd_set_section_flags (dynobj, fptr, - (SEC_ALLOC - | SEC_LOAD - | SEC_HAS_CONTENTS - | SEC_IN_MEMORY - | (info->pie ? 0 : SEC_READONLY) - | SEC_LINKER_CREATED)) || !bfd_set_section_alignment (abfd, fptr, 4)) { BFD_ASSERT (0); @@ -2074,15 +2538,15 @@ get_fptr (abfd, info, ia64_info) if (info->pie) { asection *fptr_rel; - fptr_rel = bfd_make_section(dynobj, ".rela.opd"); + fptr_rel = bfd_make_section_with_flags (dynobj, ".rela.opd", + (SEC_ALLOC | SEC_LOAD + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_LINKER_CREATED + | SEC_READONLY)); if (fptr_rel == NULL - || !bfd_set_section_flags (dynobj, fptr_rel, - (SEC_ALLOC | SEC_LOAD - | SEC_HAS_CONTENTS - | SEC_IN_MEMORY - | SEC_LINKER_CREATED - | SEC_READONLY)) - || !bfd_set_section_alignment (abfd, fptr_rel, 3)) + || !bfd_set_section_alignment (abfd, fptr_rel, + LOG_SECTION_ALIGN)) { BFD_ASSERT (0); return NULL; @@ -2111,15 +2575,15 @@ get_pltoff (abfd, info, ia64_info) if (!dynobj) ia64_info->root.dynobj = dynobj = abfd; - pltoff = bfd_make_section (dynobj, ELF_STRING_ia64_pltoff); + pltoff = bfd_make_section_with_flags (dynobj, + ELF_STRING_ia64_pltoff, + (SEC_ALLOC + | SEC_LOAD + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_SMALL_DATA + | SEC_LINKER_CREATED)); if (!pltoff - || !bfd_set_section_flags (dynobj, pltoff, - (SEC_ALLOC - | SEC_LOAD - | SEC_HAS_CONTENTS - | SEC_IN_MEMORY - | SEC_SMALL_DATA - | SEC_LINKER_CREATED)) || !bfd_set_section_alignment (abfd, pltoff, 4)) { BFD_ASSERT (0); @@ -2163,16 +2627,15 @@ get_reloc_section (abfd, ia64_info, sec, create) srel = bfd_get_section_by_name (dynobj, srel_name); if (srel == NULL && create) { - srel = bfd_make_section (dynobj, srel_name); + srel = bfd_make_section_with_flags (dynobj, srel_name, + (SEC_ALLOC | SEC_LOAD + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_LINKER_CREATED + | SEC_READONLY)); if (srel == NULL - || !bfd_set_section_flags (dynobj, srel, - (SEC_ALLOC - | SEC_LOAD - | SEC_HAS_CONTENTS - | SEC_IN_MEMORY - | SEC_LINKER_CREATED - | SEC_READONLY)) - || !bfd_set_section_alignment (dynobj, srel, 3)) + || !bfd_set_section_alignment (dynobj, srel, + LOG_SECTION_ALIGN)) return NULL; } @@ -2219,7 +2682,24 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs) const Elf_Internal_Rela *relend; Elf_Internal_Shdr *symtab_hdr; const Elf_Internal_Rela *rel; - asection *got, *fptr, *srel; + asection *got, *fptr, *srel, *pltoff; + enum { + NEED_GOT = 1, + NEED_GOTX = 2, + NEED_FPTR = 4, + NEED_PLTOFF = 8, + NEED_MIN_PLT = 16, + NEED_FULL_PLT = 32, + NEED_DYNREL = 64, + NEED_LTOFF_FPTR = 128, + NEED_TPREL = 256, + NEED_DTPMOD = 512, + NEED_DTPREL = 1024 + }; + int need_entry; + struct elf_link_hash_entry *h; + unsigned long r_symndx; + bfd_boolean maybe_dynamic; if (info->relocatable) return TRUE; @@ -2227,55 +2707,36 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs) symtab_hdr = &elf_tdata (abfd)->symtab_hdr; ia64_info = elfNN_ia64_hash_table (info); - got = fptr = srel = NULL; + got = fptr = srel = pltoff = NULL; relend = relocs + sec->reloc_count; + + /* We scan relocations first to create dynamic relocation arrays. We + modified get_dyn_sym_info to allow fast insertion and support fast + lookup in the next loop. */ for (rel = relocs; rel < relend; ++rel) { - enum { - NEED_GOT = 1, - NEED_GOTX = 2, - NEED_FPTR = 4, - NEED_PLTOFF = 8, - NEED_MIN_PLT = 16, - NEED_FULL_PLT = 32, - NEED_DYNREL = 64, - NEED_LTOFF_FPTR = 128, - NEED_TPREL = 256, - NEED_DTPMOD = 512, - NEED_DTPREL = 1024 - }; - - struct elf_link_hash_entry *h = NULL; - unsigned long r_symndx = ELFNN_R_SYM (rel->r_info); - struct elfNN_ia64_dyn_sym_info *dyn_i; - int need_entry; - bfd_boolean maybe_dynamic; - int dynrel_type = R_IA64_NONE; - + r_symndx = ELFNN_R_SYM (rel->r_info); if (r_symndx >= symtab_hdr->sh_info) { - /* We're dealing with a global symbol -- find its hash entry - and mark it as being referenced. */ long indx = r_symndx - symtab_hdr->sh_info; h = elf_sym_hashes (abfd)[indx]; 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; - - h->elf_link_hash_flags |= ELF_LINK_HASH_REF_REGULAR; } + else + h = NULL; /* We can only get preliminary data on whether a symbol is locally or externally defined, as not all of the input files have yet been processed. Do something with what we know, as this may help reduce memory usage and processing time later. */ - maybe_dynamic = FALSE; - if (h && ((!info->executable - && (!info->symbolic || info->unresolved_syms_in_shared_libs == RM_IGNORE)) - || ! (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) - || h->root.type == bfd_link_hash_defweak)) - maybe_dynamic = TRUE; + maybe_dynamic = (h && ((!info->executable + && (!info->symbolic + || info->unresolved_syms_in_shared_libs == RM_IGNORE)) + || !h->def_regular + || h->root.type == bfd_link_hash_defweak)); need_entry = 0; switch (ELFNN_R_TYPE (rel->r_info)) @@ -2284,9 +2745,6 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs) case R_IA64_TPREL64LSB: if (info->shared || maybe_dynamic) need_entry = NEED_DYNREL; - dynrel_type = R_IA64_TPREL64LSB; - if (info->shared) - info->flags |= DF_STATIC_TLS; break; case R_IA64_LTOFF_TPREL22: @@ -2295,11 +2753,12 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs) info->flags |= DF_STATIC_TLS; break; + case R_IA64_DTPREL32MSB: + case R_IA64_DTPREL32LSB: case R_IA64_DTPREL64MSB: case R_IA64_DTPREL64LSB: if (info->shared || maybe_dynamic) need_entry = NEED_DYNREL; - dynrel_type = R_IA64_DTPREL64LSB; break; case R_IA64_LTOFF_DTPREL22: @@ -2310,7 +2769,6 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs) case R_IA64_DTPMOD64LSB: if (info->shared || maybe_dynamic) need_entry = NEED_DYNREL; - dynrel_type = R_IA64_DTPMOD64LSB; break; case R_IA64_LTOFF_DTPMOD22: @@ -2335,7 +2793,6 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs) need_entry = NEED_FPTR | NEED_DYNREL; else need_entry = NEED_FPTR; - dynrel_type = R_IA64_FPTR64LSB; break; case R_IA64_LTOFF22: @@ -2385,7 +2842,179 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs) /* Shared objects will always need at least a REL relocation. */ if (info->shared || maybe_dynamic) need_entry = NEED_DYNREL; - dynrel_type = R_IA64_DIR64LSB; + break; + + case R_IA64_IPLTMSB: + case R_IA64_IPLTLSB: + /* Shared objects will always need at least a REL relocation. */ + if (info->shared || maybe_dynamic) + need_entry = NEED_DYNREL; + break; + + case R_IA64_PCREL22: + case R_IA64_PCREL64I: + case R_IA64_PCREL32MSB: + case R_IA64_PCREL32LSB: + case R_IA64_PCREL64MSB: + case R_IA64_PCREL64LSB: + if (maybe_dynamic) + need_entry = NEED_DYNREL; + break; + } + + if (!need_entry) + continue; + + if ((need_entry & NEED_FPTR) != 0 + && rel->r_addend) + { + (*info->callbacks->warning) + (info, _("non-zero addend in @fptr reloc"), 0, + abfd, 0, (bfd_vma) 0); + } + + if (get_dyn_sym_info (ia64_info, h, abfd, rel, TRUE) == NULL) + return FALSE; + } + + /* Now, we only do lookup without insertion, which is very fast + with the modified get_dyn_sym_info. */ + for (rel = relocs; rel < relend; ++rel) + { + struct elfNN_ia64_dyn_sym_info *dyn_i; + int dynrel_type = R_IA64_NONE; + + r_symndx = ELFNN_R_SYM (rel->r_info); + if (r_symndx >= symtab_hdr->sh_info) + { + /* We're dealing with a global symbol -- find its hash entry + and mark it as being referenced. */ + long indx = r_symndx - symtab_hdr->sh_info; + h = elf_sym_hashes (abfd)[indx]; + 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; + + h->ref_regular = 1; + } + else + h = NULL; + + /* We can only get preliminary data on whether a symbol is + locally or externally defined, as not all of the input files + have yet been processed. Do something with what we know, as + this may help reduce memory usage and processing time later. */ + maybe_dynamic = (h && ((!info->executable + && (!info->symbolic + || info->unresolved_syms_in_shared_libs == RM_IGNORE)) + || !h->def_regular + || h->root.type == bfd_link_hash_defweak)); + + need_entry = 0; + switch (ELFNN_R_TYPE (rel->r_info)) + { + case R_IA64_TPREL64MSB: + case R_IA64_TPREL64LSB: + if (info->shared || maybe_dynamic) + need_entry = NEED_DYNREL; + dynrel_type = R_IA64_TPREL64LSB; + if (info->shared) + info->flags |= DF_STATIC_TLS; + break; + + case R_IA64_LTOFF_TPREL22: + need_entry = NEED_TPREL; + if (info->shared) + info->flags |= DF_STATIC_TLS; + break; + + case R_IA64_DTPREL32MSB: + case R_IA64_DTPREL32LSB: + case R_IA64_DTPREL64MSB: + case R_IA64_DTPREL64LSB: + if (info->shared || maybe_dynamic) + need_entry = NEED_DYNREL; + dynrel_type = R_IA64_DTPRELNNLSB; + break; + + case R_IA64_LTOFF_DTPREL22: + need_entry = NEED_DTPREL; + break; + + case R_IA64_DTPMOD64MSB: + case R_IA64_DTPMOD64LSB: + if (info->shared || maybe_dynamic) + need_entry = NEED_DYNREL; + dynrel_type = R_IA64_DTPMOD64LSB; + break; + + case R_IA64_LTOFF_DTPMOD22: + need_entry = NEED_DTPMOD; + break; + + case R_IA64_LTOFF_FPTR22: + case R_IA64_LTOFF_FPTR64I: + case R_IA64_LTOFF_FPTR32MSB: + case R_IA64_LTOFF_FPTR32LSB: + case R_IA64_LTOFF_FPTR64MSB: + case R_IA64_LTOFF_FPTR64LSB: + need_entry = NEED_FPTR | NEED_GOT | NEED_LTOFF_FPTR; + break; + + case R_IA64_FPTR64I: + case R_IA64_FPTR32MSB: + case R_IA64_FPTR32LSB: + case R_IA64_FPTR64MSB: + case R_IA64_FPTR64LSB: + if (info->shared || h) + need_entry = NEED_FPTR | NEED_DYNREL; + else + need_entry = NEED_FPTR; + dynrel_type = R_IA64_FPTRNNLSB; + break; + + case R_IA64_LTOFF22: + case R_IA64_LTOFF64I: + need_entry = NEED_GOT; + break; + + case R_IA64_LTOFF22X: + need_entry = NEED_GOTX; + break; + + case R_IA64_PLTOFF22: + case R_IA64_PLTOFF64I: + case R_IA64_PLTOFF64MSB: + case R_IA64_PLTOFF64LSB: + need_entry = NEED_PLTOFF; + if (h) + { + if (maybe_dynamic) + need_entry |= NEED_MIN_PLT; + } + break; + + case R_IA64_PCREL21B: + case R_IA64_PCREL60B: + /* Depending on where this symbol is defined, we may or may not + need a full plt entry. Only skip if we know we'll not need + the entry -- static or symbolic, and the symbol definition + has already been seen. */ + if (maybe_dynamic && rel->r_addend == 0) + need_entry = NEED_FULL_PLT; + break; + + case R_IA64_IMM14: + case R_IA64_IMM22: + case R_IA64_IMM64: + case R_IA64_DIR32MSB: + case R_IA64_DIR32LSB: + case R_IA64_DIR64MSB: + case R_IA64_DIR64LSB: + /* Shared objects will always need at least a REL relocation. */ + if (info->shared || maybe_dynamic) + need_entry = NEED_DYNREL; + dynrel_type = R_IA64_DIRNNLSB; break; case R_IA64_IPLTMSB: @@ -2404,22 +3033,14 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs) case R_IA64_PCREL64LSB: if (maybe_dynamic) need_entry = NEED_DYNREL; - dynrel_type = R_IA64_PCREL64LSB; + dynrel_type = R_IA64_PCRELNNLSB; break; } if (!need_entry) continue; - if ((need_entry & NEED_FPTR) != 0 - && rel->r_addend) - { - (*info->callbacks->warning) - (info, _("non-zero addend in @fptr reloc"), 0, - abfd, 0, (bfd_vma) 0); - } - - dyn_i = get_dyn_sym_info (ia64_info, h, abfd, rel, TRUE); + dyn_i = get_dyn_sym_info (ia64_info, h, abfd, rel, FALSE); /* Record whether or not this is a local symbol. */ dyn_i->h = h; @@ -2472,13 +3093,24 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs) { if (!ia64_info->root.dynobj) ia64_info->root.dynobj = abfd; - h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; + h->needs_plt = 1; dyn_i->want_plt = 1; } if (need_entry & NEED_FULL_PLT) dyn_i->want_plt2 = 1; if (need_entry & NEED_PLTOFF) - dyn_i->want_pltoff = 1; + { + /* This is needed here, in case @pltoff is used in a non-shared + link. */ + if (!pltoff) + { + pltoff = get_pltoff (abfd, info, ia64_info); + if (!pltoff) + return FALSE; + } + + dyn_i->want_pltoff = 1; + } if ((need_entry & NEED_DYNREL) && (sec->flags & SEC_ALLOC)) { if (!srel) @@ -2557,7 +3189,7 @@ allocate_global_fptr_got (dyn_i, data) if (dyn_i->want_got && dyn_i->want_fptr - && elfNN_ia64_dynamic_symbol_p (dyn_i->h, x->info, R_IA64_FPTR64LSB)) + && elfNN_ia64_dynamic_symbol_p (dyn_i->h, x->info, R_IA64_FPTRNNLSB)) { dyn_i->got_offset = x->ofs; x->ofs += 8; @@ -2624,7 +3256,8 @@ allocate_fptr (dyn_i, data) if (!x->info->executable && (!h || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT - || h->root.type != bfd_link_hash_undefweak)) + || (h->root.type != bfd_link_hash_undefweak + && h->root.type != bfd_link_hash_undefined))) { if (h && h->dynindx == -1) { @@ -2668,7 +3301,7 @@ allocate_plt_entries (dyn_i, data) || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; - /* ??? Versioned symbols seem to lose ELF_LINK_HASH_NEEDS_PLT. */ + /* ??? Versioned symbols seem to lose NEEDS_PLT. */ if (elfNN_ia64_dynamic_symbol_p (h, x->info, 0)) { bfd_size_type offset = x->ofs; @@ -2756,50 +3389,6 @@ allocate_dynrel_entries (dyn_i, data) && ELF_ST_VISIBILITY (dyn_i->h->other) && dyn_i->h->root.type == bfd_link_hash_undefweak); - /* Take care of the normal data relocations. */ - - for (rent = dyn_i->reloc_entries; rent; rent = rent->next) - { - int count = rent->count; - - switch (rent->type) - { - case R_IA64_FPTR64LSB: - /* Allocate one iff !want_fptr and not PIE, which by this point - will be true only if we're actually allocating one statically - in the main executable. Position independent executables - need a relative reloc. */ - if (dyn_i->want_fptr && !x->info->pie) - continue; - break; - case R_IA64_PCREL64LSB: - if (!dynamic_symbol) - continue; - break; - case R_IA64_DIR64LSB: - if (!dynamic_symbol && !shared) - continue; - break; - case R_IA64_IPLTLSB: - if (!dynamic_symbol && !shared) - continue; - /* Use two REL relocations for IPLT relocations - against local symbols. */ - if (!dynamic_symbol) - count *= 2; - break; - case R_IA64_TPREL64LSB: - case R_IA64_DTPREL64LSB: - case R_IA64_DTPMOD64LSB: - break; - default: - abort (); - } - if (rent->reltext) - ia64_info->reltext = 1; - rent->srel->_raw_size += sizeof (ElfNN_External_Rela) * count; - } - /* Take care of the GOT and PLT relocations. */ if ((!resolved_zero @@ -2813,18 +3402,22 @@ allocate_dynrel_entries (dyn_i, data) || !x->info->pie || dyn_i->h == NULL || dyn_i->h->root.type != bfd_link_hash_undefweak) - ia64_info->rel_got_sec->_raw_size += sizeof (ElfNN_External_Rela); + ia64_info->rel_got_sec->size += sizeof (ElfNN_External_Rela); } if ((dynamic_symbol || shared) && dyn_i->want_tprel) - ia64_info->rel_got_sec->_raw_size += sizeof (ElfNN_External_Rela); + ia64_info->rel_got_sec->size += sizeof (ElfNN_External_Rela); if (dynamic_symbol && dyn_i->want_dtpmod) - ia64_info->rel_got_sec->_raw_size += sizeof (ElfNN_External_Rela); + ia64_info->rel_got_sec->size += sizeof (ElfNN_External_Rela); if (dynamic_symbol && dyn_i->want_dtprel) - ia64_info->rel_got_sec->_raw_size += sizeof (ElfNN_External_Rela); + ia64_info->rel_got_sec->size += sizeof (ElfNN_External_Rela); + + if (x->only_got) + return TRUE; + if (ia64_info->rel_fptr_sec && dyn_i->want_fptr) { if (dyn_i->h == NULL || dyn_i->h->root.type != bfd_link_hash_undefweak) - ia64_info->rel_fptr_sec->_raw_size += sizeof (ElfNN_External_Rela); + ia64_info->rel_fptr_sec->size += sizeof (ElfNN_External_Rela); } if (!resolved_zero && dyn_i->want_pltoff) @@ -2839,7 +3432,55 @@ allocate_dynrel_entries (dyn_i, data) else if (shared) t = 2 * sizeof (ElfNN_External_Rela); - ia64_info->rel_pltoff_sec->_raw_size += t; + ia64_info->rel_pltoff_sec->size += t; + } + + /* Take care of the normal data relocations. */ + + for (rent = dyn_i->reloc_entries; rent; rent = rent->next) + { + int count = rent->count; + + switch (rent->type) + { + case R_IA64_FPTR32LSB: + case R_IA64_FPTR64LSB: + /* Allocate one iff !want_fptr and not PIE, which by this point + will be true only if we're actually allocating one statically + in the main executable. Position independent executables + need a relative reloc. */ + if (dyn_i->want_fptr && !x->info->pie) + continue; + break; + case R_IA64_PCREL32LSB: + case R_IA64_PCREL64LSB: + if (!dynamic_symbol) + continue; + break; + case R_IA64_DIR32LSB: + case R_IA64_DIR64LSB: + if (!dynamic_symbol && !shared) + continue; + break; + case R_IA64_IPLTLSB: + if (!dynamic_symbol && !shared) + continue; + /* Use two REL relocations for IPLT relocations + against local symbols. */ + if (!dynamic_symbol) + count *= 2; + break; + case R_IA64_DTPREL32LSB: + case R_IA64_TPREL64LSB: + case R_IA64_DTPREL64LSB: + case R_IA64_DTPMOD64LSB: + break; + default: + abort (); + } + if (rent->reltext) + ia64_info->reltext = 1; + rent->srel->size += sizeof (ElfNN_External_Rela) * count; } return TRUE; @@ -2856,12 +3497,12 @@ elfNN_ia64_adjust_dynamic_symbol (info, h) /* 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) + if (h->u.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; + BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined + || h->u.weakdef->root.type == bfd_link_hash_defweak); + h->root.u.def.section = h->u.weakdef->root.u.def.section; + h->root.u.def.value = h->u.weakdef->root.u.def.value; return TRUE; } @@ -2899,7 +3540,7 @@ elfNN_ia64_size_dynamic_sections (output_bfd, info) sec = bfd_get_section_by_name (dynobj, ".interp"); BFD_ASSERT (sec != NULL); sec->contents = (bfd_byte *) ELF_DYNAMIC_INTERPRETER; - sec->_raw_size = strlen (ELF_DYNAMIC_INTERPRETER) + 1; + sec->size = strlen (ELF_DYNAMIC_INTERPRETER) + 1; } /* Allocate the GOT entries. */ @@ -2910,7 +3551,7 @@ elfNN_ia64_size_dynamic_sections (output_bfd, info) elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_global_data_got, &data); elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_global_fptr_got, &data); elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_local_got, &data); - ia64_info->got_sec->_raw_size = data.ofs; + ia64_info->got_sec->size = data.ofs; } /* Allocate the FPTR entries. */ @@ -2919,7 +3560,7 @@ elfNN_ia64_size_dynamic_sections (output_bfd, info) { data.ofs = 0; elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_fptr, &data); - ia64_info->fptr_sec->_raw_size = data.ofs; + ia64_info->fptr_sec->size = data.ofs; } /* Now that we've seen all of the input files, we can decide which @@ -2949,12 +3590,12 @@ elfNN_ia64_size_dynamic_sections (output_bfd, info) BFD_ASSERT (ia64_info->root.dynamic_sections_created); - ia64_info->plt_sec->_raw_size = data.ofs; + ia64_info->plt_sec->size = data.ofs; /* If we've got a .plt, we need some extra memory for the dynamic linker. We stuff these in .got.plt. */ sec = bfd_get_section_by_name (dynobj, ".got.plt"); - sec->_raw_size = 8 * PLT_RESERVED_WORDS; + sec->size = 8 * PLT_RESERVED_WORDS; } /* Allocate the PLTOFF entries. */ @@ -2963,7 +3604,7 @@ elfNN_ia64_size_dynamic_sections (output_bfd, info) { data.ofs = 0; elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_pltoff_entries, &data); - ia64_info->pltoff_sec->_raw_size = data.ofs; + ia64_info->pltoff_sec->size = data.ofs; } if (ia64_info->root.dynamic_sections_created) @@ -2972,7 +3613,8 @@ elfNN_ia64_size_dynamic_sections (output_bfd, info) required. */ if (info->shared && ia64_info->self_dtpmod_offset != (bfd_vma) -1) - ia64_info->rel_got_sec->_raw_size += sizeof (ElfNN_External_Rela); + ia64_info->rel_got_sec->size += sizeof (ElfNN_External_Rela); + data.only_got = FALSE; elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_dynrel_entries, &data); } @@ -2993,7 +3635,7 @@ elfNN_ia64_size_dynamic_sections (output_bfd, info) function which decides whether anything needs to go into these sections. */ - strip = (sec->_raw_size == 0); + strip = (sec->size == 0); if (sec == ia64_info->got_sec) strip = FALSE; @@ -3066,12 +3708,12 @@ elfNN_ia64_size_dynamic_sections (output_bfd, info) } if (strip) - _bfd_strip_section_from_output (info, sec); + sec->flags |= SEC_EXCLUDE; else { /* Allocate memory for the section contents. */ - sec->contents = (bfd_byte *) bfd_zalloc (dynobj, sec->_raw_size); - if (sec->contents == NULL && sec->_raw_size != 0) + sec->contents = (bfd_byte *) bfd_zalloc (dynobj, sec->size); + if (sec->contents == NULL && sec->size != 0) return FALSE; } } @@ -3125,15 +3767,15 @@ elfNN_ia64_size_dynamic_sections (output_bfd, info) } static bfd_reloc_status_type -elfNN_ia64_install_value (abfd, hit_addr, v, r_type) - bfd *abfd; +elfNN_ia64_install_value (hit_addr, v, r_type) bfd_byte *hit_addr; bfd_vma v; unsigned int r_type; { const struct ia64_operand *op; int bigendian = 0, shift = 0; - bfd_vma t0, t1, insn, dword; + bfd_vma t0, t1, dword; + ia64_insn insn; enum ia64_opnd opnd; const char *err; size_t size = 8; @@ -3258,8 +3900,8 @@ elfNN_ia64_install_value (abfd, hit_addr, v, r_type) { case IA64_OPND_IMMU64: hit_addr -= (long) hit_addr & 0x3; - t0 = bfd_get_64 (abfd, hit_addr); - t1 = bfd_get_64 (abfd, hit_addr + 8); + t0 = bfd_getl64 (hit_addr); + t1 = bfd_getl64 (hit_addr + 8); /* tmpl/s: bits 0.. 5 in t0 slot 0: bits 5..45 in t0 @@ -3281,14 +3923,14 @@ elfNN_ia64_install_value (abfd, hit_addr, v, r_type) | (((val >> 21) & 0x001) << 21) /* ic */ | (((val >> 63) & 0x001) << 36)) << 23; /* i */ - bfd_put_64 (abfd, t0, hit_addr); - bfd_put_64 (abfd, t1, hit_addr + 8); + bfd_putl64 (t0, hit_addr); + bfd_putl64 (t1, hit_addr + 8); break; case IA64_OPND_TGT64: hit_addr -= (long) hit_addr & 0x3; - t0 = bfd_get_64 (abfd, hit_addr); - t1 = bfd_get_64 (abfd, hit_addr + 8); + t0 = bfd_getl64 (hit_addr); + t1 = bfd_getl64 (hit_addr + 8); /* tmpl/s: bits 0.. 5 in t0 slot 0: bits 5..45 in t0 @@ -3306,8 +3948,8 @@ elfNN_ia64_install_value (abfd, hit_addr, v, r_type) t1 |= ((((val >> 0) & 0xfffffLL) << 13) /* imm20b */ | (((val >> 59) & 0x1LL) << 36)) << 23; /* i */ - bfd_put_64 (abfd, t0, hit_addr); - bfd_put_64 (abfd, t1, hit_addr + 8); + bfd_putl64 (t0, hit_addr); + bfd_putl64 (t1, hit_addr + 8); break; default: @@ -3318,17 +3960,17 @@ elfNN_ia64_install_value (abfd, hit_addr, v, r_type) case 2: shift = 23; hit_addr += 6; break; case 3: return bfd_reloc_notsupported; /* shouldn't happen... */ } - dword = bfd_get_64 (abfd, hit_addr); + dword = bfd_getl64 (hit_addr); insn = (dword >> shift) & 0x1ffffffffffLL; op = elf64_ia64_operands + opnd; - err = (*op->insert) (op, val, (ia64_insn *)& insn); + err = (*op->insert) (op, val, &insn); if (err) return bfd_reloc_overflow; dword &= ~(0x1ffffffffffLL << shift); dword |= (insn << shift); - bfd_put_64 (abfd, dword, hit_addr); + bfd_putl64 (dword, hit_addr); break; case IA64_OPND_NIL: @@ -3382,8 +4024,7 @@ elfNN_ia64_install_dyn_reloc (abfd, info, sec, srel, offset, type, loc = srel->contents; loc += srel->reloc_count++ * sizeof (ElfNN_External_Rela); bfd_elfNN_swap_reloca_out (abfd, &outrel, loc); - BFD_ASSERT (sizeof (ElfNN_External_Rela) * srel->reloc_count - <= srel->_cooked_size); + BFD_ASSERT (sizeof (ElfNN_External_Rela) * srel->reloc_count <= srel->size); } /* Store an entry for target address TARGET_ADDR in the linkage table @@ -3428,6 +4069,7 @@ set_got_entry (abfd, info, dyn_i, dynindx, addend, value, dyn_r_type) } got_offset = dyn_i->dtpmod_offset; break; + case R_IA64_DTPREL32LSB: case R_IA64_DTPREL64LSB: done = dyn_i->dtprel_done; dyn_i->dtprel_done = TRUE; @@ -3452,9 +4094,12 @@ set_got_entry (abfd, info, dyn_i, dynindx, addend, value, dyn_r_type) && (!dyn_i->h || ELF_ST_VISIBILITY (dyn_i->h->other) == STV_DEFAULT || dyn_i->h->root.type != bfd_link_hash_undefweak) + && dyn_r_type != R_IA64_DTPREL32LSB && dyn_r_type != R_IA64_DTPREL64LSB) || elfNN_ia64_dynamic_symbol_p (dyn_i->h, info, dyn_r_type) - || (dynindx != -1 && dyn_r_type == R_IA64_FPTR64LSB)) + || (dynindx != -1 + && (dyn_r_type == R_IA64_FPTR32LSB + || dyn_r_type == R_IA64_FPTR64LSB))) && (!dyn_i->want_ltoff_fptr || !info->pie || !dyn_i->h @@ -3463,9 +4108,10 @@ set_got_entry (abfd, info, dyn_i, dynindx, addend, value, dyn_r_type) if (dynindx == -1 && dyn_r_type != R_IA64_TPREL64LSB && dyn_r_type != R_IA64_DTPMOD64LSB + && dyn_r_type != R_IA64_DTPREL32LSB && dyn_r_type != R_IA64_DTPREL64LSB) { - dyn_r_type = R_IA64_REL64LSB; + dyn_r_type = R_IA64_RELNNLSB; dynindx = 0; addend = value; } @@ -3474,6 +4120,18 @@ set_got_entry (abfd, info, dyn_i, dynindx, addend, value, dyn_r_type) { switch (dyn_r_type) { + case R_IA64_REL32LSB: + dyn_r_type = R_IA64_REL32MSB; + break; + case R_IA64_DIR32LSB: + dyn_r_type = R_IA64_DIR32MSB; + break; + case R_IA64_FPTR32LSB: + dyn_r_type = R_IA64_FPTR32MSB; + break; + case R_IA64_DTPREL32LSB: + dyn_r_type = R_IA64_DTPREL32MSB; + break; case R_IA64_REL64LSB: dyn_r_type = R_IA64_REL64MSB; break; @@ -3603,9 +4261,9 @@ set_pltoff_entry (abfd, info, dyn_i, value, is_plt) unsigned int dyn_r_type; if (bfd_big_endian (abfd)) - dyn_r_type = R_IA64_REL64MSB; + dyn_r_type = R_IA64_RELNNMSB; else - dyn_r_type = R_IA64_REL64LSB; + dyn_r_type = R_IA64_RELNNLSB; elfNN_ia64_install_dyn_reloc (abfd, NULL, pltoff_sec, ia64_info->rel_pltoff_sec, @@ -3613,7 +4271,7 @@ set_pltoff_entry (abfd, info, dyn_i, value, is_plt) dyn_r_type, 0, value); elfNN_ia64_install_dyn_reloc (abfd, NULL, pltoff_sec, ia64_info->rel_pltoff_sec, - dyn_i->pltoff_offset + 8, + dyn_i->pltoff_offset + ARCH_SIZE / 8, dyn_r_type, 0, gp); } @@ -3631,7 +4289,7 @@ set_pltoff_entry (abfd, info, dyn_i, value, is_plt) /* Return the base VMA address which should be subtracted from real addresses when resolving @tprel() relocation. Main program TLS (whose template starts at PT_TLS p_vaddr) - is assigned offset round(16, PT_TLS p_align). */ + is assigned offset round(2 * size of pointer, PT_TLS p_align). */ static bfd_vma elfNN_ia64_tprel_base (info) @@ -3640,7 +4298,8 @@ elfNN_ia64_tprel_base (info) asection *tls_sec = elf_hash_table (info)->tls_sec; BFD_ASSERT (tls_sec != NULL); - return tls_sec->vma - align_power ((bfd_vma) 16, tls_sec->alignment_power); + return tls_sec->vma - align_power ((bfd_vma) ARCH_SIZE / 4, + tls_sec->alignment_power); } /* Return the base VMA address which should be subtracted from real addresses @@ -3699,7 +4358,7 @@ elfNN_ia64_choose_gp (abfd, info) continue; lo = os->vma; - hi = os->vma + os->_raw_size; + hi = os->vma + os->size; if (hi < lo) hi = (bfd_vma) -1; @@ -3740,14 +4399,16 @@ elfNN_ia64_choose_gp (abfd, info) gp_val = got_sec->output_section->vma; else if (max_short_vma != 0) gp_val = min_short_vma; - else + else if (max_vma - min_vma < 0x200000) gp_val = min_vma; + else + gp_val = max_vma - 0x200000 + 8; /* If it is possible to address the entire image, but we don't with the choice above, adjust. */ if (max_vma - min_vma < 0x400000 - && max_vma - gp_val <= 0x200000 - && gp_val - min_vma > 0x200000) + && (max_vma - gp_val >= 0x200000 + || gp_val - min_vma > 0x200000)) gp_val = min_vma + 0x200000; else if (max_short_vma != 0) { @@ -3804,15 +4465,15 @@ elfNN_ia64_final_link (abfd, info) /* Make sure we've got ourselves a nice fat __gp value. */ if (!info->relocatable) { - bfd_vma gp_val = _bfd_get_gp_value (abfd); + bfd_vma gp_val; struct elf_link_hash_entry *gp; - if (gp_val == 0) - { - if (! elfNN_ia64_choose_gp (abfd, info)) - return FALSE; - gp_val = _bfd_get_gp_value (abfd); - } + /* We assume after gp is set, section size will only decrease. We + need to adjust gp for it. */ + _bfd_set_gp_value (abfd, 0); + if (! elfNN_ia64_choose_gp (abfd, info)) + return FALSE; + gp_val = _bfd_get_gp_value (abfd); gp = elf_link_hash_lookup (elf_hash_table (info), "__gp", FALSE, FALSE, FALSE); @@ -3835,7 +4496,7 @@ elfNN_ia64_final_link (abfd, info) { unwind_output_sec = s->output_section; unwind_output_sec->contents - = bfd_malloc (unwind_output_sec->_raw_size); + = bfd_malloc (unwind_output_sec->size); if (unwind_output_sec->contents == NULL) return FALSE; } @@ -3849,13 +4510,13 @@ elfNN_ia64_final_link (abfd, info) { elfNN_ia64_unwind_entry_compare_bfd = abfd; qsort (unwind_output_sec->contents, - (size_t) (unwind_output_sec->_raw_size / 24), + (size_t) (unwind_output_sec->size / 24), 24, elfNN_ia64_unwind_entry_compare); if (! bfd_set_section_contents (abfd, unwind_output_sec, unwind_output_sec->contents, (bfd_vma) 0, - unwind_output_sec->_raw_size)) + unwind_output_sec->size)) return FALSE; } @@ -3922,8 +4583,8 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section, if (r_type > R_IA64_MAX_RELOC_CODE) { (*_bfd_error_handler) - (_("%s: unknown relocation type %d"), - bfd_archive_filename (input_bfd), (int)r_type); + (_("%B: unknown relocation type %d"), + input_bfd, (int) r_type); bfd_set_error (bfd_error_bad_value); ret_val = FALSE; continue; @@ -3954,8 +4615,11 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section, if (loc_h && ! loc_h->sec_merge_done) { struct elfNN_ia64_dyn_sym_info *dynent; + unsigned int count; - for (dynent = loc_h->info; dynent; dynent = dynent->next) + for (count = loc_h->count, dynent = loc_h->info; + count != 0; + count--, dynent++) { msec = sym_sec; dynent->addend = @@ -3963,14 +4627,17 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section, elf_section_data (msec)-> sec_info, sym->st_value - + dynent->addend, - (bfd_vma) 0); + + dynent->addend); dynent->addend -= sym->st_value; dynent->addend += msec->output_section->vma + msec->output_offset - sym_sec->output_section->vma - sym_sec->output_offset; } + + qsort (loc_h->info, loc_h->count, + sizeof (*loc_h->info), addend_compare); + loc_h->sec_merge_done = 1; } } @@ -4028,9 +4695,11 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section, /* ??? People shouldn't be doing non-pic code in shared libraries nor dynamic executables. */ (*_bfd_error_handler) - (_("%s: non-pic code with imm relocation against dynamic symbol `%s'"), - bfd_archive_filename (input_bfd), - h->root.root.string); + (_("%B: non-pic code with imm relocation against dynamic symbol `%s'"), + input_bfd, + h ? h->root.root.string + : bfd_elf_sym_name (input_bfd, symtab_hdr, sym, + sym_sec)); ret_val = FALSE; continue; @@ -4081,7 +4750,7 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section, case R_IA64_LTV32LSB: case R_IA64_LTV64MSB: case R_IA64_LTV64LSB: - r = elfNN_ia64_install_value (output_bfd, hit_addr, value, r_type); + r = elfNN_ia64_install_value (hit_addr, value, r_type); break; case R_IA64_GPREL22: @@ -4093,13 +4762,16 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section, if (dynamic_symbol_p) { (*_bfd_error_handler) - (_("%s: @gprel relocation against dynamic symbol %s"), - bfd_archive_filename (input_bfd), h->root.root.string); + (_("%B: @gprel relocation against dynamic symbol %s"), + input_bfd, + h ? h->root.root.string + : bfd_elf_sym_name (input_bfd, symtab_hdr, sym, + sym_sec)); ret_val = FALSE; continue; } value -= gp_val; - r = elfNN_ia64_install_value (output_bfd, hit_addr, value, r_type); + r = elfNN_ia64_install_value (hit_addr, value, r_type); break; case R_IA64_LTOFF22: @@ -4107,9 +4779,9 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section, case R_IA64_LTOFF64I: dyn_i = get_dyn_sym_info (ia64_info, h, input_bfd, rel, FALSE); value = set_got_entry (input_bfd, info, dyn_i, (h ? h->dynindx : -1), - rel->r_addend, value, R_IA64_DIR64LSB); + rel->r_addend, value, R_IA64_DIRNNLSB); value -= gp_val; - r = elfNN_ia64_install_value (output_bfd, hit_addr, value, r_type); + r = elfNN_ia64_install_value (hit_addr, value, r_type); break; case R_IA64_PLTOFF22: @@ -4119,7 +4791,7 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section, dyn_i = get_dyn_sym_info (ia64_info, h, input_bfd, rel, FALSE); value = set_pltoff_entry (output_bfd, info, dyn_i, value, FALSE); value -= gp_val; - r = elfNN_ia64_install_value (output_bfd, hit_addr, value, r_type); + r = elfNN_ia64_install_value (hit_addr, value, r_type); break; case R_IA64_FPTR64I: @@ -4153,14 +4825,14 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section, /* ??? People shouldn't be doing non-pic code in shared libraries. Hork. */ (*_bfd_error_handler) - (_("%s: linking non-pic code in a position independent executable"), - bfd_archive_filename (input_bfd)); + (_("%B: linking non-pic code in a position independent executable"), + input_bfd); ret_val = FALSE; continue; } dynindx = 0; addend = value; - dyn_r_type = r_type + R_IA64_REL64LSB - R_IA64_FPTR64LSB; + dyn_r_type = r_type + R_IA64_RELNNLSB - R_IA64_FPTRNNLSB; } else if (h) { @@ -4184,7 +4856,7 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section, dynindx, addend); } - r = elfNN_ia64_install_value (output_bfd, hit_addr, value, r_type); + r = elfNN_ia64_install_value (hit_addr, value, r_type); break; case R_IA64_LTOFF_FPTR22: @@ -4199,7 +4871,7 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section, dyn_i = get_dyn_sym_info (ia64_info, h, input_bfd, rel, FALSE); if (dyn_i->want_fptr) { - BFD_ASSERT (h == NULL || h->dynindx == -1) + BFD_ASSERT (h == NULL || h->dynindx == -1); if (!undef_weak_ref) value = set_fptr_entry (output_bfd, info, dyn_i, value); dynindx = -1; @@ -4224,9 +4896,9 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section, } value = set_got_entry (output_bfd, info, dyn_i, dynindx, - rel->r_addend, value, R_IA64_FPTR64LSB); + rel->r_addend, value, R_IA64_FPTRNNLSB); value -= gp_val; - r = elfNN_ia64_install_value (output_bfd, hit_addr, value, r_type); + r = elfNN_ia64_install_value (hit_addr, value, r_type); } break; @@ -4283,20 +4955,24 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section, case R_IA64_PCREL64I: /* The PCREL21BI reloc is specifically not intended for use with dynamic relocs. PCREL21F and PCREL21M are used for speculation - fixup code, and thus probably ought not be dynamic. The + fixup code, and thus probably ought not be dynamic. The PCREL22 and PCREL64I relocs aren't emitted as dynamic relocs. */ if (dynamic_symbol_p) { const char *msg; if (r_type == R_IA64_PCREL21BI) - msg = _("%s: @internal branch to dynamic symbol %s"); + msg = _("%B: @internal branch to dynamic symbol %s"); else if (r_type == R_IA64_PCREL21F || r_type == R_IA64_PCREL21M) - msg = _("%s: speculation fixup to dynamic symbol %s"); + msg = _("%B: speculation fixup to dynamic symbol %s"); else - msg = _("%s: @pcrel relocation against dynamic symbol %s"); - (*_bfd_error_handler) (msg, bfd_archive_filename (input_bfd), - h->root.root.string); + msg = _("%B: @pcrel relocation against dynamic symbol %s"); + (*_bfd_error_handler) (msg, input_bfd, + h ? h->root.root.string + : bfd_elf_sym_name (input_bfd, + symtab_hdr, + sym, + sym_sec)); ret_val = FALSE; continue; } @@ -4307,7 +4983,7 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section, value -= (input_section->output_section->vma + input_section->output_offset + rel->r_offset) & ~ (bfd_vma) 0x3; - r = elfNN_ia64_install_value (output_bfd, hit_addr, value, r_type); + r = elfNN_ia64_install_value (hit_addr, value, r_type); break; case R_IA64_SEGREL32MSB: @@ -4351,8 +5027,7 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section, value -= p->p_vaddr; else value = 0; - r = elfNN_ia64_install_value (output_bfd, hit_addr, value, - r_type); + r = elfNN_ia64_install_value (hit_addr, value, r_type); } break; } @@ -4361,12 +5036,11 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section, case R_IA64_SECREL32LSB: case R_IA64_SECREL64MSB: case R_IA64_SECREL64LSB: - /* Make output-section relative. */ - if (value > input_section->output_section->vma) - value -= input_section->output_section->vma; - else - value = 0; - r = elfNN_ia64_install_value (output_bfd, hit_addr, value, r_type); + /* Make output-section relative to section where the symbol + is defined. PR 475 */ + if (sym_sec) + value -= sym_sec->output_section->vma; + r = elfNN_ia64_install_value (hit_addr, value, r_type); break; case R_IA64_IPLTMSB: @@ -4407,25 +5081,26 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section, r_type = R_IA64_DIR64MSB; else r_type = R_IA64_DIR64LSB; - elfNN_ia64_install_value (output_bfd, hit_addr, value, r_type); - r = elfNN_ia64_install_value (output_bfd, hit_addr + 8, gp_val, - r_type); + elfNN_ia64_install_value (hit_addr, value, r_type); + r = elfNN_ia64_install_value (hit_addr + 8, gp_val, r_type); break; case R_IA64_TPREL14: case R_IA64_TPREL22: case R_IA64_TPREL64I: value -= elfNN_ia64_tprel_base (info); - r = elfNN_ia64_install_value (output_bfd, hit_addr, value, r_type); + r = elfNN_ia64_install_value (hit_addr, value, r_type); break; case R_IA64_DTPREL14: case R_IA64_DTPREL22: case R_IA64_DTPREL64I: + case R_IA64_DTPREL32LSB: + case R_IA64_DTPREL32MSB: case R_IA64_DTPREL64LSB: case R_IA64_DTPREL64MSB: value -= elfNN_ia64_dtprel_base (info); - r = elfNN_ia64_install_value (output_bfd, hit_addr, value, r_type); + r = elfNN_ia64_install_value (hit_addr, value, r_type); break; case R_IA64_LTOFF_TPREL22: @@ -4460,15 +5135,14 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section, case R_IA64_LTOFF_DTPREL22: if (!dynamic_symbol_p) value -= elfNN_ia64_dtprel_base (info); - got_r_type = R_IA64_DTPREL64LSB; + got_r_type = R_IA64_DTPRELNNLSB; break; } dyn_i = get_dyn_sym_info (ia64_info, h, input_bfd, rel, FALSE); value = set_got_entry (input_bfd, info, dyn_i, dynindx, r_addend, value, got_r_type); value -= gp_val; - r = elfNN_ia64_install_value (output_bfd, hit_addr, value, - r_type); + r = elfNN_ia64_install_value (hit_addr, value, r_type); } break; @@ -4497,15 +5171,8 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section, if (h) 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, input_section); - } + name = bfd_elf_sym_name (input_bfd, symtab_hdr, sym, + sym_sec); if (!(*info->callbacks->warning) (info, _("unsupported reloc"), name, input_bfd, input_section, rel->r_offset)) @@ -4524,22 +5191,39 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section, if (h) name = h->root.root.string; else + name = bfd_elf_sym_name (input_bfd, symtab_hdr, sym, + sym_sec); + + switch (r_type) { - name = bfd_elf_string_from_elf_section (input_bfd, - symtab_hdr->sh_link, - sym->st_name); - if (name == NULL) + case R_IA64_PCREL21B: + case R_IA64_PCREL21BI: + case R_IA64_PCREL21M: + case R_IA64_PCREL21F: + if (is_elf_hash_table (info->hash)) + { + /* Relaxtion is always performed for ELF output. + Overflow failures for those relocations mean + that the section is too big to relax. */ + (*_bfd_error_handler) + (_("%B: Can't relax br (%s) to `%s' at 0x%lx in section `%A' with size 0x%lx (> 0x1000000)."), + input_bfd, input_section, howto->name, name, + rel->r_offset, input_section->size); + break; + } + default: + if (!(*info->callbacks->reloc_overflow) (info, + &h->root, + name, + howto->name, + (bfd_vma) 0, + input_bfd, + input_section, + rel->r_offset)) return FALSE; - if (*name == '\0') - name = bfd_section_name (input_bfd, input_section); + break; } - if (!(*info->callbacks->reloc_overflow) (info, name, - howto->name, - (bfd_vma) 0, - input_bfd, - input_section, - rel->r_offset)) - return FALSE; + ret_val = FALSE; } break; @@ -4579,9 +5263,8 @@ elfNN_ia64_finish_dynamic_symbol (output_bfd, info, h, sym) loc = plt_sec->contents + dyn_i->plt_offset; memcpy (loc, plt_min_entry, PLT_MIN_ENTRY_SIZE); - elfNN_ia64_install_value (output_bfd, loc, index, R_IA64_IMM22); - elfNN_ia64_install_value (output_bfd, loc+2, -dyn_i->plt_offset, - R_IA64_PCREL21B); + elfNN_ia64_install_value (loc, index, R_IA64_IMM22); + elfNN_ia64_install_value (loc+2, -dyn_i->plt_offset, R_IA64_PCREL21B); plt_addr = (plt_sec->output_section->vma + plt_sec->output_offset @@ -4594,14 +5277,13 @@ elfNN_ia64_finish_dynamic_symbol (output_bfd, info, h, sym) loc = plt_sec->contents + dyn_i->plt2_offset; memcpy (loc, plt_full_entry, PLT_FULL_ENTRY_SIZE); - elfNN_ia64_install_value (output_bfd, loc, pltoff_addr - gp_val, - R_IA64_IMM22); + elfNN_ia64_install_value (loc, pltoff_addr - gp_val, R_IA64_IMM22); /* Mark the symbol as undefined, rather than as defined in the plt section. Leave the value alone. */ /* ??? We didn't redefine it in adjust_dynamic_symbol in the first place. But perhaps elflink.c did some for us. */ - if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + if (!h->def_regular) sym->st_shndx = SHN_UNDEF; } @@ -4633,8 +5315,8 @@ elfNN_ia64_finish_dynamic_symbol (output_bfd, info, h, sym) /* Mark some specially defined symbols as absolute. */ if (strcmp (h->root.root.string, "_DYNAMIC") == 0 - || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0 - || strcmp (h->root.root.string, "_PROCEDURE_LINKAGE_TABLE_") == 0) + || h == ia64_info->root.hgot + || h == ia64_info->root.hplt) sym->st_shndx = SHN_ABS; return TRUE; @@ -4661,7 +5343,7 @@ elfNN_ia64_finish_dynamic_sections (abfd, info) sgotplt = bfd_get_section_by_name (dynobj, ".got.plt"); BFD_ASSERT (sdyn != NULL); dyncon = (ElfNN_External_Dyn *) sdyn->contents; - dynconend = (ElfNN_External_Dyn *) (sdyn->contents + sdyn->_raw_size); + dynconend = (ElfNN_External_Dyn *) (sdyn->contents + sdyn->size); gp_val = _bfd_get_gp_value (abfd); @@ -4718,7 +5400,7 @@ elfNN_ia64_finish_dynamic_sections (abfd, info) + sgotplt->output_offset - gp_val); - elfNN_ia64_install_value (abfd, loc+1, pltres, R_IA64_GPREL22); + elfNN_ia64_install_value (loc+1, pltres, R_IA64_GPREL22); } } @@ -4785,8 +5467,8 @@ elfNN_ia64_merge_private_bfd_data (ibfd, obfd) if ((in_flags & EF_IA_64_TRAPNIL) != (out_flags & EF_IA_64_TRAPNIL)) { (*_bfd_error_handler) - (_("%s: linking trap-on-NULL-dereference with non-trapping files"), - bfd_archive_filename (ibfd)); + (_("%B: linking trap-on-NULL-dereference with non-trapping files"), + ibfd); bfd_set_error (bfd_error_bad_value); ok = FALSE; @@ -4794,8 +5476,8 @@ elfNN_ia64_merge_private_bfd_data (ibfd, obfd) if ((in_flags & EF_IA_64_BE) != (out_flags & EF_IA_64_BE)) { (*_bfd_error_handler) - (_("%s: linking big-endian files with little-endian files"), - bfd_archive_filename (ibfd)); + (_("%B: linking big-endian files with little-endian files"), + ibfd); bfd_set_error (bfd_error_bad_value); ok = FALSE; @@ -4803,8 +5485,8 @@ elfNN_ia64_merge_private_bfd_data (ibfd, obfd) if ((in_flags & EF_IA_64_ABI64) != (out_flags & EF_IA_64_ABI64)) { (*_bfd_error_handler) - (_("%s: linking 64-bit files with 32-bit files"), - bfd_archive_filename (ibfd)); + (_("%B: linking 64-bit files with 32-bit files"), + ibfd); bfd_set_error (bfd_error_bad_value); ok = FALSE; @@ -4812,8 +5494,8 @@ elfNN_ia64_merge_private_bfd_data (ibfd, obfd) if ((in_flags & EF_IA_64_CONS_GP) != (out_flags & EF_IA_64_CONS_GP)) { (*_bfd_error_handler) - (_("%s: linking constant-gp files with non-constant-gp files"), - bfd_archive_filename (ibfd)); + (_("%B: linking constant-gp files with non-constant-gp files"), + ibfd); bfd_set_error (bfd_error_bad_value); ok = FALSE; @@ -4822,8 +5504,8 @@ elfNN_ia64_merge_private_bfd_data (ibfd, obfd) != (out_flags & EF_IA_64_NOFUNCDESC_CONS_GP)) { (*_bfd_error_handler) - (_("%s: linking auto-pic files with non-auto-pic files"), - bfd_archive_filename (ibfd)); + (_("%B: linking auto-pic files with non-auto-pic files"), + ibfd); bfd_set_error (bfd_error_bad_value); ok = FALSE; @@ -4877,13 +5559,106 @@ elfNN_ia64_reloc_type_class (rela) } } -static struct bfd_elf_special_section const elfNN_ia64_special_sections[]= +static const struct bfd_elf_special_section elfNN_ia64_special_sections[] = { { ".sbss", 5, -1, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_IA_64_SHORT }, { ".sdata", 6, -1, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_IA_64_SHORT }, - { NULL, 0, 0, 0, 0 } + { NULL, 0, 0, 0, 0 } }; +static bfd_boolean +elfNN_ia64_object_p (bfd *abfd) +{ + asection *sec; + asection *group, *unwi, *unw; + flagword flags; + const char *name; + char *unwi_name, *unw_name; + bfd_size_type amt; + + if (abfd->flags & DYNAMIC) + return TRUE; + + /* Flags for fake group section. */ + flags = (SEC_LINKER_CREATED | SEC_GROUP | SEC_LINK_ONCE + | SEC_EXCLUDE); + + /* We add a fake section group for each .gnu.linkonce.t.* section, + which isn't in a section group, and its unwind sections. */ + for (sec = abfd->sections; sec != NULL; sec = sec->next) + { + if (elf_sec_group (sec) == NULL + && ((sec->flags & (SEC_LINK_ONCE | SEC_CODE | SEC_GROUP)) + == (SEC_LINK_ONCE | SEC_CODE)) + && strncmp (sec->name, ".gnu.linkonce.t.", 16) == 0) + { + name = sec->name + 16; + + amt = strlen (name) + sizeof (".gnu.linkonce.ia64unwi."); + unwi_name = bfd_alloc (abfd, amt); + if (!unwi_name) + return FALSE; + + strcpy (stpcpy (unwi_name, ".gnu.linkonce.ia64unwi."), name); + unwi = bfd_get_section_by_name (abfd, unwi_name); + + amt = strlen (name) + sizeof (".gnu.linkonce.ia64unw."); + unw_name = bfd_alloc (abfd, amt); + if (!unw_name) + return FALSE; + + strcpy (stpcpy (unw_name, ".gnu.linkonce.ia64unw."), name); + unw = bfd_get_section_by_name (abfd, unw_name); + + /* We need to create a fake group section for it and its + unwind sections. */ + group = bfd_make_section_anyway_with_flags (abfd, name, + flags); + if (group == NULL) + return FALSE; + + /* Move the fake group section to the beginning. */ + bfd_section_list_remove (abfd, group); + bfd_section_list_prepend (abfd, group); + + elf_next_in_group (group) = sec; + + elf_group_name (sec) = name; + elf_next_in_group (sec) = sec; + elf_sec_group (sec) = group; + + if (unwi) + { + elf_group_name (unwi) = name; + elf_next_in_group (unwi) = sec; + elf_next_in_group (sec) = unwi; + elf_sec_group (unwi) = group; + } + + if (unw) + { + elf_group_name (unw) = name; + if (unwi) + { + elf_next_in_group (unw) = elf_next_in_group (unwi); + elf_next_in_group (unwi) = unw; + } + else + { + elf_next_in_group (unw) = sec; + elf_next_in_group (sec) = unw; + } + elf_sec_group (unw) = group; + } + + /* Fake SHT_GROUP section header. */ + elf_section_data (group)->this_hdr.bfd_section = group; + elf_section_data (group)->this_hdr.sh_type = SHT_GROUP; + } + } + return TRUE; +} + static bfd_boolean elfNN_ia64_hpux_vec (const bfd_target *vec) { @@ -4920,7 +5695,7 @@ static void elfNN_hpux_backend_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED, asymbol *asym) { - elf_symbol_type *elfsym = (elf_symbol_type *) asym;; + elf_symbol_type *elfsym = (elf_symbol_type *) asym; switch (elfsym->internal_elf_sym.st_shndx) { @@ -4967,6 +5742,9 @@ elfNN_hpux_backend_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED, #define bfd_elfNN_bfd_relax_section \ elfNN_ia64_relax_section +#define elf_backend_object_p \ + elfNN_ia64_object_p + /* Stuff for the BFD linker: */ #define bfd_elfNN_bfd_link_hash_table_create \ elfNN_ia64_hash_table_create @@ -5007,10 +5785,18 @@ elfNN_hpux_backend_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED, #define elf_backend_want_dynbss 0 #define elf_backend_copy_indirect_symbol elfNN_ia64_hash_copy_indirect #define elf_backend_hide_symbol elfNN_ia64_hash_hide_symbol +#define elf_backend_fixup_symbol _bfd_elf_link_hash_fixup_symbol #define elf_backend_reloc_type_class elfNN_ia64_reloc_type_class #define elf_backend_rela_normal 1 #define elf_backend_special_sections elfNN_ia64_special_sections +/* FIXME: PR 290: The Intel C compiler generates SHT_IA_64_UNWIND with + SHF_LINK_ORDER. But it doesn't set the sh_link or sh_info fields. + We don't want to flood users with so many error messages. We turn + off the warning for now. It will be turned on later when the Intel + compiler is fixed. */ +#define elf_backend_link_order_error_handler NULL + #include "elfNN-target.h" /* HPUX-specific vectors. */ diff --git a/contrib/binutils/bfd/elfxx-mips.c b/contrib/binutils/bfd/elfxx-mips.c index 0a7495ad5e2..a9aea661f44 100644 --- a/contrib/binutils/bfd/elfxx-mips.c +++ b/contrib/binutils/bfd/elfxx-mips.c @@ -34,6 +34,7 @@ #include "elf-bfd.h" #include "elfxx-mips.h" #include "elf/mips.h" +#include "elf-vxworks.h" /* Get the ECOFF swapping routines. */ #include "coff/sym.h" @@ -43,8 +44,39 @@ #include "hashtab.h" -/* This structure is used to hold .got entries while estimating got - sizes. */ +/* This structure is used to hold information about one GOT entry. + There are three types of entry: + + (1) absolute addresses + (abfd == NULL) + (2) SYMBOL + OFFSET addresses, where SYMBOL is local to an input bfd + (abfd != NULL, symndx >= 0) + (3) global and forced-local symbols + (abfd != NULL, symndx == -1) + + Type (3) entries are treated differently for different types of GOT. + In the "master" GOT -- i.e. the one that describes every GOT + reference needed in the link -- the mips_got_entry is keyed on both + the symbol and the input bfd that references it. If it turns out + that we need multiple GOTs, we can then use this information to + create separate GOTs for each input bfd. + + However, we want each of these separate GOTs to have at most one + entry for a given symbol, so their type (3) entries are keyed only + on the symbol. The input bfd given by the "abfd" field is somewhat + arbitrary in this case. + + This means that when there are multiple GOTs, each GOT has a unique + mips_got_entry for every symbol within it. We can therefore use the + mips_got_entry fields (tls_type and gotidx) to track the symbol's + GOT index. + + However, if it turns out that we need only a single GOT, we continue + to use the master GOT to describe it. There may therefore be several + mips_got_entries for the same symbol, each with a different input bfd. + We want to make sure that each symbol gets a unique GOT entry, so when + there's a single GOT, we use the symbol's hash entry, not the + mips_got_entry fields, to track a symbol's GOT index. */ struct mips_got_entry { /* The input bfd in which the symbol is defined. */ @@ -64,6 +96,14 @@ struct mips_got_entry h->forced_local). */ struct mips_elf_link_hash_entry *h; } d; + + /* The TLS types included in this GOT entry (specifically, GD and + IE). The GD and IE flags can be added as we encounter new + relocations. LDM can also be set; it will always be alone, not + combined with any GD or IE flags. An LDM GOT entry will be + a local symbol entry with r_symndx == 0. */ + unsigned char tls_type; + /* The offset from the beginning of the .got section to the entry corresponding to this symbol+addend. If it's a global symbol whose offset is yet to be decided, it's going to be -1. */ @@ -79,6 +119,11 @@ struct mips_got_info struct elf_link_hash_entry *global_gotsym; /* The number of global .got entries. */ unsigned int global_gotno; + /* The number of .got slots used for TLS. */ + unsigned int tls_gotno; + /* The first unused TLS .got entry. Used only during + mips_elf_initialize_tls_index. */ + unsigned int tls_assigned_gotno; /* The number of local .got entries. */ unsigned int local_gotno; /* The number of local .got entries we have used. */ @@ -91,6 +136,11 @@ struct mips_got_info /* In multi-got links, a pointer to the next got (err, rather, most of the time, it points to the previous got). */ struct mips_got_info *next; + /* This is the GOT index of the TLS LDM entry for the GOT, MINUS_ONE + for none, or MINUS_TWO for not yet assigned. This is needed + because a single-GOT link may have multiple hash table entries + for the LDM. It does not get initialized in multi-GOT mode. */ + bfd_vma tls_ldm_offset; }; /* Map an input bfd to a got in a multi-got link. */ @@ -125,6 +175,11 @@ struct mips_elf_got_per_bfd_arg unsigned int primary_count; /* The number of local and global entries in the current got. */ unsigned int current_count; + /* The total number of global entries which will live in the + primary got and be automatically relocated. This includes + those not referenced by the primary GOT but included in + the "master" GOT. */ + unsigned int global_count; }; /* Another structure used to pass arguments for got entries traversal. */ @@ -137,6 +192,15 @@ struct mips_elf_set_global_got_offset_arg struct bfd_link_info *info; }; +/* A structure used to count TLS relocations or GOT entries, for GOT + entry or ELF symbol table traversal. */ + +struct mips_elf_count_tls_arg +{ + struct bfd_link_info *info; + unsigned int needed; +}; + struct _mips_elf_section_data { struct bfd_elf_section_data elf; @@ -158,8 +222,8 @@ 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. */ + /* The least dynamic symbol table index corresponding to a non-TLS + symbol with a GOT entry. */ long min_got_dynindx; /* The greatest dynamic symbol table index corresponding to a symbol with a GOT entry that is not referenced (e.g., a dynamic symbol @@ -210,8 +274,30 @@ struct mips_elf_link_hash_entry being called returns a floating point value. */ asection *call_fp_stub; - /* Are we forced local? .*/ + /* Are we forced local? This will only be set if we have converted + the initial global GOT entry to a local GOT entry. */ bfd_boolean forced_local; + + /* Are we referenced by some kind of relocation? */ + bfd_boolean is_relocation_target; + + /* Are we referenced by branch relocations? */ + bfd_boolean is_branch_target; + +#define GOT_NORMAL 0 +#define GOT_TLS_GD 1 +#define GOT_TLS_LDM 2 +#define GOT_TLS_IE 4 +#define GOT_TLS_OFFSET_DONE 0x40 +#define GOT_TLS_DONE 0x80 + unsigned char tls_type; + /* This is only used in single-GOT mode; in multi-GOT mode there + is one mips_got_entry per GOT entry, so the offset is stored + there. In single-GOT mode there may be many mips_got_entry + structures all referring to the same GOT slot. It might be + possible to use root.got.offset instead, but that field is + overloaded already. */ + bfd_vma tls_got_offset; }; /* MIPS ELF linker hash table. */ @@ -235,8 +321,39 @@ struct mips_elf_link_hash_table bfd_vma rld_value; /* This is set if we see any mips16 stub sections. */ bfd_boolean mips16_stubs_seen; + /* True if we're generating code for VxWorks. */ + bfd_boolean is_vxworks; + /* Shortcuts to some dynamic sections, or NULL if they are not + being used. */ + asection *srelbss; + asection *sdynbss; + asection *srelplt; + asection *srelplt2; + asection *sgotplt; + asection *splt; + /* The size of the PLT header in bytes (VxWorks only). */ + bfd_vma plt_header_size; + /* The size of a PLT entry in bytes (VxWorks only). */ + bfd_vma plt_entry_size; + /* The size of a function stub entry in bytes. */ + bfd_vma function_stub_size; }; +#define TLS_RELOC_P(r_type) \ + (r_type == R_MIPS_TLS_DTPMOD32 \ + || r_type == R_MIPS_TLS_DTPMOD64 \ + || r_type == R_MIPS_TLS_DTPREL32 \ + || r_type == R_MIPS_TLS_DTPREL64 \ + || r_type == R_MIPS_TLS_GD \ + || r_type == R_MIPS_TLS_LDM \ + || r_type == R_MIPS_TLS_DTPREL_HI16 \ + || r_type == R_MIPS_TLS_DTPREL_LO16 \ + || r_type == R_MIPS_TLS_GOTTPREL \ + || r_type == R_MIPS_TLS_TPREL32 \ + || r_type == R_MIPS_TLS_TPREL64 \ + || r_type == R_MIPS_TLS_TPREL_HI16 \ + || r_type == R_MIPS_TLS_TPREL_LO16) + /* Structure used to pass information to mips_elf_output_extsym. */ struct extsym_info @@ -369,134 +486,21 @@ typedef struct runtime_pdr { #define cbRPDR sizeof (RPDR) #define rpdNil ((pRPDR) 0) -static struct bfd_hash_entry *mips_elf_link_hash_newfunc - (struct bfd_hash_entry *, struct bfd_hash_table *, const char *); -static void ecoff_swap_rpdr_out - (bfd *, const RPDR *, struct rpdr_ext *); -static bfd_boolean mips_elf_create_procedure_table - (void *, bfd *, struct bfd_link_info *, asection *, - struct ecoff_debug_info *); -static bfd_boolean mips_elf_check_mips16_stubs - (struct mips_elf_link_hash_entry *, void *); -static void bfd_mips_elf32_swap_gptab_in - (bfd *, const Elf32_External_gptab *, Elf32_gptab *); -static void bfd_mips_elf32_swap_gptab_out - (bfd *, const Elf32_gptab *, Elf32_External_gptab *); -static void bfd_elf32_swap_compact_rel_out - (bfd *, const Elf32_compact_rel *, Elf32_External_compact_rel *); -static void bfd_elf32_swap_crinfo_out - (bfd *, const Elf32_crinfo *, Elf32_External_crinfo *); -static int sort_dynamic_relocs - (const void *, const void *); -static int sort_dynamic_relocs_64 - (const void *, const void *); -static bfd_boolean mips_elf_output_extsym - (struct mips_elf_link_hash_entry *, void *); -static int gptab_compare - (const void *, const void *); -static asection *mips_elf_rel_dyn_section - (bfd *, bfd_boolean); -static asection *mips_elf_got_section - (bfd *, bfd_boolean); -static struct mips_got_info *mips_elf_got_info - (bfd *, asection **); -static long mips_elf_get_global_gotsym_index - (bfd *abfd); -static bfd_vma mips_elf_local_got_index - (bfd *, bfd *, struct bfd_link_info *, bfd_vma); -static bfd_vma mips_elf_global_got_index - (bfd *, bfd *, struct elf_link_hash_entry *); -static bfd_vma mips_elf_got_page - (bfd *, bfd *, struct bfd_link_info *, bfd_vma, bfd_vma *); -static bfd_vma mips_elf_got16_entry - (bfd *, bfd *, struct bfd_link_info *, bfd_vma, bfd_boolean); -static bfd_vma mips_elf_got_offset_from_index - (bfd *, bfd *, bfd *, bfd_vma); static struct mips_got_entry *mips_elf_create_local_got_entry - (bfd *, bfd *, struct mips_got_info *, asection *, bfd_vma); -static bfd_boolean mips_elf_sort_hash_table - (struct bfd_link_info *, unsigned long); + (bfd *, struct bfd_link_info *, bfd *, struct mips_got_info *, asection *, + asection *, bfd_vma, unsigned long, struct mips_elf_link_hash_entry *, int); static bfd_boolean mips_elf_sort_hash_table_f (struct mips_elf_link_hash_entry *, void *); -static bfd_boolean mips_elf_record_local_got_symbol - (bfd *, long, bfd_vma, struct mips_got_info *); -static bfd_boolean mips_elf_record_global_got_symbol - (struct elf_link_hash_entry *, bfd *, struct bfd_link_info *, - struct mips_got_info *); -static const Elf_Internal_Rela *mips_elf_next_relocation - (bfd *, unsigned int, const Elf_Internal_Rela *, const Elf_Internal_Rela *); -static bfd_boolean mips_elf_local_relocation_p - (bfd *, const Elf_Internal_Rela *, asection **, bfd_boolean); -static bfd_boolean mips_elf_overflow_p - (bfd_vma, int); static bfd_vma mips_elf_high (bfd_vma); -static bfd_vma mips_elf_higher - (bfd_vma); -static bfd_vma mips_elf_highest - (bfd_vma); -static bfd_boolean mips_elf_create_compact_rel_section - (bfd *, struct bfd_link_info *); -static bfd_boolean mips_elf_create_got_section - (bfd *, struct bfd_link_info *, bfd_boolean); -static bfd_reloc_status_type mips_elf_calculate_relocation - (bfd *, bfd *, asection *, struct bfd_link_info *, - const Elf_Internal_Rela *, bfd_vma, reloc_howto_type *, - Elf_Internal_Sym *, asection **, bfd_vma *, const char **, - bfd_boolean *, bfd_boolean); -static bfd_vma mips_elf_obtain_contents - (reloc_howto_type *, const Elf_Internal_Rela *, bfd *, bfd_byte *); -static bfd_boolean mips_elf_perform_relocation - (struct bfd_link_info *, reloc_howto_type *, const Elf_Internal_Rela *, - bfd_vma, bfd *, asection *, bfd_byte *, bfd_boolean); static bfd_boolean mips_elf_stub_section_p (bfd *, asection *); -static void mips_elf_allocate_dynamic_relocations - (bfd *, unsigned int); static bfd_boolean mips_elf_create_dynamic_relocation (bfd *, struct bfd_link_info *, const Elf_Internal_Rela *, struct mips_elf_link_hash_entry *, asection *, bfd_vma, bfd_vma *, asection *); -static void mips_set_isa_flags - (bfd *); -static INLINE char *elf_mips_abi_name - (bfd *); -static void mips_elf_irix6_finish_dynamic_symbol - (bfd *, const char *, Elf_Internal_Sym *); -static bfd_boolean mips_mach_extends_p - (unsigned long, unsigned long); -static bfd_boolean mips_32bit_flags_p - (flagword); -static INLINE hashval_t mips_elf_hash_bfd_vma - (bfd_vma); static hashval_t mips_elf_got_entry_hash (const void *); -static int mips_elf_got_entry_eq - (const void *, const void *); - -static bfd_boolean mips_elf_multi_got - (bfd *, struct bfd_link_info *, struct mips_got_info *, - asection *, bfd_size_type); -static hashval_t mips_elf_multi_got_entry_hash - (const void *); -static int mips_elf_multi_got_entry_eq - (const void *, const void *); -static hashval_t mips_elf_bfd2got_entry_hash - (const void *); -static int mips_elf_bfd2got_entry_eq - (const void *, const void *); -static int mips_elf_make_got_per_bfd - (void **, void *); -static int mips_elf_merge_gots - (void **, void *); -static int mips_elf_set_global_got_offset - (void **, void *); -static int mips_elf_set_no_stub - (void **, void *); -static int mips_elf_resolve_final_got_entry - (void **, void *); -static void mips_elf_resolve_final_got_entries - (struct mips_got_info *); static bfd_vma mips_elf_adjust_gp (bfd *, struct mips_got_info *, bfd *); static struct mips_got_info *mips_elf_got_for_ibfd @@ -506,7 +510,6 @@ static struct mips_got_info *mips_elf_got_for_ibfd static bfd *reldyn_sorting_bfd; /* Nonzero if ABFD is using the N32 ABI. */ - #define ABI_N32_P(abfd) \ ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI2) != 0) @@ -529,6 +532,16 @@ static bfd *reldyn_sorting_bfd; #define MIPS_ELF_OPTIONS_SECTION_NAME(abfd) \ (NEWABI_P (abfd) ? ".MIPS.options" : ".options") +/* True if NAME is the recognized name of any SHT_MIPS_OPTIONS section. + Some IRIX system files do not use MIPS_ELF_OPTIONS_SECTION_NAME. */ +#define MIPS_ELF_OPTIONS_SECTION_NAME_P(NAME) \ + (strcmp (NAME, ".MIPS.options") == 0 || strcmp (NAME, ".options") == 0) + +/* Whether the section is readonly. */ +#define MIPS_ELF_READONLY_SECTION(sec) \ + ((sec->flags & (SEC_ALLOC | SEC_LOAD | SEC_READONLY)) \ + == (SEC_ALLOC | SEC_LOAD | SEC_READONLY)) + /* The name of the stub section. */ #define MIPS_ELF_STUB_SECTION_NAME(abfd) ".MIPS.stubs" @@ -536,6 +549,10 @@ static bfd *reldyn_sorting_bfd; #define MIPS_ELF_REL_SIZE(abfd) \ (get_elf_backend_data (abfd)->s->sizeof_rel) +/* The size of an external RELA relocation. */ +#define MIPS_ELF_RELA_SIZE(abfd) \ + (get_elf_backend_data (abfd)->s->sizeof_rela) + /* The size of an external dynamic table entry. */ #define MIPS_ELF_DYN_SIZE(abfd) \ (get_elf_backend_data (abfd)->s->sizeof_dyn) @@ -586,35 +603,47 @@ static bfd *reldyn_sorting_bfd; == (ABI_64_P (abfd) ? sizeof (Elf64_External_Rela) \ : sizeof (Elf32_External_Rela)))) +/* The name of the dynamic relocation section. */ +#define MIPS_ELF_REL_DYN_NAME(INFO) \ + (mips_elf_hash_table (INFO)->is_vxworks ? ".rela.dyn" : ".rel.dyn") + /* 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) +#define MINUS_TWO (((bfd_vma)0) - 2) /* The number of local .got entries we reserve. */ -#define MIPS_RESERVED_GOTNO (2) +#define MIPS_RESERVED_GOTNO(INFO) \ + (mips_elf_hash_table (INFO)->is_vxworks ? 3 : 2) /* The offset of $gp from the beginning of the .got section. */ -#define ELF_MIPS_GP_OFFSET(abfd) (0x7ff0) +#define ELF_MIPS_GP_OFFSET(INFO) \ + (mips_elf_hash_table (INFO)->is_vxworks ? 0x0 : 0x7ff0) /* The maximum size of the GOT for it to be addressable using 16-bit offsets from $gp. */ -#define MIPS_ELF_GOT_MAX_SIZE(abfd) (ELF_MIPS_GP_OFFSET(abfd) + 0x7fff) +#define MIPS_ELF_GOT_MAX_SIZE(INFO) (ELF_MIPS_GP_OFFSET (INFO) + 0x7fff) /* Instructions which appear in a stub. */ -#define STUB_LW(abfd) \ - ((ABI_64_P (abfd) \ - ? 0xdf998010 /* ld t9,0x8010(gp) */ \ - : 0x8f998010)) /* lw t9,0x8010(gp) */ -#define STUB_MOVE(abfd) \ - ((ABI_64_P (abfd) \ - ? 0x03e0782d /* daddu t7,ra */ \ - : 0x03e07821)) /* addu t7,ra */ -#define STUB_JALR 0x0320f809 /* jalr t9,ra */ -#define STUB_LI16(abfd) \ - ((ABI_64_P (abfd) \ - ? 0x64180000 /* daddiu t8,zero,0 */ \ - : 0x24180000)) /* addiu t8,zero,0 */ -#define MIPS_FUNCTION_STUB_SIZE (16) +#define STUB_LW(abfd) \ + ((ABI_64_P (abfd) \ + ? 0xdf998010 /* ld t9,0x8010(gp) */ \ + : 0x8f998010)) /* lw t9,0x8010(gp) */ +#define STUB_MOVE(abfd) \ + ((ABI_64_P (abfd) \ + ? 0x03e0782d /* daddu t7,ra */ \ + : 0x03e07821)) /* addu t7,ra */ +#define STUB_LUI(VAL) (0x3c180000 + (VAL)) /* lui t8,VAL */ +#define STUB_JALR 0x0320f809 /* jalr t9,ra */ +#define STUB_ORI(VAL) (0x37180000 + (VAL)) /* ori t8,t8,VAL */ +#define STUB_LI16U(VAL) (0x34180000 + (VAL)) /* ori t8,zero,VAL unsigned */ +#define STUB_LI16S(abfd, VAL) \ + ((ABI_64_P (abfd) \ + ? (0x64180000 + (VAL)) /* daddiu t8,zero,VAL sign extended */ \ + : (0x24180000 + (VAL)))) /* addiu t8,zero,VAL sign extended */ + +#define MIPS_FUNCTION_STUB_NORMAL_SIZE 16 +#define MIPS_FUNCTION_STUB_BIG_SIZE 20 /* The name of the dynamic interpreter. This is put in the .interp section. */ @@ -681,6 +710,44 @@ static bfd *reldyn_sorting_bfd; #define CALL_STUB ".mips16.call." #define CALL_FP_STUB ".mips16.call.fp." +/* The format of the first PLT entry in a VxWorks executable. */ +static const bfd_vma mips_vxworks_exec_plt0_entry[] = { + 0x3c190000, /* lui t9, %hi(_GLOBAL_OFFSET_TABLE_) */ + 0x27390000, /* addiu t9, t9, %lo(_GLOBAL_OFFSET_TABLE_) */ + 0x8f390008, /* lw t9, 8(t9) */ + 0x00000000, /* nop */ + 0x03200008, /* jr t9 */ + 0x00000000 /* nop */ +}; + +/* The format of subsequent PLT entries. */ +static const bfd_vma mips_vxworks_exec_plt_entry[] = { + 0x10000000, /* b .PLT_resolver */ + 0x24180000, /* li t8, */ + 0x3c190000, /* lui t9, %hi(<.got.plt slot>) */ + 0x27390000, /* addiu t9, t9, %lo(<.got.plt slot>) */ + 0x8f390000, /* lw t9, 0(t9) */ + 0x00000000, /* nop */ + 0x03200008, /* jr t9 */ + 0x00000000 /* nop */ +}; + +/* The format of the first PLT entry in a VxWorks shared object. */ +static const bfd_vma mips_vxworks_shared_plt0_entry[] = { + 0x8f990008, /* lw t9, 8(gp) */ + 0x00000000, /* nop */ + 0x03200008, /* jr t9 */ + 0x00000000, /* nop */ + 0x00000000, /* nop */ + 0x00000000 /* nop */ +}; + +/* The format of subsequent PLT entries. */ +static const bfd_vma mips_vxworks_shared_plt_entry[] = { + 0x10000000, /* b .PLT_resolver */ + 0x24180000 /* li t8, */ +}; + /* Look up an entry in a MIPS ELF linker hash table. */ #define mips_elf_link_hash_lookup(table, string, create, copy, follow) \ @@ -701,6 +768,30 @@ static bfd *reldyn_sorting_bfd; #define mips_elf_hash_table(p) \ ((struct mips_elf_link_hash_table *) ((p)->hash)) +/* Find the base offsets for thread-local storage in this object, + for GD/LD and IE/LE respectively. */ + +#define TP_OFFSET 0x7000 +#define DTP_OFFSET 0x8000 + +static bfd_vma +dtprel_base (struct bfd_link_info *info) +{ + /* If tls_sec is NULL, we should have signalled an error already. */ + if (elf_hash_table (info)->tls_sec == NULL) + return 0; + return elf_hash_table (info)->tls_sec->vma + DTP_OFFSET; +} + +static bfd_vma +tprel_base (struct bfd_link_info *info) +{ + /* If tls_sec is NULL, we should have signalled an error already. */ + if (elf_hash_table (info)->tls_sec == NULL) + return 0; + return elf_hash_table (info)->tls_sec->vma + TP_OFFSET; +} + /* Create an entry in a MIPS ELF linker hash table. */ static struct bfd_hash_entry * @@ -736,6 +827,9 @@ mips_elf_link_hash_newfunc (struct bfd_hash_entry *entry, ret->call_stub = NULL; ret->call_fp_stub = NULL; ret->forced_local = FALSE; + ret->is_branch_target = FALSE; + ret->is_relocation_target = FALSE; + ret->tls_type = GOT_NORMAL; } return (struct bfd_hash_entry *) ret; @@ -811,7 +905,6 @@ _bfd_mips_elf_read_ecoff_info (bfd *abfd, asection *section, #undef READ debug->fdr = NULL; - debug->adjust = NULL; return TRUE; @@ -859,9 +952,6 @@ ecoff_swap_rpdr_out (bfd *abfd, const RPDR *in, struct rpdr_ext *ex) H_PUT_16 (abfd, in->pcreg, ex->p_pcreg); H_PUT_32 (abfd, in->irpss, ex->p_irpss); -#if 0 /* FIXME */ - H_PUT_S32 (abfd, in->exception_info, ex->p_exception_info); -#endif } /* Create a runtime procedure table from the .mdebug section. */ @@ -932,7 +1022,7 @@ mips_elf_create_procedure_table (void *handle, bfd *abfd, ss = bfd_malloc (count); if (ss == NULL) goto error_return; - if (! _bfd_ecoff_get_accumulated_ss (handle, ss)) + if (! _bfd_ecoff_get_accumulated_ss (handle, (bfd_byte *) ss)) goto error_return; count = hdr->ipdMax; @@ -980,12 +1070,12 @@ mips_elf_create_procedure_table (void *handle, bfd *abfd, H_PUT_S32 (abfd, -1, (erp + count)->p_adr); /* Set the size and contents of .rtproc section. */ - s->_raw_size = size; + s->size = size; s->contents = rtproc; /* Skip this section later on (I don't think this currently matters, but someday it might). */ - s->link_order_head = NULL; + s->map_head.link_order = NULL; if (epdr != NULL) free (epdr); @@ -1030,8 +1120,7 @@ mips_elf_check_mips16_stubs (struct mips_elf_link_hash_entry *h, /* 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->size = 0; h->fn_stub->flags &= ~SEC_RELOC; h->fn_stub->reloc_count = 0; h->fn_stub->flags |= SEC_EXCLUDE; @@ -1043,8 +1132,7 @@ mips_elf_check_mips16_stubs (struct mips_elf_link_hash_entry *h, /* 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->size = 0; h->call_stub->flags &= ~SEC_RELOC; h->call_stub->reloc_count = 0; h->call_stub->flags |= SEC_EXCLUDE; @@ -1056,8 +1144,7 @@ mips_elf_check_mips16_stubs (struct mips_elf_link_hash_entry *h, /* 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->size = 0; h->call_fp_stub->flags &= ~SEC_RELOC; h->call_fp_stub->reloc_count = 0; h->call_fp_stub->flags |= SEC_EXCLUDE; @@ -1066,6 +1153,152 @@ mips_elf_check_mips16_stubs (struct mips_elf_link_hash_entry *h, return TRUE; } +/* 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 relocatable 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 relocatable object file, the calculation is + (((A < 2) | ((P + 4) & 0xf0000000) + S) >> 2) + When producing a fully linked file, the calculation is + let R = (((A < 2) | ((P + 4) & 0xf0000000) + S) >> 2) + ((R & 0x1f0000) << 5) | ((R & 0x3e00000) >> 5) | (R & 0xffff) + + 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. + + R_MIPS16_HI16 and R_MIPS16_LO16 are used in mips16 mode to + access data when neither GP-relative nor PC-relative addressing + can be used. They are handled like R_MIPS_HI16 and R_MIPS_LO16, + except that the addend is retrieved and stored as shown above + for R_MIPS16_GPREL. + */ +void +_bfd_mips16_elf_reloc_unshuffle (bfd *abfd, int r_type, + bfd_boolean jal_shuffle, bfd_byte *data) +{ + bfd_vma extend, insn, val; + + if (r_type != R_MIPS16_26 && r_type != R_MIPS16_GPREL + && r_type != R_MIPS16_HI16 && r_type != R_MIPS16_LO16) + return; + + /* Pick up the mips16 extend instruction and the real instruction. */ + extend = bfd_get_16 (abfd, data); + insn = bfd_get_16 (abfd, data + 2); + if (r_type == R_MIPS16_26) + { + if (jal_shuffle) + val = ((extend & 0xfc00) << 16) | ((extend & 0x3e0) << 11) + | ((extend & 0x1f) << 21) | insn; + else + val = extend << 16 | insn; + } + else + val = ((extend & 0xf800) << 16) | ((insn & 0xffe0) << 11) + | ((extend & 0x1f) << 11) | (extend & 0x7e0) | (insn & 0x1f); + bfd_put_32 (abfd, val, data); +} + +void +_bfd_mips16_elf_reloc_shuffle (bfd *abfd, int r_type, + bfd_boolean jal_shuffle, bfd_byte *data) +{ + bfd_vma extend, insn, val; + + if (r_type != R_MIPS16_26 && r_type != R_MIPS16_GPREL + && r_type != R_MIPS16_HI16 && r_type != R_MIPS16_LO16) + return; + + val = bfd_get_32 (abfd, data); + if (r_type == R_MIPS16_26) + { + if (jal_shuffle) + { + insn = val & 0xffff; + extend = ((val >> 16) & 0xfc00) | ((val >> 11) & 0x3e0) + | ((val >> 21) & 0x1f); + } + else + { + insn = val & 0xffff; + extend = val >> 16; + } + } + else + { + insn = ((val >> 11) & 0xffe0) | (val & 0x1f); + extend = ((val >> 16) & 0xf800) | ((val >> 11) & 0x1f) | (val & 0x7e0); + } + bfd_put_16 (abfd, insn, data + 2); + bfd_put_16 (abfd, extend, data); +} + bfd_reloc_status_type _bfd_mips_elf_gprel16_with_gp (bfd *abfd, asymbol *symbol, arelent *reloc_entry, asection *input_section, @@ -1083,7 +1316,7 @@ _bfd_mips_elf_gprel16_with_gp (bfd *abfd, asymbol *symbol, relocation += symbol->section->output_section->vma; relocation += symbol->section->output_offset; - if (reloc_entry->address > input_section->_cooked_size) + if (reloc_entry->address > bfd_get_section_limit (abfd, input_section)) return bfd_reloc_outofrange; /* Set val to the offset into the section or symbol. */ @@ -1149,7 +1382,7 @@ _bfd_mips_elf_hi16_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry, { struct mips_hi16 *n; - if (reloc_entry->address > input_section->_cooked_size) + if (reloc_entry->address > bfd_get_section_limit (abfd, input_section)) return bfd_reloc_outofrange; n = bfd_malloc (sizeof *n); @@ -1199,11 +1432,17 @@ _bfd_mips_elf_lo16_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, bfd *output_bfd, char **error_message) { bfd_vma vallo; + bfd_byte *location = (bfd_byte *) data + reloc_entry->address; - if (reloc_entry->address > input_section->_cooked_size) + if (reloc_entry->address > bfd_get_section_limit (abfd, input_section)) return bfd_reloc_outofrange; - vallo = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address); + _bfd_mips16_elf_reloc_unshuffle (abfd, reloc_entry->howto->type, FALSE, + location); + vallo = bfd_get_32 (abfd, location); + _bfd_mips16_elf_reloc_shuffle (abfd, reloc_entry->howto->type, FALSE, + location); + while (mips_hi16_list != NULL) { bfd_reloc_status_type ret; @@ -1223,13 +1462,6 @@ _bfd_mips_elf_lo16_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, carry or borrow will induce a change of +1 or -1 in the high part. */ hi->rel.addend += (vallo + 0x8000) & 0xffff; - /* R_MIPS_GNU_REL_HI16 relocations are relative to the address of the - lo16 relocation, not their own address. If we're calculating the - final value, and hence subtracting the "PC", subtract the offset - of the lo16 relocation from here. */ - if (output_bfd == NULL && hi->rel.howto->type == R_MIPS_GNU_REL_HI16) - hi->rel.addend -= reloc_entry->address - hi->rel.address; - ret = _bfd_mips_elf_generic_reloc (abfd, &hi->rel, symbol, hi->data, hi->input_section, output_bfd, error_message); @@ -1261,7 +1493,7 @@ _bfd_mips_elf_generic_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry, relocatable = (output_bfd != NULL); - if (reloc_entry->address > input_section->_cooked_size) + if (reloc_entry->address > bfd_get_section_limit (abfd, input_section)) return bfd_reloc_outofrange; /* Build up the field adjustment in VAL. */ @@ -1296,13 +1528,19 @@ _bfd_mips_elf_generic_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry, reloc_entry->addend += val; else { + bfd_byte *location = (bfd_byte *) data + reloc_entry->address; + /* Add in the separate addend, if any. */ val += reloc_entry->addend; /* Add VAL to the relocation field. */ + _bfd_mips16_elf_reloc_unshuffle (abfd, reloc_entry->howto->type, FALSE, + location); status = _bfd_relocate_contents (reloc_entry->howto, abfd, val, - (bfd_byte *) data - + reloc_entry->address); + location); + _bfd_mips16_elf_reloc_shuffle (abfd, reloc_entry->howto->type, FALSE, + location); + if (status != bfd_reloc_ok) return status; } @@ -1461,8 +1699,10 @@ sort_dynamic_relocs (const void *arg1, const void *arg2) /* Like sort_dynamic_relocs, but used for elf64 relocations. */ static int -sort_dynamic_relocs_64 (const void *arg1, const void *arg2) +sort_dynamic_relocs_64 (const void *arg1 ATTRIBUTE_UNUSED, + const void *arg2 ATTRIBUTE_UNUSED) { +#ifdef BFD64 Elf_Internal_Rela int_reloc1[3]; Elf_Internal_Rela int_reloc2[3]; @@ -1473,6 +1713,9 @@ sort_dynamic_relocs_64 (const void *arg1, const void *arg2) return (ELF64_R_SYM (int_reloc1[0].r_info) - ELF64_R_SYM (int_reloc2[0].r_info)); +#else + abort (); +#endif } @@ -1502,10 +1745,11 @@ mips_elf_output_extsym (struct mips_elf_link_hash_entry *h, void *data) 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) + else if ((h->root.def_dynamic + || h->root.ref_dynamic + || h->root.type == bfd_link_hash_new) + && !h->root.def_regular + && !h->root.ref_regular) strip = TRUE; else if (einfo->info->strip == strip_all || (einfo->info->strip == strip_some @@ -1623,7 +1867,7 @@ mips_elf_output_extsym (struct mips_elf_link_hash_entry *h, void *data) else h->esym.asym.value = 0; } - else if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0) + else if (h->root.needs_plt) { struct mips_elf_link_hash_entry *hd = h; bfd_boolean no_fn_stub = h->no_fn_stub; @@ -1651,9 +1895,6 @@ mips_elf_output_extsym (struct mips_elf_link_hash_entry *h, void *data) else h->esym.asym.value = 0; } -#if 0 /* FIXME? */ - h->esym.ifd = 0; -#endif } } @@ -1704,6 +1945,7 @@ mips_elf_got_entry_hash (const void *entry_) const struct mips_got_entry *entry = (struct mips_got_entry *)entry_; return entry->symndx + + ((entry->tls_type & GOT_TLS_LDM) << 17) + (! entry->abfd ? mips_elf_hash_bfd_vma (entry->d.address) : entry->abfd->id + (entry->symndx >= 0 ? mips_elf_hash_bfd_vma (entry->d.addend) @@ -1716,6 +1958,10 @@ mips_elf_got_entry_eq (const void *entry1, const void *entry2) const struct mips_got_entry *e1 = (struct mips_got_entry *)entry1; const struct mips_got_entry *e2 = (struct mips_got_entry *)entry2; + /* An LDM entry can only match another LDM entry. */ + if ((e1->tls_type ^ e2->tls_type) & GOT_TLS_LDM) + return 0; + return e1->abfd == e2->abfd && e1->symndx == e2->symndx && (! e1->abfd ? e1->d.address == e2->d.address : e1->symndx >= 0 ? e1->d.addend == e2->d.addend @@ -1736,8 +1982,10 @@ mips_elf_multi_got_entry_hash (const void *entry_) + (! entry->abfd ? mips_elf_hash_bfd_vma (entry->d.address) : entry->symndx >= 0 - ? (entry->abfd->id - + mips_elf_hash_bfd_vma (entry->d.addend)) + ? ((entry->tls_type & GOT_TLS_LDM) + ? (GOT_TLS_LDM << 17) + : (entry->abfd->id + + mips_elf_hash_bfd_vma (entry->d.addend))) : entry->d.h->root.root.root.hash); } @@ -1747,6 +1995,14 @@ mips_elf_multi_got_entry_eq (const void *entry1, const void *entry2) const struct mips_got_entry *e1 = (struct mips_got_entry *)entry1; const struct mips_got_entry *e2 = (struct mips_got_entry *)entry2; + /* Any two LDM entries match. */ + if (e1->tls_type & e2->tls_type & GOT_TLS_LDM) + return 1; + + /* Nothing else matches an LDM entry. */ + if ((e1->tls_type ^ e2->tls_type) & GOT_TLS_LDM) + return 0; + return e1->symndx == e2->symndx && (e1->symndx >= 0 ? e1->abfd == e2->abfd && e1->d.addend == e2->d.addend : e1->abfd == NULL || e2->abfd == NULL @@ -1754,26 +2010,30 @@ mips_elf_multi_got_entry_eq (const void *entry1, const void *entry2) : e1->d.h == e2->d.h); } -/* Returns the dynamic relocation section for DYNOBJ. */ +/* Return the dynamic relocation section. If it doesn't exist, try to + create a new it if CREATE_P, otherwise return NULL. Also return NULL + if creation fails. */ static asection * -mips_elf_rel_dyn_section (bfd *dynobj, bfd_boolean create_p) +mips_elf_rel_dyn_section (struct bfd_link_info *info, bfd_boolean create_p) { - static const char dname[] = ".rel.dyn"; + const char *dname; asection *sreloc; + bfd *dynobj; + dname = MIPS_ELF_REL_DYN_NAME (info); + dynobj = elf_hash_table (info)->dynobj; sreloc = bfd_get_section_by_name (dynobj, dname); if (sreloc == NULL && create_p) { - sreloc = bfd_make_section (dynobj, dname); + sreloc = bfd_make_section_with_flags (dynobj, dname, + (SEC_ALLOC + | SEC_LOAD + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_LINKER_CREATED + | SEC_READONLY)); 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, MIPS_ELF_LOG_FILE_ALIGN (dynobj))) return NULL; @@ -1815,35 +2075,331 @@ mips_elf_got_info (bfd *abfd, asection **sgotp) return g; } -/* Obtain the lowest dynamic index of a symbol that was assigned a - global GOT entry. */ -static long -mips_elf_get_global_gotsym_index (bfd *abfd) +/* Count the number of relocations needed for a TLS GOT entry, with + access types from TLS_TYPE, and symbol H (or a local symbol if H + is NULL). */ + +static int +mips_tls_got_relocs (struct bfd_link_info *info, unsigned char tls_type, + struct elf_link_hash_entry *h) { - asection *sgot; - struct mips_got_info *g; + int indx = 0; + int ret = 0; + bfd_boolean need_relocs = FALSE; + bfd_boolean dyn = elf_hash_table (info)->dynamic_sections_created; - if (abfd == NULL) - return 0; + if (h && WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h) + && (!info->shared || !SYMBOL_REFERENCES_LOCAL (info, h))) + indx = h->dynindx; - sgot = mips_elf_got_section (abfd, TRUE); - if (sgot == NULL || mips_elf_section_data (sgot) == NULL) - return 0; + if ((info->shared || indx != 0) + && (h == NULL + || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT + || h->root.type != bfd_link_hash_undefweak)) + need_relocs = TRUE; - g = mips_elf_section_data (sgot)->u.got_info; - if (g == NULL || g->global_gotsym == NULL) - return 0; + if (!need_relocs) + return FALSE; - return g->global_gotsym->dynindx; + if (tls_type & GOT_TLS_GD) + { + ret++; + if (indx != 0) + ret++; + } + + if (tls_type & GOT_TLS_IE) + ret++; + + if ((tls_type & GOT_TLS_LDM) && info->shared) + ret++; + + return ret; } -/* 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. */ +/* Count the number of TLS relocations required for the GOT entry in + ARG1, if it describes a local symbol. */ + +static int +mips_elf_count_local_tls_relocs (void **arg1, void *arg2) +{ + struct mips_got_entry *entry = * (struct mips_got_entry **) arg1; + struct mips_elf_count_tls_arg *arg = arg2; + + if (entry->abfd != NULL && entry->symndx != -1) + arg->needed += mips_tls_got_relocs (arg->info, entry->tls_type, NULL); + + return 1; +} + +/* Count the number of TLS GOT entries required for the global (or + forced-local) symbol in ARG1. */ + +static int +mips_elf_count_global_tls_entries (void *arg1, void *arg2) +{ + struct mips_elf_link_hash_entry *hm + = (struct mips_elf_link_hash_entry *) arg1; + struct mips_elf_count_tls_arg *arg = arg2; + + if (hm->tls_type & GOT_TLS_GD) + arg->needed += 2; + if (hm->tls_type & GOT_TLS_IE) + arg->needed += 1; + + return 1; +} + +/* Count the number of TLS relocations required for the global (or + forced-local) symbol in ARG1. */ + +static int +mips_elf_count_global_tls_relocs (void *arg1, void *arg2) +{ + struct mips_elf_link_hash_entry *hm + = (struct mips_elf_link_hash_entry *) arg1; + struct mips_elf_count_tls_arg *arg = arg2; + + arg->needed += mips_tls_got_relocs (arg->info, hm->tls_type, &hm->root); + + return 1; +} + +/* Output a simple dynamic relocation into SRELOC. */ + +static void +mips_elf_output_dynamic_relocation (bfd *output_bfd, + asection *sreloc, + unsigned long indx, + int r_type, + bfd_vma offset) +{ + Elf_Internal_Rela rel[3]; + + memset (rel, 0, sizeof (rel)); + + rel[0].r_info = ELF_R_INFO (output_bfd, indx, r_type); + rel[0].r_offset = rel[1].r_offset = rel[2].r_offset = offset; + + if (ABI_64_P (output_bfd)) + { + (*get_elf_backend_data (output_bfd)->s->swap_reloc_out) + (output_bfd, &rel[0], + (sreloc->contents + + sreloc->reloc_count * sizeof (Elf64_Mips_External_Rel))); + } + else + bfd_elf32_swap_reloc_out + (output_bfd, &rel[0], + (sreloc->contents + + sreloc->reloc_count * sizeof (Elf32_External_Rel))); + ++sreloc->reloc_count; +} + +/* Initialize a set of TLS GOT entries for one symbol. */ + +static void +mips_elf_initialize_tls_slots (bfd *abfd, bfd_vma got_offset, + unsigned char *tls_type_p, + struct bfd_link_info *info, + struct mips_elf_link_hash_entry *h, + bfd_vma value) +{ + int indx; + asection *sreloc, *sgot; + bfd_vma offset, offset2; + bfd *dynobj; + bfd_boolean need_relocs = FALSE; + + dynobj = elf_hash_table (info)->dynobj; + sgot = mips_elf_got_section (dynobj, FALSE); + + indx = 0; + if (h != NULL) + { + bfd_boolean dyn = elf_hash_table (info)->dynamic_sections_created; + + if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, &h->root) + && (!info->shared || !SYMBOL_REFERENCES_LOCAL (info, &h->root))) + indx = h->root.dynindx; + } + + if (*tls_type_p & GOT_TLS_DONE) + return; + + if ((info->shared || indx != 0) + && (h == NULL + || ELF_ST_VISIBILITY (h->root.other) == STV_DEFAULT + || h->root.type != bfd_link_hash_undefweak)) + need_relocs = TRUE; + + /* MINUS_ONE means the symbol is not defined in this object. It may not + be defined at all; assume that the value doesn't matter in that + case. Otherwise complain if we would use the value. */ + BFD_ASSERT (value != MINUS_ONE || (indx != 0 && need_relocs) + || h->root.root.type == bfd_link_hash_undefweak); + + /* Emit necessary relocations. */ + sreloc = mips_elf_rel_dyn_section (info, FALSE); + + /* General Dynamic. */ + if (*tls_type_p & GOT_TLS_GD) + { + offset = got_offset; + offset2 = offset + MIPS_ELF_GOT_SIZE (abfd); + + if (need_relocs) + { + mips_elf_output_dynamic_relocation + (abfd, sreloc, indx, + ABI_64_P (abfd) ? R_MIPS_TLS_DTPMOD64 : R_MIPS_TLS_DTPMOD32, + sgot->output_offset + sgot->output_section->vma + offset); + + if (indx) + mips_elf_output_dynamic_relocation + (abfd, sreloc, indx, + ABI_64_P (abfd) ? R_MIPS_TLS_DTPREL64 : R_MIPS_TLS_DTPREL32, + sgot->output_offset + sgot->output_section->vma + offset2); + else + MIPS_ELF_PUT_WORD (abfd, value - dtprel_base (info), + sgot->contents + offset2); + } + else + { + MIPS_ELF_PUT_WORD (abfd, 1, + sgot->contents + offset); + MIPS_ELF_PUT_WORD (abfd, value - dtprel_base (info), + sgot->contents + offset2); + } + + got_offset += 2 * MIPS_ELF_GOT_SIZE (abfd); + } + + /* Initial Exec model. */ + if (*tls_type_p & GOT_TLS_IE) + { + offset = got_offset; + + if (need_relocs) + { + if (indx == 0) + MIPS_ELF_PUT_WORD (abfd, value - elf_hash_table (info)->tls_sec->vma, + sgot->contents + offset); + else + MIPS_ELF_PUT_WORD (abfd, 0, + sgot->contents + offset); + + mips_elf_output_dynamic_relocation + (abfd, sreloc, indx, + ABI_64_P (abfd) ? R_MIPS_TLS_TPREL64 : R_MIPS_TLS_TPREL32, + sgot->output_offset + sgot->output_section->vma + offset); + } + else + MIPS_ELF_PUT_WORD (abfd, value - tprel_base (info), + sgot->contents + offset); + } + + if (*tls_type_p & GOT_TLS_LDM) + { + /* The initial offset is zero, and the LD offsets will include the + bias by DTP_OFFSET. */ + MIPS_ELF_PUT_WORD (abfd, 0, + sgot->contents + got_offset + + MIPS_ELF_GOT_SIZE (abfd)); + + if (!info->shared) + MIPS_ELF_PUT_WORD (abfd, 1, + sgot->contents + got_offset); + else + mips_elf_output_dynamic_relocation + (abfd, sreloc, indx, + ABI_64_P (abfd) ? R_MIPS_TLS_DTPMOD64 : R_MIPS_TLS_DTPMOD32, + sgot->output_offset + sgot->output_section->vma + got_offset); + } + + *tls_type_p |= GOT_TLS_DONE; +} + +/* Return the GOT index to use for a relocation of type R_TYPE against + a symbol accessed using TLS_TYPE models. The GOT entries for this + symbol in this GOT start at GOT_INDEX. This function initializes the + GOT entries and corresponding relocations. */ + +static bfd_vma +mips_tls_got_index (bfd *abfd, bfd_vma got_index, unsigned char *tls_type, + int r_type, struct bfd_link_info *info, + struct mips_elf_link_hash_entry *h, bfd_vma symbol) +{ + BFD_ASSERT (r_type == R_MIPS_TLS_GOTTPREL || r_type == R_MIPS_TLS_GD + || r_type == R_MIPS_TLS_LDM); + + mips_elf_initialize_tls_slots (abfd, got_index, tls_type, info, h, symbol); + + if (r_type == R_MIPS_TLS_GOTTPREL) + { + BFD_ASSERT (*tls_type & GOT_TLS_IE); + if (*tls_type & GOT_TLS_GD) + return got_index + 2 * MIPS_ELF_GOT_SIZE (abfd); + else + return got_index; + } + + if (r_type == R_MIPS_TLS_GD) + { + BFD_ASSERT (*tls_type & GOT_TLS_GD); + return got_index; + } + + if (r_type == R_MIPS_TLS_LDM) + { + BFD_ASSERT (*tls_type & GOT_TLS_LDM); + return got_index; + } + + return got_index; +} + +/* Return the offset from _GLOBAL_OFFSET_TABLE_ of the .got.plt entry + for global symbol H. .got.plt comes before the GOT, so the offset + will be negative. */ + +static bfd_vma +mips_elf_gotplt_index (struct bfd_link_info *info, + struct elf_link_hash_entry *h) +{ + bfd_vma plt_index, got_address, got_value; + struct mips_elf_link_hash_table *htab; + + htab = mips_elf_hash_table (info); + BFD_ASSERT (h->plt.offset != (bfd_vma) -1); + + /* Calculate the index of the symbol's PLT entry. */ + plt_index = (h->plt.offset - htab->plt_header_size) / htab->plt_entry_size; + + /* Calculate the address of the associated .got.plt entry. */ + got_address = (htab->sgotplt->output_section->vma + + htab->sgotplt->output_offset + + plt_index * 4); + + /* Calculate the value of _GLOBAL_OFFSET_TABLE_. */ + got_value = (htab->root.hgot->root.u.def.section->output_section->vma + + htab->root.hgot->root.u.def.section->output_offset + + htab->root.hgot->root.u.def.value); + + return got_address - got_value; +} + +/* Return the GOT offset for address VALUE, which was derived from + a symbol belonging to INPUT_SECTION. If there is not yet a GOT + entry for this value, create one. If R_SYMNDX refers to a TLS symbol, + create a TLS GOT entry instead. Return -1 if no satisfactory GOT + offset can be found. */ static bfd_vma mips_elf_local_got_index (bfd *abfd, bfd *ibfd, struct bfd_link_info *info, - bfd_vma value) + asection *input_section, bfd_vma value, + unsigned long r_symndx, + struct mips_elf_link_hash_entry *h, int r_type) { asection *sgot; struct mips_got_info *g; @@ -1851,17 +2407,32 @@ mips_elf_local_got_index (bfd *abfd, bfd *ibfd, struct bfd_link_info *info, g = mips_elf_got_info (elf_hash_table (info)->dynobj, &sgot); - entry = mips_elf_create_local_got_entry (abfd, ibfd, g, sgot, value); - if (entry) - return entry->gotidx; - else + entry = mips_elf_create_local_got_entry (abfd, info, ibfd, g, sgot, + input_section, value, + r_symndx, h, r_type); + if (!entry) return MINUS_ONE; + + if (TLS_RELOC_P (r_type)) + { + if (entry->symndx == -1 && g->next == NULL) + /* A type (3) entry in the single-GOT case. We use the symbol's + hash table entry to track the index. */ + return mips_tls_got_index (abfd, h->tls_got_offset, &h->tls_type, + r_type, info, h, value); + else + return mips_tls_got_index (abfd, entry->gotidx, &entry->tls_type, + r_type, info, h, value); + } + else + return entry->gotidx; } /* Returns the GOT index for the global symbol indicated by H. */ static bfd_vma -mips_elf_global_got_index (bfd *abfd, bfd *ibfd, struct elf_link_hash_entry *h) +mips_elf_global_got_index (bfd *abfd, bfd *ibfd, struct elf_link_hash_entry *h, + int r_type, struct bfd_link_info *info) { bfd_vma index; asection *sgot; @@ -1876,54 +2447,91 @@ mips_elf_global_got_index (bfd *abfd, bfd *ibfd, struct elf_link_hash_entry *h) BFD_ASSERT (h->dynindx >= 0); g = mips_elf_got_for_ibfd (g, ibfd); - if (g->next != gg) + if (g->next != gg || TLS_RELOC_P (r_type)) { e.abfd = ibfd; e.symndx = -1; e.d.h = (struct mips_elf_link_hash_entry *)h; + e.tls_type = 0; p = htab_find (g->got_entries, &e); BFD_ASSERT (p->gotidx > 0); - return p->gotidx; + + if (TLS_RELOC_P (r_type)) + { + bfd_vma value = MINUS_ONE; + if ((h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + && h->root.u.def.section->output_section) + value = (h->root.u.def.value + + h->root.u.def.section->output_offset + + h->root.u.def.section->output_section->vma); + + return mips_tls_got_index (abfd, p->gotidx, &p->tls_type, r_type, + info, e.d.h, value); + } + else + return p->gotidx; } } if (gg->global_gotsym != NULL) global_got_dynindx = gg->global_gotsym->dynindx; - /* 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 >= global_got_dynindx); - index = ((h->dynindx - global_got_dynindx + g->local_gotno) - * MIPS_ELF_GOT_SIZE (abfd)); - BFD_ASSERT (index < sgot->_raw_size); + if (TLS_RELOC_P (r_type)) + { + struct mips_elf_link_hash_entry *hm + = (struct mips_elf_link_hash_entry *) h; + bfd_vma value = MINUS_ONE; + + if ((h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + && h->root.u.def.section->output_section) + value = (h->root.u.def.value + + h->root.u.def.section->output_offset + + h->root.u.def.section->output_section->vma); + + index = mips_tls_got_index (abfd, hm->tls_got_offset, &hm->tls_type, + r_type, info, hm, value); + } + else + { + /* 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 >= global_got_dynindx); + index = ((h->dynindx - global_got_dynindx + g->local_gotno) + * MIPS_ELF_GOT_SIZE (abfd)); + } + BFD_ASSERT (index < sgot->size); return index; } -/* 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. */ +/* Find a GOT page entry that points to within 32KB of VALUE, which was + calculated from a symbol belonging to INPUT_SECTION. These entries + are supposed to be placed at small offsets in the GOT, i.e., within + 32KB of GP. Return the index of the GOT entry, or -1 if no entry + could be created. If OFFSETP is nonnull, use it to return the + offset of the GOT entry from VALUE. */ static bfd_vma mips_elf_got_page (bfd *abfd, bfd *ibfd, struct bfd_link_info *info, - bfd_vma value, bfd_vma *offsetp) + asection *input_section, bfd_vma value, bfd_vma *offsetp) { asection *sgot; struct mips_got_info *g; - bfd_vma index; + bfd_vma page, index; struct mips_got_entry *entry; g = mips_elf_got_info (elf_hash_table (info)->dynobj, &sgot); - entry = mips_elf_create_local_got_entry (abfd, ibfd, g, sgot, - (value + 0x8000) - & (~(bfd_vma)0xffff)); + page = (value + 0x8000) & ~(bfd_vma) 0xffff; + entry = mips_elf_create_local_got_entry (abfd, info, ibfd, g, sgot, + input_section, page, 0, + NULL, R_MIPS_GOT_PAGE); if (!entry) return MINUS_ONE; @@ -1936,29 +2544,32 @@ mips_elf_got_page (bfd *abfd, bfd *ibfd, struct bfd_link_info *info, 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. */ +/* Find a local GOT entry for an R_MIPS_GOT16 relocation against VALUE, + which was calculated from a symbol belonging to INPUT_SECTION. + EXTERNAL is true if the relocation was against a global symbol + that has been forced local. */ static bfd_vma mips_elf_got16_entry (bfd *abfd, bfd *ibfd, struct bfd_link_info *info, - bfd_vma value, bfd_boolean external) + asection *input_section, bfd_vma value, + bfd_boolean external) { asection *sgot; struct mips_got_info *g; struct mips_got_entry *entry; + /* GOT16 relocations against local symbols are followed by a LO16 + relocation; those against global symbols are not. Thus if the + symbol was originally local, the GOT16 relocation should load the + equivalent of %hi(VALUE), otherwise it should load VALUE itself. */ if (! external) - { - /* 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; - } + value = mips_elf_high (value) << 16; g = mips_elf_got_info (elf_hash_table (info)->dynobj, &sgot); - entry = mips_elf_create_local_got_entry (abfd, ibfd, g, sgot, value); + entry = mips_elf_create_local_got_entry (abfd, info, ibfd, g, sgot, + input_section, value, 0, + NULL, R_MIPS_GOT16); if (entry) return entry->gotidx; else @@ -1983,20 +2594,29 @@ mips_elf_got_offset_from_index (bfd *dynobj, bfd *output_bfd, return sgot->output_section->vma + sgot->output_offset + index - gp; } -/* Create a local GOT entry for VALUE. Return the index of the entry, - or -1 if it could not be created. */ +/* Create and return a local GOT entry for VALUE, which was calculated + from a symbol belonging to INPUT_SECTON. Return NULL if it could not + be created. If R_SYMNDX refers to a TLS symbol, create a TLS entry + instead. */ static struct mips_got_entry * -mips_elf_create_local_got_entry (bfd *abfd, bfd *ibfd, - struct mips_got_info *gg, - asection *sgot, bfd_vma value) +mips_elf_create_local_got_entry (bfd *abfd, struct bfd_link_info *info, + bfd *ibfd, struct mips_got_info *gg, + asection *sgot, asection *input_section, + bfd_vma value, unsigned long r_symndx, + struct mips_elf_link_hash_entry *h, + int r_type) { struct mips_got_entry entry, **loc; struct mips_got_info *g; + struct mips_elf_link_hash_table *htab; + + htab = mips_elf_hash_table (info); entry.abfd = NULL; entry.symndx = -1; entry.d.address = value; + entry.tls_type = 0; g = mips_elf_got_for_ibfd (gg, ibfd); if (g == NULL) @@ -2005,12 +2625,44 @@ mips_elf_create_local_got_entry (bfd *abfd, bfd *ibfd, BFD_ASSERT (g != NULL); } + /* We might have a symbol, H, if it has been forced local. Use the + global entry then. It doesn't matter whether an entry is local + or global for TLS, since the dynamic linker does not + automatically relocate TLS GOT entries. */ + BFD_ASSERT (h == NULL || h->root.forced_local); + if (TLS_RELOC_P (r_type)) + { + struct mips_got_entry *p; + + entry.abfd = ibfd; + if (r_type == R_MIPS_TLS_LDM) + { + entry.tls_type = GOT_TLS_LDM; + entry.symndx = 0; + entry.d.addend = 0; + } + else if (h == NULL) + { + entry.symndx = r_symndx; + entry.d.addend = 0; + } + else + entry.d.h = h; + + p = (struct mips_got_entry *) + htab_find (g->got_entries, &entry); + + BFD_ASSERT (p); + return p; + } + loc = (struct mips_got_entry **) htab_find_slot (g->got_entries, &entry, INSERT); if (*loc) return *loc; entry.gotidx = MIPS_ELF_GOT_SIZE (abfd) * g->assigned_gotno++; + entry.tls_type = 0; *loc = (struct mips_got_entry *)bfd_alloc (abfd, sizeof entry); @@ -2032,6 +2684,33 @@ mips_elf_create_local_got_entry (bfd *abfd, bfd *ibfd, MIPS_ELF_PUT_WORD (abfd, value, (sgot->contents + entry.gotidx)); + /* These GOT entries need a dynamic relocation on VxWorks. Because + the offset between segments is not fixed, the relocation must be + against a symbol in the same segment as the original symbol. + The easiest way to do this is to take INPUT_SECTION's output + section and emit a relocation against its section symbol. */ + if (htab->is_vxworks) + { + Elf_Internal_Rela outrel; + asection *s, *output_section; + bfd_byte *loc; + bfd_vma got_address; + int dynindx; + + s = mips_elf_rel_dyn_section (info, FALSE); + output_section = input_section->output_section; + dynindx = elf_section_data (output_section)->dynindx; + got_address = (sgot->output_section->vma + + sgot->output_offset + + entry.gotidx); + + loc = s->contents + (s->reloc_count++ * sizeof (Elf32_External_Rela)); + outrel.r_offset = got_address; + outrel.r_info = ELF32_R_INFO (dynindx, R_MIPS_32); + outrel.r_addend = value - output_section->vma; + bfd_elf32_swap_reloca_out (abfd, &outrel, loc); + } + return *loc; } @@ -2106,6 +2785,8 @@ mips_elf_sort_hash_table_f (struct mips_elf_link_hash_entry *h, void *data) -1. */ if (h->root.got.offset == 2) { + BFD_ASSERT (h->tls_type == GOT_NORMAL); + if (hsd->max_unref_got_dynindx == hsd->min_got_dynindx) hsd->low = (struct elf_link_hash_entry *) h; h->root.dynindx = hsd->max_unref_got_dynindx++; @@ -2114,6 +2795,8 @@ mips_elf_sort_hash_table_f (struct mips_elf_link_hash_entry *h, void *data) h->root.dynindx = hsd->max_non_got_dynindx++; else { + BFD_ASSERT (h->tls_type == GOT_NORMAL); + h->root.dynindx = --hsd->min_got_dynindx; hsd->low = (struct elf_link_hash_entry *) h; } @@ -2128,7 +2811,8 @@ mips_elf_sort_hash_table_f (struct mips_elf_link_hash_entry *h, void *data) static bfd_boolean mips_elf_record_global_got_symbol (struct elf_link_hash_entry *h, bfd *abfd, struct bfd_link_info *info, - struct mips_got_info *g) + struct mips_got_info *g, + unsigned char tls_flag) { struct mips_got_entry entry, **loc; @@ -2147,9 +2831,13 @@ mips_elf_record_global_got_symbol (struct elf_link_hash_entry *h, return FALSE; } + /* Make sure we have a GOT to put this entry into. */ + BFD_ASSERT (g != NULL); + entry.abfd = abfd; entry.symndx = -1; entry.d.h = (struct mips_elf_link_hash_entry *) h; + entry.tls_type = 0; loc = (struct mips_got_entry **) htab_find_slot (g->got_entries, &entry, INSERT); @@ -2157,7 +2845,10 @@ mips_elf_record_global_got_symbol (struct elf_link_hash_entry *h, /* If we've already marked this entry as needing GOT space, we don't need to do it again. */ if (*loc) - return TRUE; + { + (*loc)->tls_type |= tls_flag; + return TRUE; + } *loc = (struct mips_got_entry *)bfd_alloc (abfd, sizeof entry); @@ -2165,6 +2856,8 @@ mips_elf_record_global_got_symbol (struct elf_link_hash_entry *h, return FALSE; entry.gotidx = -1; + entry.tls_type = tls_flag; + memcpy (*loc, &entry, sizeof entry); if (h->got.offset != MINUS_ONE) @@ -2173,7 +2866,8 @@ mips_elf_record_global_got_symbol (struct elf_link_hash_entry *h, /* By setting this to a value other than -1, we are indicating that there needs to be a GOT entry for H. Avoid using zero, as the generic ELF copy_indirect_symbol tests for <= 0. */ - h->got.offset = 1; + if (tls_flag == 0) + h->got.offset = 1; return TRUE; } @@ -2183,20 +2877,52 @@ mips_elf_record_global_got_symbol (struct elf_link_hash_entry *h, static bfd_boolean mips_elf_record_local_got_symbol (bfd *abfd, long symndx, bfd_vma addend, - struct mips_got_info *g) + struct mips_got_info *g, + unsigned char tls_flag) { struct mips_got_entry entry, **loc; entry.abfd = abfd; entry.symndx = symndx; entry.d.addend = addend; + entry.tls_type = tls_flag; loc = (struct mips_got_entry **) htab_find_slot (g->got_entries, &entry, INSERT); if (*loc) - return TRUE; + { + if (tls_flag == GOT_TLS_GD && !((*loc)->tls_type & GOT_TLS_GD)) + { + g->tls_gotno += 2; + (*loc)->tls_type |= tls_flag; + } + else if (tls_flag == GOT_TLS_IE && !((*loc)->tls_type & GOT_TLS_IE)) + { + g->tls_gotno += 1; + (*loc)->tls_type |= tls_flag; + } + return TRUE; + } - entry.gotidx = g->local_gotno++; + if (tls_flag != 0) + { + entry.gotidx = -1; + entry.tls_type = tls_flag; + if (tls_flag == GOT_TLS_IE) + g->tls_gotno += 1; + else if (tls_flag == GOT_TLS_GD) + g->tls_gotno += 2; + else if (g->tls_ldm_offset == MINUS_ONE) + { + g->tls_ldm_offset = MINUS_TWO; + g->tls_gotno += 2; + } + } + else + { + entry.gotidx = g->local_gotno++; + entry.tls_type = 0; + } *loc = (struct mips_got_entry *)bfd_alloc (abfd, sizeof entry); @@ -2232,7 +2958,7 @@ mips_elf_bfd2got_entry_eq (const void *entry1, const void *entry2) return e1->bfd == e2->bfd; } -/* In a multi-got link, determine the GOT to be used for IBDF. G must +/* In a multi-got link, determine the GOT to be used for IBFD. G must be the master GOT data. */ static struct mips_got_info * @@ -2296,6 +3022,9 @@ mips_elf_make_got_per_bfd (void **entryp, void *p) g->global_gotno = 0; g->local_gotno = 0; g->assigned_gotno = -1; + g->tls_gotno = 0; + g->tls_assigned_gotno = 0; + g->tls_ldm_offset = MINUS_ONE; g->got_entries = htab_try_create (1, mips_elf_multi_got_entry_hash, mips_elf_multi_got_entry_eq, NULL); if (g->got_entries == NULL) @@ -2315,7 +3044,14 @@ mips_elf_make_got_per_bfd (void **entryp, void *p) *entryp = entry; - if (entry->symndx >= 0 || entry->d.h->forced_local) + if (entry->tls_type) + { + if (entry->tls_type & (GOT_TLS_GD | GOT_TLS_LDM)) + g->tls_gotno += 2; + if (entry->tls_type & GOT_TLS_IE) + g->tls_gotno += 1; + } + else if (entry->symndx >= 0 || entry->d.h->forced_local) ++g->local_gotno; else ++g->global_gotno; @@ -2338,11 +3074,26 @@ mips_elf_merge_gots (void **bfd2got_, void *p) struct mips_elf_got_per_bfd_arg *arg = (struct mips_elf_got_per_bfd_arg *)p; unsigned int lcount = bfd2got->g->local_gotno; unsigned int gcount = bfd2got->g->global_gotno; + unsigned int tcount = bfd2got->g->tls_gotno; unsigned int maxcnt = arg->max_count; + bfd_boolean too_many_for_tls = FALSE; + + /* We place TLS GOT entries after both locals and globals. The globals + for the primary GOT may overflow the normal GOT size limit, so be + sure not to merge a GOT which requires TLS with the primary GOT in that + case. This doesn't affect non-primary GOTs. */ + if (tcount > 0) + { + unsigned int primary_total = lcount + tcount + arg->global_count; + if (primary_total * MIPS_ELF_GOT_SIZE (bfd2got->bfd) + >= MIPS_ELF_GOT_MAX_SIZE (arg->info)) + too_many_for_tls = TRUE; + } /* If we don't have a primary GOT and this is not too big, use it as a starting point for the primary GOT. */ - if (! arg->primary && lcount + gcount <= maxcnt) + if (! arg->primary && lcount + gcount + tcount <= maxcnt + && ! too_many_for_tls) { arg->primary = bfd2got->g; arg->primary_count = lcount + gcount; @@ -2350,12 +3101,13 @@ mips_elf_merge_gots (void **bfd2got_, void *p) /* If it looks like we can merge this bfd's entries with those of the primary, merge them. The heuristics is conservative, but we don't have to squeeze it too hard. */ - else if (arg->primary - && (arg->primary_count + lcount + gcount) <= maxcnt) + else if (arg->primary && ! too_many_for_tls + && (arg->primary_count + lcount + gcount + tcount) <= maxcnt) { struct mips_got_info *g = bfd2got->g; int old_lcount = arg->primary->local_gotno; int old_gcount = arg->primary->global_gotno; + int old_tcount = arg->primary->tls_gotno; bfd2got->g = arg->primary; @@ -2372,17 +3124,19 @@ mips_elf_merge_gots (void **bfd2got_, void *p) BFD_ASSERT (old_lcount + lcount >= arg->primary->local_gotno); BFD_ASSERT (old_gcount + gcount >= arg->primary->global_gotno); + BFD_ASSERT (old_tcount + tcount >= arg->primary->tls_gotno); arg->primary_count = arg->primary->local_gotno - + arg->primary->global_gotno; + + arg->primary->global_gotno + arg->primary->tls_gotno; } /* If we can merge with the last-created got, do it. */ else if (arg->current - && arg->current_count + lcount + gcount <= maxcnt) + && arg->current_count + lcount + gcount + tcount <= maxcnt) { struct mips_got_info *g = bfd2got->g; int old_lcount = arg->current->local_gotno; int old_gcount = arg->current->global_gotno; + int old_tcount = arg->current->tls_gotno; bfd2got->g = arg->current; @@ -2396,9 +3150,10 @@ mips_elf_merge_gots (void **bfd2got_, void *p) BFD_ASSERT (old_lcount + lcount >= arg->current->local_gotno); BFD_ASSERT (old_gcount + gcount >= arg->current->global_gotno); + BFD_ASSERT (old_tcount + tcount >= arg->current->tls_gotno); arg->current_count = arg->current->local_gotno - + arg->current->global_gotno; + + arg->current->global_gotno + arg->current->tls_gotno; } /* Well, we couldn't merge, so create a new GOT. Don't check if it fits; if it turns out that it doesn't, we'll get relocation @@ -2408,12 +3163,63 @@ mips_elf_merge_gots (void **bfd2got_, void *p) bfd2got->g->next = arg->current; arg->current = bfd2got->g; - arg->current_count = lcount + gcount; + arg->current_count = lcount + gcount + 2 * tcount; } return 1; } +/* Set the TLS GOT index for the GOT entry in ENTRYP. ENTRYP's NEXT field + is null iff there is just a single GOT. */ + +static int +mips_elf_initialize_tls_index (void **entryp, void *p) +{ + struct mips_got_entry *entry = (struct mips_got_entry *)*entryp; + struct mips_got_info *g = p; + bfd_vma next_index; + + /* We're only interested in TLS symbols. */ + if (entry->tls_type == 0) + return 1; + + next_index = MIPS_ELF_GOT_SIZE (entry->abfd) * (long) g->tls_assigned_gotno; + + if (entry->symndx == -1 && g->next == NULL) + { + /* A type (3) got entry in the single-GOT case. We use the symbol's + hash table entry to track its index. */ + if (entry->d.h->tls_type & GOT_TLS_OFFSET_DONE) + return 1; + entry->d.h->tls_type |= GOT_TLS_OFFSET_DONE; + entry->d.h->tls_got_offset = next_index; + } + else + { + if (entry->tls_type & GOT_TLS_LDM) + { + /* There are separate mips_got_entry objects for each input bfd + that requires an LDM entry. Make sure that all LDM entries in + a GOT resolve to the same index. */ + if (g->tls_ldm_offset != MINUS_TWO && g->tls_ldm_offset != MINUS_ONE) + { + entry->gotidx = g->tls_ldm_offset; + return 1; + } + g->tls_ldm_offset = next_index; + } + entry->gotidx = next_index; + } + + /* Account for the entries we've just allocated. */ + if (entry->tls_type & (GOT_TLS_GD | GOT_TLS_LDM)) + g->tls_assigned_gotno += 2; + if (entry->tls_type & GOT_TLS_IE) + g->tls_assigned_gotno += 1; + + return 1; +} + /* If passed a NULL mips_got_info in the argument, set the marker used to tell whether a global symbol needs a got entry (in the primary got) to the given VALUE. @@ -2435,8 +3241,14 @@ mips_elf_set_global_got_offset (void **entryp, void *p) = (struct mips_elf_set_global_got_offset_arg *)p; struct mips_got_info *g = arg->g; + if (g && entry->tls_type != GOT_NORMAL) + arg->needed_relocs += + mips_tls_got_relocs (arg->info, entry->tls_type, + entry->symndx == -1 ? &entry->d.h->root : NULL); + if (entry->abfd != NULL && entry->symndx == -1 - && entry->d.h->root.dynindx != -1) + && entry->d.h->root.dynindx != -1 + && entry->d.h->tls_type == GOT_NORMAL) { if (g) { @@ -2445,10 +3257,8 @@ mips_elf_set_global_got_offset (void **entryp, void *p) entry->gotidx = arg->value * (long) g->assigned_gotno++; if (arg->info->shared || (elf_hash_table (arg->info)->dynamic_sections_created - && ((entry->d.h->root.elf_link_hash_flags - & ELF_LINK_HASH_DEF_DYNAMIC) != 0) - && ((entry->d.h->root.elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0))) + && entry->d.h->root.def_dynamic + && !entry->d.h->root.def_regular)) ++arg->needed_relocs; } else @@ -2553,7 +3363,8 @@ mips_elf_adjust_gp (bfd *abfd, struct mips_got_info *g, bfd *ibfd) g = g->next; - return (g->local_gotno + g->global_gotno) * MIPS_ELF_GOT_SIZE (abfd); + return (g->local_gotno + g->global_gotno + g->tls_gotno) + * MIPS_ELF_GOT_SIZE (abfd); } /* Turn a single GOT that is too big for 16-bit addressing into @@ -2580,7 +3391,6 @@ mips_elf_multi_got (bfd *abfd, struct bfd_link_info *info, /* Count how many GOT entries each input bfd requires, creating a map from bfd to got info while at that. */ - mips_elf_resolve_final_got_entries (g); htab_traverse (g->got_entries, mips_elf_make_got_per_bfd, &got_per_bfd_arg); if (got_per_bfd_arg.obfd == NULL) return FALSE; @@ -2590,9 +3400,13 @@ mips_elf_multi_got (bfd *abfd, struct bfd_link_info *info, /* Taking out PAGES entries is a worst-case estimate. We could compute the maximum number of pages that each separate input bfd uses, but it's probably not worth it. */ - got_per_bfd_arg.max_count = ((MIPS_ELF_GOT_MAX_SIZE (abfd) + got_per_bfd_arg.max_count = ((MIPS_ELF_GOT_MAX_SIZE (info) / MIPS_ELF_GOT_SIZE (abfd)) - - MIPS_RESERVED_GOTNO - pages); + - MIPS_RESERVED_GOTNO (info) - pages); + /* The number of globals that will be included in the primary GOT. + See the calls to mips_elf_set_global_got_offset below for more + information. */ + got_per_bfd_arg.global_count = g->global_gotno; /* Try to merge the GOTs of input bfds together, as long as they don't seem to exceed the maximum GOT size, choosing one of them @@ -2601,7 +3415,7 @@ mips_elf_multi_got (bfd *abfd, struct bfd_link_info *info, if (got_per_bfd_arg.obfd == NULL) return FALSE; - /* If we find any suitable primary GOT, create an empty one. */ + /* If we do not find any suitable primary GOT, create an empty one. */ if (got_per_bfd_arg.primary == NULL) { g->next = (struct mips_got_info *) @@ -2612,7 +3426,10 @@ mips_elf_multi_got (bfd *abfd, struct bfd_link_info *info, g->next->global_gotsym = NULL; g->next->global_gotno = 0; g->next->local_gotno = 0; + g->next->tls_gotno = 0; g->next->assigned_gotno = 0; + g->next->tls_assigned_gotno = 0; + g->next->tls_ldm_offset = MINUS_ONE; g->next->got_entries = htab_try_create (1, mips_elf_multi_got_entry_hash, mips_elf_multi_got_entry_eq, NULL); @@ -2712,6 +3529,7 @@ mips_elf_multi_got (bfd *abfd, struct bfd_link_info *info, points back to the master GOT. */ gg->local_gotno = -g->global_gotno; gg->global_gotno = g->global_gotno; + gg->tls_gotno = 0; assign = 0; gg->next = gg; @@ -2719,16 +3537,24 @@ mips_elf_multi_got (bfd *abfd, struct bfd_link_info *info, { struct mips_got_info *gn; - assign += MIPS_RESERVED_GOTNO; + assign += MIPS_RESERVED_GOTNO (info); g->assigned_gotno = assign; g->local_gotno += assign + pages; - assign = g->local_gotno + g->global_gotno; + assign = g->local_gotno + g->global_gotno + g->tls_gotno; /* Take g out of the direct list, and push it onto the reversed - list that gg points to. */ + list that gg points to. g->next is guaranteed to be nonnull after + this operation, as required by mips_elf_initialize_tls_index. */ gn = g->next; g->next = gg->next; gg->next = g; + + /* Set up any TLS entries. We always place the TLS entries after + all non-TLS entries. */ + g->tls_assigned_gotno = g->local_gotno + g->global_gotno; + htab_traverse (g->got_entries, mips_elf_initialize_tls_index, g); + + /* Move onto the next GOT. It will be a secondary GOT if nonull. */ g = gn; /* Mark global symbols in every non-primary GOT as ineligible for @@ -2738,8 +3564,9 @@ mips_elf_multi_got (bfd *abfd, struct bfd_link_info *info, } while (g); - got->_raw_size = (gg->next->local_gotno - + gg->next->global_gotno) * MIPS_ELF_GOT_SIZE (abfd); + got->size = (gg->next->local_gotno + + gg->next->global_gotno + + gg->next->tls_gotno) * MIPS_ELF_GOT_SIZE (abfd); return TRUE; } @@ -2753,12 +3580,6 @@ mips_elf_next_relocation (bfd *abfd ATTRIBUTE_UNUSED, unsigned int r_type, const Elf_Internal_Rela *relocation, const Elf_Internal_Rela *relend) { - /* According to the MIPS ELF ABI, the R_MIPS_LO16 relocation must be - immediately following. However, for the IRIX6 ABI, the next - 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 (ELF_R_TYPE (abfd, relocation->r_info) == r_type) @@ -2804,7 +3625,7 @@ mips_elf_local_relocation_p (bfd *input_bfd, while (h->root.root.type == bfd_link_hash_indirect || h->root.root.type == bfd_link_hash_warning) h = (struct mips_elf_link_hash_entry *) h->root.root.u.i.link; - if ((h->root.elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0) + if (h->root.forced_local) return TRUE; } @@ -2860,7 +3681,7 @@ mips_elf_higher (bfd_vma value ATTRIBUTE_UNUSED) return ((value + (bfd_vma) 0x80008000) >> 32) & 0xffff; #else abort (); - return (bfd_vma) -1; + return MINUS_ONE; #endif } @@ -2873,7 +3694,7 @@ mips_elf_highest (bfd_vma value ATTRIBUTE_UNUSED) return ((value + (((bfd_vma) 0x8000 << 32) | 0x80008000)) >> 48) & 0xffff; #else abort (); - return (bfd_vma) -1; + return MINUS_ONE; #endif } @@ -2891,14 +3712,13 @@ mips_elf_create_compact_rel_section flags = (SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED | SEC_READONLY); - s = bfd_make_section (abfd, ".compact_rel"); + s = bfd_make_section_with_flags (abfd, ".compact_rel", flags); 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); + s->size = sizeof (Elf32_External_compact_rel); } return TRUE; @@ -2916,6 +3736,9 @@ mips_elf_create_got_section (bfd *abfd, struct bfd_link_info *info, struct bfd_link_hash_entry *bh; struct mips_got_info *g; bfd_size_type amt; + struct mips_elf_link_hash_table *htab; + + htab = mips_elf_hash_table (info); /* This function may be called more than once. */ s = mips_elf_got_section (abfd, TRUE); @@ -2934,9 +3757,8 @@ mips_elf_create_got_section (bfd *abfd, struct bfd_link_info *info, /* We have to use an alignment of 2**4 here because this is hardcoded in the function stub generation and in the linker script. */ - s = bfd_make_section (abfd, ".got"); + s = bfd_make_section_with_flags (abfd, ".got", flags); if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags) || ! bfd_set_section_alignment (abfd, s, 4)) return FALSE; @@ -2950,9 +3772,10 @@ mips_elf_create_got_section (bfd *abfd, struct bfd_link_info *info, return FALSE; h = (struct elf_link_hash_entry *) bh; - h->elf_link_hash_flags &= ~ELF_LINK_NON_ELF; - h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; + h->non_elf = 0; + h->def_regular = 1; h->type = STT_OBJECT; + elf_hash_table (info)->hgot = h; if (info->shared && ! bfd_elf_link_record_dynamic_symbol (info, h)) @@ -2964,10 +3787,12 @@ mips_elf_create_got_section (bfd *abfd, struct bfd_link_info *info, return FALSE; g->global_gotsym = NULL; g->global_gotno = 0; - g->local_gotno = MIPS_RESERVED_GOTNO; - g->assigned_gotno = MIPS_RESERVED_GOTNO; + g->tls_gotno = 0; + g->local_gotno = MIPS_RESERVED_GOTNO (info); + g->assigned_gotno = MIPS_RESERVED_GOTNO (info); g->bfd2got = NULL; g->next = NULL; + g->tls_ldm_offset = MINUS_ONE; g->got_entries = htab_try_create (1, mips_elf_got_entry_hash, mips_elf_got_entry_eq, NULL); if (g->got_entries == NULL) @@ -2976,9 +3801,33 @@ mips_elf_create_got_section (bfd *abfd, struct bfd_link_info *info, mips_elf_section_data (s)->elf.this_hdr.sh_flags |= SHF_ALLOC | SHF_WRITE | SHF_MIPS_GPREL; + /* VxWorks also needs a .got.plt section. */ + if (htab->is_vxworks) + { + s = bfd_make_section_with_flags (abfd, ".got.plt", + SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS + | SEC_IN_MEMORY | SEC_LINKER_CREATED); + if (s == NULL || !bfd_set_section_alignment (abfd, s, 4)) + return FALSE; + + htab->sgotplt = s; + } return TRUE; } +/* Return true if H refers to the special VxWorks __GOTT_BASE__ or + __GOTT_INDEX__ symbols. These symbols are only special for + shared objects; they are not used in executables. */ + +static bfd_boolean +is_gott_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *h) +{ + return (mips_elf_hash_table (info)->is_vxworks + && info->shared + && (strcmp (h->root.root.string, "__GOTT_BASE__") == 0 + || strcmp (h->root.root.string, "__GOTT_INDEX__") == 0)); +} + /* 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. @@ -3029,6 +3878,9 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd, bfd_boolean local_p, was_local_p; /* TRUE if the symbol referred to by this relocation is "_gp_disp". */ bfd_boolean gp_disp_p = FALSE; + /* TRUE if the symbol referred to by this relocation is + "__gnu_local_gp". */ + bfd_boolean gnu_local_gp_p = FALSE; Elf_Internal_Shdr *symtab_hdr; size_t extsymoff; unsigned long r_symndx; @@ -3038,6 +3890,11 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd, bfd_boolean overflowed_p; /* TRUE if this relocation refers to a MIPS16 function. */ bfd_boolean target_is_16_bit_code_p = FALSE; + struct mips_elf_link_hash_table *htab; + bfd *dynobj; + + dynobj = elf_hash_table (info)->dynobj; + htab = mips_elf_hash_table (info); /* Parse the relocation. */ r_symndx = ELF_R_SYM (input_bfd, relocation->r_info); @@ -3119,11 +3976,18 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd, { /* 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) + if (r_type != R_MIPS_HI16 && r_type != R_MIPS_LO16 + && r_type != R_MIPS16_HI16 && r_type != R_MIPS16_LO16) return bfd_reloc_notsupported; gp_disp_p = TRUE; } + /* See if this is the special _gp symbol. Note that such a + symbol must always be a global symbol. */ + else if (strcmp (*namep, "__gnu_local_gp") == 0) + gnu_local_gp_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 @@ -3149,8 +4013,8 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd, else if (info->unresolved_syms_in_objects == RM_IGNORE && ELF_ST_VISIBILITY (h->root.other) == STV_DEFAULT) symbol = 0; - else if (strcmp (*namep, "_DYNAMIC_LINK") == 0 || - strcmp (*namep, "_DYNAMIC_LINKING") == 0) + else if (strcmp (*namep, SGI_COMPAT (input_bfd) + ? "_DYNAMIC_LINK" : "_DYNAMIC_LINKING") == 0) { /* If this is a dynamic link, we should have created a _DYNAMIC_LINK symbol or _DYNAMIC_LINKING(for normal mips) symbol @@ -3162,6 +4026,17 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd, BFD_ASSERT (bfd_get_section_by_name (abfd, ".dynamic") == NULL); symbol = 0; } + else if (ELF_MIPS_IS_OPTIONAL (h->root.other)) + { + /* This is an optional symbol - an Irix specific extension to the + ELF spec. Ignore it for now. + XXX - FIXME - there is more to the spec for OPTIONAL symbols + than simply ignoring them, but we do not handle this for now. + For information see the "64-bit ELF Object File Specification" + which is available from here: + http://techpubs.sgi.com/library/manuals/4000/007-4658-001/pdf/007-4658-001.pdf */ + symbol = 0; + } else { if (! ((*info->callbacks->undefined_symbol) @@ -3230,7 +4105,7 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd, else sec = h->call_fp_stub; - BFD_ASSERT (sec->_raw_size > 0); + BFD_ASSERT (sec->size > 0); symbol = sec->output_section->vma + sec->output_offset; } @@ -3263,59 +4138,81 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd, case R_MIPS_CALL_HI16: case R_MIPS_GOT_LO16: case R_MIPS_CALL_LO16: + case R_MIPS_TLS_GD: + case R_MIPS_TLS_GOTTPREL: + case R_MIPS_TLS_LDM: /* Find the index into the GOT where this value is located. */ - if (!local_p) + if (r_type == R_MIPS_TLS_LDM) { - /* GOT_PAGE may take a non-zero addend, that is ignored in a - GOT_PAGE relocation that decays to GOT_DISP because the - symbol turns out to be global. The addend is then added - as GOT_OFST. */ - BFD_ASSERT (addend == 0 || r_type == R_MIPS_GOT_PAGE); - g = mips_elf_global_got_index (elf_hash_table (info)->dynobj, - input_bfd, - (struct elf_link_hash_entry *) h); - if (! elf_hash_table(info)->dynamic_sections_created - || (info->shared - && (info->symbolic || h->root.dynindx == -1) - && (h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))) + g = mips_elf_local_got_index (abfd, input_bfd, info, + sec, 0, 0, NULL, r_type); + if (g == MINUS_ONE) + return bfd_reloc_outofrange; + } + else if (!local_p) + { + /* On VxWorks, CALL relocations should refer to the .got.plt + entry, which is initialized to point at the PLT stub. */ + if (htab->is_vxworks + && (r_type == R_MIPS_CALL_HI16 + || r_type == R_MIPS_CALL_LO16 + || r_type == R_MIPS_CALL16)) { - /* This is a static link or a -Bsymbolic link. The - symbol is defined locally, or was forced to be local. - We must initialize this entry in the GOT. */ - bfd *tmpbfd = elf_hash_table (info)->dynobj; - asection *sgot = mips_elf_got_section (tmpbfd, FALSE); - MIPS_ELF_PUT_WORD (tmpbfd, symbol, sgot->contents + g); + BFD_ASSERT (addend == 0); + BFD_ASSERT (h->root.needs_plt); + g = mips_elf_gotplt_index (info, &h->root); + } + else + { + /* GOT_PAGE may take a non-zero addend, that is ignored in a + GOT_PAGE relocation that decays to GOT_DISP because the + symbol turns out to be global. The addend is then added + as GOT_OFST. */ + BFD_ASSERT (addend == 0 || r_type == R_MIPS_GOT_PAGE); + g = mips_elf_global_got_index (dynobj, input_bfd, + &h->root, r_type, info); + if (h->tls_type == GOT_NORMAL + && (! elf_hash_table(info)->dynamic_sections_created + || (info->shared + && (info->symbolic || h->root.forced_local) + && h->root.def_regular))) + { + /* This is a static link or a -Bsymbolic link. The + symbol is defined locally, or was forced to be local. + We must initialize this entry in the GOT. */ + asection *sgot = mips_elf_got_section (dynobj, FALSE); + MIPS_ELF_PUT_WORD (dynobj, symbol, sgot->contents + g); + } } } - else if (r_type == R_MIPS_GOT16 || r_type == R_MIPS_CALL16) - /* There's no need to create a local GOT entry here; the - calculation for a local GOT16 entry does not involve G. */ + else if (!htab->is_vxworks + && (r_type == R_MIPS_CALL16 || (r_type == R_MIPS_GOT16))) + /* The calculation below does not involve "g". */ break; else { - g = mips_elf_local_got_index (abfd, input_bfd, - info, symbol + addend); + g = mips_elf_local_got_index (abfd, input_bfd, info, sec, + symbol + addend, r_symndx, h, r_type); if (g == MINUS_ONE) return bfd_reloc_outofrange; } /* Convert GOT indices to actual offsets. */ - g = mips_elf_got_offset_from_index (elf_hash_table (info)->dynobj, - abfd, input_bfd, g); + g = mips_elf_got_offset_from_index (dynobj, abfd, input_bfd, g); break; case R_MIPS_HI16: case R_MIPS_LO16: - case R_MIPS16_GPREL: case R_MIPS_GPREL16: case R_MIPS_GPREL32: case R_MIPS_LITERAL: + case R_MIPS16_HI16: + case R_MIPS16_LO16: + case R_MIPS16_GPREL: gp0 = _bfd_get_gp_value (input_bfd); gp = _bfd_get_gp_value (abfd); - if (elf_hash_table (info)->dynobj) - gp += mips_elf_adjust_gp (abfd, - mips_elf_got_info - (elf_hash_table (info)->dynobj, NULL), + if (dynobj) + gp += mips_elf_adjust_gp (abfd, mips_elf_got_info (dynobj, NULL), input_bfd); break; @@ -3323,6 +4220,30 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd, break; } + if (gnu_local_gp_p) + symbol = gp; + + /* Relocations against the VxWorks __GOTT_BASE__ and __GOTT_INDEX__ + symbols are resolved by the loader. Add them to .rela.dyn. */ + if (h != NULL && is_gott_symbol (info, &h->root)) + { + Elf_Internal_Rela outrel; + bfd_byte *loc; + asection *s; + + s = mips_elf_rel_dyn_section (info, FALSE); + loc = s->contents + s->reloc_count++ * sizeof (Elf32_External_Rela); + + outrel.r_offset = (input_section->output_section->vma + + input_section->output_offset + + relocation->r_offset); + outrel.r_info = ELF32_R_INFO (h->root.dynindx, r_type); + outrel.r_addend = addend; + bfd_elf32_swap_reloca_out (abfd, &outrel, loc); + *valuep = 0; + return bfd_reloc_ok; + } + /* Figure out what kind of relocation is being performed. */ switch (r_type) { @@ -3338,12 +4259,11 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd, case R_MIPS_REL32: case R_MIPS_64: if ((info->shared - || (elf_hash_table (info)->dynamic_sections_created + || (!htab->is_vxworks + && htab->root.dynamic_sections_created && h != NULL - && ((h->root.elf_link_hash_flags - & ELF_LINK_HASH_DEF_DYNAMIC) != 0) - && ((h->root.elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0))) + && h->root.def_dynamic + && !h->root.def_regular)) && r_symndx != 0 && (input_section->flags & SEC_ALLOC) != 0) { @@ -3351,7 +4271,11 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd, 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. */ + linker. + + In VxWorks executables, references to external symbols + are handled using copy relocs or PLT stubs, so there's + no need to add a dynamic relocation here. */ value = addend; if (!mips_elf_create_dynamic_relocation (abfd, info, @@ -3374,28 +4298,10 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd, 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 + _bfd_mips_elf_sign_extend (addend, 18) - p; - overflowed_p = mips_elf_overflow_p (value, 18); - value = (value >> 2) & howto->dst_mask; - break; - - case R_MIPS_GNU_REL_HI16: - /* Instead of subtracting 'p' here, we should be subtracting the - equivalent value for the LO part of the reloc, since the value - here is relative to that address. Because that's not easy to do, - we adjust 'addend' in _bfd_mips_elf_relocate_section(). See also - the comment there for more information. */ - value = mips_elf_high (addend + symbol - p); - value &= howto->dst_mask; - break; - case R_MIPS16_26: /* The calculation for R_MIPS16_26 is just the same as for an R_MIPS_26. It's only the storage of the relocated field into @@ -3406,11 +4312,34 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd, if (local_p) value = ((addend | ((p + 4) & 0xf0000000)) + symbol) >> 2; else - value = (_bfd_mips_elf_sign_extend (addend, 28) + symbol) >> 2; + { + value = (_bfd_mips_elf_sign_extend (addend, 28) + symbol) >> 2; + if (h->root.root.type != bfd_link_hash_undefweak) + overflowed_p = (value >> 26) != ((p + 4) >> 28); + } value &= howto->dst_mask; break; + case R_MIPS_TLS_DTPREL_HI16: + value = (mips_elf_high (addend + symbol - dtprel_base (info)) + & howto->dst_mask); + break; + + case R_MIPS_TLS_DTPREL_LO16: + value = (symbol + addend - dtprel_base (info)) & howto->dst_mask; + break; + + case R_MIPS_TLS_TPREL_HI16: + value = (mips_elf_high (addend + symbol - tprel_base (info)) + & howto->dst_mask); + break; + + case R_MIPS_TLS_TPREL_LO16: + value = (symbol + addend - tprel_base (info)) & howto->dst_mask; + break; + case R_MIPS_HI16: + case R_MIPS16_HI16: if (!gp_disp_p) { value = mips_elf_high (addend + symbol); @@ -3418,17 +4347,35 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd, } else { - value = mips_elf_high (addend + gp - p); + /* For MIPS16 ABI code we generate this sequence + 0: li $v0,%hi(_gp_disp) + 4: addiupc $v1,%lo(_gp_disp) + 8: sll $v0,16 + 12: addu $v0,$v1 + 14: move $gp,$v0 + So the offsets of hi and lo relocs are the same, but the + $pc is four higher than $t9 would be, so reduce + both reloc addends by 4. */ + if (r_type == R_MIPS16_HI16) + value = mips_elf_high (addend + gp - p - 4); + else + value = mips_elf_high (addend + gp - p); overflowed_p = mips_elf_overflow_p (value, 16); } break; case R_MIPS_LO16: + case R_MIPS16_LO16: if (!gp_disp_p) value = (symbol + addend) & howto->dst_mask; else { - value = addend + gp - p + 4; + /* See the comment for R_MIPS16_HI16 above for the reason + for this conditional. */ + if (r_type == R_MIPS16_LO16) + value = addend + gp - p; + else + value = addend + gp - p + 4; /* The MIPS ABI requires checking the R_MIPS_LO16 relocation for overflow. But, on, say, IRIX5, relocations against _gp_disp are normally generated from the .cpload @@ -3480,28 +4427,29 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd, case R_MIPS_GOT16: case R_MIPS_CALL16: - if (local_p) + /* VxWorks does not have separate local and global semantics for + R_MIPS_GOT16; every relocation evaluates to "G". */ + if (!htab->is_vxworks && local_p) { bfd_boolean forced; - /* The special case is when the symbol is forced to be local. We - need the full address in the GOT since no R_MIPS_LO16 relocation - follows. */ forced = ! mips_elf_local_relocation_p (input_bfd, relocation, local_sections, FALSE); - value = mips_elf_got16_entry (abfd, input_bfd, info, + value = mips_elf_got16_entry (abfd, input_bfd, info, sec, symbol + addend, forced); if (value == MINUS_ONE) return bfd_reloc_outofrange; value - = mips_elf_got_offset_from_index (elf_hash_table (info)->dynobj, - abfd, input_bfd, value); + = mips_elf_got_offset_from_index (dynobj, abfd, input_bfd, value); overflowed_p = mips_elf_overflow_p (value, 16); break; } /* Fall through. */ + case R_MIPS_TLS_GD: + case R_MIPS_TLS_GOTTPREL: + case R_MIPS_TLS_LDM: case R_MIPS_GOT_DISP: got_disp: value = g; @@ -3515,8 +4463,10 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd, break; case R_MIPS_PC16: - value = _bfd_mips_elf_sign_extend (addend, 16) + symbol - p; - overflowed_p = mips_elf_overflow_p (value, 16); + case R_MIPS_GNU_REL16_S2: + value = symbol + _bfd_mips_elf_sign_extend (addend, 18) - p; + overflowed_p = mips_elf_overflow_p (value, 18); + value = (value >> 2) & howto->dst_mask; break; case R_MIPS_GOT_HI16: @@ -3540,17 +4490,18 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd, 0. */ if (! local_p) goto got_disp; - value = mips_elf_got_page (abfd, input_bfd, info, symbol + addend, NULL); + value = mips_elf_got_page (abfd, input_bfd, info, sec, + symbol + addend, NULL); if (value == MINUS_ONE) return bfd_reloc_outofrange; - value = mips_elf_got_offset_from_index (elf_hash_table (info)->dynobj, - abfd, input_bfd, value); + value = mips_elf_got_offset_from_index (dynobj, abfd, input_bfd, value); overflowed_p = mips_elf_overflow_p (value, 16); break; case R_MIPS_GOT_OFST: if (local_p) - mips_elf_got_page (abfd, input_bfd, info, symbol + addend, &value); + mips_elf_got_page (abfd, input_bfd, info, sec, + symbol + addend, &value); else value = addend; overflowed_p = mips_elf_overflow_p (value, 16); @@ -3576,12 +4527,16 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd, 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; + /* This relocation is only a hint. In some cases, we optimize + it into a bal instruction. But we don't try to optimize + branches to the PLT; that will wind up wasting time. */ + if (h != NULL && h->root.plt.offset != (bfd_vma) -1) + return bfd_reloc_continue; + value = symbol + addend; + break; + case R_MIPS_PJUMP: case R_MIPS_GNU_VTINHERIT: case R_MIPS_GNU_VTENTRY: /* We don't do anything with these at present. */ @@ -3610,13 +4565,6 @@ mips_elf_obtain_contents (reloc_howto_type *howto, /* Obtain the bytes. */ x = bfd_get ((8 * bfd_get_reloc_size (howto)), input_bfd, location); - if ((ELF_R_TYPE (input_bfd, relocation->r_info) == R_MIPS16_26 - || ELF_R_TYPE (input_bfd, 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; } @@ -3644,107 +4592,14 @@ mips_elf_perform_relocation (struct bfd_link_info *info, /* Figure out where the relocation is occurring. */ location = contents + relocation->r_offset; + _bfd_mips16_elf_reloc_unshuffle (input_bfd, r_type, FALSE, location); + /* 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 relocatable 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 relocatable object file, the calculation is - (((A < 2) | ((P + 4) & 0xf0000000) + S) >> 2) - When producing a fully linked file, the calculation is - let R = (((A < 2) | ((P + 4) & 0xf0000000) + S) >> 2) - ((R & 0x1f0000) << 5) | ((R & 0x3e00000) >> 5) | (R & 0xffff) */ - - if (!info->relocatable) - /* 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); @@ -3771,9 +4626,9 @@ mips_elf_perform_relocation (struct bfd_link_info *info, if (!ok) { (*_bfd_error_handler) - (_("%s: %s+0x%lx: jump to stub routine which is not jal"), - bfd_archive_filename (input_bfd), - input_section->name, + (_("%B: %A+0x%lx: jump to stub routine which is not jal"), + input_bfd, + input_section, (unsigned long) relocation->r_offset); bfd_set_error (bfd_error_bad_value); return FALSE; @@ -3783,14 +4638,39 @@ mips_elf_perform_relocation (struct bfd_link_info *info, 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)); + /* On the RM9000, bal is faster than jal, because bal uses branch + prediction hardware. If we are linking for the RM9000, and we + see jal, and bal fits, use it instead. Note that this + transformation should be safe for all architectures. */ + if (bfd_get_mach (input_bfd) == bfd_mach_mips9000 + && !info->relocatable + && !require_jalx + && ((r_type == R_MIPS_26 && (x >> 26) == 0x3) /* jal addr */ + || (r_type == R_MIPS_JALR && x == 0x0320f809))) /* jalr t9 */ + { + bfd_vma addr; + bfd_vma dest; + bfd_signed_vma off; + + addr = (input_section->output_section->vma + + input_section->output_offset + + relocation->r_offset + + 4); + if (r_type == R_MIPS_26) + dest = (value << 2) | ((addr >> 28) << 28); + else + dest = value; + off = dest - addr; + if (off <= 0x1ffff && off >= -0x20000) + x = 0x04110000 | (((bfd_vma) off >> 2) & 0xffff); /* bal addr */ + } /* Put the value into the output. */ bfd_put (8 * bfd_get_reloc_size (howto), input_bfd, x, location); + + _bfd_mips16_elf_reloc_shuffle(input_bfd, r_type, !info->relocatable, + location); + return TRUE; } @@ -3806,23 +4686,31 @@ mips_elf_stub_section_p (bfd *abfd ATTRIBUTE_UNUSED, asection *section) || strncmp (name, CALL_FP_STUB, sizeof CALL_FP_STUB - 1) == 0); } -/* Add room for N relocations to the .rel.dyn section in ABFD. */ +/* Add room for N relocations to the .rel(a).dyn section in ABFD. */ static void -mips_elf_allocate_dynamic_relocations (bfd *abfd, unsigned int n) +mips_elf_allocate_dynamic_relocations (bfd *abfd, struct bfd_link_info *info, + unsigned int n) { asection *s; + struct mips_elf_link_hash_table *htab; - s = mips_elf_rel_dyn_section (abfd, FALSE); + htab = mips_elf_hash_table (info); + s = mips_elf_rel_dyn_section (info, FALSE); BFD_ASSERT (s != NULL); - if (s->_raw_size == 0) + if (htab->is_vxworks) + s->size += n * MIPS_ELF_RELA_SIZE (abfd); + else { - /* Make room for a null element. */ - s->_raw_size += MIPS_ELF_REL_SIZE (abfd); - ++s->reloc_count; + if (s->size == 0) + { + /* Make room for a null element. */ + s->size += MIPS_ELF_REL_SIZE (abfd); + ++s->reloc_count; + } + s->size += n * MIPS_ELF_REL_SIZE (abfd); } - s->_raw_size += n * MIPS_ELF_REL_SIZE (abfd); } /* Create a rel.dyn relocation for the dynamic linker to resolve. REL @@ -3839,20 +4727,22 @@ mips_elf_create_dynamic_relocation (bfd *output_bfd, bfd_vma *addendp, asection *input_section) { Elf_Internal_Rela outrel[3]; - bfd_boolean skip; asection *sreloc; bfd *dynobj; int r_type; + long indx; + bfd_boolean defined_p; + struct mips_elf_link_hash_table *htab; + htab = mips_elf_hash_table (info); r_type = ELF_R_TYPE (output_bfd, rel->r_info); dynobj = elf_hash_table (info)->dynobj; - sreloc = mips_elf_rel_dyn_section (dynobj, FALSE); + sreloc = mips_elf_rel_dyn_section (info, FALSE); BFD_ASSERT (sreloc != NULL); BFD_ASSERT (sreloc->contents != NULL); BFD_ASSERT (sreloc->reloc_count * MIPS_ELF_REL_SIZE (output_bfd) - < sreloc->_raw_size); + < sreloc->size); - skip = FALSE; outrel[0].r_offset = _bfd_elf_section_offset (output_bfd, info, input_section, rel[0].r_offset); outrel[1].r_offset = @@ -3860,147 +4750,114 @@ mips_elf_create_dynamic_relocation (bfd *output_bfd, outrel[2].r_offset = _bfd_elf_section_offset (output_bfd, info, input_section, rel[2].r_offset); -#if 0 - /* 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 (input_section->sec_info_type != ELF_INFO_TYPE_STABS) - { - outrel[1].r_offset = rel[1].r_offset; - outrel[2].r_offset = rel[2].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[1].r_offset = outrel[0].r_offset; - outrel[2].r_offset = outrel[0].r_offset; - /* If we didn't need the relocation at all, this value will be - -1. */ - if (outrel[0].r_offset == (bfd_vma) -1) - skip = TRUE; - } -#endif - - if (outrel[0].r_offset == (bfd_vma) -1) + if (outrel[0].r_offset == MINUS_ONE) /* The relocation field has been deleted. */ - skip = TRUE; - else if (outrel[0].r_offset == (bfd_vma) -2) + return TRUE; + + if (outrel[0].r_offset == MINUS_TWO) { /* The relocation field has been converted into a relative value of some sort. Functions like _bfd_elf_write_section_eh_frame expect the field to be fully relocated, so add in the symbol's value. */ - skip = TRUE; *addendp += symbol; + return TRUE; } - /* If we've decided to skip this relocation, just output an empty - 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 (Elf_Internal_Rela) * 3); + /* We must now calculate the dynamic symbol table index to use + in the relocation. */ + if (h != NULL + && (!h->root.def_regular + || (info->shared && !info->symbolic && !h->root.forced_local))) + { + indx = h->root.dynindx; + if (SGI_COMPAT (output_bfd)) + defined_p = h->root.def_regular; + else + /* ??? glibc's ld.so just adds the final GOT entry to the + relocation field. It therefore treats relocs against + defined symbols in the same way as relocs against + undefined symbols. */ + defined_p = FALSE; + } else { - long indx; - bfd_boolean defined_p; - - /* 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) - /* h->root.dynindx may be -1 if this symbol was marked to - become local. */ - && h->root.dynindx != -1) + if (sec != NULL && bfd_is_abs_section (sec)) + indx = 0; + else if (sec == NULL || sec->owner == NULL) { - indx = h->root.dynindx; - if (SGI_COMPAT (output_bfd)) - defined_p = ((h->root.elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) != 0); - else - /* ??? glibc's ld.so just adds the final GOT entry to the - relocation field. It therefore treats relocs against - defined symbols in the same way as relocs against - undefined symbols. */ - defined_p = FALSE; + bfd_set_error (bfd_error_bad_value); + return FALSE; } 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 (); - } - - /* Instead of generating a relocation using the section - symbol, we may as well make it a fully relative - relocation. We want to avoid generating relocations to - local symbols because we used to generate them - incorrectly, without adding the original symbol value, - which is mandated by the ABI for section symbols. In - order to give dynamic loaders and applications time to - phase out the incorrect use, we refrain from emitting - section-relative relocations. It's not like they're - useful, after all. This should be a bit more efficient - as well. */ - /* ??? Although this behavior is compatible with glibc's ld.so, - the ABI says that relocations against STN_UNDEF should have - a symbol value of 0. Irix rld honors this, so relocations - against STN_UNDEF have no effect. */ - if (!SGI_COMPAT (output_bfd)) - indx = 0; - defined_p = TRUE; + indx = elf_section_data (sec->output_section)->dynindx; + if (indx == 0) + abort (); } - /* If the relocation was previously an absolute relocation and - this symbol will not be referred to by the relocation, we must - adjust it by the value we give it in the dynamic symbol table. - Otherwise leave the job up to the dynamic linker. */ - if (defined_p && 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[0].r_info = ELF_R_INFO (output_bfd, (unsigned long) indx, - R_MIPS_REL32); - /* For strict adherence to the ABI specification, we should - generate a R_MIPS_64 relocation record by itself before the - _REL32/_64 record as well, such that the addend is read in as - a 64-bit value (REL32 is a 32-bit relocation, after all). - However, since none of the existing ELF64 MIPS dynamic - loaders seems to care, we don't waste space with these - artificial relocations. If this turns out to not be true, - mips_elf_allocate_dynamic_relocation() should be tweaked so - as to make room for a pair of dynamic relocations per - invocation if ABI_64_P, and here we should generate an - additional relocation record with R_MIPS_64 by itself for a - NULL symbol before this relocation record. */ - outrel[1].r_info = ELF_R_INFO (output_bfd, 0, - ABI_64_P (output_bfd) - ? R_MIPS_64 - : R_MIPS_NONE); - outrel[2].r_info = ELF_R_INFO (output_bfd, 0, R_MIPS_NONE); - - /* Adjust the output offset of the relocation to reference the - correct location in the output file. */ - outrel[0].r_offset += (input_section->output_section->vma - + input_section->output_offset); - outrel[1].r_offset += (input_section->output_section->vma - + input_section->output_offset); - outrel[2].r_offset += (input_section->output_section->vma - + input_section->output_offset); + /* Instead of generating a relocation using the section + symbol, we may as well make it a fully relative + relocation. We want to avoid generating relocations to + local symbols because we used to generate them + incorrectly, without adding the original symbol value, + which is mandated by the ABI for section symbols. In + order to give dynamic loaders and applications time to + phase out the incorrect use, we refrain from emitting + section-relative relocations. It's not like they're + useful, after all. This should be a bit more efficient + as well. */ + /* ??? Although this behavior is compatible with glibc's ld.so, + the ABI says that relocations against STN_UNDEF should have + a symbol value of 0. Irix rld honors this, so relocations + against STN_UNDEF have no effect. */ + if (!SGI_COMPAT (output_bfd)) + indx = 0; + defined_p = TRUE; } + /* If the relocation was previously an absolute relocation and + this symbol will not be referred to by the relocation, we must + adjust it by the value we give it in the dynamic symbol table. + Otherwise leave the job up to the dynamic linker. */ + if (defined_p && r_type != R_MIPS_REL32) + *addendp += symbol; + + if (htab->is_vxworks) + /* VxWorks uses non-relative relocations for this. */ + outrel[0].r_info = ELF32_R_INFO (indx, R_MIPS_32); + else + /* The relocation is always an REL32 relocation because we don't + know where the shared library will wind up at load-time. */ + outrel[0].r_info = ELF_R_INFO (output_bfd, (unsigned long) indx, + R_MIPS_REL32); + + /* For strict adherence to the ABI specification, we should + generate a R_MIPS_64 relocation record by itself before the + _REL32/_64 record as well, such that the addend is read in as + a 64-bit value (REL32 is a 32-bit relocation, after all). + However, since none of the existing ELF64 MIPS dynamic + loaders seems to care, we don't waste space with these + artificial relocations. If this turns out to not be true, + mips_elf_allocate_dynamic_relocation() should be tweaked so + as to make room for a pair of dynamic relocations per + invocation if ABI_64_P, and here we should generate an + additional relocation record with R_MIPS_64 by itself for a + NULL symbol before this relocation record. */ + outrel[1].r_info = ELF_R_INFO (output_bfd, 0, + ABI_64_P (output_bfd) + ? R_MIPS_64 + : R_MIPS_NONE); + outrel[2].r_info = ELF_R_INFO (output_bfd, 0, R_MIPS_NONE); + + /* Adjust the output offset of the relocation to reference the + correct location in the output file. */ + outrel[0].r_offset += (input_section->output_section->vma + + input_section->output_offset); + outrel[1].r_offset += (input_section->output_section->vma + + input_section->output_offset); + outrel[2].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. */ @@ -4011,6 +4868,15 @@ mips_elf_create_dynamic_relocation (bfd *output_bfd, (sreloc->contents + sreloc->reloc_count * sizeof (Elf64_Mips_External_Rel))); } + else if (htab->is_vxworks) + { + /* VxWorks uses RELA rather than REL dynamic relocations. */ + outrel[0].r_addend = *addendp; + bfd_elf32_swap_reloca_out + (output_bfd, &outrel[0], + (sreloc->contents + + sreloc->reloc_count * sizeof (Elf32_External_Rela))); + } else bfd_elf32_swap_reloc_out (output_bfd, &outrel[0], @@ -4025,7 +4891,7 @@ mips_elf_create_dynamic_relocation (bfd *output_bfd, |= SHF_WRITE; /* On IRIX5, make an entry of compact relocation info. */ - if (! skip && IRIX_COMPAT (output_bfd) == ict_irix5) + if (IRIX_COMPAT (output_bfd) == ict_irix5) { asection *scpt = bfd_get_section_by_name (dynobj, ".compact_rel"); bfd_byte *cr; @@ -4047,6 +4913,7 @@ mips_elf_create_dynamic_relocation (bfd *output_bfd, cr = (scpt->contents + sizeof (Elf32_External_compact_rel)); + mips_elf_set_cr_relvaddr (cptrel, 0); bfd_elf32_swap_crinfo_out (output_bfd, &cptrel, ((Elf32_External_crinfo *) cr + scpt->reloc_count)); @@ -4054,6 +4921,12 @@ mips_elf_create_dynamic_relocation (bfd *output_bfd, } } + /* If we've written this relocation for a readonly section, + we need to set DF_TEXTREL again, so that we do not delete the + DT_TEXTREL tag. */ + if (MIPS_ELF_READONLY_SECTION (input_section)) + info->flags |= DF_TEXTREL; + return TRUE; } @@ -4250,18 +5123,106 @@ _bfd_mips_elf_symbol_processing (bfd *abfd, asymbol *asym) asym->section = bfd_und_section_ptr; break; -#if 0 /* for SGI_COMPAT */ case SHN_MIPS_TEXT: - asym->section = mips_elf_text_section_ptr; + { + asection *section = bfd_get_section_by_name (abfd, ".text"); + + BFD_ASSERT (SGI_COMPAT (abfd)); + if (section != NULL) + { + asym->section = section; + /* MIPS_TEXT is a bit special, the address is not an offset + to the base of the .text section. So substract the section + base address to make it an offset. */ + asym->value -= section->vma; + } + } break; case SHN_MIPS_DATA: - asym->section = mips_elf_data_section_ptr; + { + asection *section = bfd_get_section_by_name (abfd, ".data"); + + BFD_ASSERT (SGI_COMPAT (abfd)); + if (section != NULL) + { + asym->section = section; + /* MIPS_DATA is a bit special, the address is not an offset + to the base of the .data section. So substract the section + base address to make it an offset. */ + asym->value -= section->vma; + } + } break; -#endif } } +/* Implement elf_backend_eh_frame_address_size. This differs from + the default in the way it handles EABI64. + + EABI64 was originally specified as an LP64 ABI, and that is what + -mabi=eabi normally gives on a 64-bit target. However, gcc has + historically accepted the combination of -mabi=eabi and -mlong32, + and this ILP32 variation has become semi-official over time. + Both forms use elf32 and have pointer-sized FDE addresses. + + If an EABI object was generated by GCC 4.0 or above, it will have + an empty .gcc_compiled_longXX section, where XX is the size of longs + in bits. Unfortunately, ILP32 objects generated by earlier compilers + have no special marking to distinguish them from LP64 objects. + + We don't want users of the official LP64 ABI to be punished for the + existence of the ILP32 variant, but at the same time, we don't want + to mistakenly interpret pre-4.0 ILP32 objects as being LP64 objects. + We therefore take the following approach: + + - If ABFD contains a .gcc_compiled_longXX section, use it to + determine the pointer size. + + - Otherwise check the type of the first relocation. Assume that + the LP64 ABI is being used if the relocation is of type R_MIPS_64. + + - Otherwise punt. + + The second check is enough to detect LP64 objects generated by pre-4.0 + compilers because, in the kind of output generated by those compilers, + the first relocation will be associated with either a CIE personality + routine or an FDE start address. Furthermore, the compilers never + used a special (non-pointer) encoding for this ABI. + + Checking the relocation type should also be safe because there is no + reason to use R_MIPS_64 in an ILP32 object. Pre-4.0 compilers never + did so. */ + +unsigned int +_bfd_mips_elf_eh_frame_address_size (bfd *abfd, asection *sec) +{ + if (elf_elfheader (abfd)->e_ident[EI_CLASS] == ELFCLASS64) + return 8; + if ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI) == E_MIPS_ABI_EABI64) + { + bfd_boolean long32_p, long64_p; + + long32_p = bfd_get_section_by_name (abfd, ".gcc_compiled_long32") != 0; + long64_p = bfd_get_section_by_name (abfd, ".gcc_compiled_long64") != 0; + if (long32_p && long64_p) + return 0; + if (long32_p) + return 4; + if (long64_p) + return 8; + + if (sec->reloc_count > 0 + && elf_section_data (sec)->relocs != NULL + && (ELF32_R_TYPE (elf_section_data (sec)->relocs[0].r_info) + == R_MIPS_64)) + return 8; + + return 0; + } + return 4; +} + /* There appears to be a bug in the MIPSpro linker that causes GOT_DISP relocations against two unnamed section symbols to resolve to the same address. For example, if we have code like: @@ -4330,6 +5291,13 @@ _bfd_mips_elf_section_processing (bfd *abfd, Elf_Internal_Shdr *hdr) bfd_mips_elf_swap_options_in (abfd, (Elf_External_Options *) l, &intopt); + if (intopt.size < sizeof (Elf_External_Options)) + { + (*_bfd_error_handler) + (_("%B: Warning: bad `%s' option size %u smaller than its header"), + abfd, MIPS_ELF_OPTIONS_SECTION_NAME (abfd), intopt.size); + break; + } if (ABI_64_P (abfd) && intopt.kind == ODK_REGINFO) { bfd_byte buf[8]; @@ -4414,8 +5382,10 @@ _bfd_mips_elf_section_processing (bfd *abfd, Elf_Internal_Shdr *hdr) how to. */ bfd_boolean -_bfd_mips_elf_section_from_shdr (bfd *abfd, Elf_Internal_Shdr *hdr, - const char *name) +_bfd_mips_elf_section_from_shdr (bfd *abfd, + Elf_Internal_Shdr *hdr, + const char *name, + int shindex) { flagword flags = 0; @@ -4466,7 +5436,7 @@ _bfd_mips_elf_section_from_shdr (bfd *abfd, Elf_Internal_Shdr *hdr, return FALSE; break; case SHT_MIPS_OPTIONS: - if (strcmp (name, MIPS_ELF_OPTIONS_SECTION_NAME (abfd)) != 0) + if (!MIPS_ELF_OPTIONS_SECTION_NAME_P (name)) return FALSE; break; case SHT_MIPS_DWARF: @@ -4484,10 +5454,10 @@ _bfd_mips_elf_section_from_shdr (bfd *abfd, Elf_Internal_Shdr *hdr, return FALSE; break; default: - return FALSE; + break; } - if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name)) + if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex)) return FALSE; if (flags) @@ -4542,6 +5512,13 @@ _bfd_mips_elf_section_from_shdr (bfd *abfd, Elf_Internal_Shdr *hdr, bfd_mips_elf_swap_options_in (abfd, (Elf_External_Options *) l, &intopt); + if (intopt.size < sizeof (Elf_External_Options)) + { + (*_bfd_error_handler) + (_("%B: Warning: bad `%s' option size %u smaller than its header"), + abfd, MIPS_ELF_OPTIONS_SECTION_NAME (abfd), intopt.size); + break; + } if (ABI_64_P (abfd) && intopt.kind == ODK_REGINFO) { Elf64_Internal_RegInfo intreg; @@ -4580,13 +5557,15 @@ bfd_boolean _bfd_mips_elf_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec) { register const char *name; + unsigned int sh_type; name = bfd_get_section_name (abfd, sec); + sh_type = hdr->sh_type; if (strcmp (name, ".liblist") == 0) { hdr->sh_type = SHT_MIPS_LIBLIST; - hdr->sh_info = sec->_raw_size / sizeof (Elf32_Lib); + hdr->sh_info = sec->size / sizeof (Elf32_Lib); /* The sh_link field is set in final_write_processing. */ } else if (strcmp (name, ".conflict") == 0) @@ -4654,7 +5633,7 @@ _bfd_mips_elf_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec) 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) + else if (MIPS_ELF_OPTIONS_SECTION_NAME_P (name)) { hdr->sh_type = SHT_MIPS_OPTIONS; hdr->sh_entsize = 1; @@ -4683,6 +5662,12 @@ _bfd_mips_elf_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec) hdr->sh_entsize = 8; } + /* In the unlikely event a special section is empty it has to lose its + special meaning. This may happen e.g. when using `strip' with the + "--only-keep-debug" option. */ + if (sec->size > 0 && !(sec->flags & SEC_HAS_CONTENTS)) + hdr->sh_type = sh_type; + /* The generic elf_fake_sections will set up REL_HDR using the default kind of relocations. We used to set up a second header for the non-default kind of relocations here, but only NewABI would use @@ -4733,6 +5718,20 @@ _bfd_mips_elf_add_symbol_hook (bfd *abfd, struct bfd_link_info *info, return TRUE; } + /* Shared objects may have a dynamic symbol '_gp_disp' defined as + a SECTION *ABS*. This causes ld to think it can resolve _gp_disp + by setting a DT_NEEDED for the shared object. Since _gp_disp is + a magic symbol resolved by the linker, we ignore this bogus definition + of _gp_disp. New ABI objects do not suffer from this problem so this + is not done for them. */ + if (!NEWABI_P(abfd) + && (sym->st_shndx == SHN_ABS) + && (strcmp (*namep, "_gp_disp") == 0)) + { + *namep = NULL; + return TRUE; + } + switch (sym->st_shndx) { case SHN_COMMON: @@ -4849,8 +5848,8 @@ _bfd_mips_elf_add_symbol_hook (bfd *abfd, struct bfd_link_info *info, return FALSE; h = (struct elf_link_hash_entry *) bh; - h->elf_link_hash_flags &= ~ELF_LINK_NON_ELF; - h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; + h->non_elf = 0; + h->def_regular = 1; h->type = STT_OBJECT; if (! bfd_elf_link_record_dynamic_symbol (info, h)) @@ -4885,9 +5884,8 @@ _bfd_mips_elf_link_output_symbol_hook && 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; + if (sym->st_other == STO_MIPS16) + sym->st_value &= ~1; return TRUE; } @@ -4904,32 +5902,39 @@ _bfd_mips_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) flagword flags; register asection *s; const char * const *namep; + struct mips_elf_link_hash_table *htab; + htab = mips_elf_hash_table (info); 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) + /* The psABI requires a read-only .dynamic section, but the VxWorks + EABI doesn't. */ + if (!htab->is_vxworks) { - if (! bfd_set_section_flags (abfd, s, flags)) - return FALSE; + 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, FALSE)) return FALSE; - if (! mips_elf_rel_dyn_section (elf_hash_table (info)->dynobj, TRUE)) + if (! mips_elf_rel_dyn_section (info, TRUE)) 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)); + s = bfd_make_section_with_flags (abfd, + MIPS_ELF_STUB_SECTION_NAME (abfd), + flags | SEC_CODE); 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; @@ -4939,9 +5944,9 @@ _bfd_mips_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) && !info->shared && bfd_get_section_by_name (abfd, ".rld_map") == NULL) { - s = bfd_make_section (abfd, ".rld_map"); + s = bfd_make_section_with_flags (abfd, ".rld_map", + flags &~ (flagword) SEC_READONLY); if (s == NULL - || ! bfd_set_section_flags (abfd, s, flags &~ (flagword) SEC_READONLY) || ! bfd_set_section_alignment (abfd, s, MIPS_ELF_LOG_FILE_ALIGN (abfd))) return FALSE; @@ -4962,8 +5967,8 @@ _bfd_mips_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) return FALSE; h = (struct elf_link_hash_entry *) bh; - h->elf_link_hash_flags &= ~ELF_LINK_NON_ELF; - h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; + h->non_elf = 0; + h->def_regular = 1; h->type = STT_SECTION; if (! bfd_elf_link_record_dynamic_symbol (info, h)) @@ -5007,8 +6012,8 @@ _bfd_mips_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) return FALSE; h = (struct elf_link_hash_entry *) bh; - h->elf_link_hash_flags &= ~ELF_LINK_NON_ELF; - h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; + h->non_elf = 0; + h->def_regular = 1; h->type = STT_SECTION; if (! bfd_elf_link_record_dynamic_symbol (info, h)) @@ -5031,8 +6036,8 @@ _bfd_mips_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) return FALSE; h = (struct elf_link_hash_entry *) bh; - h->elf_link_hash_flags &= ~ELF_LINK_NON_ELF; - h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; + h->non_elf = 0; + h->def_regular = 1; h->type = STT_OBJECT; if (! bfd_elf_link_record_dynamic_symbol (info, h)) @@ -5040,6 +6045,45 @@ _bfd_mips_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) } } + if (htab->is_vxworks) + { + /* Create the .plt, .rela.plt, .dynbss and .rela.bss sections. + Also create the _PROCEDURE_LINKAGE_TABLE symbol. */ + if (!_bfd_elf_create_dynamic_sections (abfd, info)) + return FALSE; + + /* Cache the sections created above. */ + htab->sdynbss = bfd_get_section_by_name (abfd, ".dynbss"); + htab->srelbss = bfd_get_section_by_name (abfd, ".rela.bss"); + htab->srelplt = bfd_get_section_by_name (abfd, ".rela.plt"); + htab->splt = bfd_get_section_by_name (abfd, ".plt"); + if (!htab->sdynbss + || (!htab->srelbss && !info->shared) + || !htab->srelplt + || !htab->splt) + abort (); + + /* Do the usual VxWorks handling. */ + if (!elf_vxworks_create_dynamic_sections (abfd, info, &htab->srelplt2)) + return FALSE; + + /* Work out the PLT sizes. */ + if (info->shared) + { + htab->plt_header_size + = 4 * ARRAY_SIZE (mips_vxworks_shared_plt0_entry); + htab->plt_entry_size + = 4 * ARRAY_SIZE (mips_vxworks_shared_plt_entry); + } + else + { + htab->plt_header_size + = 4 * ARRAY_SIZE (mips_vxworks_exec_plt0_entry); + htab->plt_entry_size + = 4 * ARRAY_SIZE (mips_vxworks_exec_plt_entry); + } + } + return TRUE; } @@ -5061,10 +6105,12 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sgot; asection *sreloc; const struct elf_backend_data *bed; + struct mips_elf_link_hash_table *htab; if (info->relocatable) return TRUE; + htab = mips_elf_hash_table (info); dynobj = elf_hash_table (info)->dynobj; symtab_hdr = &elf_tdata (abfd)->symtab_hdr; sym_hashes = elf_sym_hashes (abfd); @@ -5169,6 +6215,10 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, h = ((struct mips_elf_link_hash_entry *) sym_hashes[r_symndx - extsymoff]); + while (h->root.root.type == bfd_link_hash_indirect + || h->root.root.type == bfd_link_hash_warning) + h = (struct mips_elf_link_hash_entry *) h->root.root.u.i.link; + /* H is the symbol this stub is for. */ h->fn_stub = sec; @@ -5263,8 +6313,8 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, else if (r_symndx >= extsymoff + NUM_SHDR_ENTRIES (symtab_hdr)) { (*_bfd_error_handler) - (_("%s: Malformed reloc detected for section %s"), - bfd_archive_filename (abfd), name); + (_("%B: Malformed reloc detected for section %s"), + abfd, name); bfd_set_error (bfd_error_bad_value); return FALSE; } @@ -5294,18 +6344,32 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, case R_MIPS_GOT_PAGE: case R_MIPS_GOT_OFST: case R_MIPS_GOT_DISP: + case R_MIPS_TLS_GOTTPREL: + case R_MIPS_TLS_GD: + case R_MIPS_TLS_LDM: if (dynobj == NULL) elf_hash_table (info)->dynobj = dynobj = abfd; if (! mips_elf_create_got_section (dynobj, info, FALSE)) return FALSE; g = mips_elf_got_info (dynobj, &sgot); + if (htab->is_vxworks && !info->shared) + { + (*_bfd_error_handler) + (_("%B: GOT reloc at 0x%lx not expected in executables"), + abfd, (unsigned long) rel->r_offset); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } break; case R_MIPS_32: case R_MIPS_REL32: case R_MIPS_64: + /* In VxWorks executables, references to external symbols + are handled using copy relocs or PLT stubs, so there's + no need to add a dynamic relocation here. */ if (dynobj == NULL - && (info->shared || h != NULL) + && (info->shared || (h != NULL && !htab->is_vxworks)) && (sec->flags & SEC_ALLOC) != 0) elf_hash_table (info)->dynobj = dynobj = abfd; break; @@ -5315,19 +6379,39 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, } } - if (!h && (r_type == R_MIPS_CALL_LO16 - || r_type == R_MIPS_GOT_LO16 - || r_type == R_MIPS_GOT_DISP)) + if (h) + { + ((struct mips_elf_link_hash_entry *) h)->is_relocation_target = TRUE; + + /* Relocations against the special VxWorks __GOTT_BASE__ and + __GOTT_INDEX__ symbols must be left to the loader. Allocate + room for them in .rela.dyn. */ + if (is_gott_symbol (info, h)) + { + if (sreloc == NULL) + { + sreloc = mips_elf_rel_dyn_section (info, TRUE); + if (sreloc == NULL) + return FALSE; + } + mips_elf_allocate_dynamic_relocations (dynobj, info, 1); + } + } + else if (r_type == R_MIPS_CALL_LO16 + || r_type == R_MIPS_GOT_LO16 + || r_type == R_MIPS_GOT_DISP + || (r_type == R_MIPS_GOT16 && htab->is_vxworks)) { /* 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 and - R_MIPS_CALL16. We don't count R_MIPS_GOT_HI16, or + R_MIPS_CALL16, except on VxWorks, where GOT relocations + always evaluate to "G". 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. */ if (! mips_elf_record_local_got_symbol (abfd, r_symndx, - rel->r_addend, g)) + rel->r_addend, g, 0)) return FALSE; } @@ -5337,8 +6421,8 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, if (h == NULL) { (*_bfd_error_handler) - (_("%s: CALL16 reloc at 0x%lx not against global symbol"), - bfd_archive_filename (abfd), (unsigned long) rel->r_offset); + (_("%B: CALL16 reloc at 0x%lx not against global symbol"), + abfd, (unsigned long) rel->r_offset); bfd_set_error (bfd_error_bad_value); return FALSE; } @@ -5348,14 +6432,17 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, case R_MIPS_CALL_LO16: if (h != NULL) { - /* This symbol requires a global offset table entry. */ - if (! mips_elf_record_global_got_symbol (h, abfd, info, g)) + /* VxWorks call relocations point the function's .got.plt + entry, which will be allocated by adjust_dynamic_symbol. + Otherwise, this symbol requires a global GOT entry. */ + if (!htab->is_vxworks + && !mips_elf_record_global_got_symbol (h, abfd, info, g, 0)) return FALSE; /* We need a stub, not a plt entry for the undefined function. But we record it as if it needs plt. See _bfd_elf_adjust_dynamic_symbol. */ - h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; + h->needs_plt = 1; h->type = STT_FUNC; } break; @@ -5375,10 +6462,9 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, hmips = (struct mips_elf_link_hash_entry *) hmips->root.root.u.i.link; - if ((hmips->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) + if (hmips->root.def_regular && ! (info->shared && ! info->symbolic - && ! (hmips->root.elf_link_hash_flags - & ELF_LINK_FORCED_LOCAL))) + && ! hmips->root.forced_local)) break; } /* Fall through. */ @@ -5387,33 +6473,74 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, 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, abfd, info, g)) + if (h && ! mips_elf_record_global_got_symbol (h, abfd, info, g, 0)) return FALSE; break; + case R_MIPS_TLS_GOTTPREL: + if (info->shared) + info->flags |= DF_STATIC_TLS; + /* Fall through */ + + case R_MIPS_TLS_LDM: + if (r_type == R_MIPS_TLS_LDM) + { + r_symndx = 0; + h = NULL; + } + /* Fall through */ + + case R_MIPS_TLS_GD: + /* This symbol requires a global offset table entry, or two + for TLS GD relocations. */ + { + unsigned char flag = (r_type == R_MIPS_TLS_GD + ? GOT_TLS_GD + : r_type == R_MIPS_TLS_LDM + ? GOT_TLS_LDM + : GOT_TLS_IE); + if (h != NULL) + { + struct mips_elf_link_hash_entry *hmips = + (struct mips_elf_link_hash_entry *) h; + hmips->tls_type |= flag; + + if (h && ! mips_elf_record_global_got_symbol (h, abfd, info, g, flag)) + return FALSE; + } + else + { + BFD_ASSERT (flag == GOT_TLS_LDM || r_symndx != 0); + + if (! mips_elf_record_local_got_symbol (abfd, r_symndx, + rel->r_addend, g, flag)) + return FALSE; + } + } + break; + case R_MIPS_32: case R_MIPS_REL32: case R_MIPS_64: - if ((info->shared || h != NULL) + /* In VxWorks executables, references to external symbols + are handled using copy relocs or PLT stubs, so there's + no need to add a .rela.dyn entry for this relocation. */ + if ((info->shared || (h != NULL && !htab->is_vxworks)) && (sec->flags & SEC_ALLOC) != 0) { if (sreloc == NULL) { - sreloc = mips_elf_rel_dyn_section (dynobj, TRUE); + sreloc = mips_elf_rel_dyn_section (info, TRUE); if (sreloc == NULL) return FALSE; } -#define MIPS_READONLY_SECTION (SEC_ALLOC | SEC_LOAD | SEC_READONLY) 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); - if ((sec->flags & MIPS_READONLY_SECTION) - == MIPS_READONLY_SECTION) + relocs. Make room for this reloc in .rel(a).dyn. */ + mips_elf_allocate_dynamic_relocations (dynobj, info, 1); + if (MIPS_ELF_READONLY_SECTION (sec)) /* We tell the dynamic linker that there are relocations against the text segment. */ info->flags |= DF_TEXTREL; @@ -5426,8 +6553,7 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, defined in a dynamic object. */ hmips = (struct mips_elf_link_hash_entry *) h; ++hmips->possibly_dynamic_relocs; - if ((sec->flags & MIPS_READONLY_SECTION) - == MIPS_READONLY_SECTION) + if (MIPS_ELF_READONLY_SECTION (sec)) /* We need it to tell the dynamic linker if there are relocations against the text segment. */ hmips->readonly_reloc = TRUE; @@ -5436,15 +6562,17 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, /* 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) + dynamic relocations against it. This does not apply + to VxWorks, which does not have the usual coupling + between global GOT entries and .dynsym entries. */ + if (h != NULL && !htab->is_vxworks) { if (dynobj == NULL) elf_hash_table (info)->dynobj = dynobj = abfd; if (! mips_elf_create_got_section (dynobj, info, TRUE)) return FALSE; g = mips_elf_got_info (dynobj, &sgot); - if (! mips_elf_record_global_got_symbol (h, abfd, info, g)) + if (! mips_elf_record_global_got_symbol (h, abfd, info, g, 0)) return FALSE; } } @@ -5454,7 +6582,16 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, sizeof (Elf32_External_crinfo); break; + case R_MIPS_PC16: + if (h) + ((struct mips_elf_link_hash_entry *) h)->is_branch_target = TRUE; + break; + case R_MIPS_26: + if (h) + ((struct mips_elf_link_hash_entry *) h)->is_branch_target = TRUE; + /* Fall through. */ + case R_MIPS_GPREL16: case R_MIPS_LITERAL: case R_MIPS_GPREL32: @@ -5482,24 +6619,21 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, } /* We must not create a stub for a symbol that has relocations - related to taking the function's address. */ - switch (r_type) - { - default: - if (h != NULL) - { - struct mips_elf_link_hash_entry *mh; - - mh = (struct mips_elf_link_hash_entry *) h; - mh->no_fn_stub = TRUE; - } - break; - case R_MIPS_CALL16: - case R_MIPS_CALL_HI16: - case R_MIPS_CALL_LO16: - case R_MIPS_JALR: - break; - } + related to taking the function's address. This doesn't apply to + VxWorks, where CALL relocs refer to a .got.plt entry instead of + a normal .got entry. */ + if (!htab->is_vxworks && h != NULL) + switch (r_type) + { + default: + ((struct mips_elf_link_hash_entry *) h)->no_fn_stub = TRUE; + break; + case R_MIPS_CALL16: + case R_MIPS_CALL_HI16: + case R_MIPS_CALL_LO16: + case R_MIPS_JALR: + 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. @@ -5532,7 +6666,6 @@ _bfd_mips_relax_section (bfd *abfd, asection *sec, Elf_Internal_Rela *irel, *irelend; Elf_Internal_Shdr *symtab_hdr; bfd_byte *contents = NULL; - bfd_byte *free_contents = NULL; size_t extsymoff; bfd_boolean changed_contents = FALSE; bfd_vma sec_start = sec->output_section->vma + sec->output_offset; @@ -5588,7 +6721,7 @@ _bfd_mips_relax_section (bfd *abfd, asection *sec, || h->root.root.type == bfd_link_hash_defweak) && h->root.root.u.def.section) || (link_info->shared && ! link_info->symbolic - && ! (h->root.elf_link_hash_flags & ELF_LINK_FORCED_LOCAL))) + && !h->root.forced_local)) continue; sym_sec = h->root.root.u.def.section; @@ -5653,13 +6786,7 @@ _bfd_mips_relax_section (bfd *abfd, asection *sec, contents = elf_section_data (sec)->this_hdr.contents; else { - contents = bfd_malloc (sec->_raw_size); - if (contents == NULL) - goto relax_return; - - free_contents = contents; - if (! bfd_get_section_contents (abfd, sec, contents, - 0, sec->_raw_size)) + if (!bfd_malloc_and_get_section (abfd, sec, &contents)) goto relax_return; } } @@ -5694,8 +6821,9 @@ _bfd_mips_relax_section (bfd *abfd, asection *sec, return TRUE; relax_return: - if (free_contents != NULL) - free (free_contents); + if (contents != NULL + && elf_section_data (sec)->this_hdr.contents != contents) + free (contents); return FALSE; } @@ -5712,19 +6840,18 @@ _bfd_mips_elf_adjust_dynamic_symbol (struct bfd_link_info *info, bfd *dynobj; struct mips_elf_link_hash_entry *hmips; asection *s; + struct mips_elf_link_hash_table *htab; + htab = mips_elf_hash_table (info); 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))); + && (h->needs_plt + || h->u.weakdef != NULL + || (h->def_dynamic + && h->ref_regular + && !h->def_regular))); /* 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 @@ -5733,11 +6860,10 @@ _bfd_mips_elf_adjust_dynamic_symbol (struct bfd_link_info *info, if (! info->relocatable && hmips->possibly_dynamic_relocs != 0 && (h->root.type == bfd_link_hash_defweak - || (h->elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0)) + || !h->def_regular)) { - mips_elf_allocate_dynamic_relocations (dynobj, - hmips->possibly_dynamic_relocs); + mips_elf_allocate_dynamic_relocations + (dynobj, info, hmips->possibly_dynamic_relocs); if (hmips->readonly_reloc) /* We tell the dynamic linker that there are relocations against the text segment. */ @@ -5746,7 +6872,7 @@ _bfd_mips_elf_adjust_dynamic_symbol (struct bfd_link_info *info, /* For a function, create a stub, if allowed. */ if (! hmips->no_fn_stub - && (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0) + && h->needs_plt) { if (! elf_hash_table (info)->dynamic_sections_created) return TRUE; @@ -5755,7 +6881,7 @@ _bfd_mips_elf_adjust_dynamic_symbol (struct bfd_link_info *info, 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) + if (!h->def_regular) { /* We need .stub section. */ s = bfd_get_section_by_name (dynobj, @@ -5763,13 +6889,13 @@ _bfd_mips_elf_adjust_dynamic_symbol (struct bfd_link_info *info, BFD_ASSERT (s != NULL); h->root.u.def.section = s; - h->root.u.def.value = s->_raw_size; + h->root.u.def.value = s->size; /* XXX Write this stub address somewhere. */ - h->plt.offset = s->_raw_size; + h->plt.offset = s->size; /* Make room for this stub code. */ - s->_raw_size += MIPS_FUNCTION_STUB_SIZE; + s->size += htab->function_stub_size; /* The last half word of the stub will be filled with the index of this symbol in .dynsym section. */ @@ -5777,7 +6903,7 @@ _bfd_mips_elf_adjust_dynamic_symbol (struct bfd_link_info *info, } } else if ((h->type == STT_FUNC) - && (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) == 0) + && !h->needs_plt) { /* This will set the entry for this symbol in the GOT to 0, and the dynamic linker will take care of this. */ @@ -5788,12 +6914,12 @@ _bfd_mips_elf_adjust_dynamic_symbol (struct bfd_link_info *info, /* 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) + if (h->u.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; + BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined + || h->u.weakdef->root.type == bfd_link_hash_defweak); + h->root.u.def.section = h->u.weakdef->root.u.def.section; + h->root.u.def.value = h->u.weakdef->root.u.def.value; return TRUE; } @@ -5802,7 +6928,187 @@ _bfd_mips_elf_adjust_dynamic_symbol (struct bfd_link_info *info, return TRUE; } + +/* Likewise, for VxWorks. */ + +bfd_boolean +_bfd_mips_vxworks_adjust_dynamic_symbol (struct bfd_link_info *info, + struct elf_link_hash_entry *h) +{ + bfd *dynobj; + struct mips_elf_link_hash_entry *hmips; + struct mips_elf_link_hash_table *htab; + unsigned int power_of_two; + + htab = mips_elf_hash_table (info); + dynobj = elf_hash_table (info)->dynobj; + hmips = (struct mips_elf_link_hash_entry *) h; + + /* Make sure we know what is going on here. */ + BFD_ASSERT (dynobj != NULL + && (h->needs_plt + || h->needs_copy + || h->u.weakdef != NULL + || (h->def_dynamic + && h->ref_regular + && !h->def_regular))); + + /* If the symbol is defined by a dynamic object, we need a PLT stub if + either (a) we want to branch to the symbol or (b) we're linking an + executable that needs a canonical function address. In the latter + case, the canonical address will be the address of the executable's + load stub. */ + if ((hmips->is_branch_target + || (!info->shared + && h->type == STT_FUNC + && hmips->is_relocation_target)) + && h->def_dynamic + && h->ref_regular + && !h->def_regular + && !h->forced_local) + h->needs_plt = 1; + + /* Locally-binding symbols do not need a PLT stub; we can refer to + the functions directly. */ + else if (h->needs_plt + && (SYMBOL_CALLS_LOCAL (info, h) + || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT + && h->root.type == bfd_link_hash_undefweak))) + { + h->needs_plt = 0; + return TRUE; + } + + if (h->needs_plt) + { + /* If this is the first symbol to need a PLT entry, allocate room + for the header, and for the header's .rela.plt.unloaded entries. */ + if (htab->splt->size == 0) + { + htab->splt->size += htab->plt_header_size; + if (!info->shared) + htab->srelplt2->size += 2 * sizeof (Elf32_External_Rela); + } + + /* Assign the next .plt entry to this symbol. */ + h->plt.offset = htab->splt->size; + htab->splt->size += htab->plt_entry_size; + + /* If the output file has no definition of the symbol, set the + symbol's value to the address of the stub. For executables, + point at the PLT load stub rather than the lazy resolution stub; + this stub will become the canonical function address. */ + if (!h->def_regular) + { + h->root.u.def.section = htab->splt; + h->root.u.def.value = h->plt.offset; + if (!info->shared) + h->root.u.def.value += 8; + } + + /* Make room for the .got.plt entry and the R_JUMP_SLOT relocation. */ + htab->sgotplt->size += 4; + htab->srelplt->size += sizeof (Elf32_External_Rela); + + /* Make room for the .rela.plt.unloaded relocations. */ + if (!info->shared) + htab->srelplt2->size += 3 * sizeof (Elf32_External_Rela); + + return TRUE; + } + + /* If a function symbol is defined by a dynamic object, and we do not + need a PLT stub for it, the symbol's value should be zero. */ + if (h->type == STT_FUNC + && h->def_dynamic + && h->ref_regular + && !h->def_regular) + { + h->root.u.def.value = 0; + 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->u.weakdef != NULL) + { + BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined + || h->u.weakdef->root.type == bfd_link_hash_defweak); + h->root.u.def.section = h->u.weakdef->root.u.def.section; + h->root.u.def.value = h->u.weakdef->root.u.def.value; + return TRUE; + } + + /* This is a reference to a symbol defined by a dynamic object which + is not a function. */ + if (info->shared) + return TRUE; + + /* We must allocate the symbol in our .dynbss section, which will + become part of the .bss section of the executable. There will be + an entry for this symbol in the .dynsym section. The dynamic + object will contain position independent code, so all references + from the dynamic object to this symbol will go through the global + offset table. The dynamic linker will use the .dynsym entry to + determine the address it must put in the global offset table, so + both the dynamic object and the regular object will refer to the + same memory location for the variable. */ + + if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) + { + htab->srelbss->size += sizeof (Elf32_External_Rela); + h->needs_copy = 1; + } + + /* We need to figure out the alignment required for this symbol. */ + power_of_two = bfd_log2 (h->size); + if (power_of_two > 4) + power_of_two = 4; + + /* Apply the required alignment. */ + htab->sdynbss->size = BFD_ALIGN (htab->sdynbss->size, + (bfd_size_type) 1 << power_of_two); + if (power_of_two > bfd_get_section_alignment (dynobj, htab->sdynbss) + && !bfd_set_section_alignment (dynobj, htab->sdynbss, power_of_two)) + return FALSE; + + /* Define the symbol as being at this point in the section. */ + h->root.u.def.section = htab->sdynbss; + h->root.u.def.value = htab->sdynbss->size; + + /* Increment the section size to make room for the symbol. */ + htab->sdynbss->size += h->size; + + return TRUE; +} +/* Return the number of dynamic section symbols required by OUTPUT_BFD. + The number might be exact or a worst-case estimate, depending on how + much information is available to elf_backend_omit_section_dynsym at + the current linking stage. */ + +static bfd_size_type +count_section_dynsyms (bfd *output_bfd, struct bfd_link_info *info) +{ + bfd_size_type count; + + count = 0; + if (info->shared) + { + asection *p; + const struct elf_backend_data *bed; + + bed = get_elf_backend_data (output_bfd); + for (p = output_bfd->sections; p ; p = p->next) + if ((p->flags & SEC_EXCLUDE) == 0 + && (p->flags & SEC_ALLOC) != 0 + && !(*bed->elf_backend_omit_section_dynsym) (output_bfd, info, p)) + ++count; + } + return count; +} + /* 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. */ @@ -5819,7 +7125,12 @@ _bfd_mips_elf_always_size_sections (bfd *output_bfd, int i; bfd_size_type loadable_size = 0; bfd_size_type local_gotno; + bfd_size_type dynsymcount; bfd *sub; + struct mips_elf_count_tls_arg count_tls_arg; + struct mips_elf_link_hash_table *htab; + + htab = mips_elf_hash_table (info); /* The .reginfo section has a fixed size. */ ri = bfd_get_section_by_name (output_bfd, ".reginfo"); @@ -5853,7 +7164,7 @@ _bfd_mips_elf_always_size_sections (bfd *output_bfd, { if ((subsection->flags & SEC_ALLOC) == 0) continue; - loadable_size += ((subsection->_raw_size + 0xf) + loadable_size += ((subsection->size + 0xf) &~ (bfd_size_type) 0xf); } } @@ -5873,24 +7184,66 @@ _bfd_mips_elf_always_size_sections (bfd *output_bfd, relocations, then GLOBAL_GOTSYM will be NULL. */ i = 0; + /* Get a worst-case estimate of the number of dynamic symbols needed. + At this point, dynsymcount does not account for section symbols + and count_section_dynsyms may overestimate the number that will + be needed. */ + dynsymcount = (elf_hash_table (info)->dynsymcount + + count_section_dynsyms (output_bfd, info)); + + /* Determine the size of one stub entry. */ + htab->function_stub_size = (dynsymcount > 0x10000 + ? MIPS_FUNCTION_STUB_BIG_SIZE + : MIPS_FUNCTION_STUB_NORMAL_SIZE); + /* In the worst case, we'll get one stub per dynamic symbol, plus one to account for the dummy entry at the end required by IRIX rld. */ - loadable_size += MIPS_FUNCTION_STUB_SIZE * (i + 1); + loadable_size += htab->function_stub_size * (i + 1); - /* Assume there are two loadable segments consisting of - contiguous sections. Is 5 enough? */ - local_gotno = (loadable_size >> 16) + 5; + if (htab->is_vxworks) + /* There's no need to allocate page entries for VxWorks; R_MIPS_GOT16 + relocations against local symbols evaluate to "G", and the EABI does + not include R_MIPS_GOT_PAGE. */ + local_gotno = 0; + else + /* Assume there are two loadable segments consisting of contiguous + sections. Is 5 enough? */ + local_gotno = (loadable_size >> 16) + 5; g->local_gotno += local_gotno; - s->_raw_size += g->local_gotno * MIPS_ELF_GOT_SIZE (output_bfd); + s->size += g->local_gotno * MIPS_ELF_GOT_SIZE (output_bfd); g->global_gotno = i; - s->_raw_size += i * MIPS_ELF_GOT_SIZE (output_bfd); + s->size += i * MIPS_ELF_GOT_SIZE (output_bfd); - if (s->_raw_size > MIPS_ELF_GOT_MAX_SIZE (output_bfd) - && ! mips_elf_multi_got (output_bfd, info, g, s, local_gotno)) - return FALSE; + /* We need to calculate tls_gotno for global symbols at this point + instead of building it up earlier, to avoid doublecounting + entries for one global symbol from multiple input files. */ + count_tls_arg.info = info; + count_tls_arg.needed = 0; + elf_link_hash_traverse (elf_hash_table (info), + mips_elf_count_global_tls_entries, + &count_tls_arg); + g->tls_gotno += count_tls_arg.needed; + s->size += g->tls_gotno * MIPS_ELF_GOT_SIZE (output_bfd); + + mips_elf_resolve_final_got_entries (g); + + /* VxWorks does not support multiple GOTs. It initializes $gp to + __GOTT_BASE__[__GOTT_INDEX__], the value of which is set by the + dynamic loader. */ + if (!htab->is_vxworks && s->size > MIPS_ELF_GOT_MAX_SIZE (info)) + { + if (! mips_elf_multi_got (output_bfd, info, g, s, local_gotno)) + return FALSE; + } + else + { + /* Set up TLS entries for the first GOT. */ + g->tls_assigned_gotno = g->global_gotno + g->local_gotno; + htab_traverse (g->got_entries, mips_elf_initialize_tls_index, g); + } return TRUE; } @@ -5902,9 +7255,11 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) { bfd *dynobj; - asection *s; + asection *s, *sreldyn; bfd_boolean reltext; + struct mips_elf_link_hash_table *htab; + htab = mips_elf_hash_table (info); dynobj = elf_hash_table (info)->dynobj; BFD_ASSERT (dynobj != NULL); @@ -5915,7 +7270,7 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd, { s = bfd_get_section_by_name (dynobj, ".interp"); BFD_ASSERT (s != NULL); - s->_raw_size + s->size = strlen (ELF_DYNAMIC_INTERPRETER (output_bfd)) + 1; s->contents = (bfd_byte *) ELF_DYNAMIC_INTERPRETER (output_bfd); @@ -5926,10 +7281,10 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd, determined the sizes of the various dynamic sections. Allocate memory for them. */ reltext = FALSE; + sreldyn = NULL; for (s = dynobj->sections; s != NULL; s = s->next) { const char *name; - bfd_boolean strip; /* It's OK to base decisions on the section name, because none of the dynobj section names depend upon the input files. */ @@ -5938,31 +7293,16 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd, 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 + if (s->size != 0) { 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 + If the relocation section is .rel(a).dyn, we always assert a DT_TEXTREL entry rather than testing whether there exists a relocation to a read only section or not. */ @@ -5972,12 +7312,12 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd, if ((target != NULL && (target->flags & SEC_READONLY) != 0 && (target->flags & SEC_ALLOC) != 0) - || strcmp (outname, ".rel.dyn") == 0) + || strcmp (outname, MIPS_ELF_REL_DYN_NAME (info)) == 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, ".rel.dyn") != 0) + if (strcmp (name, MIPS_ELF_REL_DYN_NAME (info)) != 0) s->reloc_count = 0; /* If combreloc is enabled, elf_link_sort_relocs() will @@ -5989,7 +7329,23 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd, info->combreloc = 0; } } - else if (strncmp (name, ".got", 4) == 0) + else if (htab->is_vxworks && strcmp (name, ".got") == 0) + { + /* Executables do not need a GOT. */ + if (info->shared) + { + /* Allocate relocations for all but the reserved entries. */ + struct mips_got_info *g; + unsigned int count; + + g = mips_elf_got_info (dynobj, NULL); + count = (g->global_gotno + + g->local_gotno + - MIPS_RESERVED_GOTNO (info)); + mips_elf_allocate_dynamic_relocations (dynobj, info, count); + } + } + else if (!htab->is_vxworks && strncmp (name, ".got", 4) == 0) { /* _bfd_mips_elf_always_size_sections() has already done most of the work, but some symbols may have been mapped @@ -6005,6 +7361,9 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd, set_got_offset_arg.value = MIPS_ELF_GOT_SIZE (output_bfd); set_got_offset_arg.info = info; + /* NOTE 2005-02-03: How can this call, or the next, ever + find any indirect entries to resolve? They were all + resolved in mips_elf_multi_got. */ mips_elf_resolve_final_got_entries (gg); for (g = gg->next; g && g->next != gg; g = g->next) { @@ -6030,46 +7389,86 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd, needed_relocs += g->local_gotno - g->assigned_gotno; BFD_ASSERT (g->assigned_gotno == g->next->local_gotno + g->next->global_gotno - + MIPS_RESERVED_GOTNO); + + g->next->tls_gotno + + MIPS_RESERVED_GOTNO (info)); } } - - if (needed_relocs) - mips_elf_allocate_dynamic_relocations (dynobj, needed_relocs); } + else + { + struct mips_elf_count_tls_arg arg; + arg.info = info; + arg.needed = 0; + + htab_traverse (gg->got_entries, mips_elf_count_local_tls_relocs, + &arg); + elf_link_hash_traverse (elf_hash_table (info), + mips_elf_count_global_tls_relocs, + &arg); + + needed_relocs += arg.needed; + } + + if (needed_relocs) + mips_elf_allocate_dynamic_relocations (dynobj, info, + needed_relocs); } 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; + of .text section. So put a dummy. XXX */ + s->size += htab->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 + /* 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; + s->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 (strncmp (name, ".init", 5) != 0) + s->size += mips_elf_hash_table (info)->compact_rel_size; + else if (strncmp (name, ".init", 5) != 0 + && s != htab->sgotplt + && s != htab->splt) { /* It's not one of our sections, so don't allocate space. */ continue; } - if (strip) + if (s->size == 0) { - _bfd_strip_section_from_output (info, s); + s->flags |= SEC_EXCLUDE; + continue; + } + + if ((s->flags & SEC_HAS_CONTENTS) == 0) + continue; + + /* Allocate memory for this section last, since we may increase its + size above. */ + if (strcmp (name, MIPS_ELF_REL_DYN_NAME (info)) == 0) + { + sreldyn = s; continue; } /* Allocate memory for the section contents. */ - s->contents = bfd_zalloc (dynobj, s->_raw_size); - if (s->contents == NULL && s->_raw_size != 0) + s->contents = bfd_zalloc (dynobj, s->size); + if (s->contents == NULL) + { + bfd_set_error (bfd_error_no_memory); + return FALSE; + } + } + + /* Allocate memory for the .rel(a).dyn section. */ + if (sreldyn != NULL) + { + sreldyn->contents = bfd_zalloc (dynobj, sreldyn->size); + if (sreldyn->contents == NULL) { bfd_set_error (bfd_error_no_memory); return FALSE; @@ -6105,81 +7504,143 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd, } } - if (reltext && SGI_COMPAT (output_bfd)) + if (reltext && (SGI_COMPAT (output_bfd) || htab->is_vxworks)) info->flags |= DF_TEXTREL; if ((info->flags & DF_TEXTREL) != 0) { if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_TEXTREL, 0)) return FALSE; + + /* Clear the DF_TEXTREL flag. It will be set again if we + write out an actual text relocation; we may not, because + at this point we do not know whether e.g. any .eh_frame + absolute relocations have been converted to PC-relative. */ + info->flags &= ~DF_TEXTREL; } if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_PLTGOT, 0)) return FALSE; - if (mips_elf_rel_dyn_section (dynobj, FALSE)) + if (htab->is_vxworks) { - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_REL, 0)) + /* VxWorks uses .rela.dyn instead of .rel.dyn. It does not + use any of the DT_MIPS_* tags. */ + if (mips_elf_rel_dyn_section (info, FALSE)) + { + if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_RELA, 0)) + return FALSE; + + if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_RELASZ, 0)) + return FALSE; + + if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_RELAENT, 0)) + return FALSE; + } + if (htab->splt->size > 0) + { + if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_PLTREL, 0)) + return FALSE; + + if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_JMPREL, 0)) + return FALSE; + + if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_PLTRELSZ, 0)) + return FALSE; + } + } + else + { + if (mips_elf_rel_dyn_section (info, FALSE)) + { + 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_RLD_VERSION, 0)) return FALSE; - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_RELSZ, 0)) + if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_FLAGS, 0)) return FALSE; - if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_RELENT, 0)) + 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 (! 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; } return TRUE; } +/* REL is a relocation in INPUT_BFD that is being copied to OUTPUT_BFD. + Adjust its R_ADDEND field so that it is correct for the output file. + LOCAL_SYMS and LOCAL_SECTIONS are arrays of INPUT_BFD's local symbols + and sections respectively; both use symbol indexes. */ + +static void +mips_elf_adjust_addend (bfd *output_bfd, struct bfd_link_info *info, + bfd *input_bfd, Elf_Internal_Sym *local_syms, + asection **local_sections, Elf_Internal_Rela *rel) +{ + unsigned int r_type, r_symndx; + Elf_Internal_Sym *sym; + asection *sec; + + if (mips_elf_local_relocation_p (input_bfd, rel, local_sections, FALSE)) + { + r_type = ELF_R_TYPE (output_bfd, rel->r_info); + if (r_type == R_MIPS16_GPREL + || r_type == R_MIPS_GPREL16 + || r_type == R_MIPS_GPREL32 + || r_type == R_MIPS_LITERAL) + { + rel->r_addend += _bfd_get_gp_value (input_bfd); + rel->r_addend -= _bfd_get_gp_value (output_bfd); + } + + r_symndx = ELF_R_SYM (output_bfd, rel->r_info); + sym = local_syms + r_symndx; + + /* Adjust REL's addend to account for section merging. */ + if (!info->relocatable) + { + sec = local_sections[r_symndx]; + _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + } + + /* This would normally be done by the rela_normal code in elflink.c. */ + if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) + rel->r_addend += local_sections[r_symndx]->output_offset; + } +} + /* Relocate a MIPS ELF section. */ bfd_boolean @@ -6200,7 +7661,7 @@ _bfd_mips_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, for (rel = relocs; rel < relend; ++rel) { const char *name; - bfd_vma value; + bfd_vma value = 0; reloc_howto_type *howto; bfd_boolean require_jalx; /* TRUE if the relocation is a RELA relocation, rather than a @@ -6249,19 +7710,25 @@ _bfd_mips_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, rel_hdr = elf_section_data (input_section)->rel_hdr2; if (rel_hdr->sh_entsize == MIPS_ELF_REL_SIZE (input_bfd)) { + bfd_byte *location = contents + rel->r_offset; + /* Note that this is a REL relocation. */ rela_relocation_p = FALSE; /* Get the addend, which is stored in the input file. */ + _bfd_mips16_elf_reloc_unshuffle (input_bfd, r_type, FALSE, + location); addend = mips_elf_obtain_contents (howto, rel, input_bfd, contents); + _bfd_mips16_elf_reloc_shuffle(input_bfd, r_type, FALSE, + location); + 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 + if (r_type == R_MIPS_HI16 || r_type == R_MIPS16_HI16 || (r_type == R_MIPS_GOT16 && mips_elf_local_relocation_p (input_bfd, rel, local_sections, FALSE))) @@ -6269,7 +7736,13 @@ _bfd_mips_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, bfd_vma l; const Elf_Internal_Rela *lo16_relocation; reloc_howto_type *lo16_howto; - unsigned int lo; + bfd_byte *lo16_location; + int lo16_type; + + if (r_type == R_MIPS16_HI16) + lo16_type = R_MIPS16_LO16; + else + lo16_type = R_MIPS_LO16; /* The combined value is the sum of the HI16 addend, left-shifted by sixteen bits, and the LO16 @@ -6277,20 +7750,33 @@ _bfd_mips_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, 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 (input_bfd, lo, + Scan ahead to find a matching LO16 relocation. + + 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. */ + lo16_relocation = mips_elf_next_relocation (input_bfd, + lo16_type, rel, relend); if (lo16_relocation == NULL) return FALSE; + lo16_location = contents + lo16_relocation->r_offset; + /* Obtain the addend kept there. */ - lo16_howto = MIPS_ELF_RTYPE_TO_HOWTO (input_bfd, lo, FALSE); + lo16_howto = MIPS_ELF_RTYPE_TO_HOWTO (input_bfd, + lo16_type, FALSE); + _bfd_mips16_elf_reloc_unshuffle (input_bfd, lo16_type, FALSE, + lo16_location); l = mips_elf_obtain_contents (lo16_howto, lo16_relocation, input_bfd, contents); + _bfd_mips16_elf_reloc_shuffle (input_bfd, lo16_type, FALSE, + lo16_location); l &= lo16_howto->src_mask; l <<= lo16_howto->rightshift; l = _bfd_mips_elf_sign_extend (l, 16); @@ -6299,75 +7785,27 @@ _bfd_mips_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, /* Compute the combined addend. */ addend += l; - - /* If PC-relative, subtract the difference between the - address of the LO part of the reloc and the address of - the HI part. The relocation is relative to the LO - part, but mips_elf_calculate_relocation() doesn't - know its address or the difference from the HI part, so - we subtract that difference here. See also the - comment in mips_elf_calculate_relocation(). */ - if (r_type == R_MIPS_GNU_REL_HI16) - addend -= (lo16_relocation->r_offset - rel->r_offset); - } - 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 <<= howto->rightshift; } else addend = rel->r_addend; + mips_elf_adjust_addend (output_bfd, info, input_bfd, + local_syms, local_sections, rel); } if (info->relocatable) { - Elf_Internal_Sym *sym; - unsigned long r_symndx; - if (r_type == R_MIPS_64 && ! NEWABI_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 relocatable object. */ - - if (! mips_elf_local_relocation_p (input_bfd, rel, local_sections, - FALSE)) - /* 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)); - - r_symndx = ELF_R_SYM (output_bfd, 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 (rela_relocation_p) - /* If this is a RELA relocation, just update the addend. */ - rel->r_addend = addend; - else + if (!rela_relocation_p && rel->r_addend) { + addend += rel->r_addend; if (r_type == R_MIPS_HI16 - || r_type == R_MIPS_GOT16 - || r_type == R_MIPS_GNU_REL_HI16) + || r_type == R_MIPS_GOT16) addend = mips_elf_high (addend); else if (r_type == R_MIPS_HIGHER) addend = mips_elf_higher (addend); @@ -6476,7 +7914,7 @@ _bfd_mips_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, { BFD_ASSERT (name != NULL); if (! ((*info->callbacks->reloc_overflow) - (info, name, howto->name, 0, + (info, NULL, name, howto->name, (bfd_vma) 0, input_bfd, input_section, rel->r_offset))) return FALSE; } @@ -6613,18 +8051,19 @@ _bfd_mips_elf_finish_dynamic_symbol (bfd *output_bfd, Elf_Internal_Sym *sym) { bfd *dynobj; - bfd_vma gval; asection *sgot; struct mips_got_info *g, *gg; const char *name; + int idx; + struct mips_elf_link_hash_table *htab; + htab = mips_elf_hash_table (info); dynobj = elf_hash_table (info)->dynobj; - gval = sym->st_value; - if (h->plt.offset != (bfd_vma) -1) + if (h->plt.offset != MINUS_ONE) { asection *s; - bfd_byte stub[MIPS_FUNCTION_STUB_SIZE]; + bfd_byte stub[MIPS_FUNCTION_STUB_BIG_SIZE]; /* This symbol has a stub. Set it up. */ @@ -6634,18 +8073,42 @@ _bfd_mips_elf_finish_dynamic_symbol (bfd *output_bfd, MIPS_ELF_STUB_SECTION_NAME (dynobj)); BFD_ASSERT (s != NULL); - /* FIXME: Can h->dynindex be more than 64K? */ - if (h->dynindx & 0xffff0000) + BFD_ASSERT ((htab->function_stub_size == MIPS_FUNCTION_STUB_BIG_SIZE) + || (h->dynindx <= 0xffff)); + + /* Values up to 2^31 - 1 are allowed. Larger values would cause + sign extension at runtime in the stub, resulting in a negative + index value. */ + if (h->dynindx & ~0x7fffffff) return FALSE; /* Fill the stub. */ - bfd_put_32 (output_bfd, STUB_LW (output_bfd), stub); - bfd_put_32 (output_bfd, STUB_MOVE (output_bfd), stub + 4); - bfd_put_32 (output_bfd, STUB_JALR, stub + 8); - bfd_put_32 (output_bfd, STUB_LI16 (output_bfd) + h->dynindx, stub + 12); + idx = 0; + bfd_put_32 (output_bfd, STUB_LW (output_bfd), stub + idx); + idx += 4; + bfd_put_32 (output_bfd, STUB_MOVE (output_bfd), stub + idx); + idx += 4; + if (htab->function_stub_size == MIPS_FUNCTION_STUB_BIG_SIZE) + { + bfd_put_32 (output_bfd, STUB_LUI ((h->dynindx >> 16) & 0x7fff), + stub + idx); + idx += 4; + } + bfd_put_32 (output_bfd, STUB_JALR, stub + idx); + idx += 4; - BFD_ASSERT (h->plt.offset <= s->_raw_size); - memcpy (s->contents + h->plt.offset, stub, MIPS_FUNCTION_STUB_SIZE); + /* If a large stub is not required and sign extension is not a + problem, then use legacy code in the stub. */ + if (htab->function_stub_size == MIPS_FUNCTION_STUB_BIG_SIZE) + bfd_put_32 (output_bfd, STUB_ORI (h->dynindx & 0xffff), stub + idx); + else if (h->dynindx & ~0x7fff) + bfd_put_32 (output_bfd, STUB_LI16U (h->dynindx & 0xffff), stub + idx); + else + bfd_put_32 (output_bfd, STUB_LI16S (output_bfd, h->dynindx), + stub + idx); + + BFD_ASSERT (h->plt.offset <= s->size); + memcpy (s->contents + h->plt.offset, stub, htab->function_stub_size); /* Mark the symbol as undefined. plt.offset != -1 occurs only for the referenced symbol. */ @@ -6654,12 +8117,12 @@ _bfd_mips_elf_finish_dynamic_symbol (bfd *output_bfd, /* 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; + sym->st_value = (s->output_section->vma + s->output_offset + + h->plt.offset); } BFD_ASSERT (h->dynindx != -1 - || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0); + || h->forced_local); sgot = mips_elf_got_section (dynobj, FALSE); BFD_ASSERT (sgot != NULL); @@ -6676,11 +8139,11 @@ _bfd_mips_elf_finish_dynamic_symbol (bfd *output_bfd, bfd_vma value; value = sym->st_value; - offset = mips_elf_global_got_index (dynobj, output_bfd, h); + offset = mips_elf_global_got_index (dynobj, output_bfd, h, R_MIPS_GOT16, info); MIPS_ELF_PUT_WORD (output_bfd, value, sgot->contents + offset); } - if (g->next && h->dynindx != -1) + if (g->next && h->dynindx != -1 && h->type != STT_TLS) { struct mips_got_entry e, *p; bfd_vma entry; @@ -6691,6 +8154,7 @@ _bfd_mips_elf_finish_dynamic_symbol (bfd *output_bfd, e.abfd = output_bfd; e.symndx = -1; e.d.h = (struct mips_elf_link_hash_entry *)h; + e.tls_type = 0; for (g = g->next; g->next != gg; g = g->next) { @@ -6702,10 +8166,8 @@ _bfd_mips_elf_finish_dynamic_symbol (bfd *output_bfd, if (info->shared || (elf_hash_table (info)->dynamic_sections_created && p->d.h != NULL - && ((p->d.h->root.elf_link_hash_flags - & ELF_LINK_HASH_DEF_DYNAMIC) != 0) - && ((p->d.h->root.elf_link_hash_flags - & ELF_LINK_HASH_DEF_REGULAR) == 0))) + && p->d.h->root.def_dynamic + && !p->d.h->root.def_regular)) { /* Create an R_MIPS_REL32 relocation for this entry. Due to the various compatibility problems, it's easier to mock @@ -6737,7 +8199,7 @@ _bfd_mips_elf_finish_dynamic_symbol (bfd *output_bfd, /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */ name = h->root.root.string; if (strcmp (name, "_DYNAMIC") == 0 - || strcmp (name, "_GLOBAL_OFFSET_TABLE_") == 0) + || h == elf_hash_table (info)->hgot) sym->st_shndx = SHN_ABS; else if (strcmp (name, "_DYNAMIC_LINK") == 0 || strcmp (name, "_DYNAMIC_LINKING") == 0) @@ -6808,13 +8270,274 @@ _bfd_mips_elf_finish_dynamic_symbol (bfd *output_bfd, } /* 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; + if (sym->st_other == STO_MIPS16) + sym->st_value &= ~1; return TRUE; } +/* Likewise, for VxWorks. */ + +bfd_boolean +_bfd_mips_vxworks_finish_dynamic_symbol (bfd *output_bfd, + struct bfd_link_info *info, + struct elf_link_hash_entry *h, + Elf_Internal_Sym *sym) +{ + bfd *dynobj; + asection *sgot; + struct mips_got_info *g; + struct mips_elf_link_hash_table *htab; + + htab = mips_elf_hash_table (info); + dynobj = elf_hash_table (info)->dynobj; + + if (h->plt.offset != (bfd_vma) -1) + { + bfd_byte *loc; + bfd_vma plt_address, plt_index, got_address, got_offset, branch_offset; + Elf_Internal_Rela rel; + static const bfd_vma *plt_entry; + + BFD_ASSERT (h->dynindx != -1); + BFD_ASSERT (htab->splt != NULL); + BFD_ASSERT (h->plt.offset <= htab->splt->size); + + /* Calculate the address of the .plt entry. */ + plt_address = (htab->splt->output_section->vma + + htab->splt->output_offset + + h->plt.offset); + + /* Calculate the index of the entry. */ + plt_index = ((h->plt.offset - htab->plt_header_size) + / htab->plt_entry_size); + + /* Calculate the address of the .got.plt entry. */ + got_address = (htab->sgotplt->output_section->vma + + htab->sgotplt->output_offset + + plt_index * 4); + + /* Calculate the offset of the .got.plt entry from + _GLOBAL_OFFSET_TABLE_. */ + got_offset = mips_elf_gotplt_index (info, h); + + /* Calculate the offset for the branch at the start of the PLT + entry. The branch jumps to the beginning of .plt. */ + branch_offset = -(h->plt.offset / 4 + 1) & 0xffff; + + /* Fill in the initial value of the .got.plt entry. */ + bfd_put_32 (output_bfd, plt_address, + htab->sgotplt->contents + plt_index * 4); + + /* Find out where the .plt entry should go. */ + loc = htab->splt->contents + h->plt.offset; + + if (info->shared) + { + plt_entry = mips_vxworks_shared_plt_entry; + bfd_put_32 (output_bfd, plt_entry[0] | branch_offset, loc); + bfd_put_32 (output_bfd, plt_entry[1] | plt_index, loc + 4); + } + else + { + bfd_vma got_address_high, got_address_low; + + plt_entry = mips_vxworks_exec_plt_entry; + got_address_high = ((got_address + 0x8000) >> 16) & 0xffff; + got_address_low = got_address & 0xffff; + + bfd_put_32 (output_bfd, plt_entry[0] | branch_offset, loc); + bfd_put_32 (output_bfd, plt_entry[1] | plt_index, loc + 4); + bfd_put_32 (output_bfd, plt_entry[2] | got_address_high, loc + 8); + bfd_put_32 (output_bfd, plt_entry[3] | got_address_low, loc + 12); + bfd_put_32 (output_bfd, plt_entry[4], loc + 16); + bfd_put_32 (output_bfd, plt_entry[5], loc + 20); + bfd_put_32 (output_bfd, plt_entry[6], loc + 24); + bfd_put_32 (output_bfd, plt_entry[7], loc + 28); + + loc = (htab->srelplt2->contents + + (plt_index * 3 + 2) * sizeof (Elf32_External_Rela)); + + /* Emit a relocation for the .got.plt entry. */ + rel.r_offset = got_address; + rel.r_info = ELF32_R_INFO (htab->root.hplt->indx, R_MIPS_32); + rel.r_addend = h->plt.offset; + bfd_elf32_swap_reloca_out (output_bfd, &rel, loc); + + /* Emit a relocation for the lui of %hi(<.got.plt slot>). */ + loc += sizeof (Elf32_External_Rela); + rel.r_offset = plt_address + 8; + rel.r_info = ELF32_R_INFO (htab->root.hgot->indx, R_MIPS_HI16); + rel.r_addend = got_offset; + bfd_elf32_swap_reloca_out (output_bfd, &rel, loc); + + /* Emit a relocation for the addiu of %lo(<.got.plt slot>). */ + loc += sizeof (Elf32_External_Rela); + rel.r_offset += 4; + rel.r_info = ELF32_R_INFO (htab->root.hgot->indx, R_MIPS_LO16); + bfd_elf32_swap_reloca_out (output_bfd, &rel, loc); + } + + /* Emit an R_MIPS_JUMP_SLOT relocation against the .got.plt entry. */ + loc = htab->srelplt->contents + plt_index * sizeof (Elf32_External_Rela); + rel.r_offset = got_address; + rel.r_info = ELF32_R_INFO (h->dynindx, R_MIPS_JUMP_SLOT); + rel.r_addend = 0; + bfd_elf32_swap_reloca_out (output_bfd, &rel, loc); + + if (!h->def_regular) + sym->st_shndx = SHN_UNDEF; + } + + BFD_ASSERT (h->dynindx != -1 || h->forced_local); + + sgot = mips_elf_got_section (dynobj, FALSE); + BFD_ASSERT (sgot != NULL); + BFD_ASSERT (mips_elf_section_data (sgot) != NULL); + g = mips_elf_section_data (sgot)->u.got_info; + BFD_ASSERT (g != NULL); + + /* See if this symbol has an entry in the GOT. */ + if (g->global_gotsym != NULL + && h->dynindx >= g->global_gotsym->dynindx) + { + bfd_vma offset; + Elf_Internal_Rela outrel; + bfd_byte *loc; + asection *s; + + /* Install the symbol value in the GOT. */ + offset = mips_elf_global_got_index (dynobj, output_bfd, h, + R_MIPS_GOT16, info); + MIPS_ELF_PUT_WORD (output_bfd, sym->st_value, sgot->contents + offset); + + /* Add a dynamic relocation for it. */ + s = mips_elf_rel_dyn_section (info, FALSE); + loc = s->contents + (s->reloc_count++ * sizeof (Elf32_External_Rela)); + outrel.r_offset = (sgot->output_section->vma + + sgot->output_offset + + offset); + outrel.r_info = ELF32_R_INFO (h->dynindx, R_MIPS_32); + outrel.r_addend = 0; + bfd_elf32_swap_reloca_out (dynobj, &outrel, loc); + } + + /* Emit a copy reloc, if needed. */ + if (h->needs_copy) + { + Elf_Internal_Rela rel; + + BFD_ASSERT (h->dynindx != -1); + + rel.r_offset = (h->root.u.def.section->output_section->vma + + h->root.u.def.section->output_offset + + h->root.u.def.value); + rel.r_info = ELF32_R_INFO (h->dynindx, R_MIPS_COPY); + rel.r_addend = 0; + bfd_elf32_swap_reloca_out (output_bfd, &rel, + htab->srelbss->contents + + (htab->srelbss->reloc_count + * sizeof (Elf32_External_Rela))); + ++htab->srelbss->reloc_count; + } + + /* If this is a mips16 symbol, force the value to be even. */ + if (sym->st_other == STO_MIPS16) + sym->st_value &= ~1; + + return TRUE; +} + +/* Install the PLT header for a VxWorks executable and finalize the + contents of .rela.plt.unloaded. */ + +static void +mips_vxworks_finish_exec_plt (bfd *output_bfd, struct bfd_link_info *info) +{ + Elf_Internal_Rela rela; + bfd_byte *loc; + bfd_vma got_value, got_value_high, got_value_low, plt_address; + static const bfd_vma *plt_entry; + struct mips_elf_link_hash_table *htab; + + htab = mips_elf_hash_table (info); + plt_entry = mips_vxworks_exec_plt0_entry; + + /* Calculate the value of _GLOBAL_OFFSET_TABLE_. */ + got_value = (htab->root.hgot->root.u.def.section->output_section->vma + + htab->root.hgot->root.u.def.section->output_offset + + htab->root.hgot->root.u.def.value); + + got_value_high = ((got_value + 0x8000) >> 16) & 0xffff; + got_value_low = got_value & 0xffff; + + /* Calculate the address of the PLT header. */ + plt_address = htab->splt->output_section->vma + htab->splt->output_offset; + + /* Install the PLT header. */ + loc = htab->splt->contents; + bfd_put_32 (output_bfd, plt_entry[0] | got_value_high, loc); + bfd_put_32 (output_bfd, plt_entry[1] | got_value_low, loc + 4); + bfd_put_32 (output_bfd, plt_entry[2], loc + 8); + bfd_put_32 (output_bfd, plt_entry[3], loc + 12); + bfd_put_32 (output_bfd, plt_entry[4], loc + 16); + bfd_put_32 (output_bfd, plt_entry[5], loc + 20); + + /* Output the relocation for the lui of %hi(_GLOBAL_OFFSET_TABLE_). */ + loc = htab->srelplt2->contents; + rela.r_offset = plt_address; + rela.r_info = ELF32_R_INFO (htab->root.hgot->indx, R_MIPS_HI16); + rela.r_addend = 0; + bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); + loc += sizeof (Elf32_External_Rela); + + /* Output the relocation for the following addiu of + %lo(_GLOBAL_OFFSET_TABLE_). */ + rela.r_offset += 4; + rela.r_info = ELF32_R_INFO (htab->root.hgot->indx, R_MIPS_LO16); + bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); + loc += sizeof (Elf32_External_Rela); + + /* Fix up the remaining relocations. They may have the wrong + symbol index for _G_O_T_ or _P_L_T_ depending on the order + in which symbols were output. */ + while (loc < htab->srelplt2->contents + htab->srelplt2->size) + { + Elf_Internal_Rela rel; + + bfd_elf32_swap_reloca_in (output_bfd, loc, &rel); + rel.r_info = ELF32_R_INFO (htab->root.hplt->indx, R_MIPS_32); + bfd_elf32_swap_reloca_out (output_bfd, &rel, loc); + loc += sizeof (Elf32_External_Rela); + + bfd_elf32_swap_reloca_in (output_bfd, loc, &rel); + rel.r_info = ELF32_R_INFO (htab->root.hgot->indx, R_MIPS_HI16); + bfd_elf32_swap_reloca_out (output_bfd, &rel, loc); + loc += sizeof (Elf32_External_Rela); + + bfd_elf32_swap_reloca_in (output_bfd, loc, &rel); + rel.r_info = ELF32_R_INFO (htab->root.hgot->indx, R_MIPS_LO16); + bfd_elf32_swap_reloca_out (output_bfd, &rel, loc); + loc += sizeof (Elf32_External_Rela); + } +} + +/* Install the PLT header for a VxWorks shared library. */ + +static void +mips_vxworks_finish_shared_plt (bfd *output_bfd, struct bfd_link_info *info) +{ + unsigned int i; + struct mips_elf_link_hash_table *htab; + + htab = mips_elf_hash_table (info); + + /* We just need to copy the entry byte-by-byte. */ + for (i = 0; i < ARRAY_SIZE (mips_vxworks_shared_plt0_entry); i++) + bfd_put_32 (output_bfd, mips_vxworks_shared_plt0_entry[i], + htab->splt->contents + i * 4); +} + /* Finish up the dynamic sections. */ bfd_boolean @@ -6825,7 +8548,9 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd, asection *sdyn; asection *sgot; struct mips_got_info *gg, *g; + struct mips_elf_link_hash_table *htab; + htab = mips_elf_hash_table (info); dynobj = elf_hash_table (info)->dynobj; sdyn = bfd_get_section_by_name (dynobj, ".dynamic"); @@ -6845,12 +8570,13 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd, if (elf_hash_table (info)->dynamic_sections_created) { bfd_byte *b; + int dyn_to_skip = 0, dyn_skipped = 0; BFD_ASSERT (sdyn != NULL); BFD_ASSERT (g != NULL); for (b = sdyn->contents; - b < sdyn->contents + sdyn->_raw_size; + b < sdyn->contents + sdyn->size; b += MIPS_ELF_DYN_SIZE (dynobj)) { Elf_Internal_Dyn dyn; @@ -6868,11 +8594,14 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd, switch (dyn.d_tag) { case DT_RELENT: - s = mips_elf_rel_dyn_section (dynobj, FALSE); - BFD_ASSERT (s != NULL); dyn.d_un.d_val = MIPS_ELF_REL_SIZE (dynobj); break; + case DT_RELAENT: + BFD_ASSERT (htab->is_vxworks); + dyn.d_un.d_val = MIPS_ELF_RELA_SIZE (dynobj); + break; + case DT_STRSZ: /* Rewrite DT_STRSZ. */ dyn.d_un.d_val = @@ -6881,9 +8610,20 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd, case DT_PLTGOT: name = ".got"; - s = bfd_get_section_by_name (output_bfd, name); - BFD_ASSERT (s != NULL); - dyn.d_un.d_ptr = s->vma; + if (htab->is_vxworks) + { + /* _GLOBAL_OFFSET_TABLE_ is defined to be the beginning + of the ".got" section in DYNOBJ. */ + s = bfd_get_section_by_name (dynobj, name); + BFD_ASSERT (s != NULL); + dyn.d_un.d_ptr = s->output_section->vma + s->output_offset; + } + else + { + 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: @@ -6895,7 +8635,11 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd, break; case DT_MIPS_TIME_STAMP: - time ((time_t *) &dyn.d_un.d_val); + { + time_t t; + time (&t); + dyn.d_un.d_val = t; + } break; case DT_MIPS_ICHECKSUM: @@ -6941,14 +8685,11 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *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; + dyn.d_un.d_val = s->size / elemsize; break; case DT_MIPS_HIPAGENO: - dyn.d_un.d_val = g->local_gotno - MIPS_RESERVED_GOTNO; + dyn.d_un.d_val = g->local_gotno - MIPS_RESERVED_GOTNO (info); break; case DT_MIPS_RLD_MAP: @@ -6961,16 +8702,46 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd, dyn.d_un.d_ptr = s->vma; break; - case DT_RELSZ: - /* Reduce DT_RELSZ to account for any relocations we - decided not to make. This is for the n64 irix rld, - which doesn't seem to apply any relocations if there - are trailing null entries. */ - s = mips_elf_rel_dyn_section (dynobj, FALSE); - dyn.d_un.d_val = (s->reloc_count - * (ABI_64_P (output_bfd) - ? sizeof (Elf64_Mips_External_Rel) - : sizeof (Elf32_External_Rel))); + case DT_RELASZ: + BFD_ASSERT (htab->is_vxworks); + /* The count does not include the JUMP_SLOT relocations. */ + if (htab->srelplt) + dyn.d_un.d_val -= htab->srelplt->size; + break; + + case DT_PLTREL: + BFD_ASSERT (htab->is_vxworks); + dyn.d_un.d_val = DT_RELA; + break; + + case DT_PLTRELSZ: + BFD_ASSERT (htab->is_vxworks); + dyn.d_un.d_val = htab->srelplt->size; + break; + + case DT_JMPREL: + BFD_ASSERT (htab->is_vxworks); + dyn.d_un.d_val = (htab->srelplt->output_section->vma + + htab->srelplt->output_offset); + break; + + case DT_TEXTREL: + /* If we didn't need any text relocations after all, delete + the dynamic tag. */ + if (!(info->flags & DF_TEXTREL)) + { + dyn_to_skip = MIPS_ELF_DYN_SIZE (dynobj); + swap_out_p = FALSE; + } + break; + + case DT_FLAGS: + /* If we didn't need any text relocations after all, clear + DF_TEXTREL from DT_FLAGS. */ + if (!(info->flags & DF_TEXTREL)) + dyn.d_un.d_val &= ~DF_TEXTREL; + else + swap_out_p = FALSE; break; default: @@ -6978,20 +8749,49 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd, break; } - if (swap_out_p) + if (swap_out_p || dyn_skipped) (*get_elf_backend_data (dynobj)->s->swap_dyn_out) - (dynobj, &dyn, b); + (dynobj, &dyn, b - dyn_skipped); + + if (dyn_to_skip) + { + dyn_skipped += dyn_to_skip; + dyn_to_skip = 0; + } } + + /* Wipe out any trailing entries if we shifted down a dynamic tag. */ + if (dyn_skipped > 0) + memset (b - dyn_skipped, 0, dyn_skipped); } - /* 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) + if (sgot != NULL && sgot->size > 0) { - MIPS_ELF_PUT_WORD (output_bfd, 0, sgot->contents); - MIPS_ELF_PUT_WORD (output_bfd, 0x80000000, - sgot->contents + MIPS_ELF_GOT_SIZE (output_bfd)); + if (htab->is_vxworks) + { + /* The first entry of the global offset table points to the + ".dynamic" section. The second is initialized by the + loader and contains the shared library identifier. + The third is also initialized by the loader and points + to the lazy resolution stub. */ + MIPS_ELF_PUT_WORD (output_bfd, + sdyn->output_offset + sdyn->output_section->vma, + sgot->contents); + MIPS_ELF_PUT_WORD (output_bfd, 0, + sgot->contents + MIPS_ELF_GOT_SIZE (output_bfd)); + MIPS_ELF_PUT_WORD (output_bfd, 0, + sgot->contents + + 2 * MIPS_ELF_GOT_SIZE (output_bfd)); + } + else + { + /* 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. */ + 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) @@ -7009,7 +8809,8 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd, for (g = gg->next; g->next != gg; g = g->next) { - bfd_vma index = g->next->local_gotno + g->next->global_gotno; + bfd_vma index = g->next->local_gotno + g->next->global_gotno + + g->next->tls_gotno; MIPS_ELF_PUT_WORD (output_bfd, 0, sgot->contents + index++ * MIPS_ELF_GOT_SIZE (output_bfd)); @@ -7033,6 +8834,55 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd, } } + /* The generation of dynamic relocations for the non-primary gots + adds more dynamic relocations. We cannot count them until + here. */ + + if (elf_hash_table (info)->dynamic_sections_created) + { + bfd_byte *b; + bfd_boolean swap_out_p; + + BFD_ASSERT (sdyn != NULL); + + for (b = sdyn->contents; + b < sdyn->contents + sdyn->size; + b += MIPS_ELF_DYN_SIZE (dynobj)) + { + Elf_Internal_Dyn dyn; + asection *s; + + /* 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_RELSZ: + /* Reduce DT_RELSZ to account for any relocations we + decided not to make. This is for the n64 irix rld, + which doesn't seem to apply any relocations if there + are trailing null entries. */ + s = mips_elf_rel_dyn_section (info, FALSE); + dyn.d_un.d_val = (s->reloc_count + * (ABI_64_P (output_bfd) + ? sizeof (Elf64_Mips_External_Rel) + : sizeof (Elf32_External_Rel))); + break; + + default: + swap_out_p = FALSE; + break; + } + + if (swap_out_p) + (*get_elf_backend_data (dynobj)->s->swap_dyn_out) + (dynobj, &dyn, b); + } + } + { asection *s; Elf32_compact_rel cpt; @@ -7061,32 +8911,45 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd, { file_ptr dummy_offset; - BFD_ASSERT (s->_raw_size >= MIPS_FUNCTION_STUB_SIZE); - dummy_offset = s->_raw_size - MIPS_FUNCTION_STUB_SIZE; + BFD_ASSERT (s->size >= htab->function_stub_size); + dummy_offset = s->size - htab->function_stub_size; memset (s->contents + dummy_offset, 0, - MIPS_FUNCTION_STUB_SIZE); + htab->function_stub_size); } } } - /* We need to sort the entries of the dynamic relocation section. */ - - s = mips_elf_rel_dyn_section (dynobj, FALSE); - - if (s != NULL - && s->_raw_size > (bfd_vma)2 * MIPS_ELF_REL_SIZE (output_bfd)) + /* The psABI says that the dynamic relocations must be sorted in + increasing order of r_symndx. The VxWorks EABI doesn't require + this, and because the code below handles REL rather than RELA + relocations, using it for VxWorks would be outright harmful. */ + if (!htab->is_vxworks) { - reldyn_sorting_bfd = output_bfd; + s = mips_elf_rel_dyn_section (info, FALSE); + if (s != NULL + && s->size > (bfd_vma)2 * MIPS_ELF_REL_SIZE (output_bfd)) + { + reldyn_sorting_bfd = output_bfd; - if (ABI_64_P (output_bfd)) - qsort ((Elf64_External_Rel *) s->contents + 1, s->reloc_count - 1, - sizeof (Elf64_Mips_External_Rel), sort_dynamic_relocs_64); - else - qsort ((Elf32_External_Rel *) s->contents + 1, s->reloc_count - 1, - sizeof (Elf32_External_Rel), sort_dynamic_relocs); + if (ABI_64_P (output_bfd)) + qsort ((Elf64_External_Rel *) s->contents + 1, + s->reloc_count - 1, sizeof (Elf64_Mips_External_Rel), + sort_dynamic_relocs_64); + else + qsort ((Elf32_External_Rel *) s->contents + 1, + s->reloc_count - 1, sizeof (Elf32_External_Rel), + sort_dynamic_relocs); + } } } + if (htab->is_vxworks && htab->splt->size > 0) + { + if (info->shared) + mips_vxworks_finish_shared_plt (output_bfd, info); + else + mips_vxworks_finish_exec_plt (output_bfd, info); + } return TRUE; } @@ -7477,9 +9340,7 @@ _bfd_mips_elf_modify_segment_map (bfd *abfd, if (low > s->vma) low = s->vma; - sz = s->_cooked_size; - if (sz == 0) - sz = s->_raw_size; + sz = s->size; if (high < s->vma + sz) high = s->vma + sz; } @@ -7489,9 +9350,7 @@ _bfd_mips_elf_modify_segment_map (bfd *abfd, 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)) + && s->vma + s->size <= high) ++c; amt = sizeof *n + (bfd_size_type) (c - 1) * sizeof (asection *); @@ -7506,9 +9365,7 @@ _bfd_mips_elf_modify_segment_map (bfd *abfd, { if ((s->flags & SEC_LOAD) != 0 && s->vma >= low - && ((s->vma - + (s->_cooked_size != 0 ? - s->_cooked_size : s->_raw_size)) <= high)) + && s->vma + s->size <= high) { n->sections[i] = s; ++i; @@ -7615,13 +9472,13 @@ _bfd_mips_elf_gc_sweep_hook (bfd *abfd ATTRIBUTE_UNUSED, _bfd_elf_link_hash_copy_indirect copy the flags for us. */ void -_bfd_mips_elf_copy_indirect_symbol (const struct elf_backend_data *bed, +_bfd_mips_elf_copy_indirect_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *dir, struct elf_link_hash_entry *ind) { struct mips_elf_link_hash_entry *dirmips, *indmips; - _bfd_elf_link_hash_copy_indirect (bed, dir, ind); + _bfd_elf_link_hash_copy_indirect (info, dir, ind); if (ind->root.type != bfd_link_hash_indirect) return; @@ -7633,6 +9490,9 @@ _bfd_mips_elf_copy_indirect_symbol (const struct elf_backend_data *bed, dirmips->readonly_reloc = TRUE; if (indmips->no_fn_stub) dirmips->no_fn_stub = TRUE; + + if (dirmips->tls_type == 0) + dirmips->tls_type = indmips->tls_type; } void @@ -7651,11 +9511,10 @@ _bfd_mips_elf_hide_symbol (struct bfd_link_info *info, h->forced_local = force_local; dynobj = elf_hash_table (info)->dynobj; - if (dynobj != NULL && force_local) + if (dynobj != NULL && force_local && h->root.type != STT_TLS + && (got = mips_elf_got_section (dynobj, FALSE)) != NULL + && (g = mips_elf_section_data (got)->u.got_info) != NULL) { - got = mips_elf_got_section (dynobj, FALSE); - g = mips_elf_section_data (got)->u.got_info; - if (g->next) { struct mips_got_entry e; @@ -7669,6 +9528,7 @@ _bfd_mips_elf_hide_symbol (struct bfd_link_info *info, e.abfd = dynobj; e.symndx = -1; e.d.h = h; + e.tls_type = 0; for (g = g->next; g != gg; g = g->next) if (htab_find (g->got_entries, &e)) @@ -7721,15 +9581,15 @@ _bfd_mips_elf_discard_info (bfd *abfd, struct elf_reloc_cookie *cookie, o = bfd_get_section_by_name (abfd, ".pdr"); if (! o) return FALSE; - if (o->_raw_size == 0) + if (o->size == 0) return FALSE; - if (o->_raw_size % PDR_SIZE != 0) + if (o->size % PDR_SIZE != 0) return FALSE; if (o->output_section != NULL && bfd_is_abs_section (o->output_section)) return FALSE; - tdata = bfd_zmalloc (o->_raw_size / PDR_SIZE); + tdata = bfd_zmalloc (o->size / PDR_SIZE); if (! tdata) return FALSE; @@ -7744,7 +9604,7 @@ _bfd_mips_elf_discard_info (bfd *abfd, struct elf_reloc_cookie *cookie, cookie->rel = cookie->rels; cookie->relend = cookie->rels + o->reloc_count; - for (i = 0, skip = 0; i < o->_raw_size / PDR_SIZE; i ++) + for (i = 0, skip = 0; i < o->size / PDR_SIZE; i ++) { if (bfd_elf_reloc_symbol_deleted_p (i * PDR_SIZE, cookie)) { @@ -7756,7 +9616,7 @@ _bfd_mips_elf_discard_info (bfd *abfd, struct elf_reloc_cookie *cookie, if (skip != 0) { mips_elf_section_data (o)->u.tdata = tdata; - o->_cooked_size = o->_raw_size - skip * PDR_SIZE; + o->size -= skip * PDR_SIZE; ret = TRUE; } else @@ -7790,7 +9650,7 @@ _bfd_mips_elf_write_section (bfd *output_bfd, asection *sec, return FALSE; to = contents; - end = contents + sec->_raw_size; + end = contents + sec->size; for (from = contents, i = 0; from < end; from += PDR_SIZE, i++) @@ -7802,7 +9662,7 @@ _bfd_mips_elf_write_section (bfd *output_bfd, asection *sec, to += PDR_SIZE; } bfd_set_section_contents (output_bfd, sec->output_section, contents, - sec->output_offset, sec->_cooked_size); + sec->output_offset, sec->size); return TRUE; } @@ -7915,6 +9775,20 @@ _bfd_mips_elf_find_nearest_line (bfd *abfd, asection *section, filename_ptr, functionname_ptr, line_ptr); } + +bfd_boolean +_bfd_mips_elf_find_inliner_info (bfd *abfd, + const char **filename_ptr, + const char **functionname_ptr, + unsigned int *line_ptr) +{ + bfd_boolean found; + found = _bfd_dwarf2_find_inliner_info (abfd, filename_ptr, + functionname_ptr, line_ptr, + & elf_tdata (abfd)->dwarf2_find_line_info); + return found; +} + /* When are writing out the .options or .MIPS.options section, remember the bytes we are writing out, so that we can install the @@ -7925,7 +9799,7 @@ _bfd_mips_elf_set_section_contents (bfd *abfd, sec_ptr section, const void *location, file_ptr offset, bfd_size_type count) { - if (strcmp (section->name, MIPS_ELF_OPTIONS_SECTION_NAME (abfd)) == 0) + if (MIPS_ELF_OPTIONS_SECTION_NAME_P (section->name)) { bfd_byte *c; @@ -7939,13 +9813,7 @@ _bfd_mips_elf_set_section_contents (bfd *abfd, sec_ptr section, c = mips_elf_section_data (section)->u.tdata; if (c == NULL) { - bfd_size_type size; - - if (section->_cooked_size != 0) - size = section->_cooked_size; - else - size = section->_raw_size; - c = bfd_zalloc (abfd, size); + c = bfd_zalloc (abfd, section->size); if (c == NULL) return FALSE; mips_elf_section_data (section)->u.tdata = c; @@ -7973,6 +9841,7 @@ _bfd_elf_mips_get_relocated_section_contents /* Get enough memory to hold the stuff */ bfd *input_bfd = link_order->u.indirect.section->owner; asection *input_section = link_order->u.indirect.section; + bfd_size_type sz; long reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section); arelent **reloc_vector = NULL; @@ -7986,14 +9855,10 @@ _bfd_elf_mips_get_relocated_section_contents goto error_return; /* read in the section */ - if (!bfd_get_section_contents (input_bfd, input_section, data, 0, - input_section->_raw_size)) + sz = input_section->rawsize ? input_section->rawsize : input_section->size; + if (!bfd_get_section_contents (input_bfd, input_section, data, 0, sz)) 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, @@ -8057,30 +9922,21 @@ _bfd_elf_mips_get_relocated_section_contents /* 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 anyway. */ - } - 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_elf32_gprel16_reloc) - { - /* bypass special_function call */ - r = _bfd_mips_elf_gprel16_with_gp (input_bfd, sym, *parent, - input_section, relocatable, - data, gp); - goto skip_bfd_perform_relocation; - } - /* end mips specific stuff */ - r = bfd_perform_relocation (input_bfd, *parent, data, input_section, - relocatable ? abfd : NULL, - &error_message); - skip_bfd_perform_relocation: + /* If we've managed to find the gp and have a special + function for the relocation then go ahead, else default + to the generic handling. */ + if (gp_found + && (*parent)->howto->special_function + == _bfd_mips_elf32_gprel16_reloc) + r = _bfd_mips_elf_gprel16_with_gp (input_bfd, sym, *parent, + input_section, relocatable, + data, gp); + else + r = bfd_perform_relocation (input_bfd, *parent, data, + input_section, + relocatable ? abfd : NULL, + &error_message); if (relocatable) { @@ -8098,8 +9954,7 @@ _bfd_elf_mips_get_relocated_section_contents 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))) + input_bfd, input_section, (*parent)->address, TRUE))) goto error_return; break; case bfd_reloc_dangerous: @@ -8111,7 +9966,8 @@ _bfd_elf_mips_get_relocated_section_contents break; case bfd_reloc_overflow: if (!((*link_info->callbacks->reloc_overflow) - (link_info, bfd_asymbol_name (*(*parent)->sym_ptr_ptr), + (link_info, NULL, + bfd_asymbol_name (*(*parent)->sym_ptr_ptr), (*parent)->howto->name, (*parent)->addend, input_bfd, input_section, (*parent)->address))) goto error_return; @@ -8147,8 +10003,9 @@ _bfd_mips_elf_link_hash_table_create (bfd *abfd) if (ret == NULL) return NULL; - if (! _bfd_elf_link_hash_table_init (&ret->root, abfd, - mips_elf_link_hash_newfunc)) + if (!_bfd_elf_link_hash_table_init (&ret->root, abfd, + mips_elf_link_hash_newfunc, + sizeof (struct mips_elf_link_hash_entry))) { free (ret); return NULL; @@ -8164,9 +10021,37 @@ _bfd_mips_elf_link_hash_table_create (bfd *abfd) ret->use_rld_obj_head = FALSE; ret->rld_value = 0; ret->mips16_stubs_seen = FALSE; + ret->is_vxworks = FALSE; + ret->srelbss = NULL; + ret->sdynbss = NULL; + ret->srelplt = NULL; + ret->srelplt2 = NULL; + ret->sgotplt = NULL; + ret->splt = NULL; + ret->plt_header_size = 0; + ret->plt_entry_size = 0; + ret->function_stub_size = 0; return &ret->root.root; } + +/* Likewise, but indicate that the target is VxWorks. */ + +struct bfd_link_hash_table * +_bfd_mips_vxworks_link_hash_table_create (bfd *abfd) +{ + struct bfd_link_hash_table *ret; + + ret = _bfd_mips_elf_link_hash_table_create (abfd); + if (ret) + { + struct mips_elf_link_hash_table *htab; + + htab = (struct mips_elf_link_hash_table *) ret; + htab->is_vxworks = 1; + } + return ret; +} /* We need to use a special link routine to handle the .reginfo and the .mdebug sections. We need to merge all instances of these @@ -8175,21 +10060,21 @@ _bfd_mips_elf_link_hash_table_create (bfd *abfd) bfd_boolean _bfd_mips_elf_final_link (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; + const struct elf_backend_data *bed = get_elf_backend_data (abfd); + const struct ecoff_debug_swap *swap = bed->elf_backend_ecoff_debug_swap; HDRR *symhdr = &debug.symbolic_header; void *mdebug_handle = NULL; asection *s; EXTR esym; unsigned int i; bfd_size_type amt; + struct mips_elf_link_hash_table *htab; static const char * const secname[] = { @@ -8206,11 +10091,13 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info) generic size_dynamic_sections renumbered them out from under us. Rather than trying somehow to prevent the renumbering, just do the sort again. */ + htab = mips_elf_hash_table (info); if (elf_hash_table (info)->dynamic_sections_created) { bfd *dynobj; asection *got; struct mips_got_info *g; + bfd_size_type dynsecsymcount; /* 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 @@ -8218,9 +10105,9 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info) 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))) + + dynsecsymcount = count_section_dynsyms (abfd, info); + if (! mips_elf_sort_hash_table (info, dynsecsymcount + 1)) return FALSE; /* Make sure we didn't grow the global .got region. */ @@ -8234,47 +10121,6 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info) <= g->global_gotno); } -#if 0 - /* We want to set the GP value for ld -r. */ - /* 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 || IRIX_COMPAT (abfd) == ict_none) - 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; - bfd_section_list_remove (abfd, secpp); - --abfd->section_count; - - break; - } - } - - /* We include .MIPS.options, even though we don't process it quite right. - (Some entries are supposed to be merged.) At IRIX6 empirically we seem - to be better off including it than not. */ - for (secpp = &abfd->sections; *secpp != NULL; secpp = &(*secpp)->next) - { - if (strcmp ((*secpp)->name, ".MIPS.options") == 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; - bfd_section_list_remove (abfd, secpp); - --abfd->section_count; - - break; - } - } -#endif - /* Get a value for the GP register. */ if (elf_gp (abfd) == 0) { @@ -8285,6 +10131,14 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info) elf_gp (abfd) = (h->u.def.value + h->u.def.section->output_section->vma + h->u.def.section->output_offset); + else if (htab->is_vxworks + && (h = bfd_link_hash_lookup (info->hash, + "_GLOBAL_OFFSET_TABLE_", + FALSE, FALSE, TRUE)) + && h->type == bfd_link_hash_defined) + elf_gp (abfd) = (h->u.def.section->output_section->vma + + h->u.def.section->output_offset + + h->u.def.value); else if (info->relocatable) { bfd_vma lo = MINUS_ONE; @@ -8296,7 +10150,7 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info) lo = o->vma; /* And calculate GP relative to that. */ - elf_gp (abfd) = lo + ELF_MIPS_GP_OFFSET (abfd); + elf_gp (abfd) = lo + ELF_MIPS_GP_OFFSET (info); } else { @@ -8321,7 +10175,7 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info) /* We have found the .reginfo section in the output file. Look through all the link_orders comprising it and merge the information together. */ - for (p = o->link_order_head; p != NULL; p = p->next) + for (p = o->map_head.link_order; p != NULL; p = p->next) { asection *input_section; bfd *input_bfd; @@ -8338,11 +10192,6 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info) 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, &ext, 0, sizeof ext)) return FALSE; @@ -8365,11 +10214,11 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info) } /* Size has been set in _bfd_mips_elf_always_size_sections. */ - BFD_ASSERT(o->_raw_size == sizeof (Elf32_External_RegInfo)); + BFD_ASSERT(o->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 = NULL; + o->map_head.link_order = NULL; reginfo_sec = o; } @@ -8433,7 +10282,7 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info) if (s != NULL) { esym.asym.value = s->vma; - last = s->vma + s->_raw_size; + last = s->vma + s->size; } else esym.asym.value = last; @@ -8442,7 +10291,7 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info) return FALSE; } - for (p = o->link_order_head; p != NULL; p = p->next) + for (p = o->map_head.link_order; p != NULL; p = p->next) { asection *input_section; bfd *input_bfd; @@ -8474,7 +10323,7 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info) input_swap = (get_elf_backend_data (input_bfd) ->elf_backend_ecoff_debug_swap); - BFD_ASSERT (p->size == input_section->_raw_size); + BFD_ASSERT (p->size == input_section->size); /* The ECOFF linking code expects that we have already read in the debugging information and set up an @@ -8553,9 +10402,10 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info) flagword flags = (SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED | SEC_READONLY); - rtproc_sec = bfd_make_section (abfd, ".rtproc"); + rtproc_sec = bfd_make_section_with_flags (abfd, + ".rtproc", + flags); if (rtproc_sec == NULL - || ! bfd_set_section_flags (abfd, rtproc_sec, flags) || ! bfd_set_section_alignment (abfd, rtproc_sec, 4)) return FALSE; } @@ -8578,11 +10428,11 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info) return FALSE; /* Set the size of the .mdebug section. */ - o->_raw_size = bfd_ecoff_debug_size (abfd, &debug, swap); + o->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 = NULL; + o->map_head.link_order = NULL; mdebug_sec = o; } @@ -8601,7 +10451,7 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info) not used in executables files. */ if (! info->relocatable) { - for (p = o->link_order_head; p != NULL; p = p->next) + for (p = o->map_head.link_order; p != NULL; p = p->next) { asection *input_section; @@ -8621,14 +10471,10 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info) /* Skip this section later on (I don't think this currently matters, but someday it might). */ - o->link_order_head = NULL; + o->map_head.link_order = NULL; /* Really remove the section. */ - for (secpp = &abfd->sections; - *secpp != o; - secpp = &(*secpp)->next) - ; - bfd_section_list_remove (abfd, secpp); + bfd_section_list_remove (abfd, o); --abfd->section_count; continue; @@ -8675,7 +10521,7 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info) tab[0].gt_header.gt_unused = 0; /* Combine the input sections. */ - for (p = o->link_order_head; p != NULL; p = p->next) + for (p = o->map_head.link_order; p != NULL; p = p->next) { asection *input_section; bfd *input_bfd; @@ -8696,7 +10542,7 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info) /* 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); + size = input_section->size; last = 0; for (gpentry = sizeof (Elf32_External_gptab); gpentry < size; @@ -8793,12 +10639,12 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info) bfd_mips_elf32_swap_gptab_out (abfd, tab + j, ext_tab + j); free (tab); - o->_raw_size = c * sizeof (Elf32_External_gptab); + o->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 = NULL; + o->map_head.link_order = NULL; } } @@ -8832,7 +10678,7 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info) { if (! bfd_set_section_contents (abfd, gptab_data_sec, gptab_data_sec->contents, - 0, gptab_data_sec->_raw_size)) + 0, gptab_data_sec->size)) return FALSE; } @@ -8840,7 +10686,7 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info) { if (! bfd_set_section_contents (abfd, gptab_bss_sec, gptab_bss_sec->contents, - 0, gptab_bss_sec->_raw_size)) + 0, gptab_bss_sec->size)) return FALSE; } @@ -8851,7 +10697,7 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info) { if (! bfd_set_section_contents (abfd, rtproc_sec, rtproc_sec->contents, - 0, rtproc_sec->_raw_size)) + 0, rtproc_sec->size)) return FALSE; } } @@ -8985,8 +10831,8 @@ _bfd_mips_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) if (! _bfd_generic_verify_endian_match (ibfd, obfd)) { (*_bfd_error_handler) - (_("%s: endianness incompatible with that of the selected emulation"), - bfd_archive_filename (ibfd)); + (_("%B: endianness incompatible with that of the selected emulation"), + ibfd); return FALSE; } @@ -8997,8 +10843,8 @@ _bfd_mips_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) if (strcmp (bfd_get_target (ibfd), bfd_get_target (obfd)) != 0) { (*_bfd_error_handler) - (_("%s: ABI is incompatible with that of the selected emulation"), - bfd_archive_filename (ibfd)); + (_("%B: ABI is incompatible with that of the selected emulation"), + ibfd); return FALSE; } @@ -9039,6 +10885,12 @@ _bfd_mips_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) new_flags &= ~EF_MIPS_UCODE; old_flags &= ~EF_MIPS_UCODE; + /* Don't care about the PIC flags from dynamic objects; they are + PIC by design. */ + if ((new_flags & (EF_MIPS_PIC | EF_MIPS_CPIC)) != 0 + && (ibfd->flags & DYNAMIC) != 0) + new_flags &= ~ (EF_MIPS_PIC | EF_MIPS_CPIC); + if (new_flags == old_flags) return TRUE; @@ -9051,7 +10903,7 @@ _bfd_mips_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) which are automatically generated by gas. */ if (strcmp (sec->name, ".reginfo") && strcmp (sec->name, ".mdebug") - && (sec->_raw_size != 0 + && (sec->size != 0 || (strcmp (sec->name, ".text") && strcmp (sec->name, ".data") && strcmp (sec->name, ".bss")))) @@ -9069,8 +10921,8 @@ _bfd_mips_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) != ((old_flags & (EF_MIPS_PIC | EF_MIPS_CPIC)) != 0)) { (*_bfd_error_handler) - (_("%s: warning: linking PIC files with non-PIC files"), - bfd_archive_filename (ibfd)); + (_("%B: warning: linking PIC files with non-PIC files"), + ibfd); ok = TRUE; } @@ -9086,8 +10938,8 @@ _bfd_mips_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) if (mips_32bit_flags_p (old_flags) != mips_32bit_flags_p (new_flags)) { (*_bfd_error_handler) - (_("%s: linking 32-bit code with 64-bit code"), - bfd_archive_filename (ibfd)); + (_("%B: linking 32-bit code with 64-bit code"), + ibfd); ok = FALSE; } else if (!mips_mach_extends_p (bfd_get_mach (ibfd), bfd_get_mach (obfd))) @@ -9114,8 +10966,8 @@ _bfd_mips_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) { /* The ISAs aren't compatible. */ (*_bfd_error_handler) - (_("%s: linking %s module with previous %s modules"), - bfd_archive_filename (ibfd), + (_("%B: linking %s module with previous %s modules"), + ibfd, bfd_printable_name (ibfd), bfd_printable_name (obfd)); ok = FALSE; @@ -9137,8 +10989,8 @@ _bfd_mips_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) != elf_elfheader (obfd)->e_ident[EI_CLASS])) { (*_bfd_error_handler) - (_("%s: ABI mismatch: linking %s module with previous %s modules"), - bfd_archive_filename (ibfd), + (_("%B: ABI mismatch: linking %s module with previous %s modules"), + ibfd, elf_mips_abi_name (ibfd), elf_mips_abi_name (obfd)); ok = FALSE; @@ -9160,8 +11012,8 @@ _bfd_mips_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) if (new_flags != old_flags) { (*_bfd_error_handler) - (_("%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"), - bfd_archive_filename (ibfd), (unsigned long) new_flags, + (_("%B: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"), + ibfd, (unsigned long) new_flags, (unsigned long) old_flags); ok = FALSE; } @@ -9255,13 +11107,34 @@ _bfd_mips_elf_print_private_bfd_data (bfd *abfd, void *ptr) return TRUE; } -struct bfd_elf_special_section const _bfd_mips_elf_special_sections[]= +const struct bfd_elf_special_section _bfd_mips_elf_special_sections[] = { - { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL }, - { ".sbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL }, { ".lit4", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL }, { ".lit8", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL }, - { ".ucode", 6, 0, SHT_MIPS_UCODE, 0 }, { ".mdebug", 7, 0, SHT_MIPS_DEBUG, 0 }, + { ".sbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL }, + { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL }, + { ".ucode", 6, 0, SHT_MIPS_UCODE, 0 }, { NULL, 0, 0, 0, 0 } }; + +/* Ensure that the STO_OPTIONAL flag is copied into h->other, + even if this is not a defintion of the symbol. */ +void +_bfd_mips_elf_merge_symbol_attribute (struct elf_link_hash_entry *h, + const Elf_Internal_Sym *isym, + bfd_boolean definition, + bfd_boolean dynamic ATTRIBUTE_UNUSED) +{ + if (! definition + && ELF_MIPS_IS_OPTIONAL (isym->st_other)) + h->other |= STO_OPTIONAL; +} + +/* Decide whether an undefined symbol is special and can be ignored. + This is the case for OPTIONAL symbols on IRIX. */ +bfd_boolean +_bfd_mips_elf_ignore_undef_symbol (struct elf_link_hash_entry *h) +{ + return ELF_MIPS_IS_OPTIONAL (h->other) ? TRUE : FALSE; +} diff --git a/contrib/binutils/bfd/elfxx-mips.h b/contrib/binutils/bfd/elfxx-mips.h index 0a684d90867..6c3c9a30f6e 100644 --- a/contrib/binutils/bfd/elfxx-mips.h +++ b/contrib/binutils/bfd/elfxx-mips.h @@ -1,5 +1,5 @@ /* MIPS ELF specific backend routines. - Copyright 2002, 2003, 2004 Free Software Foundation, Inc. + Copyright 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -15,7 +15,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "elf/common.h" #include "elf/internal.h" @@ -24,12 +24,14 @@ extern bfd_boolean _bfd_mips_elf_new_section_hook (bfd *, asection *); extern void _bfd_mips_elf_symbol_processing (bfd *, asymbol *); +extern unsigned int _bfd_mips_elf_eh_frame_address_size + (bfd *, asection *); extern bfd_boolean _bfd_mips_elf_name_local_section_symbols (bfd *); extern bfd_boolean _bfd_mips_elf_section_processing (bfd *, Elf_Internal_Shdr *); extern bfd_boolean _bfd_mips_elf_section_from_shdr - (bfd *, Elf_Internal_Shdr *, const char *); + (bfd *, Elf_Internal_Shdr *, const char *, int); extern bfd_boolean _bfd_mips_elf_fake_sections (bfd *, Elf_Internal_Shdr *, asection *); extern bfd_boolean _bfd_mips_elf_section_from_bfd_section @@ -46,6 +48,8 @@ extern bfd_boolean _bfd_mips_elf_check_relocs (bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *); extern bfd_boolean _bfd_mips_elf_adjust_dynamic_symbol (struct bfd_link_info *, struct elf_link_hash_entry *); +extern bfd_boolean _bfd_mips_vxworks_adjust_dynamic_symbol + (struct bfd_link_info *, struct elf_link_hash_entry *); extern bfd_boolean _bfd_mips_elf_always_size_sections (bfd *, struct bfd_link_info *); extern bfd_boolean _bfd_mips_elf_size_dynamic_sections @@ -56,6 +60,9 @@ extern bfd_boolean _bfd_mips_elf_relocate_section extern bfd_boolean _bfd_mips_elf_finish_dynamic_symbol (bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, Elf_Internal_Sym *); +extern bfd_boolean _bfd_mips_vxworks_finish_dynamic_symbol + (bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, + Elf_Internal_Sym *); extern bfd_boolean _bfd_mips_elf_finish_dynamic_sections (bfd *, struct bfd_link_info *); extern void _bfd_mips_elf_final_write_processing @@ -70,7 +77,7 @@ extern asection * _bfd_mips_elf_gc_mark_hook extern bfd_boolean _bfd_mips_elf_gc_sweep_hook (bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *); extern void _bfd_mips_elf_copy_indirect_symbol - (const struct elf_backend_data *, struct elf_link_hash_entry *, + (struct bfd_link_info *, struct elf_link_hash_entry *, struct elf_link_hash_entry *); extern void _bfd_mips_elf_hide_symbol (struct bfd_link_info *, struct elf_link_hash_entry *, bfd_boolean); @@ -79,6 +86,8 @@ extern bfd_boolean _bfd_mips_elf_ignore_discarded_relocs extern bfd_boolean _bfd_mips_elf_find_nearest_line (bfd *, asection *, asymbol **, bfd_vma, const char **, const char **, unsigned int *); +extern bfd_boolean _bfd_mips_elf_find_inliner_info + (bfd *, const char **, const char **, unsigned int *); extern bfd_boolean _bfd_mips_elf_set_section_contents (bfd *, asection *, const void *, file_ptr, bfd_size_type); extern bfd_byte *_bfd_elf_mips_get_relocated_section_contents @@ -86,6 +95,8 @@ extern bfd_byte *_bfd_elf_mips_get_relocated_section_contents bfd_byte *, bfd_boolean, asymbol **); extern struct bfd_link_hash_table *_bfd_mips_elf_link_hash_table_create (bfd *); +extern struct bfd_link_hash_table *_bfd_mips_vxworks_link_hash_table_create + (bfd *); extern bfd_boolean _bfd_mips_elf_final_link (bfd *, struct bfd_link_info *); extern bfd_boolean _bfd_mips_elf_merge_private_bfd_data @@ -101,6 +112,10 @@ extern bfd_boolean _bfd_mips_elf_write_section extern bfd_boolean _bfd_mips_elf_read_ecoff_info (bfd *, asection *, struct ecoff_debug_info *); +extern void _bfd_mips16_elf_reloc_unshuffle + (bfd *, int, bfd_boolean, bfd_byte *); +extern void _bfd_mips16_elf_reloc_shuffle + (bfd *, int, bfd_boolean, bfd_byte *); extern bfd_reloc_status_type _bfd_mips_elf_gprel16_with_gp (bfd *, asymbol *, arelent *, asection *, bfd_boolean, void *, bfd_vma); extern bfd_reloc_status_type _bfd_mips_elf32_gprel16_reloc @@ -119,8 +134,16 @@ extern bfd_boolean _bfd_mips_relax_section (bfd *, asection *, struct bfd_link_info *, bfd_boolean *); extern bfd_vma _bfd_mips_elf_sign_extend (bfd_vma, int); +extern void _bfd_mips_elf_merge_symbol_attribute + (struct elf_link_hash_entry *, const Elf_Internal_Sym *, bfd_boolean, bfd_boolean); +extern bfd_boolean _bfd_mips_elf_ignore_undef_symbol + (struct elf_link_hash_entry *); + +extern const struct bfd_elf_special_section _bfd_mips_elf_special_sections []; -extern struct bfd_elf_special_section const _bfd_mips_elf_special_sections[]; #define elf_backend_name_local_section_symbols \ _bfd_mips_elf_name_local_section_symbols #define elf_backend_special_sections _bfd_mips_elf_special_sections +#define elf_backend_eh_frame_address_size _bfd_mips_elf_eh_frame_address_size +#define elf_backend_merge_symbol_attribute _bfd_mips_elf_merge_symbol_attribute +#define elf_backend_ignore_undef_symbol _bfd_mips_elf_ignore_undef_symbol diff --git a/contrib/binutils/bfd/elfxx-sparc.c b/contrib/binutils/bfd/elfxx-sparc.c new file mode 100644 index 00000000000..ef7ff482d2e --- /dev/null +++ b/contrib/binutils/bfd/elfxx-sparc.c @@ -0,0 +1,4165 @@ +/* SPARC-specific support for ELF + Copyright 2005, 2006 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* This file handles functionality common to the different SPARC ABI's. */ + +#include "bfd.h" +#include "sysdep.h" +#include "bfdlink.h" +#include "libbfd.h" +#include "libiberty.h" +#include "elf-bfd.h" +#include "elf/sparc.h" +#include "opcode/sparc.h" +#include "elfxx-sparc.h" +#include "elf-vxworks.h" + +/* In case we're on a 32-bit machine, construct a 64-bit "-1" value. */ +#define MINUS_ONE (~ (bfd_vma) 0) + +#define ABI_64_P(abfd) \ + (get_elf_backend_data (abfd)->s->elfclass == ELFCLASS64) + +/* The relocation "howto" table. */ + +/* Utility for performing the standard initial work of an instruction + relocation. + *PRELOCATION will contain the relocated item. + *PINSN will contain the instruction from the input stream. + If the result is `bfd_reloc_other' the caller can continue with + performing the relocation. Otherwise it must stop and return the + value to its caller. */ + +static bfd_reloc_status_type +init_insn_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, + PTR data, asection *input_section, bfd *output_bfd, + bfd_vma *prelocation, bfd_vma *pinsn) +{ + bfd_vma relocation; + reloc_howto_type *howto = reloc_entry->howto; + + if (output_bfd != (bfd *) NULL + && (symbol->flags & BSF_SECTION_SYM) == 0 + && (! howto->partial_inplace + || reloc_entry->addend == 0)) + { + reloc_entry->address += input_section->output_offset; + return bfd_reloc_ok; + } + + /* This works because partial_inplace is FALSE. */ + if (output_bfd != NULL) + return bfd_reloc_continue; + + if (reloc_entry->address > bfd_get_section_limit (abfd, input_section)) + return bfd_reloc_outofrange; + + relocation = (symbol->value + + symbol->section->output_section->vma + + symbol->section->output_offset); + relocation += reloc_entry->addend; + if (howto->pc_relative) + { + relocation -= (input_section->output_section->vma + + input_section->output_offset); + relocation -= reloc_entry->address; + } + + *prelocation = relocation; + *pinsn = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address); + return bfd_reloc_other; +} + +/* For unsupported relocs. */ + +static bfd_reloc_status_type +sparc_elf_notsup_reloc (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_notsupported; +} + +/* Handle the WDISP16 reloc. */ + +static bfd_reloc_status_type +sparc_elf_wdisp16_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, + PTR data, asection *input_section, bfd *output_bfd, + char **error_message ATTRIBUTE_UNUSED) +{ + bfd_vma relocation; + bfd_vma insn; + bfd_reloc_status_type status; + + status = init_insn_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, &relocation, &insn); + if (status != bfd_reloc_other) + return status; + + insn &= ~ (bfd_vma) 0x303fff; + insn |= (((relocation >> 2) & 0xc000) << 6) | ((relocation >> 2) & 0x3fff); + bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address); + + if ((bfd_signed_vma) relocation < - 0x40000 + || (bfd_signed_vma) relocation > 0x3ffff) + return bfd_reloc_overflow; + else + return bfd_reloc_ok; +} + +/* Handle the HIX22 reloc. */ + +static bfd_reloc_status_type +sparc_elf_hix22_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, + PTR data, asection *input_section, bfd *output_bfd, + char **error_message ATTRIBUTE_UNUSED) +{ + bfd_vma relocation; + bfd_vma insn; + bfd_reloc_status_type status; + + status = init_insn_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, &relocation, &insn); + if (status != bfd_reloc_other) + return status; + + relocation ^= MINUS_ONE; + insn = (insn &~ (bfd_vma) 0x3fffff) | ((relocation >> 10) & 0x3fffff); + bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address); + + if ((relocation & ~ (bfd_vma) 0xffffffff) != 0) + return bfd_reloc_overflow; + else + return bfd_reloc_ok; +} + +/* Handle the LOX10 reloc. */ + +static bfd_reloc_status_type +sparc_elf_lox10_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, + PTR data, asection *input_section, bfd *output_bfd, + char **error_message ATTRIBUTE_UNUSED) +{ + bfd_vma relocation; + bfd_vma insn; + bfd_reloc_status_type status; + + status = init_insn_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, &relocation, &insn); + if (status != bfd_reloc_other) + return status; + + insn = (insn &~ (bfd_vma) 0x1fff) | 0x1c00 | (relocation & 0x3ff); + bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address); + + return bfd_reloc_ok; +} + +static reloc_howto_type _bfd_sparc_elf_howto_table[] = +{ + HOWTO(R_SPARC_NONE, 0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_NONE", FALSE,0,0x00000000,TRUE), + HOWTO(R_SPARC_8, 0,0, 8,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_8", FALSE,0,0x000000ff,TRUE), + HOWTO(R_SPARC_16, 0,1,16,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_16", FALSE,0,0x0000ffff,TRUE), + HOWTO(R_SPARC_32, 0,2,32,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_32", FALSE,0,0xffffffff,TRUE), + HOWTO(R_SPARC_DISP8, 0,0, 8,TRUE, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_DISP8", FALSE,0,0x000000ff,TRUE), + HOWTO(R_SPARC_DISP16, 0,1,16,TRUE, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_DISP16", FALSE,0,0x0000ffff,TRUE), + HOWTO(R_SPARC_DISP32, 0,2,32,TRUE, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_DISP32", FALSE,0,0xffffffff,TRUE), + HOWTO(R_SPARC_WDISP30, 2,2,30,TRUE, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_WDISP30", FALSE,0,0x3fffffff,TRUE), + HOWTO(R_SPARC_WDISP22, 2,2,22,TRUE, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_WDISP22", FALSE,0,0x003fffff,TRUE), + HOWTO(R_SPARC_HI22, 10,2,22,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_HI22", FALSE,0,0x003fffff,TRUE), + HOWTO(R_SPARC_22, 0,2,22,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_22", FALSE,0,0x003fffff,TRUE), + HOWTO(R_SPARC_13, 0,2,13,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_13", FALSE,0,0x00001fff,TRUE), + HOWTO(R_SPARC_LO10, 0,2,10,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_LO10", FALSE,0,0x000003ff,TRUE), + HOWTO(R_SPARC_GOT10, 0,2,10,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_GOT10", FALSE,0,0x000003ff,TRUE), + HOWTO(R_SPARC_GOT13, 0,2,13,FALSE,0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_GOT13", FALSE,0,0x00001fff,TRUE), + HOWTO(R_SPARC_GOT22, 10,2,22,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_GOT22", FALSE,0,0x003fffff,TRUE), + HOWTO(R_SPARC_PC10, 0,2,10,TRUE, 0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_PC10", FALSE,0,0x000003ff,TRUE), + HOWTO(R_SPARC_PC22, 10,2,22,TRUE, 0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_PC22", FALSE,0,0x003fffff,TRUE), + HOWTO(R_SPARC_WPLT30, 2,2,30,TRUE, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_WPLT30", FALSE,0,0x3fffffff,TRUE), + HOWTO(R_SPARC_COPY, 0,0,00,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_COPY", FALSE,0,0x00000000,TRUE), + HOWTO(R_SPARC_GLOB_DAT, 0,0,00,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_GLOB_DAT",FALSE,0,0x00000000,TRUE), + HOWTO(R_SPARC_JMP_SLOT, 0,0,00,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_JMP_SLOT",FALSE,0,0x00000000,TRUE), + HOWTO(R_SPARC_RELATIVE, 0,0,00,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_RELATIVE",FALSE,0,0x00000000,TRUE), + HOWTO(R_SPARC_UA32, 0,2,32,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_UA32", FALSE,0,0xffffffff,TRUE), + HOWTO(R_SPARC_PLT32, 0,2,32,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_PLT32", FALSE,0,0xffffffff,TRUE), + HOWTO(R_SPARC_HIPLT22, 0,0,00,FALSE,0,complain_overflow_dont, sparc_elf_notsup_reloc, "R_SPARC_HIPLT22", FALSE,0,0x00000000,TRUE), + HOWTO(R_SPARC_LOPLT10, 0,0,00,FALSE,0,complain_overflow_dont, sparc_elf_notsup_reloc, "R_SPARC_LOPLT10", FALSE,0,0x00000000,TRUE), + HOWTO(R_SPARC_PCPLT32, 0,0,00,FALSE,0,complain_overflow_dont, sparc_elf_notsup_reloc, "R_SPARC_PCPLT32", FALSE,0,0x00000000,TRUE), + HOWTO(R_SPARC_PCPLT22, 0,0,00,FALSE,0,complain_overflow_dont, sparc_elf_notsup_reloc, "R_SPARC_PCPLT22", FALSE,0,0x00000000,TRUE), + HOWTO(R_SPARC_PCPLT10, 0,0,00,FALSE,0,complain_overflow_dont, sparc_elf_notsup_reloc, "R_SPARC_PCPLT10", FALSE,0,0x00000000,TRUE), + HOWTO(R_SPARC_10, 0,2,10,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_10", FALSE,0,0x000003ff,TRUE), + HOWTO(R_SPARC_11, 0,2,11,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_11", FALSE,0,0x000007ff,TRUE), + HOWTO(R_SPARC_64, 0,4,64,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_64", FALSE,0,MINUS_ONE, TRUE), + HOWTO(R_SPARC_OLO10, 0,2,13,FALSE,0,complain_overflow_signed, sparc_elf_notsup_reloc, "R_SPARC_OLO10", FALSE,0,0x00001fff,TRUE), + HOWTO(R_SPARC_HH22, 42,2,22,FALSE,0,complain_overflow_unsigned,bfd_elf_generic_reloc, "R_SPARC_HH22", FALSE,0,0x003fffff,TRUE), + HOWTO(R_SPARC_HM10, 32,2,10,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_HM10", FALSE,0,0x000003ff,TRUE), + HOWTO(R_SPARC_LM22, 10,2,22,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_LM22", FALSE,0,0x003fffff,TRUE), + HOWTO(R_SPARC_PC_HH22, 42,2,22,TRUE, 0,complain_overflow_unsigned,bfd_elf_generic_reloc, "R_SPARC_PC_HH22", FALSE,0,0x003fffff,TRUE), + HOWTO(R_SPARC_PC_HM10, 32,2,10,TRUE, 0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_PC_HM10", FALSE,0,0x000003ff,TRUE), + HOWTO(R_SPARC_PC_LM22, 10,2,22,TRUE, 0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_PC_LM22", FALSE,0,0x003fffff,TRUE), + HOWTO(R_SPARC_WDISP16, 2,2,16,TRUE, 0,complain_overflow_signed, sparc_elf_wdisp16_reloc,"R_SPARC_WDISP16", FALSE,0,0x00000000,TRUE), + HOWTO(R_SPARC_WDISP19, 2,2,19,TRUE, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_WDISP19", FALSE,0,0x0007ffff,TRUE), + HOWTO(R_SPARC_UNUSED_42, 0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_UNUSED_42",FALSE,0,0x00000000,TRUE), + HOWTO(R_SPARC_7, 0,2, 7,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_7", FALSE,0,0x0000007f,TRUE), + HOWTO(R_SPARC_5, 0,2, 5,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_5", FALSE,0,0x0000001f,TRUE), + HOWTO(R_SPARC_6, 0,2, 6,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_6", FALSE,0,0x0000003f,TRUE), + HOWTO(R_SPARC_DISP64, 0,4,64,TRUE, 0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_DISP64", FALSE,0,MINUS_ONE, TRUE), + HOWTO(R_SPARC_PLT64, 0,4,64,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_PLT64", FALSE,0,MINUS_ONE, TRUE), + HOWTO(R_SPARC_HIX22, 0,4, 0,FALSE,0,complain_overflow_bitfield,sparc_elf_hix22_reloc, "R_SPARC_HIX22", FALSE,0,MINUS_ONE, FALSE), + HOWTO(R_SPARC_LOX10, 0,4, 0,FALSE,0,complain_overflow_dont, sparc_elf_lox10_reloc, "R_SPARC_LOX10", FALSE,0,MINUS_ONE, FALSE), + HOWTO(R_SPARC_H44, 22,2,22,FALSE,0,complain_overflow_unsigned,bfd_elf_generic_reloc, "R_SPARC_H44", FALSE,0,0x003fffff,FALSE), + HOWTO(R_SPARC_M44, 12,2,10,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_M44", FALSE,0,0x000003ff,FALSE), + HOWTO(R_SPARC_L44, 0,2,13,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_L44", FALSE,0,0x00000fff,FALSE), + HOWTO(R_SPARC_REGISTER, 0,4, 0,FALSE,0,complain_overflow_bitfield,sparc_elf_notsup_reloc, "R_SPARC_REGISTER",FALSE,0,MINUS_ONE, FALSE), + HOWTO(R_SPARC_UA64, 0,4,64,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_UA64", FALSE,0,MINUS_ONE, TRUE), + HOWTO(R_SPARC_UA16, 0,1,16,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_UA16", FALSE,0,0x0000ffff,TRUE), + HOWTO(R_SPARC_TLS_GD_HI22,10,2,22,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_GD_HI22",FALSE,0,0x003fffff,TRUE), + HOWTO(R_SPARC_TLS_GD_LO10,0,2,10,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_GD_LO10",FALSE,0,0x000003ff,TRUE), + HOWTO(R_SPARC_TLS_GD_ADD,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_GD_ADD",FALSE,0,0x00000000,TRUE), + HOWTO(R_SPARC_TLS_GD_CALL,2,2,30,TRUE,0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_TLS_GD_CALL",FALSE,0,0x3fffffff,TRUE), + HOWTO(R_SPARC_TLS_LDM_HI22,10,2,22,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_LDM_HI22",FALSE,0,0x003fffff,TRUE), + HOWTO(R_SPARC_TLS_LDM_LO10,0,2,10,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_LDM_LO10",FALSE,0,0x000003ff,TRUE), + HOWTO(R_SPARC_TLS_LDM_ADD,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_LDM_ADD",FALSE,0,0x00000000,TRUE), + HOWTO(R_SPARC_TLS_LDM_CALL,2,2,30,TRUE,0,complain_overflow_signed, bfd_elf_generic_reloc, "R_SPARC_TLS_LDM_CALL",FALSE,0,0x3fffffff,TRUE), + HOWTO(R_SPARC_TLS_LDO_HIX22,0,2,0,FALSE,0,complain_overflow_bitfield,sparc_elf_hix22_reloc,"R_SPARC_TLS_LDO_HIX22",FALSE,0,0x003fffff, FALSE), + HOWTO(R_SPARC_TLS_LDO_LOX10,0,2,0,FALSE,0,complain_overflow_dont, sparc_elf_lox10_reloc, "R_SPARC_TLS_LDO_LOX10",FALSE,0,0x000003ff, FALSE), + HOWTO(R_SPARC_TLS_LDO_ADD,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_LDO_ADD",FALSE,0,0x00000000,TRUE), + HOWTO(R_SPARC_TLS_IE_HI22,10,2,22,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_IE_HI22",FALSE,0,0x003fffff,TRUE), + HOWTO(R_SPARC_TLS_IE_LO10,0,2,10,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_IE_LO10",FALSE,0,0x000003ff,TRUE), + HOWTO(R_SPARC_TLS_IE_LD,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_IE_LD",FALSE,0,0x00000000,TRUE), + HOWTO(R_SPARC_TLS_IE_LDX,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_IE_LDX",FALSE,0,0x00000000,TRUE), + HOWTO(R_SPARC_TLS_IE_ADD,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_IE_ADD",FALSE,0,0x00000000,TRUE), + HOWTO(R_SPARC_TLS_LE_HIX22,0,2,0,FALSE,0,complain_overflow_bitfield,sparc_elf_hix22_reloc, "R_SPARC_TLS_LE_HIX22",FALSE,0,0x003fffff, FALSE), + HOWTO(R_SPARC_TLS_LE_LOX10,0,2,0,FALSE,0,complain_overflow_dont, sparc_elf_lox10_reloc, "R_SPARC_TLS_LE_LOX10",FALSE,0,0x000003ff, FALSE), + HOWTO(R_SPARC_TLS_DTPMOD32,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_DTPMOD32",FALSE,0,0x00000000,TRUE), + HOWTO(R_SPARC_TLS_DTPMOD64,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_DTPMOD64",FALSE,0,0x00000000,TRUE), + HOWTO(R_SPARC_TLS_DTPOFF32,0,2,32,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc,"R_SPARC_TLS_DTPOFF32",FALSE,0,0xffffffff,TRUE), + HOWTO(R_SPARC_TLS_DTPOFF64,0,4,64,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc,"R_SPARC_TLS_DTPOFF64",FALSE,0,MINUS_ONE,TRUE), + HOWTO(R_SPARC_TLS_TPOFF32,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_TPOFF32",FALSE,0,0x00000000,TRUE), + HOWTO(R_SPARC_TLS_TPOFF64,0,0, 0,FALSE,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_TLS_TPOFF64",FALSE,0,0x00000000,TRUE) +}; +static reloc_howto_type sparc_vtinherit_howto = + HOWTO (R_SPARC_GNU_VTINHERIT, 0,2,0,FALSE,0,complain_overflow_dont, NULL, "R_SPARC_GNU_VTINHERIT", FALSE,0, 0, FALSE); +static reloc_howto_type sparc_vtentry_howto = + HOWTO (R_SPARC_GNU_VTENTRY, 0,2,0,FALSE,0,complain_overflow_dont, _bfd_elf_rel_vtable_reloc_fn,"R_SPARC_GNU_VTENTRY", FALSE,0,0, FALSE); +static reloc_howto_type sparc_rev32_howto = + HOWTO(R_SPARC_REV32, 0,2,32,FALSE,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_REV32", FALSE,0,0xffffffff,TRUE); + +struct elf_reloc_map { + bfd_reloc_code_real_type bfd_reloc_val; + unsigned char elf_reloc_val; +}; + +static const struct elf_reloc_map sparc_reloc_map[] = +{ + { BFD_RELOC_NONE, R_SPARC_NONE, }, + { BFD_RELOC_16, R_SPARC_16, }, + { BFD_RELOC_16_PCREL, R_SPARC_DISP16 }, + { BFD_RELOC_8, R_SPARC_8 }, + { BFD_RELOC_8_PCREL, R_SPARC_DISP8 }, + { BFD_RELOC_CTOR, R_SPARC_64 }, + { BFD_RELOC_32, R_SPARC_32 }, + { BFD_RELOC_32_PCREL, R_SPARC_DISP32 }, + { BFD_RELOC_HI22, R_SPARC_HI22 }, + { BFD_RELOC_LO10, R_SPARC_LO10, }, + { BFD_RELOC_32_PCREL_S2, R_SPARC_WDISP30 }, + { BFD_RELOC_64_PCREL, R_SPARC_DISP64 }, + { BFD_RELOC_SPARC22, R_SPARC_22 }, + { BFD_RELOC_SPARC13, R_SPARC_13 }, + { BFD_RELOC_SPARC_GOT10, R_SPARC_GOT10 }, + { BFD_RELOC_SPARC_GOT13, R_SPARC_GOT13 }, + { BFD_RELOC_SPARC_GOT22, R_SPARC_GOT22 }, + { BFD_RELOC_SPARC_PC10, R_SPARC_PC10 }, + { BFD_RELOC_SPARC_PC22, R_SPARC_PC22 }, + { BFD_RELOC_SPARC_WPLT30, R_SPARC_WPLT30 }, + { BFD_RELOC_SPARC_COPY, R_SPARC_COPY }, + { BFD_RELOC_SPARC_GLOB_DAT, R_SPARC_GLOB_DAT }, + { BFD_RELOC_SPARC_JMP_SLOT, R_SPARC_JMP_SLOT }, + { BFD_RELOC_SPARC_RELATIVE, R_SPARC_RELATIVE }, + { BFD_RELOC_SPARC_WDISP22, R_SPARC_WDISP22 }, + { BFD_RELOC_SPARC_UA16, R_SPARC_UA16 }, + { BFD_RELOC_SPARC_UA32, R_SPARC_UA32 }, + { BFD_RELOC_SPARC_UA64, R_SPARC_UA64 }, + { BFD_RELOC_SPARC_10, R_SPARC_10 }, + { BFD_RELOC_SPARC_11, R_SPARC_11 }, + { BFD_RELOC_SPARC_64, R_SPARC_64 }, + { BFD_RELOC_SPARC_OLO10, R_SPARC_OLO10 }, + { BFD_RELOC_SPARC_HH22, R_SPARC_HH22 }, + { BFD_RELOC_SPARC_HM10, R_SPARC_HM10 }, + { BFD_RELOC_SPARC_LM22, R_SPARC_LM22 }, + { BFD_RELOC_SPARC_PC_HH22, R_SPARC_PC_HH22 }, + { BFD_RELOC_SPARC_PC_HM10, R_SPARC_PC_HM10 }, + { BFD_RELOC_SPARC_PC_LM22, R_SPARC_PC_LM22 }, + { BFD_RELOC_SPARC_WDISP16, R_SPARC_WDISP16 }, + { BFD_RELOC_SPARC_WDISP19, R_SPARC_WDISP19 }, + { BFD_RELOC_SPARC_7, R_SPARC_7 }, + { BFD_RELOC_SPARC_5, R_SPARC_5 }, + { BFD_RELOC_SPARC_6, R_SPARC_6 }, + { BFD_RELOC_SPARC_DISP64, R_SPARC_DISP64 }, + { BFD_RELOC_SPARC_TLS_GD_HI22, R_SPARC_TLS_GD_HI22 }, + { BFD_RELOC_SPARC_TLS_GD_LO10, R_SPARC_TLS_GD_LO10 }, + { BFD_RELOC_SPARC_TLS_GD_ADD, R_SPARC_TLS_GD_ADD }, + { BFD_RELOC_SPARC_TLS_GD_CALL, R_SPARC_TLS_GD_CALL }, + { BFD_RELOC_SPARC_TLS_LDM_HI22, R_SPARC_TLS_LDM_HI22 }, + { BFD_RELOC_SPARC_TLS_LDM_LO10, R_SPARC_TLS_LDM_LO10 }, + { BFD_RELOC_SPARC_TLS_LDM_ADD, R_SPARC_TLS_LDM_ADD }, + { BFD_RELOC_SPARC_TLS_LDM_CALL, R_SPARC_TLS_LDM_CALL }, + { BFD_RELOC_SPARC_TLS_LDO_HIX22, R_SPARC_TLS_LDO_HIX22 }, + { BFD_RELOC_SPARC_TLS_LDO_LOX10, R_SPARC_TLS_LDO_LOX10 }, + { BFD_RELOC_SPARC_TLS_LDO_ADD, R_SPARC_TLS_LDO_ADD }, + { BFD_RELOC_SPARC_TLS_IE_HI22, R_SPARC_TLS_IE_HI22 }, + { BFD_RELOC_SPARC_TLS_IE_LO10, R_SPARC_TLS_IE_LO10 }, + { BFD_RELOC_SPARC_TLS_IE_LD, R_SPARC_TLS_IE_LD }, + { BFD_RELOC_SPARC_TLS_IE_LDX, R_SPARC_TLS_IE_LDX }, + { BFD_RELOC_SPARC_TLS_IE_ADD, R_SPARC_TLS_IE_ADD }, + { BFD_RELOC_SPARC_TLS_LE_HIX22, R_SPARC_TLS_LE_HIX22 }, + { BFD_RELOC_SPARC_TLS_LE_LOX10, R_SPARC_TLS_LE_LOX10 }, + { BFD_RELOC_SPARC_TLS_DTPMOD32, R_SPARC_TLS_DTPMOD32 }, + { BFD_RELOC_SPARC_TLS_DTPMOD64, R_SPARC_TLS_DTPMOD64 }, + { BFD_RELOC_SPARC_TLS_DTPOFF32, R_SPARC_TLS_DTPOFF32 }, + { BFD_RELOC_SPARC_TLS_DTPOFF64, R_SPARC_TLS_DTPOFF64 }, + { BFD_RELOC_SPARC_TLS_TPOFF32, R_SPARC_TLS_TPOFF32 }, + { BFD_RELOC_SPARC_TLS_TPOFF64, R_SPARC_TLS_TPOFF64 }, + { BFD_RELOC_SPARC_PLT32, R_SPARC_PLT32 }, + { BFD_RELOC_SPARC_PLT64, R_SPARC_PLT64 }, + { BFD_RELOC_SPARC_HIX22, R_SPARC_HIX22 }, + { BFD_RELOC_SPARC_LOX10, R_SPARC_LOX10 }, + { BFD_RELOC_SPARC_H44, R_SPARC_H44 }, + { BFD_RELOC_SPARC_M44, R_SPARC_M44 }, + { BFD_RELOC_SPARC_L44, R_SPARC_L44 }, + { BFD_RELOC_SPARC_REGISTER, R_SPARC_REGISTER }, + { BFD_RELOC_VTABLE_INHERIT, R_SPARC_GNU_VTINHERIT }, + { BFD_RELOC_VTABLE_ENTRY, R_SPARC_GNU_VTENTRY }, + { BFD_RELOC_SPARC_REV32, R_SPARC_REV32 }, +}; + +reloc_howto_type * +_bfd_sparc_elf_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, + bfd_reloc_code_real_type code) +{ + unsigned int i; + + switch (code) + { + case BFD_RELOC_VTABLE_INHERIT: + return &sparc_vtinherit_howto; + + case BFD_RELOC_VTABLE_ENTRY: + return &sparc_vtentry_howto; + + case BFD_RELOC_SPARC_REV32: + return &sparc_rev32_howto; + + default: + for (i = 0; + i < sizeof (sparc_reloc_map) / sizeof (struct elf_reloc_map); + i++) + { + if (sparc_reloc_map[i].bfd_reloc_val == code) + return (_bfd_sparc_elf_howto_table + + (int) sparc_reloc_map[i].elf_reloc_val); + } + } + bfd_set_error (bfd_error_bad_value); + return NULL; +} + +reloc_howto_type * +_bfd_sparc_elf_info_to_howto_ptr (unsigned int r_type) +{ + switch (r_type) + { + case R_SPARC_GNU_VTINHERIT: + return &sparc_vtinherit_howto; + + case R_SPARC_GNU_VTENTRY: + return &sparc_vtentry_howto; + + case R_SPARC_REV32: + return &sparc_rev32_howto; + + default: + if (r_type >= (unsigned int) R_SPARC_max_std) + { + (*_bfd_error_handler) (_("invalid relocation type %d"), + (int) r_type); + r_type = R_SPARC_NONE; + } + return &_bfd_sparc_elf_howto_table[r_type]; + } +} + +/* Both 32-bit and 64-bit sparc encode this in an identical manner, + so just take advantage of that. */ +#define SPARC_ELF_R_TYPE(r_info) \ + ((r_info) & 0xff) + +void +_bfd_sparc_elf_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, arelent *cache_ptr, + Elf_Internal_Rela *dst) +{ + unsigned int r_type = SPARC_ELF_R_TYPE (dst->r_info); + + cache_ptr->howto = _bfd_sparc_elf_info_to_howto_ptr (r_type); +} + + +/* The nop opcode we use. */ +#define SPARC_NOP 0x01000000 + +#define SPARC_INSN_BYTES 4 + +/* The SPARC linker needs to keep track of the number of relocs that it + decides to copy as dynamic relocs in check_relocs for each symbol. + This is so that it can later discard them if they are found to be + unnecessary. We store the information in a field extending the + regular ELF linker hash table. */ + +struct _bfd_sparc_elf_dyn_relocs +{ + struct _bfd_sparc_elf_dyn_relocs *next; + + /* The input section of the reloc. */ + asection *sec; + + /* Total number of relocs copied for the input section. */ + bfd_size_type count; + + /* Number of pc-relative relocs copied for the input section. */ + bfd_size_type pc_count; +}; + +/* SPARC ELF linker hash entry. */ + +struct _bfd_sparc_elf_link_hash_entry +{ + struct elf_link_hash_entry elf; + + /* Track dynamic relocs copied for this symbol. */ + struct _bfd_sparc_elf_dyn_relocs *dyn_relocs; + +#define GOT_UNKNOWN 0 +#define GOT_NORMAL 1 +#define GOT_TLS_GD 2 +#define GOT_TLS_IE 3 + unsigned char tls_type; +}; + +#define _bfd_sparc_elf_hash_entry(ent) ((struct _bfd_sparc_elf_link_hash_entry *)(ent)) + +struct _bfd_sparc_elf_obj_tdata +{ + struct elf_obj_tdata root; + + /* tls_type for each local got entry. */ + char *local_got_tls_type; + + /* TRUE if TLS GD relocs has been seen for this object. */ + bfd_boolean has_tlsgd; +}; + +#define _bfd_sparc_elf_tdata(abfd) \ + ((struct _bfd_sparc_elf_obj_tdata *) (abfd)->tdata.any) + +#define _bfd_sparc_elf_local_got_tls_type(abfd) \ + (_bfd_sparc_elf_tdata (abfd)->local_got_tls_type) + +bfd_boolean +_bfd_sparc_elf_mkobject (bfd *abfd) +{ + bfd_size_type amt = sizeof (struct _bfd_sparc_elf_obj_tdata); + abfd->tdata.any = bfd_zalloc (abfd, amt); + if (abfd->tdata.any == NULL) + return FALSE; + return TRUE; +} + +static void +sparc_put_word_32 (bfd *bfd, bfd_vma val, void *ptr) +{ + bfd_put_32 (bfd, val, ptr); +} + +static void +sparc_put_word_64 (bfd *bfd, bfd_vma val, void *ptr) +{ + bfd_put_64 (bfd, val, ptr); +} + +static void +sparc_elf_append_rela_64 (bfd *abfd ATTRIBUTE_UNUSED, + asection *s ATTRIBUTE_UNUSED, + Elf_Internal_Rela *rel ATTRIBUTE_UNUSED) +{ +#ifdef BFD64 + Elf64_External_Rela *loc64; + + loc64 = (Elf64_External_Rela *) s->contents; + loc64 += s->reloc_count++; + bfd_elf64_swap_reloca_out (abfd, rel, (bfd_byte *) loc64); +#endif +} + +static void +sparc_elf_append_rela_32 (bfd *abfd, asection *s, Elf_Internal_Rela *rel) +{ + Elf32_External_Rela *loc32; + + loc32 = (Elf32_External_Rela *) s->contents; + loc32 += s->reloc_count++; + bfd_elf32_swap_reloca_out (abfd, rel, (bfd_byte *) loc32); +} + +static bfd_vma +sparc_elf_r_info_64 (Elf_Internal_Rela *in_rel ATTRIBUTE_UNUSED, + bfd_vma index ATTRIBUTE_UNUSED, + bfd_vma type ATTRIBUTE_UNUSED) +{ + return ELF64_R_INFO (index, + (in_rel ? + ELF64_R_TYPE_INFO (ELF64_R_TYPE_DATA (in_rel->r_info), + type) : type)); +} + +static bfd_vma +sparc_elf_r_info_32 (Elf_Internal_Rela *in_rel ATTRIBUTE_UNUSED, + bfd_vma index, bfd_vma type) +{ + return ELF32_R_INFO (index, type); +} + +static bfd_vma +sparc_elf_r_symndx_64 (bfd_vma r_info) +{ + bfd_vma r_symndx = ELF32_R_SYM (r_info); + return (r_symndx >> 24); +} + +static bfd_vma +sparc_elf_r_symndx_32 (bfd_vma r_info) +{ + return ELF32_R_SYM (r_info); +} + +/* PLT/GOT stuff */ + +#define PLT32_ENTRY_SIZE 12 +#define PLT32_HEADER_SIZE (4 * PLT32_ENTRY_SIZE) + +/* The first four entries in a 32-bit procedure linkage table are reserved, + and the initial contents are unimportant (we zero them out). + Subsequent entries look like this. See the SVR4 ABI SPARC + supplement to see how this works. */ + +/* sethi %hi(.-.plt0),%g1. We fill in the address later. */ +#define PLT32_ENTRY_WORD0 0x03000000 +/* b,a .plt0. We fill in the offset later. */ +#define PLT32_ENTRY_WORD1 0x30800000 +/* nop. */ +#define PLT32_ENTRY_WORD2 SPARC_NOP + +static int +sparc32_plt_entry_build (bfd *output_bfd, asection *splt, bfd_vma offset, + bfd_vma max ATTRIBUTE_UNUSED, + bfd_vma *r_offset) +{ + bfd_put_32 (output_bfd, + PLT32_ENTRY_WORD0 + offset, + splt->contents + offset); + bfd_put_32 (output_bfd, + (PLT32_ENTRY_WORD1 + + (((- (offset + 4)) >> 2) & 0x3fffff)), + splt->contents + offset + 4); + bfd_put_32 (output_bfd, (bfd_vma) PLT32_ENTRY_WORD2, + splt->contents + offset + 8); + + *r_offset = offset; + + return offset / PLT32_ENTRY_SIZE - 4; +} + +/* Both the headers and the entries are icache aligned. */ +#define PLT64_ENTRY_SIZE 32 +#define PLT64_HEADER_SIZE (4 * PLT64_ENTRY_SIZE) +#define PLT64_LARGE_THRESHOLD 32768 + +static int +sparc64_plt_entry_build (bfd *output_bfd, asection *splt, bfd_vma offset, + bfd_vma max, bfd_vma *r_offset) +{ + unsigned char *entry = splt->contents + offset; + const unsigned int nop = SPARC_NOP; + int index; + + if (offset < (PLT64_LARGE_THRESHOLD * PLT64_ENTRY_SIZE)) + { + unsigned int sethi, ba; + + *r_offset = offset; + + index = (offset / PLT64_ENTRY_SIZE); + + sethi = 0x03000000 | (index * PLT64_ENTRY_SIZE); + ba = 0x30680000 + | (((splt->contents + PLT64_ENTRY_SIZE) - (entry + 4)) / 4 & 0x7ffff); + + bfd_put_32 (output_bfd, (bfd_vma) sethi, entry); + bfd_put_32 (output_bfd, (bfd_vma) ba, entry + 4); + bfd_put_32 (output_bfd, (bfd_vma) nop, entry + 8); + bfd_put_32 (output_bfd, (bfd_vma) nop, entry + 12); + bfd_put_32 (output_bfd, (bfd_vma) nop, entry + 16); + bfd_put_32 (output_bfd, (bfd_vma) nop, entry + 20); + bfd_put_32 (output_bfd, (bfd_vma) nop, entry + 24); + bfd_put_32 (output_bfd, (bfd_vma) nop, entry + 28); + } + else + { + unsigned char *ptr; + unsigned int ldx; + int block, last_block, ofs, last_ofs, chunks_this_block; + const int insn_chunk_size = (6 * 4); + const int ptr_chunk_size = (1 * 8); + const int entries_per_block = 160; + const int block_size = entries_per_block * (insn_chunk_size + + ptr_chunk_size); + + /* Entries 32768 and higher are grouped into blocks of 160. + The blocks are further subdivided into 160 sequences of + 6 instructions and 160 pointers. If a block does not require + the full 160 entries, let's say it requires N, then there + will be N sequences of 6 instructions and N pointers. */ + + offset -= (PLT64_LARGE_THRESHOLD * PLT64_ENTRY_SIZE); + max -= (PLT64_LARGE_THRESHOLD * PLT64_ENTRY_SIZE); + + block = offset / block_size; + last_block = max / block_size; + if (block != last_block) + { + chunks_this_block = 160; + } + else + { + last_ofs = max % block_size; + chunks_this_block = last_ofs / (insn_chunk_size + ptr_chunk_size); + } + + ofs = offset % block_size; + + index = (PLT64_LARGE_THRESHOLD + + (block * 160) + + (ofs / insn_chunk_size)); + + ptr = splt->contents + + (PLT64_LARGE_THRESHOLD * PLT64_ENTRY_SIZE) + + (block * block_size) + + (chunks_this_block * insn_chunk_size) + + (ofs / insn_chunk_size) * ptr_chunk_size; + + *r_offset = (bfd_vma) (ptr - splt->contents); + + ldx = 0xc25be000 | ((ptr - (entry+4)) & 0x1fff); + + /* mov %o7,%g5 + call .+8 + nop + ldx [%o7+P],%g1 + jmpl %o7+%g1,%g1 + mov %g5,%o7 */ + bfd_put_32 (output_bfd, (bfd_vma) 0x8a10000f, entry); + bfd_put_32 (output_bfd, (bfd_vma) 0x40000002, entry + 4); + bfd_put_32 (output_bfd, (bfd_vma) SPARC_NOP, entry + 8); + bfd_put_32 (output_bfd, (bfd_vma) ldx, entry + 12); + bfd_put_32 (output_bfd, (bfd_vma) 0x83c3c001, entry + 16); + bfd_put_32 (output_bfd, (bfd_vma) 0x9e100005, entry + 20); + + bfd_put_64 (output_bfd, (bfd_vma) (splt->contents - (entry + 4)), ptr); + } + + return index - 4; +} + +/* The format of the first PLT entry in a VxWorks executable. */ +static const bfd_vma sparc_vxworks_exec_plt0_entry[] = + { + 0x05000000, /* sethi %hi(_GLOBAL_OFFSET_TABLE_+8), %g2 */ + 0x8410a000, /* or %g2, %lo(_GLOBAL_OFFSET_TABLE_+8), %g2 */ + 0xc4008000, /* ld [ %g2 ], %g2 */ + 0x81c08000, /* jmp %g2 */ + 0x01000000 /* nop */ + }; + +/* The format of subsequent PLT entries. */ +static const bfd_vma sparc_vxworks_exec_plt_entry[] = + { + 0x03000000, /* sethi %hi(_GLOBAL_OFFSET_TABLE_+f@got), %g1 */ + 0x82106000, /* or %g1, %lo(_GLOBAL_OFFSET_TABLE_+f@got), %g1 */ + 0xc2004000, /* ld [ %g1 ], %g1 */ + 0x81c04000, /* jmp %g1 */ + 0x01000000, /* nop */ + 0x03000000, /* sethi %hi(f@pltindex), %g1 */ + 0x10800000, /* b _PLT_resolve */ + 0x82106000 /* or %g1, %lo(f@pltindex), %g1 */ + }; + +/* The format of the first PLT entry in a VxWorks shared object. */ +static const bfd_vma sparc_vxworks_shared_plt0_entry[] = + { + 0xc405e008, /* ld [ %l7 + 8 ], %g2 */ + 0x81c08000, /* jmp %g2 */ + 0x01000000 /* nop */ + }; + +/* The format of subsequent PLT entries. */ +static const bfd_vma sparc_vxworks_shared_plt_entry[] = + { + 0x03000000, /* sethi %hi(f@got), %g1 */ + 0x82106000, /* or %g1, %lo(f@got), %g1 */ + 0xc205c001, /* ld [ %l7 + %g1 ], %g1 */ + 0x81c04000, /* jmp %g1 */ + 0x01000000, /* nop */ + 0x03000000, /* sethi %hi(f@pltindex), %g1 */ + 0x10800000, /* b _PLT_resolve */ + 0x82106000 /* or %g1, %lo(f@pltindex), %g1 */ + }; + +#define SPARC_ELF_PUT_WORD(htab, bfd, val, ptr) \ + htab->put_word(bfd, val, ptr) + +#define SPARC_ELF_APPEND_RELA(htab, bfd, sec, rela) \ + htab->append_rela(bfd, sec, rela) + +#define SPARC_ELF_R_INFO(htab, in_rel, index, type) \ + htab->r_info(in_rel, index, type) + +#define SPARC_ELF_R_SYMNDX(htab, r_info) \ + htab->r_symndx(r_info) + +#define SPARC_ELF_WORD_BYTES(htab) \ + htab->bytes_per_word + +#define SPARC_ELF_RELA_BYTES(htab) \ + htab->bytes_per_rela + +#define SPARC_ELF_DTPOFF_RELOC(htab) \ + htab->dtpoff_reloc + +#define SPARC_ELF_DTPMOD_RELOC(htab) \ + htab->dtpmod_reloc + +#define SPARC_ELF_TPOFF_RELOC(htab) \ + htab->tpoff_reloc + +#define SPARC_ELF_BUILD_PLT_ENTRY(htab, obfd, splt, off, max, r_off) \ + htab->build_plt_entry (obfd, splt, off, max, r_off) + +/* Create an entry in an SPARC ELF linker hash table. */ + +static struct bfd_hash_entry * +link_hash_newfunc (struct bfd_hash_entry *entry, + struct bfd_hash_table *table, const char *string) +{ + /* Allocate the structure if it has not already been allocated by a + subclass. */ + if (entry == NULL) + { + entry = bfd_hash_allocate (table, + sizeof (struct _bfd_sparc_elf_link_hash_entry)); + if (entry == NULL) + return entry; + } + + /* Call the allocation method of the superclass. */ + entry = _bfd_elf_link_hash_newfunc (entry, table, string); + if (entry != NULL) + { + struct _bfd_sparc_elf_link_hash_entry *eh; + + eh = (struct _bfd_sparc_elf_link_hash_entry *) entry; + eh->dyn_relocs = NULL; + eh->tls_type = GOT_UNKNOWN; + } + + return entry; +} + +/* The name of the dynamic interpreter. This is put in the .interp + section. */ + +#define ELF32_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1" +#define ELF64_DYNAMIC_INTERPRETER "/usr/lib/sparcv9/ld.so.1" + +/* Create a SPARC ELF linker hash table. */ + +struct bfd_link_hash_table * +_bfd_sparc_elf_link_hash_table_create (bfd *abfd) +{ + struct _bfd_sparc_elf_link_hash_table *ret; + bfd_size_type amt = sizeof (struct _bfd_sparc_elf_link_hash_table); + + ret = (struct _bfd_sparc_elf_link_hash_table *) bfd_zmalloc (amt); + if (ret == NULL) + return NULL; + + if (ABI_64_P (abfd)) + { + ret->put_word = sparc_put_word_64; + ret->append_rela = sparc_elf_append_rela_64; + ret->r_info = sparc_elf_r_info_64; + ret->r_symndx = sparc_elf_r_symndx_64; + ret->dtpoff_reloc = R_SPARC_TLS_DTPOFF64; + ret->dtpmod_reloc = R_SPARC_TLS_DTPMOD64; + ret->tpoff_reloc = R_SPARC_TLS_TPOFF64; + ret->word_align_power = 3; + ret->align_power_max = 4; + ret->bytes_per_word = 8; + ret->bytes_per_rela = sizeof (Elf64_External_Rela); + ret->dynamic_interpreter = ELF64_DYNAMIC_INTERPRETER; + ret->dynamic_interpreter_size = sizeof ELF64_DYNAMIC_INTERPRETER; + } + else + { + ret->put_word = sparc_put_word_32; + ret->append_rela = sparc_elf_append_rela_32; + ret->r_info = sparc_elf_r_info_32; + ret->r_symndx = sparc_elf_r_symndx_32; + ret->dtpoff_reloc = R_SPARC_TLS_DTPOFF32; + ret->dtpmod_reloc = R_SPARC_TLS_DTPMOD32; + ret->tpoff_reloc = R_SPARC_TLS_TPOFF32; + ret->word_align_power = 2; + ret->align_power_max = 3; + ret->bytes_per_word = 4; + ret->bytes_per_rela = sizeof (Elf32_External_Rela); + ret->dynamic_interpreter = ELF32_DYNAMIC_INTERPRETER; + ret->dynamic_interpreter_size = sizeof ELF32_DYNAMIC_INTERPRETER; + } + + if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc, + sizeof (struct _bfd_sparc_elf_link_hash_entry))) + { + free (ret); + return NULL; + } + + return &ret->elf.root; +} + +/* Create .got and .rela.got sections in DYNOBJ, and set up + shortcuts to them in our hash table. */ + +static bfd_boolean +create_got_section (bfd *dynobj, struct bfd_link_info *info) +{ + struct _bfd_sparc_elf_link_hash_table *htab; + + if (! _bfd_elf_create_got_section (dynobj, info)) + return FALSE; + + htab = _bfd_sparc_elf_hash_table (info); + htab->sgot = bfd_get_section_by_name (dynobj, ".got"); + BFD_ASSERT (htab->sgot != NULL); + + htab->srelgot = bfd_make_section_with_flags (dynobj, ".rela.got", + SEC_ALLOC + | SEC_LOAD + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_LINKER_CREATED + | SEC_READONLY); + if (htab->srelgot == NULL + || ! bfd_set_section_alignment (dynobj, htab->srelgot, + htab->word_align_power)) + return FALSE; + + if (htab->is_vxworks) + { + htab->sgotplt = bfd_get_section_by_name (dynobj, ".got.plt"); + if (!htab->sgotplt) + return FALSE; + } + + return TRUE; +} + +/* Create .plt, .rela.plt, .got, .rela.got, .dynbss, and + .rela.bss sections in DYNOBJ, and set up shortcuts to them in our + hash table. */ + +bfd_boolean +_bfd_sparc_elf_create_dynamic_sections (bfd *dynobj, + struct bfd_link_info *info) +{ + struct _bfd_sparc_elf_link_hash_table *htab; + + htab = _bfd_sparc_elf_hash_table (info); + if (!htab->sgot && !create_got_section (dynobj, info)) + return FALSE; + + if (!_bfd_elf_create_dynamic_sections (dynobj, info)) + return FALSE; + + htab->splt = bfd_get_section_by_name (dynobj, ".plt"); + htab->srelplt = bfd_get_section_by_name (dynobj, ".rela.plt"); + htab->sdynbss = bfd_get_section_by_name (dynobj, ".dynbss"); + if (!info->shared) + htab->srelbss = bfd_get_section_by_name (dynobj, ".rela.bss"); + + if (htab->is_vxworks) + { + if (!elf_vxworks_create_dynamic_sections (dynobj, info, &htab->srelplt2)) + return FALSE; + if (info->shared) + { + htab->plt_header_size + = 4 * ARRAY_SIZE (sparc_vxworks_shared_plt0_entry); + htab->plt_entry_size + = 4 * ARRAY_SIZE (sparc_vxworks_shared_plt_entry); + } + else + { + htab->plt_header_size + = 4 * ARRAY_SIZE (sparc_vxworks_exec_plt0_entry); + htab->plt_entry_size + = 4 * ARRAY_SIZE (sparc_vxworks_exec_plt_entry); + } + } + else + { + if (ABI_64_P (dynobj)) + { + htab->build_plt_entry = sparc64_plt_entry_build; + htab->plt_header_size = PLT64_HEADER_SIZE; + htab->plt_entry_size = PLT64_ENTRY_SIZE; + } + else + { + htab->build_plt_entry = sparc32_plt_entry_build; + htab->plt_header_size = PLT32_HEADER_SIZE; + htab->plt_entry_size = PLT32_ENTRY_SIZE; + } + } + + if (!htab->splt || !htab->srelplt || !htab->sdynbss + || (!info->shared && !htab->srelbss)) + abort (); + + return TRUE; +} + +/* Copy the extra info we tack onto an elf_link_hash_entry. */ + +void +_bfd_sparc_elf_copy_indirect_symbol (struct bfd_link_info *info, + struct elf_link_hash_entry *dir, + struct elf_link_hash_entry *ind) +{ + struct _bfd_sparc_elf_link_hash_entry *edir, *eind; + + edir = (struct _bfd_sparc_elf_link_hash_entry *) dir; + eind = (struct _bfd_sparc_elf_link_hash_entry *) ind; + + if (eind->dyn_relocs != NULL) + { + if (edir->dyn_relocs != NULL) + { + struct _bfd_sparc_elf_dyn_relocs **pp; + struct _bfd_sparc_elf_dyn_relocs *p; + + /* Add reloc counts against the indirect sym to the direct sym + list. Merge any entries against the same section. */ + for (pp = &eind->dyn_relocs; (p = *pp) != NULL; ) + { + struct _bfd_sparc_elf_dyn_relocs *q; + + for (q = edir->dyn_relocs; q != NULL; q = q->next) + if (q->sec == p->sec) + { + q->pc_count += p->pc_count; + q->count += p->count; + *pp = p->next; + break; + } + if (q == NULL) + pp = &p->next; + } + *pp = edir->dyn_relocs; + } + + edir->dyn_relocs = eind->dyn_relocs; + eind->dyn_relocs = NULL; + } + + if (ind->root.type == bfd_link_hash_indirect + && dir->got.refcount <= 0) + { + edir->tls_type = eind->tls_type; + eind->tls_type = GOT_UNKNOWN; + } + _bfd_elf_link_hash_copy_indirect (info, dir, ind); +} + +static int +sparc_elf_tls_transition (struct bfd_link_info *info, bfd *abfd, + int r_type, int is_local) +{ + if (! ABI_64_P (abfd) + && r_type == R_SPARC_TLS_GD_HI22 + && ! _bfd_sparc_elf_tdata (abfd)->has_tlsgd) + r_type = R_SPARC_REV32; + + if (info->shared) + return r_type; + + switch (r_type) + { + case R_SPARC_TLS_GD_HI22: + if (is_local) + return R_SPARC_TLS_LE_HIX22; + return R_SPARC_TLS_IE_HI22; + case R_SPARC_TLS_GD_LO10: + if (is_local) + return R_SPARC_TLS_LE_LOX10; + return R_SPARC_TLS_IE_LO10; + case R_SPARC_TLS_IE_HI22: + if (is_local) + return R_SPARC_TLS_LE_HIX22; + return r_type; + case R_SPARC_TLS_IE_LO10: + if (is_local) + return R_SPARC_TLS_LE_LOX10; + return r_type; + case R_SPARC_TLS_LDM_HI22: + return R_SPARC_TLS_LE_HIX22; + case R_SPARC_TLS_LDM_LO10: + return R_SPARC_TLS_LE_LOX10; + } + + return r_type; +} + +/* Look through the relocs for a section during the first phase, and + allocate space in the global offset table or procedure linkage + table. */ + +bfd_boolean +_bfd_sparc_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, + asection *sec, const Elf_Internal_Rela *relocs) +{ + struct _bfd_sparc_elf_link_hash_table *htab; + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + bfd_vma *local_got_offsets; + const Elf_Internal_Rela *rel; + const Elf_Internal_Rela *rel_end; + asection *sreloc; + int num_relocs; + bfd_boolean checked_tlsgd = FALSE; + + if (info->relocatable) + return TRUE; + + htab = _bfd_sparc_elf_hash_table (info); + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (abfd); + local_got_offsets = elf_local_got_offsets (abfd); + + sreloc = NULL; + + if (ABI_64_P (abfd)) + num_relocs = NUM_SHDR_ENTRIES (& elf_section_data (sec)->rel_hdr); + else + num_relocs = sec->reloc_count; + rel_end = relocs + num_relocs; + for (rel = relocs; rel < rel_end; rel++) + { + unsigned int r_type; + unsigned long r_symndx; + struct elf_link_hash_entry *h; + + r_symndx = SPARC_ELF_R_SYMNDX (htab, rel->r_info); + r_type = SPARC_ELF_R_TYPE (rel->r_info); + + if (r_symndx >= NUM_SHDR_ENTRIES (symtab_hdr)) + { + (*_bfd_error_handler) (_("%B: bad symbol index: %d"), + abfd, r_symndx); + return FALSE; + } + + if (r_symndx < symtab_hdr->sh_info) + h = NULL; + 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; + } + + /* Compatibility with old R_SPARC_REV32 reloc conflicting + with R_SPARC_TLS_GD_HI22. */ + if (! ABI_64_P (abfd) && ! checked_tlsgd) + switch (r_type) + { + case R_SPARC_TLS_GD_HI22: + { + const Elf_Internal_Rela *relt; + + for (relt = rel + 1; relt < rel_end; relt++) + if (ELF32_R_TYPE (relt->r_info) == R_SPARC_TLS_GD_LO10 + || ELF32_R_TYPE (relt->r_info) == R_SPARC_TLS_GD_ADD + || ELF32_R_TYPE (relt->r_info) == R_SPARC_TLS_GD_CALL) + break; + checked_tlsgd = TRUE; + _bfd_sparc_elf_tdata (abfd)->has_tlsgd = relt < rel_end; + } + break; + case R_SPARC_TLS_GD_LO10: + case R_SPARC_TLS_GD_ADD: + case R_SPARC_TLS_GD_CALL: + checked_tlsgd = TRUE; + _bfd_sparc_elf_tdata (abfd)->has_tlsgd = TRUE; + break; + } + + r_type = sparc_elf_tls_transition (info, abfd, r_type, h == NULL); + switch (r_type) + { + case R_SPARC_TLS_LDM_HI22: + case R_SPARC_TLS_LDM_LO10: + htab->tls_ldm_got.refcount += 1; + break; + + case R_SPARC_TLS_LE_HIX22: + case R_SPARC_TLS_LE_LOX10: + if (info->shared) + goto r_sparc_plt32; + break; + + case R_SPARC_TLS_IE_HI22: + case R_SPARC_TLS_IE_LO10: + if (info->shared) + info->flags |= DF_STATIC_TLS; + /* Fall through */ + + case R_SPARC_GOT10: + case R_SPARC_GOT13: + case R_SPARC_GOT22: + case R_SPARC_TLS_GD_HI22: + case R_SPARC_TLS_GD_LO10: + /* This symbol requires a global offset table entry. */ + { + int tls_type, old_tls_type; + + switch (r_type) + { + default: + case R_SPARC_GOT10: + case R_SPARC_GOT13: + case R_SPARC_GOT22: + tls_type = GOT_NORMAL; + break; + case R_SPARC_TLS_GD_HI22: + case R_SPARC_TLS_GD_LO10: + tls_type = GOT_TLS_GD; + break; + case R_SPARC_TLS_IE_HI22: + case R_SPARC_TLS_IE_LO10: + tls_type = GOT_TLS_IE; + break; + } + + if (h != NULL) + { + h->got.refcount += 1; + old_tls_type = _bfd_sparc_elf_hash_entry(h)->tls_type; + } + else + { + bfd_signed_vma *local_got_refcounts; + + /* This is a global offset table entry for a local symbol. */ + local_got_refcounts = elf_local_got_refcounts (abfd); + if (local_got_refcounts == NULL) + { + bfd_size_type size; + + size = symtab_hdr->sh_info; + size *= (sizeof (bfd_signed_vma) + sizeof(char)); + local_got_refcounts = ((bfd_signed_vma *) + bfd_zalloc (abfd, size)); + if (local_got_refcounts == NULL) + return FALSE; + elf_local_got_refcounts (abfd) = local_got_refcounts; + _bfd_sparc_elf_local_got_tls_type (abfd) + = (char *) (local_got_refcounts + symtab_hdr->sh_info); + } + local_got_refcounts[r_symndx] += 1; + old_tls_type = _bfd_sparc_elf_local_got_tls_type (abfd) [r_symndx]; + } + + /* If a TLS symbol is accessed using IE at least once, + there is no point to use dynamic model for it. */ + if (old_tls_type != tls_type && old_tls_type != GOT_UNKNOWN + && (old_tls_type != GOT_TLS_GD + || tls_type != GOT_TLS_IE)) + { + if (old_tls_type == GOT_TLS_IE && tls_type == GOT_TLS_GD) + tls_type = old_tls_type; + else + { + (*_bfd_error_handler) + (_("%B: `%s' accessed both as normal and thread local symbol"), + abfd, h ? h->root.root.string : ""); + return FALSE; + } + } + + if (old_tls_type != tls_type) + { + if (h != NULL) + _bfd_sparc_elf_hash_entry (h)->tls_type = tls_type; + else + _bfd_sparc_elf_local_got_tls_type (abfd) [r_symndx] = tls_type; + } + } + + if (htab->sgot == NULL) + { + if (htab->elf.dynobj == NULL) + htab->elf.dynobj = abfd; + if (!create_got_section (htab->elf.dynobj, info)) + return FALSE; + } + break; + + case R_SPARC_TLS_GD_CALL: + case R_SPARC_TLS_LDM_CALL: + if (info->shared) + { + /* These are basically R_SPARC_TLS_WPLT30 relocs against + __tls_get_addr. */ + struct bfd_link_hash_entry *bh = NULL; + if (! _bfd_generic_link_add_one_symbol (info, abfd, + "__tls_get_addr", 0, + bfd_und_section_ptr, 0, + NULL, FALSE, FALSE, + &bh)) + return FALSE; + h = (struct elf_link_hash_entry *) bh; + } + else + break; + /* Fall through */ + + case R_SPARC_PLT32: + case R_SPARC_WPLT30: + case R_SPARC_HIPLT22: + case R_SPARC_LOPLT10: + case R_SPARC_PCPLT32: + case R_SPARC_PCPLT22: + case R_SPARC_PCPLT10: + case R_SPARC_PLT64: + /* This symbol requires a procedure linkage table entry. We + actually build the entry in adjust_dynamic_symbol, + because this might be a case of linking PIC code without + linking in any dynamic objects, in which case we don't + need to generate a procedure linkage table after all. */ + + if (h == NULL) + { + if (! ABI_64_P (abfd)) + { + /* The Solaris native assembler will generate a WPLT30 + reloc for a local symbol if you assemble a call from + one section to another when using -K pic. We treat + it as WDISP30. */ + if (ELF32_R_TYPE (rel->r_info) == R_SPARC_PLT32) + goto r_sparc_plt32; + break; + } + + /* It does not make sense to have a procedure linkage + table entry for a local symbol. */ + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + + h->needs_plt = 1; + + { + int this_r_type; + + this_r_type = SPARC_ELF_R_TYPE (rel->r_info); + if (this_r_type == R_SPARC_PLT32 + || this_r_type == R_SPARC_PLT64) + goto r_sparc_plt32; + } + h->plt.refcount += 1; + break; + + case R_SPARC_PC10: + case R_SPARC_PC22: + case R_SPARC_PC_HH22: + case R_SPARC_PC_HM10: + case R_SPARC_PC_LM22: + if (h != NULL) + h->non_got_ref = 1; + + if (h != NULL + && strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0) + break; + /* Fall through. */ + + case R_SPARC_DISP8: + case R_SPARC_DISP16: + case R_SPARC_DISP32: + case R_SPARC_DISP64: + case R_SPARC_WDISP30: + case R_SPARC_WDISP22: + case R_SPARC_WDISP19: + case R_SPARC_WDISP16: + case R_SPARC_8: + case R_SPARC_16: + case R_SPARC_32: + case R_SPARC_HI22: + case R_SPARC_22: + case R_SPARC_13: + case R_SPARC_LO10: + case R_SPARC_UA16: + case R_SPARC_UA32: + case R_SPARC_10: + case R_SPARC_11: + case R_SPARC_64: + case R_SPARC_OLO10: + case R_SPARC_HH22: + case R_SPARC_HM10: + case R_SPARC_LM22: + case R_SPARC_7: + case R_SPARC_5: + case R_SPARC_6: + case R_SPARC_HIX22: + case R_SPARC_LOX10: + case R_SPARC_H44: + case R_SPARC_M44: + case R_SPARC_L44: + case R_SPARC_UA64: + if (h != NULL) + h->non_got_ref = 1; + + r_sparc_plt32: + if (h != NULL && !info->shared) + { + /* We may need a .plt entry if the function this reloc + refers to is in a shared lib. */ + h->plt.refcount += 1; + } + + /* If we are creating a shared library, and this is a reloc + against a global symbol, or a non PC relative reloc + against a local symbol, then we need to copy the reloc + into the shared library. However, if we are linking with + -Bsymbolic, we do not need to copy a reloc against a + global symbol which is defined in an object we are + including in the link (i.e., DEF_REGULAR is set). At + this point we have not seen all the input files, so it is + possible that DEF_REGULAR is not set now but will be set + later (it is never cleared). In case of a weak definition, + DEF_REGULAR may be cleared later by a strong definition in + a shared library. We account for that possibility below by + storing information in the relocs_copied field of the hash + table entry. A similar situation occurs when creating + shared libraries and symbol visibility changes render the + symbol local. + + If on the other hand, we are creating an executable, we + may need to keep relocations for symbols satisfied by a + dynamic library if we manage to avoid copy relocs for the + symbol. */ + if ((info->shared + && (sec->flags & SEC_ALLOC) != 0 + && (! _bfd_sparc_elf_howto_table[r_type].pc_relative + || (h != NULL + && (! info->symbolic + || h->root.type == bfd_link_hash_defweak + || !h->def_regular)))) + || (!info->shared + && (sec->flags & SEC_ALLOC) != 0 + && h != NULL + && (h->root.type == bfd_link_hash_defweak + || !h->def_regular))) + { + struct _bfd_sparc_elf_dyn_relocs *p; + struct _bfd_sparc_elf_dyn_relocs **head; + + /* When creating a shared object, we must copy these + relocs into the output file. We create a reloc + section in dynobj and make room for the reloc. */ + if (sreloc == NULL) + { + const char *name; + bfd *dynobj; + + name = (bfd_elf_string_from_elf_section + (abfd, + elf_elfheader (abfd)->e_shstrndx, + elf_section_data (sec)->rel_hdr.sh_name)); + if (name == NULL) + return FALSE; + + BFD_ASSERT (strncmp (name, ".rela", 5) == 0 + && strcmp (bfd_get_section_name (abfd, sec), + name + 5) == 0); + + if (htab->elf.dynobj == NULL) + htab->elf.dynobj = abfd; + dynobj = htab->elf.dynobj; + + sreloc = bfd_get_section_by_name (dynobj, name); + if (sreloc == NULL) + { + flagword flags; + + flags = (SEC_HAS_CONTENTS | SEC_READONLY + | SEC_IN_MEMORY | SEC_LINKER_CREATED); + if ((sec->flags & SEC_ALLOC) != 0) + flags |= SEC_ALLOC | SEC_LOAD; + sreloc = bfd_make_section_with_flags (dynobj, + name, + flags); + if (sreloc == NULL + || ! bfd_set_section_alignment (dynobj, sreloc, + htab->word_align_power)) + return FALSE; + } + elf_section_data (sec)->sreloc = sreloc; + } + + /* If this is a global symbol, we count the number of + relocations we need for this symbol. */ + if (h != NULL) + head = &((struct _bfd_sparc_elf_link_hash_entry *) h)->dyn_relocs; + else + { + /* Track dynamic relocs needed for local syms too. + We really need local syms available to do this + easily. Oh well. */ + + asection *s; + void *vpp; + + s = bfd_section_from_r_symndx (abfd, &htab->sym_sec, + sec, r_symndx); + if (s == NULL) + return FALSE; + + vpp = &elf_section_data (s)->local_dynrel; + head = (struct _bfd_sparc_elf_dyn_relocs **) vpp; + } + + p = *head; + if (p == NULL || p->sec != sec) + { + bfd_size_type amt = sizeof *p; + p = ((struct _bfd_sparc_elf_dyn_relocs *) + bfd_alloc (htab->elf.dynobj, amt)); + if (p == NULL) + return FALSE; + p->next = *head; + *head = p; + p->sec = sec; + p->count = 0; + p->pc_count = 0; + } + + p->count += 1; + if (_bfd_sparc_elf_howto_table[r_type].pc_relative) + p->pc_count += 1; + } + + break; + + case R_SPARC_GNU_VTINHERIT: + if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset)) + return FALSE; + break; + + case R_SPARC_GNU_VTENTRY: + if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend)) + return FALSE; + break; + + case R_SPARC_REGISTER: + /* Nothing to do. */ + break; + + default: + break; + } + } + + return TRUE; +} + +asection * +_bfd_sparc_elf_gc_mark_hook (asection *sec, + struct bfd_link_info *info, + Elf_Internal_Rela *rel, + struct elf_link_hash_entry *h, + Elf_Internal_Sym *sym) +{ + if (h != NULL) + { + struct _bfd_sparc_elf_link_hash_table *htab; + + htab = _bfd_sparc_elf_hash_table (info); + switch (SPARC_ELF_R_TYPE (rel->r_info)) + { + case R_SPARC_GNU_VTINHERIT: + case R_SPARC_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 + return bfd_section_from_elf_index (sec->owner, sym->st_shndx); + + return NULL; +} + +/* Update the got entry reference counts for the section being removed. */ +bfd_boolean +_bfd_sparc_elf_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info, + asection *sec, const Elf_Internal_Rela *relocs) +{ + struct _bfd_sparc_elf_link_hash_table *htab; + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + bfd_signed_vma *local_got_refcounts; + const Elf_Internal_Rela *rel, *relend; + + elf_section_data (sec)->local_dynrel = NULL; + + htab = _bfd_sparc_elf_hash_table (info); + 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++) + { + unsigned long r_symndx; + unsigned int r_type; + struct elf_link_hash_entry *h = NULL; + + r_symndx = SPARC_ELF_R_SYMNDX (htab, rel->r_info); + if (r_symndx >= symtab_hdr->sh_info) + { + struct _bfd_sparc_elf_link_hash_entry *eh; + struct _bfd_sparc_elf_dyn_relocs **pp; + struct _bfd_sparc_elf_dyn_relocs *p; + + 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; + eh = (struct _bfd_sparc_elf_link_hash_entry *) h; + for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next) + if (p->sec == sec) + { + /* Everything must go for SEC. */ + *pp = p->next; + break; + } + } + + r_type = SPARC_ELF_R_TYPE (rel->r_info); + r_type = sparc_elf_tls_transition (info, abfd, r_type, h != NULL); + switch (r_type) + { + case R_SPARC_TLS_LDM_HI22: + case R_SPARC_TLS_LDM_LO10: + if (_bfd_sparc_elf_hash_table (info)->tls_ldm_got.refcount > 0) + _bfd_sparc_elf_hash_table (info)->tls_ldm_got.refcount -= 1; + break; + + case R_SPARC_TLS_GD_HI22: + case R_SPARC_TLS_GD_LO10: + case R_SPARC_TLS_IE_HI22: + case R_SPARC_TLS_IE_LO10: + case R_SPARC_GOT10: + case R_SPARC_GOT13: + case R_SPARC_GOT22: + if (h != NULL) + { + if (h->got.refcount > 0) + h->got.refcount--; + } + else + { + if (local_got_refcounts[r_symndx] > 0) + local_got_refcounts[r_symndx]--; + } + break; + + case R_SPARC_PC10: + case R_SPARC_PC22: + case R_SPARC_PC_HH22: + case R_SPARC_PC_HM10: + case R_SPARC_PC_LM22: + if (h != NULL + && strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0) + break; + /* Fall through. */ + + case R_SPARC_DISP8: + case R_SPARC_DISP16: + case R_SPARC_DISP32: + case R_SPARC_DISP64: + case R_SPARC_WDISP30: + case R_SPARC_WDISP22: + case R_SPARC_WDISP19: + case R_SPARC_WDISP16: + case R_SPARC_8: + case R_SPARC_16: + case R_SPARC_32: + case R_SPARC_HI22: + case R_SPARC_22: + case R_SPARC_13: + case R_SPARC_LO10: + case R_SPARC_UA16: + case R_SPARC_UA32: + case R_SPARC_PLT32: + case R_SPARC_10: + case R_SPARC_11: + case R_SPARC_64: + case R_SPARC_OLO10: + case R_SPARC_HH22: + case R_SPARC_HM10: + case R_SPARC_LM22: + case R_SPARC_7: + case R_SPARC_5: + case R_SPARC_6: + case R_SPARC_HIX22: + case R_SPARC_LOX10: + case R_SPARC_H44: + case R_SPARC_M44: + case R_SPARC_L44: + case R_SPARC_UA64: + if (info->shared) + break; + /* Fall through. */ + + case R_SPARC_WPLT30: + if (h != NULL) + { + if (h->plt.refcount > 0) + h->plt.refcount--; + } + break; + + default: + break; + } + } + + return TRUE; +} + +/* Adjust a symbol defined by a dynamic object and referenced by a + regular object. The current definition is in some section of the + dynamic object, but we're not including those sections. We have to + change the definition to something the rest of the link can + understand. */ + +bfd_boolean +_bfd_sparc_elf_adjust_dynamic_symbol (struct bfd_link_info *info, + struct elf_link_hash_entry *h) +{ + struct _bfd_sparc_elf_link_hash_table *htab; + struct _bfd_sparc_elf_link_hash_entry * eh; + struct _bfd_sparc_elf_dyn_relocs *p; + asection *s; + unsigned int power_of_two; + + htab = _bfd_sparc_elf_hash_table (info); + + /* Make sure we know what is going on here. */ + BFD_ASSERT (htab->elf.dynobj != NULL + && (h->needs_plt + || h->u.weakdef != NULL + || (h->def_dynamic + && h->ref_regular + && !h->def_regular))); + + /* If this is a function, put it in the procedure linkage table. We + will fill in the contents of the procedure linkage table later + (although we could actually do it here). The STT_NOTYPE + condition is a hack specifically for the Oracle libraries + delivered for Solaris; for some inexplicable reason, they define + some of their functions as STT_NOTYPE when they really should be + STT_FUNC. */ + if (h->type == STT_FUNC + || h->needs_plt + || (h->type == STT_NOTYPE + && (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + && (h->root.u.def.section->flags & SEC_CODE) != 0)) + { + if (h->plt.refcount <= 0 + || (! info->shared + && !h->def_dynamic + && !h->ref_dynamic + && h->root.type != bfd_link_hash_undefweak + && h->root.type != bfd_link_hash_undefined)) + { + /* This case can occur if we saw a WPLT30 reloc in an input + file, but the symbol was never referred to by a dynamic + object, or if all references were garbage collected. In + such a case, we don't actually need to build a procedure + linkage table, and we can just do a WDISP30 reloc instead. */ + h->plt.offset = (bfd_vma) -1; + h->needs_plt = 0; + } + + return TRUE; + } + else + h->plt.offset = (bfd_vma) -1; + + /* If this is a weak symbol, and there is a real definition, the + processor independent code will have arranged for us to see the + real definition first, and we can just use the same value. */ + if (h->u.weakdef != NULL) + { + BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined + || h->u.weakdef->root.type == bfd_link_hash_defweak); + h->root.u.def.section = h->u.weakdef->root.u.def.section; + h->root.u.def.value = h->u.weakdef->root.u.def.value; + return TRUE; + } + + /* This is a reference to a symbol defined by a dynamic object which + is not a function. */ + + /* If we are creating a shared library, we must presume that the + only references to the symbol are via the global offset table. + For such cases we need not do anything here; the relocations will + be handled correctly by relocate_section. */ + if (info->shared) + return TRUE; + + /* If there are no references to this symbol that do not use the + GOT, we don't need to generate a copy reloc. */ + if (!h->non_got_ref) + return TRUE; + + eh = (struct _bfd_sparc_elf_link_hash_entry *) h; + for (p = eh->dyn_relocs; p != NULL; p = p->next) + { + s = p->sec->output_section; + if (s != NULL && (s->flags & SEC_READONLY) != 0) + break; + } + + /* If we didn't find any dynamic relocs in read-only sections, then + we'll be keeping the dynamic relocs and avoiding the copy reloc. */ + if (p == NULL) + { + h->non_got_ref = 0; + return TRUE; + } + + if (h->size == 0) + { + (*_bfd_error_handler) (_("dynamic variable `%s' is zero size"), + h->root.root.string); + return TRUE; + } + + /* We must allocate the symbol in our .dynbss section, which will + become part of the .bss section of the executable. There will be + an entry for this symbol in the .dynsym section. The dynamic + object will contain position independent code, so all references + from the dynamic object to this symbol will go through the global + offset table. The dynamic linker will use the .dynsym entry to + determine the address it must put in the global offset table, so + both the dynamic object and the regular object will refer to the + same memory location for the variable. */ + + /* We must generate a R_SPARC_COPY reloc to tell the dynamic linker + to copy the initial value out of the dynamic object and into the + runtime process image. We need to remember the offset into the + .rel.bss section we are going to use. */ + if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) + { + htab->srelbss->size += SPARC_ELF_RELA_BYTES (htab); + h->needs_copy = 1; + } + + /* We need to figure out the alignment required for this symbol. I + have no idea how ELF linkers handle this. */ + power_of_two = bfd_log2 (h->size); + if (power_of_two > htab->align_power_max) + power_of_two = htab->align_power_max; + + /* Apply the required alignment. */ + s = htab->sdynbss; + s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two)); + if (power_of_two > bfd_get_section_alignment (dynobj, s)) + { + if (! bfd_set_section_alignment (dynobj, s, power_of_two)) + return FALSE; + } + + /* Define the symbol as being at this point in the section. */ + h->root.u.def.section = s; + h->root.u.def.value = s->size; + + /* Increment the section size to make room for the symbol. */ + s->size += h->size; + + return TRUE; +} + +/* Allocate space in .plt, .got and associated reloc sections for + dynamic relocs. */ + +static bfd_boolean +allocate_dynrelocs (struct elf_link_hash_entry *h, PTR inf) +{ + struct bfd_link_info *info; + struct _bfd_sparc_elf_link_hash_table *htab; + struct _bfd_sparc_elf_link_hash_entry *eh; + struct _bfd_sparc_elf_dyn_relocs *p; + + if (h->root.type == bfd_link_hash_indirect) + return TRUE; + + if (h->root.type == bfd_link_hash_warning) + /* When warning symbols are created, they **replace** the "real" + entry in the hash table, thus we never get to see the real + symbol in a hash traversal. So look at it now. */ + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + info = (struct bfd_link_info *) inf; + htab = _bfd_sparc_elf_hash_table (info); + + if (htab->elf.dynamic_sections_created + && h->plt.refcount > 0) + { + /* Make sure this symbol is output as a dynamic symbol. + Undefined weak syms won't yet be marked as dynamic. */ + if (h->dynindx == -1 + && !h->forced_local) + { + if (! bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } + + if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info->shared, h)) + { + asection *s = htab->splt; + + /* Allocate room for the header. */ + if (s->size == 0) + { + s->size = htab->plt_header_size; + + /* Allocate space for the .rela.plt.unloaded relocations. */ + if (htab->is_vxworks && !info->shared) + htab->srelplt2->size = sizeof (Elf32_External_Rela) * 2; + } + + /* The procedure linkage table size is bounded by the magnitude + of the offset we can describe in the entry. */ + if (s->size >= (SPARC_ELF_WORD_BYTES(htab) == 8 ? + (((bfd_vma)1 << 31) << 1) : 0x400000)) + { + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + + if (SPARC_ELF_WORD_BYTES(htab) == 8 + && s->size >= PLT64_LARGE_THRESHOLD * PLT64_ENTRY_SIZE) + { + bfd_vma off = s->size - PLT64_LARGE_THRESHOLD * PLT64_ENTRY_SIZE; + + + off = (off % (160 * PLT64_ENTRY_SIZE)) / PLT64_ENTRY_SIZE; + + h->plt.offset = (s->size - (off * 8)); + } + else + h->plt.offset = s->size; + + /* If this symbol is not defined in a regular file, and we are + not generating a shared library, then set the symbol to this + location in the .plt. This is required to make function + pointers compare as equal between the normal executable and + the shared library. */ + if (! info->shared + && !h->def_regular) + { + h->root.u.def.section = s; + h->root.u.def.value = h->plt.offset; + } + + /* Make room for this entry. */ + s->size += htab->plt_entry_size; + + /* We also need to make an entry in the .rela.plt section. */ + htab->srelplt->size += SPARC_ELF_RELA_BYTES (htab); + + if (htab->is_vxworks) + { + /* Allocate space for the .got.plt entry. */ + htab->sgotplt->size += 4; + + /* ...and for the .rela.plt.unloaded relocations. */ + if (!info->shared) + htab->srelplt2->size += sizeof (Elf32_External_Rela) * 3; + } + } + else + { + h->plt.offset = (bfd_vma) -1; + h->needs_plt = 0; + } + } + else + { + h->plt.offset = (bfd_vma) -1; + h->needs_plt = 0; + } + + /* If R_SPARC_TLS_IE_{HI22,LO10} symbol is now local to the binary, + make it a R_SPARC_TLS_LE_{HI22,LO10} requiring no TLS entry. */ + if (h->got.refcount > 0 + && !info->shared + && h->dynindx == -1 + && _bfd_sparc_elf_hash_entry(h)->tls_type == GOT_TLS_IE) + h->got.offset = (bfd_vma) -1; + else if (h->got.refcount > 0) + { + asection *s; + bfd_boolean dyn; + int tls_type = _bfd_sparc_elf_hash_entry(h)->tls_type; + + /* Make sure this symbol is output as a dynamic symbol. + Undefined weak syms won't yet be marked as dynamic. */ + if (h->dynindx == -1 + && !h->forced_local) + { + if (! bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } + + s = htab->sgot; + h->got.offset = s->size; + s->size += SPARC_ELF_WORD_BYTES (htab); + /* R_SPARC_TLS_GD_HI{22,LO10} needs 2 consecutive GOT slots. */ + if (tls_type == GOT_TLS_GD) + s->size += SPARC_ELF_WORD_BYTES (htab); + dyn = htab->elf.dynamic_sections_created; + /* R_SPARC_TLS_IE_{HI22,LO10} needs one dynamic relocation, + R_SPARC_TLS_GD_{HI22,LO10} needs one if local symbol and two if + global. */ + if ((tls_type == GOT_TLS_GD && h->dynindx == -1) + || tls_type == GOT_TLS_IE) + htab->srelgot->size += SPARC_ELF_RELA_BYTES (htab); + else if (tls_type == GOT_TLS_GD) + htab->srelgot->size += 2 * SPARC_ELF_RELA_BYTES (htab); + else if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)) + htab->srelgot->size += SPARC_ELF_RELA_BYTES (htab); + } + else + h->got.offset = (bfd_vma) -1; + + eh = (struct _bfd_sparc_elf_link_hash_entry *) h; + if (eh->dyn_relocs == NULL) + return TRUE; + + /* In the shared -Bsymbolic case, discard space allocated for + dynamic pc-relative relocs against symbols which turn out to be + defined in regular objects. For the normal shared case, discard + space for pc-relative relocs that have become local due to symbol + visibility changes. */ + + if (info->shared) + { + if (h->def_regular + && (h->forced_local + || info->symbolic)) + { + struct _bfd_sparc_elf_dyn_relocs **pp; + + for (pp = &eh->dyn_relocs; (p = *pp) != NULL; ) + { + p->count -= p->pc_count; + p->pc_count = 0; + if (p->count == 0) + *pp = p->next; + else + pp = &p->next; + } + } + + /* Also discard relocs on undefined weak syms with non-default + visibility. */ + if (eh->dyn_relocs != NULL + && h->root.type == bfd_link_hash_undefweak) + { + if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT) + eh->dyn_relocs = NULL; + + /* Make sure undefined weak symbols are output as a dynamic + symbol in PIEs. */ + else if (h->dynindx == -1 + && !h->forced_local) + { + if (! bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } + } + } + else + { + /* For the non-shared case, discard space for relocs against + symbols which turn out to need copy relocs or are not + dynamic. */ + + if (!h->non_got_ref + && ((h->def_dynamic + && !h->def_regular) + || (htab->elf.dynamic_sections_created + && (h->root.type == bfd_link_hash_undefweak + || h->root.type == bfd_link_hash_undefined)))) + { + /* Make sure this symbol is output as a dynamic symbol. + Undefined weak syms won't yet be marked as dynamic. */ + if (h->dynindx == -1 + && !h->forced_local) + { + if (! bfd_elf_link_record_dynamic_symbol (info, h)) + return FALSE; + } + + /* If that succeeded, we know we'll be keeping all the + relocs. */ + if (h->dynindx != -1) + goto keep; + } + + eh->dyn_relocs = NULL; + + keep: ; + } + + /* Finally, allocate space. */ + for (p = eh->dyn_relocs; p != NULL; p = p->next) + { + asection *sreloc = elf_section_data (p->sec)->sreloc; + sreloc->size += p->count * SPARC_ELF_RELA_BYTES (htab); + } + + return TRUE; +} + +/* Find any dynamic relocs that apply to read-only sections. */ + +static bfd_boolean +readonly_dynrelocs (struct elf_link_hash_entry *h, PTR inf) +{ + struct _bfd_sparc_elf_link_hash_entry *eh; + struct _bfd_sparc_elf_dyn_relocs *p; + + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + eh = (struct _bfd_sparc_elf_link_hash_entry *) h; + for (p = eh->dyn_relocs; p != NULL; p = p->next) + { + asection *s = p->sec->output_section; + + if (s != NULL && (s->flags & SEC_READONLY) != 0) + { + struct bfd_link_info *info = (struct bfd_link_info *) inf; + + info->flags |= DF_TEXTREL; + + /* Not an error, just cut short the traversal. */ + return FALSE; + } + } + return TRUE; +} + +/* Return true if the dynamic symbol for a given section should be + omitted when creating a shared library. */ + +bfd_boolean +_bfd_sparc_elf_omit_section_dynsym (bfd *output_bfd, + struct bfd_link_info *info, + asection *p) +{ + /* We keep the .got section symbol so that explicit relocations + against the _GLOBAL_OFFSET_TABLE_ symbol emitted in PIC mode + can be turned into relocations against the .got symbol. */ + if (strcmp (p->name, ".got") == 0) + return FALSE; + + return _bfd_elf_link_omit_section_dynsym (output_bfd, info, p); +} + +/* Set the sizes of the dynamic sections. */ + +bfd_boolean +_bfd_sparc_elf_size_dynamic_sections (bfd *output_bfd, + struct bfd_link_info *info) +{ + struct _bfd_sparc_elf_link_hash_table *htab; + bfd *dynobj; + asection *s; + bfd *ibfd; + + htab = _bfd_sparc_elf_hash_table (info); + dynobj = htab->elf.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->executable) + { + s = bfd_get_section_by_name (dynobj, ".interp"); + BFD_ASSERT (s != NULL); + s->size = htab->dynamic_interpreter_size; + s->contents = (unsigned char *) htab->dynamic_interpreter; + } + } + + /* Set up .got offsets for local syms, and space for local dynamic + relocs. */ + for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) + { + bfd_signed_vma *local_got; + bfd_signed_vma *end_local_got; + char *local_tls_type; + bfd_size_type locsymcount; + Elf_Internal_Shdr *symtab_hdr; + asection *srel; + + if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour) + continue; + + for (s = ibfd->sections; s != NULL; s = s->next) + { + struct _bfd_sparc_elf_dyn_relocs *p; + + for (p = elf_section_data (s)->local_dynrel; p != NULL; p = p->next) + { + if (!bfd_is_abs_section (p->sec) + && bfd_is_abs_section (p->sec->output_section)) + { + /* Input section has been discarded, either because + it is a copy of a linkonce section or due to + linker script /DISCARD/, so we'll be discarding + the relocs too. */ + } + else if (p->count != 0) + { + srel = elf_section_data (p->sec)->sreloc; + srel->size += p->count * SPARC_ELF_RELA_BYTES (htab); + if ((p->sec->output_section->flags & SEC_READONLY) != 0) + info->flags |= DF_TEXTREL; + } + } + } + + local_got = elf_local_got_refcounts (ibfd); + if (!local_got) + continue; + + symtab_hdr = &elf_tdata (ibfd)->symtab_hdr; + locsymcount = symtab_hdr->sh_info; + end_local_got = local_got + locsymcount; + local_tls_type = _bfd_sparc_elf_local_got_tls_type (ibfd); + s = htab->sgot; + srel = htab->srelgot; + for (; local_got < end_local_got; ++local_got, ++local_tls_type) + { + if (*local_got > 0) + { + *local_got = s->size; + s->size += SPARC_ELF_WORD_BYTES (htab); + if (*local_tls_type == GOT_TLS_GD) + s->size += SPARC_ELF_WORD_BYTES (htab); + if (info->shared + || *local_tls_type == GOT_TLS_GD + || *local_tls_type == GOT_TLS_IE) + srel->size += SPARC_ELF_RELA_BYTES (htab); + } + else + *local_got = (bfd_vma) -1; + } + } + + if (htab->tls_ldm_got.refcount > 0) + { + /* Allocate 2 got entries and 1 dynamic reloc for + R_SPARC_TLS_LDM_{HI22,LO10} relocs. */ + htab->tls_ldm_got.offset = htab->sgot->size; + htab->sgot->size += (2 * SPARC_ELF_WORD_BYTES (htab)); + htab->srelgot->size += SPARC_ELF_RELA_BYTES (htab); + } + else + htab->tls_ldm_got.offset = -1; + + /* Allocate global sym .plt and .got entries, and space for global + sym dynamic relocs. */ + elf_link_hash_traverse (&htab->elf, allocate_dynrelocs, (PTR) info); + + if (! ABI_64_P (output_bfd) + && !htab->is_vxworks + && elf_hash_table (info)->dynamic_sections_created) + { + /* Make space for the trailing nop in .plt. */ + if (htab->splt->size > 0) + htab->splt->size += 1 * SPARC_INSN_BYTES; + + /* If the .got section is more than 0x1000 bytes, we add + 0x1000 to the value of _GLOBAL_OFFSET_TABLE_, so that 13 + bit relocations have a greater chance of working. + + FIXME: Make this optimization work for 64-bit too. */ + if (htab->sgot->size >= 0x1000 + && elf_hash_table (info)->hgot->root.u.def.value == 0) + elf_hash_table (info)->hgot->root.u.def.value = 0x1000; + } + + /* The check_relocs and adjust_dynamic_symbol entry points have + determined the sizes of the various dynamic sections. Allocate + memory for them. */ + for (s = dynobj->sections; s != NULL; s = s->next) + { + if ((s->flags & SEC_LINKER_CREATED) == 0) + continue; + + if (s == htab->splt + || s == htab->sgot + || s == htab->sdynbss + || s == htab->sgotplt) + { + /* Strip this section if we don't need it; see the + comment below. */ + } + else if (strncmp (s->name, ".rela", 5) == 0) + { + if (s->size != 0) + { + /* We use the reloc_count field as a counter if we need + to copy relocs into the output file. */ + s->reloc_count = 0; + } + } + else + { + /* It's not one of our sections. */ + continue; + } + + if (s->size == 0) + { + /* If we don't need this section, strip it from the + output file. This is mostly to handle .rela.bss and + .rela.plt. We must create both sections in + create_dynamic_sections, because they must be created + before the linker maps input sections to output + sections. The linker does that before + adjust_dynamic_symbol is called, and it is that + function which decides whether anything needs to go + into these sections. */ + s->flags |= SEC_EXCLUDE; + continue; + } + + if ((s->flags & SEC_HAS_CONTENTS) == 0) + continue; + + /* Allocate memory for the section contents. Zero the memory + for the benefit of .rela.plt, which has 4 unused entries + at the beginning, and we don't want garbage. */ + s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->size); + if (s->contents == NULL) + return FALSE; + } + + if (elf_hash_table (info)->dynamic_sections_created) + { + /* Add some entries to the .dynamic section. We fill in the + values later, in _bfd_sparc_elf_finish_dynamic_sections, but we + must add the entries now so that we get the correct size for + the .dynamic section. The DT_DEBUG entry is filled in by the + dynamic linker and used by the debugger. */ +#define add_dynamic_entry(TAG, VAL) \ + _bfd_elf_add_dynamic_entry (info, TAG, VAL) + + if (info->executable) + { + if (!add_dynamic_entry (DT_DEBUG, 0)) + return FALSE; + } + + if (htab->srelplt->size != 0) + { + if (!add_dynamic_entry (DT_PLTGOT, 0) + || !add_dynamic_entry (DT_PLTRELSZ, 0) + || !add_dynamic_entry (DT_PLTREL, DT_RELA) + || !add_dynamic_entry (DT_JMPREL, 0)) + return FALSE; + } + + if (!add_dynamic_entry (DT_RELA, 0) + || !add_dynamic_entry (DT_RELASZ, 0) + || !add_dynamic_entry (DT_RELAENT, + SPARC_ELF_RELA_BYTES (htab))) + return FALSE; + + /* If any dynamic relocs apply to a read-only section, + then we need a DT_TEXTREL entry. */ + if ((info->flags & DF_TEXTREL) == 0) + elf_link_hash_traverse (&htab->elf, readonly_dynrelocs, + (PTR) info); + + if (info->flags & DF_TEXTREL) + { + if (!add_dynamic_entry (DT_TEXTREL, 0)) + return FALSE; + } + + if (ABI_64_P (output_bfd)) + { + int reg; + struct _bfd_sparc_elf_app_reg * app_regs; + struct elf_strtab_hash *dynstr; + struct elf_link_hash_table *eht = elf_hash_table (info); + + /* Add dynamic STT_REGISTER symbols and corresponding DT_SPARC_REGISTER + entries if needed. */ + app_regs = _bfd_sparc_elf_hash_table (info)->app_regs; + dynstr = eht->dynstr; + + for (reg = 0; reg < 4; reg++) + if (app_regs [reg].name != NULL) + { + struct elf_link_local_dynamic_entry *entry, *e; + + if (!add_dynamic_entry (DT_SPARC_REGISTER, 0)) + return FALSE; + + entry = (struct elf_link_local_dynamic_entry *) + bfd_hash_allocate (&info->hash->table, sizeof (*entry)); + if (entry == NULL) + return FALSE; + + /* We cheat here a little bit: the symbol will not be local, so we + put it at the end of the dynlocal linked list. We will fix it + later on, as we have to fix other fields anyway. */ + entry->isym.st_value = reg < 2 ? reg + 2 : reg + 4; + entry->isym.st_size = 0; + if (*app_regs [reg].name != '\0') + entry->isym.st_name + = _bfd_elf_strtab_add (dynstr, app_regs[reg].name, FALSE); + else + entry->isym.st_name = 0; + entry->isym.st_other = 0; + entry->isym.st_info = ELF_ST_INFO (app_regs [reg].bind, + STT_REGISTER); + entry->isym.st_shndx = app_regs [reg].shndx; + entry->next = NULL; + entry->input_bfd = output_bfd; + entry->input_indx = -1; + + if (eht->dynlocal == NULL) + eht->dynlocal = entry; + else + { + for (e = eht->dynlocal; e->next; e = e->next) + ; + e->next = entry; + } + eht->dynsymcount++; + } + } + } +#undef add_dynamic_entry + + return TRUE; +} + +bfd_boolean +_bfd_sparc_elf_new_section_hook (bfd *abfd, asection *sec) +{ + struct _bfd_sparc_elf_section_data *sdata; + bfd_size_type amt = sizeof (*sdata); + + sdata = (struct _bfd_sparc_elf_section_data *) bfd_zalloc (abfd, amt); + if (sdata == NULL) + return FALSE; + sec->used_by_bfd = (PTR) sdata; + + return _bfd_elf_new_section_hook (abfd, sec); +} + +bfd_boolean +_bfd_sparc_elf_relax_section (bfd *abfd ATTRIBUTE_UNUSED, + struct bfd_section *section, + struct bfd_link_info *link_info ATTRIBUTE_UNUSED, + bfd_boolean *again) +{ + *again = FALSE; + sec_do_relax (section) = 1; + return TRUE; +} + +/* Return the base VMA address which should be subtracted from real addresses + when resolving @dtpoff relocation. + This is PT_TLS segment p_vaddr. */ + +static bfd_vma +dtpoff_base (struct bfd_link_info *info) +{ + /* If tls_sec is NULL, we should have signalled an error already. */ + if (elf_hash_table (info)->tls_sec == NULL) + return 0; + return elf_hash_table (info)->tls_sec->vma; +} + +/* Return the relocation value for @tpoff relocation + if STT_TLS virtual address is ADDRESS. */ + +static bfd_vma +tpoff (struct bfd_link_info *info, bfd_vma address) +{ + struct elf_link_hash_table *htab = elf_hash_table (info); + + /* If tls_sec is NULL, we should have signalled an error already. */ + if (htab->tls_sec == NULL) + return 0; + return address - htab->tls_size - htab->tls_sec->vma; +} + +/* Relocate a SPARC ELF section. */ + +bfd_boolean +_bfd_sparc_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, + bfd *input_bfd, asection *input_section, + bfd_byte *contents, Elf_Internal_Rela *relocs, + Elf_Internal_Sym *local_syms, asection **local_sections) +{ + struct _bfd_sparc_elf_link_hash_table *htab; + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + bfd_vma *local_got_offsets; + bfd_vma got_base; + asection *sreloc; + Elf_Internal_Rela *rel; + Elf_Internal_Rela *relend; + int num_relocs; + + if (info->relocatable) + return TRUE; + + htab = _bfd_sparc_elf_hash_table (info); + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (input_bfd); + local_got_offsets = elf_local_got_offsets (input_bfd); + + if (elf_hash_table (info)->hgot == NULL) + got_base = 0; + else + got_base = elf_hash_table (info)->hgot->root.u.def.value; + + sreloc = elf_section_data (input_section)->sreloc; + + rel = relocs; + if (ABI_64_P (output_bfd)) + num_relocs = NUM_SHDR_ENTRIES (& elf_section_data (input_section)->rel_hdr); + else + num_relocs = input_section->reloc_count; + relend = relocs + num_relocs; + for (; rel < relend; rel++) + { + int r_type, tls_type; + reloc_howto_type *howto; + unsigned long r_symndx; + struct elf_link_hash_entry *h; + Elf_Internal_Sym *sym; + asection *sec; + bfd_vma relocation, off; + bfd_reloc_status_type r; + bfd_boolean is_plt = FALSE; + bfd_boolean unresolved_reloc; + + r_type = SPARC_ELF_R_TYPE (rel->r_info); + if (r_type == R_SPARC_GNU_VTINHERIT + || r_type == R_SPARC_GNU_VTENTRY) + continue; + + if (r_type < 0 || r_type >= (int) R_SPARC_max_std) + { + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + howto = _bfd_sparc_elf_howto_table + r_type; + + /* This is a final link. */ + r_symndx = SPARC_ELF_R_SYMNDX (htab, rel->r_info); + h = NULL; + sym = NULL; + sec = NULL; + unresolved_reloc = FALSE; + if (r_symndx < symtab_hdr->sh_info) + { + sym = local_syms + r_symndx; + sec = local_sections[r_symndx]; + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + } + else + { + bfd_boolean warned; + + RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel, + r_symndx, symtab_hdr, sym_hashes, + h, sec, relocation, + unresolved_reloc, warned); + if (warned) + { + /* To avoid generating warning messages about truncated + relocations, set the relocation's address to be the same as + the start of this section. */ + if (input_section->output_section != NULL) + relocation = input_section->output_section->vma; + else + relocation = 0; + } + } + + switch (r_type) + { + case R_SPARC_GOT10: + case R_SPARC_GOT13: + case R_SPARC_GOT22: + /* Relocation is to the entry for this symbol in the global + offset table. */ + if (htab->sgot == NULL) + abort (); + + if (h != NULL) + { + bfd_boolean dyn; + + off = h->got.offset; + BFD_ASSERT (off != (bfd_vma) -1); + dyn = elf_hash_table (info)->dynamic_sections_created; + + if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h) + || (info->shared + && (info->symbolic + || h->dynindx == -1 + || h->forced_local) + && h->def_regular)) + { + /* This is actually a static link, or it is a + -Bsymbolic link and the symbol is defined + locally, or the symbol was forced to be local + because of a version file. We must initialize + this entry in the global offset table. Since the + offset must always be a multiple of 8 for 64-bit + and 4 for 32-bit, we use the least significant bit + to record whether we have initialized it already. + + When doing a dynamic link, we create a .rela.got + relocation entry to initialize the value. This + is done in the finish_dynamic_symbol routine. */ + if ((off & 1) != 0) + off &= ~1; + else + { + SPARC_ELF_PUT_WORD (htab, output_bfd, relocation, + htab->sgot->contents + off); + h->got.offset |= 1; + } + } + else + unresolved_reloc = FALSE; + } + else + { + BFD_ASSERT (local_got_offsets != NULL + && local_got_offsets[r_symndx] != (bfd_vma) -1); + + off = local_got_offsets[r_symndx]; + + /* The offset must always be a multiple of 8 on 64-bit and + 4 on 32-bit. We use the least significant bit to record + whether we have already processed this entry. */ + if ((off & 1) != 0) + off &= ~1; + else + { + + if (info->shared) + { + asection *s; + Elf_Internal_Rela outrel; + + /* We need to generate a R_SPARC_RELATIVE reloc + for the dynamic linker. */ + s = htab->srelgot; + BFD_ASSERT (s != NULL); + + outrel.r_offset = (htab->sgot->output_section->vma + + htab->sgot->output_offset + + off); + outrel.r_info = SPARC_ELF_R_INFO (htab, NULL, + 0, R_SPARC_RELATIVE); + outrel.r_addend = relocation; + relocation = 0; + SPARC_ELF_APPEND_RELA (htab, output_bfd, s, &outrel); + } + + SPARC_ELF_PUT_WORD (htab, output_bfd, relocation, + htab->sgot->contents + off); + local_got_offsets[r_symndx] |= 1; + } + } + relocation = htab->sgot->output_offset + off - got_base; + break; + + case R_SPARC_PLT32: + case R_SPARC_PLT64: + if (h == NULL || h->plt.offset == (bfd_vma) -1) + { + r_type = (r_type == R_SPARC_PLT32) ? R_SPARC_32 : R_SPARC_64; + goto r_sparc_plt32; + } + /* Fall through. */ + + case R_SPARC_WPLT30: + case R_SPARC_HIPLT22: + case R_SPARC_LOPLT10: + case R_SPARC_PCPLT32: + case R_SPARC_PCPLT22: + case R_SPARC_PCPLT10: + r_sparc_wplt30: + /* Relocation is to the entry for this symbol in the + procedure linkage table. */ + + if (! ABI_64_P (output_bfd)) + { + /* The Solaris native assembler will generate a WPLT30 reloc + for a local symbol if you assemble a call from one + section to another when using -K pic. We treat it as + WDISP30. */ + if (h == NULL) + break; + } + else + { + BFD_ASSERT (h != NULL); + } + + if (h->plt.offset == (bfd_vma) -1 || htab->splt == NULL) + { + /* We didn't make a PLT entry for this symbol. This + happens when statically linking PIC code, or when + using -Bsymbolic. */ + break; + } + + relocation = (htab->splt->output_section->vma + + htab->splt->output_offset + + h->plt.offset); + unresolved_reloc = FALSE; + if (r_type == R_SPARC_PLT32 || r_type == R_SPARC_PLT64) + { + r_type = r_type == R_SPARC_PLT32 ? R_SPARC_32 : R_SPARC_64; + is_plt = TRUE; + goto r_sparc_plt32; + } + break; + + case R_SPARC_PC10: + case R_SPARC_PC22: + case R_SPARC_PC_HH22: + case R_SPARC_PC_HM10: + case R_SPARC_PC_LM22: + if (h != NULL + && strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0) + break; + /* Fall through. */ + case R_SPARC_DISP8: + case R_SPARC_DISP16: + case R_SPARC_DISP32: + case R_SPARC_DISP64: + case R_SPARC_WDISP30: + case R_SPARC_WDISP22: + case R_SPARC_WDISP19: + case R_SPARC_WDISP16: + case R_SPARC_8: + case R_SPARC_16: + case R_SPARC_32: + case R_SPARC_HI22: + case R_SPARC_22: + case R_SPARC_13: + case R_SPARC_LO10: + case R_SPARC_UA16: + case R_SPARC_UA32: + case R_SPARC_10: + case R_SPARC_11: + case R_SPARC_64: + case R_SPARC_OLO10: + case R_SPARC_HH22: + case R_SPARC_HM10: + case R_SPARC_LM22: + case R_SPARC_7: + case R_SPARC_5: + case R_SPARC_6: + case R_SPARC_HIX22: + case R_SPARC_LOX10: + case R_SPARC_H44: + case R_SPARC_M44: + case R_SPARC_L44: + case R_SPARC_UA64: + r_sparc_plt32: + /* r_symndx will be zero only for relocs against symbols + from removed linkonce sections, or sections discarded by + a linker script. */ + if (r_symndx == 0 + || (input_section->flags & SEC_ALLOC) == 0) + break; + + if ((info->shared + && (h == NULL + || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT + || h->root.type != bfd_link_hash_undefweak) + && (! howto->pc_relative + || (h != NULL + && h->dynindx != -1 + && (! info->symbolic + || !h->def_regular)))) + || (!info->shared + && h != NULL + && h->dynindx != -1 + && !h->non_got_ref + && ((h->def_dynamic + && !h->def_regular) + || h->root.type == bfd_link_hash_undefweak + || h->root.type == bfd_link_hash_undefined))) + { + Elf_Internal_Rela outrel; + bfd_boolean skip, relocate = FALSE; + + /* When generating a shared object, these relocations + are copied into the output file to be resolved at run + time. */ + + BFD_ASSERT (sreloc != NULL); + + skip = FALSE; + + outrel.r_offset = + _bfd_elf_section_offset (output_bfd, info, input_section, + rel->r_offset); + if (outrel.r_offset == (bfd_vma) -1) + skip = TRUE; + else if (outrel.r_offset == (bfd_vma) -2) + skip = TRUE, relocate = TRUE; + outrel.r_offset += (input_section->output_section->vma + + input_section->output_offset); + + /* Optimize unaligned reloc usage now that we know where + it finally resides. */ + switch (r_type) + { + case R_SPARC_16: + if (outrel.r_offset & 1) + r_type = R_SPARC_UA16; + break; + case R_SPARC_UA16: + if (!(outrel.r_offset & 1)) + r_type = R_SPARC_16; + break; + case R_SPARC_32: + if (outrel.r_offset & 3) + r_type = R_SPARC_UA32; + break; + case R_SPARC_UA32: + if (!(outrel.r_offset & 3)) + r_type = R_SPARC_32; + break; + case R_SPARC_64: + if (outrel.r_offset & 7) + r_type = R_SPARC_UA64; + break; + case R_SPARC_UA64: + if (!(outrel.r_offset & 7)) + r_type = R_SPARC_64; + break; + case R_SPARC_DISP8: + case R_SPARC_DISP16: + case R_SPARC_DISP32: + case R_SPARC_DISP64: + /* If the symbol is not dynamic, we should not keep + a dynamic relocation. But an .rela.* slot has been + allocated for it, output R_SPARC_NONE. + FIXME: Add code tracking needed dynamic relocs as + e.g. i386 has. */ + if (h->dynindx == -1) + skip = TRUE, relocate = TRUE; + break; + } + + if (skip) + memset (&outrel, 0, sizeof outrel); + /* h->dynindx may be -1 if the symbol was marked to + become local. */ + else if (h != NULL && ! is_plt + && ((! info->symbolic && h->dynindx != -1) + || !h->def_regular)) + { + BFD_ASSERT (h->dynindx != -1); + outrel.r_info = SPARC_ELF_R_INFO (htab, rel, h->dynindx, r_type); + outrel.r_addend = rel->r_addend; + } + else + { + if (r_type == R_SPARC_32 || r_type == R_SPARC_64) + { + outrel.r_info = SPARC_ELF_R_INFO (htab, NULL, + 0, R_SPARC_RELATIVE); + outrel.r_addend = relocation + rel->r_addend; + } + else + { + long indx; + + if (is_plt) + sec = htab->splt; + + if (bfd_is_abs_section (sec)) + indx = 0; + else if (sec == NULL || sec->owner == NULL) + { + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + else + { + asection *osec; + + osec = sec->output_section; + indx = elf_section_data (osec)->dynindx; + + /* FIXME: we really should be able to link non-pic + shared libraries. */ + if (indx == 0) + { + BFD_FAIL (); + (*_bfd_error_handler) + (_("%B: probably compiled without -fPIC?"), + input_bfd); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + } + + outrel.r_info = SPARC_ELF_R_INFO (htab, rel, indx, r_type); + outrel.r_addend = relocation + rel->r_addend; + } + } + + SPARC_ELF_APPEND_RELA (htab, output_bfd, sreloc, &outrel); + + /* This reloc will be computed at runtime, so there's no + need to do anything now. */ + if (! relocate) + continue; + } + break; + + case R_SPARC_TLS_GD_HI22: + if (! ABI_64_P (input_bfd) + && ! _bfd_sparc_elf_tdata (input_bfd)->has_tlsgd) + { + /* R_SPARC_REV32 used the same reloc number as + R_SPARC_TLS_GD_HI22. */ + r_type = R_SPARC_REV32; + break; + } + /* Fall through */ + + case R_SPARC_TLS_GD_LO10: + case R_SPARC_TLS_IE_HI22: + case R_SPARC_TLS_IE_LO10: + r_type = sparc_elf_tls_transition (info, input_bfd, r_type, h == NULL); + tls_type = GOT_UNKNOWN; + if (h == NULL && local_got_offsets) + tls_type = _bfd_sparc_elf_local_got_tls_type (input_bfd) [r_symndx]; + else if (h != NULL) + { + tls_type = _bfd_sparc_elf_hash_entry(h)->tls_type; + if (!info->shared && h->dynindx == -1 && tls_type == GOT_TLS_IE) + switch (SPARC_ELF_R_TYPE (rel->r_info)) + { + case R_SPARC_TLS_GD_HI22: + case R_SPARC_TLS_IE_HI22: + r_type = R_SPARC_TLS_LE_HIX22; + break; + default: + r_type = R_SPARC_TLS_LE_LOX10; + break; + } + } + if (tls_type == GOT_TLS_IE) + switch (r_type) + { + case R_SPARC_TLS_GD_HI22: + r_type = R_SPARC_TLS_IE_HI22; + break; + case R_SPARC_TLS_GD_LO10: + r_type = R_SPARC_TLS_IE_LO10; + break; + } + + if (r_type == R_SPARC_TLS_LE_HIX22) + { + relocation = tpoff (info, relocation); + break; + } + if (r_type == R_SPARC_TLS_LE_LOX10) + { + /* Change add into xor. */ + relocation = tpoff (info, relocation); + bfd_put_32 (output_bfd, (bfd_get_32 (input_bfd, + contents + rel->r_offset) + | 0x80182000), contents + rel->r_offset); + break; + } + + if (h != NULL) + { + off = h->got.offset; + h->got.offset |= 1; + } + else + { + BFD_ASSERT (local_got_offsets != NULL); + off = local_got_offsets[r_symndx]; + local_got_offsets[r_symndx] |= 1; + } + + r_sparc_tlsldm: + if (htab->sgot == NULL) + abort (); + + if ((off & 1) != 0) + off &= ~1; + else + { + Elf_Internal_Rela outrel; + int dr_type, indx; + + if (htab->srelgot == NULL) + abort (); + + SPARC_ELF_PUT_WORD (htab, output_bfd, 0, htab->sgot->contents + off); + outrel.r_offset = (htab->sgot->output_section->vma + + htab->sgot->output_offset + off); + indx = h && h->dynindx != -1 ? h->dynindx : 0; + if (r_type == R_SPARC_TLS_IE_HI22 + || r_type == R_SPARC_TLS_IE_LO10) + dr_type = SPARC_ELF_TPOFF_RELOC (htab); + else + dr_type = SPARC_ELF_DTPMOD_RELOC (htab); + if (dr_type == SPARC_ELF_TPOFF_RELOC (htab) && indx == 0) + outrel.r_addend = relocation - dtpoff_base (info); + else + outrel.r_addend = 0; + outrel.r_info = SPARC_ELF_R_INFO (htab, NULL, indx, dr_type); + SPARC_ELF_APPEND_RELA (htab, output_bfd, htab->srelgot, &outrel); + + if (r_type == R_SPARC_TLS_GD_HI22 + || r_type == R_SPARC_TLS_GD_LO10) + { + if (indx == 0) + { + BFD_ASSERT (! unresolved_reloc); + SPARC_ELF_PUT_WORD (htab, output_bfd, + relocation - dtpoff_base (info), + (htab->sgot->contents + off + + SPARC_ELF_WORD_BYTES (htab))); + } + else + { + SPARC_ELF_PUT_WORD (htab, output_bfd, 0, + (htab->sgot->contents + off + + SPARC_ELF_WORD_BYTES (htab))); + outrel.r_info = SPARC_ELF_R_INFO (htab, NULL, indx, + SPARC_ELF_DTPOFF_RELOC (htab)); + outrel.r_offset += SPARC_ELF_WORD_BYTES (htab); + SPARC_ELF_APPEND_RELA (htab, output_bfd, htab->srelgot, &outrel); + } + } + else if (dr_type == SPARC_ELF_DTPMOD_RELOC (htab)) + { + SPARC_ELF_PUT_WORD (htab, output_bfd, 0, + (htab->sgot->contents + off + + SPARC_ELF_WORD_BYTES (htab))); + } + } + + if (off >= (bfd_vma) -2) + abort (); + + relocation = htab->sgot->output_offset + off - got_base; + unresolved_reloc = FALSE; + howto = _bfd_sparc_elf_howto_table + r_type; + break; + + case R_SPARC_TLS_LDM_HI22: + case R_SPARC_TLS_LDM_LO10: + if (! info->shared) + { + bfd_put_32 (output_bfd, SPARC_NOP, contents + rel->r_offset); + continue; + } + off = htab->tls_ldm_got.offset; + htab->tls_ldm_got.offset |= 1; + goto r_sparc_tlsldm; + + case R_SPARC_TLS_LDO_HIX22: + case R_SPARC_TLS_LDO_LOX10: + if (info->shared) + { + relocation -= dtpoff_base (info); + break; + } + + r_type = (r_type == R_SPARC_TLS_LDO_HIX22 + ? R_SPARC_TLS_LE_HIX22 : R_SPARC_TLS_LE_LOX10); + /* Fall through. */ + + case R_SPARC_TLS_LE_HIX22: + case R_SPARC_TLS_LE_LOX10: + if (info->shared) + { + Elf_Internal_Rela outrel; + bfd_boolean skip, relocate = FALSE; + + BFD_ASSERT (sreloc != NULL); + skip = FALSE; + outrel.r_offset = + _bfd_elf_section_offset (output_bfd, info, input_section, + rel->r_offset); + if (outrel.r_offset == (bfd_vma) -1) + skip = TRUE; + else if (outrel.r_offset == (bfd_vma) -2) + skip = TRUE, relocate = TRUE; + outrel.r_offset += (input_section->output_section->vma + + input_section->output_offset); + if (skip) + memset (&outrel, 0, sizeof outrel); + else + { + outrel.r_info = SPARC_ELF_R_INFO (htab, NULL, 0, r_type); + outrel.r_addend = relocation - dtpoff_base (info) + + rel->r_addend; + } + + SPARC_ELF_APPEND_RELA (htab, output_bfd, sreloc, &outrel); + continue; + } + relocation = tpoff (info, relocation); + break; + + case R_SPARC_TLS_LDM_CALL: + if (! info->shared) + { + /* mov %g0, %o0 */ + bfd_put_32 (output_bfd, 0x90100000, contents + rel->r_offset); + continue; + } + /* Fall through */ + + case R_SPARC_TLS_GD_CALL: + tls_type = GOT_UNKNOWN; + if (h == NULL && local_got_offsets) + tls_type = _bfd_sparc_elf_local_got_tls_type (input_bfd) [r_symndx]; + else if (h != NULL) + tls_type = _bfd_sparc_elf_hash_entry(h)->tls_type; + if (! info->shared + || (r_type == R_SPARC_TLS_GD_CALL && tls_type == GOT_TLS_IE)) + { + bfd_vma insn; + + if (!info->shared && (h == NULL || h->dynindx == -1)) + { + /* GD -> LE */ + bfd_put_32 (output_bfd, SPARC_NOP, contents + rel->r_offset); + continue; + } + + /* GD -> IE */ + if (rel + 1 < relend + && SPARC_ELF_R_TYPE (rel[1].r_info) == R_SPARC_TLS_GD_ADD + && rel[1].r_offset == rel->r_offset + 4 + && SPARC_ELF_R_SYMNDX (htab, rel[1].r_info) == r_symndx + && (((insn = bfd_get_32 (input_bfd, + contents + rel[1].r_offset)) + >> 25) & 0x1f) == 8) + { + /* We have + call __tls_get_addr, %tgd_call(foo) + add %reg1, %reg2, %o0, %tgd_add(foo) + and change it into IE: + {ld,ldx} [%reg1 + %reg2], %o0, %tie_ldx(foo) + add %g7, %o0, %o0, %tie_add(foo). + add is 0x80000000 | (rd << 25) | (rs1 << 14) | rs2, + ld is 0xc0000000 | (rd << 25) | (rs1 << 14) | rs2, + ldx is 0xc0580000 | (rd << 25) | (rs1 << 14) | rs2. */ + bfd_put_32 (output_bfd, insn | (ABI_64_P (output_bfd) ? 0xc0580000 : 0xc0000000), + contents + rel->r_offset); + bfd_put_32 (output_bfd, 0x9001c008, + contents + rel->r_offset + 4); + rel++; + continue; + } + + bfd_put_32 (output_bfd, 0x9001c008, contents + rel->r_offset); + continue; + } + + h = (struct elf_link_hash_entry *) + bfd_link_hash_lookup (info->hash, "__tls_get_addr", FALSE, + FALSE, TRUE); + BFD_ASSERT (h != NULL); + r_type = R_SPARC_WPLT30; + howto = _bfd_sparc_elf_howto_table + r_type; + goto r_sparc_wplt30; + + case R_SPARC_TLS_GD_ADD: + tls_type = GOT_UNKNOWN; + if (h == NULL && local_got_offsets) + tls_type = _bfd_sparc_elf_local_got_tls_type (input_bfd) [r_symndx]; + else if (h != NULL) + tls_type = _bfd_sparc_elf_hash_entry(h)->tls_type; + if (! info->shared || tls_type == GOT_TLS_IE) + { + /* add %reg1, %reg2, %reg3, %tgd_add(foo) + changed into IE: + {ld,ldx} [%reg1 + %reg2], %reg3, %tie_ldx(foo) + or LE: + add %g7, %reg2, %reg3. */ + bfd_vma insn = bfd_get_32 (input_bfd, contents + rel->r_offset); + if ((h != NULL && h->dynindx != -1) || info->shared) + relocation = insn | (ABI_64_P (output_bfd) ? 0xc0580000 : 0xc0000000); + else + relocation = (insn & ~0x7c000) | 0x1c000; + bfd_put_32 (output_bfd, relocation, contents + rel->r_offset); + } + continue; + + case R_SPARC_TLS_LDM_ADD: + if (! info->shared) + bfd_put_32 (output_bfd, SPARC_NOP, contents + rel->r_offset); + continue; + + case R_SPARC_TLS_LDO_ADD: + if (! info->shared) + { + /* Change rs1 into %g7. */ + bfd_vma insn = bfd_get_32 (input_bfd, contents + rel->r_offset); + insn = (insn & ~0x7c000) | 0x1c000; + bfd_put_32 (output_bfd, insn, contents + rel->r_offset); + } + continue; + + case R_SPARC_TLS_IE_LD: + case R_SPARC_TLS_IE_LDX: + if (! info->shared && (h == NULL || h->dynindx == -1)) + { + bfd_vma insn = bfd_get_32 (input_bfd, contents + rel->r_offset); + int rs2 = insn & 0x1f; + int rd = (insn >> 25) & 0x1f; + + if (rs2 == rd) + relocation = SPARC_NOP; + else + relocation = 0x80100000 | (insn & 0x3e00001f); + bfd_put_32 (output_bfd, relocation, contents + rel->r_offset); + } + continue; + + case R_SPARC_TLS_IE_ADD: + /* Totally useless relocation. */ + continue; + + case R_SPARC_TLS_DTPOFF32: + case R_SPARC_TLS_DTPOFF64: + relocation -= dtpoff_base (info); + break; + + default: + break; + } + + /* Dynamic relocs are not propagated for SEC_DEBUGGING sections + because such sections are not SEC_ALLOC and thus ld.so will + not process them. */ + if (unresolved_reloc + && !((input_section->flags & SEC_DEBUGGING) != 0 + && h->def_dynamic)) + (*_bfd_error_handler) + (_("%B(%A+0x%lx): unresolvable %s relocation against symbol `%s'"), + input_bfd, + input_section, + (long) rel->r_offset, + howto->name, + h->root.root.string); + + r = bfd_reloc_continue; + if (r_type == R_SPARC_OLO10) + { + bfd_vma x; + + if (! ABI_64_P (output_bfd)) + abort (); + + relocation += rel->r_addend; + relocation = (relocation & 0x3ff) + ELF64_R_TYPE_DATA (rel->r_info); + + x = bfd_get_32 (input_bfd, contents + rel->r_offset); + x = (x & ~(bfd_vma) 0x1fff) | (relocation & 0x1fff); + bfd_put_32 (input_bfd, x, contents + rel->r_offset); + + r = bfd_check_overflow (howto->complain_on_overflow, + howto->bitsize, howto->rightshift, + bfd_arch_bits_per_address (input_bfd), + relocation); + } + else if (r_type == R_SPARC_WDISP16) + { + bfd_vma x; + + relocation += rel->r_addend; + relocation -= (input_section->output_section->vma + + input_section->output_offset); + relocation -= rel->r_offset; + + x = bfd_get_32 (input_bfd, contents + rel->r_offset); + x |= ((((relocation >> 2) & 0xc000) << 6) + | ((relocation >> 2) & 0x3fff)); + bfd_put_32 (input_bfd, x, contents + rel->r_offset); + + r = bfd_check_overflow (howto->complain_on_overflow, + howto->bitsize, howto->rightshift, + bfd_arch_bits_per_address (input_bfd), + relocation); + } + else if (r_type == R_SPARC_REV32) + { + bfd_vma x; + + relocation = relocation + rel->r_addend; + + x = bfd_get_32 (input_bfd, contents + rel->r_offset); + x = x + relocation; + bfd_putl32 (/*input_bfd,*/ x, contents + rel->r_offset); + r = bfd_reloc_ok; + } + else if (r_type == R_SPARC_TLS_LDO_HIX22 + || r_type == R_SPARC_TLS_LE_HIX22) + { + bfd_vma x; + + relocation += rel->r_addend; + if (r_type == R_SPARC_TLS_LE_HIX22) + relocation ^= MINUS_ONE; + + x = bfd_get_32 (input_bfd, contents + rel->r_offset); + x = (x & ~(bfd_vma) 0x3fffff) | ((relocation >> 10) & 0x3fffff); + bfd_put_32 (input_bfd, x, contents + rel->r_offset); + r = bfd_reloc_ok; + } + else if (r_type == R_SPARC_TLS_LDO_LOX10 + || r_type == R_SPARC_TLS_LE_LOX10) + { + bfd_vma x; + + relocation += rel->r_addend; + relocation &= 0x3ff; + if (r_type == R_SPARC_TLS_LE_LOX10) + relocation |= 0x1c00; + + x = bfd_get_32 (input_bfd, contents + rel->r_offset); + x = (x & ~(bfd_vma) 0x1fff) | relocation; + bfd_put_32 (input_bfd, x, contents + rel->r_offset); + + r = bfd_reloc_ok; + } + else if (r_type == R_SPARC_HIX22) + { + bfd_vma x; + + relocation += rel->r_addend; + relocation = relocation ^ MINUS_ONE; + + x = bfd_get_32 (input_bfd, contents + rel->r_offset); + x = (x & ~(bfd_vma) 0x3fffff) | ((relocation >> 10) & 0x3fffff); + bfd_put_32 (input_bfd, x, contents + rel->r_offset); + + r = bfd_check_overflow (howto->complain_on_overflow, + howto->bitsize, howto->rightshift, + bfd_arch_bits_per_address (input_bfd), + relocation); + } + else if (r_type == R_SPARC_LOX10) + { + bfd_vma x; + + relocation += rel->r_addend; + relocation = (relocation & 0x3ff) | 0x1c00; + + x = bfd_get_32 (input_bfd, contents + rel->r_offset); + x = (x & ~(bfd_vma) 0x1fff) | relocation; + bfd_put_32 (input_bfd, x, contents + rel->r_offset); + + r = bfd_reloc_ok; + } + else if ((r_type == R_SPARC_WDISP30 || r_type == R_SPARC_WPLT30) + && sec_do_relax (input_section) + && rel->r_offset + 4 < input_section->size) + { +#define G0 0 +#define O7 15 +#define XCC (2 << 20) +#define COND(x) (((x)&0xf)<<25) +#define CONDA COND(0x8) +#define INSN_BPA (F2(0,1) | CONDA | BPRED | XCC) +#define INSN_BA (F2(0,2) | CONDA) +#define INSN_OR F3(2, 0x2, 0) +#define INSN_NOP F2(0,4) + + bfd_vma x, y; + + /* If the instruction is a call with either: + restore + arithmetic instruction with rd == %o7 + where rs1 != %o7 and rs2 if it is register != %o7 + then we can optimize if the call destination is near + by changing the call into a branch always. */ + x = bfd_get_32 (input_bfd, contents + rel->r_offset); + y = bfd_get_32 (input_bfd, contents + rel->r_offset + 4); + if ((x & OP(~0)) == OP(1) && (y & OP(~0)) == OP(2)) + { + if (((y & OP3(~0)) == OP3(0x3d) /* restore */ + || ((y & OP3(0x28)) == 0 /* arithmetic */ + && (y & RD(~0)) == RD(O7))) + && (y & RS1(~0)) != RS1(O7) + && ((y & F3I(~0)) + || (y & RS2(~0)) != RS2(O7))) + { + bfd_vma reloc; + + reloc = relocation + rel->r_addend - rel->r_offset; + reloc -= (input_section->output_section->vma + + input_section->output_offset); + + /* Ensure the branch fits into simm22. */ + if ((reloc & 3) == 0 + && ((reloc & ~(bfd_vma)0x7fffff) == 0 + || ((reloc | 0x7fffff) == ~(bfd_vma)0))) + { + reloc >>= 2; + + /* Check whether it fits into simm19. */ + if (((reloc & 0x3c0000) == 0 + || (reloc & 0x3c0000) == 0x3c0000) + && (ABI_64_P (output_bfd) + || elf_elfheader (output_bfd)->e_flags & EF_SPARC_32PLUS)) + x = INSN_BPA | (reloc & 0x7ffff); /* ba,pt %xcc */ + else + x = INSN_BA | (reloc & 0x3fffff); /* ba */ + bfd_put_32 (input_bfd, x, contents + rel->r_offset); + r = bfd_reloc_ok; + if (rel->r_offset >= 4 + && (y & (0xffffffff ^ RS1(~0))) + == (INSN_OR | RD(O7) | RS2(G0))) + { + bfd_vma z; + unsigned int reg; + + z = bfd_get_32 (input_bfd, + contents + rel->r_offset - 4); + if ((z & (0xffffffff ^ RD(~0))) + != (INSN_OR | RS1(O7) | RS2(G0))) + break; + + /* The sequence was + or %o7, %g0, %rN + call foo + or %rN, %g0, %o7 + + If call foo was replaced with ba, replace + or %rN, %g0, %o7 with nop. */ + + reg = (y & RS1(~0)) >> 14; + if (reg != ((z & RD(~0)) >> 25) + || reg == G0 || reg == O7) + break; + + bfd_put_32 (input_bfd, (bfd_vma) INSN_NOP, + contents + rel->r_offset + 4); + } + + } + } + } + } + + if (r == bfd_reloc_continue) + r = _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, rel->r_offset, + relocation, rel->r_addend); + + if (r != bfd_reloc_ok) + { + switch (r) + { + default: + case bfd_reloc_outofrange: + abort (); + case bfd_reloc_overflow: + { + const char *name; + + /* The Solaris native linker silently disregards overflows. + We don't, but this breaks stabs debugging info, whose + relocations are only 32-bits wide. Ignore overflows in + this case and also for discarded entries. */ + if ((r_type == R_SPARC_32 || r_type == R_SPARC_DISP32) + && (((input_section->flags & SEC_DEBUGGING) != 0 + && strcmp (bfd_section_name (input_bfd, + input_section), + ".stab") == 0) + || _bfd_elf_section_offset (output_bfd, info, + input_section, + rel->r_offset) + == (bfd_vma)-1)) + break; + + if (h != NULL) + { + /* Assume this is a call protected by other code that + detect the symbol is undefined. If this is the case, + we can safely ignore the overflow. If not, the + program is hosed anyway, and a little warning isn't + going to help. */ + if (h->root.type == bfd_link_hash_undefweak + && howto->pc_relative) + break; + + name = NULL; + } + 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, (h ? &h->root : NULL), name, howto->name, + (bfd_vma) 0, input_bfd, input_section, + rel->r_offset))) + return FALSE; + } + break; + } + } + } + + return TRUE; +} + +/* Build a VxWorks PLT entry. PLT_INDEX is the index of the PLT entry + and PLT_OFFSET is the byte offset from the start of .plt. GOT_OFFSET + is the offset of the associated .got.plt entry from + _GLOBAL_OFFSET_TABLE_. */ + +static void +sparc_vxworks_build_plt_entry (bfd *output_bfd, struct bfd_link_info *info, + bfd_vma plt_offset, bfd_vma plt_index, + bfd_vma got_offset) +{ + bfd_vma got_base; + const bfd_vma *plt_entry; + struct _bfd_sparc_elf_link_hash_table *htab; + bfd_byte *loc; + Elf_Internal_Rela rela; + + htab = _bfd_sparc_elf_hash_table (info); + if (info->shared) + { + plt_entry = sparc_vxworks_shared_plt_entry; + got_base = 0; + } + else + { + plt_entry = sparc_vxworks_exec_plt_entry; + got_base = (htab->elf.hgot->root.u.def.value + + htab->elf.hgot->root.u.def.section->output_offset + + htab->elf.hgot->root.u.def.section->output_section->vma); + } + + /* Fill in the entry in the procedure linkage table. */ + bfd_put_32 (output_bfd, plt_entry[0] + ((got_base + got_offset) >> 10), + htab->splt->contents + plt_offset); + bfd_put_32 (output_bfd, plt_entry[1] + ((got_base + got_offset) & 0x3ff), + htab->splt->contents + plt_offset + 4); + bfd_put_32 (output_bfd, plt_entry[2], + htab->splt->contents + plt_offset + 8); + bfd_put_32 (output_bfd, plt_entry[3], + htab->splt->contents + plt_offset + 12); + bfd_put_32 (output_bfd, plt_entry[4], + htab->splt->contents + plt_offset + 16); + bfd_put_32 (output_bfd, plt_entry[5] + (plt_index >> 10), + htab->splt->contents + plt_offset + 20); + /* PC-relative displacement for a branch to the start of + the PLT section. */ + bfd_put_32 (output_bfd, plt_entry[6] + (((-plt_offset - 24) >> 2) + & 0x003fffff), + htab->splt->contents + plt_offset + 24); + bfd_put_32 (output_bfd, plt_entry[7] + (plt_index & 0x3ff), + htab->splt->contents + plt_offset + 28); + + /* Fill in the .got.plt entry, pointing initially at the + second half of the PLT entry. */ + BFD_ASSERT (htab->sgotplt != NULL); + bfd_put_32 (output_bfd, + htab->splt->output_section->vma + + htab->splt->output_offset + + plt_offset + 20, + htab->sgotplt->contents + got_offset); + + /* Add relocations to .rela.plt.unloaded. */ + if (!info->shared) + { + loc = (htab->srelplt2->contents + + (2 + 3 * plt_index) * sizeof (Elf32_External_Rela)); + + /* Relocate the initial sethi. */ + rela.r_offset = (htab->splt->output_section->vma + + htab->splt->output_offset + + plt_offset); + rela.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_SPARC_HI22); + rela.r_addend = got_offset; + bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); + loc += sizeof (Elf32_External_Rela); + + /* Likewise the following or. */ + rela.r_offset += 4; + rela.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_SPARC_LO10); + bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); + loc += sizeof (Elf32_External_Rela); + + /* Relocate the .got.plt entry. */ + rela.r_offset = (htab->sgotplt->output_section->vma + + htab->sgotplt->output_offset + + got_offset); + rela.r_info = ELF32_R_INFO (htab->elf.hplt->indx, R_SPARC_32); + rela.r_addend = plt_offset + 20; + bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); + } +} + +/* Finish up dynamic symbol handling. We set the contents of various + dynamic sections here. */ + +bfd_boolean +_bfd_sparc_elf_finish_dynamic_symbol (bfd *output_bfd, + struct bfd_link_info *info, + struct elf_link_hash_entry *h, + Elf_Internal_Sym *sym) +{ + bfd *dynobj; + struct _bfd_sparc_elf_link_hash_table *htab; + + htab = _bfd_sparc_elf_hash_table (info); + dynobj = htab->elf.dynobj; + + if (h->plt.offset != (bfd_vma) -1) + { + asection *splt; + asection *srela; + Elf_Internal_Rela rela; + bfd_byte *loc; + bfd_vma r_offset, got_offset; + int rela_index; + + /* This symbol has an entry in the PLT. Set it up. */ + + BFD_ASSERT (h->dynindx != -1); + + splt = htab->splt; + srela = htab->srelplt; + BFD_ASSERT (splt != NULL && srela != NULL); + + /* Fill in the entry in the .rela.plt section. */ + if (htab->is_vxworks) + { + /* Work out the index of this PLT entry. */ + rela_index = ((h->plt.offset - htab->plt_header_size) + / htab->plt_entry_size); + + /* Calculate the offset of the associated .got.plt entry. + The first three entries are reserved. */ + got_offset = (rela_index + 3) * 4; + + sparc_vxworks_build_plt_entry (output_bfd, info, h->plt.offset, + rela_index, got_offset); + + + /* On VxWorks, the relocation points to the .got.plt entry, + not the .plt entry. */ + rela.r_offset = (htab->sgotplt->output_section->vma + + htab->sgotplt->output_offset + + got_offset); + rela.r_addend = 0; + } + else + { + /* Fill in the entry in the procedure linkage table. */ + rela_index = SPARC_ELF_BUILD_PLT_ENTRY (htab, output_bfd, splt, + h->plt.offset, splt->size, + &r_offset); + + rela.r_offset = r_offset + + (splt->output_section->vma + splt->output_offset); + if (! ABI_64_P (output_bfd) + || h->plt.offset < (PLT64_LARGE_THRESHOLD * PLT64_ENTRY_SIZE)) + { + rela.r_addend = 0; + } + else + { + rela.r_addend = (-(h->plt.offset + 4) + - splt->output_section->vma + - splt->output_offset); + } + } + rela.r_info = SPARC_ELF_R_INFO (htab, NULL, h->dynindx, R_SPARC_JMP_SLOT); + + /* Adjust for the first 4 reserved elements in the .plt section + when setting the offset in the .rela.plt section. + Sun forgot to read their own ABI and copied elf32-sparc behaviour, + thus .plt[4] has corresponding .rela.plt[0] and so on. */ + + loc = srela->contents; +#ifdef BFD64 + if (ABI_64_P (output_bfd)) + { + loc += rela_index * sizeof (Elf64_External_Rela); + bfd_elf64_swap_reloca_out (output_bfd, &rela, loc); + } + else +#endif + { + loc += rela_index * sizeof (Elf32_External_Rela); + bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); + } + + if (!h->def_regular) + { + /* Mark the symbol as undefined, rather than as defined in + the .plt section. Leave the value alone. */ + sym->st_shndx = SHN_UNDEF; + /* If the symbol is weak, we do need to clear the value. + Otherwise, the PLT entry would provide a definition for + the symbol even if the symbol wasn't defined anywhere, + and so the symbol would never be NULL. */ + if (!h->ref_regular_nonweak) + sym->st_value = 0; + } + } + + if (h->got.offset != (bfd_vma) -1 + && _bfd_sparc_elf_hash_entry(h)->tls_type != GOT_TLS_GD + && _bfd_sparc_elf_hash_entry(h)->tls_type != GOT_TLS_IE) + { + asection *sgot; + asection *srela; + Elf_Internal_Rela rela; + + /* This symbol has an entry in the GOT. Set it up. */ + + sgot = htab->sgot; + srela = htab->srelgot; + BFD_ASSERT (sgot != NULL && srela != NULL); + + rela.r_offset = (sgot->output_section->vma + + sgot->output_offset + + (h->got.offset &~ (bfd_vma) 1)); + + /* If this is a -Bsymbolic link, and the symbol is defined + locally, we just want to emit a RELATIVE reloc. Likewise if + the symbol was forced to be local because of a version file. + The entry in the global offset table will already have been + initialized in the relocate_section function. */ + if (info->shared + && (info->symbolic || h->dynindx == -1) + && h->def_regular) + { + asection *sec = h->root.u.def.section; + rela.r_info = SPARC_ELF_R_INFO (htab, NULL, 0, R_SPARC_RELATIVE); + rela.r_addend = (h->root.u.def.value + + sec->output_section->vma + + sec->output_offset); + } + else + { + rela.r_info = SPARC_ELF_R_INFO (htab, NULL, h->dynindx, R_SPARC_GLOB_DAT); + rela.r_addend = 0; + } + + SPARC_ELF_PUT_WORD (htab, output_bfd, 0, + sgot->contents + (h->got.offset & ~(bfd_vma) 1)); + SPARC_ELF_APPEND_RELA (htab, output_bfd, srela, &rela); + } + + if (h->needs_copy) + { + asection *s; + Elf_Internal_Rela rela; + + /* This symbols needs a copy reloc. Set it up. */ + BFD_ASSERT (h->dynindx != -1); + + s = bfd_get_section_by_name (h->root.u.def.section->owner, + ".rela.bss"); + BFD_ASSERT (s != NULL); + + rela.r_offset = (h->root.u.def.value + + h->root.u.def.section->output_section->vma + + h->root.u.def.section->output_offset); + rela.r_info = SPARC_ELF_R_INFO (htab, NULL, h->dynindx, R_SPARC_COPY); + rela.r_addend = 0; + SPARC_ELF_APPEND_RELA (htab, output_bfd, s, &rela); + } + + /* Mark some specially defined symbols as absolute. On VxWorks, + _GLOBAL_OFFSET_TABLE_ is not absolute: it is relative to the + ".got" section. Likewise _PROCEDURE_LINKAGE_TABLE_ and ".plt". */ + if (strcmp (h->root.root.string, "_DYNAMIC") == 0 + || (!htab->is_vxworks + && (h == htab->elf.hgot || h == htab->elf.hplt))) + sym->st_shndx = SHN_ABS; + + return TRUE; +} + +/* Finish up the dynamic sections. */ + +#ifdef BFD64 +static bfd_boolean +sparc64_finish_dyn (bfd *output_bfd, struct bfd_link_info *info, + bfd *dynobj, asection *sdyn, + asection *splt ATTRIBUTE_UNUSED) +{ + Elf64_External_Dyn *dyncon, *dynconend; + int stt_regidx = -1; + + dyncon = (Elf64_External_Dyn *) sdyn->contents; + dynconend = (Elf64_External_Dyn *) (sdyn->contents + sdyn->size); + for (; dyncon < dynconend; dyncon++) + { + Elf_Internal_Dyn dyn; + const char *name; + bfd_boolean size; + + bfd_elf64_swap_dyn_in (dynobj, dyncon, &dyn); + + switch (dyn.d_tag) + { + case DT_PLTGOT: name = ".plt"; size = FALSE; break; + case DT_PLTRELSZ: name = ".rela.plt"; size = TRUE; break; + case DT_JMPREL: name = ".rela.plt"; size = FALSE; break; + case DT_SPARC_REGISTER: + if (stt_regidx == -1) + { + stt_regidx = + _bfd_elf_link_lookup_local_dynindx (info, output_bfd, -1); + if (stt_regidx == -1) + return FALSE; + } + dyn.d_un.d_val = stt_regidx++; + bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon); + /* fallthrough */ + default: name = NULL; size = FALSE; break; + } + + if (name != NULL) + { + asection *s; + + s = bfd_get_section_by_name (output_bfd, name); + if (s == NULL) + dyn.d_un.d_val = 0; + else + { + if (! size) + dyn.d_un.d_ptr = s->vma; + else + dyn.d_un.d_val = s->size; + } + bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon); + } + } + return TRUE; +} +#endif + +static bfd_boolean +sparc32_finish_dyn (bfd *output_bfd, struct bfd_link_info *info, + bfd *dynobj, asection *sdyn, + asection *splt ATTRIBUTE_UNUSED) +{ + Elf32_External_Dyn *dyncon, *dynconend; + struct _bfd_sparc_elf_link_hash_table *htab; + + htab = _bfd_sparc_elf_hash_table (info); + dyncon = (Elf32_External_Dyn *) sdyn->contents; + dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->size); + for (; dyncon < dynconend; dyncon++) + { + Elf_Internal_Dyn dyn; + const char *name; + bfd_boolean size; + + bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn); + + if (htab->is_vxworks && dyn.d_tag == DT_RELASZ) + { + /* On VxWorks, DT_RELASZ should not include the relocations + in .rela.plt. */ + if (htab->srelplt) + { + dyn.d_un.d_val -= htab->srelplt->size; + bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + } + } + else if (htab->is_vxworks && dyn.d_tag == DT_PLTGOT) + { + /* On VxWorks, DT_PLTGOT should point to the start of the GOT, + not to the start of the PLT. */ + if (htab->sgotplt) + { + dyn.d_un.d_val = (htab->sgotplt->output_section->vma + + htab->sgotplt->output_offset); + bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + } + } + else + { + switch (dyn.d_tag) + { + case DT_PLTGOT: name = ".plt"; size = FALSE; break; + case DT_PLTRELSZ: name = ".rela.plt"; size = TRUE; break; + case DT_JMPREL: name = ".rela.plt"; size = FALSE; break; + default: name = NULL; size = FALSE; break; + } + + if (name != NULL) + { + asection *s; + + s = bfd_get_section_by_name (output_bfd, name); + if (s == NULL) + dyn.d_un.d_val = 0; + else + { + if (! size) + dyn.d_un.d_ptr = s->vma; + else + dyn.d_un.d_val = s->size; + } + bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); + } + } + } + return TRUE; +} + +/* Install the first PLT entry in a VxWorks executable and make sure that + .rela.plt.unloaded relocations have the correct symbol indexes. */ + +static void +sparc_vxworks_finish_exec_plt (bfd *output_bfd, struct bfd_link_info *info) +{ + struct _bfd_sparc_elf_link_hash_table *htab; + Elf_Internal_Rela rela; + bfd_vma got_base; + bfd_byte *loc; + + htab = _bfd_sparc_elf_hash_table (info); + + /* Calculate the absolute value of _GLOBAL_OFFSET_TABLE_. */ + got_base = (htab->elf.hgot->root.u.def.section->output_section->vma + + htab->elf.hgot->root.u.def.section->output_offset + + htab->elf.hgot->root.u.def.value); + + /* Install the initial PLT entry. */ + bfd_put_32 (output_bfd, + sparc_vxworks_exec_plt0_entry[0] + ((got_base + 8) >> 10), + htab->splt->contents); + bfd_put_32 (output_bfd, + sparc_vxworks_exec_plt0_entry[1] + ((got_base + 8) & 0x3ff), + htab->splt->contents + 4); + bfd_put_32 (output_bfd, + sparc_vxworks_exec_plt0_entry[2], + htab->splt->contents + 8); + bfd_put_32 (output_bfd, + sparc_vxworks_exec_plt0_entry[3], + htab->splt->contents + 12); + bfd_put_32 (output_bfd, + sparc_vxworks_exec_plt0_entry[4], + htab->splt->contents + 16); + + loc = htab->srelplt2->contents; + + /* Add an unloaded relocation for the initial entry's "sethi". */ + rela.r_offset = (htab->splt->output_section->vma + + htab->splt->output_offset); + rela.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_SPARC_HI22); + rela.r_addend = 8; + bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); + loc += sizeof (Elf32_External_Rela); + + /* Likewise the following "or". */ + rela.r_offset += 4; + rela.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_SPARC_LO10); + bfd_elf32_swap_reloca_out (output_bfd, &rela, loc); + loc += sizeof (Elf32_External_Rela); + + /* Fix up the remaining .rela.plt.unloaded relocations. They may have + the wrong symbol index for _G_O_T_ or _P_L_T_ depending on the order + in which symbols were output. */ + while (loc < htab->srelplt2->contents + htab->srelplt2->size) + { + Elf_Internal_Rela rel; + + /* The entry's initial "sethi" (against _G_O_T_). */ + bfd_elf32_swap_reloc_in (output_bfd, loc, &rel); + rel.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_SPARC_HI22); + bfd_elf32_swap_reloc_out (output_bfd, &rel, loc); + loc += sizeof (Elf32_External_Rela); + + /* The following "or" (also against _G_O_T_). */ + bfd_elf32_swap_reloc_in (output_bfd, loc, &rel); + rel.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_SPARC_LO10); + bfd_elf32_swap_reloc_out (output_bfd, &rel, loc); + loc += sizeof (Elf32_External_Rela); + + /* The .got.plt entry (against _P_L_T_). */ + bfd_elf32_swap_reloc_in (output_bfd, loc, &rel); + rel.r_info = ELF32_R_INFO (htab->elf.hplt->indx, R_SPARC_32); + bfd_elf32_swap_reloc_out (output_bfd, &rel, loc); + loc += sizeof (Elf32_External_Rela); + } +} + +/* Install the first PLT entry in a VxWorks shared object. */ + +static void +sparc_vxworks_finish_shared_plt (bfd *output_bfd, struct bfd_link_info *info) +{ + struct _bfd_sparc_elf_link_hash_table *htab; + unsigned int i; + + htab = _bfd_sparc_elf_hash_table (info); + for (i = 0; i < ARRAY_SIZE (sparc_vxworks_shared_plt0_entry); i++) + bfd_put_32 (output_bfd, sparc_vxworks_shared_plt0_entry[i], + htab->splt->contents + i * 4); +} + +bfd_boolean +_bfd_sparc_elf_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) +{ + bfd *dynobj; + asection *sdyn; + struct _bfd_sparc_elf_link_hash_table *htab; + + htab = _bfd_sparc_elf_hash_table (info); + dynobj = htab->elf.dynobj; + + sdyn = bfd_get_section_by_name (dynobj, ".dynamic"); + + if (elf_hash_table (info)->dynamic_sections_created) + { + asection *splt; + bfd_boolean ret; + + splt = bfd_get_section_by_name (dynobj, ".plt"); + BFD_ASSERT (splt != NULL && sdyn != NULL); + +#ifdef BFD64 + if (ABI_64_P (output_bfd)) + ret = sparc64_finish_dyn (output_bfd, info, dynobj, sdyn, splt); + else +#endif + ret = sparc32_finish_dyn (output_bfd, info, dynobj, sdyn, splt); + + if (ret != TRUE) + return ret; + + /* Initialize the contents of the .plt section. */ + if (splt->size > 0) + { + if (htab->is_vxworks) + { + if (info->shared) + sparc_vxworks_finish_shared_plt (output_bfd, info); + else + sparc_vxworks_finish_exec_plt (output_bfd, info); + } + else + { + memset (splt->contents, 0, htab->plt_header_size); + if (!ABI_64_P (output_bfd)) + bfd_put_32 (output_bfd, (bfd_vma) SPARC_NOP, + splt->contents + splt->size - 4); + } + } + + elf_section_data (splt->output_section)->this_hdr.sh_entsize + = htab->plt_entry_size; + } + + /* Set the first entry in the global offset table to the address of + the dynamic section. */ + if (htab->sgot && htab->sgot->size > 0) + { + bfd_vma val = (sdyn ? + sdyn->output_section->vma + sdyn->output_offset : + 0); + + SPARC_ELF_PUT_WORD (htab, output_bfd, val, htab->sgot->contents); + } + + if (htab->sgot) + elf_section_data (htab->sgot->output_section)->this_hdr.sh_entsize = + SPARC_ELF_WORD_BYTES (htab); + + return TRUE; +} + + +/* Set the right machine number for a SPARC ELF file. */ + +bfd_boolean +_bfd_sparc_elf_object_p (bfd *abfd) +{ + if (ABI_64_P (abfd)) + { + unsigned long mach = bfd_mach_sparc_v9; + + if (elf_elfheader (abfd)->e_flags & EF_SPARC_SUN_US3) + mach = bfd_mach_sparc_v9b; + else if (elf_elfheader (abfd)->e_flags & EF_SPARC_SUN_US1) + mach = bfd_mach_sparc_v9a; + return bfd_default_set_arch_mach (abfd, bfd_arch_sparc, mach); + } + else + { + if (elf_elfheader (abfd)->e_machine == EM_SPARC32PLUS) + { + if (elf_elfheader (abfd)->e_flags & EF_SPARC_SUN_US3) + return bfd_default_set_arch_mach (abfd, bfd_arch_sparc, + bfd_mach_sparc_v8plusb); + else if (elf_elfheader (abfd)->e_flags & EF_SPARC_SUN_US1) + return bfd_default_set_arch_mach (abfd, bfd_arch_sparc, + bfd_mach_sparc_v8plusa); + else if (elf_elfheader (abfd)->e_flags & EF_SPARC_32PLUS) + return bfd_default_set_arch_mach (abfd, bfd_arch_sparc, + bfd_mach_sparc_v8plus); + else + return FALSE; + } + else if (elf_elfheader (abfd)->e_flags & EF_SPARC_LEDATA) + return bfd_default_set_arch_mach (abfd, bfd_arch_sparc, + bfd_mach_sparc_sparclite_le); + else + return bfd_default_set_arch_mach (abfd, bfd_arch_sparc, bfd_mach_sparc); + } +} + +/* Return address for Ith PLT stub in section PLT, for relocation REL + or (bfd_vma) -1 if it should not be included. */ + +bfd_vma +_bfd_sparc_elf_plt_sym_val (bfd_vma i, const asection *plt, const arelent *rel) +{ + if (ABI_64_P (plt->owner)) + { + bfd_vma j; + + i += PLT64_HEADER_SIZE / PLT64_ENTRY_SIZE; + if (i < PLT64_LARGE_THRESHOLD) + return plt->vma + i * PLT64_ENTRY_SIZE; + + j = (i - PLT64_LARGE_THRESHOLD) % 160; + i -= j; + return plt->vma + i * PLT64_ENTRY_SIZE + j * 4 * 6; + } + else + return rel->address; +} diff --git a/contrib/binutils/bfd/elfxx-sparc.h b/contrib/binutils/bfd/elfxx-sparc.h new file mode 100644 index 00000000000..0a5a88b6fe3 --- /dev/null +++ b/contrib/binutils/bfd/elfxx-sparc.h @@ -0,0 +1,145 @@ +/* SPARC ELF specific backend routines. + Copyright 2005 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include "elf/common.h" +#include "elf/internal.h" + +struct _bfd_sparc_elf_section_data +{ + struct bfd_elf_section_data elf; + unsigned int do_relax, reloc_count; +}; + +#define sec_do_relax(sec) \ + ((struct _bfd_sparc_elf_section_data *) elf_section_data (sec))->do_relax +#define canon_reloc_count(sec) \ + ((struct _bfd_sparc_elf_section_data *) elf_section_data (sec))->reloc_count + +struct _bfd_sparc_elf_app_reg +{ + unsigned char bind; + unsigned short shndx; + bfd *abfd; + char *name; +}; + +/* Sparc ELF linker hash table. */ + +struct _bfd_sparc_elf_link_hash_table +{ + struct elf_link_hash_table elf; + + /* Short-cuts to get to dynamic linker sections. */ + asection *sgot; + asection *srelgot; + asection *splt; + asection *srelplt; + asection *sdynbss; + asection *srelbss; + + union { + bfd_signed_vma refcount; + bfd_vma offset; + } tls_ldm_got; + + /* Small local sym to section mapping cache. */ + struct sym_sec_cache sym_sec; + + /* True if the target system is VxWorks. */ + int is_vxworks; + + /* The (unloaded but important) .rela.plt.unloaded section, for VxWorks. */ + asection *srelplt2; + + /* .got.plt is only used on VxWorks. */ + asection *sgotplt; + + void (*put_word) (bfd *, bfd_vma, void *); + void (*append_rela) (bfd *, asection *, Elf_Internal_Rela *); + bfd_vma (*r_info) (Elf_Internal_Rela *, bfd_vma, bfd_vma); + bfd_vma (*r_symndx) (bfd_vma); + int (*build_plt_entry) (bfd *, asection *, bfd_vma, bfd_vma, bfd_vma *); + const char *dynamic_interpreter; + int dynamic_interpreter_size; + unsigned int word_align_power; + unsigned int align_power_max; + unsigned int plt_header_size; + unsigned int plt_entry_size; + int bytes_per_word; + int bytes_per_rela; + int dtpoff_reloc; + int dtpmod_reloc; + int tpoff_reloc; + + struct _bfd_sparc_elf_app_reg app_regs [4]; +}; + +/* Get the SPARC ELF linker hash table from a link_info structure. */ + +#define _bfd_sparc_elf_hash_table(p) \ + ((struct _bfd_sparc_elf_link_hash_table *) ((p)->hash)) + +extern reloc_howto_type *_bfd_sparc_elf_reloc_type_lookup + (bfd *, bfd_reloc_code_real_type); +extern void _bfd_sparc_elf_info_to_howto + (bfd *, arelent *, Elf_Internal_Rela *); +extern reloc_howto_type *_bfd_sparc_elf_info_to_howto_ptr + (unsigned int); +extern bfd_boolean _bfd_sparc_elf_mkobject + (bfd *); +extern struct bfd_link_hash_table *_bfd_sparc_elf_link_hash_table_create + (bfd *); +extern bfd_boolean _bfd_sparc_elf_create_dynamic_sections + (bfd *, struct bfd_link_info *); +extern void _bfd_sparc_elf_copy_indirect_symbol + (struct bfd_link_info *, + struct elf_link_hash_entry *, + struct elf_link_hash_entry *); +extern bfd_boolean _bfd_sparc_elf_check_relocs + (bfd *, struct bfd_link_info *, + asection *, const Elf_Internal_Rela *); +extern asection *_bfd_sparc_elf_gc_mark_hook + (asection *, struct bfd_link_info *, + Elf_Internal_Rela *, struct elf_link_hash_entry *, + Elf_Internal_Sym *); +extern bfd_boolean _bfd_sparc_elf_gc_sweep_hook + (bfd *, struct bfd_link_info *, + asection *, const Elf_Internal_Rela *); +extern bfd_boolean _bfd_sparc_elf_adjust_dynamic_symbol + (struct bfd_link_info *, struct elf_link_hash_entry *); +extern bfd_boolean _bfd_sparc_elf_omit_section_dynsym + (bfd *, struct bfd_link_info *, asection *); +extern bfd_boolean _bfd_sparc_elf_size_dynamic_sections + (bfd *, struct bfd_link_info *); +extern bfd_boolean _bfd_sparc_elf_new_section_hook + (bfd *, asection *); +extern bfd_boolean _bfd_sparc_elf_relax_section + (bfd *, struct bfd_section *, struct bfd_link_info *, bfd_boolean *); +extern bfd_boolean _bfd_sparc_elf_relocate_section + (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, + Elf_Internal_Rela *, Elf_Internal_Sym *, asection **); +extern bfd_boolean _bfd_sparc_elf_finish_dynamic_symbol + (bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, + Elf_Internal_Sym *sym); +extern bfd_boolean _bfd_sparc_elf_finish_dynamic_sections + (bfd *, struct bfd_link_info *); +extern bfd_boolean _bfd_sparc_elf_object_p + (bfd *); +extern bfd_vma _bfd_sparc_elf_plt_sym_val + (bfd_vma, const asection *, const arelent *); diff --git a/contrib/binutils/bfd/elfxx-target.h b/contrib/binutils/bfd/elfxx-target.h index e250a97da7a..503726d2b86 100644 --- a/contrib/binutils/bfd/elfxx-target.h +++ b/contrib/binutils/bfd/elfxx-target.h @@ -1,6 +1,6 @@ /* Target definitions for NN-bit ELF Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003 Free Software Foundation, Inc. + 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* This structure contains everything that BFD knows about a target. It includes things like its byte order, name, what routines to call @@ -26,7 +26,9 @@ There are two such structures here: one for big-endian machines and one for little-endian machines. */ +#ifndef bfd_elfNN_close_and_cleanup #define bfd_elfNN_close_and_cleanup _bfd_elf_close_and_cleanup +#endif #define bfd_elfNN_bfd_free_cached_info _bfd_generic_bfd_free_cached_info #ifndef bfd_elfNN_get_section_contents #define bfd_elfNN_get_section_contents _bfd_generic_get_section_contents @@ -34,12 +36,19 @@ #define bfd_elfNN_canonicalize_dynamic_symtab \ _bfd_elf_canonicalize_dynamic_symtab +#ifndef bfd_elfNN_get_synthetic_symtab +#define bfd_elfNN_get_synthetic_symtab \ + _bfd_elf_get_synthetic_symtab +#endif #ifndef bfd_elfNN_canonicalize_reloc #define bfd_elfNN_canonicalize_reloc _bfd_elf_canonicalize_reloc #endif #ifndef bfd_elfNN_find_nearest_line #define bfd_elfNN_find_nearest_line _bfd_elf_find_nearest_line #endif +#ifndef bfd_elfNN_find_inliner_info +#define bfd_elfNN_find_inliner_info _bfd_elf_find_inliner_info +#endif #define bfd_elfNN_read_minisymbols _bfd_elf_read_minisymbols #define bfd_elfNN_minisymbol_to_symbol _bfd_elf_minisymbol_to_symbol #define bfd_elfNN_get_dynamic_symtab_upper_bound \ @@ -68,9 +77,6 @@ #define bfd_elfNN_get_section_contents_in_window \ _bfd_generic_get_section_contents_in_window -#ifndef elf_backend_got_symbol_offset -#define elf_backend_got_symbol_offset (bfd_vma) 0 -#endif #ifndef elf_backend_can_refcount #define elf_backend_can_refcount 0 #endif @@ -119,6 +125,9 @@ #ifndef elf_backend_want_got_sym #define elf_backend_want_got_sym 1 #endif +#ifndef elf_backend_gc_mark_dynamic_ref +#define elf_backend_gc_mark_dynamic_ref bfd_elf_gc_mark_dynamic_ref_symbol +#endif #ifndef elf_backend_gc_mark_hook #define elf_backend_gc_mark_hook NULL #endif @@ -134,8 +143,17 @@ _bfd_elf_merge_sections #endif +#ifndef bfd_elfNN_bfd_is_group_section +#define bfd_elfNN_bfd_is_group_section bfd_elf_is_group_section +#endif + #ifndef bfd_elfNN_bfd_discard_group -#define bfd_elfNN_bfd_discard_group bfd_elf_discard_group +#define bfd_elfNN_bfd_discard_group bfd_generic_discard_group +#endif + +#ifndef bfd_elfNN_section_already_linked +#define bfd_elfNN_section_already_linked \ + _bfd_elf_section_already_linked #endif #ifndef bfd_elfNN_bfd_make_debug_symbol @@ -152,6 +170,10 @@ #define bfd_elfNN_bfd_copy_private_section_data \ _bfd_elf_copy_private_section_data #endif +#ifndef bfd_elfNN_bfd_copy_private_header_data +#define bfd_elfNN_bfd_copy_private_header_data \ + _bfd_elf_copy_private_header_data +#endif #ifndef bfd_elfNN_bfd_copy_private_bfd_data #define bfd_elfNN_bfd_copy_private_bfd_data \ _bfd_elf_copy_private_bfd_data @@ -171,6 +193,10 @@ #ifndef bfd_elfNN_bfd_is_local_label_name #define bfd_elfNN_bfd_is_local_label_name _bfd_elf_is_local_label_name #endif +#ifndef bfd_elfNN_bfd_is_target_special_symbol +#define bfd_elfNN_bfd_is_target_special_symbol \ + ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) +#endif #ifndef bfd_elfNN_get_dynamic_reloc_upper_bound #define bfd_elfNN_get_dynamic_reloc_upper_bound \ @@ -262,6 +288,17 @@ #define ELF_MAXPAGESIZE 1 #endif +#ifndef ELF_MINPAGESIZE +#define ELF_MINPAGESIZE ELF_MAXPAGESIZE +#endif + +#ifndef ELF_DYNAMIC_SEC_FLAGS +/* Note that we set the SEC_IN_MEMORY flag for these sections. */ +#define ELF_DYNAMIC_SEC_FLAGS \ + (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS \ + | SEC_IN_MEMORY | SEC_LINKER_CREATED) +#endif + #ifndef elf_backend_collect #define elf_backend_collect FALSE #endif @@ -284,6 +321,9 @@ #ifndef elf_backend_get_symbol_type #define elf_backend_get_symbol_type 0 #endif +#ifndef elf_backend_archive_symbol_lookup +#define elf_backend_archive_symbol_lookup _bfd_elf_archive_symbol_lookup +#endif #ifndef elf_backend_name_local_section_symbols #define elf_backend_name_local_section_symbols 0 #endif @@ -291,13 +331,16 @@ #define elf_backend_section_processing 0 #endif #ifndef elf_backend_section_from_shdr -#define elf_backend_section_from_shdr 0 +#define elf_backend_section_from_shdr _bfd_elf_make_section_from_shdr #endif #ifndef elf_backend_section_flags #define elf_backend_section_flags 0 #endif +#ifndef elf_backend_get_sec_type_attr +#define elf_backend_get_sec_type_attr _bfd_elf_get_sec_type_attr +#endif #ifndef elf_backend_section_from_phdr -#define elf_backend_section_from_phdr 0 +#define elf_backend_section_from_phdr _bfd_elf_make_section_from_phdr #endif #ifndef elf_backend_fake_sections #define elf_backend_fake_sections 0 @@ -314,9 +357,15 @@ #ifndef elf_backend_create_dynamic_sections #define elf_backend_create_dynamic_sections 0 #endif +#ifndef elf_backend_omit_section_dynsym +#define elf_backend_omit_section_dynsym _bfd_elf_link_omit_section_dynsym +#endif #ifndef elf_backend_check_relocs #define elf_backend_check_relocs 0 #endif +#ifndef elf_backend_check_directives +#define elf_backend_check_directives 0 +#endif #ifndef elf_backend_adjust_dynamic_symbol #define elf_backend_adjust_dynamic_symbol 0 #endif @@ -371,11 +420,17 @@ #ifndef elf_backend_hide_symbol #define elf_backend_hide_symbol _bfd_elf_link_hash_hide_symbol #endif +#ifndef elf_backend_fixup_symbol +#define elf_backend_fixup_symbol NULL +#endif #ifndef elf_backend_merge_symbol_attribute #define elf_backend_merge_symbol_attribute NULL #endif +#ifndef elf_backend_ignore_undef_symbol +#define elf_backend_ignore_undef_symbol NULL +#endif #ifndef elf_backend_emit_relocs -#define elf_backend_emit_relocs NULL +#define elf_backend_emit_relocs _bfd_elf_link_output_relocs #endif #ifndef elf_backend_count_relocs #define elf_backend_count_relocs NULL @@ -401,6 +456,12 @@ #ifndef elf_backend_ignore_discarded_relocs #define elf_backend_ignore_discarded_relocs NULL #endif +#ifndef elf_backend_action_discarded +#define elf_backend_action_discarded _bfd_elf_default_action_discarded +#endif +#ifndef elf_backend_eh_frame_address_size +#define elf_backend_eh_frame_address_size _bfd_elf_eh_frame_address_size +#endif #ifndef elf_backend_can_make_relative_eh_frame #define elf_backend_can_make_relative_eh_frame _bfd_elf_can_make_relative #endif @@ -443,6 +504,13 @@ #define elf_backend_rela_normal 0 #endif +#ifndef elf_backend_plt_sym_val +#define elf_backend_plt_sym_val NULL +#endif +#ifndef elf_backend_relplt_name +#define elf_backend_relplt_name NULL +#endif + #ifndef ELF_MACHINE_ALT1 #define ELF_MACHINE_ALT1 0 #endif @@ -463,6 +531,26 @@ #define elf_backend_sign_extend_vma 0 #endif +#ifndef elf_backend_link_order_error_handler +#define elf_backend_link_order_error_handler _bfd_default_error_handler +#endif + +#ifndef elf_backend_common_definition +#define elf_backend_common_definition _bfd_elf_common_definition +#endif + +#ifndef elf_backend_common_section_index +#define elf_backend_common_section_index _bfd_elf_common_section_index +#endif + +#ifndef elf_backend_common_section +#define elf_backend_common_section _bfd_elf_common_section +#endif + +#ifndef elf_backend_merge_symbol +#define elf_backend_merge_symbol NULL +#endif + extern const struct elf_size_info _bfd_elfNN_size_info; #ifndef INCLUDED_TARGET_FILE @@ -471,6 +559,8 @@ static const struct elf_backend_data elfNN_bed = ELF_ARCH, /* arch */ ELF_MACHINE_CODE, /* elf_machine_code */ ELF_MAXPAGESIZE, /* maxpagesize */ + ELF_MINPAGESIZE, /* minpagesize */ + ELF_DYNAMIC_SEC_FLAGS, /* dynamic_sec_flags */ elf_info_to_howto, elf_info_to_howto_rel, elf_backend_sym_is_global, @@ -478,17 +568,21 @@ static const struct elf_backend_data elfNN_bed = elf_backend_symbol_processing, elf_backend_symbol_table_processing, elf_backend_get_symbol_type, + elf_backend_archive_symbol_lookup, elf_backend_name_local_section_symbols, elf_backend_section_processing, elf_backend_section_from_shdr, elf_backend_section_flags, + elf_backend_get_sec_type_attr, elf_backend_section_from_phdr, elf_backend_fake_sections, elf_backend_section_from_bfd_section, elf_backend_add_symbol_hook, elf_backend_link_output_symbol_hook, elf_backend_create_dynamic_sections, + elf_backend_omit_section_dynsym, elf_backend_check_relocs, + elf_backend_check_directives, elf_backend_adjust_dynamic_symbol, elf_backend_always_size_sections, elf_backend_size_dynamic_sections, @@ -499,6 +593,7 @@ static const struct elf_backend_data elfNN_bed = elf_backend_final_write_processing, elf_backend_additional_program_headers, elf_backend_modify_segment_map, + elf_backend_gc_mark_dynamic_ref, elf_backend_gc_mark_hook, elf_backend_gc_sweep_hook, elf_backend_post_process_headers, @@ -506,7 +601,9 @@ static const struct elf_backend_data elfNN_bed = elf_backend_output_arch_syms, elf_backend_copy_indirect_symbol, elf_backend_hide_symbol, + elf_backend_fixup_symbol, elf_backend_merge_symbol_attribute, + elf_backend_ignore_undef_symbol, elf_backend_emit_relocs, elf_backend_count_relocs, elf_backend_grok_prstatus, @@ -516,6 +613,8 @@ static const struct elf_backend_data elfNN_bed = elf_backend_reloc_type_class, elf_backend_discard_info, elf_backend_ignore_discarded_relocs, + elf_backend_action_discarded, + elf_backend_eh_frame_address_size, elf_backend_can_make_relative_eh_frame, elf_backend_can_make_lsda_relative_eh_frame, elf_backend_encode_eh_address, @@ -524,11 +623,17 @@ static const struct elf_backend_data elfNN_bed = elf_backend_mips_rtype_to_howto, elf_backend_ecoff_debug_swap, elf_backend_bfd_from_remote_memory, + elf_backend_plt_sym_val, + elf_backend_common_definition, + elf_backend_common_section_index, + elf_backend_common_section, + elf_backend_merge_symbol, + elf_backend_link_order_error_handler, + elf_backend_relplt_name, ELF_MACHINE_ALT1, ELF_MACHINE_ALT2, &elf_backend_size_info, elf_backend_special_sections, - elf_backend_got_symbol_offset, elf_backend_got_header_size, elf_backend_collect, elf_backend_type_change_ok, @@ -577,7 +682,7 @@ const bfd_target TARGET_BIG_SYM = /* section_flags: mask of all section flags */ (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY | SEC_CODE | SEC_DATA | SEC_DEBUGGING | SEC_EXCLUDE | SEC_SORT_ENTRIES - | SEC_ARCH_BIT_0 | SEC_SMALL_DATA | SEC_MERGE | SEC_STRINGS | SEC_GROUP), + | SEC_SMALL_DATA | SEC_MERGE | SEC_STRINGS | SEC_GROUP), /* leading_symbol_char: is the first char of a user symbol predictable, and if so what is it */ @@ -673,7 +778,7 @@ const bfd_target TARGET_LITTLE_SYM = /* section_flags: mask of all section flags */ (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY | SEC_CODE | SEC_DATA | SEC_DEBUGGING | SEC_EXCLUDE | SEC_SORT_ENTRIES - | SEC_ARCH_BIT_0 | SEC_SMALL_DATA | SEC_MERGE | SEC_STRINGS | SEC_GROUP), + | SEC_SMALL_DATA | SEC_MERGE | SEC_STRINGS | SEC_GROUP), /* leading_symbol_char: is the first char of a user symbol predictable, and if so what is it */ diff --git a/contrib/binutils/bfd/format.c b/contrib/binutils/bfd/format.c index 9d9ee86bac4..6a34dd2bea4 100644 --- a/contrib/binutils/bfd/format.c +++ b/contrib/binutils/bfd/format.c @@ -1,6 +1,6 @@ /* Generic BFD support for file formats. - Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1999, 2000, 2001, 2002, 2003 - Free Software Foundation, Inc. + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1999, 2000, 2001, 2002, + 2003, 2005 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* SECTION @@ -38,6 +38,8 @@ SECTION The BFD contains the result of an executable core dump. +SUBSECTION + File format functions */ #include "bfd.h" @@ -173,6 +175,14 @@ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching) if (matching) free (matching_vector); + /* If the file was opened for update, then `output_has_begun' + some time ago when the file was created. Do not recompute + sections sizes or alignments in _bfd_set_section_contents. + We can not set this flag until after checking the format, + because it will interfere with creation of BFD sections. */ + if (abfd->direction == both_direction) + abfd->output_has_begun = TRUE; + return TRUE; /* File position has moved, BTW. */ } @@ -207,7 +217,9 @@ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching) const bfd_target *temp; bfd_error_type err; - if (*target == &binary_vec) + /* Don't check the default target twice. */ + if (*target == &binary_vec + || (!abfd->target_defaulted && *target == save_targ)) continue; abfd->xvec = *target; /* Change BFD's target temporarily. */ @@ -245,16 +257,6 @@ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching) matching_vector[match_count] = temp; match_count++; - -#ifdef GNU960 - /* Big- and little-endian b.out archives look the same, but it - doesn't matter: there is no difference in their headers, and - member file byte orders will (I hope) be handled appropriately - by bfd. Ditto for big and little coff archives. And the 4 - coff/b.out object formats are unambiguous. So accept the - first match we find. */ - break; -#endif } else if ((err = bfd_get_error ()) == bfd_error_wrong_object_format || err == bfd_error_file_ambiguously_recognized) @@ -329,6 +331,14 @@ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching) if (matching) free (matching_vector); + /* If the file was opened for update, then `output_has_begun' + some time ago when the file was created. Do not recompute + sections sizes or alignments in _bfd_set_section_contents. + We can not set this flag until after checking the format, + because it will interfere with creation of BFD sections. */ + if (abfd->direction == both_direction) + abfd->output_has_begun = TRUE; + return TRUE; /* File position has moved, BTW. */ } diff --git a/contrib/binutils/bfd/freebsd.h b/contrib/binutils/bfd/freebsd.h index 5b0ede1acb5..5bc5bbcaa90 100644 --- a/contrib/binutils/bfd/freebsd.h +++ b/contrib/binutils/bfd/freebsd.h @@ -1,23 +1,23 @@ /* BFD back-end definitions used by all FreeBSD targets. - Copyright 1990, 1991, 1992, 1996, 1997, 2000, 2001, 2002 + Copyright 1990, 1991, 1992, 1996, 1997, 2000, 2001, 2002, 2005 Free Software Foundation, Inc. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, + USA. */ /* $FreeBSD$ */ @@ -55,7 +55,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | (((flags) & 0x3f) << 26)) #define N_SET_MACHTYPE(exec, machtype) \ ((exec).a_info = \ - ((exec).a_info & 0xfb00ffff) | ((((int)(machtype))&0x3ff) << 16)) + ((exec).a_info & 0xfb00ffff) | ((((int) (machtype)) & 0x3ff) << 16)) #define N_SET_FLAGS(exec, flags) \ ((exec).a_info = \ ((exec).a_info & 0x03ffffff) | ((flags & 0x03f) << 26)) @@ -67,19 +67,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define SWAP_MAGIC(ext) (freebsd_swap_magic(ext)) -#define MY_bfd_final_link MY(bfd_final_link) -#define MY_write_object_contents MY(write_object_contents) - -static bfd_boolean MY(bfd_final_link) PARAMS ((bfd *, struct bfd_link_info *)); -static bfd_boolean MY(write_object_contents) PARAMS ((bfd *abfd)); -static long freebsd_swap_magic PARAMS ((void *ext)); +#define MY_bfd_final_link MY (bfd_final_link) +#define MY_write_object_contents MY (write_object_contents) +static bfd_boolean MY (bfd_final_link) (bfd *, struct bfd_link_info *); +static bfd_boolean MY (write_object_contents) (bfd *); +static long freebsd_swap_magic (void *); #include "aout-target.h" static bfd_boolean -MY(bfd_final_link) (abfd, info) - bfd *abfd; - struct bfd_link_info *info; +MY (bfd_final_link) (bfd *abfd, struct bfd_link_info *info) { obj_aout_subformat (abfd) = q_magic_format; return NAME(aout,final_link) (abfd, info, MY_final_link_callback); @@ -88,8 +85,7 @@ MY(bfd_final_link) (abfd, info) /* Swap a magic number. We accept either endian, whichever looks valid. */ static long -freebsd_swap_magic (ext) - void *ext; +freebsd_swap_magic (void *ext) { long linfo = bfd_getl32(ext); long binfo = bfd_getb32(ext); @@ -108,8 +104,7 @@ freebsd_swap_magic (ext) file header, symbols, and relocation. */ static bfd_boolean -MY(write_object_contents) (abfd) - bfd *abfd; +MY (write_object_contents) (bfd *abfd) { struct external_exec exec_bytes; struct internal_exec *execp = exec_hdr (abfd); @@ -117,26 +112,27 @@ MY(write_object_contents) (abfd) obj_reloc_entry_size (abfd) = RELOC_STD_SIZE; /* Magic number, maestro, please! */ - switch (bfd_get_arch(abfd)) { - case bfd_arch_m68k: - if (strcmp (abfd->xvec->name, "a.out-m68k4k-netbsd") == 0) - N_SET_MACHTYPE(*execp, M_68K4K_NETBSD); - else - N_SET_MACHTYPE(*execp, M_68K_NETBSD); - break; - case bfd_arch_sparc: - N_SET_MACHTYPE(*execp, M_SPARC_NETBSD); - break; - case bfd_arch_i386: - N_SET_MACHTYPE(*execp, M_386_NETBSD); - break; - case bfd_arch_ns32k: - N_SET_MACHTYPE(*execp, M_532_NETBSD); - break; - default: - N_SET_MACHTYPE(*execp, M_UNKNOWN); - break; - } + switch (bfd_get_arch(abfd)) + { + case bfd_arch_m68k: + if (strcmp (abfd->xvec->name, "a.out-m68k4k-netbsd") == 0) + N_SET_MACHTYPE (*execp, M_68K4K_NETBSD); + else + N_SET_MACHTYPE (*execp, M_68K_NETBSD); + break; + case bfd_arch_sparc: + N_SET_MACHTYPE (*execp, M_SPARC_NETBSD); + break; + case bfd_arch_i386: + N_SET_MACHTYPE (*execp, M_386_NETBSD); + break; + case bfd_arch_ns32k: + N_SET_MACHTYPE (*execp, M_532_NETBSD); + break; + default: + N_SET_MACHTYPE (*execp, M_UNKNOWN); + break; + } WRITE_HEADERS(abfd, execp); diff --git a/contrib/binutils/bfd/gen-aout.c b/contrib/binutils/bfd/gen-aout.c index ea207db6e96..c81d3d0027b 100644 --- a/contrib/binutils/bfd/gen-aout.c +++ b/contrib/binutils/bfd/gen-aout.c @@ -16,7 +16,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "/usr/include/a.out.h" #include diff --git a/contrib/binutils/bfd/genlink.h b/contrib/binutils/bfd/genlink.h index bcdc34b1568..175bee6877a 100644 --- a/contrib/binutils/bfd/genlink.h +++ b/contrib/binutils/bfd/genlink.h @@ -1,22 +1,22 @@ /* genlink.h -- interface to the BFD generic linker - Copyright 1993, 1994, 1996, 2002 Free Software Foundation, Inc. + Copyright 1993, 1994, 1996, 2002, 2005 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef GENLINK_H #define GENLINK_H @@ -65,7 +65,7 @@ struct generic_link_hash_table #define _bfd_generic_link_hash_traverse(table, func, info) \ (bfd_link_hash_traverse \ (&(table)->root, \ - (bfd_boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \ + (bfd_boolean (*) (struct bfd_link_hash_entry *, void *)) (func), \ (info))) /* Get the generic link hash table from the info structure. This is @@ -77,14 +77,13 @@ struct generic_link_hash_table /* The generic linker reads in the asymbol structures for an input BFD and keeps them in the outsymbol and symcount fields. */ -#define _bfd_generic_link_get_symbols(abfd) ((abfd)->outsymbols) +#define _bfd_generic_link_get_symbols(abfd) ((abfd)->outsymbols) #define _bfd_generic_link_get_symcount(abfd) ((abfd)->symcount) /* Add the symbols of input_bfd to the symbols being built for output_bfd. */ extern bfd_boolean _bfd_generic_link_output_symbols - PARAMS ((bfd *output_bfd, bfd *input_bfd, struct bfd_link_info *, - size_t *psymalloc)); + (bfd *, bfd *, struct bfd_link_info *, size_t *); /* This structure is used to pass information to _bfd_generic_link_write_global_symbol, which may be called via @@ -101,11 +100,10 @@ struct generic_write_global_symbol_info via _bfd_generic_link_hash_traverse. The second argument must actually be a struct generic_write_global_symbol_info *. */ extern bfd_boolean _bfd_generic_link_write_global_symbol - PARAMS ((struct generic_link_hash_entry *, PTR)); + (struct generic_link_hash_entry *, void *); /* Generic link hash table entry creation routine. */ struct bfd_hash_entry *_bfd_generic_link_hash_newfunc - PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, - const char *)); + (struct bfd_hash_entry *, struct bfd_hash_table *, const char *); #endif diff --git a/contrib/binutils/bfd/hash.c b/contrib/binutils/bfd/hash.c index 58fa5327bee..ce9ba5c6297 100644 --- a/contrib/binutils/bfd/hash.c +++ b/contrib/binutils/bfd/hash.c @@ -1,28 +1,29 @@ /* hash.c -- hash table routines for BFD - Copyright 1993, 1994, 1995, 1997, 1999, 2001, 2002, 2003 - Free Software Foundation, Inc. + Copyright 1993, 1994, 1995, 1997, 1999, 2001, 2002, 2003, 2004, 2005, + 2006 Free Software Foundation, Inc. Written by Steve Chamberlain -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" #include "libbfd.h" #include "objalloc.h" +#include "libiberty.h" /* SECTION @@ -87,6 +88,10 @@ SUBSECTION been allocated for a hash table. This will not free up the <> itself, which you must provide. +@findex bfd_hash_set_default_size + Use <> to set the default size of + hash table to use. + INODE Looking Up or Entering a String, Traversing a Hash Table, Creating and Freeing a Hash Table, Hash Tables SUBSECTION @@ -225,20 +230,18 @@ SUBSUBSECTION EXAMPLE .struct bfd_hash_entry * -.@var{function_name} (entry, table, string) -. struct bfd_hash_entry *entry; -. struct bfd_hash_table *table; -. const char *string; +.@var{function_name} (struct bfd_hash_entry *entry, +. struct bfd_hash_table *table, +. const char *string) .{ . struct @var{entry_type} *ret = (@var{entry_type} *) entry; . . {* Allocate the structure if it has not already been allocated by a . derived class. *} -. if (ret == (@var{entry_type} *) NULL) +. if (ret == NULL) . { -. ret = ((@var{entry_type} *) -. bfd_hash_allocate (table, sizeof (@var{entry_type}))); -. if (ret == (@var{entry_type} *) NULL) +. ret = bfd_hash_allocate (table, sizeof (* ret)); +. if (ret == NULL) . return NULL; . } . @@ -295,37 +298,38 @@ SUBSUBSECTION */ /* The default number of entries to use when creating a hash table. */ -#define DEFAULT_SIZE (4051) +#define DEFAULT_SIZE 4051 +static size_t bfd_default_hash_table_size = DEFAULT_SIZE; /* Create a new hash table, given a number of entries. */ bfd_boolean -bfd_hash_table_init_n (table, newfunc, size) - struct bfd_hash_table *table; - struct bfd_hash_entry *(*newfunc) PARAMS ((struct bfd_hash_entry *, - struct bfd_hash_table *, - const char *)); - unsigned int size; +bfd_hash_table_init_n (struct bfd_hash_table *table, + struct bfd_hash_entry *(*newfunc) (struct bfd_hash_entry *, + struct bfd_hash_table *, + const char *), + unsigned int entsize, + unsigned int size) { unsigned int alloc; alloc = size * sizeof (struct bfd_hash_entry *); - table->memory = (PTR) objalloc_create (); + table->memory = (void *) objalloc_create (); if (table->memory == NULL) { bfd_set_error (bfd_error_no_memory); return FALSE; } - table->table = ((struct bfd_hash_entry **) - objalloc_alloc ((struct objalloc *) table->memory, alloc)); + table->table = objalloc_alloc ((struct objalloc *) table->memory, alloc); if (table->table == NULL) { bfd_set_error (bfd_error_no_memory); return FALSE; } - memset ((PTR) table->table, 0, alloc); + memset ((void *) table->table, 0, alloc); table->size = size; + table->entsize = entsize; table->newfunc = newfunc; return TRUE; } @@ -333,37 +337,36 @@ bfd_hash_table_init_n (table, newfunc, size) /* Create a new hash table with the default number of entries. */ bfd_boolean -bfd_hash_table_init (table, newfunc) - struct bfd_hash_table *table; - struct bfd_hash_entry *(*newfunc) PARAMS ((struct bfd_hash_entry *, - struct bfd_hash_table *, - const char *)); +bfd_hash_table_init (struct bfd_hash_table *table, + struct bfd_hash_entry *(*newfunc) (struct bfd_hash_entry *, + struct bfd_hash_table *, + const char *), + unsigned int entsize) { - return bfd_hash_table_init_n (table, newfunc, DEFAULT_SIZE); + return bfd_hash_table_init_n (table, newfunc, entsize, + bfd_default_hash_table_size); } /* Free a hash table. */ void -bfd_hash_table_free (table) - struct bfd_hash_table *table; +bfd_hash_table_free (struct bfd_hash_table *table) { - objalloc_free ((struct objalloc *) table->memory); + objalloc_free (table->memory); table->memory = NULL; } /* Look up a string in a hash table. */ struct bfd_hash_entry * -bfd_hash_lookup (table, string, create, copy) - struct bfd_hash_table *table; - const char *string; - bfd_boolean create; - bfd_boolean copy; +bfd_hash_lookup (struct bfd_hash_table *table, + const char *string, + bfd_boolean create, + bfd_boolean copy) { - register const unsigned char *s; - register unsigned long hash; - register unsigned int c; + const unsigned char *s; + unsigned long hash; + unsigned int c; struct bfd_hash_entry *hashp; unsigned int len; unsigned int index; @@ -382,7 +385,7 @@ bfd_hash_lookup (table, string, create, copy) index = hash % table->size; for (hashp = table->table[index]; - hashp != (struct bfd_hash_entry *) NULL; + hashp != NULL; hashp = hashp->next) { if (hashp->hash == hash @@ -391,21 +394,20 @@ bfd_hash_lookup (table, string, create, copy) } if (! create) - return (struct bfd_hash_entry *) NULL; + return NULL; - hashp = (*table->newfunc) ((struct bfd_hash_entry *) NULL, table, string); - if (hashp == (struct bfd_hash_entry *) NULL) - return (struct bfd_hash_entry *) NULL; + hashp = (*table->newfunc) (NULL, table, string); + if (hashp == NULL) + return NULL; if (copy) { char *new; - new = (char *) objalloc_alloc ((struct objalloc *) table->memory, - len + 1); + new = objalloc_alloc ((struct objalloc *) table->memory, len + 1); if (!new) { bfd_set_error (bfd_error_no_memory); - return (struct bfd_hash_entry *) NULL; + return NULL; } memcpy (new, string, len + 1); string = new; @@ -421,17 +423,16 @@ bfd_hash_lookup (table, string, create, copy) /* Replace an entry in a hash table. */ void -bfd_hash_replace (table, old, nw) - struct bfd_hash_table *table; - struct bfd_hash_entry *old; - struct bfd_hash_entry *nw; +bfd_hash_replace (struct bfd_hash_table *table, + struct bfd_hash_entry *old, + struct bfd_hash_entry *nw) { unsigned int index; struct bfd_hash_entry **pph; index = old->hash % table->size; for (pph = &table->table[index]; - (*pph) != (struct bfd_hash_entry *) NULL; + (*pph) != NULL; pph = &(*pph)->next) { if (*pph == old) @@ -444,28 +445,13 @@ bfd_hash_replace (table, old, nw) abort (); } -/* Base method for creating a new hash table entry. */ - -struct bfd_hash_entry * -bfd_hash_newfunc (entry, table, string) - struct bfd_hash_entry *entry; - struct bfd_hash_table *table; - const char *string ATTRIBUTE_UNUSED; -{ - if (entry == (struct bfd_hash_entry *) NULL) - entry = ((struct bfd_hash_entry *) - bfd_hash_allocate (table, sizeof (struct bfd_hash_entry))); - return entry; -} - /* Allocate space in a hash table. */ -PTR -bfd_hash_allocate (table, size) - struct bfd_hash_table *table; - unsigned int size; +void * +bfd_hash_allocate (struct bfd_hash_table *table, + unsigned int size) { - PTR ret; + void * ret; ret = objalloc_alloc ((struct objalloc *) table->memory, size); if (ret == NULL && size != 0) @@ -473,13 +459,24 @@ bfd_hash_allocate (table, size) return ret; } +/* Base method for creating a new hash table entry. */ + +struct bfd_hash_entry * +bfd_hash_newfunc (struct bfd_hash_entry *entry, + struct bfd_hash_table *table, + const char *string ATTRIBUTE_UNUSED) +{ + if (entry == NULL) + entry = bfd_hash_allocate (table, sizeof (* entry)); + return entry; +} + /* Traverse a hash table. */ void -bfd_hash_traverse (table, func, info) - struct bfd_hash_table *table; - bfd_boolean (*func) PARAMS ((struct bfd_hash_entry *, PTR)); - PTR info; +bfd_hash_traverse (struct bfd_hash_table *table, + bfd_boolean (*func) (struct bfd_hash_entry *, void *), + void * info) { unsigned int i; @@ -488,13 +485,29 @@ bfd_hash_traverse (table, func, info) struct bfd_hash_entry *p; for (p = table->table[i]; p != NULL; p = p->next) - { - if (! (*func) (p, info)) - return; - } + if (! (*func) (p, info)) + return; } } +void +bfd_hash_set_default_size (bfd_size_type hash_size) +{ + /* Extend this prime list if you want more granularity of hash table size. */ + static const bfd_size_type hash_size_primes[] = + { + 251, 509, 1021, 2039, 4051, 8599, 16699, 32749 + }; + size_t index; + + /* Work out best prime number near the hash_size. */ + for (index = 0; index < ARRAY_SIZE (hash_size_primes) - 1; ++index) + if (hash_size <= hash_size_primes[index]) + break; + + bfd_default_hash_table_size = hash_size_primes[index]; +} + /* A few different object file formats (a.out, COFF, ELF) use a string table. These functions support adding strings to a string table, returning the byte offset, and writing out the table. @@ -534,30 +547,25 @@ struct bfd_strtab_hash bfd_boolean xcoff; }; -static struct bfd_hash_entry *strtab_hash_newfunc - PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); - /* Routine to create an entry in a strtab. */ static struct bfd_hash_entry * -strtab_hash_newfunc (entry, table, string) - struct bfd_hash_entry *entry; - struct bfd_hash_table *table; - const char *string; +strtab_hash_newfunc (struct bfd_hash_entry *entry, + struct bfd_hash_table *table, + const char *string) { struct strtab_hash_entry *ret = (struct strtab_hash_entry *) entry; /* Allocate the structure if it has not already been allocated by a subclass. */ - if (ret == (struct strtab_hash_entry *) NULL) - ret = ((struct strtab_hash_entry *) - bfd_hash_allocate (table, sizeof (struct strtab_hash_entry))); - if (ret == (struct strtab_hash_entry *) NULL) + if (ret == NULL) + ret = bfd_hash_allocate (table, sizeof (* ret)); + if (ret == NULL) return NULL; /* Call the allocation method of the superclass. */ - ret = ((struct strtab_hash_entry *) - bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string)); + ret = (struct strtab_hash_entry *) + bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string); if (ret) { @@ -578,16 +586,17 @@ strtab_hash_newfunc (entry, table, string) /* Create a new strtab. */ struct bfd_strtab_hash * -_bfd_stringtab_init () +_bfd_stringtab_init (void) { struct bfd_strtab_hash *table; - bfd_size_type amt = sizeof (struct bfd_strtab_hash); + bfd_size_type amt = sizeof (* table); - table = (struct bfd_strtab_hash *) bfd_malloc (amt); + table = bfd_malloc (amt); if (table == NULL) return NULL; - if (! bfd_hash_table_init (&table->table, strtab_hash_newfunc)) + if (!bfd_hash_table_init (&table->table, strtab_hash_newfunc, + sizeof (struct strtab_hash_entry))) { free (table); return NULL; @@ -606,7 +615,7 @@ _bfd_stringtab_init () string. */ struct bfd_strtab_hash * -_bfd_xcoff_stringtab_init () +_bfd_xcoff_stringtab_init (void) { struct bfd_strtab_hash *ret; @@ -619,8 +628,7 @@ _bfd_xcoff_stringtab_init () /* Free a strtab. */ void -_bfd_stringtab_free (table) - struct bfd_strtab_hash *table; +_bfd_stringtab_free (struct bfd_strtab_hash *table) { bfd_hash_table_free (&table->table); free (table); @@ -631,13 +639,12 @@ _bfd_stringtab_free (table) table, and we don't eliminate duplicate strings. */ bfd_size_type -_bfd_stringtab_add (tab, str, hash, copy) - struct bfd_strtab_hash *tab; - const char *str; - bfd_boolean hash; - bfd_boolean copy; +_bfd_stringtab_add (struct bfd_strtab_hash *tab, + const char *str, + bfd_boolean hash, + bfd_boolean copy) { - register struct strtab_hash_entry *entry; + struct strtab_hash_entry *entry; if (hash) { @@ -647,9 +654,7 @@ _bfd_stringtab_add (tab, str, hash, copy) } else { - entry = ((struct strtab_hash_entry *) - bfd_hash_allocate (&tab->table, - sizeof (struct strtab_hash_entry))); + entry = bfd_hash_allocate (&tab->table, sizeof (* entry)); if (entry == NULL) return (bfd_size_type) -1; if (! copy) @@ -658,7 +663,7 @@ _bfd_stringtab_add (tab, str, hash, copy) { char *n; - n = (char *) bfd_hash_allocate (&tab->table, strlen (str) + 1); + n = bfd_hash_allocate (&tab->table, strlen (str) + 1); if (n == NULL) return (bfd_size_type) -1; entry->root.string = n; @@ -689,8 +694,7 @@ _bfd_stringtab_add (tab, str, hash, copy) /* Get the number of bytes in a strtab. */ bfd_size_type -_bfd_stringtab_size (tab) - struct bfd_strtab_hash *tab; +_bfd_stringtab_size (struct bfd_strtab_hash *tab) { return tab->size; } @@ -699,12 +703,10 @@ _bfd_stringtab_size (tab) the file. */ bfd_boolean -_bfd_stringtab_emit (abfd, tab) - register bfd *abfd; - struct bfd_strtab_hash *tab; +_bfd_stringtab_emit (bfd *abfd, struct bfd_strtab_hash *tab) { - register bfd_boolean xcoff; - register struct strtab_hash_entry *entry; + bfd_boolean xcoff; + struct strtab_hash_entry *entry; xcoff = tab->xcoff; @@ -722,11 +724,11 @@ _bfd_stringtab_emit (abfd, tab) /* The output length includes the null byte. */ bfd_put_16 (abfd, (bfd_vma) len, buf); - if (bfd_bwrite ((PTR) buf, (bfd_size_type) 2, abfd) != 2) + if (bfd_bwrite ((void *) buf, (bfd_size_type) 2, abfd) != 2) return FALSE; } - if (bfd_bwrite ((PTR) str, (bfd_size_type) len, abfd) != len) + if (bfd_bwrite ((void *) str, (bfd_size_type) len, abfd) != len) return FALSE; } diff --git a/contrib/binutils/bfd/host-aout.c b/contrib/binutils/bfd/host-aout.c index 5cbb5df763b..902a0206696 100644 --- a/contrib/binutils/bfd/host-aout.c +++ b/contrib/binutils/bfd/host-aout.c @@ -17,7 +17,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" diff --git a/contrib/binutils/bfd/i386aout.c b/contrib/binutils/bfd/i386aout.c index 6b2948ef4cc..128e9d20dc0 100644 --- a/contrib/binutils/bfd/i386aout.c +++ b/contrib/binutils/bfd/i386aout.c @@ -1,23 +1,22 @@ /* BFD back-end for i386 a.out binaries. - Copyright 1990, 1991, 1992, 1994, 1996, 1997, 2001, 2002, 2003 + Copyright 1990, 1991, 1992, 1994, 1996, 1997, 2001, 2002, 2003, 2005 Free Software Foundation, Inc. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* The only 386 aout system we have here is GO32 from DJ. These numbers make BFD work with that. If your aout 386 system @@ -25,20 +24,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ files. Send me (sac@cygnus.com) the runes to make it work on your system, and I'll stick it in for the next release. */ -#define N_HEADER_IN_TEXT(x) 0 - -#define N_TXTOFF(x) 0x20 -#define N_TXTADDR(x) (N_MAGIC(x)==ZMAGIC ? 0x1020 : 0) - -#define N_TXTSIZE(x) ((x).a_text) -#if 0 -#define N_DATADDR(x) (N_MAGIC(x)==OMAGIC? (N_TXTADDR(x)+(x).a_text) : (SEGMENT_SIZE + ((0x1020+(x).a_text-1) & ~(SEGMENT_SIZE-1)))) -#define NOSUBEXECB - -#endif -#define TARGET_PAGE_SIZE 4096 -#define SEGMENT_SIZE 0x400000 -#define DEFAULT_ARCH bfd_arch_i386 +#define N_HEADER_IN_TEXT(x) 0 +#define N_TXTOFF(x) 0x20 +#define N_TXTADDR(x) (N_MAGIC (x) == ZMAGIC ? 0x1020 : 0) +#define N_TXTSIZE(x) ((x).a_text) +#define TARGET_PAGE_SIZE 4096 +#define SEGMENT_SIZE 0x400000 +#define DEFAULT_ARCH bfd_arch_i386 /* Do not "beautify" the CONCAT* macro args. Traditional C will not remove whitespace added here, and thus will fail to concatenate @@ -53,14 +45,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "aout/aout64.h" #include "libaout.h" -static bfd_boolean i386aout_write_object_contents PARAMS ((bfd *)); -static bfd_boolean MY (set_sizes) PARAMS ((bfd *)); - /* Set the machine type correctly. */ static bfd_boolean -i386aout_write_object_contents (abfd) - bfd *abfd; +i386aout_write_object_contents (bfd *abfd) { struct external_exec exec_bytes; struct internal_exec *execp = exec_hdr (abfd); @@ -74,23 +62,26 @@ i386aout_write_object_contents (abfd) return TRUE; } -#define MY_write_object_contents i386aout_write_object_contents +#define MY_write_object_contents i386aout_write_object_contents +#define MY_backend_data & MY (backend_data) -#define MY_backend_data &MY(backend_data) -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 */ - 0, /* text vma? */ - MY(set_sizes), - 1, /* exec header not counted */ - 0, /* add_dynamic_symbols */ - 0, /* add_one_symbol */ - 0, /* link_dynamic_object */ - 0, /* write_dynamic_symbol */ - 0, /* check_dynamic_reloc */ - 0 /* finish_dynamic_link */ -}; +static const struct aout_backend_data MY (backend_data); #include "aout-target.h" + +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. */ + 0, /* Text vma? */ + MY (set_sizes), + 1, /* Exec header not counted. */ + 0, /* Add_dynamic_symbols. */ + 0, /* Add_one_symbol. */ + 0, /* Link_dynamic_object. */ + 0, /* Write_dynamic_symbol. */ + 0, /* Check_dynamic_reloc. */ + 0 /* Finish_dynamic_link. */ +}; diff --git a/contrib/binutils/bfd/i386bsd.c b/contrib/binutils/bfd/i386bsd.c index e21a9ca9341..3f98ee4025c 100644 --- a/contrib/binutils/bfd/i386bsd.c +++ b/contrib/binutils/bfd/i386bsd.c @@ -16,7 +16,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* This data should be correct for the format used under all the various BSD ports for 386 machines. */ diff --git a/contrib/binutils/bfd/i386freebsd.c b/contrib/binutils/bfd/i386freebsd.c index 73fa0ca6014..57b38a7cac3 100644 --- a/contrib/binutils/bfd/i386freebsd.c +++ b/contrib/binutils/bfd/i386freebsd.c @@ -15,7 +15,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #define BYTES_IN_WORD 4 #undef TARGET_IS_BIG_ENDIAN_P diff --git a/contrib/binutils/bfd/i386linux.c b/contrib/binutils/bfd/i386linux.c index da36e75c784..17c618006ff 100644 --- a/contrib/binutils/bfd/i386linux.c +++ b/contrib/binutils/bfd/i386linux.c @@ -1,6 +1,6 @@ /* BFD back-end for linux flavored i386 a.out binaries. - Copyright 1992, 1993, 1994, 1995, 1996, 1997, 2001, 2002, 2003 - Free Software Foundation, Inc. + Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2001, 2002, 2003, + 2004, 2006 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -16,7 +16,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #define TARGET_PAGE_SIZE 4096 #define ZMAGIC_DISK_BLOCK_SIZE 1024 @@ -231,8 +231,9 @@ linux_link_hash_table_create (abfd) ret = (struct linux_link_hash_table *) bfd_alloc (abfd, amt); if (ret == (struct linux_link_hash_table *) NULL) return (struct bfd_link_hash_table *) NULL; - if (! NAME(aout,link_hash_table_init) (&ret->root, abfd, - linux_link_hash_newfunc)) + if (!NAME(aout,link_hash_table_init) (&ret->root, abfd, + linux_link_hash_newfunc, + sizeof (struct linux_link_hash_entry))) { free (ret); return (struct bfd_link_hash_table *) NULL; @@ -316,7 +317,7 @@ linux_link_create_dynamic_sections (abfd, info) || ! bfd_set_section_flags (abfd, s, flags) || ! bfd_set_section_alignment (abfd, s, 2)) return FALSE; - s->_raw_size = 0; + s->size = 0; s->contents = 0; return TRUE; @@ -594,9 +595,9 @@ bfd_i386linux_size_dynamic_sections (output_bfd, info) ".linux-dynamic"); if (s != NULL) { - s->_raw_size = linux_hash_table (info)->fixup_count + 1; - s->_raw_size *= 8; - s->contents = (bfd_byte *) bfd_zalloc (output_bfd, s->_raw_size); + s->size = linux_hash_table (info)->fixup_count + 1; + s->size *= 8; + s->contents = (bfd_byte *) bfd_zalloc (output_bfd, s->size); if (s->contents == NULL) return FALSE; } @@ -761,7 +762,7 @@ linux_finish_dynamic_link (output_bfd, info) SEEK_SET) != 0) return FALSE; - if (bfd_bwrite ((PTR) s->contents, s->_raw_size, output_bfd) != s->_raw_size) + if (bfd_bwrite ((PTR) s->contents, s->size, output_bfd) != s->size) return FALSE; return TRUE; diff --git a/contrib/binutils/bfd/i386netbsd.c b/contrib/binutils/bfd/i386netbsd.c index 26fa30e9e8a..d0116703f90 100644 --- a/contrib/binutils/bfd/i386netbsd.c +++ b/contrib/binutils/bfd/i386netbsd.c @@ -16,7 +16,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #define BYTES_IN_WORD 4 #undef TARGET_IS_BIG_ENDIAN_P diff --git a/contrib/binutils/bfd/ieee.c b/contrib/binutils/bfd/ieee.c index 8a0802840d4..be8455c617f 100644 --- a/contrib/binutils/bfd/ieee.c +++ b/contrib/binutils/bfd/ieee.c @@ -1,6 +1,6 @@ /* BFD back-end for ieee-695 objects. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003 + 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support. @@ -19,7 +19,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #define KEEPMINUSPCININST 0 @@ -40,181 +40,47 @@ struct output_buffer_struct int buffer; }; -static bfd_boolean ieee_write_byte - PARAMS ((bfd *, int)); -static bfd_boolean ieee_write_2bytes - PARAMS ((bfd *, int)); -static bfd_boolean ieee_write_int - PARAMS ((bfd *, bfd_vma)); -static bfd_boolean ieee_write_id - PARAMS ((bfd *, const char *)); -static unsigned short read_2bytes - PARAMS ((common_header_type *)); -static void bfd_get_string - PARAMS ((common_header_type *, char *, size_t)); -static char *read_id - PARAMS ((common_header_type *)); -static bfd_boolean ieee_write_expression - PARAMS ((bfd *, bfd_vma, asymbol *, bfd_boolean, unsigned int)); -static void ieee_write_int5 - PARAMS ((bfd_byte *, bfd_vma)); -static bfd_boolean ieee_write_int5_out - PARAMS ((bfd *, bfd_vma)); -static bfd_boolean parse_int - PARAMS ((common_header_type *, bfd_vma *)); -static int parse_i - PARAMS ((common_header_type *, bfd_boolean *)); -static bfd_vma must_parse_int - PARAMS ((common_header_type *)); -static void parse_expression - PARAMS ((ieee_data_type *, bfd_vma *, ieee_symbol_index_type *, - bfd_boolean *, unsigned int *, asection **)); -static file_ptr ieee_part_after - PARAMS ((ieee_data_type *, file_ptr)); -static ieee_symbol_type *get_symbol - PARAMS ((bfd *, ieee_data_type *, ieee_symbol_type *, unsigned int *, - ieee_symbol_type ***, unsigned int *, int)); -static bfd_boolean ieee_slurp_external_symbols - PARAMS ((bfd *)); -static bfd_boolean ieee_slurp_symbol_table - PARAMS ((bfd *)); -static long ieee_get_symtab_upper_bound - PARAMS ((bfd *)); -static long ieee_canonicalize_symtab - PARAMS ((bfd *, asymbol **)); -static asection *get_section_entry - PARAMS ((bfd *, ieee_data_type *i, unsigned int)); -static void ieee_slurp_sections - PARAMS ((bfd *)); -static bfd_boolean ieee_slurp_debug - PARAMS ((bfd *)); -const bfd_target *ieee_archive_p - PARAMS ((bfd *)); -const bfd_target *ieee_object_p - PARAMS ((bfd *)); -static void ieee_get_symbol_info - PARAMS ((bfd *, asymbol *, symbol_info *)); -static void ieee_print_symbol - PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type)); -static bfd_boolean do_one - PARAMS ((ieee_data_type *, ieee_per_section_type *, unsigned char *, - asection *, int)); -static bfd_boolean ieee_slurp_section_data - PARAMS ((bfd *)); -static bfd_boolean ieee_new_section_hook - PARAMS ((bfd *, asection *)); -static long ieee_get_reloc_upper_bound - PARAMS ((bfd *, sec_ptr)); -static bfd_boolean ieee_get_section_contents - PARAMS ((bfd *, sec_ptr, PTR, file_ptr, bfd_size_type)); -static long ieee_canonicalize_reloc - PARAMS ((bfd *, sec_ptr, arelent **, asymbol **)); -static int comp - PARAMS ((const PTR, const PTR)); -static bfd_boolean ieee_write_section_part - PARAMS ((bfd *)); -static bfd_boolean do_with_relocs - PARAMS ((bfd *, asection *)); -static bfd_boolean do_as_repeat - PARAMS ((bfd *, asection *)); -static bfd_boolean do_without_relocs - PARAMS ((bfd *, asection *)); -static bfd_boolean ieee_mkobject - PARAMS ((bfd *)); -static void fill - PARAMS ((void)); -static void flush - PARAMS ((void)); -static void write_int - PARAMS ((int)); -static void copy_id - PARAMS ((void)); -static void copy_expression - PARAMS ((void)); -static void fill_int - PARAMS ((struct output_buffer_struct *)); -static void drop_int - PARAMS ((struct output_buffer_struct *)); -static void copy_int - PARAMS ((void)); -static void f1_record - PARAMS ((void)); -static void f0_record - PARAMS ((void)); -static void copy_till_end - PARAMS ((void)); -static void f2_record - PARAMS ((void)); -static void f8_record - PARAMS ((void)); -static void e2_record - PARAMS ((void)); -static void block - PARAMS ((void)); -static void relocate_debug - PARAMS ((bfd *, bfd *)); -static bfd_boolean ieee_write_debug_part - PARAMS ((bfd *)); -static bfd_boolean ieee_write_data_part - PARAMS ((bfd *)); -static bfd_boolean init_for_output - PARAMS ((bfd *)); -static bfd_boolean ieee_set_section_contents - PARAMS ((bfd *, sec_ptr, const PTR, file_ptr, bfd_size_type)); -static bfd_boolean ieee_write_external_part - PARAMS ((bfd *)); -static bfd_boolean ieee_write_me_part - PARAMS ((bfd *)); -static bfd_boolean ieee_write_processor - PARAMS ((bfd *)); -static bfd_boolean ieee_write_object_contents - PARAMS ((bfd *)); -static asymbol *ieee_make_empty_symbol - PARAMS ((bfd *)); -static bfd *ieee_openr_next_archived_file - PARAMS ((bfd *, bfd *)); -static bfd_boolean ieee_find_nearest_line - PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **, - const char **, unsigned int *)); -static int ieee_generic_stat_arch_elt - PARAMS ((bfd *, struct stat *)); -static int ieee_sizeof_headers - PARAMS ((bfd *, bfd_boolean)); +static unsigned char *output_ptr_start; +static unsigned char *output_ptr; +static unsigned char *output_ptr_end; +static unsigned char *input_ptr_start; +static unsigned char *input_ptr; +static unsigned char *input_ptr_end; +static bfd *input_bfd; +static bfd *output_bfd; +static int output_buffer; + + +static void block (void); /* Functions for writing to ieee files in the strange way that the - standard requires. */ + standard requires. */ static bfd_boolean -ieee_write_byte (abfd, barg) - bfd *abfd; - int barg; +ieee_write_byte (bfd *abfd, int barg) { bfd_byte byte; byte = barg; - if (bfd_bwrite ((PTR) &byte, (bfd_size_type) 1, abfd) != 1) + if (bfd_bwrite ((void *) &byte, (bfd_size_type) 1, abfd) != 1) return FALSE; return TRUE; } static bfd_boolean -ieee_write_2bytes (abfd, bytes) - bfd *abfd; - int bytes; +ieee_write_2bytes (bfd *abfd, int bytes) { bfd_byte buffer[2]; buffer[0] = bytes >> 8; buffer[1] = bytes & 0xff; - if (bfd_bwrite ((PTR) buffer, (bfd_size_type) 2, abfd) != 2) + if (bfd_bwrite ((void *) buffer, (bfd_size_type) 2, abfd) != 2) return FALSE; return TRUE; } static bfd_boolean -ieee_write_int (abfd, value) - bfd *abfd; - bfd_vma value; +ieee_write_int (bfd *abfd, bfd_vma value) { if (value <= 127) { @@ -264,9 +130,7 @@ ieee_write_int (abfd, value) } static bfd_boolean -ieee_write_id (abfd, id) - bfd *abfd; - const char *id; +ieee_write_id (bfd *abfd, const char *id) { size_t length = strlen (id); @@ -296,7 +160,7 @@ ieee_write_id (abfd, id) return FALSE; } - if (bfd_bwrite ((PTR) id, (bfd_size_type) length, abfd) != length) + if (bfd_bwrite ((void *) id, (bfd_size_type) length, abfd) != length) return FALSE; return TRUE; } @@ -304,13 +168,12 @@ ieee_write_id (abfd, id) /* Functions for reading from ieee files in the strange way that the standard requires. */ -#define this_byte(ieee) *((ieee)->input_p) -#define next_byte(ieee) ((ieee)->input_p++) +#define this_byte(ieee) *((ieee)->input_p) +#define next_byte(ieee) ((ieee)->input_p++) #define this_byte_and_next(ieee) (*((ieee)->input_p++)) static unsigned short -read_2bytes (ieee) - common_header_type *ieee; +read_2bytes (common_header_type *ieee) { unsigned char c1 = this_byte_and_next (ieee); unsigned char c2 = this_byte_and_next (ieee); @@ -319,10 +182,7 @@ read_2bytes (ieee) } static void -bfd_get_string (ieee, string, length) - common_header_type *ieee; - char *string; - size_t length; +bfd_get_string (common_header_type *ieee, char *string, size_t length) { size_t i; @@ -331,22 +191,20 @@ bfd_get_string (ieee, string, length) } static char * -read_id (ieee) - common_header_type *ieee; +read_id (common_header_type *ieee) { size_t length; char *string; length = this_byte_and_next (ieee); if (length <= 0x7f) - { - /* Simple string of length 0 to 127. */ - } + /* Simple string of length 0 to 127. */ + ; + else if (length == 0xde) - { - /* Length is next byte, allowing 0..255. */ - length = this_byte_and_next (ieee); - } + /* Length is next byte, allowing 0..255. */ + length = this_byte_and_next (ieee); + else if (length == 0xdf) { /* Length is next two bytes, allowing 0..65535. */ @@ -364,12 +222,11 @@ read_id (ieee) } static bfd_boolean -ieee_write_expression (abfd, value, symbol, pcrel, index) - bfd *abfd; - bfd_vma value; - asymbol *symbol; - bfd_boolean pcrel; - unsigned int index; +ieee_write_expression (bfd *abfd, + bfd_vma value, + asymbol *symbol, + bfd_boolean pcrel, + unsigned int index) { unsigned int term_count = 0; @@ -396,7 +253,6 @@ ieee_write_expression (abfd, value, symbol, pcrel, index) else if (! bfd_is_abs_section (symbol->section)) { /* Ref to defined symbol - */ - if (symbol->flags & BSF_GLOBAL) { if (! ieee_write_byte (abfd, ieee_variable_I_enum) @@ -462,9 +318,7 @@ ieee_write_expression (abfd, value, symbol, pcrel, index) /* Writes any integer into the buffer supplied and always takes 5 bytes. */ static void -ieee_write_int5 (buffer, value) - bfd_byte *buffer; - bfd_vma value; +ieee_write_int5 (bfd_byte *buffer, bfd_vma value) { buffer[0] = (bfd_byte) ieee_number_repeat_4_enum; buffer[1] = (value >> 24) & 0xff; @@ -474,22 +328,18 @@ ieee_write_int5 (buffer, value) } static bfd_boolean -ieee_write_int5_out (abfd, value) - bfd *abfd; - bfd_vma value; +ieee_write_int5_out (bfd *abfd, bfd_vma value) { bfd_byte b[5]; ieee_write_int5 (b, value); - if (bfd_bwrite ((PTR) b, (bfd_size_type) 5, abfd) != 5) + if (bfd_bwrite ((void *) b, (bfd_size_type) 5, abfd) != 5) return FALSE; return TRUE; } static bfd_boolean -parse_int (ieee, value_ptr) - common_header_type *ieee; - bfd_vma *value_ptr; +parse_int (common_header_type *ieee, bfd_vma *value_ptr) { int value = this_byte (ieee); int result; @@ -518,9 +368,7 @@ parse_int (ieee, value_ptr) } static int -parse_i (ieee, ok) - common_header_type *ieee; - bfd_boolean *ok; +parse_i (common_header_type *ieee, bfd_boolean *ok) { bfd_vma x; *ok = parse_int (ieee, &x); @@ -528,8 +376,7 @@ parse_i (ieee, ok) } static bfd_vma -must_parse_int (ieee) - common_header_type *ieee; +must_parse_int (common_header_type *ieee) { bfd_vma result; BFD_ASSERT (parse_int (ieee, &result)); @@ -649,29 +496,28 @@ static reloc_howto_type rel8_howto = static ieee_symbol_index_type NOSYMBOL = {0, 0}; static void -parse_expression (ieee, value, symbol, pcrel, extra, section) - ieee_data_type *ieee; - bfd_vma *value; - ieee_symbol_index_type *symbol; - bfd_boolean *pcrel; - unsigned int *extra; - asection **section; +parse_expression (ieee_data_type *ieee, + bfd_vma *value, + ieee_symbol_index_type *symbol, + bfd_boolean *pcrel, + unsigned int *extra, + asection **section) { + bfd_boolean loop = TRUE; + ieee_value_type stack[10]; + ieee_value_type *sp = stack; + asection *dummy; + #define POS sp[1] #define TOS sp[0] #define NOS sp[-1] #define INC sp++; #define DEC sp--; - bfd_boolean loop = TRUE; - ieee_value_type stack[10]; - /* The stack pointer always points to the next unused location. */ -#define PUSH(x,y,z) TOS.symbol=x;TOS.section=y;TOS.value=z;INC; -#define POP(x,y,z) DEC;x=TOS.symbol;y=TOS.section;z=TOS.value; - ieee_value_type *sp = stack; - asection *dummy; +#define PUSH(x,y,z) TOS.symbol = x; TOS.section = y; TOS.value = z; INC; +#define POP(x,y,z) DEC; x = TOS.symbol; y = TOS.section; z = TOS.value; while (loop && ieee->h.input_p < ieee->h.last_byte) { @@ -704,12 +550,13 @@ parse_expression (ieee, value, symbol, pcrel, extra, section) next_byte (&(ieee->h)); PUSH (NOSYMBOL, 0, - ieee->section_table[must_parse_int (&(ieee->h))]->_raw_size); + ieee->section_table[must_parse_int (&(ieee->h))]->size); break; case ieee_variable_I_enum: /* Push the address of variable n. */ { ieee_symbol_index_type sy; + next_byte (&(ieee->h)); sy.index = (int) must_parse_int (&(ieee->h)); sy.letter = 'I'; @@ -721,6 +568,7 @@ parse_expression (ieee, value, symbol, pcrel, extra, section) /* Push the address of external variable n. */ { ieee_symbol_index_type sy; + next_byte (&(ieee->h)); sy.index = (int) (must_parse_int (&(ieee->h))); sy.letter = 'X'; @@ -733,6 +581,7 @@ parse_expression (ieee, value, symbol, pcrel, extra, section) bfd_vma value1, value2; asection *section1, *section_dummy; ieee_symbol_index_type sy; + next_byte (&(ieee->h)); POP (sy, section1, value1); @@ -747,6 +596,7 @@ parse_expression (ieee, value, symbol, pcrel, extra, section) asection *section2; ieee_symbol_index_type sy1; ieee_symbol_index_type sy2; + next_byte (&(ieee->h)); POP (sy1, section1, value1); @@ -759,6 +609,7 @@ parse_expression (ieee, value, symbol, pcrel, extra, section) default: { bfd_vma va; + BFD_ASSERT (this_byte (&(ieee->h)) < (int) ieee_variable_A_enum || this_byte (&(ieee->h)) > (int) ieee_variable_Z_enum); if (parse_int (&(ieee->h), &va)) @@ -766,10 +617,8 @@ parse_expression (ieee, value, symbol, pcrel, extra, section) PUSH (NOSYMBOL, bfd_abs_section_ptr, va); } else - { - /* Thats all that we can understand. */ - loop = FALSE; - } + /* Thats all that we can understand. */ + loop = FALSE; } } } @@ -784,6 +633,7 @@ parse_expression (ieee, value, symbol, pcrel, extra, section) { asection *section1; ieee_symbol_index_type sy1; + POP (sy1, section1, *extra); } @@ -808,9 +658,7 @@ parse_expression (ieee, value, symbol, pcrel, extra, section) /* Find the first part of the ieee file after HERE. */ static file_ptr -ieee_part_after (ieee, here) - ieee_data_type *ieee; - file_ptr here; +ieee_part_after (ieee_data_type *ieee, file_ptr here) { int part; file_ptr after = ieee->w.r.me_record; @@ -828,14 +676,13 @@ static unsigned int last_index; static char last_type; /* Is the index for an X or a D. */ static ieee_symbol_type * -get_symbol (abfd, ieee, last_symbol, symbol_count, pptr, max_index, this_type) - bfd *abfd ATTRIBUTE_UNUSED; - ieee_data_type *ieee; - ieee_symbol_type *last_symbol; - unsigned int *symbol_count; - ieee_symbol_type ***pptr; - unsigned int *max_index; - int this_type; +get_symbol (bfd *abfd ATTRIBUTE_UNUSED, + ieee_data_type *ieee, + ieee_symbol_type *last_symbol, + unsigned int *symbol_count, + ieee_symbol_type ***pptr, + unsigned int *max_index, + int this_type) { /* Need a new symbol. */ unsigned int new_index = must_parse_int (&(ieee->h)); @@ -845,7 +692,7 @@ get_symbol (abfd, ieee, last_symbol, symbol_count, pptr, max_index, this_type) ieee_symbol_type *new_symbol; bfd_size_type amt = sizeof (ieee_symbol_type); - new_symbol = (ieee_symbol_type *) bfd_alloc (ieee->h.abfd, amt); + new_symbol = bfd_alloc (ieee->h.abfd, amt); if (!new_symbol) return NULL; @@ -865,17 +712,17 @@ get_symbol (abfd, ieee, last_symbol, symbol_count, pptr, max_index, this_type) } static bfd_boolean -ieee_slurp_external_symbols (abfd) - bfd *abfd; +ieee_slurp_external_symbols (bfd *abfd) { ieee_data_type *ieee = IEEE_DATA (abfd); file_ptr offset = ieee->w.r.external_part; ieee_symbol_type **prev_symbols_ptr = &ieee->external_symbols; ieee_symbol_type **prev_reference_ptr = &ieee->external_reference; - ieee_symbol_type *symbol = (ieee_symbol_type *) NULL; + ieee_symbol_type *symbol = NULL; unsigned int symbol_count = 0; bfd_boolean loop = TRUE; + last_index = 0xffffff; ieee->symbol_table_full = TRUE; @@ -889,14 +736,14 @@ ieee_slurp_external_symbols (abfd) next_byte (&(ieee->h)); symbol = get_symbol (abfd, ieee, symbol, &symbol_count, - &prev_symbols_ptr, - &ieee->external_symbol_max_index, 'I'); + & prev_symbols_ptr, + & ieee->external_symbol_max_index, 'I'); if (symbol == NULL) return FALSE; symbol->symbol.the_bfd = abfd; symbol->symbol.name = read_id (&(ieee->h)); - symbol->symbol.udata.p = (PTR) NULL; + symbol->symbol.udata.p = NULL; symbol->symbol.flags = BSF_NO_FLAGS; break; case ieee_external_symbol_enum: @@ -912,7 +759,7 @@ ieee_slurp_external_symbols (abfd) symbol->symbol.the_bfd = abfd; symbol->symbol.name = read_id (&(ieee->h)); - symbol->symbol.udata.p = (PTR) NULL; + symbol->symbol.udata.p = NULL; symbol->symbol.flags = BSF_NO_FLAGS; break; case ieee_attribute_record_enum >> 8: @@ -921,6 +768,7 @@ ieee_slurp_external_symbols (abfd) unsigned int symbol_type_index; unsigned int symbol_attribute_def; bfd_vma value; + switch (read_2bytes (&ieee->h)) { case ieee_attribute_record_enum: @@ -935,9 +783,8 @@ ieee_slurp_external_symbols (abfd) break; default: (*_bfd_error_handler) - (_("%s: unimplemented ATI record %u for symbol %u"), - bfd_archive_filename (abfd), symbol_attribute_def, - symbol_name_index); + (_("%B: unimplemented ATI record %u for symbol %u"), + abfd, symbol_attribute_def, symbol_name_index); bfd_set_error (bfd_error_bad_value); return FALSE; break; @@ -960,8 +807,8 @@ ieee_slurp_external_symbols (abfd) if (value != 0x3f) { (*_bfd_error_handler) - (_("%s: unexpected ATN type %d in external part"), - bfd_archive_filename (abfd), (int) value); + (_("%B: unexpected ATN type %d in external part"), + abfd, (int) value); bfd_set_error (bfd_error_bad_value); return FALSE; } @@ -982,8 +829,7 @@ ieee_slurp_external_symbols (abfd) default: (*_bfd_error_handler) - (_("%s: unexpected type after ATN"), - bfd_archive_filename (abfd)); + (_("%B: unexpected type after ATN"), abfd); bfd_set_error (bfd_error_bad_value); return FALSE; } @@ -997,6 +843,7 @@ ieee_slurp_external_symbols (abfd) ieee_symbol_index_type symbol_ignore; bfd_boolean pcrel_ignore; unsigned int extra; + next_byte (&(ieee->h)); next_byte (&(ieee->h)); @@ -1021,7 +868,7 @@ ieee_slurp_external_symbols (abfd) val = symbol->symbol.value; for (s = abfd->sections; s != NULL; s = s->next) { - if (val >= s->vma && val < s->vma + s->_raw_size) + if (val >= s->vma && val < s->vma + s->size) { symbol->symbol.section = s; symbol->symbol.value -= s->vma; @@ -1038,6 +885,7 @@ ieee_slurp_external_symbols (abfd) { bfd_vma size; bfd_vma value; + next_byte (&(ieee->h)); /* Throw away the external reference index. */ (void) must_parse_int (&(ieee->h)); @@ -1045,9 +893,7 @@ ieee_slurp_external_symbols (abfd) size = must_parse_int (&(ieee->h)); /* Fetch the default value if available. */ if (! parse_int (&(ieee->h), &value)) - { - value = 0; - } + value = 0; /* This turns into a common. */ symbol->symbol.section = bfd_com_section_ptr; symbol->symbol.value = size; @@ -1065,7 +911,7 @@ ieee_slurp_external_symbols (abfd) symbol->symbol.the_bfd = abfd; symbol->symbol.name = read_id (&(ieee->h)); - symbol->symbol.udata.p = (PTR) NULL; + symbol->symbol.udata.p = NULL; symbol->symbol.section = bfd_und_section_ptr; symbol->symbol.value = (bfd_vma) 0; symbol->symbol.flags = 0; @@ -1085,9 +931,7 @@ ieee_slurp_external_symbols (abfd) ieee->external_symbol_min_index + 1; } else - { - ieee->external_symbol_count = 0; - } + ieee->external_symbol_count = 0; if (ieee->external_reference_max_index != 0) { @@ -1096,28 +940,23 @@ ieee_slurp_external_symbols (abfd) ieee->external_reference_min_index + 1; } else - { - ieee->external_reference_count = 0; - } + ieee->external_reference_count = 0; abfd->symcount = ieee->external_reference_count + ieee->external_symbol_count; if (symbol_count != abfd->symcount) - { - /* There are gaps in the table -- */ - ieee->symbol_table_full = FALSE; - } + /* There are gaps in the table -- */ + ieee->symbol_table_full = FALSE; - *prev_symbols_ptr = (ieee_symbol_type *) NULL; - *prev_reference_ptr = (ieee_symbol_type *) NULL; + *prev_symbols_ptr = NULL; + *prev_reference_ptr = NULL; return TRUE; } static bfd_boolean -ieee_slurp_symbol_table (abfd) - bfd *abfd; +ieee_slurp_symbol_table (bfd *abfd) { if (! IEEE_DATA (abfd)->read_symbols) { @@ -1129,8 +968,7 @@ ieee_slurp_symbol_table (abfd) } static long -ieee_get_symtab_upper_bound (abfd) - bfd *abfd; +ieee_get_symtab_upper_bound (bfd *abfd) { if (! ieee_slurp_symbol_table (abfd)) return -1; @@ -1145,9 +983,7 @@ ieee_get_symtab_upper_bound (abfd) extern const bfd_target ieee_vec; static long -ieee_canonicalize_symtab (abfd, location) - bfd *abfd; - asymbol **location; +ieee_canonicalize_symtab (bfd *abfd, asymbol **location) { ieee_symbol_type *symp; static bfd dummy_bfd; @@ -1167,6 +1003,7 @@ ieee_canonicalize_symtab (abfd, location) if (abfd->symcount) { ieee_data_type *ieee = IEEE_DATA (abfd); + dummy_bfd.xvec = &ieee_vec; if (! ieee_slurp_symbol_table (abfd)) return -1; @@ -1206,10 +1043,7 @@ ieee_canonicalize_symtab (abfd, location) } static asection * -get_section_entry (abfd, ieee, index) - bfd *abfd; - ieee_data_type *ieee; - unsigned int index; +get_section_entry (bfd *abfd, ieee_data_type *ieee, unsigned int index) { if (index >= ieee->section_table_size) { @@ -1225,7 +1059,7 @@ get_section_entry (abfd, ieee, index) amt = c; amt *= sizeof (asection *); - n = (asection **) bfd_realloc (ieee->section_table, amt); + n = bfd_realloc (ieee->section_table, amt); if (n == NULL) return NULL; @@ -1254,8 +1088,7 @@ get_section_entry (abfd, ieee, index) } static void -ieee_slurp_sections (abfd) - bfd *abfd; +ieee_slurp_sections (bfd *abfd) { ieee_data_type *ieee = IEEE_DATA (abfd); file_ptr offset = ieee->w.r.section_part; @@ -1264,6 +1097,7 @@ ieee_slurp_sections (abfd) if (offset != 0) { bfd_byte section_type[3]; + ieee_seek (ieee, offset); while (TRUE) { @@ -1273,6 +1107,7 @@ ieee_slurp_sections (abfd) { asection *section; unsigned int section_index; + next_byte (&(ieee->h)); section_index = must_parse_int (&(ieee->h)); @@ -1290,7 +1125,8 @@ ieee_slurp_sections (abfd) section->flags = SEC_ALLOC; switch (section_type[1]) { - case 0xD3: /* AS Absolute section attributes. */ + /* AS Absolute section attributes. */ + case 0xD3: next_byte (&(ieee->h)); section_type[2] = this_byte (&(ieee->h)); switch (section_type[2]) @@ -1315,7 +1151,9 @@ ieee_slurp_sections (abfd) } } break; - case 0xC3: /* Named relocatable sections (type C). */ + + /* Named relocatable sections (type C). */ + case 0xC3: section_type[1] = this_byte (&(ieee->h)); section->flags = SEC_ALLOC; switch (section_type[1]) @@ -1345,6 +1183,7 @@ ieee_slurp_sections (abfd) /* Skip these fields, which we don't care about. */ { bfd_vma parent, brother, context; + parse_int (&(ieee->h), &parent); parse_int (&(ieee->h), &brother); parse_int (&(ieee->h), &context); @@ -1356,13 +1195,13 @@ ieee_slurp_sections (abfd) unsigned int section_index; bfd_vma value; asection *section; + next_byte (&(ieee->h)); section_index = must_parse_int (&ieee->h); section = get_section_entry (abfd, ieee, section_index); if (section_index > ieee->section_count) - { - ieee->section_count = section_index; - } + ieee->section_count = section_index; + section->alignment_power = bfd_log2 (must_parse_int (&ieee->h)); (void) parse_int (&(ieee->h), &value); @@ -1378,11 +1217,11 @@ ieee_slurp_sections (abfd) { case ieee_section_size_enum: section = ieee->section_table[must_parse_int (&(ieee->h))]; - section->_raw_size = must_parse_int (&(ieee->h)); + section->size = must_parse_int (&(ieee->h)); break; case ieee_physical_region_size_enum: section = ieee->section_table[must_parse_int (&(ieee->h))]; - section->_raw_size = must_parse_int (&(ieee->h)); + section->size = must_parse_int (&(ieee->h)); break; case ieee_region_base_address_enum: section = ieee->section_table[must_parse_int (&(ieee->h))]; @@ -1424,8 +1263,7 @@ ieee_slurp_sections (abfd) out. */ static bfd_boolean -ieee_slurp_debug (abfd) - bfd *abfd; +ieee_slurp_debug (bfd *abfd) { ieee_data_type *ieee = IEEE_DATA (abfd); asection *sec; @@ -1441,16 +1279,15 @@ ieee_slurp_debug (abfd) sec->filepos = ieee->w.r.debug_information_part; debug_end = ieee_part_after (ieee, ieee->w.r.debug_information_part); - sec->_raw_size = debug_end - ieee->w.r.debug_information_part; + sec->size = debug_end - ieee->w.r.debug_information_part; return TRUE; } /* Archive stuff. */ -const bfd_target * -ieee_archive_p (abfd) - bfd *abfd; +static const bfd_target * +ieee_archive_p (bfd *abfd) { char *library; unsigned int i; @@ -1462,14 +1299,14 @@ ieee_archive_p (abfd) ieee_ar_obstack_type *elts = NULL; bfd_size_type amt = sizeof (ieee_ar_data_type); - abfd->tdata.ieee_ar_data = (ieee_ar_data_type *) bfd_alloc (abfd, amt); + abfd->tdata.ieee_ar_data = bfd_alloc (abfd, amt); if (!abfd->tdata.ieee_ar_data) goto error_ret_restore; ieee = IEEE_AR_DATA (abfd); /* Ignore the return value here. It doesn't matter if we don't read the entire buffer. We might have a very small ieee file. */ - bfd_bread ((PTR) buffer, (bfd_size_type) sizeof (buffer), abfd); + bfd_bread ((void *) buffer, (bfd_size_type) sizeof (buffer), abfd); ieee->h.first_byte = buffer; ieee->h.input_p = buffer; @@ -1495,7 +1332,7 @@ ieee_archive_p (abfd) must_parse_int (&(ieee->h)); alc_elts = 10; - elts = (ieee_ar_obstack_type *) bfd_malloc (alc_elts * sizeof *elts); + elts = bfd_malloc (alc_elts * sizeof *elts); if (elts == NULL) goto error_return; @@ -1514,8 +1351,7 @@ ieee_archive_p (abfd) ieee_ar_obstack_type *n; alc_elts *= 2; - n = ((ieee_ar_obstack_type *) - bfd_realloc (elts, alc_elts * sizeof *elts)); + n = bfd_realloc (elts, alc_elts * sizeof (* elts)); if (n == NULL) goto error_return; elts = n; @@ -1537,7 +1373,7 @@ ieee_archive_p (abfd) goto error_return; /* Again ignore return value of bfd_bread. */ - bfd_bread ((PTR) buffer, (bfd_size_type) sizeof (buffer), abfd); + bfd_bread ((void *) buffer, (bfd_size_type) sizeof (buffer), abfd); ieee->h.first_byte = buffer; ieee->h.input_p = buffer; } @@ -1545,7 +1381,7 @@ ieee_archive_p (abfd) amt = ieee->element_count; amt *= sizeof *ieee->elements; - ieee->elements = (ieee_ar_obstack_type *) bfd_alloc (abfd, amt); + ieee->elements = bfd_alloc (abfd, amt); if (ieee->elements == NULL) goto error_return; @@ -1560,7 +1396,7 @@ ieee_archive_p (abfd) goto error_return; /* Again ignore return value of bfd_bread. */ - bfd_bread ((PTR) buffer, (bfd_size_type) sizeof (buffer), abfd); + bfd_bread ((void *) buffer, (bfd_size_type) sizeof (buffer), abfd); ieee->h.first_byte = buffer; ieee->h.input_p = buffer; @@ -1591,257 +1427,31 @@ ieee_archive_p (abfd) return NULL; } -const bfd_target * -ieee_object_p (abfd) - bfd *abfd; +static bfd_boolean +ieee_mkobject (bfd *abfd) { - char *processor; - unsigned int part; - ieee_data_type *ieee; - unsigned char buffer[300]; - ieee_data_type *save = IEEE_DATA (abfd); bfd_size_type amt; - abfd->tdata.ieee_data = 0; - ieee_mkobject (abfd); - - ieee = IEEE_DATA (abfd); - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) - goto fail; - /* Read the first few bytes in to see if it makes sense. Ignore - bfd_bread return value; The file might be very small. */ - bfd_bread ((PTR) buffer, (bfd_size_type) sizeof (buffer), abfd); - - ieee->h.input_p = buffer; - if (this_byte_and_next (&(ieee->h)) != Module_Beginning) - goto got_wrong_format; - - ieee->read_symbols = FALSE; - ieee->read_data = FALSE; - ieee->section_count = 0; - ieee->external_symbol_max_index = 0; - ieee->external_symbol_min_index = IEEE_PUBLIC_BASE; - ieee->external_reference_min_index = IEEE_REFERENCE_BASE; - ieee->external_reference_max_index = 0; - ieee->h.abfd = abfd; - ieee->section_table = NULL; - ieee->section_table_size = 0; - - processor = ieee->mb.processor = read_id (&(ieee->h)); - if (strcmp (processor, "LIBRARY") == 0) - goto got_wrong_format; - ieee->mb.module_name = read_id (&(ieee->h)); - if (abfd->filename == (const char *) NULL) - abfd->filename = ieee->mb.module_name; - - /* Determine the architecture and machine type of the object file. */ - { - const bfd_arch_info_type *arch; - char family[10]; - - /* IEEE does not specify the format of the processor identification - string, so the compiler is free to put in it whatever it wants. - We try here to recognize different processors belonging to the - m68k family. Code for other processors can be added here. */ - if ((processor[0] == '6') && (processor[1] == '8')) - { - if (processor[2] == '3') /* 683xx integrated processors */ - { - switch (processor[3]) - { - case '0': /* 68302, 68306, 68307 */ - case '2': /* 68322, 68328 */ - case '5': /* 68356 */ - strcpy (family, "68000"); /* MC68000-based controllers */ - break; - - case '3': /* 68330, 68331, 68332, 68333, - 68334, 68335, 68336, 68338 */ - case '6': /* 68360 */ - case '7': /* 68376 */ - strcpy (family, "68332"); /* CPU32 and CPU32+ */ - break; - - case '4': - if (processor[4] == '9') /* 68349 */ - strcpy (family, "68030"); /* CPU030 */ - else /* 68340, 68341 */ - strcpy (family, "68332"); /* CPU32 and CPU32+ */ - break; - - default: /* Does not exist yet */ - strcpy (family, "68332"); /* Guess it will be CPU32 */ - } - } - else if (TOUPPER (processor[3]) == 'F') /* 68F333 */ - strcpy (family, "68332"); /* CPU32 */ - else if ((TOUPPER (processor[3]) == 'C') /* Embedded controllers. */ - && ((TOUPPER (processor[2]) == 'E') - || (TOUPPER (processor[2]) == 'H') - || (TOUPPER (processor[2]) == 'L'))) - { - strcpy (family, "68"); - strncat (family, processor + 4, 7); - family[9] = '\0'; - } - else /* "Regular" processors. */ - { - strncpy (family, processor, 9); - family[9] = '\0'; - } - } - else if ((strncmp (processor, "cpu32", 5) == 0) /* CPU32 and CPU32+ */ - || (strncmp (processor, "CPU32", 5) == 0)) - strcpy (family, "68332"); - else - { - strncpy (family, processor, 9); - family[9] = '\0'; - } - - arch = bfd_scan_arch (family); - if (arch == 0) - goto got_wrong_format; - abfd->arch_info = arch; - } - - if (this_byte (&(ieee->h)) != (int) ieee_address_descriptor_enum) - goto fail; - - next_byte (&(ieee->h)); - - if (! parse_int (&(ieee->h), &ieee->ad.number_of_bits_mau)) - goto fail; - - if (! parse_int (&(ieee->h), &ieee->ad.number_of_maus_in_address)) - goto fail; - - /* If there is a byte order info, take it. */ - if (this_byte (&(ieee->h)) == (int) ieee_variable_L_enum - || this_byte (&(ieee->h)) == (int) ieee_variable_M_enum) - next_byte (&(ieee->h)); - - for (part = 0; part < N_W_VARIABLES; part++) - { - bfd_boolean ok; - - if (read_2bytes (&(ieee->h)) != (int) ieee_assign_value_to_variable_enum) - goto fail; - - if (this_byte_and_next (&(ieee->h)) != part) - goto fail; - - ieee->w.offset[part] = parse_i (&(ieee->h), &ok); - if (! ok) - goto fail; - } - - if (ieee->w.r.external_part != 0) - abfd->flags = HAS_SYMS; - - /* By now we know that this is a real IEEE file, we're going to read - the whole thing into memory so that we can run up and down it - quickly. We can work out how big the file is from the trailer - record. */ - - amt = ieee->w.r.me_record + 1; - IEEE_DATA (abfd)->h.first_byte = - (unsigned char *) bfd_alloc (ieee->h.abfd, amt); - if (!IEEE_DATA (abfd)->h.first_byte) - goto fail; - if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) - goto fail; - /* FIXME: Check return value. I'm not sure whether it needs to read - the entire buffer or not. */ - bfd_bread ((PTR) (IEEE_DATA (abfd)->h.first_byte), - (bfd_size_type) ieee->w.r.me_record + 1, abfd); - - ieee_slurp_sections (abfd); - - if (! ieee_slurp_debug (abfd)) - goto fail; - - /* Parse section data to activate file and section flags implied by - section contents. */ - if (! ieee_slurp_section_data (abfd)) - goto fail; - - return abfd->xvec; -got_wrong_format: - bfd_set_error (bfd_error_wrong_format); -fail: - bfd_release (abfd, ieee); - abfd->tdata.ieee_data = save; - return (const bfd_target *) NULL; -} - -static void -ieee_get_symbol_info (ignore_abfd, symbol, ret) - bfd *ignore_abfd ATTRIBUTE_UNUSED; - asymbol *symbol; - symbol_info *ret; -{ - bfd_symbol_info (symbol, ret); - if (symbol->name[0] == ' ') - ret->name = "* empty table entry "; - if (!symbol->section) - ret->type = (symbol->flags & BSF_LOCAL) ? 'a' : 'A'; -} - -static void -ieee_print_symbol (abfd, afile, symbol, how) - bfd *abfd; - PTR afile; - asymbol *symbol; - bfd_print_symbol_type how; -{ - FILE *file = (FILE *) afile; - - switch (how) - { - case bfd_print_symbol_name: - fprintf (file, "%s", symbol->name); - break; - case bfd_print_symbol_more: -#if 0 - fprintf (file, "%4x %2x", aout_symbol (symbol)->desc & 0xffff, - aout_symbol (symbol)->other & 0xff); -#endif - BFD_FAIL (); - break; - case bfd_print_symbol_all: - { - const char *section_name = - (symbol->section == (asection *) NULL - ? "*abs" - : symbol->section->name); - - if (symbol->name[0] == ' ') - { - fprintf (file, "* empty table entry "); - } - else - { - bfd_print_symbol_vandf (abfd, (PTR) file, symbol); - - fprintf (file, " %-5s %04x %02x %s", - section_name, - (unsigned) ieee_symbol (symbol)->index, - (unsigned) 0, - symbol->name); - } - } - break; - } + output_ptr_start = NULL; + output_ptr = NULL; + output_ptr_end = NULL; + input_ptr_start = NULL; + input_ptr = NULL; + input_ptr_end = NULL; + input_bfd = NULL; + output_bfd = NULL; + output_buffer = 0; + amt = sizeof (ieee_data_type); + abfd->tdata.ieee_data = bfd_zalloc (abfd, amt); + return abfd->tdata.ieee_data != NULL; } static bfd_boolean -do_one (ieee, current_map, location_ptr, s, iterations) - ieee_data_type *ieee; - ieee_per_section_type *current_map; - unsigned char *location_ptr; - asection *s; - int iterations; +do_one (ieee_data_type *ieee, + ieee_per_section_type *current_map, + unsigned char *location_ptr, + asection *s, + int iterations) { switch (this_byte (&(ieee->h))) { @@ -1880,9 +1490,8 @@ do_one (ieee, current_map, location_ptr, s, iterations) bfd_boolean pcrel = FALSE; asection *section; ieee_reloc_type *r; - bfd_size_type amt = sizeof (ieee_reloc_type); - r = (ieee_reloc_type *) bfd_alloc (ieee->h.abfd, amt); + r = bfd_alloc (ieee->h.abfd, sizeof (* r)); if (!r) return FALSE; @@ -2010,9 +1619,11 @@ do_one (ieee, current_map, location_ptr, s, iterations) default: { bfd_vma this_size; + if (parse_int (&(ieee->h), &this_size)) { unsigned int i; + for (i = 0; i < this_size; i++) { location_ptr[current_map->pc++] = this_byte (&(ieee->h)); @@ -2020,14 +1631,12 @@ do_one (ieee, current_map, location_ptr, s, iterations) } } else - { - loop = FALSE; - } + loop = FALSE; } } /* Prevent more than the first load-item of an LR record - from being repeated (MRI convention). */ + from being repeated (MRI convention). */ if (iterations != 1) loop = FALSE; } @@ -2039,15 +1648,14 @@ do_one (ieee, current_map, location_ptr, s, iterations) /* Read in all the section data and relocation stuff too. */ static bfd_boolean -ieee_slurp_section_data (abfd) - bfd *abfd; +ieee_slurp_section_data (bfd *abfd) { bfd_byte *location_ptr = (bfd_byte *) NULL; ieee_data_type *ieee = IEEE_DATA (abfd); unsigned int section_number; - - ieee_per_section_type *current_map = (ieee_per_section_type *) NULL; + ieee_per_section_type *current_map = NULL; asection *s; + /* Seek to the start of the data area. */ if (ieee->read_data) return TRUE; @@ -2058,13 +1666,15 @@ ieee_slurp_section_data (abfd) for (s = abfd->sections; s != (asection *) NULL; s = s->next) { ieee_per_section_type *per = ieee_per_section (s); + arelent **relpp; + if ((s->flags & SEC_DEBUGGING) != 0) continue; - per->data = (bfd_byte *) bfd_alloc (ieee->h.abfd, s->_raw_size); + per->data = bfd_alloc (ieee->h.abfd, s->size); if (!per->data) return FALSE; - per->reloc_tail_ptr = - (ieee_reloc_type **) & (s->relocation); + relpp = &s->relocation; + per->reloc_tail_ptr = (ieee_reloc_type **) relpp; } while (TRUE) @@ -2106,7 +1716,7 @@ ieee_slurp_section_data (abfd) &pcrel, &extra, 0); current_map->pc = value; - BFD_ASSERT ((unsigned) (value - s->vma) <= s->_raw_size); + BFD_ASSERT ((unsigned) (value - s->vma) <= s->size); } break; @@ -2167,24 +1777,253 @@ ieee_slurp_section_data (abfd) } } -static bfd_boolean -ieee_new_section_hook (abfd, newsect) - bfd *abfd; - asection *newsect; +static const bfd_target * +ieee_object_p (bfd *abfd) { - newsect->used_by_bfd - = (PTR) bfd_alloc (abfd, (bfd_size_type) sizeof (ieee_per_section_type)); + char *processor; + unsigned int part; + ieee_data_type *ieee; + unsigned char buffer[300]; + ieee_data_type *save = IEEE_DATA (abfd); + bfd_size_type amt; + + abfd->tdata.ieee_data = 0; + ieee_mkobject (abfd); + + ieee = IEEE_DATA (abfd); + if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) + goto fail; + /* Read the first few bytes in to see if it makes sense. Ignore + bfd_bread return value; The file might be very small. */ + bfd_bread ((void *) buffer, (bfd_size_type) sizeof (buffer), abfd); + + ieee->h.input_p = buffer; + if (this_byte_and_next (&(ieee->h)) != Module_Beginning) + goto got_wrong_format; + + ieee->read_symbols = FALSE; + ieee->read_data = FALSE; + ieee->section_count = 0; + ieee->external_symbol_max_index = 0; + ieee->external_symbol_min_index = IEEE_PUBLIC_BASE; + ieee->external_reference_min_index = IEEE_REFERENCE_BASE; + ieee->external_reference_max_index = 0; + ieee->h.abfd = abfd; + ieee->section_table = NULL; + ieee->section_table_size = 0; + + processor = ieee->mb.processor = read_id (&(ieee->h)); + if (strcmp (processor, "LIBRARY") == 0) + goto got_wrong_format; + ieee->mb.module_name = read_id (&(ieee->h)); + if (abfd->filename == (const char *) NULL) + abfd->filename = ieee->mb.module_name; + + /* Determine the architecture and machine type of the object file. */ + { + const bfd_arch_info_type *arch; + char family[10]; + + /* IEEE does not specify the format of the processor identification + string, so the compiler is free to put in it whatever it wants. + We try here to recognize different processors belonging to the + m68k family. Code for other processors can be added here. */ + if ((processor[0] == '6') && (processor[1] == '8')) + { + if (processor[2] == '3') /* 683xx integrated processors. */ + { + switch (processor[3]) + { + case '0': /* 68302, 68306, 68307 */ + case '2': /* 68322, 68328 */ + case '5': /* 68356 */ + strcpy (family, "68000"); /* MC68000-based controllers. */ + break; + + case '3': /* 68330, 68331, 68332, 68333, + 68334, 68335, 68336, 68338 */ + case '6': /* 68360 */ + case '7': /* 68376 */ + strcpy (family, "68332"); /* CPU32 and CPU32+ */ + break; + + case '4': + if (processor[4] == '9') /* 68349 */ + strcpy (family, "68030"); /* CPU030 */ + else /* 68340, 68341 */ + strcpy (family, "68332"); /* CPU32 and CPU32+ */ + break; + + default: /* Does not exist yet. */ + strcpy (family, "68332"); /* Guess it will be CPU32 */ + } + } + else if (TOUPPER (processor[3]) == 'F') /* 68F333 */ + strcpy (family, "68332"); /* CPU32 */ + else if ((TOUPPER (processor[3]) == 'C') /* Embedded controllers. */ + && ((TOUPPER (processor[2]) == 'E') + || (TOUPPER (processor[2]) == 'H') + || (TOUPPER (processor[2]) == 'L'))) + { + strcpy (family, "68"); + strncat (family, processor + 4, 7); + family[9] = '\0'; + } + else /* "Regular" processors. */ + { + strncpy (family, processor, 9); + family[9] = '\0'; + } + } + else if ((strncmp (processor, "cpu32", 5) == 0) /* CPU32 and CPU32+ */ + || (strncmp (processor, "CPU32", 5) == 0)) + strcpy (family, "68332"); + else + { + strncpy (family, processor, 9); + family[9] = '\0'; + } + + arch = bfd_scan_arch (family); + if (arch == 0) + goto got_wrong_format; + abfd->arch_info = arch; + } + + if (this_byte (&(ieee->h)) != (int) ieee_address_descriptor_enum) + goto fail; + + next_byte (&(ieee->h)); + + if (! parse_int (&(ieee->h), &ieee->ad.number_of_bits_mau)) + goto fail; + + if (! parse_int (&(ieee->h), &ieee->ad.number_of_maus_in_address)) + goto fail; + + /* If there is a byte order info, take it. */ + if (this_byte (&(ieee->h)) == (int) ieee_variable_L_enum + || this_byte (&(ieee->h)) == (int) ieee_variable_M_enum) + next_byte (&(ieee->h)); + + for (part = 0; part < N_W_VARIABLES; part++) + { + bfd_boolean ok; + + if (read_2bytes (&(ieee->h)) != (int) ieee_assign_value_to_variable_enum) + goto fail; + + if (this_byte_and_next (&(ieee->h)) != part) + goto fail; + + ieee->w.offset[part] = parse_i (&(ieee->h), &ok); + if (! ok) + goto fail; + } + + if (ieee->w.r.external_part != 0) + abfd->flags = HAS_SYMS; + + /* By now we know that this is a real IEEE file, we're going to read + the whole thing into memory so that we can run up and down it + quickly. We can work out how big the file is from the trailer + record. */ + + amt = ieee->w.r.me_record + 1; + IEEE_DATA (abfd)->h.first_byte = bfd_alloc (ieee->h.abfd, amt); + if (!IEEE_DATA (abfd)->h.first_byte) + goto fail; + if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) + goto fail; + /* FIXME: Check return value. I'm not sure whether it needs to read + the entire buffer or not. */ + bfd_bread ((void *) (IEEE_DATA (abfd)->h.first_byte), + (bfd_size_type) ieee->w.r.me_record + 1, abfd); + + ieee_slurp_sections (abfd); + + if (! ieee_slurp_debug (abfd)) + goto fail; + + /* Parse section data to activate file and section flags implied by + section contents. */ + if (! ieee_slurp_section_data (abfd)) + goto fail; + + return abfd->xvec; +got_wrong_format: + bfd_set_error (bfd_error_wrong_format); +fail: + bfd_release (abfd, ieee); + abfd->tdata.ieee_data = save; + return (const bfd_target *) NULL; +} + +static void +ieee_get_symbol_info (bfd *ignore_abfd ATTRIBUTE_UNUSED, + asymbol *symbol, + symbol_info *ret) +{ + bfd_symbol_info (symbol, ret); + if (symbol->name[0] == ' ') + ret->name = "* empty table entry "; + if (!symbol->section) + ret->type = (symbol->flags & BSF_LOCAL) ? 'a' : 'A'; +} + +static void +ieee_print_symbol (bfd *abfd, + void * afile, + asymbol *symbol, + bfd_print_symbol_type how) +{ + FILE *file = (FILE *) afile; + + switch (how) + { + case bfd_print_symbol_name: + fprintf (file, "%s", symbol->name); + break; + case bfd_print_symbol_more: + BFD_FAIL (); + break; + case bfd_print_symbol_all: + { + const char *section_name = + (symbol->section == (asection *) NULL + ? "*abs" + : symbol->section->name); + + if (symbol->name[0] == ' ') + fprintf (file, "* empty table entry "); + else + { + bfd_print_symbol_vandf (abfd, (void *) file, symbol); + + fprintf (file, " %-5s %04x %02x %s", + section_name, + (unsigned) ieee_symbol (symbol)->index, + (unsigned) 0, + symbol->name); + } + } + break; + } +} + +static bfd_boolean +ieee_new_section_hook (bfd *abfd, asection *newsect) +{ + newsect->used_by_bfd = bfd_alloc (abfd, (bfd_size_type) sizeof (ieee_per_section_type)); if (!newsect->used_by_bfd) return FALSE; - ieee_per_section (newsect)->data = (bfd_byte *) NULL; + ieee_per_section (newsect)->data = NULL; ieee_per_section (newsect)->section = newsect; return TRUE; } static long -ieee_get_reloc_upper_bound (abfd, asect) - bfd *abfd; - sec_ptr asect; +ieee_get_reloc_upper_bound (bfd *abfd, sec_ptr asect) { if ((asect->flags & SEC_DEBUGGING) != 0) return 0; @@ -2194,28 +2033,26 @@ ieee_get_reloc_upper_bound (abfd, asect) } static bfd_boolean -ieee_get_section_contents (abfd, section, location, offset, count) - bfd *abfd; - sec_ptr section; - PTR location; - file_ptr offset; - bfd_size_type count; +ieee_get_section_contents (bfd *abfd, + sec_ptr section, + void * location, + file_ptr offset, + bfd_size_type count) { ieee_per_section_type *p = ieee_per_section (section); if ((section->flags & SEC_DEBUGGING) != 0) return _bfd_generic_get_section_contents (abfd, section, location, offset, count); ieee_slurp_section_data (abfd); - (void) memcpy ((PTR) location, (PTR) (p->data + offset), (unsigned) count); + (void) memcpy ((void *) location, (void *) (p->data + offset), (unsigned) count); return TRUE; } static long -ieee_canonicalize_reloc (abfd, section, relptr, symbols) - bfd *abfd; - sec_ptr section; - arelent **relptr; - asymbol **symbols; +ieee_canonicalize_reloc (bfd *abfd, + sec_ptr section, + arelent **relptr, + asymbol **symbols) { ieee_reloc_type *src = (ieee_reloc_type *) (section->relocation); ieee_data_type *ieee = IEEE_DATA (abfd); @@ -2248,14 +2085,12 @@ ieee_canonicalize_reloc (abfd, section, relptr, symbols) *relptr++ = &src->relent; src = src->next; } - *relptr = (arelent *) NULL; + *relptr = NULL; return section->reloc_count; } static int -comp (ap, bp) - const PTR ap; - const PTR bp; +comp (const void * ap, const void * bp) { arelent *a = *((arelent **) ap); arelent *b = *((arelent **) bp); @@ -2265,11 +2100,11 @@ comp (ap, bp) /* Write the section headers. */ static bfd_boolean -ieee_write_section_part (abfd) - bfd *abfd; +ieee_write_section_part (bfd *abfd) { ieee_data_type *ieee = IEEE_DATA (abfd); asection *s; + ieee->w.r.section_part = bfd_tell (abfd); for (s = abfd->sections; s != (asection *) NULL; s = s->next) { @@ -2318,11 +2153,6 @@ ieee_write_section_part (abfd) if (! ieee_write_id (abfd, s->name)) return FALSE; -#if 0 - ieee_write_int (abfd, 0); /* Parent */ - ieee_write_int (abfd, 0); /* Brother */ - ieee_write_int (abfd, 0); /* Context */ -#endif /* Alignment. */ if (! ieee_write_byte (abfd, ieee_section_alignment_enum) || ! ieee_write_byte (abfd, @@ -2336,7 +2166,7 @@ ieee_write_section_part (abfd) || ! ieee_write_byte (abfd, (bfd_byte) (s->index + IEEE_SECTION_NUMBER_BASE)) - || ! ieee_write_int (abfd, s->_raw_size)) + || ! ieee_write_int (abfd, s->size)) return FALSE; if (abfd->flags & EXEC_P) { @@ -2356,11 +2186,8 @@ ieee_write_section_part (abfd) return TRUE; } - static bfd_boolean -do_with_relocs (abfd, s) - bfd *abfd; - asection *s; +do_with_relocs (bfd *abfd, asection *s) { unsigned int number_of_maus_in_address = bfd_arch_bits_per_address (abfd) / bfd_arch_bits_per_byte (abfd); @@ -2398,14 +2225,14 @@ do_with_relocs (abfd, s) { /* If there aren't any relocations then output the load constant byte opcode rather than the load with relocation opcode. */ - while (current_byte_index < s->_raw_size) + while (current_byte_index < s->size) { bfd_size_type run; unsigned int MAXRUN = 127; run = MAXRUN; - if (run > s->_raw_size - current_byte_index) - run = s->_raw_size - current_byte_index; + if (run > s->size - current_byte_index) + run = s->size - current_byte_index; if (run != 0) { @@ -2414,7 +2241,7 @@ do_with_relocs (abfd, s) /* Output a stream of bytes. */ if (! ieee_write_int (abfd, run)) return FALSE; - if (bfd_bwrite ((PTR) (stream + current_byte_index), run, abfd) + if (bfd_bwrite ((void *) (stream + current_byte_index), run, abfd) != run) return FALSE; current_byte_index += run; @@ -2429,15 +2256,14 @@ do_with_relocs (abfd, s) /* Output the data stream as the longest sequence of bytes possible, allowing for the a reasonable packet size and relocation stuffs. */ - - if ((PTR) stream == (PTR) NULL) + if (stream == NULL) { /* Outputting a section without data, fill it up. */ - stream = (unsigned char *) bfd_zalloc (abfd, s->_raw_size); + stream = bfd_zalloc (abfd, s->size); if (!stream) return FALSE; } - while (current_byte_index < s->_raw_size) + while (current_byte_index < s->size) { bfd_size_type run; unsigned int MAXRUN = 127; @@ -2451,15 +2277,15 @@ do_with_relocs (abfd, s) else run = MAXRUN; - if (run > s->_raw_size - current_byte_index) - run = s->_raw_size - current_byte_index; + if (run > s->size - current_byte_index) + run = s->size - current_byte_index; if (run != 0) { /* Output a stream of bytes. */ if (! ieee_write_int (abfd, run)) return FALSE; - if (bfd_bwrite ((PTR) (stream + current_byte_index), run, abfd) + if (bfd_bwrite ((void *) (stream + current_byte_index), run, abfd) != run) return FALSE; current_byte_index += run; @@ -2473,14 +2299,9 @@ do_with_relocs (abfd, s) { arelent *r = *p; bfd_signed_vma ov; -#if 0 - if (r->howto->pc_relative) - r->addend += current_byte_index; -#endif switch (r->howto->size) { case 2: - ov = bfd_get_signed_32 (abfd, stream + current_byte_index); current_byte_index += 4; @@ -2511,8 +2332,6 @@ do_with_relocs (abfd, s) ieee_function_either_open_b_enum)) return FALSE; -/* abort();*/ - if (r->sym_ptr_ptr != (asymbol **) NULL) { if (! ieee_write_expression (abfd, r->addend + ov, @@ -2557,11 +2376,9 @@ do_with_relocs (abfd, s) bytes. */ static bfd_boolean -do_as_repeat (abfd, s) - bfd *abfd; - asection *s; +do_as_repeat (bfd *abfd, asection *s) { - if (s->_raw_size) + if (s->size) { if (! ieee_write_byte (abfd, ieee_set_current_section_enum) || ! ieee_write_byte (abfd, @@ -2586,7 +2403,7 @@ do_as_repeat (abfd, s) } if (! ieee_write_byte (abfd, ieee_repeat_data_enum) - || ! ieee_write_int (abfd, s->_raw_size) + || ! ieee_write_int (abfd, s->size) || ! ieee_write_byte (abfd, ieee_load_constant_bytes_enum) || ! ieee_write_byte (abfd, 1) || ! ieee_write_byte (abfd, 0)) @@ -2597,9 +2414,7 @@ do_as_repeat (abfd, s) } static bfd_boolean -do_without_relocs (abfd, s) - bfd *abfd; - asection *s; +do_without_relocs (bfd *abfd, asection *s) { bfd_byte *stream = ieee_per_section (s)->data; @@ -2612,7 +2427,7 @@ do_without_relocs (abfd, s) { unsigned int i; - for (i = 0; i < s->_raw_size; i++) + for (i = 0; i < s->size; i++) { if (stream[i] != 0) { @@ -2628,65 +2443,33 @@ do_without_relocs (abfd, s) return TRUE; } - -static unsigned char *output_ptr_start; -static unsigned char *output_ptr; -static unsigned char *output_ptr_end; -static unsigned char *input_ptr_start; -static unsigned char *input_ptr; -static unsigned char *input_ptr_end; -static bfd *input_bfd; -static bfd *output_bfd; -static int output_buffer; - -static bfd_boolean -ieee_mkobject (abfd) - bfd *abfd; -{ - bfd_size_type amt; - - output_ptr_start = NULL; - output_ptr = NULL; - output_ptr_end = NULL; - input_ptr_start = NULL; - input_ptr = NULL; - input_ptr_end = NULL; - input_bfd = NULL; - output_bfd = NULL; - output_buffer = 0; - amt = sizeof (ieee_data_type); - abfd->tdata.ieee_data = (ieee_data_type *) bfd_zalloc (abfd, amt); - return abfd->tdata.ieee_data != NULL; -} - static void -fill () +fill (void) { bfd_size_type amt = input_ptr_end - input_ptr_start; /* FIXME: Check return value. I'm not sure whether it needs to read the entire buffer or not. */ - bfd_bread ((PTR) input_ptr_start, amt, input_bfd); + bfd_bread ((void *) input_ptr_start, amt, input_bfd); input_ptr = input_ptr_start; } static void -flush () +flush (void) { bfd_size_type amt = output_ptr - output_ptr_start; - if (bfd_bwrite ((PTR) (output_ptr_start), amt, output_bfd) != amt) + if (bfd_bwrite ((void *) (output_ptr_start), amt, output_bfd) != amt) abort (); output_ptr = output_ptr_start; output_buffer++; } #define THIS() ( *input_ptr ) -#define NEXT() { input_ptr++; if (input_ptr == input_ptr_end) fill(); } -#define OUT(x) { *output_ptr++ = (x); if(output_ptr == output_ptr_end) flush(); } +#define NEXT() { input_ptr++; if (input_ptr == input_ptr_end) fill (); } +#define OUT(x) { *output_ptr++ = (x); if (output_ptr == output_ptr_end) flush (); } static void -write_int (value) - int value; +write_int (int value) { if (value >= 0 && value <= 127) { @@ -2695,6 +2478,7 @@ write_int (value) else { unsigned int length; + /* How many significant bytes ? */ /* FIXME FOR LONGER INTS. */ if (value & 0xff000000) @@ -2722,7 +2506,7 @@ write_int (value) } static void -copy_id () +copy_id (void) { int length = THIS (); char ch; @@ -2739,7 +2523,7 @@ copy_id () #define VAR(x) ((x | 0x80)) static void -copy_expression () +copy_expression (void) { int stack[10]; int *tos = stack; @@ -2837,11 +2621,10 @@ copy_expression () } /* Drop the int in the buffer, and copy a null into the gap, which we - will overwrite later */ + will overwrite later. */ static void -fill_int (buf) - struct output_buffer_struct *buf; +fill_int (struct output_buffer_struct *buf) { if (buf->buffer == output_buffer) { @@ -2855,8 +2638,7 @@ fill_int (buf) } static void -drop_int (buf) - struct output_buffer_struct *buf; +drop_int (struct output_buffer_struct *buf) { int type = THIS (); int ch; @@ -2892,7 +2674,7 @@ drop_int (buf) } static void -copy_int () +copy_int (void) { int type = THIS (); int ch; @@ -2924,14 +2706,53 @@ copy_int () } } -#define ID copy_id() -#define INT copy_int() -#define EXP copy_expression() -#define INTn(q) copy_int() -#define EXPn(q) copy_expression() +#define ID copy_id () +#define INT copy_int () +#define EXP copy_expression () +#define INTn(q) copy_int () +#define EXPn(q) copy_expression () static void -f1_record () +copy_till_end (void) +{ + int ch = THIS (); + + while (1) + { + while (ch <= 0x80) + { + OUT (ch); + NEXT (); + ch = THIS (); + } + switch (ch) + { + case 0x84: + OUT (THIS ()); + NEXT (); + case 0x83: + OUT (THIS ()); + NEXT (); + case 0x82: + OUT (THIS ()); + NEXT (); + case 0x81: + OUT (THIS ()); + NEXT (); + OUT (THIS ()); + NEXT (); + + ch = THIS (); + break; + default: + return; + } + } + +} + +static void +f1_record (void) { int ch; @@ -3032,7 +2853,7 @@ f1_record () } static void -f0_record () +f0_record (void) { /* Attribute record. */ NEXT (); @@ -3042,46 +2863,7 @@ f0_record () } static void -copy_till_end () -{ - int ch = THIS (); - - while (1) - { - while (ch <= 0x80) - { - OUT (ch); - NEXT (); - ch = THIS (); - } - switch (ch) - { - case 0x84: - OUT (THIS ()); - NEXT (); - case 0x83: - OUT (THIS ()); - NEXT (); - case 0x82: - OUT (THIS ()); - NEXT (); - case 0x81: - OUT (THIS ()); - NEXT (); - OUT (THIS ()); - NEXT (); - - ch = THIS (); - break; - default: - return; - } - } - -} - -static void -f2_record () +f2_record (void) { NEXT (); OUT (0xf2); @@ -3092,9 +2874,8 @@ f2_record () copy_till_end (); } - static void -f8_record () +f8_record (void) { int ch; NEXT (); @@ -3243,7 +3024,7 @@ f8_record () } static void -e2_record () +e2_record (void) { OUT (0xe2); NEXT (); @@ -3254,7 +3035,7 @@ e2_record () } static void -block () +block (void) { int ch; @@ -3288,14 +3069,12 @@ block () } } - /* Moves all the debug information from the source bfd to the output bfd, and relocates any expressions it finds. */ static void -relocate_debug (output, input) - bfd *output ATTRIBUTE_UNUSED; - bfd *input; +relocate_debug (bfd *output ATTRIBUTE_UNUSED, + bfd *input) { #define IBS 400 #define OBS 400 @@ -3306,7 +3085,7 @@ relocate_debug (output, input) input_bfd = input; /* FIXME: Check return value. I'm not sure whether it needs to read the entire buffer or not. */ - bfd_bread ((PTR) input_ptr_start, (bfd_size_type) IBS, input); + bfd_bread ((void *) input_ptr_start, (bfd_size_type) IBS, input); block (); } @@ -3314,8 +3093,7 @@ relocate_debug (output, input) one place, relocating it and emitting it as we go. */ static bfd_boolean -ieee_write_debug_part (abfd) - bfd *abfd; +ieee_write_debug_part (bfd *abfd) { ieee_data_type *ieee = IEEE_DATA (abfd); bfd_chain_type *chain = ieee->chain_root; @@ -3342,7 +3120,7 @@ ieee_write_debug_part (abfd) } ieee->w.r.debug_information_part = here; - if (bfd_bwrite (s->contents, s->_raw_size, abfd) != s->_raw_size) + if (bfd_bwrite (s->contents, s->size, abfd) != s->size) return FALSE; } else @@ -3377,8 +3155,7 @@ ieee_write_debug_part (abfd) /* Write the data in an ieee way. */ static bfd_boolean -ieee_write_data_part (abfd) - bfd *abfd; +ieee_write_data_part (bfd *abfd) { asection *s; @@ -3393,7 +3170,7 @@ ieee_write_data_part (abfd) continue; /* Sort the reloc records so we can insert them in the correct - places */ + places. */ if (s->reloc_count != 0) { if (! do_with_relocs (abfd, s)) @@ -3409,10 +3186,8 @@ ieee_write_data_part (abfd) return TRUE; } - static bfd_boolean -init_for_output (abfd) - bfd *abfd; +init_for_output (bfd *abfd) { asection *s; @@ -3420,10 +3195,10 @@ init_for_output (abfd) { if ((s->flags & SEC_DEBUGGING) != 0) continue; - if (s->_raw_size != 0) + if (s->size != 0) { - bfd_size_type size = s->_raw_size; - ieee_per_section (s)->data = (bfd_byte *) (bfd_alloc (abfd, size)); + bfd_size_type size = s->size; + ieee_per_section (s)->data = bfd_alloc (abfd, size); if (!ieee_per_section (s)->data) return FALSE; } @@ -3437,19 +3212,18 @@ init_for_output (abfd) not a byte image, but a record stream. */ static bfd_boolean -ieee_set_section_contents (abfd, section, location, offset, count) - bfd *abfd; - sec_ptr section; - const PTR location; - file_ptr offset; - bfd_size_type count; +ieee_set_section_contents (bfd *abfd, + sec_ptr section, + const void * location, + file_ptr offset, + bfd_size_type count) { if ((section->flags & SEC_DEBUGGING) != 0) { if (section->contents == NULL) { - bfd_size_type size = section->_raw_size; - section->contents = (unsigned char *) bfd_alloc (abfd, size); + bfd_size_type size = section->size; + section->contents = bfd_alloc (abfd, size); if (section->contents == NULL) return FALSE; } @@ -3464,8 +3238,8 @@ ieee_set_section_contents (abfd, section, location, offset, count) if (!init_for_output (abfd)) return FALSE; } - memcpy ((PTR) (ieee_per_section (section)->data + offset), - (PTR) location, + memcpy ((void *) (ieee_per_section (section)->data + offset), + (void *) location, (unsigned int) count); return TRUE; } @@ -3476,8 +3250,7 @@ ieee_set_section_contents (abfd, section, location, offset, count) symbol values into indexes from the right base. */ static bfd_boolean -ieee_write_external_part (abfd) - bfd *abfd; +ieee_write_external_part (bfd *abfd) { asymbol **q; ieee_data_type *ieee = IEEE_DATA (abfd); @@ -3527,9 +3300,9 @@ ieee_write_external_part (abfd) || ! ieee_write_id (abfd, p->name) || ! ieee_write_2bytes (abfd, ieee_attribute_record_enum) || ! ieee_write_int (abfd, (bfd_vma) public_index) - || ! ieee_write_byte (abfd, 15) /* instruction address */ - || ! ieee_write_byte (abfd, 19) /* static symbol */ - || ! ieee_write_byte (abfd, 1)) /* one of them */ + || ! ieee_write_byte (abfd, 15) /* Instruction address. */ + || ! ieee_write_byte (abfd, 19) /* Static symbol. */ + || ! ieee_write_byte (abfd, 1)) /* One of them. */ return FALSE; /* Write out the value. */ @@ -3600,15 +3373,14 @@ static const unsigned char envi[] = /* 0xf1, 0xce, 0x21, 00, 50, 0x82, 0x07, 0xc7, 0x09, 0x11, 0x11, 0x19, 0x2c, */ - 0xf1, 0xce, 0x21, 00, 52, 0x00, /* exec ok */ + 0xf1, 0xce, 0x21, 00, 52, 0x00, /* exec ok. */ - 0xf1, 0xce, 0x21, 0, 53, 0x03,/* host unix */ + 0xf1, 0xce, 0x21, 0, 53, 0x03,/* host unix. */ /* 0xf1, 0xce, 0x21, 0, 54, 2,1,1 tool & version # */ }; static bfd_boolean -ieee_write_me_part (abfd) - bfd *abfd; +ieee_write_me_part (bfd *abfd) { ieee_data_type *ieee = IEEE_DATA (abfd); ieee->w.r.trailer_part = bfd_tell (abfd); @@ -3629,8 +3401,7 @@ ieee_write_me_part (abfd) /* Write out the IEEE processor ID. */ static bfd_boolean -ieee_write_processor (abfd) - bfd *abfd; +ieee_write_processor (bfd *abfd) { const bfd_arch_info_type *arch; @@ -3642,11 +3413,6 @@ ieee_write_processor (abfd) return FALSE; break; - case bfd_arch_a29k: - if (! ieee_write_id (abfd, "29000")) - return FALSE; - break; - case bfd_arch_h8300: if (! ieee_write_id (abfd, "H8/300")) return FALSE; @@ -3700,11 +3466,22 @@ ieee_write_processor (abfd) case bfd_mach_m68040: id = "68040"; break; case bfd_mach_m68060: id = "68060"; break; case bfd_mach_cpu32: id = "cpu32"; break; - case bfd_mach_mcf5200:id = "5200"; break; - case bfd_mach_mcf5206e:id = "5206e"; break; - case bfd_mach_mcf5307:id = "5307"; break; - case bfd_mach_mcf5407:id = "5407"; break; - case bfd_mach_mcf528x:id = "5282"; break; + case bfd_mach_mcf_isa_a_nodiv: id = "isa-a:nodiv"; break; + case bfd_mach_mcf_isa_a: id = "isa-a"; break; + case bfd_mach_mcf_isa_a_mac: id = "isa-a:mac"; break; + case bfd_mach_mcf_isa_a_emac: id = "isa-a:emac"; break; + case bfd_mach_mcf_isa_aplus: id = "isa-aplus"; break; + case bfd_mach_mcf_isa_aplus_mac: id = "isa-aplus:mac"; break; + case bfd_mach_mcf_isa_aplus_emac: id = "isa-aplus:mac"; break; + case bfd_mach_mcf_isa_b_nousp: id = "isa-b:nousp"; break; + case bfd_mach_mcf_isa_b_nousp_mac: id = "isa-b:nousp:mac"; break; + case bfd_mach_mcf_isa_b_nousp_emac: id = "isa-b:nousp:emac"; break; + case bfd_mach_mcf_isa_b: id = "isa-b"; break; + case bfd_mach_mcf_isa_b_mac: id = "isa-b:mac"; break; + case bfd_mach_mcf_isa_b_emac: id = "isa-b:emac"; break; + case bfd_mach_mcf_isa_b_float: id = "isa-b:float"; break; + case bfd_mach_mcf_isa_b_float_mac: id = "isa-b:float:mac"; break; + case bfd_mach_mcf_isa_b_float_emac: id = "isa-b:float:emac"; break; } if (! ieee_write_id (abfd, id)) @@ -3717,8 +3494,7 @@ ieee_write_processor (abfd) } static bfd_boolean -ieee_write_object_contents (abfd) - bfd *abfd; +ieee_write_object_contents (bfd *abfd) { ieee_data_type *ieee = IEEE_DATA (abfd); unsigned int i; @@ -3756,12 +3532,12 @@ ieee_write_object_contents (abfd) return FALSE; if (abfd->flags & EXEC_P) { - if (! ieee_write_byte (abfd, 0x1)) /* Absolute */ + if (! ieee_write_byte (abfd, 0x1)) /* Absolute. */ return FALSE; } else { - if (! ieee_write_byte (abfd, 0x2)) /* Relocateable */ + if (! ieee_write_byte (abfd, 0x2)) /* Relocateable. */ return FALSE; } @@ -3830,18 +3606,17 @@ ieee_write_object_contents (abfd) return TRUE; } -/* Native-level interface to symbols. */ +/* Native-level interface to symbols. */ /* We read the symbols into a buffer, which is discarded when this function exits. We read the strings into a buffer large enough to hold them all plus all the cached symbol entries. */ static asymbol * -ieee_make_empty_symbol (abfd) - bfd *abfd; +ieee_make_empty_symbol (bfd *abfd) { bfd_size_type amt = sizeof (ieee_symbol_type); - ieee_symbol_type *new = (ieee_symbol_type *) bfd_zalloc (abfd, amt); + ieee_symbol_type *new = bfd_zalloc (abfd, amt); if (!new) return NULL; @@ -3850,9 +3625,7 @@ ieee_make_empty_symbol (abfd) } static bfd * -ieee_openr_next_archived_file (arch, prev) - bfd *arch; - bfd *prev; +ieee_openr_next_archived_file (bfd *arch, bfd *prev) { ieee_ar_data_type *ar = IEEE_AR_DATA (arch); @@ -3881,29 +3654,34 @@ ieee_openr_next_archived_file (arch, prev) else { bfd_set_error (bfd_error_no_more_archived_files); - return (bfd *) NULL; + return NULL; } } } static bfd_boolean -ieee_find_nearest_line (abfd, section, symbols, offset, filename_ptr, - functionname_ptr, line_ptr) - bfd *abfd ATTRIBUTE_UNUSED; - asection *section ATTRIBUTE_UNUSED; - asymbol **symbols ATTRIBUTE_UNUSED; - bfd_vma offset ATTRIBUTE_UNUSED; - const char **filename_ptr ATTRIBUTE_UNUSED; - const char **functionname_ptr ATTRIBUTE_UNUSED; - unsigned int *line_ptr ATTRIBUTE_UNUSED; +ieee_find_nearest_line (bfd *abfd ATTRIBUTE_UNUSED, + asection *section ATTRIBUTE_UNUSED, + asymbol **symbols ATTRIBUTE_UNUSED, + bfd_vma offset ATTRIBUTE_UNUSED, + const char **filename_ptr ATTRIBUTE_UNUSED, + const char **functionname_ptr ATTRIBUTE_UNUSED, + unsigned int *line_ptr ATTRIBUTE_UNUSED) +{ + return FALSE; +} + +static bfd_boolean +ieee_find_inliner_info (bfd *abfd ATTRIBUTE_UNUSED, + const char **filename_ptr ATTRIBUTE_UNUSED, + const char **functionname_ptr ATTRIBUTE_UNUSED, + unsigned int *line_ptr ATTRIBUTE_UNUSED) { return FALSE; } static int -ieee_generic_stat_arch_elt (abfd, buf) - bfd *abfd; - struct stat *buf; +ieee_generic_stat_arch_elt (bfd *abfd, struct stat *buf) { ieee_ar_data_type *ar = (ieee_ar_data_type *) NULL; ieee_data_type *ieee; @@ -3933,75 +3711,12 @@ ieee_generic_stat_arch_elt (abfd, buf) } static int -ieee_sizeof_headers (abfd, x) - bfd *abfd ATTRIBUTE_UNUSED; - bfd_boolean x ATTRIBUTE_UNUSED; +ieee_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, + bfd_boolean x ATTRIBUTE_UNUSED) { return 0; } - -/* The debug info routines are never used. */ -#if 0 - -static void -ieee_bfd_debug_info_start (abfd) - bfd *abfd; -{ - -} - -static void -ieee_bfd_debug_info_end (abfd) - bfd *abfd; -{ - -} - - -/* Add this section to the list of sections we have debug info for, to - be ready to output it at close time. */ -static void -ieee_bfd_debug_info_accumulate (abfd, section) - bfd *abfd; - asection *section; -{ - ieee_data_type *ieee = IEEE_DATA (section->owner); - ieee_data_type *output_ieee = IEEE_DATA (abfd); - - /* Can only accumulate data from other ieee bfds. */ - if (section->owner->xvec != abfd->xvec) - return; - /* Only bother once per bfd. */ - if (ieee->done_debug) - return; - ieee->done_debug = TRUE; - - /* Don't bother if there is no debug info. */ - if (ieee->w.r.debug_information_part == 0) - return; - - /* Add to chain. */ - { - bfd_size_type amt = sizeof (bfd_chain_type); - bfd_chain_type *n = (bfd_chain_type *) bfd_alloc (abfd, amt); - - if (!n) - abort (); /* FIXME */ - n->this = section->owner; - n->next = (bfd_chain_type *) NULL; - - if (output_ieee->chain_head) - output_ieee->chain_head->next = n; - else - output_ieee->chain_root = n; - - output_ieee->chain_head = n; - } -} - -#endif - #define ieee_close_and_cleanup _bfd_generic_close_and_cleanup #define ieee_bfd_free_cached_info _bfd_generic_bfd_free_cached_info @@ -4009,17 +3724,19 @@ ieee_bfd_debug_info_accumulate (abfd, section) #define ieee_slurp_extended_name_table bfd_true #define ieee_construct_extended_name_table \ ((bfd_boolean (*) \ - PARAMS ((bfd *, char **, bfd_size_type *, const char **))) \ + (bfd *, char **, bfd_size_type *, const char **)) \ bfd_true) #define ieee_truncate_arname bfd_dont_truncate_arname #define ieee_write_armap \ ((bfd_boolean (*) \ - PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int))) \ + (bfd *, unsigned int, struct orl *, unsigned int, int)) \ bfd_true) #define ieee_read_ar_hdr bfd_nullvoidptr #define ieee_update_armap_timestamp bfd_true #define ieee_get_elt_at_index _bfd_generic_get_elt_at_index +#define ieee_bfd_is_target_special_symbol \ + ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) #define ieee_bfd_is_local_label_name bfd_generic_is_local_label_name #define ieee_get_lineno _bfd_nosymbols_get_lineno #define ieee_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol @@ -4037,7 +3754,10 @@ ieee_bfd_debug_info_accumulate (abfd, section) #define ieee_bfd_relax_section bfd_generic_relax_section #define ieee_bfd_gc_sections bfd_generic_gc_sections #define ieee_bfd_merge_sections bfd_generic_merge_sections +#define ieee_bfd_is_group_section bfd_generic_is_group_section #define ieee_bfd_discard_group bfd_generic_discard_group +#define ieee_section_already_linked \ + _bfd_generic_section_already_linked #define ieee_bfd_link_hash_table_create _bfd_generic_link_hash_table_create #define ieee_bfd_link_hash_table_free _bfd_generic_link_hash_table_free #define ieee_bfd_link_add_symbols _bfd_generic_link_add_symbols @@ -4047,27 +3767,27 @@ ieee_bfd_debug_info_accumulate (abfd, section) const bfd_target ieee_vec = { - "ieee", /* name */ + "ieee", /* Name. */ bfd_target_ieee_flavour, - BFD_ENDIAN_UNKNOWN, /* target byte order */ - BFD_ENDIAN_UNKNOWN, /* target headers byte order */ - (HAS_RELOC | EXEC_P | /* object flags */ + BFD_ENDIAN_UNKNOWN, /* Target byte order. */ + BFD_ENDIAN_UNKNOWN, /* Target headers byte order. */ + (HAS_RELOC | EXEC_P | /* Object flags. */ HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED), (SEC_CODE | SEC_DATA | SEC_ROM | SEC_HAS_CONTENTS - | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ - '_', /* leading underscore */ - ' ', /* ar_pad_char */ - 16, /* ar_max_namelen */ + | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* Section flags. */ + '_', /* Leading underscore. */ + ' ', /* AR_pad_char. */ + 16, /* AR_max_namelen. */ bfd_getb64, bfd_getb_signed_64, bfd_putb64, bfd_getb32, bfd_getb_signed_32, bfd_putb32, - bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */ + bfd_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_getb16, bfd_getb_signed_16, bfd_putb16, /* Headers. */ {_bfd_dummy_target, - ieee_object_p, /* bfd_check_format */ + ieee_object_p, /* bfd_check_format. */ ieee_archive_p, _bfd_dummy_target, }, @@ -4085,7 +3805,7 @@ const bfd_target ieee_vec = }, /* ieee_close_and_cleanup, ieee_bfd_free_cached_info, ieee_new_section_hook, - ieee_get_section_contents, ieee_get_section_contents_in_window */ + ieee_get_section_contents, ieee_get_section_contents_in_window. */ BFD_JUMP_TABLE_GENERIC (ieee), BFD_JUMP_TABLE_COPY (_bfd_generic), @@ -4095,21 +3815,21 @@ const bfd_target ieee_vec = ieee_construct_extended_name_table, ieee_truncate_arname, ieee_write_armap, ieee_read_ar_hdr, ieee_openr_next_archived_file, ieee_get_elt_at_index, ieee_generic_stat_arch_elt, - ieee_update_armap_timestamp */ + ieee_update_armap_timestamp. */ BFD_JUMP_TABLE_ARCHIVE (ieee), /* ieee_get_symtab_upper_bound, ieee_canonicalize_symtab, ieee_make_empty_symbol, ieee_print_symbol, ieee_get_symbol_info, ieee_bfd_is_local_label_name, ieee_get_lineno, ieee_find_nearest_line, ieee_bfd_make_debug_symbol, - ieee_read_minisymbols, ieee_minisymbol_to_symbol */ + ieee_read_minisymbols, ieee_minisymbol_to_symbol. */ BFD_JUMP_TABLE_SYMBOLS (ieee), /* ieee_get_reloc_upper_bound, ieee_canonicalize_reloc, - ieee_bfd_reloc_type_lookup */ + ieee_bfd_reloc_type_lookup. */ BFD_JUMP_TABLE_RELOCS (ieee), - /* ieee_set_arch_mach, ieee_set_section_contents */ + /* ieee_set_arch_mach, ieee_set_section_contents. */ BFD_JUMP_TABLE_WRITE (ieee), /* ieee_sizeof_headers, ieee_bfd_get_relocated_section_contents, @@ -4117,12 +3837,12 @@ const bfd_target ieee_vec = _bfd_generic_link_hash_table_free, ieee_bfd_link_add_symbols, ieee_bfd_final_link, ieee_bfd_link_split_section, ieee_bfd_gc_sections, - ieee_bfd_merge_sections */ + ieee_bfd_merge_sections. */ BFD_JUMP_TABLE_LINK (ieee), BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), NULL, - (PTR) 0 + NULL }; diff --git a/contrib/binutils/bfd/ihex.c b/contrib/binutils/bfd/ihex.c index 5d2d47fbcb7..fb2ab96c99e 100644 --- a/contrib/binutils/bfd/ihex.c +++ b/contrib/binutils/bfd/ihex.c @@ -1,5 +1,5 @@ /* BFD back-end for Intel Hex objects. - Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003 + Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. Written by Ian Lance Taylor of Cygnus Support . @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* This is what Intel Hex files look like: @@ -116,8 +116,7 @@ The MRI compiler uses this, which is a repeat of type 5: 10..13 Upper 16 bits of start address 14..17 Lower 16 bits of start address 18..19 Checksum in hex notation - 20..21 Carriage return, line feed -*/ + 20..21 Carriage return, line feed. */ #include "bfd.h" #include "sysdep.h" @@ -125,33 +124,6 @@ The MRI compiler uses this, which is a repeat of type 5: #include "libiberty.h" #include "safe-ctype.h" -static void ihex_init - PARAMS ((void)); -static bfd_boolean ihex_mkobject - PARAMS ((bfd *)); -static INLINE int ihex_get_byte - PARAMS ((bfd *, bfd_boolean *)); -static void ihex_bad_byte - PARAMS ((bfd *, unsigned int, int, bfd_boolean)); -static bfd_boolean ihex_scan - PARAMS ((bfd *)); -static const bfd_target *ihex_object_p - PARAMS ((bfd *)); -static bfd_boolean ihex_read_section - PARAMS ((bfd *, asection *, bfd_byte *)); -static bfd_boolean ihex_get_section_contents - PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); -static bfd_boolean ihex_set_section_contents - PARAMS ((bfd *, asection *, const PTR, file_ptr, bfd_size_type)); -static bfd_boolean ihex_write_record - PARAMS ((bfd *, size_t, unsigned int, unsigned int, bfd_byte *)); -static bfd_boolean ihex_write_object_contents - PARAMS ((bfd *)); -static bfd_boolean ihex_set_arch_mach - PARAMS ((bfd *, enum bfd_architecture, unsigned long)); -static int ihex_sizeof_headers - PARAMS ((bfd *, bfd_boolean)); - /* The number of bytes we put on one line during output. */ #define CHUNK 16 @@ -185,7 +157,7 @@ struct ihex_data_struct /* Initialize by filling in the hex conversion array. */ static void -ihex_init () +ihex_init (void) { static bfd_boolean inited; @@ -199,13 +171,11 @@ ihex_init () /* Create an ihex object. */ static bfd_boolean -ihex_mkobject (abfd) - bfd *abfd; +ihex_mkobject (bfd *abfd) { struct ihex_data_struct *tdata; - bfd_size_type amt = sizeof (struct ihex_data_struct); - tdata = (struct ihex_data_struct *) bfd_alloc (abfd, amt); + tdata = bfd_alloc (abfd, sizeof (* tdata)); if (tdata == NULL) return FALSE; @@ -219,9 +189,7 @@ ihex_mkobject (abfd) Return EOF on error or end of file. */ static INLINE int -ihex_get_byte (abfd, errorptr) - bfd *abfd; - bfd_boolean *errorptr; +ihex_get_byte (bfd *abfd, bfd_boolean *errorptr) { bfd_byte c; @@ -238,11 +206,7 @@ ihex_get_byte (abfd, errorptr) /* Report a problem in an Intel Hex file. */ static void -ihex_bad_byte (abfd, lineno, c, error) - bfd *abfd; - unsigned int lineno; - int c; - bfd_boolean error; +ihex_bad_byte (bfd *abfd, unsigned int lineno, int c, bfd_boolean error) { if (c == EOF) { @@ -261,8 +225,8 @@ ihex_bad_byte (abfd, lineno, c, error) buf[1] = '\0'; } (*_bfd_error_handler) - (_("%s:%d: unexpected character `%s' in Intel Hex file\n"), - bfd_archive_filename (abfd), lineno, buf); + (_("%B:%d: unexpected character `%s' in Intel Hex file"), + abfd, lineno, buf); bfd_set_error (bfd_error_bad_value); } } @@ -271,8 +235,7 @@ ihex_bad_byte (abfd, lineno, c, error) section for each contiguous set of bytes. */ static bfd_boolean -ihex_scan (abfd) - bfd *abfd; +ihex_scan (bfd *abfd) { bfd_vma segbase; bfd_vma extbase; @@ -344,7 +307,7 @@ ihex_scan (abfd) chars = len * 2 + 2; if (chars >= bufsize) { - buf = (bfd_byte *) bfd_realloc (buf, (bfd_size_type) chars); + buf = bfd_realloc (buf, (bfd_size_type) chars); if (buf == NULL) goto error_return; bufsize = chars; @@ -369,8 +332,8 @@ ihex_scan (abfd) if (((- chksum) & 0xff) != (unsigned int) HEX2 (buf + 2 * i)) { (*_bfd_error_handler) - (_("%s:%u: bad checksum in Intel Hex file (expected %u, found %u)"), - bfd_archive_filename (abfd), lineno, + (_("%B:%u: bad checksum in Intel Hex file (expected %u, found %u)"), + abfd, lineno, (- chksum) & 0xff, (unsigned int) HEX2 (buf + 2 * i)); bfd_set_error (bfd_error_bad_value); goto error_return; @@ -381,11 +344,11 @@ ihex_scan (abfd) case 0: /* This is a data record. */ if (sec != NULL - && sec->vma + sec->_raw_size == extbase + segbase + addr) + && sec->vma + sec->size == extbase + segbase + addr) { /* This data goes at the end of the section we are currently building. */ - sec->_raw_size += len; + sec->size += len; } else if (len > 0) { @@ -395,7 +358,7 @@ ihex_scan (abfd) sprintf (secbuf, ".sec%d", bfd_count_sections (abfd) + 1); amt = strlen (secbuf) + 1; - secname = (char *) bfd_alloc (abfd, amt); + secname = bfd_alloc (abfd, amt); if (secname == NULL) goto error_return; strcpy (secname, secbuf); @@ -405,7 +368,7 @@ ihex_scan (abfd) sec->flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC; sec->vma = extbase + segbase + addr; sec->lma = extbase + segbase + addr; - sec->_raw_size = len; + sec->size = len; sec->filepos = pos; } break; @@ -423,8 +386,8 @@ ihex_scan (abfd) if (len != 2) { (*_bfd_error_handler) - (_("%s:%u: bad extended address record length in Intel Hex file"), - bfd_archive_filename (abfd), lineno); + (_("%B:%u: bad extended address record length in Intel Hex file"), + abfd, lineno); bfd_set_error (bfd_error_bad_value); goto error_return; } @@ -440,8 +403,8 @@ ihex_scan (abfd) if (len != 4) { (*_bfd_error_handler) - (_("%s:%u: bad extended start address length in Intel Hex file"), - bfd_archive_filename (abfd), lineno); + (_("%B:%u: bad extended start address length in Intel Hex file"), + abfd, lineno); bfd_set_error (bfd_error_bad_value); goto error_return; } @@ -457,8 +420,8 @@ ihex_scan (abfd) if (len != 2) { (*_bfd_error_handler) - (_("%s:%u: bad extended linear address record length in Intel Hex file"), - bfd_archive_filename (abfd), lineno); + (_("%B:%u: bad extended linear address record length in Intel Hex file"), + abfd, lineno); bfd_set_error (bfd_error_bad_value); goto error_return; } @@ -474,8 +437,8 @@ ihex_scan (abfd) if (len != 2 && len != 4) { (*_bfd_error_handler) - (_("%s:%u: bad extended linear start address length in Intel Hex file"), - bfd_archive_filename (abfd), lineno); + (_("%B:%u: bad extended linear start address length in Intel Hex file"), + abfd, lineno); bfd_set_error (bfd_error_bad_value); goto error_return; } @@ -491,8 +454,8 @@ ihex_scan (abfd) default: (*_bfd_error_handler) - (_("%s:%u: unrecognized ihex type %u in Intel Hex file\n"), - bfd_archive_filename (abfd), lineno, type); + (_("%B:%u: unrecognized ihex type %u in Intel Hex file"), + abfd, lineno, type); bfd_set_error (bfd_error_bad_value); goto error_return; } @@ -516,10 +479,9 @@ ihex_scan (abfd) /* Try to recognize an Intel Hex file. */ static const bfd_target * -ihex_object_p (abfd) - bfd *abfd; +ihex_object_p (bfd *abfd) { - PTR tdata_save; + void * tdata_save; bfd_byte b[9]; unsigned int i; unsigned int type; @@ -573,10 +535,7 @@ ihex_object_p (abfd) /* Read the contents of a section in an Intel Hex file. */ static bfd_boolean -ihex_read_section (abfd, section, contents) - bfd *abfd; - asection *section; - bfd_byte *contents; +ihex_read_section (bfd *abfd, asection *section, bfd_byte *contents) { int c; bfd_byte *p; @@ -616,15 +575,14 @@ ihex_read_section (abfd, section, contents) if (type != 0) { (*_bfd_error_handler) - (_("%s: internal error in ihex_read_section"), - bfd_archive_filename (abfd)); + (_("%B: internal error in ihex_read_section"), abfd); bfd_set_error (bfd_error_bad_value); goto error_return; } if (len * 2 > bufsize) { - buf = (bfd_byte *) bfd_realloc (buf, (bfd_size_type) len * 2); + buf = bfd_realloc (buf, (bfd_size_type) len * 2); if (buf == NULL) goto error_return; bufsize = len * 2; @@ -635,7 +593,7 @@ ihex_read_section (abfd, section, contents) for (i = 0; i < len; i++) *p++ = HEX2 (buf + 2 * i); - if ((bfd_size_type) (p - contents) >= section->_raw_size) + if ((bfd_size_type) (p - contents) >= section->size) { /* We've read everything in the section. */ if (buf != NULL) @@ -648,11 +606,10 @@ ihex_read_section (abfd, section, contents) goto error_return; } - if ((bfd_size_type) (p - contents) < section->_raw_size) + if ((bfd_size_type) (p - contents) < section->size) { (*_bfd_error_handler) - (_("%s: bad section length in ihex_read_section"), - bfd_archive_filename (abfd)); + (_("%B: bad section length in ihex_read_section"), abfd); bfd_set_error (bfd_error_bad_value); goto error_return; } @@ -671,16 +628,15 @@ ihex_read_section (abfd, section, contents) /* Get the contents of a section in an Intel Hex file. */ static bfd_boolean -ihex_get_section_contents (abfd, section, location, offset, count) - bfd *abfd; - asection *section; - PTR location; - file_ptr offset; - bfd_size_type count; +ihex_get_section_contents (bfd *abfd, + asection *section, + void * location, + file_ptr offset, + bfd_size_type count) { if (section->used_by_bfd == NULL) { - section->used_by_bfd = bfd_alloc (abfd, section->_raw_size); + section->used_by_bfd = bfd_alloc (abfd, section->size); if (section->used_by_bfd == NULL) return FALSE; if (! ihex_read_section (abfd, section, section->used_by_bfd)) @@ -696,29 +652,26 @@ ihex_get_section_contents (abfd, section, location, offset, count) /* Set the contents of a section in an Intel Hex file. */ static bfd_boolean -ihex_set_section_contents (abfd, section, location, offset, count) - bfd *abfd; - asection *section; - const PTR location; - file_ptr offset; - bfd_size_type count; +ihex_set_section_contents (bfd *abfd, + asection *section, + const void * location, + file_ptr offset, + bfd_size_type count) { struct ihex_data_list *n; bfd_byte *data; struct ihex_data_struct *tdata; - bfd_size_type amt; if (count == 0 || (section->flags & SEC_ALLOC) == 0 || (section->flags & SEC_LOAD) == 0) return TRUE; - amt = sizeof (struct ihex_data_list); - n = (struct ihex_data_list *) bfd_alloc (abfd, amt); + n = bfd_alloc (abfd, sizeof (* n)); if (n == NULL) return FALSE; - data = (bfd_byte *) bfd_alloc (abfd, count); + data = bfd_alloc (abfd, count); if (data == NULL) return FALSE; memcpy (data, location, (size_t) count); @@ -739,7 +692,7 @@ ihex_set_section_contents (abfd, section, location, offset, count) } else { - register struct ihex_data_list **pp; + struct ihex_data_list **pp; for (pp = &tdata->head; *pp != NULL && (*pp)->where < n->where; @@ -757,12 +710,11 @@ ihex_set_section_contents (abfd, section, location, offset, count) /* Write a record out to an Intel Hex file. */ static bfd_boolean -ihex_write_record (abfd, count, addr, type, data) - bfd *abfd; - size_t count; - unsigned int addr; - unsigned int type; - bfd_byte *data; +ihex_write_record (bfd *abfd, + size_t count, + unsigned int addr, + unsigned int type, + bfd_byte *data) { static const char digs[] = "0123456789ABCDEF"; char buf[9 + CHUNK * 2 + 4]; @@ -802,8 +754,7 @@ ihex_write_record (abfd, count, addr, type, data) /* Write out an Intel Hex file. */ static bfd_boolean -ihex_write_object_contents (abfd) - bfd *abfd; +ihex_write_object_contents (bfd *abfd) { bfd_vma segbase; bfd_vma extbase; @@ -820,6 +771,7 @@ ihex_write_object_contents (abfd) where = l->where; p = l->data; count = l->size; + while (count > 0) { size_t now; @@ -933,10 +885,9 @@ ihex_write_object_contents (abfd) irrelevant, so we ignore errors about unknown architectures. */ static bfd_boolean -ihex_set_arch_mach (abfd, arch, mach) - bfd *abfd; - enum bfd_architecture arch; - unsigned long mach; +ihex_set_arch_mach (bfd *abfd, + enum bfd_architecture arch, + unsigned long mach) { if (! bfd_default_set_arch_mach (abfd, arch, mach)) { @@ -949,76 +900,70 @@ ihex_set_arch_mach (abfd, arch, mach) /* Get the size of the headers, for the linker. */ static int -ihex_sizeof_headers (abfd, exec) - bfd *abfd ATTRIBUTE_UNUSED; - bfd_boolean exec ATTRIBUTE_UNUSED; +ihex_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, bfd_boolean exec ATTRIBUTE_UNUSED) { return 0; } /* Some random definitions for the target vector. */ -#define ihex_close_and_cleanup _bfd_generic_close_and_cleanup -#define ihex_bfd_free_cached_info _bfd_generic_bfd_free_cached_info -#define ihex_new_section_hook _bfd_generic_new_section_hook -#define ihex_get_section_contents_in_window \ - _bfd_generic_get_section_contents_in_window - -#define ihex_get_symtab_upper_bound bfd_0l -#define ihex_canonicalize_symtab \ - ((long (*) PARAMS ((bfd *, asymbol **))) bfd_0l) -#define ihex_make_empty_symbol _bfd_generic_make_empty_symbol -#define ihex_print_symbol _bfd_nosymbols_print_symbol -#define ihex_get_symbol_info _bfd_nosymbols_get_symbol_info -#define ihex_bfd_is_local_label_name _bfd_nosymbols_bfd_is_local_label_name -#define ihex_get_lineno _bfd_nosymbols_get_lineno -#define ihex_find_nearest_line _bfd_nosymbols_find_nearest_line -#define ihex_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol -#define ihex_read_minisymbols _bfd_nosymbols_read_minisymbols -#define ihex_minisymbol_to_symbol _bfd_nosymbols_minisymbol_to_symbol - -#define ihex_get_reloc_upper_bound \ - ((long (*) PARAMS ((bfd *, asection *))) bfd_0l) -#define ihex_canonicalize_reloc \ - ((long (*) PARAMS ((bfd *, asection *, arelent **, asymbol **))) bfd_0l) -#define ihex_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup - -#define ihex_bfd_get_relocated_section_contents \ - bfd_generic_get_relocated_section_contents -#define ihex_bfd_relax_section bfd_generic_relax_section -#define ihex_bfd_gc_sections bfd_generic_gc_sections -#define ihex_bfd_merge_sections bfd_generic_merge_sections -#define ihex_bfd_discard_group bfd_generic_discard_group -#define ihex_bfd_link_hash_table_create _bfd_generic_link_hash_table_create -#define ihex_bfd_link_hash_table_free _bfd_generic_link_hash_table_free -#define ihex_bfd_link_add_symbols _bfd_generic_link_add_symbols -#define ihex_bfd_link_just_syms _bfd_generic_link_just_syms -#define ihex_bfd_final_link _bfd_generic_final_link -#define ihex_bfd_link_split_section _bfd_generic_link_split_section +#define ihex_close_and_cleanup _bfd_generic_close_and_cleanup +#define ihex_bfd_free_cached_info _bfd_generic_bfd_free_cached_info +#define ihex_new_section_hook _bfd_generic_new_section_hook +#define ihex_get_section_contents_in_window _bfd_generic_get_section_contents_in_window +#define ihex_get_symtab_upper_bound bfd_0l +#define ihex_canonicalize_symtab ((long (*) (bfd *, asymbol **)) bfd_0l) +#define ihex_make_empty_symbol _bfd_generic_make_empty_symbol +#define ihex_print_symbol _bfd_nosymbols_print_symbol +#define ihex_get_symbol_info _bfd_nosymbols_get_symbol_info +#define ihex_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) +#define ihex_bfd_is_local_label_name _bfd_nosymbols_bfd_is_local_label_name +#define ihex_get_lineno _bfd_nosymbols_get_lineno +#define ihex_find_nearest_line _bfd_nosymbols_find_nearest_line +#define ihex_find_inliner_info _bfd_nosymbols_find_inliner_info +#define ihex_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol +#define ihex_read_minisymbols _bfd_nosymbols_read_minisymbols +#define ihex_minisymbol_to_symbol _bfd_nosymbols_minisymbol_to_symbol +#define ihex_get_reloc_upper_bound ((long (*) (bfd *, asection *)) bfd_0l) +#define ihex_canonicalize_reloc ((long (*) (bfd *, asection *, arelent **, asymbol **)) bfd_0l) +#define ihex_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup +#define ihex_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents +#define ihex_bfd_relax_section bfd_generic_relax_section +#define ihex_bfd_gc_sections bfd_generic_gc_sections +#define ihex_bfd_merge_sections bfd_generic_merge_sections +#define ihex_bfd_is_group_section bfd_generic_is_group_section +#define ihex_bfd_discard_group bfd_generic_discard_group +#define ihex_section_already_linked _bfd_generic_section_already_linked +#define ihex_bfd_link_hash_table_create _bfd_generic_link_hash_table_create +#define ihex_bfd_link_hash_table_free _bfd_generic_link_hash_table_free +#define ihex_bfd_link_add_symbols _bfd_generic_link_add_symbols +#define ihex_bfd_link_just_syms _bfd_generic_link_just_syms +#define ihex_bfd_final_link _bfd_generic_final_link +#define ihex_bfd_link_split_section _bfd_generic_link_split_section /* The Intel Hex target vector. */ const bfd_target ihex_vec = { - "ihex", /* name */ + "ihex", /* Name. */ bfd_target_ihex_flavour, - BFD_ENDIAN_UNKNOWN, /* target byte order */ - BFD_ENDIAN_UNKNOWN, /* target headers byte order */ - 0, /* object flags */ - (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD), /* section flags */ - 0, /* leading underscore */ - ' ', /* ar_pad_char */ - 16, /* ar_max_namelen */ + BFD_ENDIAN_UNKNOWN, /* Target byte order. */ + BFD_ENDIAN_UNKNOWN, /* Target headers byte order. */ + 0, /* Object flags. */ + (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD), /* Section flags. */ + 0, /* Leading underscore. */ + ' ', /* AR_pad_char. */ + 16, /* AR_max_namelen. */ bfd_getb64, bfd_getb_signed_64, bfd_putb64, bfd_getb32, bfd_getb_signed_32, bfd_putb32, - bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */ + bfd_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_getb16, bfd_getb_signed_16, bfd_putb16, /* Headers. */ { _bfd_dummy_target, - ihex_object_p, /* bfd_check_format */ + ihex_object_p, /* bfd_check_format. */ _bfd_dummy_target, _bfd_dummy_target, }, @@ -1028,7 +973,7 @@ const bfd_target ihex_vec = _bfd_generic_mkarchive, bfd_false, }, - { /* bfd_write_contents */ + { /* bfd_write_contents. */ bfd_false, ihex_write_object_contents, _bfd_write_archive_contents, @@ -1047,5 +992,5 @@ const bfd_target ihex_vec = NULL, - (PTR) 0 + NULL }; diff --git a/contrib/binutils/bfd/init.c b/contrib/binutils/bfd/init.c index 07401eb9478..a34acbf9faf 100644 --- a/contrib/binutils/bfd/init.c +++ b/contrib/binutils/bfd/init.c @@ -17,7 +17,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" @@ -27,6 +27,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ SECTION Initialization +SUBSECTION + Initialization functions + These are the functions that handle initializing a BFD. */ diff --git a/contrib/binutils/bfd/libaout.h b/contrib/binutils/bfd/libaout.h index 67054e37827..bb3ee808267 100644 --- a/contrib/binutils/bfd/libaout.h +++ b/contrib/binutils/bfd/libaout.h @@ -1,6 +1,6 @@ /* BFD back-end data structures for a.out (and similar) files. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003 + 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Written by Cygnus Support. @@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef LIBAOUT_H #define LIBAOUT_H @@ -31,22 +31,22 @@ /* Macros for accessing components in an aout header. */ -#define H_PUT_64 bfd_h_put_64 -#define H_PUT_32 bfd_h_put_32 -#define H_PUT_16 bfd_h_put_16 -#define H_PUT_8 bfd_h_put_8 +#define H_PUT_64 bfd_h_put_64 +#define H_PUT_32 bfd_h_put_32 +#define H_PUT_16 bfd_h_put_16 +#define H_PUT_8 bfd_h_put_8 #define H_PUT_S64 bfd_h_put_signed_64 #define H_PUT_S32 bfd_h_put_signed_32 #define H_PUT_S16 bfd_h_put_signed_16 -#define H_PUT_S8 bfd_h_put_signed_8 -#define H_GET_64 bfd_h_get_64 -#define H_GET_32 bfd_h_get_32 -#define H_GET_16 bfd_h_get_16 -#define H_GET_8 bfd_h_get_8 +#define H_PUT_S8 bfd_h_put_signed_8 +#define H_GET_64 bfd_h_get_64 +#define H_GET_32 bfd_h_get_32 +#define H_GET_16 bfd_h_get_16 +#define H_GET_8 bfd_h_get_8 #define H_GET_S64 bfd_h_get_signed_64 #define H_GET_S32 bfd_h_get_signed_32 #define H_GET_S16 bfd_h_get_signed_16 -#define H_GET_S8 bfd_h_get_signed_8 +#define H_GET_S8 bfd_h_get_signed_8 /* Parameterize the a.out code based on whether it is being built for a 32-bit architecture or a 64-bit architecture. */ @@ -54,10 +54,10 @@ remove whitespace added here, and thus will fail to concatenate the tokens. */ #if ARCH_SIZE==64 -#define GET_WORD H_GET_64 +#define GET_WORD H_GET_64 #define GET_SWORD H_GET_S64 #define GET_MAGIC H_GET_32 -#define PUT_WORD H_PUT_64 +#define PUT_WORD H_PUT_64 #define PUT_MAGIC H_PUT_32 #ifndef NAME #define NAME(x,y) CONCAT3 (x,_64_,y) @@ -66,10 +66,10 @@ #define BYTES_IN_WORD 8 #else #if ARCH_SIZE==16 -#define GET_WORD H_GET_16 +#define GET_WORD H_GET_16 #define GET_SWORD H_GET_S16 #define GET_MAGIC H_GET_16 -#define PUT_WORD H_PUT_16 +#define PUT_WORD H_PUT_16 #define PUT_MAGIC H_PUT_16 #ifndef NAME #define NAME(x,y) CONCAT3 (x,_16_,y) @@ -77,10 +77,10 @@ #define JNAME(x) CONCAT2 (x,_16) #define BYTES_IN_WORD 2 #else /* ARCH_SIZE == 32 */ -#define GET_WORD H_GET_32 +#define GET_WORD H_GET_32 #define GET_SWORD H_GET_S32 #define GET_MAGIC H_GET_32 -#define PUT_WORD H_PUT_32 +#define PUT_WORD H_PUT_32 #define PUT_MAGIC H_PUT_32 #ifndef NAME #define NAME(x,y) CONCAT3 (x,_32_,y) @@ -126,7 +126,7 @@ struct aout_link_hash_table #define aout_link_hash_traverse(table, func, info) \ (bfd_link_hash_traverse \ (&(table)->root, \ - (bfd_boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \ + (bfd_boolean (*) (struct bfd_link_hash_entry *, void *)) (func), \ (info))) /* Get the a.out link hash table from the info structure. This is @@ -165,8 +165,7 @@ struct aout_backend_data /* Callback for setting the page and segment sizes, if they can't be trivially determined from the architecture. */ - bfd_boolean (*set_sizes) - PARAMS ((bfd *)); + bfd_boolean (*set_sizes) (bfd *); /* zmagic files only. For go32, the length of the exec header contributes to the size of the text section in the file for alignment purposes but @@ -176,39 +175,38 @@ struct aout_backend_data /* Callback from the add symbols phase of the linker code to handle a dynamic object. */ bfd_boolean (*add_dynamic_symbols) - PARAMS ((bfd *, struct bfd_link_info *, struct external_nlist **, - bfd_size_type *, char **)); + (bfd *, struct bfd_link_info *, struct external_nlist **, + bfd_size_type *, char **); /* Callback from the add symbols phase of the linker code to handle adding a single symbol to the global linker hash table. */ bfd_boolean (*add_one_symbol) - PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword, - asection *, bfd_vma, const char *, bfd_boolean, bfd_boolean, - struct bfd_link_hash_entry **)); + (struct bfd_link_info *, bfd *, const char *, flagword, + asection *, bfd_vma, const char *, bfd_boolean, bfd_boolean, + struct bfd_link_hash_entry **); /* Called to handle linking a dynamic object. */ bfd_boolean (*link_dynamic_object) - PARAMS ((struct bfd_link_info *, bfd *)); + (struct bfd_link_info *, bfd *); /* Called for each global symbol being written out by the linker. This should write out the dynamic symbol information. */ bfd_boolean (*write_dynamic_symbol) - PARAMS ((bfd *, struct bfd_link_info *, struct aout_link_hash_entry *)); + (bfd *, struct bfd_link_info *, struct aout_link_hash_entry *); /* If this callback is not NULL, the linker calls it for each reloc. RELOC is a pointer to the unswapped reloc. If *SKIP is set to TRUE, the reloc will be skipped. *RELOCATION may be changed to change the effects of the relocation. */ bfd_boolean (*check_dynamic_reloc) - PARAMS ((struct bfd_link_info *info, bfd *input_bfd, - asection *input_section, struct aout_link_hash_entry *h, - PTR reloc, bfd_byte *contents, bfd_boolean *skip, - bfd_vma *relocation)); + (struct bfd_link_info *info, bfd *input_bfd, + asection *input_section, struct aout_link_hash_entry *h, + void * reloc, bfd_byte *contents, bfd_boolean *skip, + bfd_vma *relocation); /* Called at the end of a link to finish up any dynamic linking information. */ - bfd_boolean (*finish_dynamic_link) - PARAMS ((bfd *, struct bfd_link_info *)); + bfd_boolean (*finish_dynamic_link) (bfd *, struct bfd_link_info *); }; #define aout_backend_info(abfd) \ ((const struct aout_backend_data *)((abfd)->xvec->backend_data)) @@ -221,73 +219,77 @@ struct aout_backend_data struct internal_exec { - long a_info; /* Magic number and flags, packed */ - bfd_vma a_text; /* length of text, in bytes */ - bfd_vma a_data; /* length of data, in bytes */ - bfd_vma a_bss; /* length of uninitialized data area in mem */ - bfd_vma a_syms; /* length of symbol table data in file */ - bfd_vma a_entry; /* start address */ - bfd_vma a_trsize; /* length of text's relocation info, in bytes */ - bfd_vma a_drsize; /* length of data's relocation info, in bytes */ - /* Added for i960 */ - bfd_vma a_tload; /* Text runtime load address */ - bfd_vma a_dload; /* Data runtime load address */ - unsigned char a_talign; /* Alignment of text segment */ - unsigned char a_dalign; /* Alignment of data segment */ - unsigned char a_balign; /* Alignment of bss segment */ - char a_relaxable; /* Enough info for linker relax */ + long a_info; /* Magic number and flags, packed. */ + bfd_vma a_text; /* Length of text, in bytes. */ + bfd_vma a_data; /* Length of data, in bytes. */ + bfd_vma a_bss; /* Length of uninitialized data area in mem. */ + bfd_vma a_syms; /* Length of symbol table data in file. */ + bfd_vma a_entry; /* Start address. */ + bfd_vma a_trsize; /* Length of text's relocation info, in bytes. */ + bfd_vma a_drsize; /* Length of data's relocation info, in bytes. */ + /* Added for i960 */ + bfd_vma a_tload; /* Text runtime load address. */ + bfd_vma a_dload; /* Data runtime load address. */ + unsigned char a_talign; /* Alignment of text segment. */ + unsigned char a_dalign; /* Alignment of data segment. */ + unsigned char a_balign; /* Alignment of bss segment. */ + char a_relaxable; /* Enough info for linker relax. */ }; /* Magic number is written -< MSB > -3130292827262524232221201918171615141312111009080706050403020100 -< FLAGS >< MACHINE TYPE >< MAGIC NUMBER > -*/ -/* Magic number for NetBSD is - -3130292827262524232221201918171615141312111009080706050403020100 -< FLAGS >< MACHINE TYPE >< MAGIC NUMBER > -*/ + < MSB > + 3130292827262524232221201918171615141312111009080706050403020100 + < FLAGS >< MACHINE TYPE >< MAGIC NUMBER > */ -enum machine_type { +/* Magic number for NetBSD is + + 3130292827262524232221201918171615141312111009080706050403020100 + < FLAGS >< MACHINE TYPE >< MAGIC NUMBER > */ + +enum machine_type +{ M_UNKNOWN = 0, M_68010 = 1, M_68020 = 2, M_SPARC = 3, /* Skip a bunch so we don't run into any of SUN's numbers. */ /* Make these up for the ns32k. */ - M_NS32032 = (64), /* ns32032 running ? */ - M_NS32532 = (64 + 5), /* ns32532 running mach */ - + M_NS32032 = (64), /* NS32032 running ? */ + M_NS32532 = (64 + 5), /* NS32532 running mach. */ M_386 = 100, - M_29K = 101, /* AMD 29000 */ - M_386_DYNIX = 102, /* Sequent running dynix */ - M_ARM = 103, /* Advanced Risc Machines ARM */ - M_SPARCLET = 131, /* SPARClet = M_SPARC + 128 */ - M_386_NETBSD = 134, /* NetBSD/i386 binary */ - M_68K_NETBSD = 135, /* NetBSD/m68k binary */ - M_68K4K_NETBSD = 136, /* NetBSD/m68k4k binary */ - M_532_NETBSD = 137, /* NetBSD/ns32k binary */ - M_SPARC_NETBSD = 138, /* NetBSD/sparc binary */ - M_PMAX_NETBSD = 139, /* NetBSD/pmax (MIPS little-endian) binary */ - M_VAX_NETBSD = 140, /* NetBSD/vax binary */ - M_ALPHA_NETBSD = 141, /* NetBSD/alpha binary */ - M_ARM6_NETBSD = 143, /* NetBSD/arm32 binary */ - M_SPARCLET_1 = 147, /* 0x93, reserved */ - M_VAX4K_NETBSD = 150, /* NetBSD/vax 4K pages binary */ - M_MIPS1 = 151, /* MIPS R2000/R3000 binary */ - M_MIPS2 = 152, /* MIPS R4000/R6000 binary */ - M_SPARCLET_2 = 163, /* 0xa3, reserved */ - M_SPARCLET_3 = 179, /* 0xb3, reserved */ - M_SPARCLET_4 = 195, /* 0xc3, reserved */ - M_HP200 = 200, /* HP 200 (68010) BSD binary */ - M_HP300 = (300 % 256), /* HP 300 (68020+68881) BSD binary */ - M_HPUX = (0x20c % 256), /* HP 200/300 HPUX binary */ - M_SPARCLET_5 = 211, /* 0xd3, reserved */ - M_SPARCLET_6 = 227, /* 0xe3, reserved */ - /* M_SPARCLET_7 = 243 / * 0xf3, reserved */ + M_29K = 101, /* AMD 29000. */ + M_386_DYNIX = 102, /* Sequent running dynix. */ + M_ARM = 103, /* Advanced Risc Machines ARM. */ + M_SPARCLET = 131, /* SPARClet = M_SPARC + 128. */ + M_386_NETBSD = 134, /* NetBSD/i386 binary. */ + M_68K_NETBSD = 135, /* NetBSD/m68k binary. */ + M_68K4K_NETBSD = 136, /* NetBSD/m68k4k binary. */ + M_532_NETBSD = 137, /* NetBSD/ns32k binary. */ + M_SPARC_NETBSD = 138, /* NetBSD/sparc binary. */ + M_PMAX_NETBSD = 139, /* NetBSD/pmax (MIPS little-endian) binary. */ + M_VAX_NETBSD = 140, /* NetBSD/vax binary. */ + M_ALPHA_NETBSD = 141, /* NetBSD/alpha binary. */ + M_ARM6_NETBSD = 143, /* NetBSD/arm32 binary. */ + M_SPARCLET_1 = 147, /* 0x93, reserved. */ + M_POWERPC_NETBSD = 149, /* NetBSD/powerpc (big-endian) binary. */ + M_VAX4K_NETBSD = 150, /* NetBSD/vax 4K pages binary. */ + M_MIPS1 = 151, /* MIPS R2000/R3000 binary. */ + M_MIPS2 = 152, /* MIPS R4000/R6000 binary. */ + M_88K_OPENBSD = 153, /* OpenBSD/m88k binary. */ + M_HPPA_OPENBSD = 154, /* OpenBSD/hppa binary. */ + M_SPARC64_NETBSD = 156, /* NetBSD/sparc64 binary. */ + M_X86_64_NETBSD = 157, /* NetBSD/amd64 binary. */ + M_SPARCLET_2 = 163, /* 0xa3, reserved. */ + M_SPARCLET_3 = 179, /* 0xb3, reserved. */ + M_SPARCLET_4 = 195, /* 0xc3, reserved. */ + M_HP200 = 200, /* HP 200 (68010) BSD binary. */ + M_HP300 = (300 % 256), /* HP 300 (68020+68881) BSD binary. */ + M_HPUX = (0x20c % 256), /* HP 200/300 HPUX binary. */ + M_SPARCLET_5 = 211, /* 0xd3, reserved. */ + M_SPARCLET_6 = 227, /* 0xe3, reserved. */ +/*M_SPARCLET_7 = 243 / * 0xf3, reserved. */ M_SPARCLITE_LE = 243, - M_CRIS = 255 /* Axis CRIS binary. */ + M_CRIS = 255 /* Axis CRIS binary. */ }; #define N_DYNAMIC(exec) ((exec).a_info & 0x80000000) @@ -334,7 +336,8 @@ enum machine_type { ((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24)) #endif -typedef struct aout_symbol { +typedef struct aout_symbol +{ asymbol symbol; short desc; char other; @@ -345,9 +348,10 @@ typedef struct aout_symbol { Various things depend on this struct being around any time an a.out file is being handled. An example is dbxread.c in GDB. */ -struct aoutdata { - struct internal_exec *hdr; /* exec file header */ - aout_symbol_type *symbols; /* symtab for input bfd */ +struct aoutdata +{ + struct internal_exec *hdr; /* Exec file header. */ + aout_symbol_type *symbols; /* Symtab for input bfd. */ /* For ease, we do this. */ asection *textsec; @@ -409,7 +413,7 @@ struct aoutdata { struct aout_link_hash_entry **sym_hashes; /* A pointer for shared library information. */ - PTR dynamic_info; + void * dynamic_info; /* A mapping from local symbols to offsets into the global offset table, used when linking on SunOS. This is indexed by the symbol @@ -417,30 +421,31 @@ struct aoutdata { bfd_vma *local_got_offsets; }; -struct aout_data_struct { - struct aoutdata a; - struct internal_exec e; +struct aout_data_struct +{ + struct aoutdata a; + struct internal_exec e; }; -#define adata(bfd) ((bfd)->tdata.aout_data->a) -#define exec_hdr(bfd) (adata(bfd).hdr) -#define obj_aout_symbols(bfd) (adata(bfd).symbols) -#define obj_textsec(bfd) (adata(bfd).textsec) -#define obj_datasec(bfd) (adata(bfd).datasec) -#define obj_bsssec(bfd) (adata(bfd).bsssec) -#define obj_sym_filepos(bfd) (adata(bfd).sym_filepos) -#define obj_str_filepos(bfd) (adata(bfd).str_filepos) -#define obj_reloc_entry_size(bfd) (adata(bfd).reloc_entry_size) -#define obj_symbol_entry_size(bfd) (adata(bfd).symbol_entry_size) -#define obj_aout_subformat(bfd) (adata(bfd).subformat) -#define obj_aout_external_syms(bfd) (adata(bfd).external_syms) -#define obj_aout_external_sym_count(bfd) (adata(bfd).external_sym_count) -#define obj_aout_sym_window(bfd) (adata(bfd).sym_window) -#define obj_aout_external_strings(bfd) (adata(bfd).external_strings) -#define obj_aout_external_string_size(bfd) (adata(bfd).external_string_size) -#define obj_aout_string_window(bfd) (adata(bfd).string_window) -#define obj_aout_sym_hashes(bfd) (adata(bfd).sym_hashes) -#define obj_aout_dynamic_info(bfd) (adata(bfd).dynamic_info) +#define adata(bfd) ((bfd)->tdata.aout_data->a) +#define exec_hdr(bfd) (adata (bfd).hdr) +#define obj_aout_symbols(bfd) (adata (bfd).symbols) +#define obj_textsec(bfd) (adata (bfd).textsec) +#define obj_datasec(bfd) (adata (bfd).datasec) +#define obj_bsssec(bfd) (adata (bfd).bsssec) +#define obj_sym_filepos(bfd) (adata (bfd).sym_filepos) +#define obj_str_filepos(bfd) (adata (bfd).str_filepos) +#define obj_reloc_entry_size(bfd) (adata (bfd).reloc_entry_size) +#define obj_symbol_entry_size(bfd) (adata (bfd).symbol_entry_size) +#define obj_aout_subformat(bfd) (adata (bfd).subformat) +#define obj_aout_external_syms(bfd) (adata (bfd).external_syms) +#define obj_aout_external_sym_count(bfd) (adata (bfd).external_sym_count) +#define obj_aout_sym_window(bfd) (adata (bfd).sym_window) +#define obj_aout_external_strings(bfd) (adata (bfd).external_strings) +#define obj_aout_external_string_size(bfd) (adata (bfd).external_string_size) +#define obj_aout_string_window(bfd) (adata (bfd).string_window) +#define obj_aout_sym_hashes(bfd) (adata (bfd).sym_hashes) +#define obj_aout_dynamic_info(bfd) (adata (bfd).dynamic_info) /* We take the address of the first element of an asymbol to ensure that the macro is only ever applied to an asymbol. */ @@ -452,137 +457,145 @@ struct aout_data_struct { struct aout_section_data_struct { /* The unswapped relocation entries for this section. */ - PTR relocs; + void * relocs; }; #define aout_section_data(s) \ ((struct aout_section_data_struct *) (s)->used_by_bfd) #define set_aout_section_data(s,v) \ - ((s)->used_by_bfd = (PTR)&(v)->relocs) + ((s)->used_by_bfd = (void *)&(v)->relocs) /* Prototype declarations for functions defined in aoutx.h. */ -extern bfd_boolean NAME(aout,squirt_out_relocs) - PARAMS ((bfd *, asection *)); +extern bfd_boolean NAME (aout, squirt_out_relocs) + (bfd *, asection *); -extern bfd_boolean NAME(aout,make_sections) - PARAMS ((bfd *)); +extern bfd_boolean NAME (aout, make_sections) + (bfd *); -extern const bfd_target * NAME(aout,some_aout_object_p) - PARAMS ((bfd *, struct internal_exec *, const bfd_target *(*) (bfd *))); +extern const bfd_target * NAME (aout, some_aout_object_p) + (bfd *, struct internal_exec *, const bfd_target *(*) (bfd *)); -extern bfd_boolean NAME(aout,mkobject) - PARAMS ((bfd *)); +extern bfd_boolean NAME (aout, mkobject) + (bfd *); -extern enum machine_type NAME(aout,machine_type) - PARAMS ((enum bfd_architecture, unsigned long, bfd_boolean *)); +extern enum machine_type NAME (aout, machine_type) + (enum bfd_architecture, unsigned long, bfd_boolean *); -extern bfd_boolean NAME(aout,set_arch_mach) - PARAMS ((bfd *, enum bfd_architecture, unsigned long)); +extern bfd_boolean NAME (aout, set_arch_mach) + (bfd *, enum bfd_architecture, unsigned long); -extern bfd_boolean NAME(aout,new_section_hook) - PARAMS ((bfd *, asection *)); +extern bfd_boolean NAME (aout, new_section_hook) + (bfd *, asection *); -extern bfd_boolean NAME(aout,set_section_contents) - PARAMS ((bfd *, sec_ptr, const PTR, file_ptr, bfd_size_type)); +extern bfd_boolean NAME (aout, set_section_contents) + (bfd *, sec_ptr, const void *, file_ptr, bfd_size_type); -extern asymbol * NAME(aout,make_empty_symbol) - PARAMS ((bfd *)); +extern asymbol * NAME (aout, make_empty_symbol) + (bfd *); -extern bfd_boolean NAME(aout,translate_symbol_table) - PARAMS ((bfd *, aout_symbol_type *, struct external_nlist *, bfd_size_type, - char *, bfd_size_type, bfd_boolean)); +extern bfd_boolean NAME (aout, translate_symbol_table) + (bfd *, aout_symbol_type *, struct external_nlist *, bfd_size_type, + char *, bfd_size_type, bfd_boolean); -extern bfd_boolean NAME(aout,slurp_symbol_table) - PARAMS ((bfd *)); +extern bfd_boolean NAME (aout, slurp_symbol_table) + (bfd *); -extern bfd_boolean NAME(aout,write_syms) - PARAMS ((bfd *)); +extern bfd_boolean NAME (aout, write_syms) + (bfd *); -extern void NAME(aout,reclaim_symbol_table) - PARAMS ((bfd *)); +extern void NAME (aout, reclaim_symbol_table) + (bfd *); -extern long NAME(aout,get_symtab_upper_bound) - PARAMS ((bfd *)); +extern long NAME (aout, get_symtab_upper_bound) + (bfd *); -extern long NAME(aout,canonicalize_symtab) - PARAMS ((bfd *, asymbol **)); +extern long NAME (aout, canonicalize_symtab) + (bfd *, asymbol **); -extern void NAME(aout,swap_ext_reloc_in) - PARAMS ((bfd *, struct reloc_ext_external *, arelent *, asymbol **, - bfd_size_type)); -extern void NAME(aout,swap_std_reloc_in) - PARAMS ((bfd *, struct reloc_std_external *, arelent *, asymbol **, - bfd_size_type)); +extern void NAME (aout, swap_ext_reloc_in) + (bfd *, struct reloc_ext_external *, arelent *, asymbol **, + bfd_size_type); -extern reloc_howto_type * NAME(aout,reloc_type_lookup) - PARAMS ((bfd *, bfd_reloc_code_real_type)); +extern void NAME (aout, swap_std_reloc_in) + (bfd *, struct reloc_std_external *, arelent *, asymbol **, + bfd_size_type); -extern bfd_boolean NAME(aout,slurp_reloc_table) - PARAMS ((bfd *, sec_ptr, asymbol **)); +extern reloc_howto_type * NAME (aout, reloc_type_lookup) + (bfd *, bfd_reloc_code_real_type); -extern long NAME(aout,canonicalize_reloc) - PARAMS ((bfd *, sec_ptr, arelent **, asymbol **)); +extern bfd_boolean NAME (aout, slurp_reloc_table) + (bfd *, sec_ptr, asymbol **); -extern long NAME(aout,get_reloc_upper_bound) - PARAMS ((bfd *, sec_ptr)); +extern long NAME (aout, canonicalize_reloc) + (bfd *, sec_ptr, arelent **, asymbol **); -extern void NAME(aout,reclaim_reloc) - PARAMS ((bfd *, sec_ptr)); +extern long NAME (aout, get_reloc_upper_bound) + (bfd *, sec_ptr); -extern alent * NAME(aout,get_lineno) - PARAMS ((bfd *, asymbol *)); +extern void NAME (aout, reclaim_reloc) + (bfd *, sec_ptr); -extern void NAME(aout,print_symbol) - PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type)); +extern alent * NAME (aout, get_lineno) + (bfd *, asymbol *); -extern void NAME(aout,get_symbol_info) - PARAMS ((bfd *, asymbol *, symbol_info *)); +extern void NAME (aout, print_symbol) + (bfd *, void *, asymbol *, bfd_print_symbol_type); -extern bfd_boolean NAME(aout,find_nearest_line) - PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **, - const char **, unsigned int *)); +extern void NAME (aout, get_symbol_info) + (bfd *, asymbol *, symbol_info *); -extern long NAME(aout,read_minisymbols) - PARAMS ((bfd *, bfd_boolean, PTR *, unsigned int *)); +extern bfd_boolean NAME (aout, find_nearest_line) + (bfd *, asection *, asymbol **, bfd_vma, const char **, + const char **, unsigned int *); -extern asymbol * NAME(aout,minisymbol_to_symbol) - PARAMS ((bfd *, bfd_boolean, const PTR, asymbol *)); +extern long NAME (aout, read_minisymbols) + (bfd *, bfd_boolean, void * *, unsigned int *); -extern int NAME(aout,sizeof_headers) - PARAMS ((bfd *, bfd_boolean)); +extern asymbol * NAME (aout, minisymbol_to_symbol) + (bfd *, bfd_boolean, const void *, asymbol *); -extern bfd_boolean NAME(aout,adjust_sizes_and_vmas) - PARAMS ((bfd *, bfd_size_type *, file_ptr *)); +extern int NAME (aout, sizeof_headers) + (bfd *, bfd_boolean); -extern void NAME(aout,swap_exec_header_in) - PARAMS ((bfd *, struct external_exec *, struct internal_exec *)); +extern bfd_boolean NAME (aout, adjust_sizes_and_vmas) + (bfd *, bfd_size_type *, file_ptr *); -extern void NAME(aout,swap_exec_header_out) - PARAMS ((bfd *, struct internal_exec *, struct external_exec *)); +extern void NAME (aout, swap_exec_header_in) + (bfd *, struct external_exec *, struct internal_exec *); -extern struct bfd_hash_entry * NAME(aout,link_hash_newfunc) - PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); +extern void NAME (aout, swap_exec_header_out) + (bfd *, struct internal_exec *, struct external_exec *); -extern bfd_boolean NAME(aout,link_hash_table_init) - PARAMS ((struct aout_link_hash_table *, bfd *, - struct bfd_hash_entry *(*) (struct bfd_hash_entry *, - struct bfd_hash_table *, - const char *))); +extern struct bfd_hash_entry * NAME (aout, link_hash_newfunc) + (struct bfd_hash_entry *, struct bfd_hash_table *, const char *); -extern struct bfd_link_hash_table * NAME(aout,link_hash_table_create) - PARAMS ((bfd *)); +extern bfd_boolean NAME (aout, link_hash_table_init) + (struct aout_link_hash_table *, bfd *, + struct bfd_hash_entry *(*) (struct bfd_hash_entry *, + struct bfd_hash_table *, + const char *), + unsigned int); -extern bfd_boolean NAME(aout,link_add_symbols) - PARAMS ((bfd *, struct bfd_link_info *)); +extern struct bfd_link_hash_table * NAME (aout, link_hash_table_create) + (bfd *); -extern bfd_boolean NAME(aout,final_link) - PARAMS ((bfd *, struct bfd_link_info *, - void (*) (bfd *, file_ptr *, file_ptr *, file_ptr *))); +extern bfd_boolean NAME (aout, link_add_symbols) + (bfd *, struct bfd_link_info *); -extern bfd_boolean NAME(aout,bfd_free_cached_info) - PARAMS ((bfd *)); +extern bfd_boolean NAME (aout, final_link) + (bfd *, struct bfd_link_info *, + void (*) (bfd *, file_ptr *, file_ptr *, file_ptr *)); + +extern bfd_boolean NAME (aout, bfd_free_cached_info) + (bfd *); + +#define aout_32_find_inliner_info _bfd_nosymbols_find_inliner_info +#if 0 /* Are these needed? */ +#define aout_16_find_inliner_info _bfd_nosymbols_find_inliner_info +#define aout_64_find_inliner_info _bfd_nosymbols_find_inliner_info +#endif /* A.out uses the generic versions of these routines... */ @@ -599,13 +612,19 @@ extern bfd_boolean NAME(aout,bfd_free_cached_info) #define aout_32_bfd_is_local_label_name bfd_generic_is_local_label_name #endif +#ifndef aout_32_bfd_is_target_special_symbol +#define aout_32_bfd_is_target_special_symbol \ + ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) +#endif + #ifndef WRITE_HEADERS #define WRITE_HEADERS(abfd, execp) \ { \ - bfd_size_type text_size; /* dummy vars */ \ + bfd_size_type text_size; /* Dummy vars. */ \ file_ptr text_end; \ + \ if (adata(abfd).magic == undecided_magic) \ - NAME(aout,adjust_sizes_and_vmas) (abfd, &text_size, &text_end); \ + NAME (aout, adjust_sizes_and_vmas) (abfd, & text_size, & text_end); \ \ execp->a_syms = bfd_get_symcount (abfd) * EXTERNAL_NLIST_SIZE; \ execp->a_entry = bfd_get_start_address (abfd); \ @@ -614,32 +633,32 @@ extern bfd_boolean NAME(aout,bfd_free_cached_info) obj_reloc_entry_size (abfd)); \ execp->a_drsize = ((obj_datasec (abfd)->reloc_count) * \ obj_reloc_entry_size (abfd)); \ - NAME(aout,swap_exec_header_out) (abfd, execp, &exec_bytes); \ + NAME (aout, swap_exec_header_out) (abfd, execp, & exec_bytes); \ \ if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 \ - || bfd_bwrite ((PTR) &exec_bytes, (bfd_size_type) EXEC_BYTES_SIZE, \ + || bfd_bwrite (& exec_bytes, (bfd_size_type) EXEC_BYTES_SIZE, \ abfd) != EXEC_BYTES_SIZE) \ return FALSE; \ /* Now write out reloc info, followed by syms and strings. */ \ \ - if (bfd_get_outsymbols (abfd) != (asymbol **) NULL \ + if (bfd_get_outsymbols (abfd) != NULL \ && bfd_get_symcount (abfd) != 0) \ { \ if (bfd_seek (abfd, (file_ptr) (N_SYMOFF(*execp)), SEEK_SET) != 0)\ return FALSE; \ \ - if (! NAME(aout,write_syms) (abfd)) \ + if (! NAME (aout, write_syms) (abfd)) \ return FALSE; \ } \ \ - if (bfd_seek (abfd, (file_ptr) (N_TRELOFF(*execp)), SEEK_SET) != 0) \ + if (bfd_seek (abfd, (file_ptr) (N_TRELOFF (*execp)), SEEK_SET) != 0) \ return FALSE; \ - if (!NAME(aout,squirt_out_relocs) (abfd, obj_textsec (abfd))) \ + if (!NAME (aout, squirt_out_relocs) (abfd, obj_textsec (abfd))) \ return FALSE; \ \ - if (bfd_seek (abfd, (file_ptr) (N_DRELOFF(*execp)), SEEK_SET) != 0) \ + if (bfd_seek (abfd, (file_ptr) (N_DRELOFF (*execp)), SEEK_SET) != 0) \ return FALSE; \ - if (!NAME(aout,squirt_out_relocs) (abfd, obj_datasec (abfd))) \ + if (!NAME (aout, squirt_out_relocs) (abfd, obj_datasec (abfd))) \ return FALSE; \ } #endif @@ -659,8 +678,8 @@ extern bfd_boolean NAME(aout,bfd_free_cached_info) && obj_textsec (abfd) != NULL \ && obj_datasec (abfd) != NULL \ && (sec)->vma >= (obj_textsec (abfd)->vma + \ - obj_textsec (abfd)->_cooked_size) \ - && ((sec)->vma + (sec)->_cooked_size) <= obj_datasec (abfd)->vma \ + obj_textsec (abfd)->size) \ + && ((sec)->vma + (sec)->size) <= obj_datasec (abfd)->vma \ && ((abfd)->flags & D_PAGED) != 0) #endif /* ! defined (LIBAOUT_H) */ diff --git a/contrib/binutils/bfd/libbfd-in.h b/contrib/binutils/bfd/libbfd-in.h index 10cafefd6ed..ee2484f25c1 100644 --- a/contrib/binutils/bfd/libbfd-in.h +++ b/contrib/binutils/bfd/libbfd-in.h @@ -2,7 +2,8 @@ (This include file is not for users of the library.) Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. Written by Cygnus Support. @@ -20,7 +21,9 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include "hashtab.h" /* Align an address upward to a boundary, expressed as a number of bytes. E.g. align to an 8-byte boundary with argument of 8. Take care never @@ -50,17 +53,24 @@ struct bfd_in_memory bfd_byte *buffer; }; +struct section_hash_entry +{ + struct bfd_hash_entry root; + asection section; +}; + /* tdata for an archive. For an input archive, cache needs to be free()'d. For an output archive, symdefs do. */ struct artdata { file_ptr first_file_filepos; /* Speed up searching the armap */ - struct ar_cache *cache; + htab_t cache; bfd *archive_head; /* Only interesting in output routines */ carsym *symdefs; /* the symdef entries */ symindex symdef_count; /* how many there are */ char *extended_names; /* clever intel extension */ + bfd_size_type extended_names_size; /* Size of extended names */ /* when more compilers are standard C, this can be a time_t */ long armap_timestamp; /* Timestamp value written into armap. This is used for BSD archives to check @@ -90,7 +100,14 @@ extern void *bfd_realloc (void *, bfd_size_type); extern void *bfd_zmalloc (bfd_size_type); +extern void *bfd_malloc2 + (bfd_size_type, bfd_size_type); +extern void *bfd_realloc2 + (void *, bfd_size_type, bfd_size_type); +extern void *bfd_zmalloc2 + (bfd_size_type, bfd_size_type); +extern void _bfd_default_error_handler (const char *s, ...); extern bfd_error_handler_type _bfd_error_handler; /* These routines allocate and free things on the BFD's objalloc. */ @@ -99,6 +116,10 @@ extern void *bfd_alloc (bfd *, bfd_size_type); extern void *bfd_zalloc (bfd *, bfd_size_type); +extern void *bfd_alloc2 + (bfd *, bfd_size_type, bfd_size_type); +extern void *bfd_zalloc2 + (bfd *, bfd_size_type, bfd_size_type); extern void bfd_release (bfd *, void *); @@ -174,6 +195,8 @@ bfd_boolean coff_write_armap extern void *_bfd_generic_read_ar_hdr (bfd *); +extern void _bfd_ar_spacepad + (char *, size_t, const char *, long); extern void *_bfd_generic_read_ar_hdr_mag (bfd *, const char *); @@ -212,9 +235,14 @@ extern bfd_boolean _bfd_generic_get_section_contents_in_window ((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true) #define _bfd_generic_bfd_copy_private_symbol_data \ ((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true) +#define _bfd_generic_bfd_copy_private_header_data \ + ((bfd_boolean (*) (bfd *, bfd *)) bfd_true) #define _bfd_generic_bfd_print_private_bfd_data \ ((bfd_boolean (*) (bfd *, void *)) bfd_true) +extern bfd_boolean _bfd_generic_init_private_section_data + (bfd *, asection *, bfd *, asection *, struct bfd_link_info *); + /* Routines to use for BFD_JUMP_TABLE_CORE when there is no core file support. Use BFD_JUMP_TABLE_CORE (_bfd_nocore). */ @@ -296,12 +324,17 @@ extern bfd_boolean _bfd_archive_coff_construct_extended_name_table ((void (*) (bfd *, asymbol *, symbol_info *)) bfd_void) #define _bfd_nosymbols_bfd_is_local_label_name \ ((bfd_boolean (*) (bfd *, const char *)) bfd_false) +#define _bfd_nosymbols_bfd_is_target_special_symbol \ + ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) #define _bfd_nosymbols_get_lineno \ ((alent *(*) (bfd *, asymbol *)) bfd_nullvoidptr) #define _bfd_nosymbols_find_nearest_line \ ((bfd_boolean (*) (bfd *, asection *, asymbol **, bfd_vma, const char **, \ const char **, unsigned int *)) \ bfd_false) +#define _bfd_nosymbols_find_inliner_info \ + ((bfd_boolean (*) (bfd *, const char **, const char **, unsigned int *)) \ + bfd_false) #define _bfd_nosymbols_bfd_make_debug_symbol \ ((asymbol *(*) (bfd *, void *, unsigned long)) bfd_nullvoidptr) #define _bfd_nosymbols_read_minisymbols \ @@ -355,6 +388,9 @@ extern bfd_boolean _bfd_generic_set_section_contents #define _bfd_nolink_bfd_merge_sections \ ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) \ bfd_false) +#define _bfd_nolink_bfd_is_group_section \ + ((bfd_boolean (*) (bfd *, const struct bfd_section *)) \ + bfd_false) #define _bfd_nolink_bfd_discard_group \ ((bfd_boolean (*) (bfd *, struct bfd_section *)) \ bfd_false) @@ -370,6 +406,8 @@ extern bfd_boolean _bfd_generic_set_section_contents ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) bfd_false) #define _bfd_nolink_bfd_link_split_section \ ((bfd_boolean (*) (bfd *, struct bfd_section *)) bfd_false) +#define _bfd_nolink_section_already_linked \ + ((void (*) (bfd *, struct bfd_section *)) bfd_void) /* Routines to use for BFD_JUMP_TABLE_DYNAMIC for targets which do not have dynamic symbols or relocs. Use BFD_JUMP_TABLE_DYNAMIC @@ -378,6 +416,8 @@ extern bfd_boolean _bfd_generic_set_section_contents #define _bfd_nodynamic_get_dynamic_symtab_upper_bound _bfd_n1 #define _bfd_nodynamic_canonicalize_dynamic_symtab \ ((long (*) (bfd *, asymbol **)) _bfd_n1) +#define _bfd_nodynamic_get_synthetic_symtab \ + ((long (*) (bfd *, long, asymbol **, long, asymbol **, asymbol **)) _bfd_n1) #define _bfd_nodynamic_get_dynamic_reloc_upper_bound _bfd_n1 #define _bfd_nodynamic_canonicalize_dynamic_reloc \ ((long (*) (bfd *, arelent **, asymbol **)) _bfd_n1) @@ -398,7 +438,7 @@ extern bfd_boolean _bfd_stab_section_find_nearest_line (bfd *, asymbol **, asection *, bfd_vma, bfd_boolean *, const char **, const char **, unsigned int *, void **); -/* Find the neaderst line using DWARF 1 debugging information. */ +/* Find the nearest line using DWARF 1 debugging information. */ extern bfd_boolean _bfd_dwarf1_find_nearest_line (bfd *, asection *, asymbol **, bfd_vma, const char **, const char **, unsigned int *); @@ -408,6 +448,18 @@ extern bfd_boolean _bfd_dwarf2_find_nearest_line (bfd *, asection *, asymbol **, bfd_vma, const char **, const char **, unsigned int *, unsigned int, void **); +/* Find the line using DWARF 2 debugging information. */ +extern bfd_boolean _bfd_dwarf2_find_line + (bfd *, asymbol **, asymbol *, const char **, + unsigned int *, unsigned int, void **); + +bfd_boolean _bfd_generic_find_line + (bfd *, asymbol **, asymbol *, const char **, unsigned int *); + +/* Find inliner info after calling bfd_find_nearest_line. */ +extern bfd_boolean _bfd_dwarf2_find_inliner_info + (bfd *, const char **, const char **, unsigned int *, void **); + /* Create a new section entry. */ extern struct bfd_hash_entry *bfd_section_hash_newfunc (struct bfd_hash_entry *, struct bfd_hash_table *, const char *); @@ -422,7 +474,8 @@ extern bfd_boolean _bfd_link_hash_table_init (struct bfd_link_hash_table *, bfd *, struct bfd_hash_entry *(*) (struct bfd_hash_entry *, struct bfd_hash_table *, - const char *)); + const char *), + unsigned int); /* Generic link hash table creation routine. */ extern struct bfd_link_hash_table *_bfd_generic_link_hash_table_create @@ -467,6 +520,9 @@ extern bfd_boolean _bfd_generic_final_link extern bfd_boolean _bfd_generic_link_split_section (bfd *, struct bfd_section *); +extern void _bfd_generic_section_already_linked + (bfd *, struct bfd_section *); + /* Generic reloc_link_order processing routine. */ extern bfd_boolean _bfd_generic_reloc_link_order (bfd *, struct bfd_link_info *, asection *, struct bfd_link_order *); @@ -491,7 +547,8 @@ extern bfd_reloc_status_type _bfd_relocate_contents /* Link stabs in sections in the first pass. */ extern bfd_boolean _bfd_link_section_stabs - (bfd *, void **, asection *, asection *, void **, bfd_size_type *); + (bfd *, struct stab_info *, asection *, asection *, void **, + bfd_size_type *); /* Eliminate stabs for discarded functions and symbols. */ extern bfd_boolean _bfd_discard_section_stabs @@ -500,28 +557,28 @@ extern bfd_boolean _bfd_discard_section_stabs /* Write out the .stab section when linking stabs in sections. */ extern bfd_boolean _bfd_write_section_stabs - (bfd *, void **, asection *, void **, bfd_byte *); + (bfd *, struct stab_info *, asection *, void **, bfd_byte *); /* Write out the .stabstr string table when linking stabs in sections. */ extern bfd_boolean _bfd_write_stab_strings - (bfd *, void **); + (bfd *, struct stab_info *); /* Find an offset within a .stab section when linking stabs in sections. */ extern bfd_vma _bfd_stab_section_offset - (bfd *, void **, asection *, void **, bfd_vma); + (asection *, void *, bfd_vma); -/* Attempt to merge a SEC_MERGE section. */ +/* Register a SEC_MERGE section as a candidate for merging. */ -extern bfd_boolean _bfd_merge_section +extern bfd_boolean _bfd_add_merge_section (bfd *, void **, asection *, void **); /* Attempt to merge SEC_MERGE sections. */ extern bfd_boolean _bfd_merge_sections - (bfd *, void *, void (*) (bfd *, asection *)); + (bfd *, struct bfd_link_info *, void *, void (*) (bfd *, asection *)); /* Write out a merged section. */ @@ -531,7 +588,7 @@ extern bfd_boolean _bfd_write_merged_section /* Find an offset within a modified SEC_MERGE section. */ extern bfd_vma _bfd_merged_section_offset - (bfd *, asection **, void *, bfd_vma, bfd_vma); + (bfd *, asection **, void *, bfd_vma); /* Create a string table. */ extern struct bfd_strtab_hash *_bfd_stringtab_init @@ -579,10 +636,10 @@ void bfd_assert (const char*,int); #define BFD_ASSERT(x) \ - { if (!(x)) bfd_assert(__FILE__,__LINE__); } + do { if (!(x)) bfd_assert(__FILE__,__LINE__); } while (0) #define BFD_FAIL() \ - { bfd_assert(__FILE__,__LINE__); } + do { bfd_assert(__FILE__,__LINE__); } while (0) extern void _bfd_abort (const char *, int, const char *) ATTRIBUTE_NORETURN; @@ -599,11 +656,7 @@ extern void _bfd_abort the system "off_t" or "off64_t", as the offset. */ extern file_ptr real_ftell (FILE *file); extern int real_fseek (FILE *file, file_ptr offset, int whence); - -FILE * bfd_cache_lookup_worker - (bfd *); - -extern bfd *bfd_last_cache; +extern FILE *real_fopen (const char *filename, const char *modes); /* List of supported target vectors, and the default vector (if bfd_default_vector[0] is NULL, there is no default). */ @@ -645,3 +698,31 @@ extern bfd_boolean _bfd_sh_align_load_span bfd_boolean (*) (bfd *, asection *, void *, bfd_byte *, bfd_vma), void *, bfd_vma **, bfd_vma *, bfd_vma, bfd_vma, bfd_boolean *); #endif + +/* This is the shape of the elements inside the already_linked hash + table. It maps a name onto a list of already_linked elements with + the same name. */ + +struct bfd_section_already_linked_hash_entry +{ + struct bfd_hash_entry root; + struct bfd_section_already_linked *entry; +}; + +struct bfd_section_already_linked +{ + struct bfd_section_already_linked *next; + asection *sec; +}; + +extern struct bfd_section_already_linked_hash_entry * + bfd_section_already_linked_table_lookup (const char *); +extern void bfd_section_already_linked_table_insert + (struct bfd_section_already_linked_hash_entry *, asection *); +extern void bfd_section_already_linked_table_traverse + (bfd_boolean (*) (struct bfd_section_already_linked_hash_entry *, + void *), void *); + +extern bfd_vma read_unsigned_leb128 (bfd *, bfd_byte *, unsigned int *); +extern bfd_signed_vma read_signed_leb128 (bfd *, bfd_byte *, unsigned int *); + diff --git a/contrib/binutils/bfd/libbfd.c b/contrib/binutils/bfd/libbfd.c index be090e9b069..57cfabcd460 100644 --- a/contrib/binutils/bfd/libbfd.c +++ b/contrib/binutils/bfd/libbfd.c @@ -1,6 +1,6 @@ /* Assorted BFD support routines, only used internally. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004 + 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. Written by Cygnus Support. @@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" @@ -30,6 +30,9 @@ /* SECTION + Implementation details + +SUBSECTION Internal functions DESCRIPTION @@ -156,6 +159,36 @@ bfd_malloc (bfd_size_type size) return ptr; } +/* Allocate memory using malloc, nmemb * size with overflow checking. */ + +void * +bfd_malloc2 (bfd_size_type nmemb, bfd_size_type size) +{ + void *ptr; + + if ((nmemb | size) >= HALF_BFD_SIZE_TYPE + && size != 0 + && nmemb > ~(bfd_size_type) 0 / size) + { + bfd_set_error (bfd_error_no_memory); + return NULL; + } + + size *= nmemb; + + if (size != (size_t) size) + { + bfd_set_error (bfd_error_no_memory); + return NULL; + } + + ptr = malloc ((size_t) size); + if (ptr == NULL && (size_t) size != 0) + bfd_set_error (bfd_error_no_memory); + + return ptr; +} + /* Reallocate memory using realloc. */ void * @@ -180,6 +213,40 @@ bfd_realloc (void *ptr, bfd_size_type size) return ret; } +/* Reallocate memory using realloc, nmemb * size with overflow checking. */ + +void * +bfd_realloc2 (void *ptr, bfd_size_type nmemb, bfd_size_type size) +{ + void *ret; + + if ((nmemb | size) >= HALF_BFD_SIZE_TYPE + && size != 0 + && nmemb > ~(bfd_size_type) 0 / size) + { + bfd_set_error (bfd_error_no_memory); + return NULL; + } + + size *= nmemb; + + if (size != (size_t) size) + { + bfd_set_error (bfd_error_no_memory); + return NULL; + } + + if (ptr == NULL) + ret = malloc ((size_t) size); + else + ret = realloc (ptr, (size_t) size); + + if (ret == NULL && (size_t) size != 0) + bfd_set_error (bfd_error_no_memory); + + return ret; +} + /* Allocate memory using malloc and clear it. */ void * @@ -205,6 +272,44 @@ bfd_zmalloc (bfd_size_type size) return ptr; } + +/* Allocate memory using malloc (nmemb * size) with overflow checking + and clear it. */ + +void * +bfd_zmalloc2 (bfd_size_type nmemb, bfd_size_type size) +{ + void *ptr; + + if ((nmemb | size) >= HALF_BFD_SIZE_TYPE + && size != 0 + && nmemb > ~(bfd_size_type) 0 / size) + { + bfd_set_error (bfd_error_no_memory); + return NULL; + } + + size *= nmemb; + + if (size != (size_t) size) + { + bfd_set_error (bfd_error_no_memory); + return NULL; + } + + ptr = malloc ((size_t) size); + + if ((size_t) size != 0) + { + if (ptr == NULL) + bfd_set_error (bfd_error_no_memory); + else + memset (ptr, 0, (size_t) size); + } + + return ptr; +} + /* INTERNAL_FUNCTION bfd_write_bigendian_4byte_int @@ -692,10 +797,12 @@ _bfd_generic_get_section_contents (bfd *abfd, file_ptr offset, bfd_size_type count) { + bfd_size_type sz; if (count == 0) return TRUE; - if (offset + count > section->_raw_size) + sz = section->rawsize ? section->rawsize : section->size; + if (offset + count > sz) { bfd_set_error (bfd_error_invalid_operation); return FALSE; @@ -717,6 +824,8 @@ _bfd_generic_get_section_contents_in_window bfd_size_type count ATTRIBUTE_UNUSED) { #ifdef USE_MMAP + bfd_size_type sz; + if (count == 0) return TRUE; if (abfd->xvec->_bfd_get_section_contents @@ -744,7 +853,8 @@ _bfd_generic_get_section_contents_in_window w->data = w->i->data; return bfd_get_section_contents (abfd, section, w->data, offset, count); } - if (offset + count > section->_raw_size + sz = section->rawsize ? section->rawsize : section->size; + if (offset + count > sz || ! bfd_get_file_window (abfd, section->filepos + offset, count, w, TRUE)) return FALSE; @@ -818,11 +928,11 @@ _bfd_generic_verify_endian_match (bfd *ibfd, bfd *obfd) const char *msg; if (bfd_big_endian (ibfd)) - msg = _("%s: compiled for a big endian system and target is little endian"); + msg = _("%B: 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"); + msg = _("%B: compiled for a little endian system and target is big endian"); - (*_bfd_error_handler) (msg, bfd_archive_filename (ibfd)); + (*_bfd_error_handler) (msg, ibfd); bfd_set_error (bfd_error_wrong_format); return FALSE; @@ -855,3 +965,81 @@ warn_deprecated (const char *what, mask |= ~(size_t) func; } } + +/* Helper function for reading uleb128 encoded data. */ + +bfd_vma +read_unsigned_leb128 (bfd *abfd ATTRIBUTE_UNUSED, + bfd_byte *buf, + unsigned int *bytes_read_ptr) +{ + bfd_vma result; + unsigned int num_read; + unsigned int shift; + unsigned char byte; + + result = 0; + shift = 0; + num_read = 0; + do + { + byte = bfd_get_8 (abfd, buf); + buf++; + num_read++; + result |= (((bfd_vma) byte & 0x7f) << shift); + shift += 7; + } + while (byte & 0x80); + *bytes_read_ptr = num_read; + return result; +} + +/* Helper function for reading sleb128 encoded data. */ + +bfd_signed_vma +read_signed_leb128 (bfd *abfd ATTRIBUTE_UNUSED, + bfd_byte *buf, + unsigned int *bytes_read_ptr) +{ + bfd_vma result; + unsigned int shift; + unsigned int num_read; + unsigned char byte; + + result = 0; + shift = 0; + num_read = 0; + do + { + byte = bfd_get_8 (abfd, buf); + buf ++; + num_read ++; + result |= (((bfd_vma) byte & 0x7f) << shift); + shift += 7; + } + while (byte & 0x80); + if (shift < 8 * sizeof (result) && (byte & 0x40)) + result |= (((bfd_vma) -1) << shift); + *bytes_read_ptr = num_read; + return result; +} + +bfd_boolean +_bfd_generic_find_line (bfd *abfd ATTRIBUTE_UNUSED, + asymbol **symbols ATTRIBUTE_UNUSED, + asymbol *symbol ATTRIBUTE_UNUSED, + const char **filename_ptr ATTRIBUTE_UNUSED, + unsigned int *linenumber_ptr ATTRIBUTE_UNUSED) +{ + return FALSE; +} + +bfd_boolean +_bfd_generic_init_private_section_data (bfd *ibfd ATTRIBUTE_UNUSED, + asection *isec ATTRIBUTE_UNUSED, + bfd *obfd ATTRIBUTE_UNUSED, + asection *osec ATTRIBUTE_UNUSED, + struct bfd_link_info *link_info ATTRIBUTE_UNUSED) +{ + return TRUE; +} diff --git a/contrib/binutils/bfd/libbfd.h b/contrib/binutils/bfd/libbfd.h index 62043f3860a..2a590a395a5 100644 --- a/contrib/binutils/bfd/libbfd.h +++ b/contrib/binutils/bfd/libbfd.h @@ -7,7 +7,8 @@ (This include file is not for users of the library.) Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. Written by Cygnus Support. @@ -25,7 +26,9 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include "hashtab.h" /* Align an address upward to a boundary, expressed as a number of bytes. E.g. align to an 8-byte boundary with argument of 8. Take care never @@ -55,17 +58,24 @@ struct bfd_in_memory bfd_byte *buffer; }; +struct section_hash_entry +{ + struct bfd_hash_entry root; + asection section; +}; + /* tdata for an archive. For an input archive, cache needs to be free()'d. For an output archive, symdefs do. */ struct artdata { file_ptr first_file_filepos; /* Speed up searching the armap */ - struct ar_cache *cache; + htab_t cache; bfd *archive_head; /* Only interesting in output routines */ carsym *symdefs; /* the symdef entries */ symindex symdef_count; /* how many there are */ char *extended_names; /* clever intel extension */ + bfd_size_type extended_names_size; /* Size of extended names */ /* when more compilers are standard C, this can be a time_t */ long armap_timestamp; /* Timestamp value written into armap. This is used for BSD archives to check @@ -95,7 +105,14 @@ extern void *bfd_realloc (void *, bfd_size_type); extern void *bfd_zmalloc (bfd_size_type); +extern void *bfd_malloc2 + (bfd_size_type, bfd_size_type); +extern void *bfd_realloc2 + (void *, bfd_size_type, bfd_size_type); +extern void *bfd_zmalloc2 + (bfd_size_type, bfd_size_type); +extern void _bfd_default_error_handler (const char *s, ...); extern bfd_error_handler_type _bfd_error_handler; /* These routines allocate and free things on the BFD's objalloc. */ @@ -104,6 +121,10 @@ extern void *bfd_alloc (bfd *, bfd_size_type); extern void *bfd_zalloc (bfd *, bfd_size_type); +extern void *bfd_alloc2 + (bfd *, bfd_size_type, bfd_size_type); +extern void *bfd_zalloc2 + (bfd *, bfd_size_type, bfd_size_type); extern void bfd_release (bfd *, void *); @@ -179,6 +200,8 @@ bfd_boolean coff_write_armap extern void *_bfd_generic_read_ar_hdr (bfd *); +extern void _bfd_ar_spacepad + (char *, size_t, const char *, long); extern void *_bfd_generic_read_ar_hdr_mag (bfd *, const char *); @@ -217,9 +240,14 @@ extern bfd_boolean _bfd_generic_get_section_contents_in_window ((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true) #define _bfd_generic_bfd_copy_private_symbol_data \ ((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true) +#define _bfd_generic_bfd_copy_private_header_data \ + ((bfd_boolean (*) (bfd *, bfd *)) bfd_true) #define _bfd_generic_bfd_print_private_bfd_data \ ((bfd_boolean (*) (bfd *, void *)) bfd_true) +extern bfd_boolean _bfd_generic_init_private_section_data + (bfd *, asection *, bfd *, asection *, struct bfd_link_info *); + /* Routines to use for BFD_JUMP_TABLE_CORE when there is no core file support. Use BFD_JUMP_TABLE_CORE (_bfd_nocore). */ @@ -301,12 +329,17 @@ extern bfd_boolean _bfd_archive_coff_construct_extended_name_table ((void (*) (bfd *, asymbol *, symbol_info *)) bfd_void) #define _bfd_nosymbols_bfd_is_local_label_name \ ((bfd_boolean (*) (bfd *, const char *)) bfd_false) +#define _bfd_nosymbols_bfd_is_target_special_symbol \ + ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) #define _bfd_nosymbols_get_lineno \ ((alent *(*) (bfd *, asymbol *)) bfd_nullvoidptr) #define _bfd_nosymbols_find_nearest_line \ ((bfd_boolean (*) (bfd *, asection *, asymbol **, bfd_vma, const char **, \ const char **, unsigned int *)) \ bfd_false) +#define _bfd_nosymbols_find_inliner_info \ + ((bfd_boolean (*) (bfd *, const char **, const char **, unsigned int *)) \ + bfd_false) #define _bfd_nosymbols_bfd_make_debug_symbol \ ((asymbol *(*) (bfd *, void *, unsigned long)) bfd_nullvoidptr) #define _bfd_nosymbols_read_minisymbols \ @@ -360,6 +393,9 @@ extern bfd_boolean _bfd_generic_set_section_contents #define _bfd_nolink_bfd_merge_sections \ ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) \ bfd_false) +#define _bfd_nolink_bfd_is_group_section \ + ((bfd_boolean (*) (bfd *, const struct bfd_section *)) \ + bfd_false) #define _bfd_nolink_bfd_discard_group \ ((bfd_boolean (*) (bfd *, struct bfd_section *)) \ bfd_false) @@ -375,6 +411,8 @@ extern bfd_boolean _bfd_generic_set_section_contents ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) bfd_false) #define _bfd_nolink_bfd_link_split_section \ ((bfd_boolean (*) (bfd *, struct bfd_section *)) bfd_false) +#define _bfd_nolink_section_already_linked \ + ((void (*) (bfd *, struct bfd_section *)) bfd_void) /* Routines to use for BFD_JUMP_TABLE_DYNAMIC for targets which do not have dynamic symbols or relocs. Use BFD_JUMP_TABLE_DYNAMIC @@ -383,6 +421,8 @@ extern bfd_boolean _bfd_generic_set_section_contents #define _bfd_nodynamic_get_dynamic_symtab_upper_bound _bfd_n1 #define _bfd_nodynamic_canonicalize_dynamic_symtab \ ((long (*) (bfd *, asymbol **)) _bfd_n1) +#define _bfd_nodynamic_get_synthetic_symtab \ + ((long (*) (bfd *, long, asymbol **, long, asymbol **, asymbol **)) _bfd_n1) #define _bfd_nodynamic_get_dynamic_reloc_upper_bound _bfd_n1 #define _bfd_nodynamic_canonicalize_dynamic_reloc \ ((long (*) (bfd *, arelent **, asymbol **)) _bfd_n1) @@ -403,7 +443,7 @@ extern bfd_boolean _bfd_stab_section_find_nearest_line (bfd *, asymbol **, asection *, bfd_vma, bfd_boolean *, const char **, const char **, unsigned int *, void **); -/* Find the neaderst line using DWARF 1 debugging information. */ +/* Find the nearest line using DWARF 1 debugging information. */ extern bfd_boolean _bfd_dwarf1_find_nearest_line (bfd *, asection *, asymbol **, bfd_vma, const char **, const char **, unsigned int *); @@ -413,6 +453,18 @@ extern bfd_boolean _bfd_dwarf2_find_nearest_line (bfd *, asection *, asymbol **, bfd_vma, const char **, const char **, unsigned int *, unsigned int, void **); +/* Find the line using DWARF 2 debugging information. */ +extern bfd_boolean _bfd_dwarf2_find_line + (bfd *, asymbol **, asymbol *, const char **, + unsigned int *, unsigned int, void **); + +bfd_boolean _bfd_generic_find_line + (bfd *, asymbol **, asymbol *, const char **, unsigned int *); + +/* Find inliner info after calling bfd_find_nearest_line. */ +extern bfd_boolean _bfd_dwarf2_find_inliner_info + (bfd *, const char **, const char **, unsigned int *, void **); + /* Create a new section entry. */ extern struct bfd_hash_entry *bfd_section_hash_newfunc (struct bfd_hash_entry *, struct bfd_hash_table *, const char *); @@ -427,7 +479,8 @@ extern bfd_boolean _bfd_link_hash_table_init (struct bfd_link_hash_table *, bfd *, struct bfd_hash_entry *(*) (struct bfd_hash_entry *, struct bfd_hash_table *, - const char *)); + const char *), + unsigned int); /* Generic link hash table creation routine. */ extern struct bfd_link_hash_table *_bfd_generic_link_hash_table_create @@ -472,6 +525,9 @@ extern bfd_boolean _bfd_generic_final_link extern bfd_boolean _bfd_generic_link_split_section (bfd *, struct bfd_section *); +extern void _bfd_generic_section_already_linked + (bfd *, struct bfd_section *); + /* Generic reloc_link_order processing routine. */ extern bfd_boolean _bfd_generic_reloc_link_order (bfd *, struct bfd_link_info *, asection *, struct bfd_link_order *); @@ -496,7 +552,8 @@ extern bfd_reloc_status_type _bfd_relocate_contents /* Link stabs in sections in the first pass. */ extern bfd_boolean _bfd_link_section_stabs - (bfd *, void **, asection *, asection *, void **, bfd_size_type *); + (bfd *, struct stab_info *, asection *, asection *, void **, + bfd_size_type *); /* Eliminate stabs for discarded functions and symbols. */ extern bfd_boolean _bfd_discard_section_stabs @@ -505,28 +562,28 @@ extern bfd_boolean _bfd_discard_section_stabs /* Write out the .stab section when linking stabs in sections. */ extern bfd_boolean _bfd_write_section_stabs - (bfd *, void **, asection *, void **, bfd_byte *); + (bfd *, struct stab_info *, asection *, void **, bfd_byte *); /* Write out the .stabstr string table when linking stabs in sections. */ extern bfd_boolean _bfd_write_stab_strings - (bfd *, void **); + (bfd *, struct stab_info *); /* Find an offset within a .stab section when linking stabs in sections. */ extern bfd_vma _bfd_stab_section_offset - (bfd *, void **, asection *, void **, bfd_vma); + (asection *, void *, bfd_vma); -/* Attempt to merge a SEC_MERGE section. */ +/* Register a SEC_MERGE section as a candidate for merging. */ -extern bfd_boolean _bfd_merge_section +extern bfd_boolean _bfd_add_merge_section (bfd *, void **, asection *, void **); /* Attempt to merge SEC_MERGE sections. */ extern bfd_boolean _bfd_merge_sections - (bfd *, void *, void (*) (bfd *, asection *)); + (bfd *, struct bfd_link_info *, void *, void (*) (bfd *, asection *)); /* Write out a merged section. */ @@ -536,7 +593,7 @@ extern bfd_boolean _bfd_write_merged_section /* Find an offset within a modified SEC_MERGE section. */ extern bfd_vma _bfd_merged_section_offset - (bfd *, asection **, void *, bfd_vma, bfd_vma); + (bfd *, asection **, void *, bfd_vma); /* Create a string table. */ extern struct bfd_strtab_hash *_bfd_stringtab_init @@ -584,10 +641,10 @@ void bfd_assert (const char*,int); #define BFD_ASSERT(x) \ - { if (!(x)) bfd_assert(__FILE__,__LINE__); } + do { if (!(x)) bfd_assert(__FILE__,__LINE__); } while (0) #define BFD_FAIL() \ - { bfd_assert(__FILE__,__LINE__); } + do { bfd_assert(__FILE__,__LINE__); } while (0) extern void _bfd_abort (const char *, int, const char *) ATTRIBUTE_NORETURN; @@ -604,11 +661,7 @@ extern void _bfd_abort the system "off_t" or "off64_t", as the offset. */ extern file_ptr real_ftell (FILE *file); extern int real_fseek (FILE *file, file_ptr offset, int whence); - -FILE * bfd_cache_lookup_worker - (bfd *); - -extern bfd *bfd_last_cache; +extern FILE *real_fopen (const char *filename, const char *modes); /* List of supported target vectors, and the default vector (if bfd_default_vector[0] is NULL, there is no default). */ @@ -650,6 +703,34 @@ extern bfd_boolean _bfd_sh_align_load_span bfd_boolean (*) (bfd *, asection *, void *, bfd_byte *, bfd_vma), void *, bfd_vma **, bfd_vma *, bfd_vma, bfd_vma, bfd_boolean *); #endif + +/* This is the shape of the elements inside the already_linked hash + table. It maps a name onto a list of already_linked elements with + the same name. */ + +struct bfd_section_already_linked_hash_entry +{ + struct bfd_hash_entry root; + struct bfd_section_already_linked *entry; +}; + +struct bfd_section_already_linked +{ + struct bfd_section_already_linked *next; + asection *sec; +}; + +extern struct bfd_section_already_linked_hash_entry * + bfd_section_already_linked_table_lookup (const char *); +extern void bfd_section_already_linked_table_insert + (struct bfd_section_already_linked_hash_entry *, asection *); +extern void bfd_section_already_linked_table_traverse + (bfd_boolean (*) (struct bfd_section_already_linked_hash_entry *, + void *), void *); + +extern bfd_vma read_unsigned_leb128 (bfd *, bfd_byte *, unsigned int *); +extern bfd_signed_vma read_signed_leb128 (bfd *, bfd_byte *, unsigned int *); + /* Extracted from init.c. */ /* Extracted from libbfd.c. */ bfd_boolean bfd_write_bigendian_4byte_int (bfd *, unsigned int); @@ -657,6 +738,27 @@ bfd_boolean bfd_write_bigendian_4byte_int (bfd *, unsigned int); unsigned int bfd_log2 (bfd_vma x); /* Extracted from bfdio.c. */ +struct bfd_iovec +{ + /* To avoid problems with macros, a "b" rather than "f" + prefix is prepended to each method name. */ + /* Attempt to read/write NBYTES on ABFD's IOSTREAM storing/fetching + bytes starting at PTR. Return the number of bytes actually + transfered (a read past end-of-file returns less than NBYTES), + or -1 (setting <>) if an error occurs. */ + file_ptr (*bread) (struct bfd *abfd, void *ptr, file_ptr nbytes); + file_ptr (*bwrite) (struct bfd *abfd, const void *ptr, + file_ptr nbytes); + /* Return the current IOSTREAM file offset, or -1 (setting <> + if an error occurs. */ + file_ptr (*btell) (struct bfd *abfd); + /* For the following, on successful completion a value of 0 is returned. + Otherwise, a value of -1 is returned (and <> is set). */ + int (*bseek) (struct bfd *abfd, file_ptr offset, int whence); + int (*bclose) (struct bfd *abfd); + int (*bflush) (struct bfd *abfd); + int (*bstat) (struct bfd *abfd, struct stat *sb); +}; /* Extracted from bfdwin.c. */ struct _bfd_window_internal { struct _bfd_window_internal *next; @@ -666,21 +768,12 @@ struct _bfd_window_internal { unsigned mapped : 1; /* 1 = mmap, 0 = malloc */ }; /* Extracted from cache.c. */ -#define BFD_CACHE_MAX_OPEN 10 -extern bfd *bfd_last_cache; - -#define bfd_cache_lookup(x) \ - ((x)==bfd_last_cache? \ - (FILE*) (bfd_last_cache->iostream): \ - bfd_cache_lookup_worker(x)) bfd_boolean bfd_cache_init (bfd *abfd); bfd_boolean bfd_cache_close (bfd *abfd); FILE* bfd_open_file (bfd *abfd); -FILE *bfd_cache_lookup_worker (bfd *abfd); - /* Extracted from reloc.c. */ #ifdef _BFD_MAKE_TABLE_bfd_reloc_code_real @@ -699,6 +792,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_16_PCREL", "BFD_RELOC_12_PCREL", "BFD_RELOC_8_PCREL", + "BFD_RELOC_32_SECREL", "BFD_RELOC_32_GOT_PCREL", "BFD_RELOC_16_GOT_PCREL", "BFD_RELOC_8_GOT_PCREL", @@ -836,8 +930,12 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_HI16", "BFD_RELOC_HI16_S", "BFD_RELOC_LO16", - "BFD_RELOC_PCREL_HI16_S", - "BFD_RELOC_PCREL_LO16", + "BFD_RELOC_HI16_PCREL", + "BFD_RELOC_HI16_S_PCREL", + "BFD_RELOC_LO16_PCREL", + "BFD_RELOC_MIPS16_HI16", + "BFD_RELOC_MIPS16_HI16_S", + "BFD_RELOC_MIPS16_LO16", "BFD_RELOC_MIPS_LITERAL", "BFD_RELOC_MIPS_GOT16", "BFD_RELOC_MIPS_CALL16", @@ -860,6 +958,22 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_MIPS_REL16", "BFD_RELOC_MIPS_RELGOT", "BFD_RELOC_MIPS_JALR", + "BFD_RELOC_MIPS_TLS_DTPMOD32", + "BFD_RELOC_MIPS_TLS_DTPREL32", + "BFD_RELOC_MIPS_TLS_DTPMOD64", + "BFD_RELOC_MIPS_TLS_DTPREL64", + "BFD_RELOC_MIPS_TLS_GD", + "BFD_RELOC_MIPS_TLS_LDM", + "BFD_RELOC_MIPS_TLS_DTPREL_HI16", + "BFD_RELOC_MIPS_TLS_DTPREL_LO16", + "BFD_RELOC_MIPS_TLS_GOTTPREL", + "BFD_RELOC_MIPS_TLS_TPREL32", + "BFD_RELOC_MIPS_TLS_TPREL64", + "BFD_RELOC_MIPS_TLS_TPREL_HI16", + "BFD_RELOC_MIPS_TLS_TPREL_LO16", + + "BFD_RELOC_MIPS_COPY", + "BFD_RELOC_MIPS_JUMP_SLOT", "BFD_RELOC_FRV_LABEL16", "BFD_RELOC_FRV_LABEL24", @@ -884,6 +998,22 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_FRV_GOTOFF12", "BFD_RELOC_FRV_GOTOFFHI", "BFD_RELOC_FRV_GOTOFFLO", + "BFD_RELOC_FRV_GETTLSOFF", + "BFD_RELOC_FRV_TLSDESC_VALUE", + "BFD_RELOC_FRV_GOTTLSDESC12", + "BFD_RELOC_FRV_GOTTLSDESCHI", + "BFD_RELOC_FRV_GOTTLSDESCLO", + "BFD_RELOC_FRV_TLSMOFF12", + "BFD_RELOC_FRV_TLSMOFFHI", + "BFD_RELOC_FRV_TLSMOFFLO", + "BFD_RELOC_FRV_GOTTLSOFF12", + "BFD_RELOC_FRV_GOTTLSOFFHI", + "BFD_RELOC_FRV_GOTTLSOFFLO", + "BFD_RELOC_FRV_TLSOFF", + "BFD_RELOC_FRV_TLSDESC_RELAX", + "BFD_RELOC_FRV_GETTLSOFF_RELAX", + "BFD_RELOC_FRV_TLSOFF_RELAX", + "BFD_RELOC_FRV_TLSMOFF", "BFD_RELOC_MN10300_GOTOFF24", "BFD_RELOC_MN10300_GOT32", @@ -914,6 +1044,9 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_386_TLS_DTPMOD32", "BFD_RELOC_386_TLS_DTPOFF32", "BFD_RELOC_386_TLS_TPOFF32", + "BFD_RELOC_386_TLS_GOTDESC", + "BFD_RELOC_386_TLS_DESC_CALL", + "BFD_RELOC_386_TLS_DESC", "BFD_RELOC_X86_64_GOT32", "BFD_RELOC_X86_64_PLT32", "BFD_RELOC_X86_64_COPY", @@ -930,6 +1063,16 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_X86_64_DTPOFF32", "BFD_RELOC_X86_64_GOTTPOFF", "BFD_RELOC_X86_64_TPOFF32", + "BFD_RELOC_X86_64_GOTOFF64", + "BFD_RELOC_X86_64_GOTPC32", + "BFD_RELOC_X86_64_GOT64", + "BFD_RELOC_X86_64_GOTPCREL64", + "BFD_RELOC_X86_64_GOTPC64", + "BFD_RELOC_X86_64_GOTPLT64", + "BFD_RELOC_X86_64_PLTOFF64", + "BFD_RELOC_X86_64_GOTPC32_TLSDESC", + "BFD_RELOC_X86_64_TLSDESC_CALL", + "BFD_RELOC_X86_64_TLSDESC", "BFD_RELOC_NS32K_IMM_8", "BFD_RELOC_NS32K_IMM_16", "BFD_RELOC_NS32K_IMM_32", @@ -1048,35 +1191,70 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_ARM_PCREL_BRANCH", "BFD_RELOC_ARM_PCREL_BLX", "BFD_RELOC_THUMB_PCREL_BLX", + "BFD_RELOC_ARM_PCREL_CALL", + "BFD_RELOC_ARM_PCREL_JUMP", + "BFD_RELOC_THUMB_PCREL_BRANCH7", + "BFD_RELOC_THUMB_PCREL_BRANCH9", + "BFD_RELOC_THUMB_PCREL_BRANCH12", + "BFD_RELOC_THUMB_PCREL_BRANCH20", + "BFD_RELOC_THUMB_PCREL_BRANCH23", + "BFD_RELOC_THUMB_PCREL_BRANCH25", + "BFD_RELOC_ARM_OFFSET_IMM", + "BFD_RELOC_ARM_THUMB_OFFSET", + "BFD_RELOC_ARM_TARGET1", + "BFD_RELOC_ARM_ROSEGREL32", + "BFD_RELOC_ARM_SBREL32", + "BFD_RELOC_ARM_TARGET2", + "BFD_RELOC_ARM_PREL31", + "BFD_RELOC_ARM_JUMP_SLOT", + "BFD_RELOC_ARM_GLOB_DAT", + "BFD_RELOC_ARM_GOT32", + "BFD_RELOC_ARM_PLT32", + "BFD_RELOC_ARM_RELATIVE", + "BFD_RELOC_ARM_GOTOFF", + "BFD_RELOC_ARM_GOTPC", + "BFD_RELOC_ARM_TLS_GD32", + "BFD_RELOC_ARM_TLS_LDO32", + "BFD_RELOC_ARM_TLS_LDM32", + "BFD_RELOC_ARM_TLS_DTPOFF32", + "BFD_RELOC_ARM_TLS_DTPMOD32", + "BFD_RELOC_ARM_TLS_TPOFF32", + "BFD_RELOC_ARM_TLS_IE32", + "BFD_RELOC_ARM_TLS_LE32", "BFD_RELOC_ARM_IMMEDIATE", "BFD_RELOC_ARM_ADRL_IMMEDIATE", - "BFD_RELOC_ARM_OFFSET_IMM", + "BFD_RELOC_ARM_T32_IMMEDIATE", + "BFD_RELOC_ARM_T32_IMM12", + "BFD_RELOC_ARM_T32_ADD_PC12", "BFD_RELOC_ARM_SHIFT_IMM", + "BFD_RELOC_ARM_SMC", "BFD_RELOC_ARM_SWI", "BFD_RELOC_ARM_MULTI", "BFD_RELOC_ARM_CP_OFF_IMM", "BFD_RELOC_ARM_CP_OFF_IMM_S2", + "BFD_RELOC_ARM_T32_CP_OFF_IMM", + "BFD_RELOC_ARM_T32_CP_OFF_IMM_S2", "BFD_RELOC_ARM_ADR_IMM", "BFD_RELOC_ARM_LDR_IMM", "BFD_RELOC_ARM_LITERAL", "BFD_RELOC_ARM_IN_POOL", "BFD_RELOC_ARM_OFFSET_IMM8", + "BFD_RELOC_ARM_T32_OFFSET_U8", + "BFD_RELOC_ARM_T32_OFFSET_IMM", "BFD_RELOC_ARM_HWLITERAL", "BFD_RELOC_ARM_THUMB_ADD", "BFD_RELOC_ARM_THUMB_IMM", "BFD_RELOC_ARM_THUMB_SHIFT", - "BFD_RELOC_ARM_THUMB_OFFSET", - "BFD_RELOC_ARM_GOT12", - "BFD_RELOC_ARM_GOT32", - "BFD_RELOC_ARM_JUMP_SLOT", - "BFD_RELOC_ARM_COPY", - "BFD_RELOC_ARM_GLOB_DAT", - "BFD_RELOC_ARM_PLT32", - "BFD_RELOC_ARM_RELATIVE", - "BFD_RELOC_ARM_GOTOFF", - "BFD_RELOC_ARM_GOTPC", "BFD_RELOC_SH_PCDISP8BY2", "BFD_RELOC_SH_PCDISP12BY2", + "BFD_RELOC_SH_IMM3", + "BFD_RELOC_SH_IMM3U", + "BFD_RELOC_SH_DISP12", + "BFD_RELOC_SH_DISP12BY2", + "BFD_RELOC_SH_DISP12BY4", + "BFD_RELOC_SH_DISP12BY8", + "BFD_RELOC_SH_DISP20", + "BFD_RELOC_SH_DISP20BY8", "BFD_RELOC_SH_IMM4", "BFD_RELOC_SH_IMM4BY2", "BFD_RELOC_SH_IMM4BY4", @@ -1157,11 +1335,55 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_SH_TLS_DTPMOD32", "BFD_RELOC_SH_TLS_DTPOFF32", "BFD_RELOC_SH_TLS_TPOFF32", - "BFD_RELOC_THUMB_PCREL_BRANCH9", - "BFD_RELOC_THUMB_PCREL_BRANCH12", - "BFD_RELOC_THUMB_PCREL_BRANCH23", "BFD_RELOC_ARC_B22_PCREL", "BFD_RELOC_ARC_B26", + "BFD_RELOC_BFIN_16_IMM", + "BFD_RELOC_BFIN_16_HIGH", + "BFD_RELOC_BFIN_4_PCREL", + "BFD_RELOC_BFIN_5_PCREL", + "BFD_RELOC_BFIN_16_LOW", + "BFD_RELOC_BFIN_10_PCREL", + "BFD_RELOC_BFIN_11_PCREL", + "BFD_RELOC_BFIN_12_PCREL_JUMP", + "BFD_RELOC_BFIN_12_PCREL_JUMP_S", + "BFD_RELOC_BFIN_24_PCREL_CALL_X", + "BFD_RELOC_BFIN_24_PCREL_JUMP_L", + "BFD_RELOC_BFIN_GOT17M4", + "BFD_RELOC_BFIN_GOTHI", + "BFD_RELOC_BFIN_GOTLO", + "BFD_RELOC_BFIN_FUNCDESC", + "BFD_RELOC_BFIN_FUNCDESC_GOT17M4", + "BFD_RELOC_BFIN_FUNCDESC_GOTHI", + "BFD_RELOC_BFIN_FUNCDESC_GOTLO", + "BFD_RELOC_BFIN_FUNCDESC_VALUE", + "BFD_RELOC_BFIN_FUNCDESC_GOTOFF17M4", + "BFD_RELOC_BFIN_FUNCDESC_GOTOFFHI", + "BFD_RELOC_BFIN_FUNCDESC_GOTOFFLO", + "BFD_RELOC_BFIN_GOTOFF17M4", + "BFD_RELOC_BFIN_GOTOFFHI", + "BFD_RELOC_BFIN_GOTOFFLO", + "BFD_RELOC_BFIN_GOT", + "BFD_RELOC_BFIN_PLTPC", + "BFD_ARELOC_BFIN_PUSH", + "BFD_ARELOC_BFIN_CONST", + "BFD_ARELOC_BFIN_ADD", + "BFD_ARELOC_BFIN_SUB", + "BFD_ARELOC_BFIN_MULT", + "BFD_ARELOC_BFIN_DIV", + "BFD_ARELOC_BFIN_MOD", + "BFD_ARELOC_BFIN_LSHIFT", + "BFD_ARELOC_BFIN_RSHIFT", + "BFD_ARELOC_BFIN_AND", + "BFD_ARELOC_BFIN_OR", + "BFD_ARELOC_BFIN_XOR", + "BFD_ARELOC_BFIN_LAND", + "BFD_ARELOC_BFIN_LOR", + "BFD_ARELOC_BFIN_LEN", + "BFD_ARELOC_BFIN_NEG", + "BFD_ARELOC_BFIN_COMP", + "BFD_ARELOC_BFIN_PAGE", + "BFD_ARELOC_BFIN_HWPAGE", + "BFD_ARELOC_BFIN_ADDR", "BFD_RELOC_D10V_10_PCREL_R", "BFD_RELOC_D10V_10_PCREL_L", "BFD_RELOC_D10V_18", @@ -1180,6 +1402,10 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_DLX_HI16_S", "BFD_RELOC_DLX_LO16", "BFD_RELOC_DLX_JMP26", + "BFD_RELOC_M32C_HI8", + "BFD_RELOC_M32C_RL_JUMP", + "BFD_RELOC_M32C_RL_1ADDR", + "BFD_RELOC_M32C_RL_2ADDR", "BFD_RELOC_M32R_24", "BFD_RELOC_M32R_10_PCREL", "BFD_RELOC_M32R_18_PCREL", @@ -1195,6 +1421,9 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_M32R_JMP_SLOT", "BFD_RELOC_M32R_RELATIVE", "BFD_RELOC_M32R_GOTOFF", + "BFD_RELOC_M32R_GOTOFF_HI_ULO", + "BFD_RELOC_M32R_GOTOFF_HI_SLO", + "BFD_RELOC_M32R_GOTOFF_LO", "BFD_RELOC_M32R_GOTPC24", "BFD_RELOC_M32R_GOT16_HI_ULO", "BFD_RELOC_M32R_GOT16_HI_SLO", @@ -1221,6 +1450,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_V850_LONGCALL", "BFD_RELOC_V850_LONGJUMP", "BFD_RELOC_V850_ALIGN", + "BFD_RELOC_V850_LO16_SPLIT_OFFSET", "BFD_RELOC_MN10300_32_PCREL", "BFD_RELOC_MN10300_16_PCREL", "BFD_RELOC_TIC30_LDP", @@ -1273,9 +1503,11 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_AVR_LO8_LDI", "BFD_RELOC_AVR_HI8_LDI", "BFD_RELOC_AVR_HH8_LDI", + "BFD_RELOC_AVR_MS8_LDI", "BFD_RELOC_AVR_LO8_LDI_NEG", "BFD_RELOC_AVR_HI8_LDI_NEG", "BFD_RELOC_AVR_HH8_LDI_NEG", + "BFD_RELOC_AVR_MS8_LDI_NEG", "BFD_RELOC_AVR_LO8_LDI_PM", "BFD_RELOC_AVR_HI8_LDI_PM", "BFD_RELOC_AVR_HH8_LDI_PM", @@ -1283,6 +1515,9 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_AVR_HI8_LDI_PM_NEG", "BFD_RELOC_AVR_HH8_LDI_PM_NEG", "BFD_RELOC_AVR_CALL", + "BFD_RELOC_AVR_LDI", + "BFD_RELOC_AVR_6", + "BFD_RELOC_AVR_6_ADIW", "BFD_RELOC_390_12", "BFD_RELOC_390_GOT12", "BFD_RELOC_390_PLT32", @@ -1437,10 +1672,75 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_M68HC11_PAGE", "BFD_RELOC_M68HC11_24", "BFD_RELOC_M68HC12_5B", + "BFD_RELOC_16C_NUM08", + "BFD_RELOC_16C_NUM08_C", + "BFD_RELOC_16C_NUM16", + "BFD_RELOC_16C_NUM16_C", + "BFD_RELOC_16C_NUM32", + "BFD_RELOC_16C_NUM32_C", + "BFD_RELOC_16C_DISP04", + "BFD_RELOC_16C_DISP04_C", + "BFD_RELOC_16C_DISP08", + "BFD_RELOC_16C_DISP08_C", + "BFD_RELOC_16C_DISP16", + "BFD_RELOC_16C_DISP16_C", + "BFD_RELOC_16C_DISP24", + "BFD_RELOC_16C_DISP24_C", + "BFD_RELOC_16C_DISP24a", + "BFD_RELOC_16C_DISP24a_C", + "BFD_RELOC_16C_REG04", + "BFD_RELOC_16C_REG04_C", + "BFD_RELOC_16C_REG04a", + "BFD_RELOC_16C_REG04a_C", + "BFD_RELOC_16C_REG14", + "BFD_RELOC_16C_REG14_C", + "BFD_RELOC_16C_REG16", + "BFD_RELOC_16C_REG16_C", + "BFD_RELOC_16C_REG20", + "BFD_RELOC_16C_REG20_C", + "BFD_RELOC_16C_ABS20", + "BFD_RELOC_16C_ABS20_C", + "BFD_RELOC_16C_ABS24", + "BFD_RELOC_16C_ABS24_C", + "BFD_RELOC_16C_IMM04", + "BFD_RELOC_16C_IMM04_C", + "BFD_RELOC_16C_IMM16", + "BFD_RELOC_16C_IMM16_C", + "BFD_RELOC_16C_IMM20", + "BFD_RELOC_16C_IMM20_C", + "BFD_RELOC_16C_IMM24", + "BFD_RELOC_16C_IMM24_C", + "BFD_RELOC_16C_IMM32", + "BFD_RELOC_16C_IMM32_C", + "BFD_RELOC_CRX_REL4", + "BFD_RELOC_CRX_REL8", + "BFD_RELOC_CRX_REL8_CMP", + "BFD_RELOC_CRX_REL16", + "BFD_RELOC_CRX_REL24", + "BFD_RELOC_CRX_REL32", + "BFD_RELOC_CRX_REGREL12", + "BFD_RELOC_CRX_REGREL22", + "BFD_RELOC_CRX_REGREL28", + "BFD_RELOC_CRX_REGREL32", + "BFD_RELOC_CRX_ABS16", + "BFD_RELOC_CRX_ABS32", + "BFD_RELOC_CRX_NUM8", + "BFD_RELOC_CRX_NUM16", + "BFD_RELOC_CRX_NUM32", + "BFD_RELOC_CRX_IMM16", + "BFD_RELOC_CRX_IMM32", + "BFD_RELOC_CRX_SWITCH8", + "BFD_RELOC_CRX_SWITCH16", + "BFD_RELOC_CRX_SWITCH32", "BFD_RELOC_CRIS_BDISP8", "BFD_RELOC_CRIS_UNSIGNED_5", "BFD_RELOC_CRIS_SIGNED_6", "BFD_RELOC_CRIS_UNSIGNED_6", + "BFD_RELOC_CRIS_SIGNED_8", + "BFD_RELOC_CRIS_UNSIGNED_8", + "BFD_RELOC_CRIS_SIGNED_16", + "BFD_RELOC_CRIS_UNSIGNED_16", + "BFD_RELOC_CRIS_LAPCQ_OFFSET", "BFD_RELOC_CRIS_UNSIGNED_4", "BFD_RELOC_CRIS_COPY", "BFD_RELOC_CRIS_GLOB_DAT", @@ -1496,14 +1796,26 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_XSTORMY16_12", "BFD_RELOC_XSTORMY16_24", "BFD_RELOC_XSTORMY16_FPTR16", + "BFD_RELOC_XC16X_PAG", + "BFD_RELOC_XC16X_POF", + "BFD_RELOC_XC16X_SEG", + "BFD_RELOC_XC16X_SOF", "BFD_RELOC_VAX_GLOB_DAT", "BFD_RELOC_VAX_JMP_SLOT", "BFD_RELOC_VAX_RELATIVE", + "BFD_RELOC_MT_PC16", + "BFD_RELOC_MT_HI16", + "BFD_RELOC_MT_LO16", + "BFD_RELOC_MT_GNU_VTINHERIT", + "BFD_RELOC_MT_GNU_VTENTRY", + "BFD_RELOC_MT_PCINSN8", "BFD_RELOC_MSP430_10_PCREL", "BFD_RELOC_MSP430_16_PCREL", "BFD_RELOC_MSP430_16", "BFD_RELOC_MSP430_16_PCREL_BYTE", "BFD_RELOC_MSP430_16_BYTE", + "BFD_RELOC_MSP430_2X_PCREL", + "BFD_RELOC_MSP430_RL_PCREL", "BFD_RELOC_IQ2000_OFFSET_16", "BFD_RELOC_IQ2000_OFFSET_21", "BFD_RELOC_IQ2000_UHI16", @@ -1512,11 +1824,48 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_XTENSA_JMP_SLOT", "BFD_RELOC_XTENSA_RELATIVE", "BFD_RELOC_XTENSA_PLT", + "BFD_RELOC_XTENSA_DIFF8", + "BFD_RELOC_XTENSA_DIFF16", + "BFD_RELOC_XTENSA_DIFF32", + "BFD_RELOC_XTENSA_SLOT0_OP", + "BFD_RELOC_XTENSA_SLOT1_OP", + "BFD_RELOC_XTENSA_SLOT2_OP", + "BFD_RELOC_XTENSA_SLOT3_OP", + "BFD_RELOC_XTENSA_SLOT4_OP", + "BFD_RELOC_XTENSA_SLOT5_OP", + "BFD_RELOC_XTENSA_SLOT6_OP", + "BFD_RELOC_XTENSA_SLOT7_OP", + "BFD_RELOC_XTENSA_SLOT8_OP", + "BFD_RELOC_XTENSA_SLOT9_OP", + "BFD_RELOC_XTENSA_SLOT10_OP", + "BFD_RELOC_XTENSA_SLOT11_OP", + "BFD_RELOC_XTENSA_SLOT12_OP", + "BFD_RELOC_XTENSA_SLOT13_OP", + "BFD_RELOC_XTENSA_SLOT14_OP", + "BFD_RELOC_XTENSA_SLOT0_ALT", + "BFD_RELOC_XTENSA_SLOT1_ALT", + "BFD_RELOC_XTENSA_SLOT2_ALT", + "BFD_RELOC_XTENSA_SLOT3_ALT", + "BFD_RELOC_XTENSA_SLOT4_ALT", + "BFD_RELOC_XTENSA_SLOT5_ALT", + "BFD_RELOC_XTENSA_SLOT6_ALT", + "BFD_RELOC_XTENSA_SLOT7_ALT", + "BFD_RELOC_XTENSA_SLOT8_ALT", + "BFD_RELOC_XTENSA_SLOT9_ALT", + "BFD_RELOC_XTENSA_SLOT10_ALT", + "BFD_RELOC_XTENSA_SLOT11_ALT", + "BFD_RELOC_XTENSA_SLOT12_ALT", + "BFD_RELOC_XTENSA_SLOT13_ALT", + "BFD_RELOC_XTENSA_SLOT14_ALT", "BFD_RELOC_XTENSA_OP0", "BFD_RELOC_XTENSA_OP1", "BFD_RELOC_XTENSA_OP2", "BFD_RELOC_XTENSA_ASM_EXPAND", "BFD_RELOC_XTENSA_ASM_SIMPLIFY", + "BFD_RELOC_Z80_DISP8", + "BFD_RELOC_Z8K_DISP7", + "BFD_RELOC_Z8K_CALLR", + "BFD_RELOC_Z8K_IMM4L", "@@overflow: BFD_RELOC_UNUSED@@", }; #endif diff --git a/contrib/binutils/bfd/libcoff-in.h b/contrib/binutils/bfd/libcoff-in.h index 6b5947c4914..f2bc264b3b9 100644 --- a/contrib/binutils/bfd/libcoff-in.h +++ b/contrib/binutils/bfd/libcoff-in.h @@ -1,55 +1,52 @@ /* BFD COFF object file private structure. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003 + 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Written by Cygnus Support. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfdlink.h" -/* Object file tdata; access macros */ +/* Object file tdata; access macros. */ -#define coff_data(bfd) ((bfd)->tdata.coff_obj_data) -#define exec_hdr(bfd) (coff_data(bfd)->hdr) -#define obj_pe(bfd) (coff_data(bfd)->pe) -#define obj_symbols(bfd) (coff_data(bfd)->symbols) -#define obj_sym_filepos(bfd) (coff_data(bfd)->sym_filepos) - -#define obj_relocbase(bfd) (coff_data(bfd)->relocbase) -#define obj_raw_syments(bfd) (coff_data(bfd)->raw_syments) -#define obj_raw_syment_count(bfd) (coff_data(bfd)->raw_syment_count) -#define obj_convert(bfd) (coff_data(bfd)->conversion_table) -#define obj_conv_table_size(bfd) (coff_data(bfd)->conv_table_size) - -#define obj_coff_external_syms(bfd) (coff_data (bfd)->external_syms) -#define obj_coff_keep_syms(bfd) (coff_data (bfd)->keep_syms) -#define obj_coff_strings(bfd) (coff_data (bfd)->strings) -#define obj_coff_keep_strings(bfd) (coff_data (bfd)->keep_strings) -#define obj_coff_sym_hashes(bfd) (coff_data (bfd)->sym_hashes) +#define coff_data(bfd) ((bfd)->tdata.coff_obj_data) +#define exec_hdr(bfd) (coff_data (bfd)->hdr) +#define obj_pe(bfd) (coff_data (bfd)->pe) +#define obj_symbols(bfd) (coff_data (bfd)->symbols) +#define obj_sym_filepos(bfd) (coff_data (bfd)->sym_filepos) +#define obj_relocbase(bfd) (coff_data (bfd)->relocbase) +#define obj_raw_syments(bfd) (coff_data (bfd)->raw_syments) +#define obj_raw_syment_count(bfd) (coff_data (bfd)->raw_syment_count) +#define obj_convert(bfd) (coff_data (bfd)->conversion_table) +#define obj_conv_table_size(bfd) (coff_data (bfd)->conv_table_size) +#define obj_coff_external_syms(bfd) (coff_data (bfd)->external_syms) +#define obj_coff_keep_syms(bfd) (coff_data (bfd)->keep_syms) +#define obj_coff_strings(bfd) (coff_data (bfd)->strings) +#define obj_coff_keep_strings(bfd) (coff_data (bfd)->keep_strings) +#define obj_coff_sym_hashes(bfd) (coff_data (bfd)->sym_hashes) #define obj_coff_strings_written(bfd) (coff_data (bfd)->strings_written) - -#define obj_coff_local_toc_table(bfd) (coff_data(bfd)->local_toc_sym_map) +#define obj_coff_local_toc_table(bfd) (coff_data (bfd)->local_toc_sym_map) /* `Tdata' information kept for COFF files. */ typedef struct coff_tdata { - struct coff_symbol_struct *symbols; /* symtab for input bfd */ + struct coff_symbol_struct *symbols; /* Symtab for input bfd. */ unsigned int *conversion_table; int conv_table_size; file_ptr sym_filepos; @@ -57,7 +54,7 @@ typedef struct coff_tdata struct coff_ptr_struct *raw_syments; unsigned long raw_syment_count; - /* These are only valid once writing has begun */ + /* These are only valid once writing has begun. */ long int relocbase; /* These members communicate important constants about the symbol table @@ -73,7 +70,7 @@ typedef struct coff_tdata /* The unswapped external symbols. May be NULL. Read by _bfd_coff_get_external_symbols. */ - PTR external_syms; + void * external_syms; /* If this is TRUE, the external_syms may not be freed. */ bfd_boolean keep_syms; @@ -85,21 +82,21 @@ typedef struct coff_tdata /* If this is TRUE, the strings have been written out already. */ bfd_boolean strings_written; - /* is this a PE format coff file */ + /* Is this a PE format coff file? */ int pe; /* Used by the COFF backend linker. */ struct coff_link_hash_entry **sym_hashes; - /* used by the pe linker for PowerPC */ + /* Used by the pe linker for PowerPC. */ int *local_toc_sym_map; struct bfd_link_info *link_info; /* Used by coff_find_nearest_line. */ - PTR line_info; + void * line_info; - /* A place to stash dwarf2 info for this bfd. */ - PTR dwarf2_find_line_info; + /* A place to stash dwarf2 info for this bfd. */ + void * dwarf2_find_line_info; /* The timestamp from the COFF file header. */ long timestamp; @@ -110,14 +107,14 @@ typedef struct coff_tdata } coff_data_type; -/* Tdata for pe image files. */ +/* Tdata for pe image files. */ typedef struct pe_tdata { coff_data_type coff; struct internal_extra_pe_aouthdr pe_opthdr; int dll; int has_reloc_section; - bfd_boolean (*in_reloc_p) PARAMS((bfd *, reloc_howto_type *)); + bfd_boolean (*in_reloc_p) (bfd *, reloc_howto_type *); flagword real_flags; int target_subsystem; bfd_boolean force_minimum_alignment; @@ -174,7 +171,7 @@ struct xcoff_tdata #define xcoff_data(abfd) ((abfd)->tdata.xcoff_obj_data) /* We take the address of the first element of an asymbol to ensure that the - * macro is only ever applied to an asymbol. */ + macro is only ever applied to an asymbol. */ #define coffsymbol(asymbol) ((coff_symbol_type *)(&((asymbol)->the_bfd))) /* The used_by_bfd field of a section may be set to a pointer to this @@ -194,11 +191,13 @@ struct coff_section_tdata bfd_vma offset; unsigned int i; const char *function; + /* Optional information about a COMDAT entry; NULL if not COMDAT. */ + struct coff_comdat_info *comdat; int line_base; /* A pointer used for .stab linking optimizations. */ - PTR stab_info; + void * stab_info; /* Available for individual backends. */ - PTR tdata; + void * tdata; }; /* An accessor macro for the coff_section_tdata structure. */ @@ -276,7 +275,7 @@ struct coff_link_hash_table { struct bfd_link_hash_table root; /* A pointer to information used to link stabs in sections. */ - PTR stab_info; + struct stab_info stab_info; }; /* Look up an entry in a COFF linker hash table. */ @@ -291,7 +290,7 @@ struct coff_link_hash_table #define coff_link_hash_traverse(table, func, info) \ (bfd_link_hash_traverse \ (&(table)->root, \ - (bfd_boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \ + (bfd_boolean (*) (struct bfd_link_hash_entry *, void *)) (func), \ (info))) /* Get the COFF linker hash table from a link_info structure. */ @@ -300,67 +299,69 @@ struct coff_link_hash_table /* Functions in coffgen.c. */ extern const bfd_target *coff_object_p - PARAMS ((bfd *)); + (bfd *); extern struct bfd_section *coff_section_from_bfd_index - PARAMS ((bfd *, int)); + (bfd *, int); extern long coff_get_symtab_upper_bound - PARAMS ((bfd *)); + (bfd *); extern long coff_canonicalize_symtab - PARAMS ((bfd *, asymbol **)); + (bfd *, asymbol **); extern int coff_count_linenumbers - PARAMS ((bfd *)); + (bfd *); extern struct coff_symbol_struct *coff_symbol_from - PARAMS ((bfd *, asymbol *)); + (bfd *, asymbol *); extern bfd_boolean coff_renumber_symbols - PARAMS ((bfd *, int *)); + (bfd *, int *); extern void coff_mangle_symbols - PARAMS ((bfd *)); + (bfd *); extern bfd_boolean coff_write_symbols - PARAMS ((bfd *)); + (bfd *); extern bfd_boolean coff_write_linenumbers - PARAMS ((bfd *)); + (bfd *); extern alent *coff_get_lineno - PARAMS ((bfd *, asymbol *)); + (bfd *, asymbol *); extern asymbol *coff_section_symbol - PARAMS ((bfd *, char *)); + (bfd *, char *); extern bfd_boolean _bfd_coff_get_external_symbols - PARAMS ((bfd *)); + (bfd *); extern const char *_bfd_coff_read_string_table - PARAMS ((bfd *)); + (bfd *); extern bfd_boolean _bfd_coff_free_symbols - PARAMS ((bfd *)); + (bfd *); extern struct coff_ptr_struct *coff_get_normalized_symtab - PARAMS ((bfd *)); + (bfd *); extern long coff_get_reloc_upper_bound - PARAMS ((bfd *, sec_ptr)); + (bfd *, sec_ptr); extern asymbol *coff_make_empty_symbol - PARAMS ((bfd *)); + (bfd *); extern void coff_print_symbol - PARAMS ((bfd *, PTR filep, asymbol *, bfd_print_symbol_type)); + (bfd *, void * filep, asymbol *, bfd_print_symbol_type); extern void coff_get_symbol_info - PARAMS ((bfd *, asymbol *, symbol_info *ret)); + (bfd *, asymbol *, symbol_info *ret); extern bfd_boolean _bfd_coff_is_local_label_name - PARAMS ((bfd *, const char *)); + (bfd *, const char *); extern asymbol *coff_bfd_make_debug_symbol - PARAMS ((bfd *, PTR, unsigned long)); + (bfd *, void *, unsigned long); extern bfd_boolean coff_find_nearest_line - PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **, - const char **, unsigned int *)); + (bfd *, asection *, asymbol **, bfd_vma, const char **, + const char **, unsigned int *); +extern bfd_boolean coff_find_inliner_info + (bfd *, const char **, const char **, unsigned int *); extern int coff_sizeof_headers - PARAMS ((bfd *, bfd_boolean)); + (bfd *, bfd_boolean); extern bfd_boolean bfd_coff_reloc16_relax_section - PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *)); + (bfd *, asection *, struct bfd_link_info *, bfd_boolean *); extern bfd_byte *bfd_coff_reloc16_get_relocated_section_contents - PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, - bfd_byte *, bfd_boolean, asymbol **)); + (bfd *, struct bfd_link_info *, struct bfd_link_order *, + bfd_byte *, bfd_boolean, asymbol **); extern bfd_vma bfd_coff_reloc16_get_value - PARAMS ((arelent *, struct bfd_link_info *, asection *)); + (arelent *, struct bfd_link_info *, asection *); extern void bfd_perform_slip - PARAMS ((bfd *, unsigned int, asection *, bfd_vma)); + (bfd *, unsigned int, asection *, bfd_vma); /* Functions and types in cofflink.c. */ -#define STRING_SIZE_SIZE (4) +#define STRING_SIZE_SIZE 4 /* We use a hash table to merge identical enum, struct, and union definitions in the linker. */ @@ -420,7 +421,8 @@ struct coff_debug_merge_hash_table /* Initialize a COFF debug merge hash table. */ #define coff_debug_merge_hash_table_init(table) \ - (bfd_hash_table_init (&(table)->root, _bfd_coff_debug_merge_hash_newfunc)) + (bfd_hash_table_init (&(table)->root, _bfd_coff_debug_merge_hash_newfunc, \ + sizeof (struct coff_debug_merge_hash_entry))) /* Free a COFF debug merge hash table. */ @@ -531,38 +533,38 @@ struct coff_section_alignment_entry }; extern struct bfd_hash_entry *_bfd_coff_link_hash_newfunc - PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); + (struct bfd_hash_entry *, struct bfd_hash_table *, const char *); extern bfd_boolean _bfd_coff_link_hash_table_init - PARAMS ((struct coff_link_hash_table *, bfd *, - struct bfd_hash_entry *(*) (struct bfd_hash_entry *, - struct bfd_hash_table *, - const char *))); + (struct coff_link_hash_table *, bfd *, + struct bfd_hash_entry *(*) (struct bfd_hash_entry *, + struct bfd_hash_table *, + const char *), + unsigned int); extern struct bfd_link_hash_table *_bfd_coff_link_hash_table_create - PARAMS ((bfd *)); + (bfd *); extern const char *_bfd_coff_internal_syment_name - PARAMS ((bfd *, const struct internal_syment *, char *)); + (bfd *, const struct internal_syment *, char *); extern bfd_boolean _bfd_coff_link_add_symbols - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); extern bfd_boolean _bfd_coff_final_link - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); extern struct internal_reloc *_bfd_coff_read_internal_relocs - PARAMS ((bfd *, asection *, bfd_boolean, bfd_byte *, bfd_boolean, - struct internal_reloc *)); + (bfd *, asection *, bfd_boolean, bfd_byte *, bfd_boolean, + struct internal_reloc *); extern bfd_boolean _bfd_coff_generic_relocate_section - PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, - struct internal_reloc *, struct internal_syment *, asection **)); - + (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, + struct internal_reloc *, struct internal_syment *, asection **); extern struct bfd_hash_entry *_bfd_coff_debug_merge_hash_newfunc - PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); + (struct bfd_hash_entry *, struct bfd_hash_table *, const char *); extern bfd_boolean _bfd_coff_write_global_sym - PARAMS ((struct coff_link_hash_entry *, PTR)); + (struct coff_link_hash_entry *, void *); extern bfd_boolean _bfd_coff_write_task_globals - PARAMS ((struct coff_link_hash_entry *, PTR)); + (struct coff_link_hash_entry *, void *); extern bfd_boolean _bfd_coff_link_input_bfd - PARAMS ((struct coff_final_link_info *, bfd *)); + (struct coff_final_link_info *, bfd *); extern bfd_boolean _bfd_coff_reloc_link_order - PARAMS ((bfd *, struct coff_final_link_info *, asection *, - struct bfd_link_order *)); + (bfd *, struct coff_final_link_info *, asection *, + struct bfd_link_order *); #define coff_get_section_contents_in_window \ @@ -571,30 +573,30 @@ extern bfd_boolean _bfd_coff_reloc_link_order /* Functions in xcofflink.c. */ extern long _bfd_xcoff_get_dynamic_symtab_upper_bound - PARAMS ((bfd *)); + (bfd *); extern long _bfd_xcoff_canonicalize_dynamic_symtab - PARAMS ((bfd *, asymbol **)); + (bfd *, asymbol **); extern long _bfd_xcoff_get_dynamic_reloc_upper_bound - PARAMS ((bfd *)); + (bfd *); extern long _bfd_xcoff_canonicalize_dynamic_reloc - PARAMS ((bfd *, arelent **, asymbol **)); + (bfd *, arelent **, asymbol **); extern struct bfd_link_hash_table *_bfd_xcoff_bfd_link_hash_table_create - PARAMS ((bfd *)); + (bfd *); extern void _bfd_xcoff_bfd_link_hash_table_free - PARAMS ((struct bfd_link_hash_table *)); + (struct bfd_link_hash_table *); extern bfd_boolean _bfd_xcoff_bfd_link_add_symbols - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); extern bfd_boolean _bfd_xcoff_bfd_final_link - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); extern bfd_boolean _bfd_ppc_xcoff_relocate_section - PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, - struct internal_reloc *, struct internal_syment *, asection **)); + (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, + struct internal_reloc *, struct internal_syment *, asection **); /* Functions in coff-ppc.c. FIXME: These are called be pe.em in the linker, and so should start with bfd and be declared in bfd.h. */ extern bfd_boolean ppc_allocate_toc_section - PARAMS ((struct bfd_link_info *)); + (struct bfd_link_info *); extern bfd_boolean ppc_process_before_allocation - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); diff --git a/contrib/binutils/bfd/libcoff.h b/contrib/binutils/bfd/libcoff.h index 57711328352..f756f30b1bf 100644 --- a/contrib/binutils/bfd/libcoff.h +++ b/contrib/binutils/bfd/libcoff.h @@ -4,56 +4,53 @@ /* BFD COFF object file private structure. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003 + 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Written by Cygnus Support. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfdlink.h" -/* Object file tdata; access macros */ +/* Object file tdata; access macros. */ -#define coff_data(bfd) ((bfd)->tdata.coff_obj_data) -#define exec_hdr(bfd) (coff_data(bfd)->hdr) -#define obj_pe(bfd) (coff_data(bfd)->pe) -#define obj_symbols(bfd) (coff_data(bfd)->symbols) -#define obj_sym_filepos(bfd) (coff_data(bfd)->sym_filepos) - -#define obj_relocbase(bfd) (coff_data(bfd)->relocbase) -#define obj_raw_syments(bfd) (coff_data(bfd)->raw_syments) -#define obj_raw_syment_count(bfd) (coff_data(bfd)->raw_syment_count) -#define obj_convert(bfd) (coff_data(bfd)->conversion_table) -#define obj_conv_table_size(bfd) (coff_data(bfd)->conv_table_size) - -#define obj_coff_external_syms(bfd) (coff_data (bfd)->external_syms) -#define obj_coff_keep_syms(bfd) (coff_data (bfd)->keep_syms) -#define obj_coff_strings(bfd) (coff_data (bfd)->strings) -#define obj_coff_keep_strings(bfd) (coff_data (bfd)->keep_strings) -#define obj_coff_sym_hashes(bfd) (coff_data (bfd)->sym_hashes) +#define coff_data(bfd) ((bfd)->tdata.coff_obj_data) +#define exec_hdr(bfd) (coff_data (bfd)->hdr) +#define obj_pe(bfd) (coff_data (bfd)->pe) +#define obj_symbols(bfd) (coff_data (bfd)->symbols) +#define obj_sym_filepos(bfd) (coff_data (bfd)->sym_filepos) +#define obj_relocbase(bfd) (coff_data (bfd)->relocbase) +#define obj_raw_syments(bfd) (coff_data (bfd)->raw_syments) +#define obj_raw_syment_count(bfd) (coff_data (bfd)->raw_syment_count) +#define obj_convert(bfd) (coff_data (bfd)->conversion_table) +#define obj_conv_table_size(bfd) (coff_data (bfd)->conv_table_size) +#define obj_coff_external_syms(bfd) (coff_data (bfd)->external_syms) +#define obj_coff_keep_syms(bfd) (coff_data (bfd)->keep_syms) +#define obj_coff_strings(bfd) (coff_data (bfd)->strings) +#define obj_coff_keep_strings(bfd) (coff_data (bfd)->keep_strings) +#define obj_coff_sym_hashes(bfd) (coff_data (bfd)->sym_hashes) #define obj_coff_strings_written(bfd) (coff_data (bfd)->strings_written) - -#define obj_coff_local_toc_table(bfd) (coff_data(bfd)->local_toc_sym_map) +#define obj_coff_local_toc_table(bfd) (coff_data (bfd)->local_toc_sym_map) /* `Tdata' information kept for COFF files. */ typedef struct coff_tdata { - struct coff_symbol_struct *symbols; /* symtab for input bfd */ + struct coff_symbol_struct *symbols; /* Symtab for input bfd. */ unsigned int *conversion_table; int conv_table_size; file_ptr sym_filepos; @@ -61,7 +58,7 @@ typedef struct coff_tdata struct coff_ptr_struct *raw_syments; unsigned long raw_syment_count; - /* These are only valid once writing has begun */ + /* These are only valid once writing has begun. */ long int relocbase; /* These members communicate important constants about the symbol table @@ -77,7 +74,7 @@ typedef struct coff_tdata /* The unswapped external symbols. May be NULL. Read by _bfd_coff_get_external_symbols. */ - PTR external_syms; + void * external_syms; /* If this is TRUE, the external_syms may not be freed. */ bfd_boolean keep_syms; @@ -89,21 +86,21 @@ typedef struct coff_tdata /* If this is TRUE, the strings have been written out already. */ bfd_boolean strings_written; - /* is this a PE format coff file */ + /* Is this a PE format coff file? */ int pe; /* Used by the COFF backend linker. */ struct coff_link_hash_entry **sym_hashes; - /* used by the pe linker for PowerPC */ + /* Used by the pe linker for PowerPC. */ int *local_toc_sym_map; struct bfd_link_info *link_info; /* Used by coff_find_nearest_line. */ - PTR line_info; + void * line_info; - /* A place to stash dwarf2 info for this bfd. */ - PTR dwarf2_find_line_info; + /* A place to stash dwarf2 info for this bfd. */ + void * dwarf2_find_line_info; /* The timestamp from the COFF file header. */ long timestamp; @@ -114,14 +111,14 @@ typedef struct coff_tdata } coff_data_type; -/* Tdata for pe image files. */ +/* Tdata for pe image files. */ typedef struct pe_tdata { coff_data_type coff; struct internal_extra_pe_aouthdr pe_opthdr; int dll; int has_reloc_section; - bfd_boolean (*in_reloc_p) PARAMS((bfd *, reloc_howto_type *)); + bfd_boolean (*in_reloc_p) (bfd *, reloc_howto_type *); flagword real_flags; int target_subsystem; bfd_boolean force_minimum_alignment; @@ -178,7 +175,7 @@ struct xcoff_tdata #define xcoff_data(abfd) ((abfd)->tdata.xcoff_obj_data) /* We take the address of the first element of an asymbol to ensure that the - * macro is only ever applied to an asymbol. */ + macro is only ever applied to an asymbol. */ #define coffsymbol(asymbol) ((coff_symbol_type *)(&((asymbol)->the_bfd))) /* The used_by_bfd field of a section may be set to a pointer to this @@ -198,11 +195,13 @@ struct coff_section_tdata bfd_vma offset; unsigned int i; const char *function; + /* Optional information about a COMDAT entry; NULL if not COMDAT. */ + struct coff_comdat_info *comdat; int line_base; /* A pointer used for .stab linking optimizations. */ - PTR stab_info; + void * stab_info; /* Available for individual backends. */ - PTR tdata; + void * tdata; }; /* An accessor macro for the coff_section_tdata structure. */ @@ -280,7 +279,7 @@ struct coff_link_hash_table { struct bfd_link_hash_table root; /* A pointer to information used to link stabs in sections. */ - PTR stab_info; + struct stab_info stab_info; }; /* Look up an entry in a COFF linker hash table. */ @@ -295,7 +294,7 @@ struct coff_link_hash_table #define coff_link_hash_traverse(table, func, info) \ (bfd_link_hash_traverse \ (&(table)->root, \ - (bfd_boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \ + (bfd_boolean (*) (struct bfd_link_hash_entry *, void *)) (func), \ (info))) /* Get the COFF linker hash table from a link_info structure. */ @@ -304,67 +303,69 @@ struct coff_link_hash_table /* Functions in coffgen.c. */ extern const bfd_target *coff_object_p - PARAMS ((bfd *)); + (bfd *); extern struct bfd_section *coff_section_from_bfd_index - PARAMS ((bfd *, int)); + (bfd *, int); extern long coff_get_symtab_upper_bound - PARAMS ((bfd *)); + (bfd *); extern long coff_canonicalize_symtab - PARAMS ((bfd *, asymbol **)); + (bfd *, asymbol **); extern int coff_count_linenumbers - PARAMS ((bfd *)); + (bfd *); extern struct coff_symbol_struct *coff_symbol_from - PARAMS ((bfd *, asymbol *)); + (bfd *, asymbol *); extern bfd_boolean coff_renumber_symbols - PARAMS ((bfd *, int *)); + (bfd *, int *); extern void coff_mangle_symbols - PARAMS ((bfd *)); + (bfd *); extern bfd_boolean coff_write_symbols - PARAMS ((bfd *)); + (bfd *); extern bfd_boolean coff_write_linenumbers - PARAMS ((bfd *)); + (bfd *); extern alent *coff_get_lineno - PARAMS ((bfd *, asymbol *)); + (bfd *, asymbol *); extern asymbol *coff_section_symbol - PARAMS ((bfd *, char *)); + (bfd *, char *); extern bfd_boolean _bfd_coff_get_external_symbols - PARAMS ((bfd *)); + (bfd *); extern const char *_bfd_coff_read_string_table - PARAMS ((bfd *)); + (bfd *); extern bfd_boolean _bfd_coff_free_symbols - PARAMS ((bfd *)); + (bfd *); extern struct coff_ptr_struct *coff_get_normalized_symtab - PARAMS ((bfd *)); + (bfd *); extern long coff_get_reloc_upper_bound - PARAMS ((bfd *, sec_ptr)); + (bfd *, sec_ptr); extern asymbol *coff_make_empty_symbol - PARAMS ((bfd *)); + (bfd *); extern void coff_print_symbol - PARAMS ((bfd *, PTR filep, asymbol *, bfd_print_symbol_type)); + (bfd *, void * filep, asymbol *, bfd_print_symbol_type); extern void coff_get_symbol_info - PARAMS ((bfd *, asymbol *, symbol_info *ret)); + (bfd *, asymbol *, symbol_info *ret); extern bfd_boolean _bfd_coff_is_local_label_name - PARAMS ((bfd *, const char *)); + (bfd *, const char *); extern asymbol *coff_bfd_make_debug_symbol - PARAMS ((bfd *, PTR, unsigned long)); + (bfd *, void *, unsigned long); extern bfd_boolean coff_find_nearest_line - PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **, - const char **, unsigned int *)); + (bfd *, asection *, asymbol **, bfd_vma, const char **, + const char **, unsigned int *); +extern bfd_boolean coff_find_inliner_info + (bfd *, const char **, const char **, unsigned int *); extern int coff_sizeof_headers - PARAMS ((bfd *, bfd_boolean)); + (bfd *, bfd_boolean); extern bfd_boolean bfd_coff_reloc16_relax_section - PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *)); + (bfd *, asection *, struct bfd_link_info *, bfd_boolean *); extern bfd_byte *bfd_coff_reloc16_get_relocated_section_contents - PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, - bfd_byte *, bfd_boolean, asymbol **)); + (bfd *, struct bfd_link_info *, struct bfd_link_order *, + bfd_byte *, bfd_boolean, asymbol **); extern bfd_vma bfd_coff_reloc16_get_value - PARAMS ((arelent *, struct bfd_link_info *, asection *)); + (arelent *, struct bfd_link_info *, asection *); extern void bfd_perform_slip - PARAMS ((bfd *, unsigned int, asection *, bfd_vma)); + (bfd *, unsigned int, asection *, bfd_vma); /* Functions and types in cofflink.c. */ -#define STRING_SIZE_SIZE (4) +#define STRING_SIZE_SIZE 4 /* We use a hash table to merge identical enum, struct, and union definitions in the linker. */ @@ -424,7 +425,8 @@ struct coff_debug_merge_hash_table /* Initialize a COFF debug merge hash table. */ #define coff_debug_merge_hash_table_init(table) \ - (bfd_hash_table_init (&(table)->root, _bfd_coff_debug_merge_hash_newfunc)) + (bfd_hash_table_init (&(table)->root, _bfd_coff_debug_merge_hash_newfunc, \ + sizeof (struct coff_debug_merge_hash_entry))) /* Free a COFF debug merge hash table. */ @@ -535,38 +537,38 @@ struct coff_section_alignment_entry }; extern struct bfd_hash_entry *_bfd_coff_link_hash_newfunc - PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); + (struct bfd_hash_entry *, struct bfd_hash_table *, const char *); extern bfd_boolean _bfd_coff_link_hash_table_init - PARAMS ((struct coff_link_hash_table *, bfd *, - struct bfd_hash_entry *(*) (struct bfd_hash_entry *, - struct bfd_hash_table *, - const char *))); + (struct coff_link_hash_table *, bfd *, + struct bfd_hash_entry *(*) (struct bfd_hash_entry *, + struct bfd_hash_table *, + const char *), + unsigned int); extern struct bfd_link_hash_table *_bfd_coff_link_hash_table_create - PARAMS ((bfd *)); + (bfd *); extern const char *_bfd_coff_internal_syment_name - PARAMS ((bfd *, const struct internal_syment *, char *)); + (bfd *, const struct internal_syment *, char *); extern bfd_boolean _bfd_coff_link_add_symbols - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); extern bfd_boolean _bfd_coff_final_link - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); extern struct internal_reloc *_bfd_coff_read_internal_relocs - PARAMS ((bfd *, asection *, bfd_boolean, bfd_byte *, bfd_boolean, - struct internal_reloc *)); + (bfd *, asection *, bfd_boolean, bfd_byte *, bfd_boolean, + struct internal_reloc *); extern bfd_boolean _bfd_coff_generic_relocate_section - PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, - struct internal_reloc *, struct internal_syment *, asection **)); - + (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, + struct internal_reloc *, struct internal_syment *, asection **); extern struct bfd_hash_entry *_bfd_coff_debug_merge_hash_newfunc - PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); + (struct bfd_hash_entry *, struct bfd_hash_table *, const char *); extern bfd_boolean _bfd_coff_write_global_sym - PARAMS ((struct coff_link_hash_entry *, PTR)); + (struct coff_link_hash_entry *, void *); extern bfd_boolean _bfd_coff_write_task_globals - PARAMS ((struct coff_link_hash_entry *, PTR)); + (struct coff_link_hash_entry *, void *); extern bfd_boolean _bfd_coff_link_input_bfd - PARAMS ((struct coff_final_link_info *, bfd *)); + (struct coff_final_link_info *, bfd *); extern bfd_boolean _bfd_coff_reloc_link_order - PARAMS ((bfd *, struct coff_final_link_info *, asection *, - struct bfd_link_order *)); + (bfd *, struct coff_final_link_info *, asection *, + struct bfd_link_order *); #define coff_get_section_contents_in_window \ @@ -575,32 +577,32 @@ extern bfd_boolean _bfd_coff_reloc_link_order /* Functions in xcofflink.c. */ extern long _bfd_xcoff_get_dynamic_symtab_upper_bound - PARAMS ((bfd *)); + (bfd *); extern long _bfd_xcoff_canonicalize_dynamic_symtab - PARAMS ((bfd *, asymbol **)); + (bfd *, asymbol **); extern long _bfd_xcoff_get_dynamic_reloc_upper_bound - PARAMS ((bfd *)); + (bfd *); extern long _bfd_xcoff_canonicalize_dynamic_reloc - PARAMS ((bfd *, arelent **, asymbol **)); + (bfd *, arelent **, asymbol **); extern struct bfd_link_hash_table *_bfd_xcoff_bfd_link_hash_table_create - PARAMS ((bfd *)); + (bfd *); extern void _bfd_xcoff_bfd_link_hash_table_free - PARAMS ((struct bfd_link_hash_table *)); + (struct bfd_link_hash_table *); extern bfd_boolean _bfd_xcoff_bfd_link_add_symbols - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); extern bfd_boolean _bfd_xcoff_bfd_final_link - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); extern bfd_boolean _bfd_ppc_xcoff_relocate_section - PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, - struct internal_reloc *, struct internal_syment *, asection **)); + (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, + struct internal_reloc *, struct internal_syment *, asection **); /* Functions in coff-ppc.c. FIXME: These are called be pe.em in the linker, and so should start with bfd and be declared in bfd.h. */ extern bfd_boolean ppc_allocate_toc_section - PARAMS ((struct bfd_link_info *)); + (struct bfd_link_info *); extern bfd_boolean ppc_process_before_allocation - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); /* Extracted from coffcode.h. */ typedef struct coff_ptr_struct @@ -674,34 +676,34 @@ enum coff_symbol_classification typedef struct { void (*_bfd_coff_swap_aux_in) - PARAMS ((bfd *, PTR, int, int, int, int, PTR)); + (bfd *, void *, int, int, int, int, void *); void (*_bfd_coff_swap_sym_in) - PARAMS ((bfd *, PTR, PTR)); + (bfd *, void *, void *); void (*_bfd_coff_swap_lineno_in) - PARAMS ((bfd *, PTR, PTR)); + (bfd *, void *, void *); unsigned int (*_bfd_coff_swap_aux_out) - PARAMS ((bfd *, PTR, int, int, int, int, PTR)); + (bfd *, void *, int, int, int, int, void *); unsigned int (*_bfd_coff_swap_sym_out) - PARAMS ((bfd *, PTR, PTR)); + (bfd *, void *, void *); unsigned int (*_bfd_coff_swap_lineno_out) - PARAMS ((bfd *, PTR, PTR)); + (bfd *, void *, void *); unsigned int (*_bfd_coff_swap_reloc_out) - PARAMS ((bfd *, PTR, PTR)); + (bfd *, void *, void *); unsigned int (*_bfd_coff_swap_filehdr_out) - PARAMS ((bfd *, PTR, PTR)); + (bfd *, void *, void *); unsigned int (*_bfd_coff_swap_aouthdr_out) - PARAMS ((bfd *, PTR, PTR)); + (bfd *, void *, void *); unsigned int (*_bfd_coff_swap_scnhdr_out) - PARAMS ((bfd *, PTR, PTR)); + (bfd *, void *, void *); unsigned int _bfd_filhsz; unsigned int _bfd_aoutsz; @@ -718,86 +720,86 @@ typedef struct unsigned int _bfd_coff_debug_string_prefix_length; void (*_bfd_coff_swap_filehdr_in) - PARAMS ((bfd *, PTR, PTR)); + (bfd *, void *, void *); void (*_bfd_coff_swap_aouthdr_in) - PARAMS ((bfd *, PTR, PTR)); + (bfd *, void *, void *); void (*_bfd_coff_swap_scnhdr_in) - PARAMS ((bfd *, PTR, PTR)); + (bfd *, void *, void *); void (*_bfd_coff_swap_reloc_in) - PARAMS ((bfd *abfd, PTR, PTR)); + (bfd *abfd, void *, void *); bfd_boolean (*_bfd_coff_bad_format_hook) - PARAMS ((bfd *, PTR)); + (bfd *, void *); bfd_boolean (*_bfd_coff_set_arch_mach_hook) - PARAMS ((bfd *, PTR)); + (bfd *, void *); - PTR (*_bfd_coff_mkobject_hook) - PARAMS ((bfd *, PTR, PTR)); + void * (*_bfd_coff_mkobject_hook) + (bfd *, void *, void *); bfd_boolean (*_bfd_styp_to_sec_flags_hook) - PARAMS ((bfd *, PTR, const char *, asection *, flagword *)); + (bfd *, void *, const char *, asection *, flagword *); void (*_bfd_set_alignment_hook) - PARAMS ((bfd *, asection *, PTR)); + (bfd *, asection *, void *); bfd_boolean (*_bfd_coff_slurp_symbol_table) - PARAMS ((bfd *)); + (bfd *); bfd_boolean (*_bfd_coff_symname_in_debug) - PARAMS ((bfd *, struct internal_syment *)); + (bfd *, struct internal_syment *); bfd_boolean (*_bfd_coff_pointerize_aux_hook) - PARAMS ((bfd *, combined_entry_type *, combined_entry_type *, - unsigned int, combined_entry_type *)); + (bfd *, combined_entry_type *, combined_entry_type *, + unsigned int, combined_entry_type *); bfd_boolean (*_bfd_coff_print_aux) - PARAMS ((bfd *, FILE *, combined_entry_type *, combined_entry_type *, - combined_entry_type *, unsigned int)); + (bfd *, FILE *, combined_entry_type *, combined_entry_type *, + combined_entry_type *, unsigned int); void (*_bfd_coff_reloc16_extra_cases) - PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *, - bfd_byte *, unsigned int *, unsigned int *)); + (bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *, + bfd_byte *, unsigned int *, unsigned int *); int (*_bfd_coff_reloc16_estimate) - PARAMS ((bfd *, asection *, arelent *, unsigned int, - struct bfd_link_info *)); + (bfd *, asection *, arelent *, unsigned int, + struct bfd_link_info *); enum coff_symbol_classification (*_bfd_coff_classify_symbol) - PARAMS ((bfd *, struct internal_syment *)); + (bfd *, struct internal_syment *); bfd_boolean (*_bfd_coff_compute_section_file_positions) - PARAMS ((bfd *)); + (bfd *); bfd_boolean (*_bfd_coff_start_final_link) - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); bfd_boolean (*_bfd_coff_relocate_section) - PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, - struct internal_reloc *, struct internal_syment *, asection **)); + (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, + struct internal_reloc *, struct internal_syment *, asection **); reloc_howto_type *(*_bfd_coff_rtype_to_howto) - PARAMS ((bfd *, asection *, struct internal_reloc *, + (bfd *, asection *, struct internal_reloc *, struct coff_link_hash_entry *, struct internal_syment *, - bfd_vma *)); + bfd_vma *); bfd_boolean (*_bfd_coff_adjust_symndx) - PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, - struct internal_reloc *, bfd_boolean *)); + (bfd *, struct bfd_link_info *, bfd *, asection *, + struct internal_reloc *, bfd_boolean *); bfd_boolean (*_bfd_coff_link_add_one_symbol) - PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword, + (struct bfd_link_info *, bfd *, const char *, flagword, asection *, bfd_vma, const char *, bfd_boolean, bfd_boolean, - struct bfd_link_hash_entry **)); + struct bfd_link_hash_entry **); bfd_boolean (*_bfd_coff_link_output_has_begun) - PARAMS ((bfd *, struct coff_final_link_info *)); + (bfd *, struct coff_final_link_info *); bfd_boolean (*_bfd_coff_final_link_postscript) - PARAMS ((bfd *, struct coff_final_link_info *)); + (bfd *, struct coff_final_link_info *); } bfd_coff_backend_data; @@ -927,7 +929,7 @@ typedef struct (info, abfd, name, flags, section, value, string, cp, coll, hashp)) #define bfd_coff_link_output_has_begun(a,p) \ - ((coff_backend_info (a)->_bfd_coff_link_output_has_begun) (a,p)) + ((coff_backend_info (a)->_bfd_coff_link_output_has_begun) (a, p)) #define bfd_coff_final_link_postscript(a,p) \ - ((coff_backend_info (a)->_bfd_coff_final_link_postscript) (a,p)) + ((coff_backend_info (a)->_bfd_coff_final_link_postscript) (a, p)) diff --git a/contrib/binutils/bfd/libecoff.h b/contrib/binutils/bfd/libecoff.h index 161f06c727c..8c5e218ee58 100644 --- a/contrib/binutils/bfd/libecoff.h +++ b/contrib/binutils/bfd/libecoff.h @@ -1,23 +1,23 @@ /* BFD ECOFF object file private structure. - Copyright 1993, 1994, 1995, 1996, 1999, 2001, 2002, 2003 - Free Software Foundation, Inc. + Copyright 1993, 1994, 1995, 1996, 1999, 2001, 2002, 2003, 2004, + 2005 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfdlink.h" @@ -57,24 +57,22 @@ struct ecoff_backend_data /* External reloc size. */ bfd_size_type external_reloc_size; /* Reloc swapping functions. */ - void (*swap_reloc_in) PARAMS ((bfd *, PTR, struct internal_reloc *)); - void (*swap_reloc_out) PARAMS ((bfd *, const struct internal_reloc *, PTR)); + void (*swap_reloc_in) (bfd *, void *, struct internal_reloc *); + void (*swap_reloc_out) (bfd *, const struct internal_reloc *, void *); /* Backend reloc tweaking. */ void (*adjust_reloc_in) - PARAMS ((bfd *, const struct internal_reloc *, arelent *)); + (bfd *, const struct internal_reloc *, arelent *); void (*adjust_reloc_out) - PARAMS ((bfd *, const arelent *, struct internal_reloc *)); + (bfd *, const arelent *, struct internal_reloc *); /* Relocate section contents while linking. */ bfd_boolean (*relocate_section) - PARAMS ((bfd *output_bfd, struct bfd_link_info *, bfd *input_bfd, - asection *input_section, bfd_byte *contents, - PTR external_relocs)); + (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, void *); /* Do final adjustments to filehdr and aouthdr. */ bfd_boolean (*adjust_headers) - PARAMS ((bfd *, struct internal_filehdr *, struct internal_aouthdr *)); + (bfd *, struct internal_filehdr *, struct internal_aouthdr *); /* Read an element from an archive at a given file position. This is needed because OSF/1 3.2 uses a weird archive format. */ - bfd *(*get_elt_at_filepos) PARAMS ((bfd *, file_ptr)); + bfd *(*get_elt_at_filepos) (bfd *, file_ptr); }; /* This is the target specific information kept for ECOFF files. */ @@ -115,7 +113,7 @@ typedef struct ecoff_tdata struct ecoff_debug_info debug_info; /* The unswapped ECOFF symbolic information. */ - PTR raw_syments; + void * raw_syments; /* The canonical BFD symbols. */ struct ecoff_symbol_struct *canonical_symbols; @@ -163,7 +161,7 @@ typedef struct ecoff_symbol_struct /* A pointer to the unswapped hidden information for this symbol. This is either a struct sym_ext or a struct ext_ext, depending on the value of the local field above. */ - PTR native; + void * native; } ecoff_symbol_type; /* We take the address of the first element of an asymbol to ensure that the @@ -176,41 +174,13 @@ typedef struct ecoff_symbol_struct #define ecoff_get_sym_index(symbol) ((symbol)->udata.i) #define ecoff_set_sym_index(symbol, idx) ((symbol)->udata.i = (idx)) -/* When generating MIPS embedded PIC code, the linker relaxes the code - to turn PC relative branches into longer code sequences when the PC - relative branch is out of range. This involves reading the relocs - in bfd_relax_section as well as in bfd_final_link, and requires the - code to keep track of which relocs have been expanded. A pointer - to this structure is put in the used_by_bfd pointer of a section to - keep track of this information. The user_by_bfd pointer will be - NULL if the information was not needed. */ +/* A pointer to this structure is put in the used_by_bfd pointer of + a section to keep track of any per-section data. + The user_by_bfd pointer will be NULL if the information was not + needed. */ struct ecoff_section_tdata { - /* The unswapped relocs for this section. These are stored in - memory so the input file does not have to be read twice. */ - PTR external_relocs; - - /* The contents of the section. These bytes may or may not be saved - in memory, but if it is this is a pointer to them. */ - bfd_byte *contents; - - /* Offset adjustments for PC relative branches. A number other than - 1 is an addend for a PC relative branch, or a switch table entry - which is the difference of two .text locations; this addend - arises because the branch or difference crosses one or more - branches which were expanded into a larger code sequence. A 1 - means that this branch was itself expanded into a larger code - sequence. 1 is not a possible offset, since all offsets must be - multiples of the instruction size, which is 4; also, the only - relocs with non-zero offsets will be PC relative branches or - switch table entries within the same object file. If this field - is NULL, no branches were expanded and no offsets are required. - Otherwise there are as many entries as there are relocs in the - section, and the entry for any reloc that is not PC relative is - zero. */ - long *offsets; - /* When producing an executable (i.e., final, non-relocatable link) on the Alpha, we may need to use multiple global pointer values to span the entire .lita section. In essence, we allow each @@ -249,34 +219,37 @@ struct ecoff_link_hash_table }; /* Make an ECOFF object. */ -extern bfd_boolean _bfd_ecoff_mkobject PARAMS ((bfd *)); +extern bfd_boolean _bfd_ecoff_mkobject (bfd *); /* Read in the ECOFF symbolic debugging information. */ extern bfd_boolean _bfd_ecoff_slurp_symbolic_info - PARAMS ((bfd *, asection *, struct ecoff_debug_info *)); + (bfd *, asection *, struct ecoff_debug_info *); /* Generic ECOFF BFD backend vectors. */ -extern bfd_boolean _bfd_ecoff_write_object_contents PARAMS ((bfd *abfd)); -extern const bfd_target *_bfd_ecoff_archive_p PARAMS ((bfd *abfd)); +extern bfd_boolean _bfd_ecoff_write_object_contents (bfd *); +extern const bfd_target *_bfd_ecoff_archive_p (bfd *); #define _bfd_ecoff_close_and_cleanup _bfd_generic_close_and_cleanup #define _bfd_ecoff_bfd_free_cached_info _bfd_generic_bfd_free_cached_info extern bfd_boolean _bfd_ecoff_new_section_hook - PARAMS ((bfd *, asection *)); + (bfd *, asection *); extern bfd_boolean _bfd_ecoff_get_section_contents - PARAMS ((bfd *, asection *, PTR location, file_ptr, bfd_size_type)); + (bfd *, asection *, void * location, file_ptr, bfd_size_type); #define _bfd_ecoff_bfd_link_split_section _bfd_generic_link_split_section extern bfd_boolean _bfd_ecoff_bfd_copy_private_bfd_data - PARAMS ((bfd *, bfd *)); + (bfd *, bfd *); #define _bfd_ecoff_bfd_copy_private_section_data \ _bfd_generic_bfd_copy_private_section_data #define _bfd_ecoff_bfd_copy_private_symbol_data \ _bfd_generic_bfd_copy_private_symbol_data +#define _bfd_ecoff_bfd_copy_private_header_data \ + _bfd_generic_bfd_copy_private_header_data + #define _bfd_ecoff_bfd_print_private_bfd_data \ _bfd_generic_bfd_print_private_bfd_data @@ -284,79 +257,81 @@ extern bfd_boolean _bfd_ecoff_bfd_copy_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data #define _bfd_ecoff_bfd_set_private_flags _bfd_generic_bfd_set_private_flags -extern bfd_boolean _bfd_ecoff_slurp_armap PARAMS ((bfd *abfd)); +extern bfd_boolean _bfd_ecoff_slurp_armap (bfd *); #define _bfd_ecoff_slurp_extended_name_table _bfd_slurp_extended_name_table #define _bfd_ecoff_construct_extended_name_table \ _bfd_archive_bsd_construct_extended_name_table #define _bfd_ecoff_truncate_arname bfd_dont_truncate_arname extern bfd_boolean _bfd_ecoff_write_armap - PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int)); + (bfd *, unsigned int, struct orl *, unsigned int, int); #define _bfd_ecoff_read_ar_hdr _bfd_generic_read_ar_hdr #define _bfd_ecoff_openr_next_archived_file \ bfd_generic_openr_next_archived_file #define _bfd_ecoff_get_elt_at_index _bfd_generic_get_elt_at_index #define _bfd_ecoff_generic_stat_arch_elt bfd_generic_stat_arch_elt #define _bfd_ecoff_update_armap_timestamp bfd_true +#define _bfd_ecoff_bfd_is_target_special_symbol \ + ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) -extern long _bfd_ecoff_get_symtab_upper_bound PARAMS ((bfd *abfd)); -extern long _bfd_ecoff_canonicalize_symtab PARAMS ((bfd *abfd, asymbol **alocation)); -extern asymbol *_bfd_ecoff_make_empty_symbol PARAMS ((bfd *abfd)); +extern long _bfd_ecoff_get_symtab_upper_bound (bfd *); +extern long _bfd_ecoff_canonicalize_symtab (bfd *, asymbol **); +extern asymbol *_bfd_ecoff_make_empty_symbol (bfd *); extern void _bfd_ecoff_print_symbol - PARAMS ((bfd *, PTR filep, asymbol *, bfd_print_symbol_type)); + (bfd *, void *, asymbol *, bfd_print_symbol_type); extern void _bfd_ecoff_get_symbol_info - PARAMS ((bfd *, asymbol *, symbol_info *)); + (bfd *, asymbol *, symbol_info *); extern bfd_boolean _bfd_ecoff_bfd_is_local_label_name - PARAMS ((bfd *, const char *)); + (bfd *, const char *); #define _bfd_ecoff_get_lineno _bfd_nosymbols_get_lineno extern bfd_boolean _bfd_ecoff_find_nearest_line - PARAMS ((bfd *, asection *, asymbol **, bfd_vma offset, - const char **filename_ptr, const char **fnname_ptr, - unsigned int *retline_ptr)); + (bfd *, asection *, asymbol **, bfd_vma, const char **, const char **, + unsigned int *); #define _bfd_ecoff_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol #define _bfd_ecoff_read_minisymbols _bfd_generic_read_minisymbols #define _bfd_ecoff_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol +#define _bfd_ecoff_find_inliner_info _bfd_nosymbols_find_inliner_info #define _bfd_ecoff_get_reloc_upper_bound coff_get_reloc_upper_bound extern long _bfd_ecoff_canonicalize_reloc - PARAMS ((bfd *, asection *, arelent **, asymbol **symbols)); + (bfd *, asection *, arelent **, asymbol **symbols); /* ecoff_bfd_reloc_type_lookup defined by backend. */ extern bfd_boolean _bfd_ecoff_set_arch_mach - PARAMS ((bfd *, enum bfd_architecture, unsigned long)); + (bfd *, enum bfd_architecture, unsigned long); extern bfd_boolean _bfd_ecoff_set_section_contents - PARAMS ((bfd *, asection *, const PTR location, file_ptr, bfd_size_type)); + (bfd *, asection *, const void * location, file_ptr, bfd_size_type); -extern int _bfd_ecoff_sizeof_headers PARAMS ((bfd *abfd, bfd_boolean reloc)); +extern int _bfd_ecoff_sizeof_headers (bfd *, bfd_boolean); /* ecoff_bfd_get_relocated_section_contents defined by backend. */ /* ecoff_bfd_relax_section defined by backend. */ extern struct bfd_link_hash_table *_bfd_ecoff_bfd_link_hash_table_create - PARAMS ((bfd *)); + (bfd *); #define _bfd_ecoff_bfd_link_hash_table_free _bfd_generic_link_hash_table_free extern bfd_boolean _bfd_ecoff_bfd_link_add_symbols - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); #define _bfd_ecoff_bfd_link_just_syms _bfd_generic_link_just_syms extern bfd_boolean _bfd_ecoff_bfd_final_link - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); /* Hook functions for the generic COFF section reading code. */ -extern PTR _bfd_ecoff_mkobject_hook PARAMS ((bfd *, PTR filehdr, PTR aouthdr)); +extern void * _bfd_ecoff_mkobject_hook (bfd *, void *, void *); #define _bfd_ecoff_set_alignment_hook \ - ((void (*) PARAMS ((bfd *, asection *, PTR))) bfd_void) + ((void (*) (bfd *, asection *, void *)) bfd_void) extern bfd_boolean _bfd_ecoff_set_arch_mach_hook - PARAMS ((bfd *abfd, PTR filehdr)); + (bfd *, void *); extern bfd_boolean _bfd_ecoff_styp_to_sec_flags - PARAMS ((bfd *, PTR, const char *, asection *, flagword *)); -extern bfd_boolean _bfd_ecoff_slurp_symbol_table PARAMS ((bfd *abfd)); + (bfd *, void *, const char *, asection *, flagword *); +extern bfd_boolean _bfd_ecoff_slurp_symbol_table (bfd *); /* ECOFF auxiliary information swapping routines. These are the same for all ECOFF targets, so they are defined in ecofflink.c. */ extern void _bfd_ecoff_swap_tir_in - PARAMS ((int, const struct tir_ext *, TIR *)); + (int, const struct tir_ext *, TIR *); extern void _bfd_ecoff_swap_tir_out - PARAMS ((int, const TIR *, struct tir_ext *)); + (int, const TIR *, struct tir_ext *); extern void _bfd_ecoff_swap_rndx_in - PARAMS ((int, const struct rndx_ext *, RNDXR *)); + (int, const struct rndx_ext *, RNDXR *); extern void _bfd_ecoff_swap_rndx_out - PARAMS ((int, const RNDXR *, struct rndx_ext *)); + (int, const RNDXR *, struct rndx_ext *); diff --git a/contrib/binutils/bfd/libieee.h b/contrib/binutils/bfd/libieee.h index 56c7ce1a20c..ab06251f91c 100644 --- a/contrib/binutils/bfd/libieee.h +++ b/contrib/binutils/bfd/libieee.h @@ -17,7 +17,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ typedef struct { unsigned int index:24; diff --git a/contrib/binutils/bfd/libpei.h b/contrib/binutils/bfd/libpei.h index 9ed9c1224e7..f0f6580fe4b 100644 --- a/contrib/binutils/bfd/libpei.h +++ b/contrib/binutils/bfd/libpei.h @@ -1,5 +1,5 @@ /* Support for the generic parts of PE/PEI; common header information. - Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 + Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005 Free Software Foundation, Inc. Written by Cygnus Solutions. @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* Most of this hacked by Steve Chamberlain, sac@cygnus.com @@ -270,6 +270,11 @@ #endif /* !COFF_WITH_pep */ +/* Macro: Returns true if the bfd is a PE executable as opposed to a PE object file. */ +#define bfd_pe_executable_p(abfd) \ + (strncmp ((abfd)->xvec->name, "pei-", 4) == 0 \ + || strncmp ((abfd)->xvec->name, "efi-app-", 8) == 0) + /* These functions are architecture dependent, and are in peicode.h: coff_swap_reloc_in int coff_swap_reloc_out @@ -282,56 +287,39 @@ implementations architecture types, and actually appear in peigen.c. */ -void _bfd_XXi_swap_sym_in PARAMS ((bfd*, PTR, PTR)); -#define coff_swap_sym_in _bfd_XXi_swap_sym_in - -unsigned int _bfd_XXi_swap_sym_out PARAMS ((bfd*, PTR, PTR)); -#define coff_swap_sym_out _bfd_XXi_swap_sym_out - -void _bfd_XXi_swap_aux_in PARAMS ((bfd *, PTR, int, int, int, int, PTR)); -#define coff_swap_aux_in _bfd_XXi_swap_aux_in - -unsigned int _bfd_XXi_swap_aux_out \ - PARAMS ((bfd *, PTR, int, int, int, int, PTR)); -#define coff_swap_aux_out _bfd_XXi_swap_aux_out - -void _bfd_XXi_swap_lineno_in PARAMS ((bfd*, PTR, PTR)); -#define coff_swap_lineno_in _bfd_XXi_swap_lineno_in - -unsigned int _bfd_XXi_swap_lineno_out PARAMS ((bfd*, PTR, PTR)); -#define coff_swap_lineno_out _bfd_XXi_swap_lineno_out - -void _bfd_XXi_swap_aouthdr_in PARAMS ((bfd*, PTR, PTR)); -#define coff_swap_aouthdr_in _bfd_XXi_swap_aouthdr_in - -unsigned int _bfd_XXi_swap_aouthdr_out PARAMS ((bfd *, PTR, PTR)); +#define coff_swap_sym_in _bfd_XXi_swap_sym_in +#define coff_swap_sym_out _bfd_XXi_swap_sym_out +#define coff_swap_aux_in _bfd_XXi_swap_aux_in +#define coff_swap_aux_out _bfd_XXi_swap_aux_out +#define coff_swap_lineno_in _bfd_XXi_swap_lineno_in +#define coff_swap_lineno_out _bfd_XXi_swap_lineno_out +#define coff_swap_aouthdr_in _bfd_XXi_swap_aouthdr_in #define coff_swap_aouthdr_out _bfd_XXi_swap_aouthdr_out - -unsigned int _bfd_XXi_swap_scnhdr_out PARAMS ((bfd *, PTR, PTR)); -#define coff_swap_scnhdr_out _bfd_XXi_swap_scnhdr_out - -bfd_boolean _bfd_XX_print_private_bfd_data_common PARAMS ((bfd *, PTR)); - -bfd_boolean _bfd_XX_bfd_copy_private_bfd_data_common PARAMS ((bfd *, bfd *)); - -void _bfd_XX_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *)); - -bfd_boolean _bfd_XXi_final_link_postscript - PARAMS ((bfd *, struct coff_final_link_info *)); +#define coff_swap_scnhdr_out _bfd_XXi_swap_scnhdr_out #ifndef coff_final_link_postscript #define coff_final_link_postscript _bfd_XXi_final_link_postscript #endif + +void _bfd_XXi_swap_sym_in (bfd *, void *, void *); +unsigned _bfd_XXi_swap_sym_out (bfd *, void *, void *); +void _bfd_XXi_swap_aux_in (bfd *, void *, int, int, int, int, void *); +unsigned _bfd_XXi_swap_aux_out (bfd *, void *, int, int, int, int, void *); +void _bfd_XXi_swap_lineno_in (bfd *, void *, void *); +unsigned _bfd_XXi_swap_lineno_out (bfd *, void *, void *); +void _bfd_XXi_swap_aouthdr_in (bfd *, void *, void *); +unsigned _bfd_XXi_swap_aouthdr_out (bfd *, void *, void *); +unsigned _bfd_XXi_swap_scnhdr_out (bfd *, void *, void *); +bfd_boolean _bfd_XX_print_private_bfd_data_common (bfd *, void *); +bfd_boolean _bfd_XX_bfd_copy_private_bfd_data_common (bfd *, bfd *); +void _bfd_XX_get_symbol_info (bfd *, asymbol *, symbol_info *); +bfd_boolean _bfd_XXi_final_link_postscript (bfd *, struct coff_final_link_info *); + /* The following are needed only for ONE of pe or pei, but don't otherwise vary; peicode.h fixes up ifdefs but we provide the prototype. */ -unsigned int _bfd_XX_only_swap_filehdr_out PARAMS ((bfd*, PTR, PTR)); -unsigned int _bfd_XXi_only_swap_filehdr_out PARAMS ((bfd*, PTR, PTR)); -bfd_boolean _bfd_XX_bfd_copy_private_section_data - PARAMS ((bfd *, asection *, bfd *, asection *)); +unsigned _bfd_XX_only_swap_filehdr_out (bfd *, void *, void *); +unsigned _bfd_XXi_only_swap_filehdr_out (bfd *, void *, void *); +bfd_boolean _bfd_XX_bfd_copy_private_section_data (bfd *, asection *, bfd *, asection *); -/* Macro: Returns true if the bfd is a PE executable as opposed to a PE object file. */ -#define bfd_pe_executable_p(abfd) \ - (strncmp ((abfd)->xvec->name, "pei-", 4) == 0 \ - || strncmp ((abfd)->xvec->name, "efi-app-", 8) == 0) diff --git a/contrib/binutils/bfd/libxcoff.h b/contrib/binutils/bfd/libxcoff.h index 8537617fcf1..78b5f5f8d00 100644 --- a/contrib/binutils/bfd/libxcoff.h +++ b/contrib/binutils/bfd/libxcoff.h @@ -1,5 +1,5 @@ /* BFD XCOFF object file private structure. - Copyright 2001, 2002 Free Software Foundation, Inc. + Copyright 2001, 2002, 2005 Free Software Foundation, Inc. Written by Tom Rix, Redhat. This file is part of BFD, the Binary File Descriptor library. @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef LIBXCOFF_H #define LIBXCOFF_H @@ -39,18 +39,12 @@ struct xcoff_backend_data_rec long _xcoff_machine; /* Function pointers to xcoff specific swap routines. */ - void (* _xcoff_swap_ldhdr_in) - PARAMS ((bfd *, const PTR, struct internal_ldhdr *)); - void (* _xcoff_swap_ldhdr_out) - PARAMS ((bfd *, const struct internal_ldhdr *, PTR)); - void (* _xcoff_swap_ldsym_in) - PARAMS ((bfd *, const PTR, struct internal_ldsym *)); - void (* _xcoff_swap_ldsym_out) - PARAMS ((bfd *, const struct internal_ldsym *, PTR)); - void (* _xcoff_swap_ldrel_in) - PARAMS ((bfd *, const PTR, struct internal_ldrel *)); - void (* _xcoff_swap_ldrel_out) - PARAMS ((bfd *, const struct internal_ldrel *, PTR)); + void (* _xcoff_swap_ldhdr_in) (bfd *, const void *, struct internal_ldhdr *); + void (* _xcoff_swap_ldhdr_out)(bfd *, const struct internal_ldhdr *, void *); + void (* _xcoff_swap_ldsym_in) (bfd *, const void *, struct internal_ldsym *); + void (* _xcoff_swap_ldsym_out)(bfd *, const struct internal_ldsym *, void *); + void (* _xcoff_swap_ldrel_in) (bfd *, const void *, struct internal_ldrel *); + void (* _xcoff_swap_ldrel_out)(bfd *, const struct internal_ldrel *, void *); /* Size of the external struct. */ unsigned int _xcoff_ldhdrsz; @@ -69,33 +63,29 @@ struct xcoff_backend_data_rec unsigned long _xcoff_ldhdr_version; bfd_boolean (* _xcoff_put_symbol_name) - PARAMS ((bfd *, struct bfd_strtab_hash *, struct internal_syment *, - const char *)); + (bfd *, struct bfd_strtab_hash *, struct internal_syment *, + const char *); bfd_boolean (* _xcoff_put_ldsymbol_name) - PARAMS ((bfd *, struct xcoff_loader_info *, struct internal_ldsym *, - const char *)); + (bfd *, struct xcoff_loader_info *, struct internal_ldsym *, + const char *); reloc_howto_type *_xcoff_dynamic_reloc; asection * (* _xcoff_create_csect_from_smclas) - PARAMS ((bfd *, union internal_auxent *, const char *)); + (bfd *, union internal_auxent *, const char *); /* Line number and relocation overflow. XCOFF32 overflows to another section when the line number or the relocation count exceeds 0xffff. XCOFF64 does not overflow. */ - bfd_boolean (*_xcoff_is_lineno_count_overflow) - PARAMS ((bfd *, bfd_vma)); - bfd_boolean (*_xcoff_is_reloc_count_overflow) - PARAMS ((bfd *, bfd_vma)); + bfd_boolean (*_xcoff_is_lineno_count_overflow) (bfd *, bfd_vma); + bfd_boolean (*_xcoff_is_reloc_count_overflow) (bfd *, bfd_vma); /* Loader section symbol and relocation table offset XCOFF32 is after the .loader header XCOFF64 is offset in .loader header. */ - bfd_vma (*_xcoff_loader_symbol_offset) - PARAMS ((bfd *, struct internal_ldhdr *)); - bfd_vma (*_xcoff_loader_reloc_offset) - PARAMS ((bfd *, struct internal_ldhdr *)); + bfd_vma (*_xcoff_loader_symbol_offset) (bfd *, struct internal_ldhdr *); + bfd_vma (*_xcoff_loader_reloc_offset) (bfd *, struct internal_ldhdr *); /* Global linkage. The first word of global linkage code must be be modified by filling in the correct TOC offset. */ @@ -107,7 +97,7 @@ struct xcoff_backend_data_rec /* rtinit. */ unsigned int _xcoff_rtinit_size; bfd_boolean (*_xcoff_generate_rtinit) - PARAMS ((bfd *, const char *, const char *, bfd_boolean)); + (bfd *, const char *, const char *, bfd_boolean); }; /* Look up an entry in an XCOFF link hash table. */ @@ -120,7 +110,7 @@ struct xcoff_backend_data_rec #define xcoff_link_hash_traverse(table, func, info) \ (bfd_link_hash_traverse \ (&(table)->root, \ - (bfd_boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \ + (bfd_boolean (*) (struct bfd_link_hash_entry *, void *)) (func), \ (info))) /* Get the XCOFF link hash table from the info structure. This is @@ -131,80 +121,80 @@ struct xcoff_backend_data_rec #define xcoff_backend(abfd) \ ((struct xcoff_backend_data_rec *) (abfd)->xvec->backend_data) -#define bfd_xcoff_magic_number(a) ((xcoff_backend(a)->_xcoff_magic_number)) -#define bfd_xcoff_architecture(a) ((xcoff_backend(a)->_xcoff_architecture)) -#define bfd_xcoff_machine(a) ((xcoff_backend(a)->_xcoff_machine)) +#define bfd_xcoff_magic_number(a) ((xcoff_backend (a)->_xcoff_magic_number)) +#define bfd_xcoff_architecture(a) ((xcoff_backend (a)->_xcoff_architecture)) +#define bfd_xcoff_machine(a) ((xcoff_backend (a)->_xcoff_machine)) #define bfd_xcoff_swap_ldhdr_in(a, b, c) \ - ((xcoff_backend(a)->_xcoff_swap_ldhdr_in) ((a), (b), (c))) + ((xcoff_backend (a)->_xcoff_swap_ldhdr_in) ((a), (b), (c))) #define bfd_xcoff_swap_ldhdr_out(a, b, c) \ - ((xcoff_backend(a)->_xcoff_swap_ldhdr_out) ((a), (b), (c))) + ((xcoff_backend (a)->_xcoff_swap_ldhdr_out) ((a), (b), (c))) #define bfd_xcoff_swap_ldsym_in(a, b, c) \ - ((xcoff_backend(a)->_xcoff_swap_ldsym_in) ((a), (b), (c))) + ((xcoff_backend (a)->_xcoff_swap_ldsym_in) ((a), (b), (c))) #define bfd_xcoff_swap_ldsym_out(a, b, c) \ - ((xcoff_backend(a)->_xcoff_swap_ldsym_out) ((a), (b), (c))) + ((xcoff_backend (a)->_xcoff_swap_ldsym_out) ((a), (b), (c))) #define bfd_xcoff_swap_ldrel_in(a, b, c) \ - ((xcoff_backend(a)->_xcoff_swap_ldrel_in) ((a), (b), (c))) + ((xcoff_backend (a)->_xcoff_swap_ldrel_in) ((a), (b), (c))) #define bfd_xcoff_swap_ldrel_out(a, b, c) \ - ((xcoff_backend(a)->_xcoff_swap_ldrel_out) ((a), (b), (c))) + ((xcoff_backend (a)->_xcoff_swap_ldrel_out) ((a), (b), (c))) -#define bfd_xcoff_ldhdrsz(a) ((xcoff_backend(a)->_xcoff_ldhdrsz)) -#define bfd_xcoff_ldsymsz(a) ((xcoff_backend(a)->_xcoff_ldsymsz)) -#define bfd_xcoff_ldrelsz(a) ((xcoff_backend(a)->_xcoff_ldrelsz)) +#define bfd_xcoff_ldhdrsz(a) ((xcoff_backend (a)->_xcoff_ldhdrsz)) +#define bfd_xcoff_ldsymsz(a) ((xcoff_backend (a)->_xcoff_ldsymsz)) +#define bfd_xcoff_ldrelsz(a) ((xcoff_backend (a)->_xcoff_ldrelsz)) #define bfd_xcoff_function_descriptor_size(a) \ - ((xcoff_backend(a)->_xcoff_function_descriptor_size)) + ((xcoff_backend (a)->_xcoff_function_descriptor_size)) #define bfd_xcoff_small_aout_header_size(a) \ - ((xcoff_backend(a)->_xcoff_small_aout_header_size)) + ((xcoff_backend (a)->_xcoff_small_aout_header_size)) -#define bfd_xcoff_ldhdr_version(a) ((xcoff_backend(a)->_xcoff_ldhdr_version)) +#define bfd_xcoff_ldhdr_version(a) ((xcoff_backend (a)->_xcoff_ldhdr_version)) #define bfd_xcoff_put_symbol_name(a, b, c, d) \ - ((xcoff_backend(a)->_xcoff_put_symbol_name) ((a), (b), (c), (d))) + ((xcoff_backend (a)->_xcoff_put_symbol_name) ((a), (b), (c), (d))) #define bfd_xcoff_put_ldsymbol_name(a, b, c, d) \ - ((xcoff_backend(a)->_xcoff_put_ldsymbol_name) ((a), (b), (c), (d))) + ((xcoff_backend (a)->_xcoff_put_ldsymbol_name) ((a), (b), (c), (d))) /* Get the XCOFF hash table entries for a BFD. */ #define obj_xcoff_sym_hashes(bfd) \ ((struct xcoff_link_hash_entry **) obj_coff_sym_hashes (bfd)) #define bfd_xcoff_dynamic_reloc_howto(a) \ - ((xcoff_backend(a)->_xcoff_dynamic_reloc)) + ((xcoff_backend (a)->_xcoff_dynamic_reloc)) #define bfd_xcoff_create_csect_from_smclas(a, b, c) \ - ((xcoff_backend(a)->_xcoff_create_csect_from_smclas((a), (b), (c)))) + ((xcoff_backend (a)->_xcoff_create_csect_from_smclas((a), (b), (c)))) #define bfd_xcoff_is_lineno_count_overflow(a, b) \ - ((xcoff_backend(a)->_xcoff_is_lineno_count_overflow((a), (b)))) + ((xcoff_backend (a)->_xcoff_is_lineno_count_overflow((a), (b)))) #define bfd_xcoff_is_reloc_count_overflow(a, b) \ - ((xcoff_backend(a)->_xcoff_is_reloc_count_overflow((a), (b)))) + ((xcoff_backend (a)->_xcoff_is_reloc_count_overflow((a), (b)))) #define bfd_xcoff_loader_symbol_offset(a, b) \ - ((xcoff_backend(a)->_xcoff_loader_symbol_offset((a), (b)))) + ((xcoff_backend (a)->_xcoff_loader_symbol_offset((a), (b)))) #define bfd_xcoff_loader_reloc_offset(a, b) \ - ((xcoff_backend(a)->_xcoff_loader_reloc_offset((a), (b)))) + ((xcoff_backend (a)->_xcoff_loader_reloc_offset((a), (b)))) -#define bfd_xcoff_glink_code(a, b) ((xcoff_backend(a)->_xcoff_glink_code[(b)])) -#define bfd_xcoff_glink_code_size(a) ((xcoff_backend(a)->_xcoff_glink_size)) +#define bfd_xcoff_glink_code(a, b) ((xcoff_backend (a)->_xcoff_glink_code[(b)])) +#define bfd_xcoff_glink_code_size(a) ((xcoff_backend (a)->_xcoff_glink_size)) /* Check for the magic number U803XTOCMAGIC or U64_TOCMAGIC for 64 bit targets. */ #define bfd_xcoff_is_xcoff64(a) \ - ( (0x01EF == (bfd_xcoff_magic_number(a))) \ - || (0x01F7 == (bfd_xcoff_magic_number(a)))) + ( (0x01EF == (bfd_xcoff_magic_number (a))) \ + || (0x01F7 == (bfd_xcoff_magic_number (a)))) /* Check for the magic number U802TOMAGIC for 32 bit targets. */ -#define bfd_xcoff_is_xcoff32(a) (0x01DF == (bfd_xcoff_magic_number(a))) +#define bfd_xcoff_is_xcoff32(a) (0x01DF == (bfd_xcoff_magic_number (a))) -#define bfd_xcoff_rtinit_size(a) ((xcoff_backend(a)->_xcoff_rtinit_size)) -#define bfd_xcoff_generate_rtinit(a, b, c, d) ((xcoff_backend(a)->_xcoff_generate_rtinit ((a), (b), (c), (d)))) +#define bfd_xcoff_rtinit_size(a) ((xcoff_backend (a)->_xcoff_rtinit_size)) +#define bfd_xcoff_generate_rtinit(a, b, c, d) ((xcoff_backend (a)->_xcoff_generate_rtinit ((a), (b), (c), (d)))) /* Accessor macros for tdata. */ #define bfd_xcoff_text_align_power(a) ((xcoff_data (a)->text_align_power)) @@ -228,18 +218,18 @@ struct xcoff_backend_data_rec bfd *, bfd_vma, bfd_vma, struct reloc_howto_struct *howto extern bfd_boolean (*xcoff_calculate_relocation[XCOFF_MAX_CALCULATE_RELOCATION]) - PARAMS ((XCOFF_RELOC_FUNCTION_ARGS)); + (XCOFF_RELOC_FUNCTION_ARGS); extern bfd_boolean (*xcoff_complain_overflow[XCOFF_MAX_COMPLAIN_OVERFLOW]) - PARAMS ((XCOFF_COMPLAIN_FUNCTION_ARGS)); + (XCOFF_COMPLAIN_FUNCTION_ARGS); /* Relocation functions */ -bfd_boolean xcoff_reloc_type_noop PARAMS ((XCOFF_RELOC_FUNCTION_ARGS)); -bfd_boolean xcoff_reloc_type_fail PARAMS ((XCOFF_RELOC_FUNCTION_ARGS)); -bfd_boolean xcoff_reloc_type_pos PARAMS ((XCOFF_RELOC_FUNCTION_ARGS)); -bfd_boolean xcoff_reloc_type_neg PARAMS ((XCOFF_RELOC_FUNCTION_ARGS)); -bfd_boolean xcoff_reloc_type_rel PARAMS ((XCOFF_RELOC_FUNCTION_ARGS)); -bfd_boolean xcoff_reloc_type_toc PARAMS ((XCOFF_RELOC_FUNCTION_ARGS)); -bfd_boolean xcoff_reloc_type_ba PARAMS ((XCOFF_RELOC_FUNCTION_ARGS)); -bfd_boolean xcoff_reloc_type_crel PARAMS ((XCOFF_RELOC_FUNCTION_ARGS)); +bfd_boolean xcoff_reloc_type_noop (XCOFF_RELOC_FUNCTION_ARGS); +bfd_boolean xcoff_reloc_type_fail (XCOFF_RELOC_FUNCTION_ARGS); +bfd_boolean xcoff_reloc_type_pos (XCOFF_RELOC_FUNCTION_ARGS); +bfd_boolean xcoff_reloc_type_neg (XCOFF_RELOC_FUNCTION_ARGS); +bfd_boolean xcoff_reloc_type_rel (XCOFF_RELOC_FUNCTION_ARGS); +bfd_boolean xcoff_reloc_type_toc (XCOFF_RELOC_FUNCTION_ARGS); +bfd_boolean xcoff_reloc_type_ba (XCOFF_RELOC_FUNCTION_ARGS); +bfd_boolean xcoff_reloc_type_crel (XCOFF_RELOC_FUNCTION_ARGS); #endif /* LIBXCOFF_H */ diff --git a/contrib/binutils/bfd/linker.c b/contrib/binutils/bfd/linker.c index 58befc3632e..14eeae4df0c 100644 --- a/contrib/binutils/bfd/linker.c +++ b/contrib/binutils/bfd/linker.c @@ -1,6 +1,6 @@ /* linker.c -- BFD linker routines Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003, 2004 Free Software Foundation, Inc. + 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Written by Steve Chamberlain and Ian Lance Taylor, Cygnus Support This file is part of BFD, the Binary File Descriptor library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" @@ -309,7 +309,7 @@ SUBSUBSECTION of the <> structure. Each section in the output file will have a list of - <> structures attached to the <> + <> structures attached to the <> field (the <> structure is defined in <>). These structures describe how to create the contents of the output section in terms of the contents of @@ -455,7 +455,9 @@ _bfd_link_hash_newfunc (struct bfd_hash_entry *entry, /* Initialize the local fields. */ h->type = bfd_link_hash_new; - h->und_next = NULL; + memset (&h->u.undef.next, 0, + (sizeof (struct bfd_link_hash_entry) + - offsetof (struct bfd_link_hash_entry, u.undef.next))); } return entry; @@ -470,14 +472,15 @@ _bfd_link_hash_table_init bfd *abfd, struct bfd_hash_entry *(*newfunc) (struct bfd_hash_entry *, struct bfd_hash_table *, - const char *)) + const char *), + unsigned int entsize) { table->creator = abfd->xvec; table->undefs = NULL; table->undefs_tail = NULL; table->type = bfd_link_generic_hash_table; - return bfd_hash_table_init (&table->table, newfunc); + return bfd_hash_table_init (&table->table, newfunc, entsize); } /* Look up a symbol in a link hash table. If follow is TRUE, we @@ -616,13 +619,52 @@ void bfd_link_add_undef (struct bfd_link_hash_table *table, struct bfd_link_hash_entry *h) { - BFD_ASSERT (h->und_next == NULL); + BFD_ASSERT (h->u.undef.next == NULL); if (table->undefs_tail != NULL) - table->undefs_tail->und_next = h; + table->undefs_tail->u.undef.next = h; if (table->undefs == NULL) table->undefs = h; table->undefs_tail = h; } + +/* The undefs list was designed so that in normal use we don't need to + remove entries. However, if symbols on the list are changed from + bfd_link_hash_undefined to either bfd_link_hash_undefweak or + bfd_link_hash_new for some reason, then they must be removed from the + list. Failure to do so might result in the linker attempting to add + the symbol to the list again at a later stage. */ + +void +bfd_link_repair_undef_list (struct bfd_link_hash_table *table) +{ + struct bfd_link_hash_entry **pun; + + pun = &table->undefs; + while (*pun != NULL) + { + struct bfd_link_hash_entry *h = *pun; + + if (h->type == bfd_link_hash_new + || h->type == bfd_link_hash_undefweak) + { + *pun = h->u.undef.next; + h->u.undef.next = NULL; + if (h == table->undefs_tail) + { + if (pun == &table->undefs) + table->undefs_tail = NULL; + else + /* pun points at an u.undef.next field. Go back to + the start of the link_hash_entry. */ + table->undefs_tail = (struct bfd_link_hash_entry *) + ((char *) pun - ((char *) &h->u.undef.next - (char *) h)); + break; + } + } + else + pun = &h->u.undef.next; + } +} /* Routine to create an entry in a generic link hash table. */ @@ -668,7 +710,8 @@ _bfd_generic_link_hash_table_create (bfd *abfd) if (ret == NULL) return NULL; if (! _bfd_link_hash_table_init (&ret->root, abfd, - _bfd_generic_link_hash_newfunc)) + _bfd_generic_link_hash_newfunc, + sizeof (struct generic_link_hash_entry))) { free (ret); return NULL; @@ -860,9 +903,10 @@ archive_hash_table_init (struct archive_hash_table *table, struct bfd_hash_entry *(*newfunc) (struct bfd_hash_entry *, struct bfd_hash_table *, - const char *)) + const char *), + unsigned int entsize) { - return bfd_hash_table_init (&table->table, newfunc); + return bfd_hash_table_init (&table->table, newfunc, entsize); } /* Look up an entry in an archive hash table. */ @@ -940,7 +984,8 @@ _bfd_generic_link_add_archive_symbols /* In order to quickly determine whether an symbol is defined in this archive, we build a hash table of the symbols. */ - if (! archive_hash_table_init (&arsym_hash, archive_hash_newfunc)) + if (! archive_hash_table_init (&arsym_hash, archive_hash_newfunc, + sizeof (struct archive_hash_entry))) return FALSE; for (arsym = arsyms, indx = 0; arsym < arsym_end; arsym++, indx++) { @@ -990,9 +1035,9 @@ _bfd_generic_link_add_archive_symbols us to lose track of whether the symbol has been referenced). */ if (*pundef != info->hash->undefs_tail) - *pundef = (*pundef)->und_next; + *pundef = (*pundef)->u.undef.next; else - pundef = &(*pundef)->und_next; + pundef = &(*pundef)->u.undef.next; continue; } @@ -1015,7 +1060,7 @@ _bfd_generic_link_add_archive_symbols } if (arh == NULL) { - pundef = &(*pundef)->und_next; + pundef = &(*pundef)->u.undef.next; continue; } } @@ -1064,7 +1109,7 @@ _bfd_generic_link_add_archive_symbols } } - pundef = &(*pundef)->und_next; + pundef = &(*pundef)->u.undef.next; } archive_hash_table_free (&arsym_hash); @@ -1565,6 +1610,7 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info, /* Make a new weak undefined symbol. */ h->type = bfd_link_hash_undefweak; h->u.undef.abfd = abfd; + h->u.undef.weak = abfd; break; case CDEF: @@ -1694,8 +1740,8 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info, case REF: /* A reference to a defined symbol. */ - if (h->und_next == NULL && info->hash->undefs_tail != h) - h->und_next = h; + if (h->u.undef.next == NULL && info->hash->undefs_tail != h) + h->u.undef.next = h; break; case BIG: @@ -1828,8 +1874,8 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info, && inh->u.i.link == h) { (*_bfd_error_handler) - (_("%s: indirect symbol `%s' to `%s' is a loop"), - bfd_archive_filename (abfd), name, string); + (_("%B: indirect symbol `%s' to `%s' is a loop"), + abfd, name, string); bfd_set_error (bfd_error_invalid_operation); return FALSE; } @@ -1881,8 +1927,8 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info, case REFC: /* A reference to an indirect symbol. */ - if (h->und_next == NULL && info->hash->undefs_tail != h) - h->und_next = h; + if (h->u.undef.next == NULL && info->hash->undefs_tail != h) + h->u.undef.next = h; h = h->u.i.link; cycle = TRUE; break; @@ -1897,10 +1943,10 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info, case CWARN: /* Warn if this symbol has been referenced already, otherwise add a warning. A symbol has been referenced if - the und_next field is not NULL, or it is the tail of the + the u.undef.next field is not NULL, or it is the tail of the undefined symbol list. The REF case above helps to ensure this. */ - if (h->und_next != NULL || info->hash->undefs_tail == h) + if (h->u.undef.next != NULL || info->hash->undefs_tail == h) { if (! (*info->callbacks->warning) (info, string, h->root.string, hash_entry_bfd (h), NULL, 0)) @@ -1967,7 +2013,7 @@ _bfd_generic_final_link (bfd *abfd, struct bfd_link_info *info) /* Mark all sections which will be included in the output file. */ for (o = abfd->sections; o != NULL; o = o->next) - for (p = o->link_order_head; p != NULL; p = p->next) + for (p = o->map_head.link_order; p != NULL; p = p->next) if (p->type == bfd_indirect_link_order) p->u.indirect.section->linker_mark = TRUE; @@ -1996,7 +2042,7 @@ _bfd_generic_final_link (bfd *abfd, struct bfd_link_info *info) for (o = abfd->sections; o != NULL; o = o->next) { o->reloc_count = 0; - for (p = o->link_order_head; p != NULL; p = p->next) + for (p = o->map_head.link_order; p != NULL; p = p->next) { if (p->type == bfd_section_reloc_link_order || p->type == bfd_symbol_reloc_link_order) @@ -2052,7 +2098,7 @@ _bfd_generic_final_link (bfd *abfd, struct bfd_link_info *info) /* Handle all the link order information for the sections. */ for (o = abfd->sections; o != NULL; o = o->next) { - for (p = o->link_order_head; p != NULL; p = p->next) + for (p = o->map_head.link_order; p != NULL; p = p->next) { switch (p->type) { @@ -2321,12 +2367,11 @@ _bfd_generic_link_output_symbols (bfd *output_bfd, abort (); /* If this symbol is in a section which is not being included - in the output file, then we don't want to output the symbol. - - Gross. .bss and similar sections won't have the linker_mark - field set. */ - if ((sym->section->flags & SEC_HAS_CONTENTS) != 0 - && ! sym->section->linker_mark) + in the output file, then we don't want to output the + symbol. */ + if (!bfd_is_abs_section (sym->section) + && bfd_section_removed_from_list (output_bfd, + sym->section->output_section)) output = FALSE; if (output) @@ -2529,7 +2574,7 @@ _bfd_generic_reloc_link_order (bfd *abfd, abort (); case bfd_reloc_overflow: if (! ((*info->callbacks->reloc_overflow) - (info, + (info, NULL, (link_order->type == bfd_section_reloc_link_order ? bfd_section_name (abfd, link_order->u.reloc.p->u.section) : link_order->u.reloc.p->u.name), @@ -2570,11 +2615,11 @@ bfd_new_link_order (bfd *abfd, asection *section) new->type = bfd_undefined_link_order; - if (section->link_order_tail != NULL) - section->link_order_tail->next = new; + if (section->map_tail.link_order != NULL) + section->map_tail.link_order->next = new; else - section->link_order_head = new; - section->link_order_tail = new; + section->map_head.link_order = new; + section->map_tail.link_order = new; return new; } @@ -2676,15 +2721,14 @@ default_indirect_link_order (bfd *output_bfd, BFD_ASSERT ((output_section->flags & SEC_HAS_CONTENTS) != 0); - if (link_order->size == 0) - return TRUE; - input_section = link_order->u.indirect.section; input_bfd = input_section->owner; + if (input_section->size == 0) + return TRUE; BFD_ASSERT (input_section->output_section == output_section); BFD_ASSERT (input_section->output_offset == link_order->offset); - BFD_ASSERT (input_section->_cooked_size == link_order->size); + BFD_ASSERT (input_section->size == link_order->size); if (info->relocatable && input_section->reloc_count > 0 @@ -2756,7 +2800,9 @@ default_indirect_link_order (bfd *output_bfd, } /* Get and relocate the section contents. */ - sec_size = bfd_section_size (input_bfd, input_section); + sec_size = (input_section->rawsize > input_section->size + ? input_section->rawsize + : input_section->size); contents = bfd_malloc (sec_size); if (contents == NULL && sec_size != 0) goto error_return; @@ -2767,9 +2813,9 @@ default_indirect_link_order (bfd *output_bfd, goto error_return; /* Output the section contents. */ - loc = link_order->offset * bfd_octets_per_byte (output_bfd); + loc = input_section->output_offset * bfd_octets_per_byte (output_bfd); if (! bfd_set_section_contents (output_bfd, output_section, - new_contents, loc, link_order->size)) + new_contents, loc, input_section->size)) goto error_return; if (contents != NULL) @@ -2825,3 +2871,238 @@ _bfd_generic_link_split_section (bfd *abfd ATTRIBUTE_UNUSED, { return FALSE; } + +/* +FUNCTION + bfd_section_already_linked + +SYNOPSIS + void bfd_section_already_linked (bfd *abfd, asection *sec); + +DESCRIPTION + Check if @var{sec} has been already linked during a reloceatable + or final link. + +.#define bfd_section_already_linked(abfd, sec) \ +. BFD_SEND (abfd, _section_already_linked, (abfd, sec)) +. + +*/ + +/* Sections marked with the SEC_LINK_ONCE flag should only be linked + once into the output. This routine checks each section, and + arrange to discard it if a section of the same name has already + been linked. This code assumes that all relevant sections have the + SEC_LINK_ONCE flag set; that is, it does not depend solely upon the + section name. bfd_section_already_linked is called via + bfd_map_over_sections. */ + +/* The hash table. */ + +static struct bfd_hash_table _bfd_section_already_linked_table; + +/* Support routines for the hash table used by section_already_linked, + initialize the table, traverse, lookup, fill in an entry and remove + the table. */ + +void +bfd_section_already_linked_table_traverse + (bfd_boolean (*func) (struct bfd_section_already_linked_hash_entry *, + void *), void *info) +{ + bfd_hash_traverse (&_bfd_section_already_linked_table, + (bfd_boolean (*) (struct bfd_hash_entry *, + void *)) func, + info); +} + +struct bfd_section_already_linked_hash_entry * +bfd_section_already_linked_table_lookup (const char *name) +{ + return ((struct bfd_section_already_linked_hash_entry *) + bfd_hash_lookup (&_bfd_section_already_linked_table, name, + TRUE, FALSE)); +} + +void +bfd_section_already_linked_table_insert + (struct bfd_section_already_linked_hash_entry *already_linked_list, + asection *sec) +{ + struct bfd_section_already_linked *l; + + /* Allocate the memory from the same obstack as the hash table is + kept in. */ + l = bfd_hash_allocate (&_bfd_section_already_linked_table, sizeof *l); + l->sec = sec; + l->next = already_linked_list->entry; + already_linked_list->entry = l; +} + +static struct bfd_hash_entry * +already_linked_newfunc (struct bfd_hash_entry *entry ATTRIBUTE_UNUSED, + struct bfd_hash_table *table, + const char *string ATTRIBUTE_UNUSED) +{ + struct bfd_section_already_linked_hash_entry *ret = + bfd_hash_allocate (table, sizeof *ret); + + ret->entry = NULL; + + return &ret->root; +} + +bfd_boolean +bfd_section_already_linked_table_init (void) +{ + return bfd_hash_table_init_n (&_bfd_section_already_linked_table, + already_linked_newfunc, + sizeof (struct bfd_section_already_linked_hash_entry), + 42); +} + +void +bfd_section_already_linked_table_free (void) +{ + bfd_hash_table_free (&_bfd_section_already_linked_table); +} + +/* This is used on non-ELF inputs. */ + +void +_bfd_generic_section_already_linked (bfd *abfd, asection *sec) +{ + flagword flags; + const char *name; + struct bfd_section_already_linked *l; + struct bfd_section_already_linked_hash_entry *already_linked_list; + + flags = sec->flags; + if ((flags & SEC_LINK_ONCE) == 0) + return; + + /* FIXME: When doing a relocatable link, we may have trouble + copying relocations in other sections that refer to local symbols + in the section being discarded. Those relocations will have to + be converted somehow; as of this writing I'm not sure that any of + the backends handle that correctly. + + It is tempting to instead not discard link once sections when + doing a relocatable link (technically, they should be discarded + whenever we are building constructors). However, that fails, + because the linker winds up combining all the link once sections + into a single large link once section, which defeats the purpose + of having link once sections in the first place. */ + + name = bfd_get_section_name (abfd, sec); + + already_linked_list = bfd_section_already_linked_table_lookup (name); + + for (l = already_linked_list->entry; l != NULL; l = l->next) + { + bfd_boolean skip = FALSE; + struct coff_comdat_info *s_comdat + = bfd_coff_get_comdat_section (abfd, sec); + struct coff_comdat_info *l_comdat + = bfd_coff_get_comdat_section (l->sec->owner, l->sec); + + /* We may have 3 different sections on the list: group section, + comdat section and linkonce section. SEC may be a linkonce or + comdat section. We always ignore group section. For non-COFF + inputs, we also ignore comdat section. + + FIXME: Is that safe to match a linkonce section with a comdat + section for COFF inputs? */ + if ((l->sec->flags & SEC_GROUP) != 0) + skip = TRUE; + else if (bfd_get_flavour (abfd) == bfd_target_coff_flavour) + { + if (s_comdat != NULL + && l_comdat != NULL + && strcmp (s_comdat->name, l_comdat->name) != 0) + skip = TRUE; + } + else if (l_comdat != NULL) + skip = TRUE; + + if (!skip) + { + /* The section has already been linked. See if we should + issue a warning. */ + switch (flags & SEC_LINK_DUPLICATES) + { + default: + abort (); + + case SEC_LINK_DUPLICATES_DISCARD: + break; + + case SEC_LINK_DUPLICATES_ONE_ONLY: + (*_bfd_error_handler) + (_("%B: warning: ignoring duplicate section `%A'\n"), + abfd, sec); + break; + + case SEC_LINK_DUPLICATES_SAME_CONTENTS: + /* FIXME: We should really dig out the contents of both + sections and memcmp them. The COFF/PE spec says that + the Microsoft linker does not implement this + correctly, so I'm not going to bother doing it + either. */ + /* Fall through. */ + case SEC_LINK_DUPLICATES_SAME_SIZE: + if (sec->size != l->sec->size) + (*_bfd_error_handler) + (_("%B: warning: duplicate section `%A' has different size\n"), + abfd, sec); + break; + } + + /* Set the output_section field so that lang_add_section + does not create a lang_input_section structure for this + section. Since there might be a symbol in the section + being discarded, we must retain a pointer to the section + which we are really going to use. */ + sec->output_section = bfd_abs_section_ptr; + sec->kept_section = l->sec; + + return; + } + } + + /* This is the first section with this name. Record it. */ + bfd_section_already_linked_table_insert (already_linked_list, sec); +} + +/* Convert symbols in excluded output sections to absolute. */ + +static bfd_boolean +fix_syms (struct bfd_link_hash_entry *h, void *data) +{ + bfd *obfd = (bfd *) data; + + if (h->type == bfd_link_hash_warning) + h = h->u.i.link; + + if (h->type == bfd_link_hash_defined + || h->type == bfd_link_hash_defweak) + { + asection *s = h->u.def.section; + if (s != NULL + && s->output_section != NULL + && (s->output_section->flags & SEC_EXCLUDE) != 0 + && bfd_section_removed_from_list (obfd, s->output_section)) + { + h->u.def.value += s->output_offset + s->output_section->vma; + h->u.def.section = bfd_abs_section_ptr; + } + } + + return TRUE; +} + +void +_bfd_fix_excluded_sec_syms (bfd *obfd, struct bfd_link_info *info) +{ + bfd_link_hash_traverse (info->hash, fix_syms, obfd); +} diff --git a/contrib/binutils/bfd/merge.c b/contrib/binutils/bfd/merge.c index 89f45cd521a..c1795d29112 100644 --- a/contrib/binutils/bfd/merge.c +++ b/contrib/binutils/bfd/merge.c @@ -1,5 +1,6 @@ /* SEC_MERGE support. - Copyright 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. Written by Jakub Jelinek . This file is part of BFD, the Binary File Descriptor library. @@ -16,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* This file contains support for merging duplicate entities within sections, as used in ELF SHF_MERGE. */ @@ -90,7 +91,7 @@ struct sec_merge_sec_info /* A hash table used to hold section content. */ struct sec_merge_hash *htab; /* First string in this section. */ - struct sec_merge_hash_entry *first; + struct sec_merge_hash_entry *first_str; /* Original section content. */ unsigned char contents[1]; }; @@ -102,30 +103,28 @@ static struct bfd_hash_entry * sec_merge_hash_newfunc (struct bfd_hash_entry *entry, struct bfd_hash_table *table, const char *string) { - struct sec_merge_hash_entry *ret = (struct sec_merge_hash_entry *) entry; - /* Allocate the structure if it has not already been allocated by a subclass. */ - if (ret == (struct sec_merge_hash_entry *) NULL) - ret = ((struct sec_merge_hash_entry *) - bfd_hash_allocate (table, sizeof (struct sec_merge_hash_entry))); - if (ret == (struct sec_merge_hash_entry *) NULL) + if (entry == NULL) + entry = bfd_hash_allocate (table, sizeof (struct sec_merge_hash_entry)); + if (entry == NULL) return NULL; /* Call the allocation method of the superclass. */ - ret = ((struct sec_merge_hash_entry *) - bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string)); + entry = bfd_hash_newfunc (entry, table, string); - if (ret) + if (entry != NULL) { /* Initialize the local fields. */ + struct sec_merge_hash_entry *ret = (struct sec_merge_hash_entry *) entry; + ret->u.suffix = NULL; ret->alignment = 0; ret->secinfo = NULL; ret->next = NULL; } - return (struct bfd_hash_entry *) ret; + return entry; } /* Look up an entry in a section merge hash table. */ @@ -192,7 +191,7 @@ sec_merge_hash_lookup (struct sec_merge_hash *table, const char *string, index = hash % table->table.size; for (hashp = (struct sec_merge_hash_entry *) table->table.table[index]; - hashp != (struct sec_merge_hash_entry *) NULL; + hashp != NULL; hashp = (struct sec_merge_hash_entry *) hashp->root.next) { if (hashp->root.hash == hash @@ -216,13 +215,12 @@ sec_merge_hash_lookup (struct sec_merge_hash *table, const char *string, } if (! create) - return (struct sec_merge_hash_entry *) NULL; + return NULL; - hashp = (struct sec_merge_hash_entry *) - sec_merge_hash_newfunc ((struct bfd_hash_entry *) NULL, - (struct bfd_hash_table *) table, string); - if (hashp == (struct sec_merge_hash_entry *) NULL) - return (struct sec_merge_hash_entry *) NULL; + hashp = ((struct sec_merge_hash_entry *) + sec_merge_hash_newfunc (NULL, &table->table, string)); + if (hashp == NULL) + return NULL; hashp->root.string = string; hashp->root.hash = hash; hashp->len = len; @@ -239,13 +237,13 @@ static struct sec_merge_hash * sec_merge_init (unsigned int entsize, bfd_boolean strings) { struct sec_merge_hash *table; - bfd_size_type amt = sizeof (struct sec_merge_hash); - table = (struct sec_merge_hash *) bfd_malloc (amt); + table = bfd_malloc (sizeof (struct sec_merge_hash)); if (table == NULL) return NULL; - if (! bfd_hash_table_init (&table->table, sec_merge_hash_newfunc)) + if (! bfd_hash_table_init_n (&table->table, sec_merge_hash_newfunc, + sizeof (struct sec_merge_hash_entry), 16699)) { free (table); return NULL; @@ -292,56 +290,73 @@ sec_merge_emit (bfd *abfd, struct sec_merge_hash_entry *entry) { struct sec_merge_sec_info *secinfo = entry->secinfo; asection *sec = secinfo->sec; - char *pad = ""; + char *pad = NULL; bfd_size_type off = 0; - int alignment_power = bfd_get_section_alignment (abfd, sec->output_section); + int alignment_power = sec->output_section->alignment_power; if (alignment_power) - pad = bfd_zmalloc ((bfd_size_type) 1 << alignment_power); + { + pad = bfd_zmalloc ((bfd_size_type) 1 << alignment_power); + if (pad == NULL) + return FALSE; + } for (; entry != NULL && entry->secinfo == secinfo; entry = entry->next) { - register const char *str; - register size_t len; + const char *str; + bfd_size_type len; - len = off & (entry->alignment - 1); - if (len) + len = -off & (entry->alignment - 1); + if (len != 0) { - len = entry->alignment - len; - if (bfd_bwrite (pad, (bfd_size_type) len, abfd) != len) - break; + if (bfd_bwrite (pad, len, abfd) != len) + goto err; off += len; } str = entry->root.string; len = entry->len; - if (bfd_bwrite (str, (bfd_size_type) len, abfd) != len) - break; + if (bfd_bwrite (str, len, abfd) != len) + goto err; off += len; } - if (alignment_power) - free (pad); + /* Trailing alignment needed? */ + off = sec->size - off; + if (off != 0 + && bfd_bwrite (pad, off, abfd) != off) + goto err; - return entry == NULL || entry->secinfo != secinfo; + if (pad != NULL) + free (pad); + return TRUE; + + err: + if (pad != NULL) + free (pad); + return FALSE; } -/* This function is called for each input file from the add_symbols - pass of the linker. */ +/* Register a SEC_MERGE section as a candidate for merging. + This function is called for all non-dynamic SEC_MERGE input sections. */ bfd_boolean -_bfd_merge_section (bfd *abfd, void **psinfo, asection *sec, void **psecinfo) +_bfd_add_merge_section (bfd *abfd, void **psinfo, asection *sec, + void **psecinfo) { struct sec_merge_info *sinfo; struct sec_merge_sec_info *secinfo; unsigned int align; bfd_size_type amt; - if (sec->_raw_size == 0 - || (sec->flags & SEC_EXCLUDE) - || (sec->flags & SEC_MERGE) == 0 + if ((abfd->flags & DYNAMIC) != 0 + || (sec->flags & SEC_MERGE) == 0) + abort (); + + if (sec->size == 0 + || (sec->flags & SEC_EXCLUDE) != 0 || sec->entsize == 0) return TRUE; @@ -351,12 +366,12 @@ _bfd_merge_section (bfd *abfd, void **psinfo, asection *sec, void **psecinfo) return TRUE; } - align = bfd_get_section_alignment (sec->owner, sec); - if ((sec->entsize < (unsigned int)(1 << align) + align = sec->alignment_power; + if ((sec->entsize < (unsigned) 1 << align && ((sec->entsize & (sec->entsize - 1)) || !(sec->flags & SEC_STRINGS))) - || (sec->entsize > (unsigned int)(1 << align) - && (sec->entsize & ((1 << align) - 1)))) + || (sec->entsize > (unsigned) 1 << align + && (sec->entsize & (((unsigned) 1 << align) - 1)))) { /* Sanity check. If string character size is smaller than alignment, then we require character size to be a power @@ -371,14 +386,14 @@ _bfd_merge_section (bfd *abfd, void **psinfo, asection *sec, void **psecinfo) if ((secinfo = sinfo->chain) && ! ((secinfo->sec->flags ^ sec->flags) & (SEC_MERGE | SEC_STRINGS)) && secinfo->sec->entsize == sec->entsize - && ! strcmp (secinfo->sec->name, sec->name)) + && secinfo->sec->alignment_power == sec->alignment_power + && secinfo->sec->output_section == sec->output_section) break; if (sinfo == NULL) { /* Initialize the information we need to keep track of. */ - amt = sizeof (struct sec_merge_info); - sinfo = (struct sec_merge_info *) bfd_alloc (abfd, amt); + sinfo = bfd_alloc (abfd, sizeof (struct sec_merge_info)); if (sinfo == NULL) goto error_return; sinfo->next = (struct sec_merge_info *) *psinfo; @@ -391,12 +406,12 @@ _bfd_merge_section (bfd *abfd, void **psinfo, asection *sec, void **psecinfo) /* Read the section from abfd. */ - amt = sizeof (struct sec_merge_sec_info) + sec->_raw_size - 1; + amt = sizeof (struct sec_merge_sec_info) + sec->size - 1; *psecinfo = bfd_alloc (abfd, amt); if (*psecinfo == NULL) goto error_return; - secinfo = (struct sec_merge_sec_info *)*psecinfo; + secinfo = (struct sec_merge_sec_info *) *psecinfo; if (sinfo->chain) { secinfo->next = sinfo->chain->next; @@ -408,10 +423,11 @@ _bfd_merge_section (bfd *abfd, void **psinfo, asection *sec, void **psecinfo) secinfo->sec = sec; secinfo->psecinfo = psecinfo; secinfo->htab = sinfo->htab; - secinfo->first = NULL; + secinfo->first_str = NULL; + sec->rawsize = sec->size; if (! bfd_get_section_contents (sec->owner, sec, secinfo->contents, - (bfd_vma) 0, sec->_raw_size)) + 0, sec->size)) goto error_return; return TRUE; @@ -433,8 +449,8 @@ record_section (struct sec_merge_info *sinfo, bfd_vma mask, eltalign; unsigned int align, i; - align = bfd_get_section_alignment (sec->owner, sec); - end = secinfo->contents + sec->_raw_size; + align = sec->alignment_power; + end = secinfo->contents + sec->size; nul = FALSE; mask = ((bfd_vma) 1 << align) - 1; if (sec->flags & SEC_STRINGS) @@ -445,7 +461,8 @@ record_section (struct sec_merge_info *sinfo, eltalign = ((eltalign ^ (eltalign - 1)) + 1) >> 1; if (!eltalign || eltalign > mask) eltalign = mask + 1; - entry = sec_merge_add (sinfo->htab, p, (unsigned) eltalign, secinfo); + entry = sec_merge_add (sinfo->htab, (char *) p, (unsigned) eltalign, + secinfo); if (! entry) goto error_return; p += entry->len; @@ -476,7 +493,7 @@ record_section (struct sec_merge_info *sinfo, if (!nul && !((p - secinfo->contents) & mask)) { nul = TRUE; - entry = sec_merge_add (sinfo->htab, p, + entry = sec_merge_add (sinfo->htab, (char *) p, (unsigned) mask + 1, secinfo); if (! entry) goto error_return; @@ -490,7 +507,7 @@ record_section (struct sec_merge_info *sinfo, { for (p = secinfo->contents; p < end; p += sec->entsize) { - entry = sec_merge_add (sinfo->htab, p, 1, secinfo); + entry = sec_merge_add (sinfo->htab, (char *) p, 1, secinfo); if (! entry) goto error_return; } @@ -511,8 +528,8 @@ strrevcmp (const void *a, const void *b) struct sec_merge_hash_entry *B = *(struct sec_merge_hash_entry **) b; unsigned int lenA = A->len; unsigned int lenB = B->len; - const unsigned char *s = A->root.string + lenA - 1; - const unsigned char *t = B->root.string + lenB - 1; + const unsigned char *s = (const unsigned char *) A->root.string + lenA - 1; + const unsigned char *t = (const unsigned char *) B->root.string + lenB - 1; int l = lenA < lenB ? lenA : lenB; while (l) @@ -536,8 +553,8 @@ strrevcmp_align (const void *a, const void *b) struct sec_merge_hash_entry *B = *(struct sec_merge_hash_entry **) b; unsigned int lenA = A->len; unsigned int lenB = B->len; - const unsigned char *s = A->root.string + lenA - 1; - const unsigned char *t = B->root.string + lenB - 1; + const unsigned char *s = (const unsigned char *) A->root.string + lenA - 1; + const unsigned char *t = (const unsigned char *) B->root.string + lenB - 1; int l = lenA < lenB ? lenA : lenB; int tail_align = (lenA & (A->alignment - 1)) - (lenB & (A->alignment - 1)); @@ -580,7 +597,7 @@ merge_strings (struct sec_merge_info *sinfo) /* Now sort the strings */ amt = sinfo->htab->size * sizeof (struct sec_merge_hash_entry *); - array = (struct sec_merge_hash_entry **) bfd_malloc (amt); + array = bfd_malloc (amt); if (array == NULL) goto alloc_failure; @@ -638,14 +655,14 @@ alloc_failure: { if (e->secinfo != secinfo) { - secinfo->sec->_cooked_size = size; + secinfo->sec->size = size; secinfo = e->secinfo; } if (e->alignment) { - if (e->secinfo->first == NULL) + if (e->secinfo->first_str == NULL) { - e->secinfo->first = e; + e->secinfo->first_str = e; size = 0; } size = (size + e->alignment - 1) & ~((bfd_vma) e->alignment - 1); @@ -653,7 +670,12 @@ alloc_failure: size += e->len; } } - secinfo->sec->_cooked_size = size; + secinfo->sec->size = size; + if (secinfo->sec->alignment_power != 0) + { + bfd_size_type align = (bfd_size_type) 1 << secinfo->sec->alignment_power; + secinfo->sec->size = (secinfo->sec->size + align - 1) & -align; + } /* And now adjust the rest, removing them from the chain (but not hashtable) at the same time. */ @@ -676,7 +698,9 @@ alloc_failure: with _bfd_merge_section. */ bfd_boolean -_bfd_merge_sections (bfd *abfd ATTRIBUTE_UNUSED, void *xsinfo, +_bfd_merge_sections (bfd *abfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info ATTRIBUTE_UNUSED, + void *xsinfo, void (*remove_hook) (bfd *, asection *)) { struct sec_merge_info *sinfo; @@ -722,11 +746,11 @@ _bfd_merge_sections (bfd *abfd ATTRIBUTE_UNUSED, void *xsinfo, secinfo = NULL; for (e = sinfo->htab->first; e; e = e->next) { - if (e->secinfo->first == NULL) + if (e->secinfo->first_str == NULL) { if (secinfo) - secinfo->sec->_cooked_size = size; - e->secinfo->first = e; + secinfo->sec->size = size; + e->secinfo->first_str = e; size = 0; } size = (size + e->alignment - 1) @@ -735,17 +759,14 @@ _bfd_merge_sections (bfd *abfd ATTRIBUTE_UNUSED, void *xsinfo, size += e->len; secinfo = e->secinfo; } - secinfo->sec->_cooked_size = size; + secinfo->sec->size = size; } /* Finally remove all input sections which have not made it into the hash table at all. */ for (secinfo = sinfo->chain; secinfo; secinfo = secinfo->next) - if (secinfo->first == NULL) - { - secinfo->sec->_cooked_size = 0; - secinfo->sec->flags |= SEC_EXCLUDE; - } + if (secinfo->first_str == NULL) + secinfo->sec->flags |= SEC_EXCLUDE; } return TRUE; @@ -761,14 +782,14 @@ _bfd_write_merged_section (bfd *output_bfd, asection *sec, void *psecinfo) secinfo = (struct sec_merge_sec_info *) psecinfo; - if (!secinfo->first) + if (secinfo->first_str == NULL) return TRUE; pos = sec->output_section->filepos + sec->output_offset; if (bfd_seek (output_bfd, pos, SEEK_SET) != 0) return FALSE; - if (! sec_merge_emit (output_bfd, secinfo->first)) + if (! sec_merge_emit (output_bfd, secinfo->first_str)) return FALSE; return TRUE; @@ -780,7 +801,7 @@ _bfd_write_merged_section (bfd *output_bfd, asection *sec, void *psecinfo) bfd_vma _bfd_merged_section_offset (bfd *output_bfd ATTRIBUTE_UNUSED, asection **psec, - void *psecinfo, bfd_vma offset, bfd_vma addend) + void *psecinfo, bfd_vma offset) { struct sec_merge_sec_info *secinfo; struct sec_merge_hash_entry *entry; @@ -789,30 +810,29 @@ _bfd_merged_section_offset (bfd *output_bfd ATTRIBUTE_UNUSED, asection **psec, secinfo = (struct sec_merge_sec_info *) psecinfo; - if (offset + addend >= sec->_raw_size) + if (offset >= sec->rawsize) { - if (offset + addend > sec->_raw_size) + if (offset > sec->rawsize) { (*_bfd_error_handler) - (_("%s: access beyond end of merged section (%ld + %ld)"), - bfd_get_filename (sec->owner), (long) offset, (long) addend); + (_("%s: access beyond end of merged section (%ld)"), + bfd_get_filename (sec->owner), (long) offset); } - return (secinfo->first ? sec->_cooked_size : 0); + return secinfo->first_str ? sec->size : 0; } if (secinfo->htab->strings) { if (sec->entsize == 1) { - p = secinfo->contents + offset + addend - 1; + p = secinfo->contents + offset - 1; while (p >= secinfo->contents && *p) --p; ++p; } else { - p = secinfo->contents - + ((offset + addend) / sec->entsize) * sec->entsize; + p = secinfo->contents + (offset / sec->entsize) * sec->entsize; p -= sec->entsize; while (p >= secinfo->contents) { @@ -830,10 +850,9 @@ _bfd_merged_section_offset (bfd *output_bfd ATTRIBUTE_UNUSED, asection **psec, } else { - p = secinfo->contents - + ((offset + addend) / sec->entsize) * sec->entsize; + p = secinfo->contents + (offset / sec->entsize) * sec->entsize; } - entry = sec_merge_hash_lookup (secinfo->htab, p, 0, FALSE); + entry = sec_merge_hash_lookup (secinfo->htab, (char *) p, 0, FALSE); if (!entry) { if (! secinfo->htab->strings) @@ -845,9 +864,8 @@ _bfd_merged_section_offset (bfd *output_bfd ATTRIBUTE_UNUSED, asection **psec, if (! secinfo->htab->first) abort (); entry = secinfo->htab->first; - p = secinfo->contents - + ((offset + addend) / sec->entsize + 1) * sec->entsize - - entry->len; + p = (secinfo->contents + (offset / sec->entsize + 1) * sec->entsize + - entry->len); } *psec = entry->secinfo->sec; diff --git a/contrib/binutils/bfd/mipsbsd.c b/contrib/binutils/bfd/mipsbsd.c index cb2050f557f..b8621e486ae 100644 --- a/contrib/binutils/bfd/mipsbsd.c +++ b/contrib/binutils/bfd/mipsbsd.c @@ -17,7 +17,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* #define ENTRY_CAN_BE_ZERO */ #define N_HEADER_IN_TEXT(x) 1 @@ -115,7 +115,6 @@ MY (choose_reloc_size) (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; @@ -157,9 +156,6 @@ MY (write_object_contents) (abfd) 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)) { diff --git a/contrib/binutils/bfd/netbsd-core.c b/contrib/binutils/bfd/netbsd-core.c index 84f2ad7eb5b..e9111a98501 100644 --- a/contrib/binutils/bfd/netbsd-core.c +++ b/contrib/binutils/bfd/netbsd-core.c @@ -1,78 +1,71 @@ /* BFD back end for NetBSD style core files Copyright 1988, 1989, 1991, 1992, 1993, 1996, 1998, 1999, 2000, 2001, - 2002, 2003, 2004 + 2002, 2003, 2004, 2005 Free Software Foundation, Inc. Written by Paul Kranenburg, EUR -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" #include "libbfd.h" -#include "libaout.h" /* BFD a.out internal data structures */ +#include "libaout.h" /* BFD a.out internal data structures. */ #include #include #include #include -/* - * FIXME: On NetBSD/sparc CORE_FPU_OFFSET should be (sizeof (struct trapframe)) - */ +/* The machine ID for OpenBSD/sparc64 and older versions of + NetBSD/sparc64 overlaps with M_MIPS1. */ +#define M_SPARC64_OPENBSD M_MIPS1 /* Offset of StackGhost cookie within `struct md_coredump' on OpenBSD/sparc. */ -#define CORE_WCOOKIE_OFFSET 344 +#define SPARC_WCOOKIE_OFFSET 344 -struct netbsd_core_struct { - struct core core; +/* Offset of StackGhost cookie within `struct md_coredump' on + OpenBSD/sparc64. */ +#define SPARC64_WCOOKIE_OFFSET 832 + +#define netbsd_core_file_matches_executable_p generic_core_file_matches_executable_p + +struct netbsd_core_struct +{ + struct core core; } *rawptr; -/* forward declarations */ - -static const bfd_target *netbsd_core_file_p - PARAMS ((bfd *abfd)); -static char *netbsd_core_file_failing_command - PARAMS ((bfd *abfd)); -static int netbsd_core_file_failing_signal - PARAMS ((bfd *abfd)); -static bfd_boolean netbsd_core_file_matches_executable_p - PARAMS ((bfd *core_bfd, bfd *exec_bfd)); -static void swap_abort - PARAMS ((void)); - /* Handle NetBSD-style core dump file. */ static const bfd_target * -netbsd_core_file_p (abfd) - bfd *abfd; - +netbsd_core_file_p (bfd *abfd) { - int i, val; + int val; + unsigned i; file_ptr offset; - asection *asect, *asect2; + asection *asect; struct core core; struct coreseg coreseg; bfd_size_type amt = sizeof core; - val = bfd_bread ((void *) &core, amt, abfd); + val = bfd_bread (&core, amt, abfd); if (val != sizeof core) { - /* Too small to be a core file */ + /* Too small to be a core file. */ bfd_set_error (bfd_error_wrong_format); return 0; } @@ -100,7 +93,7 @@ netbsd_core_file_p (abfd) if (bfd_seek (abfd, offset, SEEK_SET) != 0) goto punt; - val = bfd_bread ((void *) &coreseg, (bfd_size_type) sizeof coreseg, abfd); + val = bfd_bread (&coreseg, sizeof coreseg, abfd); if (val != sizeof coreseg) { bfd_set_error (bfd_error_file_truncated); @@ -138,49 +131,98 @@ netbsd_core_file_p (abfd) goto punt; asect->flags = flags; - asect->_raw_size = coreseg.c_size; + asect->size = coreseg.c_size; asect->vma = coreseg.c_addr; asect->filepos = offset; asect->alignment_power = 2; - if (CORE_GETMID (core) == M_SPARC_NETBSD - && CORE_GETFLAG (coreseg) == CORE_CPU - && coreseg.c_size > CORE_WCOOKIE_OFFSET) + if (CORE_GETFLAG (coreseg) == CORE_CPU) { - /* Truncate the .reg section. */ - asect->_raw_size = CORE_WCOOKIE_OFFSET; + bfd_size_type wcookie_offset; - /* And create the .wcookie section. */ - asect = bfd_make_section_anyway (abfd, ".wcookie"); - if (asect == NULL) - goto punt; + switch (CORE_GETMID (core)) + { + case M_SPARC_NETBSD: + wcookie_offset = SPARC_WCOOKIE_OFFSET; + break; + case M_SPARC64_OPENBSD: + wcookie_offset = SPARC64_WCOOKIE_OFFSET; + break; + default: + wcookie_offset = 0; + break; + } - asect->flags = SEC_ALLOC + SEC_HAS_CONTENTS; - asect->_raw_size = 4; - asect->vma = 0; - asect->filepos = offset + CORE_WCOOKIE_OFFSET; - asect->alignment_power = 2; + if (wcookie_offset > 0 && coreseg.c_size > wcookie_offset) + { + /* Truncate the .reg section. */ + asect->size = wcookie_offset; + + /* And create the .wcookie section. */ + asect = bfd_make_section_anyway (abfd, ".wcookie"); + if (asect == NULL) + goto punt; + + asect->flags = SEC_ALLOC + SEC_HAS_CONTENTS; + asect->size = coreseg.c_size - wcookie_offset; + asect->vma = 0; + asect->filepos = offset + wcookie_offset; + asect->alignment_power = 2; + } } offset += coreseg.c_size; + } -#ifdef CORE_FPU_OFFSET - switch (CORE_GETFLAG (coreseg)) - { - case CORE_CPU: - /* Hackish... */ - asect->_raw_size = CORE_FPU_OFFSET; - asect2 = bfd_make_section_anyway (abfd, ".reg2"); - if (asect2 == NULL) - goto punt; - asect2->_raw_size = coreseg.c_size - CORE_FPU_OFFSET; - asect2->vma = 0; - asect2->filepos = asect->filepos + CORE_FPU_OFFSET; - asect2->alignment_power = 2; - asect2->flags = SEC_ALLOC + SEC_HAS_CONTENTS; - break; - } -#endif + /* Set architecture from machine ID. */ + switch (CORE_GETMID (core)) + { + case M_ALPHA_NETBSD: + bfd_default_set_arch_mach (abfd, bfd_arch_alpha, 0); + break; + + case M_ARM6_NETBSD: + bfd_default_set_arch_mach (abfd, bfd_arch_arm, bfd_mach_arm_3); + break; + + case M_X86_64_NETBSD: + bfd_default_set_arch_mach (abfd, bfd_arch_i386, bfd_mach_x86_64); + break; + + case M_386_NETBSD: + bfd_default_set_arch_mach (abfd, bfd_arch_i386, bfd_mach_i386_i386); + break; + + case M_68K_NETBSD: + case M_68K4K_NETBSD: + bfd_default_set_arch_mach (abfd, bfd_arch_m68k, 0); + break; + + case M_88K_OPENBSD: + bfd_default_set_arch_mach (abfd, bfd_arch_m88k, 0); + break; + + case M_HPPA_OPENBSD: + bfd_default_set_arch_mach (abfd, bfd_arch_hppa, bfd_mach_hppa11); + break; + + case M_POWERPC_NETBSD: + bfd_default_set_arch_mach (abfd, bfd_arch_powerpc, bfd_mach_ppc); + break; + + case M_SPARC_NETBSD: + bfd_default_set_arch_mach (abfd, bfd_arch_sparc, bfd_mach_sparc); + break; + + case M_SPARC64_NETBSD: + case M_SPARC64_OPENBSD: + bfd_default_set_arch_mach (abfd, bfd_arch_sparc, bfd_mach_sparc_v9); + break; + + case M_VAX_NETBSD: + case M_VAX4K_NETBSD: + bfd_default_set_arch_mach (abfd, bfd_arch_vax, 0); + break; } /* OK, we believe you. You're a core file (sure, sure). */ @@ -194,34 +236,26 @@ netbsd_core_file_p (abfd) } static char* -netbsd_core_file_failing_command (abfd) - bfd *abfd; +netbsd_core_file_failing_command (bfd *abfd) { - /*return core_command (abfd);*/ + /*return core_command (abfd);*/ return abfd->tdata.netbsd_core_data->core.c_name; } static int -netbsd_core_file_failing_signal (abfd) - bfd *abfd; +netbsd_core_file_failing_signal (bfd *abfd) { /*return core_signal (abfd);*/ return abfd->tdata.netbsd_core_data->core.c_signo; } - -static bfd_boolean -netbsd_core_file_matches_executable_p (core_bfd, exec_bfd) - bfd *core_bfd ATTRIBUTE_UNUSED; - bfd *exec_bfd ATTRIBUTE_UNUSED; -{ - return TRUE; /* FIXME, We have no way of telling at this point */ -} /* If somebody calls any byte-swapping routines, shoot them. */ + static void -swap_abort () +swap_abort (void) { - abort (); /* This way doesn't require any declaration for ANSI to fuck up */ + /* This way doesn't require any declaration for ANSI to fuck up. */ + abort (); } #define NO_GET ((bfd_vma (*) (const void *)) swap_abort) @@ -235,15 +269,16 @@ const bfd_target netbsd_core_vec = { "netbsd-core", bfd_target_unknown_flavour, - BFD_ENDIAN_UNKNOWN, /* target byte order */ - BFD_ENDIAN_UNKNOWN, /* target headers byte order */ - (HAS_RELOC | EXEC_P | /* object flags */ + BFD_ENDIAN_UNKNOWN, /* Target byte order. */ + BFD_ENDIAN_UNKNOWN, /* Target headers byte order. */ + (HAS_RELOC | EXEC_P | /* Object flags. */ HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED), - (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ - 0, /* symbol prefix */ - ' ', /* ar_pad_char */ - 16, /* ar_max_namelen */ + (SEC_HAS_CONTENTS | /* Section flags. */ + SEC_ALLOC | SEC_LOAD | SEC_RELOC), + 0, /* Symbol prefix. */ + ' ', /* ar_pad_char. */ + 16, /* ar_max_namelen. */ NO_GET64, NO_GETS64, NO_PUT64, /* 64 bit data. */ NO_GET, NO_GETS, NO_PUT, /* 32 bit data. */ NO_GET, NO_GETS, NO_PUT, /* 16 bit data. */ @@ -251,17 +286,17 @@ const bfd_target netbsd_core_vec = NO_GET, NO_GETS, NO_PUT, /* 32 bit hdrs. */ NO_GET, NO_GETS, NO_PUT, /* 16 bit hdrs. */ - { /* bfd_check_format */ - _bfd_dummy_target, /* unknown format */ - _bfd_dummy_target, /* object file */ - _bfd_dummy_target, /* archive */ - netbsd_core_file_p /* a core file */ + { /* bfd_check_format. */ + _bfd_dummy_target, /* Unknown format. */ + _bfd_dummy_target, /* Object file. */ + _bfd_dummy_target, /* Archive. */ + netbsd_core_file_p /* A core file. */ }, - { /* bfd_set_format */ + { /* bfd_set_format. */ bfd_false, bfd_false, bfd_false, bfd_false }, - { /* bfd_write_contents */ + { /* bfd_write_contents. */ bfd_false, bfd_false, bfd_false, bfd_false }, @@ -278,5 +313,5 @@ const bfd_target netbsd_core_vec = NULL, - (PTR) 0 /* backend_data */ + (PTR) 0 /* Backend_data. */ }; diff --git a/contrib/binutils/bfd/netbsd.h b/contrib/binutils/bfd/netbsd.h index 04a4eabfdfd..92f6a7d2fd1 100644 --- a/contrib/binutils/bfd/netbsd.h +++ b/contrib/binutils/bfd/netbsd.h @@ -1,23 +1,23 @@ /* BFD back-end definitions used by all NetBSD targets. - Copyright 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 2000, 2002 + Copyright 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 2000, 2002, 2005 Free Software Foundation, Inc. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, -USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, + USA. */ /* Check for our machine type (part of magic number). */ #ifndef MACHTYPE_OK @@ -31,7 +31,7 @@ USA. */ #define N_HEADER_IN_TEXT(x) 1 /* Determine if this is a shared library using the flags. */ -#define N_SHARED_LIB(x) (N_DYNAMIC(x)) +#define N_SHARED_LIB(x) (N_DYNAMIC (x)) /* We have 6 bits of flags and 10 bits of machine ID. */ #define N_MACHTYPE(exec) \ @@ -45,7 +45,7 @@ USA. */ | (((flags) & 0x3f) << 24)) #define N_SET_MACHTYPE(exec, machtype) \ ((exec).a_info = \ - ((exec).a_info & 0xfb00ffff) | ((((int) (machtype))&0x3ff) << 16)) + ((exec).a_info & 0xfb00ffff) | ((((int) (machtype)) & 0x3ff) << 16)) #define N_SET_FLAGS(exec, flags) \ ((exec).a_info = \ ((exec).a_info & 0x03ffffff) | ((flags & 0x03f) << 26)) @@ -63,8 +63,9 @@ USA. */ section. */ #define MY_entry_is_text_address 1 -#define MY_write_object_contents MY(write_object_contents) -static bfd_boolean MY(write_object_contents) PARAMS ((bfd *abfd)); +#define MY_write_object_contents MY (write_object_contents) +static bfd_boolean MY (write_object_contents) (bfd *); + #define MY_text_includes_header 1 #include "aout-target.h" @@ -74,8 +75,7 @@ static bfd_boolean MY(write_object_contents) PARAMS ((bfd *abfd)); file header, symbols, and relocation. */ static bfd_boolean -MY(write_object_contents) (abfd) - bfd *abfd; +MY (write_object_contents) (bfd *abfd) { struct external_exec exec_bytes; struct internal_exec *execp = exec_hdr (abfd); @@ -88,20 +88,21 @@ MY(write_object_contents) (abfd) bfd_size_type text_size; file_ptr text_end; - NAME(aout,adjust_sizes_and_vmas) (abfd, &text_size, &text_end); + NAME (aout, adjust_sizes_and_vmas) (abfd, & text_size, & text_end); } obj_reloc_entry_size (abfd) = RELOC_STD_SIZE; /* Magic number, maestro, please! */ - switch (bfd_get_arch(abfd)) { - case DEFAULT_ARCH: - N_SET_MACHTYPE(*execp, DEFAULT_MID); - break; - default: - N_SET_MACHTYPE(*execp, M_UNKNOWN); - break; - } + switch (bfd_get_arch(abfd)) + { + case DEFAULT_ARCH: + N_SET_MACHTYPE(*execp, DEFAULT_MID); + break; + default: + N_SET_MACHTYPE(*execp, M_UNKNOWN); + break; + } /* The NetBSD magic number is always big-endian */ #ifndef TARGET_IS_BIG_ENDIAN_P @@ -112,7 +113,7 @@ MY(write_object_contents) (abfd) | (execp->a_info & 0xff0000) >> 8 | (execp->a_info & 0xff000000) >> 24; #endif - WRITE_HEADERS(abfd, execp); + WRITE_HEADERS (abfd, execp); return TRUE; } diff --git a/contrib/binutils/bfd/opncls.c b/contrib/binutils/bfd/opncls.c index 6abd40509ca..b02b137889a 100644 --- a/contrib/binutils/bfd/opncls.c +++ b/contrib/binutils/bfd/opncls.c @@ -1,6 +1,6 @@ /* opncls.c -- open and close a BFD. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, - 2001, 2002, 2003 + 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Written by Cygnus Support. @@ -19,7 +19,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" @@ -71,13 +71,13 @@ _bfd_new_bfd (void) nbfd->iostream = NULL; nbfd->where = 0; if (!bfd_hash_table_init_n (& nbfd->section_htab, bfd_section_hash_newfunc, - 251)) + sizeof (struct section_hash_entry), 251)) { free (nbfd); return NULL; } nbfd->sections = NULL; - nbfd->section_tail = &nbfd->sections; + nbfd->section_last = NULL; nbfd->format = bfd_unknown; nbfd->my_archive = NULL; nbfd->origin = 0; @@ -103,6 +103,7 @@ _bfd_new_bfd_contained_in (bfd *obfd) if (nbfd == NULL) return NULL; nbfd->xvec = obfd->xvec; + nbfd->iovec = obfd->iovec; nbfd->my_archive = obfd; nbfd->direction = read_direction; nbfd->target_defaulted = obfd->target_defaulted; @@ -123,8 +124,94 @@ _bfd_delete_bfd (bfd *abfd) SECTION Opening and closing BFDs +SUBSECTION + Functions for opening and closing */ +/* +FUNCTION + bfd_fopen + +SYNOPSIS + bfd *bfd_fopen (const char *filename, const char *target, + const char *mode, int fd); + +DESCRIPTION + Open the file @var{filename} with the target @var{target}. + Return a pointer to the created BFD. If @var{fd} is not -1, + then <> is used to open the file; otherwise, <> + is used. @var{mode} is passed directly to <> or + <>. + + Calls <>, so @var{target} is interpreted as by + that function. + + The new BFD is marked as cacheable iff @var{fd} is -1. + + If <> is returned then an error has occured. Possible errors + are <>, <> or + <> error. +*/ + +bfd * +bfd_fopen (const char *filename, const char *target, const char *mode, int fd) +{ + bfd *nbfd; + const bfd_target *target_vec; + + nbfd = _bfd_new_bfd (); + if (nbfd == NULL) + return NULL; + + target_vec = bfd_find_target (target, nbfd); + if (target_vec == NULL) + { + _bfd_delete_bfd (nbfd); + return NULL; + } + +#ifdef HAVE_FDOPEN + if (fd != -1) + nbfd->iostream = fdopen (fd, mode); + else +#endif + nbfd->iostream = real_fopen (filename, mode); + if (nbfd->iostream == NULL) + { + bfd_set_error (bfd_error_system_call); + _bfd_delete_bfd (nbfd); + return NULL; + } + + /* OK, put everything where it belongs. */ + nbfd->filename = filename; + + /* Figure out whether the user is opening the file for reading, + writing, or both, by looking at the MODE argument. */ + if ((mode[0] == 'r' || mode[0] == 'w' || mode[0] == 'a') + && mode[1] == '+') + nbfd->direction = both_direction; + else if (mode[0] == 'r') + nbfd->direction = read_direction; + else + nbfd->direction = write_direction; + + if (! bfd_cache_init (nbfd)) + { + _bfd_delete_bfd (nbfd); + return NULL; + } + nbfd->opened_once = TRUE; + /* If we opened the file by name, mark it cacheable; we can close it + and reopen it later. However, if a file descriptor was provided, + then it may have been opened with special flags that make it + unsafe to close and reopen the file. */ + if (fd == -1) + bfd_set_cacheable (nbfd, TRUE); + + return nbfd; +} + /* FUNCTION bfd_openr @@ -147,32 +234,7 @@ DESCRIPTION bfd * bfd_openr (const char *filename, const char *target) { - bfd *nbfd; - const bfd_target *target_vec; - - nbfd = _bfd_new_bfd (); - if (nbfd == NULL) - return NULL; - - target_vec = bfd_find_target (target, nbfd); - if (target_vec == NULL) - { - _bfd_delete_bfd (nbfd); - return NULL; - } - - nbfd->filename = filename; - nbfd->direction = read_direction; - - if (bfd_open_file (nbfd) == NULL) - { - /* File didn't exist, or some such. */ - bfd_set_error (bfd_error_system_call); - _bfd_delete_bfd (nbfd); - return NULL; - } - - return nbfd; + return bfd_fopen (filename, target, FOPEN_RB, -1); } /* Don't try to `optimize' this function: @@ -211,72 +273,32 @@ DESCRIPTION bfd * bfd_fdopenr (const char *filename, const char *target, int fd) { - bfd *nbfd; - const bfd_target *target_vec; + const char *mode; +#if defined(HAVE_FCNTL) && defined(F_GETFL) int fdflags; +#endif - bfd_set_error (bfd_error_system_call); #if ! defined(HAVE_FCNTL) || ! defined(F_GETFL) - fdflags = O_RDWR; /* Assume full access. */ + mode = FOPEN_RUB; /* Assume full access. */ #else fdflags = fcntl (fd, F_GETFL, NULL); -#endif if (fdflags == -1) - return NULL; - - nbfd = _bfd_new_bfd (); - if (nbfd == NULL) - return NULL; - - target_vec = bfd_find_target (target, nbfd); - if (target_vec == NULL) { - _bfd_delete_bfd (nbfd); + bfd_set_error (bfd_error_system_call); return NULL; } -#ifndef HAVE_FDOPEN - nbfd->iostream = fopen (filename, FOPEN_RB); -#else /* (O_ACCMODE) parens are to avoid Ultrix header file bug. */ switch (fdflags & (O_ACCMODE)) { - case O_RDONLY: nbfd->iostream = fdopen (fd, FOPEN_RB); break; - case O_WRONLY: nbfd->iostream = fdopen (fd, FOPEN_RUB); break; - case O_RDWR: nbfd->iostream = fdopen (fd, FOPEN_RUB); break; + case O_RDONLY: mode = FOPEN_RB; break; + case O_WRONLY: mode = FOPEN_RUB; break; + case O_RDWR: mode = FOPEN_RUB; break; default: abort (); } #endif - if (nbfd->iostream == NULL) - { - _bfd_delete_bfd (nbfd); - return NULL; - } - - /* OK, put everything where it belongs. */ - nbfd->filename = filename; - - /* As a special case we allow a FD open for read/write to - be written through, although doing so requires that we end - the previous clause with a preposition. */ - /* (O_ACCMODE) parens are to avoid Ultrix header file bug. */ - switch (fdflags & (O_ACCMODE)) - { - case O_RDONLY: nbfd->direction = read_direction; break; - case O_WRONLY: nbfd->direction = write_direction; break; - case O_RDWR: nbfd->direction = both_direction; break; - default: abort (); - } - - if (! bfd_cache_init (nbfd)) - { - _bfd_delete_bfd (nbfd); - return NULL; - } - nbfd->opened_once = TRUE; - - return nbfd; + return bfd_fopen (filename, target, mode, fd); } /* @@ -322,6 +344,183 @@ bfd_openstreamr (const char *filename, const char *target, void *streamarg) return nbfd; } + +/* +FUNCTION + bfd_openr_iovec + +SYNOPSIS + bfd *bfd_openr_iovec (const char *filename, const char *target, + void *(*open) (struct bfd *nbfd, + void *open_closure), + void *open_closure, + file_ptr (*pread) (struct bfd *nbfd, + void *stream, + void *buf, + file_ptr nbytes, + file_ptr offset), + int (*close) (struct bfd *nbfd, + void *stream)); + +DESCRIPTION + + Create and return a BFD backed by a read-only @var{stream}. + The @var{stream} is created using @var{open}, accessed using + @var{pread} and destroyed using @var{close}. + + Calls <>, so @var{target} is interpreted as by + that function. + + Calls @var{open} (which can call <> and + <>) to obtain the read-only stream backing + the BFD. @var{open} either succeeds returning the + non-<> @var{stream}, or fails returning <> + (setting <>). + + Calls @var{pread} to request @var{nbytes} of data from + @var{stream} starting at @var{offset} (e.g., via a call to + <>). @var{pread} either succeeds returning the + number of bytes read (which can be less than @var{nbytes} when + end-of-file), or fails returning -1 (setting <>). + + Calls @var{close} when the BFD is later closed using + <>. @var{close} either succeeds returning 0, or + fails returning -1 (setting <>). + + If <> returns <> then an error has + occurred. Possible errors are <>, + <> and <>. + +*/ + +struct opncls +{ + void *stream; + file_ptr (*pread) (struct bfd *abfd, void *stream, void *buf, + file_ptr nbytes, file_ptr offset); + int (*close) (struct bfd *abfd, void *stream); + file_ptr where; +}; + +static file_ptr +opncls_btell (struct bfd *abfd) +{ + struct opncls *vec = abfd->iostream; + return vec->where; +} + +static int +opncls_bseek (struct bfd *abfd, file_ptr offset, int whence) +{ + struct opncls *vec = abfd->iostream; + switch (whence) + { + case SEEK_SET: vec->where = offset; break; + case SEEK_CUR: vec->where += offset; break; + case SEEK_END: return -1; + } + return 0; +} + +static file_ptr +opncls_bread (struct bfd *abfd, void *buf, file_ptr nbytes) +{ + struct opncls *vec = abfd->iostream; + file_ptr nread = (vec->pread) (abfd, vec->stream, buf, nbytes, vec->where); + if (nread < 0) + return nread; + vec->where += nread; + return nread; +} + +static file_ptr +opncls_bwrite (struct bfd *abfd ATTRIBUTE_UNUSED, + const void *where ATTRIBUTE_UNUSED, + file_ptr nbytes ATTRIBUTE_UNUSED) +{ + return -1; +} + +static int +opncls_bclose (struct bfd *abfd) +{ + struct opncls *vec = abfd->iostream; + /* Since the VEC's memory is bound to the bfd deleting the bfd will + free it. */ + int status = 0; + if (vec->close != NULL) + status = (vec->close) (abfd, vec->stream); + abfd->iostream = NULL; + return status; +} + +static int +opncls_bflush (struct bfd *abfd ATTRIBUTE_UNUSED) +{ + return 0; +} + +static int +opncls_bstat (struct bfd *abfd ATTRIBUTE_UNUSED, struct stat *sb) +{ + memset (sb, 0, sizeof (*sb)); + return 0; +} + +static const struct bfd_iovec opncls_iovec = { + &opncls_bread, &opncls_bwrite, &opncls_btell, &opncls_bseek, + &opncls_bclose, &opncls_bflush, &opncls_bstat +}; + +bfd * +bfd_openr_iovec (const char *filename, const char *target, + void *(*open) (struct bfd *nbfd, + void *open_closure), + void *open_closure, + file_ptr (*pread) (struct bfd *abfd, + void *stream, + void *buf, + file_ptr nbytes, + file_ptr offset), + int (*close) (struct bfd *nbfd, + void *stream)) +{ + bfd *nbfd; + const bfd_target *target_vec; + struct opncls *vec; + void *stream; + + nbfd = _bfd_new_bfd (); + if (nbfd == NULL) + return NULL; + + target_vec = bfd_find_target (target, nbfd); + if (target_vec == NULL) + { + _bfd_delete_bfd (nbfd); + return NULL; + } + + nbfd->filename = filename; + nbfd->direction = read_direction; + + stream = open (nbfd, open_closure); + if (stream == NULL) + { + _bfd_delete_bfd (nbfd); + return NULL; + } + + vec = bfd_zalloc (nbfd, sizeof (struct opncls)); + vec->stream = stream; + vec->pread = pread; + vec->close = close; + + nbfd->iovec = &opncls_iovec; + nbfd->iostream = vec; + + return nbfd; +} /* bfd_openw -- open for writing. Returns a pointer to a freshly-allocated BFD on success, or NULL. @@ -415,7 +614,12 @@ bfd_close (bfd *abfd) if (! BFD_SEND (abfd, _close_and_cleanup, (abfd))) return FALSE; - ret = bfd_cache_close (abfd); + /* FIXME: cagney/2004-02-15: Need to implement a BFD_IN_MEMORY io + vector. */ + if (!(abfd->flags & BFD_IN_MEMORY)) + ret = abfd->iovec->bclose (abfd); + else + ret = TRUE; /* If the file was open for writing and is now executable, make it so. */ @@ -630,14 +834,13 @@ INTERNAL_FUNCTION bfd_alloc SYNOPSIS - void *bfd_alloc (bfd *abfd, size_t wanted); + void *bfd_alloc (bfd *abfd, bfd_size_type wanted); DESCRIPTION Allocate a block of @var{wanted} bytes of memory attached to <> and return a pointer to it. */ - void * bfd_alloc (bfd *abfd, bfd_size_type size) { @@ -655,6 +858,57 @@ bfd_alloc (bfd *abfd, bfd_size_type size) return ret; } +/* +INTERNAL_FUNCTION + bfd_alloc2 + +SYNOPSIS + void *bfd_alloc2 (bfd *abfd, bfd_size_type nmemb, bfd_size_type size); + +DESCRIPTION + Allocate a block of @var{nmemb} elements of @var{size} bytes each + of memory attached to <> and return a pointer to it. +*/ + +void * +bfd_alloc2 (bfd *abfd, bfd_size_type nmemb, bfd_size_type size) +{ + void *ret; + + if ((nmemb | size) >= HALF_BFD_SIZE_TYPE + && size != 0 + && nmemb > ~(bfd_size_type) 0 / size) + { + bfd_set_error (bfd_error_no_memory); + return NULL; + } + + size *= nmemb; + + if (size != (unsigned long) size) + { + bfd_set_error (bfd_error_no_memory); + return NULL; + } + + ret = objalloc_alloc (abfd->memory, (unsigned long) size); + if (ret == NULL) + bfd_set_error (bfd_error_no_memory); + return ret; +} + +/* +INTERNAL_FUNCTION + bfd_zalloc + +SYNOPSIS + void *bfd_zalloc (bfd *abfd, bfd_size_type wanted); + +DESCRIPTION + Allocate a block of @var{wanted} bytes of zeroed memory + attached to <> and return a pointer to it. +*/ + void * bfd_zalloc (bfd *abfd, bfd_size_type size) { @@ -666,6 +920,39 @@ bfd_zalloc (bfd *abfd, bfd_size_type size) return res; } +/* +INTERNAL_FUNCTION + bfd_zalloc2 + +SYNOPSIS + void *bfd_zalloc2 (bfd *abfd, bfd_size_type nmemb, bfd_size_type size); + +DESCRIPTION + Allocate a block of @var{nmemb} elements of @var{size} bytes each + of zeroed memory attached to <> and return a pointer to it. +*/ + +void * +bfd_zalloc2 (bfd *abfd, bfd_size_type nmemb, bfd_size_type size) +{ + void *res; + + if ((nmemb | size) >= HALF_BFD_SIZE_TYPE + && size != 0 + && nmemb > ~(bfd_size_type) 0 / size) + { + bfd_set_error (bfd_error_no_memory); + return NULL; + } + + size *= nmemb; + + res = bfd_alloc (abfd, size); + if (res) + memset (res, 0, (size_t) size); + return res; +} + /* Free a block allocated for a BFD. Note: Also frees all more recently allocated blocks! */ @@ -676,9 +963,9 @@ bfd_release (bfd *abfd, void *block) } -/* - GNU Extension: separate debug-info files - +/* + GNU Extension: separate debug-info files + The idea here is that a special section called .gnu_debuglink might be embedded in a binary file, which indicates that some *other* file contains the real debugging information. This special section contains a @@ -706,7 +993,7 @@ DESCRIPTION RETURNS Return the updated CRC32 value. -*/ +*/ unsigned long bfd_calc_gnu_debuglink_crc32 (unsigned long crc, @@ -793,12 +1080,11 @@ DESCRIPTION static char * get_debug_link_info (bfd *abfd, unsigned long *crc32_out) { - asection * sect; - bfd_size_type debuglink_size; + asection *sect; unsigned long crc32; - char * contents; + bfd_byte *contents; int crc_offset; - bfd_boolean ret; + char *name; BFD_ASSERT (abfd); BFD_ASSERT (crc32_out); @@ -808,27 +1094,22 @@ get_debug_link_info (bfd *abfd, unsigned long *crc32_out) if (sect == NULL) return NULL; - debuglink_size = bfd_section_size (abfd, sect); - - contents = malloc (debuglink_size); - if (contents == NULL) - return NULL; - - ret = bfd_get_section_contents (abfd, sect, contents, 0, debuglink_size); - if (! ret) + if (!bfd_malloc_and_get_section (abfd, sect, &contents)) { - free (contents); + if (contents != NULL) + free (contents); return NULL; } /* Crc value is stored after the filename, aligned up to 4 bytes. */ - crc_offset = strlen (contents) + 1; + name = (char *) contents; + crc_offset = strlen (name) + 1; crc_offset = (crc_offset + 3) & ~3; crc32 = bfd_get_32 (abfd, contents + crc_offset); *crc32_out = crc32; - return contents; + return name; } /* @@ -847,7 +1128,7 @@ DESCRIPTION static bfd_boolean separate_debug_file_exists (const char *name, const unsigned long crc) { - static char buffer [8 * 1024]; + static unsigned char buffer [8 * 1024]; unsigned long file_crc = 0; int fd; bfd_size_type count; @@ -917,19 +1198,19 @@ find_separate_debug_file (bfd *abfd, const char *debug_file_directory) return NULL; } BFD_ASSERT (strlen (dir) != 0); - + /* Strip off filename part. */ for (i = strlen (dir) - 1; i >= 0; i--) if (IS_DIR_SEPARATOR (dir[i])) break; dir[i + 1] = '\0'; - BFD_ASSERT (dir[i] == '/' || dir[0] == '\0') + BFD_ASSERT (dir[i] == '/' || dir[0] == '\0'); debugfile = malloc (strlen (debug_file_directory) + 1 + strlen (dir) + strlen (".debug/") - + strlen (basename) + + strlen (basename) + 1); if (debugfile == NULL) { @@ -1014,10 +1295,6 @@ RETURNS char * bfd_follow_gnu_debuglink (bfd *abfd, const char *dir) { -#if 0 /* Disabled until DEBUGDIR can be defined by configure.in. */ - if (dir == NULL) - dir = DEBUGDIR; -#endif return find_separate_debug_file (abfd, dir); } @@ -1036,7 +1313,7 @@ DESCRIPTION RETURNS A pointer to the new section is returned if all is ok. Otherwise <> is - returned and bfd_error is set. + returned and bfd_error is set. */ asection * @@ -1053,7 +1330,7 @@ bfd_create_gnu_debuglink_section (bfd *abfd, const char *filename) /* Strip off any path components in filename. */ filename = lbasename (filename); - + sect = bfd_get_section_by_name (abfd, GNU_DEBUGLINK); if (sect) { @@ -1071,7 +1348,7 @@ bfd_create_gnu_debuglink_section (bfd *abfd, const char *filename) /* XXX Should we delete the section from the bfd ? */ return NULL; - + debuglink_size = strlen (filename) + 1; debuglink_size += 3; debuglink_size &= ~3; @@ -1080,7 +1357,7 @@ bfd_create_gnu_debuglink_section (bfd *abfd, const char *filename) if (! bfd_set_section_size (abfd, sect, debuglink_size)) /* XXX Should we delete the section from the bfd ? */ return NULL; - + return sect; } @@ -1102,7 +1379,7 @@ DESCRIPTION RETURNS <> is returned if all is ok. Otherwise <> is returned - and bfd_error is set. + and bfd_error is set. */ bfd_boolean @@ -1115,7 +1392,7 @@ bfd_fill_in_gnu_debuglink_section (bfd *abfd, char * contents; bfd_size_type crc_offset; FILE * handle; - static char buffer[8 * 1024]; + static unsigned char buffer[8 * 1024]; size_t count; if (abfd == NULL || sect == NULL || filename == NULL) @@ -1130,7 +1407,7 @@ bfd_fill_in_gnu_debuglink_section (bfd *abfd, .gnu_debuglink section, we insist upon the user providing us with a correct-for-section-creation-time path, but this need not conform to the gdb location algorithm. */ - handle = fopen (filename, FOPEN_RB); + handle = real_fopen (filename, FOPEN_RB); if (handle == NULL) { bfd_set_error (bfd_error_system_call); @@ -1145,7 +1422,7 @@ bfd_fill_in_gnu_debuglink_section (bfd *abfd, /* Strip off any path components in filename, now that we no longer need them. */ filename = lbasename (filename); - + debuglink_size = strlen (filename) + 1; debuglink_size += 3; debuglink_size &= ~3; diff --git a/contrib/binutils/bfd/osf-core.c b/contrib/binutils/bfd/osf-core.c index 8273504e59a..cc6c4dccd00 100644 --- a/contrib/binutils/bfd/osf-core.c +++ b/contrib/binutils/bfd/osf-core.c @@ -16,7 +16,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* This file can only be compiled on systems which use OSF/1 style core files. */ @@ -26,7 +26,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "libbfd.h" #include +#ifdef OSF_CORE #include +#endif /* forward declarations */ @@ -38,8 +40,7 @@ static char *osf_core_core_file_failing_command PARAMS ((bfd *)); static int osf_core_core_file_failing_signal PARAMS ((bfd *)); -static bfd_boolean osf_core_core_file_matches_executable_p - PARAMS ((bfd *, bfd *)); +#define osf_core_core_file_matches_executable_p generic_core_file_matches_executable_p static void swap_abort PARAMS ((void)); @@ -56,11 +57,11 @@ struct osf_core_struct #define core_command(bfd) (core_hdr(bfd)->cmd) static asection * -make_bfd_asection (abfd, name, flags, _raw_size, vma, filepos) +make_bfd_asection (abfd, name, flags, size, vma, filepos) bfd *abfd; const char *name; flagword flags; - bfd_size_type _raw_size; + bfd_size_type size; bfd_vma vma; file_ptr filepos; { @@ -71,7 +72,7 @@ make_bfd_asection (abfd, name, flags, _raw_size, vma, filepos) return NULL; asect->flags = flags; - asect->_raw_size = _raw_size; + asect->size = size; asect->vma = vma; asect->filepos = filepos; asect->alignment_power = 8; @@ -170,14 +171,6 @@ osf_core_core_file_failing_signal (abfd) { return core_signal (abfd); } - -static bfd_boolean -osf_core_core_file_matches_executable_p (core_bfd, exec_bfd) - bfd *core_bfd ATTRIBUTE_UNUSED; - bfd *exec_bfd ATTRIBUTE_UNUSED; -{ - return TRUE; /* FIXME, We have no way of telling at this point */ -} /* If somebody calls any byte-swapping routines, shoot them. */ static void diff --git a/contrib/binutils/bfd/pe-arm.c b/contrib/binutils/bfd/pe-arm.c index 8b5d1c7e101..dba9c1b40e4 100644 --- a/contrib/binutils/bfd/pe-arm.c +++ b/contrib/binutils/bfd/pe-arm.c @@ -15,7 +15,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" diff --git a/contrib/binutils/bfd/pe-i386.c b/contrib/binutils/bfd/pe-i386.c index a912cffd998..7c102b42de8 100644 --- a/contrib/binutils/bfd/pe-i386.c +++ b/contrib/binutils/bfd/pe-i386.c @@ -1,5 +1,5 @@ /* BFD back-end for Intel 386 PECOFF files. - Copyright 1995, 1996, 1999, 2001, 2002 Free Software Foundation, Inc. + Copyright 1995, 1996, 1999, 2001, 2002, 2004 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -15,17 +15,18 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" -#define TARGET_SYM i386pe_vec -#define TARGET_NAME "pe-i386" +#define TARGET_SYM i386pe_vec +#define TARGET_NAME "pe-i386" #define COFF_WITH_PE -#define PCRELOFFSET TRUE -#define TARGET_UNDERSCORE '_' +#define PCRELOFFSET TRUE +#define TARGET_UNDERSCORE '_' #define COFF_LONG_SECTION_NAMES +#define COFF_SUPPORT_GNU_LINKONCE #define COFF_LONG_FILENAMES #define COFF_SECTION_ALIGNMENT_ENTRIES \ @@ -33,11 +34,17 @@ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \ { COFF_SECTION_NAME_EXACT_MATCH (".data"), \ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \ +{ COFF_SECTION_NAME_EXACT_MATCH (".rdata"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \ { COFF_SECTION_NAME_EXACT_MATCH (".text"), \ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \ { COFF_SECTION_NAME_PARTIAL_MATCH (".idata"), \ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \ { COFF_SECTION_NAME_EXACT_MATCH (".pdata"), \ - COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 } + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \ +{ COFF_SECTION_NAME_PARTIAL_MATCH (".debug"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 }, \ +{ COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.wi."), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 } #include "coff-i386.c" diff --git a/contrib/binutils/bfd/pe-mips.c b/contrib/binutils/bfd/pe-mips.c index 3066aaa442b..03d6beca981 100644 --- a/contrib/binutils/bfd/pe-mips.c +++ b/contrib/binutils/bfd/pe-mips.c @@ -1,23 +1,23 @@ /* BFD back-end for MIPS PE COFF files. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + 2000, 2001, 2002, 2003, 2004, 2005 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 file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #define COFF_WITH_PE #define COFF_LONG_SECTION_NAMES @@ -26,45 +26,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #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 - -static bfd_boolean in_reloc_p - PARAMS ((bfd *, reloc_howto_type *)); -static reloc_howto_type * coff_mips_reloc_type_lookup - PARAMS ((bfd *, bfd_reloc_code_real_type)); -static void mips_swap_reloc_in - PARAMS ((bfd *, PTR, PTR)); -static unsigned int mips_swap_reloc_out - PARAMS ((bfd *, PTR, PTR)); -static bfd_boolean coff_pe_mips_relocate_section - PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, - struct internal_reloc *, struct internal_syment *, asection **)); - -#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2) +#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER 2 /* The page size is a guess based on ELF. */ #define COFF_PAGE_SIZE 0x1000 @@ -79,19 +46,17 @@ static bfd_boolean coff_pe_mips_relocate_section 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; +coff_mips_reloc (bfd *abfd, + arelent *reloc_entry, + asymbol *symbol, + void * data, + asection *input_section ATTRIBUTE_UNUSED, + bfd *output_bfd, + char **error_message ATTRIBUTE_UNUSED) { symvalue diff; - if (output_bfd == (bfd *) NULL) + if (output_bfd == NULL) return bfd_reloc_continue; if (bfd_is_com_section (symbol->section)) @@ -115,22 +80,11 @@ coff_mips_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, #endif } else - { - /* For some reason bfd_perform_relocation always effectively - ignores the addend for a COFF target when producing - relocatable 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 + /* For some reason bfd_perform_relocation always effectively + ignores the addend for a COFF target when producing + relocatable output. This seems to be always wrong for 386 + COFF, so we handle the addend here instead. */ + diff = reloc_entry->addend; #define DOIT(x) \ x = ((x & ~howto->dst_mask) | (((x & howto->src_mask) + (diff >> howto->rightshift)) & howto->dst_mask)) @@ -145,6 +99,7 @@ coff_mips_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, case 0: { char x = bfd_get_8 (abfd, addr); + DOIT (x); bfd_put_8 (abfd, x, addr); } @@ -153,6 +108,7 @@ coff_mips_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, case 1: { short x = bfd_get_16 (abfd, addr); + DOIT (x); bfd_put_16 (abfd, (bfd_vma) x, addr); } @@ -161,6 +117,7 @@ coff_mips_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, case 2: { long x = bfd_get_32 (abfd, addr); + DOIT (x); bfd_put_32 (abfd, (bfd_vma) x, addr); } @@ -180,9 +137,7 @@ coff_mips_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, appear in the output .reloc section. */ static bfd_boolean -in_reloc_p (abfd, howto) - bfd * abfd ATTRIBUTE_UNUSED; - reloc_howto_type *howto; +in_reloc_p (bfd * abfd ATTRIBUTE_UNUSED, reloc_howto_type *howto) { return ! howto->pc_relative && howto->type != MIPS_R_RVA; } @@ -197,130 +152,130 @@ 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 */ + 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 */ + 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 */ + 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 */ + 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 */ + 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 */ + 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 */ + 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 */ + 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 */ + 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), @@ -348,41 +303,43 @@ static reloc_howto_type howto_table[] = 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 */ + 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 */ + 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 */ +/* 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 SELECT_RELOC(x, howto) { x.r_type = howto->type; } +#define BADMAG(x) MIPSBADMAG (x) + +/* Customize coffcode.h. */ +#define MIPS 1 #define RTYPE2HOWTO(cache_ptr, dst) \ (cache_ptr)->howto = howto_table + (dst)->r_type; @@ -402,17 +359,17 @@ static reloc_howto_type howto_table[] = #define CALC_ADDEND(abfd, ptr, reloc, cache_ptr) \ { \ - coff_symbol_type *coffsym = (coff_symbol_type *) NULL; \ + coff_symbol_type *coffsym = 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 \ + if (coffsym != 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) \ + && ptr->section != NULL) \ cache_ptr->addend = - (ptr->section->vma + ptr->value); \ else \ cache_ptr->addend = 0; \ @@ -423,13 +380,12 @@ static reloc_howto_type howto_table[] = /* 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; +coff_mips_rtype_to_howto (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; @@ -489,24 +445,20 @@ coff_mips_rtype_to_howto (abfd, sec, rel, h, sym, addendp) } if (rel->r_type == MIPS_R_RVA) - { - *addendp -= pe_data(sec->output_section->owner)->pe_opthdr.ImageBase; - } + *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 +#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; +coff_mips_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, + bfd_reloc_code_real_type code) { int mips_type; @@ -534,35 +486,18 @@ coff_mips_reloc_type_lookup (abfd, code) 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 NULL; } - return &howto_table[mips_type]; + return & howto_table [mips_type]; } static void -mips_swap_reloc_in (abfd, src, dst) - bfd *abfd; - PTR src; - PTR dst; +mips_swap_reloc_in (bfd * abfd, void * src, void * dst) { static struct internal_reloc pair_prev; RELOC *reloc_src = (RELOC *) src; @@ -584,17 +519,13 @@ mips_swap_reloc_in (abfd, src, dst) 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; +mips_swap_reloc_out (bfd * abfd, void * src, void * dst) { static int prev_offset = 1; static bfd_vma prev_addr = 0; @@ -629,22 +560,19 @@ mips_swap_reloc_out (abfd, src, dst) return RELSZ; } -#define coff_swap_reloc_in mips_swap_reloc_in -#define coff_swap_reloc_out mips_swap_reloc_out +#define coff_swap_reloc_in mips_swap_reloc_in +#define coff_swap_reloc_out mips_swap_reloc_out #define NO_COFF_RELOCS static bfd_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; +coff_pe_mips_relocate_section (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; bfd_boolean gp_undefined; @@ -655,35 +583,23 @@ coff_pe_mips_relocate_section (output_bfd, info, input_bfd, bfd_boolean got_lo; if (info->relocatable) - { - (*_bfd_error_handler) (_("\ -%s: `ld -r' not supported with PE MIPS objects\n"), - bfd_archive_filename (input_bfd)); - bfd_set_error (bfd_error_bad_value); - return FALSE; - } + { + (*_bfd_error_handler) + (_("%B: `ld -r' not supported with PE MIPS objects\n"), 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; - + gp_undefined = (gp == 0) ? TRUE : 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; @@ -779,57 +695,49 @@ coff_pe_mips_relocate_section (output_bfd, info, input_bfd, 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 - */ + val = VMA of what we need to refer to. */ -#define UI(x) (*_bfd_error_handler) (_("%s: unimplemented %s\n"), \ - bfd_archive_filename (input_bfd), x); \ +#define UI(x) (*_bfd_error_handler) (_("%B: unimplemented %s\n"), \ + input_bfd, x); \ bfd_set_error (bfd_error_bad_value); switch (rel->r_type) { case MIPS_R_ABSOLUTE: - /* ignore these */ + /* Ignore these. */ break; case MIPS_R_REFHALF: - UI("refhalf"); + UI ("refhalf"); break; case MIPS_R_REFWORD: - tmp = bfd_get_32(input_bfd, mem); + 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); + bfd_put_32 (input_bfd, tmp, mem); break; case MIPS_R_JMPADDR: - tmp = bfd_get_32(input_bfd, mem); - targ = val + (tmp&0x03ffffff)*4; + 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_archive_filename (input_bfd)); + (*_bfd_error_handler) (_("%B: jump too far away\n"), input_bfd); bfd_set_error (bfd_error_bad_value); return FALSE; } tmp &= 0xfc000000; - tmp |= (targ/4) & 0x3ffffff; - bfd_put_32(input_bfd, tmp, mem); + tmp |= (targ / 4) & 0x3ffffff; + bfd_put_32 (input_bfd, tmp, mem); break; case MIPS_R_REFHI: - tmp = bfd_get_32(input_bfd, mem); + tmp = bfd_get_32 (input_bfd, mem); switch (rel[1].r_type) { case MIPS_R_PAIR: @@ -838,51 +746,51 @@ coff_pe_mips_relocate_section (output_bfd, info, input_bfd, break; case MIPS_R_REFLO: /* GNU COFF object */ - low = bfd_get_32(input_bfd, contents + rel[1].r_vaddr); + 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_archive_filename (input_bfd)); + (*_bfd_error_handler) (_("%B: bad pair/reflo after refhi\n"), + input_bfd); bfd_set_error (bfd_error_bad_value); return FALSE; } tmp &= 0xffff0000; tmp |= (targ >> 16) & 0xffff; - bfd_put_32(input_bfd, tmp, mem); + bfd_put_32 (input_bfd, tmp, mem); break; case MIPS_R_REFLO: - tmp = bfd_get_32(input_bfd, mem); + 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); + bfd_put_32 (input_bfd, tmp, mem); break; case MIPS_R_GPREL: case MIPS_R_LITERAL: - UI("gprel"); + UI ("gprel"); break; case MIPS_R_SECTION: - UI("section"); + UI ("section"); break; case MIPS_R_SECREL: - UI("secrel"); + UI ("secrel"); break; case MIPS_R_SECRELLO: - UI("secrello"); + UI ("secrello"); break; case MIPS_R_SECRELHI: - UI("secrelhi"); + UI ("secrelhi"); break; case MIPS_R_RVA: @@ -910,13 +818,8 @@ coff_pe_mips_relocate_section (output_bfd, info, input_bfd, a leading dot for local labels, so if TARGET_UNDERSCORE is defined we treat all symbols starting with L as local. */ -static bfd_boolean coff_mips_is_local_label_name - PARAMS ((bfd *, const char *)); - static bfd_boolean -coff_mips_is_local_label_name (abfd, name) - bfd *abfd; - const char *name; +coff_mips_is_local_label_name (bfd *abfd, const char *name) { if (name[0] == 'L') return TRUE; @@ -942,57 +845,57 @@ const bfd_target #ifdef TARGET_NAME TARGET_NAME, #else - "pe-mips", /* name */ + "pe-mips", /* Name. */ #endif bfd_target_coff_flavour, - BFD_ENDIAN_LITTLE, /* data byte order is little */ - BFD_ENDIAN_LITTLE, /* header byte order is little */ + BFD_ENDIAN_LITTLE, /* Data byte order is little. */ + BFD_ENDIAN_LITTLE, /* Header byte order is little. */ - (HAS_RELOC | EXEC_P | /* object flags */ + (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_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_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 */ + TARGET_UNDERSCORE, /* Leading underscore. */ #else 0, /* leading underscore */ #endif - '/', /* ar_pad_char */ - 15, /* ar_max_namelen */ + '/', /* 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_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_getl16, bfd_getl_signed_16, bfd_putl16, /* Headers. */ -/* 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}, + /* 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), + 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, diff --git a/contrib/binutils/bfd/pe-ppc.c b/contrib/binutils/bfd/pe-ppc.c index adbf3176e69..93cf6367c6e 100644 --- a/contrib/binutils/bfd/pe-ppc.c +++ b/contrib/binutils/bfd/pe-ppc.c @@ -1,5 +1,5 @@ /* BFD back-end for PowerPC PECOFF files. - Copyright 1995, 1996, 2001 Free Software Foundation, Inc. + Copyright 1995, 1996, 1999, 2001 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -15,8 +15,8 @@ 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. */ +Foundation, 51 Franklin Street - Fifth Floor, +Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" diff --git a/contrib/binutils/bfd/peXXigen.c b/contrib/binutils/bfd/peXXigen.c index 598aa7cfa03..71300219d30 100644 --- a/contrib/binutils/bfd/peXXigen.c +++ b/contrib/binutils/bfd/peXXigen.c @@ -1,6 +1,6 @@ /* Support for the generic parts of PE/PEI; the common executable parts. - Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 - Free Software Foundation, Inc. + Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, + 2005, 2006 Free Software Foundation, Inc. Written by Cygnus Solutions. This file is part of BFD, the Binary File Descriptor library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* Most of this hacked by Steve Chamberlain . @@ -88,20 +88,9 @@ the code is in peigen.c. PowerPC NT is said to be dead. If anybody wants to revive the code, you will have to figure out how to handle those issues. */ - -static void add_data_entry - PARAMS ((bfd *, struct internal_extra_pe_aouthdr *, int, char *, bfd_vma)); -static bfd_boolean pe_print_pdata PARAMS ((bfd *, PTR)); -static bfd_boolean pe_print_reloc PARAMS ((bfd *, PTR)); -static bfd_boolean pe_print_idata PARAMS ((bfd *, PTR)); -static bfd_boolean pe_print_edata PARAMS ((bfd *, PTR)); - void -_bfd_XXi_swap_sym_in (abfd, ext1, in1) - bfd *abfd; - PTR ext1; - PTR in1; +_bfd_XXi_swap_sym_in (bfd * abfd, void * ext1, void * in1) { SYMENT *ext = (SYMENT *) ext1; struct internal_syment *in = (struct internal_syment *) in1; @@ -138,24 +127,6 @@ _bfd_XXi_swap_sym_in (abfd, ext1, in1) { in->n_value = 0x0; -#if 0 - /* FIXME: This is clearly wrong. The problem seems to be that - undefined C_SECTION symbols appear in the first object of a - MS generated .lib file, and the symbols are not defined - anywhere. */ - in->n_scnum = 1; - - /* I have tried setting the class to 3 and using the following - to set the section number. This will put the address of the - pointer to the string kernel32.dll at addresses 0 and 0x10 - off start of idata section which is not correct. */ -#if 0 - if (strcmp (in->_n._n_name, ".idata$4") == 0) - in->n_scnum = 3; - else - in->n_scnum = 2; -#endif -#else /* Create synthetic empty sections as needed. DJ */ if (in->n_scnum == 0) { @@ -189,16 +160,14 @@ _bfd_XXi_swap_sym_in (abfd, ext1, in1) sec->vma = 0; sec->lma = 0; - sec->_cooked_size = 0; - sec->_raw_size = 0; + sec->size = 0; sec->filepos = 0; sec->rel_filepos = 0; sec->reloc_count = 0; sec->line_filepos = 0; sec->lineno_count = 0; sec->userdata = NULL; - sec->next = (asection *) NULL; - sec->flags = 0; + sec->next = NULL; sec->alignment_power = 2; sec->flags = SEC_HAS_CONTENTS | SEC_ALLOC | SEC_DATA | SEC_LOAD; @@ -207,7 +176,6 @@ _bfd_XXi_swap_sym_in (abfd, ext1, in1) in->n_scnum = unused_section_number; } in->n_sclass = C_STAT; -#endif } #endif @@ -219,10 +187,7 @@ _bfd_XXi_swap_sym_in (abfd, ext1, in1) } unsigned int -_bfd_XXi_swap_sym_out (abfd, inp, extp) - bfd *abfd; - PTR inp; - PTR extp; +_bfd_XXi_swap_sym_out (bfd * abfd, void * inp, void * extp) { struct internal_syment *in = (struct internal_syment *) inp; SYMENT *ext = (SYMENT *) extp; @@ -250,14 +215,13 @@ _bfd_XXi_swap_sym_out (abfd, inp, extp) } void -_bfd_XXi_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1) - bfd *abfd; - PTR ext1; - int type; - int class; - int indx ATTRIBUTE_UNUSED; - int numaux ATTRIBUTE_UNUSED; - PTR in1; +_bfd_XXi_swap_aux_in (bfd * abfd, + void * ext1, + int type, + int class, + int indx ATTRIBUTE_UNUSED, + int numaux ATTRIBUTE_UNUSED, + void * in1) { AUXENT *ext = (AUXENT *) ext1; union internal_auxent *in = (union internal_auxent *) in1; @@ -322,19 +286,19 @@ _bfd_XXi_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1) } unsigned int -_bfd_XXi_swap_aux_out (abfd, inp, type, class, indx, numaux, extp) - bfd *abfd; - PTR inp; - int type; - int class; - int indx ATTRIBUTE_UNUSED; - int numaux ATTRIBUTE_UNUSED; - PTR extp; +_bfd_XXi_swap_aux_out (bfd * abfd, + void * inp, + int type, + int class, + int indx ATTRIBUTE_UNUSED, + int numaux ATTRIBUTE_UNUSED, + void * extp) { union internal_auxent *in = (union internal_auxent *) inp; AUXENT *ext = (AUXENT *) extp; - memset ((PTR) ext, 0, AUXESZ); + memset (ext, 0, AUXESZ); + switch (class) { case C_FILE: @@ -396,10 +360,7 @@ _bfd_XXi_swap_aux_out (abfd, inp, type, class, indx, numaux, extp) } void -_bfd_XXi_swap_lineno_in (abfd, ext1, in1) - bfd *abfd; - PTR ext1; - PTR in1; +_bfd_XXi_swap_lineno_in (bfd * abfd, void * ext1, void * in1) { LINENO *ext = (LINENO *) ext1; struct internal_lineno *in = (struct internal_lineno *) in1; @@ -409,10 +370,7 @@ _bfd_XXi_swap_lineno_in (abfd, ext1, in1) } unsigned int -_bfd_XXi_swap_lineno_out (abfd, inp, outp) - bfd *abfd; - PTR inp; - PTR outp; +_bfd_XXi_swap_lineno_out (bfd * abfd, void * inp, void * outp) { struct internal_lineno *in = (struct internal_lineno *) inp; struct external_lineno *ext = (struct external_lineno *) outp; @@ -423,14 +381,13 @@ _bfd_XXi_swap_lineno_out (abfd, inp, outp) } void -_bfd_XXi_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1) - bfd *abfd; - PTR aouthdr_ext1; - PTR aouthdr_int1; +_bfd_XXi_swap_aouthdr_in (bfd * abfd, + void * aouthdr_ext1, + void * aouthdr_int1) { struct internal_extra_pe_aouthdr *a; - PEAOUTHDR *src = (PEAOUTHDR *) (aouthdr_ext1); - AOUTHDR *aouthdr_ext = (AOUTHDR *) aouthdr_ext1; + PEAOUTHDR * src = (PEAOUTHDR *) (aouthdr_ext1); + AOUTHDR * aouthdr_ext = (AOUTHDR *) aouthdr_ext1; struct internal_aouthdr *aouthdr_int = (struct internal_aouthdr *)aouthdr_int1; aouthdr_int->magic = H_GET_16 (abfd, aouthdr_ext->magic); @@ -442,7 +399,7 @@ _bfd_XXi_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1) aouthdr_int->text_start = GET_AOUTHDR_TEXT_START (abfd, aouthdr_ext->text_start); #ifndef COFF_WITH_pep - /* PE32+ does not have data_start member! */ + /* PE32+ does not have data_start member! */ aouthdr_int->data_start = GET_AOUTHDR_DATA_START (abfd, aouthdr_ext->data_start); #endif @@ -511,7 +468,7 @@ _bfd_XXi_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1) } #ifndef COFF_WITH_pep - /* PE32+ does not have data_start member! */ + /* PE32+ does not have data_start member! */ if (aouthdr_int->dsize) { aouthdr_int->data_start += a->ImageBase; @@ -532,12 +489,11 @@ _bfd_XXi_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1) /* A support function for below. */ static void -add_data_entry (abfd, aout, idx, name, base) - bfd *abfd; - struct internal_extra_pe_aouthdr *aout; - int idx; - char *name; - bfd_vma base; +add_data_entry (bfd * abfd, + struct internal_extra_pe_aouthdr *aout, + int idx, + char *name, + bfd_vma base) { asection *sec = bfd_get_section_by_name (abfd, name); @@ -560,10 +516,7 @@ add_data_entry (abfd, aout, idx, name, base) } unsigned int -_bfd_XXi_swap_aouthdr_out (abfd, in, out) - bfd *abfd; - PTR in; - PTR out; +_bfd_XXi_swap_aouthdr_out (bfd * abfd, void * in, void * out) { struct internal_aouthdr *aouthdr_in = (struct internal_aouthdr *) in; pe_data_type *pe = pe_data (abfd); @@ -658,14 +611,19 @@ _bfd_XXi_swap_aouthdr_out (abfd, in, out) { asection *sec; + bfd_vma hsize = 0; bfd_vma dsize = 0; - bfd_vma isize = SA(abfd->sections->filepos); + bfd_vma isize = 0; bfd_vma tsize = 0; for (sec = abfd->sections; sec; sec = sec->next) { - int rounded = FA(sec->_raw_size); + int rounded = FA (sec->size); + /* The first non-zero section filepos is the header size. + Sections without contents will have a filepos of 0. */ + if (hsize == 0) + hsize = sec->filepos; if (sec->flags & SEC_DATA) dsize += rounded; if (sec->flags & SEC_CODE) @@ -682,10 +640,10 @@ _bfd_XXi_swap_aouthdr_out (abfd, in, out) aouthdr_in->dsize = dsize; aouthdr_in->tsize = tsize; - extra->SizeOfImage = isize; + extra->SizeOfHeaders = hsize; + extra->SizeOfImage = SA (hsize) + isize; } - extra->SizeOfHeaders = abfd->sections->filepos; H_PUT_16 (abfd, aouthdr_in->magic, aouthdr_out->standard.magic); #define LINKER_VERSION 256 /* That is, 2.56 */ @@ -754,10 +712,7 @@ _bfd_XXi_swap_aouthdr_out (abfd, in, out) } unsigned int -_bfd_XXi_only_swap_filehdr_out (abfd, in, out) - bfd *abfd; - PTR in; - PTR out; +_bfd_XXi_only_swap_filehdr_out (bfd * abfd, void * in, void * out) { int idx; struct internal_filehdr *filehdr_in = (struct internal_filehdr *) in; @@ -865,10 +820,7 @@ _bfd_XXi_only_swap_filehdr_out (abfd, in, out) } unsigned int -_bfd_XX_only_swap_filehdr_out (abfd, in, out) - bfd *abfd; - PTR in; - PTR out; +_bfd_XX_only_swap_filehdr_out (bfd * abfd, void * in, void * out) { struct internal_filehdr *filehdr_in = (struct internal_filehdr *) in; FILHDR *filehdr_out = (FILHDR *) out; @@ -885,10 +837,7 @@ _bfd_XX_only_swap_filehdr_out (abfd, in, out) } unsigned int -_bfd_XXi_swap_scnhdr_out (abfd, in, out) - bfd *abfd; - PTR in; - PTR out; +_bfd_XXi_swap_scnhdr_out (bfd * abfd, void * in, void * out) { struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in; SCNHDR *scnhdr_ext = (SCNHDR *) out; @@ -983,7 +932,6 @@ _bfd_XXi_swap_scnhdr_out (abfd, in, out) }; pe_required_section_flags * p; - int flags = scnhdr_int->s_flags; /* We have defaulted to adding the IMAGE_SCN_MEM_WRITE flag, but now we know exactly what this specific section wants so we remove it @@ -998,12 +946,12 @@ _bfd_XXi_swap_scnhdr_out (abfd, in, out) { if (strcmp (scnhdr_int->s_name, ".text") || (bfd_get_file_flags (abfd) & WP_TEXT)) - flags &= ~IMAGE_SCN_MEM_WRITE; - flags |= p->must_have; + scnhdr_int->s_flags &= ~IMAGE_SCN_MEM_WRITE; + scnhdr_int->s_flags |= p->must_have; break; } - H_PUT_32 (abfd, flags, scnhdr_ext->s_flags); + H_PUT_32 (abfd, scnhdr_int->s_flags, scnhdr_ext->s_flags); } if (coff_data (abfd)->link_info @@ -1048,38 +996,30 @@ _bfd_XXi_swap_scnhdr_out (abfd, in, out) H_PUT_16 (abfd, 0xffff, scnhdr_ext->s_nreloc); scnhdr_int->s_flags |= IMAGE_SCN_LNK_NRELOC_OVFL; H_PUT_32 (abfd, scnhdr_int->s_flags, scnhdr_ext->s_flags); -#if 0 - (*_bfd_error_handler) (_("%s: reloc overflow 1: 0x%lx > 0xffff"), - bfd_get_filename (abfd), - scnhdr_int->s_nreloc); - bfd_set_error (bfd_error_file_truncated); - H_PUT_16 (abfd, 0xffff, scnhdr_ext->s_nreloc); - ret = 0; -#endif } } return ret; } static char * dir_names[IMAGE_NUMBEROF_DIRECTORY_ENTRIES] = - { - N_("Export Directory [.edata (or where ever we found it)]"), - N_("Import Directory [parts of .idata]"), - N_("Resource Directory [.rsrc]"), - N_("Exception Directory [.pdata]"), - N_("Security Directory"), - N_("Base Relocation Directory [.reloc]"), - N_("Debug Directory"), - N_("Description Directory"), - N_("Special Directory"), - N_("Thread Storage Directory [.tls]"), - N_("Load Configuration Directory"), - N_("Bound Import Directory"), - N_("Import Address Table Directory"), - N_("Delay Import Directory"), - N_("Reserved"), - N_("Reserved") - }; +{ + N_("Export Directory [.edata (or where ever we found it)]"), + N_("Import Directory [parts of .idata]"), + N_("Resource Directory [.rsrc]"), + N_("Exception Directory [.pdata]"), + N_("Security Directory"), + N_("Base Relocation Directory [.reloc]"), + N_("Debug Directory"), + N_("Description Directory"), + N_("Special Directory"), + N_("Thread Storage Directory [.tls]"), + N_("Load Configuration Directory"), + N_("Bound Import Directory"), + N_("Import Address Table Directory"), + N_("Delay Import Directory"), + N_("Reserved"), + N_("Reserved") +}; #ifdef POWERPC_LE_PE /* The code for the PPC really falls in the "architecture dependent" @@ -1090,9 +1030,7 @@ static char * dir_names[IMAGE_NUMBEROF_DIRECTORY_ENTRIES] = #endif static bfd_boolean -pe_print_idata (abfd, vfile) - bfd *abfd; - PTR vfile; +pe_print_idata (bfd * abfd, void * vfile) { FILE *file = (FILE *) vfile; bfd_byte *data; @@ -1106,7 +1044,6 @@ pe_print_idata (abfd, vfile) bfd_size_type datasize = 0; bfd_size_type dataoff; bfd_size_type i; - bfd_size_type amt; int onaline = 20; pe_data_type *pe = pe_data (abfd); @@ -1124,7 +1061,7 @@ pe_print_idata (abfd, vfile) return TRUE; addr = section->vma; - datasize = bfd_section_size (abfd, section); + datasize = section->size; if (datasize == 0) return TRUE; } @@ -1133,7 +1070,7 @@ pe_print_idata (abfd, vfile) addr += extra->ImageBase; for (section = abfd->sections; section != NULL; section = section->next) { - datasize = bfd_section_size (abfd, section); + datasize = section->size; if (addr >= section->vma && addr < section->vma + datasize) break; } @@ -1153,7 +1090,7 @@ pe_print_idata (abfd, vfile) datasize -= dataoff; #ifdef POWERPC_LE_PE - if (rel_section != 0 && bfd_section_size (abfd, rel_section) != 0) + if (rel_section != 0 && rel_section->size != 0) { /* The toc address can be found by taking the starting address, which on the PPC locates a function descriptor. The @@ -1165,19 +1102,25 @@ pe_print_idata (abfd, vfile) bfd_vma loadable_toc_address; bfd_vma toc_address; bfd_vma start_address; - bfd_byte *data = 0; - int offset; + bfd_byte *data; + bfd_vma offset; - amt = bfd_section_size (abfd, rel_section); - data = (bfd_byte *) bfd_malloc (amt); - if (data == NULL && amt != 0) - return FALSE; - - bfd_get_section_contents (abfd, rel_section, (PTR) data, (bfd_vma) 0, - amt); + if (!bfd_malloc_and_get_section (abfd, rel_section, &data)) + { + if (data != NULL) + free (data); + return FALSE; + } offset = abfd->start_address - rel_section->vma; + if (offset >= rel_section->size || offset + 8 > rel_section->size) + { + if (data != NULL) + free (data); + return FALSE; + } + start_address = bfd_get_32 (abfd, data + offset); loadable_toc_address = bfd_get_32 (abfd, data + offset + 4); toc_address = loadable_toc_address - 32768; @@ -1188,6 +1131,8 @@ pe_print_idata (abfd, vfile) fprintf (file, _("\tcode-base %08lx toc (loadable/actual) %08lx/%08lx\n"), start_address, loadable_toc_address, toc_address); + if (data != NULL) + free (data); } else { @@ -1204,14 +1149,13 @@ pe_print_idata (abfd, vfile) vma: Hint Time Forward DLL First\n\ Table Stamp Chain Name Thunk\n")); - amt = dataoff + datasize; - data = (bfd_byte *) bfd_malloc (amt); - if (data == NULL) - return FALSE; - /* Read the whole section. Some of the fields might be before dataoff. */ - if (! bfd_get_section_contents (abfd, section, (PTR) data, (bfd_vma) 0, amt)) - return FALSE; + if (!bfd_malloc_and_get_section (abfd, section, &data)) + { + if (data != NULL) + free (data); + return FALSE; + } adj = section->vma - extra->ImageBase; @@ -1229,11 +1173,6 @@ pe_print_idata (abfd, vfile) /* Print (i + extra->DataDirectory[1].VirtualAddress). */ fprintf (file, " %08lx\t", (unsigned long) (i + adj + dataoff)); -#if 0 - if (i + 20 > datasize) - /* Check stuff. */ - ; -#endif hint_addr = bfd_get_32 (abfd, data + i + dataoff); time_stamp = bfd_get_32 (abfd, data + i + 4 + dataoff); forward_chain = bfd_get_32 (abfd, data + i + 8 + dataoff); @@ -1250,6 +1189,9 @@ pe_print_idata (abfd, vfile) if (hint_addr == 0 && first_thunk == 0) break; + if (dll_name - adj >= section->size) + break; + dll = (char *) data + dll_name - adj; fprintf (file, _("\n\tDLL Name: %s\n"), dll); @@ -1278,7 +1220,7 @@ pe_print_idata (abfd, vfile) ft_section != NULL; ft_section = ft_section->next) { - ft_datasize = bfd_section_size (abfd, ft_section); + ft_datasize = ft_section->size; if (ft_addr >= ft_section->vma && ft_addr < ft_section->vma + ft_datasize) break; @@ -1301,15 +1243,13 @@ pe_print_idata (abfd, vfile) else { ft_idx = first_thunk - (ft_section->vma - extra->ImageBase); - ft_data = (bfd_byte *) bfd_malloc (datasize); + ft_data = bfd_malloc (datasize); if (ft_data == NULL) continue; /* Read datasize bfd_bytes starting at offset ft_idx. */ - if (! bfd_get_section_contents (abfd, ft_section, - (PTR) ft_data, - (bfd_vma) ft_idx, - datasize)) + if (! bfd_get_section_contents + (abfd, ft_section, ft_data, (bfd_vma) ft_idx, datasize)) { free (ft_data); continue; @@ -1367,9 +1307,7 @@ pe_print_idata (abfd, vfile) } static bfd_boolean -pe_print_edata (abfd, vfile) - bfd *abfd; - PTR vfile; +pe_print_edata (bfd * abfd, void * vfile) { FILE *file = (FILE *) vfile; bfd_byte *data; @@ -1380,17 +1318,17 @@ pe_print_edata (abfd, vfile) bfd_signed_vma adj; struct EDT_type { - long export_flags; /* reserved - should be zero */ + long export_flags; /* Reserved - should be zero. */ long time_stamp; short major_ver; short minor_ver; - bfd_vma name; /* rva - relative to image base */ - long base; /* ordinal base */ - unsigned long num_functions;/* Number in the export address table */ - unsigned long num_names; /* Number in the name pointer table */ - bfd_vma eat_addr; /* rva to the export address table */ - bfd_vma npt_addr; /* rva to the Export Name Pointer Table */ - bfd_vma ot_addr; /* rva to the Ordinal Table */ + bfd_vma name; /* RVA - relative to image base. */ + long base; /* Ordinal base. */ + unsigned long num_functions;/* Number in the export address table. */ + unsigned long num_names; /* Number in the name pointer table. */ + bfd_vma eat_addr; /* RVA to the export address table. */ + bfd_vma npt_addr; /* RVA to the Export Name Pointer Table. */ + bfd_vma ot_addr; /* RVA to the Ordinal Table. */ } edt; pe_data_type *pe = pe_data (abfd); @@ -1408,7 +1346,8 @@ pe_print_edata (abfd, vfile) return TRUE; addr = section->vma; - datasize = bfd_section_size (abfd, section); + dataoff = 0; + datasize = section->size; if (datasize == 0) return TRUE; } @@ -1417,12 +1356,8 @@ pe_print_edata (abfd, vfile) addr += extra->ImageBase; for (section = abfd->sections; section != NULL; section = section->next) - { - datasize = bfd_section_size (abfd, section); - - if (addr >= section->vma && addr < section->vma + datasize) - break; - } + if (addr >= section->vma && addr < section->vma + section->size) + break; if (section == NULL) { @@ -1430,19 +1365,26 @@ pe_print_edata (abfd, vfile) _("\nThere is an export table, but the section containing it could not be found\n")); return TRUE; } + + dataoff = addr - section->vma; + datasize = extra->DataDirectory[0].Size; + if (datasize > section->size - dataoff) + { + fprintf (file, + _("\nThere is an export table in %s, but it does not fit into that section\n"), + section->name); + return TRUE; + } } fprintf (file, _("\nThere is an export table in %s at 0x%lx\n"), section->name, (unsigned long) addr); - dataoff = addr - section->vma; - datasize -= dataoff; - - data = (bfd_byte *) bfd_malloc (datasize); + data = bfd_malloc (datasize); if (data == NULL) return FALSE; - if (! bfd_get_section_contents (abfd, section, (PTR) data, + if (! bfd_get_section_contents (abfd, section, data, (file_ptr) dataoff, datasize)) return FALSE; @@ -1519,8 +1461,7 @@ pe_print_edata (abfd, vfile) { long export_rva; long forwarder_rva; - } export_address_table_entry; - */ + } export_address_table_entry; */ fprintf (file, _("\nExport Address Table -- Ordinal Base %ld\n"), @@ -1590,9 +1531,7 @@ pe_print_edata (abfd, vfile) covers and the address of the corresponding unwind info data. */ static bfd_boolean -pe_print_pdata (abfd, vfile) - bfd *abfd; - PTR vfile; +pe_print_pdata (bfd * abfd, void * vfile) { #ifdef COFF_WITH_pep # define PDATA_ROW_SIZE (3*8) @@ -1629,16 +1568,16 @@ pe_print_pdata (abfd, vfile) \t\tAddress Address Handler Data Address Mask\n")); #endif - datasize = bfd_section_size (abfd, section); + datasize = section->size; if (datasize == 0) return TRUE; - data = (bfd_byte *) bfd_malloc (datasize); - if (data == NULL && datasize != 0) - return FALSE; - - bfd_get_section_contents (abfd, section, (PTR) data, (bfd_vma) 0, - datasize); + if (! bfd_malloc_and_get_section (abfd, section, &data)) + { + if (data != NULL) + free (data); + return FALSE; + } start = 0; @@ -1685,12 +1624,12 @@ pe_print_pdata (abfd, vfile) if (eh_handler == 0 && eh_data != 0) { /* Special bits here, although the meaning may be a little - mysterious. The only one I know for sure is 0x03. */ - /* Code Significance */ - /* 0x00 None */ - /* 0x01 Register Save Millicode */ - /* 0x02 Register Restore Millicode */ - /* 0x03 Glue Code Sequence */ + mysterious. The only one I know for sure is 0x03 + Code Significance + 0x00 None + 0x01 Register Save Millicode + 0x02 Register Restore Millicode + 0x03 Glue Code Sequence. */ switch (eh_data) { case 0x01: @@ -1717,26 +1656,24 @@ pe_print_pdata (abfd, vfile) #define IMAGE_REL_BASED_HIGHADJ 4 static const char * const tbl[] = - { - "ABSOLUTE", - "HIGH", - "LOW", - "HIGHLOW", - "HIGHADJ", - "MIPS_JMPADDR", - "SECTION", - "REL32", - "RESERVED1", - "MIPS_JMPADDR16", - "DIR64", - "HIGH3ADJ" - "UNKNOWN", /* MUST be last */ - }; +{ + "ABSOLUTE", + "HIGH", + "LOW", + "HIGHLOW", + "HIGHADJ", + "MIPS_JMPADDR", + "SECTION", + "REL32", + "RESERVED1", + "MIPS_JMPADDR16", + "DIR64", + "HIGH3ADJ", + "UNKNOWN", /* MUST be last. */ +}; static bfd_boolean -pe_print_reloc (abfd, vfile) - bfd *abfd; - PTR vfile; +pe_print_reloc (bfd * abfd, void * vfile) { FILE *file = (FILE *) vfile; bfd_byte *data = 0; @@ -1748,23 +1685,23 @@ pe_print_reloc (abfd, vfile) if (section == NULL) return TRUE; - if (bfd_section_size (abfd, section) == 0) + if (section->size == 0) return TRUE; fprintf (file, _("\n\nPE File Base Relocations (interpreted .reloc section contents)\n")); - datasize = bfd_section_size (abfd, section); - data = (bfd_byte *) bfd_malloc (datasize); - if (data == NULL && datasize != 0) - return FALSE; - - bfd_get_section_contents (abfd, section, (PTR) data, (bfd_vma) 0, - datasize); + datasize = section->size; + if (! bfd_malloc_and_get_section (abfd, section, &data)) + { + if (data != NULL) + free (data); + return FALSE; + } start = 0; - stop = bfd_section_size (abfd, section); + stop = section->size; for (i = start; i < stop;) { @@ -1822,9 +1759,7 @@ pe_print_reloc (abfd, vfile) /* Print out the program headers. */ bfd_boolean -_bfd_XX_print_private_bfd_data_common (abfd, vfile) - bfd *abfd; - PTR vfile; +_bfd_XX_print_private_bfd_data_common (bfd * abfd, void * vfile) { FILE *file = (FILE *) vfile; int j; @@ -1838,16 +1773,17 @@ _bfd_XX_print_private_bfd_data_common (abfd, vfile) fprintf (file, _("\nCharacteristics 0x%x\n"), pe->real_flags); #undef PF #define PF(x, y) if (pe->real_flags & x) { fprintf (file, "\t%s\n", y); } - PF (F_RELFLG, "relocations stripped"); - PF (F_EXEC, "executable"); - PF (F_LNNO, "line numbers stripped"); - PF (F_LSYMS, "symbols stripped"); - PF (0x80, "little endian"); - PF (F_AR32WR, "32 bit words"); - PF (0x200, "debugging information removed"); - PF (0x1000, "system file"); - PF (F_DLL, "DLL"); - PF (0x8000, "big endian"); + PF (IMAGE_FILE_RELOCS_STRIPPED, "relocations stripped"); + PF (IMAGE_FILE_EXECUTABLE_IMAGE, "executable"); + PF (IMAGE_FILE_LINE_NUMS_STRIPPED, "line numbers stripped"); + PF (IMAGE_FILE_LOCAL_SYMS_STRIPPED, "symbols stripped"); + PF (IMAGE_FILE_LARGE_ADDRESS_AWARE, "large address aware"); + PF (IMAGE_FILE_BYTES_REVERSED_LO, "little endian"); + PF (IMAGE_FILE_32BIT_MACHINE, "32 bit words"); + PF (IMAGE_FILE_DEBUG_STRIPPED, "debugging information removed"); + PF (IMAGE_FILE_SYSTEM, "system file"); + PF (IMAGE_FILE_DLL, "DLL"); + PF (IMAGE_FILE_BYTES_REVERSED_HI, "big endian"); #undef PF /* ctime implies '\n'. */ @@ -1939,8 +1875,7 @@ _bfd_XX_print_private_bfd_data_common (abfd, vfile) to the output bfd. */ bfd_boolean -_bfd_XX_bfd_copy_private_bfd_data_common (ibfd, obfd) - bfd *ibfd, *obfd; +_bfd_XX_bfd_copy_private_bfd_data_common (bfd * ibfd, bfd * obfd) { /* One day we may try to grok other private data. */ if (ibfd->xvec->flavour != bfd_target_coff_flavour @@ -1963,11 +1898,10 @@ _bfd_XX_bfd_copy_private_bfd_data_common (ibfd, obfd) /* Copy private section data. */ bfd_boolean -_bfd_XX_bfd_copy_private_section_data (ibfd, isec, obfd, osec) - bfd *ibfd; - asection *isec; - bfd *obfd; - asection *osec; +_bfd_XX_bfd_copy_private_section_data (bfd *ibfd, + asection *isec, + bfd *obfd, + asection *osec) { if (bfd_get_flavour (ibfd) != bfd_target_coff_flavour || bfd_get_flavour (obfd) != bfd_target_coff_flavour) @@ -1979,7 +1913,7 @@ _bfd_XX_bfd_copy_private_section_data (ibfd, isec, obfd, osec) if (coff_section_data (obfd, osec) == NULL) { bfd_size_type amt = sizeof (struct coff_section_tdata); - osec->used_by_bfd = (PTR) bfd_zalloc (obfd, amt); + osec->used_by_bfd = bfd_zalloc (obfd, amt); if (osec->used_by_bfd == NULL) return FALSE; } @@ -1987,7 +1921,7 @@ _bfd_XX_bfd_copy_private_section_data (ibfd, isec, obfd, osec) if (pei_section_data (obfd, osec) == NULL) { bfd_size_type amt = sizeof (struct pei_section_tdata); - coff_section_data (obfd, osec)->tdata = (PTR) bfd_zalloc (obfd, amt); + coff_section_data (obfd, osec)->tdata = bfd_zalloc (obfd, amt); if (coff_section_data (obfd, osec)->tdata == NULL) return FALSE; } @@ -2002,29 +1936,16 @@ _bfd_XX_bfd_copy_private_section_data (ibfd, isec, obfd, osec) } void -_bfd_XX_get_symbol_info (abfd, symbol, ret) - bfd *abfd; - asymbol *symbol; - symbol_info *ret; +_bfd_XX_get_symbol_info (bfd * abfd, asymbol *symbol, symbol_info *ret) { coff_get_symbol_info (abfd, symbol, ret); -#if 0 /* This code no longer appears to be necessary. - ImageBase has already been added in by coff_swap_scnhdr_in. */ - if (pe_data (abfd) != NULL - && ((symbol->flags & BSF_DEBUGGING) == 0 - || (symbol->flags & BSF_DEBUGGING_RELOC) != 0) - && ! bfd_is_abs_section (symbol->section)) - ret->value += pe_data (abfd)->pe_opthdr.ImageBase; -#endif } /* Handle the .idata section and other things that need symbol table access. */ bfd_boolean -_bfd_XXi_final_link_postscript (abfd, pfinfo) - bfd *abfd; - struct coff_final_link_info *pfinfo; +_bfd_XXi_final_link_postscript (bfd * abfd, struct coff_final_link_info *pfinfo) { struct coff_link_hash_entry *h1; struct bfd_link_info *info = pfinfo->info; diff --git a/contrib/binutils/bfd/pei-mips.c b/contrib/binutils/bfd/pei-mips.c index 976b2f995e0..0c9b962f2b6 100644 --- a/contrib/binutils/bfd/pei-mips.c +++ b/contrib/binutils/bfd/pei-mips.c @@ -15,7 +15,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" diff --git a/contrib/binutils/bfd/peicode.h b/contrib/binutils/bfd/peicode.h index 41445e592c3..2061f415af6 100644 --- a/contrib/binutils/bfd/peicode.h +++ b/contrib/binutils/bfd/peicode.h @@ -1,6 +1,6 @@ /* Support for the generic parts of PE/PEI, for BFD. - Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 - Free Software Foundation, Inc. + Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, + 2005 Free Software Foundation, Inc. Written by Cygnus Solutions. This file is part of BFD, the Binary File Descriptor library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* Most of this hacked by Steve Chamberlain, sac@cygnus.com @@ -55,8 +55,7 @@ #include "libpei.h" -static bfd_boolean (*pe_saved_coff_bfd_print_private_bfd_data) - PARAMS ((bfd *, PTR)) = +static bfd_boolean (*pe_saved_coff_bfd_print_private_bfd_data) (bfd *, void *) = #ifndef coff_bfd_print_private_bfd_data NULL; #else @@ -64,11 +63,10 @@ static bfd_boolean (*pe_saved_coff_bfd_print_private_bfd_data) #undef coff_bfd_print_private_bfd_data #endif -static bfd_boolean pe_print_private_bfd_data PARAMS ((bfd *, PTR)); +static bfd_boolean pe_print_private_bfd_data (bfd *, void *); #define coff_bfd_print_private_bfd_data pe_print_private_bfd_data -static bfd_boolean (*pe_saved_coff_bfd_copy_private_bfd_data) - PARAMS ((bfd *, bfd *)) = +static bfd_boolean (*pe_saved_coff_bfd_copy_private_bfd_data) (bfd *, bfd *) = #ifndef coff_bfd_copy_private_bfd_data NULL; #else @@ -76,21 +74,12 @@ static bfd_boolean (*pe_saved_coff_bfd_copy_private_bfd_data) #undef coff_bfd_copy_private_bfd_data #endif -static bfd_boolean pe_bfd_copy_private_bfd_data PARAMS ((bfd *, bfd *)); +static bfd_boolean pe_bfd_copy_private_bfd_data (bfd *, bfd *); #define coff_bfd_copy_private_bfd_data pe_bfd_copy_private_bfd_data #define coff_mkobject pe_mkobject #define coff_mkobject_hook pe_mkobject_hook -#ifndef NO_COFF_RELOCS -static void coff_swap_reloc_in PARAMS ((bfd *, PTR, PTR)); -static unsigned int coff_swap_reloc_out PARAMS ((bfd *, PTR, PTR)); -#endif -static void coff_swap_filehdr_in PARAMS ((bfd *, PTR, PTR)); -static void coff_swap_scnhdr_in PARAMS ((bfd *, PTR, PTR)); -static bfd_boolean pe_mkobject PARAMS ((bfd *)); -static PTR pe_mkobject_hook PARAMS ((bfd *, PTR, PTR)); - #ifdef COFF_IMAGE_WITH_PE /* This structure contains static variables used by the ILF code. */ typedef asection * asection_ptr; @@ -130,76 +119,54 @@ typedef struct struct internal_reloc * int_reltab; } pe_ILF_vars; - -static asection_ptr pe_ILF_make_a_section PARAMS ((pe_ILF_vars *, const char *, unsigned int, flagword)); -static void pe_ILF_make_a_reloc PARAMS ((pe_ILF_vars *, bfd_vma, bfd_reloc_code_real_type, asection_ptr)); -static void pe_ILF_make_a_symbol PARAMS ((pe_ILF_vars *, const char *, const char *, asection_ptr, flagword)); -static void pe_ILF_save_relocs PARAMS ((pe_ILF_vars *, asection_ptr)); -static void pe_ILF_make_a_symbol_reloc PARAMS ((pe_ILF_vars *, bfd_vma, bfd_reloc_code_real_type, struct bfd_symbol **, unsigned int)); -static bfd_boolean pe_ILF_build_a_bfd PARAMS ((bfd *, unsigned int, bfd_byte *, bfd_byte *, unsigned int, unsigned int)); -static const bfd_target * pe_ILF_object_p PARAMS ((bfd *)); -static const bfd_target * pe_bfd_object_p PARAMS ((bfd *)); #endif /* COFF_IMAGE_WITH_PE */ - -/**********************************************************************/ - + #ifndef NO_COFF_RELOCS static void -coff_swap_reloc_in (abfd, src, dst) - bfd *abfd; - PTR src; - PTR dst; +coff_swap_reloc_in (bfd * abfd, void * src, void * dst) { RELOC *reloc_src = (RELOC *) src; struct internal_reloc *reloc_dst = (struct internal_reloc *) dst; - reloc_dst->r_vaddr = H_GET_32 (abfd, reloc_src->r_vaddr); + reloc_dst->r_vaddr = H_GET_32 (abfd, reloc_src->r_vaddr); reloc_dst->r_symndx = H_GET_S32 (abfd, reloc_src->r_symndx); - - reloc_dst->r_type = H_GET_16 (abfd, reloc_src->r_type); - + reloc_dst->r_type = H_GET_16 (abfd, reloc_src->r_type); #ifdef SWAP_IN_RELOC_OFFSET reloc_dst->r_offset = SWAP_IN_RELOC_OFFSET (abfd, reloc_src->r_offset); #endif } static unsigned int -coff_swap_reloc_out (abfd, src, dst) - bfd *abfd; - PTR src; - PTR dst; +coff_swap_reloc_out (bfd * abfd, void * src, void * dst) { - struct internal_reloc *reloc_src = (struct internal_reloc *)src; - struct external_reloc *reloc_dst = (struct external_reloc *)dst; + struct internal_reloc *reloc_src = (struct internal_reloc *) src; + struct external_reloc *reloc_dst = (struct external_reloc *) dst; + H_PUT_32 (abfd, reloc_src->r_vaddr, reloc_dst->r_vaddr); H_PUT_32 (abfd, reloc_src->r_symndx, reloc_dst->r_symndx); - H_PUT_16 (abfd, reloc_src->r_type, reloc_dst->r_type); -#ifdef SWAP_OUT_RELOC_OFFSET +#ifdef SWAP_OUT_RELOC_OFFSET SWAP_OUT_RELOC_OFFSET (abfd, reloc_src->r_offset, reloc_dst->r_offset); #endif #ifdef SWAP_OUT_RELOC_EXTRA - SWAP_OUT_RELOC_EXTRA(abfd, reloc_src, reloc_dst); + SWAP_OUT_RELOC_EXTRA (abfd, reloc_src, reloc_dst); #endif return RELSZ; } #endif /* not NO_COFF_RELOCS */ static void -coff_swap_filehdr_in (abfd, src, dst) - bfd *abfd; - PTR src; - PTR dst; +coff_swap_filehdr_in (bfd * abfd, void * src, void * dst) { FILHDR *filehdr_src = (FILHDR *) src; struct internal_filehdr *filehdr_dst = (struct internal_filehdr *) dst; - filehdr_dst->f_magic = H_GET_16 (abfd, filehdr_src->f_magic); - filehdr_dst->f_nscns = H_GET_16 (abfd, filehdr_src-> f_nscns); - filehdr_dst->f_timdat = H_GET_32 (abfd, filehdr_src-> f_timdat); - filehdr_dst->f_nsyms = H_GET_32 (abfd, filehdr_src-> f_nsyms); - filehdr_dst->f_flags = H_GET_16 (abfd, filehdr_src-> f_flags); + filehdr_dst->f_magic = H_GET_16 (abfd, filehdr_src->f_magic); + filehdr_dst->f_nscns = H_GET_16 (abfd, filehdr_src->f_nscns); + filehdr_dst->f_timdat = H_GET_32 (abfd, filehdr_src->f_timdat); + filehdr_dst->f_nsyms = H_GET_32 (abfd, filehdr_src->f_nsyms); + filehdr_dst->f_flags = H_GET_16 (abfd, filehdr_src->f_flags); filehdr_dst->f_symptr = H_GET_32 (abfd, filehdr_src->f_symptr); /* Other people's tools sometimes generate headers with an nsyms but @@ -220,22 +187,20 @@ coff_swap_filehdr_in (abfd, src, dst) #endif static void -coff_swap_scnhdr_in (abfd, ext, in) - bfd *abfd; - PTR ext; - PTR in; +coff_swap_scnhdr_in (bfd * abfd, void * ext, void * in) { SCNHDR *scnhdr_ext = (SCNHDR *) ext; struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in; - memcpy(scnhdr_int->s_name, scnhdr_ext->s_name, sizeof (scnhdr_int->s_name)); - scnhdr_int->s_vaddr = GET_SCNHDR_VADDR (abfd, scnhdr_ext->s_vaddr); - scnhdr_int->s_paddr = GET_SCNHDR_PADDR (abfd, scnhdr_ext->s_paddr); - scnhdr_int->s_size = GET_SCNHDR_SIZE (abfd, scnhdr_ext->s_size); - scnhdr_int->s_scnptr = GET_SCNHDR_SCNPTR (abfd, scnhdr_ext->s_scnptr); - scnhdr_int->s_relptr = GET_SCNHDR_RELPTR (abfd, scnhdr_ext->s_relptr); + memcpy (scnhdr_int->s_name, scnhdr_ext->s_name, sizeof (scnhdr_int->s_name)); + + scnhdr_int->s_vaddr = GET_SCNHDR_VADDR (abfd, scnhdr_ext->s_vaddr); + scnhdr_int->s_paddr = GET_SCNHDR_PADDR (abfd, scnhdr_ext->s_paddr); + scnhdr_int->s_size = GET_SCNHDR_SIZE (abfd, scnhdr_ext->s_size); + scnhdr_int->s_scnptr = GET_SCNHDR_SCNPTR (abfd, scnhdr_ext->s_scnptr); + scnhdr_int->s_relptr = GET_SCNHDR_RELPTR (abfd, scnhdr_ext->s_relptr); scnhdr_int->s_lnnoptr = GET_SCNHDR_LNNOPTR (abfd, scnhdr_ext->s_lnnoptr); - scnhdr_int->s_flags = H_GET_32 (abfd, scnhdr_ext->s_flags); + scnhdr_int->s_flags = H_GET_32 (abfd, scnhdr_ext->s_flags); /* MS handles overflow of line numbers by carrying into the reloc field (it appears). Since it's supposed to be zero for PE @@ -264,20 +229,16 @@ coff_swap_scnhdr_in (abfd, ext, in) && (((scnhdr_int->s_flags & IMAGE_SCN_CNT_UNINITIALIZED_DATA) != 0 && (! bfd_pe_executable_p (abfd) || scnhdr_int->s_size == 0)) || (bfd_pe_executable_p (abfd) && scnhdr_int->s_size > scnhdr_int->s_paddr))) - { - scnhdr_int->s_size = scnhdr_int->s_paddr; - - /* This code used to set scnhdr_int->s_paddr to 0. However, - coff_set_alignment_hook stores s_paddr in virt_size, which - only works if it correctly holds the virtual size of the - section. */ - } + /* This code used to set scnhdr_int->s_paddr to 0. However, + coff_set_alignment_hook stores s_paddr in virt_size, which + only works if it correctly holds the virtual size of the + section. */ + scnhdr_int->s_size = scnhdr_int->s_paddr; #endif } static bfd_boolean -pe_mkobject (abfd) - bfd * abfd; +pe_mkobject (bfd * abfd) { pe_data_type *pe; bfd_size_type amt = sizeof (pe_data_type); @@ -305,11 +266,11 @@ pe_mkobject (abfd) } /* Create the COFF backend specific information. */ -static PTR -pe_mkobject_hook (abfd, filehdr, aouthdr) - bfd * abfd; - PTR filehdr; - PTR aouthdr ATTRIBUTE_UNUSED; + +static void * +pe_mkobject_hook (bfd * abfd, + void * filehdr, + void * aouthdr ATTRIBUTE_UNUSED) { struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr; pe_data_type *pe; @@ -346,7 +307,7 @@ pe_mkobject_hook (abfd, filehdr, aouthdr) #ifdef COFF_IMAGE_WITH_PE if (aouthdr) - pe->pe_opthdr = ((struct internal_aouthdr *)aouthdr)->pe; + pe->pe_opthdr = ((struct internal_aouthdr *) aouthdr)->pe; #endif #ifdef ARM @@ -354,36 +315,39 @@ pe_mkobject_hook (abfd, filehdr, aouthdr) coff_data (abfd) ->flags = 0; #endif - return (PTR) pe; + return (void *) pe; } static bfd_boolean -pe_print_private_bfd_data (abfd, vfile) - bfd *abfd; - PTR vfile; +pe_print_private_bfd_data (bfd *abfd, void * vfile) { FILE *file = (FILE *) vfile; if (!_bfd_XX_print_private_bfd_data_common (abfd, vfile)) return FALSE; - if (pe_saved_coff_bfd_print_private_bfd_data != NULL) - { - fputc ('\n', file); + if (pe_saved_coff_bfd_print_private_bfd_data == NULL) + return TRUE; - return pe_saved_coff_bfd_print_private_bfd_data (abfd, vfile); - } + fputc ('\n', file); - return TRUE; + return pe_saved_coff_bfd_print_private_bfd_data (abfd, vfile); } /* Copy any private info we understand from the input bfd to the output bfd. */ static bfd_boolean -pe_bfd_copy_private_bfd_data (ibfd, obfd) - bfd *ibfd, *obfd; +pe_bfd_copy_private_bfd_data (bfd *ibfd, bfd *obfd) { + /* PR binutils/716: Copy the large address aware flag. + XXX: Should we be copying other flags or other fields in the pe_data() + structure ? */ + if (pe_data (obfd) != NULL + && pe_data (ibfd) != NULL + && pe_data (ibfd)->real_flags & IMAGE_FILE_LARGE_ADDRESS_AWARE) + pe_data (obfd)->real_flags |= IMAGE_FILE_LARGE_ADDRESS_AWARE; + if (!_bfd_XX_bfd_copy_private_bfd_data_common (ibfd, obfd)) return FALSE; @@ -429,14 +393,14 @@ pe_bfd_copy_private_bfd_data (ibfd, obfd) #define NUM_ILF_SECTIONS 6 #define NUM_ILF_SYMS (2 + NUM_ILF_SECTIONS) -#define SIZEOF_ILF_SYMS (NUM_ILF_SYMS * sizeof (* vars.sym_cache)) -#define SIZEOF_ILF_SYM_TABLE (NUM_ILF_SYMS * sizeof (* vars.sym_table)) -#define SIZEOF_ILF_NATIVE_SYMS (NUM_ILF_SYMS * sizeof (* vars.native_syms)) +#define SIZEOF_ILF_SYMS (NUM_ILF_SYMS * sizeof (* vars.sym_cache)) +#define SIZEOF_ILF_SYM_TABLE (NUM_ILF_SYMS * sizeof (* vars.sym_table)) +#define SIZEOF_ILF_NATIVE_SYMS (NUM_ILF_SYMS * sizeof (* vars.native_syms)) #define SIZEOF_ILF_SYM_PTR_TABLE (NUM_ILF_SYMS * sizeof (* vars.sym_ptr_table)) -#define SIZEOF_ILF_EXT_SYMS (NUM_ILF_SYMS * sizeof (* vars.esym_table)) -#define SIZEOF_ILF_RELOCS (NUM_ILF_RELOCS * sizeof (* vars.reltab)) -#define SIZEOF_ILF_INT_RELOCS (NUM_ILF_RELOCS * sizeof (* vars.int_reltab)) -#define SIZEOF_ILF_STRINGS (strlen (symbol_name) * 2 + 8 \ +#define SIZEOF_ILF_EXT_SYMS (NUM_ILF_SYMS * sizeof (* vars.esym_table)) +#define SIZEOF_ILF_RELOCS (NUM_ILF_RELOCS * sizeof (* vars.reltab)) +#define SIZEOF_ILF_INT_RELOCS (NUM_ILF_RELOCS * sizeof (* vars.int_reltab)) +#define SIZEOF_ILF_STRINGS (strlen (symbol_name) * 2 + 8 \ + 21 + strlen (source_dll) \ + NUM_ILF_SECTIONS * 9 \ + STRING_SIZE_SIZE) @@ -466,12 +430,13 @@ pe_bfd_copy_private_bfd_data (ibfd, obfd) + MAX_TEXT_SECTION_SIZE /* Create an empty relocation against the given symbol. */ + static void -pe_ILF_make_a_symbol_reloc (pe_ILF_vars * vars, - bfd_vma address, - bfd_reloc_code_real_type reloc, - struct bfd_symbol ** sym, - unsigned int sym_index) +pe_ILF_make_a_symbol_reloc (pe_ILF_vars * vars, + bfd_vma address, + bfd_reloc_code_real_type reloc, + struct bfd_symbol ** sym, + unsigned int sym_index) { arelent * entry; struct internal_reloc * internal; @@ -487,11 +452,6 @@ pe_ILF_make_a_symbol_reloc (pe_ILF_vars * vars, internal->r_vaddr = address; internal->r_symndx = sym_index; internal->r_type = entry->howto->type; -#if 0 /* These fields do not need to be initialised. */ - internal->r_size = 0; - internal->r_extern = 0; - internal->r_offset = 0; -#endif vars->relcount ++; @@ -499,6 +459,7 @@ pe_ILF_make_a_symbol_reloc (pe_ILF_vars * vars, } /* Create an empty relocation against the given section. */ + static void pe_ILF_make_a_reloc (pe_ILF_vars * vars, bfd_vma address, @@ -510,6 +471,7 @@ pe_ILF_make_a_reloc (pe_ILF_vars * vars, } /* Move the queued relocs into the given section. */ + static void pe_ILF_save_relocs (pe_ILF_vars * vars, asection_ptr sec) @@ -534,6 +496,7 @@ pe_ILF_save_relocs (pe_ILF_vars * vars, } /* Create a global symbol and add it to the relevant tables. */ + static void pe_ILF_make_a_symbol (pe_ILF_vars * vars, const char * prefix, @@ -583,39 +546,18 @@ pe_ILF_make_a_symbol (pe_ILF_vars * vars, /* The following initialisations are unnecessary - the memory is zero initialised. They are just kept here as reminders. */ -#if 0 - esym->e.e.e_zeroes = 0; - esym->e_value = 0; - esym->e_type = T_NULL; - esym->e_numaux = 0; -#endif /* Initialise the internal symbol structure. */ ent->u.syment.n_sclass = sclass; ent->u.syment.n_scnum = section->target_index; ent->u.syment._n._n_n._n_offset = (long) sym; -#if 0 /* See comment above. */ - ent->u.syment.n_value = 0; - ent->u.syment.n_flags = 0; - ent->u.syment.n_type = T_NULL; - ent->u.syment.n_numaux = 0; - ent->fix_value = 0; -#endif - sym->symbol.the_bfd = vars->abfd; sym->symbol.name = vars->string_ptr; sym->symbol.flags = BSF_EXPORT | BSF_GLOBAL | extra_flags; sym->symbol.section = section; sym->native = ent; -#if 0 /* See comment above. */ - sym->symbol.value = 0; - sym->symbol.udata.i = 0; - sym->done_lineno = FALSE; - sym->lineno = NULL; -#endif - * vars->table_ptr = vars->sym_index; * vars->sym_ptr_ptr = sym; @@ -632,6 +574,7 @@ pe_ILF_make_a_symbol (pe_ILF_vars * vars, } /* Create a section. */ + static asection_ptr pe_ILF_make_a_section (pe_ILF_vars * vars, const char * name, @@ -755,11 +698,12 @@ static jump_table jtab[] = #endif /* Build a full BFD from the information supplied in a ILF object. */ + static bfd_boolean pe_ILF_build_a_bfd (bfd * abfd, unsigned int magic, - bfd_byte * symbol_name, - bfd_byte * source_dll, + char * symbol_name, + char * source_dll, unsigned int ordinal, unsigned int types) { @@ -784,13 +728,13 @@ pe_ILF_build_a_bfd (bfd * abfd, case IMPORT_CONST: /* XXX code yet to be written. */ - _bfd_error_handler (_("%s: Unhandled import type; %x"), - bfd_archive_filename (abfd), import_type); + _bfd_error_handler (_("%B: Unhandled import type; %x"), + abfd, import_type); return FALSE; default: - _bfd_error_handler (_("%s: Unrecognised import type; %x"), - bfd_archive_filename (abfd), import_type); + _bfd_error_handler (_("%B: Unrecognised import type; %x"), + abfd, import_type); return FALSE; } @@ -803,8 +747,8 @@ pe_ILF_build_a_bfd (bfd * abfd, break; default: - _bfd_error_handler (_("%s: Unrecognised import name type; %x"), - bfd_archive_filename (abfd), import_name_type); + _bfd_error_handler (_("%B: Unrecognised import name type; %x"), + abfd, import_name_type); return FALSE; } @@ -855,10 +799,10 @@ pe_ILF_build_a_bfd (bfd * abfd, vars.int_reltab = (struct internal_reloc *) ptr; ptr += SIZEOF_ILF_INT_RELOCS; - vars.string_table = ptr; - vars.string_ptr = ptr + STRING_SIZE_SIZE; + vars.string_table = (char *) ptr; + vars.string_ptr = (char *) ptr + STRING_SIZE_SIZE; ptr += SIZEOF_ILF_STRINGS; - vars.end_string_ptr = ptr; + vars.end_string_ptr = (char *) ptr; /* The remaining space in bim->buffer is used by the pe_ILF_make_a_section() function. */ @@ -892,6 +836,7 @@ pe_ILF_build_a_bfd (bfd * abfd, else { char * symbol; + unsigned int len; /* Create .idata$6 - the Hint Name Table. */ id6 = pe_ILF_make_a_section (& vars, ".idata$6", SIZEOF_IDATA6, 0); @@ -901,54 +846,35 @@ pe_ILF_build_a_bfd (bfd * abfd, /* If necessary, trim the import symbol name. */ symbol = symbol_name; + /* As used by MS compiler, '_', '@', and '?' are alternative + forms of USER_LABEL_PREFIX, with '?' for c++ mangled names, + '@' used for fastcall (in C), '_' everywhere else. Only one + of these is used for a symbol. We strip this leading char for + IMPORT_NAME_NOPREFIX and IMPORT_NAME_UNDECORATE as per the + PE COFF 6.0 spec (section 8.3, Import Name Type). */ + if (import_name_type != IMPORT_NAME) { - bfd_boolean skipped_leading_underscore = FALSE; - bfd_boolean skipped_leading_at = FALSE; - bfd_boolean skipped_leading_question_mark = FALSE; - bfd_boolean check_again; - - /* Skip any prefix in symbol_name. */ - -- symbol; - do - { - check_again = FALSE; - ++ symbol; - - switch (*symbol) - { - case '@': - if (! skipped_leading_at) - check_again = skipped_leading_at = TRUE; - break; - case '?': - if (! skipped_leading_question_mark) - check_again = skipped_leading_question_mark = TRUE; - break; - case '_': - if (! skipped_leading_underscore) - check_again = skipped_leading_underscore = TRUE; - break; - default: - break; - } - } - while (check_again); + char c = symbol[0]; + if (c == '_' || c == '@' || c == '?') + symbol++; } + len = strlen (symbol); if (import_name_type == IMPORT_NAME_UNDECORATE) { - /* Truncate at the first '@' */ - while (* symbol != 0 && * symbol != '@') - symbol ++; + /* Truncate at the first '@'. */ + char *at = strchr (symbol, '@'); - * symbol = 0; + if (at != NULL) + len = at - symbol; } id6->contents[0] = ordinal & 0xff; id6->contents[1] = ordinal >> 8; - strcpy (id6->contents + 2, symbol); + memcpy ((char *) id6->contents + 2, symbol, len); + id6->contents[len + 2] = '\0'; } if (import_name_type != IMPORT_ORDINAL) @@ -1033,7 +959,7 @@ pe_ILF_build_a_bfd (bfd * abfd, || ! bfd_coff_set_arch_mach_hook (abfd, & internal_f)) return FALSE; - if (bfd_coff_mkobject_hook (abfd, (PTR) & internal_f, NULL) == NULL) + if (bfd_coff_mkobject_hook (abfd, (void *) & internal_f, NULL) == NULL) return FALSE; coff_data (abfd)->pe = 1; @@ -1046,7 +972,7 @@ pe_ILF_build_a_bfd (bfd * abfd, /* Switch from file contents to memory contents. */ bfd_cache_close (abfd); - abfd->iostream = (PTR) vars.bim; + abfd->iostream = (void *) vars.bim; abfd->flags |= BFD_IN_MEMORY /* | HAS_LOCALS */; abfd->where = 0; obj_sym_filepos (abfd) = 0; @@ -1060,7 +986,7 @@ pe_ILF_build_a_bfd (bfd * abfd, /* Create an import symbol for the DLL, without the .dll suffix. */ - ptr = strrchr (source_dll, '.'); + ptr = (bfd_byte *) strrchr (source_dll, '.'); if (ptr) * ptr = 0; pe_ILF_make_a_symbol (& vars, "__IMPORT_DESCRIPTOR_", source_dll, NULL, 0); @@ -1084,7 +1010,7 @@ pe_ILF_build_a_bfd (bfd * abfd, obj_raw_syments (abfd) = vars.native_syms; obj_raw_syment_count (abfd) = vars.sym_index; - obj_coff_external_syms (abfd) = (PTR) vars.esym_table; + obj_coff_external_syms (abfd) = (void *) vars.esym_table; obj_coff_keep_syms (abfd) = TRUE; obj_convert (abfd) = vars.sym_table; @@ -1100,13 +1026,14 @@ pe_ILF_build_a_bfd (bfd * abfd, /* We have detected a Image Library Format archive element. Decode the element and return the appropriate target. */ + static const bfd_target * pe_ILF_object_p (bfd * abfd) { bfd_byte buffer[16]; bfd_byte * ptr; - bfd_byte * symbol_name; - bfd_byte * source_dll; + char * symbol_name; + char * source_dll; unsigned int machine; bfd_size_type size; unsigned int ordinal; @@ -1190,9 +1117,9 @@ pe_ILF_object_p (bfd * abfd) /* We no longer support PowerPC. */ default: _bfd_error_handler - ( -_("%s: Unrecognised machine type (0x%x) in Import Library Format archive"), - bfd_archive_filename (abfd), machine); + (_("%B: Unrecognised machine type (0x%x)" + " in Import Library Format archive"), + abfd, machine); bfd_set_error (bfd_error_malformed_archive); return NULL; @@ -1202,9 +1129,9 @@ _("%s: Unrecognised machine type (0x%x) in Import Library Format archive"), if (magic == 0) { _bfd_error_handler - ( -_("%s: Recognised but unhandled machine type (0x%x) in Import Library Format archive"), - bfd_archive_filename (abfd), machine); + (_("%B: Recognised but unhandled machine type (0x%x)" + " in Import Library Format archive"), + abfd, machine); bfd_set_error (bfd_error_wrong_format); return NULL; @@ -1220,8 +1147,7 @@ _("%s: Recognised but unhandled machine type (0x%x) in Import Library Format arc if (size == 0) { _bfd_error_handler - (_("%s: size field is zero in Import Library Format header"), - bfd_archive_filename (abfd)); + (_("%B: size field is zero in Import Library Format header"), abfd); bfd_set_error (bfd_error_malformed_archive); return NULL; @@ -1244,15 +1170,15 @@ _("%s: Recognised but unhandled machine type (0x%x) in Import Library Format arc return NULL; } - symbol_name = ptr; - source_dll = ptr + strlen (ptr) + 1; + symbol_name = (char *) ptr; + source_dll = symbol_name + strlen (symbol_name) + 1; /* Verify that the strings are null terminated. */ - if (ptr[size - 1] != 0 || ((unsigned long) (source_dll - ptr) >= size)) + if (ptr[size - 1] != 0 + || (bfd_size_type) ((bfd_byte *) source_dll - ptr) >= size) { _bfd_error_handler - (_("%s: string not null terminated in ILF object file."), - bfd_archive_filename (abfd)); + (_("%B: string not null terminated in ILF object file."), abfd); bfd_set_error (bfd_error_malformed_archive); bfd_release (abfd, ptr); return NULL; diff --git a/contrib/binutils/bfd/po/Make-in b/contrib/binutils/bfd/po/Make-in index 1608b2d6272..f11ccb41cef 100644 --- a/contrib/binutils/bfd/po/Make-in +++ b/contrib/binutils/bfd/po/Make-in @@ -1,7 +1,8 @@ # Makefile for program source directory in GNU NLS utilities package. # Copyright (C) 1995, 1996, 1997 by Ulrich Drepper +# Copyright 2001, 2003, 2006 Free Software Foundation, Inc. # -# This file file be copied and used freely without restrictions. It can +# This file may 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. @@ -122,6 +123,7 @@ $(srcdir)/stamp-cat-id: $(PACKAGE).pot install: install-exec install-data install-exec: install-info: +install-html: install-data: install-data-@USE_NLS@ install-data-no: all install-data-yes: all @@ -197,7 +199,7 @@ check: all cat-id-tbl.o: ../intl/libgettext.h -dvi info tags TAGS ID: +html dvi pdf ps info tags TAGS ID: mostlyclean: rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp diff --git a/contrib/binutils/bfd/po/SRC-POTFILES.in b/contrib/binutils/bfd/po/SRC-POTFILES.in index d29593d795b..8bcf979a5bf 100644 --- a/contrib/binutils/bfd/po/SRC-POTFILES.in +++ b/contrib/binutils/bfd/po/SRC-POTFILES.in @@ -23,11 +23,9 @@ binary.c bout.c cache.c cf-i386lynx.c -cf-m68klynx.c cf-sparclynx.c cisco-core.c coff64-rs6000.c -coff-a29k.c coff-alpha.c coff-apollo.c coff-arm.c @@ -43,6 +41,7 @@ coff-i960.c cofflink.c coff-m68k.c coff-m88k.c +coff-maxq.c coff-mips.c coff-or32.c coff-rs6000.c @@ -58,14 +57,17 @@ coff-tic80.c coff-u68k.c coff-w65.c coff-we32k.c +coff-z80.c coff-z8k.c corefile.c -cpu-a29k.c cpu-alpha.c cpu-arc.c cpu-arm.c cpu-avr.c +cpu-bfin.c +cpu-cr16c.c cpu-cris.c +cpu-crx.c cpu-d10v.c cpu-d30v.c cpu-dlx.c @@ -83,15 +85,18 @@ cpu-ip2k.c cpu-iq2000.c cpu-m10200.c cpu-m10300.c +cpu-m32c.c cpu-m32r.c cpu-m68hc11.c cpu-m68hc12.c cpu-m68k.c cpu-m88k.c +cpu-maxq.c cpu-mcore.c cpu-mips.c cpu-mmix.c cpu-msp430.c +cpu-mt.c cpu-ns32k.c cpu-openrisc.c cpu-or32.c @@ -110,8 +115,10 @@ cpu-v850.c cpu-vax.c cpu-w65.c cpu-we32k.c +cpu-xc16x.c cpu-xstormy16.c cpu-xtensa.c +cpu-z80.c cpu-z8k.c demo64.c dwarf1.c @@ -123,10 +130,13 @@ efi-app-ia32.c efi-app-ia64.c elf32-am33lin.c elf32-arc.c -elf32-arm.h +elf32-arm.c elf32-avr.c +elf32-bfin.c elf32.c +elf32-cr16c.c elf32-cris.c +elf32-crx.c elf32-d10v.c elf32-d30v.c elf32-dlx.c @@ -142,6 +152,7 @@ elf32-i860.c elf32-i960.c elf32-ip2k.c elf32-iq2000.c +elf32-m32c.c elf32-m32r.c elf32-m68hc11.c elf32-m68hc12.c @@ -151,6 +162,7 @@ elf32-m88k.c elf32-mcore.c elf32-mips.c elf32-msp430.c +elf32-mt.c elf32-openrisc.c elf32-or32.c elf32-pj.c @@ -159,9 +171,11 @@ elf32-s390.c elf32-sh64.c elf32-sh64-com.c elf32-sh.c +elf32-sh-symbian.c elf32-sparc.c elf32-v850.c elf32-vax.c +elf32-xc16x.c elf32-xstormy16.c elf32-xtensa.c elf64-alpha.c @@ -176,8 +190,6 @@ elf64-s390.c elf64-sh64.c elf64-sparc.c elf64-x86-64.c -elfarm-nabi.c -elfarm-oabi.c elf-bfd.h elf.c elfcode.h @@ -189,7 +201,9 @@ elf-m10200.c elf-m10300.c elfn32-mips.c elf-strtab.c +elf-vxworks.c elfxx-mips.c +elfxx-sparc.c epoc-pe-arm.c epoc-pei-arm.c format.c @@ -229,9 +243,9 @@ linker.c lynx-core.c m68k4knetbsd.c m68klinux.c -m68klynx.c m68knetbsd.c m88kmach3.c +m88kopenbsd.c mach-o.c mach-o.h merge.c diff --git a/contrib/binutils/bfd/po/bfd.pot b/contrib/binutils/bfd/po/bfd.pot index 5d4f2349a02..37c57290aee 100644 --- a/contrib/binutils/bfd/po/bfd.pot +++ b/contrib/binutils/bfd/po/bfd.pot @@ -1,12 +1,14 @@ # SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR Free Software Foundation, Inc. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2003-07-17 14:52+0100\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2005-10-25 22:24+0930\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -14,154 +16,151 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: aout-adobe.c:204 -#, c-format -msgid "%s: Unknown section type in a.out.adobe file: %x\n" +#: aout-adobe.c:127 +msgid "%B: Unknown section type in a.out.adobe file: %x\n" msgstr "" -#: aout-cris.c:207 +#: aout-cris.c:202 #, c-format msgid "%s: Invalid relocation type exported: %d" msgstr "" -#: aout-cris.c:251 -#, c-format -msgid "%s: Invalid relocation type imported: %d" +#: aout-cris.c:245 +msgid "%B: Invalid relocation type imported: %d" msgstr "" -#: aout-cris.c:262 -#, c-format -msgid "%s: Bad relocation record imported: %d" +#: aout-cris.c:256 +msgid "%B: Bad relocation record imported: %d" msgstr "" -#: aoutx.h:1295 aoutx.h:1716 +#: aoutx.h:1244 aoutx.h:1578 #, c-format msgid "%s: can not represent section `%s' in a.out object file format" msgstr "" -#: aoutx.h:1682 +#: aoutx.h:1544 #, c-format msgid "" "%s: can not represent section for symbol `%s' in a.out object file format" msgstr "" -#: aoutx.h:1684 +#: aoutx.h:1546 msgid "*unknown*" msgstr "" -#: aoutx.h:3776 +#: aoutx.h:5281 #, c-format msgid "%s: relocatable link from %s to %s not supported" msgstr "" -#: archive.c:1751 +#: archive.c:1760 msgid "Warning: writing archive was slow: rewriting timestamp\n" msgstr "" -#: archive.c:2014 +#: archive.c:2019 msgid "Reading archive file mod timestamp" msgstr "" -#: archive.c:2040 +#: archive.c:2043 msgid "Writing updated armap timestamp" msgstr "" -#: bfd.c:280 +#: bfd.c:279 msgid "No error" msgstr "" -#: bfd.c:281 +#: bfd.c:280 msgid "System call error" msgstr "" -#: bfd.c:282 +#: bfd.c:281 msgid "Invalid bfd target" msgstr "" -#: bfd.c:283 +#: bfd.c:282 msgid "File in wrong format" msgstr "" -#: bfd.c:284 +#: bfd.c:283 msgid "Archive object file in wrong format" msgstr "" -#: bfd.c:285 +#: bfd.c:284 msgid "Invalid operation" msgstr "" -#: bfd.c:286 +#: bfd.c:285 msgid "Memory exhausted" msgstr "" -#: bfd.c:287 +#: bfd.c:286 msgid "No symbols" msgstr "" -#: bfd.c:288 +#: bfd.c:287 msgid "Archive has no index; run ranlib to add one" msgstr "" -#: bfd.c:289 +#: bfd.c:288 msgid "No more archived files" msgstr "" -#: bfd.c:290 +#: bfd.c:289 msgid "Malformed archive" msgstr "" -#: bfd.c:291 +#: bfd.c:290 msgid "File format not recognized" msgstr "" -#: bfd.c:292 +#: bfd.c:291 msgid "File format is ambiguous" msgstr "" -#: bfd.c:293 +#: bfd.c:292 msgid "Section has no contents" msgstr "" -#: bfd.c:294 +#: bfd.c:293 msgid "Nonrepresentable section on output" msgstr "" -#: bfd.c:295 +#: bfd.c:294 msgid "Symbol needs debug section which does not exist" msgstr "" -#: bfd.c:296 +#: bfd.c:295 msgid "Bad value" msgstr "" -#: bfd.c:297 +#: bfd.c:296 msgid "File truncated" msgstr "" -#: bfd.c:298 +#: bfd.c:297 msgid "File too big" msgstr "" -#: bfd.c:299 +#: bfd.c:298 msgid "#" msgstr "" -#: bfd.c:687 +#: bfd.c:771 #, c-format msgid "BFD %s assertion fail %s:%d" msgstr "" -#: bfd.c:703 +#: bfd.c:787 #, c-format msgid "BFD %s internal error, aborting at %s line %d in %s\n" msgstr "" -#: bfd.c:707 +#: bfd.c:791 #, c-format msgid "BFD %s internal error, aborting at %s line %d\n" msgstr "" -#: bfd.c:709 +#: bfd.c:793 msgid "Please report this bug.\n" msgstr "" @@ -171,1323 +170,1634 @@ msgid "not mapping: data=%lx mapped=%d\n" msgstr "" #: bfdwin.c:205 +#, c-format msgid "not mapping: env var not set\n" msgstr "" -#: binary.c:306 +#: binary.c:285 #, c-format msgid "Warning: Writing section `%s' to huge (ie negative) file offset 0x%lx." msgstr "" -#: coff-rs6000.c:3616 coff64-rs6000.c:2109 -#, c-format -msgid "%s: symbol `%s' has unrecognized smclas %d" +#: coff64-rs6000.c:2109 coff-rs6000.c:3610 +msgid "%B: symbol `%s' has unrecognized smclas %d" msgstr "" -#: coff-a29k.c:120 -msgid "Missing IHCONST" +#: coff-alpha.c:489 +msgid "" +"%B: Cannot handle compressed Alpha binaries.\n" +" Use compiler flags, or objZ, to generate uncompressed binaries." msgstr "" -#: coff-a29k.c:181 -msgid "Missing IHIHALF" +#: coff-alpha.c:646 +msgid "%B: unknown/unsupported relocation type %d" msgstr "" -#: coff-a29k.c:213 coff-or32.c:236 -msgid "Unrecognized reloc" -msgstr "" - -#: coff-a29k.c:409 -msgid "missing IHCONST reloc" -msgstr "" - -#: coff-a29k.c:499 -msgid "missing IHIHALF reloc" -msgstr "" - -#: coff-alpha.c:884 coff-alpha.c:921 coff-alpha.c:1992 coff-mips.c:1397 +#: coff-alpha.c:898 coff-alpha.c:935 coff-alpha.c:2007 coff-mips.c:985 msgid "GP relative relocation used when GP not defined" msgstr "" -#: coff-alpha.c:1488 +#: coff-alpha.c:1484 msgid "using multiple gp values" msgstr "" -#: coff-arm.c:1066 elf32-arm.h:294 +#: coff-alpha.c:1543 +msgid "%B: unsupported relocation: ALPHA_R_GPRELHIGH" +msgstr "" + +#: coff-alpha.c:1550 +msgid "%B: unsupported relocation: ALPHA_R_GPRELLOW" +msgstr "" + +#: coff-alpha.c:1557 elf32-m32r.c:2471 elf64-alpha.c:3912 elf64-alpha.c:4038 +#: elf32-ia64.c:4108 elf64-ia64.c:4108 +msgid "%B: unknown relocation type %d" +msgstr "" + +#: coff-arm.c:990 elf32-arm.c:1926 #, c-format -msgid "%s: unable to find THUMB glue '%s' for `%s'" +msgid "%B: unable to find THUMB glue '%s' for `%s'" msgstr "" -#: coff-arm.c:1096 elf32-arm.h:329 +#: coff-arm.c:1019 elf32-arm.c:1960 #, c-format -msgid "%s: unable to find ARM glue '%s' for `%s'" +msgid "%B: unable to find ARM glue '%s' for `%s'" msgstr "" -#: coff-arm.c:1394 coff-arm.c:1489 elf32-arm.h:892 elf32-arm.h:999 -#, c-format -msgid "%s(%s): warning: interworking not enabled." -msgstr "" - -#: coff-arm.c:1398 elf32-arm.h:1002 -#, c-format -msgid " first occurrence: %s: arm call to thumb" -msgstr "" - -#: coff-arm.c:1493 elf32-arm.h:895 -#, c-format -msgid " first occurrence: %s: thumb call to arm" -msgstr "" - -#: coff-arm.c:1496 -msgid " consider relinking with --support-old-code enabled" -msgstr "" - -#: coff-arm.c:1788 coff-tic80.c:687 cofflink.c:3038 -#, c-format -msgid "%s: bad reloc address 0x%lx in section `%s'" -msgstr "" - -#: coff-arm.c:2132 -#, c-format -msgid "%s: illegal symbol index in reloc: %d" -msgstr "" - -#: coff-arm.c:2265 -#, c-format -msgid "ERROR: %s is compiled for APCS-%d, whereas %s is compiled for APCS-%d" -msgstr "" - -#: coff-arm.c:2280 elf32-arm.h:2328 +#: coff-arm.c:1319 elf32-arm.c:2683 #, c-format msgid "" -"ERROR: %s passes floats in float registers, whereas %s passes them in " +"%B(%s): warning: interworking not enabled.\n" +" first occurrence: %B: arm call to thumb" +msgstr "" + +#: coff-arm.c:1409 +#, c-format +msgid "" +"%B(%s): warning: interworking not enabled.\n" +" first occurrence: %B: thumb call to arm\n" +" consider relinking with --support-old-code enabled" +msgstr "" + +#: coff-arm.c:1702 cofflink.c:3015 coff-tic80.c:695 +msgid "%B: bad reloc address 0x%lx in section `%A'" +msgstr "" + +#: coff-arm.c:2028 +msgid "%B: illegal symbol index in reloc: %d" +msgstr "" + +#: coff-arm.c:2158 +#, c-format +msgid "ERROR: %B is compiled for APCS-%d, whereas %B is compiled for APCS-%d" +msgstr "" + +#: coff-arm.c:2174 elf32-arm.c:5093 +#, c-format +msgid "" +"ERROR: %B passes floats in float registers, whereas %B passes them in " "integer registers" msgstr "" -#: coff-arm.c:2283 elf32-arm.h:2333 +#: coff-arm.c:2177 elf32-arm.c:5097 #, c-format msgid "" -"ERROR: %s passes floats in integer registers, whereas %s passes them in " +"ERROR: %B passes floats in integer registers, whereas %B passes them in " "float registers" msgstr "" -#: coff-arm.c:2298 +#: coff-arm.c:2191 #, c-format msgid "" -"ERROR: %s is compiled as position independent code, whereas target %s is " +"ERROR: %B is compiled as position independent code, whereas target %B is " "absolute position" msgstr "" -#: coff-arm.c:2301 +#: coff-arm.c:2194 #, c-format msgid "" -"ERROR: %s is compiled as absolute position code, whereas target %s is " +"ERROR: %B is compiled as absolute position code, whereas target %B is " "position independent" msgstr "" -#: coff-arm.c:2330 elf32-arm.h:2405 +#: coff-arm.c:2222 elf32-arm.c:5162 #, c-format -msgid "Warning: %s supports interworking, whereas %s does not" +msgid "Warning: %B supports interworking, whereas %B does not" msgstr "" -#: coff-arm.c:2333 elf32-arm.h:2412 +#: coff-arm.c:2225 elf32-arm.c:5168 #, c-format -msgid "Warning: %s does not support interworking, whereas %s does" +msgid "Warning: %B does not support interworking, whereas %B does" msgstr "" -#: coff-arm.c:2360 +#: coff-arm.c:2249 #, c-format msgid "private flags = %x:" msgstr "" -#: coff-arm.c:2368 elf32-arm.h:2467 +#: coff-arm.c:2257 elf32-arm.c:5219 +#, c-format msgid " [floats passed in float registers]" msgstr "" -#: coff-arm.c:2370 +#: coff-arm.c:2259 +#, c-format msgid " [floats passed in integer registers]" msgstr "" -#: coff-arm.c:2373 elf32-arm.h:2470 +#: coff-arm.c:2262 elf32-arm.c:5222 +#, c-format msgid " [position independent]" msgstr "" -#: coff-arm.c:2375 +#: coff-arm.c:2264 +#, c-format msgid " [absolute position]" msgstr "" -#: coff-arm.c:2379 +#: coff-arm.c:2268 +#, c-format msgid " [interworking flag not initialised]" msgstr "" -#: coff-arm.c:2381 +#: coff-arm.c:2270 +#, c-format msgid " [interworking supported]" msgstr "" -#: coff-arm.c:2383 +#: coff-arm.c:2272 +#, c-format msgid " [interworking not supported]" msgstr "" -#: coff-arm.c:2431 elf32-arm.h:2150 +#: coff-arm.c:2318 elf32-arm.c:4571 #, c-format msgid "" -"Warning: Not setting interworking flag of %s since it has already been " +"Warning: Not setting interworking flag of %B since it has already been " "specified as non-interworking" msgstr "" -#: coff-arm.c:2435 elf32-arm.h:2154 +#: coff-arm.c:2322 elf32-arm.c:4575 #, c-format -msgid "Warning: Clearing the interworking flag of %s due to outside request" +msgid "Warning: Clearing the interworking flag of %B due to outside request" msgstr "" -#: coffcode.h:1108 -#, c-format -msgid "%s (%s): Section flag %s (0x%x) ignored" +#: coffcode.h:849 +msgid "%B: warning: COMDAT symbol '%s' does not match section name '%s'" msgstr "" -#: coffcode.h:2214 +#. Generate a warning message rather using the 'unhandled' +#. variable as this will allow some .sys files generate by +#. other toolchains to be processed. See bugzilla issue 196. +#: coffcode.h:1061 +msgid "" +"%B: Warning: Ignoring section flag IMAGE_SCN_MEM_NOT_PAGED in section %s" +msgstr "" + +#: coffcode.h:1116 +msgid "%B (%s): Section flag %s (0x%x) ignored" +msgstr "" + +#: coffcode.h:2204 #, c-format msgid "Unrecognized TI COFF target id '0x%x'" msgstr "" -#: coffcode.h:4439 -#, c-format -msgid "%s: warning: illegal symbol index %ld in line numbers" +#: coffcode.h:4211 +msgid "%B: warning: line number table read failed" msgstr "" -#: coffcode.h:4453 -#, c-format -msgid "%s: warning: duplicate line number information for `%s'" +#: coffcode.h:4243 +msgid "%B: warning: illegal symbol index %ld in line numbers" msgstr "" -#: coffcode.h:4807 -#, c-format -msgid "%s: Unrecognized storage class %d for %s symbol `%s'" +#: coffcode.h:4257 +msgid "%B: warning: duplicate line number information for `%s'" msgstr "" -#: coffcode.h:4940 -#, c-format -msgid "warning: %s: local symbol `%s' has no section" +#: coffcode.h:4597 +msgid "%B: Unrecognized storage class %d for %s symbol `%s'" msgstr "" -#: coff-tic4x.c:218 coff-tic54x.c:373 coffcode.h:5047 -#, c-format -msgid "%s: warning: illegal symbol index %ld in relocs" +#: coffcode.h:4723 +msgid "warning: %B: local symbol `%s' has no section" msgstr "" -#: coffcode.h:5085 -#, c-format -msgid "%s: illegal relocation type %d at address 0x%lx" +#: coffcode.h:4827 coff-i860.c:586 coff-tic54x.c:376 +msgid "%B: warning: illegal symbol index %ld in relocs" msgstr "" -#: coffgen.c:1666 -#, c-format -msgid "%s: bad string table size %lu" +#: coffcode.h:4865 +msgid "%B: illegal relocation type %d at address 0x%lx" msgstr "" -#: coff-h8300.c:1047 +#: coffgen.c:1511 +msgid "%B: bad string table size %lu" +msgstr "" + +#: coff-h8300.c:1126 #, c-format msgid "cannot handle R_MEM_INDIRECT reloc when using %s output" msgstr "" +#: coff-i860.c:142 +#, c-format +msgid "Relocation `%s' not yet implemented\n" +msgstr "" + #: coff-i960.c:137 coff-i960.c:486 msgid "uncertain calling convention for non-COFF symbol" msgstr "" -#: cofflink.c:538 elflink.h:1276 -#, c-format -msgid "Warning: type of symbol `%s' changed from %d to %d in %s" +#: cofflink.c:507 elflink.c:3948 +msgid "Warning: type of symbol `%s' changed from %d to %d in %B" msgstr "" -#: cofflink.c:2328 -#, c-format -msgid "%s: relocs in section `%s', but it has no contents" +#: cofflink.c:2293 +msgid "%B: relocs in section `%A', but it has no contents" msgstr "" -#: cofflink.c:2671 coffswap.h:890 +#: cofflink.c:2624 coffswap.h:823 #, c-format msgid "%s: %s: reloc overflow: 0x%lx > 0xffff" msgstr "" -#: cofflink.c:2680 coffswap.h:876 +#: cofflink.c:2633 coffswap.h:809 #, c-format msgid "%s: warning: %s: line number overflow: 0x%lx > 0xffff" msgstr "" -#: coff-m68k.c:482 coff-mips.c:2394 elf32-m68k.c:2193 elf32-mips.c:1783 +#: coff-m68k.c:482 elf32-bfin.c:2722 elf32-m68k.c:2193 msgid "unsupported reloc type" msgstr "" -#: coff-mips.c:839 elf32-mips.c:1088 elf64-mips.c:1590 elfn32-mips.c:1554 +#: coff-maxq.c:128 +msgid "Can't Make it a Short Jump" +msgstr "" + +#: coff-maxq.c:193 +msgid "Exceeds Long Jump Range" +msgstr "" + +#: coff-maxq.c:204 coff-maxq.c:278 +msgid "Absolute address Exceeds 16 bit Range" +msgstr "" + +#: coff-maxq.c:242 +msgid "Absolute address Exceeds 8 bit Range" +msgstr "" + +#: coff-maxq.c:335 +msgid "Unrecognized Reloc Type" +msgstr "" + +#: coff-mips.c:686 elf32-mips.c:940 elf64-mips.c:1864 elfn32-mips.c:1718 msgid "GP relative relocation when _gp not defined" msgstr "" -#. No other sections should appear in -membedded-pic -#. code. -#: coff-mips.c:2431 -msgid "reloc against unsupported section" +#: coff-or32.c:227 +msgid "Unrecognized reloc" msgstr "" -#: coff-mips.c:2439 -msgid "reloc not properly aligned" -msgstr "" - -#: coff-rs6000.c:2790 +#: coff-rs6000.c:2785 #, c-format msgid "%s: unsupported relocation type 0x%02x" msgstr "" -#: coff-rs6000.c:2883 +#: coff-rs6000.c:2878 #, c-format msgid "%s: TOC reloc at 0x%x to symbol `%s' with no TOC entry" msgstr "" -#: coff-tic4x.c:170 coff-tic54x.c:288 coff-tic80.c:450 +#: coff-tic4x.c:174 coff-tic54x.c:282 coff-tic80.c:458 #, c-format msgid "Unrecognized reloc type 0x%x" msgstr "" -#: coff-w65.c:364 +#: coff-tic4x.c:219 +#, c-format +msgid "%s: warning: illegal symbol index %ld in relocs" +msgstr "" + +#: coff-w65.c:366 #, c-format msgid "ignoring reloc %s\n" msgstr "" -#: cpu-arm.c:196 cpu-arm.c:206 -#, c-format -msgid "ERROR: %s is compiled for the EP9312, whereas %s is compiled for XScale" +#: cpu-arm.c:184 cpu-arm.c:193 +msgid "ERROR: %B is compiled for the EP9312, whereas %B is compiled for XScale" msgstr "" -#: cpu-arm.c:344 +#: cpu-arm.c:324 #, c-format msgid "warning: unable to update contents of %s section in %s" msgstr "" -#: dwarf2.c:380 +#: dwarf2.c:315 msgid "Dwarf Error: Can't find .debug_str section." msgstr "" -#: dwarf2.c:397 +#: dwarf2.c:333 #, c-format msgid "" "Dwarf Error: DW_FORM_strp offset (%lu) greater than or equal to .debug_str " "size (%lu)." msgstr "" -#: dwarf2.c:541 +#: dwarf2.c:426 msgid "Dwarf Error: Can't find .debug_abbrev section." msgstr "" -#: dwarf2.c:556 +#: dwarf2.c:441 #, c-format msgid "" "Dwarf Error: Abbrev offset (%lu) greater than or equal to .debug_abbrev size " "(%lu)." msgstr "" -#: dwarf2.c:756 +#: dwarf2.c:656 #, c-format msgid "Dwarf Error: Invalid or unhandled FORM value: %u." msgstr "" -#: dwarf2.c:933 +#: dwarf2.c:856 msgid "Dwarf Error: mangled line number section (bad file number)." msgstr "" -#: dwarf2.c:1032 +#: dwarf2.c:947 msgid "Dwarf Error: Can't find .debug_line section." msgstr "" -#: dwarf2.c:1049 +#: dwarf2.c:964 #, c-format msgid "" "Dwarf Error: Line offset (%lu) greater than or equal to .debug_line size (%" "lu)." msgstr "" -#: dwarf2.c:1255 +#: dwarf2.c:1192 msgid "Dwarf Error: mangled line number section." msgstr "" -#: dwarf2.c:1470 dwarf2.c:1620 +#: dwarf2.c:1382 +msgid "Dwarf Error: Can't find .debug_ranges section." +msgstr "" + +#: dwarf2.c:1544 dwarf2.c:1660 dwarf2.c:1930 #, c-format msgid "Dwarf Error: Could not find abbrev number %u." msgstr "" -#: dwarf2.c:1581 +#: dwarf2.c:1891 #, c-format msgid "" "Dwarf Error: found dwarf version '%u', this reader only handles version 2 " "information." msgstr "" -#: dwarf2.c:1588 +#: dwarf2.c:1898 #, c-format msgid "" "Dwarf Error: found address size '%u', this reader can not handle sizes " "greater than '%u'." msgstr "" -#: dwarf2.c:1611 +#: dwarf2.c:1921 #, c-format msgid "Dwarf Error: Bad abbrev number: %u." msgstr "" -#: ecoff.c:1339 +#: ecoff.c:1227 #, c-format msgid "Unknown basic type %d" msgstr "" -#: ecoff.c:1599 +#: ecoff.c:1484 #, c-format msgid "" "\n" " End+1 symbol: %ld" msgstr "" -#: ecoff.c:1606 ecoff.c:1609 +#: ecoff.c:1491 ecoff.c:1494 #, c-format msgid "" "\n" " First symbol: %ld" msgstr "" -#: ecoff.c:1621 +#: ecoff.c:1506 #, c-format msgid "" "\n" " End+1 symbol: %-7ld Type: %s" msgstr "" -#: ecoff.c:1628 +#: ecoff.c:1513 #, c-format msgid "" "\n" " Local symbol: %ld" msgstr "" -#: ecoff.c:1636 +#: ecoff.c:1521 #, c-format msgid "" "\n" " struct; End+1 symbol: %ld" msgstr "" -#: ecoff.c:1641 +#: ecoff.c:1526 #, c-format msgid "" "\n" " union; End+1 symbol: %ld" msgstr "" -#: ecoff.c:1646 +#: ecoff.c:1531 #, c-format msgid "" "\n" " enum; End+1 symbol: %ld" msgstr "" -#: ecoff.c:1652 +#: ecoff.c:1537 #, c-format msgid "" "\n" " Type: %s" msgstr "" -#: elf32-arm.h:1228 -#, c-format -msgid "%s: Warning: Arm BLX instruction targets Arm function '%s'." +#: elf32-arm.c:2315 +msgid "%B: BE8 images only valid in big-endian mode." msgstr "" -#: elf32-arm.h:1424 +#: elf32-arm.c:2471 #, c-format -msgid "%s: Warning: Thumb BLX instruction targets thumb function '%s'." +msgid "Invalid TARGET2 relocation type '%s'." msgstr "" -#: elf32-arm.h:1918 elf32-sh.c:4706 elf64-sh64.c:1613 -#, c-format -msgid "%s(%s+0x%lx): %s relocation against SEC_MERGE section" -msgstr "" - -#: elf32-arm.h:2012 -#, c-format +#: elf32-arm.c:2578 msgid "" -"%s: warning: unresolvable relocation %d against symbol `%s' from %s section" +"%B(%s): warning: interworking not enabled.\n" +" first occurrence: %B: thumb call to arm" msgstr "" -#: elf-m10200.c:442 elf-m10300.c:1695 elf32-arm.h:2088 elf32-avr.c:812 -#: elf32-cris.c:1390 elf32-d10v.c:482 elf32-fr30.c:634 elf32-frv.c:815 -#: elf32-h8300.c:509 elf32-i860.c:1028 elf32-ip2k.c:1586 elf32-iq2000.c:699 -#: elf32-m32r.c:1283 elf32-m68hc1x.c:1305 elf32-msp430.c:510 -#: elf32-openrisc.c:436 elf32-v850.c:1777 elf32-xstormy16.c:976 -#: elf64-mmix.c:1332 +#: elf32-arm.c:3044 +msgid "\\%B: Warning: Arm BLX instruction targets Arm function '%s'." +msgstr "" + +#: elf32-arm.c:3227 +msgid "%B: Warning: Thumb BLX instruction targets thumb function '%s'." +msgstr "" + +#: elf32-arm.c:3889 +msgid "%B(%A+0x%lx): R_ARM_TLS_LE32 relocation not permitted in shared object" +msgstr "" + +#: elf32-arm.c:4290 elf32-sh.c:4618 elf64-sh64.c:1537 +msgid "%B(%A+0x%lx): %s relocation against SEC_MERGE section" +msgstr "" + +#: elf32-arm.c:4351 elf64-ppc.c:9672 +msgid "%B(%A+0x%lx): %s used with TLS symbol %s" +msgstr "" + +#: elf32-arm.c:4352 elf64-ppc.c:9673 +msgid "%B(%A+0x%lx): %s used with non-TLS symbol %s" +msgstr "" + +#: elf32-arm.c:4375 elf32-i386.c:3038 elf32-m32r.c:2653 elf32-m68k.c:1737 +#: elf32-ppc.c:6561 elf32-s390.c:3012 elf32-sh.c:4717 elf32-xtensa.c:2311 +#: elf64-ppc.c:10825 elf64-s390.c:3010 elf64-sh64.c:1626 elf64-x86-64.c:2522 +#: elf-hppa.h:1413 elf-m10300.c:1460 elfxx-sparc.c:3137 +msgid "%B(%A+0x%lx): unresolvable %s relocation against symbol `%s'" +msgstr "" + +#: elf32-arm.c:4411 elf32-avr.c:880 elf32-cr16c.c:773 elf32-cris.c:1502 +#: elf32-crx.c:911 elf32-d10v.c:536 elf32-fr30.c:595 elf32-frv.c:4107 +#: elf32-h8300.c:494 elf32-i860.c:1189 elf32-ip2k.c:1474 elf32-iq2000.c:616 +#: elf32-m32c.c:465 elf32-m32r.c:3111 elf32-m68hc1x.c:1194 elf32-ms1.c:373 +#: elf32-msp430.c:508 elf32-openrisc.c:383 elf32-v850.c:1672 +#: elf32-xstormy16.c:909 elf64-mmix.c:1517 elf-m10200.c:427 elf-m10300.c:1509 msgid "internal error: out of range error" msgstr "" -#: elf-m10200.c:446 elf-m10300.c:1699 elf32-arm.h:2092 elf32-avr.c:816 -#: elf32-cris.c:1394 elf32-d10v.c:486 elf32-fr30.c:638 elf32-frv.c:819 -#: elf32-h8300.c:513 elf32-i860.c:1032 elf32-iq2000.c:703 elf32-m32r.c:1287 -#: elf32-m68hc1x.c:1309 elf32-msp430.c:514 elf32-openrisc.c:440 -#: elf32-v850.c:1781 elf32-xstormy16.c:980 elf64-mmix.c:1336 elfxx-mips.c:6452 +#: elf32-arm.c:4415 elf32-avr.c:884 elf32-cr16c.c:777 elf32-cris.c:1506 +#: elf32-crx.c:915 elf32-d10v.c:540 elf32-fr30.c:599 elf32-frv.c:4111 +#: elf32-h8300.c:498 elf32-i860.c:1193 elf32-iq2000.c:620 elf32-m32c.c:469 +#: elf32-m32r.c:3115 elf32-m68hc1x.c:1198 elf32-msp430.c:512 +#: elf32-openrisc.c:387 elf32-v850.c:1676 elf32-xstormy16.c:913 +#: elf64-mmix.c:1521 elf-m10200.c:431 elf-m10300.c:1513 elfxx-mips.c:7212 msgid "internal error: unsupported relocation error" msgstr "" -#: elf-m10200.c:450 elf-m10300.c:1703 elf32-arm.h:2096 elf32-d10v.c:490 -#: elf32-h8300.c:517 elf32-m32r.c:1291 elf32-m68hc1x.c:1313 +#: elf32-arm.c:4419 elf32-cr16c.c:781 elf32-crx.c:919 elf32-d10v.c:544 +#: elf32-h8300.c:502 elf32-m32r.c:3119 elf32-m68hc1x.c:1202 elf-m10200.c:435 +#: elf-m10300.c:1517 msgid "internal error: dangerous error" msgstr "" -#: elf-m10200.c:454 elf-m10300.c:1707 elf32-arm.h:2100 elf32-avr.c:824 -#: elf32-cris.c:1402 elf32-d10v.c:494 elf32-fr30.c:646 elf32-frv.c:827 -#: elf32-h8300.c:521 elf32-i860.c:1040 elf32-ip2k.c:1601 elf32-iq2000.c:711 -#: elf32-m32r.c:1295 elf32-m68hc1x.c:1317 elf32-msp430.c:522 -#: elf32-openrisc.c:448 elf32-v850.c:1801 elf32-xstormy16.c:988 -#: elf64-mmix.c:1344 +#: elf32-arm.c:4423 elf32-avr.c:892 elf32-cr16c.c:785 elf32-cris.c:1514 +#: elf32-crx.c:923 elf32-d10v.c:548 elf32-fr30.c:607 elf32-frv.c:4119 +#: elf32-h8300.c:506 elf32-i860.c:1201 elf32-ip2k.c:1489 elf32-iq2000.c:628 +#: elf32-m32c.c:477 elf32-m32r.c:3123 elf32-m68hc1x.c:1206 elf32-ms1.c:381 +#: elf32-msp430.c:520 elf32-openrisc.c:395 elf32-v850.c:1696 +#: elf32-xstormy16.c:921 elf64-mmix.c:1529 elf-m10200.c:439 elf-m10300.c:1521 msgid "internal error: unknown error" msgstr "" -#: elf32-arm.h:2202 -#, c-format +#: elf32-arm.c:4664 msgid "" -"Warning: Clearing the interworking flag of %s because non-interworking code " -"in %s has been linked with it" +"Warning: Clearing the interworking flag of %B because non-interworking code " +"in %B has been linked with it" msgstr "" -#: elf32-arm.h:2302 -#, c-format +#: elf32-arm.c:4751 +msgid "ERROR: %B uses VFP register arguments, %B does not" +msgstr "" + +#: elf32-arm.c:4798 +msgid "ERROR: %B: Conflicting architecture profiles %c/%c" +msgstr "" + +#: elf32-arm.c:4813 +msgid "Warning: %B: Conflicting platform configuration" +msgstr "" + +#: elf32-arm.c:4821 +msgid "ERROR: %B: Conflicting use of R9" +msgstr "" + +#: elf32-arm.c:4833 +msgid "ERROR: %B: SB relative addressing conflicts with use of R9" +msgstr "" + +#: elf32-arm.c:4855 +msgid "ERROR: %B: Conflicting definitions of wchar_t" +msgstr "" + +#: elf32-arm.c:4881 +msgid "ERROR: %B: Conflicting enum sizes" +msgstr "" + +#: elf32-arm.c:4892 +msgid "ERROR: %B uses iWMMXt register arguments, %B does not" +msgstr "" + +#: elf32-arm.c:4912 +msgid "ERROR: %B: Must be processed by '%s' toolchain" +msgstr "" + +#: elf32-arm.c:4932 elf32-arm.c:4951 +msgid "ERROR: %B: Incompatible object tag '%s':%d" +msgstr "" + +#: elf32-arm.c:4961 +msgid "Warning: %B: Unknown EABI object attribute %d" +msgstr "" + +#: elf32-arm.c:5069 msgid "" -"ERROR: %s is compiled for EABI version %d, whereas %s is compiled for " -"version %d" +"ERROR: Source object %B has EABI version %d, but target %B has EABI version %" +"d" msgstr "" -#: elf32-arm.h:2316 -#, c-format -msgid "ERROR: %s is compiled for APCS-%d, whereas target %s uses APCS-%d" +#: elf32-arm.c:5082 +msgid "ERROR: %B is compiled for APCS-%d, whereas target %B uses APCS-%d" msgstr "" -#: elf32-arm.h:2344 -#, c-format -msgid "ERROR: %s uses VFP instructions, whereas %s does not" +#: elf32-arm.c:5107 +msgid "ERROR: %B uses VFP instructions, whereas %B does not" msgstr "" -#: elf32-arm.h:2349 -#, c-format -msgid "ERROR: %s uses FPA instructions, whereas %s does not" +#: elf32-arm.c:5111 +msgid "ERROR: %B uses FPA instructions, whereas %B does not" msgstr "" -#: elf32-arm.h:2360 elf32-arm.h:2365 -#, c-format -msgid "ERROR: %s uses Maverick instructions, whereas %s does not" +#: elf32-arm.c:5121 +msgid "ERROR: %B uses Maverick instructions, whereas %B does not" msgstr "" -#: elf32-arm.h:2385 -#, c-format -msgid "ERROR: %s uses software FP, whereas %s uses hardware FP" +#: elf32-arm.c:5125 +msgid "ERROR: %B does not use Maverick instructions, whereas %B does" msgstr "" -#: elf32-arm.h:2390 -#, c-format -msgid "ERROR: %s uses hardware FP, whereas %s uses software FP" +#: elf32-arm.c:5144 +msgid "ERROR: %B uses software FP, whereas %B uses hardware FP" +msgstr "" + +#: elf32-arm.c:5148 +msgid "ERROR: %B uses hardware FP, whereas %B uses software FP" msgstr "" #. Ignore init flag - it may not be set, despite the flags field #. containing valid data. -#: elf32-arm.h:2443 elf32-cris.c:2975 elf32-m68hc1x.c:1459 elf32-m68k.c:397 -#: elf32-vax.c:546 elfxx-mips.c:9240 +#. Ignore init flag - it may not be set, despite the flags field containing valid data. +#: elf32-arm.c:5195 elf32-bfin.c:2164 elf32-cris.c:3243 elf32-m68hc1x.c:1338 +#: elf32-m68k.c:428 elf32-vax.c:528 elfxx-mips.c:9933 #, c-format msgid "private flags = %lx:" msgstr "" -#: elf32-arm.h:2452 +#: elf32-arm.c:5204 +#, c-format msgid " [interworking enabled]" msgstr "" -#: elf32-arm.h:2460 +#: elf32-arm.c:5212 +#, c-format msgid " [VFP float format]" msgstr "" -#: elf32-arm.h:2462 +#: elf32-arm.c:5214 +#, c-format msgid " [Maverick float format]" msgstr "" -#: elf32-arm.h:2464 +#: elf32-arm.c:5216 +#, c-format msgid " [FPA float format]" msgstr "" -#: elf32-arm.h:2473 +#: elf32-arm.c:5225 +#, c-format msgid " [new ABI]" msgstr "" -#: elf32-arm.h:2476 +#: elf32-arm.c:5228 +#, c-format msgid " [old ABI]" msgstr "" -#: elf32-arm.h:2479 +#: elf32-arm.c:5231 +#, c-format msgid " [software FP]" msgstr "" -#: elf32-arm.h:2488 +#: elf32-arm.c:5240 +#, c-format msgid " [Version1 EABI]" msgstr "" -#: elf32-arm.h:2491 elf32-arm.h:2502 +#: elf32-arm.c:5243 elf32-arm.c:5254 +#, c-format msgid " [sorted symbol table]" msgstr "" -#: elf32-arm.h:2493 elf32-arm.h:2504 +#: elf32-arm.c:5245 elf32-arm.c:5256 +#, c-format msgid " [unsorted symbol table]" msgstr "" -#: elf32-arm.h:2499 +#: elf32-arm.c:5251 +#, c-format msgid " [Version2 EABI]" msgstr "" -#: elf32-arm.h:2507 +#: elf32-arm.c:5259 +#, c-format msgid " [dynamic symbols use segment index]" msgstr "" -#: elf32-arm.h:2510 +#: elf32-arm.c:5262 +#, c-format msgid " [mapping symbols precede others]" msgstr "" -#: elf32-arm.h:2517 +#: elf32-arm.c:5269 +#, c-format +msgid " [Version3 EABI]" +msgstr "" + +#: elf32-arm.c:5273 +#, c-format +msgid " [Version4 EABI]" +msgstr "" + +#: elf32-arm.c:5276 +#, c-format +msgid " [BE8]" +msgstr "" + +#: elf32-arm.c:5279 +#, c-format +msgid " [LE8]" +msgstr "" + +#: elf32-arm.c:5285 +#, c-format msgid " " msgstr "" -#: elf32-arm.h:2524 +#: elf32-arm.c:5292 +#, c-format msgid " [relocatable executable]" msgstr "" -#: elf32-arm.h:2527 +#: elf32-arm.c:5295 +#, c-format msgid " [has entry point]" msgstr "" -#: elf32-arm.h:2532 +#: elf32-arm.c:5300 +#, c-format msgid "" msgstr "" -#: elf32-avr.c:820 elf32-cris.c:1398 elf32-fr30.c:642 elf32-frv.c:823 -#: elf32-i860.c:1036 elf32-ip2k.c:1597 elf32-iq2000.c:707 elf32-msp430.c:518 -#: elf32-openrisc.c:444 elf32-v850.c:1785 elf32-xstormy16.c:984 -#: elf64-mmix.c:1340 +#: elf32-arm.c:5536 elf32-i386.c:902 elf32-s390.c:989 elf32-xtensa.c:784 +#: elf64-s390.c:942 elf64-x86-64.c:666 elfxx-sparc.c:1016 +msgid "%B: bad symbol index: %d" +msgstr "" + +#: elf32-arm.c:6023 elf32-cris.c:2385 elf32-hppa.c:1813 elf32-i370.c:491 +#: elf32-i386.c:1465 elf32-m32r.c:1913 elf32-m68k.c:1088 elf32-ppc.c:4145 +#: elf32-s390.c:1686 elf32-sh.c:3920 elf32-vax.c:1059 elf64-ppc.c:5717 +#: elf64-s390.c:1659 elf64-sh64.c:3442 elf64-x86-64.c:1252 elf-m10300.c:4107 +#: elfxx-sparc.c:1720 +#, c-format +msgid "dynamic variable `%s' is zero size" +msgstr "" + +#: elf32-avr.c:888 elf32-cris.c:1510 elf32-fr30.c:603 elf32-frv.c:4115 +#: elf32-i860.c:1197 elf32-ip2k.c:1485 elf32-iq2000.c:624 elf32-m32c.c:473 +#: elf32-ms1.c:377 elf32-msp430.c:516 elf32-openrisc.c:391 elf32-v850.c:1680 +#: elf32-xstormy16.c:917 elf64-mmix.c:1525 msgid "internal error: dangerous relocation" msgstr "" -#: elf32-cris.c:931 -#, c-format -msgid "%s: unresolvable relocation %s against symbol `%s' from %s section" +#: elf32-bfin.c:96 +msgid "Division by zero. " msgstr "" -#: elf32-cris.c:993 -#, c-format -msgid "" -"%s: No PLT nor GOT for relocation %s against symbol `%s' from %s section" +#: elf32-bfin.c:1958 +msgid "%B(%A+0x%lx): unresolvable relocation against symbol `%s'" msgstr "" -#: elf32-cris.c:996 elf32-cris.c:1122 +#: elf32-bfin.c:1991 elf32-i386.c:3079 elf32-m68k.c:1778 elf32-s390.c:3064 +#: elf64-s390.c:3062 elf64-x86-64.c:2567 +msgid "%B(%A+0x%lx): reloc against `%s': error %d" +msgstr "" + +#: elf32-cris.c:1050 +msgid "%B, section %A: unresolvable relocation %s against symbol `%s'" +msgstr "" + +#: elf32-cris.c:1105 +msgid "%B, section %A: No PLT nor GOT for relocation %s against symbol `%s'" +msgstr "" + +#: elf32-cris.c:1107 +msgid "%B, section %A: No PLT for relocation %s against symbol `%s'" +msgstr "" + +#: elf32-cris.c:1113 elf32-cris.c:1245 msgid "[whose name is lost]" msgstr "" -#: elf32-cris.c:1111 -#, c-format +#: elf32-cris.c:1231 msgid "" -"%s: relocation %s with non-zero addend %d against local symbol from %s " -"section" +"%B, section %A: relocation %s with non-zero addend %d against local symbol" msgstr "" -#: elf32-cris.c:1118 -#, c-format +#: elf32-cris.c:1239 msgid "" -"%s: relocation %s with non-zero addend %d against symbol `%s' from %s section" +"%B, section %A: relocation %s with non-zero addend %d against symbol `%s'" msgstr "" -#: elf32-cris.c:1143 -#, c-format +#: elf32-cris.c:1265 +msgid "%B, section %A: relocation %s is not allowed for global symbol: `%s'" +msgstr "" + +#: elf32-cris.c:1281 +msgid "%B, section %A: relocation %s with no GOT created" +msgstr "" + +#: elf32-cris.c:1399 +msgid "%B: Internal inconsistency; no relocation section %s" +msgstr "" + +#: elf32-cris.c:2520 msgid "" -"%s: relocation %s is not allowed for global symbol: `%s' from %s section" +"%B, section %A:\n" +" v10/v32 compatible object %s must not contain a PIC relocation" msgstr "" -#: elf32-cris.c:1158 -#, c-format -msgid "%s: relocation %s in section %s with no GOT created" -msgstr "" - -#: elf32-cris.c:1277 -#, c-format -msgid "%s: Internal inconsistency; no relocation section %s" -msgstr "" - -#: elf32-cris.c:2500 -#, c-format +#: elf32-cris.c:2707 elf32-cris.c:2775 msgid "" -"%s, section %s:\n" +"%B, section %A:\n" " relocation %s should not be used in a shared object; recompile with -fPIC" msgstr "" -#: elf32-cris.c:2978 +#: elf32-cris.c:3192 +msgid "Unexpected machine number" +msgstr "" + +#: elf32-cris.c:3246 +#, c-format msgid " [symbols have a _ prefix]" msgstr "" -#: elf32-cris.c:3017 +#: elf32-cris.c:3249 #, c-format -msgid "%s: uses _-prefixed symbols, but writing file with non-prefixed symbols" +msgid " [v10 and v32]" msgstr "" -#: elf32-cris.c:3018 +#: elf32-cris.c:3252 #, c-format -msgid "%s: uses non-prefixed symbols, but writing file with _-prefixed symbols" +msgid " [v32]" msgstr "" -#: elf32-frv.c:1223 +#: elf32-cris.c:3297 +msgid "%B: uses _-prefixed symbols, but writing file with non-prefixed symbols" +msgstr "" + +#: elf32-cris.c:3298 +msgid "%B: uses non-prefixed symbols, but writing file with _-prefixed symbols" +msgstr "" + +#: elf32-cris.c:3317 +msgid "%B contains CRIS v32 code, incompatible with previous objects" +msgstr "" + +#: elf32-cris.c:3319 +msgid "%B contains non-CRIS-v32 code, incompatible with previous objects" +msgstr "" + +#: elf32-frv.c:1522 elf32-frv.c:1671 +msgid "relocation requires zero addend" +msgstr "" + +#: elf32-frv.c:2901 +msgid "%B(%A+0x%x): relocation to `%s+%x' may have caused the error above" +msgstr "" + +#: elf32-frv.c:2914 +msgid "relocation references symbol not defined in the module" +msgstr "" + +#: elf32-frv.c:2990 +msgid "R_FRV_GETTLSOFF not applied to a call instruction" +msgstr "" + +#: elf32-frv.c:3032 +msgid "R_FRV_GOTTLSDESC12 not applied to an lddi instruction" +msgstr "" + +#: elf32-frv.c:3103 +msgid "R_FRV_GOTTLSDESCHI not applied to a sethi instruction" +msgstr "" + +#: elf32-frv.c:3140 +msgid "R_FRV_GOTTLSDESCLO not applied to a setlo or setlos instruction" +msgstr "" + +#: elf32-frv.c:3188 +msgid "R_FRV_TLSDESC_RELAX not applied to an ldd instruction" +msgstr "" + +#: elf32-frv.c:3272 +msgid "R_FRV_GETTLSOFF_RELAX not applied to a calll instruction" +msgstr "" + +#: elf32-frv.c:3327 +msgid "R_FRV_GOTTLSOFF12 not applied to an ldi instruction" +msgstr "" + +#: elf32-frv.c:3357 +msgid "R_FRV_GOTTLSOFFHI not applied to a sethi instruction" +msgstr "" + +#: elf32-frv.c:3386 +msgid "R_FRV_GOTTLSOFFLO not applied to a setlo or setlos instruction" +msgstr "" + +#: elf32-frv.c:3417 +msgid "R_FRV_TLSOFF_RELAX not applied to an ld instruction" +msgstr "" + +#: elf32-frv.c:3462 +msgid "R_FRV_TLSMOFFHI not applied to a sethi instruction" +msgstr "" + +#: elf32-frv.c:3489 +msgid "R_FRV_TLSMOFFLO not applied to a setlo or setlos instruction" +msgstr "" + +#: elf32-frv.c:3610 +msgid "R_FRV_FUNCDESC references dynamic symbol with nonzero addend" +msgstr "" + +#: elf32-frv.c:3649 elf32-frv.c:3762 +msgid "cannot emit fixups in read-only section" +msgstr "" + +#: elf32-frv.c:3675 elf32-frv.c:3802 +msgid "cannot emit dynamic relocations in read-only section" +msgstr "" + +#: elf32-frv.c:3720 +msgid "R_FRV_FUNCDESC_VALUE references dynamic symbol with nonzero addend" +msgstr "" + +#: elf32-frv.c:3970 elf32-frv.c:4126 +msgid "%B(%A+0x%lx): reloc against `%s': %s" +msgstr "" + +#: elf32-frv.c:3972 elf32-frv.c:3976 +msgid "relocation references a different segment" +msgstr "" + +#: elf32-frv.c:6324 +msgid "%B: unsupported relocation type %i" +msgstr "" + +#: elf32-frv.c:6642 #, c-format msgid "" "%s: compiled with %s and linked with modules that use non-pic relocations" msgstr "" -#: elf32-frv.c:1273 elf32-iq2000.c:895 +#: elf32-frv.c:6695 elf32-iq2000.c:801 elf32-m32c.c:785 #, c-format msgid "%s: compiled with %s and linked with modules compiled with %s" msgstr "" -#: elf32-frv.c:1285 +#: elf32-frv.c:6707 #, c-format msgid "" "%s: uses different unknown e_flags (0x%lx) fields than previous modules (0x%" "lx)" msgstr "" -#: elf32-frv.c:1321 elf32-iq2000.c:933 +#: elf32-frv.c:6728 +#, c-format +msgid "%s: cannot link non-fdpic object file into fdpic executable" +msgstr "" + +#: elf32-frv.c:6732 +#, c-format +msgid "%s: cannot link fdpic object file into non-fdpic executable" +msgstr "" + +#: elf32-frv.c:6757 elf32-iq2000.c:838 elf32-m32c.c:821 elf32-ms1.c:596 #, c-format msgid "private flags = 0x%lx:" msgstr "" -#: elf32-gen.c:83 elf64-gen.c:82 -#, c-format -msgid "%s: Relocations in generic ELF (EM: %d)" +#: elf32-gen.c:68 elf64-gen.c:68 +msgid "%B: Relocations in generic ELF (EM: %d)" msgstr "" -#: elf32-hppa.c:672 elf32-m68hc1x.c:176 elf64-ppc.c:3118 -#, c-format -msgid "%s: cannot create stub entry %s" +#: elf32-hppa.c:569 elf32-m68hc1x.c:161 elf64-ppc.c:3660 +msgid "%B: cannot create stub entry %s" msgstr "" -#: elf32-hppa.c:957 elf32-hppa.c:3538 -#, c-format -msgid "%s(%s+0x%lx): cannot reach %s, recompile with -ffunction-sections" +#: elf32-hppa.c:822 elf32-hppa.c:3411 +msgid "%B(%A+0x%lx): cannot reach %s, recompile with -ffunction-sections" msgstr "" -#: elf32-hppa.c:1340 elf64-x86-64.c:672 elf64-x86-64.c:797 -#, c-format +#: elf32-hppa.c:1212 msgid "" -"%s: relocation %s can not be used when making a shared object; recompile " +"%B: relocation %s can not be used when making a shared object; recompile " "with -fPIC" msgstr "" -#: elf32-hppa.c:1360 -#, c-format -msgid "" -"%s: relocation %s should not be used when making a shared object; recompile " -"with -fPIC" -msgstr "" - -#: elf32-hppa.c:1553 +#: elf32-hppa.c:1405 #, c-format msgid "Could not find relocation section for %s" msgstr "" -#: elf32-hppa.c:2828 -#, c-format -msgid "%s: duplicate export stub %s" +#: elf32-hppa.c:2677 +msgid "%B: duplicate export stub %s" msgstr "" -#: elf32-hppa.c:3416 -#, c-format -msgid "%s(%s+0x%lx): fixing %s" +#: elf32-hppa.c:3266 +msgid "" +"%B(%A+0x%lx): %s fixup for insn 0x%x is not supported in a non-shared link" msgstr "" -#: elf32-hppa.c:4039 -#, c-format -msgid "%s(%s+0x%lx): cannot handle %s for %s" +#: elf32-hppa.c:3895 +msgid "%B(%A+0x%lx): cannot handle %s for %s" msgstr "" -#: elf32-hppa.c:4357 +#: elf32-hppa.c:4189 msgid ".got section not immediately after .plt section" msgstr "" -#: elf32-i386.c:326 -#, c-format -msgid "%s: invalid relocation type %d" +#: elf32-i386.c:327 elf32-s390.c:368 elf64-ppc.c:2124 elf64-s390.c:390 +#: elf64-x86-64.c:204 +msgid "%B: invalid relocation type %d" msgstr "" -#: elf32-i386.c:841 elf32-s390.c:990 elf32-sparc.c:887 elf32-xtensa.c:637 -#: elf64-s390.c:943 elf64-x86-64.c:650 -#, c-format -msgid "%s: bad symbol index: %d" +#: elf32-i386.c:1015 elf32-s390.c:1171 elf32-sh.c:6389 elf64-s390.c:1133 +#: elfxx-sparc.c:1144 +msgid "%B: `%s' accessed both as normal and thread local symbol" msgstr "" -#: elf32-i386.c:949 elf32-s390.c:1168 elf32-sh.c:6426 elf32-sparc.c:1011 -#: elf64-s390.c:1129 -#, c-format -msgid "%s: `%s' accessed both as normal and thread local symbol" +#: elf32-i386.c:1130 elf32-s390.c:1280 elf64-ppc.c:4731 elf64-s390.c:1245 +#: elf64-x86-64.c:910 +msgid "%B: bad relocation section name `%s'" msgstr "" -#: elf32-i386.c:1064 elf32-s390.c:1279 elf64-ppc.c:3929 elf64-s390.c:1243 -#: elf64-x86-64.c:886 -#, c-format -msgid "%s: bad relocation section name `%s'" +#: elf32-i386.c:2149 +msgid "%B: unrecognized relocation (0x%x) in section `%A'" msgstr "" -#: elf32-i386.c:2908 elf32-m68k.c:1757 elf32-s390.c:3022 elf32-sparc.c:2879 -#: elf32-xtensa.c:2193 elf64-s390.c:3018 elf64-sparc.c:2664 -#: elf64-x86-64.c:2452 -#, c-format -msgid "%s(%s+0x%lx): unresolvable relocation against symbol `%s'" +#: elf32-i386.c:2409 +msgid "" +"%B: relocation R_386_GOTOFF against protected function `%s' can not be used " +"when making a shared object" msgstr "" -#: elf32-i386.c:2947 elf32-m68k.c:1796 elf32-s390.c:3072 elf64-s390.c:3068 -#: elf64-x86-64.c:2490 -#, c-format -msgid "%s(%s+0x%lx): reloc against `%s': error %d" -msgstr "" - -#: elf32-ip2k.c:565 elf32-ip2k.c:571 elf32-ip2k.c:734 elf32-ip2k.c:740 +#: elf32-ip2k.c:853 elf32-ip2k.c:859 elf32-ip2k.c:926 elf32-ip2k.c:932 msgid "" "ip2k relaxer: switch table without complete matching relocation information." msgstr "" -#: elf32-ip2k.c:588 elf32-ip2k.c:767 +#: elf32-ip2k.c:876 elf32-ip2k.c:959 msgid "ip2k relaxer: switch table header corrupt." msgstr "" -#: elf32-ip2k.c:1395 +#: elf32-ip2k.c:1301 #, c-format msgid "ip2k linker: missing page instruction at 0x%08lx (dest = 0x%08lx)." msgstr "" -#: elf32-ip2k.c:1409 +#: elf32-ip2k.c:1317 #, c-format msgid "ip2k linker: redundant page instruction at 0x%08lx (dest = 0x%08lx)." msgstr "" #. Only if it's not an unresolved symbol. -#: elf32-ip2k.c:1593 +#: elf32-ip2k.c:1481 msgid "unsupported relocation between data/insn address spaces" msgstr "" -#: elf32-iq2000.c:907 elf32-m68hc1x.c:1431 elf32-ppc.c:2175 elf64-sparc.c:3072 -#: elfxx-mips.c:9197 +#: elf32-iq2000.c:814 elf32-m32c.c:797 #, c-format msgid "%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)" msgstr "" -#: elf32-m32r.c:930 +#: elf32-m32r.c:1436 msgid "SDA relocation when _SDA_BASE_ not defined" msgstr "" -#: elf32-ia64.c:3817 elf32-m32r.c:1018 elf64-alpha.c:4279 elf64-alpha.c:4407 -#: elf64-ia64.c:3817 -#, c-format -msgid "%s: unknown relocation type %d" +#: elf32-m32r.c:3048 +msgid "%B: The target (%s) of an %s relocation is in the wrong section (%A)" msgstr "" -#: elf32-m32r.c:1226 -#, c-format -msgid "%s: The target (%s) of an %s relocation is in the wrong section (%s)" +#: elf32-m32r.c:3576 +msgid "%B: Instruction set mismatch with previous modules" msgstr "" -#: elf32-m32r.c:1952 -#, c-format -msgid "%s: Instruction set mismatch with previous modules" -msgstr "" - -#: elf32-m32r.c:1975 +#: elf32-m32r.c:3597 #, c-format msgid "private flags = %lx" msgstr "" -#: elf32-m32r.c:1980 +#: elf32-m32r.c:3602 +#, c-format msgid ": m32r instructions" msgstr "" -#: elf32-m32r.c:1981 +#: elf32-m32r.c:3603 +#, c-format msgid ": m32rx instructions" msgstr "" -#: elf32-m68hc1x.c:1217 +#: elf32-m32r.c:3604 +#, c-format +msgid ": m32r2 instructions" +msgstr "" + +#: elf32-m68hc1x.c:1106 #, c-format msgid "" "Reference to the far symbol `%s' using a wrong relocation may result in " "incorrect execution" msgstr "" -#: elf32-m68hc1x.c:1240 +#: elf32-m68hc1x.c:1129 #, c-format msgid "" "banked address [%lx:%04lx] (%lx) is not in the same bank as current banked " "address [%lx:%04lx] (%lx)" msgstr "" -#: elf32-m68hc1x.c:1259 +#: elf32-m68hc1x.c:1148 #, c-format msgid "" "reference to a banked address [%lx:%04lx] in the normal address space at %" "04lx" msgstr "" -#: elf32-m68hc1x.c:1396 -#, c-format +#: elf32-m68hc1x.c:1281 msgid "" -"%s: linking files compiled for 16-bit integers (-mshort) and others for 32-" +"%B: linking files compiled for 16-bit integers (-mshort) and others for 32-" "bit integers" msgstr "" -#: elf32-m68hc1x.c:1404 -#, c-format +#: elf32-m68hc1x.c:1288 msgid "" -"%s: linking files compiled for 32-bit double (-fshort-double) and others for " +"%B: linking files compiled for 32-bit double (-fshort-double) and others for " "64-bit double" msgstr "" -#: elf32-m68hc1x.c:1414 -#, c-format -msgid "%s: linking files compiled for HCS12 with others compiled for HC12" +#: elf32-m68hc1x.c:1297 +msgid "%B: linking files compiled for HCS12 with others compiled for HC12" msgstr "" -#: elf32-m68hc1x.c:1462 +#: elf32-m68hc1x.c:1313 elf32-ppc.c:3576 elf64-sparc.c:696 elfxx-mips.c:9894 +msgid "%B: uses different e_flags (0x%lx) fields than previous modules (0x%lx)" +msgstr "" + +#: elf32-m68hc1x.c:1341 +#, c-format msgid "[abi=32-bit int, " msgstr "" -#: elf32-m68hc1x.c:1464 +#: elf32-m68hc1x.c:1343 +#, c-format msgid "[abi=16-bit int, " msgstr "" -#: elf32-m68hc1x.c:1467 +#: elf32-m68hc1x.c:1346 +#, c-format msgid "64-bit double, " msgstr "" -#: elf32-m68hc1x.c:1469 +#: elf32-m68hc1x.c:1348 +#, c-format msgid "32-bit double, " msgstr "" -#: elf32-m68hc1x.c:1472 +#: elf32-m68hc1x.c:1351 +#, c-format msgid "cpu=HC11]" msgstr "" -#: elf32-m68hc1x.c:1474 +#: elf32-m68hc1x.c:1353 +#, c-format msgid "cpu=HCS12]" msgstr "" -#: elf32-m68hc1x.c:1476 +#: elf32-m68hc1x.c:1355 +#, c-format msgid "cpu=HC12]" msgstr "" -#: elf32-m68hc1x.c:1479 +#: elf32-m68hc1x.c:1358 +#, c-format msgid " [memory=bank-model]" msgstr "" -#: elf32-m68hc1x.c:1481 +#: elf32-m68hc1x.c:1360 +#, c-format msgid " [memory=flat]" msgstr "" -#: elf32-m68k.c:400 +#: elf32-m68k.c:431 +#, c-format msgid " [cpu32]" msgstr "" -#: elf32-m68k.c:403 +#: elf32-m68k.c:434 +#, c-format msgid " [m68000]" msgstr "" -#: elf32-mcore.c:353 elf32-mcore.c:456 -#, c-format -msgid "%s: Relocation %s (%d) is not currently supported.\n" +#: elf32-mcore.c:98 elf32-mcore.c:428 +msgid "%B: Relocation %s (%d) is not currently supported.\n" msgstr "" -#: elf32-mcore.c:441 -#, c-format -msgid "%s: Unknown relocation type %d\n" +#: elf32-mcore.c:414 +msgid "%B: Unknown relocation type %d\n" msgstr "" -#: elf32-mips.c:1170 elf64-mips.c:1717 elfn32-mips.c:1664 +#: elf32-mips.c:971 elf64-mips.c:1929 elfn32-mips.c:1774 +msgid "literal relocation occurs for an external symbol" +msgstr "" + +#: elf32-mips.c:1011 elf64-mips.c:1972 elfn32-mips.c:1815 msgid "32bits gp relative relocation occurs for an external symbol" msgstr "" -#: elf32-mips.c:1314 elf64-mips.c:1830 elfn32-mips.c:1783 +#: elf32-mips.c:1134 elf64-mips.c:2066 elfn32-mips.c:1915 #, c-format msgid "Linking mips16 objects into %s format is not supported" msgstr "" -#: elf32-ppc.c:2056 +#: elf32-ppc.c:1652 #, c-format msgid "generic linker can't handle %s" msgstr "" -#: elf32-ppc.c:2138 -#, c-format -msgid "" -"%s: compiled with -mrelocatable and linked with modules compiled normally" +#: elf32-ppc.c:2080 +msgid "corrupt or empty %s section in %B" msgstr "" -#: elf32-ppc.c:2147 -#, c-format -msgid "" -"%s: compiled normally and linked with modules compiled with -mrelocatable" +#: elf32-ppc.c:2087 +msgid "unable to read in %s section from %B" msgstr "" -#: elf32-ppc.c:3413 -#, c-format -msgid "%s: relocation %s cannot be used when making a shared object" +#: elf32-ppc.c:2093 +msgid "corrupt %s section in %B" +msgstr "" + +#: elf32-ppc.c:2136 +msgid "warning: unable to set size of %s section in %B" +msgstr "" + +#: elf32-ppc.c:2183 +msgid "failed to allocate space for new APUinfo section." +msgstr "" + +#: elf32-ppc.c:2202 +msgid "failed to compute new APUinfo section." +msgstr "" + +#: elf32-ppc.c:2205 +msgid "failed to install new APUinfo section." +msgstr "" + +#: elf32-ppc.c:2941 +msgid "%B: relocation %s cannot be used when making a shared object" msgstr "" #. It does not make sense to have a procedure linkage #. table entry for a local symbol. -#: elf32-ppc.c:3619 -#, c-format -msgid "%s(%s+0x%lx): %s reloc against local symbol" +#: elf32-ppc.c:3211 +msgid "%B(%A+0x%lx): %s reloc against local symbol" msgstr "" -#: elf32-ppc.c:4862 elf64-ppc.c:7789 -#, c-format -msgid "%s: unknown relocation type %d for symbol %s" -msgstr "" - -#: elf32-ppc.c:5113 -#, c-format -msgid "%s(%s+0x%lx): non-zero addend on %s reloc against `%s'" -msgstr "" - -#: elf32-ppc.c:5399 elf32-ppc.c:5425 elf32-ppc.c:5484 -#, c-format +#: elf32-ppc.c:3541 msgid "" -"%s: the target (%s) of a %s relocation is in the wrong output section (%s)" +"%B: compiled with -mrelocatable and linked with modules compiled normally" msgstr "" -#: elf32-ppc.c:5539 -#, c-format -msgid "%s: relocation %s is not yet supported for symbol %s." +#: elf32-ppc.c:3549 +msgid "" +"%B: compiled normally and linked with modules compiled with -mrelocatable" msgstr "" -#: elf32-ppc.c:5594 elf64-ppc.c:8461 -#, c-format -msgid "%s(%s+0x%lx): unresolvable %s relocation against symbol `%s'" +#: elf32-ppc.c:5768 elf64-ppc.c:10186 +msgid "%B: unknown relocation type %d for symbol %s" msgstr "" -#: elf32-ppc.c:5644 elf64-ppc.c:8507 -#, c-format -msgid "%s(%s+0x%lx): %s reloc against `%s': error %d" +#: elf32-ppc.c:6018 +msgid "%B(%A+0x%lx): non-zero addend on %s reloc against `%s'" msgstr "" -#: elf32-ppc.c:5888 -#, c-format -msgid "corrupt or empty %s section in %s" +#: elf32-ppc.c:6365 elf32-ppc.c:6391 elf32-ppc.c:6450 +msgid "" +"%B: the target (%s) of a %s relocation is in the wrong output section (%s)" msgstr "" -#: elf32-ppc.c:5895 -#, c-format -msgid "unable to read in %s section from %s" +#: elf32-ppc.c:6505 +msgid "%B: relocation %s is not yet supported for symbol %s." msgstr "" -#: elf32-ppc.c:5901 -#, c-format -msgid "corrupt %s section in %s" +#: elf32-ppc.c:6610 elf64-ppc.c:10872 +msgid "%B(%A+0x%lx): %s reloc against `%s': error %d" msgstr "" -#: elf32-ppc.c:5944 -#, c-format -msgid "warning: unable to set size of %s section in %s" +#: elf32-s390.c:2253 elf64-s390.c:2225 +msgid "%B(%A+0x%lx): invalid instruction for TLS relocation %s" msgstr "" -#: elf32-ppc.c:5994 -msgid "failed to allocate space for new APUinfo section." -msgstr "" - -#: elf32-ppc.c:6013 -msgid "failed to compute new APUinfo section." -msgstr "" - -#: elf32-ppc.c:6016 -msgid "failed to install new APUinfo section." -msgstr "" - -#: elf32-s390.c:2256 elf64-s390.c:2226 -#, c-format -msgid "%s(%s+0x%lx): invalid instruction for TLS relocation %s" -msgstr "" - -#: elf32-sh64.c:221 elf64-sh64.c:2407 +#: elf32-sh64.c:218 elf64-sh64.c:2322 #, c-format msgid "%s: compiled as 32-bit object and %s is 64-bit" msgstr "" -#: elf32-sh64.c:224 elf64-sh64.c:2410 +#: elf32-sh64.c:221 elf64-sh64.c:2325 #, c-format msgid "%s: compiled as 64-bit object and %s is 32-bit" msgstr "" -#: elf32-sh64.c:226 elf64-sh64.c:2412 +#: elf32-sh64.c:223 elf64-sh64.c:2327 #, c-format msgid "%s: object size does not match that of target %s" msgstr "" -#: elf32-sh64.c:461 elf64-sh64.c:2990 +#: elf32-sh64.c:446 elf64-sh64.c:2899 #, c-format msgid "%s: encountered datalabel symbol in input" msgstr "" -#: elf32-sh64.c:544 +#: elf32-sh64.c:523 msgid "PTB mismatch: a SHmedia address (bit 0 == 1)" msgstr "" -#: elf32-sh64.c:547 +#: elf32-sh64.c:526 msgid "PTA mismatch: a SHcompact address (bit 0 == 0)" msgstr "" -#: elf32-sh64.c:565 +#: elf32-sh64.c:544 #, c-format msgid "%s: GAS error: unexpected PTB insn with R_SH_PT_16" msgstr "" -#: elf32-sh64.c:614 elf64-sh64.c:1748 -#, c-format -msgid "%s: error: unaligned relocation type %d at %08x reloc %08x\n" +#: elf32-sh64.c:593 +msgid "%B: error: unaligned relocation type %d at %08x reloc %p\n" msgstr "" -#: elf32-sh64.c:698 +#: elf32-sh64.c:669 #, c-format msgid "%s: could not write out added .cranges entries" msgstr "" -#: elf32-sh64.c:760 +#: elf32-sh64.c:729 #, c-format msgid "%s: could not write out sorted .cranges entries" msgstr "" -#: elf32-sh.c:2103 -#, c-format -msgid "%s: 0x%lx: warning: bad R_SH_USES offset" +#: elf32-sh.c:2176 +msgid "%B: 0x%lx: warning: bad R_SH_USES offset" msgstr "" -#: elf32-sh.c:2115 -#, c-format -msgid "%s: 0x%lx: warning: R_SH_USES points to unrecognized insn 0x%x" +#: elf32-sh.c:2188 +msgid "%B: 0x%lx: warning: R_SH_USES points to unrecognized insn 0x%x" msgstr "" -#: elf32-sh.c:2132 -#, c-format -msgid "%s: 0x%lx: warning: bad R_SH_USES load offset" +#: elf32-sh.c:2205 +msgid "%B: 0x%lx: warning: bad R_SH_USES load offset" msgstr "" -#: elf32-sh.c:2147 -#, c-format -msgid "%s: 0x%lx: warning: could not find expected reloc" +#: elf32-sh.c:2220 +msgid "%B: 0x%lx: warning: could not find expected reloc" msgstr "" -#: elf32-sh.c:2175 -#, c-format -msgid "%s: 0x%lx: warning: symbol in unexpected section" +#: elf32-sh.c:2248 +msgid "%B: 0x%lx: warning: symbol in unexpected section" msgstr "" -#: elf32-sh.c:2300 -#, c-format -msgid "%s: 0x%lx: warning: could not find expected COUNT reloc" +#: elf32-sh.c:2361 +msgid "%B: 0x%lx: warning: could not find expected COUNT reloc" msgstr "" -#: elf32-sh.c:2309 -#, c-format -msgid "%s: 0x%lx: warning: bad count" +#: elf32-sh.c:2370 +msgid "%B: 0x%lx: warning: bad count" msgstr "" -#: elf32-sh.c:2712 elf32-sh.c:3088 -#, c-format -msgid "%s: 0x%lx: fatal: reloc overflow while relaxing" +#: elf32-sh.c:2765 elf32-sh.c:3135 +msgid "%B: 0x%lx: fatal: reloc overflow while relaxing" msgstr "" -#: elf32-sh.c:4654 elf64-sh64.c:1585 +#: elf32-sh.c:4566 elf64-sh64.c:1509 msgid "Unexpected STO_SH5_ISA32 on local symbol is not handled" msgstr "" -#: elf32-sh.c:4809 -#, c-format -msgid "%s: unresolvable relocation against symbol `%s' from %s section" +#: elf32-sh.c:4791 +msgid "%B: 0x%lx: fatal: unaligned branch target for relax-support relocation" msgstr "" -#: elf32-sh.c:4881 -#, c-format -msgid "%s: 0x%lx: fatal: unaligned branch target for relax-support relocation" +#: elf32-sh.c:4824 elf32-sh.c:4839 +msgid "%B: 0x%lx: fatal: unaligned %s relocation 0x%lx" msgstr "" -#: elf32-sh.c:6627 elf64-alpha.c:4848 -#, c-format -msgid "%s: TLS local exec code cannot be linked into shared objects" +#: elf32-sh.c:4853 +msgid "%B: 0x%lx: fatal: R_SH_PSHA relocation %d not in range -32..32" msgstr "" -#: elf32-sparc.c:2521 elf64-sparc.c:2314 -#, c-format -msgid "%s: probably compiled without -fPIC?" +#: elf32-sh.c:4867 +msgid "%B: 0x%lx: fatal: R_SH_PSHL relocation %d not in range -32..32" msgstr "" -#: elf32-sparc.c:3348 -#, c-format -msgid "%s: compiled for a 64 bit system and target is 32 bit" +#: elf32-sh.c:6601 elf64-alpha.c:4466 +msgid "%B: TLS local exec code cannot be linked into shared objects" msgstr "" -#: elf32-sparc.c:3362 -#, c-format -msgid "%s: linking little endian files with big endian files" +#: elf32-sh-symbian.c:128 +msgid "%B: IMPORT AS directive for %s conceals previous IMPORT AS" msgstr "" -#: elf32-v850.c:753 +#: elf32-sh-symbian.c:381 +msgid "%B: Unrecognised .directive command: %s" +msgstr "" + +#: elf32-sh-symbian.c:502 +msgid "%B: Failed to add renamed symbol %s" +msgstr "" + +#: elf32-sparc.c:87 +msgid "%B: compiled for a 64 bit system and target is 32 bit" +msgstr "" + +#: elf32-sparc.c:100 +msgid "%B: linking little endian files with big endian files" +msgstr "" + +#: elf32-v850.c:160 #, c-format msgid "Variable `%s' cannot occupy in multiple small data regions" msgstr "" -#: elf32-v850.c:756 +#: elf32-v850.c:163 #, c-format msgid "" "Variable `%s' can only be in one of the small, zero, and tiny data regions" msgstr "" -#: elf32-v850.c:759 +#: elf32-v850.c:166 #, c-format msgid "" "Variable `%s' cannot be in both small and zero data regions simultaneously" msgstr "" -#: elf32-v850.c:762 +#: elf32-v850.c:169 #, c-format msgid "" "Variable `%s' cannot be in both small and tiny data regions simultaneously" msgstr "" -#: elf32-v850.c:765 +#: elf32-v850.c:172 #, c-format msgid "" "Variable `%s' cannot be in both zero and tiny data regions simultaneously" msgstr "" -#: elf32-v850.c:1144 +#: elf32-v850.c:475 +#, c-format msgid "FAILED to find previous HI16 reloc\n" msgstr "" -#: elf32-v850.c:1789 +#: elf32-v850.c:1684 msgid "could not locate special linker symbol __gp" msgstr "" -#: elf32-v850.c:1793 +#: elf32-v850.c:1688 msgid "could not locate special linker symbol __ep" msgstr "" -#: elf32-v850.c:1797 +#: elf32-v850.c:1692 msgid "could not locate special linker symbol __ctbp" msgstr "" -#: elf32-v850.c:1963 -#, c-format -msgid "%s: Architecture mismatch with previous modules" +#: elf32-v850.c:1870 +msgid "%B: Architecture mismatch with previous modules" msgstr "" -#: elf32-v850.c:1983 +#: elf32-v850.c:1889 #, c-format msgid "private flags = %lx: " msgstr "" -#: elf32-v850.c:1988 +#: elf32-v850.c:1894 +#, c-format msgid "v850 architecture" msgstr "" -#: elf32-v850.c:1989 +#: elf32-v850.c:1895 +#, c-format msgid "v850e architecture" msgstr "" -#: elf32-vax.c:549 +#: elf32-v850.c:1896 +#, c-format +msgid "v850e1 architecture" +msgstr "" + +#: elf32-vax.c:531 +#, c-format msgid " [nonpic]" msgstr "" -#: elf32-vax.c:552 +#: elf32-vax.c:534 +#, c-format msgid " [d-float]" msgstr "" -#: elf32-vax.c:555 +#: elf32-vax.c:537 +#, c-format msgid " [g-float]" msgstr "" -#: elf32-vax.c:663 +#: elf32-vax.c:647 #, c-format msgid "" "%s: warning: GOT addend of %ld to `%s' does not match previous GOT addend of " "%ld" msgstr "" -#: elf32-vax.c:1667 +#: elf32-vax.c:1604 #, c-format msgid "%s: warning: PLT addend of %d to `%s' from %s section ignored" msgstr "" -#: elf32-vax.c:1802 +#: elf32-vax.c:1728 #, c-format msgid "%s: warning: %s relocation against symbol `%s' from %s section" msgstr "" -#: elf32-vax.c:1808 +#: elf32-vax.c:1734 #, c-format msgid "%s: warning: %s relocation to 0x%x from %s section" msgstr "" -#: elf32-ia64.c:2326 elf32-xstormy16.c:462 elf64-ia64.c:2326 +#: elf32-xstormy16.c:425 elf32-ia64.c:2563 elf64-ia64.c:2563 msgid "non-zero addend in @fptr reloc" msgstr "" -#: elf64-alpha.c:1108 +#: elf32-xtensa.c:705 +msgid "%B(%A): invalid property table" +msgstr "" + +#: elf32-xtensa.c:2199 +msgid "%B(%A+0x%lx): relocation offset out of range (size=0x%x)" +msgstr "" + +#: elf32-xtensa.c:2256 +msgid "dynamic relocation in read-only section" +msgstr "" + +#: elf32-xtensa.c:2421 +msgid "internal inconsistency in size of .got.loc section" +msgstr "" + +#: elf32-xtensa.c:2735 +msgid "%B: incompatible machine type. Output is 0x%x. Input is 0x%x" +msgstr "" + +#: elf32-xtensa.c:3881 elf32-xtensa.c:3889 +msgid "Attempt to convert L32R/CALLX to CALL failed" +msgstr "" + +#: elf32-xtensa.c:5467 elf32-xtensa.c:5543 elf32-xtensa.c:6496 +#: elf32-xtensa.c:6550 +msgid "" +"%B(%A+0x%lx): could not decode instruction; possible configuration mismatch" +msgstr "" + +#: elf32-xtensa.c:6369 elf32-xtensa.c:6532 +msgid "" +"%B(%A+0x%lx): could not decode instruction for XTENSA_ASM_SIMPLIFY " +"relocation; possible configuration mismatch" +msgstr "" + +#: elf32-xtensa.c:7855 +msgid "invalid relocation address" +msgstr "" + +#: elf32-xtensa.c:7904 +msgid "overflow after relaxation" +msgstr "" + +#: elf32-xtensa.c:9032 +msgid "%B(%A+0x%lx): unexpected fix for %s relocation" +msgstr "" + +#: elf64-alpha.c:443 msgid "GPDISP relocation did not find ldah and lda instructions" msgstr "" -#: elf64-alpha.c:3731 -#, c-format -msgid "%s: .got subsegment exceeds 64K (size %d)" +#: elf64-alpha.c:2363 +msgid "%B: .got subsegment exceeds 64K (size %d)" msgstr "" -#: elf64-alpha.c:4602 elf64-alpha.c:4614 -#, c-format -msgid "%s: gp-relative relocation against dynamic symbol %s" +#: elf64-alpha.c:4210 elf64-alpha.c:4222 +msgid "%B: gp-relative relocation against dynamic symbol %s" msgstr "" -#: elf64-alpha.c:4640 elf64-alpha.c:4773 -#, c-format -msgid "%s: pc-relative relocation against dynamic symbol %s" +#: elf64-alpha.c:4248 elf64-alpha.c:4383 +msgid "%B: pc-relative relocation against dynamic symbol %s" msgstr "" -#: elf64-alpha.c:4668 -#, c-format -msgid "%s: change in gp: BRSGP %s" +#: elf64-alpha.c:4276 +msgid "%B: change in gp: BRSGP %s" msgstr "" -#: elf64-alpha.c:4693 +#: elf64-alpha.c:4301 msgid "" msgstr "" -#: elf64-alpha.c:4698 -#, c-format -msgid "%s: !samegp reloc against symbol without .prologue: %s" +#: elf64-alpha.c:4306 +msgid "%B: !samegp reloc against symbol without .prologue: %s" msgstr "" -#: elf64-alpha.c:4749 -#, c-format -msgid "%s: unhandled dynamic relocation against %s" +#: elf64-alpha.c:4358 +msgid "%B: unhandled dynamic relocation against %s" msgstr "" -#: elf64-alpha.c:4832 -#, c-format -msgid "%s: dtp-relative relocation against dynamic symbol %s" +#: elf64-alpha.c:4390 +msgid "%B: pc-relative relocation against undefined weak symbol %s" msgstr "" -#: elf64-alpha.c:4855 -#, c-format -msgid "%s: tp-relative relocation against dynamic symbol %s" +#: elf64-alpha.c:4450 +msgid "%B: dtp-relative relocation against dynamic symbol %s" msgstr "" -#: elf64-hppa.c:2086 +#: elf64-alpha.c:4473 +msgid "%B: tp-relative relocation against dynamic symbol %s" +msgstr "" + +#: elf64-hppa.c:2046 #, c-format msgid "stub entry for %s cannot load .plt, dp offset = %ld" msgstr "" -#: elf64-mmix.c:1032 +#: elf64-mmix.c:1163 #, c-format msgid "" "%s: Internal inconsistency error for value for\n" @@ -1495,109 +1805,129 @@ msgid "" "08lx\n" msgstr "" -#: elf64-mmix.c:1416 +#: elf64-mmix.c:1602 #, c-format msgid "" "%s: base-plus-offset relocation against register symbol: (unknown) in %s" msgstr "" -#: elf64-mmix.c:1421 +#: elf64-mmix.c:1607 #, c-format msgid "%s: base-plus-offset relocation against register symbol: %s in %s" msgstr "" -#: elf64-mmix.c:1465 +#: elf64-mmix.c:1651 #, c-format msgid "%s: register relocation against non-register symbol: (unknown) in %s" msgstr "" -#: elf64-mmix.c:1470 +#: elf64-mmix.c:1656 #, c-format msgid "%s: register relocation against non-register symbol: %s in %s" msgstr "" -#: elf64-mmix.c:1507 +#: elf64-mmix.c:1693 #, c-format msgid "%s: directive LOCAL valid only with a register or absolute value" msgstr "" -#: elf64-mmix.c:1535 +#: elf64-mmix.c:1721 #, c-format msgid "" "%s: LOCAL directive: Register $%ld is not a local register. First global " "register is $%ld." msgstr "" -#: elf64-mmix.c:1994 +#: elf64-mmix.c:2207 #, c-format msgid "" "%s: Error: multiple definition of `%s'; start of %s is set in a earlier " "linked file\n" msgstr "" -#: elf64-mmix.c:2053 +#: elf64-mmix.c:2265 msgid "Register section has contents\n" msgstr "" -#: elf64-mmix.c:2216 +#: elf64-mmix.c:2457 #, c-format msgid "" "Internal inconsistency: remaining %u != max %u.\n" " Please report this bug." msgstr "" -#: elf64-ppc.c:2388 libbfd.c:831 -#, c-format -msgid "%s: compiled for a big endian system and target is little endian" +#: elf64-ppc.c:2500 libbfd.c:931 +msgid "%B: compiled for a big endian system and target is little endian" msgstr "" -#: elf64-ppc.c:2391 libbfd.c:833 -#, c-format -msgid "%s: compiled for a little endian system and target is big endian" +#: elf64-ppc.c:2503 libbfd.c:933 +msgid "%B: compiled for a little endian system and target is big endian" msgstr "" -#: elf64-ppc.c:4857 +#: elf64-ppc.c:5707 #, c-format -msgid "%s: unexpected reloc type %u in .opd section" +msgid "" +"copy reloc against `%s' requires lazy plt linking; avoid setting " +"LD_BIND_NOW=1 or upgrade gcc" msgstr "" -#: elf64-ppc.c:4877 -#, c-format -msgid "%s: .opd is not a regular array of opd entries" +#: elf64-ppc.c:6155 +msgid "dynreloc miscount for %B, section %A" msgstr "" -#: elf64-ppc.c:4897 -#, c-format -msgid "%s: undefined sym `%s' in .opd section" +#: elf64-ppc.c:6257 +msgid "%B: .opd is not a regular array of opd entries" msgstr "" -#: elf64-ppc.c:6136 +#: elf64-ppc.c:6266 +msgid "%B: unexpected reloc type %u in .opd section" +msgstr "" + +#: elf64-ppc.c:6287 +msgid "%B: undefined sym `%s' in .opd section" +msgstr "" + +#: elf64-ppc.c:6939 elf64-ppc.c:7318 +#, c-format +msgid "%s defined in removed toc entry" +msgstr "" + +#: elf64-ppc.c:8041 +#, c-format +msgid "long branch stub `%s' offset overflow" +msgstr "" + +#: elf64-ppc.c:8116 #, c-format msgid "can't find branch stub `%s'" msgstr "" -#: elf64-ppc.c:6175 elf64-ppc.c:6250 +#: elf64-ppc.c:8155 elf64-ppc.c:8231 #, c-format msgid "linkage table error against `%s'" msgstr "" -#: elf64-ppc.c:6340 +#: elf64-ppc.c:8360 #, c-format msgid "can't build branch stub `%s'" msgstr "" -#: elf64-ppc.c:7047 +#: elf64-ppc.c:8784 +msgid "%B section %A exceeds stub group size" +msgstr "" + +#: elf64-ppc.c:9295 msgid ".glink and .plt too far apart" msgstr "" -#: elf64-ppc.c:7135 +#: elf64-ppc.c:9408 msgid "stubs don't match calculated size" msgstr "" -#: elf64-ppc.c:7147 +#: elf64-ppc.c:9420 #, c-format msgid "" -"linker stubs in %u groups\n" +"linker stubs in %u group%s\n" " branch %lu\n" " toc adjust %lu\n" " long branch %lu\n" @@ -1605,399 +1935,500 @@ msgid "" " plt call %lu" msgstr "" -#: elf64-ppc.c:7723 -#, c-format +#: elf64-ppc.c:10075 msgid "" -"%s(%s+0x%lx): automatic multiple TOCs not supported using your crt files; " +"%B(%A+0x%lx): automatic multiple TOCs not supported using your crt files; " "recompile with -mminimal-toc or upgrade gcc" msgstr "" -#: elf64-ppc.c:7731 -#, c-format +#: elf64-ppc.c:10083 msgid "" -"%s(%s+0x%lx): sibling call optimization to `%s' does not allow automatic " +"%B(%A+0x%lx): sibling call optimization to `%s' does not allow automatic " "multiple TOCs; recompile with -mminimal-toc or -fno-optimize-sibling-calls, " "or make `%s' extern" msgstr "" -#: elf64-ppc.c:8329 -#, c-format -msgid "%s: relocation %s is not supported for symbol %s." +#: elf64-ppc.c:10727 +msgid "%B: relocation %s is not supported for symbol %s." msgstr "" -#: elf64-ppc.c:8408 -#, c-format -msgid "%s: error: relocation %s not a multiple of %d" +#: elf64-ppc.c:10806 +msgid "%B: error: relocation %s not a multiple of %d" msgstr "" -#: elf-hppa.h:1458 elf-hppa.h:1491 elf-m10300.c:1628 elf64-sh64.c:1704 +#: elf64-sh64.c:1676 #, c-format +msgid "%s: error: unaligned relocation type %d at %08x reloc %08x\n" +msgstr "" + +#: elf64-sparc.c:438 +msgid "%B: Only registers %%g[2367] can be declared using STT_REGISTER" +msgstr "" + +#: elf64-sparc.c:458 +msgid "Register %%g%d used incompatibly: %s in %B, previously %s in %B" +msgstr "" + +#: elf64-sparc.c:481 +msgid "Symbol `%s' has differing types: REGISTER in %B, previously %s in %B" +msgstr "" + +#: elf64-sparc.c:526 +msgid "Symbol `%s' has differing types: %s in %B, previously REGISTER in %B" +msgstr "" + +#: elf64-sparc.c:677 +msgid "%B: linking UltraSPARC specific with HAL specific code" +msgstr "" + +#: elf64-x86-64.c:692 elf64-x86-64.c:818 elf64-x86-64.c:2069 msgid "" -"%s: warning: unresolvable relocation against symbol `%s' from %s section" +"%B: relocation %s against `%s' can not be used when making a shared object; " +"recompile with -fPIC" msgstr "" -#: elf64-sparc.c:1370 +#: elf64-x86-64.c:760 +msgid "%B: %s' accessed both as normal and thread local symbol" +msgstr "" + +#: elf64-x86-64.c:2000 +msgid "" +"%B: relocation R_X86_64_GOTOFF64 against protected function `%s' can not be " +"used when making a shared object" +msgstr "" + +#: elf64-x86-64.c:2065 +msgid "" +"%B: relocation R_X86_64_PC32 against protected function `%s' can not be used " +"when making a shared object" +msgstr "" + +#: elf.c:288 +msgid "%B: invalid string offset %u >= %lu for section `%s'" +msgstr "" + +#: elf.c:552 +msgid "%B: invalid SHT_GROUP entry" +msgstr "" + +#: elf.c:622 +msgid "%B: no group info for section %A" +msgstr "" + +#: elf.c:652 elf.c:3091 elflink.c:7588 +msgid "%B: warning: sh_link not set for section `%A'" +msgstr "" + +#: elf.c:688 +msgid "%B: unknown [%d] section `%s' in group [%s]" +msgstr "" + +#: elf.c:1071 #, c-format -msgid "%s: check_relocs: unhandled reloc type %d" -msgstr "" - -#: elf64-sparc.c:1407 -#, c-format -msgid "%s: Only registers %%g[2367] can be declared using STT_REGISTER" -msgstr "" - -#: elf64-sparc.c:1427 -#, c-format -msgid "Register %%g%d used incompatibly: %s in %s, previously %s in %s" -msgstr "" - -#: elf64-sparc.c:1450 -#, c-format -msgid "Symbol `%s' has differing types: REGISTER in %s, previously %s in %s" -msgstr "" - -#: elf64-sparc.c:1496 -#, c-format -msgid "Symbol `%s' has differing types: %s in %s, previously REGISTER in %s" -msgstr "" - -#: elf64-sparc.c:3053 -#, c-format -msgid "%s: linking UltraSPARC specific with HAL specific code" -msgstr "" - -#: elf64-x86-64.c:739 -#, c-format -msgid "%s: %s' accessed both as normal and thread local symbol" -msgstr "" - -#: elf.c:372 -#, c-format -msgid "%s: invalid string offset %u >= %lu for section `%s'" -msgstr "" - -#: elf.c:624 -#, c-format -msgid "%s: invalid SHT_GROUP entry" -msgstr "" - -#: elf.c:695 -#, c-format -msgid "%s: no group info for section %s" -msgstr "" - -#: elf.c:1055 msgid "" "\n" "Program Header:\n" msgstr "" -#: elf.c:1106 +#: elf.c:1123 +#, c-format msgid "" "\n" "Dynamic Section:\n" msgstr "" -#: elf.c:1235 +#: elf.c:1248 +#, c-format msgid "" "\n" "Version definitions:\n" msgstr "" -#: elf.c:1258 +#: elf.c:1273 +#, c-format msgid "" "\n" "Version References:\n" msgstr "" -#: elf.c:1263 +#: elf.c:1278 #, c-format msgid " required from %s:\n" msgstr "" -#: elf.c:1944 -#, c-format -msgid "%s: invalid link %lu for reloc section %s (index %u)" +#: elf.c:1985 +msgid "%B: invalid link %lu for reloc section %s (index %u)" msgstr "" -#: elf.c:3686 -#, c-format -msgid "%s: Not enough room for program headers (allocated %u, need %u)" +#: elf.c:3062 +msgid "%B: sh_link of section `%A' points to discarded section `%A' of `%B'" msgstr "" -#: elf.c:3791 -#, c-format -msgid "%s: Not enough room for program headers, try linking with -N" +#: elf.c:4070 +msgid "%B: Not enough room for program headers (allocated %u, need %u)" msgstr "" -#: elf.c:3922 -#, c-format +#: elf.c:4173 msgid "" -"Error: First section in segment (%s) starts at 0x%x whereas the segment " -"starts at 0x%x" +"%B: The first section in the PT_DYNAMIC segment is not the .dynamic section" msgstr "" -#: elf.c:4242 -#, c-format -msgid "%s: warning: allocated section `%s' not in segment" +#: elf.c:4217 +msgid "%B: Not enough room for program headers, try linking with -N" msgstr "" -#: elf.c:4566 -#, c-format -msgid "%s: symbol `%s' required but not present" +#: elf.c:4308 +msgid "%B: section %A lma 0x%lx overlaps previous sections" msgstr "" -#: elf.c:4854 -#, c-format -msgid "%s: warning: Empty loadable segment detected, is this intentional ?\n" +#: elf.c:4709 +msgid "%B: warning: allocated section `%s' not in segment" msgstr "" -#: elf.c:5485 +#: elf.c:5002 +msgid "%B: symbol `%s' required but not present" +msgstr "" + +#: elf.c:5299 +msgid "%B: warning: Empty loadable segment detected, is this intentional ?\n" +msgstr "" + +#: elf.c:5961 #, c-format msgid "" "Unable to find equivalent output section for symbol '%s' from section '%s'" msgstr "" -#: elf.c:6298 -#, c-format -msgid "%s: unsupported relocation type %s" +#: elf.c:6917 +msgid "%B: unsupported relocation type %s" msgstr "" -#: elfcode.h:1113 +#: elfcode.h:1110 #, c-format msgid "%s: version count (%ld) does not match symbol count (%ld)" msgstr "" -#: elfcode.h:1342 +#: elfcode.h:1337 #, c-format msgid "%s(%s): relocation %d has invalid symbol index %ld" msgstr "" -#: elflink.c:1456 -#, c-format -msgid "%s: warning: unexpected redefinition of indirect versioned symbol `%s'" +#: elf-hppa.h:1443 elf-hppa.h:1458 +msgid "%B(%A): warning: unresolvable relocation against symbol `%s'" +msgstr "" + +#: elflink.c:907 +msgid "" +"%s: TLS definition in %B section %A mismatches non-TLS definition in %B " +"section %A" +msgstr "" + +#: elflink.c:911 +msgid "%s: TLS reference in %B mismatches non-TLS reference in %B" +msgstr "" + +#: elflink.c:915 +msgid "%s: TLS definition in %B section %A mismatches non-TLS reference in %B" +msgstr "" + +#: elflink.c:919 +msgid "%s: TLS reference in %B mismatches non-TLS definition in %B section %A" +msgstr "" + +#: elflink.c:1491 +msgid "%B: unexpected redefinition of indirect versioned symbol `%s'" msgstr "" #: elflink.c:1807 -#, c-format -msgid "%s: undefined versioned symbol name %s" +msgid "%B: undefined versioned symbol name %s" msgstr "" -#: elflink.c:2142 -#, c-format -msgid "%s: relocation size mismatch in %s section %s" +#: elflink.c:1955 +msgid "" +"%B: bad reloc symbol index (0x%lx >= 0x%lx) for offset 0x%lx in section `%A'" msgstr "" -#: elflink.c:2434 +#: elflink.c:2147 +msgid "%B: relocation size mismatch in %B section %A" +msgstr "" + +#: elflink.c:2437 #, c-format msgid "warning: type and size of dynamic symbol `%s' are not defined" msgstr "" -#: elflink.h:1022 -#, c-format -msgid "%s: %s: invalid version %u (max %d)" +#: elflink.c:2761 +msgid "warning: creating a DT_TEXTREL in a shared object." msgstr "" -#: elflink.h:1063 -#, c-format -msgid "%s: %s: invalid needed version %d" +#: elflink.c:3696 +msgid "%B: %s: invalid version %u (max %d)" msgstr "" -#: elflink.h:1238 -#, c-format -msgid "Warning: alignment %u of symbol `%s' in %s is smaller than %u in %s" +#: elflink.c:3732 +msgid "%B: %s: invalid needed version %d" msgstr "" -#: elflink.h:1252 -#, c-format -msgid "Warning: size of symbol `%s' changed from %lu in %s to %lu in %s" +#: elflink.c:3912 +msgid "Warning: alignment %u of symbol `%s' in %B is smaller than %u in %B" msgstr "" -#: elflink.h:2160 +#: elflink.c:3924 +msgid "Warning: size of symbol `%s' changed from %lu in %B to %lu in %B" +msgstr "" + +#: elflink.c:4091 +#, c-format +msgid "%s: invalid DSO for symbol `%s' definition" +msgstr "" + +#: elflink.c:5152 #, c-format msgid "%s: undefined version: %s" msgstr "" -#: elflink.h:2226 -#, c-format -msgid "%s: .preinit_array section is not allowed in DSO" +#: elflink.c:5219 +msgid "%B: .preinit_array section is not allowed in DSO" msgstr "" -#: elflink.h:3078 +#: elflink.c:5978 msgid "Not enough memory to sort relocations" msgstr "" -#: elflink.h:3958 elflink.h:4001 -#, c-format -msgid "%s: could not find output section %s" +#: elflink.c:6369 +msgid "%B: %s symbol `%s' in %B is referenced by DSO" msgstr "" -#: elflink.h:3964 +#: elflink.c:6452 +msgid "%B: could not find output section %A for input section %A" +msgstr "" + +#: elflink.c:6549 +msgid "%B: %s symbol `%s' isn't defined" +msgstr "" + +#: elflink.c:7024 +msgid "" +"error: %B contains a reloc (0x%s) for section %A that references a non-" +"existent global symbol" +msgstr "" + +#: elflink.c:7058 +msgid "" +"%X`%s' referenced in section `%A' of %B: defined in discarded section `%A' " +"of %B\n" +msgstr "" + +#: elflink.c:7665 +msgid "%A has both ordered [`%A' in %B] and unordered [`%A' in %B] sections" +msgstr "" + +#: elflink.c:7670 +#, c-format +msgid "%A has both ordered and unordered sections" +msgstr "" + +#: elflink.c:8487 elflink.c:8528 +msgid "%B: could not find output section %s" +msgstr "" + +#: elflink.c:8492 #, c-format msgid "warning: %s section has zero size" msgstr "" -#: elflink.h:4483 -#, c-format -msgid "%s: %s symbol `%s' in %s is referenced by DSO" +#: elflink.c:9087 +msgid "Warning: gc-sections option ignored" msgstr "" -#: elflink.h:4564 -#, c-format -msgid "%s: could not find output section %s for input section %s" +#: elflink.c:9704 +msgid "%B: ignoring duplicate section `%A'" msgstr "" -#: elflink.h:4666 -#, c-format -msgid "%s: %s symbol `%s' isn't defined" +#: elflink.c:9711 elflink.c:9718 +msgid "%B: duplicate section `%A' has different size" msgstr "" -#: elflink.h:5053 elflink.h:5095 -msgid "%T: discarded in section `%s' from %s\n" +#: elflink.c:9726 elflink.c:9731 +msgid "%B: warning: could not read contents of section `%A'" msgstr "" -#: elfxx-mips.c:887 +#: elflink.c:9735 +msgid "%B: warning: duplicate section `%A' has different contents" +msgstr "" + +#: elfxx-mips.c:866 msgid "static procedure (no name)" msgstr "" -#: elfxx-mips.c:1897 +#: elfxx-mips.c:2513 msgid "not enough GOT space for local GOT entries" msgstr "" -#: elfxx-mips.c:3691 -#, c-format -msgid "%s: %s+0x%lx: jump to stub routine which is not jal" +#: elfxx-mips.c:4356 +msgid "%B: %A+0x%lx: jump to stub routine which is not jal" msgstr "" -#: elfxx-mips.c:5192 -#, c-format -msgid "%s: Malformed reloc detected for section %s" +#: elfxx-mips.c:4993 elfxx-mips.c:5214 +msgid "%B: Warning: bad `%s' option size %u smaller than its header" msgstr "" -#: elfxx-mips.c:5266 -#, c-format -msgid "%s: CALL16 reloc at 0x%lx not against global symbol" +#: elfxx-mips.c:5965 +msgid "%B: Malformed reloc detected for section %s" msgstr "" -#: elfxx-mips.c:8693 +#: elfxx-mips.c:6041 +msgid "%B: CALL16 reloc at 0x%lx not against global symbol" +msgstr "" + +#: elfxx-mips.c:9380 #, c-format msgid "%s: illegal section name `%s'" msgstr "" -#: elfxx-mips.c:9027 -#, c-format -msgid "%s: endianness incompatible with that of the selected emulation" +#: elfxx-mips.c:9719 +msgid "%B: endianness incompatible with that of the selected emulation" msgstr "" -#: elfxx-mips.c:9039 -#, c-format -msgid "%s: ABI is incompatible with that of the selected emulation" +#: elfxx-mips.c:9731 +msgid "%B: ABI is incompatible with that of the selected emulation" msgstr "" -#: elfxx-mips.c:9106 -#, c-format -msgid "%s: warning: linking PIC files with non-PIC files" +#: elfxx-mips.c:9803 +msgid "%B: warning: linking PIC files with non-PIC files" msgstr "" -#: elfxx-mips.c:9123 -#, c-format -msgid "%s: linking 32-bit code with 64-bit code" +#: elfxx-mips.c:9820 +msgid "%B: linking 32-bit code with 64-bit code" msgstr "" -#: elfxx-mips.c:9151 -#, c-format -msgid "%s: linking %s module with previous %s modules" +#: elfxx-mips.c:9848 +msgid "%B: linking %s module with previous %s modules" msgstr "" -#: elfxx-mips.c:9174 -#, c-format -msgid "%s: ABI mismatch: linking %s module with previous %s modules" +#: elfxx-mips.c:9871 +msgid "%B: ABI mismatch: linking %s module with previous %s modules" msgstr "" -#: elfxx-mips.c:9243 +#: elfxx-mips.c:9936 +#, c-format msgid " [abi=O32]" msgstr "" -#: elfxx-mips.c:9245 +#: elfxx-mips.c:9938 +#, c-format msgid " [abi=O64]" msgstr "" -#: elfxx-mips.c:9247 +#: elfxx-mips.c:9940 +#, c-format msgid " [abi=EABI32]" msgstr "" -#: elfxx-mips.c:9249 +#: elfxx-mips.c:9942 +#, c-format msgid " [abi=EABI64]" msgstr "" -#: elfxx-mips.c:9251 +#: elfxx-mips.c:9944 +#, c-format msgid " [abi unknown]" msgstr "" -#: elfxx-mips.c:9253 +#: elfxx-mips.c:9946 +#, c-format msgid " [abi=N32]" msgstr "" -#: elfxx-mips.c:9255 +#: elfxx-mips.c:9948 +#, c-format msgid " [abi=64]" msgstr "" -#: elfxx-mips.c:9257 +#: elfxx-mips.c:9950 +#, c-format msgid " [no abi set]" msgstr "" -#: elfxx-mips.c:9260 +#: elfxx-mips.c:9953 +#, c-format msgid " [mips1]" msgstr "" -#: elfxx-mips.c:9262 +#: elfxx-mips.c:9955 +#, c-format msgid " [mips2]" msgstr "" -#: elfxx-mips.c:9264 +#: elfxx-mips.c:9957 +#, c-format msgid " [mips3]" msgstr "" -#: elfxx-mips.c:9266 +#: elfxx-mips.c:9959 +#, c-format msgid " [mips4]" msgstr "" -#: elfxx-mips.c:9268 +#: elfxx-mips.c:9961 +#, c-format msgid " [mips5]" msgstr "" -#: elfxx-mips.c:9270 +#: elfxx-mips.c:9963 +#, c-format msgid " [mips32]" msgstr "" -#: elfxx-mips.c:9272 +#: elfxx-mips.c:9965 +#, c-format msgid " [mips64]" msgstr "" -#: elfxx-mips.c:9274 +#: elfxx-mips.c:9967 +#, c-format msgid " [mips32r2]" msgstr "" -#: elfxx-mips.c:9276 +#: elfxx-mips.c:9969 +#, c-format +msgid " [mips64r2]" +msgstr "" + +#: elfxx-mips.c:9971 +#, c-format msgid " [unknown ISA]" msgstr "" -#: elfxx-mips.c:9279 +#: elfxx-mips.c:9974 +#, c-format msgid " [mdmx]" msgstr "" -#: elfxx-mips.c:9282 +#: elfxx-mips.c:9977 +#, c-format msgid " [mips16]" msgstr "" -#: elfxx-mips.c:9285 +#: elfxx-mips.c:9980 +#, c-format msgid " [32bitmode]" msgstr "" -#: elfxx-mips.c:9287 +#: elfxx-mips.c:9982 +#, c-format msgid " [not 32bitmode]" msgstr "" +#: elfxx-sparc.c:402 +#, c-format +msgid "invalid relocation type %d" +msgstr "" + +#: elfxx-sparc.c:2783 +msgid "%B: probably compiled without -fPIC?" +msgstr "" + #: i386linux.c:457 m68klinux.c:461 sparclinux.c:458 #, c-format msgid "Output file requires shared library `%s'\n" @@ -2018,249 +2449,244 @@ msgstr "" msgid "Warning: fixup count mismatch\n" msgstr "" -#: ieee.c:293 +#: ieee.c:157 #, c-format msgid "%s: string too long (%d chars, max 65535)" msgstr "" -#: ieee.c:428 +#: ieee.c:284 #, c-format msgid "%s: unrecognized symbol `%s' flags 0x%x" msgstr "" -#: ieee.c:938 -#, c-format -msgid "%s: unimplemented ATI record %u for symbol %u" +#: ieee.c:786 +msgid "%B: unimplemented ATI record %u for symbol %u" msgstr "" -#: ieee.c:963 -#, c-format -msgid "%s: unexpected ATN type %d in external part" +#: ieee.c:810 +msgid "%B: unexpected ATN type %d in external part" msgstr "" -#: ieee.c:985 -#, c-format -msgid "%s: unexpected type after ATN" +#: ieee.c:832 +msgid "%B: unexpected type after ATN" msgstr "" -#: ihex.c:264 -#, c-format -msgid "%s:%d: unexpected character `%s' in Intel Hex file\n" +#: ihex.c:228 +msgid "%B:%d: unexpected character `%s' in Intel Hex file" msgstr "" -#: ihex.c:372 -#, c-format -msgid "%s:%u: bad checksum in Intel Hex file (expected %u, found %u)" +#: ihex.c:335 +msgid "%B:%u: bad checksum in Intel Hex file (expected %u, found %u)" msgstr "" -#: ihex.c:426 -#, c-format -msgid "%s:%u: bad extended address record length in Intel Hex file" +#: ihex.c:389 +msgid "%B:%u: bad extended address record length in Intel Hex file" msgstr "" -#: ihex.c:443 -#, c-format -msgid "%s:%u: bad extended start address length in Intel Hex file" +#: ihex.c:406 +msgid "%B:%u: bad extended start address length in Intel Hex file" msgstr "" -#: ihex.c:460 -#, c-format -msgid "%s:%u: bad extended linear address record length in Intel Hex file" +#: ihex.c:423 +msgid "%B:%u: bad extended linear address record length in Intel Hex file" msgstr "" -#: ihex.c:477 -#, c-format -msgid "%s:%u: bad extended linear start address length in Intel Hex file" +#: ihex.c:440 +msgid "%B:%u: bad extended linear start address length in Intel Hex file" msgstr "" -#: ihex.c:494 -#, c-format -msgid "%s:%u: unrecognized ihex type %u in Intel Hex file\n" +#: ihex.c:457 +msgid "%B:%u: unrecognized ihex type %u in Intel Hex file" msgstr "" -#: ihex.c:619 -#, c-format -msgid "%s: internal error in ihex_read_section" +#: ihex.c:578 +msgid "%B: internal error in ihex_read_section" msgstr "" -#: ihex.c:654 -#, c-format -msgid "%s: bad section length in ihex_read_section" +#: ihex.c:612 +msgid "%B: bad section length in ihex_read_section" msgstr "" -#: ihex.c:872 +#: ihex.c:824 #, c-format msgid "%s: address 0x%s out of range for Intel Hex file" msgstr "" -#: libbfd.c:861 +#: libbfd.c:961 #, c-format msgid "Deprecated %s called at %s line %d in %s\n" msgstr "" -#: libbfd.c:864 +#: libbfd.c:964 #, c-format msgid "Deprecated %s called\n" msgstr "" -#: linker.c:1829 -#, c-format -msgid "%s: indirect symbol `%s' to `%s' is a loop" +#: linker.c:1873 +msgid "%B: indirect symbol `%s' to `%s' is a loop" msgstr "" -#: linker.c:2697 +#: linker.c:2740 #, c-format msgid "Attempt to do relocatable link with %s input and %s output" msgstr "" -#: merge.c:896 -#, c-format -msgid "%s: access beyond end of merged section (%ld + %ld)" +#: linker.c:3037 +msgid "%B: warning: ignoring duplicate section `%A'\n" msgstr "" -#: mmo.c:503 +#: linker.c:3051 +msgid "%B: warning: duplicate section `%A' has different size\n" +msgstr "" + +#: merge.c:817 +#, c-format +msgid "%s: access beyond end of merged section (%ld)" +msgstr "" + +#: mmo.c:456 #, c-format msgid "%s: No core to allocate section name %s\n" msgstr "" -#: mmo.c:579 +#: mmo.c:531 #, c-format msgid "%s: No core to allocate a symbol %d bytes long\n" msgstr "" -#: mmo.c:1287 +#: mmo.c:1187 #, c-format msgid "%s: invalid mmo file: initialization value for $255 is not `Main'\n" msgstr "" -#: mmo.c:1433 +#: mmo.c:1332 #, c-format msgid "" "%s: unsupported wide character sequence 0x%02X 0x%02X after symbol name " "starting with `%s'\n" msgstr "" -#: mmo.c:1674 +#: mmo.c:1566 #, c-format msgid "%s: invalid mmo file: unsupported lopcode `%d'\n" msgstr "" -#: mmo.c:1684 +#: mmo.c:1576 #, c-format msgid "%s: invalid mmo file: expected YZ = 1 got YZ = %d for lop_quote\n" msgstr "" -#: mmo.c:1720 +#: mmo.c:1612 #, c-format msgid "%s: invalid mmo file: expected z = 1 or z = 2, got z = %d for lop_loc\n" msgstr "" -#: mmo.c:1766 +#: mmo.c:1658 #, c-format msgid "" "%s: invalid mmo file: expected z = 1 or z = 2, got z = %d for lop_fixo\n" msgstr "" -#: mmo.c:1805 +#: mmo.c:1697 #, c-format msgid "%s: invalid mmo file: expected y = 0, got y = %d for lop_fixrx\n" msgstr "" -#: mmo.c:1814 +#: mmo.c:1706 #, c-format msgid "" "%s: invalid mmo file: expected z = 16 or z = 24, got z = %d for lop_fixrx\n" msgstr "" -#: mmo.c:1837 +#: mmo.c:1729 #, c-format msgid "" "%s: invalid mmo file: leading byte of operand word must be 0 or 1, got %d " "for lop_fixrx\n" msgstr "" -#: mmo.c:1860 +#: mmo.c:1752 #, c-format msgid "%s: cannot allocate file name for file number %d, %d bytes\n" msgstr "" -#: mmo.c:1880 +#: mmo.c:1772 #, c-format msgid "" "%s: invalid mmo file: file number %d `%s', was already entered as `%s'\n" msgstr "" -#: mmo.c:1893 +#: mmo.c:1785 #, c-format msgid "" "%s: invalid mmo file: file name for number %d was not specified before use\n" msgstr "" -#: mmo.c:1999 +#: mmo.c:1892 #, c-format msgid "" "%s: invalid mmo file: fields y and z of lop_stab non-zero, y: %d, z: %d\n" msgstr "" -#: mmo.c:2035 +#: mmo.c:1928 #, c-format msgid "%s: invalid mmo file: lop_end not last item in file\n" msgstr "" -#: mmo.c:2048 +#: mmo.c:1941 #, c-format msgid "" "%s: invalid mmo file: YZ of lop_end (%ld) not equal to the number of tetras " "to the preceding lop_stab (%ld)\n" msgstr "" -#: mmo.c:2698 +#: mmo.c:2649 #, c-format msgid "%s: invalid symbol table: duplicate symbol `%s'\n" msgstr "" -#: mmo.c:2949 +#: mmo.c:2892 #, c-format msgid "" "%s: Bad symbol definition: `Main' set to %s rather than the start address %" "s\n" msgstr "" -#: mmo.c:3039 +#: mmo.c:2984 #, c-format msgid "" "%s: warning: symbol table too large for mmo, larger than 65535 32-bit words: " "%d. Only `Main' will be emitted.\n" msgstr "" -#: mmo.c:3084 +#: mmo.c:3029 #, c-format msgid "%s: internal error, symbol table changed size from %d to %d words\n" msgstr "" -#: mmo.c:3139 +#: mmo.c:3081 #, c-format msgid "%s: internal error, internal register section %s had contents\n" msgstr "" -#: mmo.c:3191 +#: mmo.c:3132 #, c-format msgid "%s: no initialized registers; section length 0\n" msgstr "" -#: mmo.c:3197 +#: mmo.c:3138 #, c-format msgid "%s: too many initialized registers; section length %ld\n" msgstr "" -#: mmo.c:3202 +#: mmo.c:3143 #, c-format msgid "" "%s: invalid start address for initialized registers of length %ld: 0x%lx%" "08lx\n" msgstr "" -#: oasys.c:1052 +#: oasys.c:876 #, c-format msgid "%s: can not represent section `%s' in oasys" msgstr "" @@ -2271,246 +2697,240 @@ msgid "Unhandled OSF/1 core file section type %d\n" msgstr "" #. XXX code yet to be written. -#: peicode.h:787 -#, c-format -msgid "%s: Unhandled import type; %x" +#: peicode.h:731 +msgid "%B: Unhandled import type; %x" msgstr "" -#: peicode.h:792 -#, c-format -msgid "%s: Unrecognised import type; %x" +#: peicode.h:736 +msgid "%B: Unrecognised import type; %x" msgstr "" -#: peicode.h:806 -#, c-format -msgid "%s: Unrecognised import name type; %x" +#: peicode.h:750 +msgid "%B: Unrecognised import name type; %x" msgstr "" -#: peicode.h:1164 -#, c-format -msgid "%s: Unrecognised machine type (0x%x) in Import Library Format archive" +#: peicode.h:1120 +msgid "%B: Unrecognised machine type (0x%x) in Import Library Format archive" msgstr "" -#: peicode.h:1176 -#, c-format +#: peicode.h:1132 msgid "" -"%s: Recognised but unhandled machine type (0x%x) in Import Library Format " +"%B: Recognised but unhandled machine type (0x%x) in Import Library Format " "archive" msgstr "" -#: peicode.h:1193 -#, c-format -msgid "%s: size field is zero in Import Library Format header" +#: peicode.h:1150 +msgid "%B: size field is zero in Import Library Format header" msgstr "" -#: peicode.h:1224 -#, c-format -msgid "%s: string not null terminated in ILF object file." +#: peicode.h:1181 +msgid "%B: string not null terminated in ILF object file." msgstr "" -#: pe-mips.c:659 -#, c-format -msgid "%s: `ld -r' not supported with PE MIPS objects\n" +#: pe-mips.c:588 +msgid "%B: `ld -r' not supported with PE MIPS objects\n" msgstr "" #. 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 -#. -#: pe-mips.c:795 -#, c-format -msgid "%s: unimplemented %s\n" +#. val = VMA of what we need to refer to. +#: pe-mips.c:704 +msgid "%B: unimplemented %s\n" msgstr "" -#: pe-mips.c:821 -#, c-format -msgid "%s: jump too far away\n" +#: pe-mips.c:730 +msgid "%B: jump too far away\n" msgstr "" -#: pe-mips.c:848 -#, c-format -msgid "%s: bad pair/reflo after refhi\n" +#: pe-mips.c:756 +msgid "%B: bad pair/reflo after refhi\n" msgstr "" -#: ppcboot.c:416 +#: ppcboot.c:419 +#, c-format msgid "" "\n" "ppcboot header:\n" msgstr "" -#: ppcboot.c:417 +#: ppcboot.c:420 #, c-format msgid "Entry offset = 0x%.8lx (%ld)\n" msgstr "" -#: ppcboot.c:418 +#: ppcboot.c:421 #, c-format msgid "Length = 0x%.8lx (%ld)\n" msgstr "" -#: ppcboot.c:421 +#: ppcboot.c:424 #, c-format msgid "Flag field = 0x%.2x\n" msgstr "" -#: ppcboot.c:427 +#: ppcboot.c:430 #, c-format msgid "Partition name = \"%s\"\n" msgstr "" -#: ppcboot.c:446 +#: ppcboot.c:449 #, c-format msgid "" "\n" "Partition[%d] start = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n" msgstr "" -#: ppcboot.c:452 +#: ppcboot.c:455 #, c-format msgid "Partition[%d] end = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n" msgstr "" -#: ppcboot.c:458 +#: ppcboot.c:461 #, c-format msgid "Partition[%d] sector = 0x%.8lx (%ld)\n" msgstr "" -#: ppcboot.c:459 +#: ppcboot.c:462 #, c-format msgid "Partition[%d] length = 0x%.8lx (%ld)\n" msgstr "" -#: som.c:5422 +#: som.c:5069 +#, c-format +msgid "" +"\n" +"Exec Auxiliary Header\n" +msgstr "" + +#: som.c:5330 msgid "som_sizeof_headers unimplemented" msgstr "" -#: srec.c:302 -#, c-format -msgid "%s:%d: Unexpected character `%s' in S-record file\n" +#: srec.c:259 +msgid "%B:%d: Unexpected character `%s' in S-record file\n" msgstr "" -#: stabs.c:319 -#, c-format -msgid "%s(%s+0x%lx): Stabs entry has invalid string index." +#: stabs.c:276 +msgid "%B(%A+0x%lx): Stabs entry has invalid string index." msgstr "" -#: syms.c:1019 +#: syms.c:1048 msgid "Unsupported .stab relocation" msgstr "" -#: vms-gsd.c:356 +#: vms-gsd.c:337 #, c-format msgid "bfd_make_section (%s) failed" msgstr "" -#: vms-gsd.c:371 +#: vms-gsd.c:352 #, c-format msgid "bfd_set_section_flags (%s, %x) failed" msgstr "" -#: vms-gsd.c:407 +#: vms-gsd.c:387 #, c-format msgid "Size mismatch section %s=%lx, %s=%lx" msgstr "" -#: vms-gsd.c:704 +#: vms-gsd.c:678 #, c-format msgid "unknown gsd/egsd subtype %d" msgstr "" -#: vms-hdr.c:408 +#: vms-hdr.c:327 msgid "Object module NOT error-free !\n" msgstr "" -#: vms-misc.c:541 +#: vms-misc.c:473 #, c-format msgid "Stack overflow (%d) in _bfd_vms_push" msgstr "" -#: vms-misc.c:559 +#: vms-misc.c:488 msgid "Stack underflow in _bfd_vms_pop" msgstr "" -#: vms-misc.c:918 +#: vms-misc.c:802 msgid "_bfd_vms_output_counted called with zero bytes" msgstr "" -#: vms-misc.c:923 +#: vms-misc.c:807 msgid "_bfd_vms_output_counted called with too many bytes" msgstr "" -#: vms-misc.c:1054 +#: vms-misc.c:925 #, c-format msgid "Symbol %s replaced by %s\n" msgstr "" -#: vms-misc.c:1117 +#: vms-misc.c:984 #, c-format msgid "failed to enter %s" msgstr "" -#: vms-tir.c:102 +#: vms-tir.c:55 msgid "No Mem !" msgstr "" -#: vms-tir.c:383 +#: vms-tir.c:298 #, c-format msgid "bad section index in %s" msgstr "" -#: vms-tir.c:396 +#: vms-tir.c:311 #, c-format msgid "unsupported STA cmd %s" msgstr "" -#: vms-tir.c:401 vms-tir.c:1261 +#: vms-tir.c:316 vms-tir.c:1118 #, c-format msgid "reserved STA cmd %d" msgstr "" -#: vms-tir.c:512 vms-tir.c:535 +#: vms-tir.c:408 vms-tir.c:430 #, c-format msgid "%s: no symbol \"%s\"" msgstr "" -#. unsigned shift -#. rotate +#. Unsigned shift. +#. Rotate. #. Redefine symbol to current location. #. Define a literal. -#: vms-tir.c:602 vms-tir.c:714 vms-tir.c:824 vms-tir.c:842 vms-tir.c:850 -#: vms-tir.c:859 vms-tir.c:1584 +#: vms-tir.c:495 vms-tir.c:604 vms-tir.c:702 vms-tir.c:719 vms-tir.c:726 +#: vms-tir.c:734 vms-tir.c:1438 #, c-format msgid "%s: not supported" msgstr "" -#: vms-tir.c:607 vms-tir.c:1439 +#: vms-tir.c:500 vms-tir.c:1295 #, c-format msgid "%s: not implemented" msgstr "" -#: vms-tir.c:611 vms-tir.c:1443 +#: vms-tir.c:504 vms-tir.c:1299 #, c-format msgid "reserved STO cmd %d" msgstr "" -#: vms-tir.c:729 vms-tir.c:1589 +#: vms-tir.c:619 vms-tir.c:1443 #, c-format msgid "reserved OPR cmd %d" msgstr "" -#: vms-tir.c:797 vms-tir.c:1653 +#: vms-tir.c:679 vms-tir.c:1507 #, c-format msgid "reserved CTL cmd %d" msgstr "" #. stack byte from image #. arg: none. -#: vms-tir.c:1169 +#: vms-tir.c:1026 msgid "stack-from-image not implemented" msgstr "" -#: vms-tir.c:1187 +#: vms-tir.c:1044 msgid "stack-entry-mask not fully implemented" msgstr "" @@ -2521,345 +2941,353 @@ msgstr "" #. #. compare argument descriptor with symbol argument (ARG$V_PASSMECH) #. and stack TRUE (args match) or FALSE (args dont match) value. -#: vms-tir.c:1201 +#: vms-tir.c:1058 msgid "PASSMECH not fully implemented" msgstr "" -#: vms-tir.c:1220 +#: vms-tir.c:1077 msgid "stack-local-symbol not fully implemented" msgstr "" -#: vms-tir.c:1233 +#: vms-tir.c:1090 msgid "stack-literal not fully implemented" msgstr "" -#: vms-tir.c:1254 +#: vms-tir.c:1111 msgid "stack-local-symbol-entry-point-mask not fully implemented" msgstr "" -#: vms-tir.c:1531 vms-tir.c:1543 vms-tir.c:1555 vms-tir.c:1567 vms-tir.c:1632 -#: vms-tir.c:1640 vms-tir.c:1648 +#: vms-tir.c:1385 vms-tir.c:1397 vms-tir.c:1409 vms-tir.c:1421 vms-tir.c:1486 +#: vms-tir.c:1494 vms-tir.c:1502 #, c-format msgid "%s: not fully implemented" msgstr "" -#: vms-tir.c:1705 +#: vms-tir.c:1560 #, c-format msgid "obj code %d not found" msgstr "" -#: vms-tir.c:2043 +#: vms-tir.c:1868 #, c-format msgid "SEC_RELOC with no relocs in section %s" msgstr "" -#: vms-tir.c:2331 +#: vms-tir.c:2150 #, c-format msgid "Unhandled relocation %s" msgstr "" -#: xcofflink.c:1244 -#, c-format -msgid "%s: `%s' has line numbers but no enclosing section" -msgstr "" - -#: xcofflink.c:1297 -#, c-format -msgid "%s: class %d symbol `%s' has no aux entries" -msgstr "" - -#: xcofflink.c:1320 -#, c-format -msgid "%s: symbol `%s' has unrecognized csect type %d" -msgstr "" - -#: xcofflink.c:1332 -#, c-format -msgid "%s: bad XTY_ER symbol `%s': class %d scnum %d scnlen %d" -msgstr "" - -#: xcofflink.c:1368 -#, c-format -msgid "%s: XMC_TC0 symbol `%s' is class %d scnlen %d" -msgstr "" - -#: xcofflink.c:1520 -#, c-format -msgid "%s: csect `%s' not in enclosing section" -msgstr "" - -#: xcofflink.c:1627 -#, c-format -msgid "%s: misplaced XTY_LD `%s'" -msgstr "" - -#: xcofflink.c:1958 -#, c-format -msgid "%s: reloc %s:%d not in csect" -msgstr "" - -#: xcofflink.c:2095 +#: xcofflink.c:564 #, c-format msgid "%s: XCOFF shared object when not producing XCOFF output" msgstr "" -#: xcofflink.c:2116 +#: xcofflink.c:585 #, c-format msgid "%s: dynamic object with no .loader section" msgstr "" -#: xcofflink.c:2761 +#: xcofflink.c:1148 +msgid "%B: `%s' has line numbers but no enclosing section" +msgstr "" + +#: xcofflink.c:1200 +msgid "%B: class %d symbol `%s' has no aux entries" +msgstr "" + +#: xcofflink.c:1223 +msgid "%B: symbol `%s' has unrecognized csect type %d" +msgstr "" + +#: xcofflink.c:1235 +msgid "%B: bad XTY_ER symbol `%s': class %d scnum %d scnlen %d" +msgstr "" + +#: xcofflink.c:1271 +msgid "%B: XMC_TC0 symbol `%s' is class %d scnlen %d" +msgstr "" + +#: xcofflink.c:1417 +msgid "%B: csect `%s' not in enclosing section" +msgstr "" + +#: xcofflink.c:1524 +msgid "%B: misplaced XTY_LD `%s'" +msgstr "" + +#: xcofflink.c:1839 +msgid "%B: reloc %s:%d not in csect" +msgstr "" + +#: xcofflink.c:2637 #, c-format msgid "%s: no such symbol" msgstr "" -#: xcofflink.c:2894 -msgid "error: undefined symbol __rtinit" -msgstr "" - -#: xcofflink.c:3455 +#: xcofflink.c:2866 #, c-format msgid "warning: attempt to export undefined symbol `%s'" msgstr "" -#: xcofflink.c:4448 +#: xcofflink.c:3033 +msgid "error: undefined symbol __rtinit" +msgstr "" + +#: xcofflink.c:3653 #, c-format msgid "TOC overflow: 0x%lx > 0x10000; try -mminimal-toc when compiling" msgstr "" -#: xcofflink.c:5288 xcofflink.c:5755 xcofflink.c:5817 xcofflink.c:6119 +#: xcofflink.c:4489 +msgid "%B: loader reloc in unrecognized section `%A'" +msgstr "" + +#: xcofflink.c:4510 +msgid "%B: `%s' in loader reloc but not loader sym" +msgstr "" + +#: xcofflink.c:4525 +msgid "%B: loader reloc in read-only section %A" +msgstr "" + +#: xcofflink.c:4934 xcofflink.c:4996 xcofflink.c:5291 #, c-format msgid "%s: loader reloc in unrecognized section `%s'" msgstr "" -#: xcofflink.c:5310 xcofflink.c:6130 +#: xcofflink.c:5302 #, c-format msgid "%s: `%s' in loader reloc but not loader sym" msgstr "" -#: xcofflink.c:5325 -#, c-format -msgid "%s: loader reloc in read-only section %s" +#: elf32-ia64.c:1139 elf64-ia64.c:1139 +msgid "" +"%B: Can't relax br at 0x%lx in section `%A'. Please use brl or indirect " +"branch." msgstr "" -#: elf32-ia64.c:2271 elf64-ia64.c:2271 +#: elf32-ia64.c:2508 elf64-ia64.c:2508 msgid "@pltoff reloc against local symbol" msgstr "" -#: elf32-ia64.c:3663 elf64-ia64.c:3663 +#: elf32-ia64.c:3955 elf64-ia64.c:3955 #, c-format msgid "%s: short data segment overflowed (0x%lx >= 0x400000)" msgstr "" -#: elf32-ia64.c:3674 elf64-ia64.c:3674 +#: elf32-ia64.c:3966 elf64-ia64.c:3966 #, c-format msgid "%s: __gp does not cover short data segment" msgstr "" -#: elf32-ia64.c:3986 elf64-ia64.c:3986 -#, c-format -msgid "%s: linking non-pic code in a shared library" +#: elf32-ia64.c:4213 elf64-ia64.c:4213 +msgid "%B: non-pic code with imm relocation against dynamic symbol `%s'" msgstr "" -#: elf32-ia64.c:4017 elf64-ia64.c:4017 -#, c-format -msgid "%s: @gprel relocation against dynamic symbol %s" +#: elf32-ia64.c:4280 elf64-ia64.c:4280 +msgid "%B: @gprel relocation against dynamic symbol %s" msgstr "" -#: elf32-ia64.c:4077 elf64-ia64.c:4077 -#, c-format -msgid "%s: linking non-pic code in a position independent executable" +#: elf32-ia64.c:4343 elf64-ia64.c:4343 +msgid "%B: linking non-pic code in a position independent executable" msgstr "" -#: elf32-ia64.c:4214 elf64-ia64.c:4214 -#, c-format -msgid "%s: @internal branch to dynamic symbol %s" +#: elf32-ia64.c:4480 elf64-ia64.c:4480 +msgid "%B: @internal branch to dynamic symbol %s" msgstr "" -#: elf32-ia64.c:4216 elf64-ia64.c:4216 -#, c-format -msgid "%s: speculation fixup to dynamic symbol %s" +#: elf32-ia64.c:4482 elf64-ia64.c:4482 +msgid "%B: speculation fixup to dynamic symbol %s" msgstr "" -#: elf32-ia64.c:4218 elf64-ia64.c:4218 -#, c-format -msgid "%s: @pcrel relocation against dynamic symbol %s" +#: elf32-ia64.c:4484 elf64-ia64.c:4484 +msgid "%B: @pcrel relocation against dynamic symbol %s" msgstr "" -#: elf32-ia64.c:4430 elf64-ia64.c:4430 +#: elf32-ia64.c:4691 elf64-ia64.c:4691 msgid "unsupported reloc" msgstr "" -#: elf32-ia64.c:4709 elf64-ia64.c:4709 -#, c-format -msgid "%s: linking trap-on-NULL-dereference with non-trapping files" +#: elf32-ia64.c:4724 elf64-ia64.c:4724 +msgid "" +"%B: Can't relax br (%s) to `%s' at 0x%lx in section `%A' with size 0x%lx (> " +"0x1000000)." msgstr "" -#: elf32-ia64.c:4718 elf64-ia64.c:4718 -#, c-format -msgid "%s: linking big-endian files with little-endian files" +#: elf32-ia64.c:4985 elf64-ia64.c:4985 +msgid "%B: linking trap-on-NULL-dereference with non-trapping files" msgstr "" -#: elf32-ia64.c:4727 elf64-ia64.c:4727 -#, c-format -msgid "%s: linking 64-bit files with 32-bit files" +#: elf32-ia64.c:4994 elf64-ia64.c:4994 +msgid "%B: linking big-endian files with little-endian files" msgstr "" -#: elf32-ia64.c:4736 elf64-ia64.c:4736 -#, c-format -msgid "%s: linking constant-gp files with non-constant-gp files" +#: elf32-ia64.c:5003 elf64-ia64.c:5003 +msgid "%B: linking 64-bit files with 32-bit files" msgstr "" -#: elf32-ia64.c:4746 elf64-ia64.c:4746 -#, c-format -msgid "%s: linking auto-pic files with non-auto-pic files" +#: elf32-ia64.c:5012 elf64-ia64.c:5012 +msgid "%B: linking constant-gp files with non-constant-gp files" msgstr "" -#: peigen.c:985 pepigen.c:985 +#: elf32-ia64.c:5022 elf64-ia64.c:5022 +msgid "%B: linking auto-pic files with non-auto-pic files" +msgstr "" + +#: peigen.c:979 pepigen.c:979 #, c-format msgid "%s: line number overflow: 0x%lx > 0xffff" msgstr "" -#: peigen.c:1002 pepigen.c:1002 -#, c-format -msgid "%s: reloc overflow 1: 0x%lx > 0xffff" -msgstr "" - -#: peigen.c:1016 pepigen.c:1016 +#: peigen.c:1006 pepigen.c:1006 msgid "Export Directory [.edata (or where ever we found it)]" msgstr "" -#: peigen.c:1017 pepigen.c:1017 +#: peigen.c:1007 pepigen.c:1007 msgid "Import Directory [parts of .idata]" msgstr "" -#: peigen.c:1018 pepigen.c:1018 +#: peigen.c:1008 pepigen.c:1008 msgid "Resource Directory [.rsrc]" msgstr "" -#: peigen.c:1019 pepigen.c:1019 +#: peigen.c:1009 pepigen.c:1009 msgid "Exception Directory [.pdata]" msgstr "" -#: peigen.c:1020 pepigen.c:1020 +#: peigen.c:1010 pepigen.c:1010 msgid "Security Directory" msgstr "" -#: peigen.c:1021 pepigen.c:1021 +#: peigen.c:1011 pepigen.c:1011 msgid "Base Relocation Directory [.reloc]" msgstr "" -#: peigen.c:1022 pepigen.c:1022 +#: peigen.c:1012 pepigen.c:1012 msgid "Debug Directory" msgstr "" -#: peigen.c:1023 pepigen.c:1023 +#: peigen.c:1013 pepigen.c:1013 msgid "Description Directory" msgstr "" -#: peigen.c:1024 pepigen.c:1024 +#: peigen.c:1014 pepigen.c:1014 msgid "Special Directory" msgstr "" -#: peigen.c:1025 pepigen.c:1025 +#: peigen.c:1015 pepigen.c:1015 msgid "Thread Storage Directory [.tls]" msgstr "" -#: peigen.c:1026 pepigen.c:1026 +#: peigen.c:1016 pepigen.c:1016 msgid "Load Configuration Directory" msgstr "" -#: peigen.c:1027 pepigen.c:1027 +#: peigen.c:1017 pepigen.c:1017 msgid "Bound Import Directory" msgstr "" -#: peigen.c:1028 pepigen.c:1028 +#: peigen.c:1018 pepigen.c:1018 msgid "Import Address Table Directory" msgstr "" -#: peigen.c:1029 pepigen.c:1029 +#: peigen.c:1019 pepigen.c:1019 msgid "Delay Import Directory" msgstr "" -#: peigen.c:1030 peigen.c:1031 pepigen.c:1030 pepigen.c:1031 +#: peigen.c:1020 peigen.c:1021 pepigen.c:1020 pepigen.c:1021 msgid "Reserved" msgstr "" -#: peigen.c:1094 pepigen.c:1094 +#: peigen.c:1081 pepigen.c:1081 +#, c-format msgid "" "\n" "There is an import table, but the section containing it could not be found\n" msgstr "" -#: peigen.c:1099 pepigen.c:1099 +#: peigen.c:1086 pepigen.c:1086 #, c-format msgid "" "\n" "There is an import table in %s at 0x%lx\n" msgstr "" -#: peigen.c:1136 pepigen.c:1136 +#: peigen.c:1129 pepigen.c:1129 #, c-format msgid "" "\n" "Function descriptor located at the start address: %04lx\n" msgstr "" -#: peigen.c:1139 pepigen.c:1139 +#: peigen.c:1132 pepigen.c:1132 #, c-format msgid "\tcode-base %08lx toc (loadable/actual) %08lx/%08lx\n" msgstr "" -#: peigen.c:1145 pepigen.c:1145 +#: peigen.c:1140 pepigen.c:1140 +#, c-format msgid "" "\n" "No reldata section! Function descriptor not decoded.\n" msgstr "" -#: peigen.c:1150 pepigen.c:1150 +#: peigen.c:1145 pepigen.c:1145 #, c-format msgid "" "\n" "The Import Tables (interpreted %s section contents)\n" msgstr "" -#: peigen.c:1153 pepigen.c:1153 +#: peigen.c:1148 pepigen.c:1148 +#, c-format msgid "" " vma: Hint Time Forward DLL First\n" " Table Stamp Chain Name Thunk\n" msgstr "" -#: peigen.c:1204 pepigen.c:1204 +#: peigen.c:1196 pepigen.c:1196 #, c-format msgid "" "\n" "\tDLL Name: %s\n" msgstr "" -#: peigen.c:1215 pepigen.c:1215 +#: peigen.c:1207 pepigen.c:1207 +#, c-format msgid "\tvma: Hint/Ord Member-Name Bound-To\n" msgstr "" -#: peigen.c:1240 pepigen.c:1240 +#: peigen.c:1232 pepigen.c:1232 +#, c-format msgid "" "\n" "There is a first thunk, but the section containing it could not be found\n" msgstr "" -#: peigen.c:1380 pepigen.c:1380 +#: peigen.c:1365 pepigen.c:1365 +#, c-format msgid "" "\n" "There is an export table, but the section containing it could not be found\n" msgstr "" -#: peigen.c:1385 pepigen.c:1385 +#: peigen.c:1374 pepigen.c:1374 +#, c-format +msgid "" +"\n" +"There is an export table in %s, but it does not fit into that section\n" +msgstr "" + +#: peigen.c:1380 pepigen.c:1380 #, c-format msgid "" "\n" "There is an export table in %s at 0x%lx\n" msgstr "" -#: peigen.c:1416 pepigen.c:1416 +#: peigen.c:1408 pepigen.c:1408 #, c-format msgid "" "\n" @@ -2867,129 +3295,143 @@ msgid "" "\n" msgstr "" -#: peigen.c:1420 pepigen.c:1420 +#: peigen.c:1412 pepigen.c:1412 #, c-format msgid "Export Flags \t\t\t%lx\n" msgstr "" -#: peigen.c:1423 pepigen.c:1423 +#: peigen.c:1415 pepigen.c:1415 #, c-format msgid "Time/Date stamp \t\t%lx\n" msgstr "" -#: peigen.c:1426 pepigen.c:1426 +#: peigen.c:1418 pepigen.c:1418 #, c-format msgid "Major/Minor \t\t\t%d/%d\n" msgstr "" -#: peigen.c:1429 pepigen.c:1429 +#: peigen.c:1421 pepigen.c:1421 +#, c-format msgid "Name \t\t\t\t" msgstr "" -#: peigen.c:1435 pepigen.c:1435 +#: peigen.c:1427 pepigen.c:1427 #, c-format msgid "Ordinal Base \t\t\t%ld\n" msgstr "" -#: peigen.c:1438 pepigen.c:1438 +#: peigen.c:1430 pepigen.c:1430 +#, c-format msgid "Number in:\n" msgstr "" -#: peigen.c:1441 pepigen.c:1441 +#: peigen.c:1433 pepigen.c:1433 #, c-format msgid "\tExport Address Table \t\t%08lx\n" msgstr "" -#: peigen.c:1445 pepigen.c:1445 +#: peigen.c:1437 pepigen.c:1437 #, c-format msgid "\t[Name Pointer/Ordinal] Table\t%08lx\n" msgstr "" -#: peigen.c:1448 pepigen.c:1448 +#: peigen.c:1440 pepigen.c:1440 +#, c-format msgid "Table Addresses\n" msgstr "" -#: peigen.c:1451 pepigen.c:1451 +#: peigen.c:1443 pepigen.c:1443 +#, c-format msgid "\tExport Address Table \t\t" msgstr "" -#: peigen.c:1456 pepigen.c:1456 +#: peigen.c:1448 pepigen.c:1448 +#, c-format msgid "\tName Pointer Table \t\t" msgstr "" -#: peigen.c:1461 pepigen.c:1461 +#: peigen.c:1453 pepigen.c:1453 +#, c-format msgid "\tOrdinal Table \t\t\t" msgstr "" -#: peigen.c:1476 pepigen.c:1476 +#: peigen.c:1467 pepigen.c:1467 #, c-format msgid "" "\n" "Export Address Table -- Ordinal Base %ld\n" msgstr "" -#: peigen.c:1495 pepigen.c:1495 +#: peigen.c:1486 pepigen.c:1486 msgid "Forwarder RVA" msgstr "" -#: peigen.c:1506 pepigen.c:1506 +#: peigen.c:1497 pepigen.c:1497 msgid "Export RVA" msgstr "" -#: peigen.c:1513 pepigen.c:1513 +#: peigen.c:1504 pepigen.c:1504 +#, c-format msgid "" "\n" "[Ordinal/Name Pointer] Table\n" msgstr "" -#: peigen.c:1568 pepigen.c:1568 +#: peigen.c:1557 pepigen.c:1557 #, c-format msgid "Warning, .pdata section size (%ld) is not a multiple of %d\n" msgstr "" -#: peigen.c:1572 pepigen.c:1572 +#: peigen.c:1561 pepigen.c:1561 +#, c-format msgid "" "\n" "The Function Table (interpreted .pdata section contents)\n" msgstr "" -#: peigen.c:1575 pepigen.c:1575 +#: peigen.c:1564 pepigen.c:1564 +#, c-format msgid " vma:\t\t\tBegin Address End Address Unwind Info\n" msgstr "" -#: peigen.c:1577 pepigen.c:1577 +#: peigen.c:1566 pepigen.c:1566 +#, c-format msgid "" " vma:\t\tBegin End EH EH PrologEnd Exception\n" " \t\tAddress Address Handler Data Address Mask\n" msgstr "" -#: peigen.c:1647 pepigen.c:1647 +#: peigen.c:1636 pepigen.c:1636 +#, c-format msgid " Register save millicode" msgstr "" -#: peigen.c:1650 pepigen.c:1650 +#: peigen.c:1639 pepigen.c:1639 +#, c-format msgid " Register restore millicode" msgstr "" -#: peigen.c:1653 pepigen.c:1653 +#: peigen.c:1642 pepigen.c:1642 +#, c-format msgid " Glue code sequence" msgstr "" -#: peigen.c:1705 pepigen.c:1705 +#: peigen.c:1692 pepigen.c:1692 +#, c-format msgid "" "\n" "\n" "PE File Base Relocations (interpreted .reloc section contents)\n" msgstr "" -#: peigen.c:1735 pepigen.c:1735 +#: peigen.c:1722 pepigen.c:1722 #, c-format msgid "" "\n" "Virtual Address: %08lx Chunk size %ld (0x%lx) Number of fixups %ld\n" msgstr "" -#: peigen.c:1748 pepigen.c:1748 +#: peigen.c:1735 pepigen.c:1735 #, c-format msgid "\treloc %4d offset %4x [%4lx] %s" msgstr "" @@ -2997,7 +3439,7 @@ msgstr "" #. The MS dumpbin program reportedly ands with 0xff0f before #. printing the characteristics field. Not sure why. No reason to #. emulate it here. -#: peigen.c:1788 pepigen.c:1788 +#: peigen.c:1773 pepigen.c:1773 #, c-format msgid "" "\n" diff --git a/contrib/binutils/bfd/ppcboot.c b/contrib/binutils/bfd/ppcboot.c index 05fb7de7429..7c8a4190bac 100644 --- a/contrib/binutils/bfd/ppcboot.c +++ b/contrib/binutils/bfd/ppcboot.c @@ -1,5 +1,5 @@ /* BFD back-end for PPCbug boot records. - Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Written by Michael Meissner, Cygnus Support, @@ -17,7 +17,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* This is a BFD backend which may be used to write PowerPCBug boot objects. It may only be used for output, not input. The intention is that this may @@ -210,7 +210,7 @@ ppcboot_object_p (abfd) return NULL; sec->flags = SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_CODE | SEC_HAS_CONTENTS; sec->vma = 0; - sec->_raw_size = statbuf.st_size - sizeof (ppcboot_hdr_t); + sec->size = statbuf.st_size - sizeof (ppcboot_hdr_t); sec->filepos = sizeof (ppcboot_hdr_t); ppcboot_mkobject (abfd); @@ -311,7 +311,7 @@ ppcboot_canonicalize_symtab (abfd, alocation) /* End symbol. */ syms[1].the_bfd = abfd; syms[1].name = mangle_name (abfd, "end"); - syms[1].value = sec->_raw_size; + syms[1].value = sec->size; syms[1].flags = BSF_GLOBAL; syms[1].section = sec; syms[1].udata.p = NULL; @@ -319,7 +319,7 @@ ppcboot_canonicalize_symtab (abfd, alocation) /* Size symbol. */ syms[2].the_bfd = abfd; syms[2].name = mangle_name (abfd, "size"); - syms[2].value = sec->_raw_size; + syms[2].value = sec->size; syms[2].flags = BSF_GLOBAL; syms[2].section = bfd_abs_section_ptr; syms[2].udata.p = NULL; @@ -345,9 +345,12 @@ ppcboot_get_symbol_info (ignore_abfd, symbol, ret) bfd_symbol_info (symbol, ret); } +#define ppcboot_bfd_is_target_special_symbol \ + ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) #define ppcboot_bfd_is_local_label_name bfd_generic_is_local_label_name #define ppcboot_get_lineno _bfd_nosymbols_get_lineno #define ppcboot_find_nearest_line _bfd_nosymbols_find_nearest_line +#define ppcboot_find_inliner_info _bfd_nosymbols_find_inliner_info #define ppcboot_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol #define ppcboot_read_minisymbols _bfd_generic_read_minisymbols #define ppcboot_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol @@ -469,7 +472,10 @@ ppcboot_bfd_print_private_bfd_data (abfd, farg) #define ppcboot_bfd_relax_section bfd_generic_relax_section #define ppcboot_bfd_gc_sections bfd_generic_gc_sections #define ppcboot_bfd_merge_sections bfd_generic_merge_sections +#define ppcboot_bfd_is_group_section bfd_generic_is_group_section #define ppcboot_bfd_discard_group bfd_generic_discard_group +#define ppcboot_section_already_linked \ + _bfd_generic_section_already_linked #define ppcboot_bfd_link_hash_table_create _bfd_generic_link_hash_table_create #define ppcboot_bfd_link_hash_table_free _bfd_generic_link_hash_table_free #define ppcboot_bfd_link_add_symbols _bfd_generic_link_add_symbols @@ -483,6 +489,7 @@ ppcboot_bfd_print_private_bfd_data (abfd, farg) #define ppcboot_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data #define ppcboot_bfd_copy_private_section_data _bfd_generic_bfd_copy_private_section_data #define ppcboot_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data +#define ppcboot_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data #define ppcboot_bfd_set_private_flags _bfd_generic_bfd_set_private_flags #define ppcboot_bfd_print_private_bfd_dat ppcboot_bfd_print_private_bfd_data diff --git a/contrib/binutils/bfd/ptrace-core.c b/contrib/binutils/bfd/ptrace-core.c index 15b6777e121..4ac28aa1dec 100644 --- a/contrib/binutils/bfd/ptrace-core.c +++ b/contrib/binutils/bfd/ptrace-core.c @@ -20,7 +20,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef PTRACE_CORE @@ -51,8 +51,7 @@ struct trad_core_struct const bfd_target *ptrace_unix_core_file_p PARAMS ((bfd *abfd)); char * ptrace_unix_core_file_failing_command PARAMS ((bfd *abfd)); int ptrace_unix_core_file_failing_signal PARAMS ((bfd *abfd)); -bfd_boolean ptrace_unix_core_file_matches_executable_p - PARAMS ((bfd *core_bfd, bfd *exec_bfd)); +#define ptrace_unix_core_file_matches_executable_p generic_core_file_matches_executable_p static void swap_abort PARAMS ((void)); const bfd_target * @@ -108,9 +107,9 @@ ptrace_unix_core_file_p (abfd) core_datasec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS; core_regsec (abfd)->flags = SEC_HAS_CONTENTS; - core_datasec (abfd)->_raw_size = u.pt_dsize; - core_stacksec (abfd)->_raw_size = u.pt_ssize; - core_regsec (abfd)->_raw_size = sizeof (u); + core_datasec (abfd)->size = u.pt_dsize; + core_stacksec (abfd)->size = u.pt_ssize; + core_regsec (abfd)->size = sizeof (u); core_datasec (abfd)->vma = u.pt_o_data_start; core_stacksec (abfd)->vma = USRSTACK - u.pt_ssize; @@ -151,15 +150,6 @@ ptrace_unix_core_file_failing_signal (abfd) { return abfd->tdata.trad_core_data->u.pt_sigframe.sig_num; } - -bfd_boolean -ptrace_unix_core_file_matches_executable_p (core_bfd, exec_bfd) - bfd *core_bfd, *exec_bfd; -{ - /* FIXME: Use pt_timdat field of the ptrace_user structure to match - the date of the executable */ - return TRUE; -} /* If somebody calls any byte-swapping routines, shoot them. */ static void diff --git a/contrib/binutils/bfd/reloc.c b/contrib/binutils/bfd/reloc.c index 9bffaa36588..f1d09a5ab07 100644 --- a/contrib/binutils/bfd/reloc.c +++ b/contrib/binutils/bfd/reloc.c @@ -1,6 +1,6 @@ /* BFD support for handling relocation entries. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004 + 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Written by Cygnus Support. @@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* SECTION @@ -255,11 +255,12 @@ CODE_FRAGMENT . {* Do not complain on overflow. *} . complain_overflow_dont, . -. {* Complain if the bitfield overflows, whether it is considered -. as signed or unsigned. *} +. {* Complain if the value overflows when considered as a signed +. number one bit larger than the field. ie. A bitfield of N bits +. is allowed to represent -2**n to 2**n-1. *} . complain_overflow_bitfield, . -. {* Complain if the value overflows when considered as signed +. {* Complain if the value overflows when considered as a signed . number. *} . complain_overflow_signed, . @@ -496,14 +497,14 @@ bfd_check_overflow (enum complain_overflow how, bfd_vma fieldmask, addrmask, signmask, ss, a; bfd_reloc_status_type flag = bfd_reloc_ok; - a = relocation; - /* Note: BITSIZE should always be <= ADDRSIZE, but in case it's not, we'll be permissive: extra bits in the field mask will automatically extend the address mask for purposes of the overflow check. */ fieldmask = N_ONES (bitsize); + signmask = ~fieldmask; addrmask = N_ONES (addrsize) | fieldmask; + a = (relocation & addrmask) >> rightshift;; switch (how) { @@ -513,19 +514,8 @@ bfd_check_overflow (enum complain_overflow how, case complain_overflow_signed: /* If any sign bits are set, all sign bits must be set. That is, A must be a valid negative address after shifting. */ - a = (a & addrmask) >> rightshift; signmask = ~ (fieldmask >> 1); - ss = a & signmask; - if (ss != 0 && ss != ((addrmask >> rightshift) & signmask)) - flag = bfd_reloc_overflow; - break; - - case complain_overflow_unsigned: - /* We have an overflow if the address does not fit in the field. */ - a = (a & addrmask) >> rightshift; - if ((a & ~ fieldmask) != 0) - flag = bfd_reloc_overflow; - break; + /* Fall thru */ case complain_overflow_bitfield: /* Bitfields are sometimes signed, sometimes unsigned. We @@ -533,9 +523,14 @@ bfd_check_overflow (enum complain_overflow how, of n bits is allowed to store -2**n to 2**n-1. Thus overflow if the value has some, but not all, bits set outside the field. */ - a >>= rightshift; - ss = a & ~ fieldmask; - if (ss != 0 && ss != (((bfd_vma) -1 >> rightshift) & ~ fieldmask)) + ss = a & signmask; + if (ss != 0 && ss != ((addrmask >> rightshift) & signmask)) + flag = bfd_reloc_overflow; + break; + + case complain_overflow_unsigned: + /* We have an overflow if the address does not fit in the field. */ + if ((a & signmask) != 0) flag = bfd_reloc_overflow; break; @@ -623,8 +618,7 @@ bfd_perform_relocation (bfd *abfd, } /* Is the address of the relocation really within the section? */ - if (reloc_entry->address > (input_section->_cooked_size - / bfd_octets_per_byte (abfd))) + if (reloc_entry->address > bfd_get_section_limit (abfd, input_section)) return bfd_reloc_outofrange; /* Work out which section the relocation is targeted at and the @@ -716,7 +710,6 @@ bfd_perform_relocation (bfd *abfd, && strcmp (abfd->xvec->name, "coff-Intel-little") != 0 && strcmp (abfd->xvec->name, "coff-Intel-big") != 0) { -#if 1 /* For m68k-coff, the addend was being subtracted twice during relocation with -r. Removing the line below this comment fixes that problem; see PR 2953. @@ -787,7 +780,6 @@ space consuming. For each target: right */ relocation -= reloc_entry->addend; -#endif reloc_entry->addend = 0; } else @@ -1013,8 +1005,7 @@ bfd_install_relocation (bfd *abfd, } /* Is the address of the relocation really within the section? */ - if (reloc_entry->address > (input_section->_cooked_size - / bfd_octets_per_byte (abfd))) + if (reloc_entry->address > bfd_get_section_limit (abfd, input_section)) return bfd_reloc_outofrange; /* Work out which section the relocation is targeted at and the @@ -1102,10 +1093,10 @@ bfd_install_relocation (bfd *abfd, && strcmp (abfd->xvec->name, "coff-Intel-little") != 0 && strcmp (abfd->xvec->name, "coff-Intel-big") != 0) { -#if 1 -/* For m68k-coff, the addend was being subtracted twice during - relocation with -r. Removing the line below this comment - fixes that problem; see PR 2953. + + /* For m68k-coff, the addend was being subtracted twice during + relocation with -r. Removing the line below this comment + fixes that problem; see PR 2953. However, Ian wrote the following, regarding removing the line below, which explains why it is still enabled: --djm @@ -1172,8 +1163,9 @@ space consuming. For each target: 7) if they are different you have to figure out which version is right. */ relocation -= reloc_entry->addend; -#endif - reloc_entry->addend = 0; + /* FIXME: There should be no target specific code here... */ + if (strcmp (abfd->xvec->name, "coff-z8k") != 0) + reloc_entry->addend = 0; } else { @@ -1350,7 +1342,7 @@ _bfd_final_link_relocate (reloc_howto_type *howto, bfd_vma relocation; /* Sanity check the address. */ - if (address > input_section->_raw_size) + if (address > bfd_get_section_limit (input_bfd, input_section)) return bfd_reloc_outofrange; /* This function assumes that we are dealing with a basic relocation @@ -1440,19 +1432,26 @@ _bfd_relocate_contents (reloc_howto_type *howto, the size of an address. For bitfields, all the bits matter. See also bfd_check_overflow. */ fieldmask = N_ONES (howto->bitsize); + signmask = ~fieldmask; addrmask = N_ONES (bfd_arch_bits_per_address (input_bfd)) | fieldmask; - a = relocation; - b = x & howto->src_mask; + a = (relocation & addrmask) >> rightshift; + b = (x & howto->src_mask & addrmask) >> bitpos; switch (howto->complain_on_overflow) { case complain_overflow_signed: - a = (a & addrmask) >> rightshift; - /* If any sign bits are set, all sign bits must be set. That is, A must be a valid negative address after shifting. */ - signmask = ~ (fieldmask >> 1); + signmask = ~(fieldmask >> 1); + /* Fall thru */ + + case complain_overflow_bitfield: + /* Much like the signed check, but for a field one bit + wider. We allow a bitfield to represent numbers in the + range -2**n to 2**n-1, where n is the number of bits in the + field. Note that when bfd_vma is 32 bits, a 32-bit reloc + can't overflow, which is exactly what we want. */ ss = a & signmask; if (ss != 0 && ss != ((addrmask >> rightshift) & signmask)) flag = bfd_reloc_overflow; @@ -1463,12 +1462,11 @@ _bfd_relocate_contents (reloc_howto_type *howto, SRC_MASK has more bits than BITSIZE, we can get into trouble; we would need to verify that B is in range, as we do for A above. */ - signmask = ((~ howto->src_mask) >> 1) & howto->src_mask; + ss = ((~howto->src_mask) >> 1) & howto->src_mask; + ss >>= bitpos; /* Set all the bits above the sign bit. */ - b = (b ^ signmask) - signmask; - - b = (b & addrmask) >> bitpos; + b = (b ^ ss) - ss; /* Now we can do the addition. */ sum = a + b; @@ -1480,11 +1478,14 @@ _bfd_relocate_contents (reloc_howto_type *howto, positive inputs. The test below looks only at the sign bits, and it really just SIGN (A) == SIGN (B) && SIGN (A) != SIGN (SUM) - */ - signmask = (fieldmask >> 1) + 1; - if (((~ (a ^ b)) & (a ^ sum)) & signmask) - flag = bfd_reloc_overflow; + We mask with addrmask here to explicitly allow an address + wrap-around. The Linux kernel relies on it, and it is + the only way to write assembler code which can run when + loaded at a location 0x80000000 away from the location at + which it is linked. */ + if (((~(a ^ b)) & (a ^ sum)) & signmask & addrmask) + flag = bfd_reloc_overflow; break; case complain_overflow_unsigned: @@ -1499,44 +1500,9 @@ _bfd_relocate_contents (reloc_howto_type *howto, separate test, we can check for this by or-ing in the operands when testing for the sum overflowing its final field. */ - a = (a & addrmask) >> rightshift; - b = (b & addrmask) >> bitpos; sum = (a + b) & addrmask; - if ((a | b | sum) & ~ fieldmask) + if ((a | b | sum) & signmask) flag = bfd_reloc_overflow; - - break; - - case complain_overflow_bitfield: - /* Much like the signed check, but for a field one bit - wider, and no trimming inputs with addrmask. We allow a - bitfield to represent numbers in the range -2**n to - 2**n-1, where n is the number of bits in the field. - Note that when bfd_vma is 32 bits, a 32-bit reloc can't - overflow, which is exactly what we want. */ - a >>= rightshift; - - signmask = ~ fieldmask; - ss = a & signmask; - if (ss != 0 && ss != (((bfd_vma) -1 >> rightshift) & signmask)) - flag = bfd_reloc_overflow; - - signmask = ((~ howto->src_mask) >> 1) & howto->src_mask; - b = (b ^ signmask) - signmask; - - b >>= bitpos; - - sum = a + b; - - /* We mask with addrmask here to explicitly allow an address - wrap-around. The Linux kernel relies on it, and it is - the only way to write assembler code which can run when - loaded at a location 0x80000000 away from the location at - which it is linked. */ - signmask = fieldmask + 1; - if (((~ (a ^ b)) & (a ^ sum)) & signmask & addrmask) - flag = bfd_reloc_overflow; - break; default: @@ -1584,7 +1550,7 @@ DOCDD INODE howto manager, , typedef arelent, Relocations -SECTION +SUBSECTION The howto manager When an application wants to create a relocation, but doesn't @@ -1646,6 +1612,11 @@ the section containing the relocation. It depends on the specific target. The 24-bit relocation is used in some Intel 960 configurations. +ENUM + BFD_RELOC_32_SECREL +ENUMDOC + Section relative relocations. Some targets need this for DWARF2. + ENUM BFD_RELOC_32_GOT_PCREL ENUMX @@ -2061,14 +2032,35 @@ ENUM BFD_RELOC_LO16 ENUMDOC Low 16 bits. + ENUM - BFD_RELOC_PCREL_HI16_S + BFD_RELOC_HI16_PCREL ENUMDOC - Like BFD_RELOC_HI16_S, but PC relative. + High 16 bits of 32-bit pc-relative value ENUM - BFD_RELOC_PCREL_LO16 + BFD_RELOC_HI16_S_PCREL ENUMDOC - Like BFD_RELOC_LO16, but PC relative. + High 16 bits of 32-bit pc-relative value, adjusted +ENUM + BFD_RELOC_LO16_PCREL +ENUMDOC + Low 16 bits of pc-relative value + +ENUM + BFD_RELOC_MIPS16_HI16 +ENUMDOC + MIPS16 high 16 bits of 32-bit value. +ENUM + BFD_RELOC_MIPS16_HI16_S +ENUMDOC + MIPS16 high 16 bits of 32-bit value but the low 16 bits will be sign + extended and added to form the final result. If the low 16 + bits form a negative number, we need to add one to the high value + to compensate for the borrow when the low bits are added. +ENUM + BFD_RELOC_MIPS16_LO16 +ENUMDOC + MIPS16 low 16 bits. ENUM BFD_RELOC_MIPS_LITERAL @@ -2117,10 +2109,44 @@ ENUMX BFD_RELOC_MIPS_RELGOT ENUMX BFD_RELOC_MIPS_JALR +ENUMX + BFD_RELOC_MIPS_TLS_DTPMOD32 +ENUMX + BFD_RELOC_MIPS_TLS_DTPREL32 +ENUMX + BFD_RELOC_MIPS_TLS_DTPMOD64 +ENUMX + BFD_RELOC_MIPS_TLS_DTPREL64 +ENUMX + BFD_RELOC_MIPS_TLS_GD +ENUMX + BFD_RELOC_MIPS_TLS_LDM +ENUMX + BFD_RELOC_MIPS_TLS_DTPREL_HI16 +ENUMX + BFD_RELOC_MIPS_TLS_DTPREL_LO16 +ENUMX + BFD_RELOC_MIPS_TLS_GOTTPREL +ENUMX + BFD_RELOC_MIPS_TLS_TPREL32 +ENUMX + BFD_RELOC_MIPS_TLS_TPREL64 +ENUMX + BFD_RELOC_MIPS_TLS_TPREL_HI16 +ENUMX + BFD_RELOC_MIPS_TLS_TPREL_LO16 ENUMDOC MIPS ELF relocations. COMMENT +ENUM + BFD_RELOC_MIPS_COPY +ENUMX + BFD_RELOC_MIPS_JUMP_SLOT +ENUMDOC + MIPS ELF relocations (VxWorks extensions). +COMMENT + ENUM BFD_RELOC_FRV_LABEL16 ENUMX @@ -2167,6 +2193,38 @@ ENUMX BFD_RELOC_FRV_GOTOFFHI ENUMX BFD_RELOC_FRV_GOTOFFLO +ENUMX + BFD_RELOC_FRV_GETTLSOFF +ENUMX + BFD_RELOC_FRV_TLSDESC_VALUE +ENUMX + BFD_RELOC_FRV_GOTTLSDESC12 +ENUMX + BFD_RELOC_FRV_GOTTLSDESCHI +ENUMX + BFD_RELOC_FRV_GOTTLSDESCLO +ENUMX + BFD_RELOC_FRV_TLSMOFF12 +ENUMX + BFD_RELOC_FRV_TLSMOFFHI +ENUMX + BFD_RELOC_FRV_TLSMOFFLO +ENUMX + BFD_RELOC_FRV_GOTTLSOFF12 +ENUMX + BFD_RELOC_FRV_GOTTLSOFFHI +ENUMX + BFD_RELOC_FRV_GOTTLSOFFLO +ENUMX + BFD_RELOC_FRV_TLSOFF +ENUMX + BFD_RELOC_FRV_TLSDESC_RELAX +ENUMX + BFD_RELOC_FRV_GETTLSOFF_RELAX +ENUMX + BFD_RELOC_FRV_TLSOFF_RELAX +ENUMX + BFD_RELOC_FRV_TLSMOFF ENUMDOC Fujitsu Frv Relocations. COMMENT @@ -2248,6 +2306,12 @@ ENUMX BFD_RELOC_386_TLS_DTPOFF32 ENUMX BFD_RELOC_386_TLS_TPOFF32 +ENUMX + BFD_RELOC_386_TLS_GOTDESC +ENUMX + BFD_RELOC_386_TLS_DESC_CALL +ENUMX + BFD_RELOC_386_TLS_DESC ENUMDOC i386/elf relocations @@ -2283,6 +2347,26 @@ ENUMX BFD_RELOC_X86_64_GOTTPOFF ENUMX BFD_RELOC_X86_64_TPOFF32 +ENUMX + BFD_RELOC_X86_64_GOTOFF64 +ENUMX + BFD_RELOC_X86_64_GOTPC32 +ENUMX + BFD_RELOC_X86_64_GOT64 +ENUMX + BFD_RELOC_X86_64_GOTPCREL64 +ENUMX + BFD_RELOC_X86_64_GOTPC64 +ENUMX + BFD_RELOC_X86_64_GOTPLT64 +ENUMX + BFD_RELOC_X86_64_PLTOFF64 +ENUMX + BFD_RELOC_X86_64_GOTPC32_TLSDESC +ENUMX + BFD_RELOC_X86_64_TLSDESC_CALL +ENUMX + BFD_RELOC_X86_64_TLSDESC ENUMDOC x86-64/elf relocations @@ -2556,14 +2640,118 @@ ENUMDOC Thumb 22 bit pc-relative branch. The lowest bit must be zero and is not stored in the instruction. The 2nd lowest bit comes from a 1 bit field in the instruction. +ENUM + BFD_RELOC_ARM_PCREL_CALL +ENUMDOC + ARM 26-bit pc-relative branch for an unconditional BL or BLX instruction. +ENUM + BFD_RELOC_ARM_PCREL_JUMP +ENUMDOC + ARM 26-bit pc-relative branch for B or conditional BL instruction. + +ENUM + BFD_RELOC_THUMB_PCREL_BRANCH7 +ENUMX + BFD_RELOC_THUMB_PCREL_BRANCH9 +ENUMX + BFD_RELOC_THUMB_PCREL_BRANCH12 +ENUMX + BFD_RELOC_THUMB_PCREL_BRANCH20 +ENUMX + BFD_RELOC_THUMB_PCREL_BRANCH23 +ENUMX + BFD_RELOC_THUMB_PCREL_BRANCH25 +ENUMDOC + Thumb 7-, 9-, 12-, 20-, 23-, and 25-bit pc-relative branches. + The lowest bit must be zero and is not stored in the instruction. + Note that the corresponding ELF R_ARM_THM_JUMPnn constant has an + "nn" one smaller in all cases. Note further that BRANCH23 + corresponds to R_ARM_THM_CALL. + +ENUM + BFD_RELOC_ARM_OFFSET_IMM +ENUMDOC + 12-bit immediate offset, used in ARM-format ldr and str instructions. + +ENUM + BFD_RELOC_ARM_THUMB_OFFSET +ENUMDOC + 5-bit immediate offset, used in Thumb-format ldr and str instructions. + +ENUM + BFD_RELOC_ARM_TARGET1 +ENUMDOC + Pc-relative or absolute relocation depending on target. Used for + entries in .init_array sections. +ENUM + BFD_RELOC_ARM_ROSEGREL32 +ENUMDOC + Read-only segment base relative address. +ENUM + BFD_RELOC_ARM_SBREL32 +ENUMDOC + Data segment base relative address. +ENUM + BFD_RELOC_ARM_TARGET2 +ENUMDOC + This reloc is used for references to RTTI data from exception handling + tables. The actual definition depends on the target. It may be a + pc-relative or some form of GOT-indirect relocation. +ENUM + BFD_RELOC_ARM_PREL31 +ENUMDOC + 31-bit PC relative address. + +ENUM + BFD_RELOC_ARM_JUMP_SLOT +ENUMX + BFD_RELOC_ARM_GLOB_DAT +ENUMX + BFD_RELOC_ARM_GOT32 +ENUMX + BFD_RELOC_ARM_PLT32 +ENUMX + BFD_RELOC_ARM_RELATIVE +ENUMX + BFD_RELOC_ARM_GOTOFF +ENUMX + BFD_RELOC_ARM_GOTPC +ENUMDOC + Relocations for setting up GOTs and PLTs for shared libraries. + +ENUM + BFD_RELOC_ARM_TLS_GD32 +ENUMX + BFD_RELOC_ARM_TLS_LDO32 +ENUMX + BFD_RELOC_ARM_TLS_LDM32 +ENUMX + BFD_RELOC_ARM_TLS_DTPOFF32 +ENUMX + BFD_RELOC_ARM_TLS_DTPMOD32 +ENUMX + BFD_RELOC_ARM_TLS_TPOFF32 +ENUMX + BFD_RELOC_ARM_TLS_IE32 +ENUMX + BFD_RELOC_ARM_TLS_LE32 +ENUMDOC + ARM thread-local storage relocations. + ENUM BFD_RELOC_ARM_IMMEDIATE ENUMX BFD_RELOC_ARM_ADRL_IMMEDIATE ENUMX - BFD_RELOC_ARM_OFFSET_IMM + BFD_RELOC_ARM_T32_IMMEDIATE +ENUMX + BFD_RELOC_ARM_T32_IMM12 +ENUMX + BFD_RELOC_ARM_T32_ADD_PC12 ENUMX BFD_RELOC_ARM_SHIFT_IMM +ENUMX + BFD_RELOC_ARM_SMC ENUMX BFD_RELOC_ARM_SWI ENUMX @@ -2572,6 +2760,10 @@ ENUMX BFD_RELOC_ARM_CP_OFF_IMM ENUMX BFD_RELOC_ARM_CP_OFF_IMM_S2 +ENUMX + BFD_RELOC_ARM_T32_CP_OFF_IMM +ENUMX + BFD_RELOC_ARM_T32_CP_OFF_IMM_S2 ENUMX BFD_RELOC_ARM_ADR_IMM ENUMX @@ -2582,6 +2774,10 @@ ENUMX BFD_RELOC_ARM_IN_POOL ENUMX BFD_RELOC_ARM_OFFSET_IMM8 +ENUMX + BFD_RELOC_ARM_T32_OFFSET_U8 +ENUMX + BFD_RELOC_ARM_T32_OFFSET_IMM ENUMX BFD_RELOC_ARM_HWLITERAL ENUMX @@ -2590,26 +2786,6 @@ ENUMX BFD_RELOC_ARM_THUMB_IMM ENUMX BFD_RELOC_ARM_THUMB_SHIFT -ENUMX - BFD_RELOC_ARM_THUMB_OFFSET -ENUMX - BFD_RELOC_ARM_GOT12 -ENUMX - BFD_RELOC_ARM_GOT32 -ENUMX - BFD_RELOC_ARM_JUMP_SLOT -ENUMX - BFD_RELOC_ARM_COPY -ENUMX - BFD_RELOC_ARM_GLOB_DAT -ENUMX - BFD_RELOC_ARM_PLT32 -ENUMX - BFD_RELOC_ARM_RELATIVE -ENUMX - BFD_RELOC_ARM_GOTOFF -ENUMX - BFD_RELOC_ARM_GOTPC ENUMDOC These relocs are only used within the ARM assembler. They are not (at present) written to any object files. @@ -2618,6 +2794,22 @@ ENUM BFD_RELOC_SH_PCDISP8BY2 ENUMX BFD_RELOC_SH_PCDISP12BY2 +ENUMX + BFD_RELOC_SH_IMM3 +ENUMX + BFD_RELOC_SH_IMM3U +ENUMX + BFD_RELOC_SH_DISP12 +ENUMX + BFD_RELOC_SH_DISP12BY2 +ENUMX + BFD_RELOC_SH_DISP12BY4 +ENUMX + BFD_RELOC_SH_DISP12BY8 +ENUMX + BFD_RELOC_SH_DISP20 +ENUMX + BFD_RELOC_SH_DISP20BY8 ENUMX BFD_RELOC_SH_IMM4 ENUMX @@ -2781,16 +2973,6 @@ ENUMX ENUMDOC Renesas / SuperH SH relocs. Not all of these appear in object files. -ENUM - BFD_RELOC_THUMB_PCREL_BRANCH9 -ENUMX - BFD_RELOC_THUMB_PCREL_BRANCH12 -ENUMX - BFD_RELOC_THUMB_PCREL_BRANCH23 -ENUMDOC - Thumb 23-, 12- and 9-bit pc-relative branches. The lowest bit must - be zero and is not stored in the instruction. - ENUM BFD_RELOC_ARC_B22_PCREL ENUMDOC @@ -2805,6 +2987,169 @@ ENUMDOC stored in the instruction. The high 24 bits are installed in bits 23 through 0. +ENUM + BFD_RELOC_BFIN_16_IMM +ENUMDOC + ADI Blackfin 16 bit immediate absolute reloc. +ENUM + BFD_RELOC_BFIN_16_HIGH +ENUMDOC + ADI Blackfin 16 bit immediate absolute reloc higher 16 bits. +ENUM + BFD_RELOC_BFIN_4_PCREL +ENUMDOC + ADI Blackfin 'a' part of LSETUP. +ENUM + BFD_RELOC_BFIN_5_PCREL +ENUMDOC + ADI Blackfin. +ENUM + BFD_RELOC_BFIN_16_LOW +ENUMDOC + ADI Blackfin 16 bit immediate absolute reloc lower 16 bits. +ENUM + BFD_RELOC_BFIN_10_PCREL +ENUMDOC + ADI Blackfin. +ENUM + BFD_RELOC_BFIN_11_PCREL +ENUMDOC + ADI Blackfin 'b' part of LSETUP. +ENUM + BFD_RELOC_BFIN_12_PCREL_JUMP +ENUMDOC + ADI Blackfin. +ENUM + BFD_RELOC_BFIN_12_PCREL_JUMP_S +ENUMDOC + ADI Blackfin Short jump, pcrel. +ENUM + BFD_RELOC_BFIN_24_PCREL_CALL_X +ENUMDOC + ADI Blackfin Call.x not implemented. +ENUM + BFD_RELOC_BFIN_24_PCREL_JUMP_L +ENUMDOC + ADI Blackfin Long Jump pcrel. +ENUM + BFD_RELOC_BFIN_GOT17M4 +ENUMX + BFD_RELOC_BFIN_GOTHI +ENUMX + BFD_RELOC_BFIN_GOTLO +ENUMX + BFD_RELOC_BFIN_FUNCDESC +ENUMX + BFD_RELOC_BFIN_FUNCDESC_GOT17M4 +ENUMX + BFD_RELOC_BFIN_FUNCDESC_GOTHI +ENUMX + BFD_RELOC_BFIN_FUNCDESC_GOTLO +ENUMX + BFD_RELOC_BFIN_FUNCDESC_VALUE +ENUMX + BFD_RELOC_BFIN_FUNCDESC_GOTOFF17M4 +ENUMX + BFD_RELOC_BFIN_FUNCDESC_GOTOFFHI +ENUMX + BFD_RELOC_BFIN_FUNCDESC_GOTOFFLO +ENUMX + BFD_RELOC_BFIN_GOTOFF17M4 +ENUMX + BFD_RELOC_BFIN_GOTOFFHI +ENUMX + BFD_RELOC_BFIN_GOTOFFLO +ENUMDOC + ADI Blackfin FD-PIC relocations. +ENUM + BFD_RELOC_BFIN_GOT +ENUMDOC + ADI Blackfin GOT relocation. +ENUM + BFD_RELOC_BFIN_PLTPC +ENUMDOC + ADI Blackfin PLTPC relocation. +ENUM + BFD_ARELOC_BFIN_PUSH +ENUMDOC + ADI Blackfin arithmetic relocation. +ENUM + BFD_ARELOC_BFIN_CONST +ENUMDOC + ADI Blackfin arithmetic relocation. +ENUM + BFD_ARELOC_BFIN_ADD +ENUMDOC + ADI Blackfin arithmetic relocation. +ENUM + BFD_ARELOC_BFIN_SUB +ENUMDOC + ADI Blackfin arithmetic relocation. +ENUM + BFD_ARELOC_BFIN_MULT +ENUMDOC + ADI Blackfin arithmetic relocation. +ENUM + BFD_ARELOC_BFIN_DIV +ENUMDOC + ADI Blackfin arithmetic relocation. +ENUM + BFD_ARELOC_BFIN_MOD +ENUMDOC + ADI Blackfin arithmetic relocation. +ENUM + BFD_ARELOC_BFIN_LSHIFT +ENUMDOC + ADI Blackfin arithmetic relocation. +ENUM + BFD_ARELOC_BFIN_RSHIFT +ENUMDOC + ADI Blackfin arithmetic relocation. +ENUM + BFD_ARELOC_BFIN_AND +ENUMDOC + ADI Blackfin arithmetic relocation. +ENUM + BFD_ARELOC_BFIN_OR +ENUMDOC + ADI Blackfin arithmetic relocation. +ENUM + BFD_ARELOC_BFIN_XOR +ENUMDOC + ADI Blackfin arithmetic relocation. +ENUM + BFD_ARELOC_BFIN_LAND +ENUMDOC + ADI Blackfin arithmetic relocation. +ENUM + BFD_ARELOC_BFIN_LOR +ENUMDOC + ADI Blackfin arithmetic relocation. +ENUM + BFD_ARELOC_BFIN_LEN +ENUMDOC + ADI Blackfin arithmetic relocation. +ENUM + BFD_ARELOC_BFIN_NEG +ENUMDOC + ADI Blackfin arithmetic relocation. +ENUM + BFD_ARELOC_BFIN_COMP +ENUMDOC + ADI Blackfin arithmetic relocation. +ENUM + BFD_ARELOC_BFIN_PAGE +ENUMDOC + ADI Blackfin arithmetic relocation. +ENUM + BFD_ARELOC_BFIN_HWPAGE +ENUMDOC + ADI Blackfin arithmetic relocation. +ENUM + BFD_ARELOC_BFIN_ADDR +ENUMDOC + ADI Blackfin arithmetic relocation. + ENUM BFD_RELOC_D10V_10_PCREL_R ENUMDOC @@ -2903,6 +3248,17 @@ ENUM ENUMDOC DLX relocs +ENUM + BFD_RELOC_M32C_HI8 +ENUMX + BFD_RELOC_M32C_RL_JUMP +ENUMX + BFD_RELOC_M32C_RL_1ADDR +ENUMX + BFD_RELOC_M32C_RL_2ADDR +ENUMDOC + Renesas M16C/M32C Relocations. + ENUM BFD_RELOC_M32R_24 ENUMDOC @@ -2953,6 +3309,12 @@ ENUMX BFD_RELOC_M32R_RELATIVE ENUMX BFD_RELOC_M32R_GOTOFF +ENUMX + BFD_RELOC_M32R_GOTOFF_HI_ULO +ENUMX + BFD_RELOC_M32R_GOTOFF_HI_SLO +ENUMX + BFD_RELOC_M32R_GOTOFF_LO ENUMX BFD_RELOC_M32R_GOTPC24 ENUMX @@ -3056,6 +3418,11 @@ ENUM BFD_RELOC_V850_ALIGN ENUMDOC Used to maintain alignment whilst relaxing. +ENUM + BFD_RELOC_V850_LO16_SPLIT_OFFSET +ENUMDOC + This is a variation of BFD_RELOC_LO16 that can be used in v850e ld.bu + instructions. ENUM BFD_RELOC_MN10300_32_PCREL ENUMDOC @@ -3266,6 +3633,11 @@ ENUM ENUMDOC This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit of program memory address) into 8 bit immediate value of LDI insn. +ENUM + BFD_RELOC_AVR_MS8_LDI +ENUMDOC + This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit + of 32 bit value) into 8 bit immediate value of LDI insn. ENUM BFD_RELOC_AVR_LO8_LDI_NEG ENUMDOC @@ -3283,6 +3655,11 @@ ENUMDOC This is a 16 bit reloc for the AVR that stores negated 8 bit value (most high 8 bit of program memory address) into 8 bit immediate value of LDI or SUBI insn. +ENUM + BFD_RELOC_AVR_MS8_LDI_NEG +ENUMDOC + This is a 16 bit reloc for the AVR that stores negated 8 bit value (msb + of 32 bit value) into 8 bit immediate value of LDI insn. ENUM BFD_RELOC_AVR_LO8_LDI_PM ENUMDOC @@ -3320,6 +3697,21 @@ ENUM ENUMDOC This is a 32 bit reloc for the AVR that stores 23 bit value into 22 bits. +ENUM + BFD_RELOC_AVR_LDI +ENUMDOC + This is a 16 bit reloc for the AVR that stores all needed bits + for absolute addressing with ldi with overflow check to linktime +ENUM + BFD_RELOC_AVR_6 +ENUMDOC + This is a 6 bit reloc for the AVR that stores offset for ldd/std + instructions +ENUM + BFD_RELOC_AVR_6_ADIW +ENUMDOC + This is a 6 bit reloc for the AVR that stores offset for adiw/sbiw + instructions ENUM BFD_RELOC_390_12 @@ -3770,6 +4162,132 @@ ENUMDOC Motorola 68HC12 reloc. This is the 5 bits of a value. +ENUM + BFD_RELOC_16C_NUM08 +ENUMX + BFD_RELOC_16C_NUM08_C +ENUMX + BFD_RELOC_16C_NUM16 +ENUMX + BFD_RELOC_16C_NUM16_C +ENUMX + BFD_RELOC_16C_NUM32 +ENUMX + BFD_RELOC_16C_NUM32_C +ENUMX + BFD_RELOC_16C_DISP04 +ENUMX + BFD_RELOC_16C_DISP04_C +ENUMX + BFD_RELOC_16C_DISP08 +ENUMX + BFD_RELOC_16C_DISP08_C +ENUMX + BFD_RELOC_16C_DISP16 +ENUMX + BFD_RELOC_16C_DISP16_C +ENUMX + BFD_RELOC_16C_DISP24 +ENUMX + BFD_RELOC_16C_DISP24_C +ENUMX + BFD_RELOC_16C_DISP24a +ENUMX + BFD_RELOC_16C_DISP24a_C +ENUMX + BFD_RELOC_16C_REG04 +ENUMX + BFD_RELOC_16C_REG04_C +ENUMX + BFD_RELOC_16C_REG04a +ENUMX + BFD_RELOC_16C_REG04a_C +ENUMX + BFD_RELOC_16C_REG14 +ENUMX + BFD_RELOC_16C_REG14_C +ENUMX + BFD_RELOC_16C_REG16 +ENUMX + BFD_RELOC_16C_REG16_C +ENUMX + BFD_RELOC_16C_REG20 +ENUMX + BFD_RELOC_16C_REG20_C +ENUMX + BFD_RELOC_16C_ABS20 +ENUMX + BFD_RELOC_16C_ABS20_C +ENUMX + BFD_RELOC_16C_ABS24 +ENUMX + BFD_RELOC_16C_ABS24_C +ENUMX + BFD_RELOC_16C_IMM04 +ENUMX + BFD_RELOC_16C_IMM04_C +ENUMX + BFD_RELOC_16C_IMM16 +ENUMX + BFD_RELOC_16C_IMM16_C +ENUMX + BFD_RELOC_16C_IMM20 +ENUMX + BFD_RELOC_16C_IMM20_C +ENUMX + BFD_RELOC_16C_IMM24 +ENUMX + BFD_RELOC_16C_IMM24_C +ENUMX + BFD_RELOC_16C_IMM32 +ENUMX + BFD_RELOC_16C_IMM32_C +ENUMDOC + NS CR16C Relocations. + +ENUM + BFD_RELOC_CRX_REL4 +ENUMX + BFD_RELOC_CRX_REL8 +ENUMX + BFD_RELOC_CRX_REL8_CMP +ENUMX + BFD_RELOC_CRX_REL16 +ENUMX + BFD_RELOC_CRX_REL24 +ENUMX + BFD_RELOC_CRX_REL32 +ENUMX + BFD_RELOC_CRX_REGREL12 +ENUMX + BFD_RELOC_CRX_REGREL22 +ENUMX + BFD_RELOC_CRX_REGREL28 +ENUMX + BFD_RELOC_CRX_REGREL32 +ENUMX + BFD_RELOC_CRX_ABS16 +ENUMX + BFD_RELOC_CRX_ABS32 +ENUMX + BFD_RELOC_CRX_NUM8 +ENUMX + BFD_RELOC_CRX_NUM16 +ENUMX + BFD_RELOC_CRX_NUM32 +ENUMX + BFD_RELOC_CRX_IMM16 +ENUMX + BFD_RELOC_CRX_IMM32 +ENUMX + BFD_RELOC_CRX_SWITCH8 +ENUMX + BFD_RELOC_CRX_SWITCH16 +ENUMX + BFD_RELOC_CRX_SWITCH32 +ENUMDOC + NS CRX Relocations. + ENUM BFD_RELOC_CRIS_BDISP8 ENUMX @@ -3778,6 +4296,16 @@ ENUMX BFD_RELOC_CRIS_SIGNED_6 ENUMX BFD_RELOC_CRIS_UNSIGNED_6 +ENUMX + BFD_RELOC_CRIS_SIGNED_8 +ENUMX + BFD_RELOC_CRIS_UNSIGNED_8 +ENUMX + BFD_RELOC_CRIS_SIGNED_16 +ENUMX + BFD_RELOC_CRIS_UNSIGNED_16 +ENUMX + BFD_RELOC_CRIS_LAPCQ_OFFSET ENUMX BFD_RELOC_CRIS_UNSIGNED_4 ENUMDOC @@ -3920,6 +4448,17 @@ ENUMX ENUMDOC Sony Xstormy16 Relocations. +ENUM + BFD_RELOC_XC16X_PAG +ENUMX + BFD_RELOC_XC16X_POF +ENUMX + BFD_RELOC_XC16X_SEG +ENUMX + BFD_RELOC_XC16X_SOF +ENUMDOC + Infineon Relocations. + ENUM BFD_RELOC_VAX_GLOB_DAT ENUMX @@ -3928,7 +4467,32 @@ ENUMX BFD_RELOC_VAX_RELATIVE ENUMDOC Relocations used by VAX ELF. - + +ENUM + BFD_RELOC_MT_PC16 +ENUMDOC + Morpho MT - 16 bit immediate relocation. +ENUM + BFD_RELOC_MT_HI16 +ENUMDOC + Morpho MT - Hi 16 bits of an address. +ENUM + BFD_RELOC_MT_LO16 +ENUMDOC + Morpho MT - Low 16 bits of an address. +ENUM + BFD_RELOC_MT_GNU_VTINHERIT +ENUMDOC + Morpho MT - Used to tell the linker which vtable entries are used. +ENUM + BFD_RELOC_MT_GNU_VTENTRY +ENUMDOC + Morpho MT - Used to tell the linker which vtable entries are used. +ENUM + BFD_RELOC_MT_PCINSN8 +ENUMDOC + Morpho MT - 8 bit immediate relocation. + ENUM BFD_RELOC_MSP430_10_PCREL ENUMX @@ -3939,6 +4503,10 @@ ENUMX BFD_RELOC_MSP430_16_PCREL_BYTE ENUMX BFD_RELOC_MSP430_16_BYTE +ENUMX + BFD_RELOC_MSP430_2X_PCREL +ENUMX + BFD_RELOC_MSP430_RL_PCREL ENUMDOC msp430 specific relocation codes @@ -3970,6 +4538,87 @@ ENUM ENUMDOC Xtensa relocation used in ELF object files for symbols that may require PLT entries. Otherwise, this is just a generic 32-bit relocation. +ENUM + BFD_RELOC_XTENSA_DIFF8 +ENUMX + BFD_RELOC_XTENSA_DIFF16 +ENUMX + BFD_RELOC_XTENSA_DIFF32 +ENUMDOC + Xtensa relocations to mark the difference of two local symbols. + These are only needed to support linker relaxation and can be ignored + when not relaxing. The field is set to the value of the difference + assuming no relaxation. The relocation encodes the position of the + first symbol so the linker can determine whether to adjust the field + value. +ENUM + BFD_RELOC_XTENSA_SLOT0_OP +ENUMX + BFD_RELOC_XTENSA_SLOT1_OP +ENUMX + BFD_RELOC_XTENSA_SLOT2_OP +ENUMX + BFD_RELOC_XTENSA_SLOT3_OP +ENUMX + BFD_RELOC_XTENSA_SLOT4_OP +ENUMX + BFD_RELOC_XTENSA_SLOT5_OP +ENUMX + BFD_RELOC_XTENSA_SLOT6_OP +ENUMX + BFD_RELOC_XTENSA_SLOT7_OP +ENUMX + BFD_RELOC_XTENSA_SLOT8_OP +ENUMX + BFD_RELOC_XTENSA_SLOT9_OP +ENUMX + BFD_RELOC_XTENSA_SLOT10_OP +ENUMX + BFD_RELOC_XTENSA_SLOT11_OP +ENUMX + BFD_RELOC_XTENSA_SLOT12_OP +ENUMX + BFD_RELOC_XTENSA_SLOT13_OP +ENUMX + BFD_RELOC_XTENSA_SLOT14_OP +ENUMDOC + Generic Xtensa relocations for instruction operands. Only the slot + number is encoded in the relocation. The relocation applies to the + last PC-relative immediate operand, or if there are no PC-relative + immediates, to the last immediate operand. +ENUM + BFD_RELOC_XTENSA_SLOT0_ALT +ENUMX + BFD_RELOC_XTENSA_SLOT1_ALT +ENUMX + BFD_RELOC_XTENSA_SLOT2_ALT +ENUMX + BFD_RELOC_XTENSA_SLOT3_ALT +ENUMX + BFD_RELOC_XTENSA_SLOT4_ALT +ENUMX + BFD_RELOC_XTENSA_SLOT5_ALT +ENUMX + BFD_RELOC_XTENSA_SLOT6_ALT +ENUMX + BFD_RELOC_XTENSA_SLOT7_ALT +ENUMX + BFD_RELOC_XTENSA_SLOT8_ALT +ENUMX + BFD_RELOC_XTENSA_SLOT9_ALT +ENUMX + BFD_RELOC_XTENSA_SLOT10_ALT +ENUMX + BFD_RELOC_XTENSA_SLOT11_ALT +ENUMX + BFD_RELOC_XTENSA_SLOT12_ALT +ENUMX + BFD_RELOC_XTENSA_SLOT13_ALT +ENUMX + BFD_RELOC_XTENSA_SLOT14_ALT +ENUMDOC + Alternate Xtensa relocations. Only the slot is encoded in the + relocation. The meaning of these relocations is opcode-specific. ENUM BFD_RELOC_XTENSA_OP0 ENUMX @@ -3977,23 +4626,40 @@ ENUMX ENUMX BFD_RELOC_XTENSA_OP2 ENUMDOC - Generic Xtensa relocations. Only the operand number is encoded - in the relocation. The details are determined by extracting the - instruction opcode. + Xtensa relocations for backward compatibility. These have all been + replaced by BFD_RELOC_XTENSA_SLOT0_OP. ENUM BFD_RELOC_XTENSA_ASM_EXPAND ENUMDOC - Xtensa relocation to mark that the assembler expanded the + Xtensa relocation to mark that the assembler expanded the instructions from an original target. The expansion size is encoded in the reloc size. ENUM BFD_RELOC_XTENSA_ASM_SIMPLIFY ENUMDOC - Xtensa relocation to mark that the linker should simplify - assembler-expanded instructions. This is commonly used - internally by the linker after analysis of a + Xtensa relocation to mark that the linker should simplify + assembler-expanded instructions. This is commonly used + internally by the linker after analysis of a BFD_RELOC_XTENSA_ASM_EXPAND. +ENUM + BFD_RELOC_Z80_DISP8 +ENUMDOC + 8 bit signed offset in (ix+d) or (iy+d). + +ENUM + BFD_RELOC_Z8K_DISP7 +ENUMDOC + DJNZ offset. +ENUM + BFD_RELOC_Z8K_CALLR +ENUMDOC + CALR offset. +ENUM + BFD_RELOC_Z8K_IMM4L +ENUMDOC + 4 bit value. + ENDSENUM BFD_RELOC_UNUSED CODE_FRAGMENT @@ -4023,7 +4689,7 @@ bfd_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code) } static reloc_howto_type bfd_howto_32 = -HOWTO (0, 00, 2, 32, FALSE, 0, complain_overflow_bitfield, 0, "VRT32", FALSE, 0xffffffff, 0xffffffff, TRUE); +HOWTO (0, 00, 2, 32, FALSE, 0, complain_overflow_dont, 0, "VRT32", FALSE, 0xffffffff, 0xffffffff, TRUE); /* INTERNAL_FUNCTION @@ -4096,8 +4762,7 @@ SYNOPSIS DESCRIPTION Provides default handling for relaxing for back ends which - don't do relaxing -- i.e., does nothing except make sure that the - final size of the section is set. + don't do relaxing. */ bfd_boolean @@ -4106,11 +4771,6 @@ bfd_generic_relax_section (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *link_info ATTRIBUTE_UNUSED, bfd_boolean *again) { - /* We're not relaxing the section, so just copy the size info if it's - zero. Someone else, like bfd_merge_sections, might have set it, so - don't overwrite a non-zero value. */ - if (section->_cooked_size == 0) - section->_cooked_size = section->_raw_size; *again = FALSE; return TRUE; } @@ -4130,7 +4790,7 @@ DESCRIPTION bfd_boolean bfd_generic_gc_sections (bfd *abfd ATTRIBUTE_UNUSED, - struct bfd_link_info *link_info ATTRIBUTE_UNUSED) + struct bfd_link_info *info ATTRIBUTE_UNUSED) { return TRUE; } @@ -4189,6 +4849,7 @@ bfd_generic_get_relocated_section_contents (bfd *abfd, long reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section); arelent **reloc_vector = NULL; long reloc_count; + bfd_size_type sz; if (reloc_size < 0) goto error_return; @@ -4198,22 +4859,10 @@ bfd_generic_get_relocated_section_contents (bfd *abfd, goto error_return; /* Read in the section. */ - if (!bfd_get_section_contents (input_bfd, - input_section, - data, - 0, - input_section->_raw_size)) + sz = input_section->rawsize ? input_section->rawsize : input_section->size; + if (!bfd_get_section_contents (input_bfd, input_section, data, 0, sz)) goto error_return; - /* Don't set input_section->_cooked_size here. The caller has set - _cooked_size or called bfd_relax_section, which sets _cooked_size. - Despite using this generic relocation function, some targets perform - target-specific relaxation or string merging, which happens before - this function is called. We do not want to clobber the _cooked_size - they computed. */ - - input_section->reloc_done = TRUE; - reloc_count = bfd_canonicalize_reloc (input_bfd, input_section, reloc_vector, @@ -4264,7 +4913,8 @@ bfd_generic_get_relocated_section_contents (bfd *abfd, break; case bfd_reloc_overflow: if (!((*link_info->callbacks->reloc_overflow) - (link_info, bfd_asymbol_name (*(*parent)->sym_ptr_ptr), + (link_info, NULL, + bfd_asymbol_name (*(*parent)->sym_ptr_ptr), (*parent)->howto->name, (*parent)->addend, input_bfd, input_section, (*parent)->address))) goto error_return; diff --git a/contrib/binutils/bfd/reloc16.c b/contrib/binutils/bfd/reloc16.c index 720e2d6abc2..3adbbc75cd1 100644 --- a/contrib/binutils/bfd/reloc16.c +++ b/contrib/binutils/bfd/reloc16.c @@ -1,6 +1,6 @@ /* 8 and 16 bit COFF relocation functions, for BFD. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2001, - 2002, 2003 Free Software Foundation, Inc. + 2002, 2003, 2004 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -17,7 +17,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* Most of this hacked by Steve Chamberlain . */ @@ -230,7 +230,8 @@ bfd_coff_reloc16_relax_section (abfd, input_section, link_info, again) free ((char *) shrinks); } - input_section->_cooked_size -= shrink; + input_section->rawsize = input_section->size; + input_section->size -= shrink; free ((char *) reloc_vector); return TRUE; } @@ -255,6 +256,7 @@ bfd_coff_reloc16_get_relocated_section_contents (in_abfd, long reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section); arelent **reloc_vector; long reloc_count; + bfd_size_type sz; if (reloc_size < 0) return NULL; @@ -267,11 +269,8 @@ bfd_coff_reloc16_get_relocated_section_contents (in_abfd, symbols); /* Read in the section. */ - if (!bfd_get_section_contents (input_bfd, - input_section, - data, - (bfd_vma) 0, - input_section->_raw_size)) + sz = input_section->rawsize ? input_section->rawsize : input_section->size; + if (!bfd_get_section_contents (input_bfd, input_section, data, 0, sz)) return NULL; reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size); diff --git a/contrib/binutils/bfd/rs6000-core.c b/contrib/binutils/bfd/rs6000-core.c index 3fa0975dc31..280a020a754 100644 --- a/contrib/binutils/bfd/rs6000-core.c +++ b/contrib/binutils/bfd/rs6000-core.c @@ -1,6 +1,6 @@ /* IBM RS/6000 "XCOFF" back-end for BFD. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, - 2001, 2002 + 2001, 2002, 2004 Free Software Foundation, Inc. FIXME: Can someone provide a transliteration of this name into ASCII? Using the following chars caused a compiler warning on HIUX (so I replaced @@ -25,7 +25,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* This port currently only handles reading object files, except when compiled on an RS/6000 host. -- no archive support, no core files. @@ -71,6 +71,9 @@ #include #include +/* Borrowed from on recent AIX versions. */ +typedef unsigned long ptr_to_uint; + #define core_hdr(bfd) ((CoreHdr *) bfd->tdata.any) /* AIX 4.1 changed the names and locations of a few items in the core file. @@ -250,6 +253,15 @@ typedef union { #define CORE_COMMONSZ ((int) &((struct core_dump *) 0)->c_entries \ + sizeof (((struct core_dump *) 0)->c_entries)) +/* Define prototypes for certain functions, to avoid a compiler warning + saying that they are missing. */ + +const bfd_target * rs6000coff_core_p (bfd *abfd); +bfd_boolean rs6000coff_core_file_matches_executable_p (bfd *core_bfd, + bfd *exec_bfd); +char * rs6000coff_core_file_failing_command (bfd *abfd); +int rs6000coff_core_file_failing_signal (bfd *abfd); + /* Try to read into CORE the header from the core file associated with ABFD. Return success. */ @@ -277,13 +289,8 @@ read_hdr (bfd *abfd, CoreHdr *core) } static asection * -make_bfd_asection (abfd, name, flags, _raw_size, vma, filepos) - bfd *abfd; - const char *name; - flagword flags; - bfd_size_type _raw_size; - bfd_vma vma; - file_ptr filepos; +make_bfd_asection (bfd *abfd, const char *name, flagword flags, + bfd_size_type size, bfd_vma vma, file_ptr filepos) { asection *asect; @@ -292,7 +299,7 @@ make_bfd_asection (abfd, name, flags, _raw_size, vma, filepos) return NULL; asect->flags = flags; - asect->_raw_size = _raw_size; + asect->size = size; asect->vma = vma; asect->filepos = filepos; asect->alignment_power = 8; @@ -304,8 +311,7 @@ make_bfd_asection (abfd, name, flags, _raw_size, vma, filepos) magic number or anything like, in rs6000coff. */ const bfd_target * -rs6000coff_core_p (abfd) - bfd *abfd; +rs6000coff_core_p (bfd *abfd) { CoreHdr core; struct stat statbuf; @@ -341,11 +347,11 @@ rs6000coff_core_p (abfd) else { c_flag = core.old.c_flag; - c_stack = (file_ptr) core.old.c_stack; + c_stack = (file_ptr) (ptr_to_uint) core.old.c_stack; c_size = core.old.c_size; c_stackend = COLD_STACKEND; c_lsize = 0x7ffffff; - c_loader = (file_ptr) COLD_LOADER (core.old); + c_loader = (file_ptr) (ptr_to_uint) COLD_LOADER (core.old); proc64 = 0; } @@ -523,9 +529,9 @@ rs6000coff_core_p (abfd) else { c_datasize = core.old.c_datasize; - c_data = (file_ptr) core.old.c_data; + c_data = (file_ptr) (ptr_to_uint) core.old.c_data; c_vmregions = core.old.c_vmregions; - c_vmm = (file_ptr) core.old.c_vmm; + c_vmm = (file_ptr) (ptr_to_uint) core.old.c_vmm; } /* .data section from executable. */ @@ -633,9 +639,7 @@ rs6000coff_core_p (abfd) /* Return `TRUE' if given core is from the given executable. */ bfd_boolean -rs6000coff_core_file_matches_executable_p (core_bfd, exec_bfd) - bfd *core_bfd; - bfd *exec_bfd; +rs6000coff_core_file_matches_executable_p (bfd *core_bfd, bfd *exec_bfd) { CoreHdr core; bfd_size_type size; @@ -651,7 +655,7 @@ rs6000coff_core_file_matches_executable_p (core_bfd, exec_bfd) if (CORE_NEW (core)) c_loader = CNEW_LOADER (core.new); else - c_loader = (file_ptr) COLD_LOADER (core.old); + c_loader = (file_ptr) (ptr_to_uint) COLD_LOADER (core.old); if (CORE_NEW (core) && CNEW_PROC64 (core.new)) size = (int) ((LdInfo *) 0)->l64.ldinfo_filename; @@ -711,8 +715,7 @@ rs6000coff_core_file_matches_executable_p (core_bfd, exec_bfd) } char * -rs6000coff_core_file_failing_command (abfd) - bfd *abfd; +rs6000coff_core_file_failing_command (bfd *abfd) { CoreHdr *core = core_hdr (abfd); char *com = CORE_NEW (*core) ? @@ -725,8 +728,7 @@ rs6000coff_core_file_failing_command (abfd) } int -rs6000coff_core_file_failing_signal (abfd) - bfd *abfd; +rs6000coff_core_file_failing_signal (bfd *abfd) { CoreHdr *core = core_hdr (abfd); return CORE_NEW (*core) ? core->new.c_signo : core->old.c_signo; diff --git a/contrib/binutils/bfd/sco5-core.c b/contrib/binutils/bfd/sco5-core.c index 5c34ff1b556..9a06b8839f5 100644 --- a/contrib/binutils/bfd/sco5-core.c +++ b/contrib/binutils/bfd/sco5-core.c @@ -1,5 +1,5 @@ /* BFD back end for SCO5 core files (U-area and raw sections) - Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 + Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. Written by Jouke Numan @@ -17,7 +17,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" @@ -31,8 +31,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include /* After a.out.h */ +#ifdef SCO5_CORE #include #include +#endif struct sco5_core_struct { @@ -47,16 +49,15 @@ static struct user *read_uarea PARAMS ((bfd *, int)); const bfd_target *sco5_core_file_p PARAMS ((bfd *abfd)); char *sco5_core_file_failing_command PARAMS ((bfd *abfd)); int sco5_core_file_failing_signal PARAMS ((bfd *abfd)); -bfd_boolean sco5_core_file_matches_executable_p - PARAMS ((bfd *core_bfd, bfd *exec_bfd)); +#define sco5_core_file_matches_executable_p generic_core_file_matches_executable_p static void swap_abort PARAMS ((void)); static asection * -make_bfd_asection (abfd, name, flags, _raw_size, vma, filepos) +make_bfd_asection (abfd, name, flags, size, vma, filepos) bfd *abfd; const char *name; flagword flags; - bfd_size_type _raw_size; + bfd_size_type size; bfd_vma vma; file_ptr filepos; { @@ -66,7 +67,7 @@ make_bfd_asection (abfd, name, flags, _raw_size, vma, filepos) if (!asect) return NULL; asect->flags = flags; - asect->_raw_size = _raw_size; + asect->size = size; asect->vma = vma; asect->filepos = filepos; asect->alignment_power = 2; @@ -123,18 +124,14 @@ sco5_core_file_p (abfd) char *secname; flagword flags; - /* Read coreoffsets region at end of core (see core(FP)) */ + /* Read coreoffsets region at end of core (see core(FP)). */ { - FILE *stream = bfd_cache_lookup (abfd); struct stat statbuf; - if (stream == NULL) + + if (bfd_stat (abfd, &statbuf) < 0) return NULL; - if (fstat (fileno (stream), &statbuf) < 0) - { - bfd_set_error (bfd_error_system_call); - return NULL; - } + coresize = statbuf.st_size; } /* Last long in core is sizeof struct coreoffsets, read it */ @@ -347,14 +344,6 @@ sco5_core_file_failing_signal (ignore_abfd) : -1); } -bfd_boolean -sco5_core_file_matches_executable_p (core_bfd, exec_bfd) - bfd *core_bfd ATTRIBUTE_UNUSED; - bfd *exec_bfd ATTRIBUTE_UNUSED; -{ - return TRUE; /* FIXME, We have no way of telling at this point */ -} - /* If somebody calls any byte-swapping routines, shoot them. */ static void swap_abort () diff --git a/contrib/binutils/bfd/section.c b/contrib/binutils/bfd/section.c index fce8e1eab3d..f870e6bfc08 100644 --- a/contrib/binutils/bfd/section.c +++ b/contrib/binutils/bfd/section.c @@ -1,6 +1,6 @@ /* Object file "section" support for the BFD library. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003 + 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Written by Cygnus Support. @@ -18,7 +18,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* SECTION @@ -149,23 +149,6 @@ SUBSECTION CODE_FRAGMENT . -.{* This structure is used for a comdat section, as in PE. A comdat -. section is associated with a particular symbol. When the linker -. sees a comdat section, it keeps only one of the sections with a -. given name and associated with a given symbol. *} -. -.struct bfd_comdat_info -.{ -. {* The name of the symbol associated with a comdat section. *} -. const char *name; -. -. {* The local symbol table index of the symbol associated with a -. comdat section. This is only meaningful to the object file format -. specific code; it is not an index into the list returned by -. bfd_canonicalize_symtab. *} -. long symbol; -.}; -. .typedef struct bfd_section .{ . {* The name of the section; the name isn't a copy, the pointer is @@ -181,6 +164,9 @@ CODE_FRAGMENT . {* The next section in the list belonging to the BFD, or NULL. *} . struct bfd_section *next; . +. {* The previous section in the list belonging to the BFD, or NULL. *} +. struct bfd_section *prev; +. . {* The field flags contains attributes of the section. Some . flags are read in from the object file, and some are . synthesized from other information. *} @@ -200,23 +186,17 @@ CODE_FRAGMENT . some relocation information too. *} .#define SEC_RELOC 0x004 . -. {* ELF reserves 4 processor specific bits and 8 operating system -. specific bits in sh_flags; at present we can get away with just -. one in communicating between the assembler and BFD, but this -. isn't a good long-term solution. *} -.#define SEC_ARCH_BIT_0 0x008 -. . {* A signal to the OS that the section contains read only data. *} -.#define SEC_READONLY 0x010 +.#define SEC_READONLY 0x008 . . {* The section contains code only. *} -.#define SEC_CODE 0x020 +.#define SEC_CODE 0x010 . . {* The section contains data only. *} -.#define SEC_DATA 0x040 +.#define SEC_DATA 0x020 . . {* The section will reside in ROM. *} -.#define SEC_ROM 0x080 +.#define SEC_ROM 0x040 . . {* The section contains constructor information. This section . type is used by the linker to create lists of constructors and @@ -228,16 +208,110 @@ CODE_FRAGMENT . sections called <<__CTOR_LIST__>> and relocate the data . contained within - exactly the operations it would peform on . standard data. *} -.#define SEC_CONSTRUCTOR 0x100 +.#define SEC_CONSTRUCTOR 0x080 . . {* The section has contents - a data section could be . <> | <>; a debug section could be . <> *} -.#define SEC_HAS_CONTENTS 0x200 +.#define SEC_HAS_CONTENTS 0x100 . . {* An instruction to the linker to not output the section . even if it has information which would normally be written. *} -.#define SEC_NEVER_LOAD 0x400 +.#define SEC_NEVER_LOAD 0x200 +. +. {* The section contains thread local data. *} +.#define SEC_THREAD_LOCAL 0x400 +. +. {* The section has GOT references. This flag is only for the +. linker, and is currently only used by the elf32-hppa back end. +. It will be set if global offset table references were detected +. in this section, which indicate to the linker that the section +. contains PIC code, and must be handled specially when doing a +. static link. *} +.#define SEC_HAS_GOT_REF 0x800 +. +. {* The section contains common symbols (symbols may be defined +. multiple times, the value of a symbol is the amount of +. space it requires, and the largest symbol value is the one +. used). Most targets have exactly one of these (which we +. translate to bfd_com_section_ptr), but ECOFF has two. *} +.#define SEC_IS_COMMON 0x1000 +. +. {* The section contains only debugging information. For +. example, this is set for ELF .debug and .stab sections. +. strip tests this flag to see if a section can be +. discarded. *} +.#define SEC_DEBUGGING 0x2000 +. +. {* The contents of this section are held in memory pointed to +. by the contents field. This is checked by bfd_get_section_contents, +. and the data is retrieved from memory if appropriate. *} +.#define SEC_IN_MEMORY 0x4000 +. +. {* The contents of this section are to be excluded by the +. linker for executable and shared objects unless those +. objects are to be further relocated. *} +.#define SEC_EXCLUDE 0x8000 +. +. {* The contents of this section are to be sorted based on the sum of +. the symbol and addend values specified by the associated relocation +. entries. Entries without associated relocation entries will be +. appended to the end of the section in an unspecified order. *} +.#define SEC_SORT_ENTRIES 0x10000 +. +. {* When linking, duplicate sections of the same name should be +. discarded, rather than being combined into a single section as +. is usually done. This is similar to how common symbols are +. handled. See SEC_LINK_DUPLICATES below. *} +.#define SEC_LINK_ONCE 0x20000 +. +. {* If SEC_LINK_ONCE is set, this bitfield describes how the linker +. should handle duplicate sections. *} +.#define SEC_LINK_DUPLICATES 0x40000 +. +. {* This value for SEC_LINK_DUPLICATES means that duplicate +. sections with the same name should simply be discarded. *} +.#define SEC_LINK_DUPLICATES_DISCARD 0x0 +. +. {* This value for SEC_LINK_DUPLICATES means that the linker +. should warn if there are any duplicate sections, although +. it should still only link one copy. *} +.#define SEC_LINK_DUPLICATES_ONE_ONLY 0x80000 +. +. {* This value for SEC_LINK_DUPLICATES means that the linker +. should warn if any duplicate sections are a different size. *} +.#define SEC_LINK_DUPLICATES_SAME_SIZE 0x100000 +. +. {* This value for SEC_LINK_DUPLICATES means that the linker +. should warn if any duplicate sections contain different +. contents. *} +.#define SEC_LINK_DUPLICATES_SAME_CONTENTS \ +. (SEC_LINK_DUPLICATES_ONE_ONLY | SEC_LINK_DUPLICATES_SAME_SIZE) +. +. {* This section was created by the linker as part of dynamic +. relocation or other arcane processing. It is skipped when +. going through the first-pass output, trusting that someone +. else up the line will take care of it later. *} +.#define SEC_LINKER_CREATED 0x200000 +. +. {* This section should not be subject to garbage collection. *} +.#define SEC_KEEP 0x400000 +. +. {* This section contains "short" data, and should be placed +. "near" the GP. *} +.#define SEC_SMALL_DATA 0x800000 +. +. {* Attempt to merge identical entities in the section. +. Entity size is given in the entsize field. *} +.#define SEC_MERGE 0x1000000 +. +. {* If given with SEC_MERGE, entities to merge are zero terminated +. strings where entsize specifies character size instead of fixed +. size entries. *} +.#define SEC_STRINGS 0x2000000 +. +. {* This section contains data about section groups. *} +.#define SEC_GROUP 0x4000000 . . {* The section is a COFF shared library section. This flag is . only for the linker. If this type of section appears in @@ -248,114 +322,23 @@ CODE_FRAGMENT . might be cleaner to have some more general mechanism to . allow the back end to control what the linker does with . sections. *} -.#define SEC_COFF_SHARED_LIBRARY 0x800 -. -. {* The section contains thread local data. *} -.#define SEC_THREAD_LOCAL 0x1000 -. -. {* The section has GOT references. This flag is only for the -. linker, and is currently only used by the elf32-hppa back end. -. It will be set if global offset table references were detected -. in this section, which indicate to the linker that the section -. contains PIC code, and must be handled specially when doing a -. static link. *} -.#define SEC_HAS_GOT_REF 0x4000 -. -. {* The section contains common symbols (symbols may be defined -. multiple times, the value of a symbol is the amount of -. space it requires, and the largest symbol value is the one -. used). Most targets have exactly one of these (which we -. translate to bfd_com_section_ptr), but ECOFF has two. *} -.#define SEC_IS_COMMON 0x8000 -. -. {* The section contains only debugging information. For -. example, this is set for ELF .debug and .stab sections. -. strip tests this flag to see if a section can be -. discarded. *} -.#define SEC_DEBUGGING 0x10000 -. -. {* The contents of this section are held in memory pointed to -. by the contents field. This is checked by bfd_get_section_contents, -. and the data is retrieved from memory if appropriate. *} -.#define SEC_IN_MEMORY 0x20000 -. -. {* The contents of this section are to be excluded by the -. linker for executable and shared objects unless those -. objects are to be further relocated. *} -.#define SEC_EXCLUDE 0x40000 -. -. {* The contents of this section are to be sorted based on the sum of -. the symbol and addend values specified by the associated relocation -. entries. Entries without associated relocation entries will be -. appended to the end of the section in an unspecified order. *} -.#define SEC_SORT_ENTRIES 0x80000 -. -. {* When linking, duplicate sections of the same name should be -. discarded, rather than being combined into a single section as -. is usually done. This is similar to how common symbols are -. handled. See SEC_LINK_DUPLICATES below. *} -.#define SEC_LINK_ONCE 0x100000 -. -. {* If SEC_LINK_ONCE is set, this bitfield describes how the linker -. should handle duplicate sections. *} -.#define SEC_LINK_DUPLICATES 0x600000 -. -. {* This value for SEC_LINK_DUPLICATES means that duplicate -. sections with the same name should simply be discarded. *} -.#define SEC_LINK_DUPLICATES_DISCARD 0x0 -. -. {* This value for SEC_LINK_DUPLICATES means that the linker -. should warn if there are any duplicate sections, although -. it should still only link one copy. *} -.#define SEC_LINK_DUPLICATES_ONE_ONLY 0x200000 -. -. {* This value for SEC_LINK_DUPLICATES means that the linker -. should warn if any duplicate sections are a different size. *} -.#define SEC_LINK_DUPLICATES_SAME_SIZE 0x400000 -. -. {* This value for SEC_LINK_DUPLICATES means that the linker -. should warn if any duplicate sections contain different -. contents. *} -.#define SEC_LINK_DUPLICATES_SAME_CONTENTS 0x600000 -. -. {* This section was created by the linker as part of dynamic -. relocation or other arcane processing. It is skipped when -. going through the first-pass output, trusting that someone -. else up the line will take care of it later. *} -.#define SEC_LINKER_CREATED 0x800000 -. -. {* This section should not be subject to garbage collection. *} -.#define SEC_KEEP 0x1000000 -. -. {* This section contains "short" data, and should be placed -. "near" the GP. *} -.#define SEC_SMALL_DATA 0x2000000 +.#define SEC_COFF_SHARED_LIBRARY 0x10000000 . . {* This section contains data which may be shared with other -. executables or shared objects. *} -.#define SEC_SHARED 0x4000000 +. executables or shared objects. This is for COFF only. *} +.#define SEC_COFF_SHARED 0x20000000 . . {* When a section with this flag is being linked, then if the size of . the input section is less than a page, it should not cross a page -. boundary. If the size of the input section is one page or more, it -. should be aligned on a page boundary. *} -.#define SEC_BLOCK 0x8000000 +. boundary. If the size of the input section is one page or more, +. it should be aligned on a page boundary. This is for TI +. TMS320C54X only. *} +.#define SEC_TIC54X_BLOCK 0x40000000 . . {* Conditionally link this section; do not link if there are no -. references found to any symbol in the section. *} -.#define SEC_CLINK 0x10000000 -. -. {* Attempt to merge identical entities in the section. -. Entity size is given in the entsize field. *} -.#define SEC_MERGE 0x20000000 -. -. {* If given with SEC_MERGE, entities to merge are zero terminated -. strings where entsize specifies character size instead of fixed -. size entries. *} -.#define SEC_STRINGS 0x40000000 -. -. {* This section contains data about section groups. *} -.#define SEC_GROUP 0x80000000 +. references found to any symbol in the section. This is for TI +. TMS320C54X only. *} +.#define SEC_TIC54X_CLINK 0x80000000 . . {* End of section flags. *} . @@ -364,9 +347,6 @@ CODE_FRAGMENT . {* See the vma field. *} . unsigned int user_set_vma : 1; . -. {* Whether relocations have been processed. *} -. unsigned int reloc_done : 1; -. . {* A mark flag used by some of the linker backends. *} . unsigned int linker_mark : 1; . @@ -374,8 +354,9 @@ CODE_FRAGMENT . output sections that have an input section. *} . unsigned int linker_has_input : 1; . -. {* A mark flag used by some linker backends for garbage collection. *} +. {* Mark flags used by some linker backends for garbage collection. *} . unsigned int gc_mark : 1; +. unsigned int gc_mark_from_eh : 1; . . {* The following flags are used by the ELF linker. *} . @@ -393,22 +374,20 @@ CODE_FRAGMENT . {* Nonzero if this section uses RELA relocations, rather than REL. *} . unsigned int use_rela_p:1; . -. {* Bits used by various backends. *} -. unsigned int has_tls_reloc:1; +. {* Bits used by various backends. The generic code doesn't touch +. these fields. *} . -. {* Nonzero if this section needs the relax finalize pass. *} -. unsigned int need_finalize_relax:1; +. {* Nonzero if this section has TLS related relocations. *} +. unsigned int has_tls_reloc:1; . . {* Nonzero if this section has a gp reloc. *} . unsigned int has_gp_reloc:1; . -. {* Unused bits. *} -. unsigned int flag13:1; -. unsigned int flag14:1; -. unsigned int flag15:1; -. unsigned int flag16:4; -. unsigned int flag20:4; -. unsigned int flag24:8; +. {* Nonzero if this section needs the relax finalize pass. *} +. unsigned int need_finalize_relax:1; +. +. {* Whether relocations have been processed. *} +. unsigned int reloc_done : 1; . . {* End of internal packed boolean fields. *} . @@ -427,13 +406,18 @@ CODE_FRAGMENT . . {* The size of the section in octets, as it will be output. . Contains a value even if the section has no contents (e.g., the -. size of <<.bss>>). This will be filled in after relocation. *} -. bfd_size_type _cooked_size; +. size of <<.bss>>). *} +. bfd_size_type size; . -. {* The original size on disk of the section, in octets. Normally this -. value is the same as the size, but if some relaxing has -. been done, then this value will be bigger. *} -. bfd_size_type _raw_size; +. {* For input sections, the original size on disk of the section, in +. octets. This field is used by the linker relaxation code. It is +. currently only set for sections where the linker relaxation scheme +. doesn't cache altered section and reloc contents (stabs, eh_frame, +. SEC_MERGE, some coff relaxing targets), and thus the original size +. needs to be kept to read the section multiple times. +. For output sections, rawsize holds the section size calculated on +. a previous linker relaxation pass. *} +. bfd_size_type rawsize; . . {* If this section is going to be output, then this value is the . offset in *bytes* into the output section of the first byte in the @@ -490,9 +474,6 @@ CODE_FRAGMENT . {* Entity size for merging purposes. *} . unsigned int entsize; . -. {* Optional information about a COMDAT entry; NULL if not COMDAT. *} -. struct bfd_comdat_info *comdat; -. . {* Points to the kept section if this section is a link-once section, . and is discarded. *} . struct bfd_section *kept_section; @@ -517,8 +498,14 @@ CODE_FRAGMENT . struct bfd_symbol *symbol; . struct bfd_symbol **symbol_ptr_ptr; . -. struct bfd_link_order *link_order_head; -. struct bfd_link_order *link_order_tail; +. {* Early in the link process, map_head and map_tail are used to build +. a list of input sections attached to an output section. Later, +. output sections use these fields for a list of bfd_link_order +. structs. *} +. union { +. struct bfd_link_order *link_order; +. struct bfd_section *s; +. } map_head, map_tail; .} asection; . .{* These sections are global, and are managed by BFD. The application @@ -557,36 +544,137 @@ CODE_FRAGMENT .extern const struct bfd_symbol * const bfd_com_symbol; .extern const struct bfd_symbol * const bfd_und_symbol; .extern const struct bfd_symbol * const bfd_ind_symbol; -.#define bfd_get_section_size_before_reloc(section) \ -. ((section)->_raw_size) -.#define bfd_get_section_size_after_reloc(section) \ -. ((section)->reloc_done ? (section)->_cooked_size \ -. : (abort (), (bfd_size_type) 1)) . .{* Macros to handle insertion and deletion of a bfd's sections. These . only handle the list pointers, ie. do not adjust section_count, . target_index etc. *} -.#define bfd_section_list_remove(ABFD, PS) \ +.#define bfd_section_list_remove(ABFD, S) \ . do \ . { \ -. asection **_ps = PS; \ -. asection *_s = *_ps; \ -. *_ps = _s->next; \ -. if (_s->next == NULL) \ -. (ABFD)->section_tail = _ps; \ -. } \ -. while (0) -.#define bfd_section_list_insert(ABFD, PS, S) \ -. do \ -. { \ -. asection **_ps = PS; \ . asection *_s = S; \ -. _s->next = *_ps; \ -. *_ps = _s; \ -. if (_s->next == NULL) \ -. (ABFD)->section_tail = &_s->next; \ +. asection *_next = _s->next; \ +. asection *_prev = _s->prev; \ +. if (_prev) \ +. _prev->next = _next; \ +. else \ +. (ABFD)->sections = _next; \ +. if (_next) \ +. _next->prev = _prev; \ +. else \ +. (ABFD)->section_last = _prev; \ . } \ . while (0) +.#define bfd_section_list_append(ABFD, S) \ +. do \ +. { \ +. asection *_s = S; \ +. bfd *_abfd = ABFD; \ +. _s->next = NULL; \ +. if (_abfd->section_last) \ +. { \ +. _s->prev = _abfd->section_last; \ +. _abfd->section_last->next = _s; \ +. } \ +. else \ +. { \ +. _s->prev = NULL; \ +. _abfd->sections = _s; \ +. } \ +. _abfd->section_last = _s; \ +. } \ +. while (0) +.#define bfd_section_list_prepend(ABFD, S) \ +. do \ +. { \ +. asection *_s = S; \ +. bfd *_abfd = ABFD; \ +. _s->prev = NULL; \ +. if (_abfd->sections) \ +. { \ +. _s->next = _abfd->sections; \ +. _abfd->sections->prev = _s; \ +. } \ +. else \ +. { \ +. _s->next = NULL; \ +. _abfd->section_last = _s; \ +. } \ +. _abfd->sections = _s; \ +. } \ +. while (0) +.#define bfd_section_list_insert_after(ABFD, A, S) \ +. do \ +. { \ +. asection *_a = A; \ +. asection *_s = S; \ +. asection *_next = _a->next; \ +. _s->next = _next; \ +. _s->prev = _a; \ +. _a->next = _s; \ +. if (_next) \ +. _next->prev = _s; \ +. else \ +. (ABFD)->section_last = _s; \ +. } \ +. while (0) +.#define bfd_section_list_insert_before(ABFD, B, S) \ +. do \ +. { \ +. asection *_b = B; \ +. asection *_s = S; \ +. asection *_prev = _b->prev; \ +. _s->prev = _prev; \ +. _s->next = _b; \ +. _b->prev = _s; \ +. if (_prev) \ +. _prev->next = _s; \ +. else \ +. (ABFD)->sections = _s; \ +. } \ +. while (0) +.#define bfd_section_removed_from_list(ABFD, S) \ +. ((S)->next == NULL ? (ABFD)->section_last != (S) : (S)->next->prev != (S)) +. +.#define BFD_FAKE_SECTION(SEC, FLAGS, SYM, SYM_PTR, NAME, IDX) \ +. {* name, id, index, next, prev, flags, user_set_vma, *} \ +. { NAME, IDX, 0, NULL, NULL, FLAGS, 0, \ +. \ +. {* linker_mark, linker_has_input, gc_mark, gc_mark_from_eh, *} \ +. 0, 0, 1, 0, \ +. \ +. {* segment_mark, sec_info_type, use_rela_p, has_tls_reloc, *} \ +. 0, 0, 0, 0, \ +. \ +. {* has_gp_reloc, need_finalize_relax, reloc_done, *} \ +. 0, 0, 0, \ +. \ +. {* vma, lma, size, rawsize *} \ +. 0, 0, 0, 0, \ +. \ +. {* output_offset, output_section, alignment_power, *} \ +. 0, (struct bfd_section *) &SEC, 0, \ +. \ +. {* relocation, orelocation, reloc_count, filepos, rel_filepos, *} \ +. NULL, NULL, 0, 0, 0, \ +. \ +. {* line_filepos, userdata, contents, lineno, lineno_count, *} \ +. 0, NULL, NULL, NULL, 0, \ +. \ +. {* entsize, kept_section, moving_line_filepos, *} \ +. 0, NULL, 0, \ +. \ +. {* target_index, used_by_bfd, constructor_chain, owner, *} \ +. 0, NULL, NULL, NULL, \ +. \ +. {* symbol, *} \ +. (struct bfd_symbol *) SYM, \ +. \ +. {* symbol_ptr_ptr, *} \ +. (struct bfd_symbol **) SYM_PTR, \ +. \ +. {* map_head, map_tail *} \ +. { NULL }, { NULL } \ +. } . */ @@ -615,49 +703,8 @@ static const asymbol global_syms[] = #define STD_SECTION(SEC, FLAGS, SYM, NAME, IDX) \ const asymbol * const SYM = (asymbol *) &global_syms[IDX]; \ - asection SEC = \ - /* name, id, index, next, flags, user_set_vma, reloc_done, */ \ - { NAME, IDX, 0, NULL, FLAGS, 0, 0, \ - \ - /* linker_mark, linker_has_input, gc_mark, segment_mark, */ \ - 0, 0, 1, 0, \ - \ - /* sec_info_type, use_rela_p, has_tls_reloc, */ \ - 0, 0, 0, \ - \ - /* need_finalize_relax, has_gp_reloc, */ \ - 0, 0, \ - \ - /* flag13, flag14, flag15, flag16, flag20, flag24, */ \ - 0, 0, 0, 0, 0, 0, \ - \ - /* vma, lma, _cooked_size, _raw_size, */ \ - 0, 0, 0, 0, \ - \ - /* output_offset, output_section, alignment_power, */ \ - 0, (struct bfd_section *) &SEC, 0, \ - \ - /* relocation, orelocation, reloc_count, filepos, rel_filepos, */ \ - NULL, NULL, 0, 0, 0, \ - \ - /* line_filepos, userdata, contents, lineno, lineno_count, */ \ - 0, NULL, NULL, NULL, 0, \ - \ - /* entsize, comdat, kept_section, moving_line_filepos, */ \ - 0, NULL, NULL, 0, \ - \ - /* target_index, used_by_bfd, constructor_chain, owner, */ \ - 0, NULL, NULL, NULL, \ - \ - /* symbol, */ \ - (struct bfd_symbol *) &global_syms[IDX], \ - \ - /* symbol_ptr_ptr, */ \ - (struct bfd_symbol **) &SYM, \ - \ - /* link_order_head, link_order_tail */ \ - NULL, NULL \ - } + asection SEC = BFD_FAKE_SECTION(SEC, FLAGS, &global_syms[IDX], &SYM, \ + NAME, IDX) STD_SECTION (bfd_com_section, SEC_IS_COMMON, bfd_com_symbol, BFD_COM_SECTION_NAME, 0); @@ -666,12 +713,6 @@ STD_SECTION (bfd_abs_section, 0, bfd_abs_symbol, BFD_ABS_SECTION_NAME, 2); STD_SECTION (bfd_ind_section, 0, bfd_ind_symbol, BFD_IND_SECTION_NAME, 3); #undef STD_SECTION -struct section_hash_entry -{ - struct bfd_hash_entry root; - asection section; -}; - /* Initialize an entry in the section hash table. */ struct bfd_hash_entry * @@ -732,8 +773,7 @@ bfd_section_init (bfd *abfd, asection *newsect) section_id++; abfd->section_count++; - *abfd->section_tail = newsect; - abfd->section_tail = &newsect->next; + bfd_section_list_append (abfd, newsect); return newsect; } @@ -763,7 +803,7 @@ void bfd_section_list_clear (bfd *abfd) { abfd->sections = NULL; - abfd->section_tail = &abfd->sections; + abfd->section_last = NULL; abfd->section_count = 0; memset (abfd->section_htab.table, 0, abfd->section_htab.size * sizeof (struct bfd_hash_entry *)); @@ -799,6 +839,57 @@ bfd_get_section_by_name (bfd *abfd, const char *name) return NULL; } +/* +FUNCTION + bfd_get_section_by_name_if + +SYNOPSIS + asection *bfd_get_section_by_name_if + (bfd *abfd, + const char *name, + bfd_boolean (*func) (bfd *abfd, asection *sect, void *obj), + void *obj); + +DESCRIPTION + Call the provided function @var{func} for each section + attached to the BFD @var{abfd} whose name matches @var{name}, + passing @var{obj} as an argument. The function will be called + as if by + +| func (abfd, the_section, obj); + + It returns the first section for which @var{func} returns true, + otherwise <>. + +*/ + +asection * +bfd_get_section_by_name_if (bfd *abfd, const char *name, + bfd_boolean (*operation) (bfd *, + asection *, + void *), + void *user_storage) +{ + struct section_hash_entry *sh; + unsigned long hash; + + sh = section_hash_lookup (&abfd->section_htab, name, FALSE, FALSE); + if (sh == NULL) + return NULL; + + hash = sh->root.hash; + do + { + if ((*operation) (abfd, &sh->section, user_storage)) + return &sh->section; + sh = (struct section_hash_entry *) sh->root.next; + } + while (sh != NULL && sh->root.hash == hash + && strcmp (sh->root.string, name) == 0); + + return NULL; +} + /* FUNCTION bfd_get_unique_section_name @@ -909,6 +1000,65 @@ bfd_make_section_old_way (bfd *abfd, const char *name) return bfd_section_init (abfd, newsect); } +/* +FUNCTION + bfd_make_section_anyway_with_flags + +SYNOPSIS + asection *bfd_make_section_anyway_with_flags + (bfd *abfd, const char *name, flagword flags); + +DESCRIPTION + Create a new empty section called @var{name} and attach it to the end of + the chain of sections for @var{abfd}. Create a new section even if there + is already a section with that name. Also set the attributes of the + new section to the value @var{flags}. + + Return <> and set <> on error; possible errors are: + o <> - If output has already started for @var{abfd}. + o <> - If memory allocation fails. +*/ + +sec_ptr +bfd_make_section_anyway_with_flags (bfd *abfd, const char *name, + flagword flags) +{ + struct section_hash_entry *sh; + asection *newsect; + + if (abfd->output_has_begun) + { + bfd_set_error (bfd_error_invalid_operation); + return NULL; + } + + sh = section_hash_lookup (&abfd->section_htab, name, TRUE, FALSE); + if (sh == NULL) + return NULL; + + newsect = &sh->section; + if (newsect->name != NULL) + { + /* We are making a section of the same name. Put it in the + section hash table. Even though we can't find it directly by a + hash lookup, we'll be able to find the section by traversing + sh->root.next quicker than looking at all the bfd sections. */ + struct section_hash_entry *new_sh; + new_sh = (struct section_hash_entry *) + bfd_section_hash_newfunc (NULL, &abfd->section_htab, name); + if (new_sh == NULL) + return NULL; + + new_sh->root = sh->root; + sh->root.next = &new_sh->root; + newsect = &new_sh->section; + } + + newsect->flags = flags; + newsect->name = name; + return bfd_section_init (abfd, newsect); +} + /* FUNCTION bfd_make_section_anyway @@ -929,51 +1079,28 @@ DESCRIPTION sec_ptr bfd_make_section_anyway (bfd *abfd, const char *name) { - struct section_hash_entry *sh; - asection *newsect; - - if (abfd->output_has_begun) - { - bfd_set_error (bfd_error_invalid_operation); - return NULL; - } - - sh = section_hash_lookup (&abfd->section_htab, name, TRUE, FALSE); - if (sh == NULL) - return NULL; - - newsect = &sh->section; - if (newsect->name != NULL) - { - /* We are making a section of the same name. It can't go in - section_htab without generating a unique section name and - that would be pointless; We don't need to traverse the - hash table. */ - newsect = bfd_zalloc (abfd, sizeof (asection)); - if (newsect == NULL) - return NULL; - } - - newsect->name = name; - return bfd_section_init (abfd, newsect); + return bfd_make_section_anyway_with_flags (abfd, name, 0); } /* FUNCTION - bfd_make_section + bfd_make_section_with_flags SYNOPSIS - asection *bfd_make_section (bfd *, const char *name); + asection *bfd_make_section_with_flags + (bfd *, const char *name, flagword flags); DESCRIPTION Like <>, but return <> (without calling bfd_set_error ()) without changing the section chain if there is already a - section named @var{name}. If there is an error, return <> and set + section named @var{name}. Also set the attributes of the new section to + the value @var{flags}. If there is an error, return <> and set <>. */ asection * -bfd_make_section (bfd *abfd, const char *name) +bfd_make_section_with_flags (bfd *abfd, const char *name, + flagword flags) { struct section_hash_entry *sh; asection *newsect; @@ -1002,9 +1129,30 @@ bfd_make_section (bfd *abfd, const char *name) } newsect->name = name; + newsect->flags = flags; return bfd_section_init (abfd, newsect); } +/* +FUNCTION + bfd_make_section + +SYNOPSIS + asection *bfd_make_section (bfd *, const char *name); + +DESCRIPTION + Like <>, but return <> (without calling + bfd_set_error ()) without changing the section chain if there is already a + section named @var{name}. If there is an error, return <> and set + <>. +*/ + +asection * +bfd_make_section (bfd *abfd, const char *name) +{ + return bfd_make_section_with_flags (abfd, name, 0); +} + /* FUNCTION bfd_set_section_flags @@ -1030,19 +1178,6 @@ bfd_set_section_flags (bfd *abfd ATTRIBUTE_UNUSED, sec_ptr section, flagword flags) { -#if 0 - /* If you try to copy a text section from an input file (where it - has the SEC_CODE flag set) to an output file, this loses big if - the bfd_applicable_section_flags (abfd) doesn't have the SEC_CODE - set - which it doesn't, at least not for a.out. FIXME */ - - if ((flags & bfd_applicable_section_flags (abfd)) != flags) - { - bfd_set_error (bfd_error_invalid_operation); - return FALSE; - } -#endif - section->flags = flags; return TRUE; } @@ -1088,6 +1223,41 @@ bfd_map_over_sections (bfd *abfd, abort (); } +/* +FUNCTION + bfd_sections_find_if + +SYNOPSIS + asection *bfd_sections_find_if + (bfd *abfd, + bfd_boolean (*operation) (bfd *abfd, asection *sect, void *obj), + void *obj); + +DESCRIPTION + Call the provided function @var{operation} for each section + attached to the BFD @var{abfd}, passing @var{obj} as an + argument. The function will be called as if by + +| operation (abfd, the_section, obj); + + It returns the first section for which @var{operation} returns true. + +*/ + +asection * +bfd_sections_find_if (bfd *abfd, + bfd_boolean (*operation) (bfd *, asection *, void *), + void *user_storage) +{ + asection *sect; + + for (sect = abfd->sections; sect != NULL; sect = sect->next) + if ((*operation) (abfd, sect, user_storage)) + break; + + return sect; +} + /* FUNCTION bfd_set_section_size @@ -1118,9 +1288,7 @@ bfd_set_section_size (bfd *abfd, sec_ptr ptr, bfd_size_type val) return FALSE; } - ptr->_cooked_size = val; - ptr->_raw_size = val; - + ptr->size = val; return TRUE; } @@ -1151,11 +1319,6 @@ DESCRIPTION */ -#define bfd_get_section_size_now(abfd, sec) \ - (sec->reloc_done \ - ? bfd_get_section_size_after_reloc (sec) \ - : bfd_get_section_size_before_reloc (sec)) - bfd_boolean bfd_set_section_contents (bfd *abfd, sec_ptr section, @@ -1171,7 +1334,7 @@ bfd_set_section_contents (bfd *abfd, return FALSE; } - sz = bfd_get_section_size_now (abfd, section); + sz = section->size; if ((bfd_size_type) offset > sz || count > sz || offset + count > sz @@ -1181,22 +1344,10 @@ bfd_set_section_contents (bfd *abfd, return FALSE; } - switch (abfd->direction) + if (!bfd_write_p (abfd)) { - case read_direction: - case no_direction: bfd_set_error (bfd_error_invalid_operation); return FALSE; - - case write_direction: - break; - - case both_direction: - /* File is opened for update. `output_has_begun' some time ago when - the file was created. Do not recompute sections sizes or alignments - in _bfd_set_section_content. */ - abfd->output_has_begun = TRUE; - break; } /* Record a copy of the data in memory if desired. */ @@ -1251,9 +1402,7 @@ bfd_get_section_contents (bfd *abfd, return TRUE; } - /* Even if reloc_done is TRUE, this function reads unrelocated - contents, so we want the raw size. */ - sz = section->_raw_size; + sz = section->rawsize ? section->rawsize : section->size; if ((bfd_size_type) offset > sz || count > sz || offset + count > sz @@ -1283,6 +1432,36 @@ bfd_get_section_contents (bfd *abfd, (abfd, section, location, offset, count)); } +/* +FUNCTION + bfd_malloc_and_get_section + +SYNOPSIS + bfd_boolean bfd_malloc_and_get_section + (bfd *abfd, asection *section, bfd_byte **buf); + +DESCRIPTION + Read all data from @var{section} in BFD @var{abfd} + into a buffer, *@var{buf}, malloc'd by this function. +*/ + +bfd_boolean +bfd_malloc_and_get_section (bfd *abfd, sec_ptr sec, bfd_byte **buf) +{ + bfd_size_type sz = sec->rawsize ? sec->rawsize : sec->size; + bfd_byte *p = NULL; + + *buf = p; + if (sz == 0) + return TRUE; + + p = bfd_malloc (sec->rawsize > sec->size ? sec->rawsize : sec->size); + if (p == NULL) + return FALSE; + *buf = p; + + return bfd_get_section_contents (abfd, sec, p, 0, sz); +} /* FUNCTION bfd_copy_private_section_data @@ -1307,46 +1486,20 @@ DESCRIPTION /* FUNCTION - _bfd_strip_section_from_output + bfd_generic_is_group_section SYNOPSIS - void _bfd_strip_section_from_output - (struct bfd_link_info *info, asection *section); + bfd_boolean bfd_generic_is_group_section (bfd *, const asection *sec); DESCRIPTION - Remove @var{section} from the output. If the output section - becomes empty, remove it from the output bfd. - - This function won't actually do anything except twiddle flags - if called too late in the linking process, when it's not safe - to remove sections. + Returns TRUE if @var{sec} is a member of a group. */ -void -_bfd_strip_section_from_output (struct bfd_link_info *info, asection *s) + +bfd_boolean +bfd_generic_is_group_section (bfd *abfd ATTRIBUTE_UNUSED, + const asection *sec ATTRIBUTE_UNUSED) { - asection *os; - asection *is; - bfd *abfd; - - s->flags |= SEC_EXCLUDE; - - /* If the section wasn't assigned to an output section, or the - section has been discarded by the linker script, there's nothing - more to do. */ - os = s->output_section; - if (os == NULL || os->owner == NULL) - return; - - /* If the output section has other (non-excluded) input sections, we - can't remove it. */ - for (abfd = info->input_bfds; abfd != NULL; abfd = abfd->link_next) - for (is = abfd->sections; is != NULL; is = is->next) - if (is->output_section == os && (is->flags & SEC_EXCLUDE) == 0) - return; - - /* If the output section is empty, flag it for removal too. - See ldlang.c:strip_excluded_output_sections for the action. */ - os->flags |= SEC_EXCLUDE; + return FALSE; } /* diff --git a/contrib/binutils/bfd/simple.c b/contrib/binutils/bfd/simple.c index fc2472eefd2..d06ce2a96e1 100644 --- a/contrib/binutils/bfd/simple.c +++ b/contrib/binutils/bfd/simple.c @@ -1,5 +1,5 @@ /* simple.c -- BFD simple client routines - Copyright 2002, 2003, 2004 + Copyright 2002, 2003, 2004, 2005 Free Software Foundation, Inc. Contributed by MontaVista Software, Inc. @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" @@ -48,6 +48,7 @@ simple_dummy_undefined_symbol (struct bfd_link_info *link_info ATTRIBUTE_UNUSED, static bfd_boolean simple_dummy_reloc_overflow (struct bfd_link_info *link_info ATTRIBUTE_UNUSED, + struct bfd_link_hash_entry *entry ATTRIBUTE_UNUSED, const char *name ATTRIBUTE_UNUSED, const char *reloc_name ATTRIBUTE_UNUSED, bfd_vma addend ATTRIBUTE_UNUSED, @@ -78,6 +79,24 @@ simple_dummy_unattached_reloc (struct bfd_link_info *link_info ATTRIBUTE_UNUSED, return TRUE; } +static bfd_boolean +simple_dummy_multiple_definition (struct bfd_link_info *link_info ATTRIBUTE_UNUSED, + const char *name ATTRIBUTE_UNUSED, + bfd *obfd ATTRIBUTE_UNUSED, + asection *osec ATTRIBUTE_UNUSED, + bfd_vma oval ATTRIBUTE_UNUSED, + bfd *nbfd ATTRIBUTE_UNUSED, + asection *nsec ATTRIBUTE_UNUSED, + bfd_vma nval ATTRIBUTE_UNUSED) +{ + return TRUE; +} + +static void +simple_dummy_einfo (const char *fmt ATTRIBUTE_UNUSED, ...) +{ +} + struct saved_output_info { bfd_vma offset; @@ -92,8 +111,12 @@ simple_save_output_info (bfd *abfd ATTRIBUTE_UNUSED, struct saved_output_info *output_info = ptr; output_info[section->index].offset = section->output_offset; output_info[section->index].section = section->output_section; - section->output_offset = 0; - section->output_section = section; + if ((section->flags & SEC_DEBUGGING) != 0 + || section->output_section == NULL) + { + section->output_offset = 0; + section->output_section = section; + } } static void @@ -117,13 +140,10 @@ SYNOPSIS DESCRIPTION Returns the relocated contents of section @var{sec}. The symbols in @var{symbol_table} will be used, or the symbols from @var{abfd} if - @var{symbol_table} is NULL. The output offsets for all sections will + @var{symbol_table} is NULL. The output offsets for debug sections will be temporarily reset to 0. The result will be stored at @var{outbuf} or allocated with @code{bfd_malloc} if @var{outbuf} is @code{NULL}. - Generally all sections in @var{abfd} should have their - @code{output_section} pointing back to the original section. - Returns @code{NULL} on a fatal error; ignores errors applying particular relocations. */ @@ -140,14 +160,14 @@ bfd_simple_get_relocated_section_contents (bfd *abfd, bfd_byte *contents, *data; int storage_needed; void *saved_offsets; - bfd_size_type old_cooked_size; if (! (sec->flags & SEC_RELOC)) { - bfd_size_type size = bfd_section_size (abfd, sec); + bfd_size_type amt = sec->rawsize > sec->size ? sec->rawsize : sec->size; + bfd_size_type size = sec->rawsize ? sec->rawsize : sec->size; if (outbuf == NULL) - contents = bfd_malloc (size); + contents = bfd_malloc (amt); else contents = outbuf; @@ -171,18 +191,20 @@ bfd_simple_get_relocated_section_contents (bfd *abfd, callbacks.reloc_overflow = simple_dummy_reloc_overflow; callbacks.reloc_dangerous = simple_dummy_reloc_dangerous; callbacks.unattached_reloc = simple_dummy_unattached_reloc; + callbacks.multiple_definition = simple_dummy_multiple_definition; + callbacks.einfo = simple_dummy_einfo; memset (&link_order, 0, sizeof (link_order)); link_order.next = NULL; link_order.type = bfd_indirect_link_order; link_order.offset = 0; - link_order.size = bfd_section_size (abfd, sec); + link_order.size = sec->size; link_order.u.indirect.section = sec; data = NULL; if (outbuf == NULL) { - data = bfd_malloc (bfd_section_size (abfd, sec)); + data = bfd_malloc (sec->size); if (data == NULL) return NULL; outbuf = data; @@ -218,12 +240,6 @@ bfd_simple_get_relocated_section_contents (bfd *abfd, else storage_needed = 0; - /* This function might be called before _cooked_size has been set, and - bfd_perform_relocation needs _cooked_size to be valid. */ - old_cooked_size = sec->_cooked_size; - if (old_cooked_size == 0) - sec->_cooked_size = sec->_raw_size; - contents = bfd_get_relocated_section_contents (abfd, &link_info, &link_order, @@ -233,25 +249,9 @@ bfd_simple_get_relocated_section_contents (bfd *abfd, if (contents == NULL && data != NULL) free (data); -#if 0 - /* NOTE: cagney/2003-04-05: This free, which was introduced on - 2003-03-31 to stop a memory leak, caused a memory corruption - between GDB and BFD. The problem, which is stabs specific, can - be identified by a bunch of failures in relocate.exp vis: - - gdb.base/relocate.exp: get address of static_bar - - Details of the problem can be found on the binutils@ mailing - list, see the discussion thread: "gdb.mi/mi-cli.exp failures". */ - if (storage_needed != 0) - free (symbol_table); -#endif - - sec->_cooked_size = old_cooked_size; bfd_map_over_sections (abfd, simple_restore_output_info, saved_offsets); free (saved_offsets); _bfd_generic_link_hash_table_free (link_info.hash); - return contents; } diff --git a/contrib/binutils/bfd/sparclinux.c b/contrib/binutils/bfd/sparclinux.c index ecaaa0f9bf3..d8659eec16b 100644 --- a/contrib/binutils/bfd/sparclinux.c +++ b/contrib/binutils/bfd/sparclinux.c @@ -1,6 +1,6 @@ /* BFD back-end for linux flavored sparc a.out binaries. - Copyright 1992, 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2002, 2003 - Free Software Foundation, Inc. + Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002, + 2003, 2004, 2006 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -16,7 +16,7 @@ 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, +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #define TARGET_PAGE_SIZE 4096 @@ -232,8 +232,9 @@ linux_link_hash_table_create (abfd) ret = (struct linux_link_hash_table *) bfd_malloc (amt); if (ret == (struct linux_link_hash_table *) NULL) return (struct bfd_link_hash_table *) NULL; - if (! NAME(aout,link_hash_table_init) (&ret->root, abfd, - linux_link_hash_newfunc)) + if (!NAME(aout,link_hash_table_init) (&ret->root, abfd, + linux_link_hash_newfunc, + sizeof (struct linux_link_hash_entry))) { free (ret); return (struct bfd_link_hash_table *) NULL; @@ -317,7 +318,7 @@ linux_link_create_dynamic_sections (abfd, info) || ! bfd_set_section_flags (abfd, s, flags) || ! bfd_set_section_alignment (abfd, s, 2)) return FALSE; - s->_raw_size = 0; + s->size = 0; s->contents = 0; return TRUE; @@ -596,9 +597,9 @@ bfd_sparclinux_size_dynamic_sections (output_bfd, info) ".linux-dynamic"); if (s != NULL) { - s->_raw_size = linux_hash_table (info)->fixup_count + 1; - s->_raw_size *= 8; - s->contents = (bfd_byte *) bfd_zalloc (output_bfd, s->_raw_size); + s->size = linux_hash_table (info)->fixup_count + 1; + s->size *= 8; + s->contents = (bfd_byte *) bfd_zalloc (output_bfd, s->size); if (s->contents == NULL) return FALSE; } @@ -763,7 +764,7 @@ linux_finish_dynamic_link (output_bfd, info) SEEK_SET) != 0) return FALSE; - if (bfd_bwrite ((PTR) s->contents, s->_raw_size, output_bfd) != s->_raw_size) + if (bfd_bwrite ((PTR) s->contents, s->size, output_bfd) != s->size) return FALSE; return TRUE; diff --git a/contrib/binutils/bfd/sparcnetbsd.c b/contrib/binutils/bfd/sparcnetbsd.c index be8e5363490..ac000181bf8 100644 --- a/contrib/binutils/bfd/sparcnetbsd.c +++ b/contrib/binutils/bfd/sparcnetbsd.c @@ -16,7 +16,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #define TARGET_IS_BIG_ENDIAN_P diff --git a/contrib/binutils/bfd/srec.c b/contrib/binutils/bfd/srec.c index c0a3d585b43..2b24f46ffb6 100644 --- a/contrib/binutils/bfd/srec.c +++ b/contrib/binutils/bfd/srec.c @@ -1,30 +1,29 @@ /* BFD back-end for s-record objects. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003 + 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support . -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -/* -SUBSECTION +/* SUBSECTION S-Record handling -DESCRIPTION + DESCRIPTION Ordinary S-Records cannot hold anything but addresses and data, so that's all that we implement. @@ -44,10 +43,10 @@ DESCRIPTION An s record looks like: -EXAMPLE + EXAMPLE S
-DESCRIPTION + DESCRIPTION Where o length is the number of bytes following upto the checksum. Note that @@ -72,10 +71,10 @@ DESCRIPTION is the sum of all the raw byte data in the record, from the length upwards, modulo 256 and subtracted from 255. -SUBSECTION + SUBSECTION Symbol S-Record handling -DESCRIPTION + DESCRIPTION Some ICE equipment understands an addition to the standard S-Record format; symbols and their addresses can be sent before the data. @@ -87,7 +86,7 @@ DESCRIPTION so a short symbol table could look like: -EXAMPLE + EXAMPLE $$ flash.x $$ flash.c _port6 $0 @@ -98,11 +97,9 @@ EXAMPLE _end $8036 $$ -DESCRIPTION + DESCRIPTION We allow symbols to be anywhere in the data stream - the module names - are always ignored. - -*/ + are always ignored. */ #include "bfd.h" #include "sysdep.h" @@ -110,61 +107,18 @@ DESCRIPTION #include "libiberty.h" #include "safe-ctype.h" -static void srec_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *)); -static void srec_print_symbol - PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type)); -static void srec_init PARAMS ((void)); -static bfd_boolean srec_mkobject PARAMS ((bfd *)); -static int srec_get_byte PARAMS ((bfd *, bfd_boolean *)); -static void srec_bad_byte PARAMS ((bfd *, unsigned int, int, bfd_boolean)); -static bfd_boolean srec_scan PARAMS ((bfd *)); -static const bfd_target *srec_object_p PARAMS ((bfd *)); -static const bfd_target *symbolsrec_object_p PARAMS ((bfd *)); -static bfd_boolean srec_read_section PARAMS ((bfd *, asection *, bfd_byte *)); - -static bfd_boolean srec_write_record - PARAMS ((bfd *, unsigned int, bfd_vma, const bfd_byte *, const bfd_byte *)); -static bfd_boolean srec_write_header PARAMS ((bfd *)); -static bfd_boolean srec_write_symbols PARAMS ((bfd *)); -static bfd_boolean srec_new_symbol PARAMS ((bfd *, const char *, bfd_vma)); -static bfd_boolean srec_get_section_contents - PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); -static bfd_boolean srec_set_arch_mach - PARAMS ((bfd *, enum bfd_architecture, unsigned long)); -static bfd_boolean srec_set_section_contents - PARAMS ((bfd *, sec_ptr, const PTR, file_ptr, bfd_size_type)); -static bfd_boolean internal_srec_write_object_contents PARAMS ((bfd *, int)); -static bfd_boolean srec_write_object_contents PARAMS ((bfd *)); -static bfd_boolean symbolsrec_write_object_contents PARAMS ((bfd *)); -static int srec_sizeof_headers PARAMS ((bfd *, bfd_boolean)); -static long srec_get_symtab_upper_bound PARAMS ((bfd *)); -static long srec_canonicalize_symtab PARAMS ((bfd *, asymbol **)); /* Macros for converting between hex and binary. */ static const char digs[] = "0123456789ABCDEF"; -#define NIBBLE(x) hex_value(x) -#define HEX(buffer) ((NIBBLE((buffer)[0])<<4) + NIBBLE((buffer)[1])) +#define NIBBLE(x) hex_value(x) +#define HEX(buffer) ((NIBBLE ((buffer)[0])<<4) + NIBBLE ((buffer)[1])) #define TOHEX(d, x, ch) \ d[1] = digs[(x) & 0xf]; \ d[0] = digs[((x)>>4)&0xf]; \ ch += ((x) & 0xff); -#define ISHEX(x) hex_p(x) - -/* Initialize by filling in the hex conversion array. */ - -static void -srec_init () -{ - static bfd_boolean inited = FALSE; - - if (! inited) - { - inited = TRUE; - hex_init (); - } -} +#define ISHEX(x) hex_p(x) /* The maximum number of address+data+crc bytes on a line is FF. */ #define MAXCHUNK 0xff @@ -219,24 +173,30 @@ typedef struct srec_data_struct } tdata_type; -static bfd_boolean srec_write_section - PARAMS ((bfd *, tdata_type *, srec_data_list_type *)); -static bfd_boolean srec_write_terminator - PARAMS ((bfd *, tdata_type *)); +/* Initialize by filling in the hex conversion array. */ + +static void +srec_init (void) +{ + static bfd_boolean inited = FALSE; + + if (! inited) + { + inited = TRUE; + hex_init (); + } +} /* Set up the S-record tdata information. */ static bfd_boolean -srec_mkobject (abfd) - bfd *abfd; +srec_mkobject (bfd *abfd) { - bfd_size_type amt; tdata_type *tdata; srec_init (); - amt = sizeof (tdata_type); - tdata = (tdata_type *) bfd_alloc (abfd, amt); + tdata = bfd_alloc (abfd, sizeof (tdata_type)); if (tdata == NULL) return FALSE; @@ -255,9 +215,7 @@ srec_mkobject (abfd) occurred. Return EOF on error or end of file. */ static int -srec_get_byte (abfd, errorptr) - bfd *abfd; - bfd_boolean *errorptr; +srec_get_byte (bfd *abfd, bfd_boolean *errorptr) { bfd_byte c; @@ -276,11 +234,10 @@ srec_get_byte (abfd, errorptr) error messages. */ static void -srec_bad_byte (abfd, lineno, c, error) - bfd *abfd; - unsigned int lineno; - int c; - bfd_boolean error; +srec_bad_byte (bfd *abfd, + unsigned int lineno, + int c, + bfd_boolean error) { if (c == EOF) { @@ -299,8 +256,8 @@ srec_bad_byte (abfd, lineno, c, error) buf[1] = '\0'; } (*_bfd_error_handler) - (_("%s:%d: Unexpected character `%s' in S-record file\n"), - bfd_archive_filename (abfd), lineno, buf); + (_("%B:%d: Unexpected character `%s' in S-record file\n"), + abfd, lineno, buf); bfd_set_error (bfd_error_bad_value); } } @@ -308,15 +265,11 @@ srec_bad_byte (abfd, lineno, c, error) /* Add a new symbol found in an S-record file. */ static bfd_boolean -srec_new_symbol (abfd, name, val) - bfd *abfd; - const char *name; - bfd_vma val; +srec_new_symbol (bfd *abfd, const char *name, bfd_vma val) { struct srec_symbol *n; - bfd_size_type amt = sizeof (struct srec_symbol); - n = (struct srec_symbol *) bfd_alloc (abfd, amt); + n = bfd_alloc (abfd, sizeof (* n)); if (n == NULL) return FALSE; @@ -339,8 +292,7 @@ srec_new_symbol (abfd, name, val) section for each contiguous set of bytes. */ static bfd_boolean -srec_scan (abfd) - bfd *abfd; +srec_scan (bfd *abfd) { int c; unsigned int lineno = 1; @@ -385,7 +337,6 @@ srec_scan (abfd) } ++lineno; - break; case ' ': @@ -410,7 +361,7 @@ srec_scan (abfd) } alc = 10; - symbuf = (char *) bfd_malloc (alc + 1); + symbuf = bfd_malloc (alc + 1); if (symbuf == NULL) goto error_return; @@ -425,7 +376,7 @@ srec_scan (abfd) char *n; alc *= 2; - n = (char *) bfd_realloc (symbuf, alc + 1); + n = bfd_realloc (symbuf, alc + 1); if (n == NULL) goto error_return; p = n + (p - symbuf); @@ -523,7 +474,7 @@ srec_scan (abfd) { if (buf != NULL) free (buf); - buf = (bfd_byte *) bfd_malloc ((bfd_size_type) bytes * 2); + buf = bfd_malloc ((bfd_size_type) bytes * 2); if (buf == NULL) goto error_return; bufsize = bytes * 2; @@ -564,11 +515,11 @@ srec_scan (abfd) bytes -= 2; if (sec != NULL - && sec->vma + sec->_raw_size == address) + && sec->vma + sec->size == address) { /* This data goes at the end of the section we are currently building. */ - sec->_raw_size += bytes; + sec->size += bytes; } else { @@ -578,7 +529,7 @@ srec_scan (abfd) sprintf (secbuf, ".sec%d", bfd_count_sections (abfd) + 1); amt = strlen (secbuf) + 1; - secname = (char *) bfd_alloc (abfd, amt); + secname = bfd_alloc (abfd, amt); strcpy (secname, secbuf); sec = bfd_make_section (abfd, secname); if (sec == NULL) @@ -586,10 +537,9 @@ srec_scan (abfd) sec->flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC; sec->vma = address; sec->lma = address; - sec->_raw_size = bytes; + sec->size = bytes; sec->filepos = pos; } - break; case '7': @@ -638,10 +588,9 @@ srec_scan (abfd) /* Check whether an existing file is an S-record file. */ static const bfd_target * -srec_object_p (abfd) - bfd *abfd; +srec_object_p (bfd *abfd) { - PTR tdata_save; + void * tdata_save; bfd_byte b[4]; srec_init (); @@ -674,10 +623,9 @@ srec_object_p (abfd) /* Check whether an existing file is an S-record file with symbols. */ static const bfd_target * -symbolsrec_object_p (abfd) - bfd *abfd; +symbolsrec_object_p (bfd *abfd) { - PTR tdata_save; + void * tdata_save; char b[2]; srec_init (); @@ -710,10 +658,7 @@ symbolsrec_object_p (abfd) /* Read in the contents of a section in an S-record file. */ static bfd_boolean -srec_read_section (abfd, section, contents) - bfd *abfd; - asection *section; - bfd_byte *contents; +srec_read_section (bfd *abfd, asection *section, bfd_byte *contents) { int c; bfd_size_type sofar = 0; @@ -749,7 +694,7 @@ srec_read_section (abfd, section, contents) { if (buf != NULL) free (buf); - buf = (bfd_byte *) bfd_malloc ((bfd_size_type) bytes * 2); + buf = bfd_malloc ((bfd_size_type) bytes * 2); if (buf == NULL) goto error_return; bufsize = bytes * 2; @@ -763,7 +708,7 @@ srec_read_section (abfd, section, contents) switch (hdr[0]) { default: - BFD_ASSERT (sofar == section->_raw_size); + BFD_ASSERT (sofar == section->size); if (buf != NULL) free (buf); return TRUE; @@ -788,7 +733,7 @@ srec_read_section (abfd, section, contents) if (address != section->vma + sofar) { /* We've come to the end of this section. */ - BFD_ASSERT (sofar == section->_raw_size); + BFD_ASSERT (sofar == section->size); if (buf != NULL) free (buf); return TRUE; @@ -811,7 +756,7 @@ srec_read_section (abfd, section, contents) if (error) goto error_return; - BFD_ASSERT (sofar == section->_raw_size); + BFD_ASSERT (sofar == section->size); if (buf != NULL) free (buf); @@ -827,17 +772,16 @@ srec_read_section (abfd, section, contents) /* Get the contents of a section in an S-record file. */ static bfd_boolean -srec_get_section_contents (abfd, section, location, offset, count) - bfd *abfd; - asection *section; - PTR location; - file_ptr offset; - bfd_size_type count; +srec_get_section_contents (bfd *abfd, + asection *section, + void * location, + file_ptr offset, + bfd_size_type count) { if (section->used_by_bfd == NULL) { - section->used_by_bfd = bfd_alloc (abfd, section->_raw_size); - if (section->used_by_bfd == NULL && section->_raw_size != 0) + section->used_by_bfd = bfd_alloc (abfd, section->size); + if (section->used_by_bfd == NULL && section->size != 0) return FALSE; if (! srec_read_section (abfd, section, section->used_by_bfd)) @@ -853,34 +797,28 @@ srec_get_section_contents (abfd, section, location, offset, count) /* Set the architecture. We accept an unknown architecture here. */ static bfd_boolean -srec_set_arch_mach (abfd, arch, mach) - bfd *abfd; - enum bfd_architecture arch; - unsigned long mach; +srec_set_arch_mach (bfd *abfd, enum bfd_architecture arch, unsigned long mach) { - if (arch == bfd_arch_unknown) - { - abfd->arch_info = &bfd_default_arch_struct; - return TRUE; - } - return bfd_default_set_arch_mach (abfd, arch, mach); + if (arch != bfd_arch_unknown) + return bfd_default_set_arch_mach (abfd, arch, mach); + + abfd->arch_info = & bfd_default_arch_struct; + return TRUE; } /* We have to save up all the Srecords for a splurge before output. */ static bfd_boolean -srec_set_section_contents (abfd, section, location, offset, bytes_to_do) - bfd *abfd; - sec_ptr section; - const PTR location; - file_ptr offset; - bfd_size_type bytes_to_do; +srec_set_section_contents (bfd *abfd, + sec_ptr section, + const void * location, + file_ptr offset, + bfd_size_type bytes_to_do) { tdata_type *tdata = abfd->tdata.srec_data; - register srec_data_list_type *entry; + srec_data_list_type *entry; - entry = ((srec_data_list_type *) - bfd_alloc (abfd, (bfd_size_type) sizeof (srec_data_list_type))); + entry = bfd_alloc (abfd, sizeof (* entry)); if (entry == NULL) return FALSE; @@ -890,10 +828,10 @@ srec_set_section_contents (abfd, section, location, offset, bytes_to_do) { bfd_byte *data; - data = (bfd_byte *) bfd_alloc (abfd, bytes_to_do); + data = bfd_alloc (abfd, bytes_to_do); if (data == NULL) return FALSE; - memcpy ((PTR) data, location, (size_t) bytes_to_do); + memcpy ((void *) data, location, (size_t) bytes_to_do); /* Ff S3Forced is TRUE then always select S3 records, regardless of the siez of the addresses. */ @@ -922,7 +860,7 @@ srec_set_section_contents (abfd, section, location, offset, bytes_to_do) } else { - register srec_data_list_type **look; + srec_data_list_type **look; for (look = &tdata->head; *look != NULL && (*look)->where < entry->where; @@ -942,12 +880,11 @@ srec_set_section_contents (abfd, section, location, offset, bytes_to_do) here. */ static bfd_boolean -srec_write_record (abfd, type, address, data, end) - bfd *abfd; - unsigned int type; - bfd_vma address; - const bfd_byte *data; - const bfd_byte *end; +srec_write_record (bfd *abfd, + unsigned int type, + bfd_vma address, + const bfd_byte *data, + const bfd_byte *end) { char buffer[2 * MAXCHUNK + 6]; unsigned int check_sum = 0; @@ -998,14 +935,12 @@ srec_write_record (abfd, type, address, data, end) *dst++ = '\r'; *dst++ = '\n'; wrlen = dst - buffer; - if (bfd_bwrite ((PTR) buffer, wrlen, abfd) != wrlen) - return FALSE; - return TRUE; + + return bfd_bwrite ((void *) buffer, wrlen, abfd) == wrlen; } static bfd_boolean -srec_write_header (abfd) - bfd *abfd; +srec_write_header (bfd *abfd) { unsigned int len = strlen (abfd->filename); @@ -1014,14 +949,14 @@ srec_write_header (abfd) len = 40; return srec_write_record (abfd, 0, (bfd_vma) 0, - abfd->filename, abfd->filename + len); + (bfd_byte *) abfd->filename, + (bfd_byte *) abfd->filename + len); } static bfd_boolean -srec_write_section (abfd, tdata, list) - bfd *abfd; - tdata_type *tdata; - srec_data_list_type *list; +srec_write_section (bfd *abfd, + tdata_type *tdata, + srec_data_list_type *list) { unsigned int octets_written = 0; bfd_byte *location = list->data; @@ -1062,17 +997,14 @@ srec_write_section (abfd, tdata, list) } static bfd_boolean -srec_write_terminator (abfd, tdata) - bfd *abfd; - tdata_type *tdata; +srec_write_terminator (bfd *abfd, tdata_type *tdata) { return srec_write_record (abfd, 10 - tdata->type, abfd->start_address, NULL, NULL); } static bfd_boolean -srec_write_symbols (abfd) - bfd *abfd; +srec_write_symbols (bfd *abfd) { /* Dump out the symbols of a bfd. */ int i; @@ -1082,6 +1014,7 @@ srec_write_symbols (abfd) { bfd_size_type len; asymbol **table = bfd_get_outsymbols (abfd); + len = strlen (abfd->filename); if (bfd_bwrite ("$$ ", (bfd_size_type) 3, abfd) != 3 || bfd_bwrite (abfd->filename, len, abfd) != len @@ -1126,9 +1059,7 @@ srec_write_symbols (abfd) } static bfd_boolean -internal_srec_write_object_contents (abfd, symbols) - bfd *abfd; - int symbols; +internal_srec_write_object_contents (bfd *abfd, int symbols) { tdata_type *tdata = abfd->tdata.srec_data; srec_data_list_type *list; @@ -1155,23 +1086,20 @@ internal_srec_write_object_contents (abfd, symbols) } static bfd_boolean -srec_write_object_contents (abfd) - bfd *abfd; +srec_write_object_contents (bfd *abfd) { return internal_srec_write_object_contents (abfd, 0); } static bfd_boolean -symbolsrec_write_object_contents (abfd) - bfd *abfd; +symbolsrec_write_object_contents (bfd *abfd) { return internal_srec_write_object_contents (abfd, 1); } static int -srec_sizeof_headers (abfd, exec) - bfd *abfd ATTRIBUTE_UNUSED; - bfd_boolean exec ATTRIBUTE_UNUSED; +srec_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, + bfd_boolean exec ATTRIBUTE_UNUSED) { return 0; } @@ -1179,8 +1107,7 @@ srec_sizeof_headers (abfd, exec) /* Return the amount of memory needed to read the symbol table. */ static long -srec_get_symtab_upper_bound (abfd) - bfd *abfd; +srec_get_symtab_upper_bound (bfd *abfd) { return (bfd_get_symcount (abfd) + 1) * sizeof (asymbol *); } @@ -1188,9 +1115,7 @@ srec_get_symtab_upper_bound (abfd) /* Return the symbol table. */ static long -srec_canonicalize_symtab (abfd, alocation) - bfd *abfd; - asymbol **alocation; +srec_canonicalize_symtab (bfd *abfd, asymbol **alocation) { bfd_size_type symcount = bfd_get_symcount (abfd); asymbol *csymbols; @@ -1202,7 +1127,7 @@ srec_canonicalize_symtab (abfd, alocation) asymbol *c; struct srec_symbol *s; - csymbols = (asymbol *) bfd_alloc (abfd, symcount * sizeof (asymbol)); + csymbols = bfd_alloc (abfd, symcount * sizeof (asymbol)); if (csymbols == NULL && symcount != 0) return 0; abfd->tdata.srec_data->csymbols = csymbols; @@ -1228,94 +1153,88 @@ srec_canonicalize_symtab (abfd, alocation) } static void -srec_get_symbol_info (ignore_abfd, symbol, ret) - bfd *ignore_abfd ATTRIBUTE_UNUSED; - asymbol *symbol; - symbol_info *ret; +srec_get_symbol_info (bfd *ignore_abfd ATTRIBUTE_UNUSED, + asymbol *symbol, + symbol_info *ret) { bfd_symbol_info (symbol, ret); } static void -srec_print_symbol (abfd, afile, symbol, how) - bfd *abfd; - PTR afile; - asymbol *symbol; - bfd_print_symbol_type how; +srec_print_symbol (bfd *abfd, + void * afile, + asymbol *symbol, + bfd_print_symbol_type how) { FILE *file = (FILE *) afile; + switch (how) { case bfd_print_symbol_name: fprintf (file, "%s", symbol->name); break; default: - bfd_print_symbol_vandf (abfd, (PTR) file, symbol); + bfd_print_symbol_vandf (abfd, (void *) file, symbol); fprintf (file, " %-5s %s", symbol->section->name, symbol->name); - } } -#define srec_close_and_cleanup _bfd_generic_close_and_cleanup -#define srec_bfd_free_cached_info _bfd_generic_bfd_free_cached_info -#define srec_new_section_hook _bfd_generic_new_section_hook - -#define srec_bfd_is_local_label_name bfd_generic_is_local_label_name -#define srec_get_lineno _bfd_nosymbols_get_lineno -#define srec_find_nearest_line _bfd_nosymbols_find_nearest_line -#define srec_make_empty_symbol _bfd_generic_make_empty_symbol -#define srec_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol -#define srec_read_minisymbols _bfd_generic_read_minisymbols -#define srec_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol - -#define srec_get_reloc_upper_bound \ - ((long (*) PARAMS ((bfd *, asection *))) bfd_0l) -#define srec_canonicalize_reloc \ - ((long (*) PARAMS ((bfd *, asection *, arelent **, asymbol **))) bfd_0l) -#define srec_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup - -#define srec_get_section_contents_in_window \ - _bfd_generic_get_section_contents_in_window - -#define srec_bfd_get_relocated_section_contents \ - bfd_generic_get_relocated_section_contents -#define srec_bfd_relax_section bfd_generic_relax_section -#define srec_bfd_gc_sections bfd_generic_gc_sections -#define srec_bfd_merge_sections bfd_generic_merge_sections -#define srec_bfd_discard_group bfd_generic_discard_group -#define srec_bfd_link_hash_table_create _bfd_generic_link_hash_table_create -#define srec_bfd_link_hash_table_free _bfd_generic_link_hash_table_free -#define srec_bfd_link_add_symbols _bfd_generic_link_add_symbols -#define srec_bfd_link_just_syms _bfd_generic_link_just_syms -#define srec_bfd_final_link _bfd_generic_final_link -#define srec_bfd_link_split_section _bfd_generic_link_split_section +#define srec_close_and_cleanup _bfd_generic_close_and_cleanup +#define srec_bfd_free_cached_info _bfd_generic_bfd_free_cached_info +#define srec_new_section_hook _bfd_generic_new_section_hook +#define srec_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) +#define srec_bfd_is_local_label_name bfd_generic_is_local_label_name +#define srec_get_lineno _bfd_nosymbols_get_lineno +#define srec_find_nearest_line _bfd_nosymbols_find_nearest_line +#define srec_find_inliner_info _bfd_nosymbols_find_inliner_info +#define srec_make_empty_symbol _bfd_generic_make_empty_symbol +#define srec_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol +#define srec_read_minisymbols _bfd_generic_read_minisymbols +#define srec_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol +#define srec_get_reloc_upper_bound ((long (*) (bfd *, asection *)) bfd_0l) +#define srec_canonicalize_reloc ((long (*) (bfd *, asection *, arelent **, asymbol **)) bfd_0l) +#define srec_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup +#define srec_get_section_contents_in_window _bfd_generic_get_section_contents_in_window +#define srec_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents +#define srec_bfd_relax_section bfd_generic_relax_section +#define srec_bfd_gc_sections bfd_generic_gc_sections +#define srec_bfd_merge_sections bfd_generic_merge_sections +#define srec_bfd_is_group_section bfd_generic_is_group_section +#define srec_bfd_discard_group bfd_generic_discard_group +#define srec_section_already_linked _bfd_generic_section_already_linked +#define srec_bfd_link_hash_table_create _bfd_generic_link_hash_table_create +#define srec_bfd_link_hash_table_free _bfd_generic_link_hash_table_free +#define srec_bfd_link_add_symbols _bfd_generic_link_add_symbols +#define srec_bfd_link_just_syms _bfd_generic_link_just_syms +#define srec_bfd_final_link _bfd_generic_final_link +#define srec_bfd_link_split_section _bfd_generic_link_split_section const bfd_target srec_vec = { - "srec", /* name */ + "srec", /* Name. */ bfd_target_srec_flavour, - BFD_ENDIAN_UNKNOWN, /* target byte order */ - BFD_ENDIAN_UNKNOWN, /* target headers byte order */ - (HAS_RELOC | EXEC_P | /* object flags */ + BFD_ENDIAN_UNKNOWN, /* Target byte order. */ + BFD_ENDIAN_UNKNOWN, /* Target headers byte order. */ + (HAS_RELOC | EXEC_P | /* Object flags. */ HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED), (SEC_CODE | SEC_DATA | SEC_ROM | SEC_HAS_CONTENTS - | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ - 0, /* leading underscore */ - ' ', /* ar_pad_char */ - 16, /* ar_max_namelen */ + | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* Section flags. */ + 0, /* Leading underscore. */ + ' ', /* AR_pad_char. */ + 16, /* AR_max_namelen. */ bfd_getb64, bfd_getb_signed_64, bfd_putb64, bfd_getb32, bfd_getb_signed_32, bfd_putb32, - bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */ + bfd_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_getb16, bfd_getb_signed_16, bfd_putb16, /* Hdrs. */ { _bfd_dummy_target, - srec_object_p, /* bfd_check_format */ + srec_object_p, /* bfd_check_format. */ _bfd_dummy_target, _bfd_dummy_target, }, @@ -1325,7 +1244,7 @@ const bfd_target srec_vec = _bfd_generic_mkarchive, bfd_false, }, - { /* bfd_write_contents */ + { /* bfd_write_contents. */ bfd_false, srec_write_object_contents, _bfd_write_archive_contents, @@ -1344,33 +1263,33 @@ const bfd_target srec_vec = NULL, - (PTR) 0 + NULL }; const bfd_target symbolsrec_vec = { - "symbolsrec", /* name */ + "symbolsrec", /* Name. */ bfd_target_srec_flavour, - BFD_ENDIAN_UNKNOWN, /* target byte order */ - BFD_ENDIAN_UNKNOWN, /* target headers byte order */ - (HAS_RELOC | EXEC_P | /* object flags */ + BFD_ENDIAN_UNKNOWN, /* Target byte order. */ + BFD_ENDIAN_UNKNOWN, /* Target headers byte order. */ + (HAS_RELOC | EXEC_P | /* Object flags. */ HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED), (SEC_CODE | SEC_DATA | SEC_ROM | SEC_HAS_CONTENTS - | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ - 0, /* leading underscore */ - ' ', /* ar_pad_char */ - 16, /* ar_max_namelen */ + | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* Section flags. */ + 0, /* Leading underscore. */ + ' ', /* AR_pad_char. */ + 16, /* AR_max_namelen. */ bfd_getb64, bfd_getb_signed_64, bfd_putb64, bfd_getb32, bfd_getb_signed_32, bfd_putb32, - bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */ + bfd_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_getb16, bfd_getb_signed_16, bfd_putb16, /* Headers. */ { _bfd_dummy_target, - symbolsrec_object_p, /* bfd_check_format */ + symbolsrec_object_p, /* bfd_check_format. */ _bfd_dummy_target, _bfd_dummy_target, }, @@ -1380,7 +1299,7 @@ const bfd_target symbolsrec_vec = _bfd_generic_mkarchive, bfd_false, }, - { /* bfd_write_contents */ + { /* bfd_write_contents. */ bfd_false, symbolsrec_write_object_contents, _bfd_write_archive_contents, @@ -1399,5 +1318,5 @@ const bfd_target symbolsrec_vec = NULL, - (PTR) 0 + NULL }; diff --git a/contrib/binutils/bfd/stab-syms.c b/contrib/binutils/bfd/stab-syms.c index a685e31eb81..c577e1f4178 100644 --- a/contrib/binutils/bfd/stab-syms.c +++ b/contrib/binutils/bfd/stab-syms.c @@ -17,7 +17,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" diff --git a/contrib/binutils/bfd/stabs.c b/contrib/binutils/bfd/stabs.c index 04b91f68004..ba3f9344619 100644 --- a/contrib/binutils/bfd/stabs.c +++ b/contrib/binutils/bfd/stabs.c @@ -1,6 +1,6 @@ /* Stabs in sections linking support. - Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 - Free Software Foundation, Inc. + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, + 2006 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* This file contains support for linking stabs in sections, as used on COFF and ELF. */ @@ -41,19 +41,12 @@ the string table for this unit, and the desc field is the number of stabs symbols for this unit. */ -#define STRDXOFF (0) -#define TYPEOFF (4) -#define OTHEROFF (5) -#define DESCOFF (6) -#define VALOFF (8) -#define STABSIZE (12) - -/* A hash table used for header files with N_BINCL entries. */ - -struct stab_link_includes_table -{ - struct bfd_hash_table root; -}; +#define STRDXOFF 0 +#define TYPEOFF 4 +#define OTHEROFF 5 +#define DESCOFF 6 +#define VALOFF 8 +#define STABSIZE 12 /* A linked list of totals that we have found for a particular header file. A total is a unique identifier for a particular BINCL...EINCL @@ -80,12 +73,6 @@ struct stab_link_includes_entry struct stab_link_includes_totals *totals; }; -/* Look up an entry in an the header file hash table. */ - -#define stab_link_includes_lookup(table, string, create, copy) \ - ((struct stab_link_includes_entry *) \ - bfd_hash_lookup (&(table)->root, (string), (create), (copy))) - /* This structure is used to hold a list of N_BINCL symbols, some of which might be converted into N_EXCL symbols. */ @@ -124,50 +111,31 @@ struct stab_section_info bfd_size_type stridxs[1]; }; -/* This structure is used to keep track of stabs in sections - information while linking. */ - -struct stab_info -{ - /* A hash table used to hold stabs strings. */ - struct bfd_strtab_hash *strings; - /* The header file hash table. */ - struct stab_link_includes_table includes; - /* The first .stabstr section. */ - asection *stabstr; -}; - -static struct bfd_hash_entry *stab_link_includes_newfunc - PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); /* The function to create a new entry in the header file hash table. */ static struct bfd_hash_entry * -stab_link_includes_newfunc (entry, table, string) - struct bfd_hash_entry *entry; - struct bfd_hash_table *table; - const char *string; +stab_link_includes_newfunc (struct bfd_hash_entry *entry, + struct bfd_hash_table *table, + const char *string) { struct stab_link_includes_entry *ret = (struct stab_link_includes_entry *) entry; /* Allocate the structure if it has not already been allocated by a subclass. */ - if (ret == (struct stab_link_includes_entry *) NULL) - ret = ((struct stab_link_includes_entry *) - bfd_hash_allocate (table, - sizeof (struct stab_link_includes_entry))); - if (ret == (struct stab_link_includes_entry *) NULL) - return (struct bfd_hash_entry *) ret; + if (ret == NULL) + ret = bfd_hash_allocate (table, + sizeof (struct stab_link_includes_entry)); + if (ret == NULL) + return NULL; /* Call the allocation method of the superclass. */ ret = ((struct stab_link_includes_entry *) bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string)); if (ret) - { - /* Set local fields. */ - ret->totals = NULL; - } + /* Set local fields. */ + ret->totals = NULL; return (struct bfd_hash_entry *) ret; } @@ -176,16 +144,14 @@ stab_link_includes_newfunc (entry, table, string) pass of the linker. */ bfd_boolean -_bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo, pstring_offset) - bfd *abfd; - PTR *psinfo; - asection *stabsec; - asection *stabstrsec; - PTR *psecinfo; - bfd_size_type *pstring_offset; +_bfd_link_section_stabs (bfd *abfd, + struct stab_info *sinfo, + asection *stabsec, + asection *stabstrsec, + void * *psecinfo, + bfd_size_type *pstring_offset) { bfd_boolean first; - struct stab_info *sinfo; bfd_size_type count, amt; struct stab_section_info *secinfo; bfd_byte *stabbuf = NULL; @@ -194,67 +160,54 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo, pstring_of bfd_size_type stroff, next_stroff, skip; bfd_size_type *pstridx; - if (stabsec->_raw_size == 0 - || stabstrsec->_raw_size == 0) - { - /* This file does not contain stabs debugging information. */ - return TRUE; - } + if (stabsec->size == 0 + || stabstrsec->size == 0) + /* This file does not contain stabs debugging information. */ + return TRUE; - if (stabsec->_raw_size % STABSIZE != 0) - { - /* Something is wrong with the format of these stab symbols. - Don't try to optimize them. */ - return TRUE; - } + if (stabsec->size % STABSIZE != 0) + /* Something is wrong with the format of these stab symbols. + Don't try to optimize them. */ + return TRUE; if ((stabstrsec->flags & SEC_RELOC) != 0) - { - /* We shouldn't see relocations in the strings, and we aren't - prepared to handle them. */ - return TRUE; - } + /* We shouldn't see relocations in the strings, and we aren't + prepared to handle them. */ + return TRUE; if ((stabsec->output_section != NULL && bfd_is_abs_section (stabsec->output_section)) || (stabstrsec->output_section != NULL && bfd_is_abs_section (stabstrsec->output_section))) - { - /* At least one of the sections is being discarded from the - link, so we should just ignore them. */ - return TRUE; - } + /* At least one of the sections is being discarded from the + link, so we should just ignore them. */ + return TRUE; first = FALSE; - if (*psinfo == NULL) + if (sinfo->stabstr == NULL) { /* Initialize the stabs information we need to keep track of. */ first = TRUE; - amt = sizeof (struct stab_info); - *psinfo = (PTR) bfd_alloc (abfd, amt); - if (*psinfo == NULL) - goto error_return; - sinfo = (struct stab_info *) *psinfo; sinfo->strings = _bfd_stringtab_init (); if (sinfo->strings == NULL) goto error_return; /* Make sure the first byte is zero. */ (void) _bfd_stringtab_add (sinfo->strings, "", TRUE, TRUE); - if (! bfd_hash_table_init_n (&sinfo->includes.root, - stab_link_includes_newfunc, - 251)) + if (! bfd_hash_table_init (&sinfo->includes, + stab_link_includes_newfunc, + sizeof (struct stab_link_includes_entry))) goto error_return; sinfo->stabstr = bfd_make_section_anyway (abfd, ".stabstr"); - sinfo->stabstr->flags |= SEC_HAS_CONTENTS | SEC_READONLY | SEC_DEBUGGING; + if (sinfo->stabstr == NULL) + goto error_return; + sinfo->stabstr->flags |= (SEC_HAS_CONTENTS | SEC_READONLY + | SEC_DEBUGGING | SEC_LINKER_CREATED); } - sinfo = (struct stab_info *) *psinfo; - /* Initialize the information we are going to store for this .stab section. */ - - count = stabsec->_raw_size / STABSIZE; + count = stabsec->size / STABSIZE; amt = sizeof (struct stab_section_info); amt += (count - 1) * sizeof (bfd_size_type); @@ -264,25 +217,17 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo, pstring_of secinfo = (struct stab_section_info *) *psecinfo; secinfo->excls = NULL; + stabsec->rawsize = stabsec->size; secinfo->cumulative_skips = NULL; memset (secinfo->stridxs, 0, (size_t) count * sizeof (bfd_size_type)); /* Read the stabs information from abfd. */ - - stabbuf = (bfd_byte *) bfd_malloc (stabsec->_raw_size); - stabstrbuf = (bfd_byte *) bfd_malloc (stabstrsec->_raw_size); - if (stabbuf == NULL || stabstrbuf == NULL) - goto error_return; - - if (! bfd_get_section_contents (abfd, stabsec, stabbuf, (bfd_vma) 0, - stabsec->_raw_size) - || ! bfd_get_section_contents (abfd, stabstrsec, stabstrbuf, (bfd_vma) 0, - stabstrsec->_raw_size)) + if (!bfd_malloc_and_get_section (abfd, stabsec, &stabbuf) + || !bfd_malloc_and_get_section (abfd, stabstrsec, &stabstrbuf)) goto error_return; /* Look through the stabs symbols, work out the new string indices, and identify N_BINCL symbols which can be eliminated. */ - stroff = 0; /* The stabs sections can be split when -split-by-reloc/-split-by-file is used. We must keep track of @@ -291,7 +236,7 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo, pstring_of next_stroff = pstring_offset ? *pstring_offset : 0; skip = 0; - symend = stabbuf + stabsec->_raw_size; + symend = stabbuf + stabsec->size; for (sym = stabbuf, pstridx = secinfo->stridxs; sym < symend; sym += STABSIZE, ++pstridx) @@ -301,10 +246,8 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo, pstring_of const char *string; if (*pstridx != 0) - { - /* This symbol has already been handled by an N_BINCL pass. */ - continue; - } + /* This symbol has already been handled by an N_BINCL pass. */ + continue; type = sym[TYPEOFF]; @@ -327,13 +270,11 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo, pstring_of /* Store the string in the hash table, and record the index. */ symstroff = stroff + bfd_get_32 (abfd, sym + STRDXOFF); - if (symstroff >= stabstrsec->_raw_size) + if (symstroff >= stabstrsec->size) { (*_bfd_error_handler) - (_("%s(%s+0x%lx): Stabs entry has invalid string index."), - bfd_archive_filename (abfd), - bfd_get_section_name (abfd, stabsec), - (long) (sym - stabbuf)); + (_("%B(%A+0x%lx): Stabs entry has invalid string index."), + abfd, stabsec, (long) (sym - stabbuf)); bfd_set_error (bfd_error_bad_value); goto error_return; } @@ -417,8 +358,8 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo, pstring_of /* If we have already included a header file with the same value, then replaced this one with an N_EXCL symbol. */ - incl_entry = stab_link_includes_lookup (&sinfo->includes, string, - TRUE, TRUE); + incl_entry = (struct stab_link_includes_entry * ) + bfd_hash_lookup (&sinfo->includes, string, TRUE, TRUE); if (incl_entry == NULL) goto error_return; @@ -431,7 +372,7 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo, pstring_of /* Record this symbol, so that we can set the value correctly. */ amt = sizeof *ne; - ne = (struct stab_excl_list *) bfd_alloc (abfd, amt); + ne = bfd_alloc (abfd, amt); if (ne == NULL) goto error_return; ne->offset = sym - stabbuf; @@ -444,8 +385,7 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo, pstring_of { /* This is the first time we have seen this header file with this set of stabs strings. */ - t = ((struct stab_link_includes_totals *) - bfd_hash_allocate (&sinfo->includes.root, sizeof *t)); + t = bfd_hash_allocate (&sinfo->includes, sizeof *t); if (t == NULL) goto error_return; t->sum_chars = sum_chars; @@ -513,11 +453,11 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo, pstring_of from the link. We record the size of the strtab in the first .stabstr section we saw, and make sure we don't set SEC_EXCLUDE for that section. */ - stabsec->_cooked_size = (count - skip) * STABSIZE; - if (stabsec->_cooked_size == 0) + stabsec->size = (count - skip) * STABSIZE; + if (stabsec->size == 0) stabsec->flags |= SEC_EXCLUDE; stabstrsec->flags |= SEC_EXCLUDE; - sinfo->stabstr->_cooked_size = _bfd_stringtab_size (sinfo->strings); + sinfo->stabstr->size = _bfd_stringtab_size (sinfo->strings); /* Calculate the `cumulative_skips' array now that stabs have been deleted for this section. */ @@ -528,7 +468,7 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo, pstring_of bfd_size_type *pskips; amt = count * sizeof (bfd_size_type); - secinfo->cumulative_skips = (bfd_size_type *) bfd_alloc (abfd, amt); + secinfo->cumulative_skips = bfd_alloc (abfd, amt); if (secinfo->cumulative_skips == NULL) goto error_return; @@ -555,7 +495,6 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo, pstring_of free (stabstrbuf); return FALSE; } - /* This function is called for each input file before the stab section is relocated. It discards stab entries for discarded @@ -564,13 +503,11 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo, pstring_of */ bfd_boolean -_bfd_discard_section_stabs (abfd, stabsec, psecinfo, - reloc_symbol_deleted_p, cookie) - bfd *abfd; - asection *stabsec; - PTR psecinfo; - bfd_boolean (*reloc_symbol_deleted_p) PARAMS ((bfd_vma, PTR)); - PTR cookie; +_bfd_discard_section_stabs (bfd *abfd, + asection *stabsec, + void * psecinfo, + bfd_boolean (*reloc_symbol_deleted_p) (bfd_vma, void *), + void * cookie) { bfd_size_type count, amt; struct stab_section_info *secinfo; @@ -580,26 +517,20 @@ _bfd_discard_section_stabs (abfd, stabsec, psecinfo, bfd_size_type *pstridx; int deleting; - if (stabsec->_raw_size == 0) - { - /* This file does not contain stabs debugging information. */ - return FALSE; - } + if (stabsec->size == 0) + /* This file does not contain stabs debugging information. */ + return FALSE; - if (stabsec->_raw_size % STABSIZE != 0) - { - /* Something is wrong with the format of these stab symbols. - Don't try to optimize them. */ - return FALSE; - } + if (stabsec->size % STABSIZE != 0) + /* Something is wrong with the format of these stab symbols. + Don't try to optimize them. */ + return FALSE; if ((stabsec->output_section != NULL && bfd_is_abs_section (stabsec->output_section))) - { - /* At least one of the sections is being discarded from the - link, so we should just ignore them. */ - return FALSE; - } + /* At least one of the sections is being discarded from the + link, so we should just ignore them. */ + return FALSE; /* We should have initialized our data in _bfd_link_stab_sections. If there was some bizarre error reading the string sections, though, @@ -607,26 +538,19 @@ _bfd_discard_section_stabs (abfd, stabsec, psecinfo, if (psecinfo == NULL) return FALSE; - count = stabsec->_raw_size / STABSIZE; + count = stabsec->rawsize / STABSIZE; secinfo = (struct stab_section_info *) psecinfo; /* Read the stabs information from abfd. */ - - stabbuf = (bfd_byte *) bfd_malloc (stabsec->_raw_size); - if (stabbuf == NULL) - goto error_return; - - if (! bfd_get_section_contents (abfd, stabsec, stabbuf, (bfd_vma) 0, - stabsec->_raw_size)) + if (!bfd_malloc_and_get_section (abfd, stabsec, &stabbuf)) goto error_return; /* Look through the stabs symbols and discard any information for discarded functions. */ - skip = 0; deleting = -1; - symend = stabbuf + stabsec->_raw_size; + symend = stabbuf + stabsec->rawsize; for (sym = stabbuf, pstridx = secinfo->stridxs; sym < symend; sym += STABSIZE, ++pstridx) @@ -634,10 +558,8 @@ _bfd_discard_section_stabs (abfd, stabsec, psecinfo, int type; if (*pstridx == (bfd_size_type) -1) - { - /* This stab was deleted in a previous pass. */ - continue; - } + /* This stab was deleted in a previous pass. */ + continue; type = sym[TYPEOFF]; @@ -684,8 +606,8 @@ _bfd_discard_section_stabs (abfd, stabsec, psecinfo, stabbuf = NULL; /* Shrink the stabsec as needed. */ - stabsec->_cooked_size -= skip * STABSIZE; - if (stabsec->_cooked_size == 0) + stabsec->size -= skip * STABSIZE; + if (stabsec->size == 0) stabsec->flags |= SEC_EXCLUDE; /* Recalculate the `cumulative_skips' array now that stabs have been @@ -699,7 +621,7 @@ _bfd_discard_section_stabs (abfd, stabsec, psecinfo, if (secinfo->cumulative_skips == NULL) { amt = count * sizeof (bfd_size_type); - secinfo->cumulative_skips = (bfd_size_type *) bfd_alloc (abfd, amt); + secinfo->cumulative_skips = bfd_alloc (abfd, amt); if (secinfo->cumulative_skips == NULL) goto error_return; } @@ -730,34 +652,30 @@ _bfd_discard_section_stabs (abfd, stabsec, psecinfo, contents. */ bfd_boolean -_bfd_write_section_stabs (output_bfd, psinfo, stabsec, psecinfo, contents) - bfd *output_bfd; - PTR *psinfo; - asection *stabsec; - PTR *psecinfo; - bfd_byte *contents; +_bfd_write_section_stabs (bfd *output_bfd, + struct stab_info *sinfo, + asection *stabsec, + void * *psecinfo, + bfd_byte *contents) { - struct stab_info *sinfo; struct stab_section_info *secinfo; struct stab_excl_list *e; bfd_byte *sym, *tosym, *symend; bfd_size_type *pstridx; - sinfo = (struct stab_info *) *psinfo; secinfo = (struct stab_section_info *) *psecinfo; if (secinfo == NULL) return bfd_set_section_contents (output_bfd, stabsec->output_section, - contents, - (file_ptr) stabsec->output_offset, - stabsec->_raw_size); + contents, stabsec->output_offset, + stabsec->size); /* Handle each N_BINCL entry. */ for (e = secinfo->excls; e != NULL; e = e->next) { bfd_byte *excl_sym; - BFD_ASSERT (e->offset < stabsec->_raw_size); + BFD_ASSERT (e->offset < stabsec->rawsize); excl_sym = contents + e->offset; bfd_put_32 (output_bfd, e->val, excl_sym + VALOFF); excl_sym[TYPEOFF] = e->type; @@ -766,7 +684,7 @@ _bfd_write_section_stabs (output_bfd, psinfo, stabsec, psecinfo, contents) /* Copy over all the stabs symbols, omitting the ones we don't want, and correcting the string indices for those we do want. */ tosym = contents; - symend = contents + stabsec->_raw_size; + symend = contents + stabsec->rawsize; for (sym = contents, pstridx = secinfo->stridxs; sym < symend; sym += STABSIZE, ++pstridx) @@ -787,7 +705,7 @@ _bfd_write_section_stabs (output_bfd, psinfo, stabsec, psecinfo, contents) bfd_put_32 (output_bfd, _bfd_stringtab_size (sinfo->strings), tosym + VALOFF); bfd_put_16 (output_bfd, - stabsec->output_section->_raw_size / STABSIZE - 1, + stabsec->output_section->size / STABSIZE - 1, tosym + DESCOFF); } @@ -795,36 +713,25 @@ _bfd_write_section_stabs (output_bfd, psinfo, stabsec, psecinfo, contents) } } - BFD_ASSERT ((bfd_size_type) (tosym - contents) == stabsec->_cooked_size); + BFD_ASSERT ((bfd_size_type) (tosym - contents) == stabsec->size); return bfd_set_section_contents (output_bfd, stabsec->output_section, contents, (file_ptr) stabsec->output_offset, - stabsec->_cooked_size); + stabsec->size); } /* Write out the .stabstr section. */ bfd_boolean -_bfd_write_stab_strings (output_bfd, psinfo) - bfd *output_bfd; - PTR *psinfo; +_bfd_write_stab_strings (bfd *output_bfd, struct stab_info *sinfo) { - struct stab_info *sinfo; - - sinfo = (struct stab_info *) *psinfo; - - if (sinfo == NULL) - return TRUE; - if (bfd_is_abs_section (sinfo->stabstr->output_section)) - { - /* The section was discarded from the link. */ - return TRUE; - } + /* The section was discarded from the link. */ + return TRUE; BFD_ASSERT ((sinfo->stabstr->output_offset + _bfd_stringtab_size (sinfo->strings)) - <= sinfo->stabstr->output_section->_raw_size); + <= sinfo->stabstr->output_section->size); if (bfd_seek (output_bfd, (file_ptr) (sinfo->stabstr->output_section->filepos @@ -837,7 +744,7 @@ _bfd_write_stab_strings (output_bfd, psinfo) /* We no longer need the stabs information. */ _bfd_stringtab_free (sinfo->strings); - bfd_hash_table_free (&sinfo->includes.root); + bfd_hash_table_free (&sinfo->includes); return TRUE; } @@ -847,22 +754,19 @@ _bfd_write_stab_strings (output_bfd, psinfo) or -1 if the address refers to a stab which has been removed. */ bfd_vma -_bfd_stab_section_offset (output_bfd, psinfo, stabsec, psecinfo, offset) - bfd *output_bfd ATTRIBUTE_UNUSED; - PTR *psinfo ATTRIBUTE_UNUSED; - asection *stabsec; - PTR *psecinfo; - bfd_vma offset; +_bfd_stab_section_offset (asection *stabsec, + void * psecinfo, + bfd_vma offset) { struct stab_section_info *secinfo; - secinfo = (struct stab_section_info *) *psecinfo; + secinfo = (struct stab_section_info *) psecinfo; if (secinfo == NULL) return offset; - if (offset >= stabsec->_raw_size) - return offset - (stabsec->_cooked_size - stabsec->_raw_size); + if (offset >= stabsec->rawsize) + return offset - stabsec->rawsize + stabsec->size; if (secinfo->cumulative_skips) { diff --git a/contrib/binutils/bfd/sunos.c b/contrib/binutils/bfd/sunos.c index 5b1b18b9d76..024320fbfa1 100644 --- a/contrib/binutils/bfd/sunos.c +++ b/contrib/binutils/bfd/sunos.c @@ -1,23 +1,23 @@ /* BFD backend for SunOS binaries. - Copyright 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 2000, 2001, - 2002, 2003 Free Software Foundation, Inc. + Copyright 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000, + 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Written by Cygnus Support. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #define TARGETNAME "a.out-sunos-big" @@ -30,59 +30,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfdlink.h" #include "libaout.h" -/* Static routines defined in this file. */ - -static bfd_boolean sunos_read_dynamic_info PARAMS ((bfd *)); -static long sunos_get_dynamic_symtab_upper_bound PARAMS ((bfd *)); -static bfd_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 bfd_boolean sunos_create_dynamic_sections - PARAMS ((bfd *, struct bfd_link_info *, bfd_boolean)); -static bfd_boolean sunos_add_dynamic_symbols - PARAMS ((bfd *, struct bfd_link_info *, struct external_nlist **, - bfd_size_type *, char **)); -static bfd_boolean sunos_add_one_symbol - PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword, asection *, - bfd_vma, const char *, bfd_boolean, bfd_boolean, - struct bfd_link_hash_entry **)); -static bfd_boolean sunos_scan_relocs - PARAMS ((struct bfd_link_info *, bfd *, asection *, bfd_size_type)); -static bfd_boolean sunos_scan_std_relocs - PARAMS ((struct bfd_link_info *, bfd *, asection *, - const struct reloc_std_external *, bfd_size_type)); -static bfd_boolean sunos_scan_ext_relocs - PARAMS ((struct bfd_link_info *, bfd *, asection *, - const struct reloc_ext_external *, bfd_size_type)); -static bfd_boolean sunos_link_dynamic_object - PARAMS ((struct bfd_link_info *, bfd *)); -static bfd_boolean sunos_write_dynamic_symbol - PARAMS ((bfd *, struct bfd_link_info *, struct aout_link_hash_entry *)); -static bfd_boolean sunos_check_dynamic_reloc - PARAMS ((struct bfd_link_info *, bfd *, asection *, - struct aout_link_hash_entry *, PTR, bfd_byte *, bfd_boolean *, - bfd_vma *)); -static bfd_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) \ @@ -93,6 +40,31 @@ static bfd_boolean sunos_finish_dynamic_link || (((mtype) == M_UNKNOWN || (mtype) == M_68010 || (mtype) == M_68020) \ && bfd_lookup_arch (bfd_arch_m68k, 0) != NULL)) +#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_synthetic_symtab _bfd_nodynamic_get_synthetic_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 + +static bfd_boolean sunos_add_dynamic_symbols (bfd *, struct bfd_link_info *, struct external_nlist **, bfd_size_type *, char **); +static bfd_boolean sunos_add_one_symbol (struct bfd_link_info *, bfd *, const char *, flagword, asection *, bfd_vma, const char *, bfd_boolean, bfd_boolean, struct bfd_link_hash_entry **); +static bfd_boolean sunos_link_dynamic_object (struct bfd_link_info *, bfd *); +static bfd_boolean sunos_write_dynamic_symbol (bfd *, struct bfd_link_info *, struct aout_link_hash_entry *); +static bfd_boolean sunos_check_dynamic_reloc (struct bfd_link_info *, bfd *, asection *, struct aout_link_hash_entry *, void *, bfd_byte *, bfd_boolean *, bfd_vma *); +static bfd_boolean sunos_finish_dynamic_link (bfd *, struct bfd_link_info *); +static struct bfd_link_hash_table *sunos_link_hash_table_create (bfd *); +static long sunos_get_dynamic_symtab_upper_bound (bfd *); +static long sunos_canonicalize_dynamic_symtab (bfd *, asymbol **); +static long sunos_get_dynamic_reloc_upper_bound (bfd *); +static long sunos_canonicalize_dynamic_reloc (bfd *, arelent **, asymbol **); + /* Include the usual a.out support. */ #include "aoutf1.h" @@ -120,7 +92,7 @@ struct sunos_dynamic_info unsigned long dynrel_count; /* Read in dynamic relocs. This may be reloc_std_external or reloc_ext_external. */ - PTR dynrel; + void * dynrel; /* arelent structures for dynamic relocs. */ arelent *canonical_dynrel; }; @@ -137,8 +109,7 @@ struct sunos_dynamic_info structure to FALSE to avoid doing this work again. */ static bfd_boolean -sunos_read_dynamic_info (abfd) - bfd *abfd; +sunos_read_dynamic_info (bfd *abfd) { struct sunos_dynamic_info *info; asection *dynsec; @@ -148,7 +119,7 @@ sunos_read_dynamic_info (abfd) struct external_sun4_dynamic_link linkinfo; bfd_size_type amt; - if (obj_aout_dynamic_info (abfd) != (PTR) NULL) + if (obj_aout_dynamic_info (abfd) != NULL) return TRUE; if ((abfd->flags & DYNAMIC) == 0) @@ -158,7 +129,7 @@ sunos_read_dynamic_info (abfd) } amt = sizeof (struct sunos_dynamic_info); - info = (struct sunos_dynamic_info *) bfd_zalloc (abfd, amt); + info = bfd_zalloc (abfd, amt); if (!info) return FALSE; info->valid = FALSE; @@ -167,7 +138,7 @@ sunos_read_dynamic_info (abfd) info->canonical_dynsym = NULL; info->dynrel = NULL; info->canonical_dynrel = NULL; - obj_aout_dynamic_info (abfd) = (PTR) info; + obj_aout_dynamic_info (abfd) = (void *) info; /* This code used to look for the __DYNAMIC symbol to locate the dynamic linking information. @@ -178,7 +149,7 @@ sunos_read_dynamic_info (abfd) symbols for the __DYNAMIC symbol. */ if ((abfd->flags & DYNAMIC) == 0) return TRUE; - if (! bfd_get_section_contents (abfd, obj_datasec (abfd), (PTR) &dyninfo, + if (! bfd_get_section_contents (abfd, obj_datasec (abfd), (void *) &dyninfo, (file_ptr) 0, (bfd_size_type) sizeof dyninfo)) return TRUE; @@ -196,12 +167,12 @@ sunos_read_dynamic_info (abfd) else dynsec = obj_datasec (abfd); dynoff -= bfd_get_section_vma (abfd, dynsec); - if (dynoff > bfd_section_size (abfd, dynsec)) + if (dynoff > dynsec->size) 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, + if (! bfd_get_section_contents (abfd, dynsec, (void *) &linkinfo, (file_ptr) dynoff, (bfd_size_type) sizeof linkinfo)) return TRUE; @@ -259,8 +230,7 @@ sunos_read_dynamic_info (abfd) /* Return the amount of memory required for the dynamic symbols. */ static long -sunos_get_dynamic_symtab_upper_bound (abfd) - bfd *abfd; +sunos_get_dynamic_symtab_upper_bound (bfd *abfd) { struct sunos_dynamic_info *info; @@ -280,8 +250,7 @@ sunos_get_dynamic_symtab_upper_bound (abfd) /* Read the external dynamic symbols. */ static bfd_boolean -sunos_slurp_dynamic_symtab (abfd) - bfd *abfd; +sunos_slurp_dynamic_symtab (bfd *abfd) { struct sunos_dynamic_info *info; bfd_size_type amt; @@ -301,14 +270,14 @@ sunos_slurp_dynamic_symtab (abfd) } /* Get the dynamic nlist structures. */ - if (info->dynsym == (struct external_nlist *) NULL) + if (info->dynsym == NULL) { amt = (bfd_size_type) info->dynsym_count * EXTERNAL_NLIST_SIZE; - info->dynsym = (struct external_nlist *) bfd_alloc (abfd, amt); + info->dynsym = bfd_alloc (abfd, amt); if (info->dynsym == NULL && info->dynsym_count != 0) return FALSE; if (bfd_seek (abfd, (file_ptr) info->dyninfo.ld_stab, SEEK_SET) != 0 - || bfd_bread ((PTR) info->dynsym, amt, abfd) != amt) + || bfd_bread ((void *) info->dynsym, amt, abfd) != amt) { if (info->dynsym != NULL) { @@ -320,14 +289,14 @@ sunos_slurp_dynamic_symtab (abfd) } /* Get the dynamic strings. */ - if (info->dynstr == (char *) NULL) + if (info->dynstr == NULL) { amt = info->dyninfo.ld_symb_size; - info->dynstr = (char *) bfd_alloc (abfd, amt); + info->dynstr = bfd_alloc (abfd, amt); if (info->dynstr == NULL && info->dyninfo.ld_symb_size != 0) return FALSE; if (bfd_seek (abfd, (file_ptr) info->dyninfo.ld_symbols, SEEK_SET) != 0 - || bfd_bread ((PTR) info->dynstr, amt, abfd) != amt) + || bfd_bread ((void *) info->dynstr, amt, abfd) != amt) { if (info->dynstr != NULL) { @@ -344,9 +313,7 @@ sunos_slurp_dynamic_symtab (abfd) /* Read in the dynamic symbols. */ static long -sunos_canonicalize_dynamic_symtab (abfd, storage) - bfd *abfd; - asymbol **storage; +sunos_canonicalize_dynamic_symtab (bfd *abfd, asymbol **storage) { struct sunos_dynamic_info *info; unsigned long i; @@ -367,11 +334,11 @@ sunos_canonicalize_dynamic_symtab (abfd, storage) 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); + table = bfd_malloc (table_size); if (table == NULL && table_size != 0) abort (); if (bfd_seek (abfd, (file_ptr) info->dyninfo.ld_hash, SEEK_SET) != 0 - || bfd_bread ((PTR) table, table_size, abfd) != table_size) + || bfd_bread ((void *) table, table_size, abfd) != table_size) abort (); for (i = 0; i < info->dynsym_count; i++) { @@ -399,13 +366,13 @@ sunos_canonicalize_dynamic_symtab (abfd, storage) /* Get the asymbol structures corresponding to the dynamic nlist structures. */ - if (info->canonical_dynsym == (aout_symbol_type *) NULL) + if (info->canonical_dynsym == NULL) { bfd_size_type size; bfd_size_type strsize = info->dyninfo.ld_symb_size; size = (bfd_size_type) info->dynsym_count * sizeof (aout_symbol_type); - info->canonical_dynsym = (aout_symbol_type *) bfd_alloc (abfd, size); + info->canonical_dynsym = bfd_alloc (abfd, size); if (info->canonical_dynsym == NULL && info->dynsym_count != 0) return -1; @@ -434,8 +401,7 @@ sunos_canonicalize_dynamic_symtab (abfd, storage) /* Return the amount of memory required for the dynamic relocs. */ static long -sunos_get_dynamic_reloc_upper_bound (abfd) - bfd *abfd; +sunos_get_dynamic_reloc_upper_bound (bfd *abfd) { struct sunos_dynamic_info *info; @@ -455,17 +421,14 @@ sunos_get_dynamic_reloc_upper_bound (abfd) /* Read in the dynamic relocs. */ static long -sunos_canonicalize_dynamic_reloc (abfd, storage, syms) - bfd *abfd; - arelent **storage; - asymbol **syms; +sunos_canonicalize_dynamic_reloc (bfd *abfd, arelent **storage, asymbol **syms) { struct sunos_dynamic_info *info; unsigned long i; bfd_size_type size; /* Get the general dynamic information. */ - if (obj_aout_dynamic_info (abfd) == (PTR) NULL) + if (obj_aout_dynamic_info (abfd) == NULL) { if (! sunos_read_dynamic_info (abfd)) return -1; @@ -482,11 +445,11 @@ sunos_canonicalize_dynamic_reloc (abfd, storage, syms) if (info->dynrel == NULL) { size = (bfd_size_type) info->dynrel_count * obj_reloc_entry_size (abfd); - info->dynrel = (PTR) bfd_alloc (abfd, size); + info->dynrel = bfd_alloc (abfd, size); if (info->dynrel == NULL && size != 0) return -1; if (bfd_seek (abfd, (file_ptr) info->dyninfo.ld_rel, SEEK_SET) != 0 - || bfd_bread ((PTR) info->dynrel, size, abfd) != size) + || bfd_bread ((void *) info->dynrel, size, abfd) != size) { if (info->dynrel != NULL) { @@ -499,12 +462,12 @@ sunos_canonicalize_dynamic_reloc (abfd, storage, syms) /* Get the arelent structures corresponding to the dynamic reloc information. */ - if (info->canonical_dynrel == (arelent *) NULL) + if (info->canonical_dynrel == NULL) { arelent *to; size = (bfd_size_type) info->dynrel_count * sizeof (arelent); - info->canonical_dynrel = (arelent *) bfd_alloc (abfd, size); + info->canonical_dynrel = bfd_alloc (abfd, size); if (info->canonical_dynrel == NULL && info->dynrel_count != 0) return -1; @@ -512,25 +475,25 @@ sunos_canonicalize_dynamic_reloc (abfd, storage, syms) if (obj_reloc_entry_size (abfd) == RELOC_EXT_SIZE) { - register struct reloc_ext_external *p; + 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, - (bfd_size_type) info->dynsym_count); + NAME (aout, swap_ext_reloc_in) (abfd, p, to, syms, + (bfd_size_type) info->dynsym_count); } else { - register struct reloc_std_external *p; + 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, - (bfd_size_type) info->dynsym_count); + NAME (aout, swap_std_reloc_in) (abfd, p, to, syms, + (bfd_size_type) info->dynsym_count); } } @@ -675,25 +638,23 @@ struct sunos_link_hash_table /* 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; +sunos_link_hash_newfunc (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; + if (ret == NULL) + ret = bfd_hash_allocate (table, sizeof (* ret)); + if (ret == NULL) + return NULL; /* 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)); + NAME (aout, link_hash_newfunc) ((struct bfd_hash_entry *) ret, + table, string)); if (ret != NULL) { /* Set local fields. */ @@ -710,20 +671,20 @@ sunos_link_hash_newfunc (entry, table, string) /* Create a SunOS link hash table. */ static struct bfd_link_hash_table * -sunos_link_hash_table_create (abfd) - bfd *abfd; +sunos_link_hash_table_create (bfd *abfd) { struct sunos_link_hash_table *ret; bfd_size_type amt = sizeof (struct sunos_link_hash_table); - ret = (struct sunos_link_hash_table *) bfd_malloc (amt); - 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)) + ret = bfd_malloc (amt); + if (ret == NULL) + return NULL; + if (!NAME (aout, link_hash_table_init) (&ret->root, abfd, + sunos_link_hash_newfunc, + sizeof (struct sunos_link_hash_entry))) { free (ret); - return (struct bfd_link_hash_table *) NULL; + return NULL; } ret->dynobj = NULL; @@ -750,7 +711,7 @@ sunos_link_hash_table_create (abfd) #define sunos_link_hash_traverse(table, func, info) \ (aout_link_hash_traverse \ (&(table)->root, \ - (bfd_boolean (*) PARAMS ((struct aout_link_hash_entry *, PTR))) (func), \ + (bfd_boolean (*) (struct aout_link_hash_entry *, void *)) (func), \ (info))) /* Get the SunOS link hash table from the info structure. This is @@ -758,9 +719,6 @@ sunos_link_hash_table_create (abfd) #define sunos_hash_table(p) ((struct sunos_link_hash_table *) ((p)->hash)) -static bfd_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 @@ -769,10 +727,9 @@ static bfd_boolean sunos_scan_dynamic_symbol of the dynamic linking information. */ static bfd_boolean -sunos_create_dynamic_sections (abfd, info, needed) - bfd *abfd; - struct bfd_link_info *info; - bfd_boolean needed; +sunos_create_dynamic_sections (bfd *abfd, + struct bfd_link_info *info, + bfd_boolean needed) { asection *s; @@ -853,8 +810,8 @@ sunos_create_dynamic_sections (abfd, info, needed) 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; + if (s->size == 0) + s->size = BYTES_IN_WORD; sunos_hash_table (info)->dynamic_sections_needed = TRUE; sunos_hash_table (info)->got_needed = TRUE; @@ -867,17 +824,15 @@ sunos_create_dynamic_sections (abfd, info, needed) backend linker for each object it encounters. */ static bfd_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; +sunos_add_dynamic_symbols (bfd *abfd, + struct bfd_link_info *info, + struct external_nlist **symsp, + bfd_size_type *sym_countp, + char **stringsp) { bfd *dynobj; struct sunos_dynamic_info *dinfo; unsigned long need; - asection **ps; /* Make sure we have all the required sections. */ if (info->hash->creator == abfd->xvec) @@ -901,12 +856,17 @@ sunos_add_dynamic_symbols (abfd, info, symsp, sym_countp, stringsp) 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. */ - for (ps = &abfd->sections; *ps != NULL; ) + if (abfd != dynobj) + abfd->sections = NULL; + else { - if (abfd != dynobj || ((*ps)->flags & SEC_LINKER_CREATED) == 0) - bfd_section_list_remove (abfd, ps); - else - ps = &(*ps)->next; + asection *s; + + for (s = abfd->sections; s != NULL; s = s->next) + { + if ((s->flags & SEC_LINKER_CREATED) == 0) + bfd_section_list_remove (abfd, s); + } } /* The native linker seems to just ignore dynamic objects when -r is @@ -987,7 +947,6 @@ sunos_add_dynamic_symbols (abfd, info, symsp, sym_countp, stringsp) /* 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); @@ -995,14 +954,14 @@ sunos_add_dynamic_symbols (abfd, info, symsp, sym_countp, stringsp) need = bfd_get_32 (abfd, buf + 12); alc = sizeof (struct bfd_link_needed_list); - needed = (struct bfd_link_needed_list *) bfd_alloc (abfd, alc); + needed = bfd_alloc (abfd, alc); 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); + namebuf = bfd_malloc (alc + 1); if (namebuf == NULL) return FALSE; p = namebuf; @@ -1031,7 +990,7 @@ sunos_add_dynamic_symbols (abfd, info, symsp, sym_countp, stringsp) char *n; alc *= 2; - n = (char *) bfd_realloc (namebuf, alc + 1); + n = bfd_realloc (namebuf, alc + 1); if (n == NULL) { free (namebuf); @@ -1063,7 +1022,7 @@ sunos_add_dynamic_symbols (abfd, info, symsp, sym_countp, stringsp) char *n; alc = (p - namebuf) + strlen (majbuf) + strlen (minbuf); - n = (char *) bfd_realloc (namebuf, alc + 1); + n = bfd_realloc (namebuf, alc + 1); if (n == NULL) { free (namebuf); @@ -1104,18 +1063,16 @@ sunos_add_dynamic_symbols (abfd, info, symsp, sym_countp, stringsp) tweaking needed for dynamic linking support. */ static bfd_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; - bfd_boolean copy; - bfd_boolean collect; - struct bfd_link_hash_entry **hashp; +sunos_add_one_symbol (struct bfd_link_info *info, + bfd *abfd, + const char *name, + flagword flags, + asection *section, + bfd_vma value, + const char *string, + bfd_boolean copy, + bfd_boolean collect, + struct bfd_link_hash_entry **hashp) { struct sunos_link_hash_entry *h; int new_flag; @@ -1180,25 +1137,21 @@ sunos_add_one_symbol (info, abfd, name, flags, section, value, string, 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; - } + /* 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; - } + /* 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, @@ -1244,14 +1197,15 @@ sunos_add_one_symbol (info, abfd, name, flags, section, value, string, return TRUE; } +extern const bfd_target MY (vec); + /* Return the list of objects needed by BFD. */ struct bfd_link_needed_list * -bfd_sunos_get_needed_list (abfd, info) - bfd *abfd ATTRIBUTE_UNUSED; - struct bfd_link_info *info; +bfd_sunos_get_needed_list (bfd *abfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info) { - if (info->hash->creator != &MY(vec)) + if (info->hash->creator != &MY (vec)) return NULL; return sunos_hash_table (info)->needed; } @@ -1260,10 +1214,9 @@ bfd_sunos_get_needed_list (abfd, info) this in case some dynamic object refers to this symbol. */ bfd_boolean -bfd_sunos_record_link_assignment (output_bfd, info, name) - bfd *output_bfd; - struct bfd_link_info *info; - const char *name; +bfd_sunos_record_link_assignment (bfd *output_bfd, + struct bfd_link_info *info, + const char *name) { struct sunos_link_hash_entry *h; @@ -1294,295 +1247,6 @@ bfd_sunos_record_link_assignment (output_bfd, info, name) 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. */ - -bfd_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; - bfd_size_type dynsymcount; - struct sunos_link_hash_entry *h; - asection *s; - size_t bucketcount; - bfd_size_type hashalloc; - size_t i; - bfd *sub; - - *sdynptr = NULL; - *sneedptr = NULL; - *srulesptr = NULL; - - if (info->relocatable) - 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_zalloc (dynobj, hashalloc); - if (s->contents == NULL && dynsymcount > 0) - return FALSE; - 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, - 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 bfd_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 (rel_size); - else - { - struct aout_section_data_struct *n; - bfd_size_type amt = sizeof (struct aout_section_data_struct); - - n = (struct aout_section_data_struct *) bfd_alloc (abfd, amt); - if (n == NULL) - relocs = NULL; - else - { - set_aout_section_data (sec, n); - relocs = bfd_malloc (rel_size); - aout_section_data (sec)->relocs = relocs; - } - } - if (relocs == NULL) - return FALSE; - - if (bfd_seek (abfd, sec->rel_filepos, SEEK_SET) != 0 - || bfd_bread (relocs, 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 @@ -1594,12 +1258,11 @@ sunos_scan_relocs (info, abfd, sec, rel_size) building global offset table entries. */ static bfd_boolean -sunos_scan_std_relocs (info, abfd, sec, relocs, rel_size) - struct bfd_link_info *info; - bfd *abfd; - asection *sec ATTRIBUTE_UNUSED; - const struct reloc_std_external *relocs; - bfd_size_type rel_size; +sunos_scan_std_relocs (struct bfd_link_info *info, + bfd *abfd, + asection *sec ATTRIBUTE_UNUSED, + const struct reloc_std_external *relocs, + bfd_size_type rel_size) { bfd *dynobj; asection *splt = NULL; @@ -1649,11 +1312,9 @@ sunos_scan_std_relocs (info, abfd, sec, relocs, rel_size) /* 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; - } + /* 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 @@ -1682,8 +1343,8 @@ sunos_scan_std_relocs (info, abfd, sec, relocs, rel_size) sgot = bfd_get_section_by_name (dynobj, ".got"); BFD_ASSERT (sgot != NULL); - if (sgot->_raw_size == 0) - sgot->_raw_size = BYTES_IN_WORD; + if (sgot->size == 0) + sgot->size = BYTES_IN_WORD; sunos_hash_table (info)->got_needed = TRUE; } @@ -1697,13 +1358,10 @@ sunos_scan_std_relocs (info, abfd, sec, relocs, rel_size) /* 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; - } + /* Presumably this symbol was marked as being undefined by + an earlier reloc. */ + srel->size += RELOC_STD_SIZE; else if ((h->root.root.u.def.section->flags & SEC_CODE) == 0) { bfd *sub; @@ -1711,7 +1369,7 @@ sunos_scan_std_relocs (info, abfd, sec, relocs, rel_size) /* 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; + srel->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; @@ -1725,21 +1383,21 @@ sunos_scan_std_relocs (info, abfd, sec, relocs, rel_size) 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 (splt->size == 0) + splt->size = M68K_PLT_ENTRY_SIZE; + h->plt_offset = splt->size; if ((h->flags & SUNOS_DEF_REGULAR) == 0) { h->root.root.u.def.section = splt; - h->root.root.u.def.value = splt->_raw_size; + h->root.root.u.def.value = splt->size; } - splt->_raw_size += M68K_PLT_ENTRY_SIZE; + splt->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; + srel->size += RELOC_STD_SIZE; } } } @@ -1754,12 +1412,11 @@ sunos_scan_std_relocs (info, abfd, sec, relocs, rel_size) Otherwise, we must preserve the reloc as a dynamic reloc. */ static bfd_boolean -sunos_scan_ext_relocs (info, abfd, sec, relocs, rel_size) - struct bfd_link_info *info; - bfd *abfd; - asection *sec ATTRIBUTE_UNUSED; - const struct reloc_ext_external *relocs; - bfd_size_type rel_size; +sunos_scan_ext_relocs (struct bfd_link_info *info, + bfd *abfd, + asection *sec ATTRIBUTE_UNUSED, + const struct reloc_ext_external *relocs, + bfd_size_type rel_size) { bfd *dynobj; struct sunos_link_hash_entry **sym_hashes; @@ -1836,8 +1493,8 @@ sunos_scan_ext_relocs (info, abfd, sec, relocs, rel_size) 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; + if (sgot->size == 0) + sgot->size = BYTES_IN_WORD; sunos_hash_table (info)->got_needed = TRUE; } @@ -1846,23 +1503,20 @@ sunos_scan_ext_relocs (info, abfd, sec, relocs, rel_size) if (h->got_offset != 0) continue; - h->got_offset = sgot->_raw_size; + h->got_offset = sgot->size; } else { if (r_index >= bfd_get_symcount (abfd)) - { - /* This is abnormal, but should be caught in the - relocation phase. */ - continue; - } + /* This is abnormal, but should be caught in the + relocation phase. */ + continue; if (adata (abfd).local_got_offsets == NULL) { amt = bfd_get_symcount (abfd); amt *= sizeof (bfd_vma); - adata (abfd).local_got_offsets = - (bfd_vma *) bfd_zalloc (abfd, amt); + adata (abfd).local_got_offsets = bfd_zalloc (abfd, amt); if (adata (abfd).local_got_offsets == NULL) return FALSE; } @@ -1870,10 +1524,10 @@ sunos_scan_ext_relocs (info, abfd, sec, relocs, rel_size) if (adata (abfd).local_got_offsets[r_index] != 0) continue; - adata (abfd).local_got_offsets[r_index] = sgot->_raw_size; + adata (abfd).local_got_offsets[r_index] = sgot->size; } - sgot->_raw_size += BYTES_IN_WORD; + sgot->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 @@ -1882,7 +1536,7 @@ sunos_scan_ext_relocs (info, abfd, sec, relocs, rel_size) || (h != NULL && (h->flags & SUNOS_DEF_DYNAMIC) != 0 && (h->flags & SUNOS_DEF_REGULAR) == 0)) - srel->_raw_size += RELOC_EXT_SIZE; + srel->size += RELOC_EXT_SIZE; continue; } @@ -1907,7 +1561,7 @@ sunos_scan_ext_relocs (info, abfd, sec, relocs, rel_size) BFD_ASSERT (splt != NULL && sgot != NULL && srel != NULL); } - srel->_raw_size += RELOC_EXT_SIZE; + srel->size += RELOC_EXT_SIZE; } continue; @@ -1954,8 +1608,8 @@ sunos_scan_ext_relocs (info, abfd, sec, relocs, rel_size) 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; + if (sgot->size == 0) + sgot->size = BYTES_IN_WORD; sunos_hash_table (info)->got_needed = TRUE; } @@ -1976,11 +1630,10 @@ sunos_scan_ext_relocs (info, abfd, sec, relocs, rel_size) 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; - } + /* Presumably this symbol was marked as being undefined by + an earlier reloc. */ + srel->size += RELOC_EXT_SIZE; + else if (r_type != RELOC_JMP_TBL && (h->root.root.u.def.section->flags & SEC_CODE) == 0) { @@ -1989,7 +1642,7 @@ sunos_scan_ext_relocs (info, abfd, sec, relocs, rel_size) /* 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; + srel->size += RELOC_EXT_SIZE; if ((h->flags & SUNOS_DEF_REGULAR) == 0) { sub = h->root.root.u.def.section->owner; @@ -2006,44 +1659,106 @@ sunos_scan_ext_relocs (info, abfd, sec, relocs, rel_size) 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 (splt->size == 0) + splt->size = SPARC_PLT_ENTRY_SIZE; + h->plt_offset = splt->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; + h->root.root.u.def.value = splt->size; } - splt->_raw_size += SPARC_PLT_ENTRY_SIZE; + splt->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; + srel->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; + srel->size += RELOC_EXT_SIZE; } } return TRUE; } +/* Scan the relocs for an input section. */ + +static bfd_boolean +sunos_scan_relocs (struct bfd_link_info *info, + bfd *abfd, + asection *sec, + bfd_size_type rel_size) +{ + void * relocs; + void * free_relocs = NULL; + + if (rel_size == 0) + return TRUE; + + if (! info->keep_memory) + relocs = free_relocs = bfd_malloc (rel_size); + else + { + struct aout_section_data_struct *n; + bfd_size_type amt = sizeof (struct aout_section_data_struct); + + n = bfd_alloc (abfd, amt); + if (n == NULL) + relocs = NULL; + else + { + set_aout_section_data (sec, n); + relocs = bfd_malloc (rel_size); + aout_section_data (sec)->relocs = relocs; + } + } + if (relocs == NULL) + return FALSE; + + if (bfd_seek (abfd, sec->rel_filepos, SEEK_SET) != 0 + || bfd_bread (relocs, 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; +} + /* 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 bfd_boolean -sunos_scan_dynamic_symbol (h, data) - struct sunos_link_hash_entry *h; - PTR data; +sunos_scan_dynamic_symbol (struct sunos_link_hash_entry *h, void * data) { struct bfd_link_info *info = (struct bfd_link_info *) data; @@ -2067,7 +1782,6 @@ sunos_scan_dynamic_symbol (h, data) /* 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) @@ -2118,15 +1832,14 @@ sunos_scan_dynamic_symbol (h, data) 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); + contents = bfd_realloc (s->contents, s->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; + h->dynstr_index = s->size; + strcpy ((char *) contents + s->size, h->root.root.root.string); + s->size += len + 1; /* Add it to the dynamic hash table. */ name = (unsigned char *) h->root.root.root.string; @@ -2149,25 +1862,245 @@ sunos_scan_dynamic_symbol (h, data) (s->contents + hash * HASH_ENTRY_SIZE + BYTES_IN_WORD)); - PUT_WORD (dynobj, s->_raw_size / HASH_ENTRY_SIZE, + PUT_WORD (dynobj, s->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; + PUT_WORD (dynobj, h->dynindx, s->contents + s->size); + PUT_WORD (dynobj, next, s->contents + s->size + BYTES_IN_WORD); + s->size += HASH_ENTRY_SIZE; } } 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. */ + +bfd_boolean +bfd_sunos_size_dynamic_sections (bfd *output_bfd, + struct bfd_link_info *info, + asection **sdynptr, + asection **sneedptr, + asection **srulesptr) +{ + bfd *dynobj; + bfd_size_type dynsymcount; + struct sunos_link_hash_entry *h; + asection *s; + size_t bucketcount; + bfd_size_type hashalloc; + size_t i; + bfd *sub; + + *sdynptr = NULL; + *sneedptr = NULL; + *srulesptr = NULL; + + if (info->relocatable) + 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->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->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->size = dynsymcount * sizeof (struct external_nlist); + s->contents = bfd_alloc (output_bfd, s->size); + if (s->contents == NULL && s->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_zalloc (dynobj, hashalloc); + if (s->contents == NULL && dynsymcount > 0) + return FALSE; + for (i = 0; i < bucketcount; i++) + PUT_WORD (output_bfd, (bfd_vma) -1, s->contents + i * HASH_ENTRY_SIZE); + s->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, + (void *) 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->size & 7) != 0) + { + bfd_size_type add; + bfd_byte *contents; + + add = 8 - (s->size & 7); + contents = bfd_realloc (s->contents, s->size + add); + if (contents == NULL) + return FALSE; + memset (contents + s->size, 0, (size_t) add); + s->contents = contents; + s->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->size != 0) + { + s->contents = bfd_alloc (dynobj, s->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->size != 0) + { + s->contents = bfd_alloc (dynobj, s->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_alloc (dynobj, s->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; +} + /* 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. */ static bfd_boolean -sunos_link_dynamic_object (info, abfd) - struct bfd_link_info *info ATTRIBUTE_UNUSED; - bfd *abfd ATTRIBUTE_UNUSED; +sunos_link_dynamic_object (struct bfd_link_info *info ATTRIBUTE_UNUSED, + bfd *abfd ATTRIBUTE_UNUSED) { return TRUE; } @@ -2176,10 +2109,9 @@ sunos_link_dynamic_object (info, abfd) over the symbol table. */ static bfd_boolean -sunos_write_dynamic_symbol (output_bfd, info, harg) - bfd *output_bfd; - struct bfd_link_info *info; - struct aout_link_hash_entry *harg; +sunos_write_dynamic_symbol (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; @@ -2254,7 +2186,7 @@ sunos_write_dynamic_symbol (output_bfd, info, harg) { BFD_ASSERT (h->dynindx >= 0); BFD_ASSERT (s->reloc_count * obj_reloc_entry_size (dynobj) - < s->_raw_size); + < s->size); p = s->contents + s->reloc_count * obj_reloc_entry_size (output_bfd); if (obj_reloc_entry_size (output_bfd) == RELOC_STD_SIZE) { @@ -2409,16 +2341,14 @@ sunos_write_dynamic_symbol (output_bfd, info, harg) reloc. */ static bfd_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 ATTRIBUTE_UNUSED; - bfd_boolean *skip; - bfd_vma *relocationp; +sunos_check_dynamic_reloc (struct bfd_link_info *info, + bfd *input_bfd, + asection *input_section, + struct aout_link_hash_entry *harg, + void * reloc, + bfd_byte *contents ATTRIBUTE_UNUSED, + bfd_boolean *skip, + bfd_vma *relocationp) { struct sunos_link_hash_entry *h = (struct sunos_link_hash_entry *) harg; bfd *dynobj; @@ -2561,7 +2491,7 @@ sunos_check_dynamic_reloc (info, input_bfd, input_section, harg, reloc, 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); + < s->size); p = (s->contents + s->reloc_count * obj_reloc_entry_size (dynobj)); @@ -2690,7 +2620,7 @@ sunos_check_dynamic_reloc (info, input_bfd, input_section, harg, reloc, 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); + BFD_ASSERT (s->reloc_count * obj_reloc_entry_size (dynobj) < s->size); p = s->contents + s->reloc_count * obj_reloc_entry_size (dynobj); @@ -2773,9 +2703,7 @@ sunos_check_dynamic_reloc (info, input_bfd, input_section, harg, reloc, /* Finish up the dynamic linking information. */ static bfd_boolean -sunos_finish_dynamic_link (abfd, info) - bfd *abfd; - struct bfd_link_info *info; +sunos_finish_dynamic_link (bfd *abfd, struct bfd_link_info *info) { bfd *dynobj; asection *o; @@ -2796,7 +2724,7 @@ sunos_finish_dynamic_link (abfd, info) 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) + if (s != NULL && s->size != 0) { file_ptr filepos; bfd_byte *p; @@ -2820,7 +2748,7 @@ sunos_finish_dynamic_link (abfd, info) 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) + if (info->shared || sdyn->size == 0) PUT_WORD (dynobj, 0, s->contents); else PUT_WORD (dynobj, sdyn->output_section->vma + sdyn->output_offset, @@ -2836,12 +2764,12 @@ sunos_finish_dynamic_link (abfd, info) if (! bfd_set_section_contents (abfd, o->output_section, o->contents, (file_ptr) o->output_offset, - o->_raw_size)) + o->size)) return FALSE; } } - if (sdyn->_raw_size > 0) + if (sdyn->size > 0) { struct external_sun4_dynamic esd; struct external_sun4_dynamic_link esdl; @@ -2867,14 +2795,14 @@ sunos_finish_dynamic_link (abfd, info) PUT_WORD (dynobj, (bfd_vma) 0, esdl.ld_loaded); s = bfd_get_section_by_name (dynobj, ".need"); - if (s == NULL || s->_raw_size == 0) + if (s == NULL || s->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) + if (s == NULL || s->size == 0) PUT_WORD (dynobj, (bfd_vma) 0, esdl.ld_rules); else PUT_WORD (dynobj, s->output_section->filepos + s->output_offset, @@ -2889,12 +2817,12 @@ sunos_finish_dynamic_link (abfd, info) 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); + PUT_WORD (dynobj, s->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); + == s->size); PUT_WORD (dynobj, s->output_section->filepos + s->output_offset, esdl.ld_rel); @@ -2917,13 +2845,13 @@ sunos_finish_dynamic_link (abfd, info) 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); + PUT_WORD (dynobj, s->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), + BFD_ALIGN (obj_textsec (abfd)->size, 0x2000), esdl.ld_text); pos = sdyn->output_offset; diff --git a/contrib/binutils/bfd/syms.c b/contrib/binutils/bfd/syms.c index c07f48b4a9a..0ff94164ed5 100644 --- a/contrib/binutils/bfd/syms.c +++ b/contrib/binutils/bfd/syms.c @@ -1,6 +1,6 @@ /* Generic symbol-table support for the BFD library. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003 + 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Written by Cygnus Support. @@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* SECTION @@ -355,7 +355,7 @@ bfd_is_local_label (bfd *abfd, asymbol *sym) /* The BSF_SECTION_SYM check is needed for IA-64, where every label that starts with '.' is local. This would accidentally catch section names if we didn't reject them here. */ - if ((sym->flags & (BSF_GLOBAL | BSF_WEAK | BSF_SECTION_SYM)) != 0) + if ((sym->flags & (BSF_GLOBAL | BSF_WEAK | BSF_FILE | BSF_SECTION_SYM)) != 0) return FALSE; if (sym->name == NULL) return FALSE; @@ -380,6 +380,23 @@ DESCRIPTION . */ +/* +FUNCTION + bfd_is_target_special_symbol + +SYNOPSIS + bfd_boolean bfd_is_target_special_symbol (bfd *abfd, asymbol *sym); + +DESCRIPTION + Return TRUE iff a symbol @var{sym} in the BFD @var{abfd} is something + special to the particular target represented by the BFD. Such symbols + should normally not be mentioned to the user. + +.#define bfd_is_target_special_symbol(abfd, sym) \ +. BFD_SEND (abfd, _bfd_is_target_special_symbol, (abfd, sym)) +. +*/ + /* FUNCTION bfd_canonicalize_symtab @@ -934,8 +951,12 @@ _bfd_stab_section_find_nearest_line (bfd *abfd, return TRUE; } - stabsize = info->stabsec->_raw_size; - strsize = info->strsec->_raw_size; + stabsize = (info->stabsec->rawsize + ? info->stabsec->rawsize + : info->stabsec->size); + strsize = (info->strsec->rawsize + ? info->strsec->rawsize + : info->strsec->size); } else { @@ -965,8 +986,12 @@ _bfd_stab_section_find_nearest_line (bfd *abfd, return TRUE; } - stabsize = info->stabsec->_raw_size; - strsize = info->strsec->_raw_size; + stabsize = (info->stabsec->rawsize + ? info->stabsec->rawsize + : info->stabsec->size); + strsize = (info->strsec->rawsize + ? info->strsec->rawsize + : info->strsec->size); info->stabs = bfd_alloc (abfd, stabsize); info->strs = bfd_alloc (abfd, strsize); @@ -974,9 +999,9 @@ _bfd_stab_section_find_nearest_line (bfd *abfd, return FALSE; if (! bfd_get_section_contents (abfd, info->stabsec, info->stabs, - (bfd_vma) 0, stabsize) + 0, stabsize) || ! bfd_get_section_contents (abfd, info->strsec, info->strs, - (bfd_vma) 0, strsize)) + 0, strsize)) return FALSE; /* If this is a relocatable object file, we have to relocate @@ -1008,6 +1033,10 @@ _bfd_stab_section_find_nearest_line (bfd *abfd, asymbol *sym; r = *pr; + /* Ignore R_*_NONE relocs. */ + if (r->howto->dst_mask == 0) + continue; + if (r->howto->rightshift != 0 || r->howto->size != 2 || r->howto->bitsize != 32 diff --git a/contrib/binutils/bfd/sysdep.h b/contrib/binutils/bfd/sysdep.h index 195447056a3..f6313d3905c 100644 --- a/contrib/binutils/bfd/sysdep.h +++ b/contrib/binutils/bfd/sysdep.h @@ -17,7 +17,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef BFD_SYSDEP_H #define BFD_SYSDEP_H @@ -39,6 +39,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ extern int errno; #endif +#ifdef STRING_WITH_STRINGS +#include +#include +#else #ifdef HAVE_STRING_H #include #else @@ -49,6 +53,7 @@ extern char *strchr (); extern char *strrchr (); #endif #endif +#endif #ifdef HAVE_STDLIB_H #include @@ -105,26 +110,58 @@ extern char *strrchr (); #include "filenames.h" -#ifdef NEED_DECLARATION_STRSTR -extern char *strstr (); +#if !HAVE_DECL_FFS +extern int ffs (int); #endif -#ifdef NEED_DECLARATION_MALLOC -extern PTR malloc (); -#endif - -#ifdef NEED_DECLARATION_REALLOC -extern PTR realloc (); -#endif - -#ifdef NEED_DECLARATION_FREE +#if !HAVE_DECL_FREE extern void free (); #endif -#ifdef NEED_DECLARATION_GETENV +#if !HAVE_DECL_GETENV extern char *getenv (); #endif +#if !HAVE_DECL_MALLOC +extern PTR malloc (); +#endif + +#if !HAVE_DECL_REALLOC +extern PTR realloc (); +#endif + +#if !HAVE_DECL_STPCPY +extern char *stpcpy (char *__dest, const char *__src); +#endif + +#if !HAVE_DECL_STRSTR +extern char *strstr (); +#endif + +#ifdef HAVE_FTELLO +#if !HAVE_DECL_FTELLO +extern off_t ftello (FILE *stream); +#endif +#endif + +#ifdef HAVE_FTELLO64 +#if !HAVE_DECL_FTELLO64 +extern off64_t ftello64 (FILE *stream); +#endif +#endif + +#ifdef HAVE_FSEEKO +#if !HAVE_DECL_FSEEKO +extern int fseeko (FILE *stream, off_t offset, int whence); +#endif +#endif + +#ifdef HAVE_FSEEKO64 +#if !HAVE_DECL_FSEEKO64 +extern int fseeko64 (FILE *stream, off64_t offset, int whence); +#endif +#endif + /* Define offsetof for those systems which lack it */ #ifndef offsetof diff --git a/contrib/binutils/bfd/targets.c b/contrib/binutils/bfd/targets.c index 0c1c1ddde74..3b04f60a4bf 100644 --- a/contrib/binutils/bfd/targets.c +++ b/contrib/binutils/bfd/targets.c @@ -1,6 +1,6 @@ /* Generic target-file-type support for the BFD library. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004 + 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. Written by Cygnus Support. @@ -18,13 +18,21 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" #include "libbfd.h" #include "fnmatch.h" +/* + It's okay to see some: +#if 0 + directives in this source file, as targets.c uses them to exclude + certain BFD vectors. This comment is specially formatted to catch + users who grep for ^#if 0, so please keep it this way! +*/ + /* SECTION Targets @@ -201,7 +209,7 @@ DESCRIPTION . unsigned short ar_max_namelen; . . {* Entries for byte swapping for data. These are different from the -. other entry points, since they don't take a BFD asthe first argument. +. other entry points, since they don't take a BFD as the first argument. . Certain other handlers could do the same. *} . bfd_uint64_t (*bfd_getx64) (const void *); . bfd_int64_t (*bfd_getx_signed_64) (const void *); @@ -263,8 +271,10 @@ BFD_JUMP_TABLE macros. .#define BFD_JUMP_TABLE_COPY(NAME) \ . NAME##_bfd_copy_private_bfd_data, \ . NAME##_bfd_merge_private_bfd_data, \ +. _bfd_generic_init_private_section_data, \ . NAME##_bfd_copy_private_section_data, \ . NAME##_bfd_copy_private_symbol_data, \ +. NAME##_bfd_copy_private_header_data, \ . NAME##_bfd_set_private_flags, \ . NAME##_bfd_print_private_bfd_data . @@ -274,6 +284,12 @@ BFD_JUMP_TABLE macros. . {* Called to merge BFD general private data from one object file . to a common output file when linking. *} . bfd_boolean (*_bfd_merge_private_bfd_data) (bfd *, bfd *); +. {* Called to initialize BFD private section data from one object file +. to another. *} +.#define bfd_init_private_section_data(ibfd, isec, obfd, osec, link_info) \ +. BFD_SEND (obfd, _bfd_init_private_section_data, (ibfd, isec, obfd, osec, link_info)) +. bfd_boolean (*_bfd_init_private_section_data) +. (bfd *, sec_ptr, bfd *, sec_ptr, struct bfd_link_info *); . {* Called to copy BFD private section data from one object file . to another. *} . bfd_boolean (*_bfd_copy_private_section_data) @@ -282,6 +298,10 @@ BFD_JUMP_TABLE macros. . to another. *} . bfd_boolean (*_bfd_copy_private_symbol_data) . (bfd *, asymbol *, bfd *, asymbol *); +. {* Called to copy BFD private header data from one object file +. to another. *} +. bfd_boolean (*_bfd_copy_private_header_data) +. (bfd *, bfd *); . {* Called to set private backend flags. *} . bfd_boolean (*_bfd_set_private_flags) (bfd *, flagword); . @@ -333,8 +353,11 @@ BFD_JUMP_TABLE macros. . NAME##_print_symbol, \ . NAME##_get_symbol_info, \ . NAME##_bfd_is_local_label_name, \ +. NAME##_bfd_is_target_special_symbol, \ . NAME##_get_lineno, \ . NAME##_find_nearest_line, \ +. _bfd_generic_find_line, \ +. NAME##_find_inliner_info, \ . NAME##_bfd_make_debug_symbol, \ . NAME##_read_minisymbols, \ . NAME##_minisymbol_to_symbol @@ -351,11 +374,16 @@ BFD_JUMP_TABLE macros. . (bfd *, struct bfd_symbol *, symbol_info *); .#define bfd_get_symbol_info(b,p,e) BFD_SEND (b, _bfd_get_symbol_info, (b,p,e)) . bfd_boolean (*_bfd_is_local_label_name) (bfd *, const char *); -. +. bfd_boolean (*_bfd_is_target_special_symbol) (bfd *, asymbol *); . alent * (*_get_lineno) (bfd *, struct bfd_symbol *); . bfd_boolean (*_bfd_find_nearest_line) . (bfd *, struct bfd_section *, struct bfd_symbol **, bfd_vma, . const char **, const char **, unsigned int *); +. bfd_boolean (*_bfd_find_line) +. (bfd *, struct bfd_symbol **, struct bfd_symbol *, +. const char **, unsigned int *); +. bfd_boolean (*_bfd_find_inliner_info) +. (bfd *, const char **, const char **, unsigned int *); . {* Back-door to allow format-aware applications to create debug symbols . while using BFD for everything else. Currently used by the assembler . when creating COFF files. *} @@ -406,7 +434,9 @@ BFD_JUMP_TABLE macros. . NAME##_bfd_link_split_section, \ . NAME##_bfd_gc_sections, \ . NAME##_bfd_merge_sections, \ -. NAME##_bfd_discard_group +. NAME##_bfd_is_group_section, \ +. NAME##_bfd_discard_group, \ +. NAME##_section_already_linked \ . . int (*_bfd_sizeof_headers) (bfd *, bfd_boolean); . bfd_byte * (*_bfd_get_relocated_section_contents) @@ -443,13 +473,21 @@ BFD_JUMP_TABLE macros. . {* Attempt to merge SEC_MERGE sections. *} . bfd_boolean (*_bfd_merge_sections) (bfd *, struct bfd_link_info *); . +. {* Is this section a member of a group? *} +. bfd_boolean (*_bfd_is_group_section) (bfd *, const struct bfd_section *); +. . {* Discard members of a group. *} . bfd_boolean (*_bfd_discard_group) (bfd *, struct bfd_section *); . +. {* Check if SEC has been already linked during a reloceatable or +. final link. *} +. void (*_section_already_linked) (bfd *, struct bfd_section *); +. . {* Routines to handle dynamic symbols and relocs. *} .#define BFD_JUMP_TABLE_DYNAMIC(NAME) \ . NAME##_get_dynamic_symtab_upper_bound, \ . NAME##_canonicalize_dynamic_symtab, \ +. NAME##_get_synthetic_symtab, \ . NAME##_get_dynamic_reloc_upper_bound, \ . NAME##_canonicalize_dynamic_reloc . @@ -458,6 +496,10 @@ BFD_JUMP_TABLE macros. . {* Read in the dynamic symbols. *} . long (*_bfd_canonicalize_dynamic_symtab) . (bfd *, struct bfd_symbol **); +. {* Create synthetized symbols. *} +. long (*_bfd_get_synthetic_symtab) +. (bfd *, long, struct bfd_symbol **, long, struct bfd_symbol **, +. struct bfd_symbol **); . {* Get the amount of memory required to hold the dynamic relocs. *} . long (*_bfd_get_dynamic_reloc_upper_bound) (bfd *); . {* Read in the dynamic relocs. *} @@ -487,7 +529,6 @@ to find an alternative output format that is suitable. Alphabetized for easy reference. They are listed a second time below, since we can't intermix extern's and initializers. */ -extern const bfd_target a29kcoff_big_vec; extern const bfd_target a_out_adobe_vec; extern const bfd_target aix5coff64_vec; extern const bfd_target aout0_big_vec; @@ -513,12 +554,18 @@ extern const bfd_target bfd_efi_app_ia32_vec; extern const bfd_target bfd_efi_app_x86_64_vec; extern const bfd_target bfd_efi_app_ia64_vec; extern const bfd_target bfd_elf32_avr_vec; +extern const bfd_target bfd_elf32_bfin_vec; +extern const bfd_target bfd_elf32_bfinfdpic_vec; extern const bfd_target bfd_elf32_big_generic_vec; extern const bfd_target bfd_elf32_bigarc_vec; -extern const bfd_target bfd_elf32_bigarm_oabi_vec; extern const bfd_target bfd_elf32_bigarm_vec; +extern const bfd_target bfd_elf32_bigarm_symbian_vec; +extern const bfd_target bfd_elf32_bigarm_vxworks_vec; extern const bfd_target bfd_elf32_bigmips_vec; +extern const bfd_target bfd_elf32_bigmips_vxworks_vec; +extern const bfd_target bfd_elf32_cr16c_vec; extern const bfd_target bfd_elf32_cris_vec; +extern const bfd_target bfd_elf32_crx_vec; extern const bfd_target bfd_elf32_d10v_vec; extern const bfd_target bfd_elf32_d30v_vec; extern const bfd_target bfd_elf32_dlx_big_vec; @@ -531,6 +578,7 @@ extern const bfd_target bfd_elf32_hppa_nbsd_vec; extern const bfd_target bfd_elf32_hppa_vec; extern const bfd_target bfd_elf32_i370_vec; extern const bfd_target bfd_elf32_i386_freebsd_vec; +extern const bfd_target bfd_elf32_i386_vxworks_vec; extern const bfd_target bfd_elf32_i386_vec; extern const bfd_target bfd_elf32_i860_little_vec; extern const bfd_target bfd_elf32_i860_vec; @@ -541,9 +589,12 @@ extern const bfd_target bfd_elf32_ip2k_vec; extern const bfd_target bfd_elf32_iq2000_vec; extern const bfd_target bfd_elf32_little_generic_vec; extern const bfd_target bfd_elf32_littlearc_vec; -extern const bfd_target bfd_elf32_littlearm_oabi_vec; extern const bfd_target bfd_elf32_littlearm_vec; +extern const bfd_target bfd_elf32_littlearm_symbian_vec; +extern const bfd_target bfd_elf32_littlearm_vxworks_vec; extern const bfd_target bfd_elf32_littlemips_vec; +extern const bfd_target bfd_elf32_littlemips_vxworks_vec; +extern const bfd_target bfd_elf32_m32c_vec; extern const bfd_target bfd_elf32_m32r_vec; extern const bfd_target bfd_elf32_m32rle_vec; extern const bfd_target bfd_elf32_m32rlin_vec; @@ -556,6 +607,7 @@ extern const bfd_target bfd_elf32_mcore_big_vec; extern const bfd_target bfd_elf32_mcore_little_vec; extern const bfd_target bfd_elf32_mn10200_vec; extern const bfd_target bfd_elf32_mn10300_vec; +extern const bfd_target bfd_elf32_mt_vec; extern const bfd_target bfd_elf32_msp430_vec; extern const bfd_target bfd_elf32_nbigmips_vec; extern const bfd_target bfd_elf32_nlittlemips_vec; @@ -567,6 +619,7 @@ extern const bfd_target bfd_elf32_pj_vec; extern const bfd_target bfd_elf32_pjl_vec; extern const bfd_target bfd_elf32_powerpc_vec; extern const bfd_target bfd_elf32_powerpcle_vec; +extern const bfd_target bfd_elf32_powerpc_vxworks_vec; extern const bfd_target bfd_elf32_s390_vec; extern const bfd_target bfd_elf32_sh64_vec; extern const bfd_target bfd_elf32_sh64l_vec; @@ -577,15 +630,18 @@ extern const bfd_target bfd_elf32_sh64nbsd_vec; extern const bfd_target bfd_elf32_sh_vec; extern const bfd_target bfd_elf32_shblin_vec; extern const bfd_target bfd_elf32_shl_vec; +extern const bfd_target bfd_elf32_shl_symbian_vec; extern const bfd_target bfd_elf32_shlin_vec; extern const bfd_target bfd_elf32_shlnbsd_vec; extern const bfd_target bfd_elf32_shnbsd_vec; extern const bfd_target bfd_elf32_sparc_vec; +extern const bfd_target bfd_elf32_sparc_vxworks_vec; extern const bfd_target bfd_elf32_tradbigmips_vec; extern const bfd_target bfd_elf32_tradlittlemips_vec; extern const bfd_target bfd_elf32_us_cris_vec; extern const bfd_target bfd_elf32_v850_vec; extern const bfd_target bfd_elf32_vax_vec; +extern const bfd_target bfd_elf32_xc16x_vec; extern const bfd_target bfd_elf32_xstormy16_vec; extern const bfd_target bfd_elf32_xtensa_be_vec; extern const bfd_target bfd_elf32_xtensa_le_vec; @@ -655,15 +711,15 @@ extern const bfd_target m68kaux_coff_vec; extern const bfd_target m68kcoff_vec; extern const bfd_target m68kcoffun_vec; extern const bfd_target m68klinux_vec; -extern const bfd_target m68klynx_aout_vec; -extern const bfd_target m68klynx_coff_vec; extern const bfd_target m68knetbsd_vec; extern const bfd_target m68ksysvcoff_vec; extern const bfd_target m88kbcs_vec; extern const bfd_target m88kmach3_vec; +extern const bfd_target m88kopenbsd_vec; extern const bfd_target mach_o_be_vec; extern const bfd_target mach_o_le_vec; extern const bfd_target mach_o_fat_vec; +extern const bfd_target maxqcoff_vec; extern const bfd_target mcore_pe_big_vec; extern const bfd_target mcore_pe_little_vec; extern const bfd_target mcore_pei_big_vec; @@ -725,6 +781,7 @@ extern const bfd_target vms_alpha_vec; extern const bfd_target vms_vax_vec; extern const bfd_target w65_vec; extern const bfd_target we32kcoff_vec; +extern const bfd_target z80coff_vec; extern const bfd_target z8kcoff_vec; /* These are always included. */ @@ -765,7 +822,6 @@ static const bfd_target * const _bfd_target_vector[] = { Vectors that don't compile on all systems, or aren't finished, should have an entry here with #if 0 around it, to show that it wasn't omitted by mistake. */ - &a29kcoff_big_vec, &a_out_adobe_vec, #ifdef BFD64 &aix5coff64_vec, @@ -801,6 +857,8 @@ static const bfd_target * const _bfd_target_vector[] = { &bfd_efi_app_ia64_vec, #endif &bfd_elf32_avr_vec, + &bfd_elf32_bfin_vec, + &bfd_elf32_bfinfdpic_vec, /* This, and other vectors, may not be used in any *.mt configuration. But that does not mean they are unnecessary. If configured with @@ -808,10 +866,14 @@ static const bfd_target * const _bfd_target_vector[] = { the file even if we don't recognize the machine type. */ &bfd_elf32_big_generic_vec, &bfd_elf32_bigarc_vec, - &bfd_elf32_bigarm_oabi_vec, &bfd_elf32_bigarm_vec, + &bfd_elf32_bigarm_symbian_vec, + &bfd_elf32_bigarm_vxworks_vec, &bfd_elf32_bigmips_vec, + &bfd_elf32_bigmips_vxworks_vec, + &bfd_elf32_cr16c_vec, &bfd_elf32_cris_vec, + &bfd_elf32_crx_vec, &bfd_elf32_d10v_vec, &bfd_elf32_d30v_vec, &bfd_elf32_dlx_big_vec, @@ -824,6 +886,7 @@ static const bfd_target * const _bfd_target_vector[] = { &bfd_elf32_hppa_vec, &bfd_elf32_i370_vec, &bfd_elf32_i386_freebsd_vec, + &bfd_elf32_i386_vxworks_vec, &bfd_elf32_i386_vec, &bfd_elf32_i860_little_vec, &bfd_elf32_i860_vec, @@ -831,14 +894,19 @@ static const bfd_target * const _bfd_target_vector[] = { #if 0 &bfd_elf32_ia64_big_vec, #endif +#ifdef BFD64 &bfd_elf32_ia64_hpux_big_vec, +#endif &bfd_elf32_ip2k_vec, &bfd_elf32_iq2000_vec, &bfd_elf32_little_generic_vec, &bfd_elf32_littlearc_vec, - &bfd_elf32_littlearm_oabi_vec, &bfd_elf32_littlearm_vec, + &bfd_elf32_littlearm_symbian_vec, + &bfd_elf32_littlearm_vxworks_vec, &bfd_elf32_littlemips_vec, + &bfd_elf32_littlemips_vxworks_vec, + &bfd_elf32_m32c_vec, &bfd_elf32_m32r_vec, &bfd_elf32_m32rle_vec, &bfd_elf32_m32rlin_vec, @@ -851,6 +919,7 @@ static const bfd_target * const _bfd_target_vector[] = { &bfd_elf32_mcore_little_vec, &bfd_elf32_mn10200_vec, &bfd_elf32_mn10300_vec, + &bfd_elf32_mt_vec, &bfd_elf32_msp430_vec, #ifdef BFD64 &bfd_elf32_nbigmips_vec, @@ -863,11 +932,13 @@ static const bfd_target * const _bfd_target_vector[] = { &bfd_elf32_pj_vec, &bfd_elf32_pjl_vec, &bfd_elf32_powerpc_vec, + &bfd_elf32_powerpc_vxworks_vec, &bfd_elf32_powerpcle_vec, &bfd_elf32_s390_vec, &bfd_elf32_sh_vec, &bfd_elf32_shblin_vec, &bfd_elf32_shl_vec, + &bfd_elf32_shl_symbian_vec, &bfd_elf32_shlin_vec, &bfd_elf32_shlnbsd_vec, &bfd_elf32_shnbsd_vec, @@ -880,11 +951,13 @@ static const bfd_target * const _bfd_target_vector[] = { &bfd_elf32_sh64blin_vec, #endif &bfd_elf32_sparc_vec, + &bfd_elf32_sparc_vxworks_vec, &bfd_elf32_tradbigmips_vec, &bfd_elf32_tradlittlemips_vec, &bfd_elf32_us_cris_vec, &bfd_elf32_v850_vec, &bfd_elf32_vax_vec, + &bfd_elf32_xc16x_vec, &bfd_elf32_xstormy16_vec, &bfd_elf32_xtensa_be_vec, &bfd_elf32_xtensa_le_vec, @@ -914,7 +987,7 @@ static const bfd_target * const _bfd_target_vector[] = { &bfd_elf64_tradbigmips_vec, &bfd_elf64_tradlittlemips_vec, &bfd_elf64_x86_64_vec, - &bfd_mmo_vec, + &bfd_mmo_vec, #endif &bfd_powerpc_pe_vec, &bfd_powerpc_pei_vec, @@ -980,15 +1053,15 @@ static const bfd_target * const _bfd_target_vector[] = { which kind of a.out file it is. */ &m68klinux_vec, #endif - &m68klynx_aout_vec, - &m68klynx_coff_vec, &m68knetbsd_vec, &m68ksysvcoff_vec, &m88kbcs_vec, &m88kmach3_vec, + &m88kopenbsd_vec, &mach_o_be_vec, &mach_o_le_vec, &mach_o_fat_vec, + &maxqcoff_vec, &mcore_pe_big_vec, &mcore_pe_little_vec, &mcore_pei_big_vec, @@ -1067,6 +1140,7 @@ static const bfd_target * const _bfd_target_vector[] = { &vms_vax_vec, &w65_vec, &we32kcoff_vec, + &z80coff_vec, &z8kcoff_vec, &bfd_elf32_am33lin_vec, #endif /* not SELECT_VECS */ diff --git a/contrib/binutils/bfd/tekhex.c b/contrib/binutils/bfd/tekhex.c index f828fe7393c..afe42cc948a 100644 --- a/contrib/binutils/bfd/tekhex.c +++ b/contrib/binutils/bfd/tekhex.c @@ -1,29 +1,28 @@ /* BFD backend for Extended Tektronix Hex Format objects. - Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003 - Free Software Foundation, Inc. + Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, + 2003, 2004 Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support . -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -/* -SUBSECTION +/* SUBSECTION Tektronix Hex Format handling -DESCRIPTION + DESCRIPTION Tek Hex records can hold symbols and data, but not relocations. Their main application is communication with @@ -50,10 +49,10 @@ DESCRIPTION up and output them when it's time to close the bfd. A TekHex record looks like: -EXAMPLE + EXAMPLE % -DESCRIPTION + DESCRIPTION Where o length is the number of bytes in the record not including the % sign. @@ -63,9 +62,8 @@ DESCRIPTION 6) data record 8) termination record -The data can come out of order, and may be discontigous. This is a -serial protocol, so big files are unlikely, so we keep a list of 8k chunks -*/ + The data can come out of order, and may be discontigous. This is a + serial protocol, so big files are unlikely, so we keep a list of 8k chunks. */ #include "bfd.h" #include "sysdep.h" @@ -73,170 +71,136 @@ serial protocol, so big files are unlikely, so we keep a list of 8k chunks #include "libiberty.h" typedef struct - { - bfd_vma low; - bfd_vma high; - } addr_range_type; +{ + bfd_vma low; + bfd_vma high; +} addr_range_type; typedef struct tekhex_symbol_struct - { - - asymbol symbol; - struct tekhex_symbol_struct *prev; - - } tekhex_symbol_type; +{ + asymbol symbol; + struct tekhex_symbol_struct *prev; +} tekhex_symbol_type; static const char digs[] = "0123456789ABCDEF"; static char sum_block[256]; -#define NOT_HEX 20 -#define NIBBLE(x) hex_value(x) -#define HEX(buffer) ((NIBBLE((buffer)[0])<<4) + NIBBLE((buffer)[1])) -#define TOHEX(d,x) \ -(d)[1] = digs[(x) & 0xf]; \ -(d)[0] = digs[((x)>>4)&0xf]; -#define ISHEX(x) hex_p(x) +#define NOT_HEX 20 +#define NIBBLE(x) hex_value(x) +#define HEX(buffer) ((NIBBLE ((buffer)[0]) << 4) + NIBBLE ((buffer)[1])) +#define ISHEX(x) hex_p(x) +#define TOHEX(d, x) \ + (d)[1] = digs[(x) & 0xf]; \ + (d)[0] = digs[((x)>>4)&0xf]; -static void tekhex_init PARAMS ((void)); -static bfd_vma getvalue PARAMS ((char **)); -static void tekhex_print_symbol - PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type)); -static void tekhex_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *)); -static asymbol *tekhex_make_empty_symbol PARAMS ((bfd *)); -static int tekhex_sizeof_headers PARAMS ((bfd *, bfd_boolean)); -static bfd_boolean tekhex_write_object_contents PARAMS ((bfd *)); -static void out PARAMS ((bfd *, int, char *, char *)); -static void writesym PARAMS ((char **, const char *)); -static void writevalue PARAMS ((char **, bfd_vma)); -static bfd_boolean tekhex_set_section_contents - PARAMS ((bfd*, sec_ptr, const PTR, file_ptr, bfd_size_type)); -static bfd_boolean tekhex_set_arch_mach - PARAMS ((bfd *, enum bfd_architecture, unsigned long)); -static bfd_boolean tekhex_get_section_contents - PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); -static void move_section_contents - PARAMS ((bfd *, asection *, const PTR, file_ptr, bfd_size_type, bfd_boolean)); -static const bfd_target *tekhex_object_p PARAMS ((bfd *)); -static bfd_boolean tekhex_mkobject PARAMS ((bfd *)); -static long tekhex_get_symtab_upper_bound PARAMS ((bfd *)); -static long tekhex_canonicalize_symtab PARAMS ((bfd *, asymbol **)); -static void pass_over PARAMS ((bfd *, void (*) (bfd*, int, char *))); -static void first_phase PARAMS ((bfd *, int, char *)); -static void insert_byte PARAMS ((bfd *, int, bfd_vma)); -static struct data_struct *find_chunk PARAMS ((bfd *, bfd_vma)); -static unsigned int getsym PARAMS ((char *, char **)); +/* Here's an example + %3A6C6480004E56FFFC4E717063B0AEFFFC6D0652AEFFFC60F24E5E4E75 + %1B3709T_SEGMENT1108FFFFFFFF + %2B3AB9T_SEGMENT7Dgcc_compiled$1087hello$c10 + %373829T_SEGMENT80int$t1$r1$$214741080char$t2$r2$0$12710 + %373769T_SEGMENT80long$int$t3$r1$$1080unsigned$int$t4$10 + %373CA9T_SEGMENT80long$unsigned$in1080short$int$t6$r1$10 + %373049T_SEGMENT80long$long$int$t71080short$unsigned$i10 + %373A29T_SEGMENT80long$long$unsign1080signed$char$t10$10 + %373D69T_SEGMENT80unsigned$char$t11080float$t12$r1$4$010 + %373D19T_SEGMENT80double$t13$r1$8$1080long$double$t14$10 + %2734D9T_SEGMENT8Bvoid$t15$151035_main10 + %2F3CA9T_SEGMENT81$1081$1681$1E81$21487main$F110 + %2832F9T_SEGMENT83i$18FFFFFFFC81$1481$214 + %07 8 10 10 -/* -Here's an example -%3A6C6480004E56FFFC4E717063B0AEFFFC6D0652AEFFFC60F24E5E4E75 -%1B3709T_SEGMENT1108FFFFFFFF -%2B3AB9T_SEGMENT7Dgcc_compiled$1087hello$c10 -%373829T_SEGMENT80int$t1$r1$$214741080char$t2$r2$0$12710 -%373769T_SEGMENT80long$int$t3$r1$$1080unsigned$int$t4$10 -%373CA9T_SEGMENT80long$unsigned$in1080short$int$t6$r1$10 -%373049T_SEGMENT80long$long$int$t71080short$unsigned$i10 -%373A29T_SEGMENT80long$long$unsign1080signed$char$t10$10 -%373D69T_SEGMENT80unsigned$char$t11080float$t12$r1$4$010 -%373D19T_SEGMENT80double$t13$r1$8$1080long$double$t14$10 -%2734D9T_SEGMENT8Bvoid$t15$151035_main10 -%2F3CA9T_SEGMENT81$1081$1681$1E81$21487main$F110 -%2832F9T_SEGMENT83i$18FFFFFFFC81$1481$214 -%07 8 10 10 + explanation: + %3A6C6480004E56FFFC4E717063B0AEFFFC6D0652AEFFFC60F24E5E4E75 + ^ ^^ ^ ^-data + | || +------ 4 char integer 0x8000 + | |+-------- checksum + | +--------- type 6 (data record) + +----------- length 3a chars + <---------------------- 3a (58 chars) -------------------> -explanation: -%3A6C6480004E56FFFC4E717063B0AEFFFC6D0652AEFFFC60F24E5E4E75 - ^ ^^ ^ ^-data - | || +------ 4 char integer 0x8000 - | |+-------- checksum - | +--------- type 6 (data record) - +----------- length 3a chars - <---------------------- 3a (58 chars) -------------------> + %1B3709T_SEGMENT1108FFFFFFFF + ^ ^^ ^- 8 character integer 0xffffffff + | |+- 1 character integer 0 + | +-- type 1 symbol (section definition) + +------------ 9 char symbol T_SEGMENT -%1B3709T_SEGMENT1108FFFFFFFF - ^ ^^ ^- 8 character integer 0xffffffff - | |+- 1 character integer 0 - | +-- type 1 symbol (section definition) - +------------ 9 char symbol T_SEGMENT + %2B3AB9T_SEGMENT7Dgcc_compiled$1087hello$c10 + %373829T_SEGMENT80int$t1$r1$$214741080char$t2$r2$0$12710 + %373769T_SEGMENT80long$int$t3$r1$$1080unsigned$int$t4$10 + %373CA9T_SEGMENT80long$unsigned$in1080short$int$t6$r1$10 + %373049T_SEGMENT80long$long$int$t71080short$unsigned$i10 + %373A29T_SEGMENT80long$long$unsign1080signed$char$t10$10 + %373D69T_SEGMENT80unsigned$char$t11080float$t12$r1$4$010 + %373D19T_SEGMENT80double$t13$r1$8$1080long$double$t14$10 + %2734D9T_SEGMENT8Bvoid$t15$151035_main10 + %2F3CA9T_SEGMENT81$1081$1681$1E81$21487main$F110 + %2832F9T_SEGMENT83i$18FFFFFFFC81$1481$214 + %0781010 -%2B3AB9T_SEGMENT7Dgcc_compiled$1087hello$c10 -%373829T_SEGMENT80int$t1$r1$$214741080char$t2$r2$0$12710 -%373769T_SEGMENT80long$int$t3$r1$$1080unsigned$int$t4$10 -%373CA9T_SEGMENT80long$unsigned$in1080short$int$t6$r1$10 -%373049T_SEGMENT80long$long$int$t71080short$unsigned$i10 -%373A29T_SEGMENT80long$long$unsign1080signed$char$t10$10 -%373D69T_SEGMENT80unsigned$char$t11080float$t12$r1$4$010 -%373D19T_SEGMENT80double$t13$r1$8$1080long$double$t14$10 -%2734D9T_SEGMENT8Bvoid$t15$151035_main10 -%2F3CA9T_SEGMENT81$1081$1681$1E81$21487main$F110 -%2832F9T_SEGMENT83i$18FFFFFFFC81$1481$214 -%0781010 + Turns into + sac@thepub$ ./objdump -dx -m m68k f -Turns into -sac@thepub$ ./objdump -dx -m m68k f + f: file format tekhex + -----x--- 9/55728 -134219416 Sep 29 15:13 1995 f + architecture: UNKNOWN!, flags 0x00000010: + HAS_SYMS + start address 0x00000000 + SECTION 0 [D00000000] : size 00020000 vma 00000000 align 2**0 + ALLOC, LOAD + SECTION 1 [D00008000] : size 00002001 vma 00008000 align 2**0 -f: file format tekhex ------x--- 9/55728 -134219416 Sep 29 15:13 1995 f -architecture: UNKNOWN!, flags 0x00000010: -HAS_SYMS -start address 0x00000000 -SECTION 0 [D00000000] : size 00020000 vma 00000000 align 2**0 - ALLOC, LOAD -SECTION 1 [D00008000] : size 00002001 vma 00008000 align 2**0 + SECTION 2 [T_SEGMENT] : size ffffffff vma 00000000 align 2**0 -SECTION 2 [T_SEGMENT] : size ffffffff vma 00000000 align 2**0 + SYMBOL TABLE: + 00000000 g T_SEGMENT gcc_compiled$ + 00000000 g T_SEGMENT hello$c + 00000000 g T_SEGMENT int$t1$r1$$21474 + 00000000 g T_SEGMENT char$t2$r2$0$127 + 00000000 g T_SEGMENT long$int$t3$r1$$ + 00000000 g T_SEGMENT unsigned$int$t4$ + 00000000 g T_SEGMENT long$unsigned$in + 00000000 g T_SEGMENT short$int$t6$r1$ + 00000000 g T_SEGMENT long$long$int$t7 + 00000000 g T_SEGMENT short$unsigned$i + 00000000 g T_SEGMENT long$long$unsign + 00000000 g T_SEGMENT signed$char$t10$ + 00000000 g T_SEGMENT unsigned$char$t1 + 00000000 g T_SEGMENT float$t12$r1$4$0 + 00000000 g T_SEGMENT double$t13$r1$8$ + 00000000 g T_SEGMENT long$double$t14$ + 00000000 g T_SEGMENT void$t15$15 + 00000000 g T_SEGMENT _main + 00000000 g T_SEGMENT $ + 00000000 g T_SEGMENT $ + 00000000 g T_SEGMENT $ + 00000010 g T_SEGMENT $ + 00000000 g T_SEGMENT main$F1 + fcffffff g T_SEGMENT i$1 + 00000000 g T_SEGMENT $ + 00000010 g T_SEGMENT $ -SYMBOL TABLE: -00000000 g T_SEGMENT gcc_compiled$ -00000000 g T_SEGMENT hello$c -00000000 g T_SEGMENT int$t1$r1$$21474 -00000000 g T_SEGMENT char$t2$r2$0$127 -00000000 g T_SEGMENT long$int$t3$r1$$ -00000000 g T_SEGMENT unsigned$int$t4$ -00000000 g T_SEGMENT long$unsigned$in -00000000 g T_SEGMENT short$int$t6$r1$ -00000000 g T_SEGMENT long$long$int$t7 -00000000 g T_SEGMENT short$unsigned$i -00000000 g T_SEGMENT long$long$unsign -00000000 g T_SEGMENT signed$char$t10$ -00000000 g T_SEGMENT unsigned$char$t1 -00000000 g T_SEGMENT float$t12$r1$4$0 -00000000 g T_SEGMENT double$t13$r1$8$ -00000000 g T_SEGMENT long$double$t14$ -00000000 g T_SEGMENT void$t15$15 -00000000 g T_SEGMENT _main -00000000 g T_SEGMENT $ -00000000 g T_SEGMENT $ -00000000 g T_SEGMENT $ -00000010 g T_SEGMENT $ -00000000 g T_SEGMENT main$F1 -fcffffff g T_SEGMENT i$1 -00000000 g T_SEGMENT $ -00000010 g T_SEGMENT $ + RELOCATION RECORDS FOR [D00000000]: (none) -RELOCATION RECORDS FOR [D00000000]: (none) + RELOCATION RECORDS FOR [D00008000]: (none) -RELOCATION RECORDS FOR [D00008000]: (none) + RELOCATION RECORDS FOR [T_SEGMENT]: (none) -RELOCATION RECORDS FOR [T_SEGMENT]: (none) - -Disassembly of section D00000000: -... -00008000 ($+)7ff0 linkw fp,#-4 -00008004 ($+)7ff4 nop -00008006 ($+)7ff6 movel #99,d0 -00008008 ($+)7ff8 cmpl fp@(-4),d0 -0000800c ($+)7ffc blts 00008014 ($+)8004 -0000800e ($+)7ffe addql #1,fp@(-4) -00008012 ($+)8002 bras 00008006 ($+)7ff6 -00008014 ($+)8004 unlk fp -00008016 ($+)8006 rts -... - -*/ + Disassembly of section D00000000: + ... + 00008000 ($+)7ff0 linkw fp,#-4 + 00008004 ($+)7ff4 nop + 00008006 ($+)7ff6 movel #99,d0 + 00008008 ($+)7ff8 cmpl fp@(-4),d0 + 0000800c ($+)7ffc blts 00008014 ($+)8004 + 0000800e ($+)7ffe addql #1,fp@(-4) + 00008012 ($+)8002 bras 00008006 ($+)7ff6 + 00008014 ($+)8004 unlk fp + 00008016 ($+)8006 rts + ... */ static void -tekhex_init () +tekhex_init (void) { unsigned int i; static bfd_boolean inited = FALSE; @@ -248,27 +212,23 @@ tekhex_init () hex_init (); val = 0; for (i = 0; i < 10; i++) - { - sum_block[i + '0'] = val++; - } + sum_block[i + '0'] = val++; + for (i = 'A'; i <= 'Z'; i++) - { - sum_block[i] = val++; - } + sum_block[i] = val++; + sum_block['$'] = val++; sum_block['%'] = val++; sum_block['.'] = val++; sum_block['_'] = val++; for (i = 'a'; i <= 'z'; i++) - { - sum_block[i] = val++; - } + sum_block[i] = val++; } } -/* The maximum number of bytes on a line is FF */ +/* The maximum number of bytes on a line is FF. */ #define MAXCHUNK 0xff -/* The number of bytes we fit onto a line on output */ +/* The number of bytes we fit onto a line on output. */ #define CHUNK 21 /* We cannot output our tekhexords as we see them, we have to glue them @@ -287,12 +247,12 @@ typedef struct tekhex_data_list_struct tekhex_data_list_type; #define CHUNK_MASK 0x1fff struct data_struct - { - char chunk_data[CHUNK_MASK + 1]; - char chunk_init[CHUNK_MASK + 1]; - bfd_vma vma; - struct data_struct *next; - }; +{ + char chunk_data[CHUNK_MASK + 1]; + char chunk_init[CHUNK_MASK + 1]; + bfd_vma vma; + struct data_struct *next; +}; typedef struct tekhex_data_struct { @@ -304,59 +264,65 @@ typedef struct tekhex_data_struct #define enda(x) (x->vma + x->size) -static bfd_vma -getvalue (srcp) - char **srcp; +static bfd_boolean +getvalue (char **srcp, bfd_vma *valuep) { char *src = *srcp; bfd_vma value = 0; - unsigned int len = hex_value(*src++); + unsigned int len; + if (!ISHEX (*src)) + return FALSE; + + len = hex_value (*src++); if (len == 0) len = 16; while (len--) { - value = value << 4 | hex_value(*src++); + if (!ISHEX (*src)) + return FALSE; + value = value << 4 | hex_value (*src++); } + *srcp = src; - return value; + *valuep = value; + return TRUE; } -static unsigned int -getsym (dstp, srcp) - char *dstp; - char **srcp; +static bfd_boolean +getsym (char *dstp, char **srcp, unsigned int *lenp) { char *src = *srcp; unsigned int i; - unsigned int len = hex_value(*src++); + unsigned int len; + + if (!ISHEX (*src)) + return FALSE; + len = hex_value (*src++); if (len == 0) len = 16; for (i = 0; i < len; i++) dstp[i] = src[i]; dstp[i] = 0; *srcp = src + i; - return len; + *lenp = len; + return TRUE; } static struct data_struct * -find_chunk (abfd, vma) - bfd *abfd; - bfd_vma vma; +find_chunk (bfd *abfd, bfd_vma vma) { struct data_struct *d = abfd->tdata.tekhex_data->data; vma &= ~CHUNK_MASK; while (d && (d->vma) != vma) - { - d = d->next; - } + d = d->next; + if (!d) { - /* No chunk for this address, so make one up */ - d = ((struct data_struct *) - bfd_zalloc (abfd, (bfd_size_type) sizeof (struct data_struct))); + /* No chunk for this address, so make one up. */ + d = bfd_zalloc (abfd, (bfd_size_type) sizeof (struct data_struct)); if (!d) return NULL; @@ -369,12 +335,9 @@ find_chunk (abfd, vma) } static void -insert_byte (abfd, value, addr) - bfd *abfd; - int value; - bfd_vma addr; +insert_byte (bfd *abfd, int value, bfd_vma addr) { - /* Find the chunk that this byte needs and put it in */ + /* Find the chunk that this byte needs and put it in. */ struct data_struct *d = find_chunk (abfd, addr); d->chunk_data[addr & CHUNK_MASK] = value; @@ -382,23 +345,25 @@ insert_byte (abfd, value, addr) } /* The first pass is to find the names of all the sections, and see - how big the data is */ -static void -first_phase (abfd, type, src) - bfd *abfd; - int type; - char *src; + how big the data is. */ + +static bfd_boolean +first_phase (bfd *abfd, int type, char *src) { asection *section = bfd_abs_section_ptr; unsigned int len; - char sym[17]; /* A symbol can only be 16chars long */ + bfd_vma val; + char sym[17]; /* A symbol can only be 16chars long. */ switch (type) { case '6': - /* Data record - read it and store it */ + /* Data record - read it and store it. */ { - bfd_vma addr = getvalue (&src); + bfd_vma addr; + + if (!getvalue (&src, &addr)) + return FALSE; while (*src) { @@ -408,17 +373,18 @@ first_phase (abfd, type, src) } } - return; + return TRUE; case '3': - /* Symbol record, read the segment */ - len = getsym (sym, &src); + /* Symbol record, read the segment. */ + if (!getsym (sym, &src, &len)) + return FALSE; section = bfd_get_section_by_name (abfd, sym); - if (section == (asection *) NULL) + if (section == NULL) { char *n = bfd_alloc (abfd, (bfd_size_type) len + 1); if (!n) - abort (); /* FIXME */ + return FALSE; memcpy (n, sym, len + 1); section = bfd_make_section (abfd, n); } @@ -426,10 +392,13 @@ first_phase (abfd, type, src) { switch (*src) { - case '1': /* section range */ + case '1': /* Section range. */ src++; - section->vma = getvalue (&src); - section->_raw_size = getvalue (&src) - section->vma; + if (!getvalue (&src, §ion->vma)) + return FALSE; + if (!getvalue (&src, &val)) + return FALSE; + section->size = val - section->vma; section->flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC; break; case '0': @@ -439,50 +408,54 @@ first_phase (abfd, type, src) case '6': case '7': case '8': - /* Symbols, add to section */ + /* Symbols, add to section. */ { bfd_size_type amt = sizeof (tekhex_symbol_type); - tekhex_symbol_type *new = - (tekhex_symbol_type *) bfd_alloc (abfd, amt); + tekhex_symbol_type *new = bfd_alloc (abfd, amt); char stype = (*src); if (!new) - abort (); /* FIXME */ + return FALSE; new->symbol.the_bfd = abfd; src++; abfd->symcount++; abfd->flags |= HAS_SYMS; new->prev = abfd->tdata.tekhex_data->symbols; abfd->tdata.tekhex_data->symbols = new; - len = getsym (sym, &src); + if (!getsym (sym, &src, &len)) + return FALSE; new->symbol.name = bfd_alloc (abfd, (bfd_size_type) len + 1); if (!new->symbol.name) - abort (); /* FIXME */ + return FALSE; memcpy ((char *) (new->symbol.name), sym, len + 1); new->symbol.section = section; if (stype <= '4') new->symbol.flags = (BSF_GLOBAL | BSF_EXPORT); else new->symbol.flags = BSF_LOCAL; - new->symbol.value = getvalue (&src) - section->vma; + if (!getvalue (&src, &val)) + return FALSE; + new->symbol.value = val - section->vma; } + default: + return FALSE; } } } + + return TRUE; } /* Pass over a tekhex, calling one of the above functions on each record. */ -static void -pass_over (abfd, func) - bfd *abfd; - void (*func) PARAMS ((bfd *, int, char *)); +static bfd_boolean +pass_over (bfd *abfd, bfd_boolean (*func) (bfd *, int, char *)) { unsigned int chars_on_line; bfd_boolean eof = FALSE; - /* To the front of the file */ + /* To the front of the file. */ if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) abort (); while (! eof) @@ -491,40 +464,42 @@ pass_over (abfd, func) char *src = buffer; char type; - /* Find first '%' */ + /* Find first '%'. */ eof = (bfd_boolean) (bfd_bread (src, (bfd_size_type) 1, abfd) != 1); while (*src != '%' && !eof) - { - eof = (bfd_boolean) (bfd_bread (src, (bfd_size_type) 1, abfd) != 1); - } + eof = (bfd_boolean) (bfd_bread (src, (bfd_size_type) 1, abfd) != 1); + if (eof) break; src++; - /* Fetch the type and the length and the checksum */ + /* Fetch the type and the length and the checksum. */ if (bfd_bread (src, (bfd_size_type) 5, abfd) != 5) - abort (); /* FIXME */ + abort (); /* FIXME. */ type = src[2]; if (!ISHEX (src[0]) || !ISHEX (src[1])) break; - chars_on_line = HEX (src) - 5; /* Already read five char */ + /* Already read five char. */ + chars_on_line = HEX (src) - 5; if (bfd_bread (src, (bfd_size_type) chars_on_line, abfd) != chars_on_line) - abort (); /* FIXME */ - src[chars_on_line] = 0; /* put a null at the end */ + abort (); /* FIXME. */ - func (abfd, type, src); + /* Put a null at the end. */ + src[chars_on_line] = 0; + + if (!func (abfd, type, src)) + return FALSE; } + return TRUE; } static long -tekhex_canonicalize_symtab (abfd, table) - bfd *abfd; - asymbol **table; +tekhex_canonicalize_symtab (bfd *abfd, asymbol **table) { tekhex_symbol_type *p = abfd->tdata.tekhex_data->symbols; unsigned int c = bfd_get_symcount (abfd); @@ -540,37 +515,33 @@ tekhex_canonicalize_symtab (abfd, table) } static long -tekhex_get_symtab_upper_bound (abfd) - bfd *abfd; +tekhex_get_symtab_upper_bound (bfd *abfd) { return (abfd->symcount + 1) * (sizeof (struct tekhex_asymbol_struct *)); } static bfd_boolean -tekhex_mkobject (abfd) - bfd *abfd; +tekhex_mkobject (bfd *abfd) { tdata_type *tdata; - tdata = (tdata_type *) bfd_alloc (abfd, (bfd_size_type) sizeof (tdata_type)); + tdata = bfd_alloc (abfd, (bfd_size_type) sizeof (tdata_type)); if (!tdata) return FALSE; abfd->tdata.tekhex_data = tdata; tdata->type = 1; - tdata->head = (tekhex_data_list_type *) NULL; - tdata->symbols = (struct tekhex_symbol_struct *) NULL; - tdata->data = (struct data_struct *) NULL; + tdata->head = NULL; + tdata->symbols = NULL; + tdata->data = NULL; return TRUE; } -/* - Return TRUE if the file looks like it's in TekHex format. Just look - for a percent sign and some hex digits */ +/* Return TRUE if the file looks like it's in TekHex format. Just look + for a percent sign and some hex digits. */ static const bfd_target * -tekhex_object_p (abfd) - bfd *abfd; +tekhex_object_p (bfd *abfd) { char b[4]; @@ -581,27 +552,28 @@ tekhex_object_p (abfd) return NULL; if (b[0] != '%' || !ISHEX (b[1]) || !ISHEX (b[2]) || !ISHEX (b[3])) - return (const bfd_target *) NULL; + return NULL; tekhex_mkobject (abfd); - pass_over (abfd, first_phase); + if (!pass_over (abfd, first_phase)) + return NULL; + return abfd->xvec; } static void -move_section_contents (abfd, section, locationp, offset, count, get) - bfd *abfd; - asection *section; - const PTR locationp; - file_ptr offset; - bfd_size_type count; - bfd_boolean get; +move_section_contents (bfd *abfd, + asection *section, + const void * locationp, + file_ptr offset, + bfd_size_type count, + bfd_boolean get) { bfd_vma addr; char *location = (char *) locationp; - bfd_vma prev_number = 1; /* Nothing can have this as a high bit*/ - struct data_struct *d = (struct data_struct *) NULL; + bfd_vma prev_number = 1; /* Nothing can have this as a high bit. */ + struct data_struct *d = NULL; BFD_ASSERT (offset == 0); for (addr = section->vma; count != 0; count--, addr++) @@ -611,21 +583,15 @@ move_section_contents (abfd, section, locationp, offset, count, get) bfd_vma low_bits = addr & CHUNK_MASK; if (chunk_number != prev_number) - { - /* Different chunk, so move pointer */ - d = find_chunk (abfd, chunk_number); - } + /* Different chunk, so move pointer. */ + d = find_chunk (abfd, chunk_number); if (get) { if (d->chunk_init[low_bits]) - { - *location = d->chunk_data[low_bits]; - } + *location = d->chunk_data[low_bits]; else - { - *location = 0; - } + *location = 0; } else { @@ -634,52 +600,45 @@ move_section_contents (abfd, section, locationp, offset, count, get) } location++; - } - } static bfd_boolean -tekhex_get_section_contents (abfd, section, locationp, offset, count) - bfd *abfd; - asection *section; - PTR locationp; - file_ptr offset; - bfd_size_type count; +tekhex_get_section_contents (bfd *abfd, + asection *section, + void * locationp, + file_ptr offset, + bfd_size_type count) { if (section->flags & (SEC_LOAD | SEC_ALLOC)) { move_section_contents (abfd, section, locationp, offset, count, TRUE); return TRUE; } - else - return FALSE; + + return FALSE; } static bfd_boolean -tekhex_set_arch_mach (abfd, arch, machine) - bfd *abfd; - enum bfd_architecture arch; - unsigned long machine; +tekhex_set_arch_mach (bfd *abfd, + enum bfd_architecture arch, + unsigned long machine) { return bfd_default_set_arch_mach (abfd, arch, machine); } -/* we have to save up all the Tekhexords for a splurge before output, - */ +/* We have to save up all the Tekhexords for a splurge before output. */ static bfd_boolean -tekhex_set_section_contents (abfd, section, locationp, offset, bytes_to_do) - bfd *abfd; - sec_ptr section; - const PTR locationp; - file_ptr offset; - bfd_size_type bytes_to_do; +tekhex_set_section_contents (bfd *abfd, + sec_ptr section, + const void * locationp, + file_ptr offset, + bfd_size_type bytes_to_do) { - if (! abfd->output_has_begun) { - /* The first time around, allocate enough sections to hold all the chunks */ + /* The first time around, allocate enough sections to hold all the chunks. */ asection *s = abfd->sections; bfd_vma vma; @@ -688,28 +647,25 @@ tekhex_set_section_contents (abfd, section, locationp, offset, bytes_to_do) if (s->flags & SEC_LOAD) { for (vma = s->vma & ~(bfd_vma) CHUNK_MASK; - vma < s->vma + s->_raw_size; + vma < s->vma + s->size; vma += CHUNK_MASK) find_chunk (abfd, vma); } } - } + if (section->flags & (SEC_LOAD | SEC_ALLOC)) { move_section_contents (abfd, section, locationp, offset, bytes_to_do, FALSE); return TRUE; } - else - return FALSE; + return FALSE; } static void -writevalue (dst, value) - char **dst; - bfd_vma value; +writevalue (char **dst, bfd_vma value) { char *p = *dst; int len; @@ -737,9 +693,7 @@ writevalue (dst, value) } static void -writesym (dst, sym) - char **dst; - const char *sym; +writesym (char **dst, const char *sym) { char *p = *dst; int len = (sym ? strlen (sym) : 0); @@ -749,7 +703,6 @@ writesym (dst, sym) *p++ = '0'; len = 16; } - else { if (len == 0) @@ -759,24 +712,17 @@ writesym (dst, sym) len = 1; } else - { - *p++ = digs[len]; - } + *p++ = digs[len]; } while (len--) - { - *p++ = *sym++; - } + *p++ = *sym++; + *dst = p; } static void -out (abfd, type, start, end) - bfd *abfd; - int type; - char *start; - char *end; +out (bfd *abfd, int type, char *start, char *end) { int sum = 0; char *s; @@ -788,13 +734,11 @@ out (abfd, type, start, end) front[3] = type; for (s = start; s < end; s++) - { - sum += sum_block[(unsigned char) *s]; - } + sum += sum_block[(unsigned char) *s]; - sum += sum_block[(unsigned char) front[1]]; /* length */ + sum += sum_block[(unsigned char) front[1]]; /* Length. */ sum += sum_block[(unsigned char) front[2]]; - sum += sum_block[(unsigned char) front[3]]; /* type */ + sum += sum_block[(unsigned char) front[3]]; /* Type. */ TOHEX (front + 4, sum); if (bfd_bwrite (front, (bfd_size_type) 6, abfd) != 6) abort (); @@ -805,8 +749,7 @@ out (abfd, type, start, end) } static bfd_boolean -tekhex_write_object_contents (abfd) - bfd *abfd; +tekhex_write_object_contents (bfd *abfd) { int bytes_written; char buffer[100]; @@ -818,9 +761,9 @@ tekhex_write_object_contents (abfd) bytes_written = 0; - /* And the raw data */ + /* And the raw data. */ for (d = abfd->tdata.tekhex_data->data; - d != (struct data_struct *) NULL; + d != NULL; d = d->next) { int low; @@ -828,18 +771,16 @@ tekhex_write_object_contents (abfd) const int span = 32; int addr; - /* Write it in blocks of 32 bytes */ - + /* Write it in blocks of 32 bytes. */ for (addr = 0; addr < CHUNK_MASK + 1; addr += span) { int need = 0; - /* Check to see if necessary */ + /* Check to see if necessary. */ for (low = 0; !need && low < span; low++) - { - if (d->chunk_init[addr + low]) - need = 1; - } + if (d->chunk_init[addr + low]) + need = 1; + if (need) { char *dst = buffer; @@ -854,19 +795,20 @@ tekhex_write_object_contents (abfd) } } } - /* write all the section headers for the sections */ - for (s = abfd->sections; s != (asection *) NULL; s = s->next) + + /* Write all the section headers for the sections. */ + for (s = abfd->sections; s != NULL; s = s->next) { char *dst = buffer; writesym (&dst, s->name); *dst++ = '1'; writevalue (&dst, s->vma); - writevalue (&dst, s->vma + s->_raw_size); + writevalue (&dst, s->vma + s->size); out (abfd, '3', buffer, dst); } - /* And the symbols */ + /* And the symbols. */ if (abfd->outsymbols) { for (p = abfd->outsymbols; *p; p++) @@ -874,7 +816,8 @@ tekhex_write_object_contents (abfd) int section_code = bfd_decode_symclass (*p); if (section_code != '?') - { /* do not include debug symbols */ + { + /* Do not include debug symbols. */ asymbol *sym = *p; char *dst = buffer; @@ -917,50 +860,45 @@ tekhex_write_object_contents (abfd) } } - /* And the terminator */ + /* And the terminator. */ if (bfd_bwrite ("%0781010\n", (bfd_size_type) 9, abfd) != 9) abort (); return TRUE; } static int -tekhex_sizeof_headers (abfd, exec) - bfd *abfd ATTRIBUTE_UNUSED; - bfd_boolean exec ATTRIBUTE_UNUSED; - +tekhex_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, + bfd_boolean exec ATTRIBUTE_UNUSED) { return 0; } static asymbol * -tekhex_make_empty_symbol (abfd) - bfd *abfd; +tekhex_make_empty_symbol (bfd *abfd) { bfd_size_type amt = sizeof (struct tekhex_symbol_struct); - tekhex_symbol_type *new = (tekhex_symbol_type *) bfd_zalloc (abfd, amt); + tekhex_symbol_type *new = bfd_zalloc (abfd, amt); if (!new) return NULL; new->symbol.the_bfd = abfd; - new->prev = (struct tekhex_symbol_struct *) NULL; + new->prev = NULL; return &(new->symbol); } static void -tekhex_get_symbol_info (ignore_abfd, symbol, ret) - bfd *ignore_abfd ATTRIBUTE_UNUSED; - asymbol *symbol; - symbol_info *ret; +tekhex_get_symbol_info (bfd *abfd ATTRIBUTE_UNUSED, + asymbol *symbol, + symbol_info *ret) { bfd_symbol_info (symbol, ret); } static void -tekhex_print_symbol (abfd, filep, symbol, how) - bfd *abfd; - PTR filep; - asymbol *symbol; - bfd_print_symbol_type how; +tekhex_print_symbol (bfd *abfd, + void * filep, + asymbol *symbol, + bfd_print_symbol_type how) { FILE *file = (FILE *) filep; @@ -976,66 +914,64 @@ tekhex_print_symbol (abfd, filep, symbol, how) { const char *section_name = symbol->section->name; - bfd_print_symbol_vandf (abfd, (PTR) file, symbol); + bfd_print_symbol_vandf (abfd, (void *) file, symbol); fprintf (file, " %-5s %s", - section_name, - symbol->name); + section_name, symbol->name); } } } -#define tekhex_close_and_cleanup _bfd_generic_close_and_cleanup -#define tekhex_bfd_free_cached_info _bfd_generic_bfd_free_cached_info -#define tekhex_new_section_hook _bfd_generic_new_section_hook - -#define tekhex_bfd_is_local_label_name bfd_generic_is_local_label_name -#define tekhex_get_lineno _bfd_nosymbols_get_lineno -#define tekhex_find_nearest_line _bfd_nosymbols_find_nearest_line -#define tekhex_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol -#define tekhex_read_minisymbols _bfd_generic_read_minisymbols -#define tekhex_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol - -#define tekhex_bfd_get_relocated_section_contents \ - bfd_generic_get_relocated_section_contents -#define tekhex_bfd_relax_section bfd_generic_relax_section -#define tekhex_bfd_gc_sections bfd_generic_gc_sections -#define tekhex_bfd_merge_sections bfd_generic_merge_sections -#define tekhex_bfd_discard_group bfd_generic_discard_group -#define tekhex_bfd_link_hash_table_create _bfd_generic_link_hash_table_create -#define tekhex_bfd_link_hash_table_free _bfd_generic_link_hash_table_free -#define tekhex_bfd_link_add_symbols _bfd_generic_link_add_symbols -#define tekhex_bfd_link_just_syms _bfd_generic_link_just_syms -#define tekhex_bfd_final_link _bfd_generic_final_link -#define tekhex_bfd_link_split_section _bfd_generic_link_split_section - -#define tekhex_get_section_contents_in_window \ - _bfd_generic_get_section_contents_in_window +#define tekhex_close_and_cleanup _bfd_generic_close_and_cleanup +#define tekhex_bfd_free_cached_info _bfd_generic_bfd_free_cached_info +#define tekhex_new_section_hook _bfd_generic_new_section_hook +#define tekhex_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) +#define tekhex_bfd_is_local_label_name bfd_generic_is_local_label_name +#define tekhex_get_lineno _bfd_nosymbols_get_lineno +#define tekhex_find_nearest_line _bfd_nosymbols_find_nearest_line +#define tekhex_find_inliner_info _bfd_nosymbols_find_inliner_info +#define tekhex_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol +#define tekhex_read_minisymbols _bfd_generic_read_minisymbols +#define tekhex_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol +#define tekhex_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents +#define tekhex_bfd_relax_section bfd_generic_relax_section +#define tekhex_bfd_gc_sections bfd_generic_gc_sections +#define tekhex_bfd_merge_sections bfd_generic_merge_sections +#define tekhex_bfd_is_group_section bfd_generic_is_group_section +#define tekhex_bfd_discard_group bfd_generic_discard_group +#define tekhex_section_already_linked _bfd_generic_section_already_linked +#define tekhex_bfd_link_hash_table_create _bfd_generic_link_hash_table_create +#define tekhex_bfd_link_hash_table_free _bfd_generic_link_hash_table_free +#define tekhex_bfd_link_add_symbols _bfd_generic_link_add_symbols +#define tekhex_bfd_link_just_syms _bfd_generic_link_just_syms +#define tekhex_bfd_final_link _bfd_generic_final_link +#define tekhex_bfd_link_split_section _bfd_generic_link_split_section +#define tekhex_get_section_contents_in_window _bfd_generic_get_section_contents_in_window const bfd_target tekhex_vec = { - "tekhex", /* name */ + "tekhex", /* Name. */ bfd_target_tekhex_flavour, - BFD_ENDIAN_UNKNOWN, /* target byte order */ - BFD_ENDIAN_UNKNOWN, /* target headers byte order */ - (EXEC_P | /* object flags */ - HAS_SYMS | HAS_LINENO | HAS_DEBUG | HAS_RELOC | HAS_LOCALS | - WP_TEXT | D_PAGED), + BFD_ENDIAN_UNKNOWN, /* Target byte order. */ + BFD_ENDIAN_UNKNOWN, /* Target headers byte order. */ + (EXEC_P | /* Object flags. */ + HAS_SYMS | HAS_LINENO | HAS_DEBUG | + HAS_RELOC | HAS_LOCALS | WP_TEXT | D_PAGED), (SEC_CODE | SEC_DATA | SEC_ROM | SEC_HAS_CONTENTS - | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ - 0, /* leading underscore */ - ' ', /* ar_pad_char */ - 16, /* ar_max_namelen */ + | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* Section flags. */ + 0, /* Leading underscore. */ + ' ', /* AR_pad_char. */ + 16, /* AR_max_namelen. */ bfd_getb64, bfd_getb_signed_64, bfd_putb64, bfd_getb32, bfd_getb_signed_32, bfd_putb32, - bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */ + bfd_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_getb16, bfd_getb_signed_16, bfd_putb16, /* Headers. */ { _bfd_dummy_target, - tekhex_object_p, /* bfd_check_format */ + tekhex_object_p, /* bfd_check_format. */ _bfd_dummy_target, _bfd_dummy_target, }, @@ -1045,7 +981,7 @@ const bfd_target tekhex_vec = _bfd_generic_mkarchive, bfd_false, }, - { /* bfd_write_contents */ + { /* bfd_write_contents. */ bfd_false, tekhex_write_object_contents, _bfd_write_archive_contents, @@ -1064,5 +1000,5 @@ const bfd_target tekhex_vec = NULL, - (PTR) 0 + NULL }; diff --git a/contrib/binutils/bfd/trad-core.c b/contrib/binutils/bfd/trad-core.c index f8c03d739a8..cb4111fb941 100644 --- a/contrib/binutils/bfd/trad-core.c +++ b/contrib/binutils/bfd/trad-core.c @@ -1,6 +1,6 @@ /* BFD back end for traditional Unix core files (U-area and raw sections) Copyright 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, - 2000, 2001, 2002, 2003, 2004 + 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. Written by John Gilmore of Cygnus Support. @@ -18,7 +18,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" @@ -65,8 +65,7 @@ struct trad_core_struct const bfd_target *trad_unix_core_file_p PARAMS ((bfd *abfd)); char * trad_unix_core_file_failing_command PARAMS ((bfd *abfd)); int trad_unix_core_file_failing_signal PARAMS ((bfd *abfd)); -bfd_boolean trad_unix_core_file_matches_executable_p - PARAMS ((bfd *core_bfd, bfd *exec_bfd)); +#define trad_unix_core_file_matches_executable_p generic_core_file_matches_executable_p static void swap_abort PARAMS ((void)); /* Handle 4.2-style (and perhaps also sysV-style) core dump file. */ @@ -109,15 +108,11 @@ trad_unix_core_file_p (abfd) /* Check that the size claimed is no greater than the file size. */ { - FILE *stream = bfd_cache_lookup (abfd); struct stat statbuf; - if (stream == NULL) + + if (bfd_stat (abfd, &statbuf) < 0) return 0; - if (fstat (fileno (stream), &statbuf) < 0) - { - bfd_set_error (bfd_error_system_call); - return 0; - } + if ((unsigned long) (NBPG * (UPAGES + u.u_dsize #ifdef TRAD_CORE_DSIZE_INCLUDES_TSIZE - u.u_tsize @@ -174,13 +169,13 @@ trad_unix_core_file_p (abfd) core_datasec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS; core_regsec (abfd)->flags = SEC_HAS_CONTENTS; - core_datasec (abfd)->_raw_size = NBPG * u.u_dsize + core_datasec (abfd)->size = NBPG * u.u_dsize #ifdef TRAD_CORE_DSIZE_INCLUDES_TSIZE - NBPG * u.u_tsize #endif ; - core_stacksec (abfd)->_raw_size = NBPG * u.u_ssize; - core_regsec (abfd)->_raw_size = NBPG * UPAGES; /* Larger than sizeof struct u */ + core_stacksec (abfd)->size = NBPG * u.u_ssize; + core_regsec (abfd)->size = NBPG * UPAGES; /* Larger than sizeof struct u */ /* What a hack... we'd like to steal it from the exec file, since the upage does not seem to provide it. FIXME. */ @@ -257,14 +252,6 @@ trad_unix_core_file_failing_signal (ignore_abfd) return -1; /* FIXME, where is it? */ #endif } - -bfd_boolean -trad_unix_core_file_matches_executable_p (core_bfd, exec_bfd) - bfd *core_bfd ATTRIBUTE_UNUSED; - bfd *exec_bfd ATTRIBUTE_UNUSED; -{ - return TRUE; /* FIXME, We have no way of telling at this point */ -} /* If somebody calls any byte-swapping routines, shoot them. */ static void diff --git a/contrib/binutils/bfd/version.h b/contrib/binutils/bfd/version.h index 25b0e07442e..f0ad1a88909 100644 --- a/contrib/binutils/bfd/version.h +++ b/contrib/binutils/bfd/version.h @@ -1,3 +1,3 @@ -#define BFD_VERSION_DATE 20050317 +#define BFD_VERSION_DATE 20070807 #define BFD_VERSION @bfd_version@ #define BFD_VERSION_STRING @bfd_version_string@ diff --git a/contrib/binutils/bfd/xcoff-target.h b/contrib/binutils/bfd/xcoff-target.h index 7bf3de72fa4..7e73cf26a59 100644 --- a/contrib/binutils/bfd/xcoff-target.h +++ b/contrib/binutils/bfd/xcoff-target.h @@ -1,23 +1,23 @@ /* Common definitions for backends based on IBM RS/6000 "XCOFF64" files. - Copyright 2000, 2001, 2002 + Copyright 2000, 2001, 2002, 2004, 2005 Free Software Foundation, Inc. Contributed by Cygnus Support. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* Internalcoff.h and coffcode.h modify themselves based on this flag. */ #define RS6000COFF_C 1 @@ -32,7 +32,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | (howto->bitsize - 1)); \ } -#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3) +#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER 3 #define COFF_LONG_FILENAMES @@ -40,74 +40,71 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define RTYPE2HOWTO(cache_ptr, dst) _bfd_xcoff_rtype2howto (cache_ptr, dst) -#define coff_mkobject _bfd_xcoff_mkobject -#define coff_bfd_copy_private_bfd_data _bfd_xcoff_copy_private_bfd_data -#define coff_bfd_is_local_label_name _bfd_xcoff_is_local_label_name -#define coff_bfd_reloc_type_lookup _bfd_xcoff_reloc_type_lookup -#define coff_relocate_section _bfd_ppc_xcoff_relocate_section +#define coff_mkobject _bfd_xcoff_mkobject +#define coff_bfd_copy_private_bfd_data _bfd_xcoff_copy_private_bfd_data +#define coff_bfd_is_local_label_name _bfd_xcoff_is_local_label_name +#define coff_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) +#define coff_bfd_reloc_type_lookup _bfd_xcoff_reloc_type_lookup +#define coff_relocate_section _bfd_ppc_xcoff_relocate_section +#define coff_core_file_failing_command _bfd_nocore_core_file_failing_command +#define coff_core_file_failing_signal _bfd_nocore_core_file_failing_signal +#define coff_core_file_matches_executable_p _bfd_nocore_core_file_matches_executable_p +#define _bfd_xcoff_bfd_get_relocated_section_contents coff_bfd_get_relocated_section_contents +#define _bfd_xcoff_bfd_relax_section coff_bfd_relax_section +#define _bfd_xcoff_bfd_gc_sections coff_bfd_gc_sections +#define _bfd_xcoff_bfd_merge_sections coff_bfd_merge_sections +#define _bfd_xcoff_bfd_discard_group bfd_generic_discard_group +#define _bfd_xcoff_section_already_linked _bfd_generic_section_already_linked +#define _bfd_xcoff_bfd_link_split_section coff_bfd_link_split_section #define CORE_FILE_P _bfd_dummy_target -#define coff_core_file_failing_command _bfd_nocore_core_file_failing_command -#define coff_core_file_failing_signal _bfd_nocore_core_file_failing_signal -#define coff_core_file_matches_executable_p \ - _bfd_nocore_core_file_matches_executable_p - #ifdef AIX_CORE -#undef CORE_FILE_P + +#undef CORE_FILE_P #define CORE_FILE_P rs6000coff_core_p -extern const bfd_target * rs6000coff_core_p (); -extern bfd_boolean rs6000coff_core_file_matches_executable_p (); +extern const bfd_target * rs6000coff_core_p (bfd *); +extern bfd_boolean rs6000coff_core_file_matches_executable_p (bfd *, bfd*); #undef coff_core_file_matches_executable_p #define coff_core_file_matches_executable_p \ rs6000coff_core_file_matches_executable_p -extern char *rs6000coff_core_file_failing_command PARAMS ((bfd *abfd)); -#undef coff_core_file_failing_command +extern char *rs6000coff_core_file_failing_command (bfd *); +#undef coff_core_file_failing_command #define coff_core_file_failing_command rs6000coff_core_file_failing_command -extern int rs6000coff_core_file_failing_signal PARAMS ((bfd *abfd)); -#undef coff_core_file_failing_signal +extern int rs6000coff_core_file_failing_signal (bfd *); +#undef coff_core_file_failing_signal #define coff_core_file_failing_signal rs6000coff_core_file_failing_signal #endif /* AIX_CORE */ #ifdef LYNX_CORE -#undef CORE_FILE_P +#undef CORE_FILE_P #define CORE_FILE_P lynx_core_file_p -extern const bfd_target *lynx_core_file_p PARAMS ((bfd *abfd)); +extern const bfd_target *lynx_core_file_p (bfd *); -extern bfd_boolean lynx_core_file_matches_executable_p - PARAMS ((bfd *core_bfd, bfd *exec_bfd)); +extern bfd_boolean lynx_core_file_matches_executable_p (bfd *, bfd *); #undef coff_core_file_matches_executable_p #define coff_core_file_matches_executable_p lynx_core_file_matches_executable_p -extern char *lynx_core_file_failing_command PARAMS ((bfd *abfd)); -#undef coff_core_file_failing_command +extern char *lynx_core_file_failing_command (bfd *); +#undef coff_core_file_failing_command #define coff_core_file_failing_command lynx_core_file_failing_command -extern int lynx_core_file_failing_signal PARAMS ((bfd *abfd)); -#undef coff_core_file_failing_signal +extern int lynx_core_file_failing_signal (bfd *); +#undef coff_core_file_failing_signal #define coff_core_file_failing_signal lynx_core_file_failing_signal #endif /* LYNX_CORE */ -#define _bfd_xcoff_bfd_get_relocated_section_contents \ - coff_bfd_get_relocated_section_contents -#define _bfd_xcoff_bfd_relax_section coff_bfd_relax_section -#define _bfd_xcoff_bfd_gc_sections coff_bfd_gc_sections -#define _bfd_xcoff_bfd_merge_sections coff_bfd_merge_sections -#define _bfd_xcoff_bfd_discard_group bfd_generic_discard_group -#define _bfd_xcoff_bfd_link_split_section coff_bfd_link_split_section - /* XCOFF archives do not have anything which corresponds to an extended name table. */ #define _bfd_xcoff_slurp_extended_name_table bfd_false #define _bfd_xcoff_construct_extended_name_table \ - ((bfd_boolean (*) PARAMS ((bfd *, char **, bfd_size_type *, const char **))) \ - bfd_false) + ((bfd_boolean (*) (bfd *, char **, bfd_size_type *, const char **)) bfd_false) #define _bfd_xcoff_truncate_arname bfd_dont_truncate_arname /* We can use the standard get_elt_at_index routine. */ @@ -118,31 +115,28 @@ extern int lynx_core_file_failing_signal PARAMS ((bfd *abfd)); #define _bfd_xcoff_update_armap_timestamp bfd_true -extern bfd_boolean _bfd_xcoff_mkobject PARAMS ((bfd *)); -extern bfd_boolean _bfd_xcoff_copy_private_bfd_data PARAMS ((bfd *, bfd *)); -extern bfd_boolean _bfd_xcoff_is_local_label_name PARAMS ((bfd *, const char *)); -extern void _bfd_xcoff_rtype2howto - PARAMS ((arelent *, struct internal_reloc *)); -extern reloc_howto_type *_bfd_xcoff_reloc_type_lookup - PARAMS ((bfd *, bfd_reloc_code_real_type)); -extern bfd_boolean _bfd_xcoff_slurp_armap PARAMS ((bfd *)); -extern const bfd_target *_bfd_xcoff_archive_p PARAMS ((bfd *)); -extern PTR _bfd_xcoff_read_ar_hdr PARAMS ((bfd *)); -extern bfd *_bfd_xcoff_openr_next_archived_file PARAMS ((bfd *, bfd *)); -extern int _bfd_xcoff_generic_stat_arch_elt PARAMS ((bfd *, struct stat *)); -extern bfd_boolean _bfd_xcoff_write_armap - PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int)); -extern bfd_boolean _bfd_xcoff_write_archive_contents PARAMS ((bfd *)); -extern int _bfd_xcoff_sizeof_headers PARAMS ((bfd *, bfd_boolean)); -extern void _bfd_xcoff_swap_sym_in PARAMS ((bfd *, PTR, PTR)); -extern unsigned int _bfd_xcoff_swap_sym_out PARAMS ((bfd *, PTR, PTR)); -extern void _bfd_xcoff_swap_aux_in PARAMS ((bfd *, PTR, int, int, int, int, PTR)); -extern unsigned int _bfd_xcoff_swap_aux_out PARAMS ((bfd *, PTR, int, int, int, int, PTR)); +extern bfd_boolean _bfd_xcoff_mkobject (bfd *); +extern bfd_boolean _bfd_xcoff_copy_private_bfd_data (bfd *, bfd *); +extern bfd_boolean _bfd_xcoff_is_local_label_name (bfd *, const char *); +extern void _bfd_xcoff_rtype2howto (arelent *, struct internal_reloc *); +extern bfd_boolean _bfd_xcoff_slurp_armap (bfd *); +extern void * _bfd_xcoff_read_ar_hdr (bfd *); +extern bfd * _bfd_xcoff_openr_next_archived_file (bfd *, bfd *); +extern int _bfd_xcoff_generic_stat_arch_elt (bfd *, struct stat *); +extern bfd_boolean _bfd_xcoff_write_armap (bfd *, unsigned int, struct orl *, unsigned int, int); +extern bfd_boolean _bfd_xcoff_write_archive_contents (bfd *); +extern int _bfd_xcoff_sizeof_headers (bfd *, bfd_boolean); +extern void _bfd_xcoff_swap_sym_in (bfd *, void *, void *); +extern unsigned int _bfd_xcoff_swap_sym_out (bfd *, void *, void *); +extern void _bfd_xcoff_swap_aux_in (bfd *, void *, int, int, int, int, void *); +extern unsigned int _bfd_xcoff_swap_aux_out (bfd *, void *, int, int, int, int, void *); +extern reloc_howto_type * _bfd_xcoff_reloc_type_lookup (bfd *, bfd_reloc_code_real_type); +extern const bfd_target * _bfd_xcoff_archive_p (bfd *); #ifndef coff_SWAP_sym_in -#define coff_SWAP_sym_in _bfd_xcoff_swap_sym_in +#define coff_SWAP_sym_in _bfd_xcoff_swap_sym_in #define coff_SWAP_sym_out _bfd_xcoff_swap_sym_out -#define coff_SWAP_aux_in _bfd_xcoff_swap_aux_in +#define coff_SWAP_aux_in _bfd_xcoff_swap_aux_in #define coff_SWAP_aux_out _bfd_xcoff_swap_aux_out #endif @@ -154,30 +148,30 @@ const bfd_target TARGET_SYM = { TARGET_NAME, bfd_target_xcoff_flavour, - BFD_ENDIAN_BIG, /* data byte order is big */ - BFD_ENDIAN_BIG, /* header byte order is big */ + BFD_ENDIAN_BIG, /* Data byte order is big. */ + BFD_ENDIAN_BIG, /* Header byte order is big. */ - (HAS_RELOC | EXEC_P | /* object flags */ + (HAS_RELOC | EXEC_P | /* Object flags. */ HAS_LINENO | HAS_DEBUG | DYNAMIC | HAS_SYMS | HAS_LOCALS | WP_TEXT), - (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ - 0, /* leading char */ - '/', /* ar_pad_char */ - 15, /* ar_max_namelen??? FIXMEmgo */ + (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* Section flags. */ + 0, /* Leading char. */ + '/', /* AR_pad_char. */ + 15, /* AR_max_namelen??? FIXME. */ 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_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_getb16, bfd_getb_signed_16, bfd_putb16,/* Headers. */ - {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ + {_bfd_dummy_target, coff_object_p, /* bfd_check_format. */ _bfd_xcoff_archive_p, CORE_FILE_P}, - {bfd_false, coff_mkobject, /* bfd_set_format */ + {bfd_false, coff_mkobject, /* bfd_set_format. */ _bfd_generic_mkarchive, bfd_false}, - {bfd_false, coff_write_object_contents, /* bfd_write_contents */ + {bfd_false, coff_write_object_contents, /* bfd_write_contents. */ _bfd_xcoff_write_archive_contents, bfd_false}, BFD_JUMP_TABLE_GENERIC (coff), diff --git a/contrib/binutils/bfd/xcofflink.c b/contrib/binutils/bfd/xcofflink.c index ccd82befdac..47c330b6c15 100644 --- a/contrib/binutils/bfd/xcofflink.c +++ b/contrib/binutils/bfd/xcofflink.c @@ -1,6 +1,6 @@ /* POWER/PowerPC XCOFF linker support. - Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 - Free Software Foundation, Inc. + Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, + 2005, 2006 Free Software Foundation, Inc. Written by Ian Lance Taylor , Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" @@ -30,7 +30,8 @@ /* This file holds the XCOFF linker code. */ -#define STRING_SIZE_SIZE (4) +#undef STRING_SIZE_SIZE +#define STRING_SIZE_SIZE 4 /* We reuse the SEC_ROM flag as a mark flag for garbage collection. This flag will only be used on input sections. */ @@ -65,7 +66,8 @@ struct xcoff_link_section_info index of the TOC symbol is not known when the reloc was handled, an entry is added to this linked list. This is not an array, like rel_hashes, because this case is quite uncommon. */ - struct xcoff_toc_rel_hash { + struct xcoff_toc_rel_hash + { struct xcoff_toc_rel_hash *next; struct xcoff_link_hash_entry *h; struct internal_reloc *rel; @@ -113,40 +115,8 @@ struct xcoff_final_link_info bfd_byte *external_relocs; }; -static struct bfd_hash_entry *xcoff_link_hash_newfunc - PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); -static bfd_boolean xcoff_get_section_contents PARAMS ((bfd *, asection *)); -static struct internal_reloc *xcoff_read_internal_relocs - PARAMS ((bfd *, asection *, bfd_boolean, bfd_byte *, bfd_boolean, - struct internal_reloc *)); -static bfd_boolean xcoff_link_add_object_symbols - PARAMS ((bfd *, struct bfd_link_info *)); -static bfd_boolean xcoff_link_check_archive_element - PARAMS ((bfd *, struct bfd_link_info *, bfd_boolean *)); -static bfd_boolean xcoff_link_check_ar_symbols - PARAMS ((bfd *, struct bfd_link_info *, bfd_boolean *)); -static bfd_boolean xcoff_link_check_dynamic_ar_symbols - PARAMS ((bfd *, struct bfd_link_info *, bfd_boolean *)); -static bfd_size_type xcoff_find_reloc - PARAMS ((struct internal_reloc *, bfd_size_type, bfd_vma)); -static bfd_boolean xcoff_link_add_symbols - PARAMS ((bfd *, struct bfd_link_info *)); -static bfd_boolean xcoff_link_add_dynamic_symbols - PARAMS ((bfd *, struct bfd_link_info *)); -static bfd_boolean xcoff_mark_symbol - PARAMS ((struct bfd_link_info *, struct xcoff_link_hash_entry *)); -static bfd_boolean xcoff_mark PARAMS ((struct bfd_link_info *, asection *)); -static void xcoff_sweep PARAMS ((struct bfd_link_info *)); -static bfd_boolean xcoff_build_ldsyms - PARAMS ((struct xcoff_link_hash_entry *, PTR)); -static bfd_boolean xcoff_link_input_bfd - PARAMS ((struct xcoff_final_link_info *, bfd *)); -static bfd_boolean xcoff_write_global_symbol - PARAMS ((struct xcoff_link_hash_entry *, PTR)); -static bfd_boolean xcoff_reloc_link_order - PARAMS ((bfd *, struct xcoff_final_link_info *, asection *, - struct bfd_link_order *)); -static int xcoff_sort_relocs PARAMS ((const PTR, const PTR)); +static bfd_boolean xcoff_mark (struct bfd_link_info *, asection *); + /* Routines to read XCOFF dynamic information. This don't really @@ -156,14 +126,12 @@ static int xcoff_sort_relocs PARAMS ((const PTR, const PTR)); /* Read the contents of a section. */ static bfd_boolean -xcoff_get_section_contents (abfd, sec) - bfd *abfd; - asection *sec; +xcoff_get_section_contents (bfd *abfd, asection *sec) { - if (coff_section_data (abfd, sec) == NULL) { bfd_size_type amt = sizeof (struct coff_section_tdata); + sec->used_by_bfd = bfd_zalloc (abfd, amt); if (sec->used_by_bfd == NULL) return FALSE; @@ -171,15 +139,15 @@ xcoff_get_section_contents (abfd, sec) if (coff_section_data (abfd, sec)->contents == NULL) { - coff_section_data (abfd, sec)->contents = ((bfd_byte *) - bfd_malloc (sec->_raw_size)); - if (coff_section_data (abfd, sec)->contents == NULL) - return FALSE; + bfd_byte *contents; - if (! bfd_get_section_contents (abfd, sec, - coff_section_data (abfd, sec)->contents, - (file_ptr) 0, sec->_raw_size)) - return FALSE; + if (! bfd_malloc_and_get_section (abfd, sec, &contents)) + { + if (contents != NULL) + free (contents); + return FALSE; + } + coff_section_data (abfd, sec)->contents = contents; } return TRUE; @@ -188,8 +156,7 @@ xcoff_get_section_contents (abfd, sec) /* Get the size required to hold the dynamic symbols. */ long -_bfd_xcoff_get_dynamic_symtab_upper_bound (abfd) - bfd *abfd; +_bfd_xcoff_get_dynamic_symtab_upper_bound (bfd *abfd) { asection *lsec; bfd_byte *contents; @@ -212,7 +179,7 @@ _bfd_xcoff_get_dynamic_symtab_upper_bound (abfd) return -1; contents = coff_section_data (abfd, lsec)->contents; - bfd_xcoff_swap_ldhdr_in (abfd, (PTR) contents, &ldhdr); + bfd_xcoff_swap_ldhdr_in (abfd, (void *) contents, &ldhdr); return (ldhdr.l_nsyms + 1) * sizeof (asymbol *); } @@ -220,9 +187,7 @@ _bfd_xcoff_get_dynamic_symtab_upper_bound (abfd) /* Get the dynamic symbols. */ long -_bfd_xcoff_canonicalize_dynamic_symtab (abfd, psyms) - bfd *abfd; - asymbol **psyms; +_bfd_xcoff_canonicalize_dynamic_symtab (bfd *abfd, asymbol **psyms) { asection *lsec; bfd_byte *contents; @@ -254,8 +219,7 @@ _bfd_xcoff_canonicalize_dynamic_symtab (abfd, psyms) strings = (char *) contents + ldhdr.l_stoff; - symbuf = ((coff_symbol_type *) - bfd_zalloc (abfd, ldhdr.l_nsyms * sizeof (coff_symbol_type))); + symbuf = bfd_zalloc (abfd, ldhdr.l_nsyms * sizeof (* symbuf)); if (symbuf == NULL) return -1; @@ -297,7 +261,6 @@ _bfd_xcoff_canonicalize_dynamic_symtab (abfd, psyms) /* FIXME: We have no way to record the other information stored with the loader symbol. */ - *psyms = (asymbol *) symbuf; } @@ -309,8 +272,7 @@ _bfd_xcoff_canonicalize_dynamic_symtab (abfd, psyms) /* Get the size required to hold the dynamic relocs. */ long -_bfd_xcoff_get_dynamic_reloc_upper_bound (abfd) - bfd *abfd; +_bfd_xcoff_get_dynamic_reloc_upper_bound (bfd *abfd) { asection *lsec; bfd_byte *contents; @@ -341,10 +303,9 @@ _bfd_xcoff_get_dynamic_reloc_upper_bound (abfd) /* Get the dynamic relocs. */ long -_bfd_xcoff_canonicalize_dynamic_reloc (abfd, prelocs, syms) - bfd *abfd; - arelent **prelocs; - asymbol **syms; +_bfd_xcoff_canonicalize_dynamic_reloc (bfd *abfd, + arelent **prelocs, + asymbol **syms) { asection *lsec; bfd_byte *contents; @@ -371,7 +332,7 @@ _bfd_xcoff_canonicalize_dynamic_reloc (abfd, prelocs, syms) bfd_xcoff_swap_ldhdr_in (abfd, contents, &ldhdr); - relbuf = (arelent *) bfd_alloc (abfd, ldhdr.l_nreloc * sizeof (arelent)); + relbuf = bfd_alloc (abfd, ldhdr.l_nreloc * sizeof (arelent)); if (relbuf == NULL) return -1; @@ -439,20 +400,18 @@ _bfd_xcoff_canonicalize_dynamic_reloc (abfd, prelocs, syms) /* Routine to create an entry in an XCOFF link hash table. */ static struct bfd_hash_entry * -xcoff_link_hash_newfunc (entry, table, string) - struct bfd_hash_entry *entry; - struct bfd_hash_table *table; - const char *string; +xcoff_link_hash_newfunc (struct bfd_hash_entry *entry, + struct bfd_hash_table *table, + const char *string) { struct xcoff_link_hash_entry *ret = (struct xcoff_link_hash_entry *) entry; /* Allocate the structure if it has not already been allocated by a subclass. */ - if (ret == (struct xcoff_link_hash_entry *) NULL) - ret = ((struct xcoff_link_hash_entry *) - bfd_hash_allocate (table, sizeof (struct xcoff_link_hash_entry))); - if (ret == (struct xcoff_link_hash_entry *) NULL) - return (struct bfd_hash_entry *) ret; + if (ret == NULL) + ret = bfd_hash_allocate (table, sizeof (* ret)); + if (ret == NULL) + return NULL; /* Call the allocation method of the superclass. */ ret = ((struct xcoff_link_hash_entry *) @@ -477,19 +436,19 @@ xcoff_link_hash_newfunc (entry, table, string) /* Create a XCOFF link hash table. */ struct bfd_link_hash_table * -_bfd_xcoff_bfd_link_hash_table_create (abfd) - bfd *abfd; +_bfd_xcoff_bfd_link_hash_table_create (bfd *abfd) { struct xcoff_link_hash_table *ret; - bfd_size_type amt = sizeof (struct xcoff_link_hash_table); + bfd_size_type amt = sizeof (* ret); - ret = (struct xcoff_link_hash_table *) bfd_malloc (amt); - if (ret == (struct xcoff_link_hash_table *) NULL) - return (struct bfd_link_hash_table *) NULL; - if (! _bfd_link_hash_table_init (&ret->root, abfd, xcoff_link_hash_newfunc)) + ret = bfd_malloc (amt); + if (ret == NULL) + return NULL; + if (!_bfd_link_hash_table_init (&ret->root, abfd, xcoff_link_hash_newfunc, + sizeof (struct xcoff_link_hash_entry))) { free (ret); - return (struct bfd_link_hash_table *) NULL; + return NULL; } ret->debug_strtab = _bfd_xcoff_stringtab_init (); @@ -517,8 +476,7 @@ _bfd_xcoff_bfd_link_hash_table_create (abfd) /* Free a XCOFF link hash table. */ void -_bfd_xcoff_bfd_link_hash_table_free (hash) - struct bfd_link_hash_table *hash; +_bfd_xcoff_bfd_link_hash_table_free (struct bfd_link_hash_table *hash) { struct xcoff_link_hash_table *ret = (struct xcoff_link_hash_table *) hash; @@ -532,16 +490,13 @@ _bfd_xcoff_bfd_link_hash_table_free (hash) relocs which may have been cached for the enclosing section. */ static struct internal_reloc * -xcoff_read_internal_relocs (abfd, sec, cache, external_relocs, - require_internal, internal_relocs) - bfd *abfd; - asection *sec; - bfd_boolean cache; - bfd_byte *external_relocs; - bfd_boolean require_internal; - struct internal_reloc *internal_relocs; +xcoff_read_internal_relocs (bfd *abfd, + asection *sec, + bfd_boolean cache, + bfd_byte *external_relocs, + bfd_boolean require_internal, + struct internal_reloc *internal_relocs) { - if (coff_section_data (abfd, sec) != NULL && coff_section_data (abfd, sec)->relocs == NULL && xcoff_section_data (abfd, sec) != NULL) @@ -557,8 +512,7 @@ xcoff_read_internal_relocs (abfd, sec, cache, external_relocs, && enclosing->reloc_count > 0) { if (_bfd_coff_read_internal_relocs (abfd, enclosing, TRUE, - external_relocs, FALSE, - (struct internal_reloc *) NULL) + external_relocs, FALSE, NULL) == NULL) return NULL; } @@ -585,1495 +539,11 @@ xcoff_read_internal_relocs (abfd, sec, cache, external_relocs, require_internal, internal_relocs); } -/* Given an XCOFF BFD, add symbols to the global hash table as - appropriate. */ - -bfd_boolean -_bfd_xcoff_bfd_link_add_symbols (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - - switch (bfd_get_format (abfd)) - { - case bfd_object: - return xcoff_link_add_object_symbols (abfd, info); - - case bfd_archive: - /* If the archive has a map, do the usual search. We then need - to check the archive for dynamic objects, because they may not - appear in the archive map even though they should, perhaps, be - included. If the archive has no map, we just consider each object - file in turn, since that apparently is what the AIX native linker - does. */ - if (bfd_has_map (abfd)) - { - if (! (_bfd_generic_link_add_archive_symbols - (abfd, info, xcoff_link_check_archive_element))) - return FALSE; - } - - { - bfd *member; - - member = bfd_openr_next_archived_file (abfd, (bfd *) NULL); - while (member != NULL) - { - if (bfd_check_format (member, bfd_object) - && (info->hash->creator == member->xvec) - && (! bfd_has_map (abfd) || (member->flags & DYNAMIC) != 0)) - { - bfd_boolean needed; - - if (! xcoff_link_check_archive_element (member, info, - &needed)) - return FALSE; - if (needed) - member->archive_pass = -1; - } - member = bfd_openr_next_archived_file (abfd, member); - } - } - - return TRUE; - - default: - bfd_set_error (bfd_error_wrong_format); - return FALSE; - } -} - -/* Add symbols from an XCOFF object file. */ - -static bfd_boolean -xcoff_link_add_object_symbols (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - - if (! _bfd_coff_get_external_symbols (abfd)) - return FALSE; - if (! xcoff_link_add_symbols (abfd, info)) - return FALSE; - if (! info->keep_memory) - { - if (! _bfd_coff_free_symbols (abfd)) - return FALSE; - } - return TRUE; -} - -/* Check a single archive element to see if we need to include it in - the link. *PNEEDED is set according to whether this element is - needed in the link or not. This is called via - _bfd_generic_link_add_archive_symbols. */ - -static bfd_boolean -xcoff_link_check_archive_element (abfd, info, pneeded) - bfd *abfd; - struct bfd_link_info *info; - bfd_boolean *pneeded; -{ - - if (! _bfd_coff_get_external_symbols (abfd)) - return FALSE; - - if (! xcoff_link_check_ar_symbols (abfd, info, pneeded)) - return FALSE; - - if (*pneeded) - { - if (! xcoff_link_add_symbols (abfd, info)) - return FALSE; - } - - if (! info->keep_memory || ! *pneeded) - { - if (! _bfd_coff_free_symbols (abfd)) - return FALSE; - } - - return TRUE; -} - -/* Look through the symbols to see if this object file should be - included in the link. */ - -static bfd_boolean -xcoff_link_check_ar_symbols (abfd, info, pneeded) - bfd *abfd; - struct bfd_link_info *info; - bfd_boolean *pneeded; -{ - bfd_size_type symesz; - bfd_byte *esym; - bfd_byte *esym_end; - - *pneeded = FALSE; - - if ((abfd->flags & DYNAMIC) != 0 - && ! info->static_link - && info->hash->creator == abfd->xvec) - return xcoff_link_check_dynamic_ar_symbols (abfd, info, pneeded); - - symesz = bfd_coff_symesz (abfd); - esym = (bfd_byte *) obj_coff_external_syms (abfd); - esym_end = esym + obj_raw_syment_count (abfd) * symesz; - while (esym < esym_end) - { - struct internal_syment sym; - - bfd_coff_swap_sym_in (abfd, (PTR) esym, (PTR) &sym); - - if (sym.n_sclass == C_EXT && sym.n_scnum != N_UNDEF) - { - const char *name; - char buf[SYMNMLEN + 1]; - struct bfd_link_hash_entry *h; - - /* This symbol is externally visible, and is defined by this - object file. */ - - name = _bfd_coff_internal_syment_name (abfd, &sym, buf); - - if (name == NULL) - return FALSE; - h = bfd_link_hash_lookup (info->hash, name, FALSE, FALSE, TRUE); - - /* We are only interested in symbols that are currently - undefined. If a symbol is currently known to be common, - XCOFF linkers do not bring in an object file which - defines it. We also don't bring in symbols to satisfy - undefined references in shared objects. */ - if (h != (struct bfd_link_hash_entry *) NULL - && h->type == bfd_link_hash_undefined - && (info->hash->creator != abfd->xvec - || (((struct xcoff_link_hash_entry *) h)->flags - & XCOFF_DEF_DYNAMIC) == 0)) - { - if (! (*info->callbacks->add_archive_element) (info, abfd, name)) - return FALSE; - *pneeded = TRUE; - return TRUE; - } - } - - esym += (sym.n_numaux + 1) * symesz; - } - - /* We do not need this object file. */ - return TRUE; -} - -/* Look through the loader symbols to see if this dynamic object - should be included in the link. The native linker uses the loader - symbols, not the normal symbol table, so we do too. */ - -static bfd_boolean -xcoff_link_check_dynamic_ar_symbols (abfd, info, pneeded) - bfd *abfd; - struct bfd_link_info *info; - bfd_boolean *pneeded; -{ - asection *lsec; - bfd_byte *contents; - struct internal_ldhdr ldhdr; - const char *strings; - bfd_byte *elsym, *elsymend; - - *pneeded = FALSE; - - lsec = bfd_get_section_by_name (abfd, ".loader"); - if (lsec == NULL) - { - /* There are no symbols, so don't try to include it. */ - return TRUE; - } - - if (! xcoff_get_section_contents (abfd, lsec)) - return FALSE; - contents = coff_section_data (abfd, lsec)->contents; - - bfd_xcoff_swap_ldhdr_in (abfd, contents, &ldhdr); - - strings = (char *) contents + ldhdr.l_stoff; - - elsym = contents + bfd_xcoff_loader_symbol_offset(abfd, &ldhdr); - - elsymend = elsym + ldhdr.l_nsyms * bfd_xcoff_ldsymsz(abfd); - for (; elsym < elsymend; elsym += bfd_xcoff_ldsymsz(abfd)) - { - struct internal_ldsym ldsym; - char nambuf[SYMNMLEN + 1]; - const char *name; - struct bfd_link_hash_entry *h; - - bfd_xcoff_swap_ldsym_in (abfd, elsym, &ldsym); - - /* We are only interested in exported symbols. */ - if ((ldsym.l_smtype & L_EXPORT) == 0) - continue; - - if (ldsym._l._l_l._l_zeroes == 0) - name = strings + ldsym._l._l_l._l_offset; - else - { - memcpy (nambuf, ldsym._l._l_name, SYMNMLEN); - nambuf[SYMNMLEN] = '\0'; - name = nambuf; - } - - h = bfd_link_hash_lookup (info->hash, name, FALSE, FALSE, TRUE); - - /* We are only interested in symbols that are currently - undefined. At this point we know that we are using an XCOFF - hash table. */ - if (h != NULL - && h->type == bfd_link_hash_undefined - && (((struct xcoff_link_hash_entry *) h)->flags - & XCOFF_DEF_DYNAMIC) == 0) - { - if (! (*info->callbacks->add_archive_element) (info, abfd, name)) - return FALSE; - *pneeded = TRUE; - return TRUE; - } - } - - /* We do not need this shared object. */ - - if (contents != NULL && ! coff_section_data (abfd, lsec)->keep_contents) - { - free (coff_section_data (abfd, lsec)->contents); - coff_section_data (abfd, lsec)->contents = NULL; - } - - return TRUE; -} - -/* Returns the index of reloc in RELOCS with the least address greater - than or equal to ADDRESS. The relocs are sorted by address. */ - -static bfd_size_type -xcoff_find_reloc (relocs, count, address) - struct internal_reloc *relocs; - bfd_size_type count; - bfd_vma address; -{ - bfd_size_type min, max, this; - - if (count < 2) - { - if (count == 1 && relocs[0].r_vaddr < address) - return 1; - else - return 0; - } - - min = 0; - max = count; - - /* Do a binary search over (min,max]. */ - while (min + 1 < max) - { - bfd_vma raddr; - - this = (max + min) / 2; - raddr = relocs[this].r_vaddr; - if (raddr > address) - max = this; - else if (raddr < address) - min = this; - else - { - min = this; - break; - } - } - - if (relocs[min].r_vaddr < address) - return min + 1; - - while (min > 0 - && relocs[min - 1].r_vaddr == address) - --min; - - return min; -} - - -/* xcoff_link_create_extra_sections - - Takes care of creating the .loader, .gl, .ds, .debug and sections. */ - -static bfd_boolean -xcoff_link_create_extra_sections(bfd * abfd, struct bfd_link_info *info) -{ - - bfd_boolean return_value = FALSE; - - if (info->hash->creator == abfd->xvec) - { - - /* We need to build a .loader section, so we do it here. This - won't work if we're producing an XCOFF output file with no - XCOFF input files. FIXME. */ - - if (xcoff_hash_table (info)->loader_section == NULL) - { - asection *lsec; - - lsec = bfd_make_section_anyway (abfd, ".loader"); - if (lsec == NULL) - { - goto end_return; - } - xcoff_hash_table (info)->loader_section = lsec; - lsec->flags |= SEC_HAS_CONTENTS | SEC_IN_MEMORY; - } - - /* Likewise for the linkage section. */ - if (xcoff_hash_table (info)->linkage_section == NULL) - { - asection *lsec; - - lsec = bfd_make_section_anyway (abfd, ".gl"); - if (lsec == NULL) - { - goto end_return; - } - - xcoff_hash_table (info)->linkage_section = lsec; - lsec->flags |= (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS - | SEC_IN_MEMORY); - lsec->alignment_power = 2; - } - - /* Likewise for the TOC section. */ - if (xcoff_hash_table (info)->toc_section == NULL) - { - asection *tsec; - - tsec = bfd_make_section_anyway (abfd, ".tc"); - if (tsec == NULL) - { - goto end_return; - } - - xcoff_hash_table (info)->toc_section = tsec; - tsec->flags |= (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS - | SEC_IN_MEMORY); - tsec->alignment_power = 2; - } - - /* Likewise for the descriptor section. */ - if (xcoff_hash_table (info)->descriptor_section == NULL) - { - asection *dsec; - - dsec = bfd_make_section_anyway (abfd, ".ds"); - if (dsec == NULL) - { - goto end_return; - } - - xcoff_hash_table (info)->descriptor_section = dsec; - dsec->flags |= (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS - | SEC_IN_MEMORY); - dsec->alignment_power = 2; - } - - /* Likewise for the .debug section. */ - if (xcoff_hash_table (info)->debug_section == NULL - && info->strip != strip_all) - { - asection *dsec; - - dsec = bfd_make_section_anyway (abfd, ".debug"); - if (dsec == NULL) - { - goto end_return; - } - xcoff_hash_table (info)->debug_section = dsec; - dsec->flags |= SEC_HAS_CONTENTS | SEC_IN_MEMORY; - } - } - - return_value = TRUE; - - end_return: - - return return_value; -} - -/* Add all the symbols from an object file to the hash table. - - XCOFF is a weird format. A normal XCOFF .o files will have three - COFF sections--.text, .data, and .bss--but each COFF section will - contain many csects. These csects are described in the symbol - table. From the linker's point of view, each csect must be - considered a section in its own right. For example, a TOC entry is - handled as a small XMC_TC csect. The linker must be able to merge - different TOC entries together, which means that it must be able to - extract the XMC_TC csects from the .data section of the input .o - file. - - From the point of view of our linker, this is, of course, a hideous - nightmare. We cope by actually creating sections for each csect, - and discarding the original sections. We then have to handle the - relocation entries carefully, since the only way to tell which - csect they belong to is to examine the address. */ - -static bfd_boolean -xcoff_link_add_symbols (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - unsigned int n_tmask; - unsigned int n_btshft; - bfd_boolean default_copy; - bfd_size_type symcount; - struct xcoff_link_hash_entry **sym_hash; - asection **csect_cache; - bfd_size_type linesz; - asection *o; - asection *last_real; - bfd_boolean keep_syms; - asection *csect; - unsigned int csect_index; - asection *first_csect; - bfd_size_type symesz; - bfd_byte *esym; - bfd_byte *esym_end; - struct reloc_info_struct - { - struct internal_reloc *relocs; - asection **csects; - bfd_byte *linenos; - } *reloc_info = NULL; - bfd_size_type amt; - - keep_syms = obj_coff_keep_syms (abfd); - - if ((abfd->flags & DYNAMIC) != 0 - && ! info->static_link) - { - if (! xcoff_link_add_dynamic_symbols (abfd, info)) - return FALSE; - } - - /* create the loader, toc, gl, ds and debug sections, if needed */ - if (! xcoff_link_create_extra_sections (abfd, info)) - goto error_return; - - if ((abfd->flags & DYNAMIC) != 0 - && ! info->static_link) - return TRUE; - - n_tmask = coff_data (abfd)->local_n_tmask; - n_btshft = coff_data (abfd)->local_n_btshft; - - /* Define macros so that ISFCN, et. al., macros work correctly. */ -#define N_TMASK n_tmask -#define N_BTSHFT n_btshft - - if (info->keep_memory) - default_copy = FALSE; - else - default_copy = TRUE; - - symcount = obj_raw_syment_count (abfd); - - /* We keep a list of the linker hash table entries that correspond - to each external symbol. */ - amt = symcount * sizeof (struct xcoff_link_hash_entry *); - sym_hash = (struct xcoff_link_hash_entry **) bfd_zalloc (abfd, amt); - if (sym_hash == NULL && symcount != 0) - goto error_return; - coff_data (abfd)->sym_hashes = (struct coff_link_hash_entry **) sym_hash; - - /* Because of the weird stuff we are doing with XCOFF csects, we can - not easily determine which section a symbol is in, so we store - the information in the tdata for the input file. */ - amt = symcount * sizeof (asection *); - csect_cache = (asection **) bfd_zalloc (abfd, amt); - if (csect_cache == NULL && symcount != 0) - goto error_return; - xcoff_data (abfd)->csects = csect_cache; - - /* While splitting sections into csects, we need to assign the - relocs correctly. The relocs and the csects must both be in - order by VMA within a given section, so we handle this by - scanning along the relocs as we process the csects. We index - into reloc_info using the section target_index. */ - amt = abfd->section_count + 1; - amt *= sizeof (struct reloc_info_struct); - reloc_info = (struct reloc_info_struct *) bfd_zmalloc (amt); - if (reloc_info == NULL) - goto error_return; - - /* Read in the relocs and line numbers for each section. */ - linesz = bfd_coff_linesz (abfd); - last_real = NULL; - for (o = abfd->sections; o != NULL; o = o->next) - { - - last_real = o; - if ((o->flags & SEC_RELOC) != 0) - { - - reloc_info[o->target_index].relocs = - xcoff_read_internal_relocs (abfd, o, TRUE, (bfd_byte *) NULL, - FALSE, (struct internal_reloc *) NULL); - amt = o->reloc_count; - amt *= sizeof (asection *); - reloc_info[o->target_index].csects = (asection **) bfd_zmalloc (amt); - if (reloc_info[o->target_index].csects == NULL) - goto error_return; - } - - if ((info->strip == strip_none || info->strip == strip_some) - && o->lineno_count > 0) - { - - bfd_byte *linenos; - - amt = linesz * o->lineno_count; - linenos = (bfd_byte *) bfd_malloc (amt); - if (linenos == NULL) - goto error_return; - reloc_info[o->target_index].linenos = linenos; - if (bfd_seek (abfd, o->line_filepos, SEEK_SET) != 0 - || bfd_bread (linenos, amt, abfd) != amt) - goto error_return; - - } - } - - /* Don't let the linker relocation routines discard the symbols. */ - obj_coff_keep_syms (abfd) = TRUE; - - csect = NULL; - csect_index = 0; - first_csect = NULL; - - symesz = bfd_coff_symesz (abfd); - BFD_ASSERT (symesz == bfd_coff_auxesz (abfd)); - esym = (bfd_byte *) obj_coff_external_syms (abfd); - esym_end = esym + symcount * symesz; - - while (esym < esym_end) - { - struct internal_syment sym; - union internal_auxent aux; - const char *name; - char buf[SYMNMLEN + 1]; - int smtyp; - flagword flags; - asection *section; - bfd_vma value; - struct xcoff_link_hash_entry *set_toc; - - bfd_coff_swap_sym_in (abfd, (PTR) esym, (PTR) &sym); - - /* In this pass we are only interested in symbols with csect - information. */ - if (sym.n_sclass != C_EXT && sym.n_sclass != C_HIDEXT) - { - - /* Set csect_cache, - Normally csect is a .pr, .rw etc. created in the loop - If C_FILE or first time, handle special - - Advance esym, sym_hash, csect_hash ptr's - Keep track of the last_symndx for the current file. */ - if (sym.n_sclass == C_FILE && csect != NULL) - { - xcoff_section_data (abfd, csect)->last_symndx = - ((esym - - (bfd_byte *) obj_coff_external_syms (abfd)) - / symesz); - csect = NULL; - } - - if (csect != NULL) - *csect_cache = csect; - else if (first_csect == NULL || sym.n_sclass == C_FILE) - *csect_cache = coff_section_from_bfd_index (abfd, sym.n_scnum); - else - *csect_cache = NULL; - esym += (sym.n_numaux + 1) * symesz; - sym_hash += sym.n_numaux + 1; - csect_cache += sym.n_numaux + 1; - - continue; - } - - name = _bfd_coff_internal_syment_name (abfd, &sym, buf); - - if (name == NULL) - goto error_return; - - /* If this symbol has line number information attached to it, - and we're not stripping it, count the number of entries and - add them to the count for this csect. In the final link pass - we are going to attach line number information by symbol, - rather than by section, in order to more easily handle - garbage collection. */ - if ((info->strip == strip_none || info->strip == strip_some) - && sym.n_numaux > 1 - && csect != NULL - && ISFCN (sym.n_type)) - { - - union internal_auxent auxlin; - - bfd_coff_swap_aux_in (abfd, (PTR) (esym + symesz), - sym.n_type, sym.n_sclass, - 0, sym.n_numaux, (PTR) &auxlin); - - if (auxlin.x_sym.x_fcnary.x_fcn.x_lnnoptr != 0) - { - asection *enclosing; - bfd_signed_vma linoff; - - enclosing = xcoff_section_data (abfd, csect)->enclosing; - if (enclosing == NULL) - { - (*_bfd_error_handler) - (_("%s: `%s' has line numbers but no enclosing section"), - bfd_archive_filename (abfd), name); - bfd_set_error (bfd_error_bad_value); - goto error_return; - } - linoff = (auxlin.x_sym.x_fcnary.x_fcn.x_lnnoptr - - enclosing->line_filepos); - /* explicit cast to bfd_signed_vma for compiler */ - if (linoff < (bfd_signed_vma) (enclosing->lineno_count * linesz)) - { - struct internal_lineno lin; - bfd_byte *linpstart; - - linpstart = (reloc_info[enclosing->target_index].linenos - + linoff); - bfd_coff_swap_lineno_in (abfd, (PTR) linpstart, (PTR) &lin); - if (lin.l_lnno == 0 - && ((bfd_size_type) lin.l_addr.l_symndx - == ((esym - - (bfd_byte *) obj_coff_external_syms (abfd)) - / symesz))) - { - bfd_byte *linpend, *linp; - - linpend = (reloc_info[enclosing->target_index].linenos - + enclosing->lineno_count * linesz); - for (linp = linpstart + linesz; - linp < linpend; - linp += linesz) - { - bfd_coff_swap_lineno_in (abfd, (PTR) linp, - (PTR) &lin); - if (lin.l_lnno == 0) - break; - } - csect->lineno_count += (linp - linpstart) / linesz; - /* The setting of line_filepos will only be - useful if all the line number entries for a - csect are contiguous; this only matters for - error reporting. */ - if (csect->line_filepos == 0) - csect->line_filepos = - auxlin.x_sym.x_fcnary.x_fcn.x_lnnoptr; - } - } - } - } - - /* Pick up the csect auxiliary information. */ - - if (sym.n_numaux == 0) - { - (*_bfd_error_handler) - (_("%s: class %d symbol `%s' has no aux entries"), - bfd_archive_filename (abfd), sym.n_sclass, name); - bfd_set_error (bfd_error_bad_value); - goto error_return; - } - - bfd_coff_swap_aux_in (abfd, - (PTR) (esym + symesz * sym.n_numaux), - sym.n_type, sym.n_sclass, - sym.n_numaux - 1, sym.n_numaux, - (PTR) &aux); - - smtyp = SMTYP_SMTYP (aux.x_csect.x_smtyp); - - flags = BSF_GLOBAL; - section = NULL; - value = 0; - set_toc = NULL; - - switch (smtyp) - { - default: - (*_bfd_error_handler) - (_("%s: symbol `%s' has unrecognized csect type %d"), - bfd_archive_filename (abfd), name, smtyp); - bfd_set_error (bfd_error_bad_value); - goto error_return; - - case XTY_ER: - /* This is an external reference. */ - if (sym.n_sclass == C_HIDEXT - || sym.n_scnum != N_UNDEF - || aux.x_csect.x_scnlen.l != 0) - { - (*_bfd_error_handler) - (_("%s: bad XTY_ER symbol `%s': class %d scnum %d scnlen %d"), - bfd_archive_filename (abfd), name, sym.n_sclass, sym.n_scnum, - aux.x_csect.x_scnlen.l); - bfd_set_error (bfd_error_bad_value); - goto error_return; - } - - /* An XMC_XO external reference is actually a reference to - an absolute location. */ - if (aux.x_csect.x_smclas != XMC_XO) - section = bfd_und_section_ptr; - else - { - section = bfd_abs_section_ptr; - value = sym.n_value; - } - break; - - case XTY_SD: - /* This is a csect definition. */ - if (csect != NULL) - { - xcoff_section_data (abfd, csect)->last_symndx = - ((esym - (bfd_byte *) obj_coff_external_syms (abfd)) / symesz); - } - - csect = NULL; - csect_index = -(unsigned) 1; - - /* When we see a TOC anchor, we record the TOC value. */ - if (aux.x_csect.x_smclas == XMC_TC0) - { - if (sym.n_sclass != C_HIDEXT - || aux.x_csect.x_scnlen.l != 0) - { - (*_bfd_error_handler) - (_("%s: XMC_TC0 symbol `%s' is class %d scnlen %d"), - bfd_archive_filename (abfd), name, sym.n_sclass, - aux.x_csect.x_scnlen.l); - bfd_set_error (bfd_error_bad_value); - goto error_return; - } - xcoff_data (abfd)->toc = sym.n_value; - } - - /* We must merge TOC entries for the same symbol. We can - merge two TOC entries if they are both C_HIDEXT, they - both have the same name, they are both 4 or 8 bytes long, and - they both have a relocation table entry for an external - symbol with the same name. Unfortunately, this means - that we must look through the relocations. Ick. - - Logic for 32 bit vs 64 bit. - 32 bit has a csect length of 4 for TOC - 64 bit has a csect length of 8 for TOC - - The conditions to get past the if-check are not that bad. - They are what is used to create the TOC csects in the first - place. */ - if (aux.x_csect.x_smclas == XMC_TC - && sym.n_sclass == C_HIDEXT - && info->hash->creator == abfd->xvec - && ((bfd_xcoff_is_xcoff32 (abfd) - && aux.x_csect.x_scnlen.l == 4) - || (bfd_xcoff_is_xcoff64 (abfd) - && aux.x_csect.x_scnlen.l == 8))) - { - asection *enclosing; - struct internal_reloc *relocs; - bfd_size_type relindx; - struct internal_reloc *rel; - - enclosing = coff_section_from_bfd_index (abfd, sym.n_scnum); - if (enclosing == NULL) - goto error_return; - - relocs = reloc_info[enclosing->target_index].relocs; - amt = enclosing->reloc_count; - relindx = xcoff_find_reloc (relocs, amt, sym.n_value); - rel = relocs + relindx; - - /* 32 bit R_POS r_size is 31 - 64 bit R_POS r_size is 63 */ - if (relindx < enclosing->reloc_count - && rel->r_vaddr == (bfd_vma) sym.n_value - && rel->r_type == R_POS - && ((bfd_xcoff_is_xcoff32 (abfd) - && rel->r_size == 31) - || (bfd_xcoff_is_xcoff64 (abfd) - && rel->r_size == 63))) - { - bfd_byte *erelsym; - - struct internal_syment relsym; - - erelsym = ((bfd_byte *) obj_coff_external_syms (abfd) - + rel->r_symndx * symesz); - bfd_coff_swap_sym_in (abfd, (PTR) erelsym, (PTR) &relsym); - if (relsym.n_sclass == C_EXT) - { - const char *relname; - char relbuf[SYMNMLEN + 1]; - bfd_boolean copy; - struct xcoff_link_hash_entry *h; - - /* At this point we know that the TOC entry is - for an externally visible symbol. */ - - relname = _bfd_coff_internal_syment_name (abfd, &relsym, - relbuf); - if (relname == NULL) - goto error_return; - - /* We only merge TOC entries if the TC name is - the same as the symbol name. This handles - the normal case, but not common cases like - SYM.P4 which gcc generates to store SYM + 4 - in the TOC. FIXME. */ - - if (strcmp (name, relname) == 0) - { - copy = (! info->keep_memory - || relsym._n._n_n._n_zeroes != 0 - || relsym._n._n_n._n_offset == 0); - h = xcoff_link_hash_lookup (xcoff_hash_table (info), - relname, TRUE, copy, - FALSE); - if (h == NULL) - goto error_return; - - /* At this point h->root.type could be - bfd_link_hash_new. That should be OK, - since we know for sure that we will come - across this symbol as we step through the - file. */ - - /* We store h in *sym_hash for the - convenience of the relocate_section - function. */ - *sym_hash = h; - - if (h->toc_section != NULL) - { - asection **rel_csects; - - /* We already have a TOC entry for this - symbol, so we can just ignore this - one. */ - rel_csects = - reloc_info[enclosing->target_index].csects; - rel_csects[relindx] = bfd_und_section_ptr; - break; - } - - /* We are about to create a TOC entry for - this symbol. */ - set_toc = h; - } /* merge toc reloc */ - } /* c_ext */ - } /* reloc */ - } /* merge toc */ - - { - - asection *enclosing; - - /* We need to create a new section. We get the name from - the csect storage mapping class, so that the linker can - accumulate similar csects together. */ - - csect = bfd_xcoff_create_csect_from_smclas(abfd, &aux, name); - if (NULL == csect) - { - goto error_return; - } - - /* The enclosing section is the main section : .data, .text - or .bss that the csect is coming from. */ - enclosing = coff_section_from_bfd_index (abfd, sym.n_scnum); - if (enclosing == NULL) - goto error_return; - - if (! bfd_is_abs_section (enclosing) - && ((bfd_vma) sym.n_value < enclosing->vma - || ((bfd_vma) sym.n_value + aux.x_csect.x_scnlen.l - > enclosing->vma + enclosing->_raw_size))) - { - (*_bfd_error_handler) - (_("%s: csect `%s' not in enclosing section"), - bfd_archive_filename (abfd), name); - bfd_set_error (bfd_error_bad_value); - goto error_return; - } - csect->vma = sym.n_value; - csect->filepos = (enclosing->filepos - + sym.n_value - - enclosing->vma); - csect->_raw_size = aux.x_csect.x_scnlen.l; - csect->flags |= SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS; - csect->alignment_power = SMTYP_ALIGN (aux.x_csect.x_smtyp); - - /* Record the enclosing section in the tdata for this new - section. */ - amt = sizeof (struct coff_section_tdata); - csect->used_by_bfd = (PTR) bfd_zalloc (abfd, amt); - if (csect->used_by_bfd == NULL) - goto error_return; - amt = sizeof (struct xcoff_section_tdata); - coff_section_data (abfd, csect)->tdata = bfd_zalloc (abfd, amt); - if (coff_section_data (abfd, csect)->tdata == NULL) - goto error_return; - xcoff_section_data (abfd, csect)->enclosing = enclosing; - xcoff_section_data (abfd, csect)->lineno_count = - enclosing->lineno_count; - - if (enclosing->owner == abfd) - { - struct internal_reloc *relocs; - bfd_size_type relindx; - struct internal_reloc *rel; - asection **rel_csect; - - relocs = reloc_info[enclosing->target_index].relocs; - amt = enclosing->reloc_count; - relindx = xcoff_find_reloc (relocs, amt, csect->vma); - - rel = relocs + relindx; - rel_csect = (reloc_info[enclosing->target_index].csects - + relindx); - - csect->rel_filepos = (enclosing->rel_filepos - + relindx * bfd_coff_relsz (abfd)); - while (relindx < enclosing->reloc_count - && *rel_csect == NULL - && rel->r_vaddr < csect->vma + csect->_raw_size) - { - - *rel_csect = csect; - csect->flags |= SEC_RELOC; - ++csect->reloc_count; - ++relindx; - ++rel; - ++rel_csect; - } - } - - /* There are a number of other fields and section flags - which we do not bother to set. */ - - csect_index = ((esym - - (bfd_byte *) obj_coff_external_syms (abfd)) - / symesz); - - xcoff_section_data (abfd, csect)->first_symndx = csect_index; - - if (first_csect == NULL) - first_csect = csect; - - /* If this symbol is C_EXT, we treat it as starting at the - beginning of the newly created section. */ - if (sym.n_sclass == C_EXT) - { - section = csect; - value = 0; - } - - /* If this is a TOC section for a symbol, record it. */ - if (set_toc != NULL) - set_toc->toc_section = csect; - } - break; - - case XTY_LD: - /* This is a label definition. The x_scnlen field is the - symbol index of the csect. Usually the XTY_LD symbol will - follow its appropriate XTY_SD symbol. The .set pseudo op can - cause the XTY_LD to not follow the XTY_SD symbol. */ - { - bfd_boolean bad; - - bad = FALSE; - if (aux.x_csect.x_scnlen.l < 0 - || (aux.x_csect.x_scnlen.l - >= esym - (bfd_byte *) obj_coff_external_syms (abfd))) - bad = TRUE; - if (! bad) - { - section = xcoff_data (abfd)->csects[aux.x_csect.x_scnlen.l]; - if (section == NULL - || (section->flags & SEC_HAS_CONTENTS) == 0) - bad = TRUE; - } - if (bad) - { - (*_bfd_error_handler) - (_("%s: misplaced XTY_LD `%s'"), - bfd_archive_filename (abfd), name); - bfd_set_error (bfd_error_bad_value); - goto error_return; - } - csect = section; - value = sym.n_value - csect->vma; - } - break; - - case XTY_CM: - /* This is an unitialized csect. We could base the name on - the storage mapping class, but we don't bother except for - an XMC_TD symbol. If this csect is externally visible, - it is a common symbol. We put XMC_TD symbols in sections - named .tocbss, and rely on the linker script to put that - in the TOC area. */ - - if (csect != NULL) - { - xcoff_section_data (abfd, csect)->last_symndx = - ((esym - - (bfd_byte *) obj_coff_external_syms (abfd)) - / symesz); - } - - if (aux.x_csect.x_smclas == XMC_TD) - { - /* The linker script puts the .td section in the data - section after the .tc section. */ - csect = bfd_make_section_anyway (abfd, ".td"); - - } - else - { - csect = bfd_make_section_anyway (abfd, ".bss"); - } - if (csect == NULL) - goto error_return; - csect->vma = sym.n_value; - csect->_raw_size = aux.x_csect.x_scnlen.l; - csect->flags |= SEC_ALLOC; - csect->alignment_power = SMTYP_ALIGN (aux.x_csect.x_smtyp); - /* There are a number of other fields and section flags - which we do not bother to set. */ - - csect_index = ((esym - - (bfd_byte *) obj_coff_external_syms (abfd)) - / symesz); - - amt = sizeof (struct coff_section_tdata); - csect->used_by_bfd = (PTR) bfd_zalloc (abfd, amt); - if (csect->used_by_bfd == NULL) - goto error_return; - amt = sizeof (struct xcoff_section_tdata); - coff_section_data (abfd, csect)->tdata = bfd_zalloc (abfd, amt); - if (coff_section_data (abfd, csect)->tdata == NULL) - goto error_return; - xcoff_section_data (abfd, csect)->first_symndx = csect_index; - - if (first_csect == NULL) - first_csect = csect; - - if (sym.n_sclass == C_EXT) - { - csect->flags |= SEC_IS_COMMON; - csect->_raw_size = 0; - section = csect; - value = aux.x_csect.x_scnlen.l; - } - - break; - } - - /* Check for magic symbol names. */ - if ((smtyp == XTY_SD || smtyp == XTY_CM) - && aux.x_csect.x_smclas != XMC_TC - && aux.x_csect.x_smclas != XMC_TD) - { - - int i = -1; - - if (name[0] == '_') - { - if (strcmp (name, "_text") == 0) - i = XCOFF_SPECIAL_SECTION_TEXT; - else if (strcmp (name, "_etext") == 0) - i = XCOFF_SPECIAL_SECTION_ETEXT; - else if (strcmp (name, "_data") == 0) - i = XCOFF_SPECIAL_SECTION_DATA; - else if (strcmp (name, "_edata") == 0) - i = XCOFF_SPECIAL_SECTION_EDATA; - else if (strcmp (name, "_end") == 0) - i = XCOFF_SPECIAL_SECTION_END; - } - else if (name[0] == 'e' && strcmp (name, "end") == 0) - { - i = XCOFF_SPECIAL_SECTION_END2; - } - - if (i != -1) - { - xcoff_hash_table (info)->special_sections[i] = csect; - } - } - - /* Now we have enough information to add the symbol to the - linker hash table. */ - - if (sym.n_sclass == C_EXT) - { - bfd_boolean copy; - - BFD_ASSERT (section != NULL); - - /* We must copy the name into memory if we got it from the - syment itself, rather than the string table. */ - copy = default_copy; - if (sym._n._n_n._n_zeroes != 0 - || sym._n._n_n._n_offset == 0) - copy = TRUE; - - /* The AIX linker appears to only detect multiple symbol - definitions when there is a reference to the symbol. If - a symbol is defined multiple times, and the only - references are from the same object file, the AIX linker - appears to permit it. It does not merge the different - definitions, but handles them independently. On the - other hand, if there is a reference, the linker reports - an error. - - This matters because the AIX header - file actually defines an initialized array, so we have to - actually permit that to work. - - Just to make matters even more confusing, the AIX linker - appears to permit multiple symbol definitions whenever - the second definition is in an archive rather than an - object file. This may be a consequence of the manner in - which it handles archives: I think it may load the entire - archive in as separate csects, and then let garbage - collection discard symbols. - - We also have to handle the case of statically linking a - shared object, which will cause symbol redefinitions, - although this is an easier case to detect. */ - - if (info->hash->creator == abfd->xvec) - { - if (! bfd_is_und_section (section)) - { - *sym_hash = xcoff_link_hash_lookup (xcoff_hash_table (info), - name, TRUE, copy, FALSE); - } - else - { - /* Make a copy of the symbol name to prevent problems with - merging symbols. */ - *sym_hash = ((struct xcoff_link_hash_entry *) - bfd_wrapped_link_hash_lookup (abfd, info, name, - TRUE, TRUE, - FALSE)); - } - if (*sym_hash == NULL) - goto error_return; - if (((*sym_hash)->root.type == bfd_link_hash_defined - || (*sym_hash)->root.type == bfd_link_hash_defweak) - && ! bfd_is_und_section (section) - && ! bfd_is_com_section (section)) - { - /* This is a second definition of a defined symbol. */ - if ((abfd->flags & DYNAMIC) != 0 - && ((*sym_hash)->smclas != XMC_GL - || aux.x_csect.x_smclas == XMC_GL - || ((*sym_hash)->root.u.def.section->owner->flags - & DYNAMIC) == 0)) - { - /* The new symbol is from a shared library, and - either the existing symbol is not global - linkage code or this symbol is global linkage - code. If the existing symbol is global - linkage code and the new symbol is not, then - we want to use the new symbol. */ - section = bfd_und_section_ptr; - value = 0; - } - else if (((*sym_hash)->root.u.def.section->owner->flags - & DYNAMIC) != 0) - { - /* The existing symbol is from a shared library. - Replace it. */ - (*sym_hash)->root.type = bfd_link_hash_undefined; - (*sym_hash)->root.u.undef.abfd = - (*sym_hash)->root.u.def.section->owner; - } - else if (abfd->my_archive != NULL) - { - /* This is a redefinition in an object contained - in an archive. Just ignore it. See the - comment above. */ - section = bfd_und_section_ptr; - value = 0; - } - else if ((*sym_hash)->root.und_next != NULL - || info->hash->undefs_tail == &(*sym_hash)->root) - { - /* This symbol has been referenced. In this - case, we just continue and permit the - multiple definition error. See the comment - above about the behaviour of the AIX linker. */ - } - else if ((*sym_hash)->smclas == aux.x_csect.x_smclas) - { - /* The symbols are both csects of the same - class. There is at least a chance that this - is a semi-legitimate redefinition. */ - section = bfd_und_section_ptr; - value = 0; - (*sym_hash)->flags |= XCOFF_MULTIPLY_DEFINED; - } - } - else if (((*sym_hash)->flags & XCOFF_MULTIPLY_DEFINED) != 0 - && ((*sym_hash)->root.type == bfd_link_hash_defined - || (*sym_hash)->root.type == bfd_link_hash_defweak) - && (bfd_is_und_section (section) - || bfd_is_com_section (section))) - { - /* This is a reference to a multiply defined symbol. - Report the error now. See the comment above - about the behaviour of the AIX linker. We could - also do this with warning symbols, but I'm not - sure the XCOFF linker is wholly prepared to - handle them, and that would only be a warning, - not an error. */ - if (! ((*info->callbacks->multiple_definition) - (info, (*sym_hash)->root.root.string, - (bfd *) NULL, (asection *) NULL, (bfd_vma) 0, - (*sym_hash)->root.u.def.section->owner, - (*sym_hash)->root.u.def.section, - (*sym_hash)->root.u.def.value))) - goto error_return; - /* Try not to give this error too many times. */ - (*sym_hash)->flags &= ~XCOFF_MULTIPLY_DEFINED; - } - } - - /* _bfd_generic_link_add_one_symbol may call the linker to - generate an error message, and the linker may try to read - the symbol table to give a good error. Right now, the - line numbers are in an inconsistent state, since they are - counted both in the real sections and in the new csects. - We need to leave the count in the real sections so that - the linker can report the line number of the error - correctly, so temporarily clobber the link to the csects - so that the linker will not try to read the line numbers - a second time from the csects. */ - BFD_ASSERT (last_real->next == first_csect); - last_real->next = NULL; - if (! (_bfd_generic_link_add_one_symbol - (info, abfd, name, flags, section, value, - (const char *) NULL, copy, TRUE, - (struct bfd_link_hash_entry **) sym_hash))) - goto error_return; - last_real->next = first_csect; - - if (smtyp == XTY_CM) - { - if ((*sym_hash)->root.type != bfd_link_hash_common - || (*sym_hash)->root.u.c.p->section != csect) - { - /* We don't need the common csect we just created. */ - csect->_raw_size = 0; - } - else - { - (*sym_hash)->root.u.c.p->alignment_power - = csect->alignment_power; - } - } - - if (info->hash->creator == abfd->xvec) - { - int flag; - - if (smtyp == XTY_ER || smtyp == XTY_CM) - flag = XCOFF_REF_REGULAR; - else - flag = XCOFF_DEF_REGULAR; - (*sym_hash)->flags |= flag; - - if ((*sym_hash)->smclas == XMC_UA - || flag == XCOFF_DEF_REGULAR) - (*sym_hash)->smclas = aux.x_csect.x_smclas; - } - } - - *csect_cache = csect; - - esym += (sym.n_numaux + 1) * symesz; - sym_hash += sym.n_numaux + 1; - csect_cache += sym.n_numaux + 1; - } - - BFD_ASSERT (last_real == NULL || last_real->next == first_csect); - - /* Make sure that we have seen all the relocs. */ - for (o = abfd->sections; o != first_csect; o = o->next) - { - /* Reset the section size and the line number count, since the - data is now attached to the csects. Don't reset the size of - the .debug section, since we need to read it below in - bfd_xcoff_size_dynamic_sections. */ - if (strcmp (bfd_get_section_name (abfd, o), ".debug") != 0) - o->_raw_size = 0; - o->lineno_count = 0; - - if ((o->flags & SEC_RELOC) != 0) - { - bfd_size_type i; - struct internal_reloc *rel; - asection **rel_csect; - - rel = reloc_info[o->target_index].relocs; - rel_csect = reloc_info[o->target_index].csects; - - for (i = 0; i < o->reloc_count; i++, rel++, rel_csect++) - { - - if (*rel_csect == NULL) - { - (*_bfd_error_handler) - (_("%s: reloc %s:%d not in csect"), - bfd_archive_filename (abfd), o->name, i); - bfd_set_error (bfd_error_bad_value); - goto error_return; - } - - /* We identify all symbols which are called, so that we - can create glue code for calls to functions imported - from dynamic objects. */ - if (info->hash->creator == abfd->xvec - && *rel_csect != bfd_und_section_ptr - && (rel->r_type == R_BR - || rel->r_type == R_RBR) - && obj_xcoff_sym_hashes (abfd)[rel->r_symndx] != NULL) - { - struct xcoff_link_hash_entry *h; - - h = obj_xcoff_sym_hashes (abfd)[rel->r_symndx]; - h->flags |= XCOFF_CALLED; - /* If the symbol name starts with a period, it is - the code of a function. If the symbol is - currently undefined, then add an undefined symbol - for the function descriptor. This should do no - harm, because any regular object that defines the - function should also define the function - descriptor. It helps, because it means that we - will identify the function descriptor with a - dynamic object if a dynamic object defines it. */ - if (h->root.root.string[0] == '.' - && h->descriptor == NULL) - { - struct xcoff_link_hash_entry *hds; - struct bfd_link_hash_entry *bh; - - hds = xcoff_link_hash_lookup (xcoff_hash_table (info), - h->root.root.string + 1, - TRUE, FALSE, TRUE); - if (hds == NULL) - goto error_return; - if (hds->root.type == bfd_link_hash_new) - { - bh = &hds->root; - if (! (_bfd_generic_link_add_one_symbol - (info, abfd, hds->root.root.string, - (flagword) 0, bfd_und_section_ptr, - (bfd_vma) 0, (const char *) NULL, FALSE, - TRUE, &bh))) - goto error_return; - hds = (struct xcoff_link_hash_entry *) bh; - } - hds->flags |= XCOFF_DESCRIPTOR; - BFD_ASSERT ((hds->flags & XCOFF_CALLED) == 0 - && (h->flags & XCOFF_DESCRIPTOR) == 0); - hds->descriptor = h; - h->descriptor = hds; - } - } - } - - free (reloc_info[o->target_index].csects); - reloc_info[o->target_index].csects = NULL; - - /* Reset SEC_RELOC and the reloc_count, since the reloc - information is now attached to the csects. */ - o->flags &=~ SEC_RELOC; - o->reloc_count = 0; - - /* If we are not keeping memory, free the reloc information. */ - if (! info->keep_memory - && coff_section_data (abfd, o) != NULL - && coff_section_data (abfd, o)->relocs != NULL - && ! coff_section_data (abfd, o)->keep_relocs) - { - free (coff_section_data (abfd, o)->relocs); - coff_section_data (abfd, o)->relocs = NULL; - } - } - - /* Free up the line numbers. FIXME: We could cache these - somewhere for the final link, to avoid reading them again. */ - if (reloc_info[o->target_index].linenos != NULL) - { - free (reloc_info[o->target_index].linenos); - reloc_info[o->target_index].linenos = NULL; - } - } - - free (reloc_info); - - obj_coff_keep_syms (abfd) = keep_syms; - - return TRUE; - - error_return: - if (reloc_info != NULL) - { - for (o = abfd->sections; o != NULL; o = o->next) - { - if (reloc_info[o->target_index].csects != NULL) - free (reloc_info[o->target_index].csects); - if (reloc_info[o->target_index].linenos != NULL) - free (reloc_info[o->target_index].linenos); - } - free (reloc_info); - } - obj_coff_keep_syms (abfd) = keep_syms; - return FALSE; -} - -#undef N_TMASK -#undef N_BTSHFT - /* This function is used to add symbols from a dynamic object to the global symbol table. */ static bfd_boolean -xcoff_link_add_dynamic_symbols (abfd, info) - bfd *abfd; - struct bfd_link_info *info; +xcoff_link_add_dynamic_symbols (bfd *abfd, struct bfd_link_info *info) { asection *lsec; bfd_byte *contents; @@ -2119,7 +589,6 @@ xcoff_link_add_dynamic_symbols (abfd, info) return FALSE; } - if (! xcoff_get_section_contents (abfd, lsec)) return FALSE; contents = coff_section_data (abfd, lsec)->contents; @@ -2269,9 +738,7 @@ xcoff_link_add_dynamic_symbols (abfd, info) } /* Record this file in the import files. */ - - n = ((struct xcoff_import_file *) - bfd_alloc (abfd, (bfd_size_type) sizeof (struct xcoff_import_file))); + n = bfd_alloc (abfd, (bfd_size_type) sizeof (struct xcoff_import_file)); if (n == NULL) return FALSE; n->next = NULL; @@ -2308,19 +775,1438 @@ xcoff_link_add_dynamic_symbols (abfd, info) return TRUE; } - -/* Routines that are called after all the input files have been - handled, but before the sections are laid out in memory. */ +/* xcoff_link_create_extra_sections + + Takes care of creating the .loader, .gl, .ds, .debug and sections. */ + +static bfd_boolean +xcoff_link_create_extra_sections (bfd * abfd, struct bfd_link_info *info) +{ + bfd_boolean return_value = FALSE; + + if (info->hash->creator == abfd->xvec) + { + /* We need to build a .loader section, so we do it here. This + won't work if we're producing an XCOFF output file with no + XCOFF input files. FIXME. */ + + if (xcoff_hash_table (info)->loader_section == NULL) + { + asection *lsec; + + lsec = bfd_make_section_anyway (abfd, ".loader"); + if (lsec == NULL) + goto end_return; + + xcoff_hash_table (info)->loader_section = lsec; + lsec->flags |= SEC_HAS_CONTENTS | SEC_IN_MEMORY; + } + + /* Likewise for the linkage section. */ + if (xcoff_hash_table (info)->linkage_section == NULL) + { + asection *lsec; + + lsec = bfd_make_section_anyway (abfd, ".gl"); + if (lsec == NULL) + goto end_return; + + xcoff_hash_table (info)->linkage_section = lsec; + lsec->flags |= (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS + | SEC_IN_MEMORY); + lsec->alignment_power = 2; + } + + /* Likewise for the TOC section. */ + if (xcoff_hash_table (info)->toc_section == NULL) + { + asection *tsec; + + tsec = bfd_make_section_anyway (abfd, ".tc"); + if (tsec == NULL) + goto end_return; + + xcoff_hash_table (info)->toc_section = tsec; + tsec->flags |= (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS + | SEC_IN_MEMORY); + tsec->alignment_power = 2; + } + + /* Likewise for the descriptor section. */ + if (xcoff_hash_table (info)->descriptor_section == NULL) + { + asection *dsec; + + dsec = bfd_make_section_anyway (abfd, ".ds"); + if (dsec == NULL) + goto end_return; + + xcoff_hash_table (info)->descriptor_section = dsec; + dsec->flags |= (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS + | SEC_IN_MEMORY); + dsec->alignment_power = 2; + } + + /* Likewise for the .debug section. */ + if (xcoff_hash_table (info)->debug_section == NULL + && info->strip != strip_all) + { + asection *dsec; + + dsec = bfd_make_section_anyway (abfd, ".debug"); + if (dsec == NULL) + goto end_return; + + xcoff_hash_table (info)->debug_section = dsec; + dsec->flags |= SEC_HAS_CONTENTS | SEC_IN_MEMORY; + } + } + + return_value = TRUE; + + end_return: + + return return_value; +} + +/* Returns the index of reloc in RELOCS with the least address greater + than or equal to ADDRESS. The relocs are sorted by address. */ + +static bfd_size_type +xcoff_find_reloc (struct internal_reloc *relocs, + bfd_size_type count, + bfd_vma address) +{ + bfd_size_type min, max, this; + + if (count < 2) + { + if (count == 1 && relocs[0].r_vaddr < address) + return 1; + else + return 0; + } + + min = 0; + max = count; + + /* Do a binary search over (min,max]. */ + while (min + 1 < max) + { + bfd_vma raddr; + + this = (max + min) / 2; + raddr = relocs[this].r_vaddr; + if (raddr > address) + max = this; + else if (raddr < address) + min = this; + else + { + min = this; + break; + } + } + + if (relocs[min].r_vaddr < address) + return min + 1; + + while (min > 0 + && relocs[min - 1].r_vaddr == address) + --min; + + return min; +} + +/* Add all the symbols from an object file to the hash table. + + XCOFF is a weird format. A normal XCOFF .o files will have three + COFF sections--.text, .data, and .bss--but each COFF section will + contain many csects. These csects are described in the symbol + table. From the linker's point of view, each csect must be + considered a section in its own right. For example, a TOC entry is + handled as a small XMC_TC csect. The linker must be able to merge + different TOC entries together, which means that it must be able to + extract the XMC_TC csects from the .data section of the input .o + file. + + From the point of view of our linker, this is, of course, a hideous + nightmare. We cope by actually creating sections for each csect, + and discarding the original sections. We then have to handle the + relocation entries carefully, since the only way to tell which + csect they belong to is to examine the address. */ + +static bfd_boolean +xcoff_link_add_symbols (bfd *abfd, struct bfd_link_info *info) +{ + unsigned int n_tmask; + unsigned int n_btshft; + bfd_boolean default_copy; + bfd_size_type symcount; + struct xcoff_link_hash_entry **sym_hash; + asection **csect_cache; + bfd_size_type linesz; + asection *o; + asection *last_real; + bfd_boolean keep_syms; + asection *csect; + unsigned int csect_index; + asection *first_csect; + bfd_size_type symesz; + bfd_byte *esym; + bfd_byte *esym_end; + struct reloc_info_struct + { + struct internal_reloc *relocs; + asection **csects; + bfd_byte *linenos; + } *reloc_info = NULL; + bfd_size_type amt; + + keep_syms = obj_coff_keep_syms (abfd); + + if ((abfd->flags & DYNAMIC) != 0 + && ! info->static_link) + { + if (! xcoff_link_add_dynamic_symbols (abfd, info)) + return FALSE; + } + + /* Create the loader, toc, gl, ds and debug sections, if needed. */ + if (! xcoff_link_create_extra_sections (abfd, info)) + goto error_return; + + if ((abfd->flags & DYNAMIC) != 0 + && ! info->static_link) + return TRUE; + + n_tmask = coff_data (abfd)->local_n_tmask; + n_btshft = coff_data (abfd)->local_n_btshft; + + /* Define macros so that ISFCN, et. al., macros work correctly. */ +#define N_TMASK n_tmask +#define N_BTSHFT n_btshft + + if (info->keep_memory) + default_copy = FALSE; + else + default_copy = TRUE; + + symcount = obj_raw_syment_count (abfd); + + /* We keep a list of the linker hash table entries that correspond + to each external symbol. */ + amt = symcount * sizeof (struct xcoff_link_hash_entry *); + sym_hash = bfd_zalloc (abfd, amt); + if (sym_hash == NULL && symcount != 0) + goto error_return; + coff_data (abfd)->sym_hashes = (struct coff_link_hash_entry **) sym_hash; + + /* Because of the weird stuff we are doing with XCOFF csects, we can + not easily determine which section a symbol is in, so we store + the information in the tdata for the input file. */ + amt = symcount * sizeof (asection *); + csect_cache = bfd_zalloc (abfd, amt); + if (csect_cache == NULL && symcount != 0) + goto error_return; + xcoff_data (abfd)->csects = csect_cache; + + /* While splitting sections into csects, we need to assign the + relocs correctly. The relocs and the csects must both be in + order by VMA within a given section, so we handle this by + scanning along the relocs as we process the csects. We index + into reloc_info using the section target_index. */ + amt = abfd->section_count + 1; + amt *= sizeof (struct reloc_info_struct); + reloc_info = bfd_zmalloc (amt); + if (reloc_info == NULL) + goto error_return; + + /* Read in the relocs and line numbers for each section. */ + linesz = bfd_coff_linesz (abfd); + last_real = NULL; + for (o = abfd->sections; o != NULL; o = o->next) + { + last_real = o; + + if ((o->flags & SEC_RELOC) != 0) + { + reloc_info[o->target_index].relocs = + xcoff_read_internal_relocs (abfd, o, TRUE, NULL, FALSE, NULL); + amt = o->reloc_count; + amt *= sizeof (asection *); + reloc_info[o->target_index].csects = bfd_zmalloc (amt); + if (reloc_info[o->target_index].csects == NULL) + goto error_return; + } + + if ((info->strip == strip_none || info->strip == strip_some) + && o->lineno_count > 0) + { + bfd_byte *linenos; + + amt = linesz * o->lineno_count; + linenos = bfd_malloc (amt); + if (linenos == NULL) + goto error_return; + reloc_info[o->target_index].linenos = linenos; + if (bfd_seek (abfd, o->line_filepos, SEEK_SET) != 0 + || bfd_bread (linenos, amt, abfd) != amt) + goto error_return; + } + } + + /* Don't let the linker relocation routines discard the symbols. */ + obj_coff_keep_syms (abfd) = TRUE; + + csect = NULL; + csect_index = 0; + first_csect = NULL; + + symesz = bfd_coff_symesz (abfd); + BFD_ASSERT (symesz == bfd_coff_auxesz (abfd)); + esym = (bfd_byte *) obj_coff_external_syms (abfd); + esym_end = esym + symcount * symesz; + + while (esym < esym_end) + { + struct internal_syment sym; + union internal_auxent aux; + const char *name; + char buf[SYMNMLEN + 1]; + int smtyp; + flagword flags; + asection *section; + bfd_vma value; + struct xcoff_link_hash_entry *set_toc; + + bfd_coff_swap_sym_in (abfd, (void *) esym, (void *) &sym); + + /* In this pass we are only interested in symbols with csect + information. */ + if (sym.n_sclass != C_EXT && sym.n_sclass != C_HIDEXT) + { + /* Set csect_cache, + Normally csect is a .pr, .rw etc. created in the loop + If C_FILE or first time, handle special + + Advance esym, sym_hash, csect_hash ptr's + Keep track of the last_symndx for the current file. */ + if (sym.n_sclass == C_FILE && csect != NULL) + { + xcoff_section_data (abfd, csect)->last_symndx = + ((esym + - (bfd_byte *) obj_coff_external_syms (abfd)) + / symesz); + csect = NULL; + } + + if (csect != NULL) + *csect_cache = csect; + else if (first_csect == NULL || sym.n_sclass == C_FILE) + *csect_cache = coff_section_from_bfd_index (abfd, sym.n_scnum); + else + *csect_cache = NULL; + esym += (sym.n_numaux + 1) * symesz; + sym_hash += sym.n_numaux + 1; + csect_cache += sym.n_numaux + 1; + + continue; + } + + name = _bfd_coff_internal_syment_name (abfd, &sym, buf); + + if (name == NULL) + goto error_return; + + /* If this symbol has line number information attached to it, + and we're not stripping it, count the number of entries and + add them to the count for this csect. In the final link pass + we are going to attach line number information by symbol, + rather than by section, in order to more easily handle + garbage collection. */ + if ((info->strip == strip_none || info->strip == strip_some) + && sym.n_numaux > 1 + && csect != NULL + && ISFCN (sym.n_type)) + { + union internal_auxent auxlin; + + bfd_coff_swap_aux_in (abfd, (void *) (esym + symesz), + sym.n_type, sym.n_sclass, + 0, sym.n_numaux, (void *) &auxlin); + + if (auxlin.x_sym.x_fcnary.x_fcn.x_lnnoptr != 0) + { + asection *enclosing; + bfd_signed_vma linoff; + + enclosing = xcoff_section_data (abfd, csect)->enclosing; + if (enclosing == NULL) + { + (*_bfd_error_handler) + (_("%B: `%s' has line numbers but no enclosing section"), + abfd, name); + bfd_set_error (bfd_error_bad_value); + goto error_return; + } + linoff = (auxlin.x_sym.x_fcnary.x_fcn.x_lnnoptr + - enclosing->line_filepos); + /* Explicit cast to bfd_signed_vma for compiler. */ + if (linoff < (bfd_signed_vma) (enclosing->lineno_count * linesz)) + { + struct internal_lineno lin; + bfd_byte *linpstart; + + linpstart = (reloc_info[enclosing->target_index].linenos + + linoff); + bfd_coff_swap_lineno_in (abfd, (void *) linpstart, (void *) &lin); + if (lin.l_lnno == 0 + && ((bfd_size_type) lin.l_addr.l_symndx + == ((esym + - (bfd_byte *) obj_coff_external_syms (abfd)) + / symesz))) + { + bfd_byte *linpend, *linp; + + linpend = (reloc_info[enclosing->target_index].linenos + + enclosing->lineno_count * linesz); + for (linp = linpstart + linesz; + linp < linpend; + linp += linesz) + { + bfd_coff_swap_lineno_in (abfd, (void *) linp, + (void *) &lin); + if (lin.l_lnno == 0) + break; + } + csect->lineno_count += (linp - linpstart) / linesz; + /* The setting of line_filepos will only be + useful if all the line number entries for a + csect are contiguous; this only matters for + error reporting. */ + if (csect->line_filepos == 0) + csect->line_filepos = + auxlin.x_sym.x_fcnary.x_fcn.x_lnnoptr; + } + } + } + } + + /* Pick up the csect auxiliary information. */ + if (sym.n_numaux == 0) + { + (*_bfd_error_handler) + (_("%B: class %d symbol `%s' has no aux entries"), + abfd, sym.n_sclass, name); + bfd_set_error (bfd_error_bad_value); + goto error_return; + } + + bfd_coff_swap_aux_in (abfd, + (void *) (esym + symesz * sym.n_numaux), + sym.n_type, sym.n_sclass, + sym.n_numaux - 1, sym.n_numaux, + (void *) &aux); + + smtyp = SMTYP_SMTYP (aux.x_csect.x_smtyp); + + flags = BSF_GLOBAL; + section = NULL; + value = 0; + set_toc = NULL; + + switch (smtyp) + { + default: + (*_bfd_error_handler) + (_("%B: symbol `%s' has unrecognized csect type %d"), + abfd, name, smtyp); + bfd_set_error (bfd_error_bad_value); + goto error_return; + + case XTY_ER: + /* This is an external reference. */ + if (sym.n_sclass == C_HIDEXT + || sym.n_scnum != N_UNDEF + || aux.x_csect.x_scnlen.l != 0) + { + (*_bfd_error_handler) + (_("%B: bad XTY_ER symbol `%s': class %d scnum %d scnlen %d"), + abfd, name, sym.n_sclass, sym.n_scnum, + aux.x_csect.x_scnlen.l); + bfd_set_error (bfd_error_bad_value); + goto error_return; + } + + /* An XMC_XO external reference is actually a reference to + an absolute location. */ + if (aux.x_csect.x_smclas != XMC_XO) + section = bfd_und_section_ptr; + else + { + section = bfd_abs_section_ptr; + value = sym.n_value; + } + break; + + case XTY_SD: + /* This is a csect definition. */ + if (csect != NULL) + { + xcoff_section_data (abfd, csect)->last_symndx = + ((esym - (bfd_byte *) obj_coff_external_syms (abfd)) / symesz); + } + + csect = NULL; + csect_index = -(unsigned) 1; + + /* When we see a TOC anchor, we record the TOC value. */ + if (aux.x_csect.x_smclas == XMC_TC0) + { + if (sym.n_sclass != C_HIDEXT + || aux.x_csect.x_scnlen.l != 0) + { + (*_bfd_error_handler) + (_("%B: XMC_TC0 symbol `%s' is class %d scnlen %d"), + abfd, name, sym.n_sclass, aux.x_csect.x_scnlen.l); + bfd_set_error (bfd_error_bad_value); + goto error_return; + } + xcoff_data (abfd)->toc = sym.n_value; + } + + /* We must merge TOC entries for the same symbol. We can + merge two TOC entries if they are both C_HIDEXT, they + both have the same name, they are both 4 or 8 bytes long, and + they both have a relocation table entry for an external + symbol with the same name. Unfortunately, this means + that we must look through the relocations. Ick. + + Logic for 32 bit vs 64 bit. + 32 bit has a csect length of 4 for TOC + 64 bit has a csect length of 8 for TOC + + The conditions to get past the if-check are not that bad. + They are what is used to create the TOC csects in the first + place. */ + if (aux.x_csect.x_smclas == XMC_TC + && sym.n_sclass == C_HIDEXT + && info->hash->creator == abfd->xvec + && ((bfd_xcoff_is_xcoff32 (abfd) + && aux.x_csect.x_scnlen.l == 4) + || (bfd_xcoff_is_xcoff64 (abfd) + && aux.x_csect.x_scnlen.l == 8))) + { + asection *enclosing; + struct internal_reloc *relocs; + bfd_size_type relindx; + struct internal_reloc *rel; + + enclosing = coff_section_from_bfd_index (abfd, sym.n_scnum); + if (enclosing == NULL) + goto error_return; + + relocs = reloc_info[enclosing->target_index].relocs; + amt = enclosing->reloc_count; + relindx = xcoff_find_reloc (relocs, amt, sym.n_value); + rel = relocs + relindx; + + /* 32 bit R_POS r_size is 31 + 64 bit R_POS r_size is 63 */ + if (relindx < enclosing->reloc_count + && rel->r_vaddr == (bfd_vma) sym.n_value + && rel->r_type == R_POS + && ((bfd_xcoff_is_xcoff32 (abfd) + && rel->r_size == 31) + || (bfd_xcoff_is_xcoff64 (abfd) + && rel->r_size == 63))) + { + bfd_byte *erelsym; + + struct internal_syment relsym; + + erelsym = ((bfd_byte *) obj_coff_external_syms (abfd) + + rel->r_symndx * symesz); + bfd_coff_swap_sym_in (abfd, (void *) erelsym, (void *) &relsym); + if (relsym.n_sclass == C_EXT) + { + const char *relname; + char relbuf[SYMNMLEN + 1]; + bfd_boolean copy; + struct xcoff_link_hash_entry *h; + + /* At this point we know that the TOC entry is + for an externally visible symbol. */ + relname = _bfd_coff_internal_syment_name (abfd, &relsym, + relbuf); + if (relname == NULL) + goto error_return; + + /* We only merge TOC entries if the TC name is + the same as the symbol name. This handles + the normal case, but not common cases like + SYM.P4 which gcc generates to store SYM + 4 + in the TOC. FIXME. */ + if (strcmp (name, relname) == 0) + { + copy = (! info->keep_memory + || relsym._n._n_n._n_zeroes != 0 + || relsym._n._n_n._n_offset == 0); + h = xcoff_link_hash_lookup (xcoff_hash_table (info), + relname, TRUE, copy, + FALSE); + if (h == NULL) + goto error_return; + + /* At this point h->root.type could be + bfd_link_hash_new. That should be OK, + since we know for sure that we will come + across this symbol as we step through the + file. */ + + /* We store h in *sym_hash for the + convenience of the relocate_section + function. */ + *sym_hash = h; + + if (h->toc_section != NULL) + { + asection **rel_csects; + + /* We already have a TOC entry for this + symbol, so we can just ignore this + one. */ + rel_csects = + reloc_info[enclosing->target_index].csects; + rel_csects[relindx] = bfd_und_section_ptr; + break; + } + + /* We are about to create a TOC entry for + this symbol. */ + set_toc = h; + } + } + } + } + + { + asection *enclosing; + + /* We need to create a new section. We get the name from + the csect storage mapping class, so that the linker can + accumulate similar csects together. */ + + csect = bfd_xcoff_create_csect_from_smclas(abfd, &aux, name); + if (NULL == csect) + goto error_return; + + /* The enclosing section is the main section : .data, .text + or .bss that the csect is coming from. */ + enclosing = coff_section_from_bfd_index (abfd, sym.n_scnum); + if (enclosing == NULL) + goto error_return; + + if (! bfd_is_abs_section (enclosing) + && ((bfd_vma) sym.n_value < enclosing->vma + || ((bfd_vma) sym.n_value + aux.x_csect.x_scnlen.l + > enclosing->vma + enclosing->size))) + { + (*_bfd_error_handler) + (_("%B: csect `%s' not in enclosing section"), + abfd, name); + bfd_set_error (bfd_error_bad_value); + goto error_return; + } + csect->vma = sym.n_value; + csect->filepos = (enclosing->filepos + + sym.n_value + - enclosing->vma); + csect->size = aux.x_csect.x_scnlen.l; + csect->flags |= SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS; + csect->alignment_power = SMTYP_ALIGN (aux.x_csect.x_smtyp); + + /* Record the enclosing section in the tdata for this new + section. */ + amt = sizeof (struct coff_section_tdata); + csect->used_by_bfd = bfd_zalloc (abfd, amt); + if (csect->used_by_bfd == NULL) + goto error_return; + amt = sizeof (struct xcoff_section_tdata); + coff_section_data (abfd, csect)->tdata = bfd_zalloc (abfd, amt); + if (coff_section_data (abfd, csect)->tdata == NULL) + goto error_return; + xcoff_section_data (abfd, csect)->enclosing = enclosing; + xcoff_section_data (abfd, csect)->lineno_count = + enclosing->lineno_count; + + if (enclosing->owner == abfd) + { + struct internal_reloc *relocs; + bfd_size_type relindx; + struct internal_reloc *rel; + asection **rel_csect; + + relocs = reloc_info[enclosing->target_index].relocs; + amt = enclosing->reloc_count; + relindx = xcoff_find_reloc (relocs, amt, csect->vma); + + rel = relocs + relindx; + rel_csect = (reloc_info[enclosing->target_index].csects + + relindx); + + csect->rel_filepos = (enclosing->rel_filepos + + relindx * bfd_coff_relsz (abfd)); + while (relindx < enclosing->reloc_count + && *rel_csect == NULL + && rel->r_vaddr < csect->vma + csect->size) + { + + *rel_csect = csect; + csect->flags |= SEC_RELOC; + ++csect->reloc_count; + ++relindx; + ++rel; + ++rel_csect; + } + } + + /* There are a number of other fields and section flags + which we do not bother to set. */ + + csect_index = ((esym + - (bfd_byte *) obj_coff_external_syms (abfd)) + / symesz); + + xcoff_section_data (abfd, csect)->first_symndx = csect_index; + + if (first_csect == NULL) + first_csect = csect; + + /* If this symbol is C_EXT, we treat it as starting at the + beginning of the newly created section. */ + if (sym.n_sclass == C_EXT) + { + section = csect; + value = 0; + } + + /* If this is a TOC section for a symbol, record it. */ + if (set_toc != NULL) + set_toc->toc_section = csect; + } + break; + + case XTY_LD: + /* This is a label definition. The x_scnlen field is the + symbol index of the csect. Usually the XTY_LD symbol will + follow its appropriate XTY_SD symbol. The .set pseudo op can + cause the XTY_LD to not follow the XTY_SD symbol. */ + { + bfd_boolean bad; + + bad = FALSE; + if (aux.x_csect.x_scnlen.l < 0 + || (aux.x_csect.x_scnlen.l + >= esym - (bfd_byte *) obj_coff_external_syms (abfd))) + bad = TRUE; + if (! bad) + { + section = xcoff_data (abfd)->csects[aux.x_csect.x_scnlen.l]; + if (section == NULL + || (section->flags & SEC_HAS_CONTENTS) == 0) + bad = TRUE; + } + if (bad) + { + (*_bfd_error_handler) + (_("%B: misplaced XTY_LD `%s'"), + abfd, name); + bfd_set_error (bfd_error_bad_value); + goto error_return; + } + csect = section; + value = sym.n_value - csect->vma; + } + break; + + case XTY_CM: + /* This is an unitialized csect. We could base the name on + the storage mapping class, but we don't bother except for + an XMC_TD symbol. If this csect is externally visible, + it is a common symbol. We put XMC_TD symbols in sections + named .tocbss, and rely on the linker script to put that + in the TOC area. */ + + if (csect != NULL) + { + xcoff_section_data (abfd, csect)->last_symndx = + ((esym + - (bfd_byte *) obj_coff_external_syms (abfd)) + / symesz); + } + + if (aux.x_csect.x_smclas == XMC_TD) + { + /* The linker script puts the .td section in the data + section after the .tc section. */ + csect = bfd_make_section_anyway (abfd, ".td"); + } + else + csect = bfd_make_section_anyway (abfd, ".bss"); + + if (csect == NULL) + goto error_return; + csect->vma = sym.n_value; + csect->size = aux.x_csect.x_scnlen.l; + csect->flags |= SEC_ALLOC; + csect->alignment_power = SMTYP_ALIGN (aux.x_csect.x_smtyp); + /* There are a number of other fields and section flags + which we do not bother to set. */ + + csect_index = ((esym + - (bfd_byte *) obj_coff_external_syms (abfd)) + / symesz); + + amt = sizeof (struct coff_section_tdata); + csect->used_by_bfd = bfd_zalloc (abfd, amt); + if (csect->used_by_bfd == NULL) + goto error_return; + amt = sizeof (struct xcoff_section_tdata); + coff_section_data (abfd, csect)->tdata = bfd_zalloc (abfd, amt); + if (coff_section_data (abfd, csect)->tdata == NULL) + goto error_return; + xcoff_section_data (abfd, csect)->first_symndx = csect_index; + + if (first_csect == NULL) + first_csect = csect; + + if (sym.n_sclass == C_EXT) + { + csect->flags |= SEC_IS_COMMON; + csect->size = 0; + section = csect; + value = aux.x_csect.x_scnlen.l; + } + + break; + } + + /* Check for magic symbol names. */ + if ((smtyp == XTY_SD || smtyp == XTY_CM) + && aux.x_csect.x_smclas != XMC_TC + && aux.x_csect.x_smclas != XMC_TD) + { + int i = -1; + + if (name[0] == '_') + { + if (strcmp (name, "_text") == 0) + i = XCOFF_SPECIAL_SECTION_TEXT; + else if (strcmp (name, "_etext") == 0) + i = XCOFF_SPECIAL_SECTION_ETEXT; + else if (strcmp (name, "_data") == 0) + i = XCOFF_SPECIAL_SECTION_DATA; + else if (strcmp (name, "_edata") == 0) + i = XCOFF_SPECIAL_SECTION_EDATA; + else if (strcmp (name, "_end") == 0) + i = XCOFF_SPECIAL_SECTION_END; + } + else if (name[0] == 'e' && strcmp (name, "end") == 0) + i = XCOFF_SPECIAL_SECTION_END2; + + if (i != -1) + xcoff_hash_table (info)->special_sections[i] = csect; + } + + /* Now we have enough information to add the symbol to the + linker hash table. */ + + if (sym.n_sclass == C_EXT) + { + bfd_boolean copy; + + BFD_ASSERT (section != NULL); + + /* We must copy the name into memory if we got it from the + syment itself, rather than the string table. */ + copy = default_copy; + if (sym._n._n_n._n_zeroes != 0 + || sym._n._n_n._n_offset == 0) + copy = TRUE; + + /* The AIX linker appears to only detect multiple symbol + definitions when there is a reference to the symbol. If + a symbol is defined multiple times, and the only + references are from the same object file, the AIX linker + appears to permit it. It does not merge the different + definitions, but handles them independently. On the + other hand, if there is a reference, the linker reports + an error. + + This matters because the AIX header + file actually defines an initialized array, so we have to + actually permit that to work. + + Just to make matters even more confusing, the AIX linker + appears to permit multiple symbol definitions whenever + the second definition is in an archive rather than an + object file. This may be a consequence of the manner in + which it handles archives: I think it may load the entire + archive in as separate csects, and then let garbage + collection discard symbols. + + We also have to handle the case of statically linking a + shared object, which will cause symbol redefinitions, + although this is an easier case to detect. */ + + if (info->hash->creator == abfd->xvec) + { + if (! bfd_is_und_section (section)) + *sym_hash = xcoff_link_hash_lookup (xcoff_hash_table (info), + name, TRUE, copy, FALSE); + else + /* Make a copy of the symbol name to prevent problems with + merging symbols. */ + *sym_hash = ((struct xcoff_link_hash_entry *) + bfd_wrapped_link_hash_lookup (abfd, info, name, + TRUE, TRUE, FALSE)); + + if (*sym_hash == NULL) + goto error_return; + if (((*sym_hash)->root.type == bfd_link_hash_defined + || (*sym_hash)->root.type == bfd_link_hash_defweak) + && ! bfd_is_und_section (section) + && ! bfd_is_com_section (section)) + { + /* This is a second definition of a defined symbol. */ + if ((abfd->flags & DYNAMIC) != 0 + && ((*sym_hash)->smclas != XMC_GL + || aux.x_csect.x_smclas == XMC_GL + || ((*sym_hash)->root.u.def.section->owner->flags + & DYNAMIC) == 0)) + { + /* The new symbol is from a shared library, and + either the existing symbol is not global + linkage code or this symbol is global linkage + code. If the existing symbol is global + linkage code and the new symbol is not, then + we want to use the new symbol. */ + section = bfd_und_section_ptr; + value = 0; + } + else if (((*sym_hash)->root.u.def.section->owner->flags + & DYNAMIC) != 0) + { + /* The existing symbol is from a shared library. + Replace it. */ + (*sym_hash)->root.type = bfd_link_hash_undefined; + (*sym_hash)->root.u.undef.abfd = + (*sym_hash)->root.u.def.section->owner; + } + else if (abfd->my_archive != NULL) + { + /* This is a redefinition in an object contained + in an archive. Just ignore it. See the + comment above. */ + section = bfd_und_section_ptr; + value = 0; + } + else if ((*sym_hash)->root.u.undef.next != NULL + || info->hash->undefs_tail == &(*sym_hash)->root) + { + /* This symbol has been referenced. In this + case, we just continue and permit the + multiple definition error. See the comment + above about the behaviour of the AIX linker. */ + } + else if ((*sym_hash)->smclas == aux.x_csect.x_smclas) + { + /* The symbols are both csects of the same + class. There is at least a chance that this + is a semi-legitimate redefinition. */ + section = bfd_und_section_ptr; + value = 0; + (*sym_hash)->flags |= XCOFF_MULTIPLY_DEFINED; + } + } + else if (((*sym_hash)->flags & XCOFF_MULTIPLY_DEFINED) != 0 + && ((*sym_hash)->root.type == bfd_link_hash_defined + || (*sym_hash)->root.type == bfd_link_hash_defweak) + && (bfd_is_und_section (section) + || bfd_is_com_section (section))) + { + /* This is a reference to a multiply defined symbol. + Report the error now. See the comment above + about the behaviour of the AIX linker. We could + also do this with warning symbols, but I'm not + sure the XCOFF linker is wholly prepared to + handle them, and that would only be a warning, + not an error. */ + if (! ((*info->callbacks->multiple_definition) + (info, (*sym_hash)->root.root.string, + NULL, NULL, (bfd_vma) 0, + (*sym_hash)->root.u.def.section->owner, + (*sym_hash)->root.u.def.section, + (*sym_hash)->root.u.def.value))) + goto error_return; + /* Try not to give this error too many times. */ + (*sym_hash)->flags &= ~XCOFF_MULTIPLY_DEFINED; + } + } + + /* _bfd_generic_link_add_one_symbol may call the linker to + generate an error message, and the linker may try to read + the symbol table to give a good error. Right now, the + line numbers are in an inconsistent state, since they are + counted both in the real sections and in the new csects. + We need to leave the count in the real sections so that + the linker can report the line number of the error + correctly, so temporarily clobber the link to the csects + so that the linker will not try to read the line numbers + a second time from the csects. */ + BFD_ASSERT (last_real->next == first_csect); + last_real->next = NULL; + if (! (_bfd_generic_link_add_one_symbol + (info, abfd, name, flags, section, value, + NULL, copy, TRUE, + (struct bfd_link_hash_entry **) sym_hash))) + goto error_return; + last_real->next = first_csect; + + if (smtyp == XTY_CM) + { + if ((*sym_hash)->root.type != bfd_link_hash_common + || (*sym_hash)->root.u.c.p->section != csect) + /* We don't need the common csect we just created. */ + csect->size = 0; + else + (*sym_hash)->root.u.c.p->alignment_power + = csect->alignment_power; + } + + if (info->hash->creator == abfd->xvec) + { + int flag; + + if (smtyp == XTY_ER || smtyp == XTY_CM) + flag = XCOFF_REF_REGULAR; + else + flag = XCOFF_DEF_REGULAR; + (*sym_hash)->flags |= flag; + + if ((*sym_hash)->smclas == XMC_UA + || flag == XCOFF_DEF_REGULAR) + (*sym_hash)->smclas = aux.x_csect.x_smclas; + } + } + + *csect_cache = csect; + + esym += (sym.n_numaux + 1) * symesz; + sym_hash += sym.n_numaux + 1; + csect_cache += sym.n_numaux + 1; + } + + BFD_ASSERT (last_real == NULL || last_real->next == first_csect); + + /* Make sure that we have seen all the relocs. */ + for (o = abfd->sections; o != first_csect; o = o->next) + { + /* Reset the section size and the line number count, since the + data is now attached to the csects. Don't reset the size of + the .debug section, since we need to read it below in + bfd_xcoff_size_dynamic_sections. */ + if (strcmp (bfd_get_section_name (abfd, o), ".debug") != 0) + o->size = 0; + o->lineno_count = 0; + + if ((o->flags & SEC_RELOC) != 0) + { + bfd_size_type i; + struct internal_reloc *rel; + asection **rel_csect; + + rel = reloc_info[o->target_index].relocs; + rel_csect = reloc_info[o->target_index].csects; + + for (i = 0; i < o->reloc_count; i++, rel++, rel_csect++) + { + if (*rel_csect == NULL) + { + (*_bfd_error_handler) + (_("%B: reloc %s:%d not in csect"), + abfd, o->name, i); + bfd_set_error (bfd_error_bad_value); + goto error_return; + } + + /* We identify all symbols which are called, so that we + can create glue code for calls to functions imported + from dynamic objects. */ + if (info->hash->creator == abfd->xvec + && *rel_csect != bfd_und_section_ptr + && (rel->r_type == R_BR + || rel->r_type == R_RBR) + && obj_xcoff_sym_hashes (abfd)[rel->r_symndx] != NULL) + { + struct xcoff_link_hash_entry *h; + + h = obj_xcoff_sym_hashes (abfd)[rel->r_symndx]; + h->flags |= XCOFF_CALLED; + /* If the symbol name starts with a period, it is + the code of a function. If the symbol is + currently undefined, then add an undefined symbol + for the function descriptor. This should do no + harm, because any regular object that defines the + function should also define the function + descriptor. It helps, because it means that we + will identify the function descriptor with a + dynamic object if a dynamic object defines it. */ + if (h->root.root.string[0] == '.' + && h->descriptor == NULL) + { + struct xcoff_link_hash_entry *hds; + struct bfd_link_hash_entry *bh; + + hds = xcoff_link_hash_lookup (xcoff_hash_table (info), + h->root.root.string + 1, + TRUE, FALSE, TRUE); + if (hds == NULL) + goto error_return; + if (hds->root.type == bfd_link_hash_new) + { + bh = &hds->root; + if (! (_bfd_generic_link_add_one_symbol + (info, abfd, hds->root.root.string, + (flagword) 0, bfd_und_section_ptr, + (bfd_vma) 0, NULL, FALSE, + TRUE, &bh))) + goto error_return; + hds = (struct xcoff_link_hash_entry *) bh; + } + hds->flags |= XCOFF_DESCRIPTOR; + BFD_ASSERT ((hds->flags & XCOFF_CALLED) == 0 + && (h->flags & XCOFF_DESCRIPTOR) == 0); + hds->descriptor = h; + h->descriptor = hds; + } + } + } + + free (reloc_info[o->target_index].csects); + reloc_info[o->target_index].csects = NULL; + + /* Reset SEC_RELOC and the reloc_count, since the reloc + information is now attached to the csects. */ + o->flags &=~ SEC_RELOC; + o->reloc_count = 0; + + /* If we are not keeping memory, free the reloc information. */ + if (! info->keep_memory + && coff_section_data (abfd, o) != NULL + && coff_section_data (abfd, o)->relocs != NULL + && ! coff_section_data (abfd, o)->keep_relocs) + { + free (coff_section_data (abfd, o)->relocs); + coff_section_data (abfd, o)->relocs = NULL; + } + } + + /* Free up the line numbers. FIXME: We could cache these + somewhere for the final link, to avoid reading them again. */ + if (reloc_info[o->target_index].linenos != NULL) + { + free (reloc_info[o->target_index].linenos); + reloc_info[o->target_index].linenos = NULL; + } + } + + free (reloc_info); + + obj_coff_keep_syms (abfd) = keep_syms; + + return TRUE; + + error_return: + if (reloc_info != NULL) + { + for (o = abfd->sections; o != NULL; o = o->next) + { + if (reloc_info[o->target_index].csects != NULL) + free (reloc_info[o->target_index].csects); + if (reloc_info[o->target_index].linenos != NULL) + free (reloc_info[o->target_index].linenos); + } + free (reloc_info); + } + obj_coff_keep_syms (abfd) = keep_syms; + return FALSE; +} + +#undef N_TMASK +#undef N_BTSHFT + +/* Add symbols from an XCOFF object file. */ + +static bfd_boolean +xcoff_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) +{ + if (! _bfd_coff_get_external_symbols (abfd)) + return FALSE; + if (! xcoff_link_add_symbols (abfd, info)) + return FALSE; + if (! info->keep_memory) + { + if (! _bfd_coff_free_symbols (abfd)) + return FALSE; + } + return TRUE; +} + +/* Look through the loader symbols to see if this dynamic object + should be included in the link. The native linker uses the loader + symbols, not the normal symbol table, so we do too. */ + +static bfd_boolean +xcoff_link_check_dynamic_ar_symbols (bfd *abfd, + struct bfd_link_info *info, + bfd_boolean *pneeded) +{ + asection *lsec; + bfd_byte *contents; + struct internal_ldhdr ldhdr; + const char *strings; + bfd_byte *elsym, *elsymend; + + *pneeded = FALSE; + + lsec = bfd_get_section_by_name (abfd, ".loader"); + if (lsec == NULL) + /* There are no symbols, so don't try to include it. */ + return TRUE; + + if (! xcoff_get_section_contents (abfd, lsec)) + return FALSE; + contents = coff_section_data (abfd, lsec)->contents; + + bfd_xcoff_swap_ldhdr_in (abfd, contents, &ldhdr); + + strings = (char *) contents + ldhdr.l_stoff; + + elsym = contents + bfd_xcoff_loader_symbol_offset (abfd, &ldhdr); + + elsymend = elsym + ldhdr.l_nsyms * bfd_xcoff_ldsymsz (abfd); + for (; elsym < elsymend; elsym += bfd_xcoff_ldsymsz (abfd)) + { + struct internal_ldsym ldsym; + char nambuf[SYMNMLEN + 1]; + const char *name; + struct bfd_link_hash_entry *h; + + bfd_xcoff_swap_ldsym_in (abfd, elsym, &ldsym); + + /* We are only interested in exported symbols. */ + if ((ldsym.l_smtype & L_EXPORT) == 0) + continue; + + if (ldsym._l._l_l._l_zeroes == 0) + name = strings + ldsym._l._l_l._l_offset; + else + { + memcpy (nambuf, ldsym._l._l_name, SYMNMLEN); + nambuf[SYMNMLEN] = '\0'; + name = nambuf; + } + + h = bfd_link_hash_lookup (info->hash, name, FALSE, FALSE, TRUE); + + /* We are only interested in symbols that are currently + undefined. At this point we know that we are using an XCOFF + hash table. */ + if (h != NULL + && h->type == bfd_link_hash_undefined + && (((struct xcoff_link_hash_entry *) h)->flags + & XCOFF_DEF_DYNAMIC) == 0) + { + if (! (*info->callbacks->add_archive_element) (info, abfd, name)) + return FALSE; + *pneeded = TRUE; + return TRUE; + } + } + + /* We do not need this shared object. */ + if (contents != NULL && ! coff_section_data (abfd, lsec)->keep_contents) + { + free (coff_section_data (abfd, lsec)->contents); + coff_section_data (abfd, lsec)->contents = NULL; + } + + return TRUE; +} + +/* Look through the symbols to see if this object file should be + included in the link. */ + +static bfd_boolean +xcoff_link_check_ar_symbols (bfd *abfd, + struct bfd_link_info *info, + bfd_boolean *pneeded) +{ + bfd_size_type symesz; + bfd_byte *esym; + bfd_byte *esym_end; + + *pneeded = FALSE; + + if ((abfd->flags & DYNAMIC) != 0 + && ! info->static_link + && info->hash->creator == abfd->xvec) + return xcoff_link_check_dynamic_ar_symbols (abfd, info, pneeded); + + symesz = bfd_coff_symesz (abfd); + esym = (bfd_byte *) obj_coff_external_syms (abfd); + esym_end = esym + obj_raw_syment_count (abfd) * symesz; + while (esym < esym_end) + { + struct internal_syment sym; + + bfd_coff_swap_sym_in (abfd, (void *) esym, (void *) &sym); + + if (sym.n_sclass == C_EXT && sym.n_scnum != N_UNDEF) + { + const char *name; + char buf[SYMNMLEN + 1]; + struct bfd_link_hash_entry *h; + + /* This symbol is externally visible, and is defined by this + object file. */ + name = _bfd_coff_internal_syment_name (abfd, &sym, buf); + + if (name == NULL) + return FALSE; + h = bfd_link_hash_lookup (info->hash, name, FALSE, FALSE, TRUE); + + /* We are only interested in symbols that are currently + undefined. If a symbol is currently known to be common, + XCOFF linkers do not bring in an object file which + defines it. We also don't bring in symbols to satisfy + undefined references in shared objects. */ + if (h != NULL + && h->type == bfd_link_hash_undefined + && (info->hash->creator != abfd->xvec + || (((struct xcoff_link_hash_entry *) h)->flags + & XCOFF_DEF_DYNAMIC) == 0)) + { + if (! (*info->callbacks->add_archive_element) (info, abfd, name)) + return FALSE; + *pneeded = TRUE; + return TRUE; + } + } + + esym += (sym.n_numaux + 1) * symesz; + } + + /* We do not need this object file. */ + return TRUE; +} + +/* Check a single archive element to see if we need to include it in + the link. *PNEEDED is set according to whether this element is + needed in the link or not. This is called via + _bfd_generic_link_add_archive_symbols. */ + +static bfd_boolean +xcoff_link_check_archive_element (bfd *abfd, + struct bfd_link_info *info, + bfd_boolean *pneeded) +{ + if (! _bfd_coff_get_external_symbols (abfd)) + return FALSE; + + if (! xcoff_link_check_ar_symbols (abfd, info, pneeded)) + return FALSE; + + if (*pneeded) + { + if (! xcoff_link_add_symbols (abfd, info)) + return FALSE; + } + + if (! info->keep_memory || ! *pneeded) + { + if (! _bfd_coff_free_symbols (abfd)) + return FALSE; + } + + return TRUE; +} + +/* Given an XCOFF BFD, add symbols to the global hash table as + appropriate. */ + +bfd_boolean +_bfd_xcoff_bfd_link_add_symbols (bfd *abfd, struct bfd_link_info *info) +{ + switch (bfd_get_format (abfd)) + { + case bfd_object: + return xcoff_link_add_object_symbols (abfd, info); + + case bfd_archive: + /* If the archive has a map, do the usual search. We then need + to check the archive for dynamic objects, because they may not + appear in the archive map even though they should, perhaps, be + included. If the archive has no map, we just consider each object + file in turn, since that apparently is what the AIX native linker + does. */ + if (bfd_has_map (abfd)) + { + if (! (_bfd_generic_link_add_archive_symbols + (abfd, info, xcoff_link_check_archive_element))) + return FALSE; + } + + { + bfd *member; + + member = bfd_openr_next_archived_file (abfd, NULL); + while (member != NULL) + { + if (bfd_check_format (member, bfd_object) + && (info->hash->creator == member->xvec) + && (! bfd_has_map (abfd) || (member->flags & DYNAMIC) != 0)) + { + bfd_boolean needed; + + if (! xcoff_link_check_archive_element (member, info, + &needed)) + return FALSE; + if (needed) + member->archive_pass = -1; + } + member = bfd_openr_next_archived_file (abfd, member); + } + } + + return TRUE; + + default: + bfd_set_error (bfd_error_wrong_format); + return FALSE; + } +} + /* Mark a symbol as not being garbage, including the section in which it is defined. */ -static INLINE bfd_boolean -xcoff_mark_symbol (info, h) - struct bfd_link_info *info; - struct xcoff_link_hash_entry *h; +static inline bfd_boolean +xcoff_mark_symbol (struct bfd_link_info *info, struct xcoff_link_hash_entry *h) { - if ((h->flags & XCOFF_MARK) != 0) return TRUE; @@ -2356,9 +2242,7 @@ xcoff_mark_symbol (info, h) section. */ static bfd_boolean -xcoff_mark (info, sec) - struct bfd_link_info *info; - asection *sec; +xcoff_mark (struct bfd_link_info *info, asection *sec) { if (bfd_is_abs_section (sec) || (sec->flags & SEC_MARK) != 0) @@ -2370,18 +2254,17 @@ xcoff_mark (info, sec) && coff_section_data (sec->owner, sec) != NULL && xcoff_section_data (sec->owner, sec) != NULL) { - register struct xcoff_link_hash_entry **hp, **hpend; + struct xcoff_link_hash_entry **hp, **hpend; struct internal_reloc *rel, *relend; /* Mark all the symbols in this section. */ - hp = (obj_xcoff_sym_hashes (sec->owner) + xcoff_section_data (sec->owner, sec)->first_symndx); hpend = (obj_xcoff_sym_hashes (sec->owner) + xcoff_section_data (sec->owner, sec)->last_symndx); for (; hp < hpend; hp++) { - register struct xcoff_link_hash_entry *h; + struct xcoff_link_hash_entry *h; h = *hp; if (h != NULL @@ -2393,13 +2276,11 @@ xcoff_mark (info, sec) } /* Look through the section relocs. */ - if ((sec->flags & SEC_RELOC) != 0 && sec->reloc_count > 0) { rel = xcoff_read_internal_relocs (sec->owner, sec, TRUE, - (bfd_byte *) NULL, FALSE, - (struct internal_reloc *) NULL); + NULL, FALSE, NULL); if (rel == NULL) return FALSE; relend = rel + sec->reloc_count; @@ -2481,12 +2362,14 @@ xcoff_mark (info, sec) return TRUE; } +/* Routines that are called after all the input files have been + handled, but before the sections are laid out in memory. */ + /* The sweep phase of garbage collection. Remove all garbage sections. */ static void -xcoff_sweep (info) - struct bfd_link_info *info; +xcoff_sweep (struct bfd_link_info *info) { bfd *sub; @@ -2511,7 +2394,7 @@ xcoff_sweep (info) o->flags |= SEC_MARK; else { - o->_raw_size = 0; + o->size = 0; o->reloc_count = 0; o->lineno_count = 0; } @@ -2524,11 +2407,10 @@ xcoff_sweep (info) correct csect length. */ bfd_boolean -bfd_xcoff_link_record_set (output_bfd, info, harg, size) - bfd *output_bfd; - struct bfd_link_info *info; - struct bfd_link_hash_entry *harg; - bfd_size_type size; +bfd_xcoff_link_record_set (bfd *output_bfd, + struct bfd_link_info *info, + struct bfd_link_hash_entry *harg, + bfd_size_type size) { struct xcoff_link_hash_entry *h = (struct xcoff_link_hash_entry *) harg; struct xcoff_link_size_list *n; @@ -2540,9 +2422,8 @@ bfd_xcoff_link_record_set (output_bfd, info, harg, size) /* This will hardly ever be called. I don't want to burn four bytes per global symbol, so instead the size is kept on a linked list attached to the hash table. */ - - amt = sizeof (struct xcoff_link_size_list); - n = (struct xcoff_link_size_list *) bfd_alloc (output_bfd, amt); + amt = sizeof (* n); + n = bfd_alloc (output_bfd, amt); if (n == NULL) return FALSE; n->next = xcoff_hash_table (info)->size_list; @@ -2558,16 +2439,14 @@ bfd_xcoff_link_record_set (output_bfd, info, harg, size) /* Import a symbol. */ bfd_boolean -bfd_xcoff_import_symbol (output_bfd, info, harg, val, imppath, impfile, - impmember, syscall_flag) - bfd *output_bfd; - struct bfd_link_info *info; - struct bfd_link_hash_entry *harg; - bfd_vma val; - const char *imppath; - const char *impfile; - const char *impmember; - unsigned int syscall_flag; +bfd_xcoff_import_symbol (bfd *output_bfd, + struct bfd_link_info *info, + struct bfd_link_hash_entry *harg, + bfd_vma val, + const char *imppath, + const char *impfile, + const char *impmember, + unsigned int syscall_flag) { struct xcoff_link_hash_entry *h = (struct xcoff_link_hash_entry *) harg; @@ -2656,9 +2535,9 @@ bfd_xcoff_import_symbol (output_bfd, info, harg, val, imppath, impfile, if (*pp == NULL) { struct xcoff_import_file *n; - bfd_size_type amt = sizeof (struct xcoff_import_file); + bfd_size_type amt = sizeof (* n); - n = (struct xcoff_import_file *) bfd_alloc (output_bfd, amt); + n = bfd_alloc (output_bfd, amt); if (n == NULL) return FALSE; n->next = NULL; @@ -2677,10 +2556,9 @@ bfd_xcoff_import_symbol (output_bfd, info, harg, val, imppath, impfile, /* Export a symbol. */ bfd_boolean -bfd_xcoff_export_symbol (output_bfd, info, harg) - bfd *output_bfd; - struct bfd_link_info *info; - struct bfd_link_hash_entry *harg; +bfd_xcoff_export_symbol (bfd *output_bfd, + struct bfd_link_info *info, + struct bfd_link_hash_entry *harg) { struct xcoff_link_hash_entry *h = (struct xcoff_link_hash_entry *) harg; @@ -2701,7 +2579,7 @@ bfd_xcoff_export_symbol (output_bfd, info, harg) struct xcoff_link_hash_entry *hfn; bfd_size_type amt = strlen (h->root.root.string) + 2; - fnname = (char *) bfd_malloc (amt); + fnname = bfd_malloc (amt); if (fnname == NULL) return FALSE; fnname[0] = '.'; @@ -2743,10 +2621,9 @@ bfd_xcoff_export_symbol (output_bfd, info, harg) and destructors. */ bfd_boolean -bfd_xcoff_link_count_reloc (output_bfd, info, name) - bfd *output_bfd; - struct bfd_link_info *info; - const char *name; +bfd_xcoff_link_count_reloc (bfd *output_bfd, + struct bfd_link_info *info, + const char *name) { struct xcoff_link_hash_entry *h; @@ -2777,10 +2654,9 @@ bfd_xcoff_link_count_reloc (output_bfd, info, name) assigns a value. */ bfd_boolean -bfd_xcoff_record_link_assignment (output_bfd, info, name) - bfd *output_bfd; - struct bfd_link_info *info; - const char *name; +bfd_xcoff_record_link_assignment (bfd *output_bfd, + struct bfd_link_info *info, + const char *name) { struct xcoff_link_hash_entry *h; @@ -2797,6 +2673,274 @@ bfd_xcoff_record_link_assignment (output_bfd, info, name) return TRUE; } +/* Add a symbol to the .loader symbols, if necessary. */ + +static bfd_boolean +xcoff_build_ldsyms (struct xcoff_link_hash_entry *h, void * p) +{ + struct xcoff_loader_info *ldinfo = (struct xcoff_loader_info *) p; + bfd_size_type amt; + + if (h->root.type == bfd_link_hash_warning) + h = (struct xcoff_link_hash_entry *) h->root.u.i.link; + + /* __rtinit, this symbol has special handling. */ + if (h->flags & XCOFF_RTINIT) + return TRUE; + + /* If this is a final link, and the symbol was defined as a common + symbol in a regular object file, and there was no definition in + any dynamic object, then the linker will have allocated space for + the symbol in a common section but the XCOFF_DEF_REGULAR flag + will not have been set. */ + if (h->root.type == bfd_link_hash_defined + && (h->flags & XCOFF_DEF_REGULAR) == 0 + && (h->flags & XCOFF_REF_REGULAR) != 0 + && (h->flags & XCOFF_DEF_DYNAMIC) == 0 + && (bfd_is_abs_section (h->root.u.def.section) + || (h->root.u.def.section->owner->flags & DYNAMIC) == 0)) + h->flags |= XCOFF_DEF_REGULAR; + + /* If all defined symbols should be exported, mark them now. We + don't want to export the actual functions, just the function + descriptors. */ + if (ldinfo->export_defineds + && (h->flags & XCOFF_DEF_REGULAR) != 0 + && h->root.root.string[0] != '.') + { + bfd_boolean export; + + /* We don't export a symbol which is being defined by an object + included from an archive which contains a shared object. The + rationale is that if an archive contains both an unshared and + a shared object, then there must be some reason that the + unshared object is unshared, and we don't want to start + providing a shared version of it. In particular, this solves + a bug involving the _savefNN set of functions. gcc will call + those functions without providing a slot to restore the TOC, + so it is essential that these functions be linked in directly + and not from a shared object, which means that a shared + object which also happens to link them in must not export + them. This is confusing, but I haven't been able to think of + a different approach. Note that the symbols can, of course, + be exported explicitly. */ + export = TRUE; + if ((h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + && h->root.u.def.section->owner != NULL + && h->root.u.def.section->owner->my_archive != NULL) + { + bfd *arbfd, *member; + + arbfd = h->root.u.def.section->owner->my_archive; + member = bfd_openr_next_archived_file (arbfd, NULL); + while (member != NULL) + { + if ((member->flags & DYNAMIC) != 0) + { + export = FALSE; + break; + } + member = bfd_openr_next_archived_file (arbfd, member); + } + } + + if (export) + h->flags |= XCOFF_EXPORT; + } + + /* We don't want to garbage collect symbols which are not defined in + XCOFF files. This is a convenient place to mark them. */ + if (xcoff_hash_table (ldinfo->info)->gc + && (h->flags & XCOFF_MARK) == 0 + && (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + && (h->root.u.def.section->owner == NULL + || (h->root.u.def.section->owner->xvec + != ldinfo->info->hash->creator))) + h->flags |= XCOFF_MARK; + + /* If this symbol is called and defined in a dynamic object, or it + is imported, then we need to set up global linkage code for it. + (Unless we did garbage collection and we didn't need this + symbol.) */ + if ((h->flags & XCOFF_CALLED) != 0 + && (h->root.type == bfd_link_hash_undefined + || h->root.type == bfd_link_hash_undefweak) + && h->root.root.string[0] == '.' + && h->descriptor != NULL + && ((h->descriptor->flags & XCOFF_DEF_DYNAMIC) != 0 + || ((h->descriptor->flags & XCOFF_IMPORT) != 0 + && (h->descriptor->flags & XCOFF_DEF_REGULAR) == 0)) + && (! xcoff_hash_table (ldinfo->info)->gc + || (h->flags & XCOFF_MARK) != 0)) + { + asection *sec; + struct xcoff_link_hash_entry *hds; + + sec = xcoff_hash_table (ldinfo->info)->linkage_section; + h->root.type = bfd_link_hash_defined; + h->root.u.def.section = sec; + h->root.u.def.value = sec->size; + h->smclas = XMC_GL; + h->flags |= XCOFF_DEF_REGULAR; + sec->size += bfd_xcoff_glink_code_size(ldinfo->output_bfd); + + /* The global linkage code requires a TOC entry for the + descriptor. */ + hds = h->descriptor; + BFD_ASSERT ((hds->root.type == bfd_link_hash_undefined + || hds->root.type == bfd_link_hash_undefweak) + && (hds->flags & XCOFF_DEF_REGULAR) == 0); + hds->flags |= XCOFF_MARK; + if (hds->toc_section == NULL) + { + int byte_size; + + /* 32 vs 64 + xcoff32 uses 4 bytes in the toc. + xcoff64 uses 8 bytes in the toc. */ + if (bfd_xcoff_is_xcoff64 (ldinfo->output_bfd)) + byte_size = 8; + else if (bfd_xcoff_is_xcoff32 (ldinfo->output_bfd)) + byte_size = 4; + else + return FALSE; + + hds->toc_section = xcoff_hash_table (ldinfo->info)->toc_section; + hds->u.toc_offset = hds->toc_section->size; + hds->toc_section->size += byte_size; + ++xcoff_hash_table (ldinfo->info)->ldrel_count; + ++hds->toc_section->reloc_count; + hds->indx = -2; + hds->flags |= XCOFF_SET_TOC | XCOFF_LDREL; + + /* We need to call xcoff_build_ldsyms recursively here, + because we may already have passed hds on the traversal. */ + xcoff_build_ldsyms (hds, p); + } + } + + /* If this symbol is exported, but not defined, we need to try to + define it. */ + if ((h->flags & XCOFF_EXPORT) != 0 + && (h->flags & XCOFF_IMPORT) == 0 + && (h->flags & XCOFF_DEF_REGULAR) == 0 + && (h->flags & XCOFF_DEF_DYNAMIC) == 0 + && (h->root.type == bfd_link_hash_undefined + || h->root.type == bfd_link_hash_undefweak)) + { + if ((h->flags & XCOFF_DESCRIPTOR) != 0 + && (h->descriptor->root.type == bfd_link_hash_defined + || h->descriptor->root.type == bfd_link_hash_defweak)) + { + asection *sec; + + /* This is an undefined function descriptor associated with + a defined entry point. We can build up a function + descriptor ourselves. Believe it or not, the AIX linker + actually does this, and there are cases where we need to + do it as well. */ + sec = xcoff_hash_table (ldinfo->info)->descriptor_section; + h->root.type = bfd_link_hash_defined; + h->root.u.def.section = sec; + h->root.u.def.value = sec->size; + h->smclas = XMC_DS; + h->flags |= XCOFF_DEF_REGULAR; + + /* The size of the function descriptor depends if this is an + xcoff32 (12) or xcoff64 (24). */ + sec->size += + bfd_xcoff_function_descriptor_size(ldinfo->output_bfd); + + /* A function descriptor uses two relocs: one for the + associated code, and one for the TOC address. */ + xcoff_hash_table (ldinfo->info)->ldrel_count += 2; + sec->reloc_count += 2; + + /* We handle writing out the contents of the descriptor in + xcoff_write_global_symbol. */ + } + else + { + (*_bfd_error_handler) + (_("warning: attempt to export undefined symbol `%s'"), + h->root.root.string); + h->ldsym = NULL; + return TRUE; + } + } + + /* If this is still a common symbol, and it wasn't garbage + collected, we need to actually allocate space for it in the .bss + section. */ + if (h->root.type == bfd_link_hash_common + && (! xcoff_hash_table (ldinfo->info)->gc + || (h->flags & XCOFF_MARK) != 0) + && h->root.u.c.p->section->size == 0) + { + BFD_ASSERT (bfd_is_com_section (h->root.u.c.p->section)); + h->root.u.c.p->section->size = h->root.u.c.size; + } + + /* We need to add a symbol to the .loader section if it is mentioned + in a reloc which we are copying to the .loader section and it was + not defined or common, or if it is the entry point, or if it is + being exported. */ + + if (((h->flags & XCOFF_LDREL) == 0 + || h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak + || h->root.type == bfd_link_hash_common) + && (h->flags & XCOFF_ENTRY) == 0 + && (h->flags & XCOFF_EXPORT) == 0) + { + h->ldsym = NULL; + return TRUE; + } + + /* We don't need to add this symbol if we did garbage collection and + we did not mark this symbol. */ + if (xcoff_hash_table (ldinfo->info)->gc + && (h->flags & XCOFF_MARK) == 0) + { + h->ldsym = NULL; + return TRUE; + } + + /* We may have already processed this symbol due to the recursive + call above. */ + if ((h->flags & XCOFF_BUILT_LDSYM) != 0) + return TRUE; + + /* We need to add this symbol to the .loader symbols. */ + + BFD_ASSERT (h->ldsym == NULL); + amt = sizeof (struct internal_ldsym); + h->ldsym = bfd_zalloc (ldinfo->output_bfd, amt); + if (h->ldsym == NULL) + { + ldinfo->failed = TRUE; + return FALSE; + } + + if ((h->flags & XCOFF_IMPORT) != 0) + h->ldsym->l_ifile = h->ldindx; + + /* The first 3 symbol table indices are reserved to indicate the + data, text and bss sections. */ + h->ldindx = ldinfo->ldsym_count + 3; + + ++ldinfo->ldsym_count; + + if (! bfd_xcoff_put_ldsymbol_name (ldinfo->output_bfd, ldinfo, + h->ldsym, h->root.root.string)) + return FALSE; + + h->flags |= XCOFF_BUILT_LDSYM; + + return TRUE; +} /* Build the .loader section. This is called by the XCOFF linker emulation before_allocation routine. We must set the size of the .loader section before the linker lays out the output file. @@ -2815,23 +2959,19 @@ bfd_xcoff_record_link_assignment (output_bfd, info, name) magic names like _end. */ bfd_boolean -bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry, - file_align, maxstack, maxdata, gc, - modtype, textro, export_defineds, - special_sections, rtld) - bfd *output_bfd; - struct bfd_link_info *info; - const char *libpath; - const char *entry; - unsigned long file_align; - unsigned long maxstack; - unsigned long maxdata; - bfd_boolean gc; - int modtype; - bfd_boolean textro; - bfd_boolean export_defineds; - asection **special_sections; - bfd_boolean rtld; +bfd_xcoff_size_dynamic_sections (bfd *output_bfd, + struct bfd_link_info *info, + const char *libpath, + const char *entry, + unsigned long file_align, + unsigned long maxstack, + unsigned long maxdata, + bfd_boolean gc, + int modtype, + bfd_boolean textro, + bfd_boolean export_defineds, + asection **special_sections, + bfd_boolean rtld) { struct xcoff_link_hash_entry *hentry; asection *lsec; @@ -2841,7 +2981,7 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry, struct xcoff_import_file *fl; struct internal_ldhdr *ldhdr; bfd_size_type stoff; - register char *out; + char *out; asection *sec; bfd *sub; struct bfd_strtab_hash *debug_strtab; @@ -2898,16 +3038,16 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry, xcoff_mark_symbol (info, hsym); hsym->flags |= (XCOFF_DEF_REGULAR | XCOFF_RTINIT); - /* __rtinit initialized */ - amt = sizeof (struct internal_ldsym); - ldsym = (struct internal_ldsym *) bfd_malloc (amt); + /* __rtinit initialized. */ + amt = sizeof (* ldsym); + ldsym = bfd_malloc (amt); - ldsym->l_value = 0; /* will be filled in later */ - ldsym->l_scnum = 2; /* data section */ - ldsym->l_smtype = XTY_SD; /* csect section definition */ - ldsym->l_smclas = 5; /* .rw */ - ldsym->l_ifile = 0; /* special system loader symbol */ - ldsym->l_parm = 0; /* NA */ + ldsym->l_value = 0; /* Will be filled in later. */ + ldsym->l_scnum = 2; /* Data section. */ + ldsym->l_smtype = XTY_SD; /* Csect section definition. */ + ldsym->l_smclas = 5; /* .rw. */ + ldsym->l_ifile = 0; /* Special system loader symbol. */ + ldsym->l_parm = 0; /* NA. */ /* Force __rtinit to be the first symbol in the loader symbol table See xcoff_build_ldsyms @@ -2973,20 +3113,17 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry, if (sec != NULL && gc && (sec->flags & SEC_MARK) == 0) - { - sec = NULL; - } + sec = NULL; + special_sections[i] = sec; } if (info->input_bfds == NULL) - { - /* I'm not sure what to do in this bizarre case. */ - return TRUE; - } + /* I'm not sure what to do in this bizarre case. */ + return TRUE; xcoff_link_hash_traverse (xcoff_hash_table (info), xcoff_build_ldsyms, - (PTR) &ldinfo); + (void *) &ldinfo); if (ldinfo.failed) goto error_return; @@ -3035,8 +3172,8 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry, /* We now know the final size of the .loader section. Allocate space for it. */ lsec = xcoff_hash_table (info)->loader_section; - lsec->_raw_size = stoff + ldhdr->l_stlen; - lsec->contents = (bfd_byte *) bfd_zalloc (output_bfd, lsec->_raw_size); + lsec->size = stoff + ldhdr->l_stlen; + lsec->contents = bfd_zalloc (output_bfd, lsec->size); if (lsec->contents == NULL) goto error_return; @@ -3051,7 +3188,7 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry, *out++ = '\0'; for (fl = xcoff_hash_table (info)->imports; fl != NULL; fl = fl->next) { - register const char *s; + const char *s; s = fl->path; while ((*out++ = *s++) != '\0') @@ -3080,28 +3217,27 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry, symbols are written out in xcoff_link_input_bfd or xcoff_write_global_symbol. The .loader relocs are written out when the corresponding normal relocs are handled in - xcoff_link_input_bfd. - */ + xcoff_link_input_bfd. */ /* Allocate space for the magic sections. */ sec = xcoff_hash_table (info)->linkage_section; - if (sec->_raw_size > 0) + if (sec->size > 0) { - sec->contents = (bfd_byte *) bfd_zalloc (output_bfd, sec->_raw_size); + sec->contents = bfd_zalloc (output_bfd, sec->size); if (sec->contents == NULL) goto error_return; } sec = xcoff_hash_table (info)->toc_section; - if (sec->_raw_size > 0) + if (sec->size > 0) { - sec->contents = (bfd_byte *) bfd_zalloc (output_bfd, sec->_raw_size); + sec->contents = bfd_zalloc (output_bfd, sec->size); if (sec->contents == NULL) goto error_return; } sec = xcoff_hash_table (info)->descriptor_section; - if (sec->_raw_size > 0) + if (sec->size > 0) { - sec->contents = (bfd_byte *) bfd_zalloc (output_bfd, sec->_raw_size); + sec->contents = bfd_zalloc (output_bfd, sec->size); if (sec->contents == NULL) goto error_return; } @@ -3122,14 +3258,14 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry, if (sub->xvec != info->hash->creator) continue; subdeb = bfd_get_section_by_name (sub, ".debug"); - if (subdeb == NULL || subdeb->_raw_size == 0) + if (subdeb == NULL || subdeb->size == 0) continue; if (info->strip == strip_all || info->strip == strip_debugger || info->discard == discard_all) { - subdeb->_raw_size = 0; + subdeb->size = 0; continue; } @@ -3137,8 +3273,7 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry, goto error_return; symcount = obj_raw_syment_count (sub); - debug_index = ((unsigned long *) - bfd_zalloc (sub, symcount * sizeof (unsigned long))); + debug_index = bfd_zalloc (sub, symcount * sizeof (unsigned long)); if (debug_index == NULL) goto error_return; xcoff_data (sub)->debug_indices = debug_index; @@ -3148,11 +3283,7 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry, bfd_alloc, because I expect that, when linking many files together, many of the strings will be the same. Storing the strings in the hash table should save space in this case. */ - debug_contents = (bfd_byte *) bfd_malloc (subdeb->_raw_size); - if (debug_contents == NULL) - goto error_return; - if (! bfd_get_section_contents (sub, subdeb, (PTR) debug_contents, - (file_ptr) 0, subdeb->_raw_size)) + if (! bfd_malloc_and_get_section (sub, subdeb, &debug_contents)) goto error_return; csectpp = xcoff_data (sub)->csects; @@ -3168,7 +3299,7 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry, { struct internal_syment sym; - bfd_coff_swap_sym_in (sub, (PTR) esym, (PTR) &sym); + bfd_coff_swap_sym_in (sub, (void *) esym, (void *) &sym); *debug_index = (unsigned long) -1; @@ -3200,7 +3331,7 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry, /* Clear the size of subdeb, so that it is not included directly in the output file. */ - subdeb->_raw_size = 0; + subdeb->size = 0; if (! info->keep_memory) { @@ -3210,7 +3341,7 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry, } if (info->strip != strip_all) - xcoff_hash_table (info)->debug_section->_raw_size = + xcoff_hash_table (info)->debug_section->size = _bfd_stringtab_size (debug_strtab); return TRUE; @@ -3224,16 +3355,14 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry, } bfd_boolean -bfd_xcoff_link_generate_rtinit (abfd, init, fini, rtld) - bfd *abfd; - const char *init; - const char *fini; - bfd_boolean rtld; +bfd_xcoff_link_generate_rtinit (bfd *abfd, + const char *init, + const char *fini, + bfd_boolean rtld) { struct bfd_in_memory *bim; - bim = ((struct bfd_in_memory *) - bfd_malloc ((bfd_size_type) sizeof (struct bfd_in_memory))); + bim = bfd_malloc ((bfd_size_type) sizeof (* bim)); if (bim == NULL) return FALSE; @@ -3242,7 +3371,7 @@ bfd_xcoff_link_generate_rtinit (abfd, init, fini, rtld) abfd->link_next = 0; abfd->format = bfd_object; - abfd->iostream = (PTR) bim; + abfd->iostream = (void *) bim; abfd->flags = BFD_IN_MEMORY; abfd->direction = write_direction; abfd->where = 0; @@ -3257,934 +3386,13 @@ bfd_xcoff_link_generate_rtinit (abfd, init, fini, rtld) return TRUE; } - - -/* Add a symbol to the .loader symbols, if necessary. */ - -static bfd_boolean -xcoff_build_ldsyms (h, p) - struct xcoff_link_hash_entry *h; - PTR p; -{ - struct xcoff_loader_info *ldinfo = (struct xcoff_loader_info *) p; - bfd_size_type amt; - - if (h->root.type == bfd_link_hash_warning) - h = (struct xcoff_link_hash_entry *) h->root.u.i.link; - - /* __rtinit, this symbol has special handling. */ - if (h->flags & XCOFF_RTINIT) - return TRUE; - - /* If this is a final link, and the symbol was defined as a common - symbol in a regular object file, and there was no definition in - any dynamic object, then the linker will have allocated space for - the symbol in a common section but the XCOFF_DEF_REGULAR flag - will not have been set. */ - if (h->root.type == bfd_link_hash_defined - && (h->flags & XCOFF_DEF_REGULAR) == 0 - && (h->flags & XCOFF_REF_REGULAR) != 0 - && (h->flags & XCOFF_DEF_DYNAMIC) == 0 - && (bfd_is_abs_section (h->root.u.def.section) - || (h->root.u.def.section->owner->flags & DYNAMIC) == 0)) - h->flags |= XCOFF_DEF_REGULAR; - - /* If all defined symbols should be exported, mark them now. We - don't want to export the actual functions, just the function - descriptors. */ - if (ldinfo->export_defineds - && (h->flags & XCOFF_DEF_REGULAR) != 0 - && h->root.root.string[0] != '.') - { - bfd_boolean export; - - /* We don't export a symbol which is being defined by an object - included from an archive which contains a shared object. The - rationale is that if an archive contains both an unshared and - a shared object, then there must be some reason that the - unshared object is unshared, and we don't want to start - providing a shared version of it. In particular, this solves - a bug involving the _savefNN set of functions. gcc will call - those functions without providing a slot to restore the TOC, - so it is essential that these functions be linked in directly - and not from a shared object, which means that a shared - object which also happens to link them in must not export - them. This is confusing, but I haven't been able to think of - a different approach. Note that the symbols can, of course, - be exported explicitly. */ - export = TRUE; - if ((h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - && h->root.u.def.section->owner != NULL - && h->root.u.def.section->owner->my_archive != NULL) - { - bfd *arbfd, *member; - - arbfd = h->root.u.def.section->owner->my_archive; - member = bfd_openr_next_archived_file (arbfd, (bfd *) NULL); - while (member != NULL) - { - if ((member->flags & DYNAMIC) != 0) - { - export = FALSE; - break; - } - member = bfd_openr_next_archived_file (arbfd, member); - } - } - - if (export) - h->flags |= XCOFF_EXPORT; - } - - /* We don't want to garbage collect symbols which are not defined in - XCOFF files. This is a convenient place to mark them. */ - if (xcoff_hash_table (ldinfo->info)->gc - && (h->flags & XCOFF_MARK) == 0 - && (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - && (h->root.u.def.section->owner == NULL - || (h->root.u.def.section->owner->xvec - != ldinfo->info->hash->creator))) - h->flags |= XCOFF_MARK; - - /* If this symbol is called and defined in a dynamic object, or it - is imported, then we need to set up global linkage code for it. - (Unless we did garbage collection and we didn't need this - symbol.) */ - if ((h->flags & XCOFF_CALLED) != 0 - && (h->root.type == bfd_link_hash_undefined - || h->root.type == bfd_link_hash_undefweak) - && h->root.root.string[0] == '.' - && h->descriptor != NULL - && ((h->descriptor->flags & XCOFF_DEF_DYNAMIC) != 0 - || ((h->descriptor->flags & XCOFF_IMPORT) != 0 - && (h->descriptor->flags & XCOFF_DEF_REGULAR) == 0)) - && (! xcoff_hash_table (ldinfo->info)->gc - || (h->flags & XCOFF_MARK) != 0)) - { - asection *sec; - struct xcoff_link_hash_entry *hds; - - sec = xcoff_hash_table (ldinfo->info)->linkage_section; - h->root.type = bfd_link_hash_defined; - h->root.u.def.section = sec; - h->root.u.def.value = sec->_raw_size; - h->smclas = XMC_GL; - h->flags |= XCOFF_DEF_REGULAR; - sec->_raw_size += bfd_xcoff_glink_code_size(ldinfo->output_bfd); - - /* The global linkage code requires a TOC entry for the - descriptor. */ - hds = h->descriptor; - BFD_ASSERT ((hds->root.type == bfd_link_hash_undefined - || hds->root.type == bfd_link_hash_undefweak) - && (hds->flags & XCOFF_DEF_REGULAR) == 0); - hds->flags |= XCOFF_MARK; - if (hds->toc_section == NULL) - { - int byte_size; - - /* 32 vs 64 - xcoff32 uses 4 bytes in the toc. - xcoff64 uses 8 bytes in the toc. */ - if (bfd_xcoff_is_xcoff64 (ldinfo->output_bfd)) - byte_size = 8; - else if (bfd_xcoff_is_xcoff32 (ldinfo->output_bfd)) - byte_size = 4; - else - return FALSE; - - hds->toc_section = xcoff_hash_table (ldinfo->info)->toc_section; - hds->u.toc_offset = hds->toc_section->_raw_size; - hds->toc_section->_raw_size += byte_size; - ++xcoff_hash_table (ldinfo->info)->ldrel_count; - ++hds->toc_section->reloc_count; - hds->indx = -2; - hds->flags |= XCOFF_SET_TOC | XCOFF_LDREL; - - /* We need to call xcoff_build_ldsyms recursively here, - because we may already have passed hds on the traversal. */ - xcoff_build_ldsyms (hds, p); - } - } - - /* If this symbol is exported, but not defined, we need to try to - define it. */ - if ((h->flags & XCOFF_EXPORT) != 0 - && (h->flags & XCOFF_IMPORT) == 0 - && (h->flags & XCOFF_DEF_REGULAR) == 0 - && (h->flags & XCOFF_DEF_DYNAMIC) == 0 - && (h->root.type == bfd_link_hash_undefined - || h->root.type == bfd_link_hash_undefweak)) - { - if ((h->flags & XCOFF_DESCRIPTOR) != 0 - && (h->descriptor->root.type == bfd_link_hash_defined - || h->descriptor->root.type == bfd_link_hash_defweak)) - { - asection *sec; - - /* This is an undefined function descriptor associated with - a defined entry point. We can build up a function - descriptor ourselves. Believe it or not, the AIX linker - actually does this, and there are cases where we need to - do it as well. */ - sec = xcoff_hash_table (ldinfo->info)->descriptor_section; - h->root.type = bfd_link_hash_defined; - h->root.u.def.section = sec; - h->root.u.def.value = sec->_raw_size; - h->smclas = XMC_DS; - h->flags |= XCOFF_DEF_REGULAR; - - /* The size of the function descriptor depends if this is an - xcoff32 (12) or xcoff64 (24). */ - sec->_raw_size += - bfd_xcoff_function_descriptor_size(ldinfo->output_bfd); - - /* A function descriptor uses two relocs: one for the - associated code, and one for the TOC address. */ - xcoff_hash_table (ldinfo->info)->ldrel_count += 2; - sec->reloc_count += 2; - - /* We handle writing out the contents of the descriptor in - xcoff_write_global_symbol. */ - } - else - { - (*_bfd_error_handler) - (_("warning: attempt to export undefined symbol `%s'"), - h->root.root.string); - h->ldsym = NULL; - return TRUE; - } - } - - /* If this is still a common symbol, and it wasn't garbage - collected, we need to actually allocate space for it in the .bss - section. */ - if (h->root.type == bfd_link_hash_common - && (! xcoff_hash_table (ldinfo->info)->gc - || (h->flags & XCOFF_MARK) != 0) - && h->root.u.c.p->section->_raw_size == 0) - { - BFD_ASSERT (bfd_is_com_section (h->root.u.c.p->section)); - h->root.u.c.p->section->_raw_size = h->root.u.c.size; - } - - /* We need to add a symbol to the .loader section if it is mentioned - in a reloc which we are copying to the .loader section and it was - not defined or common, or if it is the entry point, or if it is - being exported. */ - - if (((h->flags & XCOFF_LDREL) == 0 - || h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak - || h->root.type == bfd_link_hash_common) - && (h->flags & XCOFF_ENTRY) == 0 - && (h->flags & XCOFF_EXPORT) == 0) - { - h->ldsym = NULL; - return TRUE; - } - - /* We don't need to add this symbol if we did garbage collection and - we did not mark this symbol. */ - if (xcoff_hash_table (ldinfo->info)->gc - && (h->flags & XCOFF_MARK) == 0) - { - h->ldsym = NULL; - return TRUE; - } - - /* We may have already processed this symbol due to the recursive - call above. */ - if ((h->flags & XCOFF_BUILT_LDSYM) != 0) - return TRUE; - - /* We need to add this symbol to the .loader symbols. */ - - BFD_ASSERT (h->ldsym == NULL); - amt = sizeof (struct internal_ldsym); - h->ldsym = (struct internal_ldsym *) bfd_zalloc (ldinfo->output_bfd, amt); - if (h->ldsym == NULL) - { - ldinfo->failed = TRUE; - return FALSE; - } - - if ((h->flags & XCOFF_IMPORT) != 0) - h->ldsym->l_ifile = h->ldindx; - - /* The first 3 symbol table indices are reserved to indicate the - data, text and bss sections. */ - h->ldindx = ldinfo->ldsym_count + 3; - - ++ldinfo->ldsym_count; - - if (! bfd_xcoff_put_ldsymbol_name (ldinfo->output_bfd, ldinfo, - h->ldsym, h->root.root.string)) - { - return FALSE; - } - - h->flags |= XCOFF_BUILT_LDSYM; - - return TRUE; -} -/* Do the final link step. */ - -bfd_boolean -_bfd_xcoff_bfd_final_link (abfd, info) - bfd *abfd; - struct bfd_link_info *info; -{ - bfd_size_type symesz; - struct xcoff_final_link_info finfo; - asection *o; - struct bfd_link_order *p; - bfd_size_type max_contents_size; - bfd_size_type max_sym_count; - bfd_size_type max_lineno_count; - bfd_size_type max_reloc_count; - bfd_size_type max_output_reloc_count; - file_ptr rel_filepos; - unsigned int relsz; - file_ptr line_filepos; - unsigned int linesz; - bfd *sub; - bfd_byte *external_relocs = NULL; - char strbuf[STRING_SIZE_SIZE]; - file_ptr pos; - bfd_size_type amt; - - if (info->shared) - abfd->flags |= DYNAMIC; - - symesz = bfd_coff_symesz (abfd); - - finfo.info = info; - finfo.output_bfd = abfd; - finfo.strtab = NULL; - finfo.section_info = NULL; - finfo.last_file_index = -1; - finfo.toc_symindx = -1; - finfo.internal_syms = NULL; - finfo.sym_indices = NULL; - finfo.outsyms = NULL; - finfo.linenos = NULL; - finfo.contents = NULL; - finfo.external_relocs = NULL; - - finfo.ldsym = (xcoff_hash_table (info)->loader_section->contents - + bfd_xcoff_ldhdrsz (abfd)); - finfo.ldrel = (xcoff_hash_table (info)->loader_section->contents - + bfd_xcoff_ldhdrsz(abfd) - + (xcoff_hash_table (info)->ldhdr.l_nsyms - * bfd_xcoff_ldsymsz(abfd))); - - xcoff_data (abfd)->coff.link_info = info; - - finfo.strtab = _bfd_stringtab_init (); - if (finfo.strtab == NULL) - goto error_return; - - /* Count the line number and relocation entries required for the - output file. Determine a few maximum sizes. */ - max_contents_size = 0; - max_lineno_count = 0; - max_reloc_count = 0; - for (o = abfd->sections; o != NULL; o = o->next) - { - o->reloc_count = 0; - o->lineno_count = 0; - for (p = o->link_order_head; p != NULL; p = p->next) - { - if (p->type == bfd_indirect_link_order) - { - asection *sec; - - sec = p->u.indirect.section; - - /* Mark all sections which are to be included in the - link. This will normally be every section. We need - to do this so that we can identify any sections which - the linker has decided to not include. */ - sec->linker_mark = TRUE; - - if (info->strip == strip_none - || info->strip == strip_some) - o->lineno_count += sec->lineno_count; - - o->reloc_count += sec->reloc_count; - - if (sec->_raw_size > max_contents_size) - max_contents_size = sec->_raw_size; - if (sec->lineno_count > max_lineno_count) - max_lineno_count = sec->lineno_count; - if (coff_section_data (sec->owner, sec) != NULL - && xcoff_section_data (sec->owner, sec) != NULL - && (xcoff_section_data (sec->owner, sec)->lineno_count - > max_lineno_count)) - max_lineno_count = - xcoff_section_data (sec->owner, sec)->lineno_count; - if (sec->reloc_count > max_reloc_count) - max_reloc_count = sec->reloc_count; - } - else if (p->type == bfd_section_reloc_link_order - || p->type == bfd_symbol_reloc_link_order) - ++o->reloc_count; - } - } - - /* Compute the file positions for all the sections. */ - if (abfd->output_has_begun) - { - if (xcoff_hash_table (info)->file_align != 0) - abort (); - } - else - { - bfd_vma file_align; - - file_align = xcoff_hash_table (info)->file_align; - if (file_align != 0) - { - bfd_boolean saw_contents; - int indx; - asection **op; - file_ptr sofar; - - /* Insert .pad sections before every section which has - contents and is loaded, if it is preceded by some other - section which has contents and is loaded. */ - saw_contents = TRUE; - for (op = &abfd->sections; *op != NULL; op = &(*op)->next) - { - if (strcmp ((*op)->name, ".pad") == 0) - saw_contents = FALSE; - else if (((*op)->flags & SEC_HAS_CONTENTS) != 0 - && ((*op)->flags & SEC_LOAD) != 0) - { - if (! saw_contents) - saw_contents = TRUE; - else - { - asection *n, **st; - - /* Create a pad section and place it before the section - that needs padding. This requires unlinking and - relinking the bfd's section list. */ - - st = abfd->section_tail; - n = bfd_make_section_anyway (abfd, ".pad"); - n->flags = SEC_HAS_CONTENTS; - n->alignment_power = 0; - - BFD_ASSERT (*st == n); - bfd_section_list_remove (abfd, st); - bfd_section_list_insert (abfd, op, n); - - op = &n->next; - saw_contents = FALSE; - } - } - } - - /* Reset the section indices after inserting the new - sections. */ - indx = 0; - for (o = abfd->sections; o != NULL; o = o->next) - { - ++indx; - o->target_index = indx; - } - BFD_ASSERT ((unsigned int) indx == abfd->section_count); - - /* Work out appropriate sizes for the .pad sections to force - each section to land on a page boundary. This bit of - code knows what compute_section_file_positions is going - to do. */ - sofar = bfd_coff_filhsz (abfd); - sofar += bfd_coff_aoutsz (abfd); - sofar += abfd->section_count * bfd_coff_scnhsz (abfd); - for (o = abfd->sections; o != NULL; o = o->next) - if ((bfd_xcoff_is_reloc_count_overflow - (abfd, (bfd_vma) o->reloc_count)) - || (bfd_xcoff_is_lineno_count_overflow - (abfd, (bfd_vma) o->lineno_count))) - /* 64 does not overflow, need to check if 32 does */ - sofar += bfd_coff_scnhsz (abfd); - - for (o = abfd->sections; o != NULL; o = o->next) - { - if (strcmp (o->name, ".pad") == 0) - { - bfd_vma pageoff; - - BFD_ASSERT (o->_raw_size == 0); - pageoff = sofar & (file_align - 1); - if (pageoff != 0) - { - o->_raw_size = file_align - pageoff; - sofar += file_align - pageoff; - o->flags |= SEC_HAS_CONTENTS; - } - } - else - { - if ((o->flags & SEC_HAS_CONTENTS) != 0) - sofar += BFD_ALIGN (o->_raw_size, - 1 << o->alignment_power); - } - } - } - - if (! bfd_coff_compute_section_file_positions (abfd)) - goto error_return; - } - - /* Allocate space for the pointers we need to keep for the relocs. */ - { - unsigned int i; - - /* We use section_count + 1, rather than section_count, because - the target_index fields are 1 based. */ - amt = abfd->section_count + 1; - amt *= sizeof (struct xcoff_link_section_info); - finfo.section_info = (struct xcoff_link_section_info *) bfd_malloc (amt); - if (finfo.section_info == NULL) - goto error_return; - for (i = 0; i <= abfd->section_count; i++) - { - finfo.section_info[i].relocs = NULL; - finfo.section_info[i].rel_hashes = NULL; - finfo.section_info[i].toc_rel_hashes = NULL; - } - } - - /* Set the file positions for the relocs. */ - rel_filepos = obj_relocbase (abfd); - relsz = bfd_coff_relsz (abfd); - max_output_reloc_count = 0; - for (o = abfd->sections; o != NULL; o = o->next) - { - if (o->reloc_count == 0) - o->rel_filepos = 0; - else - { - /* A stripped file has no relocs. However, we still - allocate the buffers, so that later code doesn't have to - worry about whether we are stripping or not. */ - if (info->strip == strip_all) - o->rel_filepos = 0; - else - { - o->flags |= SEC_RELOC; - o->rel_filepos = rel_filepos; - rel_filepos += o->reloc_count * relsz; - } - - /* We don't know the indices of global symbols until we have - written out all the local symbols. For each section in - the output file, we keep an array of pointers to hash - table entries. Each entry in the array corresponds to a - reloc. When we find a reloc against a global symbol, we - set the corresponding entry in this array so that we can - fix up the symbol index after we have written out all the - local symbols. - - Because of this problem, we also keep the relocs in - memory until the end of the link. This wastes memory. - We could backpatch the file later, I suppose, although it - would be slow. */ - amt = o->reloc_count; - amt *= sizeof (struct internal_reloc); - finfo.section_info[o->target_index].relocs = - (struct internal_reloc *) bfd_malloc (amt); - - amt = o->reloc_count; - amt *= sizeof (struct xcoff_link_hash_entry *); - finfo.section_info[o->target_index].rel_hashes = - (struct xcoff_link_hash_entry **) bfd_malloc (amt); - - if (finfo.section_info[o->target_index].relocs == NULL - || finfo.section_info[o->target_index].rel_hashes == NULL) - goto error_return; - - if (o->reloc_count > max_output_reloc_count) - max_output_reloc_count = o->reloc_count; - } - } - - /* We now know the size of the relocs, so we can determine the file - positions of the line numbers. */ - line_filepos = rel_filepos; - finfo.line_filepos = line_filepos; - linesz = bfd_coff_linesz (abfd); - for (o = abfd->sections; o != NULL; o = o->next) - { - if (o->lineno_count == 0) - o->line_filepos = 0; - else - { - o->line_filepos = line_filepos; - line_filepos += o->lineno_count * linesz; - } - - /* Reset the reloc and lineno counts, so that we can use them to - count the number of entries we have output so far. */ - o->reloc_count = 0; - o->lineno_count = 0; - } - - obj_sym_filepos (abfd) = line_filepos; - - /* Figure out the largest number of symbols in an input BFD. Take - the opportunity to clear the output_has_begun fields of all the - input BFD's. We want at least 6 symbols, since that is the - number which xcoff_write_global_symbol may need. */ - max_sym_count = 6; - for (sub = info->input_bfds; sub != NULL; sub = sub->link_next) - { - bfd_size_type sz; - - sub->output_has_begun = FALSE; - sz = obj_raw_syment_count (sub); - if (sz > max_sym_count) - max_sym_count = sz; - } - - /* Allocate some buffers used while linking. */ - amt = max_sym_count * sizeof (struct internal_syment); - finfo.internal_syms = (struct internal_syment *) bfd_malloc (amt); - - amt = max_sym_count * sizeof (long); - finfo.sym_indices = (long *) bfd_malloc (amt); - - amt = (max_sym_count + 1) * symesz; - finfo.outsyms = (bfd_byte *) bfd_malloc (amt); - - amt = max_lineno_count * bfd_coff_linesz (abfd); - finfo.linenos = (bfd_byte *) bfd_malloc (amt); - - amt = max_contents_size; - finfo.contents = (bfd_byte *) bfd_malloc (amt); - - amt = max_reloc_count * relsz; - finfo.external_relocs = (bfd_byte *) bfd_malloc (amt); - - if ((finfo.internal_syms == NULL && max_sym_count > 0) - || (finfo.sym_indices == NULL && max_sym_count > 0) - || finfo.outsyms == NULL - || (finfo.linenos == NULL && max_lineno_count > 0) - || (finfo.contents == NULL && max_contents_size > 0) - || (finfo.external_relocs == NULL && max_reloc_count > 0)) - goto error_return; - - obj_raw_syment_count (abfd) = 0; - xcoff_data (abfd)->toc = (bfd_vma) -1; - - /* We now know the position of everything in the file, except that - we don't know the size of the symbol table and therefore we don't - know where the string table starts. We just build the string - table in memory as we go along. We process all the relocations - for a single input file at once. */ - for (o = abfd->sections; o != NULL; o = o->next) - { - for (p = o->link_order_head; p != NULL; p = p->next) - { - if (p->type == bfd_indirect_link_order - && p->u.indirect.section->owner->xvec == abfd->xvec) - { - sub = p->u.indirect.section->owner; - if (! sub->output_has_begun) - { - if (! xcoff_link_input_bfd (&finfo, sub)) - goto error_return; - sub->output_has_begun = TRUE; - } - } - else if (p->type == bfd_section_reloc_link_order - || p->type == bfd_symbol_reloc_link_order) - { - if (! xcoff_reloc_link_order (abfd, &finfo, o, p)) - goto error_return; - } - else - { - if (! _bfd_default_link_order (abfd, info, o, p)) - goto error_return; - } - } - } - - - /* Free up the buffers used by xcoff_link_input_bfd. */ - - if (finfo.internal_syms != NULL) - { - free (finfo.internal_syms); - finfo.internal_syms = NULL; - } - if (finfo.sym_indices != NULL) - { - free (finfo.sym_indices); - finfo.sym_indices = NULL; - } - if (finfo.linenos != NULL) - { - free (finfo.linenos); - finfo.linenos = NULL; - } - if (finfo.contents != NULL) - { - free (finfo.contents); - finfo.contents = NULL; - } - if (finfo.external_relocs != NULL) - { - free (finfo.external_relocs); - finfo.external_relocs = NULL; - } - - /* The value of the last C_FILE symbol is supposed to be -1. Write - it out again. */ - if (finfo.last_file_index != -1) - { - finfo.last_file.n_value = -(bfd_vma) 1; - bfd_coff_swap_sym_out (abfd, (PTR) &finfo.last_file, - (PTR) finfo.outsyms); - pos = obj_sym_filepos (abfd) + finfo.last_file_index * symesz; - if (bfd_seek (abfd, pos, SEEK_SET) != 0 - || bfd_bwrite (finfo.outsyms, symesz, abfd) != symesz) - goto error_return; - } - - /* Write out all the global symbols which do not come from XCOFF - input files. */ - xcoff_link_hash_traverse (xcoff_hash_table (info), - xcoff_write_global_symbol, - (PTR) &finfo); - - if (finfo.outsyms != NULL) - { - free (finfo.outsyms); - finfo.outsyms = NULL; - } - - /* Now that we have written out all the global symbols, we know the - symbol indices to use for relocs against them, and we can finally - write out the relocs. */ - amt = max_output_reloc_count * relsz; - external_relocs = (bfd_byte *) bfd_malloc (amt); - if (external_relocs == NULL && max_output_reloc_count != 0) - goto error_return; - - for (o = abfd->sections; o != NULL; o = o->next) - { - struct internal_reloc *irel; - struct internal_reloc *irelend; - struct xcoff_link_hash_entry **rel_hash; - struct xcoff_toc_rel_hash *toc_rel_hash; - bfd_byte *erel; - bfd_size_type rel_size; - - /* A stripped file has no relocs. */ - if (info->strip == strip_all) - { - o->reloc_count = 0; - continue; - } - - if (o->reloc_count == 0) - continue; - - irel = finfo.section_info[o->target_index].relocs; - irelend = irel + o->reloc_count; - rel_hash = finfo.section_info[o->target_index].rel_hashes; - for (; irel < irelend; irel++, rel_hash++, erel += relsz) - { - if (*rel_hash != NULL) - { - if ((*rel_hash)->indx < 0) - { - if (! ((*info->callbacks->unattached_reloc) - (info, (*rel_hash)->root.root.string, - (bfd *) NULL, o, irel->r_vaddr))) - goto error_return; - (*rel_hash)->indx = 0; - } - irel->r_symndx = (*rel_hash)->indx; - } - } - - for (toc_rel_hash = finfo.section_info[o->target_index].toc_rel_hashes; - toc_rel_hash != NULL; - toc_rel_hash = toc_rel_hash->next) - { - if (toc_rel_hash->h->u.toc_indx < 0) - { - if (! ((*info->callbacks->unattached_reloc) - (info, toc_rel_hash->h->root.root.string, - (bfd *) NULL, o, toc_rel_hash->rel->r_vaddr))) - goto error_return; - toc_rel_hash->h->u.toc_indx = 0; - } - toc_rel_hash->rel->r_symndx = toc_rel_hash->h->u.toc_indx; - } - - /* XCOFF requires that the relocs be sorted by address. We tend - to produce them in the order in which their containing csects - appear in the symbol table, which is not necessarily by - address. So we sort them here. There may be a better way to - do this. */ - qsort ((PTR) finfo.section_info[o->target_index].relocs, - o->reloc_count, sizeof (struct internal_reloc), - xcoff_sort_relocs); - - irel = finfo.section_info[o->target_index].relocs; - irelend = irel + o->reloc_count; - erel = external_relocs; - for (; irel < irelend; irel++, rel_hash++, erel += relsz) - bfd_coff_swap_reloc_out (abfd, (PTR) irel, (PTR) erel); - - rel_size = relsz * o->reloc_count; - if (bfd_seek (abfd, o->rel_filepos, SEEK_SET) != 0 - || bfd_bwrite ((PTR) external_relocs, rel_size, abfd) != rel_size) - goto error_return; - } - - if (external_relocs != NULL) - { - free (external_relocs); - external_relocs = NULL; - } - - /* Free up the section information. */ - if (finfo.section_info != NULL) - { - unsigned int i; - - for (i = 0; i < abfd->section_count; i++) - { - if (finfo.section_info[i].relocs != NULL) - free (finfo.section_info[i].relocs); - if (finfo.section_info[i].rel_hashes != NULL) - free (finfo.section_info[i].rel_hashes); - } - free (finfo.section_info); - finfo.section_info = NULL; - } - - /* Write out the loader section contents. */ - BFD_ASSERT ((bfd_byte *) finfo.ldrel - == (xcoff_hash_table (info)->loader_section->contents - + xcoff_hash_table (info)->ldhdr.l_impoff)); - o = xcoff_hash_table (info)->loader_section; - if (! bfd_set_section_contents (abfd, o->output_section, o->contents, - (file_ptr) o->output_offset, o->_raw_size)) - goto error_return; - - /* Write out the magic sections. */ - o = xcoff_hash_table (info)->linkage_section; - if (o->_raw_size > 0 - && ! bfd_set_section_contents (abfd, o->output_section, o->contents, - (file_ptr) o->output_offset, - o->_raw_size)) - goto error_return; - o = xcoff_hash_table (info)->toc_section; - if (o->_raw_size > 0 - && ! bfd_set_section_contents (abfd, o->output_section, o->contents, - (file_ptr) o->output_offset, - o->_raw_size)) - goto error_return; - o = xcoff_hash_table (info)->descriptor_section; - if (o->_raw_size > 0 - && ! bfd_set_section_contents (abfd, o->output_section, o->contents, - (file_ptr) o->output_offset, - o->_raw_size)) - goto error_return; - - /* Write out the string table. */ - pos = obj_sym_filepos (abfd) + obj_raw_syment_count (abfd) * symesz; - if (bfd_seek (abfd, pos, SEEK_SET) != 0) - goto error_return; - H_PUT_32 (abfd, - _bfd_stringtab_size (finfo.strtab) + STRING_SIZE_SIZE, - strbuf); - amt = STRING_SIZE_SIZE; - if (bfd_bwrite (strbuf, amt, abfd) != amt) - goto error_return; - if (! _bfd_stringtab_emit (abfd, finfo.strtab)) - goto error_return; - - _bfd_stringtab_free (finfo.strtab); - - /* Write out the debugging string table. */ - o = xcoff_hash_table (info)->debug_section; - if (o != NULL) - { - struct bfd_strtab_hash *debug_strtab; - - debug_strtab = xcoff_hash_table (info)->debug_strtab; - BFD_ASSERT (o->output_section->_raw_size - o->output_offset - >= _bfd_stringtab_size (debug_strtab)); - pos = o->output_section->filepos + o->output_offset; - if (bfd_seek (abfd, pos, SEEK_SET) != 0) - goto error_return; - if (! _bfd_stringtab_emit (abfd, debug_strtab)) - goto error_return; - } - - /* Setting bfd_get_symcount to 0 will cause write_object_contents to - not try to write out the symbols. */ - bfd_get_symcount (abfd) = 0; - - return TRUE; - - error_return: - if (finfo.strtab != NULL) - _bfd_stringtab_free (finfo.strtab); - - if (finfo.section_info != NULL) - { - unsigned int i; - - for (i = 0; i < abfd->section_count; i++) - { - if (finfo.section_info[i].relocs != NULL) - free (finfo.section_info[i].relocs); - if (finfo.section_info[i].rel_hashes != NULL) - free (finfo.section_info[i].rel_hashes); - } - free (finfo.section_info); - } - - if (finfo.internal_syms != NULL) - free (finfo.internal_syms); - if (finfo.sym_indices != NULL) - free (finfo.sym_indices); - if (finfo.outsyms != NULL) - free (finfo.outsyms); - if (finfo.linenos != NULL) - free (finfo.linenos); - if (finfo.contents != NULL) - free (finfo.contents); - if (finfo.external_relocs != NULL) - free (finfo.external_relocs); - if (external_relocs != NULL) - free (external_relocs); - return FALSE; -} - /* Link an input file into the linker output file. This function handles all the sections and relocations of the input file at once. */ static bfd_boolean -xcoff_link_input_bfd (finfo, input_bfd) - struct xcoff_final_link_info *finfo; - bfd *input_bfd; +xcoff_link_input_bfd (struct xcoff_final_link_info *finfo, + bfd *input_bfd) { bfd *output_bfd; const char *strings; @@ -4215,7 +3423,6 @@ xcoff_link_input_bfd (finfo, input_bfd) return TRUE; /* Move all the symbols to the output file. */ - output_bfd = finfo->output_bfd; strings = NULL; syment_base = obj_raw_syment_count (output_bfd); @@ -4255,7 +3462,6 @@ xcoff_link_input_bfd (finfo, input_bfd) while (esym < esym_end) { - struct internal_syment isym; union internal_auxent aux; int smtyp = 0; @@ -4263,7 +3469,7 @@ xcoff_link_input_bfd (finfo, input_bfd) bfd_boolean require; int add; - bfd_coff_swap_sym_in (input_bfd, (PTR) esym, (PTR) isymp); + bfd_coff_swap_sym_in (input_bfd, (void *) esym, (void *) isymp); /* If this is a C_EXT or C_HIDEXT symbol, we need the csect information. */ @@ -4271,10 +3477,10 @@ xcoff_link_input_bfd (finfo, input_bfd) { BFD_ASSERT (isymp->n_numaux > 0); bfd_coff_swap_aux_in (input_bfd, - (PTR) (esym + isymesz * isymp->n_numaux), + (void *) (esym + isymesz * isymp->n_numaux), isymp->n_type, isymp->n_sclass, isymp->n_numaux - 1, isymp->n_numaux, - (PTR) &aux); + (void *) &aux); smtyp = SMTYP_SMTYP (aux.x_csect.x_smtyp); } @@ -4423,7 +3629,7 @@ xcoff_link_input_bfd (finfo, input_bfd) output section, as it does in the default linker script. */ tocend = ((*csectpp)->output_section->vma - + (*csectpp)->output_section->_raw_size); + + (*csectpp)->output_section->size); for (inp = finfo->info->input_bfds; inp != NULL; inp = inp->link_next) @@ -4435,7 +3641,7 @@ xcoff_link_input_bfd (finfo, input_bfd) bfd_vma new_toc_end; new_toc_end = (o->output_section->vma + o->output_offset - + o->_cooked_size); + + o->size); if (new_toc_end > tocend) tocend = new_toc_end; } @@ -4560,8 +3766,7 @@ xcoff_link_input_bfd (finfo, input_bfd) const char *name; bfd_size_type indx; - name = _bfd_coff_internal_syment_name (input_bfd, &isym, - (char *) NULL); + name = _bfd_coff_internal_syment_name (input_bfd, &isym, NULL); if (name == NULL) return FALSE; @@ -4599,8 +3804,8 @@ xcoff_link_input_bfd (finfo, input_bfd) { /* The last C_FILE symbol is in this input file. */ bfd_coff_swap_sym_out (output_bfd, - (PTR) &finfo->last_file, - (PTR) (finfo->outsyms + (void *) &finfo->last_file, + (void *) (finfo->outsyms + ((finfo->last_file_index - syment_base) * osymesz))); @@ -4613,8 +3818,8 @@ xcoff_link_input_bfd (finfo, input_bfd) file_ptr pos; bfd_coff_swap_sym_out (output_bfd, - (PTR) &finfo->last_file, - (PTR) outsym); + (void *) &finfo->last_file, + (void *) outsym); pos = obj_sym_filepos (output_bfd); pos += finfo->last_file_index * osymesz; @@ -4641,7 +3846,7 @@ xcoff_link_input_bfd (finfo, input_bfd) /* Output the symbol. */ - bfd_coff_swap_sym_out (output_bfd, (PTR) &isym, (PTR) outsym); + bfd_coff_swap_sym_out (output_bfd, (void *) &isym, (void *) outsym); *indexp = output_index; @@ -4715,7 +3920,7 @@ xcoff_link_input_bfd (finfo, input_bfd) /* The value of a C_BSTAT symbol is the symbol table index of the containing csect. */ - bfd_coff_swap_sym_in (output_bfd, (PTR) outsym, (PTR) &isym); + bfd_coff_swap_sym_in (output_bfd, (void *) outsym, (void *) &isym); indx = isym.n_value; if (indx < obj_raw_syment_count (input_bfd)) { @@ -4726,8 +3931,8 @@ xcoff_link_input_bfd (finfo, input_bfd) isym.n_value = 0; else isym.n_value = symindx; - bfd_coff_swap_sym_out (output_bfd, (PTR) &isym, - (PTR) outsym); + bfd_coff_swap_sym_out (output_bfd, (void *) &isym, + (void *) outsym); } } @@ -4738,9 +3943,9 @@ xcoff_link_input_bfd (finfo, input_bfd) { union internal_auxent aux; - bfd_coff_swap_aux_in (input_bfd, (PTR) esym, isymp->n_type, + bfd_coff_swap_aux_in (input_bfd, (void *) esym, isymp->n_type, isymp->n_sclass, i, isymp->n_numaux, - (PTR) &aux); + (void *) &aux); if (isymp->n_sclass == C_FILE) { @@ -4884,8 +4089,8 @@ xcoff_link_input_bfd (finfo, input_bfd) - enclosing->line_filepos); bfd_coff_swap_lineno_in (input_bfd, - (PTR) (finfo->linenos + linoff), - (PTR) &lin); + (void *) (finfo->linenos + linoff), + (void *) &lin); if (lin.l_lnno != 0 || ((bfd_size_type) lin.l_addr.l_symndx != ((esym @@ -4901,8 +4106,8 @@ xcoff_link_input_bfd (finfo, input_bfd) bfd_size_type count; lin.l_addr.l_symndx = *indexp; - bfd_coff_swap_lineno_out (output_bfd, (PTR) &lin, - (PTR) (finfo->linenos + bfd_coff_swap_lineno_out (output_bfd, (void *) &lin, + (void *) (finfo->linenos + linoff)); linpend = (finfo->linenos @@ -4914,14 +4119,14 @@ xcoff_link_input_bfd (finfo, input_bfd) linp < linpend; linp += linesz) { - bfd_coff_swap_lineno_in (input_bfd, (PTR) linp, - (PTR) &lin); + bfd_coff_swap_lineno_in (input_bfd, (void *) linp, + (void *) &lin); if (lin.l_lnno == 0) break; lin.l_addr.l_paddr += offset; bfd_coff_swap_lineno_out (output_bfd, - (PTR) &lin, - (PTR) linp); + (void *) &lin, + (void *) linp); } count = (linp - (finfo->linenos + linoff)) / linesz; @@ -4969,16 +4174,16 @@ xcoff_link_input_bfd (finfo, input_bfd) struct internal_syment iis; bfd_coff_swap_sym_in (output_bfd, - (PTR) oos, - (PTR) &iis); + (void *) oos, + (void *) &iis); iis.n_value = (iisp->n_value - enclosing->line_filepos - linoff + aux.x_sym.x_fcnary.x_fcn.x_lnnoptr); bfd_coff_swap_sym_out (output_bfd, - (PTR) &iis, - (PTR) oos); + (void *) &iis, + (void *) oos); --incls; } @@ -4993,9 +4198,9 @@ xcoff_link_input_bfd (finfo, input_bfd) } } - bfd_coff_swap_aux_out (output_bfd, (PTR) &aux, isymp->n_type, + bfd_coff_swap_aux_out (output_bfd, (void *) &aux, isymp->n_type, isymp->n_sclass, i, isymp->n_numaux, - (PTR) outsym); + (void *) outsym); outsym += osymesz; esym += isymesz; } @@ -5014,8 +4219,8 @@ xcoff_link_input_bfd (finfo, input_bfd) && (bfd_size_type) finfo->last_file_index >= syment_base) { finfo->last_file.n_value = output_index; - bfd_coff_swap_sym_out (output_bfd, (PTR) &finfo->last_file, - (PTR) (finfo->outsyms + bfd_coff_swap_sym_out (output_bfd, (void *) &finfo->last_file, + (void *) (finfo->outsyms + ((finfo->last_file_index - syment_base) * osymesz))); } @@ -5043,17 +4248,14 @@ xcoff_link_input_bfd (finfo, input_bfd) /* Relocate the contents of each section. */ for (o = input_bfd->sections; o != NULL; o = o->next) { - bfd_byte *contents; if (! o->linker_mark) - { - /* This section was omitted from the link. */ - continue; - } + /* This section was omitted from the link. */ + continue; if ((o->flags & SEC_HAS_CONTENTS) == 0 - || o->_raw_size == 0 + || o->size == 0 || (o->flags & SEC_IN_MEMORY) != 0) continue; @@ -5062,12 +4264,13 @@ xcoff_link_input_bfd (finfo, input_bfd) if (coff_section_data (input_bfd, o) != NULL && coff_section_data (input_bfd, o)->contents != NULL) contents = coff_section_data (input_bfd, o)->contents; - else { - if (! bfd_get_section_contents (input_bfd, o, finfo->contents, - (file_ptr) 0, o->_raw_size)) - return FALSE; - contents = finfo->contents; - } + else + { + bfd_size_type sz = o->rawsize ? o->rawsize : o->size; + if (!bfd_get_section_contents (input_bfd, o, finfo->contents, 0, sz)) + return FALSE; + contents = finfo->contents; + } if ((o->flags & SEC_RELOC) != 0) { @@ -5148,9 +4351,8 @@ xcoff_link_input_bfd (finfo, input_bfd) struct xcoff_link_section_info *si; bfd_size_type amt; - amt = sizeof (struct xcoff_toc_rel_hash); - n = ((struct xcoff_toc_rel_hash *) - bfd_alloc (finfo->output_bfd, amt)); + amt = sizeof (* n); + n = bfd_alloc (finfo->output_bfd, amt); if (n == NULL) return FALSE; si = finfo->section_info + target_index; @@ -5194,10 +4396,10 @@ xcoff_link_input_bfd (finfo, input_bfd) if (is->n_sclass == C_HIDEXT && is->n_numaux > 0) { - PTR auxptr; + void * auxptr; union internal_auxent aux; - auxptr = ((PTR) + auxptr = ((void *) (((bfd_byte *) obj_coff_external_syms (input_bfd)) + ((r_symndx + is->n_numaux) @@ -5206,7 +4408,7 @@ xcoff_link_input_bfd (finfo, input_bfd) is->n_type, is->n_sclass, is->n_numaux - 1, is->n_numaux, - (PTR) &aux); + (void *) &aux); if (SMTYP_SMTYP (aux.x_csect.x_smtyp) == XTY_SD && aux.x_csect.x_smclas == XMC_TC0) indx = finfo->toc_symindx; @@ -5285,9 +4487,8 @@ xcoff_link_input_bfd (finfo, input_bfd) else { (*_bfd_error_handler) - (_("%s: loader reloc in unrecognized section `%s'"), - bfd_archive_filename (input_bfd), - sec->name); + (_("%B: loader reloc in unrecognized section `%A'"), + input_bfd, sec); bfd_set_error (bfd_error_nonrepresentable_section); return FALSE; } @@ -5307,8 +4508,8 @@ xcoff_link_input_bfd (finfo, input_bfd) if (h->ldindx < 0 && ! quiet) { (*_bfd_error_handler) - (_("%s: `%s' in loader reloc but not loader sym"), - bfd_archive_filename (input_bfd), + (_("%B: `%s' in loader reloc but not loader sym"), + input_bfd, h->root.root.string); bfd_set_error (bfd_error_bad_value); return FALSE; @@ -5322,10 +4523,8 @@ xcoff_link_input_bfd (finfo, input_bfd) && ! quiet) { (*_bfd_error_handler) - (_("%s: loader reloc in read-only section %s"), - bfd_archive_filename (input_bfd), - bfd_get_section_name (finfo->output_bfd, - o->output_section)); + (_("%B: loader reloc in read-only section %A"), + input_bfd, o->output_section); bfd_set_error (bfd_error_invalid_operation); return FALSE; } @@ -5352,9 +4551,7 @@ xcoff_link_input_bfd (finfo, input_bfd) /* Write out the modified section contents. */ if (! bfd_set_section_contents (output_bfd, o->output_section, contents, (file_ptr) o->output_offset, - (o->_cooked_size != 0 - ? o->_cooked_size - : o->_raw_size))) + o->size)) return FALSE; } @@ -5372,13 +4569,26 @@ xcoff_link_input_bfd (finfo, input_bfd) #undef N_TMASK #undef N_BTSHFT +/* Sort relocs by VMA. This is called via qsort. */ + +static int +xcoff_sort_relocs (const void * p1, const void * p2) +{ + const struct internal_reloc *r1 = (const struct internal_reloc *) p1; + const struct internal_reloc *r2 = (const struct internal_reloc *) p2; + + if (r1->r_vaddr > r2->r_vaddr) + return 1; + else if (r1->r_vaddr < r2->r_vaddr) + return -1; + else + return 0; +} + /* Write out a non-XCOFF global symbol. */ - static bfd_boolean -xcoff_write_global_symbol (h, inf) - struct xcoff_link_hash_entry *h; - PTR inf; +xcoff_write_global_symbol (struct xcoff_link_hash_entry *h, void * inf) { struct xcoff_final_link_info *finfo = (struct xcoff_final_link_info *) inf; bfd *output_bfd; @@ -5425,7 +4635,6 @@ xcoff_write_global_symbol (h, inf) else if (h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak) { - asection *sec; sec = h->root.u.def.section; @@ -5443,30 +4652,22 @@ xcoff_write_global_symbol (h, inf) if (((h->flags & XCOFF_DEF_REGULAR) == 0 && (h->flags & XCOFF_DEF_DYNAMIC) != 0) || (h->flags & XCOFF_IMPORT) != 0) - { - /* Clear l_smtype - Import symbols are defined so the check above will make - the l_smtype XTY_SD. But this is not correct, it should - be cleared. */ - ldsym->l_smtype |= L_IMPORT; - } + /* Clear l_smtype + Import symbols are defined so the check above will make + the l_smtype XTY_SD. But this is not correct, it should + be cleared. */ + ldsym->l_smtype |= L_IMPORT; if (((h->flags & XCOFF_DEF_REGULAR) != 0 && (h->flags & XCOFF_DEF_DYNAMIC) != 0) || (h->flags & XCOFF_EXPORT) != 0) - { - ldsym->l_smtype |= L_EXPORT; - } + ldsym->l_smtype |= L_EXPORT; if ((h->flags & XCOFF_ENTRY) != 0) - { - ldsym->l_smtype |= L_ENTRY; - } + ldsym->l_smtype |= L_ENTRY; if ((h->flags & XCOFF_RTINIT) != 0) - { - ldsym->l_smtype = XTY_SD; - } + ldsym->l_smtype = XTY_SD; ldsym->l_smclas = h->smclas; @@ -5475,22 +4676,17 @@ xcoff_write_global_symbol (h, inf) if ((h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak) && (h->root.u.def.value != 0)) - { - ldsym->l_smclas = XMC_XO; - } + ldsym->l_smclas = XMC_XO; + else if ((h->flags & (XCOFF_SYSCALL32 | XCOFF_SYSCALL64)) == (XCOFF_SYSCALL32 | XCOFF_SYSCALL64)) - { - ldsym->l_smclas = XMC_SV3264; - } + ldsym->l_smclas = XMC_SV3264; + else if (h->flags & XCOFF_SYSCALL32) - { - ldsym->l_smclas = XMC_SV; - } + ldsym->l_smclas = XMC_SV; + else if (h->flags & XCOFF_SYSCALL64) - { - ldsym->l_smclas = XMC_SV64; - } + ldsym->l_smclas = XMC_SV64; } if (ldsym->l_ifile == -(bfd_size_type) 1) @@ -5500,13 +4696,9 @@ xcoff_write_global_symbol (h, inf) else if (ldsym->l_ifile == 0) { if ((ldsym->l_smtype & L_IMPORT) == 0) - { - ldsym->l_ifile = 0; - } + ldsym->l_ifile = 0; else if (impbfd == NULL) - { - ldsym->l_ifile = 0; - } + ldsym->l_ifile = 0; else { BFD_ASSERT (impbfd->xvec == output_bfd->xvec); @@ -5543,10 +4735,7 @@ xcoff_write_global_symbol (h, inf) - xcoff_data (output_bfd)->toc); if ((h->descriptor->flags & XCOFF_SET_TOC) != 0) - { - tocoff += h->descriptor->u.toc_offset; - } - + tocoff += h->descriptor->u.toc_offset; /* The first instruction in the glink code needs to be cooked to to hold the correct offset in the toc. The @@ -5558,11 +4747,9 @@ xcoff_write_global_symbol (h, inf) The /4 is because the glink code is in bytes and we are going 4 at a pop. */ for (i = 1; i < bfd_xcoff_glink_code_size(output_bfd) / 4; i++) - { - bfd_put_32 (output_bfd, - (bfd_vma) bfd_xcoff_glink_code(output_bfd, i), - &p[4 * i]); - } + bfd_put_32 (output_bfd, + (bfd_vma) bfd_xcoff_glink_code(output_bfd, i), + &p[4 * i]); } /* If we created a TOC entry for this symbol, write out the required @@ -5585,11 +4772,8 @@ xcoff_write_global_symbol (h, inf) + tocsec->output_offset + h->u.toc_offset); - if (h->indx >= 0) - { - irel->r_symndx = h->indx; - } + irel->r_symndx = h->indx; else { h->indx = -2; @@ -5603,7 +4787,7 @@ xcoff_write_global_symbol (h, inf) whether the output is 32 or 64 bit. */ memset (&iraux, 0, sizeof iraux); iraux.x_csect.x_smtyp = XTY_SD; - /* iraux.x_csect.x_scnlen.l = 4 or 8, see below */ + /* iraux.x_csect.x_scnlen.l = 4 or 8, see below. */ iraux.x_csect.x_smclas = XMC_TC; /* 32 bit uses a 32 bit R_POS to do the relocations @@ -5623,9 +4807,8 @@ xcoff_write_global_symbol (h, inf) iraux.x_csect.x_scnlen.l = 4; } else - { - return FALSE; - } + return FALSE; + irel->r_type = R_POS; finfo->section_info[oindx].rel_hashes[osec->reloc_count] = NULL; ++osec->reloc_count; @@ -5641,7 +4824,6 @@ xcoff_write_global_symbol (h, inf) the reloc. */ if (finfo->info->strip != strip_all) { - result = bfd_xcoff_put_symbol_name (output_bfd, finfo->strtab, &irsym, h->root.root.string); if (!result) @@ -5653,12 +4835,12 @@ xcoff_write_global_symbol (h, inf) irsym.n_type = T_NULL; irsym.n_numaux = 1; - bfd_coff_swap_sym_out (output_bfd, (PTR) &irsym, (PTR) outsym); + bfd_coff_swap_sym_out (output_bfd, (void *) &irsym, (void *) outsym); outsym += bfd_coff_symesz (output_bfd); - /* note : iraux is initialized above */ - bfd_coff_swap_aux_out (output_bfd, (PTR) &iraux, T_NULL, C_HIDEXT, - 0, 1, (PTR) outsym); + /* Note : iraux is initialized above. */ + bfd_coff_swap_aux_out (output_bfd, (void *) &iraux, T_NULL, C_HIDEXT, + 0, 1, (void *) outsym); outsym += bfd_coff_auxesz (output_bfd); if (h->indx >= 0) @@ -5717,9 +4899,7 @@ xcoff_write_global_symbol (h, inf) byte_size = 4; } else - { - return FALSE; - } + return FALSE; sec = h->root.u.def.section; osec = sec->output_section; @@ -5920,12 +5100,12 @@ xcoff_write_global_symbol (h, inf) isym.n_type = T_NULL; isym.n_numaux = 1; - bfd_coff_swap_sym_out (output_bfd, (PTR) &isym, (PTR) outsym); + bfd_coff_swap_sym_out (output_bfd, (void *) &isym, (void *) outsym); outsym += bfd_coff_symesz (output_bfd); aux.x_csect.x_smclas = h->smclas; - bfd_coff_swap_aux_out (output_bfd, (PTR) &aux, T_NULL, isym.n_sclass, 0, 1, - (PTR) outsym); + bfd_coff_swap_aux_out (output_bfd, (void *) &aux, T_NULL, isym.n_sclass, 0, 1, + (void *) outsym); outsym += bfd_coff_auxesz (output_bfd); if ((h->root.type == bfd_link_hash_defined @@ -5933,17 +5113,16 @@ xcoff_write_global_symbol (h, inf) && h->smclas != XMC_XO) { /* We just output an SD symbol. Now output an LD symbol. */ - h->indx += 2; isym.n_sclass = C_EXT; - bfd_coff_swap_sym_out (output_bfd, (PTR) &isym, (PTR) outsym); + bfd_coff_swap_sym_out (output_bfd, (void *) &isym, (void *) outsym); outsym += bfd_coff_symesz (output_bfd); aux.x_csect.x_smtyp = XTY_LD; aux.x_csect.x_scnlen.l = obj_raw_syment_count (output_bfd); - bfd_coff_swap_aux_out (output_bfd, (PTR) &aux, T_NULL, C_EXT, 0, 1, - (PTR) outsym); + bfd_coff_swap_aux_out (output_bfd, (void *) &aux, T_NULL, C_EXT, 0, 1, + (void *) outsym); outsym += bfd_coff_auxesz (output_bfd); } @@ -5962,11 +5141,10 @@ xcoff_write_global_symbol (h, inf) /* Handle a link order which is supposed to generate a reloc. */ static bfd_boolean -xcoff_reloc_link_order (output_bfd, finfo, output_section, link_order) - bfd *output_bfd; - struct xcoff_final_link_info *finfo; - asection *output_section; - struct bfd_link_order *link_order; +xcoff_reloc_link_order (bfd *output_bfd, + struct xcoff_final_link_info *finfo, + asection *output_section, + struct bfd_link_order *link_order) { reloc_howto_type *howto; struct xcoff_link_hash_entry *h; @@ -5978,13 +5156,11 @@ xcoff_reloc_link_order (output_bfd, finfo, output_section, link_order) struct internal_ldrel ldrel; if (link_order->type == bfd_section_reloc_link_order) - { - /* We need to somehow locate a symbol in the right section. The - symbol must either have a value of zero, or we must adjust - the addend by the value of the symbol. FIXME: Write this - when we need it. The old linker couldn't handle this anyhow. */ - abort (); - } + /* We need to somehow locate a symbol in the right section. The + symbol must either have a value of zero, or we must adjust + the addend by the value of the symbol. FIXME: Write this + when we need it. The old linker couldn't handle this anyhow. */ + abort (); howto = bfd_reloc_type_lookup (output_bfd, link_order->u.reloc.p->reloc); if (howto == NULL) @@ -6000,8 +5176,7 @@ xcoff_reloc_link_order (output_bfd, finfo, output_section, link_order) if (h == NULL) { if (! ((*finfo->info->callbacks->unattached_reloc) - (finfo->info, link_order->u.reloc.p->u.name, (bfd *) NULL, - (asection *) NULL, (bfd_vma) 0))) + (finfo->info, link_order->u.reloc.p->u.name, NULL, NULL, (bfd_vma) 0))) return FALSE; return TRUE; } @@ -6037,7 +5212,7 @@ xcoff_reloc_link_order (output_bfd, finfo, output_section, link_order) bfd_boolean ok; size = bfd_get_reloc_size (howto); - buf = (bfd_byte *) bfd_zmalloc (size); + buf = bfd_zmalloc (size); if (buf == NULL) return FALSE; @@ -6051,16 +5226,15 @@ xcoff_reloc_link_order (output_bfd, finfo, output_section, link_order) abort (); case bfd_reloc_overflow: if (! ((*finfo->info->callbacks->reloc_overflow) - (finfo->info, link_order->u.reloc.p->u.name, - howto->name, addend, (bfd *) NULL, (asection *) NULL, - (bfd_vma) 0))) + (finfo->info, NULL, link_order->u.reloc.p->u.name, + howto->name, addend, NULL, NULL, (bfd_vma) 0))) { free (buf); return FALSE; } break; } - ok = bfd_set_section_contents (output_bfd, output_section, (PTR) buf, + ok = bfd_set_section_contents (output_bfd, output_section, (void *) buf, (file_ptr) link_order->offset, size); free (buf); if (! ok) @@ -6069,7 +5243,6 @@ xcoff_reloc_link_order (output_bfd, finfo, output_section, link_order) /* Store the reloc information in the right place. It will get swapped and written out at the end of the final_link routine. */ - irel = (finfo->section_info[output_section->target_index].relocs + output_section->reloc_count); rel_hash_ptr = (finfo->section_info[output_section->target_index].rel_hashes @@ -6144,24 +5317,639 @@ xcoff_reloc_link_order (output_bfd, finfo, output_section, link_order) return TRUE; } -/* Sort relocs by VMA. This is called via qsort. */ +/* Do the final link step. */ -static int -xcoff_sort_relocs (p1, p2) - const PTR p1; - const PTR p2; +bfd_boolean +_bfd_xcoff_bfd_final_link (bfd *abfd, struct bfd_link_info *info) { - const struct internal_reloc *r1 = (const struct internal_reloc *) p1; - const struct internal_reloc *r2 = (const struct internal_reloc *) p2; + bfd_size_type symesz; + struct xcoff_final_link_info finfo; + asection *o; + struct bfd_link_order *p; + bfd_size_type max_contents_size; + bfd_size_type max_sym_count; + bfd_size_type max_lineno_count; + bfd_size_type max_reloc_count; + bfd_size_type max_output_reloc_count; + file_ptr rel_filepos; + unsigned int relsz; + file_ptr line_filepos; + unsigned int linesz; + bfd *sub; + bfd_byte *external_relocs = NULL; + char strbuf[STRING_SIZE_SIZE]; + file_ptr pos; + bfd_size_type amt; - if (r1->r_vaddr > r2->r_vaddr) - return 1; - else if (r1->r_vaddr < r2->r_vaddr) - return -1; + if (info->shared) + abfd->flags |= DYNAMIC; + + symesz = bfd_coff_symesz (abfd); + + finfo.info = info; + finfo.output_bfd = abfd; + finfo.strtab = NULL; + finfo.section_info = NULL; + finfo.last_file_index = -1; + finfo.toc_symindx = -1; + finfo.internal_syms = NULL; + finfo.sym_indices = NULL; + finfo.outsyms = NULL; + finfo.linenos = NULL; + finfo.contents = NULL; + finfo.external_relocs = NULL; + + finfo.ldsym = (xcoff_hash_table (info)->loader_section->contents + + bfd_xcoff_ldhdrsz (abfd)); + finfo.ldrel = (xcoff_hash_table (info)->loader_section->contents + + bfd_xcoff_ldhdrsz(abfd) + + (xcoff_hash_table (info)->ldhdr.l_nsyms + * bfd_xcoff_ldsymsz(abfd))); + + xcoff_data (abfd)->coff.link_info = info; + + finfo.strtab = _bfd_stringtab_init (); + if (finfo.strtab == NULL) + goto error_return; + + /* Count the line number and relocation entries required for the + output file. Determine a few maximum sizes. */ + max_contents_size = 0; + max_lineno_count = 0; + max_reloc_count = 0; + for (o = abfd->sections; o != NULL; o = o->next) + { + o->reloc_count = 0; + o->lineno_count = 0; + for (p = o->map_head.link_order; p != NULL; p = p->next) + { + if (p->type == bfd_indirect_link_order) + { + asection *sec; + + sec = p->u.indirect.section; + + /* Mark all sections which are to be included in the + link. This will normally be every section. We need + to do this so that we can identify any sections which + the linker has decided to not include. */ + sec->linker_mark = TRUE; + + if (info->strip == strip_none + || info->strip == strip_some) + o->lineno_count += sec->lineno_count; + + o->reloc_count += sec->reloc_count; + + if (sec->rawsize > max_contents_size) + max_contents_size = sec->rawsize; + if (sec->size > max_contents_size) + max_contents_size = sec->size; + if (sec->lineno_count > max_lineno_count) + max_lineno_count = sec->lineno_count; + if (coff_section_data (sec->owner, sec) != NULL + && xcoff_section_data (sec->owner, sec) != NULL + && (xcoff_section_data (sec->owner, sec)->lineno_count + > max_lineno_count)) + max_lineno_count = + xcoff_section_data (sec->owner, sec)->lineno_count; + if (sec->reloc_count > max_reloc_count) + max_reloc_count = sec->reloc_count; + } + else if (p->type == bfd_section_reloc_link_order + || p->type == bfd_symbol_reloc_link_order) + ++o->reloc_count; + } + } + + /* Compute the file positions for all the sections. */ + if (abfd->output_has_begun) + { + if (xcoff_hash_table (info)->file_align != 0) + abort (); + } else - return 0; + { + bfd_vma file_align; + + file_align = xcoff_hash_table (info)->file_align; + if (file_align != 0) + { + bfd_boolean saw_contents; + int indx; + file_ptr sofar; + + /* Insert .pad sections before every section which has + contents and is loaded, if it is preceded by some other + section which has contents and is loaded. */ + saw_contents = TRUE; + for (o = abfd->sections; o != NULL; o = o->next) + { + if (strcmp (o->name, ".pad") == 0) + saw_contents = FALSE; + else if ((o->flags & SEC_HAS_CONTENTS) != 0 + && (o->flags & SEC_LOAD) != 0) + { + if (! saw_contents) + saw_contents = TRUE; + else + { + asection *n; + + /* Create a pad section and place it before the section + that needs padding. This requires unlinking and + relinking the bfd's section list. */ + + n = bfd_make_section_anyway (abfd, ".pad"); + n->flags = SEC_HAS_CONTENTS; + n->alignment_power = 0; + + bfd_section_list_remove (abfd, n); + bfd_section_list_insert_before (abfd, o, n); + saw_contents = FALSE; + } + } + } + + /* Reset the section indices after inserting the new + sections. */ + indx = 0; + for (o = abfd->sections; o != NULL; o = o->next) + { + ++indx; + o->target_index = indx; + } + BFD_ASSERT ((unsigned int) indx == abfd->section_count); + + /* Work out appropriate sizes for the .pad sections to force + each section to land on a page boundary. This bit of + code knows what compute_section_file_positions is going + to do. */ + sofar = bfd_coff_filhsz (abfd); + sofar += bfd_coff_aoutsz (abfd); + sofar += abfd->section_count * bfd_coff_scnhsz (abfd); + for (o = abfd->sections; o != NULL; o = o->next) + if ((bfd_xcoff_is_reloc_count_overflow + (abfd, (bfd_vma) o->reloc_count)) + || (bfd_xcoff_is_lineno_count_overflow + (abfd, (bfd_vma) o->lineno_count))) + /* 64 does not overflow, need to check if 32 does */ + sofar += bfd_coff_scnhsz (abfd); + + for (o = abfd->sections; o != NULL; o = o->next) + { + if (strcmp (o->name, ".pad") == 0) + { + bfd_vma pageoff; + + BFD_ASSERT (o->size == 0); + pageoff = sofar & (file_align - 1); + if (pageoff != 0) + { + o->size = file_align - pageoff; + sofar += file_align - pageoff; + o->flags |= SEC_HAS_CONTENTS; + } + } + else + { + if ((o->flags & SEC_HAS_CONTENTS) != 0) + sofar += BFD_ALIGN (o->size, + 1 << o->alignment_power); + } + } + } + + if (! bfd_coff_compute_section_file_positions (abfd)) + goto error_return; + } + + /* Allocate space for the pointers we need to keep for the relocs. */ + { + unsigned int i; + + /* We use section_count + 1, rather than section_count, because + the target_index fields are 1 based. */ + amt = abfd->section_count + 1; + amt *= sizeof (struct xcoff_link_section_info); + finfo.section_info = bfd_malloc (amt); + if (finfo.section_info == NULL) + goto error_return; + for (i = 0; i <= abfd->section_count; i++) + { + finfo.section_info[i].relocs = NULL; + finfo.section_info[i].rel_hashes = NULL; + finfo.section_info[i].toc_rel_hashes = NULL; + } + } + + /* Set the file positions for the relocs. */ + rel_filepos = obj_relocbase (abfd); + relsz = bfd_coff_relsz (abfd); + max_output_reloc_count = 0; + for (o = abfd->sections; o != NULL; o = o->next) + { + if (o->reloc_count == 0) + o->rel_filepos = 0; + else + { + /* A stripped file has no relocs. However, we still + allocate the buffers, so that later code doesn't have to + worry about whether we are stripping or not. */ + if (info->strip == strip_all) + o->rel_filepos = 0; + else + { + o->flags |= SEC_RELOC; + o->rel_filepos = rel_filepos; + rel_filepos += o->reloc_count * relsz; + } + + /* We don't know the indices of global symbols until we have + written out all the local symbols. For each section in + the output file, we keep an array of pointers to hash + table entries. Each entry in the array corresponds to a + reloc. When we find a reloc against a global symbol, we + set the corresponding entry in this array so that we can + fix up the symbol index after we have written out all the + local symbols. + + Because of this problem, we also keep the relocs in + memory until the end of the link. This wastes memory. + We could backpatch the file later, I suppose, although it + would be slow. */ + amt = o->reloc_count; + amt *= sizeof (struct internal_reloc); + finfo.section_info[o->target_index].relocs = bfd_malloc (amt); + + amt = o->reloc_count; + amt *= sizeof (struct xcoff_link_hash_entry *); + finfo.section_info[o->target_index].rel_hashes = bfd_malloc (amt); + + if (finfo.section_info[o->target_index].relocs == NULL + || finfo.section_info[o->target_index].rel_hashes == NULL) + goto error_return; + + if (o->reloc_count > max_output_reloc_count) + max_output_reloc_count = o->reloc_count; + } + } + + /* We now know the size of the relocs, so we can determine the file + positions of the line numbers. */ + line_filepos = rel_filepos; + finfo.line_filepos = line_filepos; + linesz = bfd_coff_linesz (abfd); + for (o = abfd->sections; o != NULL; o = o->next) + { + if (o->lineno_count == 0) + o->line_filepos = 0; + else + { + o->line_filepos = line_filepos; + line_filepos += o->lineno_count * linesz; + } + + /* Reset the reloc and lineno counts, so that we can use them to + count the number of entries we have output so far. */ + o->reloc_count = 0; + o->lineno_count = 0; + } + + obj_sym_filepos (abfd) = line_filepos; + + /* Figure out the largest number of symbols in an input BFD. Take + the opportunity to clear the output_has_begun fields of all the + input BFD's. We want at least 6 symbols, since that is the + number which xcoff_write_global_symbol may need. */ + max_sym_count = 6; + for (sub = info->input_bfds; sub != NULL; sub = sub->link_next) + { + bfd_size_type sz; + + sub->output_has_begun = FALSE; + sz = obj_raw_syment_count (sub); + if (sz > max_sym_count) + max_sym_count = sz; + } + + /* Allocate some buffers used while linking. */ + amt = max_sym_count * sizeof (struct internal_syment); + finfo.internal_syms = bfd_malloc (amt); + + amt = max_sym_count * sizeof (long); + finfo.sym_indices = bfd_malloc (amt); + + amt = (max_sym_count + 1) * symesz; + finfo.outsyms = bfd_malloc (amt); + + amt = max_lineno_count * bfd_coff_linesz (abfd); + finfo.linenos = bfd_malloc (amt); + + amt = max_contents_size; + finfo.contents = bfd_malloc (amt); + + amt = max_reloc_count * relsz; + finfo.external_relocs = bfd_malloc (amt); + + if ((finfo.internal_syms == NULL && max_sym_count > 0) + || (finfo.sym_indices == NULL && max_sym_count > 0) + || finfo.outsyms == NULL + || (finfo.linenos == NULL && max_lineno_count > 0) + || (finfo.contents == NULL && max_contents_size > 0) + || (finfo.external_relocs == NULL && max_reloc_count > 0)) + goto error_return; + + obj_raw_syment_count (abfd) = 0; + xcoff_data (abfd)->toc = (bfd_vma) -1; + + /* We now know the position of everything in the file, except that + we don't know the size of the symbol table and therefore we don't + know where the string table starts. We just build the string + table in memory as we go along. We process all the relocations + for a single input file at once. */ + for (o = abfd->sections; o != NULL; o = o->next) + { + for (p = o->map_head.link_order; p != NULL; p = p->next) + { + if (p->type == bfd_indirect_link_order + && p->u.indirect.section->owner->xvec == abfd->xvec) + { + sub = p->u.indirect.section->owner; + if (! sub->output_has_begun) + { + if (! xcoff_link_input_bfd (&finfo, sub)) + goto error_return; + sub->output_has_begun = TRUE; + } + } + else if (p->type == bfd_section_reloc_link_order + || p->type == bfd_symbol_reloc_link_order) + { + if (! xcoff_reloc_link_order (abfd, &finfo, o, p)) + goto error_return; + } + else + { + if (! _bfd_default_link_order (abfd, info, o, p)) + goto error_return; + } + } + } + + /* Free up the buffers used by xcoff_link_input_bfd. */ + if (finfo.internal_syms != NULL) + { + free (finfo.internal_syms); + finfo.internal_syms = NULL; + } + if (finfo.sym_indices != NULL) + { + free (finfo.sym_indices); + finfo.sym_indices = NULL; + } + if (finfo.linenos != NULL) + { + free (finfo.linenos); + finfo.linenos = NULL; + } + if (finfo.contents != NULL) + { + free (finfo.contents); + finfo.contents = NULL; + } + if (finfo.external_relocs != NULL) + { + free (finfo.external_relocs); + finfo.external_relocs = NULL; + } + + /* The value of the last C_FILE symbol is supposed to be -1. Write + it out again. */ + if (finfo.last_file_index != -1) + { + finfo.last_file.n_value = -(bfd_vma) 1; + bfd_coff_swap_sym_out (abfd, (void *) &finfo.last_file, + (void *) finfo.outsyms); + pos = obj_sym_filepos (abfd) + finfo.last_file_index * symesz; + if (bfd_seek (abfd, pos, SEEK_SET) != 0 + || bfd_bwrite (finfo.outsyms, symesz, abfd) != symesz) + goto error_return; + } + + /* Write out all the global symbols which do not come from XCOFF + input files. */ + xcoff_link_hash_traverse (xcoff_hash_table (info), + xcoff_write_global_symbol, + (void *) &finfo); + + if (finfo.outsyms != NULL) + { + free (finfo.outsyms); + finfo.outsyms = NULL; + } + + /* Now that we have written out all the global symbols, we know the + symbol indices to use for relocs against them, and we can finally + write out the relocs. */ + amt = max_output_reloc_count * relsz; + external_relocs = bfd_malloc (amt); + if (external_relocs == NULL && max_output_reloc_count != 0) + goto error_return; + + for (o = abfd->sections; o != NULL; o = o->next) + { + struct internal_reloc *irel; + struct internal_reloc *irelend; + struct xcoff_link_hash_entry **rel_hash; + struct xcoff_toc_rel_hash *toc_rel_hash; + bfd_byte *erel; + bfd_size_type rel_size; + + /* A stripped file has no relocs. */ + if (info->strip == strip_all) + { + o->reloc_count = 0; + continue; + } + + if (o->reloc_count == 0) + continue; + + irel = finfo.section_info[o->target_index].relocs; + irelend = irel + o->reloc_count; + rel_hash = finfo.section_info[o->target_index].rel_hashes; + for (; irel < irelend; irel++, rel_hash++, erel += relsz) + { + if (*rel_hash != NULL) + { + if ((*rel_hash)->indx < 0) + { + if (! ((*info->callbacks->unattached_reloc) + (info, (*rel_hash)->root.root.string, + NULL, o, irel->r_vaddr))) + goto error_return; + (*rel_hash)->indx = 0; + } + irel->r_symndx = (*rel_hash)->indx; + } + } + + for (toc_rel_hash = finfo.section_info[o->target_index].toc_rel_hashes; + toc_rel_hash != NULL; + toc_rel_hash = toc_rel_hash->next) + { + if (toc_rel_hash->h->u.toc_indx < 0) + { + if (! ((*info->callbacks->unattached_reloc) + (info, toc_rel_hash->h->root.root.string, + NULL, o, toc_rel_hash->rel->r_vaddr))) + goto error_return; + toc_rel_hash->h->u.toc_indx = 0; + } + toc_rel_hash->rel->r_symndx = toc_rel_hash->h->u.toc_indx; + } + + /* XCOFF requires that the relocs be sorted by address. We tend + to produce them in the order in which their containing csects + appear in the symbol table, which is not necessarily by + address. So we sort them here. There may be a better way to + do this. */ + qsort ((void *) finfo.section_info[o->target_index].relocs, + o->reloc_count, sizeof (struct internal_reloc), + xcoff_sort_relocs); + + irel = finfo.section_info[o->target_index].relocs; + irelend = irel + o->reloc_count; + erel = external_relocs; + for (; irel < irelend; irel++, rel_hash++, erel += relsz) + bfd_coff_swap_reloc_out (abfd, (void *) irel, (void *) erel); + + rel_size = relsz * o->reloc_count; + if (bfd_seek (abfd, o->rel_filepos, SEEK_SET) != 0 + || bfd_bwrite ((void *) external_relocs, rel_size, abfd) != rel_size) + goto error_return; + } + + if (external_relocs != NULL) + { + free (external_relocs); + external_relocs = NULL; + } + + /* Free up the section information. */ + if (finfo.section_info != NULL) + { + unsigned int i; + + for (i = 0; i < abfd->section_count; i++) + { + if (finfo.section_info[i].relocs != NULL) + free (finfo.section_info[i].relocs); + if (finfo.section_info[i].rel_hashes != NULL) + free (finfo.section_info[i].rel_hashes); + } + free (finfo.section_info); + finfo.section_info = NULL; + } + + /* Write out the loader section contents. */ + BFD_ASSERT ((bfd_byte *) finfo.ldrel + == (xcoff_hash_table (info)->loader_section->contents + + xcoff_hash_table (info)->ldhdr.l_impoff)); + o = xcoff_hash_table (info)->loader_section; + if (! bfd_set_section_contents (abfd, o->output_section, o->contents, + (file_ptr) o->output_offset, o->size)) + goto error_return; + + /* Write out the magic sections. */ + o = xcoff_hash_table (info)->linkage_section; + if (o->size > 0 + && ! bfd_set_section_contents (abfd, o->output_section, o->contents, + (file_ptr) o->output_offset, + o->size)) + goto error_return; + o = xcoff_hash_table (info)->toc_section; + if (o->size > 0 + && ! bfd_set_section_contents (abfd, o->output_section, o->contents, + (file_ptr) o->output_offset, + o->size)) + goto error_return; + o = xcoff_hash_table (info)->descriptor_section; + if (o->size > 0 + && ! bfd_set_section_contents (abfd, o->output_section, o->contents, + (file_ptr) o->output_offset, + o->size)) + goto error_return; + + /* Write out the string table. */ + pos = obj_sym_filepos (abfd) + obj_raw_syment_count (abfd) * symesz; + if (bfd_seek (abfd, pos, SEEK_SET) != 0) + goto error_return; + H_PUT_32 (abfd, + _bfd_stringtab_size (finfo.strtab) + STRING_SIZE_SIZE, + strbuf); + amt = STRING_SIZE_SIZE; + if (bfd_bwrite (strbuf, amt, abfd) != amt) + goto error_return; + if (! _bfd_stringtab_emit (abfd, finfo.strtab)) + goto error_return; + + _bfd_stringtab_free (finfo.strtab); + + /* Write out the debugging string table. */ + o = xcoff_hash_table (info)->debug_section; + if (o != NULL) + { + struct bfd_strtab_hash *debug_strtab; + + debug_strtab = xcoff_hash_table (info)->debug_strtab; + BFD_ASSERT (o->output_section->size - o->output_offset + >= _bfd_stringtab_size (debug_strtab)); + pos = o->output_section->filepos + o->output_offset; + if (bfd_seek (abfd, pos, SEEK_SET) != 0) + goto error_return; + if (! _bfd_stringtab_emit (abfd, debug_strtab)) + goto error_return; + } + + /* Setting bfd_get_symcount to 0 will cause write_object_contents to + not try to write out the symbols. */ + bfd_get_symcount (abfd) = 0; + + return TRUE; + + error_return: + if (finfo.strtab != NULL) + _bfd_stringtab_free (finfo.strtab); + + if (finfo.section_info != NULL) + { + unsigned int i; + + for (i = 0; i < abfd->section_count; i++) + { + if (finfo.section_info[i].relocs != NULL) + free (finfo.section_info[i].relocs); + if (finfo.section_info[i].rel_hashes != NULL) + free (finfo.section_info[i].rel_hashes); + } + free (finfo.section_info); + } + + if (finfo.internal_syms != NULL) + free (finfo.internal_syms); + if (finfo.sym_indices != NULL) + free (finfo.sym_indices); + if (finfo.outsyms != NULL) + free (finfo.outsyms); + if (finfo.linenos != NULL) + free (finfo.linenos); + if (finfo.contents != NULL) + free (finfo.contents); + if (finfo.external_relocs != NULL) + free (finfo.external_relocs); + if (external_relocs != NULL) + free (external_relocs); + return FALSE; } - - - - diff --git a/contrib/binutils/binutils/ChangeLog b/contrib/binutils/binutils/ChangeLog index 185b21b9492..2f6520f4420 100644 --- a/contrib/binutils/binutils/ChangeLog +++ b/contrib/binutils/binutils/ChangeLog @@ -1,132 +1,267 @@ -2004-05-13 Nick Clifton +2006-08-15 Nick Clifton + + PR binutils/3039 + * wrstabs.c (stab_tag_type): Initialize 'size'. + +2006-06-07 Joseph S. Myers + + * po/Make-in (pdf, ps): New dummy targets. + +2006-06-02 Joseph S. Myers + + * doc/Makefile.am (TEXI2DVI): Define. + * doc/Makefile.in: Regenerate. + +2006-06-01 Daniel Jacobowitz + + Backport: + 2006-05-19 Andreas Schwab + * doc/Makefile.am (addr2line.1): Depend on $(binutils_TEXINFOS). + (ar.1): Likewise. + (dlltool.1): Likewise. + (nlmconv.1): Likewise. + (nm.1): Likewise. + (objcopy.1): Likewise. + (objdump.1): Likewise. + (ranlib.1): Likewise. + (readelf.1): Likewise. + (size.1): Likewise. + (strings.1): Likewise. + (strip.1): Likewise. + (windres.1): Likewise. + (cxxfilt.man): Likewise. + * doc/Makefile.in: Regenerated. + +2006-05-30 Nick Clifton + + * po/es.po: Updated Spanish translation. + +2006-05-24 Nick Clifton * po/fr.po: Updated French translation. -2004-04-09 Daniel Jacobowitz +2006-05-23 Nick Clifton - Merge from mainline: - 2004-04-07 Benjamin Monate - PR 86 - * arsup.c (ar_save): Use smart_rename. + * po/vi.po: Updated Vietnamese translation. - 2004-04-01 Dean Luick - * readelf.c (display_debug_pubnames): Align offset and data - columns. - (read_and_display_attr_value): Add missing break; - (debug_displays): Enable the display of the .debug_pubtypes - section. +2006-05-22 Daniel Jacobowitz - 2004-03-21 Richard Henderson - * readelf.c (display_debug_frames): Don't crash for mismatched - DW_CFA_restore_state. + * po/ru.po: Updated translation. - 2004-03-10 Ben Elliston - * MAINTAINERS: Update my mail address. +2006-05-02 Daniel Jacobowitz - 2004-03-08 Danny Smith - * deflex.l: Handle "PRIVATE" string. - * defparse.y (%token): Add PRIVATE. - (%type): Add opt_PRIVATE. - (expline): Pass opt_PRIVATE to def_exports. - (opt_PRIVATE): Handle PRIVATE token. - * dlltool.h (def_exports): Add 7th param for private flag to - declaration. - * dlltool.c: Add PRIVATE to comment on EXPORTS syntax. - (struct export): Add 'private' field. - (def_exports): Set 'private' field of struct exports. - (scan_drectve_symbols): Adjust calls to def_exports. - (scan_filtered_symbols): Likewise. - (dump_def_info): Print 'private' field. - (gen_def_file): Likewise. - (gen_lib_file): Skip generation of lib object if private. - Delete tmp object files in same order as they were generated. - Don't delete non-existent private object files. + * doc/Makefile.am (AM_MAKEINFOFLAGS): New. + (TEXI2POD): Use AM_MAKEINFOFLAGS. + (config.texi): Don't set top_srcdir. + * doc/binutils.texi: Don't use top_srcdir. + * aclocal.m4, Makefile.in, doc/Makefile.in: Regenerated. - 2004-02-27 Andreas Schwab - * ar.c (main): Support POSIX-compatible argument parsing. +2006-04-12 Nick Clifton - 2004-02-23 Daniel Lucq - * readelf.c (process_mips_specific): Print conflictsno as an - unsigned long. + * objdump.c (objdump_symbol_at_address): Fix typo in comment. - 2004-02-21 Dmitry Timoshkov - * dlltool.c (gen_exp_file): Always output names for forwarded symbols. +2006-04-10 Ben Elliston - 2004-02-19 Jakub Jelinek - * objcopy.c (copy_section): Avoid warnings. + * MAINTAINERS (CGEN Maintainers): Remove myself. -2004-02-14 Andrew Cagney +2006-04-06 Carlos O'Donell - * ar.c (remove_output): Use bfd_cache_close. - * arsup.c (ar_end): Ditto. + * po/Make-in: Add install-html target. + * Makefile.am: Add install-html and install-html-recursive targets. + * Makefile.in: Regenerate. + * configure.in: AC_SUBST datarootdir, docdir and htmldir. + * configure: Regenerate. + * doc/Makefile.am: Add install-html and install-html-am targets. + * doc/Makefile.in: Regenerate. -2004-01-21 Roland McGrath +2006-04-05 Eric Botcazou - * readelf.c (get_note_type): Match NT_AUXV. + * addr2line.c (long_options): Add new option 'section'. + (usage): Document new -j/--section option. + (find_offset_in_section): New function. + (translate_addresses): Add 'section' parameter. + If it is non-null, call find_offset_in_section on it. + (process_file): Add 'section_name' parameter. + If it is non-null, look for the section in the BFD object. + Pass the section to translate_addresses. + (main): Handle new -j option. + Pass the section name to process_file. + * doc/binutils.texi (addr2line): Document new -j/--section option. -2004-01-20 Nick Clifton +2006-03-29 Ben Elliston - * version.c (print_version): Update copyright year to 2004. + * resbin.c: Avoid duplicating constants in calls to reswr_alloc. -2004-01-14 Maciej W. Rozycki +2006-03-20 Nathan Sidwell - * acinclude.m4: Quote names of macros to be defined by AC_DEFUN - throughout. - * aclocal.m4: Regenerate. + * BRANCHES: Remove binutils-csl-arm-2006q1-branch. Document + binutils-csl-2_17-branch instead. + +2006-03-20 Paul Brook + + * BRANCHES: Mention binutils-csl-arm-2006q1-branch. + +2006-03-16 Alan Modra + + PR 2434 + * ieee.c (write_ieee_debugging_info): Adjust bfd_hash_table_init calls. + * wrstabs.c (write_stabs_in_sections_debugging_info): Likewise. + +2006-03-13 Ben Elliston + + * bucomm.c (display_target_list): Make local variable `a' to be of + type enum bfd_architecture. Thus no need to cast enums to int. + (display_info_table): Likewise. + +2006-03-10 Paul Brook + + * readelf.c (decode_ARM_machine_flags): Handle EABIv5. + +2006-03-10 Alan Modra + + * dwarf.c (process_extended_line_op): Remove pointer_size param. + Use length instead to determine address size. + (get_pointer_size_and_offset_of_comp_unit): Delete. + (display_debug_lines): Adjust for above. + (display_debug_aranges): Don't stop on finding two zeros. + (display_debug_frames): For warning, print offset not pointer. + +2006-03-09 Danny Smith + + * dlltool.c: Update copyright year. + * doc/binutils.texi: Likewise. + +2006-03-09 Danny Smith + + * dlltool.c (add_stdcall_underscore): New flag. + (xlate): Also add underscore to stdcall symbol if + add_stdcall_underscore set. + (usage): Document --add-stdcall-underscore option. + (OPTION_ADD_STDCALL_UNDERSCORE): New define. + (long_options): Use it for --add-stdcall-underscore option. + (main): Handle it. + * doc/binutils.texi: Document --add-stdcall-underscore option + and differentiate from --add-underscore. + +2006-03-06 Nathan Sidwell + + * readelf.c (get_machine_flags): Adjust. + +2006-03-03 Jakub Jelinek + + * dwarf.c (frame_display_row, display_debug_frames): Handle + DW_CFA_val_offset, DW_CFA_val_offset_sf and DW_CFA_val_expression. + +2006-02-28 Nick Clifton + + * objcopy.c (use_alt_mach_code): Change type to unsigned long. + (copy_object): If bfd_alt_mach_code fails emit a more helpful + message and if the target architecture is ELF use the alternative + as replacement value for the e_machine number. + (copy_main): Use strtoul to parse the number provided with the + --alt-mach-code switch. + * doc/binutils.texi (--alt-mach-code): Document that this switch + can now set the absolute e_machine value. + +2006-02-27 Carlos O'Donell + + * po/Make-in: Add html target. + +2006-02-17 Nick Hudson + + * readelf.c (get_machine_flags): Add logic for missing EF_SH flags. + +2006-02-14 Jakub Jelinek + + * config.in: Rebuilt. + +2006-02-10 H.J. Lu + + PR binutils/2258 + * readelf.c (process_program_headers): Use + ELF_IS_SECTION_IN_SEGMENT_MEMORY. + +2006-02-09 Eric Botcazou + + * configure.in (CHECK_DECLS): Add snprintf and vsnprintf. + * configure: Regenerate. + * objdump.c (fprintf): Remove declaration. + * bucomm.h (fprintf): Declare if not already declared. + (snprintf): Likewise. + (vsnprintf): Likewise. + +2006-02-08 H.J. Lu + + * readelf.c (process_program_headers): Match PT_TLS segment + only with SHT_TLS sections. + +2006-02-07 Nathan Sidwell + + * readelf.c (get_machine_flags): Add logic for EF_M68K flags. + +2006-02-02 H.J. Lu + + * readelf.c (process_program_headers): Undo the last change. + +2006-02-02 H.J. Lu + + * readelf.c (process_program_headers): Undo the change made on + 2004-09-22. Match PT_DYNAMIC segment only with SHT_DYNAMIC + sections. + +2006-01-30 Nick Clifton + + * objcopy.c (copy_object): Catch the case where an attempt is made + to add a section that already exists and produce a more helpful + warning message. + +2006-01-26 Nick Clifton + + * po/vi.po: New Vietnamese translation. + * configure.in (ALL_LINGUAS): Add vi. * configure: Regenerate. -2004-01-12 Jakub Jelinek +2006-01-18 Alexandre Oliva - * objcopy.c: Include elf-bfd.h. - (is_strip_section): Don't strip debugging sections if - STRIP_NONDEBUG. - (setup_section): If STRIP_NONDEBUG make SEC_ALLOC sections - ~(SEC_LOAD | SEC_HAS_CONTENTS) and on ELF targets also SHT_NOBITS. + Introduce TLS descriptors for i386 and x86_64. + * readelf.c (get_dynamic_type): Handle DT_TLSDESC_GOT and + DT_TLSDESC_PLT. - * objcopy.c (copy_section): Free relpp if relcount == 0. +2006-01-18 Nick Clifton -2004-01-12 Ian Lance Taylor + PR binutils/1391 + * objcopy.c (copy_object): For PE format targets set the VMA of a + newly created gnu_debuglink section to a non-zero, aligned, + contiguous value. + * Makefile.am (objcopy.c): Add a dependency upon libbfd.h. + * Makefile.in: Regenerate. - * stabs.c (parse_stab_argtypes): Handle g++ ABI version 3 names. - (stab_demangle_argtypes): Likewise. - (stab_demangle_v3_argtypes): New static function. - (stab_demangle_v3_arg): New static function. +2006-01-17 Andreas Schwab -2004-01-12 Nick Clifton - - * objcopy.c (copy_object): Make the function boolean, returning - FALSE upon failure. - (copy_archive): Handle the return value from copy_object. - (copy_file): Likewise. - -2004-01-07 Nick Clifton - - * readelf.c (find_section): New function. Locates a named - section. - (get_debug_line_pointer_sizes): New function: Initialises the - debug_line_pointer_sizes array. - (display_debug_lines): Call get_debug_line_pointer_sizes. - (display_debug_loc): Likewise. - (load_debug_loc): Use find_section. - (load_debug_str): Likewise. - (display_debug_info): Likewise. - (prescan_debug_info): Delete. - (debug_displays): Remove prescan field. - (process_section_contents): Do not perform prescans. - -2004-01-03 Alan Modra - - * objcopy.c (filter_bytes): Delete. Move code to.. - (copy_section): ..here. Simplify size adjustment. Divide - section lma by interleave. - -2004-01-02 Nick Clifton - - * po/ru.po: New file: Russian translation. - * configure.in (ALL_LINGUAS): Add ru + PR binutils/1486 + * configure.in: Don't define DISASSEMBLER_NEEDS_RELOCS. * configure: Regenerate. + * objdump.c (struct objdump_disasm_info): Don't check for + DISASSEMBLER_NEEDS_RELOCS. + (objdump_print_addr): Likewise. + (disassemble_bytes): Check disassembler_needs_relocs from + disassemble_info at run-time instead of DISASSEMBLER_NEEDS_RELOCS + at compile-time. + (disassemble_section): Likewise. + (disassemble_data): Initialize it. -For older changes see ChangeLog-0203 +2006-01-11 Alan Modra + + * objcopy.c (copy_object): Fix thinko. + + * objcopy.c (copy_object): Set isympp and osympp to NULL after free. + +2006-01-09 Mike Frysinger : + + * readelf.c (guess_is_rela): Add case for Nios/Nios II. + (get_machine_name): Likewise. + +For older changes see ChangeLog-2005 Local Variables: mode: change-log diff --git a/contrib/binutils/binutils/MAINTAINERS b/contrib/binutils/binutils/MAINTAINERS index 28c9144e1cc..f5beb0343b4 100644 --- a/contrib/binutils/binutils/MAINTAINERS +++ b/contrib/binutils/binutils/MAINTAINERS @@ -22,8 +22,8 @@ top level config.guess and config.sub scripts should be sent to: config-patches@gnu.org and not to the binutils lists. Patches to the other top level -configure files (configure, configure.in, config-if, config-ml.in) -should be sent to the binutils lists, and copied to the gcc and gdb +configure files (configure, configure.in, config-ml.in) should +be sent to the binutils lists, and copied to the gcc and gdb lists as well (gcc-patches@gcc.gnu.org and gdb-patches@sources.redhat.com). @@ -34,12 +34,13 @@ repository without obtaining approval first: Nick Clifton (head maintainer) Richard Henderson - Ian Taylor + Ian Lance Taylor Jeff Law Jim Wilson DJ Delorie Alan Modra Michael Meissner + Daniel Jacobowitz --------- Maintainers --------- @@ -57,14 +58,22 @@ responsibility among the other maintainers. ALPHA Richard Henderson ARM Nick Clifton ARM Richard Earnshaw + ARM (Symbian) Paul Brook + ARM (Symbian) Mark Mitchell AVR Denis Chertykov AVR Marek Michalkiewicz + BFIN Jie Zhang + BFIN Bernd Schmidt BUILD SYSTEM Ben Elliston BUILD SYSTEM Daniel Jacobowitz CRIS Hans-Peter Nilsson + CRX Tomer Levi + DLX Nikolaos Kavvadias DWARF2 Jason Merrill FR30 Dave Brolley FRV Dave Brolley + FRV Alexandre Oliva + H8300 Anil Paranjpe HPPA Dave Anglin HPPA elf32 Alan Modra HPPA elf64 Jeff Law [Basic maintainance only] @@ -75,14 +84,17 @@ responsibility among the other maintainers. ix86 PE Christopher Faylor ix86 COFF DJ Delorie ix86 H.J.Lu - ix86 INTEL MODE Diego Novillo + ix86 INTEL MODE Jan Beulich M68HC11 M68HC12 Stephane Carrez M68k Ben Elliston - MIPS Eric Christopher - MIPS Thiemo Seufer + M88k Mark Kettenis + MAXQ Inderpreet Singh + MIPS Eric Christopher + MIPS Thiemo Seufer MMIX Hans-Peter Nilsson - MN10300 Eric Christopher + MN10300 Eric Christopher MN10300 Alexandre Oliva + MSP430 Dmitry Diky PPC Geoff Keating PPC vector ext Aldy Hernandez s390, s390x Martin Schwidefsky @@ -91,12 +103,15 @@ responsibility among the other maintainers. SH Kaz Kojima SPARC Jakub Jelinek TESTSUITES Ben Elliston - TIC4X Svein Seldal + TIC4X Svein Seldal TIC54X Timothy Wall - VAX Jason R Thorpe + VAX Jason R Thorpe + VAX Jan-Benedict Glaw x86_64 Jan Hubicka x86_64 Andreas Jaeger + x86_64 H.J.Lu Xtensa Bob Wilson + z80 Arnold Metselaar z8k Christian Groessler @@ -114,7 +129,7 @@ If you have CGEN related problems you can send email to; The current CGEN maintainers are: - Doug Evans, Ben Elliston, Frank Eigler + Doug Evans, Frank Eigler --------- Write After Approval --------- @@ -166,3 +181,71 @@ by the binutils group. Instead they should be submitted to the config maintainer at: config-patches@gnu.org + + --------- Creating Branches --------- + +Anyone with at least write-after-approval access may create a branch +to use for their own development purposes. In keeping with FSF +policies, all patches applied to such a branch must come from people +with appropriate copyright assignments on file. All legal +requirements that would apply to any other contribution apply equally +to contributions on a branch. + +Before creating the branch, you should select a name for the branch of +the form: + + binutils-- + +where "org" is the initials of your organization, or your own initials +if you are acting as an individual. For example, for a branch created +by The GNUDist Company, "tgc" would be an appropriate choice for +"org". It's up to each organization to select an appropriate choice +for "name"; some organizations may use more structure than others, so +"name" may contain additional hyphens. + +Suppose that The GNUDist Company was creating a branch to develop a +port of Binutils to the FullMonty processor. Then, an appropriate +choice of branch name would be: + + binutils-tgc-fm + +A data stamp is not required as part of the name field, but some +organizations like to have one. If you do include the date, you +should follow these rules: + +1. The date should be the date that the branch was created. + +2. The date should be numerical and in the form YYYYMMDD. + +For example: + + binutils-tgc-fm_20050101 + +would be appropriate if the branch was created on January 1st, 2005. + +Having selected the branch name, create the branch as follows: + +1. Check out binutils, so that you have a CVS checkout corresponding + to the initial state of your branch. + +2. Create a tag: + + cvs tag binutils---branchpoint + + That tag will allow you, and others, to easily determine what's + changed on the branch relative to the initial state. + +3. Create the branch: + + cvs rtag -b -r binutils---branchpoint \ + binutils---branch + +4. Document the branch: + + Add a description of the branch to binutils/BRANCHES, and check + that file in. All branch descriptions should be added to the + HEAD revision of the file; it doesn't help to modify + binutils/BRANCHES on a branch! + +Please do not commit any patches to a branch you did not create +without the explicit permission of the person who created the branch. diff --git a/contrib/binutils/binutils/Makefile.am b/contrib/binutils/binutils/Makefile.am index 324c0ea0645..1b4e85adb8a 100644 --- a/contrib/binutils/binutils/Makefile.am +++ b/contrib/binutils/binutils/Makefile.am @@ -20,6 +20,7 @@ YFLAGS = -d LEX = `if [ -f ../flex/flex ]; then echo ../flex/flex; else echo @LEX@; fi` WARN_CFLAGS = @WARN_CFLAGS@ +NO_WERROR = @NO_WERROR@ AM_CFLAGS = $(WARN_CFLAGS) # these two are almost the same program @@ -63,7 +64,7 @@ noinst_PROGRAMS = $(NM_PROG) $(STRIP_PROG) $(DEMANGLER_PROG) EXTRA_PROGRAMS = $(NLMCONV_PROG) srconv sysdump coffdump $(DLLTOOL_PROG) $(WINDRES_PROG) $(DLLWRAP_PROG) # Stuff that goes in tooldir/ if appropriate. -TOOL_PROGS = nm-new strip-new ar ranlib dlltool +TOOL_PROGS = nm-new strip-new ar ranlib dlltool objdump BASEDIR = $(srcdir)/.. BFDDIR = $(BASEDIR)/bfd @@ -75,7 +76,7 @@ INCLUDES = -D_GNU_SOURCE \ -I. -I$(srcdir) -I../bfd -I$(BFDDIR) -I$(INCDIR) \ @HDEFINES@ \ -I$(srcdir)/../intl -I../intl \ - -DLOCALEDIR="\"$(prefix)/share/locale\"" \ + -DLOCALEDIR="\"$(datadir)/locale\"" \ -Dbin_dummy_emulation=$(EMULATION_VECTOR) HFILES = \ @@ -87,7 +88,8 @@ GENERATED_HFILES = arparse.h sysroff.h sysinfo.h defparse.h rcparse.h CFILES = \ addr2line.c ar.c arsup.c binemul.c bucomm.c budemang.c \ - coffdump.c coffgrok.c cxxfilt.c debug.c dlltool.c dllwrap.c \ + coffdump.c coffgrok.c cxxfilt.c \ + dwarf.c debug.c dlltool.c dllwrap.c \ emul_aix.c emul_vanilla.c filemode.c \ ieee.c is-ranlib.c is-strip.c maybe-ranlib.c maybe-strip.c \ nlmconv.c nm.c not-ranlib.c not-strip.c \ @@ -113,17 +115,42 @@ OPCODES = ../opcodes/libopcodes.la LIBIBERTY = ../libiberty/libiberty.a +.PHONY: install-html install-html-am install-html-recursive + +install-html: install-html-recursive + +install-html-recursive: + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + POTFILES = $(CFILES) $(DEBUG_SRCS) $(HFILES) po/POTFILES.in: @MAINT@ Makefile for f in $(POTFILES); do echo $$f; done | LC_COLLATE= sort > tmp \ && mv tmp $(srcdir)/po/POTFILES.in -EXPECT = `if [ -f $$r/../expect/expect ] ; then \ - echo $$r/../expect/expect ; \ - else echo expect ; fi` -RUNTEST = `if [ -f ${srcdir}/../dejagnu/runtest ] ; then \ - echo ${srcdir}/../dejagnu/runtest ; \ - else echo runtest ; fi` +EXPECT = expect +RUNTEST = runtest CC_FOR_TARGET = ` \ if [ -f $$r/../gcc/xgcc ] ; then \ @@ -144,10 +171,6 @@ check-DEJAGNU: site.exp srcdir=`cd $(srcdir) && pwd`; export srcdir; \ r=`pwd`; export r; \ EXPECT=$(EXPECT); export EXPECT; \ - if [ -f $(top_builddir)/../expect/expect ]; then \ - TCL_LIBRARY=`cd $(top_srcdir)/../tcl/library && pwd`; \ - export TCL_LIBRARY; \ - fi; \ runtest=$(RUNTEST); \ if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \ CC_FOR_TARGET="$(CC_FOR_TARGET)" CFLAGS_FOR_TARGET="$(CFLAGS)" \ @@ -167,14 +190,14 @@ objcopy_SOURCES = objcopy.c not-strip.c rename.c $(WRITE_DEBUG_SRCS) $(BULIBS) strings_SOURCES = strings.c $(BULIBS) -readelf_SOURCES = readelf.c version.c unwind-ia64.c +readelf_SOURCES = readelf.c version.c unwind-ia64.c dwarf.c readelf_LDADD = $(INTLLIBS) $(LIBIBERTY) strip_new_SOURCES = objcopy.c is-strip.c rename.c $(WRITE_DEBUG_SRCS) $(BULIBS) nm_new_SOURCES = nm.c budemang.c $(BULIBS) -objdump_SOURCES = objdump.c budemang.c prdbg.c $(DEBUG_SRCS) $(BULIBS) +objdump_SOURCES = objdump.c dwarf.c budemang.c prdbg.c $(DEBUG_SRCS) $(BULIBS) objdump_LDADD = $(OPCODES) $(BFDLIB) $(LIBIBERTY) $(INTLLIBS) objdump.o:objdump.c @@ -219,20 +242,20 @@ sysroff.h: sysinfo$(EXEEXT_FOR_BUILD) sysroff.info ./sysinfo$(EXEEXT_FOR_BUILD) -d <$(srcdir)/sysroff.info >sysroff.h sysinfo$(EXEEXT_FOR_BUILD): sysinfo.o syslex.o - $(CC_FOR_BUILD) $(CFLAGS) $(LDFLAGS) -o $@ sysinfo.o syslex.o + $(CC_FOR_BUILD) $(CFLAGS) $(LDFLAGS) -o $@ sysinfo.o syslex.o -syslex.o: syslex.c sysinfo.h +syslex.o: if [ -r syslex.c ]; then \ - $(CC_FOR_BUILD) -c -I. $(CFLAGS) syslex.c ; \ + $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS) syslex.c -Wno-error ; \ else \ - $(CC_FOR_BUILD) -c -I. -I$(srcdir) $(CFLAGS) $(srcdir)/syslex.c ;\ + $(CC_FOR_BUILD) -c -I. -I$(srcdir) $(AM_CFLAGS) $(CFLAGS) $(srcdir)/syslex.c -Wno-error ;\ fi -sysinfo.o: sysinfo.c +sysinfo.o: if [ -r sysinfo.c ]; then \ - $(CC_FOR_BUILD) -c -I. $(CFLAGS) sysinfo.c ; \ + $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS) sysinfo.c -Wno-error ; \ else \ - $(CC_FOR_BUILD) -c -I. $(CFLAGS) $(srcdir)/sysinfo.c ; \ + $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS) $(srcdir)/sysinfo.c -Wno-error ; \ fi # We need these for parallel make. @@ -242,15 +265,34 @@ nlmheader.h: nlmheader.c rcparse.h: rcparse.c sysinfo.h: sysinfo.c +# Disable -Werror, if it has been enabled, since old versions of bison/ +# yacc will produce working code which contain compile time warnings. +arparse.o: + $(COMPILE) -c $< $(NO_WERROR) +arlex.o: + $(COMPILE) -c $< $(NO_WERROR) +sysroff.o: + $(COMPILE) -c $< $(NO_WERROR) +defparse.o: + $(COMPILE) -c $< $(NO_WERROR) +deflex.o: + $(COMPILE) -c $< $(NO_WERROR) +nlmheader.o: + $(COMPILE) -c $< $(NO_WERROR) +rcparse.o: + $(COMPILE) -c $< $(NO_WERROR) +rclex.o: + $(COMPILE) -c $< $(NO_WERROR) + srconv_SOURCES = srconv.c coffgrok.c $(BULIBS) dlltool_SOURCES = dlltool.c defparse.y deflex.l $(BULIBS) dlltool_LDADD = $(BFDLIB) $(LIBIBERTY) @LEXLIB@ $(INTLLIBS) -dlltool.o:dlltool.c +dlltool.o: $(COMPILE) -c $(DLLTOOL_DEFS) $(srcdir)/dlltool.c -rescoff.o:rescoff.c +rescoff.o: $(COMPILE) -c $(DLLTOOL_DEFS) $(srcdir)/rescoff.c coffdump_SOURCES = coffdump.c coffgrok.c $(BULIBS) @@ -277,12 +319,11 @@ EXTRA_DIST = arparse.c arparse.h arlex.c nlmheader.c sysinfo.c sysinfo.h \ syslex.c deflex.c defparse.h defparse.c rclex.c rcparse.h rcparse.c diststuff: $(EXTRA_DIST) info +all: info DISTCLEANFILES = sysinfo sysroff.c sysroff.h \ site.exp site.bak -Makefile: $(BFDDIR)/configure.in - # Targets to rebuild dependencies in this Makefile. # Have to get rid of DEP1 here so that "$?" later includes all of $(CFILES). DEP: dep.sed $(CFILES) $(HFILES) $(GENERATED_CFILES) $(GENERATED_HFILES) config.h @@ -363,15 +404,15 @@ install-exec-local: install-binPROGRAMS $(bin_PROGRAMS) $(noinst_PROGRAMS) # DO NOT DELETE THIS LINE -- mkdep uses it. # DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. -addr2line.o: addr2line.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ +addr2line.o: addr2line.c config.h ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h $(INCDIR)/getopt.h $(INCDIR)/libiberty.h \ - $(INCDIR)/demangle.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/demangle.h bucomm.h $(INCDIR)/bin-bugs.h \ $(INCDIR)/fopen-same.h budemang.h ar.o: ar.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \ $(INCDIR)/libiberty.h $(INCDIR)/progress.h bucomm.h \ config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/aout/ar.h $(BFDDIR)/libbfd.h arsup.h $(INCDIR)/filenames.h \ - binemul.h + $(INCDIR)/aout/ar.h $(BFDDIR)/libbfd.h $(INCDIR)/hashtab.h \ + arsup.h $(INCDIR)/filenames.h binemul.h arsup.o: arsup.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h arsup.h $(INCDIR)/libiberty.h bucomm.h \ config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ @@ -382,7 +423,7 @@ binemul.o: binemul.c binemul.h ../bfd/bfd.h $(INCDIR)/ansidecl.h \ bucomm.o: bucomm.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h ../bfd/bfdver.h $(INCDIR)/libiberty.h \ bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/filenames.h $(BFDDIR)/libbfd.h + $(INCDIR)/filenames.h $(BFDDIR)/libbfd.h $(INCDIR)/hashtab.h budemang.o: budemang.c config.h ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h $(INCDIR)/libiberty.h $(INCDIR)/demangle.h \ budemang.h @@ -396,6 +437,10 @@ coffgrok.o: coffgrok.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ cxxfilt.o: cxxfilt.c config.h ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h bucomm.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ $(INCDIR)/libiberty.h $(INCDIR)/demangle.h $(INCDIR)/safe-ctype.h +dwarf.o: dwarf.c dwarf.h ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/symcat.h $(INCDIR)/elf/dwarf2.h bucomm.h \ + config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/libiberty.h debug.o: debug.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h debug.h @@ -440,13 +485,15 @@ not-strip.o: not-strip.c objcopy.o: objcopy.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h $(INCDIR)/progress.h bucomm.h config.h \ $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ - budbg.h $(INCDIR)/filenames.h $(INCDIR)/fnmatch.h + budbg.h $(INCDIR)/filenames.h $(INCDIR)/fnmatch.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(BFDDIR)/libbfd.h objdump.o: objdump.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h ../bfd/bfdver.h $(INCDIR)/progress.h \ bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ - budemang.h $(INCDIR)/safe-ctype.h $(INCDIR)/dis-asm.h \ - $(INCDIR)/libiberty.h $(INCDIR)/demangle.h debug.h \ - budbg.h $(INCDIR)/aout/aout64.h + dwarf.h $(INCDIR)/elf/dwarf2.h budemang.h $(INCDIR)/safe-ctype.h \ + $(INCDIR)/dis-asm.h $(INCDIR)/libiberty.h $(INCDIR)/demangle.h \ + debug.h budbg.h $(INCDIR)/aout/aout64.h prdbg.o: prdbg.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h debug.h \ @@ -460,24 +507,25 @@ rddbg.o: rddbg.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h debug.h \ budbg.h -readelf.o: readelf.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/symcat.h $(INCDIR)/elf/common.h $(INCDIR)/elf/external.h \ - $(INCDIR)/elf/internal.h $(INCDIR)/elf/dwarf2.h $(INCDIR)/elf/alpha.h \ +readelf.o: readelf.c dwarf.h ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/symcat.h $(INCDIR)/elf/dwarf2.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/external.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/alpha.h \ $(INCDIR)/elf/reloc-macros.h $(INCDIR)/elf/arc.h $(INCDIR)/elf/arm.h \ - $(INCDIR)/elf/avr.h $(INCDIR)/elf/cris.h $(INCDIR)/elf/d10v.h \ - $(INCDIR)/elf/d30v.h $(INCDIR)/elf/dlx.h $(INCDIR)/elf/fr30.h \ - $(INCDIR)/elf/frv.h $(INCDIR)/elf/h8.h $(INCDIR)/elf/hppa.h \ - $(INCDIR)/elf/i386.h $(INCDIR)/elf/i370.h $(INCDIR)/elf/i860.h \ - $(INCDIR)/elf/i960.h $(INCDIR)/elf/ia64.h $(INCDIR)/elf/ip2k.h \ - $(INCDIR)/elf/m32r.h $(INCDIR)/elf/m68k.h $(INCDIR)/elf/m68hc11.h \ - $(INCDIR)/elf/mcore.h $(INCDIR)/elf/mips.h $(INCDIR)/elf/mmix.h \ - $(INCDIR)/elf/mn10200.h $(INCDIR)/elf/mn10300.h $(INCDIR)/elf/msp430.h \ + $(INCDIR)/elf/avr.h $(INCDIR)/elf/bfin.h $(INCDIR)/elf/cris.h \ + $(INCDIR)/elf/d10v.h $(INCDIR)/elf/d30v.h $(INCDIR)/elf/dlx.h \ + $(INCDIR)/elf/fr30.h $(INCDIR)/elf/frv.h $(INCDIR)/elf/h8.h \ + $(INCDIR)/elf/hppa.h $(INCDIR)/elf/i386.h $(INCDIR)/elf/i370.h \ + $(INCDIR)/elf/i860.h $(INCDIR)/elf/i960.h $(INCDIR)/elf/ia64.h \ + $(INCDIR)/elf/ip2k.h $(INCDIR)/elf/m32c.h $(INCDIR)/elf/m32r.h \ + $(INCDIR)/elf/m68k.h $(INCDIR)/elf/m68hc11.h $(INCDIR)/elf/mcore.h \ + $(INCDIR)/elf/mips.h $(INCDIR)/elf/mmix.h $(INCDIR)/elf/mn10200.h \ + $(INCDIR)/elf/mn10300.h $(INCDIR)/elf/mt.h $(INCDIR)/elf/msp430.h \ $(INCDIR)/elf/or32.h $(INCDIR)/elf/pj.h $(INCDIR)/elf/ppc.h \ $(INCDIR)/elf/ppc64.h $(INCDIR)/elf/s390.h $(INCDIR)/elf/sh.h \ $(INCDIR)/elf/sparc.h $(INCDIR)/elf/v850.h $(INCDIR)/elf/vax.h \ - $(INCDIR)/elf/x86-64.h $(INCDIR)/elf/xstormy16.h $(INCDIR)/elf/iq2000.h \ - $(INCDIR)/elf/xtensa.h $(INCDIR)/aout/ar.h bucomm.h \ - config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/elf/x86-64.h $(INCDIR)/elf/xstormy16.h $(INCDIR)/elf/crx.h \ + $(INCDIR)/elf/iq2000.h $(INCDIR)/elf/xtensa.h $(INCDIR)/aout/ar.h \ + bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ $(INCDIR)/libiberty.h unwind-ia64.h rename.o: rename.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ @@ -523,11 +571,10 @@ sysdump.o: sysdump.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ version.o: version.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h ../bfd/bfdver.h bucomm.h config.h \ $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h -windres.o: windres.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/symcat.h $(INCDIR)/getopt.h bucomm.h config.h \ - $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ - $(INCDIR)/safe-ctype.h $(INCDIR)/obstack.h windres.h \ - winduni.h +windres.o: windres.c config.h ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/symcat.h bucomm.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h $(INCDIR)/obstack.h \ + windres.h winduni.h winduni.o: winduni.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ $(INCDIR)/fopen-same.h winduni.h $(INCDIR)/safe-ctype.h @@ -543,7 +590,7 @@ arlex.o: arlex.c $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ arparse.h sysroff.o: sysroff.c sysinfo.o: sysinfo.c -syslex.o: syslex.c sysinfo.h +syslex.o: syslex.c config.h sysinfo.h defparse.o: defparse.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ $(INCDIR)/fopen-same.h dlltool.h diff --git a/contrib/binutils/binutils/Makefile.in b/contrib/binutils/binutils/Makefile.in index 46eeac8068e..8b5ab820548 100644 --- a/contrib/binutils/binutils/Makefile.in +++ b/contrib/binutils/binutils/Makefile.in @@ -1,6 +1,8 @@ -# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ -# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -10,61 +12,230 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. - -SHELL = @SHELL@ +@SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -sbindir = @sbindir@ -libexecdir = @libexecdir@ -datadir = @datadir@ -sysconfdir = @sysconfdir@ -sharedstatedir = @sharedstatedir@ -localstatedir = @localstatedir@ -libdir = @libdir@ -infodir = @infodir@ -mandir = @mandir@ -includedir = @includedir@ -oldincludedir = /usr/include - -DESTDIR = - pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ - top_builddir = . - -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -transform = @program_transform_name@ - +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : -build_alias = @build_alias@ build_triplet = @build@ -host_alias = @host_alias@ host_triplet = @host@ -target_alias = @target_alias@ target_triplet = @target@ +bin_PROGRAMS = $(am__EXEEXT_5) $(am__EXEEXT_6) $(am__EXEEXT_7) \ + $(am__EXEEXT_8) $(am__EXEEXT_9) $(am__EXEEXT_10) \ + @BUILD_NLMCONV@ @BUILD_SRCONV@ @BUILD_DLLTOOL@ @BUILD_WINDRES@ \ + $(am__EXEEXT_11) $(am__EXEEXT_12) @BUILD_DLLWRAP@ @BUILD_MISC@ +noinst_PROGRAMS = $(am__EXEEXT_13) $(am__EXEEXT_14) $(am__EXEEXT_15) +EXTRA_PROGRAMS = $(am__EXEEXT_1) srconv$(EXEEXT) sysdump$(EXEEXT) \ + coffdump$(EXEEXT) $(am__EXEEXT_2) $(am__EXEEXT_3) \ + $(am__EXEEXT_4) +DIST_COMMON = $(srcdir)/../config.guess $(srcdir)/../config.sub NEWS \ + README ChangeLog $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(top_srcdir)/configure $(am__configure_deps) \ + $(srcdir)/config.in $(srcdir)/../mkinstalldirs \ + $(top_srcdir)/po/Make-in arparse.h arparse.c arlex.c \ + defparse.h defparse.c deflex.c nlmheader.h nlmheader.c \ + arparse.h arparse.c arlex.c rcparse.h rcparse.c rclex.c \ + $(srcdir)/../ylwrap $(srcdir)/../ltmain.sh \ + $(srcdir)/../config.guess $(srcdir)/../config.sub +subdir = . +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/../bfd/acinclude.m4 \ + $(top_srcdir)/../config/acx.m4 $(top_srcdir)/../bfd/bfd.m4 \ + $(top_srcdir)/../bfd/warning.m4 $(top_srcdir)/../libtool.m4 \ + $(top_srcdir)/../gettext.m4 $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno configure.status.lineno +mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = po/Makefile.in +am__EXEEXT_1 = nlmconv$(EXEEXT) +am__EXEEXT_2 = dlltool$(EXEEXT) +am__EXEEXT_3 = windres$(EXEEXT) +am__EXEEXT_4 = dllwrap$(EXEEXT) +am__EXEEXT_5 = size$(EXEEXT) +am__EXEEXT_6 = objdump$(EXEEXT) +am__EXEEXT_7 = ar$(EXEEXT) +am__EXEEXT_8 = strings$(EXEEXT) +am__EXEEXT_9 = ranlib$(EXEEXT) +am__EXEEXT_10 = objcopy$(EXEEXT) +am__EXEEXT_11 = addr2line$(EXEEXT) +am__EXEEXT_12 = readelf$(EXEEXT) +am__installdirs = "$(DESTDIR)$(bindir)" +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +am__EXEEXT_13 = nm-new$(EXEEXT) +am__EXEEXT_14 = strip-new$(EXEEXT) +am__EXEEXT_15 = cxxfilt$(EXEEXT) +PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) +am__objects_1 = bucomm.$(OBJEXT) version.$(OBJEXT) filemode.$(OBJEXT) +am_addr2line_OBJECTS = addr2line.$(OBJEXT) budemang.$(OBJEXT) \ + $(am__objects_1) +addr2line_OBJECTS = $(am_addr2line_OBJECTS) +addr2line_LDADD = $(LDADD) +am__DEPENDENCIES_1 = ../bfd/libbfd.la +am__DEPENDENCIES_2 = ../libiberty/libiberty.a +am__DEPENDENCIES_3 = +addr2line_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_3) +am_ar_OBJECTS = arparse.$(OBJEXT) arlex.$(OBJEXT) ar.$(OBJEXT) \ + not-ranlib.$(OBJEXT) arsup.$(OBJEXT) rename.$(OBJEXT) \ + binemul.$(OBJEXT) emul_$(EMULATION).$(OBJEXT) $(am__objects_1) +ar_OBJECTS = $(am_ar_OBJECTS) +ar_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_3) +am_coffdump_OBJECTS = coffdump.$(OBJEXT) coffgrok.$(OBJEXT) \ + $(am__objects_1) +coffdump_OBJECTS = $(am_coffdump_OBJECTS) +coffdump_LDADD = $(LDADD) +coffdump_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_3) +am_cxxfilt_OBJECTS = cxxfilt.$(OBJEXT) $(am__objects_1) +cxxfilt_OBJECTS = $(am_cxxfilt_OBJECTS) +cxxfilt_LDADD = $(LDADD) +cxxfilt_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_3) +am_dlltool_OBJECTS = dlltool.$(OBJEXT) defparse.$(OBJEXT) \ + deflex.$(OBJEXT) $(am__objects_1) +dlltool_OBJECTS = $(am_dlltool_OBJECTS) +dlltool_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_3) +am_dllwrap_OBJECTS = dllwrap.$(OBJEXT) version.$(OBJEXT) +dllwrap_OBJECTS = $(am_dllwrap_OBJECTS) +dllwrap_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) +am_nlmconv_OBJECTS = nlmconv.$(OBJEXT) nlmheader.$(OBJEXT) \ + $(am__objects_1) +nlmconv_OBJECTS = $(am_nlmconv_OBJECTS) +nlmconv_LDADD = $(LDADD) +nlmconv_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_3) +am_nm_new_OBJECTS = nm.$(OBJEXT) budemang.$(OBJEXT) $(am__objects_1) +nm_new_OBJECTS = $(am_nm_new_OBJECTS) +nm_new_LDADD = $(LDADD) +nm_new_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_3) +am__objects_2 = rddbg.$(OBJEXT) debug.$(OBJEXT) stabs.$(OBJEXT) \ + ieee.$(OBJEXT) rdcoff.$(OBJEXT) +am__objects_3 = $(am__objects_2) wrstabs.$(OBJEXT) +am_objcopy_OBJECTS = objcopy.$(OBJEXT) not-strip.$(OBJEXT) \ + rename.$(OBJEXT) $(am__objects_3) $(am__objects_1) +objcopy_OBJECTS = $(am_objcopy_OBJECTS) +objcopy_LDADD = $(LDADD) +objcopy_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_3) +am_objdump_OBJECTS = objdump.$(OBJEXT) dwarf.$(OBJEXT) \ + budemang.$(OBJEXT) prdbg.$(OBJEXT) $(am__objects_2) \ + $(am__objects_1) +objdump_OBJECTS = $(am_objdump_OBJECTS) +am__DEPENDENCIES_4 = ../opcodes/libopcodes.la +objdump_DEPENDENCIES = $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) +am_ranlib_OBJECTS = ar.$(OBJEXT) is-ranlib.$(OBJEXT) arparse.$(OBJEXT) \ + arlex.$(OBJEXT) arsup.$(OBJEXT) rename.$(OBJEXT) \ + binemul.$(OBJEXT) emul_$(EMULATION).$(OBJEXT) $(am__objects_1) +ranlib_OBJECTS = $(am_ranlib_OBJECTS) +ranlib_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_3) +am_readelf_OBJECTS = readelf.$(OBJEXT) version.$(OBJEXT) \ + unwind-ia64.$(OBJEXT) dwarf.$(OBJEXT) +readelf_OBJECTS = $(am_readelf_OBJECTS) +readelf_DEPENDENCIES = $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_2) +am_size_OBJECTS = size.$(OBJEXT) $(am__objects_1) +size_OBJECTS = $(am_size_OBJECTS) +size_LDADD = $(LDADD) +size_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_3) +am_srconv_OBJECTS = srconv.$(OBJEXT) coffgrok.$(OBJEXT) \ + $(am__objects_1) +srconv_OBJECTS = $(am_srconv_OBJECTS) +srconv_LDADD = $(LDADD) +srconv_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_3) +am_strings_OBJECTS = strings.$(OBJEXT) $(am__objects_1) +strings_OBJECTS = $(am_strings_OBJECTS) +strings_LDADD = $(LDADD) +strings_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_3) +am_strip_new_OBJECTS = objcopy.$(OBJEXT) is-strip.$(OBJEXT) \ + rename.$(OBJEXT) $(am__objects_3) $(am__objects_1) +strip_new_OBJECTS = $(am_strip_new_OBJECTS) +strip_new_LDADD = $(LDADD) +strip_new_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_3) +am_sysdump_OBJECTS = sysdump.$(OBJEXT) $(am__objects_1) +sysdump_OBJECTS = $(am_sysdump_OBJECTS) +sysdump_LDADD = $(LDADD) +sysdump_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_3) +am_windres_OBJECTS = windres.$(OBJEXT) resrc.$(OBJEXT) \ + rescoff.$(OBJEXT) resbin.$(OBJEXT) rcparse.$(OBJEXT) \ + rclex.$(OBJEXT) winduni.$(OBJEXT) resres.$(OBJEXT) \ + $(am__objects_1) +windres_OBJECTS = $(am_windres_OBJECTS) +windres_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_3) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I. +depcomp = +am__depfiles_maybe = +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +LEXCOMPILE = $(LEX) $(LFLAGS) $(AM_LFLAGS) +LTLEXCOMPILE = $(LIBTOOL) --mode=compile $(LEX) $(LFLAGS) $(AM_LFLAGS) +YLWRAP = $(top_srcdir)/../ylwrap +YACCCOMPILE = $(YACC) $(YFLAGS) $(AM_YFLAGS) +LTYACCCOMPILE = $(LIBTOOL) --mode=compile $(YACC) $(YFLAGS) \ + $(AM_YFLAGS) +SOURCES = $(addr2line_SOURCES) $(ar_SOURCES) $(coffdump_SOURCES) \ + $(cxxfilt_SOURCES) $(dlltool_SOURCES) $(dllwrap_SOURCES) \ + $(nlmconv_SOURCES) $(nm_new_SOURCES) $(objcopy_SOURCES) \ + $(objdump_SOURCES) $(ranlib_SOURCES) $(readelf_SOURCES) \ + $(size_SOURCES) $(srconv_SOURCES) $(strings_SOURCES) \ + $(strip_new_SOURCES) $(sysdump_SOURCES) $(windres_SOURCES) +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-exec-recursive install-info-recursive \ + install-recursive installcheck-recursive installdirs-recursive \ + pdf-recursive ps-recursive uninstall-info-recursive \ + uninstall-recursive +ETAGS = etags +CTAGS = ctags +DEJATOOL = $(PACKAGE) +RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir +DIST_SUBDIRS = $(SUBDIRS) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ AR = @AR@ -AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ BUILD_DLLTOOL = @BUILD_DLLTOOL@ BUILD_DLLWRAP = @BUILD_DLLWRAP@ BUILD_MISC = @BUILD_MISC@ @@ -74,64 +245,127 @@ BUILD_WINDRES = @BUILD_WINDRES@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ +CCDEPMODE = @CCDEPMODE@ +CC_FOR_BUILD = @CC_FOR_BUILD@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ +DEFS = @DEFS@ DEMANGLER_NAME = @DEMANGLER_NAME@ -DLLTOOL = @DLLTOOL@ +DEPDIR = @DEPDIR@ DLLTOOL_DEFS = @DLLTOOL_DEFS@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ EMULATION = @EMULATION@ EMULATION_VECTOR = @EMULATION_VECTOR@ EXEEXT = @EXEEXT@ -GCJ = @GCJ@ -GCJFLAGS = @GCJFLAGS@ +EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GT_NO = @GT_NO@ GT_YES = @GT_YES@ HDEFINES = @HDEFINES@ INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLDEPS = @INTLDEPS@ +INTLLIBS = @INTLLIBS@ INTLOBJS = @INTLOBJS@ +LDFLAGS = @LDFLAGS@ +LEX = `if [ -f ../flex/flex ]; then echo ../flex/flex; else echo @LEX@; fi` +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MKINSTALLDIRS = @MKINSTALLDIRS@ MSGFMT = @MSGFMT@ NLMCONV_DEFS = @NLMCONV_DEFS@ -OBJDUMP = @OBJDUMP@ +NO_WERROR = @NO_WERROR@ OBJDUMP_DEFS = @OBJDUMP_DEFS@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ POFILES = @POFILES@ POSUB = @POSUB@ RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ STRIP = @STRIP@ USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ -bfdincludedir = @bfdincludedir@ -bfdlibdir = @bfdlibdir@ -l = @l@ - -INTLLIBS = @INTLLIBS@ - -AUTOMAKE_OPTIONS = cygnus dejagnu - -SUBDIRS = doc po - -tooldir = $(exec_prefix)/$(target_alias) - -CC_FOR_BUILD = @CC_FOR_BUILD@ -EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@ - -YACC = `if [ -f ../bison/bison ]; then echo ../bison/bison -y -L$(srcdir)/../bison/; else echo @YACC@; fi` -YFLAGS = -d -LEX = `if [ -f ../flex/flex ]; then echo ../flex/flex; else echo @LEX@; fi` - WARN_CFLAGS = @WARN_CFLAGS@ +XGETTEXT = @XGETTEXT@ +YACC = `if [ -f ../bison/bison ]; then echo ../bison/bison -y -L$(srcdir)/../bison/; else echo @YACC@; fi` +ac_ct_CC = @ac_ct_CC@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +l = @l@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +AUTOMAKE_OPTIONS = cygnus dejagnu +SUBDIRS = doc po +tooldir = $(exec_prefix)/$(target_alias) +YFLAGS = -d AM_CFLAGS = $(WARN_CFLAGS) # these two are almost the same program @@ -141,9 +375,7 @@ RANLIB_PROG = ranlib # objcopy and strip should be the same program OBJCOPY_PROG = objcopy STRIP_PROG = strip-new - STRINGS_PROG = strings - READELF_PROG = readelf # These should all be the same program too. @@ -154,52 +386,37 @@ OBJDUMP_PROG = objdump # This is the demangler, as a standalone program. # Note: This one is used as the installed name too, unlike the above. DEMANGLER_PROG = cxxfilt - ADDR2LINE_PROG = addr2line - NLMCONV_PROG = nlmconv DLLTOOL_PROG = dlltool WINDRES_PROG = windres DLLWRAP_PROG = dllwrap - SRCONV_PROG = srconv$(EXEEXT) sysdump$(EXEEXT) coffdump$(EXEEXT) - PROGS = $(SIZE_PROG) $(OBJDUMP_PROG) $(NM_PROG) $(AR_PROG) $(STRINGS_PROG) $(STRIP_PROG) $(RANLIB_PROG) $(DEMANGLER_PROG) $(OBJCOPY_PROG) @BUILD_NLMCONV@ @BUILD_SRCONV@ @BUILD_DLLTOOL@ @BUILD_WINDRES@ $(ADDR2LINE_PROG) $(READELF_PROG) @BUILD_DLLWRAP@ @BUILD_MISC@ -bin_PROGRAMS = $(SIZE_PROG) $(OBJDUMP_PROG) $(AR_PROG) $(STRINGS_PROG) $(RANLIB_PROG) $(OBJCOPY_PROG) @BUILD_NLMCONV@ @BUILD_SRCONV@ @BUILD_DLLTOOL@ @BUILD_WINDRES@ $(ADDR2LINE_PROG) $(READELF_PROG) @BUILD_DLLWRAP@ @BUILD_MISC@ - -noinst_PROGRAMS = $(NM_PROG) $(STRIP_PROG) $(DEMANGLER_PROG) - -EXTRA_PROGRAMS = $(NLMCONV_PROG) srconv sysdump coffdump $(DLLTOOL_PROG) $(WINDRES_PROG) $(DLLWRAP_PROG) - # Stuff that goes in tooldir/ if appropriate. -TOOL_PROGS = nm-new strip-new ar ranlib dlltool - +TOOL_PROGS = nm-new strip-new ar ranlib dlltool objdump BASEDIR = $(srcdir)/.. BFDDIR = $(BASEDIR)/bfd INCDIR = $(BASEDIR)/include - MKDEP = gcc -MM - INCLUDES = -D_GNU_SOURCE \ -I. -I$(srcdir) -I../bfd -I$(BFDDIR) -I$(INCDIR) \ @HDEFINES@ \ -I$(srcdir)/../intl -I../intl \ - -DLOCALEDIR="\"$(prefix)/share/locale\"" \ + -DLOCALEDIR="\"$(datadir)/locale\"" \ -Dbin_dummy_emulation=$(EMULATION_VECTOR) - HFILES = \ arsup.h binemul.h bucomm.h budbg.h budemang.h \ coffgrok.h debug.h dlltool.h nlmconv.h \ windres.h winduni.h - GENERATED_HFILES = arparse.h sysroff.h sysinfo.h defparse.h rcparse.h - CFILES = \ addr2line.c ar.c arsup.c binemul.c bucomm.c budemang.c \ - coffdump.c coffgrok.c cxxfilt.c debug.c dlltool.c dllwrap.c \ + coffdump.c coffgrok.c cxxfilt.c \ + dwarf.c debug.c dlltool.c dllwrap.c \ emul_aix.c emul_vanilla.c filemode.c \ ieee.c is-ranlib.c is-strip.c maybe-ranlib.c maybe-strip.c \ nlmconv.c nm.c not-ranlib.c not-strip.c \ @@ -209,35 +426,21 @@ CFILES = \ size.c srconv.c stabs.c strings.c sysdump.c version.c \ windres.c winduni.c wrstabs.c - GENERATED_CFILES = \ arparse.c arlex.c sysroff.c sysinfo.c syslex.c \ defparse.c deflex.c nlmheader.c rcparse.c rclex.c - DEBUG_SRCS = rddbg.c debug.c stabs.c ieee.c rdcoff.c WRITE_DEBUG_SRCS = $(DEBUG_SRCS) wrstabs.c # Code shared by all the binutils. BULIBS = bucomm.c version.c filemode.c - BFDLIB = ../bfd/libbfd.la - OPCODES = ../opcodes/libopcodes.la - LIBIBERTY = ../libiberty/libiberty.a - POTFILES = $(CFILES) $(DEBUG_SRCS) $(HFILES) - -EXPECT = `if [ -f $$r/../expect/expect ] ; then \ - echo $$r/../expect/expect ; \ - else echo expect ; fi` - -RUNTEST = `if [ -f ${srcdir}/../dejagnu/runtest ] ; then \ - echo ${srcdir}/../dejagnu/runtest ; \ - else echo runtest ; fi` - - +EXPECT = expect +RUNTEST = runtest CC_FOR_TARGET = ` \ if [ -f $$r/../gcc/xgcc ] ; then \ if [ -f $$r/../newlib/Makefile ] ; then \ @@ -253,313 +456,215 @@ CC_FOR_TARGET = ` \ fi; \ fi` - LDADD = $(BFDLIB) $(LIBIBERTY) $(INTLLIBS) - size_SOURCES = size.c $(BULIBS) - objcopy_SOURCES = objcopy.c not-strip.c rename.c $(WRITE_DEBUG_SRCS) $(BULIBS) - strings_SOURCES = strings.c $(BULIBS) - -readelf_SOURCES = readelf.c version.c unwind-ia64.c +readelf_SOURCES = readelf.c version.c unwind-ia64.c dwarf.c readelf_LDADD = $(INTLLIBS) $(LIBIBERTY) - strip_new_SOURCES = objcopy.c is-strip.c rename.c $(WRITE_DEBUG_SRCS) $(BULIBS) - nm_new_SOURCES = nm.c budemang.c $(BULIBS) - -objdump_SOURCES = objdump.c budemang.c prdbg.c $(DEBUG_SRCS) $(BULIBS) +objdump_SOURCES = objdump.c dwarf.c budemang.c prdbg.c $(DEBUG_SRCS) $(BULIBS) objdump_LDADD = $(OPCODES) $(BFDLIB) $(LIBIBERTY) $(INTLLIBS) - cxxfilt_SOURCES = cxxfilt.c $(BULIBS) - ar_SOURCES = arparse.y arlex.l ar.c not-ranlib.c arsup.c rename.c binemul.c \ emul_$(EMULATION).c $(BULIBS) ar_LDADD = $(BFDLIB) $(LIBIBERTY) @LEXLIB@ $(INTLLIBS) - ranlib_SOURCES = ar.c is-ranlib.c arparse.y arlex.l arsup.c rename.c \ binemul.c emul_$(EMULATION).c $(BULIBS) ranlib_LDADD = $(BFDLIB) $(LIBIBERTY) @LEXLIB@ $(INTLLIBS) - addr2line_SOURCES = addr2line.c budemang.c $(BULIBS) - srconv_SOURCES = srconv.c coffgrok.c $(BULIBS) - dlltool_SOURCES = dlltool.c defparse.y deflex.l $(BULIBS) dlltool_LDADD = $(BFDLIB) $(LIBIBERTY) @LEXLIB@ $(INTLLIBS) - coffdump_SOURCES = coffdump.c coffgrok.c $(BULIBS) - sysdump_SOURCES = sysdump.c $(BULIBS) - nlmconv_SOURCES = nlmconv.c nlmheader.y $(BULIBS) - windres_SOURCES = windres.c resrc.c rescoff.c resbin.c rcparse.y rclex.l \ winduni.c resres.c $(BULIBS) windres_LDADD = $(BFDLIB) $(LIBIBERTY) @LEXLIB@ $(INTLLIBS) - dllwrap_SOURCES = dllwrap.c version.c dllwrap_LDADD = $(LIBIBERTY) $(INTLLIBS) - EXTRA_DIST = arparse.c arparse.h arlex.c nlmheader.c sysinfo.c sysinfo.h \ syslex.c deflex.c defparse.h defparse.c rclex.c rcparse.h rcparse.c - DISTCLEANFILES = sysinfo sysroff.c sysroff.h \ site.exp site.bak ### - MOSTLYCLEANFILES = sysinfo binutils.log binutils.sum abcdefgh* - CLEANFILES = dep.sed DEP DEPA DEP1 DEP2 -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs -CONFIG_HEADER = config.h -CONFIG_CLEAN_FILES = -bin_PROGRAMS = size$(EXEEXT) objdump$(EXEEXT) ar$(EXEEXT) \ -strings$(EXEEXT) ranlib$(EXEEXT) objcopy$(EXEEXT) @BUILD_NLMCONV@ \ -@BUILD_SRCONV@ @BUILD_DLLTOOL@ @BUILD_WINDRES@ addr2line$(EXEEXT) \ -readelf$(EXEEXT) @BUILD_DLLWRAP@ @BUILD_MISC@ -noinst_PROGRAMS = nm-new$(EXEEXT) strip-new$(EXEEXT) cxxfilt$(EXEEXT) -PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive - -DEFS = @DEFS@ -I. -I$(srcdir) -I. -CPPFLAGS = @CPPFLAGS@ -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ -nlmconv_OBJECTS = nlmconv.$(OBJEXT) nlmheader.$(OBJEXT) \ -bucomm.$(OBJEXT) version.$(OBJEXT) filemode.$(OBJEXT) -nlmconv_LDADD = $(LDADD) -nlmconv_DEPENDENCIES = ../bfd/libbfd.la ../libiberty/libiberty.a -nlmconv_LDFLAGS = -srconv_OBJECTS = srconv.$(OBJEXT) coffgrok.$(OBJEXT) bucomm.$(OBJEXT) \ -version.$(OBJEXT) filemode.$(OBJEXT) -srconv_LDADD = $(LDADD) -srconv_DEPENDENCIES = ../bfd/libbfd.la ../libiberty/libiberty.a -srconv_LDFLAGS = -sysdump_OBJECTS = sysdump.$(OBJEXT) bucomm.$(OBJEXT) version.$(OBJEXT) \ -filemode.$(OBJEXT) -sysdump_LDADD = $(LDADD) -sysdump_DEPENDENCIES = ../bfd/libbfd.la ../libiberty/libiberty.a -sysdump_LDFLAGS = -coffdump_OBJECTS = coffdump.$(OBJEXT) coffgrok.$(OBJEXT) \ -bucomm.$(OBJEXT) version.$(OBJEXT) filemode.$(OBJEXT) -coffdump_LDADD = $(LDADD) -coffdump_DEPENDENCIES = ../bfd/libbfd.la ../libiberty/libiberty.a -coffdump_LDFLAGS = -dlltool_OBJECTS = dlltool.$(OBJEXT) defparse.$(OBJEXT) deflex.$(OBJEXT) \ -bucomm.$(OBJEXT) version.$(OBJEXT) filemode.$(OBJEXT) -dlltool_DEPENDENCIES = ../bfd/libbfd.la ../libiberty/libiberty.a -dlltool_LDFLAGS = -windres_OBJECTS = windres.$(OBJEXT) resrc.$(OBJEXT) rescoff.$(OBJEXT) \ -resbin.$(OBJEXT) rcparse.$(OBJEXT) rclex.$(OBJEXT) winduni.$(OBJEXT) \ -resres.$(OBJEXT) bucomm.$(OBJEXT) version.$(OBJEXT) filemode.$(OBJEXT) -windres_DEPENDENCIES = ../bfd/libbfd.la ../libiberty/libiberty.a -windres_LDFLAGS = -dllwrap_OBJECTS = dllwrap.$(OBJEXT) version.$(OBJEXT) -dllwrap_DEPENDENCIES = ../libiberty/libiberty.a -dllwrap_LDFLAGS = -size_OBJECTS = size.$(OBJEXT) bucomm.$(OBJEXT) version.$(OBJEXT) \ -filemode.$(OBJEXT) -size_LDADD = $(LDADD) -size_DEPENDENCIES = ../bfd/libbfd.la ../libiberty/libiberty.a -size_LDFLAGS = -objdump_OBJECTS = objdump.$(OBJEXT) budemang.$(OBJEXT) prdbg.$(OBJEXT) \ -rddbg.$(OBJEXT) debug.$(OBJEXT) stabs.$(OBJEXT) ieee.$(OBJEXT) \ -rdcoff.$(OBJEXT) bucomm.$(OBJEXT) version.$(OBJEXT) filemode.$(OBJEXT) -objdump_DEPENDENCIES = ../opcodes/libopcodes.la ../bfd/libbfd.la \ -../libiberty/libiberty.a -objdump_LDFLAGS = -ar_OBJECTS = arparse.$(OBJEXT) arlex.$(OBJEXT) ar.$(OBJEXT) \ -not-ranlib.$(OBJEXT) arsup.$(OBJEXT) rename.$(OBJEXT) binemul.$(OBJEXT) \ -emul_$(EMULATION).$(OBJEXT) bucomm.$(OBJEXT) version.$(OBJEXT) \ -filemode.$(OBJEXT) -ar_DEPENDENCIES = ../bfd/libbfd.la ../libiberty/libiberty.a -ar_LDFLAGS = -strings_OBJECTS = strings.$(OBJEXT) bucomm.$(OBJEXT) version.$(OBJEXT) \ -filemode.$(OBJEXT) -strings_LDADD = $(LDADD) -strings_DEPENDENCIES = ../bfd/libbfd.la ../libiberty/libiberty.a -strings_LDFLAGS = -ranlib_OBJECTS = ar.$(OBJEXT) is-ranlib.$(OBJEXT) arparse.$(OBJEXT) \ -arlex.$(OBJEXT) arsup.$(OBJEXT) rename.$(OBJEXT) binemul.$(OBJEXT) \ -emul_$(EMULATION).$(OBJEXT) bucomm.$(OBJEXT) version.$(OBJEXT) \ -filemode.$(OBJEXT) -ranlib_DEPENDENCIES = ../bfd/libbfd.la ../libiberty/libiberty.a -ranlib_LDFLAGS = -objcopy_OBJECTS = objcopy.$(OBJEXT) not-strip.$(OBJEXT) \ -rename.$(OBJEXT) rddbg.$(OBJEXT) debug.$(OBJEXT) stabs.$(OBJEXT) \ -ieee.$(OBJEXT) rdcoff.$(OBJEXT) wrstabs.$(OBJEXT) bucomm.$(OBJEXT) \ -version.$(OBJEXT) filemode.$(OBJEXT) -objcopy_LDADD = $(LDADD) -objcopy_DEPENDENCIES = ../bfd/libbfd.la ../libiberty/libiberty.a -objcopy_LDFLAGS = -addr2line_OBJECTS = addr2line.$(OBJEXT) budemang.$(OBJEXT) \ -bucomm.$(OBJEXT) version.$(OBJEXT) filemode.$(OBJEXT) -addr2line_LDADD = $(LDADD) -addr2line_DEPENDENCIES = ../bfd/libbfd.la ../libiberty/libiberty.a -addr2line_LDFLAGS = -readelf_OBJECTS = readelf.$(OBJEXT) version.$(OBJEXT) \ -unwind-ia64.$(OBJEXT) -readelf_DEPENDENCIES = ../libiberty/libiberty.a -readelf_LDFLAGS = -nm_new_OBJECTS = nm.$(OBJEXT) budemang.$(OBJEXT) bucomm.$(OBJEXT) \ -version.$(OBJEXT) filemode.$(OBJEXT) -nm_new_LDADD = $(LDADD) -nm_new_DEPENDENCIES = ../bfd/libbfd.la ../libiberty/libiberty.a -nm_new_LDFLAGS = -strip_new_OBJECTS = objcopy.$(OBJEXT) is-strip.$(OBJEXT) \ -rename.$(OBJEXT) rddbg.$(OBJEXT) debug.$(OBJEXT) stabs.$(OBJEXT) \ -ieee.$(OBJEXT) rdcoff.$(OBJEXT) wrstabs.$(OBJEXT) bucomm.$(OBJEXT) \ -version.$(OBJEXT) filemode.$(OBJEXT) -strip_new_LDADD = $(LDADD) -strip_new_DEPENDENCIES = ../bfd/libbfd.la ../libiberty/libiberty.a -strip_new_LDFLAGS = -cxxfilt_OBJECTS = cxxfilt.$(OBJEXT) bucomm.$(OBJEXT) version.$(OBJEXT) \ -filemode.$(OBJEXT) -cxxfilt_LDADD = $(LDADD) -cxxfilt_DEPENDENCIES = ../bfd/libbfd.la ../libiberty/libiberty.a -cxxfilt_LDFLAGS = -LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LEXLIB = @LEXLIB@ -YLWRAP = $(top_srcdir)/../ylwrap -CFLAGS = @CFLAGS@ -COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ -DIST_COMMON = README ./stamp-h.in ChangeLog Makefile.am Makefile.in \ -NEWS acinclude.m4 aclocal.m4 arlex.c arparse.c config.in configure \ -configure.in deflex.c defparse.c nlmheader.c rclex.c rcparse.c - - -DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) - -TAR = tar -GZIP_ENV = --best -SOURCES = $(nlmconv_SOURCES) $(srconv_SOURCES) $(sysdump_SOURCES) $(coffdump_SOURCES) $(dlltool_SOURCES) $(windres_SOURCES) $(dllwrap_SOURCES) $(size_SOURCES) $(objdump_SOURCES) $(ar_SOURCES) $(strings_SOURCES) $(ranlib_SOURCES) $(objcopy_SOURCES) $(addr2line_SOURCES) $(readelf_SOURCES) $(nm_new_SOURCES) $(strip_new_SOURCES) $(cxxfilt_SOURCES) -OBJECTS = $(nlmconv_OBJECTS) $(srconv_OBJECTS) $(sysdump_OBJECTS) $(coffdump_OBJECTS) $(dlltool_OBJECTS) $(windres_OBJECTS) $(dllwrap_OBJECTS) $(size_OBJECTS) $(objdump_OBJECTS) $(ar_OBJECTS) $(strings_OBJECTS) $(ranlib_OBJECTS) $(objcopy_OBJECTS) $(addr2line_OBJECTS) $(readelf_OBJECTS) $(nm_new_OBJECTS) $(strip_new_OBJECTS) $(cxxfilt_OBJECTS) - -all: all-redirect .SUFFIXES: -.SUFFIXES: .S .c .l .lo .o .obj .s .y -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --cygnus Makefile +.SUFFIXES: .c .l .lo .o .obj .y +am--refresh: + @: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \ + cd $(srcdir) && $(AUTOMAKE) --foreign \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) \ - && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status - -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in acinclude.m4 - cd $(srcdir) && $(ACLOCAL) - -config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck -$(srcdir)/configure: @MAINTAINER_MODE_TRUE@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) -config.h: stamp-h +config.h: stamp-h1 @if test ! -f $@; then \ - rm -f stamp-h; \ - $(MAKE) stamp-h; \ + rm -f stamp-h1; \ + $(MAKE) stamp-h1; \ else :; fi -stamp-h: $(srcdir)/config.in $(top_builddir)/config.status - cd $(top_builddir) \ - && CONFIG_FILES= CONFIG_HEADERS=config.h:config.in \ - $(SHELL) ./config.status - @echo timestamp > stamp-h 2> /dev/null -$(srcdir)/config.in: @MAINTAINER_MODE_TRUE@$(srcdir)/stamp-h.in - @if test ! -f $@; then \ - rm -f $(srcdir)/stamp-h.in; \ - $(MAKE) $(srcdir)/stamp-h.in; \ - else :; fi -$(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) + +stamp-h1: $(srcdir)/config.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status config.h +$(srcdir)/config.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_srcdir) && $(AUTOHEADER) - @echo timestamp > $(srcdir)/stamp-h.in 2> /dev/null - -mostlyclean-hdr: - -clean-hdr: + rm -f stamp-h1 + touch $@ distclean-hdr: - -rm -f config.h - -maintainer-clean-hdr: - -mostlyclean-binPROGRAMS: - -clean-binPROGRAMS: - -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) - -distclean-binPROGRAMS: - -maintainer-clean-binPROGRAMS: - + -rm -f config.h stamp-h1 +po/Makefile.in: $(top_builddir)/config.status $(top_srcdir)/po/Make-in + cd $(top_builddir) && $(SHELL) ./config.status $@ install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(bindir) + test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; for p in $$list; do \ - if test -f $$p; then \ - echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \ - $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + || test -f $$p1 \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ else :; fi; \ done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) - list='$(bin_PROGRAMS)'; for p in $$list; do \ - rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ done -mostlyclean-noinstPROGRAMS: +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done clean-noinstPROGRAMS: - -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) - -distclean-noinstPROGRAMS: - -maintainer-clean-noinstPROGRAMS: - -.c.o: - $(COMPILE) -c $< - -# FIXME: We should only use cygpath when building on Windows, -# and only if it is available. -.c.obj: - $(COMPILE) -c `cygpath -w $<` - -.s.o: - $(COMPILE) -c $< - -.S.o: - $(COMPILE) -c $< + @list='$(noinst_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +addr2line$(EXEEXT): $(addr2line_OBJECTS) $(addr2line_DEPENDENCIES) + @rm -f addr2line$(EXEEXT) + $(LINK) $(addr2line_LDFLAGS) $(addr2line_OBJECTS) $(addr2line_LDADD) $(LIBS) +ar$(EXEEXT): $(ar_OBJECTS) $(ar_DEPENDENCIES) + @rm -f ar$(EXEEXT) + $(LINK) $(ar_LDFLAGS) $(ar_OBJECTS) $(ar_LDADD) $(LIBS) +coffdump$(EXEEXT): $(coffdump_OBJECTS) $(coffdump_DEPENDENCIES) + @rm -f coffdump$(EXEEXT) + $(LINK) $(coffdump_LDFLAGS) $(coffdump_OBJECTS) $(coffdump_LDADD) $(LIBS) +cxxfilt$(EXEEXT): $(cxxfilt_OBJECTS) $(cxxfilt_DEPENDENCIES) + @rm -f cxxfilt$(EXEEXT) + $(LINK) $(cxxfilt_LDFLAGS) $(cxxfilt_OBJECTS) $(cxxfilt_LDADD) $(LIBS) +dlltool$(EXEEXT): $(dlltool_OBJECTS) $(dlltool_DEPENDENCIES) + @rm -f dlltool$(EXEEXT) + $(LINK) $(dlltool_LDFLAGS) $(dlltool_OBJECTS) $(dlltool_LDADD) $(LIBS) +dllwrap$(EXEEXT): $(dllwrap_OBJECTS) $(dllwrap_DEPENDENCIES) + @rm -f dllwrap$(EXEEXT) + $(LINK) $(dllwrap_LDFLAGS) $(dllwrap_OBJECTS) $(dllwrap_LDADD) $(LIBS) +nlmconv$(EXEEXT): $(nlmconv_OBJECTS) $(nlmconv_DEPENDENCIES) + @rm -f nlmconv$(EXEEXT) + $(LINK) $(nlmconv_LDFLAGS) $(nlmconv_OBJECTS) $(nlmconv_LDADD) $(LIBS) +nm-new$(EXEEXT): $(nm_new_OBJECTS) $(nm_new_DEPENDENCIES) + @rm -f nm-new$(EXEEXT) + $(LINK) $(nm_new_LDFLAGS) $(nm_new_OBJECTS) $(nm_new_LDADD) $(LIBS) +objcopy$(EXEEXT): $(objcopy_OBJECTS) $(objcopy_DEPENDENCIES) + @rm -f objcopy$(EXEEXT) + $(LINK) $(objcopy_LDFLAGS) $(objcopy_OBJECTS) $(objcopy_LDADD) $(LIBS) +objdump$(EXEEXT): $(objdump_OBJECTS) $(objdump_DEPENDENCIES) + @rm -f objdump$(EXEEXT) + $(LINK) $(objdump_LDFLAGS) $(objdump_OBJECTS) $(objdump_LDADD) $(LIBS) +ranlib$(EXEEXT): $(ranlib_OBJECTS) $(ranlib_DEPENDENCIES) + @rm -f ranlib$(EXEEXT) + $(LINK) $(ranlib_LDFLAGS) $(ranlib_OBJECTS) $(ranlib_LDADD) $(LIBS) +readelf$(EXEEXT): $(readelf_OBJECTS) $(readelf_DEPENDENCIES) + @rm -f readelf$(EXEEXT) + $(LINK) $(readelf_LDFLAGS) $(readelf_OBJECTS) $(readelf_LDADD) $(LIBS) +size$(EXEEXT): $(size_OBJECTS) $(size_DEPENDENCIES) + @rm -f size$(EXEEXT) + $(LINK) $(size_LDFLAGS) $(size_OBJECTS) $(size_LDADD) $(LIBS) +srconv$(EXEEXT): $(srconv_OBJECTS) $(srconv_DEPENDENCIES) + @rm -f srconv$(EXEEXT) + $(LINK) $(srconv_LDFLAGS) $(srconv_OBJECTS) $(srconv_LDADD) $(LIBS) +strings$(EXEEXT): $(strings_OBJECTS) $(strings_DEPENDENCIES) + @rm -f strings$(EXEEXT) + $(LINK) $(strings_LDFLAGS) $(strings_OBJECTS) $(strings_LDADD) $(LIBS) +strip-new$(EXEEXT): $(strip_new_OBJECTS) $(strip_new_DEPENDENCIES) + @rm -f strip-new$(EXEEXT) + $(LINK) $(strip_new_LDFLAGS) $(strip_new_OBJECTS) $(strip_new_LDADD) $(LIBS) +sysdump$(EXEEXT): $(sysdump_OBJECTS) $(sysdump_DEPENDENCIES) + @rm -f sysdump$(EXEEXT) + $(LINK) $(sysdump_LDFLAGS) $(sysdump_OBJECTS) $(sysdump_LDADD) $(LIBS) +windres$(EXEEXT): $(windres_OBJECTS) $(windres_DEPENDENCIES) + @rm -f windres$(EXEEXT) + $(LINK) $(windres_LDFLAGS) $(windres_OBJECTS) $(windres_LDADD) $(LIBS) mostlyclean-compile: - -rm -f *.o core *.core -rm -f *.$(OBJEXT) -clean-compile: - distclean-compile: -rm -f *.tab.c -maintainer-clean-compile: +.c.o: + $(COMPILE) -c $< + +.c.obj: + $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: - $(LIBTOOL) --mode=compile $(COMPILE) -c $< + $(LTCOMPILE) -c -o $@ $< -.s.lo: - $(LIBTOOL) --mode=compile $(COMPILE) -c $< +.l.c: + $(SHELL) $(YLWRAP) $< $(LEX_OUTPUT_ROOT).c $@ -- $(LEXCOMPILE) -.S.lo: - $(LIBTOOL) --mode=compile $(COMPILE) -c $< +.y.c: + $(SHELL) $(YLWRAP) $< y.tab.c $@ y.tab.h $*.h y.output $*.output -- $(YACCCOMPILE) mostlyclean-libtool: -rm -f *.lo @@ -568,89 +673,8 @@ clean-libtool: -rm -rf .libs _libs distclean-libtool: - -maintainer-clean-libtool: - -nlmconv$(EXEEXT): $(nlmconv_OBJECTS) $(nlmconv_DEPENDENCIES) - @rm -f nlmconv$(EXEEXT) - $(LINK) $(nlmconv_LDFLAGS) $(nlmconv_OBJECTS) $(nlmconv_LDADD) $(LIBS) - -srconv$(EXEEXT): $(srconv_OBJECTS) $(srconv_DEPENDENCIES) - @rm -f srconv$(EXEEXT) - $(LINK) $(srconv_LDFLAGS) $(srconv_OBJECTS) $(srconv_LDADD) $(LIBS) - -sysdump$(EXEEXT): $(sysdump_OBJECTS) $(sysdump_DEPENDENCIES) - @rm -f sysdump$(EXEEXT) - $(LINK) $(sysdump_LDFLAGS) $(sysdump_OBJECTS) $(sysdump_LDADD) $(LIBS) - -coffdump$(EXEEXT): $(coffdump_OBJECTS) $(coffdump_DEPENDENCIES) - @rm -f coffdump$(EXEEXT) - $(LINK) $(coffdump_LDFLAGS) $(coffdump_OBJECTS) $(coffdump_LDADD) $(LIBS) - -dlltool$(EXEEXT): $(dlltool_OBJECTS) $(dlltool_DEPENDENCIES) - @rm -f dlltool$(EXEEXT) - $(LINK) $(dlltool_LDFLAGS) $(dlltool_OBJECTS) $(dlltool_LDADD) $(LIBS) - -windres$(EXEEXT): $(windres_OBJECTS) $(windres_DEPENDENCIES) - @rm -f windres$(EXEEXT) - $(LINK) $(windres_LDFLAGS) $(windres_OBJECTS) $(windres_LDADD) $(LIBS) - -dllwrap$(EXEEXT): $(dllwrap_OBJECTS) $(dllwrap_DEPENDENCIES) - @rm -f dllwrap$(EXEEXT) - $(LINK) $(dllwrap_LDFLAGS) $(dllwrap_OBJECTS) $(dllwrap_LDADD) $(LIBS) - -size$(EXEEXT): $(size_OBJECTS) $(size_DEPENDENCIES) - @rm -f size$(EXEEXT) - $(LINK) $(size_LDFLAGS) $(size_OBJECTS) $(size_LDADD) $(LIBS) - -objdump$(EXEEXT): $(objdump_OBJECTS) $(objdump_DEPENDENCIES) - @rm -f objdump$(EXEEXT) - $(LINK) $(objdump_LDFLAGS) $(objdump_OBJECTS) $(objdump_LDADD) $(LIBS) - -ar$(EXEEXT): $(ar_OBJECTS) $(ar_DEPENDENCIES) - @rm -f ar$(EXEEXT) - $(LINK) $(ar_LDFLAGS) $(ar_OBJECTS) $(ar_LDADD) $(LIBS) - -strings$(EXEEXT): $(strings_OBJECTS) $(strings_DEPENDENCIES) - @rm -f strings$(EXEEXT) - $(LINK) $(strings_LDFLAGS) $(strings_OBJECTS) $(strings_LDADD) $(LIBS) - -ranlib$(EXEEXT): $(ranlib_OBJECTS) $(ranlib_DEPENDENCIES) - @rm -f ranlib$(EXEEXT) - $(LINK) $(ranlib_LDFLAGS) $(ranlib_OBJECTS) $(ranlib_LDADD) $(LIBS) - -objcopy$(EXEEXT): $(objcopy_OBJECTS) $(objcopy_DEPENDENCIES) - @rm -f objcopy$(EXEEXT) - $(LINK) $(objcopy_LDFLAGS) $(objcopy_OBJECTS) $(objcopy_LDADD) $(LIBS) - -addr2line$(EXEEXT): $(addr2line_OBJECTS) $(addr2line_DEPENDENCIES) - @rm -f addr2line$(EXEEXT) - $(LINK) $(addr2line_LDFLAGS) $(addr2line_OBJECTS) $(addr2line_LDADD) $(LIBS) - -readelf$(EXEEXT): $(readelf_OBJECTS) $(readelf_DEPENDENCIES) - @rm -f readelf$(EXEEXT) - $(LINK) $(readelf_LDFLAGS) $(readelf_OBJECTS) $(readelf_LDADD) $(LIBS) - -nm-new$(EXEEXT): $(nm_new_OBJECTS) $(nm_new_DEPENDENCIES) - @rm -f nm-new$(EXEEXT) - $(LINK) $(nm_new_LDFLAGS) $(nm_new_OBJECTS) $(nm_new_LDADD) $(LIBS) - -strip-new$(EXEEXT): $(strip_new_OBJECTS) $(strip_new_DEPENDENCIES) - @rm -f strip-new$(EXEEXT) - $(LINK) $(strip_new_LDFLAGS) $(strip_new_OBJECTS) $(strip_new_LDADD) $(LIBS) - -cxxfilt$(EXEEXT): $(cxxfilt_OBJECTS) $(cxxfilt_DEPENDENCIES) - @rm -f cxxfilt$(EXEEXT) - $(LINK) $(cxxfilt_LDFLAGS) $(cxxfilt_OBJECTS) $(cxxfilt_LDADD) $(LIBS) -.l.c: - $(SHELL) $(YLWRAP) "$(LEX)" $< $(LEX_OUTPUT_ROOT).c $@ -- $(AM_LFLAGS) $(LFLAGS) -.y.c: - $(SHELL) $(YLWRAP) "$(YACC)" $< y.tab.c $*.c y.tab.h $*.h -- $(AM_YFLAGS) $(YFLAGS) -arparse.h: arparse.c -defparse.h: defparse.c -nlmheader.h: nlmheader.c -rcparse.h: rcparse.c - + -rm -f libtool +uninstall-info-am: # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. @@ -658,13 +682,14 @@ rcparse.h: rcparse.c # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. - -@SET_MAKE@ - -all-recursive install-data-recursive install-exec-recursive \ -installdirs-recursive install-recursive uninstall-recursive install-info-recursive \ -check-recursive installcheck-recursive info-recursive dvi-recursive: - @set fnord $(MAKEFLAGS); amf=$$2; \ +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ @@ -676,7 +701,7 @@ check-recursive installcheck-recursive info-recursive dvi-recursive: local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ @@ -684,13 +709,24 @@ check-recursive installcheck-recursive info-recursive dvi-recursive: mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: - @set fnord $(MAKEFLAGS); amf=$$2; \ - dot_seen=no; \ - rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ - rev="$$subdir $$rev"; \ - test "$$subdir" != "." || dot_seen=yes; \ + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ done; \ - test "$$dot_seen" = "no" && rev=". $$rev"; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ @@ -700,164 +736,123 @@ maintainer-clean-recursive: local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique tags: TAGS -ID: $(HEADERS) $(SOURCES) $(LISP) - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - here=`pwd` && cd $(srcdir) \ - && mkid -f$$here/ID $$unique $(LISP) - -TAGS: tags-recursive $(HEADERS) $(SOURCES) config.in $(TAGS_DEPENDENCIES) $(LISP) +TAGS: tags-recursive $(HEADERS) $(SOURCES) config.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ - fi; \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ done; \ - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ + list='$(SOURCES) $(HEADERS) config.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)config.in$$unique$(LISP)$$tags" \ - || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.in $$unique $(LISP) -o $$here/TAGS) + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) config.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique -mostlyclean-tags: - -clean-tags: +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here distclean-tags: - -rm -f TAGS ID - -maintainer-clean-tags: - -distdir = $(PACKAGE)-$(VERSION) -top_distdir = $(distdir) - -# This target untars the dist file and tries a VPATH configuration. Then -# it guarantees that the distribution is self-contained by making another -# tarfile. -distcheck: dist - -rm -rf $(distdir) - GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz - mkdir $(distdir)/=build - mkdir $(distdir)/=inst - dc_install_base=`cd $(distdir)/=inst && pwd`; \ - cd $(distdir)/=build \ - && ../configure --srcdir=.. --prefix=$$dc_install_base \ - && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) dvi \ - && $(MAKE) $(AM_MAKEFLAGS) check \ - && $(MAKE) $(AM_MAKEFLAGS) install \ - && $(MAKE) $(AM_MAKEFLAGS) installcheck \ - && $(MAKE) $(AM_MAKEFLAGS) dist - -rm -rf $(distdir) - @banner="$(distdir).tar.gz is ready for distribution"; \ - dashes=`echo "$$banner" | sed s/./=/g`; \ - echo "$$dashes"; \ - echo "$$banner"; \ - echo "$$dashes" -dist: distdir - -chmod -R a+r $(distdir) - GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) - -rm -rf $(distdir) -dist-all: distdir - -chmod -R a+r $(distdir) - GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) - -rm -rf $(distdir) -distdir: $(DISTFILES) - -rm -rf $(distdir) - mkdir $(distdir) - -chmod 777 $(distdir) - @for file in $(DISTFILES); do \ - if test -f $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - cp -pr $$d/$$file $(distdir)/$$file; \ - else \ - test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file || :; \ - fi; \ - done - for subdir in $(SUBDIRS); do \ - if test "$$subdir" = .; then :; else \ - test -d $(distdir)/$$subdir \ - || mkdir $(distdir)/$$subdir \ - || exit 1; \ - chmod 777 $(distdir)/$$subdir; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \ - || exit 1; \ - fi; \ - done - -RUNTESTFLAGS = - -DEJATOOL = $(PACKAGE) - -RUNTESTDEFAULTFLAGS = --tool $(DEJATOOL) --srcdir $$srcdir + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags site.exp: Makefile @echo 'Making a new site.exp file...' - @test ! -f site.bak || rm -f site.bak - @echo '## these variables are automatically generated by make ##' > $@-t - @echo '# Do not edit here. If you wish to override these values' >> $@-t - @echo '# edit the last section' >> $@-t - @echo 'set tool $(DEJATOOL)' >> $@-t - @echo 'set srcdir $(srcdir)' >> $@-t - @echo 'set objdir' `pwd` >> $@-t - @echo 'set host_alias $(host_alias)' >> $@-t - @echo 'set host_triplet $(host_triplet)' >> $@-t - @echo 'set target_alias $(target_alias)' >> $@-t - @echo 'set target_triplet $(target_triplet)' >> $@-t - @echo 'set build_alias $(build_alias)' >> $@-t - @echo 'set build_triplet $(build_triplet)' >> $@-t - @echo '## All variables above are generated by configure. Do Not Edit ##' >> $@-t - @test ! -f site.exp || sed '1,/^## All variables above are.*##/ d' site.exp >> $@-t + @echo '## these variables are automatically generated by make ##' >site.tmp + @echo '# Do not edit here. If you wish to override these values' >>site.tmp + @echo '# edit the last section' >>site.tmp + @echo 'set srcdir $(srcdir)' >>site.tmp + @echo "set objdir `pwd`" >>site.tmp + @echo 'set build_alias "$(build_alias)"' >>site.tmp + @echo 'set build_triplet $(build_triplet)' >>site.tmp + @echo 'set host_alias "$(host_alias)"' >>site.tmp + @echo 'set host_triplet $(host_triplet)' >>site.tmp + @echo 'set target_alias "$(target_alias)"' >>site.tmp + @echo 'set target_triplet $(target_triplet)' >>site.tmp + @echo '## All variables above are generated by configure. Do Not Edit ##' >>site.tmp + @test ! -f site.exp || \ + sed '1,/^## All variables above are.*##/ d' site.exp >> site.tmp + @-rm -f site.bak @test ! -f site.exp || mv site.exp site.bak - @mv $@-t site.exp -info-am: -info: info-recursive -dvi-am: -dvi: dvi-recursive + @mv site.tmp site.exp + +distclean-DEJAGNU: + -rm -f site.exp site.bak + -l='$(DEJATOOL)'; for tool in $$l; do \ + rm -f $$tool.sum $$tool.log; \ + done check-am: $(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU check: check-recursive -installcheck-am: -installcheck: installcheck-recursive -install-info-am: -install-info: install-info-recursive -all-recursive-am: config.h - $(MAKE) $(AM_MAKEFLAGS) all-recursive - -install-exec-am: install-binPROGRAMS install-exec-local +all-am: Makefile $(PROGRAMS) config.h +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-recursive install-exec: install-exec-recursive - -install-data-am: install-data: install-data-recursive +uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -install: install-recursive -uninstall-am: uninstall-binPROGRAMS -uninstall: uninstall-recursive -all-am: Makefile $(PROGRAMS) config.h -all-redirect: all-recursive-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install -installdirs: installdirs-recursive -installdirs-am: - $(mkinstalldirs) $(DESTDIR)$(bindir) - - + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) @@ -865,66 +860,123 @@ clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) - -rm -f config.cache config.log stamp-h stamp-h[0-9]* + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: - -test -z "arlex.cdeflex.crclex.carparse.harparse.cdefparse.hdefparse.cnlmheader.hnlmheader.crcparse.hrcparse.c" || rm -f arlex.c deflex.c rclex.c arparse.h arparse.c defparse.h defparse.c nlmheader.h nlmheader.c rcparse.h rcparse.c -mostlyclean-am: mostlyclean-hdr mostlyclean-binPROGRAMS \ - mostlyclean-noinstPROGRAMS mostlyclean-compile \ - mostlyclean-libtool mostlyclean-tags \ - mostlyclean-generic mostlyclean-local + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -rm -f arlex.c + -rm -f arparse.c + -rm -f arparse.h + -rm -f deflex.c + -rm -f defparse.c + -rm -f defparse.h + -rm -f nlmheader.c + -rm -f nlmheader.h + -rm -f rclex.c + -rm -f rcparse.c + -rm -f rcparse.h +clean: clean-recursive + +clean-am: clean-binPROGRAMS clean-generic clean-libtool \ + clean-noinstPROGRAMS mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -f Makefile +distclean-am: clean-am distclean-DEJAGNU distclean-compile \ + distclean-generic distclean-hdr distclean-libtool \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: install-binPROGRAMS install-exec-local + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive -clean-am: clean-hdr clean-binPROGRAMS clean-noinstPROGRAMS \ - clean-compile clean-libtool clean-tags clean-generic \ - mostlyclean-am +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool mostlyclean-local -clean: clean-recursive +pdf: pdf-recursive -distclean-am: distclean-hdr distclean-binPROGRAMS \ - distclean-noinstPROGRAMS distclean-compile \ - distclean-libtool distclean-tags distclean-generic \ - clean-am - -rm -f libtool +pdf-am: -distclean: distclean-recursive - -rm -f config.status +ps: ps-recursive -maintainer-clean-am: maintainer-clean-hdr maintainer-clean-binPROGRAMS \ - maintainer-clean-noinstPROGRAMS \ - maintainer-clean-compile maintainer-clean-libtool \ - maintainer-clean-tags maintainer-clean-generic \ - distclean-am - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." +ps-am: -maintainer-clean: maintainer-clean-recursive - -rm -f config.status +uninstall-am: uninstall-binPROGRAMS -.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \ -mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \ -maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \ -mostlyclean-noinstPROGRAMS distclean-noinstPROGRAMS \ -clean-noinstPROGRAMS maintainer-clean-noinstPROGRAMS \ -mostlyclean-compile distclean-compile clean-compile \ -maintainer-clean-compile mostlyclean-libtool distclean-libtool \ -clean-libtool maintainer-clean-libtool install-data-recursive \ -uninstall-data-recursive install-exec-recursive \ -uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \ -all-recursive check-recursive installcheck-recursive info-recursive \ -dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \ -maintainer-clean-recursive tags tags-recursive mostlyclean-tags \ -distclean-tags clean-tags maintainer-clean-tags distdir check-DEJAGNU \ -info-am info dvi-am dvi check check-am installcheck-am installcheck \ -install-info-am install-info all-recursive-am install-exec-local \ -install-exec-am install-exec install-data-am install-data install-am \ -install uninstall-am uninstall all-redirect all-am all installdirs-am \ -installdirs mostlyclean-generic distclean-generic clean-generic \ -maintainer-clean-generic clean mostlyclean distclean maintainer-clean +uninstall-info: uninstall-info-recursive +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \ + check-DEJAGNU check-am clean clean-binPROGRAMS clean-generic \ + clean-libtool clean-noinstPROGRAMS clean-recursive ctags \ + ctags-recursive distclean distclean-DEJAGNU distclean-compile \ + distclean-generic distclean-hdr distclean-libtool \ + distclean-recursive distclean-tags dvi dvi-am html html-am \ + info info-am install install-am install-binPROGRAMS \ + install-data install-data-am install-exec install-exec-am \ + install-exec-local install-info install-info-am install-man \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + maintainer-clean-recursive mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool mostlyclean-local \ + mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am uninstall-binPROGRAMS uninstall-info-am + + +.PHONY: install-html install-html-am install-html-recursive + +install-html: install-html-recursive + +install-html-recursive: + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" po/POTFILES.in: @MAINT@ Makefile for f in $(POTFILES); do echo $$f; done | LC_COLLATE= sort > tmp \ && mv tmp $(srcdir)/po/POTFILES.in @@ -933,10 +985,6 @@ check-DEJAGNU: site.exp srcdir=`cd $(srcdir) && pwd`; export srcdir; \ r=`pwd`; export r; \ EXPECT=$(EXPECT); export EXPECT; \ - if [ -f $(top_builddir)/../expect/expect ]; then \ - TCL_LIBRARY=`cd $(top_srcdir)/../tcl/library && pwd`; \ - export TCL_LIBRARY; \ - fi; \ runtest=$(RUNTEST); \ if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \ CC_FOR_TARGET="$(CC_FOR_TARGET)" CFLAGS_FOR_TARGET="$(CFLAGS)" \ @@ -978,20 +1026,20 @@ sysroff.h: sysinfo$(EXEEXT_FOR_BUILD) sysroff.info ./sysinfo$(EXEEXT_FOR_BUILD) -d <$(srcdir)/sysroff.info >sysroff.h sysinfo$(EXEEXT_FOR_BUILD): sysinfo.o syslex.o - $(CC_FOR_BUILD) $(CFLAGS) $(LDFLAGS) -o $@ sysinfo.o syslex.o + $(CC_FOR_BUILD) $(CFLAGS) $(LDFLAGS) -o $@ sysinfo.o syslex.o -syslex.o: syslex.c sysinfo.h +syslex.o: if [ -r syslex.c ]; then \ - $(CC_FOR_BUILD) -c -I. $(CFLAGS) syslex.c ; \ + $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS) syslex.c -Wno-error ; \ else \ - $(CC_FOR_BUILD) -c -I. -I$(srcdir) $(CFLAGS) $(srcdir)/syslex.c ;\ + $(CC_FOR_BUILD) -c -I. -I$(srcdir) $(AM_CFLAGS) $(CFLAGS) $(srcdir)/syslex.c -Wno-error ;\ fi -sysinfo.o: sysinfo.c +sysinfo.o: if [ -r sysinfo.c ]; then \ - $(CC_FOR_BUILD) -c -I. $(CFLAGS) sysinfo.c ; \ + $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS) sysinfo.c -Wno-error ; \ else \ - $(CC_FOR_BUILD) -c -I. $(CFLAGS) $(srcdir)/sysinfo.c ; \ + $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS) $(srcdir)/sysinfo.c -Wno-error ; \ fi # We need these for parallel make. @@ -1001,10 +1049,29 @@ nlmheader.h: nlmheader.c rcparse.h: rcparse.c sysinfo.h: sysinfo.c -dlltool.o:dlltool.c +# Disable -Werror, if it has been enabled, since old versions of bison/ +# yacc will produce working code which contain compile time warnings. +arparse.o: + $(COMPILE) -c $< $(NO_WERROR) +arlex.o: + $(COMPILE) -c $< $(NO_WERROR) +sysroff.o: + $(COMPILE) -c $< $(NO_WERROR) +defparse.o: + $(COMPILE) -c $< $(NO_WERROR) +deflex.o: + $(COMPILE) -c $< $(NO_WERROR) +nlmheader.o: + $(COMPILE) -c $< $(NO_WERROR) +rcparse.o: + $(COMPILE) -c $< $(NO_WERROR) +rclex.o: + $(COMPILE) -c $< $(NO_WERROR) + +dlltool.o: $(COMPILE) -c $(DLLTOOL_DEFS) $(srcdir)/dlltool.c -rescoff.o:rescoff.c +rescoff.o: $(COMPILE) -c $(DLLTOOL_DEFS) $(srcdir)/rescoff.c # coff/sym.h and coff/ecoff.h won't be found by the automatic dependency @@ -1014,8 +1081,7 @@ nlmconv.o: nlmconv.c $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h $(COMPILE) -c -DLD_NAME="\"$${ldname}\"" @NLMCONV_DEFS@ $(srcdir)/nlmconv.c diststuff: $(EXTRA_DIST) info - -Makefile: $(BFDDIR)/configure.in +all: info # Targets to rebuild dependencies in this Makefile. # Have to get rid of DEP1 here so that "$?" later includes all of $(CFILES). @@ -1091,15 +1157,15 @@ install-exec-local: install-binPROGRAMS $(bin_PROGRAMS) $(noinst_PROGRAMS) # DO NOT DELETE THIS LINE -- mkdep uses it. # DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. -addr2line.o: addr2line.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ +addr2line.o: addr2line.c config.h ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h $(INCDIR)/getopt.h $(INCDIR)/libiberty.h \ - $(INCDIR)/demangle.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/demangle.h bucomm.h $(INCDIR)/bin-bugs.h \ $(INCDIR)/fopen-same.h budemang.h ar.o: ar.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \ $(INCDIR)/libiberty.h $(INCDIR)/progress.h bucomm.h \ config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/aout/ar.h $(BFDDIR)/libbfd.h arsup.h $(INCDIR)/filenames.h \ - binemul.h + $(INCDIR)/aout/ar.h $(BFDDIR)/libbfd.h $(INCDIR)/hashtab.h \ + arsup.h $(INCDIR)/filenames.h binemul.h arsup.o: arsup.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h arsup.h $(INCDIR)/libiberty.h bucomm.h \ config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ @@ -1110,7 +1176,7 @@ binemul.o: binemul.c binemul.h ../bfd/bfd.h $(INCDIR)/ansidecl.h \ bucomm.o: bucomm.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h ../bfd/bfdver.h $(INCDIR)/libiberty.h \ bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/filenames.h $(BFDDIR)/libbfd.h + $(INCDIR)/filenames.h $(BFDDIR)/libbfd.h $(INCDIR)/hashtab.h budemang.o: budemang.c config.h ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h $(INCDIR)/libiberty.h $(INCDIR)/demangle.h \ budemang.h @@ -1124,6 +1190,10 @@ coffgrok.o: coffgrok.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ cxxfilt.o: cxxfilt.c config.h ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h bucomm.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ $(INCDIR)/libiberty.h $(INCDIR)/demangle.h $(INCDIR)/safe-ctype.h +dwarf.o: dwarf.c dwarf.h ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/symcat.h $(INCDIR)/elf/dwarf2.h bucomm.h \ + config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/libiberty.h debug.o: debug.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h debug.h @@ -1168,13 +1238,15 @@ not-strip.o: not-strip.c objcopy.o: objcopy.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h $(INCDIR)/progress.h bucomm.h config.h \ $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ - budbg.h $(INCDIR)/filenames.h $(INCDIR)/fnmatch.h + budbg.h $(INCDIR)/filenames.h $(INCDIR)/fnmatch.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(BFDDIR)/libbfd.h objdump.o: objdump.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h ../bfd/bfdver.h $(INCDIR)/progress.h \ bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ - budemang.h $(INCDIR)/safe-ctype.h $(INCDIR)/dis-asm.h \ - $(INCDIR)/libiberty.h $(INCDIR)/demangle.h debug.h \ - budbg.h $(INCDIR)/aout/aout64.h + dwarf.h $(INCDIR)/elf/dwarf2.h budemang.h $(INCDIR)/safe-ctype.h \ + $(INCDIR)/dis-asm.h $(INCDIR)/libiberty.h $(INCDIR)/demangle.h \ + debug.h budbg.h $(INCDIR)/aout/aout64.h prdbg.o: prdbg.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h debug.h \ @@ -1188,24 +1260,25 @@ rddbg.o: rddbg.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h debug.h \ budbg.h -readelf.o: readelf.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/symcat.h $(INCDIR)/elf/common.h $(INCDIR)/elf/external.h \ - $(INCDIR)/elf/internal.h $(INCDIR)/elf/dwarf2.h $(INCDIR)/elf/alpha.h \ +readelf.o: readelf.c dwarf.h ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/symcat.h $(INCDIR)/elf/dwarf2.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/external.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/alpha.h \ $(INCDIR)/elf/reloc-macros.h $(INCDIR)/elf/arc.h $(INCDIR)/elf/arm.h \ - $(INCDIR)/elf/avr.h $(INCDIR)/elf/cris.h $(INCDIR)/elf/d10v.h \ - $(INCDIR)/elf/d30v.h $(INCDIR)/elf/dlx.h $(INCDIR)/elf/fr30.h \ - $(INCDIR)/elf/frv.h $(INCDIR)/elf/h8.h $(INCDIR)/elf/hppa.h \ - $(INCDIR)/elf/i386.h $(INCDIR)/elf/i370.h $(INCDIR)/elf/i860.h \ - $(INCDIR)/elf/i960.h $(INCDIR)/elf/ia64.h $(INCDIR)/elf/ip2k.h \ - $(INCDIR)/elf/m32r.h $(INCDIR)/elf/m68k.h $(INCDIR)/elf/m68hc11.h \ - $(INCDIR)/elf/mcore.h $(INCDIR)/elf/mips.h $(INCDIR)/elf/mmix.h \ - $(INCDIR)/elf/mn10200.h $(INCDIR)/elf/mn10300.h $(INCDIR)/elf/msp430.h \ + $(INCDIR)/elf/avr.h $(INCDIR)/elf/bfin.h $(INCDIR)/elf/cris.h \ + $(INCDIR)/elf/d10v.h $(INCDIR)/elf/d30v.h $(INCDIR)/elf/dlx.h \ + $(INCDIR)/elf/fr30.h $(INCDIR)/elf/frv.h $(INCDIR)/elf/h8.h \ + $(INCDIR)/elf/hppa.h $(INCDIR)/elf/i386.h $(INCDIR)/elf/i370.h \ + $(INCDIR)/elf/i860.h $(INCDIR)/elf/i960.h $(INCDIR)/elf/ia64.h \ + $(INCDIR)/elf/ip2k.h $(INCDIR)/elf/m32c.h $(INCDIR)/elf/m32r.h \ + $(INCDIR)/elf/m68k.h $(INCDIR)/elf/m68hc11.h $(INCDIR)/elf/mcore.h \ + $(INCDIR)/elf/mips.h $(INCDIR)/elf/mmix.h $(INCDIR)/elf/mn10200.h \ + $(INCDIR)/elf/mn10300.h $(INCDIR)/elf/mt.h $(INCDIR)/elf/msp430.h \ $(INCDIR)/elf/or32.h $(INCDIR)/elf/pj.h $(INCDIR)/elf/ppc.h \ $(INCDIR)/elf/ppc64.h $(INCDIR)/elf/s390.h $(INCDIR)/elf/sh.h \ $(INCDIR)/elf/sparc.h $(INCDIR)/elf/v850.h $(INCDIR)/elf/vax.h \ - $(INCDIR)/elf/x86-64.h $(INCDIR)/elf/xstormy16.h $(INCDIR)/elf/iq2000.h \ - $(INCDIR)/elf/xtensa.h $(INCDIR)/aout/ar.h bucomm.h \ - config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/elf/x86-64.h $(INCDIR)/elf/xstormy16.h $(INCDIR)/elf/crx.h \ + $(INCDIR)/elf/iq2000.h $(INCDIR)/elf/xtensa.h $(INCDIR)/aout/ar.h \ + bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ $(INCDIR)/libiberty.h unwind-ia64.h rename.o: rename.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ @@ -1251,11 +1324,10 @@ sysdump.o: sysdump.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ version.o: version.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h ../bfd/bfdver.h bucomm.h config.h \ $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h -windres.o: windres.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/symcat.h $(INCDIR)/getopt.h bucomm.h config.h \ - $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ - $(INCDIR)/safe-ctype.h $(INCDIR)/obstack.h windres.h \ - winduni.h +windres.o: windres.c config.h ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/symcat.h bucomm.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ + $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h $(INCDIR)/obstack.h \ + windres.h winduni.h winduni.o: winduni.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ $(INCDIR)/fopen-same.h winduni.h $(INCDIR)/safe-ctype.h @@ -1271,7 +1343,7 @@ arlex.o: arlex.c $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ arparse.h sysroff.o: sysroff.c sysinfo.o: sysinfo.c -syslex.o: syslex.c sysinfo.h +syslex.o: syslex.c config.h sysinfo.h defparse.o: defparse.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ $(INCDIR)/fopen-same.h dlltool.h @@ -1290,7 +1362,6 @@ rclex.o: rclex.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h \ windres.h winduni.h rcparse.h # IF YOU PUT ANYTHING HERE IT WILL GO AWAY - # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/contrib/binutils/binutils/NEWS b/contrib/binutils/binutils/NEWS index a72826ef873..d12450e3892 100644 --- a/contrib/binutils/binutils/NEWS +++ b/contrib/binutils/binutils/NEWS @@ -1,5 +1,66 @@ -*- text -*- +* Add "-x NAME" to readelf in addition to "-x NUMBER". + +* Add -i and -t switches to cxxfilt. -i disables the display of implementation + specific extra demangling information (if any) and -t disables the demangling + of types. + +* Add support for the "@" syntax to the command lines of all tools, so + that extra switches can be read from . + +* Add "-W/--dwarf" to objdump to display the contents of the DWARF + debug sections. + +* Add "-t/--section-details" to readelf to display section details. + "-N/--full-section-name" is deprecated. + +* powerpc-linux ld now supports a variant form of PLT and GOT for the security + conscious. This form will automatically be chosen when ld detects that all + code in regular object files was generated by gcc -msecure-plt. The old PLT + and GOT may be forced by a new ld option, --bss-plt. + +* Add "-i/--inlines" to addr2line to print enclosing scope information + for inlined function chains, back to first non-inlined function. + +* Add "-N/--full-section-name" to readelf to display full section name. + +* Add "-M entry:" switch to objdump to specify a function entry address + when disassembling VAX binaries. + +* Add "--globalize-symbol " and "--globalize-symbols " switches + to objcopy to convert local symbols into global symbols. + +Changes in 2.16: + +* Add "-g/--section-groups" to readelf to display section groups. + +* objcopy recognizes two new options --strip-unneeded-symbol and + --strip-unneeded-symbols, namely for use together with the wildcard + matching the original --strip-symbol/--strip-symbols provided, but + retaining any symbols matching but needed by relocations. + +* readelf can now display address ranges from .debug_range sections. This + happens automatically when a DW_AT_range attribute is encountered. The + command line switch --debug-dump=Ranges (or -wR) can also be used to display + the contents of the .debug_range section. + +* nm and objdump now have a switch "--special-syms" to enable the displaying of + symbols which the target considers to be special. By default these symbols + are no longer displayed. Currently the only special symbols are the Mapping + symbols used by the ARM port to mark transitions between text and data and + between ARM and THUMB code. + +* dlltool has a switch "--ext-prefix-alias " to generate additional + import and export symbols with prepended to them. + +Changes in 2.15: + +* objcopy for MIPS targets now accepts "-M no-aliases" as an option to the + disassembler to print the "raw" mips instruction mnemonic instead of some + pseudo instruction name. I.E. print "daddu" or "or" instead of "move", + "sll" instead of "nop", etc. + * objcopy and strip can now take wildcard patterns in symbol names specified on the command line provided that the --wildcard switch is used to enable them. diff --git a/contrib/binutils/binutils/acinclude.m4 b/contrib/binutils/binutils/acinclude.m4 index c5ae4d46859..71b09b9f6ac 100644 --- a/contrib/binutils/binutils/acinclude.m4 +++ b/contrib/binutils/binutils/acinclude.m4 @@ -1,32 +1 @@ sinclude(../bfd/acinclude.m4) - -dnl sinclude(../libtool.m4) already included in bfd/acinclude.m4 -dnl The lines below arrange for aclocal not to bring libtool.m4 -dnl AM_PROG_LIBTOOL into aclocal.m4, while still arranging for automake -dnl to add a definition of LIBTOOL to Makefile.in. -ifelse(yes,no,[ -AC_DEFUN([AM_PROG_LIBTOOL],) -AC_SUBST(LIBTOOL) -]) - -dnl sinclude(../gettext.m4) already included in bfd/acinclude.m4 -ifelse(yes,no,[ -AC_DEFUN([CY_WITH_NLS],) -AC_SUBST(INTLLIBS) -]) - -## Replacement for AC_PROG_LEX and AC_DECL_YYTEXT -## by Alexandre Oliva - -## We need to override the installed aclocal/lex.m4 because of a bug in -## this definition in the recommended automake snapshot of 000227: -## There were double-quotes around ``$missing_dir/missing flex'' which was -## bad since aclocal wraps it in double-quotes. - -dnl AM_PROG_LEX -dnl Look for flex, lex or missing, then run AC_PROG_LEX and AC_DECL_YYTEXT -AC_DEFUN([AM_PROG_LEX], -[missing_dir=ifelse([$1],,`cd $ac_aux_dir && pwd`,$1) -AC_CHECK_PROGS(LEX, flex lex, [$missing_dir/missing flex]) -AC_PROG_LEX -AC_DECL_YYTEXT]) diff --git a/contrib/binutils/binutils/aclocal.m4 b/contrib/binutils/binutils/aclocal.m4 index d1f4a36bbf4..cd4267338b7 100644 --- a/contrib/binutils/binutils/aclocal.m4 +++ b/contrib/binutils/binutils/aclocal.m4 @@ -1,115 +1,771 @@ -dnl aclocal.m4 generated automatically by aclocal 1.4-p5 +# generated automatically by aclocal 1.9.6 -*- Autoconf -*- -dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -dnl This program is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without -dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A -dnl PARTICULAR PURPOSE. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. -sinclude(../bfd/acinclude.m4) +# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -dnl sinclude(../libtool.m4) already included in bfd/acinclude.m4 -dnl The lines below arrange for aclocal not to bring libtool.m4 -dnl AM_PROG_LIBTOOL into aclocal.m4, while still arranging for automake -dnl to add a definition of LIBTOOL to Makefile.in. -ifelse(yes,no,[ -AC_DEFUN([AM_PROG_LIBTOOL],) -AC_SUBST(LIBTOOL) +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"]) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION so it can be traced. +# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], + [AM_AUTOMAKE_VERSION([1.9.6])]) + +# AM_AUX_DIR_EXPAND -*- Autoconf -*- + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to +# `$srcdir', `$srcdir/..', or `$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is `.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[dnl Rely on autoconf to set up CDPATH properly. +AC_PREREQ([2.50])dnl +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` ]) -dnl sinclude(../gettext.m4) already included in bfd/acinclude.m4 -ifelse(yes,no,[ -AC_DEFUN([CY_WITH_NLS],) -AC_SUBST(INTLLIBS) +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 7 + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ(2.52)dnl + ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE]) +AC_SUBST([$1_FALSE]) +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) +fi])]) + + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 8 + +# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "GCJ", or "OBJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +ifelse([$1], CC, [depcc="$CC" am_compiler_list=], + [$1], CXX, [depcc="$CXX" am_compiler_list=], + [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +AM_CONDITIONAL([am__fastdep$1], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES +AC_DEFUN([AM_SET_DEPDIR], +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl +]) -dnl AM_PROG_LEX -dnl Look for flex, lex or missing, then run AC_PROG_LEX and AC_DECL_YYTEXT -AC_DEFUN(AM_PROG_LEX, -[missing_dir=ifelse([$1],,`cd $ac_aux_dir && pwd`,$1) -AC_CHECK_PROGS(LEX, flex lex, [$missing_dir/missing flex]) -AC_PROG_LEX -AC_DECL_YYTEXT]) -#serial 1 -# This test replaces the one in autoconf. -# Currently this macro should have the same name as the autoconf macro -# because gettext's gettext.m4 (distributed in the automake package) -# still uses it. Otherwise, the use in gettext.m4 makes autoheader -# give these diagnostics: -# configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX -# configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE(dependency-tracking, +[ --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH]) +]) -undefine([AC_ISC_POSIX]) +# Generate code to set up dependency tracking. -*- Autoconf -*- -AC_DEFUN([AC_ISC_POSIX], - [ - dnl This test replaces the obsolescent AC_ISC_POSIX kludge. - AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"]) - ] -) +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# Do all the work for Automake. This macro actually does too much -- -# some checks are only needed if your package does certain things. -# But this isn't really a big deal. +#serial 3 -# serial 1 +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # So let's grep whole file. + if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + dirpart=`AS_DIRNAME("$mf")` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`AS_DIRNAME(["$file"])` + AS_MKDIR_P([$dirpart/$fdir]) + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done +])# _AM_OUTPUT_DEPENDENCY_COMMANDS -dnl Usage: -dnl AM_INIT_AUTOMAKE(package,version, [no-define]) +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking +# is enabled. FIXME. This creates each `.P' file that we will +# need in order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) +]) + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 8 + +# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. +AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) + +# Do all the work for Automake. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 12 + +# This macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], -[AC_REQUIRE([AC_PROG_INSTALL]) -PACKAGE=[$1] -AC_SUBST(PACKAGE) -VERSION=[$2] -AC_SUBST(VERSION) -dnl test to see if srcdir already configured -if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then +[AC_PREREQ([2.58])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl +# test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi -ifelse([$3],, -AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) -AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])) -AC_REQUIRE([AM_SANITY_CHECK]) -AC_REQUIRE([AC_ARG_PROGRAM]) -dnl FIXME This is truly gross. -missing_dir=`cd $ac_aux_dir && pwd` -AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) -AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) -AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) -AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) -AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) -AC_REQUIRE([AC_PROG_MAKE_SET])]) -# -# Check to make sure that the build environment is sane. -# +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) + AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) +AM_MISSING_PROG(AUTOCONF, autoconf) +AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) +AM_MISSING_PROG(AUTOHEADER, autoheader) +AM_MISSING_PROG(MAKEINFO, makeinfo) +AM_PROG_INSTALL_SH +AM_PROG_INSTALL_STRIP +AC_REQUIRE([AM_PROG_MKDIR_P])dnl +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES(CC)], + [define([AC_PROG_CC], + defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES(CXX)], + [define([AC_PROG_CXX], + defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl +]) +]) + + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $1 | $1:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +install_sh=${install_sh-"$am_aux_dir/install-sh"} +AC_SUBST(install_sh)]) + +# Copyright (C) 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# Check whether the underlying file-system supports filenames +# with a leading dot. For instance MS-DOS doesn't. +AC_DEFUN([AM_SET_LEADING_DOT], +[rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null +AC_SUBST([am__leading_dot])]) + +# Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 5 + +# AM_PROG_LEX +# ----------- +# Autoconf leaves LEX=: if lex or flex can't be found. Change that to a +# "missing" invocation, for better error output. +AC_DEFUN([AM_PROG_LEX], +[AC_PREREQ(2.50)dnl +AC_REQUIRE([AM_MISSING_HAS_RUN])dnl +AC_REQUIRE([AC_PROG_LEX])dnl +if test "$LEX" = :; then + LEX=${am_missing_run}flex +fi]) + +# Add --enable-maintainer-mode option to configure. -*- Autoconf -*- +# From Jim Meyering + +# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +AC_DEFUN([AM_MAINTAINER_MODE], +[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) + dnl maintainer-mode is disabled by default + AC_ARG_ENABLE(maintainer-mode, +[ --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer], + USE_MAINTAINER_MODE=$enableval, + USE_MAINTAINER_MODE=no) + AC_MSG_RESULT([$USE_MAINTAINER_MODE]) + AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes]) + MAINT=$MAINTAINER_MODE_TRUE + AC_SUBST(MAINT)dnl +] +) + +AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE]) + +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 3 + +# AM_MAKE_INCLUDE() +# ----------------- +# Check to see how make treats includes. +AC_DEFUN([AM_MAKE_INCLUDE], +[am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +AC_MSG_CHECKING([for style of include used by $am_make]) +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi +AC_SUBST([am__include]) +AC_SUBST([am__quote]) +AC_MSG_RESULT([$_am_result]) +rm -f confinc confmf +]) + +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- + +# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it supports --run. +# If it does, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + AC_MSG_WARN([`missing' script is too old or missing]) +fi +]) + +# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_MKDIR_P +# --------------- +# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. +# +# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories +# created by `make install' are always world readable, even if the +# installer happens to have an overly restrictive umask (e.g. 077). +# This was a mistake. There are at least two reasons why we must not +# use `-m 0755': +# - it causes special bits like SGID to be ignored, +# - it may be too restrictive (some setups expect 775 directories). +# +# Do not use -m 0755 and let people choose whatever they expect by +# setting umask. +# +# We cannot accept any implementation of `mkdir' that recognizes `-p'. +# Some implementations (such as Solaris 8's) are not thread-safe: if a +# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c' +# concurrently, both version can detect that a/ is missing, but only +# one can create it and the other will error out. Consequently we +# restrict ourselves to GNU make (using the --version option ensures +# this.) +AC_DEFUN([AM_PROG_MKDIR_P], +[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then + # We used to keeping the `.' as first argument, in order to + # allow $(mkdir_p) to be used without argument. As in + # $(mkdir_p) $(somedir) + # where $(somedir) is conditionally defined. However this is wrong + # for two reasons: + # 1. if the package is installed by a user who cannot write `.' + # make install will fail, + # 2. the above comment should most certainly read + # $(mkdir_p) $(DESTDIR)$(somedir) + # so it does not work when $(somedir) is undefined and + # $(DESTDIR) is not. + # To support the latter case, we have to write + # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), + # so the `.' trick is pointless. + mkdir_p='mkdir -p --' +else + # On NextStep and OpenStep, the `mkdir' command does not + # recognize any option. It will interpret all options as + # directories to create, and then abort because `.' already + # exists. + for d in ./-p ./--version; + do + test -d $d && rmdir $d + done + # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. + if test -f "$ac_aux_dir/mkinstalldirs"; then + mkdir_p='$(mkinstalldirs)' + else + mkdir_p='$(install_sh) -d' + fi +fi +AC_SUBST([mkdir_p])]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 3 + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# ------------------------------ +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) + +# _AM_SET_OPTIONS(OPTIONS) +# ---------------------------------- +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +# AM_SANITY_CHECK +# --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 -echo timestamp > conftestfile +echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( - set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` - if test "[$]*" = "X"; then + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$[*]" = "X"; then # -L didn't work. - set X `ls -t $srcdir/configure conftestfile` + set X `ls -t $srcdir/configure conftest.file` fi - if test "[$]*" != "X $srcdir/configure conftestfile" \ - && test "[$]*" != "X conftestfile $srcdir/configure"; then + rm -f conftest.file + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a @@ -119,7 +775,7 @@ if ( alias in your environment]) fi - test "[$]2" = conftestfile + test "$[2]" = conftest.file ) then # Ok. @@ -128,78 +784,130 @@ else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi -rm -f conftest* AC_MSG_RESULT(yes)]) -dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) -dnl The program must properly implement --version. -AC_DEFUN([AM_MISSING_PROG], -[AC_MSG_CHECKING(for working $2) -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if ($2 --version) < /dev/null > /dev/null 2>&1; then - $1=$2 - AC_MSG_RESULT(found) -else - $1="$3/missing $2" - AC_MSG_RESULT(missing) +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_STRIP +# --------------------- +# One issue with vendor `install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in `make install-strip', and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be `maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) fi -AC_SUBST($1)]) +INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) -# Like AC_CONFIG_HEADER, but automatically create stamp file. +# Check how to create a tarball. -*- Autoconf -*- -AC_DEFUN([AM_CONFIG_HEADER], -[AC_PREREQ([2.12]) -AC_CONFIG_HEADER([$1]) -dnl When config.status generates a header, we must update the stamp-h file. -dnl This file resides in the same directory as the config header -dnl that is generated. We must strip everything past the first ":", -dnl and everything past the last "/". -AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl -ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>, -<>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>, -<>; do - case " <<$>>CONFIG_HEADERS " in - *" <<$>>am_file "*<<)>> - echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx +# Copyright (C) 2004, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of `v7', `ustar', or `pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. +AM_MISSING_PROG([AMTAR], [tar]) +m4_if([$1], [v7], + [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], + [m4_case([$1], [ustar],, [pax],, + [m4_fatal([Unknown tar format])]) +AC_MSG_CHECKING([how to create a $1 tar archive]) +# Loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' +_am_tools=${am_cv_prog_tar_$1-$_am_tools} +# Do not fold the above two line into one, because Tru64 sh and +# Solaris sh will not grok spaces in the rhs of `-'. +for _am_tool in $_am_tools +do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; + do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false ;; esac - am_indx=`expr "<<$>>am_indx" + 1` -done<<>>dnl>>) -changequote([,]))]) -# Add --enable-maintainer-mode option to configure. -# From Jim Meyering + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break -# serial 1 + # tar/untar a dummy directory, and stop if the command works + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar /dev/null 2>&1 && break + fi +done +rm -rf conftest.dir -AC_DEFUN([AM_MAINTAINER_MODE], -[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) - dnl maintainer-mode is disabled by default - AC_ARG_ENABLE(maintainer-mode, -[ --enable-maintainer-mode enable make rules and dependencies not useful - (and sometimes confusing) to the casual installer], - USE_MAINTAINER_MODE=$enableval, - USE_MAINTAINER_MODE=no) - AC_MSG_RESULT($USE_MAINTAINER_MODE) - AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes) - MAINT=$MAINTAINER_MODE_TRUE - AC_SUBST(MAINT)dnl -] -) - -# Define a conditional. - -AC_DEFUN([AM_CONDITIONAL], -[AC_SUBST($1_TRUE) -AC_SUBST($1_FALSE) -if $2; then - $1_TRUE= - $1_FALSE='#' -else - $1_TRUE='#' - $1_FALSE= -fi]) +AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) +AC_MSG_RESULT([$am_cv_prog_tar_$1])]) +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR +m4_include([acinclude.m4]) diff --git a/contrib/binutils/binutils/addr2line.c b/contrib/binutils/binutils/addr2line.c index 354153eadb1..7cd67bc0a1b 100644 --- a/contrib/binutils/binutils/addr2line.c +++ b/contrib/binutils/binutils/addr2line.c @@ -1,5 +1,5 @@ /* addr2line.c -- convert addresses to line number and function name - Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003 + Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006 Free Software Foundation, Inc. Contributed by Ulrich Lauther @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* Derived from objdump.c and nm.c by Ulrich.Lauther@mchp.siemens.de @@ -29,6 +29,7 @@ both forms write results to stdout, the second form reads addresses to be converted from stdin. */ +#include "config.h" #include #include "bfd.h" @@ -38,6 +39,7 @@ #include "bucomm.h" #include "budemang.h" +static bfd_boolean unwind_inlines; /* -i, unwind inlined functions. */ static bfd_boolean with_functions; /* -f, show function names. */ static bfd_boolean do_demangle; /* -C, demangle names. */ static bfd_boolean base_names; /* -s, strip directory names. */ @@ -53,6 +55,8 @@ static struct option long_options[] = {"demangle", optional_argument, NULL, 'C'}, {"exe", required_argument, NULL, 'e'}, {"functions", no_argument, NULL, 'f'}, + {"inlines", no_argument, NULL, 'i'}, + {"section", required_argument, NULL, 'j'}, {"target", required_argument, NULL, 'b'}, {"help", no_argument, NULL, 'H'}, {"version", no_argument, NULL, 'V'}, @@ -62,8 +66,9 @@ static struct option long_options[] = static void usage (FILE *, int); static void slurp_symtab (bfd *); static void find_address_in_section (bfd *, asection *, void *); -static void translate_addresses (bfd *); -static void process_file (const char *, const char *); +static void find_offset_in_section (bfd *, asection *); +static void translate_addresses (bfd *, asection *); +static void process_file (const char *, const char *, const char *); /* Print a usage message to STREAM and exit with STATUS. */ @@ -74,8 +79,11 @@ usage (FILE *stream, int status) fprintf (stream, _(" Convert addresses into line number/file name pairs.\n")); fprintf (stream, _(" If no addresses are specified on the command line, they will be read from stdin\n")); fprintf (stream, _(" The options are:\n\ + @ Read options from \n\ -b --target= Set the binary file format\n\ -e --exe= Set the input file name (default is a.out)\n\ + -i --inlines Unwind inlined functions\n\ + -j --section= Read section-relative offsets instead of addresses\n\ -s --basenames Strip directory names\n\ -f --functions Show function names\n\ -C --demangle[=style] Demangle function names\n\ @@ -137,7 +145,7 @@ find_address_in_section (bfd *abfd, asection *section, if (pc < vma) return; - size = bfd_get_section_size_before_reloc (section); + size = bfd_get_section_size (section); if (pc >= vma + size) return; @@ -145,11 +153,32 @@ find_address_in_section (bfd *abfd, asection *section, &filename, &functionname, &line); } +/* Look for an offset in a section. This is directly called. */ + +static void +find_offset_in_section (bfd *abfd, asection *section) +{ + bfd_size_type size; + + if (found) + return; + + if ((bfd_get_section_flags (abfd, section) & SEC_ALLOC) == 0) + return; + + size = bfd_get_section_size (section); + if (pc >= size) + return; + + found = bfd_find_nearest_line (abfd, section, syms, pc, + &filename, &functionname, &line); +} + /* Read hexadecimal addresses from stdin, translate into file_name:line_number and optionally function name. */ static void -translate_addresses (bfd *abfd) +translate_addresses (bfd *abfd, asection *section) { int read_stdin = (naddr == 0); @@ -172,7 +201,10 @@ translate_addresses (bfd *abfd) } found = FALSE; - bfd_map_over_sections (abfd, find_address_in_section, NULL); + if (section) + find_offset_in_section (abfd, section); + else + bfd_map_over_sections (abfd, find_address_in_section, NULL); if (! found) { @@ -182,36 +214,43 @@ translate_addresses (bfd *abfd) } else { - if (with_functions) - { - const char *name; - char *alloc = NULL; + do { + if (with_functions) + { + const char *name; + char *alloc = NULL; - name = functionname; - if (name == NULL || *name == '\0') - name = "??"; - else if (do_demangle) - { - alloc = demangle (abfd, name); - name = alloc; - } + name = functionname; + if (name == NULL || *name == '\0') + name = "??"; + else if (do_demangle) + { + alloc = demangle (abfd, name); + name = alloc; + } - printf ("%s\n", name); + printf ("%s\n", name); - if (alloc != NULL) - free (alloc); - } + if (alloc != NULL) + free (alloc); + } - if (base_names && filename != NULL) - { - char *h; + if (base_names && filename != NULL) + { + char *h; - h = strrchr (filename, '/'); - if (h != NULL) - filename = h + 1; - } + h = strrchr (filename, '/'); + if (h != NULL) + filename = h + 1; + } + + printf ("%s:%u\n", filename ? filename : "??", line); + if (!unwind_inlines) + found = FALSE; + else + found = bfd_find_inliner_info (abfd, &filename, &functionname, &line); + } while (found); - printf ("%s:%u\n", filename ? filename : "??", line); } /* fflush() is essential for using this command as a server @@ -225,9 +264,11 @@ translate_addresses (bfd *abfd) /* Process a file. */ static void -process_file (const char *file_name, const char *target) +process_file (const char *file_name, const char *section_name, + const char *target) { bfd *abfd; + asection *section; char **matching; if (get_file_size (file_name) < 1) @@ -238,7 +279,7 @@ process_file (const char *file_name, const char *target) bfd_fatal (file_name); if (bfd_check_format (abfd, bfd_archive)) - fatal (_("%s: can not get addresses from archive"), file_name); + fatal (_("%s: cannot get addresses from archive"), file_name); if (! bfd_check_format_matches (abfd, bfd_object, &matching)) { @@ -251,9 +292,18 @@ process_file (const char *file_name, const char *target) xexit (1); } + if (section_name != NULL) + { + section = bfd_get_section_by_name (abfd, section_name); + if (section == NULL) + fatal (_("%s: cannot find section %s"), file_name, section_name); + } + else + section = NULL; + slurp_symtab (abfd); - translate_addresses (abfd); + translate_addresses (abfd, section); if (syms != NULL) { @@ -264,12 +314,11 @@ process_file (const char *file_name, const char *target) bfd_close (abfd); } -int main (int, char **); - int main (int argc, char **argv) { const char *file_name; + const char *section_name; char *target; int c; @@ -285,12 +334,15 @@ main (int argc, char **argv) program_name = *argv; xmalloc_set_program_name (program_name); + expandargv (&argc, &argv); + bfd_init (); set_default_bfd_target (); file_name = NULL; + section_name = NULL; target = NULL; - while ((c = getopt_long (argc, argv, "b:Ce:sfHhVv", long_options, (int *) 0)) + while ((c = getopt_long (argc, argv, "b:Ce:sfHhij:Vv", long_options, (int *) 0)) != EOF) { switch (c) @@ -331,6 +383,12 @@ main (int argc, char **argv) case 'H': usage (stdout, 0); break; + case 'i': + unwind_inlines = TRUE; + break; + case 'j': + section_name = optarg; + break; default: usage (stderr, 1); break; @@ -343,7 +401,7 @@ main (int argc, char **argv) addr = argv + optind; naddr = argc - optind; - process_file (file_name, target); + process_file (file_name, section_name, target); return 0; } diff --git a/contrib/binutils/binutils/ar.c b/contrib/binutils/binutils/ar.c index ec0657d638c..fe1c6402222 100644 --- a/contrib/binutils/binutils/ar.c +++ b/contrib/binutils/binutils/ar.c @@ -1,6 +1,6 @@ /* ar.c - Archive modify and extract. Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003, 2004 + 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* Bugs: should use getopt the way tar does (complete w/optional -) and @@ -49,8 +49,6 @@ #define O_BINARY 0 #endif -#define BUFSIZE 8192 - /* Kludge declaration from BFD! This is ugly! FIXME! XXX */ struct ar_hdr * @@ -65,11 +63,6 @@ static void map_over_members (bfd *, void (*)(bfd *), char **, int); static void print_contents (bfd * member); static void delete_members (bfd *, char **files_to_delete); -#if 0 -static void do_quick_append - (const char *archive_filename, char **files_to_append); -#endif - static void move_members (bfd *, char **files_to_move); static void replace_members (bfd *, char **files_to_replace, bfd_boolean quick); @@ -81,7 +74,7 @@ static void usage (int); /** Globals and flags */ -int mri_mode; +static int mri_mode; /* This flag distinguishes between ar and ranlib: 1 means this is 'ranlib'; 0 means this is 'ar'. @@ -249,7 +242,8 @@ usage (int help) fprintf (s, _(" [S] - do not build a symbol table\n")); fprintf (s, _(" [v] - be verbose\n")); fprintf (s, _(" [V] - display the version number\n")); - + fprintf (s, _(" @ - read options from \n")); + ar_emul_usage (s); } else @@ -258,6 +252,7 @@ usage (int help) fprintf (s, _("Usage: %s [options] archive\n"), program_name); fprintf (s, _(" Generate an index to speed access to archives\n")); fprintf (s, _(" The options are:\n\ + @ Read options from \n\ -h --help Print this help message\n\ -V --version Print version information\n")); } @@ -328,7 +323,7 @@ remove_output (void) bfd_cache_close (output_bfd); if (output_file != NULL) fclose (output_file); - unlink (output_filename); + unlink_if_ordinary (output_filename); } } @@ -367,6 +362,8 @@ main (int argc, char **argv) program_name = argv[0]; xmalloc_set_program_name (program_name); + expandargv (&argc, &argv); + if (is_ranlib < 0) { char *temp; @@ -589,6 +586,10 @@ main (int argc, char **argv) { bfd *arch; + /* We don't use do_quick_append any more. Too many systems + expect ar to always rebuild the symbol table even when q is + used. */ + /* We can't write an armap when using ar q, so just do ar r instead. */ if (operation == quick_append && write_armap) @@ -624,39 +625,6 @@ main (int argc, char **argv) files = arg_index < argc ? argv + arg_index : NULL; file_count = argc - arg_index; -#if 0 - /* We don't use do_quick_append any more. Too many systems - expect ar to always rebuild the symbol table even when q is - used. */ - - /* We can't do a quick append if we need to construct an - extended name table, because do_quick_append won't be able to - rebuild the name table. Unfortunately, at this point we - don't actually know the maximum name length permitted by this - object file format. So, we guess. FIXME. */ - if (operation == quick_append && ! ar_truncate) - { - char **chk; - - for (chk = files; chk != NULL && *chk != '\0'; chk++) - { - if (strlen (normalize (*chk, (bfd *) NULL)) > 14) - { - operation = replace; - break; - } - } - } - - if (operation == quick_append) - { - /* Note that quick appending to a non-existent archive creates it, - even if there are no files to append. */ - do_quick_append (inarch_filename, files); - xexit (0); - } -#endif - arch = open_inarch (inarch_filename, files == NULL ? (char *) NULL : files[0]); @@ -935,130 +903,16 @@ extract_file (bfd *abfd) chmod (bfd_get_filename (abfd), buf.st_mode); if (preserve_dates) - set_times (bfd_get_filename (abfd), &buf); + { + /* Set access time to modification time. Only st_mtime is + initialized by bfd_stat_arch_elt. */ + buf.st_atime = buf.st_mtime; + set_times (bfd_get_filename (abfd), &buf); + } free (cbuf); } -#if 0 - -/* We don't use this anymore. Too many systems expect ar to rebuild - the symbol table even when q is used. */ - -/* Just do it quickly; don't worry about dups, armap, or anything like that */ - -static void -do_quick_append (const char *archive_filename, char **files_to_append) -{ - FILE *ofile, *ifile; - char *buf = xmalloc (BUFSIZE); - long tocopy, thistime; - bfd *temp; - struct stat sbuf; - bfd_boolean newfile = FALSE; - bfd_set_error (bfd_error_no_error); - - if (stat (archive_filename, &sbuf) != 0) - { - -#if !defined(__GO32__) || defined(__DJGPP__) - - /* FIXME: I don't understand why this fragment was ifndef'ed - away for __GO32__; perhaps it was in the days of DJGPP v1.x. - stat() works just fine in v2.x, so I think this should be - removed. For now, I enable it for DJGPP v2. - - (And yes, I know this is all unused, but somebody, someday, - might wish to resurrect this again... -- EZ. */ - -/* KLUDGE ALERT! Temporary fix until I figger why - stat() is wrong ... think it's buried in GO32's IDT - Jax */ - - if (errno != ENOENT) - bfd_fatal (archive_filename); -#endif - - newfile = TRUE; - } - - ofile = fopen (archive_filename, FOPEN_AUB); - if (ofile == NULL) - { - perror (program_name); - xexit (1); - } - - temp = bfd_openr (archive_filename, NULL); - if (temp == NULL) - { - bfd_fatal (archive_filename); - } - if (!newfile) - { - if (!bfd_check_format (temp, bfd_archive)) - /* xgettext:c-format */ - fatal (_("%s is not an archive"), archive_filename); - } - else - { - fwrite (ARMAG, 1, SARMAG, ofile); - if (!silent_create) - /* xgettext:c-format */ - non_fatal (_("creating %s"), archive_filename); - } - - if (ar_truncate) - temp->flags |= BFD_TRADITIONAL_FORMAT; - - /* assume it's an archive, go straight to the end, sans $200 */ - fseek (ofile, 0, 2); - - for (; files_to_append && *files_to_append; ++files_to_append) - { - struct ar_hdr *hdr = bfd_special_undocumented_glue (temp, *files_to_append); - if (hdr == NULL) - { - bfd_fatal (*files_to_append); - } - - BFD_SEND (temp, _bfd_truncate_arname, (temp, *files_to_append, (char *) hdr)); - - ifile = fopen (*files_to_append, FOPEN_RB); - if (ifile == NULL) - { - bfd_nonfatal (*files_to_append); - } - - if (stat (*files_to_append, &sbuf) != 0) - { - bfd_nonfatal (*files_to_append); - } - - tocopy = sbuf.st_size; - - /* XXX should do error-checking! */ - fwrite (hdr, 1, sizeof (struct ar_hdr), ofile); - - while (tocopy > 0) - { - thistime = tocopy; - if (thistime > BUFSIZE) - thistime = BUFSIZE; - fread (buf, 1, thistime, ifile); - fwrite (buf, 1, thistime, ofile); - tocopy -= thistime; - } - fclose (ifile); - if ((sbuf.st_size % 2) == 1) - putc ('\012', ofile); - } - fclose (ofile); - bfd_close (temp); - free (buf); -} - -#endif /* 0 */ - static void write_archive (bfd *iarch) { @@ -1268,7 +1122,7 @@ static void replace_members (bfd *arch, char **files_to_move, bfd_boolean quick) { bfd_boolean changed = FALSE; - bfd **after_bfd; /* New entries go after this one */ + bfd **after_bfd; /* New entries go after this one. */ bfd *current; bfd **current_ptr; @@ -1325,8 +1179,7 @@ replace_members (bfd *arch, char **files_to_move, bfd_boolean quick) /* Add to the end of the archive. */ after_bfd = get_pos_bfd (&arch->next, pos_end, NULL); - if (get_file_size (* files_to_move) > 0 - && ar_emul_append (after_bfd, *files_to_move, verbose)) + if (ar_emul_append (after_bfd, *files_to_move, verbose)) changed = TRUE; next_file:; diff --git a/contrib/binutils/binutils/arlex.l b/contrib/binutils/binutils/arlex.l index ab1ff164e19..1560294327f 100644 --- a/contrib/binutils/binutils/arlex.l +++ b/contrib/binutils/binutils/arlex.l @@ -1,7 +1,8 @@ %{ /* arlex.l - Strange script language lexer */ -/* Copyright 1992, 1997, 2000, 2002, 2003 Free Software Foundation, Inc. +/* Copyright 1992, 1997, 2000, 2001, 2002, 2003, 2004 + Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -17,13 +18,11 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -/* Contributed by Steve Chamberlain - sac@cygnus.com +/* Contributed by Steve Chamberlain . */ -*/ #define DONTDECLARE_MALLOC #include "ansidecl.h" #include "libiberty.h" diff --git a/contrib/binutils/binutils/arparse.y b/contrib/binutils/binutils/arparse.y index d54de24d1c5..a7ea0157f41 100644 --- a/contrib/binutils/binutils/arparse.y +++ b/contrib/binutils/binutils/arparse.y @@ -1,7 +1,7 @@ %{ /* arparse.y - Stange script language parser */ -/* Copyright 1992, 1993, 1995, 1997, 1999, 2003 +/* Copyright 1992, 1993, 1995, 1997, 1999, 2002, 2003 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -18,7 +18,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* Contributed by Steve Chamberlain diff --git a/contrib/binutils/binutils/arsup.c b/contrib/binutils/binutils/arsup.c index 5160dc47b57..189490b307b 100644 --- a/contrib/binutils/binutils/arsup.c +++ b/contrib/binutils/binutils/arsup.c @@ -1,6 +1,6 @@ /* arsup.c - Archive support for MRI compatibility - Copyright 1992, 1994, 1995, 1996, 1997, 2000, 2002, 2003, 2004 - Free Software Foundation, Inc. + Copyright 1992, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003, + 2004 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* Contributed by Steve Chamberlain @@ -38,6 +38,10 @@ static void ar_addlib_doer (bfd *, bfd *); extern int verbose; +static bfd *obfd; +static char *real_name; +static FILE *outfile; + static void map_over_list (bfd *arch, void (*function) (bfd *, bfd *), struct list *list) { @@ -86,7 +90,6 @@ map_over_list (bfd *arch, void (*function) (bfd *, bfd *), struct list *list) } -FILE *outfile; static void ar_directory_doer (bfd *abfd, bfd *ignore ATTRIBUTE_UNUSED) @@ -141,9 +144,6 @@ maybequit (void) } -bfd *obfd; -char *real_name; - void ar_open (char *name, int t) { diff --git a/contrib/binutils/binutils/arsup.h b/contrib/binutils/binutils/arsup.h index e3a1807919b..136efcf3c9b 100644 --- a/contrib/binutils/binutils/arsup.h +++ b/contrib/binutils/binutils/arsup.h @@ -1,5 +1,6 @@ /* arsup.h - archive support header file - Copyright 1992, 1993, 1994, 1996, 2003 Free Software Foundation, Inc. + Copyright 1992, 1993, 1994, 1996, 2001, 2002, 2003 + Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -15,7 +16,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ struct list { char *name; diff --git a/contrib/binutils/binutils/binemul.c b/contrib/binutils/binutils/binemul.c index 3f6ed6573d6..7dac32dd115 100644 --- a/contrib/binutils/binutils/binemul.c +++ b/contrib/binutils/binutils/binemul.c @@ -1,6 +1,6 @@ /* Binutils emulation layer. Copyright 2002, 2003 Free Software Foundation, Inc. - Written by Tom Rix, Redhat. + Written by Tom Rix, Red Hat Inc. This file is part of GNU Binutils. @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "binemul.h" @@ -89,47 +89,6 @@ ar_emul_default_replace (bfd **after_bfd, char *file_name, return TRUE; } -bfd_boolean -ar_emul_create (bfd **abfd_out, char *archive_file_name, char *file_name) -{ - if (bin_dummy_emulation.ar_create) - return bin_dummy_emulation.ar_create (abfd_out, archive_file_name, - file_name); - - return FALSE; -} - -bfd_boolean -ar_emul_default_create (bfd **abfd_out, char *archive_file_name, - char *file_name) -{ - char *target = NULL; - - /* Try to figure out the target to use for the archive from the - first object on the list. */ - if (file_name != NULL) - { - bfd *obj; - - obj = bfd_openr (file_name, NULL); - if (obj != NULL) - { - if (bfd_check_format (obj, bfd_object)) - target = bfd_get_target (obj); - (void) bfd_close (obj); - } - } - - /* Create an empty archive. */ - *abfd_out = bfd_openw (archive_file_name, target); - if (*abfd_out == NULL - || ! bfd_set_format (*abfd_out, bfd_archive) - || ! bfd_close (*abfd_out)) - bfd_fatal (archive_file_name); - - return TRUE; -} - bfd_boolean ar_emul_parse_arg (char *arg) { diff --git a/contrib/binutils/binutils/binemul.h b/contrib/binutils/binutils/binemul.h index 59dc2bde20d..53bbbd2de20 100644 --- a/contrib/binutils/binutils/binemul.h +++ b/contrib/binutils/binutils/binemul.h @@ -1,6 +1,6 @@ /* Binutils emulation layer. Copyright 2002, 2003 Free Software Foundation, Inc. - Written by Tom Rix, Redhat. + Written by Tom Rix, Red Hat Inc. This file is part of GNU Binutils. @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef BINEMUL_H #define BINEMUL_H @@ -30,8 +30,6 @@ extern bfd_boolean ar_emul_append (bfd **, char *, bfd_boolean); extern bfd_boolean ar_emul_default_append (bfd **, char *, bfd_boolean); extern bfd_boolean ar_emul_replace (bfd **, char *, bfd_boolean); extern bfd_boolean ar_emul_default_replace (bfd **, char *, bfd_boolean); -extern bfd_boolean ar_emul_create (bfd **, char *, char *); -extern bfd_boolean ar_emul_default_create (bfd **, char *, char *); extern bfd_boolean ar_emul_parse_arg (char *); extern bfd_boolean ar_emul_default_parse_arg (char *); @@ -42,7 +40,7 @@ extern bfd_boolean ar_emul_default_parse_arg (char *); fprintf (fp, _(" emulation options: \n")) #define AR_EMUL_ELEMENT_CHECK(abfd, file_name) \ - do { if ((abfd) == (bfd *) NULL) bfd_fatal (file_name); } while (0) + do { if ((abfd) == NULL) bfd_fatal (file_name); } while (0) #define AR_EMUL_APPEND_PRINT_VERBOSE(verbose, file_name) \ do { if (verbose) printf ("a - %s\n", file_name); } while (0) @@ -56,7 +54,6 @@ typedef struct bin_emulation_xfer_struct void (* ar_usage) (FILE *fp); bfd_boolean (* ar_append) (bfd **, char *, bfd_boolean); bfd_boolean (* ar_replace) (bfd **, char *, bfd_boolean); - bfd_boolean (* ar_create) (bfd **, char *, char *); bfd_boolean (* ar_parse_arg) (char *); } bin_emulation_xfer_type; diff --git a/contrib/binutils/binutils/bucomm.c b/contrib/binutils/binutils/bucomm.c index 6573e2d9c7f..03a4d2873e2 100644 --- a/contrib/binutils/binutils/bucomm.c +++ b/contrib/binutils/binutils/bucomm.c @@ -16,8 +16,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ /* We might put this in a library someday so it could be dynamically loaded, but for now it's not necessary. */ @@ -31,6 +31,7 @@ #include #include /* ctime, maybe time_t */ +#include #ifndef HAVE_TIME_T_IN_TIME_H #ifndef HAVE_TIME_T_IN_TYPES_H @@ -188,7 +189,7 @@ display_target_list (void) { const bfd_target *p = bfd_target_vector[t]; bfd *abfd = bfd_openw (dummy_name, p->name); - int a; + enum bfd_architecture a; printf ("%s\n (header %s, data %s)\n", p->name, endian_string (p->header_byteorder), @@ -212,7 +213,7 @@ display_target_list (void) continue; } - for (a = (int) bfd_arch_obscure + 1; a < (int) bfd_arch_last; a++) + for (a = bfd_arch_obscure + 1; a < bfd_arch_last; a++) if (bfd_set_arch_mach (abfd, (enum bfd_architecture) a, 0)) printf (" %s\n", bfd_printable_arch_mach ((enum bfd_architecture) a, 0)); @@ -232,9 +233,9 @@ static int display_info_table (int first, int last) { int t; - int a; int ret = 1; char *dummy_name; + enum bfd_architecture a; /* Print heading of target names. */ printf ("\n%*s", (int) LONGEST_ARCH, " "); @@ -243,7 +244,7 @@ display_info_table (int first, int last) putchar ('\n'); dummy_name = make_temp_file (NULL); - for (a = (int) bfd_arch_obscure + 1; a < (int) bfd_arch_last; a++) + for (a = bfd_arch_obscure + 1; a < bfd_arch_last; a++) if (strcmp (bfd_printable_arch_mach (a, 0), "UNKNOWN!") != 0) { printf ("%*s ", (int) LONGEST_ARCH - 1, @@ -475,3 +476,38 @@ get_file_size (const char * file_name) return 0; } + +/* Return the filename in a static buffer. */ + +const char * +bfd_get_archive_filename (bfd *abfd) +{ + static size_t curr = 0; + static char *buf; + size_t needed; + + assert (abfd != NULL); + + if (!abfd->my_archive) + return bfd_get_filename (abfd); + + needed = (strlen (bfd_get_filename (abfd->my_archive)) + + strlen (bfd_get_filename (abfd)) + 3); + if (needed > curr) + { + if (curr) + free (buf); + curr = needed + (needed >> 1); + buf = bfd_malloc (curr); + /* If we can't malloc, fail safe by returning just the file name. + This function is only used when building error messages. */ + if (!buf) + { + curr = 0; + return bfd_get_filename (abfd); + } + } + sprintf (buf, "%s(%s)", bfd_get_filename (abfd->my_archive), + bfd_get_filename (abfd)); + return buf; +} diff --git a/contrib/binutils/binutils/bucomm.h b/contrib/binutils/binutils/bucomm.h index f604053cec8..9f914adeb58 100644 --- a/contrib/binutils/binutils/bucomm.h +++ b/contrib/binutils/binutils/bucomm.h @@ -1,6 +1,6 @@ /* bucomm.h -- binutils common include file. Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2002, 2003 Free Software Foundation, Inc. + 2001, 2002, 2003, 2005 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _BUCOMM_H #define _BUCOMM_H @@ -28,11 +28,7 @@ #include "config.h" #include "bin-bugs.h" -#ifdef ANSI_PROTOTYPES #include -#else -#include -#endif #ifdef USE_BINARY_FOPEN #include "fopen-bin.h" @@ -72,24 +68,40 @@ extern char *strrchr (); #endif #endif -#ifdef NEED_DECLARATION_STRSTR +#if !HAVE_DECL_STPCPY +extern char *stpcpy (char *, const char *); +#endif + +#if !HAVE_DECL_STRSTR extern char *strstr (); #endif #ifdef HAVE_SBRK -#ifdef NEED_DECLARATION_SBRK +#if !HAVE_DECL_SBRK extern char *sbrk (); #endif #endif -#ifdef NEED_DECLARATION_GETENV +#if !HAVE_DECL_GETENV extern char *getenv (); #endif -#ifdef NEED_DECLARATION_ENVIRON +#if !HAVE_DECL_ENVIRON extern char **environ; #endif +#if !HAVE_DECL_FPRINTF +extern int fprintf (FILE *, const char *, ...); +#endif + +#if !HAVE_DECL_SNPRINTF +extern int snprintf(char *, size_t, const char *, ...); +#endif + +#if !HAVE_DECL_VSNPRINTF +extern int vsnprintf(char *, size_t, const char *, va_list); +#endif + #ifndef O_RDONLY #define O_RDONLY 0 #endif @@ -125,7 +137,17 @@ void *alloca (); # endif /* HAVE_ALLOCA_H */ #endif + #ifdef HAVE_LOCALE_H +# ifndef ENABLE_NLS + /* The Solaris version of locale.h always includes libintl.h. If we have + been configured with --disable-nls then ENABLE_NLS will not be defined + and the dummy definitions of bindtextdomain (et al) below will conflict + with the defintions in libintl.h. So we define these values to prevent + the bogus inclusion of libintl.h. */ +# define _LIBINTL_H +# define _LIBGETTEXT_H +# endif # include #endif @@ -147,12 +169,19 @@ void *alloca (); # define N_(String) (String) #endif +/* Used by ar.c and objcopy.c. */ +#define BUFSIZE 8192 + /* bucomm.c */ + +/* Return the filename in a static buffer. */ +const char *bfd_get_archive_filename (bfd *); + void bfd_nonfatal (const char *); void bfd_fatal (const char *) ATTRIBUTE_NORETURN; -void report (const char *, va_list); +void report (const char *, va_list) ATTRIBUTE_PRINTF(1,0); void fatal (const char *, ...) ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN; diff --git a/contrib/binutils/binutils/budbg.h b/contrib/binutils/binutils/budbg.h index f5c03bd23a2..3524190a180 100644 --- a/contrib/binutils/binutils/budbg.h +++ b/contrib/binutils/binutils/budbg.h @@ -16,8 +16,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #ifndef BUDBG_H #define BUDBG_H diff --git a/contrib/binutils/binutils/budemang.c b/contrib/binutils/binutils/budemang.c index 525a1c898cf..55f10b785da 100644 --- a/contrib/binutils/binutils/budemang.c +++ b/contrib/binutils/binutils/budemang.c @@ -1,5 +1,5 @@ /* demangle.c -- A wrapper calling libiberty cplus_demangle - Copyright 2002, 2003 Free Software Foundation, Inc. + Copyright 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -15,8 +15,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #include "config.h" #include @@ -38,8 +38,9 @@ char * demangle (bfd *abfd, const char *name) { - char *res; - const char *p; + char *res, *alloc; + const char *pre, *suf; + size_t pre_len; if (abfd != NULL && bfd_get_symbol_leading_char (abfd) == name[0]) ++name; @@ -48,28 +49,52 @@ demangle (bfd *abfd, const char *name) or the MS PE format. These formats have a number of leading '.'s on at least some symbols, so we remove all dots to avoid confusing the demangler. */ - p = name; - while (*p == '.') - ++p; + pre = name; + while (*name == '.') + ++name; + pre_len = name - pre; - res = cplus_demangle (p, DMGL_ANSI | DMGL_PARAMS); - if (res) + alloc = NULL; + suf = strchr (name, '@'); + if (suf != NULL) { - size_t dots = p - name; + alloc = xmalloc (suf - name + 1); + memcpy (alloc, name, suf - name); + alloc[suf - name] = '\0'; + name = alloc; + } - /* Now put back any stripped dots. */ - if (dots != 0) + res = cplus_demangle (name, DMGL_ANSI | DMGL_PARAMS); + if (res != NULL) + { + /* Now put back any suffix, or stripped dots. */ + if (pre_len != 0 || suf != NULL) { - size_t len = strlen (res) + 1; - char *add_dots = xmalloc (len + dots); + size_t len; + size_t suf_len; + char *final; - memcpy (add_dots, name, dots); - memcpy (add_dots + dots, res, len); + if (alloc != NULL) + free (alloc); + + len = strlen (res); + if (suf == NULL) + suf = res + len; + suf_len = strlen (suf) + 1; + final = xmalloc (pre_len + len + suf_len); + + memcpy (final, pre, pre_len); + memcpy (final + pre_len, res, len); + memcpy (final + pre_len + len, suf, suf_len); free (res); - res = add_dots; + res = final; } + return res; } - return xstrdup (name); + if (alloc != NULL) + free (alloc); + + return xstrdup (pre); } diff --git a/contrib/binutils/binutils/budemang.h b/contrib/binutils/binutils/budemang.h index b837d718d12..17df9f55ea7 100644 --- a/contrib/binutils/binutils/budemang.h +++ b/contrib/binutils/binutils/budemang.h @@ -15,8 +15,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #ifndef BUDEMANG_H #define BUDEMANG_H diff --git a/contrib/binutils/binutils/coffdump.c b/contrib/binutils/binutils/coffdump.c index 039b9553621..5ec23b43f62 100644 --- a/contrib/binutils/binutils/coffdump.c +++ b/contrib/binutils/binutils/coffdump.c @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* Written by Steve Chamberlain @@ -38,11 +38,9 @@ static void dump_coff_lines (struct coff_line *); static void dump_coff_type (struct coff_type *); static void dump_coff_where (struct coff_where *); static void dump_coff_visible (struct coff_visible *); -extern void dump_coff_symbol (struct coff_symbol *); static void dump_coff_scope (struct coff_scope *); static void dump_coff_sfile (struct coff_sfile *); static void dump_coff_section (struct coff_section *); -extern void coff_dump (struct coff_ofile *); static void show_usage (FILE *, int); extern int main (int, char **); @@ -325,7 +323,7 @@ dump_coff_visible (struct coff_visible *p) tab (-1); } -void +static void dump_coff_symbol (struct coff_symbol *p) { tab (1); @@ -436,7 +434,7 @@ dump_coff_section (struct coff_section *ptr) tab (-1); } -void +static void coff_dump (struct coff_ofile *ptr) { int i; @@ -459,6 +457,7 @@ show_usage (FILE *file, int status) fprintf (file, _("Usage: %s [option(s)] in-file\n"), program_name); fprintf (file, _(" Print a human readable interpretation of a SYSROFF object file\n")); fprintf (file, _(" The options are:\n\ + @ Read options from \n\ -h --help Display this information\n\ -v --version Display the program's version\n\ \n")); @@ -496,6 +495,8 @@ main (int ac, char **av) program_name = av[0]; xmalloc_set_program_name (program_name); + expandargv (&ac, &av); + while ((opt = getopt_long (ac, av, "HhVv", long_options, (int *) NULL)) != EOF) diff --git a/contrib/binutils/binutils/coffgrok.c b/contrib/binutils/binutils/coffgrok.c index b2ec98c4bd8..a6c05b14d2a 100644 --- a/contrib/binutils/binutils/coffgrok.c +++ b/contrib/binutils/binutils/coffgrok.c @@ -1,5 +1,5 @@ /* coffgrok.c - Copyright 1994, 1995, 1997, 1998, 2000, 2001, 2002, 2003 + Copyright 1994, 1995, 1997, 1998, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -16,7 +16,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* Written by Steve Chamberlain (sac@cygnus.com) @@ -33,16 +33,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "coff/internal.h" #include "../bfd/libcoff.h" #include "coffgrok.h" -int lofile = 1; +static int lofile = 1; static struct coff_scope *top_scope; static struct coff_scope *file_scope; static struct coff_ofile *ofile; -struct coff_symbol *last_function_symbol; -struct coff_type *last_function_type; -struct coff_type *last_struct; -struct coff_type *last_enum; -struct coff_sfile *cur_sfile; +static struct coff_symbol *last_function_symbol; +static struct coff_type *last_function_type; +static struct coff_type *last_struct; +static struct coff_type *last_enum; +static struct coff_sfile *cur_sfile; static struct coff_symbol **tindex; @@ -156,7 +156,7 @@ do_sections_p1 (struct coff_ofile *head) if (strcmp (section->name, ".bss") == 0) head->sections[i].data = 1; head->sections[i].address = section->lma; - head->sections[i].size = section->_raw_size; + head->sections[i].size = bfd_get_section_size (section); head->sections[i].number = idx; head->sections[i].nrelocs = section->reloc_count; head->sections[i].relocs = diff --git a/contrib/binutils/binutils/coffgrok.h b/contrib/binutils/binutils/coffgrok.h index c063f1dc77a..e6d0077ad3f 100644 --- a/contrib/binutils/binutils/coffgrok.h +++ b/contrib/binutils/binutils/coffgrok.h @@ -1,5 +1,5 @@ /* coffgrok.h - Copyright 2001 Free Software Foundation, Inc. + Copyright 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -15,7 +15,7 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #define T_NULL 0 #define T_VOID 1 /* function argument (only used by compiler) */ diff --git a/contrib/binutils/binutils/config.in b/contrib/binutils/binutils/config.in index f2bd0495589..93d8e952837 100644 --- a/contrib/binutils/binutils/config.in +++ b/contrib/binutils/binutils/config.in @@ -1,173 +1,178 @@ -/* config.in. Generated automatically from configure.in by autoheader. */ +/* config.in. Generated from configure.in by autoheader. */ -/* Define if using alloca.c. */ -#undef C_ALLOCA - -/* Define to empty if the keyword does not work. */ -#undef const - -/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. - This function is required for alloca.c support on those systems. */ +/* 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 and it should be used (not on Ultrix). */ -#undef HAVE_ALLOCA_H - -/* Define if you have a working `mmap' system call. */ -#undef HAVE_MMAP - -/* Define if you have that is POSIX.1 compatible. */ -#undef HAVE_SYS_WAIT_H - -/* Define as __inline if that's what the C compiler calls it. */ -#undef inline - -/* Define to `long' if doesn't define. */ -#undef off_t - -/* Define to `unsigned' if doesn't define. */ -#undef size_t - -/* If using the C implementation of alloca, define if you know the - direction of stack growth for your system; otherwise it will be - automatically deduced at run-time. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown - */ -#undef STACK_DIRECTION - -/* Define if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Define if lex declares yytext as a char * by default, not a char[]. */ -#undef YYTEXT_POINTER - -/* Define if you have the __argz_count function. */ -#undef HAVE___ARGZ_COUNT - -/* Define if you have the __argz_next function. */ -#undef HAVE___ARGZ_NEXT - -/* Define if you have the __argz_stringify function. */ -#undef HAVE___ARGZ_STRINGIFY - -/* Define if you have the dcgettext function. */ -#undef HAVE_DCGETTEXT - -/* Define if you have the getc_unlocked function. */ -#undef HAVE_GETC_UNLOCKED - -/* Define if you have the getcwd function. */ -#undef HAVE_GETCWD - -/* Define if you have the getpagesize function. */ -#undef HAVE_GETPAGESIZE - -/* Define if you have the munmap function. */ -#undef HAVE_MUNMAP - -/* Define if you have the putenv function. */ -#undef HAVE_PUTENV - -/* Define if you have the sbrk function. */ -#undef HAVE_SBRK - -/* Define if you have the setenv function. */ -#undef HAVE_SETENV - -/* Define if you have the setlocale function. */ -#undef HAVE_SETLOCALE - -/* Define if you have the setmode function. */ -#undef HAVE_SETMODE - -/* Define if you have the stpcpy function. */ -#undef HAVE_STPCPY - -/* Define if you have the strcasecmp function. */ -#undef HAVE_STRCASECMP - -/* Define if you have the strchr function. */ -#undef HAVE_STRCHR - -/* Define if you have the strcoll function. */ -#undef HAVE_STRCOLL - -/* Define if you have the utimes function. */ -#undef HAVE_UTIMES - -/* Define if you have the header file. */ -#undef HAVE_ARGZ_H - -/* Define if you have the header file. */ -#undef HAVE_FCNTL_H - -/* Define if you have the header file. */ -#undef HAVE_LIMITS_H - -/* Define if you have the header file. */ -#undef HAVE_LOCALE_H - -/* Define if you have the header file. */ -#undef HAVE_MALLOC_H - -/* Define if you have the header file. */ -#undef HAVE_NL_TYPES_H - -/* Define if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define if you have the header file. */ -#undef HAVE_STRING_H - -/* Define if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_FILE_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_PARAM_H - -/* Define if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define if you have the header file. */ -#undef HAVE_VALUES_H - -/* Name of package */ -#undef PACKAGE - -/* Version number of package */ -#undef VERSION - -/* Define if you have the stpcpy function */ -#undef HAVE_STPCPY - -/* Define if your locale.h file contains LC_MESSAGES. */ -#undef HAVE_LC_MESSAGES +/* Define to 1 if using `alloca.c'. */ +#undef C_ALLOCA /* Define to 1 if NLS is requested */ #undef ENABLE_NLS -/* Define as 1 if you have gettext and don't want to use GNU gettext. */ -#undef HAVE_GETTEXT +/* Suffix used for executables, if any. */ +#undef EXECUTABLE_SUFFIX + +/* Define to 1 if you have `alloca', as a function or macro. */ +#undef HAVE_ALLOCA + +/* Define to 1 if you have and it should be used (not on Ultrix). + */ +#undef HAVE_ALLOCA_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_ARGZ_H + +/* Define to 1 if you have the `dcgettext' function. */ +#undef HAVE_DCGETTEXT + +/* Define to 1 if you have the declaration of `environ', and to 0 if you + don't. */ +#undef HAVE_DECL_ENVIRON + +/* Define to 1 if you have the declaration of `fprintf', and to 0 if you + don't. */ +#undef HAVE_DECL_FPRINTF + +/* Define to 1 if you have the declaration of `getc_unlocked', and to 0 if you + don't. */ +#undef HAVE_DECL_GETC_UNLOCKED + +/* Define to 1 if you have the declaration of `getenv', and to 0 if you don't. + */ +#undef HAVE_DECL_GETENV + +/* Is the prototype for getopt in in the expected format? */ +#undef HAVE_DECL_GETOPT + +/* Define to 1 if you have the declaration of `sbrk', and to 0 if you don't. + */ +#undef HAVE_DECL_SBRK + +/* Define to 1 if you have the declaration of `snprintf', and to 0 if you + don't. */ +#undef HAVE_DECL_SNPRINTF + +/* Define to 1 if you have the declaration of `stpcpy', and to 0 if you don't. + */ +#undef HAVE_DECL_STPCPY + +/* Define to 1 if you have the declaration of `strstr', and to 0 if you don't. + */ +#undef HAVE_DECL_STRSTR + +/* Define to 1 if you have the declaration of `vsnprintf', and to 0 if you + don't. */ +#undef HAVE_DECL_VSNPRINTF /* Does the platform use an executable suffix? */ #undef HAVE_EXECUTABLE_SUFFIX -/* Suffix used for executables, if any. */ -#undef EXECUTABLE_SUFFIX +/* Define to 1 if you have the header file. */ +#undef HAVE_FCNTL_H /* Is fopen64 available? */ #undef HAVE_FOPEN64 -/* Enable LFS */ -#undef _LARGEFILE64_SOURCE +/* Define to 1 if you have the `getcwd' function. */ +#undef HAVE_GETCWD + +/* Define to 1 if you have the `getc_unlocked' function. */ +#undef HAVE_GETC_UNLOCKED + +/* Define to 1 if you have the `getpagesize' function. */ +#undef HAVE_GETPAGESIZE + +/* Define as 1 if you have gettext and don't want to use GNU gettext. */ +#undef HAVE_GETTEXT + +/* Does define struct utimbuf? */ +#undef HAVE_GOOD_UTIME_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define if your locale.h file contains LC_MESSAGES. */ +#undef HAVE_LC_MESSAGES + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIMITS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LOCALE_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MALLOC_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have a working `mmap' system call. */ +#undef HAVE_MMAP + +/* Define to 1 if you have the `munmap' function. */ +#undef HAVE_MUNMAP + +/* Define to 1 if you have the header file. */ +#undef HAVE_NL_TYPES_H + +/* Define to 1 if you have the `putenv' function. */ +#undef HAVE_PUTENV + +/* Define to 1 if you have the `sbrk' function. */ +#undef HAVE_SBRK + +/* Define to 1 if you have the `setenv' function. */ +#undef HAVE_SETENV + +/* Define to 1 if you have the `setlocale' function. */ +#undef HAVE_SETLOCALE + +/* Define to 1 if you have the `setmode' function. */ +#undef HAVE_SETMODE + +/* Is stat64 available? */ +#undef HAVE_STAT64 + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define if you have the stpcpy function */ +#undef HAVE_STPCPY + +/* Define to 1 if you have the `strcasecmp' function. */ +#undef HAVE_STRCASECMP + +/* Define to 1 if you have the `strchr' function. */ +#undef HAVE_STRCHR + +/* Define to 1 if you have the `strcoll' function. */ +#undef HAVE_STRCOLL + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_FILE_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have that is POSIX.1 compatible. */ +#undef HAVE_SYS_WAIT_H /* Is the type time_t defined in ? */ #undef HAVE_TIME_T_IN_TIME_H @@ -175,26 +180,52 @@ /* Is the type time_t defined in ? */ #undef HAVE_TIME_T_IN_TYPES_H -/* Does define struct utimbuf? */ -#undef HAVE_GOOD_UTIME_H +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H -/* Define if fprintf is not declared in system header files. */ -#undef NEED_DECLARATION_FPRINTF +/* Define to 1 if you have the `utimes' function. */ +#undef HAVE_UTIMES -/* Define if strstr is not declared in system header files. */ -#undef NEED_DECLARATION_STRSTR +/* Define to 1 if you have the header file. */ +#undef HAVE_VALUES_H -/* Define if sbrk is not declared in system header files. */ -#undef NEED_DECLARATION_SBRK +/* Define to 1 if you have the `__argz_count' function. */ +#undef HAVE___ARGZ_COUNT -/* Define if getenv is not declared in system header files. */ -#undef NEED_DECLARATION_GETENV +/* Define to 1 if you have the `__argz_next' function. */ +#undef HAVE___ARGZ_NEXT -/* Define if environ is not declared in system header files. */ -#undef NEED_DECLARATION_ENVIRON +/* Define to 1 if you have the `__argz_stringify' function. */ +#undef HAVE___ARGZ_STRINGIFY -/* Use b modifier when opening binary files? */ -#undef USE_BINARY_FOPEN +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at run-time. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +#undef STACK_DIRECTION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS /* Configured target name. */ #undef TARGET @@ -202,3 +233,35 @@ /* Define to 1 if user symbol names have a leading underscore, 0 if not. */ #undef TARGET_PREPENDS_UNDERSCORE +/* Use b modifier when opening binary files? */ +#undef USE_BINARY_FOPEN + +/* Version number of package */ +#undef VERSION + +/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a + `char[]'. */ +#undef YYTEXT_POINTER + +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# undef _GNU_SOURCE +#endif + +/* Enable LFS */ +#undef _LARGEFILE64_SOURCE + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#undef inline +#endif + +/* Define to `long' if does not define. */ +#undef off_t + +/* Define to `unsigned' if does not define. */ +#undef size_t diff --git a/contrib/binutils/binutils/configure b/contrib/binutils/binutils/configure index 8210910ac90..2d8e0cb970c 100755 --- a/contrib/binutils/binutils/configure +++ b/contrib/binutils/binutils/configure @@ -1,51 +1,325 @@ #! /bin/sh - # Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.13 -# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# Generated by GNU Autoconf 2.59. # +# Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## -# Defaults: -ac_help= +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi +DUALCASE=1; export DUALCASE # for MKS sh + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# ac_default_prefix=/usr/local -# Any additions from configure.in: -ac_help="$ac_help - --enable-shared[=PKGS] build shared libraries [default=yes]" -ac_help="$ac_help - --enable-static[=PKGS] build static libraries [default=yes]" -ac_help="$ac_help - --enable-fast-install[=PKGS] optimize for fast installation [default=yes]" -ac_help="$ac_help - --with-gnu-ld assume the C compiler uses GNU ld [default=no]" -ac_help="$ac_help - --disable-libtool-lock avoid locking (might break parallel builds)" -ac_help="$ac_help - --with-pic try to use only PIC/non-PIC objects [default=use both]" -ac_help="$ac_help - --enable-targets alternative target configurations" -ac_help="$ac_help - --enable-commonbfdlib build shared BFD/opcodes/libiberty library" -ac_help="$ac_help - --enable-build-warnings Enable build-time compiler warnings if gcc is used" -ac_help="$ac_help - --disable-nls do not use Native Language Support" -ac_help="$ac_help - --with-included-gettext use the GNU gettext library included here" -ac_help="$ac_help - --enable-maintainer-mode enable make rules and dependencies not useful - (and sometimes confusing) to the casual installer" +ac_config_libobj_dir=. +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +# Identity of this package. +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= + +ac_unique_file="ar.c" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_STAT_H +# include +#endif +#if STDC_HEADERS +# include +# include +#else +# if HAVE_STDLIB_H +# include +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include +# endif +# include +#endif +#if HAVE_STRINGS_H +# include +#endif +#if HAVE_INTTYPES_H +# include +#else +# if HAVE_STDINT_H +# include +# endif +#endif +#if HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE LN_S RANLIB ac_ct_RANLIB LIBTOOL WARN_CFLAGS NO_WERROR YACC LEX LEXLIB LEX_OUTPUT_ROOT CPP EGREP ALLOCA USE_NLS MSGFMT GMSGFMT XGETTEXT USE_INCLUDED_LIBINTL CATALOGS CATOBJEXT DATADIRNAME GMOFILES INSTOBJEXT INTLDEPS INTLLIBS INTLOBJS POFILES POSUB INCLUDE_LOCALE_H GT_NO GT_YES MKINSTALLDIRS l MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT HDEFINES AR CC_FOR_BUILD EXEEXT_FOR_BUILD DEMANGLER_NAME NLMCONV_DEFS BUILD_NLMCONV BUILD_SRCONV BUILD_DLLTOOL DLLTOOL_DEFS BUILD_WINDRES BUILD_DLLWRAP BUILD_MISC OBJDUMP_DEFS EMULATION EMULATION_VECTOR datarootdir docdir htmldir LIBOBJS LTLIBOBJS' +ac_subst_files='' # Initialize some variables set by options. +ac_init_help= +ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. -build=NONE -cache_file=./config.cache +cache_file=/dev/null exec_prefix=NONE -host=NONE no_create= -nonopt=NONE no_recursion= prefix=NONE program_prefix=NONE @@ -53,12 +327,16 @@ program_suffix=NONE program_transform_name=s,x,x, silent= site= -sitefile= srcdir= -target=NONE verbose= x_includes=NONE x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' @@ -72,17 +350,9 @@ 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" @@ -90,59 +360,59 @@ do continue fi - case "$ac_option" in - -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) ac_optarg= ;; - esac + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. - case "$ac_option" in + case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir="$ac_optarg" ;; + bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) - ac_prev=build ;; + ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build="$ac_optarg" ;; + build_alias=$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" ;; + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) - datadir="$ac_optarg" ;; + datadir=$ac_optarg ;; -disable-* | --disable-*) - ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + ac_feature=`expr "x$ac_option" : 'x-*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" ;; + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + 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/=.*//'` + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # 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 - *=*) ;; + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac - eval "enable_${ac_feature}='$ac_optarg'" ;; + eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ @@ -151,96 +421,47 @@ do -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) - exec_prefix="$ac_optarg" ;; + exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; - -help | --help | --hel | --he) - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat << EOF -Usage: configure [options] [host] -Options: [defaults in brackets after descriptions] -Configuration: - --cache-file=FILE cache test results in FILE - --help print this message - --no-create do not create output files - --quiet, --silent do not print \`checking...' messages - --site-file=FILE use FILE as the site file - --version print the version of autoconf that created configure -Directory and file names: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [same as prefix] - --bindir=DIR user executables in DIR [EPREFIX/bin] - --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] - --libexecdir=DIR program executables in DIR [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data in DIR - [PREFIX/share] - --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data in DIR - [PREFIX/com] - --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] - --libdir=DIR object code libraries in DIR [EPREFIX/lib] - --includedir=DIR C header files in DIR [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] - --infodir=DIR info documentation in DIR [PREFIX/info] - --mandir=DIR man documentation in DIR [PREFIX/man] - --srcdir=DIR find the sources in DIR [configure dir or ..] - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM - run sed PROGRAM on installed program names -EOF - cat << EOF -Host type: - --build=BUILD configure for building on BUILD [BUILD=HOST] - --host=HOST configure for HOST [guessed] - --target=TARGET configure for TARGET [TARGET=HOST] -Features and packages: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --x-includes=DIR X include files are in DIR - --x-libraries=DIR X library files are in DIR -EOF - if test -n "$ac_help"; then - echo "--enable and --with options recognized:$ac_help" - fi - exit 0 ;; + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; -host | --host | --hos | --ho) - ac_prev=host ;; + ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) - host="$ac_optarg" ;; + host_alias=$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" ;; + includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir="$ac_optarg" ;; + infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir="$ac_optarg" ;; + 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" ;; + libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ @@ -249,19 +470,19 @@ EOF -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir="$ac_optarg" ;; + localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir="$ac_optarg" ;; + 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-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ @@ -275,26 +496,26 @@ EOF -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir="$ac_optarg" ;; + oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix="$ac_optarg" ;; + 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_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_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ @@ -311,7 +532,7 @@ EOF | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name="$ac_optarg" ;; + program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) @@ -321,7 +542,7 @@ EOF ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) - sbindir="$ac_optarg" ;; + sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ @@ -332,63 +553,57 @@ EOF | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) - sharedstatedir="$ac_optarg" ;; + sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) - site="$ac_optarg" ;; - - -site-file | --site-file | --site-fil | --site-fi | --site-f) - ac_prev=sitefile ;; - -site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*) - sitefile="$ac_optarg" ;; + site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir="$ac_optarg" ;; + 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" ;; + sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target ;; + ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target="$ac_optarg" ;; + target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; - -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.13" - exit 0 ;; + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; -with-* | --with-*) - ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # 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 + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac - eval "with_${ac_package}='$ac_optarg'" ;; + eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) - ac_package=`echo $ac_option|sed -e 's/-*without-//'` + ac_package=`expr "x$ac_option" : 'x-*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" ;; + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. @@ -399,99 +614,110 @@ EOF 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_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" ;; + x_libraries=$ac_optarg ;; - -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } ;; + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + *) - 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" + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$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; } + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); 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 +# Be sure to have absolute paths. +for ac_var in exec_prefix prefix 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" ;; + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; 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 +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done -# 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 +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null -# 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=ar.c # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. - ac_prog=$0 - ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` - test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + ac_confdir=`(dirname "$0") 2>/dev/null || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$0" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. @@ -501,123 +727,596 @@ else 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; } + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } else - { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } fi fi -srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` +(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || + { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 + { (exit 1); exit 1; }; } +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP -# Prefer explicitly selected file to automatically selected ones. -if test -z "$sitefile"; then - if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi - fi +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # 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 <<_ACEOF +\`configure' configures this package to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +_ACEOF + + cat <<_ACEOF +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data [PREFIX/share] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --infodir=DIR info documentation [PREFIX/info] + --mandir=DIR man documentation [PREFIX/man] +_ACEOF + + cat <<\_ACEOF + +Program names: + --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 + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] + --target=TARGET configure for building compilers for TARGET [HOST] +_ACEOF +fi + +if test -n "$ac_init_help"; then + + cat <<\_ACEOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors + --enable-shared=PKGS build shared libraries default=yes + --enable-static=PKGS build static libraries default=yes + --enable-fast-install=PKGS optimize for fast installation default=yes + --disable-libtool-lock avoid locking (might break parallel builds) + --enable-targets alternative target configurations + --enable-commonbfdlib build shared BFD/opcodes/libiberty library + --enable-werror treat compile warnings as errors + --enable-build-warnings Enable build-time compiler warnings + --disable-nls do not use Native Language Support + --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-gnu-ld assume the C compiler uses GNU ld default=no + --with-pic try to use only PIC/non-PIC objects default=use both + --with-included-gettext use the GNU gettext library included here + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have + headers in a nonstandard directory + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +_ACEOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d $ac_dir || continue + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else - CONFIG_SITE="$sitefile" + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + cd $ac_dir + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_srcdir/configure.gnu; then + echo + $SHELL $ac_srcdir/configure.gnu --help=recursive + elif test -f $ac_srcdir/configure; then + echo + $SHELL $ac_srcdir/configure --help=recursive + elif test -f $ac_srcdir/configure.ac || + test -f $ac_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi + cd $ac_popdir + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\_ACEOF + +Copyright (C) 2003 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit 0 +fi +exec 5>config.log +cat >&5 <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by $as_me, which was +generated by GNU Autoconf 2.59. Invocation command line was + + $ $0 $@ + +_ACEOF +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + echo "PATH: $as_dir" +done + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_sep= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + # Get rid of the leading space. + ac_sep=" " + ;; + esac + done +done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Be sure not to use single quotes in there, as some shells, +# such as our DU 5.0 friend, will then `close' the trap. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} + echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------- ## +## Output files. ## +## ------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + sed "/^$/d" confdefs.h | sort + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core && + rm -rf conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# 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 + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# 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" + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then - echo "loading cache $cache_file" - . $cache_file + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi else - echo "creating cache $cache_file" - > $cache_file + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" + eval ac_new_val="\$ac_env_${ac_var}_value" + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } fi ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + + + -ac_exeext= -ac_objext=o -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi -echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 -echo "configure:561: checking for Cygwin environment" >&5 -if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_cygwin=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_cygwin=no -fi -rm -f conftest* -rm -f conftest* -fi -echo "$ac_t""$ac_cv_cygwin" 1>&6 -CYGWIN= -test "$ac_cv_cygwin" = yes && CYGWIN=yes -echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 -echo "configure:594: checking for mingw32 environment" >&5 -if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_mingw32=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_mingw32=no -fi -rm -f conftest* -rm -f conftest* -fi -echo "$ac_t""$ac_cv_mingw32" 1>&6 -MINGW32= -test "$ac_cv_mingw32" = yes && MINGW32=yes ac_aux_dir= @@ -630,149 +1329,1163 @@ for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break + elif test -f $ac_dir/shtool; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -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; } + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 +echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} + { (exit 1); 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. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + +# Make sure we can run config.sub. +$ac_config_sub sun4 >/dev/null 2>&1 || + { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 +echo "$as_me: error: cannot run $ac_config_sub" >&2;} + { (exit 1); exit 1; }; } + +echo "$as_me:$LINENO: checking build system type" >&5 +echo $ECHO_N "checking build system type... $ECHO_C" >&6 +if test "${ac_cv_build+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_build_alias=$build_alias +test -z "$ac_cv_build_alias" && + ac_cv_build_alias=`$ac_config_guess` +test -z "$ac_cv_build_alias" && + { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 +echo "$as_me: error: cannot guess build type; you must specify one" >&2;} + { (exit 1); exit 1; }; } +ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_build" >&5 +echo "${ECHO_T}$ac_cv_build" >&6 +build=$ac_cv_build +build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -# Do some error checking and defaulting for the host and target type. -# The inputs are: -# configure --host=HOST --target=TARGET --build=BUILD NONOPT -# -# The rules are: -# 1. You are not allowed to specify --host, --target, and nonopt at the -# same time. -# 2. Host defaults to nonopt. -# 3. If nonopt is not specified, then host defaults to the current host, -# as determined by config.guess. -# 4. Target and build default to nonopt. -# 5. If nonopt is not specified, then target and build default to host. +echo "$as_me:$LINENO: checking host system type" >&5 +echo $ECHO_N "checking host system type... $ECHO_C" >&6 +if test "${ac_cv_host+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_host_alias=$host_alias +test -z "$ac_cv_host_alias" && + ac_cv_host_alias=$ac_cv_build_alias +ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6 +host=$ac_cv_host +host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + +echo "$as_me:$LINENO: checking target system type" >&5 +echo $ECHO_N "checking target system type... $ECHO_C" >&6 +if test "${ac_cv_target+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_target_alias=$target_alias +test "x$ac_cv_target_alias" = "x" && + ac_cv_target_alias=$ac_cv_host_alias +ac_cv_target=`$ac_config_sub $ac_cv_target_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_target_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_target_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_target" >&5 +echo "${ECHO_T}$ac_cv_target" >&6 +target=$ac_cv_target +target_cpu=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +target_vendor=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +target_os=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + # The aliases save the names the user supplied, while $host etc. # will get canonicalized. -case $host---$target---$nonopt in -NONE---*---* | *---NONE---* | *---*---NONE) ;; -*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;; -esac - - -# Make sure we can run config.sub. -if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : -else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } -fi - -echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:671: checking host system type" >&5 - -host_alias=$host -case "$host_alias" in -NONE) - case $nonopt in - NONE) - if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : - else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } - fi ;; - *) host_alias=$nonopt ;; - esac ;; -esac - -host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` -host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$host" 1>&6 - -echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:692: checking target system type" >&5 - -target_alias=$target -case "$target_alias" in -NONE) - case $nonopt in - NONE) target_alias=$host_alias ;; - *) target_alias=$nonopt ;; - esac ;; -esac - -target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias` -target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$target" 1>&6 - -echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:710: checking build system type" >&5 - -build_alias=$build -case "$build_alias" in -NONE) - case $nonopt in - NONE) build_alias=$host_alias ;; - *) build_alias=$nonopt ;; - esac ;; -esac - -build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` -build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$build" 1>&6 - -test "$host_alias" != "$target_alias" && +test -n "$target_alias" && test "$program_prefix$program_suffix$program_transform_name" = \ NONENONEs,x,x, && program_prefix=${target_alias}- - - - echo $ac_n "checking for strerror in -lcposix""... $ac_c" 1>&6 -echo "configure:734: checking for strerror in -lcposix" >&5 -ac_lib_var=`echo cposix'_'strerror | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_LIBS="$LIBS" -LIBS="-lcposix $LIBS" -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. + +# Be careful to initialize this variable, since it used to be cached. +# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. +ac_cv_exeext= +# b.out is created by i960 compilers. +for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) + ;; + conftest.$ac_ext ) + # This is the source file. + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool, + # but it would be cool to find out if it's true. Does anybody + # maintain Libtool? --akim. + export ac_cv_exeext + break;; + * ) + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +rm -f a.out a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 + +echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cc_g=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std1 is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std1. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + '' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +#include +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +continue +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done rm -f conftest* -LIBS="$ac_save_LIBS" - +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - LIBS="$LIBS -lcposix" + else - echo "$ac_t""no" 1>&6 -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 - +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +echo "$as_me:$LINENO: checking for library containing strerror" >&5 +echo $ECHO_N "checking for library containing strerror... $ECHO_C" >&6 +if test "${ac_cv_search_strerror+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_func_search_save_LIBS=$LIBS +ac_cv_search_strerror=no +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char strerror (); +int +main () +{ +strerror (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_strerror="none required" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test "$ac_cv_search_strerror" = no; then + for ac_lib in cposix; do + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char strerror (); +int +main () +{ +strerror (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_strerror="-l$ac_lib" +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + done +fi +LIBS=$ac_func_search_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_search_strerror" >&5 +echo "${ECHO_T}$ac_cv_search_strerror" >&6 +if test "$ac_cv_search_strerror" != no; then + test "$ac_cv_search_strerror" = "none required" || LIBS="$ac_cv_search_strerror $LIBS" + +fi BFD_VERSION=`sed -n -e 's/^.._INIT_AUTOMAKE.*,[ ]*\([^ ]*\)[ ]*).*/\1/p' < ${srcdir}/../bfd/configure.in` +am__api_version="1.9" # 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: @@ -780,230 +2493,582 @@ BFD_VERSION=`sed -n -e 's/^.._INIT_AUTOMAKE.*,[ ]*\([^ ]*\)[ ]*).*/\1/p' < ${ # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs # 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" +# OS/2's system install, which has a completely different semantic # ./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:789: checking for a BSD compatible install" >&5 +echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then -if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" - for ac_dir in $PATH; do - # Account for people who put trailing slashes in PATH elements. - case "$ac_dir/" in - /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - if test -f $ac_dir/$ac_prog; then + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ + /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 + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && - grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : else - ac_cv_path_install="$ac_dir/$ac_prog -c" - break 2 + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 fi fi done - ;; - esac - done - IFS="$ac_save_IFS" + done + ;; +esac +done + fi if test "${ac_cv_path_install+set}" = set; then - INSTALL="$ac_cv_path_install" + 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" + INSTALL=$ac_install_sh fi fi -echo "$ac_t""$INSTALL" 1>&6 +echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 -echo "configure:842: checking whether build environment is sane" >&5 +echo "$as_me:$LINENO: checking whether build environment is sane" >&5 +echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 # Just in case sleep 1 -echo timestamp > conftestfile +echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( - set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. - set X `ls -t $srcdir/configure conftestfile` + set X `ls -t $srcdir/configure conftest.file` fi - if test "$*" != "X $srcdir/configure conftestfile" \ - && test "$*" != "X conftestfile $srcdir/configure"; then + rm -f conftest.file + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". - { echo "configure: error: ls -t appears to fail. Make sure there is not a broken -alias in your environment" 1>&2; exit 1; } + { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&5 +echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&2;} + { (exit 1); exit 1; }; } fi - test "$2" = conftestfile + test "$2" = conftest.file ) then # Ok. : else - { echo "configure: error: newly created file is older than distributed files! -Check your system clock" 1>&2; exit 1; } -fi -rm -f conftest* -echo "$ac_t""yes" 1>&6 -if test "$program_transform_name" = s,x,x,; then - program_transform_name= -else - # Double any \ or $. echo might interpret backslashes. - cat <<\EOF_SED > conftestsed -s,\\,\\\\,g; s,\$,$$,g -EOF_SED - program_transform_name="`echo $program_transform_name|sed -f conftestsed`" - rm -f conftestsed + { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! +Check your system clock" >&5 +echo "$as_me: error: newly created file is older than distributed files! +Check your system clock" >&2;} + { (exit 1); exit 1; }; } fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 test "$program_prefix" != NONE && - program_transform_name="s,^,${program_prefix},; $program_transform_name" + program_transform_name="s,^,$program_prefix,;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && - program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" + program_transform_name="s,\$,$program_suffix,;$program_transform_name" +# Double any \ or $. echo might interpret backslashes. +# By default was `s,x,x', remove it if useless. +cat <<\_ACEOF >conftest.sed +s/[\\$]/&&/g;s/;s,x,x,$// +_ACEOF +program_transform_name=`echo $program_transform_name | sed -f conftest.sed` +rm conftest.sed -# sed with no file args requires a program. -test "$program_transform_name" = "" && program_transform_name="s,x,x," +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` -echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:899: checking whether ${MAKE-make} sets \${MAKE}" >&5 -set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " else - cat > conftestmake <<\EOF + am_missing_run= + { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 +echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} +fi + +if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then + # We used to keeping the `.' as first argument, in order to + # allow $(mkdir_p) to be used without argument. As in + # $(mkdir_p) $(somedir) + # where $(somedir) is conditionally defined. However this is wrong + # for two reasons: + # 1. if the package is installed by a user who cannot write `.' + # make install will fail, + # 2. the above comment should most certainly read + # $(mkdir_p) $(DESTDIR)$(somedir) + # so it does not work when $(somedir) is undefined and + # $(DESTDIR) is not. + # To support the latter case, we have to write + # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), + # so the `.' trick is pointless. + mkdir_p='mkdir -p --' +else + # On NextStep and OpenStep, the `mkdir' command does not + # recognize any option. It will interpret all options as + # directories to create, and then abort because `.' already + # exists. + for d in ./-p ./--version; + do + test -d $d && rmdir $d + done + # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. + if test -f "$ac_aux_dir/mkinstalldirs"; then + mkdir_p='$(mkinstalldirs)' + else + mkdir_p='$(install_sh) -d' + fi +fi + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_AWK+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AWK="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + echo "$as_me:$LINENO: result: $AWK" >&5 +echo "${ECHO_T}$AWK" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$AWK" && break +done + +echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.make <<\_ACEOF all: - @echo 'ac_maketemp="${MAKE}"' -EOF + @echo 'ac_maketemp="$(MAKE)"' +_ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. -eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi -rm -f conftestmake +rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$ac_t""yes" 1>&6 + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 SET_MAKE= else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi - -PACKAGE=binutils - -VERSION=${BFD_VERSION} - -if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then - { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ fi -cat >> confdefs.h </dev/null + +DEPDIR="${am__leading_dot}deps" + + ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 +echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6 +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi + + +echo "$as_me:$LINENO: result: $_am_result" >&5 +echo "${ECHO_T}$_am_result" >&6 +rm -f confinc confmf + +# Check whether --enable-dependency-tracking or --disable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then + enableval="$enable_dependency_tracking" + +fi; +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi + + +if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + + +# test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then + { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 +echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} + { (exit 1); exit 1; }; } +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE=binutils + VERSION=${BFD_VERSION} + + +cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" -EOF +_ACEOF -cat >> confdefs.h <>confdefs.h <<_ACEOF #define VERSION "$VERSION" -EOF +_ACEOF + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} -missing_dir=`cd $ac_aux_dir && pwd` -echo $ac_n "checking for working aclocal""... $ac_c" 1>&6 -echo "configure:945: checking for working aclocal" >&5 -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if (aclocal --version) < /dev/null > /dev/null 2>&1; then - ACLOCAL=aclocal - echo "$ac_t""found" 1>&6 + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + +install_sh=${install_sh-"$am_aux_dir/install-sh"} + +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ACLOCAL="$missing_dir/missing aclocal" - echo "$ac_t""missing" 1>&6 + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + echo "$as_me:$LINENO: result: $STRIP" >&5 +echo "${ECHO_T}$STRIP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi -echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 -echo "configure:958: checking for working autoconf" >&5 -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if (autoconf --version) < /dev/null > /dev/null 2>&1; then - AUTOCONF=autoconf - echo "$ac_t""found" 1>&6 +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - AUTOCONF="$missing_dir/missing autoconf" - echo "$ac_t""missing" 1>&6 + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 +echo "${ECHO_T}$ac_ct_STRIP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi -echo $ac_n "checking for working automake""... $ac_c" 1>&6 -echo "configure:971: checking for working automake" >&5 -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if (automake --version) < /dev/null > /dev/null 2>&1; then - AUTOMAKE=automake - echo "$ac_t""found" 1>&6 + STRIP=$ac_ct_STRIP else - AUTOMAKE="$missing_dir/missing automake" - echo "$ac_t""missing" 1>&6 + STRIP="$ac_cv_prog_STRIP" fi -echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 -echo "configure:984: checking for working autoheader" >&5 -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if (autoheader --version) < /dev/null > /dev/null 2>&1; then - AUTOHEADER=autoheader - echo "$ac_t""found" 1>&6 +fi +INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +# Always define AMTAR for backward compatibility. + +AMTAR=${AMTAR-"${am_missing_run}tar"} + +am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' + + + + +depcc="$CC" am_compiler_list= + +echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 +echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - AUTOHEADER="$missing_dir/missing autoheader" - echo "$ac_t""missing" 1>&6 + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none fi -echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 -echo "configure:997: checking for working makeinfo" >&5 -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if (makeinfo --version) < /dev/null > /dev/null 2>&1; then - MAKEINFO=makeinfo - echo "$ac_t""found" 1>&6 -else - MAKEINFO="$missing_dir/missing makeinfo" - echo "$ac_t""missing" 1>&6 fi +echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 +echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6 +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + + +if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + @@ -1028,8 +3093,7 @@ no) enable_shared=no ;; esac else enable_shared=yes -fi - +fi; # Check whether --enable-static or --disable-static was given. if test "${enable_static+set}" = set; then enableval="$enable_static" @@ -1051,8 +3115,7 @@ no) enable_static=no ;; esac else enable_static=yes -fi - +fi; # Check whether --enable-fast-install or --disable-fast-install was given. if test "${enable_fast_install+set}" = set; then enableval="$enable_fast_install" @@ -1074,229 +3137,7 @@ no) enable_fast_install=no ;; esac else enable_fast_install=yes -fi - -# Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1083: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="gcc" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1113: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_prog_rejected=no - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - break - fi - done - IFS="$ac_save_ifs" -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# -gt 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - set dummy "$ac_dir/$ac_word" "$@" - shift - ac_cv_prog_CC="$@" - fi -fi -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - if test -z "$CC"; then - case "`uname -s`" in - *win32* | *WIN32*) - # Extract the first word of "cl", so it can be a program name with args. -set dummy cl; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1164: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="cl" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - ;; - esac - fi - test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } -fi - -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1196: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -cat > conftest.$ac_ext << EOF - -#line 1207 "configure" -#include "confdefs.h" - -main(){return(0);} -EOF -if { (eval echo configure:1212: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - ac_cv_prog_cc_works=yes - # If we can't run a trivial program, we are probably using a cross compiler. - if (./conftest; exit) 2>/dev/null; then - ac_cv_prog_cc_cross=no - else - ac_cv_prog_cc_cross=yes - fi -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_prog_cc_works=no -fi -rm -fr conftest* -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 -if test $ac_cv_prog_cc_works = no; then - { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } -fi -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1238: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 -echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 -cross_compiling=$ac_cv_prog_cc_cross - -echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:1243: checking whether we are using GNU C" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gcc=yes -else - ac_cv_prog_gcc=no -fi -fi - -echo "$ac_t""$ac_cv_prog_gcc" 1>&6 - -if test $ac_cv_prog_gcc = yes; then - GCC=yes -else - GCC= -fi - -ac_test_CFLAGS="${CFLAGS+set}" -ac_save_CFLAGS="$CFLAGS" -CFLAGS= -echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1271: checking whether ${CC-cc} accepts -g" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - echo 'void f(){}' > conftest.c -if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then - ac_cv_prog_cc_g=yes -else - ac_cv_prog_cc_g=no -fi -rm -f conftest* - -fi - -echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 -if test "$ac_test_CFLAGS" = set; then - CFLAGS="$ac_save_CFLAGS" -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi +fi; # Check whether --with-gnu-ld or --without-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then @@ -1304,13 +3145,12 @@ if test "${with_gnu_ld+set}" = set; then test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no -fi - +fi; ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. - echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6 -echo "configure:1314: checking for ld used by GCC" >&5 + echo "$as_me:$LINENO: checking for ld used by GCC" >&5 +echo $ECHO_N "checking for ld used by GCC... $ECHO_C" >&6 case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw @@ -1339,14 +3179,14 @@ echo "configure:1314: checking for ld used by GCC" >&5 ;; esac elif test "$with_gnu_ld" = yes; then - echo $ac_n "checking for GNU ld""... $ac_c" 1>&6 -echo "configure:1344: checking for GNU ld" >&5 + echo "$as_me:$LINENO: checking for GNU ld" >&5 +echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6 else - echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 -echo "configure:1347: checking for non-GNU ld" >&5 + echo "$as_me:$LINENO: checking for non-GNU ld" >&5 +echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6 fi -if eval "test \"`echo '$''{'lt_cv_path_LD'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +if test "${lt_cv_path_LD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$LD"; then IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" @@ -1372,15 +3212,19 @@ fi LD="$lt_cv_path_LD" if test -n "$LD"; then - echo "$ac_t""$LD" 1>&6 + echo "$as_me:$LINENO: result: $LD" >&5 +echo "${ECHO_T}$LD" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi -test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; } -echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6 -echo "configure:1382: checking if the linker ($LD) is GNU ld" >&5 -if eval "test \"`echo '$''{'lt_cv_prog_gnu_ld'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 +echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} + { (exit 1); exit 1; }; } +echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 +echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6 +if test "${lt_cv_prog_gnu_ld+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else # I'd rather use --version here, but apparently some GNU ld's only accept -v. if $LD -v 2>&1 &5; then @@ -1389,27 +3233,27 @@ else lt_cv_prog_gnu_ld=no fi fi - -echo "$ac_t""$lt_cv_prog_gnu_ld" 1>&6 +echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5 +echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 with_gnu_ld=$lt_cv_prog_gnu_ld -echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6 -echo "configure:1399: checking for $LD option to reload object files" >&5 -if eval "test \"`echo '$''{'lt_cv_ld_reload_flag'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5 +echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6 +if test "${lt_cv_ld_reload_flag+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_ld_reload_flag='-r' fi - -echo "$ac_t""$lt_cv_ld_reload_flag" 1>&6 +echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5 +echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6 reload_flag=$lt_cv_ld_reload_flag test -n "$reload_flag" && reload_flag=" $reload_flag" -echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6 -echo "configure:1411: checking for BSD-compatible nm" >&5 -if eval "test \"`echo '$''{'lt_cv_path_NM'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5 +echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6 +if test "${lt_cv_path_NM+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$NM"; then # Let the user override the test. @@ -1442,33 +3286,24 @@ fi fi NM="$lt_cv_path_NM" -echo "$ac_t""$NM" 1>&6 +echo "$as_me:$LINENO: result: $NM" >&5 +echo "${ECHO_T}$NM" >&6 -echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:1449: checking whether ln -s works" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking whether ln -s works" >&5 +echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6 +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 else - rm -f conftestdata -if ln -s X conftestdata 2>/dev/null -then - rm -f conftestdata - ac_cv_prog_LN_S="ln -s" -else - ac_cv_prog_LN_S=ln -fi -fi -LN_S="$ac_cv_prog_LN_S" -if test "$ac_cv_prog_LN_S" = "ln -s"; then - echo "$ac_t""yes" 1>&6 -else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no, using $LN_S" >&5 +echo "${ECHO_T}no, using $LN_S" >&6 fi -echo $ac_n "checking how to recognise dependant libraries""... $ac_c" 1>&6 -echo "configure:1470: checking how to recognise dependant libraries" >&5 -if eval "test \"`echo '$''{'lt_cv_deplibs_check_method'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking how to recognise dependant libraries" >&5 +echo $ECHO_N "checking how to recognise dependant libraries... $ECHO_C" >&6 +if test "${lt_cv_deplibs_check_method+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= @@ -1505,6 +3340,7 @@ cygwin* | mingw* |pw32*) ;; darwin* | rhapsody*) + # this will be overwritten by pass_all, but leave it in just in case lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' lt_cv_file_magic_cmd='/usr/bin/file -L' case "$host_os" in @@ -1515,9 +3351,10 @@ darwin* | rhapsody*) lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' ;; esac + lt_cv_deplibs_check_method=pass_all ;; -freebsd* ) +freebsd* | kfreebsd*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then case $host_cpu in i*86 ) @@ -1575,17 +3412,10 @@ irix5* | irix6*) # This must be Linux ELF. linux-gnu*) - case $host_cpu in - alpha* | mips* | hppa* | i*86 | powerpc* | sparc* | ia64* ) - lt_cv_deplibs_check_method=pass_all ;; - *) - # glibc up to 2.1.1 does not perform some relocations on ARM - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; - esac - lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` + lt_cv_deplibs_check_method=pass_all ;; -netbsd*) +netbsd* | knetbsd*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' else @@ -1633,84 +3463,85 @@ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) esac fi - -echo "$ac_t""$lt_cv_deplibs_check_method" 1>&6 +echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5 +echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6 file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method -echo $ac_n "checking for object suffix""... $ac_c" 1>&6 -echo "configure:1643: checking for object suffix" >&5 -if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - rm -f conftest* -echo 'int i = 1;' > conftest.$ac_ext -if { (eval echo configure:1649: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - for ac_file in conftest.*; do - case $ac_file in - *.c) ;; - *) ac_cv_objext=`echo $ac_file | sed -e s/conftest.//` ;; - esac - done -else - { echo "configure: error: installation or configuration problem; compiler does not work" 1>&2; exit 1; } -fi -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_objext" 1>&6 -OBJEXT=$ac_cv_objext -ac_objext=$ac_cv_objext -echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:1669: checking for executable suffix" >&5 -if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$CYGWIN" = yes || test "$MINGW32" = yes; then - ac_cv_exeext=.exe -else - rm -f conftest* - echo 'int main () { return 0; }' > conftest.$ac_ext - ac_cv_exeext= - if { (eval echo configure:1679: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then - for file in conftest.*; do - case $file in - *.c | *.o | *.obj | *.ilk | *.pdb) ;; - *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; - esac - done - else - { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; } - fi - rm -f conftest* - test x"${ac_cv_exeext}" = x && ac_cv_exeext=no -fi -fi - -EXEEXT="" -test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext} -echo "$ac_t""${ac_cv_exeext}" 1>&6 -ac_exeext=$EXEEXT - -if test $host != $build; then - ac_tool_prefix=${host_alias}- -else - ac_tool_prefix= -fi - # Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! +# find the maximum length of command line arguments +echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5 +echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6 +if test "${lt_cv_sys_max_cmd_len+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + i=0 + teststring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + cygwin* | mingw*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for *BSD + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + esac + +fi + +if test -n "$lt_cv_sys_max_cmd_len" ; then + echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5 +echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6 +else + echo "$as_me:$LINENO: result: none" >&5 +echo "${ECHO_T}none" >&6 +fi + + # Only perform the check for file, if the check method requires it case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then - echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6 -echo "configure:1712: checking for ${ac_tool_prefix}file" >&5 -if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5 +echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6 +if test "${lt_cv_path_MAGIC_CMD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else case $MAGIC_CMD in /*) @@ -1762,17 +3593,19 @@ fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then - echo "$ac_t""$MAGIC_CMD" 1>&6 + echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 +echo "${ECHO_T}$MAGIC_CMD" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then - echo $ac_n "checking for file""... $ac_c" 1>&6 -echo "configure:1774: checking for file" >&5 -if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking for file" >&5 +echo $ECHO_N "checking for file... $ECHO_C" >&6 +if test "${lt_cv_path_MAGIC_CMD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else case $MAGIC_CMD in /*) @@ -1824,9 +3657,11 @@ fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then - echo "$ac_t""$MAGIC_CMD" 1>&6 + echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 +echo "${ECHO_T}$MAGIC_CMD" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi else @@ -1838,138 +3673,164 @@ fi ;; esac -# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1845: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + fi fi -RANLIB="$ac_cv_prog_RANLIB" +RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then - echo "$ac_t""$RANLIB" 1>&6 + echo "$as_me:$LINENO: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - +fi if test -z "$ac_cv_prog_RANLIB"; then -if test -n "$ac_tool_prefix"; then + ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1877: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_RANLIB="ranlib" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" fi fi -RANLIB="$ac_cv_prog_RANLIB" -if test -n "$RANLIB"; then - echo "$ac_t""$RANLIB" 1>&6 +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 +echo "${ECHO_T}$ac_ct_RANLIB" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi + RANLIB=$ac_ct_RANLIB else - RANLIB=":" -fi + RANLIB="$ac_cv_prog_RANLIB" fi -# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1912: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + fi fi -STRIP="$ac_cv_prog_STRIP" +STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then - echo "$ac_t""$STRIP" 1>&6 + echo "$as_me:$LINENO: result: $STRIP" >&5 +echo "${ECHO_T}$STRIP" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - +fi if test -z "$ac_cv_prog_STRIP"; then -if test -n "$ac_tool_prefix"; then + ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1944: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_STRIP="strip" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_STRIP" && ac_cv_prog_STRIP=":" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" fi fi -STRIP="$ac_cv_prog_STRIP" -if test -n "$STRIP"; then - echo "$ac_t""$STRIP" 1>&6 +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 +echo "${ECHO_T}$ac_ct_STRIP" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi + STRIP=$ac_ct_STRIP else - STRIP=":" -fi + STRIP="$ac_cv_prog_STRIP" fi @@ -1985,20 +3846,19 @@ test "$lt_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" # Check whether --enable-libtool-lock or --disable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then enableval="$enable_libtool_lock" - : -fi +fi; test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" + # Check whether --with-pic or --without-pic was given. if test "${with_pic+set}" = set; then withval="$with_pic" pic_mode="$withval" else pic_mode=default -fi - +fi; test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic" test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic" @@ -2007,8 +3867,12 @@ test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic" case $host in *-*-irix6*) # Find out which ABI we are using. - echo '#line 2011 "configure"' > conftest.$ac_ext - if { (eval echo configure:2012: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + echo '#line 3870 "configure"' > conftest.$ac_ext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) @@ -2041,7 +3905,11 @@ case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext - if { (eval echo configure:2045: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then case "`/usr/bin/file conftest.o`" in *ELF-32*) HPUX_IA64_MODE="32" @@ -2054,51 +3922,124 @@ ia64-*-hpux*) rm -rf conftest* ;; +x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + case "`/usr/bin/file conftest.o`" in + *32-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" - echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6 -echo "configure:2063: checking whether the C compiler needs -belf" >&5 -if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5 +echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6 +if test "${lt_cv_cc_needs_belf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - + + ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -int main() { +int +main () +{ -; return 0; } -EOF -if { (eval echo configure:2083: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then lt_cv_cc_needs_belf=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - lt_cv_cc_needs_belf=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +lt_cv_cc_needs_belf=no fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu fi - -echo "$ac_t""$lt_cv_cc_needs_belf" 1>&6 +echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5 +echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6 if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" @@ -2110,54 +4051,61 @@ esac # Save cache, so that ltconfig can load it -cat > confcache <<\EOF +cat >confcache <<\_ACEOF # 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. +# scripts and configure runs, see configure's option --config-cache. +# 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. +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. # -EOF +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. -(set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote substitution - # turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - -e "s/'/'\\\\''/g" \ - -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' - ;; - esac >> confcache -if cmp -s $cache_file confcache; then - : -else +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then - echo "updating cache $cache_file" - cat confcache > $cache_file + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache - # Actually configure libtool. ac_aux_dir is where install-sh is found. AR="$AR" LTCC="$CC" CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ @@ -2167,15 +4115,26 @@ objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ deplibs_check_method="$deplibs_check_method" file_magic_cmd="$file_magic_cmd" \ ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ $libtool_flags --no-verify --build="$build" $ac_aux_dir/ltmain.sh $host \ -|| { echo "configure: error: libtool configure failed" 1>&2; exit 1; } +|| { { echo "$as_me:$LINENO: error: libtool configure failed" >&5 +echo "$as_me: error: libtool configure failed" >&2;} + { (exit 1); exit 1; }; } # Reload cache, that may have been modified by ltconfig if test -r "$cache_file"; then - echo "loading cache $cache_file" - . $cache_file + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi else - echo "creating cache $cache_file" - > $cache_file + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file fi @@ -2189,274 +4148,554 @@ LIBTOOL='$(SHELL) $(top_builddir)/libtool' # clobbered by the next message. exec 5>>./config.log - - - - + + + + # Check whether --enable-targets or --disable-targets was given. if test "${enable_targets+set}" = set; then enableval="$enable_targets" case "${enableval}" in - yes | "") { echo "configure: error: enable-targets option must specify target names or 'all'" 1>&2; exit 1; } + yes | "") { { echo "$as_me:$LINENO: error: enable-targets option must specify target names or 'all'" >&5 +echo "$as_me: error: enable-targets option must specify target names or 'all'" >&2;} + { (exit 1); exit 1; }; } ;; no) enable_targets= ;; *) enable_targets=$enableval ;; esac -fi -# Check whether --enable-commonbfdlib or --disable-commonbfdlib was given. +fi; # Check whether --enable-commonbfdlib or --disable-commonbfdlib was given. if test "${enable_commonbfdlib+set}" = set; then enableval="$enable_commonbfdlib" case "${enableval}" in yes) commonbfdlib=true ;; no) commonbfdlib=false ;; - *) { echo "configure: error: bad value ${enableval} for BFD commonbfdlib option" 1>&2; exit 1; } ;; + *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for BFD commonbfdlib option" >&5 +echo "$as_me: error: bad value ${enableval} for BFD commonbfdlib option" >&2;} + { (exit 1); exit 1; }; } ;; esac +fi; + +GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes" + +# Check whether --enable-werror or --disable-werror was given. +if test "${enable_werror+set}" = set; then + enableval="$enable_werror" + case "${enableval}" in + yes | y) ERROR_ON_WARNING="yes" ;; + no | n) ERROR_ON_WARNING="no" ;; + *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-werror" >&5 +echo "$as_me: error: bad value ${enableval} for --enable-werror" >&2;} + { (exit 1); exit 1; }; } ;; + esac +fi; + +# Enable -Werror by default when using gcc +if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then + ERROR_ON_WARNING=yes +fi + +NO_WERROR= +if test "${ERROR_ON_WARNING}" = yes ; then + GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror" + NO_WERROR="-Wno-error" +fi + +if test "${GCC}" = yes ; then + WARN_CFLAGS="${GCC_WARN_CFLAGS}" fi -build_warnings="-W -Wall -Wstrict-prototypes -Wmissing-prototypes" # Check whether --enable-build-warnings or --disable-build-warnings was given. if test "${enable_build_warnings+set}" = set; then enableval="$enable_build_warnings" case "${enableval}" in - yes) ;; - no) build_warnings="-w";; + yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}";; + no) if test "${GCC}" = yes ; then + WARN_CFLAGS="-w" + fi;; ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"` - build_warnings="${build_warnings} ${t}";; + WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";; *,) t=`echo "${enableval}" | sed -e "s/,/ /g"` - build_warnings="${t} ${build_warnings}";; - *) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;; + WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";; + *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;; esac -if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then - echo "Setting warning flags = $build_warnings" 6>&1 -fi -fi -WARN_CFLAGS="" -if test "x${build_warnings}" != x -a "x$GCC" = xyes ; then - WARN_CFLAGS="${build_warnings}" +fi; + +if test x"$silent" != x"yes" && test x"$WARN_CFLAGS" != x""; then + echo "Setting warning flags = $WARN_CFLAGS" 6>&1 fi + ac_config_headers="$ac_config_headers config.h:config.in" + if test -z "$target" ; then - { echo "configure: error: Unrecognized target system type; please check config.sub." 1>&2; exit 1; } + { { echo "$as_me:$LINENO: error: Unrecognized target system type; please check config.sub." >&5 +echo "$as_me: error: Unrecognized target system type; please check config.sub." >&2;} + { (exit 1); exit 1; }; } fi if test -z "$host" ; then - { echo "configure: error: Unrecognized host system type; please check config.sub." 1>&2; exit 1; } + { { echo "$as_me:$LINENO: error: Unrecognized host system type; please check config.sub." >&5 +echo "$as_me: error: Unrecognized host system type; please check config.sub." >&2;} + { (exit 1); exit 1; }; } fi -# Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2256: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="gcc" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + fi fi -CC="$ac_cv_prog_CC" +CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" fi if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2286: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_prog_rejected=no - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift - if test $# -gt 0; then + if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift - set dummy "$ac_dir/$ac_word" "$@" - shift - ac_cv_prog_CC="$@" + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi -CC="$ac_cv_prog_CC" +CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - if test -z "$CC"; then - case "`uname -s`" in - *win32* | *WIN32*) - # Extract the first word of "cl", so it can be a program name with args. -set dummy cl; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2337: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="cl" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + fi fi -CC="$ac_cv_prog_CC" +CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - ;; - esac + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 fi - test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +done +done + fi - -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:2369: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -cat > conftest.$ac_ext << EOF - -#line 2380 "configure" -#include "confdefs.h" - -main(){return(0);} -EOF -if { (eval echo configure:2385: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - ac_cv_prog_cc_works=yes - # If we can't run a trivial program, we are probably using a cross compiler. - if (./conftest; exit) 2>/dev/null; then - ac_cv_prog_cc_cross=no - else - ac_cv_prog_cc_cross=yes - fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_prog_cc_works=no + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi -rm -fr conftest* -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross -echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 -if test $ac_cv_prog_cc_works = no; then - { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC fi -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:2411: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 -echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 -cross_compiling=$ac_cv_prog_cc_cross -echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:2416: checking whether we are using GNU C" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.c <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me #endif -EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2425: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gcc=yes -else - ac_cv_prog_gcc=no -fi -fi -echo "$ac_t""$ac_cv_prog_gcc" 1>&6 - -if test $ac_cv_prog_gcc = yes; then - GCC=yes + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes else - GCC= + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu -ac_test_CFLAGS="${CFLAGS+set}" -ac_save_CFLAGS="$CFLAGS" -CFLAGS= -echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:2444: checking whether ${CC-cc} accepts -g" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - echo 'void f(){}' > conftest.c -if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else - ac_cv_prog_cc_g=no -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_prog_cc_g=no fi - -echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then - CFLAGS="$ac_save_CFLAGS" + CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" @@ -2470,371 +4709,997 @@ else CFLAGS= fi fi +echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std1 is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std1. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + '' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +#include +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +continue +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +cat >>confdefs.h <<\_ACEOF +#define _GNU_SOURCE 1 +_ACEOF + for ac_prog in 'bison -y' byacc do -# Extract the first word of "$ac_prog", so it can be a program name with args. + # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2481: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_YACC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$YACC"; then ac_cv_prog_YACC="$YACC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_YACC="$ac_prog" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_YACC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + fi fi -YACC="$ac_cv_prog_YACC" +YACC=$ac_cv_prog_YACC if test -n "$YACC"; then - echo "$ac_t""$YACC" 1>&6 + echo "$as_me:$LINENO: result: $YACC" >&5 +echo "${ECHO_T}$YACC" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi -test -n "$YACC" && break + test -n "$YACC" && break done test -n "$YACC" || YACC="yacc" -echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:2512: checking how to run the C preprocessor" >&5 -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then -if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - # This must be in double quotes, not single quotes, because CPP may get - # substituted into the Makefile and "${CC-cc}" will confuse make. - CPP="${CC-cc} -E" - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. - cat > conftest.$ac_ext < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2533: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -E -traditional-cpp" - cat > conftest.$ac_ext < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2550: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -nologo -E" - cat > conftest.$ac_ext < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2567: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP=/lib/cpp -fi -rm -f conftest* -fi -rm -f conftest* -fi -rm -f conftest* - ac_cv_prog_CPP="$CPP" -fi - CPP="$ac_cv_prog_CPP" -else - ac_cv_prog_CPP="$CPP" -fi -echo "$ac_t""$CPP" 1>&6 - -missing_dir=`cd $ac_aux_dir && pwd` for ac_prog in flex lex do -# Extract the first word of "$ac_prog", so it can be a program name with args. + # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2597: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_LEX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$LEX"; then ac_cv_prog_LEX="$LEX" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_LEX="$ac_prog" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -LEX="$ac_cv_prog_LEX" -if test -n "$LEX"; then - echo "$ac_t""$LEX" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -test -n "$LEX" && break +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_LEX="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done done -test -n "$LEX" || LEX="$missing_dir/missing flex" -# Extract the first word of "flex", so it can be a program name with args. -set dummy flex; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2630: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$LEX"; then - ac_cv_prog_LEX="$LEX" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_LEX="flex" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_LEX" && ac_cv_prog_LEX="lex" fi fi -LEX="$ac_cv_prog_LEX" +LEX=$ac_cv_prog_LEX if test -n "$LEX"; then - echo "$ac_t""$LEX" 1>&6 + echo "$as_me:$LINENO: result: $LEX" >&5 +echo "${ECHO_T}$LEX" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi + test -n "$LEX" && break +done +test -n "$LEX" || LEX=":" + if test -z "$LEXLIB" then - case "$LEX" in - flex*) ac_lib=fl ;; - *) ac_lib=l ;; - esac - echo $ac_n "checking for yywrap in -l$ac_lib""... $ac_c" 1>&6 -echo "configure:2664: checking for yywrap in -l$ac_lib" >&5 -ac_lib_var=`echo $ac_lib'_'yywrap | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking for yywrap in -lfl" >&5 +echo $ECHO_N "checking for yywrap in -lfl... $ECHO_C" >&6 +if test "${ac_cv_lib_fl_yywrap+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_LIBS="$LIBS" -LIBS="-l$ac_lib $LIBS" -cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char yywrap(); - -int main() { -yywrap() -; return 0; } -EOF -if { (eval echo configure:2683: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" + builtin and then its argument prototype would still apply. */ +char yywrap (); +int +main () +{ +yywrap (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_fl_yywrap=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_lib_fl_yywrap=no fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - LEXLIB="-l$ac_lib" +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_fl_yywrap" >&5 +echo "${ECHO_T}$ac_cv_lib_fl_yywrap" >&6 +if test $ac_cv_lib_fl_yywrap = yes; then + LEXLIB="-lfl" else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: checking for yywrap in -ll" >&5 +echo $ECHO_N "checking for yywrap in -ll... $ECHO_C" >&6 +if test "${ac_cv_lib_l_yywrap+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ll $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char yywrap (); +int +main () +{ +yywrap (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_l_yywrap=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_l_yywrap=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_l_yywrap" >&5 +echo "${ECHO_T}$ac_cv_lib_l_yywrap" >&6 +if test $ac_cv_lib_l_yywrap = yes; then + LEXLIB="-ll" fi fi -echo $ac_n "checking lex output file root""... $ac_c" 1>&6 -echo "configure:2706: checking lex output file root" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_lex_root'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +fi + +if test "x$LEX" != "x:"; then + echo "$as_me:$LINENO: checking lex output file root" >&5 +echo $ECHO_N "checking lex output file root... $ECHO_C" >&6 +if test "${ac_cv_prog_lex_root+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else # The minimal lex program is just a single line: %%. But some broken lexes # (Solaris, I think it was) want two %% lines, so accommodate them. -echo '%% -%%' | $LEX +cat >conftest.l <<_ACEOF +%% +%% +_ACEOF +{ (eval echo "$as_me:$LINENO: \"$LEX conftest.l\"") >&5 + (eval $LEX conftest.l) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } if test -f lex.yy.c; then ac_cv_prog_lex_root=lex.yy elif test -f lexyy.c; then ac_cv_prog_lex_root=lexyy else - { echo "configure: error: cannot find output from $LEX; giving up" 1>&2; exit 1; } + { { echo "$as_me:$LINENO: error: cannot find output from $LEX; giving up" >&5 +echo "$as_me: error: cannot find output from $LEX; giving up" >&2;} + { (exit 1); exit 1; }; } fi fi - -echo "$ac_t""$ac_cv_prog_lex_root" 1>&6 +echo "$as_me:$LINENO: result: $ac_cv_prog_lex_root" >&5 +echo "${ECHO_T}$ac_cv_prog_lex_root" >&6 +rm -f conftest.l LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root -echo $ac_n "checking whether yytext is a pointer""... $ac_c" 1>&6 -echo "configure:2727: checking whether yytext is a pointer" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_lex_yytext_pointer'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking whether yytext is a pointer" >&5 +echo $ECHO_N "checking whether yytext is a pointer... $ECHO_C" >&6 +if test "${ac_cv_prog_lex_yytext_pointer+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else # POSIX says lex can declare yytext either as a pointer or an array; the # default is implementation-dependent. Figure out which it is, since # not all implementations provide the %pointer and %array declarations. ac_cv_prog_lex_yytext_pointer=no echo 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.c -ac_save_LIBS="$LIBS" +ac_save_LIBS=$LIBS LIBS="$LIBS $LEXLIB" -cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF `cat $LEX_OUTPUT_ROOT.c` -int main() { - -; return 0; } -EOF -if { (eval echo configure:2746: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_prog_lex_yytext_pointer=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest* -LIBS="$ac_save_LIBS" +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_save_LIBS rm -f "${LEX_OUTPUT_ROOT}.c" fi - -echo "$ac_t""$ac_cv_prog_lex_yytext_pointer" 1>&6 +echo "$as_me:$LINENO: result: $ac_cv_prog_lex_yytext_pointer" >&5 +echo "${ECHO_T}$ac_cv_prog_lex_yytext_pointer" >&6 if test $ac_cv_prog_lex_yytext_pointer = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define YYTEXT_POINTER 1 -EOF +_ACEOF fi +fi +if test "$LEX" = :; then + LEX=${am_missing_run}flex +fi -ALL_LINGUAS="fr tr ja es sv da zh_CN ru" -# Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2772: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +ALL_LINGUAS="fr tr ja es sv da zh_CN ru ro rw zh_TW fi vi" +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_RANLIB="ranlib" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + fi fi -RANLIB="$ac_cv_prog_RANLIB" +RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then - echo "$ac_t""$RANLIB" 1>&6 + echo "$as_me:$LINENO: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi -echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:2800: checking for ANSI C header files" >&5 -if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 +echo "${ECHO_T}$ac_ct_RANLIB" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + RANLIB=$ac_ct_RANLIB +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6 +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6 +if test "${ac_cv_prog_egrep+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if echo a | (grep -E '(a|b)') >/dev/null 2>&1 + then ac_cv_prog_egrep='grep -E' + else ac_cv_prog_egrep='egrep' + fi +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 +echo "${ECHO_T}$ac_cv_prog_egrep" >&6 + EGREP=$ac_cv_prog_egrep + + +echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #include #include #include -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2813: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_header_stdc=yes else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_header_stdc=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdc=no fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. -cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include -EOF + +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "memchr" >/dev/null 2>&1; then + $EGREP "memchr" >/dev/null 2>&1; then : else - rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* @@ -2843,16 +5708,19 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. -cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include -EOF + +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "free" >/dev/null 2>&1; then + $EGREP "free" >/dev/null 2>&1; then : else - rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* @@ -2861,269 +5729,530 @@ fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. -if test "$cross_compiling" = yes; then + if test "$cross_compiling" = yes; then : else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include -#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int main () { int i; for (i = 0; i < 256; i++) -if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); -exit (0); } +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif -EOF -if { (eval echo configure:2880: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then : else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_header_stdc=no -fi -rm -fr conftest* -fi + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi - -echo "$ac_t""$ac_cv_header_stdc" 1>&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 -EOF +_ACEOF fi -echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:2904: checking for working const" >&5 -if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 +echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 +if test "${ac_cv_c_const+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -int main() { +int +main () +{ +/* FIXME: Include the comments suggested by Paul. */ +#ifndef __cplusplus + /* Ultrix mips cc rejects this. */ + typedef int charset[2]; + const charset x; + /* SunOS 4.1.1 cc rejects this. */ + char const *const *ccp; + char **p; + /* NEC SVR4.0.2 mips cc rejects this. */ + struct point {int x, y;}; + static struct point const zero = {0,0}; + /* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in + an arm of an if-expression whose if-part is not a constant + expression */ + const char *g = "string"; + ccp = &g + (g ? g-g : 0); + /* HPUX 7.0 cc rejects these. */ + ++ccp; + p = (char**) ccp; + ccp = (char const *const *) p; + { /* SCO 3.2v4 cc rejects this. */ + char *t; + char const *s = 0 ? (char *) 0 : (char const *) 0; -/* Ultrix mips cc rejects this. */ -typedef int charset[2]; const charset x; -/* SunOS 4.1.1 cc rejects this. */ -char const *const *ccp; -char **p; -/* NEC SVR4.0.2 mips cc rejects this. */ -struct point {int x, y;}; -static struct point const zero = {0,0}; -/* AIX XL C 1.02.0.0 rejects this. - It does not let you subtract one const X* pointer from another in an arm - of an if-expression whose if-part is not a constant expression */ -const char *g = "string"; -ccp = &g + (g ? g-g : 0); -/* HPUX 7.0 cc rejects these. */ -++ccp; -p = (char**) ccp; -ccp = (char const *const *) p; -{ /* SCO 3.2v4 cc rejects this. */ - char *t; - char const *s = 0 ? (char *) 0 : (char const *) 0; + *t++ = 0; + } + { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; + } + { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; + } + { /* AIX XL C 1.02.0.0 rejects this saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; }; + struct s *b; b->j = 5; + } + { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; + } +#endif - *t++ = 0; + ; + return 0; } -{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ - int x[] = {25, 17}; - const int *foo = &x[0]; - ++foo; -} -{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ - typedef const int *iptr; - iptr p = 0; - ++p; -} -{ /* AIX XL C 1.02.0.0 rejects this saying - "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ - struct s { int j; const int *ap[3]; }; - struct s *b; b->j = 5; -} -{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ - const int foo = 10; -} - -; return 0; } -EOF -if { (eval echo configure:2958: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_c_const=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_c_const=no -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -echo "$ac_t""$ac_cv_c_const" 1>&6 +ac_cv_c_const=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 +echo "${ECHO_T}$ac_cv_c_const" >&6 if test $ac_cv_c_const = no; then - cat >> confdefs.h <<\EOF -#define const -EOF + +cat >>confdefs.h <<\_ACEOF +#define const +_ACEOF fi -echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:2979: checking for inline" >&5 -if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for inline" >&5 +echo $ECHO_N "checking for inline... $ECHO_C" >&6 +if test "${ac_cv_c_inline+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifndef __cplusplus +typedef int foo_t; +static $ac_kw foo_t static_foo () {return 0; } +$ac_kw foo_t foo () {return 0; } +#endif -int main() { -} $ac_kw foo() { -; return 0; } -EOF -if { (eval echo configure:2993: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_c_inline=$ac_kw; break else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done fi +echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5 +echo "${ECHO_T}$ac_cv_c_inline" >&6 -echo "$ac_t""$ac_cv_c_inline" 1>&6 -case "$ac_cv_c_inline" in + +case $ac_cv_c_inline in inline | yes) ;; - no) cat >> confdefs.h <<\EOF -#define inline -EOF - ;; - *) cat >> confdefs.h <>confdefs.h <<_ACEOF +#ifndef __cplusplus +#define inline $ac_val +#endif +_ACEOF + ;; esac -echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:3019: checking for off_t" >&5 -if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext < -#if STDC_HEADERS -#include -#include -#endif -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "(^|[^a-zA-Z_0-9])off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then - rm -rf conftest* + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +echo "$as_me:$LINENO: checking for off_t" >&5 +echo $ECHO_N "checking for off_t... $ECHO_C" >&6 +if test "${ac_cv_type_off_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if ((off_t *) 0) + return 0; +if (sizeof (off_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_type_off_t=yes else - rm -rf conftest* - ac_cv_type_off_t=no -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_type_off_t=no fi -echo "$ac_t""$ac_cv_type_off_t" 1>&6 -if test $ac_cv_type_off_t = no; then - cat >> confdefs.h <<\EOF -#define off_t long -EOF - +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi - -echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:3052: checking for size_t" >&5 -if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5 +echo "${ECHO_T}$ac_cv_type_off_t" >&6 +if test $ac_cv_type_off_t = yes; then + : else - cat > conftest.$ac_ext < -#if STDC_HEADERS -#include -#include -#endif -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then - rm -rf conftest* + +cat >>confdefs.h <<_ACEOF +#define off_t long +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for size_t" >&5 +echo $ECHO_N "checking for size_t... $ECHO_C" >&6 +if test "${ac_cv_type_size_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if ((size_t *) 0) + return 0; +if (sizeof (size_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_type_size_t=yes else - rm -rf conftest* - ac_cv_type_size_t=no -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_type_size_t=no fi -echo "$ac_t""$ac_cv_type_size_t" 1>&6 -if test $ac_cv_type_size_t = no; then - cat >> confdefs.h <<\EOF +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 +echo "${ECHO_T}$ac_cv_type_size_t" >&6 +if test $ac_cv_type_size_t = yes; then + : +else + +cat >>confdefs.h <<_ACEOF #define size_t unsigned -EOF +_ACEOF fi # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! -echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:3087: checking for working alloca.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for working alloca.h" >&5 +echo $ECHO_N "checking for working alloca.h... $ECHO_C" >&6 +if test "${ac_cv_working_alloca_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include -int main() { -char *p = alloca(2 * sizeof(int)); -; return 0; } -EOF -if { (eval echo configure:3099: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - ac_cv_header_alloca_h=yes +int +main () +{ +char *p = (char *) alloca (2 * sizeof (int)); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_working_alloca_h=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_header_alloca_h=no -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -echo "$ac_t""$ac_cv_header_alloca_h" 1>&6 -if test $ac_cv_header_alloca_h = yes; then - cat >> confdefs.h <<\EOF +ac_cv_working_alloca_h=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_working_alloca_h" >&5 +echo "${ECHO_T}$ac_cv_working_alloca_h" >&6 +if test $ac_cv_working_alloca_h = yes; then + +cat >>confdefs.h <<\_ACEOF #define HAVE_ALLOCA_H 1 -EOF +_ACEOF fi -echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:3120: checking for alloca" >&5 -if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for alloca" >&5 +echo $ECHO_N "checking for alloca... $ECHO_C" >&6 +if test "${ac_cv_func_alloca_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #ifdef __GNUC__ # define alloca __builtin_alloca #else @@ -3145,137 +6274,217 @@ char *alloca (); # endif #endif -int main() { -char *p = (char *) alloca(1); -; return 0; } -EOF -if { (eval echo configure:3153: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* +int +main () +{ +char *p = (char *) alloca (1); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_func_alloca_works=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_func_alloca_works=no -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_alloca_works=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_alloca_works" >&5 +echo "${ECHO_T}$ac_cv_func_alloca_works" >&6 -echo "$ac_t""$ac_cv_func_alloca_works" 1>&6 if test $ac_cv_func_alloca_works = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_ALLOCA 1 -EOF +_ACEOF -fi - -if test $ac_cv_func_alloca_works = no; then - # The SVR3 libPW and SVR4 libucb both contain incompatible functions - # that cause trouble. Some versions do not even contain alloca or - # contain a buggy version. If you still want to use their alloca, - # use ar to extract alloca.o from them instead of compiling alloca.c. - ALLOCA=alloca.${ac_objext} - cat >> confdefs.h <<\EOF -#define C_ALLOCA 1 -EOF - - -echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:3185: checking whether alloca needs Cray hooks" >&5 -if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 else - cat > conftest.$ac_ext <>confdefs.h <<\_ACEOF +#define C_ALLOCA 1 +_ACEOF + + +echo "$as_me:$LINENO: checking whether \`alloca.c' needs Cray hooks" >&5 +echo $ECHO_N "checking whether \`alloca.c' needs Cray hooks... $ECHO_C" >&6 +if test "${ac_cv_os_cray+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #if defined(CRAY) && ! defined(CRAY2) webecray #else wenotbecray #endif -EOF +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "webecray" >/dev/null 2>&1; then - rm -rf conftest* + $EGREP "webecray" >/dev/null 2>&1; then ac_cv_os_cray=yes else - rm -rf conftest* ac_cv_os_cray=no fi rm -f conftest* fi - -echo "$ac_t""$ac_cv_os_cray" 1>&6 +echo "$as_me:$LINENO: result: $ac_cv_os_cray" >&5 +echo "${ECHO_T}$ac_cv_os_cray" >&6 if test $ac_cv_os_cray = yes; then -for ac_func in _getb67 GETB67 getb67; do - echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3215: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + for ac_func in _getb67 GETB67 getb67; do + as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - + builtin and then its argument prototype would still apply. */ +char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif -; return 0; } -EOF -if { (eval echo configure:3243: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - cat >> confdefs.h <&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + +cat >>confdefs.h <<_ACEOF #define CRAY_STACKSEG_END $ac_func -EOF +_ACEOF - break -else - echo "$ac_t""no" 1>&6 + break fi -done + done fi -echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:3270: checking stack direction for C alloca" >&5 -if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking stack direction for C alloca" >&5 +echo $ECHO_N "checking stack direction for C alloca... $ECHO_C" >&6 +if test "${ac_cv_c_stack_direction+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_c_stack_direction=0 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +int find_stack_direction () { static char *addr = 0; @@ -3288,138 +6497,316 @@ find_stack_direction () else return (&dummy > addr) ? 1 : -1; } + +int main () { - exit (find_stack_direction() < 0); + exit (find_stack_direction () < 0); } -EOF -if { (eval echo configure:3297: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_c_stack_direction=1 else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_c_stack_direction=-1 -fi -rm -fr conftest* -fi + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +( exit $ac_status ) +ac_cv_c_stack_direction=-1 fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_c_stack_direction" >&5 +echo "${ECHO_T}$ac_cv_c_stack_direction" >&6 -echo "$ac_t""$ac_cv_c_stack_direction" 1>&6 -cat >> confdefs.h <>confdefs.h <<_ACEOF #define STACK_DIRECTION $ac_cv_c_stack_direction -EOF +_ACEOF + fi -for ac_hdr in unistd.h + + +for ac_header in stdlib.h unistd.h do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3322: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3332: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else - echo "$ac_t""no" 1>&6 + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + done + for ac_func in getpagesize do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3361: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - + builtin and then its argument prototype would still apply. */ +char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif -; return 0; } -EOF -if { (eval echo configure:3389: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 fi done -echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:3414: checking for working mmap" >&5 -if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for working mmap" >&5 +echo $ECHO_N "checking for working mmap... $ECHO_C" >&6 +if test "${ac_cv_func_mmap_fixed_mapped+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_func_mmap_fixed_mapped=no else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +/* malloc might have been renamed as rpl_malloc. */ +#undef malloc /* Thanks to Mike Haertel and Jim Avera for this test. Here is a matrix of mmap possibilities: @@ -3433,34 +6820,34 @@ else back from the file, nor mmap's back from the file at a different address. (There have been systems where private was not correctly implemented like the infamous i386 svr4.0, and systems where the - VM page cache was not coherent with the filesystem buffer cache + VM page cache was not coherent with the file system buffer cache like early versions of FreeBSD and possibly contemporary NetBSD.) For shared mappings, we should conversely verify that changes get - propogated back to all the places they're supposed to be. + propagated back to all the places they're supposed to be. Grep wants private fixed already mapped. The main things grep needs to know about mmap are: * does it exist and is it safe to write into the mmap'd area * how to use it (BSD variants) */ -#include + #include #include -/* This mess was copied from the GNU getpagesize.h. */ -#ifndef HAVE_GETPAGESIZE -# ifdef HAVE_UNISTD_H -# include -# endif +#if !STDC_HEADERS && !HAVE_STDLIB_H +char *malloc (); +#endif +/* This mess was copied from the GNU getpagesize.h. */ +#if !HAVE_GETPAGESIZE /* Assume that all systems that can run configure have sys/param.h. */ -# ifndef HAVE_SYS_PARAM_H +# if !HAVE_SYS_PARAM_H # define HAVE_SYS_PARAM_H 1 # endif # ifdef _SC_PAGESIZE # define getpagesize() sysconf(_SC_PAGESIZE) # else /* no _SC_PAGESIZE */ -# ifdef HAVE_SYS_PARAM_H +# if HAVE_SYS_PARAM_H # include # ifdef EXEC_PAGESIZE # define getpagesize() EXEC_PAGESIZE @@ -3487,469 +6874,910 @@ else #endif /* no HAVE_GETPAGESIZE */ -#ifdef __cplusplus -extern "C" { void *malloc(unsigned); } -#else -char *malloc(); -#endif - int -main() +main () { - char *data, *data2, *data3; - int i, pagesize; - int fd; + char *data, *data2, *data3; + int i, pagesize; + int fd; - pagesize = getpagesize(); + pagesize = getpagesize (); - /* - * First, make a file with some known garbage in it. - */ - data = malloc(pagesize); - if (!data) - exit(1); - for (i = 0; i < pagesize; ++i) - *(data + i) = rand(); - umask(0); - fd = creat("conftestmmap", 0600); - if (fd < 0) - exit(1); - if (write(fd, data, pagesize) != pagesize) - exit(1); - close(fd); + /* First, make a file with some known garbage in it. */ + data = (char *) malloc (pagesize); + if (!data) + exit (1); + for (i = 0; i < pagesize; ++i) + *(data + i) = rand (); + umask (0); + fd = creat ("conftest.mmap", 0600); + if (fd < 0) + exit (1); + if (write (fd, data, pagesize) != pagesize) + exit (1); + close (fd); - /* - * Next, try to mmap the file at a fixed address which - * already has something else allocated at it. If we can, - * also make sure that we see the same garbage. - */ - fd = open("conftestmmap", O_RDWR); - if (fd < 0) - exit(1); - data2 = malloc(2 * pagesize); - if (!data2) - exit(1); - data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1); - if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_FIXED, fd, 0L)) - exit(1); - for (i = 0; i < pagesize; ++i) - if (*(data + i) != *(data2 + i)) - exit(1); + /* Next, try to mmap the file at a fixed address which already has + something else allocated at it. If we can, also make sure that + we see the same garbage. */ + fd = open ("conftest.mmap", O_RDWR); + if (fd < 0) + exit (1); + data2 = (char *) malloc (2 * pagesize); + if (!data2) + exit (1); + data2 += (pagesize - ((long) data2 & (pagesize - 1))) & (pagesize - 1); + if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_FIXED, fd, 0L)) + exit (1); + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data2 + i)) + exit (1); - /* - * Finally, make sure that changes to the mapped area - * do not percolate back to the file as seen by read(). - * (This is a bug on some variants of i386 svr4.0.) - */ - for (i = 0; i < pagesize; ++i) - *(data2 + i) = *(data2 + i) + 1; - data3 = malloc(pagesize); - if (!data3) - exit(1); - if (read(fd, data3, pagesize) != pagesize) - exit(1); - for (i = 0; i < pagesize; ++i) - if (*(data + i) != *(data3 + i)) - exit(1); - close(fd); - unlink("conftestmmap"); - exit(0); + /* Finally, make sure that changes to the mapped area do not + percolate back to the file as seen by read(). (This is a bug on + some variants of i386 svr4.0.) */ + for (i = 0; i < pagesize; ++i) + *(data2 + i) = *(data2 + i) + 1; + data3 = (char *) malloc (pagesize); + if (!data3) + exit (1); + if (read (fd, data3, pagesize) != pagesize) + exit (1); + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data3 + i)) + exit (1); + close (fd); + exit (0); } - -EOF -if { (eval echo configure:3562: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_func_mmap_fixed_mapped=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_func_mmap_fixed_mapped=no -fi -rm -fr conftest* -fi + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +( exit $ac_status ) +ac_cv_func_mmap_fixed_mapped=no fi - -echo "$ac_t""$ac_cv_func_mmap_fixed_mapped" 1>&6 +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_func_mmap_fixed_mapped" >&5 +echo "${ECHO_T}$ac_cv_func_mmap_fixed_mapped" >&6 if test $ac_cv_func_mmap_fixed_mapped = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_MMAP 1 -EOF +_ACEOF fi +rm -f conftest.mmap - - for ac_hdr in argz.h limits.h locale.h nl_types.h malloc.h string.h \ + + + + + + + + + + +for ac_header in argz.h limits.h locale.h nl_types.h malloc.h string.h \ unistd.h values.h sys/param.h do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3590: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3600: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else - echo "$ac_t""no" 1>&6 + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + done - for ac_func in getcwd munmap putenv setenv setlocale strchr strcasecmp \ + + + + + + + + + + +for ac_func in getcwd munmap putenv setenv setlocale strchr strcasecmp \ __argz_count __argz_stringify __argz_next do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3630: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - + builtin and then its argument prototype would still apply. */ +char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif -; return 0; } -EOF -if { (eval echo configure:3658: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 fi done if test "${ac_cv_func_stpcpy+set}" != "set"; then - for ac_func in stpcpy + +for ac_func in stpcpy do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3687: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - + builtin and then its argument prototype would still apply. */ +char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif -; return 0; } -EOF -if { (eval echo configure:3715: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 fi done fi if test "${ac_cv_func_stpcpy}" = "yes"; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_STPCPY 1 -EOF +_ACEOF fi if test $ac_cv_header_locale_h = yes; then - echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6 -echo "configure:3749: checking for LC_MESSAGES" >&5 -if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking for LC_MESSAGES" >&5 +echo $ECHO_N "checking for LC_MESSAGES... $ECHO_C" >&6 +if test "${am_cv_val_LC_MESSAGES+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include -int main() { +int +main () +{ return LC_MESSAGES -; return 0; } -EOF -if { (eval echo configure:3761: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then am_cv_val_LC_MESSAGES=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - am_cv_val_LC_MESSAGES=no -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -echo "$ac_t""$am_cv_val_LC_MESSAGES" 1>&6 +am_cv_val_LC_MESSAGES=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $am_cv_val_LC_MESSAGES" >&5 +echo "${ECHO_T}$am_cv_val_LC_MESSAGES" >&6 if test $am_cv_val_LC_MESSAGES = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_LC_MESSAGES 1 -EOF +_ACEOF fi fi - echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6 -echo "configure:3782: checking whether NLS is requested" >&5 + echo "$as_me:$LINENO: checking whether NLS is requested" >&5 +echo $ECHO_N "checking whether NLS is requested... $ECHO_C" >&6 # Check whether --enable-nls or --disable-nls was given. if test "${enable_nls+set}" = set; then enableval="$enable_nls" USE_NLS=$enableval else USE_NLS=yes -fi +fi; + echo "$as_me:$LINENO: result: $USE_NLS" >&5 +echo "${ECHO_T}$USE_NLS" >&6 - echo "$ac_t""$USE_NLS" 1>&6 - USE_INCLUDED_LIBINTL=no if test "$USE_NLS" = "yes"; then - cat >> confdefs.h <<\EOF -#define ENABLE_NLS 1 -EOF + echo "$as_me:$LINENO: checking whether included gettext is requested" >&5 +echo $ECHO_N "checking whether included gettext is requested... $ECHO_C" >&6 - echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6 -echo "configure:3802: checking whether included gettext is requested" >&5 - # Check whether --with-included-gettext or --without-included-gettext was given. +# Check whether --with-included-gettext or --without-included-gettext was given. if test "${with_included_gettext+set}" = set; then withval="$with_included_gettext" nls_cv_force_use_gnu_gettext=$withval else nls_cv_force_use_gnu_gettext=no -fi - - echo "$ac_t""$nls_cv_force_use_gnu_gettext" 1>&6 +fi; + echo "$as_me:$LINENO: result: $nls_cv_force_use_gnu_gettext" >&5 +echo "${ECHO_T}$nls_cv_force_use_gnu_gettext" >&6 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" if test "$nls_cv_force_use_gnu_gettext" != "yes"; then nls_cv_header_intl= nls_cv_header_libgt= - CATOBJEXT=NONE + CATOBJEXT= - ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for libintl.h""... $ac_c" 1>&6 -echo "configure:3821: checking for libintl.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3831: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" + if test "${ac_cv_header_libintl_h+set}" = set; then + echo "$as_me:$LINENO: checking for libintl.h" >&5 +echo $ECHO_N "checking for libintl.h... $ECHO_C" >&6 +if test "${ac_cv_header_libintl_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - echo $ac_n "checking for gettext in libc""... $ac_c" 1>&6 -echo "configure:3848: checking for gettext in libc" >&5 -if eval "test \"`echo '$''{'gt_cv_func_gettext_libc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: result: $ac_cv_header_libintl_h" >&5 +echo "${ECHO_T}$ac_cv_header_libintl_h" >&6 else - cat > conftest.$ac_ext <&5 +echo $ECHO_N "checking libintl.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default #include -int main() { +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking libintl.h presence" >&5 +echo $ECHO_N "checking libintl.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: libintl.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: libintl.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: libintl.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: libintl.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: libintl.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: libintl.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: libintl.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: libintl.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: libintl.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: libintl.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: libintl.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: libintl.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: libintl.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: libintl.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: libintl.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: libintl.h: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for libintl.h" >&5 +echo $ECHO_N "checking for libintl.h... $ECHO_C" >&6 +if test "${ac_cv_header_libintl_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_libintl_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_libintl_h" >&5 +echo "${ECHO_T}$ac_cv_header_libintl_h" >&6 + +fi +if test $ac_cv_header_libintl_h = yes; then + echo "$as_me:$LINENO: checking for gettext in libc" >&5 +echo $ECHO_N "checking for gettext in libc... $ECHO_C" >&6 +if test "${gt_cv_func_gettext_libc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ return (int) gettext ("") -; return 0; } -EOF -if { (eval echo configure:3860: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then gt_cv_func_gettext_libc=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - gt_cv_func_gettext_libc=no -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -echo "$ac_t""$gt_cv_func_gettext_libc" 1>&6 +gt_cv_func_gettext_libc=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $gt_cv_func_gettext_libc" >&5 +echo "${ECHO_T}$gt_cv_func_gettext_libc" >&6 if test "$gt_cv_func_gettext_libc" != "yes"; then - echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6 -echo "configure:3876: checking for bindtextdomain in -lintl" >&5 -ac_lib_var=`echo intl'_'bindtextdomain | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking for bindtextdomain in -lintl" >&5 +echo $ECHO_N "checking for bindtextdomain in -lintl... $ECHO_C" >&6 +if test "${ac_cv_lib_intl_bindtextdomain+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_LIBS="$LIBS" + ac_check_lib_save_LIBS=$LIBS LIBS="-lintl $LIBS" -cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char bindtextdomain(); - -int main() { -bindtextdomain() -; return 0; } -EOF -if { (eval echo configure:3895: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" + builtin and then its argument prototype would still apply. */ +char bindtextdomain (); +int +main () +{ +bindtextdomain (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_intl_bindtextdomain=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_lib_intl_bindtextdomain=no fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - echo $ac_n "checking for gettext in libintl""... $ac_c" 1>&6 -echo "configure:3911: checking for gettext in libintl" >&5 -if eval "test \"`echo '$''{'gt_cv_func_gettext_libintl'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_intl_bindtextdomain" >&5 +echo "${ECHO_T}$ac_cv_lib_intl_bindtextdomain" >&6 +if test $ac_cv_lib_intl_bindtextdomain = yes; then + echo "$as_me:$LINENO: checking for gettext in libintl" >&5 +echo $ECHO_N "checking for gettext in libintl... $ECHO_C" >&6 +if test "${gt_cv_func_gettext_libintl+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -int main() { +int +main () +{ return (int) gettext ("") -; return 0; } -EOF -if { (eval echo configure:3923: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then gt_cv_func_gettext_libintl=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - gt_cv_func_gettext_libintl=no -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -echo "$ac_t""$gt_cv_func_gettext_libintl" 1>&6 -else - echo "$ac_t""no" 1>&6 +gt_cv_func_gettext_libintl=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $gt_cv_func_gettext_libintl" >&5 +echo "${ECHO_T}$gt_cv_func_gettext_libintl" >&6 fi fi if test "$gt_cv_func_gettext_libc" = "yes" \ || test "$gt_cv_func_gettext_libintl" = "yes"; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_GETTEXT 1 -EOF +_ACEOF # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3951: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_MSGFMT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else case "$MSGFMT" in /*) @@ -3973,108 +7801,161 @@ esac fi MSGFMT="$ac_cv_path_MSGFMT" if test -n "$MSGFMT"; then - echo "$ac_t""$MSGFMT" 1>&6 + echo "$as_me:$LINENO: result: $MSGFMT" >&5 +echo "${ECHO_T}$MSGFMT" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi if test "$MSGFMT" != "no"; then - for ac_func in dcgettext + +for ac_func in dcgettext do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3985: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - + builtin and then its argument prototype would still apply. */ +char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif -; return 0; } -EOF -if { (eval echo configure:4013: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 fi done # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4040: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_GMSGFMT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - case "$GMSGFMT" in - /*) + case $GMSGFMT in + [\\/]* | ?:[\\/]*) ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. ;; - ?:/*) - ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path. - ;; *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_path_GMSGFMT="$ac_dir/$ac_word" - break - fi - done - IFS="$ac_save_ifs" + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" ;; esac fi -GMSGFMT="$ac_cv_path_GMSGFMT" +GMSGFMT=$ac_cv_path_GMSGFMT + if test -n "$GMSGFMT"; then - echo "$ac_t""$GMSGFMT" 1>&6 + echo "$as_me:$LINENO: result: $GMSGFMT" >&5 +echo "${ECHO_T}$GMSGFMT" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4076: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_XGETTEXT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else case "$XGETTEXT" in /*) @@ -4098,44 +7979,75 @@ esac fi XGETTEXT="$ac_cv_path_XGETTEXT" if test -n "$XGETTEXT"; then - echo "$ac_t""$XGETTEXT" 1>&6 + echo "$as_me:$LINENO: result: $XGETTEXT" >&5 +echo "${ECHO_T}$XGETTEXT" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -int main() { +int +main () +{ extern int _nl_msg_cat_cntr; return _nl_msg_cat_cntr -; return 0; } -EOF -if { (eval echo configure:4116: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then CATOBJEXT=.gmo DATADIRNAME=share else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CATOBJEXT=.mo + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +CATOBJEXT=.mo DATADIRNAME=lib fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext INSTOBJEXT=.mo fi fi - -else - echo "$ac_t""no" 1>&6 + fi - - if test "$CATOBJEXT" = "NONE"; then - nls_cv_use_gnu_gettext=yes + + + if test x"$CATOBJEXT" = x && test -d $srcdir/../intl; then + # Neither gettext nor catgets in included in the C library. + # Fall back on GNU gettext library (assuming it is present). + nls_cv_use_gnu_gettext=yes fi fi @@ -4143,10 +8055,10 @@ fi INTLOBJS="\$(GETTOBJS)" # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4148: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_MSGFMT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else case "$MSGFMT" in /*) @@ -4170,53 +8082,59 @@ esac fi MSGFMT="$ac_cv_path_MSGFMT" if test -n "$MSGFMT"; then - echo "$ac_t""$MSGFMT" 1>&6 + echo "$as_me:$LINENO: result: $MSGFMT" >&5 +echo "${ECHO_T}$MSGFMT" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4182: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_GMSGFMT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - case "$GMSGFMT" in - /*) + case $GMSGFMT in + [\\/]* | ?:[\\/]*) ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. ;; - ?:/*) - ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path. - ;; *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_path_GMSGFMT="$ac_dir/$ac_word" - break - fi - done - IFS="$ac_save_ifs" + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" ;; esac fi -GMSGFMT="$ac_cv_path_GMSGFMT" +GMSGFMT=$ac_cv_path_GMSGFMT + if test -n "$GMSGFMT"; then - echo "$ac_t""$GMSGFMT" 1>&6 + echo "$as_me:$LINENO: result: $GMSGFMT" >&5 +echo "${ECHO_T}$GMSGFMT" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4218: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_XGETTEXT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else case "$XGETTEXT" in /*) @@ -4240,12 +8158,14 @@ esac fi XGETTEXT="$ac_cv_path_XGETTEXT" if test -n "$XGETTEXT"; then - echo "$ac_t""$XGETTEXT" 1>&6 + echo "$as_me:$LINENO: result: $XGETTEXT" >&5 +echo "${ECHO_T}$XGETTEXT" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - + USE_INCLUDED_LIBINTL=yes CATOBJEXT=.gmo INSTOBJEXT=.mo @@ -4261,7 +8181,8 @@ fi if $XGETTEXT --omit-header /dev/null 2> /dev/null; then : ; else - echo "$ac_t""found xgettext programs is not GNU xgettext; ignore it" 1>&6 + echo "$as_me:$LINENO: result: found xgettext programs is not GNU xgettext; ignore it" >&5 +echo "${ECHO_T}found xgettext programs is not GNU xgettext; ignore it" >&6 XGETTEXT=":" fi fi @@ -4286,25 +8207,32 @@ fi POFILES="$POFILES $lang.po" done - - - - - - - - - - - - + + + + + + + + + + + + if test "x$CATOBJEXT" != "x"; then + +cat >>confdefs.h <<\_ACEOF +#define ENABLE_NLS 1 +_ACEOF + + fi + if test "x$CATOBJEXT" != "x"; then if test "x$ALL_LINGUAS" = "x"; then LINGUAS= else - echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6 -echo "configure:4308: checking for catalogs to be installed" >&5 + echo "$as_me:$LINENO: checking for catalogs to be installed" >&5 +echo $ECHO_N "checking for catalogs to be installed... $ECHO_C" >&6 NEW_LINGUAS= for lang in ${LINGUAS=$ALL_LINGUAS}; do case "$ALL_LINGUAS" in @@ -4312,7 +8240,8 @@ echo "configure:4308: checking for catalogs to be installed" >&5 esac done LINGUAS=$NEW_LINGUAS - echo "$ac_t""$LINGUAS" 1>&6 + echo "$as_me:$LINENO: result: $LINGUAS" >&5 +echo "${ECHO_T}$LINGUAS" >&6 fi if test -n "$LINGUAS"; then @@ -4326,45 +8255,155 @@ echo "configure:4308: checking for catalogs to be installed" >&5 INCLUDE_LOCALE_H="\ /* The system does not provide the header . Take care yourself. */" fi - + if test -f $srcdir/po2tbl.sed.in; then if test "$CATOBJEXT" = ".cat"; then - ac_safe=`echo "linux/version.h" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for linux/version.h""... $ac_c" 1>&6 -echo "configure:4336: checking for linux/version.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + if test "${ac_cv_header_linux_version_h+set}" = set; then + echo "$as_me:$LINENO: checking for linux/version.h" >&5 +echo $ECHO_N "checking for linux/version.h... $ECHO_C" >&6 +if test "${ac_cv_header_linux_version_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_linux_version_h" >&5 +echo "${ECHO_T}$ac_cv_header_linux_version_h" >&6 else - cat > conftest.$ac_ext <&5 +echo $ECHO_N "checking linux/version.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default #include -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4346: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking linux/version.h presence" >&5 +echo $ECHO_N "checking linux/version.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: linux/version.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: linux/version.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: linux/version.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: linux/version.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: linux/version.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: linux/version.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: linux/version.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: linux/version.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: linux/version.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: linux/version.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: linux/version.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: linux/version.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: linux/version.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: linux/version.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: linux/version.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: linux/version.h: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for linux/version.h" >&5 +echo $ECHO_N "checking for linux/version.h... $ECHO_C" >&6 +if test "${ac_cv_header_linux_version_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_linux_version_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_linux_version_h" >&5 +echo "${ECHO_T}$ac_cv_header_linux_version_h" >&6 + +fi +if test $ac_cv_header_linux_version_h = yes; then msgformat=linux else - echo "$ac_t""no" 1>&6 -msgformat=xopen + msgformat=xopen fi + sed -e '/^#/d' $srcdir/$msgformat-msg.sed > po2msg.sed fi sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \ @@ -4378,14 +8417,14 @@ fi GT_NO= GT_YES="#YES#" fi - - + + MKINSTALLDIRS="\$(srcdir)/../../mkinstalldirs" - + l= - + if test -f $srcdir/po/POTFILES.in; then test -d po || mkdir po @@ -4402,20 +8441,20 @@ fi sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \ < $srcdir/po/POTFILES.in > po/POTFILES fi - -echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 -echo "configure:4409: checking whether to enable maintainer-specific portions of Makefiles" >&5 + +echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval="$enable_maintainer_mode" USE_MAINTAINER_MODE=$enableval else USE_MAINTAINER_MODE=no -fi +fi; + echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5 +echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6 - echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6 - if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= @@ -4424,51 +8463,22 @@ else MAINTAINER_MODE_TRUE='#' MAINTAINER_MODE_FALSE= fi + MAINT=$MAINTAINER_MODE_TRUE - -echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:4434: checking for executable suffix" >&5 -if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$CYGWIN" = yes || test "$MINGW32" = yes; then - ac_cv_exeext=.exe -else - rm -f conftest* - echo 'int main () { return 0; }' > conftest.$ac_ext - ac_cv_exeext= - if { (eval echo configure:4444: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then - for file in conftest.*; do - case $file in - *.c | *.o | *.obj | *.ilk | *.pdb) ;; - *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; - esac - done - else - { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; } - fi - rm -f conftest* - test x"${ac_cv_exeext}" = x && ac_cv_exeext=no -fi -fi - -EXEEXT="" -test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext} -echo "$ac_t""${ac_cv_exeext}" 1>&6 -ac_exeext=$EXEEXT - if test -n "$EXEEXT"; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_EXECUTABLE_SUFFIX 1 -EOF +_ACEOF fi -cat >> confdefs.h <>confdefs.h <<_ACEOF #define EXECUTABLE_SUFFIX "${EXEEXT}" -EOF +_ACEOF # host-specific stuff: @@ -4480,34 +8490,84 @@ HDEFINES= AR=${AR-ar} -# Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4487: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_RANLIB="ranlib" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + fi fi -RANLIB="$ac_cv_prog_RANLIB" +RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then - echo "$ac_t""$RANLIB" 1>&6 + echo "$as_me:$LINENO: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 +echo "${ECHO_T}$ac_ct_RANLIB" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + RANLIB=$ac_ct_RANLIB +else + RANLIB="$ac_cv_prog_RANLIB" fi # Find a good install program. We prefer a C program (faster), @@ -4517,60 +8577,75 @@ fi # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs # 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" +# OS/2's system install, which has a completely different semantic # ./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:4526: checking for a BSD compatible install" >&5 +echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then -if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" - for ac_dir in $PATH; do - # Account for people who put trailing slashes in PATH elements. - case "$ac_dir/" in - /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - if test -f $ac_dir/$ac_prog; then + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ + /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 + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && - grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : else - ac_cv_path_install="$ac_dir/$ac_prog -c" - break 2 + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 fi fi done - ;; - esac - done - IFS="$ac_save_IFS" + done + ;; +esac +done + fi if test "${ac_cv_path_install+set}" = set; then - INSTALL="$ac_cv_path_install" + 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" + INSTALL=$ac_install_sh fi fi -echo "$ac_t""$INSTALL" 1>&6 +echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' @@ -4588,10 +8663,10 @@ fi if test "x$cross_compiling" = "xno"; then EXEEXT_FOR_BUILD='$(EXEEXT)' else - echo $ac_n "checking for build system executable suffix""... $ac_c" 1>&6 -echo "configure:4593: checking for build system executable suffix" >&5 -if eval "test \"`echo '$''{'bfd_cv_build_exeext'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking for build system executable suffix" >&5 +echo $ECHO_N "checking for build system executable suffix... $ECHO_C" >&6 +if test "${bfd_cv_build_exeext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else rm -f conftest* echo 'int main () { return 0; }' > conftest.c @@ -4606,8 +8681,8 @@ else rm -f conftest* test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no fi - -echo "$ac_t""$bfd_cv_build_exeext" 1>&6 +echo "$as_me:$LINENO: result: $bfd_cv_build_exeext" >&5 +echo "${ECHO_T}$bfd_cv_build_exeext" >&6 EXEEXT_FOR_BUILD="" test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext} fi @@ -4620,132 +8695,307 @@ case "${host}" in esac -for ac_hdr in string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h + + + + + + +for ac_header in string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4628: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4638: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else - echo "$ac_t""no" 1>&6 + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + done -echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 -echo "configure:4665: checking for sys/wait.h that is POSIX.1 compatible" >&5 -if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for sys/wait.h that is POSIX.1 compatible" >&5 +echo $ECHO_N "checking for sys/wait.h that is POSIX.1 compatible... $ECHO_C" >&6 +if test "${ac_cv_header_sys_wait_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #include #ifndef WEXITSTATUS -#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) +# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) #endif #ifndef WIFEXITED -#define WIFEXITED(stat_val) (((stat_val) & 255) == 0) +# define WIFEXITED(stat_val) (((stat_val) & 255) == 0) #endif -int main() { -int s; -wait (&s); -s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; -; return 0; } -EOF -if { (eval echo configure:4686: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + +int +main () +{ + int s; + wait (&s); + s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_header_sys_wait_h=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_header_sys_wait_h=no -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -echo "$ac_t""$ac_cv_header_sys_wait_h" 1>&6 +ac_cv_header_sys_wait_h=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6 if test $ac_cv_header_sys_wait_h = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_SYS_WAIT_H 1 -EOF +_ACEOF fi # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! -echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:4709: checking for working alloca.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for working alloca.h" >&5 +echo $ECHO_N "checking for working alloca.h... $ECHO_C" >&6 +if test "${ac_cv_working_alloca_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include -int main() { -char *p = alloca(2 * sizeof(int)); -; return 0; } -EOF -if { (eval echo configure:4721: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - ac_cv_header_alloca_h=yes +int +main () +{ +char *p = (char *) alloca (2 * sizeof (int)); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_working_alloca_h=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_header_alloca_h=no -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -echo "$ac_t""$ac_cv_header_alloca_h" 1>&6 -if test $ac_cv_header_alloca_h = yes; then - cat >> confdefs.h <<\EOF +ac_cv_working_alloca_h=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_working_alloca_h" >&5 +echo "${ECHO_T}$ac_cv_working_alloca_h" >&6 +if test $ac_cv_working_alloca_h = yes; then + +cat >>confdefs.h <<\_ACEOF #define HAVE_ALLOCA_H 1 -EOF +_ACEOF fi -echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:4742: checking for alloca" >&5 -if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for alloca" >&5 +echo $ECHO_N "checking for alloca... $ECHO_C" >&6 +if test "${ac_cv_func_alloca_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #ifdef __GNUC__ # define alloca __builtin_alloca #else @@ -4767,137 +9017,217 @@ char *alloca (); # endif #endif -int main() { -char *p = (char *) alloca(1); -; return 0; } -EOF -if { (eval echo configure:4775: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* +int +main () +{ +char *p = (char *) alloca (1); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_func_alloca_works=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_func_alloca_works=no -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_alloca_works=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_alloca_works" >&5 +echo "${ECHO_T}$ac_cv_func_alloca_works" >&6 -echo "$ac_t""$ac_cv_func_alloca_works" 1>&6 if test $ac_cv_func_alloca_works = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_ALLOCA 1 -EOF +_ACEOF -fi - -if test $ac_cv_func_alloca_works = no; then - # The SVR3 libPW and SVR4 libucb both contain incompatible functions - # that cause trouble. Some versions do not even contain alloca or - # contain a buggy version. If you still want to use their alloca, - # use ar to extract alloca.o from them instead of compiling alloca.c. - ALLOCA=alloca.${ac_objext} - cat >> confdefs.h <<\EOF -#define C_ALLOCA 1 -EOF - - -echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:4807: checking whether alloca needs Cray hooks" >&5 -if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 else - cat > conftest.$ac_ext <>confdefs.h <<\_ACEOF +#define C_ALLOCA 1 +_ACEOF + + +echo "$as_me:$LINENO: checking whether \`alloca.c' needs Cray hooks" >&5 +echo $ECHO_N "checking whether \`alloca.c' needs Cray hooks... $ECHO_C" >&6 +if test "${ac_cv_os_cray+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #if defined(CRAY) && ! defined(CRAY2) webecray #else wenotbecray #endif -EOF +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "webecray" >/dev/null 2>&1; then - rm -rf conftest* + $EGREP "webecray" >/dev/null 2>&1; then ac_cv_os_cray=yes else - rm -rf conftest* ac_cv_os_cray=no fi rm -f conftest* fi - -echo "$ac_t""$ac_cv_os_cray" 1>&6 +echo "$as_me:$LINENO: result: $ac_cv_os_cray" >&5 +echo "${ECHO_T}$ac_cv_os_cray" >&6 if test $ac_cv_os_cray = yes; then -for ac_func in _getb67 GETB67 getb67; do - echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4837: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + for ac_func in _getb67 GETB67 getb67; do + as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - + builtin and then its argument prototype would still apply. */ +char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif -; return 0; } -EOF -if { (eval echo configure:4865: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - cat >> confdefs.h <&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + +cat >>confdefs.h <<_ACEOF #define CRAY_STACKSEG_END $ac_func -EOF +_ACEOF - break -else - echo "$ac_t""no" 1>&6 + break fi -done + done fi -echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:4892: checking stack direction for C alloca" >&5 -if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking stack direction for C alloca" >&5 +echo $ECHO_N "checking stack direction for C alloca... $ECHO_C" >&6 +if test "${ac_cv_c_stack_direction+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_c_stack_direction=0 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +int find_stack_direction () { static char *addr = 0; @@ -4910,560 +9240,1407 @@ find_stack_direction () else return (&dummy > addr) ? 1 : -1; } + +int main () { - exit (find_stack_direction() < 0); + exit (find_stack_direction () < 0); } -EOF -if { (eval echo configure:4919: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_c_stack_direction=1 else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_c_stack_direction=-1 -fi -rm -fr conftest* -fi + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +( exit $ac_status ) +ac_cv_c_stack_direction=-1 fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_c_stack_direction" >&5 +echo "${ECHO_T}$ac_cv_c_stack_direction" >&6 -echo "$ac_t""$ac_cv_c_stack_direction" 1>&6 -cat >> confdefs.h <>confdefs.h <<_ACEOF #define STACK_DIRECTION $ac_cv_c_stack_direction -EOF +_ACEOF + fi + + + + + for ac_func in sbrk utimes setmode getc_unlocked strcoll do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4943: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - + builtin and then its argument prototype would still apply. */ +char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif -; return 0; } -EOF -if { (eval echo configure:4971: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 fi done # Check whether fopen64 is available and whether _LARGEFILE64_SOURCE # needs to be defined for it -echo $ac_n "checking for fopen64""... $ac_c" 1>&6 -echo "configure:4999: checking for fopen64" >&5 -if eval "test \"`echo '$''{'bu_cv_have_fopen64'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for fopen64" >&5 +echo $ECHO_N "checking for fopen64... $ECHO_C" >&6 +if test "${bu_cv_have_fopen64+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include -int main() { +int +main () +{ FILE *f = fopen64 ("/tmp/foo","r"); -; return 0; } -EOF -if { (eval echo configure:5011: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then bu_cv_have_fopen64=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - saved_CPPFLAGS=$CPPFLAGS + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +saved_CPPFLAGS=$CPPFLAGS CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE" - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include -int main() { +int +main () +{ FILE *f = fopen64 ("/tmp/foo","r"); -; return 0; } -EOF -if { (eval echo configure:5028: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then bu_cv_have_fopen64="need -D_LARGEFILE64_SOURCE" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - bu_cv_have_fopen64=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +bu_cv_have_fopen64=no fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext CPPFLAGS=$saved_CPPFLAGS fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi -echo "$ac_t""$bu_cv_have_fopen64" 1>&6 +echo "$as_me:$LINENO: result: $bu_cv_have_fopen64" >&5 +echo "${ECHO_T}$bu_cv_have_fopen64" >&6 if test "$bu_cv_have_fopen64" != no; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_FOPEN64 1 -EOF +_ACEOF - if test "$bu_cv_have_fopen64" = "need -D_LARGEFILE64_SOURCE"; then - cat >> confdefs.h <<\EOF +fi +echo "$as_me:$LINENO: checking for stat64" >&5 +echo $ECHO_N "checking for stat64... $ECHO_C" >&6 +if test "${bu_cv_have_stat64+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +struct stat64 st; stat64 ("/tmp/foo", &st); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + bu_cv_have_stat64=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +saved_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +struct stat64 st; stat64 ("/tmp/foo", &st); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + bu_cv_have_stat64="need -D_LARGEFILE64_SOURCE" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +bu_cv_have_stat64=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + CPPFLAGS=$saved_CPPFLAGS +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + +echo "$as_me:$LINENO: result: $bu_cv_have_stat64" >&5 +echo "${ECHO_T}$bu_cv_have_stat64" >&6 +if test "$bu_cv_have_stat64" != no; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_STAT64 1 +_ACEOF + +fi +if test "$bu_cv_have_fopen64" = "need -D_LARGEFILE64_SOURCE" \ + || test "$bu_cv_have_stat64" = "need -D_LARGEFILE64_SOURCE"; then + +cat >>confdefs.h <<\_ACEOF #define _LARGEFILE64_SOURCE 1 -EOF +_ACEOF - fi + CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE" fi # Some systems have frexp only in -lm, not in -lc. - -echo $ac_n "checking for library containing frexp""... $ac_c" 1>&6 -echo "configure:5060: checking for library containing frexp" >&5 -if eval "test \"`echo '$''{'ac_cv_search_frexp'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for library containing frexp" >&5 +echo $ECHO_N "checking for library containing frexp... $ECHO_C" >&6 +if test "${ac_cv_search_frexp+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_func_search_save_LIBS="$LIBS" -ac_cv_search_frexp="no" -cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -int main() { -frexp() -; return 0; } -EOF -if { (eval echo configure:5078: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char frexp (); +int +main () +{ +frexp (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_search_frexp="none required" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 -fi -rm -f conftest* -test "$ac_cv_search_frexp" = "no" && for i in m; do -LIBS="-l$i $ac_func_search_save_LIBS" -cat > conftest.$ac_ext <&5 +sed 's/^/| /' conftest.$ac_ext >&5 -int main() { -frexp() -; return 0; } -EOF -if { (eval echo configure:5100: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - ac_cv_search_frexp="-l$i" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test "$ac_cv_search_frexp" = no; then + for ac_lib in m; do + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char frexp (); +int +main () +{ +frexp (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_frexp="-l$ac_lib" break else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 -fi -rm -f conftest* -done -LIBS="$ac_func_search_save_LIBS" -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -echo "$ac_t""$ac_cv_search_frexp" 1>&6 -if test "$ac_cv_search_frexp" != "no"; then +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + done +fi +LIBS=$ac_func_search_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_search_frexp" >&5 +echo "${ECHO_T}$ac_cv_search_frexp" >&6 +if test "$ac_cv_search_frexp" != no; then test "$ac_cv_search_frexp" = "none required" || LIBS="$ac_cv_search_frexp $LIBS" - -else : - + fi -echo $ac_n "checking for time_t in time.h""... $ac_c" 1>&6 -echo "configure:5122: checking for time_t in time.h" >&5 -if eval "test \"`echo '$''{'bu_cv_decl_time_t_time_h'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + +echo "$as_me:$LINENO: checking for time_t in time.h" >&5 +echo $ECHO_N "checking for time_t in time.h... $ECHO_C" >&6 +if test "${bu_cv_decl_time_t_time_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include -int main() { +int +main () +{ time_t i; -; return 0; } -EOF -if { (eval echo configure:5134: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then bu_cv_decl_time_t_time_h=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - bu_cv_decl_time_t_time_h=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +bu_cv_decl_time_t_time_h=no fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$ac_t""$bu_cv_decl_time_t_time_h" 1>&6 +echo "$as_me:$LINENO: result: $bu_cv_decl_time_t_time_h" >&5 +echo "${ECHO_T}$bu_cv_decl_time_t_time_h" >&6 if test $bu_cv_decl_time_t_time_h = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_TIME_T_IN_TIME_H 1 -EOF +_ACEOF fi -echo $ac_n "checking for time_t in sys/types.h""... $ac_c" 1>&6 -echo "configure:5155: checking for time_t in sys/types.h" >&5 -if eval "test \"`echo '$''{'bu_cv_decl_time_t_types_h'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for time_t in sys/types.h" >&5 +echo $ECHO_N "checking for time_t in sys/types.h... $ECHO_C" >&6 +if test "${bu_cv_decl_time_t_types_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include -int main() { +int +main () +{ time_t i; -; return 0; } -EOF -if { (eval echo configure:5167: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then bu_cv_decl_time_t_types_h=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - bu_cv_decl_time_t_types_h=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +bu_cv_decl_time_t_types_h=no fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$ac_t""$bu_cv_decl_time_t_types_h" 1>&6 +echo "$as_me:$LINENO: result: $bu_cv_decl_time_t_types_h" >&5 +echo "${ECHO_T}$bu_cv_decl_time_t_types_h" >&6 if test $bu_cv_decl_time_t_types_h = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_TIME_T_IN_TYPES_H 1 -EOF +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for a known getopt prototype in unistd.h" >&5 +echo $ECHO_N "checking for a known getopt prototype in unistd.h... $ECHO_C" >&6 +if test "${bu_cv_decl_getopt_unistd_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +extern int getopt (int, char *const*, const char *); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + bu_cv_decl_getopt_unistd_h=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +bu_cv_decl_getopt_unistd_h=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +echo "$as_me:$LINENO: result: $bu_cv_decl_getopt_unistd_h" >&5 +echo "${ECHO_T}$bu_cv_decl_getopt_unistd_h" >&6 +if test $bu_cv_decl_getopt_unistd_h = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_DECL_GETOPT 1 +_ACEOF fi # Under Next 3.2 apparently does not define struct utimbuf # by default. -echo $ac_n "checking for utime.h""... $ac_c" 1>&6 -echo "configure:5190: checking for utime.h" >&5 -if eval "test \"`echo '$''{'bu_cv_header_utime_h'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for utime.h" >&5 +echo $ECHO_N "checking for utime.h... $ECHO_C" >&6 +if test "${bu_cv_header_utime_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #ifdef HAVE_TIME_H #include #endif #include -int main() { +int +main () +{ struct utimbuf s; -; return 0; } -EOF -if { (eval echo configure:5206: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then bu_cv_header_utime_h=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - bu_cv_header_utime_h=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +bu_cv_header_utime_h=no fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$ac_t""$bu_cv_header_utime_h" 1>&6 +echo "$as_me:$LINENO: result: $bu_cv_header_utime_h" >&5 +echo "${ECHO_T}$bu_cv_header_utime_h" >&6 if test $bu_cv_header_utime_h = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_GOOD_UTIME_H 1 -EOF +_ACEOF fi -echo $ac_n "checking whether fprintf must be declared""... $ac_c" 1>&6 -echo "configure:5227: checking whether fprintf must be declared" >&5 -if eval "test \"`echo '$''{'bfd_cv_decl_needed_fprintf'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking whether fprintf is declared" >&5 +echo $ECHO_N "checking whether fprintf is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_fprintf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef fprintf + char *p = (char *) fprintf; +#endif -#include -#ifdef HAVE_STRING_H -#include -#else -#ifdef HAVE_STRINGS_H -#include -#endif -#endif -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif -int main() { -char *(*pfn) = (char *(*)) fprintf -; return 0; } -EOF -if { (eval echo configure:5253: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - bfd_cv_decl_needed_fprintf=no + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_fprintf=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - bfd_cv_decl_needed_fprintf=yes -fi -rm -f conftest* -fi - -echo "$ac_t""$bfd_cv_decl_needed_fprintf" 1>&6 -if test $bfd_cv_decl_needed_fprintf = yes; then - cat >> confdefs.h <<\EOF -#define NEED_DECLARATION_FPRINTF 1 -EOF + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_have_decl_fprintf=no fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_fprintf" >&5 +echo "${ECHO_T}$ac_cv_have_decl_fprintf" >&6 +if test $ac_cv_have_decl_fprintf = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FPRINTF 1 +_ACEOF + -echo $ac_n "checking whether strstr must be declared""... $ac_c" 1>&6 -echo "configure:5274: checking whether strstr must be declared" >&5 -if eval "test \"`echo '$''{'bfd_cv_decl_needed_strstr'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 else - cat > conftest.$ac_ext <>confdefs.h <<_ACEOF +#define HAVE_DECL_FPRINTF 0 +_ACEOF -#include -#ifdef HAVE_STRING_H -#include -#else -#ifdef HAVE_STRINGS_H -#include -#endif -#endif -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif -int main() { -char *(*pfn) = (char *(*)) strstr -; return 0; } -EOF -if { (eval echo configure:5300: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - bfd_cv_decl_needed_strstr=no + +fi +echo "$as_me:$LINENO: checking whether stpcpy is declared" >&5 +echo $ECHO_N "checking whether stpcpy is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_stpcpy+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - bfd_cv_decl_needed_strstr=yes -fi -rm -f conftest* -fi + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef stpcpy + char *p = (char *) stpcpy; +#endif -echo "$ac_t""$bfd_cv_decl_needed_strstr" 1>&6 -if test $bfd_cv_decl_needed_strstr = yes; then - cat >> confdefs.h <<\EOF -#define NEED_DECLARATION_STRSTR 1 -EOF - -fi - -echo $ac_n "checking whether sbrk must be declared""... $ac_c" 1>&6 -echo "configure:5321: checking whether sbrk must be declared" >&5 -if eval "test \"`echo '$''{'bfd_cv_decl_needed_sbrk'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_stpcpy=yes else - cat > conftest.$ac_ext <&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_stpcpy=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_stpcpy" >&5 +echo "${ECHO_T}$ac_cv_have_decl_stpcpy" >&6 +if test $ac_cv_have_decl_stpcpy = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STPCPY 1 +_ACEOF + -#include -#ifdef HAVE_STRING_H -#include -#else -#ifdef HAVE_STRINGS_H -#include -#endif -#endif -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif -int main() { -char *(*pfn) = (char *(*)) sbrk -; return 0; } -EOF -if { (eval echo configure:5347: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - bfd_cv_decl_needed_sbrk=no else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - bfd_cv_decl_needed_sbrk=yes -fi -rm -f conftest* -fi + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STPCPY 0 +_ACEOF -echo "$ac_t""$bfd_cv_decl_needed_sbrk" 1>&6 -if test $bfd_cv_decl_needed_sbrk = yes; then - cat >> confdefs.h <<\EOF -#define NEED_DECLARATION_SBRK 1 -EOF fi - -echo $ac_n "checking whether getenv must be declared""... $ac_c" 1>&6 -echo "configure:5368: checking whether getenv must be declared" >&5 -if eval "test \"`echo '$''{'bfd_cv_decl_needed_getenv'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking whether strstr is declared" >&5 +echo $ECHO_N "checking whether strstr is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_strstr+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef strstr + char *p = (char *) strstr; +#endif -#include -#ifdef HAVE_STRING_H -#include -#else -#ifdef HAVE_STRINGS_H -#include -#endif -#endif -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif -int main() { -char *(*pfn) = (char *(*)) getenv -; return 0; } -EOF -if { (eval echo configure:5394: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - bfd_cv_decl_needed_getenv=no + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_strstr=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - bfd_cv_decl_needed_getenv=yes -fi -rm -f conftest* -fi - -echo "$ac_t""$bfd_cv_decl_needed_getenv" 1>&6 -if test $bfd_cv_decl_needed_getenv = yes; then - cat >> confdefs.h <<\EOF -#define NEED_DECLARATION_GETENV 1 -EOF + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_have_decl_strstr=no fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_strstr" >&5 +echo "${ECHO_T}$ac_cv_have_decl_strstr" >&6 +if test $ac_cv_have_decl_strstr = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STRSTR 1 +_ACEOF + -echo $ac_n "checking whether environ must be declared""... $ac_c" 1>&6 -echo "configure:5415: checking whether environ must be declared" >&5 -if eval "test \"`echo '$''{'bfd_cv_decl_needed_environ'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 else - cat > conftest.$ac_ext <>confdefs.h <<_ACEOF +#define HAVE_DECL_STRSTR 0 +_ACEOF -#include -#ifdef HAVE_STRING_H -#include -#else -#ifdef HAVE_STRINGS_H -#include -#endif -#endif -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif -int main() { -char *(*pfn) = (char *(*)) environ -; return 0; } -EOF -if { (eval echo configure:5441: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - bfd_cv_decl_needed_environ=no + +fi +echo "$as_me:$LINENO: checking whether sbrk is declared" >&5 +echo $ECHO_N "checking whether sbrk is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_sbrk+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - bfd_cv_decl_needed_environ=yes -fi -rm -f conftest* -fi + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef sbrk + char *p = (char *) sbrk; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_sbrk=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_sbrk=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_sbrk" >&5 +echo "${ECHO_T}$ac_cv_have_decl_sbrk" >&6 +if test $ac_cv_have_decl_sbrk = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SBRK 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SBRK 0 +_ACEOF -echo "$ac_t""$bfd_cv_decl_needed_environ" 1>&6 -if test $bfd_cv_decl_needed_environ = yes; then - cat >> confdefs.h <<\EOF -#define NEED_DECLARATION_ENVIRON 1 -EOF fi +echo "$as_me:$LINENO: checking whether getenv is declared" >&5 +echo $ECHO_N "checking whether getenv is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_getenv+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef getenv + char *p = (char *) getenv; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_getenv=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_getenv=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_getenv" >&5 +echo "${ECHO_T}$ac_cv_have_decl_getenv" >&6 +if test $ac_cv_have_decl_getenv = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_GETENV 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_GETENV 0 +_ACEOF + + +fi +echo "$as_me:$LINENO: checking whether environ is declared" >&5 +echo $ECHO_N "checking whether environ is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_environ+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef environ + char *p = (char *) environ; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_environ=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_environ=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_environ" >&5 +echo "${ECHO_T}$ac_cv_have_decl_environ" >&6 +if test $ac_cv_have_decl_environ = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_ENVIRON 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_ENVIRON 0 +_ACEOF + + +fi +echo "$as_me:$LINENO: checking whether getc_unlocked is declared" >&5 +echo $ECHO_N "checking whether getc_unlocked is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_getc_unlocked+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef getc_unlocked + char *p = (char *) getc_unlocked; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_getc_unlocked=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_getc_unlocked=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_getc_unlocked" >&5 +echo "${ECHO_T}$ac_cv_have_decl_getc_unlocked" >&6 +if test $ac_cv_have_decl_getc_unlocked = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_GETC_UNLOCKED 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_GETC_UNLOCKED 0 +_ACEOF + + +fi +echo "$as_me:$LINENO: checking whether snprintf is declared" >&5 +echo $ECHO_N "checking whether snprintf is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_snprintf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef snprintf + char *p = (char *) snprintf; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_snprintf=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_snprintf=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_snprintf" >&5 +echo "${ECHO_T}$ac_cv_have_decl_snprintf" >&6 +if test $ac_cv_have_decl_snprintf = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SNPRINTF 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SNPRINTF 0 +_ACEOF + + +fi +echo "$as_me:$LINENO: checking whether vsnprintf is declared" >&5 +echo $ECHO_N "checking whether vsnprintf is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_vsnprintf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef vsnprintf + char *p = (char *) vsnprintf; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_vsnprintf=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_vsnprintf=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_vsnprintf" >&5 +echo "${ECHO_T}$ac_cv_have_decl_vsnprintf" >&6 +if test $ac_cv_have_decl_vsnprintf = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_VSNPRINTF 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_VSNPRINTF 0 +_ACEOF + + +fi + case "${host}" in *-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*) - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define USE_BINARY_FOPEN 1 -EOF +_ACEOF ;; esac @@ -5503,7 +10680,7 @@ do NLMCONV_DEFS="-DNLMCONV_I386 -DNLMCONV_ALPHA -DNLMCONV_POWERPC -DNLMCONV_SPARC" else case $targ in - i[3-7]86*-*-netware*) + i[3-7]86*-*-netware*) BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)' NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_I386" ;; @@ -5539,9 +10716,6 @@ do DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM" BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' ;; - arm*-* | xscale-* | strongarm-* | d10v-*) - OBJDUMP_DEFS="-DDISASSEMBLER_NEEDS_RELOCS" - ;; i[3-7]86-*-pe* | i[3-7]86-*-cygwin* | i[3-7]86-*-mingw32** | i[3-7]86-*-netbsdpe*) BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386" @@ -5581,12 +10755,6 @@ do BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE_ELF" ;; - c4x-*-* | tic4x-*-*) - OBJDUMP_DEFS="$OBJDUMP_DEFS -DSKIP_ZEROES=32" - ;; - ia64-*-*) - OBJDUMP_DEFS="$OBJDUMP_DEFS -DSKIP_ZEROES=16" - ;; esac fi done @@ -5605,9 +10773,10 @@ fi -cat >> confdefs.h <>confdefs.h <<_ACEOF #define TARGET "${target}" -EOF +_ACEOF targ=$target @@ -5617,12 +10786,13 @@ if test "x$targ_underscore" = "xyes"; then else UNDERSCORE=0 fi -cat >> confdefs.h <>confdefs.h <<_ACEOF #define TARGET_PREPENDS_UNDERSCORE $UNDERSCORE -EOF +_ACEOF -# Emulation +# Emulation for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'` do # Canonicalize the secondary target names. @@ -5636,446 +10806,1490 @@ do . ${srcdir}/configure.tgt EMULATION=$targ_emul - EMULATION_VECTOR=$targ_emul_vector + EMULATION_VECTOR=$targ_emul_vector done -trap '' 1 2 15 -cat > confcache <<\EOF +# Required for html and install-html + + + + + ac_config_files="$ac_config_files Makefile doc/Makefile po/Makefile.in:po/Make-in" + ac_config_commands="$ac_config_commands default" +cat >confcache <<\_ACEOF # 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. +# scripts and configure runs, see configure's option --config-cache. +# 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. +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. # -EOF +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. -(set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote substitution - # turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - -e "s/'/'\\\\''/g" \ - -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' - ;; - esac >> confcache -if cmp -s $cache_file confcache; then - : -else +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then - echo "updating cache $cache_file" - cat confcache > $cache_file + test "x$cache_file" != "x/dev/null" && 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. +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' fi -trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 - DEFS=-DHAVE_CONFIG_H -# Without the "./", some shells look in PATH for config.status. -: ${CONFIG_STATUS=./config.status} - -echo creating $CONFIG_STATUS -rm -f $CONFIG_STATUS -cat > $CONFIG_STATUS </dev/null | sed 1q`: -# -# $0 $ac_configure_args -# -# Compiler output produced by configure, useful for debugging -# configure, is in ./config.log if it exists. - -ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" -for ac_option -do - case "\$ac_option" in - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" - exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; - -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.13" - exit 0 ;; - -help | --help | --hel | --he | --h) - echo "\$ac_cs_usage"; exit 0 ;; - *) echo "\$ac_cs_usage"; exit 1 ;; - esac +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_i=`echo "$ac_i" | + sed 's/\$U\././;s/\.o$//;s/\.obj$//'` + # 2. Add them. + ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' done +LIBOBJS=$ac_libobjs -ac_given_srcdir=$srcdir -ac_given_INSTALL="$INSTALL" +LTLIBOBJS=$ac_ltlibobjs -trap 'rm -fr `echo "Makefile doc/Makefile po/Makefile.in:po/Make-in config.h:config.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 -EOF -cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF -$ac_vpsub -$extrasub -s%@SHELL@%$SHELL%g -s%@CFLAGS@%$CFLAGS%g -s%@CPPFLAGS@%$CPPFLAGS%g -s%@CXXFLAGS@%$CXXFLAGS%g -s%@FFLAGS@%$FFLAGS%g -s%@DEFS@%$DEFS%g -s%@LDFLAGS@%$LDFLAGS%g -s%@LIBS@%$LIBS%g -s%@exec_prefix@%$exec_prefix%g -s%@prefix@%$prefix%g -s%@program_transform_name@%$program_transform_name%g -s%@bindir@%$bindir%g -s%@sbindir@%$sbindir%g -s%@libexecdir@%$libexecdir%g -s%@datadir@%$datadir%g -s%@sysconfdir@%$sysconfdir%g -s%@sharedstatedir@%$sharedstatedir%g -s%@localstatedir@%$localstatedir%g -s%@libdir@%$libdir%g -s%@includedir@%$includedir%g -s%@oldincludedir@%$oldincludedir%g -s%@infodir@%$infodir%g -s%@mandir@%$mandir%g -s%@host@%$host%g -s%@host_alias@%$host_alias%g -s%@host_cpu@%$host_cpu%g -s%@host_vendor@%$host_vendor%g -s%@host_os@%$host_os%g -s%@target@%$target%g -s%@target_alias@%$target_alias%g -s%@target_cpu@%$target_cpu%g -s%@target_vendor@%$target_vendor%g -s%@target_os@%$target_os%g -s%@build@%$build%g -s%@build_alias@%$build_alias%g -s%@build_cpu@%$build_cpu%g -s%@build_vendor@%$build_vendor%g -s%@build_os@%$build_os%g -s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g -s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g -s%@INSTALL_DATA@%$INSTALL_DATA%g -s%@PACKAGE@%$PACKAGE%g -s%@VERSION@%$VERSION%g -s%@ACLOCAL@%$ACLOCAL%g -s%@AUTOCONF@%$AUTOCONF%g -s%@AUTOMAKE@%$AUTOMAKE%g -s%@AUTOHEADER@%$AUTOHEADER%g -s%@MAKEINFO@%$MAKEINFO%g -s%@SET_MAKE@%$SET_MAKE%g -s%@CC@%$CC%g -s%@LN_S@%$LN_S%g -s%@OBJEXT@%$OBJEXT%g -s%@EXEEXT@%$EXEEXT%g -s%@RANLIB@%$RANLIB%g -s%@STRIP@%$STRIP%g -s%@LIBTOOL@%$LIBTOOL%g -s%@WARN_CFLAGS@%$WARN_CFLAGS%g -s%@YACC@%$YACC%g -s%@LEX@%$LEX%g -s%@LEXLIB@%$LEXLIB%g -s%@CPP@%$CPP%g -s%@LEX_OUTPUT_ROOT@%$LEX_OUTPUT_ROOT%g -s%@ALLOCA@%$ALLOCA%g -s%@USE_NLS@%$USE_NLS%g -s%@MSGFMT@%$MSGFMT%g -s%@GMSGFMT@%$GMSGFMT%g -s%@XGETTEXT@%$XGETTEXT%g -s%@USE_INCLUDED_LIBINTL@%$USE_INCLUDED_LIBINTL%g -s%@CATALOGS@%$CATALOGS%g -s%@CATOBJEXT@%$CATOBJEXT%g -s%@DATADIRNAME@%$DATADIRNAME%g -s%@GMOFILES@%$GMOFILES%g -s%@INSTOBJEXT@%$INSTOBJEXT%g -s%@INTLDEPS@%$INTLDEPS%g -s%@INTLLIBS@%$INTLLIBS%g -s%@INTLOBJS@%$INTLOBJS%g -s%@POFILES@%$POFILES%g -s%@POSUB@%$POSUB%g -s%@INCLUDE_LOCALE_H@%$INCLUDE_LOCALE_H%g -s%@GT_NO@%$GT_NO%g -s%@GT_YES@%$GT_YES%g -s%@MKINSTALLDIRS@%$MKINSTALLDIRS%g -s%@l@%$l%g -s%@MAINTAINER_MODE_TRUE@%$MAINTAINER_MODE_TRUE%g -s%@MAINTAINER_MODE_FALSE@%$MAINTAINER_MODE_FALSE%g -s%@MAINT@%$MAINT%g -s%@HDEFINES@%$HDEFINES%g -s%@AR@%$AR%g -s%@CC_FOR_BUILD@%$CC_FOR_BUILD%g -s%@EXEEXT_FOR_BUILD@%$EXEEXT_FOR_BUILD%g -s%@DEMANGLER_NAME@%$DEMANGLER_NAME%g -s%@NLMCONV_DEFS@%$NLMCONV_DEFS%g -s%@BUILD_NLMCONV@%$BUILD_NLMCONV%g -s%@BUILD_SRCONV@%$BUILD_SRCONV%g -s%@BUILD_DLLTOOL@%$BUILD_DLLTOOL%g -s%@DLLTOOL_DEFS@%$DLLTOOL_DEFS%g -s%@BUILD_WINDRES@%$BUILD_WINDRES%g -s%@BUILD_DLLWRAP@%$BUILD_DLLWRAP%g -s%@BUILD_MISC@%$BUILD_MISC%g -s%@OBJDUMP_DEFS@%$OBJDUMP_DEFS%g -s%@EMULATION@%$EMULATION%g -s%@EMULATION_VECTOR@%$EMULATION_VECTOR%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 +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"MAINTAINER_MODE\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } fi -EOF -cat >> $CONFIG_STATUS <&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. -CONFIG_FILES=\${CONFIG_FILES-"Makefile doc/Makefile po/Makefile.in:po/Make-in"} -EOF -cat >> $CONFIG_STATUS <<\EOF -for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` - ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - *) ac_file_in="${ac_file}.in" ;; +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi +DUALCASE=1; export DUALCASE # for MKS sh + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 +echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; esac - # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 +echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} + { (exit 1); exit 1; }; } - # 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'` + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' else - ac_dir_suffix= ac_dots= + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + +exec 6>&1 + +# Open the log real soon, to keep \$[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. Logging --version etc. is OK. +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX +} >&5 +cat >&5 <<_CSEOF + +This file was extended by $as_me, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +_CSEOF +echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 +echo >&5 +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\_ACEOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to ." +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +config.status +configured by $0, generated by GNU Autoconf 2.59, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + +Copyright (C) 2003 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir=$srcdir +INSTALL="$INSTALL" +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + ac_shift=: + ;; + -*) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_option=$1 + ac_need_defaults=false;; + esac + + case $ac_option in + # Handling of the options. +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:$LINENO: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + ac_need_defaults=false;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +if \$ac_cs_recheck; then + echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +# +# INIT-COMMANDS section. +# + +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" + +_ACEOF + + + +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; + "po/Makefile.in" ) CONFIG_FILES="$CONFIG_FILES po/Makefile.in:po/Make-in" ;; + "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "default" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;; + "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h:config.in" ;; + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason to put it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./confstat$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF + +# +# CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "\$CONFIG_FILES"; then + # Protect against being on the right side of a sed subst in config.status. + sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@DEFS@,$DEFS,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@LIBS@,$LIBS,;t t +s,@build@,$build,;t t +s,@build_cpu@,$build_cpu,;t t +s,@build_vendor@,$build_vendor,;t t +s,@build_os@,$build_os,;t t +s,@host@,$host,;t t +s,@host_cpu@,$host_cpu,;t t +s,@host_vendor@,$host_vendor,;t t +s,@host_os@,$host_os,;t t +s,@target@,$target,;t t +s,@target_cpu@,$target_cpu,;t t +s,@target_vendor@,$target_vendor,;t t +s,@target_os@,$target_os,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@CYGPATH_W@,$CYGPATH_W,;t t +s,@PACKAGE@,$PACKAGE,;t t +s,@VERSION@,$VERSION,;t t +s,@ACLOCAL@,$ACLOCAL,;t t +s,@AUTOCONF@,$AUTOCONF,;t t +s,@AUTOMAKE@,$AUTOMAKE,;t t +s,@AUTOHEADER@,$AUTOHEADER,;t t +s,@MAKEINFO@,$MAKEINFO,;t t +s,@install_sh@,$install_sh,;t t +s,@STRIP@,$STRIP,;t t +s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t +s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t +s,@mkdir_p@,$mkdir_p,;t t +s,@AWK@,$AWK,;t t +s,@SET_MAKE@,$SET_MAKE,;t t +s,@am__leading_dot@,$am__leading_dot,;t t +s,@AMTAR@,$AMTAR,;t t +s,@am__tar@,$am__tar,;t t +s,@am__untar@,$am__untar,;t t +s,@DEPDIR@,$DEPDIR,;t t +s,@am__include@,$am__include,;t t +s,@am__quote@,$am__quote,;t t +s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t +s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t +s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t +s,@CCDEPMODE@,$CCDEPMODE,;t t +s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t +s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t +s,@LN_S@,$LN_S,;t t +s,@RANLIB@,$RANLIB,;t t +s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t +s,@LIBTOOL@,$LIBTOOL,;t t +s,@WARN_CFLAGS@,$WARN_CFLAGS,;t t +s,@NO_WERROR@,$NO_WERROR,;t t +s,@YACC@,$YACC,;t t +s,@LEX@,$LEX,;t t +s,@LEXLIB@,$LEXLIB,;t t +s,@LEX_OUTPUT_ROOT@,$LEX_OUTPUT_ROOT,;t t +s,@CPP@,$CPP,;t t +s,@EGREP@,$EGREP,;t t +s,@ALLOCA@,$ALLOCA,;t t +s,@USE_NLS@,$USE_NLS,;t t +s,@MSGFMT@,$MSGFMT,;t t +s,@GMSGFMT@,$GMSGFMT,;t t +s,@XGETTEXT@,$XGETTEXT,;t t +s,@USE_INCLUDED_LIBINTL@,$USE_INCLUDED_LIBINTL,;t t +s,@CATALOGS@,$CATALOGS,;t t +s,@CATOBJEXT@,$CATOBJEXT,;t t +s,@DATADIRNAME@,$DATADIRNAME,;t t +s,@GMOFILES@,$GMOFILES,;t t +s,@INSTOBJEXT@,$INSTOBJEXT,;t t +s,@INTLDEPS@,$INTLDEPS,;t t +s,@INTLLIBS@,$INTLLIBS,;t t +s,@INTLOBJS@,$INTLOBJS,;t t +s,@POFILES@,$POFILES,;t t +s,@POSUB@,$POSUB,;t t +s,@INCLUDE_LOCALE_H@,$INCLUDE_LOCALE_H,;t t +s,@GT_NO@,$GT_NO,;t t +s,@GT_YES@,$GT_YES,;t t +s,@MKINSTALLDIRS@,$MKINSTALLDIRS,;t t +s,@l@,$l,;t t +s,@MAINTAINER_MODE_TRUE@,$MAINTAINER_MODE_TRUE,;t t +s,@MAINTAINER_MODE_FALSE@,$MAINTAINER_MODE_FALSE,;t t +s,@MAINT@,$MAINT,;t t +s,@HDEFINES@,$HDEFINES,;t t +s,@AR@,$AR,;t t +s,@CC_FOR_BUILD@,$CC_FOR_BUILD,;t t +s,@EXEEXT_FOR_BUILD@,$EXEEXT_FOR_BUILD,;t t +s,@DEMANGLER_NAME@,$DEMANGLER_NAME,;t t +s,@NLMCONV_DEFS@,$NLMCONV_DEFS,;t t +s,@BUILD_NLMCONV@,$BUILD_NLMCONV,;t t +s,@BUILD_SRCONV@,$BUILD_SRCONV,;t t +s,@BUILD_DLLTOOL@,$BUILD_DLLTOOL,;t t +s,@DLLTOOL_DEFS@,$DLLTOOL_DEFS,;t t +s,@BUILD_WINDRES@,$BUILD_WINDRES,;t t +s,@BUILD_DLLWRAP@,$BUILD_DLLWRAP,;t t +s,@BUILD_MISC@,$BUILD_MISC,;t t +s,@OBJDUMP_DEFS@,$OBJDUMP_DEFS,;t t +s,@EMULATION@,$EMULATION,;t t +s,@EMULATION_VECTOR@,$EMULATION_VECTOR,;t t +s,@datarootdir@,$datarootdir,;t t +s,@docdir@,$docdir,;t t +s,@htmldir@,$htmldir,;t t +s,@LIBOBJS@,$LIBOBJS,;t t +s,@LTLIBOBJS@,$LTLIBOBJS,;t t +CEOF + +_ACEOF + + cat >>$CONFIG_STATUS <<\_ACEOF + # 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_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # 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" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_builddir$INSTALL ;; + esac + + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + configure_input= + else + configure_input="$ac_file. " + fi + configure_input=$configure_input"Generated from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo "$f";; + *) # Relative + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@abs_srcdir@,$ac_abs_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t +s,@builddir@,$ac_builddir,;t t +s,@abs_builddir@,$ac_abs_builddir,;t t +s,@top_builddir@,$ac_top_builddir,;t t +s,@abs_top_builddir@,$ac_abs_top_builddir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out 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 +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF - 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* +# +# CONFIG_HEADER section. +# # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. -ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' -ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' -ac_dC='\3' -ac_dD='%g' -# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". -ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_uB='\([ ]\)%\1#\2define\3' +ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='[ ].*$,\1#\2' +ac_dC=' ' +ac_dD=',;t' +# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='$,\1#\2define\3' ac_uC=' ' -ac_uD='\4%g' -# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". -ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_eB='$%\1#\2define\3' -ac_eC=' ' -ac_eD='%g' +ac_uD=',;t' -if test "${CONFIG_HEADERS+set}" != set; then -EOF -cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF -fi -for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then +for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue # 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" ;; + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; esac - echo creating $ac_file + test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} - rm -f conftest.frag conftest.in conftest.out - ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` - cat $ac_file_inputs > conftest.in + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + # Do quote $f, to prevent DOS paths from being IFS'd. + echo "$f";; + *) # Relative + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } + # Remove the trailing spaces. + sed 's/[ ]*$//' $ac_file_inputs >$tmp/in -EOF +_ACEOF -# Transform confdefs.h into a sed script conftest.vals that substitutes -# the proper values into config.h.in to produce config.h. And first: -# Protect against being on the right side of a sed subst in config.status. -# Protect against being in an unquoted here document in config.status. -rm -f conftest.vals -cat > conftest.hdr <<\EOF -s/[\\&%]/\\&/g -s%[\\$`]%\\&%g -s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp -s%ac_d%ac_u%gp -s%ac_u%ac_e%gp -EOF -sed -n -f conftest.hdr confdefs.h > conftest.vals -rm -f conftest.hdr +# Transform confdefs.h into two sed scripts, `conftest.defines' and +# `conftest.undefs', that substitutes the proper values into +# config.h.in to produce config.h. The first handles `#define' +# templates, and the second `#undef' templates. +# And first: Protect against being on the right side of a sed subst in +# config.status. Protect against being in an unquoted here document +# in config.status. +rm -f conftest.defines conftest.undefs +# Using a here document instead of a string reduces the quoting nightmare. +# Putting comments in sed scripts is not portable. +# +# `end' is used to avoid that the second main sed command (meant for +# 0-ary CPP macros) applies to n-ary macro definitions. +# See the Autoconf documentation for `clear'. +cat >confdef2sed.sed <<\_ACEOF +s/[\\&,]/\\&/g +s,[\\$`],\\&,g +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp +t end +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp +: end +_ACEOF +# If some macros were called several times there might be several times +# the same #defines, which is useless. Nevertheless, we may not want to +# sort them, since we want the *last* AC-DEFINE to be honored. +uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines +sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs +rm -f confdef2sed.sed # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. -cat >> conftest.vals <<\EOF -s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% -EOF - -# Break up conftest.vals because some shells have a limit on -# the size of here documents, and old seds have small limits too. +cat >>conftest.undefs <<\_ACEOF +s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, +_ACEOF +# Break up conftest.defines because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS +echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS +echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS +echo ' :' >>$CONFIG_STATUS rm -f conftest.tail -while : +while grep . conftest.defines >/dev/null do - ac_lines=`grep -c . conftest.vals` - # grep -c gives empty output for an empty file on some AIX systems. - if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi - # Write a limited-size here document to conftest.frag. - echo ' cat > conftest.frag <> $CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS + # Write a limited-size here document to $tmp/defines.sed. + echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#define' lines. + echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF - sed -f conftest.frag conftest.in > conftest.out - rm -f conftest.in - mv conftest.out conftest.in -' >> $CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail - rm -f conftest.vals - mv conftest.tail conftest.vals + sed -f $tmp/defines.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail + rm -f conftest.defines + mv conftest.tail conftest.defines done -rm -f conftest.vals +rm -f conftest.defines +echo ' fi # grep' >>$CONFIG_STATUS +echo >>$CONFIG_STATUS -cat >> $CONFIG_STATUS <<\EOF - rm -f conftest.frag conftest.h - echo "/* $ac_file. Generated automatically by configure. */" > conftest.h - cat conftest.in >> conftest.h - rm -f conftest.in - if cmp -s $ac_file conftest.h 2>/dev/null; then - echo "$ac_file is unchanged" - rm -f conftest.h +# Break up conftest.undefs because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #undef templates' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.undefs >/dev/null +do + # Write a limited-size here document to $tmp/undefs.sed. + echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#undef' + echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/undefs.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail + rm -f conftest.undefs + mv conftest.tail conftest.undefs +done +rm -f conftest.undefs + +cat >>$CONFIG_STATUS <<\_ACEOF + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + echo "/* Generated by configure. */" >$tmp/config.h else - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` - if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - # The file is in a subdirectory. - test ! -d "$ac_dir" && mkdir "$ac_dir" - fi - rm -f $ac_file - mv conftest.h $ac_file + echo "/* $ac_file. Generated by configure. */" >$tmp/config.h fi -fi; done + cat $tmp/in >>$tmp/config.h + rm -f $tmp/in + if test x"$ac_file" != x-; then + if diff $ac_file $tmp/config.h >/dev/null 2>&1; then + { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} + else + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } -EOF -cat >> $CONFIG_STATUS <`(dirname $ac_file) 2>/dev/null || +$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X$ac_file : 'X\(//\)[^/]' \| \ + X$ac_file : 'X\(//\)$' \| \ + X$ac_file : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X$ac_file | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'`/stamp-h$_am_stamp_count +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + +# +# CONFIG_COMMANDS section. +# +for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue + ac_dest=`echo "$ac_file" | sed 's,:.*,,'` + ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_dir=`(dirname "$ac_dest") 2>/dev/null || +$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_dest" : 'X\(//\)[^/]' \| \ + X"$ac_dest" : 'X\(//\)$' \| \ + X"$ac_dest" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_dest" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac -EOF -cat >> $CONFIG_STATUS <<\EOF -test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h + { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 +echo "$as_me: executing $ac_dest commands" >&6;} + case $ac_dest in + depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # So let's grep whole file. + if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + dirpart=`(dirname "$mf") 2>/dev/null || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`(dirname "$file") 2>/dev/null || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p $dirpart/$fdir + else + as_dir=$dirpart/$fdir + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5 +echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} + { (exit 1); exit 1; }; }; } + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done + ;; + default ) case "x$CONFIG_FILES" in *) sed -e '/POTFILES =/r po/POTFILES' po/Makefile.in > po/Makefile ;; esac + ;; + esac +done +_ACEOF -exit 0 -EOF +cat >>$CONFIG_STATUS <<\_ACEOF + +{ (exit 0); exit 0; } +_ACEOF chmod +x $CONFIG_STATUS -rm -fr confdefs* $ac_clean_files -test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 +ac_clean_files=$ac_clean_files_save + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi diff --git a/contrib/binutils/binutils/configure.in b/contrib/binutils/binutils/configure.in index 88890843983..10afc537441 100644 --- a/contrib/binutils/binutils/configure.in +++ b/contrib/binutils/binutils/configure.in @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script. dnl -AC_PREREQ(2.13) +AC_PREREQ(2.57) AC_INIT(ar.c) AC_CANONICAL_SYSTEM @@ -29,27 +29,8 @@ AC_ARG_ENABLE(commonbfdlib, *) AC_MSG_ERROR([bad value ${enableval} for BFD commonbfdlib option]) ;; esac])dnl -build_warnings="-W -Wall -Wstrict-prototypes -Wmissing-prototypes" -AC_ARG_ENABLE(build-warnings, -[ --enable-build-warnings Enable build-time compiler warnings if gcc is used], -[case "${enableval}" in - yes) ;; - no) build_warnings="-w";; - ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"` - build_warnings="${build_warnings} ${t}";; - *,) t=`echo "${enableval}" | sed -e "s/,/ /g"` - build_warnings="${t} ${build_warnings}";; - *) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;; -esac -if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then - echo "Setting warning flags = $build_warnings" 6>&1 -fi])dnl -WARN_CFLAGS="" -if test "x${build_warnings}" != x -a "x$GCC" = xyes ; then - WARN_CFLAGS="${build_warnings}" -fi -AC_SUBST(WARN_CFLAGS) - +AM_BINUTILS_WARNINGS + AM_CONFIG_HEADER(config.h:config.in) if test -z "$target" ; then @@ -60,11 +41,12 @@ if test -z "$host" ; then fi AC_PROG_CC +AC_GNU_SOURCE AC_PROG_YACC AM_PROG_LEX -ALL_LINGUAS="fr tr ja es sv da zh_CN ru" +ALL_LINGUAS="fr tr ja es sv da zh_CN ru ro rw zh_TW fi vi" CY_GNU_GETTEXT AM_MAINTAINER_MODE @@ -118,10 +100,27 @@ AC_MSG_RESULT($bu_cv_have_fopen64) if test "$bu_cv_have_fopen64" != no; then AC_DEFINE([HAVE_FOPEN64], 1, [Is fopen64 available?]) - if test "$bu_cv_have_fopen64" = "need -D_LARGEFILE64_SOURCE"; then - AC_DEFINE([_LARGEFILE64_SOURCE], 1, - [Enable LFS]) - fi +fi +AC_MSG_CHECKING([for stat64]) +AC_CACHE_VAL(bu_cv_have_stat64, +[AC_TRY_LINK([#include ], [struct stat64 st; stat64 ("/tmp/foo", &st);], +bu_cv_have_stat64=yes, +[saved_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE" + AC_TRY_LINK([#include ], [struct stat64 st; stat64 ("/tmp/foo", &st);], +bu_cv_have_stat64="need -D_LARGEFILE64_SOURCE", +bu_cv_have_stat64=no) + CPPFLAGS=$saved_CPPFLAGS])]) +AC_MSG_RESULT($bu_cv_have_stat64) +if test "$bu_cv_have_stat64" != no; then + AC_DEFINE([HAVE_STAT64], 1, + [Is stat64 available?]) +fi +if test "$bu_cv_have_fopen64" = "need -D_LARGEFILE64_SOURCE" \ + || test "$bu_cv_have_stat64" = "need -D_LARGEFILE64_SOURCE"; then + AC_DEFINE([_LARGEFILE64_SOURCE], 1, + [Enable LFS]) + CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE" fi # Some systems have frexp only in -lm, not in -lc. @@ -147,6 +146,16 @@ if test $bu_cv_decl_time_t_types_h = yes; then [Is the type time_t defined in ?]) fi +AC_MSG_CHECKING(for a known getopt prototype in unistd.h) +AC_CACHE_VAL(bu_cv_decl_getopt_unistd_h, +[AC_TRY_COMPILE([#include ], [extern int getopt (int, char *const*, const char *);], +bu_cv_decl_getopt_unistd_h=yes, bu_cv_decl_getopt_unistd_h=no)]) +AC_MSG_RESULT($bu_cv_decl_getopt_unistd_h) +if test $bu_cv_decl_getopt_unistd_h = yes; then + AC_DEFINE([HAVE_DECL_GETOPT], 1, + [Is the prototype for getopt in in the expected format?]) +fi + # Under Next 3.2 apparently does not define struct utimbuf # by default. AC_MSG_CHECKING([for utime.h]) @@ -163,11 +172,8 @@ if test $bu_cv_header_utime_h = yes; then AC_DEFINE(HAVE_GOOD_UTIME_H, 1, [Does define struct utimbuf?]) fi -BFD_NEED_DECLARATION(fprintf) -BFD_NEED_DECLARATION(strstr) -BFD_NEED_DECLARATION(sbrk) -BFD_NEED_DECLARATION(getenv) -BFD_NEED_DECLARATION(environ) +AC_CHECK_DECLS([fprintf, stpcpy, strstr, sbrk, getenv, environ, getc_unlocked, + snprintf, vsnprintf]) BFD_BINARY_FOPEN @@ -245,9 +251,6 @@ changequote([,])dnl DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM" BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)' ;; - arm*-* | xscale-* | strongarm-* | d10v-*) - OBJDUMP_DEFS="-DDISASSEMBLER_NEEDS_RELOCS" - ;; changequote(,)dnl i[3-7]86-*-pe* | i[3-7]86-*-cygwin* | i[3-7]86-*-mingw32** | i[3-7]86-*-netbsdpe*) changequote([,])dnl @@ -293,12 +296,6 @@ changequote([,])dnl BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)' DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE_ELF" ;; - c4x-*-* | tic4x-*-*) - OBJDUMP_DEFS="$OBJDUMP_DEFS -DSKIP_ZEROES=32" - ;; - ia64-*-*) - OBJDUMP_DEFS="$OBJDUMP_DEFS -DSKIP_ZEROES=16" - ;; esac fi done @@ -349,6 +346,11 @@ done AC_SUBST(EMULATION) AC_SUBST(EMULATION_VECTOR) +# Required for html and install-html +AC_SUBST(datarootdir) +AC_SUBST(docdir) +AC_SUBST(htmldir) + AC_OUTPUT(Makefile doc/Makefile po/Makefile.in:po/Make-in, [ case "x$CONFIG_FILES" in diff --git a/contrib/binutils/binutils/cxxfilt.c b/contrib/binutils/binutils/cxxfilt.c index 1b297fd9da3..a8ec43ba118 100644 --- a/contrib/binutils/binutils/cxxfilt.c +++ b/contrib/binutils/binutils/cxxfilt.c @@ -1,26 +1,26 @@ /* Demangler for GNU C++ - main program Copyright 1989, 1991, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + 2000, 2001, 2002, 2003, 2005 Free Software Foundation, Inc. Written by James Clark (jjc@jclark.uucp) Rewritten by Fred Fish (fnf@cygnus.com) for ARM and Lucid demangling Modified by Satish Pai (pai@apollo.hp.com) for HP demangling -This file is part of GCC. + This file is part of GCC. -GCC is free software; you can redistribute 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. + GCC is free software; you can redistribute 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. -GCC is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. + GCC is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. -You should have received a copy of the GNU General Public License -along with GCC; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING. If not, write to the Free + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #include "config.h" #include "bfd.h" @@ -31,25 +31,44 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "safe-ctype.h" static int flags = DMGL_PARAMS | DMGL_ANSI | DMGL_VERBOSE; +static int strip_underscore = TARGET_PREPENDS_UNDERSCORE; -static void demangle_it (char *); -static void usage (FILE *, int) ATTRIBUTE_NORETURN; -static void print_demangler_list (FILE *); +static const struct option long_options[] = +{ + {"strip-underscore", no_argument, NULL, '_'}, + {"format", required_argument, NULL, 's'}, + {"help", no_argument, NULL, 'h'}, + {"no-params", no_argument, NULL, 'p'}, + {"no-strip-underscores", no_argument, NULL, 'n'}, + {"no-verbose", no_argument, NULL, 'i'}, + {"types", no_argument, NULL, 't'}, + {"version", no_argument, NULL, 'v'}, + {NULL, no_argument, NULL, 0} +}; static void demangle_it (char *mangled_name) { char *result; + unsigned int skip_first = 0; + + /* _ and $ are sometimes found at the start of function names + in assembler sources in order to distinguish them from other + names (eg register names). So skip them here. */ + if (mangled_name[0] == '.' || mangled_name[0] == '$') + ++skip_first; + if (strip_underscore && mangled_name[skip_first] == '_') + ++skip_first; + + result = cplus_demangle (mangled_name + skip_first, flags); - /* For command line args, also try to demangle type encodings. */ - result = cplus_demangle (mangled_name, flags | DMGL_TYPES); if (result == NULL) - { - printf ("%s\n", mangled_name); - } + printf (mangled_name); else { - printf ("%s\n", result); + if (mangled_name[0] == '.') + putchar ('.'); + printf (result); free (result); } } @@ -73,44 +92,32 @@ static void usage (FILE *stream, int status) { fprintf (stream, "\ -Usage: %s [-_] [-n] [--strip-underscores] [--no-strip-underscores]\n\ - [-p] [--no-params]\n", - program_name); - +Usage: %s [options] [mangled names]\n", program_name); fprintf (stream, "\ - [-s "); +Options are:\n\ + [-_|--strip-underscore] Ignore first leading underscore%s\n", + TARGET_PREPENDS_UNDERSCORE ? " (default)" : ""); + fprintf (stream, "\ + [-n|--no-strip-underscore] Do not ignore a leading underscore%s\n", + TARGET_PREPENDS_UNDERSCORE ? "" : " (default)"); + fprintf (stream, "\ + [-p|--no-params] Do not display function arguments\n\ + [-i|--no-verbose] Do not show implementation details (if any)\n\ + [-t|--types] Also attempt to demangle type encodings\n\ + [-s|--format "); print_demangler_list (stream); fprintf (stream, "]\n"); fprintf (stream, "\ - [--format "); - print_demangler_list (stream); - fprintf (stream, "]\n"); - - fprintf (stream, "\ - [--help] [--version] [arg...]\n"); + [@] Read extra options from \n\ + [-h|--help] Display this information\n\ + [-v|--version] Show the version information\n\ +Demangled names are displayed to stdout.\n\ +If a name cannot be demangled it is just echoed to stdout.\n\ +If no names are provided on the command line, stdin is read.\n"); exit (status); } -#define MBUF_SIZE 32767 -char mbuffer[MBUF_SIZE]; - -int strip_underscore = 0; - -static const struct option long_options[] = { - {"strip-underscores", no_argument, 0, '_'}, - {"format", required_argument, 0, 's'}, - {"help", no_argument, 0, 'h'}, - {"no-params", no_argument, 0, 'p'}, - {"no-strip-underscores", no_argument, 0, 'n'}, - {"version", no_argument, 0, 'v'}, - {0, no_argument, 0, 0} -}; - -static const char *standard_symbol_characters (void); - -static const char *hp_symbol_characters (void); - /* Return the string of non-alnum characters that may occur as a valid symbol component, in the standard assembler symbol syntax. */ @@ -121,7 +128,6 @@ standard_symbol_characters (void) return "_$."; } - /* Return the string of non-alnum characters that may occur as a valid symbol name component in an HP object file. @@ -163,7 +169,6 @@ extern int main (int, char **); int main (int argc, char **argv) { - char *result; int c; const char *valid_symbols; enum demangling_styles style = auto_demangling; @@ -171,9 +176,9 @@ main (int argc, char **argv) program_name = argv[0]; xmalloc_set_program_name (program_name); - strip_underscore = TARGET_PREPENDS_UNDERSCORE; + expandargv (&argc, &argv); - while ((c = getopt_long (argc, argv, "_nps:", long_options, (int *) 0)) != EOF) + while ((c = getopt_long (argc, argv, "_hinps:tv", long_options, (int *) 0)) != EOF) { switch (c) { @@ -188,24 +193,27 @@ main (int argc, char **argv) case 'p': flags &= ~ DMGL_PARAMS; break; + case 't': + flags |= DMGL_TYPES; + break; + case 'i': + flags &= ~ DMGL_VERBOSE; + break; case 'v': print_version ("c++filt"); - return (0); + return 0; case '_': strip_underscore = 1; break; case 's': - { - style = cplus_demangle_name_to_style (optarg); - if (style == unknown_demangling) - { - fprintf (stderr, "%s: unknown demangling style `%s'\n", - program_name, optarg); - return (1); - } - else - cplus_demangle_set_style (style); - } + style = cplus_demangle_name_to_style (optarg); + if (style == unknown_demangling) + { + fprintf (stderr, "%s: unknown demangling style `%s'\n", + program_name, optarg); + return 1; + } + cplus_demangle_set_style (style); break; } } @@ -215,77 +223,65 @@ main (int argc, char **argv) for ( ; optind < argc; optind++) { demangle_it (argv[optind]); + putchar ('\n'); } + + return 0; } - else + + switch (current_demangling_style) { - switch (current_demangling_style) - { - case gnu_demangling: - case lucid_demangling: - case arm_demangling: - case java_demangling: - case edg_demangling: - case gnat_demangling: - case gnu_v3_demangling: - case auto_demangling: - valid_symbols = standard_symbol_characters (); - break; - case hp_demangling: - valid_symbols = hp_symbol_characters (); - break; - default: - /* Folks should explicitly indicate the appropriate alphabet for - each demangling. Providing a default would allow the - question to go unconsidered. */ - fatal ("Internal error: no symbol alphabet for current style"); - } - - for (;;) - { - int i = 0; - c = getchar (); - /* Try to read a label. */ - while (c != EOF && (ISALNUM (c) || strchr (valid_symbols, c))) - { - if (i >= MBUF_SIZE-1) - break; - mbuffer[i++] = c; - c = getchar (); - } - if (i > 0) - { - int skip_first = 0; - - mbuffer[i] = 0; - if (mbuffer[0] == '.' || mbuffer[0] == '$') - ++skip_first; - if (strip_underscore && mbuffer[skip_first] == '_') - ++skip_first; - - if (skip_first > i) - skip_first = i; - - flags |= (int) style; - result = cplus_demangle (mbuffer + skip_first, flags); - if (result) - { - if (mbuffer[0] == '.') - putc ('.', stdout); - fputs (result, stdout); - free (result); - } - else - fputs (mbuffer, stdout); - - fflush (stdout); - } - if (c == EOF) - break; - putchar (c); - fflush (stdout); - } + case gnu_demangling: + case lucid_demangling: + case arm_demangling: + case java_demangling: + case edg_demangling: + case gnat_demangling: + case gnu_v3_demangling: + case auto_demangling: + valid_symbols = standard_symbol_characters (); + break; + case hp_demangling: + valid_symbols = hp_symbol_characters (); + break; + default: + /* Folks should explicitly indicate the appropriate alphabet for + each demangling. Providing a default would allow the + question to go unconsidered. */ + fatal ("Internal error: no symbol alphabet for current style"); } - return (0); + for (;;) + { + static char mbuffer[32767]; + unsigned i = 0; + + c = getchar (); + /* Try to read a mangled name. */ + while (c != EOF && (ISALNUM (c) || strchr (valid_symbols, c))) + { + if (i >= sizeof (mbuffer) - 1) + break; + mbuffer[i++] = c; + c = getchar (); + } + + if (i > 0) + { + mbuffer[i] = 0; + demangle_it (mbuffer); + } + + if (c == EOF) + break; + + /* Echo the whitespace characters so that the output looks + like the input, only with the mangled names demangled. */ + putchar (c); + if (c == '\n') + fflush (stdout); + } + + fflush (stdout); + return 0; } diff --git a/contrib/binutils/binutils/debug.c b/contrib/binutils/binutils/debug.c index 5d46b781080..07d38acfe40 100644 --- a/contrib/binutils/binutils/debug.c +++ b/contrib/binutils/binutils/debug.c @@ -1,5 +1,6 @@ /* debug.c -- Handle generic debugging information. - Copyright 1995, 1996, 1997, 1998, 2000, 2002, 2003 Free Software Foundation, Inc. + Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003 + Free Software Foundation, Inc. Written by Ian Lance Taylor . This file is part of GNU Binutils. @@ -16,8 +17,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ /* This file implements a generic debugging format. We may eventually have readers which convert different formats into this generic diff --git a/contrib/binutils/binutils/debug.h b/contrib/binutils/binutils/debug.h index 3331e0b9b29..c18ba54a663 100644 --- a/contrib/binutils/binutils/debug.h +++ b/contrib/binutils/binutils/debug.h @@ -16,8 +16,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #ifndef DEBUG_H #define DEBUG_H diff --git a/contrib/binutils/binutils/deflex.l b/contrib/binutils/binutils/deflex.l index bdf15d3a12e..c6d45c85a43 100644 --- a/contrib/binutils/binutils/deflex.l +++ b/contrib/binutils/binutils/deflex.l @@ -1,6 +1,6 @@ %{/* deflex.l - Lexer for .def files */ -/* Copyright 1995, 1997, 1998, 1999, 2002, 2003, 2004 +/* Copyright 1995, 1997, 1998, 1999, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* Contributed by Steve Chamberlain: sac@cygnus.com */ @@ -27,6 +27,8 @@ #include "defparse.h" #include "dlltool.h" +#define YY_NO_UNPUT + int linenumber; %} @@ -81,6 +83,7 @@ int linenumber; ";".* { } " " { } "\t" { } +"\r" { } "\n" { linenumber ++ ;} "=" { return '=';} "." { return '.';} diff --git a/contrib/binutils/binutils/defparse.c b/contrib/binutils/binutils/defparse.c index 7cd3a253139..de34ae0cfc1 100644 --- a/contrib/binutils/binutils/defparse.c +++ b/contrib/binutils/binutils/defparse.c @@ -1,41 +1,129 @@ -/* A Bison parser, made from defparse.y - by GNU bison 1.35. */ +/* A Bison parser, made by GNU Bison 2.1. */ -#define YYBISON 1 /* Identify Bison output. */ +/* Skeleton parser for Yacc-like parsing with Bison, + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. -# define NAME 257 -# define LIBRARY 258 -# define DESCRIPTION 259 -# define STACKSIZE 260 -# define HEAPSIZE 261 -# define CODE 262 -# define DATA 263 -# define SECTIONS 264 -# define EXPORTS 265 -# define IMPORTS 266 -# define VERSIONK 267 -# define BASE 268 -# define CONSTANT 269 -# define READ 270 -# define WRITE 271 -# define EXECUTE 272 -# define SHARED 273 -# define NONSHARED 274 -# define NONAME 275 -# define PRIVATE 276 -# define SINGLE 277 -# define MULTIPLE 278 -# define INITINSTANCE 279 -# define INITGLOBAL 280 -# define TERMINSTANCE 281 -# define TERMGLOBAL 282 -# define ID 283 -# define NUMBER 284 + This program is free software; you can redistribute 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ + +/* As a special exception, when this file is copied by Bison into a + Bison output file, you may use that output file without restriction. + This special exception was added by the Free Software Foundation + in version 1.24 of Bison. */ + +/* Written by Richard Stallman by simplifying the original so called + ``semantic'' parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "2.1" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 0 + +/* Using locations. */ +#define YYLSP_NEEDED 0 + + + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + NAME = 258, + LIBRARY = 259, + DESCRIPTION = 260, + STACKSIZE = 261, + HEAPSIZE = 262, + CODE = 263, + DATA = 264, + SECTIONS = 265, + EXPORTS = 266, + IMPORTS = 267, + VERSIONK = 268, + BASE = 269, + CONSTANT = 270, + READ = 271, + WRITE = 272, + EXECUTE = 273, + SHARED = 274, + NONSHARED = 275, + NONAME = 276, + PRIVATE = 277, + SINGLE = 278, + MULTIPLE = 279, + INITINSTANCE = 280, + INITGLOBAL = 281, + TERMINSTANCE = 282, + TERMGLOBAL = 283, + ID = 284, + NUMBER = 285 + }; +#endif +/* Tokens. */ +#define NAME 258 +#define LIBRARY 259 +#define DESCRIPTION 260 +#define STACKSIZE 261 +#define HEAPSIZE 262 +#define CODE 263 +#define DATA 264 +#define SECTIONS 265 +#define EXPORTS 266 +#define IMPORTS 267 +#define VERSIONK 268 +#define BASE 269 +#define CONSTANT 270 +#define READ 271 +#define WRITE 272 +#define EXECUTE 273 +#define SHARED 274 +#define NONSHARED 275 +#define NONAME 276 +#define PRIVATE 277 +#define SINGLE 278 +#define MULTIPLE 279 +#define INITINSTANCE 280 +#define INITGLOBAL 281 +#define TERMINSTANCE 282 +#define TERMGLOBAL 283 +#define ID 284 +#define NUMBER 285 + + + + +/* Copy the first part of user declarations. */ #line 1 "defparse.y" /* defparse.y - parser for .def files */ -/* Copyright 1995, 1997, 1998, 1999, 2004 +/* Copyright 1995, 1997, 1998, 1999, 2001, 2004 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -52,36 +140,221 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "bucomm.h" #include "dlltool.h" -#line 27 "defparse.y" -#ifndef YYSTYPE -typedef union { - char *id; - int number; -} yystype; -# define YYSTYPE yystype -# define YYSTYPE_IS_TRIVIAL 1 -#endif + +/* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 +#endif + +#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) +#line 27 "defparse.y" +typedef union YYSTYPE { + char *id; + int number; +} YYSTYPE; +/* Line 196 of yacc.c. */ +#line 176 "defparse.c" +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 +#endif -#define YYFINAL 98 -#define YYFLAG -32768 -#define YYNTBASE 35 -/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */ -#define YYTRANSLATE(x) ((unsigned)(x) <= 284 ? yytranslate[x] : 57) +/* Copy the second part of user declarations. */ -/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */ -static const char yytranslate[] = + +/* Line 219 of yacc.c. */ +#line 188 "defparse.c" + +#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) +# define YYSIZE_T __SIZE_TYPE__ +#endif +#if ! defined (YYSIZE_T) && defined (size_t) +# define YYSIZE_T size_t +#endif +#if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus)) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +#endif +#if ! defined (YYSIZE_T) +# define YYSIZE_T unsigned int +#endif + +#ifndef YY_ +# if YYENABLE_NLS +# if ENABLE_NLS +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif +# endif +# ifndef YY_ +# define YY_(msgid) msgid +# endif +#endif + +#if ! defined (yyoverflow) || YYERROR_VERBOSE + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# else +# define YYSTACK_ALLOC alloca +# if defined (__STDC__) || defined (__cplusplus) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYINCLUDED_STDLIB_H +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1) +# endif +# ifdef __cplusplus +extern "C" { +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \ + && (defined (__STDC__) || defined (__cplusplus))) +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \ + && (defined (__STDC__) || defined (__cplusplus))) +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifdef __cplusplus +} +# endif +# endif +#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ + + +#if (! defined (yyoverflow) \ + && (! defined (__cplusplus) \ + || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + short int yyss; + YYSTYPE yyvs; + }; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAXIMUM) + +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined (__GNUC__) && 1 < __GNUC__ +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define YYCOPY(To, From, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (0) +# endif +# endif + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack, Stack, yysize); \ + Stack = &yyptr->Stack; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (0) + +#endif + +#if defined (__STDC__) || defined (__cplusplus) + typedef signed char yysigned_char; +#else + typedef short int yysigned_char; +#endif + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 38 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 114 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 35 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 23 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 68 +/* YYNRULES -- Number of states. */ +#define YYNSTATES 98 + +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 285 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +static const unsigned char yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -108,172 +381,191 @@ static const char yytranslate[] = 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 3, 4, 5, - 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30 + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30 }; #if YYDEBUG -static const short yyprhs[] = +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ +static const unsigned char yyprhs[] = { - 0, 0, 3, 5, 9, 14, 17, 20, 24, 28, - 31, 34, 37, 40, 43, 48, 49, 52, 60, 63, - 65, 73, 81, 87, 93, 99, 105, 109, 113, 116, - 118, 121, 125, 127, 129, 130, 133, 134, 136, 138, - 140, 142, 144, 146, 148, 150, 151, 153, 154, 156, - 157, 159, 160, 162, 166, 167, 170, 171, 174, 179, - 180, 184, 185, 186, 190, 192, 194, 196 -}; -static const short yyrhs[] = -{ - 35, 36, 0, 36, 0, 3, 51, 54, 0, 4, - 51, 54, 55, 0, 11, 37, 0, 5, 29, 0, - 6, 30, 45, 0, 7, 30, 45, 0, 8, 43, - 0, 9, 43, 0, 10, 41, 0, 12, 39, 0, - 13, 30, 0, 13, 30, 31, 30, 0, 0, 37, - 38, 0, 29, 53, 52, 48, 47, 49, 50, 0, - 39, 40, 0, 40, 0, 29, 32, 29, 31, 29, - 31, 29, 0, 29, 32, 29, 31, 29, 31, 30, - 0, 29, 32, 29, 31, 29, 0, 29, 32, 29, - 31, 30, 0, 29, 31, 29, 31, 29, 0, 29, - 31, 29, 31, 30, 0, 29, 31, 29, 0, 29, - 31, 30, 0, 41, 42, 0, 42, 0, 29, 43, - 0, 43, 44, 46, 0, 46, 0, 33, 0, 0, - 33, 30, 0, 0, 16, 0, 17, 0, 18, 0, - 19, 0, 20, 0, 23, 0, 24, 0, 15, 0, - 0, 21, 0, 0, 9, 0, 0, 22, 0, 0, - 29, 0, 29, 31, 29, 0, 0, 34, 30, 0, - 0, 32, 29, 0, 32, 29, 31, 29, 0, 0, - 14, 32, 30, 0, 0, 0, 55, 44, 56, 0, - 25, 0, 26, 0, 27, 0, 28, 0 + 0, 0, 3, 6, 8, 12, 17, 20, 23, 27, + 31, 34, 37, 40, 43, 46, 51, 52, 55, 63, + 66, 68, 76, 84, 90, 96, 102, 108, 112, 116, + 119, 121, 124, 128, 130, 132, 133, 136, 137, 139, + 141, 143, 145, 147, 149, 151, 153, 154, 156, 157, + 159, 160, 162, 163, 165, 169, 170, 173, 174, 177, + 182, 183, 187, 188, 189, 193, 195, 197, 199 }; -#endif - -#if YYDEBUG -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const short yyrline[] = +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yysigned_char yyrhs[] = { - 0, 44, 45, 48, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 64, 66, 69, 73, 75, - 78, 80, 81, 82, 83, 84, 85, 86, 89, 91, - 94, 98, 100, 103, 105, 107, 108, 111, 113, 114, - 115, 116, 117, 118, 121, 123, 126, 128, 131, 133, - 136, 138, 141, 142, 148, 151, 153, 156, 158, 164, - 167, 168, 171, 173, 176, 178, 179, 180 + 36, 0, -1, 36, 37, -1, 37, -1, 3, 52, + 55, -1, 4, 52, 55, 56, -1, 11, 38, -1, + 5, 29, -1, 6, 30, 46, -1, 7, 30, 46, + -1, 8, 44, -1, 9, 44, -1, 10, 42, -1, + 12, 40, -1, 13, 30, -1, 13, 30, 31, 30, + -1, -1, 38, 39, -1, 29, 54, 53, 49, 48, + 50, 51, -1, 40, 41, -1, 41, -1, 29, 32, + 29, 31, 29, 31, 29, -1, 29, 32, 29, 31, + 29, 31, 30, -1, 29, 32, 29, 31, 29, -1, + 29, 32, 29, 31, 30, -1, 29, 31, 29, 31, + 29, -1, 29, 31, 29, 31, 30, -1, 29, 31, + 29, -1, 29, 31, 30, -1, 42, 43, -1, 43, + -1, 29, 44, -1, 44, 45, 47, -1, 47, -1, + 33, -1, -1, 33, 30, -1, -1, 16, -1, 17, + -1, 18, -1, 19, -1, 20, -1, 23, -1, 24, + -1, 15, -1, -1, 21, -1, -1, 9, -1, -1, + 22, -1, -1, 29, -1, 29, 31, 29, -1, -1, + 34, 30, -1, -1, 32, 29, -1, 32, 29, 31, + 29, -1, -1, 14, 32, 30, -1, -1, -1, 56, + 45, 57, -1, 25, -1, 26, -1, 27, -1, 28, + -1 +}; + +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const unsigned char yyrline[] = +{ + 0, 44, 44, 45, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 64, 66, 70, 74, + 75, 79, 80, 81, 82, 83, 84, 85, 86, 90, + 91, 95, 99, 100, 104, 105, 107, 108, 112, 113, + 114, 115, 116, 117, 118, 122, 123, 127, 128, 132, + 133, 137, 138, 141, 142, 148, 152, 153, 157, 158, + 164, 167, 168, 171, 173, 177, 178, 179, 180 }; #endif - -#if (YYDEBUG) || defined YYERROR_VERBOSE - -/* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */ +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { - "$", "error", "$undefined.", "NAME", "LIBRARY", "DESCRIPTION", - "STACKSIZE", "HEAPSIZE", "CODE", "DATA", "SECTIONS", "EXPORTS", - "IMPORTS", "VERSIONK", "BASE", "CONSTANT", "READ", "WRITE", "EXECUTE", - "SHARED", "NONSHARED", "NONAME", "PRIVATE", "SINGLE", "MULTIPLE", - "INITINSTANCE", "INITGLOBAL", "TERMINSTANCE", "TERMGLOBAL", "ID", - "NUMBER", "'.'", "'='", "','", "'@'", "start", "command", "explist", - "expline", "implist", "impline", "seclist", "secline", "attr_list", - "opt_comma", "opt_number", "attr", "opt_CONSTANT", "opt_NONAME", - "opt_DATA", "opt_PRIVATE", "opt_name", "opt_ordinal", "opt_equal_name", - "opt_base", "option_list", "option", 0 + "$end", "error", "$undefined", "NAME", "LIBRARY", "DESCRIPTION", + "STACKSIZE", "HEAPSIZE", "CODE", "DATA", "SECTIONS", "EXPORTS", + "IMPORTS", "VERSIONK", "BASE", "CONSTANT", "READ", "WRITE", "EXECUTE", + "SHARED", "NONSHARED", "NONAME", "PRIVATE", "SINGLE", "MULTIPLE", + "INITINSTANCE", "INITGLOBAL", "TERMINSTANCE", "TERMGLOBAL", "ID", + "NUMBER", "'.'", "'='", "','", "'@'", "$accept", "start", "command", + "explist", "expline", "implist", "impline", "seclist", "secline", + "attr_list", "opt_comma", "opt_number", "attr", "opt_CONSTANT", + "opt_NONAME", "opt_DATA", "opt_PRIVATE", "opt_name", "opt_ordinal", + "opt_equal_name", "opt_base", "option_list", "option", 0 }; #endif -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const short yyr1[] = +# ifdef YYPRINT +/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to + token YYLEX-NUM. */ +static const unsigned short int yytoknum[] = { - 0, 35, 35, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 37, 37, 38, 39, 39, - 40, 40, 40, 40, 40, 40, 40, 40, 41, 41, - 42, 43, 43, 44, 44, 45, 45, 46, 46, 46, - 46, 46, 46, 46, 47, 47, 48, 48, 49, 49, - 50, 50, 51, 51, 51, 52, 52, 53, 53, 53, - 54, 54, 55, 55, 56, 56, 56, 56 + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 46, 61, 44, 64 +}; +# endif + +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const unsigned char yyr1[] = +{ + 0, 35, 36, 36, 37, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 37, 37, 38, 38, 39, 40, + 40, 41, 41, 41, 41, 41, 41, 41, 41, 42, + 42, 43, 44, 44, 45, 45, 46, 46, 47, 47, + 47, 47, 47, 47, 47, 48, 48, 49, 49, 50, + 50, 51, 51, 52, 52, 52, 53, 53, 54, 54, + 54, 55, 55, 56, 56, 57, 57, 57, 57 }; -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const short yyr2[] = +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const unsigned char yyr2[] = { - 0, 2, 1, 3, 4, 2, 2, 3, 3, 2, - 2, 2, 2, 2, 4, 0, 2, 7, 2, 1, - 7, 7, 5, 5, 5, 5, 3, 3, 2, 1, - 2, 3, 1, 1, 0, 2, 0, 1, 1, 1, - 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, - 1, 0, 1, 3, 0, 2, 0, 2, 4, 0, - 3, 0, 0, 3, 1, 1, 1, 1 + 0, 2, 2, 1, 3, 4, 2, 2, 3, 3, + 2, 2, 2, 2, 2, 4, 0, 2, 7, 2, + 1, 7, 7, 5, 5, 5, 5, 3, 3, 2, + 1, 2, 3, 1, 1, 0, 2, 0, 1, 1, + 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 3, 0, 2, 0, 2, 4, + 0, 3, 0, 0, 3, 1, 1, 1, 1 }; -/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE - doesn't specify something else to do. Zero means the default is an - error. */ -static const short yydefact[] = +/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state + STATE-NUM when YYTABLE doesn't specify something else to do. Zero + means the default is an error. */ +static const unsigned char yydefact[] = { - 0, 54, 54, 0, 0, 0, 0, 0, 0, 15, - 0, 0, 0, 2, 52, 61, 61, 6, 36, 36, - 37, 38, 39, 40, 41, 42, 43, 9, 32, 10, - 0, 11, 29, 5, 0, 12, 19, 13, 1, 0, - 0, 3, 62, 0, 7, 8, 33, 0, 30, 28, - 59, 16, 0, 0, 18, 0, 53, 0, 4, 35, - 31, 0, 56, 26, 27, 0, 14, 60, 0, 57, - 0, 47, 0, 0, 64, 65, 66, 67, 63, 0, - 55, 46, 45, 24, 25, 22, 23, 58, 44, 49, - 0, 48, 51, 20, 21, 50, 17, 0, 0 + 0, 55, 55, 0, 0, 0, 0, 0, 0, 16, + 0, 0, 0, 3, 53, 62, 62, 7, 37, 37, + 38, 39, 40, 41, 42, 43, 44, 10, 33, 11, + 0, 12, 30, 6, 0, 13, 20, 14, 1, 2, + 0, 0, 4, 63, 0, 8, 9, 34, 0, 31, + 29, 60, 17, 0, 0, 19, 0, 54, 0, 5, + 36, 32, 0, 57, 27, 28, 0, 15, 61, 0, + 58, 0, 48, 0, 0, 65, 66, 67, 68, 64, + 0, 56, 47, 46, 25, 26, 23, 24, 59, 45, + 50, 0, 49, 52, 21, 22, 51, 18 }; -static const short yydefgoto[] = +/* YYDEFGOTO[NTERM-NUM]. */ +static const yysigned_char yydefgoto[] = { - 12, 13, 33, 51, 35, 36, 31, 32, 27, 47, - 44, 28, 89, 82, 92, 96, 15, 71, 62, 41, - 58, 78 + -1, 12, 13, 33, 52, 35, 36, 31, 32, 27, + 48, 45, 28, 90, 83, 93, 97, 15, 72, 63, + 42, 59, 79 }; -static const short yypact[] = +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +#define YYPACT_NINF -26 +static const yysigned_char yypact[] = { - 32, -12, -12, 17, -8, 33, -4, -4, 35,-32768, - 36, 37, 21,-32768, 38, 48, 48,-32768, 39, 39, - -32768,-32768,-32768,-32768,-32768,-32768,-32768, -15,-32768, -15, - -4, 35,-32768, 41, -25, 36,-32768, 40,-32768, 44, - 34,-32768,-32768, 45,-32768,-32768,-32768, -4, -15,-32768, - 42,-32768, -19, 47,-32768, 49,-32768, 50, 22,-32768, - -32768, 52, 43, 51,-32768, 53,-32768,-32768, 26, 54, - 56, 57, 27, 29,-32768,-32768,-32768,-32768,-32768, 58, - -32768,-32768, 68,-32768,-32768, 59,-32768,-32768,-32768, 79, - 31,-32768, 46,-32768,-32768,-32768,-32768, 89,-32768 + 32, -12, -12, 17, -8, 33, -4, -4, 35, -26, + 36, 37, 21, -26, 38, 48, 48, -26, 39, 39, + -26, -26, -26, -26, -26, -26, -26, -15, -26, -15, + -4, 35, -26, 41, -25, 36, -26, 40, -26, -26, + 44, 34, -26, -26, 45, -26, -26, -26, -4, -15, + -26, 42, -26, -19, 47, -26, 49, -26, 50, 22, + -26, -26, 52, 43, 51, -26, 53, -26, -26, 26, + 54, 56, 57, 27, 29, -26, -26, -26, -26, -26, + 58, -26, -26, 68, -26, -26, 59, -26, -26, -26, + 79, 31, -26, 46, -26, -26, -26, -26 }; -static const short yypgoto[] = +/* YYPGOTO[NTERM-NUM]. */ +static const yysigned_char yypgoto[] = { - -32768, 80,-32768,-32768,-32768, 60,-32768, 62, -7, 55, - 72, 61,-32768,-32768,-32768,-32768, 92,-32768,-32768, 81, - -32768,-32768 + -26, -26, 77, -26, -26, -26, 60, -26, 61, -7, + 55, 72, 62, -26, -26, -26, -26, 91, -26, -26, + 78, -26, -26 }; - -#define YYLAST 113 - - -static const short yytable[] = +/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule which + number is the opposite. If zero, do what YYDEFACT says. + If YYTABLE_NINF, syntax error. */ +#define YYTABLE_NINF -36 +static const yysigned_char yytable[] = { - 29, -34, -34, -34, -34, -34, 52, 53, -34, -34, - 63, 64, 20, 21, 22, 23, 24, 14, 46, 25, - 26, 97, 18, 48, 1, 2, 3, 4, 5, 6, + 29, -35, -35, -35, -35, -35, 53, 54, -35, -35, + 64, 65, 20, 21, 22, 23, 24, 14, 47, 25, + 26, 38, 18, 49, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 1, 2, 3, 4, 5, - 6, 7, 8, 9, 10, 11, 17, -34, -34, -34, - -34, 74, 75, 76, 77, 46, 83, 84, 85, 86, - 93, 94, 40, 19, 30, 34, 57, 37, 95, 39, - 50, 55, 43, 56, 61, 59, 65, 70, 81, 66, - 67, 69, 72, 88, 73, 79, 80, 87, 91, 98, - 90, 45, 38, 49, 16, 54, 0, 42, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, - 0, 0, 0, 68 + 6, 7, 8, 9, 10, 11, 17, -35, -35, -35, + -35, 75, 76, 77, 78, 47, 84, 85, 86, 87, + 94, 95, 41, 19, 30, 34, 58, 37, 96, 40, + 51, 56, 44, 57, 62, 60, 66, 71, 82, 67, + 68, 70, 73, 89, 74, 80, 81, 88, 92, 39, + 91, 46, 50, 16, 43, 55, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 61, 0, 0, 0, 69 }; -static const short yycheck[] = +static const yysigned_char yycheck[] = { 7, 16, 17, 18, 19, 20, 31, 32, 23, 24, 29, 30, 16, 17, 18, 19, 20, 29, 33, 23, @@ -283,232 +575,117 @@ static const short yycheck[] = 28, 25, 26, 27, 28, 33, 29, 30, 29, 30, 29, 30, 14, 30, 29, 29, 32, 30, 22, 31, 29, 31, 33, 29, 32, 30, 29, 34, 21, 30, - 30, 29, 31, 15, 31, 31, 30, 29, 9, 0, - 31, 19, 12, 31, 2, 35, -1, 16, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 47, -1, - -1, -1, -1, 58 + 30, 29, 31, 15, 31, 31, 30, 29, 9, 12, + 31, 19, 31, 2, 16, 35, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 48, -1, -1, -1, 59 }; -/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ -#line 3 "/usr/share/bison-1.35/bison.simple" -/* Skeleton output parser for bison, - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software - Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* As a special exception, when this file is copied by Bison into a - Bison output file, you may use that output file without restriction. - This special exception was added by the Free Software Foundation - in version 1.24 of Bison. */ - -/* This is the parser code that is written into each bison parser when - the %semantic_parser declaration is not specified in the grammar. - It was written by Richard Stallman by simplifying the hairy parser - used when %semantic_parser is specified. */ - -/* All symbols defined below should begin with yy or YY, to avoid - infringing on user name space. This should be done even for local - variables, as they might otherwise be expanded by user macros. - There are some unavoidable exceptions within include files to - define necessary library symbols; they are noted "INFRINGES ON - USER NAME SPACE" below. */ - -#if ! defined (yyoverflow) || defined (YYERROR_VERBOSE) - -/* The parser invokes alloca or malloc; define the necessary symbols. */ - -# if YYSTACK_USE_ALLOCA -# define YYSTACK_ALLOC alloca -# else -# ifndef YYSTACK_USE_ALLOCA -# if defined (alloca) || defined (_ALLOCA_H) -# define YYSTACK_ALLOC alloca -# else -# ifdef __GNUC__ -# define YYSTACK_ALLOC __builtin_alloca -# endif -# endif -# endif -# endif - -# ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) -# else -# if defined (__STDC__) || defined (__cplusplus) -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# endif -# define YYSTACK_ALLOC malloc -# define YYSTACK_FREE free -# endif -#endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */ - - -#if (! defined (yyoverflow) \ - && (! defined (__cplusplus) \ - || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) - -/* A type that is properly aligned for any stack member. */ -union yyalloc +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const unsigned char yystos[] = { - short yyss; - YYSTYPE yyvs; -# if YYLSP_NEEDED - YYLTYPE yyls; -# endif + 0, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 36, 37, 29, 52, 52, 29, 30, 30, + 16, 17, 18, 19, 20, 23, 24, 44, 47, 44, + 29, 42, 43, 38, 29, 40, 41, 30, 0, 37, + 31, 14, 55, 55, 33, 46, 46, 33, 45, 44, + 43, 29, 39, 31, 32, 41, 31, 29, 32, 56, + 30, 47, 32, 54, 29, 30, 29, 30, 30, 45, + 29, 34, 53, 31, 31, 25, 26, 27, 28, 57, + 31, 30, 21, 49, 29, 30, 29, 30, 29, 15, + 48, 31, 9, 50, 29, 30, 22, 51 }; -/* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1) - -/* The size of an array large to enough to hold all stacks, each with - N elements. */ -# if YYLSP_NEEDED -# define YYSTACK_BYTES(N) \ - ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ - + 2 * YYSTACK_GAP_MAX) -# else -# define YYSTACK_BYTES(N) \ - ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ - + YYSTACK_GAP_MAX) -# endif - -/* Copy COUNT objects from FROM to TO. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if 1 < __GNUC__ -# define YYCOPY(To, From, Count) \ - __builtin_memcpy (To, From, (Count) * sizeof (*(From))) -# else -# define YYCOPY(To, From, Count) \ - do \ - { \ - register YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (To)[yyi] = (From)[yyi]; \ - } \ - while (0) -# endif -# endif - -/* Relocate STACK from its old location to the new one. The - local variables YYSIZE and YYSTACKSIZE give the old and new number of - elements in the stack, and YYPTR gives the new location of the - stack. Advance YYPTR to a properly aligned location for the next - stack. */ -# define YYSTACK_RELOCATE(Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ - while (0) - -#endif - - -#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) -# define YYSIZE_T __SIZE_TYPE__ -#endif -#if ! defined (YYSIZE_T) && defined (size_t) -# define YYSIZE_T size_t -#endif -#if ! defined (YYSIZE_T) -# if defined (__STDC__) || defined (__cplusplus) -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# endif -#endif -#if ! defined (YYSIZE_T) -# define YYSIZE_T unsigned int -#endif - #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) -#define YYEMPTY -2 +#define YYEMPTY (-2) #define YYEOF 0 + #define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrlab1 +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ + #define YYFAIL goto yyerrlab + #define YYRECOVERING() (!!yyerrstatus) + #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ { \ yychar = (Token); \ yylval = (Value); \ - yychar1 = YYTRANSLATE (yychar); \ + yytoken = YYTRANSLATE (yychar); \ YYPOPSTACK; \ goto yybackup; \ } \ else \ - { \ - yyerror ("syntax error: cannot back up"); \ + { \ + yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (0) + #define YYTERROR 1 #define YYERRCODE 256 -/* YYLLOC_DEFAULT -- Compute the default location (before the actions - are run). - - When YYLLOC_DEFAULT is run, CURRENT is set the location of the - first token. By default, to implement support for ranges, extend - its range to the last symbol. */ +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) #ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - Current.last_line = Rhs[N].last_line; \ - Current.last_column = Rhs[N].last_column; +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (N) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (0) +#endif + + +/* YY_LOCATION_PRINT -- Print the location on the stream. + This macro was not mandated originally: define only if we know + we won't break user code: when these are the locations we know. */ + +#ifndef YY_LOCATION_PRINT +# if YYLTYPE_IS_TRIVIAL +# define YY_LOCATION_PRINT(File, Loc) \ + fprintf (File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) +# else +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif #endif /* YYLEX -- calling `yylex' with the right arguments. */ -#if YYPURE -# if YYLSP_NEEDED -# ifdef YYLEX_PARAM -# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) -# else -# define YYLEX yylex (&yylval, &yylloc) -# endif -# else /* !YYLSP_NEEDED */ -# ifdef YYLEX_PARAM -# define YYLEX yylex (&yylval, YYLEX_PARAM) -# else -# define YYLEX yylex (&yylval) -# endif -# endif /* !YYLSP_NEEDED */ -#else /* !YYPURE */ -# define YYLEX yylex () -#endif /* !YYPURE */ - +#ifdef YYLEX_PARAM +# define YYLEX yylex (YYLEX_PARAM) +#else +# define YYLEX yylex () +#endif /* Enable debugging if requested. */ #if YYDEBUG @@ -523,13 +700,86 @@ do { \ if (yydebug) \ YYFPRINTF Args; \ } while (0) + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yysymprint (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) +static void +yy_stack_print (short int *bottom, short int *top) +#else +static void +yy_stack_print (bottom, top) + short int *bottom; + short int *top; +#endif +{ + YYFPRINTF (stderr, "Stack now"); + for (/* Nothing. */; bottom <= top; ++bottom) + YYFPRINTF (stderr, " %d", *bottom); + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (0) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) +static void +yy_reduce_print (int yyrule) +#else +static void +yy_reduce_print (yyrule) + int yyrule; +#endif +{ + int yyi; + unsigned long int yylno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ", + yyrule - 1, yylno); + /* Print the symbols being reduced, and their result. */ + for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) + YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); + YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]); +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (Rule); \ +} while (0) + /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ + /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH # define YYINITDEPTH 200 @@ -539,18 +789,16 @@ int yydebug; if the built-in stack extension method is used). Do not make this value too large; the results are undefined if - SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ -#if YYMAXDEPTH == 0 -# undef YYMAXDEPTH -#endif - #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif + -#ifdef YYERROR_VERBOSE + +#if YYERROR_VERBOSE # ifndef yystrlen # if defined (__GLIBC__) && defined (_STRING_H) @@ -565,7 +813,7 @@ yystrlen (yystr) const char *yystr; # endif { - register const char *yys = yystr; + const char *yys = yystr; while (*yys++ != '\0') continue; @@ -590,8 +838,8 @@ yystpcpy (yydest, yysrc) const char *yysrc; # endif { - register char *yyd = yydest; - register const char *yys = yysrc; + char *yyd = yydest; + const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; @@ -600,86 +848,187 @@ yystpcpy (yydest, yysrc) } # endif # endif -#endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + size_t yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +#endif /* YYERROR_VERBOSE */ + -#line 315 "/usr/share/bison-1.35/bison.simple" + +#if YYDEBUG +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) +static void +yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) +#else +static void +yysymprint (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE *yyvaluep; +#endif +{ + /* Pacify ``unused variable'' warnings. */ + (void) yyvaluep; + + if (yytype < YYNTOKENS) + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); -/* The user can define YYPARSE_PARAM as the name of an argument to be passed - into yyparse. The argument should have type void *. - It should actually point to an object. - Grammar actions can access the variable by casting it - to the proper pointer type. */ +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# endif + switch (yytype) + { + default: + break; + } + YYFPRINTF (yyoutput, ")"); +} + +#endif /* ! YYDEBUG */ +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) +#else +static void +yydestruct (yymsg, yytype, yyvaluep) + const char *yymsg; + int yytype; + YYSTYPE *yyvaluep; +#endif +{ + /* Pacify ``unused variable'' warnings. */ + (void) yyvaluep; + + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + switch (yytype) + { + + default: + break; + } +} + + +/* Prevent warnings from -Wmissing-prototypes. */ #ifdef YYPARSE_PARAM # if defined (__STDC__) || defined (__cplusplus) -# define YYPARSE_PARAM_ARG void *YYPARSE_PARAM -# define YYPARSE_PARAM_DECL +int yyparse (void *YYPARSE_PARAM); # else -# define YYPARSE_PARAM_ARG YYPARSE_PARAM -# define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; +int yyparse (); # endif -#else /* !YYPARSE_PARAM */ -# define YYPARSE_PARAM_ARG -# define YYPARSE_PARAM_DECL -#endif /* !YYPARSE_PARAM */ - -/* Prevent warning if -Wstrict-prototypes. */ -#ifdef __GNUC__ -# ifdef YYPARSE_PARAM -int yyparse (void *); -# else +#else /* ! YYPARSE_PARAM */ +#if defined (__STDC__) || defined (__cplusplus) int yyparse (void); -# endif +#else +int yyparse (); #endif +#endif /* ! YYPARSE_PARAM */ -/* YY_DECL_VARIABLES -- depending whether we use a pure parser, - variables are global, or local to YYPARSE. */ -#define YY_DECL_NON_LSP_VARIABLES \ -/* The lookahead symbol. */ \ -int yychar; \ - \ -/* The semantic value of the lookahead symbol. */ \ -YYSTYPE yylval; \ - \ -/* Number of parse errors so far. */ \ + +/* The look-ahead symbol. */ +int yychar; + +/* The semantic value of the look-ahead symbol. */ +YYSTYPE yylval; + +/* Number of syntax errors so far. */ int yynerrs; -#if YYLSP_NEEDED -# define YY_DECL_VARIABLES \ -YY_DECL_NON_LSP_VARIABLES \ - \ -/* Location data for the lookahead symbol. */ \ -YYLTYPE yylloc; -#else -# define YY_DECL_VARIABLES \ -YY_DECL_NON_LSP_VARIABLES -#endif -/* If nonreentrant, generate the variables here. */ - -#if !YYPURE -YY_DECL_VARIABLES -#endif /* !YYPURE */ +/*----------. +| yyparse. | +`----------*/ +#ifdef YYPARSE_PARAM +# if defined (__STDC__) || defined (__cplusplus) +int yyparse (void *YYPARSE_PARAM) +# else +int yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; +# endif +#else /* ! YYPARSE_PARAM */ +#if defined (__STDC__) || defined (__cplusplus) int -yyparse (YYPARSE_PARAM_ARG) - YYPARSE_PARAM_DECL +yyparse (void) +#else +int +yyparse () + ; +#endif +#endif { - /* If reentrant, generate the variables here. */ -#if YYPURE - YY_DECL_VARIABLES -#endif /* !YYPURE */ - - register int yystate; - register int yyn; + + int yystate; + int yyn; int yyresult; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; - /* Lookahead token as an internal (translated) token number. */ - int yychar1 = 0; + /* Look-ahead token as an internal (translated) token number. */ + int yytoken = 0; /* Three stacks and their tools: `yyss': related to states, @@ -689,41 +1038,29 @@ yyparse (YYPARSE_PARAM_ARG) Refer to the stacks thru separate pointers, to allow yyoverflow to reallocate them elsewhere. */ - /* The state stack. */ - short yyssa[YYINITDEPTH]; - short *yyss = yyssa; - register short *yyssp; + /* The state stack. */ + short int yyssa[YYINITDEPTH]; + short int *yyss = yyssa; + short int *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs = yyvsa; - register YYSTYPE *yyvsp; + YYSTYPE *yyvsp; -#if YYLSP_NEEDED - /* The location stack. */ - YYLTYPE yylsa[YYINITDEPTH]; - YYLTYPE *yyls = yylsa; - YYLTYPE *yylsp; -#endif -#if YYLSP_NEEDED -# define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) -#else -# define YYPOPSTACK (yyvsp--, yyssp--) -#endif + +#define YYPOPSTACK (yyvsp--, yyssp--) YYSIZE_T yystacksize = YYINITDEPTH; - /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; -#if YYLSP_NEEDED - YYLTYPE yyloc; -#endif + /* When reducing, the number of symbols on the RHS of the reduced - rule. */ + rule. */ int yylen; YYDPRINTF ((stderr, "Starting parse\n")); @@ -740,9 +1077,7 @@ yyparse (YYPARSE_PARAM_ARG) yyssp = yyss; yyvsp = yyvs; -#if YYLSP_NEEDED - yylsp = yyls; -#endif + goto yysetstate; /*------------------------------------------------------------. @@ -757,7 +1092,7 @@ yyparse (YYPARSE_PARAM_ARG) yysetstate: *yyssp = yystate; - if (yyssp >= yyss + yystacksize - 1) + if (yyss + yystacksize - 1 <= yyssp) { /* Get the current used size of the three stacks, in elements. */ YYSIZE_T yysize = yyssp - yyss + 1; @@ -768,52 +1103,43 @@ yyparse (YYPARSE_PARAM_ARG) these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; - short *yyss1 = yyss; + short int *yyss1 = yyss; + /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. */ -# if YYLSP_NEEDED - YYLTYPE *yyls1 = yyls; - /* This used to be a conditional around just the two extra args, - but that might be undefined if yyoverflow is a macro. */ - yyoverflow ("parser stack overflow", + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), - &yyls1, yysize * sizeof (*yylsp), + &yystacksize); - yyls = yyls1; -# else - yyoverflow ("parser stack overflow", - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); -# endif + yyss = yyss1; yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE - goto yyoverflowlab; + goto yyexhaustedlab; # else /* Extend the stack our own way. */ - if (yystacksize >= YYMAXDEPTH) - goto yyoverflowlab; + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; yystacksize *= 2; - if (yystacksize > YYMAXDEPTH) + if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { - short *yyss1 = yyss; + short int *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) - goto yyoverflowlab; + goto yyexhaustedlab; YYSTACK_RELOCATE (yyss); YYSTACK_RELOCATE (yyvs); -# if YYLSP_NEEDED - YYSTACK_RELOCATE (yyls); -# endif -# undef YYSTACK_RELOCATE + +# undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } @@ -822,14 +1148,12 @@ yyparse (YYPARSE_PARAM_ARG) yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; -#if YYLSP_NEEDED - yylsp = yyls + yysize - 1; -#endif + YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); - if (yyssp >= yyss + yystacksize - 1) + if (yyss + yystacksize - 1 <= yyssp) YYABORT; } @@ -837,101 +1161,67 @@ yyparse (YYPARSE_PARAM_ARG) goto yybackup; - /*-----------. | yybackup. | `-----------*/ yybackup: /* Do appropriate processing given the current state. */ -/* Read a lookahead token if we need one and don't already have one. */ +/* Read a look-ahead token if we need one and don't already have one. */ /* yyresume: */ - /* First try to decide what to do without reference to lookahead token. */ + /* First try to decide what to do without reference to look-ahead token. */ yyn = yypact[yystate]; - if (yyn == YYFLAG) + if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a lookahead token if don't already have one. */ - - /* yychar is either YYEMPTY or YYEOF - or a valid token in external form. */ + /* Not known => get a look-ahead token if don't already have one. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); yychar = YYLEX; } - /* Convert token to internal form (in yychar1) for indexing tables with */ - - if (yychar <= 0) /* This means end of input. */ + if (yychar <= YYEOF) { - yychar1 = 0; - yychar = YYEOF; /* Don't call YYLEX any more */ - + yychar = yytoken = YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } else { - yychar1 = YYTRANSLATE (yychar); - -#if YYDEBUG - /* We have to keep this `#if YYDEBUG', since we use variables - which are defined only if `YYDEBUG' is set. */ - if (yydebug) - { - YYFPRINTF (stderr, "Next token is %d (%s", - yychar, yytname[yychar1]); - /* Give the individual parser a way to print the precise - meaning of a token, for further debugging info. */ -# ifdef YYPRINT - YYPRINT (stderr, yychar, yylval); -# endif - YYFPRINTF (stderr, ")\n"); - } -#endif + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } - yyn += yychar1; - if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; - yyn = yytable[yyn]; - - /* yyn is what to do for this token type in this state. - Negative => reduce, -yyn is rule number. - Positive => shift, yyn is new state. - New state is final state => don't bother to shift, - just return success. - 0, or most negative number => error. */ - - if (yyn < 0) + if (yyn <= 0) { - if (yyn == YYFLAG) + if (yyn == 0 || yyn == YYTABLE_NINF) goto yyerrlab; yyn = -yyn; goto yyreduce; } - else if (yyn == 0) - goto yyerrlab; if (yyn == YYFINAL) YYACCEPT; - /* Shift the lookahead token. */ - YYDPRINTF ((stderr, "Shifting token %d (%s), ", - yychar, yytname[yychar1])); + /* Shift the look-ahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); /* Discard the token being shifted unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; *++yyvsp = yylval; -#if YYLSP_NEEDED - *++yylsp = yylloc; -#endif + /* Count tokens shifted since error; after three, turn off error status. */ @@ -962,257 +1252,270 @@ yyreduce: /* If YYLEN is nonzero, implement the default value of the action: `$$ = $1'. - Otherwise, the following line sets YYVAL to the semantic value of - the lookahead token. This behavior is undocumented and Bison + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; -#if YYLSP_NEEDED - /* Similarly for the default location. Let the user run additional - commands if for instance locations are ranges. */ - yyloc = yylsp[1-yylen]; - YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); -#endif -#if YYDEBUG - /* We have to keep this `#if YYDEBUG', since we use variables which - are defined only if `YYDEBUG' is set. */ - if (yydebug) + YY_REDUCE_PRINT (yyn); + switch (yyn) { - int yyi; - - YYFPRINTF (stderr, "Reducing via rule %d (line %d), ", - yyn, yyrline[yyn]); - - /* Print the symbols being reduced, and their result. */ - for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++) - YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); - YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]); - } -#endif - - switch (yyn) { - -case 3: + case 4: #line 49 "defparse.y" -{ def_name (yyvsp[-1].id, yyvsp[0].number); } + { def_name ((yyvsp[-1].id), (yyvsp[0].number)); } break; -case 4: + + case 5: #line 50 "defparse.y" -{ def_library (yyvsp[-2].id, yyvsp[-1].number); } + { def_library ((yyvsp[-2].id), (yyvsp[-1].number)); } break; -case 6: + + case 7: #line 52 "defparse.y" -{ def_description (yyvsp[0].id);} + { def_description ((yyvsp[0].id));} break; -case 7: + + case 8: #line 53 "defparse.y" -{ def_stacksize (yyvsp[-1].number, yyvsp[0].number);} + { def_stacksize ((yyvsp[-1].number), (yyvsp[0].number));} break; -case 8: + + case 9: #line 54 "defparse.y" -{ def_heapsize (yyvsp[-1].number, yyvsp[0].number);} + { def_heapsize ((yyvsp[-1].number), (yyvsp[0].number));} break; -case 9: + + case 10: #line 55 "defparse.y" -{ def_code (yyvsp[0].number);} + { def_code ((yyvsp[0].number));} break; -case 10: + + case 11: #line 56 "defparse.y" -{ def_data (yyvsp[0].number);} + { def_data ((yyvsp[0].number));} break; -case 13: + + case 14: #line 59 "defparse.y" -{ def_version (yyvsp[0].number,0);} + { def_version ((yyvsp[0].number),0);} break; -case 14: + + case 15: #line 60 "defparse.y" -{ def_version (yyvsp[-2].number,yyvsp[0].number);} + { def_version ((yyvsp[-2].number),(yyvsp[0].number));} break; -case 17: + + case 18: #line 71 "defparse.y" -{ def_exports (yyvsp[-6].id, yyvsp[-5].id, yyvsp[-4].number, yyvsp[-3].number, yyvsp[-2].number, yyvsp[-1].number, yyvsp[0].number);} + { def_exports ((yyvsp[-6].id), (yyvsp[-5].id), (yyvsp[-4].number), (yyvsp[-3].number), (yyvsp[-2].number), (yyvsp[-1].number), (yyvsp[0].number));} break; -case 20: + + case 21: #line 79 "defparse.y" -{ def_import (yyvsp[-6].id,yyvsp[-4].id,yyvsp[-2].id,yyvsp[0].id, 0); } + { def_import ((yyvsp[-6].id),(yyvsp[-4].id),(yyvsp[-2].id),(yyvsp[0].id), 0); } break; -case 21: + + case 22: #line 80 "defparse.y" -{ def_import (yyvsp[-6].id,yyvsp[-4].id,yyvsp[-2].id, 0,yyvsp[0].number); } + { def_import ((yyvsp[-6].id),(yyvsp[-4].id),(yyvsp[-2].id), 0,(yyvsp[0].number)); } break; -case 22: + + case 23: #line 81 "defparse.y" -{ def_import (yyvsp[-4].id,yyvsp[-2].id, 0,yyvsp[0].id, 0); } + { def_import ((yyvsp[-4].id),(yyvsp[-2].id), 0,(yyvsp[0].id), 0); } break; -case 23: + + case 24: #line 82 "defparse.y" -{ def_import (yyvsp[-4].id,yyvsp[-2].id, 0, 0,yyvsp[0].number); } + { def_import ((yyvsp[-4].id),(yyvsp[-2].id), 0, 0,(yyvsp[0].number)); } break; -case 24: + + case 25: #line 83 "defparse.y" -{ def_import ( 0,yyvsp[-4].id,yyvsp[-2].id,yyvsp[0].id, 0); } + { def_import ( 0,(yyvsp[-4].id),(yyvsp[-2].id),(yyvsp[0].id), 0); } break; -case 25: + + case 26: #line 84 "defparse.y" -{ def_import ( 0,yyvsp[-4].id,yyvsp[-2].id, 0,yyvsp[0].number); } + { def_import ( 0,(yyvsp[-4].id),(yyvsp[-2].id), 0,(yyvsp[0].number)); } break; -case 26: + + case 27: #line 85 "defparse.y" -{ def_import ( 0,yyvsp[-2].id, 0,yyvsp[0].id, 0); } + { def_import ( 0,(yyvsp[-2].id), 0,(yyvsp[0].id), 0); } break; -case 27: + + case 28: #line 86 "defparse.y" -{ def_import ( 0,yyvsp[-2].id, 0, 0,yyvsp[0].number); } + { def_import ( 0,(yyvsp[-2].id), 0, 0,(yyvsp[0].number)); } break; -case 30: + + case 31: #line 95 "defparse.y" -{ def_section (yyvsp[-1].id,yyvsp[0].number);} + { def_section ((yyvsp[-1].id),(yyvsp[0].number));} break; -case 35: + + case 36: #line 107 "defparse.y" -{ yyval.number=yyvsp[0].number;} + { (yyval.number)=(yyvsp[0].number);} break; -case 36: + + case 37: #line 108 "defparse.y" -{ yyval.number=-1;} + { (yyval.number)=-1;} break; -case 37: + + case 38: #line 112 "defparse.y" -{ yyval.number = 1; } + { (yyval.number) = 1; } break; -case 38: + + case 39: #line 113 "defparse.y" -{ yyval.number = 2; } + { (yyval.number) = 2; } break; -case 39: + + case 40: #line 114 "defparse.y" -{ yyval.number = 4; } + { (yyval.number) = 4; } break; -case 40: + + case 41: #line 115 "defparse.y" -{ yyval.number = 8; } + { (yyval.number) = 8; } break; -case 41: + + case 42: #line 116 "defparse.y" -{ yyval.number = 0; } + { (yyval.number) = 0; } break; -case 42: + + case 43: #line 117 "defparse.y" -{ yyval.number = 0; } + { (yyval.number) = 0; } break; -case 43: + + case 44: #line 118 "defparse.y" -{ yyval.number = 0; } + { (yyval.number) = 0; } break; -case 44: + + case 45: #line 122 "defparse.y" -{yyval.number=1;} + {(yyval.number)=1;} break; -case 45: + + case 46: #line 123 "defparse.y" -{yyval.number=0;} + {(yyval.number)=0;} break; -case 46: + + case 47: #line 127 "defparse.y" -{yyval.number=1;} + {(yyval.number)=1;} break; -case 47: + + case 48: #line 128 "defparse.y" -{yyval.number=0;} + {(yyval.number)=0;} break; -case 48: + + case 49: #line 132 "defparse.y" -{ yyval.number = 1; } + { (yyval.number) = 1; } break; -case 49: + + case 50: #line 133 "defparse.y" -{ yyval.number = 0; } + { (yyval.number) = 0; } break; -case 50: + + case 51: #line 137 "defparse.y" -{ yyval.number = 1; } + { (yyval.number) = 1; } break; -case 51: + + case 52: #line 138 "defparse.y" -{ yyval.number = 0; } + { (yyval.number) = 0; } break; -case 52: + + case 53: #line 141 "defparse.y" -{ yyval.id =yyvsp[0].id; } + { (yyval.id) =(yyvsp[0].id); } break; -case 53: + + case 54: #line 143 "defparse.y" -{ - char *name = xmalloc (strlen (yyvsp[-2].id) + 1 + strlen (yyvsp[0].id) + 1); - sprintf (name, "%s.%s", yyvsp[-2].id, yyvsp[0].id); - yyval.id = name; + { + char *name = xmalloc (strlen ((yyvsp[-2].id)) + 1 + strlen ((yyvsp[0].id)) + 1); + sprintf (name, "%s.%s", (yyvsp[-2].id), (yyvsp[0].id)); + (yyval.id) = name; } break; -case 54: + + case 55: #line 148 "defparse.y" -{ yyval.id=""; } + { (yyval.id)=""; } break; -case 55: + + case 56: #line 152 "defparse.y" -{ yyval.number=yyvsp[0].number;} + { (yyval.number)=(yyvsp[0].number);} break; -case 56: + + case 57: #line 153 "defparse.y" -{ yyval.number=-1;} + { (yyval.number)=-1;} break; -case 57: + + case 58: #line 157 "defparse.y" -{ yyval.id = yyvsp[0].id; } + { (yyval.id) = (yyvsp[0].id); } break; -case 58: + + case 59: #line 159 "defparse.y" -{ - char *name = xmalloc (strlen (yyvsp[-2].id) + 1 + strlen (yyvsp[0].id) + 1); - sprintf (name, "%s.%s", yyvsp[-2].id, yyvsp[0].id); - yyval.id = name; + { + char *name = xmalloc (strlen ((yyvsp[-2].id)) + 1 + strlen ((yyvsp[0].id)) + 1); + sprintf (name, "%s.%s", (yyvsp[-2].id), (yyvsp[0].id)); + (yyval.id) = name; } break; -case 59: + + case 60: #line 164 "defparse.y" -{ yyval.id = 0; } + { (yyval.id) = 0; } break; -case 60: + + case 61: #line 167 "defparse.y" -{ yyval.number= yyvsp[0].number;} + { (yyval.number)= (yyvsp[0].number);} break; -case 61: + + case 62: #line 168 "defparse.y" -{ yyval.number=-1;} + { (yyval.number)=-1;} break; -} -#line 705 "/usr/share/bison-1.35/bison.simple" + default: break; + } + +/* Line 1126 of yacc.c. */ +#line 1510 "defparse.c" yyvsp -= yylen; yyssp -= yylen; -#if YYLSP_NEEDED - yylsp -= yylen; -#endif -#if YYDEBUG - if (yydebug) - { - short *yyssp1 = yyss - 1; - YYFPRINTF (stderr, "state stack now"); - while (yyssp1 != yyssp) - YYFPRINTF (stderr, " %d", *++yyssp1); - YYFPRINTF (stderr, "\n"); - } -#endif + + YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; -#if YYLSP_NEEDED - *++yylsp = yyloc; -#endif + /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule @@ -1220,11 +1523,11 @@ case 61: yyn = yyr1[yyn]; - yystate = yypgoto[yyn - YYNTBASE] + *yyssp; - if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else - yystate = yydefgoto[yyn - YYNTBASE]; + yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; @@ -1237,155 +1540,193 @@ yyerrlab: if (!yyerrstatus) { ++yynerrs; - -#ifdef YYERROR_VERBOSE +#if YYERROR_VERBOSE yyn = yypact[yystate]; - if (yyn > YYFLAG && yyn < YYLAST) + if (YYPACT_NINF < yyn && yyn < YYLAST) { - YYSIZE_T yysize = 0; - char *yymsg; - int yyx, yycount; + int yytype = YYTRANSLATE (yychar); + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + int yysize_overflow = 0; + char *yymsg = 0; +# define YYERROR_VERBOSE_ARGS_MAXIMUM 5 + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + int yyx; + +#if 0 + /* This is so xgettext sees the translatable formats that are + constructed on the fly. */ + YY_("syntax error, unexpected %s"); + YY_("syntax error, unexpected %s, expecting %s"); + YY_("syntax error, unexpected %s, expecting %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); +#endif + char *yyfmt; + char const *yyf; + static char const yyunexpected[] = "syntax error, unexpected %s"; + static char const yyexpecting[] = ", expecting %s"; + static char const yyor[] = " or %s"; + char yyformat[sizeof yyunexpected + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; + char const *yyprefix = yyexpecting; - yycount = 0; /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. */ - for (yyx = yyn < 0 ? -yyn : 0; - yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) - if (yycheck[yyx + yyn] == yyx) - yysize += yystrlen (yytname[yyx]) + 15, yycount++; - yysize += yystrlen ("parse error, unexpected ") + 1; - yysize += yystrlen (yytname[YYTRANSLATE (yychar)]); - yymsg = (char *) YYSTACK_ALLOC (yysize); - if (yymsg != 0) - { - char *yyp = yystpcpy (yymsg, "parse error, unexpected "); - yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]); + int yyxbegin = yyn < 0 ? -yyn : 0; - if (yycount < 5) + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yycount = 1; + + yyarg[0] = yytname[yytype]; + yyfmt = yystpcpy (yyformat, yyunexpected); + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize_overflow |= yysize1 < yysize; + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; + } + + yyf = YY_(yyformat); + yysize1 = yysize + yystrlen (yyf); + yysize_overflow |= yysize1 < yysize; + yysize = yysize1; + + if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM) + yymsg = (char *) YYSTACK_ALLOC (yysize); + if (yymsg) + { + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + char *yyp = yymsg; + int yyi = 0; + while ((*yyp = *yyf)) { - yycount = 0; - for (yyx = yyn < 0 ? -yyn : 0; - yyx < (int) (sizeof (yytname) / sizeof (char *)); - yyx++) - if (yycheck[yyx + yyn] == yyx) - { - const char *yyq = ! yycount ? ", expecting " : " or "; - yyp = yystpcpy (yyp, yyq); - yyp = yystpcpy (yyp, yytname[yyx]); - yycount++; - } + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } } yyerror (yymsg); YYSTACK_FREE (yymsg); } else - yyerror ("parse error; also virtual memory exhausted"); + { + yyerror (YY_("syntax error")); + goto yyexhaustedlab; + } } else -#endif /* defined (YYERROR_VERBOSE) */ - yyerror ("parse error"); +#endif /* YYERROR_VERBOSE */ + yyerror (YY_("syntax error")); } + + + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse look-ahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", yytoken, &yylval); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse look-ahead token after shifting the error + token. */ goto yyerrlab1; -/*--------------------------------------------------. -| yyerrlab1 -- error raised explicitly by an action | -`--------------------------------------------------*/ +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (0) + goto yyerrorlab; + +yyvsp -= yylen; + yyssp -= yylen; + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ yyerrlab1: - if (yyerrstatus == 3) - { - /* If just tried and failed to reuse lookahead token after an - error, discard it. */ + yyerrstatus = 3; /* Each real token shifted decrements this. */ - /* return failure if at end of input */ - if (yychar == YYEOF) + for (;;) + { + yyn = yypact[yystate]; + if (yyn != YYPACT_NINF) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) YYABORT; - YYDPRINTF ((stderr, "Discarding token %d (%s).\n", - yychar, yytname[yychar1])); - yychar = YYEMPTY; + + + yydestruct ("Error: popping", yystos[yystate], yyvsp); + YYPOPSTACK; + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); } - /* Else will try to reuse lookahead token after shifting the error - token. */ - - yyerrstatus = 3; /* Each real token shifted decrements this */ - - goto yyerrhandle; - - -/*-------------------------------------------------------------------. -| yyerrdefault -- current state does not do anything special for the | -| error token. | -`-------------------------------------------------------------------*/ -yyerrdefault: -#if 0 - /* This is wrong; only states that explicitly want error tokens - should shift them. */ - - /* If its default is to accept any token, ok. Otherwise pop it. */ - yyn = yydefact[yystate]; - if (yyn) - goto yydefault; -#endif - - -/*---------------------------------------------------------------. -| yyerrpop -- pop the current state because it cannot handle the | -| error token | -`---------------------------------------------------------------*/ -yyerrpop: - if (yyssp == yyss) - YYABORT; - yyvsp--; - yystate = *--yyssp; -#if YYLSP_NEEDED - yylsp--; -#endif - -#if YYDEBUG - if (yydebug) - { - short *yyssp1 = yyss - 1; - YYFPRINTF (stderr, "Error: state stack now"); - while (yyssp1 != yyssp) - YYFPRINTF (stderr, " %d", *++yyssp1); - YYFPRINTF (stderr, "\n"); - } -#endif - -/*--------------. -| yyerrhandle. | -`--------------*/ -yyerrhandle: - yyn = yypact[yystate]; - if (yyn == YYFLAG) - goto yyerrdefault; - - yyn += YYTERROR; - if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) - goto yyerrdefault; - - yyn = yytable[yyn]; - if (yyn < 0) - { - if (yyn == YYFLAG) - goto yyerrpop; - yyn = -yyn; - goto yyreduce; - } - else if (yyn == 0) - goto yyerrpop; - if (yyn == YYFINAL) YYACCEPT; - YYDPRINTF ((stderr, "Shifting error token, ")); - *++yyvsp = yylval; -#if YYLSP_NEEDED - *++yylsp = yylloc; -#endif + + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; @@ -1405,19 +1746,32 @@ yyabortlab: yyresult = 1; goto yyreturn; -/*---------------------------------------------. -| yyoverflowab -- parser overflow comes here. | -`---------------------------------------------*/ -yyoverflowlab: - yyerror ("parser stack overflow"); +#ifndef yyoverflow +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (YY_("memory exhausted")); yyresult = 2; /* Fall through. */ +#endif yyreturn: + if (yychar != YYEOF && yychar != YYEMPTY) + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp); + YYPOPSTACK; + } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif return yyresult; } -#line 182 "defparse.y" + + + diff --git a/contrib/binutils/binutils/defparse.h b/contrib/binutils/binutils/defparse.h index 71a82752954..0eea9b9dcf4 100644 --- a/contrib/binutils/binutils/defparse.h +++ b/contrib/binutils/binutils/defparse.h @@ -1,44 +1,111 @@ -#ifndef BISON_Y_TAB_H -# define BISON_Y_TAB_H +/* A Bison parser, made by GNU Bison 2.1. */ -#ifndef YYSTYPE -typedef union { +/* Skeleton parser for Yacc-like parsing with Bison, + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ + +/* As a special exception, when this file is copied by Bison into a + Bison output file, you may use that output file without restriction. + This special exception was added by the Free Software Foundation + in version 1.24 of Bison. */ + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + NAME = 258, + LIBRARY = 259, + DESCRIPTION = 260, + STACKSIZE = 261, + HEAPSIZE = 262, + CODE = 263, + DATA = 264, + SECTIONS = 265, + EXPORTS = 266, + IMPORTS = 267, + VERSIONK = 268, + BASE = 269, + CONSTANT = 270, + READ = 271, + WRITE = 272, + EXECUTE = 273, + SHARED = 274, + NONSHARED = 275, + NONAME = 276, + PRIVATE = 277, + SINGLE = 278, + MULTIPLE = 279, + INITINSTANCE = 280, + INITGLOBAL = 281, + TERMINSTANCE = 282, + TERMGLOBAL = 283, + ID = 284, + NUMBER = 285 + }; +#endif +/* Tokens. */ +#define NAME 258 +#define LIBRARY 259 +#define DESCRIPTION 260 +#define STACKSIZE 261 +#define HEAPSIZE 262 +#define CODE 263 +#define DATA 264 +#define SECTIONS 265 +#define EXPORTS 266 +#define IMPORTS 267 +#define VERSIONK 268 +#define BASE 269 +#define CONSTANT 270 +#define READ 271 +#define WRITE 272 +#define EXECUTE 273 +#define SHARED 274 +#define NONSHARED 275 +#define NONAME 276 +#define PRIVATE 277 +#define SINGLE 278 +#define MULTIPLE 279 +#define INITINSTANCE 280 +#define INITGLOBAL 281 +#define TERMINSTANCE 282 +#define TERMGLOBAL 283 +#define ID 284 +#define NUMBER 285 + + + + +#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) +#line 27 "defparse.y" +typedef union YYSTYPE { char *id; int number; -} yystype; -# define YYSTYPE yystype +} YYSTYPE; +/* Line 1447 of yacc.c. */ +#line 103 "defparse.h" +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 #endif -# define NAME 257 -# define LIBRARY 258 -# define DESCRIPTION 259 -# define STACKSIZE 260 -# define HEAPSIZE 261 -# define CODE 262 -# define DATA 263 -# define SECTIONS 264 -# define EXPORTS 265 -# define IMPORTS 266 -# define VERSIONK 267 -# define BASE 268 -# define CONSTANT 269 -# define READ 270 -# define WRITE 271 -# define EXECUTE 272 -# define SHARED 273 -# define NONSHARED 274 -# define NONAME 275 -# define PRIVATE 276 -# define SINGLE 277 -# define MULTIPLE 278 -# define INITINSTANCE 279 -# define INITGLOBAL 280 -# define TERMINSTANCE 281 -# define TERMGLOBAL 282 -# define ID 283 -# define NUMBER 284 - extern YYSTYPE yylval; -#endif /* not BISON_Y_TAB_H */ + + diff --git a/contrib/binutils/binutils/defparse.y b/contrib/binutils/binutils/defparse.y index b58aaee7146..81b4c61ce90 100644 --- a/contrib/binutils/binutils/defparse.y +++ b/contrib/binutils/binutils/defparse.y @@ -1,6 +1,6 @@ %{ /* defparse.y - parser for .def files */ -/* Copyright 1995, 1997, 1998, 1999, 2004 +/* Copyright 1995, 1997, 1998, 1999, 2001, 2004 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "bucomm.h" @@ -29,8 +29,8 @@ int number; }; -%token NAME, LIBRARY, DESCRIPTION, STACKSIZE, HEAPSIZE, CODE, DATA -%token SECTIONS, EXPORTS, IMPORTS, VERSIONK, BASE, CONSTANT +%token NAME LIBRARY DESCRIPTION STACKSIZE HEAPSIZE CODE DATA +%token SECTIONS EXPORTS IMPORTS VERSIONK BASE CONSTANT %token READ WRITE EXECUTE SHARED NONSHARED NONAME PRIVATE %token SINGLE MULTIPLE INITINSTANCE INITGLOBAL TERMINSTANCE TERMGLOBAL %token ID diff --git a/contrib/binutils/binutils/dep-in.sed b/contrib/binutils/binutils/dep-in.sed index aeb22a1acc7..c30c39693ff 100644 --- a/contrib/binutils/binutils/dep-in.sed +++ b/contrib/binutils/binutils/dep-in.sed @@ -2,6 +2,7 @@ /\\$/N /\\$/b loop +s! \./! !g s!@INCDIR@!$(INCDIR)!g s!@TOPDIR@/include!$(INCDIR)!g s!@BFDDIR@!$(BFDDIR)!g diff --git a/contrib/binutils/binutils/dlltool.c b/contrib/binutils/binutils/dlltool.c index 5f921ae0954..6c231f69a44 100644 --- a/contrib/binutils/binutils/dlltool.c +++ b/contrib/binutils/binutils/dlltool.c @@ -1,6 +1,6 @@ /* dlltool.c -- tool to generate stuff for PE style DLLs - Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 - Free Software Foundation, Inc. + Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, + 2005, 2006 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -16,8 +16,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ /* This program allows you to build the files necessary to create @@ -57,7 +57,7 @@ IMPORTS ( ( = . ) | ( [ = ] . )) * - Declares that or the exported function whoes ordinal number + Declares that or the exported function whose ordinal number is is to be imported from the file . If is specified then this is the name that the imported function will be refereed to in the body of the DLL. @@ -254,12 +254,8 @@ #include #include - -#ifdef ANSI_PROTOTYPES #include -#else -#include -#endif +#include #ifdef DLLTOOL_ARM #include "coff/arm.h" @@ -358,6 +354,7 @@ static char *dll_name; static int add_indirect = 0; static int add_underscore = 0; +static int add_stdcall_underscore = 0; static int dontdeltemps = 0; /* TRUE if we should export all symbols. Otherwise, we only export @@ -382,6 +379,7 @@ extern char * program_name; static int machine; static int killat; static int add_stdcall_alias; +static const char *ext_prefix_alias; static int verbose; static FILE *output_def; static FILE *base_file; @@ -427,7 +425,11 @@ static char * mcore_elf_linker_flags = NULL; #define DRECTVE_SECTION_NAME ".drectve" #endif -#define PATHMAX 250 /* What's the right name for this ? */ +/* What's the right name for this ? */ +#define PATHMAX 250 + +/* External name alias numbering starts here. */ +#define PREFIX_ALIAS_BASE 20000 char *tmp_asm_buf; char *tmp_head_s_buf; @@ -641,6 +643,7 @@ typedef struct export { const char *name; const char *internal_name; + const char *import_name; int ordinal; int constant; int noname; /* Don't put name in image file. */ @@ -664,7 +667,7 @@ static struct string_list *excludes; static const char *rvaafter (int); static const char *rvabefore (int); -static const char *asm_prefix (int); +static const char *asm_prefix (int, const char *); static void process_def_file (const char *); static void new_directive (char *); static void append_import (const char *, const char *, int); @@ -686,9 +689,6 @@ static void generate_idata_ofile (FILE *); static void assemble_file (const char *, const char *); static void gen_exp_file (void); static const char *xlate (const char *); -#if 0 -static void dump_iat (FILE *, export_type *); -#endif static char *make_label (const char *, const char *); static char *make_imp_label (const char *, const char *); static bfd *make_one_lib_file (export_type *, int); @@ -698,13 +698,12 @@ static void gen_lib_file (void); static int pfunc (const void *, const void *); static int nfunc (const void *, const void *); static void remove_null_names (export_type **); -static void dtab (export_type **); static void process_duplicates (export_type **); static void fill_ordinals (export_type **); -static int alphafunc (const void *, const void *); static void mangle_defs (void); static void usage (FILE *, int); -static void inform (const char *, ...); +static void inform (const char *, ...) ATTRIBUTE_PRINTF_1; +static void set_dll_name_from_def (const char *); static char * prefix_encode (char *start, unsigned code) @@ -795,7 +794,7 @@ rvabefore (int machine) } static const char * -asm_prefix (int machine) +asm_prefix (int machine, const char *name) { switch (machine) { @@ -810,7 +809,11 @@ asm_prefix (int machine) case MARM_EPOC: break; case M386: - return "_"; + /* Symbol names starting with ? do not have a leading underscore. */ + if (name && *name == '?') + break; + else + return "_"; default: /* xgettext:c-format */ fatal (_("Internal error: Unknown machine type: %d"), machine); @@ -819,26 +822,26 @@ asm_prefix (int machine) return ""; } -#define ASM_BYTE mtable[machine].how_byte -#define ASM_SHORT mtable[machine].how_short -#define ASM_LONG mtable[machine].how_long -#define ASM_TEXT mtable[machine].how_asciz -#define ASM_C mtable[machine].how_comment -#define ASM_JUMP mtable[machine].how_jump -#define ASM_GLOBAL mtable[machine].how_global -#define ASM_SPACE mtable[machine].how_space -#define ASM_ALIGN_SHORT mtable[machine].how_align_short -#define ASM_RVA_BEFORE rvabefore(machine) -#define ASM_RVA_AFTER rvaafter(machine) -#define ASM_PREFIX asm_prefix(machine) -#define ASM_ALIGN_LONG mtable[machine].how_align_long -#define HOW_BFD_READ_TARGET 0 /* always default*/ -#define HOW_BFD_WRITE_TARGET mtable[machine].how_bfd_target -#define HOW_BFD_ARCH mtable[machine].how_bfd_arch -#define HOW_JTAB mtable[machine].how_jtab -#define HOW_JTAB_SIZE mtable[machine].how_jtab_size -#define HOW_JTAB_ROFF mtable[machine].how_jtab_roff -#define ASM_SWITCHES mtable[machine].how_default_as_switches +#define ASM_BYTE mtable[machine].how_byte +#define ASM_SHORT mtable[machine].how_short +#define ASM_LONG mtable[machine].how_long +#define ASM_TEXT mtable[machine].how_asciz +#define ASM_C mtable[machine].how_comment +#define ASM_JUMP mtable[machine].how_jump +#define ASM_GLOBAL mtable[machine].how_global +#define ASM_SPACE mtable[machine].how_space +#define ASM_ALIGN_SHORT mtable[machine].how_align_short +#define ASM_RVA_BEFORE rvabefore (machine) +#define ASM_RVA_AFTER rvaafter (machine) +#define ASM_PREFIX(NAME) asm_prefix (machine, (NAME)) +#define ASM_ALIGN_LONG mtable[machine].how_align_long +#define HOW_BFD_READ_TARGET 0 /* Always default. */ +#define HOW_BFD_WRITE_TARGET mtable[machine].how_bfd_target +#define HOW_BFD_ARCH mtable[machine].how_bfd_arch +#define HOW_JTAB mtable[machine].how_jtab +#define HOW_JTAB_SIZE mtable[machine].how_jtab_size +#define HOW_JTAB_ROFF mtable[machine].how_jtab_roff +#define ASM_SWITCHES mtable[machine].how_default_as_switches static char **oav; @@ -865,7 +868,6 @@ process_def_file (const char *name) /* Communications with the parser. */ -static const char *d_name; /* Arg to NAME or LIBRARY. */ static int d_nfuncs; /* Number of functions exported. */ static int d_named_nfuncs; /* Number of named functions exported. */ static int d_low_ord; /* Lowest ordinal index. */ @@ -896,6 +898,7 @@ def_exports (const char *name, const char *internal_name, int ordinal, p->name = name; p->internal_name = internal_name ? internal_name : name; + p->import_name = name; p->ordinal = ordinal; p->constant = constant; p->noname = noname; @@ -912,6 +915,16 @@ def_exports (const char *name, const char *internal_name, int ordinal, p->forward = 0; /* no forward */ } +static void +set_dll_name_from_def (const char * name) +{ + const char* image_basename = lbasename (name); + if (image_basename != name) + non_fatal (_("%s: Path components stripped from image name, '%s'."), + def_file, name); + dll_name = xstrdup (image_basename); +} + void def_name (const char *name, int base) { @@ -921,11 +934,10 @@ def_name (const char *name, int base) if (d_is_dll) non_fatal (_("Can't have LIBRARY and NAME")); - d_name = name; /* If --dllname not provided, use the one in the DEF file. FIXME: Is this appropriate for executables? */ if (! dll_name) - dll_name = xstrdup (name); + set_dll_name_from_def (name); d_is_exe = 1; } @@ -938,10 +950,9 @@ def_library (const char *name, int base) if (d_is_exe) non_fatal (_("Can't have LIBRARY and NAME")); - d_name = name; /* If --dllname not provided, use the one in the DEF file. */ if (! dll_name) - dll_name = xstrdup (name); + set_dll_name_from_def (name); d_is_dll = 1; } @@ -1206,7 +1217,7 @@ scan_drectve_symbols (bfd *abfd) if (s == NULL) return; - size = bfd_get_section_size_before_reloc (s); + size = bfd_get_section_size (s); buf = xmalloc (size); bfd_get_section_contents (abfd, s, buf, 0, size); @@ -1794,14 +1805,6 @@ gen_exp_file (void) { if (exp->ordinal != i) { -#if 0 - fprintf (f, "\t%s\t%d\t%s %d..%d missing\n", - ASM_SPACE, - (exp->ordinal - i) * 4, - ASM_C, - i, exp->ordinal - 1); - i = exp->ordinal; -#endif while (i < exp->ordinal) { fprintf(f,"\t%s\t0\n", ASM_LONG); @@ -1816,7 +1819,7 @@ gen_exp_file (void) exp->internal_name, ASM_RVA_AFTER, ASM_C, exp->ordinal); else fprintf (f, "\t%s%s%s%s\t%s %d\n", ASM_RVA_BEFORE, - ASM_PREFIX, + ASM_PREFIX (exp->internal_name), exp->internal_name, ASM_RVA_AFTER, ASM_C, exp->ordinal); } else @@ -1992,7 +1995,9 @@ xlate (const char *name) { int lead_at = (*name == '@'); - if (add_underscore && !lead_at) + if (!lead_at && (add_underscore + || (add_stdcall_underscore + && strchr (name, '@')))) { char *copy = xmalloc (strlen (name) + 2); @@ -2013,29 +2018,6 @@ xlate (const char *name) return name; } -/**********************************************************************/ - -#if 0 - -static void -dump_iat (FILE *f, export_type *exp) -{ - if (exp->noname && !show_allnames ) - { - fprintf (f, "\t%s\t0x%08x\n", - ASM_LONG, - exp->ordinal | 0x80000000); /* hint or orindal ?? */ - } - else - { - fprintf (f, "\t%sID%d%s\n", ASM_RVA_BEFORE, - exp->ordinal, - ASM_RVA_AFTER); - } -} - -#endif - typedef struct { int id; @@ -2150,10 +2132,10 @@ ID2: .short 2 static char * make_label (const char *prefix, const char *name) { - int len = strlen (ASM_PREFIX) + strlen (prefix) + strlen (name); - char *copy = xmalloc (len +1 ); + int len = strlen (ASM_PREFIX (name)) + strlen (prefix) + strlen (name); + char *copy = xmalloc (len + 1); - strcpy (copy, ASM_PREFIX); + strcpy (copy, ASM_PREFIX (name)); strcat (copy, prefix); strcat (copy, name); return copy; @@ -2174,10 +2156,10 @@ make_imp_label (const char *prefix, const char *name) } else { - len = strlen (ASM_PREFIX) + strlen (prefix) + strlen (name); + len = strlen (ASM_PREFIX (name)) + strlen (prefix) + strlen (name); copy = xmalloc (len + 1); strcpy (copy, prefix); - strcat (copy, ASM_PREFIX); + strcat (copy, ASM_PREFIX (name)); strcat (copy, name); } return copy; @@ -2186,466 +2168,409 @@ make_imp_label (const char *prefix, const char *name) static bfd * make_one_lib_file (export_type *exp, int i) { -#if 0 - { - char *name; - FILE *f; - const char *prefix = "d"; - char *dest; - - name = (char *) alloca (strlen (prefix) + 10); - sprintf (name, "%ss%05d.s", prefix, i); - f = fopen (name, FOPEN_WT); - fprintf (f, "\t.text\n"); - fprintf (f, "\t%s\t%s%s\n", ASM_GLOBAL, ASM_PREFIX, exp->name); - if (create_compat_implib) - fprintf (f, "\t%s\t__imp_%s\n", ASM_GLOBAL, exp->name); - fprintf (f, "\t%s\t_imp__%s\n", ASM_GLOBAL, exp->name); - if (create_compat_implib) - fprintf (f, "%s%s:\n\t%s\t__imp_%s\n", ASM_PREFIX, - exp->name, ASM_JUMP, exp->name); - - fprintf (f, "\t.section\t.idata$7\t%s To force loading of head\n", ASM_C); - fprintf (f, "\t%s\t%s\n", ASM_LONG, head_label); - - - fprintf (f,"%s Import Address Table\n", ASM_C); - - fprintf (f, "\t.section .idata$5\n"); - if (create_compat_implib) - fprintf (f, "__imp_%s:\n", exp->name); - fprintf (f, "_imp__%s:\n", exp->name); - - dump_iat (f, exp); - - fprintf (f, "\n%s Import Lookup Table\n", ASM_C); - fprintf (f, "\t.section .idata$4\n"); - - dump_iat (f, exp); - - if(!exp->noname || show_allnames) - { - fprintf (f, "%s Hint/Name table\n", ASM_C); - fprintf (f, "\t.section .idata$6\n"); - fprintf (f, "ID%d:\t%s\t%d\n", exp->ordinal, ASM_SHORT, exp->hint); - fprintf (f, "\t%s\t\"%s\"\n", ASM_TEXT, xlate (exp->name)); - } - - fclose (f); - - dest = (char *) alloca (strlen (prefix) + 10); - sprintf (dest, "%ss%05d.o", prefix, i); - assemble_file (name, dest); - } -#else /* if 0 */ - { - bfd * abfd; - asymbol * exp_label; - asymbol * iname = 0; - asymbol * iname2; - asymbol * iname_lab; - asymbol ** iname_lab_pp; - asymbol ** iname_pp; + bfd * abfd; + asymbol * exp_label; + asymbol * iname = 0; + asymbol * iname2; + asymbol * iname_lab; + asymbol ** iname_lab_pp; + asymbol ** iname_pp; #ifdef DLLTOOL_PPC - asymbol ** fn_pp; - asymbol ** toc_pp; + asymbol ** fn_pp; + asymbol ** toc_pp; #define EXTRA 2 #endif #ifndef EXTRA #define EXTRA 0 #endif - asymbol * ptrs[NSECS + 4 + EXTRA + 1]; - flagword applicable; - - char * outname = xmalloc (strlen (TMP_STUB) + 10); - int oidx = 0; + asymbol * ptrs[NSECS + 4 + EXTRA + 1]; + flagword applicable; + char * outname = xmalloc (strlen (TMP_STUB) + 10); + int oidx = 0; - sprintf (outname, "%s%05d.o", TMP_STUB, i); + sprintf (outname, "%s%05d.o", TMP_STUB, i); - abfd = bfd_openw (outname, HOW_BFD_WRITE_TARGET); + abfd = bfd_openw (outname, HOW_BFD_WRITE_TARGET); - if (!abfd) - /* xgettext:c-format */ - fatal (_("bfd_open failed open stub file: %s"), outname); + if (!abfd) + /* xgettext:c-format */ + fatal (_("bfd_open failed open stub file: %s"), outname); - /* xgettext:c-format */ - inform (_("Creating stub file: %s"), outname); + /* xgettext:c-format */ + inform (_("Creating stub file: %s"), outname); - bfd_set_format (abfd, bfd_object); - bfd_set_arch_mach (abfd, HOW_BFD_ARCH, 0); + bfd_set_format (abfd, bfd_object); + bfd_set_arch_mach (abfd, HOW_BFD_ARCH, 0); #ifdef DLLTOOL_ARM - if (machine == MARM_INTERWORK || machine == MTHUMB) - bfd_set_private_flags (abfd, F_INTERWORK); + if (machine == MARM_INTERWORK || machine == MTHUMB) + bfd_set_private_flags (abfd, F_INTERWORK); #endif - applicable = bfd_applicable_section_flags (abfd); + applicable = bfd_applicable_section_flags (abfd); - /* First make symbols for the sections. */ - for (i = 0; i < NSECS; i++) - { - sinfo *si = secdata + i; - if (si->id != i) - abort(); - si->sec = bfd_make_section_old_way (abfd, si->name); - bfd_set_section_flags (abfd, - si->sec, - si->flags & applicable); + /* First make symbols for the sections. */ + for (i = 0; i < NSECS; i++) + { + sinfo *si = secdata + i; - bfd_set_section_alignment(abfd, si->sec, si->align); - si->sec->output_section = si->sec; - si->sym = bfd_make_empty_symbol(abfd); - si->sym->name = si->sec->name; - si->sym->section = si->sec; - si->sym->flags = BSF_LOCAL; - si->sym->value = 0; - ptrs[oidx] = si->sym; - si->sympp = ptrs + oidx; - si->size = 0; - si->data = NULL; + if (si->id != i) + abort(); + si->sec = bfd_make_section_old_way (abfd, si->name); + bfd_set_section_flags (abfd, + si->sec, + si->flags & applicable); - oidx++; - } + bfd_set_section_alignment(abfd, si->sec, si->align); + si->sec->output_section = si->sec; + si->sym = bfd_make_empty_symbol(abfd); + si->sym->name = si->sec->name; + si->sym->section = si->sec; + si->sym->flags = BSF_LOCAL; + si->sym->value = 0; + ptrs[oidx] = si->sym; + si->sympp = ptrs + oidx; + si->size = 0; + si->data = NULL; - if (! exp->data) - { - exp_label = bfd_make_empty_symbol (abfd); - exp_label->name = make_imp_label ("", exp->name); + oidx++; + } - /* On PowerPC, the function name points to a descriptor in - the rdata section, the first element of which is a - pointer to the code (..function_name), and the second - points to the .toc. */ + if (! exp->data) + { + exp_label = bfd_make_empty_symbol (abfd); + exp_label->name = make_imp_label ("", exp->name); + + /* On PowerPC, the function name points to a descriptor in + the rdata section, the first element of which is a + pointer to the code (..function_name), and the second + points to the .toc. */ #ifdef DLLTOOL_PPC - if (machine == MPPC) - exp_label->section = secdata[RDATA].sec; - else + if (machine == MPPC) + exp_label->section = secdata[RDATA].sec; + else #endif - exp_label->section = secdata[TEXT].sec; + exp_label->section = secdata[TEXT].sec; - exp_label->flags = BSF_GLOBAL; - exp_label->value = 0; + exp_label->flags = BSF_GLOBAL; + exp_label->value = 0; #ifdef DLLTOOL_ARM - if (machine == MTHUMB) - bfd_coff_set_symbol_class (abfd, exp_label, C_THUMBEXTFUNC); + if (machine == MTHUMB) + bfd_coff_set_symbol_class (abfd, exp_label, C_THUMBEXTFUNC); #endif - ptrs[oidx++] = exp_label; - } + ptrs[oidx++] = exp_label; + } - /* Generate imp symbols with one underscore for Microsoft - compatibility, and with two underscores for backward - compatibility with old versions of cygwin. */ - if (create_compat_implib) - { - iname = bfd_make_empty_symbol (abfd); - iname->name = make_imp_label ("___imp", exp->name); - iname->section = secdata[IDATA5].sec; - iname->flags = BSF_GLOBAL; - iname->value = 0; - } + /* Generate imp symbols with one underscore for Microsoft + compatibility, and with two underscores for backward + compatibility with old versions of cygwin. */ + if (create_compat_implib) + { + iname = bfd_make_empty_symbol (abfd); + iname->name = make_imp_label ("___imp", exp->name); + iname->section = secdata[IDATA5].sec; + iname->flags = BSF_GLOBAL; + iname->value = 0; + } - iname2 = bfd_make_empty_symbol (abfd); - iname2->name = make_imp_label ("__imp_", exp->name); - iname2->section = secdata[IDATA5].sec; - iname2->flags = BSF_GLOBAL; - iname2->value = 0; + iname2 = bfd_make_empty_symbol (abfd); + iname2->name = make_imp_label ("__imp_", exp->name); + iname2->section = secdata[IDATA5].sec; + iname2->flags = BSF_GLOBAL; + iname2->value = 0; - iname_lab = bfd_make_empty_symbol(abfd); + iname_lab = bfd_make_empty_symbol (abfd); - iname_lab->name = head_label; - iname_lab->section = (asection *)&bfd_und_section; - iname_lab->flags = 0; - iname_lab->value = 0; + iname_lab->name = head_label; + iname_lab->section = (asection *) &bfd_und_section; + iname_lab->flags = 0; + iname_lab->value = 0; - iname_pp = ptrs + oidx; - if (create_compat_implib) - ptrs[oidx++] = iname; - ptrs[oidx++] = iname2; + iname_pp = ptrs + oidx; + if (create_compat_implib) + ptrs[oidx++] = iname; + ptrs[oidx++] = iname2; - iname_lab_pp = ptrs + oidx; - ptrs[oidx++] = iname_lab; + iname_lab_pp = ptrs + oidx; + ptrs[oidx++] = iname_lab; #ifdef DLLTOOL_PPC - /* The symbol referring to the code (.text). */ - { - asymbol *function_name; + /* The symbol referring to the code (.text). */ + { + asymbol *function_name; - function_name = bfd_make_empty_symbol(abfd); - function_name->name = make_label ("..", exp->name); - function_name->section = secdata[TEXT].sec; - function_name->flags = BSF_GLOBAL; - function_name->value = 0; + function_name = bfd_make_empty_symbol(abfd); + function_name->name = make_label ("..", exp->name); + function_name->section = secdata[TEXT].sec; + function_name->flags = BSF_GLOBAL; + function_name->value = 0; - fn_pp = ptrs + oidx; - ptrs[oidx++] = function_name; - } + fn_pp = ptrs + oidx; + ptrs[oidx++] = function_name; + } - /* The .toc symbol. */ - { - asymbol *toc_symbol; + /* The .toc symbol. */ + { + asymbol *toc_symbol; - toc_symbol = bfd_make_empty_symbol (abfd); - toc_symbol->name = make_label (".", "toc"); - toc_symbol->section = (asection *)&bfd_und_section; - toc_symbol->flags = BSF_GLOBAL; - toc_symbol->value = 0; + toc_symbol = bfd_make_empty_symbol (abfd); + toc_symbol->name = make_label (".", "toc"); + toc_symbol->section = (asection *)&bfd_und_section; + toc_symbol->flags = BSF_GLOBAL; + toc_symbol->value = 0; - toc_pp = ptrs + oidx; - ptrs[oidx++] = toc_symbol; - } + toc_pp = ptrs + oidx; + ptrs[oidx++] = toc_symbol; + } #endif - ptrs[oidx] = 0; + ptrs[oidx] = 0; - for (i = 0; i < NSECS; i++) + for (i = 0; i < NSECS; i++) + { + sinfo *si = secdata + i; + asection *sec = si->sec; + arelent *rel; + arelent **rpp; + + switch (i) { - sinfo *si = secdata + i; - asection *sec = si->sec; - arelent *rel; - arelent **rpp; - - switch (i) + case TEXT: + if (! exp->data) { - case TEXT: - if (! exp->data) + si->size = HOW_JTAB_SIZE; + si->data = xmalloc (HOW_JTAB_SIZE); + memcpy (si->data, HOW_JTAB, HOW_JTAB_SIZE); + + /* add the reloc into idata$5 */ + rel = xmalloc (sizeof (arelent)); + + rpp = xmalloc (sizeof (arelent *) * 2); + rpp[0] = rel; + rpp[1] = 0; + + rel->address = HOW_JTAB_ROFF; + rel->addend = 0; + + if (machine == MPPC) { - si->size = HOW_JTAB_SIZE; - si->data = xmalloc (HOW_JTAB_SIZE); - memcpy (si->data, HOW_JTAB, HOW_JTAB_SIZE); - - /* add the reloc into idata$5 */ - rel = xmalloc (sizeof (arelent)); - - rpp = xmalloc (sizeof (arelent *) * 2); - rpp[0] = rel; - rpp[1] = 0; - - rel->address = HOW_JTAB_ROFF; - rel->addend = 0; - - if (machine == MPPC) - { - rel->howto = bfd_reloc_type_lookup (abfd, - BFD_RELOC_16_GOTOFF); - rel->sym_ptr_ptr = iname_pp; - } - else - { - rel->howto = bfd_reloc_type_lookup (abfd, BFD_RELOC_32); - rel->sym_ptr_ptr = secdata[IDATA5].sympp; - } - sec->orelocation = rpp; - sec->reloc_count = 1; - } - break; - case IDATA4: - case IDATA5: - /* An idata$4 or idata$5 is one word long, and has an - rva to idata$6. */ - - si->data = xmalloc (4); - si->size = 4; - - if (exp->noname) - { - si->data[0] = exp->ordinal ; - si->data[1] = exp->ordinal >> 8; - si->data[2] = exp->ordinal >> 16; - si->data[3] = 0x80; + rel->howto = bfd_reloc_type_lookup (abfd, + BFD_RELOC_16_GOTOFF); + rel->sym_ptr_ptr = iname_pp; } else { - sec->reloc_count = 1; - memset (si->data, 0, si->size); - rel = xmalloc (sizeof (arelent)); - rpp = xmalloc (sizeof (arelent *) * 2); - rpp[0] = rel; - rpp[1] = 0; - rel->address = 0; - rel->addend = 0; - rel->howto = bfd_reloc_type_lookup (abfd, BFD_RELOC_RVA); - rel->sym_ptr_ptr = secdata[IDATA6].sympp; - sec->orelocation = rpp; + rel->howto = bfd_reloc_type_lookup (abfd, BFD_RELOC_32); + rel->sym_ptr_ptr = secdata[IDATA5].sympp; } + sec->orelocation = rpp; + sec->reloc_count = 1; + } + break; + case IDATA4: + case IDATA5: + /* An idata$4 or idata$5 is one word long, and has an + rva to idata$6. */ - break; + si->data = xmalloc (4); + si->size = 4; - case IDATA6: - if (!exp->noname) - { - /* This used to add 1 to exp->hint. I don't know - why it did that, and it does not match what I see - in programs compiled with the MS tools. */ - int idx = exp->hint; - si->size = strlen (xlate (exp->name)) + 3; - si->data = xmalloc (si->size); - si->data[0] = idx & 0xff; - si->data[1] = idx >> 8; - strcpy (si->data + 2, xlate (exp->name)); - } - break; - case IDATA7: - si->size = 4; - si->data =xmalloc (4); + if (exp->noname) + { + si->data[0] = exp->ordinal ; + si->data[1] = exp->ordinal >> 8; + si->data[2] = exp->ordinal >> 16; + si->data[3] = 0x80; + } + else + { + sec->reloc_count = 1; memset (si->data, 0, si->size); rel = xmalloc (sizeof (arelent)); rpp = xmalloc (sizeof (arelent *) * 2); rpp[0] = rel; + rpp[1] = 0; rel->address = 0; rel->addend = 0; rel->howto = bfd_reloc_type_lookup (abfd, BFD_RELOC_RVA); - rel->sym_ptr_ptr = iname_lab_pp; + rel->sym_ptr_ptr = secdata[IDATA6].sympp; sec->orelocation = rpp; - sec->reloc_count = 1; - break; + } + + break; + + case IDATA6: + if (!exp->noname) + { + /* This used to add 1 to exp->hint. I don't know + why it did that, and it does not match what I see + in programs compiled with the MS tools. */ + int idx = exp->hint; + si->size = strlen (xlate (exp->import_name)) + 3; + si->data = xmalloc (si->size); + si->data[0] = idx & 0xff; + si->data[1] = idx >> 8; + strcpy ((char *) si->data + 2, xlate (exp->import_name)); + } + break; + case IDATA7: + si->size = 4; + si->data = xmalloc (4); + memset (si->data, 0, si->size); + rel = xmalloc (sizeof (arelent)); + rpp = xmalloc (sizeof (arelent *) * 2); + rpp[0] = rel; + rel->address = 0; + rel->addend = 0; + rel->howto = bfd_reloc_type_lookup (abfd, BFD_RELOC_RVA); + rel->sym_ptr_ptr = iname_lab_pp; + sec->orelocation = rpp; + sec->reloc_count = 1; + break; #ifdef DLLTOOL_PPC - case PDATA: - { - /* The .pdata section is 5 words long. - Think of it as: - struct - { - bfd_vma BeginAddress, [0x00] - EndAddress, [0x04] - ExceptionHandler, [0x08] - HandlerData, [0x0c] - PrologEndAddress; [0x10] - }; */ - - /* So this pdata section setups up this as a glue linkage to - a dll routine. There are a number of house keeping things - we need to do: - - 1. In the name of glue trickery, the ADDR32 relocs for 0, - 4, and 0x10 are set to point to the same place: - "..function_name". - 2. There is one more reloc needed in the pdata section. - The actual glue instruction to restore the toc on - return is saved as the offset in an IMGLUE reloc. - So we need a total of four relocs for this section. - - 3. Lastly, the HandlerData field is set to 0x03, to indicate - that this is a glue routine. */ - arelent *imglue, *ba_rel, *ea_rel, *pea_rel; - - /* Alignment must be set to 2**2 or you get extra stuff. */ - bfd_set_section_alignment(abfd, sec, 2); - - si->size = 4 * 5; - si->data = xmalloc (si->size); - memset (si->data, 0, si->size); - rpp = xmalloc (sizeof (arelent *) * 5); - rpp[0] = imglue = xmalloc (sizeof (arelent)); - rpp[1] = ba_rel = xmalloc (sizeof (arelent)); - rpp[2] = ea_rel = xmalloc (sizeof (arelent)); - rpp[3] = pea_rel = xmalloc (sizeof (arelent)); - rpp[4] = 0; - - /* Stick the toc reload instruction in the glue reloc. */ - bfd_put_32(abfd, ppc_glue_insn, (char *) &imglue->address); - - imglue->addend = 0; - imglue->howto = bfd_reloc_type_lookup (abfd, - BFD_RELOC_32_GOTOFF); - imglue->sym_ptr_ptr = fn_pp; - - ba_rel->address = 0; - ba_rel->addend = 0; - ba_rel->howto = bfd_reloc_type_lookup (abfd, BFD_RELOC_32); - ba_rel->sym_ptr_ptr = fn_pp; - - bfd_put_32 (abfd, 0x18, si->data + 0x04); - ea_rel->address = 4; - ea_rel->addend = 0; - ea_rel->howto = bfd_reloc_type_lookup (abfd, BFD_RELOC_32); - ea_rel->sym_ptr_ptr = fn_pp; - - /* Mark it as glue. */ - bfd_put_32 (abfd, 0x03, si->data + 0x0c); - - /* Mark the prolog end address. */ - bfd_put_32 (abfd, 0x0D, si->data + 0x10); - pea_rel->address = 0x10; - pea_rel->addend = 0; - pea_rel->howto = bfd_reloc_type_lookup (abfd, BFD_RELOC_32); - pea_rel->sym_ptr_ptr = fn_pp; - - sec->orelocation = rpp; - sec->reloc_count = 4; - break; - } - case RDATA: - /* Each external function in a PowerPC PE file has a two word - descriptor consisting of: - 1. The address of the code. - 2. The address of the appropriate .toc - We use relocs to build this. */ - si->size = 8; - si->data = xmalloc (8); - memset (si->data, 0, si->size); - - rpp = xmalloc (sizeof (arelent *) * 3); - rpp[0] = rel = xmalloc (sizeof (arelent)); - rpp[1] = xmalloc (sizeof (arelent)); - rpp[2] = 0; - - rel->address = 0; - rel->addend = 0; - rel->howto = bfd_reloc_type_lookup (abfd, BFD_RELOC_32); - rel->sym_ptr_ptr = fn_pp; - - rel = rpp[1]; - - rel->address = 4; - rel->addend = 0; - rel->howto = bfd_reloc_type_lookup (abfd, BFD_RELOC_32); - rel->sym_ptr_ptr = toc_pp; - - sec->orelocation = rpp; - sec->reloc_count = 2; - break; -#endif /* DLLTOOL_PPC */ - } - } - - { - bfd_vma vma = 0; - /* Size up all the sections. */ - for (i = 0; i < NSECS; i++) + case PDATA: { - sinfo *si = secdata + i; + /* The .pdata section is 5 words long. + Think of it as: + struct + { + bfd_vma BeginAddress, [0x00] + EndAddress, [0x04] + ExceptionHandler, [0x08] + HandlerData, [0x0c] + PrologEndAddress; [0x10] + }; */ - bfd_set_section_size (abfd, si->sec, si->size); - bfd_set_section_vma (abfd, si->sec, vma); + /* So this pdata section setups up this as a glue linkage to + a dll routine. There are a number of house keeping things + we need to do: -/* vma += si->size;*/ + 1. In the name of glue trickery, the ADDR32 relocs for 0, + 4, and 0x10 are set to point to the same place: + "..function_name". + 2. There is one more reloc needed in the pdata section. + The actual glue instruction to restore the toc on + return is saved as the offset in an IMGLUE reloc. + So we need a total of four relocs for this section. + + 3. Lastly, the HandlerData field is set to 0x03, to indicate + that this is a glue routine. */ + arelent *imglue, *ba_rel, *ea_rel, *pea_rel; + + /* Alignment must be set to 2**2 or you get extra stuff. */ + bfd_set_section_alignment(abfd, sec, 2); + + si->size = 4 * 5; + si->data = xmalloc (si->size); + memset (si->data, 0, si->size); + rpp = xmalloc (sizeof (arelent *) * 5); + rpp[0] = imglue = xmalloc (sizeof (arelent)); + rpp[1] = ba_rel = xmalloc (sizeof (arelent)); + rpp[2] = ea_rel = xmalloc (sizeof (arelent)); + rpp[3] = pea_rel = xmalloc (sizeof (arelent)); + rpp[4] = 0; + + /* Stick the toc reload instruction in the glue reloc. */ + bfd_put_32(abfd, ppc_glue_insn, (char *) &imglue->address); + + imglue->addend = 0; + imglue->howto = bfd_reloc_type_lookup (abfd, + BFD_RELOC_32_GOTOFF); + imglue->sym_ptr_ptr = fn_pp; + + ba_rel->address = 0; + ba_rel->addend = 0; + ba_rel->howto = bfd_reloc_type_lookup (abfd, BFD_RELOC_32); + ba_rel->sym_ptr_ptr = fn_pp; + + bfd_put_32 (abfd, 0x18, si->data + 0x04); + ea_rel->address = 4; + ea_rel->addend = 0; + ea_rel->howto = bfd_reloc_type_lookup (abfd, BFD_RELOC_32); + ea_rel->sym_ptr_ptr = fn_pp; + + /* Mark it as glue. */ + bfd_put_32 (abfd, 0x03, si->data + 0x0c); + + /* Mark the prolog end address. */ + bfd_put_32 (abfd, 0x0D, si->data + 0x10); + pea_rel->address = 0x10; + pea_rel->addend = 0; + pea_rel->howto = bfd_reloc_type_lookup (abfd, BFD_RELOC_32); + pea_rel->sym_ptr_ptr = fn_pp; + + sec->orelocation = rpp; + sec->reloc_count = 4; + break; } - } - /* Write them out. */ - for (i = 0; i < NSECS; i++) - { - sinfo *si = secdata + i; + case RDATA: + /* Each external function in a PowerPC PE file has a two word + descriptor consisting of: + 1. The address of the code. + 2. The address of the appropriate .toc + We use relocs to build this. */ + si->size = 8; + si->data = xmalloc (8); + memset (si->data, 0, si->size); - if (i == IDATA5 && no_idata5) - continue; + rpp = xmalloc (sizeof (arelent *) * 3); + rpp[0] = rel = xmalloc (sizeof (arelent)); + rpp[1] = xmalloc (sizeof (arelent)); + rpp[2] = 0; - if (i == IDATA4 && no_idata4) - continue; + rel->address = 0; + rel->addend = 0; + rel->howto = bfd_reloc_type_lookup (abfd, BFD_RELOC_32); + rel->sym_ptr_ptr = fn_pp; - bfd_set_section_contents (abfd, si->sec, - si->data, 0, - si->size); + rel = rpp[1]; + + rel->address = 4; + rel->addend = 0; + rel->howto = bfd_reloc_type_lookup (abfd, BFD_RELOC_32); + rel->sym_ptr_ptr = toc_pp; + + sec->orelocation = rpp; + sec->reloc_count = 2; + break; +#endif /* DLLTOOL_PPC */ } - - bfd_set_symtab (abfd, ptrs, oidx); - bfd_close (abfd); - abfd = bfd_openr (outname, HOW_BFD_READ_TARGET); - return abfd; } -#endif + + { + bfd_vma vma = 0; + /* Size up all the sections. */ + for (i = 0; i < NSECS; i++) + { + sinfo *si = secdata + i; + + bfd_set_section_size (abfd, si->sec, si->size); + bfd_set_section_vma (abfd, si->sec, vma); + } + } + /* Write them out. */ + for (i = 0; i < NSECS; i++) + { + sinfo *si = secdata + i; + + if (i == IDATA5 && no_idata5) + continue; + + if (i == IDATA4 && no_idata4) + continue; + + bfd_set_section_contents (abfd, si->sec, + si->data, 0, + si->size); + } + + bfd_set_symtab (abfd, ptrs, oidx); + bfd_close (abfd); + abfd = bfd_openr (outname, HOW_BFD_READ_TARGET); + return abfd; } static bfd * @@ -2805,6 +2730,26 @@ gen_lib_file (void) n = make_one_lib_file (exp, i); n->next = head; head = n; + if (ext_prefix_alias) + { + export_type alias_exp; + + assert (i < PREFIX_ALIAS_BASE); + alias_exp.name = make_imp_label (ext_prefix_alias, exp->name); + alias_exp.internal_name = exp->internal_name; + alias_exp.import_name = exp->name; + alias_exp.ordinal = exp->ordinal; + alias_exp.constant = exp->constant; + alias_exp.noname = exp->noname; + alias_exp.private = exp->private; + alias_exp.data = exp->data; + alias_exp.hint = exp->hint; + alias_exp.forward = exp->forward; + alias_exp.next = exp->next; + n = make_one_lib_file (&alias_exp, i + PREFIX_ALIAS_BASE); + n->next = head; + head = n; + } } /* Now stick them all into the archive. */ @@ -2848,6 +2793,13 @@ gen_lib_file (void) if (unlink (name) < 0) /* xgettext:c-format */ non_fatal (_("cannot delete %s: %s"), name, strerror (errno)); + if (ext_prefix_alias) + { + sprintf (name, "%s%05d.o", TMP_STUB, i + PREFIX_ALIAS_BASE); + if (unlink (name) < 0) + /* xgettext:c-format */ + non_fatal (_("cannot delete %s: %s"), name, strerror (errno)); + } } } @@ -2878,8 +2830,16 @@ nfunc (const void *a, const void *b) { export_type *ap = *(export_type **) a; export_type *bp = *(export_type **) b; + const char *an = ap->name; + const char *bn = bp->name; - return (strcmp (ap->name, bp->name)); + if (killat) + { + an = (an[0] == '@') ? an + 1 : an; + bn = (bn[0] == '@') ? bn + 1 : bn; + } + + return (strcmp (an, bn)); } static void @@ -2899,27 +2859,6 @@ remove_null_names (export_type **ptr) d_nfuncs = dst; } -static void -dtab (export_type **ptr ATTRIBUTE_UNUSED) -{ -#ifdef SACDEBUG - int i; - for (i = 0; i < d_nfuncs; i++) - { - if (ptr[i]) - { - printf ("%d %s @ %d %s%s%s\n", - i, ptr[i]->name, ptr[i]->ordinal, - ptr[i]->noname ? "NONAME " : "", - ptr[i]->constant ? "CONSTANT" : "", - ptr[i]->data ? "DATA" : ""); - } - else - printf ("empty\n"); - } -#endif -} - static void process_duplicates (export_type **d_export_vec) { @@ -2932,7 +2871,6 @@ process_duplicates (export_type **d_export_vec) /* Remove duplicates. */ qsort (d_export_vec, d_nfuncs, sizeof (export_type *), nfunc); - dtab (d_export_vec); for (i = 0; i < d_nfuncs - 1; i++) { if (strcmp (d_export_vec[i]->name, @@ -2961,9 +2899,7 @@ process_duplicates (export_type **d_export_vec) d_export_vec[i] = 0; } - dtab (d_export_vec); remove_null_names (d_export_vec); - dtab (d_export_vec); } } @@ -3047,15 +2983,6 @@ fill_ordinals (export_type **d_export_vec) } } -static int -alphafunc (const void *av, const void *bv) -{ - const export_type **a = (const export_type **) av; - const export_type **b = (const export_type **) bv; - - return strcmp ((*a)->name, (*b)->name); -} - static void mangle_defs (void) { @@ -3091,7 +3018,7 @@ mangle_defs (void) d_exports_lexically[i] = 0; - qsort (d_exports_lexically, i, sizeof (export_type *), alphafunc); + qsort (d_exports_lexically, i, sizeof (export_type *), nfunc); /* Fill exp entries with their hint values. */ for (i = 0; i < d_nfuncs; i++) @@ -3122,9 +3049,11 @@ usage (FILE *file, int status) fprintf (file, _(" -b --base-file Read linker generated base file.\n")); fprintf (file, _(" -x --no-idata4 Don't generate idata$4 section.\n")); fprintf (file, _(" -c --no-idata5 Don't generate idata$5 section.\n")); - fprintf (file, _(" -U --add-underscore Add underscores to symbols in interface library.\n")); + fprintf (file, _(" -U --add-underscore Add underscores to all symbols in interface library.\n")); + fprintf (file, _(" --add-stdcall-underscore Add underscores to stdcall symbols in interface library.\n")); fprintf (file, _(" -k --kill-at Kill @ from exported names.\n")); fprintf (file, _(" -A --add-stdcall-alias Add aliases without @.\n")); + fprintf (file, _(" -p --ext-prefix-alias Add aliases with .\n")); fprintf (file, _(" -S --as Use for assembler.\n")); fprintf (file, _(" -f --as-flags Pass to the assembler.\n")); fprintf (file, _(" -C --compat-implib Create backward compatible import library.\n")); @@ -3133,6 +3062,7 @@ usage (FILE *file, int status) fprintf (file, _(" -v --verbose Be verbose.\n")); fprintf (file, _(" -V --version Display the program version.\n")); fprintf (file, _(" -h --help Display this information.\n")); + fprintf (file, _(" @ Read options from .\n")); #ifdef DLLTOOL_MCORE_ELF fprintf (file, _(" -M --mcore-elf Process mcore-elf object files into .\n")); fprintf (file, _(" -L --linker Use as the linker.\n")); @@ -3145,6 +3075,7 @@ usage (FILE *file, int status) #define OPTION_NO_EXPORT_ALL_SYMS (OPTION_EXPORT_ALL_SYMS + 1) #define OPTION_EXCLUDE_SYMS (OPTION_NO_EXPORT_ALL_SYMS + 1) #define OPTION_NO_DEFAULT_EXCLUDES (OPTION_EXCLUDE_SYMS + 1) +#define OPTION_ADD_STDCALL_UNDERSCORE (OPTION_NO_DEFAULT_EXCLUDES + 1) static const struct option long_options[] = { @@ -3162,8 +3093,10 @@ static const struct option long_options[] = {"def", required_argument, NULL, 'd'}, /* for compatibility with older versions */ {"input-def", required_argument, NULL, 'd'}, {"add-underscore", no_argument, NULL, 'U'}, + {"add-stdcall-underscore", no_argument, NULL, OPTION_ADD_STDCALL_UNDERSCORE}, {"kill-at", no_argument, NULL, 'k'}, {"add-stdcall-alias", no_argument, NULL, 'A'}, + {"ext-prefix-alias", required_argument, NULL, 'p'}, {"verbose", no_argument, NULL, 'v'}, {"version", no_argument, NULL, 'V'}, {"help", no_argument, NULL, 'h'}, @@ -3198,11 +3131,13 @@ main (int ac, char **av) bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); + expandargv (&ac, &av); + while ((c = getopt_long (ac, av, #ifdef DLLTOOL_MCORE_ELF - "m:e:l:aD:d:z:b:xcCuUkAS:f:nvVHhM:L:F:", + "m:e:l:aD:d:z:b:xp:cCuUkAS:f:nvVHhM:L:F:", #else - "m:e:l:aD:d:z:b:xcCuUkAS:f:nvVHh", + "m:e:l:aD:d:z:b:xp:cCuUkAS:f:nvVHh", #endif long_options, 0)) != EOF) @@ -3221,6 +3156,9 @@ main (int ac, char **av) case OPTION_NO_DEFAULT_EXCLUDES: do_default_excludes = FALSE; break; + case OPTION_ADD_STDCALL_UNDERSCORE: + add_stdcall_underscore = 1; + break; case 'x': no_idata4 = 1; break; @@ -3247,7 +3185,10 @@ main (int ac, char **av) output_def = fopen (optarg, FOPEN_WT); break; case 'D': - dll_name = optarg; + dll_name = (char*) lbasename (optarg); + if (dll_name != optarg) + non_fatal (_("Path components stripped from dllname, '%s'."), + optarg); break; case 'l': imp_name = optarg; @@ -3277,6 +3218,9 @@ main (int ac, char **av) case 'A': add_stdcall_alias = 1; break; + case 'p': + ext_prefix_alias = optarg; + break; case 'd': def_file = optarg; break; @@ -3326,9 +3270,13 @@ main (int ac, char **av) if (!dll_name && exp_name) { - int len = strlen (exp_name) + 5; + /* If we are inferring dll_name from exp_name, + strip off any path components, without emitting + a warning. */ + const char* exp_basename = lbasename (exp_name); + const int len = strlen (exp_basename) + 5; dll_name = xmalloc (len); - strcpy (dll_name, exp_name); + strcpy (dll_name, exp_basename); strcat (dll_name, ".dll"); } diff --git a/contrib/binutils/binutils/dlltool.h b/contrib/binutils/binutils/dlltool.h index f488d96c02d..e2634ea258a 100644 --- a/contrib/binutils/binutils/dlltool.h +++ b/contrib/binutils/binutils/dlltool.h @@ -15,8 +15,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #include "ansidecl.h" #include diff --git a/contrib/binutils/binutils/dllwrap.c b/contrib/binutils/binutils/dllwrap.c index e4db7bae538..f93c75d6fb3 100644 --- a/contrib/binutils/binutils/dllwrap.c +++ b/contrib/binutils/binutils/dllwrap.c @@ -1,5 +1,5 @@ /* dllwrap.c -- wrapper for DLLTOOL and GCC to generate PE style DLLs - Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Contributed by Mumit Khan (khan@xraylith.wisc.edu). This file is part of GNU Binutils. @@ -16,8 +16,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ /* AIX requires this to be the first thing in the file. */ #ifndef __GNUC__ @@ -38,12 +38,7 @@ #include #include - -#ifdef ANSI_PROTOTYPES #include -#else -#include -#endif #ifdef HAVE_SYS_WAIT_H #include @@ -101,7 +96,7 @@ static target_type which_target = UNKNOWN_TARGET; static int dontdeltemps = 0; static int dry_run = 0; -static char *program_name; +static char *prog_name; static int verbose = 0; @@ -118,9 +113,9 @@ static int run (const char *, char *); static char *mybasename (const char *); static int strhash (const char *); static void usage (FILE *, int); -static void display (const char *, va_list); -static void inform (const char *, ...); -static void warn (const char *, ...); +static void display (const char *, va_list) ATTRIBUTE_PRINTF(1,0); +static void inform (const char *, ...) ATTRIBUTE_PRINTF_1; +static void warn (const char *, ...) ATTRIBUTE_PRINTF_1; static char *look_for_prog (const char *, const char *, int); static char *deduce_name (const char *); static void delete_temp_files (void); @@ -139,8 +134,8 @@ static void cleanup_and_exit (int); static void display (const char * message, va_list args) { - if (program_name != NULL) - fprintf (stderr, "%s: ", program_name); + if (prog_name != NULL) + fprintf (stderr, "%s: ", prog_name); vfprintf (stderr, message, args); fputc ('\n', stderr); @@ -244,17 +239,20 @@ look_for_prog (const char *prog_name, const char *prefix, int end_prefix) Returns a dynamically allocated string. */ static char * -deduce_name (const char *prog_name) +deduce_name (const char * name) { char *cmd; - char *dash, *slash, *cp; + const char *dash; + const char *slash; + const char *cp; dash = NULL; slash = NULL; - for (cp = program_name; *cp != '\0'; ++cp) + for (cp = prog_name; *cp != '\0'; ++cp) { if (*cp == '-') dash = cp; + if ( #if defined(__DJGPP__) || defined (__CYGWIN__) || defined(__WIN32__) *cp == ':' || *cp == '\\' || @@ -269,24 +267,18 @@ deduce_name (const char *prog_name) cmd = NULL; if (dash != NULL) - { - /* First, try looking for a prefixed PROG_NAME in the - PROGRAM_NAME directory, with the same prefix as PROGRAM_NAME. */ - cmd = look_for_prog (prog_name, program_name, dash - program_name + 1); - } + /* First, try looking for a prefixed NAME in the + PROG_NAME directory, with the same prefix as PROG_NAME. */ + cmd = look_for_prog (name, prog_name, dash - prog_name + 1); if (slash != NULL && cmd == NULL) - { - /* Next, try looking for a PROG_NAME in the same directory as - that of this program. */ - cmd = look_for_prog (prog_name, program_name, slash - program_name + 1); - } + /* Next, try looking for a NAME in the same directory as + that of this program. */ + cmd = look_for_prog (name, prog_name, slash - prog_name + 1); if (cmd == NULL) - { - /* Just return PROG_NAME as is. */ - cmd = xstrdup (prog_name); - } + /* Just return NAME as is. */ + cmd = xstrdup (name); return cmd; } @@ -396,14 +388,14 @@ run (const char *what, char *args) if (dry_run) return 0; - pid = pexecute (argv[0], (char * const *) argv, program_name, temp_base, + pid = pexecute (argv[0], (char * const *) argv, prog_name, temp_base, &errmsg_fmt, &errmsg_arg, PEXECUTE_ONE | PEXECUTE_SEARCH); if (pid == -1) { int errno_val = errno; - fprintf (stderr, "%s: ", program_name); + fprintf (stderr, "%s: ", prog_name); fprintf (stderr, errmsg_fmt, errmsg_arg); fprintf (stderr, ": %s\n", strerror (errno_val)); return 1; @@ -479,13 +471,14 @@ strhash (const char *str) static void usage (FILE *file, int status) { - fprintf (file, _("Usage %s \n"), program_name); + fprintf (file, _("Usage %s \n"), prog_name); fprintf (file, _(" Generic options:\n")); + fprintf (file, _(" @ Read options from \n")); fprintf (file, _(" --quiet, -q Work quietly\n")); fprintf (file, _(" --verbose, -v Verbose\n")); fprintf (file, _(" --version Print dllwrap version\n")); fprintf (file, _(" --implib Synonym for --output-lib\n")); - fprintf (file, _(" Options for %s:\n"), program_name); + fprintf (file, _(" Options for %s:\n"), prog_name); fprintf (file, _(" --driver-name Defaults to \"gcc\"\n")); fprintf (file, _(" --driver-flags Override default ld flags\n")); fprintf (file, _(" --dlltool-name Defaults to \"dlltool\"\n")); @@ -624,7 +617,7 @@ main (int argc, char **argv) char *image_base_str = 0; - program_name = argv[0]; + prog_name = argv[0]; #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) setlocale (LC_MESSAGES, ""); @@ -635,6 +628,8 @@ main (int argc, char **argv) bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); + expandargv (&argc, &argv); + saved_argv = (char **) xmalloc (argc * sizeof (char*)); dlltool_arg_indices = (int *) xmalloc (argc * sizeof (int)); driver_arg_indices = (int *) xmalloc (argc * sizeof (int)); @@ -688,7 +683,7 @@ main (int argc, char **argv) verbose = 1; break; case OPTION_VERSION: - print_version (program_name); + print_version (prog_name); break; case 'e': entry_point = optarg; @@ -781,7 +776,7 @@ main (int argc, char **argv) } } - /* sanity checks. */ + /* Sanity checks. */ if (! dll_name && ! dll_file_name) { warn (_("Must provide at least one of -o or --dllname options")); @@ -806,6 +801,7 @@ main (int argc, char **argv) if (! def_file_seen) { char *fileprefix = choose_temp_base (); + def_file_name = (char *) xmalloc (strlen (fileprefix) + 5); sprintf (def_file_name, "%s.def", (dontdeltemps) ? mybasename (fileprefix) : fileprefix); @@ -816,7 +812,7 @@ main (int argc, char **argv) Creating one, but that may not be what you want")); } - /* set the target platform. */ + /* Set the target platform. */ if (strstr (target, "cygwin")) which_target = CYGWIN_TARGET; else if (strstr (target, "mingw")) @@ -824,12 +820,11 @@ Creating one, but that may not be what you want")); else which_target = UNKNOWN_TARGET; - /* re-create the command lines as a string, taking care to quote stuff. */ + /* Re-create the command lines as a string, taking care to quote stuff. */ dlltool_cmdline = dyn_string_new (cmdline_len); if (verbose) - { - dyn_string_append_cstr (dlltool_cmdline, " -v"); - } + dyn_string_append_cstr (dlltool_cmdline, " -v"); + dyn_string_append_cstr (dlltool_cmdline, " --dllname "); dyn_string_append_cstr (dlltool_cmdline, dll_name); @@ -922,10 +917,8 @@ Creating one, but that may not be what you want")); } } - /* - * Step pre-1. If no --def is specified, then create it - * and then pass it on. - */ + /* Step pre-1. If no --def is specified, + then create it and then pass it on. */ if (! def_file_seen) { @@ -980,16 +973,13 @@ Creating one, but that may not be what you want")); fprintf (stderr, _("DRIVER options : %s\n"), driver_cmdline->s); } - /* - * Step 1. Call GCC/LD to create base relocation file. If using GCC, the - * driver command line will look like the following: - * - * % gcc -Wl,--dll --Wl,--base-file,foo.base [rest of command line] - * - * If the user does not specify a base name, create temporary one that - * is deleted at exit. - * - */ + /* Step 1. Call GCC/LD to create base relocation file. If using GCC, the + driver command line will look like the following: + + % gcc -Wl,--dll --Wl,--base-file,foo.base [rest of command line] + + If the user does not specify a base name, create temporary one that + is deleted at exit. */ if (! base_file_name) { @@ -1027,23 +1017,19 @@ Creating one, but that may not be what you want")); dyn_string_delete (step1); } - - - /* - * Step 2. generate the exp file by running dlltool. - * dlltool command line will look like the following: - * - * % dlltool -Wl,--dll --Wl,--base-file,foo.base [rest of command line] - * - * If the user does not specify a base name, create temporary one that - * is deleted at exit. - * - */ + /* Step 2. generate the exp file by running dlltool. + dlltool command line will look like the following: + + % dlltool -Wl,--dll --Wl,--base-file,foo.base [rest of command line] + + If the user does not specify a base name, create temporary one that + is deleted at exit. */ if (! exp_file_name) { char *p = strrchr (dll_name, '.'); - size_t prefix_len = (p) ? p - dll_name : strlen (dll_name); + size_t prefix_len = (p) ? (size_t) (p - dll_name) : strlen (dll_name); + exp_file_name = (char *) xmalloc (prefix_len + 4 + 1); strncpy (exp_file_name, dll_name, prefix_len); exp_file_name[prefix_len] = '\0'; @@ -1053,6 +1039,7 @@ Creating one, but that may not be what you want")); { int quote; + dyn_string_t step2 = dyn_string_new (dlltool_cmdline->length + strlen (base_file_name) + strlen (exp_file_name) diff --git a/contrib/binutils/binutils/doc/Makefile.am b/contrib/binutils/binutils/doc/Makefile.am index 851f205636f..1d043e7d3f8 100644 --- a/contrib/binutils/binutils/doc/Makefile.am +++ b/contrib/binutils/binutils/doc/Makefile.am @@ -8,7 +8,7 @@ CONFIG=all # Options to extract the man page from as.texinfo MANCONF = -Dman -TEXI2POD = perl $(top_srcdir)/../etc/texi2pod.pl +TEXI2POD = perl $(top_srcdir)/../etc/texi2pod.pl $(AM_MAKEINFOFLAGS) POD2MAN = pod2man --center="GNU Development Tools" \ --release="binutils-$(VERSION)" --section=1 @@ -31,110 +31,111 @@ man_MANS = \ $(DEMANGLER_NAME).1 info_TEXINFOS = binutils.texi - -config.texi: Makefile - rm -f config.texi - echo '@set VERSION $(VERSION)' > config.texi - +binutils_TEXINFOS = config.texi binutils_TEXI = $(srcdir)/binutils.texi -binutils.dvi: $(binutils_TEXI) config.texi +AM_MAKEINFOFLAGS = -I "$(srcdir)" -I "$(top_srcdir)/../libiberty" +TEXI2DVI = texi2dvi -I "$(srcdir)" -I "$(top_srcdir)/../libiberty" -binutils.info: $(binutils_TEXI) config.texi +config.texi: $(srcdir)/../../bfd/configure $(binutils_TEXI) + rm -f config.texi + eval `grep '^ *VERSION=' $(srcdir)/../../bfd/configure`; \ + echo "@set VERSION $$VERSION" > $@ + echo "@set UPDATED `date "+%B %Y"`" >> config.texi # Man page generation from texinfo -addr2line.1: $(binutils_TEXI) +addr2line.1: $(binutils_TEXI) $(binutils_TEXINFOS) touch $@ -$(TEXI2POD) $(MANCONF) -Daddr2line < $(binutils_TEXI) > addr2line.pod -($(POD2MAN) addr2line.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \ mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1) rm -f addr2line.pod -ar.1: $(binutils_TEXI) +ar.1: $(binutils_TEXI) $(binutils_TEXINFOS) touch $@ -$(TEXI2POD) $(MANCONF) -Dar < $(binutils_TEXI) > ar.pod -($(POD2MAN) ar.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \ mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1) rm -f ar.pod -dlltool.1: $(binutils_TEXI) +dlltool.1: $(binutils_TEXI) $(binutils_TEXINFOS) touch $@ -$(TEXI2POD) $(MANCONF) -Ddlltool < $(binutils_TEXI) > dlltool.pod -($(POD2MAN) dlltool.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \ mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1) rm -f dlltool.pod -nlmconv.1: $(binutils_TEXI) +nlmconv.1: $(binutils_TEXI) $(binutils_TEXINFOS) touch $@ -$(TEXI2POD) $(MANCONF) -Dnlmconv < $(binutils_TEXI) > nlmconv.pod -($(POD2MAN) nlmconv.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \ mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1) rm -f nlmconv.pod -nm.1: $(binutils_TEXI) +nm.1: $(binutils_TEXI) $(binutils_TEXINFOS) touch $@ -$(TEXI2POD) $(MANCONF) -Dnm < $(binutils_TEXI) > nm.pod -($(POD2MAN) nm.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \ mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1) rm -f nm.pod -objcopy.1: $(binutils_TEXI) +objcopy.1: $(binutils_TEXI) $(binutils_TEXINFOS) touch $@ -$(TEXI2POD) $(MANCONF) -Dobjcopy < $(binutils_TEXI) > objcopy.pod -($(POD2MAN) objcopy.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \ mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1) rm -f objcopy.pod -objdump.1: $(binutils_TEXI) +objdump.1: $(binutils_TEXI) $(binutils_TEXINFOS) touch $@ -$(TEXI2POD) $(MANCONF) -Dobjdump < $(binutils_TEXI) > objdump.pod -($(POD2MAN) objdump.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \ mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1) rm -f objdump.pod -ranlib.1: $(binutils_TEXI) +ranlib.1: $(binutils_TEXI) $(binutils_TEXINFOS) touch $@ -$(TEXI2POD) $(MANCONF) -Dranlib < $(binutils_TEXI) > ranlib.pod -($(POD2MAN) ranlib.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \ mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1) rm -f ranlib.pod -readelf.1: $(binutils_TEXI) +readelf.1: $(binutils_TEXI) $(binutils_TEXINFOS) touch $@ -$(TEXI2POD) $(MANCONF) -Dreadelf < $(binutils_TEXI) > readelf.pod -($(POD2MAN) readelf.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \ mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1) rm -f readelf.pod -size.1: $(binutils_TEXI) +size.1: $(binutils_TEXI) $(binutils_TEXINFOS) touch $@ -$(TEXI2POD) $(MANCONF) -Dsize < $(binutils_TEXI) > size.pod -($(POD2MAN) size.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \ mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1) rm -f size.pod -strings.1: $(binutils_TEXI) +strings.1: $(binutils_TEXI) $(binutils_TEXINFOS) touch $@ -$(TEXI2POD) $(MANCONF) -Dstrings < $(binutils_TEXI) > strings.pod -($(POD2MAN) strings.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \ mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1) rm -f strings.pod -strip.1: $(binutils_TEXI) +strip.1: $(binutils_TEXI) $(binutils_TEXINFOS) touch $@ -$(TEXI2POD) $(MANCONF) -Dstrip < $(binutils_TEXI) > strip.pod -($(POD2MAN) strip.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \ mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1) rm -f strip.pod -windres.1: $(binutils_TEXI) +windres.1: $(binutils_TEXI) $(binutils_TEXINFOS) touch $@ -$(TEXI2POD) $(MANCONF) -Dwindres < $(binutils_TEXI) > windres.pod -($(POD2MAN) windres.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \ mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1) rm -f windres.pod -cxxfilt.man: $(binutils_TEXI) +cxxfilt.man: $(binutils_TEXI) $(binutils_TEXINFOS) touch $@ -$(TEXI2POD) $(MANCONF) -Dcxxfilt < $(binutils_TEXI) > $(DEMANGLER_NAME).pod -($(POD2MAN) $(DEMANGLER_NAME).pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \ @@ -142,7 +143,6 @@ cxxfilt.man: $(binutils_TEXI) rm -f $(DEMANGLER_NAME).pod MAINTAINERCLEANFILES = config.texi -DISTCLEANFILES = config.texi MOSTLYCLEANFILES = $(DEMANGLER_NAME).1 $(DEMANGLER_NAME).1: cxxfilt.man Makefile @@ -157,9 +157,30 @@ $(DEMANGLER_NAME).1: cxxfilt.man Makefile # We want install to imply install-info as per GNU standards, despite the # cygnus option. -install: install-info +install-data-local: install-info + +html__strip_dir = `echo $$p | sed -e 's|^.*/||'`; + +install-html: install-html-am + +install-html-am: $(HTMLS) + @$(NORMAL_INSTALL) + test -z "$(htmldir)" || $(mkdir_p) "$(DESTDIR)$(htmldir)" + @list='$(HTMLS)'; for p in $$list; do \ + if test -f "$$p" || test -d "$$p"; then d=""; else d="$(srcdir)/"; fi; \ + f=$(html__strip_dir) \ + if test -d "$$d$$p"; then \ + echo " $(mkdir_p) '$(DESTDIR)$(htmldir)/$$f'"; \ + $(mkdir_p) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \ + echo " $(INSTALL_DATA) '$$d$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \ + $(INSTALL_DATA) "$$d$$p"/* "$(DESTDIR)$(htmldir)/$$f"; \ + else \ + echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(htmldir)/$$f'"; \ + $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(htmldir)/$$f"; \ + fi; \ + done # Maintenance # We need it for the taz target in ../../Makefile.in. -info: $(MANS) +info-local: $(MANS) diff --git a/contrib/binutils/binutils/doc/Makefile.in b/contrib/binutils/binutils/doc/Makefile.in index e05f5bee1e4..ef28ceff8df 100644 --- a/contrib/binutils/binutils/doc/Makefile.in +++ b/contrib/binutils/binutils/doc/Makefile.in @@ -1,6 +1,8 @@ -# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ -# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -10,61 +12,73 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. - -SHELL = @SHELL@ - +@SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -sbindir = @sbindir@ -libexecdir = @libexecdir@ -datadir = @datadir@ -sysconfdir = @sysconfdir@ -sharedstatedir = @sharedstatedir@ -localstatedir = @localstatedir@ -libdir = @libdir@ -infodir = @infodir@ -mandir = @mandir@ -includedir = @includedir@ -oldincludedir = /usr/include - -DESTDIR = - pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ - top_builddir = .. - -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -transform = @program_transform_name@ - +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : -build_alias = @build_alias@ build_triplet = @build@ -host_alias = @host_alias@ host_triplet = @host@ -target_alias = @target_alias@ target_triplet = @target@ +subdir = doc +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(binutils_TEXINFOS) +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/../bfd/acinclude.m4 \ + $(top_srcdir)/../config/acx.m4 $(top_srcdir)/../bfd/bfd.m4 \ + $(top_srcdir)/../bfd/warning.m4 $(top_srcdir)/../libtool.m4 \ + $(top_srcdir)/../gettext.m4 $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +depcomp = +am__depfiles_maybe = +SOURCES = +INFO_DEPS = $(srcdir)/binutils.info +TEXINFO_TEX = $(top_srcdir)/../texinfo/texinfo.tex +am__TEXINFO_TEX_DIR = $(top_srcdir)/../texinfo +DVIS = binutils.dvi +PDFS = binutils.pdf +PSS = binutils.ps +HTMLS = binutils.html +TEXINFOS = binutils.texi +TEXI2PDF = $(TEXI2DVI) --pdf --batch +MAKEINFOHTML = $(MAKEINFO) --html +AM_MAKEINFOHTMLFLAGS = $(AM_MAKEINFOFLAGS) +DVIPS = dvips +man1dir = $(mandir)/man1 +am__installdirs = "$(DESTDIR)$(man1dir)" +NROFF = nroff +MANS = $(man_MANS) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ AR = @AR@ -AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ BUILD_DLLTOOL = @BUILD_DLLTOOL@ BUILD_DLLWRAP = @BUILD_DLLWRAP@ BUILD_MISC = @BUILD_MISC@ @@ -74,54 +88,123 @@ BUILD_WINDRES = @BUILD_WINDRES@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ +CCDEPMODE = @CCDEPMODE@ CC_FOR_BUILD = @CC_FOR_BUILD@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ +DEFS = @DEFS@ DEMANGLER_NAME = @DEMANGLER_NAME@ -DLLTOOL = @DLLTOOL@ +DEPDIR = @DEPDIR@ DLLTOOL_DEFS = @DLLTOOL_DEFS@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ EMULATION = @EMULATION@ EMULATION_VECTOR = @EMULATION_VECTOR@ EXEEXT = @EXEEXT@ EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@ -GCJ = @GCJ@ -GCJFLAGS = @GCJFLAGS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GT_NO = @GT_NO@ GT_YES = @GT_YES@ HDEFINES = @HDEFINES@ INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLDEPS = @INTLDEPS@ INTLLIBS = @INTLLIBS@ INTLOBJS = @INTLOBJS@ +LDFLAGS = @LDFLAGS@ LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MKINSTALLDIRS = @MKINSTALLDIRS@ MSGFMT = @MSGFMT@ NLMCONV_DEFS = @NLMCONV_DEFS@ -OBJDUMP = @OBJDUMP@ +NO_WERROR = @NO_WERROR@ OBJDUMP_DEFS = @OBJDUMP_DEFS@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ POFILES = @POFILES@ POSUB = @POSUB@ RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ STRIP = @STRIP@ USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WARN_CFLAGS = @WARN_CFLAGS@ +XGETTEXT = @XGETTEXT@ YACC = @YACC@ -bfdincludedir = @bfdincludedir@ -bfdlibdir = @bfdlibdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ l = @l@ - +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ AUTOMAKE_OPTIONS = cygnus # What version of the manual you want; "all" includes everything @@ -129,9 +212,7 @@ CONFIG = all # Options to extract the man page from as.texinfo MANCONF = -Dman - -TEXI2POD = perl $(top_srcdir)/../etc/texi2pod.pl - +TEXI2POD = perl $(top_srcdir)/../etc/texi2pod.pl $(AM_MAKEINFOFLAGS) POD2MAN = pod2man --center="GNU Development Tools" \ --release="binutils-$(VERSION)" --section=1 @@ -153,161 +234,168 @@ man_MANS = \ windres.1 \ $(DEMANGLER_NAME).1 - info_TEXINFOS = binutils.texi - +binutils_TEXINFOS = config.texi binutils_TEXI = $(srcdir)/binutils.texi - +AM_MAKEINFOFLAGS = -I "$(srcdir)" -I "$(top_srcdir)/../libiberty" +TEXI2DVI = texi2dvi -I "$(srcdir)" -I "$(top_srcdir)/../libiberty" MAINTAINERCLEANFILES = config.texi -DISTCLEANFILES = config.texi MOSTLYCLEANFILES = $(DEMANGLER_NAME).1 -mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs -CONFIG_HEADER = ../config.h -CONFIG_CLEAN_FILES = -TEXI2DVI = `if test -f $(top_srcdir)/../texinfo/util/texi2dvi; then echo $(top_srcdir)/../texinfo/util/texi2dvi; else echo texi2dvi; fi` -TEXINFO_TEX = $(top_srcdir)/../texinfo/texinfo.tex -INFO_DEPS = binutils.info -DVIS = binutils.dvi -TEXINFOS = binutils.texi -man1dir = $(mandir)/man1 -MANS = $(man_MANS) +html__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +all: all-am -NROFF = nroff -DIST_COMMON = Makefile.am Makefile.in - - -DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) - -TAR = tar -GZIP_ENV = --best -all: all-redirect .SUFFIXES: -.SUFFIXES: .dvi .info .ps .texi .texinfo .txi -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --cygnus doc/Makefile +.SUFFIXES: .dvi .html .info .pdf .ps .texi +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign doc/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -binutils.info: binutils.texi -binutils.dvi: binutils.texi +mostlyclean-libtool: + -rm -f *.lo +clean-libtool: + -rm -rf .libs _libs -DVIPS = dvips +distclean-libtool: + -rm -f libtool .texi.info: - @rm -f $@ $@-[0-9] $@-[0-9][0-9] - $(MAKEINFO) -I $(srcdir) $< + restore=: && backupdir="$(am__leading_dot)am$$$$" && \ + am__cwd=`pwd` && cd $(srcdir) && \ + rm -rf $$backupdir && mkdir $$backupdir && \ + if ($(MAKEINFO) --version) >/dev/null 2>&1; then \ + for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]; do \ + if test -f $$f; then mv $$f $$backupdir; restore=mv; else :; fi; \ + done; \ + else :; fi && \ + cd "$$am__cwd"; \ + if $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \ + -o $@ $<; \ + then \ + rc=0; \ + cd $(srcdir); \ + else \ + rc=$$?; \ + cd $(srcdir) && \ + $$restore $$backupdir/* `echo "./$@" | sed 's|[^/]*$$||'`; \ + fi; \ + rm -rf $$backupdir; exit $$rc .texi.dvi: - TEXINPUTS=$(top_srcdir)/../texinfo/texinfo.tex:$$TEXINPUTS \ - MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $< + TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ + MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \ + $(TEXI2DVI) $< -.texi: - @rm -f $@ $@-[0-9] $@-[0-9][0-9] - $(MAKEINFO) -I $(srcdir) $< +.texi.pdf: + TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ + MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \ + $(TEXI2PDF) $< -.texinfo.info: - @rm -f $@ $@-[0-9] $@-[0-9][0-9] - $(MAKEINFO) -I $(srcdir) $< - -.texinfo: - @rm -f $@ $@-[0-9] $@-[0-9][0-9] - $(MAKEINFO) -I $(srcdir) $< - -.texinfo.dvi: - TEXINPUTS=$(top_srcdir)/../texinfo/texinfo.tex:$$TEXINPUTS \ - MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $< - -.txi.info: - @rm -f $@ $@-[0-9] $@-[0-9][0-9] - $(MAKEINFO) -I $(srcdir) $< - -.txi.dvi: - TEXINPUTS=$(top_srcdir)/../texinfo/texinfo.tex:$$TEXINPUTS \ - MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $< - -.txi: - @rm -f $@ $@-[0-9] $@-[0-9][0-9] - $(MAKEINFO) -I $(srcdir) $< +.texi.html: + rm -rf $(@:.html=.htp) + if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \ + -o $(@:.html=.htp) $<; \ + then \ + rm -rf $@; \ + if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \ + mv $(@:.html=) $@; else mv $(@:.html=.htp) $@; fi; \ + else \ + if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \ + rm -rf $(@:.html=); else rm -Rf $(@:.html=.htp) $@; fi; \ + exit 1; \ + fi +$(srcdir)/binutils.info: binutils.texi $(binutils_TEXINFOS) +binutils.dvi: binutils.texi $(binutils_TEXINFOS) +binutils.pdf: binutils.texi $(binutils_TEXINFOS) +binutils.html: binutils.texi $(binutils_TEXINFOS) .dvi.ps: - $(DVIPS) $< -o $@ + TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ + $(DVIPS) -o $@ $< -install-info-am: $(INFO_DEPS) - @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(infodir) - @list='$(INFO_DEPS)'; \ - for file in $$list; do \ - if test -f $$file; then d=.; else d=$(srcdir); fi; \ - for ifile in `cd $$d && echo $$file $$file-[0-9] $$file-[0-9][0-9]`; do \ - if test -f $$d/$$ifile; then \ - echo " $(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile"; \ - $(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile; \ - else : ; fi; \ - done; \ - done - @$(POST_INSTALL) - @if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \ +uninstall-info-am: + @$(PRE_UNINSTALL) + @if (install-info --version && \ + install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \ list='$(INFO_DEPS)'; \ for file in $$list; do \ - echo " install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file";\ - install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file || :;\ + relfile=`echo "$$file" | sed 's|^.*/||'`; \ + echo " install-info --info-dir='$(DESTDIR)$(infodir)' --remove '$(DESTDIR)$(infodir)/$$relfile'"; \ + install-info --info-dir="$(DESTDIR)$(infodir)" --remove "$(DESTDIR)$(infodir)/$$relfile"; \ done; \ - else : ; fi - -uninstall-info: - $(PRE_UNINSTALL) - @if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \ - ii=yes; \ - else ii=; fi; \ - list='$(INFO_DEPS)'; \ - for file in $$list; do \ - test -z "$$ii" \ - || install-info --info-dir=$(DESTDIR)$(infodir) --remove $$file; \ - done + else :; fi @$(NORMAL_UNINSTALL) - list='$(INFO_DEPS)'; \ + @list='$(INFO_DEPS)'; \ for file in $$list; do \ - (cd $(DESTDIR)$(infodir) && rm -f $$file $$file-[0-9] $$file-[0-9][0-9]); \ + relfile=`echo "$$file" | sed 's|^.*/||'`; \ + relfile_i=`echo "$$relfile" | sed 's|\.info$$||;s|$$|.i|'`; \ + (if cd "$(DESTDIR)$(infodir)"; then \ + echo " cd '$(DESTDIR)$(infodir)' && rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]"; \ + rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]; \ + else :; fi); \ done dist-info: $(INFO_DEPS) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ list='$(INFO_DEPS)'; \ for base in $$list; do \ + case $$base in \ + $(srcdir)/*) base=`echo "$$base" | sed "s|^$$srcdirstrip/||"`;; \ + esac; \ if test -f $$base; then d=.; else d=$(srcdir); fi; \ - for file in `cd $$d && eval echo $$base*`; do \ - test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file; \ + for file in $$d/$$base*; do \ + relfile=`expr "$$file" : "$$d/\(.*\)"`; \ + test -f $(distdir)/$$relfile || \ + cp -p $$file $(distdir)/$$relfile; \ done; \ done mostlyclean-aminfo: - -rm -f binutils.aux binutils.cp binutils.cps binutils.dvi binutils.fn \ - binutils.fns binutils.ky binutils.kys binutils.ps \ - binutils.log binutils.pg binutils.toc binutils.tp \ - binutils.tps binutils.vr binutils.vrs binutils.op binutils.tr \ - binutils.cv binutils.cn - -clean-aminfo: - -distclean-aminfo: + -rm -rf binutils.aux binutils.cp binutils.cps binutils.fn binutils.fns \ + binutils.ky binutils.log binutils.pg binutils.pgs \ + binutils.tmp binutils.toc binutils.tp binutils.tps \ + binutils.vr binutils.vrs binutils.dvi binutils.pdf \ + binutils.ps binutils.html maintainer-clean-aminfo: - for i in $(INFO_DEPS); do \ - rm -f $$i; \ - if test "`echo $$i-[0-9]*`" != "$$i-[0-9]*"; then \ - rm -f $$i-[0-9]*; \ - fi; \ + @list='$(INFO_DEPS)'; for i in $$list; do \ + i_i=`echo "$$i" | sed 's|\.info$$||;s|$$|.i|'`; \ + echo " rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]"; \ + rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]; \ done -clean-info: mostlyclean-aminfo -install-man1: - $(mkinstalldirs) $(DESTDIR)$(man1dir) - @list='$(man1_MANS)'; \ - l2='$(man_MANS)'; for i in $$l2; do \ +clean-info: mostlyclean-aminfo +install-man1: $(man1_MANS) $(man_MANS) + @$(NORMAL_INSTALL) + test -z "$(man1dir)" || $(mkdir_p) "$(DESTDIR)$(man1dir)" + @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ + l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ + for i in $$l2; do \ case "$$i" in \ *.1*) list="$$list $$i" ;; \ esac; \ @@ -316,224 +404,270 @@ install-man1: if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ else file=$$i; fi; \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + case "$$ext" in \ + 1*) ;; \ + *) ext='1' ;; \ + esac; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ - echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst"; \ - $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst; \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \ done - uninstall-man1: - @list='$(man1_MANS)'; \ - l2='$(man_MANS)'; for i in $$l2; do \ + @$(NORMAL_UNINSTALL) + @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ + l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ + for i in $$l2; do \ case "$$i" in \ *.1*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + case "$$ext" in \ + 1*) ;; \ + *) ext='1' ;; \ + esac; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ - echo " rm -f $(DESTDIR)$(man1dir)/$$inst"; \ - rm -f $(DESTDIR)$(man1dir)/$$inst; \ + echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \ + rm -f "$(DESTDIR)$(man1dir)/$$inst"; \ done -install-man: $(MANS) - @$(NORMAL_INSTALL) - $(MAKE) $(AM_MAKEFLAGS) install-man1 -uninstall-man: - @$(NORMAL_UNINSTALL) - $(MAKE) $(AM_MAKEFLAGS) uninstall-man1 tags: TAGS TAGS: +ctags: CTAGS +CTAGS: -distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) - -subdir = doc - -distdir: $(DISTFILES) - @for file in $(DISTFILES); do \ - if test -f $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - cp -pr $$d/$$file $(distdir)/$$file; \ - else \ - test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file || :; \ - fi; \ - done - $(MAKE) $(AM_MAKEFLAGS) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-info -info-am: $(INFO_DEPS) -info: info-am -dvi-am: $(DVIS) -dvi: dvi-am check-am: check: check-am -installcheck-am: -installcheck: installcheck-am -install-info-am: -install-info: install-info-am -install-exec-am: +all-am: Makefile $(MANS) +installdirs: + for dir in "$(DESTDIR)$(man1dir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-am install-exec: install-exec-am - -install-data-am: install-man install-data: install-data-am +uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -install: install-am -uninstall-am: uninstall-man -uninstall: uninstall-am -all-am: Makefile $(MANS) -all-redirect: all-am + +installcheck: installcheck-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install -installdirs: - $(mkinstalldirs) $(DESTDIR)$(mandir)/man1 - - + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) clean-generic: distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) - -rm -f config.cache config.log stamp-h stamp-h[0-9]* - -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) -mostlyclean-am: mostlyclean-aminfo mostlyclean-generic +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-libtool + +dvi: dvi-am + +dvi-am: $(DVIS) + +html: html-am + +html-am: $(HTMLS) + +info: info-am + +info-am: $(INFO_DEPS) info-local + +install-data-am: install-data-local install-man + +install-exec-am: + +install-info: install-info-am + +install-info-am: $(INFO_DEPS) + @$(NORMAL_INSTALL) + test -z "$(infodir)" || $(mkdir_p) "$(DESTDIR)$(infodir)" + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + list='$(INFO_DEPS)'; \ + for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + esac; \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ + file_i=`echo "$$file" | sed 's|\.info$$||;s|$$|.i|'`; \ + for ifile in $$d/$$file $$d/$$file-[0-9] $$d/$$file-[0-9][0-9] \ + $$d/$$file_i[0-9] $$d/$$file_i[0-9][0-9] ; do \ + if test -f $$ifile; then \ + relfile=`echo "$$ifile" | sed 's|^.*/||'`; \ + echo " $(INSTALL_DATA) '$$ifile' '$(DESTDIR)$(infodir)/$$relfile'"; \ + $(INSTALL_DATA) "$$ifile" "$(DESTDIR)$(infodir)/$$relfile"; \ + else : ; fi; \ + done; \ + done + @$(POST_INSTALL) + @if (install-info --version && \ + install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \ + list='$(INFO_DEPS)'; \ + for file in $$list; do \ + relfile=`echo "$$file" | sed 's|^.*/||'`; \ + echo " install-info --info-dir='$(DESTDIR)$(infodir)' '$(DESTDIR)$(infodir)/$$relfile'";\ + install-info --info-dir="$(DESTDIR)$(infodir)" "$(DESTDIR)$(infodir)/$$relfile" || :;\ + done; \ + else : ; fi +install-man: install-man1 + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-aminfo \ + maintainer-clean-generic mostlyclean: mostlyclean-am -clean-am: clean-aminfo clean-generic mostlyclean-am +mostlyclean-am: mostlyclean-aminfo mostlyclean-generic \ + mostlyclean-libtool -clean: clean-am +pdf: pdf-am -distclean-am: distclean-aminfo distclean-generic clean-am - -rm -f libtool +pdf-am: $(PDFS) -distclean: distclean-am +ps: ps-am -maintainer-clean-am: maintainer-clean-aminfo maintainer-clean-generic \ - distclean-am - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." +ps-am: $(PSS) -maintainer-clean: maintainer-clean-am +uninstall-am: uninstall-man -.PHONY: install-info-am uninstall-info mostlyclean-aminfo \ -distclean-aminfo clean-aminfo maintainer-clean-aminfo install-man1 \ -uninstall-man1 install-man uninstall-man tags distdir info-am info \ -dvi-am dvi check check-am installcheck-am installcheck install-info-am \ -install-info install-exec-am install-exec install-data-am install-data \ -install-am install uninstall-am uninstall all-redirect all-am all \ -installdirs mostlyclean-generic distclean-generic clean-generic \ -maintainer-clean-generic clean mostlyclean distclean maintainer-clean +uninstall-man: uninstall-man1 + +.PHONY: all all-am check check-am clean clean-generic clean-info \ + clean-libtool dist-info distclean distclean-generic \ + distclean-libtool dvi dvi-am html html-am info info-am \ + info-local install install-am install-data install-data-am \ + install-data-local install-exec install-exec-am install-info \ + install-info-am install-man install-man1 install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-aminfo maintainer-clean-generic mostlyclean \ + mostlyclean-aminfo mostlyclean-generic mostlyclean-libtool pdf \ + pdf-am ps ps-am uninstall uninstall-am uninstall-info-am \ + uninstall-man uninstall-man1 -config.texi: Makefile +config.texi: $(srcdir)/../../bfd/configure $(binutils_TEXI) rm -f config.texi - echo '@set VERSION $(VERSION)' > config.texi - -binutils.dvi: $(binutils_TEXI) config.texi - -binutils.info: $(binutils_TEXI) config.texi + eval `grep '^ *VERSION=' $(srcdir)/../../bfd/configure`; \ + echo "@set VERSION $$VERSION" > $@ + echo "@set UPDATED `date "+%B %Y"`" >> config.texi # Man page generation from texinfo -addr2line.1: $(binutils_TEXI) +addr2line.1: $(binutils_TEXI) $(binutils_TEXINFOS) touch $@ -$(TEXI2POD) $(MANCONF) -Daddr2line < $(binutils_TEXI) > addr2line.pod -($(POD2MAN) addr2line.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \ mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1) rm -f addr2line.pod -ar.1: $(binutils_TEXI) +ar.1: $(binutils_TEXI) $(binutils_TEXINFOS) touch $@ -$(TEXI2POD) $(MANCONF) -Dar < $(binutils_TEXI) > ar.pod -($(POD2MAN) ar.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \ mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1) rm -f ar.pod -dlltool.1: $(binutils_TEXI) +dlltool.1: $(binutils_TEXI) $(binutils_TEXINFOS) touch $@ -$(TEXI2POD) $(MANCONF) -Ddlltool < $(binutils_TEXI) > dlltool.pod -($(POD2MAN) dlltool.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \ mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1) rm -f dlltool.pod -nlmconv.1: $(binutils_TEXI) +nlmconv.1: $(binutils_TEXI) $(binutils_TEXINFOS) touch $@ -$(TEXI2POD) $(MANCONF) -Dnlmconv < $(binutils_TEXI) > nlmconv.pod -($(POD2MAN) nlmconv.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \ mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1) rm -f nlmconv.pod -nm.1: $(binutils_TEXI) +nm.1: $(binutils_TEXI) $(binutils_TEXINFOS) touch $@ -$(TEXI2POD) $(MANCONF) -Dnm < $(binutils_TEXI) > nm.pod -($(POD2MAN) nm.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \ mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1) rm -f nm.pod -objcopy.1: $(binutils_TEXI) +objcopy.1: $(binutils_TEXI) $(binutils_TEXINFOS) touch $@ -$(TEXI2POD) $(MANCONF) -Dobjcopy < $(binutils_TEXI) > objcopy.pod -($(POD2MAN) objcopy.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \ mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1) rm -f objcopy.pod -objdump.1: $(binutils_TEXI) +objdump.1: $(binutils_TEXI) $(binutils_TEXINFOS) touch $@ -$(TEXI2POD) $(MANCONF) -Dobjdump < $(binutils_TEXI) > objdump.pod -($(POD2MAN) objdump.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \ mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1) rm -f objdump.pod -ranlib.1: $(binutils_TEXI) +ranlib.1: $(binutils_TEXI) $(binutils_TEXINFOS) touch $@ -$(TEXI2POD) $(MANCONF) -Dranlib < $(binutils_TEXI) > ranlib.pod -($(POD2MAN) ranlib.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \ mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1) rm -f ranlib.pod -readelf.1: $(binutils_TEXI) +readelf.1: $(binutils_TEXI) $(binutils_TEXINFOS) touch $@ -$(TEXI2POD) $(MANCONF) -Dreadelf < $(binutils_TEXI) > readelf.pod -($(POD2MAN) readelf.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \ mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1) rm -f readelf.pod -size.1: $(binutils_TEXI) +size.1: $(binutils_TEXI) $(binutils_TEXINFOS) touch $@ -$(TEXI2POD) $(MANCONF) -Dsize < $(binutils_TEXI) > size.pod -($(POD2MAN) size.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \ mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1) rm -f size.pod -strings.1: $(binutils_TEXI) +strings.1: $(binutils_TEXI) $(binutils_TEXINFOS) touch $@ -$(TEXI2POD) $(MANCONF) -Dstrings < $(binutils_TEXI) > strings.pod -($(POD2MAN) strings.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \ mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1) rm -f strings.pod -strip.1: $(binutils_TEXI) +strip.1: $(binutils_TEXI) $(binutils_TEXINFOS) touch $@ -$(TEXI2POD) $(MANCONF) -Dstrip < $(binutils_TEXI) > strip.pod -($(POD2MAN) strip.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \ mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1) rm -f strip.pod -windres.1: $(binutils_TEXI) +windres.1: $(binutils_TEXI) $(binutils_TEXINFOS) touch $@ -$(TEXI2POD) $(MANCONF) -Dwindres < $(binutils_TEXI) > windres.pod -($(POD2MAN) windres.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \ mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1) rm -f windres.pod -cxxfilt.man: $(binutils_TEXI) +cxxfilt.man: $(binutils_TEXI) $(binutils_TEXINFOS) touch $@ -$(TEXI2POD) $(MANCONF) -Dcxxfilt < $(binutils_TEXI) > $(DEMANGLER_NAME).pod -($(POD2MAN) $(DEMANGLER_NAME).pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \ @@ -552,13 +686,31 @@ $(DEMANGLER_NAME).1: cxxfilt.man Makefile # We want install to imply install-info as per GNU standards, despite the # cygnus option. -install: install-info +install-data-local: install-info + +install-html: install-html-am + +install-html-am: $(HTMLS) + @$(NORMAL_INSTALL) + test -z "$(htmldir)" || $(mkdir_p) "$(DESTDIR)$(htmldir)" + @list='$(HTMLS)'; for p in $$list; do \ + if test -f "$$p" || test -d "$$p"; then d=""; else d="$(srcdir)/"; fi; \ + f=$(html__strip_dir) \ + if test -d "$$d$$p"; then \ + echo " $(mkdir_p) '$(DESTDIR)$(htmldir)/$$f'"; \ + $(mkdir_p) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \ + echo " $(INSTALL_DATA) '$$d$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \ + $(INSTALL_DATA) "$$d$$p"/* "$(DESTDIR)$(htmldir)/$$f"; \ + else \ + echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(htmldir)/$$f'"; \ + $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(htmldir)/$$f"; \ + fi; \ + done # Maintenance # We need it for the taz target in ../../Makefile.in. -info: $(MANS) - +info-local: $(MANS) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/contrib/binutils/binutils/doc/addr2line.1 b/contrib/binutils/binutils/doc/addr2line.1 index 5808d6588f0..71d1ea76398 100644 --- a/contrib/binutils/binutils/doc/addr2line.1 +++ b/contrib/binutils/binutils/doc/addr2line.1 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14 +.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32 .\" .\" Standard preamble: .\" ======================================================================== @@ -25,11 +25,11 @@ .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left -.\" double quote, and \*(R" will give a right double quote. | will give a -.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to -.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' -.\" expand to `' in nroff, nothing in troff, for use with C<>. -.tr \(*W-|\(bv\*(Tr +.\" double quote, and \*(R" will give a right double quote. \*(C+ will +.\" give a nicer C++. Capital omega is used to do unbreakable dashes and +.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, +.\" nothing in troff, for use with C<>. +.tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- @@ -128,7 +128,7 @@ .\" ======================================================================== .\" .IX Title "ADDR2LINE 1" -.TH ADDR2LINE 1 "2004-04-09" "binutils-2.14.91" "GNU Development Tools" +.TH ADDR2LINE 1 "2006-06-23" "binutils-2.17" "GNU Development Tools" .SH "NAME" addr2line \- convert addresses into file names and line numbers. .SH "SYNOPSIS" @@ -137,17 +137,20 @@ addr2line [\fB\-b\fR \fIbfdname\fR|\fB\-\-target=\fR\fIbfdname\fR] [\fB\-C\fR|\fB\-\-demangle\fR[=\fIstyle\fR]] [\fB\-e\fR \fIfilename\fR|\fB\-\-exe=\fR\fIfilename\fR] [\fB\-f\fR|\fB\-\-functions\fR] [\fB\-s\fR|\fB\-\-basename\fR] + [\fB\-i\fR|\fB\-\-inlines\fR] + [\fB\-j\fR|\fB\-\-section=\fR\fIname\fR] [\fB\-H\fR|\fB\-\-help\fR] [\fB\-V\fR|\fB\-\-version\fR] [addr addr ...] .SH "DESCRIPTION" .IX Header "DESCRIPTION" -\&\fBaddr2line\fR translates program addresses into file names and line -numbers. Given an address and an executable, it uses the debugging -information in the executable to figure out which file name and line -number are associated with a given address. +\&\fBaddr2line\fR translates addresses into file names and line numbers. +Given an address in an executable or an offset in a section of a relocatable +object, it uses the debugging information to figure out which file name and +line number are associated with it. .PP -The executable to use is specified with the \fB\-e\fR option. The -default is the file \fIa.out\fR. +The executable or relocatable object to use is specified with the \fB\-e\fR +option. The default is the file \fIa.out\fR. The section in the relocatable +object to use is specified with the \fB\-j\fR option. .PP \&\fBaddr2line\fR has two modes of operation. .PP @@ -214,17 +217,49 @@ Display function names as well as file and line number information. .IX Item "--basenames" .PD Display only the base of each file name. +.IP "\fB\-i\fR" 4 +.IX Item "-i" +.PD 0 +.IP "\fB\-\-inlines\fR" 4 +.IX Item "--inlines" +.PD +If the address belongs to a function that was inlined, the source +information for all enclosing scopes back to the first non-inlined +function will also be printed. For example, if \f(CW\*(C`main\*(C'\fR inlines +\&\f(CW\*(C`callee1\*(C'\fR which inlines \f(CW\*(C`callee2\*(C'\fR, and address is from +\&\f(CW\*(C`callee2\*(C'\fR, the source information for \f(CW\*(C`callee1\*(C'\fR and \f(CW\*(C`main\*(C'\fR +will also be printed. +.IP "\fB\-j\fR" 4 +.IX Item "-j" +.PD 0 +.IP "\fB\-\-section\fR" 4 +.IX Item "--section" +.PD +Read offsets relative to the specified section instead of absolute addresses. +.IP "\fB@\fR\fIfile\fR" 4 +.IX Item "@file" +Read command-line options from \fIfile\fR. The options read are +inserted in place of the original @\fIfile\fR option. If \fIfile\fR +does not exist, or cannot be read, then the option will be treated +literally, and not removed. +.Sp +Options in \fIfile\fR are separated by whitespace. A whitespace +character may be included in an option by surrounding the entire +option in either single or double quotes. Any character (including a +backslash) may be included by prefixing the character to be included +with a backslash. The \fIfile\fR may itself contain additional +@\fIfile\fR options; any such options will be processed recursively. .SH "SEE ALSO" .IX Header "SEE ALSO" Info entries for \fIbinutils\fR. .SH "COPYRIGHT" .IX Header "COPYRIGHT" -Copyright (c) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, -2001, 2002, 2003 Free Software Foundation, Inc. +Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. .PP Permission is granted to copy, distribute and/or modify this document under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the -section entitled ``\s-1GNU\s0 Free Documentation License''. +section entitled \*(L"\s-1GNU\s0 Free Documentation License\*(R". diff --git a/contrib/binutils/binutils/doc/ar.1 b/contrib/binutils/binutils/doc/ar.1 index 6708cf43bc7..5985ca15e44 100644 --- a/contrib/binutils/binutils/doc/ar.1 +++ b/contrib/binutils/binutils/doc/ar.1 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14 +.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32 .\" .\" Standard preamble: .\" ======================================================================== @@ -25,11 +25,11 @@ .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left -.\" double quote, and \*(R" will give a right double quote. | will give a -.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to -.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' -.\" expand to `' in nroff, nothing in troff, for use with C<>. -.tr \(*W-|\(bv\*(Tr +.\" double quote, and \*(R" will give a right double quote. \*(C+ will +.\" give a nicer C++. Capital omega is used to do unbreakable dashes and +.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, +.\" nothing in troff, for use with C<>. +.tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- @@ -128,7 +128,7 @@ .\" ======================================================================== .\" .IX Title "AR 1" -.TH AR 1 "2004-04-09" "binutils-2.14.91" "GNU Development Tools" +.TH AR 1 "2006-06-23" "binutils-2.17" "GNU Development Tools" .SH "NAME" ar \- create, modify, and extract from archives .SH "SYNOPSIS" @@ -172,7 +172,7 @@ table. If an archive lacks the table, another form of \fBar\fR called facilities. You can control its activity using command-line options, like the different varieties of \fBar\fR on Unix systems; or, if you specify the single command-line option \fB\-M\fR, you can control it -with a script supplied via standard input, like the \s-1MRI\s0 ``librarian'' +with a script supplied via standard input, like the \s-1MRI\s0 \*(L"librarian\*(R" program. .SH "OPTIONS" .IX Header "OPTIONS" @@ -361,17 +361,30 @@ compatibility with \s-1AIX\s0. The behaviour produced by this option is the default for \s-1GNU\s0 \fBar\fR. \fBar\fR does not support any of the other \&\fB\-X\fR options; in particular, it does not support \fB\-X32\fR which is the default for \s-1AIX\s0 \fBar\fR. +.IP "\fB@\fR\fIfile\fR" 4 +.IX Item "@file" +Read command-line options from \fIfile\fR. The options read are +inserted in place of the original @\fIfile\fR option. If \fIfile\fR +does not exist, or cannot be read, then the option will be treated +literally, and not removed. +.Sp +Options in \fIfile\fR are separated by whitespace. A whitespace +character may be included in an option by surrounding the entire +option in either single or double quotes. Any character (including a +backslash) may be included by prefixing the character to be included +with a backslash. The \fIfile\fR may itself contain additional +@\fIfile\fR options; any such options will be processed recursively. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fInm\fR\|(1), \fIranlib\fR\|(1), and the Info entries for \fIbinutils\fR. .SH "COPYRIGHT" .IX Header "COPYRIGHT" -Copyright (c) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, -2001, 2002, 2003 Free Software Foundation, Inc. +Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. .PP Permission is granted to copy, distribute and/or modify this document under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the -section entitled ``\s-1GNU\s0 Free Documentation License''. +section entitled \*(L"\s-1GNU\s0 Free Documentation License\*(R". diff --git a/contrib/binutils/binutils/doc/binutils.texi b/contrib/binutils/binutils/doc/binutils.texi index 2e787202985..be571d2a7cc 100644 --- a/contrib/binutils/binutils/doc/binutils.texi +++ b/contrib/binutils/binutils/doc/binutils.texi @@ -1,8 +1,10 @@ \input texinfo @c -*- Texinfo -*- @setfilename binutils.info -@c Copyright 2001, 2002, 2003 Free Software Foundation, Inc. +@c Copyright 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +@c man begin INCLUDE @include config.texi +@c man end @ifinfo @format @@ -29,8 +31,8 @@ END-INFO-DIR-ENTRY @ifinfo @c man begin COPYRIGHT -Copyright @copyright{} 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, -2001, 2002, 2003 Free Software Foundation, Inc. +Copyright @copyright{} 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 @@ -54,8 +56,8 @@ notice identical to this one except for the removal of this paragraph @c This file documents the GNU binary utilities "ar", "ld", "objcopy", @c "objdump", "nm", "size", "strings", "strip", "readelf" and "ranlib". @c -@c Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001, -@c 2002, 2003 Free Software Foundation, Inc. +@c Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +@c 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. @c @c This text may be freely distributed under the terms of the GNU @c Free Documentation License. @@ -68,7 +70,7 @@ notice identical to this one except for the removal of this paragraph @title The @sc{gnu} Binary Utilities @subtitle Version @value{VERSION} @sp 1 -@subtitle May 1993 +@subtitle @value{UPDATED} @author Roland H. Pesch @author Jeffrey M. Osier @author Cygnus Support @@ -80,8 +82,8 @@ notice identical to this one except for the removal of this paragraph @end tex @vskip 0pt plus 1filll -Copyright @copyright{} 1991, 92, 93, 94, 95, 96, 97, 1998, 2000, 2001, -2002, 2003 Free Software Foundation, Inc. +Copyright @copyright{} 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, +2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 @@ -166,6 +168,7 @@ section entitled "GNU Free Documentation License". * nlmconv:: Converts object code into an NLM * windres:: Manipulate Windows resources * dlltool:: Create files needed to build and use DLLs +* Common Options:: Command-line options for all utilities * Selecting The Target System:: How these utilities determine the target. * Reporting Bugs:: Reporting Bugs * GNU Free Documentation License:: GNU Free Documentation License @@ -663,7 +666,7 @@ The @sc{gnu} linker @command{ld} is now described in a separate manual. nm [@option{-a}|@option{--debug-syms}] [@option{-g}|@option{--extern-only}] [@option{-B}] [@option{-C}|@option{--demangle}[=@var{style}]] [@option{-D}|@option{--dynamic}] [@option{-S}|@option{--print-size}] [@option{-s}|@option{--print-armap}] - [@option{-A}|@option{-o}|@option{--print-file-name}] + [@option{-A}|@option{-o}|@option{--print-file-name}][@option{--special-syms}] [@option{-n}|@option{-v}|@option{--numeric-sort}] [@option{-p}|@option{--no-sort}] [@option{-r}|@option{--reverse-sort}] [@option{--size-sort}] [@option{-u}|@option{--undefined-only}] [@option{-t} @var{radix}|@option{--radix=}@var{radix}] [@option{-P}|@option{--portability}] @@ -748,7 +751,10 @@ The symbol is a weak symbol that has not been specifically tagged as a weak object symbol. When a weak defined symbol is linked with a normal defined symbol, the normal defined symbol is used with no error. When a weak undefined symbol is linked and the symbol is not defined, -the value of the weak symbol becomes zero with no error. +the value of the symbol is determined in a system-specific manner without +error. On some systems, uppercase indicates that a default value has been +specified. + @item - The symbol is a stabs symbol in an a.out object file. In this case, the @@ -878,6 +884,14 @@ value. If the @code{bsd} output format is used the size of the symbol is printed, rather than the value, and @samp{-S} must be used in order both size and value to be printed. +@item --special-syms +Display symbols which have a target-specific special meaning. These +symbols are usually used by the target for some special processing and +are not normally helpful when included included in the normal symbol +lists. For example for ARM targets this option would skip the mapping +symbols used to mark transistions between ARM code, THUMB code and +data. + @item -t @var{radix} @itemx --radix=@var{radix} Use @var{radix} as the radix for printing the symbol values. It must be @@ -936,8 +950,10 @@ objcopy [@option{-F} @var{bfdname}|@option{--target=}@var{bfdname}] [@option{-g}|@option{--strip-debug}] [@option{-K} @var{symbolname}|@option{--keep-symbol=}@var{symbolname}] [@option{-N} @var{symbolname}|@option{--strip-symbol=}@var{symbolname}] + [@option{--strip-unneeded-symbol=}@var{symbolname}] [@option{-G} @var{symbolname}|@option{--keep-global-symbol=}@var{symbolname}] [@option{-L} @var{symbolname}|@option{--localize-symbol=}@var{symbolname}] + [@option{--globalize-symbol=}@var{symbolname}] [@option{-W} @var{symbolname}|@option{--weaken-symbol=}@var{symbolname}] [@option{-w}|@option{--wildcard}] [@option{-x}|@option{--discard-all}] @@ -967,14 +983,17 @@ objcopy [@option{-F} @var{bfdname}|@option{--target=}@var{bfdname}] [@option{--weaken}] [@option{--keep-symbols=}@var{filename}] [@option{--strip-symbols=}@var{filename}] + [@option{--strip-unneeded-symbols=}@var{filename}] [@option{--keep-global-symbols=}@var{filename}] [@option{--localize-symbols=}@var{filename}] + [@option{--globalize-symbols=}@var{filename}] [@option{--weaken-symbols=}@var{filename}] [@option{--alt-machine-code=}@var{index}] [@option{--prefix-symbols=}@var{string}] [@option{--prefix-sections=}@var{string}] [@option{--prefix-alloc-sections=}@var{string}] [@option{--add-gnu-debuglink=}@var{path-to-file}] + [@option{--keep-file-symbols}] [@option{--only-keep-debug}] [@option{--writable-text}] [@option{--readonly-text}] @@ -1087,14 +1106,18 @@ Strip all symbols that are not needed for relocation processing. @item -K @var{symbolname} @itemx --keep-symbol=@var{symbolname} -Copy only symbol @var{symbolname} from the source file. This option may -be given more than once. +When stripping symbols, keep symbol @var{symbolname} even if it would +normally be stripped. This option may be given more than once. @item -N @var{symbolname} @itemx --strip-symbol=@var{symbolname} Do not copy symbol @var{symbolname} from the source file. This option may be given more than once. +@item --strip-unneeded-symbol=@var{symbolname} +Do not copy symbol @var{symbolname} from the source file unless it is needed +by a relocation. This option may be given more than once. + @item -G @var{symbolname} @itemx --keep-global-symbol=@var{symbolname} Keep only symbol @var{symbolname} global. Make all other symbols local @@ -1110,6 +1133,11 @@ visible externally. This option may be given more than once. @itemx --weaken-symbol=@var{symbolname} Make symbol @var{symbolname} weak. This option may be given more than once. +@item --globalize-symbol=@var{symbolname} +Give symbol @var{symbolname} global scoping so that it is visible +outside of the file in which it is defined. This option may be given +more than once. + @item -w @itemx --wildcard Permit regular expressions in @var{symbolname}s used in other command @@ -1336,6 +1364,12 @@ Apply @option{--strip-symbol} option to each symbol listed in the file name per line. Line comments may be introduced by the hash character. This option may be given more than once. +@item --strip-unneeded-symbols=@var{filename} +Apply @option{--strip-unneeded-symbol} option to each symbol listed in +the file @var{filename}. @var{filename} is simply a flat file, with one +symbol name per line. Line comments may be introduced by the hash +character. This option may be given more than once. + @item --keep-global-symbols=@var{filename} Apply @option{--keep-global-symbol} option to each symbol listed in the file @var{filename}. @var{filename} is simply a flat file, with one @@ -1348,6 +1382,12 @@ Apply @option{--localize-symbol} option to each symbol listed in the file name per line. Line comments may be introduced by the hash character. This option may be given more than once. +@item --globalize-symbols=@var{filename} +Apply @option{--globalize-symbol} option to each symbol listed in the file +@var{filename}. @var{filename} is simply a flat file, with one symbol +name per line. Line comments may be introduced by the hash character. +This option may be given more than once. + @item --weaken-symbols=@var{filename} Apply @option{--weaken-symbol} option to each symbol listed in the file @var{filename}. @var{filename} is simply a flat file, with one symbol @@ -1359,7 +1399,9 @@ If the output architecture has alternate machine codes, use the @var{index}th code instead of the default one. This is useful in case a machine is assigned an official code and the tool-chain adopts the new code, but other applications still depend on the original code -being used. +being used. For ELF based architectures if the @var{index} +alternative does not exist then the value is treated as an absolute +number to be stored in the e_machine field of the ELF header. @item --writable-text Mark the output text as writable. This option isn't meaningful for all @@ -1391,9 +1433,15 @@ Prefix all the names of all allocated sections in the output file with Creates a .gnu_debuglink section which contains a reference to @var{path-to-file} and adds it to the output file. +@item --keep-file-symbols +When stripping a file, perhaps with @option{--strip-debug} or +@option{--strip-unneeded}, retain any symbols specifying source file names, +which would otherwise get stripped. + @item --only-keep-debug -Strip a file, removing any sections that would be stripped by -@option{--strip-debug} and leaving the debugging sections. +Strip a file, removing contents of any sections that would not be +stripped by @option{--strip-debug} and leaving the debugging sections +intact. The intention is that this option will be used in conjunction with @option{--add-gnu-debuglink} to create a two part executable. One a @@ -1424,7 +1472,7 @@ optional. You could instead do this: @item Run @code{objcopy --add-gnu-debuglink=foo.full foo} @end enumerate -ie the file pointed to by the @option{--add-gnu-debuglink} can be the +i.e. the file pointed to by the @option{--add-gnu-debuglink} can be the full executable. It does not have to be a file created by the @option{--only-keep-debug} switch. @@ -1484,6 +1532,7 @@ objdump [@option{-a}|@option{--archive-headers}] [@option{-r}|@option{--reloc}] [@option{-R}|@option{--dynamic-reloc}] [@option{-s}|@option{--full-contents}] + [@option{-W}|@option{--dwarf}] [@option{-G}|@option{--stabs}] [@option{-t}|@option{--syms}] [@option{-T}|@option{--dynamic-syms}] @@ -1494,6 +1543,7 @@ objdump [@option{-a}|@option{--archive-headers}] [@option{--prefix-addresses}] [@option{--[no-]show-raw-insn}] [@option{--adjust-vma=}@var{offset}] + [@option{--special-syms}] [@option{-V}|@option{--version}] [@option{-H}|@option{--help}] @var{objfile}@dots{} @@ -1674,7 +1724,7 @@ can be placed together into a comma separated list. If the target is an ARM architecture then this switch can be used to select which register name set is used during disassembler. Specifying -@option{-M reg-name-std} (the default) will select the register names as +@option{-M reg-names-std} (the default) will select the register names as used in ARM's instruction set documentation, but with register 13 called 'sp', register 14 called 'lr' and register 15 called 'pc'. Specifying @option{-M reg-names-apcs} will select the name set used by the ARM @@ -1707,14 +1757,20 @@ suffix could be inferred by the operands. For PPC, @option{booke}, @option{booke32} and @option{booke64} select disassembly of BookE instructions. @option{32} and @option{64} select -PowerPC and PowerPC64 disassembly, respectively. +PowerPC and PowerPC64 disassembly, respectively. @option{e300} selects +disassembly for the e300 family. -For MIPS, this option controls the printing of register names in -disassembled instructions. Multiple selections from the -following may be specified as a comma separated string, and invalid -options are ignored: +For MIPS, this option controls the printing of instruction mneumonic +names and register names in disassembled instructions. Multiple +selections from the following may be specified as a comma separated +string, and invalid options are ignored: @table @code +@item no-aliases +Print the 'raw' instruction mneumonic instead of some pseudo +instruction mneumonic. I.E. print 'daddu' or 'or' instead of 'move', +'sll' instead of 'nop', etc. + @item gpr-names=@var{ABI} Print GPR (general-purpose register) names as appropriate for the specified ABI. By default, GPR names are selected according to @@ -1751,6 +1807,13 @@ rather than names, for the selected types of registers. You can list the available values of @var{ABI} and @var{ARCH} using the @option{--help} option. +For VAX, you can specify function entry addresses with @option{-M +entry:0xf00ba}. You can use this multiple times to properly +disassemble VAX binary files that don't contain symbol tables (like +ROM dumps). In these cases, the function entry mask would otherwise +be decoded as VAX instructions, which would probably lead the the rest +of the function being wrongly disassembled. + @item -p @itemx --private-headers Print information that is specific to the object file format. The exact @@ -1794,6 +1857,13 @@ in symbolic form. This is the default except when When disassembling instructions, do not print the instruction bytes. This is the default when @option{--prefix-addresses} is used. +@item -W +@itemx --dwarf +@cindex DWARF +@cindex debug symbols +Displays the contents of the DWARF debug sections in the file, if any +are present. + @item -G @itemx --stabs @cindex stab @@ -1836,6 +1906,11 @@ meaningful for dynamic objects, such as certain types of shared libraries. This is similar to the information provided by the @samp{nm} program when given the @option{-D} (@option{--dynamic}) option. +@item --special-syms +When displaying symbols include those which the target considers to be +special in some way and which would not normally be of interest to the +user. + @item -V @itemx --version Print the version number of @command{objdump} and exit. @@ -1846,7 +1921,7 @@ Print the version number of @command{objdump} and exit. @cindex header information, all Display all available header information, including the symbol table and relocation entries. Using @option{-x} is equivalent to specifying all of -@option{-a -f -h -r -t}. +@option{-a -f -h -p -r -t}. @item -w @itemx --wide @@ -2158,6 +2233,7 @@ strip [@option{-F} @var{bfdname} |@option{--target=}@var{bfdname}] [@option{-x}|@option{--discard-all}] [@option{-X} |@option{--discard-locals}] [@option{-R} @var{sectionname} |@option{--remove-section=}@var{sectionname}] [@option{-o} @var{file}] [@option{-p}|@option{--preserve-dates}] + [@option{--keep-file-symbols}] [@option{--only-keep-debug}] [@option{-v} |@option{--verbose}] [@option{-V}|@option{--version}] [@option{--help}] [@option{--info}] @@ -2223,8 +2299,8 @@ Remove all symbols that are not needed for relocation processing. @item -K @var{symbolname} @itemx --keep-symbol=@var{symbolname} -Keep only symbol @var{symbolname} from the source file. This option may -be given more than once. +When stripping symbols, keep symbol @var{symbolname} even if it would +normally be stripped. This option may be given more than once. @item -N @var{symbolname} @itemx --strip-symbol=@var{symbolname} @@ -2266,6 +2342,11 @@ Remove non-global symbols. Remove compiler-generated local symbols. (These usually start with @samp{L} or @samp{.}.) +@item --keep-file-symbols +When stripping a file, perhaps with @option{--strip-debug} or +@option{--strip-unneeded}, retain any symbols specifying source file names, +which would otherwise get stripped. + @item --only-keep-debug Strip a file, removing any sections that would be stripped by @option{--strip-debug} and leaving the debugging sections. @@ -2332,9 +2413,10 @@ the Info entries for @file{binutils}. @smallexample @c man begin SYNOPSIS cxxfilt c++filt [@option{-_}|@option{--strip-underscores}] - [@option{-j}|@option{--java}] [@option{-n}|@option{--no-strip-underscores}] [@option{-p}|@option{--no-params}] + [@option{-t}|@option{--types}] + [@option{-i}|@option{--no-verbose}] [@option{-s} @var{format}|@option{--format=}@var{format}] [@option{--help}] [@option{--version}] [@var{symbol}@dots{}] @c man end @@ -2343,31 +2425,67 @@ c++filt [@option{-_}|@option{--strip-underscores}] @c man begin DESCRIPTION cxxfilt @kindex cxxfilt -The C++ and Java languages provides function overloading, which means -that you can write many functions with the same name (providing each -takes parameters of different types). All C++ and Java function names -are encoded into a low-level assembly label (this process is known as -@dfn{mangling}). The @command{c++filt} -@footnote{MS-DOS does not allow @kbd{+} characters in file names, so on -MS-DOS this program is named @command{cxxfilt}.} +The C++ and Java languages provide function overloading, which means +that you can write many functions with the same name, providing that +each function takes parameters of different types. In order to be +able to distinguish these similarly named functions C++ and Java +encode them into a low-level assembler name which uniquely identifies +each different version. This process is known as @dfn{mangling}. The +@command{c++filt} +@footnote{MS-DOS does not allow @kbd{+} characters in file names, so on +MS-DOS this program is named @command{CXXFILT}.} program does the inverse mapping: it decodes (@dfn{demangles}) low-level -names into user-level names so that the linker can keep these overloaded -functions from clashing. +names into user-level names so that they can be read. Every alphanumeric word (consisting of letters, digits, underscores, -dollars, or periods) seen in the input is a potential label. If the -label decodes into a C++ name, the C++ name replaces the low-level -name in the output. +dollars, or periods) seen in the input is a potential mangled name. +If the name decodes into a C++ name, the C++ name replaces the +low-level name in the output, otherwise the original word is output. +In this way you can pass an entire assembler source file, containing +mangled names, through @command{c++filt} and see the same source file +containing demangled names. -You can use @command{c++filt} to decipher individual symbols: +You can also use @command{c++filt} to decipher individual symbols by +passing them on the command line: @example c++filt @var{symbol} @end example If no @var{symbol} arguments are given, @command{c++filt} reads symbol -names from the standard input and writes the demangled names to the -standard output. All results are printed on the standard output. +names from the standard input instead. All the results are printed on +the standard output. The difference between reading names from the +command line versus reading names from the standard input is that +command line arguments are expected to be just mangled names and no +checking is performed to seperate them from surrounding text. Thus +for example: + +@smallexample +c++filt -n _Z1fv +@end smallexample + +will work and demangle the name to ``f()'' whereas: + +@smallexample +c++filt -n _Z1fv, +@end smallexample + +will not work. (Note the extra comma at the end of the mangled +name which makes it invalid). This command however will work: + +@smallexample +echo _Z1fv, | c++filt -n +@end smallexample + +and will display ``f(),'' ie the demangled name followed by a +trailing comma. This behaviour is because when the names are read +from the standard input it is expected that they might be part of an +assembler source file where there might be extra, extraneous +characters trailing after a mangled name. eg: + +@smallexample + .type _Z1fv, @@function +@end smallexample @c man end @@ -2395,6 +2513,19 @@ Do not remove the initial underscore. When demangling the name of a function, do not display the types of the function's parameters. +@item -t +@itemx --types +Attempt to demangle types as well as function names. This is disabled +by default since mangled types are normally only used internally in +the compiler, and they can be confused with non-mangled names. eg +a function called ``a'' treated as a mangled type name would be +demangled to ``signed char''. + +@item -i +@itemx --no-verbose +Do not include implementation details (if any) in the demangled +output. + @item -s @var{format} @itemx --format=@var{format} @command{c++filt} can decode various methods of mangling, used by @@ -2469,6 +2600,8 @@ addr2line [@option{-b} @var{bfdname}|@option{--target=}@var{bfdname}] [@option{-C}|@option{--demangle}[=@var{style}]] [@option{-e} @var{filename}|@option{--exe=}@var{filename}] [@option{-f}|@option{--functions}] [@option{-s}|@option{--basename}] + [@option{-i}|@option{--inlines}] + [@option{-j}|@option{--section=}@var{name}] [@option{-H}|@option{--help}] [@option{-V}|@option{--version}] [addr addr @dots{}] @c man end @@ -2476,13 +2609,14 @@ addr2line [@option{-b} @var{bfdname}|@option{--target=}@var{bfdname}] @c man begin DESCRIPTION addr2line -@command{addr2line} translates program addresses into file names and line -numbers. Given an address and an executable, it uses the debugging -information in the executable to figure out which file name and line -number are associated with a given address. +@command{addr2line} translates addresses into file names and line numbers. +Given an address in an executable or an offset in a section of a relocatable +object, it uses the debugging information to figure out which file name and +line number are associated with it. -The executable to use is specified with the @option{-e} option. The -default is the file @file{a.out}. +The executable or relocatable object to use is specified with the @option{-e} +option. The default is the file @file{a.out}. The section in the relocatable +object to use is specified with the @option{-j} option. @command{addr2line} has two modes of operation. @@ -2541,6 +2675,19 @@ Display function names as well as file and line number information. @item -s @itemx --basenames Display only the base of each file name. + +@item -i +@itemx --inlines +If the address belongs to a function that was inlined, the source +information for all enclosing scopes back to the first non-inlined +function will also be printed. For example, if @code{main} inlines +@code{callee1} which inlines @code{callee2}, and address is from +@code{callee2}, the source information for @code{callee1} and @code{main} +will also be printed. + +@item -j +@itemx --section +Read offsets relative to the specified section instead of absolute addresses. @end table @c man end @@ -2837,16 +2984,25 @@ the Info entries for @file{binutils}. @end ignore @node dlltool -@chapter Create files needed to build and use DLLs +@chapter dlltool @cindex DLL @kindex dlltool -@command{dlltool} may be used to create the files needed to build and use -dynamic link libraries (DLLs). +@command{dlltool} is used to create the files needed to create dynamic +link libraries (DLLs) on systems which understand PE format image +files such as Windows. A DLL contains an export table which contains +information that the runtime loader needs to resolve references from a +referencing program. + +The export table is generated by this program by reading in a +@file{.def} file or scanning the @file{.a} and @file{.o} files which +will be in the DLL. A @file{.o} file can contain information in +special @samp{.drectve} sections with export information. @quotation -@emph{Warning:} @command{dlltool} is not always built as part of the binary -utilities, since it is only useful for those targets which support DLLs. +@emph{Note:} @command{dlltool} is not always built as part of the +binary utilities, since it is only useful for those targets which +support DLLs. @end quotation @c man title dlltool Create files needed to build and use DLLs. @@ -2863,8 +3019,10 @@ dlltool [@option{-d}|@option{--input-def} @var{def-file-name}] [@option{--no-default-excludes}] [@option{-S}|@option{--as} @var{path-to-assembler}] [@option{-f}|@option{--as-flags} @var{options}] [@option{-D}|@option{--dllname} @var{name}] [@option{-m}|@option{--machine} @var{machine}] - [@option{-a}|@option{--add-indirect}] [@option{-U}|@option{--add-underscore}] [@option{-k}|@option{--kill-at}] - [@option{-A}|@option{--add-stdcall-alias}] + [@option{-a}|@option{--add-indirect}] + [@option{-U}|@option{--add-underscore}] [@option{--add-stdcall-underscore}] + [@option{-k}|@option{--kill-at}] [@option{-A}|@option{--add-stdcall-alias}] + [@option{-p}|@option{--ext-prefix-alias} @var{prefix}] [@option{-x}|@option{--no-idata4}] [@option{-c}|@option{--no-idata5}] [@option{-i}|@option{--interwork}] [@option{-n}|@option{--nodelete}] [@option{-t}|@option{--temp-prefix} @var{prefix}] [@option{-v}|@option{--verbose}] @@ -2888,13 +3046,13 @@ When creating a DLL, along with the source for the DLL, it is necessary to have three other files. @command{dlltool} can help with the creation of these files. -The first file is a @samp{.def} file which specifies which functions are +The first file is a @file{.def} file which specifies which functions are exported from the DLL, which functions the DLL imports, and so on. This is a text file and can be created by hand, or @command{dlltool} can be used to create it using the @option{-z} option. In this case @command{dlltool} will scan the object files specified on its command line looking for those functions which have been specially marked as being exported and -put entries for them in the .def file it creates. +put entries for them in the @file{.def} file it creates. In order to mark a function as being exported from a DLL, it needs to have an @option{-export:} entry in the @samp{.drectve} @@ -2912,12 +3070,12 @@ The second file needed for DLL creation is an exports file. This file is linked with the object files that make up the body of the DLL and it handles the interface between the DLL and the outside world. This is a binary file and it can be created by giving the @option{-e} option to -@command{dlltool} when it is creating or reading in a .def file. +@command{dlltool} when it is creating or reading in a @file{.def} file. The third file needed for DLL creation is the library file that programs will link with in order to access the functions in the DLL. This file can be created by giving the @option{-l} option to dlltool when it -is creating or reading in a .def file. +is creating or reading in a @file{.def} file. @command{dlltool} builds the library file by hand, but it builds the exports file by creating temporary files containing assembler statements @@ -2951,7 +3109,7 @@ The command line options have the following meanings: @item -d @var{filename} @itemx --input-def @var{filename} @cindex input .def file -Specifies the name of a .def file to be read in and processed. +Specifies the name of a @file{.def} file to be read in and processed. @item -b @var{filename} @itemx --base-file @var{filename} @@ -2966,7 +3124,7 @@ Specifies the name of the export file to be created by dlltool. @item -z @var{filename} @itemx --output-def @var{filename} -Specifies the name of the .def file to be created by dlltool. +Specifies the name of the @file{.def} file to be created by dlltool. @item -l @var{filename} @itemx --output-lib @var{filename} @@ -2980,7 +3138,7 @@ option. You may add to the list of symbols to not export by using the @option{--exclude-symbols} option. @item --no-export-all-symbols -Only export symbols explicitly listed in an input .def file or in +Only export symbols explicitly listed in an input @file{.def} file or in @samp{.drectve} sections in the input object files. This is the default behaviour. The @samp{.drectve} sections are created by @samp{dllexport} attributes in the source code. @@ -3016,10 +3174,10 @@ double quotes. @item -D @var{name} @itemx --dll-name @var{name} -Specifies the name to be stored in the .def file as the name of the DLL -when the @option{-e} option is used. If this option is not present, then -the filename given to the @option{-e} option will be used as the name of -the DLL. +Specifies the name to be stored in the @file{.def} file as the name of +the DLL when the @option{-e} option is used. If this option is not +present, then the filename given to the @option{-e} option will be +used as the name of the DLL. @item -m @var{machine} @itemx -machine @var{machine} @@ -3039,7 +3197,14 @@ means! @item -U @itemx --add-underscore Specifies that when @command{dlltool} is creating the exports file it -should prepend an underscore to the names of the exported functions. +should prepend an underscore to the names of @emph{all} exported symbols. + +@item --add-stdcall-underscore +Specifies that when @command{dlltool} is creating the exports file it +should prepend an underscore to the names of exported @emph{stdcall} +functions. Variable names and non-stdcall function names are not modified. +This option is useful when creating GNU-compatible import libs for third +party DLLs that were built with MS-Windows tools. @item -k @itemx --kill-at @@ -3054,6 +3219,12 @@ Specifies that when @command{dlltool} is creating the exports file it should add aliases for stdcall symbols without @samp{@@ } in addition to the symbols with @samp{@@ }. +@item -p +@itemx --ext-prefix-alias @var{prefix} +Causes @command{dlltool} to create external aliases for all DLL +imports with the specified prefix. The aliases are created for both +external and import symbols with no leading underscore. + @item -x @itemx --no-idata4 Specifies that when @command{dlltool} is creating the exports and library @@ -3101,9 +3272,60 @@ Displays dlltool's version number and then exits. @c man end +@menu +* def file format:: The format of the dlltool @file{.def} file +@end menu + +@node def file format +@section The format of the @command{dlltool} @file{.def} file + +A @file{.def} file contains any number of the following commands: + +@table @asis + +@item @code{NAME} @var{name} @code{[ ,} @var{base} @code{]} +The result is going to be named @var{name}@code{.exe}. + +@item @code{LIBRARY} @var{name} @code{[ ,} @var{base} @code{]} +The result is going to be named @var{name}@code{.dll}. + +@item @code{EXPORTS ( ( (} @var{name1} @code{[ = } @var{name2} @code{] ) | ( } @var{name1} @code{=} @var{module-name} @code{.} @var{external-name} @code{) )} +@item @code{[} @var{integer} @code{] [ NONAME ] [ CONSTANT ] [ DATA ] [ PRIVATE ] ) *} +Declares @var{name1} as an exported symbol from the DLL, with optional +ordinal number @var{integer}, or declares @var{name1} as an alias +(forward) of the function @var{external-name} in the DLL +@var{module-name}. + +@item @code{IMPORTS ( (} @var{internal-name} @code{=} @var{module-name} @code{.} @var{integer} @code{) | [} @var{internal-name} @code{= ]} @var{module-name} @code{.} @var{external-name} @code{) ) *} +Declares that @var{external-name} or the exported function whose +ordinal number is @var{integer} is to be imported from the file +@var{module-name}. If @var{internal-name} is specified then this is +the name that the imported function will be referred to in the body of +the DLL. + +@item @code{DESCRIPTION} @var{string} +Puts @var{string} into the output @file{.exp} file in the +@code{.rdata} section. + +@item @code{STACKSIZE} @var{number-reserve} @code{[, } @var{number-commit} @code{]} +@item @code{HEAPSIZE} @var{number-reserve} @code{[, } @var{number-commit} @code{]} +Generates @code{--stack} or @code{--heap} +@var{number-reserve},@var{number-commit} in the output @code{.drectve} +section. The linker will see this and act upon it. + +@item @code{CODE} @var{attr} @code{+} +@item @code{DATA} @var{attr} @code{+} +@item @code{SECTIONS (} @var{section-name} @var{attr}@code{ + ) *} +Generates @code{--attr} @var{section-name} @var{attr} in the output +@code{.drectve} section, where @var{attr} is one of @code{READ}, +@code{WRITE}, @code{EXECUTE} or @code{SHARED}. The linker will see +this and act upon it. + +@end table + @ignore @c man begin SEEALSO dlltool -the Info entries for @file{binutils}. +The Info pages for @file{binutils}. @c man end @end ignore @@ -3121,6 +3343,8 @@ readelf [@option{-a}|@option{--all}] [@option{-h}|@option{--file-header}] [@option{-l}|@option{--program-headers}|@option{--segments}] [@option{-S}|@option{--section-headers}|@option{--sections}] + [@option{-g}|@option{--section-groups}] + [@option{-t}|@option{--section-details}] [@option{-e}|@option{--headers}] [@option{-s}|@option{--syms}|@option{--symbols}] [@option{-n}|@option{--notes}] @@ -3130,9 +3354,9 @@ readelf [@option{-a}|@option{--all}] [@option{-V}|@option{--version-info}] [@option{-A}|@option{--arch-specific}] [@option{-D}|@option{--use-dynamic}] - [@option{-x} |@option{--hex-dump=}] - [@option{-w[liaprmfFso]}| - @option{--debug-dump}[=line,=info,=abbrev,=pubnames,=ranges,=macro,=frames,=frames-interp,=str,=loc]] + [@option{-x} |@option{--hex-dump=}] + [@option{-w[liaprmfFsoR]}| + @option{--debug-dump}[=line,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=loc,=Ranges]] [@option{-I}|@option{-histogram}] [@option{-v}|@option{--version}] [@option{-W}|@option{--wide}] @@ -3191,6 +3415,17 @@ has any. Displays the information contained in the file's section headers, if it has any. +@item -g +@itemx --section-groups +@cindex ELF section group information +Displays the information contained in the file's section groups, if it +has any. + +@item -t +@itemx --section-details +@cindex ELF section information +Displays the detailed section information. Implies @option{-S}. + @item -s @itemx --symbols @itemx --syms @@ -3203,8 +3438,8 @@ Display all the headers in the file. Equivalent to @option{-h -l -S}. @item -n @itemx --notes -@cindex ELF core notes -Displays the contents of the NOTE segment, if it exists. +@cindex ELF notes +Displays the contents of the NOTE segments and/or sections, if any. @item -r @itemx --relocs @@ -3217,12 +3452,6 @@ Displays the contents of the file's relocation section, if it has one. Displays the contents of the file's unwind section, if it has one. Only the unwind sections for IA64 ELF files are currently supported. -@item -u -@itemx --unwind -@cindex unwind information -Displays the contents of the file's unwind section, if it has one. Only -the unwind sections for IA64 ELF files are currently supported. - @item -d @itemx --dynamic @cindex ELF dynamic section information @@ -3245,12 +3474,14 @@ When displaying symbols, this option makes @command{readelf} use the symbol table in the file's dynamic section, rather than the one in the symbols section. -@item -x -@itemx --hex-dump= +@item -x +@itemx --hex-dump= Displays the contents of the indicated section as a hexadecimal dump. +A number identifies a particular section by index in the section table; +any other string identifies all sections with that name in the object file. -@item -w[liaprmfFso] -@itemx --debug-dump[=line,=info,=abbrev,=pubnames,=ranges,=macro,=frames,=frames-interp,=str,=loc] +@item -w[liaprmfFsoR] +@itemx --debug-dump[=line,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=loc,=Ranges] Displays the contents of the debug sections in the file, if any are present. If one of the optional letters or words follows the switch then only data found in those specific sections will be dumped. @@ -3286,6 +3517,27 @@ objdump(1), and the Info entries for @file{binutils}. @c man end @end ignore +@node Common Options +@chapter Common Options + +The following command-line options are supported by all of the +programs described in this manual. + +@c man begin OPTIONS +@table @env +@include at-file.texi +@c man end + +@item --help +Display the command-line options supported by the program. + +@item --version +Display the version number of the program. + +@c man begin OPTIONS +@end table +@c man end + @node Selecting The Target System @chapter Selecting the Target System diff --git a/contrib/binutils/binutils/doc/cxxfilt.man b/contrib/binutils/binutils/doc/cxxfilt.man index 8cc8eb246c2..08e77f18ed9 100644 --- a/contrib/binutils/binutils/doc/cxxfilt.man +++ b/contrib/binutils/binutils/doc/cxxfilt.man @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14 +.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32 .\" .\" Standard preamble: .\" ======================================================================== @@ -25,11 +25,11 @@ .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left -.\" double quote, and \*(R" will give a right double quote. | will give a -.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to -.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' -.\" expand to `' in nroff, nothing in troff, for use with C<>. -.tr \(*W-|\(bv\*(Tr +.\" double quote, and \*(R" will give a right double quote. \*(C+ will +.\" give a nicer C++. Capital omega is used to do unbreakable dashes and +.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, +.\" nothing in troff, for use with C<>. +.tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- @@ -128,43 +128,80 @@ .\" ======================================================================== .\" .IX Title "C++FILT 1" -.TH C++FILT 1 "2004-04-09" "binutils-2.14.91" "GNU Development Tools" +.TH C++FILT 1 "2006-06-23" "binutils-2.17" "GNU Development Tools" .SH "NAME" cxxfilt \- Demangle C++ and Java symbols. .SH "SYNOPSIS" .IX Header "SYNOPSIS" c++filt [\fB\-_\fR|\fB\-\-strip\-underscores\fR] - [\fB\-j\fR|\fB\-\-java\fR] [\fB\-n\fR|\fB\-\-no\-strip\-underscores\fR] [\fB\-p\fR|\fB\-\-no\-params\fR] + [\fB\-t\fR|\fB\-\-types\fR] + [\fB\-i\fR|\fB\-\-no\-verbose\fR] [\fB\-s\fR \fIformat\fR|\fB\-\-format=\fR\fIformat\fR] [\fB\-\-help\fR] [\fB\-\-version\fR] [\fIsymbol\fR...] .SH "DESCRIPTION" .IX Header "DESCRIPTION" -The \*(C+ and Java languages provides function overloading, which means -that you can write many functions with the same name (providing each -takes parameters of different types). All \*(C+ and Java function names -are encoded into a low-level assembly label (this process is known as -\&\fImangling\fR). The \fBc++filt\fR +The \*(C+ and Java languages provide function overloading, which means +that you can write many functions with the same name, providing that +each function takes parameters of different types. In order to be +able to distinguish these similarly named functions \*(C+ and Java +encode them into a low-level assembler name which uniquely identifies +each different version. This process is known as \fImangling\fR. The +\&\fBc++filt\fR [1] program does the inverse mapping: it decodes (\fIdemangles\fR) low-level -names into user-level names so that the linker can keep these overloaded -functions from clashing. +names into user-level names so that they can be read. .PP Every alphanumeric word (consisting of letters, digits, underscores, -dollars, or periods) seen in the input is a potential label. If the -label decodes into a \*(C+ name, the \*(C+ name replaces the low-level -name in the output. +dollars, or periods) seen in the input is a potential mangled name. +If the name decodes into a \*(C+ name, the \*(C+ name replaces the +low-level name in the output, otherwise the original word is output. +In this way you can pass an entire assembler source file, containing +mangled names, through \fBc++filt\fR and see the same source file +containing demangled names. .PP -You can use \fBc++filt\fR to decipher individual symbols: +You can also use \fBc++filt\fR to decipher individual symbols by +passing them on the command line: .PP .Vb 1 \& c++filt .Ve .PP If no \fIsymbol\fR arguments are given, \fBc++filt\fR reads symbol -names from the standard input and writes the demangled names to the -standard output. All results are printed on the standard output. +names from the standard input instead. All the results are printed on +the standard output. The difference between reading names from the +command line versus reading names from the standard input is that +command line arguments are expected to be just mangled names and no +checking is performed to seperate them from surrounding text. Thus +for example: +.PP +.Vb 1 +\& c++filt \-n _Z1fv +.Ve +.PP +will work and demangle the name to \*(L"f()\*(R" whereas: +.PP +.Vb 1 +\& c++filt \-n _Z1fv, +.Ve +.PP +will not work. (Note the extra comma at the end of the mangled +name which makes it invalid). This command however will work: +.PP +.Vb 1 +\& echo _Z1fv, | c++filt \-n +.Ve +.PP +and will display \*(L"f(),\*(R" ie the demangled name followed by a +trailing comma. This behaviour is because when the names are read +from the standard input it is expected that they might be part of an +assembler source file where there might be extra, extraneous +characters trailing after a mangled name. eg: +.PP +.Vb 1 +\& .type _Z1fv, @function +.Ve .SH "OPTIONS" .IX Header "OPTIONS" .IP "\fB\-_\fR" 4 @@ -200,6 +237,25 @@ Do not remove the initial underscore. .PD When demangling the name of a function, do not display the types of the function's parameters. +.IP "\fB\-t\fR" 4 +.IX Item "-t" +.PD 0 +.IP "\fB\-\-types\fR" 4 +.IX Item "--types" +.PD +Attempt to demangle types as well as function names. This is disabled +by default since mangled types are normally only used internally in +the compiler, and they can be confused with non-mangled names. eg +a function called \*(L"a\*(R" treated as a mangled type name would be +demangled to \*(L"signed char\*(R". +.IP "\fB\-i\fR" 4 +.IX Item "-i" +.PD 0 +.IP "\fB\-\-no\-verbose\fR" 4 +.IX Item "--no-verbose" +.PD +Do not include implementation details (if any) in the demangled +output. .IP "\fB\-s\fR \fIformat\fR" 4 .IX Item "-s format" .PD 0 @@ -255,22 +311,35 @@ Print a summary of the options to \fBc++filt\fR and exit. .IP "\fB\-\-version\fR" 4 .IX Item "--version" Print the version number of \fBc++filt\fR and exit. +.IP "\fB@\fR\fIfile\fR" 4 +.IX Item "@file" +Read command-line options from \fIfile\fR. The options read are +inserted in place of the original @\fIfile\fR option. If \fIfile\fR +does not exist, or cannot be read, then the option will be treated +literally, and not removed. +.Sp +Options in \fIfile\fR are separated by whitespace. A whitespace +character may be included in an option by surrounding the entire +option in either single or double quotes. Any character (including a +backslash) may be included by prefixing the character to be included +with a backslash. The \fIfile\fR may itself contain additional +@\fIfile\fR options; any such options will be processed recursively. .SH "FOOTNOTES" .IX Header "FOOTNOTES" .IP "1." 4 -MS-DOS does not allow \f(CW\*(C`+\*(C'\fR characters in file names, so on -MS-DOS this program is named \fBcxxfilt\fR. +MS-DOS does not allow \f(CW\*(C`+\*(C'\fR characters in file names, so on +MS-DOS this program is named \fB\s-1CXXFILT\s0\fR. .SH "SEE ALSO" .IX Header "SEE ALSO" the Info entries for \fIbinutils\fR. .SH "COPYRIGHT" .IX Header "COPYRIGHT" -Copyright (c) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, -2001, 2002, 2003 Free Software Foundation, Inc. +Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. .PP Permission is granted to copy, distribute and/or modify this document under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the -section entitled ``\s-1GNU\s0 Free Documentation License''. +section entitled \*(L"\s-1GNU\s0 Free Documentation License\*(R". diff --git a/contrib/binutils/binutils/doc/dlltool.1 b/contrib/binutils/binutils/doc/dlltool.1 index c1e4642f9db..44c5a4e01dd 100644 --- a/contrib/binutils/binutils/doc/dlltool.1 +++ b/contrib/binutils/binutils/doc/dlltool.1 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14 +.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32 .\" .\" Standard preamble: .\" ======================================================================== @@ -25,11 +25,11 @@ .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left -.\" double quote, and \*(R" will give a right double quote. | will give a -.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to -.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' -.\" expand to `' in nroff, nothing in troff, for use with C<>. -.tr \(*W-|\(bv\*(Tr +.\" double quote, and \*(R" will give a right double quote. \*(C+ will +.\" give a nicer C++. Capital omega is used to do unbreakable dashes and +.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, +.\" nothing in troff, for use with C<>. +.tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- @@ -128,7 +128,7 @@ .\" ======================================================================== .\" .IX Title "DLLTOOL 1" -.TH DLLTOOL 1 "2004-04-09" "binutils-2.14.91" "GNU Development Tools" +.TH DLLTOOL 1 "2006-06-23" "binutils-2.17" "GNU Development Tools" .SH "NAME" dlltool \- Create files needed to build and use DLLs. .SH "SYNOPSIS" @@ -143,8 +143,10 @@ dlltool [\fB\-d\fR|\fB\-\-input\-def\fR \fIdef-file-name\fR] [\fB\-\-no\-default\-excludes\fR] [\fB\-S\fR|\fB\-\-as\fR \fIpath-to-assembler\fR] [\fB\-f\fR|\fB\-\-as\-flags\fR \fIoptions\fR] [\fB\-D\fR|\fB\-\-dllname\fR \fIname\fR] [\fB\-m\fR|\fB\-\-machine\fR \fImachine\fR] - [\fB\-a\fR|\fB\-\-add\-indirect\fR] [\fB\-U\fR|\fB\-\-add\-underscore\fR] [\fB\-k\fR|\fB\-\-kill\-at\fR] - [\fB\-A\fR|\fB\-\-add\-stdcall\-alias\fR] + [\fB\-a\fR|\fB\-\-add\-indirect\fR] + [\fB\-U\fR|\fB\-\-add\-underscore\fR] [\fB\-\-add\-stdcall\-underscore\fR] + [\fB\-k\fR|\fB\-\-kill\-at\fR] [\fB\-A\fR|\fB\-\-add\-stdcall\-alias\fR] + [\fB\-p\fR|\fB\-\-ext\-prefix\-alias\fR \fIprefix\fR] [\fB\-x\fR|\fB\-\-no\-idata4\fR] [\fB\-c\fR|\fB\-\-no\-idata5\fR] [\fB\-i\fR|\fB\-\-interwork\fR] [\fB\-n\fR|\fB\-\-nodelete\fR] [\fB\-t\fR|\fB\-\-temp\-prefix\fR \fIprefix\fR] [\fB\-v\fR|\fB\-\-verbose\fR] @@ -165,13 +167,13 @@ When creating a \s-1DLL\s0, along with the source for the \s-1DLL\s0, it is nece to have three other files. \fBdlltool\fR can help with the creation of these files. .PP -The first file is a \fB.def\fR file which specifies which functions are +The first file is a \fI.def\fR file which specifies which functions are exported from the \s-1DLL\s0, which functions the \s-1DLL\s0 imports, and so on. This is a text file and can be created by hand, or \fBdlltool\fR can be used to create it using the \fB\-z\fR option. In this case \fBdlltool\fR will scan the object files specified on its command line looking for those functions which have been specially marked as being exported and -put entries for them in the .def file it creates. +put entries for them in the \fI.def\fR file it creates. .PP In order to mark a function as being exported from a \s-1DLL\s0, it needs to have an \fB\-export:\fR entry in the \fB.drectve\fR @@ -180,7 +182,7 @@ section of the object file. This can be done in C by using the .PP .Vb 2 \& asm (".section .drectve"); -\& asm (".ascii \e"-export:my_func\e""); +\& asm (".ascii \e"\-export:my_func\e""); .Ve .PP .Vb 1 @@ -191,12 +193,12 @@ The second file needed for \s-1DLL\s0 creation is an exports file. This file is linked with the object files that make up the body of the \s-1DLL\s0 and it handles the interface between the \s-1DLL\s0 and the outside world. This is a binary file and it can be created by giving the \fB\-e\fR option to -\&\fBdlltool\fR when it is creating or reading in a .def file. +\&\fBdlltool\fR when it is creating or reading in a \fI.def\fR file. .PP The third file needed for \s-1DLL\s0 creation is the library file that programs will link with in order to access the functions in the \s-1DLL\s0. This file can be created by giving the \fB\-l\fR option to dlltool when it -is creating or reading in a .def file. +is creating or reading in a \fI.def\fR file. .PP \&\fBdlltool\fR builds the library file by hand, but it builds the exports file by creating temporary files containing assembler statements @@ -213,10 +215,10 @@ also creating a program (from an object file called \fBprogram.o\fR) that uses that \s-1DLL:\s0 .PP .Vb 4 -\& gcc -c dll.c -\& dlltool -e exports.o -l dll.lib dll.o -\& gcc dll.o exports.o -o dll.dll -\& gcc program.o dll.lib -o program +\& gcc \-c dll.c +\& dlltool \-e exports.o \-l dll.lib dll.o +\& gcc dll.o exports.o \-o dll.dll +\& gcc program.o dll.lib \-o program .Ve .SH "OPTIONS" .IX Header "OPTIONS" @@ -227,7 +229,7 @@ The command line options have the following meanings: .IP "\fB\-\-input\-def\fR \fIfilename\fR" 4 .IX Item "--input-def filename" .PD -Specifies the name of a .def file to be read in and processed. +Specifies the name of a \fI.def\fR file to be read in and processed. .IP "\fB\-b\fR \fIfilename\fR" 4 .IX Item "-b filename" .PD 0 @@ -250,7 +252,7 @@ Specifies the name of the export file to be created by dlltool. .IP "\fB\-\-output\-def\fR \fIfilename\fR" 4 .IX Item "--output-def filename" .PD -Specifies the name of the .def file to be created by dlltool. +Specifies the name of the \fI.def\fR file to be created by dlltool. .IP "\fB\-l\fR \fIfilename\fR" 4 .IX Item "-l filename" .PD 0 @@ -267,7 +269,7 @@ option. You may add to the list of symbols to not export by using the \&\fB\-\-exclude\-symbols\fR option. .IP "\fB\-\-no\-export\-all\-symbols\fR" 4 .IX Item "--no-export-all-symbols" -Only export symbols explicitly listed in an input .def file or in +Only export symbols explicitly listed in an input \fI.def\fR file or in \&\fB.drectve\fR sections in the input object files. This is the default behaviour. The \fB.drectve\fR sections are created by \fBdllexport\fR attributes in the source code. @@ -312,10 +314,10 @@ double quotes. .IP "\fB\-\-dll\-name\fR \fIname\fR" 4 .IX Item "--dll-name name" .PD -Specifies the name to be stored in the .def file as the name of the \s-1DLL\s0 -when the \fB\-e\fR option is used. If this option is not present, then -the filename given to the \fB\-e\fR option will be used as the name of -the \s-1DLL\s0. +Specifies the name to be stored in the \fI.def\fR file as the name of +the \s-1DLL\s0 when the \fB\-e\fR option is used. If this option is not +present, then the filename given to the \fB\-e\fR option will be +used as the name of the \s-1DLL\s0. .IP "\fB\-m\fR \fImachine\fR" 4 .IX Item "-m machine" .PD 0 @@ -344,7 +346,14 @@ means! .IX Item "--add-underscore" .PD Specifies that when \fBdlltool\fR is creating the exports file it -should prepend an underscore to the names of the exported functions. +should prepend an underscore to the names of \fIall\fR exported symbols. +.IP "\fB\-\-add\-stdcall\-underscore\fR" 4 +.IX Item "--add-stdcall-underscore" +Specifies that when \fBdlltool\fR is creating the exports file it +should prepend an underscore to the names of exported \fIstdcall\fR +functions. Variable names and non-stdcall function names are not modified. +This option is useful when creating GNU-compatible import libs for third +party DLLs that were built with MS-Windows tools. .IP "\fB\-k\fR" 4 .IX Item "-k" .PD 0 @@ -364,6 +373,15 @@ function in a \s-1DLL\s0, other than by name. Specifies that when \fBdlltool\fR is creating the exports file it should add aliases for stdcall symbols without \fB@ \fR in addition to the symbols with \fB@ \fR. +.IP "\fB\-p\fR" 4 +.IX Item "-p" +.PD 0 +.IP "\fB\-\-ext\-prefix\-alias\fR \fIprefix\fR" 4 +.IX Item "--ext-prefix-alias prefix" +.PD +Causes \fBdlltool\fR to create external aliases for all \s-1DLL\s0 +imports with the specified prefix. The aliases are created for both +external and import symbols with no leading underscore. .IP "\fB\-x\fR" 4 .IX Item "-x" .PD 0 @@ -431,17 +449,30 @@ Displays a list of command line options and then exits. .IX Item "--version" .PD Displays dlltool's version number and then exits. +.IP "\fB@\fR\fIfile\fR" 4 +.IX Item "@file" +Read command-line options from \fIfile\fR. The options read are +inserted in place of the original @\fIfile\fR option. If \fIfile\fR +does not exist, or cannot be read, then the option will be treated +literally, and not removed. +.Sp +Options in \fIfile\fR are separated by whitespace. A whitespace +character may be included in an option by surrounding the entire +option in either single or double quotes. Any character (including a +backslash) may be included by prefixing the character to be included +with a backslash. The \fIfile\fR may itself contain additional +@\fIfile\fR options; any such options will be processed recursively. .SH "SEE ALSO" .IX Header "SEE ALSO" -the Info entries for \fIbinutils\fR. +The Info pages for \fIbinutils\fR. .SH "COPYRIGHT" .IX Header "COPYRIGHT" -Copyright (c) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, -2001, 2002, 2003 Free Software Foundation, Inc. +Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. .PP Permission is granted to copy, distribute and/or modify this document under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the -section entitled ``\s-1GNU\s0 Free Documentation License''. +section entitled \*(L"\s-1GNU\s0 Free Documentation License\*(R". diff --git a/contrib/binutils/binutils/doc/fdl.texi b/contrib/binutils/binutils/doc/fdl.texi index f4726b9b149..cb9b4ae9724 100644 --- a/contrib/binutils/binutils/doc/fdl.texi +++ b/contrib/binutils/binutils/doc/fdl.texi @@ -5,8 +5,8 @@ @center Version 1.1, March 2000 @display -Copyright (C) 2000 Free Software Foundation, Inc. -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +Copyright (C) 2000, 2003 Free Software Foundation, Inc. +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. diff --git a/contrib/binutils/binutils/doc/nm.1 b/contrib/binutils/binutils/doc/nm.1 index c4727752a27..9f2271c7cbd 100644 --- a/contrib/binutils/binutils/doc/nm.1 +++ b/contrib/binutils/binutils/doc/nm.1 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14 +.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32 .\" .\" Standard preamble: .\" ======================================================================== @@ -25,11 +25,11 @@ .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left -.\" double quote, and \*(R" will give a right double quote. | will give a -.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to -.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' -.\" expand to `' in nroff, nothing in troff, for use with C<>. -.tr \(*W-|\(bv\*(Tr +.\" double quote, and \*(R" will give a right double quote. \*(C+ will +.\" give a nicer C++. Capital omega is used to do unbreakable dashes and +.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, +.\" nothing in troff, for use with C<>. +.tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- @@ -128,7 +128,7 @@ .\" ======================================================================== .\" .IX Title "NM 1" -.TH NM 1 "2004-04-09" "binutils-2.14.91" "GNU Development Tools" +.TH NM 1 "2006-06-23" "binutils-2.17" "GNU Development Tools" .SH "NAME" nm \- list symbols from object files .SH "SYNOPSIS" @@ -136,7 +136,7 @@ nm \- list symbols from object files nm [\fB\-a\fR|\fB\-\-debug\-syms\fR] [\fB\-g\fR|\fB\-\-extern\-only\fR] [\fB\-B\fR] [\fB\-C\fR|\fB\-\-demangle\fR[=\fIstyle\fR]] [\fB\-D\fR|\fB\-\-dynamic\fR] [\fB\-S\fR|\fB\-\-print\-size\fR] [\fB\-s\fR|\fB\-\-print\-armap\fR] - [\fB\-A\fR|\fB\-o\fR|\fB\-\-print\-file\-name\fR] + [\fB\-A\fR|\fB\-o\fR|\fB\-\-print\-file\-name\fR][\fB\-\-special\-syms\fR] [\fB\-n\fR|\fB\-v\fR|\fB\-\-numeric\-sort\fR] [\fB\-p\fR|\fB\-\-no\-sort\fR] [\fB\-r\fR|\fB\-\-reverse\-sort\fR] [\fB\-\-size\-sort\fR] [\fB\-u\fR|\fB\-\-undefined\-only\fR] [\fB\-t\fR \fIradix\fR|\fB\-\-radix=\fR\fIradix\fR] [\fB\-P\fR|\fB\-\-portability\fR] @@ -223,7 +223,9 @@ The symbol is a weak symbol that has not been specifically tagged as a weak object symbol. When a weak defined symbol is linked with a normal defined symbol, the normal defined symbol is used with no error. When a weak undefined symbol is linked and the symbol is not defined, -the value of the weak symbol becomes zero with no error. +the value of the symbol is determined in a system-specific manner without +error. On some systems, uppercase indicates that a default value has been +specified. .ie n .IP """\-""" 4 .el .IP "\f(CW\-\fR" 4 .IX Item "-" @@ -373,6 +375,14 @@ the value of the symbol and the value of the symbol with the next higher value. If the \f(CW\*(C`bsd\*(C'\fR output format is used the size of the symbol is printed, rather than the value, and \fB\-S\fR must be used in order both size and value to be printed. +.IP "\fB\-\-special\-syms\fR" 4 +.IX Item "--special-syms" +Display symbols which have a target-specific special meaning. These +symbols are usually used by the target for some special processing and +are not normally helpful when included included in the normal symbol +lists. For example for \s-1ARM\s0 targets this option would skip the mapping +symbols used to mark transistions between \s-1ARM\s0 code, \s-1THUMB\s0 code and +data. .IP "\fB\-t\fR \fIradix\fR" 4 .IX Item "-t radix" .PD 0 @@ -410,17 +420,30 @@ to \fB\-X 32\fR, which is not supported by \s-1GNU\s0 \fBnm\fR. .IP "\fB\-\-help\fR" 4 .IX Item "--help" Show a summary of the options to \fBnm\fR and exit. +.IP "\fB@\fR\fIfile\fR" 4 +.IX Item "@file" +Read command-line options from \fIfile\fR. The options read are +inserted in place of the original @\fIfile\fR option. If \fIfile\fR +does not exist, or cannot be read, then the option will be treated +literally, and not removed. +.Sp +Options in \fIfile\fR are separated by whitespace. A whitespace +character may be included in an option by surrounding the entire +option in either single or double quotes. Any character (including a +backslash) may be included by prefixing the character to be included +with a backslash. The \fIfile\fR may itself contain additional +@\fIfile\fR options; any such options will be processed recursively. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fIar\fR\|(1), \fIobjdump\fR\|(1), \fIranlib\fR\|(1), and the Info entries for \fIbinutils\fR. .SH "COPYRIGHT" .IX Header "COPYRIGHT" -Copyright (c) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, -2001, 2002, 2003 Free Software Foundation, Inc. +Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. .PP Permission is granted to copy, distribute and/or modify this document under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the -section entitled ``\s-1GNU\s0 Free Documentation License''. +section entitled \*(L"\s-1GNU\s0 Free Documentation License\*(R". diff --git a/contrib/binutils/binutils/doc/objcopy.1 b/contrib/binutils/binutils/doc/objcopy.1 index 43871d6687b..828cddef56e 100644 --- a/contrib/binutils/binutils/doc/objcopy.1 +++ b/contrib/binutils/binutils/doc/objcopy.1 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14 +.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32 .\" .\" Standard preamble: .\" ======================================================================== @@ -25,11 +25,11 @@ .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left -.\" double quote, and \*(R" will give a right double quote. | will give a -.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to -.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' -.\" expand to `' in nroff, nothing in troff, for use with C<>. -.tr \(*W-|\(bv\*(Tr +.\" double quote, and \*(R" will give a right double quote. \*(C+ will +.\" give a nicer C++. Capital omega is used to do unbreakable dashes and +.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, +.\" nothing in troff, for use with C<>. +.tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- @@ -128,7 +128,7 @@ .\" ======================================================================== .\" .IX Title "OBJCOPY 1" -.TH OBJCOPY 1 "2004-04-09" "binutils-2.14.91" "GNU Development Tools" +.TH OBJCOPY 1 "2006-06-23" "binutils-2.17" "GNU Development Tools" .SH "NAME" objcopy \- copy and translate object files .SH "SYNOPSIS" @@ -141,8 +141,10 @@ objcopy [\fB\-F\fR \fIbfdname\fR|\fB\-\-target=\fR\fIbfdname\fR] [\fB\-g\fR|\fB\-\-strip\-debug\fR] [\fB\-K\fR \fIsymbolname\fR|\fB\-\-keep\-symbol=\fR\fIsymbolname\fR] [\fB\-N\fR \fIsymbolname\fR|\fB\-\-strip\-symbol=\fR\fIsymbolname\fR] + [\fB\-\-strip\-unneeded\-symbol=\fR\fIsymbolname\fR] [\fB\-G\fR \fIsymbolname\fR|\fB\-\-keep\-global\-symbol=\fR\fIsymbolname\fR] [\fB\-L\fR \fIsymbolname\fR|\fB\-\-localize\-symbol=\fR\fIsymbolname\fR] + [\fB\-\-globalize\-symbol=\fR\fIsymbolname\fR] [\fB\-W\fR \fIsymbolname\fR|\fB\-\-weaken\-symbol=\fR\fIsymbolname\fR] [\fB\-w\fR|\fB\-\-wildcard\fR] [\fB\-x\fR|\fB\-\-discard\-all\fR] @@ -172,14 +174,17 @@ objcopy [\fB\-F\fR \fIbfdname\fR|\fB\-\-target=\fR\fIbfdname\fR] [\fB\-\-weaken\fR] [\fB\-\-keep\-symbols=\fR\fIfilename\fR] [\fB\-\-strip\-symbols=\fR\fIfilename\fR] + [\fB\-\-strip\-unneeded\-symbols=\fR\fIfilename\fR] [\fB\-\-keep\-global\-symbols=\fR\fIfilename\fR] [\fB\-\-localize\-symbols=\fR\fIfilename\fR] + [\fB\-\-globalize\-symbols=\fR\fIfilename\fR] [\fB\-\-weaken\-symbols=\fR\fIfilename\fR] [\fB\-\-alt\-machine\-code=\fR\fIindex\fR] [\fB\-\-prefix\-symbols=\fR\fIstring\fR] [\fB\-\-prefix\-sections=\fR\fIstring\fR] [\fB\-\-prefix\-alloc\-sections=\fR\fIstring\fR] [\fB\-\-add\-gnu\-debuglink=\fR\fIpath-to-file\fR] + [\fB\-\-keep\-file\-symbols\fR] [\fB\-\-only\-keep\-debug\fR] [\fB\-\-writable\-text\fR] [\fB\-\-readonly\-text\fR] @@ -316,8 +321,8 @@ Strip all symbols that are not needed for relocation processing. .IP "\fB\-\-keep\-symbol=\fR\fIsymbolname\fR" 4 .IX Item "--keep-symbol=symbolname" .PD -Copy only symbol \fIsymbolname\fR from the source file. This option may -be given more than once. +When stripping symbols, keep symbol \fIsymbolname\fR even if it would +normally be stripped. This option may be given more than once. .IP "\fB\-N\fR \fIsymbolname\fR" 4 .IX Item "-N symbolname" .PD 0 @@ -326,6 +331,10 @@ be given more than once. .PD Do not copy symbol \fIsymbolname\fR from the source file. This option may be given more than once. +.IP "\fB\-\-strip\-unneeded\-symbol=\fR\fIsymbolname\fR" 4 +.IX Item "--strip-unneeded-symbol=symbolname" +Do not copy symbol \fIsymbolname\fR from the source file unless it is needed +by a relocation. This option may be given more than once. .IP "\fB\-G\fR \fIsymbolname\fR" 4 .IX Item "-G symbolname" .PD 0 @@ -350,6 +359,11 @@ visible externally. This option may be given more than once. .IX Item "--weaken-symbol=symbolname" .PD Make symbol \fIsymbolname\fR weak. This option may be given more than once. +.IP "\fB\-\-globalize\-symbol=\fR\fIsymbolname\fR" 4 +.IX Item "--globalize-symbol=symbolname" +Give symbol \fIsymbolname\fR global scoping so that it is visible +outside of the file in which it is defined. This option may be given +more than once. .IP "\fB\-w\fR" 4 .IX Item "-w" .PD 0 @@ -364,11 +378,11 @@ point (!) then the sense of the switch is reversed for that symbol. For example: .Sp .Vb 1 -\& -w -W !foo -W fo* +\& \-w \-W !foo \-W fo* .Ve .Sp -would cause objcopy to weaken all symbols that start with ``fo'' -except for the symbol ``foo''. +would cause objcopy to weaken all symbols that start with \*(L"fo\*(R" +except for the symbol \*(L"foo\*(R". .IP "\fB\-x\fR" 4 .IX Item "-x" .PD 0 @@ -540,8 +554,8 @@ you wanted instead to create a section called .rodata containing binary data you could use the following command line to achieve it: .Sp .Vb 3 -\& objcopy -I binary -O -B \e -\& --rename-section .data=.rodata,alloc,load,readonly,data,contents \e +\& objcopy \-I binary \-O \-B \e +\& \-\-rename\-section .data=.rodata,alloc,load,readonly,data,contents \e \& .Ve .IP "\fB\-\-change\-leading\-char\fR" 4 @@ -603,6 +617,12 @@ Apply \fB\-\-strip\-symbol\fR option to each symbol listed in the file \&\fIfilename\fR. \fIfilename\fR is simply a flat file, with one symbol name per line. Line comments may be introduced by the hash character. This option may be given more than once. +.IP "\fB\-\-strip\-unneeded\-symbols=\fR\fIfilename\fR" 4 +.IX Item "--strip-unneeded-symbols=filename" +Apply \fB\-\-strip\-unneeded\-symbol\fR option to each symbol listed in +the file \fIfilename\fR. \fIfilename\fR is simply a flat file, with one +symbol name per line. Line comments may be introduced by the hash +character. This option may be given more than once. .IP "\fB\-\-keep\-global\-symbols=\fR\fIfilename\fR" 4 .IX Item "--keep-global-symbols=filename" Apply \fB\-\-keep\-global\-symbol\fR option to each symbol listed in the @@ -615,6 +635,12 @@ Apply \fB\-\-localize\-symbol\fR option to each symbol listed in the file \&\fIfilename\fR. \fIfilename\fR is simply a flat file, with one symbol name per line. Line comments may be introduced by the hash character. This option may be given more than once. +.IP "\fB\-\-globalize\-symbols=\fR\fIfilename\fR" 4 +.IX Item "--globalize-symbols=filename" +Apply \fB\-\-globalize\-symbol\fR option to each symbol listed in the file +\&\fIfilename\fR. \fIfilename\fR is simply a flat file, with one symbol +name per line. Line comments may be introduced by the hash character. +This option may be given more than once. .IP "\fB\-\-weaken\-symbols=\fR\fIfilename\fR" 4 .IX Item "--weaken-symbols=filename" Apply \fB\-\-weaken\-symbol\fR option to each symbol listed in the file @@ -627,7 +653,9 @@ If the output architecture has alternate machine codes, use the \&\fIindex\fRth code instead of the default one. This is useful in case a machine is assigned an official code and the tool-chain adopts the new code, but other applications still depend on the original code -being used. +being used. For \s-1ELF\s0 based architectures if the \fIindex\fR +alternative does not exist then the value is treated as an absolute +number to be stored in the e_machine field of the \s-1ELF\s0 header. .IP "\fB\-\-writable\-text\fR" 4 .IX Item "--writable-text" Mark the output text as writable. This option isn't meaningful for all @@ -658,10 +686,16 @@ Prefix all the names of all allocated sections in the output file with .IX Item "--add-gnu-debuglink=path-to-file" Creates a .gnu_debuglink section which contains a reference to \fIpath-to-file\fR and adds it to the output file. +.IP "\fB\-\-keep\-file\-symbols\fR" 4 +.IX Item "--keep-file-symbols" +When stripping a file, perhaps with \fB\-\-strip\-debug\fR or +\&\fB\-\-strip\-unneeded\fR, retain any symbols specifying source file names, +which would otherwise get stripped. .IP "\fB\-\-only\-keep\-debug\fR" 4 .IX Item "--only-keep-debug" -Strip a file, removing any sections that would be stripped by -\&\fB\-\-strip\-debug\fR and leaving the debugging sections. +Strip a file, removing contents of any sections that would not be +stripped by \fB\-\-strip\-debug\fR and leaving the debugging sections +intact. .Sp The intention is that this option will be used in conjunction with \&\fB\-\-add\-gnu\-debuglink\fR to create a two part executable. One a @@ -707,7 +741,7 @@ optional. You could instead do this: .RS 4 .PD .Sp -ie the file pointed to by the \fB\-\-add\-gnu\-debuglink\fR can be the +i.e. the file pointed to by the \fB\-\-add\-gnu\-debuglink\fR can be the full executable. It does not have to be a file created by the \&\fB\-\-only\-keep\-debug\fR switch. .RE @@ -732,17 +766,30 @@ Show a summary of the options to \fBobjcopy\fR. .IP "\fB\-\-info\fR" 4 .IX Item "--info" Display a list showing all architectures and object formats available. +.IP "\fB@\fR\fIfile\fR" 4 +.IX Item "@file" +Read command-line options from \fIfile\fR. The options read are +inserted in place of the original @\fIfile\fR option. If \fIfile\fR +does not exist, or cannot be read, then the option will be treated +literally, and not removed. +.Sp +Options in \fIfile\fR are separated by whitespace. A whitespace +character may be included in an option by surrounding the entire +option in either single or double quotes. Any character (including a +backslash) may be included by prefixing the character to be included +with a backslash. The \fIfile\fR may itself contain additional +@\fIfile\fR options; any such options will be processed recursively. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fIld\fR\|(1), \fIobjdump\fR\|(1), and the Info entries for \fIbinutils\fR. .SH "COPYRIGHT" .IX Header "COPYRIGHT" -Copyright (c) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, -2001, 2002, 2003 Free Software Foundation, Inc. +Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. .PP Permission is granted to copy, distribute and/or modify this document under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the -section entitled ``\s-1GNU\s0 Free Documentation License''. +section entitled \*(L"\s-1GNU\s0 Free Documentation License\*(R". diff --git a/contrib/binutils/binutils/doc/objdump.1 b/contrib/binutils/binutils/doc/objdump.1 index 1e9baf570c8..a27423c21ba 100644 --- a/contrib/binutils/binutils/doc/objdump.1 +++ b/contrib/binutils/binutils/doc/objdump.1 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14 +.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32 .\" .\" Standard preamble: .\" ======================================================================== @@ -25,11 +25,11 @@ .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left -.\" double quote, and \*(R" will give a right double quote. | will give a -.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to -.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' -.\" expand to `' in nroff, nothing in troff, for use with C<>. -.tr \(*W-|\(bv\*(Tr +.\" double quote, and \*(R" will give a right double quote. \*(C+ will +.\" give a nicer C++. Capital omega is used to do unbreakable dashes and +.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, +.\" nothing in troff, for use with C<>. +.tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- @@ -128,7 +128,7 @@ .\" ======================================================================== .\" .IX Title "OBJDUMP 1" -.TH OBJDUMP 1 "2004-04-09" "binutils-2.14.91" "GNU Development Tools" +.TH OBJDUMP 1 "2006-06-23" "binutils-2.17" "GNU Development Tools" .SH "NAME" objdump \- display information from object files. .SH "SYNOPSIS" @@ -155,6 +155,7 @@ objdump [\fB\-a\fR|\fB\-\-archive\-headers\fR] [\fB\-r\fR|\fB\-\-reloc\fR] [\fB\-R\fR|\fB\-\-dynamic\-reloc\fR] [\fB\-s\fR|\fB\-\-full\-contents\fR] + [\fB\-W\fR|\fB\-\-dwarf\fR] [\fB\-G\fR|\fB\-\-stabs\fR] [\fB\-t\fR|\fB\-\-syms\fR] [\fB\-T\fR|\fB\-\-dynamic\-syms\fR] @@ -165,6 +166,7 @@ objdump [\fB\-a\fR|\fB\-\-archive\-headers\fR] [\fB\-\-prefix\-addresses\fR] [\fB\-\-[no\-]show\-raw\-insn\fR] [\fB\-\-adjust\-vma=\fR\fIoffset\fR] + [\fB\-\-special\-syms\fR] [\fB\-V\fR|\fB\-\-version\fR] [\fB\-H\fR|\fB\-\-help\fR] \fIobjfile\fR... @@ -214,7 +216,7 @@ automatically recognize many formats. For example, .Sp .Vb 1 -\& objdump -b oasys -m vax -h fu.o +\& objdump \-b oasys \-m vax \-h fu.o .Ve .Sp displays summary information from the section headers (\fB\-h\fR) of @@ -368,7 +370,7 @@ can be placed together into a comma separated list. .Sp If the target is an \s-1ARM\s0 architecture then this switch can be used to select which register name set is used during disassembler. Specifying -\&\fB\-M reg-name-std\fR (the default) will select the register names as +\&\fB\-M reg-names-std\fR (the default) will select the register names as used in \s-1ARM\s0's instruction set documentation, but with register 13 called \&'sp', register 14 called 'lr' and register 15 called 'pc'. Specifying \&\fB\-M reg-names-apcs\fR will select the name set used by the \s-1ARM\s0 @@ -401,13 +403,20 @@ suffix could be inferred by the operands. .Sp For \s-1PPC\s0, \fBbooke\fR, \fBbooke32\fR and \fBbooke64\fR select disassembly of BookE instructions. \fB32\fR and \fB64\fR select -PowerPC and PowerPC64 disassembly, respectively. +PowerPC and PowerPC64 disassembly, respectively. \fBe300\fR selects +disassembly for the e300 family. .Sp -For \s-1MIPS\s0, this option controls the printing of register names in -disassembled instructions. Multiple selections from the -following may be specified as a comma separated string, and invalid -options are ignored: +For \s-1MIPS\s0, this option controls the printing of instruction mneumonic +names and register names in disassembled instructions. Multiple +selections from the following may be specified as a comma separated +string, and invalid options are ignored: .RS 4 +.ie n .IP """no\-aliases""" 4 +.el .IP "\f(CWno\-aliases\fR" 4 +.IX Item "no-aliases" +Print the 'raw' instruction mneumonic instead of some pseudo +instruction mneumonic. I.E. print 'daddu' or 'or' instead of 'move', +\&'sll' instead of 'nop', etc. .ie n .IP """gpr\-names=\f(CI\s-1ABI\s0\f(CW""" 4 .el .IP "\f(CWgpr\-names=\f(CI\s-1ABI\s0\f(CW\fR" 4 .IX Item "gpr-names=ABI" @@ -451,6 +460,13 @@ For any of the options listed above, \fI\s-1ABI\s0\fR or rather than names, for the selected types of registers. You can list the available values of \fI\s-1ABI\s0\fR and \fI\s-1ARCH\s0\fR using the \fB\-\-help\fR option. +.Sp +For \s-1VAX\s0, you can specify function entry addresses with \fB\-M +entry:0xf00ba\fR. You can use this multiple times to properly +disassemble \s-1VAX\s0 binary files that don't contain symbol tables (like +\&\s-1ROM\s0 dumps). In these cases, the function entry mask would otherwise +be decoded as \s-1VAX\s0 instructions, which would probably lead the the rest +of the function being wrongly disassembled. .RE .IP "\fB\-p\fR" 4 .IX Item "-p" @@ -504,6 +520,14 @@ in symbolic form. This is the default except when .IX Item "--no-show-raw-insn" When disassembling instructions, do not print the instruction bytes. This is the default when \fB\-\-prefix\-addresses\fR is used. +.IP "\fB\-W\fR" 4 +.IX Item "-W" +.PD 0 +.IP "\fB\-\-dwarf\fR" 4 +.IX Item "--dwarf" +.PD +Displays the contents of the \s-1DWARF\s0 debug sections in the file, if any +are present. .IP "\fB\-G\fR" 4 .IX Item "-G" .PD 0 @@ -543,6 +567,11 @@ Print the dynamic symbol table entries of the file. This is only meaningful for dynamic objects, such as certain types of shared libraries. This is similar to the information provided by the \fBnm\fR program when given the \fB\-D\fR (\fB\-\-dynamic\fR) option. +.IP "\fB\-\-special\-syms\fR" 4 +.IX Item "--special-syms" +When displaying symbols include those which the target considers to be +special in some way and which would not normally be of interest to the +user. .IP "\fB\-V\fR" 4 .IX Item "-V" .PD 0 @@ -558,7 +587,7 @@ Print the version number of \fBobjdump\fR and exit. .PD Display all available header information, including the symbol table and relocation entries. Using \fB\-x\fR is equivalent to specifying all of -\&\fB\-a \-f \-h \-r \-t\fR. +\&\fB\-a \-f \-h \-p \-r \-t\fR. .IP "\fB\-w\fR" 4 .IX Item "-w" .PD 0 @@ -576,17 +605,30 @@ Also do not truncate symbol names when they are displayed. Normally the disassembly output will skip blocks of zeroes. This option directs the disassembler to disassemble those blocks, just like any other data. +.IP "\fB@\fR\fIfile\fR" 4 +.IX Item "@file" +Read command-line options from \fIfile\fR. The options read are +inserted in place of the original @\fIfile\fR option. If \fIfile\fR +does not exist, or cannot be read, then the option will be treated +literally, and not removed. +.Sp +Options in \fIfile\fR are separated by whitespace. A whitespace +character may be included in an option by surrounding the entire +option in either single or double quotes. Any character (including a +backslash) may be included by prefixing the character to be included +with a backslash. The \fIfile\fR may itself contain additional +@\fIfile\fR options; any such options will be processed recursively. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fInm\fR\|(1), \fIreadelf\fR\|(1), and the Info entries for \fIbinutils\fR. .SH "COPYRIGHT" .IX Header "COPYRIGHT" -Copyright (c) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, -2001, 2002, 2003 Free Software Foundation, Inc. +Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. .PP Permission is granted to copy, distribute and/or modify this document under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the -section entitled ``\s-1GNU\s0 Free Documentation License''. +section entitled \*(L"\s-1GNU\s0 Free Documentation License\*(R". diff --git a/contrib/binutils/binutils/doc/ranlib.1 b/contrib/binutils/binutils/doc/ranlib.1 index 0d8e4ac548a..fd03dd02c72 100644 --- a/contrib/binutils/binutils/doc/ranlib.1 +++ b/contrib/binutils/binutils/doc/ranlib.1 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14 +.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32 .\" .\" Standard preamble: .\" ======================================================================== @@ -25,11 +25,11 @@ .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left -.\" double quote, and \*(R" will give a right double quote. | will give a -.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to -.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' -.\" expand to `' in nroff, nothing in troff, for use with C<>. -.tr \(*W-|\(bv\*(Tr +.\" double quote, and \*(R" will give a right double quote. \*(C+ will +.\" give a nicer C++. Capital omega is used to do unbreakable dashes and +.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, +.\" nothing in troff, for use with C<>. +.tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- @@ -128,7 +128,7 @@ .\" ======================================================================== .\" .IX Title "RANLIB 1" -.TH RANLIB 1 "2004-04-09" "binutils-2.14.91" "GNU Development Tools" +.TH RANLIB 1 "2006-06-23" "binutils-2.17" "GNU Development Tools" .SH "NAME" ranlib \- generate index to archive. .SH "SYNOPSIS" @@ -159,17 +159,30 @@ The \s-1GNU\s0 \fBranlib\fR program is another form of \s-1GNU\s0 \fBar\fR; runn .IX Item "--version" .PD Show the version number of \fBranlib\fR. +.IP "\fB@\fR\fIfile\fR" 4 +.IX Item "@file" +Read command-line options from \fIfile\fR. The options read are +inserted in place of the original @\fIfile\fR option. If \fIfile\fR +does not exist, or cannot be read, then the option will be treated +literally, and not removed. +.Sp +Options in \fIfile\fR are separated by whitespace. A whitespace +character may be included in an option by surrounding the entire +option in either single or double quotes. Any character (including a +backslash) may be included by prefixing the character to be included +with a backslash. The \fIfile\fR may itself contain additional +@\fIfile\fR options; any such options will be processed recursively. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fIar\fR\|(1), \fInm\fR\|(1), and the Info entries for \fIbinutils\fR. .SH "COPYRIGHT" .IX Header "COPYRIGHT" -Copyright (c) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, -2001, 2002, 2003 Free Software Foundation, Inc. +Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. .PP Permission is granted to copy, distribute and/or modify this document under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the -section entitled ``\s-1GNU\s0 Free Documentation License''. +section entitled \*(L"\s-1GNU\s0 Free Documentation License\*(R". diff --git a/contrib/binutils/binutils/doc/readelf.1 b/contrib/binutils/binutils/doc/readelf.1 index 38b5042dc22..14480c7938e 100644 --- a/contrib/binutils/binutils/doc/readelf.1 +++ b/contrib/binutils/binutils/doc/readelf.1 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14 +.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32 .\" .\" Standard preamble: .\" ======================================================================== @@ -25,11 +25,11 @@ .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left -.\" double quote, and \*(R" will give a right double quote. | will give a -.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to -.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' -.\" expand to `' in nroff, nothing in troff, for use with C<>. -.tr \(*W-|\(bv\*(Tr +.\" double quote, and \*(R" will give a right double quote. \*(C+ will +.\" give a nicer C++. Capital omega is used to do unbreakable dashes and +.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, +.\" nothing in troff, for use with C<>. +.tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- @@ -128,7 +128,7 @@ .\" ======================================================================== .\" .IX Title "READELF 1" -.TH READELF 1 "2004-04-09" "binutils-2.14.91" "GNU Development Tools" +.TH READELF 1 "2006-06-23" "binutils-2.17" "GNU Development Tools" .SH "NAME" readelf \- Displays information about ELF files. .SH "SYNOPSIS" @@ -137,6 +137,8 @@ readelf [\fB\-a\fR|\fB\-\-all\fR] [\fB\-h\fR|\fB\-\-file\-header\fR] [\fB\-l\fR|\fB\-\-program\-headers\fR|\fB\-\-segments\fR] [\fB\-S\fR|\fB\-\-section\-headers\fR|\fB\-\-sections\fR] + [\fB\-g\fR|\fB\-\-section\-groups\fR] + [\fB\-t\fR|\fB\-\-section\-details\fR] [\fB\-e\fR|\fB\-\-headers\fR] [\fB\-s\fR|\fB\-\-syms\fR|\fB\-\-symbols\fR] [\fB\-n\fR|\fB\-\-notes\fR] @@ -146,9 +148,9 @@ readelf [\fB\-a\fR|\fB\-\-all\fR] [\fB\-V\fR|\fB\-\-version\-info\fR] [\fB\-A\fR|\fB\-\-arch\-specific\fR] [\fB\-D\fR|\fB\-\-use\-dynamic\fR] - [\fB\-x\fR |\fB\-\-hex\-dump=\fR] - [\fB\-w[liaprmfFso]\fR| - \fB\-\-debug\-dump\fR[=line,=info,=abbrev,=pubnames,=ranges,=macro,=frames,=frames\-interp,=str,=loc]] + [\fB\-x\fR |\fB\-\-hex\-dump=\fR] + [\fB\-w[liaprmfFsoR]\fR| + \fB\-\-debug\-dump\fR[=line,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames\-interp,=str,=loc,=Ranges]] [\fB\-I\fR|\fB\-histogram\fR] [\fB\-v\fR|\fB\-\-version\fR] [\fB\-W\fR|\fB\-\-wide\fR] @@ -209,6 +211,21 @@ has any. .PD Displays the information contained in the file's section headers, if it has any. +.IP "\fB\-g\fR" 4 +.IX Item "-g" +.PD 0 +.IP "\fB\-\-section\-groups\fR" 4 +.IX Item "--section-groups" +.PD +Displays the information contained in the file's section groups, if it +has any. +.IP "\fB\-t\fR" 4 +.IX Item "-t" +.PD 0 +.IP "\fB\-\-section\-details\fR" 4 +.IX Item "--section-details" +.PD +Displays the detailed section information. Implies \fB\-S\fR. .IP "\fB\-s\fR" 4 .IX Item "-s" .PD 0 @@ -231,7 +248,7 @@ Display all the headers in the file. Equivalent to \fB\-h \-l \-S\fR. .IP "\fB\-\-notes\fR" 4 .IX Item "--notes" .PD -Displays the contents of the \s-1NOTE\s0 segment, if it exists. +Displays the contents of the \s-1NOTE\s0 segments and/or sections, if any. .IP "\fB\-r\fR" 4 .IX Item "-r" .PD 0 @@ -279,18 +296,20 @@ is any. When displaying symbols, this option makes \fBreadelf\fR use the symbol table in the file's dynamic section, rather than the one in the symbols section. -.IP "\fB\-x \fR" 4 -.IX Item "-x " +.IP "\fB\-x \fR" 4 +.IX Item "-x " .PD 0 -.IP "\fB\-\-hex\-dump=\fR" 4 -.IX Item "--hex-dump=" +.IP "\fB\-\-hex\-dump=\fR" 4 +.IX Item "--hex-dump=" .PD Displays the contents of the indicated section as a hexadecimal dump. -.IP "\fB\-w[liaprmfFso]\fR" 4 -.IX Item "-w[liaprmfFso]" +A number identifies a particular section by index in the section table; +any other string identifies all sections with that name in the object file. +.IP "\fB\-w[liaprmfFsoR]\fR" 4 +.IX Item "-w[liaprmfFsoR]" .PD 0 -.IP "\fB\-\-debug\-dump[=line,=info,=abbrev,=pubnames,=ranges,=macro,=frames,=frames\-interp,=str,=loc]\fR" 4 -.IX Item "--debug-dump[=line,=info,=abbrev,=pubnames,=ranges,=macro,=frames,=frames-interp,=str,=loc]" +.IP "\fB\-\-debug\-dump[=line,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames\-interp,=str,=loc,=Ranges]\fR" 4 +.IX Item "--debug-dump[=line,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=loc,=Ranges]" .PD Displays the contents of the debug sections in the file, if any are present. If one of the optional letters or words follows the switch @@ -328,17 +347,30 @@ single line, which is far more readable on terminals wider than 80 columns. .IX Item "--help" .PD Display the command line options understood by \fBreadelf\fR. +.IP "\fB@\fR\fIfile\fR" 4 +.IX Item "@file" +Read command-line options from \fIfile\fR. The options read are +inserted in place of the original @\fIfile\fR option. If \fIfile\fR +does not exist, or cannot be read, then the option will be treated +literally, and not removed. +.Sp +Options in \fIfile\fR are separated by whitespace. A whitespace +character may be included in an option by surrounding the entire +option in either single or double quotes. Any character (including a +backslash) may be included by prefixing the character to be included +with a backslash. The \fIfile\fR may itself contain additional +@\fIfile\fR options; any such options will be processed recursively. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fIobjdump\fR\|(1), and the Info entries for \fIbinutils\fR. .SH "COPYRIGHT" .IX Header "COPYRIGHT" -Copyright (c) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, -2001, 2002, 2003 Free Software Foundation, Inc. +Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. .PP Permission is granted to copy, distribute and/or modify this document under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the -section entitled ``\s-1GNU\s0 Free Documentation License''. +section entitled \*(L"\s-1GNU\s0 Free Documentation License\*(R". diff --git a/contrib/binutils/binutils/doc/size.1 b/contrib/binutils/binutils/doc/size.1 index 4bf051258e0..1cf72ac7fe2 100644 --- a/contrib/binutils/binutils/doc/size.1 +++ b/contrib/binutils/binutils/doc/size.1 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14 +.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32 .\" .\" Standard preamble: .\" ======================================================================== @@ -25,11 +25,11 @@ .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left -.\" double quote, and \*(R" will give a right double quote. | will give a -.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to -.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' -.\" expand to `' in nroff, nothing in troff, for use with C<>. -.tr \(*W-|\(bv\*(Tr +.\" double quote, and \*(R" will give a right double quote. \*(C+ will +.\" give a nicer C++. Capital omega is used to do unbreakable dashes and +.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, +.\" nothing in troff, for use with C<>. +.tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- @@ -128,7 +128,7 @@ .\" ======================================================================== .\" .IX Title "SIZE 1" -.TH SIZE 1 "2004-04-09" "binutils-2.14.91" "GNU Development Tools" +.TH SIZE 1 "2006-06-23" "binutils-2.17" "GNU Development Tools" .SH "NAME" size \- list section sizes and total size. .SH "SYNOPSIS" @@ -169,7 +169,7 @@ Here is an example of the Berkeley (default) format of output from \&\fBsize\fR: .Sp .Vb 4 -\& $ size --format=Berkeley ranlib size +\& $ size \-\-format=Berkeley ranlib size \& text data bss dec hex filename \& 294880 81920 11592 388392 5ed28 ranlib \& 294880 81920 11888 388688 5ee50 size @@ -178,7 +178,7 @@ Here is an example of the Berkeley (default) format of output from This is the same data, but displayed closer to System V conventions: .Sp .Vb 7 -\& $ size --format=SysV ranlib size +\& $ size \-\-format=SysV ranlib size \& ranlib : \& section size addr \& .text 294880 8192 @@ -234,17 +234,30 @@ automatically recognize many formats. .IX Item "--version" .PD Display the version number of \fBsize\fR. +.IP "\fB@\fR\fIfile\fR" 4 +.IX Item "@file" +Read command-line options from \fIfile\fR. The options read are +inserted in place of the original @\fIfile\fR option. If \fIfile\fR +does not exist, or cannot be read, then the option will be treated +literally, and not removed. +.Sp +Options in \fIfile\fR are separated by whitespace. A whitespace +character may be included in an option by surrounding the entire +option in either single or double quotes. Any character (including a +backslash) may be included by prefixing the character to be included +with a backslash. The \fIfile\fR may itself contain additional +@\fIfile\fR options; any such options will be processed recursively. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fIar\fR\|(1), \fIobjdump\fR\|(1), \fIreadelf\fR\|(1), and the Info entries for \fIbinutils\fR. .SH "COPYRIGHT" .IX Header "COPYRIGHT" -Copyright (c) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, -2001, 2002, 2003 Free Software Foundation, Inc. +Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. .PP Permission is granted to copy, distribute and/or modify this document under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the -section entitled ``\s-1GNU\s0 Free Documentation License''. +section entitled \*(L"\s-1GNU\s0 Free Documentation License\*(R". diff --git a/contrib/binutils/binutils/doc/strings.1 b/contrib/binutils/binutils/doc/strings.1 index f3b9be0f2d4..5cffee121bf 100644 --- a/contrib/binutils/binutils/doc/strings.1 +++ b/contrib/binutils/binutils/doc/strings.1 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14 +.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32 .\" .\" Standard preamble: .\" ======================================================================== @@ -25,11 +25,11 @@ .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left -.\" double quote, and \*(R" will give a right double quote. | will give a -.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to -.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' -.\" expand to `' in nroff, nothing in troff, for use with C<>. -.tr \(*W-|\(bv\*(Tr +.\" double quote, and \*(R" will give a right double quote. \*(C+ will +.\" give a nicer C++. Capital omega is used to do unbreakable dashes and +.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, +.\" nothing in troff, for use with C<>. +.tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- @@ -128,7 +128,7 @@ .\" ======================================================================== .\" .IX Title "STRINGS 1" -.TH STRINGS 1 "2004-04-09" "binutils-2.14.91" "GNU Development Tools" +.TH STRINGS 1 "2006-06-23" "binutils-2.17" "GNU Development Tools" .SH "NAME" strings \- print the strings of printable characters in files. .SH "SYNOPSIS" @@ -219,18 +219,31 @@ Specify an object code format other than your system's default format. .IX Item "--version" .PD Print the program version number on the standard output and exit. +.IP "\fB@\fR\fIfile\fR" 4 +.IX Item "@file" +Read command-line options from \fIfile\fR. The options read are +inserted in place of the original @\fIfile\fR option. If \fIfile\fR +does not exist, or cannot be read, then the option will be treated +literally, and not removed. +.Sp +Options in \fIfile\fR are separated by whitespace. A whitespace +character may be included in an option by surrounding the entire +option in either single or double quotes. Any character (including a +backslash) may be included by prefixing the character to be included +with a backslash. The \fIfile\fR may itself contain additional +@\fIfile\fR options; any such options will be processed recursively. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fIar\fR\|(1), \fInm\fR\|(1), \fIobjdump\fR\|(1), \fIranlib\fR\|(1), \fIreadelf\fR\|(1) and the Info entries for \fIbinutils\fR. .SH "COPYRIGHT" .IX Header "COPYRIGHT" -Copyright (c) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, -2001, 2002, 2003 Free Software Foundation, Inc. +Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. .PP Permission is granted to copy, distribute and/or modify this document under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the -section entitled ``\s-1GNU\s0 Free Documentation License''. +section entitled \*(L"\s-1GNU\s0 Free Documentation License\*(R". diff --git a/contrib/binutils/binutils/doc/strip.1 b/contrib/binutils/binutils/doc/strip.1 index 2073020819b..982255ef754 100644 --- a/contrib/binutils/binutils/doc/strip.1 +++ b/contrib/binutils/binutils/doc/strip.1 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14 +.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32 .\" .\" Standard preamble: .\" ======================================================================== @@ -25,11 +25,11 @@ .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left -.\" double quote, and \*(R" will give a right double quote. | will give a -.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to -.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' -.\" expand to `' in nroff, nothing in troff, for use with C<>. -.tr \(*W-|\(bv\*(Tr +.\" double quote, and \*(R" will give a right double quote. \*(C+ will +.\" give a nicer C++. Capital omega is used to do unbreakable dashes and +.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, +.\" nothing in troff, for use with C<>. +.tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- @@ -128,7 +128,7 @@ .\" ======================================================================== .\" .IX Title "STRIP 1" -.TH STRIP 1 "2004-04-09" "binutils-2.14.91" "GNU Development Tools" +.TH STRIP 1 "2006-06-23" "binutils-2.17" "GNU Development Tools" .SH "NAME" strip \- Discard symbols from object files. .SH "SYNOPSIS" @@ -144,6 +144,7 @@ strip [\fB\-F\fR \fIbfdname\fR |\fB\-\-target=\fR\fIbfdname\fR] [\fB\-x\fR|\fB\-\-discard\-all\fR] [\fB\-X\fR |\fB\-\-discard\-locals\fR] [\fB\-R\fR \fIsectionname\fR |\fB\-\-remove\-section=\fR\fIsectionname\fR] [\fB\-o\fR \fIfile\fR] [\fB\-p\fR|\fB\-\-preserve\-dates\fR] + [\fB\-\-keep\-file\-symbols\fR] [\fB\-\-only\-keep\-debug\fR] [\fB\-v\fR |\fB\-\-verbose\fR] [\fB\-V\fR|\fB\-\-version\fR] [\fB\-\-help\fR] [\fB\-\-info\fR] @@ -223,8 +224,8 @@ Remove all symbols that are not needed for relocation processing. .IP "\fB\-\-keep\-symbol=\fR\fIsymbolname\fR" 4 .IX Item "--keep-symbol=symbolname" .PD -Keep only symbol \fIsymbolname\fR from the source file. This option may -be given more than once. +When stripping symbols, keep symbol \fIsymbolname\fR even if it would +normally be stripped. This option may be given more than once. .IP "\fB\-N\fR \fIsymbolname\fR" 4 .IX Item "-N symbolname" .PD 0 @@ -260,11 +261,11 @@ point (!) then the sense of the switch is reversed for that symbol. For example: .Sp .Vb 1 -\& -w -K !foo -K fo* +\& \-w \-K !foo \-K fo* .Ve .Sp would cause strip to only keep symbols that start with the letters -``fo'', but to discard the symbol ``foo''. +\&\*(L"fo\*(R", but to discard the symbol \*(L"foo\*(R". .IP "\fB\-x\fR" 4 .IX Item "-x" .PD 0 @@ -280,6 +281,11 @@ Remove non-global symbols. .PD Remove compiler-generated local symbols. (These usually start with \fBL\fR or \fB.\fR.) +.IP "\fB\-\-keep\-file\-symbols\fR" 4 +.IX Item "--keep-file-symbols" +When stripping a file, perhaps with \fB\-\-strip\-debug\fR or +\&\fB\-\-strip\-unneeded\fR, retain any symbols specifying source file names, +which would otherwise get stripped. .IP "\fB\-\-only\-keep\-debug\fR" 4 .IX Item "--only-keep-debug" Strip a file, removing any sections that would be stripped by @@ -348,17 +354,30 @@ Show the version number for \fBstrip\fR. .PD Verbose output: list all object files modified. In the case of archives, \fBstrip \-v\fR lists all members of the archive. +.IP "\fB@\fR\fIfile\fR" 4 +.IX Item "@file" +Read command-line options from \fIfile\fR. The options read are +inserted in place of the original @\fIfile\fR option. If \fIfile\fR +does not exist, or cannot be read, then the option will be treated +literally, and not removed. +.Sp +Options in \fIfile\fR are separated by whitespace. A whitespace +character may be included in an option by surrounding the entire +option in either single or double quotes. Any character (including a +backslash) may be included by prefixing the character to be included +with a backslash. The \fIfile\fR may itself contain additional +@\fIfile\fR options; any such options will be processed recursively. .SH "SEE ALSO" .IX Header "SEE ALSO" the Info entries for \fIbinutils\fR. .SH "COPYRIGHT" .IX Header "COPYRIGHT" -Copyright (c) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, -2001, 2002, 2003 Free Software Foundation, Inc. +Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. .PP Permission is granted to copy, distribute and/or modify this document under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the -section entitled ``\s-1GNU\s0 Free Documentation License''. +section entitled \*(L"\s-1GNU\s0 Free Documentation License\*(R". diff --git a/contrib/binutils/binutils/dwarf.c b/contrib/binutils/binutils/dwarf.c new file mode 100644 index 00000000000..c69cab224b2 --- /dev/null +++ b/contrib/binutils/binutils/dwarf.c @@ -0,0 +1,3732 @@ +/* dwarf.c -- display DWARF contents of a BFD binary file + Copyright 2005, 2006 + Free Software Foundation, Inc. + + This file is part of GNU Binutils. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ + +#include + +#include "dwarf.h" + +#include "bucomm.h" +#include "libiberty.h" + +static int have_frame_base; +static int need_base_address; + +static unsigned int last_pointer_size = 0; +static int warned_about_missing_comp_units = FALSE; + +static unsigned int num_debug_info_entries = 0; +static debug_info *debug_information = NULL; + +dwarf_vma eh_addr_size; +int is_relocatable; + +int do_debug_info; +int do_debug_abbrevs; +int do_debug_lines; +int do_debug_pubnames; +int do_debug_aranges; +int do_debug_ranges; +int do_debug_frames; +int do_debug_frames_interp; +int do_debug_macinfo; +int do_debug_str; +int do_debug_loc; + +dwarf_vma (*byte_get) (unsigned char *, int); + +dwarf_vma +byte_get_little_endian (unsigned char *field, int size) +{ + switch (size) + { + case 1: + return *field; + + case 2: + return ((unsigned int) (field[0])) + | (((unsigned int) (field[1])) << 8); + + case 4: + return ((unsigned long) (field[0])) + | (((unsigned long) (field[1])) << 8) + | (((unsigned long) (field[2])) << 16) + | (((unsigned long) (field[3])) << 24); + + case 8: + if (sizeof (dwarf_vma) == 8) + return ((dwarf_vma) (field[0])) + | (((dwarf_vma) (field[1])) << 8) + | (((dwarf_vma) (field[2])) << 16) + | (((dwarf_vma) (field[3])) << 24) + | (((dwarf_vma) (field[4])) << 32) + | (((dwarf_vma) (field[5])) << 40) + | (((dwarf_vma) (field[6])) << 48) + | (((dwarf_vma) (field[7])) << 56); + else if (sizeof (dwarf_vma) == 4) + /* We want to extract data from an 8 byte wide field and + place it into a 4 byte wide field. Since this is a little + endian source we can just use the 4 byte extraction code. */ + return ((unsigned long) (field[0])) + | (((unsigned long) (field[1])) << 8) + | (((unsigned long) (field[2])) << 16) + | (((unsigned long) (field[3])) << 24); + + default: + error (_("Unhandled data length: %d\n"), size); + abort (); + } +} + +dwarf_vma +byte_get_big_endian (unsigned char *field, int size) +{ + switch (size) + { + case 1: + return *field; + + case 2: + return ((unsigned int) (field[1])) | (((int) (field[0])) << 8); + + case 4: + return ((unsigned long) (field[3])) + | (((unsigned long) (field[2])) << 8) + | (((unsigned long) (field[1])) << 16) + | (((unsigned long) (field[0])) << 24); + + case 8: + if (sizeof (dwarf_vma) == 8) + return ((dwarf_vma) (field[7])) + | (((dwarf_vma) (field[6])) << 8) + | (((dwarf_vma) (field[5])) << 16) + | (((dwarf_vma) (field[4])) << 24) + | (((dwarf_vma) (field[3])) << 32) + | (((dwarf_vma) (field[2])) << 40) + | (((dwarf_vma) (field[1])) << 48) + | (((dwarf_vma) (field[0])) << 56); + else if (sizeof (dwarf_vma) == 4) + { + /* Although we are extracing data from an 8 byte wide field, + we are returning only 4 bytes of data. */ + field += 4; + return ((unsigned long) (field[3])) + | (((unsigned long) (field[2])) << 8) + | (((unsigned long) (field[1])) << 16) + | (((unsigned long) (field[0])) << 24); + } + + default: + error (_("Unhandled data length: %d\n"), size); + abort (); + } +} + +static dwarf_vma +byte_get_signed (unsigned char *field, int size) +{ + dwarf_vma x = byte_get (field, size); + + switch (size) + { + case 1: + return (x ^ 0x80) - 0x80; + case 2: + return (x ^ 0x8000) - 0x8000; + case 4: + return (x ^ 0x80000000) - 0x80000000; + case 8: + return x; + default: + abort (); + } +} + +static unsigned long int +read_leb128 (unsigned char *data, unsigned int *length_return, int sign) +{ + unsigned long int result = 0; + unsigned int num_read = 0; + unsigned int shift = 0; + unsigned char byte; + + do + { + byte = *data++; + num_read++; + + result |= ((unsigned long int) (byte & 0x7f)) << shift; + + shift += 7; + + } + while (byte & 0x80); + + if (length_return != NULL) + *length_return = num_read; + + if (sign && (shift < 8 * sizeof (result)) && (byte & 0x40)) + result |= -1L << shift; + + return result; +} + +typedef struct State_Machine_Registers +{ + unsigned long address; + unsigned int file; + unsigned int line; + unsigned int column; + int is_stmt; + int basic_block; + int end_sequence; +/* This variable hold the number of the last entry seen + in the File Table. */ + unsigned int last_file_entry; +} SMR; + +static SMR state_machine_regs; + +static void +reset_state_machine (int is_stmt) +{ + state_machine_regs.address = 0; + state_machine_regs.file = 1; + state_machine_regs.line = 1; + state_machine_regs.column = 0; + state_machine_regs.is_stmt = is_stmt; + state_machine_regs.basic_block = 0; + state_machine_regs.end_sequence = 0; + state_machine_regs.last_file_entry = 0; +} + +/* Handled an extend line op. + Returns the number of bytes read. */ + +static int +process_extended_line_op (unsigned char *data, int is_stmt) +{ + unsigned char op_code; + unsigned int bytes_read; + unsigned int len; + unsigned char *name; + unsigned long adr; + + len = read_leb128 (data, & bytes_read, 0); + data += bytes_read; + + if (len == 0) + { + warn (_("badly formed extended line op encountered!\n")); + return bytes_read; + } + + len += bytes_read; + op_code = *data++; + + printf (_(" Extended opcode %d: "), op_code); + + switch (op_code) + { + case DW_LNE_end_sequence: + printf (_("End of Sequence\n\n")); + reset_state_machine (is_stmt); + break; + + case DW_LNE_set_address: + adr = byte_get (data, len - bytes_read - 1); + printf (_("set Address to 0x%lx\n"), adr); + state_machine_regs.address = adr; + break; + + case DW_LNE_define_file: + printf (_(" define new File Table entry\n")); + printf (_(" Entry\tDir\tTime\tSize\tName\n")); + + printf (_(" %d\t"), ++state_machine_regs.last_file_entry); + name = data; + data += strlen ((char *) data) + 1; + printf (_("%lu\t"), read_leb128 (data, & bytes_read, 0)); + data += bytes_read; + printf (_("%lu\t"), read_leb128 (data, & bytes_read, 0)); + data += bytes_read; + printf (_("%lu\t"), read_leb128 (data, & bytes_read, 0)); + printf (_("%s\n\n"), name); + break; + + default: + printf (_("UNKNOWN: length %d\n"), len - bytes_read); + break; + } + + return len; +} + +static const char * +fetch_indirect_string (unsigned long offset) +{ + struct dwarf_section *section = &debug_displays [str].section; + + if (section->start == NULL) + return _(""); + + /* DWARF sections under Mach-O have non-zero addresses. */ + offset -= section->address; + if (offset > section->size) + { + warn (_("DW_FORM_strp offset too big: %lx\n"), offset); + return _(""); + } + + return (const char *) section->start + offset; +} + +/* FIXME: There are better and more efficient ways to handle + these structures. For now though, I just want something that + is simple to implement. */ +typedef struct abbrev_attr +{ + unsigned long attribute; + unsigned long form; + struct abbrev_attr *next; +} +abbrev_attr; + +typedef struct abbrev_entry +{ + unsigned long entry; + unsigned long tag; + int children; + struct abbrev_attr *first_attr; + struct abbrev_attr *last_attr; + struct abbrev_entry *next; +} +abbrev_entry; + +static abbrev_entry *first_abbrev = NULL; +static abbrev_entry *last_abbrev = NULL; + +static void +free_abbrevs (void) +{ + abbrev_entry *abbrev; + + for (abbrev = first_abbrev; abbrev;) + { + abbrev_entry *next = abbrev->next; + abbrev_attr *attr; + + for (attr = abbrev->first_attr; attr;) + { + abbrev_attr *next = attr->next; + + free (attr); + attr = next; + } + + free (abbrev); + abbrev = next; + } + + last_abbrev = first_abbrev = NULL; +} + +static void +add_abbrev (unsigned long number, unsigned long tag, int children) +{ + abbrev_entry *entry; + + entry = malloc (sizeof (*entry)); + + if (entry == NULL) + /* ugg */ + return; + + entry->entry = number; + entry->tag = tag; + entry->children = children; + entry->first_attr = NULL; + entry->last_attr = NULL; + entry->next = NULL; + + if (first_abbrev == NULL) + first_abbrev = entry; + else + last_abbrev->next = entry; + + last_abbrev = entry; +} + +static void +add_abbrev_attr (unsigned long attribute, unsigned long form) +{ + abbrev_attr *attr; + + attr = malloc (sizeof (*attr)); + + if (attr == NULL) + /* ugg */ + return; + + attr->attribute = attribute; + attr->form = form; + attr->next = NULL; + + if (last_abbrev->first_attr == NULL) + last_abbrev->first_attr = attr; + else + last_abbrev->last_attr->next = attr; + + last_abbrev->last_attr = attr; +} + +/* Processes the (partial) contents of a .debug_abbrev section. + Returns NULL if the end of the section was encountered. + Returns the address after the last byte read if the end of + an abbreviation set was found. */ + +static unsigned char * +process_abbrev_section (unsigned char *start, unsigned char *end) +{ + if (first_abbrev != NULL) + return NULL; + + while (start < end) + { + unsigned int bytes_read; + unsigned long entry; + unsigned long tag; + unsigned long attribute; + int children; + + entry = read_leb128 (start, & bytes_read, 0); + start += bytes_read; + + /* A single zero is supposed to end the section according + to the standard. If there's more, then signal that to + the caller. */ + if (entry == 0) + return start == end ? NULL : start; + + tag = read_leb128 (start, & bytes_read, 0); + start += bytes_read; + + children = *start++; + + add_abbrev (entry, tag, children); + + do + { + unsigned long form; + + attribute = read_leb128 (start, & bytes_read, 0); + start += bytes_read; + + form = read_leb128 (start, & bytes_read, 0); + start += bytes_read; + + if (attribute != 0) + add_abbrev_attr (attribute, form); + } + while (attribute != 0); + } + + return NULL; +} + +static char * +get_TAG_name (unsigned long tag) +{ + switch (tag) + { + case DW_TAG_padding: return "DW_TAG_padding"; + case DW_TAG_array_type: return "DW_TAG_array_type"; + case DW_TAG_class_type: return "DW_TAG_class_type"; + case DW_TAG_entry_point: return "DW_TAG_entry_point"; + case DW_TAG_enumeration_type: return "DW_TAG_enumeration_type"; + case DW_TAG_formal_parameter: return "DW_TAG_formal_parameter"; + case DW_TAG_imported_declaration: return "DW_TAG_imported_declaration"; + case DW_TAG_label: return "DW_TAG_label"; + case DW_TAG_lexical_block: return "DW_TAG_lexical_block"; + case DW_TAG_member: return "DW_TAG_member"; + case DW_TAG_pointer_type: return "DW_TAG_pointer_type"; + case DW_TAG_reference_type: return "DW_TAG_reference_type"; + case DW_TAG_compile_unit: return "DW_TAG_compile_unit"; + case DW_TAG_string_type: return "DW_TAG_string_type"; + case DW_TAG_structure_type: return "DW_TAG_structure_type"; + case DW_TAG_subroutine_type: return "DW_TAG_subroutine_type"; + case DW_TAG_typedef: return "DW_TAG_typedef"; + case DW_TAG_union_type: return "DW_TAG_union_type"; + case DW_TAG_unspecified_parameters: return "DW_TAG_unspecified_parameters"; + case DW_TAG_variant: return "DW_TAG_variant"; + case DW_TAG_common_block: return "DW_TAG_common_block"; + case DW_TAG_common_inclusion: return "DW_TAG_common_inclusion"; + case DW_TAG_inheritance: return "DW_TAG_inheritance"; + case DW_TAG_inlined_subroutine: return "DW_TAG_inlined_subroutine"; + case DW_TAG_module: return "DW_TAG_module"; + case DW_TAG_ptr_to_member_type: return "DW_TAG_ptr_to_member_type"; + case DW_TAG_set_type: return "DW_TAG_set_type"; + case DW_TAG_subrange_type: return "DW_TAG_subrange_type"; + case DW_TAG_with_stmt: return "DW_TAG_with_stmt"; + case DW_TAG_access_declaration: return "DW_TAG_access_declaration"; + case DW_TAG_base_type: return "DW_TAG_base_type"; + case DW_TAG_catch_block: return "DW_TAG_catch_block"; + case DW_TAG_const_type: return "DW_TAG_const_type"; + case DW_TAG_constant: return "DW_TAG_constant"; + case DW_TAG_enumerator: return "DW_TAG_enumerator"; + case DW_TAG_file_type: return "DW_TAG_file_type"; + case DW_TAG_friend: return "DW_TAG_friend"; + case DW_TAG_namelist: return "DW_TAG_namelist"; + case DW_TAG_namelist_item: return "DW_TAG_namelist_item"; + case DW_TAG_packed_type: return "DW_TAG_packed_type"; + case DW_TAG_subprogram: return "DW_TAG_subprogram"; + case DW_TAG_template_type_param: return "DW_TAG_template_type_param"; + case DW_TAG_template_value_param: return "DW_TAG_template_value_param"; + case DW_TAG_thrown_type: return "DW_TAG_thrown_type"; + case DW_TAG_try_block: return "DW_TAG_try_block"; + case DW_TAG_variant_part: return "DW_TAG_variant_part"; + case DW_TAG_variable: return "DW_TAG_variable"; + case DW_TAG_volatile_type: return "DW_TAG_volatile_type"; + case DW_TAG_MIPS_loop: return "DW_TAG_MIPS_loop"; + case DW_TAG_format_label: return "DW_TAG_format_label"; + case DW_TAG_function_template: return "DW_TAG_function_template"; + case DW_TAG_class_template: return "DW_TAG_class_template"; + /* DWARF 2.1 values. */ + case DW_TAG_dwarf_procedure: return "DW_TAG_dwarf_procedure"; + case DW_TAG_restrict_type: return "DW_TAG_restrict_type"; + case DW_TAG_interface_type: return "DW_TAG_interface_type"; + case DW_TAG_namespace: return "DW_TAG_namespace"; + case DW_TAG_imported_module: return "DW_TAG_imported_module"; + case DW_TAG_unspecified_type: return "DW_TAG_unspecified_type"; + case DW_TAG_partial_unit: return "DW_TAG_partial_unit"; + case DW_TAG_imported_unit: return "DW_TAG_imported_unit"; + /* UPC values. */ + case DW_TAG_upc_shared_type: return "DW_TAG_upc_shared_type"; + case DW_TAG_upc_strict_type: return "DW_TAG_upc_strict_type"; + case DW_TAG_upc_relaxed_type: return "DW_TAG_upc_relaxed_type"; + default: + { + static char buffer[100]; + + snprintf (buffer, sizeof (buffer), _("Unknown TAG value: %lx"), tag); + return buffer; + } + } +} + +static char * +get_FORM_name (unsigned long form) +{ + switch (form) + { + case DW_FORM_addr: return "DW_FORM_addr"; + case DW_FORM_block2: return "DW_FORM_block2"; + case DW_FORM_block4: return "DW_FORM_block4"; + case DW_FORM_data2: return "DW_FORM_data2"; + case DW_FORM_data4: return "DW_FORM_data4"; + case DW_FORM_data8: return "DW_FORM_data8"; + case DW_FORM_string: return "DW_FORM_string"; + case DW_FORM_block: return "DW_FORM_block"; + case DW_FORM_block1: return "DW_FORM_block1"; + case DW_FORM_data1: return "DW_FORM_data1"; + case DW_FORM_flag: return "DW_FORM_flag"; + case DW_FORM_sdata: return "DW_FORM_sdata"; + case DW_FORM_strp: return "DW_FORM_strp"; + case DW_FORM_udata: return "DW_FORM_udata"; + case DW_FORM_ref_addr: return "DW_FORM_ref_addr"; + case DW_FORM_ref1: return "DW_FORM_ref1"; + case DW_FORM_ref2: return "DW_FORM_ref2"; + case DW_FORM_ref4: return "DW_FORM_ref4"; + case DW_FORM_ref8: return "DW_FORM_ref8"; + case DW_FORM_ref_udata: return "DW_FORM_ref_udata"; + case DW_FORM_indirect: return "DW_FORM_indirect"; + default: + { + static char buffer[100]; + + snprintf (buffer, sizeof (buffer), _("Unknown FORM value: %lx"), form); + return buffer; + } + } +} + +static unsigned char * +display_block (unsigned char *data, unsigned long length) +{ + printf (_(" %lu byte block: "), length); + + while (length --) + printf ("%lx ", (unsigned long) byte_get (data++, 1)); + + return data; +} + +static int +decode_location_expression (unsigned char * data, + unsigned int pointer_size, + unsigned long length, + unsigned long cu_offset) +{ + unsigned op; + unsigned int bytes_read; + unsigned long uvalue; + unsigned char *end = data + length; + int need_frame_base = 0; + + while (data < end) + { + op = *data++; + + switch (op) + { + case DW_OP_addr: + printf ("DW_OP_addr: %lx", + (unsigned long) byte_get (data, pointer_size)); + data += pointer_size; + break; + case DW_OP_deref: + printf ("DW_OP_deref"); + break; + case DW_OP_const1u: + printf ("DW_OP_const1u: %lu", (unsigned long) byte_get (data++, 1)); + break; + case DW_OP_const1s: + printf ("DW_OP_const1s: %ld", (long) byte_get_signed (data++, 1)); + break; + case DW_OP_const2u: + printf ("DW_OP_const2u: %lu", (unsigned long) byte_get (data, 2)); + data += 2; + break; + case DW_OP_const2s: + printf ("DW_OP_const2s: %ld", (long) byte_get_signed (data, 2)); + data += 2; + break; + case DW_OP_const4u: + printf ("DW_OP_const4u: %lu", (unsigned long) byte_get (data, 4)); + data += 4; + break; + case DW_OP_const4s: + printf ("DW_OP_const4s: %ld", (long) byte_get_signed (data, 4)); + data += 4; + break; + case DW_OP_const8u: + printf ("DW_OP_const8u: %lu %lu", (unsigned long) byte_get (data, 4), + (unsigned long) byte_get (data + 4, 4)); + data += 8; + break; + case DW_OP_const8s: + printf ("DW_OP_const8s: %ld %ld", (long) byte_get (data, 4), + (long) byte_get (data + 4, 4)); + data += 8; + break; + case DW_OP_constu: + printf ("DW_OP_constu: %lu", read_leb128 (data, &bytes_read, 0)); + data += bytes_read; + break; + case DW_OP_consts: + printf ("DW_OP_consts: %ld", read_leb128 (data, &bytes_read, 1)); + data += bytes_read; + break; + case DW_OP_dup: + printf ("DW_OP_dup"); + break; + case DW_OP_drop: + printf ("DW_OP_drop"); + break; + case DW_OP_over: + printf ("DW_OP_over"); + break; + case DW_OP_pick: + printf ("DW_OP_pick: %ld", (unsigned long) byte_get (data++, 1)); + break; + case DW_OP_swap: + printf ("DW_OP_swap"); + break; + case DW_OP_rot: + printf ("DW_OP_rot"); + break; + case DW_OP_xderef: + printf ("DW_OP_xderef"); + break; + case DW_OP_abs: + printf ("DW_OP_abs"); + break; + case DW_OP_and: + printf ("DW_OP_and"); + break; + case DW_OP_div: + printf ("DW_OP_div"); + break; + case DW_OP_minus: + printf ("DW_OP_minus"); + break; + case DW_OP_mod: + printf ("DW_OP_mod"); + break; + case DW_OP_mul: + printf ("DW_OP_mul"); + break; + case DW_OP_neg: + printf ("DW_OP_neg"); + break; + case DW_OP_not: + printf ("DW_OP_not"); + break; + case DW_OP_or: + printf ("DW_OP_or"); + break; + case DW_OP_plus: + printf ("DW_OP_plus"); + break; + case DW_OP_plus_uconst: + printf ("DW_OP_plus_uconst: %lu", + read_leb128 (data, &bytes_read, 0)); + data += bytes_read; + break; + case DW_OP_shl: + printf ("DW_OP_shl"); + break; + case DW_OP_shr: + printf ("DW_OP_shr"); + break; + case DW_OP_shra: + printf ("DW_OP_shra"); + break; + case DW_OP_xor: + printf ("DW_OP_xor"); + break; + case DW_OP_bra: + printf ("DW_OP_bra: %ld", (long) byte_get_signed (data, 2)); + data += 2; + break; + case DW_OP_eq: + printf ("DW_OP_eq"); + break; + case DW_OP_ge: + printf ("DW_OP_ge"); + break; + case DW_OP_gt: + printf ("DW_OP_gt"); + break; + case DW_OP_le: + printf ("DW_OP_le"); + break; + case DW_OP_lt: + printf ("DW_OP_lt"); + break; + case DW_OP_ne: + printf ("DW_OP_ne"); + break; + case DW_OP_skip: + printf ("DW_OP_skip: %ld", (long) byte_get_signed (data, 2)); + data += 2; + break; + + case DW_OP_lit0: + case DW_OP_lit1: + case DW_OP_lit2: + case DW_OP_lit3: + case DW_OP_lit4: + case DW_OP_lit5: + case DW_OP_lit6: + case DW_OP_lit7: + case DW_OP_lit8: + case DW_OP_lit9: + case DW_OP_lit10: + case DW_OP_lit11: + case DW_OP_lit12: + case DW_OP_lit13: + case DW_OP_lit14: + case DW_OP_lit15: + case DW_OP_lit16: + case DW_OP_lit17: + case DW_OP_lit18: + case DW_OP_lit19: + case DW_OP_lit20: + case DW_OP_lit21: + case DW_OP_lit22: + case DW_OP_lit23: + case DW_OP_lit24: + case DW_OP_lit25: + case DW_OP_lit26: + case DW_OP_lit27: + case DW_OP_lit28: + case DW_OP_lit29: + case DW_OP_lit30: + case DW_OP_lit31: + printf ("DW_OP_lit%d", op - DW_OP_lit0); + break; + + case DW_OP_reg0: + case DW_OP_reg1: + case DW_OP_reg2: + case DW_OP_reg3: + case DW_OP_reg4: + case DW_OP_reg5: + case DW_OP_reg6: + case DW_OP_reg7: + case DW_OP_reg8: + case DW_OP_reg9: + case DW_OP_reg10: + case DW_OP_reg11: + case DW_OP_reg12: + case DW_OP_reg13: + case DW_OP_reg14: + case DW_OP_reg15: + case DW_OP_reg16: + case DW_OP_reg17: + case DW_OP_reg18: + case DW_OP_reg19: + case DW_OP_reg20: + case DW_OP_reg21: + case DW_OP_reg22: + case DW_OP_reg23: + case DW_OP_reg24: + case DW_OP_reg25: + case DW_OP_reg26: + case DW_OP_reg27: + case DW_OP_reg28: + case DW_OP_reg29: + case DW_OP_reg30: + case DW_OP_reg31: + printf ("DW_OP_reg%d", op - DW_OP_reg0); + break; + + case DW_OP_breg0: + case DW_OP_breg1: + case DW_OP_breg2: + case DW_OP_breg3: + case DW_OP_breg4: + case DW_OP_breg5: + case DW_OP_breg6: + case DW_OP_breg7: + case DW_OP_breg8: + case DW_OP_breg9: + case DW_OP_breg10: + case DW_OP_breg11: + case DW_OP_breg12: + case DW_OP_breg13: + case DW_OP_breg14: + case DW_OP_breg15: + case DW_OP_breg16: + case DW_OP_breg17: + case DW_OP_breg18: + case DW_OP_breg19: + case DW_OP_breg20: + case DW_OP_breg21: + case DW_OP_breg22: + case DW_OP_breg23: + case DW_OP_breg24: + case DW_OP_breg25: + case DW_OP_breg26: + case DW_OP_breg27: + case DW_OP_breg28: + case DW_OP_breg29: + case DW_OP_breg30: + case DW_OP_breg31: + printf ("DW_OP_breg%d: %ld", op - DW_OP_breg0, + read_leb128 (data, &bytes_read, 1)); + data += bytes_read; + break; + + case DW_OP_regx: + printf ("DW_OP_regx: %lu", read_leb128 (data, &bytes_read, 0)); + data += bytes_read; + break; + case DW_OP_fbreg: + need_frame_base = 1; + printf ("DW_OP_fbreg: %ld", read_leb128 (data, &bytes_read, 1)); + data += bytes_read; + break; + case DW_OP_bregx: + uvalue = read_leb128 (data, &bytes_read, 0); + data += bytes_read; + printf ("DW_OP_bregx: %lu %ld", uvalue, + read_leb128 (data, &bytes_read, 1)); + data += bytes_read; + break; + case DW_OP_piece: + printf ("DW_OP_piece: %lu", read_leb128 (data, &bytes_read, 0)); + data += bytes_read; + break; + case DW_OP_deref_size: + printf ("DW_OP_deref_size: %ld", (long) byte_get (data++, 1)); + break; + case DW_OP_xderef_size: + printf ("DW_OP_xderef_size: %ld", (long) byte_get (data++, 1)); + break; + case DW_OP_nop: + printf ("DW_OP_nop"); + break; + + /* DWARF 3 extensions. */ + case DW_OP_push_object_address: + printf ("DW_OP_push_object_address"); + break; + case DW_OP_call2: + /* XXX: Strictly speaking for 64-bit DWARF3 files + this ought to be an 8-byte wide computation. */ + printf ("DW_OP_call2: <%lx>", (long) byte_get (data, 2) + cu_offset); + data += 2; + break; + case DW_OP_call4: + /* XXX: Strictly speaking for 64-bit DWARF3 files + this ought to be an 8-byte wide computation. */ + printf ("DW_OP_call4: <%lx>", (long) byte_get (data, 4) + cu_offset); + data += 4; + break; + case DW_OP_call_ref: + printf ("DW_OP_call_ref"); + break; + + /* GNU extensions. */ + case DW_OP_GNU_push_tls_address: + printf ("DW_OP_GNU_push_tls_address"); + break; + + default: + if (op >= DW_OP_lo_user + && op <= DW_OP_hi_user) + printf (_("(User defined location op)")); + else + printf (_("(Unknown location op)")); + /* No way to tell where the next op is, so just bail. */ + return need_frame_base; + } + + /* Separate the ops. */ + if (data < end) + printf ("; "); + } + + return need_frame_base; +} + +static unsigned char * +read_and_display_attr_value (unsigned long attribute, + unsigned long form, + unsigned char *data, + unsigned long cu_offset, + unsigned long pointer_size, + unsigned long offset_size, + int dwarf_version, + debug_info *debug_info_p, + int do_loc) +{ + unsigned long uvalue = 0; + unsigned char *block_start = NULL; + unsigned int bytes_read; + + switch (form) + { + default: + break; + + case DW_FORM_ref_addr: + if (dwarf_version == 2) + { + uvalue = byte_get (data, pointer_size); + data += pointer_size; + } + else if (dwarf_version == 3) + { + uvalue = byte_get (data, offset_size); + data += offset_size; + } + else + { + error (_("Internal error: DWARF version is not 2 or 3.\n")); + } + break; + + case DW_FORM_addr: + uvalue = byte_get (data, pointer_size); + data += pointer_size; + break; + + case DW_FORM_strp: + uvalue = byte_get (data, offset_size); + data += offset_size; + break; + + case DW_FORM_ref1: + case DW_FORM_flag: + case DW_FORM_data1: + uvalue = byte_get (data++, 1); + break; + + case DW_FORM_ref2: + case DW_FORM_data2: + uvalue = byte_get (data, 2); + data += 2; + break; + + case DW_FORM_ref4: + case DW_FORM_data4: + uvalue = byte_get (data, 4); + data += 4; + break; + + case DW_FORM_sdata: + uvalue = read_leb128 (data, & bytes_read, 1); + data += bytes_read; + break; + + case DW_FORM_ref_udata: + case DW_FORM_udata: + uvalue = read_leb128 (data, & bytes_read, 0); + data += bytes_read; + break; + + case DW_FORM_indirect: + form = read_leb128 (data, & bytes_read, 0); + data += bytes_read; + if (!do_loc) + printf (" %s", get_FORM_name (form)); + return read_and_display_attr_value (attribute, form, data, + cu_offset, pointer_size, + offset_size, dwarf_version, + debug_info_p, do_loc); + } + + switch (form) + { + case DW_FORM_ref_addr: + if (!do_loc) + printf (" <#%lx>", uvalue); + break; + + case DW_FORM_ref1: + case DW_FORM_ref2: + case DW_FORM_ref4: + case DW_FORM_ref_udata: + if (!do_loc) + printf (" <%lx>", uvalue + cu_offset); + break; + + case DW_FORM_data4: + case DW_FORM_addr: + if (!do_loc) + printf (" %#lx", uvalue); + break; + + case DW_FORM_flag: + case DW_FORM_data1: + case DW_FORM_data2: + case DW_FORM_sdata: + case DW_FORM_udata: + if (!do_loc) + printf (" %ld", uvalue); + break; + + case DW_FORM_ref8: + case DW_FORM_data8: + if (!do_loc) + { + uvalue = byte_get (data, 4); + printf (" %lx", uvalue); + printf (" %lx", (unsigned long) byte_get (data + 4, 4)); + } + if ((do_loc || do_debug_loc || do_debug_ranges) + && num_debug_info_entries == 0) + { + if (sizeof (uvalue) == 8) + uvalue = byte_get (data, 8); + else + error (_("DW_FORM_data8 is unsupported when sizeof (unsigned long) != 8\n")); + } + data += 8; + break; + + case DW_FORM_string: + if (!do_loc) + printf (" %s", data); + data += strlen ((char *) data) + 1; + break; + + case DW_FORM_block: + uvalue = read_leb128 (data, & bytes_read, 0); + block_start = data + bytes_read; + if (do_loc) + data = block_start + uvalue; + else + data = display_block (block_start, uvalue); + break; + + case DW_FORM_block1: + uvalue = byte_get (data, 1); + block_start = data + 1; + if (do_loc) + data = block_start + uvalue; + else + data = display_block (block_start, uvalue); + break; + + case DW_FORM_block2: + uvalue = byte_get (data, 2); + block_start = data + 2; + if (do_loc) + data = block_start + uvalue; + else + data = display_block (block_start, uvalue); + break; + + case DW_FORM_block4: + uvalue = byte_get (data, 4); + block_start = data + 4; + if (do_loc) + data = block_start + uvalue; + else + data = display_block (block_start, uvalue); + break; + + case DW_FORM_strp: + if (!do_loc) + printf (_(" (indirect string, offset: 0x%lx): %s"), + uvalue, fetch_indirect_string (uvalue)); + break; + + case DW_FORM_indirect: + /* Handled above. */ + break; + + default: + warn (_("Unrecognized form: %lu\n"), form); + break; + } + + /* For some attributes we can display further information. */ + if ((do_loc || do_debug_loc || do_debug_ranges) + && num_debug_info_entries == 0) + { + switch (attribute) + { + case DW_AT_frame_base: + have_frame_base = 1; + case DW_AT_location: + case DW_AT_data_member_location: + case DW_AT_vtable_elem_location: + case DW_AT_allocated: + case DW_AT_associated: + case DW_AT_data_location: + case DW_AT_stride: + case DW_AT_upper_bound: + case DW_AT_lower_bound: + if (form == DW_FORM_data4 || form == DW_FORM_data8) + { + /* Process location list. */ + unsigned int max = debug_info_p->max_loc_offsets; + unsigned int num = debug_info_p->num_loc_offsets; + + if (max == 0 || num >= max) + { + max += 1024; + debug_info_p->loc_offsets + = xcrealloc (debug_info_p->loc_offsets, + max, sizeof (*debug_info_p->loc_offsets)); + debug_info_p->have_frame_base + = xcrealloc (debug_info_p->have_frame_base, + max, sizeof (*debug_info_p->have_frame_base)); + debug_info_p->max_loc_offsets = max; + } + debug_info_p->loc_offsets [num] = uvalue; + debug_info_p->have_frame_base [num] = have_frame_base; + debug_info_p->num_loc_offsets++; + } + break; + + case DW_AT_low_pc: + if (need_base_address) + debug_info_p->base_address = uvalue; + break; + + case DW_AT_ranges: + if (form == DW_FORM_data4 || form == DW_FORM_data8) + { + /* Process range list. */ + unsigned int max = debug_info_p->max_range_lists; + unsigned int num = debug_info_p->num_range_lists; + + if (max == 0 || num >= max) + { + max += 1024; + debug_info_p->range_lists + = xcrealloc (debug_info_p->range_lists, + max, sizeof (*debug_info_p->range_lists)); + debug_info_p->max_range_lists = max; + } + debug_info_p->range_lists [num] = uvalue; + debug_info_p->num_range_lists++; + } + break; + + default: + break; + } + } + + if (do_loc) + return data; + + printf ("\t"); + + switch (attribute) + { + case DW_AT_inline: + switch (uvalue) + { + case DW_INL_not_inlined: + printf (_("(not inlined)")); + break; + case DW_INL_inlined: + printf (_("(inlined)")); + break; + case DW_INL_declared_not_inlined: + printf (_("(declared as inline but ignored)")); + break; + case DW_INL_declared_inlined: + printf (_("(declared as inline and inlined)")); + break; + default: + printf (_(" (Unknown inline attribute value: %lx)"), uvalue); + break; + } + break; + + case DW_AT_language: + switch (uvalue) + { + case DW_LANG_C: printf ("(non-ANSI C)"); break; + case DW_LANG_C89: printf ("(ANSI C)"); break; + case DW_LANG_C_plus_plus: printf ("(C++)"); break; + case DW_LANG_Fortran77: printf ("(FORTRAN 77)"); break; + case DW_LANG_Fortran90: printf ("(Fortran 90)"); break; + case DW_LANG_Modula2: printf ("(Modula 2)"); break; + case DW_LANG_Pascal83: printf ("(ANSI Pascal)"); break; + case DW_LANG_Ada83: printf ("(Ada)"); break; + case DW_LANG_Cobol74: printf ("(Cobol 74)"); break; + case DW_LANG_Cobol85: printf ("(Cobol 85)"); break; + /* DWARF 2.1 values. */ + case DW_LANG_C99: printf ("(ANSI C99)"); break; + case DW_LANG_Ada95: printf ("(ADA 95)"); break; + case DW_LANG_Fortran95: printf ("(Fortran 95)"); break; + /* MIPS extension. */ + case DW_LANG_Mips_Assembler: printf ("(MIPS assembler)"); break; + /* UPC extension. */ + case DW_LANG_Upc: printf ("(Unified Parallel C)"); break; + default: + printf ("(Unknown: %lx)", uvalue); + break; + } + break; + + case DW_AT_encoding: + switch (uvalue) + { + case DW_ATE_void: printf ("(void)"); break; + case DW_ATE_address: printf ("(machine address)"); break; + case DW_ATE_boolean: printf ("(boolean)"); break; + case DW_ATE_complex_float: printf ("(complex float)"); break; + case DW_ATE_float: printf ("(float)"); break; + case DW_ATE_signed: printf ("(signed)"); break; + case DW_ATE_signed_char: printf ("(signed char)"); break; + case DW_ATE_unsigned: printf ("(unsigned)"); break; + case DW_ATE_unsigned_char: printf ("(unsigned char)"); break; + /* DWARF 2.1 value. */ + case DW_ATE_imaginary_float: printf ("(imaginary float)"); break; + case DW_ATE_decimal_float: printf ("(decimal float)"); break; + default: + if (uvalue >= DW_ATE_lo_user + && uvalue <= DW_ATE_hi_user) + printf ("(user defined type)"); + else + printf ("(unknown type)"); + break; + } + break; + + case DW_AT_accessibility: + switch (uvalue) + { + case DW_ACCESS_public: printf ("(public)"); break; + case DW_ACCESS_protected: printf ("(protected)"); break; + case DW_ACCESS_private: printf ("(private)"); break; + default: + printf ("(unknown accessibility)"); + break; + } + break; + + case DW_AT_visibility: + switch (uvalue) + { + case DW_VIS_local: printf ("(local)"); break; + case DW_VIS_exported: printf ("(exported)"); break; + case DW_VIS_qualified: printf ("(qualified)"); break; + default: printf ("(unknown visibility)"); break; + } + break; + + case DW_AT_virtuality: + switch (uvalue) + { + case DW_VIRTUALITY_none: printf ("(none)"); break; + case DW_VIRTUALITY_virtual: printf ("(virtual)"); break; + case DW_VIRTUALITY_pure_virtual:printf ("(pure_virtual)"); break; + default: printf ("(unknown virtuality)"); break; + } + break; + + case DW_AT_identifier_case: + switch (uvalue) + { + case DW_ID_case_sensitive: printf ("(case_sensitive)"); break; + case DW_ID_up_case: printf ("(up_case)"); break; + case DW_ID_down_case: printf ("(down_case)"); break; + case DW_ID_case_insensitive: printf ("(case_insensitive)"); break; + default: printf ("(unknown case)"); break; + } + break; + + case DW_AT_calling_convention: + switch (uvalue) + { + case DW_CC_normal: printf ("(normal)"); break; + case DW_CC_program: printf ("(program)"); break; + case DW_CC_nocall: printf ("(nocall)"); break; + default: + if (uvalue >= DW_CC_lo_user + && uvalue <= DW_CC_hi_user) + printf ("(user defined)"); + else + printf ("(unknown convention)"); + } + break; + + case DW_AT_ordering: + switch (uvalue) + { + case -1: printf ("(undefined)"); break; + case 0: printf ("(row major)"); break; + case 1: printf ("(column major)"); break; + } + break; + + case DW_AT_frame_base: + have_frame_base = 1; + case DW_AT_location: + case DW_AT_data_member_location: + case DW_AT_vtable_elem_location: + case DW_AT_allocated: + case DW_AT_associated: + case DW_AT_data_location: + case DW_AT_stride: + case DW_AT_upper_bound: + case DW_AT_lower_bound: + if (block_start) + { + int need_frame_base; + + printf ("("); + need_frame_base = decode_location_expression (block_start, + pointer_size, + uvalue, + cu_offset); + printf (")"); + if (need_frame_base && !have_frame_base) + printf (_(" [without DW_AT_frame_base]")); + } + else if (form == DW_FORM_data4 || form == DW_FORM_data8) + printf (_("(location list)")); + + break; + + default: + break; + } + + return data; +} + +static char * +get_AT_name (unsigned long attribute) +{ + switch (attribute) + { + case DW_AT_sibling: return "DW_AT_sibling"; + case DW_AT_location: return "DW_AT_location"; + case DW_AT_name: return "DW_AT_name"; + case DW_AT_ordering: return "DW_AT_ordering"; + case DW_AT_subscr_data: return "DW_AT_subscr_data"; + case DW_AT_byte_size: return "DW_AT_byte_size"; + case DW_AT_bit_offset: return "DW_AT_bit_offset"; + case DW_AT_bit_size: return "DW_AT_bit_size"; + case DW_AT_element_list: return "DW_AT_element_list"; + case DW_AT_stmt_list: return "DW_AT_stmt_list"; + case DW_AT_low_pc: return "DW_AT_low_pc"; + case DW_AT_high_pc: return "DW_AT_high_pc"; + case DW_AT_language: return "DW_AT_language"; + case DW_AT_member: return "DW_AT_member"; + case DW_AT_discr: return "DW_AT_discr"; + case DW_AT_discr_value: return "DW_AT_discr_value"; + case DW_AT_visibility: return "DW_AT_visibility"; + case DW_AT_import: return "DW_AT_import"; + case DW_AT_string_length: return "DW_AT_string_length"; + case DW_AT_common_reference: return "DW_AT_common_reference"; + case DW_AT_comp_dir: return "DW_AT_comp_dir"; + case DW_AT_const_value: return "DW_AT_const_value"; + case DW_AT_containing_type: return "DW_AT_containing_type"; + case DW_AT_default_value: return "DW_AT_default_value"; + case DW_AT_inline: return "DW_AT_inline"; + case DW_AT_is_optional: return "DW_AT_is_optional"; + case DW_AT_lower_bound: return "DW_AT_lower_bound"; + case DW_AT_producer: return "DW_AT_producer"; + case DW_AT_prototyped: return "DW_AT_prototyped"; + case DW_AT_return_addr: return "DW_AT_return_addr"; + case DW_AT_start_scope: return "DW_AT_start_scope"; + case DW_AT_stride_size: return "DW_AT_stride_size"; + case DW_AT_upper_bound: return "DW_AT_upper_bound"; + case DW_AT_abstract_origin: return "DW_AT_abstract_origin"; + case DW_AT_accessibility: return "DW_AT_accessibility"; + case DW_AT_address_class: return "DW_AT_address_class"; + case DW_AT_artificial: return "DW_AT_artificial"; + case DW_AT_base_types: return "DW_AT_base_types"; + case DW_AT_calling_convention: return "DW_AT_calling_convention"; + case DW_AT_count: return "DW_AT_count"; + case DW_AT_data_member_location: return "DW_AT_data_member_location"; + case DW_AT_decl_column: return "DW_AT_decl_column"; + case DW_AT_decl_file: return "DW_AT_decl_file"; + case DW_AT_decl_line: return "DW_AT_decl_line"; + case DW_AT_declaration: return "DW_AT_declaration"; + case DW_AT_discr_list: return "DW_AT_discr_list"; + case DW_AT_encoding: return "DW_AT_encoding"; + case DW_AT_external: return "DW_AT_external"; + case DW_AT_frame_base: return "DW_AT_frame_base"; + case DW_AT_friend: return "DW_AT_friend"; + case DW_AT_identifier_case: return "DW_AT_identifier_case"; + case DW_AT_macro_info: return "DW_AT_macro_info"; + case DW_AT_namelist_items: return "DW_AT_namelist_items"; + case DW_AT_priority: return "DW_AT_priority"; + case DW_AT_segment: return "DW_AT_segment"; + case DW_AT_specification: return "DW_AT_specification"; + case DW_AT_static_link: return "DW_AT_static_link"; + case DW_AT_type: return "DW_AT_type"; + case DW_AT_use_location: return "DW_AT_use_location"; + case DW_AT_variable_parameter: return "DW_AT_variable_parameter"; + case DW_AT_virtuality: return "DW_AT_virtuality"; + case DW_AT_vtable_elem_location: return "DW_AT_vtable_elem_location"; + /* DWARF 2.1 values. */ + case DW_AT_allocated: return "DW_AT_allocated"; + case DW_AT_associated: return "DW_AT_associated"; + case DW_AT_data_location: return "DW_AT_data_location"; + case DW_AT_stride: return "DW_AT_stride"; + case DW_AT_entry_pc: return "DW_AT_entry_pc"; + case DW_AT_use_UTF8: return "DW_AT_use_UTF8"; + case DW_AT_extension: return "DW_AT_extension"; + case DW_AT_ranges: return "DW_AT_ranges"; + case DW_AT_trampoline: return "DW_AT_trampoline"; + case DW_AT_call_column: return "DW_AT_call_column"; + case DW_AT_call_file: return "DW_AT_call_file"; + case DW_AT_call_line: return "DW_AT_call_line"; + /* SGI/MIPS extensions. */ + case DW_AT_MIPS_fde: return "DW_AT_MIPS_fde"; + case DW_AT_MIPS_loop_begin: return "DW_AT_MIPS_loop_begin"; + case DW_AT_MIPS_tail_loop_begin: return "DW_AT_MIPS_tail_loop_begin"; + case DW_AT_MIPS_epilog_begin: return "DW_AT_MIPS_epilog_begin"; + case DW_AT_MIPS_loop_unroll_factor: return "DW_AT_MIPS_loop_unroll_factor"; + case DW_AT_MIPS_software_pipeline_depth: + return "DW_AT_MIPS_software_pipeline_depth"; + case DW_AT_MIPS_linkage_name: return "DW_AT_MIPS_linkage_name"; + case DW_AT_MIPS_stride: return "DW_AT_MIPS_stride"; + case DW_AT_MIPS_abstract_name: return "DW_AT_MIPS_abstract_name"; + case DW_AT_MIPS_clone_origin: return "DW_AT_MIPS_clone_origin"; + case DW_AT_MIPS_has_inlines: return "DW_AT_MIPS_has_inlines"; + /* GNU extensions. */ + case DW_AT_sf_names: return "DW_AT_sf_names"; + case DW_AT_src_info: return "DW_AT_src_info"; + case DW_AT_mac_info: return "DW_AT_mac_info"; + case DW_AT_src_coords: return "DW_AT_src_coords"; + case DW_AT_body_begin: return "DW_AT_body_begin"; + case DW_AT_body_end: return "DW_AT_body_end"; + case DW_AT_GNU_vector: return "DW_AT_GNU_vector"; + /* UPC extension. */ + case DW_AT_upc_threads_scaled: return "DW_AT_upc_threads_scaled"; + default: + { + static char buffer[100]; + + snprintf (buffer, sizeof (buffer), _("Unknown AT value: %lx"), + attribute); + return buffer; + } + } +} + +static unsigned char * +read_and_display_attr (unsigned long attribute, + unsigned long form, + unsigned char *data, + unsigned long cu_offset, + unsigned long pointer_size, + unsigned long offset_size, + int dwarf_version, + debug_info *debug_info_p, + int do_loc) +{ + if (!do_loc) + printf (" %-18s:", get_AT_name (attribute)); + data = read_and_display_attr_value (attribute, form, data, cu_offset, + pointer_size, offset_size, + dwarf_version, debug_info_p, + do_loc); + if (!do_loc) + printf ("\n"); + return data; +} + + +/* Process the contents of a .debug_info section. If do_loc is non-zero + then we are scanning for location lists and we do not want to display + anything to the user. */ + +static int +process_debug_info (struct dwarf_section *section, void *file, + int do_loc) +{ + unsigned char *start = section->start; + unsigned char *end = start + section->size; + unsigned char *section_begin; + unsigned int unit; + unsigned int num_units = 0; + + if ((do_loc || do_debug_loc || do_debug_ranges) + && num_debug_info_entries == 0) + { + unsigned long length; + + /* First scan the section to get the number of comp units. */ + for (section_begin = start, num_units = 0; section_begin < end; + num_units ++) + { + /* Read the first 4 bytes. For a 32-bit DWARF section, this + will be the length. For a 64-bit DWARF section, it'll be + the escape code 0xffffffff followed by an 8 byte length. */ + length = byte_get (section_begin, 4); + + if (length == 0xffffffff) + { + length = byte_get (section_begin + 4, 8); + section_begin += length + 12; + } + else + section_begin += length + 4; + } + + if (num_units == 0) + { + error (_("No comp units in %s section ?"), section->name); + return 0; + } + + /* Then allocate an array to hold the information. */ + debug_information = cmalloc (num_units, + sizeof (* debug_information)); + if (debug_information == NULL) + { + error (_("Not enough memory for a debug info array of %u entries"), + num_units); + return 0; + } + } + + if (!do_loc) + { + printf (_("The section %s contains:\n\n"), section->name); + + load_debug_section (str, file); + } + + load_debug_section (abbrev, file); + if (debug_displays [abbrev].section.start == NULL) + { + warn (_("Unable to locate %s section!\n"), + debug_displays [abbrev].section.name); + return 0; + } + + for (section_begin = start, unit = 0; start < end; unit++) + { + DWARF2_Internal_CompUnit compunit; + unsigned char *hdrptr; + unsigned char *cu_abbrev_offset_ptr; + unsigned char *tags; + int level; + unsigned long cu_offset; + int offset_size; + int initial_length_size; + + hdrptr = start; + + compunit.cu_length = byte_get (hdrptr, 4); + hdrptr += 4; + + if (compunit.cu_length == 0xffffffff) + { + compunit.cu_length = byte_get (hdrptr, 8); + hdrptr += 8; + offset_size = 8; + initial_length_size = 12; + } + else + { + offset_size = 4; + initial_length_size = 4; + } + + compunit.cu_version = byte_get (hdrptr, 2); + hdrptr += 2; + + cu_offset = start - section_begin; + start += compunit.cu_length + initial_length_size; + + cu_abbrev_offset_ptr = hdrptr; + compunit.cu_abbrev_offset = byte_get (hdrptr, offset_size); + hdrptr += offset_size; + + compunit.cu_pointer_size = byte_get (hdrptr, 1); + hdrptr += 1; + if ((do_loc || do_debug_loc || do_debug_ranges) + && num_debug_info_entries == 0) + { + debug_information [unit].cu_offset = cu_offset; + debug_information [unit].pointer_size + = compunit.cu_pointer_size; + debug_information [unit].base_address = 0; + debug_information [unit].loc_offsets = NULL; + debug_information [unit].have_frame_base = NULL; + debug_information [unit].max_loc_offsets = 0; + debug_information [unit].num_loc_offsets = 0; + debug_information [unit].range_lists = NULL; + debug_information [unit].max_range_lists= 0; + debug_information [unit].num_range_lists = 0; + } + + tags = hdrptr; + + if (!do_loc) + { + printf (_(" Compilation Unit @ offset 0x%lx:\n"), cu_offset); + printf (_(" Length: %ld\n"), compunit.cu_length); + printf (_(" Version: %d\n"), compunit.cu_version); + printf (_(" Abbrev Offset: %ld\n"), compunit.cu_abbrev_offset); + printf (_(" Pointer Size: %d\n"), compunit.cu_pointer_size); + } + + if (compunit.cu_version != 2 && compunit.cu_version != 3) + { + warn (_("Only version 2 and 3 DWARF debug information is currently supported.\n")); + continue; + } + + free_abbrevs (); + + /* Process the abbrevs used by this compilation unit. DWARF + sections under Mach-O have non-zero addresses. */ + process_abbrev_section + ((unsigned char *) debug_displays [abbrev].section.start + + compunit.cu_abbrev_offset - debug_displays [abbrev].section.address, + (unsigned char *) debug_displays [abbrev].section.start + + debug_displays [abbrev].section.size); + + level = 0; + while (tags < start) + { + unsigned int bytes_read; + unsigned long abbrev_number; + abbrev_entry *entry; + abbrev_attr *attr; + + abbrev_number = read_leb128 (tags, & bytes_read, 0); + tags += bytes_read; + + /* A null DIE marks the end of a list of children. */ + if (abbrev_number == 0) + { + --level; + continue; + } + + /* Scan through the abbreviation list until we reach the + correct entry. */ + for (entry = first_abbrev; + entry && entry->entry != abbrev_number; + entry = entry->next) + continue; + + if (entry == NULL) + { + warn (_("Unable to locate entry %lu in the abbreviation table\n"), + abbrev_number); + return 0; + } + + if (!do_loc) + printf (_(" <%d><%lx>: Abbrev Number: %lu (%s)\n"), + level, + (unsigned long) (tags - section_begin + - bytes_read), + abbrev_number, + get_TAG_name (entry->tag)); + + switch (entry->tag) + { + default: + need_base_address = 0; + break; + case DW_TAG_compile_unit: + need_base_address = 1; + break; + case DW_TAG_entry_point: + case DW_TAG_inlined_subroutine: + case DW_TAG_subprogram: + need_base_address = 0; + /* Assuming that there is no DW_AT_frame_base. */ + have_frame_base = 0; + break; + } + + for (attr = entry->first_attr; attr; attr = attr->next) + tags = read_and_display_attr (attr->attribute, + attr->form, + tags, cu_offset, + compunit.cu_pointer_size, + offset_size, + compunit.cu_version, + &debug_information [unit], + do_loc); + + if (entry->children) + ++level; + } + } + + /* Set num_debug_info_entries here so that it can be used to check if + we need to process .debug_loc and .debug_ranges sections. */ + if ((do_loc || do_debug_loc || do_debug_ranges) + && num_debug_info_entries == 0) + num_debug_info_entries = num_units; + + if (!do_loc) + { + printf ("\n"); + } + + return 1; +} + +/* Locate and scan the .debug_info section in the file and record the pointer + sizes and offsets for the compilation units in it. Usually an executable + will have just one pointer size, but this is not guaranteed, and so we try + not to make any assumptions. Returns zero upon failure, or the number of + compilation units upon success. */ + +static unsigned int +load_debug_info (void * file) +{ + /* Reset the last pointer size so that we can issue correct error + messages if we are displaying the contents of more than one section. */ + last_pointer_size = 0; + warned_about_missing_comp_units = FALSE; + + /* If we already have the information there is nothing else to do. */ + if (num_debug_info_entries > 0) + return num_debug_info_entries; + + if (load_debug_section (info, file) + && process_debug_info (&debug_displays [info].section, file, 1)) + return num_debug_info_entries; + else + return 0; +} + +static int +display_debug_lines (struct dwarf_section *section, void *file) +{ + unsigned char *start = section->start; + unsigned char *data = start; + unsigned char *end = start + section->size; + + printf (_("\nDump of debug contents of section %s:\n\n"), + section->name); + + load_debug_info (file); + + while (data < end) + { + DWARF2_Internal_LineInfo info; + unsigned char *standard_opcodes; + unsigned char *end_of_sequence; + unsigned char *hdrptr; + int initial_length_size; + int offset_size; + int i; + + hdrptr = data; + + /* Check the length of the block. */ + info.li_length = byte_get (hdrptr, 4); + hdrptr += 4; + + if (info.li_length == 0xffffffff) + { + /* This section is 64-bit DWARF 3. */ + info.li_length = byte_get (hdrptr, 8); + hdrptr += 8; + offset_size = 8; + initial_length_size = 12; + } + else + { + offset_size = 4; + initial_length_size = 4; + } + + if (info.li_length + initial_length_size > section->size) + { + warn + (_("The line info appears to be corrupt - the section is too small\n")); + return 0; + } + + /* Check its version number. */ + info.li_version = byte_get (hdrptr, 2); + hdrptr += 2; + if (info.li_version != 2 && info.li_version != 3) + { + warn (_("Only DWARF version 2 and 3 line info is currently supported.\n")); + return 0; + } + + info.li_prologue_length = byte_get (hdrptr, offset_size); + hdrptr += offset_size; + info.li_min_insn_length = byte_get (hdrptr, 1); + hdrptr++; + info.li_default_is_stmt = byte_get (hdrptr, 1); + hdrptr++; + info.li_line_base = byte_get (hdrptr, 1); + hdrptr++; + info.li_line_range = byte_get (hdrptr, 1); + hdrptr++; + info.li_opcode_base = byte_get (hdrptr, 1); + hdrptr++; + + /* Sign extend the line base field. */ + info.li_line_base <<= 24; + info.li_line_base >>= 24; + + printf (_(" Length: %ld\n"), info.li_length); + printf (_(" DWARF Version: %d\n"), info.li_version); + printf (_(" Prologue Length: %d\n"), info.li_prologue_length); + printf (_(" Minimum Instruction Length: %d\n"), info.li_min_insn_length); + printf (_(" Initial value of 'is_stmt': %d\n"), info.li_default_is_stmt); + printf (_(" Line Base: %d\n"), info.li_line_base); + printf (_(" Line Range: %d\n"), info.li_line_range); + printf (_(" Opcode Base: %d\n"), info.li_opcode_base); + + end_of_sequence = data + info.li_length + initial_length_size; + + reset_state_machine (info.li_default_is_stmt); + + /* Display the contents of the Opcodes table. */ + standard_opcodes = hdrptr; + + printf (_("\n Opcodes:\n")); + + for (i = 1; i < info.li_opcode_base; i++) + printf (_(" Opcode %d has %d args\n"), i, standard_opcodes[i - 1]); + + /* Display the contents of the Directory table. */ + data = standard_opcodes + info.li_opcode_base - 1; + + if (*data == 0) + printf (_("\n The Directory Table is empty.\n")); + else + { + printf (_("\n The Directory Table:\n")); + + while (*data != 0) + { + printf (_(" %s\n"), data); + + data += strlen ((char *) data) + 1; + } + } + + /* Skip the NUL at the end of the table. */ + data++; + + /* Display the contents of the File Name table. */ + if (*data == 0) + printf (_("\n The File Name Table is empty.\n")); + else + { + printf (_("\n The File Name Table:\n")); + printf (_(" Entry\tDir\tTime\tSize\tName\n")); + + while (*data != 0) + { + unsigned char *name; + unsigned int bytes_read; + + printf (_(" %d\t"), ++state_machine_regs.last_file_entry); + name = data; + + data += strlen ((char *) data) + 1; + + printf (_("%lu\t"), read_leb128 (data, & bytes_read, 0)); + data += bytes_read; + printf (_("%lu\t"), read_leb128 (data, & bytes_read, 0)); + data += bytes_read; + printf (_("%lu\t"), read_leb128 (data, & bytes_read, 0)); + data += bytes_read; + printf (_("%s\n"), name); + } + } + + /* Skip the NUL at the end of the table. */ + data++; + + /* Now display the statements. */ + printf (_("\n Line Number Statements:\n")); + + while (data < end_of_sequence) + { + unsigned char op_code; + int adv; + unsigned long int uladv; + unsigned int bytes_read; + + op_code = *data++; + + if (op_code >= info.li_opcode_base) + { + op_code -= info.li_opcode_base; + uladv = (op_code / info.li_line_range) * info.li_min_insn_length; + state_machine_regs.address += uladv; + printf (_(" Special opcode %d: advance Address by %lu to 0x%lx"), + op_code, uladv, state_machine_regs.address); + adv = (op_code % info.li_line_range) + info.li_line_base; + state_machine_regs.line += adv; + printf (_(" and Line by %d to %d\n"), + adv, state_machine_regs.line); + } + else switch (op_code) + { + case DW_LNS_extended_op: + data += process_extended_line_op (data, info.li_default_is_stmt); + break; + + case DW_LNS_copy: + printf (_(" Copy\n")); + break; + + case DW_LNS_advance_pc: + uladv = read_leb128 (data, & bytes_read, 0); + uladv *= info.li_min_insn_length; + data += bytes_read; + state_machine_regs.address += uladv; + printf (_(" Advance PC by %lu to 0x%lx\n"), uladv, + state_machine_regs.address); + break; + + case DW_LNS_advance_line: + adv = read_leb128 (data, & bytes_read, 1); + data += bytes_read; + state_machine_regs.line += adv; + printf (_(" Advance Line by %d to %d\n"), adv, + state_machine_regs.line); + break; + + case DW_LNS_set_file: + adv = read_leb128 (data, & bytes_read, 0); + data += bytes_read; + printf (_(" Set File Name to entry %d in the File Name Table\n"), + adv); + state_machine_regs.file = adv; + break; + + case DW_LNS_set_column: + uladv = read_leb128 (data, & bytes_read, 0); + data += bytes_read; + printf (_(" Set column to %lu\n"), uladv); + state_machine_regs.column = uladv; + break; + + case DW_LNS_negate_stmt: + adv = state_machine_regs.is_stmt; + adv = ! adv; + printf (_(" Set is_stmt to %d\n"), adv); + state_machine_regs.is_stmt = adv; + break; + + case DW_LNS_set_basic_block: + printf (_(" Set basic block\n")); + state_machine_regs.basic_block = 1; + break; + + case DW_LNS_const_add_pc: + uladv = (((255 - info.li_opcode_base) / info.li_line_range) + * info.li_min_insn_length); + state_machine_regs.address += uladv; + printf (_(" Advance PC by constant %lu to 0x%lx\n"), uladv, + state_machine_regs.address); + break; + + case DW_LNS_fixed_advance_pc: + uladv = byte_get (data, 2); + data += 2; + state_machine_regs.address += uladv; + printf (_(" Advance PC by fixed size amount %lu to 0x%lx\n"), + uladv, state_machine_regs.address); + break; + + case DW_LNS_set_prologue_end: + printf (_(" Set prologue_end to true\n")); + break; + + case DW_LNS_set_epilogue_begin: + printf (_(" Set epilogue_begin to true\n")); + break; + + case DW_LNS_set_isa: + uladv = read_leb128 (data, & bytes_read, 0); + data += bytes_read; + printf (_(" Set ISA to %lu\n"), uladv); + break; + + default: + printf (_(" Unknown opcode %d with operands: "), op_code); + + for (i = standard_opcodes[op_code - 1]; i > 0 ; --i) + { + printf ("0x%lx%s", read_leb128 (data, &bytes_read, 0), + i == 1 ? "" : ", "); + data += bytes_read; + } + putchar ('\n'); + break; + } + } + putchar ('\n'); + } + + return 1; +} + +static int +display_debug_pubnames (struct dwarf_section *section, + void *file ATTRIBUTE_UNUSED) +{ + DWARF2_Internal_PubNames pubnames; + unsigned char *start = section->start; + unsigned char *end = start + section->size; + + printf (_("Contents of the %s section:\n\n"), section->name); + + while (start < end) + { + unsigned char *data; + unsigned long offset; + int offset_size, initial_length_size; + + data = start; + + pubnames.pn_length = byte_get (data, 4); + data += 4; + if (pubnames.pn_length == 0xffffffff) + { + pubnames.pn_length = byte_get (data, 8); + data += 8; + offset_size = 8; + initial_length_size = 12; + } + else + { + offset_size = 4; + initial_length_size = 4; + } + + pubnames.pn_version = byte_get (data, 2); + data += 2; + pubnames.pn_offset = byte_get (data, offset_size); + data += offset_size; + pubnames.pn_size = byte_get (data, offset_size); + data += offset_size; + + start += pubnames.pn_length + initial_length_size; + + if (pubnames.pn_version != 2 && pubnames.pn_version != 3) + { + static int warned = 0; + + if (! warned) + { + warn (_("Only DWARF 2 and 3 pubnames are currently supported\n")); + warned = 1; + } + + continue; + } + + printf (_(" Length: %ld\n"), + pubnames.pn_length); + printf (_(" Version: %d\n"), + pubnames.pn_version); + printf (_(" Offset into .debug_info section: %ld\n"), + pubnames.pn_offset); + printf (_(" Size of area in .debug_info section: %ld\n"), + pubnames.pn_size); + + printf (_("\n Offset\tName\n")); + + do + { + offset = byte_get (data, offset_size); + + if (offset != 0) + { + data += offset_size; + printf (" %-6ld\t\t%s\n", offset, data); + data += strlen ((char *) data) + 1; + } + } + while (offset != 0); + } + + printf ("\n"); + return 1; +} + +static int +display_debug_macinfo (struct dwarf_section *section, + void *file ATTRIBUTE_UNUSED) +{ + unsigned char *start = section->start; + unsigned char *end = start + section->size; + unsigned char *curr = start; + unsigned int bytes_read; + enum dwarf_macinfo_record_type op; + + printf (_("Contents of the %s section:\n\n"), section->name); + + while (curr < end) + { + unsigned int lineno; + const char *string; + + op = *curr; + curr++; + + switch (op) + { + case DW_MACINFO_start_file: + { + unsigned int filenum; + + lineno = read_leb128 (curr, & bytes_read, 0); + curr += bytes_read; + filenum = read_leb128 (curr, & bytes_read, 0); + curr += bytes_read; + + printf (_(" DW_MACINFO_start_file - lineno: %d filenum: %d\n"), + lineno, filenum); + } + break; + + case DW_MACINFO_end_file: + printf (_(" DW_MACINFO_end_file\n")); + break; + + case DW_MACINFO_define: + lineno = read_leb128 (curr, & bytes_read, 0); + curr += bytes_read; + string = (char *) curr; + curr += strlen (string) + 1; + printf (_(" DW_MACINFO_define - lineno : %d macro : %s\n"), + lineno, string); + break; + + case DW_MACINFO_undef: + lineno = read_leb128 (curr, & bytes_read, 0); + curr += bytes_read; + string = (char *) curr; + curr += strlen (string) + 1; + printf (_(" DW_MACINFO_undef - lineno : %d macro : %s\n"), + lineno, string); + break; + + case DW_MACINFO_vendor_ext: + { + unsigned int constant; + + constant = read_leb128 (curr, & bytes_read, 0); + curr += bytes_read; + string = (char *) curr; + curr += strlen (string) + 1; + printf (_(" DW_MACINFO_vendor_ext - constant : %d string : %s\n"), + constant, string); + } + break; + } + } + + return 1; +} + +static int +display_debug_abbrev (struct dwarf_section *section, + void *file ATTRIBUTE_UNUSED) +{ + abbrev_entry *entry; + unsigned char *start = section->start; + unsigned char *end = start + section->size; + + printf (_("Contents of the %s section:\n\n"), section->name); + + do + { + free_abbrevs (); + + start = process_abbrev_section (start, end); + + if (first_abbrev == NULL) + continue; + + printf (_(" Number TAG\n")); + + for (entry = first_abbrev; entry; entry = entry->next) + { + abbrev_attr *attr; + + printf (_(" %ld %s [%s]\n"), + entry->entry, + get_TAG_name (entry->tag), + entry->children ? _("has children") : _("no children")); + + for (attr = entry->first_attr; attr; attr = attr->next) + printf (_(" %-18s %s\n"), + get_AT_name (attr->attribute), + get_FORM_name (attr->form)); + } + } + while (start); + + printf ("\n"); + + return 1; +} + +static int +display_debug_loc (struct dwarf_section *section, void *file) +{ + unsigned char *start = section->start; + unsigned char *section_end; + unsigned long bytes; + unsigned char *section_begin = start; + unsigned int num_loc_list = 0; + unsigned long last_offset = 0; + unsigned int first = 0; + unsigned int i; + unsigned int j; + int seen_first_offset = 0; + int use_debug_info = 1; + unsigned char *next; + + bytes = section->size; + section_end = start + bytes; + + if (bytes == 0) + { + printf (_("\nThe %s section is empty.\n"), section->name); + return 0; + } + + load_debug_info (file); + + /* Check the order of location list in .debug_info section. If + offsets of location lists are in the ascending order, we can + use `debug_information' directly. */ + for (i = 0; i < num_debug_info_entries; i++) + { + unsigned int num; + + num = debug_information [i].num_loc_offsets; + num_loc_list += num; + + /* Check if we can use `debug_information' directly. */ + if (use_debug_info && num != 0) + { + if (!seen_first_offset) + { + /* This is the first location list. */ + last_offset = debug_information [i].loc_offsets [0]; + first = i; + seen_first_offset = 1; + j = 1; + } + else + j = 0; + + for (; j < num; j++) + { + if (last_offset > + debug_information [i].loc_offsets [j]) + { + use_debug_info = 0; + break; + } + last_offset = debug_information [i].loc_offsets [j]; + } + } + } + + if (!use_debug_info) + /* FIXME: Should we handle this case? */ + error (_("Location lists in .debug_info section aren't in ascending order!\n")); + + if (!seen_first_offset) + error (_("No location lists in .debug_info section!\n")); + + /* DWARF sections under Mach-O have non-zero addresses. */ + if (debug_information [first].loc_offsets [0] != section->address) + warn (_("Location lists in %s section start at 0x%lx\n"), + section->name, debug_information [first].loc_offsets [0]); + + printf (_("Contents of the %s section:\n\n"), section->name); + printf (_(" Offset Begin End Expression\n")); + + seen_first_offset = 0; + for (i = first; i < num_debug_info_entries; i++) + { + unsigned long begin; + unsigned long end; + unsigned short length; + unsigned long offset; + unsigned int pointer_size; + unsigned long cu_offset; + unsigned long base_address; + int need_frame_base; + int has_frame_base; + + pointer_size = debug_information [i].pointer_size; + cu_offset = debug_information [i].cu_offset; + + for (j = 0; j < debug_information [i].num_loc_offsets; j++) + { + has_frame_base = debug_information [i].have_frame_base [j]; + /* DWARF sections under Mach-O have non-zero addresses. */ + offset = debug_information [i].loc_offsets [j] - section->address; + next = section_begin + offset; + base_address = debug_information [i].base_address; + + if (!seen_first_offset) + seen_first_offset = 1; + else + { + if (start < next) + warn (_("There is a hole [0x%lx - 0x%lx] in .debug_loc section.\n"), + (long)(start - section_begin), (long)(next - section_begin)); + else if (start > next) + warn (_("There is an overlap [0x%lx - 0x%lx] in .debug_loc section.\n"), + (long)(start - section_begin), (long)(next - section_begin)); + } + start = next; + + if (offset >= bytes) + { + warn (_("Offset 0x%lx is bigger than .debug_loc section size.\n"), + offset); + continue; + } + + while (1) + { + if (start + 2 * pointer_size > section_end) + { + warn (_("Location list starting at offset 0x%lx is not terminated.\n"), + offset); + break; + } + + begin = byte_get (start, pointer_size); + start += pointer_size; + end = byte_get (start, pointer_size); + start += pointer_size; + + if (begin == 0 && end == 0) + { + printf (_(" %8.8lx \n"), offset); + break; + } + + /* Check base address specifiers. */ + if (begin == -1UL && end != -1UL) + { + base_address = end; + printf (_(" %8.8lx %8.8lx %8.8lx (base address)\n"), + offset, begin, end); + continue; + } + + if (start + 2 > section_end) + { + warn (_("Location list starting at offset 0x%lx is not terminated.\n"), + offset); + break; + } + + length = byte_get (start, 2); + start += 2; + + if (start + length > section_end) + { + warn (_("Location list starting at offset 0x%lx is not terminated.\n"), + offset); + break; + } + + printf (" %8.8lx %8.8lx %8.8lx (", + offset, begin + base_address, end + base_address); + need_frame_base = decode_location_expression (start, + pointer_size, + length, + cu_offset); + putchar (')'); + + if (need_frame_base && !has_frame_base) + printf (_(" [without DW_AT_frame_base]")); + + if (begin == end) + fputs (_(" (start == end)"), stdout); + else if (begin > end) + fputs (_(" (start > end)"), stdout); + + putchar ('\n'); + + start += length; + } + } + } + return 1; +} + +static int +display_debug_str (struct dwarf_section *section, + void *file ATTRIBUTE_UNUSED) +{ + unsigned char *start = section->start; + unsigned long bytes = section->size; + dwarf_vma addr = section->address; + + if (bytes == 0) + { + printf (_("\nThe %s section is empty.\n"), section->name); + return 0; + } + + printf (_("Contents of the %s section:\n\n"), section->name); + + while (bytes) + { + int j; + int k; + int lbytes; + + lbytes = (bytes > 16 ? 16 : bytes); + + printf (" 0x%8.8lx ", (unsigned long) addr); + + for (j = 0; j < 16; j++) + { + if (j < lbytes) + printf ("%2.2x", start[j]); + else + printf (" "); + + if ((j & 3) == 3) + printf (" "); + } + + for (j = 0; j < lbytes; j++) + { + k = start[j]; + if (k >= ' ' && k < 0x80) + printf ("%c", k); + else + printf ("."); + } + + putchar ('\n'); + + start += lbytes; + addr += lbytes; + bytes -= lbytes; + } + + putchar ('\n'); + + return 1; +} + + +static int +display_debug_info (struct dwarf_section *section, void *file) +{ + return process_debug_info (section, file, 0); +} + + +static int +display_debug_aranges (struct dwarf_section *section, + void *file ATTRIBUTE_UNUSED) +{ + unsigned char *start = section->start; + unsigned char *end = start + section->size; + + printf (_("The section %s contains:\n\n"), section->name); + + while (start < end) + { + unsigned char *hdrptr; + DWARF2_Internal_ARange arange; + unsigned char *ranges; + unsigned long length; + unsigned long address; + int excess; + int offset_size; + int initial_length_size; + + hdrptr = start; + + arange.ar_length = byte_get (hdrptr, 4); + hdrptr += 4; + + if (arange.ar_length == 0xffffffff) + { + arange.ar_length = byte_get (hdrptr, 8); + hdrptr += 8; + offset_size = 8; + initial_length_size = 12; + } + else + { + offset_size = 4; + initial_length_size = 4; + } + + arange.ar_version = byte_get (hdrptr, 2); + hdrptr += 2; + + arange.ar_info_offset = byte_get (hdrptr, offset_size); + hdrptr += offset_size; + + arange.ar_pointer_size = byte_get (hdrptr, 1); + hdrptr += 1; + + arange.ar_segment_size = byte_get (hdrptr, 1); + hdrptr += 1; + + if (arange.ar_version != 2 && arange.ar_version != 3) + { + warn (_("Only DWARF 2 and 3 aranges are currently supported.\n")); + break; + } + + printf (_(" Length: %ld\n"), arange.ar_length); + printf (_(" Version: %d\n"), arange.ar_version); + printf (_(" Offset into .debug_info: %lx\n"), arange.ar_info_offset); + printf (_(" Pointer Size: %d\n"), arange.ar_pointer_size); + printf (_(" Segment Size: %d\n"), arange.ar_segment_size); + + printf (_("\n Address Length\n")); + + ranges = hdrptr; + + /* Must pad to an alignment boundary that is twice the pointer size. */ + excess = (hdrptr - start) % (2 * arange.ar_pointer_size); + if (excess) + ranges += (2 * arange.ar_pointer_size) - excess; + + start += arange.ar_length + initial_length_size; + + while (ranges + 2 * arange.ar_pointer_size <= start) + { + address = byte_get (ranges, arange.ar_pointer_size); + + ranges += arange.ar_pointer_size; + + length = byte_get (ranges, arange.ar_pointer_size); + + ranges += arange.ar_pointer_size; + + printf (" %8.8lx %lu\n", address, length); + } + } + + printf ("\n"); + + return 1; +} + +static int +display_debug_ranges (struct dwarf_section *section, + void *file ATTRIBUTE_UNUSED) +{ + unsigned char *start = section->start; + unsigned char *section_end; + unsigned long bytes; + unsigned char *section_begin = start; + unsigned int num_range_list = 0; + unsigned long last_offset = 0; + unsigned int first = 0; + unsigned int i; + unsigned int j; + int seen_first_offset = 0; + int use_debug_info = 1; + unsigned char *next; + + bytes = section->size; + section_end = start + bytes; + + if (bytes == 0) + { + printf (_("\nThe %s section is empty.\n"), section->name); + return 0; + } + + load_debug_info (file); + + /* Check the order of range list in .debug_info section. If + offsets of range lists are in the ascending order, we can + use `debug_information' directly. */ + for (i = 0; i < num_debug_info_entries; i++) + { + unsigned int num; + + num = debug_information [i].num_range_lists; + num_range_list += num; + + /* Check if we can use `debug_information' directly. */ + if (use_debug_info && num != 0) + { + if (!seen_first_offset) + { + /* This is the first range list. */ + last_offset = debug_information [i].range_lists [0]; + first = i; + seen_first_offset = 1; + j = 1; + } + else + j = 0; + + for (; j < num; j++) + { + if (last_offset > + debug_information [i].range_lists [j]) + { + use_debug_info = 0; + break; + } + last_offset = debug_information [i].range_lists [j]; + } + } + } + + if (!use_debug_info) + /* FIXME: Should we handle this case? */ + error (_("Range lists in .debug_info section aren't in ascending order!\n")); + + if (!seen_first_offset) + error (_("No range lists in .debug_info section!\n")); + + /* DWARF sections under Mach-O have non-zero addresses. */ + if (debug_information [first].range_lists [0] != section->address) + warn (_("Range lists in %s section start at 0x%lx\n"), + section->name, debug_information [first].range_lists [0]); + + printf (_("Contents of the %s section:\n\n"), section->name); + printf (_(" Offset Begin End\n")); + + seen_first_offset = 0; + for (i = first; i < num_debug_info_entries; i++) + { + unsigned long begin; + unsigned long end; + unsigned long offset; + unsigned int pointer_size; + unsigned long base_address; + + pointer_size = debug_information [i].pointer_size; + + for (j = 0; j < debug_information [i].num_range_lists; j++) + { + /* DWARF sections under Mach-O have non-zero addresses. */ + offset = debug_information [i].range_lists [j] - section->address; + next = section_begin + offset; + base_address = debug_information [i].base_address; + + if (!seen_first_offset) + seen_first_offset = 1; + else + { + if (start < next) + warn (_("There is a hole [0x%lx - 0x%lx] in %s section.\n"), + (long)(start - section_begin), + (long)(next - section_begin), section->name); + else if (start > next) + warn (_("There is an overlap [0x%lx - 0x%lx] in %s section.\n"), + (long)(start - section_begin), + (long)(next - section_begin), section->name); + } + start = next; + + while (1) + { + begin = byte_get (start, pointer_size); + start += pointer_size; + end = byte_get (start, pointer_size); + start += pointer_size; + + if (begin == 0 && end == 0) + { + printf (_(" %8.8lx \n"), offset); + break; + } + + /* Check base address specifiers. */ + if (begin == -1UL && end != -1UL) + { + base_address = end; + printf (" %8.8lx %8.8lx %8.8lx (base address)\n", + offset, begin, end); + continue; + } + + printf (" %8.8lx %8.8lx %8.8lx", + offset, begin + base_address, end + base_address); + + if (begin == end) + fputs (_(" (start == end)"), stdout); + else if (begin > end) + fputs (_(" (start > end)"), stdout); + + putchar ('\n'); + } + } + } + putchar ('\n'); + return 1; +} + +typedef struct Frame_Chunk +{ + struct Frame_Chunk *next; + unsigned char *chunk_start; + int ncols; + /* DW_CFA_{undefined,same_value,offset,register,unreferenced} */ + short int *col_type; + int *col_offset; + char *augmentation; + unsigned int code_factor; + int data_factor; + unsigned long pc_begin; + unsigned long pc_range; + int cfa_reg; + int cfa_offset; + int ra; + unsigned char fde_encoding; + unsigned char cfa_exp; +} +Frame_Chunk; + +/* A marker for a col_type that means this column was never referenced + in the frame info. */ +#define DW_CFA_unreferenced (-1) + +static void +frame_need_space (Frame_Chunk *fc, int reg) +{ + int prev = fc->ncols; + + if (reg < fc->ncols) + return; + + fc->ncols = reg + 1; + fc->col_type = xcrealloc (fc->col_type, fc->ncols, sizeof (short int)); + fc->col_offset = xcrealloc (fc->col_offset, fc->ncols, sizeof (int)); + + while (prev < fc->ncols) + { + fc->col_type[prev] = DW_CFA_unreferenced; + fc->col_offset[prev] = 0; + prev++; + } +} + +static void +frame_display_row (Frame_Chunk *fc, int *need_col_headers, int *max_regs) +{ + int r; + char tmp[100]; + + if (*max_regs < fc->ncols) + *max_regs = fc->ncols; + + if (*need_col_headers) + { + *need_col_headers = 0; + + printf (" LOC CFA "); + + for (r = 0; r < *max_regs; r++) + if (fc->col_type[r] != DW_CFA_unreferenced) + { + if (r == fc->ra) + printf ("ra "); + else + printf ("r%-4d", r); + } + + printf ("\n"); + } + + printf ("%08lx ", fc->pc_begin); + if (fc->cfa_exp) + strcpy (tmp, "exp"); + else + sprintf (tmp, "r%d%+d", fc->cfa_reg, fc->cfa_offset); + printf ("%-8s ", tmp); + + for (r = 0; r < fc->ncols; r++) + { + if (fc->col_type[r] != DW_CFA_unreferenced) + { + switch (fc->col_type[r]) + { + case DW_CFA_undefined: + strcpy (tmp, "u"); + break; + case DW_CFA_same_value: + strcpy (tmp, "s"); + break; + case DW_CFA_offset: + sprintf (tmp, "c%+d", fc->col_offset[r]); + break; + case DW_CFA_val_offset: + sprintf (tmp, "v%+d", fc->col_offset[r]); + break; + case DW_CFA_register: + sprintf (tmp, "r%d", fc->col_offset[r]); + break; + case DW_CFA_expression: + strcpy (tmp, "exp"); + break; + case DW_CFA_val_expression: + strcpy (tmp, "vexp"); + break; + default: + strcpy (tmp, "n/a"); + break; + } + printf ("%-5s", tmp); + } + } + printf ("\n"); +} + +static int +size_of_encoded_value (int encoding) +{ + switch (encoding & 0x7) + { + default: /* ??? */ + case 0: return eh_addr_size; + case 2: return 2; + case 3: return 4; + case 4: return 8; + } +} + +static dwarf_vma +get_encoded_value (unsigned char *data, int encoding) +{ + int size = size_of_encoded_value (encoding); + if (encoding & DW_EH_PE_signed) + return byte_get_signed (data, size); + else + return byte_get (data, size); +} + +#define GET(N) byte_get (start, N); start += N +#define LEB() read_leb128 (start, & length_return, 0); start += length_return +#define SLEB() read_leb128 (start, & length_return, 1); start += length_return + +static int +display_debug_frames (struct dwarf_section *section, + void *file ATTRIBUTE_UNUSED) +{ + unsigned char *start = section->start; + unsigned char *end = start + section->size; + unsigned char *section_start = start; + Frame_Chunk *chunks = 0; + Frame_Chunk *remembered_state = 0; + Frame_Chunk *rs; + int is_eh = strcmp (section->name, ".eh_frame") == 0; + unsigned int length_return; + int max_regs = 0; + + printf (_("The section %s contains:\n"), section->name); + + while (start < end) + { + unsigned char *saved_start; + unsigned char *block_end; + unsigned long length; + unsigned long cie_id; + Frame_Chunk *fc; + Frame_Chunk *cie; + int need_col_headers = 1; + unsigned char *augmentation_data = NULL; + unsigned long augmentation_data_len = 0; + int encoded_ptr_size = eh_addr_size; + int offset_size; + int initial_length_size; + + saved_start = start; + length = byte_get (start, 4); start += 4; + + if (length == 0) + { + printf ("\n%08lx ZERO terminator\n\n", + (unsigned long)(saved_start - section_start)); + return 1; + } + + if (length == 0xffffffff) + { + length = byte_get (start, 8); + start += 8; + offset_size = 8; + initial_length_size = 12; + } + else + { + offset_size = 4; + initial_length_size = 4; + } + + block_end = saved_start + length + initial_length_size; + cie_id = byte_get (start, offset_size); start += offset_size; + + if (is_eh ? (cie_id == 0) : (cie_id == DW_CIE_ID)) + { + int version; + + fc = xmalloc (sizeof (Frame_Chunk)); + memset (fc, 0, sizeof (Frame_Chunk)); + + fc->next = chunks; + chunks = fc; + fc->chunk_start = saved_start; + fc->ncols = 0; + fc->col_type = xmalloc (sizeof (short int)); + fc->col_offset = xmalloc (sizeof (int)); + frame_need_space (fc, max_regs-1); + + version = *start++; + + fc->augmentation = (char *) start; + start = (unsigned char *) strchr ((char *) start, '\0') + 1; + + if (fc->augmentation[0] == 'z') + { + fc->code_factor = LEB (); + fc->data_factor = SLEB (); + if (version == 1) + { + fc->ra = GET (1); + } + else + { + fc->ra = LEB (); + } + augmentation_data_len = LEB (); + augmentation_data = start; + start += augmentation_data_len; + } + else if (strcmp (fc->augmentation, "eh") == 0) + { + start += eh_addr_size; + fc->code_factor = LEB (); + fc->data_factor = SLEB (); + if (version == 1) + { + fc->ra = GET (1); + } + else + { + fc->ra = LEB (); + } + } + else + { + fc->code_factor = LEB (); + fc->data_factor = SLEB (); + if (version == 1) + { + fc->ra = GET (1); + } + else + { + fc->ra = LEB (); + } + } + cie = fc; + + if (do_debug_frames_interp) + printf ("\n%08lx %08lx %08lx CIE \"%s\" cf=%d df=%d ra=%d\n", + (unsigned long)(saved_start - section_start), length, cie_id, + fc->augmentation, fc->code_factor, fc->data_factor, + fc->ra); + else + { + printf ("\n%08lx %08lx %08lx CIE\n", + (unsigned long)(saved_start - section_start), length, cie_id); + printf (" Version: %d\n", version); + printf (" Augmentation: \"%s\"\n", fc->augmentation); + printf (" Code alignment factor: %u\n", fc->code_factor); + printf (" Data alignment factor: %d\n", fc->data_factor); + printf (" Return address column: %d\n", fc->ra); + + if (augmentation_data_len) + { + unsigned long i; + printf (" Augmentation data: "); + for (i = 0; i < augmentation_data_len; ++i) + printf (" %02x", augmentation_data[i]); + putchar ('\n'); + } + putchar ('\n'); + } + + if (augmentation_data_len) + { + unsigned char *p, *q; + p = (unsigned char *) fc->augmentation + 1; + q = augmentation_data; + + while (1) + { + if (*p == 'L') + q++; + else if (*p == 'P') + q += 1 + size_of_encoded_value (*q); + else if (*p == 'R') + fc->fde_encoding = *q++; + else + break; + p++; + } + + if (fc->fde_encoding) + encoded_ptr_size = size_of_encoded_value (fc->fde_encoding); + } + + frame_need_space (fc, fc->ra); + } + else + { + unsigned char *look_for; + static Frame_Chunk fde_fc; + + fc = & fde_fc; + memset (fc, 0, sizeof (Frame_Chunk)); + + look_for = is_eh ? start - 4 - cie_id : section_start + cie_id; + + for (cie = chunks; cie ; cie = cie->next) + if (cie->chunk_start == look_for) + break; + + if (!cie) + { + warn ("Invalid CIE pointer %08lx in FDE at %08lx\n", + cie_id, (unsigned long)(saved_start - section_start)); + start = block_end; + fc->ncols = 0; + fc->col_type = xmalloc (sizeof (short int)); + fc->col_offset = xmalloc (sizeof (int)); + frame_need_space (fc, max_regs - 1); + cie = fc; + fc->augmentation = ""; + fc->fde_encoding = 0; + } + else + { + fc->ncols = cie->ncols; + fc->col_type = xcmalloc (fc->ncols, sizeof (short int)); + fc->col_offset = xcmalloc (fc->ncols, sizeof (int)); + memcpy (fc->col_type, cie->col_type, fc->ncols * sizeof (short int)); + memcpy (fc->col_offset, cie->col_offset, fc->ncols * sizeof (int)); + fc->augmentation = cie->augmentation; + fc->code_factor = cie->code_factor; + fc->data_factor = cie->data_factor; + fc->cfa_reg = cie->cfa_reg; + fc->cfa_offset = cie->cfa_offset; + fc->ra = cie->ra; + frame_need_space (fc, max_regs-1); + fc->fde_encoding = cie->fde_encoding; + } + + if (fc->fde_encoding) + encoded_ptr_size = size_of_encoded_value (fc->fde_encoding); + + fc->pc_begin = get_encoded_value (start, fc->fde_encoding); + if ((fc->fde_encoding & 0x70) == DW_EH_PE_pcrel + /* Don't adjust for relocatable file since there's + invariably a pcrel reloc here, which we haven't + applied. */ + && !is_relocatable) + fc->pc_begin += section->address + (start - section_start); + start += encoded_ptr_size; + fc->pc_range = byte_get (start, encoded_ptr_size); + start += encoded_ptr_size; + + if (cie->augmentation[0] == 'z') + { + augmentation_data_len = LEB (); + augmentation_data = start; + start += augmentation_data_len; + } + + printf ("\n%08lx %08lx %08lx FDE cie=%08lx pc=%08lx..%08lx\n", + (unsigned long)(saved_start - section_start), length, cie_id, + (unsigned long)(cie->chunk_start - section_start), + fc->pc_begin, fc->pc_begin + fc->pc_range); + if (! do_debug_frames_interp && augmentation_data_len) + { + unsigned long i; + + printf (" Augmentation data: "); + for (i = 0; i < augmentation_data_len; ++i) + printf (" %02x", augmentation_data[i]); + putchar ('\n'); + putchar ('\n'); + } + } + + /* At this point, fc is the current chunk, cie (if any) is set, and + we're about to interpret instructions for the chunk. */ + /* ??? At present we need to do this always, since this sizes the + fc->col_type and fc->col_offset arrays, which we write into always. + We should probably split the interpreted and non-interpreted bits + into two different routines, since there's so much that doesn't + really overlap between them. */ + if (1 || do_debug_frames_interp) + { + /* Start by making a pass over the chunk, allocating storage + and taking note of what registers are used. */ + unsigned char *tmp = start; + + while (start < block_end) + { + unsigned op, opa; + unsigned long reg, tmp; + + op = *start++; + opa = op & 0x3f; + if (op & 0xc0) + op &= 0xc0; + + /* Warning: if you add any more cases to this switch, be + sure to add them to the corresponding switch below. */ + switch (op) + { + case DW_CFA_advance_loc: + break; + case DW_CFA_offset: + LEB (); + frame_need_space (fc, opa); + fc->col_type[opa] = DW_CFA_undefined; + break; + case DW_CFA_restore: + frame_need_space (fc, opa); + fc->col_type[opa] = DW_CFA_undefined; + break; + case DW_CFA_set_loc: + start += encoded_ptr_size; + break; + case DW_CFA_advance_loc1: + start += 1; + break; + case DW_CFA_advance_loc2: + start += 2; + break; + case DW_CFA_advance_loc4: + start += 4; + break; + case DW_CFA_offset_extended: + case DW_CFA_val_offset: + reg = LEB (); LEB (); + frame_need_space (fc, reg); + fc->col_type[reg] = DW_CFA_undefined; + break; + case DW_CFA_restore_extended: + reg = LEB (); + frame_need_space (fc, reg); + fc->col_type[reg] = DW_CFA_undefined; + break; + case DW_CFA_undefined: + reg = LEB (); + frame_need_space (fc, reg); + fc->col_type[reg] = DW_CFA_undefined; + break; + case DW_CFA_same_value: + reg = LEB (); + frame_need_space (fc, reg); + fc->col_type[reg] = DW_CFA_undefined; + break; + case DW_CFA_register: + reg = LEB (); LEB (); + frame_need_space (fc, reg); + fc->col_type[reg] = DW_CFA_undefined; + break; + case DW_CFA_def_cfa: + LEB (); LEB (); + break; + case DW_CFA_def_cfa_register: + LEB (); + break; + case DW_CFA_def_cfa_offset: + LEB (); + break; + case DW_CFA_def_cfa_expression: + tmp = LEB (); + start += tmp; + break; + case DW_CFA_expression: + case DW_CFA_val_expression: + reg = LEB (); + tmp = LEB (); + start += tmp; + frame_need_space (fc, reg); + fc->col_type[reg] = DW_CFA_undefined; + break; + case DW_CFA_offset_extended_sf: + case DW_CFA_val_offset_sf: + reg = LEB (); SLEB (); + frame_need_space (fc, reg); + fc->col_type[reg] = DW_CFA_undefined; + break; + case DW_CFA_def_cfa_sf: + LEB (); SLEB (); + break; + case DW_CFA_def_cfa_offset_sf: + SLEB (); + break; + case DW_CFA_MIPS_advance_loc8: + start += 8; + break; + case DW_CFA_GNU_args_size: + LEB (); + break; + case DW_CFA_GNU_negative_offset_extended: + reg = LEB (); LEB (); + frame_need_space (fc, reg); + fc->col_type[reg] = DW_CFA_undefined; + + default: + break; + } + } + start = tmp; + } + + /* Now we know what registers are used, make a second pass over + the chunk, this time actually printing out the info. */ + + while (start < block_end) + { + unsigned op, opa; + unsigned long ul, reg, roffs; + long l, ofs; + dwarf_vma vma; + + op = *start++; + opa = op & 0x3f; + if (op & 0xc0) + op &= 0xc0; + + /* Warning: if you add any more cases to this switch, be + sure to add them to the corresponding switch above. */ + switch (op) + { + case DW_CFA_advance_loc: + if (do_debug_frames_interp) + frame_display_row (fc, &need_col_headers, &max_regs); + else + printf (" DW_CFA_advance_loc: %d to %08lx\n", + opa * fc->code_factor, + fc->pc_begin + opa * fc->code_factor); + fc->pc_begin += opa * fc->code_factor; + break; + + case DW_CFA_offset: + roffs = LEB (); + if (! do_debug_frames_interp) + printf (" DW_CFA_offset: r%d at cfa%+ld\n", + opa, roffs * fc->data_factor); + fc->col_type[opa] = DW_CFA_offset; + fc->col_offset[opa] = roffs * fc->data_factor; + break; + + case DW_CFA_restore: + if (! do_debug_frames_interp) + printf (" DW_CFA_restore: r%d\n", opa); + fc->col_type[opa] = cie->col_type[opa]; + fc->col_offset[opa] = cie->col_offset[opa]; + break; + + case DW_CFA_set_loc: + vma = get_encoded_value (start, fc->fde_encoding); + if ((fc->fde_encoding & 0x70) == DW_EH_PE_pcrel + && !is_relocatable) + vma += section->address + (start - section_start); + start += encoded_ptr_size; + if (do_debug_frames_interp) + frame_display_row (fc, &need_col_headers, &max_regs); + else + printf (" DW_CFA_set_loc: %08lx\n", (unsigned long)vma); + fc->pc_begin = vma; + break; + + case DW_CFA_advance_loc1: + ofs = byte_get (start, 1); start += 1; + if (do_debug_frames_interp) + frame_display_row (fc, &need_col_headers, &max_regs); + else + printf (" DW_CFA_advance_loc1: %ld to %08lx\n", + ofs * fc->code_factor, + fc->pc_begin + ofs * fc->code_factor); + fc->pc_begin += ofs * fc->code_factor; + break; + + case DW_CFA_advance_loc2: + ofs = byte_get (start, 2); start += 2; + if (do_debug_frames_interp) + frame_display_row (fc, &need_col_headers, &max_regs); + else + printf (" DW_CFA_advance_loc2: %ld to %08lx\n", + ofs * fc->code_factor, + fc->pc_begin + ofs * fc->code_factor); + fc->pc_begin += ofs * fc->code_factor; + break; + + case DW_CFA_advance_loc4: + ofs = byte_get (start, 4); start += 4; + if (do_debug_frames_interp) + frame_display_row (fc, &need_col_headers, &max_regs); + else + printf (" DW_CFA_advance_loc4: %ld to %08lx\n", + ofs * fc->code_factor, + fc->pc_begin + ofs * fc->code_factor); + fc->pc_begin += ofs * fc->code_factor; + break; + + case DW_CFA_offset_extended: + reg = LEB (); + roffs = LEB (); + if (! do_debug_frames_interp) + printf (" DW_CFA_offset_extended: r%ld at cfa%+ld\n", + reg, roffs * fc->data_factor); + fc->col_type[reg] = DW_CFA_offset; + fc->col_offset[reg] = roffs * fc->data_factor; + break; + + case DW_CFA_val_offset: + reg = LEB (); + roffs = LEB (); + if (! do_debug_frames_interp) + printf (" DW_CFA_val_offset: r%ld at cfa%+ld\n", + reg, roffs * fc->data_factor); + fc->col_type[reg] = DW_CFA_val_offset; + fc->col_offset[reg] = roffs * fc->data_factor; + break; + + case DW_CFA_restore_extended: + reg = LEB (); + if (! do_debug_frames_interp) + printf (" DW_CFA_restore_extended: r%ld\n", reg); + fc->col_type[reg] = cie->col_type[reg]; + fc->col_offset[reg] = cie->col_offset[reg]; + break; + + case DW_CFA_undefined: + reg = LEB (); + if (! do_debug_frames_interp) + printf (" DW_CFA_undefined: r%ld\n", reg); + fc->col_type[reg] = DW_CFA_undefined; + fc->col_offset[reg] = 0; + break; + + case DW_CFA_same_value: + reg = LEB (); + if (! do_debug_frames_interp) + printf (" DW_CFA_same_value: r%ld\n", reg); + fc->col_type[reg] = DW_CFA_same_value; + fc->col_offset[reg] = 0; + break; + + case DW_CFA_register: + reg = LEB (); + roffs = LEB (); + if (! do_debug_frames_interp) + printf (" DW_CFA_register: r%ld in r%ld\n", reg, roffs); + fc->col_type[reg] = DW_CFA_register; + fc->col_offset[reg] = roffs; + break; + + case DW_CFA_remember_state: + if (! do_debug_frames_interp) + printf (" DW_CFA_remember_state\n"); + rs = xmalloc (sizeof (Frame_Chunk)); + rs->ncols = fc->ncols; + rs->col_type = xcmalloc (rs->ncols, sizeof (short int)); + rs->col_offset = xcmalloc (rs->ncols, sizeof (int)); + memcpy (rs->col_type, fc->col_type, rs->ncols); + memcpy (rs->col_offset, fc->col_offset, rs->ncols * sizeof (int)); + rs->next = remembered_state; + remembered_state = rs; + break; + + case DW_CFA_restore_state: + if (! do_debug_frames_interp) + printf (" DW_CFA_restore_state\n"); + rs = remembered_state; + if (rs) + { + remembered_state = rs->next; + frame_need_space (fc, rs->ncols-1); + memcpy (fc->col_type, rs->col_type, rs->ncols); + memcpy (fc->col_offset, rs->col_offset, + rs->ncols * sizeof (int)); + free (rs->col_type); + free (rs->col_offset); + free (rs); + } + else if (do_debug_frames_interp) + printf ("Mismatched DW_CFA_restore_state\n"); + break; + + case DW_CFA_def_cfa: + fc->cfa_reg = LEB (); + fc->cfa_offset = LEB (); + fc->cfa_exp = 0; + if (! do_debug_frames_interp) + printf (" DW_CFA_def_cfa: r%d ofs %d\n", + fc->cfa_reg, fc->cfa_offset); + break; + + case DW_CFA_def_cfa_register: + fc->cfa_reg = LEB (); + fc->cfa_exp = 0; + if (! do_debug_frames_interp) + printf (" DW_CFA_def_cfa_reg: r%d\n", fc->cfa_reg); + break; + + case DW_CFA_def_cfa_offset: + fc->cfa_offset = LEB (); + if (! do_debug_frames_interp) + printf (" DW_CFA_def_cfa_offset: %d\n", fc->cfa_offset); + break; + + case DW_CFA_nop: + if (! do_debug_frames_interp) + printf (" DW_CFA_nop\n"); + break; + + case DW_CFA_def_cfa_expression: + ul = LEB (); + if (! do_debug_frames_interp) + { + printf (" DW_CFA_def_cfa_expression ("); + decode_location_expression (start, eh_addr_size, ul, 0); + printf (")\n"); + } + fc->cfa_exp = 1; + start += ul; + break; + + case DW_CFA_expression: + reg = LEB (); + ul = LEB (); + if (! do_debug_frames_interp) + { + printf (" DW_CFA_expression: r%ld (", reg); + decode_location_expression (start, eh_addr_size, ul, 0); + printf (")\n"); + } + fc->col_type[reg] = DW_CFA_expression; + start += ul; + break; + + case DW_CFA_val_expression: + reg = LEB (); + ul = LEB (); + if (! do_debug_frames_interp) + { + printf (" DW_CFA_val_expression: r%ld (", reg); + decode_location_expression (start, eh_addr_size, ul, 0); + printf (")\n"); + } + fc->col_type[reg] = DW_CFA_val_expression; + start += ul; + break; + + case DW_CFA_offset_extended_sf: + reg = LEB (); + l = SLEB (); + frame_need_space (fc, reg); + if (! do_debug_frames_interp) + printf (" DW_CFA_offset_extended_sf: r%ld at cfa%+ld\n", + reg, l * fc->data_factor); + fc->col_type[reg] = DW_CFA_offset; + fc->col_offset[reg] = l * fc->data_factor; + break; + + case DW_CFA_val_offset_sf: + reg = LEB (); + l = SLEB (); + frame_need_space (fc, reg); + if (! do_debug_frames_interp) + printf (" DW_CFA_val_offset_sf: r%ld at cfa%+ld\n", + reg, l * fc->data_factor); + fc->col_type[reg] = DW_CFA_val_offset; + fc->col_offset[reg] = l * fc->data_factor; + break; + + case DW_CFA_def_cfa_sf: + fc->cfa_reg = LEB (); + fc->cfa_offset = SLEB (); + fc->cfa_offset = fc->cfa_offset * fc->data_factor; + fc->cfa_exp = 0; + if (! do_debug_frames_interp) + printf (" DW_CFA_def_cfa_sf: r%d ofs %d\n", + fc->cfa_reg, fc->cfa_offset); + break; + + case DW_CFA_def_cfa_offset_sf: + fc->cfa_offset = SLEB (); + fc->cfa_offset = fc->cfa_offset * fc->data_factor; + if (! do_debug_frames_interp) + printf (" DW_CFA_def_cfa_offset_sf: %d\n", fc->cfa_offset); + break; + + case DW_CFA_MIPS_advance_loc8: + ofs = byte_get (start, 8); start += 8; + if (do_debug_frames_interp) + frame_display_row (fc, &need_col_headers, &max_regs); + else + printf (" DW_CFA_MIPS_advance_loc8: %ld to %08lx\n", + ofs * fc->code_factor, + fc->pc_begin + ofs * fc->code_factor); + fc->pc_begin += ofs * fc->code_factor; + break; + + case DW_CFA_GNU_window_save: + if (! do_debug_frames_interp) + printf (" DW_CFA_GNU_window_save\n"); + break; + + case DW_CFA_GNU_args_size: + ul = LEB (); + if (! do_debug_frames_interp) + printf (" DW_CFA_GNU_args_size: %ld\n", ul); + break; + + case DW_CFA_GNU_negative_offset_extended: + reg = LEB (); + l = - LEB (); + frame_need_space (fc, reg); + if (! do_debug_frames_interp) + printf (" DW_CFA_GNU_negative_offset_extended: r%ld at cfa%+ld\n", + reg, l * fc->data_factor); + fc->col_type[reg] = DW_CFA_offset; + fc->col_offset[reg] = l * fc->data_factor; + break; + + default: + warn (_("unsupported or unknown DW_CFA_%d\n"), op); + start = block_end; + } + } + + if (do_debug_frames_interp) + frame_display_row (fc, &need_col_headers, &max_regs); + + start = block_end; + } + + printf ("\n"); + + return 1; +} + +#undef GET +#undef LEB +#undef SLEB + +static int +display_debug_not_supported (struct dwarf_section *section, + void *file ATTRIBUTE_UNUSED) +{ + printf (_("Displaying the debug contents of section %s is not yet supported.\n"), + section->name); + + return 1; +} + +void * +cmalloc (size_t nmemb, size_t size) +{ + /* Check for overflow. */ + if (nmemb >= ~(size_t) 0 / size) + return NULL; + else + return malloc (nmemb * size); +} + +void * +xcmalloc (size_t nmemb, size_t size) +{ + /* Check for overflow. */ + if (nmemb >= ~(size_t) 0 / size) + return NULL; + else + return xmalloc (nmemb * size); +} + +void * +xcrealloc (void *ptr, size_t nmemb, size_t size) +{ + /* Check for overflow. */ + if (nmemb >= ~(size_t) 0 / size) + return NULL; + else + return xrealloc (ptr, nmemb * size); +} + +void +error (const char *message, ...) +{ + va_list args; + + va_start (args, message); + fprintf (stderr, _("%s: Error: "), program_name); + vfprintf (stderr, message, args); + va_end (args); +} + +void +warn (const char *message, ...) +{ + va_list args; + + va_start (args, message); + fprintf (stderr, _("%s: Warning: "), program_name); + vfprintf (stderr, message, args); + va_end (args); +} + +void +free_debug_memory (void) +{ + enum dwarf_section_display_enum i; + + free_abbrevs (); + + for (i = 0; i < max; i++) + free_debug_section (i); + + if (debug_information) + { + for (i = 0; i < num_debug_info_entries; i++) + { + if (!debug_information [i].max_loc_offsets) + { + free (debug_information [i].loc_offsets); + free (debug_information [i].have_frame_base); + } + if (!debug_information [i].max_range_lists) + free (debug_information [i].range_lists); + } + free (debug_information); + debug_information = NULL; + num_debug_info_entries = 0; + } + +} + +struct dwarf_section_display debug_displays[] = +{ + { { ".debug_abbrev", NULL, 0, 0 }, + display_debug_abbrev, 0, 0 }, + { { ".debug_aranges", NULL, 0, 0 }, + display_debug_aranges, 0, 0 }, + { { ".debug_frame", NULL, 0, 0 }, + display_debug_frames, 1, 0 }, + { { ".debug_info", NULL, 0, 0 }, + display_debug_info, 1, 0 }, + { { ".debug_line", NULL, 0, 0 }, + display_debug_lines, 0, 0 }, + { { ".debug_pubnames", NULL, 0, 0 }, + display_debug_pubnames, 0, 0 }, + { { ".eh_frame", NULL, 0, 0 }, + display_debug_frames, 1, 1 }, + { { ".debug_macinfo", NULL, 0, 0 }, + display_debug_macinfo, 0, 0 }, + { { ".debug_str", NULL, 0, 0 }, + display_debug_str, 0, 0 }, + { { ".debug_loc", NULL, 0, 0 }, + display_debug_loc, 0, 0 }, + { { ".debug_pubtypes", NULL, 0, 0 }, + display_debug_pubnames, 0, 0 }, + { { ".debug_ranges", NULL, 0, 0 }, + display_debug_ranges, 0, 0 }, + { { ".debug_static_func", NULL, 0, 0 }, + display_debug_not_supported, 0, 0 }, + { { ".debug_static_vars", NULL, 0, 0 }, + display_debug_not_supported, 0, 0 }, + { { ".debug_types", NULL, 0, 0 }, + display_debug_not_supported, 0, 0 }, + { { ".debug_weaknames", NULL, 0, 0 }, + display_debug_not_supported, 0, 0 } +}; diff --git a/contrib/binutils/binutils/dwarf.h b/contrib/binutils/binutils/dwarf.h new file mode 100644 index 00000000000..907ac93ef71 --- /dev/null +++ b/contrib/binutils/binutils/dwarf.h @@ -0,0 +1,122 @@ +/* dwwrf.h - DWARF support header file + Copyright 2005 + Free Software Foundation, Inc. + +This file is part of GNU Binutils. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include "bfd.h" +#include "elf/dwarf2.h" + +#if __STDC_VERSION__ >= 199901L || (defined(__GNUC__) && __GNUC__ >= 2) +/* We can't use any bfd types here since readelf may define BFD64 and + objdump may not. */ +typedef unsigned long long dwarf_vma; +typedef unsigned long long dwarf_size_type; +#else +typedef unsigned long dwarf_vma; +typedef unsigned long dwarf_size_type; +#endif + +struct dwarf_section +{ + const char *name; + unsigned char *start; + dwarf_vma address; + dwarf_size_type size; +}; + +/* A structure containing the name of a debug section + and a pointer to a function that can decode it. */ +struct dwarf_section_display +{ + struct dwarf_section section; + int (*display) (struct dwarf_section *, void *); + unsigned int relocate : 1; + unsigned int eh_frame : 1; +}; + +enum dwarf_section_display_enum { + abbrev = 0, + aranges, + frame, + info, + line, + pubnames, + eh_frame, + macinfo, + str, + loc, + pubtypes, + ranges, + static_func, + static_vars, + types, + weaknames, + max +}; + +extern struct dwarf_section_display debug_displays []; + +/* This structure records the information that + we extract from the.debug_info section. */ +typedef struct +{ + unsigned int pointer_size; + unsigned long cu_offset; + unsigned long base_address; + /* This is an array of offsets to the location list table. */ + unsigned long *loc_offsets; + int *have_frame_base; + unsigned int num_loc_offsets; + unsigned int max_loc_offsets; + unsigned long *range_lists; + unsigned int num_range_lists; + unsigned int max_range_lists; +} +debug_info; + +extern dwarf_vma (*byte_get) (unsigned char *, int); +extern dwarf_vma byte_get_little_endian (unsigned char *, int); +extern dwarf_vma byte_get_big_endian (unsigned char *, int); + +extern dwarf_vma eh_addr_size; +extern int is_relocatable; + +extern int do_debug_info; +extern int do_debug_abbrevs; +extern int do_debug_lines; +extern int do_debug_pubnames; +extern int do_debug_aranges; +extern int do_debug_ranges; +extern int do_debug_frames; +extern int do_debug_frames_interp; +extern int do_debug_macinfo; +extern int do_debug_str; +extern int do_debug_loc; + +extern int load_debug_section (enum dwarf_section_display_enum, + void *); +extern void free_debug_section (enum dwarf_section_display_enum); + +extern void free_debug_memory (void); + +void *cmalloc (size_t, size_t); +void *xcmalloc (size_t, size_t); +void *xcrealloc (void *, size_t, size_t); + +void error (const char *, ...) ATTRIBUTE_PRINTF_1; +void warn (const char *, ...) ATTRIBUTE_PRINTF_1; diff --git a/contrib/binutils/binutils/emul_vanilla.c b/contrib/binutils/binutils/emul_vanilla.c index d6cfebda98d..2f34f9d5c2f 100644 --- a/contrib/binutils/binutils/emul_vanilla.c +++ b/contrib/binutils/binutils/emul_vanilla.c @@ -1,6 +1,6 @@ /* Binutils emulation layer. Copyright (C) 2002 Free Software Foundation, Inc. - Written by Tom Rix, Redhat. + Written by Tom Rix, Red Hat Inc. This file is part of GNU Binutils. @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "binemul.h" @@ -25,6 +25,5 @@ struct bin_emulation_xfer_struct bin_vanilla_emulation = ar_emul_default_usage, ar_emul_default_append, ar_emul_default_replace, - ar_emul_default_create, ar_emul_default_parse_arg, }; diff --git a/contrib/binutils/binutils/filemode.c b/contrib/binutils/binutils/filemode.c index 8b438a9a50d..78578c88241 100644 --- a/contrib/binutils/binutils/filemode.c +++ b/contrib/binutils/binutils/filemode.c @@ -1,5 +1,5 @@ /* filemode.c -- make a string describing file modes - Copyright 1985, 1990, 1991, 1994, 1995, 1997, 2003 + Copyright 1985, 1990, 1991, 1994, 1995, 1997, 1999, 2002, 2003, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -14,8 +14,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #include "bfd.h" #include "bucomm.h" @@ -59,18 +59,6 @@ static void setst (unsigned long, char *); otherwise. 'T' if the file is sticky but not executable. */ -#if 0 - -/* This is not used; only mode_string is used. */ - -void -filemodestring (struct stat *statp, char *str) -{ - mode_string ((unsigned long) statp->st_mode, str); -} - -#endif - /* Get definitions for the file permission bits. */ #ifndef S_IRWXU diff --git a/contrib/binutils/binutils/ieee.c b/contrib/binutils/binutils/ieee.c index 1ced603680d..98ec30de9ef 100644 --- a/contrib/binutils/binutils/ieee.c +++ b/contrib/binutils/binutils/ieee.c @@ -1,5 +1,6 @@ /* ieee.c -- Read and write IEEE-695 debugging information. - Copyright 1996, 1998, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2006 + Free Software Foundation, Inc. Written by Ian Lance Taylor . This file is part of GNU Binutils. @@ -16,8 +17,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ /* This file reads and writes IEEE-695 debugging information. */ @@ -4593,8 +4594,10 @@ write_ieee_debugging_info (bfd *abfd, void *dhandle) info.type_indx = 256; info.name_indx = 32; - if (! bfd_hash_table_init (&info.typedefs.root, ieee_name_type_newfunc) - || ! bfd_hash_table_init (&info.tags.root, ieee_name_type_newfunc)) + if (!bfd_hash_table_init (&info.typedefs.root, ieee_name_type_newfunc, + sizeof (struct ieee_name_type_hash_entry)) + || !bfd_hash_table_init (&info.tags.root, ieee_name_type_newfunc, + sizeof (struct ieee_name_type_hash_entry))) return FALSE; if (! ieee_init_buffer (&info, &info.global_types) diff --git a/contrib/binutils/binutils/nm.c b/contrib/binutils/binutils/nm.c index bac7d388ce2..c1fb4d803e8 100644 --- a/contrib/binutils/binutils/nm.c +++ b/contrib/binutils/binutils/nm.c @@ -1,6 +1,6 @@ /* nm.c -- Describe symbol table of a rel file. Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003 + 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #include "bfd.h" #include "progress.h" @@ -68,31 +68,6 @@ struct extended_symbol_info #define SYM_SIZE(sym) \ (sym->elfinfo ? sym->elfinfo->internal_elf_sym.st_size: sym->ssize) -static void usage (FILE *, int); -static void set_print_radix (char *); -static void set_output_format (char *); -static void display_archive (bfd *); -static bfd_boolean display_file (char *); -static void display_rel_file (bfd *, bfd *); -static long filter_symbols (bfd *, bfd_boolean, void *, long, unsigned int); -static long sort_symbols_by_size - (bfd *, bfd_boolean, void *, long, unsigned int, struct size_sym **); -static void print_symbols - (bfd *, bfd_boolean, void *, long, unsigned int, bfd *); -static void print_size_symbols - (bfd *, bfd_boolean, struct size_sym *, long, bfd *); -static void print_symname (const char *, const char *, bfd *); -static void print_symbol (bfd *, asymbol *, bfd_vma ssize, bfd *); -static void print_symdef_entry (bfd *); - -/* The sorting functions. */ -static int numeric_forward (const void *, const void *); -static int numeric_reverse (const void *, const void *); -static int non_numeric_forward (const void *, const void *); -static int non_numeric_reverse (const void *, const void *); -static int size_forward1 (const void *, const void *); -static int size_forward2 (const void *, const void *); - /* The output formatting functions. */ static void print_object_filename_bsd (char *); static void print_object_filename_sysv (char *); @@ -110,8 +85,6 @@ static void print_value (bfd *, bfd_vma); static void print_symbol_info_bsd (struct extended_symbol_info *, bfd *); static void print_symbol_info_sysv (struct extended_symbol_info *, bfd *); static void print_symbol_info_posix (struct extended_symbol_info *, bfd *); -static void get_relocs (bfd *, asection *, void *); -static const char * get_symbol_type (unsigned int); /* Support for different output formats. */ struct output_fns @@ -177,7 +150,9 @@ static int undefined_only = 0; /* Print undefined symbols only. */ static int dynamic = 0; /* Print dynamic symbols. */ static int show_version = 0; /* Show the version number. */ static int show_stats = 0; /* Show statistics. */ +static int show_synthetic = 0; /* Display synthesized symbols too. */ static int line_numbers = 0; /* Print line numbers for symbols. */ +static int allow_special_symbols = 0; /* Allow special symbols. */ /* When to print the names of files. Not mutually exclusive in SYSV format. */ static int filename_per_file = 0; /* Once per file, on its own line. */ @@ -231,7 +206,9 @@ static struct option long_options[] = {"radix", required_argument, 0, 't'}, {"reverse-sort", no_argument, &reverse_sort, 1}, {"size-sort", no_argument, &sort_by_size, 1}, + {"special-syms", no_argument, &allow_special_symbols, 1}, {"stats", no_argument, &show_stats, 1}, + {"synthetic", no_argument, &show_synthetic, 1}, {"target", required_argument, 0, OPTION_TARGET}, {"defined-only", no_argument, &defined_only, 1}, {"undefined-only", no_argument, &undefined_only, 1}, @@ -271,10 +248,13 @@ usage (FILE *stream, int status) -S, --print-size Print size of defined symbols\n\ -s, --print-armap Include index for symbols from archive members\n\ --size-sort Sort symbols by size\n\ + --special-syms Include special symbols in the output\n\ + --synthetic Display synthetic symbols as well\n\ -t, --radix=RADIX Use RADIX for printing symbol values\n\ --target=BFDNAME Specify the target object format as BFDNAME\n\ -u, --undefined-only Display only undefined symbols\n\ -X 32_64 (ignored)\n\ + @FILE Read options from FILE\n\ -h, --help Display this information\n\ -V, --version Display this program's version number\n\ \n")); @@ -341,173 +321,6 @@ set_output_format (char *f) format = &formats[i]; } -int main (int, char **); - -int -main (int argc, char **argv) -{ - int c; - int retval; - -#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) - setlocale (LC_MESSAGES, ""); -#endif -#if defined (HAVE_SETLOCALE) - setlocale (LC_CTYPE, ""); - setlocale (LC_COLLATE, ""); -#endif - bindtextdomain (PACKAGE, LOCALEDIR); - textdomain (PACKAGE); - - program_name = *argv; - xmalloc_set_program_name (program_name); - - START_PROGRESS (program_name, 0); - - bfd_init (); - set_default_bfd_target (); - - while ((c = getopt_long (argc, argv, "aABCDef:gHhlnopPrSst:uvVvX:", - long_options, (int *) 0)) != EOF) - { - switch (c) - { - case 'a': - print_debug_syms = 1; - break; - case 'A': - case 'o': - filename_per_symbol = 1; - break; - case 'B': /* For MIPS compatibility. */ - set_output_format ("bsd"); - break; - case 'C': - do_demangle = 1; - if (optarg != NULL) - { - enum demangling_styles style; - - style = cplus_demangle_name_to_style (optarg); - if (style == unknown_demangling) - fatal (_("unknown demangling style `%s'"), - optarg); - - cplus_demangle_set_style (style); - } - break; - case 'D': - dynamic = 1; - break; - case 'e': - /* Ignored for HP/UX compatibility. */ - break; - case 'f': - set_output_format (optarg); - break; - case 'g': - external_only = 1; - break; - case 'H': - case 'h': - usage (stdout, 0); - case 'l': - line_numbers = 1; - break; - case 'n': - case 'v': - sort_numerically = 1; - break; - case 'p': - no_sort = 1; - break; - case 'P': - set_output_format ("posix"); - break; - case 'r': - reverse_sort = 1; - break; - case 's': - print_armap = 1; - break; - case 'S': - print_size = 1; - break; - case 't': - set_print_radix (optarg); - break; - case 'u': - undefined_only = 1; - break; - case 'V': - show_version = 1; - break; - case 'X': - /* Ignored for (partial) AIX compatibility. On AIX, the - argument has values 32, 64, or 32_64, and specifies that - only 32-bit, only 64-bit, or both kinds of objects should - be examined. The default is 32. So plain AIX nm on a - library archive with both kinds of objects will ignore - the 64-bit ones. For GNU nm, the default is and always - has been -X 32_64, and other options are not supported. */ - if (strcmp (optarg, "32_64") != 0) - fatal (_("Only -X 32_64 is supported")); - break; - - case OPTION_TARGET: /* --target */ - target = optarg; - break; - - case 0: /* A long option that just sets a flag. */ - break; - - default: - usage (stderr, 1); - } - } - - if (show_version) - print_version ("nm"); - - if (sort_by_size && undefined_only) - { - non_fatal (_("Using the --size-sort and --undefined-only options together")); - non_fatal (_("will produce no output, since undefined symbols have no size.")); - return 0; - } - - /* OK, all options now parsed. If no filename specified, do a.out. */ - if (optind == argc) - return !display_file ("a.out"); - - retval = 0; - - if (argc - optind > 1) - filename_per_file = 1; - - /* We were given several filenames to do. */ - while (optind < argc) - { - PROGRESS (1); - if (!display_file (argv[optind++])) - retval++; - } - - END_PROGRESS (program_name); - -#ifdef HAVE_SBRK - if (show_stats) - { - char *lim = (char *) sbrk (0); - - non_fatal (_("data size %ld"), (long) (lim - (char *) &environ)); - } -#endif - - exit (retval); - return retval; -} - static const char * get_symbol_type (unsigned int type) { @@ -532,117 +345,124 @@ get_symbol_type (unsigned int type) return buff; } } + +/* Print symbol name NAME, read from ABFD, with printf format FORMAT, + demangling it if requested. */ static void -display_archive (bfd *file) +print_symname (const char *format, const char *name, bfd *abfd) { - bfd *arfile = NULL; - bfd *last_arfile = NULL; - char **matching; - - (*format->print_archive_filename) (bfd_get_filename (file)); - - if (print_armap) - print_symdef_entry (file); - - for (;;) + if (do_demangle && *name) { - PROGRESS (1); + char *res = demangle (abfd, name); - arfile = bfd_openr_next_archived_file (file, arfile); - - if (arfile == NULL) - { - if (bfd_get_error () != bfd_error_no_more_archived_files) - bfd_fatal (bfd_get_filename (file)); - break; - } - - if (bfd_check_format_matches (arfile, bfd_object, &matching)) - { - char buf[30]; - - bfd_sprintf_vma (arfile, buf, (bfd_vma) -1); - print_width = strlen (buf); - (*format->print_archive_member) (bfd_get_filename (file), - bfd_get_filename (arfile)); - display_rel_file (arfile, file); - } - else - { - bfd_nonfatal (bfd_get_filename (arfile)); - if (bfd_get_error () == bfd_error_file_ambiguously_recognized) - { - list_matching_formats (matching); - free (matching); - } - } - - if (last_arfile != NULL) - { - bfd_close (last_arfile); - lineno_cache_bfd = NULL; - lineno_cache_rel_bfd = NULL; - } - last_arfile = arfile; + printf (format, res); + free (res); + return; } - if (last_arfile != NULL) - { - bfd_close (last_arfile); - lineno_cache_bfd = NULL; - lineno_cache_rel_bfd = NULL; - } + printf (format, name); } -static bfd_boolean -display_file (char *filename) +static void +print_symdef_entry (bfd *abfd) { - bfd_boolean retval = TRUE; - bfd *file; - char **matching; + symindex idx = BFD_NO_MORE_SYMBOLS; + carsym *thesym; + bfd_boolean everprinted = FALSE; - if (get_file_size (filename) < 1) - return FALSE; - - file = bfd_openr (filename, target); - if (file == NULL) + for (idx = bfd_get_next_mapent (abfd, idx, &thesym); + idx != BFD_NO_MORE_SYMBOLS; + idx = bfd_get_next_mapent (abfd, idx, &thesym)) { - bfd_nonfatal (filename); - return FALSE; - } - - if (bfd_check_format (file, bfd_archive)) - { - display_archive (file); - } - else if (bfd_check_format_matches (file, bfd_object, &matching)) - { - char buf[30]; - - bfd_sprintf_vma (file, buf, (bfd_vma) -1); - print_width = strlen (buf); - (*format->print_object_filename) (filename); - display_rel_file (file, NULL); - } - else - { - bfd_nonfatal (filename); - if (bfd_get_error () == bfd_error_file_ambiguously_recognized) + bfd *elt; + if (!everprinted) { - list_matching_formats (matching); - free (matching); + printf (_("\nArchive index:\n")); + everprinted = TRUE; + } + elt = bfd_get_elt_at_index (abfd, idx); + if (elt == NULL) + bfd_fatal ("bfd_get_elt_at_index"); + if (thesym->name != (char *) NULL) + { + print_symname ("%s", thesym->name, abfd); + printf (" in %s\n", bfd_get_filename (elt)); + } + } +} + +/* Choose which symbol entries to print; + compact them downward to get rid of the rest. + Return the number of symbols to be printed. */ + +static long +filter_symbols (bfd *abfd, bfd_boolean dynamic, void *minisyms, + long symcount, unsigned int size) +{ + bfd_byte *from, *fromend, *to; + asymbol *store; + + store = bfd_make_empty_symbol (abfd); + if (store == NULL) + bfd_fatal (bfd_get_filename (abfd)); + + from = (bfd_byte *) minisyms; + fromend = from + symcount * size; + to = (bfd_byte *) minisyms; + + for (; from < fromend; from += size) + { + int keep = 0; + asymbol *sym; + + PROGRESS (1); + + sym = bfd_minisymbol_to_symbol (abfd, dynamic, (const void *) from, store); + if (sym == NULL) + bfd_fatal (bfd_get_filename (abfd)); + + if (undefined_only) + keep = bfd_is_und_section (sym->section); + else if (external_only) + keep = ((sym->flags & BSF_GLOBAL) != 0 + || (sym->flags & BSF_WEAK) != 0 + || bfd_is_und_section (sym->section) + || bfd_is_com_section (sym->section)); + else + keep = 1; + + if (keep + && ! print_debug_syms + && (sym->flags & BSF_DEBUGGING) != 0) + keep = 0; + + if (keep + && sort_by_size + && (bfd_is_abs_section (sym->section) + || bfd_is_und_section (sym->section))) + keep = 0; + + if (keep + && defined_only) + { + if (bfd_is_und_section (sym->section)) + keep = 0; + } + + if (keep + && bfd_is_target_special_symbol (abfd, sym) + && ! allow_special_symbols) + keep = 0; + + if (keep) + { + memcpy (to, from, size); + to += size; } - retval = FALSE; } - if (!bfd_close (file)) - bfd_fatal (filename); - - lineno_cache_bfd = NULL; - lineno_cache_rel_bfd = NULL; - - return retval; + return (to - (bfd_byte *) minisyms) / size; } /* These globals are used to pass information into the sorting @@ -659,39 +479,6 @@ static asymbol *sort_y; defined symbols with zero values. Common symbols are not treated specially -- i.e., their sizes are used as their "values". */ -static int -numeric_forward (const void *P_x, const void *P_y) -{ - asymbol *x, *y; - asection *xs, *ys; - - x = bfd_minisymbol_to_symbol (sort_bfd, sort_dynamic, P_x, sort_x); - y = bfd_minisymbol_to_symbol (sort_bfd, sort_dynamic, P_y, sort_y); - if (x == NULL || y == NULL) - bfd_fatal (bfd_get_filename (sort_bfd)); - - xs = bfd_get_section (x); - ys = bfd_get_section (y); - - if (bfd_is_und_section (xs)) - { - if (! bfd_is_und_section (ys)) - return -1; - } - else if (bfd_is_und_section (ys)) - return 1; - else if (valueof (x) != valueof (y)) - return valueof (x) < valueof (y) ? -1 : 1; - - return non_numeric_forward (P_x, P_y); -} - -static int -numeric_reverse (const void *x, const void *y) -{ - return - numeric_forward (x, y); -} - static int non_numeric_forward (const void *P_x, const void *P_y) { @@ -731,6 +518,39 @@ non_numeric_reverse (const void *x, const void *y) return - non_numeric_forward (x, y); } +static int +numeric_forward (const void *P_x, const void *P_y) +{ + asymbol *x, *y; + asection *xs, *ys; + + x = bfd_minisymbol_to_symbol (sort_bfd, sort_dynamic, P_x, sort_x); + y = bfd_minisymbol_to_symbol (sort_bfd, sort_dynamic, P_y, sort_y); + if (x == NULL || y == NULL) + bfd_fatal (bfd_get_filename (sort_bfd)); + + xs = bfd_get_section (x); + ys = bfd_get_section (y); + + if (bfd_is_und_section (xs)) + { + if (! bfd_is_und_section (ys)) + return -1; + } + else if (bfd_is_und_section (ys)) + return 1; + else if (valueof (x) != valueof (y)) + return valueof (x) < valueof (y) ? -1 : 1; + + return non_numeric_forward (P_x, P_y); +} + +static int +numeric_reverse (const void *x, const void *y) +{ + return - numeric_forward (x, y); +} + static int (*(sorters[2][2])) (const void *, const void *) = { { non_numeric_forward, non_numeric_reverse }, @@ -851,7 +671,7 @@ sort_symbols_by_size (bfd *abfd, bfd_boolean dynamic, void *minisyms, /* We are going to return a special set of symbols and sizes to print. */ - symsizes = (struct size_sym *) xmalloc (symcount * sizeof (struct size_sym)); + symsizes = xmalloc (symcount * sizeof (struct size_sym)); *symsizesp = symsizes; /* Note that filter_symbols has already removed all absolute and @@ -928,215 +748,40 @@ sort_symbols_by_size (bfd *abfd, bfd_boolean dynamic, void *minisyms, return symcount; } - -/* If ARCHIVE_BFD is non-NULL, it is the archive containing ABFD. */ + +/* This function is used to get the relocs for a particular section. + It is called via bfd_map_over_sections. */ static void -display_rel_file (bfd *abfd, bfd *archive_bfd) +get_relocs (bfd *abfd, asection *sec, void *dataarg) { - long symcount; - void *minisyms; - unsigned int size; - struct size_sym *symsizes; + struct get_relocs_info *data = (struct get_relocs_info *) dataarg; - if (! dynamic) + *data->secs = sec; + + if ((sec->flags & SEC_RELOC) == 0) { - if (!(bfd_get_file_flags (abfd) & HAS_SYMS)) - { - non_fatal (_("%s: no symbols"), bfd_get_filename (abfd)); - return; - } + *data->relocs = NULL; + *data->relcount = 0; } - - symcount = bfd_read_minisymbols (abfd, dynamic, &minisyms, &size); - if (symcount < 0) - bfd_fatal (bfd_get_filename (abfd)); - - if (symcount == 0) - { - non_fatal (_("%s: no symbols"), bfd_get_filename (abfd)); - return; - } - - /* Discard the symbols we don't want to print. - It's OK to do this in place; we'll free the storage anyway - (after printing). */ - - symcount = filter_symbols (abfd, dynamic, minisyms, symcount, size); - - symsizes = NULL; - if (! no_sort) - { - sort_bfd = abfd; - sort_dynamic = dynamic; - sort_x = bfd_make_empty_symbol (abfd); - sort_y = bfd_make_empty_symbol (abfd); - if (sort_x == NULL || sort_y == NULL) - bfd_fatal (bfd_get_filename (abfd)); - - if (! sort_by_size) - qsort (minisyms, symcount, size, - sorters[sort_numerically][reverse_sort]); - else - symcount = sort_symbols_by_size (abfd, dynamic, minisyms, symcount, - size, &symsizes); - } - - if (! sort_by_size) - print_symbols (abfd, dynamic, minisyms, symcount, size, archive_bfd); else - print_size_symbols (abfd, dynamic, symsizes, symcount, archive_bfd); - - free (minisyms); -} - -/* Choose which symbol entries to print; - compact them downward to get rid of the rest. - Return the number of symbols to be printed. */ - -static long -filter_symbols (bfd *abfd, bfd_boolean dynamic, void *minisyms, - long symcount, unsigned int size) -{ - bfd_byte *from, *fromend, *to; - asymbol *store; - - store = bfd_make_empty_symbol (abfd); - if (store == NULL) - bfd_fatal (bfd_get_filename (abfd)); - - from = (bfd_byte *) minisyms; - fromend = from + symcount * size; - to = (bfd_byte *) minisyms; - - for (; from < fromend; from += size) { - int keep = 0; - asymbol *sym; + long relsize; - PROGRESS (1); - - sym = bfd_minisymbol_to_symbol (abfd, dynamic, (const void *) from, store); - if (sym == NULL) + relsize = bfd_get_reloc_upper_bound (abfd, sec); + if (relsize < 0) bfd_fatal (bfd_get_filename (abfd)); - if (undefined_only) - keep = bfd_is_und_section (sym->section); - else if (external_only) - keep = ((sym->flags & BSF_GLOBAL) != 0 - || (sym->flags & BSF_WEAK) != 0 - || bfd_is_und_section (sym->section) - || bfd_is_com_section (sym->section)); - else - keep = 1; - - if (keep - && ! print_debug_syms - && (sym->flags & BSF_DEBUGGING) != 0) - keep = 0; - - if (keep - && sort_by_size - && (bfd_is_abs_section (sym->section) - || bfd_is_und_section (sym->section))) - keep = 0; - - if (keep - && defined_only) - { - if (bfd_is_und_section (sym->section)) - keep = 0; - } - - if (keep) - { - memcpy (to, from, size); - to += size; - } - } - - return (to - (bfd_byte *) minisyms) / size; -} - -/* Print symbol name NAME, read from ABFD, with printf format FORMAT, - demangling it if requested. */ - -static void -print_symname (const char *format, const char *name, bfd *abfd) -{ - if (do_demangle && *name) - { - char *res = demangle (abfd, name); - - printf (format, res); - free (res); - return; - } - - printf (format, name); -} - -/* Print the symbols. If ARCHIVE_BFD is non-NULL, it is the archive - containing ABFD. */ - -static void -print_symbols (bfd *abfd, bfd_boolean dynamic, void *minisyms, long symcount, - unsigned int size, bfd *archive_bfd) -{ - asymbol *store; - bfd_byte *from, *fromend; - - store = bfd_make_empty_symbol (abfd); - if (store == NULL) - bfd_fatal (bfd_get_filename (abfd)); - - from = (bfd_byte *) minisyms; - fromend = from + symcount * size; - for (; from < fromend; from += size) - { - asymbol *sym; - - sym = bfd_minisymbol_to_symbol (abfd, dynamic, from, store); - if (sym == NULL) + *data->relocs = xmalloc (relsize); + *data->relcount = bfd_canonicalize_reloc (abfd, sec, *data->relocs, + data->syms); + if (*data->relcount < 0) bfd_fatal (bfd_get_filename (abfd)); - - print_symbol (abfd, sym, (bfd_vma) 0, archive_bfd); } -} -/* Print the symbols when sorting by size. */ - -static void -print_size_symbols (bfd *abfd, bfd_boolean dynamic, - struct size_sym *symsizes, long symcount, - bfd *archive_bfd) -{ - asymbol *store; - struct size_sym *from, *fromend; - - store = bfd_make_empty_symbol (abfd); - if (store == NULL) - bfd_fatal (bfd_get_filename (abfd)); - - from = symsizes; - fromend = from + symcount; - for (; from < fromend; from++) - { - asymbol *sym; - bfd_vma ssize; - - sym = bfd_minisymbol_to_symbol (abfd, dynamic, from->minisym, store); - if (sym == NULL) - bfd_fatal (bfd_get_filename (abfd)); - - /* For elf we have already computed the correct symbol size. */ - if (bfd_get_flavour (abfd) == bfd_target_elf_flavour) - ssize = from->size; - else - ssize = from->size - bfd_section_vma (abfd, bfd_get_section (sym)); - - print_symbol (abfd, sym, ssize, archive_bfd); - } + ++data->secs; + ++data->relocs; + ++data->relcount; } /* Print a single symbol. */ @@ -1149,7 +794,7 @@ print_symbol (bfd *abfd, asymbol *sym, bfd_vma ssize, bfd *archive_bfd) PROGRESS (1); - (*format->print_symbol_filename) (archive_bfd, abfd); + format->print_symbol_filename (archive_bfd, abfd); bfd_get_symbol_info (abfd, sym, &syminfo); info.sinfo = &syminfo; @@ -1158,7 +803,7 @@ print_symbol (bfd *abfd, asymbol *sym, bfd_vma ssize, bfd *archive_bfd) info.elfinfo = (elf_symbol_type *) sym; else info.elfinfo = NULL; - (*format->print_symbol_info) (&info, abfd); + format->print_symbol_info (&info, abfd); if (line_numbers) { @@ -1182,7 +827,7 @@ print_symbol (bfd *abfd, asymbol *sym, bfd_vma ssize, bfd *archive_bfd) symsize = bfd_get_symtab_upper_bound (abfd); if (symsize < 0) bfd_fatal (bfd_get_filename (abfd)); - syms = (asymbol **) xmalloc (symsize); + syms = xmalloc (symsize); symcount = bfd_canonicalize_symtab (abfd, syms); if (symcount < 0) bfd_fatal (bfd_get_filename (abfd)); @@ -1219,9 +864,9 @@ print_symbol (bfd *abfd, asymbol *sym, bfd_vma ssize, bfd *archive_bfd) seccount = bfd_count_sections (abfd); - secs = (asection **) xmalloc (seccount * sizeof *secs); - relocs = (arelent ***) xmalloc (seccount * sizeof *relocs); - relcount = (long *) xmalloc (seccount * sizeof *relcount); + secs = xmalloc (seccount * sizeof *secs); + relocs = xmalloc (seccount * sizeof *relocs); + relcount = xmalloc (seccount * sizeof *relcount); info.secs = secs; info.relocs = relocs; @@ -1261,20 +906,305 @@ print_symbol (bfd *abfd, asymbol *sym, bfd_vma ssize, bfd *archive_bfd) } else if (bfd_get_section (sym)->owner == abfd) { - if (bfd_find_nearest_line (abfd, bfd_get_section (sym), syms, - sym->value, &filename, &functionname, - &lineno) + if ((bfd_find_line (abfd, syms, sym, &filename, &lineno) + || bfd_find_nearest_line (abfd, bfd_get_section (sym), + syms, sym->value, &filename, + &functionname, &lineno)) && filename != NULL && lineno != 0) - { - printf ("\t%s:%u", filename, lineno); - } + printf ("\t%s:%u", filename, lineno); } } putchar ('\n'); } +/* Print the symbols when sorting by size. */ + +static void +print_size_symbols (bfd *abfd, bfd_boolean dynamic, + struct size_sym *symsizes, long symcount, + bfd *archive_bfd) +{ + asymbol *store; + struct size_sym *from, *fromend; + + store = bfd_make_empty_symbol (abfd); + if (store == NULL) + bfd_fatal (bfd_get_filename (abfd)); + + from = symsizes; + fromend = from + symcount; + for (; from < fromend; from++) + { + asymbol *sym; + bfd_vma ssize; + + sym = bfd_minisymbol_to_symbol (abfd, dynamic, from->minisym, store); + if (sym == NULL) + bfd_fatal (bfd_get_filename (abfd)); + + /* For elf we have already computed the correct symbol size. */ + if (bfd_get_flavour (abfd) == bfd_target_elf_flavour) + ssize = from->size; + else + ssize = from->size - bfd_section_vma (abfd, bfd_get_section (sym)); + + print_symbol (abfd, sym, ssize, archive_bfd); + } +} + + +/* Print the symbols. If ARCHIVE_BFD is non-NULL, it is the archive + containing ABFD. */ + +static void +print_symbols (bfd *abfd, bfd_boolean dynamic, void *minisyms, long symcount, + unsigned int size, bfd *archive_bfd) +{ + asymbol *store; + bfd_byte *from, *fromend; + + store = bfd_make_empty_symbol (abfd); + if (store == NULL) + bfd_fatal (bfd_get_filename (abfd)); + + from = (bfd_byte *) minisyms; + fromend = from + symcount * size; + for (; from < fromend; from += size) + { + asymbol *sym; + + sym = bfd_minisymbol_to_symbol (abfd, dynamic, from, store); + if (sym == NULL) + bfd_fatal (bfd_get_filename (abfd)); + + print_symbol (abfd, sym, (bfd_vma) 0, archive_bfd); + } +} + +/* If ARCHIVE_BFD is non-NULL, it is the archive containing ABFD. */ + +static void +display_rel_file (bfd *abfd, bfd *archive_bfd) +{ + long symcount; + void *minisyms; + unsigned int size; + struct size_sym *symsizes; + + if (! dynamic) + { + if (!(bfd_get_file_flags (abfd) & HAS_SYMS)) + { + non_fatal (_("%s: no symbols"), bfd_get_filename (abfd)); + return; + } + } + + symcount = bfd_read_minisymbols (abfd, dynamic, &minisyms, &size); + if (symcount < 0) + bfd_fatal (bfd_get_filename (abfd)); + + if (symcount == 0) + { + non_fatal (_("%s: no symbols"), bfd_get_filename (abfd)); + return; + } + + if (show_synthetic && size == sizeof (asymbol *)) + { + asymbol *synthsyms; + long synth_count; + asymbol **static_syms = NULL; + asymbol **dyn_syms = NULL; + long static_count = 0; + long dyn_count = 0; + + if (dynamic) + { + dyn_count = symcount; + dyn_syms = minisyms; + } + else + { + long storage = bfd_get_dynamic_symtab_upper_bound (abfd); + + static_count = symcount; + static_syms = minisyms; + + if (storage > 0) + { + dyn_syms = xmalloc (storage); + dyn_count = bfd_canonicalize_dynamic_symtab (abfd, dyn_syms); + if (dyn_count < 0) + bfd_fatal (bfd_get_filename (abfd)); + } + } + synth_count = bfd_get_synthetic_symtab (abfd, static_count, static_syms, + dyn_count, dyn_syms, &synthsyms); + if (synth_count > 0) + { + asymbol **symp; + void *new_mini; + long i; + + new_mini = xmalloc ((symcount + synth_count + 1) * sizeof (*symp)); + symp = new_mini; + memcpy (symp, minisyms, symcount * sizeof (*symp)); + symp += symcount; + for (i = 0; i < synth_count; i++) + *symp++ = synthsyms + i; + *symp = 0; + minisyms = new_mini; + symcount += synth_count; + } + } + + /* Discard the symbols we don't want to print. + It's OK to do this in place; we'll free the storage anyway + (after printing). */ + + symcount = filter_symbols (abfd, dynamic, minisyms, symcount, size); + + symsizes = NULL; + if (! no_sort) + { + sort_bfd = abfd; + sort_dynamic = dynamic; + sort_x = bfd_make_empty_symbol (abfd); + sort_y = bfd_make_empty_symbol (abfd); + if (sort_x == NULL || sort_y == NULL) + bfd_fatal (bfd_get_filename (abfd)); + + if (! sort_by_size) + qsort (minisyms, symcount, size, + sorters[sort_numerically][reverse_sort]); + else + symcount = sort_symbols_by_size (abfd, dynamic, minisyms, symcount, + size, &symsizes); + } + + if (! sort_by_size) + print_symbols (abfd, dynamic, minisyms, symcount, size, archive_bfd); + else + print_size_symbols (abfd, dynamic, symsizes, symcount, archive_bfd); + + free (minisyms); +} + +static void +display_archive (bfd *file) +{ + bfd *arfile = NULL; + bfd *last_arfile = NULL; + char **matching; + + format->print_archive_filename (bfd_get_filename (file)); + + if (print_armap) + print_symdef_entry (file); + + for (;;) + { + PROGRESS (1); + + arfile = bfd_openr_next_archived_file (file, arfile); + + if (arfile == NULL) + { + if (bfd_get_error () != bfd_error_no_more_archived_files) + bfd_fatal (bfd_get_filename (file)); + break; + } + + if (bfd_check_format_matches (arfile, bfd_object, &matching)) + { + char buf[30]; + + bfd_sprintf_vma (arfile, buf, (bfd_vma) -1); + print_width = strlen (buf); + format->print_archive_member (bfd_get_filename (file), + bfd_get_filename (arfile)); + display_rel_file (arfile, file); + } + else + { + bfd_nonfatal (bfd_get_filename (arfile)); + if (bfd_get_error () == bfd_error_file_ambiguously_recognized) + { + list_matching_formats (matching); + free (matching); + } + } + + if (last_arfile != NULL) + { + bfd_close (last_arfile); + lineno_cache_bfd = NULL; + lineno_cache_rel_bfd = NULL; + } + last_arfile = arfile; + } + + if (last_arfile != NULL) + { + bfd_close (last_arfile); + lineno_cache_bfd = NULL; + lineno_cache_rel_bfd = NULL; + } +} + +static bfd_boolean +display_file (char *filename) +{ + bfd_boolean retval = TRUE; + bfd *file; + char **matching; + + if (get_file_size (filename) < 1) + return FALSE; + + file = bfd_openr (filename, target); + if (file == NULL) + { + bfd_nonfatal (filename); + return FALSE; + } + + if (bfd_check_format (file, bfd_archive)) + { + display_archive (file); + } + else if (bfd_check_format_matches (file, bfd_object, &matching)) + { + char buf[30]; + + bfd_sprintf_vma (file, buf, (bfd_vma) -1); + print_width = strlen (buf); + format->print_object_filename (filename); + display_rel_file (file, NULL); + } + else + { + bfd_nonfatal (filename); + if (bfd_get_error () == bfd_error_file_ambiguously_recognized) + { + list_matching_formats (matching); + free (matching); + } + retval = FALSE; + } + + if (!bfd_close (file)) + bfd_fatal (filename); + + lineno_cache_bfd = NULL; + lineno_cache_rel_bfd = NULL; + + return retval; +} + /* The following 3 groups of functions are called unconditionally, once at the start of processing each file of the appropriate type. They should check `filename_per_file' and `filename_per_symbol', @@ -1541,65 +1471,169 @@ print_symbol_info_posix (struct extended_symbol_info *info, bfd *abfd) } } -static void -print_symdef_entry (bfd *abfd) +int +main (int argc, char **argv) { - symindex idx = BFD_NO_MORE_SYMBOLS; - carsym *thesym; - bfd_boolean everprinted = FALSE; + int c; + int retval; - for (idx = bfd_get_next_mapent (abfd, idx, &thesym); - idx != BFD_NO_MORE_SYMBOLS; - idx = bfd_get_next_mapent (abfd, idx, &thesym)) +#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) + setlocale (LC_MESSAGES, ""); +#endif +#if defined (HAVE_SETLOCALE) + setlocale (LC_CTYPE, ""); + setlocale (LC_COLLATE, ""); +#endif + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); + + program_name = *argv; + xmalloc_set_program_name (program_name); + + START_PROGRESS (program_name, 0); + + expandargv (&argc, &argv); + + bfd_init (); + set_default_bfd_target (); + + while ((c = getopt_long (argc, argv, "aABCDef:gHhlnopPrSst:uvVvX:", + long_options, (int *) 0)) != EOF) { - bfd *elt; - if (!everprinted) + switch (c) { - printf (_("\nArchive index:\n")); - everprinted = TRUE; - } - elt = bfd_get_elt_at_index (abfd, idx); - if (elt == NULL) - bfd_fatal ("bfd_get_elt_at_index"); - if (thesym->name != (char *) NULL) - { - print_symname ("%s", thesym->name, abfd); - printf (" in %s\n", bfd_get_filename (elt)); + case 'a': + print_debug_syms = 1; + break; + case 'A': + case 'o': + filename_per_symbol = 1; + break; + case 'B': /* For MIPS compatibility. */ + set_output_format ("bsd"); + break; + case 'C': + do_demangle = 1; + if (optarg != NULL) + { + enum demangling_styles style; + + style = cplus_demangle_name_to_style (optarg); + if (style == unknown_demangling) + fatal (_("unknown demangling style `%s'"), + optarg); + + cplus_demangle_set_style (style); + } + break; + case 'D': + dynamic = 1; + break; + case 'e': + /* Ignored for HP/UX compatibility. */ + break; + case 'f': + set_output_format (optarg); + break; + case 'g': + external_only = 1; + break; + case 'H': + case 'h': + usage (stdout, 0); + case 'l': + line_numbers = 1; + break; + case 'n': + case 'v': + sort_numerically = 1; + break; + case 'p': + no_sort = 1; + break; + case 'P': + set_output_format ("posix"); + break; + case 'r': + reverse_sort = 1; + break; + case 's': + print_armap = 1; + break; + case 'S': + print_size = 1; + break; + case 't': + set_print_radix (optarg); + break; + case 'u': + undefined_only = 1; + break; + case 'V': + show_version = 1; + break; + case 'X': + /* Ignored for (partial) AIX compatibility. On AIX, the + argument has values 32, 64, or 32_64, and specifies that + only 32-bit, only 64-bit, or both kinds of objects should + be examined. The default is 32. So plain AIX nm on a + library archive with both kinds of objects will ignore + the 64-bit ones. For GNU nm, the default is and always + has been -X 32_64, and other options are not supported. */ + if (strcmp (optarg, "32_64") != 0) + fatal (_("Only -X 32_64 is supported")); + break; + + case OPTION_TARGET: /* --target */ + target = optarg; + break; + + case 0: /* A long option that just sets a flag. */ + break; + + default: + usage (stderr, 1); } } -} - -/* This function is used to get the relocs for a particular section. - It is called via bfd_map_over_sections. */ -static void -get_relocs (bfd *abfd, asection *sec, void *dataarg) -{ - struct get_relocs_info *data = (struct get_relocs_info *) dataarg; + if (show_version) + print_version ("nm"); - *data->secs = sec; - - if ((sec->flags & SEC_RELOC) == 0) + if (sort_by_size && undefined_only) { - *data->relocs = NULL; - *data->relcount = 0; - } - else - { - long relsize; - - relsize = bfd_get_reloc_upper_bound (abfd, sec); - if (relsize < 0) - bfd_fatal (bfd_get_filename (abfd)); - - *data->relocs = (arelent **) xmalloc (relsize); - *data->relcount = bfd_canonicalize_reloc (abfd, sec, *data->relocs, - data->syms); - if (*data->relcount < 0) - bfd_fatal (bfd_get_filename (abfd)); + non_fatal (_("Using the --size-sort and --undefined-only options together")); + non_fatal (_("will produce no output, since undefined symbols have no size.")); + return 0; } - ++data->secs; - ++data->relocs; - ++data->relcount; + /* OK, all options now parsed. If no filename specified, do a.out. */ + if (optind == argc) + return !display_file ("a.out"); + + retval = 0; + + if (argc - optind > 1) + filename_per_file = 1; + + /* We were given several filenames to do. */ + while (optind < argc) + { + PROGRESS (1); + if (!display_file (argv[optind++])) + retval++; + } + + END_PROGRESS (program_name); + +#ifdef HAVE_SBRK + if (show_stats) + { + char *lim = (char *) sbrk (0); + + non_fatal (_("data size %ld"), (long) (lim - (char *) &environ)); + } +#endif + + exit (retval); + return retval; } diff --git a/contrib/binutils/binutils/objcopy.c b/contrib/binutils/binutils/objcopy.c index 96233986c3e..0e0cfaaccf5 100644 --- a/contrib/binutils/binutils/objcopy.c +++ b/contrib/binutils/binutils/objcopy.c @@ -1,6 +1,6 @@ /* objcopy.c -- copy object file from input to output, optionally massaging it. Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003, 2004 + 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #include "bfd.h" #include "progress.h" @@ -30,6 +30,7 @@ #include "fnmatch.h" #include "elf-bfd.h" #include +#include "libbfd.h" /* A list of symbols to explicitly strip out, or to keep. A linked list is good enough for a small number from the command line, but @@ -146,8 +147,8 @@ static bfd_byte gap_fill = 0; static bfd_boolean pad_to_set = FALSE; static bfd_vma pad_to; -/* Use alternate machine code? */ -static int use_alt_mach_code = 0; +/* Use alternative machine code? */ +static unsigned long use_alt_mach_code = 0; /* Output BFD flags user wants to set or clear */ static flagword bfd_flags_to_set; @@ -192,8 +193,10 @@ static bfd_boolean wildcard = FALSE; /* List of symbols to strip, keep, localize, keep-global, weaken, or redefine. */ static struct symlist *strip_specific_list = NULL; +static struct symlist *strip_unneeded_list = NULL; static struct symlist *keep_specific_list = NULL; static struct symlist *localize_specific_list = NULL; +static struct symlist *globalize_specific_list = NULL; static struct symlist *keepglobal_specific_list = NULL; static struct symlist *weaken_specific_list = NULL; static struct redefine_node *redefine_sym_list = NULL; @@ -201,6 +204,9 @@ static struct redefine_node *redefine_sym_list = NULL; /* If this is TRUE, we weaken global symbols (set BSF_WEAK). */ static bfd_boolean weaken = FALSE; +/* If this is TRUE, we retain BSF_FILE symbols. */ +static bfd_boolean keep_file_symbols = FALSE; + /* Prefix symbols/sections. */ static char *prefix_symbols_string = 0; static char *prefix_sections_string = 0; @@ -231,8 +237,12 @@ enum command_line_switch OPTION_SREC_LEN, OPTION_SREC_FORCES3, OPTION_STRIP_SYMBOLS, + OPTION_STRIP_UNNEEDED_SYMBOL, + OPTION_STRIP_UNNEEDED_SYMBOLS, OPTION_KEEP_SYMBOLS, OPTION_LOCALIZE_SYMBOLS, + OPTION_GLOBALIZE_SYMBOL, + OPTION_GLOBALIZE_SYMBOLS, OPTION_KEEPGLOBAL_SYMBOLS, OPTION_WEAKEN_SYMBOLS, OPTION_RENAME_SECTION, @@ -243,6 +253,7 @@ enum command_line_switch OPTION_FORMATS_INFO, OPTION_ADD_GNU_DEBUGLINK, OPTION_ONLY_KEEP_DEBUG, + OPTION_KEEP_FILE_SYMBOLS, OPTION_READONLY_TEXT, OPTION_WRITABLE_TEXT, OPTION_PURE, @@ -260,6 +271,7 @@ static struct option strip_options[] = {"info", no_argument, 0, OPTION_FORMATS_INFO}, {"input-format", required_argument, 0, 'I'}, /* Obsolete */ {"input-target", required_argument, 0, 'I'}, + {"keep-file-symbols", no_argument, 0, OPTION_KEEP_FILE_SYMBOLS}, {"keep-symbol", required_argument, 0, 'K'}, {"only-keep-debug", no_argument, 0, OPTION_ONLY_KEEP_DEBUG}, {"output-format", required_argument, 0, 'O'}, /* Obsolete */ @@ -303,12 +315,15 @@ static struct option copy_options[] = {"discard-locals", no_argument, 0, 'X'}, {"format", required_argument, 0, 'F'}, /* Obsolete */ {"gap-fill", required_argument, 0, OPTION_GAP_FILL}, + {"globalize-symbol", required_argument, 0, OPTION_GLOBALIZE_SYMBOL}, + {"globalize-symbols", required_argument, 0, OPTION_GLOBALIZE_SYMBOLS}, {"help", no_argument, 0, 'h'}, {"impure", no_argument, 0, OPTION_IMPURE}, {"info", no_argument, 0, OPTION_FORMATS_INFO}, {"input-format", required_argument, 0, 'I'}, /* Obsolete */ {"input-target", required_argument, 0, 'I'}, {"interleave", required_argument, 0, 'i'}, + {"keep-file-symbols", no_argument, 0, OPTION_KEEP_FILE_SYMBOLS}, {"keep-global-symbol", required_argument, 0, 'G'}, {"keep-global-symbols", required_argument, 0, OPTION_KEEPGLOBAL_SYMBOLS}, {"keep-symbol", required_argument, 0, 'K'}, @@ -340,6 +355,8 @@ static struct option copy_options[] = {"strip-all", no_argument, 0, 'S'}, {"strip-debug", no_argument, 0, 'g'}, {"strip-unneeded", no_argument, 0, OPTION_STRIP_UNNEEDED}, + {"strip-unneeded-symbol", required_argument, 0, OPTION_STRIP_UNNEEDED_SYMBOL}, + {"strip-unneeded-symbols", required_argument, 0, OPTION_STRIP_UNNEEDED_SYMBOLS}, {"strip-symbol", required_argument, 0, 'N'}, {"strip-symbols", required_argument, 0, OPTION_STRIP_SYMBOLS}, {"target", required_argument, 0, 'F'}, @@ -377,6 +394,7 @@ extern unsigned long bfd_external_machine; /* Forward declarations. */ static void setup_section (bfd *, asection *, void *); +static void setup_bfd_headers (bfd *, bfd *); static void copy_section (bfd *, asection *, void *); static void get_sections (bfd *, asection *, void *); static int compare_section_lma (const void *, const void *); @@ -404,13 +422,18 @@ copy_usage (FILE *stream, int exit_status) -g --strip-debug Remove all debugging symbols & sections\n\ --strip-unneeded Remove all symbols not needed by relocations\n\ -N --strip-symbol Do not copy symbol \n\ + --strip-unneeded-symbol \n\ + Do not copy symbol unless needed by\n\ + relocations\n\ --only-keep-debug Strip everything but the debug information\n\ - -K --keep-symbol Only copy symbol \n\ + -K --keep-symbol Do not strip symbol \n\ + --keep-file-symbols Do not strip file symbol(s)\n\ -L --localize-symbol Force symbol to be marked as a local\n\ + --globalize-symbol Force symbol to be marked as a global\n\ -G --keep-global-symbol Localize all symbols except \n\ -W --weaken-symbol Force symbol to be marked as a weak\n\ --weaken Force all global symbols to be marked as weak\n\ - -w --wildcard Permit wildcard in symbol comparasion\n\ + -w --wildcard Permit wildcard in symbol comparison\n\ -x --discard-all Remove all non-global symbols\n\ -X --discard-locals Remove any compiler-generated symbols\n\ -i --interleave Only copy one out of every bytes\n\ @@ -442,11 +465,15 @@ copy_usage (FILE *stream, int exit_status) --srec-len Restrict the length of generated Srecords\n\ --srec-forceS3 Restrict the type of generated Srecords to S3\n\ --strip-symbols -N for all symbols listed in \n\ + --strip-unneeded-symbols \n\ + --strip-unneeded-symbol for all symbols listed\n\ + in \n\ --keep-symbols -K for all symbols listed in \n\ --localize-symbols -L for all symbols listed in \n\ + --globalize-symbols --globalize-symbol for all in \n\ --keep-global-symbols -G for all symbols listed in \n\ --weaken-symbols -W for all symbols listed in \n\ - --alt-machine-code Use alternate machine code for output\n\ + --alt-machine-code Use the target's 'th alternative machine\n\ --writable-text Mark the output text as writable\n\ --readonly-text Make the output text write protected\n\ --pure Mark the output file as demand paged\n\ @@ -457,6 +484,7 @@ copy_usage (FILE *stream, int exit_status) Add to start of every allocatable\n\ section name\n\ -v --verbose List all object files modified\n\ + @ Read options from \n\ -V --version Display this program's version number\n\ -h --help Display this output\n\ --info List object formats & architectures supported\n\ @@ -484,8 +512,9 @@ strip_usage (FILE *stream, int exit_status) --strip-unneeded Remove all symbols not needed by relocations\n\ --only-keep-debug Strip everything but the debug information\n\ -N --strip-symbol= Do not copy symbol \n\ - -K --keep-symbol= Only copy symbol \n\ - -w --wildcard Permit wildcard in symbol comparasion\n\ + -K --keep-symbol= Do not strip symbol \n\ + --keep-file-symbols Do not strip file symbol(s)\n\ + -w --wildcard Permit wildcard in symbol comparison\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\ @@ -535,7 +564,7 @@ parse_flags (const char *s) PARSE_FLAG ("code", SEC_CODE); PARSE_FLAG ("data", SEC_DATA); PARSE_FLAG ("rom", SEC_ROM); - PARSE_FLAG ("share", SEC_SHARED); + PARSE_FLAG ("share", SEC_COFF_SHARED); PARSE_FLAG ("contents", SEC_HAS_CONTENTS); #undef PARSE_FLAG else @@ -699,8 +728,8 @@ add_specific_symbols (const char *filename, struct symlist **list) ; if (! IS_LINE_TERMINATOR (* extra)) - non_fatal (_("Ignoring rubbish found on line %d of %s"), - line_count, filename); + non_fatal (_("%s:%d: Ignoring rubbish found on this line"), + filename, line_count); } * name_end = '\0'; @@ -890,7 +919,7 @@ filter_symbols (bfd *abfd, bfd *obfd, asymbol **osyms, keep = (strip_symbols != STRIP_DEBUG && strip_symbols != STRIP_UNNEEDED && ! convert_debugging); - else if (bfd_get_section (sym)->comdat) + else if (bfd_coff_get_comdat_section (abfd, bfd_get_section (sym))) /* COMDAT sections store special information in local symbols, so we cannot risk stripping any of them. */ keep = 1; @@ -902,28 +931,46 @@ filter_symbols (bfd *abfd, bfd *obfd, asymbol **osyms, if (keep && is_specified_symbol (name, strip_specific_list)) keep = 0; - if (!keep && is_specified_symbol (name, keep_specific_list)) + if (keep + && !(flags & BSF_KEEP) + && is_specified_symbol (name, strip_unneeded_list)) + keep = 0; + if (!keep + && ((keep_file_symbols && (flags & BSF_FILE)) + || is_specified_symbol (name, keep_specific_list))) keep = 1; if (keep && is_strip_section (abfd, bfd_get_section (sym))) keep = 0; - if (keep && (flags & BSF_GLOBAL) != 0 - && (weaken || is_specified_symbol (name, weaken_specific_list))) - { - sym->flags &=~ BSF_GLOBAL; - sym->flags |= BSF_WEAK; - } - if (keep && !undefined && (flags & (BSF_GLOBAL | BSF_WEAK)) - && (is_specified_symbol (name, localize_specific_list) - || (keepglobal_specific_list != NULL - && ! is_specified_symbol (name, keepglobal_specific_list)))) - { - sym->flags &= ~(BSF_GLOBAL | BSF_WEAK); - sym->flags |= BSF_LOCAL; - } - if (keep) - to[dst_count++] = sym; + { + if ((flags & BSF_GLOBAL) != 0 + && (weaken || is_specified_symbol (name, weaken_specific_list))) + { + sym->flags &= ~ BSF_GLOBAL; + sym->flags |= BSF_WEAK; + } + + if (!undefined + && (flags & (BSF_GLOBAL | BSF_WEAK)) + && (is_specified_symbol (name, localize_specific_list) + || (keepglobal_specific_list != NULL + && ! is_specified_symbol (name, keepglobal_specific_list)))) + { + sym->flags &= ~ (BSF_GLOBAL | BSF_WEAK); + sym->flags |= BSF_LOCAL; + } + + if (!undefined + && (flags & BSF_LOCAL) + && is_specified_symbol (name, globalize_specific_list)) + { + sym->flags &= ~ BSF_LOCAL; + sym->flags |= BSF_GLOBAL; + } + + to[dst_count++] = sym; + } } to[dst_count] = NULL; @@ -1067,10 +1114,10 @@ add_redefine_syms_file (const char *filename) continue; } else - fatal (_("%s: garbage at end of line %d"), filename, lineno); + fatal (_("%s:%d: garbage found at end of line"), filename, lineno); comment: if (len != 0 && (outsym_off == 0 || outsym_off == len)) - fatal (_("%s: missing new symbol name at line %d"), filename, lineno); + fatal (_("%s:%d: missing new symbol name"), filename, lineno); buf[len++] = '\0'; /* Eat the rest of the line and finish it. */ @@ -1080,11 +1127,79 @@ add_redefine_syms_file (const char *filename) } if (len != 0) - fatal (_("%s: premature end of file at line %d"), filename, lineno); + fatal (_("%s:%d: premature end of file"), filename, lineno); free (buf); } +/* Copy unkown object file IBFD onto OBFD. + Returns TRUE upon success, FALSE otherwise. */ + +static bfd_boolean +copy_unknown_object (bfd *ibfd, bfd *obfd) +{ + char *cbuf; + int tocopy; + long ncopied; + long size; + struct stat buf; + + if (bfd_stat_arch_elt (ibfd, &buf) != 0) + { + bfd_nonfatal (bfd_get_archive_filename (ibfd)); + return FALSE; + } + + size = buf.st_size; + if (size < 0) + { + non_fatal (_("stat returns negative size for `%s'"), + bfd_get_archive_filename (ibfd)); + return FALSE; + } + + if (bfd_seek (ibfd, (file_ptr) 0, SEEK_SET) != 0) + { + bfd_nonfatal (bfd_get_archive_filename (ibfd)); + return FALSE; + } + + if (verbose) + printf (_("copy from `%s' [unknown] to `%s' [unknown]\n"), + bfd_get_archive_filename (ibfd), bfd_get_filename (obfd)); + + cbuf = xmalloc (BUFSIZE); + ncopied = 0; + while (ncopied < size) + { + tocopy = size - ncopied; + if (tocopy > BUFSIZE) + tocopy = BUFSIZE; + + if (bfd_bread (cbuf, (bfd_size_type) tocopy, ibfd) + != (bfd_size_type) tocopy) + { + bfd_nonfatal (bfd_get_archive_filename (ibfd)); + free (cbuf); + return FALSE; + } + + if (bfd_bwrite (cbuf, (bfd_size_type) tocopy, obfd) + != (bfd_size_type) tocopy) + { + bfd_nonfatal (bfd_get_filename (obfd)); + free (cbuf); + return FALSE; + } + + ncopied += tocopy; + } + + chmod (bfd_get_filename (obfd), buf.st_mode); + free (cbuf); + return TRUE; +} + /* Copy object file IBFD onto OBFD. Returns TRUE upon success, FALSE otherwise. */ @@ -1114,8 +1229,8 @@ copy_object (bfd *ibfd, bfd *obfd) } if (verbose) - printf (_("copy from %s(%s) to %s(%s)\n"), - bfd_get_filename (ibfd), bfd_get_target (ibfd), + printf (_("copy from `%s' [%s] to `%s' [%s]\n"), + bfd_get_archive_filename (ibfd), bfd_get_target (ibfd), bfd_get_filename (obfd), bfd_get_target (obfd)); if (set_start_set) @@ -1138,7 +1253,7 @@ copy_object (bfd *ibfd, bfd *obfd) if (!bfd_set_start_address (obfd, start) || !bfd_set_file_flags (obfd, flags)) { - bfd_nonfatal (bfd_get_filename (ibfd)); + bfd_nonfatal (bfd_get_archive_filename (ibfd)); return FALSE; } } @@ -1151,20 +1266,18 @@ copy_object (bfd *ibfd, bfd *obfd) || bfd_get_arch (ibfd) != bfd_get_arch (obfd))) { if (bfd_get_arch (ibfd) == bfd_arch_unknown) - fatal (_("Unable to recognise the format of the input file %s"), - bfd_get_filename (ibfd)); + non_fatal (_("Unable to recognise the format of the input file `%s'"), + bfd_get_archive_filename (ibfd)); else - { - non_fatal (_("Warning: Output file cannot represent architecture %s"), - bfd_printable_arch_mach (bfd_get_arch (ibfd), - bfd_get_mach (ibfd))); - return FALSE; - } + non_fatal (_("Warning: Output file cannot represent architecture `%s'"), + bfd_printable_arch_mach (bfd_get_arch (ibfd), + bfd_get_mach (ibfd))); + return FALSE; } if (!bfd_set_format (obfd, bfd_get_format (ibfd))) { - bfd_nonfatal (bfd_get_filename (ibfd)); + bfd_nonfatal (bfd_get_archive_filename (ibfd)); return FALSE; } @@ -1174,10 +1287,15 @@ copy_object (bfd *ibfd, bfd *obfd) if (osympp != isympp) free (osympp); + isympp = NULL; + osympp = NULL; + /* BFD mandates that all output sections be created and sizes set before any output is done. Thus, we traverse all sections multiple times. */ bfd_map_over_sections (ibfd, setup_section, obfd); + setup_bfd_headers (ibfd, obfd); + if (add_sections != NULL) { struct section_add *padd; @@ -1187,30 +1305,33 @@ copy_object (bfd *ibfd, bfd *obfd) { flagword flags; - padd->section = bfd_make_section (obfd, padd->name); - if (padd->section == NULL) - { - non_fatal (_("can't create section `%s': %s"), - padd->name, bfd_errmsg (bfd_get_error ())); - return FALSE; - } - - if (! bfd_set_section_size (obfd, padd->section, padd->size)) - { - bfd_nonfatal (bfd_get_filename (obfd)); - return FALSE; - } - pset = find_section_list (padd->name, FALSE); if (pset != NULL) pset->used = TRUE; + flags = SEC_HAS_CONTENTS | SEC_READONLY | SEC_DATA; if (pset != NULL && pset->set_flags) flags = pset->flags | SEC_HAS_CONTENTS; - else - flags = SEC_HAS_CONTENTS | SEC_READONLY | SEC_DATA; - if (! bfd_set_section_flags (obfd, padd->section, flags)) + /* bfd_make_section_with_flags() does not return very helpful + error codes, so check for the most likely user error first. */ + if (bfd_get_section_by_name (obfd, padd->name)) + { + non_fatal (_("can't add section '%s' - it already exists!"), padd->name); + return FALSE; + } + else + { + padd->section = bfd_make_section_with_flags (obfd, padd->name, flags); + if (padd->section == NULL) + { + non_fatal (_("can't create section `%s': %s"), + padd->name, bfd_errmsg (bfd_get_error ())); + return FALSE; + } + } + + if (! bfd_set_section_size (obfd, padd->section, padd->size)) { bfd_nonfatal (bfd_get_filename (obfd)); return FALSE; @@ -1252,6 +1373,49 @@ copy_object (bfd *ibfd, bfd *obfd) bfd_nonfatal (gnu_debuglink_filename); return FALSE; } + + /* Special processing for PE format files. We + have no way to distinguish PE from COFF here. */ + if (bfd_get_flavour (obfd) == bfd_target_coff_flavour) + { + bfd_vma debuglink_vma; + asection * highest_section; + asection * sec; + + /* The PE spec requires that all sections be adjacent and sorted + in ascending order of VMA. It also specifies that debug + sections should be last. This is despite the fact that debug + sections are not loaded into memory and so in theory have no + use for a VMA. + + This means that the debuglink section must be given a non-zero + VMA which makes it contiguous with other debug sections. So + walk the current section list, find the section with the + highest VMA and start the debuglink section after that one. */ + for (sec = obfd->sections, highest_section = NULL; + sec != NULL; + sec = sec->next) + if (sec->vma > 0 + && (highest_section == NULL + || sec->vma > highest_section->vma)) + highest_section = sec; + + if (highest_section) + debuglink_vma = BFD_ALIGN (highest_section->vma + + highest_section->size, + /* FIXME: We ought to be using + COFF_PAGE_SIZE here or maybe + bfd_get_section_alignment() (if it + was set) but since this is for PE + and we know the required alignment + it is easier just to hard code it. */ + 0x1000); + else + /* Umm, not sure what to do in this case. */ + debuglink_vma = 0x1000; + + bfd_set_section_vma (obfd, gnu_debuglink_section, debuglink_vma); + } } if (bfd_count_sections (obfd) == 0) @@ -1348,7 +1512,7 @@ copy_object (bfd *ibfd, bfd *obfd) symsize = bfd_get_symtab_upper_bound (ibfd); if (symsize < 0) { - bfd_nonfatal (bfd_get_filename (ibfd)); + bfd_nonfatal (bfd_get_archive_filename (ibfd)); return FALSE; } @@ -1371,6 +1535,7 @@ copy_object (bfd *ibfd, bfd *obfd) || strip_specific_list != NULL || keep_specific_list != NULL || localize_specific_list != NULL + || globalize_specific_list != NULL || keepglobal_specific_list != NULL || weaken_specific_list != NULL || prefix_symbols_string @@ -1502,9 +1667,21 @@ copy_object (bfd *ibfd, bfd *obfd) /* Switch to the alternate machine code. We have to do this at the very end, because we only initialize the header when we create the first section. */ - if (use_alt_mach_code != 0 - && ! bfd_alt_mach_code (obfd, use_alt_mach_code)) - non_fatal (_("unknown alternate machine code, ignored")); + if (use_alt_mach_code != 0) + { + if (! bfd_alt_mach_code (obfd, use_alt_mach_code)) + { + non_fatal (_("this target does not support %lu alternative machine codes"), + use_alt_mach_code); + if (bfd_get_flavour (obfd) == bfd_target_elf_flavour) + { + non_fatal (_("treating that number as an absolute e_machine value instead")); + elf_elfheader (obfd)->e_machine = use_alt_mach_code; + } + else + non_fatal (_("ignoring the alternative value")); + } + } return TRUE; } @@ -1589,19 +1766,42 @@ copy_archive (bfd *ibfd, bfd *obfd, const char *output_target) l = xmalloc (sizeof (struct name_list)); l->name = output_name; l->next = list; + l->obfd = NULL; list = l; if (output_bfd == NULL) RETURN_NONFATAL (output_name); if (bfd_check_format (this_element, bfd_object)) - delete = ! copy_object (this_element, output_bfd); - - if (!bfd_close (output_bfd)) { - bfd_nonfatal (bfd_get_filename (output_bfd)); - /* Error in new object file. Don't change archive. */ - status = 1; + delete = ! copy_object (this_element, output_bfd); + + if (! delete + || bfd_get_arch (this_element) != bfd_arch_unknown) + { + if (!bfd_close (output_bfd)) + { + bfd_nonfatal (bfd_get_filename (output_bfd)); + /* Error in new object file. Don't change archive. */ + status = 1; + } + } + else + goto copy_unknown_element; + } + else + { + non_fatal (_("Unable to recognise the format of the input file `%s'"), + bfd_get_archive_filename (this_element)); + +copy_unknown_element: + delete = !copy_unknown_object (this_element, output_bfd); + if (!bfd_close_all_done (output_bfd)) + { + bfd_nonfatal (bfd_get_filename (output_bfd)); + /* Error in new object file. Don't change archive. */ + status = 1; + } } if (delete) @@ -1663,6 +1863,7 @@ copy_file (const char *input_filename, const char *output_filename, if (get_file_size (input_filename) < 1) { + non_fatal (_("error: the input file '%s' is empty"), input_filename); status = 1; return; } @@ -1691,7 +1892,6 @@ copy_file (const char *input_filename, const char *output_filename, else if (bfd_check_format_matches (ibfd, bfd_object, &obj_matching)) { bfd *obfd; - bfd_boolean delete; do_copy: /* bfd_get_target does not return the correct value until @@ -1703,7 +1903,8 @@ copy_file (const char *input_filename, const char *output_filename, if (obfd == NULL) RETURN_NONFATAL (output_filename); - delete = ! copy_object (ibfd, obfd); + if (! copy_object (ibfd, obfd)) + status = 1; if (!bfd_close (obfd)) RETURN_NONFATAL (output_filename); @@ -1711,11 +1912,6 @@ copy_file (const char *input_filename, const char *output_filename, if (!bfd_close (ibfd)) RETURN_NONFATAL (input_filename); - if (delete) - { - unlink (output_filename); - status = 1; - } } else { @@ -1808,6 +2004,32 @@ find_section_rename (bfd * ibfd ATTRIBUTE_UNUSED, sec_ptr isection, return old_name; } +/* Once each of the sections is copied, we may still need to do some + finalization work for private section headers. Do that here. */ + +static void +setup_bfd_headers (bfd *ibfd, bfd *obfd) +{ + const char *err; + + /* Allow the BFD backend to copy any private data it understands + from the input section to the output section. */ + if (! bfd_copy_private_header_data (ibfd, obfd)) + { + err = _("private header data"); + goto loser; + } + + /* All went well. */ + return; + +loser: + non_fatal (_("%s: error in %s: %s"), + bfd_get_filename (ibfd), + err, bfd_errmsg (bfd_get_error ())); + status = 1; +} + /* Create a section in OBFD with the same name and attributes as ISECTION in IBFD. */ @@ -1852,7 +2074,12 @@ setup_section (bfd *ibfd, sec_ptr isection, void *obfdarg) name = n; } - osection = bfd_make_section_anyway (obfd, name); + if (p != NULL && p->set_flags) + flags = p->flags | (flags & (SEC_HAS_CONTENTS | SEC_RELOC)); + else if (strip_symbols == STRIP_NONDEBUG && (flags & SEC_ALLOC) != 0) + flags &= ~(SEC_HAS_CONTENTS | SEC_LOAD); + + osection = bfd_make_section_anyway_with_flags (obfd, name, flags); if (osection == NULL) { @@ -1860,6 +2087,12 @@ setup_section (bfd *ibfd, sec_ptr isection, void *obfdarg) goto loser; } + if (strip_symbols == STRIP_NONDEBUG + && obfd->xvec->flavour == bfd_target_elf_flavour + && (flags & SEC_ALLOC) != 0 + && (p == NULL || !p->set_flags)) + elf_section_type (osection) = SHT_NOBITS; + size = bfd_section_size (ibfd, isection); if (copy_byte >= 0) size = (size + interleave - 1) / interleave; @@ -1908,21 +2141,6 @@ setup_section (bfd *ibfd, sec_ptr isection, void *obfdarg) goto loser; } - if (p != NULL && p->set_flags) - flags = p->flags | (flags & (SEC_HAS_CONTENTS | SEC_RELOC)); - else if (strip_symbols == STRIP_NONDEBUG && (flags & SEC_ALLOC) != 0) - { - flags &= ~(SEC_HAS_CONTENTS | SEC_LOAD); - if (obfd->xvec->flavour == bfd_target_elf_flavour) - elf_section_type (osection) = SHT_NOBITS; - } - - if (!bfd_set_section_flags (obfd, osection, flags)) - { - err = _("flags"); - goto loser; - } - /* Copy merge entity size. */ osection->entsize = isection->entsize; @@ -1985,7 +2203,7 @@ copy_section (bfd *ibfd, sec_ptr isection, void *obfdarg) return; osection = isection->output_section; - size = bfd_get_section_size_before_reloc (isection); + size = bfd_get_section_size (isection); if (size == 0 || osection == 0) return; @@ -2041,9 +2259,6 @@ copy_section (bfd *ibfd, sec_ptr isection, void *obfdarg) free (relpp); } - isection->_cooked_size = isection->_raw_size; - isection->reloc_done = TRUE; - if (bfd_get_section_flags (ibfd, isection) & SEC_HAS_CONTENTS && bfd_get_section_flags (obfd, osection) & SEC_HAS_CONTENTS) { @@ -2135,9 +2350,9 @@ compare_section_lma (const void *arg1, const void *arg2) return -1; /* Sort sections with the same LMA by size. */ - if ((*sec1)->_raw_size > (*sec2)->_raw_size) + if (bfd_get_section_size (*sec1) > bfd_get_section_size (*sec2)) return 1; - else if ((*sec1)->_raw_size < (*sec2)->_raw_size) + else if (bfd_get_section_size (*sec1) < bfd_get_section_size (*sec2)) return -1; return 0; @@ -2207,28 +2422,22 @@ write_debugging_info (bfd *obfd, void *dhandle, bfd_byte *syms, *strings; bfd_size_type symsize, stringsize; asection *stabsec, *stabstrsec; + flagword flags; if (! write_stabs_in_sections_debugging_info (obfd, dhandle, &syms, &symsize, &strings, &stringsize)) return FALSE; - stabsec = bfd_make_section (obfd, ".stab"); - stabstrsec = bfd_make_section (obfd, ".stabstr"); + flags = SEC_HAS_CONTENTS | SEC_READONLY | SEC_DEBUGGING; + stabsec = bfd_make_section_with_flags (obfd, ".stab", flags); + stabstrsec = bfd_make_section_with_flags (obfd, ".stabstr", flags); if (stabsec == NULL || stabstrsec == NULL || ! bfd_set_section_size (obfd, stabsec, symsize) || ! bfd_set_section_size (obfd, stabstrsec, stringsize) || ! bfd_set_section_alignment (obfd, stabsec, 2) - || ! bfd_set_section_alignment (obfd, stabstrsec, 0) - || ! bfd_set_section_flags (obfd, stabsec, - (SEC_HAS_CONTENTS - | SEC_READONLY - | SEC_DEBUGGING)) - || ! bfd_set_section_flags (obfd, stabstrsec, - (SEC_HAS_CONTENTS - | SEC_READONLY - | SEC_DEBUGGING))) + || ! bfd_set_section_alignment (obfd, stabstrsec, 0)) { non_fatal (_("%s: can't create debugging section: %s"), bfd_get_filename (obfd), @@ -2330,6 +2539,9 @@ strip_main (int argc, char *argv[]) case OPTION_ONLY_KEEP_DEBUG: strip_symbols = STRIP_NONDEBUG; break; + case OPTION_KEEP_FILE_SYMBOLS: + keep_file_symbols = 1; + break; case 0: /* We've been given a long option. */ break; @@ -2397,7 +2609,7 @@ strip_main (int argc, char *argv[]) status = hold_status; } else - unlink (tmpname); + unlink_if_ordinary (tmpname); if (output_file == NULL) free (tmpname); } @@ -2487,6 +2699,10 @@ copy_main (int argc, char *argv[]) strip_symbols = STRIP_NONDEBUG; break; + case OPTION_KEEP_FILE_SYMBOLS: + keep_file_symbols = 1; + break; + case OPTION_ADD_GNU_DEBUGLINK: gnu_debuglink_filename = optarg; break; @@ -2499,10 +2715,18 @@ copy_main (int argc, char *argv[]) add_specific_symbol (optarg, &strip_specific_list); break; + case OPTION_STRIP_UNNEEDED_SYMBOL: + add_specific_symbol (optarg, &strip_unneeded_list); + break; + case 'L': add_specific_symbol (optarg, &localize_specific_list); break; + case OPTION_GLOBALIZE_SYMBOL: + add_specific_symbol (optarg, &globalize_specific_list); + break; + case 'G': add_specific_symbol (optarg, &keepglobal_specific_list); break; @@ -2832,6 +3056,10 @@ copy_main (int argc, char *argv[]) add_specific_symbols (optarg, &strip_specific_list); break; + case OPTION_STRIP_UNNEEDED_SYMBOLS: + add_specific_symbols (optarg, &strip_unneeded_list); + break; + case OPTION_KEEP_SYMBOLS: add_specific_symbols (optarg, &keep_specific_list); break; @@ -2840,6 +3068,10 @@ copy_main (int argc, char *argv[]) add_specific_symbols (optarg, &localize_specific_list); break; + case OPTION_GLOBALIZE_SYMBOLS: + add_specific_symbols (optarg, &globalize_specific_list); + break; + case OPTION_KEEPGLOBAL_SYMBOLS: add_specific_symbols (optarg, &keepglobal_specific_list); break; @@ -2849,9 +3081,9 @@ copy_main (int argc, char *argv[]) break; case OPTION_ALT_MACH_CODE: - use_alt_mach_code = atoi (optarg); - if (use_alt_mach_code <= 0) - fatal (_("alternate machine code index must be positive")); + use_alt_mach_code = strtoul (optarg, NULL, 0); + if (use_alt_mach_code == 0) + fatal (_("unable to parse alternative machine code")); break; case OPTION_PREFIX_SYMBOLS: @@ -2975,6 +3207,8 @@ copy_main (int argc, char *argv[]) if (status == 0 && preserve_dates) set_times (output_filename, &statbuf); + else if (status != 0) + unlink_if_ordinary (output_filename); } if (change_warn) @@ -3034,6 +3268,8 @@ main (int argc, char *argv[]) START_PROGRESS (program_name, 0); + expandargv (&argc, &argv); + strip_symbols = STRIP_UNDEF; discard_locals = LOCALS_UNDEF; diff --git a/contrib/binutils/binutils/objdump.c b/contrib/binutils/binutils/objdump.c index f67aacb8881..6e5eab56da2 100644 --- a/contrib/binutils/binutils/objdump.c +++ b/contrib/binutils/binutils/objdump.c @@ -1,6 +1,6 @@ /* objdump.c -- dump information about an object file. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003 + 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* Objdump overview. @@ -52,6 +52,7 @@ #include "bfdver.h" #include "progress.h" #include "bucomm.h" +#include "dwarf.h" #include "budemang.h" #include "getopt.h" #include "safe-ctype.h" @@ -65,11 +66,6 @@ #define BYTES_IN_WORD 32 #include "aout/aout64.h" -#ifdef NEED_DECLARATION_FPRINTF -/* This is needed by init_disassemble_info(). */ -extern int fprintf (FILE *, const char *, ...); -#endif - /* Exit status. */ static int exit_status = 0; @@ -91,6 +87,7 @@ static int prefix_addresses; /* --prefix-addresses */ static int with_line_numbers; /* -l */ static bfd_boolean with_source_code; /* -S */ static int show_raw_insn; /* --show-raw-insn */ +static int dump_dwarf_section_info; /* --dwarf */ static int dump_stab_section_info; /* --stabs */ static int do_demangle; /* -C, --demangle */ static bfd_boolean disassemble; /* -d */ @@ -102,6 +99,7 @@ static bfd_vma start_address = (bfd_vma) -1; /* --start-address */ static bfd_vma stop_address = (bfd_vma) -1; /* --stop-address */ static int dump_debugging; /* --debugging */ static int dump_debugging_tags; /* --debugging-tags */ +static int dump_special_syms = 0; /* --special-syms */ static bfd_vma adjust_section_vma = 0; /* --adjust-vma */ static int file_start_context = 0; /* --file-start-context */ @@ -127,6 +125,7 @@ struct objdump_disasm_info arelent ** dynrelbuf; long dynrelcount; disassembler_ftype disassemble_fn; + arelent * reloc; }; /* Architecture to disassemble for, or default if NULL. */ @@ -153,6 +152,10 @@ static long sorted_symcount = 0; /* The dynamic symbol table. */ static asymbol **dynsyms; +/* The synthetic symbol table. */ +static asymbol *synthsyms; +static long synthcount = 0; + /* Number of symbols in `dynsyms'. */ static long dynsymcount = 0; @@ -181,10 +184,12 @@ usage (FILE *stream, int status) -g, --debugging Display debug information in object file\n\ -e, --debugging-tags Display debug information using ctags style\n\ -G, --stabs Display (in raw form) any STABS info in the file\n\ + -W, --dwarf Display DWARF info in the 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\ + @ Read options from \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\ @@ -213,6 +218,7 @@ usage (FILE *stream, int status) --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\ + --special-syms Include special symbols in symbol dumps\n\ \n")); list_supported_targets (program_name, stream); list_supported_architectures (program_name, stream); @@ -264,7 +270,9 @@ static struct option long_options[]= {"section-headers", no_argument, NULL, 'h'}, {"show-raw-insn", no_argument, &show_raw_insn, 1}, {"source", no_argument, NULL, 'S'}, + {"special-syms", no_argument, &dump_special_syms, 1}, {"include", required_argument, NULL, 'I'}, + {"dwarf", no_argument, NULL, 'W'}, {"stabs", no_argument, NULL, 'G'}, {"start-address", required_argument, NULL, OPTION_START_ADDRESS}, {"stop-address", required_argument, NULL, OPTION_STOP_ADDRESS}, @@ -283,12 +291,17 @@ nonfatal (const char *msg) } static void -dump_section_header (bfd *abfd ATTRIBUTE_UNUSED, asection *section, +dump_section_header (bfd *abfd, asection *section, void *ignored ATTRIBUTE_UNUSED) { char *comma = ""; unsigned int opb = bfd_octets_per_byte (abfd); + /* Ignore linker created section. See elfNN_ia64_object_p in + bfd/elfxx-ia64.c. */ + if (section->flags & SEC_LINKER_CREATED) + return; + printf ("%3d %-13s %08lx ", section->index, bfd_get_section_name (abfd, section), (unsigned long) bfd_section_size (abfd, section) / opb); @@ -317,16 +330,21 @@ dump_section_header (bfd *abfd ATTRIBUTE_UNUSED, asection *section, PF (SEC_NEVER_LOAD, "NEVER_LOAD"); PF (SEC_EXCLUDE, "EXCLUDE"); PF (SEC_SORT_ENTRIES, "SORT_ENTRIES"); - PF (SEC_BLOCK, "BLOCK"); - PF (SEC_CLINK, "CLINK"); + if (bfd_get_arch (abfd) == bfd_arch_tic54x) + { + PF (SEC_TIC54X_BLOCK, "BLOCK"); + PF (SEC_TIC54X_CLINK, "CLINK"); + } PF (SEC_SMALL_DATA, "SMALL_DATA"); - PF (SEC_SHARED, "SHARED"); - PF (SEC_ARCH_BIT_0, "ARCH_BIT_0"); + if (bfd_get_flavour (abfd) == bfd_target_coff_flavour) + PF (SEC_COFF_SHARED, "SHARED"); PF (SEC_THREAD_LOCAL, "THREAD_LOCAL"); + PF (SEC_GROUP, "GROUP"); if ((section->flags & SEC_LINK_ONCE) != 0) { const char *ls; + struct coff_comdat_info *comdat; switch (section->flags & SEC_LINK_DUPLICATES) { @@ -347,9 +365,9 @@ dump_section_header (bfd *abfd ATTRIBUTE_UNUSED, asection *section, } printf ("%s%s", comma, ls); - if (section->comdat != NULL) - printf (" (COMDAT %s %ld)", section->comdat->name, - section->comdat->symbol); + comdat = bfd_coff_get_comdat_section (abfd, section); + if (comdat != NULL) + printf (" (COMDAT %s %ld)", comdat->name, comdat->symbol); comma = ", "; } @@ -450,7 +468,7 @@ remove_useless_symbols (asymbol **symbols, long count) if (sym->name == NULL || sym->name[0] == '\0') continue; - if (sym->flags & (BSF_DEBUGGING)) + if (sym->flags & (BSF_DEBUGGING | BSF_SECTION_SYM)) continue; if (bfd_is_und_section (sym->section) || bfd_is_com_section (sym->section)) @@ -840,7 +858,8 @@ objdump_print_addr (bfd_vma vma, bfd_boolean skip_zeroes) { struct objdump_disasm_info *aux; - asymbol *sym; + asymbol *sym = NULL; /* Initialize to avoid compiler warning. */ + bfd_boolean skip_find = FALSE; if (sorted_symcount < 1) { @@ -850,7 +869,23 @@ objdump_print_addr (bfd_vma vma, } aux = (struct objdump_disasm_info *) info->application_data; - sym = find_symbol_for_address (vma, info, NULL); + + if (aux->reloc != NULL + && aux->reloc->sym_ptr_ptr != NULL + && * aux->reloc->sym_ptr_ptr != NULL) + { + sym = * aux->reloc->sym_ptr_ptr; + + /* Adjust the vma to the reloc. */ + vma += bfd_asymbol_value (sym); + + if (bfd_is_und_section (bfd_get_section (sym))) + skip_find = TRUE; + } + + if (!skip_find) + sym = find_symbol_for_address (vma, info, NULL); + objdump_print_addr_with_sym (aux->abfd, aux->sec, sym, vma, info, skip_zeroes); } @@ -864,7 +899,7 @@ objdump_print_address (bfd_vma vma, struct disassemble_info *info) objdump_print_addr (vma, info, ! prefix_addresses); } -/* Determine of the given address has a symbol associated with it. */ +/* Determine if the given address has a symbol associated with it. */ static int objdump_symbol_at_address (bfd_vma vma, struct disassemble_info * info) @@ -1142,48 +1177,34 @@ show_line (bfd *abfd, asection *section, bfd_vma addr_offset) typedef struct { char *buffer; - size_t size; - char *current; + size_t pos; + size_t alloc; } SFILE; /* sprintf to a "stream". */ -static int +static int ATTRIBUTE_PRINTF_2 objdump_sprintf (SFILE *f, const char *format, ...) { - char *buf; size_t n; va_list args; - va_start (args, format); - - vasprintf (&buf, format, args); - - if (buf == NULL) + while (1) { + size_t space = f->alloc - f->pos; + + va_start (args, format); + n = vsnprintf (f->buffer + f->pos, space, format, args); va_end (args); - fatal (_("Out of virtual memory")); + + if (space > n) + break; + + f->alloc = (f->alloc + n) * 2; + f->buffer = xrealloc (f->buffer, f->alloc); } - - n = strlen (buf); - - while ((size_t) ((f->buffer + f->size) - f->current) < n + 1) - { - size_t curroff; - - curroff = f->current - f->buffer; - f->size *= 2; - f->buffer = xrealloc (f->buffer, f->size); - f->current = f->buffer + curroff; - } - - memcpy (f->current, buf, n); - f->current += n; - f->current[0] = '\0'; - - free (buf); - - va_end (args); + f->pos += n; + return n; } @@ -1208,9 +1229,7 @@ process_section_p (asection * section) /* The number of zeroes we want to see before we start skipping them. The number is arbitrarily chosen. */ -#ifndef SKIP_ZEROES -#define SKIP_ZEROES (8) -#endif +#define DEFAULT_SKIP_ZEROES 8 /* The number of zeroes to skip at the end of a section. If the number of zeroes at the end is between SKIP_ZEROES_AT_END and @@ -1219,9 +1238,7 @@ process_section_p (asection * section) attempt to avoid disassembling zeroes inserted by section alignment. */ -#ifndef SKIP_ZEROES_AT_END -#define SKIP_ZEROES_AT_END (3) -#endif +#define DEFAULT_SKIP_ZEROES_AT_END 3 /* Disassemble some data in memory between given values. */ @@ -1242,11 +1259,19 @@ disassemble_bytes (struct disassemble_info * info, bfd_boolean done_dot; int skip_addr_chars; bfd_vma addr_offset; - int opb = info->octets_per_byte; + unsigned int opb = info->octets_per_byte; + unsigned int skip_zeroes = info->skip_zeroes; + unsigned int skip_zeroes_at_end = info->skip_zeroes_at_end; + int octets = opb; + SFILE sfile; aux = (struct objdump_disasm_info *) info->application_data; section = aux->sec; + sfile.alloc = 120; + sfile.buffer = xmalloc (sfile.alloc); + sfile.pos = 0; + if (insns) octets_per_line = 4; else @@ -1282,8 +1307,12 @@ disassemble_bytes (struct disassemble_info * info, while (addr_offset < stop_offset) { bfd_vma z; - int octets = 0; bfd_boolean need_nl = FALSE; + int previous_octets; + + /* Remember the length of the previous instruction. */ + previous_octets = octets; + octets = 0; /* If we see more than SKIP_ZEROES octets of zeroes, we just print `...'. */ @@ -1293,9 +1322,9 @@ disassemble_bytes (struct disassemble_info * info, if (! disassemble_zeroes && (info->insn_info_valid == 0 || info->branch_delay_insns == 0) - && (z - addr_offset * opb >= SKIP_ZEROES + && (z - addr_offset * opb >= skip_zeroes || (z == stop_offset * opb && - z - addr_offset * opb < SKIP_ZEROES_AT_END))) + z - addr_offset * opb < skip_zeroes_at_end))) { printf ("\t...\n"); @@ -1311,17 +1340,13 @@ disassemble_bytes (struct disassemble_info * info, else { char buf[50]; - SFILE sfile; int bpc = 0; int pb = 0; done_dot = FALSE; if (with_line_numbers || with_source_code) - /* The line number tables will refer to unadjusted - section VMAs, so we must undo any VMA modifications - when calling show_line. */ - show_line (aux->abfd, section, addr_offset - adjust_section_vma); + show_line (aux->abfd, section, addr_offset); if (! prefix_addresses) { @@ -1344,25 +1369,44 @@ disassemble_bytes (struct disassemble_info * info, if (insns) { - sfile.size = 120; - sfile.buffer = xmalloc (sfile.size); - sfile.current = sfile.buffer; + sfile.pos = 0; info->fprintf_func = (fprintf_ftype) objdump_sprintf; - info->stream = (FILE *) &sfile; + info->stream = &sfile; info->bytes_per_line = 0; info->bytes_per_chunk = 0; + info->flags = 0; -#ifdef DISASSEMBLER_NEEDS_RELOCS - /* FIXME: This is wrong. It tests the number of octets - in the last instruction, not the current one. */ - if (*relppp < relppend - && (**relppp)->address >= rel_offset + addr_offset - && ((**relppp)->address - < rel_offset + addr_offset + octets / opb)) - info->flags = INSN_HAS_RELOC; - else -#endif - info->flags = 0; + if (info->disassembler_needs_relocs + && *relppp < relppend) + { + bfd_signed_vma distance_to_rel; + + distance_to_rel = (**relppp)->address + - (rel_offset + addr_offset); + + /* Check to see if the current reloc is associated with + the instruction that we are about to disassemble. */ + if (distance_to_rel == 0 + /* FIXME: This is wrong. We are trying to catch + relocs that are addressed part way through the + current instruction, as might happen with a packed + VLIW instruction. Unfortunately we do not know the + length of the current instruction since we have not + disassembled it yet. Instead we take a guess based + upon the length of the previous instruction. The + proper solution is to have a new target-specific + disassembler function which just returns the length + of an instruction at a given address without trying + to display its disassembly. */ + || (distance_to_rel > 0 + && distance_to_rel < (bfd_signed_vma) (previous_octets/ opb))) + { + info->flags = INSN_HAS_RELOC; + aux->reloc = **relppp; + } + else + aux->reloc = NULL; + } octets = (*disassemble_fn) (section->vma + addr_offset, info); info->fprintf_func = (fprintf_ftype) fprintf; @@ -1371,9 +1415,8 @@ disassemble_bytes (struct disassemble_info * info, octets_per_line = info->bytes_per_line; if (octets < 0) { - if (sfile.current != sfile.buffer) + if (sfile.pos) printf ("%s\n", sfile.buffer); - free (sfile.buffer); break; } } @@ -1415,6 +1458,7 @@ disassemble_bytes (struct disassemble_info * info, for (j = addr_offset * opb; j < addr_offset * opb + pb; j += bpc) { int k; + if (bpc > 1 && info->display_endian == BFD_ENDIAN_LITTLE) { for (k = bpc - 1; k >= 0; k--) @@ -1447,11 +1491,8 @@ disassemble_bytes (struct disassemble_info * info, if (! insns) printf ("%s", buf); - else - { - printf ("%s", sfile.buffer); - free (sfile.buffer); - } + else if (sfile.pos) + printf ("%s", sfile.buffer); if (prefix_addresses ? show_raw_insn > 0 @@ -1518,7 +1559,12 @@ disassemble_bytes (struct disassemble_info * info, objdump_print_value (section->vma - rel_offset + q->address, info, TRUE); - printf (": %s\t", q->howto->name); + if (q->howto == NULL) + printf (": *unknown*\t"); + else if (q->howto->name) + printf (": %s\t", q->howto->name); + else + printf (": %d\t", q->howto->type); if (q->sym_ptr_ptr == NULL || *q->sym_ptr_ptr == NULL) printf ("*unknown*"); @@ -1558,6 +1604,8 @@ disassemble_bytes (struct disassemble_info * info, addr_offset += octets / opb; } + + free (sfile.buffer); } static void @@ -1582,13 +1630,14 @@ disassemble_section (bfd *abfd, asection *section, void *info) code are not normally disassembled. */ if (! disassemble_all && only == NULL - && (section->flags & SEC_CODE) == 0) + && ((section->flags & (SEC_CODE | SEC_HAS_CONTENTS)) + != (SEC_CODE | SEC_HAS_CONTENTS))) return; if (! process_section_p (section)) return; - datasize = bfd_get_section_size_before_reloc (section); + datasize = bfd_get_section_size (section); if (datasize == 0) return; @@ -1610,10 +1659,7 @@ disassemble_section (bfd *abfd, asection *section, void *info) rel_offset = 0; if ((section->flags & SEC_RELOC) != 0 -#ifndef DISASSEMBLER_NEEDS_RELOCS - && dump_reloc_info -#endif - ) + && (dump_reloc_info || pinfo->disassembler_needs_relocs)) { long relsize; @@ -1789,6 +1835,7 @@ disassemble_data (bfd *abfd) { struct disassemble_info disasm_info; struct objdump_disasm_info aux; + long i; print_files = NULL; prev_functionname = NULL; @@ -1796,10 +1843,18 @@ disassemble_data (bfd *abfd) /* We make a copy of syms to sort. We don't want to sort syms because that will screw up the relocs. */ - sorted_syms = xmalloc (symcount * sizeof (asymbol *)); - memcpy (sorted_syms, syms, symcount * sizeof (asymbol *)); + sorted_symcount = symcount ? symcount : dynsymcount; + sorted_syms = xmalloc ((sorted_symcount + synthcount) * sizeof (asymbol *)); + memcpy (sorted_syms, symcount ? syms : dynsyms, + sorted_symcount * sizeof (asymbol *)); - sorted_symcount = remove_useless_symbols (sorted_syms, symcount); + sorted_symcount = remove_useless_symbols (sorted_syms, sorted_symcount); + + for (i = 0; i < synthcount; ++i) + { + sorted_syms[sorted_symcount] = synthsyms + i; + ++sorted_symcount; + } /* Sort the symbols into section and symbol order. */ qsort (sorted_syms, sorted_symcount, sizeof (asymbol *), compare_symbols); @@ -1811,6 +1866,7 @@ disassemble_data (bfd *abfd) aux.require_sec = FALSE; aux.dynrelbuf = NULL; aux.dynrelcount = 0; + aux.reloc = NULL; disasm_info.print_address_func = objdump_print_address; disasm_info.symbol_at_address_func = objdump_symbol_at_address; @@ -1850,6 +1906,9 @@ disassemble_data (bfd *abfd) disasm_info.mach = bfd_get_mach (abfd); disasm_info.disassembler_options = disassembler_options; disasm_info.octets_per_byte = bfd_octets_per_byte (abfd); + disasm_info.skip_zeroes = DEFAULT_SKIP_ZEROES; + disasm_info.skip_zeroes_at_end = DEFAULT_SKIP_ZEROES_AT_END; + disasm_info.disassembler_needs_relocs = FALSE; if (bfd_big_endian (abfd)) disasm_info.display_endian = disasm_info.endian = BFD_ENDIAN_BIG; @@ -1894,6 +1953,163 @@ disassemble_data (bfd *abfd) free (sorted_syms); } +int +load_debug_section (enum dwarf_section_display_enum debug, void *file) +{ + struct dwarf_section *section = &debug_displays [debug].section; + bfd *abfd = file; + asection *sec; + bfd_boolean ret; + + /* If it is already loaded, do nothing. */ + if (section->start != NULL) + return 1; + + /* Locate the debug section. */ + sec = bfd_get_section_by_name (abfd, section->name); + if (sec == NULL) + return 0; + + section->address = bfd_get_section_vma (abfd, sec); + section->size = bfd_get_section_size (sec); + section->start = xmalloc (section->size); + + if (is_relocatable && debug_displays [debug].relocate) + ret = bfd_simple_get_relocated_section_contents (abfd, + sec, + section->start, + syms) != NULL; + else + ret = bfd_get_section_contents (abfd, sec, section->start, 0, + section->size); + + if (!ret) + { + free_debug_section (debug); + printf (_("\nCan't get contents for section '%s'.\n"), + section->name); + } + + return ret; +} + +void +free_debug_section (enum dwarf_section_display_enum debug) +{ + struct dwarf_section *section = &debug_displays [debug].section; + + if (section->start == NULL) + return; + + free ((char *) section->start); + section->start = NULL; + section->address = 0; + section->size = 0; +} + +static void +dump_dwarf_section (bfd *abfd, asection *section, + void *arg ATTRIBUTE_UNUSED) +{ + const char *name = bfd_get_section_name (abfd, section); + const char *match; + enum dwarf_section_display_enum i; + + if (strncmp (name, ".gnu.linkonce.wi.", 17) == 0) + match = ".debug_info"; + else + match = name; + + for (i = 0; i < max; i++) + if (strcmp (debug_displays[i].section.name, match) == 0) + { + if (!debug_displays[i].eh_frame) + { + struct dwarf_section *sec = &debug_displays [i].section; + + if (load_debug_section (i, abfd)) + { + debug_displays[i].display (sec, abfd); + + if (i != info && i != abbrev) + free_debug_section (i); + } + } + break; + } +} + +static const char *mach_o_dwarf_sections [] = { + "LC_SEGMENT.__DWARFA.__debug_abbrev", /* .debug_abbrev */ + "LC_SEGMENT.__DWARFA.__debug_aranges", /* .debug_aranges */ + "LC_SEGMENT.__DWARFA.__debug_frame", /* .debug_frame */ + "LC_SEGMENT.__DWARFA.__debug_info", /* .debug_info */ + "LC_SEGMENT.__DWARFA.__debug_line", /* .debug_line */ + "LC_SEGMENT.__DWARFA.__debug_pubnames", /* .debug_pubnames */ + ".eh_frame", /* .eh_frame */ + "LC_SEGMENT.__DWARFA.__debug_macinfo", /* .debug_macinfo */ + "LC_SEGMENT.__DWARFA.__debug_str", /* .debug_str */ + "LC_SEGMENT.__DWARFA.__debug_loc", /* .debug_loc */ + "LC_SEGMENT.__DWARFA.__debug_pubtypes", /* .debug_pubtypes */ + "LC_SEGMENT.__DWARFA.__debug_ranges", /* .debug_ranges */ + "LC_SEGMENT.__DWARFA.__debug_static_func", /* .debug_static_func */ + "LC_SEGMENT.__DWARFA.__debug_static_vars", /* .debug_static_vars */ + "LC_SEGMENT.__DWARFA.__debug_types", /* .debug_types */ + "LC_SEGMENT.__DWARFA.__debug_weaknames" /* .debug_weaknames */ +}; + +static const char *generic_dwarf_sections [max]; + +static void +check_mach_o_dwarf (bfd *abfd) +{ + static enum bfd_flavour old_flavour = bfd_target_unknown_flavour; + enum bfd_flavour current_flavour = bfd_get_flavour (abfd); + enum dwarf_section_display_enum i; + + if (generic_dwarf_sections [0] == NULL) + for (i = 0; i < max; i++) + generic_dwarf_sections [i] = debug_displays[i].section.name; + + if (old_flavour != current_flavour) + { + if (current_flavour == bfd_target_mach_o_flavour) + for (i = 0; i < max; i++) + debug_displays[i].section.name = mach_o_dwarf_sections [i]; + else if (old_flavour == bfd_target_mach_o_flavour) + for (i = 0; i < max; i++) + debug_displays[i].section.name = generic_dwarf_sections [i]; + + old_flavour = current_flavour; + } +} + +/* Dump the dwarf debugging information. */ + +static void +dump_dwarf (bfd *abfd) +{ + is_relocatable = ((abfd->flags & (HAS_RELOC | EXEC_P | DYNAMIC)) + == HAS_RELOC); + + /* FIXME: bfd_get_arch_size may return -1. We assume that 64bit + targets will return 64. */ + eh_addr_size = bfd_get_arch_size (abfd) == 64 ? 8 : 4; + + if (bfd_big_endian (abfd)) + byte_get = byte_get_big_endian; + else if (bfd_little_endian (abfd)) + byte_get = byte_get_little_endian; + else + abort (); + + check_mach_o_dwarf (abfd); + + bfd_map_over_sections (abfd, dump_dwarf_section, NULL); + + free_debug_memory (); +} + /* Read ABFD's stabs section STABSECT_NAME, and return a pointer to it. Return NULL on failure. */ @@ -2048,7 +2264,8 @@ find_stabs_section (bfd *abfd, asection *section, void *names) if (strtab) { - stabs = read_section_stabs (abfd, section->name, &stab_size); + stabs = (bfd_byte *) read_section_stabs (abfd, section->name, + &stab_size); if (stabs) print_section_stabs (abfd, section->name, &sought->string_offset); } @@ -2275,13 +2492,15 @@ dump_symbols (bfd *abfd ATTRIBUTE_UNUSED, bfd_boolean dynamic) bfd *cur_bfd; if (*current == NULL) - printf (_("no information for the %ld'th symbol"), count); + printf (_("no information for symbol number %ld\n"), count); else if ((cur_bfd = bfd_asymbol_bfd (*current)) == NULL) - printf (_("could not determine the type of the %ld'th symbol"), + printf (_("could not determine the type of symbol number %ld\n"), count); - else + else if (process_section_p ((* current)->section) + && (dump_special_syms + || !bfd_is_target_special_symbol (cur_bfd, *current))) { const char *name = (*current)->name; @@ -2302,9 +2521,9 @@ dump_symbols (bfd *abfd ATTRIBUTE_UNUSED, bfd_boolean dynamic) else bfd_print_symbol (cur_bfd, stdout, *current, bfd_print_symbol_all); + printf ("\n"); } - printf ("\n"); current++; } printf ("\n\n"); @@ -2393,23 +2612,20 @@ dump_reloc_set (bfd *abfd, asection *sec, arelent **relpp, long relcount) section_name = NULL; } + bfd_printf_vma (abfd, q->address); + if (q->howto == NULL) + printf (" *unknown* "); + else if (q->howto->name) + printf (" %-16s ", q->howto->name); + else + printf (" %-16d ", q->howto->type); if (sym_name) - { - bfd_printf_vma (abfd, q->address); - if (q->howto->name) - printf (" %-16s ", q->howto->name); - else - printf (" %-16d ", q->howto->type); - objdump_print_symname (abfd, NULL, *q->sym_ptr_ptr); - } + objdump_print_symname (abfd, NULL, *q->sym_ptr_ptr); else { if (section_name == NULL) section_name = "*unknown*"; - bfd_printf_vma (abfd, q->address); - printf (" %-16s [%s]", - q->howto->name, - section_name); + printf ("[%s]", section_name); } if (q->addend) @@ -2526,10 +2742,15 @@ add_include_path (const char *path) static void adjust_addresses (bfd *abfd ATTRIBUTE_UNUSED, asection *section, - void *dummy ATTRIBUTE_UNUSED) + void *arg) { - section->vma += adjust_section_vma; - section->lma += adjust_section_vma; + if ((section->flags & SEC_DEBUGGING) == 0) + { + bfd_boolean *has_reloc_p = (bfd_boolean *) arg; + section->vma += adjust_section_vma; + if (*has_reloc_p) + section->lma += adjust_section_vma; + } } /* Dump selected contents of ABFD. */ @@ -2541,7 +2762,10 @@ dump_bfd (bfd *abfd) the BFD information is a hack. However, we must do it, or bfd_find_nearest_line will not do the right thing. */ if (adjust_section_vma != 0) - bfd_map_over_sections (abfd, adjust_addresses, NULL); + { + bfd_boolean has_reloc = (abfd->flags & HAS_RELOC); + bfd_map_over_sections (abfd, adjust_addresses, &has_reloc); + } if (! dump_debugging_tags) printf (_("\n%s: file format %s\n"), bfd_get_filename (abfd), @@ -2557,15 +2781,29 @@ dump_bfd (bfd *abfd) if (dump_section_headers) dump_headers (abfd); - if (dump_symtab || dump_reloc_info || disassemble || dump_debugging) + if (dump_symtab + || dump_reloc_info + || disassemble + || dump_debugging + || dump_dwarf_section_info) syms = slurp_symtab (abfd); - if (dump_dynamic_symtab || dump_dynamic_reloc_info) + if (dump_dynamic_symtab || dump_dynamic_reloc_info + || (disassemble && bfd_get_dynamic_symtab_upper_bound (abfd) > 0)) dynsyms = slurp_dynamic_symtab (abfd); + if (disassemble) + { + synthcount = bfd_get_synthetic_symtab (abfd, symcount, syms, + dynsymcount, dynsyms, &synthsyms); + if (synthcount < 0) + synthcount = 0; + } if (dump_symtab) dump_symbols (abfd, FALSE); if (dump_dynamic_symtab) dump_symbols (abfd, TRUE); + if (dump_dwarf_section_info) + dump_dwarf (abfd); if (dump_stab_section_info) dump_stabs (abfd); if (dump_reloc_info && ! disassemble) @@ -2605,6 +2843,16 @@ dump_bfd (bfd *abfd) free (dynsyms); dynsyms = NULL; } + + if (synthsyms) + { + free (synthsyms); + synthsyms = NULL; + } + + symcount = 0; + dynsymcount = 0; + synthcount = 0; } static void @@ -2719,10 +2967,12 @@ main (int argc, char **argv) START_PROGRESS (program_name, 0); + expandargv (&argc, &argv); + bfd_init (); set_default_bfd_target (); - while ((c = getopt_long (argc, argv, "pib:m:M:VvCdDlfaHhrRtTxsSI:j:wE:zgeG", + while ((c = getopt_long (argc, argv, "pib:m:M:VvCdDlfaHhrRtTxsSI:j:wE:zgeGW", long_options, (int *) 0)) != EOF) { @@ -2863,6 +3113,20 @@ main (int argc, char **argv) do_demangle = TRUE; seenflag = TRUE; break; + case 'W': + dump_dwarf_section_info = TRUE; + seenflag = TRUE; + do_debug_info = 1; + do_debug_abbrevs = 1; + do_debug_lines = 1; + do_debug_pubnames = 1; + do_debug_aranges = 1; + do_debug_ranges = 1; + do_debug_frames = 1; + do_debug_macinfo = 1; + do_debug_str = 1; + do_debug_loc = 1; + break; case 'G': dump_stab_section_info = TRUE; seenflag = TRUE; diff --git a/contrib/binutils/binutils/po/Make-in b/contrib/binutils/binutils/po/Make-in index 6176dbf78c3..be09b4cd788 100644 --- a/contrib/binutils/binutils/po/Make-in +++ b/contrib/binutils/binutils/po/Make-in @@ -1,7 +1,8 @@ # Makefile for program source directory in GNU NLS utilities package. # Copyright (C) 1995, 1996, 1997 by Ulrich Drepper +# Copyright 2003, 2006 Free Software Foundation, Inc. # -# This file file be copied and used freely without restrictions. It can +# This file may 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. @@ -109,6 +110,7 @@ $(srcdir)/stamp-cat-id: $(PACKAGE).pot install: install-exec install-data install-exec: install-info: +install-html: install-data: install-data-@USE_NLS@ install-data-no: all install-data-yes: all @@ -184,7 +186,7 @@ check: all cat-id-tbl.o: ../intl/libgettext.h -dvi info tags TAGS ID: +html dvi pdf ps info tags TAGS ID: mostlyclean: rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp diff --git a/contrib/binutils/binutils/po/POTFILES.in b/contrib/binutils/binutils/po/POTFILES.in index 9e9e6a59677..d3f6cb3fa7c 100644 --- a/contrib/binutils/binutils/po/POTFILES.in +++ b/contrib/binutils/binutils/po/POTFILES.in @@ -19,6 +19,7 @@ debug.h dlltool.c dlltool.h dllwrap.c +dwarf.c emul_aix.c emul_vanilla.c filemode.c diff --git a/contrib/binutils/binutils/po/binutils.pot b/contrib/binutils/binutils/po/binutils.pot index 73c60b3e0e2..5e5a4dc7f22 100644 --- a/contrib/binutils/binutils/po/binutils.pot +++ b/contrib/binutils/binutils/po/binutils.pot @@ -7,7 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2003-07-11 13:56+0930\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2005-10-25 09:14+0930\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -15,26 +16,31 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: addr2line.c:74 +#: addr2line.c:76 #, c-format msgid "Usage: %s [option(s)] [addr(s)]\n" msgstr "" -#: addr2line.c:75 +#: addr2line.c:77 +#, c-format msgid " Convert addresses into line number/file name pairs.\n" msgstr "" -#: addr2line.c:76 +#: addr2line.c:78 +#, c-format msgid "" " If no addresses are specified on the command line, they will be read from " "stdin\n" msgstr "" -#: addr2line.c:77 +#: addr2line.c:79 +#, c-format msgid "" " The options are:\n" +" @ Read options from \n" " -b --target= Set the binary file format\n" " -e --exe= Set the input file name (default is a.out)\n" +" -i --inlines\t\t Unwind inlined functions\n" " -s --basenames Strip directory names\n" " -f --functions Show function names\n" " -C --demangle[=style] Demangle function names\n" @@ -43,1341 +49,2161 @@ msgid "" "\n" msgstr "" -#: addr2line.c:89 ar.c:297 coffdump.c:479 nlmconv.c:1121 objcopy.c:484 -#: objcopy.c:518 readelf.c:2649 size.c:104 srconv.c:1962 strings.c:673 -#: sysdump.c:774 windres.c:702 +#: addr2line.c:93 ar.c:263 coffdump.c:466 nlmconv.c:1113 objcopy.c:486 +#: objcopy.c:520 readelf.c:2622 size.c:102 srconv.c:1732 strings.c:725 +#: sysdump.c:648 windres.c:673 #, c-format msgid "Report bugs to %s\n" msgstr "" -#: addr2line.c:245 +#: addr2line.c:253 #, c-format msgid "%s: can not get addresses from archive" msgstr "" -#: addr2line.c:317 nm.c:433 objdump.c:2693 +#: addr2line.c:325 nm.c:1523 objdump.c:3033 #, c-format msgid "unknown demangling style `%s'" msgstr "" -#: ar.c:238 +#: ar.c:203 #, c-format msgid "no entry %s in archive\n" msgstr "" -#: ar.c:255 +#: ar.c:219 #, c-format msgid "" "Usage: %s [emulation options] [-]{dmpqrstx}[abcfilNoPsSuvV] [member-name] " "[count] archive-file file...\n" msgstr "" -#: ar.c:258 +#: ar.c:222 #, c-format msgid " %s -M [ - read options from \n" +msgstr "" + +#: ar.c:252 #, c-format msgid "Usage: %s [options] archive\n" msgstr "" -#: ar.c:288 +#: ar.c:253 +#, c-format msgid " Generate an index to speed access to archives\n" msgstr "" -#: ar.c:289 +#: ar.c:254 +#, c-format msgid "" " The options are:\n" +" @ Read options from \n" " -h --help Print this help message\n" " -V --version Print version information\n" msgstr "" -#: ar.c:512 +#: ar.c:485 msgid "two different operation options specified" msgstr "" -#: ar.c:587 +#: ar.c:560 #, c-format msgid "illegal option -- %c" msgstr "" -#: ar.c:619 +#: ar.c:606 msgid "no operation specified" msgstr "" -#: ar.c:622 +#: ar.c:609 msgid "`u' is only meaningful with the `r' option." msgstr "" -#: ar.c:632 +#: ar.c:617 msgid "`N' is only meaningful with the `x' and `d' options." msgstr "" -#: ar.c:635 +#: ar.c:620 msgid "Value for `N' must be positive." msgstr "" -#: ar.c:718 +#: ar.c:670 #, c-format msgid "internal error -- this option not implemented" msgstr "" -#: ar.c:837 ar.c:888 ar.c:1333 objcopy.c:1579 -#, c-format -msgid "internal stat error on %s" -msgstr "" - -#: ar.c:841 -#, c-format -msgid "" -"\n" -"\n" -"\n" -msgstr "" - -#: ar.c:857 ar.c:925 -#, c-format -msgid "%s is not a valid archive" -msgstr "" - -#: ar.c:893 -#, c-format -msgid "stat returns negative size for %s" -msgstr "" - -#: ar.c:1020 -#, c-format -msgid "%s is not an archive" -msgstr "" - -#: ar.c:1027 +#: ar.c:739 #, c-format msgid "creating %s" msgstr "" -#: ar.c:1233 +#: ar.c:788 ar.c:838 ar.c:1156 objcopy.c:1683 +#, c-format +msgid "internal stat error on %s" +msgstr "" + +#: ar.c:792 +#, c-format +msgid "" +"\n" +"<%s>\n" +"\n" +msgstr "" + +#: ar.c:808 ar.c:875 +#, c-format +msgid "%s is not a valid archive" +msgstr "" + +#: ar.c:843 +#, c-format +msgid "stat returns negative size for %s" +msgstr "" + +#: ar.c:1061 #, c-format msgid "No member named `%s'\n" msgstr "" -#: ar.c:1285 +#: ar.c:1111 #, c-format msgid "no entry %s in archive %s!" msgstr "" -#: ar.c:1422 +#: ar.c:1248 #, c-format msgid "%s: no archive map to update" msgstr "" -#: arsup.c:86 +#: arsup.c:87 #, c-format msgid "No entry %s in archive.\n" msgstr "" -#: arsup.c:117 +#: arsup.c:112 #, c-format msgid "Can't open file %s\n" msgstr "" -#: arsup.c:172 +#: arsup.c:162 #, c-format msgid "%s: Can't open output archive %s\n" msgstr "" -#: arsup.c:189 +#: arsup.c:179 #, c-format msgid "%s: Can't open input archive %s\n" msgstr "" -#: arsup.c:198 +#: arsup.c:188 #, c-format msgid "%s: file %s is not an archive\n" msgstr "" -#: arsup.c:241 +#: arsup.c:227 #, c-format msgid "%s: no output archive specified yet\n" msgstr "" -#: arsup.c:262 arsup.c:301 arsup.c:343 arsup.c:364 arsup.c:430 +#: arsup.c:247 arsup.c:285 arsup.c:327 arsup.c:347 arsup.c:413 #, c-format msgid "%s: no open output archive\n" msgstr "" -#: arsup.c:273 arsup.c:385 arsup.c:411 +#: arsup.c:258 arsup.c:368 arsup.c:394 #, c-format msgid "%s: can't open file %s\n" msgstr "" -#: arsup.c:328 arsup.c:407 arsup.c:489 +#: arsup.c:312 arsup.c:390 arsup.c:471 #, c-format msgid "%s: can't find module file %s\n" msgstr "" -#: arsup.c:439 +#: arsup.c:422 #, c-format msgid "Current open archive is %s\n" msgstr "" -#: arsup.c:464 +#: arsup.c:446 #, c-format msgid "%s: no open archive\n" msgstr "" -#: binemul.c:39 +#: binemul.c:37 #, c-format msgid " No emulation specific options\n" msgstr "" #. Macros for common output. -#: binemul.h:52 +#: binemul.h:40 #, c-format msgid " emulation options: \n" msgstr "" -#: bucomm.c:113 +#: bucomm.c:110 #, c-format msgid "can't set BFD default target to `%s': %s" msgstr "" -#: bucomm.c:125 +#: bucomm.c:121 #, c-format msgid "%s: Matching formats:" msgstr "" -#: bucomm.c:142 +#: bucomm.c:136 +#, c-format msgid "Supported targets:" msgstr "" -#: bucomm.c:144 +#: bucomm.c:138 #, c-format msgid "%s: supported targets:" msgstr "" -#: bucomm.c:162 +#: bucomm.c:154 +#, c-format msgid "Supported architectures:" msgstr "" -#: bucomm.c:164 +#: bucomm.c:156 #, c-format msgid "%s: supported architectures:" msgstr "" -#: bucomm.c:360 +#: bucomm.c:349 #, c-format msgid "BFD header file version %s\n" msgstr "" -#: bucomm.c:467 +#: bucomm.c:450 #, c-format msgid "%s: bad number: %s" msgstr "" -#: coffdump.c:107 +#: bucomm.c:467 strings.c:438 +#, c-format +msgid "'%s': No such file" +msgstr "" + +#: bucomm.c:469 strings.c:440 +#, c-format +msgid "Warning: could not locate '%s'. reason: %s" +msgstr "" + +#: bucomm.c:473 +#, c-format +msgid "Warning: '%s' is not an ordinary file" +msgstr "" + +#: coffdump.c:103 #, c-format msgid "#lines %d " msgstr "" -#: coffdump.c:471 sysdump.c:767 +#: coffdump.c:457 sysdump.c:641 #, c-format msgid "Usage: %s [option(s)] in-file\n" msgstr "" -#: coffdump.c:472 +#: coffdump.c:458 +#, c-format msgid " Print a human readable interpretation of a SYSROFF object file\n" msgstr "" -#: coffdump.c:473 +#: coffdump.c:459 +#, c-format msgid "" " The options are:\n" +" @ Read options from \n" " -h --help Display this information\n" " -v --version Display the program's version\n" "\n" msgstr "" -#: coffdump.c:541 srconv.c:2052 sysdump.c:831 +#: coffdump.c:528 srconv.c:1822 sysdump.c:705 msgid "no input file specified" msgstr "" -#: debug.c:654 +#: debug.c:648 msgid "debug_add_to_current_namespace: no current file" msgstr "" -#: debug.c:737 +#: debug.c:727 msgid "debug_start_source: no debug_set_filename call" msgstr "" -#: debug.c:796 +#: debug.c:783 msgid "debug_record_function: no debug_set_filename call" msgstr "" -#: debug.c:852 +#: debug.c:835 msgid "debug_record_parameter: no current function" msgstr "" -#: debug.c:886 +#: debug.c:867 msgid "debug_end_function: no current function" msgstr "" -#: debug.c:892 +#: debug.c:873 msgid "debug_end_function: some blocks were not closed" msgstr "" -#: debug.c:922 +#: debug.c:901 msgid "debug_start_block: no current block" msgstr "" -#: debug.c:960 +#: debug.c:937 msgid "debug_end_block: no current block" msgstr "" -#: debug.c:967 +#: debug.c:944 msgid "debug_end_block: attempt to close top level block" msgstr "" -#: debug.c:993 +#: debug.c:967 msgid "debug_record_line: no current unit" msgstr "" #. FIXME -#: debug.c:1047 +#: debug.c:1020 msgid "debug_start_common_block: not implemented" msgstr "" #. FIXME -#: debug.c:1059 +#: debug.c:1031 msgid "debug_end_common_block: not implemented" msgstr "" #. FIXME. -#: debug.c:1153 +#: debug.c:1115 msgid "debug_record_label: not implemented" msgstr "" -#: debug.c:1179 +#: debug.c:1137 msgid "debug_record_variable: no current file" msgstr "" -#: debug.c:1762 +#: debug.c:1665 msgid "debug_make_undefined_type: unsupported kind" msgstr "" -#: debug.c:1963 +#: debug.c:1842 msgid "debug_name_type: no current file" msgstr "" -#: debug.c:2011 +#: debug.c:1887 msgid "debug_tag_type: no current file" msgstr "" -#: debug.c:2019 +#: debug.c:1895 msgid "debug_tag_type: extra tag attempted" msgstr "" -#: debug.c:2058 +#: debug.c:1932 #, c-format msgid "Warning: changing type size from %d to %d\n" msgstr "" -#: debug.c:2082 +#: debug.c:1954 msgid "debug_find_named_type: no current compilation unit" msgstr "" -#: debug.c:2189 +#: debug.c:2057 #, c-format msgid "debug_get_real_type: circular debug information for %s\n" msgstr "" -#: debug.c:2650 +#: debug.c:2484 msgid "debug_write_type: illegal type encountered" msgstr "" -#: dlltool.c:812 dlltool.c:837 dlltool.c:863 +#: dlltool.c:765 dlltool.c:789 dlltool.c:818 #, c-format msgid "Internal error: Unknown machine type: %d" msgstr "" -#: dlltool.c:900 +#: dlltool.c:854 #, c-format msgid "Can't open def file: %s" msgstr "" -#: dlltool.c:905 +#: dlltool.c:859 #, c-format msgid "Processing def file: %s" msgstr "" -#: dlltool.c:909 +#: dlltool.c:863 msgid "Processed def file" msgstr "" -#: dlltool.c:935 +#: dlltool.c:887 #, c-format msgid "Syntax error in def file %s:%d" msgstr "" -#: dlltool.c:974 +#: dlltool.c:922 +#, c-format +msgid "%s: Path components stripped from image name, '%s'." +msgstr "" + +#: dlltool.c:931 #, c-format msgid "NAME: %s base: %x" msgstr "" -#: dlltool.c:977 dlltool.c:996 +#: dlltool.c:934 dlltool.c:950 msgid "Can't have LIBRARY and NAME" msgstr "" -#: dlltool.c:993 +#: dlltool.c:947 #, c-format msgid "LIBRARY: %s base: %x" msgstr "" -#: dlltool.c:1251 resrc.c:271 +#: dlltool.c:1183 resrc.c:269 #, c-format msgid "wait: %s" msgstr "" -#: dlltool.c:1256 dllwrap.c:430 resrc.c:276 +#: dlltool.c:1188 dllwrap.c:413 resrc.c:274 #, c-format msgid "subprocess got fatal signal %d" msgstr "" -#: dlltool.c:1262 dllwrap.c:437 resrc.c:283 +#: dlltool.c:1194 dllwrap.c:420 resrc.c:281 #, c-format msgid "%s exited with status %d" msgstr "" -#: dlltool.c:1294 +#: dlltool.c:1225 #, c-format msgid "Sucking in info from %s section in %s" msgstr "" -#: dlltool.c:1423 +#: dlltool.c:1350 #, c-format msgid "Excluding symbol: %s" msgstr "" -#: dlltool.c:1518 dlltool.c:1529 nm.c:1004 nm.c:1015 +#: dlltool.c:1439 dlltool.c:1450 nm.c:1000 nm.c:1011 #, c-format msgid "%s: no symbols" msgstr "" #. FIXME: we ought to read in and block out the base relocations. -#: dlltool.c:1556 +#: dlltool.c:1476 #, c-format msgid "Done reading %s" msgstr "" -#: dlltool.c:1567 +#: dlltool.c:1486 #, c-format msgid "Unable to open object file: %s" msgstr "" -#: dlltool.c:1570 +#: dlltool.c:1489 #, c-format msgid "Scanning object file %s" msgstr "" -#: dlltool.c:1585 +#: dlltool.c:1504 #, c-format msgid "Cannot produce mcore-elf dll from archive file: %s" msgstr "" -#: dlltool.c:1677 +#: dlltool.c:1590 msgid "Adding exports to output file" msgstr "" -#: dlltool.c:1724 +#: dlltool.c:1638 msgid "Added exports to output file" msgstr "" -#: dlltool.c:1848 +#: dlltool.c:1759 #, c-format msgid "Generating export file: %s" msgstr "" -#: dlltool.c:1853 +#: dlltool.c:1764 #, c-format msgid "Unable to open temporary assembler file: %s" msgstr "" -#: dlltool.c:1856 +#: dlltool.c:1767 #, c-format msgid "Opened temporary file: %s" msgstr "" -#: dlltool.c:2086 +#: dlltool.c:1989 msgid "Generated exports file" msgstr "" -#: dlltool.c:2378 +#: dlltool.c:2195 #, c-format msgid "bfd_open failed open stub file: %s" msgstr "" -#: dlltool.c:2381 +#: dlltool.c:2198 #, c-format msgid "Creating stub file: %s" msgstr "" -#: dlltool.c:2766 +#: dlltool.c:2580 #, c-format msgid "failed to open temporary head file: %s" msgstr "" -#: dlltool.c:2825 +#: dlltool.c:2639 #, c-format msgid "failed to open temporary tail file: %s" msgstr "" -#: dlltool.c:2892 +#: dlltool.c:2706 #, c-format msgid "Can't open .lib file: %s" msgstr "" -#: dlltool.c:2895 +#: dlltool.c:2709 #, c-format msgid "Creating library file: %s" msgstr "" -#: dlltool.c:2951 +#: dlltool.c:2792 dlltool.c:2798 #, c-format msgid "cannot delete %s: %s" msgstr "" -#: dlltool.c:2955 +#: dlltool.c:2803 msgid "Created lib file" msgstr "" -#: dlltool.c:3062 +#: dlltool.c:2882 #, c-format msgid "Warning, ignoring duplicate EXPORT %s %d,%d" msgstr "" -#: dlltool.c:3068 +#: dlltool.c:2888 #, c-format msgid "Error, duplicate EXPORT with oridinals: %s" msgstr "" -#: dlltool.c:3191 +#: dlltool.c:2993 msgid "Processing definitions" msgstr "" -#: dlltool.c:3223 +#: dlltool.c:3025 msgid "Processed definitions" msgstr "" #. xgetext:c-format -#: dlltool.c:3234 dllwrap.c:495 +#: dlltool.c:3032 dllwrap.c:474 #, c-format msgid "Usage %s \n" msgstr "" #. xgetext:c-format -#: dlltool.c:3236 +#: dlltool.c:3034 #, c-format msgid "" " -m --machine Create as DLL for . [default: %s]\n" msgstr "" -#: dlltool.c:3237 +#: dlltool.c:3035 +#, c-format msgid "" " possible : arm[_interwork], i386, mcore[-elf]{-le|-be}, " "ppc, thumb\n" msgstr "" -#: dlltool.c:3238 +#: dlltool.c:3036 +#, c-format msgid " -e --output-exp Generate an export file.\n" msgstr "" -#: dlltool.c:3239 +#: dlltool.c:3037 +#, c-format msgid " -l --output-lib Generate an interface library.\n" msgstr "" -#: dlltool.c:3240 +#: dlltool.c:3038 +#, c-format msgid " -a --add-indirect Add dll indirects to export file.\n" msgstr "" -#: dlltool.c:3241 +#: dlltool.c:3039 +#, c-format msgid "" " -D --dllname Name of input dll to put into interface lib.\n" msgstr "" -#: dlltool.c:3242 +#: dlltool.c:3040 +#, c-format msgid " -d --input-def Name of .def file to be read in.\n" msgstr "" -#: dlltool.c:3243 +#: dlltool.c:3041 +#, c-format msgid " -z --output-def Name of .def file to be created.\n" msgstr "" -#: dlltool.c:3244 +#: dlltool.c:3042 +#, c-format msgid " --export-all-symbols Export all symbols to .def\n" msgstr "" -#: dlltool.c:3245 +#: dlltool.c:3043 +#, c-format msgid " --no-export-all-symbols Only export listed symbols\n" msgstr "" -#: dlltool.c:3246 +#: dlltool.c:3044 +#, c-format msgid " --exclude-symbols Don't export \n" msgstr "" -#: dlltool.c:3247 +#: dlltool.c:3045 +#, c-format msgid " --no-default-excludes Clear default exclude symbols\n" msgstr "" -#: dlltool.c:3248 +#: dlltool.c:3046 +#, c-format msgid " -b --base-file Read linker generated base file.\n" msgstr "" -#: dlltool.c:3249 +#: dlltool.c:3047 +#, c-format msgid " -x --no-idata4 Don't generate idata$4 section.\n" msgstr "" -#: dlltool.c:3250 +#: dlltool.c:3048 +#, c-format msgid " -c --no-idata5 Don't generate idata$5 section.\n" msgstr "" -#: dlltool.c:3251 +#: dlltool.c:3049 +#, c-format msgid "" " -U --add-underscore Add underscores to symbols in interface " "library.\n" msgstr "" -#: dlltool.c:3252 +#: dlltool.c:3050 +#, c-format msgid " -k --kill-at Kill @ from exported names.\n" msgstr "" -#: dlltool.c:3253 +#: dlltool.c:3051 +#, c-format msgid " -A --add-stdcall-alias Add aliases without @.\n" msgstr "" -#: dlltool.c:3254 +#: dlltool.c:3052 +#, c-format +msgid " -p --ext-prefix-alias Add aliases with .\n" +msgstr "" + +#: dlltool.c:3053 +#, c-format msgid " -S --as Use for assembler.\n" msgstr "" -#: dlltool.c:3255 +#: dlltool.c:3054 +#, c-format msgid " -f --as-flags Pass to the assembler.\n" msgstr "" -#: dlltool.c:3256 +#: dlltool.c:3055 +#, c-format msgid "" " -C --compat-implib Create backward compatible import library.\n" msgstr "" -#: dlltool.c:3257 +#: dlltool.c:3056 +#, c-format msgid "" " -n --no-delete Keep temp files (repeat for extra " "preservation).\n" msgstr "" -#: dlltool.c:3258 +#: dlltool.c:3057 +#, c-format +msgid "" +" -t --temp-prefix Use to construct temp file names.\n" +msgstr "" + +#: dlltool.c:3058 +#, c-format msgid " -v --verbose Be verbose.\n" msgstr "" -#: dlltool.c:3259 +#: dlltool.c:3059 +#, c-format msgid " -V --version Display the program version.\n" msgstr "" -#: dlltool.c:3260 +#: dlltool.c:3060 +#, c-format msgid " -h --help Display this information.\n" msgstr "" -#: dlltool.c:3262 +#: dlltool.c:3061 +#, c-format +msgid " @ Read options from .\n" +msgstr "" + +#: dlltool.c:3063 +#, c-format msgid "" " -M --mcore-elf Process mcore-elf object files into .\n" msgstr "" -#: dlltool.c:3263 +#: dlltool.c:3064 +#, c-format msgid " -L --linker Use as the linker.\n" msgstr "" -#: dlltool.c:3264 +#: dlltool.c:3065 +#, c-format msgid " -F --linker-flags Pass to the linker.\n" msgstr "" -#: dlltool.c:3418 +#: dlltool.c:3181 +#, c-format +msgid "Path components stripped from dllname, '%s'." +msgstr "" + +#: dlltool.c:3226 #, c-format msgid "Unable to open base-file: %s" msgstr "" -#: dlltool.c:3450 +#: dlltool.c:3258 #, c-format msgid "Machine '%s' not supported" msgstr "" -#: dlltool.c:3553 dllwrap.c:214 +#: dlltool.c:3362 dllwrap.c:204 #, c-format msgid "Tried file: %s" msgstr "" -#: dlltool.c:3560 dllwrap.c:221 +#: dlltool.c:3369 dllwrap.c:211 #, c-format msgid "Using file: %s" msgstr "" -#: dllwrap.c:308 +#: dllwrap.c:294 #, c-format msgid "Keeping temporary base file %s" msgstr "" -#: dllwrap.c:310 +#: dllwrap.c:296 #, c-format msgid "Deleting temporary base file %s" msgstr "" -#: dllwrap.c:324 +#: dllwrap.c:310 #, c-format msgid "Keeping temporary exp file %s" msgstr "" -#: dllwrap.c:326 +#: dllwrap.c:312 #, c-format msgid "Deleting temporary exp file %s" msgstr "" -#: dllwrap.c:339 +#: dllwrap.c:325 #, c-format msgid "Keeping temporary def file %s" msgstr "" -#: dllwrap.c:341 +#: dllwrap.c:327 #, c-format msgid "Deleting temporary def file %s" msgstr "" -#: dllwrap.c:496 +#: dllwrap.c:475 +#, c-format msgid " Generic options:\n" msgstr "" -#: dllwrap.c:497 +#: dllwrap.c:476 +#, c-format +msgid " @ Read options from \n" +msgstr "" + +#: dllwrap.c:477 +#, c-format msgid " --quiet, -q Work quietly\n" msgstr "" -#: dllwrap.c:498 +#: dllwrap.c:478 +#, c-format msgid " --verbose, -v Verbose\n" msgstr "" -#: dllwrap.c:499 +#: dllwrap.c:479 +#, c-format msgid " --version Print dllwrap version\n" msgstr "" -#: dllwrap.c:500 +#: dllwrap.c:480 +#, c-format msgid " --implib Synonym for --output-lib\n" msgstr "" -#: dllwrap.c:501 +#: dllwrap.c:481 #, c-format msgid " Options for %s:\n" msgstr "" -#: dllwrap.c:502 +#: dllwrap.c:482 +#, c-format msgid " --driver-name Defaults to \"gcc\"\n" msgstr "" -#: dllwrap.c:503 +#: dllwrap.c:483 +#, c-format msgid " --driver-flags Override default ld flags\n" msgstr "" -#: dllwrap.c:504 +#: dllwrap.c:484 +#, c-format msgid " --dlltool-name Defaults to \"dlltool\"\n" msgstr "" -#: dllwrap.c:505 +#: dllwrap.c:485 +#, c-format msgid " --entry Specify alternate DLL entry point\n" msgstr "" -#: dllwrap.c:506 +#: dllwrap.c:486 +#, c-format msgid " --image-base Specify image base address\n" msgstr "" -#: dllwrap.c:507 +#: dllwrap.c:487 +#, c-format msgid " --target i386-cygwin32 or i386-mingw32\n" msgstr "" -#: dllwrap.c:508 +#: dllwrap.c:488 +#, c-format msgid " --dry-run Show what needs to be run\n" msgstr "" -#: dllwrap.c:509 +#: dllwrap.c:489 +#, c-format msgid " --mno-cygwin Create Mingw DLL\n" msgstr "" -#: dllwrap.c:510 +#: dllwrap.c:490 +#, c-format msgid " Options passed to DLLTOOL:\n" msgstr "" -#: dllwrap.c:511 +#: dllwrap.c:491 +#, c-format msgid " --machine \n" msgstr "" -#: dllwrap.c:512 +#: dllwrap.c:492 +#, c-format msgid " --output-exp Generate export file.\n" msgstr "" -#: dllwrap.c:513 +#: dllwrap.c:493 +#, c-format msgid " --output-lib Generate input library.\n" msgstr "" -#: dllwrap.c:514 +#: dllwrap.c:494 +#, c-format msgid " --add-indirect Add dll indirects to export file.\n" msgstr "" -#: dllwrap.c:515 +#: dllwrap.c:495 +#, c-format msgid " --dllname Name of input dll to put into output lib.\n" msgstr "" -#: dllwrap.c:516 +#: dllwrap.c:496 +#, c-format msgid " --def Name input .def file\n" msgstr "" -#: dllwrap.c:517 +#: dllwrap.c:497 +#, c-format msgid " --output-def Name output .def file\n" msgstr "" -#: dllwrap.c:518 +#: dllwrap.c:498 +#, c-format msgid " --export-all-symbols Export all symbols to .def\n" msgstr "" -#: dllwrap.c:519 +#: dllwrap.c:499 +#, c-format msgid " --no-export-all-symbols Only export .drectve symbols\n" msgstr "" -#: dllwrap.c:520 +#: dllwrap.c:500 +#, c-format msgid " --exclude-symbols Exclude from .def\n" msgstr "" -#: dllwrap.c:521 +#: dllwrap.c:501 +#, c-format msgid " --no-default-excludes Zap default exclude symbols\n" msgstr "" -#: dllwrap.c:522 +#: dllwrap.c:502 +#, c-format msgid " --base-file Read linker generated base file\n" msgstr "" -#: dllwrap.c:523 +#: dllwrap.c:503 +#, c-format msgid " --no-idata4 Don't generate idata$4 section\n" msgstr "" -#: dllwrap.c:524 +#: dllwrap.c:504 +#, c-format msgid " --no-idata5 Don't generate idata$5 section\n" msgstr "" -#: dllwrap.c:525 +#: dllwrap.c:505 +#, c-format msgid " -U Add underscores to .lib\n" msgstr "" -#: dllwrap.c:526 +#: dllwrap.c:506 +#, c-format msgid " -k Kill @ from exported names\n" msgstr "" -#: dllwrap.c:527 +#: dllwrap.c:507 +#, c-format msgid " --add-stdcall-alias Add aliases without @\n" msgstr "" -#: dllwrap.c:528 +#: dllwrap.c:508 +#, c-format msgid " --as Use for assembler\n" msgstr "" -#: dllwrap.c:529 +#: dllwrap.c:509 +#, c-format msgid " --nodelete Keep temp files.\n" msgstr "" -#: dllwrap.c:530 +#: dllwrap.c:510 +#, c-format msgid " Rest are passed unmodified to the language driver\n" msgstr "" -#: dllwrap.c:802 +#: dllwrap.c:782 msgid "Must provide at least one of -o or --dllname options" msgstr "" -#: dllwrap.c:830 +#: dllwrap.c:811 msgid "" "no export definition file provided.\n" "Creating one, but that may not be what you want" msgstr "" -#: dllwrap.c:992 +#: dllwrap.c:970 #, c-format msgid "DLLTOOL name : %s\n" msgstr "" -#: dllwrap.c:993 +#: dllwrap.c:971 #, c-format msgid "DLLTOOL options : %s\n" msgstr "" -#: dllwrap.c:994 +#: dllwrap.c:972 #, c-format msgid "DRIVER name : %s\n" msgstr "" -#: dllwrap.c:995 +#: dllwrap.c:973 #, c-format msgid "DRIVER options : %s\n" msgstr "" -#: emul_aix.c:58 +#: dwarf.c:93 dwarf.c:137 readelf.c:322 readelf.c:515 +#, c-format +msgid "Unhandled data length: %d\n" +msgstr "" + +#: dwarf.c:237 +msgid "badly formed extended line op encountered!\n" +msgstr "" + +#: dwarf.c:244 +#, c-format +msgid " Extended opcode %d: " +msgstr "" + +#: dwarf.c:249 +#, c-format +msgid "" +"End of Sequence\n" +"\n" +msgstr "" + +#: dwarf.c:255 +#, c-format +msgid "set Address to 0x%lx\n" +msgstr "" + +#: dwarf.c:260 +#, c-format +msgid " define new File Table entry\n" +msgstr "" + +#: dwarf.c:261 dwarf.c:1944 +#, c-format +msgid " Entry\tDir\tTime\tSize\tName\n" +msgstr "" + +#: dwarf.c:263 +#, c-format +msgid " %d\t" +msgstr "" + +#: dwarf.c:266 dwarf.c:268 dwarf.c:270 dwarf.c:1956 dwarf.c:1958 dwarf.c:1960 +#, c-format +msgid "%lu\t" +msgstr "" + +#: dwarf.c:271 +#, c-format +msgid "" +"%s\n" +"\n" +msgstr "" + +#: dwarf.c:275 +#, c-format +msgid "UNKNOWN: length %d\n" +msgstr "" + +#: dwarf.c:288 +msgid "" +msgstr "" + +#: dwarf.c:294 +#, c-format +msgid "DW_FORM_strp offset too big: %lx\n" +msgstr "" + +#: dwarf.c:295 +msgid "" +msgstr "" + +#: dwarf.c:528 +#, c-format +msgid "Unknown TAG value: %lx" +msgstr "" + +#: dwarf.c:564 +#, c-format +msgid "Unknown FORM value: %lx" +msgstr "" + +#: dwarf.c:573 +#, c-format +msgid " %lu byte block: " +msgstr "" + +#: dwarf.c:907 +#, c-format +msgid "(User defined location op)" +msgstr "" + +#: dwarf.c:909 +#, c-format +msgid "(Unknown location op)" +msgstr "" + +#: dwarf.c:955 +msgid "Internal error: DWARF version is not 2 or 3.\n" +msgstr "" + +#: dwarf.c:1053 +msgid "DW_FORM_data8 is unsupported when sizeof (unsigned long) != 8\n" +msgstr "" + +#: dwarf.c:1102 +#, c-format +msgid " (indirect string, offset: 0x%lx): %s" +msgstr "" + +#: dwarf.c:1111 +#, c-format +msgid "Unrecognized form: %lu\n" +msgstr "" + +#: dwarf.c:1196 +#, c-format +msgid "(not inlined)" +msgstr "" + +#: dwarf.c:1199 +#, c-format +msgid "(inlined)" +msgstr "" + +#: dwarf.c:1202 +#, c-format +msgid "(declared as inline but ignored)" +msgstr "" + +#: dwarf.c:1205 +#, c-format +msgid "(declared as inline and inlined)" +msgstr "" + +#: dwarf.c:1208 +#, c-format +msgid " (Unknown inline attribute value: %lx)" +msgstr "" + +#: dwarf.c:1354 dwarf.c:2484 +#, c-format +msgid " [without DW_AT_frame_base]" +msgstr "" + +#: dwarf.c:1357 +#, c-format +msgid "(location list)" +msgstr "" + +#: dwarf.c:1475 +#, c-format +msgid "Unknown AT value: %lx" +msgstr "" + +#: dwarf.c:1544 +#, c-format +msgid "No comp units in %s section ?" +msgstr "" + +#: dwarf.c:1553 +#, c-format +msgid "Not enough memory for a debug info array of %u entries" +msgstr "" + +#: dwarf.c:1561 dwarf.c:2573 +#, c-format +msgid "" +"The section %s contains:\n" +"\n" +msgstr "" + +#: dwarf.c:1569 +#, c-format +msgid "Unable to locate %s section!\n" +msgstr "" + +#: dwarf.c:1635 +#, c-format +msgid " Compilation Unit @ offset 0x%lx:\n" +msgstr "" + +#: dwarf.c:1636 +#, c-format +msgid " Length: %ld\n" +msgstr "" + +#: dwarf.c:1637 +#, c-format +msgid " Version: %d\n" +msgstr "" + +#: dwarf.c:1638 +#, c-format +msgid " Abbrev Offset: %ld\n" +msgstr "" + +#: dwarf.c:1639 +#, c-format +msgid " Pointer Size: %d\n" +msgstr "" + +#: dwarf.c:1644 +msgid "Only version 2 and 3 DWARF debug information is currently supported.\n" +msgstr "" + +#: dwarf.c:1685 +#, c-format +msgid "Unable to locate entry %lu in the abbreviation table\n" +msgstr "" + +#: dwarf.c:1691 +#, c-format +msgid " <%d><%lx>: Abbrev Number: %lu (%s)\n" +msgstr "" + +#: dwarf.c:1785 +#, c-format +msgid "%s section needs a populated .debug_info section\n" +msgstr "" + +#: dwarf.c:1792 +#, c-format +msgid "%s section has more comp units than .debug_info section\n" +msgstr "" + +#: dwarf.c:1794 +#, c-format +msgid "" +"assuming that the pointer size is %d, from the last comp unit in ." +"debug_info\n" +"\n" +msgstr "" + +#: dwarf.c:1819 +#, c-format +msgid "" +"\n" +"Dump of debug contents of section %s:\n" +"\n" +msgstr "" + +#: dwarf.c:1858 +msgid "The line info appears to be corrupt - the section is too small\n" +msgstr "" + +#: dwarf.c:1867 +msgid "Only DWARF version 2 and 3 line info is currently supported.\n" +msgstr "" + +#: dwarf.c:1894 +#, c-format +msgid " Length: %ld\n" +msgstr "" + +#: dwarf.c:1895 +#, c-format +msgid " DWARF Version: %d\n" +msgstr "" + +#: dwarf.c:1896 +#, c-format +msgid " Prologue Length: %d\n" +msgstr "" + +#: dwarf.c:1897 +#, c-format +msgid " Minimum Instruction Length: %d\n" +msgstr "" + +#: dwarf.c:1898 +#, c-format +msgid " Initial value of 'is_stmt': %d\n" +msgstr "" + +#: dwarf.c:1899 +#, c-format +msgid " Line Base: %d\n" +msgstr "" + +#: dwarf.c:1900 +#, c-format +msgid " Line Range: %d\n" +msgstr "" + +#: dwarf.c:1901 +#, c-format +msgid " Opcode Base: %d\n" +msgstr "" + +#: dwarf.c:1902 +#, c-format +msgid " (Pointer size: %u)%s\n" +msgstr "" + +#: dwarf.c:1913 +#, c-format +msgid "" +"\n" +" Opcodes:\n" +msgstr "" + +#: dwarf.c:1916 +#, c-format +msgid " Opcode %d has %d args\n" +msgstr "" + +#: dwarf.c:1922 +#, c-format +msgid "" +"\n" +" The Directory Table is empty.\n" +msgstr "" + +#: dwarf.c:1925 +#, c-format +msgid "" +"\n" +" The Directory Table:\n" +msgstr "" + +#: dwarf.c:1929 +#, c-format +msgid " %s\n" +msgstr "" + +#: dwarf.c:1940 +#, c-format +msgid "" +"\n" +" The File Name Table is empty.\n" +msgstr "" + +#: dwarf.c:1943 +#, c-format +msgid "" +"\n" +" The File Name Table:\n" +msgstr "" + +#: dwarf.c:1951 +#, c-format +msgid " %d\t" +msgstr "" + +#: dwarf.c:1962 +#, c-format +msgid "%s\n" +msgstr "" + +#. Now display the statements. +#: dwarf.c:1970 +#, c-format +msgid "" +"\n" +" Line Number Statements:\n" +msgstr "" + +#: dwarf.c:1986 +#, c-format +msgid " Special opcode %d: advance Address by %lu to 0x%lx" +msgstr "" + +#: dwarf.c:1990 +#, c-format +msgid " and Line by %d to %d\n" +msgstr "" + +#: dwarf.c:1998 +msgid "Extend line ops need a valid pointer size, guessing at 4\n" +msgstr "" + +#: dwarf.c:2007 +#, c-format +msgid " Copy\n" +msgstr "" + +#: dwarf.c:2015 +#, c-format +msgid " Advance PC by %lu to 0x%lx\n" +msgstr "" + +#: dwarf.c:2023 +#, c-format +msgid " Advance Line by %d to %d\n" +msgstr "" + +#: dwarf.c:2030 +#, c-format +msgid " Set File Name to entry %d in the File Name Table\n" +msgstr "" + +#: dwarf.c:2038 +#, c-format +msgid " Set column to %lu\n" +msgstr "" + +#: dwarf.c:2045 +#, c-format +msgid " Set is_stmt to %d\n" +msgstr "" + +#: dwarf.c:2050 +#, c-format +msgid " Set basic block\n" +msgstr "" + +#: dwarf.c:2058 +#, c-format +msgid " Advance PC by constant %lu to 0x%lx\n" +msgstr "" + +#: dwarf.c:2066 +#, c-format +msgid " Advance PC by fixed size amount %lu to 0x%lx\n" +msgstr "" + +#: dwarf.c:2071 +#, c-format +msgid " Set prologue_end to true\n" +msgstr "" + +#: dwarf.c:2075 +#, c-format +msgid " Set epilogue_begin to true\n" +msgstr "" + +#: dwarf.c:2081 +#, c-format +msgid " Set ISA to %lu\n" +msgstr "" + +#: dwarf.c:2085 +#, c-format +msgid " Unknown opcode %d with operands: " +msgstr "" + +#: dwarf.c:2111 dwarf.c:2197 dwarf.c:2271 dwarf.c:2382 dwarf.c:2514 +#: dwarf.c:2739 +#, c-format +msgid "" +"Contents of the %s section:\n" +"\n" +msgstr "" + +#: dwarf.c:2151 +msgid "Only DWARF 2 and 3 pubnames are currently supported\n" +msgstr "" + +#: dwarf.c:2158 +#, c-format +msgid " Length: %ld\n" +msgstr "" + +#: dwarf.c:2160 +#, c-format +msgid " Version: %d\n" +msgstr "" + +#: dwarf.c:2162 +#, c-format +msgid " Offset into .debug_info section: %ld\n" +msgstr "" + +#: dwarf.c:2164 +#, c-format +msgid " Size of area in .debug_info section: %ld\n" +msgstr "" + +#: dwarf.c:2167 +#, c-format +msgid "" +"\n" +" Offset\tName\n" +msgstr "" + +#: dwarf.c:2218 +#, c-format +msgid " DW_MACINFO_start_file - lineno: %d filenum: %d\n" +msgstr "" + +#: dwarf.c:2224 +#, c-format +msgid " DW_MACINFO_end_file\n" +msgstr "" + +#: dwarf.c:2232 +#, c-format +msgid " DW_MACINFO_define - lineno : %d macro : %s\n" +msgstr "" + +#: dwarf.c:2241 +#, c-format +msgid " DW_MACINFO_undef - lineno : %d macro : %s\n" +msgstr "" + +#: dwarf.c:2253 +#, c-format +msgid " DW_MACINFO_vendor_ext - constant : %d string : %s\n" +msgstr "" + +#: dwarf.c:2282 +#, c-format +msgid " Number TAG\n" +msgstr "" + +#: dwarf.c:2288 +#, c-format +msgid " %ld %s [%s]\n" +msgstr "" + +#: dwarf.c:2291 +msgid "has children" +msgstr "" + +#: dwarf.c:2291 +msgid "no children" +msgstr "" + +#: dwarf.c:2294 +#, c-format +msgid " %-18s %s\n" +msgstr "" + +#: dwarf.c:2327 dwarf.c:2510 dwarf.c:2684 +#, c-format +msgid "" +"\n" +"The %s section is empty.\n" +msgstr "" + +#. FIXME: Should we handle this case? +#: dwarf.c:2372 +msgid "Location lists in .debug_info section aren't in ascending order!\n" +msgstr "" + +#: dwarf.c:2375 +msgid "No location lists in .debug_info section!\n" +msgstr "" + +#: dwarf.c:2379 +#, c-format +msgid "Location lists in %s section start at 0x%lx\n" +msgstr "" + +#: dwarf.c:2383 +#, c-format +msgid " Offset Begin End Expression\n" +msgstr "" + +#: dwarf.c:2414 +#, c-format +msgid "There is a hole [0x%lx - 0x%lx] in .debug_loc section.\n" +msgstr "" + +#: dwarf.c:2417 +#, c-format +msgid "There is an overlap [0x%lx - 0x%lx] in .debug_loc section.\n" +msgstr "" + +#: dwarf.c:2424 +#, c-format +msgid "Offset 0x%lx is bigger than .debug_loc section size.\n" +msgstr "" + +#: dwarf.c:2433 dwarf.c:2460 dwarf.c:2470 +#, c-format +msgid "Location list starting at offset 0x%lx is not terminated.\n" +msgstr "" + +#: dwarf.c:2445 dwarf.c:2784 +#, c-format +msgid " %8.8lx \n" +msgstr "" + +#: dwarf.c:2453 +#, c-format +msgid " %8.8lx %8.8lx %8.8lx (base address)\n" +msgstr "" + +#: dwarf.c:2487 dwarf.c:2801 +msgid " (start == end)" +msgstr "" + +#: dwarf.c:2489 dwarf.c:2803 +msgid " (start > end)" +msgstr "" + +#: dwarf.c:2618 +msgid "Only DWARF 2 and 3 aranges are currently supported.\n" +msgstr "" + +#: dwarf.c:2622 +#, c-format +msgid " Length: %ld\n" +msgstr "" + +#: dwarf.c:2623 +#, c-format +msgid " Version: %d\n" +msgstr "" + +#: dwarf.c:2624 +#, c-format +msgid " Offset into .debug_info: %lx\n" +msgstr "" + +#: dwarf.c:2625 +#, c-format +msgid " Pointer Size: %d\n" +msgstr "" + +#: dwarf.c:2626 +#, c-format +msgid " Segment Size: %d\n" +msgstr "" + +#: dwarf.c:2628 +#, c-format +msgid "" +"\n" +" Address Length\n" +msgstr "" + +#. FIXME: Should we handle this case? +#: dwarf.c:2729 +msgid "Range lists in .debug_info section aren't in ascending order!\n" +msgstr "" + +#: dwarf.c:2732 +msgid "No range lists in .debug_info section!\n" +msgstr "" + +#: dwarf.c:2736 +#, c-format +msgid "Range lists in %s section start at 0x%lx\n" +msgstr "" + +#: dwarf.c:2740 +#, c-format +msgid " Offset Begin End\n" +msgstr "" + +#: dwarf.c:2765 +#, c-format +msgid "There is a hole [0x%lx - 0x%lx] in %s section.\n" +msgstr "" + +#: dwarf.c:2769 +#, c-format +msgid "There is an overlap [0x%lx - 0x%lx] in %s section.\n" +msgstr "" + +#: dwarf.c:2964 +#, c-format +msgid "The section %s contains:\n" +msgstr "" + +#: dwarf.c:3608 +#, c-format +msgid "unsupported or unknown DW_CFA_%d\n" +msgstr "" + +#: dwarf.c:3632 +#, c-format +msgid "Displaying the debug contents of section %s is not yet supported.\n" +msgstr "" + +#: dwarf.c:3674 +#, c-format +msgid "%s: Error: " +msgstr "" + +#: dwarf.c:3685 +#, c-format +msgid "%s: Warning: " +msgstr "" + +#: emul_aix.c:51 #, c-format msgid " [-g] - 32 bit small archive\n" msgstr "" -#: emul_aix.c:59 +#: emul_aix.c:52 +#, c-format msgid " [-X32] - ignores 64 bit objects\n" msgstr "" -#: emul_aix.c:60 +#: emul_aix.c:53 +#, c-format msgid " [-X64] - ignores 32 bit objects\n" msgstr "" -#: emul_aix.c:61 +#: emul_aix.c:54 +#, c-format msgid " [-X32_64] - accepts 32 and 64 bit objects\n" msgstr "" -#: ieee.c:326 +#: ieee.c:311 msgid "unexpected end of debugging information" msgstr "" -#: ieee.c:421 +#: ieee.c:398 msgid "invalid number" msgstr "" -#: ieee.c:480 +#: ieee.c:451 msgid "invalid string length" msgstr "" -#: ieee.c:537 ieee.c:578 +#: ieee.c:506 ieee.c:547 msgid "expression stack overflow" msgstr "" -#: ieee.c:557 +#: ieee.c:526 msgid "unsupported IEEE expression operator" msgstr "" -#: ieee.c:572 +#: ieee.c:541 msgid "unknown section" msgstr "" -#: ieee.c:593 +#: ieee.c:562 msgid "expression stack underflow" msgstr "" -#: ieee.c:607 +#: ieee.c:576 msgid "expression stack mismatch" msgstr "" -#: ieee.c:646 +#: ieee.c:613 msgid "unknown builtin type" msgstr "" -#: ieee.c:791 +#: ieee.c:758 msgid "BCD float type not supported" msgstr "" -#: ieee.c:937 +#: ieee.c:895 msgid "unexpected number" msgstr "" -#: ieee.c:944 +#: ieee.c:902 msgid "unexpected record type" msgstr "" -#: ieee.c:977 +#: ieee.c:935 msgid "blocks left on stack at end" msgstr "" -#: ieee.c:1242 +#: ieee.c:1198 msgid "unknown BB type" msgstr "" -#: ieee.c:1251 +#: ieee.c:1207 msgid "stack overflow" msgstr "" -#: ieee.c:1276 +#: ieee.c:1230 msgid "stack underflow" msgstr "" -#: ieee.c:1390 ieee.c:1462 ieee.c:2161 +#: ieee.c:1342 ieee.c:1412 ieee.c:2109 msgid "illegal variable index" msgstr "" -#: ieee.c:1440 +#: ieee.c:1390 msgid "illegal type index" msgstr "" -#: ieee.c:1450 ieee.c:1487 +#: ieee.c:1400 ieee.c:1437 msgid "unknown TY code" msgstr "" -#: ieee.c:1469 +#: ieee.c:1419 msgid "undefined variable in TY" msgstr "" #. Pascal file name. FIXME. -#: ieee.c:1880 +#: ieee.c:1830 msgid "Pascal file name not supported" msgstr "" -#: ieee.c:1928 +#: ieee.c:1878 msgid "unsupported qualifier" msgstr "" -#: ieee.c:2199 +#: ieee.c:2147 msgid "undefined variable in ATN" msgstr "" -#: ieee.c:2242 +#: ieee.c:2190 msgid "unknown ATN type" msgstr "" #. Reserved for FORTRAN common. -#: ieee.c:2364 +#: ieee.c:2312 msgid "unsupported ATN11" msgstr "" #. We have no way to record this information. FIXME. -#: ieee.c:2391 +#: ieee.c:2339 msgid "unsupported ATN12" msgstr "" -#: ieee.c:2451 +#: ieee.c:2399 msgid "unexpected string in C++ misc" msgstr "" -#: ieee.c:2464 +#: ieee.c:2412 msgid "bad misc record" msgstr "" -#: ieee.c:2507 +#: ieee.c:2453 msgid "unrecognized C++ misc record" msgstr "" -#: ieee.c:2624 +#: ieee.c:2568 msgid "undefined C++ object" msgstr "" -#: ieee.c:2658 +#: ieee.c:2602 msgid "unrecognized C++ object spec" msgstr "" -#: ieee.c:2694 +#: ieee.c:2638 msgid "unsupported C++ object type" msgstr "" -#: ieee.c:2704 +#: ieee.c:2648 msgid "C++ base class not defined" msgstr "" -#: ieee.c:2716 ieee.c:2821 +#: ieee.c:2660 ieee.c:2765 msgid "C++ object has no fields" msgstr "" -#: ieee.c:2735 +#: ieee.c:2679 msgid "C++ base class not found in container" msgstr "" -#: ieee.c:2842 +#: ieee.c:2786 msgid "C++ data member not found in container" msgstr "" -#: ieee.c:2883 ieee.c:3033 +#: ieee.c:2827 ieee.c:2977 msgid "unknown C++ visibility" msgstr "" -#: ieee.c:2917 +#: ieee.c:2861 msgid "bad C++ field bit pos or size" msgstr "" -#: ieee.c:3009 +#: ieee.c:2953 msgid "bad type for C++ method function" msgstr "" -#: ieee.c:3019 +#: ieee.c:2963 msgid "no type information for C++ method function" msgstr "" -#: ieee.c:3058 +#: ieee.c:3002 msgid "C++ static virtual method" msgstr "" -#: ieee.c:3153 +#: ieee.c:3097 msgid "unrecognized C++ object overhead spec" msgstr "" -#: ieee.c:3192 +#: ieee.c:3136 msgid "undefined C++ vtable" msgstr "" -#: ieee.c:3263 +#: ieee.c:3205 msgid "C++ default values not in a function" msgstr "" -#: ieee.c:3303 +#: ieee.c:3245 msgid "unrecognized C++ default type" msgstr "" -#: ieee.c:3334 +#: ieee.c:3276 msgid "reference parameter is not a pointer" msgstr "" -#: ieee.c:3419 +#: ieee.c:3359 msgid "unrecognized C++ reference type" msgstr "" -#: ieee.c:3501 +#: ieee.c:3441 msgid "C++ reference not found" msgstr "" -#: ieee.c:3509 +#: ieee.c:3449 msgid "C++ reference is not pointer" msgstr "" -#: ieee.c:3538 ieee.c:3546 +#: ieee.c:3475 ieee.c:3483 msgid "missing required ASN" msgstr "" -#: ieee.c:3576 ieee.c:3584 +#: ieee.c:3510 ieee.c:3518 msgid "missing required ATN65" msgstr "" -#: ieee.c:3598 +#: ieee.c:3532 msgid "bad ATN65 record" msgstr "" -#: ieee.c:4286 +#: ieee.c:4160 +#, c-format msgid "IEEE numeric overflow: 0x" msgstr "" -#: ieee.c:4332 +#: ieee.c:4204 #, c-format msgid "IEEE string length overflow: %u\n" msgstr "" -#: ieee.c:5382 +#: ieee.c:5203 #, c-format msgid "IEEE unsupported integer type size %u\n" msgstr "" -#: ieee.c:5418 +#: ieee.c:5237 #, c-format msgid "IEEE unsupported float type size %u\n" msgstr "" -#: ieee.c:5454 +#: ieee.c:5271 #, c-format msgid "IEEE unsupported complex type size %u\n" msgstr "" -#: nlmconv.c:282 srconv.c:2043 +#: nlmconv.c:269 srconv.c:1813 msgid "input and output files must be different" msgstr "" -#: nlmconv.c:329 +#: nlmconv.c:316 msgid "input file named both on command line and with INPUT" msgstr "" -#: nlmconv.c:338 +#: nlmconv.c:325 msgid "no input file" msgstr "" -#: nlmconv.c:368 +#: nlmconv.c:355 msgid "no name for output file" msgstr "" -#: nlmconv.c:382 +#: nlmconv.c:369 msgid "warning: input and output formats are not compatible" msgstr "" -#: nlmconv.c:411 +#: nlmconv.c:398 msgid "make .bss section" msgstr "" -#: nlmconv.c:420 +#: nlmconv.c:407 msgid "make .nlmsections section" msgstr "" -#: nlmconv.c:422 +#: nlmconv.c:409 msgid "set .nlmsections flags" msgstr "" -#: nlmconv.c:450 +#: nlmconv.c:437 msgid "set .bss vma" msgstr "" -#: nlmconv.c:457 +#: nlmconv.c:444 msgid "set .data size" msgstr "" -#: nlmconv.c:637 +#: nlmconv.c:624 #, c-format msgid "warning: symbol %s imported but not in import list" msgstr "" -#: nlmconv.c:657 +#: nlmconv.c:644 msgid "set start address" msgstr "" -#: nlmconv.c:706 +#: nlmconv.c:693 #, c-format msgid "warning: START procedure %s not defined" msgstr "" -#: nlmconv.c:708 +#: nlmconv.c:695 #, c-format msgid "warning: EXIT procedure %s not defined" msgstr "" -#: nlmconv.c:710 +#: nlmconv.c:697 #, c-format msgid "warning: CHECK procedure %s not defined" msgstr "" -#: nlmconv.c:731 nlmconv.c:920 +#: nlmconv.c:718 nlmconv.c:907 msgid "custom section" msgstr "" -#: nlmconv.c:752 nlmconv.c:949 +#: nlmconv.c:739 nlmconv.c:936 msgid "help section" msgstr "" -#: nlmconv.c:774 nlmconv.c:967 +#: nlmconv.c:761 nlmconv.c:954 msgid "message section" msgstr "" -#: nlmconv.c:790 nlmconv.c:1000 +#: nlmconv.c:777 nlmconv.c:987 msgid "module section" msgstr "" -#: nlmconv.c:810 nlmconv.c:1016 +#: nlmconv.c:797 nlmconv.c:1003 msgid "rpc section" msgstr "" #. There is no place to record this information. -#: nlmconv.c:846 +#: nlmconv.c:833 #, c-format msgid "%s: warning: shared libraries can not have uninitialized data" msgstr "" -#: nlmconv.c:867 nlmconv.c:1035 +#: nlmconv.c:854 nlmconv.c:1022 msgid "shared section" msgstr "" -#: nlmconv.c:875 +#: nlmconv.c:862 msgid "warning: No version number given" msgstr "" -#: nlmconv.c:915 nlmconv.c:944 nlmconv.c:962 nlmconv.c:1011 nlmconv.c:1030 +#: nlmconv.c:902 nlmconv.c:931 nlmconv.c:949 nlmconv.c:998 nlmconv.c:1017 #, c-format msgid "%s: read: %s" msgstr "" -#: nlmconv.c:937 -msgid "warning: MAP and FULLMAP are not supported; try ld -M" +#: nlmconv.c:924 +msgid "warning: FULLMAP is not supported; try ld -M" msgstr "" -#: nlmconv.c:1109 +#: nlmconv.c:1100 #, c-format msgid "Usage: %s [option(s)] [in-file [out-file]]\n" msgstr "" -#: nlmconv.c:1110 +#: nlmconv.c:1101 +#, c-format msgid " Convert an object file into a NetWare Loadable Module\n" msgstr "" -#: nlmconv.c:1111 +#: nlmconv.c:1102 +#, c-format msgid "" " The options are:\n" " -I --input-target= Set the input binary file format\n" @@ -1385,77 +2211,80 @@ msgid "" " -T --header-file= Read for NLM header information\n" " -l --linker= Use for any linking\n" " -d --debug Display on stderr the linker command line\n" +" @ Read options from .\n" " -h --help Display this information\n" " -v --version Display the program's version\n" msgstr "" -#: nlmconv.c:1153 +#: nlmconv.c:1143 #, c-format msgid "support not compiled in for %s" msgstr "" -#: nlmconv.c:1193 +#: nlmconv.c:1180 msgid "make section" msgstr "" -#: nlmconv.c:1207 +#: nlmconv.c:1194 msgid "set section size" msgstr "" -#: nlmconv.c:1213 +#: nlmconv.c:1200 msgid "set section alignment" msgstr "" -#: nlmconv.c:1217 +#: nlmconv.c:1204 msgid "set section flags" msgstr "" -#: nlmconv.c:1228 +#: nlmconv.c:1215 msgid "set .nlmsections size" msgstr "" -#: nlmconv.c:1316 nlmconv.c:1324 nlmconv.c:1333 nlmconv.c:1338 +#: nlmconv.c:1296 nlmconv.c:1304 nlmconv.c:1313 nlmconv.c:1318 msgid "set .nlmsection contents" msgstr "" -#: nlmconv.c:1839 +#: nlmconv.c:1797 msgid "stub section sizes" msgstr "" -#: nlmconv.c:1888 +#: nlmconv.c:1844 msgid "writing stub" msgstr "" -#: nlmconv.c:1977 +#: nlmconv.c:1928 #, c-format msgid "unresolved PC relative reloc against %s" msgstr "" -#: nlmconv.c:2041 +#: nlmconv.c:1992 #, c-format msgid "overflow when adjusting relocation against %s" msgstr "" -#: nlmconv.c:2158 +#: nlmconv.c:2119 #, c-format msgid "%s: execution of %s failed: " msgstr "" -#: nlmconv.c:2173 +#: nlmconv.c:2134 #, c-format msgid "Execution of %s failed" msgstr "" -#: nm.c:283 size.c:85 strings.c:657 +#: nm.c:224 size.c:82 strings.c:708 #, c-format msgid "Usage: %s [option(s)] [file(s)]\n" msgstr "" -#: nm.c:284 +#: nm.c:225 +#, c-format msgid " List symbols in [file(s)] (a.out by default).\n" msgstr "" -#: nm.c:285 +#: nm.c:226 +#, c-format msgid "" " The options are:\n" " -a, --debug-syms Display debugger-only symbols\n" @@ -1486,63 +2315,56 @@ msgid "" " -S, --print-size Print size of defined symbols\n" " -s, --print-armap Include index for symbols from archive members\n" " --size-sort Sort symbols by size\n" +" --special-syms Include special symbols in the output\n" +" --synthetic Display synthetic symbols as well\n" " -t, --radix=RADIX Use RADIX for printing symbol values\n" " --target=BFDNAME Specify the target object format as BFDNAME\n" " -u, --undefined-only Display only undefined symbols\n" " -X 32_64 (ignored)\n" +" @FILE Read options from FILE\n" " -h, --help Display this information\n" " -V, --version Display this program's version number\n" "\n" msgstr "" -#: nm.c:319 objdump.c:250 +#: nm.c:263 objdump.c:236 #, c-format msgid "Report bugs to %s.\n" msgstr "" -#: nm.c:352 +#: nm.c:295 #, c-format msgid "%s: invalid radix" msgstr "" -#: nm.c:377 +#: nm.c:319 #, c-format msgid "%s: invalid output format" msgstr "" -#: nm.c:494 -msgid "Only -X 32_64 is supported" -msgstr "" - -#: nm.c:514 -msgid "Using the --size-sort and --undefined-only options together" -msgstr "" - -#: nm.c:515 -msgid "will produce no output, since undefined symbols have no size." -msgstr "" - -#: nm.c:543 -#, c-format -msgid "data size %ld" -msgstr "" - -#: nm.c:568 readelf.c:5809 readelf.c:5845 +#: nm.c:340 readelf.c:6623 readelf.c:6659 #, c-format msgid ": %d" msgstr "" -#: nm.c:570 readelf.c:5811 readelf.c:5857 +#: nm.c:342 readelf.c:6626 readelf.c:6671 #, c-format msgid ": %d" msgstr "" -#: nm.c:572 readelf.c:5813 readelf.c:5860 +#: nm.c:344 readelf.c:6628 readelf.c:6674 #, c-format msgid ": %d" msgstr "" -#: nm.c:1376 +#: nm.c:381 +#, c-format +msgid "" +"\n" +"Archive index:\n" +msgstr "" + +#: nm.c:1227 #, c-format msgid "" "\n" @@ -1551,7 +2373,7 @@ msgid "" "\n" msgstr "" -#: nm.c:1378 +#: nm.c:1229 #, c-format msgid "" "\n" @@ -1560,21 +2382,23 @@ msgid "" "\n" msgstr "" -#: nm.c:1380 nm.c:1438 +#: nm.c:1231 nm.c:1282 +#, c-format msgid "" "Name Value Class Type Size Line " "Section\n" "\n" msgstr "" -#: nm.c:1383 nm.c:1441 +#: nm.c:1234 nm.c:1285 +#, c-format msgid "" "Name Value Class Type " "Size Line Section\n" "\n" msgstr "" -#: nm.c:1434 +#: nm.c:1278 #, c-format msgid "" "\n" @@ -1583,7 +2407,7 @@ msgid "" "\n" msgstr "" -#: nm.c:1436 +#: nm.c:1280 #, c-format msgid "" "\n" @@ -1592,26 +2416,40 @@ msgid "" "\n" msgstr "" -#: nm.c:1658 -msgid "" -"\n" -"Archive index:\n" +#: nm.c:1584 +msgid "Only -X 32_64 is supported" msgstr "" -#: objcopy.c:414 srconv.c:1952 +#: nm.c:1604 +msgid "Using the --size-sort and --undefined-only options together" +msgstr "" + +#: nm.c:1605 +msgid "will produce no output, since undefined symbols have no size." +msgstr "" + +#: nm.c:1633 +#, c-format +msgid "data size %ld" +msgstr "" + +#: objcopy.c:401 srconv.c:1721 #, c-format msgid "Usage: %s [option(s)] in-file [out-file]\n" msgstr "" -#: objcopy.c:415 +#: objcopy.c:402 +#, c-format msgid " Copies a binary file, possibly transforming it in the process\n" msgstr "" -#: objcopy.c:416 objcopy.c:495 +#: objcopy.c:403 objcopy.c:495 +#, c-format msgid " The options are:\n" msgstr "" -#: objcopy.c:417 +#: objcopy.c:404 +#, c-format msgid "" " -I --input-target Assume input file is in format \n" " -O --output-target Create an output file in format " @@ -1634,14 +2472,23 @@ msgid "" " --strip-unneeded Remove all symbols not needed by " "relocations\n" " -N --strip-symbol Do not copy symbol \n" -" -K --keep-symbol Only copy symbol \n" +" --strip-unneeded-symbol \n" +" Do not copy symbol unless needed " +"by\n" +" relocations\n" +" --only-keep-debug Strip everything but the debug " +"information\n" +" -K --keep-symbol Do not strip symbol \n" " -L --localize-symbol Force symbol to be marked as a " "local\n" +" --globalize-symbol Force symbol to be marked as a " +"global\n" " -G --keep-global-symbol Localize all symbols except \n" " -W --weaken-symbol Force symbol to be marked as a " "weak\n" " --weaken Force all global symbols to be marked as " "weak\n" +" -w --wildcard Permit wildcard in symbol comparison\n" " -x --discard-all Remove all non-global symbols\n" " -X --discard-locals Remove any compiler-generated symbols\n" " -i --interleave Only copy one out of every " @@ -1686,11 +2533,20 @@ msgid "" " --srec-forceS3 Restrict the type of generated Srecords " "to S3\n" " --strip-symbols -N for all symbols listed in \n" +" --strip-unneeded-symbols \n" +" --strip-unneeded-symbol for all symbols " +"listed\n" +" in \n" " --keep-symbols -K for all symbols listed in \n" " --localize-symbols -L for all symbols listed in \n" +" --globalize-symbols --globalize-symbol for all in \n" " --keep-global-symbols -G for all symbols listed in \n" " --weaken-symbols -W for all symbols listed in \n" " --alt-machine-code Use alternate machine code for output\n" +" --writable-text Mark the output text as writable\n" +" --readonly-text Make the output text write protected\n" +" --pure Mark the output file as demand paged\n" +" --impure Mark the output file as impure\n" " --prefix-symbols Add to start of every symbol " "name\n" " --prefix-sections Add to start of every section " @@ -1700,6 +2556,7 @@ msgid "" "allocatable\n" " section name\n" " -v --verbose List all object files modified\n" +" @ Read options from \n" " -V --version Display this program's version number\n" " -h --help Display this output\n" " --info List object formats & architectures " @@ -1712,10 +2569,12 @@ msgid "Usage: %s in-file(s)\n" msgstr "" #: objcopy.c:494 +#, c-format msgid " Removes symbols and sections from files\n" msgstr "" #: objcopy.c:496 +#, c-format msgid "" " -I --input-target= Assume input file is in format \n" " -O --output-target= Create an output file in format " @@ -1730,8 +2589,11 @@ msgid "" " -g -S -d --strip-debug Remove all debugging symbols & sections\n" " --strip-unneeded Remove all symbols not needed by " "relocations\n" +" --only-keep-debug Strip everything but the debug " +"information\n" " -N --strip-symbol= Do not copy symbol \n" -" -K --keep-symbol= Only copy symbol \n" +" -K --keep-symbol= Do not strip symbol \n" +" -w --wildcard Permit wildcard in symbol comparison\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" @@ -1742,234 +2604,261 @@ msgid "" " -o Place stripped output into \n" msgstr "" -#: objcopy.c:567 +#: objcopy.c:568 #, c-format msgid "unrecognized section flag `%s'" msgstr "" -#: objcopy.c:568 +#: objcopy.c:569 #, c-format msgid "supported flags: %s" msgstr "" -#: objcopy.c:645 objcopy.c:2526 +#: objcopy.c:646 #, c-format -msgid "cannot stat: %s: %s" +msgid "cannot open '%s': %s" msgstr "" -#: objcopy.c:652 objcopy.c:2544 -#, c-format -msgid "cannot open: %s: %s" -msgstr "" - -#: objcopy.c:655 objcopy.c:2548 +#: objcopy.c:649 objcopy.c:2722 #, c-format msgid "%s: fread failed" msgstr "" -#: objcopy.c:728 +#: objcopy.c:722 #, c-format -msgid "Ignoring rubbish found on line %d of %s" +msgid "%s:%d: Ignoring rubbish found on this line" msgstr "" -#: objcopy.c:979 +#: objcopy.c:996 #, c-format msgid "%s: Multiple redefinition of symbol \"%s\"" msgstr "" -#: objcopy.c:983 +#: objcopy.c:1000 #, c-format msgid "%s: Symbol \"%s\" is target of more than one redefinition" msgstr "" -#: objcopy.c:1010 +#: objcopy.c:1028 #, c-format msgid "couldn't open symbol redefinition file %s (error: %s)" msgstr "" -#: objcopy.c:1088 +#: objcopy.c:1106 #, c-format -msgid "%s: garbage at end of line %d" +msgid "%s:%d: garbage found at end of line" msgstr "" -#: objcopy.c:1091 +#: objcopy.c:1109 #, c-format -msgid "%s: missing new symbol name at line %d" +msgid "%s:%d: missing new symbol name" msgstr "" -#: objcopy.c:1101 +#: objcopy.c:1119 #, c-format -msgid "%s: premature end of file at line %d" +msgid "%s:%d: premature end of file" msgstr "" -#: objcopy.c:1147 +#: objcopy.c:1145 +#, c-format +msgid "stat returns negative size for `%s'" +msgstr "" + +#: objcopy.c:1157 +#, c-format +msgid "copy from `%s' [unknown] to `%s' [unknown]\n" +msgstr "" + +#: objcopy.c:1212 msgid "Unable to change endianness of input file(s)" msgstr "" -#: objcopy.c:1155 +#: objcopy.c:1221 #, c-format -msgid "copy from %s(%s) to %s(%s)\n" +msgid "copy from `%s' [%s] to `%s' [%s]\n" msgstr "" -#: objcopy.c:1182 +#: objcopy.c:1258 objcopy.c:1715 #, c-format -msgid "Warning: Output file cannot represent architecture %s" +msgid "Unable to recognise the format of the input file `%s'" msgstr "" -#: objcopy.c:1211 +#: objcopy.c:1261 +#, c-format +msgid "Warning: Output file cannot represent architecture `%s'" +msgstr "" + +#: objcopy.c:1305 #, c-format msgid "can't create section `%s': %s" msgstr "" -#: objcopy.c:1304 +#: objcopy.c:1356 +msgid "there are no sections to be copied!" +msgstr "" + +#: objcopy.c:1402 #, c-format msgid "Can't fill gap after %s: %s" msgstr "" -#: objcopy.c:1329 +#: objcopy.c:1427 #, c-format msgid "Can't add padding to %s: %s" msgstr "" -#: objcopy.c:1485 +#: objcopy.c:1594 #, c-format msgid "%s: error copying private BFD data: %s" msgstr "" -#: objcopy.c:1498 +#: objcopy.c:1605 msgid "unknown alternate machine code, ignored" msgstr "" -#: objcopy.c:1531 objcopy.c:1561 +#: objcopy.c:1635 objcopy.c:1665 #, c-format msgid "cannot mkdir %s for archive copying (error: %s)" msgstr "" -#: objcopy.c:1749 +#: objcopy.c:1787 +#, c-format +msgid "error: the input file '%s' is empty" +msgstr "" + +#: objcopy.c:1889 #, c-format msgid "Multiple renames of section %s" msgstr "" -#: objcopy.c:1840 +#: objcopy.c:1940 +msgid "private header data" +msgstr "" + +#: objcopy.c:1948 +#, c-format +msgid "%s: error in %s: %s" +msgstr "" + +#: objcopy.c:2007 msgid "making" msgstr "" -#: objcopy.c:1849 +#: objcopy.c:2022 msgid "size" msgstr "" -#: objcopy.c:1863 +#: objcopy.c:2036 msgid "vma" msgstr "" -#: objcopy.c:1888 +#: objcopy.c:2061 msgid "alignment" msgstr "" -#: objcopy.c:1896 -msgid "flags" -msgstr "" - -#: objcopy.c:1918 +#: objcopy.c:2083 msgid "private data" msgstr "" -#: objcopy.c:1926 +#: objcopy.c:2091 #, c-format msgid "%s: section `%s': error in %s: %s" msgstr "" -#: objcopy.c:2199 +#: objcopy.c:2363 #, c-format msgid "%s: can't create debugging section: %s" msgstr "" -#: objcopy.c:2214 +#: objcopy.c:2377 #, c-format msgid "%s: can't set debugging section contents: %s" msgstr "" -#: objcopy.c:2223 +#: objcopy.c:2386 #, c-format msgid "%s: don't know how to write debugging information for %s" msgstr "" -#: objcopy.c:2346 -#, c-format -msgid "%s: cannot stat: %s" -msgstr "" - -#: objcopy.c:2400 +#: objcopy.c:2561 msgid "byte number must be non-negative" msgstr "" -#: objcopy.c:2410 +#: objcopy.c:2571 msgid "interleave must be positive" msgstr "" -#: objcopy.c:2430 objcopy.c:2438 +#: objcopy.c:2591 objcopy.c:2599 #, c-format msgid "%s both copied and removed" msgstr "" -#: objcopy.c:2523 objcopy.c:2593 objcopy.c:2693 objcopy.c:2724 objcopy.c:2748 -#: objcopy.c:2752 objcopy.c:2772 +#: objcopy.c:2696 objcopy.c:2767 objcopy.c:2867 objcopy.c:2898 objcopy.c:2922 +#: objcopy.c:2926 objcopy.c:2946 #, c-format msgid "bad format for %s" msgstr "" -#: objcopy.c:2662 +#: objcopy.c:2717 +#, c-format +msgid "cannot open: %s: %s" +msgstr "" + +#: objcopy.c:2836 #, c-format msgid "Warning: truncating gap-fill from 0x%s to 0x%x" msgstr "" -#: objcopy.c:2818 +#: objcopy.c:3000 msgid "alternate machine code index must be positive" msgstr "" -#: objcopy.c:2856 +#: objcopy.c:3058 msgid "byte number must be less than interleave" msgstr "" -#: objcopy.c:2883 +#: objcopy.c:3088 #, c-format msgid "architecture %s unknown" msgstr "" -#: objcopy.c:2887 +#: objcopy.c:3092 msgid "" "Warning: input target 'binary' required for binary architecture parameter." msgstr "" -#: objcopy.c:2888 +#: objcopy.c:3093 #, c-format msgid " Argument %s ignored" msgstr "" -#: objcopy.c:2894 +#: objcopy.c:3099 #, c-format -msgid "Cannot stat: %s: %s" +msgid "warning: could not locate '%s'. System error message: %s" msgstr "" -#: objcopy.c:2934 objcopy.c:2948 +#: objcopy.c:3141 objcopy.c:3155 #, c-format msgid "%s %s%c0x%s never used" msgstr "" -#: objdump.c:197 +#: objdump.c:178 #, c-format msgid "Usage: %s \n" msgstr "" -#: objdump.c:198 +#: objdump.c:179 +#, c-format msgid " Display information from object .\n" msgstr "" -#: objdump.c:199 +#: objdump.c:180 +#, c-format msgid " At least one of the following switches must be given:\n" msgstr "" -#: objdump.c:200 +#: objdump.c:181 +#, c-format msgid "" " -a, --archive-headers Display archive header information\n" " -f, --file-headers Display the contents of the overall file header\n" @@ -1984,24 +2873,29 @@ msgid "" " -s, --full-contents Display the full contents of all sections " "requested\n" " -g, --debugging Display debug information in object file\n" +" -e, --debugging-tags Display debug information using ctags style\n" " -G, --stabs Display (in raw form) any STABS info in the file\n" +" -W, --dwarf Display DWARF info in the 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" +" @ Read options from \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:222 +#: objdump.c:206 +#, c-format msgid "" "\n" " The following switches are optional:\n" msgstr "" -#: objdump.c:223 +#: objdump.c:207 +#, c-format msgid "" " -b, --target=BFDNAME Specify the target object format as " "BFDNAME\n" @@ -2014,6 +2908,7 @@ msgid "" "disassembling\n" " --file-start-context Include context from start of file (with -" "S)\n" +" -I, --include=DIR Add DIR to search list for source files\n" " -l, --line-numbers Include line numbers and filenames in " "output\n" " -C, --demangle[=STYLE] Decode mangled/processed symbol names\n" @@ -2032,325 +2927,352 @@ msgid "" " --[no-]show-raw-insn Display hex alongside symbolic disassembly\n" " --adjust-vma=OFFSET Add OFFSET to all displayed section " "addresses\n" +" --special-syms Include special symbols in symbol dumps\n" "\n" msgstr "" -#: objdump.c:391 +#: objdump.c:389 +#, c-format msgid "Sections:\n" msgstr "" -#: objdump.c:394 objdump.c:398 +#: objdump.c:392 objdump.c:396 +#, c-format msgid "Idx Name Size VMA LMA File off Algn" msgstr "" -#: objdump.c:400 +#: objdump.c:398 +#, c-format msgid "" "Idx Name Size VMA LMA File off " "Algn" msgstr "" -#: objdump.c:404 +#: objdump.c:402 +#, c-format msgid " Flags" msgstr "" -#: objdump.c:406 +#: objdump.c:404 +#, c-format msgid " Pg" msgstr "" -#: objdump.c:451 +#: objdump.c:447 #, c-format msgid "%s: not a dynamic object" msgstr "" -#: objdump.c:1144 -msgid "Out of virtual memory" -msgstr "" - -#: objdump.c:1574 -#, c-format -msgid "Can't use supplied machine %s" -msgstr "" - -#: objdump.c:1592 -#, c-format -msgid "Can't disassemble for architecture %s\n" -msgstr "" - -#: objdump.c:1682 +#: objdump.c:1735 #, c-format msgid "Disassembly of section %s:\n" msgstr "" -#: objdump.c:1847 +#: objdump.c:1897 +#, c-format +msgid "Can't use supplied machine %s" +msgstr "" + +#: objdump.c:1916 +#, c-format +msgid "Can't disassemble for architecture %s\n" +msgstr "" + +#: objdump.c:2006 +#, c-format +msgid "" +"\n" +"Can't get contents for section '%s'.\n" +msgstr "" + +#: objdump.c:2143 #, c-format msgid "" "No %s section present\n" "\n" msgstr "" -#: objdump.c:1854 -#, c-format -msgid "%s has no %s section" -msgstr "" - -#: objdump.c:1868 +#: objdump.c:2152 #, c-format msgid "Reading %s section of %s failed: %s" msgstr "" -#: objdump.c:1880 -#, c-format -msgid "Reading %s section of %s failed: %s\n" -msgstr "" - -#: objdump.c:1923 +#: objdump.c:2196 #, c-format msgid "" "Contents of %s section:\n" "\n" msgstr "" -#: objdump.c:2021 +#: objdump.c:2323 #, c-format msgid "architecture: %s, " msgstr "" -#: objdump.c:2024 +#: objdump.c:2326 #, c-format msgid "flags 0x%08x:\n" msgstr "" -#: objdump.c:2038 +#: objdump.c:2340 +#, c-format msgid "" "\n" "start address 0x" msgstr "" -#: objdump.c:2071 +#: objdump.c:2380 +#, c-format +msgid "Contents of section %s:\n" +msgstr "" + +#: objdump.c:2505 +#, c-format +msgid "no symbols\n" +msgstr "" + +#: objdump.c:2512 +#, c-format +msgid "no information for symbol number %ld\n" +msgstr "" + +#: objdump.c:2515 +#, c-format +msgid "could not determine the type of symbol number %ld\n" +msgstr "" + +#: objdump.c:2788 #, c-format msgid "" "\n" "%s: file format %s\n" msgstr "" -#: objdump.c:2111 +#: objdump.c:2845 #, c-format msgid "%s: printing debugging information failed" msgstr "" -#: objdump.c:2190 +#: objdump.c:2936 #, c-format msgid "In archive %s:\n" msgstr "" -#: objdump.c:2249 -#, c-format -msgid "Contents of section %s:\n" -msgstr "" - -#: objdump.c:2369 -msgid "no symbols\n" -msgstr "" - -#: objdump.c:2718 +#: objdump.c:3058 msgid "unrecognized -E option" msgstr "" -#: objdump.c:2729 +#: objdump.c:3069 #, c-format msgid "unrecognized --endian type `%s'" msgstr "" -#: rdcoff.c:206 +#: rdcoff.c:196 #, c-format msgid "parse_coff_type: Bad type code 0x%x" msgstr "" -#: rdcoff.c:424 rdcoff.c:532 rdcoff.c:731 +#: rdcoff.c:404 rdcoff.c:509 rdcoff.c:697 #, c-format msgid "bfd_coff_get_syment failed: %s" msgstr "" -#: rdcoff.c:440 rdcoff.c:751 +#: rdcoff.c:420 rdcoff.c:717 #, c-format msgid "bfd_coff_get_auxent failed: %s" msgstr "" -#: rdcoff.c:818 +#: rdcoff.c:784 #, c-format msgid "%ld: .bf without preceding function" msgstr "" -#: rdcoff.c:868 +#: rdcoff.c:834 #, c-format msgid "%ld: unexpected .ef\n" msgstr "" -#: rddbg.c:91 +#: rddbg.c:85 #, c-format msgid "%s: no recognized debugging information" msgstr "" -#: rddbg.c:415 +#: rddbg.c:394 +#, c-format msgid "Last stabs entries before error:\n" msgstr "" -#: readelf.c:455 +#: readelf.c:264 #, c-format -msgid "%s: Error: " +msgid "Unable to seek to 0x%lx for %s\n" msgstr "" -#: readelf.c:466 +#: readelf.c:279 #, c-format -msgid "%s: Warning: " +msgid "Out of memory allocating 0x%lx bytes for %s\n" msgstr "" -#: readelf.c:488 +#: readelf.c:289 #, c-format -msgid "Unable to seek to 0x%x for %s\n" +msgid "Unable to read in 0x%lx bytes of %s\n" msgstr "" -#: readelf.c:499 -#, c-format -msgid "Out of memory allocating 0x%x bytes for %s\n" -msgstr "" - -#: readelf.c:507 -#, c-format -msgid "Unable to read in 0x%x bytes of %s\n" -msgstr "" - -#: readelf.c:560 readelf.c:614 readelf.c:798 readelf.c:833 -#, c-format -msgid "Unhandled data length: %d\n" -msgstr "" - -#: readelf.c:924 +#: readelf.c:623 msgid "Don't know about relocations on this machine architecture\n" msgstr "" -#: readelf.c:946 readelf.c:975 readelf.c:1021 readelf.c:1049 +#: readelf.c:643 readelf.c:671 readelf.c:715 readelf.c:743 msgid "relocs" msgstr "" -#: readelf.c:957 readelf.c:986 readelf.c:1031 readelf.c:1059 +#: readelf.c:654 readelf.c:682 readelf.c:726 readelf.c:754 msgid "out of memory parsing relocs" msgstr "" -#: readelf.c:1112 +#: readelf.c:808 +#, c-format msgid "" " Offset Info Type Sym. Value Symbol's Name + Addend\n" msgstr "" -#: readelf.c:1114 +#: readelf.c:810 +#, c-format msgid " Offset Info Type Sym.Value Sym. Name + Addend\n" msgstr "" -#: readelf.c:1119 +#: readelf.c:815 +#, c-format msgid " Offset Info Type Sym. Value Symbol's Name\n" msgstr "" -#: readelf.c:1121 +#: readelf.c:817 +#, c-format msgid " Offset Info Type Sym.Value Sym. Name\n" msgstr "" -#: readelf.c:1129 +#: readelf.c:825 +#, c-format msgid "" " Offset Info Type Symbol's Value " "Symbol's Name + Addend\n" msgstr "" -#: readelf.c:1131 +#: readelf.c:827 +#, c-format msgid "" " Offset Info Type Sym. Value Sym. Name + " "Addend\n" msgstr "" -#: readelf.c:1136 +#: readelf.c:832 +#, c-format msgid "" " Offset Info Type Symbol's Value " "Symbol's Name\n" msgstr "" -#: readelf.c:1138 +#: readelf.c:834 +#, c-format msgid "" " Offset Info Type Sym. Value Sym. Name\n" msgstr "" -#: readelf.c:1414 readelf.c:1416 readelf.c:1492 readelf.c:1494 readelf.c:1503 -#: readelf.c:1505 +#: readelf.c:1127 readelf.c:1129 readelf.c:1238 readelf.c:1240 readelf.c:1249 +#: readelf.c:1251 #, c-format msgid "unrecognized: %-7lx" msgstr "" -#: readelf.c:1466 +#: readelf.c:1154 #, c-format -msgid "" +msgid "" msgstr "" -#: readelf.c:1743 +#: readelf.c:1210 +#, c-format +msgid "" +msgstr "" + +#: readelf.c:1212 +#, c-format +msgid "" +msgstr "" + +#: readelf.c:1522 #, c-format msgid "Processor Specific: %lx" msgstr "" -#: readelf.c:1762 +#: readelf.c:1543 #, c-format msgid "Operating System specific: %lx" msgstr "" -#: readelf.c:1765 readelf.c:2417 +#: readelf.c:1547 readelf.c:2349 #, c-format msgid ": %lx" msgstr "" -#: readelf.c:1779 +#: readelf.c:1560 msgid "NONE (None)" msgstr "" -#: readelf.c:1780 +#: readelf.c:1561 msgid "REL (Relocatable file)" msgstr "" -#: readelf.c:1781 +#: readelf.c:1562 msgid "EXEC (Executable file)" msgstr "" -#: readelf.c:1782 +#: readelf.c:1563 msgid "DYN (Shared object file)" msgstr "" -#: readelf.c:1783 +#: readelf.c:1564 msgid "CORE (Core file)" msgstr "" -#: readelf.c:1787 +#: readelf.c:1568 #, c-format msgid "Processor Specific: (%x)" msgstr "" -#: readelf.c:1789 +#: readelf.c:1570 #, c-format msgid "OS Specific: (%x)" msgstr "" -#: readelf.c:1791 readelf.c:1898 readelf.c:2574 +#: readelf.c:1572 readelf.c:1681 readelf.c:2541 #, c-format msgid ": %x" msgstr "" -#: readelf.c:1804 +#: readelf.c:1584 msgid "None" msgstr "" -#: readelf.c:2616 +#: readelf.c:2186 +msgid "Standalone App" +msgstr "" + +#: readelf.c:2189 readelf.c:2948 readelf.c:2964 +#, c-format +msgid "" +msgstr "" + +#: readelf.c:2586 +#, c-format msgid "Usage: readelf elf-file(s)\n" msgstr "" -#: readelf.c:2617 +#: readelf.c:2587 +#, c-format msgid " Display information about the contents of ELF format files\n" msgstr "" -#: readelf.c:2618 +#: readelf.c:2588 +#, c-format msgid "" " Options are:\n" " -a --all Equivalent to: -h -l -S -s -r -d -V -A -I\n" @@ -2359,354 +3281,421 @@ msgid "" " --segments An alias for --program-headers\n" " -S --section-headers Display the sections' header\n" " --sections An alias for --section-headers\n" +" -g --section-groups Display the section groups\n" +" -t --section-details Display the section details\n" " -e --headers Equivalent to: -h -l -S\n" " -s --syms Display the symbol table\n" " --symbols An alias for --syms\n" " -n --notes Display the core notes (if present)\n" " -r --relocs Display the relocations (if present)\n" " -u --unwind Display the unwind info (if present)\n" -" -d --dynamic Display the dynamic segment (if present)\n" +" -d --dynamic Display the dynamic section (if present)\n" " -V --version-info Display the version sections (if present)\n" " -A --arch-specific Display architecture specific information (if " "any).\n" " -D --use-dynamic Use the dynamic section info when displaying " "symbols\n" " -x --hex-dump= Dump the contents of section \n" -" -w[liaprmfFso] or\n" -" --debug-dump[=line,=info,=abbrev,=pubnames,=ranges,=macro,=frames,=str," -"=loc]\n" +" -w[liaprmfFsoR] or\n" +" --debug-dump[=line,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=str," +"=loc,=Ranges]\n" " Display the contents of DWARF2 debug sections\n" msgstr "" -#: readelf.c:2640 +#: readelf.c:2612 +#, c-format msgid "" " -i --instruction-dump=\n" " Disassemble the contents of section \n" msgstr "" -#: readelf.c:2644 +#: readelf.c:2616 +#, c-format msgid "" " -I --histogram Display histogram of bucket list lengths\n" " -W --wide Allow output width to exceed 80 characters\n" +" @ Read options from \n" " -H --help Display this information\n" " -v --version Display the version number of readelf\n" msgstr "" -#: readelf.c:2666 readelf.c:10765 +#: readelf.c:2642 readelf.c:9180 msgid "Out of memory allocating dump request table." msgstr "" -#: readelf.c:2830 readelf.c:2906 +#: readelf.c:2816 readelf.c:2884 #, c-format msgid "Unrecognized debug option '%s'\n" msgstr "" -#: readelf.c:2940 +#: readelf.c:2918 #, c-format msgid "Invalid option '-%c'\n" msgstr "" -#: readelf.c:2953 +#: readelf.c:2932 msgid "Nothing to do.\n" msgstr "" -#: readelf.c:2966 readelf.c:2983 readelf.c:5366 +#: readelf.c:2944 readelf.c:2960 readelf.c:6169 msgid "none" msgstr "" -#: readelf.c:2970 readelf.c:2987 readelf.c:3018 -#, c-format -msgid "" -msgstr "" - -#: readelf.c:2984 +#: readelf.c:2961 msgid "2's complement, little endian" msgstr "" -#: readelf.c:2985 +#: readelf.c:2962 msgid "2's complement, big endian" msgstr "" -#: readelf.c:3015 -msgid "Standalone App" -msgstr "" - -#: readelf.c:3034 +#: readelf.c:2980 msgid "Not an ELF file - it has the wrong magic bytes at the start\n" msgstr "" -#: readelf.c:3042 +#: readelf.c:2988 +#, c-format msgid "ELF Header:\n" msgstr "" -#: readelf.c:3043 +#: readelf.c:2989 +#, c-format msgid " Magic: " msgstr "" -#: readelf.c:3047 +#: readelf.c:2993 #, c-format msgid " Class: %s\n" msgstr "" -#: readelf.c:3049 +#: readelf.c:2995 #, c-format msgid " Data: %s\n" msgstr "" -#: readelf.c:3051 +#: readelf.c:2997 #, c-format msgid " Version: %d %s\n" msgstr "" -#: readelf.c:3058 +#: readelf.c:3004 #, c-format msgid " OS/ABI: %s\n" msgstr "" -#: readelf.c:3060 +#: readelf.c:3006 #, c-format msgid " ABI Version: %d\n" msgstr "" -#: readelf.c:3062 +#: readelf.c:3008 #, c-format msgid " Type: %s\n" msgstr "" -#: readelf.c:3064 +#: readelf.c:3010 #, c-format msgid " Machine: %s\n" msgstr "" -#: readelf.c:3066 +#: readelf.c:3012 #, c-format msgid " Version: 0x%lx\n" msgstr "" -#: readelf.c:3069 +#: readelf.c:3015 +#, c-format msgid " Entry point address: " msgstr "" -#: readelf.c:3071 +#: readelf.c:3017 +#, c-format msgid "" "\n" " Start of program headers: " msgstr "" -#: readelf.c:3073 +#: readelf.c:3019 +#, c-format msgid "" " (bytes into file)\n" " Start of section headers: " msgstr "" -#: readelf.c:3075 +#: readelf.c:3021 +#, c-format msgid " (bytes into file)\n" msgstr "" -#: readelf.c:3077 +#: readelf.c:3023 #, c-format msgid " Flags: 0x%lx%s\n" msgstr "" -#: readelf.c:3080 +#: readelf.c:3026 #, c-format msgid " Size of this header: %ld (bytes)\n" msgstr "" -#: readelf.c:3082 +#: readelf.c:3028 #, c-format msgid " Size of program headers: %ld (bytes)\n" msgstr "" -#: readelf.c:3084 +#: readelf.c:3030 #, c-format msgid " Number of program headers: %ld\n" msgstr "" -#: readelf.c:3086 +#: readelf.c:3032 #, c-format msgid " Size of section headers: %ld (bytes)\n" msgstr "" -#: readelf.c:3088 +#: readelf.c:3034 #, c-format msgid " Number of section headers: %ld" msgstr "" -#: readelf.c:3093 +#: readelf.c:3039 #, c-format msgid " Section header string table index: %ld" msgstr "" -#: readelf.c:3127 readelf.c:3163 +#: readelf.c:3070 readelf.c:3103 msgid "program headers" msgstr "" -#: readelf.c:3203 readelf.c:3480 readelf.c:3526 readelf.c:3589 readelf.c:3656 -#: readelf.c:4715 readelf.c:4758 readelf.c:4948 readelf.c:5917 readelf.c:5931 -#: readelf.c:10411 +#: readelf.c:3141 readelf.c:3440 readelf.c:3481 readelf.c:3540 readelf.c:3603 +#: readelf.c:4208 readelf.c:4232 readelf.c:5510 readelf.c:5554 readelf.c:5752 +#: readelf.c:6734 readelf.c:6748 readelf.c:8564 readelf.c:8972 readelf.c:9039 msgid "Out of memory\n" msgstr "" -#: readelf.c:3231 +#: readelf.c:3168 +#, c-format msgid "" "\n" "There are no program headers in this file.\n" msgstr "" -#: readelf.c:3237 +#: readelf.c:3174 #, c-format msgid "" "\n" "Elf file type is %s\n" msgstr "" -#: readelf.c:3238 +#: readelf.c:3175 +#, c-format msgid "Entry point " msgstr "" -#: readelf.c:3240 +#: readelf.c:3177 #, c-format msgid "" "\n" "There are %d program headers, starting at offset " msgstr "" -#: readelf.c:3252 readelf.c:3254 +#: readelf.c:3189 readelf.c:3191 +#, c-format msgid "" "\n" "Program Headers:\n" msgstr "" -#: readelf.c:3258 +#: readelf.c:3195 +#, c-format msgid "" " Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align\n" msgstr "" -#: readelf.c:3261 +#: readelf.c:3198 +#, c-format msgid "" " Type Offset VirtAddr PhysAddr FileSiz " "MemSiz Flg Align\n" msgstr "" -#: readelf.c:3265 +#: readelf.c:3202 +#, c-format msgid " Type Offset VirtAddr PhysAddr\n" msgstr "" -#: readelf.c:3267 +#: readelf.c:3204 +#, c-format msgid " FileSiz MemSiz Flags Align\n" msgstr "" -#: readelf.c:3360 +#: readelf.c:3297 msgid "more than one dynamic segment\n" msgstr "" -#: readelf.c:3368 +#: readelf.c:3308 +msgid "no .dynamic section in the dynamic segment" +msgstr "" + +#: readelf.c:3317 +msgid "the .dynamic section is not contained within the dynamic segment" +msgstr "" + +#: readelf.c:3319 +msgid "the .dynamic section is not the first section in the dynamic segment." +msgstr "" + +#: readelf.c:3333 msgid "Unable to find program interpreter name\n" msgstr "" -#: readelf.c:3375 +#: readelf.c:3340 #, c-format msgid "" "\n" " [Requesting program interpreter: %s]" msgstr "" -#: readelf.c:3387 +#: readelf.c:3352 +#, c-format msgid "" "\n" " Section to Segment mapping:\n" msgstr "" -#: readelf.c:3388 +#: readelf.c:3353 +#, c-format msgid " Segment Sections...\n" msgstr "" -#: readelf.c:3437 +#: readelf.c:3402 msgid "Cannot interpret virtual addresses without program headers.\n" msgstr "" -#: readelf.c:3453 +#: readelf.c:3418 #, c-format msgid "Virtual address 0x%lx not located in any PT_LOAD segment.\n" msgstr "" -#: readelf.c:3471 readelf.c:3517 +#: readelf.c:3432 readelf.c:3473 msgid "section headers" msgstr "" -#: readelf.c:3565 readelf.c:3632 +#: readelf.c:3517 readelf.c:3580 msgid "symbols" msgstr "" -#: readelf.c:3576 readelf.c:3643 +#: readelf.c:3527 readelf.c:3590 msgid "symtab shndx" msgstr "" -#: readelf.c:3745 +#: readelf.c:3817 readelf.c:4192 +#, c-format msgid "" "\n" "There are no sections in this file.\n" msgstr "" -#: readelf.c:3751 +#: readelf.c:3823 #, c-format msgid "There are %d section headers, starting at offset 0x%lx:\n" msgstr "" -#: readelf.c:3768 readelf.c:4098 readelf.c:4433 readelf.c:6070 +#: readelf.c:3842 readelf.c:4309 readelf.c:4544 readelf.c:4852 readelf.c:5267 +#: readelf.c:6906 msgid "string table" msgstr "" -#: readelf.c:3793 +#: readelf.c:3881 +#, c-format +msgid "Section %d has invalid sh_entsize %lx (expected %lx)\n" +msgstr "" + +#: readelf.c:3901 msgid "File contains multiple dynamic symbol tables\n" msgstr "" -#: readelf.c:3805 +#: readelf.c:3914 msgid "File contains multiple dynamic string tables\n" msgstr "" -#: readelf.c:3811 +#: readelf.c:3919 msgid "dynamic strings" msgstr "" -#: readelf.c:3817 +#: readelf.c:3926 msgid "File contains multiple symtab shndx tables\n" msgstr "" -#: readelf.c:3855 +#: readelf.c:3973 +#, c-format msgid "" "\n" "Section Headers:\n" msgstr "" -#: readelf.c:3857 +#: readelf.c:3975 +#, c-format msgid "" "\n" "Section Header:\n" msgstr "" -#: readelf.c:3861 +#: readelf.c:3981 readelf.c:3992 readelf.c:4003 +#, c-format +msgid " [Nr] Name\n" +msgstr "" + +#: readelf.c:3982 +#, c-format +msgid " Type Addr Off Size ES Lk Inf Al\n" +msgstr "" + +#: readelf.c:3986 +#, c-format msgid "" " [Nr] Name Type Addr Off Size ES Flg Lk " "Inf Al\n" msgstr "" -#: readelf.c:3864 +#: readelf.c:3993 +#, c-format +msgid " Type Address Off Size ES Lk Inf Al\n" +msgstr "" + +#: readelf.c:3997 +#, c-format msgid "" " [Nr] Name Type Address Off Size ES " "Flg Lk Inf Al\n" msgstr "" -#: readelf.c:3867 +#: readelf.c:4004 +#, c-format +msgid " Type Address Offset Link\n" +msgstr "" + +#: readelf.c:4005 +#, c-format +msgid " Size EntSize Info Align\n" +msgstr "" + +#: readelf.c:4009 +#, c-format msgid " [Nr] Name Type Address Offset\n" msgstr "" -#: readelf.c:3868 +#: readelf.c:4010 +#, c-format msgid " Size EntSize Flags Link Info Align\n" msgstr "" -#: readelf.c:3963 +#: readelf.c:4015 +#, c-format +msgid " Flags\n" +msgstr "" + +#: readelf.c:4150 +#, c-format msgid "" "Key to Flags:\n" " W (write), A (alloc), X (execute), M (merge), S (strings)\n" @@ -2714,1554 +3703,1204 @@ msgid "" " O (extra OS processing required) o (OS specific), p (processor specific)\n" msgstr "" -#: readelf.c:4031 +#: readelf.c:4168 +#, c-format +msgid "[: 0x%x]" +msgstr "" + +#: readelf.c:4199 +msgid "Section headers are not available!\n" +msgstr "" + +#: readelf.c:4223 +#, c-format +msgid "" +"\n" +"There are no section groups in this file.\n" +msgstr "" + +#: readelf.c:4259 +#, c-format +msgid "Bad sh_link in group section `%s'\n" +msgstr "" + +#: readelf.c:4278 +#, c-format +msgid "Bad sh_info in group section `%s'\n" +msgstr "" + +#: readelf.c:4317 readelf.c:7243 +msgid "section data" +msgstr "" + +#: readelf.c:4329 +#, c-format +msgid " [Index] Name\n" +msgstr "" + +#: readelf.c:4343 +#, c-format +msgid "section [%5u] in group section [%5u] > maximum section [%5u]\n" +msgstr "" + +#: readelf.c:4349 +#, c-format +msgid "invalid section [%5u] in group section [%5u]\n" +msgstr "" + +#: readelf.c:4359 +#, c-format +msgid "section [%5u] in group section [%5u] already in group section [%5u]\n" +msgstr "" + +#: readelf.c:4372 +#, c-format +msgid "section 0 in group section [%5u]\n" +msgstr "" + +#: readelf.c:4468 #, c-format msgid "" "\n" "'%s' relocation section at offset 0x%lx contains %ld bytes:\n" msgstr "" -#: readelf.c:4043 +#: readelf.c:4480 +#, c-format msgid "" "\n" "There are no dynamic relocations in this file.\n" msgstr "" -#: readelf.c:4070 +#: readelf.c:4504 +#, c-format msgid "" "\n" "Relocation section " msgstr "" -#: readelf.c:4075 readelf.c:4496 readelf.c:4510 +#: readelf.c:4509 readelf.c:4928 readelf.c:4942 readelf.c:5282 #, c-format msgid "'%s'" msgstr "" -#: readelf.c:4077 readelf.c:4512 +#: readelf.c:4511 readelf.c:4944 readelf.c:5284 #, c-format msgid " at offset 0x%lx contains %lu entries:\n" msgstr "" -#: readelf.c:4115 +#: readelf.c:4563 +#, c-format msgid "" "\n" "There are no relocations in this file.\n" msgstr "" -#: readelf.c:4299 +#: readelf.c:4742 readelf.c:5124 msgid "unwind table" msgstr "" -#: readelf.c:4350 readelf.c:4362 readelf.c:8499 readelf.c:8511 -#, c-format -msgid "Skipping unexpected symbol type %u\n" -msgstr "" - -#: readelf.c:4370 +#: readelf.c:4801 readelf.c:5214 #, c-format msgid "Skipping unexpected relocation type %s\n" msgstr "" -#: readelf.c:4415 readelf.c:4440 +#: readelf.c:4860 readelf.c:5275 readelf.c:5326 +#, c-format msgid "" "\n" "There are no unwind sections in this file.\n" msgstr "" -#: readelf.c:4491 +#: readelf.c:4923 +#, c-format msgid "" "\n" "Could not find unwind info section for " msgstr "" -#: readelf.c:4503 +#: readelf.c:4935 msgid "unwind info" msgstr "" -#: readelf.c:4505 +#: readelf.c:4937 readelf.c:5281 +#, c-format msgid "" "\n" "Unwind section " msgstr "" -#: readelf.c:4699 readelf.c:4742 -msgid "dynamic segment" +#: readelf.c:5491 readelf.c:5535 +msgid "dynamic section" msgstr "" -#: readelf.c:4820 -msgid "" -"\n" -"There is no dynamic segment in this file.\n" -msgstr "" - -#: readelf.c:4854 -msgid "Unable to seek to end of file!" -msgstr "" - -#: readelf.c:4865 -msgid "Unable to determine the number of symbols to load\n" -msgstr "" - -#: readelf.c:4895 -msgid "Unable to seek to end of file\n" -msgstr "" - -#: readelf.c:4901 -msgid "Unable to determine the length of the dynamic string table\n" -msgstr "" - -#: readelf.c:4906 -msgid "dynamic string table" -msgstr "" - -#: readelf.c:4941 -msgid "symbol information" -msgstr "" - -#: readelf.c:4965 +#: readelf.c:5612 #, c-format msgid "" "\n" -"Dynamic segment at offset 0x%lx contains %ld entries:\n" +"There is no dynamic section in this file.\n" msgstr "" -#: readelf.c:4968 +#: readelf.c:5650 +msgid "Unable to seek to end of file!" +msgstr "" + +#: readelf.c:5663 +msgid "Unable to determine the number of symbols to load\n" +msgstr "" + +#: readelf.c:5698 +msgid "Unable to seek to end of file\n" +msgstr "" + +#: readelf.c:5705 +msgid "Unable to determine the length of the dynamic string table\n" +msgstr "" + +#: readelf.c:5710 +msgid "dynamic string table" +msgstr "" + +#: readelf.c:5745 +msgid "symbol information" +msgstr "" + +#: readelf.c:5770 +#, c-format +msgid "" +"\n" +"Dynamic section at offset 0x%lx contains %u entries:\n" +msgstr "" + +#: readelf.c:5773 +#, c-format msgid " Tag Type Name/Value\n" msgstr "" -#: readelf.c:5004 +#: readelf.c:5809 +#, c-format msgid "Auxiliary library" msgstr "" -#: readelf.c:5008 +#: readelf.c:5813 +#, c-format msgid "Filter library" msgstr "" -#: readelf.c:5012 +#: readelf.c:5817 +#, c-format msgid "Configuration file" msgstr "" -#: readelf.c:5016 +#: readelf.c:5821 +#, c-format msgid "Dependency audit library" msgstr "" -#: readelf.c:5020 +#: readelf.c:5825 +#, c-format msgid "Audit library" msgstr "" -#: readelf.c:5038 readelf.c:5066 readelf.c:5094 +#: readelf.c:5843 readelf.c:5871 readelf.c:5899 +#, c-format msgid "Flags:" msgstr "" -#: readelf.c:5041 readelf.c:5069 readelf.c:5096 +#: readelf.c:5846 readelf.c:5874 readelf.c:5901 +#, c-format msgid " None\n" msgstr "" -#: readelf.c:5217 +#: readelf.c:6022 #, c-format msgid "Shared library: [%s]" msgstr "" -#: readelf.c:5220 +#: readelf.c:6025 +#, c-format msgid " program interpreter" msgstr "" -#: readelf.c:5224 +#: readelf.c:6029 #, c-format msgid "Library soname: [%s]" msgstr "" -#: readelf.c:5228 +#: readelf.c:6033 #, c-format msgid "Library rpath: [%s]" msgstr "" -#: readelf.c:5232 +#: readelf.c:6037 #, c-format msgid "Library runpath: [%s]" msgstr "" -#: readelf.c:5296 +#: readelf.c:6100 #, c-format msgid "Not needed object: [%s]\n" msgstr "" -#: readelf.c:5412 +#: readelf.c:6214 #, c-format msgid "" "\n" "Version definition section '%s' contains %ld entries:\n" msgstr "" -#: readelf.c:5415 +#: readelf.c:6217 +#, c-format msgid " Addr: 0x" msgstr "" -#: readelf.c:5417 readelf.c:5612 +#: readelf.c:6219 readelf.c:6426 #, c-format msgid " Offset: %#08lx Link: %lx (%s)\n" msgstr "" -#: readelf.c:5424 +#: readelf.c:6228 msgid "version definition section" msgstr "" -#: readelf.c:5450 +#: readelf.c:6254 #, c-format msgid " %#06x: Rev: %d Flags: %s" msgstr "" -#: readelf.c:5453 +#: readelf.c:6257 #, c-format msgid " Index: %d Cnt: %d " msgstr "" -#: readelf.c:5464 +#: readelf.c:6268 #, c-format msgid "Name: %s\n" msgstr "" -#: readelf.c:5466 +#: readelf.c:6270 #, c-format msgid "Name index: %ld\n" msgstr "" -#: readelf.c:5481 +#: readelf.c:6285 #, c-format msgid " %#06x: Parent %d: %s\n" msgstr "" -#: readelf.c:5484 +#: readelf.c:6288 #, c-format msgid " %#06x: Parent %d, name index: %ld\n" msgstr "" -#: readelf.c:5503 +#: readelf.c:6307 #, c-format msgid "" "\n" "Version needs section '%s' contains %ld entries:\n" msgstr "" -#: readelf.c:5506 +#: readelf.c:6310 +#, c-format msgid " Addr: 0x" msgstr "" -#: readelf.c:5508 +#: readelf.c:6312 #, c-format msgid " Offset: %#08lx Link to section: %ld (%s)\n" msgstr "" -#: readelf.c:5514 +#: readelf.c:6321 msgid "version need section" msgstr "" -#: readelf.c:5536 +#: readelf.c:6343 #, c-format msgid " %#06x: Version: %d" msgstr "" -#: readelf.c:5539 +#: readelf.c:6346 #, c-format msgid " File: %s" msgstr "" -#: readelf.c:5541 +#: readelf.c:6348 #, c-format msgid " File: %lx" msgstr "" -#: readelf.c:5543 +#: readelf.c:6350 #, c-format msgid " Cnt: %d\n" msgstr "" -#: readelf.c:5561 +#: readelf.c:6368 #, c-format -msgid " %#06x: Name: %s" +msgid " %#06x: Name: %s" msgstr "" -#: readelf.c:5564 +#: readelf.c:6371 #, c-format -msgid " %#06x: Name index: %lx" +msgid " %#06x: Name index: %lx" msgstr "" -#: readelf.c:5567 +#: readelf.c:6374 #, c-format msgid " Flags: %s Version: %d\n" msgstr "" -#: readelf.c:5603 +#: readelf.c:6417 msgid "version string table" msgstr "" -#: readelf.c:5607 +#: readelf.c:6421 #, c-format msgid "" "\n" "Version symbols section '%s' contains %d entries:\n" msgstr "" -#: readelf.c:5610 +#: readelf.c:6424 +#, c-format msgid " Addr: " msgstr "" -#: readelf.c:5622 +#: readelf.c:6434 msgid "version symbol data" msgstr "" -#: readelf.c:5649 +#: readelf.c:6461 msgid " 0 (*local*) " msgstr "" -#: readelf.c:5653 +#: readelf.c:6465 msgid " 1 (*global*) " msgstr "" -#: readelf.c:5689 readelf.c:6129 +#: readelf.c:6503 readelf.c:6969 msgid "version need" msgstr "" -#: readelf.c:5699 +#: readelf.c:6513 msgid "version need aux (2)" msgstr "" -#: readelf.c:5741 readelf.c:6192 +#: readelf.c:6555 readelf.c:7034 msgid "version def" msgstr "" -#: readelf.c:5760 readelf.c:6207 +#: readelf.c:6575 readelf.c:7049 msgid "version def aux" msgstr "" -#: readelf.c:5791 +#: readelf.c:6606 +#, c-format msgid "" "\n" "No version information found in this file.\n" msgstr "" -#: readelf.c:5923 +#: readelf.c:6740 msgid "Unable to read in dynamic data\n" msgstr "" -#: readelf.c:5967 +#: readelf.c:6793 msgid "Unable to seek to start of dynamic information" msgstr "" -#: readelf.c:5973 +#: readelf.c:6799 msgid "Failed to read in number of buckets\n" msgstr "" -#: readelf.c:5979 +#: readelf.c:6805 msgid "Failed to read in number of chains\n" msgstr "" -#: readelf.c:5999 +#: readelf.c:6825 +#, c-format msgid "" "\n" "Symbol table for image:\n" msgstr "" -#: readelf.c:6001 +#: readelf.c:6827 +#, c-format msgid " Num Buc: Value Size Type Bind Vis Ndx Name\n" msgstr "" -#: readelf.c:6003 +#: readelf.c:6829 +#, c-format msgid " Num Buc: Value Size Type Bind Vis Ndx Name\n" msgstr "" -#: readelf.c:6048 +#: readelf.c:6882 #, c-format msgid "" "\n" "Symbol table '%s' contains %lu entries:\n" msgstr "" -#: readelf.c:6052 +#: readelf.c:6886 +#, c-format msgid " Num: Value Size Type Bind Vis Ndx Name\n" msgstr "" -#: readelf.c:6054 +#: readelf.c:6888 +#, c-format msgid " Num: Value Size Type Bind Vis Ndx Name\n" msgstr "" -#: readelf.c:6101 +#: readelf.c:6939 msgid "version data" msgstr "" -#: readelf.c:6142 +#: readelf.c:6982 msgid "version need aux (3)" msgstr "" -#: readelf.c:6167 +#: readelf.c:7009 msgid "bad dynamic symbol" msgstr "" -#: readelf.c:6230 +#: readelf.c:7073 +#, c-format msgid "" "\n" "Dynamic symbol information is not available for displaying symbols.\n" msgstr "" -#: readelf.c:6242 +#: readelf.c:7085 #, c-format msgid "" "\n" -"Histogram for bucket list length (total of %d buckets):\n" +"Histogram for bucket list length (total of %lu buckets):\n" msgstr "" -#: readelf.c:6244 +#: readelf.c:7087 #, c-format msgid " Length Number %% of total Coverage\n" msgstr "" -#: readelf.c:6249 readelf.c:6268 readelf.c:9898 readelf.c:10090 +#: readelf.c:7092 readelf.c:7108 readelf.c:8031 readelf.c:8223 msgid "Out of memory" msgstr "" -#: readelf.c:6317 +#: readelf.c:7157 #, c-format msgid "" "\n" "Dynamic info segment at offset 0x%lx contains %d entries:\n" msgstr "" -#: readelf.c:6320 +#: readelf.c:7160 +#, c-format msgid " Num: Name BoundTo Flags\n" msgstr "" -#: readelf.c:6373 +#: readelf.c:7212 #, c-format msgid "" "\n" "Assembly dump of section %s\n" msgstr "" -#: readelf.c:6396 +#: readelf.c:7233 #, c-format msgid "" "\n" "Section '%s' has no data to dump.\n" msgstr "" -#: readelf.c:6401 +#: readelf.c:7238 #, c-format msgid "" "\n" "Hex dump of section '%s':\n" msgstr "" -#: readelf.c:6406 -msgid "section data" -msgstr "" - -#: readelf.c:6555 -msgid "badly formed extended line op encountered!\n" -msgstr "" - -#: readelf.c:6562 +#: readelf.c:7359 #, c-format -msgid " Extended opcode %d: " +msgid "skipping invalid relocation offset 0x%lx in section %s\n" msgstr "" -#: readelf.c:6567 -msgid "" -"End of Sequence\n" -"\n" -msgstr "" - -#: readelf.c:6573 +#: readelf.c:7376 #, c-format -msgid "set Address to 0x%lx\n" +msgid "skipping unexpected symbol type %s in relocation in section .rela%s\n" msgstr "" -#: readelf.c:6578 -msgid " define new File Table entry\n" -msgstr "" - -#: readelf.c:6579 readelf.c:6726 -msgid " Entry\tDir\tTime\tSize\tName\n" -msgstr "" - -#: readelf.c:6581 +#: readelf.c:7402 #, c-format -msgid " %d\t" +msgid "skipping unexpected symbol type %s in relocation in section .rela.%s\n" msgstr "" -#: readelf.c:6584 readelf.c:6586 readelf.c:6588 readelf.c:6738 readelf.c:6740 -#: readelf.c:6742 +#: readelf.c:7435 #, c-format -msgid "%lu\t" +msgid "%s section data" msgstr "" -#: readelf.c:6589 -#, c-format -msgid "" -"%s\n" -"\n" -msgstr "" - -#: readelf.c:6593 -#, c-format -msgid "UNKNOWN: length %d\n" -msgstr "" - -#: readelf.c:6621 -#, c-format -msgid "" -"\n" -"Dump of debug contents of section %s:\n" -"\n" -msgstr "" - -#: readelf.c:6649 -msgid "The line info appears to be corrupt - the section is too small\n" -msgstr "" - -#: readelf.c:6658 -msgid "Only DWARF version 2 and 3 line info is currently supported.\n" -msgstr "" - -#: readelf.c:6679 -#, c-format -msgid " Length: %ld\n" -msgstr "" - -#: readelf.c:6680 -#, c-format -msgid " DWARF Version: %d\n" -msgstr "" - -#: readelf.c:6681 -#, c-format -msgid " Prologue Length: %d\n" -msgstr "" - -#: readelf.c:6682 -#, c-format -msgid " Minimum Instruction Length: %d\n" -msgstr "" - -#: readelf.c:6683 -#, c-format -msgid " Initial value of 'is_stmt': %d\n" -msgstr "" - -#: readelf.c:6684 -#, c-format -msgid " Line Base: %d\n" -msgstr "" - -#: readelf.c:6685 -#, c-format -msgid " Line Range: %d\n" -msgstr "" - -#: readelf.c:6686 -#, c-format -msgid " Opcode Base: %d\n" -msgstr "" - -#: readelf.c:6695 -msgid "" -"\n" -" Opcodes:\n" -msgstr "" - -#: readelf.c:6698 -#, c-format -msgid " Opcode %d has %d args\n" -msgstr "" - -#: readelf.c:6704 -msgid "" -"\n" -" The Directory Table is empty.\n" -msgstr "" - -#: readelf.c:6707 -msgid "" -"\n" -" The Directory Table:\n" -msgstr "" - -#: readelf.c:6711 -#, c-format -msgid " %s\n" -msgstr "" - -#: readelf.c:6722 -msgid "" -"\n" -" The File Name Table is empty.\n" -msgstr "" - -#: readelf.c:6725 -msgid "" -"\n" -" The File Name Table:\n" -msgstr "" - -#: readelf.c:6733 -#, c-format -msgid " %d\t" -msgstr "" - -#: readelf.c:6744 -#, c-format -msgid "%s\n" -msgstr "" - -#. Now display the statements. -#: readelf.c:6752 -msgid "" -"\n" -" Line Number Statements:\n" -msgstr "" - -#: readelf.c:6768 -#, c-format -msgid " Special opcode %d: advance Address by %d to 0x%lx" -msgstr "" - -#: readelf.c:6772 -#, c-format -msgid " and Line by %d to %d\n" -msgstr "" - -#: readelf.c:6783 -msgid " Copy\n" -msgstr "" - -#: readelf.c:6790 -#, c-format -msgid " Advance PC by %d to %lx\n" -msgstr "" - -#: readelf.c:6798 -#, c-format -msgid " Advance Line by %d to %d\n" -msgstr "" - -#: readelf.c:6805 -#, c-format -msgid " Set File Name to entry %d in the File Name Table\n" -msgstr "" - -#: readelf.c:6813 -#, c-format -msgid " Set column to %d\n" -msgstr "" - -#: readelf.c:6820 -#, c-format -msgid " Set is_stmt to %d\n" -msgstr "" - -#: readelf.c:6825 -msgid " Set basic block\n" -msgstr "" - -#: readelf.c:6833 -#, c-format -msgid " Advance PC by constant %d to 0x%lx\n" -msgstr "" - -#: readelf.c:6841 -#, c-format -msgid " Advance PC by fixed size amount %d to 0x%lx\n" -msgstr "" - -#: readelf.c:6846 -msgid " Set prologue_end to true\n" -msgstr "" - -#: readelf.c:6850 -msgid " Set epilogue_begin to true\n" -msgstr "" - -#: readelf.c:6856 -#, c-format -msgid " Set ISA to %d\n" -msgstr "" - -#: readelf.c:6860 -#, c-format -msgid " Unknown opcode %d with operands: " -msgstr "" - -#: readelf.c:6891 readelf.c:7371 readelf.c:7443 -#, c-format -msgid "" -"Contents of the %s section:\n" -"\n" -msgstr "" - -#: readelf.c:6931 -msgid "Only DWARF 2 and 3 pubnames are currently supported\n" -msgstr "" - -#: readelf.c:6938 -#, c-format -msgid " Length: %ld\n" -msgstr "" - -#: readelf.c:6940 -#, c-format -msgid " Version: %d\n" -msgstr "" - -#: readelf.c:6942 -#, c-format -msgid " Offset into .debug_info section: %ld\n" -msgstr "" - -#: readelf.c:6944 -#, c-format -msgid " Size of area in .debug_info section: %ld\n" -msgstr "" - -#: readelf.c:6947 -msgid "" -"\n" -" Offset\tName\n" -msgstr "" - -#: readelf.c:7042 -#, c-format -msgid "Unknown TAG value: %lx" -msgstr "" - -#: readelf.c:7156 -#, c-format -msgid "Unknown AT value: %lx" -msgstr "" - -#: readelf.c:7193 -#, c-format -msgid "Unknown FORM value: %lx" -msgstr "" - -#: readelf.c:7392 -#, c-format -msgid " DW_MACINFO_start_file - lineno: %d filenum: %d\n" -msgstr "" - -#: readelf.c:7397 -msgid " DW_MACINFO_end_file\n" -msgstr "" - -#: readelf.c:7405 -#, c-format -msgid " DW_MACINFO_define - lineno : %d macro : %s\n" -msgstr "" - -#: readelf.c:7413 -#, c-format -msgid " DW_MACINFO_undef - lineno : %d macro : %s\n" -msgstr "" - -#: readelf.c:7424 -#, c-format -msgid " DW_MACINFO_vendor_ext - constant : %d string : %s\n" -msgstr "" - -#: readelf.c:7452 -msgid " Number TAG\n" -msgstr "" - -#: readelf.c:7458 -#, c-format -msgid " %ld %s [%s]\n" -msgstr "" - -#: readelf.c:7461 -msgid "has children" -msgstr "" - -#: readelf.c:7461 -msgid "no children" -msgstr "" - -#: readelf.c:7465 -#, c-format -msgid " %-18s %s\n" -msgstr "" - -#: readelf.c:7486 -#, c-format -msgid " %lu byte block: " -msgstr "" - -#: readelf.c:7814 -msgid "(User defined location op)" -msgstr "" - -#: readelf.c:7816 -msgid "(Unknown location op)" -msgstr "" - -#: readelf.c:7855 -msgid "debug_loc section data" -msgstr "" - -#: readelf.c:7887 -msgid "" -"\n" -"The .debug_loc section is empty.\n" -msgstr "" - -#: readelf.c:7891 -msgid "" -"Contents of the .debug_loc section:\n" -"\n" -msgstr "" - -#: readelf.c:7892 -msgid "" -"\n" -" Offset Begin End Expression\n" -msgstr "" - -#: readelf.c:7968 -msgid "debug_str section data" -msgstr "" - -#: readelf.c:7987 -msgid "" -msgstr "" - -#: readelf.c:7990 -msgid "" -msgstr "" - -#: readelf.c:8009 -msgid "" -"\n" -"The .debug_str section is empty.\n" -msgstr "" - -#: readelf.c:8013 -msgid "" -"Contents of the .debug_str section:\n" -"\n" -msgstr "" - -#: readelf.c:8088 -msgid "Internal error: DWARF version is not 2 or 3.\n" -msgstr "" - -#: readelf.c:8203 -#, c-format -msgid " (indirect string, offset: 0x%lx): %s" -msgstr "" - -#: readelf.c:8212 -#, c-format -msgid "Unrecognized form: %d\n" -msgstr "" - -#: readelf.c:8226 -msgid "(not inlined)" -msgstr "" - -#: readelf.c:8229 -msgid "(inlined)" -msgstr "" - -#: readelf.c:8232 -msgid "(declared as inline but ignored)" -msgstr "" - -#: readelf.c:8235 -msgid "(declared as inline and inlined)" -msgstr "" - -#: readelf.c:8238 -#, c-format -msgid " (Unknown inline attribute value: %lx)" -msgstr "" - -#: readelf.c:8419 readelf.c:8646 -#, c-format -msgid "" -"The section %s contains:\n" -"\n" -msgstr "" - -#: readelf.c:8535 -#, c-format -msgid " Compilation Unit @ %lx:\n" -msgstr "" - -#: readelf.c:8536 -#, c-format -msgid " Length: %ld\n" -msgstr "" - -#: readelf.c:8537 -#, c-format -msgid " Version: %d\n" -msgstr "" - -#: readelf.c:8538 -#, c-format -msgid " Abbrev Offset: %ld\n" -msgstr "" - -#: readelf.c:8539 -#, c-format -msgid " Pointer Size: %d\n" -msgstr "" - -#: readelf.c:8543 -msgid "Only version 2 and 3 DWARF debug information is currently supported.\n" -msgstr "" - -#: readelf.c:8563 -msgid "Unable to locate .debug_abbrev section!\n" -msgstr "" - -#: readelf.c:8569 -msgid "debug_abbrev section data" -msgstr "" - -#: readelf.c:8606 -#, c-format -msgid "Unable to locate entry %lu in the abbreviation table\n" -msgstr "" - -#: readelf.c:8611 -#, c-format -msgid " <%d><%lx>: Abbrev Number: %lu (%s)\n" -msgstr "" - -#: readelf.c:8691 -msgid "Only DWARF 2 and 3 aranges are currently supported.\n" -msgstr "" - -#: readelf.c:8695 -#, c-format -msgid " Length: %ld\n" -msgstr "" - -#: readelf.c:8696 -#, c-format -msgid " Version: %d\n" -msgstr "" - -#: readelf.c:8697 -#, c-format -msgid " Offset into .debug_info: %lx\n" -msgstr "" - -#: readelf.c:8698 -#, c-format -msgid " Pointer Size: %d\n" -msgstr "" - -#: readelf.c:8699 -#, c-format -msgid " Segment Size: %d\n" -msgstr "" - -#: readelf.c:8701 -msgid "" -"\n" -" Address Length\n" -msgstr "" - -#: readelf.c:8903 -#, c-format -msgid "The section %s contains:\n" -msgstr "" - -#: readelf.c:9538 -#, c-format -msgid "Displaying the debug contents of section %s is not yet supported.\n" -msgstr "" - -#: readelf.c:9634 +#: readelf.c:7472 #, c-format msgid "" "\n" "Section '%s' has no debugging data.\n" msgstr "" -#: readelf.c:9639 readelf.c:9701 -msgid "debug section data" -msgstr "" - -#: readelf.c:9655 +#: readelf.c:7498 #, c-format msgid "Unrecognized debug section: %s\n" msgstr "" -#: readelf.c:9729 -msgid "Some sections were not dumped because they do not exist!\n" +#: readelf.c:7533 +#, c-format +msgid "Section %d was not dumped because it does not exist!\n" msgstr "" -#: readelf.c:9806 readelf.c:10170 +#: readelf.c:7791 +msgid "attributes" +msgstr "" + +#: readelf.c:7809 +#, c-format +msgid "ERROR: Bad section length (%d > %d)\n" +msgstr "" + +#: readelf.c:7830 +#, c-format +msgid "ERROR: Bad subsection length (%d > %d)\n" +msgstr "" + +#: readelf.c:7880 +#, c-format +msgid "Unknown format '%c'\n" +msgstr "" + +#: readelf.c:7936 readelf.c:8304 msgid "liblist" msgstr "" -#: readelf.c:9891 +#: readelf.c:8025 msgid "options" msgstr "" -#: readelf.c:9922 +#: readelf.c:8055 #, c-format msgid "" "\n" "Section '%s' contains %d entries:\n" msgstr "" -#: readelf.c:10083 +#: readelf.c:8216 msgid "conflict list found without a dynamic symbol table" msgstr "" -#: readelf.c:10101 readelf.c:10117 +#: readelf.c:8232 readelf.c:8246 msgid "conflict" msgstr "" -#: readelf.c:10127 +#: readelf.c:8256 #, c-format msgid "" "\n" -"Section '.conflict' contains %ld entries:\n" +"Section '.conflict' contains %lu entries:\n" msgstr "" -#: readelf.c:10129 +#: readelf.c:8258 msgid " Num: Index Value Name" msgstr "" -#: readelf.c:10178 +#: readelf.c:8311 msgid "liblist string table" msgstr "" -#: readelf.c:10187 +#: readelf.c:8321 #, c-format msgid "" "\n" "Library list section '%s' contains %lu entries:\n" msgstr "" -#: readelf.c:10236 +#: readelf.c:8374 +msgid "NT_AUXV (auxiliary vector)" +msgstr "" + +#: readelf.c:8376 msgid "NT_PRSTATUS (prstatus structure)" msgstr "" -#: readelf.c:10237 +#: readelf.c:8378 msgid "NT_FPREGSET (floating point registers)" msgstr "" -#: readelf.c:10238 +#: readelf.c:8380 msgid "NT_PRPSINFO (prpsinfo structure)" msgstr "" -#: readelf.c:10239 +#: readelf.c:8382 msgid "NT_TASKSTRUCT (task structure)" msgstr "" -#: readelf.c:10240 +#: readelf.c:8384 msgid "NT_PRXFPREG (user_xfpregs structure)" msgstr "" -#: readelf.c:10241 +#: readelf.c:8386 msgid "NT_PSTATUS (pstatus structure)" msgstr "" -#: readelf.c:10242 +#: readelf.c:8388 msgid "NT_FPREGS (floating point registers)" msgstr "" -#: readelf.c:10243 +#: readelf.c:8390 msgid "NT_PSINFO (psinfo structure)" msgstr "" -#: readelf.c:10244 +#: readelf.c:8392 msgid "NT_LWPSTATUS (lwpstatus_t structure)" msgstr "" -#: readelf.c:10245 +#: readelf.c:8394 msgid "NT_LWPSINFO (lwpsinfo_t structure)" msgstr "" -#: readelf.c:10246 +#: readelf.c:8396 msgid "NT_WIN32PSTATUS (win32_pstatus structure)" msgstr "" -#: readelf.c:10248 readelf.c:10272 +#: readelf.c:8404 +msgid "NT_VERSION (version)" +msgstr "" + +#: readelf.c:8406 +msgid "NT_ARCH (architecture)" +msgstr "" + +#: readelf.c:8411 readelf.c:8433 #, c-format msgid "Unknown note type: (0x%08x)" msgstr "" #. NetBSD core "procinfo" structure. -#: readelf.c:10262 +#: readelf.c:8423 msgid "NetBSD procinfo structure" msgstr "" -#: readelf.c:10289 readelf.c:10303 +#: readelf.c:8450 readelf.c:8464 msgid "PT_GETREGS (reg structure)" msgstr "" -#: readelf.c:10291 readelf.c:10305 +#: readelf.c:8452 readelf.c:8466 msgid "PT_GETFPREGS (fpreg structure)" msgstr "" -#: readelf.c:10311 +#: readelf.c:8472 #, c-format msgid "PT_FIRSTMACH+%d" msgstr "" -#: readelf.c:10365 +#: readelf.c:8518 msgid "notes" msgstr "" -#: readelf.c:10371 +#: readelf.c:8524 #, c-format msgid "" "\n" "Notes at offset 0x%08lx with length 0x%08lx:\n" msgstr "" -#: readelf.c:10373 +#: readelf.c:8526 +#, c-format msgid " Owner\t\tData size\tDescription\n" msgstr "" -#: readelf.c:10392 +#: readelf.c:8545 #, c-format -msgid "corrupt note found at offset %x into core notes\n" +msgid "corrupt note found at offset %lx into core notes\n" msgstr "" -#: readelf.c:10394 +#: readelf.c:8547 #, c-format -msgid " type: %x, namesize: %08lx, descsize: %08lx\n" +msgid " type: %lx, namesize: %08lx, descsize: %08lx\n" msgstr "" -#: readelf.c:10476 +#: readelf.c:8645 +#, c-format msgid "No note segments present in the core file.\n" msgstr "" -#: readelf.c:10560 +#: readelf.c:8726 msgid "" "This instance of readelf has been built without support for a\n" "64 bit data type and so it cannot read 64 bit ELF files.\n" msgstr "" -#: readelf.c:10606 -#, c-format -msgid "Cannot stat input file %s.\n" -msgstr "" - -#: readelf.c:10613 -#, c-format -msgid "Input file %s not found.\n" -msgstr "" - -#: readelf.c:10619 +#: readelf.c:8775 readelf.c:9119 #, c-format msgid "%s: Failed to read file header\n" msgstr "" -#: readelf.c:10633 +#: readelf.c:8788 #, c-format msgid "" "\n" "File: %s\n" msgstr "" -#: rename.c:132 +#: readelf.c:8936 readelf.c:8957 readelf.c:8994 readelf.c:9074 +#, c-format +msgid "%s: failed to read archive header\n" +msgstr "" + +#: readelf.c:8947 +#, c-format +msgid "%s: failed to skip archive symbol table\n" +msgstr "" + +#: readelf.c:8979 +#, c-format +msgid "%s: failed to read string table\n" +msgstr "" + +#: readelf.c:9015 +#, c-format +msgid "%s: invalid archive string table offset %lu\n" +msgstr "" + +#: readelf.c:9031 +#, c-format +msgid "%s: bad archive file name\n" +msgstr "" + +#: readelf.c:9063 +#, c-format +msgid "%s: failed to seek to next archive header\n" +msgstr "" + +#: readelf.c:9097 +#, c-format +msgid "'%s': No such file\n" +msgstr "" + +#: readelf.c:9099 +#, c-format +msgid "Could not locate '%s'. System error message: %s\n" +msgstr "" + +#: readelf.c:9106 +#, c-format +msgid "'%s' is not an ordinary file\n" +msgstr "" + +#: readelf.c:9113 +#, c-format +msgid "Input file '%s' is not readable.\n" +msgstr "" + +#: rename.c:129 #, c-format msgid "%s: cannot set time: %s" msgstr "" #. We have to clean up here. -#: rename.c:171 rename.c:204 +#: rename.c:164 rename.c:202 #, c-format -msgid "%s: rename: %s" +msgid "unable to rename '%s' reason: %s" msgstr "" -#: rename.c:212 +#: rename.c:210 #, c-format -msgid "%s: simple_copy: %s" +msgid "unable to copy file '%s' reason: %s" msgstr "" -#: resbin.c:134 +#: resbin.c:132 #, c-format msgid "%s: not enough binary data" msgstr "" -#: resbin.c:153 +#: resbin.c:148 msgid "null terminated unicode string" msgstr "" -#: resbin.c:183 resbin.c:189 +#: resbin.c:175 resbin.c:181 msgid "resource ID" msgstr "" -#: resbin.c:233 +#: resbin.c:221 msgid "cursor" msgstr "" -#: resbin.c:267 resbin.c:274 +#: resbin.c:253 resbin.c:260 msgid "menu header" msgstr "" -#: resbin.c:284 +#: resbin.c:270 msgid "menuex header" msgstr "" -#: resbin.c:288 +#: resbin.c:274 msgid "menuex offset" msgstr "" -#: resbin.c:295 +#: resbin.c:281 #, c-format msgid "unsupported menu version %d" msgstr "" -#: resbin.c:323 resbin.c:338 resbin.c:404 +#: resbin.c:306 resbin.c:321 resbin.c:384 msgid "menuitem header" msgstr "" -#: resbin.c:434 +#: resbin.c:414 msgid "menuitem" msgstr "" -#: resbin.c:475 resbin.c:503 +#: resbin.c:453 resbin.c:481 msgid "dialog header" msgstr "" -#: resbin.c:493 +#: resbin.c:471 #, c-format msgid "unexpected DIALOGEX version %d" msgstr "" -#: resbin.c:538 +#: resbin.c:516 msgid "dialog font point size" msgstr "" -#: resbin.c:546 +#: resbin.c:524 msgid "dialogex font information" msgstr "" -#: resbin.c:572 resbin.c:590 +#: resbin.c:550 resbin.c:568 msgid "dialog control" msgstr "" -#: resbin.c:582 +#: resbin.c:560 msgid "dialogex control" msgstr "" -#: resbin.c:611 +#: resbin.c:589 msgid "dialog control end" msgstr "" -#: resbin.c:623 +#: resbin.c:601 msgid "dialog control data" msgstr "" -#: resbin.c:666 +#: resbin.c:642 msgid "stringtable string length" msgstr "" -#: resbin.c:676 +#: resbin.c:652 msgid "stringtable string" msgstr "" -#: resbin.c:709 +#: resbin.c:683 msgid "fontdir header" msgstr "" -#: resbin.c:722 +#: resbin.c:696 msgid "fontdir" msgstr "" -#: resbin.c:738 +#: resbin.c:712 msgid "fontdir device name" msgstr "" -#: resbin.c:744 +#: resbin.c:718 msgid "fontdir face name" msgstr "" -#: resbin.c:787 +#: resbin.c:759 msgid "accelerator" msgstr "" -#: resbin.c:851 +#: resbin.c:819 msgid "group cursor header" msgstr "" -#: resbin.c:855 +#: resbin.c:823 #, c-format msgid "unexpected group cursor type %d" msgstr "" -#: resbin.c:870 +#: resbin.c:838 msgid "group cursor" msgstr "" -#: resbin.c:909 +#: resbin.c:875 msgid "group icon header" msgstr "" -#: resbin.c:913 +#: resbin.c:879 #, c-format msgid "unexpected group icon type %d" msgstr "" -#: resbin.c:928 +#: resbin.c:894 msgid "group icon" msgstr "" -#: resbin.c:999 resbin.c:1218 +#: resbin.c:957 resbin.c:1174 msgid "unexpected version string" msgstr "" -#: resbin.c:1033 +#: resbin.c:989 #, c-format msgid "version length %d does not match resource length %lu" msgstr "" -#: resbin.c:1037 +#: resbin.c:993 #, c-format msgid "unexpected version type %d" msgstr "" -#: resbin.c:1049 +#: resbin.c:1005 #, c-format msgid "unexpected fixed version information length %d" msgstr "" -#: resbin.c:1052 +#: resbin.c:1008 msgid "fixed version info" msgstr "" -#: resbin.c:1056 +#: resbin.c:1012 #, c-format msgid "unexpected fixed version signature %lu" msgstr "" -#: resbin.c:1060 +#: resbin.c:1016 #, c-format msgid "unexpected fixed version info version %lu" msgstr "" -#: resbin.c:1089 +#: resbin.c:1045 msgid "version var info" msgstr "" -#: resbin.c:1106 +#: resbin.c:1062 #, c-format msgid "unexpected stringfileinfo value length %d" msgstr "" -#: resbin.c:1116 +#: resbin.c:1072 #, c-format msgid "unexpected version stringtable value length %d" msgstr "" -#: resbin.c:1150 +#: resbin.c:1106 #, c-format msgid "unexpected version string length %d != %d + %d" msgstr "" -#: resbin.c:1161 +#: resbin.c:1117 #, c-format msgid "unexpected version string length %d < %d" msgstr "" -#: resbin.c:1178 +#: resbin.c:1134 #, c-format msgid "unexpected varfileinfo value length %d" msgstr "" -#: resbin.c:1197 +#: resbin.c:1153 msgid "version varfileinfo" msgstr "" -#: resbin.c:1212 +#: resbin.c:1168 #, c-format msgid "unexpected version value length %d" msgstr "" -#: rescoff.c:128 +#: rescoff.c:126 msgid "filename required for COFF input" msgstr "" -#: rescoff.c:145 +#: rescoff.c:143 #, c-format msgid "%s: no resource section" msgstr "" -#: rescoff.c:152 +#: rescoff.c:150 msgid "can't read resource section" msgstr "" -#: rescoff.c:178 +#: rescoff.c:174 #, c-format msgid "%s: %s: address out of bounds" msgstr "" -#: rescoff.c:197 +#: rescoff.c:190 msgid "directory" msgstr "" -#: rescoff.c:225 +#: rescoff.c:218 msgid "named directory entry" msgstr "" -#: rescoff.c:234 +#: rescoff.c:227 msgid "directory entry name" msgstr "" -#: rescoff.c:254 +#: rescoff.c:247 msgid "named subdirectory" msgstr "" -#: rescoff.c:262 +#: rescoff.c:255 msgid "named resource" msgstr "" -#: rescoff.c:277 +#: rescoff.c:270 msgid "ID directory entry" msgstr "" -#: rescoff.c:294 +#: rescoff.c:287 msgid "ID subdirectory" msgstr "" -#: rescoff.c:302 +#: rescoff.c:295 msgid "ID resource" msgstr "" -#: rescoff.c:328 +#: rescoff.c:318 msgid "resource type unknown" msgstr "" -#: rescoff.c:331 +#: rescoff.c:321 msgid "data entry" msgstr "" -#: rescoff.c:339 +#: rescoff.c:329 msgid "resource data" msgstr "" -#: rescoff.c:344 +#: rescoff.c:334 msgid "resource data size" msgstr "" -#: rescoff.c:439 +#: rescoff.c:427 msgid "filename required for COFF output" msgstr "" -#: rescoff.c:738 +#: rescoff.c:719 msgid "can't get BFD_RELOC_RVA relocation type" msgstr "" -#: resrc.c:240 resrc.c:312 +#: resrc.c:238 resrc.c:309 #, c-format msgid "can't open temporary file `%s': %s" msgstr "" -#: resrc.c:246 +#: resrc.c:244 #, c-format msgid "can't redirect stdout: `%s': %s" msgstr "" -#: resrc.c:262 +#: resrc.c:260 #, c-format msgid "%s %s: %s" msgstr "" -#: resrc.c:308 +#: resrc.c:305 #, c-format msgid "can't execute `%s': %s" msgstr "" -#: resrc.c:317 +#: resrc.c:314 #, c-format msgid "Using temporary file `%s' to read preprocessor output\n" msgstr "" -#: resrc.c:324 +#: resrc.c:321 #, c-format msgid "can't popen `%s': %s" msgstr "" -#: resrc.c:326 +#: resrc.c:323 +#, c-format msgid "Using popen to read preprocessor output\n" msgstr "" -#: resrc.c:369 +#: resrc.c:362 #, c-format msgid "Tried `%s'\n" msgstr "" -#: resrc.c:380 +#: resrc.c:373 #, c-format msgid "Using `%s'\n" msgstr "" -#: resrc.c:542 +#: resrc.c:529 #, c-format msgid "%s:%d: %s\n" msgstr "" -#: resrc.c:551 +#: resrc.c:537 #, c-format msgid "%s: unexpected EOF" msgstr "" -#: resrc.c:608 +#: resrc.c:586 #, c-format msgid "%s: read of %lu returned %lu" msgstr "" -#: resrc.c:650 resrc.c:905 resrc.c:1178 resrc.c:1332 +#: resrc.c:624 resrc.c:1134 #, c-format msgid "stat failed on bitmap file `%s': %s" msgstr "" -#: resrc.c:703 +#: resrc.c:675 #, c-format msgid "cursor file `%s' does not contain cursor data" msgstr "" -#: resrc.c:735 resrc.c:1049 +#: resrc.c:707 resrc.c:1003 #, c-format msgid "%s: fseek to %lu failed: %s" msgstr "" -#: resrc.c:873 +#: resrc.c:831 msgid "help ID requires DIALOGEX" msgstr "" -#: resrc.c:875 +#: resrc.c:833 msgid "control data requires DIALOGEX" msgstr "" -#: resrc.c:1018 +#: resrc.c:861 +#, c-format +msgid "stat failed on font file `%s': %s" +msgstr "" + +#: resrc.c:972 #, c-format msgid "icon file `%s' does not contain icon data" msgstr "" -#: resrc.c:1537 +#: resrc.c:1273 resrc.c:1308 +#, c-format +msgid "stat failed on file `%s': %s" +msgstr "" + +#: resrc.c:1494 #, c-format msgid "can't open `%s' for output: %s" msgstr "" -#: size.c:86 +#: size.c:83 +#, c-format msgid " Displays the sizes of sections inside binary files\n" msgstr "" -#: size.c:87 +#: size.c:84 +#, c-format msgid " If no input file(s) are specified, a.out is assumed\n" msgstr "" -#: size.c:88 +#: size.c:85 #, c-format msgid "" " The options are:\n" @@ -4271,150 +4910,194 @@ msgid "" " -t --totals Display the total sizes (Berkeley " "only)\n" " --target= Set the binary file format\n" +" @ Read options from \n" " -h --help Display this information\n" " -v --version Display the program's version\n" "\n" msgstr "" -#: size.c:160 +#: size.c:158 #, c-format msgid "invalid argument to --format: %s" msgstr "" -#: size.c:187 +#: size.c:185 #, c-format msgid "Invalid radix: %s\n" msgstr "" -#: srconv.c:1953 +#: srconv.c:1722 +#, c-format msgid "Convert a COFF object file into a SYSROFF object file\n" msgstr "" -#: srconv.c:1954 +#: srconv.c:1723 +#, c-format msgid "" " The options are:\n" -" -q --quick (Obsolete - ignoerd)\n" +" -q --quick (Obsolete - ignored)\n" " -n --noprescan Do not perform a scan to convert commons into defs\n" " -d --debug Display information about what is being done\n" +" @ Read options from \n" " -h --help Display this information\n" " -v --version Print the program's version number\n" msgstr "" -#: srconv.c:2099 +#: srconv.c:1869 #, c-format msgid "unable to open output file %s" msgstr "" -#: stabs.c:346 stabs.c:1755 +#: stabs.c:330 stabs.c:1708 msgid "numeric overflow" msgstr "" -#: stabs.c:357 +#: stabs.c:340 #, c-format msgid "Bad stab: %s\n" msgstr "" -#: stabs.c:367 +#: stabs.c:348 #, c-format msgid "Warning: %s: %s\n" msgstr "" -#: stabs.c:488 +#: stabs.c:458 +#, c-format msgid "N_LBRAC not within function\n" msgstr "" -#: stabs.c:527 +#: stabs.c:497 +#, c-format msgid "Too many N_RBRACs\n" msgstr "" -#: stabs.c:773 +#: stabs.c:738 msgid "unknown C++ encoded name" msgstr "" #. Complain and keep going, so compilers can invent new #. cross-reference types. -#: stabs.c:1293 +#: stabs.c:1253 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:1847 +#: stabs.c:1800 msgid "missing index type" msgstr "" -#: stabs.c:2174 +#: stabs.c:2114 msgid "unknown virtual character for baseclass" msgstr "" -#: stabs.c:2192 +#: stabs.c:2132 msgid "unknown visibility character for baseclass" msgstr "" -#: stabs.c:2384 +#: stabs.c:2318 msgid "unnamed $vb type" msgstr "" -#: stabs.c:2390 +#: stabs.c:2324 msgid "unrecognized C++ abbreviation" msgstr "" -#: stabs.c:2470 +#: stabs.c:2400 msgid "unknown visibility character for field" msgstr "" -#: stabs.c:2726 +#: stabs.c:2652 msgid "const/volatile indicator missing" msgstr "" -#: stabs.c:2967 +#: stabs.c:2888 #, c-format msgid "No mangling for \"%s\"\n" msgstr "" -#: stabs.c:3281 +#: stabs.c:3188 msgid "Undefined N_EXCL" msgstr "" -#: stabs.c:3369 +#: stabs.c:3268 #, c-format msgid "Type file number %d out of range\n" msgstr "" -#: stabs.c:3374 +#: stabs.c:3273 #, c-format msgid "Type index number %d out of range\n" msgstr "" -#: stabs.c:3461 +#: stabs.c:3352 #, c-format msgid "Unrecognized XCOFF type %d\n" msgstr "" -#: stabs.c:3762 +#: stabs.c:3644 #, c-format msgid "bad mangled name `%s'\n" msgstr "" -#: stabs.c:3859 +#: stabs.c:3739 +#, c-format msgid "no argument types in mangled string\n" msgstr "" -#: strings.c:208 +#: stabs.c:5093 +#, c-format +msgid "Demangled name is not a function\n" +msgstr "" + +#: stabs.c:5135 +#, c-format +msgid "Unexpected type in v3 arglist demangling\n" +msgstr "" + +#: stabs.c:5202 +#, c-format +msgid "Unrecognized demangle component %d\n" +msgstr "" + +#: stabs.c:5254 +#, c-format +msgid "Failed to print demangled template\n" +msgstr "" + +#: stabs.c:5334 +#, c-format +msgid "Couldn't get demangled builtin type\n" +msgstr "" + +#: stabs.c:5383 +#, c-format +msgid "Unexpected demangled varargs\n" +msgstr "" + +#: stabs.c:5390 +#, c-format +msgid "Unrecognized demangled builtin type\n" +msgstr "" + +#: strings.c:218 #, c-format msgid "invalid number %s" msgstr "" -#: strings.c:647 +#: strings.c:700 #, c-format msgid "invalid integer argument %s" msgstr "" -#: strings.c:658 +#: strings.c:709 +#, c-format msgid " Display printable strings in [file(s)] (stdin by default)\n" msgstr "" -#: strings.c:659 +#: strings.c:710 +#, c-format msgid "" " The options are:\n" " -a - --all Scan the entire file, not just the data section\n" @@ -4422,87 +5105,96 @@ msgid "" " -n --bytes=[number] Locate & print any NUL-terminated sequence of " "at\n" " - least [number] characters (default 4).\n" -" -t --radix={o,x,d} Print the location of the string in base 8, 10 " +" -t --radix={o,d,x} Print the location of the string in base 8, 10 " "or 16\n" " -o An alias for --radix=o\n" " -T --target= Specify the binary file format\n" " -e --encoding={s,S,b,l,B,L} Select character size and endianness:\n" " s = 7-bit, S = 8-bit, {b,l} = 16-bit, {B,L} = 32-" "bit\n" +" @ Read options from \n" " -h --help Display this information\n" " -v --version Print the program's version number\n" msgstr "" -#: sysdump.c:768 +#: sysdump.c:642 +#, c-format msgid "Print a human readable interpretation of a SYSROFF object file\n" msgstr "" -#: sysdump.c:769 +#: sysdump.c:643 +#, c-format msgid "" " The options are:\n" " -h --help Display this information\n" " -v --version Print the program's version number\n" msgstr "" -#: sysdump.c:836 +#: sysdump.c:710 #, c-format msgid "cannot open input file %s" msgstr "" -#: version.c:36 -msgid "Copyright 2002 Free Software Foundation, Inc.\n" +#: version.c:35 +#, c-format +msgid "Copyright 2005 Free Software Foundation, Inc.\n" msgstr "" -#: version.c:37 +#: version.c:36 +#, c-format 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:205 +#: windres.c:204 #, c-format msgid "can't open %s `%s': %s" msgstr "" -#: windres.c:384 +#: windres.c:370 +#, c-format msgid ": expected to be a directory\n" msgstr "" -#: windres.c:396 +#: windres.c:382 +#, c-format msgid ": expected to be a leaf\n" msgstr "" -#: windres.c:405 +#: windres.c:391 #, c-format msgid "%s: warning: " msgstr "" -#: windres.c:407 +#: windres.c:393 +#, c-format msgid ": duplicate value\n" msgstr "" -#: windres.c:569 +#: windres.c:543 #, c-format msgid "unknown format type `%s'" msgstr "" -#: windres.c:570 +#: windres.c:544 #, c-format msgid "%s: supported formats:" msgstr "" #. Otherwise, we give up. -#: windres.c:655 +#: windres.c:627 #, c-format -msgid "can not determine type of file `%s'; use the -I option" +msgid "can not determine type of file `%s'; use the -J option" msgstr "" -#: windres.c:669 +#: windres.c:639 #, c-format msgid "Usage: %s [option(s)] [input-file] [output-file]\n" msgstr "" -#: windres.c:671 +#: windres.c:641 +#, c-format msgid "" " The options are:\n" " -i --input= Name input file\n" @@ -4522,53 +5214,58 @@ msgid "" " --no-use-temp-file Use popen (default)\n" msgstr "" -#: windres.c:687 +#: windres.c:657 +#, c-format msgid " --yydebug Turn on parser debugging\n" msgstr "" -#: windres.c:690 +#: windres.c:660 +#, c-format msgid "" " -r Ignored for compatibility with rc\n" +" @ Read options from \n" " -h --help Print this help message\n" " -V --version Print version information\n" msgstr "" -#: windres.c:694 +#: windres.c:665 +#, c-format 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:833 +#: windres.c:803 msgid "invalid option -f\n" msgstr "" -#: windres.c:838 +#: windres.c:808 msgid "No filename following the -fo option.\n" msgstr "" -#: windres.c:896 +#: windres.c:866 +#, c-format msgid "" "Option -I is deprecated for setting the input format, please use -J " "instead.\n" msgstr "" -#: windres.c:1014 +#: windres.c:984 msgid "no resources" msgstr "" -#: wrstabs.c:395 wrstabs.c:2055 +#: wrstabs.c:354 wrstabs.c:1915 #, c-format msgid "string_hash_lookup failed: %s" msgstr "" -#: wrstabs.c:695 +#: wrstabs.c:635 #, c-format msgid "stab_int_type: bad size %u" msgstr "" -#: wrstabs.c:1495 +#: wrstabs.c:1393 #, c-format msgid "%s: warning: unknown size for field `%s' in struct" msgstr "" diff --git a/contrib/binutils/binutils/prdbg.c b/contrib/binutils/binutils/prdbg.c index 5b6b0479a8e..87a49341b01 100644 --- a/contrib/binutils/binutils/prdbg.c +++ b/contrib/binutils/binutils/prdbg.c @@ -1,5 +1,6 @@ /* prdbg.c -- Print out generic debugging information. - Copyright 1995, 1996, 2002, 2003 Free Software Foundation, Inc. + Copyright 1995, 1996, 1999, 2002, 2003, 2004 + Free Software Foundation, Inc. Written by Ian Lance Taylor . Tags style generation written by Salvador E. Tropea . @@ -17,8 +18,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ /* This file prints out the generic debugging information, by supplying a set of routines to debug_write. */ @@ -1904,7 +1905,7 @@ find_address_in_section (bfd *abfd, asection *section, void *data) if (pc < vma) return; - size = bfd_get_section_size_before_reloc (section); + size = bfd_get_section_size (section); if (pc >= vma + size) return; diff --git a/contrib/binutils/binutils/ranlib.sh b/contrib/binutils/binutils/ranlib.sh index 2b6fbc479c6..9a2248f1430 100755 --- a/contrib/binutils/binutils/ranlib.sh +++ b/contrib/binutils/binutils/ranlib.sh @@ -1,3 +1,3 @@ #!/bin/sh # A simple ranlib script, to use less disk space than a ranlib program. -ar s $1 +ar s "$1" diff --git a/contrib/binutils/binutils/rclex.c b/contrib/binutils/binutils/rclex.c index ff20f2ae871..b546335b1ab 100644 --- a/contrib/binutils/binutils/rclex.c +++ b/contrib/binutils/binutils/rclex.c @@ -1,7 +1,7 @@ /* A lexical scanner generated by flex */ /* Scanner skeleton version: - * $Header: /cvs/src/src/binutils/rclex.c,v 1.1.12.1 2004/04/09 19:32:15 drow Exp $ + * $Header: /cvs/src/src/binutils/rclex.c,v 1.1.16.1 2006/04/16 18:36:40 drow Exp $ */ #define FLEX_SCANNER @@ -638,7 +638,8 @@ char *yytext; #line 1 "rclex.l" #define INITIAL 0 #line 2 "rclex.l" -/* Copyright 1997, 1998, 1999, 2001, 2002, 2003 Free Software Foundation, Inc. +/* Copyright 1997, 1998, 1999, 2001, 2002, 2003, 2005 + Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. This file is part of GNU Binutils. @@ -655,8 +656,8 @@ char *yytext; You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ /* This is a lex input file which generates a lexer used by the Windows rc file parser. It basically just recognized a bunch of @@ -671,6 +672,8 @@ char *yytext; #include +#define YY_NO_UNPUT + /* Whether we are in rcdata mode, in which we returns the lengths of strings. */ @@ -709,7 +712,7 @@ static void cpp_line (const char *); static char *handle_quotes (const char *, unsigned long *); static char *get_string (int); -#line 713 "lex.yy.c" +#line 716 "rclex.c" /* Macros after this point can all be overridden by user definitions in * section 1. @@ -871,10 +874,10 @@ YY_DECL register char *yy_cp, *yy_bp; register int yy_act; -#line 75 "rclex.l" +#line 78 "rclex.l" -#line 878 "lex.yy.c" +#line 881 "rclex.c" if ( yy_init ) { @@ -959,387 +962,387 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 77 "rclex.l" +#line 80 "rclex.l" { MAYBE_RETURN (BEG); } YY_BREAK case 2: YY_RULE_SETUP -#line 78 "rclex.l" +#line 81 "rclex.l" { MAYBE_RETURN (BEG); } YY_BREAK case 3: YY_RULE_SETUP -#line 79 "rclex.l" +#line 82 "rclex.l" { MAYBE_RETURN (END); } YY_BREAK case 4: YY_RULE_SETUP -#line 80 "rclex.l" +#line 83 "rclex.l" { MAYBE_RETURN (END); } YY_BREAK case 5: YY_RULE_SETUP -#line 81 "rclex.l" +#line 84 "rclex.l" { MAYBE_RETURN (ACCELERATORS); } YY_BREAK case 6: YY_RULE_SETUP -#line 82 "rclex.l" +#line 85 "rclex.l" { MAYBE_RETURN (VIRTKEY); } YY_BREAK case 7: YY_RULE_SETUP -#line 83 "rclex.l" +#line 86 "rclex.l" { MAYBE_RETURN (ASCII); } YY_BREAK case 8: YY_RULE_SETUP -#line 84 "rclex.l" +#line 87 "rclex.l" { MAYBE_RETURN (NOINVERT); } YY_BREAK case 9: YY_RULE_SETUP -#line 85 "rclex.l" +#line 88 "rclex.l" { MAYBE_RETURN (SHIFT); } YY_BREAK case 10: YY_RULE_SETUP -#line 86 "rclex.l" +#line 89 "rclex.l" { MAYBE_RETURN (CONTROL); } YY_BREAK case 11: YY_RULE_SETUP -#line 87 "rclex.l" +#line 90 "rclex.l" { MAYBE_RETURN (ALT); } YY_BREAK case 12: YY_RULE_SETUP -#line 88 "rclex.l" +#line 91 "rclex.l" { MAYBE_RETURN (BITMAP); } YY_BREAK case 13: YY_RULE_SETUP -#line 89 "rclex.l" +#line 92 "rclex.l" { MAYBE_RETURN (CURSOR); } YY_BREAK case 14: YY_RULE_SETUP -#line 90 "rclex.l" +#line 93 "rclex.l" { MAYBE_RETURN (DIALOG); } YY_BREAK case 15: YY_RULE_SETUP -#line 91 "rclex.l" +#line 94 "rclex.l" { MAYBE_RETURN (DIALOGEX); } YY_BREAK case 16: YY_RULE_SETUP -#line 92 "rclex.l" +#line 95 "rclex.l" { MAYBE_RETURN (EXSTYLE); } YY_BREAK case 17: YY_RULE_SETUP -#line 93 "rclex.l" +#line 96 "rclex.l" { MAYBE_RETURN (CAPTION); } YY_BREAK case 18: YY_RULE_SETUP -#line 94 "rclex.l" +#line 97 "rclex.l" { MAYBE_RETURN (CLASS); } YY_BREAK case 19: YY_RULE_SETUP -#line 95 "rclex.l" +#line 98 "rclex.l" { MAYBE_RETURN (STYLE); } YY_BREAK case 20: YY_RULE_SETUP -#line 96 "rclex.l" +#line 99 "rclex.l" { MAYBE_RETURN (AUTO3STATE); } YY_BREAK case 21: YY_RULE_SETUP -#line 97 "rclex.l" +#line 100 "rclex.l" { MAYBE_RETURN (AUTOCHECKBOX); } YY_BREAK case 22: YY_RULE_SETUP -#line 98 "rclex.l" +#line 101 "rclex.l" { MAYBE_RETURN (AUTORADIOBUTTON); } YY_BREAK case 23: YY_RULE_SETUP -#line 99 "rclex.l" +#line 102 "rclex.l" { MAYBE_RETURN (CHECKBOX); } YY_BREAK case 24: YY_RULE_SETUP -#line 100 "rclex.l" +#line 103 "rclex.l" { MAYBE_RETURN (COMBOBOX); } YY_BREAK case 25: YY_RULE_SETUP -#line 101 "rclex.l" +#line 104 "rclex.l" { MAYBE_RETURN (CTEXT); } YY_BREAK case 26: YY_RULE_SETUP -#line 102 "rclex.l" +#line 105 "rclex.l" { MAYBE_RETURN (DEFPUSHBUTTON); } YY_BREAK case 27: YY_RULE_SETUP -#line 103 "rclex.l" +#line 106 "rclex.l" { MAYBE_RETURN (EDITTEXT); } YY_BREAK case 28: YY_RULE_SETUP -#line 104 "rclex.l" +#line 107 "rclex.l" { MAYBE_RETURN (GROUPBOX); } YY_BREAK case 29: YY_RULE_SETUP -#line 105 "rclex.l" +#line 108 "rclex.l" { MAYBE_RETURN (LISTBOX); } YY_BREAK case 30: YY_RULE_SETUP -#line 106 "rclex.l" +#line 109 "rclex.l" { MAYBE_RETURN (LTEXT); } YY_BREAK case 31: YY_RULE_SETUP -#line 107 "rclex.l" +#line 110 "rclex.l" { MAYBE_RETURN (PUSHBOX); } YY_BREAK case 32: YY_RULE_SETUP -#line 108 "rclex.l" +#line 111 "rclex.l" { MAYBE_RETURN (PUSHBUTTON); } YY_BREAK case 33: YY_RULE_SETUP -#line 109 "rclex.l" +#line 112 "rclex.l" { MAYBE_RETURN (RADIOBUTTON); } YY_BREAK case 34: YY_RULE_SETUP -#line 110 "rclex.l" +#line 113 "rclex.l" { MAYBE_RETURN (RTEXT); } YY_BREAK case 35: YY_RULE_SETUP -#line 111 "rclex.l" +#line 114 "rclex.l" { MAYBE_RETURN (SCROLLBAR); } YY_BREAK case 36: YY_RULE_SETUP -#line 112 "rclex.l" +#line 115 "rclex.l" { MAYBE_RETURN (STATE3); } YY_BREAK case 37: YY_RULE_SETUP -#line 113 "rclex.l" +#line 116 "rclex.l" { MAYBE_RETURN (USERBUTTON); } YY_BREAK case 38: YY_RULE_SETUP -#line 114 "rclex.l" +#line 117 "rclex.l" { MAYBE_RETURN (BEDIT); } YY_BREAK case 39: YY_RULE_SETUP -#line 115 "rclex.l" +#line 118 "rclex.l" { MAYBE_RETURN (HEDIT); } YY_BREAK case 40: YY_RULE_SETUP -#line 116 "rclex.l" +#line 119 "rclex.l" { MAYBE_RETURN (IEDIT); } YY_BREAK case 41: YY_RULE_SETUP -#line 117 "rclex.l" +#line 120 "rclex.l" { MAYBE_RETURN (FONT); } YY_BREAK case 42: YY_RULE_SETUP -#line 118 "rclex.l" +#line 121 "rclex.l" { MAYBE_RETURN (ICON); } YY_BREAK case 43: YY_RULE_SETUP -#line 119 "rclex.l" +#line 122 "rclex.l" { MAYBE_RETURN (LANGUAGE); } YY_BREAK case 44: YY_RULE_SETUP -#line 120 "rclex.l" +#line 123 "rclex.l" { MAYBE_RETURN (CHARACTERISTICS); } YY_BREAK case 45: YY_RULE_SETUP -#line 121 "rclex.l" +#line 124 "rclex.l" { MAYBE_RETURN (VERSIONK); } YY_BREAK case 46: YY_RULE_SETUP -#line 122 "rclex.l" +#line 125 "rclex.l" { MAYBE_RETURN (MENU); } YY_BREAK case 47: YY_RULE_SETUP -#line 123 "rclex.l" +#line 126 "rclex.l" { MAYBE_RETURN (MENUEX); } YY_BREAK case 48: YY_RULE_SETUP -#line 124 "rclex.l" +#line 127 "rclex.l" { MAYBE_RETURN (MENUITEM); } YY_BREAK case 49: YY_RULE_SETUP -#line 125 "rclex.l" +#line 128 "rclex.l" { MAYBE_RETURN (SEPARATOR); } YY_BREAK case 50: YY_RULE_SETUP -#line 126 "rclex.l" +#line 129 "rclex.l" { MAYBE_RETURN (POPUP); } YY_BREAK case 51: YY_RULE_SETUP -#line 127 "rclex.l" +#line 130 "rclex.l" { MAYBE_RETURN (CHECKED); } YY_BREAK case 52: YY_RULE_SETUP -#line 128 "rclex.l" +#line 131 "rclex.l" { MAYBE_RETURN (GRAYED); } YY_BREAK case 53: YY_RULE_SETUP -#line 129 "rclex.l" +#line 132 "rclex.l" { MAYBE_RETURN (HELP); } YY_BREAK case 54: YY_RULE_SETUP -#line 130 "rclex.l" +#line 133 "rclex.l" { MAYBE_RETURN (INACTIVE); } YY_BREAK case 55: YY_RULE_SETUP -#line 131 "rclex.l" +#line 134 "rclex.l" { MAYBE_RETURN (MENUBARBREAK); } YY_BREAK case 56: YY_RULE_SETUP -#line 132 "rclex.l" +#line 135 "rclex.l" { MAYBE_RETURN (MENUBREAK); } YY_BREAK case 57: YY_RULE_SETUP -#line 133 "rclex.l" +#line 136 "rclex.l" { MAYBE_RETURN (MESSAGETABLE); } YY_BREAK case 58: YY_RULE_SETUP -#line 134 "rclex.l" +#line 137 "rclex.l" { MAYBE_RETURN (RCDATA); } YY_BREAK case 59: YY_RULE_SETUP -#line 135 "rclex.l" +#line 138 "rclex.l" { MAYBE_RETURN (STRINGTABLE); } YY_BREAK case 60: YY_RULE_SETUP -#line 136 "rclex.l" +#line 139 "rclex.l" { MAYBE_RETURN (VERSIONINFO); } YY_BREAK case 61: YY_RULE_SETUP -#line 137 "rclex.l" +#line 140 "rclex.l" { MAYBE_RETURN (FILEVERSION); } YY_BREAK case 62: YY_RULE_SETUP -#line 138 "rclex.l" +#line 141 "rclex.l" { MAYBE_RETURN (PRODUCTVERSION); } YY_BREAK case 63: YY_RULE_SETUP -#line 139 "rclex.l" +#line 142 "rclex.l" { MAYBE_RETURN (FILEFLAGSMASK); } YY_BREAK case 64: YY_RULE_SETUP -#line 140 "rclex.l" +#line 143 "rclex.l" { MAYBE_RETURN (FILEFLAGS); } YY_BREAK case 65: YY_RULE_SETUP -#line 141 "rclex.l" +#line 144 "rclex.l" { MAYBE_RETURN (FILEOS); } YY_BREAK case 66: YY_RULE_SETUP -#line 142 "rclex.l" +#line 145 "rclex.l" { MAYBE_RETURN (FILETYPE); } YY_BREAK case 67: YY_RULE_SETUP -#line 143 "rclex.l" +#line 146 "rclex.l" { MAYBE_RETURN (FILESUBTYPE); } YY_BREAK case 68: YY_RULE_SETUP -#line 144 "rclex.l" +#line 147 "rclex.l" { MAYBE_RETURN (VALUE); } YY_BREAK case 69: YY_RULE_SETUP -#line 145 "rclex.l" +#line 148 "rclex.l" { MAYBE_RETURN (MOVEABLE); } YY_BREAK case 70: YY_RULE_SETUP -#line 146 "rclex.l" +#line 149 "rclex.l" { MAYBE_RETURN (FIXED); } YY_BREAK case 71: YY_RULE_SETUP -#line 147 "rclex.l" +#line 150 "rclex.l" { MAYBE_RETURN (PURE); } YY_BREAK case 72: YY_RULE_SETUP -#line 148 "rclex.l" +#line 151 "rclex.l" { MAYBE_RETURN (IMPURE); } YY_BREAK case 73: YY_RULE_SETUP -#line 149 "rclex.l" +#line 152 "rclex.l" { MAYBE_RETURN (PRELOAD); } YY_BREAK case 74: YY_RULE_SETUP -#line 150 "rclex.l" +#line 153 "rclex.l" { MAYBE_RETURN (LOADONCALL); } YY_BREAK case 75: YY_RULE_SETUP -#line 151 "rclex.l" +#line 154 "rclex.l" { MAYBE_RETURN (DISCARDABLE); } YY_BREAK case 76: YY_RULE_SETUP -#line 152 "rclex.l" +#line 155 "rclex.l" { MAYBE_RETURN (NOT); } YY_BREAK case 77: YY_RULE_SETUP -#line 154 "rclex.l" +#line 157 "rclex.l" { char *s, *send; @@ -1371,14 +1374,14 @@ YY_RULE_SETUP YY_BREAK case 78: YY_RULE_SETUP -#line 183 "rclex.l" +#line 186 "rclex.l" { cpp_line (yytext); } YY_BREAK case 79: YY_RULE_SETUP -#line 187 "rclex.l" +#line 190 "rclex.l" { yylval.i.val = strtoul (yytext, 0, 0); yylval.i.dword = 1; @@ -1387,7 +1390,7 @@ YY_RULE_SETUP YY_BREAK case 80: YY_RULE_SETUP -#line 193 "rclex.l" +#line 196 "rclex.l" { yylval.i.val = strtoul (yytext, 0, 0); yylval.i.dword = 0; @@ -1396,7 +1399,7 @@ YY_RULE_SETUP YY_BREAK case 81: YY_RULE_SETUP -#line 199 "rclex.l" +#line 202 "rclex.l" { char *s; unsigned long length; @@ -1417,7 +1420,7 @@ YY_RULE_SETUP YY_BREAK case 82: YY_RULE_SETUP -#line 217 "rclex.l" +#line 220 "rclex.l" { char *s; @@ -1435,25 +1438,25 @@ YY_RULE_SETUP YY_BREAK case 83: YY_RULE_SETUP -#line 232 "rclex.l" +#line 235 "rclex.l" { ++rc_lineno; } YY_BREAK case 84: YY_RULE_SETUP -#line 233 "rclex.l" +#line 236 "rclex.l" { /* ignore whitespace */ } YY_BREAK case 85: YY_RULE_SETUP -#line 234 "rclex.l" +#line 237 "rclex.l" { MAYBE_RETURN (*yytext); } YY_BREAK case 86: YY_RULE_SETUP -#line 236 "rclex.l" +#line 239 "rclex.l" ECHO; YY_BREAK -#line 1457 "lex.yy.c" +#line 1460 "rclex.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -2343,7 +2346,7 @@ int main() return 0; } #endif -#line 236 "rclex.l" +#line 239 "rclex.l" #ifndef yywrap /* This is needed for some versions of lex. */ @@ -2416,6 +2419,7 @@ handle_quotes (const char *input, unsigned long *len) char *ret, *s; const char *t; int ch; + int num_xdigits; ret = get_string (strlen (input) + 1); @@ -2497,7 +2501,11 @@ handle_quotes (const char *input, unsigned long *len) case 'x': ++t; ch = 0; - while (1) + /* We only handle single byte chars here. Make sure + we finish an escape sequence like "/xB0ABC" after + the first two digits. */ + num_xdigits = 2; + while (num_xdigits--) { if (*t >= '0' && *t <= '9') ch = (ch << 4) | (*t - '0'); diff --git a/contrib/binutils/binutils/rclex.l b/contrib/binutils/binutils/rclex.l index 2735cc18aca..92b1ec73852 100644 --- a/contrib/binutils/binutils/rclex.l +++ b/contrib/binutils/binutils/rclex.l @@ -1,5 +1,6 @@ %{ /* rclex.l -- lexer for Windows rc files parser */ -/* Copyright 1997, 1998, 1999, 2001, 2002, 2003 Free Software Foundation, Inc. +/* Copyright 1997, 1998, 1999, 2001, 2002, 2003, 2005 + Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. This file is part of GNU Binutils. @@ -16,8 +17,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ /* This is a lex input file which generates a lexer used by the Windows rc file parser. It basically just recognized a bunch of @@ -32,6 +33,8 @@ #include +#define YY_NO_UNPUT + /* Whether we are in rcdata mode, in which we returns the lengths of strings. */ @@ -305,6 +308,7 @@ handle_quotes (const char *input, unsigned long *len) char *ret, *s; const char *t; int ch; + int num_xdigits; ret = get_string (strlen (input) + 1); @@ -386,7 +390,11 @@ handle_quotes (const char *input, unsigned long *len) case 'x': ++t; ch = 0; - while (1) + /* We only handle single byte chars here. Make sure + we finish an escape sequence like "/xB0ABC" after + the first two digits. */ + num_xdigits = 2; + while (num_xdigits--) { if (*t >= '0' && *t <= '9') ch = (ch << 4) | (*t - '0'); diff --git a/contrib/binutils/binutils/rcparse.y b/contrib/binutils/binutils/rcparse.y index 7aacaaa0673..fbc5bef6f8a 100644 --- a/contrib/binutils/binutils/rcparse.y +++ b/contrib/binutils/binutils/rcparse.y @@ -1,5 +1,6 @@ %{ /* rcparse.y -- parser for Windows rc files - Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005 + Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. This file is part of GNU Binutils. @@ -16,8 +17,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ /* This is a parser for Windows rc files. It is based on the parser by Gunther Ebert . */ @@ -53,10 +54,11 @@ static unsigned long base_style; static unsigned long default_style; static unsigned long class; static struct res_id res_text_field; +static unichar null_unichar; /* This is used for COMBOBOX, LISTBOX and EDITTEXT which do not allow resource 'text' field in control definition. */ -static const struct res_id res_null_text = { 1, {{0, L""}}}; +static const struct res_id res_null_text = { 1, {{0, &null_unichar}}}; %} @@ -1152,6 +1154,13 @@ rcdata: YYERROR; rcparse_discard_strings (); } + | id RCDATA suboptions file_name + { + define_rcdata_file ($1, &$3, $4); + if (yychar != YYEMPTY) + YYERROR; + rcparse_discard_strings (); + } ; /* We use a different lexing algorithm, because rcdata strings may diff --git a/contrib/binutils/binutils/rdcoff.c b/contrib/binutils/binutils/rdcoff.c index 84788e0e10e..1eda3af195d 100644 --- a/contrib/binutils/binutils/rdcoff.c +++ b/contrib/binutils/binutils/rdcoff.c @@ -1,5 +1,5 @@ /* stabs.c -- Parse COFF debugging information - Copyright 1996, 2000, 2002, 2003 Free Software Foundation, Inc. + Copyright 1996, 1999, 2000, 2002, 2003 Free Software Foundation, Inc. Written by Ian Lance Taylor . This file is part of GNU Binutils. @@ -16,8 +16,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ /* This file contains code which parses COFF debugging information. */ diff --git a/contrib/binutils/binutils/rddbg.c b/contrib/binutils/binutils/rddbg.c index 75ddab54488..e977d8b5ef1 100644 --- a/contrib/binutils/binutils/rddbg.c +++ b/contrib/binutils/binutils/rddbg.c @@ -1,5 +1,5 @@ /* rddbg.c -- Read debugging information into a generic form. - Copyright 1995, 1996, 1997, 2000, 2002, 2003 + Copyright 1995, 1996, 1997, 2000, 2002, 2003, 2005 Free Software Foundation, Inc. Written by Ian Lance Taylor . @@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ /* This file reads debugging information into a generic form. This file knows how to dig the debugging information out of an object @@ -100,8 +100,13 @@ read_section_stabs_debugging_info (bfd *abfd, asymbol **syms, long symcount, { const char *secname; const char *strsecname; - } names[] = { { ".stab", ".stabstr" }, - { "LC_SYMTAB.stabs", "LC_SYMTAB.stabstr" } }; + } + names[] = + { + { ".stab", ".stabstr" }, + { "LC_SYMTAB.stabs", "LC_SYMTAB.stabstr" }, + { "$GDB_SYMBOLS$", "$GDB_STRINGS$" } + }; unsigned int i; void *shandle; diff --git a/contrib/binutils/binutils/readelf.c b/contrib/binutils/binutils/readelf.c index e95a501dabb..d8bd54f440f 100644 --- a/contrib/binutils/binutils/readelf.c +++ b/contrib/binutils/binutils/readelf.c @@ -1,5 +1,6 @@ /* readelf.c -- display contents of an ELF format file - Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. Originally developed by Eric Youngdale Modifications by Nick Clifton @@ -18,12 +19,12 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ /* The difference between readelf and objdump: - Both programs are capabale of displaying the contents of ELF format files, + Both programs are capable of displaying the contents of ELF format files, so why does the binutils project have two file dumpers ? The reason is that objdump sees an ELF file through a BFD filter of the @@ -54,12 +55,11 @@ #define BFD64 #endif -#include "bfd.h" +#include "dwarf.h" #include "elf/common.h" #include "elf/external.h" #include "elf/internal.h" -#include "elf/dwarf2.h" /* The following headers use the elf/reloc-macros.h file to automatically generate relocation recognition functions @@ -71,6 +71,7 @@ #include "elf/arc.h" #include "elf/arm.h" #include "elf/avr.h" +#include "elf/bfin.h" #include "elf/cris.h" #include "elf/d10v.h" #include "elf/d30v.h" @@ -85,6 +86,7 @@ #include "elf/i960.h" #include "elf/ia64.h" #include "elf/ip2k.h" +#include "elf/m32c.h" #include "elf/m32r.h" #include "elf/m68k.h" #include "elf/m68hc11.h" @@ -93,6 +95,7 @@ #include "elf/mmix.h" #include "elf/mn10200.h" #include "elf/mn10300.h" +#include "elf/mt.h" #include "elf/msp430.h" #include "elf/or32.h" #include "elf/pj.h" @@ -105,6 +108,7 @@ #include "elf/vax.h" #include "elf/x86-64.h" #include "elf/xstormy16.h" +#include "elf/crx.h" #include "elf/iq2000.h" #include "elf/xtensa.h" @@ -115,55 +119,85 @@ #include "libiberty.h" char *program_name = "readelf"; -long archive_file_offset; -unsigned long archive_file_size; -unsigned long dynamic_addr; -bfd_size_type dynamic_size; -char *dynamic_strings; -char *string_table; -unsigned long string_table_length; -unsigned long num_dynamic_syms; -Elf_Internal_Sym *dynamic_symbols; -Elf_Internal_Syminfo *dynamic_syminfo; -unsigned long dynamic_syminfo_offset; -unsigned int dynamic_syminfo_nent; -char program_interpreter[64]; -bfd_vma dynamic_info[DT_JMPREL + 1]; -bfd_vma version_info[16]; -Elf_Internal_Ehdr elf_header; -Elf_Internal_Shdr *section_headers; -Elf_Internal_Phdr *program_headers; -Elf_Internal_Dyn *dynamic_segment; -Elf_Internal_Shdr *symtab_shndx_hdr; -int show_name; -int do_dynamic; -int do_syms; -int do_reloc; -int do_sections; -int do_segments; -int do_unwind; -int do_using_dynamic; -int do_header; -int do_dump; -int do_version; -int do_wide; -int do_histogram; -int do_debugging; -int do_debug_info; -int do_debug_abbrevs; -int do_debug_lines; -int do_debug_pubnames; -int do_debug_aranges; -int do_debug_frames; -int do_debug_frames_interp; -int do_debug_macinfo; -int do_debug_str; -int do_debug_loc; -int do_arch; -int do_notes; -int is_32bit_elf; +static long archive_file_offset; +static unsigned long archive_file_size; +static unsigned long dynamic_addr; +static bfd_size_type dynamic_size; +static unsigned int dynamic_nent; +static char *dynamic_strings; +static unsigned long dynamic_strings_length; +static char *string_table; +static unsigned long string_table_length; +static unsigned long num_dynamic_syms; +static Elf_Internal_Sym *dynamic_symbols; +static Elf_Internal_Syminfo *dynamic_syminfo; +static unsigned long dynamic_syminfo_offset; +static unsigned int dynamic_syminfo_nent; +static char program_interpreter[64]; +static bfd_vma dynamic_info[DT_JMPREL + 1]; +static bfd_vma version_info[16]; +static Elf_Internal_Ehdr elf_header; +static Elf_Internal_Shdr *section_headers; +static Elf_Internal_Phdr *program_headers; +static Elf_Internal_Dyn *dynamic_section; +static Elf_Internal_Shdr *symtab_shndx_hdr; +static int show_name; +static int do_dynamic; +static int do_syms; +static int do_reloc; +static int do_sections; +static int do_section_groups; +static int do_section_details; +static int do_segments; +static int do_unwind; +static int do_using_dynamic; +static int do_header; +static int do_dump; +static int do_version; +static int do_wide; +static int do_histogram; +static int do_debugging; +static int do_arch; +static int do_notes; +static int is_32bit_elf; -/* A dynamic array of flags indicating which sections require dumping. */ +struct group_list +{ + struct group_list *next; + unsigned int section_index; +}; + +struct group +{ + struct group_list *root; + unsigned int group_index; +}; + +static size_t group_count; +static struct group *section_groups; +static struct group **section_headers_groups; + +/* A linked list of the section names for which dumps were requested + by name. */ +struct dump_list_entry +{ + char *name; + int type; + struct dump_list_entry *next; +}; +static struct dump_list_entry *dump_sects_byname; + +/* A dynamic array of flags indicating for which sections a hex dump + has been requested (via the -x switch) and/or a disassembly dump + (via the -i switch). */ +char *cmdline_dump_sects = NULL; +unsigned num_cmdline_dump_sects = 0; + +/* A dynamic array of flags indicating for which sections a dump of + some kind has been requested. It is reset on a per-object file + basis and then initialised from the cmdline_dump_sects array, + the results of interpreting the -w switch, and the + dump_sects_byname list. */ char *dump_sects = NULL; unsigned int num_dump_sects = 0; @@ -171,7 +205,7 @@ unsigned int num_dump_sects = 0; #define DISASS_DUMP (1 << 1) #define DEBUG_DUMP (1 << 2) -/* How to rpint a vma value. */ +/* How to print a vma value. */ typedef enum print_mode { HEX, @@ -184,16 +218,13 @@ typedef enum print_mode } print_mode; -static bfd_vma (*byte_get) (unsigned char *, int); static void (*byte_put) (unsigned char *, bfd_vma, int); -typedef int Elf32_Word; - #define UNKNOWN -1 #define SECTION_NAME(X) ((X) == NULL ? "" : \ - ((X)->sh_name >= string_table_length \ - ? "" : string_table + (X)->sh_name)) + ((X)->sh_name >= string_table_length \ + ? "" : string_table + (X)->sh_name)) /* Given st_shndx I, map to section_headers index. */ #define SECTION_HEADER_INDEX(I) \ @@ -215,60 +246,33 @@ typedef int Elf32_Word; #define BYTE_GET(field) byte_get (field, sizeof (field)) -/* If we can support a 64 bit data type then BFD64 should be defined - and sizeof (bfd_vma) == 8. In this case when translating from an - external 8 byte field to an internal field, we can assume that the - internal field is also 8 bytes wide and so we can extract all the data. - If, however, BFD64 is not defined, then we must assume that the - internal data structure only has 4 byte wide fields that are the - equivalent of the 8 byte wide external counterparts, and so we must - truncate the data. */ -#ifdef BFD64 -#define BYTE_GET8(field) byte_get (field, -8) -#else -#define BYTE_GET8(field) byte_get (field, 8) -#endif - #define NUM_ELEM(array) (sizeof (array) / sizeof ((array)[0])) #define GET_ELF_SYMBOLS(file, section) \ (is_32bit_elf ? get_32bit_elf_symbols (file, section) \ : get_64bit_elf_symbols (file, section)) +#define VALID_DYNAMIC_NAME(offset) ((dynamic_strings != NULL) && (offset < dynamic_strings_length)) +/* GET_DYNAMIC_NAME asssumes that VALID_DYNAMIC_NAME has + already been called and verified that the string exists. */ +#define GET_DYNAMIC_NAME(offset) (dynamic_strings + offset) -static void -error (const char *message, ...) -{ - va_list args; - - va_start (args, message); - fprintf (stderr, _("%s: Error: "), program_name); - vfprintf (stderr, message, args); - va_end (args); -} - -static void -warn (const char *message, ...) -{ - va_list args; - - va_start (args, message); - fprintf (stderr, _("%s: Warning: "), program_name); - vfprintf (stderr, message, args); - va_end (args); -} - +/* This is just a bit of syntatic sugar. */ +#define streq(a,b) (strcmp ((a), (b)) == 0) +#define strneq(a,b,n) (strncmp ((a), (b), (n)) == 0) + static void * -get_data (void *var, FILE *file, long offset, size_t size, const char *reason) +get_data (void *var, FILE *file, long offset, size_t size, size_t nmemb, + const char *reason) { void *mvar; - if (size == 0) + if (size == 0 || nmemb == 0) return NULL; if (fseek (file, archive_file_offset + offset, SEEK_SET)) { - error (_("Unable to seek to 0x%x for %s\n"), + error (_("Unable to seek to 0x%lx for %s\n"), archive_file_offset + offset, reason); return NULL; } @@ -276,19 +280,25 @@ get_data (void *var, FILE *file, long offset, size_t size, const char *reason) mvar = var; if (mvar == NULL) { - mvar = malloc (size); + /* Check for overflow. */ + if (nmemb < (~(size_t) 0 - 1) / size) + /* + 1 so that we can '\0' terminate invalid string table sections. */ + mvar = malloc (size * nmemb + 1); if (mvar == NULL) { - error (_("Out of memory allocating 0x%x bytes for %s\n"), - size, reason); + error (_("Out of memory allocating 0x%lx bytes for %s\n"), + (unsigned long)(size * nmemb), reason); return NULL; } + + ((char *) mvar)[size * nmemb] = '\0'; } - if (fread (mvar, size, 1, file) != 1) + if (fread (mvar, size, nmemb, file) != nmemb) { - error (_("Unable to read in 0x%x bytes of %s\n"), size, reason); + error (_("Unable to read in 0x%lx bytes of %s\n"), + (unsigned long)(size * nmemb), reason); if (mvar != var) free (mvar); return NULL; @@ -297,74 +307,6 @@ get_data (void *var, FILE *file, long offset, size_t size, const char *reason) return mvar; } -static bfd_vma -byte_get_little_endian (unsigned char *field, int size) -{ - switch (size) - { - case 1: - return *field; - - case 2: - return ((unsigned int) (field[0])) - | (((unsigned int) (field[1])) << 8); - -#ifndef BFD64 - case 8: - /* We want to extract data from an 8 byte wide field and - place it into a 4 byte wide field. Since this is a little - endian source we can just use the 4 byte extraction code. */ - /* Fall through. */ -#endif - case 4: - return ((unsigned long) (field[0])) - | (((unsigned long) (field[1])) << 8) - | (((unsigned long) (field[2])) << 16) - | (((unsigned long) (field[3])) << 24); - -#ifdef BFD64 - case 8: - case -8: - /* This is a special case, generated by the BYTE_GET8 macro. - It means that we are loading an 8 byte value from a field - in an external structure into an 8 byte value in a field - in an internal structure. */ - return ((bfd_vma) (field[0])) - | (((bfd_vma) (field[1])) << 8) - | (((bfd_vma) (field[2])) << 16) - | (((bfd_vma) (field[3])) << 24) - | (((bfd_vma) (field[4])) << 32) - | (((bfd_vma) (field[5])) << 40) - | (((bfd_vma) (field[6])) << 48) - | (((bfd_vma) (field[7])) << 56); -#endif - default: - error (_("Unhandled data length: %d\n"), size); - abort (); - } -} - -static bfd_vma -byte_get_signed (unsigned char *field, int size) -{ - bfd_vma x = byte_get (field, size); - - switch (size) - { - case 1: - return (x ^ 0x80) - 0x80; - case 2: - return (x ^ 0x8000) - 0x8000; - case 4: - return (x ^ 0x80000000) - 0x80000000; - case 8: - case -8: - return x; - default: - abort (); - } -} - static void byte_put_little_endian (unsigned char *field, bfd_vma value, int size) { @@ -393,8 +335,60 @@ byte_put_little_endian (unsigned char *field, bfd_vma value, int size) } } +#if defined BFD64 && !BFD_HOST_64BIT_LONG +static int +print_dec_vma (bfd_vma vma, int is_signed) +{ + char buf[40]; + char *bufp = buf; + int nc = 0; + + if (is_signed && (bfd_signed_vma) vma < 0) + { + vma = -vma; + putchar ('-'); + nc = 1; + } + + do + { + *bufp++ = '0' + vma % 10; + vma /= 10; + } + while (vma != 0); + nc += bufp - buf; + + while (bufp > buf) + putchar (*--bufp); + return nc; +} + +static int +print_hex_vma (bfd_vma vma) +{ + char buf[32]; + char *bufp = buf; + int nc; + + do + { + char digit = '0' + (vma & 0x0f); + if (digit > '9') + digit += 'a' - '0' - 10; + *bufp++ = digit; + vma >>= 4; + } + while (vma != 0); + nc = bufp - buf; + + while (bufp > buf) + putchar (*--bufp); + return nc; +} +#endif + /* Print a VMA value. */ -static void +static int print_vma (bfd_vma vma, print_mode mode) { #ifdef BFD64 @@ -404,106 +398,85 @@ print_vma (bfd_vma vma, print_mode mode) switch (mode) { case FULL_HEX: - printf ("0x"); - /* Drop through. */ + return printf ("0x%8.8lx", (unsigned long) vma); + case LONG_HEX: - printf ("%8.8lx", (unsigned long) vma); - break; + return printf ("%8.8lx", (unsigned long) vma); case DEC_5: if (vma <= 99999) - { - printf ("%5ld", (long) vma); - break; - } + return printf ("%5ld", (long) vma); /* Drop through. */ + case PREFIX_HEX: - printf ("0x"); - /* Drop through. */ + return printf ("0x%lx", (unsigned long) vma); + case HEX: - printf ("%lx", (unsigned long) vma); - break; + return printf ("%lx", (unsigned long) vma); case DEC: - printf ("%ld", (unsigned long) vma); - break; + return printf ("%ld", (unsigned long) vma); case UNSIGNED: - printf ("%lu", (unsigned long) vma); - break; + return printf ("%lu", (unsigned long) vma); } } #ifdef BFD64 else { + int nc = 0; + switch (mode) { case FULL_HEX: - printf ("0x"); + nc = printf ("0x"); /* Drop through. */ case LONG_HEX: printf_vma (vma); - break; + return nc + 16; case PREFIX_HEX: - printf ("0x"); + nc = printf ("0x"); /* Drop through. */ case HEX: #if BFD_HOST_64BIT_LONG - printf ("%lx", vma); + return nc + printf ("%lx", vma); #else - if (_bfd_int64_high (vma)) - printf ("%lx%8.8lx", _bfd_int64_high (vma), _bfd_int64_low (vma)); - else - printf ("%lx", _bfd_int64_low (vma)); + return nc + print_hex_vma (vma); #endif - break; case DEC: #if BFD_HOST_64BIT_LONG - printf ("%ld", vma); + return printf ("%ld", vma); #else - if (_bfd_int64_high (vma)) - /* ugg */ - printf ("++%ld", _bfd_int64_low (vma)); - else - printf ("%ld", _bfd_int64_low (vma)); + return print_dec_vma (vma, 1); #endif - break; case DEC_5: #if BFD_HOST_64BIT_LONG if (vma <= 99999) - printf ("%5ld", vma); + return printf ("%5ld", vma); else - printf ("%#lx", vma); + return printf ("%#lx", vma); #else - if (_bfd_int64_high (vma)) - /* ugg */ - printf ("++%ld", _bfd_int64_low (vma)); - else if (vma <= 99999) - printf ("%5ld", _bfd_int64_low (vma)); + if (vma <= 99999) + return printf ("%5ld", _bfd_int64_low (vma)); else - printf ("%#lx", _bfd_int64_low (vma)); + return print_hex_vma (vma); #endif - break; case UNSIGNED: #if BFD_HOST_64BIT_LONG - printf ("%lu", vma); + return printf ("%lu", vma); #else - if (_bfd_int64_high (vma)) - /* ugg */ - printf ("++%lu", _bfd_int64_low (vma)); - else - printf ("%lu", _bfd_int64_low (vma)); + return print_dec_vma (vma, 0); #endif - break; } } #endif + return 0; } /* Display a symbol on stdout. If do_wide is not true then @@ -523,54 +496,6 @@ print_symbol (int width, const char *symbol) printf ("%-.*s", width, symbol); } -static bfd_vma -byte_get_big_endian (unsigned char *field, int size) -{ - switch (size) - { - case 1: - return *field; - - case 2: - return ((unsigned int) (field[1])) | (((int) (field[0])) << 8); - - case 4: - return ((unsigned long) (field[3])) - | (((unsigned long) (field[2])) << 8) - | (((unsigned long) (field[1])) << 16) - | (((unsigned long) (field[0])) << 24); - -#ifndef BFD64 - case 8: - /* Although we are extracing data from an 8 byte wide field, we - are returning only 4 bytes of data. */ - return ((unsigned long) (field[7])) - | (((unsigned long) (field[6])) << 8) - | (((unsigned long) (field[5])) << 16) - | (((unsigned long) (field[4])) << 24); -#else - case 8: - case -8: - /* This is a special case, generated by the BYTE_GET8 macro. - It means that we are loading an 8 byte value from a field - in an external structure into an 8 byte value in a field - in an internal structure. */ - return ((bfd_vma) (field[7])) - | (((bfd_vma) (field[6])) << 8) - | (((bfd_vma) (field[5])) << 16) - | (((bfd_vma) (field[4])) << 24) - | (((bfd_vma) (field[3])) << 32) - | (((bfd_vma) (field[2])) << 40) - | (((bfd_vma) (field[1])) << 48) - | (((bfd_vma) (field[0])) << 56); -#endif - - default: - error (_("Unhandled data length: %d\n"), size); - abort (); - } -} - static void byte_put_big_endian (unsigned char *field, bfd_vma value, int size) { @@ -603,6 +528,20 @@ byte_put_big_endian (unsigned char *field, bfd_vma value, int size) } } +/* Return a pointer to section NAME, or NULL if no such section exists. */ + +static Elf_Internal_Shdr * +find_section (const char *name) +{ + unsigned int i; + + for (i = 0; i < elf_header.e_shnum; i++) + if (streq (SECTION_NAME (section_headers + i), name)) + return section_headers + i; + + return NULL; +} + /* Guess the relocation size commonly used by the specific machines. */ static int @@ -661,6 +600,7 @@ guess_is_rela (unsigned long e_machine) case EM_MSP430: case EM_MSP430_OLD: case EM_XSTORMY16: + case EM_CRX: case EM_VAX: case EM_IP2K: case EM_IP2K_OLD: @@ -668,6 +608,11 @@ guess_is_rela (unsigned long e_machine) case EM_XTENSA: case EM_XTENSA_OLD: case EM_M32R: + case EM_M32C: + case EM_MT: + case EM_BLACKFIN: + case EM_NIOS32: + case EM_ALTERA_NIOS2: return TRUE; case EM_MMA: @@ -708,17 +653,18 @@ slurp_rela_relocs (FILE *file, { Elf32_External_Rela *erelas; - erelas = get_data (NULL, file, rel_offset, rel_size, _("relocs")); + erelas = get_data (NULL, file, rel_offset, 1, rel_size, _("relocs")); if (!erelas) return 0; nrelas = rel_size / sizeof (Elf32_External_Rela); - relas = malloc (nrelas * sizeof (Elf_Internal_Rela)); + relas = cmalloc (nrelas, sizeof (Elf_Internal_Rela)); if (relas == NULL) { - error(_("out of memory parsing relocs")); + free (erelas); + error (_("out of memory parsing relocs")); return 0; } @@ -735,25 +681,26 @@ slurp_rela_relocs (FILE *file, { Elf64_External_Rela *erelas; - erelas = get_data (NULL, file, rel_offset, rel_size, _("relocs")); + erelas = get_data (NULL, file, rel_offset, 1, rel_size, _("relocs")); if (!erelas) return 0; nrelas = rel_size / sizeof (Elf64_External_Rela); - relas = malloc (nrelas * sizeof (Elf_Internal_Rela)); + relas = cmalloc (nrelas, sizeof (Elf_Internal_Rela)); if (relas == NULL) { - error(_("out of memory parsing relocs")); + free (erelas); + error (_("out of memory parsing relocs")); return 0; } for (i = 0; i < nrelas; i++) { - relas[i].r_offset = BYTE_GET8 (erelas[i].r_offset); - relas[i].r_info = BYTE_GET8 (erelas[i].r_info); - relas[i].r_addend = BYTE_GET8 (erelas[i].r_addend); + relas[i].r_offset = BYTE_GET (erelas[i].r_offset); + relas[i].r_info = BYTE_GET (erelas[i].r_info); + relas[i].r_addend = BYTE_GET (erelas[i].r_addend); } free (erelas); @@ -778,17 +725,18 @@ slurp_rel_relocs (FILE *file, { Elf32_External_Rel *erels; - erels = get_data (NULL, file, rel_offset, rel_size, _("relocs")); + erels = get_data (NULL, file, rel_offset, 1, rel_size, _("relocs")); if (!erels) return 0; nrels = rel_size / sizeof (Elf32_External_Rel); - rels = malloc (nrels * sizeof (Elf_Internal_Rela)); + rels = cmalloc (nrels, sizeof (Elf_Internal_Rela)); if (rels == NULL) { - error(_("out of memory parsing relocs")); + free (erels); + error (_("out of memory parsing relocs")); return 0; } @@ -805,24 +753,25 @@ slurp_rel_relocs (FILE *file, { Elf64_External_Rel *erels; - erels = get_data (NULL, file, rel_offset, rel_size, _("relocs")); + erels = get_data (NULL, file, rel_offset, 1, rel_size, _("relocs")); if (!erels) return 0; nrels = rel_size / sizeof (Elf64_External_Rel); - rels = malloc (nrels * sizeof (Elf_Internal_Rela)); + rels = cmalloc (nrels, sizeof (Elf_Internal_Rela)); if (rels == NULL) { - error(_("out of memory parsing relocs")); + free (erels); + error (_("out of memory parsing relocs")); return 0; } for (i = 0; i < nrels; i++) { - rels[i].r_offset = BYTE_GET8 (erels[i].r_offset); - rels[i].r_info = BYTE_GET8 (erels[i].r_info); + rels[i].r_offset = BYTE_GET (erels[i].r_offset); + rels[i].r_info = BYTE_GET (erels[i].r_info); rels[i].r_addend = 0; } @@ -843,6 +792,7 @@ dump_relocations (FILE *file, Elf_Internal_Sym *symtab, unsigned long nsyms, char *strtab, + unsigned long strtablen, int is_rela) { unsigned int i; @@ -991,10 +941,10 @@ dump_relocations (FILE *file, rtype = elf_i386_reloc_type (type); break; - case EM_68HC11: - case EM_68HC12: - rtype = elf_m68hc11_reloc_type (type); - break; + case EM_68HC11: + case EM_68HC12: + rtype = elf_m68hc11_reloc_type (type); + break; case EM_68K: rtype = elf_m68k_reloc_type (type); @@ -1054,9 +1004,9 @@ dump_relocations (FILE *file, rtype = elf_fr30_reloc_type (type); break; - case EM_CYGNUS_FRV: - rtype = elf_frv_reloc_type (type); - break; + case EM_CYGNUS_FRV: + rtype = elf_frv_reloc_type (type); + break; case EM_MCORE: rtype = elf_mcore_reloc_type (type); @@ -1149,6 +1099,10 @@ dump_relocations (FILE *file, rtype = elf_xstormy16_reloc_type (type); break; + case EM_CRX: + rtype = elf_crx_reloc_type (type); + break; + case EM_VAX: rtype = elf_vax_reloc_type (type); break; @@ -1166,6 +1120,19 @@ dump_relocations (FILE *file, case EM_XTENSA: rtype = elf_xtensa_reloc_type (type); break; + + case EM_M32C: + rtype = elf_m32c_reloc_type (type); + break; + + case EM_MT: + rtype = elf_mt_reloc_type (type); + break; + + case EM_BLACKFIN: + rtype = elf_bfin_reloc_type (type); + break; + } if (rtype == NULL) @@ -1177,7 +1144,31 @@ dump_relocations (FILE *file, else printf (do_wide ? "%-22.22s" : "%-17.17s", rtype); - if (symtab_index) + if (elf_header.e_machine == EM_ALPHA + && streq (rtype, "R_ALPHA_LITUSE") + && is_rela) + { + switch (rels[i].r_addend) + { + case LITUSE_ALPHA_ADDR: rtype = "ADDR"; break; + case LITUSE_ALPHA_BASE: rtype = "BASE"; break; + case LITUSE_ALPHA_BYTOFF: rtype = "BYTOFF"; break; + case LITUSE_ALPHA_JSR: rtype = "JSR"; break; + case LITUSE_ALPHA_TLSGD: rtype = "TLSGD"; break; + case LITUSE_ALPHA_TLSLDM: rtype = "TLSLDM"; break; + case LITUSE_ALPHA_JSRDIRECT: rtype = "JSRDIRECT"; break; + default: rtype = NULL; + } + if (rtype) + printf (" (%s)", rtype); + else + { + putchar (' '); + printf (_(""), + (unsigned long) rels[i].r_addend); + } + } + else if (symtab_index) { if (symtab == NULL || symtab_index >= nsyms) printf (" bad symbol index: %08lx", (unsigned long) symtab_index); @@ -1202,7 +1193,7 @@ dump_relocations (FILE *file, if (psym->st_shndx < SHN_LORESERVE) sec_index = psym->st_shndx; - else if (psym->st_shndx > SHN_LORESERVE) + else if (psym->st_shndx > SHN_HIRESERVE) sec_index = psym->st_shndx - (SHN_HIRESERVE + 1 - SHN_LORESERVE); @@ -1212,6 +1203,9 @@ dump_relocations (FILE *file, sec_name = "ABS"; else if (psym->st_shndx == SHN_COMMON) sec_name = "COMMON"; + else if (elf_header.e_machine == EM_X86_64 + && psym->st_shndx == SHN_X86_64_LCOMMON) + sec_name = "LARGE_COMMON"; else if (elf_header.e_machine == EM_IA_64 && elf_header.e_ident[EI_OSABI] == ELFOSABI_HPUX && psym->st_shndx == SHN_IA_64_ANSI_COMMON) @@ -1226,7 +1220,9 @@ dump_relocations (FILE *file, print_symbol (22, sec_name); } else if (strtab == NULL) - printf (_(""), psym->st_name); + printf (_(""), psym->st_name); + else if (psym->st_name >= strtablen) + printf (_(""), psym->st_name); else print_symbol (22, strtab + psym->st_name); @@ -1236,12 +1232,12 @@ dump_relocations (FILE *file, } else if (is_rela) { - printf ("%*c", is_32bit_elf ? (do_wide ? 34 : 28) : (do_wide ? 26 : 20), ' '); + printf ("%*c", is_32bit_elf ? + (do_wide ? 34 : 28) : (do_wide ? 26 : 20), ' '); print_vma (rels[i].r_addend, LONG_HEX); } - if (elf_header.e_machine == EM_SPARCV9 - && !strcmp (rtype, "R_SPARC_OLO10")) + if (elf_header.e_machine == EM_SPARCV9 && streq (rtype, "R_SPARC_OLO10")) printf (" + %lx", (unsigned long) ELF64_R_TYPE_DATA (info)); putchar ('\n'); @@ -1259,7 +1255,7 @@ dump_relocations (FILE *file, else printf ("%-17.17s", rtype2); - printf("\n Type3: "); + printf ("\n Type3: "); if (rtype3 == NULL) #ifdef _bfd_int64_low @@ -1343,6 +1339,17 @@ get_sparc64_dynamic_type (unsigned long type) } } +static const char * +get_ppc_dynamic_type (unsigned long type) +{ + switch (type) + { + case DT_PPC_GOT: return "PPC_GOT"; + default: + return NULL; + } +} + static const char * get_ppc64_dynamic_type (unsigned long type) { @@ -1374,6 +1381,17 @@ get_parisc_dynamic_type (unsigned long type) case DT_HP_GST_SIZE: return "HP_GST_SIZE"; case DT_HP_GST_VERSION: return "HP_GST_VERSION"; case DT_HP_GST_HASHVAL: return "HP_GST_HASHVAL"; + case DT_HP_EPLTREL: return "HP_GST_EPLTREL"; + case DT_HP_EPLTRELSZ: return "HP_GST_EPLTRELSZ"; + case DT_HP_FILTERED: return "HP_FILTERED"; + case DT_HP_FILTER_TLS: return "HP_FILTER_TLS"; + case DT_HP_COMPAT_FILTERED: return "HP_COMPAT_FILTERED"; + case DT_HP_LAZYLOAD: return "HP_LAZYLOAD"; + case DT_HP_BIND_NOW_COUNT: return "HP_BIND_NOW_COUNT"; + case DT_PLT: return "PLT"; + case DT_PLT_SIZE: return "PLT_SIZE"; + case DT_DLT: return "DLT"; + case DT_DLT_SIZE: return "DLT_SIZE"; default: return NULL; } @@ -1390,10 +1408,21 @@ get_ia64_dynamic_type (unsigned long type) } } +static const char * +get_alpha_dynamic_type (unsigned long type) +{ + switch (type) + { + case DT_ALPHA_PLTRO: return "ALPHA_PLTRO"; + default: + return NULL; + } +} + static const char * get_dynamic_type (unsigned long type) { - static char buff[32]; + static char buff[64]; switch (type) { @@ -1451,6 +1480,8 @@ get_dynamic_type (unsigned long type) case DT_VERSYM: return "VERSYM"; + case DT_TLSDESC_GOT: return "TLSDESC_GOT"; + case DT_TLSDESC_PLT: return "TLSDESC_PLT"; case DT_RELACOUNT: return "RELACOUNT"; case DT_RELCOUNT: return "RELCOUNT"; case DT_FLAGS_1: return "FLAGS_1"; @@ -1483,12 +1514,18 @@ get_dynamic_type (unsigned long type) case EM_SPARCV9: result = get_sparc64_dynamic_type (type); break; + case EM_PPC: + result = get_ppc_dynamic_type (type); + break; case EM_PPC64: result = get_ppc64_dynamic_type (type); break; case EM_IA_64: result = get_ia64_dynamic_type (type); break; + case EM_ALPHA: + result = get_alpha_dynamic_type (type); + break; default: result = NULL; break; @@ -1497,9 +1534,11 @@ get_dynamic_type (unsigned long type) if (result != NULL) return result; - sprintf (buff, _("Processor Specific: %lx"), type); + snprintf (buff, sizeof (buff), _("Processor Specific: %lx"), type); } - else if ((type >= DT_LOOS) && (type <= DT_HIOS)) + else if (((type >= DT_LOOS) && (type <= DT_HIOS)) + || (elf_header.e_machine == EM_PARISC + && (type >= OLD_DT_LOOS) && (type <= OLD_DT_HIOS))) { const char *result; @@ -1516,10 +1555,11 @@ get_dynamic_type (unsigned long type) if (result != NULL) return result; - sprintf (buff, _("Operating System specific: %lx"), type); + snprintf (buff, sizeof (buff), _("Operating System specific: %lx"), + type); } else - sprintf (buff, _(": %lx"), type); + snprintf (buff, sizeof (buff), _(": %lx"), type); return buff; } @@ -1534,17 +1574,17 @@ get_file_type (unsigned e_type) { case ET_NONE: return _("NONE (None)"); case ET_REL: return _("REL (Relocatable file)"); - case ET_EXEC: return _("EXEC (Executable file)"); - case ET_DYN: return _("DYN (Shared object file)"); - case ET_CORE: return _("CORE (Core file)"); + case ET_EXEC: return _("EXEC (Executable file)"); + case ET_DYN: return _("DYN (Shared object file)"); + case ET_CORE: return _("CORE (Core file)"); default: if ((e_type >= ET_LOPROC) && (e_type <= ET_HIPROC)) - sprintf (buff, _("Processor Specific: (%x)"), e_type); + snprintf (buff, sizeof (buff), _("Processor Specific: (%x)"), e_type); else if ((e_type >= ET_LOOS) && (e_type <= ET_HIOS)) - sprintf (buff, _("OS Specific: (%x)"), e_type); + snprintf (buff, sizeof (buff), _("OS Specific: (%x)"), e_type); else - sprintf (buff, _(": %x"), e_type); + snprintf (buff, sizeof (buff), _(": %x"), e_type); return buff; } } @@ -1643,14 +1683,21 @@ get_machine_name (unsigned e_machine) case EM_XSTORMY16: return "Sanyo Xstormy16 CPU core"; case EM_OPENRISC: case EM_OR32: return "OpenRISC"; + case EM_CRX: return "National Semiconductor CRX microprocessor"; case EM_DLX: return "OpenDLX"; case EM_IP2K_OLD: case EM_IP2K: return "Ubicom IP2xxx 8-bit microcontrollers"; case EM_IQ2000: return "Vitesse IQ2000"; case EM_XTENSA_OLD: case EM_XTENSA: return "Tensilica Xtensa Processor"; + case EM_M32C: return "Renesas M32c"; + case EM_MT: return "Morpho Techologies MT processor"; + case EM_BLACKFIN: return "Analog Devices Blackfin"; + case EM_NIOS32: return "Altera Nios"; + case EM_ALTERA_NIOS2: return "Altera Nios II"; + case EM_XC16X: return "Infineon Technologies xc16x"; default: - sprintf (buff, _(": %x"), e_machine); + snprintf (buff, sizeof (buff), _(": %x"), e_machine); return buff; } } @@ -1740,6 +1787,42 @@ decode_ARM_machine_flags (unsigned e_flags, char buf[]) } break; + case EF_ARM_EABI_VER3: + strcat (buf, ", Version3 EABI"); + break; + + case EF_ARM_EABI_VER4: + strcat (buf, ", Version4 EABI"); + goto eabi; + + case EF_ARM_EABI_VER5: + strcat (buf, ", Version5 EABI"); + eabi: + while (e_flags) + { + unsigned flag; + + /* Process flags one bit at a time. */ + flag = e_flags & - e_flags; + e_flags &= ~ flag; + + switch (flag) + { + case EF_ARM_BE8: + strcat (buf, ", BE8"); + break; + + case EF_ARM_LE8: + strcat (buf, ", LE8"); + break; + + default: + unknown = 1; + break; + } + } + break; + case EF_ARM_EABI_UNKNOWN: strcat (buf, ", GNU EABI"); while (e_flags) @@ -1784,6 +1867,10 @@ decode_ARM_machine_flags (unsigned e_flags, char buf[]) strcat (buf, ", software FP"); break; + case EF_ARM_VFP_FLOAT: + strcat (buf, ", VFP"); + break; + case EF_ARM_MAVERICK_FLOAT: strcat (buf, ", Maverick FP"); break; @@ -1817,11 +1904,102 @@ get_machine_flags (unsigned e_flags, unsigned e_machine) decode_ARM_machine_flags (e_flags, buf); break; + case EM_CYGNUS_FRV: + switch (e_flags & EF_FRV_CPU_MASK) + { + case EF_FRV_CPU_GENERIC: + break; + + default: + strcat (buf, ", fr???"); + break; + + case EF_FRV_CPU_FR300: + strcat (buf, ", fr300"); + break; + + case EF_FRV_CPU_FR400: + strcat (buf, ", fr400"); + break; + case EF_FRV_CPU_FR405: + strcat (buf, ", fr405"); + break; + + case EF_FRV_CPU_FR450: + strcat (buf, ", fr450"); + break; + + case EF_FRV_CPU_FR500: + strcat (buf, ", fr500"); + break; + case EF_FRV_CPU_FR550: + strcat (buf, ", fr550"); + break; + + case EF_FRV_CPU_SIMPLE: + strcat (buf, ", simple"); + break; + case EF_FRV_CPU_TOMCAT: + strcat (buf, ", tomcat"); + break; + } + break; + case EM_68K: - if (e_flags & EF_CPU32) + if (e_flags & EF_M68K_CPU32) strcat (buf, ", cpu32"); - if (e_flags & EF_M68000) + if (e_flags & EF_M68K_M68000) strcat (buf, ", m68000"); + if (e_flags & EF_M68K_ISA_MASK) + { + char const *isa = _("unknown"); + char const *mac = _("unknown mac"); + char const *additional = NULL; + + switch (e_flags & EF_M68K_ISA_MASK) + { + case EF_M68K_ISA_A_NODIV: + isa = "A"; + additional = ", nodiv"; + break; + case EF_M68K_ISA_A: + isa = "A"; + break; + case EF_M68K_ISA_A_PLUS: + isa = "A+"; + break; + case EF_M68K_ISA_B_NOUSP: + isa = "B"; + additional = ", nousp"; + break; + case EF_M68K_ISA_B: + isa = "B"; + break; + } + strcat (buf, ", cf, isa "); + strcat (buf, isa); + if (additional) + strcat (buf, additional); + if (e_flags & EF_M68K_FLOAT) + strcat (buf, ", float"); + switch (e_flags & EF_M68K_MAC_MASK) + { + case 0: + mac = NULL; + break; + case EF_M68K_MAC: + mac = "mac"; + break; + case EF_M68K_EMAC: + mac = "emac"; + break; + } + if (mac) + { + strcat (buf, ", "); + strcat (buf, mac); + } + } break; case EM_PPC: @@ -1895,6 +2073,7 @@ get_machine_flags (unsigned e_flags, unsigned e_machine) case E_MIPS_MACH_5400: strcat (buf, ", 5400"); break; case E_MIPS_MACH_5500: strcat (buf, ", 5500"); break; case E_MIPS_MACH_SB1: strcat (buf, ", sb1"); break; + case E_MIPS_MACH_9000: strcat (buf, ", 9000"); break; case 0: /* We simply ignore the field in this case to avoid confusion: MIPS ELF does not specify EF_MIPS_MACH, it is a GNU @@ -1940,6 +2119,35 @@ get_machine_flags (unsigned e_flags, unsigned e_machine) break; + case EM_SH: + switch ((e_flags & EF_SH_MACH_MASK)) + { + case EF_SH1: strcat (buf, ", sh1"); break; + case EF_SH2: strcat (buf, ", sh2"); break; + case EF_SH3: strcat (buf, ", sh3"); break; + case EF_SH_DSP: strcat (buf, ", sh-dsp"); break; + case EF_SH3_DSP: strcat (buf, ", sh3-dsp"); break; + case EF_SH4AL_DSP: strcat (buf, ", sh4al-dsp"); break; + case EF_SH3E: strcat (buf, ", sh3e"); break; + case EF_SH4: strcat (buf, ", sh4"); break; + case EF_SH5: strcat (buf, ", sh5"); break; + case EF_SH2E: strcat (buf, ", sh2e"); break; + case EF_SH4A: strcat (buf, ", sh4a"); break; + case EF_SH2A: strcat (buf, ", sh2a"); break; + case EF_SH4_NOFPU: strcat (buf, ", sh4-nofpu"); break; + case EF_SH4A_NOFPU: strcat (buf, ", sh4a-nofpu"); break; + case EF_SH2A_NOFPU: strcat (buf, ", sh2a-nofpu"); break; + case EF_SH3_NOMMU: strcat (buf, ", sh3-nommu"); break; + case EF_SH4_NOMMU_NOFPU: strcat (buf, ", sh4-nommu-nofpu"); break; + case EF_SH2A_SH4_NOFPU: strcat (buf, ", sh2a-nofpu-or-sh4-nommu-nofpu"); break; + case EF_SH2A_SH3_NOFPU: strcat (buf, ", sh2a-nofpu-or-sh3-nommu"); break; + case EF_SH2A_SH4: strcat (buf, ", sh2a-or-sh4"); break; + case EF_SH2A_SH3E: strcat (buf, ", sh2a-or-sh3e"); break; + default: strcat (buf, ", unknown ISA"); break; + } + + break; + case EM_SPARCV9: if (e_flags & EF_SPARC_32PLUS) strcat (buf, ", v8+"); @@ -2058,11 +2266,25 @@ get_osabi_name (unsigned int osabi) case ELFOSABI_STANDALONE: return _("Standalone App"); case ELFOSABI_ARM: return "ARM"; default: - sprintf (buff, _(""), osabi); + snprintf (buff, sizeof (buff), _(""), osabi); return buff; } } +static const char * +get_arm_segment_type (unsigned long type) +{ + switch (type) + { + case PT_ARM_EXIDX: + return "EXIDX"; + default: + break; + } + + return NULL; +} + static const char * get_mips_segment_type (unsigned long type) { @@ -2098,8 +2320,13 @@ get_parisc_segment_type (unsigned long type) case PT_HP_CORE_MMF: return "HP_CORE_MMF"; case PT_HP_PARALLEL: return "HP_PARALLEL"; case PT_HP_FASTBIND: return "HP_FASTBIND"; + case PT_HP_OPT_ANNOT: return "HP_OPT_ANNOT"; + case PT_HP_HSL_ANNOT: return "HP_HSL_ANNOT"; + case PT_HP_STACK: return "HP_STACK"; + case PT_HP_CORE_UTSNAME: return "HP_CORE_UTSNAME"; case PT_PARISC_ARCHEXT: return "PARISC_ARCHEXT"; case PT_PARISC_UNWIND: return "PARISC_UNWIND"; + case PT_PARISC_WEAKORDER: return "PARISC_WEAKORDER"; default: break; } @@ -2143,7 +2370,8 @@ get_segment_type (unsigned long p_type) case PT_GNU_EH_FRAME: return "GNU_EH_FRAME"; - case PT_GNU_STACK: return "STACK"; + case PT_GNU_STACK: return "GNU_STACK"; + case PT_GNU_RELRO: return "GNU_RELRO"; default: if ((p_type >= PT_LOPROC) && (p_type <= PT_HIPROC)) @@ -2152,6 +2380,9 @@ get_segment_type (unsigned long p_type) switch (elf_header.e_machine) { + case EM_ARM: + result = get_arm_segment_type (p_type); + break; case EM_MIPS: case EM_MIPS_RS3_LE: result = get_mips_segment_type (p_type); @@ -2195,7 +2426,7 @@ get_segment_type (unsigned long p_type) sprintf (buff, "LOOS+%lx", p_type - PT_LOOS); } else - sprintf (buff, _(": %lx"), p_type); + snprintf (buff, sizeof (buff), _(": %lx"), p_type); return buff; } @@ -2259,6 +2490,10 @@ get_parisc_section_type_name (unsigned int sh_type) case SHT_PARISC_EXT: return "PARISC_EXT"; case SHT_PARISC_UNWIND: return "PARISC_UNWIND"; case SHT_PARISC_DOC: return "PARISC_DOC"; + case SHT_PARISC_ANNOT: return "PARISC_ANNOT"; + case SHT_PARISC_SYMEXTN: return "PARISC_SYMEXTN"; + case SHT_PARISC_STUBS: return "PARISC_STUBS"; + case SHT_PARISC_DLKM: return "PARISC_DLKM"; default: break; } @@ -2268,7 +2503,7 @@ get_parisc_section_type_name (unsigned int sh_type) static const char * get_ia64_section_type_name (unsigned int sh_type) { - /* If the top 8 bits are 0x78 the next 8 are the os/abi ID. */ + /* If the top 8 bits are 0x78 the next 8 are the os/abi ID. */ if ((sh_type & 0xFF000000) == SHT_IA_64_LOPSREG) return get_osabi_name ((sh_type & 0x00FF0000) >> 16); @@ -2283,6 +2518,35 @@ get_ia64_section_type_name (unsigned int sh_type) return NULL; } +static const char * +get_x86_64_section_type_name (unsigned int sh_type) +{ + switch (sh_type) + { + case SHT_X86_64_UNWIND: return "X86_64_UNWIND"; + default: + break; + } + return NULL; +} + +static const char * +get_arm_section_type_name (unsigned int sh_type) +{ + switch (sh_type) + { + case SHT_ARM_EXIDX: + return "ARM_EXIDX"; + case SHT_ARM_PREEMPTMAP: + return "ARM_PREEMPTMAP"; + case SHT_ARM_ATTRIBUTES: + return "ARM_ATTRIBUTES"; + default: + break; + } + return NULL; +} + static const char * get_section_type_name (unsigned int sh_type) { @@ -2333,6 +2597,12 @@ get_section_type_name (unsigned int sh_type) case EM_IA_64: result = get_ia64_section_type_name (sh_type); break; + case EM_X86_64: + result = get_x86_64_section_type_name (sh_type); + break; + case EM_ARM: + result = get_arm_section_type_name (sh_type); + break; default: result = NULL; break; @@ -2348,7 +2618,7 @@ get_section_type_name (unsigned int sh_type) else if ((sh_type >= SHT_LOUSER) && (sh_type <= SHT_HIUSER)) sprintf (buff, "LOUSER+%x", sh_type - SHT_LOUSER); else - sprintf (buff, _(": %x"), sh_type); + snprintf (buff, sizeof (buff), _(": %x"), sh_type); return buff; } @@ -2356,7 +2626,7 @@ get_section_type_name (unsigned int sh_type) #define OPTION_DEBUG_DUMP 512 -struct option options[] = +static struct option options[] = { {"all", no_argument, 0, 'a'}, {"file-header", no_argument, 0, 'h'}, @@ -2366,6 +2636,9 @@ struct option options[] = {"segments", no_argument, 0, 'l'}, {"sections", no_argument, 0, 'S'}, {"section-headers", no_argument, 0, 'S'}, + {"section-groups", no_argument, 0, 'g'}, + {"section-details", no_argument, 0, 't'}, + {"full-section-name",no_argument, 0, 'N'}, {"symbols", no_argument, 0, 's'}, {"syms", no_argument, 0, 's'}, {"relocs", no_argument, 0, 'r'}, @@ -2399,19 +2672,21 @@ usage (void) --segments An alias for --program-headers\n\ -S --section-headers Display the sections' header\n\ --sections An alias for --section-headers\n\ + -g --section-groups Display the section groups\n\ + -t --section-details Display the section details\n\ -e --headers Equivalent to: -h -l -S\n\ -s --syms Display the symbol table\n\ --symbols An alias for --syms\n\ -n --notes Display the core notes (if present)\n\ -r --relocs Display the relocations (if present)\n\ -u --unwind Display the unwind info (if present)\n\ - -d --dynamic Display the dynamic segment (if present)\n\ + -d --dynamic Display the dynamic section (if present)\n\ -V --version-info Display the version sections (if present)\n\ -A --arch-specific Display architecture specific information (if any).\n\ -D --use-dynamic Use the dynamic section info when displaying symbols\n\ -x --hex-dump= Dump the contents of section \n\ - -w[liaprmfFso] or\n\ - --debug-dump[=line,=info,=abbrev,=pubnames,=ranges,=macro,=frames,=str,=loc]\n\ + -w[liaprmfFsoR] or\n\ + --debug-dump[=line,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=str,=loc,=Ranges]\n\ Display the contents of DWARF2 debug sections\n")); #ifdef SUPPORT_DISASSEMBLY fprintf (stdout, _("\ @@ -2421,6 +2696,7 @@ usage (void) fprintf (stdout, _("\ -I --histogram Display histogram of bucket list lengths\n\ -W --wide Allow output width to exceed 80 characters\n\ + @ Read options from \n\ -H --help Display this information\n\ -v --version Display the version number of readelf\n")); fprintf (stdout, _("Report bugs to %s\n"), REPORT_BUGS_TO); @@ -2428,6 +2704,11 @@ usage (void) exit (0); } +/* Record the fact that the user wants the contents of section number + SECTION to be displayed using the method(s) encoded as flags bits + in TYPE. Note, TYPE can be zero if we are creating the array for + the first time. */ + static void request_dump (unsigned int section, int type) { @@ -2457,6 +2738,27 @@ request_dump (unsigned int section, int type) return; } +/* Request a dump by section name. */ + +static void +request_dump_byname (const char *section, int type) +{ + struct dump_list_entry *new_request; + + new_request = malloc (sizeof (struct dump_list_entry)); + if (!new_request) + error (_("Out of memory allocating dump request table.")); + + new_request->name = strdup (section); + if (!new_request->name) + error (_("Out of memory allocating dump request table.")); + + new_request->type = type; + + new_request->next = dump_sects_byname; + dump_sects_byname = new_request; +} + static void parse_args (int argc, char **argv) { @@ -2466,7 +2768,7 @@ parse_args (int argc, char **argv) usage (); while ((c = getopt_long - (argc, argv, "ersuahnldSDAIw::x:i:vVWH", options, NULL)) != EOF) + (argc, argv, "ersuahnldSDAINtgw::x:i:vVWH", options, NULL)) != EOF) { char *cp; int section; @@ -2487,12 +2789,21 @@ parse_args (int argc, char **argv) do_dynamic++; do_header++; do_sections++; + do_section_groups++; do_segments++; do_version++; do_histogram++; do_arch++; do_notes++; break; + case 'g': + do_section_groups++; + break; + case 't': + case 'N': + do_sections++; + do_section_details++; + break; case 'e': do_header++; do_sections++; @@ -2535,11 +2846,10 @@ parse_args (int argc, char **argv) do_dump++; section = strtoul (optarg, & cp, 0); if (! *cp && section >= 0) - { - request_dump (section, HEX_DUMP); - break; - } - goto oops; + request_dump (section, HEX_DUMP); + else + request_dump_byname (optarg, HEX_DUMP); + break; case 'w': do_dump++; if (optarg == 0) @@ -2574,10 +2884,13 @@ parse_args (int argc, char **argv) break; case 'r': - case 'R': do_debug_aranges = 1; break; + case 'R': + do_debug_ranges = 1; + break; + case 'F': do_debug_frames_interp = 1; case 'f': @@ -2611,10 +2924,33 @@ parse_args (int argc, char **argv) do_debugging = 1; else { - static const char *debug_dump_opt[] - = { "line", "info", "abbrev", "pubnames", "ranges", - "macro", "frames", "frames-interp", "str", "loc", NULL }; - unsigned int index; + typedef struct + { + const char * option; + int * variable; + } + debug_dump_long_opts; + + debug_dump_long_opts opts_table [] = + { + /* Please keep this table alpha- sorted. */ + { "Ranges", & do_debug_ranges }, + { "abbrev", & do_debug_abbrevs }, + { "aranges", & do_debug_aranges }, + { "frames", & do_debug_frames }, + { "frames-interp", & do_debug_frames_interp }, + { "info", & do_debug_info }, + { "line", & do_debug_lines }, + { "loc", & do_debug_loc }, + { "macro", & do_debug_macinfo }, + { "pubnames", & do_debug_pubnames }, + /* This entry is for compatability + with earlier versions of readelf. */ + { "ranges", & do_debug_aranges }, + { "str", & do_debug_str }, + { NULL, NULL } + }; + const char *p; do_debugging = 0; @@ -2622,59 +2958,28 @@ parse_args (int argc, char **argv) p = optarg; while (*p) { - for (index = 0; debug_dump_opt[index]; index++) - { - size_t len = strlen (debug_dump_opt[index]); + debug_dump_long_opts * entry; - if (strncmp (p, debug_dump_opt[index], len) == 0 + for (entry = opts_table; entry->option; entry++) + { + size_t len = strlen (entry->option); + + if (strneq (p, entry->option, len) && (p[len] == ',' || p[len] == '\0')) { - switch (p[0]) - { - case 'i': - do_debug_info = 1; - break; + * entry->variable = 1; - case 'a': - do_debug_abbrevs = 1; - break; - - case 'l': - if (p[1] == 'i') - do_debug_lines = 1; - else - do_debug_loc = 1; - break; - - case 'p': - do_debug_pubnames = 1; - break; - - case 'r': - do_debug_aranges = 1; - break; - - case 'f': - if (len > 6) - do_debug_frames_interp = 1; - do_debug_frames = 1; - break; - - case 'm': - do_debug_macinfo = 1; - break; - - case 's': - do_debug_str = 1; - break; - } + /* The --debug-dump=frames-interp option also + enables the --debug-dump=frames option. */ + if (do_debug_frames_interp) + do_debug_frames = 1; p += len; break; } } - if (debug_dump_opt[index] == NULL) + if (entry->option == NULL) { warn (_("Unrecognized debug option '%s'\n"), p); p = strchr (p, ','); @@ -2708,7 +3013,9 @@ parse_args (int argc, char **argv) do_wide++; break; default: +#ifdef SUPPORT_DISASSEMBLY oops: +#endif /* xgettext:c-format */ error (_("Invalid option '-%c'\n"), c); /* Drop through. */ @@ -2719,12 +3026,13 @@ parse_args (int argc, char **argv) if (!do_dynamic && !do_syms && !do_reloc && !do_unwind && !do_sections && !do_segments && !do_header && !do_dump && !do_version - && !do_histogram && !do_debugging && !do_arch && !do_notes) + && !do_histogram && !do_debugging && !do_arch && !do_notes + && !do_section_groups) usage (); else if (argc < 3) { warn (_("Nothing to do.\n")); - usage(); + usage (); } } @@ -2739,7 +3047,7 @@ get_elf_class (unsigned int elf_class) case ELFCLASS32: return "ELF32"; case ELFCLASS64: return "ELF64"; default: - sprintf (buff, _(""), elf_class); + snprintf (buff, sizeof (buff), _(""), elf_class); return buff; } } @@ -2755,7 +3063,7 @@ get_data_encoding (unsigned int encoding) case ELFDATA2LSB: return _("2's complement, little endian"); case ELFDATA2MSB: return _("2's complement, big endian"); default: - sprintf (buff, _(""), encoding); + snprintf (buff, sizeof (buff), _(""), encoding); return buff; } } @@ -2860,7 +3168,7 @@ get_32bit_program_headers (FILE *file, Elf_Internal_Phdr *program_headers) unsigned int i; phdrs = get_data (NULL, file, elf_header.e_phoff, - elf_header.e_phentsize * elf_header.e_phnum, + elf_header.e_phentsize, elf_header.e_phnum, _("program headers")); if (!phdrs) return 0; @@ -2893,7 +3201,7 @@ get_64bit_program_headers (FILE *file, Elf_Internal_Phdr *program_headers) unsigned int i; phdrs = get_data (NULL, file, elf_header.e_phoff, - elf_header.e_phentsize * elf_header.e_phnum, + elf_header.e_phentsize, elf_header.e_phnum, _("program headers")); if (!phdrs) return 0; @@ -2904,12 +3212,12 @@ get_64bit_program_headers (FILE *file, Elf_Internal_Phdr *program_headers) { internal->p_type = BYTE_GET (external->p_type); internal->p_flags = BYTE_GET (external->p_flags); - internal->p_offset = BYTE_GET8 (external->p_offset); - internal->p_vaddr = BYTE_GET8 (external->p_vaddr); - internal->p_paddr = BYTE_GET8 (external->p_paddr); - internal->p_filesz = BYTE_GET8 (external->p_filesz); - internal->p_memsz = BYTE_GET8 (external->p_memsz); - internal->p_align = BYTE_GET8 (external->p_align); + internal->p_offset = BYTE_GET (external->p_offset); + internal->p_vaddr = BYTE_GET (external->p_vaddr); + internal->p_paddr = BYTE_GET (external->p_paddr); + internal->p_filesz = BYTE_GET (external->p_filesz); + internal->p_memsz = BYTE_GET (external->p_memsz); + internal->p_align = BYTE_GET (external->p_align); } free (phdrs); @@ -2928,7 +3236,7 @@ get_program_headers (FILE *file) if (program_headers != NULL) return 1; - phdrs = malloc (elf_header.e_phnum * sizeof (Elf_Internal_Phdr)); + phdrs = cmalloc (elf_header.e_phnum, sizeof (Elf_Internal_Phdr)); if (phdrs == NULL) { @@ -3090,8 +3398,35 @@ process_program_headers (FILE *file) if (dynamic_addr) error (_("more than one dynamic segment\n")); - dynamic_addr = segment->p_offset; - dynamic_size = segment->p_filesz; + /* Try to locate the .dynamic section. If there is + a section header table, we can easily locate it. */ + if (section_headers != NULL) + { + Elf_Internal_Shdr *sec; + + sec = find_section (".dynamic"); + if (sec == NULL || sec->sh_size == 0) + { + error (_("no .dynamic section in the dynamic segment")); + break; + } + + dynamic_addr = sec->sh_offset; + dynamic_size = sec->sh_size; + + if (dynamic_addr < segment->p_offset + || dynamic_addr > segment->p_offset + segment->p_filesz) + warn (_("the .dynamic section is not contained within the dynamic segment")); + else if (dynamic_addr > segment->p_offset) + warn (_("the .dynamic section is not the first section in the dynamic segment.")); + } + else + { + /* Otherwise, we can only assume that the .dynamic + section is the first section in the DYNAMIC segment. */ + dynamic_addr = segment->p_offset; + dynamic_size = segment->p_filesz; + } break; case PT_INTERP: @@ -3114,13 +3449,11 @@ process_program_headers (FILE *file) putc ('\n', stdout); } - if (do_segments && section_headers != NULL) + if (do_segments && section_headers != NULL && string_table != NULL) { printf (_("\n Section to Segment mapping:\n")); printf (_(" Segment Sections...\n")); - assert (string_table != NULL); - for (i = 0; i < elf_header.e_phnum; i++) { unsigned int j; @@ -3133,16 +3466,7 @@ process_program_headers (FILE *file) for (j = 1; j < elf_header.e_shnum; j++, section++) { - if (section->sh_size > 0 - /* Compare allocated sections by VMA, unallocated - sections by file offset. */ - && (section->sh_flags & SHF_ALLOC - ? (section->sh_addr >= segment->p_vaddr - && section->sh_addr + section->sh_size - <= segment->p_vaddr + segment->p_memsz) - : ((bfd_vma) section->sh_offset >= segment->p_offset - && (section->sh_offset + section->sh_size - <= segment->p_offset + segment->p_filesz)))) + if (ELF_IS_SECTION_IN_SEGMENT_MEMORY(section, segment)) printf ("%s ", SECTION_NAME (section)); } @@ -3193,11 +3517,11 @@ get_32bit_section_headers (FILE *file, unsigned int num) unsigned int i; shdrs = get_data (NULL, file, elf_header.e_shoff, - elf_header.e_shentsize * num, _("section headers")); + elf_header.e_shentsize, num, _("section headers")); if (!shdrs) return 0; - section_headers = malloc (num * sizeof (Elf_Internal_Shdr)); + section_headers = cmalloc (num, sizeof (Elf_Internal_Shdr)); if (section_headers == NULL) { @@ -3234,11 +3558,11 @@ get_64bit_section_headers (FILE *file, unsigned int num) unsigned int i; shdrs = get_data (NULL, file, elf_header.e_shoff, - elf_header.e_shentsize * num, _("section headers")); + elf_header.e_shentsize, num, _("section headers")); if (!shdrs) return 0; - section_headers = malloc (num * sizeof (Elf_Internal_Shdr)); + section_headers = cmalloc (num, sizeof (Elf_Internal_Shdr)); if (section_headers == NULL) { @@ -3252,10 +3576,10 @@ get_64bit_section_headers (FILE *file, unsigned int num) { internal->sh_name = BYTE_GET (shdrs[i].sh_name); internal->sh_type = BYTE_GET (shdrs[i].sh_type); - internal->sh_flags = BYTE_GET8 (shdrs[i].sh_flags); - internal->sh_addr = BYTE_GET8 (shdrs[i].sh_addr); - internal->sh_size = BYTE_GET8 (shdrs[i].sh_size); - internal->sh_entsize = BYTE_GET8 (shdrs[i].sh_entsize); + internal->sh_flags = BYTE_GET (shdrs[i].sh_flags); + internal->sh_addr = BYTE_GET (shdrs[i].sh_addr); + internal->sh_size = BYTE_GET (shdrs[i].sh_size); + internal->sh_entsize = BYTE_GET (shdrs[i].sh_entsize); internal->sh_link = BYTE_GET (shdrs[i].sh_link); internal->sh_info = BYTE_GET (shdrs[i].sh_info); internal->sh_offset = BYTE_GET (shdrs[i].sh_offset); @@ -3277,7 +3601,7 @@ get_32bit_elf_symbols (FILE *file, Elf_Internal_Shdr *section) Elf_Internal_Sym *psym; unsigned int j; - esyms = get_data (NULL, file, section->sh_offset, section->sh_size, + esyms = get_data (NULL, file, section->sh_offset, 1, section->sh_size, _("symbols")); if (!esyms) return NULL; @@ -3288,7 +3612,7 @@ get_32bit_elf_symbols (FILE *file, Elf_Internal_Shdr *section) == (unsigned long) SECTION_HEADER_NUM (section - section_headers))) { shndx = get_data (NULL, file, symtab_shndx_hdr->sh_offset, - symtab_shndx_hdr->sh_size, _("symtab shndx")); + 1, symtab_shndx_hdr->sh_size, _("symtab shndx")); if (!shndx) { free (esyms); @@ -3297,7 +3621,7 @@ get_32bit_elf_symbols (FILE *file, Elf_Internal_Shdr *section) } number = section->sh_size / section->sh_entsize; - isyms = malloc (number * sizeof (Elf_Internal_Sym)); + isyms = cmalloc (number, sizeof (Elf_Internal_Sym)); if (isyms == NULL) { @@ -3340,7 +3664,7 @@ get_64bit_elf_symbols (FILE *file, Elf_Internal_Shdr *section) Elf_Internal_Sym *psym; unsigned int j; - esyms = get_data (NULL, file, section->sh_offset, section->sh_size, + esyms = get_data (NULL, file, section->sh_offset, 1, section->sh_size, _("symbols")); if (!esyms) return NULL; @@ -3351,7 +3675,7 @@ get_64bit_elf_symbols (FILE *file, Elf_Internal_Shdr *section) == (unsigned long) SECTION_HEADER_NUM (section - section_headers))) { shndx = get_data (NULL, file, symtab_shndx_hdr->sh_offset, - symtab_shndx_hdr->sh_size, _("symtab shndx")); + 1, symtab_shndx_hdr->sh_size, _("symtab shndx")); if (!shndx) { free (esyms); @@ -3360,7 +3684,7 @@ get_64bit_elf_symbols (FILE *file, Elf_Internal_Shdr *section) } number = section->sh_size / section->sh_entsize; - isyms = malloc (number * sizeof (Elf_Internal_Sym)); + isyms = cmalloc (number, sizeof (Elf_Internal_Sym)); if (isyms == NULL) { @@ -3382,8 +3706,8 @@ get_64bit_elf_symbols (FILE *file, Elf_Internal_Shdr *section) if (psym->st_shndx == SHN_XINDEX && shndx != NULL) psym->st_shndx = byte_get ((unsigned char *) &shndx[j], sizeof (shndx[j])); - psym->st_value = BYTE_GET8 (esyms[j].st_value); - psym->st_size = BYTE_GET8 (esyms[j].st_size); + psym->st_value = BYTE_GET (esyms[j].st_value); + psym->st_size = BYTE_GET (esyms[j].st_size); } if (shndx) @@ -3396,9 +3720,38 @@ get_64bit_elf_symbols (FILE *file, Elf_Internal_Shdr *section) static const char * get_elf_section_flags (bfd_vma sh_flags) { - static char buff[32]; + static char buff[1024]; + char *p = buff; + int field_size = is_32bit_elf ? 8 : 16; + int index, size = sizeof (buff) - (field_size + 4 + 1); + bfd_vma os_flags = 0; + bfd_vma proc_flags = 0; + bfd_vma unknown_flags = 0; + const struct + { + const char *str; + int len; + } + flags [] = + { + { "WRITE", 5 }, + { "ALLOC", 5 }, + { "EXEC", 4 }, + { "MERGE", 5 }, + { "STRINGS", 7 }, + { "INFO LINK", 9 }, + { "LINK ORDER", 10 }, + { "OS NONCONF", 10 }, + { "GROUP", 5 }, + { "TLS", 3 } + }; - *buff = 0; + if (do_section_details) + { + sprintf (buff, "[%*.*lx]: ", + field_size, field_size, (unsigned long) sh_flags); + p += field_size + 4; + } while (sh_flags) { @@ -3407,36 +3760,134 @@ get_elf_section_flags (bfd_vma sh_flags) flag = sh_flags & - sh_flags; sh_flags &= ~ flag; - switch (flag) + if (do_section_details) { - case SHF_WRITE: strcat (buff, "W"); break; - case SHF_ALLOC: strcat (buff, "A"); break; - case SHF_EXECINSTR: strcat (buff, "X"); break; - case SHF_MERGE: strcat (buff, "M"); break; - case SHF_STRINGS: strcat (buff, "S"); break; - case SHF_INFO_LINK: strcat (buff, "I"); break; - case SHF_LINK_ORDER: strcat (buff, "L"); break; - case SHF_OS_NONCONFORMING: strcat (buff, "O"); break; - case SHF_GROUP: strcat (buff, "G"); break; - case SHF_TLS: strcat (buff, "T"); break; + switch (flag) + { + case SHF_WRITE: index = 0; break; + case SHF_ALLOC: index = 1; break; + case SHF_EXECINSTR: index = 2; break; + case SHF_MERGE: index = 3; break; + case SHF_STRINGS: index = 4; break; + case SHF_INFO_LINK: index = 5; break; + case SHF_LINK_ORDER: index = 6; break; + case SHF_OS_NONCONFORMING: index = 7; break; + case SHF_GROUP: index = 8; break; + case SHF_TLS: index = 9; break; - default: - if (flag & SHF_MASKOS) - { - strcat (buff, "o"); - sh_flags &= ~ SHF_MASKOS; + default: + index = -1; + break; } + + if (index != -1) + { + if (p != buff + field_size + 4) + { + if (size < (10 + 2)) + abort (); + size -= 2; + *p++ = ','; + *p++ = ' '; + } + + size -= flags [index].len; + p = stpcpy (p, flags [index].str); + } + else if (flag & SHF_MASKOS) + os_flags |= flag; else if (flag & SHF_MASKPROC) - { - strcat (buff, "p"); - sh_flags &= ~ SHF_MASKPROC; - } + proc_flags |= flag; else - strcat (buff, "x"); - break; + unknown_flags |= flag; + } + else + { + switch (flag) + { + case SHF_WRITE: *p = 'W'; break; + case SHF_ALLOC: *p = 'A'; break; + case SHF_EXECINSTR: *p = 'X'; break; + case SHF_MERGE: *p = 'M'; break; + case SHF_STRINGS: *p = 'S'; break; + case SHF_INFO_LINK: *p = 'I'; break; + case SHF_LINK_ORDER: *p = 'L'; break; + case SHF_OS_NONCONFORMING: *p = 'O'; break; + case SHF_GROUP: *p = 'G'; break; + case SHF_TLS: *p = 'T'; break; + + default: + if (elf_header.e_machine == EM_X86_64 + && flag == SHF_X86_64_LARGE) + *p = 'l'; + else if (flag & SHF_MASKOS) + { + *p = 'o'; + sh_flags &= ~ SHF_MASKOS; + } + else if (flag & SHF_MASKPROC) + { + *p = 'p'; + sh_flags &= ~ SHF_MASKPROC; + } + else + *p = 'x'; + break; + } + p++; } } + if (do_section_details) + { + if (os_flags) + { + size -= 5 + field_size; + if (p != buff + field_size + 4) + { + if (size < (2 + 1)) + abort (); + size -= 2; + *p++ = ','; + *p++ = ' '; + } + sprintf (p, "OS (%*.*lx)", field_size, field_size, + (unsigned long) os_flags); + p += 5 + field_size; + } + if (proc_flags) + { + size -= 7 + field_size; + if (p != buff + field_size + 4) + { + if (size < (2 + 1)) + abort (); + size -= 2; + *p++ = ','; + *p++ = ' '; + } + sprintf (p, "PROC (%*.*lx)", field_size, field_size, + (unsigned long) proc_flags); + p += 7 + field_size; + } + if (unknown_flags) + { + size -= 10 + field_size; + if (p != buff + field_size + 4) + { + if (size < (2 + 1)) + abort (); + size -= 2; + *p++ = ','; + *p++ = ' '; + } + sprintf (p, "UNKNOWN (%*.*lx)", field_size, field_size, + (unsigned long) unknown_flags); + p += 10 + field_size; + } + } + + *p = '\0'; return buff; } @@ -3469,17 +3920,17 @@ process_section_headers (FILE *file) return 0; /* Read in the string table, so that we have names to display. */ - section = SECTION_HEADER (elf_header.e_shstrndx); - - if (section->sh_size != 0) + if (SECTION_HEADER_INDEX (elf_header.e_shstrndx) < elf_header.e_shnum) { - string_table = get_data (NULL, file, section->sh_offset, - section->sh_size, _("string table")); + section = SECTION_HEADER (elf_header.e_shstrndx); - if (string_table == NULL) - return 0; + if (section->sh_size != 0) + { + string_table = get_data (NULL, file, section->sh_offset, + 1, section->sh_size, _("string table")); - string_table_length = section->sh_size; + string_table_length = string_table != NULL ? section->sh_size : 0; + } } /* Scan the sections for the dynamic symbol table @@ -3489,6 +3940,42 @@ process_section_headers (FILE *file) dynamic_syminfo = NULL; symtab_shndx_hdr = NULL; + eh_addr_size = is_32bit_elf ? 4 : 8; + switch (elf_header.e_machine) + { + case EM_MIPS: + case EM_MIPS_RS3_LE: + /* The 64-bit MIPS EABI uses a combination of 32-bit ELF and 64-bit + FDE addresses. However, the ABI also has a semi-official ILP32 + variant for which the normal FDE address size rules apply. + + GCC 4.0 marks EABI64 objects with a dummy .gcc_compiled_longXX + section, where XX is the size of longs in bits. Unfortunately, + earlier compilers provided no way of distinguishing ILP32 objects + from LP64 objects, so if there's any doubt, we should assume that + the official LP64 form is being used. */ + if ((elf_header.e_flags & EF_MIPS_ABI) == E_MIPS_ABI_EABI64 + && find_section (".gcc_compiled_long32") == NULL) + eh_addr_size = 8; + break; + } + +#define CHECK_ENTSIZE_VALUES(section, i, size32, size64) \ + do \ + { \ + size_t expected_entsize \ + = is_32bit_elf ? size32 : size64; \ + if (section->sh_entsize != expected_entsize) \ + error (_("Section %d has invalid sh_entsize %lx (expected %lx)\n"), \ + i, (unsigned long int) section->sh_entsize, \ + (unsigned long int) expected_entsize); \ + section->sh_entsize = expected_entsize; \ + } \ + while (0) +#define CHECK_ENTSIZE(section, i, type) \ + CHECK_ENTSIZE_VALUES (section, i, sizeof (Elf32_External_##type), \ + sizeof (Elf64_External_##type)) + for (i = 0, section = section_headers; i < elf_header.e_shnum; i++, section++) @@ -3503,11 +3990,12 @@ process_section_headers (FILE *file) continue; } + CHECK_ENTSIZE (section, i, Sym); num_dynamic_syms = section->sh_size / section->sh_entsize; dynamic_symbols = GET_ELF_SYMBOLS (file, section); } else if (section->sh_type == SHT_STRTAB - && strcmp (name, ".dynstr") == 0) + && streq (name, ".dynstr")) { if (dynamic_strings != NULL) { @@ -3516,7 +4004,8 @@ process_section_headers (FILE *file) } dynamic_strings = get_data (NULL, file, section->sh_offset, - section->sh_size, _("dynamic strings")); + 1, section->sh_size, _("dynamic strings")); + dynamic_strings_length = section->sh_size; } else if (section->sh_type == SHT_SYMTAB_SHNDX) { @@ -3527,32 +4016,41 @@ process_section_headers (FILE *file) } symtab_shndx_hdr = section; } + else if (section->sh_type == SHT_SYMTAB) + CHECK_ENTSIZE (section, i, Sym); + else if (section->sh_type == SHT_GROUP) + CHECK_ENTSIZE_VALUES (section, i, GRP_ENTRY_SIZE, GRP_ENTRY_SIZE); + else if (section->sh_type == SHT_REL) + CHECK_ENTSIZE (section, i, Rel); + else if (section->sh_type == SHT_RELA) + CHECK_ENTSIZE (section, i, Rela); else if ((do_debugging || do_debug_info || do_debug_abbrevs || do_debug_lines || do_debug_pubnames || do_debug_aranges || do_debug_frames || do_debug_macinfo || do_debug_str - || do_debug_loc) - && strncmp (name, ".debug_", 7) == 0) + || do_debug_loc || do_debug_ranges) + && strneq (name, ".debug_", 7)) { name += 7; if (do_debugging - || (do_debug_info && (strcmp (name, "info") == 0)) - || (do_debug_abbrevs && (strcmp (name, "abbrev") == 0)) - || (do_debug_lines && (strcmp (name, "line") == 0)) - || (do_debug_pubnames && (strcmp (name, "pubnames") == 0)) - || (do_debug_aranges && (strcmp (name, "aranges") == 0)) - || (do_debug_frames && (strcmp (name, "frame") == 0)) - || (do_debug_macinfo && (strcmp (name, "macinfo") == 0)) - || (do_debug_str && (strcmp (name, "str") == 0)) - || (do_debug_loc && (strcmp (name, "loc") == 0)) + || (do_debug_info && streq (name, "info")) + || (do_debug_abbrevs && streq (name, "abbrev")) + || (do_debug_lines && streq (name, "line")) + || (do_debug_pubnames && streq (name, "pubnames")) + || (do_debug_aranges && streq (name, "aranges")) + || (do_debug_ranges && streq (name, "ranges")) + || (do_debug_frames && streq (name, "frame")) + || (do_debug_macinfo && streq (name, "macinfo")) + || (do_debug_str && streq (name, "str")) + || (do_debug_loc && streq (name, "loc")) ) request_dump (i, DEBUG_DUMP); } /* linkonce section to be combined with .debug_info at link time. */ else if ((do_debugging || do_debug_info) - && strncmp (name, ".gnu.linkonce.wi.", 17) == 0) + && strneq (name, ".gnu.linkonce.wi.", 17)) request_dump (i, DEBUG_DUMP); - else if (do_debug_frames && strcmp (name, ".eh_frame") == 0) + else if (do_debug_frames && streq (name, ".eh_frame")) request_dump (i, DEBUG_DUMP); } @@ -3565,25 +4063,63 @@ process_section_headers (FILE *file) printf (_("\nSection Header:\n")); if (is_32bit_elf) - printf - (_(" [Nr] Name Type Addr Off Size ES Flg Lk Inf Al\n")); + { + if (do_section_details) + { + printf (_(" [Nr] Name\n")); + printf (_(" Type Addr Off Size ES Lk Inf Al\n")); + } + else + printf + (_(" [Nr] Name Type Addr Off Size ES Flg Lk Inf Al\n")); + } else if (do_wide) - printf - (_(" [Nr] Name Type Address Off Size ES Flg Lk Inf Al\n")); + { + if (do_section_details) + { + printf (_(" [Nr] Name\n")); + printf (_(" Type Address Off Size ES Lk Inf Al\n")); + } + else + printf + (_(" [Nr] Name Type Address Off Size ES Flg Lk Inf Al\n")); + } else { - printf (_(" [Nr] Name Type Address Offset\n")); - printf (_(" Size EntSize Flags Link Info Align\n")); + if (do_section_details) + { + printf (_(" [Nr] Name\n")); + printf (_(" Type Address Offset Link\n")); + printf (_(" Size EntSize Info Align\n")); + } + else + { + printf (_(" [Nr] Name Type Address Offset\n")); + printf (_(" Size EntSize Flags Link Info Align\n")); + } } + if (do_section_details) + printf (_(" Flags\n")); + for (i = 0, section = section_headers; i < elf_header.e_shnum; i++, section++) { - printf (" [%2u] %-17.17s %-15.15s ", - SECTION_HEADER_NUM (i), - SECTION_NAME (section), - get_section_type_name (section->sh_type)); + if (do_section_details) + { + printf (" [%2u] %s\n", + SECTION_HEADER_NUM (i), + SECTION_NAME (section)); + if (is_32bit_elf || do_wide) + printf (" %-15.15s ", + get_section_type_name (section->sh_type)); + } + else + printf (" [%2u] %-17.17s %-15.15s ", + SECTION_HEADER_NUM (i), + SECTION_NAME (section), + get_section_type_name (section->sh_type)); if (is_32bit_elf) { @@ -3594,9 +4130,12 @@ process_section_headers (FILE *file) (unsigned long) section->sh_size, (unsigned long) section->sh_entsize); - printf (" %3s ", get_elf_section_flags (section->sh_flags)); + if (do_section_details) + fputs (" ", stdout); + else + printf (" %3s ", get_elf_section_flags (section->sh_flags)); - printf ("%2ld %3lx %2ld\n", + printf ("%2ld %3lu %2ld\n", (unsigned long) section->sh_link, (unsigned long) section->sh_info, (unsigned long) section->sh_addralign); @@ -3629,9 +4168,12 @@ process_section_headers (FILE *file) print_vma (section->sh_entsize, LONG_HEX); } - printf (" %3s ", get_elf_section_flags (section->sh_flags)); + if (do_section_details) + fputs (" ", stdout); + else + printf (" %3s ", get_elf_section_flags (section->sh_flags)); - printf ("%2ld %3lx ", + printf ("%2ld %3lu ", (unsigned long) section->sh_link, (unsigned long) section->sh_info); @@ -3643,6 +4185,27 @@ process_section_headers (FILE *file) putchar ('\n'); } } + else if (do_section_details) + { + printf (" %-15.15s ", + get_section_type_name (section->sh_type)); + print_vma (section->sh_addr, LONG_HEX); + if ((long) section->sh_offset == section->sh_offset) + printf (" %16.16lx", (unsigned long) section->sh_offset); + else + { + printf (" "); + print_vma (section->sh_offset, LONG_HEX); + } + printf (" %ld\n ", (unsigned long) section->sh_link); + print_vma (section->sh_size, LONG_HEX); + putchar (' '); + print_vma (section->sh_entsize, LONG_HEX); + + printf (" %-16lu %ld\n", + (unsigned long) section->sh_info, + (unsigned long) section->sh_addralign); + } else { putchar (' '); @@ -3661,14 +4224,18 @@ process_section_headers (FILE *file) printf (" %3s ", get_elf_section_flags (section->sh_flags)); - printf (" %2ld %3lx %ld\n", + printf (" %2ld %3lu %ld\n", (unsigned long) section->sh_link, (unsigned long) section->sh_info, (unsigned long) section->sh_addralign); } + + if (do_section_details) + printf (" %s\n", get_elf_section_flags (section->sh_flags)); } - printf (_("Key to Flags:\n\ + if (!do_section_details) + printf (_("Key to Flags:\n\ W (write), A (alloc), X (execute), M (merge), S (strings)\n\ I (info), L (link order), G (group), x (unknown)\n\ O (extra OS processing required) o (OS specific), p (processor specific)\n")); @@ -3676,7 +4243,257 @@ process_section_headers (FILE *file) return 1; } -struct +static const char * +get_group_flags (unsigned int flags) +{ + static char buff[32]; + switch (flags) + { + case GRP_COMDAT: + return "COMDAT"; + + default: + snprintf (buff, sizeof (buff), _("[: 0x%x]"), flags); + break; + } + return buff; +} + +static int +process_section_groups (FILE *file) +{ + Elf_Internal_Shdr *section; + unsigned int i; + struct group *group; + Elf_Internal_Shdr *symtab_sec, *strtab_sec; + Elf_Internal_Sym *symtab; + char *strtab; + size_t strtab_size; + + /* Don't process section groups unless needed. */ + if (!do_unwind && !do_section_groups) + return 1; + + if (elf_header.e_shnum == 0) + { + if (do_section_groups) + printf (_("\nThere are no sections in this file.\n")); + + return 1; + } + + if (section_headers == NULL) + { + error (_("Section headers are not available!\n")); + abort (); + } + + section_headers_groups = calloc (elf_header.e_shnum, + sizeof (struct group *)); + + if (section_headers_groups == NULL) + { + error (_("Out of memory\n")); + return 0; + } + + /* Scan the sections for the group section. */ + group_count = 0; + for (i = 0, section = section_headers; + i < elf_header.e_shnum; + i++, section++) + if (section->sh_type == SHT_GROUP) + group_count++; + + if (group_count == 0) + { + if (do_section_groups) + printf (_("\nThere are no section groups in this file.\n")); + + return 1; + } + + section_groups = calloc (group_count, sizeof (struct group)); + + if (section_groups == NULL) + { + error (_("Out of memory\n")); + return 0; + } + + symtab_sec = NULL; + strtab_sec = NULL; + symtab = NULL; + strtab = NULL; + strtab_size = 0; + for (i = 0, section = section_headers, group = section_groups; + i < elf_header.e_shnum; + i++, section++) + { + if (section->sh_type == SHT_GROUP) + { + char *name = SECTION_NAME (section); + char *group_name; + unsigned char *start, *indices; + unsigned int entry, j, size; + Elf_Internal_Shdr *sec; + Elf_Internal_Sym *sym; + + /* Get the symbol table. */ + if (SECTION_HEADER_INDEX (section->sh_link) >= elf_header.e_shnum + || ((sec = SECTION_HEADER (section->sh_link))->sh_type + != SHT_SYMTAB)) + { + error (_("Bad sh_link in group section `%s'\n"), name); + continue; + } + + if (symtab_sec != sec) + { + symtab_sec = sec; + if (symtab) + free (symtab); + symtab = GET_ELF_SYMBOLS (file, symtab_sec); + } + + sym = symtab + section->sh_info; + + if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) + { + bfd_vma sec_index = SECTION_HEADER_INDEX (sym->st_shndx); + if (sec_index == 0) + { + error (_("Bad sh_info in group section `%s'\n"), name); + continue; + } + + group_name = SECTION_NAME (section_headers + sec_index); + strtab_sec = NULL; + if (strtab) + free (strtab); + strtab = NULL; + strtab_size = 0; + } + else + { + /* Get the string table. */ + if (SECTION_HEADER_INDEX (symtab_sec->sh_link) + >= elf_header.e_shnum) + { + strtab_sec = NULL; + if (strtab) + free (strtab); + strtab = NULL; + strtab_size = 0; + } + else if (strtab_sec + != (sec = SECTION_HEADER (symtab_sec->sh_link))) + { + strtab_sec = sec; + if (strtab) + free (strtab); + strtab = get_data (NULL, file, strtab_sec->sh_offset, + 1, strtab_sec->sh_size, + _("string table")); + strtab_size = strtab != NULL ? strtab_sec->sh_size : 0; + } + group_name = sym->st_name < strtab_size + ? strtab + sym->st_name : ""; + } + + start = get_data (NULL, file, section->sh_offset, + 1, section->sh_size, _("section data")); + + indices = start; + size = (section->sh_size / section->sh_entsize) - 1; + entry = byte_get (indices, 4); + indices += 4; + + if (do_section_groups) + { + printf ("\n%s group section [%5u] `%s' [%s] contains %u sections:\n", + get_group_flags (entry), i, name, group_name, size); + + printf (_(" [Index] Name\n")); + } + + group->group_index = i; + + for (j = 0; j < size; j++) + { + struct group_list *g; + + entry = byte_get (indices, 4); + indices += 4; + + if (SECTION_HEADER_INDEX (entry) >= elf_header.e_shnum) + { + error (_("section [%5u] in group section [%5u] > maximum section [%5u]\n"), + entry, i, elf_header.e_shnum - 1); + continue; + } + else if (entry >= SHN_LORESERVE && entry <= SHN_HIRESERVE) + { + error (_("invalid section [%5u] in group section [%5u]\n"), + entry, i); + continue; + } + + if (section_headers_groups [SECTION_HEADER_INDEX (entry)] + != NULL) + { + if (entry) + { + error (_("section [%5u] in group section [%5u] already in group section [%5u]\n"), + entry, i, + section_headers_groups [SECTION_HEADER_INDEX (entry)]->group_index); + continue; + } + else + { + /* Intel C/C++ compiler may put section 0 in a + section group. We just warn it the first time + and ignore it afterwards. */ + static int warned = 0; + if (!warned) + { + error (_("section 0 in group section [%5u]\n"), + section_headers_groups [SECTION_HEADER_INDEX (entry)]->group_index); + warned++; + } + } + } + + section_headers_groups [SECTION_HEADER_INDEX (entry)] + = group; + + if (do_section_groups) + { + sec = SECTION_HEADER (entry); + printf (" [%5u] %s\n", entry, SECTION_NAME (sec)); + } + + g = xmalloc (sizeof (struct group_list)); + g->section_index = entry; + g->next = group->root; + group->root = g; + } + + if (start) + free (start); + + group++; + } + } + + if (symtab) + free (symtab); + if (strtab) + free (strtab); + return 1; +} + +static struct { const char *name; int reloc; @@ -3690,6 +4507,7 @@ struct }; /* Process the reloc section. */ + static int process_relocs (FILE *file) { @@ -3742,7 +4560,7 @@ process_relocs (FILE *file) offset_from_vma (file, rel_offset, rel_size), rel_size, dynamic_symbols, num_dynamic_syms, - dynamic_strings, is_rela); + dynamic_strings, dynamic_strings_length, is_rela); } } @@ -3769,10 +4587,7 @@ process_relocs (FILE *file) if (rel_size) { Elf_Internal_Shdr *strsec; - Elf_Internal_Sym *symtab; - char *strtab; int is_rela; - unsigned long nsyms; printf (_("\nRelocation section ")); @@ -3784,34 +4599,49 @@ process_relocs (FILE *file) printf (_(" at offset 0x%lx contains %lu entries:\n"), rel_offset, (unsigned long) (rel_size / section->sh_entsize)); - symtab = NULL; - strtab = NULL; - nsyms = 0; - if (section->sh_link) + is_rela = section->sh_type == SHT_RELA; + + if (section->sh_link + && SECTION_HEADER_INDEX (section->sh_link) + < elf_header.e_shnum) { Elf_Internal_Shdr *symsec; + Elf_Internal_Sym *symtab; + unsigned long nsyms; + unsigned long strtablen = 0; + char *strtab = NULL; symsec = SECTION_HEADER (section->sh_link); + if (symsec->sh_type != SHT_SYMTAB + && symsec->sh_type != SHT_DYNSYM) + continue; + nsyms = symsec->sh_size / symsec->sh_entsize; symtab = GET_ELF_SYMBOLS (file, symsec); if (symtab == NULL) continue; - strsec = SECTION_HEADER (symsec->sh_link); + if (SECTION_HEADER_INDEX (symsec->sh_link) + < elf_header.e_shnum) + { + strsec = SECTION_HEADER (symsec->sh_link); - strtab = get_data (NULL, file, strsec->sh_offset, - strsec->sh_size, _("string table")); + strtab = get_data (NULL, file, strsec->sh_offset, + 1, strsec->sh_size, + _("string table")); + strtablen = strtab == NULL ? 0 : strsec->sh_size; + } + + dump_relocations (file, rel_offset, rel_size, + symtab, nsyms, strtab, strtablen, is_rela); + if (strtab) + free (strtab); + free (symtab); } - is_rela = section->sh_type == SHT_RELA; - - dump_relocations (file, rel_offset, rel_size, - symtab, nsyms, strtab, is_rela); - - if (strtab) - free (strtab); - if (symtab) - free (symtab); + else + dump_relocations (file, rel_offset, rel_size, + NULL, 0, NULL, 0, is_rela); found = 1; } @@ -3824,6 +4654,8 @@ process_relocs (FILE *file) return 1; } +/* Process the unwind section. */ + #include "unwind-ia64.h" /* An absolute address consists of a section and an offset. If the @@ -3836,9 +4668,14 @@ struct absaddr bfd_vma offset; }; -struct unw_aux_info +#define ABSADDR(a) \ + ((a).section \ + ? section_headers [(a).section].sh_addr + (a).offset \ + : (a).offset) + +struct ia64_unw_aux_info { - struct unw_table_entry + struct ia64_unw_table_entry { struct absaddr start; struct absaddr end; @@ -3857,7 +4694,10 @@ struct unw_aux_info }; static void -find_symbol_for_address (struct unw_aux_info *aux, +find_symbol_for_address (Elf_Internal_Sym *symtab, + unsigned long nsyms, + const char *strtab, + unsigned long strtab_size, struct absaddr addr, const char **symname, bfd_vma *offset) @@ -3866,7 +4706,7 @@ find_symbol_for_address (struct unw_aux_info *aux, Elf_Internal_Sym *sym, *best = NULL; unsigned long i; - for (i = 0, sym = aux->symtab; i < aux->nsyms; ++i, ++sym) + for (i = 0, sym = symtab; i < nsyms; ++i, ++sym) { if (ELF_ST_TYPE (sym->st_info) == STT_FUNC && sym->st_name != 0 @@ -3882,8 +4722,8 @@ find_symbol_for_address (struct unw_aux_info *aux, } if (best) { - *symname = (best->st_name >= aux->strtab_size - ? "" : aux->strtab + best->st_name); + *symname = (best->st_name >= strtab_size + ? "" : strtab + best->st_name); *offset = dist; return; } @@ -3892,14 +4732,11 @@ find_symbol_for_address (struct unw_aux_info *aux, } static void -dump_ia64_unwind (struct unw_aux_info *aux) +dump_ia64_unwind (struct ia64_unw_aux_info *aux) { - bfd_vma addr_size; - struct unw_table_entry *tp; + struct ia64_unw_table_entry *tp; int in_body; - addr_size = is_32bit_elf ? 4 : 8; - for (tp = aux->table; tp < aux->table + aux->table_len; ++tp) { bfd_vma stamp; @@ -3908,7 +4745,8 @@ dump_ia64_unwind (struct unw_aux_info *aux) const unsigned char *head; const char *procname; - find_symbol_for_address (aux, tp->start, &procname, &offset); + find_symbol_for_address (aux->symtab, aux->nsyms, aux->strtab, + aux->strtab_size, tp->start, &procname, &offset); fputs ("\n<", stdout); @@ -3927,15 +4765,15 @@ dump_ia64_unwind (struct unw_aux_info *aux) printf ("], info at +0x%lx\n", (unsigned long) (tp->info.offset - aux->seg_base)); - head = aux->info + (tp->info.offset - aux->info_addr); - stamp = BYTE_GET8 ((unsigned char *) head); + head = aux->info + (ABSADDR (tp->info) - aux->info_addr); + stamp = byte_get ((unsigned char *) head, sizeof (stamp)); printf (" v%u, flags=0x%lx (%s%s), len=%lu bytes\n", (unsigned) UNW_VER (stamp), (unsigned long) ((stamp & UNW_FLAG_MASK) >> 32), UNW_FLAG_EHANDLER (stamp) ? " ehandler" : "", UNW_FLAG_UHANDLER (stamp) ? " uhandler" : "", - (unsigned long) (addr_size * UNW_LENGTH (stamp))); + (unsigned long) (eh_addr_size * UNW_LENGTH (stamp))); if (UNW_VER (stamp) != 1) { @@ -3944,27 +4782,25 @@ dump_ia64_unwind (struct unw_aux_info *aux) } in_body = 0; - for (dp = head + 8; dp < head + 8 + addr_size * UNW_LENGTH (stamp);) + for (dp = head + 8; dp < head + 8 + eh_addr_size * UNW_LENGTH (stamp);) dp = unw_decode (dp, in_body, & in_body); } } static int slurp_ia64_unwind_table (FILE *file, - struct unw_aux_info *aux, + struct ia64_unw_aux_info *aux, Elf_Internal_Shdr *sec) { - unsigned long size, addr_size, nrelas, i; + unsigned long size, nrelas, i; Elf_Internal_Phdr *seg; - struct unw_table_entry *tep; + struct ia64_unw_table_entry *tep; Elf_Internal_Shdr *relsec; Elf_Internal_Rela *rela, *rp; unsigned char *table, *tp; Elf_Internal_Sym *sym; const char *relname; - addr_size = is_32bit_elf ? 4 : 8; - /* First, find the starting address of the segment that includes this section: */ @@ -3991,12 +4827,13 @@ slurp_ia64_unwind_table (FILE *file, /* Second, build the unwind table from the contents of the unwind section: */ size = sec->sh_size; - table = get_data (NULL, file, sec->sh_offset, size, _("unwind table")); + table = get_data (NULL, file, sec->sh_offset, 1, size, _("unwind table")); if (!table) return 0; - tep = aux->table = xmalloc (size / (3 * addr_size) * sizeof (aux->table[0])); - for (tp = table; tp < table + size; tp += 3 * addr_size, ++tep) + aux->table = xcmalloc (size / (3 * eh_addr_size), sizeof (aux->table[0])); + tep = aux->table; + for (tp = table; tp < table + size; tp += 3 * eh_addr_size, ++tep) { tep->start.section = SHN_UNDEF; tep->end.section = SHN_UNDEF; @@ -4009,9 +4846,9 @@ slurp_ia64_unwind_table (FILE *file, } else { - tep->start.offset = BYTE_GET8 ((unsigned char *) tp + 0); - tep->end.offset = BYTE_GET8 ((unsigned char *) tp + 8); - tep->info.offset = BYTE_GET8 ((unsigned char *) tp + 16); + tep->start.offset = BYTE_GET ((unsigned char *) tp + 0); + tep->end.offset = BYTE_GET ((unsigned char *) tp + 8); + tep->info.offset = BYTE_GET ((unsigned char *) tp + 16); } tep->start.offset += aux->seg_base; tep->end.offset += aux->seg_base; @@ -4026,6 +4863,7 @@ slurp_ia64_unwind_table (FILE *file, ++relsec) { if (relsec->sh_type != SHT_RELA + || SECTION_HEADER_INDEX (relsec->sh_info) >= elf_header.e_shnum || SECTION_HEADER (relsec->sh_info) != sec) continue; @@ -4039,48 +4877,34 @@ slurp_ia64_unwind_table (FILE *file, { relname = elf_ia64_reloc_type (ELF32_R_TYPE (rp->r_info)); sym = aux->symtab + ELF32_R_SYM (rp->r_info); - - if (ELF32_ST_TYPE (sym->st_info) != STT_SECTION) - { - warn (_("Skipping unexpected symbol type %u\n"), - ELF32_ST_TYPE (sym->st_info)); - continue; - } } else { relname = elf_ia64_reloc_type (ELF64_R_TYPE (rp->r_info)); sym = aux->symtab + ELF64_R_SYM (rp->r_info); - - if (ELF64_ST_TYPE (sym->st_info) != STT_SECTION) - { - warn (_("Skipping unexpected symbol type %u\n"), - ELF64_ST_TYPE (sym->st_info)); - continue; - } } - if (strncmp (relname, "R_IA64_SEGREL", 13) != 0) + if (! strneq (relname, "R_IA64_SEGREL", 13)) { warn (_("Skipping unexpected relocation type %s\n"), relname); continue; } - i = rp->r_offset / (3 * addr_size); + i = rp->r_offset / (3 * eh_addr_size); - switch (rp->r_offset/addr_size % 3) + switch (rp->r_offset/eh_addr_size % 3) { case 0: aux->table[i].start.section = sym->st_shndx; - aux->table[i].start.offset += rp->r_addend; + aux->table[i].start.offset += rp->r_addend + sym->st_value; break; case 1: aux->table[i].end.section = sym->st_shndx; - aux->table[i].end.offset += rp->r_addend; + aux->table[i].end.offset += rp->r_addend + sym->st_value; break; case 2: aux->table[i].info.section = sym->st_shndx; - aux->table[i].info.offset += rp->r_addend; + aux->table[i].info.offset += rp->r_addend + sym->st_value; break; default: break; @@ -4090,41 +4914,31 @@ slurp_ia64_unwind_table (FILE *file, free (rela); } - aux->table_len = size / (3 * addr_size); + aux->table_len = size / (3 * eh_addr_size); return 1; } static int -process_unwind (FILE *file) +ia64_process_unwind (FILE *file) { Elf_Internal_Shdr *sec, *unwsec = NULL, *strsec; - unsigned long i, addr_size, unwcount = 0, unwstart = 0; - struct unw_aux_info aux; - - if (!do_unwind) - return 1; - - if (elf_header.e_machine != EM_IA_64) - { - printf (_("\nThere are no unwind sections in this file.\n")); - return 1; - } + unsigned long i, unwcount = 0, unwstart = 0; + struct ia64_unw_aux_info aux; memset (& aux, 0, sizeof (aux)); - addr_size = is_32bit_elf ? 4 : 8; - for (i = 0, sec = section_headers; i < elf_header.e_shnum; ++i, ++sec) { - if (sec->sh_type == SHT_SYMTAB) + if (sec->sh_type == SHT_SYMTAB + && SECTION_HEADER_INDEX (sec->sh_link) < elf_header.e_shnum) { aux.nsyms = sec->sh_size / sec->sh_entsize; aux.symtab = GET_ELF_SYMBOLS (file, sec); strsec = SECTION_HEADER (sec->sh_link); - aux.strtab_size = strsec->sh_size; aux.strtab = get_data (NULL, file, strsec->sh_offset, - aux.strtab_size, _("string table")); + 1, strsec->sh_size, _("string table")); + aux.strtab_size = aux.strtab != NULL ? strsec->sh_size : 0; } else if (sec->sh_type == SHT_IA_64_UNWIND) unwcount++; @@ -4149,34 +4963,46 @@ process_unwind (FILE *file) unwstart = i + 1; len = sizeof (ELF_STRING_ia64_unwind_once) - 1; - if (strncmp (SECTION_NAME (unwsec), ELF_STRING_ia64_unwind_once, - len) == 0) + if ((unwsec->sh_flags & SHF_GROUP) != 0) { - /* .gnu.linkonce.ia64unw.FOO -> .gnu.linkonce.ia64unwi.FOO */ + /* We need to find which section group it is in. */ + struct group_list *g = section_headers_groups [i]->root; + + for (; g != NULL; g = g->next) + { + sec = SECTION_HEADER (g->section_index); + + if (streq (SECTION_NAME (sec), ELF_STRING_ia64_unwind_info)) + break; + } + + if (g == NULL) + i = elf_header.e_shnum; + } + else if (strneq (SECTION_NAME (unwsec), ELF_STRING_ia64_unwind_once, len)) + { + /* .gnu.linkonce.ia64unw.FOO -> .gnu.linkonce.ia64unwi.FOO. */ len2 = sizeof (ELF_STRING_ia64_unwind_info_once) - 1; suffix = SECTION_NAME (unwsec) + len; for (i = 0, sec = section_headers; i < elf_header.e_shnum; ++i, ++sec) - if (strncmp (SECTION_NAME (sec), - ELF_STRING_ia64_unwind_info_once, len2) == 0 - && strcmp (SECTION_NAME (sec) + len2, suffix) == 0) + if (strneq (SECTION_NAME (sec), ELF_STRING_ia64_unwind_info_once, len2) + && streq (SECTION_NAME (sec) + len2, suffix)) break; } else { /* .IA_64.unwindFOO -> .IA_64.unwind_infoFOO - .IA_64.unwind or BAR -> .IA_64.unwind_info */ + .IA_64.unwind or BAR -> .IA_64.unwind_info. */ len = sizeof (ELF_STRING_ia64_unwind) - 1; len2 = sizeof (ELF_STRING_ia64_unwind_info) - 1; suffix = ""; - if (strncmp (SECTION_NAME (unwsec), ELF_STRING_ia64_unwind, - len) == 0) + if (strneq (SECTION_NAME (unwsec), ELF_STRING_ia64_unwind, len)) suffix = SECTION_NAME (unwsec) + len; for (i = 0, sec = section_headers; i < elf_header.e_shnum; ++i, ++sec) - if (strncmp (SECTION_NAME (sec), - ELF_STRING_ia64_unwind_info, len2) == 0 - && strcmp (SECTION_NAME (sec) + len2, suffix) == 0) + if (strneq (SECTION_NAME (sec), ELF_STRING_ia64_unwind_info, len2) + && streq (SECTION_NAME (sec) + len2, suffix)) break; } @@ -4193,7 +5019,7 @@ process_unwind (FILE *file) { aux.info_size = sec->sh_size; aux.info_addr = sec->sh_addr; - aux.info = get_data (NULL, file, sec->sh_offset, aux.info_size, + aux.info = get_data (NULL, file, sec->sh_offset, 1, aux.info_size, _("unwind info")); printf (_("\nUnwind section ")); @@ -4205,7 +5031,7 @@ process_unwind (FILE *file) printf (_(" at offset 0x%lx contains %lu entries:\n"), (unsigned long) unwsec->sh_offset, - (unsigned long) (unwsec->sh_size / (3 * addr_size))); + (unsigned long) (unwsec->sh_size / (3 * eh_addr_size))); (void) slurp_ia64_unwind_table (file, & aux, unwsec); @@ -4229,8 +5055,368 @@ process_unwind (FILE *file) return 1; } +struct hppa_unw_aux_info + { + struct hppa_unw_table_entry + { + struct absaddr start; + struct absaddr end; + unsigned int Cannot_unwind:1; /* 0 */ + unsigned int Millicode:1; /* 1 */ + unsigned int Millicode_save_sr0:1; /* 2 */ + unsigned int Region_description:2; /* 3..4 */ + unsigned int reserved1:1; /* 5 */ + unsigned int Entry_SR:1; /* 6 */ + unsigned int Entry_FR:4; /* number saved */ /* 7..10 */ + unsigned int Entry_GR:5; /* number saved */ /* 11..15 */ + unsigned int Args_stored:1; /* 16 */ + unsigned int Variable_Frame:1; /* 17 */ + unsigned int Separate_Package_Body:1; /* 18 */ + unsigned int Frame_Extension_Millicode:1; /* 19 */ + unsigned int Stack_Overflow_Check:1; /* 20 */ + unsigned int Two_Instruction_SP_Increment:1; /* 21 */ + unsigned int Ada_Region:1; /* 22 */ + unsigned int cxx_info:1; /* 23 */ + unsigned int cxx_try_catch:1; /* 24 */ + unsigned int sched_entry_seq:1; /* 25 */ + unsigned int reserved2:1; /* 26 */ + unsigned int Save_SP:1; /* 27 */ + unsigned int Save_RP:1; /* 28 */ + unsigned int Save_MRP_in_frame:1; /* 29 */ + unsigned int extn_ptr_defined:1; /* 30 */ + unsigned int Cleanup_defined:1; /* 31 */ + + unsigned int MPE_XL_interrupt_marker:1; /* 0 */ + unsigned int HP_UX_interrupt_marker:1; /* 1 */ + unsigned int Large_frame:1; /* 2 */ + unsigned int Pseudo_SP_Set:1; /* 3 */ + unsigned int reserved4:1; /* 4 */ + unsigned int Total_frame_size:27; /* 5..31 */ + } + *table; /* Unwind table. */ + unsigned long table_len; /* Length of unwind table. */ + bfd_vma seg_base; /* Starting address of segment. */ + Elf_Internal_Sym *symtab; /* The symbol table. */ + unsigned long nsyms; /* Number of symbols. */ + char *strtab; /* The string table. */ + unsigned long strtab_size; /* Size of string table. */ + }; + static void -dynamic_segment_mips_val (Elf_Internal_Dyn *entry) +dump_hppa_unwind (struct hppa_unw_aux_info *aux) +{ + struct hppa_unw_table_entry *tp; + + for (tp = aux->table; tp < aux->table + aux->table_len; ++tp) + { + bfd_vma offset; + const char *procname; + + find_symbol_for_address (aux->symtab, aux->nsyms, aux->strtab, + aux->strtab_size, tp->start, &procname, + &offset); + + fputs ("\n<", stdout); + + if (procname) + { + fputs (procname, stdout); + + if (offset) + printf ("+%lx", (unsigned long) offset); + } + + fputs (">: [", stdout); + print_vma (tp->start.offset, PREFIX_HEX); + fputc ('-', stdout); + print_vma (tp->end.offset, PREFIX_HEX); + printf ("]\n\t"); + +#define PF(_m) if (tp->_m) printf (#_m " "); +#define PV(_m) if (tp->_m) printf (#_m "=%d ", tp->_m); + PF(Cannot_unwind); + PF(Millicode); + PF(Millicode_save_sr0); + /* PV(Region_description); */ + PF(Entry_SR); + PV(Entry_FR); + PV(Entry_GR); + PF(Args_stored); + PF(Variable_Frame); + PF(Separate_Package_Body); + PF(Frame_Extension_Millicode); + PF(Stack_Overflow_Check); + PF(Two_Instruction_SP_Increment); + PF(Ada_Region); + PF(cxx_info); + PF(cxx_try_catch); + PF(sched_entry_seq); + PF(Save_SP); + PF(Save_RP); + PF(Save_MRP_in_frame); + PF(extn_ptr_defined); + PF(Cleanup_defined); + PF(MPE_XL_interrupt_marker); + PF(HP_UX_interrupt_marker); + PF(Large_frame); + PF(Pseudo_SP_Set); + PV(Total_frame_size); +#undef PF +#undef PV + } + + printf ("\n"); +} + +static int +slurp_hppa_unwind_table (FILE *file, + struct hppa_unw_aux_info *aux, + Elf_Internal_Shdr *sec) +{ + unsigned long size, unw_ent_size, nentries, nrelas, i; + Elf_Internal_Phdr *seg; + struct hppa_unw_table_entry *tep; + Elf_Internal_Shdr *relsec; + Elf_Internal_Rela *rela, *rp; + unsigned char *table, *tp; + Elf_Internal_Sym *sym; + const char *relname; + + /* First, find the starting address of the segment that includes + this section. */ + + if (elf_header.e_phnum) + { + if (! get_program_headers (file)) + return 0; + + for (seg = program_headers; + seg < program_headers + elf_header.e_phnum; + ++seg) + { + if (seg->p_type != PT_LOAD) + continue; + + if (sec->sh_addr >= seg->p_vaddr + && (sec->sh_addr + sec->sh_size <= seg->p_vaddr + seg->p_memsz)) + { + aux->seg_base = seg->p_vaddr; + break; + } + } + } + + /* Second, build the unwind table from the contents of the unwind + section. */ + size = sec->sh_size; + table = get_data (NULL, file, sec->sh_offset, 1, size, _("unwind table")); + if (!table) + return 0; + + unw_ent_size = 16; + nentries = size / unw_ent_size; + size = unw_ent_size * nentries; + + tep = aux->table = xcmalloc (nentries, sizeof (aux->table[0])); + + for (tp = table; tp < table + size; tp += unw_ent_size, ++tep) + { + unsigned int tmp1, tmp2; + + tep->start.section = SHN_UNDEF; + tep->end.section = SHN_UNDEF; + + tep->start.offset = byte_get ((unsigned char *) tp + 0, 4); + tep->end.offset = byte_get ((unsigned char *) tp + 4, 4); + tmp1 = byte_get ((unsigned char *) tp + 8, 4); + tmp2 = byte_get ((unsigned char *) tp + 12, 4); + + tep->start.offset += aux->seg_base; + tep->end.offset += aux->seg_base; + + tep->Cannot_unwind = (tmp1 >> 31) & 0x1; + tep->Millicode = (tmp1 >> 30) & 0x1; + tep->Millicode_save_sr0 = (tmp1 >> 29) & 0x1; + tep->Region_description = (tmp1 >> 27) & 0x3; + tep->reserved1 = (tmp1 >> 26) & 0x1; + tep->Entry_SR = (tmp1 >> 25) & 0x1; + tep->Entry_FR = (tmp1 >> 21) & 0xf; + tep->Entry_GR = (tmp1 >> 16) & 0x1f; + tep->Args_stored = (tmp1 >> 15) & 0x1; + tep->Variable_Frame = (tmp1 >> 14) & 0x1; + tep->Separate_Package_Body = (tmp1 >> 13) & 0x1; + tep->Frame_Extension_Millicode = (tmp1 >> 12) & 0x1; + tep->Stack_Overflow_Check = (tmp1 >> 11) & 0x1; + tep->Two_Instruction_SP_Increment = (tmp1 >> 10) & 0x1; + tep->Ada_Region = (tmp1 >> 9) & 0x1; + tep->cxx_info = (tmp1 >> 8) & 0x1; + tep->cxx_try_catch = (tmp1 >> 7) & 0x1; + tep->sched_entry_seq = (tmp1 >> 6) & 0x1; + tep->reserved2 = (tmp1 >> 5) & 0x1; + tep->Save_SP = (tmp1 >> 4) & 0x1; + tep->Save_RP = (tmp1 >> 3) & 0x1; + tep->Save_MRP_in_frame = (tmp1 >> 2) & 0x1; + tep->extn_ptr_defined = (tmp1 >> 1) & 0x1; + tep->Cleanup_defined = tmp1 & 0x1; + + tep->MPE_XL_interrupt_marker = (tmp2 >> 31) & 0x1; + tep->HP_UX_interrupt_marker = (tmp2 >> 30) & 0x1; + tep->Large_frame = (tmp2 >> 29) & 0x1; + tep->Pseudo_SP_Set = (tmp2 >> 28) & 0x1; + tep->reserved4 = (tmp2 >> 27) & 0x1; + tep->Total_frame_size = tmp2 & 0x7ffffff; + } + free (table); + + /* Third, apply any relocations to the unwind table. */ + + for (relsec = section_headers; + relsec < section_headers + elf_header.e_shnum; + ++relsec) + { + if (relsec->sh_type != SHT_RELA + || SECTION_HEADER_INDEX (relsec->sh_info) >= elf_header.e_shnum + || SECTION_HEADER (relsec->sh_info) != sec) + continue; + + if (!slurp_rela_relocs (file, relsec->sh_offset, relsec->sh_size, + & rela, & nrelas)) + return 0; + + for (rp = rela; rp < rela + nrelas; ++rp) + { + if (is_32bit_elf) + { + relname = elf_hppa_reloc_type (ELF32_R_TYPE (rp->r_info)); + sym = aux->symtab + ELF32_R_SYM (rp->r_info); + } + else + { + relname = elf_hppa_reloc_type (ELF64_R_TYPE (rp->r_info)); + sym = aux->symtab + ELF64_R_SYM (rp->r_info); + } + + /* R_PARISC_SEGREL32 or R_PARISC_SEGREL64. */ + if (strncmp (relname, "R_PARISC_SEGREL", 15) != 0) + { + warn (_("Skipping unexpected relocation type %s\n"), relname); + continue; + } + + i = rp->r_offset / unw_ent_size; + + switch ((rp->r_offset % unw_ent_size) / eh_addr_size) + { + case 0: + aux->table[i].start.section = sym->st_shndx; + aux->table[i].start.offset += sym->st_value + rp->r_addend; + break; + case 1: + aux->table[i].end.section = sym->st_shndx; + aux->table[i].end.offset += sym->st_value + rp->r_addend; + break; + default: + break; + } + } + + free (rela); + } + + aux->table_len = nentries; + + return 1; +} + +static int +hppa_process_unwind (FILE *file) +{ + struct hppa_unw_aux_info aux; + Elf_Internal_Shdr *unwsec = NULL; + Elf_Internal_Shdr *strsec; + Elf_Internal_Shdr *sec; + unsigned long i; + + memset (& aux, 0, sizeof (aux)); + + if (string_table == NULL) + return 1; + + for (i = 0, sec = section_headers; i < elf_header.e_shnum; ++i, ++sec) + { + if (sec->sh_type == SHT_SYMTAB + && SECTION_HEADER_INDEX (sec->sh_link) < elf_header.e_shnum) + { + aux.nsyms = sec->sh_size / sec->sh_entsize; + aux.symtab = GET_ELF_SYMBOLS (file, sec); + + strsec = SECTION_HEADER (sec->sh_link); + aux.strtab = get_data (NULL, file, strsec->sh_offset, + 1, strsec->sh_size, _("string table")); + aux.strtab_size = aux.strtab != NULL ? strsec->sh_size : 0; + } + else if (streq (SECTION_NAME (sec), ".PARISC.unwind")) + unwsec = sec; + } + + if (!unwsec) + printf (_("\nThere are no unwind sections in this file.\n")); + + for (i = 0, sec = section_headers; i < elf_header.e_shnum; ++i, ++sec) + { + if (streq (SECTION_NAME (sec), ".PARISC.unwind")) + { + printf (_("\nUnwind section ")); + printf (_("'%s'"), SECTION_NAME (sec)); + + printf (_(" at offset 0x%lx contains %lu entries:\n"), + (unsigned long) sec->sh_offset, + (unsigned long) (sec->sh_size / (2 * eh_addr_size + 8))); + + slurp_hppa_unwind_table (file, &aux, sec); + if (aux.table_len > 0) + dump_hppa_unwind (&aux); + + if (aux.table) + free ((char *) aux.table); + aux.table = NULL; + } + } + + if (aux.symtab) + free (aux.symtab); + if (aux.strtab) + free ((char *) aux.strtab); + + return 1; +} + +static int +process_unwind (FILE *file) +{ + struct unwind_handler { + int machtype; + int (*handler)(FILE *file); + } handlers[] = { + { EM_IA_64, ia64_process_unwind }, + { EM_PARISC, hppa_process_unwind }, + { 0, 0 } + }; + int i; + + if (!do_unwind) + return 1; + + for (i = 0; handlers[i].handler != NULL; i++) + if (elf_header.e_machine == handlers[i].machtype) + return handlers[i].handler (file); + + printf (_("\nThere are no unwind sections in this file.\n")); + return 1; +} + +static void +dynamic_section_mips_val (Elf_Internal_Dyn *entry) { switch (entry->d_tag) { @@ -4260,11 +5446,10 @@ dynamic_segment_mips_val (Elf_Internal_Dyn *entry) break; case DT_MIPS_IVERSION: - if (dynamic_strings != NULL) - printf ("Interface Version: %s\n", - dynamic_strings + entry->d_un.d_val); + if (VALID_DYNAMIC_NAME (entry->d_un.d_val)) + printf ("Interface Version: %s\n", GET_DYNAMIC_NAME (entry->d_un.d_val)); else - printf ("%ld\n", (long) entry->d_un.d_ptr); + printf ("\n", (long) entry->d_un.d_ptr); break; case DT_MIPS_TIME_STAMP: @@ -4274,9 +5459,9 @@ dynamic_segment_mips_val (Elf_Internal_Dyn *entry) time_t time = entry->d_un.d_val; tmp = gmtime (&time); - sprintf (timebuf, "%04u-%02u-%02uT%02u:%02u:%02u", - tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday, - tmp->tm_hour, tmp->tm_min, tmp->tm_sec); + snprintf (timebuf, sizeof (timebuf), "%04u-%02u-%02uT%02u:%02u:%02u", + tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday, + tmp->tm_hour, tmp->tm_min, tmp->tm_sec); printf ("Time Stamp: %s\n", timebuf); } break; @@ -4304,7 +5489,7 @@ dynamic_segment_mips_val (Elf_Internal_Dyn *entry) static void -dynamic_segment_parisc_val (Elf_Internal_Dyn *entry) +dynamic_section_parisc_val (Elf_Internal_Dyn *entry) { switch (entry->d_tag) { @@ -4327,7 +5512,13 @@ dynamic_segment_parisc_val (Elf_Internal_Dyn *entry) { DT_HP_BIND_RESTRICTED, "HP_BIND_RESTRICTED" }, { DT_HP_BIND_SYMBOLIC, "HP_BIND_SYMBOLIC" }, { DT_HP_RPATH_FIRST, "HP_RPATH_FIRST" }, - { DT_HP_BIND_DEPTH_FIRST, "HP_BIND_DEPTH_FIRST" } + { DT_HP_BIND_DEPTH_FIRST, "HP_BIND_DEPTH_FIRST" }, + { DT_HP_GST, "HP_GST" }, + { DT_HP_SHLIB_FIXED, "HP_SHLIB_FIXED" }, + { DT_HP_MERGE_SHLIB_SEG, "HP_MERGE_SHLIB_SEG" }, + { DT_HP_NODELETE, "HP_NODELETE" }, + { DT_HP_GROUP, "HP_GROUP" }, + { DT_HP_PROTECT_LINKAGE_TABLE, "HP_PROTECT_LINKAGE_TABLE" } }; int first = 1; size_t cnt; @@ -4360,7 +5551,7 @@ dynamic_segment_parisc_val (Elf_Internal_Dyn *entry) } static void -dynamic_segment_ia64_val (Elf_Internal_Dyn *entry) +dynamic_section_ia64_val (Elf_Internal_Dyn *entry) { switch (entry->d_tag) { @@ -4379,39 +5570,42 @@ dynamic_segment_ia64_val (Elf_Internal_Dyn *entry) } static int -get_32bit_dynamic_segment (FILE *file) +get_32bit_dynamic_section (FILE *file) { - Elf32_External_Dyn *edyn; + Elf32_External_Dyn *edyn, *ext; Elf_Internal_Dyn *entry; - bfd_size_type i; - edyn = get_data (NULL, file, dynamic_addr, dynamic_size, - _("dynamic segment")); + edyn = get_data (NULL, file, dynamic_addr, 1, dynamic_size, + _("dynamic section")); if (!edyn) return 0; - /* SGI's ELF has more than one section in the DYNAMIC segment. Determine - how large this .dynamic is now. We can do this even before the byte - swapping since the DT_NULL tag is recognizable. */ - dynamic_size = 0; - while (*(Elf32_Word *) edyn[dynamic_size++].d_tag != DT_NULL) - ; +/* SGI's ELF has more than one section in the DYNAMIC segment, and we + might not have the luxury of section headers. Look for the DT_NULL + terminator to determine the number of entries. */ + for (ext = edyn, dynamic_nent = 0; + (char *) ext < (char *) edyn + dynamic_size; + ext++) + { + dynamic_nent++; + if (BYTE_GET (ext->d_tag) == DT_NULL) + break; + } - dynamic_segment = malloc (dynamic_size * sizeof (Elf_Internal_Dyn)); - - if (dynamic_segment == NULL) + dynamic_section = cmalloc (dynamic_nent, sizeof (*entry)); + if (dynamic_section == NULL) { error (_("Out of memory\n")); free (edyn); return 0; } - for (i = 0, entry = dynamic_segment; - i < dynamic_size; - i++, entry++) + for (ext = edyn, entry = dynamic_section; + entry < dynamic_section + dynamic_nent; + ext++, entry++) { - entry->d_tag = BYTE_GET (edyn[i].d_tag); - entry->d_un.d_val = BYTE_GET (edyn[i].d_un.d_val); + entry->d_tag = BYTE_GET (ext->d_tag); + entry->d_un.d_val = BYTE_GET (ext->d_un.d_val); } free (edyn); @@ -4420,39 +5614,42 @@ get_32bit_dynamic_segment (FILE *file) } static int -get_64bit_dynamic_segment (FILE *file) +get_64bit_dynamic_section (FILE *file) { - Elf64_External_Dyn *edyn; + Elf64_External_Dyn *edyn, *ext; Elf_Internal_Dyn *entry; - bfd_size_type i; - edyn = get_data (NULL, file, dynamic_addr, dynamic_size, - _("dynamic segment")); + edyn = get_data (NULL, file, dynamic_addr, 1, dynamic_size, + _("dynamic section")); if (!edyn) return 0; - /* SGI's ELF has more than one section in the DYNAMIC segment. Determine - how large this .dynamic is now. We can do this even before the byte - swapping since the DT_NULL tag is recognizable. */ - dynamic_size = 0; - while (*(bfd_vma *) edyn[dynamic_size++].d_tag != DT_NULL) - ; +/* SGI's ELF has more than one section in the DYNAMIC segment, and we + might not have the luxury of section headers. Look for the DT_NULL + terminator to determine the number of entries. */ + for (ext = edyn, dynamic_nent = 0; + (char *) ext < (char *) edyn + dynamic_size; + ext++) + { + dynamic_nent++; + if (BYTE_GET (ext->d_tag) == DT_NULL) + break; + } - dynamic_segment = malloc (dynamic_size * sizeof (Elf_Internal_Dyn)); - - if (dynamic_segment == NULL) + dynamic_section = cmalloc (dynamic_nent, sizeof (*entry)); + if (dynamic_section == NULL) { error (_("Out of memory\n")); free (edyn); return 0; } - for (i = 0, entry = dynamic_segment; - i < dynamic_size; - i++, entry++) + for (ext = edyn, entry = dynamic_section; + entry < dynamic_section + dynamic_nent; + ext++, entry++) { - entry->d_tag = BYTE_GET8 (edyn[i].d_tag); - entry->d_un.d_val = BYTE_GET8 (edyn[i].d_un.d_val); + entry->d_tag = BYTE_GET (ext->d_tag); + entry->d_un.d_val = BYTE_GET (ext->d_un.d_val); } free (edyn); @@ -4460,13 +5657,11 @@ get_64bit_dynamic_segment (FILE *file) return 1; } -static const char * -get_dynamic_flags (bfd_vma flags) +static void +print_dynamic_flags (bfd_vma flags) { - static char buff[128]; - char *p = buff; + int first = 1; - *p = '\0'; while (flags) { bfd_vma flag; @@ -4474,53 +5669,53 @@ get_dynamic_flags (bfd_vma flags) flag = flags & - flags; flags &= ~ flag; - if (p != buff) - *p++ = ' '; + if (first) + first = 0; + else + putc (' ', stdout); switch (flag) { - case DF_ORIGIN: strcpy (p, "ORIGIN"); break; - case DF_SYMBOLIC: strcpy (p, "SYMBOLIC"); break; - case DF_TEXTREL: strcpy (p, "TEXTREL"); break; - case DF_BIND_NOW: strcpy (p, "BIND_NOW"); break; - case DF_STATIC_TLS: strcpy (p, "STATIC_TLS"); break; - default: strcpy (p, "unknown"); break; + case DF_ORIGIN: fputs ("ORIGIN", stdout); break; + case DF_SYMBOLIC: fputs ("SYMBOLIC", stdout); break; + case DF_TEXTREL: fputs ("TEXTREL", stdout); break; + case DF_BIND_NOW: fputs ("BIND_NOW", stdout); break; + case DF_STATIC_TLS: fputs ("STATIC_TLS", stdout); break; + default: fputs ("unknown", stdout); break; } - - p = strchr (p, '\0'); } - return buff; + puts (""); } -/* Parse and display the contents of the dynamic segment. */ +/* Parse and display the contents of the dynamic section. */ + static int -process_dynamic_segment (FILE *file) +process_dynamic_section (FILE *file) { Elf_Internal_Dyn *entry; - bfd_size_type i; if (dynamic_size == 0) { if (do_dynamic) - printf (_("\nThere is no dynamic segment in this file.\n")); + printf (_("\nThere is no dynamic section in this file.\n")); return 1; } if (is_32bit_elf) { - if (! get_32bit_dynamic_segment (file)) + if (! get_32bit_dynamic_section (file)) return 0; } - else if (! get_64bit_dynamic_segment (file)) + else if (! get_64bit_dynamic_section (file)) return 0; /* Find the appropriate symbol table. */ if (dynamic_symbols == NULL) { - for (i = 0, entry = dynamic_segment; - i < dynamic_size; - ++i, ++entry) + for (entry = dynamic_section; + entry < dynamic_section + dynamic_nent; + ++entry) { Elf_Internal_Shdr section; @@ -4564,9 +5759,9 @@ process_dynamic_segment (FILE *file) /* Similarly find a string table. */ if (dynamic_strings == NULL) { - for (i = 0, entry = dynamic_segment; - i < dynamic_size; - ++i, ++entry) + for (entry = dynamic_section; + entry < dynamic_section + dynamic_nent; + ++entry) { unsigned long offset; long str_tab_len; @@ -4599,8 +5794,9 @@ process_dynamic_segment (FILE *file) continue; } - dynamic_strings = get_data (NULL, file, offset, str_tab_len, + dynamic_strings = get_data (NULL, file, offset, 1, str_tab_len, _("dynamic string table")); + dynamic_strings_length = str_tab_len; break; } } @@ -4610,9 +5806,9 @@ process_dynamic_segment (FILE *file) { unsigned long syminsz = 0; - for (i = 0, entry = dynamic_segment; - i < dynamic_size; - ++i, ++entry) + for (entry = dynamic_section; + entry < dynamic_section + dynamic_nent; + ++entry) { if (entry->d_tag == DT_SYMINENT) { @@ -4629,12 +5825,12 @@ process_dynamic_segment (FILE *file) if (dynamic_syminfo_offset != 0 && syminsz != 0) { - Elf_External_Syminfo *extsyminfo; + Elf_External_Syminfo *extsyminfo, *extsym; Elf_Internal_Syminfo *syminfo; /* There is a syminfo section. Read the data. */ - extsyminfo = get_data (NULL, file, dynamic_syminfo_offset, syminsz, - _("symbol information")); + extsyminfo = get_data (NULL, file, dynamic_syminfo_offset, 1, + syminsz, _("symbol information")); if (!extsyminfo) return 0; @@ -4646,11 +5842,12 @@ process_dynamic_segment (FILE *file) } dynamic_syminfo_nent = syminsz / sizeof (Elf_External_Syminfo); - for (i = 0, syminfo = dynamic_syminfo; i < dynamic_syminfo_nent; - ++i, ++syminfo) + for (syminfo = dynamic_syminfo, extsym = extsyminfo; + syminfo < dynamic_syminfo + dynamic_syminfo_nent; + ++syminfo, ++extsym) { - syminfo->si_boundto = BYTE_GET (extsyminfo[i].si_boundto); - syminfo->si_flags = BYTE_GET (extsyminfo[i].si_flags); + syminfo->si_boundto = BYTE_GET (extsym->si_boundto); + syminfo->si_flags = BYTE_GET (extsym->si_flags); } free (extsyminfo); @@ -4658,14 +5855,14 @@ process_dynamic_segment (FILE *file) } if (do_dynamic && dynamic_addr) - printf (_("\nDynamic segment at offset 0x%lx contains %ld entries:\n"), - dynamic_addr, (long) dynamic_size); + printf (_("\nDynamic section at offset 0x%lx contains %u entries:\n"), + dynamic_addr, dynamic_nent); if (do_dynamic) printf (_(" Tag Type Name/Value\n")); - for (i = 0, entry = dynamic_segment; - i < dynamic_size; - i++, entry++) + for (entry = dynamic_section; + entry < dynamic_section + dynamic_nent; + entry++) { if (do_dynamic) { @@ -4684,7 +5881,7 @@ process_dynamic_segment (FILE *file) { case DT_FLAGS: if (do_dynamic) - puts (get_dynamic_flags (entry->d_un.d_val)); + print_dynamic_flags (entry->d_un.d_val); break; case DT_AUXILIARY: @@ -4717,8 +5914,8 @@ process_dynamic_segment (FILE *file) break; } - if (dynamic_strings) - printf (": [%s]\n", dynamic_strings + entry->d_un.d_val); + if (VALID_DYNAMIC_NAME (entry->d_un.d_val)) + printf (": [%s]\n", GET_DYNAMIC_NAME (entry->d_un.d_val)); else { printf (": "); @@ -4900,10 +6097,10 @@ process_dynamic_segment (FILE *file) { char *name; - if (dynamic_strings == NULL) - name = NULL; + if (VALID_DYNAMIC_NAME (entry->d_un.d_val)) + name = GET_DYNAMIC_NAME (entry->d_un.d_val); else - name = dynamic_strings + entry->d_un.d_val; + name = NULL; if (name) { @@ -4912,7 +6109,7 @@ process_dynamic_segment (FILE *file) case DT_NEEDED: printf (_("Shared library: [%s]"), name); - if (strcmp (name, program_interpreter) == 0) + if (streq (name, program_interpreter)) printf (_(" program interpreter")); break; @@ -4981,11 +6178,10 @@ process_dynamic_segment (FILE *file) case DT_FINI_ARRAY: if (do_dynamic) { - if (dynamic_strings != NULL && entry->d_tag == DT_USED) + if (entry->d_tag == DT_USED + && VALID_DYNAMIC_NAME (entry->d_un.d_val)) { - char *name; - - name = dynamic_strings + entry->d_un.d_val; + char *name = GET_DYNAMIC_NAME (entry->d_un.d_val); if (*name) { @@ -5030,13 +6226,13 @@ process_dynamic_segment (FILE *file) { case EM_MIPS: case EM_MIPS_RS3_LE: - dynamic_segment_mips_val (entry); + dynamic_section_mips_val (entry); break; case EM_PARISC: - dynamic_segment_parisc_val (entry); + dynamic_section_parisc_val (entry); break; case EM_IA_64: - dynamic_segment_ia64_val (entry); + dynamic_section_ia64_val (entry); break; default: print_vma (entry->d_un.d_val, PREFIX_HEX); @@ -5110,9 +6306,13 @@ process_version_sections (FILE *file) printf_vma (section->sh_addr); printf (_(" Offset: %#08lx Link: %lx (%s)\n"), (unsigned long) section->sh_offset, section->sh_link, - SECTION_NAME (SECTION_HEADER (section->sh_link))); + SECTION_HEADER_INDEX (section->sh_link) + < elf_header.e_shnum + ? SECTION_NAME (SECTION_HEADER (section->sh_link)) + : ""); - edefs = get_data (NULL, file, section->sh_offset, section->sh_size, + edefs = get_data (NULL, file, section->sh_offset, 1, + section->sh_size, _("version definition section")); if (!edefs) break; @@ -5152,8 +6352,8 @@ process_version_sections (FILE *file) aux.vda_name = BYTE_GET (eaux->vda_name); aux.vda_next = BYTE_GET (eaux->vda_next); - if (dynamic_strings) - printf (_("Name: %s\n"), dynamic_strings + aux.vda_name); + if (VALID_DYNAMIC_NAME (aux.vda_name)) + printf (_("Name: %s\n"), GET_DYNAMIC_NAME (aux.vda_name)); else printf (_("Name index: %ld\n"), aux.vda_name); @@ -5169,9 +6369,9 @@ process_version_sections (FILE *file) aux.vda_name = BYTE_GET (eaux->vda_name); aux.vda_next = BYTE_GET (eaux->vda_next); - if (dynamic_strings) + if (VALID_DYNAMIC_NAME (aux.vda_name)) printf (_(" %#06x: Parent %d: %s\n"), - isum, j, dynamic_strings + aux.vda_name); + isum, j, GET_DYNAMIC_NAME (aux.vda_name)); else printf (_(" %#06x: Parent %d, name index: %ld\n"), isum, j, aux.vda_name); @@ -5199,9 +6399,13 @@ process_version_sections (FILE *file) printf_vma (section->sh_addr); printf (_(" Offset: %#08lx Link to section: %ld (%s)\n"), (unsigned long) section->sh_offset, section->sh_link, - SECTION_NAME (SECTION_HEADER (section->sh_link))); + SECTION_HEADER_INDEX (section->sh_link) + < elf_header.e_shnum + ? SECTION_NAME (SECTION_HEADER (section->sh_link)) + : ""); - eneed = get_data (NULL, file, section->sh_offset, section->sh_size, + eneed = get_data (NULL, file, section->sh_offset, 1, + section->sh_size, _("version need section")); if (!eneed) break; @@ -5226,8 +6430,8 @@ process_version_sections (FILE *file) printf (_(" %#06x: Version: %d"), idx, ent.vn_version); - if (dynamic_strings) - printf (_(" File: %s"), dynamic_strings + ent.vn_file); + if (VALID_DYNAMIC_NAME (ent.vn_file)) + printf (_(" File: %s"), GET_DYNAMIC_NAME (ent.vn_file)); else printf (_(" File: %lx"), ent.vn_file); @@ -5248,9 +6452,9 @@ process_version_sections (FILE *file) aux.vna_name = BYTE_GET (eaux->vna_name); aux.vna_next = BYTE_GET (eaux->vna_next); - if (dynamic_strings) + if (VALID_DYNAMIC_NAME (aux.vna_name)) printf (_(" %#06x: Name: %s"), - isum, dynamic_strings + aux.vna_name); + isum, GET_DYNAMIC_NAME (aux.vna_name)); else printf (_(" %#06x: Name index: %lx"), isum, aux.vna_name); @@ -5281,8 +6485,15 @@ process_version_sections (FILE *file) Elf_Internal_Shdr *string_sec; long off; + if (SECTION_HEADER_INDEX (section->sh_link) >= elf_header.e_shnum) + break; + link_section = SECTION_HEADER (section->sh_link); - total = section->sh_size / section->sh_entsize; + total = section->sh_size / sizeof (Elf_External_Versym); + + if (SECTION_HEADER_INDEX (link_section->sh_link) + >= elf_header.e_shnum) + break; found = 1; @@ -5290,7 +6501,7 @@ process_version_sections (FILE *file) string_sec = SECTION_HEADER (link_section->sh_link); - strtab = get_data (NULL, file, string_sec->sh_offset, + strtab = get_data (NULL, file, string_sec->sh_offset, 1, string_sec->sh_size, _("version string table")); if (!strtab) break; @@ -5307,7 +6518,7 @@ process_version_sections (FILE *file) off = offset_from_vma (file, version_info[DT_VERSIONTAGIDX (DT_VERSYM)], total * sizeof (short)); - edata = get_data (NULL, file, off, total * sizeof (short), + edata = get_data (NULL, file, off, total, sizeof (short), _("version symbol data")); if (!edata) { @@ -5315,7 +6526,7 @@ process_version_sections (FILE *file) break; } - data = malloc (total * sizeof (short)); + data = cmalloc (total, sizeof (short)); for (cnt = total; cnt --;) data[cnt] = byte_get (edata + cnt * sizeof (short), @@ -5348,8 +6559,10 @@ process_version_sections (FILE *file) check_def = 1; check_need = 1; - if (SECTION_HEADER (symbols[cnt + j].st_shndx)->sh_type - != SHT_NOBITS) + if (SECTION_HEADER_INDEX (symbols[cnt + j].st_shndx) + >= elf_header.e_shnum + || SECTION_HEADER (symbols[cnt + j].st_shndx)->sh_type + != SHT_NOBITS) { if (symbols[cnt + j].st_shndx == SHN_UNDEF) check_def = 0; @@ -5374,7 +6587,7 @@ process_version_sections (FILE *file) Elf_External_Vernaux evna; unsigned long a_off; - get_data (&evn, file, offset, sizeof (evn), + get_data (&evn, file, offset, sizeof (evn), 1, _("version need")); ivn.vn_aux = BYTE_GET (evn.vn_aux); @@ -5385,7 +6598,7 @@ process_version_sections (FILE *file) do { get_data (&evna, file, a_off, sizeof (evna), - _("version need aux (2)")); + 1, _("version need aux (2)")); ivna.vna_next = BYTE_GET (evna.vna_next); ivna.vna_other = BYTE_GET (evna.vna_other); @@ -5426,7 +6639,7 @@ process_version_sections (FILE *file) do { - get_data (&evd, file, offset, sizeof (evd), + get_data (&evd, file, offset, sizeof (evd), 1, _("version def")); ivd.vd_next = BYTE_GET (evd.vd_next); @@ -5446,7 +6659,8 @@ process_version_sections (FILE *file) get_data (&evda, file, offset - ivd.vd_next + ivd.vd_aux, - sizeof (evda), _("version def aux")); + sizeof (evda), 1, + _("version def aux")); ivda.vda_name = BYTE_GET (evda.vda_name); @@ -5494,11 +6708,12 @@ get_symbol_binding (unsigned int binding) case STB_WEAK: return "WEAK"; default: if (binding >= STB_LOPROC && binding <= STB_HIPROC) - sprintf (buff, _(": %d"), binding); + snprintf (buff, sizeof (buff), _(": %d"), + binding); else if (binding >= STB_LOOS && binding <= STB_HIOS) - sprintf (buff, _(": %d"), binding); + snprintf (buff, sizeof (buff), _(": %d"), binding); else - sprintf (buff, _(": %d"), binding); + snprintf (buff, sizeof (buff), _(": %d"), binding); return buff; } } @@ -5529,7 +6744,7 @@ get_symbol_type (unsigned int type) if (elf_header.e_machine == EM_PARISC && type == STT_PARISC_MILLI) return "PARISC_MILLI"; - sprintf (buff, _(": %d"), type); + snprintf (buff, sizeof (buff), _(": %d"), type); } else if (type >= STT_LOOS && type <= STT_HIOS) { @@ -5541,10 +6756,10 @@ get_symbol_type (unsigned int type) return "HP_STUB"; } - sprintf (buff, _(": %d"), type); + snprintf (buff, sizeof (buff), _(": %d"), type); } else - sprintf (buff, _(": %d"), type); + snprintf (buff, sizeof (buff), _(": %d"), type); return buff; } } @@ -5562,6 +6777,41 @@ get_symbol_visibility (unsigned int visibility) } } +static const char * +get_mips_symbol_other (unsigned int other) +{ + switch (other) + { + case STO_OPTIONAL: return "OPTIONAL"; + case STO_MIPS16: return "MIPS16"; + default: return NULL; + } +} + +static const char * +get_symbol_other (unsigned int other) +{ + const char * result = NULL; + static char buff [32]; + + if (other == 0) + return ""; + + switch (elf_header.e_machine) + { + case EM_MIPS: + result = get_mips_symbol_other (other); + default: + break; + } + + if (result) + return result; + + snprintf (buff, sizeof buff, _(": %x"), other); + return buff; +} + static const char * get_symbol_index_type (unsigned int type) { @@ -5577,6 +6827,9 @@ get_symbol_index_type (unsigned int type) && elf_header.e_machine == EM_IA_64 && elf_header.e_ident[EI_OSABI] == ELFOSABI_HPUX) return "ANSI_COM"; + else if (elf_header.e_machine == EM_X86_64 + && type == SHN_X86_64_LCOMMON) + return "LARGE_COM"; else if (type >= SHN_LOPROC && type <= SHN_HIPROC) sprintf (buff, "PRC[0x%04x]", type); else if (type >= SHN_LOOS && type <= SHN_HIOS) @@ -5591,13 +6844,13 @@ get_symbol_index_type (unsigned int type) return buff; } -static int * -get_dynamic_data (FILE *file, unsigned int number) +static bfd_vma * +get_dynamic_data (FILE *file, unsigned int number, unsigned int ent_size) { unsigned char *e_data; - int *i_data; + bfd_vma *i_data; - e_data = malloc (number * 4); + e_data = cmalloc (number, ent_size); if (e_data == NULL) { @@ -5605,13 +6858,13 @@ get_dynamic_data (FILE *file, unsigned int number) return NULL; } - if (fread (e_data, 4, number, file) != number) + if (fread (e_data, ent_size, number, file) != number) { error (_("Unable to read in dynamic data\n")); return NULL; } - i_data = malloc (number * sizeof (*i_data)); + i_data = cmalloc (number, sizeof (*i_data)); if (i_data == NULL) { @@ -5621,7 +6874,7 @@ get_dynamic_data (FILE *file, unsigned int number) } while (number--) - i_data[number] = byte_get (e_data + number * 4, 4); + i_data[number] = byte_get (e_data + number * ent_size, ent_size); free (e_data); @@ -5633,12 +6886,10 @@ static int process_symbol_table (FILE *file) { Elf_Internal_Shdr *section; - unsigned char nb[4]; - unsigned char nc[4]; - int nbuckets = 0; - int nchains = 0; - int *buckets = NULL; - int *chains = NULL; + bfd_vma nbuckets = 0; + bfd_vma nchains = 0; + bfd_vma *buckets = NULL; + bfd_vma *chains = NULL; if (! do_syms && !do_histogram) return 1; @@ -5646,6 +6897,16 @@ process_symbol_table (FILE *file) if (dynamic_info[DT_HASH] && ((do_using_dynamic && dynamic_strings != NULL) || do_histogram)) { + unsigned char nb[8]; + unsigned char nc[8]; + int hash_ent_size = 4; + + if ((elf_header.e_machine == EM_ALPHA + || elf_header.e_machine == EM_S390 + || elf_header.e_machine == EM_S390_OLD) + && elf_header.e_ident[EI_CLASS] == ELFCLASS64) + hash_ent_size = 8; + if (fseek (file, (archive_file_offset + offset_from_vma (file, dynamic_info[DT_HASH], @@ -5656,23 +6917,23 @@ process_symbol_table (FILE *file) return 0; } - if (fread (nb, sizeof (nb), 1, file) != 1) + if (fread (nb, hash_ent_size, 1, file) != 1) { error (_("Failed to read in number of buckets\n")); return 0; } - if (fread (nc, sizeof (nc), 1, file) != 1) + if (fread (nc, hash_ent_size, 1, file) != 1) { error (_("Failed to read in number of chains\n")); return 0; } - nbuckets = byte_get (nb, 4); - nchains = byte_get (nc, 4); + nbuckets = byte_get (nb, hash_ent_size); + nchains = byte_get (nc, hash_ent_size); - buckets = get_dynamic_data (file, nbuckets); - chains = get_dynamic_data (file, nchains); + buckets = get_dynamic_data (file, nbuckets, hash_ent_size); + chains = get_dynamic_data (file, nchains, hash_ent_size); if (buckets == NULL || chains == NULL) return 0; @@ -5681,8 +6942,8 @@ process_symbol_table (FILE *file) if (do_syms && dynamic_info[DT_HASH] && do_using_dynamic && dynamic_strings != NULL) { - int hn; - int si; + unsigned long hn; + bfd_vma si; printf (_("\nSymbol table for image:\n")); if (is_32bit_elf) @@ -5698,19 +6959,31 @@ process_symbol_table (FILE *file) for (si = buckets[hn]; si < nchains && si > 0; si = chains[si]) { Elf_Internal_Sym *psym; + int n; psym = dynamic_symbols + si; - printf (" %3d %3d: ", si, hn); + n = print_vma (si, DEC_5); + if (n < 5) + fputs (" " + n, stdout); + printf (" %3lu: ", hn); print_vma (psym->st_value, LONG_HEX); - putchar (' ' ); + putchar (' '); print_vma (psym->st_size, DEC_5); printf (" %6s", get_symbol_type (ELF_ST_TYPE (psym->st_info))); printf (" %6s", get_symbol_binding (ELF_ST_BIND (psym->st_info))); printf (" %3s", get_symbol_visibility (ELF_ST_VISIBILITY (psym->st_other))); + /* Check to see if any other bits in the st_other field are set. + Note - displaying this information disrupts the layout of the + table being generated, but for the moment this case is very rare. */ + if (psym->st_other ^ ELF_ST_VISIBILITY (psym->st_other)) + printf (" [%s] ", get_symbol_other (psym->st_other ^ ELF_ST_VISIBILITY (psym->st_other))); printf (" %3.3s ", get_symbol_index_type (psym->st_shndx)); - print_symbol (25, dynamic_strings + psym->st_name); + if (VALID_DYNAMIC_NAME (psym->st_name)) + print_symbol (25, GET_DYNAMIC_NAME (psym->st_name)); + else + printf (" ", psym->st_name); putchar ('\n'); } } @@ -5724,7 +6997,8 @@ process_symbol_table (FILE *file) i++, section++) { unsigned int si; - char *strtab; + char *strtab = NULL; + unsigned long int strtab_size = 0; Elf_Internal_Sym *symtab; Elf_Internal_Sym *psym; @@ -5746,15 +7020,19 @@ process_symbol_table (FILE *file) continue; if (section->sh_link == elf_header.e_shstrndx) - strtab = string_table; - else + { + strtab = string_table; + strtab_size = string_table_length; + } + else if (SECTION_HEADER_INDEX (section->sh_link) < elf_header.e_shnum) { Elf_Internal_Shdr *string_sec; string_sec = SECTION_HEADER (section->sh_link); strtab = get_data (NULL, file, string_sec->sh_offset, - string_sec->sh_size, _("string table")); + 1, string_sec->sh_size, _("string table")); + strtab_size = strtab != NULL ? string_sec->sh_size : 0; } for (si = 0, psym = symtab; @@ -5768,8 +7046,14 @@ process_symbol_table (FILE *file) printf (" %-7s", get_symbol_type (ELF_ST_TYPE (psym->st_info))); printf (" %-6s", get_symbol_binding (ELF_ST_BIND (psym->st_info))); printf (" %-3s", get_symbol_visibility (ELF_ST_VISIBILITY (psym->st_other))); + /* Check to see if any other bits in the st_other field are set. + Note - displaying this information disrupts the layout of the + table being generated, but for the moment this case is very rare. */ + if (psym->st_other ^ ELF_ST_VISIBILITY (psym->st_other)) + printf (" [%s] ", get_symbol_other (psym->st_other ^ ELF_ST_VISIBILITY (psym->st_other))); printf (" %4s ", get_symbol_index_type (psym->st_shndx)); - print_symbol (25, strtab + psym->st_name); + print_symbol (25, psym->st_name < strtab_size + ? strtab + psym->st_name : ""); if (section->sh_type == SHT_DYNSYM && version_info[DT_VERSIONTAGIDX (DT_VERSYM)] != 0) @@ -5785,12 +7069,14 @@ process_symbol_table (FILE *file) sizeof data + si * sizeof (vers_data)); get_data (&data, file, offset + si * sizeof (vers_data), - sizeof (data), _("version data")); + sizeof (data), 1, _("version data")); vers_data = byte_get (data, 2); - is_nobits = (SECTION_HEADER (psym->st_shndx)->sh_type - == SHT_NOBITS); + is_nobits = (SECTION_HEADER_INDEX (psym->st_shndx) + < elf_header.e_shnum + && SECTION_HEADER (psym->st_shndx)->sh_type + == SHT_NOBITS); check_def = (psym->st_shndx != SHN_UNDEF); @@ -5812,7 +7098,7 @@ process_symbol_table (FILE *file) { unsigned long vna_off; - get_data (&evn, file, offset, sizeof (evn), + get_data (&evn, file, offset, sizeof (evn), 1, _("version need")); ivn.vn_aux = BYTE_GET (evn.vn_aux); @@ -5825,7 +7111,7 @@ process_symbol_table (FILE *file) Elf_External_Vernaux evna; get_data (&evna, file, vna_off, - sizeof (evna), + sizeof (evna), 1, _("version need aux (3)")); ivna.vna_other = BYTE_GET (evna.vna_other); @@ -5847,7 +7133,9 @@ process_symbol_table (FILE *file) if (ivna.vna_other == vers_data) { printf ("@%s (%d)", - strtab + ivna.vna_name, ivna.vna_other); + ivna.vna_name < strtab_size + ? strtab + ivna.vna_name : "", + ivna.vna_other); check_def = 0; } else if (! is_nobits) @@ -5876,7 +7164,7 @@ process_symbol_table (FILE *file) Elf_External_Verdef evd; get_data (&evd, file, offset, sizeof (evd), - _("version def")); + 1, _("version def")); ivd.vd_ndx = BYTE_GET (evd.vd_ndx); ivd.vd_aux = BYTE_GET (evd.vd_aux); @@ -5891,14 +7179,15 @@ process_symbol_table (FILE *file) offset += ivd.vd_aux; get_data (&evda, file, offset, sizeof (evda), - _("version def aux")); + 1, _("version def aux")); ivda.vda_name = BYTE_GET (evda.vda_name); if (psym->st_name != ivda.vda_name) printf ((vers_data & 0x8000) ? "@%s" : "@@%s", - strtab + ivda.vda_name); + ivda.vda_name < strtab_size + ? strtab + ivda.vda_name : ""); } } } @@ -5918,19 +7207,19 @@ process_symbol_table (FILE *file) if (do_histogram && buckets != NULL) { - int *lengths; - int *counts; - int hn; - int si; - int maxlength = 0; - int nzero_counts = 0; - int nsyms = 0; + unsigned long *lengths; + unsigned long *counts; + unsigned long hn; + bfd_vma si; + unsigned long maxlength = 0; + unsigned long nzero_counts = 0; + unsigned long nsyms = 0; - printf (_("\nHistogram for bucket list length (total of %d buckets):\n"), - nbuckets); + printf (_("\nHistogram for bucket list length (total of %lu buckets):\n"), + (unsigned long) nbuckets); printf (_(" Length Number %% of total Coverage\n")); - lengths = calloc (nbuckets, sizeof (int)); + lengths = calloc (nbuckets, sizeof (*lengths)); if (lengths == NULL) { error (_("Out of memory")); @@ -5938,9 +7227,6 @@ process_symbol_table (FILE *file) } for (hn = 0; hn < nbuckets; ++hn) { - if (! buckets[hn]) - continue; - for (si = buckets[hn]; si > 0 && si < nchains; si = chains[si]) { ++nsyms; @@ -5949,7 +7235,7 @@ process_symbol_table (FILE *file) } } - counts = calloc (maxlength + 1, sizeof (int)); + counts = calloc (maxlength + 1, sizeof (*counts)); if (counts == NULL) { error (_("Out of memory")); @@ -5961,13 +7247,14 @@ process_symbol_table (FILE *file) if (nbuckets > 0) { - printf (" 0 %-10d (%5.1f%%)\n", + unsigned long i; + printf (" 0 %-10lu (%5.1f%%)\n", counts[0], (counts[0] * 100.0) / nbuckets); - for (si = 1; si <= maxlength; ++si) + for (i = 1; i <= maxlength; ++i) { - nzero_counts += counts[si] * si; - printf ("%7d %-10d (%5.1f%%) %5.1f%%\n", - si, counts[si], (counts[si] * 100.0) / nbuckets, + nzero_counts += counts[i] * i; + printf ("%7lu %-10lu (%5.1f%%) %5.1f%%\n", + i, counts[i], (counts[i] * 100.0) / nbuckets, (nzero_counts * 100.0) / nsyms); } } @@ -6009,7 +7296,10 @@ process_syminfo (FILE *file ATTRIBUTE_UNUSED) unsigned short int flags = dynamic_syminfo[i].si_flags; printf ("%4d: ", i); - print_symbol (30, dynamic_strings + dynamic_symbols[i].st_name); + if (VALID_DYNAMIC_NAME (dynamic_symbols[i].st_name)) + print_symbol (30, GET_DYNAMIC_NAME (dynamic_symbols[i].st_name)); + else + printf ("", dynamic_symbols[i].st_name); putchar (' '); switch (dynamic_syminfo[i].si_boundto) @@ -6022,12 +7312,10 @@ process_syminfo (FILE *file ATTRIBUTE_UNUSED) break; default: if (dynamic_syminfo[i].si_boundto > 0 - && dynamic_syminfo[i].si_boundto < dynamic_size) + && dynamic_syminfo[i].si_boundto < dynamic_nent + && VALID_DYNAMIC_NAME (dynamic_section[dynamic_syminfo[i].si_boundto].d_un.d_val)) { - print_symbol (10, - dynamic_strings - + (dynamic_segment - [dynamic_syminfo[i].si_boundto].d_un.d_val)); + print_symbol (10, GET_DYNAMIC_NAME (dynamic_section[dynamic_syminfo[i].si_boundto].d_un.d_val)); putchar (' ' ); } else @@ -6051,7 +7339,7 @@ process_syminfo (FILE *file ATTRIBUTE_UNUSED) } #ifdef SUPPORT_DISASSEMBLY -static void +static int disassemble_section (Elf_Internal_Shdr *section, FILE *file) { printf (_("\nAssembly dump of section %s\n"), @@ -6084,7 +7372,8 @@ dump_section (Elf_Internal_Shdr *section, FILE *file) addr = section->sh_addr; - start = get_data (NULL, file, section->sh_offset, bytes, _("section data")); + start = get_data (NULL, file, section->sh_offset, 1, bytes, + _("section data")); if (!start) return 0; @@ -6151,3198 +7440,164 @@ dump_section (Elf_Internal_Shdr *section, FILE *file) return 1; } - -static unsigned long int -read_leb128 (unsigned char *data, int *length_return, int sign) -{ - unsigned long int result = 0; - unsigned int num_read = 0; - int shift = 0; - unsigned char byte; - - do - { - byte = *data++; - num_read++; - - result |= (byte & 0x7f) << shift; - - shift += 7; - - } - while (byte & 0x80); - - if (length_return != NULL) - *length_return = num_read; - - if (sign && (shift < 32) && (byte & 0x40)) - result |= -1 << shift; - - return result; -} - -typedef struct State_Machine_Registers -{ - unsigned long address; - unsigned int file; - unsigned int line; - unsigned int column; - int is_stmt; - int basic_block; - int end_sequence; -/* This variable hold the number of the last entry seen - in the File Table. */ - unsigned int last_file_entry; -} SMR; - -static SMR state_machine_regs; - -static void -reset_state_machine (int is_stmt) -{ - state_machine_regs.address = 0; - state_machine_regs.file = 1; - state_machine_regs.line = 1; - state_machine_regs.column = 0; - state_machine_regs.is_stmt = is_stmt; - state_machine_regs.basic_block = 0; - state_machine_regs.end_sequence = 0; - state_machine_regs.last_file_entry = 0; -} - -/* Handled an extend line op. Returns true if this is the end - of sequence. */ -static int -process_extended_line_op (unsigned char *data, int is_stmt, int pointer_size) -{ - unsigned char op_code; - int bytes_read; - unsigned int len; - unsigned char *name; - unsigned long adr; - - len = read_leb128 (data, & bytes_read, 0); - data += bytes_read; - - if (len == 0) - { - warn (_("badly formed extended line op encountered!\n")); - return bytes_read; - } - - len += bytes_read; - op_code = *data++; - - printf (_(" Extended opcode %d: "), op_code); - - switch (op_code) - { - case DW_LNE_end_sequence: - printf (_("End of Sequence\n\n")); - reset_state_machine (is_stmt); - break; - - case DW_LNE_set_address: - adr = byte_get (data, pointer_size); - printf (_("set Address to 0x%lx\n"), adr); - state_machine_regs.address = adr; - break; - - case DW_LNE_define_file: - printf (_(" define new File Table entry\n")); - printf (_(" Entry\tDir\tTime\tSize\tName\n")); - - printf (_(" %d\t"), ++state_machine_regs.last_file_entry); - name = data; - data += strlen ((char *) data) + 1; - printf (_("%lu\t"), read_leb128 (data, & bytes_read, 0)); - data += bytes_read; - printf (_("%lu\t"), read_leb128 (data, & bytes_read, 0)); - data += bytes_read; - printf (_("%lu\t"), read_leb128 (data, & bytes_read, 0)); - printf (_("%s\n\n"), name); - break; - - default: - printf (_("UNKNOWN: length %d\n"), len - bytes_read); - break; - } - - return len; -} - -/* Finds section NAME inside FILE and returns a - pointer to it, or NULL upon failure. */ - -static Elf_Internal_Shdr * -find_section (const char * name) -{ - Elf_Internal_Shdr *sec; - unsigned int i; - - for (i = elf_header.e_shnum, sec = section_headers + i - 1; - i; --i, --sec) - if (strcmp (SECTION_NAME (sec), name) == 0) - break; - - if (i && sec && sec->sh_size != 0) - return sec; - - return NULL; -} - -/* Size of pointers in the .debug_line section. This information is not - really present in that section. It's obtained before dumping the debug - sections by doing some pre-scan of the .debug_info section. */ -static unsigned int * debug_line_pointer_sizes = NULL; -static unsigned int num_debug_line_pointer_sizes = 0; - -/* Locate and scan the .debug_info section in the file and record the pointer - sizes for the compilation units in it. Usually an executable will have - just one pointer size, but this is not guaranteed, and so we try not to - make any assumptions. Returns zero upon failure, or the number of - compilation units upon success. */ - -static unsigned int -get_debug_line_pointer_sizes (FILE * file) -{ - Elf_Internal_Shdr * section; - unsigned char * start; - unsigned char * end; - unsigned char * begin; - unsigned long length; - unsigned int num_units; - unsigned int unit; - - section = find_section (".debug_info"); - if (section == NULL) - return 0; - - length = section->sh_size; - start = get_data (NULL, file, section->sh_offset, section->sh_size, - _("extracting pointer sizes from .debug_info section")); - if (start == NULL) - return 0; - - end = start + section->sh_size; - /* First scan the section to get the number of comp units. */ - for (begin = start, num_units = 0; begin < end; num_units++) - { - /* Read the first 4 bytes. For a 32-bit DWARF section, this will - be the length. For a 64-bit DWARF section, it'll be the escape - code 0xffffffff followed by an 8 byte length. */ - length = byte_get (begin, 4); - - if (length == 0xffffffff) - { - length = byte_get (begin + 4, 8); - begin += length + 12; - } - else - begin += length + 4; - } - - if (num_units == 0) - { - error (_("No comp units in .debug_info section ?")); - free (start); - return 0; - } - - /* Then allocate an array to hold the pointer sizes. */ - debug_line_pointer_sizes = malloc (num_units * sizeof * debug_line_pointer_sizes); - if (debug_line_pointer_sizes == NULL) - { - error (_("Not enough memory for a pointer size array of %u entries"), - num_units); - free (start); - return 0; - } - - /* Populate the array. */ - for (begin = start, unit = 0; begin < end; unit++) - { - length = byte_get (begin, 4); - if (length == 0xffffffff) - { - /* For 64-bit DWARF, the 1-byte address_size field is 22 bytes - from the start of the section. This is computed as follows: - - unit_length: 12 bytes - version: 2 bytes - debug_abbrev_offset: 8 bytes - ----------------------------- - Total: 22 bytes */ - - debug_line_pointer_sizes [unit] = byte_get (begin + 22, 1); - length = byte_get (begin + 4, 8); - begin += length + 12; - } - else - { - /* For 32-bit DWARF, the 1-byte address_size field is 10 bytes from - the start of the section: - - unit_length: 4 bytes - version: 2 bytes - debug_abbrev_offset: 4 bytes - ----------------------------- - Total: 10 bytes */ - - debug_line_pointer_sizes [unit] = byte_get (begin + 10, 1); - begin += length + 4; - } - } - - free (start); - num_debug_line_pointer_sizes = num_units; - return num_units; -} +/* Apply addends of RELA relocations. */ static int -display_debug_lines (Elf_Internal_Shdr *section, - unsigned char *start, FILE *file) +debug_apply_rela_addends (void *file, + Elf_Internal_Shdr *section, + unsigned char *start) { - unsigned char *hdrptr; - DWARF2_Internal_LineInfo info; - unsigned char *standard_opcodes; - unsigned char *data = start; + Elf_Internal_Shdr *relsec; unsigned char *end = start + section->sh_size; - unsigned char *end_of_sequence; - int i; - int offset_size; - int initial_length_size; - unsigned int comp_unit = 0; + /* FIXME: The relocation field size is relocation type dependent. */ + unsigned int reloc_size = 4; - printf (_("\nDump of debug contents of section %s:\n\n"), - SECTION_NAME (section)); + if (!is_relocatable) + return 1; - if (num_debug_line_pointer_sizes == 0) - get_debug_line_pointer_sizes (file); + if (section->sh_size < reloc_size) + return 1; - while (data < end) + for (relsec = section_headers; + relsec < section_headers + elf_header.e_shnum; + ++relsec) { - unsigned int pointer_size; - - hdrptr = data; - - /* Check the length of the block. */ - info.li_length = byte_get (hdrptr, 4); - hdrptr += 4; - - if (info.li_length == 0xffffffff) - { - /* This section is 64-bit DWARF 3. */ - info.li_length = byte_get (hdrptr, 8); - hdrptr += 8; - offset_size = 8; - initial_length_size = 12; - } - else - { - offset_size = 4; - initial_length_size = 4; - } - - if (info.li_length + initial_length_size > section->sh_size) - { - warn - (_("The line info appears to be corrupt - the section is too small\n")); - return 0; - } - - /* Check its version number. */ - info.li_version = byte_get (hdrptr, 2); - hdrptr += 2; - if (info.li_version != 2 && info.li_version != 3) - { - warn (_("Only DWARF version 2 and 3 line info is currently supported.\n")); - return 0; - } - - info.li_prologue_length = byte_get (hdrptr, offset_size); - hdrptr += offset_size; - info.li_min_insn_length = byte_get (hdrptr, 1); - hdrptr++; - info.li_default_is_stmt = byte_get (hdrptr, 1); - hdrptr++; - info.li_line_base = byte_get (hdrptr, 1); - hdrptr++; - info.li_line_range = byte_get (hdrptr, 1); - hdrptr++; - info.li_opcode_base = byte_get (hdrptr, 1); - hdrptr++; - - /* Sign extend the line base field. */ - info.li_line_base <<= 24; - info.li_line_base >>= 24; - - /* Get the pointer size from the comp unit associated - with this block of line number information. */ - if (comp_unit >= num_debug_line_pointer_sizes) - { - error (_("Not enough comp units for .debug_lines section\n")); - return 0; - } - else - { - pointer_size = debug_line_pointer_sizes [comp_unit]; - comp_unit ++; - } - - printf (_(" Length: %ld\n"), info.li_length); - printf (_(" DWARF Version: %d\n"), info.li_version); - printf (_(" Prologue Length: %d\n"), info.li_prologue_length); - printf (_(" Minimum Instruction Length: %d\n"), info.li_min_insn_length); - printf (_(" Initial value of 'is_stmt': %d\n"), info.li_default_is_stmt); - printf (_(" Line Base: %d\n"), info.li_line_base); - printf (_(" Line Range: %d\n"), info.li_line_range); - printf (_(" Opcode Base: %d\n"), info.li_opcode_base); - printf (_(" (Pointer size: %u)\n"), pointer_size); - - end_of_sequence = data + info.li_length + initial_length_size; - - reset_state_machine (info.li_default_is_stmt); - - /* Display the contents of the Opcodes table. */ - standard_opcodes = hdrptr; - - printf (_("\n Opcodes:\n")); - - for (i = 1; i < info.li_opcode_base; i++) - printf (_(" Opcode %d has %d args\n"), i, standard_opcodes[i - 1]); - - /* Display the contents of the Directory table. */ - data = standard_opcodes + info.li_opcode_base - 1; - - if (*data == 0) - printf (_("\n The Directory Table is empty.\n")); - else - { - printf (_("\n The Directory Table:\n")); - - while (*data != 0) - { - printf (_(" %s\n"), data); - - data += strlen ((char *) data) + 1; - } - } - - /* Skip the NUL at the end of the table. */ - data++; - - /* Display the contents of the File Name table. */ - if (*data == 0) - printf (_("\n The File Name Table is empty.\n")); - else - { - printf (_("\n The File Name Table:\n")); - printf (_(" Entry\tDir\tTime\tSize\tName\n")); - - while (*data != 0) - { - unsigned char *name; - int bytes_read; - - printf (_(" %d\t"), ++state_machine_regs.last_file_entry); - name = data; - - data += strlen ((char *) data) + 1; - - printf (_("%lu\t"), read_leb128 (data, & bytes_read, 0)); - data += bytes_read; - printf (_("%lu\t"), read_leb128 (data, & bytes_read, 0)); - data += bytes_read; - printf (_("%lu\t"), read_leb128 (data, & bytes_read, 0)); - data += bytes_read; - printf (_("%s\n"), name); - } - } - - /* Skip the NUL at the end of the table. */ - data++; - - /* Now display the statements. */ - printf (_("\n Line Number Statements:\n")); - - - while (data < end_of_sequence) - { - unsigned char op_code; - int adv; - int bytes_read; - - op_code = *data++; - - if (op_code >= info.li_opcode_base) - { - op_code -= info.li_opcode_base; - adv = (op_code / info.li_line_range) * info.li_min_insn_length; - state_machine_regs.address += adv; - printf (_(" Special opcode %d: advance Address by %d to 0x%lx"), - op_code, adv, state_machine_regs.address); - adv = (op_code % info.li_line_range) + info.li_line_base; - state_machine_regs.line += adv; - printf (_(" and Line by %d to %d\n"), - adv, state_machine_regs.line); - } - else switch (op_code) - { - case DW_LNS_extended_op: - data += process_extended_line_op (data, info.li_default_is_stmt, - pointer_size); - break; - - case DW_LNS_copy: - printf (_(" Copy\n")); - break; - - case DW_LNS_advance_pc: - adv = info.li_min_insn_length * read_leb128 (data, & bytes_read, 0); - data += bytes_read; - state_machine_regs.address += adv; - printf (_(" Advance PC by %d to %lx\n"), adv, - state_machine_regs.address); - break; - - case DW_LNS_advance_line: - adv = read_leb128 (data, & bytes_read, 1); - data += bytes_read; - state_machine_regs.line += adv; - printf (_(" Advance Line by %d to %d\n"), adv, - state_machine_regs.line); - break; - - case DW_LNS_set_file: - adv = read_leb128 (data, & bytes_read, 0); - data += bytes_read; - printf (_(" Set File Name to entry %d in the File Name Table\n"), - adv); - state_machine_regs.file = adv; - break; - - case DW_LNS_set_column: - adv = read_leb128 (data, & bytes_read, 0); - data += bytes_read; - printf (_(" Set column to %d\n"), adv); - state_machine_regs.column = adv; - break; - - case DW_LNS_negate_stmt: - adv = state_machine_regs.is_stmt; - adv = ! adv; - printf (_(" Set is_stmt to %d\n"), adv); - state_machine_regs.is_stmt = adv; - break; - - case DW_LNS_set_basic_block: - printf (_(" Set basic block\n")); - state_machine_regs.basic_block = 1; - break; - - case DW_LNS_const_add_pc: - adv = (((255 - info.li_opcode_base) / info.li_line_range) - * info.li_min_insn_length); - state_machine_regs.address += adv; - printf (_(" Advance PC by constant %d to 0x%lx\n"), adv, - state_machine_regs.address); - break; - - case DW_LNS_fixed_advance_pc: - adv = byte_get (data, 2); - data += 2; - state_machine_regs.address += adv; - printf (_(" Advance PC by fixed size amount %d to 0x%lx\n"), - adv, state_machine_regs.address); - break; - - case DW_LNS_set_prologue_end: - printf (_(" Set prologue_end to true\n")); - break; - - case DW_LNS_set_epilogue_begin: - printf (_(" Set epilogue_begin to true\n")); - break; - - case DW_LNS_set_isa: - adv = read_leb128 (data, & bytes_read, 0); - data += bytes_read; - printf (_(" Set ISA to %d\n"), adv); - break; - - default: - printf (_(" Unknown opcode %d with operands: "), op_code); - { - int i; - for (i = standard_opcodes[op_code - 1]; i > 0 ; --i) - { - printf ("0x%lx%s", read_leb128 (data, &bytes_read, 0), - i == 1 ? "" : ", "); - data += bytes_read; - } - putchar ('\n'); - } - break; - } - } - putchar ('\n'); - } - - return 1; -} - -static int -display_debug_pubnames (Elf_Internal_Shdr *section, - unsigned char *start, - FILE *file ATTRIBUTE_UNUSED) -{ - DWARF2_Internal_PubNames pubnames; - unsigned char *end; - - end = start + section->sh_size; - - printf (_("Contents of the %s section:\n\n"), SECTION_NAME (section)); - - while (start < end) - { - unsigned char *data; - unsigned long offset; - int offset_size, initial_length_size; - - data = start; - - pubnames.pn_length = byte_get (data, 4); - data += 4; - if (pubnames.pn_length == 0xffffffff) - { - pubnames.pn_length = byte_get (data, 8); - data += 8; - offset_size = 8; - initial_length_size = 12; - } - else - { - offset_size = 4; - initial_length_size = 4; - } - - pubnames.pn_version = byte_get (data, 2); - data += 2; - pubnames.pn_offset = byte_get (data, offset_size); - data += offset_size; - pubnames.pn_size = byte_get (data, offset_size); - data += offset_size; - - start += pubnames.pn_length + initial_length_size; - - if (pubnames.pn_version != 2 && pubnames.pn_version != 3) - { - static int warned = 0; - - if (! warned) - { - warn (_("Only DWARF 2 and 3 pubnames are currently supported\n")); - warned = 1; - } - - continue; - } - - printf (_(" Length: %ld\n"), - pubnames.pn_length); - printf (_(" Version: %d\n"), - pubnames.pn_version); - printf (_(" Offset into .debug_info section: %ld\n"), - pubnames.pn_offset); - printf (_(" Size of area in .debug_info section: %ld\n"), - pubnames.pn_size); - - printf (_("\n Offset\tName\n")); - - do - { - offset = byte_get (data, offset_size); - - if (offset != 0) - { - data += offset_size; - printf (" %-6ld\t\t%s\n", offset, data); - data += strlen ((char *) data) + 1; - } - } - while (offset != 0); - } - - printf ("\n"); - return 1; -} - -static char * -get_TAG_name (unsigned long tag) -{ - switch (tag) - { - case DW_TAG_padding: return "DW_TAG_padding"; - case DW_TAG_array_type: return "DW_TAG_array_type"; - case DW_TAG_class_type: return "DW_TAG_class_type"; - case DW_TAG_entry_point: return "DW_TAG_entry_point"; - case DW_TAG_enumeration_type: return "DW_TAG_enumeration_type"; - case DW_TAG_formal_parameter: return "DW_TAG_formal_parameter"; - case DW_TAG_imported_declaration: return "DW_TAG_imported_declaration"; - case DW_TAG_label: return "DW_TAG_label"; - case DW_TAG_lexical_block: return "DW_TAG_lexical_block"; - case DW_TAG_member: return "DW_TAG_member"; - case DW_TAG_pointer_type: return "DW_TAG_pointer_type"; - case DW_TAG_reference_type: return "DW_TAG_reference_type"; - case DW_TAG_compile_unit: return "DW_TAG_compile_unit"; - case DW_TAG_string_type: return "DW_TAG_string_type"; - case DW_TAG_structure_type: return "DW_TAG_structure_type"; - case DW_TAG_subroutine_type: return "DW_TAG_subroutine_type"; - case DW_TAG_typedef: return "DW_TAG_typedef"; - case DW_TAG_union_type: return "DW_TAG_union_type"; - case DW_TAG_unspecified_parameters: return "DW_TAG_unspecified_parameters"; - case DW_TAG_variant: return "DW_TAG_variant"; - case DW_TAG_common_block: return "DW_TAG_common_block"; - case DW_TAG_common_inclusion: return "DW_TAG_common_inclusion"; - case DW_TAG_inheritance: return "DW_TAG_inheritance"; - case DW_TAG_inlined_subroutine: return "DW_TAG_inlined_subroutine"; - case DW_TAG_module: return "DW_TAG_module"; - case DW_TAG_ptr_to_member_type: return "DW_TAG_ptr_to_member_type"; - case DW_TAG_set_type: return "DW_TAG_set_type"; - case DW_TAG_subrange_type: return "DW_TAG_subrange_type"; - case DW_TAG_with_stmt: return "DW_TAG_with_stmt"; - case DW_TAG_access_declaration: return "DW_TAG_access_declaration"; - case DW_TAG_base_type: return "DW_TAG_base_type"; - case DW_TAG_catch_block: return "DW_TAG_catch_block"; - case DW_TAG_const_type: return "DW_TAG_const_type"; - case DW_TAG_constant: return "DW_TAG_constant"; - case DW_TAG_enumerator: return "DW_TAG_enumerator"; - case DW_TAG_file_type: return "DW_TAG_file_type"; - case DW_TAG_friend: return "DW_TAG_friend"; - case DW_TAG_namelist: return "DW_TAG_namelist"; - case DW_TAG_namelist_item: return "DW_TAG_namelist_item"; - case DW_TAG_packed_type: return "DW_TAG_packed_type"; - case DW_TAG_subprogram: return "DW_TAG_subprogram"; - case DW_TAG_template_type_param: return "DW_TAG_template_type_param"; - case DW_TAG_template_value_param: return "DW_TAG_template_value_param"; - case DW_TAG_thrown_type: return "DW_TAG_thrown_type"; - case DW_TAG_try_block: return "DW_TAG_try_block"; - case DW_TAG_variant_part: return "DW_TAG_variant_part"; - case DW_TAG_variable: return "DW_TAG_variable"; - case DW_TAG_volatile_type: return "DW_TAG_volatile_type"; - case DW_TAG_MIPS_loop: return "DW_TAG_MIPS_loop"; - case DW_TAG_format_label: return "DW_TAG_format_label"; - case DW_TAG_function_template: return "DW_TAG_function_template"; - case DW_TAG_class_template: return "DW_TAG_class_template"; - /* DWARF 2.1 values. */ - case DW_TAG_dwarf_procedure: return "DW_TAG_dwarf_procedure"; - case DW_TAG_restrict_type: return "DW_TAG_restrict_type"; - case DW_TAG_interface_type: return "DW_TAG_interface_type"; - case DW_TAG_namespace: return "DW_TAG_namespace"; - case DW_TAG_imported_module: return "DW_TAG_imported_module"; - case DW_TAG_unspecified_type: return "DW_TAG_unspecified_type"; - case DW_TAG_partial_unit: return "DW_TAG_partial_unit"; - case DW_TAG_imported_unit: return "DW_TAG_imported_unit"; - /* UPC values. */ - case DW_TAG_upc_shared_type: return "DW_TAG_upc_shared_type"; - case DW_TAG_upc_strict_type: return "DW_TAG_upc_strict_type"; - case DW_TAG_upc_relaxed_type: return "DW_TAG_upc_relaxed_type"; - default: - { - static char buffer[100]; - - sprintf (buffer, _("Unknown TAG value: %lx"), tag); - return buffer; - } - } -} - -static char * -get_AT_name (unsigned long attribute) -{ - switch (attribute) - { - case DW_AT_sibling: return "DW_AT_sibling"; - case DW_AT_location: return "DW_AT_location"; - case DW_AT_name: return "DW_AT_name"; - case DW_AT_ordering: return "DW_AT_ordering"; - case DW_AT_subscr_data: return "DW_AT_subscr_data"; - case DW_AT_byte_size: return "DW_AT_byte_size"; - case DW_AT_bit_offset: return "DW_AT_bit_offset"; - case DW_AT_bit_size: return "DW_AT_bit_size"; - case DW_AT_element_list: return "DW_AT_element_list"; - case DW_AT_stmt_list: return "DW_AT_stmt_list"; - case DW_AT_low_pc: return "DW_AT_low_pc"; - case DW_AT_high_pc: return "DW_AT_high_pc"; - case DW_AT_language: return "DW_AT_language"; - case DW_AT_member: return "DW_AT_member"; - case DW_AT_discr: return "DW_AT_discr"; - case DW_AT_discr_value: return "DW_AT_discr_value"; - case DW_AT_visibility: return "DW_AT_visibility"; - case DW_AT_import: return "DW_AT_import"; - case DW_AT_string_length: return "DW_AT_string_length"; - case DW_AT_common_reference: return "DW_AT_common_reference"; - case DW_AT_comp_dir: return "DW_AT_comp_dir"; - case DW_AT_const_value: return "DW_AT_const_value"; - case DW_AT_containing_type: return "DW_AT_containing_type"; - case DW_AT_default_value: return "DW_AT_default_value"; - case DW_AT_inline: return "DW_AT_inline"; - case DW_AT_is_optional: return "DW_AT_is_optional"; - case DW_AT_lower_bound: return "DW_AT_lower_bound"; - case DW_AT_producer: return "DW_AT_producer"; - case DW_AT_prototyped: return "DW_AT_prototyped"; - case DW_AT_return_addr: return "DW_AT_return_addr"; - case DW_AT_start_scope: return "DW_AT_start_scope"; - case DW_AT_stride_size: return "DW_AT_stride_size"; - case DW_AT_upper_bound: return "DW_AT_upper_bound"; - case DW_AT_abstract_origin: return "DW_AT_abstract_origin"; - case DW_AT_accessibility: return "DW_AT_accessibility"; - case DW_AT_address_class: return "DW_AT_address_class"; - case DW_AT_artificial: return "DW_AT_artificial"; - case DW_AT_base_types: return "DW_AT_base_types"; - case DW_AT_calling_convention: return "DW_AT_calling_convention"; - case DW_AT_count: return "DW_AT_count"; - case DW_AT_data_member_location: return "DW_AT_data_member_location"; - case DW_AT_decl_column: return "DW_AT_decl_column"; - case DW_AT_decl_file: return "DW_AT_decl_file"; - case DW_AT_decl_line: return "DW_AT_decl_line"; - case DW_AT_declaration: return "DW_AT_declaration"; - case DW_AT_discr_list: return "DW_AT_discr_list"; - case DW_AT_encoding: return "DW_AT_encoding"; - case DW_AT_external: return "DW_AT_external"; - case DW_AT_frame_base: return "DW_AT_frame_base"; - case DW_AT_friend: return "DW_AT_friend"; - case DW_AT_identifier_case: return "DW_AT_identifier_case"; - case DW_AT_macro_info: return "DW_AT_macro_info"; - case DW_AT_namelist_items: return "DW_AT_namelist_items"; - case DW_AT_priority: return "DW_AT_priority"; - case DW_AT_segment: return "DW_AT_segment"; - case DW_AT_specification: return "DW_AT_specification"; - case DW_AT_static_link: return "DW_AT_static_link"; - case DW_AT_type: return "DW_AT_type"; - case DW_AT_use_location: return "DW_AT_use_location"; - case DW_AT_variable_parameter: return "DW_AT_variable_parameter"; - case DW_AT_virtuality: return "DW_AT_virtuality"; - case DW_AT_vtable_elem_location: return "DW_AT_vtable_elem_location"; - /* DWARF 2.1 values. */ - case DW_AT_allocated: return "DW_AT_allocated"; - case DW_AT_associated: return "DW_AT_associated"; - case DW_AT_data_location: return "DW_AT_data_location"; - case DW_AT_stride: return "DW_AT_stride"; - case DW_AT_entry_pc: return "DW_AT_entry_pc"; - case DW_AT_use_UTF8: return "DW_AT_use_UTF8"; - case DW_AT_extension: return "DW_AT_extension"; - case DW_AT_ranges: return "DW_AT_ranges"; - case DW_AT_trampoline: return "DW_AT_trampoline"; - case DW_AT_call_column: return "DW_AT_call_column"; - case DW_AT_call_file: return "DW_AT_call_file"; - case DW_AT_call_line: return "DW_AT_call_line"; - /* SGI/MIPS extensions. */ - case DW_AT_MIPS_fde: return "DW_AT_MIPS_fde"; - case DW_AT_MIPS_loop_begin: return "DW_AT_MIPS_loop_begin"; - case DW_AT_MIPS_tail_loop_begin: return "DW_AT_MIPS_tail_loop_begin"; - case DW_AT_MIPS_epilog_begin: return "DW_AT_MIPS_epilog_begin"; - case DW_AT_MIPS_loop_unroll_factor: return "DW_AT_MIPS_loop_unroll_factor"; - case DW_AT_MIPS_software_pipeline_depth: - return "DW_AT_MIPS_software_pipeline_depth"; - case DW_AT_MIPS_linkage_name: return "DW_AT_MIPS_linkage_name"; - case DW_AT_MIPS_stride: return "DW_AT_MIPS_stride"; - case DW_AT_MIPS_abstract_name: return "DW_AT_MIPS_abstract_name"; - case DW_AT_MIPS_clone_origin: return "DW_AT_MIPS_clone_origin"; - case DW_AT_MIPS_has_inlines: return "DW_AT_MIPS_has_inlines"; - /* GNU extensions. */ - case DW_AT_sf_names: return "DW_AT_sf_names"; - case DW_AT_src_info: return "DW_AT_src_info"; - case DW_AT_mac_info: return "DW_AT_mac_info"; - case DW_AT_src_coords: return "DW_AT_src_coords"; - case DW_AT_body_begin: return "DW_AT_body_begin"; - case DW_AT_body_end: return "DW_AT_body_end"; - case DW_AT_GNU_vector: return "DW_AT_GNU_vector"; - /* UPC extension. */ - case DW_AT_upc_threads_scaled: return "DW_AT_upc_threads_scaled"; - default: - { - static char buffer[100]; - - sprintf (buffer, _("Unknown AT value: %lx"), attribute); - return buffer; - } - } -} - -static char * -get_FORM_name (unsigned long form) -{ - switch (form) - { - case DW_FORM_addr: return "DW_FORM_addr"; - case DW_FORM_block2: return "DW_FORM_block2"; - case DW_FORM_block4: return "DW_FORM_block4"; - case DW_FORM_data2: return "DW_FORM_data2"; - case DW_FORM_data4: return "DW_FORM_data4"; - case DW_FORM_data8: return "DW_FORM_data8"; - case DW_FORM_string: return "DW_FORM_string"; - case DW_FORM_block: return "DW_FORM_block"; - case DW_FORM_block1: return "DW_FORM_block1"; - case DW_FORM_data1: return "DW_FORM_data1"; - case DW_FORM_flag: return "DW_FORM_flag"; - case DW_FORM_sdata: return "DW_FORM_sdata"; - case DW_FORM_strp: return "DW_FORM_strp"; - case DW_FORM_udata: return "DW_FORM_udata"; - case DW_FORM_ref_addr: return "DW_FORM_ref_addr"; - case DW_FORM_ref1: return "DW_FORM_ref1"; - case DW_FORM_ref2: return "DW_FORM_ref2"; - case DW_FORM_ref4: return "DW_FORM_ref4"; - case DW_FORM_ref8: return "DW_FORM_ref8"; - case DW_FORM_ref_udata: return "DW_FORM_ref_udata"; - case DW_FORM_indirect: return "DW_FORM_indirect"; - default: - { - static char buffer[100]; - - sprintf (buffer, _("Unknown FORM value: %lx"), form); - return buffer; - } - } -} - -/* FIXME: There are better and more efficient ways to handle - these structures. For now though, I just want something that - is simple to implement. */ -typedef struct abbrev_attr -{ - unsigned long attribute; - unsigned long form; - struct abbrev_attr *next; -} -abbrev_attr; - -typedef struct abbrev_entry -{ - unsigned long entry; - unsigned long tag; - int children; - struct abbrev_attr *first_attr; - struct abbrev_attr *last_attr; - struct abbrev_entry *next; -} -abbrev_entry; - -static abbrev_entry *first_abbrev = NULL; -static abbrev_entry *last_abbrev = NULL; - -static void -free_abbrevs (void) -{ - abbrev_entry *abbrev; - - for (abbrev = first_abbrev; abbrev;) - { - abbrev_entry *next = abbrev->next; - abbrev_attr *attr; - - for (attr = abbrev->first_attr; attr;) - { - abbrev_attr *next = attr->next; - - free (attr); - attr = next; - } - - free (abbrev); - abbrev = next; - } - - last_abbrev = first_abbrev = NULL; -} - -static void -add_abbrev (unsigned long number, unsigned long tag, int children) -{ - abbrev_entry *entry; - - entry = malloc (sizeof (*entry)); - - if (entry == NULL) - /* ugg */ - return; - - entry->entry = number; - entry->tag = tag; - entry->children = children; - entry->first_attr = NULL; - entry->last_attr = NULL; - entry->next = NULL; - - if (first_abbrev == NULL) - first_abbrev = entry; - else - last_abbrev->next = entry; - - last_abbrev = entry; -} - -static void -add_abbrev_attr (unsigned long attribute, unsigned long form) -{ - abbrev_attr *attr; - - attr = malloc (sizeof (*attr)); - - if (attr == NULL) - /* ugg */ - return; - - attr->attribute = attribute; - attr->form = form; - attr->next = NULL; - - if (last_abbrev->first_attr == NULL) - last_abbrev->first_attr = attr; - else - last_abbrev->last_attr->next = attr; - - last_abbrev->last_attr = attr; -} - -/* Processes the (partial) contents of a .debug_abbrev section. - Returns NULL if the end of the section was encountered. - Returns the address after the last byte read if the end of - an abbreviation set was found. */ - -static unsigned char * -process_abbrev_section (unsigned char *start, unsigned char *end) -{ - if (first_abbrev != NULL) - return NULL; - - while (start < end) - { - int bytes_read; - unsigned long entry; - unsigned long tag; - unsigned long attribute; - int children; - - entry = read_leb128 (start, & bytes_read, 0); - start += bytes_read; - - /* A single zero is supposed to end the section according - to the standard. If there's more, then signal that to - the caller. */ - if (entry == 0) - return start == end ? NULL : start; - - tag = read_leb128 (start, & bytes_read, 0); - start += bytes_read; - - children = *start++; - - add_abbrev (entry, tag, children); - - do - { - unsigned long form; - - attribute = read_leb128 (start, & bytes_read, 0); - start += bytes_read; - - form = read_leb128 (start, & bytes_read, 0); - start += bytes_read; - - if (attribute != 0) - add_abbrev_attr (attribute, form); - } - while (attribute != 0); - } - - return NULL; -} - - -static int -display_debug_macinfo (Elf_Internal_Shdr *section, - unsigned char *start, - FILE *file ATTRIBUTE_UNUSED) -{ - unsigned char *end = start + section->sh_size; - unsigned char *curr = start; - unsigned int bytes_read; - enum dwarf_macinfo_record_type op; - - printf (_("Contents of the %s section:\n\n"), SECTION_NAME (section)); - - while (curr < end) - { - unsigned int lineno; - const char *string; - - op = *curr; - curr++; - - switch (op) - { - case DW_MACINFO_start_file: - { - unsigned int filenum; - - lineno = read_leb128 (curr, & bytes_read, 0); - curr += bytes_read; - filenum = read_leb128 (curr, & bytes_read, 0); - curr += bytes_read; - - printf (_(" DW_MACINFO_start_file - lineno: %d filenum: %d\n"), lineno, filenum); - } - break; - - case DW_MACINFO_end_file: - printf (_(" DW_MACINFO_end_file\n")); - break; - - case DW_MACINFO_define: - lineno = read_leb128 (curr, & bytes_read, 0); - curr += bytes_read; - string = curr; - curr += strlen (string) + 1; - printf (_(" DW_MACINFO_define - lineno : %d macro : %s\n"), lineno, string); - break; - - case DW_MACINFO_undef: - lineno = read_leb128 (curr, & bytes_read, 0); - curr += bytes_read; - string = curr; - curr += strlen (string) + 1; - printf (_(" DW_MACINFO_undef - lineno : %d macro : %s\n"), lineno, string); - break; - - case DW_MACINFO_vendor_ext: - { - unsigned int constant; - - constant = read_leb128 (curr, & bytes_read, 0); - curr += bytes_read; - string = curr; - curr += strlen (string) + 1; - printf (_(" DW_MACINFO_vendor_ext - constant : %d string : %s\n"), constant, string); - } - break; - } - } - - return 1; -} - - -static int -display_debug_abbrev (Elf_Internal_Shdr *section, - unsigned char *start, - FILE *file ATTRIBUTE_UNUSED) -{ - abbrev_entry *entry; - unsigned char *end = start + section->sh_size; - - printf (_("Contents of the %s section:\n\n"), SECTION_NAME (section)); - - do - { - start = process_abbrev_section (start, end); - - if (first_abbrev == NULL) + unsigned long nrelas; + Elf_Internal_Rela *rela, *rp; + Elf_Internal_Shdr *symsec; + Elf_Internal_Sym *symtab; + Elf_Internal_Sym *sym; + + if (relsec->sh_type != SHT_RELA + || SECTION_HEADER_INDEX (relsec->sh_info) >= elf_header.e_shnum + || SECTION_HEADER (relsec->sh_info) != section + || relsec->sh_size == 0 + || SECTION_HEADER_INDEX (relsec->sh_link) >= elf_header.e_shnum) continue; - printf (_(" Number TAG\n")); + if (!slurp_rela_relocs (file, relsec->sh_offset, relsec->sh_size, + &rela, &nrelas)) + return 0; - for (entry = first_abbrev; entry; entry = entry->next) + symsec = SECTION_HEADER (relsec->sh_link); + symtab = GET_ELF_SYMBOLS (file, symsec); + + for (rp = rela; rp < rela + nrelas; ++rp) { - abbrev_attr *attr; + unsigned char *loc; - printf (_(" %ld %s [%s]\n"), - entry->entry, - get_TAG_name (entry->tag), - entry->children ? _("has children") : _("no children")); - - for (attr = entry->first_attr; attr; attr = attr->next) + loc = start + rp->r_offset; + if ((loc + reloc_size) > end) { - printf (_(" %-18s %s\n"), - get_AT_name (attr->attribute), - get_FORM_name (attr->form)); - } - } - - free_abbrevs (); - } - while (start); - - printf ("\n"); - - return 1; -} - - -static unsigned char * -display_block (unsigned char *data, unsigned long length) -{ - printf (_(" %lu byte block: "), length); - - while (length --) - printf ("%lx ", (unsigned long) byte_get (data++, 1)); - - return data; -} - -static void -decode_location_expression (unsigned char * data, - unsigned int pointer_size, - unsigned long length) -{ - unsigned op; - int bytes_read; - unsigned long uvalue; - unsigned char *end = data + length; - - while (data < end) - { - op = *data++; - - switch (op) - { - case DW_OP_addr: - printf ("DW_OP_addr: %lx", - (unsigned long) byte_get (data, pointer_size)); - data += pointer_size; - break; - case DW_OP_deref: - printf ("DW_OP_deref"); - break; - case DW_OP_const1u: - printf ("DW_OP_const1u: %lu", (unsigned long) byte_get (data++, 1)); - break; - case DW_OP_const1s: - printf ("DW_OP_const1s: %ld", (long) byte_get (data++, 1)); - break; - case DW_OP_const2u: - printf ("DW_OP_const2u: %lu", (unsigned long) byte_get (data, 2)); - data += 2; - break; - case DW_OP_const2s: - printf ("DW_OP_const2s: %ld", (long) byte_get (data, 2)); - data += 2; - break; - case DW_OP_const4u: - printf ("DW_OP_const4u: %lu", (unsigned long) byte_get (data, 4)); - data += 4; - break; - case DW_OP_const4s: - printf ("DW_OP_const4s: %ld", (long) byte_get (data, 4)); - data += 4; - break; - case DW_OP_const8u: - printf ("DW_OP_const8u: %lu %lu", (unsigned long) byte_get (data, 4), - (unsigned long) byte_get (data + 4, 4)); - data += 8; - break; - case DW_OP_const8s: - printf ("DW_OP_const8s: %ld %ld", (long) byte_get (data, 4), - (long) byte_get (data + 4, 4)); - data += 8; - break; - case DW_OP_constu: - printf ("DW_OP_constu: %lu", read_leb128 (data, &bytes_read, 0)); - data += bytes_read; - break; - case DW_OP_consts: - printf ("DW_OP_consts: %ld", read_leb128 (data, &bytes_read, 1)); - data += bytes_read; - break; - case DW_OP_dup: - printf ("DW_OP_dup"); - break; - case DW_OP_drop: - printf ("DW_OP_drop"); - break; - case DW_OP_over: - printf ("DW_OP_over"); - break; - case DW_OP_pick: - printf ("DW_OP_pick: %ld", (unsigned long) byte_get (data++, 1)); - break; - case DW_OP_swap: - printf ("DW_OP_swap"); - break; - case DW_OP_rot: - printf ("DW_OP_rot"); - break; - case DW_OP_xderef: - printf ("DW_OP_xderef"); - break; - case DW_OP_abs: - printf ("DW_OP_abs"); - break; - case DW_OP_and: - printf ("DW_OP_and"); - break; - case DW_OP_div: - printf ("DW_OP_div"); - break; - case DW_OP_minus: - printf ("DW_OP_minus"); - break; - case DW_OP_mod: - printf ("DW_OP_mod"); - break; - case DW_OP_mul: - printf ("DW_OP_mul"); - break; - case DW_OP_neg: - printf ("DW_OP_neg"); - break; - case DW_OP_not: - printf ("DW_OP_not"); - break; - case DW_OP_or: - printf ("DW_OP_or"); - break; - case DW_OP_plus: - printf ("DW_OP_plus"); - break; - case DW_OP_plus_uconst: - printf ("DW_OP_plus_uconst: %lu", - read_leb128 (data, &bytes_read, 0)); - data += bytes_read; - break; - case DW_OP_shl: - printf ("DW_OP_shl"); - break; - case DW_OP_shr: - printf ("DW_OP_shr"); - break; - case DW_OP_shra: - printf ("DW_OP_shra"); - break; - case DW_OP_xor: - printf ("DW_OP_xor"); - break; - case DW_OP_bra: - printf ("DW_OP_bra: %ld", (long) byte_get (data, 2)); - data += 2; - break; - case DW_OP_eq: - printf ("DW_OP_eq"); - break; - case DW_OP_ge: - printf ("DW_OP_ge"); - break; - case DW_OP_gt: - printf ("DW_OP_gt"); - break; - case DW_OP_le: - printf ("DW_OP_le"); - break; - case DW_OP_lt: - printf ("DW_OP_lt"); - break; - case DW_OP_ne: - printf ("DW_OP_ne"); - break; - case DW_OP_skip: - printf ("DW_OP_skip: %ld", (long) byte_get (data, 2)); - data += 2; - break; - - case DW_OP_lit0: - case DW_OP_lit1: - case DW_OP_lit2: - case DW_OP_lit3: - case DW_OP_lit4: - case DW_OP_lit5: - case DW_OP_lit6: - case DW_OP_lit7: - case DW_OP_lit8: - case DW_OP_lit9: - case DW_OP_lit10: - case DW_OP_lit11: - case DW_OP_lit12: - case DW_OP_lit13: - case DW_OP_lit14: - case DW_OP_lit15: - case DW_OP_lit16: - case DW_OP_lit17: - case DW_OP_lit18: - case DW_OP_lit19: - case DW_OP_lit20: - case DW_OP_lit21: - case DW_OP_lit22: - case DW_OP_lit23: - case DW_OP_lit24: - case DW_OP_lit25: - case DW_OP_lit26: - case DW_OP_lit27: - case DW_OP_lit28: - case DW_OP_lit29: - case DW_OP_lit30: - case DW_OP_lit31: - printf ("DW_OP_lit%d", op - DW_OP_lit0); - break; - - case DW_OP_reg0: - case DW_OP_reg1: - case DW_OP_reg2: - case DW_OP_reg3: - case DW_OP_reg4: - case DW_OP_reg5: - case DW_OP_reg6: - case DW_OP_reg7: - case DW_OP_reg8: - case DW_OP_reg9: - case DW_OP_reg10: - case DW_OP_reg11: - case DW_OP_reg12: - case DW_OP_reg13: - case DW_OP_reg14: - case DW_OP_reg15: - case DW_OP_reg16: - case DW_OP_reg17: - case DW_OP_reg18: - case DW_OP_reg19: - case DW_OP_reg20: - case DW_OP_reg21: - case DW_OP_reg22: - case DW_OP_reg23: - case DW_OP_reg24: - case DW_OP_reg25: - case DW_OP_reg26: - case DW_OP_reg27: - case DW_OP_reg28: - case DW_OP_reg29: - case DW_OP_reg30: - case DW_OP_reg31: - printf ("DW_OP_reg%d", op - DW_OP_reg0); - break; - - case DW_OP_breg0: - case DW_OP_breg1: - case DW_OP_breg2: - case DW_OP_breg3: - case DW_OP_breg4: - case DW_OP_breg5: - case DW_OP_breg6: - case DW_OP_breg7: - case DW_OP_breg8: - case DW_OP_breg9: - case DW_OP_breg10: - case DW_OP_breg11: - case DW_OP_breg12: - case DW_OP_breg13: - case DW_OP_breg14: - case DW_OP_breg15: - case DW_OP_breg16: - case DW_OP_breg17: - case DW_OP_breg18: - case DW_OP_breg19: - case DW_OP_breg20: - case DW_OP_breg21: - case DW_OP_breg22: - case DW_OP_breg23: - case DW_OP_breg24: - case DW_OP_breg25: - case DW_OP_breg26: - case DW_OP_breg27: - case DW_OP_breg28: - case DW_OP_breg29: - case DW_OP_breg30: - case DW_OP_breg31: - printf ("DW_OP_breg%d: %ld", op - DW_OP_breg0, - read_leb128 (data, &bytes_read, 1)); - data += bytes_read; - break; - - case DW_OP_regx: - printf ("DW_OP_regx: %lu", read_leb128 (data, &bytes_read, 0)); - data += bytes_read; - break; - case DW_OP_fbreg: - printf ("DW_OP_fbreg: %ld", read_leb128 (data, &bytes_read, 1)); - data += bytes_read; - break; - case DW_OP_bregx: - uvalue = read_leb128 (data, &bytes_read, 0); - data += bytes_read; - printf ("DW_OP_bregx: %lu %ld", uvalue, - read_leb128 (data, &bytes_read, 1)); - data += bytes_read; - break; - case DW_OP_piece: - printf ("DW_OP_piece: %lu", read_leb128 (data, &bytes_read, 0)); - data += bytes_read; - break; - case DW_OP_deref_size: - printf ("DW_OP_deref_size: %ld", (long) byte_get (data++, 1)); - break; - case DW_OP_xderef_size: - printf ("DW_OP_xderef_size: %ld", (long) byte_get (data++, 1)); - break; - case DW_OP_nop: - printf ("DW_OP_nop"); - break; - - /* DWARF 3 extensions. */ - case DW_OP_push_object_address: - printf ("DW_OP_push_object_address"); - break; - case DW_OP_call2: - printf ("DW_OP_call2: <%lx>", (long) byte_get (data, 2)); - data += 2; - break; - case DW_OP_call4: - printf ("DW_OP_call4: <%lx>", (long) byte_get (data, 4)); - data += 4; - break; - case DW_OP_call_ref: - printf ("DW_OP_call_ref"); - break; - - /* GNU extensions. */ - case DW_OP_GNU_push_tls_address: - printf ("DW_OP_GNU_push_tls_address"); - break; - - default: - if (op >= DW_OP_lo_user - && op <= DW_OP_hi_user) - printf (_("(User defined location op)")); - else - printf (_("(Unknown location op)")); - /* No way to tell where the next op is, so just bail. */ - return; - } - - /* Separate the ops. */ - if (data < end) - printf ("; "); - } -} - -static const char *debug_loc_contents; -static bfd_vma debug_loc_size; - -static void -load_debug_loc (FILE *file) -{ - Elf_Internal_Shdr *sec; - - /* If it is already loaded, do nothing. */ - if (debug_loc_contents != NULL) - return; - - /* Locate the .debug_loc section. */ - sec = find_section (".debug_loc"); - if (sec == NULL) - return; - - debug_loc_size = sec->sh_size; - - debug_loc_contents = get_data (NULL, file, sec->sh_offset, sec->sh_size, - _("debug_loc section data")); -} - -static void -free_debug_loc (void) -{ - if (debug_loc_contents == NULL) - return; - - free ((char *) debug_loc_contents); - debug_loc_contents = NULL; - debug_loc_size = 0; -} - - -static int -display_debug_loc (Elf_Internal_Shdr *section, - unsigned char *start, FILE *file) -{ - unsigned char *section_end; - unsigned long bytes; - unsigned char *section_begin = start; - bfd_vma addr; - unsigned int comp_unit = 0; - - addr = section->sh_addr; - bytes = section->sh_size; - section_end = start + bytes; - - if (bytes == 0) - { - printf (_("\nThe .debug_loc section is empty.\n")); - return 0; - } - - if (num_debug_line_pointer_sizes == 0) - get_debug_line_pointer_sizes (file); - - printf (_("Contents of the .debug_loc section:\n\n")); - printf (_("\n Offset Begin End Expression\n")); - - while (start < section_end) - { - unsigned long begin; - unsigned long end; - unsigned short length; - unsigned long offset; - unsigned int pointer_size; - - offset = start - section_begin; - - /* Get the pointer size from the comp unit associated - with this block of location information. */ - if (comp_unit >= num_debug_line_pointer_sizes) - { - error (_("Not enough comp units for .debug_loc section\n")); - return 0; - } - else - { - pointer_size = debug_line_pointer_sizes [comp_unit]; - comp_unit ++; - } - - while (1) - { - begin = byte_get (start, pointer_size); - start += pointer_size; - end = byte_get (start, pointer_size); - start += pointer_size; - - if (begin == 0 && end == 0) - break; - - /* For now, skip any base address specifiers. */ - if (begin == 0xffffffff) - continue; - - begin += addr; - end += addr; - - length = byte_get (start, 2); - start += 2; - - printf (" %8.8lx %8.8lx %8.8lx (", offset, begin, end); - decode_location_expression (start, pointer_size, length); - printf (")\n"); - - start += length; - } - printf ("\n"); - } - return 1; -} - -static const char *debug_str_contents; -static bfd_vma debug_str_size; - -static void -load_debug_str (FILE *file) -{ - Elf_Internal_Shdr *sec; - - /* If it is already loaded, do nothing. */ - if (debug_str_contents != NULL) - return; - - /* Locate the .debug_str section. */ - sec = find_section (".debug_str"); - if (sec == NULL) - return; - - debug_str_size = sec->sh_size; - - debug_str_contents = get_data (NULL, file, sec->sh_offset, sec->sh_size, - _("debug_str section data")); -} - -static void -free_debug_str (void) -{ - if (debug_str_contents == NULL) - return; - - free ((char *) debug_str_contents); - debug_str_contents = NULL; - debug_str_size = 0; -} - -static const char * -fetch_indirect_string (unsigned long offset) -{ - if (debug_str_contents == NULL) - return _(""); - - if (offset > debug_str_size) - return _(""); - - return debug_str_contents + offset; -} - -static int -display_debug_str (Elf_Internal_Shdr *section, - unsigned char *start, - FILE *file ATTRIBUTE_UNUSED) -{ - unsigned long bytes; - bfd_vma addr; - - addr = section->sh_addr; - bytes = section->sh_size; - - if (bytes == 0) - { - printf (_("\nThe .debug_str section is empty.\n")); - return 0; - } - - printf (_("Contents of the .debug_str section:\n\n")); - - while (bytes) - { - int j; - int k; - int lbytes; - - lbytes = (bytes > 16 ? 16 : bytes); - - printf (" 0x%8.8lx ", (unsigned long) addr); - - for (j = 0; j < 16; j++) - { - if (j < lbytes) - printf ("%2.2x", start[j]); - else - printf (" "); - - if ((j & 3) == 3) - printf (" "); - } - - for (j = 0; j < lbytes; j++) - { - k = start[j]; - if (k >= ' ' && k < 0x80) - printf ("%c", k); - else - printf ("."); - } - - putchar ('\n'); - - start += lbytes; - addr += lbytes; - bytes -= lbytes; - } - - return 1; -} - -static unsigned char * -read_and_display_attr_value (unsigned long attribute, - unsigned long form, - unsigned char *data, - unsigned long cu_offset, - unsigned long pointer_size, - unsigned long offset_size, - int dwarf_version) -{ - unsigned long uvalue = 0; - unsigned char *block_start = NULL; - int bytes_read; - - switch (form) - { - default: - break; - - case DW_FORM_ref_addr: - if (dwarf_version == 2) - { - uvalue = byte_get (data, pointer_size); - data += pointer_size; - } - else if (dwarf_version == 3) - { - uvalue = byte_get (data, offset_size); - data += offset_size; - } - else - { - error (_("Internal error: DWARF version is not 2 or 3.\n")); - } - break; - - case DW_FORM_addr: - uvalue = byte_get (data, pointer_size); - data += pointer_size; - break; - - case DW_FORM_strp: - uvalue = byte_get (data, offset_size); - data += offset_size; - break; - - case DW_FORM_ref1: - case DW_FORM_flag: - case DW_FORM_data1: - uvalue = byte_get (data++, 1); - break; - - case DW_FORM_ref2: - case DW_FORM_data2: - uvalue = byte_get (data, 2); - data += 2; - break; - - case DW_FORM_ref4: - case DW_FORM_data4: - uvalue = byte_get (data, 4); - data += 4; - break; - - case DW_FORM_sdata: - uvalue = read_leb128 (data, & bytes_read, 1); - data += bytes_read; - break; - - case DW_FORM_ref_udata: - case DW_FORM_udata: - uvalue = read_leb128 (data, & bytes_read, 0); - data += bytes_read; - break; - - case DW_FORM_indirect: - form = read_leb128 (data, & bytes_read, 0); - data += bytes_read; - printf (" %s", get_FORM_name (form)); - return read_and_display_attr_value (attribute, form, data, cu_offset, - pointer_size, offset_size, - dwarf_version); - } - - switch (form) - { - case DW_FORM_ref_addr: - printf (" <#%lx>", uvalue); - break; - - case DW_FORM_ref1: - case DW_FORM_ref2: - case DW_FORM_ref4: - case DW_FORM_ref_udata: - printf (" <%lx>", uvalue + cu_offset); - break; - - case DW_FORM_addr: - printf (" %#lx", uvalue); - break; - - case DW_FORM_flag: - case DW_FORM_data1: - case DW_FORM_data2: - case DW_FORM_data4: - case DW_FORM_sdata: - case DW_FORM_udata: - printf (" %ld", uvalue); - break; - - case DW_FORM_ref8: - case DW_FORM_data8: - uvalue = byte_get (data, 4); - printf (" %lx", uvalue); - printf (" %lx", (unsigned long) byte_get (data + 4, 4)); - data += 8; - break; - - case DW_FORM_string: - printf (" %s", data); - data += strlen ((char *) data) + 1; - break; - - case DW_FORM_block: - uvalue = read_leb128 (data, & bytes_read, 0); - block_start = data + bytes_read; - data = display_block (block_start, uvalue); - break; - - case DW_FORM_block1: - uvalue = byte_get (data, 1); - block_start = data + 1; - data = display_block (block_start, uvalue); - break; - - case DW_FORM_block2: - uvalue = byte_get (data, 2); - block_start = data + 2; - data = display_block (block_start, uvalue); - break; - - case DW_FORM_block4: - uvalue = byte_get (data, 4); - block_start = data + 4; - data = display_block (block_start, uvalue); - break; - - case DW_FORM_strp: - printf (_(" (indirect string, offset: 0x%lx): %s"), - uvalue, fetch_indirect_string (uvalue)); - break; - - case DW_FORM_indirect: - /* Handled above. */ - break; - - default: - warn (_("Unrecognized form: %d\n"), form); - break; - } - - /* For some attributes we can display further information. */ - - printf ("\t"); - - switch (attribute) - { - case DW_AT_inline: - switch (uvalue) - { - case DW_INL_not_inlined: - printf (_("(not inlined)")); - break; - case DW_INL_inlined: - printf (_("(inlined)")); - break; - case DW_INL_declared_not_inlined: - printf (_("(declared as inline but ignored)")); - break; - case DW_INL_declared_inlined: - printf (_("(declared as inline and inlined)")); - break; - default: - printf (_(" (Unknown inline attribute value: %lx)"), uvalue); - break; - } - break; - - case DW_AT_language: - switch (uvalue) - { - case DW_LANG_C: printf ("(non-ANSI C)"); break; - case DW_LANG_C89: printf ("(ANSI C)"); break; - case DW_LANG_C_plus_plus: printf ("(C++)"); break; - case DW_LANG_Fortran77: printf ("(FORTRAN 77)"); break; - case DW_LANG_Fortran90: printf ("(Fortran 90)"); break; - case DW_LANG_Modula2: printf ("(Modula 2)"); break; - case DW_LANG_Pascal83: printf ("(ANSI Pascal)"); break; - case DW_LANG_Ada83: printf ("(Ada)"); break; - case DW_LANG_Cobol74: printf ("(Cobol 74)"); break; - case DW_LANG_Cobol85: printf ("(Cobol 85)"); break; - /* DWARF 2.1 values. */ - case DW_LANG_C99: printf ("(ANSI C99)"); break; - case DW_LANG_Ada95: printf ("(ADA 95)"); break; - case DW_LANG_Fortran95: printf ("(Fortran 95)"); break; - /* MIPS extension. */ - case DW_LANG_Mips_Assembler: printf ("(MIPS assembler)"); break; - /* UPC extension. */ - case DW_LANG_Upc: printf ("(Unified Parallel C)"); break; - default: - printf ("(Unknown: %lx)", uvalue); - break; - } - break; - - case DW_AT_encoding: - switch (uvalue) - { - case DW_ATE_void: printf ("(void)"); break; - case DW_ATE_address: printf ("(machine address)"); break; - case DW_ATE_boolean: printf ("(boolean)"); break; - case DW_ATE_complex_float: printf ("(complex float)"); break; - case DW_ATE_float: printf ("(float)"); break; - case DW_ATE_signed: printf ("(signed)"); break; - case DW_ATE_signed_char: printf ("(signed char)"); break; - case DW_ATE_unsigned: printf ("(unsigned)"); break; - case DW_ATE_unsigned_char: printf ("(unsigned char)"); break; - /* DWARF 2.1 value. */ - case DW_ATE_imaginary_float: printf ("(imaginary float)"); break; - default: - if (uvalue >= DW_ATE_lo_user - && uvalue <= DW_ATE_hi_user) - printf ("(user defined type)"); - else - printf ("(unknown type)"); - break; - } - break; - - case DW_AT_accessibility: - switch (uvalue) - { - case DW_ACCESS_public: printf ("(public)"); break; - case DW_ACCESS_protected: printf ("(protected)"); break; - case DW_ACCESS_private: printf ("(private)"); break; - default: - printf ("(unknown accessibility)"); - break; - } - break; - - case DW_AT_visibility: - switch (uvalue) - { - case DW_VIS_local: printf ("(local)"); break; - case DW_VIS_exported: printf ("(exported)"); break; - case DW_VIS_qualified: printf ("(qualified)"); break; - default: printf ("(unknown visibility)"); break; - } - break; - - case DW_AT_virtuality: - switch (uvalue) - { - case DW_VIRTUALITY_none: printf ("(none)"); break; - case DW_VIRTUALITY_virtual: printf ("(virtual)"); break; - case DW_VIRTUALITY_pure_virtual:printf ("(pure_virtual)"); break; - default: printf ("(unknown virtuality)"); break; - } - break; - - case DW_AT_identifier_case: - switch (uvalue) - { - case DW_ID_case_sensitive: printf ("(case_sensitive)"); break; - case DW_ID_up_case: printf ("(up_case)"); break; - case DW_ID_down_case: printf ("(down_case)"); break; - case DW_ID_case_insensitive: printf ("(case_insensitive)"); break; - default: printf ("(unknown case)"); break; - } - break; - - case DW_AT_calling_convention: - switch (uvalue) - { - case DW_CC_normal: printf ("(normal)"); break; - case DW_CC_program: printf ("(program)"); break; - case DW_CC_nocall: printf ("(nocall)"); break; - default: - if (uvalue >= DW_CC_lo_user - && uvalue <= DW_CC_hi_user) - printf ("(user defined)"); - else - printf ("(unknown convention)"); - } - break; - - case DW_AT_ordering: - switch (uvalue) - { - case -1: printf ("(undefined)"); break; - case 0: printf ("(row major)"); break; - case 1: printf ("(column major)"); break; - } - break; - - case DW_AT_frame_base: - case DW_AT_location: - case DW_AT_data_member_location: - case DW_AT_vtable_elem_location: - case DW_AT_allocated: - case DW_AT_associated: - case DW_AT_data_location: - case DW_AT_stride: - case DW_AT_upper_bound: - case DW_AT_lower_bound: - if (block_start) - { - printf ("("); - decode_location_expression (block_start, pointer_size, uvalue); - printf (")"); - } - else if (form == DW_FORM_data4 || form == DW_FORM_data8) - { - printf ("("); - printf ("location list"); - printf (")"); - } - break; - - default: - break; - } - - return data; -} - -static unsigned char * -read_and_display_attr (unsigned long attribute, - unsigned long form, - unsigned char *data, - unsigned long cu_offset, - unsigned long pointer_size, - unsigned long offset_size, - int dwarf_version) -{ - printf (" %-18s:", get_AT_name (attribute)); - data = read_and_display_attr_value (attribute, form, data, cu_offset, - pointer_size, offset_size, dwarf_version); - printf ("\n"); - return data; -} - -static int -display_debug_info (Elf_Internal_Shdr *section, - unsigned char *start, - FILE *file) -{ - unsigned char *end = start + section->sh_size; - unsigned char *section_begin = start; - - printf (_("The section %s contains:\n\n"), SECTION_NAME (section)); - - load_debug_str (file); - load_debug_loc (file); - - while (start < end) - { - DWARF2_Internal_CompUnit compunit; - Elf_Internal_Shdr *relsec; - unsigned char *hdrptr; - unsigned char *cu_abbrev_offset_ptr; - unsigned char *tags; - int level; - unsigned long cu_offset; - int offset_size; - int initial_length_size; - - hdrptr = start; - - compunit.cu_length = byte_get (hdrptr, 4); - hdrptr += 4; - - if (compunit.cu_length == 0xffffffff) - { - compunit.cu_length = byte_get (hdrptr, 8); - hdrptr += 8; - offset_size = 8; - initial_length_size = 12; - } - else - { - offset_size = 4; - initial_length_size = 4; - } - - compunit.cu_version = byte_get (hdrptr, 2); - hdrptr += 2; - - /* Apply addends of RELA relocations. */ - for (relsec = section_headers; - relsec < section_headers + elf_header.e_shnum; - ++relsec) - { - unsigned long nrelas; - Elf_Internal_Rela *rela, *rp; - Elf_Internal_Shdr *symsec; - Elf_Internal_Sym *symtab; - Elf_Internal_Sym *sym; - - if (relsec->sh_type != SHT_RELA - || SECTION_HEADER (relsec->sh_info) != section - || relsec->sh_size == 0) - continue; - - if (!slurp_rela_relocs (file, relsec->sh_offset, relsec->sh_size, - & rela, & nrelas)) - return 0; - - symsec = SECTION_HEADER (relsec->sh_link); - symtab = GET_ELF_SYMBOLS (file, symsec); - - for (rp = rela; rp < rela + nrelas; ++rp) - { - unsigned char *loc; - - if (rp->r_offset >= (bfd_vma) (hdrptr - section_begin) - && section->sh_size > (bfd_vma) offset_size - && rp->r_offset <= section->sh_size - offset_size) - loc = section_begin + rp->r_offset; - else - continue; - - if (is_32bit_elf) - { - sym = symtab + ELF32_R_SYM (rp->r_info); - - if (ELF32_R_SYM (rp->r_info) != 0 - && ELF32_ST_TYPE (sym->st_info) != STT_SECTION) - { - warn (_("Skipping unexpected symbol type %u\n"), - ELF32_ST_TYPE (sym->st_info)); - continue; - } - } - else - { - sym = symtab + ELF64_R_SYM (rp->r_info); - - if (ELF64_R_SYM (rp->r_info) != 0 - && ELF64_ST_TYPE (sym->st_info) != STT_SECTION) - { - warn (_("Skipping unexpected symbol type %u\n"), - ELF64_ST_TYPE (sym->st_info)); - continue; - } - } - - byte_put (loc, rp->r_addend, offset_size); - } - - free (rela); - break; - } - - cu_abbrev_offset_ptr = hdrptr; - compunit.cu_abbrev_offset = byte_get (hdrptr, offset_size); - hdrptr += offset_size; - - compunit.cu_pointer_size = byte_get (hdrptr, 1); - hdrptr += 1; - - tags = hdrptr; - cu_offset = start - section_begin; - start += compunit.cu_length + initial_length_size; - - printf (_(" Compilation Unit @ %lx:\n"), cu_offset); - printf (_(" Length: %ld\n"), compunit.cu_length); - printf (_(" Version: %d\n"), compunit.cu_version); - printf (_(" Abbrev Offset: %ld\n"), compunit.cu_abbrev_offset); - printf (_(" Pointer Size: %d\n"), compunit.cu_pointer_size); - - if (compunit.cu_version != 2 && compunit.cu_version != 3) - { - warn (_("Only version 2 and 3 DWARF debug information is currently supported.\n")); - continue; - } - - free_abbrevs (); - - /* Read in the abbrevs used by this compilation unit. */ - { - Elf_Internal_Shdr *sec; - unsigned char *begin; - - /* Locate the .debug_abbrev section and process it. */ - sec = find_section (".debug_abbrev"); - if (sec == NULL) - { - warn (_("Unable to locate .debug_abbrev section!\n")); - return 0; - } - - begin = get_data (NULL, file, sec->sh_offset, sec->sh_size, - _("debug_abbrev section data")); - if (!begin) - return 0; - - process_abbrev_section (begin + compunit.cu_abbrev_offset, - begin + sec->sh_size); - - free (begin); - } - - level = 0; - while (tags < start) - { - int bytes_read; - unsigned long abbrev_number; - abbrev_entry *entry; - abbrev_attr *attr; - - abbrev_number = read_leb128 (tags, & bytes_read, 0); - tags += bytes_read; - - /* A null DIE marks the end of a list of children. */ - if (abbrev_number == 0) - { - --level; + warn (_("skipping invalid relocation offset 0x%lx in section %s\n"), + (unsigned long) rp->r_offset, + SECTION_NAME (section)); continue; } - /* Scan through the abbreviation list until we reach the - correct entry. */ - for (entry = first_abbrev; - entry && entry->entry != abbrev_number; - entry = entry->next) - continue; - - if (entry == NULL) + if (is_32bit_elf) { - warn (_("Unable to locate entry %lu in the abbreviation table\n"), - abbrev_number); - return 0; + sym = symtab + ELF32_R_SYM (rp->r_info); + + if (ELF32_R_SYM (rp->r_info) != 0 + && ELF32_ST_TYPE (sym->st_info) != STT_SECTION + /* Relocations against object symbols can happen, + eg when referencing a global array. For an + example of this see the _clz.o binary in libgcc.a. */ + && ELF32_ST_TYPE (sym->st_info) != STT_OBJECT) + { + warn (_("skipping unexpected symbol type %s in relocation in section .rela%s\n"), + get_symbol_type (ELF32_ST_TYPE (sym->st_info)), + SECTION_NAME (section)); + continue; + } + } + else + { + /* In MIPS little-endian objects, r_info isn't really a + 64-bit little-endian value: it has a 32-bit little-endian + symbol index followed by four individual byte fields. + Reorder INFO accordingly. */ + if (elf_header.e_machine == EM_MIPS + && elf_header.e_ident[EI_DATA] != ELFDATA2MSB) + rp->r_info = (((rp->r_info & 0xffffffff) << 32) + | ((rp->r_info >> 56) & 0xff) + | ((rp->r_info >> 40) & 0xff00) + | ((rp->r_info >> 24) & 0xff0000) + | ((rp->r_info >> 8) & 0xff000000)); + + sym = symtab + ELF64_R_SYM (rp->r_info); + + if (ELF64_R_SYM (rp->r_info) != 0 + && ELF64_ST_TYPE (sym->st_info) != STT_SECTION + && ELF64_ST_TYPE (sym->st_info) != STT_OBJECT) + { + warn (_("skipping unexpected symbol type %s in relocation in section .rela.%s\n"), + get_symbol_type (ELF64_ST_TYPE (sym->st_info)), + SECTION_NAME (section)); + continue; + } } - printf (_(" <%d><%lx>: Abbrev Number: %lu (%s)\n"), - level, - (unsigned long) (tags - section_begin - bytes_read), - abbrev_number, - get_TAG_name (entry->tag)); - - for (attr = entry->first_attr; attr; attr = attr->next) - tags = read_and_display_attr (attr->attribute, - attr->form, - tags, cu_offset, - compunit.cu_pointer_size, - offset_size, - compunit.cu_version); - - if (entry->children) - ++level; + byte_put (loc, rp->r_addend, reloc_size); } + + free (symtab); + free (rela); + break; } - - free_debug_str (); - free_debug_loc (); - - printf ("\n"); - return 1; } -static int -display_debug_aranges (Elf_Internal_Shdr *section, - unsigned char *start, - FILE *file ATTRIBUTE_UNUSED) +int +load_debug_section (enum dwarf_section_display_enum debug, void *file) { - unsigned char *end = start + section->sh_size; + struct dwarf_section *section = &debug_displays [debug].section; + Elf_Internal_Shdr *sec; + char buf [64]; - printf (_("The section %s contains:\n\n"), SECTION_NAME (section)); + /* If it is already loaded, do nothing. */ + if (section->start != NULL) + return 1; - while (start < end) - { - unsigned char *hdrptr; - DWARF2_Internal_ARange arange; - unsigned char *ranges; - unsigned long length; - unsigned long address; - int excess; - int offset_size; - int initial_length_size; + /* Locate the debug section. */ + sec = find_section (section->name); + if (sec == NULL) + return 0; - hdrptr = start; + snprintf (buf, sizeof (buf), _("%s section data"), section->name); + section->address = sec->sh_addr; + section->size = sec->sh_size; + section->start = get_data (NULL, file, sec->sh_offset, 1, + sec->sh_size, buf); - arange.ar_length = byte_get (hdrptr, 4); - hdrptr += 4; + if (debug_displays [debug].relocate) + debug_apply_rela_addends (file, sec, section->start); - if (arange.ar_length == 0xffffffff) - { - arange.ar_length = byte_get (hdrptr, 8); - hdrptr += 8; - offset_size = 8; - initial_length_size = 12; - } - else - { - offset_size = 4; - initial_length_size = 4; - } - - arange.ar_version = byte_get (hdrptr, 2); - hdrptr += 2; - - arange.ar_info_offset = byte_get (hdrptr, offset_size); - hdrptr += offset_size; - - arange.ar_pointer_size = byte_get (hdrptr, 1); - hdrptr += 1; - - arange.ar_segment_size = byte_get (hdrptr, 1); - hdrptr += 1; - - if (arange.ar_version != 2 && arange.ar_version != 3) - { - warn (_("Only DWARF 2 and 3 aranges are currently supported.\n")); - break; - } - - printf (_(" Length: %ld\n"), arange.ar_length); - printf (_(" Version: %d\n"), arange.ar_version); - printf (_(" Offset into .debug_info: %lx\n"), arange.ar_info_offset); - printf (_(" Pointer Size: %d\n"), arange.ar_pointer_size); - printf (_(" Segment Size: %d\n"), arange.ar_segment_size); - - printf (_("\n Address Length\n")); - - ranges = hdrptr; - - /* Must pad to an alignment boundary that is twice the pointer size. */ - excess = (hdrptr - start) % (2 * arange.ar_pointer_size); - if (excess) - ranges += (2 * arange.ar_pointer_size) - excess; - - for (;;) - { - address = byte_get (ranges, arange.ar_pointer_size); - - ranges += arange.ar_pointer_size; - - length = byte_get (ranges, arange.ar_pointer_size); - - ranges += arange.ar_pointer_size; - - /* A pair of zeros marks the end of the list. */ - if (address == 0 && length == 0) - break; - - printf (" %8.8lx %lu\n", address, length); - } - - start += arange.ar_length + initial_length_size; - } - - printf ("\n"); - - return 1; + return section->start != NULL; } -typedef struct Frame_Chunk +void +free_debug_section (enum dwarf_section_display_enum debug) { - struct Frame_Chunk *next; - unsigned char *chunk_start; - int ncols; - /* DW_CFA_{undefined,same_value,offset,register,unreferenced} */ - short int *col_type; - int *col_offset; - char *augmentation; - unsigned int code_factor; - int data_factor; - unsigned long pc_begin; - unsigned long pc_range; - int cfa_reg; - int cfa_offset; - int ra; - unsigned char fde_encoding; - unsigned char cfa_exp; -} -Frame_Chunk; + struct dwarf_section *section = &debug_displays [debug].section; -/* A marker for a col_type that means this column was never referenced - in the frame info. */ -#define DW_CFA_unreferenced (-1) - -static void -frame_need_space (Frame_Chunk *fc, int reg) -{ - int prev = fc->ncols; - - if (reg < fc->ncols) + if (section->start == NULL) return; - fc->ncols = reg + 1; - fc->col_type = xrealloc (fc->col_type, fc->ncols * sizeof (short int)); - fc->col_offset = xrealloc (fc->col_offset, fc->ncols * sizeof (int)); - - while (prev < fc->ncols) - { - fc->col_type[prev] = DW_CFA_unreferenced; - fc->col_offset[prev] = 0; - prev++; - } + free ((char *) section->start); + section->start = NULL; + section->address = 0; + section->size = 0; } -static void -frame_display_row (Frame_Chunk *fc, int *need_col_headers, int *max_regs) -{ - int r; - char tmp[100]; - - if (*max_regs < fc->ncols) - *max_regs = fc->ncols; - - if (*need_col_headers) - { - *need_col_headers = 0; - - printf (" LOC CFA "); - - for (r = 0; r < *max_regs; r++) - if (fc->col_type[r] != DW_CFA_unreferenced) - { - if (r == fc->ra) - printf ("ra "); - else - printf ("r%-4d", r); - } - - printf ("\n"); - } - - printf ("%08lx ", fc->pc_begin); - if (fc->cfa_exp) - strcpy (tmp, "exp"); - else - sprintf (tmp, "r%d%+d", fc->cfa_reg, fc->cfa_offset); - printf ("%-8s ", tmp); - - for (r = 0; r < fc->ncols; r++) - { - if (fc->col_type[r] != DW_CFA_unreferenced) - { - switch (fc->col_type[r]) - { - case DW_CFA_undefined: - strcpy (tmp, "u"); - break; - case DW_CFA_same_value: - strcpy (tmp, "s"); - break; - case DW_CFA_offset: - sprintf (tmp, "c%+d", fc->col_offset[r]); - break; - case DW_CFA_register: - sprintf (tmp, "r%d", fc->col_offset[r]); - break; - case DW_CFA_expression: - strcpy (tmp, "exp"); - break; - default: - strcpy (tmp, "n/a"); - break; - } - printf ("%-5s", tmp); - } - } - printf ("\n"); -} - -static int -size_of_encoded_value (int encoding) -{ - switch (encoding & 0x7) - { - default: /* ??? */ - case 0: return is_32bit_elf ? 4 : 8; - case 2: return 2; - case 3: return 4; - case 4: return 8; - } -} - -static bfd_vma -get_encoded_value (unsigned char *data, int encoding) -{ - int size = size_of_encoded_value (encoding); - if (encoding & DW_EH_PE_signed) - return byte_get_signed (data, size); - else - return byte_get (data, size); -} - -#define GET(N) byte_get (start, N); start += N -#define LEB() read_leb128 (start, & length_return, 0); start += length_return -#define SLEB() read_leb128 (start, & length_return, 1); start += length_return - -static int -display_debug_frames (Elf_Internal_Shdr *section, - unsigned char *start, - FILE *file ATTRIBUTE_UNUSED) -{ - unsigned char *end = start + section->sh_size; - unsigned char *section_start = start; - Frame_Chunk *chunks = 0; - Frame_Chunk *remembered_state = 0; - Frame_Chunk *rs; - int is_eh = (strcmp (SECTION_NAME (section), ".eh_frame") == 0); - int length_return; - int max_regs = 0; - int addr_size = is_32bit_elf ? 4 : 8; - - printf (_("The section %s contains:\n"), SECTION_NAME (section)); - - while (start < end) - { - unsigned char *saved_start; - unsigned char *block_end; - unsigned long length; - unsigned long cie_id; - Frame_Chunk *fc; - Frame_Chunk *cie; - int need_col_headers = 1; - unsigned char *augmentation_data = NULL; - unsigned long augmentation_data_len = 0; - int encoded_ptr_size = addr_size; - int offset_size; - int initial_length_size; - - saved_start = start; - length = byte_get (start, 4); start += 4; - - if (length == 0) - { - printf ("\n%08lx ZERO terminator\n\n", - (unsigned long)(saved_start - section_start)); - return 1; - } - - if (length == 0xffffffff) - { - length = byte_get (start, 8); - start += 8; - offset_size = 8; - initial_length_size = 12; - } - else - { - offset_size = 4; - initial_length_size = 4; - } - - block_end = saved_start + length + initial_length_size; - cie_id = byte_get (start, offset_size); start += offset_size; - - if (is_eh ? (cie_id == 0) : (cie_id == DW_CIE_ID)) - { - int version; - - fc = xmalloc (sizeof (Frame_Chunk)); - memset (fc, 0, sizeof (Frame_Chunk)); - - fc->next = chunks; - chunks = fc; - fc->chunk_start = saved_start; - fc->ncols = 0; - fc->col_type = xmalloc (sizeof (short int)); - fc->col_offset = xmalloc (sizeof (int)); - frame_need_space (fc, max_regs-1); - - version = *start++; - - fc->augmentation = start; - start = strchr (start, '\0') + 1; - - if (fc->augmentation[0] == 'z') - { - fc->code_factor = LEB (); - fc->data_factor = SLEB (); - fc->ra = byte_get (start, 1); start += 1; - augmentation_data_len = LEB (); - augmentation_data = start; - start += augmentation_data_len; - } - else if (strcmp (fc->augmentation, "eh") == 0) - { - start += addr_size; - fc->code_factor = LEB (); - fc->data_factor = SLEB (); - fc->ra = byte_get (start, 1); start += 1; - } - else - { - fc->code_factor = LEB (); - fc->data_factor = SLEB (); - fc->ra = byte_get (start, 1); start += 1; - } - cie = fc; - - if (do_debug_frames_interp) - printf ("\n%08lx %08lx %08lx CIE \"%s\" cf=%d df=%d ra=%d\n", - (unsigned long)(saved_start - section_start), length, cie_id, - fc->augmentation, fc->code_factor, fc->data_factor, - fc->ra); - else - { - printf ("\n%08lx %08lx %08lx CIE\n", - (unsigned long)(saved_start - section_start), length, cie_id); - printf (" Version: %d\n", version); - printf (" Augmentation: \"%s\"\n", fc->augmentation); - printf (" Code alignment factor: %u\n", fc->code_factor); - printf (" Data alignment factor: %d\n", fc->data_factor); - printf (" Return address column: %d\n", fc->ra); - - if (augmentation_data_len) - { - unsigned long i; - printf (" Augmentation data: "); - for (i = 0; i < augmentation_data_len; ++i) - printf (" %02x", augmentation_data[i]); - putchar ('\n'); - } - putchar ('\n'); - } - - if (augmentation_data_len) - { - unsigned char *p, *q; - p = fc->augmentation + 1; - q = augmentation_data; - - while (1) - { - if (*p == 'L') - q++; - else if (*p == 'P') - q += 1 + size_of_encoded_value (*q); - else if (*p == 'R') - fc->fde_encoding = *q++; - else - break; - p++; - } - - if (fc->fde_encoding) - encoded_ptr_size = size_of_encoded_value (fc->fde_encoding); - } - - frame_need_space (fc, fc->ra); - } - else - { - unsigned char *look_for; - static Frame_Chunk fde_fc; - - fc = & fde_fc; - memset (fc, 0, sizeof (Frame_Chunk)); - - look_for = is_eh ? start - 4 - cie_id : section_start + cie_id; - - for (cie = chunks; cie ; cie = cie->next) - if (cie->chunk_start == look_for) - break; - - if (!cie) - { - warn ("Invalid CIE pointer %08lx in FDE at %08lx\n", - cie_id, saved_start); - start = block_end; - fc->ncols = 0; - fc->col_type = xmalloc (sizeof (short int)); - fc->col_offset = xmalloc (sizeof (int)); - frame_need_space (fc, max_regs - 1); - cie = fc; - fc->augmentation = ""; - fc->fde_encoding = 0; - } - else - { - fc->ncols = cie->ncols; - fc->col_type = xmalloc (fc->ncols * sizeof (short int)); - fc->col_offset = xmalloc (fc->ncols * sizeof (int)); - memcpy (fc->col_type, cie->col_type, fc->ncols * sizeof (short int)); - memcpy (fc->col_offset, cie->col_offset, fc->ncols * sizeof (int)); - fc->augmentation = cie->augmentation; - fc->code_factor = cie->code_factor; - fc->data_factor = cie->data_factor; - fc->cfa_reg = cie->cfa_reg; - fc->cfa_offset = cie->cfa_offset; - fc->ra = cie->ra; - frame_need_space (fc, max_regs-1); - fc->fde_encoding = cie->fde_encoding; - } - - if (fc->fde_encoding) - encoded_ptr_size = size_of_encoded_value (fc->fde_encoding); - - fc->pc_begin = get_encoded_value (start, fc->fde_encoding); - if ((fc->fde_encoding & 0x70) == DW_EH_PE_pcrel) - fc->pc_begin += section->sh_addr + (start - section_start); - start += encoded_ptr_size; - fc->pc_range = byte_get (start, encoded_ptr_size); - start += encoded_ptr_size; - - if (cie->augmentation[0] == 'z') - { - augmentation_data_len = LEB (); - augmentation_data = start; - start += augmentation_data_len; - } - - printf ("\n%08lx %08lx %08lx FDE cie=%08lx pc=%08lx..%08lx\n", - (unsigned long)(saved_start - section_start), length, cie_id, - (unsigned long)(cie->chunk_start - section_start), - fc->pc_begin, fc->pc_begin + fc->pc_range); - if (! do_debug_frames_interp && augmentation_data_len) - { - unsigned long i; - printf (" Augmentation data: "); - for (i = 0; i < augmentation_data_len; ++i) - printf (" %02x", augmentation_data[i]); - putchar ('\n'); - putchar ('\n'); - } - } - - /* At this point, fc is the current chunk, cie (if any) is set, and we're - about to interpret instructions for the chunk. */ - /* ??? At present we need to do this always, since this sizes the - fc->col_type and fc->col_offset arrays, which we write into always. - We should probably split the interpreted and non-interpreted bits - into two different routines, since there's so much that doesn't - really overlap between them. */ - if (1 || do_debug_frames_interp) - { - /* Start by making a pass over the chunk, allocating storage - and taking note of what registers are used. */ - unsigned char *tmp = start; - - while (start < block_end) - { - unsigned op, opa; - unsigned long reg, tmp; - - op = *start++; - opa = op & 0x3f; - if (op & 0xc0) - op &= 0xc0; - - /* Warning: if you add any more cases to this switch, be - sure to add them to the corresponding switch below. */ - switch (op) - { - case DW_CFA_advance_loc: - break; - case DW_CFA_offset: - LEB (); - frame_need_space (fc, opa); - fc->col_type[opa] = DW_CFA_undefined; - break; - case DW_CFA_restore: - frame_need_space (fc, opa); - fc->col_type[opa] = DW_CFA_undefined; - break; - case DW_CFA_set_loc: - start += encoded_ptr_size; - break; - case DW_CFA_advance_loc1: - start += 1; - break; - case DW_CFA_advance_loc2: - start += 2; - break; - case DW_CFA_advance_loc4: - start += 4; - break; - case DW_CFA_offset_extended: - reg = LEB (); LEB (); - frame_need_space (fc, reg); - fc->col_type[reg] = DW_CFA_undefined; - break; - case DW_CFA_restore_extended: - reg = LEB (); - frame_need_space (fc, reg); - fc->col_type[reg] = DW_CFA_undefined; - break; - case DW_CFA_undefined: - reg = LEB (); - frame_need_space (fc, reg); - fc->col_type[reg] = DW_CFA_undefined; - break; - case DW_CFA_same_value: - reg = LEB (); - frame_need_space (fc, reg); - fc->col_type[reg] = DW_CFA_undefined; - break; - case DW_CFA_register: - reg = LEB (); LEB (); - frame_need_space (fc, reg); - fc->col_type[reg] = DW_CFA_undefined; - break; - case DW_CFA_def_cfa: - LEB (); LEB (); - break; - case DW_CFA_def_cfa_register: - LEB (); - break; - case DW_CFA_def_cfa_offset: - LEB (); - break; - case DW_CFA_def_cfa_expression: - tmp = LEB (); - start += tmp; - break; - case DW_CFA_expression: - reg = LEB (); - tmp = LEB (); - start += tmp; - frame_need_space (fc, reg); - fc->col_type[reg] = DW_CFA_undefined; - break; - case DW_CFA_offset_extended_sf: - reg = LEB (); SLEB (); - frame_need_space (fc, reg); - fc->col_type[reg] = DW_CFA_undefined; - break; - case DW_CFA_def_cfa_sf: - LEB (); SLEB (); - break; - case DW_CFA_def_cfa_offset_sf: - SLEB (); - break; - case DW_CFA_MIPS_advance_loc8: - start += 8; - break; - case DW_CFA_GNU_args_size: - LEB (); - break; - case DW_CFA_GNU_negative_offset_extended: - reg = LEB (); LEB (); - frame_need_space (fc, reg); - fc->col_type[reg] = DW_CFA_undefined; - - default: - break; - } - } - start = tmp; - } - - /* Now we know what registers are used, make a second pass over - the chunk, this time actually printing out the info. */ - - while (start < block_end) - { - unsigned op, opa; - unsigned long ul, reg, roffs; - long l, ofs; - bfd_vma vma; - - op = *start++; - opa = op & 0x3f; - if (op & 0xc0) - op &= 0xc0; - - /* Warning: if you add any more cases to this switch, be - sure to add them to the corresponding switch above. */ - switch (op) - { - case DW_CFA_advance_loc: - if (do_debug_frames_interp) - frame_display_row (fc, &need_col_headers, &max_regs); - else - printf (" DW_CFA_advance_loc: %d to %08lx\n", - opa * fc->code_factor, - fc->pc_begin + opa * fc->code_factor); - fc->pc_begin += opa * fc->code_factor; - break; - - case DW_CFA_offset: - roffs = LEB (); - if (! do_debug_frames_interp) - printf (" DW_CFA_offset: r%d at cfa%+ld\n", - opa, roffs * fc->data_factor); - fc->col_type[opa] = DW_CFA_offset; - fc->col_offset[opa] = roffs * fc->data_factor; - break; - - case DW_CFA_restore: - if (! do_debug_frames_interp) - printf (" DW_CFA_restore: r%d\n", opa); - fc->col_type[opa] = cie->col_type[opa]; - fc->col_offset[opa] = cie->col_offset[opa]; - break; - - case DW_CFA_set_loc: - vma = get_encoded_value (start, fc->fde_encoding); - if ((fc->fde_encoding & 0x70) == DW_EH_PE_pcrel) - vma += section->sh_addr + (start - section_start); - start += encoded_ptr_size; - if (do_debug_frames_interp) - frame_display_row (fc, &need_col_headers, &max_regs); - else - printf (" DW_CFA_set_loc: %08lx\n", (unsigned long)vma); - fc->pc_begin = vma; - break; - - case DW_CFA_advance_loc1: - ofs = byte_get (start, 1); start += 1; - if (do_debug_frames_interp) - frame_display_row (fc, &need_col_headers, &max_regs); - else - printf (" DW_CFA_advance_loc1: %ld to %08lx\n", - ofs * fc->code_factor, - fc->pc_begin + ofs * fc->code_factor); - fc->pc_begin += ofs * fc->code_factor; - break; - - case DW_CFA_advance_loc2: - ofs = byte_get (start, 2); start += 2; - if (do_debug_frames_interp) - frame_display_row (fc, &need_col_headers, &max_regs); - else - printf (" DW_CFA_advance_loc2: %ld to %08lx\n", - ofs * fc->code_factor, - fc->pc_begin + ofs * fc->code_factor); - fc->pc_begin += ofs * fc->code_factor; - break; - - case DW_CFA_advance_loc4: - ofs = byte_get (start, 4); start += 4; - if (do_debug_frames_interp) - frame_display_row (fc, &need_col_headers, &max_regs); - else - printf (" DW_CFA_advance_loc4: %ld to %08lx\n", - ofs * fc->code_factor, - fc->pc_begin + ofs * fc->code_factor); - fc->pc_begin += ofs * fc->code_factor; - break; - - case DW_CFA_offset_extended: - reg = LEB (); - roffs = LEB (); - if (! do_debug_frames_interp) - printf (" DW_CFA_offset_extended: r%ld at cfa%+ld\n", - reg, roffs * fc->data_factor); - fc->col_type[reg] = DW_CFA_offset; - fc->col_offset[reg] = roffs * fc->data_factor; - break; - - case DW_CFA_restore_extended: - reg = LEB (); - if (! do_debug_frames_interp) - printf (" DW_CFA_restore_extended: r%ld\n", reg); - fc->col_type[reg] = cie->col_type[reg]; - fc->col_offset[reg] = cie->col_offset[reg]; - break; - - case DW_CFA_undefined: - reg = LEB (); - if (! do_debug_frames_interp) - printf (" DW_CFA_undefined: r%ld\n", reg); - fc->col_type[reg] = DW_CFA_undefined; - fc->col_offset[reg] = 0; - break; - - case DW_CFA_same_value: - reg = LEB (); - if (! do_debug_frames_interp) - printf (" DW_CFA_same_value: r%ld\n", reg); - fc->col_type[reg] = DW_CFA_same_value; - fc->col_offset[reg] = 0; - break; - - case DW_CFA_register: - reg = LEB (); - roffs = LEB (); - if (! do_debug_frames_interp) - printf (" DW_CFA_register: r%ld in r%ld\n", reg, roffs); - fc->col_type[reg] = DW_CFA_register; - fc->col_offset[reg] = roffs; - break; - - case DW_CFA_remember_state: - if (! do_debug_frames_interp) - printf (" DW_CFA_remember_state\n"); - rs = xmalloc (sizeof (Frame_Chunk)); - rs->ncols = fc->ncols; - rs->col_type = xmalloc (rs->ncols * sizeof (short int)); - rs->col_offset = xmalloc (rs->ncols * sizeof (int)); - memcpy (rs->col_type, fc->col_type, rs->ncols); - memcpy (rs->col_offset, fc->col_offset, rs->ncols * sizeof (int)); - rs->next = remembered_state; - remembered_state = rs; - break; - - case DW_CFA_restore_state: - if (! do_debug_frames_interp) - printf (" DW_CFA_restore_state\n"); - rs = remembered_state; - if (rs) - { - remembered_state = rs->next; - frame_need_space (fc, rs->ncols-1); - memcpy (fc->col_type, rs->col_type, rs->ncols); - memcpy (fc->col_offset, rs->col_offset, - rs->ncols * sizeof (int)); - free (rs->col_type); - free (rs->col_offset); - free (rs); - } - else if (do_debug_frames_interp) - printf ("Mismatched DW_CFA_restore_state\n"); - break; - - case DW_CFA_def_cfa: - fc->cfa_reg = LEB (); - fc->cfa_offset = LEB (); - fc->cfa_exp = 0; - if (! do_debug_frames_interp) - printf (" DW_CFA_def_cfa: r%d ofs %d\n", - fc->cfa_reg, fc->cfa_offset); - break; - - case DW_CFA_def_cfa_register: - fc->cfa_reg = LEB (); - fc->cfa_exp = 0; - if (! do_debug_frames_interp) - printf (" DW_CFA_def_cfa_reg: r%d\n", fc->cfa_reg); - break; - - case DW_CFA_def_cfa_offset: - fc->cfa_offset = LEB (); - if (! do_debug_frames_interp) - printf (" DW_CFA_def_cfa_offset: %d\n", fc->cfa_offset); - break; - - case DW_CFA_nop: - if (! do_debug_frames_interp) - printf (" DW_CFA_nop\n"); - break; - - case DW_CFA_def_cfa_expression: - ul = LEB (); - if (! do_debug_frames_interp) - { - printf (" DW_CFA_def_cfa_expression ("); - decode_location_expression (start, addr_size, ul); - printf (")\n"); - } - fc->cfa_exp = 1; - start += ul; - break; - - case DW_CFA_expression: - reg = LEB (); - ul = LEB (); - if (! do_debug_frames_interp) - { - printf (" DW_CFA_expression: r%ld (", reg); - decode_location_expression (start, addr_size, ul); - printf (")\n"); - } - fc->col_type[reg] = DW_CFA_expression; - start += ul; - break; - - case DW_CFA_offset_extended_sf: - reg = LEB (); - l = SLEB (); - frame_need_space (fc, reg); - if (! do_debug_frames_interp) - printf (" DW_CFA_offset_extended_sf: r%ld at cfa%+ld\n", - reg, l * fc->data_factor); - fc->col_type[reg] = DW_CFA_offset; - fc->col_offset[reg] = l * fc->data_factor; - break; - - case DW_CFA_def_cfa_sf: - fc->cfa_reg = LEB (); - fc->cfa_offset = SLEB (); - fc->cfa_exp = 0; - if (! do_debug_frames_interp) - printf (" DW_CFA_def_cfa_sf: r%d ofs %d\n", - fc->cfa_reg, fc->cfa_offset); - break; - - case DW_CFA_def_cfa_offset_sf: - fc->cfa_offset = SLEB (); - if (! do_debug_frames_interp) - printf (" DW_CFA_def_cfa_offset_sf: %d\n", fc->cfa_offset); - break; - - case DW_CFA_MIPS_advance_loc8: - ofs = byte_get (start, 8); start += 8; - if (do_debug_frames_interp) - frame_display_row (fc, &need_col_headers, &max_regs); - else - printf (" DW_CFA_MIPS_advance_loc8: %ld to %08lx\n", - ofs * fc->code_factor, - fc->pc_begin + ofs * fc->code_factor); - fc->pc_begin += ofs * fc->code_factor; - break; - - case DW_CFA_GNU_window_save: - if (! do_debug_frames_interp) - printf (" DW_CFA_GNU_window_save\n"); - break; - - case DW_CFA_GNU_args_size: - ul = LEB (); - if (! do_debug_frames_interp) - printf (" DW_CFA_GNU_args_size: %ld\n", ul); - break; - - case DW_CFA_GNU_negative_offset_extended: - reg = LEB (); - l = - LEB (); - frame_need_space (fc, reg); - if (! do_debug_frames_interp) - printf (" DW_CFA_GNU_negative_offset_extended: r%ld at cfa%+ld\n", - reg, l * fc->data_factor); - fc->col_type[reg] = DW_CFA_offset; - fc->col_offset[reg] = l * fc->data_factor; - break; - - default: - fprintf (stderr, "unsupported or unknown DW_CFA_%d\n", op); - start = block_end; - } - } - - if (do_debug_frames_interp) - frame_display_row (fc, &need_col_headers, &max_regs); - - start = block_end; - } - - printf ("\n"); - - return 1; -} - -#undef GET -#undef LEB -#undef SLEB - -static int -display_debug_not_supported (Elf_Internal_Shdr *section, - unsigned char *start ATTRIBUTE_UNUSED, - FILE *file ATTRIBUTE_UNUSED) -{ - printf (_("Displaying the debug contents of section %s is not yet supported.\n"), - SECTION_NAME (section)); - - return 1; -} - -/* A structure containing the name of a debug section - and a pointer to a function that can decode it. */ -struct -{ - const char *const name; - int (*display) (Elf_Internal_Shdr *, unsigned char *, FILE *); -} -debug_displays[] = -{ - { ".debug_abbrev", display_debug_abbrev }, - { ".debug_aranges", display_debug_aranges }, - { ".debug_frame", display_debug_frames }, - { ".debug_info", display_debug_info }, - { ".debug_line", display_debug_lines }, - { ".debug_pubnames", display_debug_pubnames }, - { ".eh_frame", display_debug_frames }, - { ".debug_macinfo", display_debug_macinfo }, - { ".debug_str", display_debug_str }, - { ".debug_loc", display_debug_loc }, - { ".debug_pubtypes", display_debug_pubnames }, - { ".debug_ranges", display_debug_not_supported }, - { ".debug_static_func", display_debug_not_supported }, - { ".debug_static_vars", display_debug_not_supported }, - { ".debug_types", display_debug_not_supported }, - { ".debug_weaknames", display_debug_not_supported } -}; - static int display_debug_section (Elf_Internal_Shdr *section, FILE *file) { char *name = SECTION_NAME (section); bfd_size_type length; - unsigned char *start; - int i; + int result = 1; + enum dwarf_section_display_enum i; length = section->sh_size; if (length == 0) @@ -9351,42 +7606,71 @@ display_debug_section (Elf_Internal_Shdr *section, FILE *file) return 0; } - start = get_data (NULL, file, section->sh_offset, length, - _("debug section data")); - if (!start) - return 0; - - /* See if we know how to display the contents of this section. */ - if (strncmp (name, ".gnu.linkonce.wi.", 17) == 0) + if (strneq (name, ".gnu.linkonce.wi.", 17)) name = ".debug_info"; - for (i = NUM_ELEM (debug_displays); i--;) - if (strcmp (debug_displays[i].name, name) == 0) + /* See if we know how to display the contents of this section. */ + for (i = 0; i < max; i++) + if (streq (debug_displays[i].section.name, name)) { - debug_displays[i].display (section, start, file); + struct dwarf_section *sec = &debug_displays [i].section; + + if (load_debug_section (i, file)) + { + result &= debug_displays[i].display (sec, file); + + if (i != info && i != abbrev) + free_debug_section (i); + } + break; } - if (i == -1) - printf (_("Unrecognized debug section: %s\n"), name); + if (i == max) + { + printf (_("Unrecognized debug section: %s\n"), name); + result = 0; + } - free (start); - - /* If we loaded in the abbrev section at some point, - we must release it here. */ - free_abbrevs (); - - return 1; + return result; } -static int +/* Set DUMP_SECTS for all sections where dumps were requested + based on section name. */ + +static void +initialise_dumps_byname (void) +{ + struct dump_list_entry *cur; + + for (cur = dump_sects_byname; cur; cur = cur->next) + { + unsigned int i; + int any; + + for (i = 0, any = 0; i < elf_header.e_shnum; i++) + if (streq (SECTION_NAME (section_headers + i), cur->name)) + { + request_dump (i, cur->type); + any = 1; + } + + if (!any) + warn (_("Section '%s' was not dumped because it does not exist!\n"), + cur->name); + } +} + +static void process_section_contents (FILE *file) { Elf_Internal_Shdr *section; unsigned int i; if (! do_dump) - return 1; + return; + + initialise_dumps_byname (); for (i = 0, section = section_headers; i < elf_header.e_shnum && i < num_dump_sects; @@ -9403,10 +7687,11 @@ process_section_contents (FILE *file) display_debug_section (section, file); } - if (i < num_dump_sects) - warn (_("Some sections were not dumped because they do not exist!\n")); - - return 1; + /* Check to see if the user requested a + dump of a section that does not exist. */ + while (i++ < num_dump_sects) + if (dump_sects[i]) + warn (_("Section %d was not dumped because it does not exist!\n"), i); } static void @@ -9430,6 +7715,337 @@ process_mips_fpe_exception (int mask) fputs ("0", stdout); } +/* ARM EABI attributes section. */ +typedef struct +{ + int tag; + const char *name; + /* 0 = special, 1 = string, 2 = uleb123, > 0x80 == table lookup. */ + int type; + const char **table; +} arm_attr_public_tag; + +static const char *arm_attr_tag_CPU_arch[] = + {"Pre-v4", "v4", "v4T", "v5T", "v5TE", "v5TEJ", "v6", "v6KZ", "v6T2", + "v6K", "v7"}; +static const char *arm_attr_tag_ARM_ISA_use[] = {"No", "Yes"}; +static const char *arm_attr_tag_THUMB_ISA_use[] = + {"No", "Thumb-1", "Thumb-2"}; +static const char *arm_attr_tag_VFP_arch[] = {"No", "VFPv1", "VFPv2"}; +static const char *arm_attr_tag_WMMX_arch[] = {"No", "WMMXv1"}; +static const char *arm_attr_tag_NEON_arch[] = {"No", "NEONv1"}; +static const char *arm_attr_tag_ABI_PCS_config[] = + {"None", "Bare platform", "Linux application", "Linux DSO", "PalmOS 2004", + "PalmOS (reserved)", "SymbianOS 2004", "SymbianOS (reserved)"}; +static const char *arm_attr_tag_ABI_PCS_R9_use[] = + {"V6", "SB", "TLS", "Unused"}; +static const char *arm_attr_tag_ABI_PCS_RW_data[] = + {"Absolute", "PC-relative", "SB-relative", "None"}; +static const char *arm_attr_tag_ABI_PCS_RO_DATA[] = + {"Absolute", "PC-relative", "None"}; +static const char *arm_attr_tag_ABI_PCS_GOT_use[] = + {"None", "direct", "GOT-indirect"}; +static const char *arm_attr_tag_ABI_PCS_wchar_t[] = + {"None", "??? 1", "2", "??? 3", "4"}; +static const char *arm_attr_tag_ABI_FP_rounding[] = {"Unused", "Needed"}; +static const char *arm_attr_tag_ABI_FP_denormal[] = {"Unused", "Needed"}; +static const char *arm_attr_tag_ABI_FP_exceptions[] = {"Unused", "Needed"}; +static const char *arm_attr_tag_ABI_FP_user_exceptions[] = {"Unused", "Needed"}; +static const char *arm_attr_tag_ABI_FP_number_model[] = + {"Unused", "Finite", "RTABI", "IEEE 754"}; +static const char *arm_attr_tag_ABI_align8_needed[] = {"No", "Yes", "4-byte"}; +static const char *arm_attr_tag_ABI_align8_preserved[] = + {"No", "Yes, except leaf SP", "Yes"}; +static const char *arm_attr_tag_ABI_enum_size[] = + {"Unused", "small", "int", "forced to int"}; +static const char *arm_attr_tag_ABI_HardFP_use[] = + {"As Tag_VFP_arch", "SP only", "DP only", "SP and DP"}; +static const char *arm_attr_tag_ABI_VFP_args[] = + {"AAPCS", "VFP registers", "custom"}; +static const char *arm_attr_tag_ABI_WMMX_args[] = + {"AAPCS", "WMMX registers", "custom"}; +static const char *arm_attr_tag_ABI_optimization_goals[] = + {"None", "Prefer Speed", "Aggressive Speed", "Prefer Size", + "Aggressive Size", "Prefer Debug", "Aggressive Debug"}; +static const char *arm_attr_tag_ABI_FP_optimization_goals[] = + {"None", "Prefer Speed", "Aggressive Speed", "Prefer Size", + "Aggressive Size", "Prefer Accuracy", "Aggressive Accuracy"}; + +#define LOOKUP(id, name) \ + {id, #name, 0x80 | ARRAY_SIZE(arm_attr_tag_##name), arm_attr_tag_##name} +static arm_attr_public_tag arm_attr_public_tags[] = +{ + {4, "CPU_raw_name", 1, NULL}, + {5, "CPU_name", 1, NULL}, + LOOKUP(6, CPU_arch), + {7, "CPU_arch_profile", 0, NULL}, + LOOKUP(8, ARM_ISA_use), + LOOKUP(9, THUMB_ISA_use), + LOOKUP(10, VFP_arch), + LOOKUP(11, WMMX_arch), + LOOKUP(12, NEON_arch), + LOOKUP(13, ABI_PCS_config), + LOOKUP(14, ABI_PCS_R9_use), + LOOKUP(15, ABI_PCS_RW_data), + LOOKUP(16, ABI_PCS_RO_DATA), + LOOKUP(17, ABI_PCS_GOT_use), + LOOKUP(18, ABI_PCS_wchar_t), + LOOKUP(19, ABI_FP_rounding), + LOOKUP(20, ABI_FP_denormal), + LOOKUP(21, ABI_FP_exceptions), + LOOKUP(22, ABI_FP_user_exceptions), + LOOKUP(23, ABI_FP_number_model), + LOOKUP(24, ABI_align8_needed), + LOOKUP(25, ABI_align8_preserved), + LOOKUP(26, ABI_enum_size), + LOOKUP(27, ABI_HardFP_use), + LOOKUP(28, ABI_VFP_args), + LOOKUP(29, ABI_WMMX_args), + LOOKUP(30, ABI_optimization_goals), + LOOKUP(31, ABI_FP_optimization_goals), + {32, "compatibility", 0, NULL} +}; +#undef LOOKUP + +/* Read an unsigned LEB128 encoded value from p. Set *PLEN to the number of + bytes read. */ +static unsigned int +read_uleb128 (unsigned char *p, unsigned int *plen) +{ + unsigned char c; + unsigned int val; + int shift; + int len; + + val = 0; + shift = 0; + len = 0; + do + { + c = *(p++); + len++; + val |= ((unsigned int)c & 0x7f) << shift; + shift += 7; + } + while (c & 0x80); + + *plen = len; + return val; +} + +static unsigned char * +display_arm_attribute (unsigned char *p) +{ + int tag; + unsigned int len; + int val; + arm_attr_public_tag *attr; + unsigned i; + int type; + + tag = read_uleb128 (p, &len); + p += len; + attr = NULL; + for (i = 0; i < ARRAY_SIZE(arm_attr_public_tags); i++) + { + if (arm_attr_public_tags[i].tag == tag) + { + attr = &arm_attr_public_tags[i]; + break; + } + } + + if (attr) + { + printf (" Tag_%s: ", attr->name); + switch (attr->type) + { + case 0: + switch (tag) + { + case 7: /* Tag_CPU_arch_profile. */ + val = read_uleb128 (p, &len); + p += len; + switch (val) + { + case 0: printf ("None\n"); break; + case 'A': printf ("Application\n"); break; + case 'R': printf ("Realtime\n"); break; + case 'M': printf ("Microcontroller\n"); break; + default: printf ("??? (%d)\n", val); break; + } + break; + + case 32: /* Tag_compatibility. */ + val = read_uleb128 (p, &len); + p += len; + printf ("flag = %d, vendor = %s\n", val, p); + p += strlen((char *)p) + 1; + break; + + default: + abort(); + } + return p; + + case 1: + case 2: + type = attr->type; + break; + + default: + assert (attr->type & 0x80); + val = read_uleb128 (p, &len); + p += len; + type = attr->type & 0x7f; + if (val >= type) + printf ("??? (%d)\n", val); + else + printf ("%s\n", attr->table[val]); + return p; + } + } + else + { + if (tag & 1) + type = 1; /* String. */ + else + type = 2; /* uleb128. */ + printf (" Tag_unknown_%d: ", tag); + } + + if (type == 1) + { + printf ("\"%s\"\n", p); + p += strlen((char *)p) + 1; + } + else + { + val = read_uleb128 (p, &len); + p += len; + printf ("%d (0x%x)\n", val, val); + } + + return p; +} + +static int +process_arm_specific (FILE *file) +{ + Elf_Internal_Shdr *sect; + unsigned char *contents; + unsigned char *p; + unsigned char *end; + bfd_vma section_len; + bfd_vma len; + unsigned i; + + /* Find the section header so that we get the size. */ + for (i = 0, sect = section_headers; + i < elf_header.e_shnum; + i++, sect++) + { + if (sect->sh_type != SHT_ARM_ATTRIBUTES) + continue; + + contents = get_data (NULL, file, sect->sh_offset, 1, sect->sh_size, + _("attributes")); + + if (!contents) + continue; + p = contents; + if (*p == 'A') + { + len = sect->sh_size - 1; + p++; + while (len > 0) + { + int namelen; + bfd_boolean public_section; + + section_len = byte_get (p, 4); + p += 4; + if (section_len > len) + { + printf (_("ERROR: Bad section length (%d > %d)\n"), + (int)section_len, (int)len); + section_len = len; + } + len -= section_len; + printf ("Attribute Section: %s\n", p); + if (strcmp ((char *)p, "aeabi") == 0) + public_section = TRUE; + else + public_section = FALSE; + namelen = strlen ((char *)p) + 1; + p += namelen; + section_len -= namelen + 4; + while (section_len > 0) + { + int tag = *(p++); + int val; + bfd_vma size; + size = byte_get (p, 4); + if (size > section_len) + { + printf (_("ERROR: Bad subsection length (%d > %d)\n"), + (int)size, (int)section_len); + size = section_len; + } + section_len -= size; + end = p + size - 1; + p += 4; + switch (tag) + { + case 1: + printf ("File Attributes\n"); + break; + case 2: + printf ("Section Attributes:"); + goto do_numlist; + case 3: + printf ("Symbol Attributes:"); + do_numlist: + for (;;) + { + unsigned int i; + val = read_uleb128 (p, &i); + p += i; + if (val == 0) + break; + printf (" %d", val); + } + printf ("\n"); + break; + default: + printf ("Unknown tag: %d\n", tag); + public_section = FALSE; + break; + } + if (public_section) + { + while (p < end) + p = display_arm_attribute(p); + } + else + { + /* ??? Do something sensible, like dump hex. */ + printf (" Unknown section contexts\n"); + p = end; + } + } + } + } + else + { + printf (_("Unknown format '%c'\n"), *p); + } + + free(contents); + } + return 1; +} + static int process_mips_specific (FILE *file) { @@ -9441,11 +8057,11 @@ process_mips_specific (FILE *file) size_t conflicts_offset = 0; /* We have a lot of special sections. Thanks SGI! */ - if (dynamic_segment == NULL) + if (dynamic_section == NULL) /* No information available. */ return 0; - for (entry = dynamic_segment; entry->d_tag != DT_NULL; ++entry) + for (entry = dynamic_section; entry->d_tag != DT_NULL; ++entry) switch (entry->d_tag) { case DT_MIPS_LIBLIST: @@ -9477,7 +8093,7 @@ process_mips_specific (FILE *file) size_t cnt; elib = get_data (NULL, file, liblist_offset, - liblistno * sizeof (Elf32_External_Lib), + liblistno, sizeof (Elf32_External_Lib), _("liblist")); if (elib) { @@ -9500,12 +8116,16 @@ process_mips_specific (FILE *file) liblist.l_flags = BYTE_GET (elib[cnt].l_flags); tmp = gmtime (&time); - sprintf (timebuf, "%04u-%02u-%02uT%02u:%02u:%02u", - tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday, - tmp->tm_hour, tmp->tm_min, tmp->tm_sec); + snprintf (timebuf, sizeof (timebuf), + "%04u-%02u-%02uT%02u:%02u:%02u", + tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday, + tmp->tm_hour, tmp->tm_min, tmp->tm_sec); printf ("%3lu: ", (unsigned long) cnt); - print_symbol (20, dynamic_strings + liblist.l_name); + if (VALID_DYNAMIC_NAME (liblist.l_name)) + print_symbol (20, GET_DYNAMIC_NAME (liblist.l_name)); + else + printf ("", liblist.l_name); printf (" %s %#10lx %-7ld", timebuf, liblist.l_checksum, liblist.l_version); @@ -9562,11 +8182,11 @@ process_mips_specific (FILE *file) while (sect->sh_type != SHT_MIPS_OPTIONS) ++sect; - eopt = get_data (NULL, file, options_offset, sect->sh_size, + eopt = get_data (NULL, file, options_offset, 1, sect->sh_size, _("options")); if (eopt) { - iopt = malloc ((sect->sh_size / sizeof (eopt)) * sizeof (*iopt)); + iopt = cmalloc ((sect->sh_size / sizeof (eopt)), sizeof (*iopt)); if (iopt == NULL) { error (_("Out of memory")); @@ -9643,7 +8263,7 @@ process_mips_specific (FILE *file) reginfo.ri_cprmask[1] = BYTE_GET (ereg->ri_cprmask[1]); reginfo.ri_cprmask[2] = BYTE_GET (ereg->ri_cprmask[2]); reginfo.ri_cprmask[3] = BYTE_GET (ereg->ri_cprmask[3]); - reginfo.ri_gp_value = BYTE_GET8 (ereg->ri_gp_value); + reginfo.ri_gp_value = BYTE_GET (ereg->ri_gp_value); printf ("GPR %08lx GP 0x", reginfo.ri_gprmask); @@ -9758,7 +8378,7 @@ process_mips_specific (FILE *file) return 0; } - iconf = malloc (conflictsno * sizeof (*iconf)); + iconf = cmalloc (conflictsno, sizeof (*iconf)); if (iconf == NULL) { error (_("Out of memory")); @@ -9770,7 +8390,7 @@ process_mips_specific (FILE *file) Elf32_External_Conflict *econf32; econf32 = get_data (NULL, file, conflicts_offset, - conflictsno * sizeof (*econf32), _("conflict")); + conflictsno, sizeof (*econf32), _("conflict")); if (!econf32) return 0; @@ -9784,7 +8404,7 @@ process_mips_specific (FILE *file) Elf64_External_Conflict *econf64; econf64 = get_data (NULL, file, conflicts_offset, - conflictsno * sizeof (*econf64), _("conflict")); + conflictsno, sizeof (*econf64), _("conflict")); if (!econf64) return 0; @@ -9805,7 +8425,10 @@ process_mips_specific (FILE *file) printf ("%5lu: %8lu ", (unsigned long) cnt, iconf[cnt]); print_vma (psym->st_value, FULL_HEX); putchar (' '); - print_symbol (25, dynamic_strings + psym->st_name); + if (VALID_DYNAMIC_NAME (psym->st_name)) + print_symbol (25, GET_DYNAMIC_NAME (psym->st_name)); + else + printf ("", psym->st_name); putchar ('\n'); } @@ -9821,6 +8444,7 @@ process_gnu_liblist (FILE *file) Elf_Internal_Shdr *section, *string_sec; Elf32_External_Lib *elib; char *strtab; + size_t strtab_size; size_t cnt; unsigned i; @@ -9834,15 +8458,19 @@ process_gnu_liblist (FILE *file) switch (section->sh_type) { case SHT_GNU_LIBLIST: - elib = get_data (NULL, file, section->sh_offset, section->sh_size, + if (SECTION_HEADER_INDEX (section->sh_link) >= elf_header.e_shnum) + break; + + elib = get_data (NULL, file, section->sh_offset, 1, section->sh_size, _("liblist")); if (elib == NULL) break; string_sec = SECTION_HEADER (section->sh_link); - strtab = get_data (NULL, file, string_sec->sh_offset, + strtab = get_data (NULL, file, string_sec->sh_offset, 1, string_sec->sh_size, _("liblist string table")); + strtab_size = string_sec->sh_size; if (strtab == NULL || section->sh_entsize != sizeof (Elf32_External_Lib)) @@ -9872,15 +8500,18 @@ process_gnu_liblist (FILE *file) liblist.l_flags = BYTE_GET (elib[cnt].l_flags); tmp = gmtime (&time); - sprintf (timebuf, "%04u-%02u-%02uT%02u:%02u:%02u", - tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday, - tmp->tm_hour, tmp->tm_min, tmp->tm_sec); + snprintf (timebuf, sizeof (timebuf), + "%04u-%02u-%02uT%02u:%02u:%02u", + tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday, + tmp->tm_hour, tmp->tm_min, tmp->tm_sec); printf ("%3lu: ", (unsigned long) cnt); if (do_wide) - printf ("%-20s", strtab + liblist.l_name); + printf ("%-20s", liblist.l_name < strtab_size + ? strtab + liblist.l_name : ""); else - printf ("%-20.20s", strtab + liblist.l_name); + printf ("%-20.20s", liblist.l_name < strtab_size + ? strtab + liblist.l_name : ""); printf (" %s %#010lx %-7ld %-7ld\n", timebuf, liblist.l_checksum, liblist.l_version, liblist.l_flags); } @@ -9897,24 +8528,49 @@ get_note_type (unsigned e_type) { static char buff[64]; - switch (e_type) - { - case NT_AUXV: return _("NT_AUXV (auxiliary vector)"); - case NT_PRSTATUS: return _("NT_PRSTATUS (prstatus structure)"); - case NT_FPREGSET: return _("NT_FPREGSET (floating point registers)"); - case NT_PRPSINFO: return _("NT_PRPSINFO (prpsinfo structure)"); - case NT_TASKSTRUCT: return _("NT_TASKSTRUCT (task structure)"); - case NT_PRXFPREG: return _("NT_PRXFPREG (user_xfpregs structure)"); - case NT_PSTATUS: return _("NT_PSTATUS (pstatus structure)"); - case NT_FPREGS: return _("NT_FPREGS (floating point registers)"); - case NT_PSINFO: return _("NT_PSINFO (psinfo structure)"); - case NT_LWPSTATUS: return _("NT_LWPSTATUS (lwpstatus_t structure)"); - case NT_LWPSINFO: return _("NT_LWPSINFO (lwpsinfo_t structure)"); - case NT_WIN32PSTATUS: return _("NT_WIN32PSTATUS (win32_pstatus structure)"); - default: - sprintf (buff, _("Unknown note type: (0x%08x)"), e_type); - return buff; - } + if (elf_header.e_type == ET_CORE) + switch (e_type) + { + case NT_AUXV: + return _("NT_AUXV (auxiliary vector)"); + case NT_PRSTATUS: + return _("NT_PRSTATUS (prstatus structure)"); + case NT_FPREGSET: + return _("NT_FPREGSET (floating point registers)"); + case NT_PRPSINFO: + return _("NT_PRPSINFO (prpsinfo structure)"); + case NT_TASKSTRUCT: + return _("NT_TASKSTRUCT (task structure)"); + case NT_PRXFPREG: + return _("NT_PRXFPREG (user_xfpregs structure)"); + case NT_PSTATUS: + return _("NT_PSTATUS (pstatus structure)"); + case NT_FPREGS: + return _("NT_FPREGS (floating point registers)"); + case NT_PSINFO: + return _("NT_PSINFO (psinfo structure)"); + case NT_LWPSTATUS: + return _("NT_LWPSTATUS (lwpstatus_t structure)"); + case NT_LWPSINFO: + return _("NT_LWPSINFO (lwpsinfo_t structure)"); + case NT_WIN32PSTATUS: + return _("NT_WIN32PSTATUS (win32_pstatus structure)"); + default: + break; + } + else + switch (e_type) + { + case NT_VERSION: + return _("NT_VERSION (version)"); + case NT_ARCH: + return _("NT_ARCH (architecture)"); + default: + break; + } + + snprintf (buff, sizeof (buff), _("Unknown note type: (0x%08x)"), e_type); + return buff; } static const char * @@ -9935,7 +8591,7 @@ get_netbsd_elfcore_note_type (unsigned e_type) if (e_type < NT_NETBSDCORE_FIRSTMACH) { - sprintf (buff, _("Unknown note type: (0x%08x)"), e_type); + snprintf (buff, sizeof (buff), _("Unknown note type: (0x%08x)"), e_type); return buff; } @@ -9974,7 +8630,8 @@ get_netbsd_elfcore_note_type (unsigned e_type) } } - sprintf (buff, _("PT_FIRSTMACH+%d"), e_type - NT_NETBSDCORE_FIRSTMACH); + snprintf (buff, sizeof (buff), _("PT_FIRSTMACH+%d"), + e_type - NT_NETBSDCORE_FIRSTMACH); return buff; } @@ -9989,22 +8646,18 @@ process_note (Elf_Internal_Note *pnote) const char *nt; if (pnote->namesz == 0) - { - /* If there is no note name, then use the default set of - note type strings. */ - nt = get_note_type (pnote->type); - } - else if (strncmp (pnote->namedata, "NetBSD-CORE", 11) == 0) - { - /* NetBSD-specific core file notes. */ - nt = get_netbsd_elfcore_note_type (pnote->type); - } + /* If there is no note name, then use the default set of + note type strings. */ + nt = get_note_type (pnote->type); + + else if (strneq (pnote->namedata, "NetBSD-CORE", 11)) + /* NetBSD-specific core file notes. */ + nt = get_netbsd_elfcore_note_type (pnote->type); + else - { - /* Don't recognize this note name; just use the default set of - note type strings. */ + /* Don't recognize this note name; just use the default set of + note type strings. */ nt = get_note_type (pnote->type); - } printf (" %s\t\t0x%08lx\t%s\n", pnote->namesz ? pnote->namedata : "(NONE)", @@ -10023,7 +8676,7 @@ process_corefile_note_segment (FILE *file, bfd_vma offset, bfd_vma length) if (length <= 0) return 0; - pnotes = get_data (NULL, file, offset, length, _("notes")); + pnotes = get_data (NULL, file, offset, 1, length, _("notes")); if (!pnotes) return 0; @@ -10050,9 +8703,9 @@ process_corefile_note_segment (FILE *file, bfd_vma offset, bfd_vma length) if (((char *) next) > (((char *) pnotes) + length)) { - warn (_("corrupt note found at offset %x into core notes\n"), - ((char *) external) - ((char *) pnotes)); - warn (_(" type: %x, namesize: %08lx, descsize: %08lx\n"), + warn (_("corrupt note found at offset %lx into core notes\n"), + (long)((char *)external - (char *)pnotes)); + warn (_(" type: %lx, namesize: %08lx, descsize: %08lx\n"), inote.type, inote.namesz, inote.descsz); break; } @@ -10119,24 +8772,39 @@ process_corefile_note_segments (FILE *file) } static int -process_corefile_contents (FILE *file) +process_note_sections (FILE *file) +{ + Elf_Internal_Shdr *section; + unsigned long i; + int res = 1; + + for (i = 0, section = section_headers; + i < elf_header.e_shnum; + i++, section++) + if (section->sh_type == SHT_NOTE) + res &= process_corefile_note_segment (file, + (bfd_vma) section->sh_offset, + (bfd_vma) section->sh_size); + + return res; +} + +static int +process_notes (FILE *file) { /* If we have not been asked to display the notes then do nothing. */ if (! do_notes) return 1; - /* If file is not a core file then exit. */ if (elf_header.e_type != ET_CORE) - return 1; + return process_note_sections (file); /* No program headers means no NOTE segment. */ - if (elf_header.e_phnum == 0) - { - printf (_("No note segments present in the core file.\n")); - return 1; - } + if (elf_header.e_phnum > 0) + return process_corefile_note_segments (file); - return process_corefile_note_segments (file); + printf (_("No note segments present in the core file.\n")); + return 1; } static int @@ -10147,6 +8815,8 @@ process_arch_specific (FILE *file) switch (elf_header.e_machine) { + case EM_ARM: + return process_arm_specific (file); case EM_MIPS: case EM_MIPS_RS3_LE: return process_mips_specific (file); @@ -10225,9 +8895,9 @@ get_file_header (FILE *file) elf_header.e_type = BYTE_GET (ehdr64.e_type); elf_header.e_machine = BYTE_GET (ehdr64.e_machine); elf_header.e_version = BYTE_GET (ehdr64.e_version); - elf_header.e_entry = BYTE_GET8 (ehdr64.e_entry); - elf_header.e_phoff = BYTE_GET8 (ehdr64.e_phoff); - elf_header.e_shoff = BYTE_GET8 (ehdr64.e_shoff); + elf_header.e_entry = BYTE_GET (ehdr64.e_entry); + elf_header.e_phoff = BYTE_GET (ehdr64.e_phoff); + elf_header.e_shoff = BYTE_GET (ehdr64.e_shoff); elf_header.e_flags = BYTE_GET (ehdr64.e_flags); elf_header.e_ehsize = BYTE_GET (ehdr64.e_ehsize); elf_header.e_phentsize = BYTE_GET (ehdr64.e_phentsize); @@ -10247,6 +8917,8 @@ get_file_header (FILE *file) get_64bit_section_headers (file, 1); } + is_relocatable = elf_header.e_type == ET_REL; + return 1; } @@ -10276,21 +8948,44 @@ process_object (char *file_name, FILE *file) if (show_name) printf (_("\nFile: %s\n"), file_name); + /* Initialise the dump_sects array from the cmdline_dump_sects array. + Note we do this even if cmdline_dump_sects is empty because we + must make sure that the dump_sets array is zeroed out before each + object file is processed. */ + if (num_dump_sects > num_cmdline_dump_sects) + memset (dump_sects, 0, num_dump_sects); + + if (num_cmdline_dump_sects > 0) + { + if (num_dump_sects == 0) + /* A sneaky way of allocating the dump_sects array. */ + request_dump (num_cmdline_dump_sects, 0); + + assert (num_dump_sects >= num_cmdline_dump_sects); + memcpy (dump_sects, cmdline_dump_sects, num_cmdline_dump_sects); + } + if (! process_file_header ()) return 1; if (! process_section_headers (file)) { - /* Without loaded section headers we - cannot process lots of things. */ + /* Without loaded section headers we cannot process lots of + things. */ do_unwind = do_version = do_dump = do_arch = 0; if (! do_using_dynamic) do_syms = do_reloc = 0; } + if (! process_section_groups (file)) + { + /* Without loaded section groups we cannot process unwind. */ + do_unwind = 0; + } + if (process_program_headers (file)) - process_dynamic_segment (file); + process_dynamic_section (file); process_relocs (file); @@ -10304,7 +8999,7 @@ process_object (char *file_name, FILE *file) process_section_contents (file); - process_corefile_contents (file); + process_notes (file); process_gnu_liblist (file); @@ -10333,6 +9028,7 @@ process_object (char *file_name, FILE *file) { free (dynamic_strings); dynamic_strings = NULL; + dynamic_strings_length = 0; } if (dynamic_symbols) @@ -10348,6 +9044,31 @@ process_object (char *file_name, FILE *file) dynamic_syminfo = NULL; } + if (section_headers_groups) + { + free (section_headers_groups); + section_headers_groups = NULL; + } + + if (section_groups) + { + struct group_list *g, *next; + + for (i = 0; i < group_count; i++) + { + for (g = section_groups [i].root; g != NULL; g = next) + { + next = g->next; + free (g); + } + } + + free (section_groups); + section_groups = NULL; + } + + free_debug_memory (); + return 0; } @@ -10416,7 +9137,7 @@ process_archive (char *file_name, FILE *file) if (fread (longnames, longnames_size, 1, file) != 1) { free (longnames); - error(_("%s: failed to read string table\n"), file_name); + error (_("%s: failed to read string table\n"), file_name); return 1; } @@ -10452,7 +9173,7 @@ process_archive (char *file_name, FILE *file) off = strtoul (arhdr.ar_name + 1, NULL, 10); if (off >= longnames_size) { - error (_("%s: invalid archive string table offset %lu\n"), off); + error (_("%s: invalid archive string table offset %lu\n"), file_name, off); ret = 1; break; } @@ -10468,7 +9189,7 @@ process_archive (char *file_name, FILE *file) if (nameend == NULL) { - error (_("%s: bad archive file name\n")); + error (_("%s: bad archive file name\n"), file_name); ret = 1; break; } @@ -10598,8 +9319,6 @@ int main (int argc, char **argv) { int err; - char *cmdline_dump_sects = NULL; - unsigned num_cmdline_dump_sects = 0; #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) setlocale (LC_MESSAGES, ""); @@ -10610,15 +9329,13 @@ main (int argc, char **argv) bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); + expandargv (&argc, &argv); + parse_args (argc, argv); - if (optind < (argc - 1)) - show_name = 1; - - /* When processing more than one file remember the dump requests - issued on command line to reset them after each file. */ - if (optind + 1 < argc && dump_sects != NULL) + if (num_dump_sects > 0) { + /* Make a copy of the dump_sects array. */ cmdline_dump_sects = malloc (num_dump_sects); if (cmdline_dump_sects == NULL) error (_("Out of memory allocating dump request table.")); @@ -10629,19 +9346,12 @@ main (int argc, char **argv) } } + if (optind < (argc - 1)) + show_name = 1; + err = 0; while (optind < argc) - { - err |= process_file (argv[optind++]); - - /* Reset dump requests. */ - if (optind < argc && dump_sects != NULL) - { - num_dump_sects = num_cmdline_dump_sects; - if (num_cmdline_dump_sects > 0) - memcpy (dump_sects, cmdline_dump_sects, num_cmdline_dump_sects); - } - } + err |= process_file (argv[optind++]); if (dump_sects != NULL) free (dump_sects); diff --git a/contrib/binutils/binutils/rename.c b/contrib/binutils/binutils/rename.c index 398152e05f1..7d21cb34c04 100644 --- a/contrib/binutils/binutils/rename.c +++ b/contrib/binutils/binutils/rename.c @@ -15,8 +15,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #include "bfd.h" #include "bucomm.h" @@ -37,6 +37,7 @@ #define O_BINARY 0 #endif +#if ! defined (_WIN32) || defined (__CYGWIN32__) static int simple_copy (const char *, const char *); /* The number of bytes to copy at once. */ @@ -88,6 +89,7 @@ simple_copy (const char *from, const char *to) } return 0; } +#endif /* __CYGWIN32__ or not _WIN32 */ /* Set the times of the file DESTINATION to be the same as those in STATBUF. */ @@ -140,7 +142,7 @@ set_times (const char *destination, const struct stat *statbuf) Return 0 if ok, -1 if error. */ int -smart_rename (const char *from, const char *to, int preserve_dates) +smart_rename (const char *from, const char *to, int preserve_dates ATTRIBUTE_UNUSED) { bfd_boolean exists; struct stat s; diff --git a/contrib/binutils/binutils/resbin.c b/contrib/binutils/binutils/resbin.c index ad14bdafcbb..80c2596a70b 100644 --- a/contrib/binutils/binutils/resbin.c +++ b/contrib/binutils/binutils/resbin.c @@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ /* This file contains functions to convert between the binary resource format and the internal structures that we want to use. The same @@ -1331,7 +1331,7 @@ resid_to_bin (struct res_id id, int big_endian) if (! id.named) { d->length = 4; - d->data = (unsigned char *) reswr_alloc (4); + d->data = (unsigned char *) reswr_alloc (d->length); put_16 (big_endian, 0xffff, d->data); put_16 (big_endian, id.u.id, d->data + 2); } @@ -1408,14 +1408,14 @@ res_to_bin_accelerator (const struct accelerator *accelerators, d = (struct bindata *) reswr_alloc (sizeof *d); d->length = 8; - d->data = (unsigned char *) reswr_alloc (8); + d->data = (unsigned char *) reswr_alloc (d->length); put_16 (big_endian, a->flags | (a->next != NULL ? 0 : ACC_LAST), d->data); put_16 (big_endian, a->key, d->data + 2); put_16 (big_endian, a->id, d->data + 4); - put_16 (big_endian, 0, d->data + 8); + put_16 (big_endian, 0, d->data + 6); d->next = NULL; *pp = d; @@ -1434,7 +1434,7 @@ res_to_bin_cursor (const struct cursor *c, int big_endian) d = (struct bindata *) reswr_alloc (sizeof *d); d->length = 4; - d->data = (unsigned char *) reswr_alloc (4); + d->data = (unsigned char *) reswr_alloc (d->length); put_16 (big_endian, c->xhotspot, d->data); put_16 (big_endian, c->yhotspot, d->data + 2); @@ -1459,7 +1459,7 @@ res_to_bin_group_cursor (const struct group_cursor *group_cursors, first = (struct bindata *) reswr_alloc (sizeof *first); first->length = 6; - first->data = (unsigned char *) reswr_alloc (6); + first->data = (unsigned char *) reswr_alloc (first->length); put_16 (big_endian, 0, first->data); put_16 (big_endian, 2, first->data + 2); @@ -1476,7 +1476,7 @@ res_to_bin_group_cursor (const struct group_cursor *group_cursors, d = (struct bindata *) reswr_alloc (sizeof *d); d->length = 14; - d->data = (unsigned char *) reswr_alloc (14); + d->data = (unsigned char *) reswr_alloc (d->length); put_16 (big_endian, gc->width, d->data); put_16 (big_endian, gc->height, d->data + 2); @@ -1642,7 +1642,7 @@ res_to_bin_dialog (const struct dialog *dialog, int big_endian) d = (struct bindata *) reswr_alloc (sizeof *d); d->length = 2; - d->data = (unsigned char *) reswr_alloc (2); + d->data = (unsigned char *) reswr_alloc (d->length); length += 2; @@ -1687,7 +1687,7 @@ res_to_bin_fontdir (const struct fontdir *fontdirs, int big_endian) first = (struct bindata *) reswr_alloc (sizeof *first); first->length = 2; - first->data = (unsigned char *) reswr_alloc (2); + first->data = (unsigned char *) reswr_alloc (first->length); first->next = NULL; pp = &first->next; @@ -1701,7 +1701,7 @@ res_to_bin_fontdir (const struct fontdir *fontdirs, int big_endian) d = (struct bindata *) reswr_alloc (sizeof *d); d->length = 2; - d->data = (unsigned char *) reswr_alloc (2); + d->data = (unsigned char *) reswr_alloc (d->length); put_16 (big_endian, fd->index, d->data); @@ -1733,7 +1733,7 @@ res_to_bin_group_icon (const struct group_icon *group_icons, int big_endian) first = (struct bindata *) reswr_alloc (sizeof *first); first->length = 6; - first->data = (unsigned char *) reswr_alloc (6); + first->data = (unsigned char *) reswr_alloc (first->length); put_16 (big_endian, 0, first->data); put_16 (big_endian, 1, first->data + 2); @@ -1750,7 +1750,7 @@ res_to_bin_group_icon (const struct group_icon *group_icons, int big_endian) d = (struct bindata *) reswr_alloc (sizeof *d); d->length = 14; - d->data = (unsigned char *) reswr_alloc (14); + d->data = (unsigned char *) reswr_alloc (d->length); d->data[0] = gi->width; d->data[1] = gi->height; @@ -1875,7 +1875,7 @@ res_to_bin_menuexitems (const struct menuitem *items, int big_endian) d = (struct bindata *) reswr_alloc (sizeof *d); d->length = 12; - d->data = (unsigned char *) reswr_alloc (12); + d->data = (unsigned char *) reswr_alloc (d->length); length += 12; @@ -1903,7 +1903,7 @@ res_to_bin_menuexitems (const struct menuitem *items, int big_endian) d = (struct bindata *) reswr_alloc (sizeof *d); d->length = 4; - d->data = (unsigned char *) reswr_alloc (4); + d->data = (unsigned char *) reswr_alloc (d->length); put_32 (big_endian, mi->help, d->data); @@ -1948,13 +1948,13 @@ res_to_bin_rcdata (const struct rcdata_item *items, int big_endian) case RCDATA_WORD: d->length = 2; - d->data = (unsigned char *) reswr_alloc (2); + d->data = (unsigned char *) reswr_alloc (d->length); put_16 (big_endian, ri->u.word, d->data); break; case RCDATA_DWORD: d->length = 4; - d->data = (unsigned char *) reswr_alloc (4); + d->data = (unsigned char *) reswr_alloc (d->length); put_32 (big_endian, ri->u.dword, d->data); break; @@ -2060,7 +2060,7 @@ res_to_bin_versioninfo (const struct versioninfo *versioninfo, int big_endian) first = (struct bindata *) reswr_alloc (sizeof *first); first->length = 6; - first->data = (unsigned char *) reswr_alloc (6); + first->data = (unsigned char *) reswr_alloc (first->length); length = 6; @@ -2086,7 +2086,7 @@ res_to_bin_versioninfo (const struct versioninfo *versioninfo, int big_endian) d = (struct bindata *) reswr_alloc (sizeof *d); d->length = 52; - d->data = (unsigned char *) reswr_alloc (52); + d->data = (unsigned char *) reswr_alloc (d->length); length += 52; @@ -2120,7 +2120,7 @@ res_to_bin_versioninfo (const struct versioninfo *versioninfo, int big_endian) vid = (struct bindata *) reswr_alloc (sizeof *vid); vid->length = 6; - vid->data = (unsigned char *) reswr_alloc (6); + vid->data = (unsigned char *) reswr_alloc (vid->length); length += 6; vilen = 6; @@ -2153,7 +2153,7 @@ res_to_bin_versioninfo (const struct versioninfo *versioninfo, int big_endian) vsd = (struct bindata *) reswr_alloc (sizeof *vsd); vsd->length = 6; - vsd->data = (unsigned char *) reswr_alloc (6); + vsd->data = (unsigned char *) reswr_alloc (vsd->length); length += 6; vilen += 6; @@ -2183,7 +2183,7 @@ res_to_bin_versioninfo (const struct versioninfo *versioninfo, int big_endian) vssd = (struct bindata *) reswr_alloc (sizeof *vssd); vssd->length = 6; - vssd->data = (unsigned char *) reswr_alloc (6); + vssd->data = (unsigned char *) reswr_alloc (vssd->length); length += 6; vilen += 6; @@ -2241,7 +2241,7 @@ res_to_bin_versioninfo (const struct versioninfo *versioninfo, int big_endian) vvd = (struct bindata *) reswr_alloc (sizeof *vvd); vvd->length = 6; - vvd->data = (unsigned char *) reswr_alloc (6); + vvd->data = (unsigned char *) reswr_alloc (vvd->length); length += 6; vilen += 6; @@ -2271,7 +2271,7 @@ res_to_bin_versioninfo (const struct versioninfo *versioninfo, int big_endian) vvsd = (struct bindata *) reswr_alloc (sizeof *vvsd); vvsd->length = 4; - vvsd->data = (unsigned char *) reswr_alloc (4); + vvsd->data = (unsigned char *) reswr_alloc (vvsd->length); length += 4; vilen += 4; diff --git a/contrib/binutils/binutils/rescoff.c b/contrib/binutils/binutils/rescoff.c index 60122ded0f2..fdd9aad9982 100644 --- a/contrib/binutils/binutils/rescoff.c +++ b/contrib/binutils/binutils/rescoff.c @@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ /* This file contains function that read and write Windows resources in COFF files. */ diff --git a/contrib/binutils/binutils/resrc.c b/contrib/binutils/binutils/resrc.c index c290a9d0c04..73b482cd04a 100644 --- a/contrib/binutils/binutils/resrc.c +++ b/contrib/binutils/binutils/resrc.c @@ -1,5 +1,6 @@ /* resrc.c -- read and write Windows rc files. - Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005 + Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. This file is part of GNU Binutils. @@ -16,8 +17,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ /* This file contains functions that read and write Windows rc files. These are text files that represent resources. */ @@ -857,7 +858,7 @@ define_font (struct res_id id, const struct res_res_info *resinfo, e = open_file_search (filename, FOPEN_RB, "font file", &real_filename); if (stat (real_filename, &s) < 0) - fatal (_("stat failed on bitmap file `%s': %s"), real_filename, + fatal (_("stat failed on font file `%s': %s"), real_filename, strerror (errno)); data = (unsigned char *) res_alloc (s.st_size); @@ -1249,12 +1250,45 @@ define_user_data (struct res_id id, struct res_id type, ids[2].named = 0; ids[2].u.id = resinfo->language; - r = define_resource (&resources, 3, ids, 0); + r = define_resource (& resources, 3, ids, 0); r->type = RES_TYPE_USERDATA; r->u.userdata = data; r->res_info = *resinfo; } +void +define_rcdata_file (struct res_id id, const struct res_res_info *resinfo, + const char *filename) +{ + struct rcdata_item *ri; + FILE *e; + char *real_filename; + struct stat s; + unsigned char *data; + + e = open_file_search (filename, FOPEN_RB, "file", &real_filename); + + + if (stat (real_filename, &s) < 0) + fatal (_("stat failed on file `%s': %s"), real_filename, + strerror (errno)); + + data = (unsigned char *) res_alloc (s.st_size); + + get_data (e, data, s.st_size, real_filename); + + fclose (e); + free (real_filename); + + ri = (struct rcdata_item *) res_alloc (sizeof *ri); + ri->next = NULL; + ri->type = RCDATA_BUFFER; + ri->u.buffer.length = s.st_size; + ri->u.buffer.data = data; + + define_rcdata (id, resinfo, ri); +} + /* Define a user data resource where the data is in a file. */ void @@ -1268,10 +1302,10 @@ define_user_file (struct res_id id, struct res_id type, struct res_id ids[3]; struct res_resource *r; - e = open_file_search (filename, FOPEN_RB, "font file", &real_filename); + e = open_file_search (filename, FOPEN_RB, "file", &real_filename); if (stat (real_filename, &s) < 0) - fatal (_("stat failed on bitmap file `%s': %s"), real_filename, + fatal (_("stat failed on file `%s': %s"), real_filename, strerror (errno)); data = (unsigned char *) res_alloc (s.st_size); diff --git a/contrib/binutils/binutils/resres.c b/contrib/binutils/binutils/resres.c index ed2714db005..1489d5eeda4 100644 --- a/contrib/binutils/binutils/resres.c +++ b/contrib/binutils/binutils/resres.c @@ -1,5 +1,5 @@ /* resres.c: read_res_file and write_res_file implementation for windres. - Copyright 1998, 1999 Free Software Foundation, Inc. + Copyright 1998, 1999, 2001, 2002 Free Software Foundation, Inc. Written by Anders Norlander . This file is part of GNU Binutils. @@ -16,8 +16,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ /* FIXME: This file does not work correctly in a cross configuration. It assumes that it can use fread and fwrite to read and write @@ -408,7 +408,7 @@ write_res_data (data, size, count) size_t size; int count; { - if (fwrite (data, size, count, fres) != (size_t) count) + if ((size_t) fwrite (data, size, count, fres) != (size_t) count) fatal ("%s: could not write to file", filename); } diff --git a/contrib/binutils/binutils/size.c b/contrib/binutils/binutils/size.c index 98754934a98..b78cba02ba0 100644 --- a/contrib/binutils/binutils/size.c +++ b/contrib/binutils/binutils/size.c @@ -1,6 +1,6 @@ /* size.c -- report size of various sections of an executable file. - Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, - 2002, 2003 Free Software Foundation, Inc. + Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, + 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* Extensions/incompatibilities: o - BSD output has filenames at the end. @@ -45,7 +45,9 @@ enum } radix = decimal; -int berkeley_format = BSD_DEFAULT; /* 0 means use AT&T-style output. */ +/* 0 means use AT&T-style output. */ +static int berkeley_format = BSD_DEFAULT; + int show_version = 0; int show_help = 0; int show_totals = 0; @@ -66,9 +68,6 @@ static void display_file (char *); static void display_bfd (bfd *); static void display_archive (bfd *); static int size_number (bfd_size_type); -#if 0 -static void lprint_number (int, bfd_size_type); -#endif static void rprint_number (int, bfd_size_type); static void print_berkeley_format (bfd *); static void sysv_internal_sizer (bfd *, asection *, void *); @@ -88,6 +87,7 @@ usage (FILE *stream, int status) -o|-d|-x --radix={8|10|16} Display numbers in octal, decimal or hex\n\ -t --totals Display the total sizes (Berkeley only)\n\ --target= Set the binary file format\n\ + @ Read options from \n\ -h --help Display this information\n\ -v --version Display the program's version\n\ \n"), @@ -103,7 +103,7 @@ usage (FILE *stream, int status) exit (status); } -struct option long_options[] = +static struct option long_options[] = { {"format", required_argument, 0, 200}, {"radix", required_argument, 0, 201}, @@ -134,6 +134,8 @@ main (int argc, char **argv) program_name = *argv; xmalloc_set_program_name (program_name); + expandargv (&argc, &argv); + bfd_init (); set_default_bfd_target (); @@ -382,25 +384,6 @@ size_number (bfd_size_type num) return strlen (buffer); } -#if 0 - -/* This is not used. */ - -static void -lprint_number (int width, bfd_size_type num) -{ - char buffer[40]; - - sprintf (buffer, - (radix == decimal ? "%lu" : - ((radix == octal) ? "0%lo" : "0x%lx")), - (unsigned long) num); - - printf ("%-*s", width, buffer); -} - -#endif - static void rprint_number (int width, bfd_size_type num) { @@ -429,7 +412,7 @@ berkeley_sum (bfd *abfd ATTRIBUTE_UNUSED, sec_ptr sec, if ((flags & SEC_ALLOC) == 0) return; - size = bfd_get_section_size_before_reloc (sec); + size = bfd_get_section_size (sec); if ((flags & SEC_CODE) != 0 || (flags & SEC_READONLY) != 0) textsize += size; else if ((flags & SEC_HAS_CONTENTS) != 0) @@ -451,14 +434,8 @@ print_berkeley_format (bfd *abfd) bfd_map_over_sections (abfd, berkeley_sum, NULL); if (files_seen++ == 0) -#if 0 - /* Intel doesn't like bss/stk because they don't have core files. */ - puts ((radix == octal) ? " text\t data\tbss/stk\t oct\t hex\tfilename" : - " text\t data\tbss/stk\t dec\t hex\tfilename"); -#else puts ((radix == octal) ? " text\t data\t bss\t oct\t hex\tfilename" : " text\t data\t bss\t dec\t hex\tfilename"); -#endif total = textsize + datasize + bsssize; diff --git a/contrib/binutils/binutils/srconv.c b/contrib/binutils/binutils/srconv.c index 0ffa0588347..d1f3efdb9e0 100644 --- a/contrib/binutils/binutils/srconv.c +++ b/contrib/binutils/binutils/srconv.c @@ -1,6 +1,6 @@ /* srconv.c -- Sysroff conversion program - Copyright 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003 - Free Software Foundation, Inc. + Copyright 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, + 2005 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -16,8 +16,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ /* Written by Steve Chamberlain (sac@cygnus.com) @@ -46,11 +46,11 @@ static int get_member_id (int); static int get_ordinary_id (int); static char *section_translate (char *); static char *strip_suffix (char *); -static void checksum (FILE *, char *, int, int); -static void writeINT (int, char *, int *, int, FILE *); -static void writeBITS (int, char *, int *, int); -static void writeBARRAY (barray, char *, int *, int, FILE *); -static void writeCHARS (char *, char *, int *, int, FILE *); +static void checksum (FILE *, unsigned char *, int, int); +static void writeINT (int, unsigned char *, int *, int, FILE *); +static void writeBITS (int, unsigned char *, int *, int); +static void writeBARRAY (barray, unsigned char *, int *, int, FILE *); +static void writeCHARS (char *, unsigned char *, int *, int, FILE *); static void wr_tr (void); static void wr_un (struct coff_ofile *, struct coff_sfile *, int, int); static void wr_hd (struct coff_ofile *); @@ -158,7 +158,7 @@ strip_suffix (char *name) /* IT LEN stuff CS */ static void -checksum (FILE *file, char *ptr, int size, int code) +checksum (FILE *file, unsigned char *ptr, int size, int code) { int j; int last; @@ -181,7 +181,7 @@ checksum (FILE *file, char *ptr, int size, int code) static void -writeINT (int n, char *ptr, int *idx, int size, FILE *file) +writeINT (int n, unsigned char *ptr, int *idx, int size, FILE *file) { int byte = *idx / 8; @@ -222,7 +222,7 @@ writeINT (int n, char *ptr, int *idx, int size, FILE *file) } static void -writeBITS (int val, char *ptr, int *idx, int size) +writeBITS (int val, unsigned char *ptr, int *idx, int size) { int byte = *idx / 8; int bit = *idx % 8; @@ -239,8 +239,8 @@ writeBITS (int val, char *ptr, int *idx, int size) } static void -writeBARRAY (barray data, char *ptr, int *idx, int size ATTRIBUTE_UNUSED, - FILE *file) +writeBARRAY (barray data, unsigned char *ptr, int *idx, + int size ATTRIBUTE_UNUSED, FILE *file) { int i; @@ -250,7 +250,7 @@ writeBARRAY (barray data, char *ptr, int *idx, int size ATTRIBUTE_UNUSED, } static void -writeCHARS (char *string, char *ptr, int *idx, int size, FILE *file) +writeCHARS (char *string, unsigned char *ptr, int *idx, int size, FILE *file) { int i = *idx / 8; @@ -317,12 +317,8 @@ wr_un (struct coff_ofile *ptr, struct coff_sfile *sfile, int first, un.format = FORMAT_OM; un.spare1 = 0; -#if 1 - un.nsections = ptr->nsections - 1; /* Don't count the abs section. */ -#else - /*NEW - only count sections with size. */ - un.nsections = nsecs; -#endif + /* Don't count the abs section. */ + un.nsections = ptr->nsections - 1; un.nextdefs = 0; un.nextrefs = 0; @@ -456,14 +452,14 @@ wr_ob (struct coff_ofile *p ATTRIBUTE_UNUSED, struct coff_section *section) unsigned char stuff[200]; i = 0; - while (i < section->bfd_section->_raw_size) + while (i < bfd_get_section_size (section->bfd_section)) { struct IT_ob ob; int todo = 200; /* Copy in 200 byte lumps. */ ob.spare = 0; - if (i + todo > section->bfd_section->_raw_size) - todo = section->bfd_section->_raw_size - i; + if (i + todo > bfd_get_section_size (section->bfd_section)) + todo = bfd_get_section_size (section->bfd_section) - i; if (first) { @@ -1208,11 +1204,6 @@ wr_du (struct coff_ofile *p, struct coff_sfile *sfile, int n) { struct IT_du du; int lim; -#if 0 - struct coff_symbol *symbol; - static int incit = 0x500000; - int used = 0; -#endif int i; int j; unsigned int *lowest = (unsigned *) nints (p->nsections); @@ -1234,47 +1225,6 @@ wr_du (struct coff_ofile *p, struct coff_sfile *sfile, int n) highest[i] = 0; } - /* Look through all the symbols and try and work out the extents in this - source file. */ -#if 0 - for (symbol = sfile->scope->vars_head; - symbol; - symbol = symbol->next) - { - if (symbol->type->type == coff_secdef_type) - { - unsigned int low = symbol->where->offset; - unsigned int high = symbol->where->offset + symbol->type->size - 1; - struct coff_section *section = symbol->where->section; - - int sn = section->number; - if (low < lowest[sn]) - lowest[sn] = low; - if (high > highest[sn]) - highest[sn] = high; - } - } - - for (i = 0; i < du.sections; i++) - { - if (highest[i] == 0) - lowest[i] = highest[i] = incit; - - du.san[used] = i; - du.length[used] = highest[i] - lowest[i]; - du.address[used] = bfd_get_file_flags (abfd) & EXEC_P ? lowest[i] : 0; - - if (debug) - { - printf (" section %6s 0x%08x..0x%08x\n", - p->sections[i + 1].name, - lowest[i], - highest[i]); - } - used++; - } -#endif - lim = du.sections; for (j = 0; j < lim; j++) { @@ -1328,22 +1278,8 @@ wr_dus (struct coff_ofile *p ATTRIBUTE_UNUSED, struct coff_sfile *sfile) dus.spare = nints (dus.ns); dus.ndir = 0; /* Find the filenames. */ -#if 0 - i = 0; - - for (sfile = p->source_head; - sfile; - sfile = sfile->next) - { - dus.drb[i] = 0; - dus.spare[i] = 0; - dus.fname[i] = sfile->name; - i++; - } -#else dus.drb[0] = 0; dus.fname[0] = sfile->name; -#endif sysroff_swap_dus_out (file, &dus); @@ -1362,69 +1298,6 @@ static void wr_dln (struct coff_ofile *p ATTRIBUTE_UNUSED, struct coff_sfile *sfile, int n ATTRIBUTE_UNUSED) { -#if 0 - if (n == 0) - { - /* Count up all the linenumbers */ - struct coff_symbol *sy; - int lc = 0; - struct IT_dln dln; - - int idx; - - for (sy = p->symbol_list_head; - sy; - sy = sy->next_in_ofile_list) - { - struct coff_type *t = sy->type; - if (t->type == coff_function_type) - { - struct coff_line *l = t->u.function.lines; - lc += l->nlines; - } - } - - dln.sfn = nints (lc); - dln.sln = nints (lc); - dln.lln = nints (lc); - dln.section = nints (lc); - - dln.from_address = nints (lc); - dln.to_address = nints (lc); - - - dln.neg = 0x1001; - - dln.nln = lc; - - /* Run through once more and fill up the structure */ - idx = 0; - for (sy = p->symbol_list_head; - sy; - sy = sy->next_in_ofile_list) - { - if (sy->type->type == coff_function_type) - { - int i; - struct coff_line *l = sy->type->u.function.lines; - for (i = 0; i < l->nlines; i++) - { - dln.section[idx] = sy->where->section->number; - dln.sfn[idx] = n; - dln.sln[idx] = l->lines[i]; - dln.from_address[idx] = l->addresses[i]; - if (idx) - dln.to_address[idx - 1] = dln.from_address[idx]; - idx++; - } - } - n++; - } - sysroff_swap_dln_out (file, &dln); - } - -#endif -#if 1 /* Count up all the linenumbers */ struct coff_symbol *sy; @@ -1491,7 +1364,6 @@ wr_dln (struct coff_ofile *p ATTRIBUTE_UNUSED, struct coff_sfile *sfile, } if (lc) sysroff_swap_dln_out (file, &dln); -#endif } /* Write the global symbols out to the debug info. */ @@ -1692,16 +1564,9 @@ wr_sc (struct coff_ofile *ptr, struct coff_sfile *sfile) { sc.contents = CONTENTS_CODE; } -#if 0 - /* NEW */ - if (sc.length) - { -#endif - sysroff_swap_sc_out (file, &sc); - scount++; -#if 0 - } -#endif + + sysroff_swap_sc_out (file, &sc); + scount++; } return scount; } @@ -1856,9 +1721,10 @@ show_usage (FILE *file, int status) fprintf (file, _("Usage: %s [option(s)] in-file [out-file]\n"), program_name); fprintf (file, _("Convert a COFF object file into a SYSROFF object file\n")); fprintf (file, _(" The options are:\n\ - -q --quick (Obsolete - ignoerd)\n\ + -q --quick (Obsolete - ignored)\n\ -n --noprescan Do not perform a scan to convert commons into defs\n\ -d --debug Display information about what is being done\n\ + @ Read options from \n\ -h --help Display this information\n\ -v --version Print the program's version number\n")); @@ -1896,6 +1762,8 @@ main (int ac, char **av) program_name = av[0]; xmalloc_set_program_name (program_name); + expandargv (&ac, &av); + while ((opt = getopt_long (ac, av, "dHhVvqn", long_options, (int *) NULL)) != EOF) diff --git a/contrib/binutils/binutils/stabs.c b/contrib/binutils/binutils/stabs.c index 7af10ef54fa..879a3e2c7a7 100644 --- a/contrib/binutils/binutils/stabs.c +++ b/contrib/binutils/binutils/stabs.c @@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ /* This file contains code which parses stabs debugging information. The organization of this code is based on the gdb stabs reading @@ -203,6 +203,8 @@ static debug_type *stab_demangle_argtypes (void *, struct stab_handle *, const char *, bfd_boolean *, unsigned int); static debug_type *stab_demangle_v3_argtypes (void *, struct stab_handle *, const char *, bfd_boolean *); +static debug_type *stab_demangle_v3_arglist + (void *, struct stab_handle *, struct demangle_component *, bfd_boolean *); static debug_type stab_demangle_v3_arg (void *, struct stab_handle *, struct demangle_component *, debug_type, bfd_boolean *); @@ -4319,7 +4321,8 @@ stab_demangle_template (struct stab_demangle_info *minfo, const char **pp, { unsigned int len; - if (! stab_demangle_get_count (pp, &len)) + len = stab_demangle_count (pp); + if (len == 0) { stab_bad_demangle (orig); return FALSE; @@ -5073,7 +5076,6 @@ stab_demangle_v3_argtypes (void *dhandle, struct stab_handle *info, { struct demangle_component *dc; void *mem; - unsigned int alloc, count; debug_type *pargs; dc = cplus_demangle_v3_components (physname, DMGL_PARAMS | DMGL_ANSI, &mem); @@ -5093,13 +5095,35 @@ stab_demangle_v3_argtypes (void *dhandle, struct stab_handle *info, return NULL; } + pargs = stab_demangle_v3_arglist (dhandle, info, + dc->u.s_binary.right->u.s_binary.right, + pvarargs); + + free (mem); + + return pargs; +} + +/* Demangle an argument list in a struct demangle_component tree. + Returns a DEBUG_TYPE_NULL terminated array of argument types, and + sets *PVARARGS to indicate whether this is a varargs function. */ + +static debug_type * +stab_demangle_v3_arglist (void *dhandle, struct stab_handle *info, + struct demangle_component *arglist, + bfd_boolean *pvarargs) +{ + struct demangle_component *dc; + unsigned int alloc, count; + debug_type *pargs; + alloc = 10; pargs = (debug_type *) xmalloc (alloc * sizeof *pargs); *pvarargs = FALSE; count = 0; - for (dc = dc->u.s_binary.right->u.s_binary.right; + for (dc = arglist; dc != NULL; dc = dc->u.s_binary.right) { @@ -5108,8 +5132,8 @@ stab_demangle_v3_argtypes (void *dhandle, struct stab_handle *info, if (dc->type != DEMANGLE_COMPONENT_ARGLIST) { - fprintf (stderr, _("Unexpected type in demangle tree\n")); - free (mem); + fprintf (stderr, _("Unexpected type in v3 arglist demangling\n")); + free (pargs); return NULL; } @@ -5122,7 +5146,7 @@ stab_demangle_v3_argtypes (void *dhandle, struct stab_handle *info, *pvarargs = TRUE; continue; } - free (mem); + free (pargs); return NULL; } @@ -5138,8 +5162,6 @@ stab_demangle_v3_argtypes (void *dhandle, struct stab_handle *info, pargs[count] = DEBUG_TYPE_NULL; - free (mem); - return pargs; } @@ -5173,12 +5195,12 @@ stab_demangle_v3_arg (void *dhandle, struct stab_handle *info, case DEMANGLE_COMPONENT_COMPLEX: case DEMANGLE_COMPONENT_IMAGINARY: case DEMANGLE_COMPONENT_VENDOR_TYPE: - case DEMANGLE_COMPONENT_FUNCTION_TYPE: case DEMANGLE_COMPONENT_ARRAY_TYPE: case DEMANGLE_COMPONENT_PTRMEM_TYPE: case DEMANGLE_COMPONENT_ARGLIST: default: - fprintf (stderr, _("Unrecognized demangle component\n")); + fprintf (stderr, _("Unrecognized demangle component %d\n"), + (int) dc->type); return NULL; case DEMANGLE_COMPONENT_NAME: @@ -5269,6 +5291,34 @@ stab_demangle_v3_arg (void *dhandle, struct stab_handle *info, return debug_make_reference_type (dhandle, dt); } + case DEMANGLE_COMPONENT_FUNCTION_TYPE: + { + debug_type *pargs; + bfd_boolean varargs; + + if (dc->u.s_binary.left == NULL) + { + /* In this case the return type is actually unknown. + However, I'm not sure this will ever arise in practice; + normally an unknown return type would only appear at + the top level, which is handled above. */ + dt = debug_make_void_type (dhandle); + } + else + dt = stab_demangle_v3_arg (dhandle, info, dc->u.s_binary.left, NULL, + NULL); + if (dt == NULL) + return NULL; + + pargs = stab_demangle_v3_arglist (dhandle, info, + dc->u.s_binary.right, + &varargs); + if (pargs == NULL) + return NULL; + + return debug_make_function_type (dhandle, dt, pargs, varargs); + } + case DEMANGLE_COMPONENT_BUILTIN_TYPE: { char *p; diff --git a/contrib/binutils/binutils/strings.c b/contrib/binutils/binutils/strings.c index 68c244cafbd..a04cb581eae 100644 --- a/contrib/binutils/binutils/strings.c +++ b/contrib/binutils/binutils/strings.c @@ -1,6 +1,6 @@ /* strings -- print the strings of printable characters in files Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, - 2002, 2003 Free Software Foundation, Inc. + 2002, 2003, 2004, 2005 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 @@ -14,8 +14,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ /* Usage: strings [options] file... @@ -67,6 +67,7 @@ #include "bucomm.h" #include "libiberty.h" #include "safe-ctype.h" +#include /* Some platforms need to put stdin into binary mode, to read binary files. */ @@ -104,6 +105,13 @@ typedef off64_t file_off; typedef off_t file_off; #define file_open(s,m) fopen(s, m) #endif +#ifdef HAVE_STAT64 +typedef struct stat64 statbuf; +#define file_stat(f,s) stat64(f, s) +#else +typedef struct stat statbuf; +#define file_stat(f,s) stat(f, s) +#endif /* Radix for printing addresses (must be 8, 10 or 16). */ static int address_radix; @@ -143,6 +151,15 @@ static struct option long_options[] = {NULL, 0, NULL, 0} }; +/* Records the size of a named file so that we + do not repeatedly run bfd_stat() on it. */ + +typedef struct +{ + const char * filename; + bfd_size_type filesize; +} filename_and_size_t; + static void strings_a_section (bfd *, asection *, void *); static bfd_boolean strings_object_file (const char *); static bfd_boolean strings_file (char *file); @@ -168,6 +185,9 @@ main (int argc, char **argv) program_name = argv[0]; xmalloc_set_program_name (program_name); + + expandargv (&argc, &argv); + string_min = -1; print_addresses = FALSE; print_filenames = FALSE; @@ -306,27 +326,62 @@ main (int argc, char **argv) return (exit_status); } -/* Scan section SECT of the file ABFD, whose printable name is FILE. - If it contains initialized data, - set `got_a_section' and print the strings in it. */ +/* Scan section SECT of the file ABFD, whose printable name is in + ARG->filename and whose size might be in ARG->filesize. If it + contains initialized data set `got_a_section' and print the + strings in it. + + FIXME: We ought to be able to return error codes/messages for + certain conditions. */ static void -strings_a_section (bfd *abfd, asection *sect, void *filearg) +strings_a_section (bfd *abfd, asection *sect, void *arg) { - const char *file = (const char *) filearg; + filename_and_size_t * filename_and_sizep; + bfd_size_type *filesizep; + bfd_size_type sectsize; + void *mem; + + if ((sect->flags & DATA_FLAGS) != DATA_FLAGS) + return; - if ((sect->flags & DATA_FLAGS) == DATA_FLAGS) + sectsize = bfd_get_section_size (sect); + + if (sectsize <= 0) + return; + + /* Get the size of the file. This might have been cached for us. */ + filename_and_sizep = (filename_and_size_t *) arg; + filesizep = & filename_and_sizep->filesize; + + if (*filesizep == 0) { - bfd_size_type sz = bfd_get_section_size_before_reloc (sect); - void *mem = xmalloc (sz); + struct stat st; + + if (bfd_stat (abfd, &st)) + return; - if (bfd_get_section_contents (abfd, sect, mem, (file_ptr) 0, sz)) - { - got_a_section = TRUE; - print_strings (file, (FILE *) NULL, sect->filepos, 0, sz, mem); - } - free (mem); + /* Cache the result so that we do not repeatedly stat this file. */ + *filesizep = st.st_size; } + + /* Compare the size of the section against the size of the file. + If the section is bigger then the file must be corrupt and + we should not try dumping it. */ + if (sectsize >= *filesizep) + return; + + mem = xmalloc (sectsize); + + if (bfd_get_section_contents (abfd, sect, mem, (file_ptr) 0, sectsize)) + { + got_a_section = TRUE; + + print_strings (filename_and_sizep->filename, NULL, sect->filepos, + 0, sectsize, mem); + } + + free (mem); } /* Scan all of the sections in FILE, and print the strings @@ -338,7 +393,10 @@ strings_a_section (bfd *abfd, asection *sect, void *filearg) static bfd_boolean strings_object_file (const char *file) { - bfd *abfd = bfd_openr (file, target); + filename_and_size_t filename_and_size; + bfd *abfd; + + abfd = bfd_openr (file, target); if (abfd == NULL) /* Treat the file as a non-object file. */ @@ -354,7 +412,9 @@ strings_object_file (const char *file) } got_a_section = FALSE; - bfd_map_over_sections (abfd, strings_a_section, (void *) file); + filename_and_size.filename = file; + filename_and_size.filesize = 0; + bfd_map_over_sections (abfd, strings_a_section, & filename_and_size); if (!bfd_close (abfd)) { @@ -370,8 +430,17 @@ strings_object_file (const char *file) static bfd_boolean strings_file (char *file) { - if (get_file_size (file) < 1) - return FALSE; + statbuf st; + + if (file_stat (file, &st) < 0) + { + if (errno == ENOENT) + non_fatal (_("'%s': No such file"), file); + else + non_fatal (_("Warning: could not locate '%s'. reason: %s"), + file, strerror (errno)); + return FALSE; + } /* If we weren't told to scan the whole file, try to open it as an object file and only look at @@ -430,7 +499,12 @@ get_char (FILE *stream, file_off *address, int *magiccount, char **magic) { if (stream == NULL) return EOF; -#ifdef HAVE_GETC_UNLOCKED + + /* Only use getc_unlocked if we found a declaration for it. + Otherwise, libc is not thread safe by default, and we + should not use it. */ + +#if defined(HAVE_GETC_UNLOCKED) && HAVE_DECL_GETC_UNLOCKED c = getc_unlocked (stream); #else c = getc (stream); @@ -512,7 +586,7 @@ print_strings (const char *filename, FILE *stream, file_off address, } /* We found a run of `string_min' graphic characters. Print up - to the next non-graphic character. */ + to the next non-graphic character. */ if (print_filenames) printf ("%s: ", filename); @@ -557,7 +631,8 @@ print_strings (const char *filename, FILE *stream, file_off address, #else # if !BFD_HOST_64BIT_LONG if (start != (unsigned long) start) - printf ("%lx%8.8lx ", start >> 32, start & 0xffffffff); + printf ("%lx%8.8lx ", (unsigned long) (start >> 32), + (unsigned long) (start & 0xffffffff)); else # endif #endif @@ -637,11 +712,12 @@ usage (FILE *stream, int status) -f --print-file-name Print the name of the file before each string\n\ -n --bytes=[number] Locate & print any NUL-terminated sequence of at\n\ - least [number] characters (default 4).\n\ - -t --radix={o,x,d} Print the location of the string in base 8, 10 or 16\n\ + -t --radix={o,d,x} Print the location of the string in base 8, 10 or 16\n\ -o An alias for --radix=o\n\ -T --target= Specify the binary file format\n\ -e --encoding={s,S,b,l,B,L} Select character size and endianness:\n\ s = 7-bit, S = 8-bit, {b,l} = 16-bit, {B,L} = 32-bit\n\ + @ Read options from \n\ -h --help Display this information\n\ -v --version Print the program's version number\n")); list_supported_targets (program_name, stream); diff --git a/contrib/binutils/binutils/sysdump.c b/contrib/binutils/binutils/sysdump.c index a1df1e05b7a..ec19472558f 100644 --- a/contrib/binutils/binutils/sysdump.c +++ b/contrib/binutils/binutils/sysdump.c @@ -1,5 +1,5 @@ /* Sysroff object format dumper. - Copyright 1994, 1995, 1998, 1999, 2000, 2001, 2002, 2003 + Copyright 1994, 1995, 1998, 1999, 2000, 2001, 2002, 2003, 2005 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -16,8 +16,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ /* Written by Steve Chamberlain . @@ -54,16 +54,9 @@ static void derived_type (void); static void module (void); static void show_usage (FILE *, int); -extern char *getCHARS (unsigned char *, int *, int, int); -extern int fillup (char *); -extern barray getBARRAY (unsigned char *, int *, int, int); -extern int getINT (unsigned char *, int *, int, int); -extern int getBITS (char *, int *, int, int); -extern void sysroff_swap_tr_in (void); -extern void sysroff_print_tr_out (void); extern int main (int, char **); -char * +static char * getCHARS (unsigned char *ptr, int *idx, int size, int max) { int oc = *idx / 8; @@ -120,8 +113,8 @@ dh (unsigned char *ptr, int size) } } -int -fillup (char *ptr) +static int +fillup (unsigned char *ptr) { int size; int sum; @@ -143,7 +136,7 @@ fillup (char *ptr) return size - 1; } -barray +static barray getBARRAY (unsigned char *ptr, int *idx, int dsize ATTRIBUTE_UNUSED, int max ATTRIBUTE_UNUSED) { @@ -161,7 +154,7 @@ getBARRAY (unsigned char *ptr, int *idx, int dsize ATTRIBUTE_UNUSED, return res; } -int +static int getINT (unsigned char *ptr, int *idx, int size, int max) { int n = 0; @@ -197,8 +190,8 @@ getINT (unsigned char *ptr, int *idx, int size, int max) return n; } -int -getBITS (char *ptr, int *idx, int size, int max) +static int +getBITS (unsigned char *ptr, int *idx, int size, int max) { int byte = *idx / 8; int bit = *idx % 8; @@ -262,16 +255,16 @@ pbarray (barray *y) #define IT_tr_CODE 0x7f -void +static void sysroff_swap_tr_in (void) { - char raw[255]; + unsigned char raw[255]; memset (raw, 0, 255); fillup (raw); } -void +static void sysroff_print_tr_out (void) { itheader ("tr", IT_tr_CODE); @@ -515,48 +508,6 @@ opt (int x) return getone (x); } -#if 0 - -/* This is no longer used. */ - -static void -unit_info_list (void) -{ - while (opt (IT_un_CODE)) - { - getone (IT_us_CODE); - - while (getone (IT_sc_CODE)) - getone (IT_ss_CODE); - - while (getone (IT_er_CODE)) - ; - - while (getone (IT_ed_CODE)) - ; - } -} - -#endif - -#if 0 - -/* This is no longer used. */ - -static void -object_body_list (void) -{ - while (getone (IT_sh_CODE)) - { - while (getone (IT_ob_CODE)) - ; - while (getone (IT_rl_CODE)) - ; - } -} - -#endif - static void must (int x) { @@ -649,45 +600,6 @@ derived_type (void) tab (-1, ""); } -#if 0 - -/* This is no longer used. */ - -static void -program_structure (void) -{ - tab (1, "PROGRAM STRUCTURE"); - while (opt (IT_dps_CODE)) - { - must (IT_dso_CODE); - opt (IT_dss_CODE); - dump_symbol_info (); - must (IT_dps_CODE); - } - tab (-1, ""); -} - -#endif - -#if 0 - -/* This is no longer used. */ - -static void -debug_list (void) -{ - tab (1, "DEBUG LIST"); - - must (IT_du_CODE); - opt (IT_dus_CODE); - program_structure (); - must (IT_dln_CODE); - - tab (-1, ""); -} - -#endif - static void module (void) { @@ -705,17 +617,6 @@ module (void) } while (getone (c) && c != IT_tr_CODE); -#if 0 - must (IT_cs_CODE); - must (IT_hd_CODE); - opt (IT_hs_CODE); - - unit_info_list (); - object_body_list (); - debug_list (); - - must (IT_tr_CODE); -#endif tab (-1, ""); c = getc (file); @@ -772,6 +673,8 @@ main (int ac, char **av) program_name = av[0]; xmalloc_set_program_name (program_name); + expandargv (&ac, &av); + while ((opt = getopt_long (ac, av, "HhVv", long_options, (int *) NULL)) != EOF) { switch (opt) diff --git a/contrib/binutils/binutils/sysinfo.y b/contrib/binutils/binutils/sysinfo.y index bf19263c5d1..a7077480bc4 100644 --- a/contrib/binutils/binutils/sysinfo.y +++ b/contrib/binutils/binutils/sysinfo.y @@ -1,4 +1,4 @@ -/* Copyright 2001, 2003 Free Software Foundation, Inc. +/* Copyright 2001, 2003, 2005 Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support (steve@cygnus.com). This file is part of GNU binutils. @@ -15,28 +15,24 @@ 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. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ %{ #include #include -extern char *word; -extern char writecode; -extern int number; -extern int unit; -char nice_name[1000]; -char *it; -int sofar; -int width; -int code; -char * repeat; -char *oldrepeat; -char *name; -int rdepth; -char *loop [] = {"","n","m","/*BAD*/"}; -char *names[] = {" ","[n]","[n][m]"}; -char *pnames[]= {"","*","**"}; +static char writecode; +static char *it; +static int code; +static char * repeat; +static char *oldrepeat; +static char *name; +static int rdepth; +static char *names[] = {" ","[n]","[n][m]"}; +static char *pnames[]= {"","*","**"}; + +static int yyerror (char *s); +extern int yylex (void); %} @@ -117,7 +113,7 @@ it: printf("void sysroff_swap_%s_in(ptr)\n",$2); printf("struct IT_%s *ptr;\n", it); printf("{\n"); - printf("char raw[255];\n"); + printf("unsigned char raw[255];\n"); printf("\tint idx = 0 ;\n"); printf("\tint size;\n"); printf("memset(raw,0,255);\n"); @@ -129,7 +125,7 @@ it: printf("FILE * file;\n"); printf("struct IT_%s *ptr;\n", it); printf("{\n"); - printf("\tchar raw[255];\n"); + printf("\tunsigned char raw[255];\n"); printf("\tint idx = 16 ;\n"); printf("\tmemset (raw, 0, 255);\n"); printf("\tcode = IT_%s_CODE;\n", it); @@ -412,7 +408,6 @@ enum_list: -c write code to print info in human form */ int yydebug; -char writecode; int main (int ac, char **av) @@ -431,7 +426,7 @@ if (writecode == 'd') return 0; } -int +static int yyerror (char *s) { fprintf(stderr, "%s\n" , s); diff --git a/contrib/binutils/binutils/syslex.l b/contrib/binutils/binutils/syslex.l index ffaf4fad2d6..3a9306c40b5 100644 --- a/contrib/binutils/binutils/syslex.l +++ b/contrib/binutils/binutils/syslex.l @@ -1,31 +1,40 @@ %{ -/* Copyright 2001, 2003 Free Software Foundation, Inc. +/* Copyright 2001, 2003, 2005 Free Software Foundation, Inc. -This file is part of GLD, the Gnu Linker. +This file is part of GNU Binutils. -GLD is free software; you can redistribute it and/or modify +This program is free software; you can redistribute 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. -GLD is distributed in the hope that it will be useful, +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GLD; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ +Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA +02110-1301, USA. */ +#include "config.h" +#ifdef HAVE_STRING_H +#include +#else +#ifdef HAVE_STRINGS_H +#include +#endif +#endif #include "sysinfo.h" -char *word; -int number; -int unit; + +#define YY_NO_UNPUT #ifndef yywrap static int yywrap (void) { return 1; } #endif + +extern int yylex (void); %} %% "(" { return '(';} @@ -37,9 +46,9 @@ static int yywrap (void) { return 1; } "\t" { ; } "\n" { ; } "\""[^\"]*"\"" { -yylval.s = malloc(strlen (yytext)); -strcpy(yylval.s, yytext+1); -yylval.s[strlen(yylval.s)-1] = 0; + yylval.s = malloc (yyleng - 1); + memcpy (yylval.s, yytext + 1, yyleng - 2); + yylval.s[yyleng - 2] = '\0'; return NAME; } diff --git a/contrib/binutils/binutils/unwind-ia64.c b/contrib/binutils/binutils/unwind-ia64.c index 2e7e726e4bf..c104e72bbc1 100644 --- a/contrib/binutils/binutils/unwind-ia64.c +++ b/contrib/binutils/binutils/unwind-ia64.c @@ -1,5 +1,5 @@ /* unwind-ia64.c -- utility routines to dump IA-64 unwind info for readelf. - Copyright 2000, 2001, 2003 Free Software Foundation, Inc. + Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Contributed by David Mosberger-Tang This file is part of GNU Binutils. @@ -16,7 +16,7 @@ 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. */ +Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "unwind-ia64.h" #include @@ -371,7 +371,7 @@ typedef bfd_vma unw_word; #define UNW_DEC_SPILL_SPREL(fmt, t, abreg, spoff, arg) \ do \ { \ - char regname[10]; \ + char regname[20]; \ \ unw_print_abreg (regname, abreg); \ printf ("\t%s:spill_sprel(reg=%s,t=%lu,spoff=0x%lx)\n", \ @@ -382,7 +382,7 @@ typedef bfd_vma unw_word; #define UNW_DEC_SPILL_PSPREL(fmt, t, abreg, pspoff, arg) \ do \ { \ - char regname[10]; \ + char regname[20]; \ \ unw_print_abreg (regname, abreg); \ printf ("\t%s:spill_psprel(reg=%s,t=%lu,pspoff=0x10-0x%lx)\n", \ @@ -393,7 +393,7 @@ typedef bfd_vma unw_word; #define UNW_DEC_RESTORE(fmt, t, abreg, arg) \ do \ { \ - char regname[10]; \ + char regname[20]; \ \ unw_print_abreg (regname, abreg); \ printf ("\t%s:restore(t=%lu,reg=%s)\n", \ @@ -404,7 +404,7 @@ typedef bfd_vma unw_word; #define UNW_DEC_SPILL_REG(fmt, t, abreg, x, ytreg, arg) \ do \ { \ - char abregname[10], tregname[10]; \ + char abregname[20], tregname[20]; \ \ unw_print_abreg (abregname, abreg); \ unw_print_xyreg (tregname, x, ytreg); \ diff --git a/contrib/binutils/binutils/unwind-ia64.h b/contrib/binutils/binutils/unwind-ia64.h index 3b6ab2256ed..c2fb9b93943 100644 --- a/contrib/binutils/binutils/unwind-ia64.h +++ b/contrib/binutils/binutils/unwind-ia64.h @@ -16,7 +16,7 @@ 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. */ +Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "elf/ia64.h" #include "ansidecl.h" diff --git a/contrib/binutils/binutils/version.c b/contrib/binutils/binutils/version.c index f965619d41a..2843e69f06b 100644 --- a/contrib/binutils/binutils/version.c +++ b/contrib/binutils/binutils/version.c @@ -1,5 +1,5 @@ /* version.c -- binutils version information - Copyright 1991, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 + Copyright 1991, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include #include "bfd.h" @@ -32,7 +32,7 @@ print_version (const char *name) /* This output is intended to follow the GNU standards document. */ /* xgettext:c-format */ printf ("GNU %s %s\n", name, BFD_VERSION_STRING); - printf (_("Copyright 2004 Free Software Foundation, Inc.\n")); + printf (_("Copyright 2005 Free Software Foundation, Inc.\n")); printf (_("\ 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")); diff --git a/contrib/binutils/binutils/wrstabs.c b/contrib/binutils/binutils/wrstabs.c index 0d301f6a249..13f01dac725 100644 --- a/contrib/binutils/binutils/wrstabs.c +++ b/contrib/binutils/binutils/wrstabs.c @@ -1,5 +1,5 @@ /* wrstabs.c -- Output stabs debugging information - Copyright 1996, 1997, 1998, 2000, 2001, 2002, 2003 + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2006 Free Software Foundation, Inc. Written by Ian Lance Taylor . @@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ /* This file contains code which writes out stabs debugging information. */ @@ -480,8 +480,10 @@ write_stabs_in_sections_debugging_info (bfd *abfd, void *dhandle, /* Reserve 1 byte for a null byte. */ info.strings_size = 1; - if (! bfd_hash_table_init (&info.strhash.table, string_hash_newfunc) - || ! bfd_hash_table_init (&info.typedef_hash.table, string_hash_newfunc)) + if (!bfd_hash_table_init (&info.strhash.table, string_hash_newfunc, + sizeof (struct string_hash_entry)) + || !bfd_hash_table_init (&info.typedef_hash.table, string_hash_newfunc, + sizeof (struct string_hash_entry))) { non_fatal ("bfd_hash_table_init_failed: %s", bfd_errmsg (bfd_get_error ())); @@ -1867,7 +1869,7 @@ stab_tag_type (void *p, const char *name, unsigned int id, { struct stab_write_handle *info = (struct stab_write_handle *) p; long index; - unsigned int size; + unsigned int size = 0; index = stab_get_struct_index (info, name, id, kind, &size); if (index < 0) diff --git a/contrib/binutils/config-ml.in b/contrib/binutils/config-ml.in index b2e4ea9cf97..937273173c0 100644 --- a/contrib/binutils/config-ml.in +++ b/contrib/binutils/config-ml.in @@ -1,7 +1,7 @@ # Configure fragment invoked in the post-target section for subdirs # wanting multilib support. # -# Copyright (C) 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Copyright (C) 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 # Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify @@ -16,8 +16,8 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -546,6 +546,9 @@ multi-do: flags=`echo $$i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; \ if (cd ../$${dir}/$${lib}; $(MAKE) $(FLAGS_TO_PASS) \ CFLAGS="$(CFLAGS) $${flags}" \ + FCFLAGS="$(FCFLAGS) $${flags}" \ + FFLAGS="$(FFLAGS) $${flags}" \ + ADAFLAGS="$(ADAFLAGS) $${flags}" \ prefix="$(prefix)" \ exec_prefix="$(exec_prefix)" \ GCJFLAGS="$(GCJFLAGS) $${flags}" \ @@ -777,12 +780,14 @@ if [ -n "${multidirs}" ] && [ -z "${ml_norecursion}" ]; then break fi done - ml_config_env='CC="${CC_}$flags" CXX="${CXX_}$flags" GCJ="${GCJ_}$flags"' + ml_config_env='CC="${CC_}$flags" CXX="${CXX_}$flags" F77="${F77_}$flags" GCJ="${GCJ_}$flags" GFORTRAN="${GFORTRAN_}$flags"' if [ "${with_target_subdir}" = "." ]; then CC_=$CC' ' CXX_=$CXX' ' + F77_=$F77' ' GCJ_=$GCJ' ' + GFORTRAN_=$GFORTRAN' ' else # Create a regular expression that matches any string as long # as ML_POPDIR. @@ -811,6 +816,18 @@ if [ -n "${multidirs}" ] && [ -z "${ml_norecursion}" ]; then esac done + F77_= + for arg in ${F77}; do + case $arg in + -[BIL]"${ML_POPDIR}"/*) + F77_="${F77_}"`echo "X${arg}" | sed -n "s/X\\(-[BIL]${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X-[BIL]${popdir_rx}\\(.*\\)/\\1/p"`' ' ;; + "${ML_POPDIR}"/*) + F77_="${F77_}"`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`' ' ;; + *) + F77_="${F77_}${arg} " ;; + esac + done + GCJ_= for arg in ${GCJ}; do case $arg in @@ -823,6 +840,18 @@ if [ -n "${multidirs}" ] && [ -z "${ml_norecursion}" ]; then esac done + GFORTRAN_= + for arg in ${GFORTRAN}; do + case $arg in + -[BIL]"${ML_POPDIR}"/*) + GFORTRAN_="${GFORTRAN_}"`echo "X${arg}" | sed -n "s/X\\(-[BIL]${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X-[BIL]${popdir_rx}\\(.*\\)/\\1/p"`' ' ;; + "${ML_POPDIR}"/*) + GFORTRAN_="${GFORTRAN_}"`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`' ' ;; + *) + GFORTRAN_="${GFORTRAN_}${arg} " ;; + esac + done + if test "x${LD_LIBRARY_PATH+set}" = xset; then LD_LIBRARY_PATH_= for arg in `echo "$LD_LIBRARY_PATH" | tr ':' ' '`; do diff --git a/contrib/binutils/config.guess b/contrib/binutils/config.guess index 00ccf89e18b..17690aea342 100755 --- a/contrib/binutils/config.guess +++ b/contrib/binutils/config.guess @@ -1,9 +1,9 @@ #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. -timestamp='2004-02-16' +timestamp='2006-01-02' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -17,13 +17,15 @@ timestamp='2004-02-16' # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. + # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. @@ -53,7 +55,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO @@ -66,11 +68,11 @@ Try \`$me --help' for more information." while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) - echo "$timestamp" ; exit 0 ;; + echo "$timestamp" ; exit ;; --version | -v ) - echo "$version" ; exit 0 ;; + echo "$version" ; exit ;; --help | --h* | -h ) - echo "$usage"; exit 0 ;; + echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. @@ -123,7 +125,7 @@ case $CC_FOR_BUILD,$HOST_CC,$CC in ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ;' +esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) @@ -196,68 +198,32 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" - exit 0 ;; - amd64:OpenBSD:*:*) - echo x86_64-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - amiga:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - arc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - cats:OpenBSD:*:*) - echo arm-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - hp300:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mac68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - macppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme88k:OpenBSD:*:*) - echo m88k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvmeppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - pegasos:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - pmax:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sgi:OpenBSD:*:*) - echo mipseb-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sun3:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - wgrisc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; + exit ;; *:OpenBSD:*:*) - echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} - exit 0 ;; + exit ;; + *:SolidBSD:*:*) + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; macppc:MirBSD:*:*) echo powerppc-unknown-mirbsd${UNAME_RELEASE} - exit 0 ;; + exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} - exit 0 ;; + exit ;; alpha:OSF1:*:*) - if test $UNAME_RELEASE = "V4.0"; then + case $UNAME_RELEASE in + *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - fi + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU @@ -295,45 +261,49 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac + # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit 0 ;; - Alpha*:OpenVMS:*:*) - echo alpha-hp-vms - exit 0 ;; + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix - exit 0 ;; + exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 - exit 0 ;; + exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 - exit 0;; + exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos - exit 0 ;; + exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos - exit 0 ;; + exit ;; *:OS/390:*:*) echo i370-ibm-openedition - exit 0 ;; + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; *:OS400:*:*) echo powerpc-ibm-os400 - exit 0 ;; + exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} - exit 0;; + exit ;; + arm:riscos:*:*|arm:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp - exit 0;; + exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then @@ -341,32 +311,32 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in else echo pyramid-pyramid-bsd fi - exit 0 ;; + exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 - exit 0 ;; + exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 - exit 0 ;; - DRS?6000:UNIX_SV:4.2*:7*) + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7 && exit 0 ;; + sparc) echo sparc-icl-nx7; exit ;; esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; i86pc:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) @@ -375,10 +345,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit 0 ;; + exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} - exit 0 ;; + exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 @@ -390,10 +360,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in echo sparc-sun-sunos${UNAME_RELEASE} ;; esac - exit 0 ;; + exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} - exit 0 ;; + exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor @@ -404,40 +374,40 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} - exit 0 ;; + exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} - exit 0 ;; + exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 - exit 0 ;; + exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} - exit 0 ;; + exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} - exit 0 ;; + exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} - exit 0 ;; + exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c @@ -461,32 +431,33 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in exit (-1); } EOF - $CC_FOR_BUILD -o $dummy $dummy.c \ - && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && exit 0 + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} - exit 0 ;; + exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax - exit 0 ;; + exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax - exit 0 ;; + exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax - exit 0 ;; + exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix - exit 0 ;; + exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 - exit 0 ;; + exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 - exit 0 ;; + exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 - exit 0 ;; + exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` @@ -502,29 +473,29 @@ EOF else echo i586-dg-dgux${UNAME_RELEASE} fi - exit 0 ;; + exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 - exit 0 ;; + exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 - exit 0 ;; + exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 - exit 0 ;; + exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd - exit 0 ;; + exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit 0 ;; + exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix - exit 0 ;; + exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` @@ -532,7 +503,7 @@ EOF IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit 0 ;; + exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build @@ -547,14 +518,18 @@ EOF exit(0); } EOF - $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 - echo rs6000-ibm-aix3.2.5 + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi - exit 0 ;; + exit ;; *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then @@ -568,28 +543,28 @@ EOF IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit 0 ;; + exit ;; *:AIX:*:*) echo rs6000-ibm-aix - exit 0 ;; + exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 - exit 0 ;; + exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit 0 ;; # report: romp-ibm BSD 4.3 + exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx - exit 0 ;; + exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 - exit 0 ;; + exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd - exit 0 ;; + exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 - exit 0 ;; + exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in @@ -651,9 +626,19 @@ EOF esac if [ ${HP_ARCH} = "hppa2.0w" ] then - # avoid double evaluation of $set_cc_for_build - test -n "$CC_FOR_BUILD" || eval $set_cc_for_build - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else @@ -661,11 +646,11 @@ EOF fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit 0 ;; + exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} - exit 0 ;; + exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c @@ -693,163 +678,171 @@ EOF exit (0); } EOF - $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 - exit 0 ;; + exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd - exit 0 ;; + exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd - exit 0 ;; + exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix - exit 0 ;; + exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf - exit 0 ;; + exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf - exit 0 ;; + exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi - exit 0 ;; + exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites - exit 0 ;; + exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd - exit 0 ;; + exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi - exit 0 ;; + exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd - exit 0 ;; + exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd - exit 0 ;; + exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd - exit 0 ;; + exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; *:UNICOS/mp:*:*) - echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit 0 ;; + exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit 0 ;; + exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit 0 ;; + exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; + exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; + exit ;; *:FreeBSD:*:*) - # Determine whether the default compiler uses glibc. - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - #if __GLIBC__ >= 2 - LIBC=gnu - #else - LIBC= - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - # GNU/KFreeBSD systems have a "k" prefix to indicate we are using - # FreeBSD's kernel, but not the complete OS. - case ${LIBC} in gnu) kernel_only='k' ;; esac - echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} - exit 0 ;; + case ${UNAME_MACHINE} in + pc98) + echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin - exit 0 ;; + exit ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 - exit 0 ;; + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 - exit 0 ;; - x86:Interix*:[34]*) + exit ;; + x86:Interix*:[345]*) echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' - exit 0 ;; + exit ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks - exit 0 ;; + exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix - exit 0 ;; + exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin - exit 0 ;; + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin - exit 0 ;; + exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit 0 ;; + exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu - exit 0 ;; + exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix - exit 0 ;; + exit ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu - exit 0 ;; + exit ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux-gnu + exit ;; + frv:Linux:*:*) + echo frv-unknown-linux-gnu + exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c @@ -866,8 +859,8 @@ EOF #endif #endif EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '/^CPU/{s: ::g;p;}'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; mips64:Linux:*:*) eval $set_cc_for_build @@ -885,15 +878,18 @@ EOF #endif #endif EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '/^CPU/{s: ::g;p;}'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; + or32:Linux:*:*) + echo or32-unknown-linux-gnu + exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu - exit 0 ;; + exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu - exit 0 ;; + exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; @@ -907,7 +903,7 @@ EOF objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} - exit 0 ;; + exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in @@ -915,25 +911,28 @@ EOF PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac - exit 0 ;; + exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu - exit 0 ;; + exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux - exit 0 ;; + exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-gnu + exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu - exit 0 ;; + exit ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent @@ -951,15 +950,15 @@ EOF ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit 0 ;; + exit ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" - exit 0 ;; + exit ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" - exit 0 ;; + exit ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build @@ -976,7 +975,7 @@ EOF LIBC=gnulibc1 # endif #else - #ifdef __INTEL_COMPILER + #if defined(__INTEL_COMPILER) || defined(__PGI) LIBC=gnu #else LIBC=gnuaout @@ -986,16 +985,19 @@ EOF LIBC=dietlibc #endif EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 - test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '/^LIBC/{s: ::g;p;}'`" + test x"${LIBC}" != x && { + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit + } + test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 - exit 0 ;; + exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... @@ -1003,27 +1005,27 @@ EOF # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit 0 ;; + exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx - exit 0 ;; + exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop - exit 0 ;; + exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos - exit 0 ;; - i*86:syllable:*:*) + exit ;; + i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable - exit 0 ;; + exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit 0 ;; + exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then @@ -1031,15 +1033,16 @@ EOF else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi - exit 0 ;; - i*86:*:5:[78]*) + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit 0 ;; + exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi - exit 0 ;; + exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv - exit 0 ;; + exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv - exit 0 ;; + exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix - exit 0 ;; - M68*:*:R3V[567]*:*) - test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0) + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4 && exit 0 ;; + && { echo i486-ncr-sysv4; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 - exit 0 ;; + exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} - exit 0 ;; + exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 - exit 0 ;; + exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 - exit 0 ;; + exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` @@ -1131,68 +1134,72 @@ EOF else echo ns32k-sni-sysv fi - exit 0 ;; + exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 - exit 0 ;; + exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 - exit 0 ;; + exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 - exit 0 ;; + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos - exit 0 ;; + exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} - exit 0 ;; + exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 - exit 0 ;; + exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi - exit 0 ;; + exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos - exit 0 ;; + exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos - exit 0 ;; + exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos - exit 0 ;; + exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} - exit 0 ;; + exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} - exit 0 ;; + exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} - exit 0 ;; + exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; + exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; + exit ;; *:Darwin:*:*) - case `uname -p` in - *86) UNAME_PROCESSOR=i686 ;; - powerpc) UNAME_PROCESSOR=powerpc ;; + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in + unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} - exit 0 ;; + exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then @@ -1200,22 +1207,25 @@ EOF UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit 0 ;; + exit ;; *:QNX:*:4*) echo i386-pc-qnx - exit 0 ;; + exit ;; + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} - exit 0 ;; + exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux - exit 0 ;; + exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv - exit 0 ;; + exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit 0 ;; + exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 @@ -1226,31 +1236,47 @@ EOF UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 - exit 0 ;; + exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 - exit 0 ;; + exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex - exit 0 ;; + exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 - exit 0 ;; + exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 - exit 0 ;; + exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 - exit 0 ;; + exit ;; *:ITS:*:*) echo pdp10-unknown-its - exit 0 ;; + exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} - exit 0 ;; + exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit 0 ;; + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 @@ -1282,7 +1308,7 @@ main () #endif #if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix"); exit (0); + printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) @@ -1371,11 +1397,12 @@ main () } EOF -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) @@ -1384,22 +1411,22 @@ then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd - exit 0 ;; + exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi - exit 0 ;; + exit ;; c34*) echo c34-convex-bsd - exit 0 ;; + exit ;; c38*) echo c38-convex-bsd - exit 0 ;; + exit ;; c4*) echo c4-convex-bsd - exit 0 ;; + exit ;; esac fi @@ -1410,7 +1437,9 @@ This script, last modified $timestamp, has failed to recognize the operating system you are using. It is advised that you download the most up to date version of the config scripts from - ftp://ftp.gnu.org/pub/gnu/config/ + http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess +and + http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub If the version you run ($0) is already up to date, please send the following data and any information you think might be diff --git a/contrib/binutils/config.if b/contrib/binutils/config.if deleted file mode 100644 index 2655bc3b56a..00000000000 --- a/contrib/binutils/config.if +++ /dev/null @@ -1,37 +0,0 @@ -#! /dev/null -# Don't call it directly. This shell script fragment is called to -# determine: -# -# 1. libstcxx_incdir: the interface name for libstdc++. -# - -# Get the top level src dir. -if [ -z "${topsrcdir}" -a -z "${top_srcdir}" ] -then - echo "Undefined top level src dir: topsrcdir and top_srcdir are empty" >&2 - exit 1 -fi - -if [ -n "${topsrcdir}" ] -then - if_topsrcdir=${topsrcdir} -else - if_topsrcdir=${top_srcdir} -fi - -# Set libstdcxx_incdir. -# This is the same as gcc/configure.in and libstdc++-v3/acinclude.m4. -if test -z "$gcc_version"; then - if test -z "${gcc_version_trigger}" \ - && test -f ${if_topsrcdir}/gcc/version.c; then - gcc_version_trigger=${if_topsrcdir}/gcc/version.c - fi - if test -f "${gcc_version_trigger}"; then - gcc_version_full=`grep version_string "${gcc_version_trigger}" | sed -e 's/.*"\([^"]*\)".*/\1/'` - else - gcc_version_full=`$CC -v 2>&1 | sed -n 's/^gcc version //p'` - fi - gcc_version=`echo ${gcc_version_full} | sed -e 's/\([^ ]*\) .*/\1/'` -fi -libstdcxx_incdir=c++/${gcc_version} - diff --git a/contrib/binutils/config.sub b/contrib/binutils/config.sub index d2e3557ac40..a4e8a94a335 100755 --- a/contrib/binutils/config.sub +++ b/contrib/binutils/config.sub @@ -1,9 +1,9 @@ #! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. -timestamp='2004-02-16' +timestamp='2006-01-02' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -21,14 +21,15 @@ timestamp='2004-02-16' # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. - +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. + # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # @@ -70,7 +71,7 @@ Report bugs and patches to ." version="\ GNU config.sub ($timestamp) -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO @@ -83,11 +84,11 @@ Try \`$me --help' for more information." while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) - echo "$timestamp" ; exit 0 ;; + echo "$timestamp" ; exit ;; --version | -v ) - echo "$version" ; exit 0 ;; + echo "$version" ; exit ;; --help | --h* | -h ) - echo "$usage"; exit 0 ;; + echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. @@ -99,7 +100,7 @@ while test $# -gt 0 ; do *local*) # First pass through any local machine types. echo $1 - exit 0;; + exit ;; * ) break ;; @@ -118,8 +119,9 @@ esac # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in - nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \ - kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) + nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ + uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; @@ -145,7 +147,7 @@ case $os in -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis) + -apple | -axis | -knuth | -cray) os= basic_machine=$1 ;; @@ -170,6 +172,10 @@ case $os in -hiux*) os=-hiuxwe2 ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` @@ -186,6 +192,10 @@ case $os in # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` @@ -231,13 +241,14 @@ case $basic_machine in | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ - | m32r | m68000 | m68k | m88k | mcore \ + | m32r | m32rle | m68000 | m68k | m88k | maxq | mb | microblaze | mcore \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ @@ -246,6 +257,7 @@ case $basic_machine in | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ @@ -254,23 +266,28 @@ case $basic_machine in | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ + | mt \ | msp430 \ | ns16k | ns32k \ - | openrisc | or32 \ + | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ - | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ + | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ - | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ + | sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b \ | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ - | x86 | xscale | xstormy16 | xtensa \ + | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; + m32c) + basic_machine=$basic_machine-unknown + ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown @@ -278,6 +295,9 @@ case $basic_machine in ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; + ms1) + basic_machine=mt-unknown + ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and @@ -298,9 +318,9 @@ case $basic_machine in | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* \ - | bs2000-* \ + | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ - | clipper-* | cydra-* \ + | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ @@ -308,9 +328,9 @@ case $basic_machine in | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ - | m32r-* \ + | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | mcore-* \ + | m88110-* | m88k-* | maxq-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ @@ -319,6 +339,7 @@ case $basic_machine in | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ @@ -326,27 +347,32 @@ case $basic_machine in | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ | msp430-* \ - | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ - | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ - | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ - | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ - | xtensa-* \ + | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \ + | xstormy16-* | xtensa-* \ | ymp-* \ | z8k-*) ;; + m32c-*) + ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) @@ -445,6 +471,10 @@ case $basic_machine in basic_machine=j90-cray os=-unicos ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; cr16c) basic_machine=cr16c-unknown os=-elf @@ -452,9 +482,16 @@ case $basic_machine in crds | unos) basic_machine=m68k-crds ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; da30 | da30-*) basic_machine=m68k-da30 ;; @@ -477,6 +514,10 @@ case $basic_machine in basic_machine=m88k-motorola os=-sysv3 ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx @@ -655,10 +696,6 @@ case $basic_machine in mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; - mmix*) - basic_machine=mmix-knuth - os=-mmixware - ;; monitor) basic_machine=m68k-rom68k os=-coff @@ -671,6 +708,9 @@ case $basic_machine in basic_machine=i386-pc os=-msdos ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; mvs) basic_machine=i370-ibm os=-mvs @@ -739,10 +779,6 @@ case $basic_machine in np1) basic_machine=np1-gould ;; - nv1) - basic_machine=nv1-cray - os=-unicosmp - ;; nsr-tandem) basic_machine=nsr-tandem ;; @@ -750,9 +786,8 @@ case $basic_machine in basic_machine=hppa1.1-oki os=-proelf ;; - or32 | or32-*) + openrisc | openrisc-*) basic_machine=or32-unknown - os=-coff ;; os400) basic_machine=powerpc-ibm @@ -783,6 +818,12 @@ case $basic_machine in pc532 | pc532-*) basic_machine=ns32k-pc532 ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; @@ -839,6 +880,10 @@ case $basic_machine in basic_machine=i586-unknown os=-pw32 ;; + rdos) + basic_machine=i386-pc + os=-rdos + ;; rom68k) basic_machine=m68k-rom68k os=-coff @@ -1025,6 +1070,10 @@ case $basic_machine in basic_machine=hppa1.1-winbond os=-proelf ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; xps | xps100) basic_machine=xps100-honeywell ;; @@ -1055,6 +1104,9 @@ case $basic_machine in romp) basic_machine=romp-ibm ;; + mmix) + basic_machine=mmix-knuth + ;; rs6000) basic_machine=rs6000-ibm ;; @@ -1071,13 +1123,10 @@ case $basic_machine in we32k) basic_machine=we32k-att ;; - sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) + sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; - sh64) - basic_machine=sh64-unknown - ;; - sparc | sparcv9 | sparcv9b) + sparc | sparcv8 | sparcv9 | sparcv9b) basic_machine=sparc-sun ;; cydra) @@ -1150,20 +1199,23 @@ case $os in | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*) + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1181,7 +1233,7 @@ case $os in os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) @@ -1290,6 +1342,9 @@ case $os in -kaos*) os=-kaos ;; + -zvmoe) + os=-zvmoe + ;; -none) ;; *) @@ -1367,9 +1422,15 @@ case $basic_machine in *-be) os=-beos ;; + *-haiku) + os=-haiku + ;; *-ibm) os=-aix ;; + *-knuth) + os=-mmixware + ;; *-wec) os=-proelf ;; @@ -1535,7 +1596,7 @@ case $basic_machine in esac echo $basic_machine$os -exit 0 +exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) diff --git a/contrib/binutils/config/ChangeLog b/contrib/binutils/config/ChangeLog index 85868b4246a..1ddcfd41628 100644 --- a/contrib/binutils/config/ChangeLog +++ b/contrib/binutils/config/ChangeLog @@ -1,3 +1,173 @@ +2006-02-14 Paolo Bonzini + Andreas Schwab + + * acx.m4 (NCN_STRICT_CHECK_TARGET_TOOLS): Use correct program name. + (ACX_CHECK_INSTALLED_TARGET_TOOL): Likewise, and always set $1. + +2006-01-26 Paolo Bonzini + + * acx.m4 (NCN_STRICT_CHECK_TARGET_TOOLS): Test $with_build_time_tools. + (ACX_PATH_SEP): New. + (ACX_TOOL_DIRS): Move here from the gcc directory. + (ACX_CHECK_INSTALLED_TARGET_TOOL): New. + (GCC_TARGET_TOOL): Do not use a host tool if we found a target tool + with a complete path in either $with_build_time_tools or $exec_prefix. + +2006-01-02 Paolo Bonzini + + PR target/25259 + * stdint.m4: New. + +2005-12-20 Paolo Bonzini + + Revert Ada-related part of the previous change. + + * mt-ppc-aix: Delete. + +2005-12-19 Paolo Bonzini + + * mt-ppc-aix, mh-ppc-aix: New. + +2005-12-05 Paolo Bonzini + + * acx.m4 (GCC_TARGET_TOOL): New. + +2005-09-23 Tom Tromey + + * enable.m4: New file. + * tls.m4: New file. + +2005-08-12 Paolo Bonzini + + * config/acx.m4 (NCN_CHECK_TARGET_TOOL, NCN_STRICT_CHECK_TOOL, + NCN_STRICT_CHECK_TARGET_TOOL): Remove. + (NCN_STRICT_CHECK_TOOLS, NCN_STRICT_CHECK_TARGET_TOOLS): New, + based on the deleted macros. + +2005-07-27 Mark Mitchell + + * mt-gnu (CXXFLAGS): Include SYSROOT_CFLAGS_FOR_TARGET. + +2005-07-16 Kelley Cook + + * all files: Update FSF address. + +2005-06-14 Tom Tromey + + PR libgcj/19877: + * no-executables.m4: Call real AC_FUNC_MMAP when cache variable + is set but not 'no'. + +2005-06-13 Zack Weinberg + + * depstand.m4, lead-dot.m4: New files. + +2005-05-19 Kelley Cook + + * accross.m4: Delete file. + +2005-05-12 Ryota Kunisawa + + PR bootstrap/21230 + * warnings.m4 (ACX_PROG_CC_WARNING_ALMOST_PEDANTIC): Add + double quotes around GCC variable. + +2005-04-29 Paolo Bonzini + + * acx.m4 (ACX_PROG_GNAT): Remove stray break. + +2005-03-31 Paolo Bonzini + + * gcc-lib-path.m4: Remove. + +2005-03-21 Zack Weinberg + + * gxx-include-dir.m4: In all substitutions, leave $(gcc_version) + to be expanded by the Makefile. + +2005-03-15 Zack Weinberg + + * gcc-version.m4: Delete. + +2005-02-28 Paolo Bonzini + + PR bootstrap/17383 + * acx.m4 (GCC_TOPLEV_SUBDIRS): Set HOST_SUBDIR if an in-src + gcc build is going. + +2005-01-23 Joseph S. Myers + + * warnings.m4 (ACX_PROG_CC_WARNING_ALMOST_PEDANTIC): Don't do + anything for non-GCC compilers. + +2004-12-03 Richard Sandiford + + * gxx-include-dir.m4: New file. + +2004-12-02 Richard Sandiford + + * gcc-version.m4: New file. + +2004-09-24 Zack Weinberg + + * warnings.m4: New file. + +2004-09-23 H.J. Lu + + PR bootstrap/17369 + * gcc-lib-path.m4: New file. + +2004-09-22 Kelley Cook + + * gettext-sister.m4: Renamed from gettext.m4 + * codeset.m4, gettext.m4, glibc21.m4, iconv.m4, intdiv0.m4, po.m4, + inttypes.m4, inttypes-pri.m4, inttypes_h.m4, lcmessage.m4, lib-ld.m4, + lib-link.m4, lib-prefix.m4, nls.m4, progtest.m4, stdint_h.m4, + uintmax_t.m4, ulonglong.m4: Import from gettext-0.12.1 sources. + +2004-08-31 Robert Bowdidge + + * mh-ppc-darwin: Add file, and override BOOT_CFLAGS. + +2004-08-13 Nathanael Nerode + + * Add ACX_{TARGET,HOST,BUILD}_NONCANONICAL, + which do an automatic AC_SUBST on _GCC_TOPLEV_*_NONCANONICAL. + The intention is that we will migrate to these bit by bit. + +2004-08-01 Robert Millan + + * mt-linux: Rename to ... + * mt-gnu: ... this. + +2004-06-09 Paolo Bonzini + + * acx.m4 (ACX_PROG_LN): From gcc, modified to + accept a parameter. + +2004-05-23 Paolo Bonzini + + * acx.m4 (ACX_HEADER_STDBOOL, ACX_HEADER_STRING): + From gcc. + +2004-04-16 Rainer Orth + + * acx.m4 (ACX_PROG_GNAT): Check if ${CC} produces object file for + Ada compilation. + Fix acx_cv_cc_gcc_supports_ada spelling. + +2004-03-08 Paolo Bonzini + + PR ada/14131 + Move language detection to the top level. + * acx.m4 (ACX_PROG_GNAT): New macro, moved here + from the gcc subdirectory. + +2004-03-09 Hans-Peter Nilsson + + * accross.m4 (AC_C_BIGENDIAN_CROSS): Compile endian probe with + "-c". Properly quote parameter for AC_MSG_ERROR. + 2004-01-14 Maciej W. Rozycki * acinclude.m4: Quote names of macros to be defined by AC_DEFUN diff --git a/contrib/binutils/config/mh-mingw32 b/contrib/binutils/config/mh-mingw32 deleted file mode 100644 index f622c8bec01..00000000000 --- a/contrib/binutils/config/mh-mingw32 +++ /dev/null @@ -1,7 +0,0 @@ -# We also need to override LIBGCC2_DEBUG_CFLAGS so libgcc2 will be -# built without debugging information - -LIBGCC2_DEBUG_CFLAGS= - -# custom installation rules for mingw32 (append .exe to binaries, etc.) -# INSTALL_DOSREL=install-dosrel diff --git a/contrib/binutils/config/mt-linux b/contrib/binutils/config/mt-linux deleted file mode 100644 index 15bf4171603..00000000000 --- a/contrib/binutils/config/mt-linux +++ /dev/null @@ -1 +0,0 @@ -CXXFLAGS_FOR_TARGET = $(CXXFLAGS) -D_GNU_SOURCE diff --git a/contrib/binutils/configure b/contrib/binutils/configure index d11c49b15d5..dbcbdfef7d3 100755 --- a/contrib/binutils/configure +++ b/contrib/binutils/configure @@ -13,14 +13,42 @@ ac_default_prefix=/usr/local # Any additions from configure.in: ac_help="$ac_help --enable-libada Builds libada directory" +ac_help="$ac_help + --enable-libssp Builds libssp directory" +ac_help="$ac_help + --enable-libgcc-math Builds libgcc-math directory" +ac_help="$ac_help + --with-mpfr-dir=PATH Specify source directory for MPFR library" +ac_help="$ac_help + --with-mpfr=PATH Specify directory for installed MPFR library" +ac_help="$ac_help + --with-gmp-dir=PATH Specify source directory for GMP library" +ac_help="$ac_help + --with-gmp=PATH Specify directory for installed GMP library" +ac_help="$ac_help + --with-build-sysroot=sysroot + use sysroot as the system root during the build" +ac_help="$ac_help + --enable-bootstrap Enable bootstrapping [yes if native build]" ac_help="$ac_help --enable-serial-[{host,target,build}-]configure Force sequential configuration of sub-packages for the host, target or build machine, or all sub-packages" +ac_help="$ac_help + --with-build-time-tools=path + use given path to find target tools during the build" ac_help="$ac_help --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer" +ac_help="$ac_help + --enable-werror enable -Werror in bootstrap stage2 and later" +ac_help="$ac_help + --with-datarootdir Use datarootdir as the data root directory." +ac_help="$ac_help + --with-docdir Install documentation in this directory." +ac_help="$ac_help + --with-htmldir Install html in this directory." # Initialize some variables set by options. # The variables have the same names as the options, with @@ -579,7 +607,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:583: checking host system type" >&5 +echo "configure:611: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -600,7 +628,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$host" 1>&6 echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:604: checking target system type" >&5 +echo "configure:632: checking target system type" >&5 target_alias=$target case "$target_alias" in @@ -618,7 +646,7 @@ target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$target" 1>&6 echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:622: checking build system type" >&5 +echo "configure:650: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -673,7 +701,7 @@ test "$program_transform_name" = "" && program_transform_name="s,x,x," # 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:677: checking for a BSD compatible install" >&5 +echo "configure:705: 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 @@ -725,49 +753,50 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' +echo $ac_n "checking whether ln works""... $ac_c" 1>&6 +echo "configure:758: checking whether ln works" >&5 +if eval "test \"`echo '$''{'acx_cv_prog_LN'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + rm -f conftestdata_t +echo >conftestdata_f +if ln conftestdata_f conftestdata_t 2>/dev/null +then + acx_cv_prog_LN=ln +else + acx_cv_prog_LN=no +fi +rm -f conftestdata_f conftestdata_t -# Autoconf M4 include file defining utility macros for complex Canadian -# cross builds. +fi +if test $acx_cv_prog_LN = no; then + LN="cp" + echo "$ac_t""no, using $LN" 1>&6 +else + LN="$acx_cv_prog_LN" + echo "$ac_t""yes" 1>&6 +fi - - - - - -#### -# _NCN_TOOL_PREFIXES: Some stuff that oughtta be done in AC_CANONICAL_SYSTEM -# or AC_INIT. -# These demand that AC_CANONICAL_SYSTEM be called beforehand. - -#### -# NCN_CHECK_TARGET_TOOL(variable, prog-to-check-for,[value-if-not-found],[path]) -# Like AC_CHECK_TOOL, but tries a prefix of the target, not the host. -# Code is pretty much lifted from autoconf2.53. - - - -#### -# NCN_STRICT_CHECK_TOOL(variable, prog-to-check-for,[value-if-not-found],[path]) -# Like AC_CHECK_TOOL, but requires the prefix if build!=host. - - - -#### -# NCN_STRICT_CHECK_TARGET_TOOL(variable, prog-to-check-for,[value-if-not-found],[path]) -# Like NCN_CHECK_TARGET_TOOL, but requires the prefix if build!=target. - - -### -# AC_PROG_CPP_WERROR -# Used for autoconf 2.5x to force AC_PREPROC_IFELSE to reject code which -# triggers warnings from the preprocessor. Will be in autoconf 2.58. -# For now, using this also overrides header checks to use only the -# preprocessor (matches 2.13 behavior; matching 2.58's behavior is a -# bit harder from here). -# Eventually autoconf will default to checking headers with the compiler -# instead, and we'll have to do this differently. - -# AC_PROG_CPP_WERROR +echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 +echo "configure:782: checking whether ln -s works" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + rm -f conftestdata +if ln -s X conftestdata 2>/dev/null +then + rm -f conftestdata + ac_cv_prog_LN_S="ln -s" +else + ac_cv_prog_LN_S=ln +fi +fi +LN_S="$ac_cv_prog_LN_S" +if test "$ac_cv_prog_LN_S" = "ln -s"; then + echo "$ac_t""yes" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi ### we might need to use some other shell than /bin/sh for running subshells @@ -820,10 +849,17 @@ rm -f conftestsed.out moveifchange=${srcdir}/move-if-change +srcpwd=`cd ${srcdir} ; ${PWDCMD-pwd}` + +# We pass INSTALL explicitly to sub-makes. Make sure that it is not +# a relative path. +if test "$INSTALL" = "${srcdir}/install-sh -c"; then + INSTALL="${srcpwd}/install-sh -c" +fi + # Set srcdir to "." if that's what it is. # This is important for multilib support. pwd=`${PWDCMD-pwd}` -srcpwd=`cd ${srcdir} ; ${PWDCMD-pwd}` if test "${pwd}" = "${srcpwd}" ; then srcdir=. fi @@ -831,26 +867,6 @@ fi topsrcdir=$srcpwd extra_host_args= -# Define the trigger file to make sure configure will re-run whenever -# the gcc version number changes. -if test "${with_gcc_version_trigger+set}" = set ; then - gcc_version_trigger="$with_gcc_version_trigger" - gcc_version=`grep version_string ${with_gcc_version_trigger} | sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/'` -else - # If gcc's sources are available, define the trigger file. - if test -f ${topsrcdir}/gcc/version.c ; then - gcc_version_trigger=${topsrcdir}/gcc/version.c - gcc_version=`grep version_string ${gcc_version_trigger} | sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/'` - case "$ac_configure_args" in - *--with-gcc-version-trigger=$gcc_version_trigger* ) - ;; - * ) - # Add to all subconfigure arguments: build, host, and target. - ac_configure_args="$ac_configure_args --with-gcc-version-trigger=$gcc_version_trigger" - ;; - esac - fi -fi ### To add a new directory to the tree, first choose whether it is a target ### or a host dependent tool. Then put it into the appropriate list @@ -866,16 +882,24 @@ fi # Double entries in build_configdirs, configdirs, or target_configdirs may # cause circular dependencies and break everything horribly. +# these library is used by various programs built for the build +# environment +# +build_libs="build-libiberty" + +# these tools are built for the build environment +build_tools="build-texinfo build-byacc build-flex build-bison build-m4 build-fixincludes" + # these libraries are used by various programs built for the host environment # -host_libs="intl mmalloc libiberty opcodes bfd readline tcl tk itcl tix libgui zlib" +host_libs="intl mmalloc libiberty opcodes bfd readline tcl tk itcl libgui zlib libcpp libdecnumber" # these tools are built for the host environment # Note, the powerpc-eabi build depends on sim occurring before gdb in order to # know that we are building the simulator. # binutils, gas and ld appear in that order because it makes sense to run # "make check" in that particular order. -host_tools="texinfo byacc flex bison binutils gas ld gcc sid sim gdb make patch prms send-pr gprof etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool diff rcs fileutils shellutils time textutils wdiff find uudecode hello tar gzip indent recode release sed utils guile perl gawk findutils gettext zip fastjar" +host_tools="texinfo byacc flex bison binutils gas ld fixincludes gcc sid sim gdb make patch prms send-pr gprof etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool diff rcs fileutils shellutils time textutils wdiff find uudecode hello tar gzip indent recode release sed utils guile perl gawk findutils gettext zip fastjar gnattools" # libgcj represents the runtime libraries only used by gcj. libgcj="target-libffi \ @@ -891,10 +915,14 @@ target_libraries="target-libiberty \ target-libgloss \ target-newlib \ target-libstdc++-v3 \ - target-libf2c \ + target-libmudflap \ + target-libssp \ + target-libgcc-math \ + target-libgfortran \ ${libgcj} \ target-libobjc \ - target-libada" + target-libada \ + target-libgomp" # these tools are built using the target libraries, and are intended to # run only in the target environment @@ -912,19 +940,9 @@ target_tools="target-examples target-groff target-gperf target-rda" ## is important because configure will choke if they ever get through. ## ${configdirs} is directories we build using the host tools. ## ${target_configdirs} is directories we build using the target tools. -# configdirs=`echo ${host_libs} ${host_tools}` target_configdirs=`echo ${target_libraries} ${target_tools}` - -# Only make build modules if build != host. -# This should be done more generally, but at the moment it doesn't matter. -if test ${host_alias} != ${build_alias} ; then - # This is the only build module. - build_modules=libiberty -else - build_modules= -fi - +build_configdirs=`echo ${build_libs} ${build_tools}` ################################################################################ @@ -959,8 +977,13 @@ esac # Prefix 'build-' so this never conflicts with target_subdir. build_subdir="build-${build_noncanonical}" -# Not really a subdirectory, but here for completeness. -host_subdir=. +# --srcdir=. covers the toplevel, while "test -d" covers the subdirectories +if ( test $srcdir = . && test -d gcc ) \ + || test -d $srcdir/../host-${host_noncanonical}; then + host_subdir="host-${host_noncanonical}" +else + host_subdir=. +fi # No prefix. target_subdir=${target_noncanonical} @@ -990,7 +1013,7 @@ fi case ${with_x} in yes | "") ;; # the default value for this tree is that X11 is available no) - skipdirs="${skipdirs} tk tix itcl libgui" + skipdirs="${skipdirs} tk itcl libgui" # We won't be able to build gdbtk without X. enable_gdbtk=no ;; @@ -1012,8 +1035,8 @@ esac # If both --with-headers and --with-libs are specified, default to # --without-newlib. -if test x"${with_headers}" != x && test x"${with_headers} != xno \ - && test x"${with_libs}" != x && test x"${with_libs} != xno ; then +if test x"${with_headers}" != x && test x"${with_headers}" != xno \ + && test x"${with_libs}" != x && test x"${with_libs}" != xno ; then if test x"${with_newlib}" = x ; then with_newlib=no fi @@ -1032,6 +1055,10 @@ case "${host}" in configdirs="$configdirs libtermcap" ;; esac +# A target can indicate whether a language isn't supported for some reason. +# Only spaces may be used in this macro; not newlines or tabs. +unsupported_languages= + # Remove more programs from consideration, based on the host or # target this usually means that a port of the program doesn't # exist yet. @@ -1041,17 +1068,17 @@ case "${host}" in noconfigdirs="$noconfigdirs byacc" ;; i[3456789]86-*-vsta) - noconfigdirs="$noconfigdirs tcl expect dejagnu make texinfo bison patch flex byacc send-pr gprof uudecode dejagnu diff guile perl itcl tix gnuserv gettext" + noconfigdirs="$noconfigdirs tcl expect dejagnu make texinfo bison patch flex byacc send-pr gprof uudecode dejagnu diff guile perl itcl gnuserv gettext" ;; i[3456789]86-*-go32* | i[3456789]86-*-msdosdjgpp*) - noconfigdirs="$noconfigdirs tcl tk expect dejagnu send-pr uudecode guile itcl tix gnuserv libffi" + noconfigdirs="$noconfigdirs tcl tk expect dejagnu send-pr uudecode guile itcl gnuserv libffi" ;; i[3456789]86-*-mingw32*) - # noconfigdirs="tcl tk expect dejagnu make texinfo bison patch flex byacc send-pr uudecode dejagnu diff guile perl itcl tix gnuserv" + # noconfigdirs="tcl tk expect dejagnu make texinfo bison patch flex byacc send-pr uudecode dejagnu diff guile perl itcl gnuserv" noconfigdirs="$noconfigdirs expect dejagnu autoconf automake send-pr rcs guile perl texinfo libtool" ;; i[3456789]86-*-beos*) - noconfigdirs="$noconfigdirs tk itcl tix libgui gdb" + noconfigdirs="$noconfigdirs tk itcl libgui gdb" ;; *-*-cygwin*) noconfigdirs="$noconfigdirs autoconf automake send-pr rcs guile perl" @@ -1060,16 +1087,14 @@ case "${host}" in noconfigdirs="$noconfigdirs rcs" ;; ppc*-*-pe) - noconfigdirs="$noconfigdirs patch diff make tk tcl expect dejagnu autoconf automake texinfo bison send-pr gprof rcs guile perl itcl tix gnuserv" + noconfigdirs="$noconfigdirs patch diff make tk tcl expect dejagnu autoconf automake texinfo bison send-pr gprof rcs guile perl itcl gnuserv" ;; powerpc-*-beos*) - noconfigdirs="$noconfigdirs tk itcl tix libgui gdb dejagnu readline" - ;; - *-*-darwin*) - noconfigdirs="$noconfigdirs tk itcl tix libgui" + noconfigdirs="$noconfigdirs tk itcl libgui gdb dejagnu readline" ;; esac + # Check whether --enable-libada or --disable-libada was given. if test "${enable_libada+set}" = set; then enableval="$enable_libada" @@ -1079,9 +1104,35 @@ else fi if test "${ENABLE_LIBADA}" != "yes" ; then - noconfigdirs="$noconfigdirs target-libada" + noconfigdirs="$noconfigdirs gnattools" fi +# Check whether --enable-libssp or --disable-libssp was given. +if test "${enable_libssp+set}" = set; then + enableval="$enable_libssp" + ENABLE_LIBSSP=$enableval +else + ENABLE_LIBSSP=yes +fi + + +# Set the default so we build libgcc-math for ix86 and x86_64 +# Check whether --enable-libgcc-math or --disable-libgcc-math was given. +if test "${enable_libgcc_math+set}" = set; then + enableval="$enable_libgcc_math" + : +else + +case "${target}" in + i?86-* | x86_64-* ) + enable_libgcc_math=yes ;; + *) + enable_libgcc_math=no ;; +esac + +fi + + # Save it here so that, even in case of --enable-libgcj, if the Java # front-end isn't enabled, we still get libgcj disabled. libgcj_saved=$libgcj @@ -1098,24 +1149,77 @@ no) ;; esac + +# Disable libmudflap on some systems. +if test x$enable_libmudflap = x ; then + case "${target}" in + *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu) + # Enable libmudflap by default in GNU and friends. + ;; + *-*-freebsd*) + # Enable libmudflap by default in FreeBSD. + ;; + *) + # Disable it by default everywhere else. + noconfigdirs="$noconfigdirs target-libmudflap" + ;; + esac +fi + +# Disable libgomp on non POSIX hosted systems. +if test x$enable_libgomp = x ; then + # Enable libgomp by default on hosted POSIX systems. + case "${target}" in + *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu) + ;; + *-*-netbsd* | *-*-freebsd* | *-*-openbsd*) + ;; + *-*-solaris2* | *-*-sysv4* | *-*-irix* | *-*-osf* | *-*-hpux*) + ;; + *-*-darwin* | *-*-aix*) + ;; + *) + noconfigdirs="$noconfigdirs target-libgomp" + ;; + esac +fi + + case "${target}" in *-*-chorusos) noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}" ;; powerpc-*-darwin*) noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes gdb gprof" - noconfigdirs="$noconfigdirs target-libobjc" + noconfigdirs="$noconfigdirs sim target-rda" ;; *-*-darwin*) - noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes gdb gprof" - noconfigdirs="$noconfigdirs target-libobjc ${libgcj}" + noconfigdirs="$noconfigdirs ld gas gdb gprof" + noconfigdirs="$noconfigdirs sim target-rda" + noconfigdirs="$noconfigdirs ${libgcj}" ;; *-*-freebsd[12] | *-*-freebsd[12].* | *-*-freebsd*aout*) noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}" ;; + *-*-freebsd*) + noconfigdirs="$noconfigdirs target-newlib target-libgloss" + if test "x$with_gmp" = x && test "x$with_gmp_dir" = x \ + && test -f /usr/local/include/gmp.h; then + with_gmp=/usr/local + fi + + # Skip some stuff that's unsupported on some FreeBSD configurations. + case "${target}" in + i*86-*-*) ;; + alpha*-*-*) ;; + *) + noconfigdirs="$noconfigdirs ${libgcj}" + ;; + esac + ;; *-*-kaos*) # Remove unsupported stuff on all kaOS configurations. - skipdirs="target-libiberty ${libgcj} target-libstdc++-v3 target-libf2c target-librx" + skipdirs="target-libiberty ${libgcj} target-libstdc++-v3 target-librx" skipdirs="$skipdirs target-libobjc target-examples target-groff target-gperf" skipdirs="$skipdirs zlib fastjar target-libjava target-boehm-gc target-zlib" noconfigdirs="$noconfigdirs target-libgloss" @@ -1133,23 +1237,24 @@ case "${target}" in ;; esac ;; - *-*-netware) - noconfigdirs="$noconfigdirs target-libstdc++-v3 target-newlib target-libiberty target-libgloss ${libgcj}" + *-*-netware*) + noconfigdirs="$noconfigdirs target-newlib target-libiberty target-libgloss ${libgcj} target-libmudflap" ;; *-*-rtems*) noconfigdirs="$noconfigdirs target-libgloss ${libgcj}" - case ${target} in - h8300*-*-* | h8500-*-*) - noconfigdirs="$noconfigdirs target-libf2c" - ;; - *) ;; - esac + ;; + # The tpf target doesn't support gdb yet. + *-*-tpf*) + noconfigdirs="$noconfigdirs target-newlib target-libgloss target-libiberty ${libgcj} target-libmudflap gdb tcl tk libgui itcl" ;; *-*-uclinux*) noconfigdirs="$noconfigdirs target-newlib target-libgloss target-rda ${libgcj}" ;; *-*-vxworks*) - noconfigdirs="$noconfigdirs target-newlib target-libgloss target-libiberty ${libgcj}" + noconfigdirs="$noconfigdirs target-newlib target-libgloss target-libiberty target-libstdc++-v3 ${libgcj}" + ;; + m32c-*-*) + noconfigdirs="$noconfigdirs target-libstdc++-v3" ;; alpha*-dec-osf*) # ld works, but does not support shared libraries. @@ -1164,9 +1269,6 @@ case "${target}" in # newlib is not 64 bit ready noconfigdirs="$noconfigdirs target-newlib target-libgloss" ;; - alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu) - noconfigdirs="$noconfigdirs target-newlib target-libgloss" - ;; alpha*-*-*) # newlib is not 64 bit ready noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}" @@ -1181,7 +1283,7 @@ case "${target}" in noconfigdirs="$noconfigdirs ${libgcj}" noconfigdirs="$noconfigdirs target-examples" noconfigdirs="$noconfigdirs target-libiberty texinfo send-pr" - noconfigdirs="$noconfigdirs tcl tix tk itcl libgui sim" + noconfigdirs="$noconfigdirs tcl tk itcl libgui sim" noconfigdirs="$noconfigdirs expect dejagnu" # the C++ libraries don't build on top of CE's C libraries noconfigdirs="$noconfigdirs target-libstdc++-v3" @@ -1195,16 +1297,22 @@ case "${target}" in arc-*-*) noconfigdirs="$noconfigdirs target-libgloss ${libgcj}" ;; + arm-semi-aof ) + ;; arm-*-coff | strongarm-*-coff | xscale-*-coff) noconfigdirs="$noconfigdirs ${libgcj}" ;; - arm-*-elf* | strongarm-*-elf* | xscale-*-elf*) + arm-*-elf* | strongarm-*-elf* | xscale-*-elf* | arm*-*-eabi* ) noconfigdirs="$noconfigdirs target-libffi target-qthreads" ;; - arm-*-pe*) - noconfigdirs="$noconfigdirs target-libgloss ${libgcj}" + arm*-*-linux-gnueabi) + noconfigdirs="$noconfigdirs target-libffi target-qthreads" + noconfigdirs="$noconfigdirs target-libjava target-libobjc" ;; - arm-*-oabi*) + arm*-*-symbianelf*) + noconfigdirs="$noconfigdirs ${libgcj} target-libiberty" + ;; + arm-*-pe*) noconfigdirs="$noconfigdirs target-libgloss ${libgcj}" ;; thumb-*-coff) @@ -1213,9 +1321,6 @@ case "${target}" in thumb-*-elf) noconfigdirs="$noconfigdirs target-libgloss ${libgcj}" ;; - thumb-*-oabi) - noconfigdirs="$noconfigdirs target-libgloss ${libgcj}" - ;; thumb-*-pe) noconfigdirs="$noconfigdirs target-libgloss ${libgcj}" ;; @@ -1225,14 +1330,36 @@ case "${target}" in avr-*-*) noconfigdirs="$noconfigdirs target-libiberty target-libstdc++-v3 ${libgcj}" ;; + bfin-*-*) + noconfigdirs="$noconfigdirs target-libgloss gdb" + if test x${is_cross_compiler} != xno ; then + target_configdirs="${target_configdirs} target-bsp target-cygmon" + fi + ;; c4x-*-* | tic4x-*-*) noconfigdirs="$noconfigdirs target-libstdc++-v3 target-libgloss ${libgcj}" ;; c54x*-*-* | tic54x-*-*) noconfigdirs="$noconfigdirs target-libstdc++-v3 target-libgloss ${libgcj} gcc gdb newlib" ;; - cris-*-*) - noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss" + cris-*-* | crisv32-*-*) + unsupported_languages="$unsupported_languages java" + case "${target}" in + *-*-aout) + unsupported_languages="$unsupported_languages fortran" + noconfigdirs="$noconfigdirs target-libffi target-boehm-gc";; + *-*-elf) + unsupported_languages="$unsupported_languages fortran" + noconfigdirs="$noconfigdirs target-boehm-gc";; + *-*-linux*) + noconfigdirs="$noconfigdirs target-newlib target-libgloss";; + *) + unsupported_languages="$unsupported_languages fortran" + noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss";; + esac + ;; + crx-*-*) + noconfigdirs="$noconfigdirs target-libstdc++-v3 target-mudflap ${libgcj}" ;; d10v-*-*) noconfigdirs="$noconfigdirs target-libstdc++-v3 target-libgloss ${libgcj}" @@ -1247,10 +1374,12 @@ case "${target}" in noconfigdirs="$noconfigdirs ${libgcj}" ;; h8300*-*-*) - noconfigdirs="$noconfigdirs target-libgloss ${libgcj} target-libf2c" + noconfigdirs="$noconfigdirs target-libgloss ${libgcj}" ;; h8500-*-*) - noconfigdirs="$noconfigdirs target-libstdc++-v3 target-libgloss ${libgcj} target-libf2c" + noconfigdirs="$noconfigdirs target-libstdc++-v3 target-libgloss ${libgcj}" + ;; + hppa1.1-*-osf* | hppa1.1-*-bsd* ) ;; hppa*64*-*-linux* | parisc*64*-*-linux*) # In this case, it's because the hppa64-linux target is for @@ -1258,13 +1387,13 @@ case "${target}" in # headers, crt*.o, etc., all of which are needed by these. noconfigdirs="$noconfigdirs target-zlib" ;; + parisc*-*-linux* | hppa*-*-linux*) + ;; hppa*-*-*elf* | \ - parisc*-*-linux* | hppa*-*-linux* | \ hppa*-*-lites* | \ hppa*-*-openbsd* | \ hppa*64*-*-*) noconfigdirs="$noconfigdirs ${libgcj}" - # Do configure ld/binutils/gas for this case. ;; hppa*-*-*) # According to Alexandre Oliva , libjava won't @@ -1276,18 +1405,17 @@ case "${target}" in ;; ia64*-*-elf*) # No gdb support yet. - noconfigdirs="$noconfigdirs tix readline mmalloc libgui itcl gdb" + noconfigdirs="$noconfigdirs readline mmalloc libgui itcl gdb" ;; ia64*-**-hpux*) # No gdb or ld support yet. - noconfigdirs="$noconfigdirs ${libgcj} tix readline mmalloc libgui itcl gdb ld" + noconfigdirs="$noconfigdirs ${libgcj} readline mmalloc libgui itcl gdb ld" + ;; + i370-*-opened*) ;; i[3456789]86-*-coff | i[3456789]86-*-elf) noconfigdirs="$noconfigdirs ${libgcj}" ;; - i[3456789]86-*-freebsd* | i[3456789]86-*-kfreebsd*-gnu) - noconfigdirs="$noconfigdirs target-newlib target-libgloss" - ;; i[3456789]86-*-linux*) # The GCC port for glibc1 has no MD_FALLBACK_FRAME_STATE_FOR, so let's # not build java stuff by default. @@ -1314,23 +1442,30 @@ case "${target}" in # Can't build gdb for mingw32 if not native. case "${host}" in i[3456789]86-*-mingw32) ;; # keep gdb tcl tk expect etc. - *) noconfigdirs="$noconfigdirs gdb tcl tk expect itcl tix gnuserv" + *) noconfigdirs="$noconfigdirs gdb tcl tk expect itcl gnuserv" ;; esac ;; *-*-cygwin*) target_configdirs="$target_configdirs target-libtermcap target-winsup" noconfigdirs="$noconfigdirs target-gperf target-libgloss ${libgcj}" - # always build newlib. - skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'` + # always build newlib if winsup directory is present. + if test -d "$srcdir/winsup"; then + skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'` + elif test -d "$srcdir/newlib"; then + echo "Warning: winsup is missing so newlib can't be built." + fi # Can't build gdb for Cygwin if not native. case "${host}" in *-*-cygwin*) ;; # keep gdb tcl tk expect etc. - *) noconfigdirs="$noconfigdirs gdb tcl tk expect itcl tix libgui gnuserv" + *) noconfigdirs="$noconfigdirs gdb tcl tk expect itcl libgui gnuserv" ;; esac ;; + i[3456789]86-moss-msdos | i[3456789]86-*-moss* | \ + i[3456789]86-*-uwin* | i[3456789]86-*-interix* ) + ;; i[3456789]86-*-pe) noconfigdirs="$noconfigdirs target-libstdc++-v3 target-libgloss ${libgcj}" ;; @@ -1351,6 +1486,9 @@ case "${target}" in i[3456789]86-*-beos*) noconfigdirs="$noconfigdirs gdb target-newlib target-libgloss ${libgcj}" ;; + i[3456789]86-*-rdos*) + noconfigdirs="$noconfigdirs gdb target-newlib target-libgloss" + ;; m32r-*-*) noconfigdirs="$noconfigdirs ${libgcj}" ;; @@ -1369,7 +1507,8 @@ case "${target}" in noconfigdirs="$noconfigdirs target-libstdc++-v3" ;; mmix-*-*) - noconfigdirs="$noconfigdirs ${libgcj} gdb libgloss" + noconfigdirs="$noconfigdirs target-libffi target-boehm-gc gdb libgloss" + unsupported_languages="$unsupported_languages fortran java" ;; mn10200-*-*) noconfigdirs="$noconfigdirs ${libgcj}" @@ -1377,19 +1516,22 @@ case "${target}" in mn10300-*-*) noconfigdirs="$noconfigdirs ${libgcj}" ;; + mt-*-*) + noconfigdirs="$noconfigdirs sim" + ;; powerpc-*-aix*) # copied from rs6000-*-* entry - noconfigdirs="$noconfigdirs gprof target-libada target-libgloss ${libgcj}" + noconfigdirs="$noconfigdirs gprof target-libgloss target-libssp ${libgcj}" ;; powerpc*-*-winnt* | powerpc*-*-pe* | ppc*-*-pe) target_configdirs="$target_configdirs target-winsup" - noconfigdirs="$noconfigdirs gdb tcl tk make expect target-libgloss itcl tix gnuserv ${libgcj}" + noconfigdirs="$noconfigdirs gdb tcl tk make expect target-libgloss itcl gnuserv ${libgcj}" # always build newlib. skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'` ;; # This is temporary until we can link against shared libraries powerpcle-*-solaris*) - noconfigdirs="$noconfigdirs gdb sim make tcl tk expect itcl tix gnuserv ${libgcj}" + noconfigdirs="$noconfigdirs gdb sim make tcl tk expect itcl gnuserv ${libgcj}" ;; powerpc-*-beos*) noconfigdirs="$noconfigdirs gdb target-newlib target-libgloss ${libgcj}" @@ -1397,11 +1539,13 @@ case "${target}" in powerpc-*-eabi) noconfigdirs="$noconfigdirs ${libgcj}" ;; + powerpc-*-eabi* | powerpcle-*-eabi* | powerpc-*-rtems* ) + ;; rs6000-*-lynxos*) noconfigdirs="$noconfigdirs target-newlib gprof ${libgcj}" ;; rs6000-*-aix*) - noconfigdirs="$noconfigdirs gprof target-libada target-libgloss ${libgcj}" + noconfigdirs="$noconfigdirs gprof target-libgloss target-libssp ${libgcj}" ;; rs6000-*-*) noconfigdirs="$noconfigdirs gprof ${libgcj}" @@ -1428,6 +1572,9 @@ case "${target}" in mipstx39-*-*) noconfigdirs="$noconfigdirs gprof ${libgcj}" # same as generic mips ;; + mips64*-*-linux*) + noconfigdirs="$noconfigdirs target-newlib ${libgcj}" + ;; mips*-*-linux*) noconfigdirs="$noconfigdirs target-newlib target-libgloss" ;; @@ -1437,7 +1584,7 @@ case "${target}" in romp-*-*) noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}" ;; - sh-*-*) + sh-*-* | sh64-*-*) case "${host}" in i[3456789]86-*-vsta) ;; # don't add gprof back in i[3456789]86-*-go32*) ;; # don't add gprof back in @@ -1446,9 +1593,6 @@ case "${target}" in esac noconfigdirs="$noconfigdirs target-libgloss ${libgcj}" ;; - sh64-*-*) - noconfigdirs="$noconfigdirs target-libgloss ${libgcj}" - ;; sparc-*-elf*) noconfigdirs="$noconfigdirs ${libgcj}" ;; @@ -1466,6 +1610,9 @@ case "${target}" in use_gnu_ld=no fi ;; + sparc-*-solaris2.[0-6] | sparc-*-solaris2.[0-6].*) + noconfigdirs="$noconfigdirs ${libgcj}" + ;; sparc-*-solaris* | sparc64-*-solaris* | sparcv9-*-solaris*) ;; v810-*-*) @@ -1492,7 +1639,7 @@ case "${target}" in ip2k-*-*) noconfigdirs="$noconfigdirs target-libiberty target-libstdc++-v3 ${libgcj}" ;; - *-*-linux*) + *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu) noconfigdirs="$noconfigdirs target-newlib target-libgloss" ;; *-*-lynxos*) @@ -1510,273 +1657,6 @@ case "${noconfigdirs}" in *target-newlib*) noconfigdirs="$noconfigdirs target-libgloss" ;; esac -# Figure out what language subdirectories are present. -# Look if the user specified --enable-languages="..."; if not, use -# the environment variable $LANGUAGES if defined. $LANGUAGES might -# go away some day. -# NB: embedded tabs in this IF block -- do not untabify -if test x"${enable_languages+set}" != xset; then - if test x"${LANGUAGES+set}" = xset; then - enable_languages="${LANGUAGES}" - echo configure.in: warning: setting LANGUAGES is deprecated, use --enable-languages instead 1>&2 - else - enable_languages=all - fi -else - if test x"${enable_languages}" = x || - test x"${enable_languages}" = xyes; - then - echo configure.in: --enable-languages needs at least one language argument 1>&2 - exit 1 - fi -fi -enable_languages=`echo "${enable_languages}" | sed -e 's/[ ,][ ,]*/,/g' -e 's/,$//'` - -# First scan to see if an enabled language requires some other language. -# We assume that a given config-lang.in will list all the language -# front ends it requires, even if some are required indirectly. -for lang_frag in ${srcdir}/gcc/*/config-lang.in .. ; do - case ${lang_frag} in - ..) ;; - # The odd quoting in the next line works around - # an apparent bug in bash 1.12 on linux. - ${srcdir}/gcc/[*]/config-lang.in) ;; - *) - # From the config-lang.in, get $language, $lang_requires - language= - lang_requires= - . ${lang_frag} - for other in ${lang_requires} ; do - case ,${enable_languages}, in - *,$other,*) ;; - *,all,*) ;; - *,$language,*) - echo " \`$other' language required by \`$language'; enabling" 1>&2 - enable_languages="${enable_languages},${other}" - ;; - esac - done - ;; - esac -done - -for lang_frag in ${srcdir}/gcc/*/config-lang.in .. ; do - case ${lang_frag} in - ..) ;; - # The odd quoting in the next line works around - # an apparent bug in bash 1.12 on linux. - ${srcdir}/gcc/[*]/config-lang.in) ;; - *) - # From the config-lang.in, get $language, $target_libs, - # $lang_dirs, and $build_by_default - language= - target_libs= - lang_dirs= - build_by_default= - . ${lang_frag} - if test "x$language" = x ; then - echo "${lang_frag} doesn't set \$language." 1>&2 - exit 1 - fi - case ,${enable_languages}, in - *,${language},*) - # Language was explicitly selected; include it. - add_this_lang=yes - ;; - *,all,*) - # 'all' was selected; include 'default' languages. - case ${build_by_default} in - no) add_this_lang=no ;; - *) add_this_lang=yes ;; - esac - ;; - *) add_this_lang=no ;; - esac - case ${add_this_lang} in - no) - # Remove language-dependent dirs. - eval noconfigdirs='"$noconfigdirs "'\"$target_libs $lang_dirs\" - ;; - esac - ;; - esac -done - -# Remove the entries in $skipdirs and $noconfigdirs from $configdirs and -# $target_configdirs. -# If we have the source for $noconfigdirs entries, add them to $notsupp. - -notsupp="" -for dir in . $skipdirs $noconfigdirs ; do - dirname=`echo $dir | sed -e s/target-//g` - if test $dir != . && echo " ${configdirs} " | grep " ${dir} " >/dev/null 2>&1; then - configdirs=`echo " ${configdirs} " | sed -e "s/ ${dir} / /"` - if test -r $srcdir/$dirname/configure ; then - if echo " ${skipdirs} " | grep " ${dir} " >/dev/null 2>&1; then - true - else - notsupp="$notsupp $dir" - fi - fi - fi - if test $dir != . && echo " ${target_configdirs} " | grep " ${dir} " >/dev/null 2>&1; then - target_configdirs=`echo " ${target_configdirs} " | sed -e "s/ ${dir} / /"` - if test -r $srcdir/$dirname/configure ; then - if echo " ${skipdirs} " | grep " ${dir} " >/dev/null 2>&1; then - true - else - notsupp="$notsupp $dir" - fi - fi - fi -done - -# Sometimes the tools are distributed with libiberty but with no other -# libraries. In that case, we don't want to build target-libiberty. -if test -n "${target_configdirs}" ; then - others= - for i in `echo ${target_configdirs} | sed -e s/target-//g` ; do - if test "$i" != "libiberty" ; then - if test -r $srcdir/$i/configure ; then - others=yes; - break; - fi - fi - done - if test -z "${others}" ; then - target_configdirs= - fi -fi - -# Quietly strip out all directories which aren't configurable in this tree. -# This relies on all configurable subdirectories being autoconfiscated, which -# is now the case. -configdirs_all="$configdirs" -configdirs= -for i in ${configdirs_all} ; do - if test -f ${srcdir}/$i/configure ; then - configdirs="${configdirs} $i" - fi -done -target_configdirs_all="$target_configdirs" -target_configdirs= -for i in ${target_configdirs_all} ; do - j=`echo $i | sed -e s/target-//g` - if test -f ${srcdir}/$j/configure ; then - target_configdirs="${target_configdirs} $i" - fi -done - -# Produce a warning message for the subdirs we can't configure. -# This isn't especially interesting in the Cygnus tree, but in the individual -# FSF releases, it's important to let people know when their machine isn't -# supported by the one or two programs in a package. - -if test -n "${notsupp}" && test -z "${norecursion}" ; then - # If $appdirs is non-empty, at least one of those directories must still - # be configured, or we error out. (E.g., if the gas release supports a - # specified target in some subdirs but not the gas subdir, we shouldn't - # pretend that all is well.) - if test -n "$appdirs" ; then - for dir in $appdirs ; do - if test -r $dir/Makefile.in ; then - if echo " ${configdirs} " | grep " ${dir} " >/dev/null 2>&1; then - appdirs="" - break - fi - if echo " ${target_configdirs} " | grep " ${dir} " >/dev/null 2>&1; then - appdirs="" - break - fi - fi - done - if test -n "$appdirs" ; then - echo "*** This configuration is not supported by this package." 1>&2 - exit 1 - fi - fi - # Okay, some application will build, or we don't care to check. Still - # notify of subdirs not getting built. - echo "*** This configuration is not supported in the following subdirectories:" 1>&2 - echo " ${notsupp}" 1>&2 - echo " (Any other directories should still work fine.)" 1>&2 -fi - -case "$host" in - *msdosdjgpp*) - enable_gdbtk=no ;; -esac - -copy_dirs= - -# Handle --with-headers=XXX. If the value is not "yes", the contents of -# the named directory are copied to $(tooldir)/sys-include. -if test x"${with_headers}" != x && test x"${with_headers}" != xno ; then - if test x${is_cross_compiler} = xno ; then - echo 1>&2 '***' --with-headers is only supported when cross compiling - exit 1 - fi - if test x"${with_headers}" != xyes ; then - case "${exec_prefixoption}" in - "") x=${prefix} ;; - *) x=${exec_prefix} ;; - esac - copy_dirs="${copy_dirs} ${with_headers} $x/${target_alias}/sys-include" - fi -fi - -# Handle --with-libs=XXX. If the value is not "yes", the contents of -# the name directories are copied to $(tooldir)/lib. Multiple directories -# are permitted. -if test x"${with_libs}" != x && test x"${with_libs}" != xno ; then - if test x${is_cross_compiler} = xno ; then - echo 1>&2 '***' --with-libs is only supported when cross compiling - exit 1 - fi - if test x"${with_libs}" != xyes ; then - # Copy the libraries in reverse order, so that files in the first named - # library override files in subsequent libraries. - case "${exec_prefixoption}" in - "") x=${prefix} ;; - *) x=${exec_prefix} ;; - esac - for l in ${with_libs}; do - copy_dirs="$l $x/${target_alias}/lib ${copy_dirs}" - done - fi -fi - -# Handle ${copy_dirs} -set fnord ${copy_dirs} -shift -while test $# != 0 ; do - if test -f $2/COPIED && test x"`cat $2/COPIED`" = x"$1" ; then - : - else - echo Copying $1 to $2 - - # Use the install script to create the directory and all required - # parent directories. - if test -d $2 ; then - : - else - echo >config.temp - ${srcdir}/install-sh -c -m 644 config.temp $2/COPIED - fi - - # Copy the directory, assuming we have tar. - # FIXME: Should we use B in the second tar? Not all systems support it. - (cd $1; tar -cf - .) | (cd $2; tar -xpf -) - - # It is the responsibility of the user to correctly adjust all - # symlinks. If somebody can figure out how to handle them correctly - # here, feel free to add the code. - - echo $1 > $2/COPIED - fi - shift; shift -done - # Work in distributions that contain no compiler tools, like Autoconf. tentative_cc="" host_makefile_frag=/dev/null @@ -1890,7 +1770,6 @@ case "${host}" in host_makefile_frag="config/mh-cygwin" ;; *-mingw32*) - host_makefile_frag="config/mh-mingw32" ;; *-interix*) host_makefile_frag="config/mh-interix" @@ -1918,6 +1797,15 @@ case "${host}" in tentative_cc="/usr/cygnus/progressive/bin/gcc" host_makefile_frag="config/mh-lynxrs6k" ;; + powerpc-*-darwin*) + host_makefile_frag="config/mh-ppc-darwin" + ;; + powerpc-*-aix*) + host_makefile_frag="config/mh-ppc-aix" + ;; + rs6000-*-aix*) + host_makefile_frag="config/mh-ppc-aix" + ;; *-*-lynxos*) # /bin/cc is less than useful for our purposes. Always use GCC tentative_cc="/bin/gcc" @@ -1925,22 +1813,1036 @@ case "${host}" in *-*-sysv4*) host_makefile_frag="config/mh-sysv4" ;; + # This is placed last to prevent interfering with the cases above. + i[3456789]86-*-*) + # Build the stage2 and stage3 compilers with -fomit-frame-pointer. + host_makefile_frag="config/mh-x86omitfp" + ;; esac fi +# If we aren't going to be using gcc, see if we can extract a definition +# of CC from the fragment. +# Actually, use the 'pre-extracted' version above. +if test -z "${CC}" && test "${build}" = "${host}" ; then + IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" + found= + for dir in $PATH; do + test -z "$dir" && dir=. + if test -f $dir/gcc; then + found=yes + break + fi + done + IFS="$save_ifs" + if test -z "${found}" && test -n "${tentative_cc}" ; then + CC=$tentative_cc + fi +fi + +if test "${build}" != "${host}" ; then + # If we are doing a Canadian Cross, in which the host and build systems + # are not the same, we set reasonable default values for the tools. + + CC=${CC-${host_alias}-gcc} + CFLAGS=${CFLAGS-"-g -O2"} + CXX=${CXX-${host_alias}-c++} + CXXFLAGS=${CXXFLAGS-"-g -O2"} + CC_FOR_BUILD=${CC_FOR_BUILD-gcc} + +else + # Set reasonable default values for some tools even if not Canadian. + # Of course, these are different reasonable default values, originally + # specified directly in the Makefile. + # We don't export, so that autoconf can do its job. + # Note that all these settings are above the fragment inclusion point + # in Makefile.in, so can still be overridden by fragments. + # This is all going to change when we autoconfiscate... + + CC_FOR_BUILD="\$(CC)" + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1867: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1897: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_prog_rejected=no + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test -z "$CC"; then + case "`uname -s`" in + *win32* | *WIN32*) + # Extract the first word of "cl", so it can be a program name with args. +set dummy cl; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1948: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="cl" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + ;; + esac + fi + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:1980: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext << EOF + +#line 1991 "configure" +#include "confdefs.h" + +main(){return(0);} +EOF +if { (eval echo configure:1996: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + ac_cv_prog_cc_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cc_cross=no + else + ac_cv_prog_cc_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no +fi +rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +if test $ac_cv_prog_cc_works = no; then + { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:2022: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 +cross_compiling=$ac_cv_prog_cc_cross + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:2027: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +else + GCC= +fi + +ac_test_CFLAGS="${CFLAGS+set}" +ac_save_CFLAGS="$CFLAGS" +CFLAGS= +echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:2055: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi + + + # We must set the default linker to the linker used by gcc for the correct + # operation of libtool. If LD is not defined and we are using gcc, try to + # set the LD default to the ld used by gcc. + if test -z "$LD"; then + if test "$GCC" = yes; then + case $build in + *-*-mingw*) + gcc_prog_ld=`$CC -print-prog-name=ld 2>&1 | tr -d '\015'` ;; + *) + gcc_prog_ld=`$CC -print-prog-name=ld 2>&1` ;; + esac + case $gcc_prog_ld in + # Accept absolute paths. + [\\/]* | [A-Za-z]:[\\/]*) + LD="$gcc_prog_ld" ;; + esac + fi + fi + + CXX=${CXX-"c++"} + CFLAGS=${CFLAGS-"-g"} + CXXFLAGS=${CXXFLAGS-"-g -O2"} +fi + +if test $host != $build; then + ac_tool_prefix=${host_alias}- +else + ac_tool_prefix= +fi + + + +# Extract the first word of "${ac_tool_prefix}gnatbind", so it can be a program name with args. +set dummy ${ac_tool_prefix}gnatbind; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2122: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_GNATBIND'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$GNATBIND"; then + ac_cv_prog_GNATBIND="$GNATBIND" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_GNATBIND="${ac_tool_prefix}gnatbind" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +GNATBIND="$ac_cv_prog_GNATBIND" +if test -n "$GNATBIND"; then + echo "$ac_t""$GNATBIND" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +if test -z "$ac_cv_prog_GNATBIND"; then +if test -n "$ac_tool_prefix"; then + # Extract the first word of "gnatbind", so it can be a program name with args. +set dummy gnatbind; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2154: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_GNATBIND'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$GNATBIND"; then + ac_cv_prog_GNATBIND="$GNATBIND" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_GNATBIND="gnatbind" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_GNATBIND" && ac_cv_prog_GNATBIND="no" +fi +fi +GNATBIND="$ac_cv_prog_GNATBIND" +if test -n "$GNATBIND"; then + echo "$ac_t""$GNATBIND" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +else + GNATBIND="no" +fi +fi + +echo $ac_n "checking whether compiler driver understands Ada""... $ac_c" 1>&6 +echo "configure:2187: checking whether compiler driver understands Ada" >&5 +if eval "test \"`echo '$''{'acx_cv_cc_gcc_supports_ada'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat >conftest.adb <&1 || echo failure` +if test x"$errors" = x && test -f conftest.$ac_objext; then + acx_cv_cc_gcc_supports_ada=yes +fi +rm -f conftest.* +fi + +echo "$ac_t""$acx_cv_cc_gcc_supports_ada" 1>&6 + +if test x$GNATBIND != xno && test x$acx_cv_cc_gcc_supports_ada != xno; then + have_gnat=yes +else + have_gnat=no +fi + +echo $ac_n "checking how to compare bootstrapped objects""... $ac_c" 1>&6 +echo "configure:2219: checking how to compare bootstrapped objects" >&5 +if eval "test \"`echo '$''{'gcc_cv_prog_cmp_skip'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo abfoo >t1 + echo cdfoo >t2 + gcc_cv_prog_cmp_skip='tail +16c $$f1 > tmp-foo1; tail +16c $$f2 > tmp-foo2; cmp tmp-foo1 tmp-foo2' + if cmp t1 t2 2 2 > /dev/null 2>&1; then + if cmp t1 t2 1 1 > /dev/null 2>&1; then + : + else + gcc_cv_prog_cmp_skip='cmp $$f1 $$f2 16 16' + fi + fi + if cmp --ignore-initial=2 t1 t2 > /dev/null 2>&1; then + if cmp --ignore-initial=1 t1 t2 > /dev/null 2>&1; then + : + else + gcc_cv_prog_cmp_skip='cmp --ignore-initial=16 $$f1 $$f2' + fi + fi + rm t1 t2 + +fi + +echo "$ac_t""$gcc_cv_prog_cmp_skip" 1>&6 +do_compare="$gcc_cv_prog_cmp_skip" + + + +# Check for GMP and MPFR +gmplibs= +gmpinc= +have_gmp=yes +# Specify a location for mpfr +# check for this first so it ends up on the link line before gmp. +# Check whether --with-mpfr-dir or --without-mpfr-dir was given. +if test "${with_mpfr_dir+set}" = set; then + withval="$with_mpfr_dir" + : +fi + + +if test "x$with_mpfr_dir" != x; then + gmpinc="-I$with_mpfr_dir" + gmplibs="$with_mpfr_dir/libmpfr.a" +else + gmplibs="-lmpfr" +fi + +# Check whether --with-mpfr or --without-mpfr was given. +if test "${with_mpfr+set}" = set; then + withval="$with_mpfr" + : +fi + + +if test "x$with_mpfr" != x; then + gmplibs="-L$with_mpfr/lib $gmplibs" + gmpinc="-I$with_mpfr/include" +fi + +# Specify a location for gmp +# Check whether --with-gmp-dir or --without-gmp-dir was given. +if test "${with_gmp_dir+set}" = set; then + withval="$with_gmp_dir" + : +fi + + +if test "x$with_gmp_dir" != x; then + gmpinc="$gmpinc -I$with_gmp_dir" + if test -f "$with_gmp_dir/.libs/libgmp.a"; then + gmplibs="$gmplibs $with_gmp_dir/.libs/libgmp.a" + elif test -f "$with_gmp_dir/_libs/libgmp.a"; then + gmplibs="$gmplibs $with_gmp_dir/_libs/libgmp.a" + fi + # One of the later tests will catch the error if neither library is present. +else + gmplibs="$gmplibs -lgmp" +fi + +# Check whether --with-gmp or --without-gmp was given. +if test "${with_gmp+set}" = set; then + withval="$with_gmp" + : +fi + + +if test "x$with_gmp" != x; then + gmplibs="-L$with_gmp/lib $gmplibs" + gmpinc="-I$with_gmp/include $gmpinc" +fi + +saved_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $gmpinc" +# Check GMP actually works +echo $ac_n "checking for correct version of gmp.h""... $ac_c" 1>&6 +echo "configure:2317: checking for correct version of gmp.h" >&5 +cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6; have_gmp=no +fi +rm -f conftest* + +if test x"$have_gmp" = xyes; then + echo $ac_n "checking for MPFR""... $ac_c" 1>&6 +echo "configure:2343: checking for MPFR" >&5 + + saved_LIBS="$LIBS" + LIBS="$LIBS $gmplibs" + cat > conftest.$ac_ext < +#include +int main() { +mpfr_t n; mpfr_init(n); +; return 0; } +EOF +if { (eval echo configure:2356: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6; have_gmp=no +fi +rm -f conftest* + LIBS="$saved_LIBS" + CFLAGS="$saved_CFLAGS" +fi + +# Flags needed for both GMP and/or MPFR + + + +# By default, C is the only stage 1 language. +stage1_languages=c + + +# Figure out what language subdirectories are present. +# Look if the user specified --enable-languages="..."; if not, use +# the environment variable $LANGUAGES if defined. $LANGUAGES might +# go away some day. +# NB: embedded tabs in this IF block -- do not untabify +if test -d ${srcdir}/gcc; then + if test x"${enable_languages+set}" != xset; then + if test x"${LANGUAGES+set}" = xset; then + enable_languages="${LANGUAGES}" + echo configure.in: warning: setting LANGUAGES is deprecated, use --enable-languages instead 1>&2 + else + enable_languages=all + fi + else + if test x"${enable_languages}" = x || + test x"${enable_languages}" = xyes; + then + echo configure.in: --enable-languages needs at least one language argument 1>&2 + exit 1 + fi + fi + enable_languages=`echo "${enable_languages}" | sed -e 's/[ ,][ ,]*/,/g' -e 's/,$//'` + + # 'f95' is the old name for the 'fortran' language. We issue a warning + # and make the substitution. + case ,${enable_languages}, in + *,f95,*) + echo configure.in: warning: 'f95' as language name is deprecated, use 'fortran' instead 1>&2 + enable_languages=`echo "${enable_languages}" | sed -e 's/f95/fortran/g'` + ;; + esac + + # First scan to see if an enabled language requires some other language. + # We assume that a given config-lang.in will list all the language + # front ends it requires, even if some are required indirectly. + for lang_frag in ${srcdir}/gcc/*/config-lang.in .. ; do + case ${lang_frag} in + ..) ;; + # The odd quoting in the next line works around + # an apparent bug in bash 1.12 on linux. + ${srcdir}/gcc/[*]/config-lang.in) ;; + *) + # From the config-lang.in, get $language, $lang_requires + language= + lang_requires= + . ${lang_frag} + for other in ${lang_requires} ; do + case ,${enable_languages}, in + *,$other,*) ;; + *,all,*) ;; + *,$language,*) + echo " \`$other' language required by \`$language'; enabling" 1>&2 + enable_languages="${enable_languages},${other}" + ;; + esac + done + ;; + esac + done + + new_enable_languages=c + missing_languages=`echo ",$enable_languages," | sed -e s/,all,/,/ -e s/,c,/,/ ` + potential_languages=c + + for lang_frag in ${srcdir}/gcc/*/config-lang.in .. ; do + case ${lang_frag} in + ..) ;; + # The odd quoting in the next line works around + # an apparent bug in bash 1.12 on linux. + ${srcdir}/gcc/[*]/config-lang.in) ;; + *) + # From the config-lang.in, get $language, $target_libs, + # $lang_dirs, $boot_language, and $build_by_default + language= + target_libs= + lang_dirs= + boot_language= + build_by_default= + need_gmp= + . ${lang_frag} + potential_languages="${potential_languages},${language}" + # This is quite sensitive to the ordering of the case statement arms. + case ,${enable_languages},:${language}:${have_gnat}:${build_by_default} in + *::*:*) + echo "${lang_frag} doesn't set \$language." 1>&2 + exit 1 + ;; + *:ada:no:*) + # Ada was requested with no preexisting GNAT. Disable unconditionally. + add_this_lang=no + ;; + *,${language},*:*:*:*) + # Language was explicitly selected; include it. + add_this_lang=yes + ;; + *,all,*:*:*:no) + # 'all' was selected, but this is not a default language + # so do not include it. + add_this_lang=no + ;; + *,all,*:*:*:*) + # 'all' was selected and this is a default language; include it. + add_this_lang=yes + ;; + *) + add_this_lang=no + ;; + esac + + # Disable languages that need GMP if it isn't available. + case ,${enable_languages},:${have_gmp}:${need_gmp} in + *,${language},*:no:yes) + # Specifically requested language; tell them. + { echo "configure: error: GMP with MPFR support is required to build $language" 1>&2; exit 1; } + ;; + *:no:yes) + # Silently disable. + add_this_lang=no + ;; + esac + + # Disable a language that is unsupported by the target. + case " $unsupported_languages " in + *" $language "*) + add_this_lang=no + ;; + esac + + case $add_this_lang in + no) + # Remove language-dependent dirs. + eval noconfigdirs='"$noconfigdirs "'\"$target_libs $lang_dirs\" + ;; + *) + new_enable_languages="$new_enable_languages,$language" + missing_languages=`echo "$missing_languages" | sed "s/,$language,/,/"` + case ${boot_language} in + yes) + # Add to (comma-separated) list of stage 1 languages. + stage1_languages="${stage1_languages},${language}" + ;; + esac + ;; + esac + ;; + esac + done + + missing_languages=`echo "$missing_languages" | sed -e "s/^,//" -e "s/,$//"` + if test "x$missing_languages" != x; then + { echo "configure: error: +The following requested languages could not be built: ${missing_languages} +Recognised languages are: ${potential_languages}" 1>&2; exit 1; } + fi + + if test "x$new_enable_languages" != "x$enable_languages"; then + echo The following languages will be built: ${new_enable_languages} + fi + enable_languages="$new_enable_languages" + ac_configure_args=`echo " $ac_configure_args" | sed -e 's/ --enable-languages=[^ ]*//' -e 's/$/ --enable-languages='"$enable_languages"/ ` +fi + +# Handle --disable- generically. +for dir in $configdirs $build_configdirs $target_configdirs ; do + dirname=`echo $dir | sed -e s/target-//g -e s/build-//g -e s/-/_/g` + if eval test x\${enable_${dirname}} "=" xno ; then + noconfigdirs="$noconfigdirs $dir" + fi +done + +# Remove the entries in $skipdirs and $noconfigdirs from $configdirs, +# $build_configdirs and $target_configdirs. +# If we have the source for $noconfigdirs entries, add them to $notsupp. + +notsupp="" +for dir in . $skipdirs $noconfigdirs ; do + dirname=`echo $dir | sed -e s/target-//g -e s/build-//g` + if test $dir != . && echo " ${configdirs} " | grep " ${dir} " >/dev/null 2>&1; then + configdirs=`echo " ${configdirs} " | sed -e "s/ ${dir} / /"` + if test -r $srcdir/$dirname/configure ; then + if echo " ${skipdirs} " | grep " ${dir} " >/dev/null 2>&1; then + true + else + notsupp="$notsupp $dir" + fi + fi + fi + if test $dir != . && echo " ${build_configdirs} " | grep " ${dir} " >/dev/null 2>&1; then + build_configdirs=`echo " ${build_configdirs} " | sed -e "s/ ${dir} / /"` + if test -r $srcdir/$dirname/configure ; then + if echo " ${skipdirs} " | grep " ${dir} " >/dev/null 2>&1; then + true + else + notsupp="$notsupp $dir" + fi + fi + fi + if test $dir != . && echo " ${target_configdirs} " | grep " ${dir} " >/dev/null 2>&1; then + target_configdirs=`echo " ${target_configdirs} " | sed -e "s/ ${dir} / /"` + if test -r $srcdir/$dirname/configure ; then + if echo " ${skipdirs} " | grep " ${dir} " >/dev/null 2>&1; then + true + else + notsupp="$notsupp $dir" + fi + fi + fi +done + +# Sometimes the tools are distributed with libiberty but with no other +# libraries. In that case, we don't want to build target-libiberty. +if test -n "${target_configdirs}" ; then + others= + for i in `echo ${target_configdirs} | sed -e s/target-//g` ; do + if test "$i" != "libiberty" ; then + if test -r $srcdir/$i/configure ; then + others=yes; + break; + fi + fi + done + if test -z "${others}" ; then + target_configdirs= + fi +fi + +# Quietly strip out all directories which aren't configurable in this tree. +# This relies on all configurable subdirectories being autoconfiscated, which +# is now the case. +build_configdirs_all="$build_configdirs" +build_configdirs= +for i in ${build_configdirs_all} ; do + j=`echo $i | sed -e s/build-//g` + if test -f ${srcdir}/$j/configure ; then + build_configdirs="${build_configdirs} $i" + fi +done + +configdirs_all="$configdirs" +configdirs= +for i in ${configdirs_all} ; do + if test -f ${srcdir}/$i/configure ; then + configdirs="${configdirs} $i" + fi +done + +target_configdirs_all="$target_configdirs" +target_configdirs= +for i in ${target_configdirs_all} ; do + j=`echo $i | sed -e s/target-//g` + if test -f ${srcdir}/$j/configure ; then + target_configdirs="${target_configdirs} $i" + fi +done + +# Produce a warning message for the subdirs we can't configure. +# This isn't especially interesting in the Cygnus tree, but in the individual +# FSF releases, it's important to let people know when their machine isn't +# supported by the one or two programs in a package. + +if test -n "${notsupp}" && test -z "${norecursion}" ; then + # If $appdirs is non-empty, at least one of those directories must still + # be configured, or we error out. (E.g., if the gas release supports a + # specified target in some subdirs but not the gas subdir, we shouldn't + # pretend that all is well.) + if test -n "$appdirs" ; then + for dir in $appdirs ; do + if test -r $dir/Makefile.in ; then + if echo " ${configdirs} " | grep " ${dir} " >/dev/null 2>&1; then + appdirs="" + break + fi + if echo " ${target_configdirs} " | grep " target-${dir} " >/dev/null 2>&1; then + appdirs="" + break + fi + fi + done + if test -n "$appdirs" ; then + echo "*** This configuration is not supported by this package." 1>&2 + exit 1 + fi + fi + # Okay, some application will build, or we don't care to check. Still + # notify of subdirs not getting built. + echo "*** This configuration is not supported in the following subdirectories:" 1>&2 + echo " ${notsupp}" 1>&2 + echo " (Any other directories should still work fine.)" 1>&2 +fi + +case "$host" in + *msdosdjgpp*) + enable_gdbtk=no ;; +esac + +copy_dirs= + +# Check whether --with-build-sysroot or --without-build-sysroot was given. +if test "${with_build_sysroot+set}" = set; then + withval="$with_build_sysroot" + if test x"$withval" != x ; then + SYSROOT_CFLAGS_FOR_TARGET="--sysroot=$withval" + fi +else + SYSROOT_CFLAGS_FOR_TARGET= +fi + + + +# Handle --with-headers=XXX. If the value is not "yes", the contents of +# the named directory are copied to $(tooldir)/sys-include. +if test x"${with_headers}" != x && test x"${with_headers}" != xno ; then + if test x${is_cross_compiler} = xno ; then + echo 1>&2 '***' --with-headers is only supported when cross compiling + exit 1 + fi + if test x"${with_headers}" != xyes ; then + case "${exec_prefixoption}" in + "") x=${prefix} ;; + *) x=${exec_prefix} ;; + esac + copy_dirs="${copy_dirs} ${with_headers} $x/${target_alias}/sys-include" + fi +fi + +# Handle --with-libs=XXX. If the value is not "yes", the contents of +# the name directories are copied to $(tooldir)/lib. Multiple directories +# are permitted. +if test x"${with_libs}" != x && test x"${with_libs}" != xno ; then + if test x${is_cross_compiler} = xno ; then + echo 1>&2 '***' --with-libs is only supported when cross compiling + exit 1 + fi + if test x"${with_libs}" != xyes ; then + # Copy the libraries in reverse order, so that files in the first named + # library override files in subsequent libraries. + case "${exec_prefixoption}" in + "") x=${prefix} ;; + *) x=${exec_prefix} ;; + esac + for l in ${with_libs}; do + copy_dirs="$l $x/${target_alias}/lib ${copy_dirs}" + done + fi +fi + +# Set with_gnu_as and with_gnu_ld as appropriate. +# +# This is done by determining whether or not the appropriate directory +# is available, and by checking whether or not specific configurations +# have requested that this magic not happen. +# +# The command line options always override the explicit settings in +# configure.in, and the settings in configure.in override this magic. +# +# If the default for a toolchain is to use GNU as and ld, and you don't +# want to do that, then you should use the --without-gnu-as and +# --without-gnu-ld options for the configure script. + +if test x${use_gnu_as} = x && + echo " ${configdirs} " | grep " gas " > /dev/null 2>&1 ; then + with_gnu_as=yes + extra_host_args="$extra_host_args --with-gnu-as" +fi + +if test x${use_gnu_ld} = x && + echo " ${configdirs} " | grep " ld " > /dev/null 2>&1 ; then + with_gnu_ld=yes + extra_host_args="$extra_host_args --with-gnu-ld" +fi + +# If using newlib, add --with-newlib to the extra_host_args so that gcc/configure +# can detect this case. + +if test x${with_newlib} != xno && echo " ${target_configdirs} " | grep " target-newlib " > /dev/null 2>&1 ; then + with_newlib=yes + extra_host_args="$extra_host_args --with-newlib" +fi + +# Handle ${copy_dirs} +set fnord ${copy_dirs} +shift +while test $# != 0 ; do + if test -f $2/COPIED && test x"`cat $2/COPIED`" = x"$1" ; then + : + else + echo Copying $1 to $2 + + # Use the install script to create the directory and all required + # parent directories. + if test -d $2 ; then + : + else + echo >config.temp + ${srcdir}/install-sh -c -m 644 config.temp $2/COPIED + fi + + # Copy the directory, assuming we have tar. + # FIXME: Should we use B in the second tar? Not all systems support it. + (cd $1; tar -cf - .) | (cd $2; tar -xpf -) + + # It is the responsibility of the user to correctly adjust all + # symlinks. If somebody can figure out how to handle them correctly + # here, feel free to add the code. + + echo $1 > $2/COPIED + fi + shift; shift +done + +# Determine a target-dependent exec_prefix that the installed +# gcc will search in. Keep this list sorted by triplet, with +# the *-*-osname triplets last. +md_exec_prefix= +case "${target}" in + alpha*-*-*vms*) + md_exec_prefix=/gnu/lib/gcc-lib + ;; + i3456786-pc-msdosdjgpp*) + md_exec_prefix=/dev/env/DJDIR/bin + ;; + i3456786-*-sco3.2v5*) + if test $with_gnu_as = yes; then + md_exec_prefix=/usr/gnu/bin + else + md_exec_prefix=/usr/ccs/bin/elf + fi + ;; + + mn10300-*-* | \ + powerpc-*-chorusos* | \ + powerpc*-*-eabi* | \ + powerpc*-*-sysv* | \ + powerpc*-*-kaos* | \ + s390x-ibm-tpf*) + md_exec_prefix=/usr/ccs/bin + ;; + sparc64-*-elf*) + ;; + v850*-*-*) + md_exec_prefix=/usr/ccs/bin + ;; + xtensa-*-elf*) + ;; + + *-*-beos* | \ + *-*-elf* | \ + *-*-hpux* | \ + *-*-netware* | \ + *-*-nto-qnx* | \ + *-*-rtems* | \ + *-*-solaris2* | \ + *-*-sysv45* | \ + *-*-vxworks* | \ + *-wrs-windiss) + md_exec_prefix=/usr/ccs/bin + ;; +esac + extra_arflags_for_target= extra_nmflags_for_target= extra_ranlibflags_for_target= target_makefile_frag=/dev/null case "${target}" in - i[3456789]86-*-netware*) + *-*-netware*) target_makefile_frag="config/mt-netware" ;; - powerpc-*-netware*) - target_makefile_frag="config/mt-netware" - ;; - *-*-linux*) - target_makefile_frag="config/mt-linux" + *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu) + target_makefile_frag="config/mt-gnu" ;; *-*-aix4.[3456789]* | *-*-aix[56789].*) # nm and ar from AIX 4.3 and above require -X32_64 flag to all ar and nm @@ -1988,40 +2890,6 @@ case "${enable_target_optspace}:${target}" in ;; esac -# Set with_gnu_as and with_gnu_ld as appropriate. -# -# This is done by determining whether or not the appropriate directory -# is available, and by checking whether or not specific configurations -# have requested that this magic not happen. -# -# The command line options always override the explicit settings in -# configure.in, and the settings in configure.in override this magic. -# -# If the default for a toolchain is to use GNU as and ld, and you don't -# want to do that, then you should use the --without-gnu-as and -# --without-gnu-ld options for the configure script. - -if test x${use_gnu_as} = x && - echo " ${configdirs} " | grep " gas " > /dev/null 2>&1 ; then - with_gnu_as=yes - extra_host_args="$extra_host_args --with-gnu-as" -fi - -if test x${use_gnu_ld} = x && - echo " ${configdirs} " | grep " ld " > /dev/null 2>&1 ; then - with_gnu_ld=yes - extra_host_args="$extra_host_args --with-gnu-ld" -fi - -# If using newlib, add --with-newlib to the extra_host_args so that gcc/configure -# can detect this case. - -if test x${with_newlib} != xno && echo " ${target_configdirs} " | grep " target-newlib " > /dev/null 2>&1 ; then - with_newlib=yes - extra_host_args="$extra_host_args --with-newlib" -fi - - # Default to using --with-stabs for certain targets. if test x${with_stabs} = x ; then case "${target}" in @@ -2042,282 +2910,11 @@ case "${host}" in ;; esac -# If we aren't going to be using gcc, see if we can extract a definition -# of CC from the fragment. -# Actually, use the 'pre-extracted' version above. -if test -z "${CC}" && test "${build}" = "${host}" ; then - IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" - found= - for dir in $PATH; do - test -z "$dir" && dir=. - if test -f $dir/gcc; then - found=yes - break - fi - done - IFS="$save_ifs" - if test -z "${found}" && test -n "${tentative_cc}" ; then - CC=$tentative_cc - fi -fi - # Some systems (e.g., one of the i386-aix systems the gas testers are # using) don't handle "\$" correctly, so don't use it here. tooldir='${exec_prefix}'/${target_alias} build_tooldir=${tooldir} -# Generate a default definition for YACC. This is used if the makefile can't -# locate bison or byacc in objdir. - -for prog in 'bison -y' byacc yacc -do - set dummy $prog; tmp=$2 - IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" - for dir in $PATH; do - test -z "$dir" && dir=. - if test -f $dir/$tmp; then - DEFAULT_YACC="$prog" - break - fi - done - IFS="$save_ifs" - - test -n "$DEFAULT_YACC" && break -done - -# Generate a default definition for M4. This is used if the makefile can't -# locate m4 in objdir. - -for prog in gm4 gnum4 m4 -do - set dummy $prog; tmp=$2 - IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" - for dir in $PATH; do - test -z "$dir" && dir=. - if test -f $dir/$tmp; then - DEFAULT_M4="$prog" - break - fi - done - IFS="$save_ifs" - - test -n "$DEFAULT_M4" && break -done - -# Generate a default definition for LEX. This is used if the makefile can't -# locate flex in objdir. - -for prog in flex lex -do - set dummy $prog; tmp=$2 - IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" - for dir in $PATH; do - test -z "$dir" && dir=. - if test -f $dir/$tmp; then - DEFAULT_LEX="$prog" - break - fi - done - IFS="$save_ifs" - - test -n "$DEFAULT_LEX" && break -done - -if test "${build}" != "${host}" ; then - # If we are doing a Canadian Cross, in which the host and build systems - # are not the same, we set reasonable default values for the tools. - - BISON=${BISON-bison} - CC=${CC-${host_alias}-gcc} - CFLAGS=${CFLAGS-"-g -O2"} - CXX=${CXX-${host_alias}-c++} - CXXFLAGS=${CXXFLAGS-"-g -O2"} - CC_FOR_BUILD=${CC_FOR_BUILD-gcc} - CC_FOR_TARGET=${CC_FOR_TARGET-${target_alias}-gcc} - CXX_FOR_TARGET=${CXX_FOR_TARGET-${target_alias}-c++} - GCJ_FOR_TARGET=${GCJ_FOR_TARGET-${target_alias}-gcj} - GCC_FOR_TARGET=${GCC_FOR_TARGET-${CC_FOR_TARGET-${target_alias}-gcc}} - BUILD_PREFIX=${build_alias}- - BUILD_PREFIX_1=${build_alias}- - MAKEINFO=${MAKEINFO-makeinfo} - - if test -z "${YACC}" ; then - IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" - for dir in $PATH; do - test -z "$dir" && dir=. - if test -f $dir/bison; then - YACC="bison -y" - break - fi - if test -f $dir/byacc; then - YACC=byacc - break - fi - if test -f $dir/yacc; then - YACC=yacc - break - fi - done - IFS="$save_ifs" - if test -z "${YACC}" ; then - YACC="bison -y" - fi - fi - - if test -z "${LEX}" ; then - IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" - for dir in $PATH; do - test -z "$dir" && dir=. - if test -f $dir/flex; then - LEX=flex - break - fi - if test -f $dir/lex; then - LEX=lex - break - fi - done - IFS="$save_ifs" - LEX=${LEX-flex} - fi - -else - # Set reasonable default values for some tools even if not Canadian. - # Of course, these are different reasonable default values, originally - # specified directly in the Makefile. - # We don't export, so that autoconf can do its job. - # Note that all these settings are above the fragment inclusion point - # in Makefile.in, so can still be overridden by fragments. - # This is all going to change when we autoconfiscate... - - BISON="\$(USUAL_BISON)" - CC_FOR_BUILD="\$(CC)" - GCC_FOR_TARGET="\$(USUAL_GCC_FOR_TARGET)" - BUILD_PREFIX= - BUILD_PREFIX_1=loser- - MAKEINFO="\$(USUAL_MAKEINFO)" - LEX="\$(USUAL_LEX)" - YACC="\$(USUAL_YACC)" - - # If CC is still not set, try to get gcc. - cc_prog_is_gcc= - if test -z "${CC}" ; then - IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" - for dir in $PATH; do - test -z "$dir" && dir=. - if test -f $dir/gcc; then - CC="gcc" - cc_prog_is_gcc=yes - echo 'void f(){}' > conftest.c - if test -z "`${CC} -g -c conftest.c 2>&1`"; then - CFLAGS=${CFLAGS-"-g -O2"} - CXXFLAGS=${CXXFLAGS-"-g -O2"} - else - CFLAGS=${CFLAGS-"-O2"} - CXXFLAGS=${CXXFLAGS-"-O2"} - fi - rm -f conftest* - break - fi - done - IFS="$save_ifs" - CC=${CC-cc} - else - # Determine if we are using gcc. - cat > conftest.c </dev/null 2>&1; then - cc_prog_is_gcc=yes - fi - rm -f conftest.c - if test -z "${CFLAGS}"; then - # Here CC is set but CFLAGS is not. Use a quick hack to use -O2 if CC - # is set to a version of gcc. - if test "$cc_prog_is_gcc" = yes; then - echo 'void f(){}' > conftest.c - if test -z "`${CC} -g -c conftest.c 2>&1`"; then - CFLAGS=${CFLAGS-"-g -O2"} - CXXFLAGS=${CXXFLAGS-"-g -O2"} - else - CFLAGS=${CFLAGS-"-O2"} - CXXFLAGS=${CXXFLAGS-"-O2"} - fi - rm -f conftest* - fi - fi - fi - - # We must set the default linker to the linker used by gcc for the correct - # operation of libtool. If LD is not defined and we are using gcc, try to - # set the LD default to the ld used by gcc. - if test -z "$LD"; then - if test "$cc_prog_is_gcc" = yes; then - case $build in - *-*-mingw*) - gcc_prog_ld=`$CC -print-prog-name=ld 2>&1 | tr -d '\015'` ;; - *) - gcc_prog_ld=`$CC -print-prog-name=ld 2>&1` ;; - esac - case $gcc_prog_ld in - # Accept absolute paths. - [\\/]* | [A-Za-z]:[\\/]*) - LD="$gcc_prog_ld" ;; - esac - fi - fi - - CXX=${CXX-"c++"} - CFLAGS=${CFLAGS-"-g"} - CXXFLAGS=${CXXFLAGS-"-g -O2"} -fi - -# FIXME Should this be done recursively ??? (Useful for e.g. gdbtest) -# Set up the list of links to be made. -# ${links} is the list of link names, and ${files} is the list of names to link to. - -# Make the links. -configlinks="${links}" -if test -r ./config.status ; then - mv -f ./config.status ./config.back -fi -while test -n "${files}" ; do - # set file to car of files, files to cdr of files - set ${files}; file=$1; shift; files=$* - set ${links}; link=$1; shift; links=$* - - if test ! -r ${srcdir}/${file} ; then - if test ! -r ${file} ; then - echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2 - echo '***' "since the file \"${srcdir}/${file}\" does not exist." 1>&2 - exit 1 - else - srcfile=${file} - fi - else - srcfile=${srcdir}/${file} - fi - - ${remove} -f ${link} - # Make a symlink if possible, otherwise try a hard link - if ${symbolic_link} ${srcfile} ${link} >/dev/null 2>&1 ; then - true - else - # We need to re-remove the file because Lynx leaves a - # very strange directory there when it fails an NFS symlink. - ${remove} -r -f ${link} - ${hard_link} ${srcfile} ${link} - fi - if test ! -r ${link} ; then - echo '***' "${progname}: unable to link \"${link}\" to \"${srcfile}\"." 1>&2 - exit 1 - fi - - echo "Linked \"${link}\" to \"${srcfile}\"." -done - # Create a .gdbinit file which runs the one in srcdir # and tells GDB to look there for source files. @@ -2384,32 +2981,16 @@ case "${host}" in ;; esac -# If --enable-shared was set, we must set LD_LIBRARY_PATH so that the -# binutils tools will find libbfd.so. -case "${enable_shared}" in - no | "") SET_LIB_PATH= ;; - *) SET_LIB_PATH="\$(REALLY_SET_LIB_PATH)" ;; -esac - case "${host}" in *-*-hpux*) RPATH_ENVVAR=SHLIB_PATH ;; + *-*-darwin* | *-*-rhapsody* ) RPATH_ENVVAR=DYLD_LIBRARY_PATH ;; *) RPATH_ENVVAR=LD_LIBRARY_PATH ;; esac # Record target_configdirs and the configure arguments for target and # build configuration in Makefile. target_configdirs=`echo "${target_configdirs}" | sed -e 's/target-//g'` - -# This is the final value for target_configdirs. configdirs already -# has its final value, as does build_modules. It's time to create some -# lists of valid targets. - -all_build_modules= -configure_build_modules= -for module in ${build_modules} ; do - all_build_modules=all-build-${module} - configure_build_modules=configure-build-${module} -done +build_configdirs=`echo "${build_configdirs}" | sed -e 's/build-//g'` # Determine whether gdb needs tk/tcl or not. # Use 'maybe' since enable_gdbtk might be true even if tk isn't available @@ -2419,7 +3000,7 @@ done # leave out the maybe dependencies when enable_gdbtk is false. I'm not # 100% sure that that's safe though. -gdb_tk="maybe-all-tcl maybe-all-tk maybe-all-itcl maybe-all-tix maybe-all-libgui" +gdb_tk="maybe-all-tcl maybe-all-tk maybe-all-itcl maybe-all-libgui" case "$enable_gdbtk" in no) GDB_TK="" ;; @@ -2436,42 +3017,102 @@ case "$enable_gdbtk" in fi ;; esac +CONFIGURE_GDB_TK=`echo ${GDB_TK} | sed s/-all-/-configure-/g` +INSTALL_GDB_TK=`echo ${GDB_TK} | sed s/-all-/-install-/g` -# Create the 'maybe dependencies'. This uses a temporary file. +# Strip out unwanted targets. # While at that, we remove Makefiles if we were started for recursive # configuration, so that the top-level Makefile reconfigures them, # like we used to do when configure itself was recursive. -rm -f maybedep.tmp -echo '# maybedep.tmp' > maybedep.tmp -# Make-targets which may need maybe dependencies. -mts="configure all install check clean distclean dvi info install-info" -mts="${mts} installcheck mostlyclean maintainer-clean TAGS" +# Loop over modules. $extrasub must be used with care, limiting as +# much as possible the usage of range addresses. That's because autoconf +# splits the sed script to overcome limits in the number of commands, +# and relying on carefully-timed sed passes may turn out to be very hard +# to maintain later. In this particular case, you just have to be careful +# not to nest @if/@endif pairs, because configure will not warn you at all. -# Loop over modules and make-targets. -for module in ${build_modules} ; do +# Check whether --enable-bootstrap or --disable-bootstrap was given. +if test "${enable_bootstrap+set}" = set; then + enableval="$enable_bootstrap" + : +else + enable_bootstrap=default +fi + + +# Issue errors and warnings for invalid/strange bootstrap combinations. +case "$configdirs" in + *gcc*) have_compiler=yes ;; + *) have_compiler=no ;; +esac + +case "$have_compiler:$host:$target:$enable_bootstrap" in + *:*:*:no) ;; + + # Default behavior. Enable bootstrap if we have a compiler + # and we are in a native configuration. + yes:$build:$build:default) + enable_bootstrap=yes ;; + + *:*:*:default) + enable_bootstrap=no ;; + + # We have a compiler and we are in a native configuration, bootstrap is ok + yes:$build:$build:yes) + ;; + + # Other configurations, but we have a compiler. Assume the user knows + # what he's doing. + yes:*:*:yes) + echo "configure: warning: trying to bootstrap a cross compiler" 1>&2 + ;; + + # No compiler: if they passed --enable-bootstrap explicitly, fail + no:*:*:yes) + { echo "configure: error: cannot bootstrap without a compiler" 1>&2; exit 1; } ;; + + # Fail if wrong command line + *) + { echo "configure: error: invalid option for --enable-bootstrap" 1>&2; exit 1; } + ;; +esac + +# Adjust the toplevel makefile according to whether bootstrap was selected. +case "$enable_bootstrap" in + yes) + bootstrap_suffix=bootstrap ;; + no) + bootstrap_suffix=no-bootstrap ;; +esac + +for module in ${build_configdirs} ; do if test -z "${no_recursion}" \ && test -f ${build_subdir}/${module}/Makefile; then echo 1>&2 "*** removing ${build_subdir}/${module}/Makefile to force reconfigure" rm -f ${build_subdir}/${module}/Makefile fi - for mt in ${mts} ; do - case ${mt} in - install) ;; # No installing build modules. - *) echo "maybe-${mt}-build-${module}: ${mt}-build-${module}" >> maybedep.tmp ;; - esac - done + extrasub="$extrasub +/^@if build-$module\$/d +/^@endif build-$module\$/d +/^@if build-$module-$bootstrap_suffix\$/d +/^@endif build-$module-$bootstrap_suffix\$/d" done for module in ${configdirs} ; do - if test -z "${no_recursion}" \ - && test -f ${module}/Makefile; then - echo 1>&2 "*** removing ${module}/Makefile to force reconfigure" - rm -f ${module}/Makefile + if test -z "${no_recursion}"; then + for file in stage*-${module}/Makefile ${module}/Makefile; do + if test -f ${file}; then + echo 1>&2 "*** removing ${file} to force reconfigure" + rm -f ${file} + fi + done fi - for mt in ${mts} ; do - echo "maybe-${mt}-${module}: ${mt}-${module}" >> maybedep.tmp - done + extrasub="$extrasub +/^@if $module\$/d +/^@endif $module\$/d +/^@if $module-$bootstrap_suffix\$/d +/^@endif $module-$bootstrap_suffix\$/d" done for module in ${target_configdirs} ; do if test -z "${no_recursion}" \ @@ -2479,12 +3120,15 @@ for module in ${target_configdirs} ; do echo 1>&2 "*** removing ${target_subdir}/${module}/Makefile to force reconfigure" rm -f ${target_subdir}/${module}/Makefile fi - for mt in ${mts} ; do - echo "maybe-${mt}-target-${module}: ${mt}-target-${module}" >> maybedep.tmp - done + extrasub="$extrasub +/^@if target-$module\$/d +/^@endif target-$module\$/d +/^@if target-$module-$bootstrap_suffix\$/d +/^@endif target-$module-$bootstrap_suffix\$/d" done -maybe_dependencies=maybedep.tmp +extrasub="$extrasub +/^@if /,/^@endif /d" # Create the serialization dependencies. This uses a temporary file. @@ -2548,21 +3192,21 @@ serialization_dependencies=serdep.tmp # at the end of the argument list. # These will be expanded by make, so quote '$'. cat <<\EOF_SED > conftestsed -s/ --no[^ ]* / / -s/ --c[a-z-]*[= ][^ ]* / / -s/ --sr[a-z-]*[= ][^ ]* / / -s/ --ho[a-z-]*[= ][^ ]* / / -s/ --bu[a-z-]*[= ][^ ]* / / -s/ --t[a-z-]*[= ][^ ]* / / -s/ --program-[pst][a-z-]*[= ][^ ]* / / -s/ -cache-file[= ][^ ]* / / -s/ -srcdir[= ][^ ]* / / -s/ -host[= ][^ ]* / / -s/ -build[= ][^ ]* / / -s/ -target[= ][^ ]* / / -s/ -program-prefix[= ][^ ]* / / -s/ -program-suffix[= ][^ ]* / / -s/ -program-transform-name[= ][^ ]* / / +s/ --no[^ ]*/ /g +s/ --c[a-z-]*[= ][^ ]*//g +s/ --sr[a-z-]*[= ][^ ]*//g +s/ --ho[a-z-]*[= ][^ ]*//g +s/ --bu[a-z-]*[= ][^ ]*//g +s/ --t[a-z-]*[= ][^ ]*//g +s/ --program-[pst][a-z-]*[= ][^ ]*//g +s/ -cache-file[= ][^ ]*//g +s/ -srcdir[= ][^ ]*//g +s/ -host[= ][^ ]*//g +s/ -build[= ][^ ]*//g +s/ -target[= ][^ ]*//g +s/ -program-prefix[= ][^ ]*//g +s/ -program-suffix[= ][^ ]*//g +s/ -program-transform-name[= ][^ ]*//g s/ [^' -][^ ]* / / s/^ *//;s/ *$// s,\$,$$,g @@ -2590,7 +3234,7 @@ baseargs="$baseargs --program-transform-name='${gcc_transform_name}'" # For the build-side libraries, we just need to pretend we're native, # and not use the same cache file. Multilibs are neither needed nor # desired. -build_configargs="--cache-file=../config.cache --build=${build_alias} --host=${build_alias} ${baseargs}" +build_configargs="--cache-file=../config.cache --build=${build_alias} --host=${build_alias} --target=${target_alias} ${baseargs}" # For host modules, accept cache file option, or specification as blank. case "${cache_file}" in @@ -2637,26 +3281,10 @@ fi # fixed in future. It's still worthwhile to use a cache file for each # directory. I think. -# Pass the appropriate --host, --build, and --cache-file arguments. -target_configargs="--cache-file=./config.cache --host=${target_alias} --build=${build_alias} ${target_configargs}" - -# provide a proper gxx_include_dir. -# Note, if you change the default, make sure to fix both here and in -# the gcc and libstdc++-v3 subdirectories. -# Check whether --with-gxx-include-dir or --without-gxx-include-dir was given. -case "${with_gxx_include_dir}" in - yes) - { echo "configure: error: --with-gxx-include-dir=[dir] requires a directory" 1>&2; exit 1; } - ;; - no | "") - case "${enable_version_specific_runtime_libs}" in - yes) gxx_include_dir='${libsubdir}/include/c++' ;; - *) - . ${srcdir}/config.if - gxx_include_dir='${prefix}/include/'${libstdcxx_incdir} ;; - esac ;; - *) gxx_include_dir=${with_gxx_include_dir} ;; -esac +# Pass the appropriate --build, --host, --target and --cache-file arguments. +# We need to pass --target, as newer autoconf's requires consistency +# for target_alias and gcc doesn't manage it consistently. +target_configargs="--cache-file=./config.cache --build=${build_alias} --host=${target_alias} --target=${target_alias} ${target_configargs}" FLAGS_FOR_TARGET= case " $target_configdirs " in @@ -2678,7 +3306,7 @@ case " $target_configdirs " in # to it. This is right: we don't want to search that directory # for binaries, but we want the header files in there, so add # them explicitly. - FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -isystem $$r/gcc/include' + FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -isystem $$r/$(HOST_SUBDIR)/gcc/include' # Someone might think of using the pre-installed headers on # Canadian crosses, in case the installed compiler is not fully @@ -2725,82 +3353,17 @@ fi if test "x${use_gnu_ld}" = x && echo " ${configdirs} " | grep " ld " > /dev/null ; then # Arrange for us to find uninstalled linker scripts. - FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/ld' + FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/$(HOST_SUBDIR)/ld' fi -if test "x${CC_FOR_TARGET+set}" = xset; then - : -elif test -d ${srcdir}/gcc; then - CC_FOR_TARGET='$$r/gcc/xgcc -B$$r/gcc/' -elif test "$host" = "$target"; then - CC_FOR_TARGET='$(CC)' -else - CC_FOR_TARGET=`echo gcc | sed "${program_transform_name}"` -fi -CC_FOR_TARGET=$CC_FOR_TARGET' $(FLAGS_FOR_TARGET)' - -if test "x${GCJ_FOR_TARGET+set}" = xset; then - : -elif test -d ${srcdir}/gcc; then - GCJ_FOR_TARGET='$$r/gcc/gcj -B$$r/gcc/' -elif test "$host" = "$target"; then - GCJ_FOR_TARGET='gcj' -else - GCJ_FOR_TARGET=`echo gcj | sed "${program_transform_name}"` -fi -GCJ_FOR_TARGET=$GCJ_FOR_TARGET' $(FLAGS_FOR_TARGET)' - -# Don't use libstdc++-v3's flags to configure/build itself. -libstdcxx_flags='`test ! -f $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags || $(SHELL) $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags --build-includes` -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs' -raw_libstdcxx_flags='-L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs' - -if test "x${CXX_FOR_TARGET+set}" = xset; then - if test "x${RAW_CXX_FOR_TARGET+set}" != xset; then - RAW_CXX_FOR_TARGET=${CXX_FOR_TARGET} - fi -elif test -d ${srcdir}/gcc; then - # We add -shared-libgcc to CXX_FOR_TARGET whenever we use xgcc instead - # of g++ for linking C++ or Java, because g++ has -shared-libgcc by - # default whereas gcc does not. - # RAW_CXX_FOR_TARGET is for linking C++ or java; CXX_FOR_TARGET is for - # all other cases. - CXX_FOR_TARGET='$$r/gcc/g++ -B$$r/gcc/ -nostdinc++ '$libstdcxx_flags - RAW_CXX_FOR_TARGET='$$r/gcc/xgcc -shared-libgcc -B$$r/gcc/ -nostdinc++ '$raw_libstdcxx_flags -elif test "$host" = "$target"; then - CXX_FOR_TARGET='$(CXX)' - RAW_CXX_FOR_TARGET=${CXX_FOR_TARGET} -else - CXX_FOR_TARGET=`echo c++ | sed "${program_transform_name}"` - RAW_CXX_FOR_TARGET=${CXX_FOR_TARGET} -fi -CXX_FOR_TARGET=$CXX_FOR_TARGET' $(FLAGS_FOR_TARGET)' -RAW_CXX_FOR_TARGET=$RAW_CXX_FOR_TARGET' $(FLAGS_FOR_TARGET)' - -qCXX_FOR_TARGET=`echo "$CXX_FOR_TARGET" | sed 's,[&%],\\\&,g'` -qRAW_CXX_FOR_TARGET=`echo "$RAW_CXX_FOR_TARGET" | sed 's,[&%],\\\&,g'` - -# We want to defer the evaluation of `cmd`s and shell variables in -# CXX_FOR_TARGET when recursing in the top-level Makefile, such as for -# bootstrap. We'll enclose CXX_FOR_TARGET_FOR_RECURSIVE_MAKE in single -# quotes, but we still have to duplicate `$'s so that shell variables -# can be expanded by the nested make as shell variables, not as make -# macros. -qqCXX_FOR_TARGET=`echo "$qCXX_FOR_TARGET" | sed -e 's,[$][$],$$$$,g'` -qqRAW_CXX_FOR_TARGET=`echo "$qRAW_CXX_FOR_TARGET" | sed -e 's,[$][$],$$$$,g'` - -# Wrap CC_FOR_TARGET and friends, for certain types of builds. -CC_FOR_TARGET="\$(STAGE_CC_WRAPPER) ${CC_FOR_TARGET}" -GCJ_FOR_TARGET="\$(STAGE_CC_WRAPPER) ${GCJ_FOR_TARGET}" -CXX_FOR_TARGET="\$(STAGE_CC_WRAPPER) ${qCXX_FOR_TARGET}" -RAW_CXX_FOR_TARGET="\$(STAGE_CC_WRAPPER) ${qRAW_CXX_FOR_TARGET}" -CXX_FOR_TARGET_FOR_RECURSIVE_MAKE="\$(STAGE_CC_WRAPPER) ${qqCXX_FOR_TARGET}" -RAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE="\$(STAGE_CC_WRAPPER) ${qqRAW_CXX_FOR_TARGET}" - # Makefile fragments. -host_makefile_frag=${srcdir}/${host_makefile_frag} -target_makefile_frag=${srcdir}/${target_makefile_frag} -alphaieee_frag=${srcdir}/${alphaieee_frag} -ospace_frag=${srcdir}/${ospace_frag} +for frag in host_makefile_frag target_makefile_frag alphaieee_frag ospace_frag; +do + eval fragval=\$$frag + if test $fragval != /dev/null; then + eval $frag=${srcdir}/$fragval + fi +done @@ -2814,17 +3377,10 @@ ospace_frag=${srcdir}/${ospace_frag} - - - - - - # Build module lists & subconfigure args. - # Host module lists & subconfigure args. @@ -2837,8 +3393,342 @@ ospace_frag=${srcdir}/${ospace_frag} +# Generate default definitions for YACC, M4, LEX and other programs that run +# on the build machine. These are used if the Makefile can't locate these +# programs in objdir. +MISSING=`cd $ac_aux_dir && ${PWDCMD-pwd}`/missing +for ac_prog in 'bison -y' byacc yacc +do +# Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:3407: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$YACC"; then + ac_cv_prog_YACC="$YACC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_YACC="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +YACC="$ac_cv_prog_YACC" +if test -n "$YACC"; then + echo "$ac_t""$YACC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi +test -n "$YACC" && break +done +test -n "$YACC" || YACC="$MISSING bison -y" + +case " $build_configdirs " in + *" bison "*) YACC='$$r/$(BUILD_SUBDIR)/bison/tests/bison -y' ;; + *" byacc "*) YACC='$$r/$(BUILD_SUBDIR)/byacc/byacc' ;; +esac + +for ac_prog in bison +do +# Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:3447: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_BISON'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$BISON"; then + ac_cv_prog_BISON="$BISON" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_BISON="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +BISON="$ac_cv_prog_BISON" +if test -n "$BISON"; then + echo "$ac_t""$BISON" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$BISON" && break +done +test -n "$BISON" || BISON="$MISSING bison" + +case " $build_configdirs " in + *" bison "*) BISON='$$r/$(BUILD_SUBDIR)/bison/tests/bison' ;; +esac + +for ac_prog in gm4 gnum4 m4 +do +# Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:3486: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_M4'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$M4"; then + ac_cv_prog_M4="$M4" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_M4="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +M4="$ac_cv_prog_M4" +if test -n "$M4"; then + echo "$ac_t""$M4" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$M4" && break +done +test -n "$M4" || M4="$MISSING m4" + +case " $build_configdirs " in + *" m4 "*) M4='$$r/$(BUILD_SUBDIR)/m4/m4' ;; +esac + +for ac_prog in flex lex +do +# Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:3525: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$LEX"; then + ac_cv_prog_LEX="$LEX" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_LEX="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +LEX="$ac_cv_prog_LEX" +if test -n "$LEX"; then + echo "$ac_t""$LEX" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$LEX" && break +done +test -n "$LEX" || LEX="$MISSING flex" + +case " $build_configdirs " in + *" flex "*) LEX='$$r/$(BUILD_SUBDIR)/flex/flex' ;; + *" lex "*) LEX='$$r/$(BUILD_SUBDIR)/lex/lex' ;; +esac + +for ac_prog in flex +do +# Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:3565: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_FLEX'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$FLEX"; then + ac_cv_prog_FLEX="$FLEX" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_FLEX="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +FLEX="$ac_cv_prog_FLEX" +if test -n "$FLEX"; then + echo "$ac_t""$FLEX" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$FLEX" && break +done +test -n "$FLEX" || FLEX="$MISSING flex" + +case " $build_configdirs " in + *" flex "*) FLEX='$$r/$(BUILD_SUBDIR)/flex/flex' ;; +esac + +for ac_prog in makeinfo +do +# Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:3604: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_MAKEINFO'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$MAKEINFO"; then + ac_cv_prog_MAKEINFO="$MAKEINFO" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_MAKEINFO="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +MAKEINFO="$ac_cv_prog_MAKEINFO" +if test -n "$MAKEINFO"; then + echo "$ac_t""$MAKEINFO" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$MAKEINFO" && break +done +test -n "$MAKEINFO" || MAKEINFO="$MISSING makeinfo" + +case " $build_configdirs " in + *" texinfo "*) MAKEINFO='$$r/$(BUILD_SUBDIR)/texinfo/makeinfo/makeinfo' ;; + *) + + # For an installed makeinfo, we require it to be from texinfo 4.4 or + # higher, else we use the "missing" dummy. + if ${MAKEINFO} --version \ + | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.[4-9]|[5-9])' >/dev/null 2>&1; then + : + else + MAKEINFO="$MISSING makeinfo" + fi + ;; + +esac + +# FIXME: expect and dejagnu may become build tools? + +for ac_prog in expect +do +# Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:3657: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_EXPECT'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$EXPECT"; then + ac_cv_prog_EXPECT="$EXPECT" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_EXPECT="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +EXPECT="$ac_cv_prog_EXPECT" +if test -n "$EXPECT"; then + echo "$ac_t""$EXPECT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$EXPECT" && break +done +test -n "$EXPECT" || EXPECT="expect" + +case " $configdirs " in + *" expect "*) + test $host = $build && EXPECT='$$r/$(HOST_SUBDIR)/expect/expect' + ;; +esac + +for ac_prog in runtest +do +# Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:3698: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RUNTEST'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RUNTEST"; then + ac_cv_prog_RUNTEST="$RUNTEST" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RUNTEST="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +RUNTEST="$ac_cv_prog_RUNTEST" +if test -n "$RUNTEST"; then + echo "$ac_t""$RUNTEST" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$RUNTEST" && break +done +test -n "$RUNTEST" || RUNTEST="runtest" + +case " $configdirs " in + *" dejagnu "*) + test $host = $build && RUNTEST='$$r/$(HOST_SUBDIR)/dejagnu/runtest' + ;; +esac # Host tools. @@ -2847,11 +3737,12 @@ test -n "$host_alias" && ncn_tool_prefix=$host_alias- ncn_target_tool_prefix= test -n "$target_alias" && ncn_target_tool_prefix=$target_alias- - if test -n "$ncn_tool_prefix"; then - # Extract the first word of "${ncn_tool_prefix}ar", so it can be a program name with args. -set dummy ${ncn_tool_prefix}ar; ac_word=$2 + for ncn_progname in ar; do + if test -n "$ncn_tool_prefix"; then + # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2855: checking for $ac_word" >&5 +echo "configure:3746: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2863,7 +3754,7 @@ else for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_prog_AR="${ncn_tool_prefix}ar" + ac_cv_prog_AR="${ncn_tool_prefix}${ncn_progname}" break fi done @@ -2877,53 +3768,56 @@ else echo "$ac_t""no" 1>&6 fi -fi -if test -z "$ac_cv_prog_AR" ; then - if test $build = $host ; then - ncn_cv_AR=$AR - # Extract the first word of "ar", so it can be a program name with args. -set dummy ar; ac_word=$2 + fi + if test -z "$ac_cv_prog_AR" && test $build = $host ; then + # Extract the first word of "${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2888: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_AR'+set}'`\" = set"; then +echo "configure:3777: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - if test -n "$ncn_cv_AR"; then - ac_cv_prog_ncn_cv_AR="$ncn_cv_AR" # Let the user override the test. + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_prog_ncn_cv_AR="ar" + ac_cv_prog_AR="${ncn_progname}" break fi done IFS="$ac_save_ifs" - test -z "$ac_cv_prog_ncn_cv_AR" && ac_cv_prog_ncn_cv_AR="ar" fi fi -ncn_cv_AR="$ac_cv_prog_ncn_cv_AR" -if test -n "$ncn_cv_AR"; then - echo "$ac_t""$ncn_cv_AR" 1>&6 +AR="$ac_cv_prog_AR" +if test -n "$AR"; then + echo "$ac_t""$AR" 1>&6 else echo "$ac_t""no" 1>&6 fi - AR=$ncn_cv_AR - else - AR="${ncn_tool_prefix}ar" fi -else - AR="$ac_cv_prog_AR" + test -n "$ac_cv_prog_AR" && break +done + +if test -z "$ac_cv_prog_AR" ; then + set dummy ar + if test $build = $host ; then + AR="$2" + else + AR="${ncn_tool_prefix}$2" + fi fi - if test -n "$ncn_tool_prefix"; then - # Extract the first word of "${ncn_tool_prefix}as", so it can be a program name with args. -set dummy ${ncn_tool_prefix}as; ac_word=$2 + for ncn_progname in as; do + if test -n "$ncn_tool_prefix"; then + # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2927: checking for $ac_word" >&5 +echo "configure:3821: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2935,7 +3829,7 @@ else for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_prog_AS="${ncn_tool_prefix}as" + ac_cv_prog_AS="${ncn_tool_prefix}${ncn_progname}" break fi done @@ -2949,53 +3843,56 @@ else echo "$ac_t""no" 1>&6 fi -fi -if test -z "$ac_cv_prog_AS" ; then - if test $build = $host ; then - ncn_cv_AS=$AS - # Extract the first word of "as", so it can be a program name with args. -set dummy as; ac_word=$2 + fi + if test -z "$ac_cv_prog_AS" && test $build = $host ; then + # Extract the first word of "${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2960: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_AS'+set}'`\" = set"; then +echo "configure:3852: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - if test -n "$ncn_cv_AS"; then - ac_cv_prog_ncn_cv_AS="$ncn_cv_AS" # Let the user override the test. + if test -n "$AS"; then + ac_cv_prog_AS="$AS" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_prog_ncn_cv_AS="as" + ac_cv_prog_AS="${ncn_progname}" break fi done IFS="$ac_save_ifs" - test -z "$ac_cv_prog_ncn_cv_AS" && ac_cv_prog_ncn_cv_AS="as" fi fi -ncn_cv_AS="$ac_cv_prog_ncn_cv_AS" -if test -n "$ncn_cv_AS"; then - echo "$ac_t""$ncn_cv_AS" 1>&6 +AS="$ac_cv_prog_AS" +if test -n "$AS"; then + echo "$ac_t""$AS" 1>&6 else echo "$ac_t""no" 1>&6 fi - AS=$ncn_cv_AS - else - AS="${ncn_tool_prefix}as" fi -else - AS="$ac_cv_prog_AS" + test -n "$ac_cv_prog_AS" && break +done + +if test -z "$ac_cv_prog_AS" ; then + set dummy as + if test $build = $host ; then + AS="$2" + else + AS="${ncn_tool_prefix}$2" + fi fi - if test -n "$ncn_tool_prefix"; then - # Extract the first word of "${ncn_tool_prefix}dlltool", so it can be a program name with args. -set dummy ${ncn_tool_prefix}dlltool; ac_word=$2 + for ncn_progname in dlltool; do + if test -n "$ncn_tool_prefix"; then + # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2999: checking for $ac_word" >&5 +echo "configure:3896: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3007,7 +3904,7 @@ else for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_prog_DLLTOOL="${ncn_tool_prefix}dlltool" + ac_cv_prog_DLLTOOL="${ncn_tool_prefix}${ncn_progname}" break fi done @@ -3021,53 +3918,56 @@ else echo "$ac_t""no" 1>&6 fi -fi -if test -z "$ac_cv_prog_DLLTOOL" ; then - if test $build = $host ; then - ncn_cv_DLLTOOL=$DLLTOOL - # Extract the first word of "dlltool", so it can be a program name with args. -set dummy dlltool; ac_word=$2 + fi + if test -z "$ac_cv_prog_DLLTOOL" && test $build = $host ; then + # Extract the first word of "${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3032: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_DLLTOOL'+set}'`\" = set"; then +echo "configure:3927: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - if test -n "$ncn_cv_DLLTOOL"; then - ac_cv_prog_ncn_cv_DLLTOOL="$ncn_cv_DLLTOOL" # Let the user override the test. + if test -n "$DLLTOOL"; then + ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_prog_ncn_cv_DLLTOOL="dlltool" + ac_cv_prog_DLLTOOL="${ncn_progname}" break fi done IFS="$ac_save_ifs" - test -z "$ac_cv_prog_ncn_cv_DLLTOOL" && ac_cv_prog_ncn_cv_DLLTOOL="dlltool" fi fi -ncn_cv_DLLTOOL="$ac_cv_prog_ncn_cv_DLLTOOL" -if test -n "$ncn_cv_DLLTOOL"; then - echo "$ac_t""$ncn_cv_DLLTOOL" 1>&6 +DLLTOOL="$ac_cv_prog_DLLTOOL" +if test -n "$DLLTOOL"; then + echo "$ac_t""$DLLTOOL" 1>&6 else echo "$ac_t""no" 1>&6 fi - DLLTOOL=$ncn_cv_DLLTOOL - else - DLLTOOL="${ncn_tool_prefix}dlltool" fi -else - DLLTOOL="$ac_cv_prog_DLLTOOL" + test -n "$ac_cv_prog_DLLTOOL" && break +done + +if test -z "$ac_cv_prog_DLLTOOL" ; then + set dummy dlltool + if test $build = $host ; then + DLLTOOL="$2" + else + DLLTOOL="${ncn_tool_prefix}$2" + fi fi - if test -n "$ncn_tool_prefix"; then - # Extract the first word of "${ncn_tool_prefix}ld", so it can be a program name with args. -set dummy ${ncn_tool_prefix}ld; ac_word=$2 + for ncn_progname in ld; do + if test -n "$ncn_tool_prefix"; then + # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3071: checking for $ac_word" >&5 +echo "configure:3971: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3079,7 +3979,7 @@ else for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_prog_LD="${ncn_tool_prefix}ld" + ac_cv_prog_LD="${ncn_tool_prefix}${ncn_progname}" break fi done @@ -3093,53 +3993,131 @@ else echo "$ac_t""no" 1>&6 fi -fi -if test -z "$ac_cv_prog_LD" ; then - if test $build = $host ; then - ncn_cv_LD=$LD - # Extract the first word of "ld", so it can be a program name with args. -set dummy ld; ac_word=$2 + fi + if test -z "$ac_cv_prog_LD" && test $build = $host ; then + # Extract the first word of "${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3104: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_LD'+set}'`\" = set"; then +echo "configure:4002: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - if test -n "$ncn_cv_LD"; then - ac_cv_prog_ncn_cv_LD="$ncn_cv_LD" # Let the user override the test. + if test -n "$LD"; then + ac_cv_prog_LD="$LD" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_prog_ncn_cv_LD="ld" + ac_cv_prog_LD="${ncn_progname}" break fi done IFS="$ac_save_ifs" - test -z "$ac_cv_prog_ncn_cv_LD" && ac_cv_prog_ncn_cv_LD="ld" fi fi -ncn_cv_LD="$ac_cv_prog_ncn_cv_LD" -if test -n "$ncn_cv_LD"; then - echo "$ac_t""$ncn_cv_LD" 1>&6 +LD="$ac_cv_prog_LD" +if test -n "$LD"; then + echo "$ac_t""$LD" 1>&6 else echo "$ac_t""no" 1>&6 fi - LD=$ncn_cv_LD - else - LD="${ncn_tool_prefix}ld" fi -else - LD="$ac_cv_prog_LD" + test -n "$ac_cv_prog_LD" && break +done + +if test -z "$ac_cv_prog_LD" ; then + set dummy ld + if test $build = $host ; then + LD="$2" + else + LD="${ncn_tool_prefix}$2" + fi fi - if test -n "$ncn_tool_prefix"; then - # Extract the first word of "${ncn_tool_prefix}nm", so it can be a program name with args. -set dummy ${ncn_tool_prefix}nm; ac_word=$2 + for ncn_progname in lipo; do + if test -n "$ncn_tool_prefix"; then + # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3143: checking for $ac_word" >&5 +echo "configure:4046: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_LIPO'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$LIPO"; then + ac_cv_prog_LIPO="$LIPO" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_LIPO="${ncn_tool_prefix}${ncn_progname}" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +LIPO="$ac_cv_prog_LIPO" +if test -n "$LIPO"; then + echo "$ac_t""$LIPO" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + fi + if test -z "$ac_cv_prog_LIPO" && test $build = $host ; then + # Extract the first word of "${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_progname}; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:4077: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_LIPO'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$LIPO"; then + ac_cv_prog_LIPO="$LIPO" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_LIPO="${ncn_progname}" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +LIPO="$ac_cv_prog_LIPO" +if test -n "$LIPO"; then + echo "$ac_t""$LIPO" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + fi + test -n "$ac_cv_prog_LIPO" && break +done + +if test -z "$ac_cv_prog_LIPO" ; then + set dummy lipo + if test $build = $host ; then + LIPO="$2" + else + LIPO="${ncn_tool_prefix}$2" + fi +fi + + for ncn_progname in nm; do + if test -n "$ncn_tool_prefix"; then + # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:4121: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_NM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3151,7 +4129,7 @@ else for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_prog_NM="${ncn_tool_prefix}nm" + ac_cv_prog_NM="${ncn_tool_prefix}${ncn_progname}" break fi done @@ -3165,53 +4143,56 @@ else echo "$ac_t""no" 1>&6 fi -fi -if test -z "$ac_cv_prog_NM" ; then - if test $build = $host ; then - ncn_cv_NM=$NM - # Extract the first word of "nm", so it can be a program name with args. -set dummy nm; ac_word=$2 + fi + if test -z "$ac_cv_prog_NM" && test $build = $host ; then + # Extract the first word of "${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3176: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_NM'+set}'`\" = set"; then +echo "configure:4152: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_NM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - if test -n "$ncn_cv_NM"; then - ac_cv_prog_ncn_cv_NM="$ncn_cv_NM" # Let the user override the test. + if test -n "$NM"; then + ac_cv_prog_NM="$NM" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_prog_ncn_cv_NM="nm" + ac_cv_prog_NM="${ncn_progname}" break fi done IFS="$ac_save_ifs" - test -z "$ac_cv_prog_ncn_cv_NM" && ac_cv_prog_ncn_cv_NM="nm" fi fi -ncn_cv_NM="$ac_cv_prog_ncn_cv_NM" -if test -n "$ncn_cv_NM"; then - echo "$ac_t""$ncn_cv_NM" 1>&6 +NM="$ac_cv_prog_NM" +if test -n "$NM"; then + echo "$ac_t""$NM" 1>&6 else echo "$ac_t""no" 1>&6 fi - NM=$ncn_cv_NM - else - NM="${ncn_tool_prefix}nm" fi -else - NM="$ac_cv_prog_NM" + test -n "$ac_cv_prog_NM" && break +done + +if test -z "$ac_cv_prog_NM" ; then + set dummy nm + if test $build = $host ; then + NM="$2" + else + NM="${ncn_tool_prefix}$2" + fi fi - if test -n "$ncn_tool_prefix"; then - # Extract the first word of "${ncn_tool_prefix}ranlib", so it can be a program name with args. -set dummy ${ncn_tool_prefix}ranlib; ac_word=$2 + for ncn_progname in ranlib; do + if test -n "$ncn_tool_prefix"; then + # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3215: checking for $ac_word" >&5 +echo "configure:4196: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3223,7 +4204,7 @@ else for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_prog_RANLIB="${ncn_tool_prefix}ranlib" + ac_cv_prog_RANLIB="${ncn_tool_prefix}${ncn_progname}" break fi done @@ -3237,53 +4218,121 @@ else echo "$ac_t""no" 1>&6 fi -fi -if test -z "$ac_cv_prog_RANLIB" ; then - if test $build = $host ; then - ncn_cv_RANLIB=$RANLIB - # Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 + fi + if test -z "$ac_cv_prog_RANLIB" && test $build = $host ; then + # Extract the first word of "${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3248: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_RANLIB'+set}'`\" = set"; then +echo "configure:4227: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - if test -n "$ncn_cv_RANLIB"; then - ac_cv_prog_ncn_cv_RANLIB="$ncn_cv_RANLIB" # Let the user override the test. + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_prog_ncn_cv_RANLIB="ranlib" + ac_cv_prog_RANLIB="${ncn_progname}" break fi done IFS="$ac_save_ifs" - test -z "$ac_cv_prog_ncn_cv_RANLIB" && ac_cv_prog_ncn_cv_RANLIB=":" fi fi -ncn_cv_RANLIB="$ac_cv_prog_ncn_cv_RANLIB" -if test -n "$ncn_cv_RANLIB"; then - echo "$ac_t""$ncn_cv_RANLIB" 1>&6 +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 else echo "$ac_t""no" 1>&6 fi - RANLIB=$ncn_cv_RANLIB - else - RANLIB=":" fi -else - RANLIB="$ac_cv_prog_RANLIB" + test -n "$ac_cv_prog_RANLIB" && break +done + +if test -z "$ac_cv_prog_RANLIB" ; then + RANLIB=":" fi - if test -n "$ncn_tool_prefix"; then - # Extract the first word of "${ncn_tool_prefix}windres", so it can be a program name with args. -set dummy ${ncn_tool_prefix}windres; ac_word=$2 + for ncn_progname in strip; do + if test -n "$ncn_tool_prefix"; then + # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3287: checking for $ac_word" >&5 +echo "configure:4266: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_STRIP="${ncn_tool_prefix}${ncn_progname}" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +STRIP="$ac_cv_prog_STRIP" +if test -n "$STRIP"; then + echo "$ac_t""$STRIP" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + fi + if test -z "$ac_cv_prog_STRIP" && test $build = $host ; then + # Extract the first word of "${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_progname}; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:4297: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_STRIP="${ncn_progname}" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +STRIP="$ac_cv_prog_STRIP" +if test -n "$STRIP"; then + echo "$ac_t""$STRIP" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + fi + test -n "$ac_cv_prog_STRIP" && break +done + +if test -z "$ac_cv_prog_STRIP" ; then + STRIP=":" +fi + + for ncn_progname in windres; do + if test -n "$ncn_tool_prefix"; then + # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:4336: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3295,7 +4344,7 @@ else for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_prog_WINDRES="${ncn_tool_prefix}windres" + ac_cv_prog_WINDRES="${ncn_tool_prefix}${ncn_progname}" break fi done @@ -3309,53 +4358,56 @@ else echo "$ac_t""no" 1>&6 fi -fi -if test -z "$ac_cv_prog_WINDRES" ; then - if test $build = $host ; then - ncn_cv_WINDRES=$WINDRES - # Extract the first word of "windres", so it can be a program name with args. -set dummy windres; ac_word=$2 + fi + if test -z "$ac_cv_prog_WINDRES" && test $build = $host ; then + # Extract the first word of "${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3320: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_WINDRES'+set}'`\" = set"; then +echo "configure:4367: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - if test -n "$ncn_cv_WINDRES"; then - ac_cv_prog_ncn_cv_WINDRES="$ncn_cv_WINDRES" # Let the user override the test. + if test -n "$WINDRES"; then + ac_cv_prog_WINDRES="$WINDRES" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_prog_ncn_cv_WINDRES="windres" + ac_cv_prog_WINDRES="${ncn_progname}" break fi done IFS="$ac_save_ifs" - test -z "$ac_cv_prog_ncn_cv_WINDRES" && ac_cv_prog_ncn_cv_WINDRES="windres" fi fi -ncn_cv_WINDRES="$ac_cv_prog_ncn_cv_WINDRES" -if test -n "$ncn_cv_WINDRES"; then - echo "$ac_t""$ncn_cv_WINDRES" 1>&6 +WINDRES="$ac_cv_prog_WINDRES" +if test -n "$WINDRES"; then + echo "$ac_t""$WINDRES" 1>&6 else echo "$ac_t""no" 1>&6 fi - WINDRES=$ncn_cv_WINDRES - else - WINDRES="${ncn_tool_prefix}windres" fi -else - WINDRES="$ac_cv_prog_WINDRES" + test -n "$ac_cv_prog_WINDRES" && break +done + +if test -z "$ac_cv_prog_WINDRES" ; then + set dummy windres + if test $build = $host ; then + WINDRES="$2" + else + WINDRES="${ncn_tool_prefix}$2" + fi fi - if test -n "$ncn_tool_prefix"; then - # Extract the first word of "${ncn_tool_prefix}objcopy", so it can be a program name with args. -set dummy ${ncn_tool_prefix}objcopy; ac_word=$2 + for ncn_progname in objcopy; do + if test -n "$ncn_tool_prefix"; then + # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3359: checking for $ac_word" >&5 +echo "configure:4411: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_OBJCOPY'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3367,7 +4419,7 @@ else for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_prog_OBJCOPY="${ncn_tool_prefix}objcopy" + ac_cv_prog_OBJCOPY="${ncn_tool_prefix}${ncn_progname}" break fi done @@ -3381,53 +4433,56 @@ else echo "$ac_t""no" 1>&6 fi -fi -if test -z "$ac_cv_prog_OBJCOPY" ; then - if test $build = $host ; then - ncn_cv_OBJCOPY=$OBJCOPY - # Extract the first word of "objcopy", so it can be a program name with args. -set dummy objcopy; ac_word=$2 + fi + if test -z "$ac_cv_prog_OBJCOPY" && test $build = $host ; then + # Extract the first word of "${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3392: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_OBJCOPY'+set}'`\" = set"; then +echo "configure:4442: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_OBJCOPY'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - if test -n "$ncn_cv_OBJCOPY"; then - ac_cv_prog_ncn_cv_OBJCOPY="$ncn_cv_OBJCOPY" # Let the user override the test. + if test -n "$OBJCOPY"; then + ac_cv_prog_OBJCOPY="$OBJCOPY" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_prog_ncn_cv_OBJCOPY="objcopy" + ac_cv_prog_OBJCOPY="${ncn_progname}" break fi done IFS="$ac_save_ifs" - test -z "$ac_cv_prog_ncn_cv_OBJCOPY" && ac_cv_prog_ncn_cv_OBJCOPY="objcopy" fi fi -ncn_cv_OBJCOPY="$ac_cv_prog_ncn_cv_OBJCOPY" -if test -n "$ncn_cv_OBJCOPY"; then - echo "$ac_t""$ncn_cv_OBJCOPY" 1>&6 +OBJCOPY="$ac_cv_prog_OBJCOPY" +if test -n "$OBJCOPY"; then + echo "$ac_t""$OBJCOPY" 1>&6 else echo "$ac_t""no" 1>&6 fi - OBJCOPY=$ncn_cv_OBJCOPY - else - OBJCOPY="${ncn_tool_prefix}objcopy" fi -else - OBJCOPY="$ac_cv_prog_OBJCOPY" + test -n "$ac_cv_prog_OBJCOPY" && break +done + +if test -z "$ac_cv_prog_OBJCOPY" ; then + set dummy objcopy + if test $build = $host ; then + OBJCOPY="$2" + else + OBJCOPY="${ncn_tool_prefix}$2" + fi fi - if test -n "$ncn_tool_prefix"; then - # Extract the first word of "${ncn_tool_prefix}objdump", so it can be a program name with args. -set dummy ${ncn_tool_prefix}objdump; ac_word=$2 + for ncn_progname in objdump; do + if test -n "$ncn_tool_prefix"; then + # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3431: checking for $ac_word" >&5 +echo "configure:4486: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3439,7 +4494,7 @@ else for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_prog_OBJDUMP="${ncn_tool_prefix}objdump" + ac_cv_prog_OBJDUMP="${ncn_tool_prefix}${ncn_progname}" break fi done @@ -3453,46 +4508,48 @@ else echo "$ac_t""no" 1>&6 fi -fi -if test -z "$ac_cv_prog_OBJDUMP" ; then - if test $build = $host ; then - ncn_cv_OBJDUMP=$OBJDUMP - # Extract the first word of "objdump", so it can be a program name with args. -set dummy objdump; ac_word=$2 + fi + if test -z "$ac_cv_prog_OBJDUMP" && test $build = $host ; then + # Extract the first word of "${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3464: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_OBJDUMP'+set}'`\" = set"; then +echo "configure:4517: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - if test -n "$ncn_cv_OBJDUMP"; then - ac_cv_prog_ncn_cv_OBJDUMP="$ncn_cv_OBJDUMP" # Let the user override the test. + if test -n "$OBJDUMP"; then + ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_prog_ncn_cv_OBJDUMP="objdump" + ac_cv_prog_OBJDUMP="${ncn_progname}" break fi done IFS="$ac_save_ifs" - test -z "$ac_cv_prog_ncn_cv_OBJDUMP" && ac_cv_prog_ncn_cv_OBJDUMP="objdump" fi fi -ncn_cv_OBJDUMP="$ac_cv_prog_ncn_cv_OBJDUMP" -if test -n "$ncn_cv_OBJDUMP"; then - echo "$ac_t""$ncn_cv_OBJDUMP" 1>&6 +OBJDUMP="$ac_cv_prog_OBJDUMP" +if test -n "$OBJDUMP"; then + echo "$ac_t""$OBJDUMP" 1>&6 else echo "$ac_t""no" 1>&6 fi - OBJDUMP=$ncn_cv_OBJDUMP - else - OBJDUMP="${ncn_tool_prefix}objdump" fi -else - OBJDUMP="$ac_cv_prog_OBJDUMP" + test -n "$ac_cv_prog_OBJDUMP" && break +done + +if test -z "$ac_cv_prog_OBJDUMP" ; then + set dummy objdump + if test $build = $host ; then + OBJDUMP="$2" + else + OBJDUMP="${ncn_tool_prefix}$2" + fi fi @@ -3501,15 +4558,612 @@ fi - - - # Target tools. - if test -n "$ncn_target_tool_prefix"; then - # Extract the first word of "${ncn_target_tool_prefix}ar", so it can be a program name with args. -set dummy ${ncn_target_tool_prefix}ar; ac_word=$2 +# Check whether --with-build-time-tools or --without-build-time-tools was given. +if test "${with_build_time_tools+set}" = set; then + withval="$with_build_time_tools" + case x"$withval" in + x/*) ;; + *) + with_build_time_tools= + echo "configure: warning: argument to --with-build-time-tools must be an absolute path" 1>&2 + ;; + esac +else + with_build_time_tools= +fi + + + if test -n "$with_build_time_tools"; then + for ncn_progname in cc gcc; do + echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 +echo "configure:4581: checking for ${ncn_progname} in $with_build_time_tools" >&5 + if test -x $with_build_time_tools/${ncn_progname}; then + ac_cv_prog_CC_FOR_TARGET=$with_build_time_tools/${ncn_progname} + echo "$ac_t""yes" 1>&6 + break + else + echo "$ac_t""no" 1>&6 + fi + done +fi + +if test -z "$ac_cv_prog_CC_FOR_TARGET"; then + for ncn_progname in cc gcc; do + if test -n "$ncn_target_tool_prefix"; then + # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3513: checking for $ac_word" >&5 +echo "configure:4598: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC_FOR_TARGET'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC_FOR_TARGET"; then + ac_cv_prog_CC_FOR_TARGET="$CC_FOR_TARGET" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC_FOR_TARGET="$ac_cv_prog_CC_FOR_TARGET" +if test -n "$CC_FOR_TARGET"; then + echo "$ac_t""$CC_FOR_TARGET" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + fi + if test -z "$ac_cv_prog_CC_FOR_TARGET" && test $build = $target ; then + # Extract the first word of "${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_progname}; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:4629: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC_FOR_TARGET'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC_FOR_TARGET"; then + ac_cv_prog_CC_FOR_TARGET="$CC_FOR_TARGET" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC_FOR_TARGET="${ncn_progname}" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC_FOR_TARGET="$ac_cv_prog_CC_FOR_TARGET" +if test -n "$CC_FOR_TARGET"; then + echo "$ac_t""$CC_FOR_TARGET" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + fi + test -n "$ac_cv_prog_CC_FOR_TARGET" && break + done +fi + +if test -z "$ac_cv_prog_CC_FOR_TARGET" ; then + set dummy cc gcc + if test $build = $target ; then + CC_FOR_TARGET="$2" + else + CC_FOR_TARGET="${ncn_target_tool_prefix}$2" + fi +fi + + if test -n "$with_build_time_tools"; then + for ncn_progname in c++ g++ cxx gxx; do + echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 +echo "configure:4672: checking for ${ncn_progname} in $with_build_time_tools" >&5 + if test -x $with_build_time_tools/${ncn_progname}; then + ac_cv_prog_CXX_FOR_TARGET=$with_build_time_tools/${ncn_progname} + echo "$ac_t""yes" 1>&6 + break + else + echo "$ac_t""no" 1>&6 + fi + done +fi + +if test -z "$ac_cv_prog_CXX_FOR_TARGET"; then + for ncn_progname in c++ g++ cxx gxx; do + if test -n "$ncn_target_tool_prefix"; then + # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:4689: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CXX_FOR_TARGET'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CXX_FOR_TARGET"; then + ac_cv_prog_CXX_FOR_TARGET="$CXX_FOR_TARGET" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CXX_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CXX_FOR_TARGET="$ac_cv_prog_CXX_FOR_TARGET" +if test -n "$CXX_FOR_TARGET"; then + echo "$ac_t""$CXX_FOR_TARGET" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + fi + if test -z "$ac_cv_prog_CXX_FOR_TARGET" && test $build = $target ; then + # Extract the first word of "${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_progname}; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:4720: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CXX_FOR_TARGET'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CXX_FOR_TARGET"; then + ac_cv_prog_CXX_FOR_TARGET="$CXX_FOR_TARGET" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CXX_FOR_TARGET="${ncn_progname}" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CXX_FOR_TARGET="$ac_cv_prog_CXX_FOR_TARGET" +if test -n "$CXX_FOR_TARGET"; then + echo "$ac_t""$CXX_FOR_TARGET" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + fi + test -n "$ac_cv_prog_CXX_FOR_TARGET" && break + done +fi + +if test -z "$ac_cv_prog_CXX_FOR_TARGET" ; then + set dummy c++ g++ cxx gxx + if test $build = $target ; then + CXX_FOR_TARGET="$2" + else + CXX_FOR_TARGET="${ncn_target_tool_prefix}$2" + fi +fi + + if test -n "$with_build_time_tools"; then + for ncn_progname in gcc; do + echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 +echo "configure:4763: checking for ${ncn_progname} in $with_build_time_tools" >&5 + if test -x $with_build_time_tools/${ncn_progname}; then + ac_cv_prog_GCC_FOR_TARGET=$with_build_time_tools/${ncn_progname} + echo "$ac_t""yes" 1>&6 + break + else + echo "$ac_t""no" 1>&6 + fi + done +fi + +if test -z "$ac_cv_prog_GCC_FOR_TARGET"; then + for ncn_progname in gcc; do + if test -n "$ncn_target_tool_prefix"; then + # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:4780: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_GCC_FOR_TARGET'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$GCC_FOR_TARGET"; then + ac_cv_prog_GCC_FOR_TARGET="$GCC_FOR_TARGET" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_GCC_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +GCC_FOR_TARGET="$ac_cv_prog_GCC_FOR_TARGET" +if test -n "$GCC_FOR_TARGET"; then + echo "$ac_t""$GCC_FOR_TARGET" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + fi + if test -z "$ac_cv_prog_GCC_FOR_TARGET" && test $build = $target ; then + # Extract the first word of "${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_progname}; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:4811: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_GCC_FOR_TARGET'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$GCC_FOR_TARGET"; then + ac_cv_prog_GCC_FOR_TARGET="$GCC_FOR_TARGET" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_GCC_FOR_TARGET="${ncn_progname}" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +GCC_FOR_TARGET="$ac_cv_prog_GCC_FOR_TARGET" +if test -n "$GCC_FOR_TARGET"; then + echo "$ac_t""$GCC_FOR_TARGET" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + fi + test -n "$ac_cv_prog_GCC_FOR_TARGET" && break + done +fi + +if test -z "$ac_cv_prog_GCC_FOR_TARGET" ; then + GCC_FOR_TARGET="${CC_FOR_TARGET}" +fi + + if test -n "$with_build_time_tools"; then + for ncn_progname in gcj; do + echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 +echo "configure:4849: checking for ${ncn_progname} in $with_build_time_tools" >&5 + if test -x $with_build_time_tools/${ncn_progname}; then + ac_cv_prog_GCJ_FOR_TARGET=$with_build_time_tools/${ncn_progname} + echo "$ac_t""yes" 1>&6 + break + else + echo "$ac_t""no" 1>&6 + fi + done +fi + +if test -z "$ac_cv_prog_GCJ_FOR_TARGET"; then + for ncn_progname in gcj; do + if test -n "$ncn_target_tool_prefix"; then + # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:4866: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_GCJ_FOR_TARGET'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$GCJ_FOR_TARGET"; then + ac_cv_prog_GCJ_FOR_TARGET="$GCJ_FOR_TARGET" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_GCJ_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +GCJ_FOR_TARGET="$ac_cv_prog_GCJ_FOR_TARGET" +if test -n "$GCJ_FOR_TARGET"; then + echo "$ac_t""$GCJ_FOR_TARGET" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + fi + if test -z "$ac_cv_prog_GCJ_FOR_TARGET" && test $build = $target ; then + # Extract the first word of "${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_progname}; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:4897: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_GCJ_FOR_TARGET'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$GCJ_FOR_TARGET"; then + ac_cv_prog_GCJ_FOR_TARGET="$GCJ_FOR_TARGET" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_GCJ_FOR_TARGET="${ncn_progname}" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +GCJ_FOR_TARGET="$ac_cv_prog_GCJ_FOR_TARGET" +if test -n "$GCJ_FOR_TARGET"; then + echo "$ac_t""$GCJ_FOR_TARGET" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + fi + test -n "$ac_cv_prog_GCJ_FOR_TARGET" && break + done +fi + +if test -z "$ac_cv_prog_GCJ_FOR_TARGET" ; then + set dummy gcj + if test $build = $target ; then + GCJ_FOR_TARGET="$2" + else + GCJ_FOR_TARGET="${ncn_target_tool_prefix}$2" + fi +fi + + if test -n "$with_build_time_tools"; then + for ncn_progname in gfortran; do + echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 +echo "configure:4940: checking for ${ncn_progname} in $with_build_time_tools" >&5 + if test -x $with_build_time_tools/${ncn_progname}; then + ac_cv_prog_GFORTRAN_FOR_TARGET=$with_build_time_tools/${ncn_progname} + echo "$ac_t""yes" 1>&6 + break + else + echo "$ac_t""no" 1>&6 + fi + done +fi + +if test -z "$ac_cv_prog_GFORTRAN_FOR_TARGET"; then + for ncn_progname in gfortran; do + if test -n "$ncn_target_tool_prefix"; then + # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:4957: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_GFORTRAN_FOR_TARGET'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$GFORTRAN_FOR_TARGET"; then + ac_cv_prog_GFORTRAN_FOR_TARGET="$GFORTRAN_FOR_TARGET" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_GFORTRAN_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +GFORTRAN_FOR_TARGET="$ac_cv_prog_GFORTRAN_FOR_TARGET" +if test -n "$GFORTRAN_FOR_TARGET"; then + echo "$ac_t""$GFORTRAN_FOR_TARGET" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + fi + if test -z "$ac_cv_prog_GFORTRAN_FOR_TARGET" && test $build = $target ; then + # Extract the first word of "${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_progname}; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:4988: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_GFORTRAN_FOR_TARGET'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$GFORTRAN_FOR_TARGET"; then + ac_cv_prog_GFORTRAN_FOR_TARGET="$GFORTRAN_FOR_TARGET" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_GFORTRAN_FOR_TARGET="${ncn_progname}" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +GFORTRAN_FOR_TARGET="$ac_cv_prog_GFORTRAN_FOR_TARGET" +if test -n "$GFORTRAN_FOR_TARGET"; then + echo "$ac_t""$GFORTRAN_FOR_TARGET" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + fi + test -n "$ac_cv_prog_GFORTRAN_FOR_TARGET" && break + done +fi + +if test -z "$ac_cv_prog_GFORTRAN_FOR_TARGET" ; then + set dummy gfortran + if test $build = $target ; then + GFORTRAN_FOR_TARGET="$2" + else + GFORTRAN_FOR_TARGET="${ncn_target_tool_prefix}$2" + fi +fi + + + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + +if test "x$exec_prefix" = xNONE; then + if test "x$prefix" = xNONE; then + gcc_cv_tool_prefix=$ac_default_prefix + else + gcc_cv_tool_prefix=$prefix + fi +else + gcc_cv_tool_prefix=$exec_prefix +fi + +# If there is no compiler in the tree, use the PATH only. In any +# case, if there is no compiler in the tree nobody should use +# AS_FOR_TARGET and LD_FOR_TARGET. +if test x$host = x$build && test -f $srcdir/gcc/BASE-VER; then + gcc_version=`cat $srcdir/gcc/BASE-VER` + gcc_cv_tool_dirs="$gcc_cv_tool_prefix/libexec/gcc/$target_noncanonical/$gcc_version$PATH_SEPARATOR" + gcc_cv_tool_dirs="$gcc_cv_tool_dirs$gcc_cv_tool_prefix/libexec/gcc/$target_noncanonical$PATH_SEPARATOR" + gcc_cv_tool_dirs="$gcc_cv_tool_dirs/usr/lib/gcc/$target_noncanonical/$gcc_version$PATH_SEPARATOR" + gcc_cv_tool_dirs="$gcc_cv_tool_dirs/usr/lib/gcc/$target_noncanonical$PATH_SEPARATOR" + gcc_cv_tool_dirs="$gcc_cv_tool_dirs$gcc_cv_tool_prefix/$target_noncanonical/bin/$target_noncanonical/$gcc_version$PATH_SEPARATOR" + gcc_cv_tool_dirs="$gcc_cv_tool_dirs$gcc_cv_tool_prefix/$target_noncanonical/bin$PATH_SEPARATOR" +else + gcc_cv_tool_dirs= +fi + +if test x$build = x$target && test -n "$md_exec_prefix"; then + gcc_cv_tool_dirs="$gcc_cv_tool_dirs$md_exec_prefix$PATH_SEPARATOR" +fi + + + +cat > conftest.c << \EOF +#ifdef __GNUC__ + gcc_yay; +#endif +EOF +if ($GCC_FOR_TARGET -E conftest.c | grep gcc_yay) > /dev/null 2>&1; then + have_gcc_for_target=yes +else + GCC_FOR_TARGET=${ncn_target_tool_prefix}gcc + have_gcc_for_target=no +fi +rm conftest.c + + + + +if test -z "$ac_cv_path_AR_FOR_TARGET" ; then + if test -n "$with_build_time_tools"; then + echo $ac_n "checking for ar in $with_build_time_tools""... $ac_c" 1>&6 +echo "configure:5095: checking for ar in $with_build_time_tools" >&5 + if test -x $with_build_time_tools/ar; then + AR_FOR_TARGET=`cd $with_build_time_tools && pwd`/ar + ac_cv_path_AR_FOR_TARGET=$AR_FOR_TARGET + echo "$ac_t""$ac_cv_path_AR_FOR_TARGET" 1>&6 + else + echo "$ac_t""no" 1>&6 + fi + elif test $build != $host && test $have_gcc_for_target = yes; then + AR_FOR_TARGET=`$GCC_FOR_TARGET --print-prog-name=ar` + test $AR_FOR_TARGET=ar && AR_FOR_TARGET= + ac_cv_path_AR_FOR_TARGET=$AR_FOR_TARGET + fi +fi +if test -z "$ac_cv_path_AR_FOR_TARGET" ; then + # Extract the first word of "ar", so it can be a program name with args. +set dummy ar; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:5113: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_AR_FOR_TARGET'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$AR_FOR_TARGET" in + /*) + ac_cv_path_AR_FOR_TARGET="$AR_FOR_TARGET" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_AR_FOR_TARGET="$AR_FOR_TARGET" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$gcc_cv_tool_dirs" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_AR_FOR_TARGET="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + ;; +esac +fi +AR_FOR_TARGET="$ac_cv_path_AR_FOR_TARGET" +if test -n "$AR_FOR_TARGET"; then + echo "$ac_t""$AR_FOR_TARGET" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +fi +if test -z "$ac_cv_path_AR_FOR_TARGET" ; then + if test -n "$with_build_time_tools"; then + for ncn_progname in ar; do + echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 +echo "configure:5150: checking for ${ncn_progname} in $with_build_time_tools" >&5 + if test -x $with_build_time_tools/${ncn_progname}; then + ac_cv_prog_AR_FOR_TARGET=$with_build_time_tools/${ncn_progname} + echo "$ac_t""yes" 1>&6 + break + else + echo "$ac_t""no" 1>&6 + fi + done +fi + +if test -z "$ac_cv_prog_AR_FOR_TARGET"; then + for ncn_progname in ar; do + if test -n "$ncn_target_tool_prefix"; then + # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:5167: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3521,7 +5175,7 @@ else for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_prog_AR_FOR_TARGET="${ncn_target_tool_prefix}ar" + ac_cv_prog_AR_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}" break fi done @@ -3535,53 +5189,134 @@ else echo "$ac_t""no" 1>&6 fi -fi -if test -z "$ac_cv_prog_AR_FOR_TARGET" ; then - if test $build = $target ; then - ncn_cv_AR_FOR_TARGET=$AR_FOR_TARGET - # Extract the first word of "ar", so it can be a program name with args. -set dummy ar; ac_word=$2 + fi + if test -z "$ac_cv_prog_AR_FOR_TARGET" && test $build = $target ; then + # Extract the first word of "${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3546: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_AR_FOR_TARGET'+set}'`\" = set"; then +echo "configure:5198: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_AR_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - if test -n "$ncn_cv_AR_FOR_TARGET"; then - ac_cv_prog_ncn_cv_AR_FOR_TARGET="$ncn_cv_AR_FOR_TARGET" # Let the user override the test. + if test -n "$AR_FOR_TARGET"; then + ac_cv_prog_AR_FOR_TARGET="$AR_FOR_TARGET" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_prog_ncn_cv_AR_FOR_TARGET="ar" + ac_cv_prog_AR_FOR_TARGET="${ncn_progname}" break fi done IFS="$ac_save_ifs" - test -z "$ac_cv_prog_ncn_cv_AR_FOR_TARGET" && ac_cv_prog_ncn_cv_AR_FOR_TARGET="ar" fi fi -ncn_cv_AR_FOR_TARGET="$ac_cv_prog_ncn_cv_AR_FOR_TARGET" -if test -n "$ncn_cv_AR_FOR_TARGET"; then - echo "$ac_t""$ncn_cv_AR_FOR_TARGET" 1>&6 +AR_FOR_TARGET="$ac_cv_prog_AR_FOR_TARGET" +if test -n "$AR_FOR_TARGET"; then + echo "$ac_t""$AR_FOR_TARGET" 1>&6 else echo "$ac_t""no" 1>&6 fi - AR_FOR_TARGET=$ncn_cv_AR_FOR_TARGET + fi + test -n "$ac_cv_prog_AR_FOR_TARGET" && break + done +fi + +if test -z "$ac_cv_prog_AR_FOR_TARGET" ; then + set dummy ar + if test $build = $target ; then + AR_FOR_TARGET="$2" else - AR_FOR_TARGET="${ncn_target_tool_prefix}ar" + AR_FOR_TARGET="${ncn_target_tool_prefix}$2" fi -else - AR_FOR_TARGET="$ac_cv_prog_AR_FOR_TARGET" fi - if test -n "$ncn_target_tool_prefix"; then - # Extract the first word of "${ncn_target_tool_prefix}as", so it can be a program name with args. -set dummy ${ncn_target_tool_prefix}as; ac_word=$2 +else + AR_FOR_TARGET=$ac_cv_path_AR_FOR_TARGET +fi + + + + +if test -z "$ac_cv_path_AS_FOR_TARGET" ; then + if test -n "$with_build_time_tools"; then + echo $ac_n "checking for as in $with_build_time_tools""... $ac_c" 1>&6 +echo "configure:5248: checking for as in $with_build_time_tools" >&5 + if test -x $with_build_time_tools/as; then + AS_FOR_TARGET=`cd $with_build_time_tools && pwd`/as + ac_cv_path_AS_FOR_TARGET=$AS_FOR_TARGET + echo "$ac_t""$ac_cv_path_AS_FOR_TARGET" 1>&6 + else + echo "$ac_t""no" 1>&6 + fi + elif test $build != $host && test $have_gcc_for_target = yes; then + AS_FOR_TARGET=`$GCC_FOR_TARGET --print-prog-name=as` + test $AS_FOR_TARGET=as && AS_FOR_TARGET= + ac_cv_path_AS_FOR_TARGET=$AS_FOR_TARGET + fi +fi +if test -z "$ac_cv_path_AS_FOR_TARGET" ; then + # Extract the first word of "as", so it can be a program name with args. +set dummy as; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3585: checking for $ac_word" >&5 +echo "configure:5266: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_AS_FOR_TARGET'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$AS_FOR_TARGET" in + /*) + ac_cv_path_AS_FOR_TARGET="$AS_FOR_TARGET" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_AS_FOR_TARGET="$AS_FOR_TARGET" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$gcc_cv_tool_dirs" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_AS_FOR_TARGET="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + ;; +esac +fi +AS_FOR_TARGET="$ac_cv_path_AS_FOR_TARGET" +if test -n "$AS_FOR_TARGET"; then + echo "$ac_t""$AS_FOR_TARGET" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +fi +if test -z "$ac_cv_path_AS_FOR_TARGET" ; then + if test -n "$with_build_time_tools"; then + for ncn_progname in as; do + echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 +echo "configure:5303: checking for ${ncn_progname} in $with_build_time_tools" >&5 + if test -x $with_build_time_tools/${ncn_progname}; then + ac_cv_prog_AS_FOR_TARGET=$with_build_time_tools/${ncn_progname} + echo "$ac_t""yes" 1>&6 + break + else + echo "$ac_t""no" 1>&6 + fi + done +fi + +if test -z "$ac_cv_prog_AS_FOR_TARGET"; then + for ncn_progname in as; do + if test -n "$ncn_target_tool_prefix"; then + # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:5320: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AS_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3593,7 +5328,7 @@ else for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_prog_AS_FOR_TARGET="${ncn_target_tool_prefix}as" + ac_cv_prog_AS_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}" break fi done @@ -3607,53 +5342,134 @@ else echo "$ac_t""no" 1>&6 fi -fi -if test -z "$ac_cv_prog_AS_FOR_TARGET" ; then - if test $build = $target ; then - ncn_cv_AS_FOR_TARGET=$AS_FOR_TARGET - # Extract the first word of "as", so it can be a program name with args. -set dummy as; ac_word=$2 + fi + if test -z "$ac_cv_prog_AS_FOR_TARGET" && test $build = $target ; then + # Extract the first word of "${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3618: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_AS_FOR_TARGET'+set}'`\" = set"; then +echo "configure:5351: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_AS_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - if test -n "$ncn_cv_AS_FOR_TARGET"; then - ac_cv_prog_ncn_cv_AS_FOR_TARGET="$ncn_cv_AS_FOR_TARGET" # Let the user override the test. + if test -n "$AS_FOR_TARGET"; then + ac_cv_prog_AS_FOR_TARGET="$AS_FOR_TARGET" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_prog_ncn_cv_AS_FOR_TARGET="as" + ac_cv_prog_AS_FOR_TARGET="${ncn_progname}" break fi done IFS="$ac_save_ifs" - test -z "$ac_cv_prog_ncn_cv_AS_FOR_TARGET" && ac_cv_prog_ncn_cv_AS_FOR_TARGET="as" fi fi -ncn_cv_AS_FOR_TARGET="$ac_cv_prog_ncn_cv_AS_FOR_TARGET" -if test -n "$ncn_cv_AS_FOR_TARGET"; then - echo "$ac_t""$ncn_cv_AS_FOR_TARGET" 1>&6 +AS_FOR_TARGET="$ac_cv_prog_AS_FOR_TARGET" +if test -n "$AS_FOR_TARGET"; then + echo "$ac_t""$AS_FOR_TARGET" 1>&6 else echo "$ac_t""no" 1>&6 fi - AS_FOR_TARGET=$ncn_cv_AS_FOR_TARGET + fi + test -n "$ac_cv_prog_AS_FOR_TARGET" && break + done +fi + +if test -z "$ac_cv_prog_AS_FOR_TARGET" ; then + set dummy as + if test $build = $target ; then + AS_FOR_TARGET="$2" else - AS_FOR_TARGET="${ncn_target_tool_prefix}as" + AS_FOR_TARGET="${ncn_target_tool_prefix}$2" fi -else - AS_FOR_TARGET="$ac_cv_prog_AS_FOR_TARGET" fi - if test -n "$ncn_target_tool_prefix"; then - # Extract the first word of "${ncn_target_tool_prefix}dlltool", so it can be a program name with args. -set dummy ${ncn_target_tool_prefix}dlltool; ac_word=$2 +else + AS_FOR_TARGET=$ac_cv_path_AS_FOR_TARGET +fi + + + + +if test -z "$ac_cv_path_DLLTOOL_FOR_TARGET" ; then + if test -n "$with_build_time_tools"; then + echo $ac_n "checking for dlltool in $with_build_time_tools""... $ac_c" 1>&6 +echo "configure:5401: checking for dlltool in $with_build_time_tools" >&5 + if test -x $with_build_time_tools/dlltool; then + DLLTOOL_FOR_TARGET=`cd $with_build_time_tools && pwd`/dlltool + ac_cv_path_DLLTOOL_FOR_TARGET=$DLLTOOL_FOR_TARGET + echo "$ac_t""$ac_cv_path_DLLTOOL_FOR_TARGET" 1>&6 + else + echo "$ac_t""no" 1>&6 + fi + elif test $build != $host && test $have_gcc_for_target = yes; then + DLLTOOL_FOR_TARGET=`$GCC_FOR_TARGET --print-prog-name=dlltool` + test $DLLTOOL_FOR_TARGET=dlltool && DLLTOOL_FOR_TARGET= + ac_cv_path_DLLTOOL_FOR_TARGET=$DLLTOOL_FOR_TARGET + fi +fi +if test -z "$ac_cv_path_DLLTOOL_FOR_TARGET" ; then + # Extract the first word of "dlltool", so it can be a program name with args. +set dummy dlltool; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3657: checking for $ac_word" >&5 +echo "configure:5419: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_DLLTOOL_FOR_TARGET'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$DLLTOOL_FOR_TARGET" in + /*) + ac_cv_path_DLLTOOL_FOR_TARGET="$DLLTOOL_FOR_TARGET" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_DLLTOOL_FOR_TARGET="$DLLTOOL_FOR_TARGET" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$gcc_cv_tool_dirs" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_DLLTOOL_FOR_TARGET="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + ;; +esac +fi +DLLTOOL_FOR_TARGET="$ac_cv_path_DLLTOOL_FOR_TARGET" +if test -n "$DLLTOOL_FOR_TARGET"; then + echo "$ac_t""$DLLTOOL_FOR_TARGET" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +fi +if test -z "$ac_cv_path_DLLTOOL_FOR_TARGET" ; then + if test -n "$with_build_time_tools"; then + for ncn_progname in dlltool; do + echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 +echo "configure:5456: checking for ${ncn_progname} in $with_build_time_tools" >&5 + if test -x $with_build_time_tools/${ncn_progname}; then + ac_cv_prog_DLLTOOL_FOR_TARGET=$with_build_time_tools/${ncn_progname} + echo "$ac_t""yes" 1>&6 + break + else + echo "$ac_t""no" 1>&6 + fi + done +fi + +if test -z "$ac_cv_prog_DLLTOOL_FOR_TARGET"; then + for ncn_progname in dlltool; do + if test -n "$ncn_target_tool_prefix"; then + # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:5473: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3665,7 +5481,7 @@ else for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_prog_DLLTOOL_FOR_TARGET="${ncn_target_tool_prefix}dlltool" + ac_cv_prog_DLLTOOL_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}" break fi done @@ -3679,53 +5495,134 @@ else echo "$ac_t""no" 1>&6 fi -fi -if test -z "$ac_cv_prog_DLLTOOL_FOR_TARGET" ; then - if test $build = $target ; then - ncn_cv_DLLTOOL_FOR_TARGET=$DLLTOOL_FOR_TARGET - # Extract the first word of "dlltool", so it can be a program name with args. -set dummy dlltool; ac_word=$2 + fi + if test -z "$ac_cv_prog_DLLTOOL_FOR_TARGET" && test $build = $target ; then + # Extract the first word of "${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3690: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_DLLTOOL_FOR_TARGET'+set}'`\" = set"; then +echo "configure:5504: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - if test -n "$ncn_cv_DLLTOOL_FOR_TARGET"; then - ac_cv_prog_ncn_cv_DLLTOOL_FOR_TARGET="$ncn_cv_DLLTOOL_FOR_TARGET" # Let the user override the test. + if test -n "$DLLTOOL_FOR_TARGET"; then + ac_cv_prog_DLLTOOL_FOR_TARGET="$DLLTOOL_FOR_TARGET" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_prog_ncn_cv_DLLTOOL_FOR_TARGET="dlltool" + ac_cv_prog_DLLTOOL_FOR_TARGET="${ncn_progname}" break fi done IFS="$ac_save_ifs" - test -z "$ac_cv_prog_ncn_cv_DLLTOOL_FOR_TARGET" && ac_cv_prog_ncn_cv_DLLTOOL_FOR_TARGET="dlltool" fi fi -ncn_cv_DLLTOOL_FOR_TARGET="$ac_cv_prog_ncn_cv_DLLTOOL_FOR_TARGET" -if test -n "$ncn_cv_DLLTOOL_FOR_TARGET"; then - echo "$ac_t""$ncn_cv_DLLTOOL_FOR_TARGET" 1>&6 +DLLTOOL_FOR_TARGET="$ac_cv_prog_DLLTOOL_FOR_TARGET" +if test -n "$DLLTOOL_FOR_TARGET"; then + echo "$ac_t""$DLLTOOL_FOR_TARGET" 1>&6 else echo "$ac_t""no" 1>&6 fi - DLLTOOL_FOR_TARGET=$ncn_cv_DLLTOOL_FOR_TARGET + fi + test -n "$ac_cv_prog_DLLTOOL_FOR_TARGET" && break + done +fi + +if test -z "$ac_cv_prog_DLLTOOL_FOR_TARGET" ; then + set dummy dlltool + if test $build = $target ; then + DLLTOOL_FOR_TARGET="$2" else - DLLTOOL_FOR_TARGET="${ncn_target_tool_prefix}dlltool" + DLLTOOL_FOR_TARGET="${ncn_target_tool_prefix}$2" fi -else - DLLTOOL_FOR_TARGET="$ac_cv_prog_DLLTOOL_FOR_TARGET" fi - if test -n "$ncn_target_tool_prefix"; then - # Extract the first word of "${ncn_target_tool_prefix}ld", so it can be a program name with args. -set dummy ${ncn_target_tool_prefix}ld; ac_word=$2 +else + DLLTOOL_FOR_TARGET=$ac_cv_path_DLLTOOL_FOR_TARGET +fi + + + + +if test -z "$ac_cv_path_LD_FOR_TARGET" ; then + if test -n "$with_build_time_tools"; then + echo $ac_n "checking for ld in $with_build_time_tools""... $ac_c" 1>&6 +echo "configure:5554: checking for ld in $with_build_time_tools" >&5 + if test -x $with_build_time_tools/ld; then + LD_FOR_TARGET=`cd $with_build_time_tools && pwd`/ld + ac_cv_path_LD_FOR_TARGET=$LD_FOR_TARGET + echo "$ac_t""$ac_cv_path_LD_FOR_TARGET" 1>&6 + else + echo "$ac_t""no" 1>&6 + fi + elif test $build != $host && test $have_gcc_for_target = yes; then + LD_FOR_TARGET=`$GCC_FOR_TARGET --print-prog-name=ld` + test $LD_FOR_TARGET=ld && LD_FOR_TARGET= + ac_cv_path_LD_FOR_TARGET=$LD_FOR_TARGET + fi +fi +if test -z "$ac_cv_path_LD_FOR_TARGET" ; then + # Extract the first word of "ld", so it can be a program name with args. +set dummy ld; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3729: checking for $ac_word" >&5 +echo "configure:5572: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_LD_FOR_TARGET'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$LD_FOR_TARGET" in + /*) + ac_cv_path_LD_FOR_TARGET="$LD_FOR_TARGET" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_LD_FOR_TARGET="$LD_FOR_TARGET" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$gcc_cv_tool_dirs" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_LD_FOR_TARGET="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + ;; +esac +fi +LD_FOR_TARGET="$ac_cv_path_LD_FOR_TARGET" +if test -n "$LD_FOR_TARGET"; then + echo "$ac_t""$LD_FOR_TARGET" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +fi +if test -z "$ac_cv_path_LD_FOR_TARGET" ; then + if test -n "$with_build_time_tools"; then + for ncn_progname in ld; do + echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 +echo "configure:5609: checking for ${ncn_progname} in $with_build_time_tools" >&5 + if test -x $with_build_time_tools/${ncn_progname}; then + ac_cv_prog_LD_FOR_TARGET=$with_build_time_tools/${ncn_progname} + echo "$ac_t""yes" 1>&6 + break + else + echo "$ac_t""no" 1>&6 + fi + done +fi + +if test -z "$ac_cv_prog_LD_FOR_TARGET"; then + for ncn_progname in ld; do + if test -n "$ncn_target_tool_prefix"; then + # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:5626: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LD_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3737,7 +5634,7 @@ else for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_prog_LD_FOR_TARGET="${ncn_target_tool_prefix}ld" + ac_cv_prog_LD_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}" break fi done @@ -3751,53 +5648,287 @@ else echo "$ac_t""no" 1>&6 fi -fi -if test -z "$ac_cv_prog_LD_FOR_TARGET" ; then - if test $build = $target ; then - ncn_cv_LD_FOR_TARGET=$LD_FOR_TARGET - # Extract the first word of "ld", so it can be a program name with args. -set dummy ld; ac_word=$2 + fi + if test -z "$ac_cv_prog_LD_FOR_TARGET" && test $build = $target ; then + # Extract the first word of "${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3762: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_LD_FOR_TARGET'+set}'`\" = set"; then +echo "configure:5657: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_LD_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - if test -n "$ncn_cv_LD_FOR_TARGET"; then - ac_cv_prog_ncn_cv_LD_FOR_TARGET="$ncn_cv_LD_FOR_TARGET" # Let the user override the test. + if test -n "$LD_FOR_TARGET"; then + ac_cv_prog_LD_FOR_TARGET="$LD_FOR_TARGET" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_prog_ncn_cv_LD_FOR_TARGET="ld" + ac_cv_prog_LD_FOR_TARGET="${ncn_progname}" break fi done IFS="$ac_save_ifs" - test -z "$ac_cv_prog_ncn_cv_LD_FOR_TARGET" && ac_cv_prog_ncn_cv_LD_FOR_TARGET="ld" fi fi -ncn_cv_LD_FOR_TARGET="$ac_cv_prog_ncn_cv_LD_FOR_TARGET" -if test -n "$ncn_cv_LD_FOR_TARGET"; then - echo "$ac_t""$ncn_cv_LD_FOR_TARGET" 1>&6 +LD_FOR_TARGET="$ac_cv_prog_LD_FOR_TARGET" +if test -n "$LD_FOR_TARGET"; then + echo "$ac_t""$LD_FOR_TARGET" 1>&6 else echo "$ac_t""no" 1>&6 fi - LD_FOR_TARGET=$ncn_cv_LD_FOR_TARGET + fi + test -n "$ac_cv_prog_LD_FOR_TARGET" && break + done +fi + +if test -z "$ac_cv_prog_LD_FOR_TARGET" ; then + set dummy ld + if test $build = $target ; then + LD_FOR_TARGET="$2" else - LD_FOR_TARGET="${ncn_target_tool_prefix}ld" + LD_FOR_TARGET="${ncn_target_tool_prefix}$2" fi -else - LD_FOR_TARGET="$ac_cv_prog_LD_FOR_TARGET" fi - if test -n "$ncn_target_tool_prefix"; then - # Extract the first word of "${ncn_target_tool_prefix}nm", so it can be a program name with args. -set dummy ${ncn_target_tool_prefix}nm; ac_word=$2 +else + LD_FOR_TARGET=$ac_cv_path_LD_FOR_TARGET +fi + + + + +if test -z "$ac_cv_path_LIPO_FOR_TARGET" ; then + if test -n "$with_build_time_tools"; then + echo $ac_n "checking for lipo in $with_build_time_tools""... $ac_c" 1>&6 +echo "configure:5707: checking for lipo in $with_build_time_tools" >&5 + if test -x $with_build_time_tools/lipo; then + LIPO_FOR_TARGET=`cd $with_build_time_tools && pwd`/lipo + ac_cv_path_LIPO_FOR_TARGET=$LIPO_FOR_TARGET + echo "$ac_t""$ac_cv_path_LIPO_FOR_TARGET" 1>&6 + else + echo "$ac_t""no" 1>&6 + fi + elif test $build != $host && test $have_gcc_for_target = yes; then + LIPO_FOR_TARGET=`$GCC_FOR_TARGET --print-prog-name=lipo` + test $LIPO_FOR_TARGET=lipo && LIPO_FOR_TARGET= + ac_cv_path_LIPO_FOR_TARGET=$LIPO_FOR_TARGET + fi +fi +if test -z "$ac_cv_path_LIPO_FOR_TARGET" ; then + # Extract the first word of "lipo", so it can be a program name with args. +set dummy lipo; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3801: checking for $ac_word" >&5 +echo "configure:5725: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_LIPO_FOR_TARGET'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$LIPO_FOR_TARGET" in + /*) + ac_cv_path_LIPO_FOR_TARGET="$LIPO_FOR_TARGET" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_LIPO_FOR_TARGET="$LIPO_FOR_TARGET" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$gcc_cv_tool_dirs" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_LIPO_FOR_TARGET="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + ;; +esac +fi +LIPO_FOR_TARGET="$ac_cv_path_LIPO_FOR_TARGET" +if test -n "$LIPO_FOR_TARGET"; then + echo "$ac_t""$LIPO_FOR_TARGET" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +fi +if test -z "$ac_cv_path_LIPO_FOR_TARGET" ; then + if test -n "$with_build_time_tools"; then + for ncn_progname in lipo; do + echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 +echo "configure:5762: checking for ${ncn_progname} in $with_build_time_tools" >&5 + if test -x $with_build_time_tools/${ncn_progname}; then + ac_cv_prog_LIPO_FOR_TARGET=$with_build_time_tools/${ncn_progname} + echo "$ac_t""yes" 1>&6 + break + else + echo "$ac_t""no" 1>&6 + fi + done +fi + +if test -z "$ac_cv_prog_LIPO_FOR_TARGET"; then + for ncn_progname in lipo; do + if test -n "$ncn_target_tool_prefix"; then + # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:5779: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_LIPO_FOR_TARGET'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$LIPO_FOR_TARGET"; then + ac_cv_prog_LIPO_FOR_TARGET="$LIPO_FOR_TARGET" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_LIPO_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +LIPO_FOR_TARGET="$ac_cv_prog_LIPO_FOR_TARGET" +if test -n "$LIPO_FOR_TARGET"; then + echo "$ac_t""$LIPO_FOR_TARGET" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + fi + if test -z "$ac_cv_prog_LIPO_FOR_TARGET" && test $build = $target ; then + # Extract the first word of "${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_progname}; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:5810: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_LIPO_FOR_TARGET'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$LIPO_FOR_TARGET"; then + ac_cv_prog_LIPO_FOR_TARGET="$LIPO_FOR_TARGET" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_LIPO_FOR_TARGET="${ncn_progname}" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +LIPO_FOR_TARGET="$ac_cv_prog_LIPO_FOR_TARGET" +if test -n "$LIPO_FOR_TARGET"; then + echo "$ac_t""$LIPO_FOR_TARGET" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + fi + test -n "$ac_cv_prog_LIPO_FOR_TARGET" && break + done +fi + +if test -z "$ac_cv_prog_LIPO_FOR_TARGET" ; then + set dummy lipo + if test $build = $target ; then + LIPO_FOR_TARGET="$2" + else + LIPO_FOR_TARGET="${ncn_target_tool_prefix}$2" + fi +fi + +else + LIPO_FOR_TARGET=$ac_cv_path_LIPO_FOR_TARGET +fi + + + + +if test -z "$ac_cv_path_NM_FOR_TARGET" ; then + if test -n "$with_build_time_tools"; then + echo $ac_n "checking for nm in $with_build_time_tools""... $ac_c" 1>&6 +echo "configure:5860: checking for nm in $with_build_time_tools" >&5 + if test -x $with_build_time_tools/nm; then + NM_FOR_TARGET=`cd $with_build_time_tools && pwd`/nm + ac_cv_path_NM_FOR_TARGET=$NM_FOR_TARGET + echo "$ac_t""$ac_cv_path_NM_FOR_TARGET" 1>&6 + else + echo "$ac_t""no" 1>&6 + fi + elif test $build != $host && test $have_gcc_for_target = yes; then + NM_FOR_TARGET=`$GCC_FOR_TARGET --print-prog-name=nm` + test $NM_FOR_TARGET=nm && NM_FOR_TARGET= + ac_cv_path_NM_FOR_TARGET=$NM_FOR_TARGET + fi +fi +if test -z "$ac_cv_path_NM_FOR_TARGET" ; then + # Extract the first word of "nm", so it can be a program name with args. +set dummy nm; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:5878: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_NM_FOR_TARGET'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$NM_FOR_TARGET" in + /*) + ac_cv_path_NM_FOR_TARGET="$NM_FOR_TARGET" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_NM_FOR_TARGET="$NM_FOR_TARGET" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$gcc_cv_tool_dirs" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_NM_FOR_TARGET="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + ;; +esac +fi +NM_FOR_TARGET="$ac_cv_path_NM_FOR_TARGET" +if test -n "$NM_FOR_TARGET"; then + echo "$ac_t""$NM_FOR_TARGET" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +fi +if test -z "$ac_cv_path_NM_FOR_TARGET" ; then + if test -n "$with_build_time_tools"; then + for ncn_progname in nm; do + echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 +echo "configure:5915: checking for ${ncn_progname} in $with_build_time_tools" >&5 + if test -x $with_build_time_tools/${ncn_progname}; then + ac_cv_prog_NM_FOR_TARGET=$with_build_time_tools/${ncn_progname} + echo "$ac_t""yes" 1>&6 + break + else + echo "$ac_t""no" 1>&6 + fi + done +fi + +if test -z "$ac_cv_prog_NM_FOR_TARGET"; then + for ncn_progname in nm; do + if test -n "$ncn_target_tool_prefix"; then + # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:5932: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_NM_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3809,7 +5940,7 @@ else for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_prog_NM_FOR_TARGET="${ncn_target_tool_prefix}nm" + ac_cv_prog_NM_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}" break fi done @@ -3823,53 +5954,287 @@ else echo "$ac_t""no" 1>&6 fi -fi -if test -z "$ac_cv_prog_NM_FOR_TARGET" ; then - if test $build = $target ; then - ncn_cv_NM_FOR_TARGET=$NM_FOR_TARGET - # Extract the first word of "nm", so it can be a program name with args. -set dummy nm; ac_word=$2 + fi + if test -z "$ac_cv_prog_NM_FOR_TARGET" && test $build = $target ; then + # Extract the first word of "${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3834: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_NM_FOR_TARGET'+set}'`\" = set"; then +echo "configure:5963: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_NM_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - if test -n "$ncn_cv_NM_FOR_TARGET"; then - ac_cv_prog_ncn_cv_NM_FOR_TARGET="$ncn_cv_NM_FOR_TARGET" # Let the user override the test. + if test -n "$NM_FOR_TARGET"; then + ac_cv_prog_NM_FOR_TARGET="$NM_FOR_TARGET" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_prog_ncn_cv_NM_FOR_TARGET="nm" + ac_cv_prog_NM_FOR_TARGET="${ncn_progname}" break fi done IFS="$ac_save_ifs" - test -z "$ac_cv_prog_ncn_cv_NM_FOR_TARGET" && ac_cv_prog_ncn_cv_NM_FOR_TARGET="nm" fi fi -ncn_cv_NM_FOR_TARGET="$ac_cv_prog_ncn_cv_NM_FOR_TARGET" -if test -n "$ncn_cv_NM_FOR_TARGET"; then - echo "$ac_t""$ncn_cv_NM_FOR_TARGET" 1>&6 +NM_FOR_TARGET="$ac_cv_prog_NM_FOR_TARGET" +if test -n "$NM_FOR_TARGET"; then + echo "$ac_t""$NM_FOR_TARGET" 1>&6 else echo "$ac_t""no" 1>&6 fi - NM_FOR_TARGET=$ncn_cv_NM_FOR_TARGET + fi + test -n "$ac_cv_prog_NM_FOR_TARGET" && break + done +fi + +if test -z "$ac_cv_prog_NM_FOR_TARGET" ; then + set dummy nm + if test $build = $target ; then + NM_FOR_TARGET="$2" else - NM_FOR_TARGET="${ncn_target_tool_prefix}nm" + NM_FOR_TARGET="${ncn_target_tool_prefix}$2" fi -else - NM_FOR_TARGET="$ac_cv_prog_NM_FOR_TARGET" fi - if test -n "$ncn_target_tool_prefix"; then - # Extract the first word of "${ncn_target_tool_prefix}ranlib", so it can be a program name with args. -set dummy ${ncn_target_tool_prefix}ranlib; ac_word=$2 +else + NM_FOR_TARGET=$ac_cv_path_NM_FOR_TARGET +fi + + + + +if test -z "$ac_cv_path_OBJDUMP_FOR_TARGET" ; then + if test -n "$with_build_time_tools"; then + echo $ac_n "checking for objdump in $with_build_time_tools""... $ac_c" 1>&6 +echo "configure:6013: checking for objdump in $with_build_time_tools" >&5 + if test -x $with_build_time_tools/objdump; then + OBJDUMP_FOR_TARGET=`cd $with_build_time_tools && pwd`/objdump + ac_cv_path_OBJDUMP_FOR_TARGET=$OBJDUMP_FOR_TARGET + echo "$ac_t""$ac_cv_path_OBJDUMP_FOR_TARGET" 1>&6 + else + echo "$ac_t""no" 1>&6 + fi + elif test $build != $host && test $have_gcc_for_target = yes; then + OBJDUMP_FOR_TARGET=`$GCC_FOR_TARGET --print-prog-name=objdump` + test $OBJDUMP_FOR_TARGET=objdump && OBJDUMP_FOR_TARGET= + ac_cv_path_OBJDUMP_FOR_TARGET=$OBJDUMP_FOR_TARGET + fi +fi +if test -z "$ac_cv_path_OBJDUMP_FOR_TARGET" ; then + # Extract the first word of "objdump", so it can be a program name with args. +set dummy objdump; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3873: checking for $ac_word" >&5 +echo "configure:6031: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_OBJDUMP_FOR_TARGET'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$OBJDUMP_FOR_TARGET" in + /*) + ac_cv_path_OBJDUMP_FOR_TARGET="$OBJDUMP_FOR_TARGET" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_OBJDUMP_FOR_TARGET="$OBJDUMP_FOR_TARGET" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$gcc_cv_tool_dirs" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_OBJDUMP_FOR_TARGET="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + ;; +esac +fi +OBJDUMP_FOR_TARGET="$ac_cv_path_OBJDUMP_FOR_TARGET" +if test -n "$OBJDUMP_FOR_TARGET"; then + echo "$ac_t""$OBJDUMP_FOR_TARGET" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +fi +if test -z "$ac_cv_path_OBJDUMP_FOR_TARGET" ; then + if test -n "$with_build_time_tools"; then + for ncn_progname in objdump; do + echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 +echo "configure:6068: checking for ${ncn_progname} in $with_build_time_tools" >&5 + if test -x $with_build_time_tools/${ncn_progname}; then + ac_cv_prog_OBJDUMP_FOR_TARGET=$with_build_time_tools/${ncn_progname} + echo "$ac_t""yes" 1>&6 + break + else + echo "$ac_t""no" 1>&6 + fi + done +fi + +if test -z "$ac_cv_prog_OBJDUMP_FOR_TARGET"; then + for ncn_progname in objdump; do + if test -n "$ncn_target_tool_prefix"; then + # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:6085: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP_FOR_TARGET'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$OBJDUMP_FOR_TARGET"; then + ac_cv_prog_OBJDUMP_FOR_TARGET="$OBJDUMP_FOR_TARGET" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_OBJDUMP_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +OBJDUMP_FOR_TARGET="$ac_cv_prog_OBJDUMP_FOR_TARGET" +if test -n "$OBJDUMP_FOR_TARGET"; then + echo "$ac_t""$OBJDUMP_FOR_TARGET" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + fi + if test -z "$ac_cv_prog_OBJDUMP_FOR_TARGET" && test $build = $target ; then + # Extract the first word of "${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_progname}; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:6116: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP_FOR_TARGET'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$OBJDUMP_FOR_TARGET"; then + ac_cv_prog_OBJDUMP_FOR_TARGET="$OBJDUMP_FOR_TARGET" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_OBJDUMP_FOR_TARGET="${ncn_progname}" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +OBJDUMP_FOR_TARGET="$ac_cv_prog_OBJDUMP_FOR_TARGET" +if test -n "$OBJDUMP_FOR_TARGET"; then + echo "$ac_t""$OBJDUMP_FOR_TARGET" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + fi + test -n "$ac_cv_prog_OBJDUMP_FOR_TARGET" && break + done +fi + +if test -z "$ac_cv_prog_OBJDUMP_FOR_TARGET" ; then + set dummy objdump + if test $build = $target ; then + OBJDUMP_FOR_TARGET="$2" + else + OBJDUMP_FOR_TARGET="${ncn_target_tool_prefix}$2" + fi +fi + +else + OBJDUMP_FOR_TARGET=$ac_cv_path_OBJDUMP_FOR_TARGET +fi + + + + +if test -z "$ac_cv_path_RANLIB_FOR_TARGET" ; then + if test -n "$with_build_time_tools"; then + echo $ac_n "checking for ranlib in $with_build_time_tools""... $ac_c" 1>&6 +echo "configure:6166: checking for ranlib in $with_build_time_tools" >&5 + if test -x $with_build_time_tools/ranlib; then + RANLIB_FOR_TARGET=`cd $with_build_time_tools && pwd`/ranlib + ac_cv_path_RANLIB_FOR_TARGET=$RANLIB_FOR_TARGET + echo "$ac_t""$ac_cv_path_RANLIB_FOR_TARGET" 1>&6 + else + echo "$ac_t""no" 1>&6 + fi + elif test $build != $host && test $have_gcc_for_target = yes; then + RANLIB_FOR_TARGET=`$GCC_FOR_TARGET --print-prog-name=ranlib` + test $RANLIB_FOR_TARGET=ranlib && RANLIB_FOR_TARGET= + ac_cv_path_RANLIB_FOR_TARGET=$RANLIB_FOR_TARGET + fi +fi +if test -z "$ac_cv_path_RANLIB_FOR_TARGET" ; then + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:6184: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_RANLIB_FOR_TARGET'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$RANLIB_FOR_TARGET" in + /*) + ac_cv_path_RANLIB_FOR_TARGET="$RANLIB_FOR_TARGET" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_RANLIB_FOR_TARGET="$RANLIB_FOR_TARGET" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$gcc_cv_tool_dirs" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_RANLIB_FOR_TARGET="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + ;; +esac +fi +RANLIB_FOR_TARGET="$ac_cv_path_RANLIB_FOR_TARGET" +if test -n "$RANLIB_FOR_TARGET"; then + echo "$ac_t""$RANLIB_FOR_TARGET" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +fi +if test -z "$ac_cv_path_RANLIB_FOR_TARGET" ; then + if test -n "$with_build_time_tools"; then + for ncn_progname in ranlib; do + echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 +echo "configure:6221: checking for ${ncn_progname} in $with_build_time_tools" >&5 + if test -x $with_build_time_tools/${ncn_progname}; then + ac_cv_prog_RANLIB_FOR_TARGET=$with_build_time_tools/${ncn_progname} + echo "$ac_t""yes" 1>&6 + break + else + echo "$ac_t""no" 1>&6 + fi + done +fi + +if test -z "$ac_cv_prog_RANLIB_FOR_TARGET"; then + for ncn_progname in ranlib; do + if test -n "$ncn_target_tool_prefix"; then + # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:6238: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3881,7 +6246,7 @@ else for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_prog_RANLIB_FOR_TARGET="${ncn_target_tool_prefix}ranlib" + ac_cv_prog_RANLIB_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}" break fi done @@ -3895,53 +6260,287 @@ else echo "$ac_t""no" 1>&6 fi -fi -if test -z "$ac_cv_prog_RANLIB_FOR_TARGET" ; then - if test $build = $target ; then - ncn_cv_RANLIB_FOR_TARGET=$RANLIB_FOR_TARGET - # Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 + fi + if test -z "$ac_cv_prog_RANLIB_FOR_TARGET" && test $build = $target ; then + # Extract the first word of "${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3906: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_RANLIB_FOR_TARGET'+set}'`\" = set"; then +echo "configure:6269: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - if test -n "$ncn_cv_RANLIB_FOR_TARGET"; then - ac_cv_prog_ncn_cv_RANLIB_FOR_TARGET="$ncn_cv_RANLIB_FOR_TARGET" # Let the user override the test. + if test -n "$RANLIB_FOR_TARGET"; then + ac_cv_prog_RANLIB_FOR_TARGET="$RANLIB_FOR_TARGET" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_prog_ncn_cv_RANLIB_FOR_TARGET="ranlib" + ac_cv_prog_RANLIB_FOR_TARGET="${ncn_progname}" break fi done IFS="$ac_save_ifs" - test -z "$ac_cv_prog_ncn_cv_RANLIB_FOR_TARGET" && ac_cv_prog_ncn_cv_RANLIB_FOR_TARGET=":" fi fi -ncn_cv_RANLIB_FOR_TARGET="$ac_cv_prog_ncn_cv_RANLIB_FOR_TARGET" -if test -n "$ncn_cv_RANLIB_FOR_TARGET"; then - echo "$ac_t""$ncn_cv_RANLIB_FOR_TARGET" 1>&6 +RANLIB_FOR_TARGET="$ac_cv_prog_RANLIB_FOR_TARGET" +if test -n "$RANLIB_FOR_TARGET"; then + echo "$ac_t""$RANLIB_FOR_TARGET" 1>&6 else echo "$ac_t""no" 1>&6 fi - RANLIB_FOR_TARGET=$ncn_cv_RANLIB_FOR_TARGET + fi + test -n "$ac_cv_prog_RANLIB_FOR_TARGET" && break + done +fi + +if test -z "$ac_cv_prog_RANLIB_FOR_TARGET" ; then + set dummy ranlib + if test $build = $target ; then + RANLIB_FOR_TARGET="$2" else - RANLIB_FOR_TARGET=":" + RANLIB_FOR_TARGET="${ncn_target_tool_prefix}$2" fi -else - RANLIB_FOR_TARGET="$ac_cv_prog_RANLIB_FOR_TARGET" fi - if test -n "$ncn_target_tool_prefix"; then - # Extract the first word of "${ncn_target_tool_prefix}windres", so it can be a program name with args. -set dummy ${ncn_target_tool_prefix}windres; ac_word=$2 +else + RANLIB_FOR_TARGET=$ac_cv_path_RANLIB_FOR_TARGET +fi + + + + +if test -z "$ac_cv_path_STRIP_FOR_TARGET" ; then + if test -n "$with_build_time_tools"; then + echo $ac_n "checking for strip in $with_build_time_tools""... $ac_c" 1>&6 +echo "configure:6319: checking for strip in $with_build_time_tools" >&5 + if test -x $with_build_time_tools/strip; then + STRIP_FOR_TARGET=`cd $with_build_time_tools && pwd`/strip + ac_cv_path_STRIP_FOR_TARGET=$STRIP_FOR_TARGET + echo "$ac_t""$ac_cv_path_STRIP_FOR_TARGET" 1>&6 + else + echo "$ac_t""no" 1>&6 + fi + elif test $build != $host && test $have_gcc_for_target = yes; then + STRIP_FOR_TARGET=`$GCC_FOR_TARGET --print-prog-name=strip` + test $STRIP_FOR_TARGET=strip && STRIP_FOR_TARGET= + ac_cv_path_STRIP_FOR_TARGET=$STRIP_FOR_TARGET + fi +fi +if test -z "$ac_cv_path_STRIP_FOR_TARGET" ; then + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3945: checking for $ac_word" >&5 +echo "configure:6337: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_STRIP_FOR_TARGET'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$STRIP_FOR_TARGET" in + /*) + ac_cv_path_STRIP_FOR_TARGET="$STRIP_FOR_TARGET" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_STRIP_FOR_TARGET="$STRIP_FOR_TARGET" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$gcc_cv_tool_dirs" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_STRIP_FOR_TARGET="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + ;; +esac +fi +STRIP_FOR_TARGET="$ac_cv_path_STRIP_FOR_TARGET" +if test -n "$STRIP_FOR_TARGET"; then + echo "$ac_t""$STRIP_FOR_TARGET" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +fi +if test -z "$ac_cv_path_STRIP_FOR_TARGET" ; then + if test -n "$with_build_time_tools"; then + for ncn_progname in strip; do + echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 +echo "configure:6374: checking for ${ncn_progname} in $with_build_time_tools" >&5 + if test -x $with_build_time_tools/${ncn_progname}; then + ac_cv_prog_STRIP_FOR_TARGET=$with_build_time_tools/${ncn_progname} + echo "$ac_t""yes" 1>&6 + break + else + echo "$ac_t""no" 1>&6 + fi + done +fi + +if test -z "$ac_cv_prog_STRIP_FOR_TARGET"; then + for ncn_progname in strip; do + if test -n "$ncn_target_tool_prefix"; then + # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:6391: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_STRIP_FOR_TARGET'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$STRIP_FOR_TARGET"; then + ac_cv_prog_STRIP_FOR_TARGET="$STRIP_FOR_TARGET" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_STRIP_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +STRIP_FOR_TARGET="$ac_cv_prog_STRIP_FOR_TARGET" +if test -n "$STRIP_FOR_TARGET"; then + echo "$ac_t""$STRIP_FOR_TARGET" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + fi + if test -z "$ac_cv_prog_STRIP_FOR_TARGET" && test $build = $target ; then + # Extract the first word of "${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_progname}; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:6422: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_STRIP_FOR_TARGET'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$STRIP_FOR_TARGET"; then + ac_cv_prog_STRIP_FOR_TARGET="$STRIP_FOR_TARGET" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_STRIP_FOR_TARGET="${ncn_progname}" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +STRIP_FOR_TARGET="$ac_cv_prog_STRIP_FOR_TARGET" +if test -n "$STRIP_FOR_TARGET"; then + echo "$ac_t""$STRIP_FOR_TARGET" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + fi + test -n "$ac_cv_prog_STRIP_FOR_TARGET" && break + done +fi + +if test -z "$ac_cv_prog_STRIP_FOR_TARGET" ; then + set dummy strip + if test $build = $target ; then + STRIP_FOR_TARGET="$2" + else + STRIP_FOR_TARGET="${ncn_target_tool_prefix}$2" + fi +fi + +else + STRIP_FOR_TARGET=$ac_cv_path_STRIP_FOR_TARGET +fi + + + + +if test -z "$ac_cv_path_WINDRES_FOR_TARGET" ; then + if test -n "$with_build_time_tools"; then + echo $ac_n "checking for windres in $with_build_time_tools""... $ac_c" 1>&6 +echo "configure:6472: checking for windres in $with_build_time_tools" >&5 + if test -x $with_build_time_tools/windres; then + WINDRES_FOR_TARGET=`cd $with_build_time_tools && pwd`/windres + ac_cv_path_WINDRES_FOR_TARGET=$WINDRES_FOR_TARGET + echo "$ac_t""$ac_cv_path_WINDRES_FOR_TARGET" 1>&6 + else + echo "$ac_t""no" 1>&6 + fi + elif test $build != $host && test $have_gcc_for_target = yes; then + WINDRES_FOR_TARGET=`$GCC_FOR_TARGET --print-prog-name=windres` + test $WINDRES_FOR_TARGET=windres && WINDRES_FOR_TARGET= + ac_cv_path_WINDRES_FOR_TARGET=$WINDRES_FOR_TARGET + fi +fi +if test -z "$ac_cv_path_WINDRES_FOR_TARGET" ; then + # Extract the first word of "windres", so it can be a program name with args. +set dummy windres; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:6490: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_WINDRES_FOR_TARGET'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$WINDRES_FOR_TARGET" in + /*) + ac_cv_path_WINDRES_FOR_TARGET="$WINDRES_FOR_TARGET" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_WINDRES_FOR_TARGET="$WINDRES_FOR_TARGET" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$gcc_cv_tool_dirs" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_WINDRES_FOR_TARGET="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + ;; +esac +fi +WINDRES_FOR_TARGET="$ac_cv_path_WINDRES_FOR_TARGET" +if test -n "$WINDRES_FOR_TARGET"; then + echo "$ac_t""$WINDRES_FOR_TARGET" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +fi +if test -z "$ac_cv_path_WINDRES_FOR_TARGET" ; then + if test -n "$with_build_time_tools"; then + for ncn_progname in windres; do + echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6 +echo "configure:6527: checking for ${ncn_progname} in $with_build_time_tools" >&5 + if test -x $with_build_time_tools/${ncn_progname}; then + ac_cv_prog_WINDRES_FOR_TARGET=$with_build_time_tools/${ncn_progname} + echo "$ac_t""yes" 1>&6 + break + else + echo "$ac_t""no" 1>&6 + fi + done +fi + +if test -z "$ac_cv_prog_WINDRES_FOR_TARGET"; then + for ncn_progname in windres; do + if test -n "$ncn_target_tool_prefix"; then + # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:6544: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_WINDRES_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3953,7 +6552,7 @@ else for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_prog_WINDRES_FOR_TARGET="${ncn_target_tool_prefix}windres" + ac_cv_prog_WINDRES_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}" break fi done @@ -3967,81 +6566,618 @@ else echo "$ac_t""no" 1>&6 fi -fi -if test -z "$ac_cv_prog_WINDRES_FOR_TARGET" ; then - if test $build = $target ; then - ncn_cv_WINDRES_FOR_TARGET=$WINDRES_FOR_TARGET - # Extract the first word of "windres", so it can be a program name with args. -set dummy windres; ac_word=$2 + fi + if test -z "$ac_cv_prog_WINDRES_FOR_TARGET" && test $build = $target ; then + # Extract the first word of "${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_progname}; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3978: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_WINDRES_FOR_TARGET'+set}'`\" = set"; then +echo "configure:6575: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_WINDRES_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - if test -n "$ncn_cv_WINDRES_FOR_TARGET"; then - ac_cv_prog_ncn_cv_WINDRES_FOR_TARGET="$ncn_cv_WINDRES_FOR_TARGET" # Let the user override the test. + if test -n "$WINDRES_FOR_TARGET"; then + ac_cv_prog_WINDRES_FOR_TARGET="$WINDRES_FOR_TARGET" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_prog_ncn_cv_WINDRES_FOR_TARGET="windres" + ac_cv_prog_WINDRES_FOR_TARGET="${ncn_progname}" break fi done IFS="$ac_save_ifs" - test -z "$ac_cv_prog_ncn_cv_WINDRES_FOR_TARGET" && ac_cv_prog_ncn_cv_WINDRES_FOR_TARGET="windres" fi fi -ncn_cv_WINDRES_FOR_TARGET="$ac_cv_prog_ncn_cv_WINDRES_FOR_TARGET" -if test -n "$ncn_cv_WINDRES_FOR_TARGET"; then - echo "$ac_t""$ncn_cv_WINDRES_FOR_TARGET" 1>&6 +WINDRES_FOR_TARGET="$ac_cv_prog_WINDRES_FOR_TARGET" +if test -n "$WINDRES_FOR_TARGET"; then + echo "$ac_t""$WINDRES_FOR_TARGET" 1>&6 else echo "$ac_t""no" 1>&6 fi - WINDRES_FOR_TARGET=$ncn_cv_WINDRES_FOR_TARGET + fi + test -n "$ac_cv_prog_WINDRES_FOR_TARGET" && break + done +fi + +if test -z "$ac_cv_prog_WINDRES_FOR_TARGET" ; then + set dummy windres + if test $build = $target ; then + WINDRES_FOR_TARGET="$2" else - WINDRES_FOR_TARGET="${ncn_target_tool_prefix}windres" + WINDRES_FOR_TARGET="${ncn_target_tool_prefix}$2" + fi +fi + +else + WINDRES_FOR_TARGET=$ac_cv_path_WINDRES_FOR_TARGET +fi + + +RAW_CXX_FOR_TARGET="$CXX_FOR_TARGET" + +echo $ac_n "checking where to find the target ar""... $ac_c" 1>&6 +echo "configure:6623: checking where to find the target ar" >&5 +if test "x${build}" != "x${host}" ; then + if expr "x$AR_FOR_TARGET" : "x/" > /dev/null; then + # We already found the complete path + echo "$ac_t""pre-installed in `dirname $AR_FOR_TARGET`" 1>&6 + else + # Canadian cross, just use what we found + echo "$ac_t""pre-installed" 1>&6 fi else - WINDRES_FOR_TARGET="$ac_cv_prog_WINDRES_FOR_TARGET" + ok=yes + case " ${configdirs} " in + *" binutils "*) ;; + *) ok=no ;; + esac + + if test $ok = yes; then + # An in-tree tool is available and we can use it + AR_FOR_TARGET='$$r/$(HOST_SUBDIR)/binutils/ar' + echo "$ac_t""just compiled" 1>&6 + elif expr "x$AR_FOR_TARGET" : "x/" > /dev/null; then + # We already found the complete path + echo "$ac_t""pre-installed in `dirname $AR_FOR_TARGET`" 1>&6 + elif test "x$target" = "x$host"; then + # We can use an host tool + AR_FOR_TARGET='$(AR)' + echo "$ac_t""host tool" 1>&6 + else + # We need a cross tool + echo "$ac_t""pre-installed" 1>&6 + fi +fi +echo $ac_n "checking where to find the target as""... $ac_c" 1>&6 +echo "configure:6656: checking where to find the target as" >&5 +if test "x${build}" != "x${host}" ; then + if expr "x$AS_FOR_TARGET" : "x/" > /dev/null; then + # We already found the complete path + echo "$ac_t""pre-installed in `dirname $AS_FOR_TARGET`" 1>&6 + else + # Canadian cross, just use what we found + echo "$ac_t""pre-installed" 1>&6 + fi +else + ok=yes + case " ${configdirs} " in + *" gas "*) ;; + *) ok=no ;; + esac + + if test $ok = yes; then + # An in-tree tool is available and we can use it + AS_FOR_TARGET='$$r/$(HOST_SUBDIR)/gas/as-new' + echo "$ac_t""just compiled" 1>&6 + elif expr "x$AS_FOR_TARGET" : "x/" > /dev/null; then + # We already found the complete path + echo "$ac_t""pre-installed in `dirname $AS_FOR_TARGET`" 1>&6 + elif test "x$target" = "x$host"; then + # We can use an host tool + AS_FOR_TARGET='$(AS)' + echo "$ac_t""host tool" 1>&6 + else + # We need a cross tool + echo "$ac_t""pre-installed" 1>&6 + fi +fi +echo $ac_n "checking where to find the target cc""... $ac_c" 1>&6 +echo "configure:6689: checking where to find the target cc" >&5 +if test "x${build}" != "x${host}" ; then + if expr "x$CC_FOR_TARGET" : "x/" > /dev/null; then + # We already found the complete path + echo "$ac_t""pre-installed in `dirname $CC_FOR_TARGET`" 1>&6 + else + # Canadian cross, just use what we found + echo "$ac_t""pre-installed" 1>&6 + fi +else + ok=yes + case " ${configdirs} " in + *" gcc "*) ;; + *) ok=no ;; + esac + + if test $ok = yes; then + # An in-tree tool is available and we can use it + CC_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/xgcc -B$$r/$(HOST_SUBDIR)/gcc/' + echo "$ac_t""just compiled" 1>&6 + elif expr "x$CC_FOR_TARGET" : "x/" > /dev/null; then + # We already found the complete path + echo "$ac_t""pre-installed in `dirname $CC_FOR_TARGET`" 1>&6 + elif test "x$target" = "x$host"; then + # We can use an host tool + CC_FOR_TARGET='$(CC)' + echo "$ac_t""host tool" 1>&6 + else + # We need a cross tool + echo "$ac_t""pre-installed" 1>&6 + fi +fi +echo $ac_n "checking where to find the target c++""... $ac_c" 1>&6 +echo "configure:6722: checking where to find the target c++" >&5 +if test "x${build}" != "x${host}" ; then + if expr "x$CXX_FOR_TARGET" : "x/" > /dev/null; then + # We already found the complete path + echo "$ac_t""pre-installed in `dirname $CXX_FOR_TARGET`" 1>&6 + else + # Canadian cross, just use what we found + echo "$ac_t""pre-installed" 1>&6 + fi +else + ok=yes + case " ${configdirs} " in + *" gcc "*) ;; + *) ok=no ;; + esac + case ,${enable_languages}, in + *,c++,*) ;; + *) ok=no ;; + esac + if test $ok = yes; then + # An in-tree tool is available and we can use it + CXX_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/g++ -B$$r/$(HOST_SUBDIR)/gcc/ -nostdinc++ `test ! -f $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags || $(SHELL) $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags --build-includes` -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs' + echo "$ac_t""just compiled" 1>&6 + elif expr "x$CXX_FOR_TARGET" : "x/" > /dev/null; then + # We already found the complete path + echo "$ac_t""pre-installed in `dirname $CXX_FOR_TARGET`" 1>&6 + elif test "x$target" = "x$host"; then + # We can use an host tool + CXX_FOR_TARGET='$(CXX)' + echo "$ac_t""host tool" 1>&6 + else + # We need a cross tool + echo "$ac_t""pre-installed" 1>&6 + fi +fi +echo $ac_n "checking where to find the target c++ for libstdc++""... $ac_c" 1>&6 +echo "configure:6758: checking where to find the target c++ for libstdc++" >&5 +if test "x${build}" != "x${host}" ; then + if expr "x$RAW_CXX_FOR_TARGET" : "x/" > /dev/null; then + # We already found the complete path + echo "$ac_t""pre-installed in `dirname $RAW_CXX_FOR_TARGET`" 1>&6 + else + # Canadian cross, just use what we found + echo "$ac_t""pre-installed" 1>&6 + fi +else + ok=yes + case " ${configdirs} " in + *" gcc "*) ;; + *) ok=no ;; + esac + case ,${enable_languages}, in + *,c++,*) ;; + *) ok=no ;; + esac + if test $ok = yes; then + # An in-tree tool is available and we can use it + RAW_CXX_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/xgcc -shared-libgcc -B$$r/$(HOST_SUBDIR)/gcc -nostdinc++ -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs' + echo "$ac_t""just compiled" 1>&6 + elif expr "x$RAW_CXX_FOR_TARGET" : "x/" > /dev/null; then + # We already found the complete path + echo "$ac_t""pre-installed in `dirname $RAW_CXX_FOR_TARGET`" 1>&6 + elif test "x$target" = "x$host"; then + # We can use an host tool + RAW_CXX_FOR_TARGET='$(CXX)' + echo "$ac_t""host tool" 1>&6 + else + # We need a cross tool + echo "$ac_t""pre-installed" 1>&6 + fi +fi +echo $ac_n "checking where to find the target dlltool""... $ac_c" 1>&6 +echo "configure:6794: checking where to find the target dlltool" >&5 +if test "x${build}" != "x${host}" ; then + if expr "x$DLLTOOL_FOR_TARGET" : "x/" > /dev/null; then + # We already found the complete path + echo "$ac_t""pre-installed in `dirname $DLLTOOL_FOR_TARGET`" 1>&6 + else + # Canadian cross, just use what we found + echo "$ac_t""pre-installed" 1>&6 + fi +else + ok=yes + case " ${configdirs} " in + *" binutils "*) ;; + *) ok=no ;; + esac + + if test $ok = yes; then + # An in-tree tool is available and we can use it + DLLTOOL_FOR_TARGET='$$r/$(HOST_SUBDIR)/binutils/dlltool' + echo "$ac_t""just compiled" 1>&6 + elif expr "x$DLLTOOL_FOR_TARGET" : "x/" > /dev/null; then + # We already found the complete path + echo "$ac_t""pre-installed in `dirname $DLLTOOL_FOR_TARGET`" 1>&6 + elif test "x$target" = "x$host"; then + # We can use an host tool + DLLTOOL_FOR_TARGET='$(DLLTOOL)' + echo "$ac_t""host tool" 1>&6 + else + # We need a cross tool + echo "$ac_t""pre-installed" 1>&6 + fi +fi +echo $ac_n "checking where to find the target gcc""... $ac_c" 1>&6 +echo "configure:6827: checking where to find the target gcc" >&5 +if test "x${build}" != "x${host}" ; then + if expr "x$GCC_FOR_TARGET" : "x/" > /dev/null; then + # We already found the complete path + echo "$ac_t""pre-installed in `dirname $GCC_FOR_TARGET`" 1>&6 + else + # Canadian cross, just use what we found + echo "$ac_t""pre-installed" 1>&6 + fi +else + ok=yes + case " ${configdirs} " in + *" gcc "*) ;; + *) ok=no ;; + esac + + if test $ok = yes; then + # An in-tree tool is available and we can use it + GCC_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/xgcc -B$$r/$(HOST_SUBDIR)/gcc/' + echo "$ac_t""just compiled" 1>&6 + elif expr "x$GCC_FOR_TARGET" : "x/" > /dev/null; then + # We already found the complete path + echo "$ac_t""pre-installed in `dirname $GCC_FOR_TARGET`" 1>&6 + elif test "x$target" = "x$host"; then + # We can use an host tool + GCC_FOR_TARGET='$()' + echo "$ac_t""host tool" 1>&6 + else + # We need a cross tool + echo "$ac_t""pre-installed" 1>&6 + fi +fi +echo $ac_n "checking where to find the target gcj""... $ac_c" 1>&6 +echo "configure:6860: checking where to find the target gcj" >&5 +if test "x${build}" != "x${host}" ; then + if expr "x$GCJ_FOR_TARGET" : "x/" > /dev/null; then + # We already found the complete path + echo "$ac_t""pre-installed in `dirname $GCJ_FOR_TARGET`" 1>&6 + else + # Canadian cross, just use what we found + echo "$ac_t""pre-installed" 1>&6 + fi +else + ok=yes + case " ${configdirs} " in + *" gcc "*) ;; + *) ok=no ;; + esac + case ,${enable_languages}, in + *,java,*) ;; + *) ok=no ;; + esac + if test $ok = yes; then + # An in-tree tool is available and we can use it + GCJ_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/gcj -B$$r/$(HOST_SUBDIR)/gcc/' + echo "$ac_t""just compiled" 1>&6 + elif expr "x$GCJ_FOR_TARGET" : "x/" > /dev/null; then + # We already found the complete path + echo "$ac_t""pre-installed in `dirname $GCJ_FOR_TARGET`" 1>&6 + elif test "x$target" = "x$host"; then + # We can use an host tool + GCJ_FOR_TARGET='$(GCJ)' + echo "$ac_t""host tool" 1>&6 + else + # We need a cross tool + echo "$ac_t""pre-installed" 1>&6 + fi +fi +echo $ac_n "checking where to find the target gfortran""... $ac_c" 1>&6 +echo "configure:6896: checking where to find the target gfortran" >&5 +if test "x${build}" != "x${host}" ; then + if expr "x$GFORTRAN_FOR_TARGET" : "x/" > /dev/null; then + # We already found the complete path + echo "$ac_t""pre-installed in `dirname $GFORTRAN_FOR_TARGET`" 1>&6 + else + # Canadian cross, just use what we found + echo "$ac_t""pre-installed" 1>&6 + fi +else + ok=yes + case " ${configdirs} " in + *" gcc "*) ;; + *) ok=no ;; + esac + case ,${enable_languages}, in + *,fortran,*) ;; + *) ok=no ;; + esac + if test $ok = yes; then + # An in-tree tool is available and we can use it + GFORTRAN_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/gfortran -B$$r/$(HOST_SUBDIR)/gcc/' + echo "$ac_t""just compiled" 1>&6 + elif expr "x$GFORTRAN_FOR_TARGET" : "x/" > /dev/null; then + # We already found the complete path + echo "$ac_t""pre-installed in `dirname $GFORTRAN_FOR_TARGET`" 1>&6 + elif test "x$target" = "x$host"; then + # We can use an host tool + GFORTRAN_FOR_TARGET='$(GFORTRAN)' + echo "$ac_t""host tool" 1>&6 + else + # We need a cross tool + echo "$ac_t""pre-installed" 1>&6 + fi +fi +echo $ac_n "checking where to find the target ld""... $ac_c" 1>&6 +echo "configure:6932: checking where to find the target ld" >&5 +if test "x${build}" != "x${host}" ; then + if expr "x$LD_FOR_TARGET" : "x/" > /dev/null; then + # We already found the complete path + echo "$ac_t""pre-installed in `dirname $LD_FOR_TARGET`" 1>&6 + else + # Canadian cross, just use what we found + echo "$ac_t""pre-installed" 1>&6 + fi +else + ok=yes + case " ${configdirs} " in + *" ld "*) ;; + *) ok=no ;; + esac + + if test $ok = yes; then + # An in-tree tool is available and we can use it + LD_FOR_TARGET='$$r/$(HOST_SUBDIR)/ld/ld-new' + echo "$ac_t""just compiled" 1>&6 + elif expr "x$LD_FOR_TARGET" : "x/" > /dev/null; then + # We already found the complete path + echo "$ac_t""pre-installed in `dirname $LD_FOR_TARGET`" 1>&6 + elif test "x$target" = "x$host"; then + # We can use an host tool + LD_FOR_TARGET='$(LD)' + echo "$ac_t""host tool" 1>&6 + else + # We need a cross tool + echo "$ac_t""pre-installed" 1>&6 + fi +fi +echo $ac_n "checking where to find the target lipo""... $ac_c" 1>&6 +echo "configure:6965: checking where to find the target lipo" >&5 +if test "x${build}" != "x${host}" ; then + if expr "x$LIPO_FOR_TARGET" : "x/" > /dev/null; then + # We already found the complete path + echo "$ac_t""pre-installed in `dirname $LIPO_FOR_TARGET`" 1>&6 + else + # Canadian cross, just use what we found + echo "$ac_t""pre-installed" 1>&6 + fi +else + if expr "x$LIPO_FOR_TARGET" : "x/" > /dev/null; then + # We already found the complete path + echo "$ac_t""pre-installed in `dirname $LIPO_FOR_TARGET`" 1>&6 + elif test "x$target" = "x$host"; then + # We can use an host tool + LIPO_FOR_TARGET='$(LIPO)' + echo "$ac_t""host tool" 1>&6 + else + # We need a cross tool + echo "$ac_t""pre-installed" 1>&6 + fi +fi +echo $ac_n "checking where to find the target nm""... $ac_c" 1>&6 +echo "configure:6988: checking where to find the target nm" >&5 +if test "x${build}" != "x${host}" ; then + if expr "x$NM_FOR_TARGET" : "x/" > /dev/null; then + # We already found the complete path + echo "$ac_t""pre-installed in `dirname $NM_FOR_TARGET`" 1>&6 + else + # Canadian cross, just use what we found + echo "$ac_t""pre-installed" 1>&6 + fi +else + ok=yes + case " ${configdirs} " in + *" binutils "*) ;; + *) ok=no ;; + esac + + if test $ok = yes; then + # An in-tree tool is available and we can use it + NM_FOR_TARGET='$$r/$(HOST_SUBDIR)/binutils/nm-new' + echo "$ac_t""just compiled" 1>&6 + elif expr "x$NM_FOR_TARGET" : "x/" > /dev/null; then + # We already found the complete path + echo "$ac_t""pre-installed in `dirname $NM_FOR_TARGET`" 1>&6 + elif test "x$target" = "x$host"; then + # We can use an host tool + NM_FOR_TARGET='$(NM)' + echo "$ac_t""host tool" 1>&6 + else + # We need a cross tool + echo "$ac_t""pre-installed" 1>&6 + fi +fi +echo $ac_n "checking where to find the target objdump""... $ac_c" 1>&6 +echo "configure:7021: checking where to find the target objdump" >&5 +if test "x${build}" != "x${host}" ; then + if expr "x$OBJDUMP_FOR_TARGET" : "x/" > /dev/null; then + # We already found the complete path + echo "$ac_t""pre-installed in `dirname $OBJDUMP_FOR_TARGET`" 1>&6 + else + # Canadian cross, just use what we found + echo "$ac_t""pre-installed" 1>&6 + fi +else + ok=yes + case " ${configdirs} " in + *" binutils "*) ;; + *) ok=no ;; + esac + + if test $ok = yes; then + # An in-tree tool is available and we can use it + OBJDUMP_FOR_TARGET='$$r/$(HOST_SUBDIR)/binutils/objdump' + echo "$ac_t""just compiled" 1>&6 + elif expr "x$OBJDUMP_FOR_TARGET" : "x/" > /dev/null; then + # We already found the complete path + echo "$ac_t""pre-installed in `dirname $OBJDUMP_FOR_TARGET`" 1>&6 + elif test "x$target" = "x$host"; then + # We can use an host tool + OBJDUMP_FOR_TARGET='$(OBJDUMP)' + echo "$ac_t""host tool" 1>&6 + else + # We need a cross tool + echo "$ac_t""pre-installed" 1>&6 + fi +fi +echo $ac_n "checking where to find the target ranlib""... $ac_c" 1>&6 +echo "configure:7054: checking where to find the target ranlib" >&5 +if test "x${build}" != "x${host}" ; then + if expr "x$RANLIB_FOR_TARGET" : "x/" > /dev/null; then + # We already found the complete path + echo "$ac_t""pre-installed in `dirname $RANLIB_FOR_TARGET`" 1>&6 + else + # Canadian cross, just use what we found + echo "$ac_t""pre-installed" 1>&6 + fi +else + ok=yes + case " ${configdirs} " in + *" binutils "*) ;; + *) ok=no ;; + esac + + if test $ok = yes; then + # An in-tree tool is available and we can use it + RANLIB_FOR_TARGET='$$r/$(HOST_SUBDIR)/binutils/ranlib' + echo "$ac_t""just compiled" 1>&6 + elif expr "x$RANLIB_FOR_TARGET" : "x/" > /dev/null; then + # We already found the complete path + echo "$ac_t""pre-installed in `dirname $RANLIB_FOR_TARGET`" 1>&6 + elif test "x$target" = "x$host"; then + # We can use an host tool + RANLIB_FOR_TARGET='$(RANLIB)' + echo "$ac_t""host tool" 1>&6 + else + # We need a cross tool + echo "$ac_t""pre-installed" 1>&6 + fi +fi +echo $ac_n "checking where to find the target strip""... $ac_c" 1>&6 +echo "configure:7087: checking where to find the target strip" >&5 +if test "x${build}" != "x${host}" ; then + if expr "x$STRIP_FOR_TARGET" : "x/" > /dev/null; then + # We already found the complete path + echo "$ac_t""pre-installed in `dirname $STRIP_FOR_TARGET`" 1>&6 + else + # Canadian cross, just use what we found + echo "$ac_t""pre-installed" 1>&6 + fi +else + ok=yes + case " ${configdirs} " in + *" binutils "*) ;; + *) ok=no ;; + esac + + if test $ok = yes; then + # An in-tree tool is available and we can use it + STRIP_FOR_TARGET='$$r/$(HOST_SUBDIR)/binutils/strip' + echo "$ac_t""just compiled" 1>&6 + elif expr "x$STRIP_FOR_TARGET" : "x/" > /dev/null; then + # We already found the complete path + echo "$ac_t""pre-installed in `dirname $STRIP_FOR_TARGET`" 1>&6 + elif test "x$target" = "x$host"; then + # We can use an host tool + STRIP_FOR_TARGET='$(STRIP)' + echo "$ac_t""host tool" 1>&6 + else + # We need a cross tool + echo "$ac_t""pre-installed" 1>&6 + fi +fi +echo $ac_n "checking where to find the target windres""... $ac_c" 1>&6 +echo "configure:7120: checking where to find the target windres" >&5 +if test "x${build}" != "x${host}" ; then + if expr "x$WINDRES_FOR_TARGET" : "x/" > /dev/null; then + # We already found the complete path + echo "$ac_t""pre-installed in `dirname $WINDRES_FOR_TARGET`" 1>&6 + else + # Canadian cross, just use what we found + echo "$ac_t""pre-installed" 1>&6 + fi +else + ok=yes + case " ${configdirs} " in + *" binutils "*) ;; + *) ok=no ;; + esac + + if test $ok = yes; then + # An in-tree tool is available and we can use it + WINDRES_FOR_TARGET='$$r/$(HOST_SUBDIR)/binutils/windres' + echo "$ac_t""just compiled" 1>&6 + elif expr "x$WINDRES_FOR_TARGET" : "x/" > /dev/null; then + # We already found the complete path + echo "$ac_t""pre-installed in `dirname $WINDRES_FOR_TARGET`" 1>&6 + elif test "x$target" = "x$host"; then + # We can use an host tool + WINDRES_FOR_TARGET='$(WINDRES)' + echo "$ac_t""host tool" 1>&6 + else + # We need a cross tool + echo "$ac_t""pre-installed" 1>&6 + fi fi - - - - - - - -# Fix up target tools. -if test "x${build}" = "x${host}" ; then - # In this case, the newly built tools can and should be used, - # so we override the results of the autoconf tests. - # This should really only happen when the tools are actually being built, - # but that's a further refinement. The new build scheme, where - # tools are built into a structure paralleling where they're installed, - # should also eliminate all of this cleanly. - AR_FOR_TARGET="\$(USUAL_AR_FOR_TARGET)" - AS_FOR_TARGET="\$(USUAL_AS_FOR_TARGET)" - DLLTOOL_FOR_TARGET="\$(USUAL_DLLTOOL_FOR_TARGET)" - LD_FOR_TARGET="\$(USUAL_LD_FOR_TARGET)" - NM_FOR_TARGET="\$(USUAL_NM_FOR_TARGET)" - RANLIB_FOR_TARGET="\$(USUAL_RANLIB_FOR_TARGET)" - WINDRES_FOR_TARGET="\$(USUAL_WINDRES_FOR_TARGET)" -fi # Certain tools may need extra flags. AR_FOR_TARGET=${AR_FOR_TARGET}${extra_arflags_for_target} RANLIB_FOR_TARGET=${RANLIB_FOR_TARGET}${extra_ranlibflags_for_target} NM_FOR_TARGET=${NM_FOR_TARGET}${extra_nmflags_for_target} +# When building target libraries, except in a Canadian cross, we use +# the same toolchain as the compiler we just built. +COMPILER_AS_FOR_TARGET='$(AS_FOR_TARGET)' +COMPILER_LD_FOR_TARGET='$(LD_FOR_TARGET)' +COMPILER_NM_FOR_TARGET='$(NM_FOR_TARGET)' +if test $host = $build; then + case " $configdirs " in + *" gcc "*) + COMPILER_AS_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/as' + COMPILER_LD_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/collect-ld' + COMPILER_NM_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/nm'${extra_nmflags_for_target} + ;; + esac +fi + + + + + echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 -echo "configure:4045: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo "configure:7181: checking whether to enable maintainer-specific portions of Makefiles" >&5 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval="$enable_maintainer_mode" @@ -4062,6 +7198,76 @@ else fi MAINT=$MAINTAINER_MODE_TRUE +# --------------------- +# GCC bootstrap support +# --------------------- + +# Stage specific cflags for build. +stage1_cflags="-g" +case $build in + vax-*-*) + case ${GCC} in + yes) stage1_cflags="-g -Wa,-J" ;; + *) stage1_cflags="-g -J" ;; + esac ;; + powerpc-*-darwin*) + # The spiffy cpp-precomp chokes on some legitimate constructs in GCC + # sources; use -no-cpp-precomp to get to GNU cpp. + # Apple's GCC has bugs in designated initializer handling, so disable + # that too. + stage1_cflags="-g -no-cpp-precomp -DHAVE_DESIGNATED_INITIALIZERS=0" + ;; +esac + + +# Enable -Werror in bootstrap stage2 and later. +# Change the default to "no" on release branches. +# Check whether --enable-werror or --disable-werror was given. +if test "${enable_werror+set}" = set; then + enableval="$enable_werror" + : +else + enable_werror=yes +fi + +case ${enable_werror} in + yes) stage2_werror_flag="--enable-werror-always" ;; + *) stage2_werror_flag="" ;; +esac + + +# Flags needed to enable html installing and building +# Check whether --with-datarootdir or --without-datarootdir was given. +if test "${with_datarootdir+set}" = set; then + withval="$with_datarootdir" + datarootdir="\${prefix}/${withval}" +else + datarootdir="\${prefix}/share" +fi + + +# Check whether --with-docdir or --without-docdir was given. +if test "${with_docdir+set}" = set; then + withval="$with_docdir" + docdir="\${prefix}/${withval}" +else + docdir="\${datarootdir}/doc" +fi + + +# Check whether --with-htmldir or --without-htmldir was given. +if test "${with_htmldir+set}" = set; then + withval="$with_htmldir" + htmldir="\${prefix}/${withval}" +else + htmldir="\${docdir}" +fi + + + + + + trap '' 1 2 15 cat > confcache <<\EOF # This file is a shell script that caches the results of configure @@ -4128,15 +7334,34 @@ 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 +# +# If the first sed substitution is executed (which looks for macros that +# take arguments), then we branch to the quote section. Otherwise, +# look for a macro that doesn't take arguments. +cat >confdef2opt.sed <<\_ACEOF +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g +t quote +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g +t quote +d +: quote +s,[ `~#$^&*(){}\\|;'"<>?],\\&,g +s,\[,\\&,g +s,\],\\&,g +s,\$,$$,g +p +_ACEOF +# We use echo to avoid assuming a particular line-breaking character. +# The extra dot is to prevent the shell from consuming trailing +# line-breaks from the sub-command output. A line-break within +# single-quotes doesn't work because, if this script is created in a +# platform that uses two characters for line-breaks (e.g., DOS), tr +# would break. +ac_LF_and_DOT=`echo; echo .` +DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` +rm -f confdef2opt.sed # Without the "./", some shells look in PATH for config.status. @@ -4225,12 +7450,19 @@ s%@build_os@%$build_os%g s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@LN@%$LN%g +s%@LN_S@%$LN_S%g s%@TOPLEVEL_CONFIGURE_ARGUMENTS@%$TOPLEVEL_CONFIGURE_ARGUMENTS%g s%@build_subdir@%$build_subdir%g s%@host_subdir@%$host_subdir%g s%@target_subdir@%$target_subdir%g -/@maybe_dependencies@/r $maybe_dependencies -s%@maybe_dependencies@%%g +s%@CC@%$CC%g +s%@GNATBIND@%$GNATBIND%g +s%@do_compare@%$do_compare%g +s%@gmplibs@%$gmplibs%g +s%@gmpinc@%$gmpinc%g +s%@stage1_languages@%$stage1_languages%g +s%@SYSROOT_CFLAGS_FOR_TARGET@%$SYSROOT_CFLAGS_FOR_TARGET%g /@serialization_dependencies@/r $serialization_dependencies s%@serialization_dependencies@%%g /@host_makefile_frag@/r $host_makefile_frag @@ -4241,80 +7473,68 @@ s%@target_makefile_frag@%%g s%@alphaieee_frag@%%g /@ospace_frag@/r $ospace_frag s%@ospace_frag@%%g -s%@SET_LIB_PATH@%$SET_LIB_PATH%g s%@RPATH_ENVVAR@%$RPATH_ENVVAR%g -s%@BUILD_PREFIX@%$BUILD_PREFIX%g -s%@BUILD_PREFIX_1@%$BUILD_PREFIX_1%g -s%@configlinks@%$configlinks%g -s%@gcc_version_trigger@%$gcc_version_trigger%g -s%@gcc_version@%$gcc_version%g s%@tooldir@%$tooldir%g s%@build_tooldir@%$build_tooldir%g +s%@CONFIGURE_GDB_TK@%$CONFIGURE_GDB_TK%g s%@GDB_TK@%$GDB_TK%g -s%@gxx_include_dir@%$gxx_include_dir%g -s%@libstdcxx_incdir@%$libstdcxx_incdir%g +s%@INSTALL_GDB_TK@%$INSTALL_GDB_TK%g s%@build_configargs@%$build_configargs%g -s%@configure_build_modules@%$configure_build_modules%g -s%@all_build_modules@%$all_build_modules%g +s%@build_configdirs@%$build_configdirs%g s%@host_configargs@%$host_configargs%g s%@configdirs@%$configdirs%g s%@target_configargs@%$target_configargs%g -s%@target_configdirs@%$target_configdirs%g -s%@BISON@%$BISON%g s%@CC_FOR_BUILD@%$CC_FOR_BUILD%g -s%@LEX@%$LEX%g -s%@MAKEINFO@%$MAKEINFO%g -s%@YACC@%$YACC%g s%@config_shell@%$config_shell%g +s%@YACC@%$YACC%g +s%@BISON@%$BISON%g +s%@M4@%$M4%g +s%@LEX@%$LEX%g +s%@FLEX@%$FLEX%g +s%@MAKEINFO@%$MAKEINFO%g +s%@EXPECT@%$EXPECT%g +s%@RUNTEST@%$RUNTEST%g s%@AR@%$AR%g -s%@ncn_cv_AR@%$ncn_cv_AR%g s%@AS@%$AS%g -s%@ncn_cv_AS@%$ncn_cv_AS%g s%@DLLTOOL@%$DLLTOOL%g -s%@ncn_cv_DLLTOOL@%$ncn_cv_DLLTOOL%g s%@LD@%$LD%g -s%@ncn_cv_LD@%$ncn_cv_LD%g +s%@LIPO@%$LIPO%g s%@NM@%$NM%g -s%@ncn_cv_NM@%$ncn_cv_NM%g s%@RANLIB@%$RANLIB%g -s%@ncn_cv_RANLIB@%$ncn_cv_RANLIB%g +s%@STRIP@%$STRIP%g s%@WINDRES@%$WINDRES%g -s%@ncn_cv_WINDRES@%$ncn_cv_WINDRES%g s%@OBJCOPY@%$OBJCOPY%g -s%@ncn_cv_OBJCOPY@%$ncn_cv_OBJCOPY%g s%@OBJDUMP@%$OBJDUMP%g -s%@ncn_cv_OBJDUMP@%$ncn_cv_OBJDUMP%g -s%@CC@%$CC%g s%@CXX@%$CXX%g s%@CFLAGS_FOR_BUILD@%$CFLAGS_FOR_BUILD%g -s%@DEFAULT_YACC@%$DEFAULT_YACC%g -s%@DEFAULT_LEX@%$DEFAULT_LEX%g -s%@DEFAULT_M4@%$DEFAULT_M4%g -s%@AR_FOR_TARGET@%$AR_FOR_TARGET%g -s%@ncn_cv_AR_FOR_TARGET@%$ncn_cv_AR_FOR_TARGET%g -s%@AS_FOR_TARGET@%$AS_FOR_TARGET%g -s%@ncn_cv_AS_FOR_TARGET@%$ncn_cv_AS_FOR_TARGET%g -s%@DLLTOOL_FOR_TARGET@%$DLLTOOL_FOR_TARGET%g -s%@ncn_cv_DLLTOOL_FOR_TARGET@%$ncn_cv_DLLTOOL_FOR_TARGET%g -s%@LD_FOR_TARGET@%$LD_FOR_TARGET%g -s%@ncn_cv_LD_FOR_TARGET@%$ncn_cv_LD_FOR_TARGET%g -s%@NM_FOR_TARGET@%$NM_FOR_TARGET%g -s%@ncn_cv_NM_FOR_TARGET@%$ncn_cv_NM_FOR_TARGET%g -s%@RANLIB_FOR_TARGET@%$RANLIB_FOR_TARGET%g -s%@ncn_cv_RANLIB_FOR_TARGET@%$ncn_cv_RANLIB_FOR_TARGET%g -s%@WINDRES_FOR_TARGET@%$WINDRES_FOR_TARGET%g -s%@ncn_cv_WINDRES_FOR_TARGET@%$ncn_cv_WINDRES_FOR_TARGET%g -s%@GCC_FOR_TARGET@%$GCC_FOR_TARGET%g -s%@FLAGS_FOR_TARGET@%$FLAGS_FOR_TARGET%g s%@CC_FOR_TARGET@%$CC_FOR_TARGET%g -s%@GCJ_FOR_TARGET@%$GCJ_FOR_TARGET%g s%@CXX_FOR_TARGET@%$CXX_FOR_TARGET%g +s%@GCC_FOR_TARGET@%$GCC_FOR_TARGET%g +s%@GCJ_FOR_TARGET@%$GCJ_FOR_TARGET%g +s%@GFORTRAN_FOR_TARGET@%$GFORTRAN_FOR_TARGET%g +s%@AR_FOR_TARGET@%$AR_FOR_TARGET%g +s%@AS_FOR_TARGET@%$AS_FOR_TARGET%g +s%@DLLTOOL_FOR_TARGET@%$DLLTOOL_FOR_TARGET%g +s%@LD_FOR_TARGET@%$LD_FOR_TARGET%g +s%@LIPO_FOR_TARGET@%$LIPO_FOR_TARGET%g +s%@NM_FOR_TARGET@%$NM_FOR_TARGET%g +s%@OBJDUMP_FOR_TARGET@%$OBJDUMP_FOR_TARGET%g +s%@RANLIB_FOR_TARGET@%$RANLIB_FOR_TARGET%g +s%@STRIP_FOR_TARGET@%$STRIP_FOR_TARGET%g +s%@WINDRES_FOR_TARGET@%$WINDRES_FOR_TARGET%g +s%@FLAGS_FOR_TARGET@%$FLAGS_FOR_TARGET%g s%@RAW_CXX_FOR_TARGET@%$RAW_CXX_FOR_TARGET%g -s%@CXX_FOR_TARGET_FOR_RECURSIVE_MAKE@%$CXX_FOR_TARGET_FOR_RECURSIVE_MAKE%g -s%@RAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE@%$RAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE%g +s%@COMPILER_AS_FOR_TARGET@%$COMPILER_AS_FOR_TARGET%g +s%@COMPILER_LD_FOR_TARGET@%$COMPILER_LD_FOR_TARGET%g +s%@COMPILER_NM_FOR_TARGET@%$COMPILER_NM_FOR_TARGET%g s%@MAINTAINER_MODE_TRUE@%$MAINTAINER_MODE_TRUE%g s%@MAINTAINER_MODE_FALSE@%$MAINTAINER_MODE_FALSE%g s%@MAINT@%$MAINT%g +s%@stage1_cflags@%$stage1_cflags%g +s%@stage2_werror_flag@%$stage2_werror_flag%g +s%@datarootdir@%$datarootdir%g +s%@docdir@%$docdir%g +s%@htmldir@%$htmldir%g CEOF EOF diff --git a/contrib/binutils/configure.in b/contrib/binutils/configure.in index 3355f0e34a0..b6ef515e01d 100644 --- a/contrib/binutils/configure.in +++ b/contrib/binutils/configure.in @@ -1,5 +1,5 @@ -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, -# 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -13,11 +13,13 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ############################################################################## ### WARNING: this file contains embedded tabs. Do not run untabify on this file. +sinclude(config/acx.m4) + AC_INIT(move-if-change) AC_PREREQ(2.13) AC_CANONICAL_SYSTEM @@ -25,8 +27,8 @@ AC_ARG_PROGRAM # Get 'install' or 'install-sh' and its variants. AC_PROG_INSTALL - -sinclude(config/acx.m4) +ACX_PROG_LN +AC_PROG_LN_S ### we might need to use some other shell than /bin/sh for running subshells ### If we are on Windows, search for the shell. This will permit people @@ -78,10 +80,17 @@ AC_SUBST(TOPLEVEL_CONFIGURE_ARGUMENTS) moveifchange=${srcdir}/move-if-change +srcpwd=`cd ${srcdir} ; ${PWDCMD-pwd}` + +# We pass INSTALL explicitly to sub-makes. Make sure that it is not +# a relative path. +if test "$INSTALL" = "${srcdir}/install-sh -c"; then + INSTALL="${srcpwd}/install-sh -c" +fi + # Set srcdir to "." if that's what it is. # This is important for multilib support. pwd=`${PWDCMD-pwd}` -srcpwd=`cd ${srcdir} ; ${PWDCMD-pwd}` if test "${pwd}" = "${srcpwd}" ; then srcdir=. fi @@ -89,26 +98,6 @@ fi topsrcdir=$srcpwd extra_host_args= -# Define the trigger file to make sure configure will re-run whenever -# the gcc version number changes. -if test "${with_gcc_version_trigger+set}" = set ; then - gcc_version_trigger="$with_gcc_version_trigger" - gcc_version=`grep version_string ${with_gcc_version_trigger} | sed -e 's/.*\"\([[^ \"]]*\)[[ \"]].*/\1/'` -else - # If gcc's sources are available, define the trigger file. - if test -f ${topsrcdir}/gcc/version.c ; then - gcc_version_trigger=${topsrcdir}/gcc/version.c - gcc_version=`grep version_string ${gcc_version_trigger} | sed -e 's/.*\"\([[^ \"]]*\)[[ \"]].*/\1/'` - case "$ac_configure_args" in - *--with-gcc-version-trigger=$gcc_version_trigger* ) - ;; - * ) - # Add to all subconfigure arguments: build, host, and target. - ac_configure_args="$ac_configure_args --with-gcc-version-trigger=$gcc_version_trigger" - ;; - esac - fi -fi ### To add a new directory to the tree, first choose whether it is a target ### or a host dependent tool. Then put it into the appropriate list @@ -124,16 +113,24 @@ fi # Double entries in build_configdirs, configdirs, or target_configdirs may # cause circular dependencies and break everything horribly. +# these library is used by various programs built for the build +# environment +# +build_libs="build-libiberty" + +# these tools are built for the build environment +build_tools="build-texinfo build-byacc build-flex build-bison build-m4 build-fixincludes" + # these libraries are used by various programs built for the host environment # -host_libs="intl mmalloc libiberty opcodes bfd readline tcl tk itcl tix libgui zlib" +host_libs="intl mmalloc libiberty opcodes bfd readline tcl tk itcl libgui zlib libcpp libdecnumber" # these tools are built for the host environment # Note, the powerpc-eabi build depends on sim occurring before gdb in order to # know that we are building the simulator. # binutils, gas and ld appear in that order because it makes sense to run # "make check" in that particular order. -host_tools="texinfo byacc flex bison binutils gas ld gcc sid sim gdb make patch prms send-pr gprof etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool diff rcs fileutils shellutils time textutils wdiff find uudecode hello tar gzip indent recode release sed utils guile perl gawk findutils gettext zip fastjar" +host_tools="texinfo byacc flex bison binutils gas ld fixincludes gcc sid sim gdb make patch prms send-pr gprof etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool diff rcs fileutils shellutils time textutils wdiff find uudecode hello tar gzip indent recode release sed utils guile perl gawk findutils gettext zip fastjar gnattools" # libgcj represents the runtime libraries only used by gcj. libgcj="target-libffi \ @@ -149,10 +146,14 @@ target_libraries="target-libiberty \ target-libgloss \ target-newlib \ target-libstdc++-v3 \ - target-libf2c \ + target-libmudflap \ + target-libssp \ + target-libgcc-math \ + target-libgfortran \ ${libgcj} \ target-libobjc \ - target-libada" + target-libada \ + target-libgomp" # these tools are built using the target libraries, and are intended to # run only in the target environment @@ -170,19 +171,9 @@ target_tools="target-examples target-groff target-gperf target-rda" ## is important because configure will choke if they ever get through. ## ${configdirs} is directories we build using the host tools. ## ${target_configdirs} is directories we build using the target tools. -# configdirs=`echo ${host_libs} ${host_tools}` target_configdirs=`echo ${target_libraries} ${target_tools}` - -# Only make build modules if build != host. -# This should be done more generally, but at the moment it doesn't matter. -if test ${host_alias} != ${build_alias} ; then - # This is the only build module. - build_modules=libiberty -else - build_modules= -fi - +build_configdirs=`echo ${build_libs} ${build_tools}` ################################################################################ @@ -227,7 +218,7 @@ fi case ${with_x} in yes | "") ;; # the default value for this tree is that X11 is available no) - skipdirs="${skipdirs} tk tix itcl libgui" + skipdirs="${skipdirs} tk itcl libgui" # We won't be able to build gdbtk without X. enable_gdbtk=no ;; @@ -249,8 +240,8 @@ esac # If both --with-headers and --with-libs are specified, default to # --without-newlib. -if test x"${with_headers}" != x && test x"${with_headers} != xno \ - && test x"${with_libs}" != x && test x"${with_libs} != xno ; then +if test x"${with_headers}" != x && test x"${with_headers}" != xno \ + && test x"${with_libs}" != x && test x"${with_libs}" != xno ; then if test x"${with_newlib}" = x ; then with_newlib=no fi @@ -269,6 +260,10 @@ case "${host}" in configdirs="$configdirs libtermcap" ;; esac +# A target can indicate whether a language isn't supported for some reason. +# Only spaces may be used in this macro; not newlines or tabs. +unsupported_languages= + # Remove more programs from consideration, based on the host or # target this usually means that a port of the program doesn't # exist yet. @@ -278,17 +273,17 @@ case "${host}" in noconfigdirs="$noconfigdirs byacc" ;; i[[3456789]]86-*-vsta) - noconfigdirs="$noconfigdirs tcl expect dejagnu make texinfo bison patch flex byacc send-pr gprof uudecode dejagnu diff guile perl itcl tix gnuserv gettext" + noconfigdirs="$noconfigdirs tcl expect dejagnu make texinfo bison patch flex byacc send-pr gprof uudecode dejagnu diff guile perl itcl gnuserv gettext" ;; i[[3456789]]86-*-go32* | i[[3456789]]86-*-msdosdjgpp*) - noconfigdirs="$noconfigdirs tcl tk expect dejagnu send-pr uudecode guile itcl tix gnuserv libffi" + noconfigdirs="$noconfigdirs tcl tk expect dejagnu send-pr uudecode guile itcl gnuserv libffi" ;; i[[3456789]]86-*-mingw32*) - # noconfigdirs="tcl tk expect dejagnu make texinfo bison patch flex byacc send-pr uudecode dejagnu diff guile perl itcl tix gnuserv" + # noconfigdirs="tcl tk expect dejagnu make texinfo bison patch flex byacc send-pr uudecode dejagnu diff guile perl itcl gnuserv" noconfigdirs="$noconfigdirs expect dejagnu autoconf automake send-pr rcs guile perl texinfo libtool" ;; i[[3456789]]86-*-beos*) - noconfigdirs="$noconfigdirs tk itcl tix libgui gdb" + noconfigdirs="$noconfigdirs tk itcl libgui gdb" ;; *-*-cygwin*) noconfigdirs="$noconfigdirs autoconf automake send-pr rcs guile perl" @@ -297,24 +292,39 @@ case "${host}" in noconfigdirs="$noconfigdirs rcs" ;; ppc*-*-pe) - noconfigdirs="$noconfigdirs patch diff make tk tcl expect dejagnu autoconf automake texinfo bison send-pr gprof rcs guile perl itcl tix gnuserv" + noconfigdirs="$noconfigdirs patch diff make tk tcl expect dejagnu autoconf automake texinfo bison send-pr gprof rcs guile perl itcl gnuserv" ;; powerpc-*-beos*) - noconfigdirs="$noconfigdirs tk itcl tix libgui gdb dejagnu readline" - ;; - *-*-darwin*) - noconfigdirs="$noconfigdirs tk itcl tix libgui" + noconfigdirs="$noconfigdirs tk itcl libgui gdb dejagnu readline" ;; esac + AC_ARG_ENABLE(libada, [ --enable-libada Builds libada directory], ENABLE_LIBADA=$enableval, ENABLE_LIBADA=yes) if test "${ENABLE_LIBADA}" != "yes" ; then - noconfigdirs="$noconfigdirs target-libada" + noconfigdirs="$noconfigdirs gnattools" fi +AC_ARG_ENABLE(libssp, +[ --enable-libssp Builds libssp directory], +ENABLE_LIBSSP=$enableval, +ENABLE_LIBSSP=yes) + +# Set the default so we build libgcc-math for ix86 and x86_64 +AC_ARG_ENABLE(libgcc-math, +[ --enable-libgcc-math Builds libgcc-math directory],, +[ +case "${target}" in + i?86-* | x86_64-* ) + enable_libgcc_math=yes ;; + *) + enable_libgcc_math=no ;; +esac +]) + # Save it here so that, even in case of --enable-libgcj, if the Java # front-end isn't enabled, we still get libgcj disabled. libgcj_saved=$libgcj @@ -331,24 +341,77 @@ no) ;; esac + +# Disable libmudflap on some systems. +if test x$enable_libmudflap = x ; then + case "${target}" in + *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu) + # Enable libmudflap by default in GNU and friends. + ;; + *-*-freebsd*) + # Enable libmudflap by default in FreeBSD. + ;; + *) + # Disable it by default everywhere else. + noconfigdirs="$noconfigdirs target-libmudflap" + ;; + esac +fi + +# Disable libgomp on non POSIX hosted systems. +if test x$enable_libgomp = x ; then + # Enable libgomp by default on hosted POSIX systems. + case "${target}" in + *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu) + ;; + *-*-netbsd* | *-*-freebsd* | *-*-openbsd*) + ;; + *-*-solaris2* | *-*-sysv4* | *-*-irix* | *-*-osf* | *-*-hpux*) + ;; + *-*-darwin* | *-*-aix*) + ;; + *) + noconfigdirs="$noconfigdirs target-libgomp" + ;; + esac +fi + + case "${target}" in *-*-chorusos) noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}" ;; powerpc-*-darwin*) noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes gdb gprof" - noconfigdirs="$noconfigdirs target-libobjc" + noconfigdirs="$noconfigdirs sim target-rda" ;; *-*-darwin*) - noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes gdb gprof" - noconfigdirs="$noconfigdirs target-libobjc ${libgcj}" + noconfigdirs="$noconfigdirs ld gas gdb gprof" + noconfigdirs="$noconfigdirs sim target-rda" + noconfigdirs="$noconfigdirs ${libgcj}" ;; *-*-freebsd[[12]] | *-*-freebsd[[12]].* | *-*-freebsd*aout*) noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}" ;; + *-*-freebsd*) + noconfigdirs="$noconfigdirs target-newlib target-libgloss" + if test "x$with_gmp" = x && test "x$with_gmp_dir" = x \ + && test -f /usr/local/include/gmp.h; then + with_gmp=/usr/local + fi + + # Skip some stuff that's unsupported on some FreeBSD configurations. + case "${target}" in + i*86-*-*) ;; + alpha*-*-*) ;; + *) + noconfigdirs="$noconfigdirs ${libgcj}" + ;; + esac + ;; *-*-kaos*) # Remove unsupported stuff on all kaOS configurations. - skipdirs="target-libiberty ${libgcj} target-libstdc++-v3 target-libf2c target-librx" + skipdirs="target-libiberty ${libgcj} target-libstdc++-v3 target-librx" skipdirs="$skipdirs target-libobjc target-examples target-groff target-gperf" skipdirs="$skipdirs zlib fastjar target-libjava target-boehm-gc target-zlib" noconfigdirs="$noconfigdirs target-libgloss" @@ -366,23 +429,24 @@ case "${target}" in ;; esac ;; - *-*-netware) - noconfigdirs="$noconfigdirs target-libstdc++-v3 target-newlib target-libiberty target-libgloss ${libgcj}" + *-*-netware*) + noconfigdirs="$noconfigdirs target-newlib target-libiberty target-libgloss ${libgcj} target-libmudflap" ;; *-*-rtems*) noconfigdirs="$noconfigdirs target-libgloss ${libgcj}" - case ${target} in - h8300*-*-* | h8500-*-*) - noconfigdirs="$noconfigdirs target-libf2c" - ;; - *) ;; - esac + ;; + # The tpf target doesn't support gdb yet. + *-*-tpf*) + noconfigdirs="$noconfigdirs target-newlib target-libgloss target-libiberty ${libgcj} target-libmudflap gdb tcl tk libgui itcl" ;; *-*-uclinux*) noconfigdirs="$noconfigdirs target-newlib target-libgloss target-rda ${libgcj}" ;; *-*-vxworks*) - noconfigdirs="$noconfigdirs target-newlib target-libgloss target-libiberty ${libgcj}" + noconfigdirs="$noconfigdirs target-newlib target-libgloss target-libiberty target-libstdc++-v3 ${libgcj}" + ;; + m32c-*-*) + noconfigdirs="$noconfigdirs target-libstdc++-v3" ;; alpha*-dec-osf*) # ld works, but does not support shared libraries. @@ -397,9 +461,6 @@ case "${target}" in # newlib is not 64 bit ready noconfigdirs="$noconfigdirs target-newlib target-libgloss" ;; - alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu) - noconfigdirs="$noconfigdirs target-newlib target-libgloss" - ;; alpha*-*-*) # newlib is not 64 bit ready noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}" @@ -414,7 +475,7 @@ case "${target}" in noconfigdirs="$noconfigdirs ${libgcj}" noconfigdirs="$noconfigdirs target-examples" noconfigdirs="$noconfigdirs target-libiberty texinfo send-pr" - noconfigdirs="$noconfigdirs tcl tix tk itcl libgui sim" + noconfigdirs="$noconfigdirs tcl tk itcl libgui sim" noconfigdirs="$noconfigdirs expect dejagnu" # the C++ libraries don't build on top of CE's C libraries noconfigdirs="$noconfigdirs target-libstdc++-v3" @@ -428,16 +489,22 @@ case "${target}" in arc-*-*) noconfigdirs="$noconfigdirs target-libgloss ${libgcj}" ;; + arm-semi-aof ) + ;; arm-*-coff | strongarm-*-coff | xscale-*-coff) noconfigdirs="$noconfigdirs ${libgcj}" ;; - arm-*-elf* | strongarm-*-elf* | xscale-*-elf*) + arm-*-elf* | strongarm-*-elf* | xscale-*-elf* | arm*-*-eabi* ) noconfigdirs="$noconfigdirs target-libffi target-qthreads" ;; - arm-*-pe*) - noconfigdirs="$noconfigdirs target-libgloss ${libgcj}" + arm*-*-linux-gnueabi) + noconfigdirs="$noconfigdirs target-libffi target-qthreads" + noconfigdirs="$noconfigdirs target-libjava target-libobjc" ;; - arm-*-oabi*) + arm*-*-symbianelf*) + noconfigdirs="$noconfigdirs ${libgcj} target-libiberty" + ;; + arm-*-pe*) noconfigdirs="$noconfigdirs target-libgloss ${libgcj}" ;; thumb-*-coff) @@ -446,9 +513,6 @@ case "${target}" in thumb-*-elf) noconfigdirs="$noconfigdirs target-libgloss ${libgcj}" ;; - thumb-*-oabi) - noconfigdirs="$noconfigdirs target-libgloss ${libgcj}" - ;; thumb-*-pe) noconfigdirs="$noconfigdirs target-libgloss ${libgcj}" ;; @@ -458,14 +522,36 @@ case "${target}" in avr-*-*) noconfigdirs="$noconfigdirs target-libiberty target-libstdc++-v3 ${libgcj}" ;; + bfin-*-*) + noconfigdirs="$noconfigdirs target-libgloss gdb" + if test x${is_cross_compiler} != xno ; then + target_configdirs="${target_configdirs} target-bsp target-cygmon" + fi + ;; c4x-*-* | tic4x-*-*) noconfigdirs="$noconfigdirs target-libstdc++-v3 target-libgloss ${libgcj}" ;; c54x*-*-* | tic54x-*-*) noconfigdirs="$noconfigdirs target-libstdc++-v3 target-libgloss ${libgcj} gcc gdb newlib" ;; - cris-*-*) - noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss" + cris-*-* | crisv32-*-*) + unsupported_languages="$unsupported_languages java" + case "${target}" in + *-*-aout) + unsupported_languages="$unsupported_languages fortran" + noconfigdirs="$noconfigdirs target-libffi target-boehm-gc";; + *-*-elf) + unsupported_languages="$unsupported_languages fortran" + noconfigdirs="$noconfigdirs target-boehm-gc";; + *-*-linux*) + noconfigdirs="$noconfigdirs target-newlib target-libgloss";; + *) + unsupported_languages="$unsupported_languages fortran" + noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss";; + esac + ;; + crx-*-*) + noconfigdirs="$noconfigdirs target-libstdc++-v3 target-mudflap ${libgcj}" ;; d10v-*-*) noconfigdirs="$noconfigdirs target-libstdc++-v3 target-libgloss ${libgcj}" @@ -480,10 +566,12 @@ case "${target}" in noconfigdirs="$noconfigdirs ${libgcj}" ;; h8300*-*-*) - noconfigdirs="$noconfigdirs target-libgloss ${libgcj} target-libf2c" + noconfigdirs="$noconfigdirs target-libgloss ${libgcj}" ;; h8500-*-*) - noconfigdirs="$noconfigdirs target-libstdc++-v3 target-libgloss ${libgcj} target-libf2c" + noconfigdirs="$noconfigdirs target-libstdc++-v3 target-libgloss ${libgcj}" + ;; + hppa1.1-*-osf* | hppa1.1-*-bsd* ) ;; hppa*64*-*-linux* | parisc*64*-*-linux*) # In this case, it's because the hppa64-linux target is for @@ -491,13 +579,13 @@ case "${target}" in # headers, crt*.o, etc., all of which are needed by these. noconfigdirs="$noconfigdirs target-zlib" ;; + parisc*-*-linux* | hppa*-*-linux*) + ;; hppa*-*-*elf* | \ - parisc*-*-linux* | hppa*-*-linux* | \ hppa*-*-lites* | \ hppa*-*-openbsd* | \ hppa*64*-*-*) noconfigdirs="$noconfigdirs ${libgcj}" - # Do configure ld/binutils/gas for this case. ;; hppa*-*-*) # According to Alexandre Oliva , libjava won't @@ -509,18 +597,17 @@ case "${target}" in ;; ia64*-*-elf*) # No gdb support yet. - noconfigdirs="$noconfigdirs tix readline mmalloc libgui itcl gdb" + noconfigdirs="$noconfigdirs readline mmalloc libgui itcl gdb" ;; ia64*-**-hpux*) # No gdb or ld support yet. - noconfigdirs="$noconfigdirs ${libgcj} tix readline mmalloc libgui itcl gdb ld" + noconfigdirs="$noconfigdirs ${libgcj} readline mmalloc libgui itcl gdb ld" + ;; + i370-*-opened*) ;; i[[3456789]]86-*-coff | i[[3456789]]86-*-elf) noconfigdirs="$noconfigdirs ${libgcj}" ;; - i[[3456789]]86-*-freebsd* | i[[3456789]]86-*-kfreebsd*-gnu) - noconfigdirs="$noconfigdirs target-newlib target-libgloss" - ;; i[[3456789]]86-*-linux*) # The GCC port for glibc1 has no MD_FALLBACK_FRAME_STATE_FOR, so let's # not build java stuff by default. @@ -547,23 +634,30 @@ case "${target}" in # Can't build gdb for mingw32 if not native. case "${host}" in i[[3456789]]86-*-mingw32) ;; # keep gdb tcl tk expect etc. - *) noconfigdirs="$noconfigdirs gdb tcl tk expect itcl tix gnuserv" + *) noconfigdirs="$noconfigdirs gdb tcl tk expect itcl gnuserv" ;; esac ;; *-*-cygwin*) target_configdirs="$target_configdirs target-libtermcap target-winsup" noconfigdirs="$noconfigdirs target-gperf target-libgloss ${libgcj}" - # always build newlib. - skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'` + # always build newlib if winsup directory is present. + if test -d "$srcdir/winsup"; then + skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'` + elif test -d "$srcdir/newlib"; then + echo "Warning: winsup is missing so newlib can't be built." + fi # Can't build gdb for Cygwin if not native. case "${host}" in *-*-cygwin*) ;; # keep gdb tcl tk expect etc. - *) noconfigdirs="$noconfigdirs gdb tcl tk expect itcl tix libgui gnuserv" + *) noconfigdirs="$noconfigdirs gdb tcl tk expect itcl libgui gnuserv" ;; esac ;; + i[[3456789]]86-moss-msdos | i[[3456789]]86-*-moss* | \ + i[[3456789]]86-*-uwin* | i[[3456789]]86-*-interix* ) + ;; i[[3456789]]86-*-pe) noconfigdirs="$noconfigdirs target-libstdc++-v3 target-libgloss ${libgcj}" ;; @@ -584,6 +678,9 @@ case "${target}" in i[[3456789]]86-*-beos*) noconfigdirs="$noconfigdirs gdb target-newlib target-libgloss ${libgcj}" ;; + i[[3456789]]86-*-rdos*) + noconfigdirs="$noconfigdirs gdb target-newlib target-libgloss" + ;; m32r-*-*) noconfigdirs="$noconfigdirs ${libgcj}" ;; @@ -602,7 +699,8 @@ case "${target}" in noconfigdirs="$noconfigdirs target-libstdc++-v3" ;; mmix-*-*) - noconfigdirs="$noconfigdirs ${libgcj} gdb libgloss" + noconfigdirs="$noconfigdirs target-libffi target-boehm-gc gdb libgloss" + unsupported_languages="$unsupported_languages fortran java" ;; mn10200-*-*) noconfigdirs="$noconfigdirs ${libgcj}" @@ -610,19 +708,22 @@ case "${target}" in mn10300-*-*) noconfigdirs="$noconfigdirs ${libgcj}" ;; + mt-*-*) + noconfigdirs="$noconfigdirs sim" + ;; powerpc-*-aix*) # copied from rs6000-*-* entry - noconfigdirs="$noconfigdirs gprof target-libada target-libgloss ${libgcj}" + noconfigdirs="$noconfigdirs gprof target-libgloss target-libssp ${libgcj}" ;; powerpc*-*-winnt* | powerpc*-*-pe* | ppc*-*-pe) target_configdirs="$target_configdirs target-winsup" - noconfigdirs="$noconfigdirs gdb tcl tk make expect target-libgloss itcl tix gnuserv ${libgcj}" + noconfigdirs="$noconfigdirs gdb tcl tk make expect target-libgloss itcl gnuserv ${libgcj}" # always build newlib. skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'` ;; # This is temporary until we can link against shared libraries powerpcle-*-solaris*) - noconfigdirs="$noconfigdirs gdb sim make tcl tk expect itcl tix gnuserv ${libgcj}" + noconfigdirs="$noconfigdirs gdb sim make tcl tk expect itcl gnuserv ${libgcj}" ;; powerpc-*-beos*) noconfigdirs="$noconfigdirs gdb target-newlib target-libgloss ${libgcj}" @@ -630,11 +731,13 @@ case "${target}" in powerpc-*-eabi) noconfigdirs="$noconfigdirs ${libgcj}" ;; + powerpc-*-eabi* | powerpcle-*-eabi* | powerpc-*-rtems* ) + ;; rs6000-*-lynxos*) noconfigdirs="$noconfigdirs target-newlib gprof ${libgcj}" ;; rs6000-*-aix*) - noconfigdirs="$noconfigdirs gprof target-libada target-libgloss ${libgcj}" + noconfigdirs="$noconfigdirs gprof target-libgloss target-libssp ${libgcj}" ;; rs6000-*-*) noconfigdirs="$noconfigdirs gprof ${libgcj}" @@ -661,6 +764,9 @@ case "${target}" in mipstx39-*-*) noconfigdirs="$noconfigdirs gprof ${libgcj}" # same as generic mips ;; + mips64*-*-linux*) + noconfigdirs="$noconfigdirs target-newlib ${libgcj}" + ;; mips*-*-linux*) noconfigdirs="$noconfigdirs target-newlib target-libgloss" ;; @@ -670,7 +776,7 @@ case "${target}" in romp-*-*) noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes target-libgloss ${libgcj}" ;; - sh-*-*) + sh-*-* | sh64-*-*) case "${host}" in i[[3456789]]86-*-vsta) ;; # don't add gprof back in i[[3456789]]86-*-go32*) ;; # don't add gprof back in @@ -679,9 +785,6 @@ case "${target}" in esac noconfigdirs="$noconfigdirs target-libgloss ${libgcj}" ;; - sh64-*-*) - noconfigdirs="$noconfigdirs target-libgloss ${libgcj}" - ;; sparc-*-elf*) noconfigdirs="$noconfigdirs ${libgcj}" ;; @@ -699,6 +802,9 @@ case "${target}" in use_gnu_ld=no fi ;; + sparc-*-solaris2.[[0-6]] | sparc-*-solaris2.[[0-6]].*) + noconfigdirs="$noconfigdirs ${libgcj}" + ;; sparc-*-solaris* | sparc64-*-solaris* | sparcv9-*-solaris*) ;; v810-*-*) @@ -725,7 +831,7 @@ case "${target}" in ip2k-*-*) noconfigdirs="$noconfigdirs target-libiberty target-libstdc++-v3 ${libgcj}" ;; - *-*-linux*) + *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu) noconfigdirs="$noconfigdirs target-newlib target-libgloss" ;; *-*-lynxos*) @@ -743,273 +849,6 @@ case "${noconfigdirs}" in *target-newlib*) noconfigdirs="$noconfigdirs target-libgloss" ;; esac -# Figure out what language subdirectories are present. -# Look if the user specified --enable-languages="..."; if not, use -# the environment variable $LANGUAGES if defined. $LANGUAGES might -# go away some day. -# NB: embedded tabs in this IF block -- do not untabify -if test x"${enable_languages+set}" != xset; then - if test x"${LANGUAGES+set}" = xset; then - enable_languages="${LANGUAGES}" - echo configure.in: warning: setting LANGUAGES is deprecated, use --enable-languages instead 1>&2 - else - enable_languages=all - fi -else - if test x"${enable_languages}" = x || - test x"${enable_languages}" = xyes; - then - echo configure.in: --enable-languages needs at least one language argument 1>&2 - exit 1 - fi -fi -enable_languages=`echo "${enable_languages}" | sed -e 's/[[ ,]][[ ,]]*/,/g' -e 's/,$//'` - -# First scan to see if an enabled language requires some other language. -# We assume that a given config-lang.in will list all the language -# front ends it requires, even if some are required indirectly. -for lang_frag in ${srcdir}/gcc/*/config-lang.in .. ; do - case ${lang_frag} in - ..) ;; - # The odd quoting in the next line works around - # an apparent bug in bash 1.12 on linux. - ${srcdir}/gcc/[[*]]/config-lang.in) ;; - *) - # From the config-lang.in, get $language, $lang_requires - language= - lang_requires= - . ${lang_frag} - for other in ${lang_requires} ; do - case ,${enable_languages}, in - *,$other,*) ;; - *,all,*) ;; - *,$language,*) - echo " \`$other' language required by \`$language'; enabling" 1>&2 - enable_languages="${enable_languages},${other}" - ;; - esac - done - ;; - esac -done - -for lang_frag in ${srcdir}/gcc/*/config-lang.in .. ; do - case ${lang_frag} in - ..) ;; - # The odd quoting in the next line works around - # an apparent bug in bash 1.12 on linux. - ${srcdir}/gcc/[[*]]/config-lang.in) ;; - *) - # From the config-lang.in, get $language, $target_libs, - # $lang_dirs, and $build_by_default - language= - target_libs= - lang_dirs= - build_by_default= - . ${lang_frag} - if test "x$language" = x ; then - echo "${lang_frag} doesn't set \$language." 1>&2 - exit 1 - fi - case ,${enable_languages}, in - *,${language},*) - # Language was explicitly selected; include it. - add_this_lang=yes - ;; - *,all,*) - # 'all' was selected; include 'default' languages. - case ${build_by_default} in - no) add_this_lang=no ;; - *) add_this_lang=yes ;; - esac - ;; - *) add_this_lang=no ;; - esac - case ${add_this_lang} in - no) - # Remove language-dependent dirs. - eval noconfigdirs='"$noconfigdirs "'\"$target_libs $lang_dirs\" - ;; - esac - ;; - esac -done - -# Remove the entries in $skipdirs and $noconfigdirs from $configdirs and -# $target_configdirs. -# If we have the source for $noconfigdirs entries, add them to $notsupp. - -notsupp="" -for dir in . $skipdirs $noconfigdirs ; do - dirname=`echo $dir | sed -e s/target-//g` - if test $dir != . && echo " ${configdirs} " | grep " ${dir} " >/dev/null 2>&1; then - configdirs=`echo " ${configdirs} " | sed -e "s/ ${dir} / /"` - if test -r $srcdir/$dirname/configure ; then - if echo " ${skipdirs} " | grep " ${dir} " >/dev/null 2>&1; then - true - else - notsupp="$notsupp $dir" - fi - fi - fi - if test $dir != . && echo " ${target_configdirs} " | grep " ${dir} " >/dev/null 2>&1; then - target_configdirs=`echo " ${target_configdirs} " | sed -e "s/ ${dir} / /"` - if test -r $srcdir/$dirname/configure ; then - if echo " ${skipdirs} " | grep " ${dir} " >/dev/null 2>&1; then - true - else - notsupp="$notsupp $dir" - fi - fi - fi -done - -# Sometimes the tools are distributed with libiberty but with no other -# libraries. In that case, we don't want to build target-libiberty. -if test -n "${target_configdirs}" ; then - others= - for i in `echo ${target_configdirs} | sed -e s/target-//g` ; do - if test "$i" != "libiberty" ; then - if test -r $srcdir/$i/configure ; then - others=yes; - break; - fi - fi - done - if test -z "${others}" ; then - target_configdirs= - fi -fi - -# Quietly strip out all directories which aren't configurable in this tree. -# This relies on all configurable subdirectories being autoconfiscated, which -# is now the case. -configdirs_all="$configdirs" -configdirs= -for i in ${configdirs_all} ; do - if test -f ${srcdir}/$i/configure ; then - configdirs="${configdirs} $i" - fi -done -target_configdirs_all="$target_configdirs" -target_configdirs= -for i in ${target_configdirs_all} ; do - j=`echo $i | sed -e s/target-//g` - if test -f ${srcdir}/$j/configure ; then - target_configdirs="${target_configdirs} $i" - fi -done - -# Produce a warning message for the subdirs we can't configure. -# This isn't especially interesting in the Cygnus tree, but in the individual -# FSF releases, it's important to let people know when their machine isn't -# supported by the one or two programs in a package. - -if test -n "${notsupp}" && test -z "${norecursion}" ; then - # If $appdirs is non-empty, at least one of those directories must still - # be configured, or we error out. (E.g., if the gas release supports a - # specified target in some subdirs but not the gas subdir, we shouldn't - # pretend that all is well.) - if test -n "$appdirs" ; then - for dir in $appdirs ; do - if test -r $dir/Makefile.in ; then - if echo " ${configdirs} " | grep " ${dir} " >/dev/null 2>&1; then - appdirs="" - break - fi - if echo " ${target_configdirs} " | grep " ${dir} " >/dev/null 2>&1; then - appdirs="" - break - fi - fi - done - if test -n "$appdirs" ; then - echo "*** This configuration is not supported by this package." 1>&2 - exit 1 - fi - fi - # Okay, some application will build, or we don't care to check. Still - # notify of subdirs not getting built. - echo "*** This configuration is not supported in the following subdirectories:" 1>&2 - echo " ${notsupp}" 1>&2 - echo " (Any other directories should still work fine.)" 1>&2 -fi - -case "$host" in - *msdosdjgpp*) - enable_gdbtk=no ;; -esac - -copy_dirs= - -# Handle --with-headers=XXX. If the value is not "yes", the contents of -# the named directory are copied to $(tooldir)/sys-include. -if test x"${with_headers}" != x && test x"${with_headers}" != xno ; then - if test x${is_cross_compiler} = xno ; then - echo 1>&2 '***' --with-headers is only supported when cross compiling - exit 1 - fi - if test x"${with_headers}" != xyes ; then - case "${exec_prefixoption}" in - "") x=${prefix} ;; - *) x=${exec_prefix} ;; - esac - copy_dirs="${copy_dirs} ${with_headers} $x/${target_alias}/sys-include" - fi -fi - -# Handle --with-libs=XXX. If the value is not "yes", the contents of -# the name directories are copied to $(tooldir)/lib. Multiple directories -# are permitted. -if test x"${with_libs}" != x && test x"${with_libs}" != xno ; then - if test x${is_cross_compiler} = xno ; then - echo 1>&2 '***' --with-libs is only supported when cross compiling - exit 1 - fi - if test x"${with_libs}" != xyes ; then - # Copy the libraries in reverse order, so that files in the first named - # library override files in subsequent libraries. - case "${exec_prefixoption}" in - "") x=${prefix} ;; - *) x=${exec_prefix} ;; - esac - for l in ${with_libs}; do - copy_dirs="$l $x/${target_alias}/lib ${copy_dirs}" - done - fi -fi - -# Handle ${copy_dirs} -set fnord ${copy_dirs} -shift -while test $# != 0 ; do - if test -f $2/COPIED && test x"`cat $2/COPIED`" = x"$1" ; then - : - else - echo Copying $1 to $2 - - # Use the install script to create the directory and all required - # parent directories. - if test -d $2 ; then - : - else - echo >config.temp - ${srcdir}/install-sh -c -m 644 config.temp $2/COPIED - fi - - # Copy the directory, assuming we have tar. - # FIXME: Should we use B in the second tar? Not all systems support it. - (cd $1; tar -cf - .) | (cd $2; tar -xpf -) - - # It is the responsibility of the user to correctly adjust all - # symlinks. If somebody can figure out how to handle them correctly - # here, feel free to add the code. - - echo $1 > $2/COPIED - fi - shift; shift -done - # Work in distributions that contain no compiler tools, like Autoconf. tentative_cc="" host_makefile_frag=/dev/null @@ -1123,7 +962,6 @@ case "${host}" in host_makefile_frag="config/mh-cygwin" ;; *-mingw32*) - host_makefile_frag="config/mh-mingw32" ;; *-interix*) host_makefile_frag="config/mh-interix" @@ -1151,6 +989,15 @@ case "${host}" in tentative_cc="/usr/cygnus/progressive/bin/gcc" host_makefile_frag="config/mh-lynxrs6k" ;; + powerpc-*-darwin*) + host_makefile_frag="config/mh-ppc-darwin" + ;; + powerpc-*-aix*) + host_makefile_frag="config/mh-ppc-aix" + ;; + rs6000-*-aix*) + host_makefile_frag="config/mh-ppc-aix" + ;; *-*-lynxos*) # /bin/cc is less than useful for our purposes. Always use GCC tentative_cc="/bin/gcc" @@ -1158,22 +1005,623 @@ case "${host}" in *-*-sysv4*) host_makefile_frag="config/mh-sysv4" ;; + # This is placed last to prevent interfering with the cases above. + i[[3456789]]86-*-*) + # Build the stage2 and stage3 compilers with -fomit-frame-pointer. + host_makefile_frag="config/mh-x86omitfp" + ;; esac fi +# If we aren't going to be using gcc, see if we can extract a definition +# of CC from the fragment. +# Actually, use the 'pre-extracted' version above. +if test -z "${CC}" && test "${build}" = "${host}" ; then + IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" + found= + for dir in $PATH; do + test -z "$dir" && dir=. + if test -f $dir/gcc; then + found=yes + break + fi + done + IFS="$save_ifs" + if test -z "${found}" && test -n "${tentative_cc}" ; then + CC=$tentative_cc + fi +fi + +if test "${build}" != "${host}" ; then + # If we are doing a Canadian Cross, in which the host and build systems + # are not the same, we set reasonable default values for the tools. + + CC=${CC-${host_alias}-gcc} + CFLAGS=${CFLAGS-"-g -O2"} + CXX=${CXX-${host_alias}-c++} + CXXFLAGS=${CXXFLAGS-"-g -O2"} + CC_FOR_BUILD=${CC_FOR_BUILD-gcc} + +else + # Set reasonable default values for some tools even if not Canadian. + # Of course, these are different reasonable default values, originally + # specified directly in the Makefile. + # We don't export, so that autoconf can do its job. + # Note that all these settings are above the fragment inclusion point + # in Makefile.in, so can still be overridden by fragments. + # This is all going to change when we autoconfiscate... + + CC_FOR_BUILD="\$(CC)" + AC_PROG_CC + + # We must set the default linker to the linker used by gcc for the correct + # operation of libtool. If LD is not defined and we are using gcc, try to + # set the LD default to the ld used by gcc. + if test -z "$LD"; then + if test "$GCC" = yes; then + case $build in + *-*-mingw*) + gcc_prog_ld=`$CC -print-prog-name=ld 2>&1 | tr -d '\015'` ;; + *) + gcc_prog_ld=`$CC -print-prog-name=ld 2>&1` ;; + esac + case $gcc_prog_ld in + # Accept absolute paths. + [[\\/]* | [A-Za-z]:[\\/]*)] + LD="$gcc_prog_ld" ;; + esac + fi + fi + + CXX=${CXX-"c++"} + CFLAGS=${CFLAGS-"-g"} + CXXFLAGS=${CXXFLAGS-"-g -O2"} +fi + +ACX_PROG_GNAT +ACX_PROG_CMP_IGNORE_INITIAL + +# Check for GMP and MPFR +gmplibs= +gmpinc= +have_gmp=yes +# Specify a location for mpfr +# check for this first so it ends up on the link line before gmp. +AC_ARG_WITH(mpfr-dir, [ --with-mpfr-dir=PATH Specify source directory for MPFR library]) + +if test "x$with_mpfr_dir" != x; then + gmpinc="-I$with_mpfr_dir" + gmplibs="$with_mpfr_dir/libmpfr.a" +else + gmplibs="-lmpfr" +fi + +AC_ARG_WITH(mpfr, [ --with-mpfr=PATH Specify directory for installed MPFR library]) + +if test "x$with_mpfr" != x; then + gmplibs="-L$with_mpfr/lib $gmplibs" + gmpinc="-I$with_mpfr/include" +fi + +# Specify a location for gmp +AC_ARG_WITH(gmp-dir, [ --with-gmp-dir=PATH Specify source directory for GMP library]) + +if test "x$with_gmp_dir" != x; then + gmpinc="$gmpinc -I$with_gmp_dir" + if test -f "$with_gmp_dir/.libs/libgmp.a"; then + gmplibs="$gmplibs $with_gmp_dir/.libs/libgmp.a" + elif test -f "$with_gmp_dir/_libs/libgmp.a"; then + gmplibs="$gmplibs $with_gmp_dir/_libs/libgmp.a" + fi + # One of the later tests will catch the error if neither library is present. +else + gmplibs="$gmplibs -lgmp" +fi + +AC_ARG_WITH(gmp, [ --with-gmp=PATH Specify directory for installed GMP library]) + +if test "x$with_gmp" != x; then + gmplibs="-L$with_gmp/lib $gmplibs" + gmpinc="-I$with_gmp/include $gmpinc" +fi + +saved_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $gmpinc" +# Check GMP actually works +AC_MSG_CHECKING([for correct version of gmp.h]) +AC_TRY_COMPILE([#include "gmp.h"],[ +#if __GNU_MP_VERSION < 3 +choke me +#endif +], [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no]); have_gmp=no]) + +if test x"$have_gmp" = xyes; then + AC_MSG_CHECKING([for MPFR]) + + saved_LIBS="$LIBS" + LIBS="$LIBS $gmplibs" + AC_TRY_LINK([#include +#include ], [mpfr_t n; mpfr_init(n);], + [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]); have_gmp=no]) + LIBS="$saved_LIBS" + CFLAGS="$saved_CFLAGS" +fi + +# Flags needed for both GMP and/or MPFR +AC_SUBST(gmplibs) +AC_SUBST(gmpinc) + +# By default, C is the only stage 1 language. +stage1_languages=c +AC_SUBST(stage1_languages) + +# Figure out what language subdirectories are present. +# Look if the user specified --enable-languages="..."; if not, use +# the environment variable $LANGUAGES if defined. $LANGUAGES might +# go away some day. +# NB: embedded tabs in this IF block -- do not untabify +if test -d ${srcdir}/gcc; then + if test x"${enable_languages+set}" != xset; then + if test x"${LANGUAGES+set}" = xset; then + enable_languages="${LANGUAGES}" + echo configure.in: warning: setting LANGUAGES is deprecated, use --enable-languages instead 1>&2 + else + enable_languages=all + fi + else + if test x"${enable_languages}" = x || + test x"${enable_languages}" = xyes; + then + echo configure.in: --enable-languages needs at least one language argument 1>&2 + exit 1 + fi + fi + enable_languages=`echo "${enable_languages}" | sed -e 's/[[ ,]][[ ,]]*/,/g' -e 's/,$//'` + + # 'f95' is the old name for the 'fortran' language. We issue a warning + # and make the substitution. + case ,${enable_languages}, in + *,f95,*) + echo configure.in: warning: 'f95' as language name is deprecated, use 'fortran' instead 1>&2 + enable_languages=`echo "${enable_languages}" | sed -e 's/f95/fortran/g'` + ;; + esac + + # First scan to see if an enabled language requires some other language. + # We assume that a given config-lang.in will list all the language + # front ends it requires, even if some are required indirectly. + for lang_frag in ${srcdir}/gcc/*/config-lang.in .. ; do + case ${lang_frag} in + ..) ;; + # The odd quoting in the next line works around + # an apparent bug in bash 1.12 on linux. + ${srcdir}/gcc/[[*]]/config-lang.in) ;; + *) + # From the config-lang.in, get $language, $lang_requires + language= + lang_requires= + . ${lang_frag} + for other in ${lang_requires} ; do + case ,${enable_languages}, in + *,$other,*) ;; + *,all,*) ;; + *,$language,*) + echo " \`$other' language required by \`$language'; enabling" 1>&2 + enable_languages="${enable_languages},${other}" + ;; + esac + done + ;; + esac + done + + new_enable_languages=c + missing_languages=`echo ",$enable_languages," | sed -e s/,all,/,/ -e s/,c,/,/ ` + potential_languages=c + + for lang_frag in ${srcdir}/gcc/*/config-lang.in .. ; do + case ${lang_frag} in + ..) ;; + # The odd quoting in the next line works around + # an apparent bug in bash 1.12 on linux. + ${srcdir}/gcc/[[*]]/config-lang.in) ;; + *) + # From the config-lang.in, get $language, $target_libs, + # $lang_dirs, $boot_language, and $build_by_default + language= + target_libs= + lang_dirs= + boot_language= + build_by_default= + need_gmp= + . ${lang_frag} + potential_languages="${potential_languages},${language}" + # This is quite sensitive to the ordering of the case statement arms. + case ,${enable_languages},:${language}:${have_gnat}:${build_by_default} in + *::*:*) + echo "${lang_frag} doesn't set \$language." 1>&2 + exit 1 + ;; + *:ada:no:*) + # Ada was requested with no preexisting GNAT. Disable unconditionally. + add_this_lang=no + ;; + *,${language},*:*:*:*) + # Language was explicitly selected; include it. + add_this_lang=yes + ;; + *,all,*:*:*:no) + # 'all' was selected, but this is not a default language + # so do not include it. + add_this_lang=no + ;; + *,all,*:*:*:*) + # 'all' was selected and this is a default language; include it. + add_this_lang=yes + ;; + *) + add_this_lang=no + ;; + esac + + # Disable languages that need GMP if it isn't available. + case ,${enable_languages},:${have_gmp}:${need_gmp} in + *,${language},*:no:yes) + # Specifically requested language; tell them. + AC_MSG_ERROR([GMP with MPFR support is required to build $language]) + ;; + *:no:yes) + # Silently disable. + add_this_lang=no + ;; + esac + + # Disable a language that is unsupported by the target. + case " $unsupported_languages " in + *" $language "*) + add_this_lang=no + ;; + esac + + case $add_this_lang in + no) + # Remove language-dependent dirs. + eval noconfigdirs='"$noconfigdirs "'\"$target_libs $lang_dirs\" + ;; + *) + new_enable_languages="$new_enable_languages,$language" + missing_languages=`echo "$missing_languages" | sed "s/,$language,/,/"` + case ${boot_language} in + yes) + # Add to (comma-separated) list of stage 1 languages. + stage1_languages="${stage1_languages},${language}" + ;; + esac + ;; + esac + ;; + esac + done + + missing_languages=`echo "$missing_languages" | sed -e "s/^,//" -e "s/,$//"` + if test "x$missing_languages" != x; then + AC_MSG_ERROR([ +The following requested languages could not be built: ${missing_languages} +Recognised languages are: ${potential_languages}]) + fi + + if test "x$new_enable_languages" != "x$enable_languages"; then + echo The following languages will be built: ${new_enable_languages} + fi + enable_languages="$new_enable_languages" + ac_configure_args=`echo " $ac_configure_args" | sed -e 's/ --enable-languages=[[^ ]]*//' -e 's/$/ --enable-languages='"$enable_languages"/ ` +fi + +# Handle --disable- generically. +for dir in $configdirs $build_configdirs $target_configdirs ; do + dirname=`echo $dir | sed -e s/target-//g -e s/build-//g -e s/-/_/g` + if eval test x\${enable_${dirname}} "=" xno ; then + noconfigdirs="$noconfigdirs $dir" + fi +done + +# Remove the entries in $skipdirs and $noconfigdirs from $configdirs, +# $build_configdirs and $target_configdirs. +# If we have the source for $noconfigdirs entries, add them to $notsupp. + +notsupp="" +for dir in . $skipdirs $noconfigdirs ; do + dirname=`echo $dir | sed -e s/target-//g -e s/build-//g` + if test $dir != . && echo " ${configdirs} " | grep " ${dir} " >/dev/null 2>&1; then + configdirs=`echo " ${configdirs} " | sed -e "s/ ${dir} / /"` + if test -r $srcdir/$dirname/configure ; then + if echo " ${skipdirs} " | grep " ${dir} " >/dev/null 2>&1; then + true + else + notsupp="$notsupp $dir" + fi + fi + fi + if test $dir != . && echo " ${build_configdirs} " | grep " ${dir} " >/dev/null 2>&1; then + build_configdirs=`echo " ${build_configdirs} " | sed -e "s/ ${dir} / /"` + if test -r $srcdir/$dirname/configure ; then + if echo " ${skipdirs} " | grep " ${dir} " >/dev/null 2>&1; then + true + else + notsupp="$notsupp $dir" + fi + fi + fi + if test $dir != . && echo " ${target_configdirs} " | grep " ${dir} " >/dev/null 2>&1; then + target_configdirs=`echo " ${target_configdirs} " | sed -e "s/ ${dir} / /"` + if test -r $srcdir/$dirname/configure ; then + if echo " ${skipdirs} " | grep " ${dir} " >/dev/null 2>&1; then + true + else + notsupp="$notsupp $dir" + fi + fi + fi +done + +# Sometimes the tools are distributed with libiberty but with no other +# libraries. In that case, we don't want to build target-libiberty. +if test -n "${target_configdirs}" ; then + others= + for i in `echo ${target_configdirs} | sed -e s/target-//g` ; do + if test "$i" != "libiberty" ; then + if test -r $srcdir/$i/configure ; then + others=yes; + break; + fi + fi + done + if test -z "${others}" ; then + target_configdirs= + fi +fi + +# Quietly strip out all directories which aren't configurable in this tree. +# This relies on all configurable subdirectories being autoconfiscated, which +# is now the case. +build_configdirs_all="$build_configdirs" +build_configdirs= +for i in ${build_configdirs_all} ; do + j=`echo $i | sed -e s/build-//g` + if test -f ${srcdir}/$j/configure ; then + build_configdirs="${build_configdirs} $i" + fi +done + +configdirs_all="$configdirs" +configdirs= +for i in ${configdirs_all} ; do + if test -f ${srcdir}/$i/configure ; then + configdirs="${configdirs} $i" + fi +done + +target_configdirs_all="$target_configdirs" +target_configdirs= +for i in ${target_configdirs_all} ; do + j=`echo $i | sed -e s/target-//g` + if test -f ${srcdir}/$j/configure ; then + target_configdirs="${target_configdirs} $i" + fi +done + +# Produce a warning message for the subdirs we can't configure. +# This isn't especially interesting in the Cygnus tree, but in the individual +# FSF releases, it's important to let people know when their machine isn't +# supported by the one or two programs in a package. + +if test -n "${notsupp}" && test -z "${norecursion}" ; then + # If $appdirs is non-empty, at least one of those directories must still + # be configured, or we error out. (E.g., if the gas release supports a + # specified target in some subdirs but not the gas subdir, we shouldn't + # pretend that all is well.) + if test -n "$appdirs" ; then + for dir in $appdirs ; do + if test -r $dir/Makefile.in ; then + if echo " ${configdirs} " | grep " ${dir} " >/dev/null 2>&1; then + appdirs="" + break + fi + if echo " ${target_configdirs} " | grep " target-${dir} " >/dev/null 2>&1; then + appdirs="" + break + fi + fi + done + if test -n "$appdirs" ; then + echo "*** This configuration is not supported by this package." 1>&2 + exit 1 + fi + fi + # Okay, some application will build, or we don't care to check. Still + # notify of subdirs not getting built. + echo "*** This configuration is not supported in the following subdirectories:" 1>&2 + echo " ${notsupp}" 1>&2 + echo " (Any other directories should still work fine.)" 1>&2 +fi + +case "$host" in + *msdosdjgpp*) + enable_gdbtk=no ;; +esac + +copy_dirs= + +AC_ARG_WITH([build-sysroot], + [ --with-build-sysroot=sysroot + use sysroot as the system root during the build], + [if test x"$withval" != x ; then + SYSROOT_CFLAGS_FOR_TARGET="--sysroot=$withval" + fi], + [SYSROOT_CFLAGS_FOR_TARGET=]) +AC_SUBST(SYSROOT_CFLAGS_FOR_TARGET) + +# Handle --with-headers=XXX. If the value is not "yes", the contents of +# the named directory are copied to $(tooldir)/sys-include. +if test x"${with_headers}" != x && test x"${with_headers}" != xno ; then + if test x${is_cross_compiler} = xno ; then + echo 1>&2 '***' --with-headers is only supported when cross compiling + exit 1 + fi + if test x"${with_headers}" != xyes ; then + case "${exec_prefixoption}" in + "") x=${prefix} ;; + *) x=${exec_prefix} ;; + esac + copy_dirs="${copy_dirs} ${with_headers} $x/${target_alias}/sys-include" + fi +fi + +# Handle --with-libs=XXX. If the value is not "yes", the contents of +# the name directories are copied to $(tooldir)/lib. Multiple directories +# are permitted. +if test x"${with_libs}" != x && test x"${with_libs}" != xno ; then + if test x${is_cross_compiler} = xno ; then + echo 1>&2 '***' --with-libs is only supported when cross compiling + exit 1 + fi + if test x"${with_libs}" != xyes ; then + # Copy the libraries in reverse order, so that files in the first named + # library override files in subsequent libraries. + case "${exec_prefixoption}" in + "") x=${prefix} ;; + *) x=${exec_prefix} ;; + esac + for l in ${with_libs}; do + copy_dirs="$l $x/${target_alias}/lib ${copy_dirs}" + done + fi +fi + +# Set with_gnu_as and with_gnu_ld as appropriate. +# +# This is done by determining whether or not the appropriate directory +# is available, and by checking whether or not specific configurations +# have requested that this magic not happen. +# +# The command line options always override the explicit settings in +# configure.in, and the settings in configure.in override this magic. +# +# If the default for a toolchain is to use GNU as and ld, and you don't +# want to do that, then you should use the --without-gnu-as and +# --without-gnu-ld options for the configure script. + +if test x${use_gnu_as} = x && + echo " ${configdirs} " | grep " gas " > /dev/null 2>&1 ; then + with_gnu_as=yes + extra_host_args="$extra_host_args --with-gnu-as" +fi + +if test x${use_gnu_ld} = x && + echo " ${configdirs} " | grep " ld " > /dev/null 2>&1 ; then + with_gnu_ld=yes + extra_host_args="$extra_host_args --with-gnu-ld" +fi + +# If using newlib, add --with-newlib to the extra_host_args so that gcc/configure +# can detect this case. + +if test x${with_newlib} != xno && echo " ${target_configdirs} " | grep " target-newlib " > /dev/null 2>&1 ; then + with_newlib=yes + extra_host_args="$extra_host_args --with-newlib" +fi + +# Handle ${copy_dirs} +set fnord ${copy_dirs} +shift +while test $# != 0 ; do + if test -f $2/COPIED && test x"`cat $2/COPIED`" = x"$1" ; then + : + else + echo Copying $1 to $2 + + # Use the install script to create the directory and all required + # parent directories. + if test -d $2 ; then + : + else + echo >config.temp + ${srcdir}/install-sh -c -m 644 config.temp $2/COPIED + fi + + # Copy the directory, assuming we have tar. + # FIXME: Should we use B in the second tar? Not all systems support it. + (cd $1; tar -cf - .) | (cd $2; tar -xpf -) + + # It is the responsibility of the user to correctly adjust all + # symlinks. If somebody can figure out how to handle them correctly + # here, feel free to add the code. + + echo $1 > $2/COPIED + fi + shift; shift +done + +# Determine a target-dependent exec_prefix that the installed +# gcc will search in. Keep this list sorted by triplet, with +# the *-*-osname triplets last. +md_exec_prefix= +case "${target}" in + alpha*-*-*vms*) + md_exec_prefix=/gnu/lib/gcc-lib + ;; + i[34567]86-pc-msdosdjgpp*) + md_exec_prefix=/dev/env/DJDIR/bin + ;; + i[34567]86-*-sco3.2v5*) + if test $with_gnu_as = yes; then + md_exec_prefix=/usr/gnu/bin + else + md_exec_prefix=/usr/ccs/bin/elf + fi + ;; + + mn10300-*-* | \ + powerpc-*-chorusos* | \ + powerpc*-*-eabi* | \ + powerpc*-*-sysv* | \ + powerpc*-*-kaos* | \ + s390x-ibm-tpf*) + md_exec_prefix=/usr/ccs/bin + ;; + sparc64-*-elf*) + ;; + v850*-*-*) + md_exec_prefix=/usr/ccs/bin + ;; + xtensa-*-elf*) + ;; + + *-*-beos* | \ + *-*-elf* | \ + *-*-hpux* | \ + *-*-netware* | \ + *-*-nto-qnx* | \ + *-*-rtems* | \ + *-*-solaris2* | \ + *-*-sysv[45]* | \ + *-*-vxworks* | \ + *-wrs-windiss) + md_exec_prefix=/usr/ccs/bin + ;; +esac + extra_arflags_for_target= extra_nmflags_for_target= extra_ranlibflags_for_target= target_makefile_frag=/dev/null case "${target}" in - i[[3456789]]86-*-netware*) + *-*-netware*) target_makefile_frag="config/mt-netware" ;; - powerpc-*-netware*) - target_makefile_frag="config/mt-netware" - ;; - *-*-linux*) - target_makefile_frag="config/mt-linux" + *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu) + target_makefile_frag="config/mt-gnu" ;; *-*-aix4.[[3456789]]* | *-*-aix[[56789]].*) # nm and ar from AIX 4.3 and above require -X32_64 flag to all ar and nm @@ -1221,40 +1669,6 @@ case "${enable_target_optspace}:${target}" in ;; esac -# Set with_gnu_as and with_gnu_ld as appropriate. -# -# This is done by determining whether or not the appropriate directory -# is available, and by checking whether or not specific configurations -# have requested that this magic not happen. -# -# The command line options always override the explicit settings in -# configure.in, and the settings in configure.in override this magic. -# -# If the default for a toolchain is to use GNU as and ld, and you don't -# want to do that, then you should use the --without-gnu-as and -# --without-gnu-ld options for the configure script. - -if test x${use_gnu_as} = x && - echo " ${configdirs} " | grep " gas " > /dev/null 2>&1 ; then - with_gnu_as=yes - extra_host_args="$extra_host_args --with-gnu-as" -fi - -if test x${use_gnu_ld} = x && - echo " ${configdirs} " | grep " ld " > /dev/null 2>&1 ; then - with_gnu_ld=yes - extra_host_args="$extra_host_args --with-gnu-ld" -fi - -# If using newlib, add --with-newlib to the extra_host_args so that gcc/configure -# can detect this case. - -if test x${with_newlib} != xno && echo " ${target_configdirs} " | grep " target-newlib " > /dev/null 2>&1 ; then - with_newlib=yes - extra_host_args="$extra_host_args --with-newlib" -fi - - # Default to using --with-stabs for certain targets. if test x${with_stabs} = x ; then case "${target}" in @@ -1275,282 +1689,11 @@ case "${host}" in ;; esac -# If we aren't going to be using gcc, see if we can extract a definition -# of CC from the fragment. -# Actually, use the 'pre-extracted' version above. -if test -z "${CC}" && test "${build}" = "${host}" ; then - IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" - found= - for dir in $PATH; do - test -z "$dir" && dir=. - if test -f $dir/gcc; then - found=yes - break - fi - done - IFS="$save_ifs" - if test -z "${found}" && test -n "${tentative_cc}" ; then - CC=$tentative_cc - fi -fi - # Some systems (e.g., one of the i386-aix systems the gas testers are # using) don't handle "\$" correctly, so don't use it here. tooldir='${exec_prefix}'/${target_alias} build_tooldir=${tooldir} -# Generate a default definition for YACC. This is used if the makefile can't -# locate bison or byacc in objdir. - -for prog in 'bison -y' byacc yacc -do - set dummy $prog; tmp=$2 - IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" - for dir in $PATH; do - test -z "$dir" && dir=. - if test -f $dir/$tmp; then - DEFAULT_YACC="$prog" - break - fi - done - IFS="$save_ifs" - - test -n "$DEFAULT_YACC" && break -done - -# Generate a default definition for M4. This is used if the makefile can't -# locate m4 in objdir. - -for prog in gm4 gnum4 m4 -do - set dummy $prog; tmp=$2 - IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" - for dir in $PATH; do - test -z "$dir" && dir=. - if test -f $dir/$tmp; then - DEFAULT_M4="$prog" - break - fi - done - IFS="$save_ifs" - - test -n "$DEFAULT_M4" && break -done - -# Generate a default definition for LEX. This is used if the makefile can't -# locate flex in objdir. - -for prog in flex lex -do - set dummy $prog; tmp=$2 - IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" - for dir in $PATH; do - test -z "$dir" && dir=. - if test -f $dir/$tmp; then - DEFAULT_LEX="$prog" - break - fi - done - IFS="$save_ifs" - - test -n "$DEFAULT_LEX" && break -done - -if test "${build}" != "${host}" ; then - # If we are doing a Canadian Cross, in which the host and build systems - # are not the same, we set reasonable default values for the tools. - - BISON=${BISON-bison} - CC=${CC-${host_alias}-gcc} - CFLAGS=${CFLAGS-"-g -O2"} - CXX=${CXX-${host_alias}-c++} - CXXFLAGS=${CXXFLAGS-"-g -O2"} - CC_FOR_BUILD=${CC_FOR_BUILD-gcc} - CC_FOR_TARGET=${CC_FOR_TARGET-${target_alias}-gcc} - CXX_FOR_TARGET=${CXX_FOR_TARGET-${target_alias}-c++} - GCJ_FOR_TARGET=${GCJ_FOR_TARGET-${target_alias}-gcj} - GCC_FOR_TARGET=${GCC_FOR_TARGET-${CC_FOR_TARGET-${target_alias}-gcc}} - BUILD_PREFIX=${build_alias}- - BUILD_PREFIX_1=${build_alias}- - MAKEINFO=${MAKEINFO-makeinfo} - - if test -z "${YACC}" ; then - IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" - for dir in $PATH; do - test -z "$dir" && dir=. - if test -f $dir/bison; then - YACC="bison -y" - break - fi - if test -f $dir/byacc; then - YACC=byacc - break - fi - if test -f $dir/yacc; then - YACC=yacc - break - fi - done - IFS="$save_ifs" - if test -z "${YACC}" ; then - YACC="bison -y" - fi - fi - - if test -z "${LEX}" ; then - IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" - for dir in $PATH; do - test -z "$dir" && dir=. - if test -f $dir/flex; then - LEX=flex - break - fi - if test -f $dir/lex; then - LEX=lex - break - fi - done - IFS="$save_ifs" - LEX=${LEX-flex} - fi - -else - # Set reasonable default values for some tools even if not Canadian. - # Of course, these are different reasonable default values, originally - # specified directly in the Makefile. - # We don't export, so that autoconf can do its job. - # Note that all these settings are above the fragment inclusion point - # in Makefile.in, so can still be overridden by fragments. - # This is all going to change when we autoconfiscate... - - BISON="\$(USUAL_BISON)" - CC_FOR_BUILD="\$(CC)" - GCC_FOR_TARGET="\$(USUAL_GCC_FOR_TARGET)" - BUILD_PREFIX= - BUILD_PREFIX_1=loser- - MAKEINFO="\$(USUAL_MAKEINFO)" - LEX="\$(USUAL_LEX)" - YACC="\$(USUAL_YACC)" - - # If CC is still not set, try to get gcc. - cc_prog_is_gcc= - if test -z "${CC}" ; then - IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" - for dir in $PATH; do - test -z "$dir" && dir=. - if test -f $dir/gcc; then - CC="gcc" - cc_prog_is_gcc=yes - echo 'void f(){}' > conftest.c - if test -z "`${CC} -g -c conftest.c 2>&1`"; then - CFLAGS=${CFLAGS-"-g -O2"} - CXXFLAGS=${CXXFLAGS-"-g -O2"} - else - CFLAGS=${CFLAGS-"-O2"} - CXXFLAGS=${CXXFLAGS-"-O2"} - fi - rm -f conftest* - break - fi - done - IFS="$save_ifs" - CC=${CC-cc} - else - # Determine if we are using gcc. - cat > conftest.c </dev/null 2>&1; then - cc_prog_is_gcc=yes - fi - rm -f conftest.c - if test -z "${CFLAGS}"; then - # Here CC is set but CFLAGS is not. Use a quick hack to use -O2 if CC - # is set to a version of gcc. - if test "$cc_prog_is_gcc" = yes; then - echo 'void f(){}' > conftest.c - if test -z "`${CC} -g -c conftest.c 2>&1`"; then - CFLAGS=${CFLAGS-"-g -O2"} - CXXFLAGS=${CXXFLAGS-"-g -O2"} - else - CFLAGS=${CFLAGS-"-O2"} - CXXFLAGS=${CXXFLAGS-"-O2"} - fi - rm -f conftest* - fi - fi - fi - - # We must set the default linker to the linker used by gcc for the correct - # operation of libtool. If LD is not defined and we are using gcc, try to - # set the LD default to the ld used by gcc. - if test -z "$LD"; then - if test "$cc_prog_is_gcc" = yes; then - case $build in - *-*-mingw*) - gcc_prog_ld=`$CC -print-prog-name=ld 2>&1 | tr -d '\015'` ;; - *) - gcc_prog_ld=`$CC -print-prog-name=ld 2>&1` ;; - esac - case $gcc_prog_ld in - # Accept absolute paths. - [[\\/]* | [A-Za-z]:[\\/]*)] - LD="$gcc_prog_ld" ;; - esac - fi - fi - - CXX=${CXX-"c++"} - CFLAGS=${CFLAGS-"-g"} - CXXFLAGS=${CXXFLAGS-"-g -O2"} -fi - -# FIXME Should this be done recursively ??? (Useful for e.g. gdbtest) -# Set up the list of links to be made. -# ${links} is the list of link names, and ${files} is the list of names to link to. - -# Make the links. -configlinks="${links}" -if test -r ./config.status ; then - mv -f ./config.status ./config.back -fi -while test -n "${files}" ; do - # set file to car of files, files to cdr of files - set ${files}; file=$1; shift; files=$* - set ${links}; link=$1; shift; links=$* - - if test ! -r ${srcdir}/${file} ; then - if test ! -r ${file} ; then - echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2 - echo '***' "since the file \"${srcdir}/${file}\" does not exist." 1>&2 - exit 1 - else - srcfile=${file} - fi - else - srcfile=${srcdir}/${file} - fi - - ${remove} -f ${link} - # Make a symlink if possible, otherwise try a hard link - if ${symbolic_link} ${srcfile} ${link} >/dev/null 2>&1 ; then - true - else - # We need to re-remove the file because Lynx leaves a - # very strange directory there when it fails an NFS symlink. - ${remove} -r -f ${link} - ${hard_link} ${srcfile} ${link} - fi - if test ! -r ${link} ; then - echo '***' "${progname}: unable to link \"${link}\" to \"${srcfile}\"." 1>&2 - exit 1 - fi - - echo "Linked \"${link}\" to \"${srcfile}\"." -done - # Create a .gdbinit file which runs the one in srcdir # and tells GDB to look there for source files. @@ -1617,32 +1760,16 @@ case "${host}" in ;; esac -# If --enable-shared was set, we must set LD_LIBRARY_PATH so that the -# binutils tools will find libbfd.so. -case "${enable_shared}" in - no | "") SET_LIB_PATH= ;; - *) SET_LIB_PATH="\$(REALLY_SET_LIB_PATH)" ;; -esac - case "${host}" in *-*-hpux*) RPATH_ENVVAR=SHLIB_PATH ;; + *-*-darwin* | *-*-rhapsody* ) RPATH_ENVVAR=DYLD_LIBRARY_PATH ;; *) RPATH_ENVVAR=LD_LIBRARY_PATH ;; esac # Record target_configdirs and the configure arguments for target and # build configuration in Makefile. target_configdirs=`echo "${target_configdirs}" | sed -e 's/target-//g'` - -# This is the final value for target_configdirs. configdirs already -# has its final value, as does build_modules. It's time to create some -# lists of valid targets. - -all_build_modules= -configure_build_modules= -for module in ${build_modules} ; do - all_build_modules=all-build-${module} - configure_build_modules=configure-build-${module} -done +build_configdirs=`echo "${build_configdirs}" | sed -e 's/build-//g'` # Determine whether gdb needs tk/tcl or not. # Use 'maybe' since enable_gdbtk might be true even if tk isn't available @@ -1652,7 +1779,7 @@ done # leave out the maybe dependencies when enable_gdbtk is false. I'm not # 100% sure that that's safe though. -gdb_tk="maybe-all-tcl maybe-all-tk maybe-all-itcl maybe-all-tix maybe-all-libgui" +gdb_tk="maybe-all-tcl maybe-all-tk maybe-all-itcl maybe-all-libgui" case "$enable_gdbtk" in no) GDB_TK="" ;; @@ -1669,42 +1796,97 @@ case "$enable_gdbtk" in fi ;; esac +CONFIGURE_GDB_TK=`echo ${GDB_TK} | sed s/-all-/-configure-/g` +INSTALL_GDB_TK=`echo ${GDB_TK} | sed s/-all-/-install-/g` -# Create the 'maybe dependencies'. This uses a temporary file. +# Strip out unwanted targets. # While at that, we remove Makefiles if we were started for recursive # configuration, so that the top-level Makefile reconfigures them, # like we used to do when configure itself was recursive. -rm -f maybedep.tmp -echo '# maybedep.tmp' > maybedep.tmp -# Make-targets which may need maybe dependencies. -mts="configure all install check clean distclean dvi info install-info" -mts="${mts} installcheck mostlyclean maintainer-clean TAGS" +# Loop over modules. $extrasub must be used with care, limiting as +# much as possible the usage of range addresses. That's because autoconf +# splits the sed script to overcome limits in the number of commands, +# and relying on carefully-timed sed passes may turn out to be very hard +# to maintain later. In this particular case, you just have to be careful +# not to nest @if/@endif pairs, because configure will not warn you at all. -# Loop over modules and make-targets. -for module in ${build_modules} ; do +AC_ARG_ENABLE([bootstrap], +[ --enable-bootstrap Enable bootstrapping [yes if native build]],, +enable_bootstrap=default) + +# Issue errors and warnings for invalid/strange bootstrap combinations. +case "$configdirs" in + *gcc*) have_compiler=yes ;; + *) have_compiler=no ;; +esac + +case "$have_compiler:$host:$target:$enable_bootstrap" in + *:*:*:no) ;; + + # Default behavior. Enable bootstrap if we have a compiler + # and we are in a native configuration. + yes:$build:$build:default) + enable_bootstrap=yes ;; + + *:*:*:default) + enable_bootstrap=no ;; + + # We have a compiler and we are in a native configuration, bootstrap is ok + yes:$build:$build:yes) + ;; + + # Other configurations, but we have a compiler. Assume the user knows + # what he's doing. + yes:*:*:yes) + AC_MSG_WARN([trying to bootstrap a cross compiler]) + ;; + + # No compiler: if they passed --enable-bootstrap explicitly, fail + no:*:*:yes) + AC_MSG_ERROR([cannot bootstrap without a compiler]) ;; + + # Fail if wrong command line + *) + AC_MSG_ERROR([invalid option for --enable-bootstrap]) + ;; +esac + +# Adjust the toplevel makefile according to whether bootstrap was selected. +case "$enable_bootstrap" in + yes) + bootstrap_suffix=bootstrap ;; + no) + bootstrap_suffix=no-bootstrap ;; +esac + +for module in ${build_configdirs} ; do if test -z "${no_recursion}" \ && test -f ${build_subdir}/${module}/Makefile; then echo 1>&2 "*** removing ${build_subdir}/${module}/Makefile to force reconfigure" rm -f ${build_subdir}/${module}/Makefile fi - for mt in ${mts} ; do - case ${mt} in - install) ;; # No installing build modules. - *) echo "maybe-${mt}-build-${module}: ${mt}-build-${module}" >> maybedep.tmp ;; - esac - done + extrasub="$extrasub +/^@if build-$module\$/d +/^@endif build-$module\$/d +/^@if build-$module-$bootstrap_suffix\$/d +/^@endif build-$module-$bootstrap_suffix\$/d" done for module in ${configdirs} ; do - if test -z "${no_recursion}" \ - && test -f ${module}/Makefile; then - echo 1>&2 "*** removing ${module}/Makefile to force reconfigure" - rm -f ${module}/Makefile + if test -z "${no_recursion}"; then + for file in stage*-${module}/Makefile ${module}/Makefile; do + if test -f ${file}; then + echo 1>&2 "*** removing ${file} to force reconfigure" + rm -f ${file} + fi + done fi - for mt in ${mts} ; do - echo "maybe-${mt}-${module}: ${mt}-${module}" >> maybedep.tmp - done + extrasub="$extrasub +/^@if $module\$/d +/^@endif $module\$/d +/^@if $module-$bootstrap_suffix\$/d +/^@endif $module-$bootstrap_suffix\$/d" done for module in ${target_configdirs} ; do if test -z "${no_recursion}" \ @@ -1712,12 +1894,15 @@ for module in ${target_configdirs} ; do echo 1>&2 "*** removing ${target_subdir}/${module}/Makefile to force reconfigure" rm -f ${target_subdir}/${module}/Makefile fi - for mt in ${mts} ; do - echo "maybe-${mt}-target-${module}: ${mt}-target-${module}" >> maybedep.tmp - done + extrasub="$extrasub +/^@if target-$module\$/d +/^@endif target-$module\$/d +/^@if target-$module-$bootstrap_suffix\$/d +/^@endif target-$module-$bootstrap_suffix\$/d" done -maybe_dependencies=maybedep.tmp -AC_SUBST_FILE(maybe_dependencies) + +extrasub="$extrasub +/^@if /,/^@endif /d" # Create the serialization dependencies. This uses a temporary file. @@ -1780,21 +1965,21 @@ AC_SUBST_FILE(serialization_dependencies) # at the end of the argument list. # These will be expanded by make, so quote '$'. cat <<\EOF_SED > conftestsed -s/ --no[[^ ]]* / / -s/ --c[[a-z-]]*[[= ]][[^ ]]* / / -s/ --sr[[a-z-]]*[[= ]][[^ ]]* / / -s/ --ho[[a-z-]]*[[= ]][[^ ]]* / / -s/ --bu[[a-z-]]*[[= ]][[^ ]]* / / -s/ --t[[a-z-]]*[[= ]][[^ ]]* / / -s/ --program-[[pst]][[a-z-]]*[[= ]][[^ ]]* / / -s/ -cache-file[[= ]][[^ ]]* / / -s/ -srcdir[[= ]][[^ ]]* / / -s/ -host[[= ]][[^ ]]* / / -s/ -build[[= ]][[^ ]]* / / -s/ -target[[= ]][[^ ]]* / / -s/ -program-prefix[[= ]][[^ ]]* / / -s/ -program-suffix[[= ]][[^ ]]* / / -s/ -program-transform-name[[= ]][[^ ]]* / / +s/ --no[[^ ]]*/ /g +s/ --c[[a-z-]]*[[= ]][[^ ]]*//g +s/ --sr[[a-z-]]*[[= ]][[^ ]]*//g +s/ --ho[[a-z-]]*[[= ]][[^ ]]*//g +s/ --bu[[a-z-]]*[[= ]][[^ ]]*//g +s/ --t[[a-z-]]*[[= ]][[^ ]]*//g +s/ --program-[[pst]][[a-z-]]*[[= ]][[^ ]]*//g +s/ -cache-file[[= ]][[^ ]]*//g +s/ -srcdir[[= ]][[^ ]]*//g +s/ -host[[= ]][[^ ]]*//g +s/ -build[[= ]][[^ ]]*//g +s/ -target[[= ]][[^ ]]*//g +s/ -program-prefix[[= ]][[^ ]]*//g +s/ -program-suffix[[= ]][[^ ]]*//g +s/ -program-transform-name[[= ]][[^ ]]*//g s/ [[^' -][^ ]*] / / s/^ *//;s/ *$// s,\$,$$,g @@ -1822,7 +2007,7 @@ baseargs="$baseargs --program-transform-name='${gcc_transform_name}'" # For the build-side libraries, we just need to pretend we're native, # and not use the same cache file. Multilibs are neither needed nor # desired. -build_configargs="--cache-file=../config.cache --build=${build_alias} --host=${build_alias} ${baseargs}" +build_configargs="--cache-file=../config.cache --build=${build_alias} --host=${build_alias} --target=${target_alias} ${baseargs}" # For host modules, accept cache file option, or specification as blank. case "${cache_file}" in @@ -1869,26 +2054,10 @@ fi # fixed in future. It's still worthwhile to use a cache file for each # directory. I think. -# Pass the appropriate --host, --build, and --cache-file arguments. -target_configargs="--cache-file=./config.cache --host=${target_alias} --build=${build_alias} ${target_configargs}" - -# provide a proper gxx_include_dir. -# Note, if you change the default, make sure to fix both here and in -# the gcc and libstdc++-v3 subdirectories. -# Check whether --with-gxx-include-dir or --without-gxx-include-dir was given. -case "${with_gxx_include_dir}" in - yes) - AC_MSG_ERROR([--with-gxx-include-dir=[[dir]] requires a directory]) - ;; - no | "") - case "${enable_version_specific_runtime_libs}" in - yes) gxx_include_dir='${libsubdir}/include/c++' ;; - *) - . ${srcdir}/config.if - gxx_include_dir='${prefix}/include/'${libstdcxx_incdir} ;; - esac ;; - *) gxx_include_dir=${with_gxx_include_dir} ;; -esac +# Pass the appropriate --build, --host, --target and --cache-file arguments. +# We need to pass --target, as newer autoconf's requires consistency +# for target_alias and gcc doesn't manage it consistently. +target_configargs="--cache-file=./config.cache --build=${build_alias} --host=${target_alias} --target=${target_alias} ${target_configargs}" FLAGS_FOR_TARGET= case " $target_configdirs " in @@ -1910,7 +2079,7 @@ case " $target_configdirs " in # to it. This is right: we don't want to search that directory # for binaries, but we want the header files in there, so add # them explicitly. - FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -isystem $$r/gcc/include' + FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -isystem $$r/$(HOST_SUBDIR)/gcc/include' # Someone might think of using the pre-installed headers on # Canadian crosses, in case the installed compiler is not fully @@ -1957,105 +2126,33 @@ fi if test "x${use_gnu_ld}" = x && echo " ${configdirs} " | grep " ld " > /dev/null ; then # Arrange for us to find uninstalled linker scripts. - FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/ld' + FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/$(HOST_SUBDIR)/ld' fi -if test "x${CC_FOR_TARGET+set}" = xset; then - : -elif test -d ${srcdir}/gcc; then - CC_FOR_TARGET='$$r/gcc/xgcc -B$$r/gcc/' -elif test "$host" = "$target"; then - CC_FOR_TARGET='$(CC)' -else - CC_FOR_TARGET=`echo gcc | sed "${program_transform_name}"` -fi -CC_FOR_TARGET=$CC_FOR_TARGET' $(FLAGS_FOR_TARGET)' - -if test "x${GCJ_FOR_TARGET+set}" = xset; then - : -elif test -d ${srcdir}/gcc; then - GCJ_FOR_TARGET='$$r/gcc/gcj -B$$r/gcc/' -elif test "$host" = "$target"; then - GCJ_FOR_TARGET='gcj' -else - GCJ_FOR_TARGET=`echo gcj | sed "${program_transform_name}"` -fi -GCJ_FOR_TARGET=$GCJ_FOR_TARGET' $(FLAGS_FOR_TARGET)' - -# Don't use libstdc++-v3's flags to configure/build itself. -libstdcxx_flags='`test ! -f $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags || $(SHELL) $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags --build-includes` -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs' -raw_libstdcxx_flags='-L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs' - -if test "x${CXX_FOR_TARGET+set}" = xset; then - if test "x${RAW_CXX_FOR_TARGET+set}" != xset; then - RAW_CXX_FOR_TARGET=${CXX_FOR_TARGET} - fi -elif test -d ${srcdir}/gcc; then - # We add -shared-libgcc to CXX_FOR_TARGET whenever we use xgcc instead - # of g++ for linking C++ or Java, because g++ has -shared-libgcc by - # default whereas gcc does not. - # RAW_CXX_FOR_TARGET is for linking C++ or java; CXX_FOR_TARGET is for - # all other cases. - CXX_FOR_TARGET='$$r/gcc/g++ -B$$r/gcc/ -nostdinc++ '$libstdcxx_flags - RAW_CXX_FOR_TARGET='$$r/gcc/xgcc -shared-libgcc -B$$r/gcc/ -nostdinc++ '$raw_libstdcxx_flags -elif test "$host" = "$target"; then - CXX_FOR_TARGET='$(CXX)' - RAW_CXX_FOR_TARGET=${CXX_FOR_TARGET} -else - CXX_FOR_TARGET=`echo c++ | sed "${program_transform_name}"` - RAW_CXX_FOR_TARGET=${CXX_FOR_TARGET} -fi -CXX_FOR_TARGET=$CXX_FOR_TARGET' $(FLAGS_FOR_TARGET)' -RAW_CXX_FOR_TARGET=$RAW_CXX_FOR_TARGET' $(FLAGS_FOR_TARGET)' - -qCXX_FOR_TARGET=`echo "$CXX_FOR_TARGET" | sed 's,[[&%]],\\\&,g'` -qRAW_CXX_FOR_TARGET=`echo "$RAW_CXX_FOR_TARGET" | sed 's,[[&%]],\\\&,g'` - -# We want to defer the evaluation of `cmd`s and shell variables in -# CXX_FOR_TARGET when recursing in the top-level Makefile, such as for -# bootstrap. We'll enclose CXX_FOR_TARGET_FOR_RECURSIVE_MAKE in single -# quotes, but we still have to duplicate `$'s so that shell variables -# can be expanded by the nested make as shell variables, not as make -# macros. -qqCXX_FOR_TARGET=`echo "$qCXX_FOR_TARGET" | sed -e 's,[[$]][[$]],$$$$,g'` -qqRAW_CXX_FOR_TARGET=`echo "$qRAW_CXX_FOR_TARGET" | sed -e 's,[[$]][[$]],$$$$,g'` - -# Wrap CC_FOR_TARGET and friends, for certain types of builds. -CC_FOR_TARGET="\$(STAGE_CC_WRAPPER) ${CC_FOR_TARGET}" -GCJ_FOR_TARGET="\$(STAGE_CC_WRAPPER) ${GCJ_FOR_TARGET}" -CXX_FOR_TARGET="\$(STAGE_CC_WRAPPER) ${qCXX_FOR_TARGET}" -RAW_CXX_FOR_TARGET="\$(STAGE_CC_WRAPPER) ${qRAW_CXX_FOR_TARGET}" -CXX_FOR_TARGET_FOR_RECURSIVE_MAKE="\$(STAGE_CC_WRAPPER) ${qqCXX_FOR_TARGET}" -RAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE="\$(STAGE_CC_WRAPPER) ${qqRAW_CXX_FOR_TARGET}" - # Makefile fragments. -host_makefile_frag=${srcdir}/${host_makefile_frag} -target_makefile_frag=${srcdir}/${target_makefile_frag} -alphaieee_frag=${srcdir}/${alphaieee_frag} -ospace_frag=${srcdir}/${ospace_frag} +for frag in host_makefile_frag target_makefile_frag alphaieee_frag ospace_frag; +do + eval fragval=\$$frag + if test $fragval != /dev/null; then + eval $frag=${srcdir}/$fragval + fi +done AC_SUBST_FILE(host_makefile_frag) AC_SUBST_FILE(target_makefile_frag) AC_SUBST_FILE(alphaieee_frag) AC_SUBST_FILE(ospace_frag) # Miscellanea: directories, flags, etc. -AC_SUBST(SET_LIB_PATH) AC_SUBST(RPATH_ENVVAR) -AC_SUBST(BUILD_PREFIX) -AC_SUBST(BUILD_PREFIX_1) -AC_SUBST(configlinks) -AC_SUBST(gcc_version_trigger) -AC_SUBST(gcc_version) AC_SUBST(tooldir) AC_SUBST(build_tooldir) +AC_SUBST(CONFIGURE_GDB_TK) AC_SUBST(GDB_TK) -AC_SUBST(gxx_include_dir) -AC_SUBST(libstdcxx_incdir) +AC_SUBST(INSTALL_GDB_TK) # Build module lists & subconfigure args. AC_SUBST(build_configargs) -AC_SUBST(configure_build_modules) -AC_SUBST(all_build_modules) +AC_SUBST(build_configdirs) # Host module lists & subconfigure args. AC_SUBST(host_configargs) @@ -2063,74 +2160,178 @@ AC_SUBST(configdirs) # Target module lists & subconfigure args. AC_SUBST(target_configargs) -AC_SUBST(target_configdirs) + # Build tools. -AC_SUBST(BISON) AC_SUBST(CC_FOR_BUILD) -AC_SUBST(LEX) -AC_SUBST(MAKEINFO) -AC_SUBST(YACC) AC_SUBST(config_shell) +# Generate default definitions for YACC, M4, LEX and other programs that run +# on the build machine. These are used if the Makefile can't locate these +# programs in objdir. +MISSING=`cd $ac_aux_dir && ${PWDCMD-pwd}`/missing + +AC_CHECK_PROGS([YACC], ['bison -y' byacc yacc], [$MISSING bison -y]) +case " $build_configdirs " in + *" bison "*) YACC='$$r/$(BUILD_SUBDIR)/bison/tests/bison -y' ;; + *" byacc "*) YACC='$$r/$(BUILD_SUBDIR)/byacc/byacc' ;; +esac + +AC_CHECK_PROGS([BISON], [bison], [$MISSING bison]) +case " $build_configdirs " in + *" bison "*) BISON='$$r/$(BUILD_SUBDIR)/bison/tests/bison' ;; +esac + +AC_CHECK_PROGS([M4], [gm4 gnum4 m4], [$MISSING m4]) +case " $build_configdirs " in + *" m4 "*) M4='$$r/$(BUILD_SUBDIR)/m4/m4' ;; +esac + +AC_CHECK_PROGS([LEX], [flex lex], [$MISSING flex]) +case " $build_configdirs " in + *" flex "*) LEX='$$r/$(BUILD_SUBDIR)/flex/flex' ;; + *" lex "*) LEX='$$r/$(BUILD_SUBDIR)/lex/lex' ;; +esac + +AC_CHECK_PROGS([FLEX], [flex], [$MISSING flex]) +case " $build_configdirs " in + *" flex "*) FLEX='$$r/$(BUILD_SUBDIR)/flex/flex' ;; +esac + +AC_CHECK_PROGS([MAKEINFO], makeinfo, [$MISSING makeinfo]) +case " $build_configdirs " in + *" texinfo "*) MAKEINFO='$$r/$(BUILD_SUBDIR)/texinfo/makeinfo/makeinfo' ;; + *) +changequote(,) + # For an installed makeinfo, we require it to be from texinfo 4.4 or + # higher, else we use the "missing" dummy. + if ${MAKEINFO} --version \ + | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.[4-9]|[5-9])' >/dev/null 2>&1; then + : + else + MAKEINFO="$MISSING makeinfo" + fi + ;; +changequote([,]) +esac + +# FIXME: expect and dejagnu may become build tools? + +AC_CHECK_PROGS(EXPECT, expect, expect) +case " $configdirs " in + *" expect "*) + test $host = $build && EXPECT='$$r/$(HOST_SUBDIR)/expect/expect' + ;; +esac + +AC_CHECK_PROGS(RUNTEST, runtest, runtest) +case " $configdirs " in + *" dejagnu "*) + test $host = $build && RUNTEST='$$r/$(HOST_SUBDIR)/dejagnu/runtest' + ;; +esac + + # Host tools. -NCN_STRICT_CHECK_TOOL(AR, ar) -NCN_STRICT_CHECK_TOOL(AS, as) -NCN_STRICT_CHECK_TOOL(DLLTOOL, dlltool) -NCN_STRICT_CHECK_TOOL(LD, ld) -NCN_STRICT_CHECK_TOOL(NM, nm) -NCN_STRICT_CHECK_TOOL(RANLIB, ranlib, :) -NCN_STRICT_CHECK_TOOL(WINDRES, windres) -NCN_STRICT_CHECK_TOOL(OBJCOPY, objcopy) -NCN_STRICT_CHECK_TOOL(OBJDUMP, objdump) +NCN_STRICT_CHECK_TOOLS(AR, ar) +NCN_STRICT_CHECK_TOOLS(AS, as) +NCN_STRICT_CHECK_TOOLS(DLLTOOL, dlltool) +NCN_STRICT_CHECK_TOOLS(LD, ld) +NCN_STRICT_CHECK_TOOLS(LIPO, lipo) +NCN_STRICT_CHECK_TOOLS(NM, nm) +NCN_STRICT_CHECK_TOOLS(RANLIB, ranlib, :) +NCN_STRICT_CHECK_TOOLS(STRIP, strip, :) +NCN_STRICT_CHECK_TOOLS(WINDRES, windres) +NCN_STRICT_CHECK_TOOLS(OBJCOPY, objcopy) +NCN_STRICT_CHECK_TOOLS(OBJDUMP, objdump) AC_SUBST(CC) AC_SUBST(CXX) AC_SUBST(CFLAGS) AC_SUBST(CFLAGS_FOR_BUILD) AC_SUBST(CXXFLAGS) -AC_SUBST(DEFAULT_YACC) -AC_SUBST(DEFAULT_LEX) -AC_SUBST(DEFAULT_M4) # Target tools. -NCN_STRICT_CHECK_TARGET_TOOL(AR_FOR_TARGET, ar) -NCN_STRICT_CHECK_TARGET_TOOL(AS_FOR_TARGET, as) -NCN_STRICT_CHECK_TARGET_TOOL(DLLTOOL_FOR_TARGET, dlltool) -NCN_STRICT_CHECK_TARGET_TOOL(LD_FOR_TARGET, ld) -NCN_STRICT_CHECK_TARGET_TOOL(NM_FOR_TARGET, nm) -NCN_STRICT_CHECK_TARGET_TOOL(RANLIB_FOR_TARGET, ranlib, :) -NCN_STRICT_CHECK_TARGET_TOOL(WINDRES_FOR_TARGET, windres) +AC_ARG_WITH([build-time-tools], + [ --with-build-time-tools=path + use given path to find target tools during the build], + [case x"$withval" in + x/*) ;; + *) + with_build_time_tools= + AC_MSG_WARN([argument to --with-build-time-tools must be an absolute path]) + ;; + esac], + [with_build_time_tools=]) + +NCN_STRICT_CHECK_TARGET_TOOLS(CC_FOR_TARGET, cc gcc) +NCN_STRICT_CHECK_TARGET_TOOLS(CXX_FOR_TARGET, c++ g++ cxx gxx) +NCN_STRICT_CHECK_TARGET_TOOLS(GCC_FOR_TARGET, gcc, ${CC_FOR_TARGET}) +NCN_STRICT_CHECK_TARGET_TOOLS(GCJ_FOR_TARGET, gcj) +NCN_STRICT_CHECK_TARGET_TOOLS(GFORTRAN_FOR_TARGET, gfortran) + +ACX_CHECK_INSTALLED_TARGET_TOOL(AR_FOR_TARGET, ar) +ACX_CHECK_INSTALLED_TARGET_TOOL(AS_FOR_TARGET, as) +ACX_CHECK_INSTALLED_TARGET_TOOL(DLLTOOL_FOR_TARGET, dlltool) +ACX_CHECK_INSTALLED_TARGET_TOOL(LD_FOR_TARGET, ld) +ACX_CHECK_INSTALLED_TARGET_TOOL(LIPO_FOR_TARGET, lipo) +ACX_CHECK_INSTALLED_TARGET_TOOL(NM_FOR_TARGET, nm) +ACX_CHECK_INSTALLED_TARGET_TOOL(OBJDUMP_FOR_TARGET, objdump) +ACX_CHECK_INSTALLED_TARGET_TOOL(RANLIB_FOR_TARGET, ranlib, :) +ACX_CHECK_INSTALLED_TARGET_TOOL(STRIP_FOR_TARGET, strip) +ACX_CHECK_INSTALLED_TARGET_TOOL(WINDRES_FOR_TARGET, windres) + +RAW_CXX_FOR_TARGET="$CXX_FOR_TARGET" + +GCC_TARGET_TOOL(ar, AR_FOR_TARGET, AR, [binutils/ar]) +GCC_TARGET_TOOL(as, AS_FOR_TARGET, AS, [gas/as-new]) +GCC_TARGET_TOOL(cc, CC_FOR_TARGET, CC, [gcc/xgcc -B$$r/$(HOST_SUBDIR)/gcc/]) +GCC_TARGET_TOOL(c++, CXX_FOR_TARGET, CXX, + [gcc/g++ -B$$r/$(HOST_SUBDIR)/gcc/ -nostdinc++ `test ! -f $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags || $(SHELL) $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags --build-includes` -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs], + c++) +GCC_TARGET_TOOL(c++ for libstdc++, RAW_CXX_FOR_TARGET, CXX, + [gcc/xgcc -shared-libgcc -B$$r/$(HOST_SUBDIR)/gcc -nostdinc++ -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs], + c++) +GCC_TARGET_TOOL(dlltool, DLLTOOL_FOR_TARGET, DLLTOOL, [binutils/dlltool]) +GCC_TARGET_TOOL(gcc, GCC_FOR_TARGET, , [gcc/xgcc -B$$r/$(HOST_SUBDIR)/gcc/]) +GCC_TARGET_TOOL(gcj, GCJ_FOR_TARGET, GCJ, + [gcc/gcj -B$$r/$(HOST_SUBDIR)/gcc/], java) +GCC_TARGET_TOOL(gfortran, GFORTRAN_FOR_TARGET, GFORTRAN, + [gcc/gfortran -B$$r/$(HOST_SUBDIR)/gcc/], fortran) +GCC_TARGET_TOOL(ld, LD_FOR_TARGET, LD, [ld/ld-new]) +GCC_TARGET_TOOL(lipo, LIPO_FOR_TARGET, LIPO) +GCC_TARGET_TOOL(nm, NM_FOR_TARGET, NM, [binutils/nm-new]) +GCC_TARGET_TOOL(objdump, OBJDUMP_FOR_TARGET, OBJDUMP, [binutils/objdump]) +GCC_TARGET_TOOL(ranlib, RANLIB_FOR_TARGET, RANLIB, [binutils/ranlib]) +GCC_TARGET_TOOL(strip, STRIP_FOR_TARGET, STRIP, [binutils/strip]) +GCC_TARGET_TOOL(windres, WINDRES_FOR_TARGET, WINDRES, [binutils/windres]) -AC_SUBST(GCC_FOR_TARGET) AC_SUBST(FLAGS_FOR_TARGET) -AC_SUBST(CC_FOR_TARGET) -AC_SUBST(GCJ_FOR_TARGET) -AC_SUBST(CXX_FOR_TARGET) AC_SUBST(RAW_CXX_FOR_TARGET) -AC_SUBST(CXX_FOR_TARGET_FOR_RECURSIVE_MAKE) -AC_SUBST(RAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE) -# Fix up target tools. -if test "x${build}" = "x${host}" ; then - # In this case, the newly built tools can and should be used, - # so we override the results of the autoconf tests. - # This should really only happen when the tools are actually being built, - # but that's a further refinement. The new build scheme, where - # tools are built into a structure paralleling where they're installed, - # should also eliminate all of this cleanly. - AR_FOR_TARGET="\$(USUAL_AR_FOR_TARGET)" - AS_FOR_TARGET="\$(USUAL_AS_FOR_TARGET)" - DLLTOOL_FOR_TARGET="\$(USUAL_DLLTOOL_FOR_TARGET)" - LD_FOR_TARGET="\$(USUAL_LD_FOR_TARGET)" - NM_FOR_TARGET="\$(USUAL_NM_FOR_TARGET)" - RANLIB_FOR_TARGET="\$(USUAL_RANLIB_FOR_TARGET)" - WINDRES_FOR_TARGET="\$(USUAL_WINDRES_FOR_TARGET)" -fi # Certain tools may need extra flags. AR_FOR_TARGET=${AR_FOR_TARGET}${extra_arflags_for_target} RANLIB_FOR_TARGET=${RANLIB_FOR_TARGET}${extra_ranlibflags_for_target} NM_FOR_TARGET=${NM_FOR_TARGET}${extra_nmflags_for_target} +# When building target libraries, except in a Canadian cross, we use +# the same toolchain as the compiler we just built. +COMPILER_AS_FOR_TARGET='$(AS_FOR_TARGET)' +COMPILER_LD_FOR_TARGET='$(LD_FOR_TARGET)' +COMPILER_NM_FOR_TARGET='$(NM_FOR_TARGET)' +if test $host = $build; then + case " $configdirs " in + *" gcc "*) + COMPILER_AS_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/as' + COMPILER_LD_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/collect-ld' + COMPILER_NM_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/nm'${extra_nmflags_for_target} + ;; + esac +fi + +AC_SUBST(COMPILER_AS_FOR_TARGET) +AC_SUBST(COMPILER_LD_FOR_TARGET) +AC_SUBST(COMPILER_NM_FOR_TARGET) + AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) AC_ARG_ENABLE(maintainer-mode, [ --enable-maintainer-mode enable make rules and dependencies not useful @@ -2150,4 +2351,57 @@ fi MAINT=$MAINTAINER_MODE_TRUE AC_SUBST(MAINT)dnl +# --------------------- +# GCC bootstrap support +# --------------------- + +# Stage specific cflags for build. +stage1_cflags="-g" +case $build in + vax-*-*) + case ${GCC} in + yes) stage1_cflags="-g -Wa,-J" ;; + *) stage1_cflags="-g -J" ;; + esac ;; + powerpc-*-darwin*) + # The spiffy cpp-precomp chokes on some legitimate constructs in GCC + # sources; use -no-cpp-precomp to get to GNU cpp. + # Apple's GCC has bugs in designated initializer handling, so disable + # that too. + stage1_cflags="-g -no-cpp-precomp -DHAVE_DESIGNATED_INITIALIZERS=0" + ;; +esac +AC_SUBST(stage1_cflags) + +# Enable -Werror in bootstrap stage2 and later. +# Change the default to "no" on release branches. +AC_ARG_ENABLE(werror, +[ --enable-werror enable -Werror in bootstrap stage2 and later], [], +[enable_werror=yes]) +case ${enable_werror} in + yes) stage2_werror_flag="--enable-werror-always" ;; + *) stage2_werror_flag="" ;; +esac +AC_SUBST(stage2_werror_flag) + +# Flags needed to enable html installing and building +AC_ARG_WITH(datarootdir, +[ --with-datarootdir Use datarootdir as the data root directory.], +[datarootdir="\${prefix}/${withval}"], +[datarootdir="\${prefix}/share"]) + +AC_ARG_WITH(docdir, +[ --with-docdir Install documentation in this directory.], +[docdir="\${prefix}/${withval}"], +[docdir="\${datarootdir}/doc"]) + +AC_ARG_WITH(htmldir, +[ --with-htmldir Install html in this directory.], +[htmldir="\${prefix}/${withval}"], +[htmldir="\${docdir}"]) + +AC_SUBST(datarootdir) +AC_SUBST(docdir) +AC_SUBST(htmldir) + AC_OUTPUT(Makefile) diff --git a/contrib/binutils/contrib/ChangeLog b/contrib/binutils/contrib/ChangeLog deleted file mode 100644 index 4a0de852933..00000000000 --- a/contrib/binutils/contrib/ChangeLog +++ /dev/null @@ -1,7 +0,0 @@ -2002-07-03 Nick Clifton - - * ChangeLog: Newly created. - * texi2pod.pl: Imported from FSF GCC sources. - - - diff --git a/contrib/binutils/contrib/texi2pod.pl b/contrib/binutils/contrib/texi2pod.pl deleted file mode 100755 index e5560f303de..00000000000 --- a/contrib/binutils/contrib/texi2pod.pl +++ /dev/null @@ -1,431 +0,0 @@ -#! /usr/bin/perl -w - -# Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. - -# This file is part of GNU CC. - -# GNU CC is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# GNU CC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with GNU CC; see the file COPYING. If not, write to -# the Free Software Foundation, 59 Temple Place - Suite 330, -# Boston MA 02111-1307, USA. - -# This does trivial (and I mean _trivial_) conversion of Texinfo -# markup to Perl POD format. It's intended to be used to extract -# something suitable for a manpage from a Texinfo document. - -$output = 0; -$skipping = 0; -%sects = (); -$section = ""; -@icstack = (); -@endwstack = (); -@skstack = (); -@instack = (); -$shift = ""; -%defs = (); -$fnno = 1; -$inf = ""; -$ibase = ""; - -while ($_ = shift) { - if (/^-D(.*)$/) { - if ($1 ne "") { - $flag = $1; - } else { - $flag = shift; - } - $value = ""; - ($flag, $value) = ($flag =~ /^([^=]+)(?:=(.+))?/); - die "no flag specified for -D\n" - unless $flag ne ""; - die "flags may only contain letters, digits, hyphens, dashes and underscores\n" - unless $flag =~ /^[a-zA-Z0-9_-]+$/; - $defs{$flag} = $value; - } elsif (/^-/) { - usage(); - } else { - $in = $_, next unless defined $in; - $out = $_, next unless defined $out; - usage(); - } -} - -if (defined $in) { - $inf = gensym(); - open($inf, "<$in") or die "opening \"$in\": $!\n"; - $ibase = $1 if $in =~ m|^(.+)/[^/]+$|; -} else { - $inf = \*STDIN; -} - -if (defined $out) { - open(STDOUT, ">$out") or die "opening \"$out\": $!\n"; -} - -while(defined $inf) { -while(<$inf>) { - # Certain commands are discarded without further processing. - /^\@(?: - [a-z]+index # @*index: useful only in complete manual - |need # @need: useful only in printed manual - |(?:end\s+)?group # @group .. @end group: ditto - |page # @page: ditto - |node # @node: useful only in .info file - |(?:end\s+)?ifnottex # @ifnottex .. @end ifnottex: use contents - )\b/x and next; - - chomp; - - # Look for filename and title markers. - /^\@setfilename\s+([^.]+)/ and $fn = $1, next; - /^\@settitle\s+([^.]+)/ and $tl = postprocess($1), next; - - # Identify a man title but keep only the one we are interested in. - /^\@c\s+man\s+title\s+([A-Za-z0-9-]+)\s+(.+)/ and do { - if (exists $defs{$1}) { - $fn = $1; - $tl = postprocess($2); - } - next; - }; - - # Look for blocks surrounded by @c man begin SECTION ... @c man end. - # This really oughta be @ifman ... @end ifman and the like, but such - # would require rev'ing all other Texinfo translators. - /^\@c\s+man\s+begin\s+([A-Z]+)\s+([A-Za-z0-9-]+)/ and do { - $output = 1 if exists $defs{$2}; - $sect = $1; - next; - }; - /^\@c\s+man\s+begin\s+([A-Z]+)/ and $sect = $1, $output = 1, next; - /^\@c\s+man\s+end/ and do { - $sects{$sect} = "" unless exists $sects{$sect}; - $sects{$sect} .= postprocess($section); - $section = ""; - $output = 0; - next; - }; - - # handle variables - /^\@set\s+([a-zA-Z0-9_-]+)\s*(.*)$/ and do { - $defs{$1} = $2; - next; - }; - /^\@clear\s+([a-zA-Z0-9_-]+)/ and do { - delete $defs{$1}; - next; - }; - - next unless $output; - - # Discard comments. (Can't do it above, because then we'd never see - # @c man lines.) - /^\@c\b/ and next; - - # End-block handler goes up here because it needs to operate even - # if we are skipping. - /^\@end\s+([a-z]+)/ and do { - # Ignore @end foo, where foo is not an operation which may - # cause us to skip, if we are presently skipping. - my $ended = $1; - next if $skipping && $ended !~ /^(?:ifset|ifclear|ignore|menu|iftex)$/; - - die "\@end $ended without \@$ended at line $.\n" unless defined $endw; - die "\@$endw ended by \@end $ended at line $.\n" unless $ended eq $endw; - - $endw = pop @endwstack; - - if ($ended =~ /^(?:ifset|ifclear|ignore|menu|iftex)$/) { - $skipping = pop @skstack; - next; - } elsif ($ended =~ /^(?:example|smallexample|display)$/) { - $shift = ""; - $_ = ""; # need a paragraph break - } elsif ($ended =~ /^(?:itemize|enumerate|[fv]?table)$/) { - $_ = "\n=back\n"; - $ic = pop @icstack; - } else { - die "unknown command \@end $ended at line $.\n"; - } - }; - - # We must handle commands which can cause skipping even while we - # are skipping, otherwise we will not process nested conditionals - # correctly. - /^\@ifset\s+([a-zA-Z0-9_-]+)/ and do { - push @endwstack, $endw; - push @skstack, $skipping; - $endw = "ifset"; - $skipping = 1 unless exists $defs{$1}; - next; - }; - - /^\@ifclear\s+([a-zA-Z0-9_-]+)/ and do { - push @endwstack, $endw; - push @skstack, $skipping; - $endw = "ifclear"; - $skipping = 1 if exists $defs{$1}; - next; - }; - - /^\@(ignore|menu|iftex)\b/ and do { - push @endwstack, $endw; - push @skstack, $skipping; - $endw = $1; - $skipping = 1; - next; - }; - - next if $skipping; - - # Character entities. First the ones that can be replaced by raw text - # or discarded outright: - s/\@copyright\{\}/(c)/g; - s/\@dots\{\}/.../g; - s/\@enddots\{\}/..../g; - s/\@([.!? ])/$1/g; - s/\@[:-]//g; - s/\@bullet(?:\{\})?/*/g; - s/\@TeX\{\}/TeX/g; - s/\@pounds\{\}/\#/g; - s/\@minus(?:\{\})?/-/g; - s/\\,/,/g; - - # Now the ones that have to be replaced by special escapes - # (which will be turned back into text by unmunge()) - s/&/&/g; - s/\@\{/{/g; - s/\@\}/}/g; - s/\@\@/&at;/g; - - # Inside a verbatim block, handle @var specially. - if ($shift ne "") { - s/\@var\{([^\}]*)\}/<$1>/g; - } - - # POD doesn't interpret E<> inside a verbatim block. - if ($shift eq "") { - s//>/g; - } else { - s//>/g; - } - - # Single line command handlers. - - /^\@include\s+(.+)$/ and do { - push @instack, $inf; - $inf = gensym(); - - # Try cwd and $ibase. - open($inf, "<" . $1) - or open($inf, "<" . $ibase . "/" . $1) - or die "cannot open $1 or $ibase/$1: $!\n"; - next; - }; - - /^\@(?:section|unnumbered|unnumberedsec|center)\s+(.+)$/ - and $_ = "\n=head2 $1\n"; - /^\@subsection\s+(.+)$/ - and $_ = "\n=head3 $1\n"; - - # Block command handlers: - /^\@itemize\s+(\@[a-z]+|\*|-)/ and do { - push @endwstack, $endw; - push @icstack, $ic; - $ic = $1; - $_ = "\n=over 4\n"; - $endw = "itemize"; - }; - - /^\@enumerate(?:\s+([a-zA-Z0-9]+))?/ and do { - push @endwstack, $endw; - push @icstack, $ic; - if (defined $1) { - $ic = $1 . "."; - } else { - $ic = "1."; - } - $_ = "\n=over 4\n"; - $endw = "enumerate"; - }; - - /^\@([fv]?table)\s+(\@[a-z]+)/ and do { - push @endwstack, $endw; - push @icstack, $ic; - $endw = $1; - $ic = $2; - $ic =~ s/\@(?:samp|strong|key|gcctabopt|env)/B/; - $ic =~ s/\@(?:code|kbd)/C/; - $ic =~ s/\@(?:dfn|var|emph|cite|i)/I/; - $ic =~ s/\@(?:file)/F/; - $_ = "\n=over 4\n"; - }; - - /^\@((?:small)?example|display)/ and do { - push @endwstack, $endw; - $endw = $1; - $shift = "\t"; - $_ = ""; # need a paragraph break - }; - - /^\@itemx?\s*(.+)?$/ and do { - if (defined $1) { - # Entity escapes prevent munging by the <> processing below. - $_ = "\n=item $ic\<$1\>\n"; - } else { - $_ = "\n=item $ic\n"; - $ic =~ y/A-Ya-y/B-Zb-z/; - $ic =~ s/(\d+)/$1 + 1/eg; - } - }; - - $section .= $shift.$_."\n"; -} -# End of current file. -close($inf); -$inf = pop @instack; -} - -die "No filename or title\n" unless defined $fn && defined $tl; - -$sects{NAME} = "$fn \- $tl\n"; -$sects{FOOTNOTES} .= "=back\n" if exists $sects{FOOTNOTES}; - -for $sect (qw(NAME SYNOPSIS DESCRIPTION OPTIONS ENVIRONMENT FILES - BUGS NOTES FOOTNOTES SEEALSO AUTHOR COPYRIGHT)) { - if(exists $sects{$sect}) { - $head = $sect; - $head =~ s/SEEALSO/SEE ALSO/; - print "=head1 $head\n\n"; - print scalar unmunge ($sects{$sect}); - print "\n"; - } -} - -sub usage -{ - die "usage: $0 [-D toggle...] [infile [outfile]]\n"; -} - -sub postprocess -{ - local $_ = $_[0]; - - # @value{foo} is replaced by whatever 'foo' is defined as. - while (m/(\@value\{([a-zA-Z0-9_-]+)\})/g) { - if (! exists $defs{$2}) { - print STDERR "Option $2 not defined\n"; - s/\Q$1\E//; - } else { - $value = $defs{$2}; - s/\Q$1\E/$value/; - } - } - - # Formatting commands. - # Temporary escape for @r. - s/\@r\{([^\}]*)\}/R<$1>/g; - s/\@(?:dfn|var|emph|cite|i)\{([^\}]*)\}/I<$1>/g; - s/\@(?:code|kbd)\{([^\}]*)\}/C<$1>/g; - s/\@(?:gccoptlist|samp|strong|key|option|env|command|b)\{([^\}]*)\}/B<$1>/g; - s/\@sc\{([^\}]*)\}/\U$1/g; - s/\@file\{([^\}]*)\}/F<$1>/g; - s/\@w\{([^\}]*)\}/S<$1>/g; - s/\@(?:dmn|math)\{([^\}]*)\}/$1/g; - - # Cross references are thrown away, as are @noindent and @refill. - # (@noindent is impossible in .pod, and @refill is unnecessary.) - # @* is also impossible in .pod; we discard it and any newline that - # follows it. Similarly, our macro @gol must be discarded. - - s/\(?\@xref\{(?:[^\}]*)\}(?:[^.<]|(?:<[^<>]*>))*\.\)?//g; - s/\s+\(\@pxref\{(?:[^\}]*)\}\)//g; - s/;\s+\@pxref\{(?:[^\}]*)\}//g; - s/\@noindent\s*//g; - s/\@refill//g; - s/\@gol//g; - s/\@\*\s*\n?//g; - - # @uref can take one, two, or three arguments, with different - # semantics each time. @url and @email are just like @uref with - # one argument, for our purposes. - s/\@(?:uref|url|email)\{([^\},]*)\}/<B<$1>>/g; - s/\@uref\{([^\},]*),([^\},]*)\}/$2 (C<$1>)/g; - s/\@uref\{([^\},]*),([^\},]*),([^\},]*)\}/$3/g; - - # Un-escape <> at this point. - s/<//g; - - # Now un-nest all B<>, I<>, R<>. Theoretically we could have - # indefinitely deep nesting; in practice, one level suffices. - 1 while s/([BIR])<([^<>]*)([BIR])<([^<>]*)>/$1<$2>$3<$4>$1 with bare ...; eliminate empty markup, B<>; - # shift white space at the ends of [BI]<...> expressions outside - # the expression. - s/R<([^<>]*)>/$1/g; - s/[BI]<>//g; - s/([BI])<(\s+)([^>]+)>/$2$1<$3>/g; - s/([BI])<([^>]+?)(\s+)>/$1<$2>$3/g; - - # Extract footnotes. This has to be done after all other - # processing because otherwise the regexp will choke on formatting - # inside @footnote. - while (/\@footnote/g) { - s/\@footnote\{([^\}]+)\}/[$fnno]/; - add_footnote($1, $fnno); - $fnno++; - } - - return $_; -} - -sub unmunge -{ - # Replace escaped symbols with their equivalents. - local $_ = $_[0]; - - s/</E/g; - s/>/E/g; - s/{/\{/g; - s/}/\}/g; - s/&at;/\@/g; - s/&/&/g; - return $_; -} - -sub add_footnote -{ - unless (exists $sects{FOOTNOTES}) { - $sects{FOOTNOTES} = "\n=over 4\n\n"; - } - - $sects{FOOTNOTES} .= "=item $fnno.\n\n"; $fnno++; - $sects{FOOTNOTES} .= $_[0]; - $sects{FOOTNOTES} .= "\n\n"; -} - -# stolen from Symbol.pm -{ - my $genseq = 0; - sub gensym - { - my $name = "GEN" . $genseq++; - my $ref = \*{$name}; - delete $::{$name}; - return $ref; - } -} diff --git a/contrib/binutils/etc/ChangeLog b/contrib/binutils/etc/ChangeLog index 6865f2df185..a5959c70a70 100644 --- a/contrib/binutils/etc/ChangeLog +++ b/contrib/binutils/etc/ChangeLog @@ -1,3 +1,39 @@ +2006-05-31 Daniel Jacobowitz + + * texi2pod.pl: Correct handling of absolute @include. + +2006-05-02 Daniel Jacobowitz + + * texi2pod.pl: Handle -I. + +2006-04-06 Carlos O'Donell + + * Makefile.in: Add install-html target. Add htmldir, + docdir and datarootdir. + * configure.texi: Document install-html target. + * configure.in: AC_SUBST datarootdir, docdir, htmldir. + * configure: Regenerate. + +2006-02-27 Carlos O'Donell + + * Makefile.in: TEXI2HTML uses makeinfo. Define + HTMLFILES. Add html targets. + * configure.texi: Use ifnottex. Add alternative + image format specifier as jpg. + * standards.texi: Use ifnottex. + +2005-10-21 Mark Mitchell + + * texi2pod.pl: Substitue for @value even when part of @include. + +2005-10-21 Bob Wilson + + * texi2pod.pl: Import latest version from GCC. + +2005-05-19 Zack Weinberg + + * Makefile.in: Have 'all' depend on 'info'. + 2003-05-16 Kelley Cook * configure.texi: Use "i[3-7]86" in example. @@ -63,7 +99,7 @@ 1998-12-03 Nick Clifton * targetdoc/fr30.texi: New document. - + 1998-10-01 Angela Marie Thomas (angela@cygnus.com) * comp-tools-fix, cross-tools-fix: Replace /usr/include @@ -128,7 +164,7 @@ Mon May 18 14:27:37 1998 Angela Marie Thomas (angela@cygnus.com) Thu May 14 14:43:10 1998 Nick Clifton * targetdoc/arm-interwork.texi: Document dlltool support of - interworking. + interworking. Thu May 7 16:49:38 1998 Jason Molenda (crash@bugshack.cygnus.com) @@ -137,7 +173,7 @@ Thu May 7 16:49:38 1998 Jason Molenda (crash@bugshack.cygnus.com) Wed Apr 1 17:11:44 1998 Nick Clifton - * targetdoc/arm-interwork.texi: Document ARM/thumb interworking. + * targetdoc/arm-interwork.texi: Document ARM/thumb interworking. Tue Mar 31 15:28:20 1998 Ian Lance Taylor @@ -147,7 +183,7 @@ Tue Mar 31 15:28:20 1998 Ian Lance Taylor Tue Mar 24 16:13:26 1998 Stu Grossman * configure: Regenerate with autoconf 2.12.1 to fix shell issues - for NT native builds. + for NT native builds. Mon Mar 9 16:41:04 1998 Doug Evans @@ -183,7 +219,7 @@ Tue Jun 17 15:50:23 1997 Angela Marie Thomas (angela@cygnus.com) Thu Jun 12 13:47:00 1997 Angela Marie Thomas (angela@cygnus.com) - * Install.in (show_exec_prefix_msg): fix quoting + * Install.in (show_exec_prefix_msg): fix quoting Wed Jun 4 15:31:43 1997 Jason Molenda (crash@godzilla.cygnus.co.jp) @@ -231,8 +267,8 @@ Thu Apr 10 23:23:33 1997 Jason Molenda (crash@godzilla.cygnus.co.jp) Mon Apr 7 18:15:00 1997 Brendan Kehoe - * Fix the version string for OSF1 4.0 to recognize either - V4.* or X4.* + * Fix the version string for OSF1 4.0 to recognize either + V4.* or X4.* Mon Apr 7 15:34:47 1997 Ian Lance Taylor @@ -303,8 +339,8 @@ Mon Aug 28 17:25:49 1995 Jason Molenda (crash@phydeaux.cygnus.com) 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. + * 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) @@ -319,8 +355,8 @@ Tue Aug 8 13:11:56 1995 Brendan Kehoe Thu Jun 8 00:42:56 1995 Angela Marie Thomas - * subst-strings: change du commands to $BINDIR/. & $SRCDIR/. just - in case they are symlinks. + * subst-strings: change du commands to $BINDIR/. & $SRCDIR/. just + in case they are symlinks. Tue Apr 18 14:23:10 1995 J.T. Conklin @@ -335,7 +371,7 @@ Tue Apr 18 14:23:10 1995 J.T. Conklin * 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 + Changed so that tape commands are not run when extracting from a file. (do_mt): Changed to take only one argument. @@ -343,7 +379,7 @@ 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 * subst-strings (mips-sgi-irix5): New entry in table. @@ -388,8 +424,8 @@ Thu Apr 28 14:42:22 1994 David J. Mackenzie (djm@rtl.cygnus.com) 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 + * 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. :) @@ -449,21 +485,21 @@ Wed Mar 23 23:38:24 1994 Jason Molenda (crash@sendai.cygnus.com) 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: 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''. + * 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. + + * 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. + * 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) @@ -494,9 +530,9 @@ Thu Jun 10 16:01:25 1993 Jeffrey Osier (jeffrey@cygnus.com) 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) + * 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) @@ -511,7 +547,7 @@ Fri Jun 4 17:09:56 1993 Jeffrey Osier (jeffrey@cygnus.com) 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 + * 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) diff --git a/contrib/binutils/etc/Makefile.in b/contrib/binutils/etc/Makefile.in index 63f7738c64a..7d0607d960c 100644 --- a/contrib/binutils/etc/Makefile.in +++ b/contrib/binutils/etc/Makefile.in @@ -25,7 +25,10 @@ man6dir = $(mandir)/man6 man7dir = $(mandir)/man7 man8dir = $(mandir)/man8 man9dir = $(mandir)/man9 +datarootdir = @datarootdir@ +docdir = @docdir@ infodir = @infodir@ +htmldir = @htmldir@ SHELL = /bin/sh @@ -39,7 +42,10 @@ MAKEINFO = `if [ -f ../texinfo/makeinfo/makeinfo ]; \ TEXI2DVI = `if [ -f ../texinfo/util/texi2dvi ]; \ then echo ../texinfo/util/texi2dvi; \ else echo texi2dvi; fi` -TEXI2HTML = texi2html +TEXI2HTML = `if [ -f ../texinfo/makeinfo/makeinfo ]; \ + then echo "../texinfo/makeinfo/makeinfo --html"; \ + else echo "makeinfo --html"; fi` + DVIPS = dvips # Where to find texinfo.tex to format documentation with TeX. @@ -50,10 +56,9 @@ TEXIDIR = $(srcdir)/../texinfo INFOFILES = standards.info configure.info DVIFILES = standards.dvi configure.dvi +HTMLFILES = standards.html configure.html -all: - -# We want install to imply install-info as per GNU standards. +all: info install: install-info uninstall: @@ -84,6 +89,32 @@ install-info: info done; \ fi +html: + for f in $(HTMLFILES); do \ + if test -f $(srcdir)/`echo $$f | sed -e 's/.html$$/.texi/'`; then \ + if $(MAKE) "TEXI2HTML=$(TEXI2HTML)" $$f; then \ + true; \ + else \ + exit 1; \ + fi; \ + fi; \ + done + +install-html: html + $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(htmldir) + if test ! -f standards.html; then cd $(srcdir); fi; \ + if test -f standards.html; then \ + for i in standards.html*; do \ + $(INSTALL_DATA) $$i $(DESTDIR)$(htmldir)/$$i; \ + done; \ + fi + if test ! -f configure.html; then cd $(srcdir); fi; \ + if test -f configure.html; then \ + for i in configure.html*; do \ + $(INSTALL_DATA) $$i $(DESTDIR)$(htmldir)/$$i; \ + done; \ + fi + dvi: for f in $(DVIFILES); do \ if test -f $(srcdir)/`echo $$f | sed -e 's/.dvi$$/.texi/'`; then \ @@ -98,6 +129,9 @@ dvi: standards.info: $(srcdir)/standards.texi $(srcdir)/make-stds.texi $(MAKEINFO) --no-split -I$(srcdir) -o standards.info $(srcdir)/standards.texi +standards.html: $(srcdir)/standards.texi $(srcdir)/make-stds.texi + $(TEXI2HTML) --no-split -I$(srcdir) -o standards.html $(srcdir)/standards.texi + standards.dvi: $(srcdir)/standards.texi TEXINPUTS=$(TEXIDIR):$$TEXINPUTS $(TEXI2DVI) $(srcdir)/standards.texi @@ -133,12 +167,15 @@ configure.ps: configure.dvi $(srcdir)/configdev.ein $(srcdir)/configbuild.ein rm -f configdev.eps configbuild.eps configure.html: $(srcdir)/configure.texi - $(TEXI2HTML) -split_chapter $(srcdir)/configure.texi + cp $(srcdir)/configdev.jin configdev.jpg + cp $(srcdir)/configbuild.jin configbuild.jpg + $(TEXI2HTML) --no-split -I$(srcdir) -o configure.html $(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.txt configbuild.txt + rm -f configdev.eps configbuild.eps rm -f configdev.jpg configbuild.jpg mostlyclean: clean @@ -147,6 +184,7 @@ distclean: clean rm -f Makefile config.status config.cache maintainer-clean realclean: distclean + rm -f *.html* rm -f *.info* Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag) diff --git a/contrib/binutils/gas/ChangeLog b/contrib/binutils/gas/ChangeLog index 209d3bb9561..1723944a36e 100644 --- a/contrib/binutils/gas/ChangeLog +++ b/contrib/binutils/gas/ChangeLog @@ -1,622 +1,758 @@ -2005-06-08 Kazuhiro Inaoka +2006-07-19 Mat Hostetter - * config/tc-m32r.c (use_parallel): Change default value from 1 to 0. + * symbols.c (report_op_error): Fix pasto. Don't use as_bad_where + when file and line unknown. -2004-08-18 Thiemo Seufer +2006-06-07 Joseph S. Myers - * config/tc-mips.c (append_insn): Handle delay slots in branch likely - correctly. + * po/Make-in (pdf, ps): New dummy targets. -2004-07-28 Jason Thorpe +2006-06-02 Joseph S. Myers - * config/tc-hppa.h (TARGET_FORMAT): Set to "elf32-hppa-netbsd" - for TE_NetBSD. + * doc/Makefile.am (TEXI2DVI): Define. + * doc/Makefile.in: Regenerate. + * doc/c-arc.texi: Fix typo. -2004-05-23 Alan Modra +2006-05-30 Nick Clifton - * expr.c (operand, operator): Don't reject '++' and '--'. + * po/es.po: Updated Spanish translation. -2004-05-13 Joel Sherrill +2006-05-25 Nathan Sidwell - * configure.in (or32-*-rtems*): Switch to elf. + * gas/config/tc-m68k.c (m68k_init_arch): Move checking of + cfloat/m68881 to correct architecture before using it. + +2006-05-16 Nick Clifton + + * Import these patches from the mainline: + + 2006-05-16 Bjoern Haase + + * config/tc-avr.h (TC_VALIDATE_FIX): Allow fixups for immediate + constant values. + + 2006-05-05 Bjoern Haase + + * gas/config/tc-avr.h (TC_VALIDATE_FIX): Define. Disable fixups + for PMEM related expressions. + +2006-05-11 Thiemo Seufer + + * config/tc-mips.c (append_insn): Don't check the range of j or + jal addresses. + +2006-05-10 Alan Modra + + * dwarf2dbg.c (get_line_subseg): Attach new struct line_seg to end + of list rather than beginning. + +2006-05-10 Alan Modra + + * write.c (relax_segment): Add pass count arg. Don't error on + negative org/space on first two passes. + (relax_seg_info): New struct. + (relax_seg, write_object_file): Adjust. + * write.h (relax_segment): Update prototype. + +2006-05-02 Joseph Myers + + * config/tc-arm.c (do_iwmmxt_wldstbh): Don't multiply offset by 4 + here. + (md_apply_fix3): Multiply offset by 4 here for + BFD_RELOC_ARM_CP_OFF_IMM_S2 and BFD_RELOC_ARM_T32_CP_OFF_IMM_S2. + +2006-05-02 Daniel Jacobowitz + + * doc/Makefile.am (AM_MAKEINFOFLAGS): New. + (TEXI2POD): Use AM_MAKEINFOFLAGS. + (asconfig.texi): Don't set top_srcdir. + * doc/as.texinfo: Don't use top_srcdir. + * aclocal.m4, Makefile.in, doc/Makefile.in: Regenerated. + +2006-05-02 Paul Brook + + * config/tc-arm.c (arm_optimize_expr): New function. + * config/tc-arm.h (md_optimize_expr): Define + (arm_optimize_expr): Add prototype. + (TC_FORCE_RELOCATION_SUB_SAME): Define. + +2006-05-01 James Lemke + + * subsegs.c (subseg_set_rest): Always set seginfp->frchainP if NULL. + +2006-04-25 Bob Wilson + + * config/xtensa-relax.c (widen_spec_list): Use new "WIDE." + syntax instead of hardcoded opcodes with ".w18" suffixes. + (wide_branch_opcode): New. + (build_transition): Use it to check for wide branch opcodes with + either ".w18" or ".w15" suffixes. + +2006-04-25 Bob Wilson + + * config/tc-xtensa.c (xtensa_create_literal_symbol, + xg_assemble_literal, xg_assemble_literal_space): Do not set the + frag's is_literal flag. + +2006-04-25 Bob Wilson + + * config/xtensa-relax.c (XCHAL_HAVE_WIDE_BRANCHES): Provide default. + +2006-04-16 Daniel Jacobowitz + + * po/POTFILES.in: Regenerated. + +2006-04-14 Sterling Augustine + + * config/tc-xtensa.c (emit_single_op): Do not relax MOVI + instructions when such transformations have been disabled. + +2006-04-10 Sterling Augustine + + * config/tc-xtensa.c (xg_assemble_vliw_tokens): Record loop target + symbols in RELAX[_CHECK]_ALIGN_NEXT_OPCODE frags. + (xtensa_fix_close_loop_end_frags): Use the recorded values instead of + decoding the loop instructions. Remove current_offset variable. + (xtensa_fix_short_loop_frags): Likewise. + (min_bytes_to_other_loop_end): Remove current_offset argument. + +2006-04-09 Arnold Metselaar + + * config/tc-z80.c (z80_optimize_expr): Removed; redundant since 2006-04-04. + * config/tc-z80.h (z80_optimize_expr, md_optimize_expr): Removed. + +2006-04-07 Joerg Wunsch + + * gas/config/tc-avr.c (mcu_types): Add support for attiny261, + attiny461, attiny861, attiny25, attiny45, attiny85,attiny24, + attiny44, attiny84, at90pwm2, at90pwm3, atmega164, atmega324, + atmega644, atmega329, atmega3290, atmega649, atmega6490, + atmega406, atmega640, atmega1280, atmega1281, at90can32, + at90can64, at90usb646, at90usb647, at90usb1286 and + at90usb1287. + Move atmega48 and atmega88 from AVR_ISA_M8 to AVR_ISA_PWMx. + +2006-04-07 Paul Brook + + * config/tc-arm.c (parse_operands): Set default error message. + +2006-04-07 Paul Brook + + * config/tc-arm.c (parse_tb): Set inst.error before returning FAIL. + +2006-04-07 Paul Brook + + * config/tc-arm.c (md_apply_fix): Set H bit on blx instruction. + +2006-04-07 Paul Brook + + * config/tc-arm.c (THUMB2_LOAD_BIT): Define. + (move_or_literal_pool): Handle Thumb-2 instructions. + (do_t_ldst): Call move_or_literal_pool for =N addressing modes. + +2006-04-07 Alan Modra + + PR 2512. + * config/tc-i386.c (match_template): Move 64-bit operand tests + inside loop. + +2006-04-06 Carlos O'Donell + + * po/Make-in: Add install-html target. + * Makefile.am: Add install-html and install-html-recursive targets. + * Makefile.in: Regenerate. + * configure.in: AC_SUBST datarootdir, docdir, htmldir. + * configure: Regenerate. + * doc/Makefile.am: Add install-html and install-html-am targets. + * doc/Makefile.in: Regenerate. + +2006-04-06 Alan Modra + + * frags.c (frag_offset_fixed_p): Reinitialise offset before + second scan. + +2006-04-05 Richard Sandiford + Daniel Jacobowitz + + * config/tc-sparc.c (sparc_target_format): Handle TE_VXWORKS. + (GOTT_BASE, GOTT_INDEX): New. + (tc_gen_reloc): Don't alter relocations against GOTT_BASE and + GOTT_INDEX when generating VxWorks PIC. + * configure.tgt (sparc*-*-vxworks*): Remove this special case; + use the generic *-*-vxworks* stanza instead. + +2006-04-04 Alan Modra + + PR 997 + * frags.c (frag_offset_fixed_p): New function. + * frags.h (frag_offset_fixed_p): Declare. + * expr.c (expr): Use frag_offset_fixed_p when simplifying subtraction. + (resolve_expression): Likewise. + +2006-04-03 Sterling Augustine + + * config/tc-xtensa.c (init_op_placement_info_table): Check for formats + of the same length but different numbers of slots. + +2006-03-30 Andreas Schwab + + * configure.in: Fix help string for --enable-targets option. * configure: Regenerate. -2004-05-13 Nick Clifton +2006-03-28 Nathan Sidwell - * po/fr.po: Updated French translation. + * gas/config/tc-m68k.c (find_cf_chip): Merge into ... + (m68k_ip): ... here. Use for all chips. Protect against buffer + overrun and avoid excessive copying. -2004-05-07 Daniel Jacobowitz + * config/tc-m68k.c (m68000_control_regs, m68010_control_regs, + m68020_control_regs, m68040_control_regs, m68060_control_regs, + mcf_control_regs, mcf5208_control_regs, mcf5213_control_regs, + mcf5329_control_regs, mcf5249_control_regs, mcf528x_control_regs, + mcfv4e_control_regs, m68010_control_regs): Rename and reorder to ... + (m68000_ctrl, m68010_ctrl, m68020_ctrl, m68040_ctrl, m68060_ctrl, + mcf_ctrl, mcf5208_ctrl, mcf5213_ctrl, mcf5235_ctrl, mcf5249_ctrl, + mcf5216_ctrl, mcf5250_ctrl, mcf5271_ctrl, mcf5272_ctrl, + mcf5282_ctrl, mcfv4e_ctrl): ... these. + (mcf5275_ctrl, mcf5329_ctrl, mcf5373_ctrl): New. + (struct m68k_cpu): Change chip field to control_regs. + (current_chip): Remove. + (control_regs): New. + (m68k_archs, m68k_extensions): Adjust. + (m68k_cpus): Reorder to be in cpu number order. Adjust. + (CPU_ALLOW_MC, CPU_ALLOW_NEGATION): Remove. + (find_cf_chip): Reimplement for new organization of cpu table. + (select_control_regs): Remove. + (mri_chip): Adjust. + (struct save_opts): Save control regs, not chip. + (s_save, s_restore): Adjust. + (m68k_lookup_cpu): Give deprecated warning when necessary. + (m68k_init_arch): Adjust. + (md_show_usage): Adjust for new cpu table organization. - * Makefile.am (DIST_SUBDIRS): Define. - * aclocal.m4: Regenerate with automake 1.8.4. - * Makefile.in: Likewise. - * doc/Makefile.in: Likewise. +2006-03-25 Bernd Schmidt -2004-05-07 Daniel Jacobowitz - - Merge from mainline: - 2004-05-05 Jakub Jelinek - * tc-s390.h (md_do_align, HANDLE_ALIGN): Remove. - (NOP_OPCODE): Define. - (s390_align_code): Remove prototype. - * tc-s390.c (s390_align_code): Remove. - - 2004-04-22 Bruno De Bus - * config/tc-arm.h (enum mstate): Move here, add MAP_UNDEFINED - state. - (TC_SEGMENT_INFO_TYPE): Define to enum mstate. - * config/tc-arm.c (enum mstate): Delete from here. - (mapping_state): Remove the static mapstate variable and instead - store the state in the segment. This allows a per-section mapping - state. Handle and ignore MAP_UNDEFINED states. - (arm_elf_change_section): Get the current mapping state from the - new section. - (s_ltorg): Set the mapping state to MAP_DATA. - (arm_cleanup): Use arm_elf_change_section to get the mapping state - for each pool as it is emitted. - - 2004-04-22 Nick Clifton - * config/tc-arm.h: Formatting tidy ups. - -2004-05-07 Alexandre Oliva - - * config/tc-frv.h (MAX_MEM_FOR_RS_ALIGN_CODE): New. - (HANDLE_ALIGN): New. - -2004-05-05 Alexandre Oliva - - * configure.in: Set em=linux for frv-*-*linux*. - * configure: Rebuilt. - * config/tc-frv.h (TARGET_FORMAT): Use elf32-frvfdpic if... - (frv_md_fdpic_enabled): New. - * config/tc-frv.c (frv_md_fdpic_enabled): New. - (DEFAULT_FDPIC): New. - (frv_flags): Use DEFAULT_FDPIC. - (frv_pic_flag): Likewise. - (OPTION_NOPIC): New. - (md_longopts): Add -mnopic. + * config/bfin-defs.h (Expr_Node_Type enum): Add Expr_Node_GOT_Reloc. + * config/bfin-lex.l: Recognize GOT17M4 and FUNCDESC_GOT17M4. + * config/bfin-parse.y: Include "libbfd.h", "elf/common.h" and + "elf/bfin.h". + (GOT17M4, FUNCDESC_GOT17M4): New tokens of type . + (any_gotrel): New rule. + (got): Use it, and create Expr_Node_GOT_Reloc nodes. + * config/tc-bfin.c: Include "libbfd.h", "elf/common.h" and + "elf/bfin.h". + (DEFAULT_FLAGS, bfin_flags, bfin_pic_flag): New. + (bfin_pic_ptr): New function. + (md_pseudo_table): Add it for ".picptr". + (OPTION_FDPIC): New macro. + (md_longopts): Add -mfdpic. (md_parse_option): Handle it. - (md_show_usage): Add -mfdpic and -mnopic. - -2004-04-20 Chris Demetriou - - * NEWS: Note that MIPS -membedded-pic option is deprecated. - -2004-04-19 Eric Christopher - - * config/tc-mips.c (mips_dwarf2_addr_size): Revert part - of previous patch for fix in gcc. - -2004-04-16 Alan Modra - - * expr.c (operand): Correct checks for ++ and --. - -2004-04-14 Richard Sandiford - - * doc/c-mips.texi (-m{no-,}fix-vr4120): Renamed from - -{no-}mfix-vr4122-bugs. - * config/tc-mips.c (mips_fix_vr4120): Renamed from mips_fix_4122_bugs. - (append_insn, mips_emit_delays): Update accordingly. - (OPTION_FIX_VR4120, OPTION_NO_FIX_VR4120): Renamed from *VR4122. - (md_longopts): Change -{no-,}mfix-vr4122-bugs to -m{no-,}fix-vr4120. - (md_parse_option): Update after above changes. - (md_show_usage): Add -mfix-vr4120. - -2004-04-11 Thiemo Seufer - - * Makefile.am: Remove mips from aout targets. - * Makefile.in: Regenerate. - * configure.in: Remove mips-dec-bsd* target. - * configure: Regenerate. - -2004-04-09 Daniel Jacobowitz - - Merge from mainline: - 2004-04-07 Alan Modra - PR 96 - * config/tc-ppc.c (ppc_elf_suffix): Add valid32 and valid64 fields - to struct map_bfd. Adjust MAP macro, and define MAP32, MAP64. - Update "mapping". Restrict some @ modifiers to 32 bit. - - 2004-04-01 Asgari Jinia - Dhananjay Deshpande - - * config/tc-sh.c (dont_adjust_reloc_32): New variable. - (sh_fix_adjustable): Avoid adjusting BFD_RELOC_32 when - dont_adjust_reloc_32 is set. - (md_longopts): Add option -renesas. - (md_parse_option, md_show_usage): Likewise. - * doc/c-sh.texi: Likewise. - - 2004-04-01 Dave Korn - * config/tc-dlx.c (md_assemble): set fx_no_overflow flag for - hi16 and lo16 fixS structs. - (md_assemble): generate bit_fixS for RELOC_DLX_LO16 in - exactly the same way as for RELOC_DLX_REL16. - (machine_ip): properly respect LO flag in the_insn and - output RELOC_DLX_LO16 rather than RELOC_DLX_16. - (md_apply_fix3): apply RELOC_DLX_LO16. - - 2004-03-19 John David Anglin - * tc-hppa.c (cons_fix_new_hppa): Check for PC relative base type. - (pa_comm): Set BSF_OBJECT in symbol flags. - - 2004-03-18 Nathan Sidwell - * read.c (read_a_source_file): Use demand_empty_rest_of_line. - (demand_empty_rest_of_line): Issue an error here. - (ignore_rest_of_line): Silently skip to end. - (demand_copy_string): Issue an error, not warning. - (equals): Likewise. - * config/obj-elf.c (obj_elf_section_name): Likewise. - (obj_elf_section): Likewise. - * config/tc-arc.c (arc_extoper): Remove bogus NULL checks. - (arc_extinst): Likewise. - * config/tc-ia64.c (dot_saveb): Use demand_empty_rest_of_line. - (dot_spill): Likewise. - (dot_unwabi): Likewise. - (dot_prologue): Likewise. - - 2004-03-18 Nathan Sidwell - * expr.c (operand): Reject ++ and --. - (operator): Likewise. - - 2004-03-12 Bob Wilson - * read.c (s_leb128): Call md_flush_pending_output. - - 2004-03-07 Andreas Schwab - * doc/c-hppa.texi (HPPA Directives): Fix typo. - - 2004-03-07 Richard Henderson - * dw2gencfi.c (output_cie): Align length to 4 byte boundary. - (cfi_finish): Likewise for fde. - - 2004-03-05 H.J. Lu - * config/tc-ia64.c (md_assemble): Properly handle NULL - align_frag. - (ia64_handle_align): Don't abort if failed to add a stop bit. - - 2004-03-04 H.J. Lu - * Makefile.in: Regenerated. - * aclocal.m4: Likewise. - * configure: Likewise. - * doc/Makefile.in: Likewise. - - 2004-03-03 H.J. Lu - * config/tc-ia64.c (dot_align): New. - (ia64_do_align): Make it static. - (md_pseudo_table): Use "dot_align" for "align". - (ia64_md_do_align): Don't set align_frag here. - (ia64_handle_align): Add a stop bit to the previous bundle if - needed. - - * config/tc-ia64.h (ia64_do_align): Removed. - - 2004-03-02 H.J. Lu - * config/tc-ia64.c (align_frag): New. - (md_assemble): Set the tc_frag_data field in align_frag for - IA64_OPCODE_FIRST instructions. - (ia64_md_do_align): Set align_frag. - (ia64_handle_align): Add a stop bit if needed. - - * config/tc-ia64.h (TC_FRAG_TYPE): New. - (TC_FRAG_INIT): New. - - 2004-02-27 Nick Clifton - * config/tc-sh.c (get_operand): Revert previous delta. - (tc_gen_reloc): Check for an unknown reloc type before processing - the addend. - - 2004-02-27 Hannes Reinecke - * config/tc-s390.c (s390_insn): Correct range check for opcode in - .insn pseudo operation. - - 2004-02-27 Anil Paranjpe - * config/tc-sh.c (get_operand): In case of #Imm, check has been - added for wrong syntax. - - 2004-02-26 Andrew Stubbs - * config/tc-sh.c (build_Mytes): Add REG_N_D and REG_N_B01 - nibble types to assembler. - - 2004-02-25 Fred Fish - * config/tc-iq2000.c: Add missing \n\ in multiline string literal. - - 2004-02-20 James E Wilson - * config/tc-ia64.c (slot_index): New arg before_relax. Use instead of - finalize_syms. - (fixup_unw_records): New arg before_relax. Pass to slot_index. - (ia64_estimate_size_before_relax): New. - (ia64_convert_frag): Pass 0 to fixup_unw_records. Add comment. - (generate_unwind_image): Pass 1 to fixup_unw_records. - * config/tc-ia64.h (ia64_estimate_size_before_relax): Declare. - (md_estimate_size_before_relax): Call ia64_estimate_size_before_relax. - - 2004-02-19 Jakub Jelinek - * stabs.c (generate_asm_file): Avoid warning about use of - uninitialized variable. - - 2004-02-18 David Mosberger - * config/tc-ia64.c (ia64_flush_insns): In addition to prologue, - body, and endp, allow unwind records which do not have a "t" - (time/instruction) field. - -2004-03-22 Bob Wilson - - * config/tc-xtensa.c (xtensa_post_relax_hook): Create literal - tables even when use_literal_section flag is not set. - -2004-03-22 Hans-Peter Nilsson - - * doc/c-cris.texi (CRIS-Opts): Document --no-mul-bug-abort, - --mul-bug-abort and the default behavior. - * config/tc-cris.c (cris_insn_kind): New member CRIS_INSN_MUL. - (err_for_dangerous_mul_placement): New variable. - (STATE_MUL, OPTION_MULBUG_ABORT_ON, OPTION_MULBUG_ABORT_OFF): New - macros. - (md_cris_relax_table): Have placeholder for STATE_MUL. - (md_longopts): New options --mul-bug-abort and --no-mul-bug-abort. - (cris_relax_frag) : New - case doing nothing. - (md_estimate_size_before_relax) : Ditto. - (md_convert_frag) : Check - alignment and position of this frag, emit error message if - suspicious. - (md_assemble): For a multiply insn and when checking it, - transform the current frag into a special frag for that purpose. - (md_parse_option) : Handle new options. - -2004-03-19 Bob Wilson - - * config/tc-xtensa.c (mark_literal_frags): New function. - (xtensa_move_literals): Call mark_literal_frags for all literal - segments, including init and fini literal segments. - (xtensa_post_relax_hook): Swap use of xt_insn_sec and xt_literal_sec. - -2004-03-17 Kaz Kojima - - * config/tc-sh.c: Include dw2gencfi.h. - (sh_cfi_frame_initial_instructions): New function. - (sh_regname_to_dw2regnum): Likewise. - * config/tc-sh.h (DWARF2_LINE_MIN_INSN_LENGTH): Move to the end of - file. - (TARGET_USE_CFIPOP): Define. - (tc_cfi_frame_initial_instructions): Likewise. - (tc_regname_to_dw2regnum): Likewise. - (DWARF2_DEFAULT_RETURN_COLUMN, DWARF2_CIE_DATA_ALIGNMENT): Likewise. - * Makefile.am: Update dependencies. + (md_begin): Set BFD flags. + (md_apply_fix3, bfin_fix_adjustable): Handle new relocs. + (bfin_gen_ldstidxi): Adjust to match the trees that the parser gives + us for GOT relocs. + * Makefile.am (bfin-parse.o): Update dependencies. + (DEPTC_bfin_elf): Likewise. * Makefile.in: Regenerate. -2004-03-17 Ralf Corsepius +2006-03-25 Richard Sandiford - * configure.in: Switch sh-*-rtems* to ELF. Add sh-*-rtemscoff*. + * config/tc-m68k.c (m68k_cpus): Change cpu_cf5208 entries to use + mcfemac instead of mcfmac. + +2006-03-22 Richard Sandiford + Daniel Jacobowitz + Phil Edwards + Zack Weinberg + Mark Mitchell + Nathan Sidwell + + * config/tc-mips.c (mips_target_format): Handle vxworks targets. + (md_begin): Complain about -G being used for PIC. Don't change + the text, data and bss alignments on VxWorks. + (reloc_needs_lo_p): Don't return true for R_MIPS_GOT16 when + generating VxWorks PIC. + (load_address): Extend SVR4_PIC handling to VXWORKS_PIC. + (macro): Likewise, but do not treat la $25 specially for + VxWorks PIC, and do not handle jal. + (OPTION_MVXWORKS_PIC): New macro. + (md_longopts): Add -mvxworks-pic. + (md_parse_option): Don't complain about using PIC and -G together here. + Handle OPTION_MVXWORKS_PIC. + (md_estimate_size_before_relax): Always use the first relaxation + sequence on VxWorks. + * config/tc-mips.h (VXWORKS_PIC): New. + +2006-03-21 Paul Brook + + * config/tc-arm.c (md_apply_fix): Fix typo in offset mask. + +2006-03-21 Sterling Augustine + + * config/tc-xtensa.c (enforce_three_byte_loop_align): New flag. + (xtensa_setup_hw_workarounds): Set this new flag for older hardware. + (get_loop_align_size): New. + (xtensa_end): Skip xtensa_mark_narrow_branches when not aligning. + (xtensa_mark_zcl_first_insns): Prevent widening of first loop frag. + (get_text_align_power): Rewrite to handle inputs in the range 2-8. + (get_noop_aligned_address): Use get_loop_align_size. + (get_aligned_diff): Likewise. + +2006-03-21 Paul Brook + + * config/tc-arm.c (insns): Correct opcodes for ldrbt and strbt. + +2006-03-20 Paul Brook + + * config/tc-arm.c (BAD_BRANCH, BAD_NOT_IT): Define. + (do_t_branch): Encode branches inside IT blocks as unconditional. + (do_t_cps): New function. + (do_t_blx, do_t_bkpt, do_t_branch23, do_t_bx, do_t_bxj, do_t_cpsi, + do_t_czb, do_t_it, do_t_setend, do_t_tb): Add IT constaints. + (opcode_lookup): Allow conditional suffixes on all instructions in + Thumb mode. + (md_assemble): Advance condexec state before checking for errors. + (insns): Use do_t_cps. + +2006-03-20 Paul Brook + + * config/tc-arm.c (output_relax_insn): Call dwarf2_emit_insn before + outputting the insn. + +2006-03-18 Jan-Benedict Glaw + + * config/tc-vax.c: Update copyright year. + * config/tc-vax.h: Likewise. + +2006-03-18 Jan-Benedict Glaw + + * config/tc-vax.c (md_chars_to_number): Used only locally, so + make it static. + * config/tc-vax.h (md_chars_to_number): Remove obsolete declaration. + +2006-03-17 Paul Brook + + * config/tc-arm.c (insns): Add ldm and stm. + +2006-03-17 Ben Elliston + + PR gas/2446 + * doc/as.texinfo (Ident): Document this directive more thoroughly. + +2006-03-16 Paul Brook + + * config/tc-arm.c (insns): Add "svc". + +2006-03-13 Bob Wilson + + * config/tc-xtensa.c (xg_translate_sysreg_op): Remove has_underbar + flag and avoid double underscore prefixes. + +2006-03-10 Paul Brook + + * config/tc-arm.c (md_begin): Handle EABIv5. + (arm_eabis): Add EF_ARM_EABI_VER5. + * doc/c-arm.texi: Document -meabi=5. + +2006-03-10 Ben Elliston + + * app.c (do_scrub_chars): Simplify string handling. + +2006-03-07 Richard Sandiford + Daniel Jacobowitz + Zack Weinberg + Nathan Sidwell + Paul Brook + Ricardo Anguiano + Phil Edwards + + * config/tc-arm.c (md_apply_fix): Install a value of zero into a + BFD_RELOC_ARM_OFFSET_IMM field if we're going to generate a RELA + R_ARM_ABS12 reloc. + (tc_gen_reloc): Keep the original fx_offset for RELA pc-relative + relocs, but adjust by md_pcrel_from_section. Create R_ARM_ABS12 + relocations for BFD_RELOC_ARM_OFFSET_IMM on RELA targets. + +2006-03-06 Bob Wilson + + * config/tc-xtensa.c (xtensa_post_relax_hook): Generate literal tables + even when using the text-section-literals option. + +2006-03-06 Nathan Sidwell + + * config/tc-m68k.c (m68k_extensions): Allow 'float' on both m68k + and cf. + (m68k_ip): Check we have some control regs. + (md_parse_option): Allow raw arch switch. + (m68k_init_arch): Better detection of arch/cpu mismatch. Detect + whether 68881 or cfloat was meant by -mfloat. + (md_show_usage): Adjust extension display. + (m68k_elf_final_processing): Adjust. + +2006-03-03 Bjoern Haase + + * config/tc-avr.c (avr_mod_hash_value): New function. + (md_apply_fix, exp_mod): Use BFD_RELOC_HH8_LDI and + BFD_RELOC_MS8_LDI for hlo8() and hhi8() + (md_begin): Set linkrelax variable to 1, use avr_mod_hash_value + instead of int avr_ldi_expression: use avr_mod_hash_value instead + of (int). + (tc_gen_reloc): Handle substractions of symbols, if possible do + fixups, abort otherwise. + * config/tc-avr.h (TC_LINKRELAX_FIXUP, TC_VALIDATE_FIX, + tc_fix_adjustable): Define. + +2006-03-02 James E Wilson + + * config/tc-ia64.c (emit_one_bundle): For IA64_OPCODE_LAST, if we + change the template, then clear md.slot[curr].end_of_insn_group. + +2006-02-28 Jan Beulich + + * macro.c (get_any_string): Don't insert quotes for <>-quoted input. + +2006-02-28 Jan Beulich + + PR/1070 + * macro.c (getstring): Don't treat parentheses special anymore. + (get_any_string): Don't consider '(' and ')' as quoting anymore. + Special-case '(', ')', '[', and ']' when dealing with non-quoting + characters. + +2006-02-28 Mat + + * dwarf2dbg.c (get_filenum): Don't inadvertently decrease files_in_use. + +2006-02-27 Jakub Jelinek + + * dw2gencfi.c (struct fde_entry, struct cie_entry): Add signal_frame + field. + (CFI_signal_frame): Define. + (cfi_pseudo_table): Add .cfi_signal_frame. + (dot_cfi): Handle CFI_signal_frame. + (output_cie): Handle cie->signal_frame. + (select_cie_for_fde): Don't share CIE if signal_frame flag is + different. Copy signal_frame from FDE to newly created CIE. + * doc/as.texinfo: Document .cfi_signal_frame. + +2006-02-27 Carlos O'Donell + + * doc/Makefile.am: Add html target. + * doc/Makefile.in: Regenerate. + * po/Make-in: Add html target. + +2006-02-27 H.J. Lu + + * config/tc-i386.c (output_insn): Support Intel Merom New + Instructions. + + * config/tc-i386.h (CpuMNI): New. + (CpuUnknownFlags): Add CpuMNI. + +2006-02-24 David S. Miller + + * config/tc-sparc.c (priv_reg_table): Add entry for "gl". + (hpriv_reg_table): New table for hyperprivileged registers. + (sparc_ip): New cases '$' and '%' for wrhpr/rdhpr hyperprivileged + register encoding. + +2006-02-24 DJ Delorie + + * config/tc-m32c.h (md_apply_fix): Define to m32c_apply_fix. + (tc_gen_reloc): Don't define. + * config/tc-m32c.c (rl_for, relaxable): New convenience macros. + (OPTION_LINKRELAX): New. + (md_longopts): Add it. + (m32c_relax): New. + (md_parse_options): Set it. + (md_assemble): Emit relaxation relocs as needed. + (md_convert_frag): Emit relaxation relocs as needed. + (md_cgen_lookup_reloc): Add LAB_8_8 and LAB_8_16. + (m32c_apply_fix): New. + (tc_gen_reloc): New. + (m32c_force_relocation): Force out jump relocs when relaxing. + (m32c_fix_adjustable): Return false if relaxing. + +2006-02-24 Paul Brook + + * config/arm/tc-arm.c (arm_ext_v6_notm, arm_ext_div, arm_ext_v7, + arm_ext_v7a, arm_ext_v7r, arm_ext_v7m): New variables. + (struct asm_barrier_opt): Define. + (arm_v7m_psr_hsh, arm_barrier_opt_hsh): New variables. + (parse_psr): Accept V7M psr names. + (parse_barrier): New function. + (enum operand_parse_code): Add OP_oBARRIER. + (parse_operands): Implement OP_oBARRIER. + (do_barrier): New function. + (do_dbg, do_pli, do_t_barrier, do_t_dbg, do_t_div): New functions. + (do_t_cpsi): Add V7M restrictions. + (do_t_mrs, do_t_msr): Validate V7M variants. + (md_assemble): Check for NULL variants. + (v7m_psrs, barrier_opt_names): New tables. + (insns): Add V7 instructions. Mark V6 instructions absent from V7M. + (md_begin): Initialize arm_v7m_psr_hsh and arm_barrier_opt_hsh. + (arm_cpu_option_table): Add Cortex-M3, R4 and A8. + (arm_arch_option_table): Add armv7, armv7a, armv7r and armv7m. + (struct cpu_arch_ver_table): Define. + (cpu_arch_ver): New. + (aeabi_set_public_attributes): Use cpu_arch_ver. Set + Tag_CPU_arch_profile. + * doc/c-arm.texi: Document new cpu and arch options. + +2006-02-23 H.J. Lu + + * config/tc-ia64.c (operand_match): Handle IA64_OPND_IMMU5b. + +2006-02-23 H.J. Lu + + * config/tc-ia64.c: Update copyright years. + +2006-02-22 H.J. Lu + + * config/tc-ia64.c (specify_resource): Add the rule 17 from + SDM 2.2. + +2005-02-22 Paul Brook + + * config/tc-arm.c (do_pld): Remove incorrect write to + inst.instruction. + (encode_thumb32_addr_mode): Use correct operand. + +2006-02-21 Paul Brook + + * config/tc-arm.c (md_apply_fix): Fix off-by-one errors. + +2006-02-17 Shrirang Khisti + Anil Paranjape + Shilin Shakti + + * Makefile.am: Add xc16x related entry. + * Makefile.in: Regenerate. + * configure.in: Added xc16x related entry. * configure: Regenerate. + * config/tc-xc16x.h: New file + * config/tc-xc16x.c: New file + * doc/c-xc16x.texi: New file for xc16x + * doc/all.texi: Entry for xc16x + * doc/Makefile.texi: Added c-xc16x.texi + * NEWS: Announce the support for the new target. -2004-03-12 Bob Wilson +2006-02-16 Nick Hudson - * read.c (s_leb128): Call md_flush_pending_output. + * configure.tgt: set emulation for mips-*-netbsd* -2004-03-12 Michal Ludvig +2006-02-14 Jakub Jelinek - * config/tc-i386.c (output_insn): Handle PadLock instructions. - * config/tc-i386.h (CpuPadLock): New define. - (CpuUnknownFlags): Added CpuPadLock. + * config.in: Rebuilt. -2004-02-26 Eric Christopher +2006-02-13 Bob Wilson - * config/tc-mips.c (mips_dwarf2_addr_size): New. - * config/tc-mips.h (DWARF2_ADDR_SIZE): Use. + * config/tc-xtensa.c (xg_add_opcode_fix): Number operands starting + from 1, not 0, in error messages. + (md_assemble): Simplify special-case check for ENTRY instructions. + (tinsn_has_invalid_symbolic_operands): Do not include opcode and + operand in error message. -2004-02-17 Petko Manolov +2006-02-13 Joseph S. Myers - * config/tc-arm.c (do_mav_dspsc_1): Correct offset of CRn. - (do_mav_dspsc_2): Likewise. - Fix accumulator registers move opcodes. + * configure.tgt (arm-*-linux-gnueabi*): Change to + arm-*-linux-*eabi*. -2004-02-13 Hannes Reinecke - Jakub Jelinek +2006-02-10 Nick Clifton - * dwarf2dbg.c (get_filenum): Do not read beyond allocated memory. + * config/tc-crx.c (check_range): Ensure that the sign bit of a + 32-bit value is propagated into the upper bits of a 64-bit long. -2004-02-10 Steve Ellcey + * config/tc-arc.c (init_opcode_tables): Fix cast. + (arc_extoper, md_operand): Likewise. - * config/tc-ia64.h (ia64_frob_symbol): New declaration. - (tc_frob_symbol): New macro definition. - * config/tc-ia64.c (ia64_frob_symbol): New routine. +2006-02-09 David Heine -2004-02-09 Daniel Jacobowitz + * config/tc-xtensa.c (xg_assembly_relax): Increment steps_taken for + each relaxation step. - * config/tc-arm.c (md_begin): Mark .note.gnu.arm.ident as - read-only. - -2004-02-09 Nathan Sidwell - - * read.h (IGNORE_OPCODE_CASE): Do not define. Replace with ... - (TC_CASE_SENSITIVE): ... this. - * read.c: Replace IGNORE_OPCODE_CASE with TC_CASE_SENSITIVE. - * doc/internals.texi (TC_CASE_SENSITIVE): Document. - -2004-02-06 James E Wilson - - * config/tc-ia64.c (dot_endp): Delete call to output_endp. - (generate_unwind_image): Re-add it here. - -2004-02-06 Nathan Sidwell - - * dwarf2dbg.c (DWARF2_ADDR_SIZE): Remove trailing ';' - * read.h (SKIP_WHITESPACE): Turn into an expression. - * read.c (read_a_source_file): A pseudo is removed by having a - NULL handler. - -2004-02-05 James E Wilson - - * config/tc-ia64.c (output_endp): New. - (count_bits): Delete. - (ia64_flush_insns, process_one_record, optimize_unw_records): Handle - endp unwind records. - (fixup_unw_records): Handle endp unwind records. Delete code for - shortening prologue regions not followed by a body record. - (dot_endp): Call add_unwind_entry to emit endp unwind record. - * config/tc-ia64.h (unw_record_type): Add endp. - -2004-02-03 James E Wilson - - * config/tc-ia64.c (ia64_convert_frag): Call md_number_to_chars to - fill padding bytes with zeroes. - (emit_one_bundle): New locals last_ptr, end_ptr. Rewrite code that - sets unwind_record slot_number and slot_frag fields. - -2004-02-02 Maciej W. Rozycki - - * config/tc-mips.c (add_got_offset_hilo): New function. - (macro): Use load_register() and add_got_offset_hilo() to load - constants instead of hardcoding code sequences throughout. - -2004-01-28 H.J. Lu - - * config/tc-ia64.c (emit_one_bundle): Add proper indentation. - -2004-01-26 Bernardo Innocenti - - * config/tc-m68k.h (EXTERN_FORCE_RELOC): Handle m68k-uclinux specially, - like m68k-elf. - * config/tc-m68k.c (RELAXABLE_SYMBOL): Use EXTERN_FORCE_RELOC instead - of hard-coded test for TARGET_OS=elf. - -2004-01-24 Chris Demetriou - - * config/tc-mips.c (hilo_interlocks): Change definition - so that MIPS32, MIPS64 and later ISAs are included, along with - the already-included machines. Update comments. - -2004-01-23 Daniel Jacobowitz - - * config/tc-arm.c (tc_gen_reloc): Improve error message for - undefined local labels. - -2004-01-23 Richard Sandiford - - * config/tc-mips.c (load_address, macro): Update comments about - NewABI GP relaxation. - -2004-01-23 Richard Sandiford - - * config/tc-mips.c (macro_build): Remove place and counter arguments. - (mips_build_lui, macro_build_ldst_constoffset): Likewise. - (mips16_macro_build, macro_build_jalr): Remove counter argument. - (set_at, load_register, load_address, move_register): Likewise. - (load_got_offset, add_got_offset): Likewise. - Update all calls and tidy accordingly. - -2004-01-23 Richard Sandiford - - * config/tc-mips.c (RELAX_ENCODE): Remove WARN argument. - (RELAX_FIRST, RELAX_SECOND): Turn into 8-bit quantities. - (RELAX_USE_SECOND): Bump to 0x10000. - (RELAX_SECOND_LONGER, RELAX_NOMACRO, RELAX_DELAY_SLOT): New flags. - (mips_macro_warning): New variable. - (md_assemble): Wrap macro expansion in macro_start() and macro_end(). - (s_cpload, s_cpsetup, s_cprestore, s_cpreturn): Likewise. - (relax_close_frag): Set mips_macro_warning.first_frag. Adjust use - of RELAX_ENCODE. - (append_insn): Update mips_macro_warning.sizes. - (macro_start, macro_warning, macro_end): New functions. - (macro_build): Don't emit warnings here. - (macro_build_lui, md_estimate_size_before_relax): ...or here. - (md_convert_frag): Check for cases where one macro alternative - needs a warning and the other doesn't. Emit a warning if the - longer sequence was chosen. - -2004-01-23 Richard Sandiford - - * config/tc-mips.h (tc_frag_data_type, TC_FRAG_TYPE): Remove. - * config/tc-mips.c (RELAX_ENCODE): Take three arguments: the size of - the first sequence, the size of the second sequence, and a flag - that says whether we should warn. - (RELAX_OLD, RELAX_NEW, RELAX_RELOC[123]): Delete. - (RELAX_FIRST, RELAX_SECOND): New. - (mips_relax): New variable. - (relax_close_frag, relax_start, relax_switch, relax_end): New fns. - (append_insn): Remove "place" argument. Use mips_relax.sequence - rather than "place" to check whether we're expanding the second - alternative of a relaxable macro. Remove redundant check for - branch relaxation. If generating a normal insn, and there - is not enough room in the current frag, call relax_close_frag() - to close it. Update mips_relax.sizes[]. Emit fixups for the - second version of a relaxable macro. Record the first relaxable - fixup in mips_relax. Remove tc_gen_reloc workaround. - (macro_build): Remove all uses of "place". Use mips_relax.sequence - in the same way as in append_insn. - (mips16_macro_build): Remove "place" argument. - (macro_build_lui): As for macro_build. Don't drop the add_symbol - when generating the second version of a relaxable macro. - (load_got_offset, add_got_offset): New functions. - (load_address, macro): Use new relaxation machinery. Remove - tc_gen_reloc workarounds. - (md_estimate_size_before_relax): Set RELAX_USE_SECOND if the second - version of a relaxable macro is needed. Return -RELAX_SECOND if the - first version is needed. - (tc_gen_reloc): Remove relaxation handling. - (md_convert_frag): Go through the fixups for a relaxable macro and - mark those that belong to the unneeded alternative as done. If the - second alternative is needed, adjust the fixup addresses to account - for the deleted first alternative. - -2004-01-23 Richard Sandiford - - * frags.h (frag_room): Declare. - * frags.c (frag_room): New function. - * doc/internals.texi: Document it. - -2004-01-22 Thiemo Seufer - - * config/tc-mips.c (append_insn): Don't do r3900 interlock - optimization for -mtune=r3900, as this will break on other CPUs. - -2004-01-11 Tom Rix - - * config/tc-m68hc11.c (build_indexed_byte): movb and movw cannot - be relaxed, use fixup. - (md_apply_fix3): Use 5 bit reloc from movb and movw fixup. - -2004-01-19 Jakub Jelinek - - * config/tc-sparc.c (sparc_ip): Disallow %f32-%f63 for single - precision operands. - -2004-01-14 Maciej W. Rozycki - - * config/tc-mips.c (append_insn): Properly detect variant frags - that preclude swapping of relaxed branches. Correctly swap - instructions between frags when dealing with relaxed branches. - -2004-01-14 Maciej W. Rozycki - - * acinclude.m4: Quote names of macros to be defined by AC_DEFUN - throughout. - * aclocal.m4: Regenerate. +2006-02-09 Eric Botcazou + + * configure.in (CHECK_DECLS): Add vsnprintf. * configure: Regenerate. + * messages.c (errno.h, stdarg.h, varargs.h, va_list): Do not + include/declare here, but... + * as.h: Move code detecting VARARGS idiom to the top. + (errno.h, stdarg.h, varargs.h, va_list): ...here. + (vsnprintf): Declare if not already declared. -2004-01-12 Anil Paranjpe +2006-02-08 H.J. Lu - * config/tc-h8300.c (build_bytes): Apply relaxation to bit - manipulation insns. + * as.c (close_output_file): New. + (main): Register close_output_file with xatexit before + dump_statistics. Don't call output_file_close. -2004-01-12 Richard Sandiford +2006-02-07 Nathan Sidwell - * config/tc-mips.c (macro_build_jalr): When adding an R_MIPS_JALR - reloc, reserve space for the delay slot as well as the jalr itself. + * config/tc-m68k.c (mcf5208_control_regs, mcf5213_control_regs, + mcf5329_control_regs): New. + (not_current_architecture, selected_arch, selected_cpu): New. + (m68k_archs, m68k_extensions): New. + (archs): Renamed to ... + (m68k_cpus): ... here. Adjust. + (n_arches): Remove. + (md_pseudo_table): Add arch and cpu directives. + (find_cf_chip, m68k_ip): Adjust table scanning. + (no_68851, no_68881): Remove. + (md_assemble): Lazily initialize. + (select_control_regs): Adjust cpu names. Add 5208, 5213, 5329. + (md_init_after_args): Move functionality to m68k_init_arch. + (mri_chip): Adjust table scanning. + (md_parse_option): Reimplement 'm' processing to add -march & -mcpu + options with saner parsing. + (m68k_lookup_cpu, m68k_set_arch, m68k_set_cpu, m68k_set_extension, + m68k_init_arch): New. + (s_m68k_cpu, s_m68k_arch): New. + (md_show_usage): Adjust. + (m68k_elf_final_processing): Set CF EF flags. + * config/tc-m68k.h (m68k_init_after_args): Remove. + (tc_init_after_args): Remove. + * doc/c-m68k.texi (M68K-Opts): Document -march, -mcpu options. + (M68k-Directives): Document .arch and .cpu directives. -2004-01-09 Paul Brook +2006-02-05 Arnold Metselaar - * config/tc-arm.c (do_vfp_reg2_from_sp2): Rename from do_vfp_sp_reg2. - (do_vfp_sp2_from_reg2): New function. + * config/tc-z80.c (z80_start_line_hook): allow .equ and .defl as + synonyms for equ and defl. + (z80_cons_fix_new): New function. + (emit_byte): Disallow relative jumps to absolute locations. + (emit_data): Only handle defb, prototype changed, because defb is + now handled as pseudo-op rather than an instruction. + (instab): Entries for defb,defw,db,dw moved from here... + (md_pseudo_table): ... to here, use generic cons() for defw,dw. + Add entries for def24,def32,d24,d32. + (md_assemble): Improved error handling. + (md_apply_fix): New case BFD_RELOC_24, set fixP->fx_no_overflow to one. + * config/tc-z80.h (TC_CONS_FIX_NEW): Define. + (z80_cons_fix_new): Declare. + * doc/c-z80.texi (defb, db): Mention warning on overflow. + (def24,d24,def32,d32): New pseudo-ops. + +2006-02-02 Paul Brook + + * config/tc-arm.c (do_shift): Remove Thumb-1 constraint. + +2005-02-02 Paul Brook + + * config/tc-arm.c (T2_OPCODE_MASK, T2_DATA_OP_SHIFT, T2_OPCODE_AND, + T2_OPCODE_BIC, T2_OPCODE_ORR, T2_OPCODE_ORN, T2_OPCODE_EOR, + T2_OPCODE_ADD, T2_OPCODE_ADC, T2_OPCODE_SBC, T2_OPCODE_SUB, + T2_OPCODE_RSB): Define. + (thumb32_negate_data_op): New function. + (md_apply_fix): Use it. + +2006-01-31 Bob Wilson + + * config/xtensa-istack.h (TInsn): Remove record_fix and sub_symbol + fields. + * config/tc-xtensa.h (xtensa_frag_type): Remove slot_sub_symbols field. + * config/tc-xtensa.c (md_apply_fix): Check for unexpected uses of + subtracted symbols. + (relaxation_requirements): Add pfinish_frag argument and use it to + replace setting tinsn->record_fix fields. + (xg_assemble_vliw_tokens): Adjust calls to relaxation_requirements + and vinsn_to_insnbuf. Remove references to record_fix and + slot_sub_symbols fields. + (xtensa_mark_narrow_branches): Delete unused code. + (is_narrow_branch_guaranteed_in_range): Handle expr that is not just + a symbol. + (convert_frag_immed): Adjust vinsn_to_insnbuf call and do not set + record_fix fields. + (tinsn_immed_from_frag): Remove code for handling slot_sub_symbols. + (vinsn_to_insnbuf): Change use of record_fixup argument, replacing use + of the record_fix field. Simplify error messages for unexpected + symbolic operands. + (set_expr_symbol_offset_diff): Delete. + +2006-01-31 Paul Brook + + * config/tc-arm.c (arm_reg_parse): Check if reg is non-NULL. + +2006-01-31 Paul Brook + Richard Earnshaw + + * config/tc-arm.c: Use arm_feature_set. + (arm_ext_*, arm_arch_full, arm_arch_t2, arm_arch_none, + arm_cext_iwmmxt, arm_cext_xscale, arm_cext_maverick, fpu_fpa_ext_v1, + fpu_fpa_ext_v2, fpu_vfp_ext_v1xd, fpu_vfp_ext_v1, fpu_vfp_ext_v2): + New variables. (insns): Use them. - (do_vfp_dp_from_reg2): Check return values properly. + (md_atof, opcode_select, opcode_select, md_assemble, md_assemble, + md_begin, arm_parse_extension, arm_parse_cpu, arm_parse_arch, + arm_parse_fpu, arm_parse_float_abi, aeabi_set_public_attributes, + s_arm_cpu, s_arm_arch, s_arm_fpu): Use macros for accessing CPU + feature flags. + (arm_legacy_option_table, arm_option_cpu_value_table): New types. + (arm_opts): Move old cpu/arch options from here... + (arm_legacy_opts): ... to here. + (md_parse_option): Search arm_legacy_opts. + (arm_cpus, arm_archs, arm_extensions, arm_fpus) + (arm_float_abis, arm_eabis): Make const. -2004-01-08 Ian Lance Taylor +2006-01-25 Bob Wilson - * config/tc-mips.c (warn_nops): Remove static variable. - (macro): Remove test of warn_nops. - (md_shortops): Remove 'n'. - (md_parse_option): Remove 'n' case. - (md_show_usage): Remove -n. - * doc/as.texinfo (Overview): Remove MIPS -n option. - * doc/c-mips.texi (MIPS Opts): Remove mention -n. - * NEWS: Mention removal of MIPS -n option. + * config/tc-xtensa.c (md_apply_fix): Set value to zero for PLT relocs. - * config/tc-mips.c (ISA_HAS_COPROC_DELAYS): Remove. - (cop_interlocks): Check ISA level. - (cop_mem_interlocks): Define. - (reg_needs_delay): Check cop_interlocks rather than - ISA_HAS_COPROC_DELAYS. - (append_insn): Likewise. Use cop_mem_interlocks rather than - directly checking mips_opts.isa. - (mips_emit_delays): Likewise. +2006-01-21 Jie Zhang -2004-01-07 H.J. Lu + * config/bfin-parse.y (asm_1): Check value range for 16 bit immediate + in load immediate intruction. - * config/tc-ia64.c (unwind): Move next_slot_number and - next_slot_frag to ... - (unw_rec_list): Here. - (free_list_records): Removed. - (output_unw_records): Likewise. - (generate_unwind_image): Make it void. - (alloc_record): Initialize next_slot_number and next_slot_frag. - (slot_index): Take .org, .space and .align into account. - (fixup_unw_records): Don't set slot_number to 0. Use - list->next_slot_number and list->next_slot_frag instead of - unwind.next_slot_number and unwind.next_slot_frag. - (ia64_convert_frag): New. - (generate_unwind_image): Generate a rs_machine_dependent frag - for unwind record. - (emit_one_bundle): Use list->next_slot_number and - list->next_slot_frag instead of unwind.next_slot_number and - unwind.next_slot_frag. +2006-01-21 Jie Zhang - * config/tc-ia64.h (md_convert_frag): Defined as - ia64_convert_frag. - (md_estimate_size_before_relax): Defined as (f)->fr_var. + * config/bfin-parse.y (value_match): Use correct conversion + specifications in template string for __FILE__ and __LINE__. + (binary): Ditto. + (unary): Ditto. -2004-01-06 Alexandre Oliva +2006-01-18 Alexandre Oliva - 2003-12-19 Alexandre Oliva - * config/tc-frv.h (md_apply_fix3): Don't define. - * config/tc-frv.c (md_apply_fix3): New. Shift/truncate %hi/%lo - operands. - * config/tc-frv.h (TC_FORCE_RELOCATION_SUB_LOCAL): Define. - 2003-10-07 Alexandre Oliva - * config/tc-frv.c (line_separator_chars): Add `!'. - 2003-09-19 Alexandre Oliva - * config/tc-frv.c (md_assemble): Clear insn upfront. - 2003-09-18 Alexandre Oliva - * config/tc-frv.c (OPTION_FDPIC): New macro. - (md_longopts): Add mfdpic. - (md_parse_option): Handle it. - 2003-08-04 Alexandre Oliva - * config/tc-frv.c (md_cgen_lookup_reloc) : Use reloc type encoded in fix-up. - (frv_pic_ptr): Parse funcdesc. + Introduce TLS descriptors for i386 and x86_64. + * config/tc-i386.c (tc_i386_fix_adjustable): Handle + BFD_RELOC_386_TLS_GOTDESC, BFD_RELOC_386_TLS_DESC_CALL, + BFD_RELOC_X86_64_GOTPC32_TLSDESC, BFD_RELOC_X86_64_TLSDESC_CALL. + (optimize_disp): Emit fix up for BFD_RELOC_386_TLS_DESC_CALL and + BFD_RELOC_X86_64_TLSDESC_CALL immediately, and clear the + displacement bits. + (build_modrm_byte): Set up zero modrm for TLS desc calls. + (lex_got): Handle @tlsdesc and @tlscall. + (md_apply_fix, tc_gen_reloc): Handle the new relocations. -2004-01-05 Maciej W. Rozycki +2006-01-11 Nick Clifton - * doc/as.texinfo: Let texi2pod parse asconfig.texi and - gasver.texi. Remove duplicate symbol definitions for texi2pod. + Fixes for building on 64-bit hosts: + * config/tc-avr.c (mod_index): New union to allow conversion + between pointers and integers. + (md_begin, avr_ldi_expression): Use it. + * config/tc-i370.c (md_assemble): Add cast for argument to print + statement. + * config/tc-tic54x.c (subsym_substitute): Likewise. + * config/tc-mn10200.c (md_assemble): Use a union to convert the + opindex field of fr_cgen structure into a pointer so that it can + be stored in a frag. + * config/tc-mn10300.c (md_assemble): Likewise. + * config/tc-frv.c (frv_debug_tomcat): Use %p to print pointer + types. + * config/tc-v850.c: Replace uses of (int) casts with correct + types. -2004-01-05 Maciej W. Rozycki +2006-01-09 H.J. Lu - * Makefile.am (Makefile): Move the dependency on - $(BFDDIR)/configure.in to... - (CONFIG_STATUS_DEPENDENCIES): ... here. - (AUTOMAKE_OPTIONS): Require automake 1.8. - * Makefile.in: Regenerate. - * doc/Makefile.am (BASEDIR, BFDDIR): Define. - (CONFIG_STATUS_DEPENDENCIES): Add a dependency on - $(BFDDIR)/configure.in here as well. - * doc/Makefile.in: Regenerate. + PR gas/2117 + * symbols.c (snapshot_symbol): Don't change a defined symbol. -2004-01-05 Maciej W. Rozycki +2006-01-03 Hans-Peter Nilsson - * Makefile.am (install, install-info, RECURSIVE_TARGETS): Remove. - * Makefile.in: Regenerate. - * aclocal.m4: Regenerate. - * doc/Makefile.am (install, install-info): Remove. - (install-data-local): A new hook for install-info. - (AUTOMAKE_OPTIONS): Require automake 1.8. - * doc/Makefile.in: Regenerate. + PR gas/2101 + * config/tc-mmix.c (mmix_handle_mmixal): Don't treat #[0-9][FB] as + a local-label reference. -2004-01-02 Nutan Singh - - * doc/c-sh.texi: Update description about floating point behavior - of SH family. - -2004-01-02 Bernardo Innocenti - - * configure.in: Add m68k-uClinux target. - * configure: Regenerate. - -For older changes see ChangeLog-0203 +For older changes see ChangeLog-2005 Local Variables: mode: change-log diff --git a/contrib/binutils/gas/ChangeLog-0001 b/contrib/binutils/gas/ChangeLog-0001 index 9d8af6fbe89..b1208c4d78c 100644 --- a/contrib/binutils/gas/ChangeLog-0001 +++ b/contrib/binutils/gas/ChangeLog-0001 @@ -8,8 +8,8 @@ 2001-12-31 Jeffrey A Law (law@redhat.com) - * config/tc-hppa.c (pa_ip): Handle new 'c' mode completers, - 'X', 'M', and 'A'. + * config/tc-hppa.c (pa_ip): Handle new 'c' mode completers, + 'X', 'M', and 'A'. 2001-12-21 Jakub Jelinek @@ -7701,3 +7701,10 @@ pseudo ops. For older changes see ChangeLog-9899 + +Local Variables: +mode: change-log +left-margin: 8 +fill-column: 74 +version-control: never +End: diff --git a/contrib/binutils/gas/ChangeLog-0203 b/contrib/binutils/gas/ChangeLog-0203 index e22a5d5f2d5..63be7bf391f 100644 --- a/contrib/binutils/gas/ChangeLog-0203 +++ b/contrib/binutils/gas/ChangeLog-0203 @@ -14,7 +14,7 @@ .byte directive generates a pc-relative relocation. 2003-12-19 Nick Clifton - Andreas Schwab + Andreas Schwab * messages.c (as_perror): Save errno around library calls. * input-file.c [BFD_ASSEMBLER]: Set the BFD error to @@ -29,15 +29,15 @@ 2003-12-19 Kazuhiro Inaoka - Add m32r-linux and PIC support. Add new ABI that uses RELA. - * configure.in: Add m32r-linux targets. + Add m32r-linux and PIC support. Add new ABI that uses RELA. + * configure.in: Add m32r-linux targets. * configure: Regenerate. - * config/tc-m32r.c (md_parse_option): Add -KPIC option. - (tc_gen_reloc): Added. - (debug_sym, md_estimate_size_before_relax, md_convert_frag, - md_pcrel_from_section, m32r_fix_adjustable): Changed for PIC. - * config/tc-m32r.h (tc_gen_reloc, EXTERN_FORCE_RELOC): Undefined. - (TC_HANDLES_FX_DONE, TC_FIX_ADJUSTABLE, TC_RELOC_RTSYM_LOC_FIXUP): + * config/tc-m32r.c (md_parse_option): Add -KPIC option. + (tc_gen_reloc): Added. + (debug_sym, md_estimate_size_before_relax, md_convert_frag, + md_pcrel_from_section, m32r_fix_adjustable): Changed for PIC. + * config/tc-m32r.h (tc_gen_reloc, EXTERN_FORCE_RELOC): Undefined. + (TC_HANDLES_FX_DONE, TC_FIX_ADJUSTABLE, TC_RELOC_RTSYM_LOC_FIXUP): Defined. * doc/c-m32r.texi: Document -KPIC option. * NEWS: Mention the support m32r Linux and PIC. @@ -68,17 +68,17 @@ 2003-12-17 Nick Clifton * config/tc-m32r.c (error_explicit_parallel_conflicts): Rename - to 'ignore_parallel_conflicts'. - (md_longopts): Change option names as well. - (md_parse_option): Separate the warn_explicit and ignore - parallel conflicts options. - (md_show_usage): Update descriptions of these options. - (first_writes_to_seconds_operands): Do not run this check if - ignoring parallel conflicts. - (assemble_two_insns): Remove code that checked - error_explicit_parallel_conflicts. - * doc/c-m32r.texi: Update descriptions of the options. - + to 'ignore_parallel_conflicts'. + (md_longopts): Change option names as well. + (md_parse_option): Separate the warn_explicit and ignore + parallel conflicts options. + (md_show_usage): Update descriptions of these options. + (first_writes_to_seconds_operands): Do not run this check if + ignoring parallel conflicts. + (assemble_two_insns): Remove code that checked + error_explicit_parallel_conflicts. + * doc/c-m32r.texi: Update descriptions of the options. + 2003-12-16 Dmitry Semyonov * tc-arm.c (do_adr): Do not adjust pc by -8 if TE_WINCE is diff --git a/contrib/binutils/gas/ChangeLog-9295 b/contrib/binutils/gas/ChangeLog-9295 index 71357330152..f51559689eb 100644 --- a/contrib/binutils/gas/ChangeLog-9295 +++ b/contrib/binutils/gas/ChangeLog-9295 @@ -248,7 +248,7 @@ Wed Nov 15 03:52:00 1995 Ken Raeburn Mon Jul 31 14:53:19 1995 Alan Modra * config/tc-i386.h (md_do_align): cast fill and 0x90 to char - before comparing + before comparing Mon May 1 10:91:49 1995 Alan Modra @@ -506,9 +506,9 @@ Mon Oct 23 16:20:04 1995 Ken Raeburn Mon Oct 23 11:15:44 1995 James G. Smith * config/tc-mips.c: Added mips_4100 control, and support for - accepting the 4100 as a MIPS architecture variant (md_begin, - macro_build, mips_ip, md_parse_option). Adding suitable - command-line OPTIONs, and updating the help text (md_show_usage). + accepting the 4100 as a MIPS architecture variant (md_begin, + macro_build, mips_ip, md_parse_option). Adding suitable + command-line OPTIONs, and updating the help text (md_show_usage). Wed Oct 18 13:20:32 1995 Ken Raeburn @@ -840,11 +840,11 @@ Wed Sep 27 10:29:13 1995 Kim Knuttila (md_assemble): Initial [toc]x(rtoc) support (ppc_frob_label): Removed some xcoff specific processing from TE_PE (ppc_frob_symbol): Removed some xcoff specific processing from TE_PE - Added support for more predefined sections - (ppc_frob_section): Removed some xcoff specific processing from TE_PE + Added support for more predefined sections + (ppc_frob_section): Removed some xcoff specific processing from TE_PE (ppc_fix_adjustable): Removed from TE_PE mainline (md_apply_fix3): For TE_PE toc entries, we don't need to mess - with fx_addnumber. Removed for the time being. + with fx_addnumber. Removed for the time being. (lots): Put back missing assignments to ppc_current_csect. Tue Sep 26 14:57:59 1995 Michael Meissner @@ -1066,7 +1066,7 @@ Thu Sep 7 12:33:58 1995 Ian Lance Taylor * expr.c (operand): Handle 08 and 09 in MRI mode. * macro.c (ISSEP): Remove duplicated `"' character. - (get_any_string): Copy some characters for which ISSEP is true: + (get_any_string): Copy some characters for which ISSEP is true: ';', '>', '(', ')'. Otherwise we can get in an infinite loop. * read.c (s_space): In MRI mode, the expressions stop at the first unquoted space. @@ -1146,7 +1146,7 @@ Fri Sep 1 17:02:15 1995 steve chamberlain Fri Sep 1 08:20:19 1995 James G. Smith - * config/tc-mips.c (md_parse_option, md_begin, md_show_usage): + * config/tc-mips.c (md_parse_option, md_begin, md_show_usage): Add support for "-mcpu=vr4300" as processor identifier. Thu Aug 31 16:41:06 1995 steve chamberlain @@ -1157,8 +1157,8 @@ Thu Aug 31 16:41:06 1995 steve chamberlain Tue Aug 29 19:42:58 1995 Andreas Schwab * config/tc-m68k.c (m68k_ip) [case POST/PRE/BASE]: Fix typo when - looking at outer displacement. Don't set the postindex bit if the - index suppress bit is set (for memory indirect addressing mode). + looking at outer displacement. Don't set the postindex bit if the + index suppress bit is set (for memory indirect addressing mode). Thu Aug 31 06:49:37 1995 Doug Evans @@ -1539,7 +1539,7 @@ Fri Aug 11 19:16:08 1995 Ian Lance Taylor * doc/gasp.texi: Document -M/--mri. * gasp.c: Include ansidecl.h. Make all local functions static. - Add prototypes for all static functions. + Add prototypes for all static functions. (mri): New global variable. (sb_add_char): Change parameter c from char to int. (sb_add_string): Make parameter s into a const pointer. @@ -1843,7 +1843,7 @@ Mon Aug 7 02:54:20 1995 Jeff Law (law@snake.cs.utah.edu) Fri Aug 4 12:29:21 1995 Ian Lance Taylor * expr.c (op_encoding): Make non-const. Don't set '"' to - O_bit_not. + O_bit_not. (expr_begin): Set op_encoding['"'] in MRI mode. Wed Aug 2 18:39:43 1995 Ian Lance Taylor @@ -2471,7 +2471,7 @@ Wed Jun 21 18:07:59 1995 Ken Raeburn (md_estimate_size_before_relax) [case TAB (FBRANCH, SZ_UNDEF)]: Turn on long bit. (m68k_ip) [case 'C']: Don't set set long bit, set it in the opcode - table. + table. (md_estimate_size_before_relax) [case TAB (PCINDEX, SZ_UNDEF)]: Variable part increases by four, not six. * write.c (fixup_segment) [TC_M68K]: Don't do further pcrel @@ -4143,7 +4143,7 @@ Tue Dec 13 08:04:15 1994 Ian Lance Taylor * config/tc-mips.c (macro_build): Accept BFD_RELOC_PCREL* without requiring that the X_op_symbol be in the text_section. - (macro): Change the test for a legel expression difference to + (macro): Change the test for a legal expression difference to correspond to changes in pseudo_set in read.c. Fri Dec 9 21:04:17 1994 Ken Raeburn @@ -13115,3 +13115,10 @@ Mon Feb 17 07:51:06 1992 K. Richard Pixley (rich at cygnus.com) * nearly everything. flush ChangeLog, package as gas-1.92.1. ChangeLog's prior to this are sketchy at best. I have logs. They just aren't ChangeLogs. + +Local Variables: +mode: change-log +left-margin: 8 +fill-column: 74 +version-control: never +End: diff --git a/contrib/binutils/gas/ChangeLog-9697 b/contrib/binutils/gas/ChangeLog-9697 index 7ffff3e6652..f39e99554e8 100644 --- a/contrib/binutils/gas/ChangeLog-9697 +++ b/contrib/binutils/gas/ChangeLog-9697 @@ -4,7 +4,7 @@ Wed Dec 31 12:29:47 1997 Jeffrey A Law (law@cygnus.com) Mon Dec 22 13:06:05 1997 Joel Sherrill - * configure.in (i386*-go32-rtems*): Fix to be the same as + * configure.in (i386*-go32-rtems*): Fix to be the same as i[3456]86-go32. * configure: Rebuild. @@ -96,7 +96,7 @@ Mon Dec 15 15:20:32 1997 Nick Clifton * doc/as.texinfo: Add documentation of m32r processor. - * doc/c-m32r.texi: New file, documenting m32r specific features. + * doc/c-m32r.texi: New file, documenting m32r specific features. Mon Dec 15 10:32:28 1997 Jeffrey A Law (law@cygnus.com) @@ -151,7 +151,7 @@ Sat Nov 22 16:19:22 1997 Richard Henderson Sat Nov 22 14:26:09 1997 Nick Clifton * config/tc-arm.c: Brought up to date with latest changes on arm - branch. + branch. Sat Nov 22 15:50:09 1997 Klaus Kaempf @@ -171,7 +171,7 @@ Thu Nov 20 15:06:08 1997 Richard Earnshaw Wed Nov 19 17:44:42 1997 Richard Henderson - * config/tc-sh.c (parse_reg): Properly quote for fv4. + * config/tc-sh.c (parse_reg): Properly quote for fv4. Wed Nov 19 23:46:18 1997 Ian Lance Taylor @@ -180,7 +180,7 @@ Wed Nov 19 23:46:18 1997 Ian Lance Taylor Tue Nov 18 18:45:14 1997 J"orn Rennecke - * config/tc-d10v.c (parallel_ok, find_opcode): + * config/tc-d10v.c (parallel_ok, find_opcode): Split OPERAND_FLAG into OPERAND_FFLAG and OPERAND_CFLAG. Sun Nov 16 10:05:07 1997 Fred Fish @@ -191,9 +191,9 @@ Sun Nov 16 10:05:07 1997 Fred Fish Thu Nov 13 13:53:10 1997 Andrew Cagney * configure.in (emulations): Make FreeBSD an aout / i386bsd - variant. + variant. * configure: Re-generate. - + Thu Nov 13 11:07:14 1997 Gavin Koch * config/tc-mips.c (macro_build): Use the membership field @@ -255,35 +255,35 @@ Tue Nov 4 16:35:57 1997 Ian Dall * write.c (print_fixup): Use TC_FIX_DATA_PRINT (if defined) to print out MD fields of fix. * frags.c (frag_var, frag_variant): Use TC_FRAG_INIT macro (if - defined) to initialize MD fields in frag. + defined) to initialize MD fields in frag. * as.h (struct frag, ns32k support): Rename ns32k to fr_ns32k. Delete pcrel_adjust. Add fr_opcode_fragP, fr_opcode_offset. * config/tc-ns32k.h: Add comments. Remove obsolete - BFD_FAST_SECTION_FILL definition, change prototypes for - fix_new_ns32k and fix_new_ns32k_exp to add new arguments - opcode_frag and opcode_offset and remove pcrel_adjust. + BFD_FAST_SECTION_FILL definition, change prototypes for + fix_new_ns32k and fix_new_ns32k_exp to add new arguments + opcode_frag and opcode_offset and remove pcrel_adjust. (TC_FIX_TYPE): add opcode_fragP and opcode_offset fields. (TC_FIX_DATA_PRINT): new macro to print out TC_FIX_TYPE. (TC_FRAG_INIT): new macro to initialize machine dependent field in - frags. + frags. (frag_opcode_frag, frag_opcode_offset, frag_bsr): macros to access - MD fields in frag structure. + MD fields in frag structure. (fix_im_disp, fix_bit_fixP, fix_opcode_frag, fix_opcode_offset, - fix_bsr): macros to access MD fields in fix structure. + fix_bsr): macros to access MD fields in fix structure. * config/tc-ns32k.c: Avoid overlength lines. Align comments. Don't - use struct opcode_location as these fields are now in the frag + use struct opcode_location as these fields are now in the frag structure. (convert_iif): Call frag_more as it is needed instead - of trying to allocate for the whole insn. Avoid call of frag_more - with negative argument. + of trying to allocate for the whole insn. Avoid call of frag_more + with negative argument. (md_pcrel_adjust, md_fix_pcrel_adjust, md_apply_fix, md_estimate_size_before_relax, md_pcrel_from, tc_aout_fix_to_chars): use accessor macros to get md fields in fix - and frag structures. + and frag structures. (fix_new_ns32k, fix_new_ns32k_exp): add new arguments opcode_frag and opcode_offset and remove pcrel_adjust. (convert_iif, cons_fix_new_ns32k): call fix_new_ns32k, - fix_new_ns32k_exp with changed arguments. + fix_new_ns32k_exp with changed arguments. Mon Nov 3 13:30:17 1997 Gavin Koch @@ -429,8 +429,8 @@ Tue Oct 14 19:12:45 1997 Richard Henderson Fri Oct 10 16:09:35 1997 Andrew Cagney * config/tc-d10v.c (parallel_ok): Allow parallel instruction issue - when second instruction is writing to first instructions inputs. - + when second instruction is writing to first instructions inputs. + Mon Oct 13 15:27:17 1997 Richard Henderson * ecoff.c (PAGE_SIZE): Double to 8k as a hack to allow some C++ @@ -439,7 +439,7 @@ Mon Oct 13 15:27:17 1997 Richard Henderson Fri Oct 10 17:48:29 1997 Nick Clifton * config/tc-v850.c (md_relax_table): Add support for relaxing - unconditional branches. This patch is courtesy of Jim Wilson. + unconditional branches. This patch is courtesy of Jim Wilson. (md_convert_frag): Fix relaxing of branches. This patch is courtesy of Jim Wilson. (md_assemble): Create different fixups for conditional and @@ -449,7 +449,7 @@ Fri Oct 10 17:48:29 1997 Nick Clifton branch. This patch is courtesy of Jim Wilson. (v850_sdata, v850_tdata, v850_zdata, v850_sbss, v850_tbss, v850_zbss, v850_rosdata, v850_rozdata, v850_bss): Add call to - obj_elf_section_change_hook(). + obj_elf_section_change_hook(). (v850_comm): New function. (md_pseudo_table): Add new pseudo ops .zcomm, .scomm and .tcomm. (md_begin): Add bss flag to seg_info of bss sections. @@ -472,7 +472,7 @@ Fri Oct 10 11:22:45 1997 Martin M. Hunt Fri Oct 10 11:54:50 1997 Andrew Cagney * config/tc-d10v.c (parallel_ok): Flag SP as modified for @-sp - operand - OPERAND_ATMINUS. + operand - OPERAND_ATMINUS. Fri Oct 10 00:47:44 1997 Michael Meissner @@ -532,7 +532,7 @@ Wed Oct 8 00:04:05 1997 Gavin Koch * config/tc-mips.c (md_begin): Replace the TARGET_CPU value of mipsr3900 with mipstx39. - * config/tc-mips.c (mips_ip): Don't print the 'opcode requires + * config/tc-mips.c (mips_ip): Don't print the 'opcode requires -mipsXX message' if the insn isn't an ISA insn. Tue Oct 7 12:48:30 1997 Doug Evans @@ -580,7 +580,7 @@ Thu Sep 25 13:08:02 1997 Ian Lance Taylor Wed Sep 24 16:54:40 1997 Joel Sherrill - * configure.in (sh*-*-rtems*): New target, like sh-*-elf*. + * configure.in (sh*-*-rtems*): New target, like sh-*-elf*. * configure: Rebuild. Wed Sep 24 11:30:25 1997 Ian Lance Taylor @@ -624,7 +624,7 @@ Thu Sep 18 14:11:56 1997 Nick Clifton (md_assemble): Produce error message when special data area relocations are used on instructions which do not support them. (md_assemble): Reset processor mask if defined by command line - switch. + switch. Thu Sep 18 11:24:01 1997 Doug Evans @@ -653,13 +653,13 @@ Thu Sep 18 11:24:01 1997 Doug Evans Wed Sep 17 16:54:20 1997 Nick Clifton * config/tc-v850.c (v850_reloc_prefix): Recoded to use CHECK_ () - macro. + macro. (handle_tdaoff, handle_zdaoff, handle_sdaoff): New functions. * config/tc-v850.c (md_assemble): Corrected typo. * config/tc-v850.c Add new sections: call_table_data and call_table_text. - (v850_reloc_prefix): Add support for ctoff() relocation prefix. + (v850_reloc_prefix): Add support for ctoff() relocation prefix. (handle_ctoff): New Function. * doc/c-v850.texi (V850 Opcodes): Document call table relocations. @@ -679,7 +679,7 @@ Mon Sep 15 18:33:06 1997 Nick Clifton * config/tc-v850.c (processor_mask): New variable. (set_machine, md_parse_option): Set processor_mask. (md_assemble): Check that instruction is available to target - processor. + processor. * config/tc-v850.h (TARGET_PROCESSOR): New constant. @@ -768,7 +768,7 @@ Tue Sep 9 10:19:37 1997 Nick Clifton * config/tc-v850.c (.v850): New pseudo op. * config/tc-v850.c (.v850e): New pseudo op. * config/tc-v850.c (.v850ea): New pseudo op. - + Mon Sep 8 23:08:04 1997 Ian Lance Taylor @@ -791,7 +791,7 @@ Mon Sep 8 12:33:40 1997 Nick Clifton * config/tc-v850.h (TARGET_MACHINE): New constant. * config/tc-v850.c (v850_insert_operand): Add - -mwarn_unsigned_overflow. + -mwarn_unsigned_overflow. (md_begin): Set BFD machine number based on machine variable. (md_parse_option): Add -mv850, -mv850e and -mv850ea options. @@ -802,15 +802,15 @@ Mon Sep 8 11:20:46 1997 Ian Lance Taylor Sun Sep 7 00:30:19 1997 Richard Henderson - * config/tc-alpha.c (md_parse_option): Move m[] out to top level and - rename to cpu_types[]. - (s_alpha_arch): New function. - (md_pseudo_table): Add "arch". + * config/tc-alpha.c (md_parse_option): Move m[] out to top level and + rename to cpu_types[]. + (s_alpha_arch): New function. + (md_pseudo_table): Add "arch". - * config/tc-alpha.c (md_begin): Merge the two loops through the - opcode table. - (s_alpha_proc): Add initial SKIP_WHITESPACE. - (s_alpha_set): Likewise. Use get_symbol_end instead local while loop. + * config/tc-alpha.c (md_begin): Merge the two loops through the + opcode table. + (s_alpha_proc): Add initial SKIP_WHITESPACE. + (s_alpha_set): Likewise. Use get_symbol_end instead local while loop. Sat Sep 6 19:38:12 1997 Fred Fish @@ -827,14 +827,14 @@ Wed Sep 3 11:21:33 1997 Nick Clifton Tue Sep 2 18:32:30 1997 Jeffrey A Law (law@cygnus.com) - * config/tc-mn10200.c (md_convert_frag): PC relative instructions arex + * config/tc-mn10200.c (md_convert_frag): PC relative instructions arex relative to the next instruction, not the current instruction. (md_assemble): Similarly. Tue Sep 2 15:58:52 1997 Nick Clifton * doc/c-v850.texi: Explanations of offsets in SDA/ZDA areas - correcetd. + correcetd. * config/tc-v850.c: Add support for SDA/TDA/ZDA sections. (v850_reloc_prefix): Duplicate code eliminated. Add code to @@ -842,12 +842,12 @@ Tue Sep 2 15:58:52 1997 Nick Clifton (md_assemble): Calculation of the size of a fixups corrected. * config/tc-v850.h (ELF_TC_SPECIAL_SECTIONS): Add SDA/TDA/ZDA - sections. + sections. Tue Sep 2 15:40:56 1997 Andrew Cagney * config/tc-v850.c (md_assemble): Use opcode->name instead of - opcode->opcode as the sentinal. Zero is a valid opcode. + opcode->opcode as the sentinal. Zero is a valid opcode. Tue Aug 26 16:51:14 1997 Ian Lance Taylor @@ -857,7 +857,7 @@ Tue Aug 26 16:51:14 1997 Ian Lance Taylor Tue Aug 26 09:46:22 1997 Nick Clifton * doc/c-v850.texi (V850 Opcodes): Correct name for tiny data area - pointer. + pointer. Tue Aug 26 12:23:25 1997 Ian Lance Taylor @@ -898,15 +898,15 @@ Mon Aug 25 14:25:48 1997 Ian Lance Taylor Mon Aug 25 11:21:48 1997 Nick Clifton * config/tc-v850.c (md_assemble): Restore input_line_pointer upon - exit. - + exit. + * config/tc-v850.c (parse_register_list): Support constant expressions as register lists. Mon Aug 25 10:19:34 1997 Nick Clifton * doc/c-v850.texi: Change the major node to v850 Machine - Dependencies. + Dependencies. Fri Aug 22 11:16:14 1997 Nick Clifton @@ -993,8 +993,8 @@ Mon Aug 18 11:26:36 1997 Nick Clifton Mon Aug 18 11:24:21 1997 Nick Clifton * config/tc-v850.c: Remove support_v850e flag and command line - option. - + option. + * configure.in (emulations): Add support for v850e target * configure (emulations): Add support for v850e target @@ -1002,8 +1002,8 @@ Mon Aug 18 11:24:21 1997 Nick Clifton Mon Aug 18 11:24:21 1997 Nick Clifton * config/tc-v850.c: Remove support_v850ea flag and command line - option. - + option. + * configure.in (emulations): Add support for v850ea target * configure (emulations): Add support for v850ea target @@ -1045,9 +1045,9 @@ Wed Aug 13 18:58:56 1997 Nick Clifton * config/tc-v850.c (md_assemble, md_show_usage, md_parse_option): Add support for v850e instructions. - + * config/tc-v850.c (md_assemble): Fix error recovery to reload - text of entire opcode. + text of entire opcode. Tue Aug 12 10:27:34 1997 Richard Henderson @@ -1066,7 +1066,7 @@ Mon Aug 11 21:48:00 1997 Richard Henderson functions. * read.h: Update prototypes. * symbols.c (resolve_symbol_value): Streamline quite a bit. Return - the symbol value, add a second FINALIZE argument that prevents + the symbol value, add a second FINALIZE argument that prevents changes from being comitted. Update all callers. * write.c (cvt_frag_to_fill, relax_segment): Handle rs_leb128. * doc/as.texinfo: Document the new pseudos. @@ -1137,9 +1137,9 @@ Mon Aug 4 11:28:35 1997 Ian Lance Taylor has an associated external symbol. Sun Aug 3 23:23:59 1997 Richard Henderson - - * config/tc-alpha.c (s_alpha_ucons): New function. - (md_pseudo_table): Add unaligned data pseudos for DWARF. + + * config/tc-alpha.c (s_alpha_ucons): New function. + (md_pseudo_table): Add unaligned data pseudos for DWARF. Thu Jul 31 15:13:43 1997 Jeffrey A Law (law@cygnus.com) @@ -1158,10 +1158,10 @@ Tue Jul 29 14:20:43 1997 Jeffrey A Law (law@cygnus.com) Mon Jul 28 18:41:41 1997 Rob Savoye - * configure.in: Use CYGWIN and EXEEXT autoconf macro to look for - win32 dependencies. - * configure: Regenerated with autoconf 2.12. - * Makefile.in: Add $(EXEEXT) to all executables. + * configure.in: Use CYGWIN and EXEEXT autoconf macro to look for + win32 dependencies. + * configure: Regenerated with autoconf 2.12. + * Makefile.in: Add $(EXEEXT) to all executables. Fri Jul 25 10:54:43 1997 Jeffrey A Law (law@cygnus.com) @@ -1182,9 +1182,9 @@ Thu Jul 24 17:51:29 1997 Ian Lance Taylor Thu Jul 24 12:13:19 1997 Fred Fish * config/tc-tic80.c (build_insn): Remove "extended" and replace with - "fx" and "fxfrag". Add "ffrag". Change code to initialize and use + "fx" and "fxfrag". Add "ffrag". Change code to initialize and use the right f/ffrag and fx/fxfrag pairs since instruction may be split - across frags. + across frags. Tue Jul 22 18:38:56 1997 Robert Hoehne @@ -1244,7 +1244,7 @@ Mon Jul 7 22:53:08 1997 Ian Lance Taylor BFD_ASSEMBLER, handle one ELF case for COFF as well, and add a PE case. * write.c (fixup_segment): Change special case for i386-coff to - not apply for i386-pe. + not apply for i386-pe. * config/obj-coff.c (coff_adjust_section_syms): Only count fixups which were not done. (coff_frob_file_after_relocs): Rename from coff_frob_file. @@ -1401,14 +1401,14 @@ Wed May 28 15:45:07 1997 Nick Clifton * config/tc-arm.c (md_begin): Change call to coff_arm_bfd_set_private_flags() to a call to - bfd_set_private_flags(). + bfd_set_private_flags(). Wed May 28 16:17:34 1997 Ian Lance Taylor * Makefile.in: Rebuild dependencies. * config/tc-i386.c (tc_gen_reloc): Don't try to convert the type - of a BFD_RELOC_RVA reloc. + of a BFD_RELOC_RVA reloc. Wed May 28 10:48:14 1997 Jeffrey A Law (law@cygnus.com) @@ -1456,11 +1456,11 @@ Wed May 14 09:54:53 1997 Nick Clifton * config/tc-arm.c (global variables): Added 'uses_apcs_26' flag to hold APCS selection. - (md_begin): Added code to generate flags to be set into the COFF + (md_begin): Added code to generate flags to be set into the COFF header and the calls to the BFD functions to do this. - (md_parse_option, md_show_usage): Added new command line + (md_parse_option, md_show_usage): Added new command line options -mapcs-32, -mapcs-26, -marmv2, -marmv2a, -marmv3, - -marmv3m, -marmv4, -marmv4t. + -marmv3m, -marmv4, -marmv4t. * config/tc-arm.h (LOCAL_LABEL): Removed the definition of this macro as it is never used. @@ -1493,7 +1493,7 @@ Thu May 8 11:10:15 1997 Ian Lance Taylor Wed May 7 15:39:48 1997 Ian Lance Taylor * config/obj-coff.c (write_object_file): Just pass NULL to - md_do_align, not the address of a char holding NOP_OPCODE. + md_do_align, not the address of a char holding NOP_OPCODE. * config/tc-mips.c (macro): Handle constants for M_LI_D and M_LI_DD. @@ -1540,7 +1540,7 @@ Tue Apr 29 20:23:10 1997 Jim Wilson Tue Apr 29 19:54:36 1997 Richard Henderson * config/obj-elf.c (elf_pseudo_table): Add "subsection". - (obj_elf_subsection): New static function. + (obj_elf_subsection): New static function. Tue Apr 29 19:52:47 1997 Ian Lance Taylor @@ -1606,7 +1606,7 @@ Tue Apr 15 18:11:44 1997 Gavin Koch Tue Apr 15 13:04:47 1997 Ian Lance Taylor * Makefile.in (srcroot): Remove. - (INSTALL): Set to @INSTALL@. + (INSTALL): Set to @INSTALL@. (INSTALL_XFORM, INSTALL_XFORM1): Remove. (all, dvi): Don't set srcroot. (install): Depend upon as.new, gasp.new, and installdirs. Use @@ -1660,7 +1660,7 @@ Mon Apr 7 14:58:22 1997 Jeffrey A Law (law@cygnus.com) Mon Apr 7 10:54:59 1997 Doug Evans * Makefile.in: Regenerate dependencies. - (TARG_CPU): New variable. + (TARG_CPU): New variable. (cgen.o): Depend on cgen.h, $(TARG_CPU)-opc.h. (.dep1): Delete creating of cgen-opc.h. (.tcdep): Put proper contents in cgen-opc.h. @@ -1761,7 +1761,7 @@ Mon Mar 31 23:53:44 1997 H.J. Lu Mon Mar 31 16:31:04 1997 Joel Sherrill - * configure.in (hppa*-*-rtems*): New target, like hppa-*-*elf*. + * configure.in (hppa*-*-rtems*): New target, like hppa-*-*elf*. * configure: Rebuild. Mon Mar 31 14:15:19 1997 Ian Lance Taylor @@ -1879,7 +1879,7 @@ Mon Mar 24 12:11:18 1997 Ian Lance Taylor (alpha_frob_file_before_adjust): Declare if OBJ_ECOFF. * config/tc-alpha.c (alpha_debug): New static variable. (md_parse_option): Set alpha_debug if -g is seen. - (alpha_frob_file_before_adjust): New function if OBJ_ECOFF. + (alpha_frob_file_before_adjust): New function if OBJ_ECOFF. Sun Mar 23 18:03:31 1997 Martin M. Hunt @@ -2030,7 +2030,7 @@ Sat Mar 15 20:27:12 1997 Fred Fish * NEWS: Note BeOS support. * configure.in: (ppc-*-beos): New target, use coff as object format. * configure: Regenerate with autoconf. - + Sat Mar 15 19:14:02 1997 Ian Lance Taylor * config/tc-mips.c (md_apply_fix): Improve error message for out @@ -2290,23 +2290,23 @@ Mon Feb 24 18:27:43 1997 Eric Youngdale Mon Feb 24 15:19:57 1997 Martin M. Hunt - * config/tc-d10v.c: Change pre_defined_registers to + * config/tc-d10v.c: Change pre_defined_registers to d10v_predefined_registers and reg_name_cnt to d10v_reg_name_cnt. Mon Feb 24 10:40:45 1997 Fred Fish * config/obj-coff.c: Fix typo in comment section. * config/tc-tic80.c (md_pseudo_table): Add entry for bss, which takes - an additional alignment argument. + an additional alignment argument. (find_opcode): Allow O_symbol relocs for any 32 bit field, not just - base relative ones. + base relative ones. (build_insn): Handle O_symbol relocs for any 32 bit field, not just - base relative ones. + base relative ones. Mon Feb 24 02:23:00 1997 Dawn Perchik * Makefile.in: Remove dependancies on itbl-cpu.h. - * as.c: Define stubs for itbl_parse and itbl_init if HAVE_ITBL_CPU + * as.c: Define stubs for itbl_parse and itbl_init if HAVE_ITBL_CPU is not defined. Mon Feb 24 02:03:00 1997 Dawn Perchik @@ -2354,10 +2354,10 @@ Sat Feb 22 21:25:00 1997 Dawn Perchik * as.c: Add itbl support. Add new option "--insttbl" for dynamically extending instruction set. * as.h: Declare insttbl_file_name; - the name of file defining extensions to the basic instruction set - * configure.in, configure: Add itbl-parse.o, itbl-lex.o, and + the name of file defining extensions to the basic instruction set + * configure.in, configure: Add itbl-parse.o, itbl-lex.o, and itbl-ops.o to extra_objects for mips configuration. - Add include file link from itbl-cpu.h to + Add include file link from itbl-cpu.h to config/itbl-${target_cpu_type}.h. * config/tc-mips.c: Allow copz instructions. Add notes for future additions to the itbl support. @@ -2372,18 +2372,18 @@ Sat Feb 22 20:53:01 1997 Fred Fish * config/tc-tic80.c (find_opcode): Add code to support O_symbol operands. (build_insn): Grab a frag early so we can use the address in - fixups. Take one's complement of BITNUM values before insertion - in opcode. Add code to support O_symbol operands. + fixups. Take one's complement of BITNUM values before insertion + in opcode. Add code to support O_symbol operands. (md_apply_fix): Replace unimplemented warning with implementation. (md_pcrel_from): Ditto. (tc_coff_fix2rtype): Ditto. Fri Feb 21 14:34:31 1997 Martin M. Hunt - * config/tc-d30v.c (parallel_ok): New function. + * config/tc-d30v.c (parallel_ok): New function. * config/tc-d30v.h: Define TARGET_BYTES_BIG_ENDIAN. * config/tc-d10v.c (md_pcrel_from_section): Return 0 if - relocation is in different section. + relocation is in different section. Fri Feb 21 10:08:25 1997 Jim Wilson @@ -2397,7 +2397,7 @@ Fri Feb 21 11:55:03 1997 Ian Lance Taylor * app.c (LEX_IS_TWOCHAR_COMMENT_2ND): Don't define. (do_scrub_begin): Don't set lex['*']. (do_scrub_chars): When handling LEX_IS_TWOCHAR_COMMENT_1ST, don't - check for LEX_IS_TWOCHAR_COMMENT_2ND. Instead, just check for + check for LEX_IS_TWOCHAR_COMMENT_2ND. Instead, just check for a literal '*'. * configure.in: Set em=svr4 for m68k-*-sysv4*. @@ -2439,24 +2439,24 @@ Tue Feb 18 18:42:51 1997 Martin M. Hunt * config/tc-d30v.c, config/tc-d30v.h: New files. - * configure: Rebuilt. - + * configure: Rebuilt. + * configure.in: Add case for d30v. Sun Feb 16 17:47:29 1997 Fred Fish * config/tc-alpha.h (md_operand): Define with a null expansion, like all the other targets. - * doc/internals.texi (CPU backend): Add missing word in + * doc/internals.texi (CPU backend): Add missing word in md_flush_pending_output description. Fix typo in md_convert_frag description. * config/tc-tic80: Minor comment additions/changes. - + Fri Feb 14 18:09:59 1997 Philippe De Muyter * config/tc-m68k.c (LOCAL_LABEL): Macro redefined if TE_DELTA. (tc_canonicalize_symbol_name): Macro defined if TE_DELTA. - * config/obj-coff.c (obj_coff_def): Use + * config/obj-coff.c (obj_coff_def): Use tc_canonicalize_symbol_name if defined. (obj_coff_tag, obj_coff_val): Likewise. * expr.c (operand): Reject '~' as operator if is_name_beginner. @@ -2503,7 +2503,7 @@ Thu Feb 13 20:02:16 1997 Fred Fish tc-mn10200.h, tc-mn10300.h, tc-sh.h, tc-vax.h, tc-w65.h}: Add default definition of zero for TARGET_BYTES_BIG_ENDIAN. * config/{tc-arm.h, tc-hppa.h, tc-i386.h, tc-mips.h, tc-ns32k.h, - tc-ppc.h, tc-sparc.h}: Move definition of TARGET_BYTES_BIG_ENDIAN + tc-ppc.h, tc-sparc.h}: Move definition of TARGET_BYTES_BIG_ENDIAN to a location consistent with the rest of the target include files. * config/tc-i386.c: Remove misleading comment. * doc/internals.texi (CPU backend): Add description of function @@ -2513,7 +2513,7 @@ Thu Feb 13 20:02:16 1997 Fred Fish Remove custom code that use to parse them. * config/tc-tic80.h: Move definition of TARGET_BYTES_BIG_ENDIAN to a location consistent with the rest of the target include files. - + Thu Feb 13 21:44:18 1997 Klaus Kaempf * as.h: GNU c provides unlink() function. @@ -2541,7 +2541,7 @@ Thu Feb 13 16:29:04 1997 Fred Fish (DVIPS): Set to dvips. (ps, as.ps, gasp.ps): New targets. (internals.info, gasp.dvi, internals.dvi): Set both TEXINPUTS - and MAKEINFO env variables. + and MAKEINFO env variables. (internals.ps): Use DVIPS macro. (clean): Remove core and backup files. (distclean): Remove temporary files from building internals. @@ -2623,7 +2623,7 @@ Wed Feb 12 14:36:29 1997 Ian Lance Taylor symbol. * config/tc-mips.c (append_insn): Warn about an attempt to put an - extended instruction in a delay slot when not reordering. + extended instruction in a delay slot when not reordering. (md_convert_frag): Warn if an extended instruction appears in a delay slot. @@ -2659,11 +2659,11 @@ Mon Feb 10 22:06:00 1997 Dawn Perchik (dawn@cygnus.com) Mon Feb 10 18:09:00 1997 Dawn Perchik (dawn@cygnus.com) - * itbl-ops.c: New file. Add support for dynamically read - instruction registers, opcodes and formats. Build internal table - for new instructions and provide callbacks for assembler and + * itbl-ops.c: New file. Add support for dynamically read + instruction registers, opcodes and formats. Build internal table + for new instructions and provide callbacks for assembler and disassembler. - * itbl-lex.l, itbl-parse.y: Lex and yacc parsers for instruction + * itbl-lex.l, itbl-parse.y: Lex and yacc parsers for instruction spec table. * itbl-ops.h: New file. Header file for itbl support. * config/itbl-mips.h: New file. Mips specific definitions for @@ -2736,7 +2736,7 @@ Fri Jan 31 10:46:14 1997 Ian Lance Taylor enforce-aligned-data. * config/tc-ppc.c (md_pseudo_table): If OBJ_XCOFF, add "long", - "word", and "short". + "word", and "short". (ppc_xcoff_cons): New static function. * write.c (relax_segment): Give an error if a .space symbol is @@ -2816,14 +2816,14 @@ Wed Jan 22 10:39:39 1997 Doug Evans Mon Jan 20 10:56:47 1997 Andreas Schwab * config/tc-m68k.c (m68k_ip): Reject pc-relative addresses for the - 'p' operand specifier. + 'p' operand specifier. Mon Jan 20 10:39:36 1997 J.T. Conklin * config/tc-m68k.c (HAVE_LONG_BRANCH): New macro, returns true for - m68k family cpus which support long branch addressing modes. + m68k family cpus which support long branch addressing modes. (m68k_ip, md_convert_frag_1, md_estimate_size_before_relax, - md_create_long_jump): Use it. + md_create_long_jump): Use it. Mon Jan 20 12:42:06 1997 Ian Lance Taylor @@ -2981,8 +2981,8 @@ Thu Jan 2 13:37:29 1997 Ian Lance Taylor work if valueT is only 32 bits. * config/tc-mips.c: Throughout, check target_big_endian rather - than byte_order. - (byte_order): Remove. + than byte_order. + (byte_order): Remove. (mips_init_after_args): Remove. * config/tc-mips.h (LITTLE_ENDIAN, BIG_ENDIAN): Don't define. (mips_init_after_args): Don't declare. @@ -3008,9 +3008,9 @@ Tue Dec 31 12:56:41 1996 Ian Lance Taylor * Makefile.in (ALL_CFLAGS): Add -D_GNU_SOURCE. * config/tc-sparc.c (md_apply_fix3): Rename from md_apply_fix, and - add segment argument. If OBJ_ELF, treat a relocation against a - symbol in a linkonce section like a relocation against an external - symbol. + add segment argument. If OBJ_ELF, treat a relocation against a + symbol in a linkonce section like a relocation against an external + symbol. * config/tc-sparc.h (MD_APPLY_FIX3): Define. Mon Dec 30 11:35:40 1996 Ian Lance Taylor @@ -3023,14 +3023,14 @@ Fri Dec 27 22:51:51 1996 Fred Fish includes config.h instead of host.h, tc.h instead of tp.h, and targ-env.h instead of target-environment.h. Also, obj-format.h includes targ-cpu.h instead of - target-processor.h. + target-processor.h. * configure.in (case ${generic_target}): Add tic80-*-coff entry. * configure: Rebuild with autoconf. * config/obj-coff.h (coff/tic80.h): Include if TC_TIC80 defined. (TARGET_FORMAT): Define to "coff-tic80". * config/tc-tic80.c: New file for TIc80 support. * config/tc-tic80.h: New file for TIc80 support. - + Fri Dec 27 11:42:29 1996 Ian Lance Taylor * doc/as.texinfo (M): Mention explicitly that -M changes macro @@ -3065,7 +3065,7 @@ Wed Dec 18 10:08:46 1996 Jeffrey A Law (law@cygnus.com) Tue Dec 17 10:59:32 1996 Ian Lance Taylor * config/tc-mips.c: Undo part of last Friday's alignment changes. - (md_begin): Always align the text section to a four byte + (md_begin): Always align the text section to a four byte boundary. (append_insn): Remove call to record_align. @@ -3233,7 +3233,7 @@ Fri Dec 6 00:55:48 1996 Martin (d10v_cleanup): No longer uses its argument, so make it void. * config/tc-d10v.h (d10v_cleanup): Change prototype. - + Thu Dec 5 11:03:31 1996 Ian Lance Taylor * write.c (fixup_segment): Don't discard the symbol for a PC @@ -3325,7 +3325,7 @@ Tue Nov 26 10:33:16 1996 Ian Lance Taylor Mon Nov 25 18:02:29 1996 J.T. Conklin * config/tc-m68k.c (m68k_ip): Implement cases for new <, >, m, n, - o and p operand specifiers. + o and p operand specifiers. Mon Nov 25 10:45:14 1996 Doug Evans @@ -3359,7 +3359,7 @@ Fri Nov 22 15:42:26 1996 Ian Lance Taylor Thu Nov 21 11:56:11 1996 Jeffrey A Law (law@cygnus.com) * config/tc-mn10300.h (DIFF_EXPR_OK): Don't define this. - (tc_fix_adjustable): Don't adjust relocs against weak symbols or + (tc_fix_adjustable): Don't adjust relocs against weak symbols or pc-relative relocs. * config/tc-mn10300.c (md_begin): Set linkrelax. (md_assemble): Create fixups as needed. @@ -3399,7 +3399,7 @@ Fri Nov 8 13:55:03 1996 Martin M. Hunt * doc/c-d10v.texi: Add info on @word modifier. Wed Nov 6 13:46:07 1996 Jeffrey A Law (law@cygnus.com) - + * config/tc-mn10300.c (mn10300_insert_operand): MN10300_OPERAND_SPLIT operands are assumed to be 32bits. Use "bits" field to hold the number of bits in the main instruction word for MN10300_OPERAND_SPLIT. @@ -3556,8 +3556,8 @@ Mon Oct 21 11:38:30 1996 Ian Lance Taylor (tc_gen_reloc): Handle BFD_RELOC_64. * config/tc-i386.c (md_apply_fix3): Don't increment value for a PC - relative reloc when BFD_ASSEMBLER and OBJ_AOUT (more ugly gas - reloc hacking). + relative reloc when BFD_ASSEMBLER and OBJ_AOUT (more ugly gas + reloc hacking). * config/obj-aout.h (S_IS_DEFINE): non BFD_ASSEMBLER version: Don't check S_GET_OTHER. @@ -3744,7 +3744,7 @@ Tue Oct 1 12:37:48 1996 Ian Lance Taylor register numbers. From Ken Rose . * config/tc-alpha.c: Add some static function prototypes. - (alpha_macros): Move to top of file. Make static. + (alpha_macros): Move to top of file. Make static. (alpha_num_macros): Move to top of file. Tue Oct 1 09:36:19 1996 Stu Grossman (grossman@critters.cygnus.com) @@ -3768,7 +3768,7 @@ Tue Sep 24 19:05:08 1996 Ian Lance Taylor Tue Sep 24 12:22:18 1996 Martin M. Hunt - * config/tc-d10v.c (md_operand): Created. Allows operands to + * config/tc-d10v.c (md_operand): Created. Allows operands to start with '#'. * config/tc-d10v.h (md_operand): Undefined. @@ -3795,10 +3795,10 @@ Mon Sep 16 11:41:40 1996 Ian Lance Taylor Thu Sep 12 10:25:45 1996 James G. Smith * config/tc-arm.c (md_apply_fix3): Update two thumb instruction - slots when processing BL fixups. + slots when processing BL fixups. * config/tc-arm.c (output_inst): Ensure Thumb BL fixup is marked - on the first half of the instruction. + on the first half of the instruction. Wed Sep 11 00:09:35 1996 Ian Lance Taylor @@ -3828,11 +3828,11 @@ Mon Sep 9 10:57:42 1996 Ian Lance Taylor Sat Sep 7 13:25:55 1996 James G. Smith * config/tc-mips.c (COUNT_TOP_ZEROES): Added macro to count - leading zeroes. + leading zeroes. (load_register): Ensure hi32 bits are not lost during lo32bit - processing. Fix shift offset that was overflowing into the next - instruction field. Add code to generate shorter sequences for - constants with a single contiguous seqeuence of ones. + processing. Fix shift offset that was overflowing into the next + instruction field. Add code to generate shorter sequences for + constants with a single contiguous seqeuence of ones. Fri Sep 6 17:07:12 1996 Martin M. Hunt @@ -3882,8 +3882,8 @@ Wed Sep 4 10:23:20 1996 Ian Lance Taylor Wed Sep 4 11:24:29 1996 James G. Smith * config/tc-mips.c (load_register): Remove unnecessary code that - was causing the high 32bits of 64bit constants to be lost. - + was causing the high 32bits of 64bit constants to be lost. + Tue Sep 3 13:52:56 1996 Martin M. Hunt * config/tc-d10v.c: Added changes to support function @@ -3916,22 +3916,22 @@ Fri Aug 30 23:50:08 1996 Jeffrey A Law (law@cygnus.com) Fri Aug 30 18:35:26 1996 J.T. Conklin * config/tc-v850.c (reg_name_search): Align calling convention to - be like identical function found in tc-ppc.c. + be like identical function found in tc-ppc.c. (get_reloc): Removed. (v850_reloc_prefix): New function, parse lo(), hi() and hi0(). (md_assemble): emit fixups. (md_pcrel_from): renamed from md_pcrel_from_section, emit proper - displacement. + displacement. (md_apply_fix3): handle fixups/relocs. * config/tc-v850.h (MD_PCREL_FROM_SECTION): Removed definition. - + Fri Aug 30 18:12:00 1996 Ian Lance Taylor Add SH ELF support. * configure.in (sh-*-elf*): New target. * config/tc-sh.h (TARGET_ARCH): Define. (WORKING_DOT_WORD): Define. - (TC_COFF_FIX2RTYPE): Only define if OBJ_COFF. + (TC_COFF_FIX2RTYPE): Only define if OBJ_COFF. (BFD_ARCH, COFF_MAGIC, TC_COUNT_RELOC): Likewise. (TC_RELOC_MANGLE, tc_coff_symbol_emit_hook): Likewise. (DO_NOT_STRIP, NEED_FX_R_TYPE, TC_KEEP_FX_OFFSET): Likewise. @@ -3975,7 +3975,7 @@ Fri Aug 30 18:12:00 1996 Ian Lance Taylor Fri Aug 30 14:47:38 1996 Martin M. Hunt - * config/tc-d10v.c (find_opcode): Fix problem with calculating + * config/tc-d10v.c (find_opcode): Fix problem with calculating branch sizes in across sections. Fri Aug 30 00:44:13 1996 Jeffrey A Law (law@cygnus.com) @@ -4022,7 +4022,7 @@ Mon Aug 26 18:24:51 1996 Martin M. Hunt Mon Aug 26 13:39:27 1996 Martin M. Hunt - * config/tc-d10v.c (parallel_ok): Fix bug in parallel + * config/tc-d10v.c (parallel_ok): Fix bug in parallel checking code. Mon Aug 26 14:38:22 1996 Ian Lance Taylor @@ -4035,7 +4035,7 @@ Mon Aug 26 14:38:22 1996 Ian Lance Taylor Fri Aug 23 11:40:47 1996 Martin M. Hunt - * doc/c-d10v.texi: Fix typo. + * doc/c-d10v.texi: Fix typo. Fri Aug 23 10:41:32 1996 Jeffrey A Law (law@cygnus.com) @@ -4060,7 +4060,7 @@ Fri Aug 23 10:41:32 1996 Jeffrey A Law (law@cygnus.com) (system_register_name): New function. (SYSREG_NAME_CNT): Define. (md_assemble): Handle operands which are system registers. - + * config/tc-v850.c (md_assemble): If we find a register, but the opcode doesn't want a register, then we don't have a match. (md_assemble): Get size of the instruction from the opcode table. @@ -4077,16 +4077,16 @@ Thu Aug 22 10:20:30 1996 Ian Lance Taylor Thu Aug 22 10:50:00 1996 Martin M. Hunt - * config/tc-d10v.c: Fix a reloc bug caused by my last change. + * config/tc-d10v.c: Fix a reloc bug caused by my last change. * doc/c-d10v.texi: Cleanup. - + Tue Aug 20 15:15:16 1996 J.T. Conklin * config/tc-v850.c: New file. * config/tc-v850.h: New file. * configure (v850-*-elf): New target. * configure.in (v850-*-elf): New target. - + Wed Aug 21 15:50:54 1996 Martin M. Hunt * doc/c-d10v.texi: New file. @@ -4096,7 +4096,7 @@ Wed Aug 21 15:50:54 1996 Martin M. Hunt Tue Aug 20 14:10:02 1996 Martin M. Hunt * config/tc-d10v.c: All references to defined symbols should - now use the optimal instruction. .float and .double now work. + now use the optimal instruction. .float and .double now work. Mon Aug 19 14:41:36 1996 Ian Lance Taylor @@ -4111,13 +4111,13 @@ Thu Aug 15 16:37:59 1996 Stan Shebs Thu Aug 15 13:24:30 1996 Martin M. Hunt * config/tc-d10v.c: Add additional information to the opcode - table to help determinine which instructions can be done - in parallel. + table to help determinine which instructions can be done + in parallel. Thu Aug 15 17:01:31 1996 James G. Smith * config/tc-arm.c: Major changes to add Thumb support, with lots - of change input from . + of change input from . Reverted to INSN_SIZE macro, rather than insn_size variable. (insns): Added ARM "bx" instruction support. (tinsns): Added Thumb instruction definition structure. @@ -4128,21 +4128,21 @@ Thu Aug 15 17:01:31 1996 James G. Smith (do_ldst): Simpler halfword support. (do_ldmstm): Improved. (reg_list, do_bx, thumb_reg, thumb_add_sub, thumb_shift, - thumb_mov_compare, thumb_load_store, do_t_arit, do_t_add, - do_t_asr, do_t_branch, do_t_bx, do_t_compare, do_t_ldmstm, - do_t_ldrb, do_t_ldrh, do_t_lds, do_t_lsl, do_t_lsr, do_t_mov, - do_t_push_pop, do_t_str, do_t_strb, do_t_strh, do_t_sub, do_t_swi, - do_t_adr): Added. + thumb_mov_compare, thumb_load_store, do_t_arit, do_t_add, + do_t_asr, do_t_branch, do_t_bx, do_t_compare, do_t_ldmstm, + do_t_ldrb, do_t_ldrh, do_t_lds, do_t_lsl, do_t_lsr, do_t_mov, + do_t_push_pop, do_t_str, do_t_strb, do_t_strh, do_t_sub, do_t_swi, + do_t_adr): Added. (md_apply_fix3): Add support for BFD_RELOC_ARM_THUMB_* relocations. (md_parse_option): Add support for -mthumb. (md_show_usage): Updated to reflect new command line option. (arm_data_in_code, arm_canonicalize_symbol_name): Added. * config/tc-arm.h: Provide TC_FIX_TYPE to allow private ARM - fragment information to be held. + fragment information to be held. Thu Aug 15 16:12:00 1996 Richard Earnshaw (rearnsha@armltd.co.uk) - * config/tc-arm.c (md_apply_fix3): Also set fixP->fx_done if fx_addsy is + * config/tc-arm.c (md_apply_fix3): Also set fixP->fx_done if fx_addsy is non-null, but is a constant. (fix_new_arm): Call make_expr_symbol to make the expression symbol so that error reporting will work correctly. @@ -4165,7 +4165,7 @@ Mon Aug 12 16:49:43 1996 Ian Lance Taylor Fri Aug 9 17:48:28 1996 Martin M. Hunt - * config/tc-d10v.c: Fix problem with relocs. + * config/tc-d10v.c: Fix problem with relocs. Fri Aug 9 14:16:14 1996 Ian Lance Taylor @@ -4243,7 +4243,7 @@ Fri Aug 2 11:23:31 1996 Ian Lance Taylor Thu Aug 1 23:51:52 1996 Jeffrey A Law (law@cygnus.com) * config/tc-hppa.c: Revert yesterday's changes. - + Wed Jul 31 14:46:11 1996 Martin M. Hunt * config/tc-d10v.c: Disable range checking on 16-bit values. @@ -4260,22 +4260,22 @@ Wed Jul 31 11:45:15 1996 Martin M. Hunt Wed Jul 31 15:41:42 1996 James G. Smith * config/tc-arm.c: Changed INSN_SIZE to variable insn_size, as - pre-cursor to adding Thumb support. Also added cpu_variant flag - information to each of the asm_flg structures. + pre-cursor to adding Thumb support. Also added cpu_variant flag + information to each of the asm_flg structures. (md_parse_option): Updated ARM7 parsing to allow 't' for - thumb/halfword support, aswell as 'm' for long multiply. + thumb/halfword support, aswell as 'm' for long multiply. (md_show_usage): Updated help message. (md_assemble): Check that instruction flags are applicated to the - current cpu variant. + current cpu variant. (md_apply_fix3, tc_gen_reloc): Add BFD_RELOC_ARM_OFFSET_IMM8 and - BFD_RELOC_ARM_HWLITERAL relocation support for new halfword and - signextension instructions. + BFD_RELOC_ARM_HWLITERAL relocation support for new halfword and + signextension instructions. (do_ldst): Generate halfword and signextension variants if - mnemonic flags match. + mnemonic flags match. (ldst_extend): Do not allow shifts in the offset field of halfword - or signextension instructions. + or signextension instructions. (validate_offset_imm): Provide check on halfword and signextension - immediate range. + immediate range. (add_to_lit_pool): Merge identical literal pool values. Tue Jul 30 14:28:23 1996 Jeffrey A Law (law@cygnus.com) @@ -4298,7 +4298,7 @@ Fri Jul 26 11:43:03 1996 Martin M. Hunt * config/tc-d10v.c: Added lots of error checking. Added hacks to support accumulator shifts. - + Fri Jul 26 11:56:08 1996 Ian Lance Taylor * symbols.c (S_SET_EXTERNAL): Let .weak override. @@ -4315,8 +4315,8 @@ Thu Jul 25 12:03:33 1996 Martin M. Hunt * config/tc-d10v.c: Fix packaging bug. Added range checking. Added kludge for divs instruction. Fixed minor problem with multiple text sections. - * config/tc-d10v.h (d10v_cleanup): Change prototype. - + * config/tc-d10v.h (d10v_cleanup): Change prototype. + Tue Jul 23 10:49:36 1996 Martin M. Hunt * config/tc-d10v.c (md_apply_fix3): Fix all instruction @@ -4325,11 +4325,11 @@ Tue Jul 23 10:49:36 1996 Martin M. Hunt Mon Jul 22 11:32:36 1996 Martin M. Hunt * config/tc-d10v.c: Many changes to get relocs working. - (register_name): No longer creates a symbol for register names. - (pre_defined_registers): moved to opcodes/d10v-opc.c. + (register_name): No longer creates a symbol for register names. + (pre_defined_registers): moved to opcodes/d10v-opc.c. (d10v_insert_operand): Now works correctly for either container. - * config/tc-d10v.h (d10v_cleanup): Declare. - + * config/tc-d10v.h (d10v_cleanup): Declare. + Mon Jul 22 14:01:33 1996 Ian Lance Taylor * config/tc-mips.c (tc_gen_reloc): BFD_RELOC_PCREL_HI16_S and @@ -4396,7 +4396,7 @@ Wed Jul 17 14:25:13 1996 Martin M. Hunt * config/tc-d10v.h: New file. * configure (d10v-*-elf): New target. * configure.in (d10v-*-elf): New target. - + Fri Jul 12 20:54:19 1996 Michael Meissner * config/tc-ppc.c (md_parse_option): Recognize -K PIC. @@ -4423,9 +4423,9 @@ Wed Jul 10 00:23:30 1996 Ian Lance Taylor Mon Jul 8 14:11:49 1996 Ian Lance Taylor * config/tc-mips.c (mips_regmask_frag): Only define if OBJ_ELF or - OBJ_MAYBE_ELF. + OBJ_MAYBE_ELF. (tc_gen_reloc): If fixup was changed to be PC relative, change - reloc type accordingly. Use name of reloc in error message. + reloc type accordingly. Use name of reloc in error message. * as.h: Don't define const or volatile. * flonum.h: Don't define const. @@ -4442,7 +4442,7 @@ Fri Jul 5 10:32:58 1996 J.T. Conklin * doc/as.texinfo: Likewise. * config/tc-m68k.c (m68k_ip): The coldfire does not support 8x - scale factor. + scale factor. Fri Jul 5 11:07:24 1996 Ian Lance Taylor @@ -4458,14 +4458,14 @@ Thu Jul 4 11:59:46 1996 Ian Lance Taylor Thu Jul 4 10:11:33 1996 James G. Smith * config/tc-mips.c (mips_ip): Only perform range check when - dealing with O_constant expressions. + dealing with O_constant expressions. Wed Jul 3 15:02:21 1996 J.T. Conklin * m68k-parse.h (m68k_register): Add new coldfile control registers. - * config/tc-m68k.c (mcf5200_control_regs): New variable, + * config/tc-m68k.c (mcf5200_control_regs): New variable, array of control registers for the coldfire. (cpu_of_arch): Added mcf5200. (archs): Added mcf5200. @@ -4499,7 +4499,7 @@ Wed Jul 3 16:05:50 1996 Ian Lance Taylor Tue Jul 2 23:02:12 1996 Jeffrey A Law (law@cygnus.com) - * config/tc-h8300.c (build_bytes): If an operand type is + * config/tc-h8300.c (build_bytes): If an operand type is marked as SRC_IN_DST retrieve it from the "destination" op. Sat Jun 29 13:38:31 1996 Ian Lance Taylor @@ -4558,7 +4558,7 @@ Wed Jun 26 13:21:34 1996 Ian Lance Taylor Wed Jun 26 16:23:08 1996 James G. Smith * config/tc-mips.c: Added cop_interlocks, to avoid NOP insertion - between co-processor comparisons and branches for the VR4300. + between co-processor comparisons and branches for the VR4300. Mon Jun 24 18:02:50 1996 Jason Molenda (crash@godzilla.cygnus.co.jp) @@ -4710,8 +4710,8 @@ Wed Jun 19 11:31:50 1996 Ian Lance Taylor emit relocations against external symbols. * config/tc-alpha.c (tc_gen_reloc): Output a sensible error - message if bfd_reloc_type_lookup fails, rather than calling - assert. + message if bfd_reloc_type_lookup fails, rather than calling + assert. * config/tc-alpha.c (alpha_force_relocation): Add BFD_RELOC_12_PCREL to switch. @@ -4757,7 +4757,7 @@ Tue Jun 18 13:19:51 1996 Jeffrey A. Law Mon Jun 17 15:50:53 1996 J.T. Conklin * doc/as.texinfo: Reorder chapter of machine dependent options so - that it is sorted by chip name. + that it is sorted by chip name. * doc/as.texinfo: Use consistant spelling of Vax. * doc/c-vax.texi: Likewise. @@ -4822,7 +4822,7 @@ Mon Jun 10 11:45:51 1996 Ian Lance Taylor flag for C_MOS, C_MOE, C_MOU, or C_EOS symbols, since they should have a section of N_ABS rather than N_DEBUG. If we do a merge, remove the new symbol from the list. - (obj_coff_endef, both versions): Call tag_insert even if there is + (obj_coff_endef, both versions): Call tag_insert even if there is an old symbol with the same name, if the old symbol does not happen to be a tag. (coff_frob_symbol): Check SF_GET_TAG, C_EOF, and C_FILE outside of @@ -4839,7 +4839,7 @@ Mon Jun 10 11:45:51 1996 Ian Lance Taylor defined. * app.c (do_scrub_chars): If '/' is LINE_COMMENT_START, check - whether the next character is '*' before checking whether we are + whether the next character is '*' before checking whether we are at the start of a line. Permit LINE_COMMENT_START to start a comment in state 1 (seen some whitespace) as well, to match the documentation. @@ -4948,7 +4948,7 @@ Thu May 16 15:51:48 1996 Ian Lance Taylor (sh_flush_pending_output): Declare. (md_flush_pending_output): Define. * config/tc-sh.c (md_assemble): If relaxing, emit a R_SH_CODE - reloc before the instruction if necessary. + reloc before the instruction if necessary. (sh_frob_label): New function. (sh_flush_pending_output): New function. (sh_coff_frob_file): Ignore ALIGN, CODE, DATA, and LABEL relocs @@ -4971,7 +4971,7 @@ Wed May 15 12:23:53 1996 Ian Lance Taylor Wed May 15 08:33:37 1996 Jeffrey A Law (law@cygnus.com) * config/obj-coff.c (count_entries_in_chain): Ignore Fixups with - fx_done set. + fx_done set. (do_relocs_for): Likewise. (fixup_segment): Don't just quit if linkrelax is set. Try to apply non pc-relative sym1-sym2 fixups, even if linkrelax is @@ -5018,7 +5018,7 @@ Sat May 4 12:49:35 1996 Jeffrey A Law (law@cygnus.com) Sat May 4 11:26:19 1996 Ian Lance Taylor * Makefile.in: Add subsegs.h to appropriate TARG_CPU_DEP_* - variables. + variables. Fri May 3 17:58:31 1996 Ian Lance Taylor @@ -5068,7 +5068,7 @@ Thu Apr 25 11:39:51 1996 Ian Lance Taylor Wed Apr 24 11:28:38 1996 Ian Lance Taylor * config/tc-m68k.c (m68k_ip): Prevent attempts to use long offsets - in 68000 mode. + in 68000 mode. * config/obj-coff.c (obj_coff_section): BFD_ASSEMBLER version: call demand_empty_rest_of_line. Non BFD_ASSEMBLER version: @@ -5087,7 +5087,7 @@ Mon Apr 22 18:02:37 1996 Doug Evans Thu Apr 18 18:58:33 1996 Ian Lance Taylor * config/obj-coff.c: BFD_ASSEMBLER: - (coff_last_bf): New static variable. + (coff_last_bf): New static variable. (coff_frob_symbol): Set endndx of a .bf symbol. Non BFD_ASSEMBLER: (obj_coff_endef): Call SF_SET_PROCESS on a .bf symbol. @@ -5185,7 +5185,7 @@ Fri Apr 5 14:29:23 1996 Ian Lance Taylor Fri Apr 5 18:39:28 1996 James G. Smith * config/tc-mips.c: Allow non-zero offsets from .sdata symbols to - be accessed using the $gp register. + be accessed using the $gp register. * config/tc-mips.h (MAX_GPREL_OFFSET): Added. Wed Apr 3 10:56:14 1996 Doug Evans @@ -5324,7 +5324,7 @@ Mon Mar 11 09:59:53 1996 Steve Chamberlain (do_relocs_for, w_symbols, obj_coff_add_segment, do_linenos_for, crawl_symbols, coff_header_append): Loop to SEG_LAST rather than SEG_E9. - + Thu Mar 7 15:17:39 1996 Doug Evans * config/tc-sparc.c (sparc_ip): Handle operand char 'O' (neg reg). @@ -5464,7 +5464,7 @@ Mon Feb 19 02:15:57 1996 Doug Evans Sun Feb 18 15:03:50 1996 Ian Lance Taylor * configure.in: Check for 'do not mix' from native linker before - trying to use -rpath. + trying to use -rpath. * configure: Rebuild. Fri Feb 16 16:53:31 1996 Ian Lance Taylor @@ -5585,7 +5585,7 @@ Mon Feb 12 15:16:29 1996 Andreas Schwab Fri Jan 26 19:28:52 1996 Kim Knuttila - * config/tc-ppc.c (md_assemble): Ignore overflow on + * config/tc-ppc.c (md_assemble): Ignore overflow on BFD_RELOC_16_GOTOFF and BFD_RELOC_PPC_TOC16. Fri Jan 26 16:14:17 1996 Michael Meissner @@ -5957,3 +5957,10 @@ Tue Jan 2 12:43:23 1996 Jim Wilson not alphanumeric. For older changes see ChangeLog-9295 + +Local Variables: +mode: change-log +left-margin: 8 +fill-column: 74 +version-control: never +End: diff --git a/contrib/binutils/gas/ChangeLog-9899 b/contrib/binutils/gas/ChangeLog-9899 index c2e4d897aa0..ae38e5dd922 100644 --- a/contrib/binutils/gas/ChangeLog-9899 +++ b/contrib/binutils/gas/ChangeLog-9899 @@ -4858,3 +4858,10 @@ Fri Jan 2 16:08:54 1998 Ian Lance Taylor unrecognized characters after an expression. For older changes see ChangeLog-9697 + +Local Variables: +mode: change-log +left-margin: 8 +fill-column: 74 +version-control: never +End: diff --git a/contrib/binutils/gas/Makefile.am b/contrib/binutils/gas/Makefile.am index 7728434af21..08b9842fc6b 100644 --- a/contrib/binutils/gas/Makefile.am +++ b/contrib/binutils/gas/Makefile.am @@ -16,6 +16,7 @@ YACC = `if [ -f ../bison/bison ] ; then echo ../bison/bison -y -L../bison/bison LEX = `if [ -f ../flex/flex ] ; then echo ../flex/flex ; else echo @LEX@ ; fi` WARN_CFLAGS = @WARN_CFLAGS@ +NO_WERROR = @NO_WERROR@ AM_CFLAGS = $(WARN_CFLAGS) MKDEP = gcc -MM @@ -40,19 +41,19 @@ IT_OBJS=itbl-parse.o itbl-lex.o itbl-ops.o # CPU types. This is only used for dependency information. CPU_TYPES = \ - a29k \ alpha \ arc \ arm \ avr \ + bfin \ cris \ + crx \ d10v \ d30v \ dlx \ fr30 \ frv \ h8300 \ - h8500 \ hppa \ ia64 \ i370 \ @@ -60,10 +61,10 @@ CPU_TYPES = \ i860 \ i960 \ ip2k \ + m32c \ m32r \ m68hc11 \ m68k \ - m88k \ mcore \ mips \ mmix \ @@ -80,16 +81,15 @@ CPU_TYPES = \ sh \ sh64 \ sparc \ - tahoe \ tic30 \ tic4x \ tic54x \ - tic80 \ vax \ - w65 \ v850 \ xstormy16 \ + xc16x \ xtensa \ + z80 \ z8k # Object format types. This is only used for dependency information. @@ -97,14 +97,11 @@ CPU_TYPES = \ OBJ_FORMATS = \ aout \ - bout \ coff \ ecoff \ elf \ evax \ - hp300 \ - ieee \ - vms + ieee # This is an sh case which sets valid according to whether the CPU # type in the shell variable c and the OS type in the shell variable o @@ -116,13 +113,9 @@ CPU_OBJ_VALID = \ case $$o in \ aout) \ case $$c in \ - a29k | arm | cris | i386 | m68k | ns32k | pdp11 | sparc | tahoe | tic30 | vax) \ + arm | cris | i386 | m68k | ns32k | pdp11 | sparc | tic30 | vax) \ valid=yes ;; \ esac ;; \ - bout) \ - case $$c in \ - i960) valid=yes ;; \ - esac ;; \ coff) valid=yes; \ case $$c in \ cris | i860 | mmix | sh64) \ @@ -137,10 +130,6 @@ CPU_OBJ_VALID = \ case $$c in \ alpha) valid=yes ;; \ esac ;; \ - hp300) \ - case $$c in \ - m68k) valid=yes ;; \ - esac ;; \ vms) \ case $$c in \ vax) valid=yes ;; \ @@ -175,7 +164,6 @@ GAS_CFILES = \ app.c \ as.c \ atof-generic.c \ - bignum-copy.c \ cond.c \ depend.c \ dwarf2dbg.c \ @@ -220,6 +208,7 @@ HFILES = \ frags.h \ hash.h \ input-file.h \ + itbl-lex.h \ itbl-ops.h \ listing.h \ macro.h \ @@ -236,19 +225,19 @@ HFILES = \ # CPU files in config. TARGET_CPU_CFILES = \ - config/tc-a29k.c \ config/tc-alpha.c \ config/tc-arc.c \ config/tc-arm.c \ config/tc-avr.c \ + config/tc-bfin.c \ config/tc-cris.c \ + config/tc-crx.c \ config/tc-d10v.c \ config/tc-d30v.c \ config/tc-dlx.c \ config/tc-fr30.c \ config/tc-frv.c \ config/tc-h8300.c \ - config/tc-h8500.c \ config/tc-hppa.c \ config/tc-ia64.c \ config/tc-i370.c \ @@ -256,10 +245,10 @@ TARGET_CPU_CFILES = \ config/tc-i860.c \ config/tc-i960.c \ config/tc-ip2k.c \ + config/tc-m32c.c \ config/tc-m32r.c \ config/tc-m68hc11.c \ config/tc-m68k.c \ - config/tc-m88k.c \ config/tc-mcore.c \ config/tc-mips.c \ config/tc-mmix.c \ @@ -276,31 +265,30 @@ TARGET_CPU_CFILES = \ config/tc-sh.c \ config/tc-sh64.c \ config/tc-sparc.c \ - config/tc-tahoe.c \ config/tc-tic30.c \ config/tc-tic54x.c \ - config/tc-tic80.c \ config/tc-vax.c \ - config/tc-w65.c \ config/tc-v850.c \ config/tc-xstormy16.c \ + config/tc-xc16x.c \ config/tc-xtensa.c \ + config/tc-z80.c \ config/tc-z8k.c TARGET_CPU_HFILES = \ - config/tc-a29k.h \ config/tc-alpha.h \ config/tc-arc.h \ config/tc-arm.h \ config/tc-avr.h \ + config/tc-bfin.h \ config/tc-cris.h \ + config/tc-crx.h \ config/tc-d10v.h \ config/tc-d30v.h \ config/tc-dlx.h \ config/tc-fr30.h \ config/tc-frv.h \ config/tc-h8300.h \ - config/tc-h8500.h \ config/tc-hppa.h \ config/tc-ia64.h \ config/tc-i370.h \ @@ -308,10 +296,10 @@ TARGET_CPU_HFILES = \ config/tc-i860.h \ config/tc-i960.h \ config/tc-ip2k.h \ + config/tc-m32c.h \ config/tc-m32r.h \ config/tc-m68hc11.h \ config/tc-m68k.h \ - config/tc-m88k.h \ config/tc-mcore.h \ config/tc-mips.h \ config/tc-mmix.h \ @@ -328,47 +316,41 @@ TARGET_CPU_HFILES = \ config/tc-sh.h \ config/tc-sh64.h \ config/tc-sparc.h \ - config/tc-tahoe.h \ config/tc-tic30.h \ config/tc-tic54x.h \ - config/tc-tic80.h \ config/tc-vax.h \ - config/tc-w65.h \ config/tc-v850.h \ config/tc-xstormy16.h \ + config/tc-xc16x.h \ config/tc-xtensa.h \ + config/tc-z80.h \ config/tc-z8k.h # OBJ files in config OBJ_FORMAT_CFILES = \ config/obj-aout.c \ - config/obj-bout.c \ config/obj-coff.c \ config/obj-ecoff.c \ config/obj-elf.c \ config/obj-evax.c \ - config/obj-hp300.c \ config/obj-ieee.c \ - config/obj-som.c \ - config/obj-vms.c + config/obj-som.c OBJ_FORMAT_HFILES = \ config/obj-aout.h \ - config/obj-bout.h \ config/obj-coff.h \ config/obj-ecoff.h \ config/obj-elf.h \ config/obj-evax.h \ - config/obj-hp300.h \ config/obj-ieee.h \ - config/obj-som.h \ - config/obj-vms.h + config/obj-som.h # Emulation header files in config TARG_ENV_HFILES = \ config/te-386bsd.h \ + config/te-armlinuxeabi.h \ config/te-aux.h \ config/te-delta.h \ config/te-delt88.h \ @@ -377,7 +359,6 @@ TARG_ENV_HFILES = \ config/te-epoc-pe.h \ config/te-generic.h \ config/te-go32.h \ - config/te-hp300.h \ config/te-hppa.h \ config/te-hppa64.h \ config/te-hppalinux64.h \ @@ -391,15 +372,15 @@ TARG_ENV_HFILES = \ config/te-macos.h \ config/te-nbsd.h \ config/te-nbsd532.h \ + config/te-netware.h \ config/te-pc532mach.h \ config/te-pe.h \ - config/te-ppcnw.h \ config/te-psos.h \ config/te-riscix.h \ config/te-sparcaout.h \ config/te-sun3.h \ config/te-svr4.h \ - config/te-sysv32.h \ + config/te-symbian.h \ config/te-tmips.h # Multi files in config @@ -423,7 +404,6 @@ GENERIC_OBJS = \ app.o \ as.o \ atof-generic.o \ - bignum-copy.o \ cond.o \ depend.o \ dwarf2dbg.o \ @@ -454,7 +434,7 @@ OBJS = $(CONFIG_OBJS) $(GENERIC_OBJS) POTFILES = $(MULTI_CFILES) $(TARGET_ENV_HFILES) $(OBJ_FORMAT_HFILES) \ $(OBJ_FORMAT_CFILES) $(TARGET_CPU_HFILES) $(TARGET_CPU_CFILES) \ - $(HFILES) $(CFILES) $(GAS_CFILES) + $(HFILES) $(CFILES) po/POTFILES.in: @MAINT@ Makefile for f in $(POTFILES); do echo $$f; done | LC_COLLATE= sort > tmp \ && mv tmp $(srcdir)/po/POTFILES.in @@ -465,14 +445,11 @@ noinst_PROGRAMS = as-new noinst_SCRIPTS = $(GDBINIT) EXTRA_SCRIPTS = .gdbinit -$(srcdir)/make-gas.com: stamp-mk.com -stamp-mk.com: vmsconf.sh Makefile - sh $(srcdir)/vmsconf.sh $(GENERIC_OBJS) > new-make.com - $(SHELL) $(srcdir)/../move-if-change new-make.com $(srcdir)/make-gas.com - touch stamp-mk.com +EXTRA_DIST = m68k-parse.c itbl-parse.c itbl-parse.h itbl-lex.c \ + bfin-parse.c bfin-parse.h bfin-lex.c -EXTRA_DIST = make-gas.com m68k-parse.c itbl-parse.c itbl-parse.h itbl-lex.c diststuff: $(EXTRA_DIST) info +all: info DISTCLEANFILES = targ-cpu.h obj-format.h targ-env.h itbl-cpu.h cgen-desc.h @@ -487,15 +464,15 @@ INCDIR = $(BASEDIR)/include # Both . and srcdir are used, in that order, # so that tm.h and config.h will be found in the compilation # subdirectory rather than in the source directory. -INCLUDES = -D_GNU_SOURCE -I. -I$(srcdir) -I../bfd -I$(srcdir)/config -I$(INCDIR) -I$(srcdir)/.. -I$(BFDDIR) -I$(srcdir)/../intl -I../intl -DLOCALEDIR="\"$(prefix)/share/locale\"" +INCLUDES = -D_GNU_SOURCE -I. -I$(srcdir) -I../bfd -I$(srcdir)/config -I$(INCDIR) -I$(srcdir)/.. -I$(BFDDIR) -I$(srcdir)/../intl -I../intl -DLOCALEDIR="\"$(datadir)/locale\"" # This should be parallel to INCLUDES, but should replace $(srcdir) # with $${srcdir}, and should work in a subdirectory. This is used # when building dependencies, because the dependency building is done # in a subdirectory. -DEP_INCLUDES = -D_GNU_SOURCE -I.. -I$${srcdir} -I../../bfd -I$${srcdir}/config -I$${srcdir}/../include -I$${srcdir}/.. -I$${srcdir}/../bfd -I$${srcdir}/../intl -I../../intl -DLOCALEDIR="\"$(prefix)/share/locale\"" +DEP_INCLUDES = -D_GNU_SOURCE -I.. -I$${srcdir} -I../../bfd -I$${srcdir}/config -I$${srcdir}/../include -I$${srcdir}/.. -I$${srcdir}/../bfd -I$${srcdir}/../intl -I../../intl -DLOCALEDIR="\"$(datadir)/locale\"" -DEP_FLAGS = -DBFD_ASSEMBLER -DOBJ_MAYBE_ELF \ +DEP_FLAGS = -DOBJ_MAYBE_ELF \ -I. -I.. -I$${srcdir} -I../../bfd $(DEP_INCLUDES) # How to link with both our special library facilities @@ -524,13 +501,8 @@ $(OBJS): $(INCDIR)/bin-bugs.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ as.h asintl.h bignum.h bit_fix.h config.h emul.h expr.h flonum.h \ frags.h hash.h listing.h obj.h read.h symbols.h tc.h write.h -EXPECT = `if [ -f $${rootme}/../expect/expect ] ; then \ - echo $${rootme}/../expect/expect ; \ - else echo expect ; fi` - -RUNTEST = `if [ -f $${srcdir}/../dejagnu/runtest ] ; then \ - echo $${srcdir}/../dejagnu/runtest ; else echo runtest; \ - fi` +EXPECT = expect +RUNTEST = runtest RUNTESTFLAGS= check-DEJAGNU: site.exp @@ -544,10 +516,6 @@ check-DEJAGNU: site.exp rootme=`pwd`; export rootme; \ srcdir=`cd ${srcdir}; pwd` ; export srcdir ; \ EXPECT=${EXPECT} ; export EXPECT ; \ - if [ -f $(top_builddir)/../expect/expect ]; then \ - TCL_LIBRARY=`cd $(top_srcdir)/../tcl/library && pwd`; \ - export TCL_LIBRARY; \ - fi; \ runtest=$(RUNTEST); \ cd testsuite; \ if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \ @@ -574,8 +542,6 @@ ecoff.o : ecoff.c ecoff.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h \ obj-aout.o : $(srcdir)/config/obj-aout.c $(COMPILE) -c $(srcdir)/config/obj-aout.c -obj-bout.o : $(srcdir)/config/obj-bout.c - $(COMPILE) -c $(srcdir)/config/obj-bout.c obj-coff.o: $(srcdir)/config/obj-coff.c $(COMPILE) -c $(srcdir)/config/obj-coff.c obj-ecoff.o : $(srcdir)/config/obj-ecoff.c @@ -584,16 +550,12 @@ obj-elf.o : $(srcdir)/config/obj-elf.c $(COMPILE) -c $(srcdir)/config/obj-elf.c obj-evax.o : $(srcdir)/config/obj-evax.c $(COMPILE) -c $(srcdir)/config/obj-evax.c -obj-hp300.o : $(srcdir)/config/obj-hp300.c - $(COMPILE) -c $(srcdir)/config/obj-hp300.c obj-ieee.o : $(srcdir)/config/obj-ieee.c $(COMPILE) -c $(srcdir)/config/obj-ieee.c obj-multi.o : $(srcdir)/config/obj-multi.c $(COMPILE) -c $(srcdir)/config/obj-multi.c obj-som.o : $(srcdir)/config/obj-som.c $(COMPILE) -c $(srcdir)/config/obj-som.c -obj-vms.o : $(srcdir)/config/obj-vms.c - $(COMPILE) -c $(srcdir)/config/obj-vms.c e-mipself.o : $(srcdir)/config/e-mipself.c $(COMPILE) -c $(srcdir)/config/e-mipself.c @@ -615,7 +577,7 @@ xtensa-relax.o: $(srcdir)/config/xtensa-relax.c # The m68k operand parser. -EXTRA_as_new_SOURCES = config/m68k-parse.y +EXTRA_as_new_SOURCES = config/m68k-parse.y config/bfin-parse.y # If m68k-parse.y is in a different directory, then ylwrap will use an # absolute path when it invokes yacc, which will cause yacc to put the @@ -635,27 +597,51 @@ m68k-parse.c: $(srcdir)/config/m68k-parse.y cp config/m68k-parse.y . >/dev/null 2>/dev/null; \ f=m68k-parse.y; \ else true; fi; \ - $(SHELL) $(YLWRAP) "$(YACC)" $$f y.tab.c m68k-parse.c --; \ + $(SHELL) $(YLWRAP) $$f y.tab.c m68k-parse.c -- $(YACCCOMPILE); \ if [ $$f = "m68k-parse.y" ]; then \ rm -f m68k-parse.y; \ else true; fi +# Disable -Werror, if it has been enabled, since old versions of bison/ +# yacc will produce working code which contain compile time warnings. m68k-parse.o: m68k-parse.c $(srcdir)/config/m68k-parse.h + $(COMPILE) -c $< $(NO_WERROR) # Don't let the .y.h rule clobber m68k-parse.h. m68k-parse.h: ; @true $(srcdir)/config/m68k-parse.h: ; @true +bfin-parse.c: $(srcdir)/config/bfin-parse.y + $(SHELL) $(YLWRAP) $(srcdir)/config/bfin-parse.y y.tab.c bfin-parse.c y.tab.h bfin-parse.h -- $(YACCCOMPILE) -d ; +bfin-parse.h: bfin-parse.c +bfin-parse.o: bfin-parse.c bfin-parse.h $(srcdir)/config/bfin-defs.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/bfin.h $(BFDDIR)/libbfd.h + +bfin-defs.h: ; @true +$(srcdir)/config/bfin-defs.h: ; @true + +bfin-lex.c: $(srcdir)/config/bfin-lex.l + $(SHELL) $(YLWRAP) $(srcdir)/config/bfin-lex.l lex.yy.c bfin-lex.c -- $(LEXCOMPILE) +bfin-lex.o: bfin-lex.c bfin-parse.h $(srcdir)/config/bfin-defs.h + $(COMPILE) -c $< $(NO_WERROR) + # The instruction table specification lexical analyzer and parser. itbl-lex.c: $(srcdir)/itbl-lex.l -itbl-lex.o: itbl-lex.c itbl-parse.h -itbl-parse.o: itbl-parse.c itbl-parse.h $(srcdir)/itbl-ops.h +# Disable -Werror, if it has been enabled, since old versions of bison/ +# yacc will produce working code which contain compile time warnings. +itbl-lex.o: itbl-lex.c itbl-parse.h $(srcdir)/itbl-lex.h + $(COMPILE) -c $< $(NO_WERROR) + +# Disable -Werror, if it has been enabled, since old versions of bison/ +# yacc will produce working code which contain compile time warnings. +itbl-parse.o: itbl-parse.c itbl-parse.h $(srcdir)/itbl-ops.h $(srcdir)/itbl-lex.h + $(COMPILE) -c $< $(NO_WERROR) itbl-ops.o: $(srcdir)/itbl-ops.c $(srcdir)/itbl-ops.h itbl-parse.h itbl-parse.c itbl-parse.h: $(srcdir)/itbl-parse.y - $(SHELL) $(YLWRAP) "$(YACC)" $(srcdir)/itbl-parse.y y.tab.c itbl-parse.c y.tab.h itbl-parse.h -- -d + $(SHELL) $(YLWRAP) $(srcdir)/itbl-parse.y y.tab.c itbl-parse.c y.tab.h itbl-parse.h -- $(YACCCOMPILE) -d # stand-alone itbl assembler & disassembler @@ -680,12 +666,41 @@ cgen.o: cgen.c cgen.h cgen-desc.h subsegs.h \ # Remake the info files. -MOSTLYCLEANFILES = $(STAGESTUFF) core stamp-mk.com \ +MOSTLYCLEANFILES = $(STAGESTUFF) core \ testsuite/*.o testsuite/*.out testsuite/gas.log testsuite/gas.sum \ testsuite/site.exp site.bak site.exp stage stage1 stage2 CLEANFILES = dep.sed DEPTC DEPTCA DEPOBJ DEPOBJA DEP2 DEP2A DEP1 DEPA DEP DEPDIR +.PHONY: install-html install-html-am install-html-recursive + +install-html: install-html-recursive + +install-html-recursive: + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + .PHONY: install-exec-local install-data-local .PHONY: install-exec-bindir install-exec-tooldir @@ -791,7 +806,7 @@ de-stage3: DEP_FILE_DEPS = $(CFILES) $(HFILES) $(TARGET_CPU_CFILES) \ $(TARGET_CPU_HFILES) $(OBJ_FORMAT_CFILES) $(OBJ_FORMAT_HFILES) -CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/configure.in +CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/configure.in $(srcdir)/configure.tgt # Automatic dependency computation. This is a real pain, because the # dependencies change based on target_cpu_type and obj_format. @@ -973,27 +988,16 @@ dep-am: DEP .PHONY: dep dep-in dep-am AMKDEP = #DO NOT PUT ANYTHING BETWEEN THIS LINE AND THE MATCHING WARNING BELOW. -DEPTC_a29k_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ - $(srcdir)/config/tc-a29k.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/a29k.h -DEPTC_a29k_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ - $(srcdir)/config/tc-a29k.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/a29k.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/a29k.h -DEPTC_a29k_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ - $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-a29k.h \ - $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/a29k.h DEPTC_alpha_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-alpha.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h ecoff.h $(INCDIR)/opcode/alpha.h $(INCDIR)/safe-ctype.h \ - $(srcdir)/config/atof-vax.c + struc-symbol.h ecoff.h $(INCDIR)/opcode/alpha.h dw2gencfi.h \ + $(INCDIR)/elf/dwarf2.h $(INCDIR)/safe-ctype.h $(srcdir)/config/atof-vax.c DEPTC_alpha_ecoff = $(INCDIR)/symcat.h $(srcdir)/config/obj-ecoff.h \ $(srcdir)/config/tc-alpha.h ecoff.h $(INCDIR)/coff/sym.h \ $(INCDIR)/coff/ecoff.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h $(INCDIR)/opcode/alpha.h $(INCDIR)/safe-ctype.h \ - $(srcdir)/config/atof-vax.c + struc-symbol.h $(INCDIR)/opcode/alpha.h dw2gencfi.h \ + $(INCDIR)/elf/dwarf2.h $(INCDIR)/safe-ctype.h $(srcdir)/config/atof-vax.c DEPTC_alpha_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-alpha.h \ @@ -1004,8 +1008,8 @@ DEPTC_alpha_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(srcdir)/config/atof-vax.c DEPTC_alpha_evax = $(INCDIR)/symcat.h $(srcdir)/config/obj-evax.h \ $(srcdir)/config/tc-alpha.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h ecoff.h $(INCDIR)/opcode/alpha.h $(INCDIR)/safe-ctype.h \ - $(srcdir)/config/atof-vax.c + struc-symbol.h ecoff.h $(INCDIR)/opcode/alpha.h dw2gencfi.h \ + $(INCDIR)/elf/dwarf2.h $(INCDIR)/safe-ctype.h $(srcdir)/config/atof-vax.c DEPTC_arc_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-arc.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h struc-symbol.h \ @@ -1015,22 +1019,24 @@ DEPTC_arc_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPTC_arc_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-arc.h \ - struc-symbol.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - $(INCDIR)/opcode/arc.h $(srcdir)/../opcodes/arc-ext.h \ - $(INCDIR)/elf/arc.h $(INCDIR)/elf/reloc-macros.h dwarf2dbg.h + dwarf2dbg.h struc-symbol.h $(INCDIR)/safe-ctype.h subsegs.h \ + $(INCDIR)/obstack.h $(INCDIR)/opcode/arc.h $(srcdir)/../opcodes/arc-ext.h \ + $(INCDIR)/elf/arc.h $(INCDIR)/elf/reloc-macros.h DEPTC_arm_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ $(srcdir)/config/tc-arm.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/arm.h DEPTC_arm_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-arm.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h subsegs.h \ - $(INCDIR)/obstack.h + $(INCDIR)/obstack.h $(INCDIR)/opcode/arm.h DEPTC_arm_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-arm.h \ $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - $(INCDIR)/elf/arm.h $(INCDIR)/elf/reloc-macros.h dwarf2dbg.h + $(INCDIR)/opcode/arm.h $(INCDIR)/elf/arm.h $(INCDIR)/elf/reloc-macros.h \ + dwarf2dbg.h dw2gencfi.h $(INCDIR)/elf/dwarf2.h DEPTC_avr_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-avr.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ @@ -1038,8 +1044,24 @@ DEPTC_avr_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPTC_avr_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-avr.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ $(INCDIR)/opcode/avr.h +DEPTC_bfin_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-bfin.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h struc-symbol.h \ + $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h dwarf2dbg.h \ + $(INCDIR)/obstack.h $(INCDIR)/safe-ctype.h \ + $(srcdir)/config/bfin-aux.h $(INCDIR)/opcode/bfin.h \ + $(srcdir)/config/bfin-defs.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/bfin.h $(BFDDIR)/libbfd.h +DEPTC_bfin_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-bfin.h \ + dwarf2dbg.h struc-symbol.h $(srcdir)/config/bfin-defs.h \ + $(INCDIR)/obstack.h $(INCDIR)/safe-ctype.h $(srcdir)/config/bfin-aux.h \ + $(INCDIR)/opcode/bfin.h $(srcdir)/config/bfin-defs.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/bfin.h $(BFDDIR)/libbfd.h DEPTC_cris_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ $(srcdir)/config/tc-cris.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ @@ -1047,8 +1069,18 @@ DEPTC_cris_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ DEPTC_cris_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-cris.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - $(INCDIR)/opcode/cris.h dwarf2dbg.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/cris.h +DEPTC_crx_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-crx.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ + dwarf2dbg.h $(INCDIR)/opcode/crx.h $(INCDIR)/elf/crx.h \ + $(INCDIR)/elf/reloc-macros.h +DEPTC_crx_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-crx.h \ + dwarf2dbg.h $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/crx.h \ + $(INCDIR)/elf/crx.h $(INCDIR)/elf/reloc-macros.h DEPTC_d10v_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-d10v.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ @@ -1075,31 +1107,34 @@ DEPTC_dlx_coff = $(INCDIR)/safe-ctype.h $(INCDIR)/symcat.h \ DEPTC_dlx_elf = $(INCDIR)/safe-ctype.h $(INCDIR)/symcat.h \ $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ - $(srcdir)/config/tc-dlx.h $(INCDIR)/opcode/dlx.h + $(srcdir)/config/tc-dlx.h dwarf2dbg.h $(INCDIR)/opcode/dlx.h DEPTC_fr30_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-fr30.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/fr30-desc.h \ - $(INCDIR)/opcode/cgen.h $(srcdir)/../opcodes/fr30-opc.h \ - cgen.h + $(INCDIR)/opcode/cgen-bitset.h $(INCDIR)/opcode/cgen.h \ + $(srcdir)/../opcodes/fr30-opc.h cgen.h DEPTC_fr30_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-fr30.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - $(srcdir)/../opcodes/fr30-desc.h $(INCDIR)/opcode/cgen.h \ - $(srcdir)/../opcodes/fr30-opc.h cgen.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(srcdir)/../opcodes/fr30-desc.h $(INCDIR)/opcode/cgen-bitset.h \ + $(INCDIR)/opcode/cgen.h $(srcdir)/../opcodes/fr30-opc.h \ + cgen.h DEPTC_frv_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-frv.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ - $(srcdir)/../opcodes/frv-desc.h $(INCDIR)/opcode/cgen.h \ - $(srcdir)/../opcodes/frv-opc.h cgen.h $(BFDDIR)/libbfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/frv.h $(INCDIR)/elf/reloc-macros.h + $(srcdir)/../opcodes/frv-desc.h $(INCDIR)/opcode/cgen-bitset.h \ + $(INCDIR)/opcode/cgen.h $(srcdir)/../opcodes/frv-opc.h \ + cgen.h $(BFDDIR)/libbfd.h $(INCDIR)/hashtab.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/frv.h $(INCDIR)/elf/reloc-macros.h DEPTC_frv_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-frv.h \ subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/frv-desc.h \ - $(INCDIR)/opcode/cgen.h $(srcdir)/../opcodes/frv-opc.h \ - cgen.h $(BFDDIR)/libbfd.h $(INCDIR)/elf/frv.h $(INCDIR)/elf/reloc-macros.h + $(INCDIR)/opcode/cgen-bitset.h $(INCDIR)/opcode/cgen.h \ + $(srcdir)/../opcodes/frv-opc.h cgen.h $(BFDDIR)/libbfd.h \ + $(INCDIR)/hashtab.h $(INCDIR)/elf/frv.h $(INCDIR)/elf/reloc-macros.h DEPTC_h8300_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-h8300.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/h8300.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ @@ -1108,18 +1143,8 @@ DEPTC_h8300_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPTC_h8300_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8300.h \ - subsegs.h $(INCDIR)/obstack.h dwarf2dbg.h $(INCDIR)/opcode/h8300.h \ + dwarf2dbg.h subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/h8300.h \ $(INCDIR)/safe-ctype.h $(INCDIR)/elf/h8.h $(INCDIR)/elf/reloc-macros.h -DEPTC_h8500_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ - $(srcdir)/config/tc-h8500.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/h8500.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ - $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/h8500-opc.h \ - $(INCDIR)/safe-ctype.h -DEPTC_h8500_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ - $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8500.h \ - subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/h8500-opc.h \ - $(INCDIR)/safe-ctype.h DEPTC_hppa_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-hppa.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ @@ -1148,32 +1173,31 @@ DEPTC_i370_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPTC_i370_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i370.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ struc-symbol.h $(INCDIR)/opcode/i370.h $(INCDIR)/elf/i370.h \ $(INCDIR)/elf/reloc-macros.h DEPTC_i386_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ $(srcdir)/config/tc-i386.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - dwarf2dbg.h dw2gencfi.h $(INCDIR)/elf/dwarf2.h $(INCDIR)/opcode/i386.h + dwarf2dbg.h dw2gencfi.h $(INCDIR)/elf/dwarf2.h $(INCDIR)/opcode/i386.h \ + $(INCDIR)/elf/x86-64.h $(INCDIR)/elf/reloc-macros.h DEPTC_i386_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-i386.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h subsegs.h \ $(INCDIR)/obstack.h dwarf2dbg.h dw2gencfi.h $(INCDIR)/elf/dwarf2.h \ - $(INCDIR)/opcode/i386.h + $(INCDIR)/opcode/i386.h $(INCDIR)/elf/x86-64.h $(INCDIR)/elf/reloc-macros.h DEPTC_i386_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i386.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - dwarf2dbg.h dw2gencfi.h $(INCDIR)/elf/dwarf2.h $(INCDIR)/opcode/i386.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + dw2gencfi.h $(INCDIR)/elf/dwarf2.h $(INCDIR)/opcode/i386.h \ + $(INCDIR)/elf/x86-64.h $(INCDIR)/elf/reloc-macros.h DEPTC_i860_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i860.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ $(INCDIR)/opcode/i860.h $(INCDIR)/elf/i860.h $(INCDIR)/elf/reloc-macros.h -DEPTC_i960_bout = $(INCDIR)/symcat.h $(srcdir)/config/obj-bout.h \ - $(srcdir)/config/tc-i960.h $(INCDIR)/safe-ctype.h $(INCDIR)/obstack.h \ - $(INCDIR)/opcode/i960.h DEPTC_i960_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-i960.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/i960.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ @@ -1181,32 +1205,54 @@ DEPTC_i960_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPTC_i960_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i960.h \ - $(INCDIR)/safe-ctype.h $(INCDIR)/obstack.h $(INCDIR)/opcode/i960.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/i960.h DEPTC_ip2k_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-ip2k.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ - $(srcdir)/../opcodes/ip2k-desc.h $(INCDIR)/opcode/cgen.h \ - $(srcdir)/../opcodes/ip2k-opc.h cgen.h $(INCDIR)/elf/common.h \ - $(INCDIR)/elf/ip2k.h $(INCDIR)/elf/reloc-macros.h $(BFDDIR)/libbfd.h + $(srcdir)/../opcodes/ip2k-desc.h $(INCDIR)/opcode/cgen-bitset.h \ + $(INCDIR)/opcode/cgen.h $(srcdir)/../opcodes/ip2k-opc.h \ + cgen.h $(INCDIR)/elf/common.h $(INCDIR)/elf/ip2k.h \ + $(INCDIR)/elf/reloc-macros.h $(BFDDIR)/libbfd.h $(INCDIR)/hashtab.h DEPTC_ip2k_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ip2k.h \ - subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/ip2k-desc.h \ - $(INCDIR)/opcode/cgen.h $(srcdir)/../opcodes/ip2k-opc.h \ - cgen.h $(INCDIR)/elf/ip2k.h $(INCDIR)/elf/reloc-macros.h \ - $(BFDDIR)/libbfd.h + dwarf2dbg.h subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/ip2k-desc.h \ + $(INCDIR)/opcode/cgen-bitset.h $(INCDIR)/opcode/cgen.h \ + $(srcdir)/../opcodes/ip2k-opc.h cgen.h $(INCDIR)/elf/ip2k.h \ + $(INCDIR)/elf/reloc-macros.h $(BFDDIR)/libbfd.h $(INCDIR)/hashtab.h +DEPTC_m32c_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-m32c.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ + $(srcdir)/../opcodes/m32c-desc.h $(INCDIR)/opcode/cgen-bitset.h \ + $(INCDIR)/opcode/cgen.h $(srcdir)/../opcodes/m32c-opc.h \ + $(srcdir)/../opcodes/cgen-types.h $(srcdir)/../opcodes/cgen-ops.h \ + cgen.h $(INCDIR)/elf/common.h $(INCDIR)/elf/m32c.h \ + $(INCDIR)/elf/reloc-macros.h $(BFDDIR)/libbfd.h $(INCDIR)/hashtab.h \ + $(INCDIR)/safe-ctype.h +DEPTC_m32c_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m32c.h \ + dwarf2dbg.h subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/m32c-desc.h \ + $(INCDIR)/opcode/cgen-bitset.h $(INCDIR)/opcode/cgen.h \ + $(srcdir)/../opcodes/m32c-opc.h $(srcdir)/../opcodes/cgen-types.h \ + $(srcdir)/../opcodes/cgen-ops.h cgen.h $(INCDIR)/elf/m32c.h \ + $(INCDIR)/elf/reloc-macros.h $(BFDDIR)/libbfd.h $(INCDIR)/hashtab.h \ + $(INCDIR)/safe-ctype.h DEPTC_m32r_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-m32r.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/m32r-desc.h \ - $(INCDIR)/opcode/cgen.h $(srcdir)/../opcodes/m32r-opc.h \ - cgen.h + $(INCDIR)/opcode/cgen-bitset.h $(INCDIR)/opcode/cgen.h \ + $(srcdir)/../opcodes/m32r-opc.h cgen.h $(INCDIR)/elf/m32r.h \ + $(INCDIR)/elf/reloc-macros.h DEPTC_m32r_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m32r.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - $(srcdir)/../opcodes/m32r-desc.h $(INCDIR)/opcode/cgen.h \ - $(srcdir)/../opcodes/m32r-opc.h cgen.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(srcdir)/../opcodes/m32r-desc.h $(INCDIR)/opcode/cgen-bitset.h \ + $(INCDIR)/opcode/cgen.h $(srcdir)/../opcodes/m32r-opc.h \ + cgen.h $(INCDIR)/elf/m32r.h $(INCDIR)/elf/reloc-macros.h DEPTC_m68hc11_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-m68hc11.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ @@ -1216,8 +1262,8 @@ DEPTC_m68hc11_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPTC_m68hc11_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m68hc11.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - $(INCDIR)/opcode/m68hc11.h dwarf2dbg.h $(INCDIR)/elf/m68hc11.h \ + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/m68hc11.h $(INCDIR)/elf/m68hc11.h \ $(INCDIR)/elf/reloc-macros.h DEPTC_m68k_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ $(srcdir)/config/tc-m68k.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ @@ -1237,21 +1283,6 @@ DEPTC_m68k_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ dwarf2dbg.h dw2gencfi.h $(INCDIR)/elf/dwarf2.h $(INCDIR)/opcode/m68k.h \ $(srcdir)/config/m68k-parse.h $(INCDIR)/elf/m68k.h \ $(INCDIR)/elf/reloc-macros.h -DEPTC_m68k_hp300 = $(INCDIR)/symcat.h $(srcdir)/config/obj-hp300.h \ - $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-m68k.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ - $(INCDIR)/obstack.h subsegs.h dwarf2dbg.h dw2gencfi.h \ - $(INCDIR)/elf/dwarf2.h $(INCDIR)/opcode/m68k.h $(srcdir)/config/m68k-parse.h -DEPTC_m88k_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ - $(srcdir)/config/tc-m88k.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/m88k.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h subsegs.h \ - $(INCDIR)/obstack.h $(srcdir)/config/m88k-opcode.h -DEPTC_m88k_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ - $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m88k.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - $(srcdir)/config/m88k-opcode.h DEPTC_mcore_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-mcore.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/mcore.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ @@ -1260,43 +1291,38 @@ DEPTC_mcore_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPTC_mcore_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mcore.h \ - subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/mcore-opc.h \ + dwarf2dbg.h subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/mcore-opc.h \ $(INCDIR)/safe-ctype.h $(INCDIR)/elf/mcore.h $(INCDIR)/elf/reloc-macros.h -DEPTC_mips_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ - $(srcdir)/config/tc-mips.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ - subsegs.h $(INCDIR)/obstack.h $(INCDIR)/safe-ctype.h \ - $(INCDIR)/opcode/mips.h itbl-ops.h dwarf2dbg.h $(srcdir)/config/obj-elf.h \ - $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h \ - ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h DEPTC_mips_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-mips.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/mipspe.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(INCDIR)/safe-ctype.h \ - $(INCDIR)/opcode/mips.h itbl-ops.h dwarf2dbg.h $(srcdir)/config/obj-elf.h \ - $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h \ - ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h + $(INCDIR)/opcode/mips.h itbl-ops.h dwarf2dbg.h dw2gencfi.h \ + $(INCDIR)/elf/dwarf2.h $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h ecoff.h \ + $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h DEPTC_mips_ecoff = $(INCDIR)/symcat.h $(srcdir)/config/obj-ecoff.h \ $(srcdir)/config/tc-mips.h ecoff.h $(INCDIR)/coff/sym.h \ $(INCDIR)/coff/ecoff.h subsegs.h $(INCDIR)/obstack.h \ $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/mips.h itbl-ops.h \ - dwarf2dbg.h $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h + dwarf2dbg.h dw2gencfi.h $(INCDIR)/elf/dwarf2.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/mips.h \ + $(INCDIR)/elf/reloc-macros.h DEPTC_mips_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mips.h \ subsegs.h $(INCDIR)/obstack.h $(INCDIR)/safe-ctype.h \ - $(INCDIR)/opcode/mips.h itbl-ops.h dwarf2dbg.h $(INCDIR)/elf/mips.h \ - $(INCDIR)/elf/reloc-macros.h ecoff.h $(INCDIR)/coff/sym.h \ - $(INCDIR)/coff/ecoff.h + $(INCDIR)/opcode/mips.h itbl-ops.h dwarf2dbg.h dw2gencfi.h \ + $(INCDIR)/elf/dwarf2.h $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h \ + ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h DEPTC_mmix_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mmix.h \ - subsegs.h $(INCDIR)/obstack.h $(INCDIR)/elf/mmix.h \ + dwarf2dbg.h subsegs.h $(INCDIR)/obstack.h $(INCDIR)/elf/mmix.h \ $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/mmix.h \ - $(INCDIR)/safe-ctype.h dwarf2dbg.h + $(INCDIR)/safe-ctype.h DEPTC_mn10200_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-mn10200.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ @@ -1304,7 +1330,7 @@ DEPTC_mn10200_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPTC_mn10200_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10200.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ $(INCDIR)/opcode/mn10200.h DEPTC_mn10300_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-mn10300.h $(INCDIR)/coff/internal.h \ @@ -1314,16 +1340,16 @@ DEPTC_mn10300_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPTC_mn10300_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10300.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - $(INCDIR)/opcode/mn10300.h dwarf2dbg.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/mn10300.h DEPTC_msp430_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-msp430.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ - $(INCDIR)/opcode/msp430.h $(INCDIR)/safe-ctype.h + $(INCDIR)/opcode/msp430.h $(INCDIR)/safe-ctype.h dwarf2dbg.h DEPTC_msp430_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-msp430.h \ - subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/msp430.h \ + dwarf2dbg.h subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/msp430.h \ $(INCDIR)/safe-ctype.h DEPTC_ns32k_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ $(srcdir)/config/tc-ns32k.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ @@ -1335,18 +1361,19 @@ DEPTC_ns32k_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPTC_ns32k_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ns32k.h \ - $(INCDIR)/opcode/ns32k.h $(INCDIR)/obstack.h + dwarf2dbg.h $(INCDIR)/opcode/ns32k.h $(INCDIR)/obstack.h DEPTC_openrisc_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-openrisc.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ - $(srcdir)/../opcodes/openrisc-desc.h $(INCDIR)/opcode/cgen.h \ - $(srcdir)/../opcodes/openrisc-opc.h cgen.h + $(srcdir)/../opcodes/openrisc-desc.h $(INCDIR)/opcode/cgen-bitset.h \ + $(INCDIR)/opcode/cgen.h $(srcdir)/../opcodes/openrisc-opc.h \ + cgen.h DEPTC_openrisc_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-openrisc.h \ - subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/openrisc-desc.h \ - $(INCDIR)/opcode/cgen.h $(srcdir)/../opcodes/openrisc-opc.h \ - cgen.h + dwarf2dbg.h subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/openrisc-desc.h \ + $(INCDIR)/opcode/cgen-bitset.h $(INCDIR)/opcode/cgen.h \ + $(srcdir)/../opcodes/openrisc-opc.h cgen.h DEPTC_or32_coff = $(INCDIR)/safe-ctype.h $(INCDIR)/symcat.h \ $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-or32.h \ $(INCDIR)/coff/internal.h $(INCDIR)/coff/or32.h $(BFDDIR)/libcoff.h \ @@ -1355,7 +1382,7 @@ DEPTC_or32_coff = $(INCDIR)/safe-ctype.h $(INCDIR)/symcat.h \ DEPTC_or32_elf = $(INCDIR)/safe-ctype.h $(INCDIR)/symcat.h \ $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ - $(srcdir)/config/tc-or32.h $(INCDIR)/opcode/or32.h \ + $(srcdir)/config/tc-or32.h dwarf2dbg.h $(INCDIR)/opcode/or32.h \ $(INCDIR)/elf/or32.h $(INCDIR)/elf/reloc-macros.h DEPTC_pdp11_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ $(srcdir)/config/tc-pdp11.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ @@ -1367,7 +1394,7 @@ DEPTC_pdp11_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPTC_pdp11_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-pdp11.h \ - $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/pdp11.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/pdp11.h DEPTC_pj_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-pj.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ @@ -1375,7 +1402,7 @@ DEPTC_pj_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPTC_pj_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-pj.h \ - $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/pj.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/pj.h DEPTC_ppc_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-ppc.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/rs6000.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ @@ -1384,9 +1411,9 @@ DEPTC_ppc_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPTC_ppc_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ppc.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ dw2gencfi.h $(INCDIR)/elf/dwarf2.h $(INCDIR)/opcode/ppc.h \ - $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h dwarf2dbg.h + $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h DEPTC_s390_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-s390.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ @@ -1396,27 +1423,30 @@ DEPTC_s390_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPTC_s390_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-s390.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h dw2gencfi.h $(INCDIR)/elf/dwarf2.h \ - $(INCDIR)/opcode/s390.h $(INCDIR)/elf/s390.h $(INCDIR)/elf/reloc-macros.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h dw2gencfi.h $(INCDIR)/elf/dwarf2.h $(INCDIR)/opcode/s390.h \ + $(INCDIR)/elf/s390.h $(INCDIR)/elf/reloc-macros.h DEPTC_sh_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-sh.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/sh.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/sh-opc.h \ - $(INCDIR)/safe-ctype.h struc-symbol.h dwarf2dbg.h dw2gencfi.h + $(INCDIR)/safe-ctype.h struc-symbol.h dwarf2dbg.h dw2gencfi.h \ + $(INCDIR)/elf/dwarf2.h DEPTC_sh_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh.h \ subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/sh-opc.h \ $(INCDIR)/safe-ctype.h struc-symbol.h $(INCDIR)/elf/sh.h \ - $(INCDIR)/elf/reloc-macros.h dwarf2dbg.h dw2gencfi.h + $(INCDIR)/elf/reloc-macros.h dwarf2dbg.h dw2gencfi.h \ + $(INCDIR)/elf/dwarf2.h DEPTC_sh64_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh64.h \ $(srcdir)/config/tc-sh.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \ $(BFDDIR)/elf32-sh64.h $(INCDIR)/safe-ctype.h $(srcdir)/../opcodes/sh64-opc.h \ $(srcdir)/config/tc-sh.c subsegs.h $(INCDIR)/obstack.h \ - $(srcdir)/../opcodes/sh-opc.h struc-symbol.h dwarf2dbg.h dw2gencfi.h + $(srcdir)/../opcodes/sh-opc.h struc-symbol.h dwarf2dbg.h \ + dw2gencfi.h $(INCDIR)/elf/dwarf2.h DEPTC_sparc_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ $(srcdir)/config/tc-sparc.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ @@ -1430,21 +1460,9 @@ DEPTC_sparc_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPTC_sparc_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sparc.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ $(INCDIR)/opcode/sparc.h dw2gencfi.h $(INCDIR)/elf/dwarf2.h \ - $(INCDIR)/elf/sparc.h $(INCDIR)/elf/reloc-macros.h \ - dwarf2dbg.h -DEPTC_tahoe_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ - $(srcdir)/config/tc-tahoe.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/safe-ctype.h $(INCDIR)/obstack.h $(INCDIR)/opcode/tahoe.h -DEPTC_tahoe_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ - $(srcdir)/config/tc-tahoe.h $(INCDIR)/coff/internal.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ - $(INCDIR)/obstack.h $(INCDIR)/opcode/tahoe.h -DEPTC_tahoe_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ - $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tahoe.h \ - $(INCDIR)/safe-ctype.h $(INCDIR)/obstack.h $(INCDIR)/opcode/tahoe.h + $(INCDIR)/elf/sparc.h $(INCDIR)/elf/reloc-macros.h DEPTC_tic30_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ $(srcdir)/config/tc-tic30.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/tic30.h @@ -1455,7 +1473,7 @@ DEPTC_tic30_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPTC_tic30_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic30.h \ - $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/tic30.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/tic30.h DEPTC_tic4x_coff = $(INCDIR)/safe-ctype.h $(INCDIR)/symcat.h \ $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic4x.h \ $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic4x.h $(INCDIR)/coff/ti.h \ @@ -1464,7 +1482,7 @@ DEPTC_tic4x_coff = $(INCDIR)/safe-ctype.h $(INCDIR)/symcat.h \ DEPTC_tic4x_elf = $(INCDIR)/safe-ctype.h $(INCDIR)/symcat.h \ $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ - $(srcdir)/config/tc-tic4x.h $(INCDIR)/opcode/tic4x.h \ + $(srcdir)/config/tc-tic4x.h dwarf2dbg.h $(INCDIR)/opcode/tic4x.h \ subsegs.h $(INCDIR)/obstack.h DEPTC_tic54x_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-tic54x.h $(INCDIR)/coff/internal.h \ @@ -1478,42 +1496,21 @@ DEPTC_tic54x_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ struc-symbol.h $(INCDIR)/opcode/tic54x.h $(srcdir)/config/obj-coff.h \ $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic54x.h $(INCDIR)/coff/ti.h \ $(BFDDIR)/libcoff.h -DEPTC_tic80_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ - $(srcdir)/config/tc-tic80.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/tic80.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/tic80.h -DEPTC_tic80_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ - $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic80.h \ - $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/tic80.h DEPTC_vax_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ $(srcdir)/config/tc-vax.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ $(srcdir)/config/vax-inst.h $(INCDIR)/obstack.h subsegs.h \ - $(INCDIR)/opcode/vax.h $(INCDIR)/safe-ctype.h + $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/vax.h DEPTC_vax_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-vax.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(srcdir)/config/vax-inst.h \ - $(INCDIR)/obstack.h subsegs.h $(INCDIR)/opcode/vax.h \ - $(INCDIR)/safe-ctype.h + $(INCDIR)/obstack.h subsegs.h $(INCDIR)/safe-ctype.h \ + $(INCDIR)/opcode/vax.h DEPTC_vax_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-vax.h \ - $(srcdir)/config/vax-inst.h $(INCDIR)/obstack.h subsegs.h \ - $(INCDIR)/elf/vax.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/vax.h \ - $(INCDIR)/safe-ctype.h -DEPTC_vax_vms = $(INCDIR)/symcat.h $(srcdir)/config/obj-vms.h \ - $(srcdir)/config/tc-vax.h $(INCDIR)/aout/stab_gnu.h \ - $(INCDIR)/aout/stab.def $(srcdir)/config/vax-inst.h \ - $(INCDIR)/obstack.h subsegs.h $(INCDIR)/opcode/vax.h \ - $(INCDIR)/safe-ctype.h -DEPTC_w65_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ - $(srcdir)/config/tc-w65.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/w65.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ - $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/w65-opc.h -DEPTC_w65_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ - $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-w65.h \ - subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/w65-opc.h + dwarf2dbg.h $(srcdir)/config/vax-inst.h $(INCDIR)/obstack.h \ + subsegs.h $(INCDIR)/safe-ctype.h $(INCDIR)/elf/vax.h \ + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/vax.h DEPTC_v850_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-v850.h $(INCDIR)/elf/v850.h $(INCDIR)/elf/reloc-macros.h \ $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ @@ -1522,27 +1519,43 @@ DEPTC_v850_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPTC_v850_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-v850.h \ - $(INCDIR)/elf/v850.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/safe-ctype.h \ - subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/v850.h \ - dwarf2dbg.h + $(INCDIR)/elf/v850.h $(INCDIR)/elf/reloc-macros.h dwarf2dbg.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/v850.h DEPTC_xstormy16_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-xstormy16.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ - $(srcdir)/../opcodes/xstormy16-desc.h $(INCDIR)/opcode/cgen.h \ - $(srcdir)/../opcodes/xstormy16-opc.h cgen.h + $(srcdir)/../opcodes/xstormy16-desc.h $(INCDIR)/opcode/cgen-bitset.h \ + $(INCDIR)/opcode/cgen.h $(srcdir)/../opcodes/xstormy16-opc.h \ + cgen.h DEPTC_xstormy16_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-xstormy16.h \ - subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/xstormy16-desc.h \ - $(INCDIR)/opcode/cgen.h $(srcdir)/../opcodes/xstormy16-opc.h \ - cgen.h + dwarf2dbg.h subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/xstormy16-desc.h \ + $(INCDIR)/opcode/cgen-bitset.h $(INCDIR)/opcode/cgen.h \ + $(srcdir)/../opcodes/xstormy16-opc.h cgen.h +DEPTC_xc16x_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-xc16x.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(srcdir)/../opcodes/xc16x-desc.h $(INCDIR)/opcode/cgen.h \ + $(srcdir)/../opcodes/xc16x-opc.h cgen.h DEPTC_xtensa_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-xtensa.h \ - $(INCDIR)/xtensa-config.h sb.h $(INCDIR)/safe-ctype.h \ - subsegs.h $(INCDIR)/obstack.h $(srcdir)/config/xtensa-relax.h \ - $(INCDIR)/xtensa-isa.h $(srcdir)/config/xtensa-istack.h \ + $(INCDIR)/xtensa-isa.h $(INCDIR)/xtensa-config.h sb.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(srcdir)/config/xtensa-relax.h $(srcdir)/config/xtensa-istack.h \ dwarf2dbg.h struc-symbol.h +DEPTC_z80_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-z80.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/z80.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h subsegs.h \ + $(INCDIR)/obstack.h +DEPTC_z80_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-z80.h \ + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h DEPTC_z8k_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-z8k.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/z8k.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ @@ -1550,7 +1563,7 @@ DEPTC_z8k_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPTC_z8k_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-z8k.h \ - $(INCDIR)/safe-ctype.h $(srcdir)/../opcodes/z8k-opc.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h $(srcdir)/../opcodes/z8k-opc.h DEPTC_hppa_som = $(srcdir)/config/tc-hppa.h subsegs.h \ $(INCDIR)/obstack.h $(BFDDIR)/libhppa.h $(INCDIR)/opcode/hppa.h \ $(BFDDIR)/som.h @@ -1559,18 +1572,6 @@ DEPTC_i386_multi = $(DEPTC_i386_aout) $(DEPTC_i386_coff) \ DEPTC_mips_multi = $(DEPTC_mips_coff) $(DEPTC_mips_ecoff) \ $(DEPTC_mips_elf) DEPTC_cris_multi = $(DEPTC_cris_aout) $(DEPTC_cris_elf) -DEPOBJ_a29k_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ - $(srcdir)/config/tc-a29k.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/aout/aout64.h $(INCDIR)/obstack.h -DEPOBJ_a29k_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ - $(srcdir)/config/tc-a29k.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/a29k.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h -DEPOBJ_a29k_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ - $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-a29k.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h DEPOBJ_alpha_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-alpha.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ @@ -1595,8 +1596,8 @@ DEPOBJ_arc_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_arc_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-arc.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_arm_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ $(srcdir)/config/tc-arm.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ $(INCDIR)/aout/aout64.h $(INCDIR)/obstack.h @@ -1616,16 +1617,34 @@ DEPOBJ_avr_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_avr_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-avr.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h +DEPOBJ_bfin_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-bfin.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ + subsegs.h +DEPOBJ_bfin_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-bfin.h \ + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_cris_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ $(srcdir)/config/tc-cris.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ $(INCDIR)/aout/aout64.h $(INCDIR)/obstack.h DEPOBJ_cris_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-cris.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h +DEPOBJ_crx_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-crx.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ + subsegs.h +DEPOBJ_crx_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-crx.h \ + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_d10v_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-d10v.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ @@ -1651,8 +1670,8 @@ DEPOBJ_dlx_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_dlx_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-dlx.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_fr30_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-fr30.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ @@ -1660,8 +1679,8 @@ DEPOBJ_fr30_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_fr30_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-fr30.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_frv_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-frv.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ @@ -1678,17 +1697,8 @@ DEPOBJ_h8300_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_h8300_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8300.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h -DEPOBJ_h8500_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ - $(srcdir)/config/tc-h8500.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/h8500.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h -DEPOBJ_h8500_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ - $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8500.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_hppa_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-hppa.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ @@ -1718,8 +1728,8 @@ DEPOBJ_i370_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_i370_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i370.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/elf/i370.h $(INCDIR)/elf/reloc-macros.h \ + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/elf/i370.h $(INCDIR)/elf/reloc-macros.h \ $(INCDIR)/aout/aout64.h DEPOBJ_i386_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ $(srcdir)/config/tc-i386.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ @@ -1731,15 +1741,14 @@ DEPOBJ_i386_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_i386_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i386.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/elf/x86-64.h $(INCDIR)/elf/reloc-macros.h \ + $(INCDIR)/aout/aout64.h DEPOBJ_i860_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i860.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h -DEPOBJ_i960_bout = $(INCDIR)/symcat.h $(srcdir)/config/obj-bout.h \ - $(srcdir)/config/tc-i960.h $(INCDIR)/obstack.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_i960_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-i960.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/i960.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ @@ -1747,8 +1756,8 @@ DEPOBJ_i960_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_i960_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i960.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_ip2k_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-ip2k.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ @@ -1756,8 +1765,17 @@ DEPOBJ_ip2k_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_ip2k_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ip2k.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h +DEPOBJ_m32c_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-m32c.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ + subsegs.h +DEPOBJ_m32c_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m32c.h \ + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_m32r_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-m32r.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ @@ -1765,8 +1783,8 @@ DEPOBJ_m32r_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_m32r_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m32r.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_m68hc11_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-m68hc11.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ @@ -1774,8 +1792,8 @@ DEPOBJ_m68hc11_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_m68hc11_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m68hc11.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_m68k_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ $(srcdir)/config/tc-m68k.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ $(INCDIR)/aout/aout64.h $(INCDIR)/obstack.h @@ -1788,19 +1806,6 @@ DEPOBJ_m68k_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m68k.h \ $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h -DEPOBJ_m68k_hp300 = $(srcdir)/config/obj-aout.c $(INCDIR)/symcat.h \ - $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-m68k.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/obstack.h -DEPOBJ_m88k_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ - $(srcdir)/config/tc-m88k.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/m88k.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h -DEPOBJ_m88k_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ - $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m88k.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h DEPOBJ_mcore_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-mcore.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/mcore.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ @@ -1808,11 +1813,8 @@ DEPOBJ_mcore_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_mcore_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mcore.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h -DEPOBJ_mips_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ - $(srcdir)/config/tc-mips.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/aout/aout64.h $(INCDIR)/obstack.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_mips_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-mips.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/mipspe.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ @@ -1831,8 +1833,8 @@ DEPOBJ_mips_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ DEPOBJ_mmix_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mmix.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_mn10200_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-mn10200.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ @@ -1840,8 +1842,8 @@ DEPOBJ_mn10200_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_mn10200_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10200.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_mn10300_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-mn10300.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ @@ -1849,8 +1851,8 @@ DEPOBJ_mn10300_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_mn10300_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10300.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_msp430_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-msp430.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ @@ -1858,8 +1860,8 @@ DEPOBJ_msp430_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_msp430_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-msp430.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_ns32k_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ $(srcdir)/config/tc-ns32k.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ $(INCDIR)/aout/aout64.h $(INCDIR)/obstack.h @@ -1870,8 +1872,8 @@ DEPOBJ_ns32k_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_ns32k_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ns32k.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_openrisc_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-openrisc.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ @@ -1879,8 +1881,8 @@ DEPOBJ_openrisc_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_openrisc_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-openrisc.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_or32_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-or32.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/or32.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ @@ -1888,8 +1890,8 @@ DEPOBJ_or32_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_or32_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-or32.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_pdp11_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ $(srcdir)/config/tc-pdp11.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ $(INCDIR)/aout/aout64.h $(INCDIR)/obstack.h @@ -1900,8 +1902,8 @@ DEPOBJ_pdp11_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_pdp11_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-pdp11.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_pj_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-pj.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ @@ -1909,8 +1911,8 @@ DEPOBJ_pj_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_pj_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-pj.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_ppc_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-ppc.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/rs6000.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ @@ -1918,8 +1920,8 @@ DEPOBJ_ppc_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_ppc_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ppc.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h \ + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h \ $(INCDIR)/aout/aout64.h DEPOBJ_s390_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-s390.h $(INCDIR)/coff/internal.h \ @@ -1928,8 +1930,8 @@ DEPOBJ_s390_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_s390_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-s390.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_sh_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-sh.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/sh.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ @@ -1955,20 +1957,8 @@ DEPOBJ_sparc_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_sparc_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sparc.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h -DEPOBJ_tahoe_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ - $(srcdir)/config/tc-tahoe.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/aout/aout64.h $(INCDIR)/obstack.h -DEPOBJ_tahoe_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ - $(srcdir)/config/tc-tahoe.h $(INCDIR)/coff/internal.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ - subsegs.h -DEPOBJ_tahoe_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ - $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tahoe.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_tic30_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ $(srcdir)/config/tc-tic30.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ $(INCDIR)/aout/aout64.h $(INCDIR)/obstack.h @@ -1979,8 +1969,8 @@ DEPOBJ_tic30_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_tic30_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic30.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_tic4x_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-tic4x.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/tic4x.h $(INCDIR)/coff/ti.h $(BFDDIR)/libcoff.h \ @@ -1988,8 +1978,8 @@ DEPOBJ_tic4x_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_tic4x_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic4x.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_tic54x_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-tic54x.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/tic54x.h $(INCDIR)/coff/ti.h $(BFDDIR)/libcoff.h \ @@ -1999,15 +1989,6 @@ DEPOBJ_tic54x_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic54x.h \ $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h -DEPOBJ_tic80_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ - $(srcdir)/config/tc-tic80.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/tic80.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h -DEPOBJ_tic80_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ - $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic80.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h DEPOBJ_vax_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ $(srcdir)/config/tc-vax.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ $(INCDIR)/aout/aout64.h $(INCDIR)/obstack.h @@ -2018,21 +1999,8 @@ DEPOBJ_vax_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_vax_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-vax.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h -DEPOBJ_vax_vms = $(INCDIR)/symcat.h $(srcdir)/config/obj-vms.h \ - $(srcdir)/config/tc-vax.h $(INCDIR)/aout/stab_gnu.h \ - $(INCDIR)/aout/stab.def $(INCDIR)/safe-ctype.h subsegs.h \ - $(INCDIR)/obstack.h -DEPOBJ_w65_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ - $(srcdir)/config/tc-w65.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/w65.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h -DEPOBJ_w65_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ - $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-w65.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_v850_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-v850.h $(INCDIR)/elf/v850.h $(INCDIR)/elf/reloc-macros.h \ $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ @@ -2040,9 +2008,9 @@ DEPOBJ_v850_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_v850_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-v850.h \ - $(INCDIR)/elf/v850.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/safe-ctype.h \ - subsegs.h $(INCDIR)/obstack.h struc-symbol.h dwarf2dbg.h \ - $(INCDIR)/aout/aout64.h + $(INCDIR)/elf/v850.h $(INCDIR)/elf/reloc-macros.h dwarf2dbg.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_xstormy16_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-xstormy16.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ @@ -2050,13 +2018,28 @@ DEPOBJ_xstormy16_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_xstormy16_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-xstormy16.h \ + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h +DEPOBJ_xc16x_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-xc16x.h \ $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h DEPOBJ_xtensa_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-xtensa.h \ - $(INCDIR)/xtensa-config.h $(INCDIR)/safe-ctype.h subsegs.h \ - $(INCDIR)/obstack.h struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + $(INCDIR)/xtensa-isa.h $(INCDIR)/xtensa-config.h $(INCDIR)/safe-ctype.h \ + subsegs.h $(INCDIR)/obstack.h struc-symbol.h dwarf2dbg.h \ + $(INCDIR)/aout/aout64.h +DEPOBJ_z80_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-z80.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/z80.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h +DEPOBJ_z80_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-z80.h \ + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_z8k_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-z8k.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/z8k.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ @@ -2064,8 +2047,8 @@ DEPOBJ_z8k_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_z8k_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-z8k.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_hppa_som = $(srcdir)/config/obj-som.h subsegs.h \ $(INCDIR)/obstack.h $(BFDDIR)/libhppa.h $(BFDDIR)/som.h \ $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def @@ -2074,14 +2057,6 @@ DEPOBJ_i386_multi = $(DEPOBJ_i386_aout) $(DEPOBJ_i386_coff) \ DEPOBJ_mips_multi = $(DEPOBJ_mips_coff) $(DEPOBJ_mips_ecoff) \ $(DEPOBJ_mips_elf) DEPOBJ_cris_multi = $(DEPOBJ_cris_aout) $(DEPOBJ_cris_elf) -DEP_a29k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-a29k.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h -DEP_a29k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-a29k.h \ - $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/a29k.h \ - $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_a29k_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ - $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-a29k.h DEP_alpha_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-alpha.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ $(INCDIR)/bfdlink.h @@ -2096,7 +2071,8 @@ DEP_arc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-arc.h \ $(INCDIR)/bfdlink.h DEP_arc_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-arc.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-arc.h \ + dwarf2dbg.h DEP_arm_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-arm.h \ $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h DEP_arm_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-arm.h \ @@ -2110,12 +2086,28 @@ DEP_avr_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-avr.h \ $(INCDIR)/bfdlink.h DEP_avr_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-avr.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-avr.h \ + dwarf2dbg.h +DEP_bfin_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-bfin.h \ + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h +DEP_bfin_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-bfin.h \ + dwarf2dbg.h DEP_cris_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-cris.h \ $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h DEP_cris_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-cris.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-cris.h \ + dwarf2dbg.h +DEP_crx_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-crx.h \ + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h +DEP_crx_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-crx.h \ + dwarf2dbg.h DEP_d10v_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-d10v.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ $(INCDIR)/bfdlink.h @@ -2133,13 +2125,15 @@ DEP_dlx_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-dlx.h \ $(INCDIR)/bfdlink.h DEP_dlx_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-dlx.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-dlx.h \ + dwarf2dbg.h DEP_fr30_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-fr30.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ $(INCDIR)/bfdlink.h DEP_fr30_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-fr30.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-fr30.h \ + dwarf2dbg.h DEP_frv_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-frv.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ $(INCDIR)/bfdlink.h @@ -2151,13 +2145,8 @@ DEP_h8300_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-h8300.h \ $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h DEP_h8300_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8300.h -DEP_h8500_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-h8500.h \ - $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/h8500.h \ - $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_h8500_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ - $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8500.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8300.h \ + dwarf2dbg.h DEP_hppa_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-hppa.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ $(INCDIR)/bfdlink.h @@ -2179,7 +2168,8 @@ DEP_i370_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i370.h \ $(INCDIR)/bfdlink.h DEP_i370_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i370.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i370.h \ + dwarf2dbg.h DEP_i386_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-i386.h \ $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h DEP_i386_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i386.h \ @@ -2187,35 +2177,47 @@ DEP_i386_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i386.h \ $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h DEP_i386_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i386.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i386.h \ + dwarf2dbg.h DEP_i860_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i860.h -DEP_i960_bout = $(srcdir)/config/obj-bout.h $(srcdir)/config/tc-i960.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i860.h \ + dwarf2dbg.h DEP_i960_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i960.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/i960.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h DEP_i960_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i960.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i960.h \ + dwarf2dbg.h DEP_ip2k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ip2k.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ $(INCDIR)/bfdlink.h DEP_ip2k_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ip2k.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ip2k.h \ + dwarf2dbg.h +DEP_m32c_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m32c.h \ + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h +DEP_m32c_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m32c.h \ + dwarf2dbg.h DEP_m32r_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m32r.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ $(INCDIR)/bfdlink.h DEP_m32r_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m32r.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m32r.h \ + dwarf2dbg.h DEP_m68hc11_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m68hc11.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/m68k.h \ $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h DEP_m68hc11_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m68hc11.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m68hc11.h \ + dwarf2dbg.h DEP_m68k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-m68k.h \ $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h DEP_m68k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m68k.h \ @@ -2224,22 +2226,13 @@ DEP_m68k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m68k.h \ DEP_m68k_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m68k.h -DEP_m68k_hp300 = $(srcdir)/config/obj-hp300.h $(srcdir)/config/obj-aout.h \ - $(srcdir)/config/tc-m68k.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h -DEP_m88k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m88k.h \ - $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/m88k.h \ - $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_m88k_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ - $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m88k.h DEP_mcore_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mcore.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/mcore.h \ $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h DEP_mcore_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mcore.h -DEP_mips_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-mips.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mcore.h \ + dwarf2dbg.h DEP_mips_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mips.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/mipspe.h \ $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h @@ -2250,25 +2243,29 @@ DEP_mips_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mips.h DEP_mmix_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mmix.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mmix.h \ + dwarf2dbg.h DEP_mn10200_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mn10200.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ $(INCDIR)/bfdlink.h DEP_mn10200_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10200.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10200.h \ + dwarf2dbg.h DEP_mn10300_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mn10300.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ $(INCDIR)/bfdlink.h DEP_mn10300_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10300.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10300.h \ + dwarf2dbg.h DEP_msp430_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-msp430.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ $(INCDIR)/bfdlink.h DEP_msp430_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-msp430.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-msp430.h \ + dwarf2dbg.h DEP_ns32k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-ns32k.h \ $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h DEP_ns32k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ns32k.h \ @@ -2276,19 +2273,22 @@ DEP_ns32k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ns32k.h \ $(INCDIR)/bfdlink.h DEP_ns32k_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ns32k.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ns32k.h \ + dwarf2dbg.h DEP_openrisc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-openrisc.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ $(INCDIR)/bfdlink.h DEP_openrisc_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-openrisc.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-openrisc.h \ + dwarf2dbg.h DEP_or32_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-or32.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/or32.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h DEP_or32_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-or32.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-or32.h \ + dwarf2dbg.h DEP_pdp11_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-pdp11.h \ $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h DEP_pdp11_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-pdp11.h \ @@ -2296,25 +2296,29 @@ DEP_pdp11_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-pdp11.h \ $(INCDIR)/bfdlink.h DEP_pdp11_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-pdp11.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-pdp11.h \ + dwarf2dbg.h DEP_pj_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-pj.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ $(INCDIR)/bfdlink.h DEP_pj_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-pj.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-pj.h \ + dwarf2dbg.h DEP_ppc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ppc.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/rs6000.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h DEP_ppc_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ppc.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ppc.h \ + dwarf2dbg.h DEP_s390_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-s390.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ $(INCDIR)/bfdlink.h DEP_s390_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-s390.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-s390.h \ + dwarf2dbg.h DEP_sh_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-sh.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/sh.h \ $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h @@ -2333,15 +2337,8 @@ DEP_sparc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-sparc.h \ $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h DEP_sparc_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sparc.h -DEP_tahoe_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-tahoe.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h -DEP_tahoe_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tahoe.h \ - $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ - $(INCDIR)/bfdlink.h -DEP_tahoe_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ - $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tahoe.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sparc.h \ + dwarf2dbg.h DEP_tic30_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-tic30.h \ $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h DEP_tic30_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic30.h \ @@ -2349,25 +2346,21 @@ DEP_tic30_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic30.h \ $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h DEP_tic30_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic30.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic30.h \ + dwarf2dbg.h DEP_tic4x_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic4x.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic4x.h \ $(INCDIR)/coff/ti.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h DEP_tic4x_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic4x.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic4x.h \ + dwarf2dbg.h DEP_tic54x_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic54x.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic54x.h \ $(INCDIR)/coff/ti.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h DEP_tic54x_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic54x.h -DEP_tic80_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic80.h \ - $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic80.h \ - $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_tic80_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ - $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic80.h DEP_vax_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-vax.h \ $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h DEP_vax_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-vax.h \ @@ -2375,38 +2368,43 @@ DEP_vax_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-vax.h \ $(INCDIR)/bfdlink.h DEP_vax_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-vax.h -DEP_vax_vms = $(srcdir)/config/obj-vms.h $(srcdir)/config/tc-vax.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def -DEP_w65_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-w65.h \ - $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/w65.h \ - $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h -DEP_w65_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ - $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-w65.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-vax.h \ + dwarf2dbg.h DEP_v850_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-v850.h \ $(INCDIR)/elf/v850.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/symcat.h \ $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h DEP_v850_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-v850.h \ - $(INCDIR)/elf/v850.h $(INCDIR)/elf/reloc-macros.h + $(INCDIR)/elf/v850.h $(INCDIR)/elf/reloc-macros.h dwarf2dbg.h DEP_xstormy16_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-xstormy16.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ $(INCDIR)/bfdlink.h DEP_xstormy16_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-xstormy16.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-xstormy16.h \ + dwarf2dbg.h +DEP_xc16x_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-xc16x.h DEP_xtensa_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-xtensa.h \ - $(INCDIR)/xtensa-config.h + $(INCDIR)/xtensa-isa.h $(INCDIR)/xtensa-config.h +DEP_z80_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-z80.h \ + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/z80.h \ + $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h +DEP_z80_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-z80.h \ + dwarf2dbg.h DEP_z8k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-z8k.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/z8k.h \ $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h DEP_z8k_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-z8k.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-z8k.h \ + dwarf2dbg.h DEP_hppa_som = $(BFDDIR)/som.h DEP_i386_multi = $(DEP_i386_aout) $(DEP_i386_coff) \ $(DEP_i386_elf) @@ -2420,11 +2418,10 @@ as.o: as.c $(INCDIR)/symcat.h subsegs.h $(INCDIR)/obstack.h \ output-file.h sb.h macro.h dwarf2dbg.h dw2gencfi.h \ $(INCDIR)/elf/dwarf2.h $(BFDVER_H) atof-generic.o: atof-generic.c $(INCDIR)/symcat.h $(INCDIR)/safe-ctype.h -bignum-copy.o: bignum-copy.c $(INCDIR)/symcat.h cond.o: cond.c $(INCDIR)/symcat.h macro.h sb.h $(INCDIR)/obstack.h depend.o: depend.c $(INCDIR)/symcat.h -dwarf2dbg.o: dwarf2dbg.c $(INCDIR)/symcat.h dwarf2dbg.h \ - $(INCDIR)/filenames.h subsegs.h $(INCDIR)/obstack.h \ +dwarf2dbg.o: dwarf2dbg.c $(INCDIR)/symcat.h $(INCDIR)/safe-ctype.h \ + dwarf2dbg.h $(INCDIR)/filenames.h subsegs.h $(INCDIR)/obstack.h \ $(INCDIR)/elf/dwarf2.h dw2gencfi.o: dw2gencfi.c $(INCDIR)/symcat.h dw2gencfi.h \ $(INCDIR)/elf/dwarf2.h @@ -2446,13 +2443,14 @@ input-scrub.o: input-scrub.c $(INCDIR)/symcat.h input-file.h \ listing.o: listing.c $(INCDIR)/symcat.h $(INCDIR)/obstack.h \ $(INCDIR)/safe-ctype.h input-file.h subsegs.h literal.o: literal.c $(INCDIR)/symcat.h subsegs.h $(INCDIR)/obstack.h -macro.o: macro.c $(INCDIR)/safe-ctype.h sb.h macro.h +macro.o: macro.c $(INCDIR)/symcat.h $(INCDIR)/safe-ctype.h \ + sb.h macro.h messages.o: messages.c $(INCDIR)/symcat.h output-file.o: output-file.c $(INCDIR)/symcat.h output-file.h read.o: read.c $(INCDIR)/symcat.h $(INCDIR)/safe-ctype.h \ subsegs.h $(INCDIR)/obstack.h sb.h macro.h ecoff.h \ dw2gencfi.h $(INCDIR)/elf/dwarf2.h -sb.o: sb.c sb.h +sb.o: sb.c sb.h $(INCDIR)/symcat.h stabs.o: stabs.c $(INCDIR)/symcat.h $(INCDIR)/obstack.h \ subsegs.h ecoff.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def subsegs.o: subsegs.c $(INCDIR)/symcat.h subsegs.h $(INCDIR)/obstack.h diff --git a/contrib/binutils/gas/Makefile.in b/contrib/binutils/gas/Makefile.in index 67ed432b303..4cc485f9683 100644 --- a/contrib/binutils/gas/Makefile.in +++ b/contrib/binutils/gas/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.8.4 from Makefile.am. +# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. +# 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -15,8 +15,6 @@ @SET_MAKE@ -SOURCES = $(as_new_SOURCES) $(EXTRA_as_new_SOURCES) $(itbl_test_SOURCES) - srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ @@ -47,14 +45,15 @@ DIST_COMMON = $(srcdir)/../config.guess $(srcdir)/../config.sub NEWS \ $(top_srcdir)/configure $(am__configure_deps) \ $(srcdir)/config.in $(srcdir)/../mkinstalldirs \ $(srcdir)/gdbinit.in $(srcdir)/gdbinit.in \ - $(top_srcdir)/po/Make-in m68k-parse.c itbl-parse.c itbl-lex.c \ - $(srcdir)/../ylwrap $(srcdir)/../ltmain.sh \ - $(srcdir)/../config.guess $(srcdir)/../config.sub + $(top_srcdir)/po/Make-in m68k-parse.c bfin-parse.c \ + itbl-parse.c itbl-lex.c $(srcdir)/../ylwrap \ + $(srcdir)/../ltmain.sh $(srcdir)/../config.guess \ + $(srcdir)/../config.sub subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/../libtool.m4 $(top_srcdir)/../gettext.m4 \ - $(top_srcdir)/configure.in + $(top_srcdir)/../bfd/warning.m4 $(top_srcdir)/../libtool.m4 \ + $(top_srcdir)/../gettext.m4 $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ @@ -64,15 +63,15 @@ CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = gdb.ini .gdbinit po/Makefile.in PROGRAMS = $(noinst_PROGRAMS) am__objects_1 = app.$(OBJEXT) as.$(OBJEXT) atof-generic.$(OBJEXT) \ - bignum-copy.$(OBJEXT) cond.$(OBJEXT) depend.$(OBJEXT) \ - dwarf2dbg.$(OBJEXT) dw2gencfi.$(OBJEXT) ecoff.$(OBJEXT) \ - ehopt.$(OBJEXT) expr.$(OBJEXT) flonum-copy.$(OBJEXT) \ - flonum-konst.$(OBJEXT) flonum-mult.$(OBJEXT) frags.$(OBJEXT) \ - hash.$(OBJEXT) input-file.$(OBJEXT) input-scrub.$(OBJEXT) \ - listing.$(OBJEXT) literal.$(OBJEXT) macro.$(OBJEXT) \ - messages.$(OBJEXT) output-file.$(OBJEXT) read.$(OBJEXT) \ - sb.$(OBJEXT) stabs.$(OBJEXT) subsegs.$(OBJEXT) \ - symbols.$(OBJEXT) write.$(OBJEXT) + cond.$(OBJEXT) depend.$(OBJEXT) dwarf2dbg.$(OBJEXT) \ + dw2gencfi.$(OBJEXT) ecoff.$(OBJEXT) ehopt.$(OBJEXT) \ + expr.$(OBJEXT) flonum-copy.$(OBJEXT) flonum-konst.$(OBJEXT) \ + flonum-mult.$(OBJEXT) frags.$(OBJEXT) hash.$(OBJEXT) \ + input-file.$(OBJEXT) input-scrub.$(OBJEXT) listing.$(OBJEXT) \ + literal.$(OBJEXT) macro.$(OBJEXT) messages.$(OBJEXT) \ + output-file.$(OBJEXT) read.$(OBJEXT) sb.$(OBJEXT) \ + stabs.$(OBJEXT) subsegs.$(OBJEXT) symbols.$(OBJEXT) \ + write.$(OBJEXT) am_as_new_OBJECTS = $(am__objects_1) as_new_OBJECTS = $(am_as_new_OBJECTS) am__DEPENDENCIES_1 = tc-@target_cpu_type@.o @@ -103,8 +102,6 @@ LTYACCCOMPILE = $(LIBTOOL) --mode=compile $(YACC) $(YFLAGS) \ YLWRAP = $(top_srcdir)/../ylwrap SOURCES = $(as_new_SOURCES) $(EXTRA_as_new_SOURCES) \ $(itbl_test_SOURCES) -DIST_SOURCES = $(as_new_SOURCES) $(EXTRA_as_new_SOURCES) \ - $(itbl_test_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-exec-recursive install-info-recursive \ @@ -173,6 +170,7 @@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MKINSTALLDIRS = @MKINSTALLDIRS@ MSGFMT = @MSGFMT@ +NO_WERROR = @NO_WERROR@ OBJEXT = @OBJEXT@ OPCODES_LIB = @OPCODES_LIB@ PACKAGE = @PACKAGE@ @@ -202,6 +200,8 @@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ atof = @atof@ bindir = @bindir@ build = @build@ @@ -211,6 +211,8 @@ build_os = @build_os@ build_vendor = @build_vendor@ cgen_cpu_prefix = @cgen_cpu_prefix@ datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ exec_prefix = @exec_prefix@ extra_objects = @extra_objects@ host = @host@ @@ -218,6 +220,7 @@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ +htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ @@ -269,19 +272,19 @@ IT_OBJS = itbl-parse.o itbl-lex.o itbl-ops.o # CPU types. This is only used for dependency information. CPU_TYPES = \ - a29k \ alpha \ arc \ arm \ avr \ + bfin \ cris \ + crx \ d10v \ d30v \ dlx \ fr30 \ frv \ h8300 \ - h8500 \ hppa \ ia64 \ i370 \ @@ -289,10 +292,10 @@ CPU_TYPES = \ i860 \ i960 \ ip2k \ + m32c \ m32r \ m68hc11 \ m68k \ - m88k \ mcore \ mips \ mmix \ @@ -309,16 +312,15 @@ CPU_TYPES = \ sh \ sh64 \ sparc \ - tahoe \ tic30 \ tic4x \ tic54x \ - tic80 \ vax \ - w65 \ v850 \ xstormy16 \ + xc16x \ xtensa \ + z80 \ z8k @@ -326,14 +328,11 @@ CPU_TYPES = \ # We deliberately omit SOM, since it does not work as a cross assembler. OBJ_FORMATS = \ aout \ - bout \ coff \ ecoff \ elf \ evax \ - hp300 \ - ieee \ - vms + ieee # This is an sh case which sets valid according to whether the CPU @@ -345,13 +344,9 @@ CPU_OBJ_VALID = \ case $$o in \ aout) \ case $$c in \ - a29k | arm | cris | i386 | m68k | ns32k | pdp11 | sparc | tahoe | tic30 | vax) \ + arm | cris | i386 | m68k | ns32k | pdp11 | sparc | tic30 | vax) \ valid=yes ;; \ esac ;; \ - bout) \ - case $$c in \ - i960) valid=yes ;; \ - esac ;; \ coff) valid=yes; \ case $$c in \ cris | i860 | mmix | sh64) \ @@ -366,10 +361,6 @@ CPU_OBJ_VALID = \ case $$c in \ alpha) valid=yes ;; \ esac ;; \ - hp300) \ - case $$c in \ - m68k) valid=yes ;; \ - esac ;; \ vms) \ case $$c in \ vax) valid=yes ;; \ @@ -403,7 +394,6 @@ GAS_CFILES = \ app.c \ as.c \ atof-generic.c \ - bignum-copy.c \ cond.c \ depend.c \ dwarf2dbg.c \ @@ -447,6 +437,7 @@ HFILES = \ frags.h \ hash.h \ input-file.h \ + itbl-lex.h \ itbl-ops.h \ listing.h \ macro.h \ @@ -463,19 +454,19 @@ HFILES = \ # CPU files in config. TARGET_CPU_CFILES = \ - config/tc-a29k.c \ config/tc-alpha.c \ config/tc-arc.c \ config/tc-arm.c \ config/tc-avr.c \ + config/tc-bfin.c \ config/tc-cris.c \ + config/tc-crx.c \ config/tc-d10v.c \ config/tc-d30v.c \ config/tc-dlx.c \ config/tc-fr30.c \ config/tc-frv.c \ config/tc-h8300.c \ - config/tc-h8500.c \ config/tc-hppa.c \ config/tc-ia64.c \ config/tc-i370.c \ @@ -483,10 +474,10 @@ TARGET_CPU_CFILES = \ config/tc-i860.c \ config/tc-i960.c \ config/tc-ip2k.c \ + config/tc-m32c.c \ config/tc-m32r.c \ config/tc-m68hc11.c \ config/tc-m68k.c \ - config/tc-m88k.c \ config/tc-mcore.c \ config/tc-mips.c \ config/tc-mmix.c \ @@ -503,31 +494,30 @@ TARGET_CPU_CFILES = \ config/tc-sh.c \ config/tc-sh64.c \ config/tc-sparc.c \ - config/tc-tahoe.c \ config/tc-tic30.c \ config/tc-tic54x.c \ - config/tc-tic80.c \ config/tc-vax.c \ - config/tc-w65.c \ config/tc-v850.c \ config/tc-xstormy16.c \ + config/tc-xc16x.c \ config/tc-xtensa.c \ + config/tc-z80.c \ config/tc-z8k.c TARGET_CPU_HFILES = \ - config/tc-a29k.h \ config/tc-alpha.h \ config/tc-arc.h \ config/tc-arm.h \ config/tc-avr.h \ + config/tc-bfin.h \ config/tc-cris.h \ + config/tc-crx.h \ config/tc-d10v.h \ config/tc-d30v.h \ config/tc-dlx.h \ config/tc-fr30.h \ config/tc-frv.h \ config/tc-h8300.h \ - config/tc-h8500.h \ config/tc-hppa.h \ config/tc-ia64.h \ config/tc-i370.h \ @@ -535,10 +525,10 @@ TARGET_CPU_HFILES = \ config/tc-i860.h \ config/tc-i960.h \ config/tc-ip2k.h \ + config/tc-m32c.h \ config/tc-m32r.h \ config/tc-m68hc11.h \ config/tc-m68k.h \ - config/tc-m88k.h \ config/tc-mcore.h \ config/tc-mips.h \ config/tc-mmix.h \ @@ -555,47 +545,41 @@ TARGET_CPU_HFILES = \ config/tc-sh.h \ config/tc-sh64.h \ config/tc-sparc.h \ - config/tc-tahoe.h \ config/tc-tic30.h \ config/tc-tic54x.h \ - config/tc-tic80.h \ config/tc-vax.h \ - config/tc-w65.h \ config/tc-v850.h \ config/tc-xstormy16.h \ + config/tc-xc16x.h \ config/tc-xtensa.h \ + config/tc-z80.h \ config/tc-z8k.h # OBJ files in config OBJ_FORMAT_CFILES = \ config/obj-aout.c \ - config/obj-bout.c \ config/obj-coff.c \ config/obj-ecoff.c \ config/obj-elf.c \ config/obj-evax.c \ - config/obj-hp300.c \ config/obj-ieee.c \ - config/obj-som.c \ - config/obj-vms.c + config/obj-som.c OBJ_FORMAT_HFILES = \ config/obj-aout.h \ - config/obj-bout.h \ config/obj-coff.h \ config/obj-ecoff.h \ config/obj-elf.h \ config/obj-evax.h \ - config/obj-hp300.h \ config/obj-ieee.h \ - config/obj-som.h \ - config/obj-vms.h + config/obj-som.h # Emulation header files in config TARG_ENV_HFILES = \ config/te-386bsd.h \ + config/te-armlinuxeabi.h \ config/te-aux.h \ config/te-delta.h \ config/te-delt88.h \ @@ -604,7 +588,6 @@ TARG_ENV_HFILES = \ config/te-epoc-pe.h \ config/te-generic.h \ config/te-go32.h \ - config/te-hp300.h \ config/te-hppa.h \ config/te-hppa64.h \ config/te-hppalinux64.h \ @@ -618,15 +601,15 @@ TARG_ENV_HFILES = \ config/te-macos.h \ config/te-nbsd.h \ config/te-nbsd532.h \ + config/te-netware.h \ config/te-pc532mach.h \ config/te-pe.h \ - config/te-ppcnw.h \ config/te-psos.h \ config/te-riscix.h \ config/te-sparcaout.h \ config/te-sun3.h \ config/te-svr4.h \ - config/te-sysv32.h \ + config/te-symbian.h \ config/te-tmips.h @@ -650,7 +633,6 @@ GENERIC_OBJS = \ app.o \ as.o \ atof-generic.o \ - bignum-copy.o \ cond.o \ depend.o \ dwarf2dbg.o \ @@ -680,11 +662,13 @@ GENERIC_OBJS = \ OBJS = $(CONFIG_OBJS) $(GENERIC_OBJS) POTFILES = $(MULTI_CFILES) $(TARGET_ENV_HFILES) $(OBJ_FORMAT_HFILES) \ $(OBJ_FORMAT_CFILES) $(TARGET_CPU_HFILES) $(TARGET_CPU_CFILES) \ - $(HFILES) $(CFILES) $(GAS_CFILES) + $(HFILES) $(CFILES) noinst_SCRIPTS = $(GDBINIT) EXTRA_SCRIPTS = .gdbinit -EXTRA_DIST = make-gas.com m68k-parse.c itbl-parse.c itbl-parse.h itbl-lex.c +EXTRA_DIST = m68k-parse.c itbl-parse.c itbl-parse.h itbl-lex.c \ + bfin-parse.c bfin-parse.h bfin-lex.c + DISTCLEANFILES = targ-cpu.h obj-format.h targ-env.h itbl-cpu.h cgen-desc.h # Now figure out from those variables how to compile and link. @@ -697,14 +681,14 @@ INCDIR = $(BASEDIR)/include # Both . and srcdir are used, in that order, # so that tm.h and config.h will be found in the compilation # subdirectory rather than in the source directory. -INCLUDES = -D_GNU_SOURCE -I. -I$(srcdir) -I../bfd -I$(srcdir)/config -I$(INCDIR) -I$(srcdir)/.. -I$(BFDDIR) -I$(srcdir)/../intl -I../intl -DLOCALEDIR="\"$(prefix)/share/locale\"" +INCLUDES = -D_GNU_SOURCE -I. -I$(srcdir) -I../bfd -I$(srcdir)/config -I$(INCDIR) -I$(srcdir)/.. -I$(BFDDIR) -I$(srcdir)/../intl -I../intl -DLOCALEDIR="\"$(datadir)/locale\"" # This should be parallel to INCLUDES, but should replace $(srcdir) # with $${srcdir}, and should work in a subdirectory. This is used # when building dependencies, because the dependency building is done # in a subdirectory. -DEP_INCLUDES = -D_GNU_SOURCE -I.. -I$${srcdir} -I../../bfd -I$${srcdir}/config -I$${srcdir}/../include -I$${srcdir}/.. -I$${srcdir}/../bfd -I$${srcdir}/../intl -I../../intl -DLOCALEDIR="\"$(prefix)/share/locale\"" -DEP_FLAGS = -DBFD_ASSEMBLER -DOBJ_MAYBE_ELF \ +DEP_INCLUDES = -D_GNU_SOURCE -I.. -I$${srcdir} -I../../bfd -I$${srcdir}/config -I$${srcdir}/../include -I$${srcdir}/.. -I$${srcdir}/../bfd -I$${srcdir}/../intl -I../../intl -DLOCALEDIR="\"$(datadir)/locale\"" +DEP_FLAGS = -DOBJ_MAYBE_ELF \ -I. -I.. -I$${srcdir} -I../../bfd $(DEP_INCLUDES) @@ -721,18 +705,12 @@ as_new_LDADD = $(TARG_CPU_O) $(OBJ_FORMAT_O) $(ATOF_TARG_O) \ as_new_DEPENDENCIES = $(TARG_CPU_O) $(OBJ_FORMAT_O) $(ATOF_TARG_O) \ $(extra_objects) $(GASLIBS) $(INTLDEPS) -EXPECT = `if [ -f $${rootme}/../expect/expect ] ; then \ - echo $${rootme}/../expect/expect ; \ - else echo expect ; fi` - -RUNTEST = `if [ -f $${srcdir}/../dejagnu/runtest ] ; then \ - echo $${srcdir}/../dejagnu/runtest ; else echo runtest; \ - fi` - +EXPECT = expect +RUNTEST = runtest RUNTESTFLAGS = # The m68k operand parser. -EXTRA_as_new_SOURCES = config/m68k-parse.y +EXTRA_as_new_SOURCES = config/m68k-parse.y config/bfin-parse.y itbl_test_SOURCES = itbl-parse.y itbl-lex.l itbl_test_LDADD = itbl-tops.o itbl-test.o $(GASLIBS) @LEXLIB@ @@ -740,7 +718,7 @@ itbl_test_LDADD = itbl-tops.o itbl-test.o $(GASLIBS) @LEXLIB@ CGEN_CPU_PREFIX = @cgen_cpu_prefix@ # Remake the info files. -MOSTLYCLEANFILES = $(STAGESTUFF) core stamp-mk.com \ +MOSTLYCLEANFILES = $(STAGESTUFF) core \ testsuite/*.o testsuite/*.out testsuite/gas.log testsuite/gas.sum \ testsuite/site.exp site.bak site.exp stage stage1 stage2 @@ -749,33 +727,19 @@ against = stage2 DEP_FILE_DEPS = $(CFILES) $(HFILES) $(TARGET_CPU_CFILES) \ $(TARGET_CPU_HFILES) $(OBJ_FORMAT_CFILES) $(OBJ_FORMAT_HFILES) -CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/configure.in +CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/configure.in $(srcdir)/configure.tgt AMKDEP = #DO NOT PUT ANYTHING BETWEEN THIS LINE AND THE MATCHING WARNING BELOW. -DEPTC_a29k_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ - $(srcdir)/config/tc-a29k.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/a29k.h - -DEPTC_a29k_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ - $(srcdir)/config/tc-a29k.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/a29k.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/a29k.h - -DEPTC_a29k_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ - $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-a29k.h \ - $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/a29k.h - DEPTC_alpha_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-alpha.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h ecoff.h $(INCDIR)/opcode/alpha.h $(INCDIR)/safe-ctype.h \ - $(srcdir)/config/atof-vax.c + struc-symbol.h ecoff.h $(INCDIR)/opcode/alpha.h dw2gencfi.h \ + $(INCDIR)/elf/dwarf2.h $(INCDIR)/safe-ctype.h $(srcdir)/config/atof-vax.c DEPTC_alpha_ecoff = $(INCDIR)/symcat.h $(srcdir)/config/obj-ecoff.h \ $(srcdir)/config/tc-alpha.h ecoff.h $(INCDIR)/coff/sym.h \ $(INCDIR)/coff/ecoff.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h $(INCDIR)/opcode/alpha.h $(INCDIR)/safe-ctype.h \ - $(srcdir)/config/atof-vax.c + struc-symbol.h $(INCDIR)/opcode/alpha.h dw2gencfi.h \ + $(INCDIR)/elf/dwarf2.h $(INCDIR)/safe-ctype.h $(srcdir)/config/atof-vax.c DEPTC_alpha_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ @@ -788,8 +752,8 @@ DEPTC_alpha_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ DEPTC_alpha_evax = $(INCDIR)/symcat.h $(srcdir)/config/obj-evax.h \ $(srcdir)/config/tc-alpha.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h ecoff.h $(INCDIR)/opcode/alpha.h $(INCDIR)/safe-ctype.h \ - $(srcdir)/config/atof-vax.c + struc-symbol.h ecoff.h $(INCDIR)/opcode/alpha.h dw2gencfi.h \ + $(INCDIR)/elf/dwarf2.h $(INCDIR)/safe-ctype.h $(srcdir)/config/atof-vax.c DEPTC_arc_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-arc.h $(INCDIR)/coff/internal.h \ @@ -801,25 +765,27 @@ DEPTC_arc_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPTC_arc_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-arc.h \ - struc-symbol.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - $(INCDIR)/opcode/arc.h $(srcdir)/../opcodes/arc-ext.h \ - $(INCDIR)/elf/arc.h $(INCDIR)/elf/reloc-macros.h dwarf2dbg.h + dwarf2dbg.h struc-symbol.h $(INCDIR)/safe-ctype.h subsegs.h \ + $(INCDIR)/obstack.h $(INCDIR)/opcode/arc.h $(srcdir)/../opcodes/arc-ext.h \ + $(INCDIR)/elf/arc.h $(INCDIR)/elf/reloc-macros.h DEPTC_arm_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ $(srcdir)/config/tc-arm.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/arm.h DEPTC_arm_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-arm.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h subsegs.h \ - $(INCDIR)/obstack.h + $(INCDIR)/obstack.h $(INCDIR)/opcode/arm.h DEPTC_arm_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-arm.h \ $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - $(INCDIR)/elf/arm.h $(INCDIR)/elf/reloc-macros.h dwarf2dbg.h + $(INCDIR)/opcode/arm.h $(INCDIR)/elf/arm.h $(INCDIR)/elf/reloc-macros.h \ + dwarf2dbg.h dw2gencfi.h $(INCDIR)/elf/dwarf2.h DEPTC_avr_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-avr.h $(INCDIR)/coff/internal.h \ @@ -829,9 +795,27 @@ DEPTC_avr_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPTC_avr_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-avr.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ $(INCDIR)/opcode/avr.h +DEPTC_bfin_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-bfin.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h struc-symbol.h \ + $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h dwarf2dbg.h \ + $(INCDIR)/obstack.h $(INCDIR)/safe-ctype.h \ + $(srcdir)/config/bfin-aux.h $(INCDIR)/opcode/bfin.h \ + $(srcdir)/config/bfin-defs.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/bfin.h $(BFDDIR)/libbfd.h + +DEPTC_bfin_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-bfin.h \ + dwarf2dbg.h struc-symbol.h $(srcdir)/config/bfin-defs.h \ + $(INCDIR)/obstack.h $(INCDIR)/safe-ctype.h $(srcdir)/config/bfin-aux.h \ + $(INCDIR)/opcode/bfin.h $(srcdir)/config/bfin-defs.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/bfin.h $(BFDDIR)/libbfd.h + DEPTC_cris_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ $(srcdir)/config/tc-cris.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ @@ -840,8 +824,20 @@ DEPTC_cris_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ DEPTC_cris_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-cris.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - $(INCDIR)/opcode/cris.h dwarf2dbg.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/cris.h + +DEPTC_crx_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-crx.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ + dwarf2dbg.h $(INCDIR)/opcode/crx.h $(INCDIR)/elf/crx.h \ + $(INCDIR)/elf/reloc-macros.h + +DEPTC_crx_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-crx.h \ + dwarf2dbg.h $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/crx.h \ + $(INCDIR)/elf/crx.h $(INCDIR)/elf/reloc-macros.h DEPTC_d10v_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-d10v.h $(INCDIR)/coff/internal.h \ @@ -874,35 +870,38 @@ DEPTC_dlx_coff = $(INCDIR)/safe-ctype.h $(INCDIR)/symcat.h \ DEPTC_dlx_elf = $(INCDIR)/safe-ctype.h $(INCDIR)/symcat.h \ $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ - $(srcdir)/config/tc-dlx.h $(INCDIR)/opcode/dlx.h + $(srcdir)/config/tc-dlx.h dwarf2dbg.h $(INCDIR)/opcode/dlx.h DEPTC_fr30_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-fr30.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/fr30-desc.h \ - $(INCDIR)/opcode/cgen.h $(srcdir)/../opcodes/fr30-opc.h \ - cgen.h + $(INCDIR)/opcode/cgen-bitset.h $(INCDIR)/opcode/cgen.h \ + $(srcdir)/../opcodes/fr30-opc.h cgen.h DEPTC_fr30_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-fr30.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - $(srcdir)/../opcodes/fr30-desc.h $(INCDIR)/opcode/cgen.h \ - $(srcdir)/../opcodes/fr30-opc.h cgen.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(srcdir)/../opcodes/fr30-desc.h $(INCDIR)/opcode/cgen-bitset.h \ + $(INCDIR)/opcode/cgen.h $(srcdir)/../opcodes/fr30-opc.h \ + cgen.h DEPTC_frv_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-frv.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ - $(srcdir)/../opcodes/frv-desc.h $(INCDIR)/opcode/cgen.h \ - $(srcdir)/../opcodes/frv-opc.h cgen.h $(BFDDIR)/libbfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/frv.h $(INCDIR)/elf/reloc-macros.h + $(srcdir)/../opcodes/frv-desc.h $(INCDIR)/opcode/cgen-bitset.h \ + $(INCDIR)/opcode/cgen.h $(srcdir)/../opcodes/frv-opc.h \ + cgen.h $(BFDDIR)/libbfd.h $(INCDIR)/hashtab.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/frv.h $(INCDIR)/elf/reloc-macros.h DEPTC_frv_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-frv.h \ subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/frv-desc.h \ - $(INCDIR)/opcode/cgen.h $(srcdir)/../opcodes/frv-opc.h \ - cgen.h $(BFDDIR)/libbfd.h $(INCDIR)/elf/frv.h $(INCDIR)/elf/reloc-macros.h + $(INCDIR)/opcode/cgen-bitset.h $(INCDIR)/opcode/cgen.h \ + $(srcdir)/../opcodes/frv-opc.h cgen.h $(BFDDIR)/libbfd.h \ + $(INCDIR)/hashtab.h $(INCDIR)/elf/frv.h $(INCDIR)/elf/reloc-macros.h DEPTC_h8300_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-h8300.h $(INCDIR)/coff/internal.h \ @@ -913,21 +912,9 @@ DEPTC_h8300_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPTC_h8300_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8300.h \ - subsegs.h $(INCDIR)/obstack.h dwarf2dbg.h $(INCDIR)/opcode/h8300.h \ + dwarf2dbg.h subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/h8300.h \ $(INCDIR)/safe-ctype.h $(INCDIR)/elf/h8.h $(INCDIR)/elf/reloc-macros.h -DEPTC_h8500_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ - $(srcdir)/config/tc-h8500.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/h8500.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ - $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/h8500-opc.h \ - $(INCDIR)/safe-ctype.h - -DEPTC_h8500_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ - $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8500.h \ - subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/h8500-opc.h \ - $(INCDIR)/safe-ctype.h - DEPTC_hppa_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-hppa.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ @@ -961,38 +948,36 @@ DEPTC_i370_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPTC_i370_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i370.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ struc-symbol.h $(INCDIR)/opcode/i370.h $(INCDIR)/elf/i370.h \ $(INCDIR)/elf/reloc-macros.h DEPTC_i386_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ $(srcdir)/config/tc-i386.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - dwarf2dbg.h dw2gencfi.h $(INCDIR)/elf/dwarf2.h $(INCDIR)/opcode/i386.h + dwarf2dbg.h dw2gencfi.h $(INCDIR)/elf/dwarf2.h $(INCDIR)/opcode/i386.h \ + $(INCDIR)/elf/x86-64.h $(INCDIR)/elf/reloc-macros.h DEPTC_i386_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-i386.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h subsegs.h \ $(INCDIR)/obstack.h dwarf2dbg.h dw2gencfi.h $(INCDIR)/elf/dwarf2.h \ - $(INCDIR)/opcode/i386.h + $(INCDIR)/opcode/i386.h $(INCDIR)/elf/x86-64.h $(INCDIR)/elf/reloc-macros.h DEPTC_i386_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i386.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - dwarf2dbg.h dw2gencfi.h $(INCDIR)/elf/dwarf2.h $(INCDIR)/opcode/i386.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + dw2gencfi.h $(INCDIR)/elf/dwarf2.h $(INCDIR)/opcode/i386.h \ + $(INCDIR)/elf/x86-64.h $(INCDIR)/elf/reloc-macros.h DEPTC_i860_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i860.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ $(INCDIR)/opcode/i860.h $(INCDIR)/elf/i860.h $(INCDIR)/elf/reloc-macros.h -DEPTC_i960_bout = $(INCDIR)/symcat.h $(srcdir)/config/obj-bout.h \ - $(srcdir)/config/tc-i960.h $(INCDIR)/safe-ctype.h $(INCDIR)/obstack.h \ - $(INCDIR)/opcode/i960.h - DEPTC_i960_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-i960.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/i960.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \ @@ -1001,36 +986,60 @@ DEPTC_i960_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPTC_i960_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i960.h \ - $(INCDIR)/safe-ctype.h $(INCDIR)/obstack.h $(INCDIR)/opcode/i960.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/i960.h DEPTC_ip2k_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-ip2k.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ - $(srcdir)/../opcodes/ip2k-desc.h $(INCDIR)/opcode/cgen.h \ - $(srcdir)/../opcodes/ip2k-opc.h cgen.h $(INCDIR)/elf/common.h \ - $(INCDIR)/elf/ip2k.h $(INCDIR)/elf/reloc-macros.h $(BFDDIR)/libbfd.h + $(srcdir)/../opcodes/ip2k-desc.h $(INCDIR)/opcode/cgen-bitset.h \ + $(INCDIR)/opcode/cgen.h $(srcdir)/../opcodes/ip2k-opc.h \ + cgen.h $(INCDIR)/elf/common.h $(INCDIR)/elf/ip2k.h \ + $(INCDIR)/elf/reloc-macros.h $(BFDDIR)/libbfd.h $(INCDIR)/hashtab.h DEPTC_ip2k_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ip2k.h \ - subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/ip2k-desc.h \ - $(INCDIR)/opcode/cgen.h $(srcdir)/../opcodes/ip2k-opc.h \ - cgen.h $(INCDIR)/elf/ip2k.h $(INCDIR)/elf/reloc-macros.h \ - $(BFDDIR)/libbfd.h + dwarf2dbg.h subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/ip2k-desc.h \ + $(INCDIR)/opcode/cgen-bitset.h $(INCDIR)/opcode/cgen.h \ + $(srcdir)/../opcodes/ip2k-opc.h cgen.h $(INCDIR)/elf/ip2k.h \ + $(INCDIR)/elf/reloc-macros.h $(BFDDIR)/libbfd.h $(INCDIR)/hashtab.h + +DEPTC_m32c_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-m32c.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ + $(srcdir)/../opcodes/m32c-desc.h $(INCDIR)/opcode/cgen-bitset.h \ + $(INCDIR)/opcode/cgen.h $(srcdir)/../opcodes/m32c-opc.h \ + $(srcdir)/../opcodes/cgen-types.h $(srcdir)/../opcodes/cgen-ops.h \ + cgen.h $(INCDIR)/elf/common.h $(INCDIR)/elf/m32c.h \ + $(INCDIR)/elf/reloc-macros.h $(BFDDIR)/libbfd.h $(INCDIR)/hashtab.h \ + $(INCDIR)/safe-ctype.h + +DEPTC_m32c_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m32c.h \ + dwarf2dbg.h subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/m32c-desc.h \ + $(INCDIR)/opcode/cgen-bitset.h $(INCDIR)/opcode/cgen.h \ + $(srcdir)/../opcodes/m32c-opc.h $(srcdir)/../opcodes/cgen-types.h \ + $(srcdir)/../opcodes/cgen-ops.h cgen.h $(INCDIR)/elf/m32c.h \ + $(INCDIR)/elf/reloc-macros.h $(BFDDIR)/libbfd.h $(INCDIR)/hashtab.h \ + $(INCDIR)/safe-ctype.h DEPTC_m32r_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-m32r.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/m32r-desc.h \ - $(INCDIR)/opcode/cgen.h $(srcdir)/../opcodes/m32r-opc.h \ - cgen.h + $(INCDIR)/opcode/cgen-bitset.h $(INCDIR)/opcode/cgen.h \ + $(srcdir)/../opcodes/m32r-opc.h cgen.h $(INCDIR)/elf/m32r.h \ + $(INCDIR)/elf/reloc-macros.h DEPTC_m32r_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m32r.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - $(srcdir)/../opcodes/m32r-desc.h $(INCDIR)/opcode/cgen.h \ - $(srcdir)/../opcodes/m32r-opc.h cgen.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(srcdir)/../opcodes/m32r-desc.h $(INCDIR)/opcode/cgen-bitset.h \ + $(INCDIR)/opcode/cgen.h $(srcdir)/../opcodes/m32r-opc.h \ + cgen.h $(INCDIR)/elf/m32r.h $(INCDIR)/elf/reloc-macros.h DEPTC_m68hc11_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-m68hc11.h $(INCDIR)/coff/internal.h \ @@ -1042,8 +1051,8 @@ DEPTC_m68hc11_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPTC_m68hc11_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m68hc11.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - $(INCDIR)/opcode/m68hc11.h dwarf2dbg.h $(INCDIR)/elf/m68hc11.h \ + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/m68hc11.h $(INCDIR)/elf/m68hc11.h \ $(INCDIR)/elf/reloc-macros.h DEPTC_m68k_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ @@ -1067,24 +1076,6 @@ DEPTC_m68k_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(srcdir)/config/m68k-parse.h $(INCDIR)/elf/m68k.h \ $(INCDIR)/elf/reloc-macros.h -DEPTC_m68k_hp300 = $(INCDIR)/symcat.h $(srcdir)/config/obj-hp300.h \ - $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-m68k.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ - $(INCDIR)/obstack.h subsegs.h dwarf2dbg.h dw2gencfi.h \ - $(INCDIR)/elf/dwarf2.h $(INCDIR)/opcode/m68k.h $(srcdir)/config/m68k-parse.h - -DEPTC_m88k_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ - $(srcdir)/config/tc-m88k.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/m88k.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h subsegs.h \ - $(INCDIR)/obstack.h $(srcdir)/config/m88k-opcode.h - -DEPTC_m88k_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ - $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m88k.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - $(srcdir)/config/m88k-opcode.h - DEPTC_mcore_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-mcore.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/mcore.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ @@ -1094,48 +1085,42 @@ DEPTC_mcore_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPTC_mcore_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mcore.h \ - subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/mcore-opc.h \ + dwarf2dbg.h subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/mcore-opc.h \ $(INCDIR)/safe-ctype.h $(INCDIR)/elf/mcore.h $(INCDIR)/elf/reloc-macros.h -DEPTC_mips_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ - $(srcdir)/config/tc-mips.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ - subsegs.h $(INCDIR)/obstack.h $(INCDIR)/safe-ctype.h \ - $(INCDIR)/opcode/mips.h itbl-ops.h dwarf2dbg.h $(srcdir)/config/obj-elf.h \ - $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h \ - ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h - DEPTC_mips_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-mips.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/mipspe.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(INCDIR)/safe-ctype.h \ - $(INCDIR)/opcode/mips.h itbl-ops.h dwarf2dbg.h $(srcdir)/config/obj-elf.h \ - $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h \ - ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h + $(INCDIR)/opcode/mips.h itbl-ops.h dwarf2dbg.h dw2gencfi.h \ + $(INCDIR)/elf/dwarf2.h $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h ecoff.h \ + $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h DEPTC_mips_ecoff = $(INCDIR)/symcat.h $(srcdir)/config/obj-ecoff.h \ $(srcdir)/config/tc-mips.h ecoff.h $(INCDIR)/coff/sym.h \ $(INCDIR)/coff/ecoff.h subsegs.h $(INCDIR)/obstack.h \ $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/mips.h itbl-ops.h \ - dwarf2dbg.h $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \ - $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h + dwarf2dbg.h dw2gencfi.h $(INCDIR)/elf/dwarf2.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/mips.h \ + $(INCDIR)/elf/reloc-macros.h DEPTC_mips_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mips.h \ subsegs.h $(INCDIR)/obstack.h $(INCDIR)/safe-ctype.h \ - $(INCDIR)/opcode/mips.h itbl-ops.h dwarf2dbg.h $(INCDIR)/elf/mips.h \ - $(INCDIR)/elf/reloc-macros.h ecoff.h $(INCDIR)/coff/sym.h \ - $(INCDIR)/coff/ecoff.h + $(INCDIR)/opcode/mips.h itbl-ops.h dwarf2dbg.h dw2gencfi.h \ + $(INCDIR)/elf/dwarf2.h $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h \ + ecoff.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/ecoff.h DEPTC_mmix_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mmix.h \ - subsegs.h $(INCDIR)/obstack.h $(INCDIR)/elf/mmix.h \ + dwarf2dbg.h subsegs.h $(INCDIR)/obstack.h $(INCDIR)/elf/mmix.h \ $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/mmix.h \ - $(INCDIR)/safe-ctype.h dwarf2dbg.h + $(INCDIR)/safe-ctype.h DEPTC_mn10200_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-mn10200.h $(INCDIR)/coff/internal.h \ @@ -1145,7 +1130,7 @@ DEPTC_mn10200_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPTC_mn10200_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10200.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ $(INCDIR)/opcode/mn10200.h DEPTC_mn10300_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ @@ -1157,18 +1142,18 @@ DEPTC_mn10300_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPTC_mn10300_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10300.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - $(INCDIR)/opcode/mn10300.h dwarf2dbg.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/mn10300.h DEPTC_msp430_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-msp430.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ - $(INCDIR)/opcode/msp430.h $(INCDIR)/safe-ctype.h + $(INCDIR)/opcode/msp430.h $(INCDIR)/safe-ctype.h dwarf2dbg.h DEPTC_msp430_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-msp430.h \ - subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/msp430.h \ + dwarf2dbg.h subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/msp430.h \ $(INCDIR)/safe-ctype.h DEPTC_ns32k_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ @@ -1183,20 +1168,21 @@ DEPTC_ns32k_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPTC_ns32k_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ns32k.h \ - $(INCDIR)/opcode/ns32k.h $(INCDIR)/obstack.h + dwarf2dbg.h $(INCDIR)/opcode/ns32k.h $(INCDIR)/obstack.h DEPTC_openrisc_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-openrisc.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ - $(srcdir)/../opcodes/openrisc-desc.h $(INCDIR)/opcode/cgen.h \ - $(srcdir)/../opcodes/openrisc-opc.h cgen.h + $(srcdir)/../opcodes/openrisc-desc.h $(INCDIR)/opcode/cgen-bitset.h \ + $(INCDIR)/opcode/cgen.h $(srcdir)/../opcodes/openrisc-opc.h \ + cgen.h DEPTC_openrisc_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-openrisc.h \ - subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/openrisc-desc.h \ - $(INCDIR)/opcode/cgen.h $(srcdir)/../opcodes/openrisc-opc.h \ - cgen.h + dwarf2dbg.h subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/openrisc-desc.h \ + $(INCDIR)/opcode/cgen-bitset.h $(INCDIR)/opcode/cgen.h \ + $(srcdir)/../opcodes/openrisc-opc.h cgen.h DEPTC_or32_coff = $(INCDIR)/safe-ctype.h $(INCDIR)/symcat.h \ $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-or32.h \ @@ -1207,7 +1193,7 @@ DEPTC_or32_coff = $(INCDIR)/safe-ctype.h $(INCDIR)/symcat.h \ DEPTC_or32_elf = $(INCDIR)/safe-ctype.h $(INCDIR)/symcat.h \ $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ - $(srcdir)/config/tc-or32.h $(INCDIR)/opcode/or32.h \ + $(srcdir)/config/tc-or32.h dwarf2dbg.h $(INCDIR)/opcode/or32.h \ $(INCDIR)/elf/or32.h $(INCDIR)/elf/reloc-macros.h DEPTC_pdp11_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ @@ -1222,7 +1208,7 @@ DEPTC_pdp11_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPTC_pdp11_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-pdp11.h \ - $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/pdp11.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/pdp11.h DEPTC_pj_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-pj.h $(INCDIR)/coff/internal.h \ @@ -1232,7 +1218,7 @@ DEPTC_pj_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPTC_pj_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-pj.h \ - $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/pj.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/pj.h DEPTC_ppc_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-ppc.h $(INCDIR)/coff/internal.h \ @@ -1243,9 +1229,9 @@ DEPTC_ppc_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPTC_ppc_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ppc.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ dw2gencfi.h $(INCDIR)/elf/dwarf2.h $(INCDIR)/opcode/ppc.h \ - $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h dwarf2dbg.h + $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h DEPTC_s390_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-s390.h $(INCDIR)/coff/internal.h \ @@ -1257,22 +1243,24 @@ DEPTC_s390_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPTC_s390_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-s390.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h dw2gencfi.h $(INCDIR)/elf/dwarf2.h \ - $(INCDIR)/opcode/s390.h $(INCDIR)/elf/s390.h $(INCDIR)/elf/reloc-macros.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h dw2gencfi.h $(INCDIR)/elf/dwarf2.h $(INCDIR)/opcode/s390.h \ + $(INCDIR)/elf/s390.h $(INCDIR)/elf/reloc-macros.h DEPTC_sh_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-sh.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/sh.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/sh-opc.h \ - $(INCDIR)/safe-ctype.h struc-symbol.h dwarf2dbg.h dw2gencfi.h + $(INCDIR)/safe-ctype.h struc-symbol.h dwarf2dbg.h dw2gencfi.h \ + $(INCDIR)/elf/dwarf2.h DEPTC_sh_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sh.h \ subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/sh-opc.h \ $(INCDIR)/safe-ctype.h struc-symbol.h $(INCDIR)/elf/sh.h \ - $(INCDIR)/elf/reloc-macros.h dwarf2dbg.h dw2gencfi.h + $(INCDIR)/elf/reloc-macros.h dwarf2dbg.h dw2gencfi.h \ + $(INCDIR)/elf/dwarf2.h DEPTC_sh64_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ @@ -1280,7 +1268,8 @@ DEPTC_sh64_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(srcdir)/config/tc-sh.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \ $(BFDDIR)/elf32-sh64.h $(INCDIR)/safe-ctype.h $(srcdir)/../opcodes/sh64-opc.h \ $(srcdir)/config/tc-sh.c subsegs.h $(INCDIR)/obstack.h \ - $(srcdir)/../opcodes/sh-opc.h struc-symbol.h dwarf2dbg.h dw2gencfi.h + $(srcdir)/../opcodes/sh-opc.h struc-symbol.h dwarf2dbg.h \ + dw2gencfi.h $(INCDIR)/elf/dwarf2.h DEPTC_sparc_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ $(srcdir)/config/tc-sparc.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ @@ -1297,24 +1286,9 @@ DEPTC_sparc_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPTC_sparc_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sparc.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ $(INCDIR)/opcode/sparc.h dw2gencfi.h $(INCDIR)/elf/dwarf2.h \ - $(INCDIR)/elf/sparc.h $(INCDIR)/elf/reloc-macros.h \ - dwarf2dbg.h - -DEPTC_tahoe_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ - $(srcdir)/config/tc-tahoe.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/safe-ctype.h $(INCDIR)/obstack.h $(INCDIR)/opcode/tahoe.h - -DEPTC_tahoe_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ - $(srcdir)/config/tc-tahoe.h $(INCDIR)/coff/internal.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \ - $(INCDIR)/obstack.h $(INCDIR)/opcode/tahoe.h - -DEPTC_tahoe_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ - $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tahoe.h \ - $(INCDIR)/safe-ctype.h $(INCDIR)/obstack.h $(INCDIR)/opcode/tahoe.h + $(INCDIR)/elf/sparc.h $(INCDIR)/elf/reloc-macros.h DEPTC_tic30_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ $(srcdir)/config/tc-tic30.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ @@ -1328,7 +1302,7 @@ DEPTC_tic30_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPTC_tic30_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic30.h \ - $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/tic30.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/tic30.h DEPTC_tic4x_coff = $(INCDIR)/safe-ctype.h $(INCDIR)/symcat.h \ $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic4x.h \ @@ -1339,7 +1313,7 @@ DEPTC_tic4x_coff = $(INCDIR)/safe-ctype.h $(INCDIR)/symcat.h \ DEPTC_tic4x_elf = $(INCDIR)/safe-ctype.h $(INCDIR)/symcat.h \ $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ - $(srcdir)/config/tc-tic4x.h $(INCDIR)/opcode/tic4x.h \ + $(srcdir)/config/tc-tic4x.h dwarf2dbg.h $(INCDIR)/opcode/tic4x.h \ subsegs.h $(INCDIR)/obstack.h DEPTC_tic54x_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ @@ -1356,49 +1330,23 @@ DEPTC_tic54x_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic54x.h $(INCDIR)/coff/ti.h \ $(BFDDIR)/libcoff.h -DEPTC_tic80_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ - $(srcdir)/config/tc-tic80.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/tic80.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/tic80.h - -DEPTC_tic80_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ - $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic80.h \ - $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/tic80.h - DEPTC_vax_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ $(srcdir)/config/tc-vax.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ $(srcdir)/config/vax-inst.h $(INCDIR)/obstack.h subsegs.h \ - $(INCDIR)/opcode/vax.h $(INCDIR)/safe-ctype.h + $(INCDIR)/safe-ctype.h $(INCDIR)/opcode/vax.h DEPTC_vax_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-vax.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(srcdir)/config/vax-inst.h \ - $(INCDIR)/obstack.h subsegs.h $(INCDIR)/opcode/vax.h \ - $(INCDIR)/safe-ctype.h + $(INCDIR)/obstack.h subsegs.h $(INCDIR)/safe-ctype.h \ + $(INCDIR)/opcode/vax.h DEPTC_vax_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-vax.h \ - $(srcdir)/config/vax-inst.h $(INCDIR)/obstack.h subsegs.h \ - $(INCDIR)/elf/vax.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/vax.h \ - $(INCDIR)/safe-ctype.h - -DEPTC_vax_vms = $(INCDIR)/symcat.h $(srcdir)/config/obj-vms.h \ - $(srcdir)/config/tc-vax.h $(INCDIR)/aout/stab_gnu.h \ - $(INCDIR)/aout/stab.def $(srcdir)/config/vax-inst.h \ - $(INCDIR)/obstack.h subsegs.h $(INCDIR)/opcode/vax.h \ - $(INCDIR)/safe-ctype.h - -DEPTC_w65_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ - $(srcdir)/config/tc-w65.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/w65.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ - $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/w65-opc.h - -DEPTC_w65_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ - $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-w65.h \ - subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/w65-opc.h + dwarf2dbg.h $(srcdir)/config/vax-inst.h $(INCDIR)/obstack.h \ + subsegs.h $(INCDIR)/safe-ctype.h $(INCDIR)/elf/vax.h \ + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/opcode/vax.h DEPTC_v850_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-v850.h $(INCDIR)/elf/v850.h $(INCDIR)/elf/reloc-macros.h \ @@ -1409,31 +1357,50 @@ DEPTC_v850_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPTC_v850_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-v850.h \ - $(INCDIR)/elf/v850.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/safe-ctype.h \ - subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/v850.h \ - dwarf2dbg.h + $(INCDIR)/elf/v850.h $(INCDIR)/elf/reloc-macros.h dwarf2dbg.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(INCDIR)/opcode/v850.h DEPTC_xstormy16_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-xstormy16.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h subsegs.h $(INCDIR)/obstack.h \ - $(srcdir)/../opcodes/xstormy16-desc.h $(INCDIR)/opcode/cgen.h \ - $(srcdir)/../opcodes/xstormy16-opc.h cgen.h + $(srcdir)/../opcodes/xstormy16-desc.h $(INCDIR)/opcode/cgen-bitset.h \ + $(INCDIR)/opcode/cgen.h $(srcdir)/../opcodes/xstormy16-opc.h \ + cgen.h DEPTC_xstormy16_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-xstormy16.h \ - subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/xstormy16-desc.h \ - $(INCDIR)/opcode/cgen.h $(srcdir)/../opcodes/xstormy16-opc.h \ - cgen.h + dwarf2dbg.h subsegs.h $(INCDIR)/obstack.h $(srcdir)/../opcodes/xstormy16-desc.h \ + $(INCDIR)/opcode/cgen-bitset.h $(INCDIR)/opcode/cgen.h \ + $(srcdir)/../opcodes/xstormy16-opc.h cgen.h + +DEPTC_xc16x_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-xc16x.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(srcdir)/../opcodes/xc16x-desc.h $(INCDIR)/opcode/cgen.h \ + $(srcdir)/../opcodes/xc16x-opc.h cgen.h DEPTC_xtensa_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-xtensa.h \ - $(INCDIR)/xtensa-config.h sb.h $(INCDIR)/safe-ctype.h \ - subsegs.h $(INCDIR)/obstack.h $(srcdir)/config/xtensa-relax.h \ - $(INCDIR)/xtensa-isa.h $(srcdir)/config/xtensa-istack.h \ + $(INCDIR)/xtensa-isa.h $(INCDIR)/xtensa-config.h sb.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + $(srcdir)/config/xtensa-relax.h $(srcdir)/config/xtensa-istack.h \ dwarf2dbg.h struc-symbol.h +DEPTC_z80_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-z80.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/z80.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h subsegs.h \ + $(INCDIR)/obstack.h + +DEPTC_z80_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-z80.h \ + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h + DEPTC_z8k_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-z8k.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/z8k.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ @@ -1442,7 +1409,7 @@ DEPTC_z8k_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPTC_z8k_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-z8k.h \ - $(INCDIR)/safe-ctype.h $(srcdir)/../opcodes/z8k-opc.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h $(srcdir)/../opcodes/z8k-opc.h DEPTC_hppa_som = $(srcdir)/config/tc-hppa.h subsegs.h \ $(INCDIR)/obstack.h $(BFDDIR)/libhppa.h $(INCDIR)/opcode/hppa.h \ @@ -1455,21 +1422,6 @@ DEPTC_mips_multi = $(DEPTC_mips_coff) $(DEPTC_mips_ecoff) \ $(DEPTC_mips_elf) DEPTC_cris_multi = $(DEPTC_cris_aout) $(DEPTC_cris_elf) -DEPOBJ_a29k_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ - $(srcdir)/config/tc-a29k.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/aout/aout64.h $(INCDIR)/obstack.h - -DEPOBJ_a29k_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ - $(srcdir)/config/tc-a29k.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/a29k.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h - -DEPOBJ_a29k_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ - $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-a29k.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h - DEPOBJ_alpha_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-alpha.h $(INCDIR)/coff/internal.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ @@ -1499,8 +1451,8 @@ DEPOBJ_arc_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_arc_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-arc.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_arm_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ $(srcdir)/config/tc-arm.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ @@ -1525,8 +1477,19 @@ DEPOBJ_avr_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_avr_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-avr.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h + +DEPOBJ_bfin_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-bfin.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ + subsegs.h + +DEPOBJ_bfin_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-bfin.h \ + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_cris_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ $(srcdir)/config/tc-cris.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ @@ -1535,8 +1498,19 @@ DEPOBJ_cris_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ DEPOBJ_cris_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-cris.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h + +DEPOBJ_crx_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-crx.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ + subsegs.h + +DEPOBJ_crx_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-crx.h \ + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_d10v_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-d10v.h $(INCDIR)/coff/internal.h \ @@ -1568,8 +1542,8 @@ DEPOBJ_dlx_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_dlx_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-dlx.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_fr30_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-fr30.h $(INCDIR)/coff/internal.h \ @@ -1579,8 +1553,8 @@ DEPOBJ_fr30_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_fr30_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-fr30.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_frv_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-frv.h $(INCDIR)/coff/internal.h \ @@ -1601,19 +1575,8 @@ DEPOBJ_h8300_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_h8300_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8300.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h - -DEPOBJ_h8500_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ - $(srcdir)/config/tc-h8500.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/h8500.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h - -DEPOBJ_h8500_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ - $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8500.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_hppa_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-hppa.h $(INCDIR)/coff/internal.h \ @@ -1649,8 +1612,8 @@ DEPOBJ_i370_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_i370_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i370.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/elf/i370.h $(INCDIR)/elf/reloc-macros.h \ + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/elf/i370.h $(INCDIR)/elf/reloc-macros.h \ $(INCDIR)/aout/aout64.h DEPOBJ_i386_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ @@ -1665,17 +1628,15 @@ DEPOBJ_i386_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_i386_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i386.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/elf/x86-64.h $(INCDIR)/elf/reloc-macros.h \ + $(INCDIR)/aout/aout64.h DEPOBJ_i860_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i860.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h - -DEPOBJ_i960_bout = $(INCDIR)/symcat.h $(srcdir)/config/obj-bout.h \ - $(srcdir)/config/tc-i960.h $(INCDIR)/obstack.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_i960_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-i960.h $(INCDIR)/coff/internal.h \ @@ -1685,8 +1646,8 @@ DEPOBJ_i960_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_i960_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i960.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_ip2k_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-ip2k.h $(INCDIR)/coff/internal.h \ @@ -1696,8 +1657,19 @@ DEPOBJ_ip2k_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_ip2k_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ip2k.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h + +DEPOBJ_m32c_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-m32c.h $(INCDIR)/coff/internal.h \ + $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ + subsegs.h + +DEPOBJ_m32c_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m32c.h \ + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_m32r_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-m32r.h $(INCDIR)/coff/internal.h \ @@ -1707,8 +1679,8 @@ DEPOBJ_m32r_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_m32r_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m32r.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_m68hc11_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-m68hc11.h $(INCDIR)/coff/internal.h \ @@ -1718,8 +1690,8 @@ DEPOBJ_m68hc11_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_m68hc11_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m68hc11.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_m68k_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ $(srcdir)/config/tc-m68k.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ @@ -1736,22 +1708,6 @@ DEPOBJ_m68k_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h -DEPOBJ_m68k_hp300 = $(srcdir)/config/obj-aout.c $(INCDIR)/symcat.h \ - $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-m68k.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \ - $(INCDIR)/obstack.h - -DEPOBJ_m88k_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ - $(srcdir)/config/tc-m88k.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/m88k.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h - -DEPOBJ_m88k_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ - $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m88k.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h - DEPOBJ_mcore_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-mcore.h $(INCDIR)/coff/internal.h \ $(INCDIR)/coff/mcore.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ @@ -1760,12 +1716,8 @@ DEPOBJ_mcore_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_mcore_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mcore.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h - -DEPOBJ_mips_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ - $(srcdir)/config/tc-mips.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/aout/aout64.h $(INCDIR)/obstack.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_mips_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-mips.h $(INCDIR)/coff/internal.h \ @@ -1788,8 +1740,8 @@ DEPOBJ_mips_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ DEPOBJ_mmix_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mmix.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_mn10200_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-mn10200.h $(INCDIR)/coff/internal.h \ @@ -1799,8 +1751,8 @@ DEPOBJ_mn10200_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_mn10200_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10200.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_mn10300_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-mn10300.h $(INCDIR)/coff/internal.h \ @@ -1810,8 +1762,8 @@ DEPOBJ_mn10300_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_mn10300_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10300.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_msp430_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-msp430.h $(INCDIR)/coff/internal.h \ @@ -1821,8 +1773,8 @@ DEPOBJ_msp430_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_msp430_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-msp430.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_ns32k_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ $(srcdir)/config/tc-ns32k.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ @@ -1836,8 +1788,8 @@ DEPOBJ_ns32k_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_ns32k_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ns32k.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_openrisc_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-openrisc.h $(INCDIR)/coff/internal.h \ @@ -1847,8 +1799,8 @@ DEPOBJ_openrisc_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_openrisc_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-openrisc.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_or32_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-or32.h $(INCDIR)/coff/internal.h \ @@ -1858,8 +1810,8 @@ DEPOBJ_or32_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_or32_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-or32.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_pdp11_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ $(srcdir)/config/tc-pdp11.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ @@ -1873,8 +1825,8 @@ DEPOBJ_pdp11_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_pdp11_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-pdp11.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_pj_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-pj.h $(INCDIR)/coff/internal.h \ @@ -1884,8 +1836,8 @@ DEPOBJ_pj_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_pj_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-pj.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_ppc_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-ppc.h $(INCDIR)/coff/internal.h \ @@ -1895,8 +1847,8 @@ DEPOBJ_ppc_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_ppc_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ppc.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h \ + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h \ $(INCDIR)/aout/aout64.h DEPOBJ_s390_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ @@ -1907,8 +1859,8 @@ DEPOBJ_s390_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_s390_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-s390.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_sh_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-sh.h $(INCDIR)/coff/internal.h \ @@ -1940,23 +1892,8 @@ DEPOBJ_sparc_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_sparc_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sparc.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h - -DEPOBJ_tahoe_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ - $(srcdir)/config/tc-tahoe.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ - $(INCDIR)/aout/aout64.h $(INCDIR)/obstack.h - -DEPOBJ_tahoe_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ - $(srcdir)/config/tc-tahoe.h $(INCDIR)/coff/internal.h \ - $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h \ - subsegs.h - -DEPOBJ_tahoe_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ - $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tahoe.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_tic30_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ $(srcdir)/config/tc-tic30.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ @@ -1970,8 +1907,8 @@ DEPOBJ_tic30_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_tic30_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic30.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_tic4x_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-tic4x.h $(INCDIR)/coff/internal.h \ @@ -1981,8 +1918,8 @@ DEPOBJ_tic4x_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_tic4x_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic4x.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_tic54x_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-tic54x.h $(INCDIR)/coff/internal.h \ @@ -1995,17 +1932,6 @@ DEPOBJ_tic54x_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h -DEPOBJ_tic80_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ - $(srcdir)/config/tc-tic80.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/tic80.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h - -DEPOBJ_tic80_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ - $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic80.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h - DEPOBJ_vax_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \ $(srcdir)/config/tc-vax.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \ $(INCDIR)/aout/aout64.h $(INCDIR)/obstack.h @@ -2018,24 +1944,8 @@ DEPOBJ_vax_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_vax_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-vax.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h - -DEPOBJ_vax_vms = $(INCDIR)/symcat.h $(srcdir)/config/obj-vms.h \ - $(srcdir)/config/tc-vax.h $(INCDIR)/aout/stab_gnu.h \ - $(INCDIR)/aout/stab.def $(INCDIR)/safe-ctype.h subsegs.h \ - $(INCDIR)/obstack.h - -DEPOBJ_w65_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ - $(srcdir)/config/tc-w65.h $(INCDIR)/coff/internal.h \ - $(INCDIR)/coff/w65.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h - -DEPOBJ_w65_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ - $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-w65.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_v850_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-v850.h $(INCDIR)/elf/v850.h $(INCDIR)/elf/reloc-macros.h \ @@ -2045,9 +1955,9 @@ DEPOBJ_v850_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_v850_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-v850.h \ - $(INCDIR)/elf/v850.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/safe-ctype.h \ - subsegs.h $(INCDIR)/obstack.h struc-symbol.h dwarf2dbg.h \ - $(INCDIR)/aout/aout64.h + $(INCDIR)/elf/v850.h $(INCDIR)/elf/reloc-macros.h dwarf2dbg.h \ + $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_xstormy16_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-xstormy16.h $(INCDIR)/coff/internal.h \ @@ -2057,14 +1967,32 @@ DEPOBJ_xstormy16_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_xstormy16_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-xstormy16.h \ + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h + +DEPOBJ_xc16x_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-xc16x.h \ $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h DEPOBJ_xtensa_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-xtensa.h \ - $(INCDIR)/xtensa-config.h $(INCDIR)/safe-ctype.h subsegs.h \ - $(INCDIR)/obstack.h struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + $(INCDIR)/xtensa-isa.h $(INCDIR)/xtensa-config.h $(INCDIR)/safe-ctype.h \ + subsegs.h $(INCDIR)/obstack.h struc-symbol.h dwarf2dbg.h \ + $(INCDIR)/aout/aout64.h + +DEPOBJ_z80_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ + $(srcdir)/config/tc-z80.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/z80.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/obstack.h subsegs.h + +DEPOBJ_z80_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-z80.h \ + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_z8k_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ $(srcdir)/config/tc-z8k.h $(INCDIR)/coff/internal.h \ @@ -2074,8 +2002,8 @@ DEPOBJ_z8k_coff = $(INCDIR)/symcat.h $(srcdir)/config/obj-coff.h \ DEPOBJ_z8k_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-z8k.h \ - $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ - struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h + dwarf2dbg.h $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \ + struc-symbol.h $(INCDIR)/aout/aout64.h DEPOBJ_hppa_som = $(srcdir)/config/obj-som.h subsegs.h \ $(INCDIR)/obstack.h $(BFDDIR)/libhppa.h $(BFDDIR)/som.h \ @@ -2088,17 +2016,6 @@ DEPOBJ_mips_multi = $(DEPOBJ_mips_coff) $(DEPOBJ_mips_ecoff) \ $(DEPOBJ_mips_elf) DEPOBJ_cris_multi = $(DEPOBJ_cris_aout) $(DEPOBJ_cris_elf) -DEP_a29k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-a29k.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h - -DEP_a29k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-a29k.h \ - $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/a29k.h \ - $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h - -DEP_a29k_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ - $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-a29k.h - DEP_alpha_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-alpha.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ $(INCDIR)/bfdlink.h @@ -2117,7 +2034,8 @@ DEP_arc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-arc.h \ DEP_arc_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-arc.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-arc.h \ + dwarf2dbg.h DEP_arm_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-arm.h \ $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h @@ -2136,14 +2054,34 @@ DEP_avr_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-avr.h \ DEP_avr_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-avr.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-avr.h \ + dwarf2dbg.h + +DEP_bfin_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-bfin.h \ + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h + +DEP_bfin_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-bfin.h \ + dwarf2dbg.h DEP_cris_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-cris.h \ $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h DEP_cris_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-cris.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-cris.h \ + dwarf2dbg.h + +DEP_crx_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-crx.h \ + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h + +DEP_crx_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-crx.h \ + dwarf2dbg.h DEP_d10v_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-d10v.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ @@ -2167,7 +2105,8 @@ DEP_dlx_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-dlx.h \ DEP_dlx_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-dlx.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-dlx.h \ + dwarf2dbg.h DEP_fr30_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-fr30.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ @@ -2175,7 +2114,8 @@ DEP_fr30_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-fr30.h \ DEP_fr30_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-fr30.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-fr30.h \ + dwarf2dbg.h DEP_frv_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-frv.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ @@ -2191,15 +2131,8 @@ DEP_h8300_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-h8300.h \ DEP_h8300_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8300.h - -DEP_h8500_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-h8500.h \ - $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/h8500.h \ - $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h - -DEP_h8500_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ - $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8500.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-h8300.h \ + dwarf2dbg.h DEP_hppa_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-hppa.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ @@ -2227,7 +2160,8 @@ DEP_i370_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i370.h \ DEP_i370_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i370.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i370.h \ + dwarf2dbg.h DEP_i386_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-i386.h \ $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h @@ -2238,20 +2172,22 @@ DEP_i386_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i386.h \ DEP_i386_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i386.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i386.h \ + dwarf2dbg.h DEP_i860_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i860.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i860.h \ + dwarf2dbg.h -DEP_i960_bout = $(srcdir)/config/obj-bout.h $(srcdir)/config/tc-i960.h DEP_i960_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-i960.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/i960.h \ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h DEP_i960_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i960.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-i960.h \ + dwarf2dbg.h DEP_ip2k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ip2k.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ @@ -2259,7 +2195,17 @@ DEP_ip2k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ip2k.h \ DEP_ip2k_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ip2k.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ip2k.h \ + dwarf2dbg.h + +DEP_m32c_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m32c.h \ + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ + $(INCDIR)/bfdlink.h + +DEP_m32c_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m32c.h \ + dwarf2dbg.h DEP_m32r_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m32r.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ @@ -2267,7 +2213,8 @@ DEP_m32r_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m32r.h \ DEP_m32r_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m32r.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m32r.h \ + dwarf2dbg.h DEP_m68hc11_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m68hc11.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/m68k.h \ @@ -2275,7 +2222,8 @@ DEP_m68hc11_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m68hc11.h \ DEP_m68hc11_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m68hc11.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m68hc11.h \ + dwarf2dbg.h DEP_m68k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-m68k.h \ $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h @@ -2288,27 +2236,14 @@ DEP_m68k_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m68k.h -DEP_m68k_hp300 = $(srcdir)/config/obj-hp300.h $(srcdir)/config/obj-aout.h \ - $(srcdir)/config/tc-m68k.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h - -DEP_m88k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m88k.h \ - $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/m88k.h \ - $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h - -DEP_m88k_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ - $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m88k.h - DEP_mcore_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mcore.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/mcore.h \ $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h DEP_mcore_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mcore.h - -DEP_mips_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-mips.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mcore.h \ + dwarf2dbg.h DEP_mips_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mips.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/mipspe.h \ @@ -2323,7 +2258,8 @@ DEP_mips_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ DEP_mmix_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mmix.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mmix.h \ + dwarf2dbg.h DEP_mn10200_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mn10200.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ @@ -2331,7 +2267,8 @@ DEP_mn10200_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mn10200.h \ DEP_mn10200_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10200.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10200.h \ + dwarf2dbg.h DEP_mn10300_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mn10300.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ @@ -2339,7 +2276,8 @@ DEP_mn10300_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-mn10300.h \ DEP_mn10300_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10300.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-mn10300.h \ + dwarf2dbg.h DEP_msp430_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-msp430.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ @@ -2347,7 +2285,8 @@ DEP_msp430_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-msp430.h \ DEP_msp430_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-msp430.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-msp430.h \ + dwarf2dbg.h DEP_ns32k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-ns32k.h \ $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h @@ -2358,7 +2297,8 @@ DEP_ns32k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ns32k.h \ DEP_ns32k_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ns32k.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ns32k.h \ + dwarf2dbg.h DEP_openrisc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-openrisc.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ @@ -2366,7 +2306,8 @@ DEP_openrisc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-openrisc.h \ DEP_openrisc_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-openrisc.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-openrisc.h \ + dwarf2dbg.h DEP_or32_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-or32.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/or32.h \ @@ -2374,7 +2315,8 @@ DEP_or32_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-or32.h \ DEP_or32_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-or32.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-or32.h \ + dwarf2dbg.h DEP_pdp11_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-pdp11.h \ $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h @@ -2385,7 +2327,8 @@ DEP_pdp11_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-pdp11.h \ DEP_pdp11_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-pdp11.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-pdp11.h \ + dwarf2dbg.h DEP_pj_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-pj.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ @@ -2393,7 +2336,8 @@ DEP_pj_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-pj.h \ DEP_pj_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-pj.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-pj.h \ + dwarf2dbg.h DEP_ppc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ppc.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/rs6000.h \ @@ -2401,7 +2345,8 @@ DEP_ppc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-ppc.h \ DEP_ppc_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ppc.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-ppc.h \ + dwarf2dbg.h DEP_s390_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-s390.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ @@ -2409,7 +2354,8 @@ DEP_s390_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-s390.h \ DEP_s390_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-s390.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-s390.h \ + dwarf2dbg.h DEP_sh_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-sh.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/sh.h \ @@ -2434,18 +2380,8 @@ DEP_sparc_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-sparc.h \ DEP_sparc_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sparc.h - -DEP_tahoe_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-tahoe.h \ - $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h - -DEP_tahoe_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tahoe.h \ - $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ - $(INCDIR)/bfdlink.h - -DEP_tahoe_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ - $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tahoe.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-sparc.h \ + dwarf2dbg.h DEP_tic30_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-tic30.h \ $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h @@ -2456,7 +2392,8 @@ DEP_tic30_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic30.h \ DEP_tic30_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic30.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic30.h \ + dwarf2dbg.h DEP_tic4x_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic4x.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic4x.h \ @@ -2464,7 +2401,8 @@ DEP_tic4x_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic4x.h \ DEP_tic4x_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic4x.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic4x.h \ + dwarf2dbg.h DEP_tic54x_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic54x.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic54x.h \ @@ -2474,14 +2412,6 @@ DEP_tic54x_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic54x.h -DEP_tic80_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic80.h \ - $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/tic80.h \ - $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h - -DEP_tic80_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ - $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-tic80.h - DEP_vax_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-vax.h \ $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h @@ -2491,18 +2421,8 @@ DEP_vax_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-vax.h \ DEP_vax_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-vax.h - -DEP_vax_vms = $(srcdir)/config/obj-vms.h $(srcdir)/config/tc-vax.h \ - $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def - -DEP_w65_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-w65.h \ - $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/w65.h \ - $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h - -DEP_w65_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ - $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-w65.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-vax.h \ + dwarf2dbg.h DEP_v850_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-v850.h \ $(INCDIR)/elf/v850.h $(INCDIR)/elf/reloc-macros.h $(INCDIR)/symcat.h \ @@ -2511,7 +2431,7 @@ DEP_v850_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-v850.h \ DEP_v850_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-v850.h \ - $(INCDIR)/elf/v850.h $(INCDIR)/elf/reloc-macros.h + $(INCDIR)/elf/v850.h $(INCDIR)/elf/reloc-macros.h dwarf2dbg.h DEP_xstormy16_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-xstormy16.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ @@ -2519,12 +2439,26 @@ DEP_xstormy16_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-xstormy16.h DEP_xstormy16_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-xstormy16.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-xstormy16.h \ + dwarf2dbg.h + +DEP_xc16x_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-xc16x.h DEP_xtensa_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-xtensa.h \ - $(INCDIR)/xtensa-config.h + $(INCDIR)/xtensa-isa.h $(INCDIR)/xtensa-config.h + +DEP_z80_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-z80.h \ + $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/z80.h \ + $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h + +DEP_z80_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-z80.h \ + dwarf2dbg.h DEP_z8k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-z8k.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/z8k.h \ @@ -2532,7 +2466,8 @@ DEP_z8k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-z8k.h \ DEP_z8k_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \ $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-z8k.h + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-z8k.h \ + dwarf2dbg.h DEP_hppa_som = $(BFDDIR)/som.h DEP_i386_multi = $(DEP_i386_aout) $(DEP_i386_coff) \ @@ -2658,7 +2593,13 @@ uninstall-info-am: # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): - @set fnord $$MAKEFLAGS; amf=$$2; \ + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ @@ -2670,7 +2611,7 @@ $(RECURSIVE_TARGETS): local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ @@ -2678,7 +2619,13 @@ $(RECURSIVE_TARGETS): mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: - @set fnord $$MAKEFLAGS; amf=$$2; \ + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ @@ -2699,7 +2646,7 @@ maintainer-clean-recursive: local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ @@ -2733,7 +2680,7 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.in $(TAGS_DEPENDENCIES) \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ - test -f $$subdir/TAGS && \ + test ! -f $$subdir/TAGS || \ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ @@ -2744,7 +2691,7 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.in $(TAGS_DEPENDENCIES) \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -z "$$unique" && unique=$$empty_fix; \ + test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi @@ -2822,15 +2769,16 @@ clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." - -rm -f m68k-parse.c + -rm -f bfin-parse.c -rm -f itbl-lex.c -rm -f itbl-parse.c + -rm -f m68k-parse.c clean: clean-recursive clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ @@ -2905,12 +2853,8 @@ po/POTFILES.in: @MAINT@ Makefile for f in $(POTFILES); do echo $$f; done | LC_COLLATE= sort > tmp \ && mv tmp $(srcdir)/po/POTFILES.in -$(srcdir)/make-gas.com: stamp-mk.com -stamp-mk.com: vmsconf.sh Makefile - sh $(srcdir)/vmsconf.sh $(GENERIC_OBJS) > new-make.com - $(SHELL) $(srcdir)/../move-if-change new-make.com $(srcdir)/make-gas.com - touch stamp-mk.com diststuff: $(EXTRA_DIST) info +all: info $(OBJS): @ALL_OBJ_DEPS@ @@ -2933,10 +2877,6 @@ check-DEJAGNU: site.exp rootme=`pwd`; export rootme; \ srcdir=`cd ${srcdir}; pwd` ; export srcdir ; \ EXPECT=${EXPECT} ; export EXPECT ; \ - if [ -f $(top_builddir)/../expect/expect ]; then \ - TCL_LIBRARY=`cd $(top_srcdir)/../tcl/library && pwd`; \ - export TCL_LIBRARY; \ - fi; \ runtest=$(RUNTEST); \ cd testsuite; \ if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \ @@ -2963,8 +2903,6 @@ ecoff.o : ecoff.c ecoff.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h \ obj-aout.o : $(srcdir)/config/obj-aout.c $(COMPILE) -c $(srcdir)/config/obj-aout.c -obj-bout.o : $(srcdir)/config/obj-bout.c - $(COMPILE) -c $(srcdir)/config/obj-bout.c obj-coff.o: $(srcdir)/config/obj-coff.c $(COMPILE) -c $(srcdir)/config/obj-coff.c obj-ecoff.o : $(srcdir)/config/obj-ecoff.c @@ -2973,16 +2911,12 @@ obj-elf.o : $(srcdir)/config/obj-elf.c $(COMPILE) -c $(srcdir)/config/obj-elf.c obj-evax.o : $(srcdir)/config/obj-evax.c $(COMPILE) -c $(srcdir)/config/obj-evax.c -obj-hp300.o : $(srcdir)/config/obj-hp300.c - $(COMPILE) -c $(srcdir)/config/obj-hp300.c obj-ieee.o : $(srcdir)/config/obj-ieee.c $(COMPILE) -c $(srcdir)/config/obj-ieee.c obj-multi.o : $(srcdir)/config/obj-multi.c $(COMPILE) -c $(srcdir)/config/obj-multi.c obj-som.o : $(srcdir)/config/obj-som.c $(COMPILE) -c $(srcdir)/config/obj-som.c -obj-vms.o : $(srcdir)/config/obj-vms.c - $(COMPILE) -c $(srcdir)/config/obj-vms.c e-mipself.o : $(srcdir)/config/e-mipself.c $(COMPILE) -c $(srcdir)/config/e-mipself.c @@ -3020,27 +2954,51 @@ m68k-parse.c: $(srcdir)/config/m68k-parse.y cp config/m68k-parse.y . >/dev/null 2>/dev/null; \ f=m68k-parse.y; \ else true; fi; \ - $(SHELL) $(YLWRAP) "$(YACC)" $$f y.tab.c m68k-parse.c --; \ + $(SHELL) $(YLWRAP) $$f y.tab.c m68k-parse.c -- $(YACCCOMPILE); \ if [ $$f = "m68k-parse.y" ]; then \ rm -f m68k-parse.y; \ else true; fi +# Disable -Werror, if it has been enabled, since old versions of bison/ +# yacc will produce working code which contain compile time warnings. m68k-parse.o: m68k-parse.c $(srcdir)/config/m68k-parse.h + $(COMPILE) -c $< $(NO_WERROR) # Don't let the .y.h rule clobber m68k-parse.h. m68k-parse.h: ; @true $(srcdir)/config/m68k-parse.h: ; @true +bfin-parse.c: $(srcdir)/config/bfin-parse.y + $(SHELL) $(YLWRAP) $(srcdir)/config/bfin-parse.y y.tab.c bfin-parse.c y.tab.h bfin-parse.h -- $(YACCCOMPILE) -d ; +bfin-parse.h: bfin-parse.c +bfin-parse.o: bfin-parse.c bfin-parse.h $(srcdir)/config/bfin-defs.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/bfin.h $(BFDDIR)/libbfd.h + +bfin-defs.h: ; @true +$(srcdir)/config/bfin-defs.h: ; @true + +bfin-lex.c: $(srcdir)/config/bfin-lex.l + $(SHELL) $(YLWRAP) $(srcdir)/config/bfin-lex.l lex.yy.c bfin-lex.c -- $(LEXCOMPILE) +bfin-lex.o: bfin-lex.c bfin-parse.h $(srcdir)/config/bfin-defs.h + $(COMPILE) -c $< $(NO_WERROR) + # The instruction table specification lexical analyzer and parser. itbl-lex.c: $(srcdir)/itbl-lex.l -itbl-lex.o: itbl-lex.c itbl-parse.h -itbl-parse.o: itbl-parse.c itbl-parse.h $(srcdir)/itbl-ops.h +# Disable -Werror, if it has been enabled, since old versions of bison/ +# yacc will produce working code which contain compile time warnings. +itbl-lex.o: itbl-lex.c itbl-parse.h $(srcdir)/itbl-lex.h + $(COMPILE) -c $< $(NO_WERROR) + +# Disable -Werror, if it has been enabled, since old versions of bison/ +# yacc will produce working code which contain compile time warnings. +itbl-parse.o: itbl-parse.c itbl-parse.h $(srcdir)/itbl-ops.h $(srcdir)/itbl-lex.h + $(COMPILE) -c $< $(NO_WERROR) itbl-ops.o: $(srcdir)/itbl-ops.c $(srcdir)/itbl-ops.h itbl-parse.h itbl-parse.c itbl-parse.h: $(srcdir)/itbl-parse.y - $(SHELL) $(YLWRAP) "$(YACC)" $(srcdir)/itbl-parse.y y.tab.c itbl-parse.c y.tab.h itbl-parse.h -- -d + $(SHELL) $(YLWRAP) $(srcdir)/itbl-parse.y y.tab.c itbl-parse.c y.tab.h itbl-parse.h -- $(YACCCOMPILE) -d itbl-tops.o: $(srcdir)/itbl-ops.c $(srcdir)/itbl-ops.h itbl-parse.h $(COMPILE) -o itbl-tops.o -DSTAND_ALONE -c $(srcdir)/itbl-ops.c @@ -3053,6 +3011,35 @@ cgen.o: cgen.c cgen.h cgen-desc.h subsegs.h \ $(srcdir)/../opcodes/$(CGEN_CPU_PREFIX)-desc.h \ $(srcdir)/../opcodes/$(CGEN_CPU_PREFIX)-opc.h +.PHONY: install-html install-html-am install-html-recursive + +install-html: install-html-recursive + +install-html-recursive: + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + .PHONY: install-exec-local install-data-local .PHONY: install-exec-bindir install-exec-tooldir @@ -3337,11 +3324,10 @@ as.o: as.c $(INCDIR)/symcat.h subsegs.h $(INCDIR)/obstack.h \ output-file.h sb.h macro.h dwarf2dbg.h dw2gencfi.h \ $(INCDIR)/elf/dwarf2.h $(BFDVER_H) atof-generic.o: atof-generic.c $(INCDIR)/symcat.h $(INCDIR)/safe-ctype.h -bignum-copy.o: bignum-copy.c $(INCDIR)/symcat.h cond.o: cond.c $(INCDIR)/symcat.h macro.h sb.h $(INCDIR)/obstack.h depend.o: depend.c $(INCDIR)/symcat.h -dwarf2dbg.o: dwarf2dbg.c $(INCDIR)/symcat.h dwarf2dbg.h \ - $(INCDIR)/filenames.h subsegs.h $(INCDIR)/obstack.h \ +dwarf2dbg.o: dwarf2dbg.c $(INCDIR)/symcat.h $(INCDIR)/safe-ctype.h \ + dwarf2dbg.h $(INCDIR)/filenames.h subsegs.h $(INCDIR)/obstack.h \ $(INCDIR)/elf/dwarf2.h dw2gencfi.o: dw2gencfi.c $(INCDIR)/symcat.h dw2gencfi.h \ $(INCDIR)/elf/dwarf2.h @@ -3363,13 +3349,14 @@ input-scrub.o: input-scrub.c $(INCDIR)/symcat.h input-file.h \ listing.o: listing.c $(INCDIR)/symcat.h $(INCDIR)/obstack.h \ $(INCDIR)/safe-ctype.h input-file.h subsegs.h literal.o: literal.c $(INCDIR)/symcat.h subsegs.h $(INCDIR)/obstack.h -macro.o: macro.c $(INCDIR)/safe-ctype.h sb.h macro.h +macro.o: macro.c $(INCDIR)/symcat.h $(INCDIR)/safe-ctype.h \ + sb.h macro.h messages.o: messages.c $(INCDIR)/symcat.h output-file.o: output-file.c $(INCDIR)/symcat.h output-file.h read.o: read.c $(INCDIR)/symcat.h $(INCDIR)/safe-ctype.h \ subsegs.h $(INCDIR)/obstack.h sb.h macro.h ecoff.h \ dw2gencfi.h $(INCDIR)/elf/dwarf2.h -sb.o: sb.c sb.h +sb.o: sb.c sb.h $(INCDIR)/symcat.h stabs.o: stabs.c $(INCDIR)/symcat.h $(INCDIR)/obstack.h \ subsegs.h ecoff.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def subsegs.o: subsegs.c $(INCDIR)/symcat.h subsegs.h $(INCDIR)/obstack.h diff --git a/contrib/binutils/gas/NEWS b/contrib/binutils/gas/NEWS index 1a31e79f560..4b4d029685a 100644 --- a/contrib/binutils/gas/NEWS +++ b/contrib/binutils/gas/NEWS @@ -1,5 +1,75 @@ -*- text -*- +* Support for the Infineon XC16X has been added by KPIT Cummins Infosystems. + +* Support for ms2 architecture has been added. + +* Support for the Z80 processor family has been added. + +* Add support for the "@" syntax to the command line, so that extra + switches can be read from . + +* The SH target supports a new command line switch --enable-reg-prefix which, + if enabled, will allow register names to be optionally prefixed with a $ + character. This allows register names to be distinguished from label names. + +* Macros with a variable number of arguments are now supported. See the + documentation for how this works. + +* Added --reduce-memory-overheads switch to reduce the size of the hash + tables used, at the expense of longer assembly times, and + --hash-size= to set the size of the hash tables used by gas. + +* Macro names and macro parameter names can now be any identifier that would + also be legal as a symbol elsewhere. For macro parameter names, this is + known to cause problems in certain sources when the respective target uses + characters inconsistently, and thus macro parameter references may no longer + be recognized as such (see the documentation for details). + +* Support the .f_floating, .d_floating, .g_floating and .h_floating directives + for the VAX target in order to be more compatible with the VAX MACRO + assembler. + +* New command line option -mtune=[itanium1|itanium2] for IA64 targets. + +Changes in 2.16: + +* Redefinition of macros now results in an error. + +* New command line option -mhint.b=[ok|warning|error] for IA64 targets. + +* New command line option -munwind-check=[warning|error] for IA64 + targets. + +* The IA64 port now uses automatic dependency violation removal as its default + mode. + +* Port to MAXQ processor contributed by HCL Tech. + +* Added support for generating unwind tables for ARM ELF targets. + +* Add a -g command line option to generate debug information in the target's + preferred debug format. + +* Support for the crx-elf target added. + +* Support for the sh-symbianelf target added. + +* Added a pseudo-op (.secrel32) to generate 32 bit section relative relocations + on pe[i]-i386; required for this target's DWARF 2 support. + +* Support for Motorola MCF521x/5249/547x/548x added. + +* Support for ColdFire EMAC instructions added and Motorola syntax for MAC/EMAC + instrucitons. + +* New command line option -mno-shared for MIPS ELF targets. + +* New command line option --alternate and pseudo-ops .altmacro and .noaltmacro + added to enter (and leave) alternate macro syntax mode. + +Changes in 2.15: + * The MIPS -membedded-pic option (Embedded-PIC code generation) is deprecated and will be removed in a future release. diff --git a/contrib/binutils/gas/README b/contrib/binutils/gas/README index 790539582b2..c249fd97fd3 100644 --- a/contrib/binutils/gas/README +++ b/contrib/binutils/gas/README @@ -57,14 +57,6 @@ facility to list all supported host and target names or aliases. abbreviations to full names; you can read the script, if you wish, or you can use it to test your guesses on abbreviations--for example: - % sh config.sub sun4 - sparc-sun-sunos411 - % sh config.sub sun3 - m68k-sun-sunos411 - % sh config.sub decstation - mips-dec-ultrix42 - % sh config.sub hp300bsd - m68k-hp-bsd % sh config.sub i386v i386-unknown-sysv % sh config.sub i786v @@ -139,75 +131,6 @@ The `--enable' options recognized by software in the gas distribution are: been done, it's already the default. So generally you won't need to use this option. -Supported platforms -=================== - -At this point I believe gas to be ANSI only code for most target cpu's. That -is, there should be relatively few, if any host system dependencies. So -porting (as a cross-assembler) to hosts not yet supported should be fairly -easy. Porting to a new target shouldn't be too tough if it's a variant of one -already supported. - -Native assembling should work on: - - sun3 - sun4 - 386bsd - bsd/386 - delta (m68k-sysv from Motorola) - delta88 (m88k-sysv from Motorola) - GNU/linux - m68k hpux 8.0 (hpux 7.0 may be a problem) - vax bsd, ultrix, vms - hp9000s300 - decstation - irix 4 - irix 5 - miniframe (m68k-sysv from Convergent Technologies) - i386-aix (ps/2) - hppa (hpux 4.3bsd, osf1) - AIX - unixware - sco 3.2v4.2 - sco openserver 5.0 (a.k.a. 3.2v5.0 ) - sparc solaris - ns32k (netbsd, lites) - -I believe that gas as a cross-assembler can currently be targeted for -most of the above hosts, plus - - arm - decstation-bsd (a.out format, to be used in BSD 4.4) - ebmon29k - go32 (DOS on i386, with DJGPP -- old a.out version) - H8/300, H8/500 (Hitachi) - i386-aix (ps/2) - i960-coff - mips ecoff (decstation-ultrix, iris, mips magnum, mips-idt-ecoff) - Mitsubishi d10v and d30v - nindy960 - powerpc EABI - SH (Hitachi) - sco386 - TI tic30 and tic80 - vax bsd or ultrix? - vms - vxworks68k - vxworks960 - z8000 (Zilog) - -MIPS ECOFF support has been added, but GAS will not run a C-style -preprocessor. If you want that, rename your file to have a ".S" suffix, and -run gcc on it. Or run "gcc -xassembler-with-cpp foo.s". - -Support for ELF should work now for sparc, hppa, i386, alpha, m68k, -MIPS, powerpc. - -Support for sequent (ns32k), tahoe, i860 may be suffering from bitrot. - -If you try out gas on some host or target not listed above, please let me know -the results, so I can update the list. - Compiler Support Hacks ====================== diff --git a/contrib/binutils/gas/acinclude.m4 b/contrib/binutils/gas/acinclude.m4 index 4a3ccf358bd..0946e724f12 100644 --- a/contrib/binutils/gas/acinclude.m4 +++ b/contrib/binutils/gas/acinclude.m4 @@ -1,3 +1,5 @@ +sinclude(../bfd/warning.m4) + dnl GAS_CHECK_DECL_NEEDED(name, typedefname, typedef, headers) AC_DEFUN([GAS_CHECK_DECL_NEEDED],[ AC_MSG_CHECKING(whether declaration is required for $1) diff --git a/contrib/binutils/gas/aclocal.m4 b/contrib/binutils/gas/aclocal.m4 index c5ef088d3d2..cd4267338b7 100644 --- a/contrib/binutils/gas/aclocal.m4 +++ b/contrib/binutils/gas/aclocal.m4 @@ -1,7 +1,7 @@ -# generated automatically by aclocal 1.8.4 -*- Autoconf -*- +# generated automatically by aclocal 1.9.6 -*- Autoconf -*- -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 -# Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -11,55 +11,32 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. -# -*- Autoconf -*- -# Copyright (C) 2002, 2003 Free Software Foundation, Inc. -# Generated from amversion.in; do not edit by hand. - -# This program is free software; you can redistribute 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 +# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. -AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.8"]) +AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"]) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION so it can be traced. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], - [AM_AUTOMAKE_VERSION([1.8.4])]) + [AM_AUTOMAKE_VERSION([1.9.6])]) -# AM_AUX_DIR_EXPAND +# AM_AUX_DIR_EXPAND -*- Autoconf -*- -# Copyright (C) 2001, 2003 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# 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. +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to @@ -106,26 +83,16 @@ AC_PREREQ([2.50])dnl am_aux_dir=`cd $ac_aux_dir && pwd` ]) -# AM_CONDITIONAL -*- Autoconf -*- +# AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997, 2000, 2001, 2003 Free Software Foundation, Inc. +# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# This program is free software; you can redistribute 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. - -# serial 6 +# serial 7 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- @@ -145,30 +112,19 @@ else fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then - AC_MSG_ERROR([conditional "$1" was never defined. -Usually this means the macro was only invoked conditionally.]) + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) fi])]) -# serial 7 -*- Autoconf -*- -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# This program is free software; you can redistribute 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. - +# serial 8 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, @@ -177,7 +133,6 @@ fi])]) # CC etc. in the Makefile, will ask for an AC_PROG_CC use... - # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. @@ -317,26 +272,16 @@ AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH]) ]) -# Generate code to set up dependency tracking. -*- Autoconf -*- +# Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# This program is free software; you can redistribute 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. - -#serial 2 +#serial 3 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ @@ -355,27 +300,21 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], else continue fi - grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue - # Extract the definition of DEP_FILES from the Makefile without - # running `make'. + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` - test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" - # We invoke sed twice because it is the simplest approach to - # changing $(DEPDIR) to its actual value in the expansion. - for file in `sed -n ' - /^DEP_FILES = .*\\\\$/ { - s/^DEP_FILES = // - :loop - s/\\\\$// - p - n - /\\\\$/ b loop - p - } - /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue @@ -401,54 +340,31 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) -# Like AC_CONFIG_HEADER, but automatically create stamp file. -*- Autoconf -*- +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# Copyright (C) 1996, 1997, 2000, 2001, 2003 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# 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. - -# serial 7 +# serial 8 # AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) -# Do all the work for Automake. -*- Autoconf -*- +# Do all the work for Automake. -*- Autoconf -*- -# This macro actually does too much some checks are only needed if -# your package does certain things. But this isn't really a big deal. - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# This program is free software; you can redistribute 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. +# serial 12 -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR 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. - -# serial 11 +# This macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) @@ -506,7 +422,6 @@ AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) -AM_MISSING_PROG(AMTAR, tar) AM_PROG_INSTALL_SH AM_PROG_INSTALL_STRIP AC_REQUIRE([AM_PROG_MKDIR_P])dnl @@ -515,7 +430,9 @@ AC_REQUIRE([AM_PROG_MKDIR_P])dnl AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl - +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], @@ -549,51 +466,27 @@ for _am_header in $config_headers :; do done echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. - -# Copyright (C) 2001, 2003 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# 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. - AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl install_sh=${install_sh-"$am_aux_dir/install-sh"} AC_SUBST(install_sh)]) -# -*- Autoconf -*- -# Copyright (C) 2003 Free Software Foundation, Inc. +# Copyright (C) 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# This program is free software; you can redistribute 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. - -# serial 1 +# serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. @@ -608,26 +501,14 @@ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) - -# Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 +# Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005 # Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# This program is free software; you can redistribute 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. - -# serial 4 +# serial 5 # AM_PROG_LEX # ----------- @@ -641,28 +522,17 @@ if test "$LEX" = :; then LEX=${am_missing_run}flex fi]) -# Add --enable-maintainer-mode option to configure. +# Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering -# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004 +# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# This program is free software; you can redistribute 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. - -# serial 3 +# serial 4 AC_DEFUN([AM_MAINTAINER_MODE], [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) @@ -681,26 +551,15 @@ AC_DEFUN([AM_MAINTAINER_MODE], AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE]) -# Check to see how 'make' treats includes. -*- Autoconf -*- +# Check to see how 'make' treats includes. -*- Autoconf -*- -# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. +# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# This program is free software; you can redistribute 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. - -# serial 2 +# serial 3 # AM_MAKE_INCLUDE() # ----------------- @@ -744,27 +603,16 @@ AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) -# -*- Autoconf -*- +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- +# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# Copyright (C) 1997, 1999, 2000, 2001, 2003 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# 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. - -# serial 3 +# serial 4 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ @@ -790,27 +638,16 @@ else fi ]) +# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + # AM_PROG_MKDIR_P # --------------- # Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. - -# Copyright (C) 2003, 2004 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - +# # Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories # created by `make install' are always world readable, even if the # installer happens to have an overly restrictive umask (e.g. 077). @@ -831,13 +668,21 @@ fi # this.) AC_DEFUN([AM_PROG_MKDIR_P], [if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then - # Keeping the `.' argument allows $(mkdir_p) to be used without - # argument. Indeed, we sometimes output rules like + # We used to keeping the `.' as first argument, in order to + # allow $(mkdir_p) to be used without argument. As in # $(mkdir_p) $(somedir) - # where $(somedir) is conditionally defined. - # (`test -n '$(somedir)' && $(mkdir_p) $(somedir)' is a more - # expensive solution, as it forces Make to start a sub-shell.) - mkdir_p='mkdir -p -- .' + # where $(somedir) is conditionally defined. However this is wrong + # for two reasons: + # 1. if the package is installed by a user who cannot write `.' + # make install will fail, + # 2. the above comment should most certainly read + # $(mkdir_p) $(DESTDIR)$(somedir) + # so it does not work when $(somedir) is undefined and + # $(DESTDIR) is not. + # To support the latter case, we have to write + # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), + # so the `.' trick is pointless. + mkdir_p='mkdir -p --' else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as @@ -856,26 +701,15 @@ else fi AC_SUBST([mkdir_p])]) -# Helper functions for option handling. -*- Autoconf -*- +# Helper functions for option handling. -*- Autoconf -*- -# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. +# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# This program is free software; you can redistribute 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. - -# serial 2 +# serial 3 # _AM_MANGLE_OPTION(NAME) # ----------------------- @@ -900,28 +734,16 @@ AC_DEFUN([_AM_SET_OPTIONS], AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. # -# Check to make sure that the build environment is sane. -# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# Copyright (C) 1996, 1997, 2000, 2001, 2003 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# 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. - -# serial 3 +# serial 4 # AM_SANITY_CHECK # --------------- @@ -964,25 +786,14 @@ Check your system clock]) fi AC_MSG_RESULT(yes)]) +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + # AM_PROG_INSTALL_STRIP - -# Copyright (C) 2001, 2003 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# 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. - +# --------------------- # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip @@ -1003,4 +814,100 @@ fi INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of `v7', `ustar', or `pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. +AM_MISSING_PROG([AMTAR], [tar]) +m4_if([$1], [v7], + [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], + [m4_case([$1], [ustar],, [pax],, + [m4_fatal([Unknown tar format])]) +AC_MSG_CHECKING([how to create a $1 tar archive]) +# Loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' +_am_tools=${am_cv_prog_tar_$1-$_am_tools} +# Do not fold the above two line into one, because Tru64 sh and +# Solaris sh will not grok spaces in the rhs of `-'. +for _am_tool in $_am_tools +do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; + do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar /dev/null 2>&1 && break + fi +done +rm -rf conftest.dir + +AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) +AC_MSG_RESULT([$am_cv_prog_tar_$1])]) +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + m4_include([acinclude.m4]) diff --git a/contrib/binutils/gas/app.c b/contrib/binutils/gas/app.c index 1dbc49a8cd8..275ad68ebb0 100644 --- a/contrib/binutils/gas/app.c +++ b/contrib/binutils/gas/app.c @@ -1,6 +1,6 @@ /* This is the Assembler Pre-Processor Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2002, 2003 + 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -17,8 +17,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ /* Modified by Allen Wirfs-Brock, Instantiations Inc 2/90. */ /* App, the assembler pre-processor. This pre-processor strips out excess @@ -345,6 +345,8 @@ do_scrub_chars (int (*get) (char *, int), char *tostart, int tolen) char *fromend; int fromlen; register int ch, ch2 = 0; + /* Character that started the string we're working on. */ + static char quotechar; /*State 0: beginning of normal line 1: After first whitespace on line (flush more white) @@ -373,6 +375,10 @@ do_scrub_chars (int (*get) (char *, int), char *tostart, int tolen) predicate. 15: After seeing a `(' at state 1, looking for a `)' as predicate. +#endif +#ifdef TC_Z80 + 16: After seeing an 'a' or an 'A' at the start of a symbol + 17: After seeing an 'f' or an 'F' in state 16 #endif */ @@ -536,11 +542,8 @@ do_scrub_chars (int (*get) (char *, int), char *tostart, int tolen) for (s = from; s < fromend; s++) { ch = *s; - /* This condition must be changed if the type of any - other character can be LEX_IS_STRINGQUOTE. */ if (ch == '\\' - || ch == '"' - || ch == '\'' + || ch == quotechar || ch == '\n') break; } @@ -558,12 +561,12 @@ do_scrub_chars (int (*get) (char *, int), char *tostart, int tolen) ch = GET (); if (ch == EOF) { - as_warn (_("end of file in string; inserted '\"'")); + as_warn (_("end of file in string; '%c' inserted"), quotechar); state = old_state; UNGET ('\n'); - PUT ('"'); + PUT (quotechar); } - else if (lex[ch] == LEX_IS_STRINGQUOTE) + else if (ch == quotechar) { state = old_state; PUT (ch); @@ -603,8 +606,8 @@ do_scrub_chars (int (*get) (char *, int), char *tostart, int tolen) continue; case EOF: - as_warn (_("end of file in string; '\"' inserted")); - PUT ('"'); + as_warn (_("end of file in string; '%c' inserted"), quotechar); + PUT (quotechar); continue; case '"': @@ -638,10 +641,9 @@ do_scrub_chars (int (*get) (char *, int), char *tostart, int tolen) case 7: ch = GET (); + quotechar = ch; state = 5; old_state = 8; - if (ch == EOF) - goto fromeof; PUT (ch); continue; @@ -666,6 +668,32 @@ do_scrub_chars (int (*get) (char *, int), char *tostart, int tolen) state = 1; PUT ('|'); continue; +#endif +#ifdef TC_Z80 + case 16: + /* We have seen an 'a' at the start of a symbol, look for an 'f'. */ + ch = GET (); + if (ch == 'f' || ch == 'F') + { + state = 17; + PUT (ch); + } + else + { + state = 9; + break; + } + case 17: + /* We have seen "af" at the start of a symbol, + a ' here is a part of that symbol. */ + ch = GET (); + state = 9; + if (ch == '\'') + /* Change to avoid warning about unclosed string. */ + PUT ('`'); + else + UNGET (ch); + break; #endif } @@ -975,6 +1003,7 @@ do_scrub_chars (int (*get) (char *, int), char *tostart, int tolen) break; case LEX_IS_STRINGQUOTE: + quotechar = ch; if (state == 10) { /* Preserve the whitespace in foo "bar". */ @@ -1243,6 +1272,30 @@ do_scrub_chars (int (*get) (char *, int), char *tostart, int tolen) break; } +#ifdef TC_Z80 + /* "af'" is a symbol containing '\''. */ + if (state == 3 && (ch == 'a' || ch == 'A')) + { + state = 16; + PUT (ch); + ch = GET (); + if (ch == 'f' || ch == 'F') + { + state = 17; + PUT (ch); + break; + } + else + { + state = 9; + if (!IS_SYMBOL_COMPONENT (ch)) + { + UNGET (ch); + break; + } + } + } +#endif if (state == 3) state = 9; @@ -1282,26 +1335,11 @@ do_scrub_chars (int (*get) (char *, int), char *tostart, int tolen) if (len > 0) { PUT (ch); - if (len > 8) - { - memcpy (to, from, len); - to += len; - from += len; - } - else - { - switch (len) - { - case 8: *to++ = *from++; - case 7: *to++ = *from++; - case 6: *to++ = *from++; - case 5: *to++ = *from++; - case 4: *to++ = *from++; - case 3: *to++ = *from++; - case 2: *to++ = *from++; - case 1: *to++ = *from++; - } - } + memcpy (to, from, len); + to += len; + from += len; + if (to >= toend) + goto tofull; ch = GET (); } } diff --git a/contrib/binutils/gas/as.c b/contrib/binutils/gas/as.c index 0911aa1fa26..727a1dd40ee 100644 --- a/contrib/binutils/gas/as.c +++ b/contrib/binutils/gas/as.c @@ -1,6 +1,6 @@ /* as.c - GAS main program. Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002 + 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -17,8 +17,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ /* Main program for AS; a 32-bit assembler of GNU. Understands command arguments. @@ -42,10 +42,8 @@ #include "macro.h" #include "dwarf2dbg.h" #include "dw2gencfi.h" - -#ifdef BFD_ASSEMBLER +#include "hash.h" #include "bfdver.h" -#endif #ifdef HAVE_ITBL_CPU #include "itbl-ops.h" @@ -89,11 +87,16 @@ int listing; enum debug_info_type debug_type = DEBUG_UNSPECIFIED; int use_gnu_debug_info_extensions = 0; +#ifndef MD_DEBUG_FORMAT_SELECTOR +#define MD_DEBUG_FORMAT_SELECTOR NULL +#endif +static enum debug_info_type (*md_debug_format_selector) (int *) = MD_DEBUG_FORMAT_SELECTOR; + /* Maximum level of macro nesting. */ int max_macro_nest = 100; /* argv[0] */ -char * myname; +static char * myname; /* The default obstack chunk size. If we set this to zero, the obstack code will use whatever will fit in a 4096 byte block. */ @@ -106,13 +109,11 @@ int debug_memory = 0; /* Enable verbose mode. */ int verbose = 0; -#ifdef BFD_ASSEMBLER segT reg_section; segT expr_section; segT text_section; segT data_section; segT bss_section; -#endif /* Name of listing file. */ static char *listing_filename = NULL; @@ -123,6 +124,8 @@ static struct itbl_file_list *itbl_files; static long start_time; +static int flag_macro_alternate; + #ifdef USE_EMULATIONS #define EMULATION_ENVIRON "AS_EMULATION" @@ -217,13 +220,8 @@ print_version_id (void) return; printed = 1; -#ifdef BFD_ASSEMBLER - fprintf (stderr, _("GNU assembler version %s (%s) using BFD version %s"), + fprintf (stderr, _("GNU assembler version %s (%s) using BFD version %s\n"), VERSION, TARGET_ALIAS, BFD_VERSION_STRING); -#else - fprintf (stderr, _("GNU assembler version %s (%s)"), VERSION, TARGET_ALIAS); -#endif - fprintf (stderr, "\n"); } static void @@ -244,6 +242,8 @@ Options:\n\ s include symbols\n\ =FILE list to FILE (must be last sub-option)\n")); + fprintf (stream, _("\ + --alternate initially turn on alternate macro syntax\n")); fprintf (stream, _("\ -D produce assembler debugging messages\n")); fprintf (stream, _("\ @@ -266,7 +266,7 @@ Options:\n\ emulate output (default %s)\n"), def_em); } #endif -#if defined BFD_ASSEMBLER && (defined OBJ_ELF || defined OBJ_MAYBE_ELF) +#if defined OBJ_ELF || defined OBJ_MAYBE_ELF fprintf (stream, _("\ --execstack require executable stack for this object\n")); fprintf (stream, _("\ @@ -275,11 +275,15 @@ Options:\n\ fprintf (stream, _("\ -f skip whitespace and comment preprocessing\n")); fprintf (stream, _("\ - --gstabs generate stabs debugging information\n")); + -g --gen-debug generate debugging information\n")); fprintf (stream, _("\ - --gstabs+ generate stabs debug info with GNU extensions\n")); + --gstabs generate STABS debugging information\n")); fprintf (stream, _("\ - --gdwarf2 generate DWARF2 debugging information\n")); + --gstabs+ generate STABS debug info with GNU extensions\n")); + fprintf (stream, _("\ + --gdwarf-2 generate DWARF2 debugging information\n")); + fprintf (stream, _("\ + --hash-size= set the hash table size close to \n")); fprintf (stream, _("\ --help show this message and exit\n")); fprintf (stream, _("\ @@ -303,6 +307,10 @@ Options:\n\ fprintf (stream, _("\ -R fold data section into text section\n")); fprintf (stream, _("\ + --reduce-memory-overheads \n\ + prefer smaller memory use at the cost of longer\n\ + assembly times\n")); + fprintf (stream, _("\ --statistics print various measured statistics from execution\n")); fprintf (stream, _("\ --strip-local-absolute strip local absolute symbols\n")); @@ -338,6 +346,8 @@ Options:\n\ fprintf (stream, _("\ --listing-cont-lines set the maximum number of continuation lines used\n\ for the output data column of the listing\n")); + fprintf (stream, _("\ + @FILE read options from FILE\n")); md_show_usage (stream); @@ -374,7 +384,7 @@ parse_args (int * pargc, char *** pargv) /* -K is not meaningful if .word is not being hacked. */ 'K', #endif - 'L', 'M', 'R', 'W', 'Z', 'a', ':', ':', 'D', 'f', 'I', ':', 'o', ':', + 'L', 'M', 'R', 'W', 'Z', 'a', ':', ':', 'D', 'f', 'g', ':',':', 'I', ':', 'o', ':', #ifndef VMS /* -v takes an argument on VMS, so we don't make it a generic option. */ @@ -407,59 +417,80 @@ parse_args (int * pargc, char *** pargv) OPTION_DEPFILE, OPTION_GSTABS, OPTION_GSTABS_PLUS, + OPTION_GDWARF2, OPTION_STRIP_LOCAL_ABSOLUTE, OPTION_TRADITIONAL_FORMAT, - OPTION_GDWARF2, OPTION_WARN, OPTION_TARGET_HELP, OPTION_EXECSTACK, OPTION_NOEXECSTACK, + OPTION_ALTERNATE, + OPTION_AL, + OPTION_HASH_TABLE_SIZE, + OPTION_REDUCE_MEMORY_OVERHEADS, OPTION_WARN_FATAL + /* When you add options here, check that they do + not collide with OPTION_MD_BASE. See as.h. */ }; static const struct option std_longopts[] = { - {"help", no_argument, NULL, OPTION_HELP}, - /* getopt allows abbreviations, so we do this to stop it from - treating -k as an abbreviation for --keep-locals. Some - ports use -k to enable PIC assembly. */ - {"keep-locals", no_argument, NULL, 'L'}, - {"keep-locals", no_argument, NULL, 'L'}, - {"mri", no_argument, NULL, 'M'}, - {"nocpp", no_argument, NULL, OPTION_NOCPP}, - {"statistics", no_argument, NULL, OPTION_STATISTICS}, - {"version", no_argument, NULL, OPTION_VERSION}, - {"dump-config", no_argument, NULL, OPTION_DUMPCONFIG}, - {"verbose", no_argument, NULL, OPTION_VERBOSE}, - {"emulation", required_argument, NULL, OPTION_EMULATION}, - {"defsym", required_argument, NULL, OPTION_DEFSYM}, + /* Note: commas are placed at the start of the line rather than + the end of the preceeding line so that it is simpler to + selectively add and remove lines from this list. */ + {"alternate", no_argument, NULL, OPTION_ALTERNATE} + /* The entry for "a" is here to prevent getopt_long_only() from + considering that -a is an abbreviation for --alternate. This is + necessary because -a= is a valid switch but getopt would + normally reject it since --alternate does not take an argument. */ + ,{"a", optional_argument, NULL, 'a'} + /* Handle -al=. */ + ,{"al", optional_argument, NULL, OPTION_AL} + ,{"defsym", required_argument, NULL, OPTION_DEFSYM} + ,{"dump-config", no_argument, NULL, OPTION_DUMPCONFIG} + ,{"emulation", required_argument, NULL, OPTION_EMULATION} +#if defined OBJ_ELF || defined OBJ_MAYBE_ELF + ,{"execstack", no_argument, NULL, OPTION_EXECSTACK} + ,{"noexecstack", no_argument, NULL, OPTION_NOEXECSTACK} +#endif + ,{"fatal-warnings", no_argument, NULL, OPTION_WARN_FATAL} + ,{"gdwarf-2", no_argument, NULL, OPTION_GDWARF2} + /* GCC uses --gdwarf-2 but GAS uses to use --gdwarf2, + so we keep it here for backwards compatibility. */ + ,{"gdwarf2", no_argument, NULL, OPTION_GDWARF2} + ,{"gen-debug", no_argument, NULL, 'g'} + ,{"gstabs", no_argument, NULL, OPTION_GSTABS} + ,{"gstabs+", no_argument, NULL, OPTION_GSTABS_PLUS} + ,{"hash-size", required_argument, NULL, OPTION_HASH_TABLE_SIZE} + ,{"help", no_argument, NULL, OPTION_HELP} /* New option for extending instruction set (see also -t above). The "-t file" or "--itbl file" option extends the basic set of valid instructions by reading "file", a text file containing a list of instruction formats. The additional opcodes and their formats are added to the built-in set of instructions, and mnemonics for new registers may also be defined. */ - {"itbl", required_argument, NULL, OPTION_INSTTBL}, - {"listing-lhs-width", required_argument, NULL, OPTION_LISTING_LHS_WIDTH}, - {"listing-lhs-width2", required_argument, NULL, OPTION_LISTING_LHS_WIDTH2}, - {"listing-rhs-width", required_argument, NULL, OPTION_LISTING_RHS_WIDTH}, - {"listing-cont-lines", required_argument, NULL, OPTION_LISTING_CONT_LINES}, - {"MD", required_argument, NULL, OPTION_DEPFILE}, - {"gstabs", no_argument, NULL, OPTION_GSTABS}, - {"gstabs+", no_argument, NULL, OPTION_GSTABS_PLUS}, - {"strip-local-absolute", no_argument, NULL, OPTION_STRIP_LOCAL_ABSOLUTE}, - {"traditional-format", no_argument, NULL, OPTION_TRADITIONAL_FORMAT}, - {"gdwarf2", no_argument, NULL, OPTION_GDWARF2}, - {"no-warn", no_argument, NULL, 'W'}, - {"warn", no_argument, NULL, OPTION_WARN}, - {"target-help", no_argument, NULL, OPTION_TARGET_HELP}, -#if defined BFD_ASSEMBLER && (defined OBJ_ELF || defined OBJ_MAYBE_ELF) - {"execstack", no_argument, NULL, OPTION_EXECSTACK}, - {"noexecstack", no_argument, NULL, OPTION_NOEXECSTACK}, -#endif - {"fatal-warnings", no_argument, NULL, OPTION_WARN_FATAL} - /* When you add options here, check that they do not collide with - OPTION_MD_BASE. See as.h. */ + ,{"itbl", required_argument, NULL, OPTION_INSTTBL} + /* getopt allows abbreviations, so we do this to stop it from + treating -k as an abbreviation for --keep-locals. Some + ports use -k to enable PIC assembly. */ + ,{"keep-locals", no_argument, NULL, 'L'} + ,{"keep-locals", no_argument, NULL, 'L'} + ,{"listing-lhs-width", required_argument, NULL, OPTION_LISTING_LHS_WIDTH} + ,{"listing-lhs-width2", required_argument, NULL, OPTION_LISTING_LHS_WIDTH2} + ,{"listing-rhs-width", required_argument, NULL, OPTION_LISTING_RHS_WIDTH} + ,{"listing-cont-lines", required_argument, NULL, OPTION_LISTING_CONT_LINES} + ,{"MD", required_argument, NULL, OPTION_DEPFILE} + ,{"mri", no_argument, NULL, 'M'} + ,{"nocpp", no_argument, NULL, OPTION_NOCPP} + ,{"no-warn", no_argument, NULL, 'W'} + ,{"reduce-memory-overheads", no_argument, NULL, OPTION_REDUCE_MEMORY_OVERHEADS} + ,{"statistics", no_argument, NULL, OPTION_STATISTICS} + ,{"strip-local-absolute", no_argument, NULL, OPTION_STRIP_LOCAL_ABSOLUTE} + ,{"version", no_argument, NULL, OPTION_VERSION} + ,{"verbose", no_argument, NULL, OPTION_VERBOSE} + ,{"target-help", no_argument, NULL, OPTION_TARGET_HELP} + ,{"traditional-format", no_argument, NULL, OPTION_TRADITIONAL_FORMAT} + ,{"warn", no_argument, NULL, OPTION_WARN} }; /* Construct the option lists from the standard list and the target @@ -520,6 +551,8 @@ parse_args (int * pargc, char *** pargv) verbose = 1; break; } + else + as_bad (_("unrecognized option -%c%s"), optc, optarg ? optarg : ""); /* Fall through. */ case '?': @@ -557,12 +590,8 @@ parse_args (int * pargc, char *** pargv) case OPTION_VERSION: /* This output is intended to follow the GNU standards document. */ -#ifdef BFD_ASSEMBLER printf (_("GNU assembler %s\n"), BFD_VERSION_STRING); -#else - printf (_("GNU assembler %s\n"), VERSION); -#endif - printf (_("Copyright 2002 Free Software Foundation, Inc.\n")); + printf (_("Copyright 2005 Free Software Foundation, Inc.\n")); printf (_("\ 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")); @@ -602,11 +631,7 @@ the GNU General Public License. This program has absolutely no warranty.\n")); if (*s == '\0') as_fatal (_("bad defsym; format is --defsym name=value")); *s++ = '\0'; -#ifdef BFD_ASSEMBLER i = bfd_scan_vma (s, (const char **) NULL, 0); -#else - i = strtol (s, (char **) NULL, 0); -#endif n = xmalloc (sizeof *n); n->next = defsyms; n->name = optarg; @@ -648,6 +673,22 @@ the GNU General Public License. This program has absolutely no warranty.\n")); start_dependencies (optarg); break; + case 'g': + /* Some backends, eg Alpha and Mips, use the -g switch for their + own purposes. So we check here for an explicit -g and allow + the backend to decide if it wants to process it. */ + if ( old_argv[optind - 1][1] == 'g' + && md_parse_option (optc, optarg)) + continue; + + if (md_debug_format_selector) + debug_type = md_debug_format_selector (& use_gnu_debug_info_extensions); + else if (IS_ELF) + debug_type = DEBUG_DWARF2; + else + debug_type = DEBUG_STABS; + break; + case OPTION_GSTABS_PLUS: use_gnu_debug_info_extensions = 1; /* Fall through. */ @@ -680,6 +721,7 @@ the GNU General Public License. This program has absolutely no warranty.\n")); case OPTION_LISTING_LHS_WIDTH2: { int tmp = atoi (optarg); + if (tmp > listing_lhs_width) listing_lhs_width_second = tmp; } @@ -716,7 +758,7 @@ the GNU General Public License. This program has absolutely no warranty.\n")); flag_fatal_warnings = 1; break; -#if defined BFD_ASSEMBLER && (defined OBJ_ELF || defined OBJ_MAYBE_ELF) +#if defined OBJ_ELF || defined OBJ_MAYBE_ELF case OPTION_EXECSTACK: flag_execstack = 1; flag_noexecstack = 0; @@ -731,9 +773,31 @@ the GNU General Public License. This program has absolutely no warranty.\n")); flag_always_generate_output = 1; break; + case OPTION_AL: + listing |= LISTING_LISTING; + if (optarg) + listing_filename = xstrdup (optarg); + break; + + case OPTION_ALTERNATE: + optarg = old_argv [optind - 1]; + while (* optarg == '-') + optarg ++; + + if (strcmp (optarg, "alternate") == 0) + { + flag_macro_alternate = 1; + break; + } + optarg ++; + /* Fall through. */ + case 'a': if (optarg) { + if (optarg != old_argv[optind] && optarg[-1] == '=') + --optarg; + if (md_parse_option (optc, optarg) != 0) break; @@ -790,6 +854,7 @@ the GNU General Public License. This program has absolutely no warranty.\n")); case 'I': { /* Include file directory. */ char *temp = xstrdup (optarg); + add_include_dir (temp); break; } @@ -804,6 +869,24 @@ the GNU General Public License. This program has absolutely no warranty.\n")); case 'X': /* -X means treat warnings as errors. */ break; + + case OPTION_REDUCE_MEMORY_OVERHEADS: + /* The only change we make at the moment is to reduce + the size of the hash tables that we use. */ + set_gas_hash_table_size (4051); + break; + + case OPTION_HASH_TABLE_SIZE: + { + unsigned long new_size; + + new_size = strtoul (optarg, NULL, 0); + if (new_size) + set_gas_hash_table_size (new_size); + else + as_fatal (_("--hash-size needs a numeric argument")); + break; + } } } @@ -847,6 +930,14 @@ dump_statistics (void) #endif } +#ifndef OBJ_VMS +static void +close_output_file (void) +{ + output_file_close (out_file_name); +} +#endif + /* The interface between the macro code and gas expression handling. */ static int @@ -859,7 +950,7 @@ macro_expr (const char *emsg, int idx, sb *in, int *val) hold = input_line_pointer; input_line_pointer = in->ptr + idx; - expression (&ex); + expression_and_evaluate (&ex); idx = input_line_pointer - in->ptr; input_line_pointer = hold; @@ -884,44 +975,10 @@ static void perform_an_assembly_pass (int argc, char ** argv) { int saw_a_file = 0; -#ifdef BFD_ASSEMBLER flagword applicable; -#endif need_pass_2 = 0; -#ifndef BFD_ASSEMBLER -#ifdef MANY_SEGMENTS - { - unsigned int i; - for (i = SEG_E0; i < SEG_UNKNOWN; i++) - segment_info[i].fix_root = 0; - } - /* Create the three fixed ones. */ - { - segT seg; - -#ifdef TE_APOLLO - seg = subseg_new (".wtext", 0); -#else - seg = subseg_new (".text", 0); -#endif - assert (seg == SEG_E0); - seg = subseg_new (".data", 0); - assert (seg == SEG_E1); - seg = subseg_new (".bss", 0); - assert (seg == SEG_E2); -#ifdef TE_APOLLO - create_target_segments (); -#endif - } - -#else /* not MANY_SEGMENTS. */ - text_fix_root = NULL; - data_fix_root = NULL; - bss_fix_root = NULL; -#endif /* not MANY_SEGMENTS. */ -#else /* BFD_ASSEMBLER. */ /* Create the standard sections, and those the assembler uses internally. */ text_section = subseg_new (TEXT_SECTION_NAME, 0); @@ -943,12 +1000,10 @@ perform_an_assembly_pass (int argc, char ** argv) reg_section = subseg_new ("*GAS `reg' section*", 0); expr_section = subseg_new ("*GAS `expr' section*", 0); -#endif /* BFD_ASSEMBLER. */ - subseg_set (text_section, 0); /* This may add symbol table entries, which requires having an open BFD, - and sections already created, in BFD_ASSEMBLER mode. */ + and sections already created. */ md_begin (); #ifdef USING_CGEN @@ -981,7 +1036,6 @@ perform_an_assembly_pass (int argc, char ** argv) int main (int argc, char ** argv) { - int macro_alternate; int macro_strip_at; int keep_it; @@ -1006,6 +1060,8 @@ main (int argc, char ** argv) myname = argv[0]; xmalloc_set_program_name (myname); + expandargv (&argc, &argv); + START_PROGRESS (myname, 0); #ifndef OBJ_DEFAULT_OUTPUT_FILE_NAME @@ -1015,47 +1071,43 @@ main (int argc, char ** argv) out_file_name = OBJ_DEFAULT_OUTPUT_FILE_NAME; hex_init (); -#ifdef BFD_ASSEMBLER bfd_init (); bfd_set_error_program_name (myname); -#endif #ifdef USE_EMULATIONS select_emulation_mode (argc, argv); #endif PROGRESS (1); + /* Call parse_args before any of the init/begin functions + so that switches like --hash-size can be honored. */ + parse_args (&argc, &argv); symbol_begin (); frag_init (); subsegs_begin (); - parse_args (&argc, &argv); read_begin (); input_scrub_begin (); expr_begin (); +#ifndef OBJ_VMS /* Does its own file handling. */ + /* It has to be called after dump_statistics (). */ + xatexit (close_output_file); +#endif + if (flag_print_statistics) xatexit (dump_statistics); - macro_alternate = 0; macro_strip_at = 0; #ifdef TC_I960 macro_strip_at = flag_mri; #endif -#ifdef TC_A29K - /* For compatibility with the AMD 29K family macro assembler - specification. */ - macro_alternate = 1; - macro_strip_at = 1; -#endif - macro_init (macro_alternate, flag_mri, macro_strip_at, macro_expr); + macro_init (flag_macro_alternate, flag_mri, macro_strip_at, macro_expr); PROGRESS (1); -#ifdef BFD_ASSEMBLER output_file_create (out_file_name); assert (stdoutput != 0); -#endif #ifdef tc_init_after_args tc_init_after_args (); @@ -1090,7 +1142,7 @@ main (int argc, char ** argv) md_end (); #endif -#if defined BFD_ASSEMBLER && (defined OBJ_ELF || defined OBJ_MAYBE_ELF) +#if defined OBJ_ELF || defined OBJ_MAYBE_ELF if ((flag_execstack || flag_noexecstack) && OUTPUT_FLAVOR == bfd_target_elf_flavour) { @@ -1117,13 +1169,11 @@ main (int argc, char ** argv) else keep_it = 0; -#if defined (BFD_ASSEMBLER) || !defined (BFD) /* This used to be done at the start of write_object_file in write.c, but that caused problems when doing listings when keep_it was zero. This could probably be moved above md_end, but I didn't want to risk the change. */ subsegs_finish (); -#endif if (keep_it) write_object_file (); @@ -1132,13 +1182,6 @@ main (int argc, char ** argv) listing_print (listing_filename); #endif -#ifndef OBJ_VMS /* Does its own file handling. */ -#ifndef BFD_ASSEMBLER - if (keep_it) -#endif - output_file_close (out_file_name); -#endif - if (flag_fatal_warnings && had_warnings () > 0 && had_errors () == 0) as_bad (_("%d warnings, treating warnings as errors"), had_warnings ()); @@ -1146,7 +1189,7 @@ main (int argc, char ** argv) keep_it = 0; if (!keep_it) - unlink (out_file_name); + unlink_if_ordinary (out_file_name); input_scrub_end (); @@ -1162,4 +1205,3 @@ main (int argc, char ** argv) xexit (EXIT_SUCCESS); } - diff --git a/contrib/binutils/gas/as.h b/contrib/binutils/gas/as.h index 5e30f478313..2f92c2ed774 100644 --- a/contrib/binutils/gas/as.h +++ b/contrib/binutils/gas/as.h @@ -17,25 +17,24 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #ifndef GAS #define GAS 1 /* I think this stuff is largely out of date. xoxorich. - * - * CAPITALISED names are #defined. - * "lowercaseH" is #defined if "lowercase.h" has been #include-d. - * "lowercaseT" is a typedef of "lowercase" objects. - * "lowercaseP" is type "pointer to object of type 'lowercase'". - * "lowercaseS" is typedef struct ... lowercaseS. - * - * #define DEBUG to enable all the "know" assertion tests. - * #define SUSPECT when debugging hash code. - * #define COMMON as "extern" for all modules except one, where you #define - * COMMON as "". - * If TEST is #defined, then we are testing a module: #define COMMON as "". - */ + + CAPITALISED names are #defined. + "lowercaseH" is #defined if "lowercase.h" has been #include-d. + "lowercaseT" is a typedef of "lowercase" objects. + "lowercaseP" is type "pointer to object of type 'lowercase'". + "lowercaseS" is typedef struct ... lowercaseS. + + #define DEBUG to enable all the "know" assertion tests. + #define SUSPECT when debugging hash code. + #define COMMON as "extern" for all modules except one, where you #define + COMMON as "". + If TEST is #defined, then we are testing a module: #define COMMON as "". */ #include "config.h" #include "bin-bugs.h" @@ -69,6 +68,19 @@ extern void *alloca (); # endif /* HAVE_ALLOCA_H */ #endif /* __GNUC__ */ +/* Prefer varargs for non-ANSI compiler, since some will barf if the + ellipsis definition is used with a no-arguments declaration. */ +#if defined (HAVE_VARARGS_H) && !defined (__STDC__) +#undef HAVE_STDARG_H +#endif + +#if defined (HAVE_STDARG_H) +#define USE_STDARG +#endif +#if !defined (USE_STDARG) && defined (HAVE_VARARGS_H) +#define USE_VARARGS +#endif + /* Now, tend to the rest of the configuration. */ /* System include files first... */ @@ -91,6 +103,27 @@ extern void *alloca (); #include #endif +#ifdef HAVE_ERRNO_H +#include +#endif + +#ifdef USE_STDARG +#include +#endif + +#ifdef USE_VARARGS +#include +#endif + +#if !defined (USE_STDARG) && !defined (USE_VARARGS) +/* Roll our own. */ +#define va_alist REST +#define va_dcl +typedef int * va_list; +#define va_start(ARGS) ARGS = &REST +#define va_end(ARGS) +#endif + #include "getopt.h" /* The first getopt value for machine-independent long options. 150 isn't special; it's just an arbitrary non-ASCII char value. */ @@ -105,60 +138,49 @@ extern void *alloca (); #if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 6) #define __PRETTY_FUNCTION__ ((char*)0) #endif -#if 0 - -/* Handle lossage with assert.h. */ -#ifndef BROKEN_ASSERT -#include -#else /* BROKEN_ASSERT */ -#ifndef NDEBUG -#define assert(p) ((p) ? 0 : (as_assert (__FILE__, __LINE__, __PRETTY_FUNCTION__), 0)) -#else -#define assert(p) ((p), 0) -#endif -#endif /* BROKEN_ASSERT */ - -#else - -#define assert(P) ((P) ? 0 : (as_assert (__FILE__, __LINE__, __PRETTY_FUNCTION__), 0)) +#define assert(P) \ + ((void) ((P) ? 0 : (as_assert (__FILE__, __LINE__, __PRETTY_FUNCTION__), 0))) #undef abort #define abort() as_abort (__FILE__, __LINE__, __PRETTY_FUNCTION__) -#endif - /* Now GNU header files... */ #include "ansidecl.h" -#ifdef BFD_ASSEMBLER #include "bfd.h" -#endif #include "libiberty.h" /* Define the standard progress macros. */ #include "progress.h" /* This doesn't get taken care of anywhere. */ -#ifndef __MWERKS__ /* Metrowerks C chokes on the "defined (inline)" */ +#ifndef __MWERKS__ /* Metrowerks C chokes on the "defined (inline)" */ #if !defined (__GNUC__) && !defined (inline) #define inline #endif #endif /* !__MWERKS__ */ /* Other stuff from config.h. */ -#ifdef NEED_DECLARATION_STRSTR -extern char *strstr (); +#ifdef NEED_DECLARATION_ENVIRON +extern char **environ; +#endif +#ifdef NEED_DECLARATION_ERRNO +extern int errno; +#endif +#ifdef NEED_DECLARATION_FFS +extern int ffs (int); +#endif +#ifdef NEED_DECLARATION_FREE +extern void free (); #endif #ifdef NEED_DECLARATION_MALLOC extern PTR malloc (); extern PTR realloc (); #endif -#ifdef NEED_DECLARATION_FREE -extern void free (); +#ifdef NEED_DECLARATION_STRSTR +extern char *strstr (); #endif -#ifdef NEED_DECLARATION_ERRNO -extern int errno; -#endif -#ifdef NEED_DECLARATION_ENVIRON -extern char **environ; + +#if !HAVE_DECL_VSNPRINTF +extern int vsnprintf(char *, size_t, const char *, va_list); #endif /* This is needed for VMS. */ @@ -221,33 +243,28 @@ extern char **environ; /* These are assembler-wide concepts */ -#ifdef BFD_ASSEMBLER extern bfd *stdoutput; typedef bfd_vma addressT; typedef bfd_signed_vma offsetT; -#else -typedef unsigned long addressT; -typedef long offsetT; -#endif /* Type of symbol value, etc. For use in prototypes. */ typedef addressT valueT; #ifndef COMMON #ifdef TEST -#define COMMON /* declare our COMMONs storage here. */ +#define COMMON /* Declare our COMMONs storage here. */ #else -#define COMMON extern /* our commons live elsewhere */ +#define COMMON extern /* Our commons live elsewhere. */ #endif #endif /* COMMON now defined */ #ifdef DEBUG #ifndef know -#define know(p) assert(p) /* Verify our assumptions! */ +#define know(p) assert(p) /* Verify our assumptions! */ #endif /* not yet defined */ #else -#define know(p) /* know() checks are no-op.ed */ +#define know(p) /* know() checks are no-op.ed */ #endif /* input_scrub.c */ @@ -257,90 +274,36 @@ typedef addressT valueT; /* subsegs.c Sub-segments. Also, segment(=expression type)s.*/ -#ifndef BFD_ASSEMBLER - -#ifdef MANY_SEGMENTS -#include "bfd.h" -#define N_SEGMENTS 40 -#define SEG_NORMAL(x) ((x) >= SEG_E0 && (x) <= SEG_E39) -#define SEG_LIST SEG_E0,SEG_E1,SEG_E2,SEG_E3,SEG_E4,SEG_E5,SEG_E6,SEG_E7,SEG_E8,SEG_E9,\ - SEG_E10,SEG_E11,SEG_E12,SEG_E13,SEG_E14,SEG_E15,SEG_E16,SEG_E17,SEG_E18,SEG_E19,\ - SEG_E20,SEG_E21,SEG_E22,SEG_E23,SEG_E24,SEG_E25,SEG_E26,SEG_E27,SEG_E28,SEG_E29,\ - SEG_E30,SEG_E31,SEG_E32,SEG_E33,SEG_E34,SEG_E35,SEG_E36,SEG_E37,SEG_E38,SEG_E39 -#define SEG_TEXT SEG_E0 -#define SEG_DATA SEG_E1 -#define SEG_BSS SEG_E2 -#define SEG_LAST SEG_E39 -#else -#define N_SEGMENTS 3 -#define SEG_NORMAL(x) ((x) == SEG_TEXT || (x) == SEG_DATA || (x) == SEG_BSS) -#define SEG_LIST SEG_TEXT,SEG_DATA,SEG_BSS -#endif - -typedef enum _segT { - SEG_ABSOLUTE = 0, - SEG_LIST, - SEG_UNKNOWN, - SEG_GOOF, /* Only happens if AS has a logic error. */ - /* Invented so we don't crash printing */ - /* error message involving weird segment. */ - SEG_EXPR, /* Intermediate expression values. */ - SEG_DEBUG, /* Debug segment */ - SEG_NTV, /* Transfert vector preload segment */ - SEG_PTV, /* Transfert vector postload segment */ - SEG_REGISTER /* Mythical: a register-valued expression */ -} segT; - -#define SEG_MAXIMUM_ORDINAL (SEG_REGISTER) -#else typedef asection *segT; -#define SEG_NORMAL(SEG) ((SEG) != absolute_section \ +#define SEG_NORMAL(SEG) ( (SEG) != absolute_section \ && (SEG) != undefined_section \ && (SEG) != reg_section \ && (SEG) != expr_section) -#endif typedef int subsegT; -/* What subseg we are accessing now? */ +/* What subseg we are accessing now? */ COMMON subsegT now_subseg; /* Segment our instructions emit to. */ COMMON segT now_seg; -#ifdef BFD_ASSEMBLER #define segment_name(SEG) bfd_get_section_name (stdoutput, SEG) -#else -extern char const *const seg_name[]; -#define segment_name(SEG) seg_name[(int) (SEG)] -#endif -#ifndef BFD_ASSEMBLER -extern int section_alignment[]; -#endif - -#ifdef BFD_ASSEMBLER extern segT reg_section, expr_section; /* Shouldn't these be eliminated someday? */ extern segT text_section, data_section, bss_section; #define absolute_section bfd_abs_section_ptr #define undefined_section bfd_und_section_ptr -#else -#define reg_section SEG_REGISTER -#define expr_section SEG_EXPR -#define text_section SEG_TEXT -#define data_section SEG_DATA -#define bss_section SEG_BSS -#define absolute_section SEG_ABSOLUTE -#define undefined_section SEG_UNKNOWN -#endif -/* relax() */ +enum _relax_state +{ + /* Dummy frag used by listing code. */ + rs_dummy = 0, -enum _relax_state { /* Variable chars to be repeated fr_offset times. Fr_symbol unused. Used with fr_offset == 0 for a constant length frag. */ - rs_fill = 1, + rs_fill, /* Align. The fr_offset field holds the power of 2 to which to align. The fr_var field holds the number of characters in the @@ -368,7 +331,7 @@ enum _relax_state { rs_broken_word, #endif - /* machine-specific relaxable (or similarly alterable) instruction */ + /* Machine specific relaxable (or similarly alterable) instruction. */ rs_machine_dependent, /* .space directive with expression operand that needs to be computed @@ -414,7 +377,7 @@ struct relax_type typedef struct relax_type relax_typeS; -/* main program "as.c" (command arguments etc) */ +/* main program "as.c" (command arguments etc). */ COMMON unsigned char flag_no_comments; /* -f */ COMMON unsigned char flag_debug; /* -D */ @@ -482,7 +445,8 @@ extern int listing; This is especially relevant to DWARF2, since the compiler may emit line number directives that the assembler resolves. */ -enum debug_info_type { +enum debug_info_type +{ DEBUG_UNSPECIFIED, DEBUG_NONE, DEBUG_STABS, @@ -504,7 +468,8 @@ extern int verbose; increase malloc calls for monitoring memory allocation. */ extern int chunksize; -struct _pseudo_type { +struct _pseudo_type +{ /* assembler mnemonic, lower case, no '.' */ const char *poc_name; /* Do the work */ @@ -515,19 +480,6 @@ struct _pseudo_type { typedef struct _pseudo_type pseudo_typeS; -/* Prefer varargs for non-ANSI compiler, since some will barf if the - ellipsis definition is used with a no-arguments declaration. */ -#if defined (HAVE_VARARGS_H) && !defined (__STDC__) -#undef HAVE_STDARG_H -#endif - -#if defined (HAVE_STDARG_H) -#define USE_STDARG -#endif -#if !defined (USE_STDARG) && defined (HAVE_VARARGS_H) -#define USE_VARARGS -#endif - #ifdef USE_STDARG #if (__GNUC__ >= 2) && !defined(VMS) /* for use with -Wformat */ @@ -569,54 +521,48 @@ PRINTF_LIKE (as_warn); PRINTF_WHERE_LIKE (as_bad_where); PRINTF_WHERE_LIKE (as_warn_where); -void as_assert (const char *, int, const char *); -void as_abort (const char *, int, const char *) ATTRIBUTE_NORETURN; - -void fprint_value (FILE *file, addressT value); -void sprint_value (char *buf, addressT value); - -int had_errors (void); -int had_warnings (void); - -void print_version_id (void); -char *app_push (void); -char *atof_ieee (char *str, int what_kind, LITTLENUM_TYPE * words); -char *input_scrub_include_file (char *filename, char *position); -extern void input_scrub_insert_line (const char *line); -extern void input_scrub_insert_file (char *path); -char *input_scrub_new_file (char *filename); -char *input_scrub_next_buffer (char **bufp); -int do_scrub_chars (int (*get) (char *, int), char *to, int tolen); -int gen_to_words (LITTLENUM_TYPE * words, int precision, - long exponent_bits); -int had_err (void); -int ignore_input (void); -void cond_finish_check (int); -void cond_exit_macro (int); -int seen_at_least_1_file (void); -void app_pop (char *arg); -void as_howmuch (FILE * stream); -void as_perror (const char *gripe, const char *filename); -void as_where (char **namep, unsigned int *linep); -void bump_line_counters (void); -void do_scrub_begin (int); -void input_scrub_begin (void); -void input_scrub_close (void); -void input_scrub_end (void); -int new_logical_line (char *fname, int line_number); -void subsegs_begin (void); -void subseg_change (segT seg, int subseg); -segT subseg_new (const char *name, subsegT subseg); -segT subseg_force_new (const char *name, subsegT subseg); -void subseg_set (segT seg, subsegT subseg); -#ifdef BFD_ASSEMBLER -segT subseg_get (const char *, int); -#endif -int subseg_text_p (segT); - -void start_dependencies (char *); -void register_dependency (char *); -void print_dependencies (void); +void as_assert (const char *, int, const char *); +void as_abort (const char *, int, const char *) ATTRIBUTE_NORETURN; +void sprint_value (char *, addressT); +int had_errors (void); +int had_warnings (void); +void as_warn_value_out_of_range (char *, offsetT, offsetT, offsetT, char *, unsigned); +void as_bad_value_out_of_range (char *, offsetT, offsetT, offsetT, char *, unsigned); +void print_version_id (void); +char * app_push (void); +char * atof_ieee (char *, int, LITTLENUM_TYPE *); +char * input_scrub_include_file (char *, char *); +void input_scrub_insert_line (const char *); +void input_scrub_insert_file (char *); +char * input_scrub_new_file (char *); +char * input_scrub_next_buffer (char **bufp); +int do_scrub_chars (int (*get) (char *, int), char *, int); +int gen_to_words (LITTLENUM_TYPE *, int, long); +int had_err (void); +int ignore_input (void); +void cond_finish_check (int); +void cond_exit_macro (int); +int seen_at_least_1_file (void); +void app_pop (char *); +void as_perror (const char *, const char *); +void as_where (char **, unsigned int *); +void bump_line_counters (void); +void do_scrub_begin (int); +void input_scrub_begin (void); +void input_scrub_close (void); +void input_scrub_end (void); +int new_logical_line (char *, int); +void subsegs_begin (void); +void subseg_change (segT, int); +segT subseg_new (const char *, subsegT); +segT subseg_force_new (const char *, subsegT); +void subseg_set (segT, subsegT); +int subseg_text_p (segT); +int seg_not_empty_p (segT); +void start_dependencies (char *); +void register_dependency (char *); +void print_dependencies (void); +segT subseg_get (const char *, int); struct expressionS; struct fix; @@ -624,21 +570,18 @@ typedef struct symbol symbolS; struct relax_type; typedef struct frag fragS; -#ifdef BFD_ASSEMBLER /* literal.c */ valueT add_to_literal_pool (symbolS *, valueT, segT, int); -#endif int check_eh_frame (struct expressionS *, unsigned int *); int eh_frame_estimate_size_before_relax (fragS *); int eh_frame_relax_frag (fragS *); void eh_frame_convert_frag (fragS *); - int generic_force_reloc (struct fix *); #include "expr.h" /* Before targ-*.h */ -/* this one starts the chain of target dependant headers */ +/* This one starts the chain of target dependant headers. */ #include "targ-env.h" #ifdef OBJ_MAYBE_ELF @@ -668,14 +611,19 @@ int generic_force_reloc (struct fix *); #ifdef TC_M68K /* True if we are assembling in m68k MRI mode. */ COMMON int flag_m68k_mri; +#define DOLLAR_AMBIGU flag_m68k_mri #else #define flag_m68k_mri 0 #endif #ifdef WARN_COMMENTS -COMMON int warn_comment; -COMMON unsigned int found_comment; -COMMON char *found_comment_file; +COMMON int warn_comment; +COMMON unsigned int found_comment; +COMMON char * found_comment_file; +#endif + +#ifndef DOLLAR_AMBIGU +#define DOLLAR_AMBIGU 0 #endif #ifndef NUMBERS_WITH_SUFFIX diff --git a/contrib/binutils/gas/asintl.h b/contrib/binutils/gas/asintl.h index 41bb21826ee..67ce0dd4fd4 100644 --- a/contrib/binutils/gas/asintl.h +++ b/contrib/binutils/gas/asintl.h @@ -1,5 +1,5 @@ /* asintl.h - gas-specific header for gettext code. - Copyright 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright 1998, 1999, 2000, 2005 Free Software Foundation, Inc. Written by Tom Tromey @@ -17,10 +17,19 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #ifdef HAVE_LOCALE_H +# ifndef ENABLE_NLS + /* The Solaris version of locale.h always includes libintl.h. If we have + been configured with --disable-nls then ENABLE_NLS will not be defined + and the dummy definitions of bindtextdomain (et al) below will conflict + with the defintions in libintl.h. So we define these values to prevent + the bogus inclusion of libintl.h. */ +# define _LIBINTL_H +# define _LIBGETTEXT_H +# endif # include #endif diff --git a/contrib/binutils/gas/atof-generic.c b/contrib/binutils/gas/atof-generic.c index 8c599b571ed..6a5c2f15b3c 100644 --- a/contrib/binutils/gas/atof-generic.c +++ b/contrib/binutils/gas/atof-generic.c @@ -1,6 +1,6 @@ /* atof_generic.c - turn a string of digits into a Flonum - Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001 - Free Software Foundation, Inc. + Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000, + 2001, 2003, 2005 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -16,8 +16,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #include @@ -324,19 +324,10 @@ atof_generic (/* return pointer to just AFTER number we read. */ + 1); /* Number of destination littlenums. */ /* Includes guard bits (two littlenums worth) */ -#if 0 /* The integer version below is very close, and it doesn't - require floating point support (which is currently buggy on - the Alpha). */ - maximum_useful_digits = (((double) (precision - 2)) - * ((double) (LITTLENUM_NUMBER_OF_BITS)) - / (LOG_TO_BASE_2_OF_10)) - + 2; /* 2 :: guard digits. */ -#else maximum_useful_digits = (((precision - 2)) * ( (LITTLENUM_NUMBER_OF_BITS)) * 1000000 / 3321928) + 2; /* 2 :: guard digits. */ -#endif if (number_of_digits_available > maximum_useful_digits) { @@ -353,13 +344,8 @@ atof_generic (/* return pointer to just AFTER number we read. */ decimal_exponent += ((long) number_of_digits_before_decimal - (long) number_of_digits_to_use); -#if 0 - more_than_enough_bits_for_digits - = ((((double) number_of_digits_to_use) * LOG_TO_BASE_2_OF_10) + 1); -#else more_than_enough_bits_for_digits = (number_of_digits_to_use * 3321928 / 1000000 + 1); -#endif more_than_enough_littlenums_for_digits = (more_than_enough_bits_for_digits diff --git a/contrib/binutils/gas/bignum-copy.c b/contrib/binutils/gas/bignum-copy.c deleted file mode 100644 index 56974722f51..00000000000 --- a/contrib/binutils/gas/bignum-copy.c +++ /dev/null @@ -1,80 +0,0 @@ -/* bignum_copy.c - copy a bignum - Copyright 1987, 1990, 1991, 1992, 1993, 2000 - 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" - -/* - * bignum_copy () - * - * Copy a bignum from in to out. - * If the output is shorter than the input, copy lower-order littlenums. - * Return 0 or the number of significant littlenums dropped. - * Assumes littlenum arrays are densely packed: no unused chars between - * the littlenums. Uses memcpy() to move littlenums, and wants to - * know length (in chars) of the input bignum. - */ - -/* void */ -int -bignum_copy (register LITTLENUM_TYPE *in, - register int in_length, /* in sizeof(littlenum)s */ - register LITTLENUM_TYPE *out, - register int out_length /* in sizeof(littlenum)s */) -{ - int significant_littlenums_dropped; - - if (out_length < in_length) - { - LITTLENUM_TYPE *p; /* -> most significant (non-zero) input - littlenum. */ - - memcpy ((void *) out, (void *) in, - (unsigned int) out_length << LITTLENUM_SHIFT); - for (p = in + in_length - 1; p >= in; --p) - { - if (*p) - break; - } - significant_littlenums_dropped = p - in - in_length + 1; - - if (significant_littlenums_dropped < 0) - { - significant_littlenums_dropped = 0; - } - } - else - { - memcpy ((char *) out, (char *) in, - (unsigned int) in_length << LITTLENUM_SHIFT); - - if (out_length > in_length) - { - memset ((char *) (out + in_length), - '\0', - (unsigned int) (out_length - in_length) << LITTLENUM_SHIFT); - } - - significant_littlenums_dropped = 0; - } - - return (significant_littlenums_dropped); -} /* bignum_copy() */ - -/* end of bignum-copy.c */ diff --git a/contrib/binutils/gas/bignum.h b/contrib/binutils/gas/bignum.h index fbb77ffe7e1..d9e0429ddeb 100644 --- a/contrib/binutils/gas/bignum.h +++ b/contrib/binutils/gas/bignum.h @@ -1,5 +1,5 @@ /* bignum.h-arbitrary precision integers - Copyright 1987, 1992 Free Software Foundation, Inc. + Copyright 1987, 1992, 2003, 2005 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -15,7 +15,7 @@ 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. */ + the Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /***********************************************************************\ * * @@ -39,14 +39,3 @@ #endif typedef unsigned short LITTLENUM_TYPE; - -/* JF truncated this to get around a problem with GCC */ -#define LOG_TO_BASE_2_OF_10 (3.3219280948873623478703194294893901758651) -/* WARNING: I haven't checked that the trailing digits are correct! */ - -/* lengths are in sizeof(littlenum)s */ - -int bignum_copy (LITTLENUM_TYPE * in, int in_length, - LITTLENUM_TYPE * out, int out_length); - -/* end of bignum.h */ diff --git a/contrib/binutils/gas/bit_fix.h b/contrib/binutils/gas/bit_fix.h index 1676d2c5f0b..64be49b430a 100644 --- a/contrib/binutils/gas/bit_fix.h +++ b/contrib/binutils/gas/bit_fix.h @@ -1,5 +1,5 @@ /* bit_fix.h - Copyright 1987, 1992, 2000, 2001 Free Software Foundation, Inc. + Copyright 1987, 1992, 2000, 2001, 2003 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -15,8 +15,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ /* The bit_fix was implemented to support machines that need variables to be inserted in bitfields other than 1, 2 and 4 bytes. diff --git a/contrib/binutils/gas/cgen.c b/contrib/binutils/gas/cgen.c index 5ce7f4c99ec..363c05e5318 100644 --- a/contrib/binutils/gas/cgen.c +++ b/contrib/binutils/gas/cgen.c @@ -1,5 +1,5 @@ /* GAS interface for targets using CGEN: Cpu tools GENerator. - Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -16,7 +16,7 @@ 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. */ + Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include #include "ansidecl.h" @@ -225,7 +225,7 @@ gas_cgen_swap_fixups (i) 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_fix3. */ + 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) @@ -264,7 +264,7 @@ gas_cgen_record_fixup (frag, where, insn, length, operand, opinfo, symbol, offse 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_fix3. */ + 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) @@ -320,9 +320,11 @@ gas_cgen_parse_operand (cd, want, strP, opindex, opinfo, resultP, valueP) /* These are volatile to survive the setjmp. */ char * volatile hold; enum cgen_parse_operand_result * volatile resultP_1; + volatile int opinfo_1; #else static char *hold; static enum cgen_parse_operand_result *resultP_1; + int opinfo_1; #endif const char *errmsg; expressionS exp; @@ -336,6 +338,7 @@ gas_cgen_parse_operand (cd, want, strP, opindex, opinfo, resultP, valueP) resultP_1 = resultP; hold = input_line_pointer; input_line_pointer = (char *) *strP; + opinfo_1 = opinfo; /* We rely on md_operand to longjmp back to us. This is done via gas_cgen_md_operand. */ @@ -355,6 +358,10 @@ gas_cgen_parse_operand (cd, want, strP, opindex, opinfo, resultP, valueP) *strP = input_line_pointer; input_line_pointer = hold; +#ifdef TC_CGEN_PARSE_FIX_EXP + opinfo_1 = TC_CGEN_PARSE_FIX_EXP (opinfo_1, & exp); +#endif + /* FIXME: Need to check `want'. */ switch (exp.X_op) @@ -368,6 +375,8 @@ gas_cgen_parse_operand (cd, want, strP, opindex, opinfo, resultP, valueP) *resultP = CGEN_PARSE_OPERAND_RESULT_ERROR; break; case O_constant: + if (want == CGEN_PARSE_OPERAND_SYMBOLIC) + goto de_fault; *valueP = exp.X_add_number; *resultP = CGEN_PARSE_OPERAND_RESULT_NUMBER; break; @@ -375,8 +384,9 @@ gas_cgen_parse_operand (cd, want, strP, opindex, opinfo, resultP, valueP) *valueP = exp.X_add_number; *resultP = CGEN_PARSE_OPERAND_RESULT_REGISTER; break; + de_fault: default: - queue_fixup (opindex, opinfo, &exp); + queue_fixup (opindex, opinfo_1, &exp); *valueP = 0; *resultP = CGEN_PARSE_OPERAND_RESULT_QUEUED; break; @@ -515,7 +525,7 @@ gas_cgen_finish_insn (insn, buf, length, relax_p, result) /* 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); + cgen_put_insn_value (gas_cgen_cpu_desc, (unsigned char *) f, length, *buf); #else memcpy (f, buf, byte_len); #endif @@ -570,7 +580,7 @@ gas_cgen_finish_insn (insn, buf, length, relax_p, result) should handle them all. */ void -gas_cgen_md_apply_fix3 (fixP, valP, seg) +gas_cgen_md_apply_fix (fixP, valP, seg) fixS * fixP; valueT * valP; segT seg ATTRIBUTE_UNUSED; @@ -609,17 +619,19 @@ gas_cgen_md_apply_fix3 (fixP, valP, seg) #if CGEN_INT_INSN_P { CGEN_INSN_INT insn_value = - cgen_get_insn_value (cd, where, CGEN_INSN_BITSIZE (insn)); + cgen_get_insn_value (cd, (unsigned char *) 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); + cgen_put_insn_value (cd, (unsigned char *) where, + CGEN_INSN_BITSIZE (insn), insn_value); } #else /* ??? 0 is passed for `pc'. */ - errmsg = CGEN_CPU_INSERT_OPERAND (cd) (cd, opindex, fields, where, + errmsg = CGEN_CPU_INSERT_OPERAND (cd) (cd, opindex, fields, + (unsigned char *) where, (bfd_vma) 0); #endif if (errmsg) diff --git a/contrib/binutils/gas/cgen.h b/contrib/binutils/gas/cgen.h index 8cf72af4b39..acb9f48d459 100644 --- a/contrib/binutils/gas/cgen.h +++ b/contrib/binutils/gas/cgen.h @@ -1,5 +1,6 @@ /* GAS cgen support. - Copyright 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright 1998, 1999, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -15,8 +16,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #ifndef GAS_CGEN_H #define GAS_CGEN_H @@ -79,8 +80,8 @@ extern fixS * gas_cgen_record_fixup_exp (fragS *, int, const CGEN_INSN *, int, const CGEN_OPERAND *, int, expressionS *); -/* md_apply_fix3 handler */ -extern void gas_cgen_md_apply_fix3 (fixS *, valueT *, segT); +/* md_apply_fix handler */ +extern void gas_cgen_md_apply_fix (fixS *, valueT *, segT); /* tc_gen_reloc handler */ extern arelent *gas_cgen_tc_gen_reloc (asection *, fixS *); diff --git a/contrib/binutils/gas/cond.c b/contrib/binutils/gas/cond.c index 870a7d5bf5c..d6c32acc253 100644 --- a/contrib/binutils/gas/cond.c +++ b/contrib/binutils/gas/cond.c @@ -1,6 +1,6 @@ /* cond.c - conditional assembly pseudo-ops, and .include - Copyright 1990, 1991, 1992, 1993, 1995, 1997, 1998, 2000, 2001 - Free Software Foundation, Inc. + Copyright 1990, 1991, 1992, 1993, 1995, 1997, 1998, 2000, 2001, 2002, + 2003 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -16,8 +16,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #include "as.h" #include "macro.h" @@ -102,7 +102,7 @@ s_ifdef (int test_defined) considered to be undefined. */ is_defined = symbolP != NULL - && S_IS_DEFINED (symbolP) + && (S_IS_DEFINED (symbolP) || symbol_equated_p (symbolP)) && S_GET_SEGMENT (symbolP) != reg_section; cframe.ignoring = ! (test_defined ^ is_defined); @@ -144,7 +144,7 @@ s_if (int arg) } else { - expression (&operand); + expression_and_evaluate (&operand); if (operand.X_op != O_constant) as_bad (_("non-constant expression in \".if\" statement")); } @@ -181,6 +181,40 @@ s_if (int arg) demand_empty_rest_of_line (); } +/* Performs the .ifb (test_blank == 1) and + the .ifnb (test_blank == 0) pseudo op. */ + +void +s_ifb (int test_blank) +{ + struct conditional_frame cframe; + + initialize_cframe (&cframe); + + if (cframe.dead_tree) + cframe.ignoring = 1; + else + { + int is_eol; + + SKIP_WHITESPACE (); + is_eol = is_end_of_line[(unsigned char) *input_line_pointer]; + cframe.ignoring = (test_blank == !is_eol); + } + + current_cframe = ((struct conditional_frame *) + obstack_copy (&cond_obstack, &cframe, + sizeof (cframe))); + + if (LISTING_SKIP_COND () + && cframe.ignoring + && (cframe.previous_cframe == NULL + || ! cframe.previous_cframe->ignoring)) + listing_list (2); + + ignore_rest_of_line (); +} + /* Get a string for the MRI IFC or IFNC pseudo-ops. */ static char * @@ -306,7 +340,7 @@ s_elseif (int arg) /* Leading whitespace is part of operand. */ SKIP_WHITESPACE (); - expression (&operand); + expression_and_evaluate (&operand); if (operand.X_op != O_constant) as_bad (_("non-constant expression in \".elseif\" statement")); diff --git a/contrib/binutils/gas/config.in b/contrib/binutils/gas/config.in index fe2bc3fbcfb..b15d8024aba 100644 --- a/contrib/binutils/gas/config.in +++ b/contrib/binutils/gas/config.in @@ -1,179 +1,164 @@ -/* config.in. Generated automatically from configure.in by autoheader. */ +/* config.in. Generated from configure.in by autoheader. */ -/* Define if using alloca.c. */ -#undef C_ALLOCA +/* Define if using AIX 5.2 value for C_WEAKEXT. */ +#undef AIX_WEAK_SUPPORT -/* Define to empty if the keyword does not work. */ -#undef const +/* assert broken? */ +#undef BROKEN_ASSERT -/* 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. */ +/* 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 +/* Compiling cross-assembler? */ +#undef CROSS_COMPILE -/* Define if you have and it should be used (not on Ultrix). */ -#undef HAVE_ALLOCA_H - -/* Define if you have a working `mmap' system call. */ -#undef HAVE_MMAP - -/* Define as __inline if that's what the C compiler calls it. */ -#undef inline - -/* Define to `long' if doesn't define. */ -#undef off_t - -/* Define to `unsigned' if doesn't define. */ -#undef size_t - -/* If using the C implementation of alloca, define if you know the - direction of stack growth for your system; otherwise it will be - automatically deduced at run-time. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown - */ -#undef STACK_DIRECTION - -/* Define if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Define if lex declares yytext as a char * by default, not a char[]. */ -#undef YYTEXT_POINTER - -/* Define if you have the __argz_count function. */ -#undef HAVE___ARGZ_COUNT - -/* Define if you have the __argz_next function. */ -#undef HAVE___ARGZ_NEXT - -/* Define if you have the __argz_stringify function. */ -#undef HAVE___ARGZ_STRINGIFY - -/* Define if you have the dcgettext function. */ -#undef HAVE_DCGETTEXT - -/* Define if you have the getcwd function. */ -#undef HAVE_GETCWD - -/* Define if you have the getpagesize function. */ -#undef HAVE_GETPAGESIZE - -/* Define if you have the munmap function. */ -#undef HAVE_MUNMAP - -/* Define if you have the putenv function. */ -#undef HAVE_PUTENV - -/* 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 setenv function. */ -#undef HAVE_SETENV - -/* Define if you have the setlocale function. */ -#undef HAVE_SETLOCALE - -/* Define if you have the stpcpy function. */ -#undef HAVE_STPCPY - -/* Define if you have the strcasecmp function. */ -#undef HAVE_STRCASECMP - -/* Define if you have the strchr function. */ -#undef HAVE_STRCHR - -/* Define if you have the unlink function. */ -#undef HAVE_UNLINK - -/* Define if you have the header file. */ -#undef HAVE_ARGZ_H - -/* Define if you have the header file. */ -#undef HAVE_ERRNO_H - -/* Define if you have the header file. */ -#undef HAVE_LIMITS_H - -/* Define if you have the header file. */ -#undef HAVE_LOCALE_H - -/* Define if you have the header file. */ -#undef HAVE_MALLOC_H - -/* Define if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define if you have the header file. */ -#undef HAVE_NL_TYPES_H - -/* Define if you have the header file. */ -#undef HAVE_STDARG_H - -/* Define if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define if you have the header file. */ -#undef HAVE_STRING_H - -/* Define if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_PARAM_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define if you have the header file. */ -#undef HAVE_VALUES_H - -/* Define if you have the header file. */ -#undef HAVE_VARARGS_H - -/* Name of package */ -#undef PACKAGE - -/* Version number of package */ -#undef VERSION - -/* Define if defaulting to ELF on SCO 5. */ -#undef SCO_ELF - -/* Using strict COFF? */ -#undef STRICTCOFF - -/* Define if default target is PowerPC Solaris. */ -#undef TARGET_SOLARIS_COMMENT - -/* Define as 1 if big endian. */ -#undef TARGET_BYTES_BIG_ENDIAN - -/* Default CPU for MIPS targets. */ -#undef MIPS_CPU_STRING_DEFAULT - -/* Allow use of E_MIPS_ABI_O32 on MIPS targets. */ -#undef USE_E_MIPS_ABI_O32 - -/* Generate 64-bit code by default on MIPS targets. */ -#undef MIPS_DEFAULT_64BIT - -/* Choose a default ABI for MIPS targets. */ -#undef MIPS_DEFAULT_ABI +/* Define to 1 if using `alloca.c'. */ +#undef C_ALLOCA /* Default architecture. */ #undef DEFAULT_ARCH -/* Using cgen code? */ -#undef USING_CGEN +/* Default CRIS architecture. */ +#undef DEFAULT_CRIS_ARCH + +/* Default emulation. */ +#undef DEFAULT_EMULATION + +/* Supported emulations. */ +#undef EMULATIONS + +/* Define to 1 if NLS is requested */ +#undef ENABLE_NLS + +/* Define to 1 if you have `alloca', as a function or macro. */ +#undef HAVE_ALLOCA + +/* Define to 1 if you have and it should be used (not on Ultrix). + */ +#undef HAVE_ALLOCA_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_ARGZ_H + +/* Define to 1 if you have the `dcgettext' function. */ +#undef HAVE_DCGETTEXT + +/* Is the prototype for getopt in in the expected format? */ +#undef HAVE_DECL_GETOPT + +/* Define to 1 if you have the declaration of `vsnprintf', and to 0 if you + don't. */ +#undef HAVE_DECL_VSNPRINTF + +/* Define to 1 if you have the header file. */ +#undef HAVE_ERRNO_H + +/* Define to 1 if you have the `getcwd' function. */ +#undef HAVE_GETCWD + +/* Define to 1 if you have the `getpagesize' function. */ +#undef HAVE_GETPAGESIZE + +/* Define as 1 if you have gettext and don't want to use GNU gettext. */ +#undef HAVE_GETTEXT + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define if your locale.h file contains LC_MESSAGES. */ +#undef HAVE_LC_MESSAGES + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIMITS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LOCALE_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MALLOC_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have a working `mmap' system call. */ +#undef HAVE_MMAP + +/* Define to 1 if you have the `munmap' function. */ +#undef HAVE_MUNMAP + +/* Define to 1 if you have the header file. */ +#undef HAVE_NL_TYPES_H + +/* Define to 1 if you have the `putenv' function. */ +#undef HAVE_PUTENV + +/* Define to 1 if you have the `remove' function. */ +#undef HAVE_REMOVE + +/* Define to 1 if you have the `sbrk' function. */ +#undef HAVE_SBRK + +/* Define to 1 if you have the `setenv' function. */ +#undef HAVE_SETENV + +/* Define to 1 if you have the `setlocale' function. */ +#undef HAVE_SETLOCALE + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDARG_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define if you have the stpcpy function */ +#undef HAVE_STPCPY + +/* Define to 1 if you have the `strcasecmp' function. */ +#undef HAVE_STRCASECMP + +/* Define to 1 if you have the `strchr' function. */ +#undef HAVE_STRCHR + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the `unlink' function. */ +#undef HAVE_UNLINK + +/* Define to 1 if you have the header file. */ +#undef HAVE_VALUES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_VARARGS_H + +/* Define to 1 if you have the `__argz_count' function. */ +#undef HAVE___ARGZ_COUNT + +/* Define to 1 if you have the `__argz_next' function. */ +#undef HAVE___ARGZ_NEXT + +/* Define to 1 if you have the `__argz_stringify' function. */ +#undef HAVE___ARGZ_STRINGIFY /* Using i386 COFF? */ #undef I386COFF @@ -184,6 +169,36 @@ /* Using m88k COFF? */ #undef M88KCOFF +/* Default CPU for MIPS targets. */ +#undef MIPS_CPU_STRING_DEFAULT + +/* Generate 64-bit code by default on MIPS targets. */ +#undef MIPS_DEFAULT_64BIT + +/* Choose a default ABI for MIPS targets. */ +#undef MIPS_DEFAULT_ABI + +/* Define if environ is not declared in system header files. */ +#undef NEED_DECLARATION_ENVIRON + +/* Define if errno is not declared in system header files. */ +#undef NEED_DECLARATION_ERRNO + +/* Define if ffs is not declared in system header files. */ +#undef NEED_DECLARATION_FFS + +/* Define if free is not declared in system header files. */ +#undef NEED_DECLARATION_FREE + +/* Define if malloc is not declared in system header files. */ +#undef NEED_DECLARATION_MALLOC + +/* Define if sbrk is not declared in system header files. */ +#undef NEED_DECLARATION_SBRK + +/* Define if strstr is not declared in system header files. */ +#undef NEED_DECLARATION_STRSTR + /* a.out support? */ #undef OBJ_MAYBE_AOUT @@ -202,81 +217,102 @@ /* generic support? */ #undef OBJ_MAYBE_GENERIC -/* HP300 support? */ -#undef OBJ_MAYBE_HP300 - /* IEEE support? */ #undef OBJ_MAYBE_IEEE /* SOM support? */ #undef OBJ_MAYBE_SOM -/* VMS support? */ -#undef OBJ_MAYBE_VMS +/* Name of package */ +#undef PACKAGE -/* Use emulation support? */ -#undef USE_EMULATIONS +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT -/* Supported emulations. */ -#undef EMULATIONS +/* Define to the full name of this package. */ +#undef PACKAGE_NAME -/* Default emulation. */ -#undef DEFAULT_EMULATION +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING -/* old COFF support? */ -#undef MANY_SEGMENTS +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME -/* Use BFD interface? */ -#undef BFD_ASSEMBLER +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define if defaulting to ELF on SCO 5. */ +#undef SCO_ELF + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at run-time. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +#undef STACK_DIRECTION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Using strict COFF? */ +#undef STRICTCOFF /* Target alias. */ #undef TARGET_ALIAS +/* Define as 1 if big endian. */ +#undef TARGET_BYTES_BIG_ENDIAN + /* Canonical target. */ #undef TARGET_CANONICAL /* Target CPU. */ #undef TARGET_CPU -/* Target vendor. */ -#undef TARGET_VENDOR - /* Target OS. */ #undef TARGET_OS -/* Define if you have the stpcpy function */ -#undef HAVE_STPCPY +/* Define if default target is PowerPC Solaris. */ +#undef TARGET_SOLARIS_COMMENT -/* Define if your locale.h file contains LC_MESSAGES. */ -#undef HAVE_LC_MESSAGES +/* Define if target is Symbian OS. */ +#undef TARGET_SYMBIAN -/* Define to 1 if NLS is requested */ -#undef ENABLE_NLS +/* Target vendor. */ +#undef TARGET_VENDOR -/* Define as 1 if you have gettext and don't want to use GNU gettext. */ -#undef HAVE_GETTEXT +/* Use emulation support? */ +#undef USE_EMULATIONS -/* Compiling cross-assembler? */ -#undef CROSS_COMPILE +/* Allow use of E_MIPS_ABI_O32 on MIPS targets. */ +#undef USE_E_MIPS_ABI_O32 -/* assert broken? */ -#undef BROKEN_ASSERT +/* Using cgen code? */ +#undef USING_CGEN -/* Define if strstr is not declared in system header files. */ -#undef NEED_DECLARATION_STRSTR +/* Version number of package */ +#undef VERSION -/* Define if malloc is not declared in system header files. */ -#undef NEED_DECLARATION_MALLOC +/* Define to 1 if your processor stores words with the most significant byte + first (like Motorola and SPARC, unlike Intel and VAX). */ +#undef WORDS_BIGENDIAN -/* Define if free is not declared in system header files. */ -#undef NEED_DECLARATION_FREE +/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a + `char[]'. */ +#undef YYTEXT_POINTER -/* Define if sbrk is not declared in system header files. */ -#undef NEED_DECLARATION_SBRK +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const -/* Define if environ is not declared in system header files. */ -#undef NEED_DECLARATION_ENVIRON +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#undef inline +#endif -/* Define if errno is not declared in system header files. */ -#undef NEED_DECLARATION_ERRNO +/* Define to `long' if does not define. */ +#undef off_t +/* Define to `unsigned' if does not define. */ +#undef size_t diff --git a/contrib/binutils/gas/config/aout_gnu.h b/contrib/binutils/gas/config/aout_gnu.h index 0942fd34a9b..e17fda9465b 100644 --- a/contrib/binutils/gas/config/aout_gnu.h +++ b/contrib/binutils/gas/config/aout_gnu.h @@ -1,6 +1,6 @@ /* This file is aout_gnu.h - Copyright 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 2000 + Copyright 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 2000, 2002 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -17,7 +17,7 @@ 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. */ + the Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef __A_OUT_GNU_H__ #define __A_OUT_GNU_H__ @@ -26,15 +26,15 @@ relocations, and one which uses extended relocations. Today, the extended reloc uses are - TC_SPARC, TC_A29K + TC_SPARC each must define the enum reloc_type */ -#define USE_EXTENDED_RELOC (defined(TC_SPARC) || defined(TC_A29K)) +#define USE_EXTENDED_RELOC defined(TC_SPARC) -#if defined(TC_SPARC) || defined(TC_A29K) +#if defined(TC_SPARC) enum reloc_type { RELOC_8, RELOC_16, RELOC_32,/* simple relocations */ @@ -62,7 +62,7 @@ enum reloc_type NO_RELOC }; -#endif /* TC_SPARC or TC_A29K */ +#endif /* TC_SPARC */ #define __GNU_EXEC_MACROS__ diff --git a/contrib/binutils/gas/config/atof-ieee.c b/contrib/binutils/gas/config/atof-ieee.c index 0ad39c9b301..bf842e1717d 100644 --- a/contrib/binutils/gas/config/atof-ieee.c +++ b/contrib/binutils/gas/config/atof-ieee.c @@ -1,5 +1,5 @@ /* atof_ieee.c - turn a Flonum into an IEEE floating point number - Copyright 1987, 1992, 1994, 1996, 1997, 1998, 1999, 2000, 2001 + Copyright 1987, 1992, 1994, 1996, 1997, 1998, 1999, 2000, 2001, 2005 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -16,29 +16,25 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #include "as.h" /* Flonums returned here. */ extern FLONUM_TYPE generic_floating_point_number; -static int next_bits PARAMS ((int)); -static void unget_bits PARAMS ((int)); -static void make_invalid_floating_point_number PARAMS ((LITTLENUM_TYPE *)); - extern const char EXP_CHARS[]; /* Precision in LittleNums. */ /* Don't count the gap in the m68k extended precision format. */ -#define MAX_PRECISION (5) -#define F_PRECISION (2) -#define D_PRECISION (4) -#define X_PRECISION (5) -#define P_PRECISION (5) +#define MAX_PRECISION 5 +#define F_PRECISION 2 +#define D_PRECISION 4 +#define X_PRECISION 5 +#define P_PRECISION 5 /* Length in LittleNums of guard bits. */ -#define GUARD (2) +#define GUARD 2 #ifndef TC_LARGEST_EXPONENT_IS_NORMAL #define TC_LARGEST_EXPONENT_IS_NORMAL(PRECISION) 0 @@ -86,13 +82,13 @@ static int littlenums_left; static LITTLENUM_TYPE *littlenum_pointer; static int -next_bits (number_of_bits) - int number_of_bits; +next_bits (int number_of_bits) { int return_value; if (!littlenums_left) - return (0); + return 0; + if (number_of_bits >= bits_left_in_littlenum) { return_value = mask[bits_left_in_littlenum] & *littlenum_pointer; @@ -120,8 +116,7 @@ next_bits (number_of_bits) /* Num had better be less than LITTLENUM_NUMBER_OF_BITS. */ static void -unget_bits (num) - int num; +unget_bits (int num) { if (!littlenums_left) { @@ -141,8 +136,7 @@ unget_bits (num) } static void -make_invalid_floating_point_number (words) - LITTLENUM_TYPE *words; +make_invalid_floating_point_number (LITTLENUM_TYPE *words) { as_bad (_("cannot create floating-point number")); /* Zero the leftmost bit. */ @@ -165,10 +159,9 @@ make_invalid_floating_point_number (words) /* Returns pointer past text consumed. */ char * -atof_ieee (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. */ +atof_ieee (char *str, /* Text to convert to binary. */ + int what_kind, /* 'd', 'f', 'g', 'h'. */ + LITTLENUM_TYPE *words) /* Build the binary here. */ { /* Extra bits for zeroed low-order bits. The 1st MAX_PRECISION are zeroed, the last contain flonum bits. */ @@ -242,7 +235,7 @@ atof_ieee (str, what_kind, words) &generic_floating_point_number)) { make_invalid_floating_point_number (words); - return (NULL); + return NULL; } gen_to_words (words, precision, exponent_bits); @@ -256,10 +249,7 @@ atof_ieee (str, what_kind, words) /* Turn generic_floating_point_number into a real float/double/extended. */ int -gen_to_words (words, precision, exponent_bits) - LITTLENUM_TYPE *words; - int precision; - long exponent_bits; +gen_to_words (LITTLENUM_TYPE *words, int precision, long exponent_bits) { int return_value = 0; @@ -673,35 +663,11 @@ gen_to_words (words, precision, exponent_bits) but return a floating exception because we can't encode the number. */ *words &= ~(1 << (LITTLENUM_NUMBER_OF_BITS - 1)); -#if 0 - make_invalid_floating_point_number (words); - return return_value; -#endif } } return return_value; } -#if 0 -/* Unused. */ -/* This routine is a real kludge. Someone really should do it better, - but I'm too lazy, and I don't understand this stuff all too well - anyway. (JF) */ - -static void -int_to_gen (x) - long x; -{ - char buf[20]; - char *bufp; - - sprintf (buf, "%ld", x); - bufp = &buf[0]; - if (atof_generic (&bufp, ".", EXP_CHARS, &generic_floating_point_number)) - as_bad (_("Error converting number to floating point (Exponent overflow?)")); -} -#endif - #ifdef TEST char * print_gen (gen) diff --git a/contrib/binutils/gas/config/atof-vax.c b/contrib/binutils/gas/config/atof-vax.c index 7c9f04e7fd1..75756904fb8 100644 --- a/contrib/binutils/gas/config/atof-vax.c +++ b/contrib/binutils/gas/config/atof-vax.c @@ -1,5 +1,5 @@ /* atof_vax.c - turn a Flonum into a VAX floating point number - Copyright 1987, 1992, 1993, 1995, 1997, 1999, 2000 + Copyright 1987, 1992, 1993, 1995, 1997, 1999, 2000, 2005 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -16,42 +16,33 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, 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) +#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) +#define GUARD 2 -int flonum_gen2vax PARAMS ((int format_letter, FLONUM_TYPE * f, - LITTLENUM_TYPE * words)); +int flonum_gen2vax (int, FLONUM_TYPE *, LITTLENUM_TYPE *); /* Number of chars in flonum type 'letter'. */ + static int -atof_vax_sizeof (letter) - int letter; +atof_vax_sizeof (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! - */ + /* 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': @@ -75,8 +66,9 @@ atof_vax_sizeof (letter) return_value = 0; break; } - return (return_value); -} /* atof_vax_sizeof */ + + return return_value; +} static const long mask[] = { @@ -116,14 +108,13 @@ static const long mask[] = }; -/* Shared between flonum_gen2vax and next_bits */ +/* 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; +next_bits (int number_of_bits) { int return_value; @@ -144,23 +135,22 @@ next_bits (number_of_bits) bits_left_in_littlenum -= number_of_bits; return_value = mask[number_of_bits] & ((*littlenum_pointer) >> bits_left_in_littlenum); } - return (return_value); + return return_value; } static void -make_invalid_floating_point_number (words) - LITTLENUM_TYPE *words; +make_invalid_floating_point_number (LITTLENUM_TYPE *words) { - *words = 0x8000; /* Floating Reserved Operand Code */ + *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. */ +what_kind_of_float (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. */ + int retval; retval = 0; switch (letter) @@ -189,29 +179,24 @@ what_kind_of_float (letter, precisionP, exponent_bitsP) retval = 69; break; } - return (retval); + 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! * - * * - \***********************************************************************/ +/* 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. */ +static char * +atof_vax (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. */ + /* 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; @@ -225,7 +210,7 @@ atof_vax (str, what_kind, words) if (what_kind_of_float (what_kind, &precision, &exponent_bits)) { - return_value = NULL; /* We lost. */ + return_value = NULL; make_invalid_floating_point_number (words); } @@ -233,37 +218,30 @@ atof_vax (str, what_kind, words) { 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. */ + /* 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_value = NULL; } + 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. */ + return return_value; +} + +/* In: a flonum, a vax floating point format. + Out: a vax floating-point bit pattern. */ + +int +flonum_gen2vax (int format_letter, /* One of 'd' 'f' 'g' 'h'. */ + FLONUM_TYPE *f, + LITTLENUM_TYPE *words) /* Deliver answer here. */ { LITTLENUM_TYPE *lp; int precision; @@ -273,16 +251,14 @@ flonum_gen2vax (format_letter, f, words) return_value = what_kind_of_float (format_letter, &precision, &exponent_bits); if (return_value != 0) - { - make_invalid_floating_point_number (words); - } + make_invalid_floating_point_number (words); + else { if (f->low > f->leader) - { - /* 0.0e0 seen. */ - memset (words, '\0', sizeof (LITTLENUM_TYPE) * precision); - } + /* 0.0e0 seen. */ + memset (words, '\0', sizeof (LITTLENUM_TYPE) * precision); + else { long exponent_1; @@ -292,49 +268,31 @@ flonum_gen2vax (format_letter, f, words) int exponent_skippage; LITTLENUM_TYPE word1; - /* JF: Deal with new Nan, +Inf and -Inf codes */ + /* 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 + /* 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. */ bits_left_in_littlenum = LITTLENUM_NUMBER_OF_BITS; littlenum_pointer = f->leader; littlenum_end = f->low; - /* Seek (and forget) 1st significant bit */ + /* Seek (and forget) 1st significant bit. */ for (exponent_skippage = 0; !next_bits (1); exponent_skippage++);; @@ -350,24 +308,19 @@ flonum_gen2vax (format_letter, f, words) if (exponent_4 & ~mask[exponent_bits]) { - /* - * Exponent overflow. Lose immediately. - */ - + /* 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. - */ + /* 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. */ + /* 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)); @@ -375,32 +328,26 @@ flonum_gen2vax (format_letter, f, words) /* The rest of the words are just mantissa bits. */ for (; lp < words + precision; lp++) - { - *lp = next_bits (LITTLENUM_NUMBER_OF_BITS); - } + *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? - */ - + /* 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 - */ + #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--) @@ -413,68 +360,61 @@ flonum_gen2vax (format_letter, f, words) 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. - */ + /* 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() */ + } + } + } + } + return return_value; +} -/* JF this used to be in vax.c but this looks like a better place for it */ +/* 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. - */ +/* 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. */ +#define MAXIMUM_NUMBER_OF_LITTLENUMS 8 /* For .hfloats. */ char * -md_atof (what_statement_type, literalP, sizeP) - int what_statement_type; - char *literalP; - int *sizeP; +md_atof (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; + char kind_of_float; + int number_of_chars; + LITTLENUM_TYPE *littlenumP; switch (what_statement_type) { - case 'F': /* .float */ - case 'f': /* .ffloat */ + case 'F': + case 'f': kind_of_float = 'f'; break; - case 'D': /* .double */ - case 'd': /* .dfloat */ + case 'D': + case 'd': kind_of_float = 'd'; break; - case 'g': /* .gfloat */ + case 'g': kind_of_float = 'g'; break; - case 'h': /* .hfloat */ + case 'h': kind_of_float = 'h'; break; @@ -485,17 +425,15 @@ md_atof (what_statement_type, literalP, sizeP) if (kind_of_float) { - register LITTLENUM_TYPE *limit; + 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. - */ + /* 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)); @@ -506,12 +444,8 @@ md_atof (what_statement_type, literalP, sizeP) }; } else - { - number_of_chars = 0; - }; + 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/itbl-mips.h b/contrib/binutils/gas/config/itbl-mips.h index 8ecb9ecc4ec..cfa072f298a 100644 --- a/contrib/binutils/gas/config/itbl-mips.h +++ b/contrib/binutils/gas/config/itbl-mips.h @@ -17,8 +17,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ /* Defines for Mips itbl cop support */ diff --git a/contrib/binutils/gas/config/obj-aout.c b/contrib/binutils/gas/config/obj-aout.c index 6e5fd29191a..e99e63d9574 100644 --- a/contrib/binutils/gas/config/obj-aout.c +++ b/contrib/binutils/gas/config/obj-aout.c @@ -1,110 +1,33 @@ /* a.out object file format Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000, - 2001, 2002 Free Software Foundation, Inc. + 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. -This file is part of GAS, the GNU Assembler. + 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 free software; you can redistribute 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. + 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. */ + 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, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #define OBJ_HEADER "obj-aout.h" #include "as.h" -#ifdef BFD_ASSEMBLER #undef NO_RELOC #include "aout/aout64.h" -#endif #include "obstack.h" -#ifndef BFD_ASSEMBLER -/* in: segT out: N_TYPE bits */ -const short seg_N_TYPE[] = -{ - N_ABS, - N_TEXT, - N_DATA, - N_BSS, - N_UNDF, /* unknown */ - N_UNDF, /* error */ - N_UNDF, /* expression */ - N_UNDF, /* debug */ - N_UNDF, /* ntv */ - N_UNDF, /* ptv */ - N_REGISTER, /* register */ -}; - -const segT N_TYPE_seg[N_TYPE + 2] = -{ /* N_TYPE == 0x1E = 32-2 */ - SEG_UNKNOWN, /* N_UNDF == 0 */ - SEG_GOOF, - SEG_ABSOLUTE, /* N_ABS == 2 */ - SEG_GOOF, - SEG_TEXT, /* N_TEXT == 4 */ - SEG_GOOF, - SEG_DATA, /* N_DATA == 6 */ - SEG_GOOF, - SEG_BSS, /* N_BSS == 8 */ - SEG_GOOF, - SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, - SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, - SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, - SEG_REGISTER, /* dummy N_REGISTER for regs = 30 */ - SEG_GOOF, -}; -#endif - -static void obj_aout_line PARAMS ((int)); -static void obj_aout_weak PARAMS ((int)); -static void obj_aout_type PARAMS ((int)); - -const pseudo_typeS aout_pseudo_table[] = -{ - {"line", obj_aout_line, 0}, /* source code line number */ - {"ln", obj_aout_line, 0}, /* coff line number that we use anyway */ - - {"weak", obj_aout_weak, 0}, /* mark symbol as weak. */ - - {"type", obj_aout_type, 0}, - - /* coff debug pseudos (ignored) */ - {"def", s_ignore, 0}, - {"dim", s_ignore, 0}, - {"endef", s_ignore, 0}, - {"ident", s_ignore, 0}, - {"line", s_ignore, 0}, - {"ln", s_ignore, 0}, - {"scl", s_ignore, 0}, - {"size", s_ignore, 0}, - {"tag", s_ignore, 0}, - {"val", s_ignore, 0}, - {"version", s_ignore, 0}, - - {"optim", s_ignore, 0}, /* For sun386i cc (?) */ - - /* other stuff */ - {"ABORT", s_abort, 0}, - - {NULL, NULL, 0} /* end sentinel */ -}; /* aout_pseudo_table */ - -#ifdef BFD_ASSEMBLER - void -obj_aout_frob_symbol (sym, punt) - symbolS *sym; - int *punt ATTRIBUTE_UNUSED; +obj_aout_frob_symbol (symbolS *sym, int *punt ATTRIBUTE_UNUSED) { flagword flags; asection *sec; @@ -184,23 +107,18 @@ obj_aout_frob_symbol (sym, punt) } } else - { - symbol_get_bfdsym (sym)->flags |= BSF_DEBUGGING; - } + symbol_get_bfdsym (sym)->flags |= BSF_DEBUGGING; aout_symbol (symbol_get_bfdsym (sym))->type = type; /* Double check weak symbols. */ - if (S_IS_WEAK (sym)) - { - if (S_IS_COMMON (sym)) - as_bad (_("Symbol `%s' can not be both weak and common"), - S_GET_NAME (sym)); - } + if (S_IS_WEAK (sym) && S_IS_COMMON (sym)) + as_bad (_("Symbol `%s' can not be both weak and common"), + S_GET_NAME (sym)); } void -obj_aout_frob_file_before_fix () +obj_aout_frob_file_before_fix (void) { /* Relocation processing may require knowing the VMAs of the sections. Since writing to a section will cause the BFD back end to compute the @@ -208,166 +126,29 @@ obj_aout_frob_file_before_fix () bfd_byte b = 0; bfd_boolean x = TRUE; if (bfd_section_size (stdoutput, text_section) != 0) - { - x = bfd_set_section_contents (stdoutput, text_section, &b, (file_ptr) 0, - (bfd_size_type) 1); - } + x = bfd_set_section_contents (stdoutput, text_section, &b, (file_ptr) 0, + (bfd_size_type) 1); else if (bfd_section_size (stdoutput, data_section) != 0) - { - x = bfd_set_section_contents (stdoutput, data_section, &b, (file_ptr) 0, - (bfd_size_type) 1); - } + x = bfd_set_section_contents (stdoutput, data_section, &b, (file_ptr) 0, + (bfd_size_type) 1); + assert (x); } -#else /* ! BFD_ASSEMBLER */ - -/* Relocation. */ - -/* - * emit_relocations() - * - * Crawl along a fixS chain. Emit the segment's relocations. - */ -void -obj_emit_relocations (where, fixP, segment_address_in_file) - char **where; - fixS *fixP; /* Fixup chain for this segment. */ - relax_addressT segment_address_in_file; -{ - for (; fixP; fixP = fixP->fx_next) - if (fixP->fx_done == 0) - { - symbolS *sym; - - sym = fixP->fx_addsy; - while (sym->sy_value.X_op == O_symbol - && (! S_IS_DEFINED (sym) || S_IS_COMMON (sym))) - sym = sym->sy_value.X_add_symbol; - fixP->fx_addsy = sym; - - if (! sym->sy_resolved && ! S_IS_DEFINED (sym)) - { - char *file; - unsigned int line; - - if (expr_symbol_where (sym, &file, &line)) - as_bad_where (file, line, _("unresolved relocation")); - else - as_bad (_("bad relocation: symbol `%s' not in symbol table"), - S_GET_NAME (sym)); - } - - tc_aout_fix_to_chars (*where, fixP, segment_address_in_file); - *where += md_reloc_size; - } -} - -#ifndef obj_header_append -/* Aout file generation & utilities */ -void -obj_header_append (where, headers) - char **where; - object_headers *headers; -{ - tc_headers_hook (headers); - -#ifdef CROSS_COMPILE - md_number_to_chars (*where, headers->header.a_info, sizeof (headers->header.a_info)); - *where += sizeof (headers->header.a_info); - md_number_to_chars (*where, headers->header.a_text, sizeof (headers->header.a_text)); - *where += sizeof (headers->header.a_text); - md_number_to_chars (*where, headers->header.a_data, sizeof (headers->header.a_data)); - *where += sizeof (headers->header.a_data); - md_number_to_chars (*where, headers->header.a_bss, sizeof (headers->header.a_bss)); - *where += sizeof (headers->header.a_bss); - md_number_to_chars (*where, headers->header.a_syms, sizeof (headers->header.a_syms)); - *where += sizeof (headers->header.a_syms); - md_number_to_chars (*where, headers->header.a_entry, sizeof (headers->header.a_entry)); - *where += sizeof (headers->header.a_entry); - md_number_to_chars (*where, headers->header.a_trsize, sizeof (headers->header.a_trsize)); - *where += sizeof (headers->header.a_trsize); - md_number_to_chars (*where, headers->header.a_drsize, sizeof (headers->header.a_drsize)); - *where += sizeof (headers->header.a_drsize); - -#else /* CROSS_COMPILE */ - - append (where, (char *) &headers->header, sizeof (headers->header)); -#endif /* CROSS_COMPILE */ - -} -#endif /* ! defined (obj_header_append) */ - -void -obj_symbol_to_chars (where, symbolP) - char **where; - symbolS *symbolP; -{ - md_number_to_chars ((char *) &(S_GET_OFFSET (symbolP)), S_GET_OFFSET (symbolP), sizeof (S_GET_OFFSET (symbolP))); - md_number_to_chars ((char *) &(S_GET_DESC (symbolP)), S_GET_DESC (symbolP), sizeof (S_GET_DESC (symbolP))); - md_number_to_chars ((char *) &(symbolP->sy_symbol.n_value), S_GET_VALUE (symbolP), sizeof (symbolP->sy_symbol.n_value)); - - append (where, (char *) &symbolP->sy_symbol, sizeof (obj_symbol_type)); -} - -void -obj_emit_symbols (where, symbol_rootP) - char **where; - symbolS *symbol_rootP; -{ - symbolS *symbolP; - - /* Emit all symbols left in the symbol chain. */ - for (symbolP = symbol_rootP; symbolP; symbolP = symbol_next (symbolP)) - { - /* Used to save the offset of the name. It is used to point - to the string in memory but must be a file offset. */ - register char *temp; - - temp = S_GET_NAME (symbolP); - S_SET_OFFSET (symbolP, symbolP->sy_name_offset); - - /* Any symbol still undefined and is not a dbg symbol is made N_EXT. */ - if (!S_IS_DEBUG (symbolP) && !S_IS_DEFINED (symbolP)) - S_SET_EXTERNAL (symbolP); - - /* Adjust the type of a weak symbol. */ - if (S_GET_WEAK (symbolP)) - { - switch (S_GET_TYPE (symbolP)) - { - case N_UNDF: S_SET_TYPE (symbolP, N_WEAKU); break; - case N_ABS: S_SET_TYPE (symbolP, N_WEAKA); break; - case N_TEXT: S_SET_TYPE (symbolP, N_WEAKT); break; - case N_DATA: S_SET_TYPE (symbolP, N_WEAKD); break; - case N_BSS: S_SET_TYPE (symbolP, N_WEAKB); break; - default: as_bad (_("%s: bad type for weak symbol"), temp); break; - } - } - - obj_symbol_to_chars (where, symbolP); - S_SET_NAME (symbolP, temp); - } -} - -#endif /* ! BFD_ASSEMBLER */ - static void -obj_aout_line (ignore) - int ignore ATTRIBUTE_UNUSED; +obj_aout_line (int ignore ATTRIBUTE_UNUSED) { /* Assume delimiter is part of expression. BSD4.2 as fails with delightful bug, so we are not being incompatible here. */ new_logical_line ((char *) NULL, (int) (get_absolute_expression ())); demand_empty_rest_of_line (); -} /* obj_aout_line() */ +} /* Handle .weak. This is a GNU extension. */ static void -obj_aout_weak (ignore) - int ignore ATTRIBUTE_UNUSED; +obj_aout_weak (int ignore ATTRIBUTE_UNUSED) { char *name; int c; @@ -399,8 +180,7 @@ obj_aout_weak (ignore) we can't parse it. */ static void -obj_aout_type (ignore) - int ignore ATTRIBUTE_UNUSED; +obj_aout_type (int ignore ATTRIBUTE_UNUSED) { char *name; int c; @@ -419,17 +199,9 @@ obj_aout_type (ignore) { ++input_line_pointer; if (strncmp (input_line_pointer, "object", 6) == 0) -#ifdef BFD_ASSEMBLER - aout_symbol (symbol_get_bfdsym (sym))->other = 1; -#else - S_SET_OTHER (sym, 1); -#endif + S_SET_OTHER (sym, 1); else if (strncmp (input_line_pointer, "function", 8) == 0) -#ifdef BFD_ASSEMBLER - aout_symbol (symbol_get_bfdsym (sym))->other = 2; -#else - S_SET_OTHER (sym, 2); -#endif + S_SET_OTHER (sym, 2); } } @@ -437,271 +209,136 @@ obj_aout_type (ignore) s_ignore (0); } -#ifndef BFD_ASSEMBLER - -void -obj_crawl_symbol_chain (headers) - object_headers *headers; -{ - symbolS *symbolP; - symbolS **symbolPP; - int symbol_number = 0; - - tc_crawl_symbol_chain (headers); - - symbolPP = &symbol_rootP; /*->last symbol chain link. */ - while ((symbolP = *symbolPP) != NULL) - { - if (symbolP->sy_mri_common) - { - if (S_IS_EXTERNAL (symbolP)) - as_bad (_("%s: global symbols not supported in common sections"), - S_GET_NAME (symbolP)); - *symbolPP = symbol_next (symbolP); - continue; - } - - if (flag_readonly_data_in_text && (S_GET_SEGMENT (symbolP) == SEG_DATA)) - { - S_SET_SEGMENT (symbolP, SEG_TEXT); - } /* if pushing data into text */ - - resolve_symbol_value (symbolP); - - /* Skip symbols which were equated to undefined or common - symbols. Also skip defined uncommon symbols which can - be resolved since in this case they should have been - resolved to a non-symbolic constant. */ - if (symbolP->sy_value.X_op == O_symbol - && (! S_IS_DEFINED (symbolP) - || S_IS_COMMON (symbolP) - || symbol_resolved_p (symbolP))) - { - *symbolPP = symbol_next (symbolP); - continue; - } - - /* OK, here is how we decide which symbols go out into the brave - new symtab. Symbols that do are: - - * symbols with no name (stabd's?) - * symbols with debug info in their N_TYPE - - Symbols that don't are: - * symbols that are registers - * symbols with \1 as their 3rd character (numeric labels) - * "local labels" as defined by S_LOCAL_NAME(name) if the -L - switch was passed to gas. - - All other symbols are output. We complain if a deleted - symbol was marked external. */ - - if (!S_IS_REGISTER (symbolP) - && (!S_GET_NAME (symbolP) - || S_IS_DEBUG (symbolP) - || !S_IS_DEFINED (symbolP) - || S_IS_EXTERNAL (symbolP) - || (S_GET_NAME (symbolP)[0] != '\001' - && (flag_keep_locals || !S_LOCAL_NAME (symbolP))))) - { - symbolP->sy_number = symbol_number++; - - /* The + 1 after strlen account for the \0 at the - end of each string */ - if (!S_IS_STABD (symbolP)) - { - /* Ordinary case. */ - symbolP->sy_name_offset = string_byte_count; - string_byte_count += strlen (S_GET_NAME (symbolP)) + 1; - } - else /* .Stabd case. */ - symbolP->sy_name_offset = 0; - symbolPP = &symbolP->sy_next; - } - else - { - if (S_IS_EXTERNAL (symbolP) || !S_IS_DEFINED (symbolP)) - /* This warning should never get triggered any more. - Well, maybe if you're doing twisted things with - register names... */ - { - as_bad (_("Local symbol %s never defined."), decode_local_label_name (S_GET_NAME (symbolP))); - } /* oops. */ - - /* Unhook it from the chain */ - *symbolPP = symbol_next (symbolP); - } /* if this symbol should be in the output */ - } /* for each symbol */ - - H_SET_SYMBOL_TABLE_SIZE (headers, symbol_number); -} - -/* - * Find strings by crawling along symbol table chain. - */ - -void -obj_emit_strings (where) - char **where; -{ - symbolS *symbolP; - -#ifdef CROSS_COMPILE - /* Gotta do md_ byte-ordering stuff for string_byte_count first - KWK */ - md_number_to_chars (*where, string_byte_count, sizeof (string_byte_count)); - *where += sizeof (string_byte_count); -#else /* CROSS_COMPILE */ - append (where, (char *) &string_byte_count, (unsigned long) sizeof (string_byte_count)); -#endif /* CROSS_COMPILE */ - - for (symbolP = symbol_rootP; symbolP; symbolP = symbol_next (symbolP)) - { - if (S_GET_NAME (symbolP)) - append (&next_object_file_charP, S_GET_NAME (symbolP), - (unsigned long) (strlen (S_GET_NAME (symbolP)) + 1)); - } /* walk symbol chain */ -} - -#ifndef AOUT_VERSION -#define AOUT_VERSION 0 -#endif - -void -obj_pre_write_hook (headers) - object_headers *headers; -{ - H_SET_DYNAMIC (headers, 0); - H_SET_VERSION (headers, AOUT_VERSION); - H_SET_MACHTYPE (headers, AOUT_MACHTYPE); - tc_aout_pre_write_hook (headers); -} - -#endif /* ! BFD_ASSEMBLER */ - -#ifdef BFD_ASSEMBLER - /* Support for an AOUT emulation. */ -static void aout_pop_insert PARAMS ((void)); -static int obj_aout_s_get_other PARAMS ((symbolS *)); -static void obj_aout_s_set_other PARAMS ((symbolS *, int)); -static int obj_aout_s_get_desc PARAMS ((symbolS *)); -static void obj_aout_s_set_desc PARAMS ((symbolS *, int)); -static int obj_aout_s_get_type PARAMS ((symbolS *)); -static void obj_aout_s_set_type PARAMS ((symbolS *, int)); -static int obj_aout_separate_stab_sections PARAMS ((void)); -static int obj_aout_sec_sym_ok_for_reloc PARAMS ((asection *)); -static void obj_aout_process_stab PARAMS ((segT, int, const char *, int, int, int)); - static void -aout_pop_insert () +aout_pop_insert (void) { pop_insert (aout_pseudo_table); } static int -obj_aout_s_get_other (sym) - symbolS *sym; +obj_aout_s_get_other (symbolS *sym) { return aout_symbol (symbol_get_bfdsym (sym))->other; } static void -obj_aout_s_set_other (sym, o) - symbolS *sym; - int o; +obj_aout_s_set_other (symbolS *sym, int o) { aout_symbol (symbol_get_bfdsym (sym))->other = o; } static int -obj_aout_sec_sym_ok_for_reloc (sec) - asection *sec ATTRIBUTE_UNUSED; +obj_aout_sec_sym_ok_for_reloc (asection *sec ATTRIBUTE_UNUSED) { return obj_sec_sym_ok_for_reloc (sec); } static void -obj_aout_process_stab (seg, w, s, t, o, d) - segT seg ATTRIBUTE_UNUSED; - int w; - const char *s; - int t; - int o; - int d; +obj_aout_process_stab (segT seg ATTRIBUTE_UNUSED, + int w, + const char *s, + int t, + int o, + int d) { aout_process_stab (w, s, t, o, d); } static int -obj_aout_s_get_desc (sym) - symbolS *sym; +obj_aout_s_get_desc (symbolS *sym) { return aout_symbol (symbol_get_bfdsym (sym))->desc; } static void -obj_aout_s_set_desc (sym, d) - symbolS *sym; - int d; +obj_aout_s_set_desc (symbolS *sym, int d) { aout_symbol (symbol_get_bfdsym (sym))->desc = d; } static int -obj_aout_s_get_type (sym) - symbolS *sym; +obj_aout_s_get_type (symbolS *sym) { return aout_symbol (symbol_get_bfdsym (sym))->type; } static void -obj_aout_s_set_type (sym, t) - symbolS *sym; - int t; +obj_aout_s_set_type (symbolS *sym, int t) { aout_symbol (symbol_get_bfdsym (sym))->type = t; } static int -obj_aout_separate_stab_sections () +obj_aout_separate_stab_sections (void) { return 0; } /* When changed, make sure these table entries match the single-format definitions in obj-aout.h. */ + const struct format_ops aout_format_ops = { bfd_target_aout_flavour, - 1, /* dfl_leading_underscore */ - 0, /* emit_section_symbols */ - 0, /* begin */ - 0, /* app_file */ + 1, /* dfl_leading_underscore. */ + 0, /* emit_section_symbols. */ + 0, /* begin. */ + 0, /* app_file. */ obj_aout_frob_symbol, - 0, /* frob_file */ - 0, /* frob_file_before_adjust */ + 0, /* frob_file. */ + 0, /* frob_file_before_adjust. */ obj_aout_frob_file_before_fix, - 0, /* frob_file_after_relocs */ - 0, /* s_get_size */ - 0, /* s_set_size */ - 0, /* s_get_align */ - 0, /* s_set_align */ + 0, /* frob_file_after_relocs. */ + 0, /* s_get_size. */ + 0, /* s_set_size. */ + 0, /* s_get_align. */ + 0, /* s_set_align. */ obj_aout_s_get_other, obj_aout_s_set_other, obj_aout_s_get_desc, obj_aout_s_set_desc, obj_aout_s_get_type, obj_aout_s_set_type, - 0, /* copy_symbol_attributes */ - 0, /* generate_asm_lineno */ + 0, /* copy_symbol_attributes. */ + 0, /* generate_asm_lineno. */ obj_aout_process_stab, obj_aout_separate_stab_sections, - 0, /* init_stab_section */ + 0, /* init_stab_section. */ obj_aout_sec_sym_ok_for_reloc, aout_pop_insert, - 0, /* ecoff_set_ext */ - 0, /* read_begin_hook */ - 0 /* symbol_new_hook */ + 0, /* ecoff_set_ext. */ + 0, /* read_begin_hook. */ + 0 /* symbol_new_hook. */ +}; + +const pseudo_typeS aout_pseudo_table[] = +{ + {"line", obj_aout_line, 0}, /* Source code line number. */ + {"ln", obj_aout_line, 0}, /* COFF line number that we use anyway. */ + + {"weak", obj_aout_weak, 0}, /* Mark symbol as weak. */ + + {"type", obj_aout_type, 0}, + + /* coff debug pseudos (ignored) */ + {"def", s_ignore, 0}, + {"dim", s_ignore, 0}, + {"endef", s_ignore, 0}, + {"ident", s_ignore, 0}, + {"line", s_ignore, 0}, + {"ln", s_ignore, 0}, + {"scl", s_ignore, 0}, + {"size", s_ignore, 0}, + {"tag", s_ignore, 0}, + {"val", s_ignore, 0}, + {"version", s_ignore, 0}, + + {"optim", s_ignore, 0}, /* For sun386i cc (?). */ + + /* other stuff */ + {"ABORT", s_abort, 0}, + + {NULL, NULL, 0} }; -#endif /* BFD_ASSEMBLER */ diff --git a/contrib/binutils/gas/config/obj-aout.h b/contrib/binutils/gas/config/obj-aout.h index 23a2907acc5..4acc4201eb9 100644 --- a/contrib/binutils/gas/config/obj-aout.h +++ b/contrib/binutils/gas/config/obj-aout.h @@ -1,6 +1,6 @@ /* obj-aout.h, a.out object file format for gas, the assembler. Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 2000, - 2002, 2003 Free Software Foundation, Inc. + 2002, 2003, 2005 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -16,56 +16,30 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ /* Tag to validate a.out object file format processing */ #define OBJ_AOUT 1 #include "targ-cpu.h" -#ifdef BFD_ASSEMBLER - #include "bfd/libaout.h" #define OUTPUT_FLAVOR bfd_target_aout_flavour -#else /* ! BFD_ASSEMBLER */ - -#ifndef VMS -#include "aout_gnu.h" /* Needed to define struct nlist. Sigh. */ -#else -#include "a_out.h" -#endif - -#ifndef AOUT_MACHTYPE -#define AOUT_MACHTYPE 0 -#endif /* AOUT_MACHTYPE */ - -extern const short seg_N_TYPE[]; -extern const segT N_TYPE_seg[]; - -#ifndef DEFAULT_MAGIC_NUMBER_FOR_OBJECT_FILE -#define DEFAULT_MAGIC_NUMBER_FOR_OBJECT_FILE (OMAGIC) -#endif /* DEFAULT_MAGIC_NUMBER_FOR_OBJECT_FILE */ - -#endif /* ! BFD_ASSEMBLER */ - extern const pseudo_typeS aout_pseudo_table[]; #ifndef obj_pop_insert #define obj_pop_insert() pop_insert (aout_pseudo_table) #endif -/* SYMBOL TABLE */ -/* Symbol table entry data type */ +/* Symbol table entry data type. */ -typedef struct nlist obj_symbol_type; /* Symbol table entry */ +typedef struct nlist obj_symbol_type; /* Symbol table entry. */ /* Symbol table macros and constants */ -#ifdef BFD_ASSEMBLER - #define S_SET_OTHER(S,V) \ (aout_symbol (symbol_get_bfdsym (S))->other = (V)) #define S_SET_TYPE(S,T) \ @@ -83,170 +57,11 @@ asection *text_section, *data_section, *bss_section; #define obj_frob_symbol(S,PUNT) obj_aout_frob_symbol (S, &PUNT) #define obj_frob_file_before_fix() obj_aout_frob_file_before_fix () -extern void obj_aout_frob_symbol PARAMS ((symbolS *, int *)); -extern void obj_aout_frob_file_before_fix PARAMS ((void)); -#define obj_sec_sym_ok_for_reloc(SEC) (1) +extern void obj_aout_frob_symbol (symbolS *, int *); +extern void obj_aout_frob_file_before_fix (void); -#else - -/* We use the sy_obj field to record whether a symbol is weak. */ -#define OBJ_SYMFIELD_TYPE char - -/* - * Macros to extract information from a symbol table entry. - * This syntactic indirection allows independence regarding a.out or coff. - * The argument (s) of all these macros is a pointer to a symbol table entry. - */ - -/* True if the symbol is external */ -#define S_IS_EXTERNAL(s) ((s)->sy_symbol.n_type & N_EXT) - -/* True if symbol has been defined, ie is in N_{TEXT,DATA,BSS,ABS} or N_EXT */ -#define S_IS_DEFINED(s) \ - (S_GET_TYPE (s) != N_UNDF || S_GET_DESC (s) != 0) - -#define S_IS_COMMON(s) \ - (S_GET_TYPE (s) == N_UNDF && S_GET_VALUE (s) != 0) - -/* Return true for symbols that should not be reduced to section - symbols or eliminated from expressions, because they may be - overridden by the linker. */ -#define S_FORCE_RELOC(s, strict) \ - (!SEG_NORMAL (S_GET_SEGMENT (s))) - -#define S_IS_REGISTER(s) ((s)->sy_symbol.n_type == N_REGISTER) - -/* True if a debug special symbol entry */ -#define S_IS_DEBUG(s) ((s)->sy_symbol.n_type & N_STAB) -/* True if a symbol is local symbol name */ -#define S_IS_LOCAL(s) \ - ((S_GET_NAME (s) \ - && !S_IS_DEBUG (s) \ - && (strchr (S_GET_NAME (s), '\001') != NULL \ - || strchr (S_GET_NAME (s), '\002') != NULL \ - || (S_LOCAL_NAME(s) && !flag_keep_locals))) \ - || (flag_strip_local_absolute \ - && ! S_IS_EXTERNAL(s) \ - && S_GET_SEGMENT (s) == absolute_section)) -/* True if a symbol is not defined in this file */ -#define S_IS_EXTERN(s) ((s)->sy_symbol.n_type & N_EXT) -/* True if the symbol has been generated because of a .stabd directive */ -#define S_IS_STABD(s) (S_GET_NAME(s) == (char *)0) - -/* Accessors */ -/* The name of the symbol */ -#define S_GET_NAME(s) ((s)->sy_symbol.n_un.n_name) -/* The pointer to the string table */ -#define S_GET_OFFSET(s) ((s)->sy_symbol.n_un.n_strx) -/* The type of the symbol */ -#define S_GET_TYPE(s) ((s)->sy_symbol.n_type & N_TYPE) -/* The numeric value of the segment */ -#define S_GET_SEGMENT(s) (N_TYPE_seg[S_GET_TYPE(s)]) -/* The n_other expression value */ -#define S_GET_OTHER(s) ((s)->sy_symbol.n_other) -/* The n_desc expression value */ -#define S_GET_DESC(s) ((s)->sy_symbol.n_desc) -/* Whether the symbol is weak. */ -#define S_GET_WEAK(s) ((s)->sy_obj) - -/* Modifiers */ -/* Assume that a symbol cannot be simultaneously in more than on segment */ -/* set segment */ -#define S_SET_SEGMENT(s,seg) ((s)->sy_symbol.n_type &= ~N_TYPE,(s)->sy_symbol.n_type|=SEGMENT_TO_SYMBOL_TYPE(seg)) -/* The symbol is external */ -#define S_SET_EXTERNAL(s) ((s)->sy_symbol.n_type |= N_EXT) -/* The symbol is not external */ -#define S_CLEAR_EXTERNAL(s) ((s)->sy_symbol.n_type &= ~N_EXT) -/* Set the name of the symbol */ -#define S_SET_NAME(s,v) ((s)->sy_symbol.n_un.n_name = (v)) -/* Set the offset in the string table */ -#define S_SET_OFFSET(s,v) ((s)->sy_symbol.n_un.n_strx = (v)) -/* Set the n_type field */ -#define S_SET_TYPE(s,t) ((s)->sy_symbol.n_type = (t)) -/* Set the n_other expression value */ -#define S_SET_OTHER(s,v) ((s)->sy_symbol.n_other = (v)) -/* Set the n_desc expression value */ -#define S_SET_DESC(s,v) ((s)->sy_symbol.n_desc = (v)) -/* Mark the symbol as weak. This causes n_type to be adjusted when - the symbol is written out. */ -#define S_SET_WEAK(s) ((s)->sy_obj = 1) - -/* File header macro and type definition */ - -#define H_GET_FILE_SIZE(h) (H_GET_HEADER_SIZE(h) \ - + H_GET_TEXT_SIZE(h) \ - + H_GET_DATA_SIZE(h) \ - + H_GET_SYMBOL_TABLE_SIZE(h) \ - + H_GET_TEXT_RELOCATION_SIZE(h) \ - + H_GET_DATA_RELOCATION_SIZE(h) \ - + H_GET_STRING_SIZE(h)) - -#define H_GET_HEADER_SIZE(h) (EXEC_BYTES_SIZE) -#define H_GET_TEXT_SIZE(h) ((h)->header.a_text) -#define H_GET_DATA_SIZE(h) ((h)->header.a_data) -#define H_GET_BSS_SIZE(h) ((h)->header.a_bss) -#define H_GET_TEXT_RELOCATION_SIZE(h) ((h)->header.a_trsize) -#define H_GET_DATA_RELOCATION_SIZE(h) ((h)->header.a_drsize) -#define H_GET_SYMBOL_TABLE_SIZE(h) ((h)->header.a_syms) -#define H_GET_ENTRY_POINT(h) ((h)->header.a_entry) -#define H_GET_STRING_SIZE(h) ((h)->string_table_size) -#define H_GET_LINENO_SIZE(h) (0) - -#define H_GET_DYNAMIC(h) ((h)->header.a_info >> 31) -#define H_GET_VERSION(h) (((h)->header.a_info >> 24) & 0x7f) -#define H_GET_MACHTYPE(h) (((h)->header.a_info >> 16) & 0xff) -#define H_GET_MAGIC_NUMBER(h) ((h)->header.a_info & 0xffff) - -#define H_SET_DYNAMIC(h,v) ((h)->header.a_info = (((v) << 31) \ - | (H_GET_VERSION(h) << 24) \ - | (H_GET_MACHTYPE(h) << 16) \ - | (H_GET_MAGIC_NUMBER(h)))) - -#define H_SET_VERSION(h,v) ((h)->header.a_info = ((H_GET_DYNAMIC(h) << 31) \ - | ((v) << 24) \ - | (H_GET_MACHTYPE(h) << 16) \ - | (H_GET_MAGIC_NUMBER(h)))) - -#define H_SET_MACHTYPE(h,v) ((h)->header.a_info = ((H_GET_DYNAMIC(h) << 31) \ - | (H_GET_VERSION(h) << 24) \ - | ((v) << 16) \ - | (H_GET_MAGIC_NUMBER(h)))) - -#define H_SET_MAGIC_NUMBER(h,v) ((h)->header.a_info = ((H_GET_DYNAMIC(h) << 31) \ - | (H_GET_VERSION(h) << 24) \ - | (H_GET_MACHTYPE(h) << 16) \ - | ((v)))) - -#define H_SET_TEXT_SIZE(h,v) ((h)->header.a_text = md_section_align(SEG_TEXT, (v))) -#define H_SET_DATA_SIZE(h,v) ((h)->header.a_data = md_section_align(SEG_DATA, (v))) -#define H_SET_BSS_SIZE(h,v) ((h)->header.a_bss = md_section_align(SEG_BSS, (v))) - -#define H_SET_RELOCATION_SIZE(h,t,d) (H_SET_TEXT_RELOCATION_SIZE((h),(t)),\ - H_SET_DATA_RELOCATION_SIZE((h),(d))) - -#define H_SET_TEXT_RELOCATION_SIZE(h,v) ((h)->header.a_trsize = (v)) -#define H_SET_DATA_RELOCATION_SIZE(h,v) ((h)->header.a_drsize = (v)) -#define H_SET_SYMBOL_TABLE_SIZE(h,v) ((h)->header.a_syms = (v) * 12) - -#define H_SET_ENTRY_POINT(h,v) ((h)->header.a_entry = (v)) -#define H_SET_STRING_SIZE(h,v) ((h)->string_table_size = (v)) - -typedef struct - { - struct exec header; /* a.out header */ - long string_table_size; /* names + '\0' + sizeof (int) */ - } - -object_headers; - -/* line numbering stuff. */ -#define OBJ_EMIT_LINENO(a, b, c) {;} - -struct fix; -void tc_aout_fix_to_chars PARAMS ((char *where, struct fix *fixP, relax_addressT segment_address)); - -#endif +#define obj_sec_sym_ok_for_reloc(SEC) 1 #define obj_read_begin_hook() {;} #define obj_symbol_new_hook(s) {;} diff --git a/contrib/binutils/gas/config/obj-coff.c b/contrib/binutils/gas/config/obj-coff.c index bd08c2b5f8b..a5a76ff3da0 100644 --- a/contrib/binutils/gas/config/obj-coff.c +++ b/contrib/binutils/gas/config/obj-coff.c @@ -1,6 +1,6 @@ /* coff object file format Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002 + 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of GAS. @@ -17,8 +17,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #define OBJ_HEADER "obj-coff.h" @@ -26,14 +26,21 @@ #include "obstack.h" #include "subsegs.h" +#ifdef TE_PE +#include "coff/pe.h" +#endif + +#define streq(a,b) (strcmp ((a), (b)) == 0) +#define strneq(a,b,n) (strncmp ((a), (b), (n)) == 0) + /* I think this is probably always correct. */ #ifndef KEEP_RELOC_INFO #define KEEP_RELOC_INFO #endif -/* The BFD_ASSEMBLER version of obj_coff_section will use this macro to set - a new section's attributes when a directive has no valid flags or the - "w" flag is used. This default should be appropriate for most. */ +/* obj_coff_section will use this macro to set a new section's + attributes when a directive has no valid flags or the "w" flag is + used. This default should be appropriate for most. */ #ifndef TC_COFF_SECTION_DEFAULT_ATTRIBUTES #define TC_COFF_SECTION_DEFAULT_ATTRIBUTES (SEC_LOAD | SEC_DATA) #endif @@ -41,6 +48,10 @@ /* This is used to hold the symbol built by a sequence of pseudo-ops from .def and .endef. */ static symbolS *def_symbol_in_progress; +#ifdef TE_PE +/* PE weak alternate symbols begin with this string. */ +static const char weak_altprefix[] = ".weak."; +#endif /* TE_PE */ typedef struct { @@ -52,48 +63,23 @@ typedef struct } stack; -static stack *stack_init PARAMS ((unsigned long, unsigned long)); -static char *stack_push PARAMS ((stack *, char *)); -static char *stack_pop PARAMS ((stack *)); -static void tag_init PARAMS ((void)); -static void tag_insert PARAMS ((const char *, symbolS *)); -static symbolS *tag_find PARAMS ((char *)); -static symbolS *tag_find_or_make PARAMS ((char *)); -static void obj_coff_bss PARAMS ((int)); -static void obj_coff_weak PARAMS ((int)); -const char *s_get_name PARAMS ((symbolS * s)); -static void obj_coff_ln PARAMS ((int)); -static void obj_coff_def PARAMS ((int)); -static void obj_coff_endef PARAMS ((int)); -static void obj_coff_dim PARAMS ((int)); -static void obj_coff_line PARAMS ((int)); -static void obj_coff_size PARAMS ((int)); -static void obj_coff_scl PARAMS ((int)); -static void obj_coff_tag PARAMS ((int)); -static void obj_coff_val PARAMS ((int)); -static void obj_coff_type PARAMS ((int)); -static void obj_coff_ident PARAMS ((int)); -#ifdef BFD_ASSEMBLER -static void obj_coff_loc PARAMS((int)); -#endif -/* stack stuff */ +/* Stack stuff. */ static stack * -stack_init (chunk_size, element_size) - unsigned long chunk_size; - unsigned long element_size; +stack_init (unsigned long chunk_size, + unsigned long element_size) { stack *st; - st = (stack *) malloc (sizeof (stack)); + st = malloc (sizeof (* st)); if (!st) - return 0; + return NULL; st->data = malloc (chunk_size); if (!st->data) { free (st); - return 0; + return NULL; } st->pointer = 0; st->size = chunk_size; @@ -102,27 +88,14 @@ stack_init (chunk_size, element_size) return st; } -#if 0 -/* Not currently used. */ -static void -stack_delete (st) - stack *st; -{ - free (st->data); - free (st); -} -#endif - static char * -stack_push (st, element) - stack *st; - char *element; +stack_push (stack *st, char *element) { if (st->pointer + st->element_size >= st->size) { st->size += st->chunk_size; - if ((st->data = xrealloc (st->data, st->size)) == (char *) 0) - return (char *) 0; + if ((st->data = xrealloc (st->data, st->size)) == NULL) + return NULL; } memcpy (st->data + st->pointer, element, st->element_size); st->pointer += st->element_size; @@ -130,58 +103,45 @@ stack_push (st, element) } static char * -stack_pop (st) - stack *st; +stack_pop (stack *st) { if (st->pointer < st->element_size) { st->pointer = 0; - return (char *) 0; + return NULL; } st->pointer -= st->element_size; return st->data + st->pointer; } -/* - * Maintain a list of the tagnames of the structures. - */ +/* Maintain a list of the tagnames of the structures. */ static struct hash_control *tag_hash; static void -tag_init () +tag_init (void) { tag_hash = hash_new (); } static void -tag_insert (name, symbolP) - const char *name; - symbolS *symbolP; +tag_insert (const char *name, symbolS *symbolP) { const char *error_string; if ((error_string = hash_jam (tag_hash, name, (char *) symbolP))) - { - as_fatal (_("Inserting \"%s\" into structure table failed: %s"), - name, error_string); - } + as_fatal (_("Inserting \"%s\" into structure table failed: %s"), + name, error_string); } static symbolS * -tag_find (name) - char *name; +tag_find (char *name) { -#ifdef STRIP_UNDERSCORE - if (*name == '_') - name++; -#endif /* STRIP_UNDERSCORE */ return (symbolS *) hash_find (tag_hash, name); } static symbolS * -tag_find_or_make (name) - char *name; +tag_find_or_make (char *name) { symbolS *symbolP; @@ -191,10 +151,8 @@ tag_find_or_make (name) 0, &zero_address_frag); tag_insert (S_GET_NAME (symbolP), symbolP); -#ifdef BFD_ASSEMBLER symbol_table_insert (symbolP); -#endif - } /* not found */ + } return symbolP; } @@ -203,8 +161,7 @@ tag_find_or_make (name) compatibility with earlier versions of gas. */ static void -obj_coff_bss (ignore) - int ignore ATTRIBUTE_UNUSED; +obj_coff_bss (int ignore ATTRIBUTE_UNUSED) { if (*input_line_pointer == '\n') subseg_new (".bss", get_absolute_expression ()); @@ -212,67 +169,20 @@ obj_coff_bss (ignore) s_lcomm (0); } -/* Handle .weak. This is a GNU extension. */ - -static void -obj_coff_weak (ignore) - int ignore ATTRIBUTE_UNUSED; -{ - char *name; - int c; - symbolS *symbolP; - - do - { - name = input_line_pointer; - c = get_symbol_end (); - symbolP = symbol_find_or_make (name); - *input_line_pointer = c; - SKIP_WHITESPACE (); - -#if defined BFD_ASSEMBLER || defined S_SET_WEAK - S_SET_WEAK (symbolP); -#endif - -#ifdef TE_PE - S_SET_STORAGE_CLASS (symbolP, C_NT_WEAK); -#else - S_SET_STORAGE_CLASS (symbolP, C_WEAKEXT); -#endif - - if (c == ',') - { - input_line_pointer++; - SKIP_WHITESPACE (); - if (*input_line_pointer == '\n') - c = '\n'; - } - } - while (c == ','); - - demand_empty_rest_of_line (); -} - -#ifdef BFD_ASSEMBLER - -static segT fetch_coff_debug_section PARAMS ((void)); -static void SA_SET_SYM_TAGNDX PARAMS ((symbolS *, symbolS *)); -static int S_GET_DATA_TYPE PARAMS ((symbolS *)); -void c_symbol_merge PARAMS ((symbolS *, symbolS *)); -static void add_lineno PARAMS ((fragS *, addressT, int)); - #define GET_FILENAME_STRING(X) \ -((char*) (&((X)->sy_symbol.ost_auxent->x_file.x_n.x_offset))[1]) + ((char *) (&((X)->sy_symbol.ost_auxent->x_file.x_n.x_offset))[1]) /* @@ Ick. */ static segT -fetch_coff_debug_section () +fetch_coff_debug_section (void) { static segT debug_section; + if (!debug_section) { const asymbol *s; - s = bfd_make_debug_symbol (stdoutput, (char *) 0, 0); + + s = bfd_make_debug_symbol (stdoutput, NULL, 0); assert (s != 0); debug_section = s->section; } @@ -280,9 +190,7 @@ fetch_coff_debug_section () } void -SA_SET_SYM_ENDNDX (sym, val) - symbolS *sym; - symbolS *val; +SA_SET_SYM_ENDNDX (symbolS *sym, symbolS *val) { combined_entry_type *entry, *p; @@ -293,9 +201,7 @@ SA_SET_SYM_ENDNDX (sym, val) } static void -SA_SET_SYM_TAGNDX (sym, val) - symbolS *sym; - symbolS *val; +SA_SET_SYM_TAGNDX (symbolS *sym, symbolS *val) { combined_entry_type *entry, *p; @@ -306,32 +212,26 @@ SA_SET_SYM_TAGNDX (sym, val) } static int -S_GET_DATA_TYPE (sym) - symbolS *sym; +S_GET_DATA_TYPE (symbolS *sym) { return coffsymbol (symbol_get_bfdsym (sym))->native->u.syment.n_type; } int -S_SET_DATA_TYPE (sym, val) - symbolS *sym; - int val; +S_SET_DATA_TYPE (symbolS *sym, int val) { coffsymbol (symbol_get_bfdsym (sym))->native->u.syment.n_type = val; return val; } int -S_GET_STORAGE_CLASS (sym) - symbolS *sym; +S_GET_STORAGE_CLASS (symbolS *sym) { return coffsymbol (symbol_get_bfdsym (sym))->native->u.syment.n_sclass; } int -S_SET_STORAGE_CLASS (sym, val) - symbolS *sym; - int val; +S_SET_STORAGE_CLASS (symbolS *sym, int val) { coffsymbol (symbol_get_bfdsym (sym))->native->u.syment.n_sclass = val; return val; @@ -339,35 +239,28 @@ S_SET_STORAGE_CLASS (sym, val) /* Merge a debug symbol containing debug information into a normal symbol. */ -void -c_symbol_merge (debug, normal) - symbolS *debug; - symbolS *normal; +static void +c_symbol_merge (symbolS *debug, symbolS *normal) { S_SET_DATA_TYPE (normal, S_GET_DATA_TYPE (debug)); S_SET_STORAGE_CLASS (normal, S_GET_STORAGE_CLASS (debug)); if (S_GET_NUMBER_AUXILIARY (debug) > S_GET_NUMBER_AUXILIARY (normal)) - { - /* take the most we have */ - S_SET_NUMBER_AUXILIARY (normal, S_GET_NUMBER_AUXILIARY (debug)); - } + /* Take the most we have. */ + S_SET_NUMBER_AUXILIARY (normal, S_GET_NUMBER_AUXILIARY (debug)); if (S_GET_NUMBER_AUXILIARY (debug) > 0) - { - /* Move all the auxiliary information. */ - memcpy (SYM_AUXINFO (normal), SYM_AUXINFO (debug), - (S_GET_NUMBER_AUXILIARY (debug) - * sizeof (*SYM_AUXINFO (debug)))); - } + /* Move all the auxiliary information. */ + memcpy (SYM_AUXINFO (normal), SYM_AUXINFO (debug), + (S_GET_NUMBER_AUXILIARY (debug) + * sizeof (*SYM_AUXINFO (debug)))); /* Move the debug flags. */ SF_SET_DEBUG_FIELD (normal, SF_GET_DEBUG_FIELD (debug)); } void -c_dot_file_symbol (filename) - const char *filename; +c_dot_file_symbol (const char *filename, int appfile ATTRIBUTE_UNUSED) { symbolS *symbolP; @@ -383,24 +276,24 @@ c_dot_file_symbol (filename) #ifndef NO_LISTING { extern int listing; + if (listing) - { - listing_source_file (filename); - } + listing_source_file (filename); } #endif - /* Make sure that the symbol is first on the symbol chain */ + /* Make sure that the symbol is first on the symbol chain. */ if (symbol_rootP != symbolP) { symbol_remove (symbolP, &symbol_rootP, &symbol_lastP); symbol_insert (symbolP, symbol_rootP, &symbol_rootP, &symbol_lastP); - } /* if not first on the list */ + } } -/* Line number handling */ +/* Line number handling. */ -struct line_no { +struct line_no +{ struct line_no *next; fragS *frag; alent l; @@ -417,11 +310,10 @@ static symbolS *line_fsym; void -coff_obj_symbol_new_hook (symbolP) - symbolS *symbolP; +coff_obj_symbol_new_hook (symbolS *symbolP) { long sz = (OBJ_COFF_MAX_AUXENTRIES + 1) * sizeof (combined_entry_type); - char * s = (char *) xmalloc (sz); + char * s = xmalloc (sz); memset (s, 0, sz); coffsymbol (symbol_get_bfdsym (symbolP))->native = (combined_entry_type *) s; @@ -437,31 +329,36 @@ coff_obj_symbol_new_hook (symbolP) SF_SET_LOCAL (symbolP); } +void +coff_obj_symbol_clone_hook (symbolS *newsymP, symbolS *orgsymP) +{ + long sz = (OBJ_COFF_MAX_AUXENTRIES + 1) * sizeof (combined_entry_type); + combined_entry_type * s = xmalloc (sz); + + memcpy (s, coffsymbol (symbol_get_bfdsym (orgsymP))->native, sz); + coffsymbol (symbol_get_bfdsym (newsymP))->native = s; + + SF_SET (newsymP, SF_GET (orgsymP)); +} + -/* - * Handle .ln directives. - */ +/* Handle .ln directives. */ static symbolS *current_lineno_sym; static struct line_no *line_nos; -/* @@ Blindly assume all .ln directives will be in the .text section... */ +/* FIXME: Blindly assume all .ln directives will be in the .text section. */ int coff_n_line_nos; static void -add_lineno (frag, offset, num) - fragS *frag; - addressT offset; - int num; +add_lineno (fragS * frag, addressT offset, int num) { - struct line_no *new_line = - (struct line_no *) xmalloc (sizeof (struct line_no)); + struct line_no * new_line = xmalloc (sizeof (* new_line)); + if (!current_lineno_sym) - { - abort (); - } + abort (); #ifndef OBJ_XCOFF - /* The native aix assembler accepts negative line number */ + /* The native aix assembler accepts negative line number. */ if (num <= 0) { @@ -479,8 +376,7 @@ add_lineno (frag, offset, num) } void -coff_add_linesym (sym) - symbolS *sym; +coff_add_linesym (symbolS *sym) { if (line_nos) { @@ -493,8 +389,7 @@ coff_add_linesym (sym) } static void -obj_coff_ln (appline) - int appline; +obj_coff_ln (int appline) { int l; @@ -534,8 +429,7 @@ obj_coff_ln (appline) compatibility. */ static void -obj_coff_loc (ignore) - int ignore ATTRIBUTE_UNUSED; +obj_coff_loc (int ignore ATTRIBUTE_UNUSED) { int lineno; @@ -582,8 +476,7 @@ obj_coff_loc (ignore) /* Handle the .ident pseudo-op. */ static void -obj_coff_ident (ignore) - int ignore ATTRIBUTE_UNUSED; +obj_coff_ident (int ignore ATTRIBUTE_UNUSED) { segT current_seg = now_seg; subsegT current_subseg = now_subseg; @@ -608,32 +501,26 @@ obj_coff_ident (ignore) subseg_set (current_seg, current_subseg); } -/* - * def() - * - * Handle .def directives. - * - * One might ask : why can't we symbol_new if the symbol does not - * already exist and fill it with debug information. Because of - * the C_EFCN special symbol. It would clobber the value of the - * function symbol before we have a chance to notice that it is - * a C_EFCN. And a second reason is that the code is more clear this - * way. (at least I think it is :-). - * - */ +/* Handle .def directives. + + One might ask : why can't we symbol_new if the symbol does not + already exist and fill it with debug information. Because of + the C_EFCN special symbol. It would clobber the value of the + function symbol before we have a chance to notice that it is + a C_EFCN. And a second reason is that the code is more clear this + way. (at least I think it is :-). */ #define SKIP_SEMI_COLON() while (*input_line_pointer++ != ';') #define SKIP_WHITESPACES() while (*input_line_pointer == ' ' || \ - *input_line_pointer == '\t') \ - input_line_pointer++; + *input_line_pointer == '\t') \ + input_line_pointer++; static void -obj_coff_def (what) - int what ATTRIBUTE_UNUSED; +obj_coff_def (int what ATTRIBUTE_UNUSED) { - char name_end; /* Char after the end of name */ - char *symbol_name; /* Name of the debug symbol */ - char *symbol_name_copy; /* Temporary copy of the name */ + char name_end; /* Char after the end of name. */ + char *symbol_name; /* Name of the debug symbol. */ + char *symbol_name_copy; /* Temporary copy of the name. */ unsigned int symbol_name_length; if (def_symbol_in_progress != NULL) @@ -641,16 +528,11 @@ obj_coff_def (what) as_warn (_(".def pseudo-op used inside of .def/.endef: ignored.")); demand_empty_rest_of_line (); return; - } /* if not inside .def/.endef */ + } SKIP_WHITESPACES (); symbol_name = input_line_pointer; -#ifdef STRIP_UNDERSCORE - if (symbol_name[0] == '_' && symbol_name[1] != 0) - symbol_name++; -#endif /* STRIP_UNDERSCORE */ - name_end = get_symbol_end (); symbol_name_length = strlen (symbol_name); symbol_name_copy = xmalloc (symbol_name_length + 1); @@ -659,7 +541,7 @@ obj_coff_def (what) symbol_name_copy = tc_canonicalize_symbol_name (symbol_name_copy); #endif - /* Initialize the new symbol */ + /* Initialize the new symbol. */ def_symbol_in_progress = symbol_make (symbol_name_copy); symbol_set_frag (def_symbol_in_progress, &zero_address_frag); S_SET_VALUE (def_symbol_in_progress, 0); @@ -675,19 +557,17 @@ obj_coff_def (what) unsigned int dim_index; static void -obj_coff_endef (ignore) - int ignore ATTRIBUTE_UNUSED; +obj_coff_endef (int ignore ATTRIBUTE_UNUSED) { symbolS *symbolP = NULL; - /* DIM BUG FIX sac@cygnus.com */ dim_index = 0; if (def_symbol_in_progress == NULL) { as_warn (_(".endef pseudo-op used outside of .def/.endef: ignored.")); demand_empty_rest_of_line (); return; - } /* if not inside .def/.endef */ + } /* Set the section number according to storage class. */ switch (S_GET_STORAGE_CLASS (def_symbol_in_progress)) @@ -696,7 +576,7 @@ obj_coff_endef (ignore) case C_ENTAG: case C_UNTAG: SF_SET_TAG (def_symbol_in_progress); - /* intentional fallthrough */ + /* Fall through. */ case C_FILE: case C_TPDEF: SF_SET_DEBUG (def_symbol_in_progress); @@ -705,13 +585,14 @@ obj_coff_endef (ignore) case C_EFCN: SF_SET_LOCAL (def_symbol_in_progress); /* Do not emit this symbol. */ - /* intentional fallthrough */ + /* Fall through. */ case C_BLOCK: - SF_SET_PROCESS (def_symbol_in_progress); /* Will need processing before writing */ - /* intentional fallthrough */ + SF_SET_PROCESS (def_symbol_in_progress); /* Will need processing before writing. */ + /* Fall through. */ case C_FCN: { const char *name; + S_SET_SEGMENT (def_symbol_in_progress, text_section); name = S_GET_NAME (def_symbol_in_progress); @@ -802,7 +683,7 @@ obj_coff_endef (ignore) #endif case C_STAT: case C_LABEL: - /* Valid but set somewhere else (s_comm, s_lcomm, colon) */ + /* Valid but set somewhere else (s_comm, s_lcomm, colon). */ break; default: @@ -812,7 +693,7 @@ obj_coff_endef (ignore) as_warn (_("unexpected storage class %d"), S_GET_STORAGE_CLASS (def_symbol_in_progress)); break; - } /* switch on storage class */ + } /* Now that we have built a debug symbol, try to find if we should merge with an existing symbol or not. If a symbol is C_EFCN or @@ -835,14 +716,13 @@ obj_coff_endef (ignore) if (S_GET_STORAGE_CLASS (def_symbol_in_progress) == C_EFCN || S_GET_STORAGE_CLASS (def_symbol_in_progress) == C_LABEL - || (!strcmp (bfd_get_section_name (stdoutput, - S_GET_SEGMENT (def_symbol_in_progress)), - "*DEBUG*") + || (streq (bfd_get_section_name (stdoutput, + S_GET_SEGMENT (def_symbol_in_progress)), + "*DEBUG*") && !SF_GET_TAG (def_symbol_in_progress)) || S_GET_SEGMENT (def_symbol_in_progress) == absolute_section || ! symbol_constant_p (def_symbol_in_progress) - || (symbolP = symbol_find_base (S_GET_NAME (def_symbol_in_progress), - DO_NOT_STRIP)) == NULL + || (symbolP = symbol_find (S_GET_NAME (def_symbol_in_progress))) == NULL || SF_GET_TAG (def_symbol_in_progress) != SF_GET_TAG (symbolP)) { /* If it already is at the end of the symbol list, do nothing */ @@ -859,7 +739,7 @@ obj_coff_endef (ignore) into the old one. This is not mandatory. The linker can handle duplicate symbols correctly. But I guess that it save a *lot* of space if the assembly file defines a lot of - symbols. [loic] */ + symbols. [loic] */ /* The debug entry (def_symbol_in_progress) is merged into the previous definition. */ @@ -876,7 +756,7 @@ obj_coff_endef (ignore) /* For functions, and tags, and static symbols, the symbol *must* be where the debug symbol appears. Move the existing symbol to the current place. */ - /* If it already is at the end of the symbol list, do nothing */ + /* If it already is at the end of the symbol list, do nothing. */ if (def_symbol_in_progress != symbol_lastP) { symbol_remove (def_symbol_in_progress, &symbol_rootP, &symbol_lastP); @@ -889,8 +769,7 @@ obj_coff_endef (ignore) { symbolS *oldtag; - oldtag = symbol_find_base (S_GET_NAME (def_symbol_in_progress), - DO_NOT_STRIP); + oldtag = symbol_find (S_GET_NAME (def_symbol_in_progress)); if (oldtag == NULL || ! SF_GET_TAG (oldtag)) tag_insert (S_GET_NAME (def_symbol_in_progress), def_symbol_in_progress); @@ -903,20 +782,18 @@ obj_coff_endef (ignore) SF_SET_PROCESS (def_symbol_in_progress); if (symbolP == NULL) - { - /* That is, if this is the first time we've seen the - function... */ - symbol_table_insert (def_symbol_in_progress); - } /* definition follows debug */ - } /* Create the line number entry pointing to the function being defined */ + /* That is, if this is the first time we've seen the + function. */ + symbol_table_insert (def_symbol_in_progress); + + } def_symbol_in_progress = NULL; demand_empty_rest_of_line (); } static void -obj_coff_dim (ignore) - int ignore ATTRIBUTE_UNUSED; +obj_coff_dim (int ignore ATTRIBUTE_UNUSED) { int dim_index; @@ -925,7 +802,7 @@ obj_coff_dim (ignore) as_warn (_(".dim pseudo-op used outside of .def/.endef: ignored.")); demand_empty_rest_of_line (); return; - } /* if not inside .def/.endef */ + } S_SET_NUMBER_AUXILIARY (def_symbol_in_progress, 1); @@ -943,7 +820,7 @@ obj_coff_dim (ignore) default: as_warn (_("badly formed .dim directive ignored")); - /* intentional fallthrough */ + /* Fall through. */ case '\n': case ';': dim_index = DIMNUM; @@ -955,8 +832,7 @@ obj_coff_dim (ignore) } static void -obj_coff_line (ignore) - int ignore ATTRIBUTE_UNUSED; +obj_coff_line (int ignore ATTRIBUTE_UNUSED) { int this_base; @@ -968,7 +844,7 @@ obj_coff_line (ignore) } this_base = get_absolute_expression (); - if (!strcmp (".bf", S_GET_NAME (def_symbol_in_progress))) + if (streq (".bf", S_GET_NAME (def_symbol_in_progress))) coff_line_base = this_base; S_SET_NUMBER_AUXILIARY (def_symbol_in_progress, 1); @@ -977,7 +853,7 @@ obj_coff_line (ignore) demand_empty_rest_of_line (); #ifndef NO_LISTING - if (strcmp (".bf", S_GET_NAME (def_symbol_in_progress)) == 0) + if (streq (".bf", S_GET_NAME (def_symbol_in_progress))) { extern int listing; @@ -988,15 +864,14 @@ obj_coff_line (ignore) } static void -obj_coff_size (ignore) - int ignore ATTRIBUTE_UNUSED; +obj_coff_size (int ignore ATTRIBUTE_UNUSED) { if (def_symbol_in_progress == NULL) { as_warn (_(".size pseudo-op used outside of .def/.endef ignored.")); demand_empty_rest_of_line (); return; - } /* if not inside .def/.endef */ + } S_SET_NUMBER_AUXILIARY (def_symbol_in_progress, 1); SA_SET_SYM_SIZE (def_symbol_in_progress, get_absolute_expression ()); @@ -1004,23 +879,21 @@ obj_coff_size (ignore) } static void -obj_coff_scl (ignore) - int ignore ATTRIBUTE_UNUSED; +obj_coff_scl (int ignore ATTRIBUTE_UNUSED) { if (def_symbol_in_progress == NULL) { as_warn (_(".scl pseudo-op used outside of .def/.endef ignored.")); demand_empty_rest_of_line (); return; - } /* if not inside .def/.endef */ + } S_SET_STORAGE_CLASS (def_symbol_in_progress, get_absolute_expression ()); demand_empty_rest_of_line (); } static void -obj_coff_tag (ignore) - int ignore ATTRIBUTE_UNUSED; +obj_coff_tag (int ignore ATTRIBUTE_UNUSED) { char *symbol_name; char name_end; @@ -1045,9 +918,7 @@ obj_coff_tag (ignore) SA_SET_SYM_TAGNDX (def_symbol_in_progress, tag_find_or_make (symbol_name)); if (SA_GET_SYM_TAGNDX (def_symbol_in_progress) == 0L) - { - as_warn (_("tag not found for .tag %s"), symbol_name); - } /* not defined */ + as_warn (_("tag not found for .tag %s"), symbol_name); SF_SET_TAGGED (def_symbol_in_progress); *input_line_pointer = name_end; @@ -1056,37 +927,33 @@ obj_coff_tag (ignore) } static void -obj_coff_type (ignore) - int ignore ATTRIBUTE_UNUSED; +obj_coff_type (int ignore ATTRIBUTE_UNUSED) { if (def_symbol_in_progress == NULL) { as_warn (_(".type pseudo-op used outside of .def/.endef ignored.")); demand_empty_rest_of_line (); return; - } /* if not inside .def/.endef */ + } S_SET_DATA_TYPE (def_symbol_in_progress, get_absolute_expression ()); if (ISFCN (S_GET_DATA_TYPE (def_symbol_in_progress)) && S_GET_STORAGE_CLASS (def_symbol_in_progress) != C_TPDEF) - { - SF_SET_FUNCTION (def_symbol_in_progress); - } /* is a function */ + SF_SET_FUNCTION (def_symbol_in_progress); demand_empty_rest_of_line (); } static void -obj_coff_val (ignore) - int ignore ATTRIBUTE_UNUSED; +obj_coff_val (int ignore ATTRIBUTE_UNUSED) { if (def_symbol_in_progress == NULL) { as_warn (_(".val pseudo-op used outside of .def/.endef ignored.")); demand_empty_rest_of_line (); return; - } /* if not inside .def/.endef */ + } if (is_name_beginner (*input_line_pointer)) { @@ -1096,13 +963,13 @@ obj_coff_val (ignore) #ifdef tc_canonicalize_symbol_name symbol_name = tc_canonicalize_symbol_name (symbol_name); #endif - if (!strcmp (symbol_name, ".")) + if (streq (symbol_name, ".")) { + /* If the .val is != from the .def (e.g. statics). */ symbol_set_frag (def_symbol_in_progress, frag_now); S_SET_VALUE (def_symbol_in_progress, (valueT) frag_now_fix ()); - /* If the .val is != from the .def (e.g. statics) */ } - else if (strcmp (S_GET_NAME (def_symbol_in_progress), symbol_name)) + else if (! streq (S_GET_NAME (def_symbol_in_progress), symbol_name)) { expressionS exp; @@ -1130,19 +997,156 @@ obj_coff_val (ignore) else { S_SET_VALUE (def_symbol_in_progress, get_absolute_expression ()); - } /* if symbol based */ + } + + demand_empty_rest_of_line (); +} + +#ifdef TE_PE + +/* Return nonzero if name begins with weak alternate symbol prefix. */ + +static int +weak_is_altname (const char * name) +{ + return strneq (name, weak_altprefix, sizeof (weak_altprefix) - 1); +} + +/* Return the name of the alternate symbol + name corresponding to a weak symbol's name. */ + +static const char * +weak_name2altname (const char * name) +{ + char *alt_name; + + alt_name = xmalloc (sizeof (weak_altprefix) + strlen (name)); + strcpy (alt_name, weak_altprefix); + return strcat (alt_name, name); +} + +/* Return the name of the weak symbol corresponding to an + alterate symbol. */ + +static const char * +weak_altname2name (const char * name) +{ + char * weak_name; + char * dot; + + assert (weak_is_altname (name)); + + weak_name = xstrdup (name + 6); + if ((dot = strchr (weak_name, '.'))) + *dot = 0; + return weak_name; +} + +/* Make a weak symbol name unique by + appending the name of an external symbol. */ + +static const char * +weak_uniquify (const char * name) +{ + char *ret; + const char * unique = ""; + +#ifdef USE_UNIQUE + if (an_external_name != NULL) + unique = an_external_name; +#endif + assert (weak_is_altname (name)); + + if (strchr (name + sizeof (weak_altprefix), '.')) + return name; + + ret = xmalloc (strlen (name) + strlen (unique) + 2); + strcpy (ret, name); + strcat (ret, "."); + strcat (ret, unique); + return ret; +} + +void +pecoff_obj_set_weak_hook (symbolS *symbolP) +{ + symbolS *alternateP; + + /* See _Microsoft Portable Executable and Common Object + File Format Specification_, section 5.5.3. + Create a symbol representing the alternate value. + coff_frob_symbol will set the value of this symbol from + the value of the weak symbol itself. */ + S_SET_STORAGE_CLASS (symbolP, C_NT_WEAK); + S_SET_NUMBER_AUXILIARY (symbolP, 1); + SA_SET_SYM_FSIZE (symbolP, IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY); + + alternateP = symbol_find_or_make (weak_name2altname (S_GET_NAME (symbolP))); + S_SET_EXTERNAL (alternateP); + S_SET_STORAGE_CLASS (alternateP, C_NT_WEAK); + + SA_SET_SYM_TAGNDX (symbolP, alternateP); +} + +void +pecoff_obj_clear_weak_hook (symbolS *symbolP) +{ + symbolS *alternateP; + + S_SET_STORAGE_CLASS (symbolP, 0); + SA_SET_SYM_FSIZE (symbolP, 0); + + alternateP = symbol_find (weak_name2altname (S_GET_NAME (symbolP))); + S_CLEAR_EXTERNAL (alternateP); +} + +#endif /* TE_PE */ + +/* Handle .weak. This is a GNU extension in formats other than PE. */ + +static void +obj_coff_weak (int ignore ATTRIBUTE_UNUSED) +{ + char *name; + int c; + symbolS *symbolP; + + do + { + name = input_line_pointer; + c = get_symbol_end (); + if (*name == 0) + { + as_warn (_("badly formed .weak directive ignored")); + ignore_rest_of_line (); + return; + } + c = 0; + symbolP = symbol_find_or_make (name); + *input_line_pointer = c; + SKIP_WHITESPACE (); + S_SET_WEAK (symbolP); + + if (c == ',') + { + input_line_pointer++; + SKIP_WHITESPACE (); + if (*input_line_pointer == '\n') + c = '\n'; + } + + } + while (c == ','); demand_empty_rest_of_line (); } void -coff_obj_read_begin_hook () +coff_obj_read_begin_hook (void) { /* These had better be the same. Usually 18 bytes. */ -#ifndef BFD_HEADERS know (sizeof (SYMENT) == sizeof (AUXENT)); know (SYMESZ == AUXESZ); -#endif tag_init (); } @@ -1152,9 +1156,7 @@ static symbolS *coff_last_bf; #endif void -coff_frob_symbol (symp, punt) - symbolS *symp; - int *punt; +coff_frob_symbol (symbolS *symp, int *punt) { static symbolS *last_tagP; static stack *block_stack; @@ -1168,19 +1170,79 @@ coff_frob_symbol (symp, punt) } if (current_lineno_sym) - coff_add_linesym ((symbolS *) 0); + coff_add_linesym (NULL); if (!block_stack) block_stack = stack_init (512, sizeof (symbolS*)); - if (S_IS_WEAK (symp)) - { #ifdef TE_PE - S_SET_STORAGE_CLASS (symp, C_NT_WEAK); -#else - S_SET_STORAGE_CLASS (symp, C_WEAKEXT); -#endif + if (S_GET_STORAGE_CLASS (symp) == C_NT_WEAK + && ! S_IS_WEAK (symp) + && weak_is_altname (S_GET_NAME (symp))) + { + /* This is a weak alternate symbol. All processing of + PECOFFweak symbols is done here, through the alternate. */ + symbolS *weakp = symbol_find_noref (weak_altname2name + (S_GET_NAME (symp)), 1); + + assert (weakp); + assert (S_GET_NUMBER_AUXILIARY (weakp) == 1); + + if (! S_IS_WEAK (weakp)) + { + /* The symbol was turned from weak to strong. Discard altname. */ + *punt = 1; + return; + } + else if (symbol_equated_p (weakp)) + { + /* The weak symbol has an alternate specified; symp is unneeded. */ + S_SET_STORAGE_CLASS (weakp, C_NT_WEAK); + SA_SET_SYM_TAGNDX (weakp, + symbol_get_value_expression (weakp)->X_add_symbol); + + S_CLEAR_EXTERNAL (symp); + *punt = 1; + return; + } + else + { + /* The weak symbol has been assigned an alternate value. + Copy this value to symp, and set symp as weakp's alternate. */ + if (S_GET_STORAGE_CLASS (weakp) != C_NT_WEAK) + { + S_SET_STORAGE_CLASS (symp, S_GET_STORAGE_CLASS (weakp)); + S_SET_STORAGE_CLASS (weakp, C_NT_WEAK); + } + + if (S_IS_DEFINED (weakp)) + { + /* This is a defined weak symbol. Copy value information + from the weak symbol itself to the alternate symbol. */ + symbol_set_value_expression (symp, + symbol_get_value_expression (weakp)); + symbol_set_frag (symp, symbol_get_frag (weakp)); + S_SET_SEGMENT (symp, S_GET_SEGMENT (weakp)); + } + else + { + /* This is an undefined weak symbol. + Define the alternate symbol to zero. */ + S_SET_VALUE (symp, 0); + S_SET_SEGMENT (symp, absolute_section); + } + + S_SET_NAME (symp, weak_uniquify (S_GET_NAME (symp))); + S_SET_STORAGE_CLASS (symp, C_EXT); + + S_SET_VALUE (weakp, 0); + S_SET_SEGMENT (weakp, undefined_section); + } } +#else /* TE_PE */ + if (S_IS_WEAK (symp)) + S_SET_STORAGE_CLASS (symp, C_WEAKEXT); +#endif /* TE_PE */ if (!S_IS_DEFINED (symp) && !S_IS_WEAK (symp) @@ -1194,8 +1256,8 @@ coff_frob_symbol (symp, punt) if (!SF_GET_LOCAL (symp) && !SF_GET_STATICS (symp) && S_GET_STORAGE_CLASS (symp) != C_LABEL - && symbol_constant_p(symp) - && (real = symbol_find_base (S_GET_NAME (symp), DO_NOT_STRIP)) + && symbol_constant_p (symp) + && (real = symbol_find_noref (S_GET_NAME (symp), 1)) && S_GET_STORAGE_CLASS (real) == C_NULL && real != symp) { @@ -1207,7 +1269,10 @@ coff_frob_symbol (symp, punt) if (!S_IS_DEFINED (symp) && !SF_GET_LOCAL (symp)) { assert (S_GET_VALUE (symp) == 0); - S_SET_EXTERNAL (symp); + if (S_IS_WEAKREFD (symp)) + *punt = 1; + else + S_SET_EXTERNAL (symp); } else if (S_GET_STORAGE_CLASS (symp) == C_NULL) { @@ -1222,7 +1287,7 @@ coff_frob_symbol (symp, punt) { if (S_GET_STORAGE_CLASS (symp) == C_BLOCK) { - if (!strcmp (S_GET_NAME (symp), ".bb")) + if (streq (S_GET_NAME (symp), ".bb")) stack_push (block_stack, (char *) &symp); else { @@ -1251,7 +1316,8 @@ coff_frob_symbol (symp, punt) if (S_GET_STORAGE_CLASS (symp) == C_EFCN) { if (coff_last_function == 0) - as_fatal (_("C_EFCN symbol out of scope")); + as_fatal (_("C_EFCN symbol for %s out of scope"), + S_GET_NAME (symp)); SA_SET_SYM_FSIZE (coff_last_function, (long) (S_GET_VALUE (symp) - S_GET_VALUE (coff_last_function))); @@ -1267,8 +1333,6 @@ coff_frob_symbol (symp, punt) if (SF_GET_FUNCTION (symp)) symbol_get_bfdsym (symp)->flags |= BSF_FUNCTION; - - /* more ... */ } /* Double check weak symbols. */ @@ -1286,7 +1350,7 @@ coff_frob_symbol (symp, punt) order to call SA_SET_SYM_ENDNDX correctly. */ if (! symbol_used_in_reloc_p (symp) && ((symbol_get_bfdsym (symp)->flags & BSF_SECTION_SYM) != 0 - || (! S_IS_EXTERNAL (symp) + || (! (S_IS_EXTERNAL (symp) || S_IS_WEAK (symp)) && ! symbol_get_tc (symp)->output && S_GET_STORAGE_CLASS (symp) != C_FILE))) *punt = 1; @@ -1314,7 +1378,7 @@ coff_frob_symbol (symp, punt) #ifndef OBJ_XCOFF if (! *punt && S_GET_STORAGE_CLASS (symp) == C_FCN - && strcmp (S_GET_NAME (symp), ".bf") == 0) + && streq (S_GET_NAME (symp), ".bf")) { if (coff_last_bf != NULL) SA_SET_SYM_ENDNDX (coff_last_bf, symp); @@ -1335,7 +1399,7 @@ coff_frob_symbol (symp, punt) /* We need i entries for line numbers, plus 1 for the first entry which BFD will override, plus 1 for the last zero entry (a marker for BFD). */ - l = (alent *) xmalloc ((i + 2) * sizeof (alent)); + l = xmalloc ((i + 2) * sizeof (* l)); coffsymbol (symbol_get_bfdsym (symp))->lineno = l; l[i + 1].line_number = 0; l[i + 1].u.sym = NULL; @@ -1350,10 +1414,9 @@ coff_frob_symbol (symp, punt) } void -coff_adjust_section_syms (abfd, sec, x) - bfd *abfd ATTRIBUTE_UNUSED; - asection *sec; - PTR x ATTRIBUTE_UNUSED; +coff_adjust_section_syms (bfd *abfd ATTRIBUTE_UNUSED, + asection *sec, + void * x ATTRIBUTE_UNUSED) { symbolS *secsym; segment_info_type *seginfo = seg_info (sec); @@ -1364,7 +1427,7 @@ coff_adjust_section_syms (abfd, sec, x) if (seginfo == NULL) return; - if (!strcmp (sec->name, ".text")) + if (streq (sec->name, ".text")) nlnno = coff_n_line_nos; else nlnno = 0; @@ -1379,13 +1442,14 @@ coff_adjust_section_syms (abfd, sec, x) fixp = fixp->fx_next; } } - if (bfd_get_section_size_before_reloc (sec) == 0 + if (bfd_get_section_size (sec) == 0 && nrelocs == 0 && nlnno == 0 && sec != text_section && sec != data_section && sec != bss_section) return; + secsym = section_symbol (sec); /* This is an estimate; we'll plug in the real value using SET_SECTION_RELOCS later */ @@ -1394,9 +1458,9 @@ coff_adjust_section_syms (abfd, sec, x) } void -coff_frob_file_after_relocs () +coff_frob_file_after_relocs (void) { - bfd_map_over_sections (stdoutput, coff_adjust_section_syms, (char*) 0); + bfd_map_over_sections (stdoutput, coff_adjust_section_syms, NULL); } /* Implement the .section pseudo op: @@ -1419,10 +1483,9 @@ coff_frob_file_after_relocs () .section directive to be parsed in both ELF and COFF formats. */ void -obj_coff_section (ignore) - int ignore ATTRIBUTE_UNUSED; +obj_coff_section (int ignore ATTRIBUTE_UNUSED) { - /* Strip out the section name */ + /* Strip out the section name. */ char *section_name; char c; char *name; @@ -1459,38 +1522,81 @@ obj_coff_section (ignore) exp = get_absolute_expression (); else { - ++input_line_pointer; - while (*input_line_pointer != '"' - && ! is_end_of_line[(unsigned char) *input_line_pointer]) + unsigned char attr; + int readonly_removed = 0; + int load_removed = 0; + + while (attr = *++input_line_pointer, + attr != '"' + && ! is_end_of_line[attr]) { - switch (*input_line_pointer) + switch (attr) { - case 'b': flags |= SEC_ALLOC; flags &=~ SEC_LOAD; break; - case 'n': flags &=~ SEC_LOAD; flags |= SEC_NEVER_LOAD; break; + case 'b': + /* Uninitialised data section. */ + flags |= SEC_ALLOC; + flags &=~ SEC_LOAD; + break; - case 's': flags |= SEC_SHARED; /* fall through */ - case 'd': flags |= SEC_DATA | SEC_LOAD; /* fall through */ - case 'w': flags &=~ SEC_READONLY; break; + case 'n': + /* Section not loaded. */ + flags &=~ SEC_LOAD; + flags |= SEC_NEVER_LOAD; + load_removed = 1; + break; - case 'a': break; /* For compatibility with ELF. */ - case 'x': flags |= SEC_CODE | SEC_LOAD; break; - case 'r': flags |= SEC_DATA | SEC_LOAD | SEC_READONLY; break; + case 's': + /* Shared section. */ + flags |= SEC_COFF_SHARED; + /* Fall through. */ + case 'd': + /* Data section. */ + flags |= SEC_DATA; + if (! load_removed) + flags |= SEC_LOAD; + flags &=~ SEC_READONLY; + break; + + case 'w': + /* Writable section. */ + flags &=~ SEC_READONLY; + readonly_removed = 1; + break; + + case 'a': + /* Ignore. Here for compatibility with ELF. */ + break; + + case 'r': /* Read-only section. Implies a data section. */ + readonly_removed = 0; + /* Fall through. */ + case 'x': /* Executable section. */ + /* If we are setting the 'x' attribute or if the 'r' + attribute is being used to restore the readonly status + of a code section (eg "wxr") then set the SEC_CODE flag, + otherwise set the SEC_DATA flag. */ + flags |= (attr == 'x' || (flags & SEC_CODE) ? SEC_CODE : SEC_DATA); + if (! load_removed) + flags |= SEC_LOAD; + /* Note - the READONLY flag is set here, even for the 'x' + attrbiute in order to be compatible with the MSVC + linker. */ + if (! readonly_removed) + flags |= SEC_READONLY; + break; case 'i': /* STYP_INFO */ case 'l': /* STYP_LIB */ case 'o': /* STYP_OVER */ - as_warn (_("unsupported section attribute '%c'"), - *input_line_pointer); + as_warn (_("unsupported section attribute '%c'"), attr); break; default: - as_warn(_("unknown section attribute '%c'"), - *input_line_pointer); + as_warn (_("unknown section attribute '%c'"), attr); break; } - ++input_line_pointer; } - if (*input_line_pointer == '"') + if (attr == '"') ++input_line_pointer; } } @@ -1509,7 +1615,7 @@ obj_coff_section (ignore) /* Add SEC_LINK_ONCE and SEC_LINK_DUPLICATES_DISCARD to .gnu.linkonce sections so adjust_reloc_syms in write.c will correctly handle relocs which refer to non-local symbols in these sections. */ - if (strncmp (name, ".gnu.linkonce", sizeof (".gnu.linkonce") - 1) == 0) + if (strneq (name, ".gnu.linkonce", sizeof (".gnu.linkonce") - 1)) flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD; #endif @@ -1520,10 +1626,10 @@ obj_coff_section (ignore) } else if (flags != SEC_NO_FLAGS) { - /* This section's attributes have already been set. Warn if the + /* This section's attributes have already been set. Warn if the attributes don't match. */ flagword matchflags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE - | SEC_DATA | SEC_SHARED | SEC_NEVER_LOAD); + | SEC_DATA | SEC_COFF_SHARED | SEC_NEVER_LOAD); if ((flags ^ oldflags) & matchflags) as_warn (_("Ignoring changed section attributes for %s"), name); } @@ -1532,16 +1638,15 @@ obj_coff_section (ignore) } void -coff_adjust_symtab () +coff_adjust_symtab (void) { if (symbol_rootP == NULL || S_GET_STORAGE_CLASS (symbol_rootP) != C_FILE) - c_dot_file_symbol ("fake"); + c_dot_file_symbol ("fake", 0); } void -coff_frob_section (sec) - segT sec; +coff_frob_section (segT sec) { segT strsec; char *p; @@ -1554,7 +1659,7 @@ coff_frob_section (sec) supposedly because standard COFF has no other way of encoding alignment for sections. If your COFF flavor has a different way of encoding section alignment, then skip this step, as TICOFF does. */ - size = bfd_get_section_size_before_reloc (sec); + size = bfd_get_section_size (sec); mask = ((bfd_vma) 1 << align_power) - 1; #if !defined(TICOFF) if (size & mask) @@ -1594,22 +1699,22 @@ coff_frob_section (sec) SA_SET_SCN_SCNLEN (secsym, size); } - /* @@ these should be in a "stabs.h" file, or maybe as.h */ + /* FIXME: These should be in a "stabs.h" file, or maybe as.h. */ #ifndef STAB_SECTION_NAME #define STAB_SECTION_NAME ".stab" #endif #ifndef STAB_STRING_SECTION_NAME #define STAB_STRING_SECTION_NAME ".stabstr" #endif - if (strcmp (STAB_STRING_SECTION_NAME, sec->name)) + if (! streq (STAB_STRING_SECTION_NAME, sec->name)) return; strsec = sec; sec = subseg_get (STAB_SECTION_NAME, 0); /* size is already rounded up, since other section will be listed first */ - size = bfd_get_section_size_before_reloc (strsec); + size = bfd_get_section_size (strsec); - n_entries = bfd_get_section_size_before_reloc (sec) / 12 - 1; + n_entries = bfd_get_section_size (sec) / 12 - 1; /* Find first non-empty frag. It should be large enough. */ fragp = seg_info (sec)->frchainP->frch_root; @@ -1624,8 +1729,7 @@ coff_frob_section (sec) } void -obj_coff_init_stab_section (seg) - segT seg; +obj_coff_init_stab_section (segT seg) { char *file; char *p; @@ -1637,7 +1741,7 @@ obj_coff_init_stab_section (seg) /* Zero it out. */ memset (p, 0, 12); as_where (&file, (unsigned int *) NULL); - stabstr_name = (char *) xmalloc (strlen (seg->name) + 4); + stabstr_name = xmalloc (strlen (seg->name) + 4); strcpy (stabstr_name, seg->name); strcat (stabstr_name, "str"); stroff = get_stab_string_offset (file, stabstr_name); @@ -1646,3009 +1750,73 @@ obj_coff_init_stab_section (seg) } #ifdef DEBUG -/* for debugging */ const char * -s_get_name (s) - symbolS *s; +s_get_name (symbolS *s) { return ((s == NULL) ? "(NULL)" : S_GET_NAME (s)); } void -symbol_dump () +symbol_dump (void) { symbolS *symbolP; for (symbolP = symbol_rootP; symbolP; symbolP = symbol_next (symbolP)) - { - printf (_("0x%lx: \"%s\" type = %ld, class = %d, segment = %d\n"), - (unsigned long) symbolP, - S_GET_NAME(symbolP), - (long) S_GET_DATA_TYPE(symbolP), - S_GET_STORAGE_CLASS(symbolP), - (int) S_GET_SEGMENT(symbolP)); - } + printf (_("0x%lx: \"%s\" type = %ld, class = %d, segment = %d\n"), + (unsigned long) symbolP, + S_GET_NAME (symbolP), + (long) S_GET_DATA_TYPE (symbolP), + S_GET_STORAGE_CLASS (symbolP), + (int) S_GET_SEGMENT (symbolP)); } #endif /* DEBUG */ -#else /* not BFD_ASSEMBLER */ - -#include "frags.h" -/* This is needed because we include internal bfd things. */ -#include - -#include "libbfd.h" -#include "libcoff.h" - -#ifdef TE_PE -#include "coff/pe.h" -#endif - -/* The NOP_OPCODE is for the alignment fill value. Fill with nop so - that we can stick sections together without causing trouble. */ -#ifndef NOP_OPCODE -#define NOP_OPCODE 0x00 -#endif - -/* The zeroes if symbol name is longer than 8 chars */ -#define S_SET_ZEROES(s,v) ((s)->sy_symbol.ost_entry.n_zeroes = (v)) - -#define MIN(a,b) ((a) < (b)? (a) : (b)) - -/* This vector is used to turn a gas internal segment number into a - section number suitable for insertion into a coff symbol table. - This must correspond to seg_info_off_by_4. */ - -const short seg_N_TYPE[] = -{ /* in: segT out: N_TYPE bits */ - C_ABS_SECTION, - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - C_UNDEF_SECTION, /* SEG_UNKNOWN */ - C_UNDEF_SECTION, /* SEG_GOOF */ - C_UNDEF_SECTION, /* SEG_EXPR */ - C_DEBUG_SECTION, /* SEG_DEBUG */ - C_NTV_SECTION, /* SEG_NTV */ - C_PTV_SECTION, /* SEG_PTV */ - C_REGISTER_SECTION, /* SEG_REGISTER */ -}; - -int function_lineoff = -1; /* Offset in line#s where the last function - started (the odd entry for line #0) */ - -/* Structure used to keep the filenames which - are too long around so that we can stick them - into the string table. */ -struct filename_list -{ - char *filename; - struct filename_list *next; -}; - -static struct filename_list *filename_list_head; -static struct filename_list *filename_list_tail; - -static symbolS *last_line_symbol; - -/* Add 4 to the real value to get the index and compensate the - negatives. This vector is used by S_GET_SEGMENT to turn a coff - section number into a segment number. */ - -bfd *abfd; -static symbolS *previous_file_symbol; -static int line_base; - -void c_symbol_merge PARAMS ((symbolS *, symbolS *)); -symbolS *c_section_symbol PARAMS ((char *, int)); -void obj_coff_section PARAMS ((int)); -void do_relocs_for PARAMS ((bfd *, object_headers *, unsigned long *)); -char * symbol_to_chars PARAMS ((bfd *, char *, symbolS *)); -void w_strings PARAMS ((char *)); - -static void fixup_segment PARAMS ((segment_info_type *, segT)); -static void fixup_mdeps PARAMS ((fragS *, object_headers *, segT)); -static void fill_section PARAMS ((bfd *, object_headers *, unsigned long *)); -static int c_line_new PARAMS ((symbolS *, long, int, fragS *)); -static void w_symbols PARAMS ((bfd *, char *, symbolS *)); -static void adjust_stab_section PARAMS ((bfd *, segT)); -static void obj_coff_lcomm PARAMS ((int)); -static void obj_coff_text PARAMS ((int)); -static void obj_coff_data PARAMS ((int)); -static unsigned int count_entries_in_chain PARAMS ((unsigned int)); -static void coff_header_append PARAMS ((bfd *, object_headers *)); -static unsigned int yank_symbols PARAMS ((void)); -static unsigned int glue_symbols PARAMS ((symbolS **, symbolS **)); -static unsigned int tie_tags PARAMS ((void)); -static void crawl_symbols PARAMS ((object_headers *, bfd *)); -static void do_linenos_for PARAMS ((bfd *, object_headers *, unsigned long *)); -static void remove_subsegs PARAMS ((void)); - - - -/* When not using BFD_ASSEMBLER, we permit up to 40 sections. - - This array maps a COFF section number into a gas section number. - Because COFF uses negative section numbers, you must add 4 to the - COFF section number when indexing into this array; this is done via - the SEG_INFO_FROM_SECTION_NUMBER macro. This must correspond to - seg_N_TYPE. */ - -static const segT seg_info_off_by_4[] = -{ - SEG_PTV, - SEG_NTV, - SEG_DEBUG, - SEG_ABSOLUTE, - SEG_UNKNOWN, - SEG_E0, SEG_E1, SEG_E2, SEG_E3, SEG_E4, - SEG_E5, SEG_E6, SEG_E7, SEG_E8, SEG_E9, - SEG_E10, SEG_E11, SEG_E12, SEG_E13, SEG_E14, - SEG_E15, SEG_E16, SEG_E17, SEG_E18, SEG_E19, - SEG_E20, SEG_E21, SEG_E22, SEG_E23, SEG_E24, - SEG_E25, SEG_E26, SEG_E27, SEG_E28, SEG_E29, - SEG_E30, SEG_E31, SEG_E32, SEG_E33, SEG_E34, - SEG_E35, SEG_E36, SEG_E37, SEG_E38, SEG_E39, - (segT) 40, - (segT) 41, - (segT) 42, - (segT) 43, - (segT) 44, - (segT) 45, - (segT) 0, - (segT) 0, - (segT) 0, - SEG_REGISTER -}; - -#define SEG_INFO_FROM_SECTION_NUMBER(x) (seg_info_off_by_4[(x)+4]) - -static relax_addressT relax_align PARAMS ((relax_addressT, long)); - -static relax_addressT -relax_align (address, alignment) - relax_addressT address; - long alignment; -{ - relax_addressT mask; - relax_addressT new_address; - - mask = ~((~0) << alignment); - new_address = (address + mask) & (~mask); - return (new_address - address); -} - -segT -s_get_segment (x) - symbolS * x; -{ - return SEG_INFO_FROM_SECTION_NUMBER (x->sy_symbol.ost_entry.n_scnum); -} - -static unsigned int size_section PARAMS ((bfd *, unsigned int)); - -/* Calculate the size of the frag chain and fill in the section header - to contain all of it, also fill in the addr of the sections. */ - -static unsigned int -size_section (abfd, idx) - bfd *abfd ATTRIBUTE_UNUSED; - unsigned int idx; -{ - - unsigned int size = 0; - fragS *frag = segment_info[idx].frchainP->frch_root; - - while (frag) - { - size = frag->fr_address; - if (frag->fr_address != size) - { - fprintf (stderr, _("Out of step\n")); - size = frag->fr_address; - } - - switch (frag->fr_type) - { -#ifdef TC_COFF_SIZEMACHDEP - case rs_machine_dependent: - size += TC_COFF_SIZEMACHDEP (frag); - break; -#endif - case rs_space: - case rs_fill: - case rs_org: - size += frag->fr_fix; - size += frag->fr_offset * frag->fr_var; - break; - case rs_align: - case rs_align_code: - case rs_align_test: - { - addressT off; - - size += frag->fr_fix; - off = relax_align (size, frag->fr_offset); - if (frag->fr_subtype != 0 && off > frag->fr_subtype) - off = 0; - size += off; - } - break; - default: - BAD_CASE (frag->fr_type); - break; - } - frag = frag->fr_next; - } - segment_info[idx].scnhdr.s_size = size; - return size; -} - -static unsigned int -count_entries_in_chain (idx) - unsigned int idx; -{ - unsigned int nrelocs; - fixS *fixup_ptr; - - /* Count the relocations. */ - fixup_ptr = segment_info[idx].fix_root; - nrelocs = 0; - while (fixup_ptr != (fixS *) NULL) - { - if (fixup_ptr->fx_done == 0 && TC_COUNT_RELOC (fixup_ptr)) - { -#if defined(TC_A29K) || defined(TC_OR32) - if (fixup_ptr->fx_r_type == RELOC_CONSTH) - nrelocs += 2; - else - nrelocs++; -#else - nrelocs++; -#endif - } - - fixup_ptr = fixup_ptr->fx_next; - } - return nrelocs; -} - -#ifdef TE_AUX - -static int compare_external_relocs PARAMS ((const PTR, const PTR)); - -/* AUX's ld expects relocations to be sorted. */ - -static int -compare_external_relocs (x, y) - const PTR x; - const PTR y; -{ - struct external_reloc *a = (struct external_reloc *) x; - struct external_reloc *b = (struct external_reloc *) y; - bfd_vma aadr = bfd_getb32 (a->r_vaddr); - bfd_vma badr = bfd_getb32 (b->r_vaddr); - return (aadr < badr ? -1 : badr < aadr ? 1 : 0); -} - -#endif - -/* Output all the relocations for a section. */ - -void -do_relocs_for (abfd, h, file_cursor) - bfd * abfd; - object_headers * h; - unsigned long *file_cursor; -{ - unsigned int nrelocs; - unsigned int idx; - unsigned long reloc_start = *file_cursor; - - for (idx = SEG_E0; idx < SEG_LAST; idx++) - { - if (segment_info[idx].scnhdr.s_name[0]) - { - struct external_reloc *ext_ptr; - struct external_reloc *external_reloc_vec; - unsigned int external_reloc_size; - unsigned int base = segment_info[idx].scnhdr.s_paddr; - fixS *fix_ptr = segment_info[idx].fix_root; - nrelocs = count_entries_in_chain (idx); - - if (nrelocs) - /* Bypass this stuff if no relocs. This also incidentally - avoids a SCO bug, where free(malloc(0)) tends to crash. */ - { - external_reloc_size = nrelocs * RELSZ; - external_reloc_vec = - (struct external_reloc *) malloc (external_reloc_size); - - ext_ptr = external_reloc_vec; - - /* Fill in the internal coff style reloc struct from the - internal fix list. */ - while (fix_ptr) - { - struct internal_reloc intr; - - /* Only output some of the relocations. */ - if (fix_ptr->fx_done == 0 && TC_COUNT_RELOC (fix_ptr)) - { -#ifdef TC_RELOC_MANGLE - TC_RELOC_MANGLE (&segment_info[idx], fix_ptr, &intr, - base); -#else - symbolS *dot; - symbolS *symbol_ptr = fix_ptr->fx_addsy; - - intr.r_type = TC_COFF_FIX2RTYPE (fix_ptr); - intr.r_vaddr = - base + fix_ptr->fx_frag->fr_address + fix_ptr->fx_where; - -#ifdef TC_KEEP_FX_OFFSET - intr.r_offset = fix_ptr->fx_offset; -#else - intr.r_offset = 0; -#endif - - while (symbol_ptr->sy_value.X_op == O_symbol - && (! S_IS_DEFINED (symbol_ptr) - || S_IS_COMMON (symbol_ptr))) - { - symbolS *n; - - /* We must avoid looping, as that can occur - with a badly written program. */ - n = symbol_ptr->sy_value.X_add_symbol; - if (n == symbol_ptr) - break; - symbol_ptr = n; - } - - /* Turn the segment of the symbol into an offset. */ - if (symbol_ptr) - { - resolve_symbol_value (symbol_ptr); - if (! symbol_ptr->sy_resolved) - { - char *file; - unsigned int line; - - if (expr_symbol_where (symbol_ptr, &file, &line)) - as_bad_where (file, line, - _("unresolved relocation")); - else - as_bad (_("bad relocation: symbol `%s' not in symbol table"), - S_GET_NAME (symbol_ptr)); - } - - dot = segment_info[S_GET_SEGMENT (symbol_ptr)].dot; - if (dot) - intr.r_symndx = dot->sy_number; - else - intr.r_symndx = symbol_ptr->sy_number; - } - else - intr.r_symndx = -1; -#endif - (void) bfd_coff_swap_reloc_out (abfd, &intr, ext_ptr); - ext_ptr++; -#if defined(TC_A29K) - /* The 29k has a special kludge for the high 16 bit - reloc. Two relocations are emitted, R_IHIHALF, - and R_IHCONST. The second one doesn't contain a - symbol, but uses the value for offset. */ - if (intr.r_type == R_IHIHALF) - { - /* Now emit the second bit. */ - intr.r_type = R_IHCONST; - intr.r_symndx = fix_ptr->fx_addnumber; - (void) bfd_coff_swap_reloc_out (abfd, &intr, ext_ptr); - ext_ptr++; - } -#endif -#if defined(TC_OR32) - /* The or32 has a special kludge for the high 16 bit - reloc. Two relocations are emitted, R_IHIHALF, - and R_IHCONST. The second one doesn't contain a - symbol, but uses the value for offset. */ - if (intr.r_type == R_IHIHALF) - { - /* Now emit the second bit. */ - intr.r_type = R_IHCONST; - intr.r_symndx = fix_ptr->fx_addnumber; - (void) bfd_coff_swap_reloc_out (abfd, & intr, ext_ptr); - ext_ptr ++; - } -#endif - } - - fix_ptr = fix_ptr->fx_next; - } -#ifdef TE_AUX - /* Sort the reloc table. */ - qsort ((PTR) external_reloc_vec, nrelocs, - sizeof (struct external_reloc), compare_external_relocs); -#endif - /* Write out the reloc table. */ - bfd_bwrite ((PTR) external_reloc_vec, - (bfd_size_type) external_reloc_size, abfd); - free (external_reloc_vec); - - /* Fill in section header info. */ - segment_info[idx].scnhdr.s_relptr = *file_cursor; - *file_cursor += external_reloc_size; - segment_info[idx].scnhdr.s_nreloc = nrelocs; - } - else - { - /* No relocs. */ - segment_info[idx].scnhdr.s_relptr = 0; - } - } - } - - /* Set relocation_size field in file headers. */ - H_SET_RELOCATION_SIZE (h, *file_cursor - reloc_start, 0); -} - -/* Run through a frag chain and write out the data to go with it, fill - in the scnhdrs with the info on the file positions. */ - -static void -fill_section (abfd, h, file_cursor) - bfd * abfd; - object_headers *h ATTRIBUTE_UNUSED; - unsigned long *file_cursor; -{ - unsigned int i; - unsigned int paddr = 0; - - for (i = SEG_E0; i < SEG_UNKNOWN; i++) - { - unsigned int offset = 0; - struct internal_scnhdr *s = &(segment_info[i].scnhdr); - - PROGRESS (1); - - if (s->s_name[0]) - { - fragS *frag = segment_info[i].frchainP->frch_root; - char *buffer = NULL; - - if (s->s_size == 0) - s->s_scnptr = 0; - else - { - buffer = xmalloc (s->s_size); - s->s_scnptr = *file_cursor; - } - know (s->s_paddr == paddr); - - if (strcmp (s->s_name, ".text") == 0) - s->s_flags |= STYP_TEXT; - else if (strcmp (s->s_name, ".data") == 0) - s->s_flags |= STYP_DATA; - else if (strcmp (s->s_name, ".bss") == 0) - { - s->s_scnptr = 0; - s->s_flags |= STYP_BSS; - - /* @@ Should make the i386 and a29k coff targets define - COFF_NOLOAD_PROBLEM, and have only one test here. */ -#ifndef TC_I386 -#ifndef TC_A29K -#ifndef TC_OR32 -#ifndef COFF_NOLOAD_PROBLEM - /* Apparently the SVR3 linker (and exec syscall) and UDI - mondfe progrem are confused by noload sections. */ - s->s_flags |= STYP_NOLOAD; -#endif -#endif -#endif -#endif - } - else if (strcmp (s->s_name, ".lit") == 0) - s->s_flags = STYP_LIT | STYP_TEXT; - else if (strcmp (s->s_name, ".init") == 0) - s->s_flags |= STYP_TEXT; - else if (strcmp (s->s_name, ".fini") == 0) - s->s_flags |= STYP_TEXT; - else if (strncmp (s->s_name, ".comment", 8) == 0) - s->s_flags |= STYP_INFO; - - while (frag) - { - unsigned int fill_size; - switch (frag->fr_type) - { - case rs_machine_dependent: - if (frag->fr_fix) - { - memcpy (buffer + frag->fr_address, - frag->fr_literal, - (unsigned int) frag->fr_fix); - offset += frag->fr_fix; - } - - break; - case rs_space: - case rs_fill: - case rs_align: - case rs_align_code: - case rs_align_test: - case rs_org: - if (frag->fr_fix) - { - memcpy (buffer + frag->fr_address, - frag->fr_literal, - (unsigned int) frag->fr_fix); - offset += frag->fr_fix; - } - - fill_size = frag->fr_var; - if (fill_size && frag->fr_offset > 0) - { - unsigned int count; - unsigned int off = frag->fr_fix; - for (count = frag->fr_offset; count; count--) - { - if (fill_size + frag->fr_address + off <= s->s_size) - { - memcpy (buffer + frag->fr_address + off, - frag->fr_literal + frag->fr_fix, - fill_size); - off += fill_size; - offset += fill_size; - } - } - } - break; - case rs_broken_word: - break; - default: - abort (); - } - frag = frag->fr_next; - } - - if (s->s_size != 0) - { - if (s->s_scnptr != 0) - { - bfd_bwrite (buffer, s->s_size, abfd); - *file_cursor += s->s_size; - } - free (buffer); - } - paddr += s->s_size; - } - } -} - -/* Coff file generation & utilities. */ - -static void -coff_header_append (abfd, h) - bfd * abfd; - object_headers * h; -{ - unsigned int i; - char buffer[1000]; - char buffero[1000]; -#ifdef COFF_LONG_SECTION_NAMES - unsigned long string_size = 4; -#endif - - bfd_seek (abfd, (file_ptr) 0, 0); - -#ifndef OBJ_COFF_OMIT_OPTIONAL_HEADER - H_SET_MAGIC_NUMBER (h, COFF_MAGIC); - H_SET_VERSION_STAMP (h, 0); - H_SET_ENTRY_POINT (h, 0); - H_SET_TEXT_START (h, segment_info[SEG_E0].frchainP->frch_root->fr_address); - H_SET_DATA_START (h, segment_info[SEG_E1].frchainP->frch_root->fr_address); - H_SET_SIZEOF_OPTIONAL_HEADER (h, bfd_coff_swap_aouthdr_out(abfd, &h->aouthdr, - buffero)); -#else /* defined (OBJ_COFF_OMIT_OPTIONAL_HEADER) */ - H_SET_SIZEOF_OPTIONAL_HEADER (h, 0); -#endif /* defined (OBJ_COFF_OMIT_OPTIONAL_HEADER) */ - - i = bfd_coff_swap_filehdr_out (abfd, &h->filehdr, buffer); - - bfd_bwrite (buffer, (bfd_size_type) i, abfd); - bfd_bwrite (buffero, (bfd_size_type) H_GET_SIZEOF_OPTIONAL_HEADER (h), abfd); - - for (i = SEG_E0; i < SEG_LAST; i++) - { - if (segment_info[i].scnhdr.s_name[0]) - { - unsigned int size; - -#ifdef COFF_LONG_SECTION_NAMES - /* Support long section names as found in PE. This code - must coordinate with that in write_object_file and - w_strings. */ - if (strlen (segment_info[i].name) > SCNNMLEN) - { - memset (segment_info[i].scnhdr.s_name, 0, SCNNMLEN); - sprintf (segment_info[i].scnhdr.s_name, "/%lu", string_size); - string_size += strlen (segment_info[i].name) + 1; - } -#endif - size = bfd_coff_swap_scnhdr_out (abfd, - &(segment_info[i].scnhdr), - buffer); - if (size == 0) - as_bad (_("bfd_coff_swap_scnhdr_out failed")); - bfd_bwrite (buffer, (bfd_size_type) size, abfd); - } - } -} - -char * -symbol_to_chars (abfd, where, symbolP) - bfd * abfd; - char *where; - symbolS * symbolP; -{ - unsigned int numaux = symbolP->sy_symbol.ost_entry.n_numaux; - unsigned int i; - valueT val; - - /* Turn any symbols with register attributes into abs symbols. */ - if (S_GET_SEGMENT (symbolP) == reg_section) - S_SET_SEGMENT (symbolP, absolute_section); - - /* At the same time, relocate all symbols to their output value. */ -#ifndef TE_PE - val = (segment_info[S_GET_SEGMENT (symbolP)].scnhdr.s_paddr - + S_GET_VALUE (symbolP)); -#else - val = S_GET_VALUE (symbolP); -#endif - - S_SET_VALUE (symbolP, val); - - symbolP->sy_symbol.ost_entry.n_value = val; - - where += bfd_coff_swap_sym_out (abfd, &symbolP->sy_symbol.ost_entry, - where); - - for (i = 0; i < numaux; i++) - { - where += bfd_coff_swap_aux_out (abfd, - &symbolP->sy_symbol.ost_auxent[i], - S_GET_DATA_TYPE (symbolP), - S_GET_STORAGE_CLASS (symbolP), - i, numaux, where); - } - - return where; -} - -void -coff_obj_symbol_new_hook (symbolP) - symbolS *symbolP; -{ - char underscore = 0; /* Symbol has leading _ */ - - /* Effective symbol. */ - /* Store the pointer in the offset. */ - S_SET_ZEROES (symbolP, 0L); - S_SET_DATA_TYPE (symbolP, T_NULL); - S_SET_STORAGE_CLASS (symbolP, 0); - S_SET_NUMBER_AUXILIARY (symbolP, 0); - /* Additional information. */ - symbolP->sy_symbol.ost_flags = 0; - /* Auxiliary entries. */ - memset ((char *) &symbolP->sy_symbol.ost_auxent[0], 0, AUXESZ); - - if (S_IS_STRING (symbolP)) - SF_SET_STRING (symbolP); - if (!underscore && S_IS_LOCAL (symbolP)) - SF_SET_LOCAL (symbolP); -} - -/* Handle .ln directives. */ - -static void -obj_coff_ln (appline) - int appline; -{ - int l; - - if (! appline && def_symbol_in_progress != NULL) - { - /* Wrong context. */ - as_warn (_(".ln pseudo-op inside .def/.endef: ignored.")); - demand_empty_rest_of_line (); - return; - } - - l = get_absolute_expression (); - c_line_new (0, frag_now_fix (), l, frag_now); - - if (appline) - new_logical_line ((char *) NULL, l - 1); - -#ifndef NO_LISTING - { - extern int listing; - - if (listing) - { - if (! appline) - l += line_base - 1; - listing_source_line ((unsigned int) l); - } - - } -#endif - demand_empty_rest_of_line (); -} - -/* Handle .def directives. - - One might ask : why can't we symbol_new if the symbol does not - already exist and fill it with debug information. Because of - the C_EFCN special symbol. It would clobber the value of the - function symbol before we have a chance to notice that it is - a C_EFCN. And a second reason is that the code is more clear this - way. (at least I think it is :-). */ - -#define SKIP_SEMI_COLON() while (*input_line_pointer++ != ';') -#define SKIP_WHITESPACES() while (*input_line_pointer == ' ' || \ - *input_line_pointer == '\t') \ - input_line_pointer++; - -static void -obj_coff_def (what) - int what ATTRIBUTE_UNUSED; -{ - char name_end; /* Char after the end of name. */ - char *symbol_name; /* Name of the debug symbol. */ - char *symbol_name_copy; /* Temporary copy of the name. */ - unsigned int symbol_name_length; - - if (def_symbol_in_progress != NULL) - { - as_warn (_(".def pseudo-op used inside of .def/.endef: ignored.")); - demand_empty_rest_of_line (); - return; - } - - SKIP_WHITESPACES (); - - def_symbol_in_progress = (symbolS *) obstack_alloc (¬es, sizeof (*def_symbol_in_progress)); - memset (def_symbol_in_progress, 0, sizeof (*def_symbol_in_progress)); - - symbol_name = input_line_pointer; - name_end = get_symbol_end (); - symbol_name_length = strlen (symbol_name); - symbol_name_copy = xmalloc (symbol_name_length + 1); - strcpy (symbol_name_copy, symbol_name); -#ifdef tc_canonicalize_symbol_name - symbol_name_copy = tc_canonicalize_symbol_name (symbol_name_copy); -#endif - - /* Initialize the new symbol. */ -#ifdef STRIP_UNDERSCORE - S_SET_NAME (def_symbol_in_progress, (*symbol_name_copy == '_' - ? symbol_name_copy + 1 - : symbol_name_copy)); -#else /* STRIP_UNDERSCORE */ - S_SET_NAME (def_symbol_in_progress, symbol_name_copy); -#endif /* STRIP_UNDERSCORE */ - /* free(symbol_name_copy); */ - def_symbol_in_progress->sy_name_offset = (unsigned long) ~0; - def_symbol_in_progress->sy_number = ~0; - def_symbol_in_progress->sy_frag = &zero_address_frag; - S_SET_VALUE (def_symbol_in_progress, 0); - - if (S_IS_STRING (def_symbol_in_progress)) - SF_SET_STRING (def_symbol_in_progress); - - *input_line_pointer = name_end; - - demand_empty_rest_of_line (); -} - -unsigned int dim_index; - -static void -obj_coff_endef (ignore) - int ignore ATTRIBUTE_UNUSED; -{ - symbolS *symbolP = 0; - /* DIM BUG FIX sac@cygnus.com */ - dim_index = 0; - if (def_symbol_in_progress == NULL) - { - as_warn (_(".endef pseudo-op used outside of .def/.endef: ignored.")); - demand_empty_rest_of_line (); - return; - } - - /* Set the section number according to storage class. */ - switch (S_GET_STORAGE_CLASS (def_symbol_in_progress)) - { - case C_STRTAG: - case C_ENTAG: - case C_UNTAG: - SF_SET_TAG (def_symbol_in_progress); - /* Intentional fallthrough. */ - - case C_FILE: - case C_TPDEF: - SF_SET_DEBUG (def_symbol_in_progress); - S_SET_SEGMENT (def_symbol_in_progress, SEG_DEBUG); - break; - - case C_EFCN: - /* Do not emit this symbol. */ - SF_SET_LOCAL (def_symbol_in_progress); - /* Intentional fallthrough. */ - - case C_BLOCK: - /* Will need processing before writing. */ - SF_SET_PROCESS (def_symbol_in_progress); - /* Intentional fallthrough. */ - - case C_FCN: - S_SET_SEGMENT (def_symbol_in_progress, SEG_E0); - - if (strcmp (S_GET_NAME (def_symbol_in_progress), ".bf") == 0) - { /* .bf */ - if (function_lineoff < 0) - fprintf (stderr, _("`.bf' symbol without preceding function\n")); - - SA_GET_SYM_LNNOPTR (last_line_symbol) = function_lineoff; - - SF_SET_PROCESS (last_line_symbol); - SF_SET_ADJ_LNNOPTR (last_line_symbol); - SF_SET_PROCESS (def_symbol_in_progress); - function_lineoff = -1; - } - - /* Value is always set to . */ - def_symbol_in_progress->sy_frag = frag_now; - S_SET_VALUE (def_symbol_in_progress, (valueT) frag_now_fix ()); - break; - -#ifdef C_AUTOARG - case C_AUTOARG: -#endif /* C_AUTOARG */ - case C_AUTO: - case C_REG: - case C_MOS: - case C_MOE: - case C_MOU: - case C_ARG: - case C_REGPARM: - case C_FIELD: - case C_EOS: - SF_SET_DEBUG (def_symbol_in_progress); - S_SET_SEGMENT (def_symbol_in_progress, absolute_section); - break; - - case C_EXT: - case C_WEAKEXT: -#ifdef TE_PE - case C_NT_WEAK: -#endif - case C_STAT: - case C_LABEL: - /* Valid but set somewhere else (s_comm, s_lcomm, colon). */ - break; - - case C_USTATIC: - case C_EXTDEF: - case C_ULABEL: - as_warn (_("unexpected storage class %d"), S_GET_STORAGE_CLASS (def_symbol_in_progress)); - break; - } - - /* Now that we have built a debug symbol, try to find if we should - merge with an existing symbol or not. If a symbol is C_EFCN or - absolute_section or untagged SEG_DEBUG it never merges. We also - don't merge labels, which are in a different namespace, nor - symbols which have not yet been defined since they are typically - unique, nor do we merge tags with non-tags. */ - - /* Two cases for functions. Either debug followed by definition or - definition followed by debug. For definition first, we will - merge the debug symbol into the definition. For debug first, the - lineno entry MUST point to the definition function or else it - will point off into space when crawl_symbols() merges the debug - symbol into the real symbol. Therefor, let's presume the debug - symbol is a real function reference. */ - - /* FIXME-SOON If for some reason the definition label/symbol is - never seen, this will probably leave an undefined symbol at link - time. */ - - if (S_GET_STORAGE_CLASS (def_symbol_in_progress) == C_EFCN - || S_GET_STORAGE_CLASS (def_symbol_in_progress) == C_LABEL - || (S_GET_SEGMENT (def_symbol_in_progress) == SEG_DEBUG - && !SF_GET_TAG (def_symbol_in_progress)) - || S_GET_SEGMENT (def_symbol_in_progress) == absolute_section - || def_symbol_in_progress->sy_value.X_op != O_constant - || (symbolP = symbol_find_base (S_GET_NAME (def_symbol_in_progress), DO_NOT_STRIP)) == NULL - || (SF_GET_TAG (def_symbol_in_progress) != SF_GET_TAG (symbolP))) - { - symbol_append (def_symbol_in_progress, symbol_lastP, &symbol_rootP, - &symbol_lastP); - } - else - { - /* This symbol already exists, merge the newly created symbol - into the old one. This is not mandatory. The linker can - handle duplicate symbols correctly. But I guess that it save - a *lot* of space if the assembly file defines a lot of - symbols. [loic] */ - - /* The debug entry (def_symbol_in_progress) is merged into the - previous definition. */ - - c_symbol_merge (def_symbol_in_progress, symbolP); - /* FIXME-SOON Should *def_symbol_in_progress be free'd? xoxorich. */ - def_symbol_in_progress = symbolP; - - if (SF_GET_FUNCTION (def_symbol_in_progress) - || SF_GET_TAG (def_symbol_in_progress) - || S_GET_STORAGE_CLASS (def_symbol_in_progress) == C_STAT) - { - /* For functions, and tags, and static symbols, the symbol - *must* be where the debug symbol appears. Move the - existing symbol to the current place. */ - /* If it already is at the end of the symbol list, do nothing. */ - if (def_symbol_in_progress != symbol_lastP) - { - symbol_remove (def_symbol_in_progress, &symbol_rootP, - &symbol_lastP); - symbol_append (def_symbol_in_progress, symbol_lastP, - &symbol_rootP, &symbol_lastP); - } - } - } - - if (SF_GET_TAG (def_symbol_in_progress)) - { - symbolS *oldtag; - - oldtag = symbol_find_base (S_GET_NAME (def_symbol_in_progress), - DO_NOT_STRIP); - if (oldtag == NULL || ! SF_GET_TAG (oldtag)) - tag_insert (S_GET_NAME (def_symbol_in_progress), - def_symbol_in_progress); - } - - if (SF_GET_FUNCTION (def_symbol_in_progress)) - { - know (sizeof (def_symbol_in_progress) <= sizeof (long)); - function_lineoff - = c_line_new (def_symbol_in_progress, 0, 0, &zero_address_frag); - - SF_SET_PROCESS (def_symbol_in_progress); - - if (symbolP == NULL) - { - /* That is, if this is the first time we've seen the - function... */ - symbol_table_insert (def_symbol_in_progress); - } - } - - def_symbol_in_progress = NULL; - demand_empty_rest_of_line (); -} - -static void -obj_coff_dim (ignore) - int ignore ATTRIBUTE_UNUSED; -{ - int dim_index; - - if (def_symbol_in_progress == NULL) - { - as_warn (_(".dim pseudo-op used outside of .def/.endef: ignored.")); - demand_empty_rest_of_line (); - return; - } - - S_SET_NUMBER_AUXILIARY (def_symbol_in_progress, 1); - - for (dim_index = 0; dim_index < DIMNUM; dim_index++) - { - SKIP_WHITESPACES (); - SA_SET_SYM_DIMEN (def_symbol_in_progress, dim_index, - get_absolute_expression ()); - - switch (*input_line_pointer) - { - case ',': - input_line_pointer++; - break; - - default: - as_warn (_("badly formed .dim directive ignored")); - /* Intentional fallthrough. */ - - case '\n': - case ';': - dim_index = DIMNUM; - break; - } - } - - demand_empty_rest_of_line (); -} - -static void -obj_coff_line (ignore) - int ignore ATTRIBUTE_UNUSED; -{ - int this_base; - const char *name; - - if (def_symbol_in_progress == NULL) - { - obj_coff_ln (0); - return; - } - - name = S_GET_NAME (def_symbol_in_progress); - this_base = get_absolute_expression (); - - /* Only .bf symbols indicate the use of a new base line number; the - line numbers associated with .ef, .bb, .eb are relative to the - start of the containing function. */ - if (!strcmp (".bf", name)) - { -#if 0 /* XXX Can we ever have line numbers going backwards? */ - if (this_base > line_base) -#endif - line_base = this_base; - -#ifndef NO_LISTING - { - extern int listing; - if (listing) - listing_source_line ((unsigned int) line_base); - } -#endif - } - - S_SET_NUMBER_AUXILIARY (def_symbol_in_progress, 1); - SA_SET_SYM_LNNO (def_symbol_in_progress, this_base); - - demand_empty_rest_of_line (); -} - -static void -obj_coff_size (ignore) - int ignore ATTRIBUTE_UNUSED; -{ - if (def_symbol_in_progress == NULL) - { - as_warn (_(".size pseudo-op used outside of .def/.endef ignored.")); - demand_empty_rest_of_line (); - return; - } - - S_SET_NUMBER_AUXILIARY (def_symbol_in_progress, 1); - SA_SET_SYM_SIZE (def_symbol_in_progress, get_absolute_expression ()); - demand_empty_rest_of_line (); -} - -static void -obj_coff_scl (ignore) - int ignore ATTRIBUTE_UNUSED; -{ - if (def_symbol_in_progress == NULL) - { - as_warn (_(".scl pseudo-op used outside of .def/.endef ignored.")); - demand_empty_rest_of_line (); - return; - } - - S_SET_STORAGE_CLASS (def_symbol_in_progress, get_absolute_expression ()); - demand_empty_rest_of_line (); -} - -static void -obj_coff_tag (ignore) - int ignore ATTRIBUTE_UNUSED; -{ - char *symbol_name; - char name_end; - - if (def_symbol_in_progress == NULL) - { - as_warn (_(".tag pseudo-op used outside of .def/.endef ignored.")); - demand_empty_rest_of_line (); - return; - } - - S_SET_NUMBER_AUXILIARY (def_symbol_in_progress, 1); - symbol_name = input_line_pointer; - name_end = get_symbol_end (); -#ifdef tc_canonicalize_symbol_name - symbol_name = tc_canonicalize_symbol_name (symbol_name); -#endif - - /* Assume that the symbol referred to by .tag is always defined. - This was a bad assumption. I've added find_or_make. xoxorich. */ - SA_SET_SYM_TAGNDX (def_symbol_in_progress, - (long) tag_find_or_make (symbol_name)); - if (SA_GET_SYM_TAGNDX (def_symbol_in_progress) == 0L) - as_warn (_("tag not found for .tag %s"), symbol_name); - - SF_SET_TAGGED (def_symbol_in_progress); - *input_line_pointer = name_end; - - demand_empty_rest_of_line (); -} - -static void -obj_coff_type (ignore) - int ignore ATTRIBUTE_UNUSED; -{ - if (def_symbol_in_progress == NULL) - { - as_warn (_(".type pseudo-op used outside of .def/.endef ignored.")); - demand_empty_rest_of_line (); - return; - } - - S_SET_DATA_TYPE (def_symbol_in_progress, get_absolute_expression ()); - - if (ISFCN (S_GET_DATA_TYPE (def_symbol_in_progress)) && - S_GET_STORAGE_CLASS (def_symbol_in_progress) != C_TPDEF) - SF_SET_FUNCTION (def_symbol_in_progress); - - demand_empty_rest_of_line (); -} - -static void -obj_coff_val (ignore) - int ignore ATTRIBUTE_UNUSED; -{ - if (def_symbol_in_progress == NULL) - { - as_warn (_(".val pseudo-op used outside of .def/.endef ignored.")); - demand_empty_rest_of_line (); - return; - } - - if (is_name_beginner (*input_line_pointer)) - { - char *symbol_name = input_line_pointer; - char name_end = get_symbol_end (); - -#ifdef tc_canonicalize_symbol_name - symbol_name = tc_canonicalize_symbol_name (symbol_name); -#endif - - if (!strcmp (symbol_name, ".")) - { - def_symbol_in_progress->sy_frag = frag_now; - S_SET_VALUE (def_symbol_in_progress, (valueT) frag_now_fix ()); - /* If the .val is != from the .def (e.g. statics). */ - } - else if (strcmp (S_GET_NAME (def_symbol_in_progress), symbol_name)) - { - def_symbol_in_progress->sy_value.X_op = O_symbol; - def_symbol_in_progress->sy_value.X_add_symbol = - symbol_find_or_make (symbol_name); - def_symbol_in_progress->sy_value.X_op_symbol = NULL; - def_symbol_in_progress->sy_value.X_add_number = 0; - - /* If the segment is undefined when the forward reference is - resolved, then copy the segment id from the forward - symbol. */ - SF_SET_GET_SEGMENT (def_symbol_in_progress); - - /* FIXME: gcc can generate address expressions here in - unusual cases (search for "obscure" in sdbout.c). We - just ignore the offset here, thus generating incorrect - debugging information. We ignore the rest of the line - just below. */ - } - /* Otherwise, it is the name of a non debug symbol and - its value will be calculated later. */ - *input_line_pointer = name_end; - - /* FIXME: this is to avoid an error message in the - FIXME case mentioned just above. */ - while (! is_end_of_line[(unsigned char) *input_line_pointer]) - ++input_line_pointer; - } - else - { - S_SET_VALUE (def_symbol_in_progress, - (valueT) get_absolute_expression ()); - } /* if symbol based */ - - demand_empty_rest_of_line (); -} - -#ifdef TE_PE - -/* Handle the .linkonce pseudo-op. This is parsed by s_linkonce in - read.c, which then calls this object file format specific routine. */ - -void -obj_coff_pe_handle_link_once (type) - enum linkonce_type type; -{ - seg_info (now_seg)->scnhdr.s_flags |= IMAGE_SCN_LNK_COMDAT; - - /* We store the type in the seg_info structure, and use it to set up - the auxiliary entry for the section symbol in c_section_symbol. */ - seg_info (now_seg)->linkonce = type; -} - -#endif /* TE_PE */ - -void -coff_obj_read_begin_hook () -{ - /* These had better be the same. Usually 18 bytes. */ -#ifndef BFD_HEADERS - know (sizeof (SYMENT) == sizeof (AUXENT)); - know (SYMESZ == AUXESZ); -#endif - tag_init (); -} - -/* This function runs through the symbol table and puts all the - externals onto another chain. */ - -/* The chain of globals. */ -symbolS *symbol_globalP; -symbolS *symbol_global_lastP; - -/* The chain of externals. */ -symbolS *symbol_externP; -symbolS *symbol_extern_lastP; - -stack *block_stack; -symbolS *last_functionP; -static symbolS *last_bfP; -symbolS *last_tagP; - -static unsigned int -yank_symbols () -{ - symbolS *symbolP; - unsigned int symbol_number = 0; - unsigned int last_file_symno = 0; - - struct filename_list *filename_list_scan = filename_list_head; - - for (symbolP = symbol_rootP; - symbolP; - symbolP = symbolP ? symbol_next (symbolP) : symbol_rootP) - { - if (symbolP->sy_mri_common) - { - if (S_GET_STORAGE_CLASS (symbolP) == C_EXT -#ifdef TE_PE - || S_GET_STORAGE_CLASS (symbolP) == C_NT_WEAK -#endif - || S_GET_STORAGE_CLASS (symbolP) == C_WEAKEXT) - as_bad (_("%s: global symbols not supported in common sections"), - S_GET_NAME (symbolP)); - symbol_remove (symbolP, &symbol_rootP, &symbol_lastP); - continue; - } - - if (!SF_GET_DEBUG (symbolP)) - { - /* Debug symbols do not need all this rubbish. */ - symbolS *real_symbolP; - - /* L* and C_EFCN symbols never merge. */ - if (!SF_GET_LOCAL (symbolP) - && !SF_GET_STATICS (symbolP) - && S_GET_STORAGE_CLASS (symbolP) != C_LABEL - && symbolP->sy_value.X_op == O_constant - && (real_symbolP = symbol_find_base (S_GET_NAME (symbolP), DO_NOT_STRIP)) - && real_symbolP != symbolP) - { - /* FIXME-SOON: where do dups come from? - Maybe tag references before definitions? xoxorich. */ - /* Move the debug data from the debug symbol to the - real symbol. Do NOT do the opposite (i.e. move from - real symbol to debug symbol and remove real symbol from the - list.) Because some pointers refer to the real symbol - whereas no pointers refer to the debug symbol. */ - c_symbol_merge (symbolP, real_symbolP); - /* Replace the current symbol by the real one. */ - /* The symbols will never be the last or the first - because : 1st symbol is .file and 3 last symbols are - .text, .data, .bss. */ - symbol_remove (real_symbolP, &symbol_rootP, &symbol_lastP); - symbol_insert (real_symbolP, symbolP, &symbol_rootP, &symbol_lastP); - symbol_remove (symbolP, &symbol_rootP, &symbol_lastP); - symbolP = real_symbolP; - } - - if (flag_readonly_data_in_text && (S_GET_SEGMENT (symbolP) == SEG_E1)) - S_SET_SEGMENT (symbolP, SEG_E0); - - resolve_symbol_value (symbolP); - - if (S_GET_STORAGE_CLASS (symbolP) == C_NULL) - { - if (!S_IS_DEFINED (symbolP) && !SF_GET_LOCAL (symbolP)) - { - S_SET_EXTERNAL (symbolP); - } - - else if (S_GET_SEGMENT (symbolP) == SEG_E0) - S_SET_STORAGE_CLASS (symbolP, C_LABEL); - - else - S_SET_STORAGE_CLASS (symbolP, C_STAT); - } - - /* Mainly to speed up if not -g. */ - if (SF_GET_PROCESS (symbolP)) - { - /* Handle the nested blocks auxiliary info. */ - if (S_GET_STORAGE_CLASS (symbolP) == C_BLOCK) - { - if (!strcmp (S_GET_NAME (symbolP), ".bb")) - stack_push (block_stack, (char *) &symbolP); - else - { - /* .eb */ - symbolS *begin_symbolP; - - begin_symbolP = *(symbolS **) stack_pop (block_stack); - if (begin_symbolP == (symbolS *) 0) - as_warn (_("mismatched .eb")); - else - SA_SET_SYM_ENDNDX (begin_symbolP, symbol_number + 2); - } - } - /* If we are able to identify the type of a function, and we - are out of a function (last_functionP == 0) then, the - function symbol will be associated with an auxiliary - entry. */ - if (last_functionP == (symbolS *) 0 && - SF_GET_FUNCTION (symbolP)) - { - last_functionP = symbolP; - - if (S_GET_NUMBER_AUXILIARY (symbolP) < 1) - S_SET_NUMBER_AUXILIARY (symbolP, 1); - - /* Clobber possible stale .dim information. */ -#if 0 - /* Iffed out by steve - this fries the lnnoptr info too. */ - bzero (symbolP->sy_symbol.ost_auxent[0].x_sym.x_fcnary.x_ary.x_dimen, - sizeof (symbolP->sy_symbol.ost_auxent[0].x_sym.x_fcnary.x_ary.x_dimen)); -#endif - } - if (S_GET_STORAGE_CLASS (symbolP) == C_FCN) - { - if (strcmp (S_GET_NAME (symbolP), ".bf") == 0) - { - if (last_bfP != NULL) - SA_SET_SYM_ENDNDX (last_bfP, symbol_number); - last_bfP = symbolP; - } - } - else if (S_GET_STORAGE_CLASS (symbolP) == C_EFCN) - { - /* I don't even know if this is needed for sdb. But - the standard assembler generates it, so... */ - if (last_functionP == (symbolS *) 0) - as_fatal (_("C_EFCN symbol out of scope")); - SA_SET_SYM_FSIZE (last_functionP, - (long) (S_GET_VALUE (symbolP) - - S_GET_VALUE (last_functionP))); - SA_SET_SYM_ENDNDX (last_functionP, symbol_number); - last_functionP = (symbolS *) 0; - } - } - } - else if (SF_GET_TAG (symbolP)) - { - /* First descriptor of a structure must point to - the first slot after the structure description. */ - last_tagP = symbolP; - - } - else if (S_GET_STORAGE_CLASS (symbolP) == C_EOS) - { - /* +2 take in account the current symbol. */ - SA_SET_SYM_ENDNDX (last_tagP, symbol_number + 2); - } - else if (S_GET_STORAGE_CLASS (symbolP) == C_FILE) - { - /* If the filename was too long to fit in the - auxent, put it in the string table. */ - if (SA_GET_FILE_FNAME_ZEROS (symbolP) == 0 - && SA_GET_FILE_FNAME_OFFSET (symbolP) != 0) - { - SA_SET_FILE_FNAME_OFFSET (symbolP, string_byte_count); - string_byte_count += strlen (filename_list_scan->filename) + 1; - filename_list_scan = filename_list_scan->next; - } - if (S_GET_VALUE (symbolP)) - { - S_SET_VALUE (symbolP, last_file_symno); - last_file_symno = symbol_number; - } - } - -#ifdef tc_frob_coff_symbol - tc_frob_coff_symbol (symbolP); -#endif - - /* We must put the external symbols apart. The loader - does not bomb if we do not. But the references in - the endndx field for a .bb symbol are not corrected - if an external symbol is removed between .bb and .be. - I.e in the following case : - [20] .bb endndx = 22 - [21] foo external - [22] .be - ld will move the symbol 21 to the end of the list but - endndx will still be 22 instead of 21. */ - - if (SF_GET_LOCAL (symbolP)) - { - /* Remove C_EFCN and LOCAL (L...) symbols. */ - /* Next pointer remains valid. */ - symbol_remove (symbolP, &symbol_rootP, &symbol_lastP); - - } - else if (symbolP->sy_value.X_op == O_symbol - && (! S_IS_DEFINED (symbolP) || S_IS_COMMON (symbolP))) - { - /* Skip symbols which were equated to undefined or common - symbols. */ - symbol_remove (symbolP, &symbol_rootP, &symbol_lastP); - } - else if (!S_IS_DEFINED (symbolP) - && !S_IS_DEBUG (symbolP) - && !SF_GET_STATICS (symbolP) - && (S_GET_STORAGE_CLASS (symbolP) == C_EXT -#ifdef TE_PE - || S_GET_STORAGE_CLASS (symbolP) == C_NT_WEAK -#endif - || S_GET_STORAGE_CLASS (symbolP) == C_WEAKEXT)) - { - /* If external, Remove from the list. */ - symbolS *hold = symbol_previous (symbolP); - - symbol_remove (symbolP, &symbol_rootP, &symbol_lastP); - symbol_clear_list_pointers (symbolP); - symbol_append (symbolP, symbol_extern_lastP, &symbol_externP, &symbol_extern_lastP); - symbolP = hold; - } - else if (! S_IS_DEBUG (symbolP) - && ! SF_GET_STATICS (symbolP) - && ! SF_GET_FUNCTION (symbolP) - && (S_GET_STORAGE_CLASS (symbolP) == C_EXT -#ifdef TE_PE - || S_GET_STORAGE_CLASS (symbolP) == C_NT_WEAK -#endif - || S_GET_STORAGE_CLASS (symbolP) == C_NT_WEAK)) - { - symbolS *hold = symbol_previous (symbolP); - - /* The O'Reilly COFF book says that defined global symbols - come at the end of the symbol table, just before - undefined global symbols. */ - symbol_remove (symbolP, &symbol_rootP, &symbol_lastP); - symbol_clear_list_pointers (symbolP); - symbol_append (symbolP, symbol_global_lastP, &symbol_globalP, - &symbol_global_lastP); - symbolP = hold; - } - else - { - if (SF_GET_STRING (symbolP)) - { - symbolP->sy_name_offset = string_byte_count; - string_byte_count += strlen (S_GET_NAME (symbolP)) + 1; - } - else - { - symbolP->sy_name_offset = 0; - } - - symbolP->sy_number = symbol_number; - symbol_number += 1 + S_GET_NUMBER_AUXILIARY (symbolP); - } - } - - return symbol_number; -} - -static unsigned int -glue_symbols (head, tail) - symbolS **head; - symbolS **tail; -{ - unsigned int symbol_number = 0; - - while (*head != NULL) - { - symbolS *tmp = *head; - - /* Append. */ - symbol_remove (tmp, head, tail); - symbol_append (tmp, symbol_lastP, &symbol_rootP, &symbol_lastP); - - /* Process. */ - if (SF_GET_STRING (tmp)) - { - tmp->sy_name_offset = string_byte_count; - string_byte_count += strlen (S_GET_NAME (tmp)) + 1; - } - else - { - /* Fix "long" names. */ - tmp->sy_name_offset = 0; - } - - tmp->sy_number = symbol_number; - symbol_number += 1 + S_GET_NUMBER_AUXILIARY (tmp); - } - - return symbol_number; -} - -static unsigned int -tie_tags () -{ - unsigned int symbol_number = 0; - symbolS *symbolP; - - for (symbolP = symbol_rootP; symbolP; symbolP = symbol_next (symbolP)) - { - symbolP->sy_number = symbol_number; - - if (SF_GET_TAGGED (symbolP)) - { - SA_SET_SYM_TAGNDX - (symbolP, - ((symbolS *) SA_GET_SYM_TAGNDX (symbolP))->sy_number); - } - - symbol_number += 1 + S_GET_NUMBER_AUXILIARY (symbolP); - } - - return symbol_number; -} - - -static void -crawl_symbols (h, abfd) - object_headers *h; - bfd *abfd ATTRIBUTE_UNUSED; -{ - unsigned int i; - - /* Initialize the stack used to keep track of the matching .bb .be. */ - - block_stack = stack_init (512, sizeof (symbolS *)); - - /* The symbol list should be ordered according to the following sequence - order : - . .file symbol - . debug entries for functions - . fake symbols for the sections, including .text .data and .bss - . defined symbols - . undefined symbols - But this is not mandatory. The only important point is to put the - undefined symbols at the end of the list. */ - - /* Is there a .file symbol ? If not insert one at the beginning. */ - if (symbol_rootP == NULL - || S_GET_STORAGE_CLASS (symbol_rootP) != C_FILE) - c_dot_file_symbol ("fake"); - - /* Build up static symbols for the sections, they are filled in later. */ - - for (i = SEG_E0; i < SEG_LAST; i++) - if (segment_info[i].scnhdr.s_name[0]) - segment_info[i].dot = c_section_symbol ((char *) segment_info[i].name, - i - SEG_E0 + 1); - - /* Take all the externals out and put them into another chain. */ - H_SET_SYMBOL_TABLE_SIZE (h, yank_symbols ()); - /* Take the externals and glue them onto the end. */ - H_SET_SYMBOL_TABLE_SIZE (h, - (H_GET_SYMBOL_COUNT (h) - + glue_symbols (&symbol_globalP, - &symbol_global_lastP) - + glue_symbols (&symbol_externP, - &symbol_extern_lastP))); - - H_SET_SYMBOL_TABLE_SIZE (h, tie_tags ()); - know (symbol_globalP == NULL); - know (symbol_global_lastP == NULL); - know (symbol_externP == NULL); - know (symbol_extern_lastP == NULL); -} - -/* Find strings by crawling along symbol table chain. */ - -void -w_strings (where) - char *where; -{ - symbolS *symbolP; - struct filename_list *filename_list_scan = filename_list_head; - - /* Gotta do md_ byte-ordering stuff for string_byte_count first - KWK. */ - md_number_to_chars (where, (valueT) string_byte_count, 4); - where += 4; - -#ifdef COFF_LONG_SECTION_NAMES - /* Support long section names as found in PE. This code must - coordinate with that in coff_header_append and write_object_file. */ - { - unsigned int i; - - for (i = SEG_E0; i < SEG_LAST; i++) - { - if (segment_info[i].scnhdr.s_name[0] - && strlen (segment_info[i].name) > SCNNMLEN) - { - unsigned int size; - - size = strlen (segment_info[i].name) + 1; - memcpy (where, segment_info[i].name, size); - where += size; - } - } - } -#endif /* COFF_LONG_SECTION_NAMES */ - - for (symbolP = symbol_rootP; - symbolP; - symbolP = symbol_next (symbolP)) - { - unsigned int size; - - if (SF_GET_STRING (symbolP)) - { - size = strlen (S_GET_NAME (symbolP)) + 1; - memcpy (where, S_GET_NAME (symbolP), size); - where += size; - } - if (S_GET_STORAGE_CLASS (symbolP) == C_FILE - && SA_GET_FILE_FNAME_ZEROS (symbolP) == 0 - && SA_GET_FILE_FNAME_OFFSET (symbolP) != 0) - { - size = strlen (filename_list_scan->filename) + 1; - memcpy (where, filename_list_scan->filename, size); - filename_list_scan = filename_list_scan ->next; - where += size; - } - } -} - -static void -do_linenos_for (abfd, h, file_cursor) - bfd * abfd; - object_headers * h; - unsigned long *file_cursor; -{ - unsigned int idx; - unsigned long start = *file_cursor; - - for (idx = SEG_E0; idx < SEG_LAST; idx++) - { - segment_info_type *s = segment_info + idx; - - if (s->scnhdr.s_nlnno != 0) - { - struct lineno_list *line_ptr; - - struct external_lineno *buffer = - (struct external_lineno *) xmalloc (s->scnhdr.s_nlnno * LINESZ); - - struct external_lineno *dst = buffer; - - /* Run through the table we've built and turn it into its external - form, take this chance to remove duplicates. */ - - for (line_ptr = s->lineno_list_head; - line_ptr != (struct lineno_list *) NULL; - line_ptr = line_ptr->next) - { - if (line_ptr->line.l_lnno == 0) - { - /* Turn a pointer to a symbol into the symbols' index, - provided that it has been initialised. */ - if (line_ptr->line.l_addr.l_symndx) - line_ptr->line.l_addr.l_symndx = - ((symbolS *) line_ptr->line.l_addr.l_symndx)->sy_number; - } - else - line_ptr->line.l_addr.l_paddr += ((struct frag *) (line_ptr->frag))->fr_address; - - (void) bfd_coff_swap_lineno_out (abfd, &(line_ptr->line), dst); - dst++; - } - - s->scnhdr.s_lnnoptr = *file_cursor; - - bfd_bwrite (buffer, (bfd_size_type) s->scnhdr.s_nlnno * LINESZ, abfd); - free (buffer); - - *file_cursor += s->scnhdr.s_nlnno * LINESZ; - } - } - - H_SET_LINENO_SIZE (h, *file_cursor - start); -} - -/* Now we run through the list of frag chains in a segment and - make all the subsegment frags appear at the end of the - list, as if the seg 0 was extra long. */ - -static void -remove_subsegs () -{ - unsigned int i; - - for (i = SEG_E0; i < SEG_UNKNOWN; i++) - { - frchainS *head = segment_info[i].frchainP; - fragS dummy; - fragS *prev_frag = &dummy; - - while (head && head->frch_seg == i) - { - prev_frag->fr_next = head->frch_root; - prev_frag = head->frch_last; - head = head->frch_next; - } - prev_frag->fr_next = 0; - } -} - -unsigned long machine; -int coff_flags; - -#ifndef SUB_SEGMENT_ALIGN -#ifdef HANDLE_ALIGN -/* The last subsegment gets an alignment corresponding to the alignment - of the section. This allows proper nop-filling at the end of - code-bearing sections. */ -#define SUB_SEGMENT_ALIGN(SEG, FRCHAIN) \ - (!(FRCHAIN)->frch_next || (FRCHAIN)->frch_next->frch_seg != (SEG) \ - ? get_recorded_alignment (SEG) : 0) -#else -#define SUB_SEGMENT_ALIGN(SEG, FRCHAIN) 1 -#endif -#endif - -extern void -write_object_file () -{ - int i; - const char *name; - struct frchain *frchain_ptr; - - object_headers headers; - unsigned long file_cursor; - bfd *abfd; - unsigned int addr; - abfd = bfd_openw (out_file_name, TARGET_FORMAT); - - if (abfd == 0) - { - as_perror (_("FATAL: Can't create %s"), out_file_name); - exit (EXIT_FAILURE); - } - bfd_set_format (abfd, bfd_object); - bfd_set_arch_mach (abfd, BFD_ARCH, machine); - - string_byte_count = 4; - - /* Run through all the sub-segments and align them up. Also - close any open frags. We tack a .fill onto the end of the - frag chain so that any .align's size can be worked by looking - at the next frag. */ - for (frchain_ptr = frchain_root; - frchain_ptr != (struct frchain *) NULL; - frchain_ptr = frchain_ptr->frch_next) - { - int alignment; - - subseg_set (frchain_ptr->frch_seg, frchain_ptr->frch_subseg); - - alignment = SUB_SEGMENT_ALIGN (now_seg, frchain_ptr); - -#ifdef md_do_align - md_do_align (alignment, (char *) NULL, 0, 0, alignment_done); -#endif - if (subseg_text_p (now_seg)) - frag_align_code (alignment, 0); - else - frag_align (alignment, 0, 0); - -#ifdef md_do_align - alignment_done: -#endif - - frag_wane (frag_now); - frag_now->fr_fix = 0; - know (frag_now->fr_next == NULL); - } - - remove_subsegs (); - - for (i = SEG_E0; i < SEG_UNKNOWN; i++) - relax_segment (segment_info[i].frchainP->frch_root, i); - - /* Relaxation has completed. Freeze all syms. */ - finalize_syms = 1; - - H_SET_NUMBER_OF_SECTIONS (&headers, 0); - - /* Find out how big the sections are, and set the addresses. */ - addr = 0; - for (i = SEG_E0; i < SEG_UNKNOWN; i++) - { - long size; - - segment_info[i].scnhdr.s_paddr = addr; - segment_info[i].scnhdr.s_vaddr = addr; - - if (segment_info[i].scnhdr.s_name[0]) - { - H_SET_NUMBER_OF_SECTIONS (&headers, - H_GET_NUMBER_OF_SECTIONS (&headers) + 1); - -#ifdef COFF_LONG_SECTION_NAMES - /* Support long section names as found in PE. This code - must coordinate with that in coff_header_append and - w_strings. */ - { - unsigned int len; - - len = strlen (segment_info[i].name); - if (len > SCNNMLEN) - string_byte_count += len + 1; - } -#endif /* COFF_LONG_SECTION_NAMES */ - } - - size = size_section (abfd, (unsigned int) i); - addr += size; - - /* I think the section alignment is only used on the i960; the - i960 needs it, and it should do no harm on other targets. */ -#ifdef ALIGNMENT_IN_S_FLAGS - segment_info[i].scnhdr.s_flags |= (section_alignment[i] & 0xF) << 8; -#else - segment_info[i].scnhdr.s_align = 1 << section_alignment[i]; -#endif - - if (i == SEG_E0) - H_SET_TEXT_SIZE (&headers, size); - else if (i == SEG_E1) - H_SET_DATA_SIZE (&headers, size); - else if (i == SEG_E2) - H_SET_BSS_SIZE (&headers, size); - } - - /* Turn the gas native symbol table shape into a coff symbol table. */ - crawl_symbols (&headers, abfd); - - if (string_byte_count == 4) - string_byte_count = 0; - - H_SET_STRING_SIZE (&headers, string_byte_count); - -#ifdef tc_frob_file - tc_frob_file (); -#endif - - for (i = SEG_E0; i < SEG_UNKNOWN; i++) - { - fixup_mdeps (segment_info[i].frchainP->frch_root, &headers, i); - fixup_segment (&segment_info[i], i); - } - - /* Look for ".stab" segments and fill in their initial symbols - correctly. */ - for (i = SEG_E0; i < SEG_UNKNOWN; i++) - { - name = segment_info[i].name; - - if (name != NULL - && strncmp (".stab", name, 5) == 0 - && strncmp (".stabstr", name, 8) != 0) - adjust_stab_section (abfd, i); - } - - file_cursor = H_GET_TEXT_FILE_OFFSET (&headers); - - bfd_seek (abfd, (file_ptr) file_cursor, 0); - - /* Plant the data. */ - fill_section (abfd, &headers, &file_cursor); - - do_relocs_for (abfd, &headers, &file_cursor); - - do_linenos_for (abfd, &headers, &file_cursor); - - H_SET_FILE_MAGIC_NUMBER (&headers, COFF_MAGIC); -#ifndef OBJ_COFF_OMIT_TIMESTAMP - H_SET_TIME_STAMP (&headers, (long)time((time_t *)0)); -#else - H_SET_TIME_STAMP (&headers, 0); -#endif -#ifdef TC_COFF_SET_MACHINE - TC_COFF_SET_MACHINE (&headers); -#endif - -#ifndef COFF_FLAGS -#define COFF_FLAGS 0 -#endif - -#ifdef KEEP_RELOC_INFO - H_SET_FLAGS (&headers, ((H_GET_LINENO_SIZE(&headers) ? 0 : F_LNNO) | - COFF_FLAGS | coff_flags)); -#else - H_SET_FLAGS (&headers, ((H_GET_LINENO_SIZE(&headers) ? 0 : F_LNNO) | - (H_GET_RELOCATION_SIZE(&headers) ? 0 : F_RELFLG) | - COFF_FLAGS | coff_flags)); -#endif - - { - unsigned int symtable_size = H_GET_SYMBOL_TABLE_SIZE (&headers); - char *buffer1 = xmalloc (symtable_size + string_byte_count + 1); - - H_SET_SYMBOL_TABLE_POINTER (&headers, bfd_tell (abfd)); - w_symbols (abfd, buffer1, symbol_rootP); - if (string_byte_count > 0) - w_strings (buffer1 + symtable_size); - bfd_bwrite (buffer1, (bfd_size_type) symtable_size + string_byte_count, - abfd); - free (buffer1); - } - - coff_header_append (abfd, &headers); -#if 0 - /* Recent changes to write need this, but where it should - go is up to Ken.. */ - if (!bfd_close_all_done (abfd)) - as_fatal (_("Can't close %s: %s"), out_file_name, - bfd_errmsg (bfd_get_error ())); -#else - { - extern bfd *stdoutput; - stdoutput = abfd; - } -#endif - -} - -/* Add a new segment. This is called from subseg_new via the - obj_new_segment macro. */ - -segT -obj_coff_add_segment (name) - const char *name; -{ - unsigned int i; - -#ifndef COFF_LONG_SECTION_NAMES - char buf[SCNNMLEN + 1]; - - strncpy (buf, name, SCNNMLEN); - buf[SCNNMLEN] = '\0'; - name = buf; -#endif - - for (i = SEG_E0; i < SEG_LAST && segment_info[i].scnhdr.s_name[0]; i++) - if (strcmp (name, segment_info[i].name) == 0) - return (segT) i; - - if (i == SEG_LAST) - { - as_bad (_("Too many new sections; can't add \"%s\""), name); - return now_seg; - } - - /* Add a new section. */ - strncpy (segment_info[i].scnhdr.s_name, name, - sizeof (segment_info[i].scnhdr.s_name)); - segment_info[i].scnhdr.s_flags = STYP_REG; - segment_info[i].name = xstrdup (name); - - return (segT) i; -} - -/* Implement the .section pseudo op: - .section name {, "flags"} - ^ ^ - | +--- optional flags: 'b' for bss - | 'i' for info - +-- section name 'l' for lib - 'n' for noload - 'o' for over - 'w' for data - 'd' (apparently m88k for data) - 'x' for text - 'r' for read-only data - But if the argument is not a quoted string, treat it as a - subsegment number. */ - -void -obj_coff_section (ignore) - int ignore ATTRIBUTE_UNUSED; -{ - /* Strip out the section name. */ - char *section_name, *name; - char c; - unsigned int exp; - long flags; - - if (flag_mri) - { - char type; - - s_mri_sect (&type); - flags = 0; - if (type == 'C') - flags = STYP_TEXT; - else if (type == 'D') - flags = STYP_DATA; - segment_info[now_seg].scnhdr.s_flags |= flags; - - return; - } - - section_name = input_line_pointer; - c = get_symbol_end (); - - name = xmalloc (input_line_pointer - section_name + 1); - strcpy (name, section_name); - - *input_line_pointer = c; - - exp = 0; - flags = 0; - - SKIP_WHITESPACE (); - if (*input_line_pointer == ',') - { - ++input_line_pointer; - SKIP_WHITESPACE (); - - if (*input_line_pointer != '"') - exp = get_absolute_expression (); - else - { - ++input_line_pointer; - while (*input_line_pointer != '"' - && ! is_end_of_line[(unsigned char) *input_line_pointer]) - { - switch (*input_line_pointer) - { - case 'b': flags |= STYP_BSS; break; - case 'i': flags |= STYP_INFO; break; - case 'l': flags |= STYP_LIB; break; - case 'n': flags |= STYP_NOLOAD; break; - case 'o': flags |= STYP_OVER; break; - case 'd': - case 'w': flags |= STYP_DATA; break; - case 'x': flags |= STYP_TEXT; break; - case 'r': flags |= STYP_LIT; break; - default: - as_warn(_("unknown section attribute '%c'"), - *input_line_pointer); - break; - } - ++input_line_pointer; - } - if (*input_line_pointer == '"') - ++input_line_pointer; - } - } - - subseg_new (name, (subsegT) exp); - - segment_info[now_seg].scnhdr.s_flags |= flags; - - demand_empty_rest_of_line (); -} - -static void -obj_coff_text (ignore) - int ignore ATTRIBUTE_UNUSED; -{ - subseg_new (".text", get_absolute_expression ()); -} - -static void -obj_coff_data (ignore) - int ignore ATTRIBUTE_UNUSED; -{ - if (flag_readonly_data_in_text) - subseg_new (".text", get_absolute_expression () + 1000); - else - subseg_new (".data", get_absolute_expression ()); -} - -static void -obj_coff_ident (ignore) - int ignore ATTRIBUTE_UNUSED; -{ - segT current_seg = now_seg; /* Save current seg. */ - subsegT current_subseg = now_subseg; - - subseg_new (".comment", 0); /* .comment seg. */ - stringer (1); /* Read string. */ - subseg_set (current_seg, current_subseg); /* Restore current seg. */ -} - -void -c_symbol_merge (debug, normal) - symbolS *debug; - symbolS *normal; -{ - S_SET_DATA_TYPE (normal, S_GET_DATA_TYPE (debug)); - S_SET_STORAGE_CLASS (normal, S_GET_STORAGE_CLASS (debug)); - - if (S_GET_NUMBER_AUXILIARY (debug) > S_GET_NUMBER_AUXILIARY (normal)) - S_SET_NUMBER_AUXILIARY (normal, S_GET_NUMBER_AUXILIARY (debug)); - - if (S_GET_NUMBER_AUXILIARY (debug) > 0) - memcpy ((char *) &normal->sy_symbol.ost_auxent[0], - (char *) &debug->sy_symbol.ost_auxent[0], - (unsigned int) (S_GET_NUMBER_AUXILIARY (debug) * AUXESZ)); - - /* Move the debug flags. */ - SF_SET_DEBUG_FIELD (normal, SF_GET_DEBUG_FIELD (debug)); -} - -static int -c_line_new (symbol, paddr, line_number, frag) - symbolS * symbol; - long paddr; - int line_number; - fragS * frag; -{ - struct lineno_list *new_line = - (struct lineno_list *) xmalloc (sizeof (struct lineno_list)); - - segment_info_type *s = segment_info + now_seg; - new_line->line.l_lnno = line_number; - - if (line_number == 0) - { - last_line_symbol = symbol; - new_line->line.l_addr.l_symndx = (long) symbol; - } - else - { - new_line->line.l_addr.l_paddr = paddr; - } - - new_line->frag = (char *) frag; - new_line->next = (struct lineno_list *) NULL; - - if (s->lineno_list_head == (struct lineno_list *) NULL) - s->lineno_list_head = new_line; - else - s->lineno_list_tail->next = new_line; - - s->lineno_list_tail = new_line; - return LINESZ * s->scnhdr.s_nlnno++; -} - -void -c_dot_file_symbol (filename) - char *filename; -{ - symbolS *symbolP; - - symbolP = symbol_new (".file", - SEG_DEBUG, - 0, - &zero_address_frag); - - S_SET_STORAGE_CLASS (symbolP, C_FILE); - S_SET_NUMBER_AUXILIARY (symbolP, 1); - - if (strlen (filename) > FILNMLEN) - { - /* Filename is too long to fit into an auxent, - we stick it into the string table instead. We keep - a linked list of the filenames we find so we can emit - them later. */ - struct filename_list *f = ((struct filename_list *) - xmalloc (sizeof (struct filename_list))); - - f->filename = filename; - f->next = 0; - - SA_SET_FILE_FNAME_ZEROS (symbolP, 0); - SA_SET_FILE_FNAME_OFFSET (symbolP, 1); - - if (filename_list_tail) - filename_list_tail->next = f; - else - filename_list_head = f; - filename_list_tail = f; - } - else - { - SA_SET_FILE_FNAME (symbolP, filename); - } -#ifndef NO_LISTING - { - extern int listing; - if (listing) - listing_source_file (filename); - } -#endif - SF_SET_DEBUG (symbolP); - S_SET_VALUE (symbolP, (valueT) previous_file_symbol); - - previous_file_symbol = symbolP; - - /* Make sure that the symbol is first on the symbol chain. */ - if (symbol_rootP != symbolP) - { - symbol_remove (symbolP, &symbol_rootP, &symbol_lastP); - symbol_insert (symbolP, symbol_rootP, &symbol_rootP, &symbol_lastP); - } -} - -/* Build a 'section static' symbol. */ - -symbolS * -c_section_symbol (name, idx) - char *name; - int idx; -{ - symbolS *symbolP; - - symbolP = symbol_find_base (name, DO_NOT_STRIP); - if (symbolP == NULL) - symbolP = symbol_new (name, idx, 0, &zero_address_frag); - else - { - /* Mmmm. I just love violating interfaces. Makes me feel...dirty. */ - S_SET_SEGMENT (symbolP, idx); - symbolP->sy_frag = &zero_address_frag; - } - - S_SET_STORAGE_CLASS (symbolP, C_STAT); - S_SET_NUMBER_AUXILIARY (symbolP, 1); - - SF_SET_STATICS (symbolP); - -#ifdef TE_DELTA - /* manfred@s-direktnet.de: section symbols *must* have the LOCAL bit cleared, - which is set by the new definition of LOCAL_LABEL in tc-m68k.h. */ - SF_CLEAR_LOCAL (symbolP); -#endif -#ifdef TE_PE - /* If the .linkonce pseudo-op was used for this section, we must - store the information in the auxiliary entry for the section - symbol. */ - if (segment_info[idx].linkonce != LINKONCE_UNSET) - { - int type; - - switch (segment_info[idx].linkonce) - { - default: - abort (); - case LINKONCE_DISCARD: - type = IMAGE_COMDAT_SELECT_ANY; - break; - case LINKONCE_ONE_ONLY: - type = IMAGE_COMDAT_SELECT_NODUPLICATES; - break; - case LINKONCE_SAME_SIZE: - type = IMAGE_COMDAT_SELECT_SAME_SIZE; - break; - case LINKONCE_SAME_CONTENTS: - type = IMAGE_COMDAT_SELECT_EXACT_MATCH; - break; - } - - SYM_AUXENT (symbolP)->x_scn.x_comdat = type; - } -#endif /* TE_PE */ - - return symbolP; -} - -static void -w_symbols (abfd, where, symbol_rootP) - bfd * abfd; - char *where; - symbolS * symbol_rootP; -{ - symbolS *symbolP; - unsigned int i; - - /* First fill in those values we have only just worked out. */ - for (i = SEG_E0; i < SEG_LAST; i++) - { - symbolP = segment_info[i].dot; - if (symbolP) - { - SA_SET_SCN_SCNLEN (symbolP, segment_info[i].scnhdr.s_size); - SA_SET_SCN_NRELOC (symbolP, segment_info[i].scnhdr.s_nreloc); - SA_SET_SCN_NLINNO (symbolP, segment_info[i].scnhdr.s_nlnno); - } - } - - /* Emit all symbols left in the symbol chain. */ - for (symbolP = symbol_rootP; symbolP; symbolP = symbol_next (symbolP)) - { - /* Used to save the offset of the name. It is used to point - to the string in memory but must be a file offset. */ - char *temp; - - /* We can't fix the lnnoptr field in yank_symbols with the other - adjustments, because we have to wait until we know where they - go in the file. */ - if (SF_GET_ADJ_LNNOPTR (symbolP)) - SA_GET_SYM_LNNOPTR (symbolP) += - segment_info[S_GET_SEGMENT (symbolP)].scnhdr.s_lnnoptr; - - tc_coff_symbol_emit_hook (symbolP); - - temp = S_GET_NAME (symbolP); - if (SF_GET_STRING (symbolP)) - { - S_SET_OFFSET (symbolP, symbolP->sy_name_offset); - S_SET_ZEROES (symbolP, 0); - } - else - { - memset (symbolP->sy_symbol.ost_entry.n_name, 0, SYMNMLEN); - strncpy (symbolP->sy_symbol.ost_entry.n_name, temp, SYMNMLEN); - } - where = symbol_to_chars (abfd, where, symbolP); - S_SET_NAME (symbolP, temp); - } -} - -static void -obj_coff_lcomm (ignore) - int ignore ATTRIBUTE_UNUSED; -{ - s_lcomm(0); - return; -#if 0 - char *name; - char c; - int temp; - char *p; - - symbolS *symbolP; - - name = input_line_pointer; - - c = get_symbol_end (); - p = input_line_pointer; - *p = c; - SKIP_WHITESPACE (); - if (*input_line_pointer != ',') - { - as_bad (_("Expected comma after name")); - ignore_rest_of_line (); - return; - } - if (*input_line_pointer == '\n') - { - as_bad (_("Missing size expression")); - return; - } - input_line_pointer++; - if ((temp = get_absolute_expression ()) < 0) - { - as_warn (_("lcomm length (%d.) <0! Ignored."), temp); - ignore_rest_of_line (); - return; - } - *p = 0; - - symbolP = symbol_find_or_make (name); - - if (S_GET_SEGMENT (symbolP) == SEG_UNKNOWN && - S_GET_VALUE (symbolP) == 0) - { - if (! need_pass_2) - { - char *p; - segT current_seg = now_seg; /* Save current seg. */ - subsegT current_subseg = now_subseg; - - subseg_set (SEG_E2, 1); - symbolP->sy_frag = frag_now; - p = frag_var(rs_org, 1, 1, (relax_substateT)0, symbolP, - (offsetT) temp, (char *) 0); - *p = 0; - subseg_set (current_seg, current_subseg); /* Restore current seg. */ - S_SET_SEGMENT (symbolP, SEG_E2); - S_SET_STORAGE_CLASS (symbolP, C_STAT); - } - } - else - as_bad (_("Symbol %s already defined"), name); - - demand_empty_rest_of_line (); -#endif -} - -static void -fixup_mdeps (frags, h, this_segment) - fragS *frags; - object_headers *h ATTRIBUTE_UNUSED; - segT this_segment; -{ - subseg_change (this_segment, 0); - - while (frags) - { - switch (frags->fr_type) - { - case rs_align: - case rs_align_code: - case rs_align_test: - case rs_org: -#ifdef HANDLE_ALIGN - HANDLE_ALIGN (frags); -#endif - frags->fr_type = rs_fill; - frags->fr_offset = - ((frags->fr_next->fr_address - frags->fr_address - frags->fr_fix) - / frags->fr_var); - break; - case rs_machine_dependent: - md_convert_frag (h, this_segment, frags); - frag_wane (frags); - break; - default: - ; - } - frags = frags->fr_next; - } -} - -#if 1 - -#ifndef TC_FORCE_RELOCATION -#define TC_FORCE_RELOCATION(fix) 0 -#endif - -static void -fixup_segment (segP, this_segment_type) - segment_info_type * segP; - segT this_segment_type; -{ - fixS * fixP; - symbolS *add_symbolP; - symbolS *sub_symbolP; - long add_number; - int size; - char *place; - long where; - char pcrel; - fragS *fragP; - segT add_symbol_segment = absolute_section; - - for (fixP = segP->fix_root; fixP; fixP = fixP->fx_next) - { - fragP = fixP->fx_frag; - know (fragP); - where = fixP->fx_where; - place = fragP->fr_literal + where; - size = fixP->fx_size; - add_symbolP = fixP->fx_addsy; - sub_symbolP = fixP->fx_subsy; - add_number = fixP->fx_offset; - pcrel = fixP->fx_pcrel; - - /* We want function-relative stabs to work on systems which - may use a relaxing linker; thus we must handle the sym1-sym2 - fixups function-relative stabs generates. - - Of course, if you actually enable relaxing in the linker, the - line and block scoping information is going to be incorrect - in some cases. The only way to really fix this is to support - a reloc involving the difference of two symbols. */ - if (linkrelax - && (!sub_symbolP || pcrel)) - continue; - -#ifdef TC_I960 - if (fixP->fx_tcbit && SF_GET_CALLNAME (add_symbolP)) - { - /* Relocation should be done via the associated 'bal' entry - point symbol. */ - - if (!SF_GET_BALNAME (tc_get_bal_of_call (add_symbolP))) - { - as_bad_where (fixP->fx_file, fixP->fx_line, - _("No 'bal' entry point for leafproc %s"), - S_GET_NAME (add_symbolP)); - continue; - } - fixP->fx_addsy = add_symbolP = tc_get_bal_of_call (add_symbolP); - } -#endif - - /* Make sure the symbols have been resolved; this may not have - happened if these are expression symbols. */ - if (add_symbolP != NULL && ! add_symbolP->sy_resolved) - resolve_symbol_value (add_symbolP); - - if (add_symbolP != NULL) - { - /* If this fixup is against a symbol which has been equated - to another symbol, convert it to the other symbol. */ - if (add_symbolP->sy_value.X_op == O_symbol - && (! S_IS_DEFINED (add_symbolP) - || S_IS_COMMON (add_symbolP))) - { - while (add_symbolP->sy_value.X_op == O_symbol - && (! S_IS_DEFINED (add_symbolP) - || S_IS_COMMON (add_symbolP))) - { - symbolS *n; - - /* We must avoid looping, as that can occur with a - badly written program. */ - n = add_symbolP->sy_value.X_add_symbol; - if (n == add_symbolP) - break; - add_number += add_symbolP->sy_value.X_add_number; - add_symbolP = n; - } - fixP->fx_addsy = add_symbolP; - fixP->fx_offset = add_number; - } - } - - if (sub_symbolP != NULL && ! sub_symbolP->sy_resolved) - resolve_symbol_value (sub_symbolP); - - if (add_symbolP != NULL - && add_symbolP->sy_mri_common) - { - know (add_symbolP->sy_value.X_op == O_symbol); - add_number += S_GET_VALUE (add_symbolP); - fixP->fx_offset = add_number; - add_symbolP = fixP->fx_addsy = add_symbolP->sy_value.X_add_symbol; - } - - if (add_symbolP) - add_symbol_segment = S_GET_SEGMENT (add_symbolP); - - if (sub_symbolP) - { - if (add_symbolP == NULL || add_symbol_segment == absolute_section) - { - if (add_symbolP != NULL) - { - add_number += S_GET_VALUE (add_symbolP); - add_symbolP = NULL; - fixP->fx_addsy = NULL; - } - - /* It's just -sym. */ - if (S_GET_SEGMENT (sub_symbolP) == absolute_section) - { - add_number -= S_GET_VALUE (sub_symbolP); - fixP->fx_subsy = 0; - fixP->fx_done = 1; - } - else - { -#ifndef TC_M68K - as_bad_where (fixP->fx_file, fixP->fx_line, - _("Negative of non-absolute symbol %s"), - S_GET_NAME (sub_symbolP)); -#endif - add_number -= S_GET_VALUE (sub_symbolP); - } /* not absolute */ - - /* if sub_symbol is in the same segment that add_symbol - and add_symbol is either in DATA, TEXT, BSS or ABSOLUTE. */ - } - else if (S_GET_SEGMENT (sub_symbolP) == add_symbol_segment - && SEG_NORMAL (add_symbol_segment)) - { - /* Difference of 2 symbols from same segment. Can't - make difference of 2 undefineds: 'value' means - something different for N_UNDF. */ -#ifdef TC_I960 - /* Makes no sense to use the difference of 2 arbitrary symbols - as the target of a call instruction. */ - if (fixP->fx_tcbit) - as_bad_where (fixP->fx_file, fixP->fx_line, - _("callj to difference of 2 symbols")); -#endif /* TC_I960 */ - add_number += S_GET_VALUE (add_symbolP) - - S_GET_VALUE (sub_symbolP); - add_symbolP = NULL; - - if (!TC_FORCE_RELOCATION (fixP)) - { - fixP->fx_addsy = NULL; - fixP->fx_subsy = NULL; - fixP->fx_done = 1; -#ifdef TC_M68K /* is this right? */ - pcrel = 0; - fixP->fx_pcrel = 0; -#endif - } - } - else - { - /* Different segments in subtraction. */ - know (!(S_IS_EXTERNAL (sub_symbolP) && (S_GET_SEGMENT (sub_symbolP) == absolute_section))); - - if ((S_GET_SEGMENT (sub_symbolP) == absolute_section)) - add_number -= S_GET_VALUE (sub_symbolP); - -#ifdef DIFF_EXPR_OK - else if (S_GET_SEGMENT (sub_symbolP) == this_segment_type -#if 0 /* Okay for 68k, at least... */ - && !pcrel -#endif - ) - { - /* Make it pc-relative. */ - add_number += (md_pcrel_from (fixP) - - S_GET_VALUE (sub_symbolP)); - pcrel = 1; - fixP->fx_pcrel = 1; - sub_symbolP = 0; - fixP->fx_subsy = 0; - } -#endif - else - { - as_bad_where (fixP->fx_file, fixP->fx_line, - _("Can't emit reloc {- %s-seg symbol \"%s\"} @ file address %ld."), - segment_name (S_GET_SEGMENT (sub_symbolP)), - S_GET_NAME (sub_symbolP), - (long) (fragP->fr_address + where)); - } - } - } - - if (add_symbolP) - { - if (add_symbol_segment == this_segment_type && pcrel) - { - /* This fixup was made when the symbol's segment was - SEG_UNKNOWN, but it is now in the local segment. - So we know how to do the address without relocation. */ -#ifdef TC_I960 - /* reloc_callj() may replace a 'call' with a 'calls' or a 'bal', - in which cases it modifies *fixP as appropriate. In the case - of a 'calls', no further work is required, and *fixP has been - set up to make the rest of the code below a no-op. */ - reloc_callj (fixP); -#endif /* TC_I960 */ - - add_number += S_GET_VALUE (add_symbolP); - add_number -= md_pcrel_from (fixP); - - /* We used to do - add_number -= segP->scnhdr.s_vaddr; - if defined (TC_I386) || defined (TE_LYNX). I now - think that was an error propagated from the case when - we are going to emit the relocation. If we are not - going to emit the relocation, then we just want to - set add_number to the difference between the symbols. - This is a case that would only arise when there is a - PC relative reference from a section other than .text - to a symbol defined in the same section, and the - reference is not relaxed. Since jump instructions on - the i386 are relaxed, this could only arise with a - call instruction. */ - - pcrel = 0; /* Lie. Don't want further pcrel processing. */ - if (!TC_FORCE_RELOCATION (fixP)) - { - fixP->fx_addsy = NULL; - fixP->fx_done = 1; - } - } - else - { - switch (add_symbol_segment) - { - case absolute_section: -#ifdef TC_I960 - /* See comment about reloc_callj() above. */ - reloc_callj (fixP); -#endif /* TC_I960 */ - add_number += S_GET_VALUE (add_symbolP); - add_symbolP = NULL; - - if (!TC_FORCE_RELOCATION (fixP)) - { - fixP->fx_addsy = NULL; - fixP->fx_done = 1; - } - break; - default: - -#if defined(TC_A29K) || (defined(TE_PE) && defined(TC_I386)) || defined(TC_M88K) || defined(TC_OR32) - /* This really should be handled in the linker, but - backward compatibility forbids. */ - add_number += S_GET_VALUE (add_symbolP); -#else - add_number += S_GET_VALUE (add_symbolP) + - segment_info[S_GET_SEGMENT (add_symbolP)].scnhdr.s_paddr; -#endif - break; - - case SEG_UNKNOWN: -#ifdef TC_I960 - if ((int) fixP->fx_bit_fixP == 13) - { - /* This is a COBR instruction. They have only a - 13-bit displacement and are only to be used - for local branches: flag as error, don't generate - relocation. */ - as_bad_where (fixP->fx_file, fixP->fx_line, - _("can't use COBR format with external label")); - fixP->fx_addsy = NULL; - fixP->fx_done = 1; - continue; - } -#endif /* TC_I960 */ -#if ((defined (TC_I386) || defined (TE_LYNX) || defined (TE_AUX)) && !defined(TE_PE)) || defined (COFF_COMMON_ADDEND) - /* 386 COFF uses a peculiar format in which the - value of a common symbol is stored in the .text - segment (I've checked this on SVR3.2 and SCO - 3.2.2) Ian Taylor . */ - /* This is also true for 68k COFF on sysv machines - (Checked on Motorola sysv68 R3V6 and R3V7.1, and also on - UNIX System V/M68000, Release 1.0 from ATT/Bell Labs) - Philippe De Muyter . */ - if (S_IS_COMMON (add_symbolP)) - add_number += S_GET_VALUE (add_symbolP); -#endif - break; - - } - } - } - - if (pcrel) - { -#if !defined(TC_M88K) && !(defined(TE_PE) && defined(TC_I386)) && !defined(TC_A29K) && !defined(TC_OR32) - /* This adjustment is not correct on the m88k, for which the - linker does all the computation. */ - add_number -= md_pcrel_from (fixP); -#endif - if (add_symbolP == 0) - fixP->fx_addsy = &abs_symbol; -#if defined (TC_I386) || defined (TE_LYNX) || defined (TC_I960) || defined (TC_M68K) - /* On the 386 we must adjust by the segment vaddr as well. - Ian Taylor. - - I changed the i960 to work this way as well. This is - compatible with the current GNU linker behaviour. I do - not know what other i960 COFF assemblers do. This is not - a common case: normally, only assembler code will contain - a PC relative reloc, and only branches which do not - originate in the .text section will have a non-zero - address. - - I changed the m68k to work this way as well. This will - break existing PC relative relocs from sections which do - not start at address 0, but it will make ld -r work. - Ian Taylor, 4 Oct 96. */ - - add_number -= segP->scnhdr.s_vaddr; -#endif - } - - md_apply_fix3 (fixP, (valueT *) & add_number, this_segment_type); - - if (!fixP->fx_bit_fixP && ! fixP->fx_no_overflow) - { -#ifndef TC_M88K - /* The m88k uses the offset field of the reloc to get around - this problem. */ - if ((size == 1 - && ((add_number & ~0xFF) - || (fixP->fx_signed && (add_number & 0x80))) - && ((add_number & ~0xFF) != (-1 & ~0xFF) - || (add_number & 0x80) == 0)) - || (size == 2 - && ((add_number & ~0xFFFF) - || (fixP->fx_signed && (add_number & 0x8000))) - && ((add_number & ~0xFFFF) != (-1 & ~0xFFFF) - || (add_number & 0x8000) == 0))) - { - as_bad_where (fixP->fx_file, fixP->fx_line, - _("Value of %ld too large for field of %d bytes at 0x%lx"), - (long) add_number, size, - (unsigned long) (fragP->fr_address + where)); - } -#endif -#ifdef WARN_SIGNED_OVERFLOW_WORD - /* Warn if a .word value is too large when treated as a - signed number. We already know it is not too negative. - This is to catch over-large switches generated by gcc on - the 68k. */ - if (!flag_signed_overflow_ok - && size == 2 - && add_number > 0x7fff) - as_bad_where (fixP->fx_file, fixP->fx_line, - _("Signed .word overflow; switch may be too large; %ld at 0x%lx"), - (long) add_number, - (unsigned long) (fragP->fr_address + where)); -#endif - } - } -} - -#endif - -/* The first entry in a .stab section is special. */ - -void -obj_coff_init_stab_section (seg) - segT seg; -{ - char *file; - char *p; - char *stabstr_name; - unsigned int stroff; - - /* Make space for this first symbol. */ - p = frag_more (12); - /* Zero it out. */ - memset (p, 0, 12); - as_where (&file, (unsigned int *) NULL); - stabstr_name = (char *) alloca (strlen (segment_info[seg].name) + 4); - strcpy (stabstr_name, segment_info[seg].name); - strcat (stabstr_name, "str"); - stroff = get_stab_string_offset (file, stabstr_name); - know (stroff == 1); - md_number_to_chars (p, stroff, 4); -} - -/* Fill in the counts in the first entry in a .stab section. */ - -static void -adjust_stab_section(abfd, seg) - bfd *abfd; - segT seg; -{ - segT stabstrseg = SEG_UNKNOWN; - const char *secname, *name2; - char *name; - char *p = NULL; - int i, strsz = 0, nsyms; - fragS *frag = segment_info[seg].frchainP->frch_root; - - /* Look for the associated string table section. */ - - secname = segment_info[seg].name; - name = (char *) alloca (strlen (secname) + 4); - strcpy (name, secname); - strcat (name, "str"); - - for (i = SEG_E0; i < SEG_UNKNOWN; i++) - { - name2 = segment_info[i].name; - if (name2 != NULL && strncmp(name2, name, 8) == 0) - { - stabstrseg = i; - break; - } - } - - /* If we found the section, get its size. */ - if (stabstrseg != SEG_UNKNOWN) - strsz = size_section (abfd, stabstrseg); - - nsyms = size_section (abfd, seg) / 12 - 1; - - /* Look for the first frag of sufficient size for the initial stab - symbol, and collect a pointer to it. */ - while (frag && frag->fr_fix < 12) - frag = frag->fr_next; - assert (frag != 0); - p = frag->fr_literal; - assert (p != 0); - - /* Write in the number of stab symbols and the size of the string - table. */ - bfd_h_put_16 (abfd, (bfd_vma) nsyms, (bfd_byte *) p + 6); - bfd_h_put_32 (abfd, (bfd_vma) strsz, (bfd_byte *) p + 8); -} - -#endif /* not BFD_ASSEMBLER */ - const pseudo_typeS coff_pseudo_table[] = { + {"ABORT", s_abort, 0}, + {"appline", obj_coff_ln, 1}, + /* We accept the .bss directive for backward compatibility with + earlier versions of gas. */ + {"bss", obj_coff_bss, 0}, {"def", obj_coff_def, 0}, {"dim", obj_coff_dim, 0}, {"endef", obj_coff_endef, 0}, + {"ident", obj_coff_ident, 0}, {"line", obj_coff_line, 0}, {"ln", obj_coff_ln, 0}, -#ifdef BFD_ASSEMBLER - {"loc", obj_coff_loc, 0}, -#endif - {"appline", obj_coff_ln, 1}, {"scl", obj_coff_scl, 0}, + {"sect", obj_coff_section, 0}, + {"sect.s", obj_coff_section, 0}, + {"section", obj_coff_section, 0}, + {"section.s", obj_coff_section, 0}, + /* FIXME: We ignore the MRI short attribute. */ {"size", obj_coff_size, 0}, {"tag", obj_coff_tag, 0}, {"type", obj_coff_type, 0}, {"val", obj_coff_val, 0}, - {"section", obj_coff_section, 0}, - {"sect", obj_coff_section, 0}, - /* FIXME: We ignore the MRI short attribute. */ - {"section.s", obj_coff_section, 0}, - {"sect.s", obj_coff_section, 0}, - /* We accept the .bss directive for backward compatibility with - earlier versions of gas. */ - {"bss", obj_coff_bss, 0}, - {"weak", obj_coff_weak, 0}, - {"ident", obj_coff_ident, 0}, -#ifndef BFD_ASSEMBLER - {"use", obj_coff_section, 0}, - {"text", obj_coff_text, 0}, - {"data", obj_coff_data, 0}, - {"lcomm", obj_coff_lcomm, 0}, -#else - {"optim", s_ignore, 0}, /* For sun386i cc (?) */ -#endif {"version", s_ignore, 0}, - {"ABORT", s_abort, 0}, -#if defined( TC_M88K ) || defined ( TC_TIC4X ) - /* The m88k and tic4x uses sdef instead of def. */ + {"loc", obj_coff_loc, 0}, + {"optim", s_ignore, 0}, /* For sun386i cc (?) */ + {"weak", obj_coff_weak, 0}, +#if defined TC_TIC4X + /* The tic4x uses sdef instead of def. */ {"sdef", obj_coff_def, 0}, #endif - {NULL, NULL, 0} /* end sentinel */ -}; /* coff_pseudo_table */ + {NULL, NULL, 0} +}; -#ifdef BFD_ASSEMBLER /* Support for a COFF emulation. */ -static void coff_pop_insert PARAMS ((void)); -static int coff_separate_stab_sections PARAMS ((void)); - static void -coff_pop_insert () +coff_pop_insert (void) { pop_insert (coff_pseudo_table); } static int -coff_separate_stab_sections () +coff_separate_stab_sections (void) { return 1; } @@ -4686,5 +1854,3 @@ const struct format_ops coff_format_ops = coff_obj_read_begin_hook, coff_obj_symbol_new_hook }; - -#endif diff --git a/contrib/binutils/gas/config/obj-coff.h b/contrib/binutils/gas/config/obj-coff.h index 520055268c2..6fcbc9f06cb 100644 --- a/contrib/binutils/gas/config/obj-coff.h +++ b/contrib/binutils/gas/config/obj-coff.h @@ -1,6 +1,6 @@ /* coff object file format Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2002, 2003 + 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of GAS. @@ -17,24 +17,14 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #ifndef OBJ_FORMAT_H #define OBJ_FORMAT_H #define OBJ_COFF 1 -#ifndef BFD_ASSEMBLER - -#define WORKING_DOT_WORD -#define WARN_SIGNED_OVERFLOW_WORD -#define OBJ_COFF_OMIT_OPTIONAL_HEADER -#define BFD_HEADERS -#define BFD - -#endif - #include "targ-cpu.h" #include "bfd.h" @@ -85,11 +75,6 @@ #endif #endif -#ifdef TC_A29K -#include "coff/a29k.h" -#define TARGET_FORMAT "coff-a29k-big" -#endif - #ifdef TC_OR32 #include "coff/or32.h" #define TARGET_FORMAT "coff-or32-big" @@ -100,6 +85,11 @@ #define TARGET_FORMAT "coff-Intel-little" #endif +#ifdef TC_Z80 +#include "coff/z80.h" +#define TARGET_FORMAT "coff-z80" +#endif + #ifdef TC_Z8K #include "coff/z8k.h" #define TARGET_FORMAT "coff-z8k" @@ -115,6 +105,11 @@ #define TARGET_FORMAT "coff-h8500" #endif +#ifdef TC_MAXQ20 +#include "coff/maxq.h" +#define TARGET_FORMAT "coff-maxq" +#endif + #ifdef TC_SH #ifdef TE_PE @@ -142,16 +137,6 @@ #define TARGET_FORMAT "pe-mips" #endif -#ifdef TC_M88K -#include "coff/m88k.h" -#define TARGET_FORMAT "coff-m88kbcs" -#endif - -#ifdef TC_W65 -#include "coff/w65.h" -#define TARGET_FORMAT "coff-w65" -#endif - #ifdef TC_TIC30 #include "coff/tic30.h" #define TARGET_FORMAT "coff-tic30" @@ -167,12 +152,6 @@ #define TARGET_FORMAT "coff1-c54x" #endif -#ifdef TC_TIC80 -#include "coff/tic80.h" -#define TARGET_FORMAT "coff-tic80" -#define ALIGNMENT_IN_S_FLAGS 1 -#endif - #ifdef TC_MCORE #include "coff/mcore.h" #ifndef TARGET_FORMAT @@ -180,65 +159,26 @@ #endif #endif -/* Targets may also set this. Also, if BFD_ASSEMBLER is defined, this - will already have been defined. */ -#undef SYMBOLS_NEED_BACKPOINTERS -#define SYMBOLS_NEED_BACKPOINTERS 1 +#ifdef TE_PE +/* PE weak symbols need USE_UNIQUE. */ +#define USE_UNIQUE 1 + +#define obj_set_weak_hook pecoff_obj_set_weak_hook +#define obj_clear_weak_hook pecoff_obj_clear_weak_hook +#endif #ifndef OBJ_COFF_MAX_AUXENTRIES #define OBJ_COFF_MAX_AUXENTRIES 1 -#endif /* OBJ_COFF_MAX_AUXENTRIES */ +#endif -extern void coff_obj_symbol_new_hook PARAMS ((symbolS *)); #define obj_symbol_new_hook coff_obj_symbol_new_hook - -extern void coff_obj_read_begin_hook PARAMS ((void)); +#define obj_symbol_clone_hook coff_obj_symbol_clone_hook #define obj_read_begin_hook coff_obj_read_begin_hook -/* This file really contains two implementations of the COFF back end. - They are in the process of being merged, but this is only a - preliminary, mechanical merging. Many definitions that are - identical between the two are still found in both versions. - - The first version, with BFD_ASSEMBLER defined, uses high-level BFD - interfaces and data structures. The second version, with - BFD_ASSEMBLER not defined, also uses BFD, but mostly for swapping - data structures and for doing the actual I/O. The latter defines - the preprocessor symbols BFD and BFD_HEADERS. Try not to let this - confuse you. - - These two are in the process of being merged, and eventually the - BFD_ASSEMBLER version should take over completely. Release timing - issues and namespace problems convinced me to merge the two - together in this fashion, a little sooner than I would have liked. - The real merge should be much better done by the time the next - release comes out. - - For now, the structure of this file is: - - #ifdef BFD_ASSEMBLER - - #else - - #endif - - Unfortunately, the common portions are very small at the moment, - and many declarations or definitions are duplicated. The structure - of obj-coff.c is similar. - - See doc/internals.texi for a brief discussion of the history, if - you care. - - Ken Raeburn, 5 May 1994. */ - -#ifdef BFD_ASSEMBLER - #include "bfd/libcoff.h" #define OUTPUT_FLAVOR bfd_target_coff_flavour -/* SYMBOL TABLE */ - /* Alter the field names, for now, until we've fixed up the other references to use the new name. */ #ifdef TC_I960 @@ -260,23 +200,14 @@ extern void coff_obj_read_begin_hook PARAMS ((void)); #define SYM_AUXINFO(S) \ (&coffsymbol (symbol_get_bfdsym (S))->native[1]) -#define DO_NOT_STRIP 0 - -extern void obj_coff_section PARAMS ((int)); - /* The number of auxiliary entries. */ #define S_GET_NUMBER_AUXILIARY(s) \ (coffsymbol (symbol_get_bfdsym (s))->native->u.syment.n_numaux) /* The number of auxiliary entries. */ -#define S_SET_NUMBER_AUXILIARY(s,v) (S_GET_NUMBER_AUXILIARY (s) = (v)) +#define S_SET_NUMBER_AUXILIARY(s, v) (S_GET_NUMBER_AUXILIARY (s) = (v)) /* True if a symbol name is in the string table, i.e. its length is > 8. */ -#define S_IS_STRING(s) (strlen(S_GET_NAME(s)) > 8 ? 1 : 0) - -extern int S_SET_DATA_TYPE PARAMS ((symbolS *, int)); -extern int S_SET_STORAGE_CLASS PARAMS ((symbolS *, int)); -extern int S_GET_STORAGE_CLASS PARAMS ((symbolS *)); -extern void SA_SET_SYM_ENDNDX PARAMS ((symbolS *, symbolS *)); +#define S_IS_STRING(s) (strlen (S_GET_NAME (s)) > 8 ? 1 : 0) /* Auxiliary entry macros. SA_ stands for symbol auxiliary. */ /* Omit the tv related fields. */ @@ -294,15 +225,15 @@ extern void SA_SET_SYM_ENDNDX PARAMS ((symbolS *, symbolS *)); #define SA_GET_SCN_NRELOC(s) (SYM_AUXENT (s)->x_scn.x_nreloc) #define SA_GET_SCN_NLINNO(s) (SYM_AUXENT (s)->x_scn.x_nlinno) -#define SA_SET_SYM_LNNO(s,v) (SYM_AUXENT (s)->x_sym.x_misc.x_lnsz.x_lnno=(v)) -#define SA_SET_SYM_SIZE(s,v) (SYM_AUXENT (s)->x_sym.x_misc.x_lnsz.x_size=(v)) -#define SA_SET_SYM_FSIZE(s,v) (SYM_AUXENT (s)->x_sym.x_misc.x_fsize=(v)) -#define SA_SET_SYM_LNNOPTR(s,v) (SYM_AUXENT (s)->x_sym.x_fcnary.x_fcn.x_lnnoptr=(v)) -#define SA_SET_SYM_DIMEN(s,i,v) (SYM_AUXENT (s)->x_sym.x_fcnary.x_ary.x_dimen[(i)]=(v)) -#define SA_SET_FILE_FNAME(s,v) strncpy(SYM_AUXENT (s)->x_file.x_fname,(v),FILNMLEN) -#define SA_SET_SCN_SCNLEN(s,v) (SYM_AUXENT (s)->x_scn.x_scnlen=(v)) -#define SA_SET_SCN_NRELOC(s,v) (SYM_AUXENT (s)->x_scn.x_nreloc=(v)) -#define SA_SET_SCN_NLINNO(s,v) (SYM_AUXENT (s)->x_scn.x_nlinno=(v)) +#define SA_SET_SYM_LNNO(s,v) (SYM_AUXENT (s)->x_sym.x_misc.x_lnsz.x_lnno = (v)) +#define SA_SET_SYM_SIZE(s,v) (SYM_AUXENT (s)->x_sym.x_misc.x_lnsz.x_size = (v)) +#define SA_SET_SYM_FSIZE(s,v) (SYM_AUXENT (s)->x_sym.x_misc.x_fsize = (v)) +#define SA_SET_SYM_LNNOPTR(s,v) (SYM_AUXENT (s)->x_sym.x_fcnary.x_fcn.x_lnnoptr = (v)) +#define SA_SET_SYM_DIMEN(s,i,v) (SYM_AUXENT (s)->x_sym.x_fcnary.x_ary.x_dimen[(i)] = (v)) +#define SA_SET_FILE_FNAME(s,v) strncpy (SYM_AUXENT (s)->x_file.x_fname, (v), FILNMLEN) +#define SA_SET_SCN_SCNLEN(s,v) (SYM_AUXENT (s)->x_scn.x_scnlen = (v)) +#define SA_SET_SCN_NRELOC(s,v) (SYM_AUXENT (s)->x_scn.x_nreloc = (v)) +#define SA_SET_SCN_NLINNO(s,v) (SYM_AUXENT (s)->x_scn.x_nlinno = (v)) /* Internal use only definitions. SF_ stands for symbol flags. @@ -312,31 +243,31 @@ extern void SA_SET_SYM_ENDNDX PARAMS ((symbolS *, symbolS *)); more on the balname/callname hack, see tc-i960.h. b.out is done differently. */ -#define SF_I960_MASK (0x000001ff) /* Bits 0-8 are used by the i960 port. */ -#define SF_SYSPROC (0x0000003f) /* bits 0-5 are used to store the sysproc number */ -#define SF_IS_SYSPROC (0x00000040) /* bit 6 marks symbols that are sysprocs */ -#define SF_BALNAME (0x00000080) /* bit 7 marks BALNAME symbols */ -#define SF_CALLNAME (0x00000100) /* bit 8 marks CALLNAME symbols */ - -#define SF_NORMAL_MASK (0x0000ffff) /* bits 12-15 are general purpose. */ - -#define SF_STATICS (0x00001000) /* Mark the .text & all symbols */ -#define SF_DEFINED (0x00002000) /* Symbol is defined in this file */ -#define SF_STRING (0x00004000) /* Symbol name length > 8 */ -#define SF_LOCAL (0x00008000) /* Symbol must not be emitted */ - -#define SF_DEBUG_MASK (0xffff0000) /* bits 16-31 are debug info */ - -#define SF_FUNCTION (0x00010000) /* The symbol is a function */ -#define SF_PROCESS (0x00020000) /* Process symbol before write */ -#define SF_TAGGED (0x00040000) /* Is associated with a tag */ -#define SF_TAG (0x00080000) /* Is a tag */ -#define SF_DEBUG (0x00100000) /* Is in debug or abs section */ -#define SF_GET_SEGMENT (0x00200000) /* Get the section of the forward symbol. */ +#define SF_I960_MASK 0x000001ff /* Bits 0-8 are used by the i960 port. */ +#define SF_SYSPROC 0x0000003f /* bits 0-5 are used to store the sysproc number. */ +#define SF_IS_SYSPROC 0x00000040 /* bit 6 marks symbols that are sysprocs. */ +#define SF_BALNAME 0x00000080 /* bit 7 marks BALNAME symbols. */ +#define SF_CALLNAME 0x00000100 /* bit 8 marks CALLNAME symbols. */ + +#define SF_NORMAL_MASK 0x0000ffff /* bits 12-15 are general purpose. */ + +#define SF_STATICS 0x00001000 /* Mark the .text & all symbols. */ +#define SF_DEFINED 0x00002000 /* Symbol is defined in this file. */ +#define SF_STRING 0x00004000 /* Symbol name length > 8. */ +#define SF_LOCAL 0x00008000 /* Symbol must not be emitted. */ + +#define SF_DEBUG_MASK 0xffff0000 /* bits 16-31 are debug info. */ + +#define SF_FUNCTION 0x00010000 /* The symbol is a function. */ +#define SF_PROCESS 0x00020000 /* Process symbol before write. */ +#define SF_TAGGED 0x00040000 /* Is associated with a tag. */ +#define SF_TAG 0x00080000 /* Is a tag. */ +#define SF_DEBUG 0x00100000 /* Is in debug or abs section. */ +#define SF_GET_SEGMENT 0x00200000 /* Get the section of the forward symbol. */ /* All other bits are unused. */ /* Accessors. */ -#define SF_GET(s) (*symbol_get_obj (s)) +#define SF_GET(s) (* symbol_get_obj (s)) #define SF_GET_DEBUG(s) (symbol_get_bfdsym (s)->flags & BSF_DEBUGGING) #define SF_SET_DEBUG(s) (symbol_get_bfdsym (s)->flags |= BSF_DEBUGGING) #define SF_GET_NORMAL_FIELD(s) (SF_GET (s) & SF_NORMAL_MASK) @@ -351,15 +282,15 @@ extern void SA_SET_SYM_ENDNDX PARAMS ((symbolS *, symbolS *)); #define SF_GET_TAGGED(s) (SF_GET (s) & SF_TAGGED) #define SF_GET_TAG(s) (SF_GET (s) & SF_TAG) #define SF_GET_GET_SEGMENT(s) (SF_GET (s) & SF_GET_SEGMENT) -#define SF_GET_I960(s) (SF_GET (s) & SF_I960_MASK) /* used by i960 */ -#define SF_GET_BALNAME(s) (SF_GET (s) & SF_BALNAME) /* used by i960 */ -#define SF_GET_CALLNAME(s) (SF_GET (s) & SF_CALLNAME) /* used by i960 */ -#define SF_GET_IS_SYSPROC(s) (SF_GET (s) & SF_IS_SYSPROC) /* used by i960 */ -#define SF_GET_SYSPROC(s) (SF_GET (s) & SF_SYSPROC) /* used by i960 */ +#define SF_GET_I960(s) (SF_GET (s) & SF_I960_MASK) /* Used by i960. */ +#define SF_GET_BALNAME(s) (SF_GET (s) & SF_BALNAME) /* Used by i960. */ +#define SF_GET_CALLNAME(s) (SF_GET (s) & SF_CALLNAME) /* Used by i960. */ +#define SF_GET_IS_SYSPROC(s) (SF_GET (s) & SF_IS_SYSPROC) /* Used by i960. */ +#define SF_GET_SYSPROC(s) (SF_GET (s) & SF_SYSPROC) /* Used by i960. */ /* Modifiers. */ #define SF_SET(s,v) (SF_GET (s) = (v)) -#define SF_SET_NORMAL_FIELD(s,v) (SF_GET (s) |= ((v) & SF_NORMAL_MASK)) +#define SF_SET_NORMAL_FIELD(s,v)(SF_GET (s) |= ((v) & SF_NORMAL_MASK)) #define SF_SET_DEBUG_FIELD(s,v) (SF_GET (s) |= ((v) & SF_DEBUG_MASK)) #define SF_SET_FILE(s) (SF_GET (s) |= SF_FILE) #define SF_SET_STATICS(s) (SF_GET (s) |= SF_STATICS) @@ -372,47 +303,38 @@ extern void SA_SET_SYM_ENDNDX PARAMS ((symbolS *, symbolS *)); #define SF_SET_TAGGED(s) (SF_GET (s) |= SF_TAGGED) #define SF_SET_TAG(s) (SF_GET (s) |= SF_TAG) #define SF_SET_GET_SEGMENT(s) (SF_GET (s) |= SF_GET_SEGMENT) -#define SF_SET_I960(s,v) (SF_GET (s) |= ((v) & SF_I960_MASK)) /* used by i960 */ -#define SF_SET_BALNAME(s) (SF_GET (s) |= SF_BALNAME) /* used by i960 */ -#define SF_SET_CALLNAME(s) (SF_GET (s) |= SF_CALLNAME) /* used by i960 */ -#define SF_SET_IS_SYSPROC(s) (SF_GET (s) |= SF_IS_SYSPROC) /* used by i960 */ -#define SF_SET_SYSPROC(s,v) (SF_GET (s) |= ((v) & SF_SYSPROC)) /* used by i960 */ +#define SF_SET_I960(s,v) (SF_GET (s) |= ((v) & SF_I960_MASK)) /* Used by i960. */ +#define SF_SET_BALNAME(s) (SF_GET (s) |= SF_BALNAME) /* Used by i960. */ +#define SF_SET_CALLNAME(s) (SF_GET (s) |= SF_CALLNAME) /* Used by i960. */ +#define SF_SET_IS_SYSPROC(s) (SF_GET (s) |= SF_IS_SYSPROC) /* Used by i960. */ +#define SF_SET_SYSPROC(s,v) (SF_GET (s) |= ((v) & SF_SYSPROC)) /* Used by i960. */ -/* -------------- Line number handling ------- */ + +/* Line number handling. */ extern int text_lineno_number; extern int coff_line_base; extern int coff_n_line_nos; - -#define obj_emit_lineno(WHERE,LINE,FILE_START) abort () -extern void coff_add_linesym PARAMS ((symbolS *)); - -void c_dot_file_symbol PARAMS ((const char *filename)); -#define obj_app_file c_dot_file_symbol - -extern void coff_frob_symbol PARAMS ((symbolS *, int *)); -extern void coff_adjust_symtab PARAMS ((void)); -extern void coff_frob_section PARAMS ((segT)); -extern void coff_adjust_section_syms PARAMS ((bfd *, asection *, PTR)); -extern void coff_frob_file_after_relocs PARAMS ((void)); -#define obj_frob_symbol(S,P) coff_frob_symbol(S,&P) -#ifndef obj_adjust_symtab -#define obj_adjust_symtab() coff_adjust_symtab() -#endif -#define obj_frob_section(S) coff_frob_section (S) -#define obj_frob_file_after_relocs() coff_frob_file_after_relocs () - extern symbolS *coff_last_function; +#define obj_emit_lineno(WHERE, LINE, FILE_START) abort () +#define obj_app_file(name, app) c_dot_file_symbol (name, app) +#define obj_frob_symbol(S,P) coff_frob_symbol (S, & P) +#define obj_frob_section(S) coff_frob_section (S) +#define obj_frob_file_after_relocs() coff_frob_file_after_relocs () +#ifndef obj_adjust_symtab +#define obj_adjust_symtab() coff_adjust_symtab () +#endif + /* Forward the segment of a forwarded symbol, handle assignments that just copy symbol values, etc. */ #ifndef OBJ_COPY_SYMBOL_ATTRIBUTES #ifndef TE_I386AIX -#define OBJ_COPY_SYMBOL_ATTRIBUTES(dest,src) \ +#define OBJ_COPY_SYMBOL_ATTRIBUTES(dest, src) \ (SF_GET_GET_SEGMENT (dest) \ ? (S_SET_SEGMENT (dest, S_GET_SEGMENT (src)), 0) \ : 0) #else -#define OBJ_COPY_SYMBOL_ATTRIBUTES(dest,src) \ +#define OBJ_COPY_SYMBOL_ATTRIBUTES(dest, src) \ (SF_GET_GET_SEGMENT (dest) && S_GET_SEGMENT (dest) == SEG_UNKNOWN \ ? (S_SET_SEGMENT (dest, S_GET_SEGMENT (src)), 0) \ : 0) @@ -427,452 +349,6 @@ hey ! Where is the C_LEAFSTAT definition ? i960 - coff support is depending on i #endif /* no C_LEAFSTAT */ #endif /* TC_I960 */ -#else /* not BFD_ASSEMBLER */ - -#if defined TC_A29K || defined TC_OR32 -/* Allow translate from aout relocs to coff relocs. */ -#define NO_RELOC 20 -#define RELOC_32 1 -#define RELOC_8 2 -#define RELOC_CONST 3 -#define RELOC_CONSTH 4 -#define RELOC_JUMPTARG 5 -#define RELOC_BASE22 6 -#define RELOC_HI22 7 -#define RELOC_LO10 8 -#define RELOC_BASE13 9 -#define RELOC_WDISP22 10 -#define RELOC_WDISP30 11 -#endif - -extern const segT N_TYPE_seg[]; - -/* Magic number of paged executable. */ -#define DEFAULT_MAGIC_NUMBER_FOR_OBJECT_FILE 0x8300 - -/* SYMBOL TABLE */ - -/* Symbol table entry data type. */ - -typedef struct -{ - /* Basic symbol */ - struct internal_syment ost_entry; - /* Auxiliary entry. */ - union internal_auxent ost_auxent[OBJ_COFF_MAX_AUXENTRIES]; - /* obj_coff internal use only flags. */ - unsigned int ost_flags; -} obj_symbol_type; - -#ifndef DO_NOT_STRIP -#define DO_NOT_STRIP 0 -#endif -/* Symbol table macros and constants. */ - -/* Possible and useful section number in symbol table - The values of TEXT, DATA and BSS may not be portable. */ - -#define C_ABS_SECTION N_ABS -#define C_UNDEF_SECTION N_UNDEF -#define C_DEBUG_SECTION N_DEBUG -#define C_NTV_SECTION N_TV -#define C_PTV_SECTION P_TV -#define C_REGISTER_SECTION 50 - -/* Macros to extract information from a symbol table entry. - This syntactic indirection allows independence regarding a.out or coff. - The argument (s) of all these macros is a pointer to a symbol table entry. */ - -/* Predicates. */ -/* True if the symbol is external. */ -#define S_IS_EXTERNAL(s) \ - ((s)->sy_symbol.ost_entry.n_scnum == C_UNDEF_SECTION) - -/* True if symbol has been defined, ie : - section > 0 (DATA, TEXT or BSS) - section == 0 and value > 0 (external bss symbol). */ -#define S_IS_DEFINED(s) \ - ((s)->sy_symbol.ost_entry.n_scnum > C_UNDEF_SECTION \ - || ((s)->sy_symbol.ost_entry.n_scnum == C_UNDEF_SECTION \ - && S_GET_VALUE (s) > 0) \ - || ((s)->sy_symbol.ost_entry.n_scnum == C_ABS_SECTION)) - -/* Return true for symbols that should not be reduced to section - symbols or eliminated from expressions, because they may be - overridden by the linker. */ -#define S_FORCE_RELOC(s, strict) \ - (!SEG_NORMAL (S_GET_SEGMENT (s)) || (strict && S_IS_WEAK (s))) - -/* True if a debug special symbol entry. */ -#define S_IS_DEBUG(s) \ - ((s)->sy_symbol.ost_entry.n_scnum == C_DEBUG_SECTION) - -/* True if a symbol is local symbol name. */ -/* A symbol name whose name includes ^A is a gas internal pseudo symbol. */ -#define S_IS_LOCAL(s) \ - ((s)->sy_symbol.ost_entry.n_scnum == C_REGISTER_SECTION \ - || (S_LOCAL_NAME(s) && ! flag_keep_locals && ! S_IS_DEBUG (s)) \ - || strchr (S_GET_NAME (s), '\001') != NULL \ - || strchr (S_GET_NAME (s), '\002') != NULL \ - || (flag_strip_local_absolute \ - && !S_IS_EXTERNAL(s) \ - && (s)->sy_symbol.ost_entry.n_scnum == C_ABS_SECTION)) - -/* True if a symbol is not defined in this file. */ -#define S_IS_EXTERN(s) ((s)->sy_symbol.ost_entry.n_scnum == 0 \ - && S_GET_VALUE (s) == 0) - -/* True if a symbol can be multiply defined (bss symbols have this def - though it is bad practice). */ -#define S_IS_COMMON(s) ((s)->sy_symbol.ost_entry.n_scnum == 0 \ - && S_GET_VALUE (s) != 0) - -/* True if a symbol name is in the string table, i.e. its length is > 8. */ -#define S_IS_STRING(s) (strlen(S_GET_NAME(s)) > 8 ? 1 : 0) - -/* True if a symbol is defined as weak. */ -#ifdef TE_PE -#define S_IS_WEAK(s) \ - ((s)->sy_symbol.ost_entry.n_sclass == C_NT_WEAK \ - || (s)->sy_symbol.ost_entry.n_sclass == C_WEAKEXT) -#else -#define S_IS_WEAK(s) \ - ((s)->sy_symbol.ost_entry.n_sclass == C_WEAKEXT) -#endif - -/* Accessors. */ -/* The name of the symbol. */ -#define S_GET_NAME(s) ((char*) (s)->sy_symbol.ost_entry.n_offset) - -/* The pointer to the string table. */ -#define S_GET_OFFSET(s) ((s)->sy_symbol.ost_entry.n_offset) - -/* The numeric value of the segment. */ -#define S_GET_SEGMENT(s) s_get_segment(s) - -/* The data type. */ -#define S_GET_DATA_TYPE(s) ((s)->sy_symbol.ost_entry.n_type) - -/* The storage class. */ -#define S_GET_STORAGE_CLASS(s) ((s)->sy_symbol.ost_entry.n_sclass) - -/* The number of auxiliary entries. */ -#define S_GET_NUMBER_AUXILIARY(s) ((s)->sy_symbol.ost_entry.n_numaux) - -/* Modifiers. */ -/* Set the name of the symbol. */ -#define S_SET_NAME(s,v) \ - ((s)->sy_symbol.ost_entry.n_offset = (unsigned long) (v)) - -/* Set the offset of the symbol. */ -#define S_SET_OFFSET(s,v) \ - ((s)->sy_symbol.ost_entry.n_offset = (v)) - -/* The numeric value of the segment. */ -#define S_SET_SEGMENT(s,v) \ - ((s)->sy_symbol.ost_entry.n_scnum = SEGMENT_TO_SYMBOL_TYPE(v)) - -/* The data type. */ -#define S_SET_DATA_TYPE(s,v) \ - ((s)->sy_symbol.ost_entry.n_type = (v)) - -/* The storage class. */ -#define S_SET_STORAGE_CLASS(s,v) \ - ((s)->sy_symbol.ost_entry.n_sclass = (v)) - -/* The number of auxiliary entries. */ -#define S_SET_NUMBER_AUXILIARY(s,v) \ - ((s)->sy_symbol.ost_entry.n_numaux = (v)) - -/* Additional modifiers. */ -/* The symbol is external (does not mean undefined). */ -#define S_SET_EXTERNAL(s) \ - { S_SET_STORAGE_CLASS(s, C_EXT) ; SF_CLEAR_LOCAL(s); } - -/* Auxiliary entry macros. SA_ stands for symbol auxiliary. */ -/* Omit the tv related fields. */ -/* Accessors. */ -#define SYM_AUXENT(S) (&(S)->sy_symbol.ost_auxent[0]) - -#define SA_GET_SYM_TAGNDX(s) (SYM_AUXENT (s)->x_sym.x_tagndx.l) -#define SA_GET_SYM_LNNO(s) (SYM_AUXENT (s)->x_sym.x_misc.x_lnsz.x_lnno) -#define SA_GET_SYM_SIZE(s) (SYM_AUXENT (s)->x_sym.x_misc.x_lnsz.x_size) -#define SA_GET_SYM_FSIZE(s) (SYM_AUXENT (s)->x_sym.x_misc.x_fsize) -#define SA_GET_SYM_LNNOPTR(s) (SYM_AUXENT (s)->x_sym.x_fcnary.x_fcn.x_lnnoptr) -#define SA_GET_SYM_ENDNDX(s) (SYM_AUXENT (s)->x_sym.x_fcnary.x_fcn.x_endndx.l) -#define SA_GET_SYM_DIMEN(s,i) (SYM_AUXENT (s)->x_sym.x_fcnary.x_ary.x_dimen[(i)]) -#define SA_GET_FILE_FNAME(s) (SYM_AUXENT (s)->x_file.x_fname) -#define SA_GET_FILE_FNAME_OFFSET(s) (SYM_AUXENT (s)->x_file.x_n.x_offset) -#define SA_GET_FILE_FNAME_ZEROS(s) (SYM_AUXENT (s)->x_file.x_n.x_zeroes) -#define SA_GET_SCN_SCNLEN(s) (SYM_AUXENT (s)->x_scn.x_scnlen) -#define SA_GET_SCN_NRELOC(s) (SYM_AUXENT (s)->x_scn.x_nreloc) -#define SA_GET_SCN_NLINNO(s) (SYM_AUXENT (s)->x_scn.x_nlinno) - -/* Modifiers. */ -#define SA_SET_SYM_TAGNDX(s,v) (SYM_AUXENT (s)->x_sym.x_tagndx.l=(v)) -#define SA_SET_SYM_LNNO(s,v) (SYM_AUXENT (s)->x_sym.x_misc.x_lnsz.x_lnno=(v)) -#define SA_SET_SYM_SIZE(s,v) (SYM_AUXENT (s)->x_sym.x_misc.x_lnsz.x_size=(v)) -#define SA_SET_SYM_FSIZE(s,v) (SYM_AUXENT (s)->x_sym.x_misc.x_fsize=(v)) -#define SA_SET_SYM_LNNOPTR(s,v) (SYM_AUXENT (s)->x_sym.x_fcnary.x_fcn.x_lnnoptr=(v)) -#define SA_SET_SYM_ENDNDX(s,v) (SYM_AUXENT (s)->x_sym.x_fcnary.x_fcn.x_endndx.l=(v)) -#define SA_SET_SYM_DIMEN(s,i,v) (SYM_AUXENT (s)->x_sym.x_fcnary.x_ary.x_dimen[(i)]=(v)) -#define SA_SET_FILE_FNAME(s,v) strncpy(SYM_AUXENT (s)->x_file.x_fname,(v),FILNMLEN) -#define SA_SET_FILE_FNAME_OFFSET(s,v) (SYM_AUXENT (s)->x_file.x_n.x_offset=(v)) -#define SA_SET_FILE_FNAME_ZEROS(s,v) (SYM_AUXENT (s)->x_file.x_n.x_zeroes=(v)) -#define SA_SET_SCN_SCNLEN(s,v) (SYM_AUXENT (s)->x_scn.x_scnlen=(v)) -#define SA_SET_SCN_NRELOC(s,v) (SYM_AUXENT (s)->x_scn.x_nreloc=(v)) -#define SA_SET_SCN_NLINNO(s,v) (SYM_AUXENT (s)->x_scn.x_nlinno=(v)) - -/* Internal use only definitions. SF_ stands for symbol flags. - - These values can be assigned to sy_symbol.ost_flags field of a symbolS. - - You'll break i960 if you shift the SYSPROC bits anywhere else. for - more on the balname/callname hack, see tc-i960.h. b.out is done - differently. */ - -#define SF_I960_MASK (0x000001ff) /* Bits 0-8 are used by the i960 port. */ -#define SF_SYSPROC (0x0000003f) /* bits 0-5 are used to store the sysproc number */ -#define SF_IS_SYSPROC (0x00000040) /* bit 6 marks symbols that are sysprocs */ -#define SF_BALNAME (0x00000080) /* bit 7 marks BALNAME symbols */ -#define SF_CALLNAME (0x00000100) /* bit 8 marks CALLNAME symbols */ - -#define SF_NORMAL_MASK (0x0000ffff) /* bits 12-15 are general purpose. */ - -#define SF_STATICS (0x00001000) /* Mark the .text & all symbols */ -#define SF_DEFINED (0x00002000) /* Symbol is defined in this file */ -#define SF_STRING (0x00004000) /* Symbol name length > 8 */ -#define SF_LOCAL (0x00008000) /* Symbol must not be emitted */ - -#define SF_DEBUG_MASK (0xffff0000) /* bits 16-31 are debug info */ - -#define SF_FUNCTION (0x00010000) /* The symbol is a function */ -#define SF_PROCESS (0x00020000) /* Process symbol before write */ -#define SF_TAGGED (0x00040000) /* Is associated with a tag */ -#define SF_TAG (0x00080000) /* Is a tag */ -#define SF_DEBUG (0x00100000) /* Is in debug or abs section */ -#define SF_GET_SEGMENT (0x00200000) /* Get the section of the forward symbol. */ -#define SF_ADJ_LNNOPTR (0x00400000) /* Has a lnnoptr */ -/* All other bits are unused. */ - -/* Accessors. */ -#define SF_GET(s) ((s)->sy_symbol.ost_flags) -#define SF_GET_NORMAL_FIELD(s) (SF_GET (s) & SF_NORMAL_MASK) -#define SF_GET_DEBUG_FIELD(s) (SF_GET (s) & SF_DEBUG_MASK) -#define SF_GET_FILE(s) (SF_GET (s) & SF_FILE) -#define SF_GET_STATICS(s) (SF_GET (s) & SF_STATICS) -#define SF_GET_DEFINED(s) (SF_GET (s) & SF_DEFINED) -#define SF_GET_STRING(s) (SF_GET (s) & SF_STRING) -#define SF_GET_LOCAL(s) (SF_GET (s) & SF_LOCAL) -#define SF_GET_FUNCTION(s) (SF_GET (s) & SF_FUNCTION) -#define SF_GET_PROCESS(s) (SF_GET (s) & SF_PROCESS) -#define SF_GET_DEBUG(s) (SF_GET (s) & SF_DEBUG) -#define SF_GET_TAGGED(s) (SF_GET (s) & SF_TAGGED) -#define SF_GET_TAG(s) (SF_GET (s) & SF_TAG) -#define SF_GET_GET_SEGMENT(s) (SF_GET (s) & SF_GET_SEGMENT) -#define SF_GET_ADJ_LNNOPTR(s) (SF_GET (s) & SF_ADJ_LNNOPTR) -#define SF_GET_I960(s) (SF_GET (s) & SF_I960_MASK) /* used by i960 */ -#define SF_GET_BALNAME(s) (SF_GET (s) & SF_BALNAME) /* used by i960 */ -#define SF_GET_CALLNAME(s) (SF_GET (s) & SF_CALLNAME) /* used by i960 */ -#define SF_GET_IS_SYSPROC(s) (SF_GET (s) & SF_IS_SYSPROC) /* used by i960 */ -#define SF_GET_SYSPROC(s) (SF_GET (s) & SF_SYSPROC) /* used by i960 */ - -/* Modifiers. */ -#define SF_SET(s,v) (SF_GET (s) = (v)) -#define SF_SET_NORMAL_FIELD(s,v) (SF_GET (s) |= ((v) & SF_NORMAL_MASK)) -#define SF_SET_DEBUG_FIELD(s,v) (SF_GET (s) |= ((v) & SF_DEBUG_MASK)) -#define SF_SET_FILE(s) (SF_GET (s) |= SF_FILE) -#define SF_SET_STATICS(s) (SF_GET (s) |= SF_STATICS) -#define SF_SET_DEFINED(s) (SF_GET (s) |= SF_DEFINED) -#define SF_SET_STRING(s) (SF_GET (s) |= SF_STRING) -#define SF_SET_LOCAL(s) (SF_GET (s) |= SF_LOCAL) -#define SF_CLEAR_LOCAL(s) (SF_GET (s) &= ~SF_LOCAL) -#define SF_SET_FUNCTION(s) (SF_GET (s) |= SF_FUNCTION) -#define SF_SET_PROCESS(s) (SF_GET (s) |= SF_PROCESS) -#define SF_SET_DEBUG(s) (SF_GET (s) |= SF_DEBUG) -#define SF_SET_TAGGED(s) (SF_GET (s) |= SF_TAGGED) -#define SF_SET_TAG(s) (SF_GET (s) |= SF_TAG) -#define SF_SET_GET_SEGMENT(s) (SF_GET (s) |= SF_GET_SEGMENT) -#define SF_SET_ADJ_LNNOPTR(s) (SF_GET (s) |= SF_ADJ_LNNOPTR) -#define SF_SET_I960(s,v) (SF_GET (s) |= ((v) & SF_I960_MASK)) /* used by i960 */ -#define SF_SET_BALNAME(s) (SF_GET (s) |= SF_BALNAME) /* used by i960 */ -#define SF_SET_CALLNAME(s) (SF_GET (s) |= SF_CALLNAME) /* used by i960 */ -#define SF_SET_IS_SYSPROC(s) (SF_GET (s) |= SF_IS_SYSPROC) /* used by i960 */ -#define SF_SET_SYSPROC(s,v) (SF_GET (s) |= ((v) & SF_SYSPROC)) /* used by i960 */ - -/* File header macro and type definition. */ - -/* File position calculators. Beware to use them when all the - appropriate fields are set in the header. */ - -#ifdef OBJ_COFF_OMIT_OPTIONAL_HEADER -#define OBJ_COFF_AOUTHDRSZ (0) -#else -#define OBJ_COFF_AOUTHDRSZ (AOUTHDRSZ) -#endif /* OBJ_COFF_OMIT_OPTIONAL_HEADER */ - -#define H_GET_FILE_SIZE(h) \ - (long) (FILHSZ + OBJ_COFF_AOUTHDRSZ + \ - H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ + \ - H_GET_TEXT_SIZE(h) + H_GET_DATA_SIZE(h) + \ - H_GET_RELOCATION_SIZE(h) + H_GET_LINENO_SIZE(h) + \ - H_GET_SYMBOL_TABLE_SIZE(h) + \ - (h)->string_table_size) -#define H_GET_TEXT_FILE_OFFSET(h) \ - (long) (FILHSZ + OBJ_COFF_AOUTHDRSZ + \ - H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ) -#define H_GET_DATA_FILE_OFFSET(h) \ - (long) (FILHSZ + OBJ_COFF_AOUTHDRSZ + \ - H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ + \ - H_GET_TEXT_SIZE(h)) -#define H_GET_BSS_FILE_OFFSET(h) 0 -#define H_GET_RELOCATION_FILE_OFFSET(h) \ - (long) (FILHSZ + OBJ_COFF_AOUTHDRSZ + \ - H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ + \ - H_GET_TEXT_SIZE(h) + H_GET_DATA_SIZE(h)) -#define H_GET_LINENO_FILE_OFFSET(h) \ - (long) (FILHSZ + OBJ_COFF_AOUTHDRSZ + \ - H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ + \ - H_GET_TEXT_SIZE(h) + H_GET_DATA_SIZE(h) + \ - H_GET_RELOCATION_SIZE(h)) -#define H_GET_SYMBOL_TABLE_FILE_OFFSET(h) \ - (long) (FILHSZ + OBJ_COFF_AOUTHDRSZ + \ - H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ + \ - H_GET_TEXT_SIZE(h) + H_GET_DATA_SIZE(h) + \ - H_GET_RELOCATION_SIZE(h) + H_GET_LINENO_SIZE(h)) - -/* Accessors. */ -/* aouthdr. */ -#define H_GET_MAGIC_NUMBER(h) ((h)->aouthdr.magic) -#define H_GET_VERSION_STAMP(h) ((h)->aouthdr.vstamp) -#define H_GET_TEXT_SIZE(h) ((h)->aouthdr.tsize) -#define H_GET_DATA_SIZE(h) ((h)->aouthdr.dsize) -#define H_GET_BSS_SIZE(h) ((h)->aouthdr.bsize) -#define H_GET_ENTRY_POINT(h) ((h)->aouthdr.entry) -#define H_GET_TEXT_START(h) ((h)->aouthdr.text_start) -#define H_GET_DATA_START(h) ((h)->aouthdr.data_start) -/* filehdr. */ -#define H_GET_FILE_MAGIC_NUMBER(h) ((h)->filehdr.f_magic) -#define H_GET_NUMBER_OF_SECTIONS(h) ((h)->filehdr.f_nscns) -#define H_GET_TIME_STAMP(h) ((h)->filehdr.f_timdat) -#define H_GET_SYMBOL_TABLE_POINTER(h) ((h)->filehdr.f_symptr) -#define H_GET_SYMBOL_COUNT(h) ((h)->filehdr.f_nsyms) -#define H_GET_SYMBOL_TABLE_SIZE(h) (H_GET_SYMBOL_COUNT(h) * SYMESZ) -#define H_GET_SIZEOF_OPTIONAL_HEADER(h) ((h)->filehdr.f_opthdr) -#define H_GET_FLAGS(h) ((h)->filehdr.f_flags) -/* Extra fields to achieve bsd a.out compatibility and for convenience. */ -#define H_GET_RELOCATION_SIZE(h) ((h)->relocation_size) -#define H_GET_STRING_SIZE(h) ((h)->string_table_size) -#define H_GET_LINENO_SIZE(h) ((h)->lineno_size) - -#ifndef OBJ_COFF_OMIT_OPTIONAL_HEADER -#define H_GET_HEADER_SIZE(h) (sizeof (FILHDR) \ - + sizeof (AOUTHDR)\ - + (H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ)) -#else /* OBJ_COFF_OMIT_OPTIONAL_HEADER */ -#define H_GET_HEADER_SIZE(h) (sizeof (FILHDR) \ - + (H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ)) -#endif /* OBJ_COFF_OMIT_OPTIONAL_HEADER */ - -#define H_GET_TEXT_RELOCATION_SIZE(h) (text_section_header.s_nreloc * RELSZ) -#define H_GET_DATA_RELOCATION_SIZE(h) (data_section_header.s_nreloc * RELSZ) - -/* Modifiers. */ -/* aouthdr. */ -#define H_SET_MAGIC_NUMBER(h,v) ((h)->aouthdr.magic = (v)) -#define H_SET_VERSION_STAMP(h,v) ((h)->aouthdr.vstamp = (v)) -#define H_SET_TEXT_SIZE(h,v) ((h)->aouthdr.tsize = (v)) -#define H_SET_DATA_SIZE(h,v) ((h)->aouthdr.dsize = (v)) -#define H_SET_BSS_SIZE(h,v) ((h)->aouthdr.bsize = (v)) -#define H_SET_ENTRY_POINT(h,v) ((h)->aouthdr.entry = (v)) -#define H_SET_TEXT_START(h,v) ((h)->aouthdr.text_start = (v)) -#define H_SET_DATA_START(h,v) ((h)->aouthdr.data_start = (v)) -/* filehdr. */ -#define H_SET_FILE_MAGIC_NUMBER(h,v) ((h)->filehdr.f_magic = (v)) -#define H_SET_NUMBER_OF_SECTIONS(h,v) ((h)->filehdr.f_nscns = (v)) -#define H_SET_TIME_STAMP(h,v) ((h)->filehdr.f_timdat = (v)) -#define H_SET_SYMBOL_TABLE_POINTER(h,v) ((h)->filehdr.f_symptr = (v)) -#define H_SET_SYMBOL_TABLE_SIZE(h,v) ((h)->filehdr.f_nsyms = (v)) -#define H_SET_SIZEOF_OPTIONAL_HEADER(h,v) ((h)->filehdr.f_opthdr = (v)) -#define H_SET_FLAGS(h,v) ((h)->filehdr.f_flags = (v)) -/* Extra fields to achieve bsd a.out compatibility and for convenience. */ -#define H_SET_RELOCATION_SIZE(h,t,d) ((h)->relocation_size = (t)+(d)) -#define H_SET_STRING_SIZE(h,v) ((h)->string_table_size = (v)) -#define H_SET_LINENO_SIZE(h,v) ((h)->lineno_size = (v)) - -/* Segment flipping. */ - -typedef struct -{ - struct internal_aouthdr aouthdr; /* a.out header */ - struct internal_filehdr filehdr; /* File header, not machine dep. */ - long string_table_size; /* names + '\0' + sizeof (int) */ - long relocation_size; /* Cumulated size of relocation - information for all sections in - bytes. */ - long lineno_size; /* Size of the line number information - table in bytes. */ -} object_headers; - -struct lineno_list -{ - struct bfd_internal_lineno line; - char *frag; /* Frag to which the line number is related. */ - struct lineno_list *next; /* Forward chain pointer. */ -}; - -#define obj_segment_name(i) (segment_info[(int) (i)].scnhdr.s_name) - -#define obj_add_segment(s) obj_coff_add_segment (s) - -extern segT obj_coff_add_segment PARAMS ((const char *)); - -extern void obj_coff_section PARAMS ((int)); - -extern void c_dot_file_symbol PARAMS ((char *filename)); -#define obj_app_file c_dot_file_symbol -extern void obj_extra_stuff PARAMS ((object_headers * headers)); - -extern segT s_get_segment PARAMS ((symbolS *ptr)); - -extern void c_section_header PARAMS ((struct internal_scnhdr * header, - char *name, - long core_address, - long size, - long data_ptr, - long reloc_ptr, - long lineno_ptr, - long reloc_number, - long lineno_number, - long alignment)); - -#ifndef tc_coff_symbol_emit_hook -void tc_coff_symbol_emit_hook PARAMS ((symbolS *)); -#endif - -/* Sanity check. */ - -#ifdef TC_I960 -#ifndef C_LEAFSTAT -hey ! Where is the C_LEAFSTAT definition ? i960 - coff support is depending on it. -#endif /* no C_LEAFSTAT */ -#endif /* TC_I960 */ -extern struct internal_scnhdr data_section_header; -extern struct internal_scnhdr text_section_header; - -/* Forward the segment of a forwarded symbol. */ -#define OBJ_COPY_SYMBOL_ATTRIBUTES(dest,src) \ - (SF_GET_GET_SEGMENT (dest) \ - ? (S_SET_SEGMENT (dest, S_GET_SEGMENT (src)), 0) \ - : 0) - -#ifdef TE_PE -#define obj_handle_link_once(t) obj_coff_pe_handle_link_once (t) -extern void obj_coff_pe_handle_link_once (); -#endif - -#endif /* not BFD_ASSEMBLER */ - extern const pseudo_typeS coff_pseudo_table[]; #ifndef obj_pop_insert @@ -896,11 +372,43 @@ extern const pseudo_typeS coff_pseudo_table[]; /* We need 12 bytes at the start of the section to hold some initial information. */ -extern void obj_coff_init_stab_section PARAMS ((segT)); #define INIT_STAB_SECTION(seg) obj_coff_init_stab_section (seg) /* Store the number of relocations in the section aux entry. */ #define SET_SECTION_RELOCS(sec, relocs, n) \ SA_SET_SCN_NRELOC (section_symbol (sec), n) +#define obj_app_file(name, app) c_dot_file_symbol (name, app) + +extern int S_SET_DATA_TYPE (symbolS *, int); +extern int S_SET_STORAGE_CLASS (symbolS *, int); +extern int S_GET_STORAGE_CLASS (symbolS *); +extern void SA_SET_SYM_ENDNDX (symbolS *, symbolS *); +extern void coff_add_linesym (symbolS *); +extern void c_dot_file_symbol (const char *, int); +extern void coff_frob_symbol (symbolS *, int *); +extern void coff_adjust_symtab (void); +extern void coff_frob_section (segT); +extern void coff_adjust_section_syms (bfd *, asection *, void *); +extern void coff_frob_file_after_relocs (void); +extern void coff_obj_symbol_new_hook (symbolS *); +extern void coff_obj_symbol_clone_hook (symbolS *, symbolS *); +extern void coff_obj_read_begin_hook (void); +#ifdef TE_PE +extern void pecoff_obj_set_weak_hook (symbolS *); +extern void pecoff_obj_clear_weak_hook (symbolS *); +#endif +extern void obj_coff_section (int); +extern segT obj_coff_add_segment (const char *); +extern void obj_coff_section (int); +extern void c_dot_file_symbol (const char *, int); +extern segT s_get_segment (symbolS *); +#ifndef tc_coff_symbol_emit_hook +extern void tc_coff_symbol_emit_hook (symbolS *); +#endif +extern void obj_coff_pe_handle_link_once (void); +extern void obj_coff_init_stab_section (segT); +extern void c_section_header (struct internal_scnhdr *, + char *, long, long, long, long, + long, long, long, long); #endif /* OBJ_FORMAT_H */ diff --git a/contrib/binutils/gas/config/obj-ecoff.c b/contrib/binutils/gas/config/obj-ecoff.c index 69f8d9a89ab..c1d2c647f0f 100644 --- a/contrib/binutils/gas/config/obj-ecoff.c +++ b/contrib/binutils/gas/config/obj-ecoff.c @@ -1,6 +1,6 @@ /* ECOFF object file format. - Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 - Free Software Foundation, Inc. + Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, + 2005 Free Software Foundation, Inc. Contributed by Cygnus Support. This file was put together by Ian Lance Taylor . @@ -18,8 +18,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #define OBJ_HEADER "obj-ecoff.h" #include "as.h" @@ -31,10 +31,192 @@ gas directory. This file mostly just arranges to call that one at the right times. */ -static int ecoff_sec_sym_ok_for_reloc PARAMS ((asection *)); -static void obj_ecoff_frob_symbol PARAMS ((symbolS *, int *)); -static void ecoff_pop_insert PARAMS ((void)); -static int ecoff_separate_stab_sections PARAMS ((void)); +/* Set section VMAs and GP values before reloc processing. */ + +void +ecoff_frob_file_before_fix (void) +{ + bfd_vma addr; + asection *sec; + + /* Set the section VMA values. We force the .sdata and .sbss + sections to the end to ensure that their VMA addresses are close + together so that the GP register can address both of them. We + put the .bss section after the .sbss section. + + Also, for the Alpha, we must sort the sections, to make sure they + appear in the output file in the correct order. (Actually, maybe + this is a job for BFD. But the VMAs computed would be out of + whack if we computed them given our initial, random ordering. + It's possible that that wouldn't break things; I could do some + experimenting sometime and find out. + + This output ordering of sections is magic, on the Alpha, at + least. The .lita section must come before .lit8 and .lit4, + otherwise the OSF/1 linker may silently trash the .lit{4,8} + section contents. Also, .text must preceed .rdata. These differ + from the order described in some parts of the DEC OSF/1 Assembly + Language Programmer's Guide, but that order doesn't seem to work + with their linker. + + I don't know if section ordering on the MIPS is important. */ + + static const char *const names[] = + { + /* text segment */ + ".text", ".rdata", ".init", ".fini", + /* data segment */ + ".data", ".lita", ".lit8", ".lit4", ".sdata", ".got", + /* bss segment */ + ".sbss", ".bss", + }; +#define n_names ((int) (sizeof (names) / sizeof (names[0]))) + + /* Sections that match names, order to be straightened out later. */ + asection *secs[n_names]; + int i; + + addr = 0; + for (i = 0; i < n_names; i++) + secs[i] = NULL; + + for (sec = stdoutput->sections; sec != NULL; sec = sec->next) + { + for (i = 0; i < n_names; i++) + if (!strcmp (sec->name, names[i])) + { + secs[i] = sec; + bfd_section_list_remove (stdoutput, sec); + break; + } + if (i == n_names) + { + bfd_set_section_vma (stdoutput, sec, addr); + addr += bfd_section_size (stdoutput, sec); + } + } + for (i = 0; i < n_names; i++) + if (secs[i]) + { + bfd_set_section_vma (stdoutput, secs[i], addr); + addr += bfd_section_size (stdoutput, secs[i]); + } + for (i = n_names - 1; i >= 0; i--) + if (secs[i]) + bfd_section_list_prepend (stdoutput, secs[i]); + + /* Fill in the register masks. */ + { + unsigned long gprmask = 0; + unsigned long fprmask = 0; + unsigned long *cprmask = NULL; + +#ifdef TC_MIPS + /* Fill in the MIPS register masks. It's probably not worth + setting up a generic interface for this. */ + gprmask = mips_gprmask; + cprmask = mips_cprmask; +#endif + +#ifdef TC_ALPHA + alpha_frob_ecoff_data (); + + if (! bfd_ecoff_set_gp_value (stdoutput, alpha_gp_value)) + as_fatal (_("Can't set GP value")); + + gprmask = alpha_gprmask; + fprmask = alpha_fprmask; +#endif + + if (! bfd_ecoff_set_regmasks (stdoutput, gprmask, fprmask, cprmask)) + as_fatal (_("Can't set register masks")); + } +} + +/* Swap out the symbols and debugging information for BFD. */ + +void +ecoff_frob_file (void) +{ + const struct ecoff_debug_swap * const debug_swap + = &ecoff_backend (stdoutput)->debug_swap; + bfd_vma addr ATTRIBUTE_UNUSED; + HDRR *hdr; + char *buf; + char *set; + + /* Build the ECOFF debugging information. */ + assert (ecoff_data (stdoutput) != 0); + hdr = &ecoff_data (stdoutput)->debug_info.symbolic_header; + ecoff_build_debug (hdr, &buf, debug_swap); + + /* Finish up the ecoff_tdata structure. */ + set = buf; +#define SET(ptr, count, type, size) \ + if (hdr->count == 0) \ + ecoff_data (stdoutput)->debug_info.ptr = NULL; \ + else \ + { \ + ecoff_data (stdoutput)->debug_info.ptr = (type) set; \ + set += hdr->count * size; \ + } + + SET (line, cbLine, unsigned char *, sizeof (unsigned char)); + SET (external_dnr, idnMax, void *, debug_swap->external_dnr_size); + SET (external_pdr, ipdMax, void *, debug_swap->external_pdr_size); + SET (external_sym, isymMax, void *, debug_swap->external_sym_size); + SET (external_opt, ioptMax, void *, debug_swap->external_opt_size); + SET (external_aux, iauxMax, union aux_ext *, sizeof (union aux_ext)); + SET (ss, issMax, char *, sizeof (char)); + SET (ssext, issExtMax, char *, sizeof (char)); + SET (external_rfd, crfd, void *, debug_swap->external_rfd_size); + SET (external_fdr, ifdMax, void *, debug_swap->external_fdr_size); + SET (external_ext, iextMax, void *, debug_swap->external_ext_size); +#undef SET +} + +/* This is called by the ECOFF code to set the external information + for a symbol. We just pass it on to BFD, which expects the swapped + information to be stored in the native field of the symbol. */ + +void +obj_ecoff_set_ext (symbolS *sym, EXTR *ext) +{ + const struct ecoff_debug_swap * const debug_swap + = &ecoff_backend (stdoutput)->debug_swap; + ecoff_symbol_type *esym; + + know (bfd_asymbol_flavour (symbol_get_bfdsym (sym)) + == bfd_target_ecoff_flavour); + esym = ecoffsymbol (symbol_get_bfdsym (sym)); + esym->local = FALSE; + esym->native = xmalloc (debug_swap->external_ext_size); + (*debug_swap->swap_ext_out) (stdoutput, ext, esym->native); +} + +static int +ecoff_sec_sym_ok_for_reloc (asection *sec ATTRIBUTE_UNUSED) +{ + return 1; +} + +static void +obj_ecoff_frob_symbol (symbolS *sym, int *puntp ATTRIBUTE_UNUSED) +{ + ecoff_frob_symbol (sym); +} + +static void +ecoff_pop_insert (void) +{ + pop_insert (obj_pseudo_table); +} + +static int +ecoff_separate_stab_sections (void) +{ + return 0; +} /* These are the pseudo-ops we support in this file. Only those relating to debugging information are supported here. @@ -98,228 +280,36 @@ const pseudo_typeS obj_pseudo_table[] = { NULL, s_ignore, 0 } }; -/* Set section VMAs and GP values before reloc processing. */ - -void -ecoff_frob_file_before_fix () -{ - bfd_vma addr; - asection **sec; - - /* Set the section VMA values. We force the .sdata and .sbss - sections to the end to ensure that their VMA addresses are close - together so that the GP register can address both of them. We - put the .bss section after the .sbss section. - - Also, for the Alpha, we must sort the sections, to make sure they - appear in the output file in the correct order. (Actually, maybe - this is a job for BFD. But the VMAs computed would be out of - whack if we computed them given our initial, random ordering. - It's possible that that wouldn't break things; I could do some - experimenting sometime and find out. - - This output ordering of sections is magic, on the Alpha, at - least. The .lita section must come before .lit8 and .lit4, - otherwise the OSF/1 linker may silently trash the .lit{4,8} - section contents. Also, .text must preceed .rdata. These differ - from the order described in some parts of the DEC OSF/1 Assembly - Language Programmer's Guide, but that order doesn't seem to work - with their linker. - - I don't know if section ordering on the MIPS is important. */ - - static const char *const names[] = { - /* text segment */ - ".text", ".rdata", ".init", ".fini", - /* data segment */ - ".data", ".lita", ".lit8", ".lit4", ".sdata", ".got", - /* bss segment */ - ".sbss", ".bss", - }; -#define n_names ((int) (sizeof (names) / sizeof (names[0]))) - - /* Sections that match names, order to be straightened out later. */ - asection *secs[n_names]; - int i; - - addr = 0; - for (i = 0; i < n_names; i++) - secs[i] = 0; - - for (sec = &stdoutput->sections; *sec != (asection *) NULL; ) - { - for (i = 0; i < n_names; i++) - if (!strcmp ((*sec)->name, names[i])) - { - secs[i] = *sec; - bfd_section_list_remove (stdoutput, sec); - break; - } - if (i == n_names) - { - bfd_set_section_vma (stdoutput, *sec, addr); - addr += bfd_section_size (stdoutput, *sec); - sec = &(*sec)->next; - } - } - for (i = 0; i < n_names; i++) - if (secs[i]) - { - bfd_set_section_vma (stdoutput, secs[i], addr); - addr += bfd_section_size (stdoutput, secs[i]); - } - for (i = n_names - 1; i >= 0; i--) - if (secs[i]) - bfd_section_list_insert (stdoutput, &stdoutput->sections, secs[i]); - - /* Fill in the register masks. */ - { - unsigned long gprmask = 0; - unsigned long fprmask = 0; - unsigned long *cprmask = NULL; - -#ifdef TC_MIPS - /* Fill in the MIPS register masks. It's probably not worth - setting up a generic interface for this. */ - gprmask = mips_gprmask; - cprmask = mips_cprmask; -#endif - -#ifdef TC_ALPHA - alpha_frob_ecoff_data (); - - if (! bfd_ecoff_set_gp_value (stdoutput, alpha_gp_value)) - as_fatal (_("Can't set GP value")); - - gprmask = alpha_gprmask; - fprmask = alpha_fprmask; -#endif - - if (! bfd_ecoff_set_regmasks (stdoutput, gprmask, fprmask, cprmask)) - as_fatal (_("Can't set register masks")); - } -} - -/* Swap out the symbols and debugging information for BFD. */ - -void -ecoff_frob_file () -{ - const struct ecoff_debug_swap * const debug_swap - = &ecoff_backend (stdoutput)->debug_swap; - bfd_vma addr ATTRIBUTE_UNUSED; - HDRR *hdr; - char *buf; - char *set; - - /* Build the ECOFF debugging information. */ - assert (ecoff_data (stdoutput) != 0); - hdr = &ecoff_data (stdoutput)->debug_info.symbolic_header; - ecoff_build_debug (hdr, &buf, debug_swap); - - /* Finish up the ecoff_tdata structure. */ - set = buf; -#define SET(ptr, count, type, size) \ - if (hdr->count == 0) \ - ecoff_data (stdoutput)->debug_info.ptr = (type) NULL; \ - else \ - { \ - ecoff_data (stdoutput)->debug_info.ptr = (type) set; \ - set += hdr->count * size; \ - } - - SET (line, cbLine, unsigned char *, sizeof (unsigned char)); - SET (external_dnr, idnMax, PTR, debug_swap->external_dnr_size); - SET (external_pdr, ipdMax, PTR, debug_swap->external_pdr_size); - SET (external_sym, isymMax, PTR, debug_swap->external_sym_size); - SET (external_opt, ioptMax, PTR, debug_swap->external_opt_size); - SET (external_aux, iauxMax, union aux_ext *, sizeof (union aux_ext)); - SET (ss, issMax, char *, sizeof (char)); - SET (ssext, issExtMax, char *, sizeof (char)); - SET (external_rfd, crfd, PTR, debug_swap->external_rfd_size); - SET (external_fdr, ifdMax, PTR, debug_swap->external_fdr_size); - SET (external_ext, iextMax, PTR, debug_swap->external_ext_size); -#undef SET -} - -/* This is called by the ECOFF code to set the external information - for a symbol. We just pass it on to BFD, which expects the swapped - information to be stored in the native field of the symbol. */ - -void -obj_ecoff_set_ext (sym, ext) - symbolS *sym; - EXTR *ext; -{ - const struct ecoff_debug_swap * const debug_swap - = &ecoff_backend (stdoutput)->debug_swap; - ecoff_symbol_type *esym; - - know (bfd_asymbol_flavour (symbol_get_bfdsym (sym)) - == bfd_target_ecoff_flavour); - esym = ecoffsymbol (symbol_get_bfdsym (sym)); - esym->local = FALSE; - esym->native = xmalloc (debug_swap->external_ext_size); - (*debug_swap->swap_ext_out) (stdoutput, ext, esym->native); -} - -static int -ecoff_sec_sym_ok_for_reloc (sec) - asection *sec ATTRIBUTE_UNUSED; -{ - return 1; -} - -static void -obj_ecoff_frob_symbol (sym, puntp) - symbolS *sym; - int *puntp ATTRIBUTE_UNUSED; -{ - ecoff_frob_symbol (sym); -} - -static void -ecoff_pop_insert () -{ - pop_insert (obj_pseudo_table); -} - -static int -ecoff_separate_stab_sections () -{ - return 0; -} - const struct format_ops ecoff_format_ops = { bfd_target_ecoff_flavour, - 0, /* dfl_leading_underscore */ + 0, /* dfl_leading_underscore. */ /* FIXME: A comment why emit_section_symbols is different here (1) from the single-format definition (0) would be in order. */ - 1, /* emit_section_symbols */ - 0, /* begin */ + 1, /* emit_section_symbols. */ + 0, /* begin. */ ecoff_new_file, obj_ecoff_frob_symbol, ecoff_frob_file, - 0, /* frob_file_before_adjust */ + 0, /* frob_file_before_adjust. */ ecoff_frob_file_before_fix, - 0, /* frob_file_after_relocs */ - 0, /* s_get_size */ - 0, /* s_set_size */ - 0, /* s_get_align */ - 0, /* s_set_align */ - 0, /* s_get_other */ - 0, /* s_set_other */ - 0, /* s_get_desc */ - 0, /* s_set_desc */ - 0, /* s_get_type */ - 0, /* s_set_type */ - 0, /* copy_symbol_attributes */ + 0, /* frob_file_after_relocs. */ + 0, /* s_get_size. */ + 0, /* s_set_size. */ + 0, /* s_get_align. */ + 0, /* s_set_align. */ + 0, /* s_get_other. */ + 0, /* s_set_other. */ + 0, /* s_get_desc. */ + 0, /* s_set_desc. */ + 0, /* s_get_type. */ + 0, /* s_set_type. */ + 0, /* copy_symbol_attributes. */ ecoff_generate_asm_lineno, ecoff_stab, ecoff_separate_stab_sections, - 0, /* init_stab_section */ + 0, /* init_stab_section. */ ecoff_sec_sym_ok_for_reloc, ecoff_pop_insert, ecoff_set_ext, diff --git a/contrib/binutils/gas/config/obj-ecoff.h b/contrib/binutils/gas/config/obj-ecoff.h index 54ee0438db3..fdec4bc1428 100644 --- a/contrib/binutils/gas/config/obj-ecoff.h +++ b/contrib/binutils/gas/config/obj-ecoff.h @@ -1,5 +1,5 @@ /* ECOFF object file format header file. - Copyright 1993, 1994, 1995, 1996, 1997, 1999, 2002 + Copyright 1993, 1994, 1995, 1996, 1997, 1999, 2002, 2004, 2005 Free Software Foundation, Inc. Contributed by Cygnus Support. Written by Ian Lance Taylor . @@ -18,8 +18,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #define OBJ_ECOFF 1 @@ -50,12 +50,10 @@ struct ecoff_sy_obj #define obj_frob_symbol(symp, punt) ecoff_frob_symbol (symp) /* Set section VMAs and GP. */ -extern void ecoff_frob_file_before_fix PARAMS ((void)); #define obj_frob_file_before_fix() ecoff_frob_file_before_fix () /* This is used to write the symbolic data in the format that BFD expects it. */ -extern void ecoff_frob_file PARAMS ((void)); #define obj_frob_file() ecoff_frob_file () /* We use the ECOFF functions as our hooks. */ @@ -63,7 +61,7 @@ extern void ecoff_frob_file PARAMS ((void)); #define obj_symbol_new_hook ecoff_symbol_new_hook /* Record file switches in the ECOFF symbol table. */ -#define obj_app_file(name) ecoff_new_file (name) +#define obj_app_file(name, app) ecoff_new_file (name, app) /* At the moment we don't want to do any stabs processing in read.c. */ #define OBJ_PROCESS_STAB(seg, what, string, type, other, desc) \ @@ -73,4 +71,7 @@ extern void ecoff_frob_file PARAMS ((void)); #define obj_sec_sym_ok_for_reloc(SEC) 1 #define obj_ecoff_set_ext ecoff_set_ext -extern void obj_ecoff_set_ext PARAMS ((symbolS *, EXTR *)); + +extern void ecoff_frob_file_before_fix (void); +extern void ecoff_frob_file (void); +extern void obj_ecoff_set_ext (symbolS *, EXTR *); diff --git a/contrib/binutils/gas/config/obj-elf.c b/contrib/binutils/gas/config/obj-elf.c index 14d48f2ee74..f922149cae0 100644 --- a/contrib/binutils/gas/config/obj-elf.c +++ b/contrib/binutils/gas/config/obj-elf.c @@ -1,6 +1,6 @@ /* ELF object file format Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003 Free Software Foundation, Inc. + 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -16,8 +16,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #define OBJ_HEADER "obj-elf.h" #include "as.h" @@ -53,6 +53,10 @@ #include "elf/i370.h" #endif +#ifdef TC_I386 +#include "elf/x86-64.h" +#endif + static void obj_elf_line (int); static void obj_elf_size (int); static void obj_elf_type (int); @@ -65,6 +69,7 @@ static void obj_elf_subsection (int); static void obj_elf_popsection (int); static void obj_elf_tls_common (int); static void obj_elf_lcomm (int); +static void obj_elf_struct (int); static const pseudo_typeS elf_pseudo_table[] = { @@ -110,9 +115,12 @@ static const pseudo_typeS elf_pseudo_table[] = /* These are used for dwarf2. */ { "file", (void (*) (int)) dwarf2_directive_file, 0 }, { "loc", dwarf2_directive_loc, 0 }, + { "loc_mark_labels", dwarf2_directive_loc_mark_labels, 0 }, /* We need to trap the section changing calls to handle .previous. */ {"data", obj_elf_data, 0}, + {"offset", obj_elf_struct, 0}, + {"struct", obj_elf_struct, 0}, {"text", obj_elf_text, 0}, {"tls_common", obj_elf_tls_common, 0}, @@ -171,6 +179,8 @@ static const pseudo_typeS ecoff_debug_pseudo_table[] = /* This is called when the assembler starts. */ +asection *elf_com_section_ptr; + void elf_begin (void) { @@ -183,6 +193,7 @@ elf_begin (void) symbol_table_insert (section_symbol (s)); s = bfd_get_section_by_name (stdoutput, BSS_SECTION_NAME); symbol_table_insert (section_symbol (s)); + elf_com_section_ptr = bfd_com_section_ptr; } void @@ -236,32 +247,38 @@ elf_sec_sym_ok_for_reloc (asection *sec) } void -elf_file_symbol (const char *s) +elf_file_symbol (const char *s, int appfile) { - symbolS *sym; - - sym = symbol_new (s, absolute_section, 0, NULL); - symbol_set_frag (sym, &zero_address_frag); - symbol_get_bfdsym (sym)->flags |= BSF_FILE; - - if (symbol_rootP != sym) + if (!appfile + || symbol_rootP == NULL + || symbol_rootP->bsym == NULL + || (symbol_rootP->bsym->flags & BSF_FILE) == 0) { - symbol_remove (sym, &symbol_rootP, &symbol_lastP); - symbol_insert (sym, symbol_rootP, &symbol_rootP, &symbol_lastP); + symbolS *sym; + + sym = symbol_new (s, absolute_section, 0, NULL); + symbol_set_frag (sym, &zero_address_frag); + symbol_get_bfdsym (sym)->flags |= BSF_FILE; + + if (symbol_rootP != sym) + { + symbol_remove (sym, &symbol_rootP, &symbol_lastP); + symbol_insert (sym, symbol_rootP, &symbol_rootP, &symbol_lastP); #ifdef DEBUG - verify_symbol_chain (symbol_rootP, symbol_lastP); + verify_symbol_chain (symbol_rootP, symbol_lastP); #endif + } } #ifdef NEED_ECOFF_DEBUG - ecoff_new_file (s); + ecoff_new_file (s, appfile); #endif } /* Called from read.c:s_comm after we've parsed .comm symbol, size. Parse a possible alignment value. */ -static symbolS * +symbolS * elf_common_parse (int ignore ATTRIBUTE_UNUSED, symbolS *symbolP, addressT size) { addressT align = 0; @@ -325,7 +342,7 @@ elf_common_parse (int ignore ATTRIBUTE_UNUSED, symbolS *symbolP, addressT size) S_SET_VALUE (symbolP, size); S_SET_ALIGN (symbolP, align); S_SET_EXTERNAL (symbolP); - S_SET_SEGMENT (symbolP, bfd_com_section_ptr); + S_SET_SEGMENT (symbolP, elf_com_section_ptr); } symbol_get_bfdsym (symbolP)->flags |= BSF_OBJECT; @@ -469,6 +486,18 @@ struct section_stack static struct section_stack *section_stack; +static bfd_boolean +get_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, void *inf) +{ + const char *gname = inf; + const char *group_name = elf_group_name (sec); + + return (group_name == gname + || (group_name != NULL + && gname != NULL + && strcmp (group_name, gname) == 0)); +} + /* Handle the .section pseudo-op. This code supports two different syntaxes. @@ -499,6 +528,7 @@ obj_elf_change_section (const char *name, asection *old_sec; segT sec; flagword flags; + const struct elf_backend_data *bed; const struct bfd_elf_special_section *ssect; #ifdef md_flush_pending_output @@ -520,9 +550,18 @@ obj_elf_change_section (const char *name, previous_section = now_seg; previous_subsection = now_subseg; - old_sec = bfd_get_section_by_name (stdoutput, name); - sec = subseg_new (name, 0); - ssect = _bfd_elf_get_sec_type_attr (stdoutput, name); + old_sec = bfd_get_section_by_name_if (stdoutput, name, get_section, + (void *) group_name); + if (old_sec) + { + sec = old_sec; + subseg_set (sec, 0); + } + else + sec = subseg_force_new (name, 0); + + bed = get_elf_backend_data (stdoutput); + ssect = (*bed->get_sec_type_attr) (stdoutput, sec); if (ssect != NULL) { @@ -538,7 +577,16 @@ obj_elf_change_section (const char *name, .section .init_array,"aw",@progbits for __attribute__ ((section (".init_array"))). + "@progbits" is incorrect. Also for x86-64 large bss + sections, gcc, as of 2005-07-06, will emit + + .section .lbss,"aw",@progbits + "@progbits" is incorrect. */ +#ifdef TC_I386 + && (bed->s->arch_size != 64 + || !(ssect->attr & SHF_X86_64_LARGE)) +#endif && ssect->type != SHT_INIT_ARRAY && ssect->type != SHT_FINI_ARRAY && ssect->type != SHT_PREINIT_ARRAY) @@ -580,10 +628,15 @@ obj_elf_change_section (const char *name, || strcmp (name, ".strtab") == 0 || strcmp (name, ".symtab") == 0)) override = TRUE; + /* .note.GNU-stack can have SHF_EXECINSTR. */ + else if (attr == SHF_EXECINSTR + && strcmp (name, ".note.GNU-stack") == 0) + override = TRUE; else { - as_warn (_("setting incorrect section attributes for %s"), - name); + if (group_name == NULL) + as_warn (_("setting incorrect section attributes for %s"), + name); override = TRUE; } } @@ -591,11 +644,6 @@ obj_elf_change_section (const char *name, attr |= ssect->attr; } - if (type != SHT_NULL) - elf_section_type (sec) = type; - if (attr != 0) - elf_section_flags (sec) = attr; - /* Convert ELF type and flags to BFD flags. */ flags = (SEC_RELOC | ((attr & SHF_WRITE) ? 0 : SEC_READONLY) @@ -609,16 +657,20 @@ obj_elf_change_section (const char *name, flags = md_elf_section_flags (flags, attr, type); #endif + if (linkonce) + flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD; + if (old_sec == NULL) { symbolS *secsym; + elf_section_type (sec) = type; + elf_section_flags (sec) = attr; + /* Prevent SEC_HAS_CONTENTS from being inadvertently set. */ if (type == SHT_NOBITS) seg_info (sec)->bss = 1; - if (linkonce) - flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD; bfd_set_section_flags (stdoutput, sec, flags); if (flags & SEC_MERGE) sec->entsize = entsize; @@ -631,22 +683,26 @@ obj_elf_change_section (const char *name, else symbol_table_insert (section_symbol (sec)); } - else if (attr != 0) + else { - /* If section attributes are specified the second time we see a - particular section, then check that they are the same as we - saw the first time. */ - if (((old_sec->flags ^ flags) - & (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE - | SEC_EXCLUDE | SEC_SORT_ENTRIES | SEC_MERGE | SEC_STRINGS - | SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD - | SEC_THREAD_LOCAL))) - as_warn (_("ignoring changed section attributes for %s"), name); - if ((flags & SEC_MERGE) && old_sec->entsize != (unsigned) entsize) - as_warn (_("ignoring changed section entity size for %s"), name); - if ((attr & SHF_GROUP) != 0 - && strcmp (elf_group_name (old_sec), group_name) != 0) - as_warn (_("ignoring new section group for %s"), name); + if (type != SHT_NULL + && (unsigned) type != elf_section_type (old_sec)) + as_warn (_("ignoring changed section type for %s"), name); + + if (attr != 0) + { + /* If section attributes are specified the second time we see a + particular section, then check that they are the same as we + saw the first time. */ + if (((old_sec->flags ^ flags) + & (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE + | SEC_EXCLUDE | SEC_SORT_ENTRIES | SEC_MERGE | SEC_STRINGS + | SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD + | SEC_THREAD_LOCAL))) + as_warn (_("ignoring changed section attributes for %s"), name); + if ((flags & SEC_MERGE) && old_sec->entsize != (unsigned) entsize) + as_warn (_("ignoring changed section entity size for %s"), name); + } } #ifdef md_elf_section_change_hook @@ -748,6 +804,12 @@ obj_elf_section_type (char *str, size_t len) return SHT_NOBITS; if (len == 4 && strncmp (str, "note", 4) == 0) return SHT_NOTE; + if (len == 10 && strncmp (str, "init_array", 10) == 0) + return SHT_INIT_ARRAY; + if (len == 10 && strncmp (str, "fini_array", 10) == 0) + return SHT_FINI_ARRAY; + if (len == 13 && strncmp (str, "preinit_array", 13) == 0) + return SHT_PREINIT_ARRAY; #ifdef md_elf_section_type { @@ -996,6 +1058,24 @@ obj_elf_text (int i) #endif } +/* Change to the *ABS* section. */ + +void +obj_elf_struct (int i) +{ +#ifdef md_flush_pending_output + md_flush_pending_output (); +#endif + + previous_section = now_seg; + previous_subsection = now_subseg; + s_struct (i); + +#ifdef md_elf_section_change_hook + md_elf_section_change_hook (); +#endif +} + static void obj_elf_subsection (int ignore ATTRIBUTE_UNUSED) { @@ -1775,17 +1855,6 @@ elf_frob_symbol (symbolS *symp, int *puntp) && (symbol_get_bfdsym (symp)->flags & BSF_FUNCTION) == 0) symbol_get_bfdsym (symp)->flags |= BSF_OBJECT; #endif - -#if 0 /* TC_PPC */ - /* If TC_PPC is defined, we used to force the type of a symbol to be - BSF_OBJECT if it was otherwise unset. This was required by some - version of VxWorks. Thomas de Lellis says - that this is no longer needed, so it is now commented out. */ - if ((symbol_get_bfdsym (symp)->flags - & (BSF_FUNCTION | BSF_FILE | BSF_SECTION_SYM)) == 0 - && S_IS_DEFINED (symp)) - symbol_get_bfdsym (symp)->flags |= BSF_OBJECT; -#endif } struct group_list @@ -1864,6 +1933,7 @@ elf_frob_file (void) flagword flags; struct symbol *sy; int has_sym; + bfd_size_type size; flags = SEC_READONLY | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_GROUP; for (s = list.head[i]; s != NULL; s = elf_next_in_group (s)) @@ -1904,8 +1974,9 @@ elf_frob_file (void) if (has_sym) elf_group_id (s) = sy->bsym; - s->_raw_size = 4 * (list.elt_count[i] + 1); - s->contents = frag_more (s->_raw_size); + size = 4 * (list.elt_count[i] + 1); + bfd_set_section_size (stdoutput, s, size); + s->contents = (unsigned char *) frag_more (size); frag_now->fr_fix = frag_now_fix_octets (); } @@ -2014,7 +2085,8 @@ elf_frob_file_after_relocs (void) to force the ELF backend to allocate a file position, and then write out the data. FIXME: Is this really the best way to do this? */ - sec->_raw_size = bfd_ecoff_debug_size (stdoutput, &debug, debug_swap); + bfd_set_section_size + (stdoutput, sec, bfd_ecoff_debug_size (stdoutput, &debug, debug_swap)); /* Pass BUF to bfd_set_section_contents because this will eventually become a call to fwrite, and ISO C prohibits diff --git a/contrib/binutils/gas/config/obj-elf.h b/contrib/binutils/gas/config/obj-elf.h index e71379721a2..7ff9ef09aa3 100644 --- a/contrib/binutils/gas/config/obj-elf.h +++ b/contrib/binutils/gas/config/obj-elf.h @@ -1,6 +1,6 @@ /* ELF object file format. Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, - 2002, 2003 Free Software Foundation, Inc. + 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -16,8 +16,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ /* HP PA-RISC support was contributed by the Center for Software Science at the University of Utah. */ @@ -156,10 +156,17 @@ extern void elf_frob_file_before_adjust (void); #endif extern void elf_frob_file_after_relocs (void); +/* If the target doesn't have special processing for labels, take care of + dwarf2 output at the object file level. */ +#ifndef tc_frob_label +#include "dwarf2dbg.h" +#define obj_frob_label dwarf2_emit_label +#endif + #ifndef obj_app_file #define obj_app_file elf_file_symbol #endif -extern void elf_file_symbol (const char *); +extern void elf_file_symbol (const char *, int); extern void obj_elf_section_change_hook (void); @@ -241,10 +248,11 @@ extern void elf_pop_insert (void); #ifndef OBJ_MAYBE_ELF #define obj_ecoff_set_ext elf_ecoff_set_ext -#ifdef ANSI_PROTOTYPES struct ecoff_extr; -#endif extern void elf_ecoff_set_ext (symbolS *, struct ecoff_extr *); #endif +extern asection *elf_com_section_ptr; +extern symbolS * elf_common_parse (int ignore ATTRIBUTE_UNUSED, symbolS *symbolP, + addressT size); #endif /* _OBJ_ELF_H */ diff --git a/contrib/binutils/gas/config/obj-ieee.c b/contrib/binutils/gas/config/obj-ieee.c index 02f43393d68..bac46757c13 100644 --- a/contrib/binutils/gas/config/obj-ieee.c +++ b/contrib/binutils/gas/config/obj-ieee.c @@ -1,5 +1,5 @@ /* obj-format for ieee-695 records. - Copyright 1991, 1992, 1993, 1994, 1997, 2000 + Copyright 1991, 1992, 1993, 1994, 1997, 2000, 2001, 2002, 2003, 2005 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -16,8 +16,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ /* Created by Steve Chamberlain . */ @@ -209,12 +209,6 @@ do_relocs_for (idx) reloc_ptr_vector[i] = to; to->howto = (reloc_howto_type *) (from->fx_r_type); -#if 0 - /* We can't represent complicated things in a reloc yet. */ - if (from->fx_addsy == 0 || from->fx_subsy != 0) - abort (); -#endif - s = &(from->fx_addsy->sy_symbol.sy); to->address = ((char *) (from->fx_frag->fr_address + from->fx_where)) @@ -561,21 +555,7 @@ write_object_file () fragS **prev_frag_ptr_ptr; struct frchain *next_frchain_ptr; -#if 0 - struct frag **head_ptr = segment_info[i].frag_root; -#endif - segment_info[i].frag_root = segment_info[i].frchainP->frch_root; -#if 0 - /* I'm not sure what this is for. */ - for (frchain_ptr = segment_info[i].frchainP->frch_root; - frchain_ptr != (struct frchain *) NULL; - frchain_ptr = frchain_ptr->frch_next) - { - *head_ptr = frchain_ptr; - head_ptr = &frchain_ptr->next; - } -#endif } for (i = SEG_E0; i < SEG_UNKNOWN; i++) diff --git a/contrib/binutils/gas/config/obj-ieee.h b/contrib/binutils/gas/config/obj-ieee.h index c0bd628a544..29654296e83 100644 --- a/contrib/binutils/gas/config/obj-ieee.h +++ b/contrib/binutils/gas/config/obj-ieee.h @@ -16,10 +16,8 @@ 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 BFD 1 + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #include "bfd.h" @@ -43,8 +41,6 @@ typedef struct } object_headers; -#define DEFAULT_MAGIC_NUMBER_FOR_OBJECT_FILE 1 - int lineno_rootP; #define IEEE_STYLE diff --git a/contrib/binutils/gas/config/obj-multi.h b/contrib/binutils/gas/config/obj-multi.h index 37d9fe828b4..70faf103be7 100644 --- a/contrib/binutils/gas/config/obj-multi.h +++ b/contrib/binutils/gas/config/obj-multi.h @@ -1,5 +1,5 @@ /* Multiple object format emulation. - Copyright 1995, 1996, 1997, 1999, 2000, 2002 + Copyright 1995, 1996, 1997, 1999, 2000, 2002, 2004 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -16,8 +16,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #ifndef _OBJ_MULTI_H #define _OBJ_MULTI_H @@ -37,9 +37,9 @@ ? (*this_format->begin) () \ : (void) 0) -#define obj_app_file(NAME) \ +#define obj_app_file(NAME, APPFILE) \ (this_format->app_file \ - ? (*this_format->app_file) (NAME) \ + ? (*this_format->app_file) (NAME, APPFILE) \ : (void) 0) #define obj_frob_symbol(S,P) \ @@ -146,6 +146,8 @@ #define EMIT_SECTION_SYMBOLS (this_format->emit_section_symbols) +#define FAKE_LABEL_NAME (this_emulation->fake_label_name) + #ifdef OBJ_MAYBE_ELF /* We need OBJ_SYMFIELD_TYPE so that symbol_get_obj is defined in symbol.c We also need various STAB defines for stab.c */ diff --git a/contrib/binutils/gas/config/tc-alpha.c b/contrib/binutils/gas/config/tc-alpha.c index 93600473ffc..3765b08c73a 100644 --- a/contrib/binutils/gas/config/tc-alpha.c +++ b/contrib/binutils/gas/config/tc-alpha.c @@ -1,6 +1,6 @@ /* tc-alpha.c - Processor-specific code for the DEC Alpha AXP CPU. Copyright 1989, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003 Free Software Foundation, Inc. + 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. Contributed by Carnegie Mellon University, 1993. Written by Alessandro Forin, based on earlier gas-1.38 target CPU files. Modified by Ken Raeburn for gas-2.x and ECOFF support. @@ -21,34 +21,32 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ -/* - * Mach Operating System - * Copyright (c) 1993 Carnegie Mellon University - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ +/* Mach Operating System + Copyright (c) 1993 Carnegie Mellon University + All Rights Reserved. + + Permission to use, copy, modify and distribute this software and its + documentation is hereby granted, provided that both the copyright + notice and this permission notice appear in all copies of the + software, derivative works or modified versions, and any portions + thereof, and that both notices appear in supporting documentation. + + CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS + CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR + ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + + Carnegie Mellon requests users of this software to return to + + Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU + School of Computer Science + Carnegie Mellon University + Pittsburgh PA 15213-3890 + + any improvements or extensions that they make and grant Carnegie the + rights to redistribute these changes. */ #include "as.h" #include "subsegs.h" @@ -60,18 +58,17 @@ #ifdef OBJ_ELF #include "elf/alpha.h" #include "dwarf2dbg.h" -#include "dw2gencfi.h" #endif +#include "dw2gencfi.h" #include "safe-ctype.h" /* Local types. */ -#define TOKENIZE_ERROR -1 -#define TOKENIZE_ERROR_REPORT -2 - -#define MAX_INSN_FIXUPS 2 -#define MAX_INSN_ARGS 5 +#define TOKENIZE_ERROR -1 +#define TOKENIZE_ERROR_REPORT -2 +#define MAX_INSN_FIXUPS 2 +#define MAX_INSN_ARGS 5 struct alpha_fixup { @@ -101,39 +98,40 @@ enum alpha_macro_arg struct alpha_macro { const char *name; - void (*emit) PARAMS ((const expressionS *, int, const PTR)); - const PTR arg; + void (*emit) (const expressionS *, int, const void *); + const void * arg; enum alpha_macro_arg argsets[16]; }; /* Extra expression types. */ -#define O_pregister O_md1 /* O_register, in parentheses */ -#define O_cpregister O_md2 /* + a leading comma */ +#define O_pregister O_md1 /* O_register, in parentheses. */ +#define O_cpregister O_md2 /* + a leading comma. */ /* The alpha_reloc_op table below depends on the ordering of these. */ -#define O_literal O_md3 /* !literal relocation */ -#define O_lituse_addr O_md4 /* !lituse_addr relocation */ -#define O_lituse_base O_md5 /* !lituse_base relocation */ -#define O_lituse_bytoff O_md6 /* !lituse_bytoff relocation */ -#define O_lituse_jsr O_md7 /* !lituse_jsr relocation */ -#define O_lituse_tlsgd O_md8 /* !lituse_tlsgd relocation */ -#define O_lituse_tlsldm O_md9 /* !lituse_tlsldm relocation */ -#define O_gpdisp O_md10 /* !gpdisp relocation */ -#define O_gprelhigh O_md11 /* !gprelhigh relocation */ -#define O_gprellow O_md12 /* !gprellow relocation */ -#define O_gprel O_md13 /* !gprel relocation */ -#define O_samegp O_md14 /* !samegp relocation */ -#define O_tlsgd O_md15 /* !tlsgd relocation */ -#define O_tlsldm O_md16 /* !tlsldm relocation */ -#define O_gotdtprel O_md17 /* !gotdtprel relocation */ -#define O_dtprelhi O_md18 /* !dtprelhi relocation */ -#define O_dtprello O_md19 /* !dtprello relocation */ -#define O_dtprel O_md20 /* !dtprel relocation */ -#define O_gottprel O_md21 /* !gottprel relocation */ -#define O_tprelhi O_md22 /* !tprelhi relocation */ -#define O_tprello O_md23 /* !tprello relocation */ -#define O_tprel O_md24 /* !tprel relocation */ +#define O_literal O_md3 /* !literal relocation. */ +#define O_lituse_addr O_md4 /* !lituse_addr relocation. */ +#define O_lituse_base O_md5 /* !lituse_base relocation. */ +#define O_lituse_bytoff O_md6 /* !lituse_bytoff relocation. */ +#define O_lituse_jsr O_md7 /* !lituse_jsr relocation. */ +#define O_lituse_tlsgd O_md8 /* !lituse_tlsgd relocation. */ +#define O_lituse_tlsldm O_md9 /* !lituse_tlsldm relocation. */ +#define O_lituse_jsrdirect O_md10 /* !lituse_jsrdirect relocation. */ +#define O_gpdisp O_md11 /* !gpdisp relocation. */ +#define O_gprelhigh O_md12 /* !gprelhigh relocation. */ +#define O_gprellow O_md13 /* !gprellow relocation. */ +#define O_gprel O_md14 /* !gprel relocation. */ +#define O_samegp O_md15 /* !samegp relocation. */ +#define O_tlsgd O_md16 /* !tlsgd relocation. */ +#define O_tlsldm O_md17 /* !tlsldm relocation. */ +#define O_gotdtprel O_md18 /* !gotdtprel relocation. */ +#define O_dtprelhi O_md19 /* !dtprelhi relocation. */ +#define O_dtprello O_md20 /* !dtprello relocation. */ +#define O_dtprel O_md21 /* !dtprel relocation. */ +#define O_gottprel O_md22 /* !gottprel relocation. */ +#define O_tprelhi O_md23 /* !tprelhi relocation. */ +#define O_tprello O_md24 /* !tprello relocation. */ +#define O_tprel O_md25 /* !tprel relocation. */ #define DUMMY_RELOC_LITUSE_ADDR (BFD_RELOC_UNUSED + 1) #define DUMMY_RELOC_LITUSE_BASE (BFD_RELOC_UNUSED + 2) @@ -141,6 +139,7 @@ struct alpha_macro #define DUMMY_RELOC_LITUSE_JSR (BFD_RELOC_UNUSED + 4) #define DUMMY_RELOC_LITUSE_TLSGD (BFD_RELOC_UNUSED + 5) #define DUMMY_RELOC_LITUSE_TLSLDM (BFD_RELOC_UNUSED + 6) +#define DUMMY_RELOC_LITUSE_JSRDIRECT (BFD_RELOC_UNUSED + 7) #define USER_RELOC_P(R) ((R) >= O_literal && (R) <= O_tprel) @@ -206,89 +205,6 @@ struct alpha_macro (t).X_op = O_constant, \ (t).X_add_number = (n)) -/* Prototypes for all local functions. */ - -static struct alpha_reloc_tag *get_alpha_reloc_tag PARAMS ((long)); -static void alpha_adjust_relocs PARAMS ((bfd *, asection *, PTR)); - -static int tokenize_arguments PARAMS ((char *, expressionS *, int)); -static const struct alpha_opcode *find_opcode_match - PARAMS ((const struct alpha_opcode *, const expressionS *, int *, int *)); -static const struct alpha_macro *find_macro_match - PARAMS ((const struct alpha_macro *, const expressionS *, int *)); -static unsigned insert_operand - PARAMS ((unsigned, const struct alpha_operand *, offsetT, char *, unsigned)); -static void assemble_insn - PARAMS ((const struct alpha_opcode *, const expressionS *, int, - struct alpha_insn *, bfd_reloc_code_real_type)); -static void emit_insn PARAMS ((struct alpha_insn *)); -static void assemble_tokens_to_insn - PARAMS ((const char *, const expressionS *, int, struct alpha_insn *)); -static void assemble_tokens - PARAMS ((const char *, const expressionS *, int, int)); - -static long load_expression - PARAMS ((int, const expressionS *, int *, expressionS *)); - -static void emit_ldgp PARAMS ((const expressionS *, int, const PTR)); -static void emit_division PARAMS ((const expressionS *, int, const PTR)); -static void emit_lda PARAMS ((const expressionS *, int, const PTR)); -static void emit_ldah PARAMS ((const expressionS *, int, const PTR)); -static void emit_ir_load PARAMS ((const expressionS *, int, const PTR)); -static void emit_loadstore PARAMS ((const expressionS *, int, const PTR)); -static void emit_jsrjmp PARAMS ((const expressionS *, int, const PTR)); -static void emit_ldX PARAMS ((const expressionS *, int, const PTR)); -static void emit_ldXu PARAMS ((const expressionS *, int, const PTR)); -static void emit_uldX PARAMS ((const expressionS *, int, const PTR)); -static void emit_uldXu PARAMS ((const expressionS *, int, const PTR)); -static void emit_ldil PARAMS ((const expressionS *, int, const PTR)); -static void emit_stX PARAMS ((const expressionS *, int, const PTR)); -static void emit_ustX PARAMS ((const expressionS *, int, const PTR)); -static void emit_sextX PARAMS ((const expressionS *, int, const PTR)); -static void emit_retjcr PARAMS ((const expressionS *, int, const PTR)); - -static void s_alpha_text PARAMS ((int)); -static void s_alpha_data PARAMS ((int)); -#ifndef OBJ_ELF -static void s_alpha_comm PARAMS ((int)); -static void s_alpha_rdata PARAMS ((int)); -#endif -#ifdef OBJ_ECOFF -static void s_alpha_sdata PARAMS ((int)); -#endif -#ifdef OBJ_ELF -static void s_alpha_section PARAMS ((int)); -static void s_alpha_ent PARAMS ((int)); -static void s_alpha_end PARAMS ((int)); -static void s_alpha_mask PARAMS ((int)); -static void s_alpha_frame PARAMS ((int)); -static void s_alpha_prologue PARAMS ((int)); -static void s_alpha_file PARAMS ((int)); -static void s_alpha_loc PARAMS ((int)); -static void s_alpha_stab PARAMS ((int)); -static void s_alpha_coff_wrapper PARAMS ((int)); -static void s_alpha_usepv PARAMS ((int)); -#endif -#ifdef OBJ_EVAX -static void s_alpha_section PARAMS ((int)); -#endif -static void s_alpha_gprel32 PARAMS ((int)); -static void s_alpha_float_cons PARAMS ((int)); -static void s_alpha_proc PARAMS ((int)); -static void s_alpha_set PARAMS ((int)); -static void s_alpha_base PARAMS ((int)); -static void s_alpha_align PARAMS ((int)); -static void s_alpha_stringer PARAMS ((int)); -static void s_alpha_space PARAMS ((int)); -static void s_alpha_ucons PARAMS ((int)); -static void s_alpha_arch PARAMS ((int)); - -static void create_literal_section PARAMS ((const char *, segT *, symbolS **)); -#ifndef OBJ_ELF -static void select_gp_value PARAMS ((void)); -#endif -static void alpha_align PARAMS ((int, char *, symbolS *, int)); - /* Generic assembler global variables which must be defined by all targets. */ @@ -308,12 +224,8 @@ const char EXP_CHARS[] = "eE"; /* Characters which mean that a number is a floating point constant, as in 0d1.0. */ -#if 0 -const char FLT_CHARS[] = "dD"; -#else /* XXX: Do all of these really get used on the alpha?? */ char FLT_CHARS[] = "rRsSfFdDxXpP"; -#endif #ifdef OBJ_EVAX const char *md_shortopts = "Fm:g+1h:HG:"; @@ -454,11 +366,12 @@ static int g_switch_value = 8; #ifdef OBJ_EVAX /* Collect information about current procedure here. */ -static struct { - symbolS *symbol; /* proc pdesc symbol */ +static struct +{ + symbolS *symbol; /* Proc pdesc symbol. */ int pdsckind; - int framereg; /* register for frame pointer */ - int framesize; /* size of frame */ + int framereg; /* Register for frame pointer. */ + int framesize; /* Size of frame. */ int rsa_offset; int ra_save; int fp_save; @@ -491,37 +404,38 @@ static int alpha_flag_show_after_trunc = 0; /* -H */ static const struct alpha_reloc_op_tag { - const char *name; /* string to lookup */ - size_t length; /* size of the string */ - operatorT op; /* which operator to use */ - bfd_reloc_code_real_type reloc; /* relocation before frob */ - unsigned int require_seq : 1; /* require a sequence number */ - unsigned int allow_seq : 1; /* allow a sequence number */ + const char *name; /* String to lookup. */ + size_t length; /* Size of the string. */ + operatorT op; /* Which operator to use. */ + bfd_reloc_code_real_type reloc; /* Relocation before frob. */ + unsigned int require_seq : 1; /* Require a sequence number. */ + unsigned int allow_seq : 1; /* Allow a sequence number. */ } alpha_reloc_op[] = { - DEF(literal, BFD_RELOC_ALPHA_ELF_LITERAL, 0, 1), - DEF(lituse_addr, DUMMY_RELOC_LITUSE_ADDR, 1, 1), - DEF(lituse_base, DUMMY_RELOC_LITUSE_BASE, 1, 1), - DEF(lituse_bytoff, DUMMY_RELOC_LITUSE_BYTOFF, 1, 1), - DEF(lituse_jsr, DUMMY_RELOC_LITUSE_JSR, 1, 1), - DEF(lituse_tlsgd, DUMMY_RELOC_LITUSE_TLSGD, 1, 1), - DEF(lituse_tlsldm, DUMMY_RELOC_LITUSE_TLSLDM, 1, 1), - DEF(gpdisp, BFD_RELOC_ALPHA_GPDISP, 1, 1), - DEF(gprelhigh, BFD_RELOC_ALPHA_GPREL_HI16, 0, 0), - DEF(gprellow, BFD_RELOC_ALPHA_GPREL_LO16, 0, 0), - DEF(gprel, BFD_RELOC_GPREL16, 0, 0), - DEF(samegp, BFD_RELOC_ALPHA_BRSGP, 0, 0), - DEF(tlsgd, BFD_RELOC_ALPHA_TLSGD, 0, 1), - DEF(tlsldm, BFD_RELOC_ALPHA_TLSLDM, 0, 1), - DEF(gotdtprel, BFD_RELOC_ALPHA_GOTDTPREL16, 0, 0), - DEF(dtprelhi, BFD_RELOC_ALPHA_DTPREL_HI16, 0, 0), - DEF(dtprello, BFD_RELOC_ALPHA_DTPREL_LO16, 0, 0), - DEF(dtprel, BFD_RELOC_ALPHA_DTPREL16, 0, 0), - DEF(gottprel, BFD_RELOC_ALPHA_GOTTPREL16, 0, 0), - DEF(tprelhi, BFD_RELOC_ALPHA_TPREL_HI16, 0, 0), - DEF(tprello, BFD_RELOC_ALPHA_TPREL_LO16, 0, 0), - DEF(tprel, BFD_RELOC_ALPHA_TPREL16, 0, 0), + DEF (literal, BFD_RELOC_ALPHA_ELF_LITERAL, 0, 1), + DEF (lituse_addr, DUMMY_RELOC_LITUSE_ADDR, 1, 1), + DEF (lituse_base, DUMMY_RELOC_LITUSE_BASE, 1, 1), + DEF (lituse_bytoff, DUMMY_RELOC_LITUSE_BYTOFF, 1, 1), + DEF (lituse_jsr, DUMMY_RELOC_LITUSE_JSR, 1, 1), + DEF (lituse_tlsgd, DUMMY_RELOC_LITUSE_TLSGD, 1, 1), + DEF (lituse_tlsldm, DUMMY_RELOC_LITUSE_TLSLDM, 1, 1), + DEF (lituse_jsrdirect, DUMMY_RELOC_LITUSE_JSRDIRECT, 1, 1), + DEF (gpdisp, BFD_RELOC_ALPHA_GPDISP, 1, 1), + DEF (gprelhigh, BFD_RELOC_ALPHA_GPREL_HI16, 0, 0), + DEF (gprellow, BFD_RELOC_ALPHA_GPREL_LO16, 0, 0), + DEF (gprel, BFD_RELOC_GPREL16, 0, 0), + DEF (samegp, BFD_RELOC_ALPHA_BRSGP, 0, 0), + DEF (tlsgd, BFD_RELOC_ALPHA_TLSGD, 0, 1), + DEF (tlsldm, BFD_RELOC_ALPHA_TLSLDM, 0, 1), + DEF (gotdtprel, BFD_RELOC_ALPHA_GOTDTPREL16, 0, 0), + DEF (dtprelhi, BFD_RELOC_ALPHA_DTPREL_HI16, 0, 0), + DEF (dtprello, BFD_RELOC_ALPHA_DTPREL_LO16, 0, 0), + DEF (dtprel, BFD_RELOC_ALPHA_DTPREL16, 0, 0), + DEF (gottprel, BFD_RELOC_ALPHA_GOTTPREL16, 0, 0), + DEF (tprelhi, BFD_RELOC_ALPHA_TPREL_HI16, 0, 0), + DEF (tprello, BFD_RELOC_ALPHA_TPREL_LO16, 0, 0), + DEF (tprel, BFD_RELOC_ALPHA_TPREL16, 0, 0), }; #undef DEF @@ -530,27 +444,27 @@ static const int alpha_num_reloc_op = sizeof (alpha_reloc_op) / sizeof (*alpha_reloc_op); #endif /* RELOC_OP_P */ -/* Maximum # digits needed to hold the largest sequence # */ +/* Maximum # digits needed to hold the largest sequence #. */ #define ALPHA_RELOC_DIGITS 25 /* Structure to hold explicit sequence information. */ struct alpha_reloc_tag { - fixS *master; /* the literal reloc */ - fixS *slaves; /* head of linked list of lituses */ - segT segment; /* segment relocs are in or undefined_section*/ - long sequence; /* sequence # */ - unsigned n_master; /* # of literals */ - unsigned n_slaves; /* # of lituses */ - unsigned saw_tlsgd : 1; /* true if ... */ + fixS *master; /* The literal reloc. */ + fixS *slaves; /* Head of linked list of lituses. */ + segT segment; /* Segment relocs are in or undefined_section. */ + long sequence; /* Sequence #. */ + unsigned n_master; /* # of literals. */ + unsigned n_slaves; /* # of lituses. */ + unsigned saw_tlsgd : 1; /* True if ... */ unsigned saw_tlsldm : 1; unsigned saw_lu_tlsgd : 1; unsigned saw_lu_tlsldm : 1; - unsigned multi_section_p : 1; /* true if more than one section was used */ - char string[1]; /* printable form of sequence to hash with */ + unsigned multi_section_p : 1; /* True if more than one section was used. */ + char string[1]; /* Printable form of sequence to hash with. */ }; -/* Hash table to link up literals with the appropriate lituse */ +/* Hash table to link up literals with the appropriate lituse. */ static struct hash_control *alpha_literal_hash; /* Sequence numbers for internal use by macros. */ @@ -599,1075 +513,23 @@ cpu_types[] = { 0, 0 } }; -/* The macro table */ - -static const struct alpha_macro alpha_macros[] = -{ -/* Load/Store macros */ - { "lda", emit_lda, NULL, - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "ldah", emit_ldah, NULL, - { MACRO_IR, MACRO_EXP, MACRO_EOA } }, - - { "ldl", emit_ir_load, "ldl", - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "ldl_l", emit_ir_load, "ldl_l", - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "ldq", emit_ir_load, "ldq", - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "ldq_l", emit_ir_load, "ldq_l", - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "ldq_u", emit_ir_load, "ldq_u", - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "ldf", emit_loadstore, "ldf", - { MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "ldg", emit_loadstore, "ldg", - { MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "lds", emit_loadstore, "lds", - { MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "ldt", emit_loadstore, "ldt", - { MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - - { "ldb", emit_ldX, (PTR) 0, - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "ldbu", emit_ldXu, (PTR) 0, - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "ldw", emit_ldX, (PTR) 1, - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "ldwu", emit_ldXu, (PTR) 1, - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - - { "uldw", emit_uldX, (PTR) 1, - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "uldwu", emit_uldXu, (PTR) 1, - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "uldl", emit_uldX, (PTR) 2, - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "uldlu", emit_uldXu, (PTR) 2, - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "uldq", emit_uldXu, (PTR) 3, - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - - { "ldgp", emit_ldgp, NULL, - { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA } }, - - { "ldi", emit_lda, NULL, - { MACRO_IR, MACRO_EXP, MACRO_EOA } }, - { "ldil", emit_ldil, NULL, - { MACRO_IR, MACRO_EXP, MACRO_EOA } }, - { "ldiq", emit_lda, NULL, - { MACRO_IR, MACRO_EXP, MACRO_EOA } }, -#if 0 - { "ldif" emit_ldiq, NULL, - { MACRO_FPR, MACRO_EXP, MACRO_EOA } }, - { "ldid" emit_ldiq, NULL, - { MACRO_FPR, MACRO_EXP, MACRO_EOA } }, - { "ldig" emit_ldiq, NULL, - { MACRO_FPR, MACRO_EXP, MACRO_EOA } }, - { "ldis" emit_ldiq, NULL, - { MACRO_FPR, MACRO_EXP, MACRO_EOA } }, - { "ldit" emit_ldiq, NULL, - { MACRO_FPR, MACRO_EXP, MACRO_EOA } }, -#endif - - { "stl", emit_loadstore, "stl", - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "stl_c", emit_loadstore, "stl_c", - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "stq", emit_loadstore, "stq", - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "stq_c", emit_loadstore, "stq_c", - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "stq_u", emit_loadstore, "stq_u", - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "stf", emit_loadstore, "stf", - { MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "stg", emit_loadstore, "stg", - { MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "sts", emit_loadstore, "sts", - { MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "stt", emit_loadstore, "stt", - { MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - - { "stb", emit_stX, (PTR) 0, - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "stw", emit_stX, (PTR) 1, - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "ustw", emit_ustX, (PTR) 1, - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "ustl", emit_ustX, (PTR) 2, - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - { "ustq", emit_ustX, (PTR) 3, - { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, - -/* Arithmetic macros */ -#if 0 - { "absl" emit_absl, 1, { IR } }, - { "absl" emit_absl, 2, { IR, IR } }, - { "absl" emit_absl, 2, { EXP, IR } }, - { "absq" emit_absq, 1, { IR } }, - { "absq" emit_absq, 2, { IR, IR } }, - { "absq" emit_absq, 2, { EXP, IR } }, -#endif - - { "sextb", emit_sextX, (PTR) 0, - { MACRO_IR, MACRO_IR, MACRO_EOA, - MACRO_IR, MACRO_EOA, - /* MACRO_EXP, MACRO_IR, MACRO_EOA */ } }, - { "sextw", emit_sextX, (PTR) 1, - { MACRO_IR, MACRO_IR, MACRO_EOA, - MACRO_IR, MACRO_EOA, - /* MACRO_EXP, MACRO_IR, MACRO_EOA */ } }, - - { "divl", emit_division, "__divl", - { MACRO_IR, MACRO_IR, MACRO_IR, MACRO_EOA, - MACRO_IR, MACRO_IR, MACRO_EOA, - /* MACRO_IR, MACRO_EXP, MACRO_IR, MACRO_EOA, - MACRO_IR, MACRO_EXP, MACRO_EOA */ } }, - { "divlu", emit_division, "__divlu", - { MACRO_IR, MACRO_IR, MACRO_IR, MACRO_EOA, - MACRO_IR, MACRO_IR, MACRO_EOA, - /* MACRO_IR, MACRO_EXP, MACRO_IR, MACRO_EOA, - MACRO_IR, MACRO_EXP, MACRO_EOA */ } }, - { "divq", emit_division, "__divq", - { MACRO_IR, MACRO_IR, MACRO_IR, MACRO_EOA, - MACRO_IR, MACRO_IR, MACRO_EOA, - /* MACRO_IR, MACRO_EXP, MACRO_IR, MACRO_EOA, - MACRO_IR, MACRO_EXP, MACRO_EOA */ } }, - { "divqu", emit_division, "__divqu", - { MACRO_IR, MACRO_IR, MACRO_IR, MACRO_EOA, - MACRO_IR, MACRO_IR, MACRO_EOA, - /* MACRO_IR, MACRO_EXP, MACRO_IR, MACRO_EOA, - MACRO_IR, MACRO_EXP, MACRO_EOA */ } }, - { "reml", emit_division, "__reml", - { MACRO_IR, MACRO_IR, MACRO_IR, MACRO_EOA, - MACRO_IR, MACRO_IR, MACRO_EOA, - /* MACRO_IR, MACRO_EXP, MACRO_IR, MACRO_EOA, - MACRO_IR, MACRO_EXP, MACRO_EOA */ } }, - { "remlu", emit_division, "__remlu", - { MACRO_IR, MACRO_IR, MACRO_IR, MACRO_EOA, - MACRO_IR, MACRO_IR, MACRO_EOA, - /* MACRO_IR, MACRO_EXP, MACRO_IR, MACRO_EOA, - MACRO_IR, MACRO_EXP, MACRO_EOA */ } }, - { "remq", emit_division, "__remq", - { MACRO_IR, MACRO_IR, MACRO_IR, MACRO_EOA, - MACRO_IR, MACRO_IR, MACRO_EOA, - /* MACRO_IR, MACRO_EXP, MACRO_IR, MACRO_EOA, - MACRO_IR, MACRO_EXP, MACRO_EOA */ } }, - { "remqu", emit_division, "__remqu", - { MACRO_IR, MACRO_IR, MACRO_IR, MACRO_EOA, - MACRO_IR, MACRO_IR, MACRO_EOA, - /* MACRO_IR, MACRO_EXP, MACRO_IR, MACRO_EOA, - MACRO_IR, MACRO_EXP, MACRO_EOA */ } }, - - { "jsr", emit_jsrjmp, "jsr", - { MACRO_PIR, MACRO_EXP, MACRO_EOA, - MACRO_PIR, MACRO_EOA, - MACRO_IR, MACRO_EXP, MACRO_EOA, - MACRO_EXP, MACRO_EOA } }, - { "jmp", emit_jsrjmp, "jmp", - { MACRO_PIR, MACRO_EXP, MACRO_EOA, - MACRO_PIR, MACRO_EOA, - MACRO_IR, MACRO_EXP, MACRO_EOA, - MACRO_EXP, MACRO_EOA } }, - { "ret", emit_retjcr, "ret", - { MACRO_IR, MACRO_EXP, MACRO_EOA, - MACRO_IR, MACRO_EOA, - MACRO_PIR, MACRO_EXP, MACRO_EOA, - MACRO_PIR, MACRO_EOA, - MACRO_EXP, MACRO_EOA, - MACRO_EOA } }, - { "jcr", emit_retjcr, "jcr", - { MACRO_IR, MACRO_EXP, MACRO_EOA, - MACRO_IR, MACRO_EOA, - MACRO_PIR, MACRO_EXP, MACRO_EOA, - MACRO_PIR, MACRO_EOA, - MACRO_EXP, MACRO_EOA, - MACRO_EOA } }, - { "jsr_coroutine", emit_retjcr, "jcr", - { MACRO_IR, MACRO_EXP, MACRO_EOA, - MACRO_IR, MACRO_EOA, - MACRO_PIR, MACRO_EXP, MACRO_EOA, - MACRO_PIR, MACRO_EOA, - MACRO_EXP, MACRO_EOA, - MACRO_EOA } }, -}; - -static const unsigned int alpha_num_macros - = sizeof (alpha_macros) / sizeof (*alpha_macros); - -/* Public interface functions */ - -/* This function is called once, at assembler startup time. It sets - up all the tables, etc. that the MD part of the assembler will - need, that can be determined before arguments are parsed. */ - -void -md_begin () -{ - unsigned int i; - - /* Verify that X_op field is wide enough. */ - { - expressionS e; - e.X_op = O_max; - assert (e.X_op == O_max); - } - - /* Create the opcode hash table. */ - alpha_opcode_hash = hash_new (); - for (i = 0; i < alpha_num_opcodes;) - { - const char *name, *retval, *slash; - - name = alpha_opcodes[i].name; - retval = hash_insert (alpha_opcode_hash, name, (PTR) &alpha_opcodes[i]); - if (retval) - as_fatal (_("internal error: can't hash opcode `%s': %s"), - name, retval); - - /* Some opcodes include modifiers of various sorts with a "/mod" - syntax, like the architecture manual suggests. However, for - use with gcc at least, we also need access to those same opcodes - without the "/". */ - - if ((slash = strchr (name, '/')) != NULL) - { - char *p = xmalloc (strlen (name)); - memcpy (p, name, slash - name); - strcpy (p + (slash - name), slash + 1); - - (void) hash_insert (alpha_opcode_hash, p, (PTR) &alpha_opcodes[i]); - /* Ignore failures -- the opcode table does duplicate some - variants in different forms, like "hw_stq" and "hw_st/q". */ - } - - while (++i < alpha_num_opcodes - && (alpha_opcodes[i].name == name - || !strcmp (alpha_opcodes[i].name, name))) - continue; - } - - /* Create the macro hash table. */ - alpha_macro_hash = hash_new (); - for (i = 0; i < alpha_num_macros;) - { - const char *name, *retval; - - name = alpha_macros[i].name; - retval = hash_insert (alpha_macro_hash, name, (PTR) &alpha_macros[i]); - if (retval) - as_fatal (_("internal error: can't hash macro `%s': %s"), - name, retval); - - while (++i < alpha_num_macros - && (alpha_macros[i].name == name - || !strcmp (alpha_macros[i].name, name))) - continue; - } - - /* Construct symbols for each of the registers. */ - for (i = 0; i < 32; ++i) - { - char name[4]; - - sprintf (name, "$%d", i); - alpha_register_table[i] = symbol_create (name, reg_section, i, - &zero_address_frag); - } - for (; i < 64; ++i) - { - char name[5]; - - sprintf (name, "$f%d", i - 32); - alpha_register_table[i] = symbol_create (name, reg_section, i, - &zero_address_frag); - } - - /* Create the special symbols and sections we'll be using. */ - - /* So .sbss will get used for tiny objects. */ - bfd_set_gp_size (stdoutput, g_switch_value); - -#ifdef OBJ_ECOFF - create_literal_section (".lita", &alpha_lita_section, &alpha_lita_symbol); - - /* For handling the GP, create a symbol that won't be output in the - symbol table. We'll edit it out of relocs later. */ - alpha_gp_symbol = symbol_create ("", alpha_lita_section, 0x8000, - &zero_address_frag); -#endif - -#ifdef OBJ_EVAX - create_literal_section (".link", &alpha_link_section, &alpha_link_symbol); -#endif - -#ifdef OBJ_ELF - if (ECOFF_DEBUGGING) - { - segT sec = subseg_new (".mdebug", (subsegT) 0); - bfd_set_section_flags (stdoutput, sec, SEC_HAS_CONTENTS | SEC_READONLY); - bfd_set_section_alignment (stdoutput, sec, 3); - } -#endif /* OBJ_ELF */ - - /* Create literal lookup hash table. */ - alpha_literal_hash = hash_new (); - - subseg_set (text_section, 0); -} - -/* The public interface to the instruction assembler. */ - -void -md_assemble (str) - char *str; -{ - char opname[32]; /* Current maximum is 13. */ - expressionS tok[MAX_INSN_ARGS]; - int ntok, trunclen; - size_t opnamelen; - - /* Split off the opcode. */ - opnamelen = strspn (str, "abcdefghijklmnopqrstuvwxyz_/46819"); - trunclen = (opnamelen < sizeof (opname) - 1 - ? opnamelen - : sizeof (opname) - 1); - memcpy (opname, str, trunclen); - opname[trunclen] = '\0'; - - /* Tokenize the rest of the line. */ - if ((ntok = tokenize_arguments (str + opnamelen, tok, MAX_INSN_ARGS)) < 0) - { - if (ntok != TOKENIZE_ERROR_REPORT) - as_bad (_("syntax error")); - - return; - } - - /* Finish it off. */ - assemble_tokens (opname, tok, ntok, alpha_macros_on); -} - -/* Round up a section's size to the appropriate boundary. */ - -valueT -md_section_align (seg, size) - segT seg; - valueT size; -{ - int align = bfd_get_section_alignment (stdoutput, seg); - valueT mask = ((valueT) 1 << align) - 1; - - return (size + mask) & ~mask; -} - -/* 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 - -extern char *vax_md_atof PARAMS ((int, char *, int *)); - -char * -md_atof (type, litP, sizeP) - char type; - char *litP; - int *sizeP; -{ - int prec; - LITTLENUM_TYPE words[MAX_LITTLENUMS]; - LITTLENUM_TYPE *wordP; - char *t; - - switch (type) - { - /* VAX floats */ - case 'G': - /* VAX md_atof doesn't like "G" for some reason. */ - type = 'g'; - case 'F': - case 'D': - return vax_md_atof (type, litP, sizeP); - - /* IEEE floats */ - case 'f': - prec = 2; - break; - - case 'd': - prec = 4; - break; - - case 'x': - case 'X': - prec = 6; - break; - - case 'p': - case 'P': - prec = 6; - 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 - 1; prec--;) - { - md_number_to_chars (litP, (long) (*wordP--), sizeof (LITTLENUM_TYPE)); - litP += sizeof (LITTLENUM_TYPE); - } - - return 0; -} - -/* Take care of the target-specific command-line options. */ - -int -md_parse_option (c, arg) - int c; - char *arg; -{ - switch (c) - { - case 'F': - alpha_nofloats_on = 1; - break; - - case OPTION_32ADDR: - alpha_addr32_on = 1; - break; - - case 'g': - alpha_debug = 1; - break; - - case 'G': - g_switch_value = atoi (arg); - break; - - case 'm': - { - const struct cpu_type *p; - for (p = cpu_types; p->name; ++p) - if (strcmp (arg, p->name) == 0) - { - alpha_target_name = p->name, alpha_target = p->flags; - goto found; - } - as_warn (_("Unknown CPU identifier `%s'"), arg); - found:; - } - break; - -#ifdef OBJ_EVAX - case '+': /* For g++. Hash any name > 63 chars long. */ - alpha_flag_hash_long_names = 1; - break; - - case 'H': /* Show new symbol after hash truncation */ - alpha_flag_show_after_trunc = 1; - break; - - case 'h': /* for gnu-c/vax compatibility. */ - break; -#endif - - case OPTION_RELAX: - alpha_flag_relax = 1; - break; - -#ifdef OBJ_ELF - case OPTION_MDEBUG: - alpha_flag_mdebug = 1; - break; - case OPTION_NO_MDEBUG: - alpha_flag_mdebug = 0; - break; -#endif - - default: - return 0; - } - - return 1; -} - -/* Print a description of the command-line options that we accept. */ - -void -md_show_usage (stream) - FILE *stream; -{ - fputs (_("\ -Alpha options:\n\ --32addr treat addresses as 32-bit values\n\ --F lack floating point instructions support\n\ --mev4 | -mev45 | -mev5 | -mev56 | -mpca56 | -mev6 | -mev67 | -mev68 | -mall\n\ - specify variant of Alpha architecture\n\ --m21064 | -m21066 | -m21164 | -m21164a | -m21164pc | -m21264 | -m21264a | -m21264b\n\ - these variants include PALcode opcodes\n"), - stream); -#ifdef OBJ_EVAX - fputs (_("\ -VMS options:\n\ --+ hash encode (don't truncate) names longer than 64 characters\n\ --H show new symbol after hash truncation\n"), - stream); -#endif -} - -/* Decide from what point a pc-relative relocation is relative to, - relative to the pc-relative fixup. Er, relatively speaking. */ - -long -md_pcrel_from (fixP) - fixS *fixP; -{ - valueT addr = fixP->fx_where + fixP->fx_frag->fr_address; - switch (fixP->fx_r_type) - { - case BFD_RELOC_23_PCREL_S2: - case BFD_RELOC_ALPHA_HINT: - case BFD_RELOC_ALPHA_BRSGP: - return addr + 4; - default: - return addr; - } -} - -/* Attempt to simplify or even eliminate a fixup. The return value is - ignored; perhaps it was once meaningful, but now it is historical. - To indicate that a fixup has been eliminated, set fixP->fx_done. - - For ELF, here it is that we transform the GPDISP_HI16 reloc we used - internally into the GPDISP reloc used externally. We had to do - this so that we'd have the GPDISP_LO16 reloc as a tag to compute - the distance to the "lda" instruction for setting the addend to - GPDISP. */ - -void -md_apply_fix3 (fixP, valP, seg) - fixS *fixP; - valueT * valP; - segT seg; -{ - char * const fixpos = fixP->fx_frag->fr_literal + fixP->fx_where; - valueT value = * valP; - unsigned image, size; - - switch (fixP->fx_r_type) - { - /* The GPDISP relocations are processed internally with a symbol - referring to the current function's section; we need to drop - in a value which, when added to the address of the start of - the function, gives the desired GP. */ - case BFD_RELOC_ALPHA_GPDISP_HI16: - { - fixS *next = fixP->fx_next; - - /* With user-specified !gpdisp relocations, we can be missing - the matching LO16 reloc. We will have already issued an - error message. */ - if (next) - fixP->fx_offset = (next->fx_frag->fr_address + next->fx_where - - fixP->fx_frag->fr_address - fixP->fx_where); - - value = (value - sign_extend_16 (value)) >> 16; - } -#ifdef OBJ_ELF - fixP->fx_r_type = BFD_RELOC_ALPHA_GPDISP; -#endif - goto do_reloc_gp; - - case BFD_RELOC_ALPHA_GPDISP_LO16: - value = sign_extend_16 (value); - fixP->fx_offset = 0; -#ifdef OBJ_ELF - fixP->fx_done = 1; -#endif - - do_reloc_gp: - fixP->fx_addsy = section_symbol (seg); - md_number_to_chars (fixpos, value, 2); - break; - - case BFD_RELOC_16: - if (fixP->fx_pcrel) - fixP->fx_r_type = BFD_RELOC_16_PCREL; - size = 2; - goto do_reloc_xx; - case BFD_RELOC_32: - if (fixP->fx_pcrel) - fixP->fx_r_type = BFD_RELOC_32_PCREL; - size = 4; - goto do_reloc_xx; - case BFD_RELOC_64: - if (fixP->fx_pcrel) - fixP->fx_r_type = BFD_RELOC_64_PCREL; - size = 8; - do_reloc_xx: - if (fixP->fx_pcrel == 0 && fixP->fx_addsy == 0) - { - md_number_to_chars (fixpos, value, size); - goto done; - } - return; - -#ifdef OBJ_ECOFF - case BFD_RELOC_GPREL32: - assert (fixP->fx_subsy == alpha_gp_symbol); - fixP->fx_subsy = 0; - /* FIXME: inherited this obliviousness of `value' -- why? */ - md_number_to_chars (fixpos, -alpha_gp_value, 4); - break; -#else - case BFD_RELOC_GPREL32: -#endif - case BFD_RELOC_GPREL16: - case BFD_RELOC_ALPHA_GPREL_HI16: - case BFD_RELOC_ALPHA_GPREL_LO16: - return; - - case BFD_RELOC_23_PCREL_S2: - if (fixP->fx_pcrel == 0 && fixP->fx_addsy == 0) - { - image = bfd_getl32 (fixpos); - image = (image & ~0x1FFFFF) | ((value >> 2) & 0x1FFFFF); - goto write_done; - } - return; - - case BFD_RELOC_ALPHA_HINT: - if (fixP->fx_pcrel == 0 && fixP->fx_addsy == 0) - { - image = bfd_getl32 (fixpos); - image = (image & ~0x3FFF) | ((value >> 2) & 0x3FFF); - goto write_done; - } - return; - -#ifdef OBJ_ELF - case BFD_RELOC_ALPHA_BRSGP: - return; - - case BFD_RELOC_ALPHA_TLSGD: - case BFD_RELOC_ALPHA_TLSLDM: - case BFD_RELOC_ALPHA_GOTDTPREL16: - case BFD_RELOC_ALPHA_DTPREL_HI16: - case BFD_RELOC_ALPHA_DTPREL_LO16: - case BFD_RELOC_ALPHA_DTPREL16: - case BFD_RELOC_ALPHA_GOTTPREL16: - case BFD_RELOC_ALPHA_TPREL_HI16: - case BFD_RELOC_ALPHA_TPREL_LO16: - case BFD_RELOC_ALPHA_TPREL16: - if (fixP->fx_addsy) - S_SET_THREAD_LOCAL (fixP->fx_addsy); - return; -#endif - -#ifdef OBJ_ECOFF - case BFD_RELOC_ALPHA_LITERAL: - md_number_to_chars (fixpos, value, 2); - return; -#endif - case BFD_RELOC_ALPHA_ELF_LITERAL: - case BFD_RELOC_ALPHA_LITUSE: - case BFD_RELOC_ALPHA_LINKAGE: - case BFD_RELOC_ALPHA_CODEADDR: - return; - - case BFD_RELOC_VTABLE_INHERIT: - case BFD_RELOC_VTABLE_ENTRY: - return; - - default: - { - const struct alpha_operand *operand; - - if ((int) fixP->fx_r_type >= 0) - as_fatal (_("unhandled relocation type %s"), - bfd_get_reloc_code_name (fixP->fx_r_type)); - - assert (-(int) fixP->fx_r_type < (int) alpha_num_operands); - operand = &alpha_operands[-(int) fixP->fx_r_type]; - - /* The rest of these fixups only exist internally during symbol - resolution and have no representation in the object file. - Therefore they must be completely resolved as constants. */ - - if (fixP->fx_addsy != 0 - && S_GET_SEGMENT (fixP->fx_addsy) != absolute_section) - as_bad_where (fixP->fx_file, fixP->fx_line, - _("non-absolute expression in constant field")); - - image = bfd_getl32 (fixpos); - image = insert_operand (image, operand, (offsetT) value, - fixP->fx_file, fixP->fx_line); - } - goto write_done; - } - - if (fixP->fx_addsy != 0 || fixP->fx_pcrel != 0) - return; - else - { - as_warn_where (fixP->fx_file, fixP->fx_line, - _("type %d reloc done?\n"), (int) fixP->fx_r_type); - goto done; - } - -write_done: - md_number_to_chars (fixpos, image, 4); - -done: - fixP->fx_done = 1; -} - -/* Look for a register name in the given symbol. */ - -symbolS * -md_undefined_symbol (name) - char *name; -{ - if (*name == '$') - { - int is_float = 0, num; - - switch (*++name) - { - case 'f': - if (name[1] == 'p' && name[2] == '\0') - return alpha_register_table[AXP_REG_FP]; - is_float = 32; - /* FALLTHRU */ - - case 'r': - if (!ISDIGIT (*++name)) - break; - /* FALLTHRU */ - - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - if (name[1] == '\0') - num = name[0] - '0'; - else if (name[0] != '0' && ISDIGIT (name[1]) && name[2] == '\0') - { - num = (name[0] - '0') * 10 + name[1] - '0'; - if (num >= 32) - break; - } - else - break; - - if (!alpha_noat_on && (num + is_float) == AXP_REG_AT) - as_warn (_("Used $at without \".set noat\"")); - return alpha_register_table[num + is_float]; - - case 'a': - if (name[1] == 't' && name[2] == '\0') - { - if (!alpha_noat_on) - as_warn (_("Used $at without \".set noat\"")); - return alpha_register_table[AXP_REG_AT]; - } - break; - - case 'g': - if (name[1] == 'p' && name[2] == '\0') - return alpha_register_table[alpha_gp_register]; - break; - - case 's': - if (name[1] == 'p' && name[2] == '\0') - return alpha_register_table[AXP_REG_SP]; - break; - } - } - return NULL; -} - -#ifdef OBJ_ECOFF -/* @@@ Magic ECOFF bits. */ - -void -alpha_frob_ecoff_data () -{ - select_gp_value (); - /* $zero and $f31 are read-only */ - alpha_gprmask &= ~1; - alpha_fprmask &= ~1; -} -#endif - -/* Hook to remember a recently defined label so that the auto-align - code can adjust the symbol after we know what alignment will be - required. */ - -void -alpha_define_label (sym) - symbolS *sym; -{ - alpha_insn_label = sym; -} - -/* Return true if we must always emit a reloc for a type and false if - there is some hope of resolving it at assembly time. */ - -int -alpha_force_relocation (f) - fixS *f; -{ - if (alpha_flag_relax) - return 1; - - switch (f->fx_r_type) - { - case BFD_RELOC_ALPHA_GPDISP_HI16: - case BFD_RELOC_ALPHA_GPDISP_LO16: - case BFD_RELOC_ALPHA_GPDISP: - case BFD_RELOC_ALPHA_LITERAL: - case BFD_RELOC_ALPHA_ELF_LITERAL: - case BFD_RELOC_ALPHA_LITUSE: - case BFD_RELOC_GPREL16: - case BFD_RELOC_GPREL32: - case BFD_RELOC_ALPHA_GPREL_HI16: - case BFD_RELOC_ALPHA_GPREL_LO16: - case BFD_RELOC_ALPHA_LINKAGE: - case BFD_RELOC_ALPHA_CODEADDR: - case BFD_RELOC_ALPHA_BRSGP: - case BFD_RELOC_ALPHA_TLSGD: - case BFD_RELOC_ALPHA_TLSLDM: - case BFD_RELOC_ALPHA_GOTDTPREL16: - case BFD_RELOC_ALPHA_DTPREL_HI16: - case BFD_RELOC_ALPHA_DTPREL_LO16: - case BFD_RELOC_ALPHA_DTPREL16: - case BFD_RELOC_ALPHA_GOTTPREL16: - case BFD_RELOC_ALPHA_TPREL_HI16: - case BFD_RELOC_ALPHA_TPREL_LO16: - case BFD_RELOC_ALPHA_TPREL16: - return 1; - - default: - break; - } - - return generic_force_reloc (f); -} - -/* Return true if we can partially resolve a relocation now. */ - -int -alpha_fix_adjustable (f) - fixS *f; -{ - /* Are there any relocation types for which we must generate a reloc - but we can adjust the values contained within it? */ - switch (f->fx_r_type) - { - case BFD_RELOC_ALPHA_GPDISP_HI16: - case BFD_RELOC_ALPHA_GPDISP_LO16: - case BFD_RELOC_ALPHA_GPDISP: - return 0; - - case BFD_RELOC_ALPHA_LITERAL: - case BFD_RELOC_ALPHA_ELF_LITERAL: - case BFD_RELOC_ALPHA_LITUSE: - case BFD_RELOC_ALPHA_LINKAGE: - case BFD_RELOC_ALPHA_CODEADDR: - return 1; - - case BFD_RELOC_VTABLE_ENTRY: - case BFD_RELOC_VTABLE_INHERIT: - return 0; - - case BFD_RELOC_GPREL16: - case BFD_RELOC_GPREL32: - case BFD_RELOC_ALPHA_GPREL_HI16: - case BFD_RELOC_ALPHA_GPREL_LO16: - case BFD_RELOC_23_PCREL_S2: - case BFD_RELOC_32: - case BFD_RELOC_64: - case BFD_RELOC_ALPHA_HINT: - return 1; - - case BFD_RELOC_ALPHA_TLSGD: - case BFD_RELOC_ALPHA_TLSLDM: - case BFD_RELOC_ALPHA_GOTDTPREL16: - case BFD_RELOC_ALPHA_DTPREL_HI16: - case BFD_RELOC_ALPHA_DTPREL_LO16: - case BFD_RELOC_ALPHA_DTPREL16: - case BFD_RELOC_ALPHA_GOTTPREL16: - case BFD_RELOC_ALPHA_TPREL_HI16: - case BFD_RELOC_ALPHA_TPREL_LO16: - case BFD_RELOC_ALPHA_TPREL16: - /* ??? No idea why we can't return a reference to .tbss+10, but - we're preventing this in the other assemblers. Follow for now. */ - return 0; - -#ifdef OBJ_ELF - case BFD_RELOC_ALPHA_BRSGP: - /* If we have a BRSGP reloc to a local symbol, adjust it to BRADDR and - let it get resolved at assembly time. */ - { - symbolS *sym = f->fx_addsy; - const char *name; - int offset = 0; - - if (generic_force_reloc (f)) - return 0; - - switch (S_GET_OTHER (sym) & STO_ALPHA_STD_GPLOAD) - { - case STO_ALPHA_NOPV: - break; - case STO_ALPHA_STD_GPLOAD: - offset = 8; - break; - default: - if (S_IS_LOCAL (sym)) - name = ""; - else - name = S_GET_NAME (sym); - as_bad_where (f->fx_file, f->fx_line, - _("!samegp reloc against symbol without .prologue: %s"), - name); - break; - } - f->fx_r_type = BFD_RELOC_23_PCREL_S2; - f->fx_offset += offset; - return 1; - } -#endif - - default: - return 1; - } - /*NOTREACHED*/ -} - -/* Generate the BFD reloc to be stuck in the object file from the - fixup used internally in the assembler. */ - -arelent * -tc_gen_reloc (sec, fixp) - asection *sec ATTRIBUTE_UNUSED; - 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; - - /* Make sure none of our internal relocations make it this far. - They'd better have been fully resolved by this point. */ - assert ((int) fixp->fx_r_type > 0); - - reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type); - if (reloc->howto == NULL) - { - as_bad_where (fixp->fx_file, fixp->fx_line, - _("cannot represent `%s' relocation in object file"), - bfd_get_reloc_code_name (fixp->fx_r_type)); - return NULL; - } - - if (!fixp->fx_pcrel != !reloc->howto->pc_relative) - { - as_fatal (_("internal error? cannot generate `%s' relocation"), - bfd_get_reloc_code_name (fixp->fx_r_type)); - } - assert (!fixp->fx_pcrel == !reloc->howto->pc_relative); - -#ifdef OBJ_ECOFF - if (fixp->fx_r_type == BFD_RELOC_ALPHA_LITERAL) - { - /* Fake out bfd_perform_relocation. sigh. */ - reloc->addend = -alpha_gp_value; - } - else -#endif - { - reloc->addend = fixp->fx_offset; -#ifdef OBJ_ELF - /* Ohhh, this is ugly. The problem is that if this is a local global - symbol, the relocation will entirely be performed at link time, not - at assembly time. bfd_perform_reloc doesn't know about this sort - of thing, and as a result we need to fake it out here. */ - if ((S_IS_EXTERN (fixp->fx_addsy) || S_IS_WEAK (fixp->fx_addsy) - || (S_GET_SEGMENT (fixp->fx_addsy)->flags & SEC_MERGE) - || (S_GET_SEGMENT (fixp->fx_addsy)->flags & SEC_THREAD_LOCAL)) - && !S_IS_COMMON (fixp->fx_addsy)) - reloc->addend -= symbol_get_bfdsym (fixp->fx_addsy)->value; -#endif - } - - return reloc; -} - -/* Parse a register name off of the input_line and return a register - number. Gets md_undefined_symbol above to do the register name - matching for us. - - Only called as a part of processing the ECOFF .frame directive. */ - -int -tc_get_register (frame) - int frame ATTRIBUTE_UNUSED; -{ - int framereg = AXP_REG_SP; - - SKIP_WHITESPACE (); - if (*input_line_pointer == '$') - { - char *s = input_line_pointer; - char c = get_symbol_end (); - symbolS *sym = md_undefined_symbol (s); - - *strchr (s, '\0') = c; - if (sym && (framereg = S_GET_VALUE (sym)) <= 31) - goto found; - } - as_warn (_("frame reg expected, using $%d."), framereg); - -found: - note_gpreg (framereg); - return framereg; -} - -/* This is called before the symbol table is processed. In order to - work with gcc when using mips-tfile, we must keep all local labels. - However, in other cases, we want to discard them. If we were - called with -g, but we didn't see any debugging information, it may - mean that gcc is smuggling debugging information through to - mips-tfile, in which case we must generate all local labels. */ - -#ifdef OBJ_ECOFF - -void -alpha_frob_file_before_adjust () -{ - if (alpha_debug != 0 - && ! ecoff_debugging_seen) - flag_keep_locals = 1; -} - -#endif /* OBJ_ECOFF */ +/* Some instruction sets indexed by lg(size). */ +static const char * const sextX_op[] = { "sextb", "sextw", "sextl", NULL }; +static const char * const insXl_op[] = { "insbl", "inswl", "insll", "insql" }; +static const char * const insXh_op[] = { NULL, "inswh", "inslh", "insqh" }; +static const char * const extXl_op[] = { "extbl", "extwl", "extll", "extql" }; +static const char * const extXh_op[] = { NULL, "extwh", "extlh", "extqh" }; +static const char * const mskXl_op[] = { "mskbl", "mskwl", "mskll", "mskql" }; +static const char * const mskXh_op[] = { NULL, "mskwh", "msklh", "mskqh" }; +static const char * const stX_op[] = { "stb", "stw", "stl", "stq" }; +static const char * const ldXu_op[] = { "ldbu", "ldwu", NULL, NULL }; + +static void assemble_insn (const struct alpha_opcode *, const expressionS *, int, struct alpha_insn *, bfd_reloc_code_real_type); +static void emit_insn (struct alpha_insn *); +static void assemble_tokens (const char *, const expressionS *, int, int); static struct alpha_reloc_tag * -get_alpha_reloc_tag (sequence) - long sequence; +get_alpha_reloc_tag (long sequence) { char buffer[ALPHA_RELOC_DIGITS]; struct alpha_reloc_tag *info; @@ -1680,13 +542,12 @@ get_alpha_reloc_tag (sequence) size_t len = strlen (buffer); const char *errmsg; - info = (struct alpha_reloc_tag *) - xcalloc (sizeof (struct alpha_reloc_tag) + len, 1); + info = xcalloc (sizeof (struct alpha_reloc_tag) + len, 1); info->segment = now_seg; info->sequence = sequence; strcpy (info->string, buffer); - errmsg = hash_insert (alpha_literal_hash, info->string, (PTR) info); + errmsg = hash_insert (alpha_literal_hash, info->string, (void *) info); if (errmsg) as_fatal (errmsg); } @@ -1694,22 +555,10 @@ get_alpha_reloc_tag (sequence) return info; } -/* Before the relocations are written, reorder them, so that user - supplied !lituse relocations follow the appropriate !literal - relocations, and similarly for !gpdisp relocations. */ - -void -alpha_before_fix () -{ - if (alpha_literal_hash) - bfd_map_over_sections (stdoutput, alpha_adjust_relocs, NULL); -} - static void -alpha_adjust_relocs (abfd, sec, ptr) - bfd *abfd ATTRIBUTE_UNUSED; - asection *sec; - PTR ptr ATTRIBUTE_UNUSED; +alpha_adjust_relocs (bfd *abfd ATTRIBUTE_UNUSED, + asection *sec, + void * ptr ATTRIBUTE_UNUSED) { segment_info_type *seginfo = seg_info (sec); fixS **prevP; @@ -1823,7 +672,7 @@ alpha_adjust_relocs (abfd, sec, ptr) fixp->tc_fix_data.info->master->fx_next = fixp->fx_next; fixp->fx_next = fixp->tc_fix_data.info->master; fixp = fixp->fx_next; - /* FALLTHRU */ + /* Fall through. */ case BFD_RELOC_ALPHA_ELF_LITERAL: if (fixp->tc_fix_data.info @@ -1858,12 +707,21 @@ alpha_adjust_relocs (abfd, sec, ptr) } } } + +/* Before the relocations are written, reorder them, so that user + supplied !lituse relocations follow the appropriate !literal + relocations, and similarly for !gpdisp relocations. */ + +void +alpha_before_fix (void) +{ + if (alpha_literal_hash) + bfd_map_over_sections (stdoutput, alpha_adjust_relocs, NULL); +} #ifdef DEBUG_ALPHA static void -debug_exp (tok, ntok) - expressionS tok[]; - int ntok; +debug_exp (expressionS tok[], int ntok) { int i; @@ -1915,6 +773,7 @@ debug_exp (tok, ntok) case O_lituse_jsr: name = "O_lituse_jsr"; break; case O_lituse_tlsgd: name = "O_lituse_tlsgd"; break; case O_lituse_tlsldm: name = "O_lituse_tlsldm"; break; + case O_lituse_jsrdirect: name = "O_lituse_jsrdirect"; break; case O_gpdisp: name = "O_gpdisp"; break; case O_gprelhigh: name = "O_gprelhigh"; break; case O_gprellow: name = "O_gprellow"; break; @@ -1945,10 +804,9 @@ debug_exp (tok, ntok) /* Parse the arguments to an opcode. */ static int -tokenize_arguments (str, tok, ntok) - char *str; - expressionS tok[]; - int ntok; +tokenize_arguments (char *str, + expressionS tok[], + int ntok) { expressionS *end_tok = tok + ntok; char *old_input_line_pointer; @@ -2134,11 +992,10 @@ err_report: syntax match. */ static const struct alpha_opcode * -find_opcode_match (first_opcode, tok, pntok, pcpumatch) - const struct alpha_opcode *first_opcode; - const expressionS *tok; - int *pntok; - int *pcpumatch; +find_opcode_match (const struct alpha_opcode *first_opcode, + const expressionS *tok, + int *pntok, + int *pcpumatch) { const struct alpha_opcode *opcode = first_opcode; int ntok = *pntok; @@ -2237,324 +1094,499 @@ find_opcode_match (first_opcode, tok, pntok, pcpumatch) return NULL; } -/* Search forward through all variants of a macro looking for a syntax - match. */ +/* Given an opcode name and a pre-tokenized set of arguments, assemble + the insn, but do not emit it. -static const struct alpha_macro * -find_macro_match (first_macro, tok, pntok) - const struct alpha_macro *first_macro; - const expressionS *tok; - int *pntok; -{ - const struct alpha_macro *macro = first_macro; - int ntok = *pntok; - - do - { - const enum alpha_macro_arg *arg = macro->argsets; - int tokidx = 0; - - while (*arg) - { - switch (*arg) - { - case MACRO_EOA: - if (tokidx == ntok) - return macro; - else - tokidx = 0; - break; - - /* Index register. */ - case MACRO_IR: - if (tokidx >= ntok || tok[tokidx].X_op != O_register - || !is_ir_num (tok[tokidx].X_add_number)) - goto match_failed; - ++tokidx; - break; - - /* Parenthesized index register. */ - case MACRO_PIR: - if (tokidx >= ntok || tok[tokidx].X_op != O_pregister - || !is_ir_num (tok[tokidx].X_add_number)) - goto match_failed; - ++tokidx; - break; - - /* Optional parenthesized index register. */ - case MACRO_OPIR: - if (tokidx < ntok && tok[tokidx].X_op == O_pregister - && is_ir_num (tok[tokidx].X_add_number)) - ++tokidx; - break; - - /* Leading comma with a parenthesized index register. */ - case MACRO_CPIR: - if (tokidx >= ntok || tok[tokidx].X_op != O_cpregister - || !is_ir_num (tok[tokidx].X_add_number)) - goto match_failed; - ++tokidx; - break; - - /* Floating point register. */ - case MACRO_FPR: - if (tokidx >= ntok || tok[tokidx].X_op != O_register - || !is_fpr_num (tok[tokidx].X_add_number)) - goto match_failed; - ++tokidx; - break; - - /* Normal expression. */ - case MACRO_EXP: - if (tokidx >= ntok) - goto match_failed; - switch (tok[tokidx].X_op) - { - case O_illegal: - case O_absent: - case O_register: - case O_pregister: - case O_cpregister: - case O_literal: - case O_lituse_base: - case O_lituse_bytoff: - case O_lituse_jsr: - case O_gpdisp: - case O_gprelhigh: - case O_gprellow: - case O_gprel: - case O_samegp: - goto match_failed; - - default: - break; - } - ++tokidx; - break; - - match_failed: - while (*arg != MACRO_EOA) - ++arg; - tokidx = 0; - break; - } - ++arg; - } - } - while (++macro - alpha_macros < (int) alpha_num_macros - && !strcmp (macro->name, first_macro->name)); - - return NULL; -} - -/* Insert an operand value into an instruction. */ - -static unsigned -insert_operand (insn, operand, val, file, line) - unsigned insn; - const struct alpha_operand *operand; - offsetT val; - char *file; - unsigned line; -{ - if (operand->bits != 32 && !(operand->flags & AXP_OPERAND_NOOVERFLOW)) - { - offsetT min, max; - - if (operand->flags & AXP_OPERAND_SIGNED) - { - max = (1 << (operand->bits - 1)) - 1; - min = -(1 << (operand->bits - 1)); - } - else - { - max = (1 << operand->bits) - 1; - min = 0; - } - - if (val < min || val > max) - { - const char *err = - _("operand out of range (%s not between %d and %d)"); - char buf[sizeof (val) * 3 + 2]; - - sprint_value (buf, val); - if (file) - as_warn_where (file, line, err, buf, min, max); - else - as_warn (err, buf, min, max); - } - } - - if (operand->insert) - { - const char *errmsg = NULL; - - insn = (*operand->insert) (insn, val, &errmsg); - if (errmsg) - as_warn (errmsg); - } - else - insn |= ((val & ((1 << operand->bits) - 1)) << operand->shift); - - return insn; -} - -/* Turn an opcode description and a set of arguments into - an instruction and a fixup. */ + Note that this implies no macros allowed, since we can't store more + than one insn in an insn structure. */ static void -assemble_insn (opcode, tok, ntok, insn, reloc) - const struct alpha_opcode *opcode; - const expressionS *tok; - int ntok; - struct alpha_insn *insn; - bfd_reloc_code_real_type reloc; +assemble_tokens_to_insn (const char *opname, + const expressionS *tok, + int ntok, + struct alpha_insn *insn) { - const struct alpha_operand *reloc_operand = NULL; - const expressionS *reloc_exp = NULL; - const unsigned char *argidx; - unsigned image; - int tokidx = 0; + const struct alpha_opcode *opcode; - memset (insn, 0, sizeof (*insn)); - image = opcode->opcode; - - for (argidx = opcode->operands; *argidx; ++argidx) + /* Search opcodes. */ + opcode = (const struct alpha_opcode *) hash_find (alpha_opcode_hash, opname); + if (opcode) { - const struct alpha_operand *operand = &alpha_operands[*argidx]; - const expressionS *t = (const expressionS *) 0; - - if (operand->flags & AXP_OPERAND_FAKE) + int cpumatch; + opcode = find_opcode_match (opcode, tok, &ntok, &cpumatch); + if (opcode) { - /* fake operands take no value and generate no fixup */ - image = insert_operand (image, operand, 0, NULL, 0); - continue; + assemble_insn (opcode, tok, ntok, insn, BFD_RELOC_UNUSED); + return; } + else if (cpumatch) + as_bad (_("inappropriate arguments for opcode `%s'"), opname); + else + as_bad (_("opcode `%s' not supported for target %s"), opname, + alpha_target_name); + } + else + as_bad (_("unknown opcode `%s'"), opname); +} - if (tokidx >= ntok) - { - switch (operand->flags & AXP_OPERAND_OPTIONAL_MASK) - { - case AXP_OPERAND_DEFAULT_FIRST: - t = &tok[0]; - break; - case AXP_OPERAND_DEFAULT_SECOND: - t = &tok[1]; - break; - case AXP_OPERAND_DEFAULT_ZERO: +/* Build a BFD section with its flags set appropriately for the .lita, + .lit8, or .lit4 sections. */ + +static void +create_literal_section (const char *name, + segT *secp, + symbolS **symp) +{ + segT current_section = now_seg; + int current_subsec = now_subseg; + segT new_sec; + + *secp = new_sec = subseg_new (name, 0); + subseg_set (current_section, current_subsec); + bfd_set_section_alignment (stdoutput, new_sec, 4); + bfd_set_section_flags (stdoutput, new_sec, + SEC_RELOC | SEC_ALLOC | SEC_LOAD | SEC_READONLY + | SEC_DATA); + + S_CLEAR_EXTERNAL (*symp = section_symbol (new_sec)); +} + +/* Load a (partial) expression into a target register. + + If poffset is not null, after the call it will either contain + O_constant 0, or a 16-bit offset appropriate for any MEM format + instruction. In addition, pbasereg will be modified to point to + the base register to use in that MEM format instruction. + + In any case, *pbasereg should contain a base register to add to the + expression. This will normally be either AXP_REG_ZERO or + alpha_gp_register. Symbol addresses will always be loaded via $gp, + so "foo($0)" is interpreted as adding the address of foo to $0; + i.e. "ldq $targ, LIT($gp); addq $targ, $0, $targ". Odd, perhaps, + but this is what OSF/1 does. + + If explicit relocations of the form !literal! are allowed, + and used, then explicit_reloc with be an expression pointer. + + Finally, the return value is nonzero if the calling macro may emit + a LITUSE reloc if otherwise appropriate; the return value is the + sequence number to use. */ + +static long +load_expression (int targreg, + const expressionS *exp, + int *pbasereg, + expressionS *poffset) +{ + long emit_lituse = 0; + offsetT addend = exp->X_add_number; + int basereg = *pbasereg; + struct alpha_insn insn; + expressionS newtok[3]; + + switch (exp->X_op) + { + case O_symbol: + { +#ifdef OBJ_ECOFF + offsetT lit; + + /* Attempt to reduce .lit load by splitting the offset from + its symbol when possible, but don't create a situation in + which we'd fail. */ + if (!range_signed_32 (addend) && + (alpha_noat_on || targreg == AXP_REG_AT)) + { + lit = add_to_literal_pool (exp->X_add_symbol, addend, + alpha_lita_section, 8); + addend = 0; + } + else + lit = add_to_literal_pool (exp->X_add_symbol, 0, + alpha_lita_section, 8); + + if (lit >= 0x8000) + as_fatal (_("overflow in literal (.lita) table")); + + /* Emit "ldq r, lit(gp)". */ + + if (basereg != alpha_gp_register && targreg == basereg) + { + if (alpha_noat_on) + as_bad (_("macro requires $at register while noat in effect")); + if (targreg == AXP_REG_AT) + as_bad (_("macro requires $at while $at in use")); + + set_tok_reg (newtok[0], AXP_REG_AT); + } + else + set_tok_reg (newtok[0], targreg); + + set_tok_sym (newtok[1], alpha_lita_symbol, lit); + set_tok_preg (newtok[2], alpha_gp_register); + + assemble_tokens_to_insn ("ldq", newtok, 3, &insn); + + assert (insn.nfixups == 1); + insn.fixups[0].reloc = BFD_RELOC_ALPHA_LITERAL; + insn.sequence = emit_lituse = next_sequence_num--; +#endif /* OBJ_ECOFF */ +#ifdef OBJ_ELF + /* Emit "ldq r, gotoff(gp)". */ + + if (basereg != alpha_gp_register && targreg == basereg) + { + if (alpha_noat_on) + as_bad (_("macro requires $at register while noat in effect")); + if (targreg == AXP_REG_AT) + as_bad (_("macro requires $at while $at in use")); + + set_tok_reg (newtok[0], AXP_REG_AT); + } + else + set_tok_reg (newtok[0], targreg); + + /* XXX: Disable this .got minimizing optimization so that we can get + better instruction offset knowledge in the compiler. This happens + very infrequently anyway. */ + if (1 + || (!range_signed_32 (addend) + && (alpha_noat_on || targreg == AXP_REG_AT))) + { + newtok[1] = *exp; + addend = 0; + } + else + set_tok_sym (newtok[1], exp->X_add_symbol, 0); + + set_tok_preg (newtok[2], alpha_gp_register); + + assemble_tokens_to_insn ("ldq", newtok, 3, &insn); + + assert (insn.nfixups == 1); + insn.fixups[0].reloc = BFD_RELOC_ALPHA_ELF_LITERAL; + insn.sequence = emit_lituse = next_sequence_num--; +#endif /* OBJ_ELF */ +#ifdef OBJ_EVAX + offsetT link; + + /* Find symbol or symbol pointer in link section. */ + + if (exp->X_add_symbol == alpha_evax_proc.symbol) + { + if (range_signed_16 (addend)) { - static expressionS zero_exp; - t = &zero_exp; - zero_exp.X_op = O_constant; - zero_exp.X_unsigned = 1; + set_tok_reg (newtok[0], targreg); + set_tok_const (newtok[1], addend); + set_tok_preg (newtok[2], basereg); + assemble_tokens_to_insn ("lda", newtok, 3, &insn); + addend = 0; } - break; - default: - abort (); - } - } + else + { + set_tok_reg (newtok[0], targreg); + set_tok_const (newtok[1], 0); + set_tok_preg (newtok[2], basereg); + assemble_tokens_to_insn ("lda", newtok, 3, &insn); + } + } + else + { + if (!range_signed_32 (addend)) + { + link = add_to_link_pool (alpha_evax_proc.symbol, + exp->X_add_symbol, addend); + addend = 0; + } + else + link = add_to_link_pool (alpha_evax_proc.symbol, + exp->X_add_symbol, 0); + + set_tok_reg (newtok[0], targreg); + set_tok_const (newtok[1], link); + set_tok_preg (newtok[2], basereg); + assemble_tokens_to_insn ("ldq", newtok, 3, &insn); + } +#endif /* OBJ_EVAX */ + + emit_insn (&insn); + +#ifndef OBJ_EVAX + if (basereg != alpha_gp_register && basereg != AXP_REG_ZERO) + { + /* Emit "addq r, base, r". */ + + set_tok_reg (newtok[1], basereg); + set_tok_reg (newtok[2], targreg); + assemble_tokens ("addq", newtok, 3, 0); + } +#endif + basereg = targreg; + } + break; + + case O_constant: + break; + + case O_subtract: + /* Assume that this difference expression will be resolved to an + absolute value and that that value will fit in 16 bits. */ + + set_tok_reg (newtok[0], targreg); + newtok[1] = *exp; + set_tok_preg (newtok[2], basereg); + assemble_tokens ("lda", newtok, 3, 0); + + if (poffset) + set_tok_const (*poffset, 0); + return 0; + + case O_big: + if (exp->X_add_number > 0) + as_bad (_("bignum invalid; zero assumed")); else - t = &tok[tokidx++]; + as_bad (_("floating point number invalid; zero assumed")); + addend = 0; + break; - switch (t->X_op) - { - case O_register: - case O_pregister: - case O_cpregister: - image = insert_operand (image, operand, regno (t->X_add_number), - NULL, 0); - break; - - case O_constant: - image = insert_operand (image, operand, t->X_add_number, NULL, 0); - assert (reloc_operand == NULL); - reloc_operand = operand; - reloc_exp = t; - break; - - default: - /* This is only 0 for fields that should contain registers, - which means this pattern shouldn't have matched. */ - if (operand->default_reloc == 0) - abort (); - - /* There is one special case for which an insn receives two - relocations, and thus the user-supplied reloc does not - override the operand reloc. */ - if (operand->default_reloc == BFD_RELOC_ALPHA_HINT) - { - struct alpha_fixup *fixup; - - if (insn->nfixups >= MAX_INSN_FIXUPS) - as_fatal (_("too many fixups")); - - fixup = &insn->fixups[insn->nfixups++]; - fixup->exp = *t; - fixup->reloc = BFD_RELOC_ALPHA_HINT; - } - else - { - if (reloc == BFD_RELOC_UNUSED) - reloc = operand->default_reloc; - - assert (reloc_operand == NULL); - reloc_operand = operand; - reloc_exp = t; - } - break; - } + default: + as_bad (_("can't handle expression")); + addend = 0; + break; } - if (reloc != BFD_RELOC_UNUSED) + if (!range_signed_32 (addend)) { - struct alpha_fixup *fixup; + offsetT lit; + long seq_num = next_sequence_num--; - if (insn->nfixups >= MAX_INSN_FIXUPS) - as_fatal (_("too many fixups")); + /* For 64-bit addends, just put it in the literal pool. */ +#ifdef OBJ_EVAX + /* Emit "ldq targreg, lit(basereg)". */ + lit = add_to_link_pool (alpha_evax_proc.symbol, + section_symbol (absolute_section), addend); + set_tok_reg (newtok[0], targreg); + set_tok_const (newtok[1], lit); + set_tok_preg (newtok[2], alpha_gp_register); + assemble_tokens ("ldq", newtok, 3, 0); +#else - /* ??? My but this is hacky. But the OSF/1 assembler uses the same - relocation tag for both ldah and lda with gpdisp. Choose the - correct internal relocation based on the opcode. */ - if (reloc == BFD_RELOC_ALPHA_GPDISP) + if (alpha_lit8_section == NULL) { - if (strcmp (opcode->name, "ldah") == 0) - reloc = BFD_RELOC_ALPHA_GPDISP_HI16; - else if (strcmp (opcode->name, "lda") == 0) - reloc = BFD_RELOC_ALPHA_GPDISP_LO16; - else - as_bad (_("invalid relocation for instruction")); + create_literal_section (".lit8", + &alpha_lit8_section, + &alpha_lit8_symbol); + +#ifdef OBJ_ECOFF + alpha_lit8_literal = add_to_literal_pool (alpha_lit8_symbol, 0x8000, + alpha_lita_section, 8); + if (alpha_lit8_literal >= 0x8000) + as_fatal (_("overflow in literal (.lita) table")); +#endif } - /* If this is a real relocation (as opposed to a lituse hint), then - the relocation width should match the operand width. */ - else if (reloc < BFD_RELOC_UNUSED) - { - reloc_howto_type *reloc_howto - = bfd_reloc_type_lookup (stdoutput, reloc); - if (reloc_howto->bitsize != reloc_operand->bits) - { - as_bad (_("invalid relocation for field")); - return; - } - } + lit = add_to_literal_pool (NULL, addend, alpha_lit8_section, 8) - 0x8000; + if (lit >= 0x8000) + as_fatal (_("overflow in literal (.lit8) table")); - fixup = &insn->fixups[insn->nfixups++]; - if (reloc_exp) - fixup->exp = *reloc_exp; + /* Emit "lda litreg, .lit8+0x8000". */ + + if (targreg == basereg) + { + if (alpha_noat_on) + as_bad (_("macro requires $at register while noat in effect")); + if (targreg == AXP_REG_AT) + as_bad (_("macro requires $at while $at in use")); + + set_tok_reg (newtok[0], AXP_REG_AT); + } else - fixup->exp.X_op = O_absent; - fixup->reloc = reloc; + set_tok_reg (newtok[0], targreg); +#ifdef OBJ_ECOFF + set_tok_sym (newtok[1], alpha_lita_symbol, alpha_lit8_literal); +#endif +#ifdef OBJ_ELF + set_tok_sym (newtok[1], alpha_lit8_symbol, 0x8000); +#endif + set_tok_preg (newtok[2], alpha_gp_register); + + assemble_tokens_to_insn ("ldq", newtok, 3, &insn); + + assert (insn.nfixups == 1); +#ifdef OBJ_ECOFF + insn.fixups[0].reloc = BFD_RELOC_ALPHA_LITERAL; +#endif +#ifdef OBJ_ELF + insn.fixups[0].reloc = BFD_RELOC_ALPHA_ELF_LITERAL; +#endif + insn.sequence = seq_num; + + emit_insn (&insn); + + /* Emit "ldq litreg, lit(litreg)". */ + + set_tok_const (newtok[1], lit); + set_tok_preg (newtok[2], newtok[0].X_add_number); + + assemble_tokens_to_insn ("ldq", newtok, 3, &insn); + + assert (insn.nfixups < MAX_INSN_FIXUPS); + insn.fixups[insn.nfixups].reloc = DUMMY_RELOC_LITUSE_BASE; + insn.fixups[insn.nfixups].exp.X_op = O_absent; + insn.nfixups++; + insn.sequence = seq_num; + emit_lituse = 0; + + emit_insn (&insn); + + /* Emit "addq litreg, base, target". */ + + if (basereg != AXP_REG_ZERO) + { + set_tok_reg (newtok[1], basereg); + set_tok_reg (newtok[2], targreg); + assemble_tokens ("addq", newtok, 3, 0); + } +#endif /* !OBJ_EVAX */ + + if (poffset) + set_tok_const (*poffset, 0); + *pbasereg = targreg; + } + else + { + offsetT low, high, extra, tmp; + + /* For 32-bit operands, break up the addend. */ + + low = sign_extend_16 (addend); + tmp = addend - low; + high = sign_extend_16 (tmp >> 16); + + if (tmp - (high << 16)) + { + extra = 0x4000; + tmp -= 0x40000000; + high = sign_extend_16 (tmp >> 16); + } + else + extra = 0; + + set_tok_reg (newtok[0], targreg); + set_tok_preg (newtok[2], basereg); + + if (extra) + { + /* Emit "ldah r, extra(r). */ + set_tok_const (newtok[1], extra); + assemble_tokens ("ldah", newtok, 3, 0); + set_tok_preg (newtok[2], basereg = targreg); + } + + if (high) + { + /* Emit "ldah r, high(r). */ + set_tok_const (newtok[1], high); + assemble_tokens ("ldah", newtok, 3, 0); + basereg = targreg; + set_tok_preg (newtok[2], basereg); + } + + if ((low && !poffset) || (!poffset && basereg != targreg)) + { + /* Emit "lda r, low(base)". */ + set_tok_const (newtok[1], low); + assemble_tokens ("lda", newtok, 3, 0); + basereg = targreg; + low = 0; + } + + if (poffset) + set_tok_const (*poffset, low); + *pbasereg = basereg; } - insn->insn = image; + return emit_lituse; +} + +/* The lda macro differs from the lda instruction in that it handles + most simple expressions, particularly symbol address loads and + large constants. */ + +static void +emit_lda (const expressionS *tok, + int ntok, + const void * unused ATTRIBUTE_UNUSED) +{ + int basereg; + + if (ntok == 2) + basereg = (tok[1].X_op == O_constant ? AXP_REG_ZERO : alpha_gp_register); + else + basereg = tok[2].X_add_number; + + (void) load_expression (tok[0].X_add_number, &tok[1], &basereg, NULL); +} + +/* The ldah macro differs from the ldah instruction in that it has $31 + as an implied base register. */ + +static void +emit_ldah (const expressionS *tok, + int ntok ATTRIBUTE_UNUSED, + const void * unused ATTRIBUTE_UNUSED) +{ + expressionS newtok[3]; + + newtok[0] = tok[0]; + newtok[1] = tok[1]; + set_tok_preg (newtok[2], AXP_REG_ZERO); + + assemble_tokens ("ldah", newtok, 3, 0); +} + +/* Called internally to handle all alignment needs. This takes care + of eliding calls to frag_align if'n the cached current alignment + says we've already got it, as well as taking care of the auto-align + feature wrt labels. */ + +static void +alpha_align (int n, + char *pfill, + symbolS *label, + int force ATTRIBUTE_UNUSED) +{ + if (alpha_current_align >= n) + return; + + if (pfill == NULL) + { + if (subseg_text_p (now_seg)) + frag_align_code (n, 0); + else + frag_align (n, 0, 0); + } + else + frag_align (n, *pfill, 0); + + alpha_current_align = n; + + if (label != NULL && S_GET_SEGMENT (label) == now_seg) + { + symbol_set_frag (label, frag_now); + S_SET_VALUE (label, (valueT) frag_now_fix ()); + } + + record_alignment (now_seg, n); + + /* ??? If alpha_flag_relax && force && elf, record the requested alignment + in a reloc for the linker to see. */ } /* Actually output an instruction with its fixup. */ static void -emit_insn (insn) - struct alpha_insn *insn; +emit_insn (struct alpha_insn *insn) { char *f; int i; @@ -2692,6 +1724,9 @@ emit_insn (insn) case DUMMY_RELOC_LITUSE_TLSLDM: fixP->fx_offset = LITUSE_ALPHA_TLSLDM; goto do_lituse; + case DUMMY_RELOC_LITUSE_JSRDIRECT: + fixP->fx_offset = LITUSE_ALPHA_JSRDIRECT; + goto do_lituse; do_lituse: fixP->fx_addsy = section_symbol (now_seg); fixP->fx_r_type = BFD_RELOC_ALPHA_LITUSE; @@ -2760,646 +1795,195 @@ emit_insn (insn) } } -/* Given an opcode name and a pre-tokenized set of arguments, assemble - the insn, but do not emit it. +/* Insert an operand value into an instruction. */ - Note that this implies no macros allowed, since we can't store more - than one insn in an insn structure. */ - -static void -assemble_tokens_to_insn (opname, tok, ntok, insn) - const char *opname; - const expressionS *tok; - int ntok; - struct alpha_insn *insn; +static unsigned +insert_operand (unsigned insn, + const struct alpha_operand *operand, + offsetT val, + char *file, + unsigned line) { - const struct alpha_opcode *opcode; - - /* search opcodes */ - opcode = (const struct alpha_opcode *) hash_find (alpha_opcode_hash, opname); - if (opcode) + if (operand->bits != 32 && !(operand->flags & AXP_OPERAND_NOOVERFLOW)) { - int cpumatch; - opcode = find_opcode_match (opcode, tok, &ntok, &cpumatch); - if (opcode) + offsetT min, max; + + if (operand->flags & AXP_OPERAND_SIGNED) { - assemble_insn (opcode, tok, ntok, insn, BFD_RELOC_UNUSED); - return; + max = (1 << (operand->bits - 1)) - 1; + min = -(1 << (operand->bits - 1)); } - else if (cpumatch) - as_bad (_("inappropriate arguments for opcode `%s'"), opname); else - as_bad (_("opcode `%s' not supported for target %s"), opname, - alpha_target_name); + { + max = (1 << operand->bits) - 1; + min = 0; + } + + if (val < min || val > max) + as_warn_value_out_of_range (_("operand"), val, min, max, file, line); + } + + if (operand->insert) + { + const char *errmsg = NULL; + + insn = (*operand->insert) (insn, val, &errmsg); + if (errmsg) + as_warn (errmsg); } else - as_bad (_("unknown opcode `%s'"), opname); + insn |= ((val & ((1 << operand->bits) - 1)) << operand->shift); + + return insn; } -/* Given an opcode name and a pre-tokenized set of arguments, take the - opcode all the way through emission. */ +/* Turn an opcode description and a set of arguments into + an instruction and a fixup. */ static void -assemble_tokens (opname, tok, ntok, local_macros_on) - const char *opname; - const expressionS *tok; - int ntok; - int local_macros_on; +assemble_insn (const struct alpha_opcode *opcode, + const expressionS *tok, + int ntok, + struct alpha_insn *insn, + bfd_reloc_code_real_type reloc) { - int found_something = 0; - const struct alpha_opcode *opcode; - const struct alpha_macro *macro; - int cpumatch = 1; - bfd_reloc_code_real_type reloc = BFD_RELOC_UNUSED; + const struct alpha_operand *reloc_operand = NULL; + const expressionS *reloc_exp = NULL; + const unsigned char *argidx; + unsigned image; + int tokidx = 0; -#ifdef RELOC_OP_P - /* If a user-specified relocation is present, this is not a macro. */ - if (ntok && USER_RELOC_P (tok[ntok - 1].X_op)) + memset (insn, 0, sizeof (*insn)); + image = opcode->opcode; + + for (argidx = opcode->operands; *argidx; ++argidx) { - reloc = ALPHA_RELOC_TABLE (tok[ntok - 1].X_op)->reloc; - ntok--; - } - else -#endif - if (local_macros_on) - { - macro = ((const struct alpha_macro *) - hash_find (alpha_macro_hash, opname)); - if (macro) + const struct alpha_operand *operand = &alpha_operands[*argidx]; + const expressionS *t = (const expressionS *) 0; + + if (operand->flags & AXP_OPERAND_FAKE) { - found_something = 1; - macro = find_macro_match (macro, tok, &ntok); - if (macro) + /* Fake operands take no value and generate no fixup. */ + image = insert_operand (image, operand, 0, NULL, 0); + continue; + } + + if (tokidx >= ntok) + { + switch (operand->flags & AXP_OPERAND_OPTIONAL_MASK) { - (*macro->emit) (tok, ntok, macro->arg); + case AXP_OPERAND_DEFAULT_FIRST: + t = &tok[0]; + break; + case AXP_OPERAND_DEFAULT_SECOND: + t = &tok[1]; + break; + case AXP_OPERAND_DEFAULT_ZERO: + { + static expressionS zero_exp; + t = &zero_exp; + zero_exp.X_op = O_constant; + zero_exp.X_unsigned = 1; + } + break; + default: + abort (); + } + } + else + t = &tok[tokidx++]; + + switch (t->X_op) + { + case O_register: + case O_pregister: + case O_cpregister: + image = insert_operand (image, operand, regno (t->X_add_number), + NULL, 0); + break; + + case O_constant: + image = insert_operand (image, operand, t->X_add_number, NULL, 0); + assert (reloc_operand == NULL); + reloc_operand = operand; + reloc_exp = t; + break; + + default: + /* This is only 0 for fields that should contain registers, + which means this pattern shouldn't have matched. */ + if (operand->default_reloc == 0) + abort (); + + /* There is one special case for which an insn receives two + relocations, and thus the user-supplied reloc does not + override the operand reloc. */ + if (operand->default_reloc == BFD_RELOC_ALPHA_HINT) + { + struct alpha_fixup *fixup; + + if (insn->nfixups >= MAX_INSN_FIXUPS) + as_fatal (_("too many fixups")); + + fixup = &insn->fixups[insn->nfixups++]; + fixup->exp = *t; + fixup->reloc = BFD_RELOC_ALPHA_HINT; + } + else + { + if (reloc == BFD_RELOC_UNUSED) + reloc = operand->default_reloc; + + assert (reloc_operand == NULL); + reloc_operand = operand; + reloc_exp = t; + } + break; + } + } + + if (reloc != BFD_RELOC_UNUSED) + { + struct alpha_fixup *fixup; + + if (insn->nfixups >= MAX_INSN_FIXUPS) + as_fatal (_("too many fixups")); + + /* ??? My but this is hacky. But the OSF/1 assembler uses the same + relocation tag for both ldah and lda with gpdisp. Choose the + correct internal relocation based on the opcode. */ + if (reloc == BFD_RELOC_ALPHA_GPDISP) + { + if (strcmp (opcode->name, "ldah") == 0) + reloc = BFD_RELOC_ALPHA_GPDISP_HI16; + else if (strcmp (opcode->name, "lda") == 0) + reloc = BFD_RELOC_ALPHA_GPDISP_LO16; + else + as_bad (_("invalid relocation for instruction")); + } + + /* If this is a real relocation (as opposed to a lituse hint), then + the relocation width should match the operand width. */ + else if (reloc < BFD_RELOC_UNUSED) + { + reloc_howto_type *reloc_howto + = bfd_reloc_type_lookup (stdoutput, reloc); + if (reloc_howto->bitsize != reloc_operand->bits) + { + as_bad (_("invalid relocation for field")); return; } } - } - /* Search opcodes. */ - opcode = (const struct alpha_opcode *) hash_find (alpha_opcode_hash, opname); - if (opcode) - { - found_something = 1; - opcode = find_opcode_match (opcode, tok, &ntok, &cpumatch); - if (opcode) - { - struct alpha_insn insn; - assemble_insn (opcode, tok, ntok, &insn, reloc); - - /* Copy the sequence number for the reloc from the reloc token. */ - if (reloc != BFD_RELOC_UNUSED) - insn.sequence = tok[ntok].X_add_number; - - emit_insn (&insn); - return; - } - } - - if (found_something) - { - if (cpumatch) - as_bad (_("inappropriate arguments for opcode `%s'"), opname); + fixup = &insn->fixups[insn->nfixups++]; + if (reloc_exp) + fixup->exp = *reloc_exp; else - as_bad (_("opcode `%s' not supported for target %s"), opname, - alpha_target_name); - } - else - as_bad (_("unknown opcode `%s'"), opname); -} - -/* Some instruction sets indexed by lg(size). */ -static const char * const sextX_op[] = { "sextb", "sextw", "sextl", NULL }; -static const char * const insXl_op[] = { "insbl", "inswl", "insll", "insql" }; -static const char * const insXh_op[] = { NULL, "inswh", "inslh", "insqh" }; -static const char * const extXl_op[] = { "extbl", "extwl", "extll", "extql" }; -static const char * const extXh_op[] = { NULL, "extwh", "extlh", "extqh" }; -static const char * const mskXl_op[] = { "mskbl", "mskwl", "mskll", "mskql" }; -static const char * const mskXh_op[] = { NULL, "mskwh", "msklh", "mskqh" }; -static const char * const stX_op[] = { "stb", "stw", "stl", "stq" }; -static const char * const ldXu_op[] = { "ldbu", "ldwu", NULL, NULL }; - -/* Implement the ldgp macro. */ - -static void -emit_ldgp (tok, ntok, unused) - const expressionS *tok; - int ntok ATTRIBUTE_UNUSED; - const PTR unused ATTRIBUTE_UNUSED; -{ -#ifdef OBJ_AOUT -FIXME -#endif -#if defined(OBJ_ECOFF) || defined(OBJ_ELF) - /* from "ldgp r1,n(r2)", generate "ldah r1,X(R2); lda r1,Y(r1)" - with appropriate constants and relocations. */ - struct alpha_insn insn; - expressionS newtok[3]; - expressionS addend; - -#ifdef OBJ_ECOFF - if (regno (tok[2].X_add_number) == AXP_REG_PV) - ecoff_set_gp_prolog_size (0); -#endif - - newtok[0] = tok[0]; - set_tok_const (newtok[1], 0); - newtok[2] = tok[2]; - - assemble_tokens_to_insn ("ldah", newtok, 3, &insn); - - addend = tok[1]; - -#ifdef OBJ_ECOFF - if (addend.X_op != O_constant) - as_bad (_("can not resolve expression")); - addend.X_op = O_symbol; - addend.X_add_symbol = alpha_gp_symbol; -#endif - - insn.nfixups = 1; - insn.fixups[0].exp = addend; - insn.fixups[0].reloc = BFD_RELOC_ALPHA_GPDISP_HI16; - insn.sequence = next_sequence_num; - - emit_insn (&insn); - - set_tok_preg (newtok[2], tok[0].X_add_number); - - assemble_tokens_to_insn ("lda", newtok, 3, &insn); - -#ifdef OBJ_ECOFF - addend.X_add_number += 4; -#endif - - insn.nfixups = 1; - insn.fixups[0].exp = addend; - insn.fixups[0].reloc = BFD_RELOC_ALPHA_GPDISP_LO16; - insn.sequence = next_sequence_num--; - - emit_insn (&insn); -#endif /* OBJ_ECOFF || OBJ_ELF */ -} - -#ifdef OBJ_EVAX - -/* Add symbol+addend to link pool. - Return offset from basesym to entry in link pool. - - Add new fixup only if offset isn't 16bit. */ - -valueT -add_to_link_pool (basesym, sym, addend) - symbolS *basesym; - symbolS *sym; - offsetT addend; -{ - segT current_section = now_seg; - int current_subsec = now_subseg; - valueT offset; - bfd_reloc_code_real_type reloc_type; - char *p; - segment_info_type *seginfo = seg_info (alpha_link_section); - fixS *fixp; - - offset = - *symbol_get_obj (basesym); - - /* @@ This assumes all entries in a given section will be of the same - size... Probably correct, but unwise to rely on. */ - /* This must always be called with the same subsegment. */ - - if (seginfo->frchainP) - for (fixp = seginfo->frchainP->fix_root; - fixp != (fixS *) NULL; - fixp = fixp->fx_next, offset += 8) - { - if (fixp->fx_addsy == sym && fixp->fx_offset == addend) - { - if (range_signed_16 (offset)) - { - return offset; - } - } - } - - /* Not found in 16bit signed range. */ - - subseg_set (alpha_link_section, 0); - p = frag_more (8); - memset (p, 0, 8); - - fix_new (frag_now, p - frag_now->fr_literal, 8, sym, addend, 0, - BFD_RELOC_64); - - subseg_set (current_section, current_subsec); - seginfo->literal_pool_size += 8; - return offset; -} - -#endif /* OBJ_EVAX */ - -/* Load a (partial) expression into a target register. - - If poffset is not null, after the call it will either contain - O_constant 0, or a 16-bit offset appropriate for any MEM format - instruction. In addition, pbasereg will be modified to point to - the base register to use in that MEM format instruction. - - In any case, *pbasereg should contain a base register to add to the - expression. This will normally be either AXP_REG_ZERO or - alpha_gp_register. Symbol addresses will always be loaded via $gp, - so "foo($0)" is interpreted as adding the address of foo to $0; - i.e. "ldq $targ, LIT($gp); addq $targ, $0, $targ". Odd, perhaps, - but this is what OSF/1 does. - - If explicit relocations of the form !literal! are allowed, - and used, then explicit_reloc with be an expression pointer. - - Finally, the return value is nonzero if the calling macro may emit - a LITUSE reloc if otherwise appropriate; the return value is the - sequence number to use. */ - -static long -load_expression (targreg, exp, pbasereg, poffset) - int targreg; - const expressionS *exp; - int *pbasereg; - expressionS *poffset; -{ - long emit_lituse = 0; - offsetT addend = exp->X_add_number; - int basereg = *pbasereg; - struct alpha_insn insn; - expressionS newtok[3]; - - switch (exp->X_op) - { - case O_symbol: - { -#ifdef OBJ_ECOFF - offsetT lit; - - /* Attempt to reduce .lit load by splitting the offset from - its symbol when possible, but don't create a situation in - which we'd fail. */ - if (!range_signed_32 (addend) && - (alpha_noat_on || targreg == AXP_REG_AT)) - { - lit = add_to_literal_pool (exp->X_add_symbol, addend, - alpha_lita_section, 8); - addend = 0; - } - else - { - lit = add_to_literal_pool (exp->X_add_symbol, 0, - alpha_lita_section, 8); - } - - if (lit >= 0x8000) - as_fatal (_("overflow in literal (.lita) table")); - - /* emit "ldq r, lit(gp)" */ - - if (basereg != alpha_gp_register && targreg == basereg) - { - if (alpha_noat_on) - as_bad (_("macro requires $at register while noat in effect")); - if (targreg == AXP_REG_AT) - as_bad (_("macro requires $at while $at in use")); - - set_tok_reg (newtok[0], AXP_REG_AT); - } - else - set_tok_reg (newtok[0], targreg); - set_tok_sym (newtok[1], alpha_lita_symbol, lit); - set_tok_preg (newtok[2], alpha_gp_register); - - assemble_tokens_to_insn ("ldq", newtok, 3, &insn); - - assert (insn.nfixups == 1); - insn.fixups[0].reloc = BFD_RELOC_ALPHA_LITERAL; - insn.sequence = emit_lituse = next_sequence_num--; -#endif /* OBJ_ECOFF */ -#ifdef OBJ_ELF - /* emit "ldq r, gotoff(gp)" */ - - if (basereg != alpha_gp_register && targreg == basereg) - { - if (alpha_noat_on) - as_bad (_("macro requires $at register while noat in effect")); - if (targreg == AXP_REG_AT) - as_bad (_("macro requires $at while $at in use")); - - set_tok_reg (newtok[0], AXP_REG_AT); - } - else - set_tok_reg (newtok[0], targreg); - - /* XXX: Disable this .got minimizing optimization so that we can get - better instruction offset knowledge in the compiler. This happens - very infrequently anyway. */ - if (1 - || (!range_signed_32 (addend) - && (alpha_noat_on || targreg == AXP_REG_AT))) - { - newtok[1] = *exp; - addend = 0; - } - else - { - set_tok_sym (newtok[1], exp->X_add_symbol, 0); - } - - set_tok_preg (newtok[2], alpha_gp_register); - - assemble_tokens_to_insn ("ldq", newtok, 3, &insn); - - assert (insn.nfixups == 1); - insn.fixups[0].reloc = BFD_RELOC_ALPHA_ELF_LITERAL; - insn.sequence = emit_lituse = next_sequence_num--; -#endif /* OBJ_ELF */ -#ifdef OBJ_EVAX - offsetT link; - - /* Find symbol or symbol pointer in link section. */ - - if (exp->X_add_symbol == alpha_evax_proc.symbol) - { - if (range_signed_16 (addend)) - { - set_tok_reg (newtok[0], targreg); - set_tok_const (newtok[1], addend); - set_tok_preg (newtok[2], basereg); - assemble_tokens_to_insn ("lda", newtok, 3, &insn); - addend = 0; - } - else - { - set_tok_reg (newtok[0], targreg); - set_tok_const (newtok[1], 0); - set_tok_preg (newtok[2], basereg); - assemble_tokens_to_insn ("lda", newtok, 3, &insn); - } - } - else - { - if (!range_signed_32 (addend)) - { - link = add_to_link_pool (alpha_evax_proc.symbol, - exp->X_add_symbol, addend); - addend = 0; - } - else - { - link = add_to_link_pool (alpha_evax_proc.symbol, - exp->X_add_symbol, 0); - } - set_tok_reg (newtok[0], targreg); - set_tok_const (newtok[1], link); - set_tok_preg (newtok[2], basereg); - assemble_tokens_to_insn ("ldq", newtok, 3, &insn); - } -#endif /* OBJ_EVAX */ - - emit_insn (&insn); - -#ifndef OBJ_EVAX - if (basereg != alpha_gp_register && basereg != AXP_REG_ZERO) - { - /* emit "addq r, base, r" */ - - set_tok_reg (newtok[1], basereg); - set_tok_reg (newtok[2], targreg); - assemble_tokens ("addq", newtok, 3, 0); - } -#endif - - basereg = targreg; - } - break; - - case O_constant: - break; - - case O_subtract: - /* Assume that this difference expression will be resolved to an - absolute value and that that value will fit in 16 bits. */ - - set_tok_reg (newtok[0], targreg); - newtok[1] = *exp; - set_tok_preg (newtok[2], basereg); - assemble_tokens ("lda", newtok, 3, 0); - - if (poffset) - set_tok_const (*poffset, 0); - return 0; - - case O_big: - if (exp->X_add_number > 0) - as_bad (_("bignum invalid; zero assumed")); - else - as_bad (_("floating point number invalid; zero assumed")); - addend = 0; - break; - - default: - as_bad (_("can't handle expression")); - addend = 0; - break; + fixup->exp.X_op = O_absent; + fixup->reloc = reloc; } - if (!range_signed_32 (addend)) - { - offsetT lit; - long seq_num = next_sequence_num--; - - /* For 64-bit addends, just put it in the literal pool. */ - -#ifdef OBJ_EVAX - /* emit "ldq targreg, lit(basereg)" */ - lit = add_to_link_pool (alpha_evax_proc.symbol, - section_symbol (absolute_section), addend); - set_tok_reg (newtok[0], targreg); - set_tok_const (newtok[1], lit); - set_tok_preg (newtok[2], alpha_gp_register); - assemble_tokens ("ldq", newtok, 3, 0); -#else - - if (alpha_lit8_section == NULL) - { - create_literal_section (".lit8", - &alpha_lit8_section, - &alpha_lit8_symbol); - -#ifdef OBJ_ECOFF - alpha_lit8_literal = add_to_literal_pool (alpha_lit8_symbol, 0x8000, - alpha_lita_section, 8); - if (alpha_lit8_literal >= 0x8000) - as_fatal (_("overflow in literal (.lita) table")); -#endif - } - - lit = add_to_literal_pool (NULL, addend, alpha_lit8_section, 8) - 0x8000; - if (lit >= 0x8000) - as_fatal (_("overflow in literal (.lit8) table")); - - /* emit "lda litreg, .lit8+0x8000" */ - - if (targreg == basereg) - { - if (alpha_noat_on) - as_bad (_("macro requires $at register while noat in effect")); - if (targreg == AXP_REG_AT) - as_bad (_("macro requires $at while $at in use")); - - set_tok_reg (newtok[0], AXP_REG_AT); - } - else - set_tok_reg (newtok[0], targreg); -#ifdef OBJ_ECOFF - set_tok_sym (newtok[1], alpha_lita_symbol, alpha_lit8_literal); -#endif -#ifdef OBJ_ELF - set_tok_sym (newtok[1], alpha_lit8_symbol, 0x8000); -#endif - set_tok_preg (newtok[2], alpha_gp_register); - - assemble_tokens_to_insn ("ldq", newtok, 3, &insn); - - assert (insn.nfixups == 1); -#ifdef OBJ_ECOFF - insn.fixups[0].reloc = BFD_RELOC_ALPHA_LITERAL; -#endif -#ifdef OBJ_ELF - insn.fixups[0].reloc = BFD_RELOC_ALPHA_ELF_LITERAL; -#endif - insn.sequence = seq_num; - - emit_insn (&insn); - - /* emit "ldq litreg, lit(litreg)" */ - - set_tok_const (newtok[1], lit); - set_tok_preg (newtok[2], newtok[0].X_add_number); - - assemble_tokens_to_insn ("ldq", newtok, 3, &insn); - - assert (insn.nfixups < MAX_INSN_FIXUPS); - insn.fixups[insn.nfixups].reloc = DUMMY_RELOC_LITUSE_BASE; - insn.fixups[insn.nfixups].exp.X_op = O_absent; - insn.nfixups++; - insn.sequence = seq_num; - emit_lituse = 0; - - emit_insn (&insn); - - /* emit "addq litreg, base, target" */ - - if (basereg != AXP_REG_ZERO) - { - set_tok_reg (newtok[1], basereg); - set_tok_reg (newtok[2], targreg); - assemble_tokens ("addq", newtok, 3, 0); - } -#endif /* !OBJ_EVAX */ - - if (poffset) - set_tok_const (*poffset, 0); - *pbasereg = targreg; - } - else - { - offsetT low, high, extra, tmp; - - /* for 32-bit operands, break up the addend */ - - low = sign_extend_16 (addend); - tmp = addend - low; - high = sign_extend_16 (tmp >> 16); - - if (tmp - (high << 16)) - { - extra = 0x4000; - tmp -= 0x40000000; - high = sign_extend_16 (tmp >> 16); - } - else - extra = 0; - - set_tok_reg (newtok[0], targreg); - set_tok_preg (newtok[2], basereg); - - if (extra) - { - /* emit "ldah r, extra(r) */ - set_tok_const (newtok[1], extra); - assemble_tokens ("ldah", newtok, 3, 0); - set_tok_preg (newtok[2], basereg = targreg); - } - - if (high) - { - /* emit "ldah r, high(r) */ - set_tok_const (newtok[1], high); - assemble_tokens ("ldah", newtok, 3, 0); - basereg = targreg; - set_tok_preg (newtok[2], basereg); - } - - if ((low && !poffset) || (!poffset && basereg != targreg)) - { - /* emit "lda r, low(base)" */ - set_tok_const (newtok[1], low); - assemble_tokens ("lda", newtok, 3, 0); - basereg = targreg; - low = 0; - } - - if (poffset) - set_tok_const (*poffset, low); - *pbasereg = basereg; - } - - return emit_lituse; -} - -/* The lda macro differs from the lda instruction in that it handles - most simple expressions, particularly symbol address loads and - large constants. */ - -static void -emit_lda (tok, ntok, unused) - const expressionS *tok; - int ntok; - const PTR unused ATTRIBUTE_UNUSED; -{ - int basereg; - - if (ntok == 2) - basereg = (tok[1].X_op == O_constant ? AXP_REG_ZERO : alpha_gp_register); - else - basereg = tok[2].X_add_number; - - (void) load_expression (tok[0].X_add_number, &tok[1], &basereg, NULL); -} - -/* The ldah macro differs from the ldah instruction in that it has $31 - as an implied base register. */ - -static void -emit_ldah (tok, ntok, unused) - const expressionS *tok; - int ntok ATTRIBUTE_UNUSED; - const PTR unused ATTRIBUTE_UNUSED; -{ - expressionS newtok[3]; - - newtok[0] = tok[0]; - newtok[1] = tok[1]; - set_tok_preg (newtok[2], AXP_REG_ZERO); - - assemble_tokens ("ldah", newtok, 3, 0); + insn->insn = image; } /* Handle all "simple" integer register loads -- ldq, ldq_l, ldq_u, @@ -3407,10 +1991,9 @@ emit_ldah (tok, ntok, unused) expressions like the lda macro. */ static void -emit_ir_load (tok, ntok, opname) - const expressionS *tok; - int ntok; - const PTR opname; +emit_ir_load (const expressionS *tok, + int ntok, + const void * opname) { int basereg; long lituse; @@ -3446,10 +2029,9 @@ emit_ir_load (tok, ntok, opname) Again, we handle simple expressions. */ static void -emit_loadstore (tok, ntok, opname) - const expressionS *tok; - int ntok; - const PTR opname; +emit_loadstore (const expressionS *tok, + int ntok, + const void * opname) { int basereg; long lituse; @@ -3494,10 +2076,9 @@ emit_loadstore (tok, ntok, opname) /* Load a half-word or byte as an unsigned value. */ static void -emit_ldXu (tok, ntok, vlgsize) - const expressionS *tok; - int ntok; - const PTR vlgsize; +emit_ldXu (const expressionS *tok, + int ntok, + const void * vlgsize) { if (alpha_target & AXP_OPCODE_BWX) emit_ir_load (tok, ntok, ldXu_op[(long) vlgsize]); @@ -3517,12 +2098,10 @@ emit_ldXu (tok, ntok, vlgsize) else basereg = tok[2].X_add_number; - /* emit "lda $at, exp" */ - + /* Emit "lda $at, exp". */ lituse = load_expression (AXP_REG_AT, &tok[1], &basereg, NULL); - /* emit "ldq_u targ, 0($at)" */ - + /* Emit "ldq_u targ, 0($at)". */ newtok[0] = tok[0]; set_tok_const (newtok[1], 0); set_tok_preg (newtok[2], basereg); @@ -3539,8 +2118,7 @@ emit_ldXu (tok, ntok, vlgsize) emit_insn (&insn); - /* emit "extXl targ, $at, targ" */ - + /* Emit "extXl targ, $at, targ". */ set_tok_reg (newtok[1], basereg); newtok[2] = newtok[0]; assemble_tokens_to_insn (extXl_op[(long) vlgsize], newtok, 3, &insn); @@ -3561,10 +2139,9 @@ emit_ldXu (tok, ntok, vlgsize) /* Load a half-word or byte as a signed value. */ static void -emit_ldX (tok, ntok, vlgsize) - const expressionS *tok; - int ntok; - const PTR vlgsize; +emit_ldX (const expressionS *tok, + int ntok, + const void * vlgsize) { emit_ldXu (tok, ntok, vlgsize); assemble_tokens (sextX_op[(long) vlgsize], tok, 1, 1); @@ -3574,10 +2151,9 @@ emit_ldX (tok, ntok, vlgsize) value. */ static void -emit_uldXu (tok, ntok, vlgsize) - const expressionS *tok; - int ntok; - const PTR vlgsize; +emit_uldXu (const expressionS *tok, + int ntok, + const void * vlgsize) { long lgsize = (long) vlgsize; expressionS newtok[3]; @@ -3585,40 +2161,34 @@ emit_uldXu (tok, ntok, vlgsize) if (alpha_noat_on) as_bad (_("macro requires $at register while noat in effect")); - /* emit "lda $at, exp" */ - + /* Emit "lda $at, exp". */ memcpy (newtok, tok, sizeof (expressionS) * ntok); newtok[0].X_add_number = AXP_REG_AT; assemble_tokens ("lda", newtok, ntok, 1); - /* emit "ldq_u $t9, 0($at)" */ - + /* Emit "ldq_u $t9, 0($at)". */ set_tok_reg (newtok[0], AXP_REG_T9); set_tok_const (newtok[1], 0); set_tok_preg (newtok[2], AXP_REG_AT); assemble_tokens ("ldq_u", newtok, 3, 1); - /* emit "ldq_u $t10, size-1($at)" */ - + /* Emit "ldq_u $t10, size-1($at)". */ set_tok_reg (newtok[0], AXP_REG_T10); set_tok_const (newtok[1], (1 << lgsize) - 1); assemble_tokens ("ldq_u", newtok, 3, 1); - /* emit "extXl $t9, $at, $t9" */ - + /* Emit "extXl $t9, $at, $t9". */ set_tok_reg (newtok[0], AXP_REG_T9); set_tok_reg (newtok[1], AXP_REG_AT); set_tok_reg (newtok[2], AXP_REG_T9); assemble_tokens (extXl_op[lgsize], newtok, 3, 1); - /* emit "extXh $t10, $at, $t10" */ - + /* Emit "extXh $t10, $at, $t10". */ set_tok_reg (newtok[0], AXP_REG_T10); set_tok_reg (newtok[2], AXP_REG_T10); assemble_tokens (extXh_op[lgsize], newtok, 3, 1); - /* emit "or $t9, $t10, targ" */ - + /* Emit "or $t9, $t10, targ". */ set_tok_reg (newtok[0], AXP_REG_T9); set_tok_reg (newtok[1], AXP_REG_T10); newtok[2] = tok[0]; @@ -3630,10 +2200,9 @@ emit_uldXu (tok, ntok, vlgsize) don't have to do the sign extension. */ static void -emit_uldX (tok, ntok, vlgsize) - const expressionS *tok; - int ntok; - const PTR vlgsize; +emit_uldX (const expressionS *tok, + int ntok, + const void * vlgsize) { emit_uldXu (tok, ntok, vlgsize); assemble_tokens (sextX_op[(long) vlgsize], tok, 1, 1); @@ -3642,10 +2211,9 @@ emit_uldX (tok, ntok, vlgsize) /* Implement the ldil macro. */ static void -emit_ldil (tok, ntok, unused) - const expressionS *tok; - int ntok; - const PTR unused ATTRIBUTE_UNUSED; +emit_ldil (const expressionS *tok, + int ntok, + const void * unused ATTRIBUTE_UNUSED) { expressionS newtok[2]; @@ -3658,10 +2226,9 @@ emit_ldil (tok, ntok, unused) /* Store a half-word or byte. */ static void -emit_stX (tok, ntok, vlgsize) - const expressionS *tok; - int ntok; - const PTR vlgsize; +emit_stX (const expressionS *tok, + int ntok, + const void * vlgsize) { int lgsize = (int) (long) vlgsize; @@ -3683,12 +2250,10 @@ emit_stX (tok, ntok, vlgsize) else basereg = tok[2].X_add_number; - /* emit "lda $at, exp" */ - + /* Emit "lda $at, exp". */ lituse = load_expression (AXP_REG_AT, &tok[1], &basereg, NULL); - /* emit "ldq_u $t9, 0($at)" */ - + /* Emit "ldq_u $t9, 0($at)". */ set_tok_reg (newtok[0], AXP_REG_T9); set_tok_const (newtok[1], 0); set_tok_preg (newtok[2], basereg); @@ -3705,8 +2270,7 @@ emit_stX (tok, ntok, vlgsize) emit_insn (&insn); - /* emit "insXl src, $at, $t10" */ - + /* Emit "insXl src, $at, $t10". */ newtok[0] = tok[0]; set_tok_reg (newtok[1], basereg); set_tok_reg (newtok[2], AXP_REG_T10); @@ -3723,8 +2287,7 @@ emit_stX (tok, ntok, vlgsize) emit_insn (&insn); - /* emit "mskXl $t9, $at, $t9" */ - + /* Emit "mskXl $t9, $at, $t9". */ set_tok_reg (newtok[0], AXP_REG_T9); newtok[2] = newtok[0]; assemble_tokens_to_insn (mskXl_op[lgsize], newtok, 3, &insn); @@ -3740,13 +2303,11 @@ emit_stX (tok, ntok, vlgsize) emit_insn (&insn); - /* emit "or $t9, $t10, $t9" */ - + /* Emit "or $t9, $t10, $t9". */ set_tok_reg (newtok[1], AXP_REG_T10); assemble_tokens ("or", newtok, 3, 1); - /* emit "stq_u $t9, 0($at) */ - + /* Emit "stq_u $t9, 0($at). */ set_tok_const(newtok[1], 0); set_tok_preg (newtok[2], AXP_REG_AT); assemble_tokens_to_insn ("stq_u", newtok, 3, &insn); @@ -3767,80 +2328,68 @@ emit_stX (tok, ntok, vlgsize) /* Store an integer to an unaligned address. */ static void -emit_ustX (tok, ntok, vlgsize) - const expressionS *tok; - int ntok; - const PTR vlgsize; +emit_ustX (const expressionS *tok, + int ntok, + const void * vlgsize) { int lgsize = (int) (long) vlgsize; expressionS newtok[3]; - /* emit "lda $at, exp" */ - + /* Emit "lda $at, exp". */ memcpy (newtok, tok, sizeof (expressionS) * ntok); newtok[0].X_add_number = AXP_REG_AT; assemble_tokens ("lda", newtok, ntok, 1); - /* emit "ldq_u $9, 0($at)" */ - + /* Emit "ldq_u $9, 0($at)". */ set_tok_reg (newtok[0], AXP_REG_T9); set_tok_const (newtok[1], 0); set_tok_preg (newtok[2], AXP_REG_AT); assemble_tokens ("ldq_u", newtok, 3, 1); - /* emit "ldq_u $10, size-1($at)" */ - + /* Emit "ldq_u $10, size-1($at)". */ set_tok_reg (newtok[0], AXP_REG_T10); set_tok_const (newtok[1], (1 << lgsize) - 1); assemble_tokens ("ldq_u", newtok, 3, 1); - /* emit "insXl src, $at, $t11" */ - + /* Emit "insXl src, $at, $t11". */ newtok[0] = tok[0]; set_tok_reg (newtok[1], AXP_REG_AT); set_tok_reg (newtok[2], AXP_REG_T11); assemble_tokens (insXl_op[lgsize], newtok, 3, 1); - /* emit "insXh src, $at, $t12" */ - + /* Emit "insXh src, $at, $t12". */ set_tok_reg (newtok[2], AXP_REG_T12); assemble_tokens (insXh_op[lgsize], newtok, 3, 1); - /* emit "mskXl $t9, $at, $t9" */ - + /* Emit "mskXl $t9, $at, $t9". */ set_tok_reg (newtok[0], AXP_REG_T9); newtok[2] = newtok[0]; assemble_tokens (mskXl_op[lgsize], newtok, 3, 1); - /* emit "mskXh $t10, $at, $t10" */ - + /* Emit "mskXh $t10, $at, $t10". */ set_tok_reg (newtok[0], AXP_REG_T10); newtok[2] = newtok[0]; assemble_tokens (mskXh_op[lgsize], newtok, 3, 1); - /* emit "or $t9, $t11, $t9" */ - + /* Emit "or $t9, $t11, $t9". */ set_tok_reg (newtok[0], AXP_REG_T9); set_tok_reg (newtok[1], AXP_REG_T11); newtok[2] = newtok[0]; assemble_tokens ("or", newtok, 3, 1); - /* emit "or $t10, $t12, $t10" */ - + /* Emit "or $t10, $t12, $t10". */ set_tok_reg (newtok[0], AXP_REG_T10); set_tok_reg (newtok[1], AXP_REG_T12); newtok[2] = newtok[0]; assemble_tokens ("or", newtok, 3, 1); - /* emit "stq_u $t9, 0($at)" */ - + /* Emit "stq_u $t9, 0($at)". */ set_tok_reg (newtok[0], AXP_REG_T9); set_tok_const (newtok[1], 0); set_tok_preg (newtok[2], AXP_REG_AT); assemble_tokens ("stq_u", newtok, 3, 1); - /* emit "stq_u $t10, size-1($at)" */ - + /* Emit "stq_u $t10, size-1($at)". */ set_tok_reg (newtok[0], AXP_REG_T10); set_tok_const (newtok[1], (1 << lgsize) - 1); assemble_tokens ("stq_u", newtok, 3, 1); @@ -3850,10 +2399,9 @@ emit_ustX (tok, ntok, vlgsize) implemented as "addl $31, $r, $t" in the opcode table. */ static void -emit_sextX (tok, ntok, vlgsize) - const expressionS *tok; - int ntok; - const PTR vlgsize; +emit_sextX (const expressionS *tok, + int ntok, + const void * vlgsize) { long lgsize = (long) vlgsize; @@ -3864,15 +2412,13 @@ emit_sextX (tok, ntok, vlgsize) int bitshift = 64 - 8 * (1 << lgsize); expressionS newtok[3]; - /* emit "sll src,bits,dst" */ - + /* Emit "sll src,bits,dst". */ newtok[0] = tok[0]; set_tok_const (newtok[1], bitshift); newtok[2] = tok[ntok - 1]; assemble_tokens ("sll", newtok, 3, 1); - /* emit "sra dst,bits,dst" */ - + /* Emit "sra dst,bits,dst". */ newtok[0] = newtok[2]; assemble_tokens ("sra", newtok, 3, 1); } @@ -3886,13 +2432,12 @@ emit_sextX (tok, ntok, vlgsize) Don't clobber PV and RA. */ static void -emit_division (tok, ntok, symname) - const expressionS *tok; - int ntok; - const PTR symname; +emit_division (const expressionS *tok, + int ntok, + const void * symname) { /* DIVISION and MODULUS. Yech. - + Convert OP x,y,result to @@ -3901,7 +2446,7 @@ emit_division (tok, ntok, symname) lda AT,__OP jsr AT,(AT),0 mov R0,result - + with appropriate optimizations if R0,R16,R17 are the registers specified by the compiler. */ @@ -3921,7 +2466,6 @@ emit_division (tok, ntok, symname) if (yr == AXP_REG_R16 && xr == AXP_REG_R17) { /* They are in exactly the wrong order -- swap through AT. */ - if (alpha_noat_on) as_bad (_("macro requires $at register while noat in effect")); @@ -3985,10 +2529,9 @@ emit_division (tok, ntok, symname) #else /* !OBJ_EVAX */ static void -emit_division (tok, ntok, symname) - const expressionS *tok; - int ntok; - const PTR symname; +emit_division (const expressionS *tok, + int ntok, + const void * symname) { /* DIVISION and MODULUS. Yech. Convert @@ -3999,7 +2542,7 @@ emit_division (tok, ntok, symname) mov y,t11 jsr t9,(pv),__OP mov t12,result - + with appropriate optimizations if t10,t11,t12 are the registers specified by the compiler. */ @@ -4092,10 +2635,9 @@ FIXME everything. */ static void -emit_jsrjmp (tok, ntok, vopname) - const expressionS *tok; - int ntok; - const PTR vopname; +emit_jsrjmp (const expressionS *tok, + int ntok, + const void * vopname) { const char *opname = (const char *) vopname; struct alpha_insn insn; @@ -4114,7 +2656,7 @@ emit_jsrjmp (tok, ntok, vopname) (tok[tokidx].X_op == O_pregister || tok[tokidx].X_op == O_cpregister)) r = regno (tok[tokidx++].X_add_number); #ifdef OBJ_EVAX - /* keep register if jsr $n. */ + /* Keep register if jsr $n.. */ #else else { @@ -4152,10 +2694,9 @@ emit_jsrjmp (tok, ntok, vopname) counterparts in that everything can be defaulted. */ static void -emit_retjcr (tok, ntok, vopname) - const expressionS *tok; - int ntok; - const PTR vopname; +emit_retjcr (const expressionS *tok, + int ntok, + const void * vopname) { const char *opname = (const char *) vopname; expressionS newtok[3]; @@ -4183,6 +2724,482 @@ emit_retjcr (tok, ntok, vopname) assemble_tokens (opname, newtok, 3, 0); } + +/* Implement the ldgp macro. */ + +static void +emit_ldgp (const expressionS *tok, + int ntok ATTRIBUTE_UNUSED, + const void * unused ATTRIBUTE_UNUSED) +{ +#ifdef OBJ_AOUT +FIXME +#endif +#if defined(OBJ_ECOFF) || defined(OBJ_ELF) + /* from "ldgp r1,n(r2)", generate "ldah r1,X(R2); lda r1,Y(r1)" + with appropriate constants and relocations. */ + struct alpha_insn insn; + expressionS newtok[3]; + expressionS addend; + +#ifdef OBJ_ECOFF + if (regno (tok[2].X_add_number) == AXP_REG_PV) + ecoff_set_gp_prolog_size (0); +#endif + + newtok[0] = tok[0]; + set_tok_const (newtok[1], 0); + newtok[2] = tok[2]; + + assemble_tokens_to_insn ("ldah", newtok, 3, &insn); + + addend = tok[1]; + +#ifdef OBJ_ECOFF + if (addend.X_op != O_constant) + as_bad (_("can not resolve expression")); + addend.X_op = O_symbol; + addend.X_add_symbol = alpha_gp_symbol; +#endif + + insn.nfixups = 1; + insn.fixups[0].exp = addend; + insn.fixups[0].reloc = BFD_RELOC_ALPHA_GPDISP_HI16; + insn.sequence = next_sequence_num; + + emit_insn (&insn); + + set_tok_preg (newtok[2], tok[0].X_add_number); + + assemble_tokens_to_insn ("lda", newtok, 3, &insn); + +#ifdef OBJ_ECOFF + addend.X_add_number += 4; +#endif + + insn.nfixups = 1; + insn.fixups[0].exp = addend; + insn.fixups[0].reloc = BFD_RELOC_ALPHA_GPDISP_LO16; + insn.sequence = next_sequence_num--; + + emit_insn (&insn); +#endif /* OBJ_ECOFF || OBJ_ELF */ +} + +/* The macro table. */ + +static const struct alpha_macro alpha_macros[] = +{ +/* Load/Store macros. */ + { "lda", emit_lda, NULL, + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, + { "ldah", emit_ldah, NULL, + { MACRO_IR, MACRO_EXP, MACRO_EOA } }, + + { "ldl", emit_ir_load, "ldl", + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, + { "ldl_l", emit_ir_load, "ldl_l", + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, + { "ldq", emit_ir_load, "ldq", + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, + { "ldq_l", emit_ir_load, "ldq_l", + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, + { "ldq_u", emit_ir_load, "ldq_u", + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, + { "ldf", emit_loadstore, "ldf", + { MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, + { "ldg", emit_loadstore, "ldg", + { MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, + { "lds", emit_loadstore, "lds", + { MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, + { "ldt", emit_loadstore, "ldt", + { MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, + + { "ldb", emit_ldX, (void *) 0, + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, + { "ldbu", emit_ldXu, (void *) 0, + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, + { "ldw", emit_ldX, (void *) 1, + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, + { "ldwu", emit_ldXu, (void *) 1, + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, + + { "uldw", emit_uldX, (void *) 1, + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, + { "uldwu", emit_uldXu, (void *) 1, + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, + { "uldl", emit_uldX, (void *) 2, + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, + { "uldlu", emit_uldXu, (void *) 2, + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, + { "uldq", emit_uldXu, (void *) 3, + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, + + { "ldgp", emit_ldgp, NULL, + { MACRO_IR, MACRO_EXP, MACRO_PIR, MACRO_EOA } }, + + { "ldi", emit_lda, NULL, + { MACRO_IR, MACRO_EXP, MACRO_EOA } }, + { "ldil", emit_ldil, NULL, + { MACRO_IR, MACRO_EXP, MACRO_EOA } }, + { "ldiq", emit_lda, NULL, + { MACRO_IR, MACRO_EXP, MACRO_EOA } }, + + { "stl", emit_loadstore, "stl", + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, + { "stl_c", emit_loadstore, "stl_c", + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, + { "stq", emit_loadstore, "stq", + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, + { "stq_c", emit_loadstore, "stq_c", + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, + { "stq_u", emit_loadstore, "stq_u", + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, + { "stf", emit_loadstore, "stf", + { MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, + { "stg", emit_loadstore, "stg", + { MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, + { "sts", emit_loadstore, "sts", + { MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, + { "stt", emit_loadstore, "stt", + { MACRO_FPR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, + + { "stb", emit_stX, (void *) 0, + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, + { "stw", emit_stX, (void *) 1, + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, + { "ustw", emit_ustX, (void *) 1, + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, + { "ustl", emit_ustX, (void *) 2, + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, + { "ustq", emit_ustX, (void *) 3, + { MACRO_IR, MACRO_EXP, MACRO_OPIR, MACRO_EOA } }, + +/* Arithmetic macros. */ + + { "sextb", emit_sextX, (void *) 0, + { MACRO_IR, MACRO_IR, MACRO_EOA, + MACRO_IR, MACRO_EOA, + /* MACRO_EXP, MACRO_IR, MACRO_EOA */ } }, + { "sextw", emit_sextX, (void *) 1, + { MACRO_IR, MACRO_IR, MACRO_EOA, + MACRO_IR, MACRO_EOA, + /* MACRO_EXP, MACRO_IR, MACRO_EOA */ } }, + + { "divl", emit_division, "__divl", + { MACRO_IR, MACRO_IR, MACRO_IR, MACRO_EOA, + MACRO_IR, MACRO_IR, MACRO_EOA, + /* MACRO_IR, MACRO_EXP, MACRO_IR, MACRO_EOA, + MACRO_IR, MACRO_EXP, MACRO_EOA */ } }, + { "divlu", emit_division, "__divlu", + { MACRO_IR, MACRO_IR, MACRO_IR, MACRO_EOA, + MACRO_IR, MACRO_IR, MACRO_EOA, + /* MACRO_IR, MACRO_EXP, MACRO_IR, MACRO_EOA, + MACRO_IR, MACRO_EXP, MACRO_EOA */ } }, + { "divq", emit_division, "__divq", + { MACRO_IR, MACRO_IR, MACRO_IR, MACRO_EOA, + MACRO_IR, MACRO_IR, MACRO_EOA, + /* MACRO_IR, MACRO_EXP, MACRO_IR, MACRO_EOA, + MACRO_IR, MACRO_EXP, MACRO_EOA */ } }, + { "divqu", emit_division, "__divqu", + { MACRO_IR, MACRO_IR, MACRO_IR, MACRO_EOA, + MACRO_IR, MACRO_IR, MACRO_EOA, + /* MACRO_IR, MACRO_EXP, MACRO_IR, MACRO_EOA, + MACRO_IR, MACRO_EXP, MACRO_EOA */ } }, + { "reml", emit_division, "__reml", + { MACRO_IR, MACRO_IR, MACRO_IR, MACRO_EOA, + MACRO_IR, MACRO_IR, MACRO_EOA, + /* MACRO_IR, MACRO_EXP, MACRO_IR, MACRO_EOA, + MACRO_IR, MACRO_EXP, MACRO_EOA */ } }, + { "remlu", emit_division, "__remlu", + { MACRO_IR, MACRO_IR, MACRO_IR, MACRO_EOA, + MACRO_IR, MACRO_IR, MACRO_EOA, + /* MACRO_IR, MACRO_EXP, MACRO_IR, MACRO_EOA, + MACRO_IR, MACRO_EXP, MACRO_EOA */ } }, + { "remq", emit_division, "__remq", + { MACRO_IR, MACRO_IR, MACRO_IR, MACRO_EOA, + MACRO_IR, MACRO_IR, MACRO_EOA, + /* MACRO_IR, MACRO_EXP, MACRO_IR, MACRO_EOA, + MACRO_IR, MACRO_EXP, MACRO_EOA */ } }, + { "remqu", emit_division, "__remqu", + { MACRO_IR, MACRO_IR, MACRO_IR, MACRO_EOA, + MACRO_IR, MACRO_IR, MACRO_EOA, + /* MACRO_IR, MACRO_EXP, MACRO_IR, MACRO_EOA, + MACRO_IR, MACRO_EXP, MACRO_EOA */ } }, + + { "jsr", emit_jsrjmp, "jsr", + { MACRO_PIR, MACRO_EXP, MACRO_EOA, + MACRO_PIR, MACRO_EOA, + MACRO_IR, MACRO_EXP, MACRO_EOA, + MACRO_EXP, MACRO_EOA } }, + { "jmp", emit_jsrjmp, "jmp", + { MACRO_PIR, MACRO_EXP, MACRO_EOA, + MACRO_PIR, MACRO_EOA, + MACRO_IR, MACRO_EXP, MACRO_EOA, + MACRO_EXP, MACRO_EOA } }, + { "ret", emit_retjcr, "ret", + { MACRO_IR, MACRO_EXP, MACRO_EOA, + MACRO_IR, MACRO_EOA, + MACRO_PIR, MACRO_EXP, MACRO_EOA, + MACRO_PIR, MACRO_EOA, + MACRO_EXP, MACRO_EOA, + MACRO_EOA } }, + { "jcr", emit_retjcr, "jcr", + { MACRO_IR, MACRO_EXP, MACRO_EOA, + MACRO_IR, MACRO_EOA, + MACRO_PIR, MACRO_EXP, MACRO_EOA, + MACRO_PIR, MACRO_EOA, + MACRO_EXP, MACRO_EOA, + MACRO_EOA } }, + { "jsr_coroutine", emit_retjcr, "jcr", + { MACRO_IR, MACRO_EXP, MACRO_EOA, + MACRO_IR, MACRO_EOA, + MACRO_PIR, MACRO_EXP, MACRO_EOA, + MACRO_PIR, MACRO_EOA, + MACRO_EXP, MACRO_EOA, + MACRO_EOA } }, +}; + +static const unsigned int alpha_num_macros + = sizeof (alpha_macros) / sizeof (*alpha_macros); + +/* Search forward through all variants of a macro looking for a syntax + match. */ + +static const struct alpha_macro * +find_macro_match (const struct alpha_macro *first_macro, + const expressionS *tok, + int *pntok) + +{ + const struct alpha_macro *macro = first_macro; + int ntok = *pntok; + + do + { + const enum alpha_macro_arg *arg = macro->argsets; + int tokidx = 0; + + while (*arg) + { + switch (*arg) + { + case MACRO_EOA: + if (tokidx == ntok) + return macro; + else + tokidx = 0; + break; + + /* Index register. */ + case MACRO_IR: + if (tokidx >= ntok || tok[tokidx].X_op != O_register + || !is_ir_num (tok[tokidx].X_add_number)) + goto match_failed; + ++tokidx; + break; + + /* Parenthesized index register. */ + case MACRO_PIR: + if (tokidx >= ntok || tok[tokidx].X_op != O_pregister + || !is_ir_num (tok[tokidx].X_add_number)) + goto match_failed; + ++tokidx; + break; + + /* Optional parenthesized index register. */ + case MACRO_OPIR: + if (tokidx < ntok && tok[tokidx].X_op == O_pregister + && is_ir_num (tok[tokidx].X_add_number)) + ++tokidx; + break; + + /* Leading comma with a parenthesized index register. */ + case MACRO_CPIR: + if (tokidx >= ntok || tok[tokidx].X_op != O_cpregister + || !is_ir_num (tok[tokidx].X_add_number)) + goto match_failed; + ++tokidx; + break; + + /* Floating point register. */ + case MACRO_FPR: + if (tokidx >= ntok || tok[tokidx].X_op != O_register + || !is_fpr_num (tok[tokidx].X_add_number)) + goto match_failed; + ++tokidx; + break; + + /* Normal expression. */ + case MACRO_EXP: + if (tokidx >= ntok) + goto match_failed; + switch (tok[tokidx].X_op) + { + case O_illegal: + case O_absent: + case O_register: + case O_pregister: + case O_cpregister: + case O_literal: + case O_lituse_base: + case O_lituse_bytoff: + case O_lituse_jsr: + case O_gpdisp: + case O_gprelhigh: + case O_gprellow: + case O_gprel: + case O_samegp: + goto match_failed; + + default: + break; + } + ++tokidx; + break; + + match_failed: + while (*arg != MACRO_EOA) + ++arg; + tokidx = 0; + break; + } + ++arg; + } + } + while (++macro - alpha_macros < (int) alpha_num_macros + && !strcmp (macro->name, first_macro->name)); + + return NULL; +} + +/* Given an opcode name and a pre-tokenized set of arguments, take the + opcode all the way through emission. */ + +static void +assemble_tokens (const char *opname, + const expressionS *tok, + int ntok, + int local_macros_on) +{ + int found_something = 0; + const struct alpha_opcode *opcode; + const struct alpha_macro *macro; + int cpumatch = 1; + bfd_reloc_code_real_type reloc = BFD_RELOC_UNUSED; + +#ifdef RELOC_OP_P + /* If a user-specified relocation is present, this is not a macro. */ + if (ntok && USER_RELOC_P (tok[ntok - 1].X_op)) + { + reloc = ALPHA_RELOC_TABLE (tok[ntok - 1].X_op)->reloc; + ntok--; + } + else +#endif + if (local_macros_on) + { + macro = ((const struct alpha_macro *) + hash_find (alpha_macro_hash, opname)); + if (macro) + { + found_something = 1; + macro = find_macro_match (macro, tok, &ntok); + if (macro) + { + (*macro->emit) (tok, ntok, macro->arg); + return; + } + } + } + + /* Search opcodes. */ + opcode = (const struct alpha_opcode *) hash_find (alpha_opcode_hash, opname); + if (opcode) + { + found_something = 1; + opcode = find_opcode_match (opcode, tok, &ntok, &cpumatch); + if (opcode) + { + struct alpha_insn insn; + assemble_insn (opcode, tok, ntok, &insn, reloc); + + /* Copy the sequence number for the reloc from the reloc token. */ + if (reloc != BFD_RELOC_UNUSED) + insn.sequence = tok[ntok].X_add_number; + + emit_insn (&insn); + return; + } + } + + if (found_something) + { + if (cpumatch) + as_bad (_("inappropriate arguments for opcode `%s'"), opname); + else + as_bad (_("opcode `%s' not supported for target %s"), opname, + alpha_target_name); + } + else + as_bad (_("unknown opcode `%s'"), opname); +} + +#ifdef OBJ_EVAX + +/* Add symbol+addend to link pool. + Return offset from basesym to entry in link pool. + + Add new fixup only if offset isn't 16bit. */ + +valueT +add_to_link_pool (symbolS *basesym, + symbolS *sym, + offsetT addend) +{ + segT current_section = now_seg; + int current_subsec = now_subseg; + valueT offset; + bfd_reloc_code_real_type reloc_type; + char *p; + segment_info_type *seginfo = seg_info (alpha_link_section); + fixS *fixp; + + offset = - *symbol_get_obj (basesym); + + /* @@ This assumes all entries in a given section will be of the same + size... Probably correct, but unwise to rely on. */ + /* This must always be called with the same subsegment. */ + + if (seginfo->frchainP) + for (fixp = seginfo->frchainP->fix_root; + fixp != (fixS *) NULL; + fixp = fixp->fx_next, offset += 8) + { + if (fixp->fx_addsy == sym && fixp->fx_offset == addend) + { + if (range_signed_16 (offset)) + { + return offset; + } + } + } + + /* Not found in 16bit signed range. */ + + subseg_set (alpha_link_section, 0); + p = frag_more (8); + memset (p, 0, 8); + + fix_new (frag_now, p - frag_now->fr_literal, 8, sym, addend, 0, + BFD_RELOC_64); + + subseg_set (current_section, current_subsec); + seginfo->literal_pool_size += 8; + return offset; +} + +#endif /* OBJ_EVAX */ /* Assembler directives. */ @@ -4190,8 +3207,7 @@ emit_retjcr (tok, ntok, vopname) clears alpha_insn_label and restores auto alignment. */ static void -s_alpha_text (i) - int i; +s_alpha_text (int i) { #ifdef OBJ_ELF @@ -4208,8 +3224,7 @@ s_alpha_text (i) clears alpha_insn_label and restores auto alignment. */ static void -s_alpha_data (i) - int i; +s_alpha_data (int i) { #ifdef OBJ_ELF obj_elf_data (i); @@ -4227,15 +3242,13 @@ s_alpha_data (i) openVMS constructs a section for every common symbol. */ static void -s_alpha_comm (ignore) - int ignore ATTRIBUTE_UNUSED; +s_alpha_comm (int ignore ATTRIBUTE_UNUSED) { - register char *name; - register char c; - register char *p; + char *name; + char c; + char *p; offsetT temp; - register symbolS *symbolP; - + symbolS *symbolP; #ifdef OBJ_EVAX segT current_section = now_seg; int current_subsec = now_subseg; @@ -4245,7 +3258,7 @@ s_alpha_comm (ignore) name = input_line_pointer; c = get_symbol_end (); - /* just after name is now '\0' */ + /* Just after name is now '\0'. */ p = input_line_pointer; *p = c; @@ -4275,7 +3288,7 @@ s_alpha_comm (ignore) *p = c; #ifdef OBJ_EVAX - /* alignment might follow */ + /* Alignment might follow. */ if (*input_line_pointer == ',') { offsetT align; @@ -4318,10 +3331,10 @@ s_alpha_comm (ignore) subseg_set (new_seg, 0); p = frag_more (temp); new_seg->flags |= SEC_IS_COMMON; - if (! S_IS_DEFINED (symbolP)) - S_SET_SEGMENT (symbolP, new_seg); + S_SET_SEGMENT (symbolP, new_seg); #else S_SET_VALUE (symbolP, (valueT) temp); + S_SET_SEGMENT (symbolP, bfd_com_section_ptr); #endif S_SET_EXTERNAL (symbolP); } @@ -4343,8 +3356,7 @@ s_alpha_comm (ignore) clears alpha_insn_label and restores auto alignment. */ static void -s_alpha_rdata (ignore) - int ignore ATTRIBUTE_UNUSED; +s_alpha_rdata (int ignore ATTRIBUTE_UNUSED) { int temp; @@ -4364,8 +3376,7 @@ s_alpha_rdata (ignore) clears alpha_insn_label and restores auto alignment. */ static void -s_alpha_sdata (ignore) - int ignore ATTRIBUTE_UNUSED; +s_alpha_sdata (int ignore ATTRIBUTE_UNUSED) { int temp; @@ -4403,8 +3414,7 @@ static struct alpha_elf_frame_data *cur_frame_data; clears alpha_insn_label and restores auto alignment. */ static void -s_alpha_section (ignore) - int ignore ATTRIBUTE_UNUSED; +s_alpha_section (int ignore ATTRIBUTE_UNUSED) { obj_elf_section (ignore); @@ -4414,8 +3424,7 @@ s_alpha_section (ignore) } static void -s_alpha_ent (dummy) - int dummy ATTRIBUTE_UNUSED; +s_alpha_ent (int dummy ATTRIBUTE_UNUSED) { if (ECOFF_DEBUGGING) ecoff_directive_ent (0); @@ -4467,8 +3476,7 @@ s_alpha_ent (dummy) } static void -s_alpha_end (dummy) - int dummy ATTRIBUTE_UNUSED; +s_alpha_end (int dummy ATTRIBUTE_UNUSED) { if (ECOFF_DEBUGGING) ecoff_directive_end (0); @@ -4517,8 +3525,7 @@ s_alpha_end (dummy) } static void -s_alpha_mask (fp) - int fp; +s_alpha_mask (int fp) { if (ECOFF_DEBUGGING) { @@ -4570,8 +3577,7 @@ s_alpha_mask (fp) } static void -s_alpha_frame (dummy) - int dummy ATTRIBUTE_UNUSED; +s_alpha_frame (int dummy ATTRIBUTE_UNUSED) { if (ECOFF_DEBUGGING) ecoff_directive_frame (0); @@ -4609,8 +3615,7 @@ s_alpha_frame (dummy) } static void -s_alpha_prologue (ignore) - int ignore ATTRIBUTE_UNUSED; +s_alpha_prologue (int ignore ATTRIBUTE_UNUSED) { symbolS *sym; int arg; @@ -4654,8 +3659,7 @@ s_alpha_prologue (ignore) static char *first_file_directive; static void -s_alpha_file (ignore) - int ignore ATTRIBUTE_UNUSED; +s_alpha_file (int ignore ATTRIBUTE_UNUSED) { /* Save the first .file directive we see, so that we can change our minds about whether ecoff debugging should or shouldn't be enabled. */ @@ -4681,8 +3685,7 @@ s_alpha_file (ignore) } static void -s_alpha_loc (ignore) - int ignore ATTRIBUTE_UNUSED; +s_alpha_loc (int ignore ATTRIBUTE_UNUSED) { if (ECOFF_DEBUGGING) ecoff_directive_loc (0); @@ -4691,8 +3694,7 @@ s_alpha_loc (ignore) } static void -s_alpha_stab (n) - int n; +s_alpha_stab (int n) { /* If we've been undecided about mdebug, make up our minds in favour. */ if (alpha_flag_mdebug < 0) @@ -4718,8 +3720,7 @@ s_alpha_stab (n) } static void -s_alpha_coff_wrapper (which) - int which; +s_alpha_coff_wrapper (int which) { static void (* const fns[]) PARAMS ((int)) = { ecoff_directive_begin, @@ -4866,7 +3867,7 @@ s_alpha_usepv (int unused ATTRIBUTE_UNUSED) as_bad (_("unknown argument for .usepv")); other = 0; } - + *input_line_pointer = which_end; demand_empty_rest_of_line (); @@ -4877,7 +3878,7 @@ s_alpha_usepv (int unused ATTRIBUTE_UNUSED) /* Standard calling conventions leaves the CFA at $30 on entry. */ void -alpha_cfi_frame_initial_instructions () +alpha_cfi_frame_initial_instructions (void) { cfi_add_CFA_def_cfa_register (30); } @@ -4887,8 +3888,7 @@ alpha_cfi_frame_initial_instructions () /* Handle the section specific pseudo-op. */ static void -s_alpha_section (secid) - int secid; +s_alpha_section (int secid) { int temp; #define EVAX_SECTION_COUNT 5 @@ -4912,8 +3912,7 @@ s_alpha_section (secid) /* Parse .ent directives. */ static void -s_alpha_ent (ignore) - int ignore ATTRIBUTE_UNUSED; +s_alpha_ent (int ignore ATTRIBUTE_UNUSED) { symbolS *symbol; expressionS symexpr; @@ -4948,8 +3947,7 @@ s_alpha_ent (ignore) /* Parse .frame ,,RA, directives. */ static void -s_alpha_frame (ignore) - int ignore ATTRIBUTE_UNUSED; +s_alpha_frame (int ignore ATTRIBUTE_UNUSED) { long val; @@ -4980,8 +3978,7 @@ s_alpha_frame (ignore) } static void -s_alpha_pdesc (ignore) - int ignore ATTRIBUTE_UNUSED; +s_alpha_pdesc (int ignore ATTRIBUTE_UNUSED) { char *name; char name_end; @@ -5036,17 +4033,14 @@ s_alpha_pdesc (ignore) name_end = get_symbol_end (); if (strncmp (name, "stack", 5) == 0) - { - alpha_evax_proc.pdsckind = PDSC_S_K_KIND_FP_STACK; - } + alpha_evax_proc.pdsckind = PDSC_S_K_KIND_FP_STACK; + else if (strncmp (name, "reg", 3) == 0) - { - alpha_evax_proc.pdsckind = PDSC_S_K_KIND_FP_REGISTER; - } + alpha_evax_proc.pdsckind = PDSC_S_K_KIND_FP_REGISTER; + else if (strncmp (name, "null", 4) == 0) - { - alpha_evax_proc.pdsckind = PDSC_S_K_KIND_NULL; - } + alpha_evax_proc.pdsckind = PDSC_S_K_KIND_NULL; + else { as_fatal (_("unknown procedure kind")); @@ -5131,10 +4125,9 @@ s_alpha_pdesc (ignore) /* Support for crash debug on vms. */ static void -s_alpha_name (ignore) - int ignore ATTRIBUTE_UNUSED; +s_alpha_name (int ignore ATTRIBUTE_UNUSED) { - register char *p; + char *p; expressionS exp; segment_info_type *seginfo = seg_info (alpha_link_section); @@ -5167,8 +4160,7 @@ s_alpha_name (ignore) } static void -s_alpha_linkage (ignore) - int ignore ATTRIBUTE_UNUSED; +s_alpha_linkage (int ignore ATTRIBUTE_UNUSED) { expressionS exp; char *p; @@ -5193,8 +4185,7 @@ s_alpha_linkage (ignore) } static void -s_alpha_code_address (ignore) - int ignore ATTRIBUTE_UNUSED; +s_alpha_code_address (int ignore ATTRIBUTE_UNUSED) { expressionS exp; char *p; @@ -5205,9 +4196,7 @@ s_alpha_code_address (ignore) expression (&exp); if (exp.X_op != O_symbol) - { - as_fatal (_("No symbol after .code_address")); - } + as_fatal (_("No symbol after .code_address")); else { p = frag_more (8); @@ -5219,8 +4208,7 @@ s_alpha_code_address (ignore) } static void -s_alpha_fp_save (ignore) - int ignore ATTRIBUTE_UNUSED; +s_alpha_fp_save (int ignore ATTRIBUTE_UNUSED) { alpha_evax_proc.fp_save = tc_get_register (1); @@ -5229,8 +4217,7 @@ s_alpha_fp_save (ignore) } static void -s_alpha_mask (ignore) - int ignore ATTRIBUTE_UNUSED; +s_alpha_mask (int ignore ATTRIBUTE_UNUSED) { long val; @@ -5248,8 +4235,7 @@ s_alpha_mask (ignore) } static void -s_alpha_fmask (ignore) - int ignore ATTRIBUTE_UNUSED; +s_alpha_fmask (int ignore ATTRIBUTE_UNUSED) { long val; @@ -5267,8 +4253,7 @@ s_alpha_fmask (ignore) } static void -s_alpha_end (ignore) - int ignore ATTRIBUTE_UNUSED; +s_alpha_end (int ignore ATTRIBUTE_UNUSED) { char c; @@ -5279,8 +4264,7 @@ s_alpha_end (ignore) } static void -s_alpha_file (ignore) - int ignore ATTRIBUTE_UNUSED; +s_alpha_file (int ignore ATTRIBUTE_UNUSED) { symbolS *s; int length; @@ -5302,8 +4286,7 @@ s_alpha_file (ignore) /* Handle the .gprel32 pseudo op. */ static void -s_alpha_gprel32 (ignore) - int ignore ATTRIBUTE_UNUSED; +s_alpha_gprel32 (int ignore ATTRIBUTE_UNUSED) { expressionS e; char *p; @@ -5357,8 +4340,7 @@ s_alpha_gprel32 (ignore) correctly aligned. */ static void -s_alpha_float_cons (type) - int type; +s_alpha_float_cons (int type) { int log_size; @@ -5397,8 +4379,7 @@ s_alpha_float_cons (type) parse it. */ static void -s_alpha_proc (is_static) - int is_static ATTRIBUTE_UNUSED; +s_alpha_proc (int is_static ATTRIBUTE_UNUSED) { char *name; char c; @@ -5406,7 +4387,7 @@ s_alpha_proc (is_static) symbolS *symbolP; int temp; - /* Takes ".proc name,nargs" */ + /* Takes ".proc name,nargs". */ SKIP_WHITESPACE (); name = input_line_pointer; c = get_symbol_end (); @@ -5436,8 +4417,7 @@ s_alpha_proc (is_static) the assembler features. */ static void -s_alpha_set (x) - int x ATTRIBUTE_UNUSED; +s_alpha_set (int x ATTRIBUTE_UNUSED) { char *name, ch, *s; int yesno = 1; @@ -5473,21 +4453,13 @@ s_alpha_set (x) the $gp register. */ static void -s_alpha_base (ignore) - int ignore ATTRIBUTE_UNUSED; +s_alpha_base (int ignore ATTRIBUTE_UNUSED) { -#if 0 - if (first_32bit_quadrant) - { - /* not fatal, but it might not work in the end */ - as_warn (_("File overrides no-base-register option.")); - first_32bit_quadrant = 0; - } -#endif - SKIP_WHITESPACE (); + if (*input_line_pointer == '$') - { /* $rNN form */ + { + /* $rNN form. */ input_line_pointer++; if (*input_line_pointer == 'r') input_line_pointer++; @@ -5508,8 +4480,7 @@ s_alpha_base (ignore) way the MIPS port does: .align 0 turns off auto alignment. */ static void -s_alpha_align (ignore) - int ignore ATTRIBUTE_UNUSED; +s_alpha_align (int ignore ATTRIBUTE_UNUSED) { int align; char fill, *pfill; @@ -5552,8 +4523,7 @@ s_alpha_align (ignore) /* Hook the normal string processor to reset known alignment. */ static void -s_alpha_stringer (terminate) - int terminate; +s_alpha_stringer (int terminate) { alpha_current_align = 0; alpha_insn_label = NULL; @@ -5563,8 +4533,7 @@ s_alpha_stringer (terminate) /* Hook the normal space processing to reset known alignment. */ static void -s_alpha_space (ignore) - int ignore; +s_alpha_space (int ignore) { alpha_current_align = 0; alpha_insn_label = NULL; @@ -5574,8 +4543,7 @@ s_alpha_space (ignore) /* Hook into cons for auto-alignment. */ void -alpha_cons_align (size) - int size; +alpha_cons_align (int size) { int log_size; @@ -5594,8 +4562,7 @@ alpha_cons_align (size) pseudos. We just turn off auto-alignment and call down to cons. */ static void -s_alpha_ucons (bytes) - int bytes; +s_alpha_ucons (int bytes) { int hold = alpha_auto_align_on; alpha_auto_align_on = 0; @@ -5606,8 +4573,7 @@ s_alpha_ucons (bytes) /* Switch the working cpu type. */ static void -s_alpha_arch (ignored) - int ignored ATTRIBUTE_UNUSED; +s_alpha_arch (int ignored ATTRIBUTE_UNUSED) { char *name, ch; const struct cpu_type *p; @@ -5633,9 +4599,7 @@ found: /* print token expression with alpha specific extension. */ static void -alpha_print_token (f, exp) - FILE *f; - const expressionS *exp; +alpha_print_token (FILE *f, const expressionS *exp) { switch (exp->X_op) { @@ -5660,9 +4624,10 @@ alpha_print_token (f, exp) /* The target specific pseudo-ops which we support. */ -const pseudo_typeS md_pseudo_table[] = { +const pseudo_typeS md_pseudo_table[] = +{ #ifdef OBJ_ECOFF - {"comm", s_alpha_comm, 0}, /* osf1 compiler does this */ + {"comm", s_alpha_comm, 0}, /* OSF1 compiler does this. */ {"rdata", s_alpha_rdata, 0}, #endif {"text", s_alpha_text, 0}, @@ -5769,29 +4734,6 @@ const pseudo_typeS md_pseudo_table[] = { {NULL, 0, 0}, }; -/* Build a BFD section with its flags set appropriately for the .lita, - .lit8, or .lit4 sections. */ - -static void -create_literal_section (name, secp, symp) - const char *name; - segT *secp; - symbolS **symp; -{ - segT current_section = now_seg; - int current_subsec = now_subseg; - segT new_sec; - - *secp = new_sec = subseg_new (name, 0); - subseg_set (current_section, current_subsec); - bfd_set_section_alignment (stdoutput, new_sec, 4); - bfd_set_section_flags (stdoutput, new_sec, - SEC_RELOC | SEC_ALLOC | SEC_LOAD | SEC_READONLY - | SEC_DATA); - - S_CLEAR_EXTERNAL (*symp = section_symbol (new_sec)); -} - #ifdef OBJ_ECOFF /* @@@ GP selection voodoo. All of this seems overly complicated and @@ -5799,10 +4741,10 @@ create_literal_section (name, secp, symp) static inline void maybe_set_gp PARAMS ((asection *)); static inline void -maybe_set_gp (sec) - asection *sec; +maybe_set_gp (asection *sec) { bfd_vma vma; + if (!sec) return; vma = bfd_get_section_vma (foo, sec); @@ -5811,7 +4753,7 @@ maybe_set_gp (sec) } static void -select_gp_value () +select_gp_value (void) { assert (alpha_gp_value == 0); @@ -5821,12 +4763,6 @@ select_gp_value () /* Select the smallest VMA of these existing sections. */ maybe_set_gp (alpha_lita_section); -#if 0 - /* These were disabled before -- should we use them? */ - maybe_set_gp (sdata); - maybe_set_gp (lit8_sec); - maybe_set_gp (lit4_sec); -#endif /* @@ Will a simple 0x8000 work here? If not, why not? */ #define GP_ADJUSTMENT (0x8000 - 0x10) @@ -5845,9 +4781,7 @@ select_gp_value () /* Map 's' to SHF_ALPHA_GPREL. */ int -alpha_elf_section_letter (letter, ptr_msg) - int letter; - char **ptr_msg; +alpha_elf_section_letter (int letter, char **ptr_msg) { if (letter == 's') return SHF_ALPHA_GPREL; @@ -5859,9 +4793,7 @@ alpha_elf_section_letter (letter, ptr_msg) /* Map SHF_ALPHA_GPREL to SEC_SMALL_DATA. */ flagword -alpha_elf_section_flags (flags, attr, type) - flagword flags; - int attr, type ATTRIBUTE_UNUSED; +alpha_elf_section_flags (flagword flags, int attr, int type ATTRIBUTE_UNUSED) { if (attr & SHF_ALPHA_GPREL) flags |= SEC_SMALL_DATA; @@ -5869,54 +4801,15 @@ alpha_elf_section_flags (flags, attr, type) } #endif /* OBJ_ELF */ -/* Called internally to handle all alignment needs. This takes care - of eliding calls to frag_align if'n the cached current alignment - says we've already got it, as well as taking care of the auto-align - feature wrt labels. */ - -static void -alpha_align (n, pfill, label, force) - int n; - char *pfill; - symbolS *label; - int force ATTRIBUTE_UNUSED; -{ - if (alpha_current_align >= n) - return; - - if (pfill == NULL) - { - if (subseg_text_p (now_seg)) - frag_align_code (n, 0); - else - frag_align (n, 0, 0); - } - else - frag_align (n, *pfill, 0); - - alpha_current_align = n; - - if (label != NULL && S_GET_SEGMENT (label) == now_seg) - { - symbol_set_frag (label, frag_now); - S_SET_VALUE (label, (valueT) frag_now_fix ()); - } - - record_alignment (now_seg, n); - - /* ??? If alpha_flag_relax && force && elf, record the requested alignment - in a reloc for the linker to see. */ -} - /* This is called from HANDLE_ALIGN in write.c. Fill in the contents of an rs_align_code fragment. */ void -alpha_handle_align (fragp) - fragS *fragp; +alpha_handle_align (fragS *fragp) { static char const unop[4] = { 0x00, 0x00, 0xfe, 0x2f }; - static char const nopunop[8] = { + static char const nopunop[8] = + { 0x1f, 0x04, 0xff, 0x47, 0x00, 0x00, 0xfe, 0x2f }; @@ -5952,6 +4845,866 @@ alpha_handle_align (fragp) fragp->fr_fix += fix; fragp->fr_var = 8; } + +/* Public interface functions. */ + +/* This function is called once, at assembler startup time. It sets + up all the tables, etc. that the MD part of the assembler will + need, that can be determined before arguments are parsed. */ + +void +md_begin (void) +{ + unsigned int i; + + /* Verify that X_op field is wide enough. */ + { + expressionS e; + + e.X_op = O_max; + assert (e.X_op == O_max); + } + + /* Create the opcode hash table. */ + alpha_opcode_hash = hash_new (); + + for (i = 0; i < alpha_num_opcodes;) + { + const char *name, *retval, *slash; + + name = alpha_opcodes[i].name; + retval = hash_insert (alpha_opcode_hash, name, (void *) &alpha_opcodes[i]); + if (retval) + as_fatal (_("internal error: can't hash opcode `%s': %s"), + name, retval); + + /* Some opcodes include modifiers of various sorts with a "/mod" + syntax, like the architecture manual suggests. However, for + use with gcc at least, we also need access to those same opcodes + without the "/". */ + + if ((slash = strchr (name, '/')) != NULL) + { + char *p = xmalloc (strlen (name)); + + memcpy (p, name, slash - name); + strcpy (p + (slash - name), slash + 1); + + (void) hash_insert (alpha_opcode_hash, p, (void *) &alpha_opcodes[i]); + /* Ignore failures -- the opcode table does duplicate some + variants in different forms, like "hw_stq" and "hw_st/q". */ + } + + while (++i < alpha_num_opcodes + && (alpha_opcodes[i].name == name + || !strcmp (alpha_opcodes[i].name, name))) + continue; + } + + /* Create the macro hash table. */ + alpha_macro_hash = hash_new (); + + for (i = 0; i < alpha_num_macros;) + { + const char *name, *retval; + + name = alpha_macros[i].name; + retval = hash_insert (alpha_macro_hash, name, (void *) &alpha_macros[i]); + if (retval) + as_fatal (_("internal error: can't hash macro `%s': %s"), + name, retval); + + while (++i < alpha_num_macros + && (alpha_macros[i].name == name + || !strcmp (alpha_macros[i].name, name))) + continue; + } + + /* Construct symbols for each of the registers. */ + for (i = 0; i < 32; ++i) + { + char name[4]; + + sprintf (name, "$%d", i); + alpha_register_table[i] = symbol_create (name, reg_section, i, + &zero_address_frag); + } + + for (; i < 64; ++i) + { + char name[5]; + + sprintf (name, "$f%d", i - 32); + alpha_register_table[i] = symbol_create (name, reg_section, i, + &zero_address_frag); + } + + /* Create the special symbols and sections we'll be using. */ + + /* So .sbss will get used for tiny objects. */ + bfd_set_gp_size (stdoutput, g_switch_value); + +#ifdef OBJ_ECOFF + create_literal_section (".lita", &alpha_lita_section, &alpha_lita_symbol); + + /* For handling the GP, create a symbol that won't be output in the + symbol table. We'll edit it out of relocs later. */ + alpha_gp_symbol = symbol_create ("", alpha_lita_section, 0x8000, + &zero_address_frag); +#endif + +#ifdef OBJ_EVAX + create_literal_section (".link", &alpha_link_section, &alpha_link_symbol); +#endif + +#ifdef OBJ_ELF + if (ECOFF_DEBUGGING) + { + segT sec = subseg_new (".mdebug", (subsegT) 0); + bfd_set_section_flags (stdoutput, sec, SEC_HAS_CONTENTS | SEC_READONLY); + bfd_set_section_alignment (stdoutput, sec, 3); + } +#endif + + /* Create literal lookup hash table. */ + alpha_literal_hash = hash_new (); + + subseg_set (text_section, 0); +} + +/* The public interface to the instruction assembler. */ + +void +md_assemble (char *str) +{ + /* Current maximum is 13. */ + char opname[32]; + expressionS tok[MAX_INSN_ARGS]; + int ntok, trunclen; + size_t opnamelen; + + /* Split off the opcode. */ + opnamelen = strspn (str, "abcdefghijklmnopqrstuvwxyz_/46819"); + trunclen = (opnamelen < sizeof (opname) - 1 + ? opnamelen + : sizeof (opname) - 1); + memcpy (opname, str, trunclen); + opname[trunclen] = '\0'; + + /* Tokenize the rest of the line. */ + if ((ntok = tokenize_arguments (str + opnamelen, tok, MAX_INSN_ARGS)) < 0) + { + if (ntok != TOKENIZE_ERROR_REPORT) + as_bad (_("syntax error")); + + return; + } + + /* Finish it off. */ + assemble_tokens (opname, tok, ntok, alpha_macros_on); +} + +/* Round up a section's size to the appropriate boundary. */ + +valueT +md_section_align (segT seg, valueT size) +{ + int align = bfd_get_section_alignment (stdoutput, seg); + valueT mask = ((valueT) 1 << align) - 1; + + return (size + mask) & ~mask; +} + +/* 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 + +extern char *vax_md_atof (int, char *, int *); + +char * +md_atof (int type, char *litP, int *sizeP) +{ + int prec; + LITTLENUM_TYPE words[MAX_LITTLENUMS]; + LITTLENUM_TYPE *wordP; + char *t; + + switch (type) + { + /* VAX floats. */ + case 'G': + /* VAX md_atof doesn't like "G" for some reason. */ + type = 'g'; + case 'F': + case 'D': + return vax_md_atof (type, litP, sizeP); + + /* IEEE floats. */ + case 'f': + prec = 2; + break; + + case 'd': + prec = 4; + break; + + case 'x': + case 'X': + prec = 6; + break; + + case 'p': + case 'P': + prec = 6; + 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 - 1; prec--;) + { + md_number_to_chars (litP, (long) (*wordP--), sizeof (LITTLENUM_TYPE)); + litP += sizeof (LITTLENUM_TYPE); + } + + return 0; +} + +/* Take care of the target-specific command-line options. */ + +int +md_parse_option (int c, char *arg) +{ + switch (c) + { + case 'F': + alpha_nofloats_on = 1; + break; + + case OPTION_32ADDR: + alpha_addr32_on = 1; + break; + + case 'g': + alpha_debug = 1; + break; + + case 'G': + g_switch_value = atoi (arg); + break; + + case 'm': + { + const struct cpu_type *p; + + for (p = cpu_types; p->name; ++p) + if (strcmp (arg, p->name) == 0) + { + alpha_target_name = p->name, alpha_target = p->flags; + goto found; + } + as_warn (_("Unknown CPU identifier `%s'"), arg); + found:; + } + break; + +#ifdef OBJ_EVAX + case '+': /* For g++. Hash any name > 63 chars long. */ + alpha_flag_hash_long_names = 1; + break; + + case 'H': /* Show new symbol after hash truncation. */ + alpha_flag_show_after_trunc = 1; + break; + + case 'h': /* For gnu-c/vax compatibility. */ + break; +#endif + + case OPTION_RELAX: + alpha_flag_relax = 1; + break; + +#ifdef OBJ_ELF + case OPTION_MDEBUG: + alpha_flag_mdebug = 1; + break; + case OPTION_NO_MDEBUG: + alpha_flag_mdebug = 0; + break; +#endif + + default: + return 0; + } + + return 1; +} + +/* Print a description of the command-line options that we accept. */ + +void +md_show_usage (FILE *stream) +{ + fputs (_("\ +Alpha options:\n\ +-32addr treat addresses as 32-bit values\n\ +-F lack floating point instructions support\n\ +-mev4 | -mev45 | -mev5 | -mev56 | -mpca56 | -mev6 | -mev67 | -mev68 | -mall\n\ + specify variant of Alpha architecture\n\ +-m21064 | -m21066 | -m21164 | -m21164a | -m21164pc | -m21264 | -m21264a | -m21264b\n\ + these variants include PALcode opcodes\n"), + stream); +#ifdef OBJ_EVAX + fputs (_("\ +VMS options:\n\ +-+ hash encode (don't truncate) names longer than 64 characters\n\ +-H show new symbol after hash truncation\n"), + stream); +#endif +} + +/* Decide from what point a pc-relative relocation is relative to, + relative to the pc-relative fixup. Er, relatively speaking. */ + +long +md_pcrel_from (fixS *fixP) +{ + valueT addr = fixP->fx_where + fixP->fx_frag->fr_address; + + switch (fixP->fx_r_type) + { + case BFD_RELOC_23_PCREL_S2: + case BFD_RELOC_ALPHA_HINT: + case BFD_RELOC_ALPHA_BRSGP: + return addr + 4; + default: + return addr; + } +} + +/* Attempt to simplify or even eliminate a fixup. The return value is + ignored; perhaps it was once meaningful, but now it is historical. + To indicate that a fixup has been eliminated, set fixP->fx_done. + + For ELF, here it is that we transform the GPDISP_HI16 reloc we used + internally into the GPDISP reloc used externally. We had to do + this so that we'd have the GPDISP_LO16 reloc as a tag to compute + the distance to the "lda" instruction for setting the addend to + GPDISP. */ + +void +md_apply_fix (fixS *fixP, valueT * valP, segT seg) +{ + char * const fixpos = fixP->fx_frag->fr_literal + fixP->fx_where; + valueT value = * valP; + unsigned image, size; + + switch (fixP->fx_r_type) + { + /* The GPDISP relocations are processed internally with a symbol + referring to the current function's section; we need to drop + in a value which, when added to the address of the start of + the function, gives the desired GP. */ + case BFD_RELOC_ALPHA_GPDISP_HI16: + { + fixS *next = fixP->fx_next; + + /* With user-specified !gpdisp relocations, we can be missing + the matching LO16 reloc. We will have already issued an + error message. */ + if (next) + fixP->fx_offset = (next->fx_frag->fr_address + next->fx_where + - fixP->fx_frag->fr_address - fixP->fx_where); + + value = (value - sign_extend_16 (value)) >> 16; + } +#ifdef OBJ_ELF + fixP->fx_r_type = BFD_RELOC_ALPHA_GPDISP; +#endif + goto do_reloc_gp; + + case BFD_RELOC_ALPHA_GPDISP_LO16: + value = sign_extend_16 (value); + fixP->fx_offset = 0; +#ifdef OBJ_ELF + fixP->fx_done = 1; +#endif + + do_reloc_gp: + fixP->fx_addsy = section_symbol (seg); + md_number_to_chars (fixpos, value, 2); + break; + + case BFD_RELOC_16: + if (fixP->fx_pcrel) + fixP->fx_r_type = BFD_RELOC_16_PCREL; + size = 2; + goto do_reloc_xx; + + case BFD_RELOC_32: + if (fixP->fx_pcrel) + fixP->fx_r_type = BFD_RELOC_32_PCREL; + size = 4; + goto do_reloc_xx; + + case BFD_RELOC_64: + if (fixP->fx_pcrel) + fixP->fx_r_type = BFD_RELOC_64_PCREL; + size = 8; + + do_reloc_xx: + if (fixP->fx_pcrel == 0 && fixP->fx_addsy == 0) + { + md_number_to_chars (fixpos, value, size); + goto done; + } + return; + +#ifdef OBJ_ECOFF + case BFD_RELOC_GPREL32: + assert (fixP->fx_subsy == alpha_gp_symbol); + fixP->fx_subsy = 0; + /* FIXME: inherited this obliviousness of `value' -- why? */ + md_number_to_chars (fixpos, -alpha_gp_value, 4); + break; +#else + case BFD_RELOC_GPREL32: +#endif + case BFD_RELOC_GPREL16: + case BFD_RELOC_ALPHA_GPREL_HI16: + case BFD_RELOC_ALPHA_GPREL_LO16: + return; + + case BFD_RELOC_23_PCREL_S2: + if (fixP->fx_pcrel == 0 && fixP->fx_addsy == 0) + { + image = bfd_getl32 (fixpos); + image = (image & ~0x1FFFFF) | ((value >> 2) & 0x1FFFFF); + goto write_done; + } + return; + + case BFD_RELOC_ALPHA_HINT: + if (fixP->fx_pcrel == 0 && fixP->fx_addsy == 0) + { + image = bfd_getl32 (fixpos); + image = (image & ~0x3FFF) | ((value >> 2) & 0x3FFF); + goto write_done; + } + return; + +#ifdef OBJ_ELF + case BFD_RELOC_ALPHA_BRSGP: + return; + + case BFD_RELOC_ALPHA_TLSGD: + case BFD_RELOC_ALPHA_TLSLDM: + case BFD_RELOC_ALPHA_GOTDTPREL16: + case BFD_RELOC_ALPHA_DTPREL_HI16: + case BFD_RELOC_ALPHA_DTPREL_LO16: + case BFD_RELOC_ALPHA_DTPREL16: + case BFD_RELOC_ALPHA_GOTTPREL16: + case BFD_RELOC_ALPHA_TPREL_HI16: + case BFD_RELOC_ALPHA_TPREL_LO16: + case BFD_RELOC_ALPHA_TPREL16: + if (fixP->fx_addsy) + S_SET_THREAD_LOCAL (fixP->fx_addsy); + return; +#endif + +#ifdef OBJ_ECOFF + case BFD_RELOC_ALPHA_LITERAL: + md_number_to_chars (fixpos, value, 2); + return; +#endif + case BFD_RELOC_ALPHA_ELF_LITERAL: + case BFD_RELOC_ALPHA_LITUSE: + case BFD_RELOC_ALPHA_LINKAGE: + case BFD_RELOC_ALPHA_CODEADDR: + return; + + case BFD_RELOC_VTABLE_INHERIT: + case BFD_RELOC_VTABLE_ENTRY: + return; + + default: + { + const struct alpha_operand *operand; + + if ((int) fixP->fx_r_type >= 0) + as_fatal (_("unhandled relocation type %s"), + bfd_get_reloc_code_name (fixP->fx_r_type)); + + assert (-(int) fixP->fx_r_type < (int) alpha_num_operands); + operand = &alpha_operands[-(int) fixP->fx_r_type]; + + /* The rest of these fixups only exist internally during symbol + resolution and have no representation in the object file. + Therefore they must be completely resolved as constants. */ + + if (fixP->fx_addsy != 0 + && S_GET_SEGMENT (fixP->fx_addsy) != absolute_section) + as_bad_where (fixP->fx_file, fixP->fx_line, + _("non-absolute expression in constant field")); + + image = bfd_getl32 (fixpos); + image = insert_operand (image, operand, (offsetT) value, + fixP->fx_file, fixP->fx_line); + } + goto write_done; + } + + if (fixP->fx_addsy != 0 || fixP->fx_pcrel != 0) + return; + else + { + as_warn_where (fixP->fx_file, fixP->fx_line, + _("type %d reloc done?\n"), (int) fixP->fx_r_type); + goto done; + } + +write_done: + md_number_to_chars (fixpos, image, 4); + +done: + fixP->fx_done = 1; +} + +/* Look for a register name in the given symbol. */ + +symbolS * +md_undefined_symbol (char *name) +{ + if (*name == '$') + { + int is_float = 0, num; + + switch (*++name) + { + case 'f': + if (name[1] == 'p' && name[2] == '\0') + return alpha_register_table[AXP_REG_FP]; + is_float = 32; + /* Fall through. */ + + case 'r': + if (!ISDIGIT (*++name)) + break; + /* Fall through. */ + + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + if (name[1] == '\0') + num = name[0] - '0'; + else if (name[0] != '0' && ISDIGIT (name[1]) && name[2] == '\0') + { + num = (name[0] - '0') * 10 + name[1] - '0'; + if (num >= 32) + break; + } + else + break; + + if (!alpha_noat_on && (num + is_float) == AXP_REG_AT) + as_warn (_("Used $at without \".set noat\"")); + return alpha_register_table[num + is_float]; + + case 'a': + if (name[1] == 't' && name[2] == '\0') + { + if (!alpha_noat_on) + as_warn (_("Used $at without \".set noat\"")); + return alpha_register_table[AXP_REG_AT]; + } + break; + + case 'g': + if (name[1] == 'p' && name[2] == '\0') + return alpha_register_table[alpha_gp_register]; + break; + + case 's': + if (name[1] == 'p' && name[2] == '\0') + return alpha_register_table[AXP_REG_SP]; + break; + } + } + return NULL; +} + +#ifdef OBJ_ECOFF +/* @@@ Magic ECOFF bits. */ + +void +alpha_frob_ecoff_data (void) +{ + select_gp_value (); + /* $zero and $f31 are read-only. */ + alpha_gprmask &= ~1; + alpha_fprmask &= ~1; +} +#endif + +/* Hook to remember a recently defined label so that the auto-align + code can adjust the symbol after we know what alignment will be + required. */ + +void +alpha_define_label (symbolS *sym) +{ + alpha_insn_label = sym; +#ifdef OBJ_ELF + dwarf2_emit_label (sym); +#endif +} + +/* Return true if we must always emit a reloc for a type and false if + there is some hope of resolving it at assembly time. */ + +int +alpha_force_relocation (fixS *f) +{ + if (alpha_flag_relax) + return 1; + + switch (f->fx_r_type) + { + case BFD_RELOC_ALPHA_GPDISP_HI16: + case BFD_RELOC_ALPHA_GPDISP_LO16: + case BFD_RELOC_ALPHA_GPDISP: + case BFD_RELOC_ALPHA_LITERAL: + case BFD_RELOC_ALPHA_ELF_LITERAL: + case BFD_RELOC_ALPHA_LITUSE: + case BFD_RELOC_GPREL16: + case BFD_RELOC_GPREL32: + case BFD_RELOC_ALPHA_GPREL_HI16: + case BFD_RELOC_ALPHA_GPREL_LO16: + case BFD_RELOC_ALPHA_LINKAGE: + case BFD_RELOC_ALPHA_CODEADDR: + case BFD_RELOC_ALPHA_BRSGP: + case BFD_RELOC_ALPHA_TLSGD: + case BFD_RELOC_ALPHA_TLSLDM: + case BFD_RELOC_ALPHA_GOTDTPREL16: + case BFD_RELOC_ALPHA_DTPREL_HI16: + case BFD_RELOC_ALPHA_DTPREL_LO16: + case BFD_RELOC_ALPHA_DTPREL16: + case BFD_RELOC_ALPHA_GOTTPREL16: + case BFD_RELOC_ALPHA_TPREL_HI16: + case BFD_RELOC_ALPHA_TPREL_LO16: + case BFD_RELOC_ALPHA_TPREL16: + return 1; + + default: + break; + } + + return generic_force_reloc (f); +} + +/* Return true if we can partially resolve a relocation now. */ + +int +alpha_fix_adjustable (fixS *f) +{ + /* Are there any relocation types for which we must generate a + reloc but we can adjust the values contained within it? */ + switch (f->fx_r_type) + { + case BFD_RELOC_ALPHA_GPDISP_HI16: + case BFD_RELOC_ALPHA_GPDISP_LO16: + case BFD_RELOC_ALPHA_GPDISP: + return 0; + + case BFD_RELOC_ALPHA_LITERAL: + case BFD_RELOC_ALPHA_ELF_LITERAL: + case BFD_RELOC_ALPHA_LITUSE: + case BFD_RELOC_ALPHA_LINKAGE: + case BFD_RELOC_ALPHA_CODEADDR: + return 1; + + case BFD_RELOC_VTABLE_ENTRY: + case BFD_RELOC_VTABLE_INHERIT: + return 0; + + case BFD_RELOC_GPREL16: + case BFD_RELOC_GPREL32: + case BFD_RELOC_ALPHA_GPREL_HI16: + case BFD_RELOC_ALPHA_GPREL_LO16: + case BFD_RELOC_23_PCREL_S2: + case BFD_RELOC_32: + case BFD_RELOC_64: + case BFD_RELOC_ALPHA_HINT: + return 1; + + case BFD_RELOC_ALPHA_TLSGD: + case BFD_RELOC_ALPHA_TLSLDM: + case BFD_RELOC_ALPHA_GOTDTPREL16: + case BFD_RELOC_ALPHA_DTPREL_HI16: + case BFD_RELOC_ALPHA_DTPREL_LO16: + case BFD_RELOC_ALPHA_DTPREL16: + case BFD_RELOC_ALPHA_GOTTPREL16: + case BFD_RELOC_ALPHA_TPREL_HI16: + case BFD_RELOC_ALPHA_TPREL_LO16: + case BFD_RELOC_ALPHA_TPREL16: + /* ??? No idea why we can't return a reference to .tbss+10, but + we're preventing this in the other assemblers. Follow for now. */ + return 0; + +#ifdef OBJ_ELF + case BFD_RELOC_ALPHA_BRSGP: + /* If we have a BRSGP reloc to a local symbol, adjust it to BRADDR and + let it get resolved at assembly time. */ + { + symbolS *sym = f->fx_addsy; + const char *name; + int offset = 0; + + if (generic_force_reloc (f)) + return 0; + + switch (S_GET_OTHER (sym) & STO_ALPHA_STD_GPLOAD) + { + case STO_ALPHA_NOPV: + break; + case STO_ALPHA_STD_GPLOAD: + offset = 8; + break; + default: + if (S_IS_LOCAL (sym)) + name = ""; + else + name = S_GET_NAME (sym); + as_bad_where (f->fx_file, f->fx_line, + _("!samegp reloc against symbol without .prologue: %s"), + name); + break; + } + f->fx_r_type = BFD_RELOC_23_PCREL_S2; + f->fx_offset += offset; + return 1; + } +#endif + + default: + return 1; + } +} + +/* Generate the BFD reloc to be stuck in the object file from the + fixup used internally in the assembler. */ + +arelent * +tc_gen_reloc (asection *sec ATTRIBUTE_UNUSED, + fixS *fixp) +{ + arelent *reloc; + + reloc = xmalloc (sizeof (* reloc)); + reloc->sym_ptr_ptr = xmalloc (sizeof (asymbol *)); + *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy); + reloc->address = fixp->fx_frag->fr_address + fixp->fx_where; + + /* Make sure none of our internal relocations make it this far. + They'd better have been fully resolved by this point. */ + assert ((int) fixp->fx_r_type > 0); + + reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type); + if (reloc->howto == NULL) + { + as_bad_where (fixp->fx_file, fixp->fx_line, + _("cannot represent `%s' relocation in object file"), + bfd_get_reloc_code_name (fixp->fx_r_type)); + return NULL; + } + + if (!fixp->fx_pcrel != !reloc->howto->pc_relative) + as_fatal (_("internal error? cannot generate `%s' relocation"), + bfd_get_reloc_code_name (fixp->fx_r_type)); + + assert (!fixp->fx_pcrel == !reloc->howto->pc_relative); + +#ifdef OBJ_ECOFF + if (fixp->fx_r_type == BFD_RELOC_ALPHA_LITERAL) + /* Fake out bfd_perform_relocation. sigh. */ + reloc->addend = -alpha_gp_value; + else +#endif + { + reloc->addend = fixp->fx_offset; +#ifdef OBJ_ELF + /* Ohhh, this is ugly. The problem is that if this is a local global + symbol, the relocation will entirely be performed at link time, not + at assembly time. bfd_perform_reloc doesn't know about this sort + of thing, and as a result we need to fake it out here. */ + if ((S_IS_EXTERNAL (fixp->fx_addsy) || S_IS_WEAK (fixp->fx_addsy) + || (S_GET_SEGMENT (fixp->fx_addsy)->flags & SEC_MERGE) + || (S_GET_SEGMENT (fixp->fx_addsy)->flags & SEC_THREAD_LOCAL)) + && !S_IS_COMMON (fixp->fx_addsy)) + reloc->addend -= symbol_get_bfdsym (fixp->fx_addsy)->value; +#endif + } + + return reloc; +} + +/* Parse a register name off of the input_line and return a register + number. Gets md_undefined_symbol above to do the register name + matching for us. + + Only called as a part of processing the ECOFF .frame directive. */ + +int +tc_get_register (int frame ATTRIBUTE_UNUSED) +{ + int framereg = AXP_REG_SP; + + SKIP_WHITESPACE (); + if (*input_line_pointer == '$') + { + char *s = input_line_pointer; + char c = get_symbol_end (); + symbolS *sym = md_undefined_symbol (s); + + *strchr (s, '\0') = c; + if (sym && (framereg = S_GET_VALUE (sym)) <= 31) + goto found; + } + as_warn (_("frame reg expected, using $%d."), framereg); + +found: + note_gpreg (framereg); + return framereg; +} + +/* This is called before the symbol table is processed. In order to + work with gcc when using mips-tfile, we must keep all local labels. + However, in other cases, we want to discard them. If we were + called with -g, but we didn't see any debugging information, it may + mean that gcc is smuggling debugging information through to + mips-tfile, in which case we must generate all local labels. */ + +#ifdef OBJ_ECOFF + +void +alpha_frob_file_before_adjust (void) +{ + if (alpha_debug != 0 + && ! ecoff_debugging_seen) + flag_keep_locals = 1; +} + +#endif /* OBJ_ECOFF */ /* The Alpha has support for some VAX floating point types, as well as for IEEE floating point. We consider IEEE to be the primary floating point diff --git a/contrib/binutils/gas/config/tc-alpha.h b/contrib/binutils/gas/config/tc-alpha.h index 939a14f296e..42e004e4148 100644 --- a/contrib/binutils/gas/config/tc-alpha.h +++ b/contrib/binutils/gas/config/tc-alpha.h @@ -1,5 +1,6 @@ /* This file is tc-alpha.h - Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 + Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 + 2005 Free Software Foundation, Inc. Written by Ken Raeburn . @@ -17,8 +18,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #define TC_ALPHA @@ -49,8 +50,8 @@ struct fix; struct alpha_reloc_tag; -extern int alpha_force_relocation PARAMS ((struct fix *)); -extern int alpha_fix_adjustable PARAMS ((struct fix *)); +extern int alpha_force_relocation (struct fix *); +extern int alpha_fix_adjustable (struct fix *); extern unsigned long alpha_gprmask, alpha_fprmask; extern valueT alpha_gp_value; @@ -59,7 +60,7 @@ extern valueT alpha_gp_value; #define tc_fix_adjustable(FIX) alpha_fix_adjustable (FIX) #define RELOC_REQUIRES_SYMBOL -/* Values passed to md_apply_fix3 don't include the symbol value. */ +/* Values passed to md_apply_fix don't include the symbol value. */ #define MD_APPLY_SYM_VALUE(FIX) 0 #define md_convert_frag(b,s,f) as_fatal ("alpha convert_frag\n") @@ -97,32 +98,32 @@ extern valueT alpha_gp_value; #define md_number_to_chars number_to_chars_littleendian -extern int tc_get_register PARAMS ((int frame)); -extern void alpha_frob_ecoff_data PARAMS ((void)); +extern int tc_get_register (int); +extern void alpha_frob_ecoff_data (void); #define tc_frob_label(sym) alpha_define_label (sym) -extern void alpha_define_label PARAMS ((symbolS *)); +extern void alpha_define_label (symbolS *); #define md_cons_align(nbytes) alpha_cons_align (nbytes) -extern void alpha_cons_align PARAMS ((int)); +extern void alpha_cons_align (int); #define HANDLE_ALIGN(fragp) alpha_handle_align (fragp) -extern void alpha_handle_align PARAMS ((struct frag *)); +extern void alpha_handle_align (struct frag *); #define MAX_MEM_FOR_RS_ALIGN_CODE (3 + 4 + 8) #ifdef OBJ_ECOFF #define tc_frob_file_before_adjust() alpha_frob_file_before_adjust () -extern void alpha_frob_file_before_adjust PARAMS ((void)); +extern void alpha_frob_file_before_adjust (void); #endif -#define DIFF_EXPR_OK /* foo-. gets turned into PC relative relocs */ +#define DIFF_EXPR_OK /* foo-. gets turned into PC relative relocs. */ #ifdef OBJ_ELF #define md_elf_section_letter alpha_elf_section_letter -extern int alpha_elf_section_letter PARAMS ((int, char **)); +extern int alpha_elf_section_letter (int, char **); #define md_elf_section_flags alpha_elf_section_flags -extern flagword alpha_elf_section_flags PARAMS ((flagword, int, int)); +extern flagword alpha_elf_section_flags (flagword, int, int); #endif /* Whether to add support for explicit !relocation_op!sequence_number. At the @@ -137,11 +138,11 @@ extern flagword alpha_elf_section_flags PARAMS ((flagword, int, int)); relocations. Also convert the gas-internal relocations to the appropriate linker relocations. */ #define tc_frob_file_before_fix() alpha_before_fix () -extern void alpha_before_fix PARAMS ((void)); +extern void alpha_before_fix (void); #ifdef OBJ_ELF #define md_end alpha_elf_md_end -extern void alpha_elf_md_end PARAMS ((void)); +extern void alpha_elf_md_end (void); #endif /* New fields for supporting explicit relocations (such as !literal to mark @@ -152,15 +153,15 @@ extern void alpha_elf_md_end PARAMS ((void)); struct alpha_fix_tag { - struct fix *next_reloc; /* next !lituse or !gpdisp */ - struct alpha_reloc_tag *info; /* other members with same sequence */ + struct fix *next_reloc; /* Next !lituse or !gpdisp. */ + struct alpha_reloc_tag *info; /* Other members with same sequence. */ }; /* Initialize the TC_FIX_TYPE field. */ #define TC_INIT_FIX_DATA(FIX) \ do { \ - FIX->tc_fix_data.next_reloc = (struct fix *) 0; \ - FIX->tc_fix_data.info = (struct alpha_reloc_tag *) 0; \ + FIX->tc_fix_data.next_reloc = NULL; \ + FIX->tc_fix_data.info = NULL; \ } while (0) /* Work with DEBUG5 to print fields in tc_fix_type. */ @@ -175,7 +176,7 @@ do { \ #define TARGET_USE_CFIPOP 1 #define tc_cfi_frame_initial_instructions alpha_cfi_frame_initial_instructions -extern void alpha_cfi_frame_initial_instructions(void); +extern void alpha_cfi_frame_initial_instructions (void); #define DWARF2_LINE_MIN_INSN_LENGTH 4 #define DWARF2_DEFAULT_RETURN_COLUMN 26 diff --git a/contrib/binutils/gas/config/tc-arc.c b/contrib/binutils/gas/config/tc-arc.c index 60cfa34652a..525b54083fb 100644 --- a/contrib/binutils/gas/config/tc-arc.c +++ b/contrib/binutils/gas/config/tc-arc.c @@ -1,6 +1,6 @@ /* tc-arc.c -- Assembler for the ARC - Copyright 1994, 1995, 1997, 1999, 2000, 2001, 2002 - Free Software Foundation, Inc. + Copyright 1994, 1995, 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2005, + 2006 Free Software Foundation, Inc. Contributed by Doug Evans (dje@cygnus.com). This file is part of GAS, the GNU Assembler. @@ -17,8 +17,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #include #include "libiberty.h" @@ -31,31 +31,12 @@ #include "elf/arc.h" #include "dwarf2dbg.h" -extern int arc_get_mach PARAMS ((char *)); -extern int arc_operand_type PARAMS ((int)); -extern int arc_insn_not_jl PARAMS ((arc_insn)); -extern int arc_limm_fixup_adjust PARAMS ((arc_insn)); -extern int arc_get_noshortcut_flag PARAMS ((void)); -extern int arc_set_ext_seg PARAMS ((void)); -extern void arc_code_symbol PARAMS ((expressionS *)); - -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_extinst PARAMS ((int)); -static void arc_extoper PARAMS ((int)); -static void arc_option PARAMS ((int)); -static int get_arc_exp_reloc_type PARAMS ((int, int, expressionS *, - expressionS *)); - -static void init_opcode_tables PARAMS ((int)); - -const struct suffix_classes { +const struct suffix_classes +{ char *name; int len; -} suffixclass[] = { +} suffixclass[] = +{ { "SUFFIX_COND|SUFFIX_FLAG",23 }, { "SUFFIX_FLAG", 11 }, { "SUFFIX_COND", 11 }, @@ -64,11 +45,13 @@ const struct suffix_classes { #define MAXSUFFIXCLASS (sizeof (suffixclass) / sizeof (struct suffix_classes)) -const struct syntax_classes { +const struct syntax_classes +{ char *name; int len; int class; -} syntaxclass[] = { +} syntaxclass[] = +{ { "SYNTAX_3OP|OP1_MUST_BE_IMM", 26, SYNTAX_3OP|OP1_MUST_BE_IMM|SYNTAX_VALID }, { "OP1_MUST_BE_IMM|SYNTAX_3OP", 26, OP1_MUST_BE_IMM|SYNTAX_3OP|SYNTAX_VALID }, { "SYNTAX_2OP|OP1_IMM_IMPLIED", 26, SYNTAX_2OP|OP1_IMM_IMPLIED|SYNTAX_VALID }, @@ -79,28 +62,6 @@ const struct syntax_classes { #define MAXSYNTAXCLASS (sizeof (syntaxclass) / sizeof (struct syntax_classes)) -const pseudo_typeS md_pseudo_table[] = { - { "align", s_align_bytes, 0 }, /* Defaulting is invalid (0). */ - { "comm", arc_common, 0 }, - { "common", arc_common, 0 }, - { "lcomm", arc_common, 1 }, - { "lcommon", arc_common, 1 }, - { "2byte", cons, 2 }, - { "half", cons, 2 }, - { "short", cons, 2 }, - { "3byte", cons, 3 }, - { "4byte", cons, 4 }, - { "word", cons, 4 }, - { "option", arc_option, 0 }, - { "cpu", arc_option, 0 }, - { "block", s_space, 0 }, - { "extcondcode", arc_extoper, 0 }, - { "extcoreregister", arc_extoper, 1 }, - { "extauxregister", arc_extoper, 2 }, - { "extinstruction", arc_extinst, 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[] = "#;"; @@ -144,21 +105,27 @@ 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) + +enum options +{ + OPTION_EB = OPTION_MD_BASE, + OPTION_EL, + OPTION_ARC5, + OPTION_ARC6, + OPTION_ARC7, + OPTION_ARC8, + OPTION_ARC +}; + +struct option md_longopts[] = +{ { "EB", no_argument, NULL, OPTION_EB }, -#define OPTION_EL (OPTION_MD_BASE + 1) { "EL", no_argument, NULL, OPTION_EL }, -#define OPTION_ARC5 (OPTION_MD_BASE + 2) { "marc5", no_argument, NULL, OPTION_ARC5 }, { "pre-v6", no_argument, NULL, OPTION_ARC5 }, -#define OPTION_ARC6 (OPTION_MD_BASE + 3) { "marc6", no_argument, NULL, OPTION_ARC6 }, -#define OPTION_ARC7 (OPTION_MD_BASE + 4) { "marc7", no_argument, NULL, OPTION_ARC7 }, -#define OPTION_ARC8 (OPTION_MD_BASE + 5) { "marc8", no_argument, NULL, OPTION_ARC8 }, -#define OPTION_ARC (OPTION_MD_BASE + 6) { "marc", no_argument, NULL, OPTION_ARC }, { NULL, no_argument, NULL, 0 } }; @@ -173,9 +140,7 @@ struct arc_operand_value *get_ext_suffix (char *s); See if it's a processor-specific option. */ int -md_parse_option (c, arg) - int c; - char *arg ATTRIBUTE_UNUSED; +md_parse_option (int c, char *arg ATTRIBUTE_UNUSED) { switch (c) { @@ -207,8 +172,7 @@ md_parse_option (c, arg) } void -md_show_usage (stream) - FILE *stream; +md_show_usage (FILE *stream) { fprintf (stream, "\ ARC Options:\n\ @@ -223,7 +187,7 @@ ARC Options:\n\ command. */ void -md_begin () +md_begin (void) { /* The endianness can be chosen "at the factory". */ target_big_endian = byte_order == BIG_ENDIAN; @@ -239,9 +203,9 @@ md_begin () /* Initialize the various opcode and operand tables. MACH is one of bfd_mach_arc_xxx. */ + static void -init_opcode_tables (mach) - int mach; +init_opcode_tables (int mach) { int i; char *last; @@ -262,7 +226,7 @@ init_opcode_tables (mach) for (i = 0; i < arc_suffixes_count; i++) { if (strcmp (arc_suffixes[i].name, last) != 0) - hash_insert (arc_suffix_hash, arc_suffixes[i].name, (PTR) (arc_suffixes + i)); + hash_insert (arc_suffix_hash, arc_suffixes[i].name, (void *) (arc_suffixes + i)); last = arc_suffixes[i].name; } @@ -282,7 +246,7 @@ init_opcode_tables (mach) output registers into the object file's symbol table. */ symbol_table_insert (symbol_create (arc_reg_names[i].name, reg_section, - (int) &arc_reg_names[i], + (valueT) &arc_reg_names[i], &zero_address_frag)); } @@ -294,14 +258,13 @@ init_opcode_tables (mach) 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; +arc_insert_operand (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) { @@ -328,17 +291,7 @@ arc_insert_operand (insn, operand, mods, reg, val, file, line) 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); - } + as_warn_value_out_of_range (_("operand"), test, (offsetT) min, (offsetT) max, file, line); } if (operand->insert) @@ -361,7 +314,8 @@ arc_insert_operand (insn, operand, mods, reg, val, file, line) we go, because that would require us to first create the frag, and that would screw up references to ``.''. */ -struct arc_fixup { +struct arc_fixup +{ /* index into `arc_operands' */ int opindex; expressionS exp; @@ -371,524 +325,81 @@ struct arc_fixup { #define MAX_SUFFIXES 5 -/* This routine is called for each instruction to be assembled. */ +/* Compute the reloc type of an expression. + The possibly modified expression is stored in EXPNEW. -void -md_assemble (str) - char *str; + 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 (int data_p, + int default_type, + expressionS *exp, + expressionS *expnew) { - const struct arc_opcode *opcode; - const struct arc_opcode *std_opcode; - struct arc_opcode *ext_opcode; - char *start; - const char *last_errmsg = 0; - arc_insn insn; - static int init_tables_p = 0; + /* If the expression is "symbol >> 2" we must change it to just "symbol", + as fix_new_exp can't handle it. Similarly 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. */ - /* Opcode table initialization is deferred until here because we have to - wait for a possible .option command. */ - if (!init_tables_p) + if (exp->X_op == O_right_shift + && exp->X_op_symbol != NULL + && exp->X_op_symbol->sy_value.X_op == O_constant + && exp->X_op_symbol->sy_value.X_add_number == 2 + && exp->X_add_number == 0) { - init_opcode_tables (arc_mach_type); - init_tables_p = 1; + if (exp->X_add_symbol != NULL + && (exp->X_add_symbol->sy_value.X_op == O_constant + || exp->X_add_symbol->sy_value.X_op == O_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 + && exp->X_add_symbol->sy_value.X_op == O_subtract) + { + *expnew = exp->X_add_symbol->sy_value; + return data_p ? BFD_RELOC_ARC_B26 : arc_operand_map['J']; + } } - /* 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. */ - - ext_opcode = arc_ext_opcodes; - std_opcode = arc_opcode_lookup_asm (str); - - /* Keep looking until we find a match. */ - - start = str; - for (opcode = (ext_opcode ? ext_opcode : std_opcode); - opcode != NULL; - opcode = (ARC_OPCODE_NEXT_ASM (opcode) - ? ARC_OPCODE_NEXT_ASM (opcode) - : (ext_opcode ? ext_opcode = NULL, std_opcode : NULL))) - { - int past_opcode_p, fc, num_suffixes; - int fix_up_at = 0; - 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; - int ext_suffix_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; - ext_suffix_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[(int) *syn]].flags)) - { - mods |= arc_operands[arc_operand_map[(int) *syn]].flags & ARC_MOD_BITS; - ++syn; - } - operand = arc_operands + arc_operand_map[(int) *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 (errmsg != (const char *) NULL) - { - last_errmsg = errmsg; - if (operand->flags & ARC_OPERAND_ERROR) - { - as_bad (errmsg); - return; - } - else if (operand->flags & ARC_OPERAND_WARN) - as_warn (errmsg); - break; - } - if (limm_reloc_p - && (operand->flags && operand->flags & ARC_OPERAND_LIMM) - && (operand->flags & - (ARC_OPERAND_ABSOLUTE_BRANCH | ARC_OPERAND_ADDRESS))) - { - fixups[fix_up_at].opindex = arc_operand_map[operand->fmt]; - } - } - ++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_end; - const struct arc_operand_value *suffix = NULL; - - 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 && ISALNUM (*t); ++t) - continue; - c = *t; - *t = '\0'; - if ((suf = get_ext_suffix (s))) - ext_suffix_p = 1; - else - suf = hash_find (arc_suffix_hash, s); - 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. */ - *t = c; - 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; - if (ext_suffix_p && arc_operands[suf->type].fmt == *syn) - { - /* Insert the suffix's value into the insn. */ - *t = c; - if (operand->insert) - insn = (*operand->insert) (insn, operand, - mods, NULL, suf->value, - NULL); - else - insn |= suf->value << operand->shift; - - str = t; - found = 1; - } - else - { - *t = c; - 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 *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 (is_end_of_line[(unsigned char) *str]) - break; - - /* 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 = (struct arc_operand_value *) exp.X_add_number; - } -#define IS_REG_DEST_OPERAND(o) ((o) == 'a') - else if (IS_REG_DEST_OPERAND (*syn)) - as_bad ("symbol as destination register"); - else - { - if (!strncmp (str, "@h30", 4)) - { - arc_code_symbol (&exp); - str += 4; - } - /* We need to generate a fixup for this expression. */ - if (fc >= MAX_FIXUPS) - as_fatal ("too many fixups"); - fixups[fc].exp = exp; - /* We don't support shimm relocs. break here to force - the assembler to output a limm. */ -#define IS_REG_SHIMM_OFFSET(o) ((o) == 'd') - if (IS_REG_SHIMM_OFFSET (*syn)) - break; - /* If this is a register constant (IE: one whose - register value gets stored as 61-63) then this - must be a limm. */ - /* ??? This bit could use some cleaning up. - Referencing the format chars like this goes - against style. */ - if (IS_SYMBOL_OPERAND (*syn)) - { - const char *junk; - limm_reloc_p = 1; - /* Save this, we don't yet know what reloc to use. */ - fix_up_at = fc; - /* 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[(int) *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 (errmsg != (const char *) NULL) - { - last_errmsg = errmsg; - if (operand->flags & ARC_OPERAND_ERROR) - { - as_bad (errmsg); - return; - } - else if (operand->flags & ARC_OPERAND_WARN) - as_warn (errmsg); - 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 (!is_end_of_line[(unsigned char) *str]) - 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; - - 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 && arc_insn_not_jl (insn)) /* except for jl addr */ - 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 && arc_mach_type == bfd_mach_arc_5) - as_warn ("conditional branch follows set of flags"); - prev_insn_needs_cc_nop_p = - /* FIXME: ??? not required: - (delay_slot_type != ARC_DELAY_NONE) && */ - 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); - dwarf2_emit_insn (8); - } - 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); - dwarf2_emit_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_fix3. - - 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) - { - /* Modify the fixup addend as required by the cpu. */ - fixups[i].exp.X_add_number += arc_limm_fixup_adjust (insn); - op_type = fixups[i].opindex; - /* FIXME: can we add this data to the operand table? */ - if (op_type == arc_operand_map['L'] - || op_type == arc_operand_map['s'] - || op_type == arc_operand_map['o'] - || op_type == arc_operand_map['O']) - 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. */ - } - - if (NULL == last_errmsg) - as_bad ("bad instruction `%s'", start); - else - as_bad (last_errmsg); + *expnew = *exp; + return default_type; } +static int +arc_set_ext_seg (void) +{ + if (!arcext_section) + { + arcext_section = subseg_new (".arcextmap", 0); + bfd_set_section_flags (stdoutput, arcext_section, + SEC_READONLY | SEC_HAS_CONTENTS); + } + else + subseg_set (arcext_section, 0); + return 1; +} + static void -arc_extoper (opertype) - int opertype; +arc_extoper (int opertype) { char *name; char *mode; @@ -1031,8 +542,7 @@ arc_extoper (opertype) return; } - ext_oper = (struct arc_ext_operand_value *) \ - xmalloc (sizeof (struct arc_ext_operand_value)); + ext_oper = xmalloc (sizeof (struct arc_ext_operand_value)); if (opertype) { @@ -1040,7 +550,7 @@ arc_extoper (opertype) if ((symbolP = symbol_find (name))) { if (S_GET_SEGMENT (symbolP) == reg_section) - S_SET_VALUE (symbolP, (int) &ext_oper->operand); + S_SET_VALUE (symbolP, (valueT) &ext_oper->operand); else { as_bad ("attempt to override symbol: %s", name); @@ -1054,7 +564,8 @@ arc_extoper (opertype) { /* If its not there, add it. */ symbol_table_insert (symbol_create (name, reg_section, - (int) &ext_oper->operand, &zero_address_frag)); + (valueT) &ext_oper->operand, + &zero_address_frag)); } } @@ -1128,10 +639,9 @@ arc_extoper (opertype) } static void -arc_extinst (ignore) - int ignore ATTRIBUTE_UNUSED; +arc_extinst (int ignore ATTRIBUTE_UNUSED) { - unsigned char syntax[129]; + char syntax[129]; char *name; char *p; char c; @@ -1294,7 +804,7 @@ arc_extinst (ignore) strcat (syntax, "%F"); strcat (syntax, "%S%L"); - ext_op = (struct arc_opcode *) xmalloc (sizeof (struct arc_opcode)); + ext_op = xmalloc (sizeof (struct arc_opcode)); ext_op->syntax = xstrdup (syntax); ext_op->mask = I (-1) | ((0x3 == opcode) ? C (-1) : 0); @@ -1332,23 +842,8 @@ arc_extinst (ignore) demand_empty_rest_of_line (); } -int -arc_set_ext_seg () -{ - if (!arcext_section) - { - arcext_section = subseg_new (".arcextmap", 0); - bfd_set_section_flags (stdoutput, arcext_section, - SEC_READONLY | SEC_HAS_CONTENTS); - } - else - subseg_set (arcext_section, 0); - return 1; -} - static void -arc_common (localScope) - int localScope; +arc_common (int localScope) { char *name; char c; @@ -1459,9 +954,9 @@ arc_common (localScope) /* Select the cpu we're assembling for. */ static void -arc_option (ignore) - int ignore ATTRIBUTE_UNUSED; +arc_option (int ignore ATTRIBUTE_UNUSED) { + extern int arc_get_mach (char *); int mach; char c; char *cpu; @@ -1515,10 +1010,7 @@ arc_option (ignore) #define MAX_LITTLENUMS 6 char * -md_atof (type, litP, sizeP) - int type; - char *litP; - int *sizeP; +md_atof (int type, char *litP, int *sizeP) { int prec; LITTLENUM_TYPE words[MAX_LITTLENUMS]; @@ -1559,10 +1051,7 @@ md_atof (type, litP, sizeP) endianness. */ void -md_number_to_chars (buf, val, n) - char *buf; - valueT val; - int n; +md_number_to_chars (char *buf, valueT val, int n) { if (target_big_endian) number_to_chars_bigendian (buf, val, n); @@ -1573,9 +1062,7 @@ md_number_to_chars (buf, val, n) /* Round up a section size to the appropriate boundary. */ valueT -md_section_align (segment, size) - segT segment; - valueT size; +md_section_align (segT segment, valueT size) { int align = bfd_get_section_alignment (stdoutput, segment); @@ -1585,9 +1072,8 @@ md_section_align (segment, size) /* We don't have any form of relaxing. */ int -md_estimate_size_before_relax (fragp, seg) - fragS *fragp ATTRIBUTE_UNUSED; - asection *seg ATTRIBUTE_UNUSED; +md_estimate_size_before_relax (fragS *fragp ATTRIBUTE_UNUSED, + asection *seg ATTRIBUTE_UNUSED) { as_fatal (_("md_estimate_size_before_relax\n")); return 1; @@ -1596,21 +1082,20 @@ md_estimate_size_before_relax (fragp, seg) /* Convert a machine dependent frag. We never generate these. */ void -md_convert_frag (abfd, sec, fragp) - bfd *abfd ATTRIBUTE_UNUSED; - asection *sec ATTRIBUTE_UNUSED; - fragS *fragp ATTRIBUTE_UNUSED; +md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, + asection *sec ATTRIBUTE_UNUSED, + fragS *fragp ATTRIBUTE_UNUSED) { as_fatal (_("md_convert_frag\n")); } -void -arc_code_symbol (expressionP) - expressionS *expressionP; +static void +arc_code_symbol (expressionS *expressionP) { if (expressionP->X_op == O_symbol && expressionP->X_add_number == 0) { expressionS two; + expressionP->X_op = O_right_shift; expressionP->X_add_symbol->sy_value.X_op = O_constant; two.X_op = O_constant; @@ -1625,6 +1110,7 @@ arc_code_symbol (expressionP) && 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; @@ -1633,10 +1119,7 @@ arc_code_symbol (expressionP) expressionP->X_op_symbol = make_expr_symbol (&two); } else - { - as_bad ("expression too complex code symbol"); - return; - } + as_bad ("expression too complex code symbol"); } /* Parse an operand that is machine-specific. @@ -1650,55 +1133,56 @@ arc_code_symbol (expressionP) to achieve the same effect. */ void -md_operand (expressionP) - expressionS *expressionP; +md_operand (expressionS *expressionP) { char *p = input_line_pointer; - if (*p == '%') - if (strncmp (p, "%st(", 4) == 0) - { - input_line_pointer += 4; - expression (expressionP); - if (*input_line_pointer != ')') - { - as_bad ("missing ')' in %%-op"); - return; - } - ++input_line_pointer; - arc_code_symbol (expressionP); - } - else - { - /* It could be a register. */ - int i, l; - struct arc_ext_operand_value *ext_oper = arc_ext_operands; - p++; + if (*p != '%') + return; - while (ext_oper) - { - l = strlen (ext_oper->operand.name); - if (!strncmp (p, ext_oper->operand.name, l) && !ISALNUM (*(p + l))) - { - input_line_pointer += l + 1; - expressionP->X_op = O_register; - expressionP->X_add_number = (int) &ext_oper->operand; - return; - } - ext_oper = ext_oper->next; - } - for (i = 0; i < arc_reg_names_count; i++) - { - l = strlen (arc_reg_names[i].name); - if (!strncmp (p, arc_reg_names[i].name, l) && !ISALNUM (*(p + l))) - { - input_line_pointer += l + 1; - expressionP->X_op = O_register; - expressionP->X_add_number = (int) &arc_reg_names[i]; - break; - } - } - } + if (strncmp (p, "%st(", 4) == 0) + { + input_line_pointer += 4; + expression (expressionP); + if (*input_line_pointer != ')') + { + as_bad ("missing ')' in %%-op"); + return; + } + ++input_line_pointer; + arc_code_symbol (expressionP); + } + else + { + /* It could be a register. */ + int i, l; + struct arc_ext_operand_value *ext_oper = arc_ext_operands; + p++; + + while (ext_oper) + { + l = strlen (ext_oper->operand.name); + if (!strncmp (p, ext_oper->operand.name, l) && !ISALNUM (*(p + l))) + { + input_line_pointer += l + 1; + expressionP->X_op = O_register; + expressionP->X_add_number = (offsetT) &ext_oper->operand; + return; + } + ext_oper = ext_oper->next; + } + for (i = 0; i < arc_reg_names_count; i++) + { + l = strlen (arc_reg_names[i].name); + if (!strncmp (p, arc_reg_names[i].name, l) && !ISALNUM (*(p + l))) + { + input_line_pointer += l + 1; + expressionP->X_op = O_register; + expressionP->X_add_number = (offsetT) &arc_reg_names[i]; + break; + } + } + } } /* We have no need to default values of symbols. @@ -1706,8 +1190,7 @@ md_operand (expressionP) them all in the symbol table to begin with. */ symbolS * -md_undefined_symbol (name) - char *name ATTRIBUTE_UNUSED; +md_undefined_symbol (char *name ATTRIBUTE_UNUSED) { return 0; } @@ -1720,9 +1203,8 @@ md_undefined_symbol (name) `label' will be right shifted by 2. */ void -arc_parse_cons_expression (exp, nbytes) - expressionS *exp; - unsigned int nbytes ATTRIBUTE_UNUSED; +arc_parse_cons_expression (expressionS *exp, + unsigned int nbytes ATTRIBUTE_UNUSED) { char *p = input_line_pointer; int code_symbol_fix = 0; @@ -1733,7 +1215,7 @@ arc_parse_cons_expression (exp, nbytes) code_symbol_fix = 1; strcpy (p, "; "); } - expr (0, exp); + expression_and_evaluate (exp); if (code_symbol_fix) { arc_code_symbol (exp); @@ -1744,11 +1226,10 @@ arc_parse_cons_expression (exp, nbytes) /* Record a fixup for a cons expression. */ void -arc_cons_fix_new (frag, where, nbytes, exp) - fragS *frag; - int where; - int nbytes; - expressionS *exp; +arc_cons_fix_new (fragS *frag, + int where, + int nbytes, + expressionS *exp) { if (nbytes == 4) { @@ -1774,73 +1255,12 @@ arc_cons_fix_new (frag, where, nbytes, exp) given a PC relative reloc. */ long -md_pcrel_from (fixP) - fixS *fixP; +md_pcrel_from (fixS *fixP) { /* 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. Similarly 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 - && exp->X_op_symbol->sy_value.X_op == O_constant - && exp->X_op_symbol->sy_value.X_add_number == 2 - && exp->X_add_number == 0) - { - if (exp->X_add_symbol != NULL - && (exp->X_add_symbol->sy_value.X_op == O_constant - || exp->X_add_symbol->sy_value.X_op == O_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 - && exp->X_add_symbol->sy_value.X_op == O_subtract) - { - *expnew = exp->X_add_symbol->sy_value; - 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 @@ -1850,14 +1270,8 @@ get_arc_exp_reloc_type (data_p, default_type, exp, expnew) that, we determine the correct reloc code and put it back in the fixup. */ void -md_apply_fix3 (fixP, valP, seg) - fixS *fixP; - valueT * valP; - segT seg; +md_apply_fix (fixS *fixP, valueT * valP, segT seg) { -#if 0 - char *buf = fixP->fx_where + fixP->fx_frag->fr_literal; -#endif valueT value = * valP; if (fixP->fx_addsy == (symbolS *) NULL) @@ -1900,10 +1314,8 @@ md_apply_fix3 (fixP, valP, seg) bfd_putl32 ((bfd_vma) insn, (unsigned char *) where); if (fixP->fx_done) - { - /* Nothing else to do here. */ - return; - } + /* Nothing else to do here. */ + return; /* Determine a BFD reloc value based on the operand information. We are only prepared to turn a few of the operands into relocs. @@ -1956,12 +1368,6 @@ md_apply_fix3 (fixP, valP, seg) 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 @@ -1981,15 +1387,15 @@ md_apply_fix3 (fixP, valP, seg) format. */ arelent * -tc_gen_reloc (section, fixP) - asection *section ATTRIBUTE_UNUSED; - fixS *fixP; +tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, + fixS *fixP) { arelent *reloc; - reloc = (arelent *) xmalloc (sizeof (arelent)); + reloc = xmalloc (sizeof (arelent)); + reloc->sym_ptr_ptr = xmalloc (sizeof (asymbol *)); - reloc->sym_ptr_ptr = &fixP->fx_addsy->bsym; + *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) @@ -2010,3 +1416,520 @@ tc_gen_reloc (section, fixP) return reloc; } + +const pseudo_typeS md_pseudo_table[] = +{ + { "align", s_align_bytes, 0 }, /* Defaulting is invalid (0). */ + { "comm", arc_common, 0 }, + { "common", arc_common, 0 }, + { "lcomm", arc_common, 1 }, + { "lcommon", arc_common, 1 }, + { "2byte", cons, 2 }, + { "half", cons, 2 }, + { "short", cons, 2 }, + { "3byte", cons, 3 }, + { "4byte", cons, 4 }, + { "word", cons, 4 }, + { "option", arc_option, 0 }, + { "cpu", arc_option, 0 }, + { "block", s_space, 0 }, + { "extcondcode", arc_extoper, 0 }, + { "extcoreregister", arc_extoper, 1 }, + { "extauxregister", arc_extoper, 2 }, + { "extinstruction", arc_extinst, 0 }, + { NULL, 0, 0 }, +}; + +/* This routine is called for each instruction to be assembled. */ + +void +md_assemble (char *str) +{ + const struct arc_opcode *opcode; + const struct arc_opcode *std_opcode; + struct arc_opcode *ext_opcode; + char *start; + const char *last_errmsg = 0; + arc_insn insn; + static int init_tables_p = 0; + + /* Opcode table initialization is deferred until here because we have to + wait for a possible .option 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. */ + + ext_opcode = arc_ext_opcodes; + std_opcode = arc_opcode_lookup_asm (str); + + /* Keep looking until we find a match. */ + start = str; + for (opcode = (ext_opcode ? ext_opcode : std_opcode); + opcode != NULL; + opcode = (ARC_OPCODE_NEXT_ASM (opcode) + ? ARC_OPCODE_NEXT_ASM (opcode) + : (ext_opcode ? ext_opcode = NULL, std_opcode : NULL))) + { + int past_opcode_p, fc, num_suffixes; + int fix_up_at = 0; + 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; + int ext_suffix_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; + ext_suffix_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 == '%') + { + 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[(int) *syn]].flags)) + { + mods |= arc_operands[arc_operand_map[(int) *syn]].flags & ARC_MOD_BITS; + ++syn; + } + operand = arc_operands + arc_operand_map[(int) *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 (errmsg != (const char *) NULL) + { + last_errmsg = errmsg; + if (operand->flags & ARC_OPERAND_ERROR) + { + as_bad (errmsg); + return; + } + else if (operand->flags & ARC_OPERAND_WARN) + as_warn (errmsg); + break; + } + if (limm_reloc_p + && (operand->flags && operand->flags & ARC_OPERAND_LIMM) + && (operand->flags & + (ARC_OPERAND_ABSOLUTE_BRANCH | ARC_OPERAND_ADDRESS))) + { + fixups[fix_up_at].opindex = arc_operand_map[operand->fmt]; + } + } + ++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_end; + const struct arc_operand_value *suffix = NULL; + + 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 && ISALNUM (*t); ++t) + continue; + c = *t; + *t = '\0'; + if ((suf = get_ext_suffix (s))) + ext_suffix_p = 1; + else + suf = hash_find (arc_suffix_hash, s); + 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. */ + *t = c; + 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; + if (ext_suffix_p && arc_operands[suf->type].fmt == *syn) + { + /* Insert the suffix's value into the insn. */ + *t = c; + if (operand->insert) + insn = (*operand->insert) (insn, operand, + mods, NULL, suf->value, + NULL); + else + insn |= suf->value << operand->shift; + suffix = suf; + str = t; + found = 1; + } + else + { + *t = c; + 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 *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 (is_end_of_line[(unsigned char) *str]) + break; + + /* 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 = (struct arc_operand_value *) exp.X_add_number; +#define IS_REG_DEST_OPERAND(o) ((o) == 'a') + else if (IS_REG_DEST_OPERAND (*syn)) + as_bad ("symbol as destination register"); + else + { + if (!strncmp (str, "@h30", 4)) + { + arc_code_symbol (&exp); + str += 4; + } + /* We need to generate a fixup for this expression. */ + if (fc >= MAX_FIXUPS) + as_fatal ("too many fixups"); + fixups[fc].exp = exp; + /* We don't support shimm relocs. break here to force + the assembler to output a limm. */ +#define IS_REG_SHIMM_OFFSET(o) ((o) == 'd') + if (IS_REG_SHIMM_OFFSET (*syn)) + break; + /* If this is a register constant (IE: one whose + register value gets stored as 61-63) then this + must be a limm. */ + /* ??? This bit could use some cleaning up. + Referencing the format chars like this goes + against style. */ + if (IS_SYMBOL_OPERAND (*syn)) + { + const char *junk; + limm_reloc_p = 1; + /* Save this, we don't yet know what reloc to use. */ + fix_up_at = fc; + /* 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[(int) *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 (errmsg != (const char *) NULL) + { + last_errmsg = errmsg; + if (operand->flags & ARC_OPERAND_ERROR) + { + as_bad (errmsg); + return; + } + else if (operand->flags & ARC_OPERAND_WARN) + as_warn (errmsg); + 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 (!is_end_of_line[(unsigned char) *str]) + 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; + + 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 && arc_insn_not_jl (insn)) /* except for jl addr */ + 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 && arc_mach_type == bfd_mach_arc_5) + as_warn ("conditional branch follows set of flags"); + prev_insn_needs_cc_nop_p = + /* FIXME: ??? not required: + (delay_slot_type != ARC_DELAY_NONE) && */ + 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); + dwarf2_emit_insn (8); + } + 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); + dwarf2_emit_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) + { + /* Modify the fixup addend as required by the cpu. */ + fixups[i].exp.X_add_number += arc_limm_fixup_adjust (insn); + op_type = fixups[i].opindex; + /* FIXME: can we add this data to the operand table? */ + if (op_type == arc_operand_map['L'] + || op_type == arc_operand_map['s'] + || op_type == arc_operand_map['o'] + || op_type == arc_operand_map['O']) + 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); + } + return; + } + } + + if (NULL == last_errmsg) + as_bad ("bad instruction `%s'", start); + else + as_bad (last_errmsg); +} diff --git a/contrib/binutils/gas/config/tc-arc.h b/contrib/binutils/gas/config/tc-arc.h index 884d375546a..4c3d9c2cdd0 100644 --- a/contrib/binutils/gas/config/tc-arc.h +++ b/contrib/binutils/gas/config/tc-arc.h @@ -1,5 +1,5 @@ /* tc-arc.h - Macros and type defines for the ARC. - Copyright 1994, 1995, 1997, 2000, 2001, 2002 + Copyright 1994, 1995, 1997, 2000, 2001, 2002, 2005 Free Software Foundation, Inc. Contributed by Doug Evans (dje@cygnus.com). @@ -17,8 +17,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #define TC_ARC 1 @@ -45,28 +45,27 @@ /* 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 +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 LISTING_HEADER "ARC GAS " /* The ARC needs to parse reloc specifiers in .word. */ -extern void arc_parse_cons_expression PARAMS ((struct expressionS *, unsigned)); +extern void arc_parse_cons_expression (struct expressionS *, unsigned); #define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) \ -arc_parse_cons_expression (EXP, NBYTES) + arc_parse_cons_expression (EXP, NBYTES) -extern void arc_cons_fix_new PARAMS ((struct frag *, int, int, struct expressionS *)); +extern void arc_cons_fix_new (struct frag *, int, int, struct expressionS *); #define TC_CONS_FIX_NEW(FRAG, WHERE, NBYTES, EXP) \ -arc_cons_fix_new (FRAG, WHERE, NBYTES, EXP) + arc_cons_fix_new (FRAG, WHERE, NBYTES, EXP) #define DWARF2_LINE_MIN_INSN_LENGTH 4 -/* Values passed to md_apply_fix3 don't include the symbol value. */ +/* Values passed to md_apply_fix don't include the symbol value. */ #define MD_APPLY_SYM_VALUE(FIX) 0 /* No shared lib support, so we don't need to ensure externally diff --git a/contrib/binutils/gas/config/tc-arm.c b/contrib/binutils/gas/config/tc-arm.c index 2ed5196f742..ae420b35347 100644 --- a/contrib/binutils/gas/config/tc-arm.c +++ b/contrib/binutils/gas/config/tc-arm.c @@ -1,5 +1,6 @@ /* tc-arm.c -- Assemble for the ARM - Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 + Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, + 2004, 2005 Free Software Foundation, Inc. Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org) Modified by David Taylor (dtaylor@armltd.co.uk) @@ -16,16 +17,16 @@ 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 + MERCHANTABILITY or FITNESS FOR A PARTICULAR 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #include -#define NO_RELOC 0 +#define NO_RELOC 0 #include "as.h" #include "safe-ctype.h" @@ -36,86 +37,58 @@ #include "symbols.h" #include "listing.h" +#include "opcode/arm.h" + #ifdef OBJ_ELF #include "elf/arm.h" #include "dwarf2dbg.h" +#include "dw2gencfi.h" #endif -/* XXX Set this to 1 after the next binutils release */ +/* XXX Set this to 1 after the next binutils release. */ #define WARN_DEPRECATED 0 -/* The following bitmasks control CPU extensions: */ -#define ARM_EXT_V1 0x00000001 /* All processors (core set). */ -#define ARM_EXT_V2 0x00000002 /* Multiply instructions. */ -#define ARM_EXT_V2S 0x00000004 /* SWP instructions. */ -#define ARM_EXT_V3 0x00000008 /* MSR MRS. */ -#define ARM_EXT_V3M 0x00000010 /* Allow long multiplies. */ -#define ARM_EXT_V4 0x00000020 /* Allow half word loads. */ -#define ARM_EXT_V4T 0x00000040 /* Thumb v1. */ -#define ARM_EXT_V5 0x00000080 /* Allow CLZ, etc. */ -#define ARM_EXT_V5T 0x00000100 /* Thumb v2. */ -#define ARM_EXT_V5ExP 0x00000200 /* DSP core set. */ -#define ARM_EXT_V5E 0x00000400 /* DSP Double transfers. */ -#define ARM_EXT_V5J 0x00000800 /* Jazelle extension. */ -#define ARM_EXT_V6 0x00001000 /* ARM V6. */ +#ifdef OBJ_ELF +/* Must be at least the size of the largest unwind opcode (currently two). */ +#define ARM_OPCODE_CHUNK_SIZE 8 -/* Co-processor space extensions. */ -#define ARM_CEXT_XSCALE 0x00800000 /* Allow MIA etc. */ -#define ARM_CEXT_MAVERICK 0x00400000 /* Use Cirrus/DSP coprocessor. */ -#define ARM_CEXT_IWMMXT 0x00200000 /* Intel Wireless MMX technology coprocessor. */ +/* This structure holds the unwinding state. */ -/* Architectures are the sum of the base and extensions. The ARM ARM (rev E) - defines the following: ARMv3, ARMv3M, ARMv4xM, ARMv4, ARMv4TxM, ARMv4T, - ARMv5xM, ARMv5, ARMv5TxM, ARMv5T, ARMv5TExP, ARMv5TE. To these we add - three more to cover cores prior to ARM6. Finally, there are cores which - implement further extensions in the co-processor space. */ -#define ARM_ARCH_V1 ARM_EXT_V1 -#define ARM_ARCH_V2 (ARM_ARCH_V1 | ARM_EXT_V2) -#define ARM_ARCH_V2S (ARM_ARCH_V2 | ARM_EXT_V2S) -#define ARM_ARCH_V3 (ARM_ARCH_V2S | ARM_EXT_V3) -#define ARM_ARCH_V3M (ARM_ARCH_V3 | ARM_EXT_V3M) -#define ARM_ARCH_V4xM (ARM_ARCH_V3 | ARM_EXT_V4) -#define ARM_ARCH_V4 (ARM_ARCH_V3M | ARM_EXT_V4) -#define ARM_ARCH_V4TxM (ARM_ARCH_V4xM | ARM_EXT_V4T) -#define ARM_ARCH_V4T (ARM_ARCH_V4 | ARM_EXT_V4T) -#define ARM_ARCH_V5xM (ARM_ARCH_V4xM | ARM_EXT_V5) -#define ARM_ARCH_V5 (ARM_ARCH_V4 | ARM_EXT_V5) -#define ARM_ARCH_V5TxM (ARM_ARCH_V5xM | ARM_EXT_V4T | ARM_EXT_V5T) -#define ARM_ARCH_V5T (ARM_ARCH_V5 | ARM_EXT_V4T | ARM_EXT_V5T) -#define ARM_ARCH_V5TExP (ARM_ARCH_V5T | ARM_EXT_V5ExP) -#define ARM_ARCH_V5TE (ARM_ARCH_V5TExP | ARM_EXT_V5E) -#define ARM_ARCH_V5TEJ (ARM_ARCH_V5TE | ARM_EXT_V5J) -#define ARM_ARCH_V6 (ARM_ARCH_V5TEJ | ARM_EXT_V6) +static struct +{ + symbolS * proc_start; + symbolS * table_entry; + symbolS * personality_routine; + int personality_index; + /* The segment containing the function. */ + segT saved_seg; + subsegT saved_subseg; + /* Opcodes generated from this function. */ + unsigned char * opcodes; + int opcode_count; + int opcode_alloc; + /* The number of bytes pushed to the stack. */ + offsetT frame_size; + /* We don't add stack adjustment opcodes immediately so that we can merge + multiple adjustments. We can also omit the final adjustment + when using a frame pointer. */ + offsetT pending_offset; + /* These two fields are set by both unwind_movsp and unwind_setfp. They + hold the reg+offset to use when restoring sp from a frame pointer. */ + offsetT fp_offset; + int fp_reg; + /* Nonzero if an unwind_setfp directive has been seen. */ + unsigned fp_used:1; + /* Nonzero if the last opcode restores sp from fp_reg. */ + unsigned sp_restored:1; +} unwind; -/* Processors with specific extensions in the co-processor space. */ -#define ARM_ARCH_XSCALE (ARM_ARCH_V5TE | ARM_CEXT_XSCALE) -#define ARM_ARCH_IWMMXT (ARM_ARCH_XSCALE | ARM_CEXT_IWMMXT) +/* Bit N indicates that an R_ARM_NONE relocation has been output for + __aeabi_unwind_cpp_prN already if set. This enables dependencies to be + emitted only once per section, to save unnecessary bloat. */ +static unsigned int marked_pr_dependency = 0; -/* Some useful combinations: */ -#define ARM_ANY 0x0000ffff /* Any basic core. */ -#define ARM_ALL 0x00ffffff /* Any core + co-processor */ -#define CPROC_ANY 0x00ff0000 /* Any co-processor */ -#define FPU_ANY 0xff000000 /* Note this is ~ARM_ALL. */ - - -#define FPU_FPA_EXT_V1 0x80000000 /* Base FPA instruction set. */ -#define FPU_FPA_EXT_V2 0x40000000 /* LFM/SFM. */ -#define FPU_VFP_EXT_NONE 0x20000000 /* Use VFP word-ordering. */ -#define FPU_VFP_EXT_V1xD 0x10000000 /* Base VFP instruction set. */ -#define FPU_VFP_EXT_V1 0x08000000 /* Double-precision insns. */ -#define FPU_VFP_EXT_V2 0x04000000 /* ARM10E VFPr1. */ -#define FPU_MAVERICK 0x02000000 /* Cirrus Maverick. */ -#define FPU_NONE 0 - -#define FPU_ARCH_FPE FPU_FPA_EXT_V1 -#define FPU_ARCH_FPA (FPU_ARCH_FPE | FPU_FPA_EXT_V2) - -#define FPU_ARCH_VFP FPU_VFP_EXT_NONE -#define FPU_ARCH_VFP_V1xD (FPU_VFP_EXT_V1xD | FPU_VFP_EXT_NONE) -#define FPU_ARCH_VFP_V1 (FPU_ARCH_VFP_V1xD | FPU_VFP_EXT_V1) -#define FPU_ARCH_VFP_V2 (FPU_ARCH_VFP_V1 | FPU_VFP_EXT_V2) - -#define FPU_ARCH_MAVERICK FPU_MAVERICK +#endif /* OBJ_ELF */ enum arm_float_abi { @@ -124,110 +97,133 @@ enum arm_float_abi ARM_FLOAT_ABI_SOFT }; -/* Types of processor to assemble for. */ -#define ARM_1 ARM_ARCH_V1 -#define ARM_2 ARM_ARCH_V2 -#define ARM_3 ARM_ARCH_V2S -#define ARM_250 ARM_ARCH_V2S -#define ARM_6 ARM_ARCH_V3 -#define ARM_7 ARM_ARCH_V3 -#define ARM_8 ARM_ARCH_V4 -#define ARM_9 ARM_ARCH_V4T -#define ARM_STRONG ARM_ARCH_V4 -#define ARM_CPU_MASK 0x0000000f /* XXX? */ - +/* Types of processor to assemble for. */ #ifndef CPU_DEFAULT #if defined __XSCALE__ -#define CPU_DEFAULT (ARM_ARCH_XSCALE) +#define CPU_DEFAULT ARM_ARCH_XSCALE #else #if defined __thumb__ -#define CPU_DEFAULT (ARM_ARCH_V5T) -#else -#define CPU_DEFAULT ARM_ANY +#define CPU_DEFAULT ARM_ARCH_V5T #endif #endif #endif -#ifdef TE_LINUX -#define FPU_DEFAULT FPU_ARCH_FPA -#endif - -#ifdef TE_NetBSD -#ifdef OBJ_ELF -#define FPU_DEFAULT FPU_ARCH_VFP /* Soft-float, but VFP order. */ -#else -/* Legacy a.out format. */ -#define FPU_DEFAULT FPU_ARCH_FPA /* Soft-float, but FPA order. */ -#endif -#endif - -/* For backwards compatibility we default to the FPA. */ #ifndef FPU_DEFAULT -#define FPU_DEFAULT FPU_ARCH_FPA -#endif +# ifdef TE_LINUX +# define FPU_DEFAULT FPU_ARCH_FPA +# elif defined (TE_NetBSD) +# ifdef OBJ_ELF +# define FPU_DEFAULT FPU_ARCH_VFP /* Soft-float, but VFP order. */ +# else + /* Legacy a.out format. */ +# define FPU_DEFAULT FPU_ARCH_FPA /* Soft-float, but FPA order. */ +# endif +# elif defined (TE_VXWORKS) +# define FPU_DEFAULT FPU_ARCH_VFP /* Soft-float, VFP order. */ +# else + /* For backwards compatibility, default to FPA. */ +# define FPU_DEFAULT FPU_ARCH_FPA +# endif +#endif /* ifndef FPU_DEFAULT */ -#define streq(a, b) (strcmp (a, b) == 0) -#define skip_whitespace(str) while (*(str) == ' ') ++(str) +#define streq(a, b) (strcmp (a, b) == 0) -static unsigned long cpu_variant; -static int target_oabi = 0; +static arm_feature_set cpu_variant; +static arm_feature_set arm_arch_used; +static arm_feature_set thumb_arch_used; /* Flags stored in private area of BFD structure. */ -static int uses_apcs_26 = FALSE; -static int atpcs = FALSE; +static int uses_apcs_26 = FALSE; +static int atpcs = FALSE; static int support_interwork = FALSE; static int uses_apcs_float = FALSE; -static int pic_code = FALSE; +static int pic_code = FALSE; /* Variables that we set while parsing command-line options. Once all options have been read we re-process these values to set the real assembly flags. */ -static int legacy_cpu = -1; -static int legacy_fpu = -1; +static const arm_feature_set *legacy_cpu = NULL; +static const arm_feature_set *legacy_fpu = NULL; -static int mcpu_cpu_opt = -1; -static int mcpu_fpu_opt = -1; -static int march_cpu_opt = -1; -static int march_fpu_opt = -1; -static int mfpu_opt = -1; -static int mfloat_abi_opt = -1; +static const arm_feature_set *mcpu_cpu_opt = NULL; +static const arm_feature_set *mcpu_fpu_opt = NULL; +static const arm_feature_set *march_cpu_opt = NULL; +static const arm_feature_set *march_fpu_opt = NULL; +static const arm_feature_set *mfpu_opt = NULL; -/* 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[] = "@"; +/* Constants for known architecture features. */ +static const arm_feature_set fpu_default = FPU_DEFAULT; +static const arm_feature_set fpu_arch_vfp_v1 = FPU_ARCH_VFP_V1; +static const arm_feature_set fpu_arch_vfp_v2 = FPU_ARCH_VFP_V2; +static const arm_feature_set fpu_arch_fpa = FPU_ARCH_FPA; +static const arm_feature_set fpu_any_hard = FPU_ANY_HARD; +static const arm_feature_set fpu_arch_maverick = FPU_ARCH_MAVERICK; +static const arm_feature_set fpu_endian_pure = FPU_ARCH_ENDIAN_PURE; -/* 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 like this one will always work. */ -const char line_comment_chars[] = "#"; - -const char line_separator_chars[] = ";"; - -/* Chars that can be used to separate mant - from exp in floating point numbers. */ -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[] = "rRsSfFdDxXeEpP"; - -/* Prefix characters that indicate the start of an immediate - value. */ -#define is_immediate_prefix(C) ((C) == '#' || (C) == '$') - -#ifdef OBJ_ELF -/* Pre-defined "_GLOBAL_OFFSET_TABLE_" */ -symbolS * GOT_symbol; +#ifdef CPU_DEFAULT +static const arm_feature_set cpu_default = CPU_DEFAULT; #endif -/* Size of relocation record. */ -const int md_reloc_size = 8; +static const arm_feature_set arm_ext_v1 = ARM_FEATURE (ARM_EXT_V1, 0); +static const arm_feature_set arm_ext_v2 = ARM_FEATURE (ARM_EXT_V1, 0); +static const arm_feature_set arm_ext_v2s = ARM_FEATURE (ARM_EXT_V2S, 0); +static const arm_feature_set arm_ext_v3 = ARM_FEATURE (ARM_EXT_V3, 0); +static const arm_feature_set arm_ext_v3m = ARM_FEATURE (ARM_EXT_V3M, 0); +static const arm_feature_set arm_ext_v4 = ARM_FEATURE (ARM_EXT_V4, 0); +static const arm_feature_set arm_ext_v4t = ARM_FEATURE (ARM_EXT_V4T, 0); +static const arm_feature_set arm_ext_v5 = ARM_FEATURE (ARM_EXT_V5, 0); +static const arm_feature_set arm_ext_v4t_5 = + ARM_FEATURE (ARM_EXT_V4T | ARM_EXT_V5, 0); +static const arm_feature_set arm_ext_v5t = ARM_FEATURE (ARM_EXT_V5T, 0); +static const arm_feature_set arm_ext_v5e = ARM_FEATURE (ARM_EXT_V5E, 0); +static const arm_feature_set arm_ext_v5exp = ARM_FEATURE (ARM_EXT_V5ExP, 0); +static const arm_feature_set arm_ext_v5j = ARM_FEATURE (ARM_EXT_V5J, 0); +static const arm_feature_set arm_ext_v6 = ARM_FEATURE (ARM_EXT_V6, 0); +static const arm_feature_set arm_ext_v6k = ARM_FEATURE (ARM_EXT_V6K, 0); +static const arm_feature_set arm_ext_v6z = ARM_FEATURE (ARM_EXT_V6Z, 0); +static const arm_feature_set arm_ext_v6t2 = ARM_FEATURE (ARM_EXT_V6T2, 0); +static const arm_feature_set arm_ext_v6_notm = ARM_FEATURE (ARM_EXT_V6_NOTM, 0); +static const arm_feature_set arm_ext_div = ARM_FEATURE (ARM_EXT_DIV, 0); +static const arm_feature_set arm_ext_v7 = ARM_FEATURE (ARM_EXT_V7, 0); +static const arm_feature_set arm_ext_v7a = ARM_FEATURE (ARM_EXT_V7A, 0); +static const arm_feature_set arm_ext_v7r = ARM_FEATURE (ARM_EXT_V7R, 0); +static const arm_feature_set arm_ext_v7m = ARM_FEATURE (ARM_EXT_V7M, 0); + +static const arm_feature_set arm_arch_any = ARM_ANY; +static const arm_feature_set arm_arch_full = ARM_FEATURE (-1, -1); +static const arm_feature_set arm_arch_t2 = ARM_ARCH_THUMB2; +static const arm_feature_set arm_arch_none = ARM_ARCH_NONE; + +static const arm_feature_set arm_cext_iwmmxt = + ARM_FEATURE (0, ARM_CEXT_IWMMXT); +static const arm_feature_set arm_cext_xscale = + ARM_FEATURE (0, ARM_CEXT_XSCALE); +static const arm_feature_set arm_cext_maverick = + ARM_FEATURE (0, ARM_CEXT_MAVERICK); +static const arm_feature_set fpu_fpa_ext_v1 = ARM_FEATURE (0, FPU_FPA_EXT_V1); +static const arm_feature_set fpu_fpa_ext_v2 = ARM_FEATURE (0, FPU_FPA_EXT_V2); +static const arm_feature_set fpu_vfp_ext_v1xd = + ARM_FEATURE (0, FPU_VFP_EXT_V1xD); +static const arm_feature_set fpu_vfp_ext_v1 = ARM_FEATURE (0, FPU_VFP_EXT_V1); +static const arm_feature_set fpu_vfp_ext_v2 = ARM_FEATURE (0, FPU_VFP_EXT_V2); + +static int mfloat_abi_opt = -1; +/* Record user cpu selection for object attributes. */ +static arm_feature_set selected_cpu = ARM_ARCH_NONE; +/* Must be long enough to hold any of the names in arm_cpus. */ +static char selected_cpu_name[16]; +#ifdef OBJ_ELF +# ifdef EABI_DEFAULT +static int meabi_flags = EABI_DEFAULT; +# else +static int meabi_flags = EF_ARM_EABI_UNKNOWN; +# endif +#endif + +#ifdef OBJ_ELF +/* Pre-defined "_GLOBAL_OFFSET_TABLE_" */ +symbolS * GOT_symbol; +#endif /* 0: assemble for ARM, 1: assemble for Thumb, @@ -235,84 +231,66 @@ const int md_reloc_size = 8; instructions. */ static int thumb_mode = 0; -typedef struct arm_fix -{ - int thumb_mode; -} arm_fix_data; +/* If unified_syntax is true, we are processing the new unified + ARM/Thumb syntax. Important differences from the old ARM mode: + + - Immediate operands do not require a # prefix. + - Conditional affixes always appear at the end of the + instruction. (For backward compatibility, those instructions + that formerly had them in the middle, continue to accept them + there.) + - The IT instruction may appear, and if it does is validated + against subsequent conditional affixes. It does not generate + machine code. + + Important differences from the old Thumb mode: + + - Immediate operands do not require a # prefix. + - Most of the V6T2 instructions are only available in unified mode. + - The .N and .W suffixes are recognized and honored (it is an error + if they cannot be honored). + - All instructions set the flags if and only if they have an 's' affix. + - Conditional affixes may be used. They are validated against + preceding IT instructions. Unlike ARM mode, you cannot use a + conditional affix except in the scope of an IT instruction. */ + +static bfd_boolean unified_syntax = FALSE; struct arm_it { - const char * error; + const char * error; unsigned long instruction; - int size; + int size; + int size_req; + int cond; + /* Set to the opcode if the instruction needs relaxation. + Zero if the instruction is not relaxed. */ + unsigned long relax; struct { bfd_reloc_code_real_type type; - expressionS exp; - int pc_rel; + expressionS exp; + int pc_rel; } reloc; + + struct + { + unsigned reg; + signed int imm; + unsigned present : 1; /* Operand present. */ + unsigned isreg : 1; /* Operand was a register. */ + unsigned immisreg : 1; /* .imm field is a second register. */ + unsigned hasreloc : 1; /* Operand has relocation suffix. */ + unsigned writeback : 1; /* Operand has trailing ! */ + unsigned preind : 1; /* Preindexed address. */ + unsigned postind : 1; /* Postindexed address. */ + unsigned negative : 1; /* Index register was negated. */ + unsigned shifted : 1; /* Shift applied to operation. */ + unsigned shift_kind : 3; /* Shift operation (enum shift_kind). */ + } operands[6]; }; -struct arm_it inst; - -enum asm_shift_index -{ - SHIFT_LSL = 0, - SHIFT_LSR, - SHIFT_ASR, - SHIFT_ROR, - SHIFT_RRX -}; - -struct asm_shift_properties -{ - enum asm_shift_index index; - unsigned long bit_field; - unsigned int allows_0 : 1; - unsigned int allows_32 : 1; -}; - -static const struct asm_shift_properties shift_properties [] = -{ - { SHIFT_LSL, 0, 1, 0}, - { SHIFT_LSR, 0x20, 0, 1}, - { SHIFT_ASR, 0x40, 0, 1}, - { SHIFT_ROR, 0x60, 0, 0}, - { SHIFT_RRX, 0x60, 0, 0} -}; - -struct asm_shift_name -{ - const char * name; - const struct asm_shift_properties * properties; -}; - -static const struct asm_shift_name shift_names [] = -{ - { "asl", shift_properties + SHIFT_LSL }, - { "lsl", shift_properties + SHIFT_LSL }, - { "lsr", shift_properties + SHIFT_LSR }, - { "asr", shift_properties + SHIFT_ASR }, - { "ror", shift_properties + SHIFT_ROR }, - { "rrx", shift_properties + SHIFT_RRX }, - { "ASL", shift_properties + SHIFT_LSL }, - { "LSL", shift_properties + SHIFT_LSL }, - { "LSR", shift_properties + SHIFT_LSR }, - { "ASR", shift_properties + SHIFT_ASR }, - { "ROR", shift_properties + SHIFT_ROR }, - { "RRX", shift_properties + SHIFT_RRX } -}; - -/* Any kind of shift is accepted. */ -#define NO_SHIFT_RESTRICT 1 -/* The shift operand must be an immediate value, not a register. */ -#define SHIFT_IMMEDIATE 0 -/* The shift must be LSL or ASR and the operand must be an immediate. */ -#define SHIFT_LSL_OR_ASR_IMMEDIATE 2 -/* The shift must be ASR and the operand must be an immediate. */ -#define SHIFT_ASR_IMMEDIATE 3 -/* The shift must be LSL and the operand must be an immediate. */ -#define SHIFT_LSL_IMMEDIATE 4 +static struct arm_it inst; #define NUM_FLOAT_VALS 8 @@ -321,7 +299,7 @@ const char * fp_const[] = "0.0", "1.0", "2.0", "3.0", "4.0", "5.0", "0.5", "10.0", 0 }; -/* Number of littlenums required to hold an extended precision number. */ +/* Number of littlenums required to hold an extended precision number. */ #define MAX_LITTLENUMS 6 LITTLENUM_TYPE fp_values[NUM_FLOAT_VALS][MAX_LITTLENUMS]; @@ -329,246 +307,52 @@ LITTLENUM_TYPE fp_values[NUM_FLOAT_VALS][MAX_LITTLENUMS]; #define FAIL (-1) #define SUCCESS (0) -/* Whether a Co-processor load/store operation accepts write-back forms. */ -#define CP_WB_OK 1 -#define CP_NO_WB 0 - #define SUFF_S 1 #define SUFF_D 2 #define SUFF_E 3 #define SUFF_P 4 -#define CP_T_X 0x00008000 -#define CP_T_Y 0x00400000 -#define CP_T_Pre 0x01000000 -#define CP_T_UD 0x00800000 -#define CP_T_WB 0x00200000 +#define CP_T_X 0x00008000 +#define CP_T_Y 0x00400000 -#define CONDS_BIT 0x00100000 -#define LOAD_BIT 0x00100000 +#define CONDS_BIT 0x00100000 +#define LOAD_BIT 0x00100000 #define DOUBLE_LOAD_FLAG 0x00000001 struct asm_cond { - const char * template; + const char * template; unsigned long value; }; -#define COND_ALWAYS 0xe0000000 -#define COND_MASK 0xf0000000 - -static const struct asm_cond conds[] = -{ - {"eq", 0x00000000}, - {"ne", 0x10000000}, - {"cs", 0x20000000}, {"hs", 0x20000000}, - {"cc", 0x30000000}, {"ul", 0x30000000}, {"lo", 0x30000000}, - {"mi", 0x40000000}, - {"pl", 0x50000000}, - {"vs", 0x60000000}, - {"vc", 0x70000000}, - {"hi", 0x80000000}, - {"ls", 0x90000000}, - {"ge", 0xa0000000}, - {"lt", 0xb0000000}, - {"gt", 0xc0000000}, - {"le", 0xd0000000}, - {"al", 0xe0000000}, - {"nv", 0xf0000000} -}; +#define COND_ALWAYS 0xE struct asm_psr { const char *template; - bfd_boolean cpsr; unsigned long field; }; +struct asm_barrier_opt +{ + const char *template; + unsigned long value; +}; + /* The bit that distinguishes CPSR and SPSR. */ #define SPSR_BIT (1 << 22) -/* How many bits to shift the PSR_xxx bits up by. */ -#define PSR_SHIFT 16 +/* The individual PSR flag bits. */ +#define PSR_c (1 << 16) +#define PSR_x (1 << 17) +#define PSR_s (1 << 18) +#define PSR_f (1 << 19) -#define PSR_c (1 << 0) -#define PSR_x (1 << 1) -#define PSR_s (1 << 2) -#define PSR_f (1 << 3) - -static const struct asm_psr psrs[] = +struct reloc_entry { - {"CPSR", TRUE, PSR_c | PSR_f}, - {"CPSR_all", TRUE, PSR_c | PSR_f}, - {"SPSR", FALSE, PSR_c | PSR_f}, - {"SPSR_all", FALSE, PSR_c | PSR_f}, - {"CPSR_flg", TRUE, PSR_f}, - {"CPSR_f", TRUE, PSR_f}, - {"SPSR_flg", FALSE, PSR_f}, - {"SPSR_f", FALSE, PSR_f}, - {"CPSR_c", TRUE, PSR_c}, - {"CPSR_ctl", TRUE, PSR_c}, - {"SPSR_c", FALSE, PSR_c}, - {"SPSR_ctl", FALSE, PSR_c}, - {"CPSR_x", TRUE, PSR_x}, - {"CPSR_s", TRUE, PSR_s}, - {"SPSR_x", FALSE, PSR_x}, - {"SPSR_s", FALSE, PSR_s}, - /* Combinations of flags. */ - {"CPSR_fs", TRUE, PSR_f | PSR_s}, - {"CPSR_fx", TRUE, PSR_f | PSR_x}, - {"CPSR_fc", TRUE, PSR_f | PSR_c}, - {"CPSR_sf", TRUE, PSR_s | PSR_f}, - {"CPSR_sx", TRUE, PSR_s | PSR_x}, - {"CPSR_sc", TRUE, PSR_s | PSR_c}, - {"CPSR_xf", TRUE, PSR_x | PSR_f}, - {"CPSR_xs", TRUE, PSR_x | PSR_s}, - {"CPSR_xc", TRUE, PSR_x | PSR_c}, - {"CPSR_cf", TRUE, PSR_c | PSR_f}, - {"CPSR_cs", TRUE, PSR_c | PSR_s}, - {"CPSR_cx", TRUE, PSR_c | PSR_x}, - {"CPSR_fsx", TRUE, PSR_f | PSR_s | PSR_x}, - {"CPSR_fsc", TRUE, PSR_f | PSR_s | PSR_c}, - {"CPSR_fxs", TRUE, PSR_f | PSR_x | PSR_s}, - {"CPSR_fxc", TRUE, PSR_f | PSR_x | PSR_c}, - {"CPSR_fcs", TRUE, PSR_f | PSR_c | PSR_s}, - {"CPSR_fcx", TRUE, PSR_f | PSR_c | PSR_x}, - {"CPSR_sfx", TRUE, PSR_s | PSR_f | PSR_x}, - {"CPSR_sfc", TRUE, PSR_s | PSR_f | PSR_c}, - {"CPSR_sxf", TRUE, PSR_s | PSR_x | PSR_f}, - {"CPSR_sxc", TRUE, PSR_s | PSR_x | PSR_c}, - {"CPSR_scf", TRUE, PSR_s | PSR_c | PSR_f}, - {"CPSR_scx", TRUE, PSR_s | PSR_c | PSR_x}, - {"CPSR_xfs", TRUE, PSR_x | PSR_f | PSR_s}, - {"CPSR_xfc", TRUE, PSR_x | PSR_f | PSR_c}, - {"CPSR_xsf", TRUE, PSR_x | PSR_s | PSR_f}, - {"CPSR_xsc", TRUE, PSR_x | PSR_s | PSR_c}, - {"CPSR_xcf", TRUE, PSR_x | PSR_c | PSR_f}, - {"CPSR_xcs", TRUE, PSR_x | PSR_c | PSR_s}, - {"CPSR_cfs", TRUE, PSR_c | PSR_f | PSR_s}, - {"CPSR_cfx", TRUE, PSR_c | PSR_f | PSR_x}, - {"CPSR_csf", TRUE, PSR_c | PSR_s | PSR_f}, - {"CPSR_csx", TRUE, PSR_c | PSR_s | PSR_x}, - {"CPSR_cxf", TRUE, PSR_c | PSR_x | PSR_f}, - {"CPSR_cxs", TRUE, PSR_c | PSR_x | PSR_s}, - {"CPSR_fsxc", TRUE, PSR_f | PSR_s | PSR_x | PSR_c}, - {"CPSR_fscx", TRUE, PSR_f | PSR_s | PSR_c | PSR_x}, - {"CPSR_fxsc", TRUE, PSR_f | PSR_x | PSR_s | PSR_c}, - {"CPSR_fxcs", TRUE, PSR_f | PSR_x | PSR_c | PSR_s}, - {"CPSR_fcsx", TRUE, PSR_f | PSR_c | PSR_s | PSR_x}, - {"CPSR_fcxs", TRUE, PSR_f | PSR_c | PSR_x | PSR_s}, - {"CPSR_sfxc", TRUE, PSR_s | PSR_f | PSR_x | PSR_c}, - {"CPSR_sfcx", TRUE, PSR_s | PSR_f | PSR_c | PSR_x}, - {"CPSR_sxfc", TRUE, PSR_s | PSR_x | PSR_f | PSR_c}, - {"CPSR_sxcf", TRUE, PSR_s | PSR_x | PSR_c | PSR_f}, - {"CPSR_scfx", TRUE, PSR_s | PSR_c | PSR_f | PSR_x}, - {"CPSR_scxf", TRUE, PSR_s | PSR_c | PSR_x | PSR_f}, - {"CPSR_xfsc", TRUE, PSR_x | PSR_f | PSR_s | PSR_c}, - {"CPSR_xfcs", TRUE, PSR_x | PSR_f | PSR_c | PSR_s}, - {"CPSR_xsfc", TRUE, PSR_x | PSR_s | PSR_f | PSR_c}, - {"CPSR_xscf", TRUE, PSR_x | PSR_s | PSR_c | PSR_f}, - {"CPSR_xcfs", TRUE, PSR_x | PSR_c | PSR_f | PSR_s}, - {"CPSR_xcsf", TRUE, PSR_x | PSR_c | PSR_s | PSR_f}, - {"CPSR_cfsx", TRUE, PSR_c | PSR_f | PSR_s | PSR_x}, - {"CPSR_cfxs", TRUE, PSR_c | PSR_f | PSR_x | PSR_s}, - {"CPSR_csfx", TRUE, PSR_c | PSR_s | PSR_f | PSR_x}, - {"CPSR_csxf", TRUE, PSR_c | PSR_s | PSR_x | PSR_f}, - {"CPSR_cxfs", TRUE, PSR_c | PSR_x | PSR_f | PSR_s}, - {"CPSR_cxsf", TRUE, PSR_c | PSR_x | PSR_s | PSR_f}, - {"SPSR_fs", FALSE, PSR_f | PSR_s}, - {"SPSR_fx", FALSE, PSR_f | PSR_x}, - {"SPSR_fc", FALSE, PSR_f | PSR_c}, - {"SPSR_sf", FALSE, PSR_s | PSR_f}, - {"SPSR_sx", FALSE, PSR_s | PSR_x}, - {"SPSR_sc", FALSE, PSR_s | PSR_c}, - {"SPSR_xf", FALSE, PSR_x | PSR_f}, - {"SPSR_xs", FALSE, PSR_x | PSR_s}, - {"SPSR_xc", FALSE, PSR_x | PSR_c}, - {"SPSR_cf", FALSE, PSR_c | PSR_f}, - {"SPSR_cs", FALSE, PSR_c | PSR_s}, - {"SPSR_cx", FALSE, PSR_c | PSR_x}, - {"SPSR_fsx", FALSE, PSR_f | PSR_s | PSR_x}, - {"SPSR_fsc", FALSE, PSR_f | PSR_s | PSR_c}, - {"SPSR_fxs", FALSE, PSR_f | PSR_x | PSR_s}, - {"SPSR_fxc", FALSE, PSR_f | PSR_x | PSR_c}, - {"SPSR_fcs", FALSE, PSR_f | PSR_c | PSR_s}, - {"SPSR_fcx", FALSE, PSR_f | PSR_c | PSR_x}, - {"SPSR_sfx", FALSE, PSR_s | PSR_f | PSR_x}, - {"SPSR_sfc", FALSE, PSR_s | PSR_f | PSR_c}, - {"SPSR_sxf", FALSE, PSR_s | PSR_x | PSR_f}, - {"SPSR_sxc", FALSE, PSR_s | PSR_x | PSR_c}, - {"SPSR_scf", FALSE, PSR_s | PSR_c | PSR_f}, - {"SPSR_scx", FALSE, PSR_s | PSR_c | PSR_x}, - {"SPSR_xfs", FALSE, PSR_x | PSR_f | PSR_s}, - {"SPSR_xfc", FALSE, PSR_x | PSR_f | PSR_c}, - {"SPSR_xsf", FALSE, PSR_x | PSR_s | PSR_f}, - {"SPSR_xsc", FALSE, PSR_x | PSR_s | PSR_c}, - {"SPSR_xcf", FALSE, PSR_x | PSR_c | PSR_f}, - {"SPSR_xcs", FALSE, PSR_x | PSR_c | PSR_s}, - {"SPSR_cfs", FALSE, PSR_c | PSR_f | PSR_s}, - {"SPSR_cfx", FALSE, PSR_c | PSR_f | PSR_x}, - {"SPSR_csf", FALSE, PSR_c | PSR_s | PSR_f}, - {"SPSR_csx", FALSE, PSR_c | PSR_s | PSR_x}, - {"SPSR_cxf", FALSE, PSR_c | PSR_x | PSR_f}, - {"SPSR_cxs", FALSE, PSR_c | PSR_x | PSR_s}, - {"SPSR_fsxc", FALSE, PSR_f | PSR_s | PSR_x | PSR_c}, - {"SPSR_fscx", FALSE, PSR_f | PSR_s | PSR_c | PSR_x}, - {"SPSR_fxsc", FALSE, PSR_f | PSR_x | PSR_s | PSR_c}, - {"SPSR_fxcs", FALSE, PSR_f | PSR_x | PSR_c | PSR_s}, - {"SPSR_fcsx", FALSE, PSR_f | PSR_c | PSR_s | PSR_x}, - {"SPSR_fcxs", FALSE, PSR_f | PSR_c | PSR_x | PSR_s}, - {"SPSR_sfxc", FALSE, PSR_s | PSR_f | PSR_x | PSR_c}, - {"SPSR_sfcx", FALSE, PSR_s | PSR_f | PSR_c | PSR_x}, - {"SPSR_sxfc", FALSE, PSR_s | PSR_x | PSR_f | PSR_c}, - {"SPSR_sxcf", FALSE, PSR_s | PSR_x | PSR_c | PSR_f}, - {"SPSR_scfx", FALSE, PSR_s | PSR_c | PSR_f | PSR_x}, - {"SPSR_scxf", FALSE, PSR_s | PSR_c | PSR_x | PSR_f}, - {"SPSR_xfsc", FALSE, PSR_x | PSR_f | PSR_s | PSR_c}, - {"SPSR_xfcs", FALSE, PSR_x | PSR_f | PSR_c | PSR_s}, - {"SPSR_xsfc", FALSE, PSR_x | PSR_s | PSR_f | PSR_c}, - {"SPSR_xscf", FALSE, PSR_x | PSR_s | PSR_c | PSR_f}, - {"SPSR_xcfs", FALSE, PSR_x | PSR_c | PSR_f | PSR_s}, - {"SPSR_xcsf", FALSE, PSR_x | PSR_c | PSR_s | PSR_f}, - {"SPSR_cfsx", FALSE, PSR_c | PSR_f | PSR_s | PSR_x}, - {"SPSR_cfxs", FALSE, PSR_c | PSR_f | PSR_x | PSR_s}, - {"SPSR_csfx", FALSE, PSR_c | PSR_s | PSR_f | PSR_x}, - {"SPSR_csxf", FALSE, PSR_c | PSR_s | PSR_x | PSR_f}, - {"SPSR_cxfs", FALSE, PSR_c | PSR_x | PSR_f | PSR_s}, - {"SPSR_cxsf", FALSE, PSR_c | PSR_x | PSR_s | PSR_f}, -}; - -enum wreg_type - { - IWMMXT_REG_WR = 0, - IWMMXT_REG_WC = 1, - IWMMXT_REG_WR_OR_WC = 2, - IWMMXT_REG_WCG - }; - -enum iwmmxt_insn_type -{ - check_rd, - check_wr, - check_wrwr, - check_wrwrwr, - check_wrwrwcg, - check_tbcst, - check_tmovmsk, - check_tmia, - check_tmcrr, - check_tmrrc, - check_tmcr, - check_tmrc, - check_tinsr, - check_textrc, - check_waligni, - check_textrm, - check_wshufh -}; - -enum vfp_dp_reg_pos -{ - VFP_REG_Dd, VFP_REG_Dm, VFP_REG_Dn + char *name; + bfd_reloc_code_real_type reloc; }; enum vfp_sp_reg_pos @@ -581,1666 +365,101 @@ enum vfp_ldstm_type VFP_LDSTMIA, VFP_LDSTMDB, VFP_LDSTMIAX, VFP_LDSTMDBX }; -/* VFP system registers. */ -struct vfp_reg +/* ARM register categories. This includes coprocessor numbers and various + architecture extensions' registers. */ +enum arm_reg_type { - const char *name; - unsigned long regno; -}; - -static const struct vfp_reg vfp_regs[] = -{ - {"fpsid", 0x00000000}, - {"FPSID", 0x00000000}, - {"fpscr", 0x00010000}, - {"FPSCR", 0x00010000}, - {"fpexc", 0x00080000}, - {"FPEXC", 0x00080000} + REG_TYPE_RN, + REG_TYPE_CP, + REG_TYPE_CN, + REG_TYPE_FN, + REG_TYPE_VFS, + REG_TYPE_VFD, + REG_TYPE_VFC, + REG_TYPE_MVF, + REG_TYPE_MVD, + REG_TYPE_MVFX, + REG_TYPE_MVDX, + REG_TYPE_MVAX, + REG_TYPE_DSPSC, + REG_TYPE_MMXWR, + REG_TYPE_MMXWC, + REG_TYPE_MMXWCG, + REG_TYPE_XSCALE, }; /* Structure for a hash table entry for a register. */ struct reg_entry { - const char * name; - int number; - bfd_boolean builtin; + const char *name; + unsigned char number; + unsigned char type; + unsigned char builtin; +}; + +/* Diagnostics used when we don't get a register of the expected type. */ +const char *const reg_expected_msgs[] = +{ + N_("ARM register expected"), + N_("bad or missing co-processor number"), + N_("co-processor register expected"), + N_("FPA register expected"), + N_("VFP single precision register expected"), + N_("VFP double precision register expected"), + N_("VFP system register expected"), + N_("Maverick MVF register expected"), + N_("Maverick MVD register expected"), + N_("Maverick MVFX register expected"), + N_("Maverick MVDX register expected"), + N_("Maverick MVAX register expected"), + N_("Maverick DSPSC register expected"), + N_("iWMMXt data register expected"), + N_("iWMMXt control register expected"), + N_("iWMMXt scalar register expected"), + N_("XScale accumulator register expected"), }; /* Some well known registers that we refer to directly elsewhere. */ -#define REG_SP 13 -#define REG_LR 14 +#define REG_SP 13 +#define REG_LR 14 #define REG_PC 15 -#define wr_register(reg) ((reg ^ WR_PREFIX) >= 0 && (reg ^ WR_PREFIX) <= 15) -#define wc_register(reg) ((reg ^ WC_PREFIX) >= 0 && (reg ^ WC_PREFIX) <= 15) -#define wcg_register(reg) ((reg ^ WC_PREFIX) >= 8 && (reg ^ WC_PREFIX) <= 11) - -/* These are the standard names. Users can add aliases with .req. - and delete them with .unreq. */ - -/* Integer Register Numbers. */ -static const struct reg_entry rn_table[] = -{ - {"r0", 0, TRUE}, {"r1", 1, TRUE}, {"r2", 2, TRUE}, {"r3", 3, TRUE}, - {"r4", 4, TRUE}, {"r5", 5, TRUE}, {"r6", 6, TRUE}, {"r7", 7, TRUE}, - {"r8", 8, TRUE}, {"r9", 9, TRUE}, {"r10", 10, TRUE}, {"r11", 11, TRUE}, - {"r12", 12, TRUE}, {"r13", REG_SP, TRUE}, {"r14", REG_LR, TRUE}, {"r15", REG_PC, TRUE}, - /* ATPCS Synonyms. */ - {"a1", 0, TRUE}, {"a2", 1, TRUE}, {"a3", 2, TRUE}, {"a4", 3, TRUE}, - {"v1", 4, TRUE}, {"v2", 5, TRUE}, {"v3", 6, TRUE}, {"v4", 7, TRUE}, - {"v5", 8, TRUE}, {"v6", 9, TRUE}, {"v7", 10, TRUE}, {"v8", 11, TRUE}, - /* Well-known aliases. */ - {"wr", 7, TRUE}, {"sb", 9, TRUE}, {"sl", 10, TRUE}, {"fp", 11, TRUE}, - {"ip", 12, TRUE}, {"sp", REG_SP, TRUE}, {"lr", REG_LR, TRUE}, {"pc", REG_PC, TRUE}, - {NULL, 0, TRUE} -}; - -#define WR_PREFIX 0x200 -#define WC_PREFIX 0x400 - -static const struct reg_entry iwmmxt_table[] = -{ - /* Intel Wireless MMX technology register names. */ - { "wr0", 0x0 | WR_PREFIX, TRUE}, {"wr1", 0x1 | WR_PREFIX, TRUE}, - { "wr2", 0x2 | WR_PREFIX, TRUE}, {"wr3", 0x3 | WR_PREFIX, TRUE}, - { "wr4", 0x4 | WR_PREFIX, TRUE}, {"wr5", 0x5 | WR_PREFIX, TRUE}, - { "wr6", 0x6 | WR_PREFIX, TRUE}, {"wr7", 0x7 | WR_PREFIX, TRUE}, - { "wr8", 0x8 | WR_PREFIX, TRUE}, {"wr9", 0x9 | WR_PREFIX, TRUE}, - { "wr10", 0xa | WR_PREFIX, TRUE}, {"wr11", 0xb | WR_PREFIX, TRUE}, - { "wr12", 0xc | WR_PREFIX, TRUE}, {"wr13", 0xd | WR_PREFIX, TRUE}, - { "wr14", 0xe | WR_PREFIX, TRUE}, {"wr15", 0xf | WR_PREFIX, TRUE}, - { "wcid", 0x0 | WC_PREFIX, TRUE}, {"wcon", 0x1 | WC_PREFIX, TRUE}, - {"wcssf", 0x2 | WC_PREFIX, TRUE}, {"wcasf", 0x3 | WC_PREFIX, TRUE}, - {"wcgr0", 0x8 | WC_PREFIX, TRUE}, {"wcgr1", 0x9 | WC_PREFIX, TRUE}, - {"wcgr2", 0xa | WC_PREFIX, TRUE}, {"wcgr3", 0xb | WC_PREFIX, TRUE}, - - { "wR0", 0x0 | WR_PREFIX, TRUE}, {"wR1", 0x1 | WR_PREFIX, TRUE}, - { "wR2", 0x2 | WR_PREFIX, TRUE}, {"wR3", 0x3 | WR_PREFIX, TRUE}, - { "wR4", 0x4 | WR_PREFIX, TRUE}, {"wR5", 0x5 | WR_PREFIX, TRUE}, - { "wR6", 0x6 | WR_PREFIX, TRUE}, {"wR7", 0x7 | WR_PREFIX, TRUE}, - { "wR8", 0x8 | WR_PREFIX, TRUE}, {"wR9", 0x9 | WR_PREFIX, TRUE}, - { "wR10", 0xa | WR_PREFIX, TRUE}, {"wR11", 0xb | WR_PREFIX, TRUE}, - { "wR12", 0xc | WR_PREFIX, TRUE}, {"wR13", 0xd | WR_PREFIX, TRUE}, - { "wR14", 0xe | WR_PREFIX, TRUE}, {"wR15", 0xf | WR_PREFIX, TRUE}, - { "wCID", 0x0 | WC_PREFIX, TRUE}, {"wCon", 0x1 | WC_PREFIX, TRUE}, - {"wCSSF", 0x2 | WC_PREFIX, TRUE}, {"wCASF", 0x3 | WC_PREFIX, TRUE}, - {"wCGR0", 0x8 | WC_PREFIX, TRUE}, {"wCGR1", 0x9 | WC_PREFIX, TRUE}, - {"wCGR2", 0xa | WC_PREFIX, TRUE}, {"wCGR3", 0xb | WC_PREFIX, TRUE}, - {NULL, 0, TRUE} -}; - -/* Co-processor Numbers. */ -static const struct reg_entry cp_table[] = -{ - {"p0", 0, TRUE}, {"p1", 1, TRUE}, {"p2", 2, TRUE}, {"p3", 3, TRUE}, - {"p4", 4, TRUE}, {"p5", 5, TRUE}, {"p6", 6, TRUE}, {"p7", 7, TRUE}, - {"p8", 8, TRUE}, {"p9", 9, TRUE}, {"p10", 10, TRUE}, {"p11", 11, TRUE}, - {"p12", 12, TRUE}, {"p13", 13, TRUE}, {"p14", 14, TRUE}, {"p15", 15, TRUE}, - {NULL, 0, TRUE} -}; - -/* Co-processor Register Numbers. */ -static const struct reg_entry cn_table[] = -{ - {"c0", 0, TRUE}, {"c1", 1, TRUE}, {"c2", 2, TRUE}, {"c3", 3, TRUE}, - {"c4", 4, TRUE}, {"c5", 5, TRUE}, {"c6", 6, TRUE}, {"c7", 7, TRUE}, - {"c8", 8, TRUE}, {"c9", 9, TRUE}, {"c10", 10, TRUE}, {"c11", 11, TRUE}, - {"c12", 12, TRUE}, {"c13", 13, TRUE}, {"c14", 14, TRUE}, {"c15", 15, TRUE}, - /* Not really valid, but kept for back-wards compatibility. */ - {"cr0", 0, TRUE}, {"cr1", 1, TRUE}, {"cr2", 2, TRUE}, {"cr3", 3, TRUE}, - {"cr4", 4, TRUE}, {"cr5", 5, TRUE}, {"cr6", 6, TRUE}, {"cr7", 7, TRUE}, - {"cr8", 8, TRUE}, {"cr9", 9, TRUE}, {"cr10", 10, TRUE}, {"cr11", 11, TRUE}, - {"cr12", 12, TRUE}, {"cr13", 13, TRUE}, {"cr14", 14, TRUE}, {"cr15", 15, TRUE}, - {NULL, 0, TRUE} -}; - -/* FPA Registers. */ -static const struct reg_entry fn_table[] = -{ - {"f0", 0, TRUE}, {"f1", 1, TRUE}, {"f2", 2, TRUE}, {"f3", 3, TRUE}, - {"f4", 4, TRUE}, {"f5", 5, TRUE}, {"f6", 6, TRUE}, {"f7", 7, TRUE}, - {NULL, 0, TRUE} -}; - -/* VFP SP Registers. */ -static const struct reg_entry sn_table[] = -{ - {"s0", 0, TRUE}, {"s1", 1, TRUE}, {"s2", 2, TRUE}, {"s3", 3, TRUE}, - {"s4", 4, TRUE}, {"s5", 5, TRUE}, {"s6", 6, TRUE}, {"s7", 7, TRUE}, - {"s8", 8, TRUE}, {"s9", 9, TRUE}, {"s10", 10, TRUE}, {"s11", 11, TRUE}, - {"s12", 12, TRUE}, {"s13", 13, TRUE}, {"s14", 14, TRUE}, {"s15", 15, TRUE}, - {"s16", 16, TRUE}, {"s17", 17, TRUE}, {"s18", 18, TRUE}, {"s19", 19, TRUE}, - {"s20", 20, TRUE}, {"s21", 21, TRUE}, {"s22", 22, TRUE}, {"s23", 23, TRUE}, - {"s24", 24, TRUE}, {"s25", 25, TRUE}, {"s26", 26, TRUE}, {"s27", 27, TRUE}, - {"s28", 28, TRUE}, {"s29", 29, TRUE}, {"s30", 30, TRUE}, {"s31", 31, TRUE}, - {NULL, 0, TRUE} -}; - -/* VFP DP Registers. */ -static const struct reg_entry dn_table[] = -{ - {"d0", 0, TRUE}, {"d1", 1, TRUE}, {"d2", 2, TRUE}, {"d3", 3, TRUE}, - {"d4", 4, TRUE}, {"d5", 5, TRUE}, {"d6", 6, TRUE}, {"d7", 7, TRUE}, - {"d8", 8, TRUE}, {"d9", 9, TRUE}, {"d10", 10, TRUE}, {"d11", 11, TRUE}, - {"d12", 12, TRUE}, {"d13", 13, TRUE}, {"d14", 14, TRUE}, {"d15", 15, TRUE}, - {NULL, 0, TRUE} -}; - -/* Maverick DSP coprocessor registers. */ -static const struct reg_entry mav_mvf_table[] = -{ - {"mvf0", 0, TRUE}, {"mvf1", 1, TRUE}, {"mvf2", 2, TRUE}, {"mvf3", 3, TRUE}, - {"mvf4", 4, TRUE}, {"mvf5", 5, TRUE}, {"mvf6", 6, TRUE}, {"mvf7", 7, TRUE}, - {"mvf8", 8, TRUE}, {"mvf9", 9, TRUE}, {"mvf10", 10, TRUE}, {"mvf11", 11, TRUE}, - {"mvf12", 12, TRUE}, {"mvf13", 13, TRUE}, {"mvf14", 14, TRUE}, {"mvf15", 15, TRUE}, - {NULL, 0, TRUE} -}; - -static const struct reg_entry mav_mvd_table[] = -{ - {"mvd0", 0, TRUE}, {"mvd1", 1, TRUE}, {"mvd2", 2, TRUE}, {"mvd3", 3, TRUE}, - {"mvd4", 4, TRUE}, {"mvd5", 5, TRUE}, {"mvd6", 6, TRUE}, {"mvd7", 7, TRUE}, - {"mvd8", 8, TRUE}, {"mvd9", 9, TRUE}, {"mvd10", 10, TRUE}, {"mvd11", 11, TRUE}, - {"mvd12", 12, TRUE}, {"mvd13", 13, TRUE}, {"mvd14", 14, TRUE}, {"mvd15", 15, TRUE}, - {NULL, 0, TRUE} -}; - -static const struct reg_entry mav_mvfx_table[] = -{ - {"mvfx0", 0, TRUE}, {"mvfx1", 1, TRUE}, {"mvfx2", 2, TRUE}, {"mvfx3", 3, TRUE}, - {"mvfx4", 4, TRUE}, {"mvfx5", 5, TRUE}, {"mvfx6", 6, TRUE}, {"mvfx7", 7, TRUE}, - {"mvfx8", 8, TRUE}, {"mvfx9", 9, TRUE}, {"mvfx10", 10, TRUE}, {"mvfx11", 11, TRUE}, - {"mvfx12", 12, TRUE}, {"mvfx13", 13, TRUE}, {"mvfx14", 14, TRUE}, {"mvfx15", 15, TRUE}, - {NULL, 0, TRUE} -}; - -static const struct reg_entry mav_mvdx_table[] = -{ - {"mvdx0", 0, TRUE}, {"mvdx1", 1, TRUE}, {"mvdx2", 2, TRUE}, {"mvdx3", 3, TRUE}, - {"mvdx4", 4, TRUE}, {"mvdx5", 5, TRUE}, {"mvdx6", 6, TRUE}, {"mvdx7", 7, TRUE}, - {"mvdx8", 8, TRUE}, {"mvdx9", 9, TRUE}, {"mvdx10", 10, TRUE}, {"mvdx11", 11, TRUE}, - {"mvdx12", 12, TRUE}, {"mvdx13", 13, TRUE}, {"mvdx14", 14, TRUE}, {"mvdx15", 15, TRUE}, - {NULL, 0, TRUE} -}; - -static const struct reg_entry mav_mvax_table[] = -{ - {"mvax0", 0, TRUE}, {"mvax1", 1, TRUE}, {"mvax2", 2, TRUE}, {"mvax3", 3, TRUE}, - {NULL, 0, TRUE} -}; - -static const struct reg_entry mav_dspsc_table[] = -{ - {"dspsc", 0, TRUE}, - {NULL, 0, TRUE} -}; - -struct reg_map -{ - const struct reg_entry *names; - int max_regno; - struct hash_control *htab; - const char *expected; -}; - -struct reg_map all_reg_maps[] = -{ - {rn_table, 15, NULL, N_("ARM register expected")}, - {cp_table, 15, NULL, N_("bad or missing co-processor number")}, - {cn_table, 15, NULL, N_("co-processor register expected")}, - {fn_table, 7, NULL, N_("FPA register expected")}, - {sn_table, 31, NULL, N_("VFP single precision register expected")}, - {dn_table, 15, NULL, N_("VFP double precision register expected")}, - {mav_mvf_table, 15, NULL, N_("Maverick MVF register expected")}, - {mav_mvd_table, 15, NULL, N_("Maverick MVD register expected")}, - {mav_mvfx_table, 15, NULL, N_("Maverick MVFX register expected")}, - {mav_mvdx_table, 15, NULL, N_("Maverick MVDX register expected")}, - {mav_mvax_table, 3, NULL, N_("Maverick MVAX register expected")}, - {mav_dspsc_table, 0, NULL, N_("Maverick DSPSC register expected")}, - {iwmmxt_table, 23, NULL, N_("Intel Wireless MMX technology register expected")}, -}; - -/* Enumeration matching entries in table above. */ -enum arm_reg_type -{ - REG_TYPE_RN = 0, -#define REG_TYPE_FIRST REG_TYPE_RN - REG_TYPE_CP = 1, - REG_TYPE_CN = 2, - REG_TYPE_FN = 3, - REG_TYPE_SN = 4, - REG_TYPE_DN = 5, - REG_TYPE_MVF = 6, - REG_TYPE_MVD = 7, - REG_TYPE_MVFX = 8, - REG_TYPE_MVDX = 9, - REG_TYPE_MVAX = 10, - REG_TYPE_DSPSC = 11, - REG_TYPE_IWMMXT = 12, - - REG_TYPE_MAX = 13 -}; - -/* Functions called by parser. */ -/* ARM instructions. */ -static void do_arit PARAMS ((char *)); -static void do_cmp PARAMS ((char *)); -static void do_mov PARAMS ((char *)); -static void do_ldst PARAMS ((char *)); -static void do_ldstt PARAMS ((char *)); -static void do_ldmstm PARAMS ((char *)); -static void do_branch PARAMS ((char *)); -static void do_swi PARAMS ((char *)); - -/* Pseudo Op codes. */ -static void do_adr PARAMS ((char *)); -static void do_adrl PARAMS ((char *)); -static void do_empty PARAMS ((char *)); - -/* ARM v2. */ -static void do_mul PARAMS ((char *)); -static void do_mla PARAMS ((char *)); - -/* ARM v2S. */ -static void do_swap PARAMS ((char *)); - -/* ARM v3. */ -static void do_msr PARAMS ((char *)); -static void do_mrs PARAMS ((char *)); - -/* ARM v3M. */ -static void do_mull PARAMS ((char *)); - -/* ARM v4. */ -static void do_ldstv4 PARAMS ((char *)); - -/* ARM v4T. */ -static void do_bx PARAMS ((char *)); - -/* ARM v5T. */ -static void do_blx PARAMS ((char *)); -static void do_bkpt PARAMS ((char *)); -static void do_clz PARAMS ((char *)); -static void do_lstc2 PARAMS ((char *)); -static void do_cdp2 PARAMS ((char *)); -static void do_co_reg2 PARAMS ((char *)); - -/* ARM v5TExP. */ -static void do_smla PARAMS ((char *)); -static void do_smlal PARAMS ((char *)); -static void do_smul PARAMS ((char *)); -static void do_qadd PARAMS ((char *)); - -/* ARM v5TE. */ -static void do_pld PARAMS ((char *)); -static void do_ldrd PARAMS ((char *)); -static void do_co_reg2c PARAMS ((char *)); - -/* ARM v5TEJ. */ -static void do_bxj PARAMS ((char *)); - -/* ARM V6. */ -static void do_cps PARAMS ((char *)); -static void do_cpsi PARAMS ((char *)); -static void do_ldrex PARAMS ((char *)); -static void do_pkhbt PARAMS ((char *)); -static void do_pkhtb PARAMS ((char *)); -static void do_qadd16 PARAMS ((char *)); -static void do_rev PARAMS ((char *)); -static void do_rfe PARAMS ((char *)); -static void do_sxtah PARAMS ((char *)); -static void do_sxth PARAMS ((char *)); -static void do_setend PARAMS ((char *)); -static void do_smlad PARAMS ((char *)); -static void do_smlald PARAMS ((char *)); -static void do_smmul PARAMS ((char *)); -static void do_ssat PARAMS ((char *)); -static void do_usat PARAMS ((char *)); -static void do_srs PARAMS ((char *)); -static void do_ssat16 PARAMS ((char *)); -static void do_usat16 PARAMS ((char *)); -static void do_strex PARAMS ((char *)); -static void do_umaal PARAMS ((char *)); - -static void do_cps_mode PARAMS ((char **)); -static void do_cps_flags PARAMS ((char **, int)); -static int do_endian_specifier PARAMS ((char *)); -static void do_pkh_core PARAMS ((char *, int)); -static void do_sat PARAMS ((char **, int)); -static void do_sat16 PARAMS ((char **, int)); - -/* Coprocessor Instructions. */ -static void do_cdp PARAMS ((char *)); -static void do_lstc PARAMS ((char *)); -static void do_co_reg PARAMS ((char *)); - -/* FPA instructions. */ -static void do_fpa_ctrl PARAMS ((char *)); -static void do_fpa_ldst PARAMS ((char *)); -static void do_fpa_ldmstm PARAMS ((char *)); -static void do_fpa_dyadic PARAMS ((char *)); -static void do_fpa_monadic PARAMS ((char *)); -static void do_fpa_cmp PARAMS ((char *)); -static void do_fpa_from_reg PARAMS ((char *)); -static void do_fpa_to_reg PARAMS ((char *)); - -/* VFP instructions. */ -static void do_vfp_sp_monadic PARAMS ((char *)); -static void do_vfp_dp_monadic PARAMS ((char *)); -static void do_vfp_sp_dyadic PARAMS ((char *)); -static void do_vfp_dp_dyadic PARAMS ((char *)); -static void do_vfp_reg_from_sp PARAMS ((char *)); -static void do_vfp_sp_from_reg PARAMS ((char *)); -static void do_vfp_reg2_from_sp2 PARAMS ((char *)); -static void do_vfp_sp2_from_reg2 PARAMS ((char *)); -static void do_vfp_reg_from_dp PARAMS ((char *)); -static void do_vfp_reg2_from_dp PARAMS ((char *)); -static void do_vfp_dp_from_reg PARAMS ((char *)); -static void do_vfp_dp_from_reg2 PARAMS ((char *)); -static void do_vfp_reg_from_ctrl PARAMS ((char *)); -static void do_vfp_ctrl_from_reg PARAMS ((char *)); -static void do_vfp_sp_ldst PARAMS ((char *)); -static void do_vfp_dp_ldst PARAMS ((char *)); -static void do_vfp_sp_ldstmia PARAMS ((char *)); -static void do_vfp_sp_ldstmdb PARAMS ((char *)); -static void do_vfp_dp_ldstmia PARAMS ((char *)); -static void do_vfp_dp_ldstmdb PARAMS ((char *)); -static void do_vfp_xp_ldstmia PARAMS ((char *)); -static void do_vfp_xp_ldstmdb PARAMS ((char *)); -static void do_vfp_sp_compare_z PARAMS ((char *)); -static void do_vfp_dp_compare_z PARAMS ((char *)); -static void do_vfp_dp_sp_cvt PARAMS ((char *)); -static void do_vfp_sp_dp_cvt PARAMS ((char *)); - -/* XScale. */ -static void do_xsc_mia PARAMS ((char *)); -static void do_xsc_mar PARAMS ((char *)); -static void do_xsc_mra PARAMS ((char *)); - -/* Maverick. */ -static void do_mav_binops PARAMS ((char *, int, enum arm_reg_type, - enum arm_reg_type)); -static void do_mav_binops_1a PARAMS ((char *)); -static void do_mav_binops_1b PARAMS ((char *)); -static void do_mav_binops_1c PARAMS ((char *)); -static void do_mav_binops_1d PARAMS ((char *)); -static void do_mav_binops_1e PARAMS ((char *)); -static void do_mav_binops_1f PARAMS ((char *)); -static void do_mav_binops_1g PARAMS ((char *)); -static void do_mav_binops_1h PARAMS ((char *)); -static void do_mav_binops_1i PARAMS ((char *)); -static void do_mav_binops_1j PARAMS ((char *)); -static void do_mav_binops_1k PARAMS ((char *)); -static void do_mav_binops_1l PARAMS ((char *)); -static void do_mav_binops_1m PARAMS ((char *)); -static void do_mav_binops_1n PARAMS ((char *)); -static void do_mav_binops_1o PARAMS ((char *)); -static void do_mav_binops_2a PARAMS ((char *)); -static void do_mav_binops_2b PARAMS ((char *)); -static void do_mav_binops_2c PARAMS ((char *)); -static void do_mav_binops_3a PARAMS ((char *)); -static void do_mav_binops_3b PARAMS ((char *)); -static void do_mav_binops_3c PARAMS ((char *)); -static void do_mav_binops_3d PARAMS ((char *)); -static void do_mav_triple PARAMS ((char *, int, enum arm_reg_type, - enum arm_reg_type, - enum arm_reg_type)); -static void do_mav_triple_4a PARAMS ((char *)); -static void do_mav_triple_4b PARAMS ((char *)); -static void do_mav_triple_5a PARAMS ((char *)); -static void do_mav_triple_5b PARAMS ((char *)); -static void do_mav_triple_5c PARAMS ((char *)); -static void do_mav_triple_5d PARAMS ((char *)); -static void do_mav_triple_5e PARAMS ((char *)); -static void do_mav_triple_5f PARAMS ((char *)); -static void do_mav_triple_5g PARAMS ((char *)); -static void do_mav_triple_5h PARAMS ((char *)); -static void do_mav_quad PARAMS ((char *, int, enum arm_reg_type, - enum arm_reg_type, - enum arm_reg_type, - enum arm_reg_type)); -static void do_mav_quad_6a PARAMS ((char *)); -static void do_mav_quad_6b PARAMS ((char *)); -static void do_mav_dspsc_1 PARAMS ((char *)); -static void do_mav_dspsc_2 PARAMS ((char *)); -static void do_mav_shift PARAMS ((char *, enum arm_reg_type, - enum arm_reg_type)); -static void do_mav_shift_1 PARAMS ((char *)); -static void do_mav_shift_2 PARAMS ((char *)); -static void do_mav_ldst PARAMS ((char *, enum arm_reg_type)); -static void do_mav_ldst_1 PARAMS ((char *)); -static void do_mav_ldst_2 PARAMS ((char *)); -static void do_mav_ldst_3 PARAMS ((char *)); -static void do_mav_ldst_4 PARAMS ((char *)); - -static int mav_reg_required_here PARAMS ((char **, int, - enum arm_reg_type)); -static int mav_parse_offset PARAMS ((char **, int *)); - -static void fix_new_arm PARAMS ((fragS *, int, short, expressionS *, - int, int)); -static int arm_reg_parse PARAMS ((char **, struct hash_control *)); -static enum arm_reg_type arm_reg_parse_any PARAMS ((char *)); -static const struct asm_psr * arm_psr_parse PARAMS ((char **)); -static void symbol_locate PARAMS ((symbolS *, const char *, segT, valueT, - fragS *)); -static int add_to_lit_pool PARAMS ((void)); -static unsigned validate_immediate PARAMS ((unsigned)); -static unsigned validate_immediate_twopart PARAMS ((unsigned int, - unsigned int *)); -static int validate_offset_imm PARAMS ((unsigned int, int)); -static void opcode_select PARAMS ((int)); -static void end_of_line PARAMS ((char *)); -static int reg_required_here PARAMS ((char **, int)); -static int psr_required_here PARAMS ((char **)); -static int co_proc_number PARAMS ((char **)); -static int cp_opc_expr PARAMS ((char **, int, int)); -static int cp_reg_required_here PARAMS ((char **, int)); -static int fp_reg_required_here PARAMS ((char **, int)); -static int vfp_sp_reg_required_here PARAMS ((char **, enum vfp_sp_reg_pos)); -static int vfp_dp_reg_required_here PARAMS ((char **, enum vfp_dp_reg_pos)); -static void vfp_sp_ldstm PARAMS ((char *, enum vfp_ldstm_type)); -static void vfp_dp_ldstm PARAMS ((char *, enum vfp_ldstm_type)); -static long vfp_sp_reg_list PARAMS ((char **, enum vfp_sp_reg_pos)); -static long vfp_dp_reg_list PARAMS ((char **)); -static int vfp_psr_required_here PARAMS ((char **str)); -static const struct vfp_reg *vfp_psr_parse PARAMS ((char **str)); -static int cp_address_offset PARAMS ((char **)); -static int cp_address_required_here PARAMS ((char **, int)); -static int my_get_float_expression PARAMS ((char **)); -static int skip_past_comma PARAMS ((char **)); -static int walk_no_bignums PARAMS ((symbolS *)); -static int negate_data_op PARAMS ((unsigned long *, unsigned long)); -static int data_op2 PARAMS ((char **)); -static int fp_op2 PARAMS ((char **)); -static long reg_list PARAMS ((char **)); -static void thumb_load_store PARAMS ((char *, int, int)); -static int decode_shift PARAMS ((char **, int)); -static int ldst_extend PARAMS ((char **)); -static int ldst_extend_v4 PARAMS ((char **)); -static void thumb_add_sub PARAMS ((char *, int)); -static void insert_reg PARAMS ((const struct reg_entry *, - struct hash_control *)); -static void thumb_shift PARAMS ((char *, int)); -static void thumb_mov_compare PARAMS ((char *, int)); -static void build_arm_ops_hsh PARAMS ((void)); -static void set_constant_flonums PARAMS ((void)); -static valueT md_chars_to_number PARAMS ((char *, int)); -static void build_reg_hsh PARAMS ((struct reg_map *)); -static void insert_reg_alias PARAMS ((char *, int, struct hash_control *)); -static int create_register_alias PARAMS ((char *, char *)); -static void output_inst PARAMS ((const char *)); -static int accum0_required_here PARAMS ((char **)); -static int ld_mode_required_here PARAMS ((char **)); -static void do_branch25 PARAMS ((char *)); -static symbolS * find_real_start PARAMS ((symbolS *)); -#ifdef OBJ_ELF -static bfd_reloc_code_real_type arm_parse_reloc PARAMS ((void)); -#endif - -static int wreg_required_here PARAMS ((char **, int, enum wreg_type)); -static void do_iwmmxt_byte_addr PARAMS ((char *)); -static void do_iwmmxt_tandc PARAMS ((char *)); -static void do_iwmmxt_tbcst PARAMS ((char *)); -static void do_iwmmxt_textrc PARAMS ((char *)); -static void do_iwmmxt_textrm PARAMS ((char *)); -static void do_iwmmxt_tinsr PARAMS ((char *)); -static void do_iwmmxt_tmcr PARAMS ((char *)); -static void do_iwmmxt_tmcrr PARAMS ((char *)); -static void do_iwmmxt_tmia PARAMS ((char *)); -static void do_iwmmxt_tmovmsk PARAMS ((char *)); -static void do_iwmmxt_tmrc PARAMS ((char *)); -static void do_iwmmxt_tmrrc PARAMS ((char *)); -static void do_iwmmxt_torc PARAMS ((char *)); -static void do_iwmmxt_waligni PARAMS ((char *)); -static void do_iwmmxt_wmov PARAMS ((char *)); -static void do_iwmmxt_word_addr PARAMS ((char *)); -static void do_iwmmxt_wrwr PARAMS ((char *)); -static void do_iwmmxt_wrwrwcg PARAMS ((char *)); -static void do_iwmmxt_wrwrwr PARAMS ((char *)); -static void do_iwmmxt_wshufh PARAMS ((char *)); -static void do_iwmmxt_wzero PARAMS ((char *)); -static int cp_byte_address_offset PARAMS ((char **)); -static int cp_byte_address_required_here PARAMS ((char **)); - /* ARM instructions take 4bytes in the object file, Thumb instructions take 2: */ -#define INSN_SIZE 4 - -/* "INSN X,Y" where X:bit12, Y:bit16. */ -#define MAV_MODE1 0x100c - -/* "INSN X,Y" where X:bit16, Y:bit12. */ -#define MAV_MODE2 0x0c10 - -/* "INSN X,Y" where X:bit12, Y:bit16. */ -#define MAV_MODE3 0x100c - -/* "INSN X,Y,Z" where X:16, Y:0, Z:12. */ -#define MAV_MODE4 0x0c0010 - -/* "INSN X,Y,Z" where X:12, Y:16, Z:0. */ -#define MAV_MODE5 0x00100c - -/* "INSN W,X,Y,Z" where W:5, X:12, Y:16, Z:0. */ -#define MAV_MODE6 0x00100c05 +#define INSN_SIZE 4 struct asm_opcode { /* Basic string to match. */ - const char * template; + const char *template; + + /* Parameters to instruction. */ + unsigned char operands[8]; + + /* Conditional tag - see opcode_lookup. */ + unsigned int tag : 4; /* Basic instruction code. */ - unsigned long value; + unsigned int avalue : 28; - /* Offset into the template where the condition code (if any) will be. - If zero, then the instruction is never conditional. */ - unsigned cond_offset; + /* Thumb-format instruction code. */ + unsigned int tvalue; /* Which architecture variant provides this instruction. */ - unsigned long variant; + const arm_feature_set *avariant; + const arm_feature_set *tvariant; - /* Function to call to parse args. */ - void (* parms) PARAMS ((char *)); -}; + /* Function to call to encode instruction in ARM format. */ + void (* aencode) (void); -static const struct asm_opcode insns[] = -{ - /* Core ARM Instructions. */ - {"and", 0xe0000000, 3, ARM_EXT_V1, do_arit}, - {"ands", 0xe0100000, 3, ARM_EXT_V1, do_arit}, - {"eor", 0xe0200000, 3, ARM_EXT_V1, do_arit}, - {"eors", 0xe0300000, 3, ARM_EXT_V1, do_arit}, - {"sub", 0xe0400000, 3, ARM_EXT_V1, do_arit}, - {"subs", 0xe0500000, 3, ARM_EXT_V1, do_arit}, - {"rsb", 0xe0600000, 3, ARM_EXT_V1, do_arit}, - {"rsbs", 0xe0700000, 3, ARM_EXT_V1, do_arit}, - {"add", 0xe0800000, 3, ARM_EXT_V1, do_arit}, - {"adds", 0xe0900000, 3, ARM_EXT_V1, do_arit}, - {"adc", 0xe0a00000, 3, ARM_EXT_V1, do_arit}, - {"adcs", 0xe0b00000, 3, ARM_EXT_V1, do_arit}, - {"sbc", 0xe0c00000, 3, ARM_EXT_V1, do_arit}, - {"sbcs", 0xe0d00000, 3, ARM_EXT_V1, do_arit}, - {"rsc", 0xe0e00000, 3, ARM_EXT_V1, do_arit}, - {"rscs", 0xe0f00000, 3, ARM_EXT_V1, do_arit}, - {"orr", 0xe1800000, 3, ARM_EXT_V1, do_arit}, - {"orrs", 0xe1900000, 3, ARM_EXT_V1, do_arit}, - {"bic", 0xe1c00000, 3, ARM_EXT_V1, do_arit}, - {"bics", 0xe1d00000, 3, ARM_EXT_V1, do_arit}, - - {"tst", 0xe1100000, 3, ARM_EXT_V1, do_cmp}, - {"tsts", 0xe1100000, 3, ARM_EXT_V1, do_cmp}, - {"tstp", 0xe110f000, 3, ARM_EXT_V1, do_cmp}, - {"teq", 0xe1300000, 3, ARM_EXT_V1, do_cmp}, - {"teqs", 0xe1300000, 3, ARM_EXT_V1, do_cmp}, - {"teqp", 0xe130f000, 3, ARM_EXT_V1, do_cmp}, - {"cmp", 0xe1500000, 3, ARM_EXT_V1, do_cmp}, - {"cmps", 0xe1500000, 3, ARM_EXT_V1, do_cmp}, - {"cmpp", 0xe150f000, 3, ARM_EXT_V1, do_cmp}, - {"cmn", 0xe1700000, 3, ARM_EXT_V1, do_cmp}, - {"cmns", 0xe1700000, 3, ARM_EXT_V1, do_cmp}, - {"cmnp", 0xe170f000, 3, ARM_EXT_V1, do_cmp}, - - {"mov", 0xe1a00000, 3, ARM_EXT_V1, do_mov}, - {"movs", 0xe1b00000, 3, ARM_EXT_V1, do_mov}, - {"mvn", 0xe1e00000, 3, ARM_EXT_V1, do_mov}, - {"mvns", 0xe1f00000, 3, ARM_EXT_V1, do_mov}, - - {"ldr", 0xe4100000, 3, ARM_EXT_V1, do_ldst}, - {"ldrb", 0xe4500000, 3, ARM_EXT_V1, do_ldst}, - {"ldrt", 0xe4300000, 3, ARM_EXT_V1, do_ldstt}, - {"ldrbt", 0xe4700000, 3, ARM_EXT_V1, do_ldstt}, - {"str", 0xe4000000, 3, ARM_EXT_V1, do_ldst}, - {"strb", 0xe4400000, 3, ARM_EXT_V1, do_ldst}, - {"strt", 0xe4200000, 3, ARM_EXT_V1, do_ldstt}, - {"strbt", 0xe4600000, 3, ARM_EXT_V1, do_ldstt}, - - {"stmia", 0xe8800000, 3, ARM_EXT_V1, do_ldmstm}, - {"stmib", 0xe9800000, 3, ARM_EXT_V1, do_ldmstm}, - {"stmda", 0xe8000000, 3, ARM_EXT_V1, do_ldmstm}, - {"stmdb", 0xe9000000, 3, ARM_EXT_V1, do_ldmstm}, - {"stmfd", 0xe9000000, 3, ARM_EXT_V1, do_ldmstm}, - {"stmfa", 0xe9800000, 3, ARM_EXT_V1, do_ldmstm}, - {"stmea", 0xe8800000, 3, ARM_EXT_V1, do_ldmstm}, - {"stmed", 0xe8000000, 3, ARM_EXT_V1, do_ldmstm}, - - {"ldmia", 0xe8900000, 3, ARM_EXT_V1, do_ldmstm}, - {"ldmib", 0xe9900000, 3, ARM_EXT_V1, do_ldmstm}, - {"ldmda", 0xe8100000, 3, ARM_EXT_V1, do_ldmstm}, - {"ldmdb", 0xe9100000, 3, ARM_EXT_V1, do_ldmstm}, - {"ldmfd", 0xe8900000, 3, ARM_EXT_V1, do_ldmstm}, - {"ldmfa", 0xe8100000, 3, ARM_EXT_V1, do_ldmstm}, - {"ldmea", 0xe9100000, 3, ARM_EXT_V1, do_ldmstm}, - {"ldmed", 0xe9900000, 3, ARM_EXT_V1, do_ldmstm}, - - {"swi", 0xef000000, 3, ARM_EXT_V1, do_swi}, -#ifdef TE_WINCE - /* XXX This is the wrong place to do this. Think multi-arch. */ - {"bl", 0xeb000000, 2, ARM_EXT_V1, do_branch}, - {"b", 0xea000000, 1, ARM_EXT_V1, do_branch}, -#else - {"bl", 0xebfffffe, 2, ARM_EXT_V1, do_branch}, - {"b", 0xeafffffe, 1, ARM_EXT_V1, do_branch}, -#endif - - /* Pseudo ops. */ - {"adr", 0xe28f0000, 3, ARM_EXT_V1, do_adr}, - {"adrl", 0xe28f0000, 3, ARM_EXT_V1, do_adrl}, - {"nop", 0xe1a00000, 3, ARM_EXT_V1, do_empty}, - - /* ARM 2 multiplies. */ - {"mul", 0xe0000090, 3, ARM_EXT_V2, do_mul}, - {"muls", 0xe0100090, 3, ARM_EXT_V2, do_mul}, - {"mla", 0xe0200090, 3, ARM_EXT_V2, do_mla}, - {"mlas", 0xe0300090, 3, ARM_EXT_V2, do_mla}, - - /* Generic coprocessor instructions. */ - {"cdp", 0xee000000, 3, ARM_EXT_V2, do_cdp}, - {"ldc", 0xec100000, 3, ARM_EXT_V2, do_lstc}, - {"ldcl", 0xec500000, 3, ARM_EXT_V2, do_lstc}, - {"stc", 0xec000000, 3, ARM_EXT_V2, do_lstc}, - {"stcl", 0xec400000, 3, ARM_EXT_V2, do_lstc}, - {"mcr", 0xee000010, 3, ARM_EXT_V2, do_co_reg}, - {"mrc", 0xee100010, 3, ARM_EXT_V2, do_co_reg}, - - /* ARM 3 - swp instructions. */ - {"swp", 0xe1000090, 3, ARM_EXT_V2S, do_swap}, - {"swpb", 0xe1400090, 3, ARM_EXT_V2S, do_swap}, - - /* ARM 6 Status register instructions. */ - {"mrs", 0xe10f0000, 3, ARM_EXT_V3, do_mrs}, - {"msr", 0xe120f000, 3, ARM_EXT_V3, do_msr}, - /* ScottB: our code uses 0xe128f000 for msr. - NickC: but this is wrong because the bits 16 through 19 are - handled by the PSR_xxx defines above. */ - - /* ARM 7M long multiplies. */ - {"smull", 0xe0c00090, 5, ARM_EXT_V3M, do_mull}, - {"smulls", 0xe0d00090, 5, ARM_EXT_V3M, do_mull}, - {"umull", 0xe0800090, 5, ARM_EXT_V3M, do_mull}, - {"umulls", 0xe0900090, 5, ARM_EXT_V3M, do_mull}, - {"smlal", 0xe0e00090, 5, ARM_EXT_V3M, do_mull}, - {"smlals", 0xe0f00090, 5, ARM_EXT_V3M, do_mull}, - {"umlal", 0xe0a00090, 5, ARM_EXT_V3M, do_mull}, - {"umlals", 0xe0b00090, 5, ARM_EXT_V3M, do_mull}, - - /* ARM Architecture 4. */ - {"ldrh", 0xe01000b0, 3, ARM_EXT_V4, do_ldstv4}, - {"ldrsh", 0xe01000f0, 3, ARM_EXT_V4, do_ldstv4}, - {"ldrsb", 0xe01000d0, 3, ARM_EXT_V4, do_ldstv4}, - {"strh", 0xe00000b0, 3, ARM_EXT_V4, do_ldstv4}, - - /* ARM Architecture 4T. */ - /* Note: bx (and blx) are required on V5, even if the processor does - not support Thumb. */ - {"bx", 0xe12fff10, 2, ARM_EXT_V4T | ARM_EXT_V5, do_bx}, - - /* ARM Architecture 5T. */ - /* Note: blx has 2 variants, so the .value is set dynamically. - Only one of the variants has conditional execution. */ - {"blx", 0xe0000000, 3, ARM_EXT_V5, do_blx}, - {"clz", 0xe16f0f10, 3, ARM_EXT_V5, do_clz}, - {"bkpt", 0xe1200070, 0, ARM_EXT_V5, do_bkpt}, - {"ldc2", 0xfc100000, 0, ARM_EXT_V5, do_lstc2}, - {"ldc2l", 0xfc500000, 0, ARM_EXT_V5, do_lstc2}, - {"stc2", 0xfc000000, 0, ARM_EXT_V5, do_lstc2}, - {"stc2l", 0xfc400000, 0, ARM_EXT_V5, do_lstc2}, - {"cdp2", 0xfe000000, 0, ARM_EXT_V5, do_cdp2}, - {"mcr2", 0xfe000010, 0, ARM_EXT_V5, do_co_reg2}, - {"mrc2", 0xfe100010, 0, ARM_EXT_V5, do_co_reg2}, - - /* ARM Architecture 5TExP. */ - {"smlabb", 0xe1000080, 6, ARM_EXT_V5ExP, do_smla}, - {"smlatb", 0xe10000a0, 6, ARM_EXT_V5ExP, do_smla}, - {"smlabt", 0xe10000c0, 6, ARM_EXT_V5ExP, do_smla}, - {"smlatt", 0xe10000e0, 6, ARM_EXT_V5ExP, do_smla}, - - {"smlawb", 0xe1200080, 6, ARM_EXT_V5ExP, do_smla}, - {"smlawt", 0xe12000c0, 6, ARM_EXT_V5ExP, do_smla}, - - {"smlalbb", 0xe1400080, 7, ARM_EXT_V5ExP, do_smlal}, - {"smlaltb", 0xe14000a0, 7, ARM_EXT_V5ExP, do_smlal}, - {"smlalbt", 0xe14000c0, 7, ARM_EXT_V5ExP, do_smlal}, - {"smlaltt", 0xe14000e0, 7, ARM_EXT_V5ExP, do_smlal}, - - {"smulbb", 0xe1600080, 6, ARM_EXT_V5ExP, do_smul}, - {"smultb", 0xe16000a0, 6, ARM_EXT_V5ExP, do_smul}, - {"smulbt", 0xe16000c0, 6, ARM_EXT_V5ExP, do_smul}, - {"smultt", 0xe16000e0, 6, ARM_EXT_V5ExP, do_smul}, - - {"smulwb", 0xe12000a0, 6, ARM_EXT_V5ExP, do_smul}, - {"smulwt", 0xe12000e0, 6, ARM_EXT_V5ExP, do_smul}, - - {"qadd", 0xe1000050, 4, ARM_EXT_V5ExP, do_qadd}, - {"qdadd", 0xe1400050, 5, ARM_EXT_V5ExP, do_qadd}, - {"qsub", 0xe1200050, 4, ARM_EXT_V5ExP, do_qadd}, - {"qdsub", 0xe1600050, 5, ARM_EXT_V5ExP, do_qadd}, - - /* ARM Architecture 5TE. */ - {"pld", 0xf450f000, 0, ARM_EXT_V5E, do_pld}, - {"ldrd", 0xe00000d0, 3, ARM_EXT_V5E, do_ldrd}, - {"strd", 0xe00000f0, 3, ARM_EXT_V5E, do_ldrd}, - - {"mcrr", 0xec400000, 4, ARM_EXT_V5E, do_co_reg2c}, - {"mrrc", 0xec500000, 4, ARM_EXT_V5E, do_co_reg2c}, - - /* ARM Architecture 5TEJ. */ - {"bxj", 0xe12fff20, 3, ARM_EXT_V5J, do_bxj}, - - /* ARM V6. */ - { "cps", 0xf1020000, 0, ARM_EXT_V6, do_cps}, - { "cpsie", 0xf1080000, 0, ARM_EXT_V6, do_cpsi}, - { "cpsid", 0xf10C0000, 0, ARM_EXT_V6, do_cpsi}, - { "ldrex", 0xe1900f9f, 5, ARM_EXT_V6, do_ldrex}, - { "mcrr2", 0xfc400000, 0, ARM_EXT_V6, do_co_reg2c}, - { "mrrc2", 0xfc500000, 0, ARM_EXT_V6, do_co_reg2c}, - { "pkhbt", 0xe6800010, 5, ARM_EXT_V6, do_pkhbt}, - { "pkhtb", 0xe6800050, 5, ARM_EXT_V6, do_pkhtb}, - { "qadd16", 0xe6200f10, 6, ARM_EXT_V6, do_qadd16}, - { "qadd8", 0xe6200f90, 5, ARM_EXT_V6, do_qadd16}, - { "qaddsubx", 0xe6200f30, 8, ARM_EXT_V6, do_qadd16}, - { "qsub16", 0xe6200f70, 6, ARM_EXT_V6, do_qadd16}, - { "qsub8", 0xe6200ff0, 5, ARM_EXT_V6, do_qadd16}, - { "qsubaddx", 0xe6200f50, 8, ARM_EXT_V6, do_qadd16}, - { "sadd16", 0xe6100f10, 6, ARM_EXT_V6, do_qadd16}, - { "sadd8", 0xe6100f90, 5, ARM_EXT_V6, do_qadd16}, - { "saddsubx", 0xe6100f30, 8, ARM_EXT_V6, do_qadd16}, - { "shadd16", 0xe6300f10, 7, ARM_EXT_V6, do_qadd16}, - { "shadd8", 0xe6300f90, 6, ARM_EXT_V6, do_qadd16}, - { "shaddsubx", 0xe6300f30, 9, ARM_EXT_V6, do_qadd16}, - { "shsub16", 0xe6300f70, 7, ARM_EXT_V6, do_qadd16}, - { "shsub8", 0xe6300ff0, 6, ARM_EXT_V6, do_qadd16}, - { "shsubaddx", 0xe6300f50, 9, ARM_EXT_V6, do_qadd16}, - { "ssub16", 0xe6100f70, 6, ARM_EXT_V6, do_qadd16}, - { "ssub8", 0xe6100ff0, 5, ARM_EXT_V6, do_qadd16}, - { "ssubaddx", 0xe6100f50, 8, ARM_EXT_V6, do_qadd16}, - { "uadd16", 0xe6500f10, 6, ARM_EXT_V6, do_qadd16}, - { "uadd8", 0xe6500f90, 5, ARM_EXT_V6, do_qadd16}, - { "uaddsubx", 0xe6500f30, 8, ARM_EXT_V6, do_qadd16}, - { "uhadd16", 0xe6700f10, 7, ARM_EXT_V6, do_qadd16}, - { "uhadd8", 0xe6700f90, 6, ARM_EXT_V6, do_qadd16}, - { "uhaddsubx", 0xe6700f30, 9, ARM_EXT_V6, do_qadd16}, - { "uhsub16", 0xe6700f70, 7, ARM_EXT_V6, do_qadd16}, - { "uhsub8", 0xe6700ff0, 6, ARM_EXT_V6, do_qadd16}, - { "uhsubaddx", 0xe6700f50, 9, ARM_EXT_V6, do_qadd16}, - { "uqadd16", 0xe6600f10, 7, ARM_EXT_V6, do_qadd16}, - { "uqadd8", 0xe6600f90, 6, ARM_EXT_V6, do_qadd16}, - { "uqaddsubx", 0xe6600f30, 9, ARM_EXT_V6, do_qadd16}, - { "uqsub16", 0xe6600f70, 7, ARM_EXT_V6, do_qadd16}, - { "uqsub8", 0xe6600ff0, 6, ARM_EXT_V6, do_qadd16}, - { "uqsubaddx", 0xe6600f50, 9, ARM_EXT_V6, do_qadd16}, - { "usub16", 0xe6500f70, 6, ARM_EXT_V6, do_qadd16}, - { "usub8", 0xe6500ff0, 5, ARM_EXT_V6, do_qadd16}, - { "usubaddx", 0xe6500f50, 8, ARM_EXT_V6, do_qadd16}, - { "rev", 0xe6bf0f30, 3, ARM_EXT_V6, do_rev}, - { "rev16", 0xe6bf0fb0, 5, ARM_EXT_V6, do_rev}, - { "revsh", 0xe6ff0fb0, 5, ARM_EXT_V6, do_rev}, - { "rfeia", 0xf8900a00, 0, ARM_EXT_V6, do_rfe}, - { "rfeib", 0xf9900a00, 0, ARM_EXT_V6, do_rfe}, - { "rfeda", 0xf8100a00, 0, ARM_EXT_V6, do_rfe}, - { "rfedb", 0xf9100a00, 0, ARM_EXT_V6, do_rfe}, - { "rfefd", 0xf8900a00, 0, ARM_EXT_V6, do_rfe}, - { "rfefa", 0xf9900a00, 0, ARM_EXT_V6, do_rfe}, - { "rfeea", 0xf8100a00, 0, ARM_EXT_V6, do_rfe}, - { "rfeed", 0xf9100a00, 0, ARM_EXT_V6, do_rfe}, - { "sxtah", 0xe6b00070, 5, ARM_EXT_V6, do_sxtah}, - { "sxtab16", 0xe6800070, 7, ARM_EXT_V6, do_sxtah}, - { "sxtab", 0xe6a00070, 5, ARM_EXT_V6, do_sxtah}, - { "sxth", 0xe6bf0070, 4, ARM_EXT_V6, do_sxth}, - { "sxtb16", 0xe68f0070, 6, ARM_EXT_V6, do_sxth}, - { "sxtb", 0xe6af0070, 4, ARM_EXT_V6, do_sxth}, - { "uxtah", 0xe6f00070, 5, ARM_EXT_V6, do_sxtah}, - { "uxtab16", 0xe6c00070, 7, ARM_EXT_V6, do_sxtah}, - { "uxtab", 0xe6e00070, 5, ARM_EXT_V6, do_sxtah}, - { "uxth", 0xe6ff0070, 4, ARM_EXT_V6, do_sxth}, - { "uxtb16", 0xe6cf0070, 6, ARM_EXT_V6, do_sxth}, - { "uxtb", 0xe6ef0070, 4, ARM_EXT_V6, do_sxth}, - { "sel", 0xe68000b0, 3, ARM_EXT_V6, do_qadd16}, - { "setend", 0xf1010000, 0, ARM_EXT_V6, do_setend}, - { "smlad", 0xe7000010, 5, ARM_EXT_V6, do_smlad}, - { "smladx", 0xe7000030, 6, ARM_EXT_V6, do_smlad}, - { "smlald", 0xe7400010, 6, ARM_EXT_V6, do_smlald}, - { "smlaldx", 0xe7400030, 7, ARM_EXT_V6, do_smlald}, - { "smlsd", 0xe7000050, 5, ARM_EXT_V6, do_smlad}, - { "smlsdx", 0xe7000070, 6, ARM_EXT_V6, do_smlad}, - { "smlsld", 0xe7400050, 6, ARM_EXT_V6, do_smlald}, - { "smlsldx", 0xe7400070, 7, ARM_EXT_V6, do_smlald}, - { "smmla", 0xe7500010, 5, ARM_EXT_V6, do_smlad}, - { "smmlar", 0xe7500030, 6, ARM_EXT_V6, do_smlad}, - { "smmls", 0xe75000d0, 5, ARM_EXT_V6, do_smlad}, - { "smmlsr", 0xe75000f0, 6, ARM_EXT_V6, do_smlad}, - { "smmul", 0xe750f010, 5, ARM_EXT_V6, do_smmul}, - { "smmulr", 0xe750f030, 6, ARM_EXT_V6, do_smmul}, - { "smuad", 0xe700f010, 5, ARM_EXT_V6, do_smmul}, - { "smuadx", 0xe700f030, 6, ARM_EXT_V6, do_smmul}, - { "smusd", 0xe700f050, 5, ARM_EXT_V6, do_smmul}, - { "smusdx", 0xe700f070, 6, ARM_EXT_V6, do_smmul}, - { "srsia", 0xf8cd0500, 0, ARM_EXT_V6, do_srs}, - { "srsib", 0xf9cd0500, 0, ARM_EXT_V6, do_srs}, - { "srsda", 0xf84d0500, 0, ARM_EXT_V6, do_srs}, - { "srsdb", 0xf94d0500, 0, ARM_EXT_V6, do_srs}, - { "ssat", 0xe6a00010, 4, ARM_EXT_V6, do_ssat}, - { "ssat16", 0xe6a00f30, 6, ARM_EXT_V6, do_ssat16}, - { "strex", 0xe1800f90, 5, ARM_EXT_V6, do_strex}, - { "umaal", 0xe0400090, 5, ARM_EXT_V6, do_umaal}, - { "usad8", 0xe780f010, 5, ARM_EXT_V6, do_smmul}, - { "usada8", 0xe7800010, 6, ARM_EXT_V6, do_smlad}, - { "usat", 0xe6e00010, 4, ARM_EXT_V6, do_usat}, - { "usat16", 0xe6e00f30, 6, ARM_EXT_V6, do_usat16}, - - /* Core FPA instruction set (V1). */ - {"wfs", 0xee200110, 3, FPU_FPA_EXT_V1, do_fpa_ctrl}, - {"rfs", 0xee300110, 3, FPU_FPA_EXT_V1, do_fpa_ctrl}, - {"wfc", 0xee400110, 3, FPU_FPA_EXT_V1, do_fpa_ctrl}, - {"rfc", 0xee500110, 3, FPU_FPA_EXT_V1, do_fpa_ctrl}, - - {"ldfs", 0xec100100, 3, FPU_FPA_EXT_V1, do_fpa_ldst}, - {"ldfd", 0xec108100, 3, FPU_FPA_EXT_V1, do_fpa_ldst}, - {"ldfe", 0xec500100, 3, FPU_FPA_EXT_V1, do_fpa_ldst}, - {"ldfp", 0xec508100, 3, FPU_FPA_EXT_V1, do_fpa_ldst}, - - {"stfs", 0xec000100, 3, FPU_FPA_EXT_V1, do_fpa_ldst}, - {"stfd", 0xec008100, 3, FPU_FPA_EXT_V1, do_fpa_ldst}, - {"stfe", 0xec400100, 3, FPU_FPA_EXT_V1, do_fpa_ldst}, - {"stfp", 0xec408100, 3, FPU_FPA_EXT_V1, do_fpa_ldst}, - - {"mvfs", 0xee008100, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"mvfsp", 0xee008120, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"mvfsm", 0xee008140, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"mvfsz", 0xee008160, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"mvfd", 0xee008180, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"mvfdp", 0xee0081a0, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"mvfdm", 0xee0081c0, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"mvfdz", 0xee0081e0, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"mvfe", 0xee088100, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"mvfep", 0xee088120, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"mvfem", 0xee088140, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"mvfez", 0xee088160, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - - {"mnfs", 0xee108100, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"mnfsp", 0xee108120, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"mnfsm", 0xee108140, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"mnfsz", 0xee108160, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"mnfd", 0xee108180, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"mnfdp", 0xee1081a0, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"mnfdm", 0xee1081c0, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"mnfdz", 0xee1081e0, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"mnfe", 0xee188100, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"mnfep", 0xee188120, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"mnfem", 0xee188140, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"mnfez", 0xee188160, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - - {"abss", 0xee208100, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"abssp", 0xee208120, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"abssm", 0xee208140, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"abssz", 0xee208160, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"absd", 0xee208180, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"absdp", 0xee2081a0, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"absdm", 0xee2081c0, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"absdz", 0xee2081e0, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"abse", 0xee288100, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"absep", 0xee288120, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"absem", 0xee288140, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"absez", 0xee288160, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - - {"rnds", 0xee308100, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"rndsp", 0xee308120, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"rndsm", 0xee308140, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"rndsz", 0xee308160, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"rndd", 0xee308180, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"rnddp", 0xee3081a0, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"rnddm", 0xee3081c0, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"rnddz", 0xee3081e0, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"rnde", 0xee388100, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"rndep", 0xee388120, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"rndem", 0xee388140, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"rndez", 0xee388160, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - - {"sqts", 0xee408100, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"sqtsp", 0xee408120, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"sqtsm", 0xee408140, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"sqtsz", 0xee408160, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"sqtd", 0xee408180, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"sqtdp", 0xee4081a0, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"sqtdm", 0xee4081c0, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"sqtdz", 0xee4081e0, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"sqte", 0xee488100, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"sqtep", 0xee488120, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"sqtem", 0xee488140, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"sqtez", 0xee488160, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - - {"logs", 0xee508100, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"logsp", 0xee508120, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"logsm", 0xee508140, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"logsz", 0xee508160, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"logd", 0xee508180, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"logdp", 0xee5081a0, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"logdm", 0xee5081c0, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"logdz", 0xee5081e0, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"loge", 0xee588100, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"logep", 0xee588120, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"logem", 0xee588140, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"logez", 0xee588160, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - - {"lgns", 0xee608100, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"lgnsp", 0xee608120, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"lgnsm", 0xee608140, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"lgnsz", 0xee608160, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"lgnd", 0xee608180, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"lgndp", 0xee6081a0, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"lgndm", 0xee6081c0, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"lgndz", 0xee6081e0, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"lgne", 0xee688100, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"lgnep", 0xee688120, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"lgnem", 0xee688140, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"lgnez", 0xee688160, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - - {"exps", 0xee708100, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"expsp", 0xee708120, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"expsm", 0xee708140, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"expsz", 0xee708160, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"expd", 0xee708180, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"expdp", 0xee7081a0, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"expdm", 0xee7081c0, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"expdz", 0xee7081e0, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"expe", 0xee788100, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"expep", 0xee788120, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"expem", 0xee788140, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"expdz", 0xee788160, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - - {"sins", 0xee808100, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"sinsp", 0xee808120, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"sinsm", 0xee808140, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"sinsz", 0xee808160, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"sind", 0xee808180, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"sindp", 0xee8081a0, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"sindm", 0xee8081c0, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"sindz", 0xee8081e0, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"sine", 0xee888100, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"sinep", 0xee888120, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"sinem", 0xee888140, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"sinez", 0xee888160, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - - {"coss", 0xee908100, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"cossp", 0xee908120, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"cossm", 0xee908140, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"cossz", 0xee908160, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"cosd", 0xee908180, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"cosdp", 0xee9081a0, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"cosdm", 0xee9081c0, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"cosdz", 0xee9081e0, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"cose", 0xee988100, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"cosep", 0xee988120, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"cosem", 0xee988140, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"cosez", 0xee988160, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - - {"tans", 0xeea08100, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"tansp", 0xeea08120, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"tansm", 0xeea08140, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"tansz", 0xeea08160, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"tand", 0xeea08180, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"tandp", 0xeea081a0, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"tandm", 0xeea081c0, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"tandz", 0xeea081e0, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"tane", 0xeea88100, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"tanep", 0xeea88120, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"tanem", 0xeea88140, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"tanez", 0xeea88160, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - - {"asns", 0xeeb08100, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"asnsp", 0xeeb08120, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"asnsm", 0xeeb08140, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"asnsz", 0xeeb08160, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"asnd", 0xeeb08180, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"asndp", 0xeeb081a0, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"asndm", 0xeeb081c0, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"asndz", 0xeeb081e0, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"asne", 0xeeb88100, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"asnep", 0xeeb88120, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"asnem", 0xeeb88140, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"asnez", 0xeeb88160, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - - {"acss", 0xeec08100, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"acssp", 0xeec08120, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"acssm", 0xeec08140, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"acssz", 0xeec08160, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"acsd", 0xeec08180, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"acsdp", 0xeec081a0, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"acsdm", 0xeec081c0, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"acsdz", 0xeec081e0, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"acse", 0xeec88100, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"acsep", 0xeec88120, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"acsem", 0xeec88140, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"acsez", 0xeec88160, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - - {"atns", 0xeed08100, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"atnsp", 0xeed08120, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"atnsm", 0xeed08140, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"atnsz", 0xeed08160, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"atnd", 0xeed08180, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"atndp", 0xeed081a0, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"atndm", 0xeed081c0, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"atndz", 0xeed081e0, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"atne", 0xeed88100, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"atnep", 0xeed88120, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"atnem", 0xeed88140, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"atnez", 0xeed88160, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - - {"urds", 0xeee08100, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"urdsp", 0xeee08120, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"urdsm", 0xeee08140, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"urdsz", 0xeee08160, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"urdd", 0xeee08180, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"urddp", 0xeee081a0, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"urddm", 0xeee081c0, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"urddz", 0xeee081e0, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"urde", 0xeee88100, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"urdep", 0xeee88120, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"urdem", 0xeee88140, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"urdez", 0xeee88160, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - - {"nrms", 0xeef08100, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"nrmsp", 0xeef08120, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"nrmsm", 0xeef08140, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"nrmsz", 0xeef08160, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"nrmd", 0xeef08180, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"nrmdp", 0xeef081a0, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"nrmdm", 0xeef081c0, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"nrmdz", 0xeef081e0, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"nrme", 0xeef88100, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"nrmep", 0xeef88120, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"nrmem", 0xeef88140, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - {"nrmez", 0xeef88160, 3, FPU_FPA_EXT_V1, do_fpa_monadic}, - - {"adfs", 0xee000100, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"adfsp", 0xee000120, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"adfsm", 0xee000140, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"adfsz", 0xee000160, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"adfd", 0xee000180, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"adfdp", 0xee0001a0, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"adfdm", 0xee0001c0, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"adfdz", 0xee0001e0, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"adfe", 0xee080100, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"adfep", 0xee080120, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"adfem", 0xee080140, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"adfez", 0xee080160, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - - {"sufs", 0xee200100, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"sufsp", 0xee200120, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"sufsm", 0xee200140, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"sufsz", 0xee200160, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"sufd", 0xee200180, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"sufdp", 0xee2001a0, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"sufdm", 0xee2001c0, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"sufdz", 0xee2001e0, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"sufe", 0xee280100, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"sufep", 0xee280120, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"sufem", 0xee280140, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"sufez", 0xee280160, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - - {"rsfs", 0xee300100, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"rsfsp", 0xee300120, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"rsfsm", 0xee300140, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"rsfsz", 0xee300160, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"rsfd", 0xee300180, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"rsfdp", 0xee3001a0, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"rsfdm", 0xee3001c0, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"rsfdz", 0xee3001e0, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"rsfe", 0xee380100, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"rsfep", 0xee380120, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"rsfem", 0xee380140, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"rsfez", 0xee380160, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - - {"mufs", 0xee100100, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"mufsp", 0xee100120, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"mufsm", 0xee100140, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"mufsz", 0xee100160, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"mufd", 0xee100180, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"mufdp", 0xee1001a0, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"mufdm", 0xee1001c0, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"mufdz", 0xee1001e0, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"mufe", 0xee180100, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"mufep", 0xee180120, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"mufem", 0xee180140, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"mufez", 0xee180160, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - - {"dvfs", 0xee400100, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"dvfsp", 0xee400120, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"dvfsm", 0xee400140, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"dvfsz", 0xee400160, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"dvfd", 0xee400180, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"dvfdp", 0xee4001a0, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"dvfdm", 0xee4001c0, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"dvfdz", 0xee4001e0, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"dvfe", 0xee480100, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"dvfep", 0xee480120, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"dvfem", 0xee480140, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"dvfez", 0xee480160, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - - {"rdfs", 0xee500100, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"rdfsp", 0xee500120, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"rdfsm", 0xee500140, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"rdfsz", 0xee500160, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"rdfd", 0xee500180, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"rdfdp", 0xee5001a0, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"rdfdm", 0xee5001c0, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"rdfdz", 0xee5001e0, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"rdfe", 0xee580100, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"rdfep", 0xee580120, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"rdfem", 0xee580140, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"rdfez", 0xee580160, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - - {"pows", 0xee600100, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"powsp", 0xee600120, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"powsm", 0xee600140, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"powsz", 0xee600160, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"powd", 0xee600180, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"powdp", 0xee6001a0, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"powdm", 0xee6001c0, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"powdz", 0xee6001e0, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"powe", 0xee680100, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"powep", 0xee680120, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"powem", 0xee680140, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"powez", 0xee680160, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - - {"rpws", 0xee700100, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"rpwsp", 0xee700120, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"rpwsm", 0xee700140, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"rpwsz", 0xee700160, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"rpwd", 0xee700180, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"rpwdp", 0xee7001a0, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"rpwdm", 0xee7001c0, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"rpwdz", 0xee7001e0, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"rpwe", 0xee780100, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"rpwep", 0xee780120, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"rpwem", 0xee780140, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"rpwez", 0xee780160, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - - {"rmfs", 0xee800100, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"rmfsp", 0xee800120, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"rmfsm", 0xee800140, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"rmfsz", 0xee800160, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"rmfd", 0xee800180, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"rmfdp", 0xee8001a0, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"rmfdm", 0xee8001c0, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"rmfdz", 0xee8001e0, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"rmfe", 0xee880100, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"rmfep", 0xee880120, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"rmfem", 0xee880140, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"rmfez", 0xee880160, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - - {"fmls", 0xee900100, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"fmlsp", 0xee900120, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"fmlsm", 0xee900140, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"fmlsz", 0xee900160, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"fmld", 0xee900180, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"fmldp", 0xee9001a0, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"fmldm", 0xee9001c0, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"fmldz", 0xee9001e0, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"fmle", 0xee980100, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"fmlep", 0xee980120, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"fmlem", 0xee980140, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"fmlez", 0xee980160, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - - {"fdvs", 0xeea00100, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"fdvsp", 0xeea00120, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"fdvsm", 0xeea00140, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"fdvsz", 0xeea00160, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"fdvd", 0xeea00180, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"fdvdp", 0xeea001a0, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"fdvdm", 0xeea001c0, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"fdvdz", 0xeea001e0, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"fdve", 0xeea80100, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"fdvep", 0xeea80120, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"fdvem", 0xeea80140, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"fdvez", 0xeea80160, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - - {"frds", 0xeeb00100, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"frdsp", 0xeeb00120, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"frdsm", 0xeeb00140, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"frdsz", 0xeeb00160, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"frdd", 0xeeb00180, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"frddp", 0xeeb001a0, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"frddm", 0xeeb001c0, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"frddz", 0xeeb001e0, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"frde", 0xeeb80100, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"frdep", 0xeeb80120, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"frdem", 0xeeb80140, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"frdez", 0xeeb80160, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - - {"pols", 0xeec00100, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"polsp", 0xeec00120, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"polsm", 0xeec00140, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"polsz", 0xeec00160, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"pold", 0xeec00180, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"poldp", 0xeec001a0, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"poldm", 0xeec001c0, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"poldz", 0xeec001e0, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"pole", 0xeec80100, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"polep", 0xeec80120, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"polem", 0xeec80140, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - {"polez", 0xeec80160, 3, FPU_FPA_EXT_V1, do_fpa_dyadic}, - - {"cmf", 0xee90f110, 3, FPU_FPA_EXT_V1, do_fpa_cmp}, - {"cmfe", 0xeed0f110, 3, FPU_FPA_EXT_V1, do_fpa_cmp}, - {"cnf", 0xeeb0f110, 3, FPU_FPA_EXT_V1, do_fpa_cmp}, - {"cnfe", 0xeef0f110, 3, FPU_FPA_EXT_V1, do_fpa_cmp}, - /* The FPA10 data sheet suggests that the 'E' of cmfe/cnfe should - not be an optional suffix, but part of the instruction. To be - compatible, we accept either. */ - {"cmfe", 0xeed0f110, 4, FPU_FPA_EXT_V1, do_fpa_cmp}, - {"cnfe", 0xeef0f110, 4, FPU_FPA_EXT_V1, do_fpa_cmp}, - - {"flts", 0xee000110, 3, FPU_FPA_EXT_V1, do_fpa_from_reg}, - {"fltsp", 0xee000130, 3, FPU_FPA_EXT_V1, do_fpa_from_reg}, - {"fltsm", 0xee000150, 3, FPU_FPA_EXT_V1, do_fpa_from_reg}, - {"fltsz", 0xee000170, 3, FPU_FPA_EXT_V1, do_fpa_from_reg}, - {"fltd", 0xee000190, 3, FPU_FPA_EXT_V1, do_fpa_from_reg}, - {"fltdp", 0xee0001b0, 3, FPU_FPA_EXT_V1, do_fpa_from_reg}, - {"fltdm", 0xee0001d0, 3, FPU_FPA_EXT_V1, do_fpa_from_reg}, - {"fltdz", 0xee0001f0, 3, FPU_FPA_EXT_V1, do_fpa_from_reg}, - {"flte", 0xee080110, 3, FPU_FPA_EXT_V1, do_fpa_from_reg}, - {"fltep", 0xee080130, 3, FPU_FPA_EXT_V1, do_fpa_from_reg}, - {"fltem", 0xee080150, 3, FPU_FPA_EXT_V1, do_fpa_from_reg}, - {"fltez", 0xee080170, 3, FPU_FPA_EXT_V1, do_fpa_from_reg}, - - /* The implementation of the FIX instruction is broken on some - assemblers, in that it accepts a precision specifier as well as a - rounding specifier, despite the fact that this is meaningless. - To be more compatible, we accept it as well, though of course it - does not set any bits. */ - {"fix", 0xee100110, 3, FPU_FPA_EXT_V1, do_fpa_to_reg}, - {"fixp", 0xee100130, 3, FPU_FPA_EXT_V1, do_fpa_to_reg}, - {"fixm", 0xee100150, 3, FPU_FPA_EXT_V1, do_fpa_to_reg}, - {"fixz", 0xee100170, 3, FPU_FPA_EXT_V1, do_fpa_to_reg}, - {"fixsp", 0xee100130, 3, FPU_FPA_EXT_V1, do_fpa_to_reg}, - {"fixsm", 0xee100150, 3, FPU_FPA_EXT_V1, do_fpa_to_reg}, - {"fixsz", 0xee100170, 3, FPU_FPA_EXT_V1, do_fpa_to_reg}, - {"fixdp", 0xee100130, 3, FPU_FPA_EXT_V1, do_fpa_to_reg}, - {"fixdm", 0xee100150, 3, FPU_FPA_EXT_V1, do_fpa_to_reg}, - {"fixdz", 0xee100170, 3, FPU_FPA_EXT_V1, do_fpa_to_reg}, - {"fixep", 0xee100130, 3, FPU_FPA_EXT_V1, do_fpa_to_reg}, - {"fixem", 0xee100150, 3, FPU_FPA_EXT_V1, do_fpa_to_reg}, - {"fixez", 0xee100170, 3, FPU_FPA_EXT_V1, do_fpa_to_reg}, - - /* Instructions that were new with the real FPA, call them V2. */ - {"lfm", 0xec100200, 3, FPU_FPA_EXT_V2, do_fpa_ldmstm}, - {"lfmfd", 0xec900200, 3, FPU_FPA_EXT_V2, do_fpa_ldmstm}, - {"lfmea", 0xed100200, 3, FPU_FPA_EXT_V2, do_fpa_ldmstm}, - {"sfm", 0xec000200, 3, FPU_FPA_EXT_V2, do_fpa_ldmstm}, - {"sfmfd", 0xed000200, 3, FPU_FPA_EXT_V2, do_fpa_ldmstm}, - {"sfmea", 0xec800200, 3, FPU_FPA_EXT_V2, do_fpa_ldmstm}, - - /* VFP V1xD (single precision). */ - /* Moves and type conversions. */ - {"fcpys", 0xeeb00a40, 5, FPU_VFP_EXT_V1xD, do_vfp_sp_monadic}, - {"fmrs", 0xee100a10, 4, FPU_VFP_EXT_V1xD, do_vfp_reg_from_sp}, - {"fmsr", 0xee000a10, 4, FPU_VFP_EXT_V1xD, do_vfp_sp_from_reg}, - {"fmstat", 0xeef1fa10, 6, FPU_VFP_EXT_V1xD, do_empty}, - {"fsitos", 0xeeb80ac0, 6, FPU_VFP_EXT_V1xD, do_vfp_sp_monadic}, - {"fuitos", 0xeeb80a40, 6, FPU_VFP_EXT_V1xD, do_vfp_sp_monadic}, - {"ftosis", 0xeebd0a40, 6, FPU_VFP_EXT_V1xD, do_vfp_sp_monadic}, - {"ftosizs", 0xeebd0ac0, 7, FPU_VFP_EXT_V1xD, do_vfp_sp_monadic}, - {"ftouis", 0xeebc0a40, 6, FPU_VFP_EXT_V1xD, do_vfp_sp_monadic}, - {"ftouizs", 0xeebc0ac0, 7, FPU_VFP_EXT_V1xD, do_vfp_sp_monadic}, - {"fmrx", 0xeef00a10, 4, FPU_VFP_EXT_V1xD, do_vfp_reg_from_ctrl}, - {"fmxr", 0xeee00a10, 4, FPU_VFP_EXT_V1xD, do_vfp_ctrl_from_reg}, - - /* Memory operations. */ - {"flds", 0xed100a00, 4, FPU_VFP_EXT_V1xD, do_vfp_sp_ldst}, - {"fsts", 0xed000a00, 4, FPU_VFP_EXT_V1xD, do_vfp_sp_ldst}, - {"fldmias", 0xec900a00, 7, FPU_VFP_EXT_V1xD, do_vfp_sp_ldstmia}, - {"fldmfds", 0xec900a00, 7, FPU_VFP_EXT_V1xD, do_vfp_sp_ldstmia}, - {"fldmdbs", 0xed300a00, 7, FPU_VFP_EXT_V1xD, do_vfp_sp_ldstmdb}, - {"fldmeas", 0xed300a00, 7, FPU_VFP_EXT_V1xD, do_vfp_sp_ldstmdb}, - {"fldmiax", 0xec900b00, 7, FPU_VFP_EXT_V1xD, do_vfp_xp_ldstmia}, - {"fldmfdx", 0xec900b00, 7, FPU_VFP_EXT_V1xD, do_vfp_xp_ldstmia}, - {"fldmdbx", 0xed300b00, 7, FPU_VFP_EXT_V1xD, do_vfp_xp_ldstmdb}, - {"fldmeax", 0xed300b00, 7, FPU_VFP_EXT_V1xD, do_vfp_xp_ldstmdb}, - {"fstmias", 0xec800a00, 7, FPU_VFP_EXT_V1xD, do_vfp_sp_ldstmia}, - {"fstmeas", 0xec800a00, 7, FPU_VFP_EXT_V1xD, do_vfp_sp_ldstmia}, - {"fstmdbs", 0xed200a00, 7, FPU_VFP_EXT_V1xD, do_vfp_sp_ldstmdb}, - {"fstmfds", 0xed200a00, 7, FPU_VFP_EXT_V1xD, do_vfp_sp_ldstmdb}, - {"fstmiax", 0xec800b00, 7, FPU_VFP_EXT_V1xD, do_vfp_xp_ldstmia}, - {"fstmeax", 0xec800b00, 7, FPU_VFP_EXT_V1xD, do_vfp_xp_ldstmia}, - {"fstmdbx", 0xed200b00, 7, FPU_VFP_EXT_V1xD, do_vfp_xp_ldstmdb}, - {"fstmfdx", 0xed200b00, 7, FPU_VFP_EXT_V1xD, do_vfp_xp_ldstmdb}, - - /* Monadic operations. */ - {"fabss", 0xeeb00ac0, 5, FPU_VFP_EXT_V1xD, do_vfp_sp_monadic}, - {"fnegs", 0xeeb10a40, 5, FPU_VFP_EXT_V1xD, do_vfp_sp_monadic}, - {"fsqrts", 0xeeb10ac0, 6, FPU_VFP_EXT_V1xD, do_vfp_sp_monadic}, - - /* Dyadic operations. */ - {"fadds", 0xee300a00, 5, FPU_VFP_EXT_V1xD, do_vfp_sp_dyadic}, - {"fsubs", 0xee300a40, 5, FPU_VFP_EXT_V1xD, do_vfp_sp_dyadic}, - {"fmuls", 0xee200a00, 5, FPU_VFP_EXT_V1xD, do_vfp_sp_dyadic}, - {"fdivs", 0xee800a00, 5, FPU_VFP_EXT_V1xD, do_vfp_sp_dyadic}, - {"fmacs", 0xee000a00, 5, FPU_VFP_EXT_V1xD, do_vfp_sp_dyadic}, - {"fmscs", 0xee100a00, 5, FPU_VFP_EXT_V1xD, do_vfp_sp_dyadic}, - {"fnmuls", 0xee200a40, 6, FPU_VFP_EXT_V1xD, do_vfp_sp_dyadic}, - {"fnmacs", 0xee000a40, 6, FPU_VFP_EXT_V1xD, do_vfp_sp_dyadic}, - {"fnmscs", 0xee100a40, 6, FPU_VFP_EXT_V1xD, do_vfp_sp_dyadic}, - - /* Comparisons. */ - {"fcmps", 0xeeb40a40, 5, FPU_VFP_EXT_V1xD, do_vfp_sp_monadic}, - {"fcmpzs", 0xeeb50a40, 6, FPU_VFP_EXT_V1xD, do_vfp_sp_compare_z}, - {"fcmpes", 0xeeb40ac0, 6, FPU_VFP_EXT_V1xD, do_vfp_sp_monadic}, - {"fcmpezs", 0xeeb50ac0, 7, FPU_VFP_EXT_V1xD, do_vfp_sp_compare_z}, - - /* VFP V1 (Double precision). */ - /* Moves and type conversions. */ - {"fcpyd", 0xeeb00b40, 5, FPU_VFP_EXT_V1, do_vfp_dp_monadic}, - {"fcvtds", 0xeeb70ac0, 6, FPU_VFP_EXT_V1, do_vfp_dp_sp_cvt}, - {"fcvtsd", 0xeeb70bc0, 6, FPU_VFP_EXT_V1, do_vfp_sp_dp_cvt}, - {"fmdhr", 0xee200b10, 5, FPU_VFP_EXT_V1, do_vfp_dp_from_reg}, - {"fmdlr", 0xee000b10, 5, FPU_VFP_EXT_V1, do_vfp_dp_from_reg}, - {"fmrdh", 0xee300b10, 5, FPU_VFP_EXT_V1, do_vfp_reg_from_dp}, - {"fmrdl", 0xee100b10, 5, FPU_VFP_EXT_V1, do_vfp_reg_from_dp}, - {"fsitod", 0xeeb80bc0, 6, FPU_VFP_EXT_V1, do_vfp_dp_sp_cvt}, - {"fuitod", 0xeeb80b40, 6, FPU_VFP_EXT_V1, do_vfp_dp_sp_cvt}, - {"ftosid", 0xeebd0b40, 6, FPU_VFP_EXT_V1, do_vfp_sp_dp_cvt}, - {"ftosizd", 0xeebd0bc0, 7, FPU_VFP_EXT_V1, do_vfp_sp_dp_cvt}, - {"ftouid", 0xeebc0b40, 6, FPU_VFP_EXT_V1, do_vfp_sp_dp_cvt}, - {"ftouizd", 0xeebc0bc0, 7, FPU_VFP_EXT_V1, do_vfp_sp_dp_cvt}, - - /* Memory operations. */ - {"fldd", 0xed100b00, 4, FPU_VFP_EXT_V1, do_vfp_dp_ldst}, - {"fstd", 0xed000b00, 4, FPU_VFP_EXT_V1, do_vfp_dp_ldst}, - {"fldmiad", 0xec900b00, 7, FPU_VFP_EXT_V1, do_vfp_dp_ldstmia}, - {"fldmfdd", 0xec900b00, 7, FPU_VFP_EXT_V1, do_vfp_dp_ldstmia}, - {"fldmdbd", 0xed300b00, 7, FPU_VFP_EXT_V1, do_vfp_dp_ldstmdb}, - {"fldmead", 0xed300b00, 7, FPU_VFP_EXT_V1, do_vfp_dp_ldstmdb}, - {"fstmiad", 0xec800b00, 7, FPU_VFP_EXT_V1, do_vfp_dp_ldstmia}, - {"fstmead", 0xec800b00, 7, FPU_VFP_EXT_V1, do_vfp_dp_ldstmia}, - {"fstmdbd", 0xed200b00, 7, FPU_VFP_EXT_V1, do_vfp_dp_ldstmdb}, - {"fstmfdd", 0xed200b00, 7, FPU_VFP_EXT_V1, do_vfp_dp_ldstmdb}, - - /* Monadic operations. */ - {"fabsd", 0xeeb00bc0, 5, FPU_VFP_EXT_V1, do_vfp_dp_monadic}, - {"fnegd", 0xeeb10b40, 5, FPU_VFP_EXT_V1, do_vfp_dp_monadic}, - {"fsqrtd", 0xeeb10bc0, 6, FPU_VFP_EXT_V1, do_vfp_dp_monadic}, - - /* Dyadic operations. */ - {"faddd", 0xee300b00, 5, FPU_VFP_EXT_V1, do_vfp_dp_dyadic}, - {"fsubd", 0xee300b40, 5, FPU_VFP_EXT_V1, do_vfp_dp_dyadic}, - {"fmuld", 0xee200b00, 5, FPU_VFP_EXT_V1, do_vfp_dp_dyadic}, - {"fdivd", 0xee800b00, 5, FPU_VFP_EXT_V1, do_vfp_dp_dyadic}, - {"fmacd", 0xee000b00, 5, FPU_VFP_EXT_V1, do_vfp_dp_dyadic}, - {"fmscd", 0xee100b00, 5, FPU_VFP_EXT_V1, do_vfp_dp_dyadic}, - {"fnmuld", 0xee200b40, 6, FPU_VFP_EXT_V1, do_vfp_dp_dyadic}, - {"fnmacd", 0xee000b40, 6, FPU_VFP_EXT_V1, do_vfp_dp_dyadic}, - {"fnmscd", 0xee100b40, 6, FPU_VFP_EXT_V1, do_vfp_dp_dyadic}, - - /* Comparisons. */ - {"fcmpd", 0xeeb40b40, 5, FPU_VFP_EXT_V1, do_vfp_dp_monadic}, - {"fcmpzd", 0xeeb50b40, 6, FPU_VFP_EXT_V1, do_vfp_dp_compare_z}, - {"fcmped", 0xeeb40bc0, 6, FPU_VFP_EXT_V1, do_vfp_dp_monadic}, - {"fcmpezd", 0xeeb50bc0, 7, FPU_VFP_EXT_V1, do_vfp_dp_compare_z}, - - /* VFP V2. */ - {"fmsrr", 0xec400a10, 5, FPU_VFP_EXT_V2, do_vfp_sp2_from_reg2}, - {"fmrrs", 0xec500a10, 5, FPU_VFP_EXT_V2, do_vfp_reg2_from_sp2}, - {"fmdrr", 0xec400b10, 5, FPU_VFP_EXT_V2, do_vfp_dp_from_reg2}, - {"fmrrd", 0xec500b10, 5, FPU_VFP_EXT_V2, do_vfp_reg2_from_dp}, - - /* Intel XScale extensions to ARM V5 ISA. (All use CP0). */ - {"mia", 0xee200010, 3, ARM_CEXT_XSCALE, do_xsc_mia}, - {"miaph", 0xee280010, 5, ARM_CEXT_XSCALE, do_xsc_mia}, - {"miabb", 0xee2c0010, 5, ARM_CEXT_XSCALE, do_xsc_mia}, - {"miabt", 0xee2d0010, 5, ARM_CEXT_XSCALE, do_xsc_mia}, - {"miatb", 0xee2e0010, 5, ARM_CEXT_XSCALE, do_xsc_mia}, - {"miatt", 0xee2f0010, 5, ARM_CEXT_XSCALE, do_xsc_mia}, - {"mar", 0xec400000, 3, ARM_CEXT_XSCALE, do_xsc_mar}, - {"mra", 0xec500000, 3, ARM_CEXT_XSCALE, do_xsc_mra}, - - /* Intel Wireless MMX technology instructions. */ - {"tandcb", 0xee130130, 6, ARM_CEXT_IWMMXT, do_iwmmxt_tandc}, - {"tandch", 0xee530130, 6, ARM_CEXT_IWMMXT, do_iwmmxt_tandc}, - {"tandcw", 0xee930130, 6, ARM_CEXT_IWMMXT, do_iwmmxt_tandc}, - {"tbcstb", 0xee400010, 6, ARM_CEXT_IWMMXT, do_iwmmxt_tbcst}, - {"tbcsth", 0xee400050, 6, ARM_CEXT_IWMMXT, do_iwmmxt_tbcst}, - {"tbcstw", 0xee400090, 6, ARM_CEXT_IWMMXT, do_iwmmxt_tbcst}, - {"textrcb", 0xee130170, 7, ARM_CEXT_IWMMXT, do_iwmmxt_textrc}, - {"textrch", 0xee530170, 7, ARM_CEXT_IWMMXT, do_iwmmxt_textrc}, - {"textrcw", 0xee930170, 7, ARM_CEXT_IWMMXT, do_iwmmxt_textrc}, - {"textrmub", 0xee100070, 8, ARM_CEXT_IWMMXT, do_iwmmxt_textrm}, - {"textrmuh", 0xee500070, 8, ARM_CEXT_IWMMXT, do_iwmmxt_textrm}, - {"textrmuw", 0xee900070, 8, ARM_CEXT_IWMMXT, do_iwmmxt_textrm}, - {"textrmsb", 0xee100078, 8, ARM_CEXT_IWMMXT, do_iwmmxt_textrm}, - {"textrmsh", 0xee500078, 8, ARM_CEXT_IWMMXT, do_iwmmxt_textrm}, - {"textrmsw", 0xee900078, 8, ARM_CEXT_IWMMXT, do_iwmmxt_textrm}, - {"tinsrb", 0xee600010, 6, ARM_CEXT_IWMMXT, do_iwmmxt_tinsr}, - {"tinsrh", 0xee600050, 6, ARM_CEXT_IWMMXT, do_iwmmxt_tinsr}, - {"tinsrw", 0xee600090, 6, ARM_CEXT_IWMMXT, do_iwmmxt_tinsr}, - {"tmcr", 0xee000110, 4, ARM_CEXT_IWMMXT, do_iwmmxt_tmcr}, - {"tmcrr", 0xec400000, 5, ARM_CEXT_IWMMXT, do_iwmmxt_tmcrr}, - {"tmia", 0xee200010, 4, ARM_CEXT_IWMMXT, do_iwmmxt_tmia}, - {"tmiaph", 0xee280010, 6, ARM_CEXT_IWMMXT, do_iwmmxt_tmia}, - {"tmiabb", 0xee2c0010, 6, ARM_CEXT_IWMMXT, do_iwmmxt_tmia}, - {"tmiabt", 0xee2d0010, 6, ARM_CEXT_IWMMXT, do_iwmmxt_tmia}, - {"tmiatb", 0xee2e0010, 6, ARM_CEXT_IWMMXT, do_iwmmxt_tmia}, - {"tmiatt", 0xee2f0010, 6, ARM_CEXT_IWMMXT, do_iwmmxt_tmia}, - {"tmovmskb", 0xee100030, 8, ARM_CEXT_IWMMXT, do_iwmmxt_tmovmsk}, - {"tmovmskh", 0xee500030, 8, ARM_CEXT_IWMMXT, do_iwmmxt_tmovmsk}, - {"tmovmskw", 0xee900030, 8, ARM_CEXT_IWMMXT, do_iwmmxt_tmovmsk}, - {"tmrc", 0xee100110, 4, ARM_CEXT_IWMMXT, do_iwmmxt_tmrc}, - {"tmrrc", 0xec500000, 5, ARM_CEXT_IWMMXT, do_iwmmxt_tmrrc}, - {"torcb", 0xee130150, 5, ARM_CEXT_IWMMXT, do_iwmmxt_torc}, - {"torch", 0xee530150, 5, ARM_CEXT_IWMMXT, do_iwmmxt_torc}, - {"torcw", 0xee930150, 5, ARM_CEXT_IWMMXT, do_iwmmxt_torc}, - {"waccb", 0xee0001c0, 5, ARM_CEXT_IWMMXT, do_iwmmxt_wrwr}, - {"wacch", 0xee4001c0, 5, ARM_CEXT_IWMMXT, do_iwmmxt_wrwr}, - {"waccw", 0xee8001c0, 5, ARM_CEXT_IWMMXT, do_iwmmxt_wrwr}, - {"waddbss", 0xee300180, 7, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"waddb", 0xee000180, 5, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"waddbus", 0xee100180, 7, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"waddhss", 0xee700180, 7, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"waddh", 0xee400180, 5, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"waddhus", 0xee500180, 7, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"waddwss", 0xeeb00180, 7, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"waddw", 0xee800180, 5, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"waddwus", 0xee900180, 7, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"waligni", 0xee000020, 7, ARM_CEXT_IWMMXT, do_iwmmxt_waligni}, - {"walignr0", 0xee800020, 8, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"walignr1", 0xee900020, 8, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"walignr2", 0xeea00020, 8, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"walignr3", 0xeeb00020, 8, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wand", 0xee200000, 4, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wandn", 0xee300000, 5, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wavg2b", 0xee800000, 6, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wavg2br", 0xee900000, 7, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wavg2h", 0xeec00000, 6, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wavg2hr", 0xeed00000, 7, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wcmpeqb", 0xee000060, 7, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wcmpeqh", 0xee400060, 7, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wcmpeqw", 0xee800060, 7, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wcmpgtub", 0xee100060, 8, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wcmpgtuh", 0xee500060, 8, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wcmpgtuw", 0xee900060, 8, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wcmpgtsb", 0xee300060, 8, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wcmpgtsh", 0xee700060, 8, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wcmpgtsw", 0xeeb00060, 8, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wldrb", 0xec100000, 5, ARM_CEXT_IWMMXT, do_iwmmxt_byte_addr}, - {"wldrh", 0xec100100, 5, ARM_CEXT_IWMMXT, do_iwmmxt_byte_addr}, - {"wldrw", 0xec100200, 5, ARM_CEXT_IWMMXT, do_iwmmxt_word_addr}, - {"wldrd", 0xec100300, 5, ARM_CEXT_IWMMXT, do_iwmmxt_word_addr}, - {"wmacs", 0xee600100, 5, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wmacsz", 0xee700100, 6, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wmacu", 0xee400100, 5, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wmacuz", 0xee500100, 6, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wmadds", 0xeea00100, 6, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wmaddu", 0xee800100, 6, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wmaxsb", 0xee200160, 6, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wmaxsh", 0xee600160, 6, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wmaxsw", 0xeea00160, 6, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wmaxub", 0xee000160, 6, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wmaxuh", 0xee400160, 6, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wmaxuw", 0xee800160, 6, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wminsb", 0xee300160, 6, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wminsh", 0xee700160, 6, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wminsw", 0xeeb00160, 6, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wminub", 0xee100160, 6, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wminuh", 0xee500160, 6, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wminuw", 0xee900160, 6, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wmov", 0xee000000, 4, ARM_CEXT_IWMMXT, do_iwmmxt_wmov}, - {"wmulsm", 0xee300100, 6, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wmulsl", 0xee200100, 6, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wmulum", 0xee100100, 6, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wmulul", 0xee000100, 6, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wor", 0xee000000, 3, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wpackhss", 0xee700080, 8, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wpackhus", 0xee500080, 8, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wpackwss", 0xeeb00080, 8, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wpackwus", 0xee900080, 8, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wpackdss", 0xeef00080, 8, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wpackdus", 0xeed00080, 8, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wrorh", 0xee700040, 5, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wrorhg", 0xee700148, 6, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwcg}, - {"wrorw", 0xeeb00040, 5, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wrorwg", 0xeeb00148, 6, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwcg}, - {"wrord", 0xeef00040, 5, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wrordg", 0xeef00148, 6, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwcg}, - {"wsadb", 0xee000120, 5, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wsadbz", 0xee100120, 6, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wsadh", 0xee400120, 5, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wsadhz", 0xee500120, 6, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wshufh", 0xee0001e0, 6, ARM_CEXT_IWMMXT, do_iwmmxt_wshufh}, - {"wsllh", 0xee500040, 5, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wsllhg", 0xee500148, 6, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwcg}, - {"wsllw", 0xee900040, 5, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wsllwg", 0xee900148, 6, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwcg}, - {"wslld", 0xeed00040, 5, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wslldg", 0xeed00148, 6, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwcg}, - {"wsrah", 0xee400040, 5, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wsrahg", 0xee400148, 6, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwcg}, - {"wsraw", 0xee800040, 5, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wsrawg", 0xee800148, 6, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwcg}, - {"wsrad", 0xeec00040, 5, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wsradg", 0xeec00148, 6, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwcg}, - {"wsrlh", 0xee600040, 5, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wsrlhg", 0xee600148, 6, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwcg}, - {"wsrlw", 0xeea00040, 5, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wsrlwg", 0xeea00148, 6, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwcg}, - {"wsrld", 0xeee00040, 5, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wsrldg", 0xeee00148, 6, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwcg}, - {"wstrb", 0xec000000, 5, ARM_CEXT_IWMMXT, do_iwmmxt_byte_addr}, - {"wstrh", 0xec000100, 5, ARM_CEXT_IWMMXT, do_iwmmxt_byte_addr}, - {"wstrw", 0xec000200, 5, ARM_CEXT_IWMMXT, do_iwmmxt_word_addr}, - {"wstrd", 0xec000300, 5, ARM_CEXT_IWMMXT, do_iwmmxt_word_addr}, - {"wsubbss", 0xee3001a0, 7, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wsubb", 0xee0001a0, 5, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wsubbus", 0xee1001a0, 7, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wsubhss", 0xee7001a0, 7, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wsubh", 0xee4001a0, 5, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wsubhus", 0xee5001a0, 7, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wsubwss", 0xeeb001a0, 7, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wsubw", 0xee8001a0, 5, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wsubwus", 0xee9001a0, 7, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wunpckehub", 0xee0000c0, 10, ARM_CEXT_IWMMXT, do_iwmmxt_wrwr}, - {"wunpckehuh", 0xee4000c0, 10, ARM_CEXT_IWMMXT, do_iwmmxt_wrwr}, - {"wunpckehuw", 0xee8000c0, 10, ARM_CEXT_IWMMXT, do_iwmmxt_wrwr}, - {"wunpckehsb", 0xee2000c0, 10, ARM_CEXT_IWMMXT, do_iwmmxt_wrwr}, - {"wunpckehsh", 0xee6000c0, 10, ARM_CEXT_IWMMXT, do_iwmmxt_wrwr}, - {"wunpckehsw", 0xeea000c0, 10, ARM_CEXT_IWMMXT, do_iwmmxt_wrwr}, - {"wunpckihb", 0xee1000c0, 9, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wunpckihh", 0xee5000c0, 9, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wunpckihw", 0xee9000c0, 9, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wunpckelub", 0xee0000e0, 10, ARM_CEXT_IWMMXT, do_iwmmxt_wrwr}, - {"wunpckeluh", 0xee4000e0, 10, ARM_CEXT_IWMMXT, do_iwmmxt_wrwr}, - {"wunpckeluw", 0xee8000e0, 10, ARM_CEXT_IWMMXT, do_iwmmxt_wrwr}, - {"wunpckelsb", 0xee2000e0, 10, ARM_CEXT_IWMMXT, do_iwmmxt_wrwr}, - {"wunpckelsh", 0xee6000e0, 10, ARM_CEXT_IWMMXT, do_iwmmxt_wrwr}, - {"wunpckelsw", 0xeea000e0, 10, ARM_CEXT_IWMMXT, do_iwmmxt_wrwr}, - {"wunpckilb", 0xee1000e0, 9, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wunpckilh", 0xee5000e0, 9, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wunpckilw", 0xee9000e0, 9, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wxor", 0xee100000, 4, ARM_CEXT_IWMMXT, do_iwmmxt_wrwrwr}, - {"wzero", 0xee300000, 5, ARM_CEXT_IWMMXT, do_iwmmxt_wzero}, - - /* Cirrus Maverick instructions. */ - {"cfldrs", 0xec100400, 6, ARM_CEXT_MAVERICK, do_mav_ldst_1}, - {"cfldrd", 0xec500400, 6, ARM_CEXT_MAVERICK, do_mav_ldst_2}, - {"cfldr32", 0xec100500, 7, ARM_CEXT_MAVERICK, do_mav_ldst_3}, - {"cfldr64", 0xec500500, 7, ARM_CEXT_MAVERICK, do_mav_ldst_4}, - {"cfstrs", 0xec000400, 6, ARM_CEXT_MAVERICK, do_mav_ldst_1}, - {"cfstrd", 0xec400400, 6, ARM_CEXT_MAVERICK, do_mav_ldst_2}, - {"cfstr32", 0xec000500, 7, ARM_CEXT_MAVERICK, do_mav_ldst_3}, - {"cfstr64", 0xec400500, 7, ARM_CEXT_MAVERICK, do_mav_ldst_4}, - {"cfmvsr", 0xee000450, 6, ARM_CEXT_MAVERICK, do_mav_binops_2a}, - {"cfmvrs", 0xee100450, 6, ARM_CEXT_MAVERICK, do_mav_binops_1a}, - {"cfmvdlr", 0xee000410, 7, ARM_CEXT_MAVERICK, do_mav_binops_2b}, - {"cfmvrdl", 0xee100410, 7, ARM_CEXT_MAVERICK, do_mav_binops_1b}, - {"cfmvdhr", 0xee000430, 7, ARM_CEXT_MAVERICK, do_mav_binops_2b}, - {"cfmvrdh", 0xee100430, 7, ARM_CEXT_MAVERICK, do_mav_binops_1b}, - {"cfmv64lr", 0xee000510, 8, ARM_CEXT_MAVERICK, do_mav_binops_2c}, - {"cfmvr64l", 0xee100510, 8, ARM_CEXT_MAVERICK, do_mav_binops_1c}, - {"cfmv64hr", 0xee000530, 8, ARM_CEXT_MAVERICK, do_mav_binops_2c}, - {"cfmvr64h", 0xee100530, 8, ARM_CEXT_MAVERICK, do_mav_binops_1c}, - {"cfmval32", 0xee200440, 8, ARM_CEXT_MAVERICK, do_mav_binops_3a}, - {"cfmv32al", 0xee100440, 8, ARM_CEXT_MAVERICK, do_mav_binops_3b}, - {"cfmvam32", 0xee200460, 8, ARM_CEXT_MAVERICK, do_mav_binops_3a}, - {"cfmv32am", 0xee100460, 8, ARM_CEXT_MAVERICK, do_mav_binops_3b}, - {"cfmvah32", 0xee200480, 8, ARM_CEXT_MAVERICK, do_mav_binops_3a}, - {"cfmv32ah", 0xee100480, 8, ARM_CEXT_MAVERICK, do_mav_binops_3b}, - {"cfmva32", 0xee2004a0, 7, ARM_CEXT_MAVERICK, do_mav_binops_3a}, - {"cfmv32a", 0xee1004a0, 7, ARM_CEXT_MAVERICK, do_mav_binops_3b}, - {"cfmva64", 0xee2004c0, 7, ARM_CEXT_MAVERICK, do_mav_binops_3c}, - {"cfmv64a", 0xee1004c0, 7, ARM_CEXT_MAVERICK, do_mav_binops_3d}, - {"cfmvsc32", 0xee2004e0, 8, ARM_CEXT_MAVERICK, do_mav_dspsc_1}, - {"cfmv32sc", 0xee1004e0, 8, ARM_CEXT_MAVERICK, do_mav_dspsc_2}, - {"cfcpys", 0xee000400, 6, ARM_CEXT_MAVERICK, do_mav_binops_1d}, - {"cfcpyd", 0xee000420, 6, ARM_CEXT_MAVERICK, do_mav_binops_1e}, - {"cfcvtsd", 0xee000460, 7, ARM_CEXT_MAVERICK, do_mav_binops_1f}, - {"cfcvtds", 0xee000440, 7, ARM_CEXT_MAVERICK, do_mav_binops_1g}, - {"cfcvt32s", 0xee000480, 8, ARM_CEXT_MAVERICK, do_mav_binops_1h}, - {"cfcvt32d", 0xee0004a0, 8, ARM_CEXT_MAVERICK, do_mav_binops_1i}, - {"cfcvt64s", 0xee0004c0, 8, ARM_CEXT_MAVERICK, do_mav_binops_1j}, - {"cfcvt64d", 0xee0004e0, 8, ARM_CEXT_MAVERICK, do_mav_binops_1k}, - {"cfcvts32", 0xee100580, 8, ARM_CEXT_MAVERICK, do_mav_binops_1l}, - {"cfcvtd32", 0xee1005a0, 8, ARM_CEXT_MAVERICK, do_mav_binops_1m}, - {"cftruncs32", 0xee1005c0, 10, ARM_CEXT_MAVERICK, do_mav_binops_1l}, - {"cftruncd32", 0xee1005e0, 10, ARM_CEXT_MAVERICK, do_mav_binops_1m}, - {"cfrshl32", 0xee000550, 8, ARM_CEXT_MAVERICK, do_mav_triple_4a}, - {"cfrshl64", 0xee000570, 8, ARM_CEXT_MAVERICK, do_mav_triple_4b}, - {"cfsh32", 0xee000500, 6, ARM_CEXT_MAVERICK, do_mav_shift_1}, - {"cfsh64", 0xee200500, 6, ARM_CEXT_MAVERICK, do_mav_shift_2}, - {"cfcmps", 0xee100490, 6, ARM_CEXT_MAVERICK, do_mav_triple_5a}, - {"cfcmpd", 0xee1004b0, 6, ARM_CEXT_MAVERICK, do_mav_triple_5b}, - {"cfcmp32", 0xee100590, 7, ARM_CEXT_MAVERICK, do_mav_triple_5c}, - {"cfcmp64", 0xee1005b0, 7, ARM_CEXT_MAVERICK, do_mav_triple_5d}, - {"cfabss", 0xee300400, 6, ARM_CEXT_MAVERICK, do_mav_binops_1d}, - {"cfabsd", 0xee300420, 6, ARM_CEXT_MAVERICK, do_mav_binops_1e}, - {"cfnegs", 0xee300440, 6, ARM_CEXT_MAVERICK, do_mav_binops_1d}, - {"cfnegd", 0xee300460, 6, ARM_CEXT_MAVERICK, do_mav_binops_1e}, - {"cfadds", 0xee300480, 6, ARM_CEXT_MAVERICK, do_mav_triple_5e}, - {"cfaddd", 0xee3004a0, 6, ARM_CEXT_MAVERICK, do_mav_triple_5f}, - {"cfsubs", 0xee3004c0, 6, ARM_CEXT_MAVERICK, do_mav_triple_5e}, - {"cfsubd", 0xee3004e0, 6, ARM_CEXT_MAVERICK, do_mav_triple_5f}, - {"cfmuls", 0xee100400, 6, ARM_CEXT_MAVERICK, do_mav_triple_5e}, - {"cfmuld", 0xee100420, 6, ARM_CEXT_MAVERICK, do_mav_triple_5f}, - {"cfabs32", 0xee300500, 7, ARM_CEXT_MAVERICK, do_mav_binops_1n}, - {"cfabs64", 0xee300520, 7, ARM_CEXT_MAVERICK, do_mav_binops_1o}, - {"cfneg32", 0xee300540, 7, ARM_CEXT_MAVERICK, do_mav_binops_1n}, - {"cfneg64", 0xee300560, 7, ARM_CEXT_MAVERICK, do_mav_binops_1o}, - {"cfadd32", 0xee300580, 7, ARM_CEXT_MAVERICK, do_mav_triple_5g}, - {"cfadd64", 0xee3005a0, 7, ARM_CEXT_MAVERICK, do_mav_triple_5h}, - {"cfsub32", 0xee3005c0, 7, ARM_CEXT_MAVERICK, do_mav_triple_5g}, - {"cfsub64", 0xee3005e0, 7, ARM_CEXT_MAVERICK, do_mav_triple_5h}, - {"cfmul32", 0xee100500, 7, ARM_CEXT_MAVERICK, do_mav_triple_5g}, - {"cfmul64", 0xee100520, 7, ARM_CEXT_MAVERICK, do_mav_triple_5h}, - {"cfmac32", 0xee100540, 7, ARM_CEXT_MAVERICK, do_mav_triple_5g}, - {"cfmsc32", 0xee100560, 7, ARM_CEXT_MAVERICK, do_mav_triple_5g}, - {"cfmadd32", 0xee000600, 8, ARM_CEXT_MAVERICK, do_mav_quad_6a}, - {"cfmsub32", 0xee100600, 8, ARM_CEXT_MAVERICK, do_mav_quad_6a}, - {"cfmadda32", 0xee200600, 9, ARM_CEXT_MAVERICK, do_mav_quad_6b}, - {"cfmsuba32", 0xee300600, 9, ARM_CEXT_MAVERICK, do_mav_quad_6b}, + /* Function to call to encode instruction in Thumb format. */ + void (* tencode) (void); }; /* Defines for various bits that we will want to toggle. */ #define INST_IMMEDIATE 0x02000000 #define OFFSET_REG 0x02000000 -#define HWOFFSET_IMM 0x00400000 +#define HWOFFSET_IMM 0x00400000 #define SHIFT_BY_REG 0x00000010 #define PRE_INDEX 0x01000000 #define INDEX_UP 0x00800000 @@ -2253,6 +472,9 @@ static const struct asm_opcode insns[] = #define DATA_OP_SHIFT 21 +#define T2_OPCODE_MASK 0xfe1fffff +#define T2_DATA_OP_SHIFT 21 + /* Codes to distinguish the arithmetic instructions. */ #define OPCODE_AND 0 #define OPCODE_EOR 1 @@ -2271,40 +493,16 @@ static const struct asm_opcode insns[] = #define OPCODE_BIC 14 #define OPCODE_MVN 15 -/* Thumb v1 (ARMv4T). */ -static void do_t_nop PARAMS ((char *)); -static void do_t_arit PARAMS ((char *)); -static void do_t_add PARAMS ((char *)); -static void do_t_asr PARAMS ((char *)); -static void do_t_branch9 PARAMS ((char *)); -static void do_t_branch12 PARAMS ((char *)); -static void do_t_branch23 PARAMS ((char *)); -static void do_t_bx PARAMS ((char *)); -static void do_t_compare PARAMS ((char *)); -static void do_t_ldmstm PARAMS ((char *)); -static void do_t_ldr PARAMS ((char *)); -static void do_t_ldrb PARAMS ((char *)); -static void do_t_ldrh PARAMS ((char *)); -static void do_t_lds PARAMS ((char *)); -static void do_t_lsl PARAMS ((char *)); -static void do_t_lsr PARAMS ((char *)); -static void do_t_mov PARAMS ((char *)); -static void do_t_push_pop PARAMS ((char *)); -static void do_t_str PARAMS ((char *)); -static void do_t_strb PARAMS ((char *)); -static void do_t_strh PARAMS ((char *)); -static void do_t_sub PARAMS ((char *)); -static void do_t_swi PARAMS ((char *)); -static void do_t_adr PARAMS ((char *)); - -/* Thumb v2 (ARMv5T). */ -static void do_t_blx PARAMS ((char *)); -static void do_t_bkpt PARAMS ((char *)); - -/* ARM V6. */ -static void do_t_cps PARAMS ((char *)); -static void do_t_cpy PARAMS ((char *)); -static void do_t_setend PARAMS ((char *));; +#define T2_OPCODE_AND 0 +#define T2_OPCODE_BIC 1 +#define T2_OPCODE_ORR 2 +#define T2_OPCODE_ORN 3 +#define T2_OPCODE_EOR 4 +#define T2_OPCODE_ADD 8 +#define T2_OPCODE_ADC 10 +#define T2_OPCODE_SBC 11 +#define T2_OPCODE_SUB 13 +#define T2_OPCODE_RSB 14 #define T_OPCODE_MUL 0x4340 #define T_OPCODE_TST 0x4200 @@ -2326,7 +524,8 @@ static void do_t_setend PARAMS ((char *));; #define T_OPCODE_ASR_R 0x4100 #define T_OPCODE_LSL_R 0x4080 -#define T_OPCODE_LSR_R 0x40c0 +#define T_OPCODE_LSR_R 0x40c0 +#define T_OPCODE_ROR_R 0x41c0 #define T_OPCODE_ASR_I 0x1000 #define T_OPCODE_LSL_I 0x0000 #define T_OPCODE_LSR_I 0x0800 @@ -2356,206 +555,31 @@ static void do_t_setend PARAMS ((char *));; #define T_OPCODE_PUSH 0xb400 #define T_OPCODE_POP 0xbc00 -#define T_OPCODE_BRANCH 0xe7fe - -static int thumb_reg PARAMS ((char ** str, int hi_lo)); +#define T_OPCODE_BRANCH 0xe000 #define THUMB_SIZE 2 /* Size of thumb instruction. */ -#define THUMB_REG_LO 0x1 -#define THUMB_REG_HI 0x2 -#define THUMB_REG_ANY 0x3 - -#define THUMB_H1 0x0080 -#define THUMB_H2 0x0040 - -#define THUMB_ASR 0 -#define THUMB_LSL 1 -#define THUMB_LSR 2 - -#define THUMB_MOVE 0 -#define THUMB_COMPARE 1 -#define THUMB_CPY 2 - -#define THUMB_LOAD 0 -#define THUMB_STORE 1 - #define THUMB_PP_PC_LR 0x0100 +#define THUMB_LOAD_BIT 0x0800 +#define THUMB2_LOAD_BIT 0x00100000 -/* These three are used for immediate shifts, do not alter. */ -#define THUMB_WORD 2 -#define THUMB_HALFWORD 1 -#define THUMB_BYTE 0 +#define BAD_ARGS _("bad arguments to instruction") +#define BAD_PC _("r15 not allowed here") +#define BAD_COND _("instruction cannot be conditional") +#define BAD_OVERLAP _("registers may not be the same") +#define BAD_HIREG _("lo register required") +#define BAD_THUMB32 _("instruction not supported in Thumb16 mode") +#define BAD_ADDR_MODE _("instruction does not accept this addressing mode"); +#define BAD_BRANCH _("branch must be last instruction in IT block") +#define BAD_NOT_IT _("instruction not allowed in IT block") -struct thumb_opcode -{ - /* Basic string to match. */ - const char * template; - - /* Basic instruction code. */ - unsigned long value; - - int size; - - /* Which CPU variants this exists for. */ - unsigned long variant; - - /* Function to call to parse args. */ - void (* parms) PARAMS ((char *)); -}; - -static const struct thumb_opcode tinsns[] = -{ - /* Thumb v1 (ARMv4T). */ - {"adc", 0x4140, 2, ARM_EXT_V4T, do_t_arit}, - {"add", 0x0000, 2, ARM_EXT_V4T, do_t_add}, - {"and", 0x4000, 2, ARM_EXT_V4T, do_t_arit}, - {"asr", 0x0000, 2, ARM_EXT_V4T, do_t_asr}, - {"b", T_OPCODE_BRANCH, 2, ARM_EXT_V4T, do_t_branch12}, - {"beq", 0xd0fe, 2, ARM_EXT_V4T, do_t_branch9}, - {"bne", 0xd1fe, 2, ARM_EXT_V4T, do_t_branch9}, - {"bcs", 0xd2fe, 2, ARM_EXT_V4T, do_t_branch9}, - {"bhs", 0xd2fe, 2, ARM_EXT_V4T, do_t_branch9}, - {"bcc", 0xd3fe, 2, ARM_EXT_V4T, do_t_branch9}, - {"bul", 0xd3fe, 2, ARM_EXT_V4T, do_t_branch9}, - {"blo", 0xd3fe, 2, ARM_EXT_V4T, do_t_branch9}, - {"bmi", 0xd4fe, 2, ARM_EXT_V4T, do_t_branch9}, - {"bpl", 0xd5fe, 2, ARM_EXT_V4T, do_t_branch9}, - {"bvs", 0xd6fe, 2, ARM_EXT_V4T, do_t_branch9}, - {"bvc", 0xd7fe, 2, ARM_EXT_V4T, do_t_branch9}, - {"bhi", 0xd8fe, 2, ARM_EXT_V4T, do_t_branch9}, - {"bls", 0xd9fe, 2, ARM_EXT_V4T, do_t_branch9}, - {"bge", 0xdafe, 2, ARM_EXT_V4T, do_t_branch9}, - {"blt", 0xdbfe, 2, ARM_EXT_V4T, do_t_branch9}, - {"bgt", 0xdcfe, 2, ARM_EXT_V4T, do_t_branch9}, - {"ble", 0xddfe, 2, ARM_EXT_V4T, do_t_branch9}, - {"bal", 0xdefe, 2, ARM_EXT_V4T, do_t_branch9}, - {"bic", 0x4380, 2, ARM_EXT_V4T, do_t_arit}, - {"bl", 0xf7fffffe, 4, ARM_EXT_V4T, do_t_branch23}, - {"bx", 0x4700, 2, ARM_EXT_V4T, do_t_bx}, - {"cmn", T_OPCODE_CMN, 2, ARM_EXT_V4T, do_t_arit}, - {"cmp", 0x0000, 2, ARM_EXT_V4T, do_t_compare}, - {"eor", 0x4040, 2, ARM_EXT_V4T, do_t_arit}, - {"ldmia", 0xc800, 2, ARM_EXT_V4T, do_t_ldmstm}, - {"ldr", 0x0000, 2, ARM_EXT_V4T, do_t_ldr}, - {"ldrb", 0x0000, 2, ARM_EXT_V4T, do_t_ldrb}, - {"ldrh", 0x0000, 2, ARM_EXT_V4T, do_t_ldrh}, - {"ldrsb", 0x5600, 2, ARM_EXT_V4T, do_t_lds}, - {"ldrsh", 0x5e00, 2, ARM_EXT_V4T, do_t_lds}, - {"ldsb", 0x5600, 2, ARM_EXT_V4T, do_t_lds}, - {"ldsh", 0x5e00, 2, ARM_EXT_V4T, do_t_lds}, - {"lsl", 0x0000, 2, ARM_EXT_V4T, do_t_lsl}, - {"lsr", 0x0000, 2, ARM_EXT_V4T, do_t_lsr}, - {"mov", 0x0000, 2, ARM_EXT_V4T, do_t_mov}, - {"mul", T_OPCODE_MUL, 2, ARM_EXT_V4T, do_t_arit}, - {"mvn", T_OPCODE_MVN, 2, ARM_EXT_V4T, do_t_arit}, - {"neg", T_OPCODE_NEG, 2, ARM_EXT_V4T, do_t_arit}, - {"orr", 0x4300, 2, ARM_EXT_V4T, do_t_arit}, - {"pop", 0xbc00, 2, ARM_EXT_V4T, do_t_push_pop}, - {"push", 0xb400, 2, ARM_EXT_V4T, do_t_push_pop}, - {"ror", 0x41c0, 2, ARM_EXT_V4T, do_t_arit}, - {"sbc", 0x4180, 2, ARM_EXT_V4T, do_t_arit}, - {"stmia", 0xc000, 2, ARM_EXT_V4T, do_t_ldmstm}, - {"str", 0x0000, 2, ARM_EXT_V4T, do_t_str}, - {"strb", 0x0000, 2, ARM_EXT_V4T, do_t_strb}, - {"strh", 0x0000, 2, ARM_EXT_V4T, do_t_strh}, - {"swi", 0xdf00, 2, ARM_EXT_V4T, do_t_swi}, - {"sub", 0x0000, 2, ARM_EXT_V4T, do_t_sub}, - {"tst", T_OPCODE_TST, 2, ARM_EXT_V4T, do_t_arit}, - /* Pseudo ops: */ - {"adr", 0x0000, 2, ARM_EXT_V4T, do_t_adr}, - {"nop", 0x46C0, 2, ARM_EXT_V4T, do_t_nop}, /* mov r8,r8 */ - /* Thumb v2 (ARMv5T). */ - {"blx", 0, 0, ARM_EXT_V5T, do_t_blx}, - {"bkpt", 0xbe00, 2, ARM_EXT_V5T, do_t_bkpt}, - - /* ARM V6. */ - {"cpsie", 0xb660, 2, ARM_EXT_V6, do_t_cps}, - {"cpsid", 0xb670, 2, ARM_EXT_V6, do_t_cps}, - {"cpy", 0x4600, 2, ARM_EXT_V6, do_t_cpy}, - {"rev", 0xba00, 2, ARM_EXT_V6, do_t_arit}, - {"rev16", 0xba40, 2, ARM_EXT_V6, do_t_arit}, - {"revsh", 0xbac0, 2, ARM_EXT_V6, do_t_arit}, - {"setend", 0xb650, 2, ARM_EXT_V6, do_t_setend}, - {"sxth", 0xb200, 2, ARM_EXT_V6, do_t_arit}, - {"sxtb", 0xb240, 2, ARM_EXT_V6, do_t_arit}, - {"uxth", 0xb280, 2, ARM_EXT_V6, do_t_arit}, - {"uxtb", 0xb2c0, 2, ARM_EXT_V6, do_t_arit}, -}; - -#define BAD_ARGS _("bad arguments to instruction") -#define BAD_PC _("r15 not allowed here") -#define BAD_COND _("instruction is not conditional") -#define ERR_NO_ACCUM _("acc0 expected") - -static struct hash_control * arm_ops_hsh = NULL; -static struct hash_control * arm_tops_hsh = NULL; -static struct hash_control * arm_cond_hsh = NULL; -static struct hash_control * arm_shift_hsh = NULL; -static struct hash_control * arm_psr_hsh = NULL; - -/* 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. */ - -static void s_req PARAMS ((int)); -static void s_unreq PARAMS ((int)); -static void s_align PARAMS ((int)); -static void s_bss PARAMS ((int)); -static void s_even PARAMS ((int)); -static void s_ltorg PARAMS ((int)); -static void s_arm PARAMS ((int)); -static void s_thumb PARAMS ((int)); -static void s_code PARAMS ((int)); -static void s_force_thumb PARAMS ((int)); -static void s_thumb_func PARAMS ((int)); -static void s_thumb_set PARAMS ((int)); -#ifdef OBJ_ELF -static void s_arm_elf_cons PARAMS ((int)); -#endif - -static int my_get_expression PARAMS ((expressionS *, char **)); - -const pseudo_typeS md_pseudo_table[] = -{ - /* Never called because '.req' does not start a line. */ - { "req", s_req, 0 }, - { "unreq", s_unreq, 0 }, - { "bss", s_bss, 0 }, - { "align", s_align, 0 }, - { "arm", s_arm, 0 }, - { "thumb", s_thumb, 0 }, - { "code", s_code, 0 }, - { "force_thumb", s_force_thumb, 0 }, - { "thumb_func", s_thumb_func, 0 }, - { "thumb_set", s_thumb_set, 0 }, - { "even", s_even, 0 }, - { "ltorg", s_ltorg, 0 }, - { "pool", s_ltorg, 0 }, -#ifdef OBJ_ELF - { "word", s_arm_elf_cons, 4 }, - { "long", s_arm_elf_cons, 4 }, -#else - { "word", cons, 4}, -#endif - { "extend", float_cons, 'x' }, - { "ldouble", float_cons, 'x' }, - { "packed", float_cons, 'p' }, - { 0, 0, 0 } -}; - -/* Other internal functions. */ -static int arm_parse_extension PARAMS ((char *, int *)); -static int arm_parse_cpu PARAMS ((char *)); -static int arm_parse_arch PARAMS ((char *)); -static int arm_parse_fpu PARAMS ((char *)); -static int arm_parse_float_abi PARAMS ((char *)); -#if 0 /* Suppressed - for now. */ -#if defined OBJ_COFF || defined OBJ_ELF -static void arm_add_note PARAMS ((const char *, const char *, unsigned int)); -#endif -#endif +static struct hash_control *arm_ops_hsh; +static struct hash_control *arm_cond_hsh; +static struct hash_control *arm_shift_hsh; +static struct hash_control *arm_psr_hsh; +static struct hash_control *arm_v7m_psr_hsh; +static struct hash_control *arm_reg_hsh; +static struct hash_control *arm_reloc_hsh; +static struct hash_control *arm_barrier_opt_hsh; /* Stuff needed to resolve the label ambiguity As: @@ -2564,4240 +588,89 @@ static void arm_add_note PARAMS ((const char *, const char *, unsigned int)); may differ from: ... label: - + */ symbolS * last_label_seen; static int label_is_thumb_function_name = FALSE; - -/* Literal Pool stuff. */ - -#define MAX_LITERAL_POOL_SIZE 1024 - + /* Literal pool structure. Held on a per-section and per-sub-section basis. */ + +#define MAX_LITERAL_POOL_SIZE 1024 typedef struct literal_pool { - expressionS literals [MAX_LITERAL_POOL_SIZE]; - unsigned int next_free_entry; - unsigned int id; - symbolS * symbol; - segT section; - subsegT sub_section; + expressionS literals [MAX_LITERAL_POOL_SIZE]; + unsigned int next_free_entry; + unsigned int id; + symbolS * symbol; + segT section; + subsegT sub_section; struct literal_pool * next; } literal_pool; /* Pointer to a linked list of literal pools. */ literal_pool * list_of_pools = NULL; -static literal_pool * find_literal_pool PARAMS ((void)); -static literal_pool * find_or_make_literal_pool PARAMS ((void)); - -static literal_pool * -find_literal_pool () -{ - literal_pool * pool; - - for (pool = list_of_pools; pool != NULL; pool = pool->next) - { - if (pool->section == now_seg - && pool->sub_section == now_subseg) - break; - } - - return pool; -} - -static literal_pool * -find_or_make_literal_pool () -{ - /* Next literal pool ID number. */ - static unsigned int latest_pool_num = 1; - literal_pool * pool; - - pool = find_literal_pool (); - - if (pool == NULL) - { - /* Create a new pool. */ - pool = (literal_pool *) xmalloc (sizeof (* pool)); - if (! pool) - return NULL; - - pool->next_free_entry = 0; - pool->section = now_seg; - pool->sub_section = now_subseg; - pool->next = list_of_pools; - pool->symbol = NULL; - - /* Add it to the list. */ - list_of_pools = pool; - } - - /* New pools, and emptied pools, will have a NULL symbol. */ - if (pool->symbol == NULL) - { - pool->symbol = symbol_create (FAKE_LABEL_NAME, undefined_section, - (valueT) 0, &zero_address_frag); - pool->id = latest_pool_num ++; - } - - /* Done. */ - return pool; -} - -/* Add the literal in the global 'inst' - structure to the relevent literal pool. */ -static int -add_to_lit_pool () -{ - literal_pool * pool; - unsigned int entry; - - pool = find_or_make_literal_pool (); - - /* Check if this literal value is already in the pool. */ - for (entry = 0; entry < pool->next_free_entry; entry ++) - { - if ((pool->literals[entry].X_op == inst.reloc.exp.X_op) - && (inst.reloc.exp.X_op == O_constant) - && (pool->literals[entry].X_add_number - == inst.reloc.exp.X_add_number) - && (pool->literals[entry].X_unsigned - == inst.reloc.exp.X_unsigned)) - break; - - if ((pool->literals[entry].X_op == inst.reloc.exp.X_op) - && (inst.reloc.exp.X_op == O_symbol) - && (pool->literals[entry].X_add_number - == inst.reloc.exp.X_add_number) - && (pool->literals[entry].X_add_symbol - == inst.reloc.exp.X_add_symbol) - && (pool->literals[entry].X_op_symbol - == inst.reloc.exp.X_op_symbol)) - break; - } - - /* Do we need to create a new entry? */ - if (entry == pool->next_free_entry) - { - if (entry >= MAX_LITERAL_POOL_SIZE) - { - inst.error = _("literal pool overflow"); - return FAIL; - } - - pool->literals[entry] = inst.reloc.exp; - pool->next_free_entry += 1; - } - - inst.reloc.exp.X_op = O_symbol; - inst.reloc.exp.X_add_number = ((int) entry) * 4 - 8; - inst.reloc.exp.X_add_symbol = pool->symbol; - - return SUCCESS; -} - -/* Can't use symbol_new here, so have to create a symbol and then at - a later date assign it a value. Thats what these functions do. */ - -static void -symbol_locate (symbolP, name, segment, valu, frag) - symbolS * symbolP; - const char * name; /* It is copied, the caller can modify. */ - segT segment; /* Segment identifier (SEG_). */ - valueT valu; /* Symbol value. */ - fragS * frag; /* Associated fragment. */ -{ - unsigned int name_length; - char * preserved_copy_of_name; - - name_length = strlen (name) + 1; /* +1 for \0. */ - obstack_grow (¬es, name, name_length); - preserved_copy_of_name = obstack_finish (¬es); -#ifdef STRIP_UNDERSCORE - if (preserved_copy_of_name[0] == '_') - preserved_copy_of_name++; -#endif - -#ifdef tc_canonicalize_symbol_name - preserved_copy_of_name = - tc_canonicalize_symbol_name (preserved_copy_of_name); -#endif - - S_SET_NAME (symbolP, preserved_copy_of_name); - - S_SET_SEGMENT (symbolP, segment); - S_SET_VALUE (symbolP, valu); - symbol_clear_list_pointers (symbolP); - - symbol_set_frag (symbolP, frag); - - /* Link to end of symbol chain. */ - { - extern int symbol_table_frozen; - if (symbol_table_frozen) - abort (); - } - - symbol_append (symbolP, symbol_lastP, & symbol_rootP, & symbol_lastP); - - obj_symbol_new_hook (symbolP); - -#ifdef tc_symbol_new_hook - tc_symbol_new_hook (symbolP); -#endif - -#ifdef DEBUG_SYMS - verify_symbol_chain (symbol_rootP, symbol_lastP); -#endif /* DEBUG_SYMS */ -} - -/* Check that an immediate is valid. - If so, convert it to the right format. */ - -static unsigned int -validate_immediate (val) - unsigned int val; -{ - unsigned int a; - unsigned int i; - -#define rotate_left(v, n) (v << n | v >> (32 - n)) - - for (i = 0; i < 32; i += 2) - if ((a = rotate_left (val, i)) <= 0xff) - return a | (i << 7); /* 12-bit pack: [shift-cnt,const]. */ - - return FAIL; -} - -/* Check to see if an immediate can be computed as two separate immediate - values, added together. We already know that this value cannot be - computed by just one ARM instruction. */ - -static unsigned int -validate_immediate_twopart (val, highpart) - unsigned int val; - unsigned int * highpart; -{ - unsigned int a; - unsigned int i; - - for (i = 0; i < 32; i += 2) - if (((a = rotate_left (val, i)) & 0xff) != 0) - { - if (a & 0xff00) - { - if (a & ~ 0xffff) - continue; - * highpart = (a >> 8) | ((i + 24) << 7); - } - else if (a & 0xff0000) - { - if (a & 0xff000000) - continue; - * highpart = (a >> 16) | ((i + 16) << 7); - } - else - { - assert (a & 0xff000000); - * highpart = (a >> 24) | ((i + 8) << 7); - } - - return (a & 0xff) | (i << 7); - } - - return FAIL; -} - -static int -validate_offset_imm (val, hwse) - unsigned int val; - int hwse; -{ - if ((hwse && val > 255) || val > 4095) - return FAIL; - return val; -} +/* State variables for IT block handling. */ +static bfd_boolean current_it_mask = 0; +static int current_cc; -#ifdef OBJ_ELF -/* This code is to handle mapping symbols as defined in the ARM ELF spec. - (This text is taken from version B-02 of the spec): +/* Pure syntax. */ - 4.4.7 Mapping and tagging symbols +/* 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[] = "@"; - A section of an ARM ELF file can contain a mixture of ARM code, - Thumb code, and data. There are inline transitions between code - and data at literal pool boundaries. There can also be inline - transitions between ARM code and Thumb code, for example in - ARM-Thumb inter-working veneers. Linkers, machine-level - debuggers, profiling tools, and disassembly tools need to map - images accurately. For example, setting an ARM breakpoint on a - Thumb location, or in a literal pool, can crash the program - being debugged, ruining the debugging session. +/* 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 like this one will always work. */ +const char line_comment_chars[] = "#"; - ARM ELF entities are mapped (see section 4.4.7.1 below) and - tagged (see section 4.4.7.2 below) using local symbols (with - binding STB_LOCAL). To assist consumers, mapping and tagging - symbols should be collated first in the symbol table, before - other symbols with binding STB_LOCAL. +const char line_separator_chars[] = ";"; - To allow properly collated mapping and tagging symbols to be - skipped by consumers that have no interest in them, the first - such symbol should have the name $m and its st_value field equal - to the total number of mapping and tagging symbols (including - the $m) in the symbol table. +/* Chars that can be used to separate mant + from exp in floating point numbers. */ +const char EXP_CHARS[] = "eE"; - 4.4.7.1 Mapping symbols +/* Chars that mean this number is a floating point constant. */ +/* As in 0f12.456 */ +/* or 0d1.2345e12 */ - $a Labels the first byte of a sequence of ARM instructions. - Its type is STT_FUNC. +const char FLT_CHARS[] = "rRsSfFdDxXeEpP"; - $d Labels the first byte of a sequence of data items. - Its type is STT_OBJECT. +/* Prefix characters that indicate the start of an immediate + value. */ +#define is_immediate_prefix(C) ((C) == '#' || (C) == '$') - $t Labels the first byte of a sequence of Thumb instructions. - Its type is STT_FUNC. +/* Separator character handling. */ - This list of mapping symbols may be extended in the future. +#define skip_whitespace(str) do { if (*(str) == ' ') ++(str); } while (0) - Section-relative mapping symbols - - Mapping symbols defined in a section define a sequence of - half-open address intervals that cover the address range of the - section. Each interval starts at the address defined by a - mapping symbol, and continues up to, but not including, the - address defined by the next (in address order) mapping symbol or - the end of the section. A corollary is that there must be a - mapping symbol defined at the beginning of each section. - Consumers can ignore the size of a section-relative mapping - symbol. Producers can set it to 0. - - Absolute mapping symbols - - Because of the need to crystallize a Thumb address with the - Thumb-bit set, absolute symbol of type STT_FUNC (symbols of type - STT_FUNC defined in section SHN_ABS) need to be mapped with $a - or $t. - - The extent of a mapping symbol defined in SHN_ABS is [st_value, - st_value + st_size), or [st_value, st_value + 1) if st_size = 0, - where [x, y) denotes the half-open address range from x, - inclusive, to y, exclusive. - - In the absence of a mapping symbol, a consumer can interpret a - function symbol with an odd value as the Thumb code address - obtained by clearing the least significant bit of the - value. This interpretation is deprecated, and it may not work in - the future. - - Note - the Tagging symbols ($b, $f, $p $m) have been dropped from - the EABI (which is still under development), so they are not - implemented here. */ - -static enum mstate mapstate = MAP_UNDEFINED; - -static void -mapping_state (enum mstate state) +static inline int +skip_past_char (char ** str, char c) { - symbolS * symbolP; - const char * symname; - int type; - - if (mapstate == state) - /* The mapping symbol has already been emitted. - There is nothing else to do. */ - return; - - mapstate = state; - - switch (state) + if (**str == c) { - case MAP_DATA: - symname = "$d"; - type = BSF_OBJECT; - break; - case MAP_ARM: - symname = "$a"; - type = BSF_FUNCTION; - break; - case MAP_THUMB: - symname = "$t"; - type = BSF_FUNCTION; - break; - case MAP_UNDEFINED: - return; - default: - abort (); - } - - seg_info (now_seg)->tc_segment_info_data = state; - - symbolP = symbol_new (symname, now_seg, (valueT) frag_now_fix (), frag_now); - symbol_table_insert (symbolP); - symbol_get_bfdsym (symbolP)->flags |= type | BSF_LOCAL; - - switch (state) - { - case MAP_ARM: - THUMB_SET_FUNC (symbolP, 0); - ARM_SET_THUMB (symbolP, 0); - ARM_SET_INTERWORK (symbolP, support_interwork); - break; - - case MAP_THUMB: - THUMB_SET_FUNC (symbolP, 1); - ARM_SET_THUMB (symbolP, 1); - ARM_SET_INTERWORK (symbolP, support_interwork); - break; - - case MAP_DATA: - default: - return; - } -} - -/* When we change sections we need to issue a new mapping symbol. */ - -void -arm_elf_change_section (void) -{ - flagword flags; - - if (!SEG_NORMAL (now_seg)) - return; - - flags = bfd_get_section_flags (stdoutput, now_seg); - - /* We can ignore sections that only contain debug info. */ - if ((flags & SEC_ALLOC) == 0) - return; - - mapstate = seg_info (now_seg)->tc_segment_info_data; -} -#else -#define mapping_state(a) -#endif /* OBJ_ELF */ - - -static void -s_req (a) - int a ATTRIBUTE_UNUSED; -{ - as_bad (_("invalid syntax for .req directive")); -} - -/* The .unreq directive deletes an alias which was previously defined - by .req. For example: - - my_alias .req r11 - .unreq my_alias */ - -static void -s_unreq (int a ATTRIBUTE_UNUSED) -{ - char *name; - char saved_char; - - skip_whitespace (input_line_pointer); - name = input_line_pointer; - - while (*input_line_pointer != 0 - && *input_line_pointer != ' ' - && *input_line_pointer != '\n') - ++input_line_pointer; - - saved_char = *input_line_pointer; - *input_line_pointer = 0; - - if (*name) - { - enum arm_reg_type req_type = arm_reg_parse_any (name); - - if (req_type != REG_TYPE_MAX) - { - char *temp_name = name; - int req_no = arm_reg_parse (&temp_name, all_reg_maps[req_type].htab); - - if (req_no != FAIL) - { - struct reg_entry *req_entry; - - /* Check to see if this alias is a builtin one. */ - req_entry = hash_delete (all_reg_maps[req_type].htab, name); - - if (!req_entry) - as_bad (_("unreq: missing hash entry for \"%s\""), name); - else if (req_entry->builtin) - /* FIXME: We are deleting a built in register alias which - points to a const data structure, so we only need to - free up the memory used by the key in the hash table. - Unfortunately we have not recorded this value, so this - is a memory leak. */ - /* FIXME: Should we issue a warning message ? */ - ; - else - { - /* Deleting a user defined alias. We need to free the - key and the value, but fortunately the key is the same - as the value->name field. */ - free ((char *) req_entry->name); - free (req_entry); - } - } - else - as_bad (_(".unreq: unrecognized symbol \"%s\""), name); - } - else - as_bad (_(".unreq: unrecognized symbol \"%s\""), name); - } - else - as_bad (_("invalid syntax for .unreq directive")); - - *input_line_pointer = saved_char; - demand_empty_rest_of_line (); -} - -static void -s_bss (ignore) - int ignore ATTRIBUTE_UNUSED; -{ - /* We don't support putting frags in the BSS segment, we fake it by - marking in_bss, then looking at s_skip for clues. */ - subseg_set (bss_section, 0); - demand_empty_rest_of_line (); - mapping_state (MAP_DATA); -} - -static void -s_even (ignore) - int ignore ATTRIBUTE_UNUSED; -{ - /* Never make frag if expect extra pass. */ - if (!need_pass_2) - frag_align (1, 0, 0); - - record_alignment (now_seg, 1); - - demand_empty_rest_of_line (); -} - -static void -s_ltorg (ignored) - int ignored ATTRIBUTE_UNUSED; -{ - unsigned int entry; - literal_pool * pool; - char sym_name[20]; - - pool = find_literal_pool (); - if (pool == NULL - || pool->symbol == NULL - || pool->next_free_entry == 0) - return; - - mapping_state (MAP_DATA); - - /* Align pool as you have word accesses. - Only make a frag if we have to. */ - if (!need_pass_2) - frag_align (2, 0, 0); - - record_alignment (now_seg, 2); - - sprintf (sym_name, "$$lit_\002%x", pool->id); - - symbol_locate (pool->symbol, sym_name, now_seg, - (valueT) frag_now_fix (), frag_now); - symbol_table_insert (pool->symbol); - - ARM_SET_THUMB (pool->symbol, thumb_mode); - -#if defined OBJ_COFF || defined OBJ_ELF - ARM_SET_INTERWORK (pool->symbol, support_interwork); -#endif - - for (entry = 0; entry < pool->next_free_entry; entry ++) - /* First output the expression in the instruction to the pool. */ - emit_expr (&(pool->literals[entry]), 4); /* .word */ - - /* Mark the pool as empty. */ - pool->next_free_entry = 0; - pool->symbol = NULL; -} - -/* Same as s_align_ptwo but align 0 => align 2. */ - -static void -s_align (unused) - int unused ATTRIBUTE_UNUSED; -{ - register int temp; - register long temp_fill; - long max_alignment = 15; - - temp = get_absolute_expression (); - if (temp > max_alignment) - as_bad (_("alignment too large: %d assumed"), temp = max_alignment); - else if (temp < 0) - { - as_bad (_("alignment negative. 0 assumed.")); - temp = 0; - } - - if (*input_line_pointer == ',') - { - input_line_pointer++; - temp_fill = get_absolute_expression (); - } - else - temp_fill = 0; - - if (!temp) - temp = 2; - - /* Only make a frag if we HAVE to. */ - if (temp && !need_pass_2) - frag_align (temp, (int) temp_fill, 0); - demand_empty_rest_of_line (); - - record_alignment (now_seg, temp); -} - -static void -s_force_thumb (ignore) - int ignore ATTRIBUTE_UNUSED; -{ - /* If we are not already in thumb mode go into it, EVEN if - the target processor does not support thumb instructions. - This is used by gcc/config/arm/lib1funcs.asm for example - to compile interworking support functions even if the - target processor should not support interworking. */ - if (! thumb_mode) - { - thumb_mode = 2; - - record_alignment (now_seg, 1); - } - - demand_empty_rest_of_line (); -} - -static void -s_thumb_func (ignore) - int ignore ATTRIBUTE_UNUSED; -{ - if (! thumb_mode) - opcode_select (16); - - /* The following label is the name/address of the start of a Thumb function. - We need to know this for the interworking support. */ - label_is_thumb_function_name = TRUE; - - demand_empty_rest_of_line (); -} - -/* Perform a .set directive, but also mark the alias as - being a thumb function. */ - -static void -s_thumb_set (equiv) - int equiv; -{ - /* XXX the following is a duplicate of the code for s_set() in read.c - We cannot just call that code as we need to get at the symbol that - is created. */ - register char * name; - register char delim; - register char * end_name; - register symbolS * symbolP; - - /* Especial apologies for the random logic: - This just grew, and could be parsed much more simply! - Dean - in haste. */ - name = input_line_pointer; - delim = get_symbol_end (); - end_name = input_line_pointer; - *end_name = delim; - - SKIP_WHITESPACE (); - - if (*input_line_pointer != ',') - { - *end_name = 0; - as_bad (_("expected comma after name \"%s\""), name); - *end_name = delim; - ignore_rest_of_line (); - return; - } - - input_line_pointer++; - *end_name = 0; - - if (name[0] == '.' && name[1] == '\0') - { - /* XXX - this should not happen to .thumb_set. */ - abort (); - } - - if ((symbolP = symbol_find (name)) == NULL - && (symbolP = md_undefined_symbol (name)) == NULL) - { -#ifndef NO_LISTING - /* When doing symbol listings, play games with dummy fragments living - outside the normal fragment chain to record the file and line info - for this symbol. */ - if (listing & LISTING_SYMBOLS) - { - extern struct list_info_struct * listing_tail; - fragS * dummy_frag = (fragS *) xmalloc (sizeof (fragS)); - - memset (dummy_frag, 0, sizeof (fragS)); - dummy_frag->fr_type = rs_fill; - dummy_frag->line = listing_tail; - symbolP = symbol_new (name, undefined_section, 0, dummy_frag); - dummy_frag->fr_symbol = symbolP; - } - else -#endif - symbolP = symbol_new (name, undefined_section, 0, &zero_address_frag); - -#ifdef OBJ_COFF - /* "set" symbols are local unless otherwise specified. */ - SF_SET_LOCAL (symbolP); -#endif /* OBJ_COFF */ - } /* Make a new symbol. */ - - symbol_table_insert (symbolP); - - * end_name = delim; - - if (equiv - && S_IS_DEFINED (symbolP) - && S_GET_SEGMENT (symbolP) != reg_section) - as_bad (_("symbol `%s' already defined"), S_GET_NAME (symbolP)); - - pseudo_set (symbolP); - - demand_empty_rest_of_line (); - - /* XXX Now we come to the Thumb specific bit of code. */ - - THUMB_SET_FUNC (symbolP, 1); - ARM_SET_THUMB (symbolP, 1); -#if defined OBJ_ELF || defined OBJ_COFF - ARM_SET_INTERWORK (symbolP, support_interwork); -#endif -} - -static void -opcode_select (width) - int width; -{ - switch (width) - { - case 16: - if (! thumb_mode) - { - if (! (cpu_variant & ARM_EXT_V4T)) - as_bad (_("selected processor does not support THUMB opcodes")); - - thumb_mode = 1; - /* No need to force the alignment, since we will have been - coming from ARM mode, which is word-aligned. */ - record_alignment (now_seg, 1); - } - mapping_state (MAP_THUMB); - break; - - case 32: - if (thumb_mode) - { - if ((cpu_variant & ARM_ALL) == ARM_EXT_V4T) - as_bad (_("selected processor does not support ARM opcodes")); - - thumb_mode = 0; - - if (!need_pass_2) - frag_align (2, 0, 0); - - record_alignment (now_seg, 1); - } - mapping_state (MAP_ARM); - break; - - default: - as_bad (_("invalid instruction size selected (%d)"), width); - } -} - -static void -s_arm (ignore) - int ignore ATTRIBUTE_UNUSED; -{ - opcode_select (32); - demand_empty_rest_of_line (); -} - -static void -s_thumb (ignore) - int ignore ATTRIBUTE_UNUSED; -{ - opcode_select (16); - demand_empty_rest_of_line (); -} - -static void -s_code (unused) - int unused ATTRIBUTE_UNUSED; -{ - register int temp; - - temp = get_absolute_expression (); - switch (temp) - { - case 16: - case 32: - opcode_select (temp); - break; - - default: - as_bad (_("invalid operand to .code directive (%d) (expecting 16 or 32)"), temp); - } -} - -static void -end_of_line (str) - char *str; -{ - skip_whitespace (str); - - if (*str != '\0' && !inst.error) - inst.error = _("garbage following instruction"); -} - -static int -skip_past_comma (str) - char ** str; -{ - char * p = * str, c; - int comma = 0; - - while ((c = *p) == ' ' || c == ',') - { - p++; - if (c == ',' && comma++) - return FAIL; - } - - if (c == '\0') - return FAIL; - - *str = p; - return comma ? SUCCESS : FAIL; -} - -/* A standard register must be given at this point. - SHIFT is the place to put it in inst.instruction. - Restores input start point on error. - Returns the reg#, or FAIL. */ - -static int -reg_required_here (str, shift) - char ** str; - int shift; -{ - static char buff [128]; /* XXX */ - int reg; - char * start = * str; - - if ((reg = arm_reg_parse (str, all_reg_maps[REG_TYPE_RN].htab)) != FAIL) - { - if (shift >= 0) - inst.instruction |= reg << shift; - return reg; - } - - /* Restore the start point, we may have got a reg of the wrong class. */ - *str = start; - - /* In the few cases where we might be able to accept something else - this error can be overridden. */ - sprintf (buff, _("register expected, not '%.100s'"), start); - inst.error = buff; - - return FAIL; -} - -/* A Intel Wireless MMX technology register - must be given at this point. - Shift is the place to put it in inst.instruction. - Restores input start point on err. - Returns the reg#, or FAIL. */ - -static int -wreg_required_here (str, shift, reg_type) - char ** str; - int shift; - enum wreg_type reg_type; -{ - static char buff [128]; - int reg; - char * start = *str; - - if ((reg = arm_reg_parse (str, all_reg_maps[REG_TYPE_IWMMXT].htab)) != FAIL) - { - if (wr_register (reg) - && (reg_type == IWMMXT_REG_WR || reg_type == IWMMXT_REG_WR_OR_WC)) - { - if (shift >= 0) - inst.instruction |= (reg ^ WR_PREFIX) << shift; - return reg; - } - else if (wc_register (reg) - && (reg_type == IWMMXT_REG_WC || reg_type == IWMMXT_REG_WR_OR_WC)) - { - if (shift >= 0) - inst.instruction |= (reg ^ WC_PREFIX) << shift; - return reg; - } - else if ((wcg_register (reg) && reg_type == IWMMXT_REG_WCG)) - { - if (shift >= 0) - inst.instruction |= ((reg ^ WC_PREFIX) - 8) << shift; - return reg; - } - } - - /* Restore the start point, we may have got a reg of the wrong class. */ - *str = start; - - /* In the few cases where we might be able to accept - something else this error can be overridden. */ - sprintf (buff, _("Intel Wireless MMX technology register expected, not '%.100s'"), start); - inst.error = buff; - - return FAIL; -} - -static const struct asm_psr * -arm_psr_parse (ccp) - register char ** ccp; -{ - char * start = * ccp; - char c; - char * p; - const struct asm_psr * psr; - - p = start; - - /* Skip to the end of the next word in the input stream. */ - do - { - c = *p++; - } - while (ISALPHA (c) || c == '_'); - - /* Terminate the word. */ - *--p = 0; - - /* CPSR's and SPSR's can now be lowercase. This is just a convenience - feature for ease of use and backwards compatibility. */ - if (!strncmp (start, "cpsr", 4)) - strncpy (start, "CPSR", 4); - else if (!strncmp (start, "spsr", 4)) - strncpy (start, "SPSR", 4); - - /* Now locate the word in the psr hash table. */ - psr = (const struct asm_psr *) hash_find (arm_psr_hsh, start); - - /* Restore the input stream. */ - *p = c; - - /* If we found a valid match, advance the - stream pointer past the end of the word. */ - *ccp = p; - - return psr; -} - -/* Parse the input looking for a PSR flag. */ - -static int -psr_required_here (str) - char ** str; -{ - char * start = * str; - const struct asm_psr * psr; - - psr = arm_psr_parse (str); - - if (psr) - { - /* If this is the SPSR that is being modified, set the R bit. */ - if (! psr->cpsr) - inst.instruction |= SPSR_BIT; - - /* Set the psr flags in the MSR instruction. */ - inst.instruction |= psr->field << PSR_SHIFT; - + (*str)++; return SUCCESS; } - - /* In the few cases where we might be able to accept - something else this error can be overridden. */ - inst.error = _("flag for {c}psr instruction expected"); - - /* Restore the start point. */ - *str = start; - return FAIL; -} - -static int -co_proc_number (str) - char **str; -{ - int processor, pchar; - char *start; - - skip_whitespace (*str); - start = *str; - - /* The data sheet seems to imply that just a number on its own is valid - here, but the RISC iX assembler seems to accept a prefix 'p'. We will - accept either. */ - if ((processor = arm_reg_parse (str, all_reg_maps[REG_TYPE_CP].htab)) - == FAIL) - { - *str = start; - - pchar = *(*str)++; - if (pchar >= '0' && pchar <= '9') - { - processor = pchar - '0'; - if (**str >= '0' && **str <= '9') - { - processor = processor * 10 + *(*str)++ - '0'; - if (processor > 15) - { - inst.error = _("illegal co-processor number"); - return FAIL; - } - } - } - else - { - inst.error = _("bad or missing co-processor number"); - return FAIL; - } - } - - inst.instruction |= processor << 8; - return SUCCESS; -} - -static int -cp_opc_expr (str, where, length) - char ** str; - int where; - int length; -{ - expressionS expr; - - skip_whitespace (* str); - - memset (&expr, '\0', sizeof (expr)); - - if (my_get_expression (&expr, str)) + else return FAIL; - if (expr.X_op != O_constant) - { - inst.error = _("bad or missing expression"); - return FAIL; - } - - if ((expr.X_add_number & ((1 << length) - 1)) != expr.X_add_number) - { - inst.error = _("immediate co-processor expression too large"); - return FAIL; - } - - inst.instruction |= expr.X_add_number << where; - return SUCCESS; -} - -static int -cp_reg_required_here (str, where) - char ** str; - int where; -{ - int reg; - char * start = *str; - - if ((reg = arm_reg_parse (str, all_reg_maps[REG_TYPE_CN].htab)) != FAIL) - { - inst.instruction |= reg << where; - return reg; - } - - /* In the few cases where we might be able to accept something else - this error can be overridden. */ - inst.error = _("co-processor register expected"); - - /* Restore the start point. */ - *str = start; - return FAIL; -} - -static int -fp_reg_required_here (str, where) - char ** str; - int where; -{ - int reg; - char * start = * str; - - if ((reg = arm_reg_parse (str, all_reg_maps[REG_TYPE_FN].htab)) != FAIL) - { - inst.instruction |= reg << where; - return reg; - } - - /* In the few cases where we might be able to accept something else - this error can be overridden. */ - inst.error = _("floating point register expected"); - - /* Restore the start point. */ - *str = start; - return FAIL; -} - -static int -cp_address_offset (str) - char ** str; -{ - int offset; - - skip_whitespace (* str); - - if (! is_immediate_prefix (**str)) - { - inst.error = _("immediate expression expected"); - return FAIL; - } - - (*str)++; - - if (my_get_expression (& inst.reloc.exp, str)) - return FAIL; - - if (inst.reloc.exp.X_op == O_constant) - { - offset = inst.reloc.exp.X_add_number; - - if (offset & 3) - { - inst.error = _("co-processor address must be word aligned"); - return FAIL; - } - - if (offset > 1023 || offset < -1023) - { - inst.error = _("offset too large"); - return FAIL; - } - - if (offset >= 0) - inst.instruction |= INDEX_UP; - else - offset = -offset; - - inst.instruction |= offset >> 2; - } - else - inst.reloc.type = BFD_RELOC_ARM_CP_OFF_IMM; - - return SUCCESS; -} - -static int -cp_address_required_here (str, wb_ok) - char ** str; - int wb_ok; -{ - char * p = * str; - int pre_inc = 0; - int write_back = 0; - - if (*p == '[') - { - int reg; - - p++; - skip_whitespace (p); - - if ((reg = reg_required_here (& p, 16)) == FAIL) - return FAIL; - - skip_whitespace (p); - - if (*p == ']') - { - p++; - - skip_whitespace (p); - - if (*p == '\0') - { - /* As an extension to the official ARM syntax we allow: - - [Rn] - - as a short hand for: - - [Rn,#0] */ - inst.instruction |= PRE_INDEX | INDEX_UP; - *str = p; - return SUCCESS; - } - - if (skip_past_comma (& p) == FAIL) - { - inst.error = _("comma expected after closing square bracket"); - return FAIL; - } - - skip_whitespace (p); - - if (*p == '#') - { - if (wb_ok) - { - /* [Rn], #expr */ - write_back = WRITE_BACK; - - if (reg == REG_PC) - { - inst.error = _("pc may not be used in post-increment"); - return FAIL; - } - - if (cp_address_offset (& p) == FAIL) - return FAIL; - } - else - pre_inc = PRE_INDEX | INDEX_UP; - } - else if (*p == '{') - { - int option; - - /* [Rn], {} */ - p++; - - skip_whitespace (p); - - if (my_get_expression (& inst.reloc.exp, & p)) - return FAIL; - - if (inst.reloc.exp.X_op == O_constant) - { - option = inst.reloc.exp.X_add_number; - - if (option > 255 || option < 0) - { - inst.error = _("'option' field too large"); - return FAIL; - } - - skip_whitespace (p); - - if (*p != '}') - { - inst.error = _("'}' expected at end of 'option' field"); - return FAIL; - } - else - { - p++; - inst.instruction |= option; - inst.instruction |= INDEX_UP; - } - } - else - { - inst.error = _("non-constant expressions for 'option' field not supported"); - return FAIL; - } - } - else - { - inst.error = _("# or { expected after comma"); - return FAIL; - } - } - else - { - /* '['Rn, #expr']'[!] */ - - if (skip_past_comma (& p) == FAIL) - { - inst.error = _("pre-indexed expression expected"); - return FAIL; - } - - pre_inc = PRE_INDEX; - - if (cp_address_offset (& p) == FAIL) - return FAIL; - - skip_whitespace (p); - - if (*p++ != ']') - { - inst.error = _("missing ]"); - return FAIL; - } - - skip_whitespace (p); - - if (wb_ok && *p == '!') - { - if (reg == REG_PC) - { - inst.error = _("pc may not be used with write-back"); - return FAIL; - } - - p++; - write_back = WRITE_BACK; - } - } - } - else - { - if (my_get_expression (&inst.reloc.exp, &p)) - return FAIL; - - inst.reloc.type = BFD_RELOC_ARM_CP_OFF_IMM; - inst.reloc.exp.X_add_number -= 8; /* PC rel adjust. */ - inst.reloc.pc_rel = 1; - inst.instruction |= (REG_PC << 16); - pre_inc = PRE_INDEX; - } - - inst.instruction |= write_back | pre_inc; - *str = p; - return SUCCESS; -} - -static int -cp_byte_address_offset (str) - char ** str; -{ - int offset; - - skip_whitespace (* str); - - if (! is_immediate_prefix (**str)) - { - inst.error = _("immediate expression expected"); - return FAIL; - } - - (*str)++; - - if (my_get_expression (& inst.reloc.exp, str)) - return FAIL; - - if (inst.reloc.exp.X_op == O_constant) - { - offset = inst.reloc.exp.X_add_number; - - if (offset > 255 || offset < -255) - { - inst.error = _("offset too large"); - return FAIL; - } - - if (offset >= 0) - inst.instruction |= INDEX_UP; - else - offset = -offset; - - inst.instruction |= offset; - } - else - inst.reloc.type = BFD_RELOC_ARM_CP_OFF_IMM_S2; - - return SUCCESS; -} - -static int -cp_byte_address_required_here (str) - char ** str; -{ - char * p = * str; - int pre_inc = 0; - int write_back = 0; - - if (*p == '[') - { - int reg; - - p++; - skip_whitespace (p); - - if ((reg = reg_required_here (& p, 16)) == FAIL) - return FAIL; - - skip_whitespace (p); - - if (*p == ']') - { - p++; - - if (skip_past_comma (& p) == SUCCESS) - { - /* [Rn], #expr */ - write_back = WRITE_BACK; - - if (reg == REG_PC) - { - inst.error = _("pc may not be used in post-increment"); - return FAIL; - } - - if (cp_byte_address_offset (& p) == FAIL) - return FAIL; - } - else - pre_inc = PRE_INDEX | INDEX_UP; - } - else - { - /* '['Rn, #expr']'[!] */ - - if (skip_past_comma (& p) == FAIL) - { - inst.error = _("pre-indexed expression expected"); - return FAIL; - } - - pre_inc = PRE_INDEX; - - if (cp_byte_address_offset (& p) == FAIL) - return FAIL; - - skip_whitespace (p); - - if (*p++ != ']') - { - inst.error = _("missing ]"); - return FAIL; - } - - skip_whitespace (p); - - if (*p == '!') - { - if (reg == REG_PC) - { - inst.error = _("pc may not be used with write-back"); - return FAIL; - } - - p++; - write_back = WRITE_BACK; - } - } - } - else - { - if (my_get_expression (&inst.reloc.exp, &p)) - return FAIL; - - inst.reloc.type = BFD_RELOC_ARM_CP_OFF_IMM_S2; - inst.reloc.exp.X_add_number -= 8; /* PC rel adjust. */ - inst.reloc.pc_rel = 1; - inst.instruction |= (REG_PC << 16); - pre_inc = PRE_INDEX; - } - - inst.instruction |= write_back | pre_inc; - *str = p; - return SUCCESS; -} - -static void -do_empty (str) - char * str; -{ - /* Do nothing really. */ - end_of_line (str); -} - -static void -do_mrs (str) - char *str; -{ - int skip = 0; - - /* Only one syntax. */ - skip_whitespace (str); - - if (reg_required_here (&str, 12) == FAIL) - { - inst.error = BAD_ARGS; - return; - } - - if (skip_past_comma (&str) == FAIL) - { - inst.error = _("comma expected after register name"); - return; - } - - skip_whitespace (str); - - if ( strcmp (str, "CPSR") == 0 - || strcmp (str, "SPSR") == 0 - /* Lower case versions for backwards compatibility. */ - || strcmp (str, "cpsr") == 0 - || strcmp (str, "spsr") == 0) - skip = 4; - - /* This is for backwards compatibility with older toolchains. */ - else if ( strcmp (str, "cpsr_all") == 0 - || strcmp (str, "spsr_all") == 0) - skip = 8; - else - { - inst.error = _("CPSR or SPSR expected"); - return; - } - - if (* str == 's' || * str == 'S') - inst.instruction |= SPSR_BIT; - str += skip; - - end_of_line (str); -} - -/* Two possible forms: - "{C|S}PSR_, Rm", - "{C|S}PSR_f, #expression". */ - -static void -do_msr (str) - char * str; -{ - skip_whitespace (str); - - if (psr_required_here (& str) == FAIL) - return; - - if (skip_past_comma (& str) == FAIL) - { - inst.error = _("comma missing after psr flags"); - return; - } - - skip_whitespace (str); - - if (reg_required_here (& str, 0) != FAIL) - { - inst.error = NULL; - end_of_line (str); - return; - } - - if (! is_immediate_prefix (* str)) - { - inst.error = - _("only a register or immediate value can follow a psr flag"); - return; - } - - str ++; - inst.error = NULL; - - if (my_get_expression (& inst.reloc.exp, & str)) - { - inst.error = - _("only a register or immediate value can follow a psr flag"); - return; - } - -#if 0 /* The first edition of the ARM architecture manual stated that - writing anything other than the flags with an immediate operation - had UNPREDICTABLE effects. This constraint was removed in the - second edition of the specification. */ - if ((cpu_variant & ARM_EXT_V5) != ARM_EXT_V5 - && inst.instruction & ((PSR_c | PSR_x | PSR_s) << PSR_SHIFT)) - { - inst.error = _("immediate value cannot be used to set this field"); - return; - } -#endif - - inst.instruction |= INST_IMMEDIATE; - - if (inst.reloc.exp.X_add_symbol) - { - inst.reloc.type = BFD_RELOC_ARM_IMMEDIATE; - inst.reloc.pc_rel = 0; - } - else - { - unsigned value = validate_immediate (inst.reloc.exp.X_add_number); - - if (value == (unsigned) FAIL) - { - inst.error = _("invalid constant"); - return; - } - - inst.instruction |= value; - } - - inst.error = NULL; - end_of_line (str); -} - -/* Long Multiply Parser - UMULL RdLo, RdHi, Rm, Rs - SMULL RdLo, RdHi, Rm, Rs - UMLAL RdLo, RdHi, Rm, Rs - SMLAL RdLo, RdHi, Rm, Rs. */ - -static void -do_mull (str) - char * str; -{ - int rdlo, rdhi, rm, rs; - - /* Only one format "rdlo, rdhi, rm, rs". */ - skip_whitespace (str); - - if ((rdlo = reg_required_here (&str, 12)) == FAIL) - { - inst.error = BAD_ARGS; - return; - } - - if (skip_past_comma (&str) == FAIL - || (rdhi = reg_required_here (&str, 16)) == FAIL) - { - inst.error = BAD_ARGS; - return; - } - - if (skip_past_comma (&str) == FAIL - || (rm = reg_required_here (&str, 0)) == FAIL) - { - inst.error = BAD_ARGS; - return; - } - - /* rdhi, rdlo and rm must all be different. */ - if (rdlo == rdhi || rdlo == rm || rdhi == rm) - as_tsktsk (_("rdhi, rdlo and rm must all be different")); - - if (skip_past_comma (&str) == FAIL - || (rs = reg_required_here (&str, 8)) == FAIL) - { - inst.error = BAD_ARGS; - return; - } - - if (rdhi == REG_PC || rdhi == REG_PC || rdhi == REG_PC || rdhi == REG_PC) - { - inst.error = BAD_PC; - return; - } - - end_of_line (str); -} - -static void -do_mul (str) - char * str; -{ - int rd, rm; - - /* Only one format "rd, rm, rs". */ - skip_whitespace (str); - - if ((rd = reg_required_here (&str, 16)) == FAIL) - { - inst.error = BAD_ARGS; - return; - } - - if (rd == REG_PC) - { - inst.error = BAD_PC; - return; - } - - if (skip_past_comma (&str) == FAIL - || (rm = reg_required_here (&str, 0)) == FAIL) - { - inst.error = BAD_ARGS; - return; - } - - if (rm == REG_PC) - { - inst.error = BAD_PC; - return; - } - - if (rm == rd) - as_tsktsk (_("rd and rm should be different in mul")); - - if (skip_past_comma (&str) == FAIL - || (rm = reg_required_here (&str, 8)) == FAIL) - { - inst.error = BAD_ARGS; - return; - } - - if (rm == REG_PC) - { - inst.error = BAD_PC; - return; - } - - end_of_line (str); -} - -static void -do_mla (str) - char * str; -{ - int rd, rm; - - /* Only one format "rd, rm, rs, rn". */ - skip_whitespace (str); - - if ((rd = reg_required_here (&str, 16)) == FAIL) - { - inst.error = BAD_ARGS; - return; - } - - if (rd == REG_PC) - { - inst.error = BAD_PC; - return; - } - - if (skip_past_comma (&str) == FAIL - || (rm = reg_required_here (&str, 0)) == FAIL) - { - inst.error = BAD_ARGS; - return; - } - - if (rm == REG_PC) - { - inst.error = BAD_PC; - return; - } - - if (rm == rd) - as_tsktsk (_("rd and rm should be different in mla")); - - if (skip_past_comma (&str) == FAIL - || (rd = reg_required_here (&str, 8)) == FAIL - || skip_past_comma (&str) == FAIL - || (rm = reg_required_here (&str, 12)) == FAIL) - { - inst.error = BAD_ARGS; - return; - } - - if (rd == REG_PC || rm == REG_PC) - { - inst.error = BAD_PC; - return; - } - - end_of_line (str); -} - -/* Expects *str -> the characters "acc0", possibly with leading blanks. - Advances *str to the next non-alphanumeric. - Returns 0, or else FAIL (in which case sets inst.error). - - (In a future XScale, there may be accumulators other than zero. - At that time this routine and its callers can be upgraded to suit.) */ - -static int -accum0_required_here (str) - char ** str; -{ - static char buff [128]; /* Note the address is taken. Hence, static. */ - char * p = * str; - char c; - int result = 0; /* The accum number. */ - - skip_whitespace (p); - - *str = p; /* Advance caller's string pointer too. */ - c = *p++; - while (ISALNUM (c)) - c = *p++; - - *--p = 0; /* Aap nul into input buffer at non-alnum. */ - - if (! ( streq (*str, "acc0") || streq (*str, "ACC0"))) - { - sprintf (buff, _("acc0 expected, not '%.100s'"), *str); - inst.error = buff; - result = FAIL; - } - - *p = c; /* Unzap. */ - *str = p; /* Caller's string pointer to after match. */ - return result; -} - -/* Expects **str -> after a comma. May be leading blanks. - Advances *str, recognizing a load mode, and setting inst.instruction. - Returns rn, or else FAIL (in which case may set inst.error - and not advance str) - - Note: doesn't know Rd, so no err checks that require such knowledge. */ - -static int -ld_mode_required_here (string) - char ** string; -{ - char * str = * string; - int rn; - int pre_inc = 0; - - skip_whitespace (str); - - if (* str == '[') - { - str++; - - skip_whitespace (str); - - if ((rn = reg_required_here (& str, 16)) == FAIL) - return FAIL; - - skip_whitespace (str); - - if (* str == ']') - { - str ++; - - if (skip_past_comma (& str) == SUCCESS) - { - /* [Rn],... (post inc) */ - if (ldst_extend_v4 (&str) == FAIL) - return FAIL; - } - else /* [Rn] */ - { - skip_whitespace (str); - - if (* str == '!') - { - str ++; - inst.instruction |= WRITE_BACK; - } - - inst.instruction |= INDEX_UP | HWOFFSET_IMM; - pre_inc = 1; - } - } - else /* [Rn,...] */ - { - if (skip_past_comma (& str) == FAIL) - { - inst.error = _("pre-indexed expression expected"); - return FAIL; - } - - pre_inc = 1; - - if (ldst_extend_v4 (&str) == FAIL) - return FAIL; - - skip_whitespace (str); - - if (* str ++ != ']') - { - inst.error = _("missing ]"); - return FAIL; - } - - skip_whitespace (str); - - if (* str == '!') - { - str ++; - inst.instruction |= WRITE_BACK; - } - } - } - else if (* str == '=') /* ldr's "r,=label" syntax */ - /* We should never reach here, because = is - caught gas/read.c read_a_source_file() as a .set operation. */ - return FAIL; - else /* PC +- 8 bit immediate offset. */ - { - if (my_get_expression (& inst.reloc.exp, & str)) - return FAIL; - - inst.instruction |= HWOFFSET_IMM; /* The I bit. */ - inst.reloc.type = BFD_RELOC_ARM_OFFSET_IMM8; - inst.reloc.exp.X_add_number -= 8; /* PC rel adjust. */ - inst.reloc.pc_rel = 1; - inst.instruction |= (REG_PC << 16); - - rn = REG_PC; - pre_inc = 1; - } - - inst.instruction |= (pre_inc ? PRE_INDEX : 0); - * string = str; - - return rn; -} - -/* ARM V5E (El Segundo) signed-multiply-accumulate (argument parse) - SMLAxy{cond} Rd,Rm,Rs,Rn - SMLAWy{cond} Rd,Rm,Rs,Rn - Error if any register is R15. */ - -static void -do_smla (str) - char * str; -{ - int rd, rm, rs, rn; - - skip_whitespace (str); - - if ((rd = reg_required_here (& str, 16)) == FAIL - || skip_past_comma (& str) == FAIL - || (rm = reg_required_here (& str, 0)) == FAIL - || skip_past_comma (& str) == FAIL - || (rs = reg_required_here (& str, 8)) == FAIL - || skip_past_comma (& str) == FAIL - || (rn = reg_required_here (& str, 12)) == FAIL) - inst.error = BAD_ARGS; - - else if (rd == REG_PC || rm == REG_PC || rs == REG_PC || rn == REG_PC) - inst.error = BAD_PC; - - else - end_of_line (str); -} - -/* ARM V5E (El Segundo) signed-multiply-accumulate-long (argument parse) - SMLALxy{cond} Rdlo,Rdhi,Rm,Rs - Error if any register is R15. - Warning if Rdlo == Rdhi. */ - -static void -do_smlal (str) - char * str; -{ - int rdlo, rdhi, rm, rs; - - skip_whitespace (str); - - if ((rdlo = reg_required_here (& str, 12)) == FAIL - || skip_past_comma (& str) == FAIL - || (rdhi = reg_required_here (& str, 16)) == FAIL - || skip_past_comma (& str) == FAIL - || (rm = reg_required_here (& str, 0)) == FAIL - || skip_past_comma (& str) == FAIL - || (rs = reg_required_here (& str, 8)) == FAIL) - { - inst.error = BAD_ARGS; - return; - } - - if (rdlo == REG_PC || rdhi == REG_PC || rm == REG_PC || rs == REG_PC) - { - inst.error = BAD_PC; - return; - } - - if (rdlo == rdhi) - as_tsktsk (_("rdhi and rdlo must be different")); - - end_of_line (str); -} - -/* ARM V5E (El Segundo) signed-multiply (argument parse) - SMULxy{cond} Rd,Rm,Rs - Error if any register is R15. */ - -static void -do_smul (str) - char * str; -{ - int rd, rm, rs; - - skip_whitespace (str); - - if ((rd = reg_required_here (& str, 16)) == FAIL - || skip_past_comma (& str) == FAIL - || (rm = reg_required_here (& str, 0)) == FAIL - || skip_past_comma (& str) == FAIL - || (rs = reg_required_here (& str, 8)) == FAIL) - inst.error = BAD_ARGS; - - else if (rd == REG_PC || rm == REG_PC || rs == REG_PC) - inst.error = BAD_PC; - - else - end_of_line (str); -} - -/* ARM V5E (El Segundo) saturating-add/subtract (argument parse) - Q[D]{ADD,SUB}{cond} Rd,Rm,Rn - Error if any register is R15. */ - -static void -do_qadd (str) - char * str; -{ - int rd, rm, rn; - - skip_whitespace (str); - - if ((rd = reg_required_here (& str, 12)) == FAIL - || skip_past_comma (& str) == FAIL - || (rm = reg_required_here (& str, 0)) == FAIL - || skip_past_comma (& str) == FAIL - || (rn = reg_required_here (& str, 16)) == FAIL) - inst.error = BAD_ARGS; - - else if (rd == REG_PC || rm == REG_PC || rn == REG_PC) - inst.error = BAD_PC; - - else - end_of_line (str); -} - -/* ARM V5E (el Segundo) - MCRRcc , , , , . - MRRCcc , , , , . - - These are equivalent to the XScale instructions MAR and MRA, - respectively, when coproc == 0, opcode == 0, and CRm == 0. - - Result unpredicatable if Rd or Rn is R15. */ - -static void -do_co_reg2c (str) - char * str; -{ - int rd, rn; - - skip_whitespace (str); - - if (co_proc_number (& str) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - if (skip_past_comma (& str) == FAIL - || cp_opc_expr (& str, 4, 4) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - if (skip_past_comma (& str) == FAIL - || (rd = reg_required_here (& str, 12)) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - if (skip_past_comma (& str) == FAIL - || (rn = reg_required_here (& str, 16)) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - /* Unpredictable result if rd or rn is R15. */ - if (rd == REG_PC || rn == REG_PC) - as_tsktsk - (_("Warning: instruction unpredictable when using r15")); - - if (skip_past_comma (& str) == FAIL - || cp_reg_required_here (& str, 0) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - end_of_line (str); -} - -/* ARM V5 count-leading-zeroes instruction (argument parse) - CLZ{} , - Condition defaults to COND_ALWAYS. - Error if Rd or Rm are R15. */ - -static void -do_clz (str) - char * str; -{ - int rd, rm; - - skip_whitespace (str); - - if (((rd = reg_required_here (& str, 12)) == FAIL) - || (skip_past_comma (& str) == FAIL) - || ((rm = reg_required_here (& str, 0)) == FAIL)) - inst.error = BAD_ARGS; - - else if (rd == REG_PC || rm == REG_PC ) - inst.error = BAD_PC; - - else - end_of_line (str); -} - -/* ARM V5 (argument parse) - LDC2{L} , , - STC2{L} , , - Instruction is not conditional, and has 0xf in the condition field. - Otherwise, it's the same as LDC/STC. */ - -static void -do_lstc2 (str) - char * str; -{ - skip_whitespace (str); - - if (co_proc_number (& str) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - } - else if (skip_past_comma (& str) == FAIL - || cp_reg_required_here (& str, 12) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - } - else if (skip_past_comma (& str) == FAIL - || cp_address_required_here (&str, CP_WB_OK) == FAIL) - { - if (! inst.error) - inst.error = BAD_ARGS; - } - else - end_of_line (str); -} - -/* ARM V5 (argument parse) - CDP2 , , , , , - Instruction is not conditional, and has 0xf in the condition field. - Otherwise, it's the same as CDP. */ - -static void -do_cdp2 (str) - char * str; -{ - skip_whitespace (str); - - if (co_proc_number (& str) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - if (skip_past_comma (& str) == FAIL - || cp_opc_expr (& str, 20,4) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - if (skip_past_comma (& str) == FAIL - || cp_reg_required_here (& str, 12) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - if (skip_past_comma (& str) == FAIL - || cp_reg_required_here (& str, 16) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - if (skip_past_comma (& str) == FAIL - || cp_reg_required_here (& str, 0) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - if (skip_past_comma (& str) == SUCCESS) - { - if (cp_opc_expr (& str, 5, 3) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - } - - end_of_line (str); -} - -/* ARM V5 (argument parse) - MCR2 , , , , , - MRC2 , , , , , - Instruction is not conditional, and has 0xf in the condition field. - Otherwise, it's the same as MCR/MRC. */ - -static void -do_co_reg2 (str) - char * str; -{ - skip_whitespace (str); - - if (co_proc_number (& str) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - if (skip_past_comma (& str) == FAIL - || cp_opc_expr (& str, 21, 3) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - if (skip_past_comma (& str) == FAIL - || reg_required_here (& str, 12) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - if (skip_past_comma (& str) == FAIL - || cp_reg_required_here (& str, 16) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - if (skip_past_comma (& str) == FAIL - || cp_reg_required_here (& str, 0) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - if (skip_past_comma (& str) == SUCCESS) - { - if (cp_opc_expr (& str, 5, 3) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - } - - end_of_line (str); -} - -/* ARM v5TEJ. Jump to Jazelle code. */ -static void -do_bxj (str) - char * str; -{ - int reg; - - skip_whitespace (str); - - if ((reg = reg_required_here (&str, 0)) == FAIL) - { - inst.error = BAD_ARGS; - return; - } - - /* Note - it is not illegal to do a "bxj pc". Useless, but not illegal. */ - if (reg == REG_PC) - as_tsktsk (_("use of r15 in bxj is not really useful")); - - end_of_line (str); -} - -/* ARM V6 umaal (argument parse). */ - -static void -do_umaal (str) - char *str; -{ - - int rdlo, rdhi, rm, rs; - - skip_whitespace (str); - if ((rdlo = reg_required_here (& str, 12)) == FAIL - || skip_past_comma (& str) == FAIL - || (rdhi = reg_required_here (& str, 16)) == FAIL - || skip_past_comma (& str) == FAIL - || (rm = reg_required_here (& str, 0)) == FAIL - || skip_past_comma (& str) == FAIL - || (rs = reg_required_here (& str, 8)) == FAIL) - { - inst.error = BAD_ARGS; - return; - } - - if (rdlo == REG_PC || rdhi == REG_PC || rm == REG_PC || rs == REG_PC) - { - inst.error = BAD_PC; - return; - } - - end_of_line (str); -} - -/* ARM V6 strex (argument parse). */ - -static void -do_strex (str) - char *str; -{ - int rd, rm, rn; - - /* Parse Rd, Rm,. */ - skip_whitespace (str); - if ((rd = reg_required_here (& str, 12)) == FAIL - || skip_past_comma (& str) == FAIL - || (rm = reg_required_here (& str, 0)) == FAIL - || skip_past_comma (& str) == FAIL) - { - inst.error = BAD_ARGS; - return; - } - if (rd == REG_PC || rm == REG_PC) - { - inst.error = BAD_PC; - return; - } - if (rd == rm) - { - inst.error = _("Rd equal to Rm or Rn yields unpredictable results"); - return; - } - - /* Skip past '['. */ - if ((strlen (str) >= 1) - && strncmp (str, "[", 1) == 0) - str+=1; - skip_whitespace (str); - - /* Parse Rn. */ - if ((rn = reg_required_here (& str, 16)) == FAIL) - { - inst.error = BAD_ARGS; - return; - } - else if (rn == REG_PC) - { - inst.error = BAD_PC; - return; - } - if (rd == rn) - { - inst.error = _("Rd equal to Rm or Rn yields unpredictable results"); - return; - } - skip_whitespace (str); - - /* Skip past ']'. */ - if ((strlen (str) >= 1) - && strncmp (str, "]", 1) == 0) - str+=1; - - end_of_line (str); -} - -/* ARM V6 ssat (argument parse). */ - -static void -do_ssat (str) - char* str; -{ - do_sat (&str, /*bias=*/-1); - end_of_line (str); -} - -/* ARM V6 usat (argument parse). */ - -static void -do_usat (str) - char* str; -{ - do_sat (&str, /*bias=*/0); - end_of_line (str); -} - -static void -do_sat (str, bias) - char **str; - int bias; -{ - int rd, rm; - expressionS expr; - - skip_whitespace (*str); - - /* Parse , field. */ - if ((rd = reg_required_here (str, 12)) == FAIL - || skip_past_comma (str) == FAIL) - { - inst.error = BAD_ARGS; - return; - } - if (rd == REG_PC) - { - inst.error = BAD_PC; - return; - } - - /* Parse #, field. */ - if (is_immediate_prefix (**str)) - (*str)++; - else - { - inst.error = _("immediate expression expected"); - return; - } - if (my_get_expression (&expr, str)) - { - inst.error = _("bad expression"); - return; - } - if (expr.X_op != O_constant) - { - inst.error = _("constant expression expected"); - return; - } - if (expr.X_add_number + bias < 0 - || expr.X_add_number + bias > 31) - { - inst.error = _("immediate value out of range"); - return; - } - inst.instruction |= (expr.X_add_number + bias) << 16; - if (skip_past_comma (str) == FAIL) - { - inst.error = BAD_ARGS; - return; - } - - /* Parse field. */ - if ((rm = reg_required_here (str, 0)) == FAIL) - { - inst.error = BAD_ARGS; - return; - } - if (rm == REG_PC) - { - inst.error = BAD_PC; - return; - } - - if (skip_past_comma (str) == SUCCESS) - decode_shift (str, SHIFT_LSL_OR_ASR_IMMEDIATE); -} - -/* ARM V6 ssat16 (argument parse). */ - -static void -do_ssat16 (str) - char *str; -{ - do_sat16 (&str, /*bias=*/-1); - end_of_line (str); -} - -static void -do_usat16 (str) - char *str; -{ - do_sat16 (&str, /*bias=*/0); - end_of_line (str); -} - -static void -do_sat16 (str, bias) - char **str; - int bias; -{ - int rd, rm; - expressionS expr; - - skip_whitespace (*str); - - /* Parse the field. */ - if ((rd = reg_required_here (str, 12)) == FAIL - || skip_past_comma (str) == FAIL) - { - inst.error = BAD_ARGS; - return; - } - if (rd == REG_PC) - { - inst.error = BAD_PC; - return; - } - - /* Parse #, field. */ - if (is_immediate_prefix (**str)) - (*str)++; - else - { - inst.error = _("immediate expression expected"); - return; - } - if (my_get_expression (&expr, str)) - { - inst.error = _("bad expression"); - return; - } - if (expr.X_op != O_constant) - { - inst.error = _("constant expression expected"); - return; - } - if (expr.X_add_number + bias < 0 - || expr.X_add_number + bias > 15) - { - inst.error = _("immediate value out of range"); - return; - } - inst.instruction |= (expr.X_add_number + bias) << 16; - if (skip_past_comma (str) == FAIL) - { - inst.error = BAD_ARGS; - return; - } - - /* Parse field. */ - if ((rm = reg_required_here (str, 0)) == FAIL) - { - inst.error = BAD_ARGS; - return; - } - if (rm == REG_PC) - { - inst.error = BAD_PC; - return; - } -} - -/* ARM V6 srs (argument parse). */ - -static void -do_srs (str) - char* str; -{ - char *exclam; - skip_whitespace (str); - exclam = strchr (str, '!'); - if (exclam) - *exclam = '\0'; - do_cps_mode (&str); - if (exclam) - *exclam = '!'; - if (*str == '!') - { - inst.instruction |= WRITE_BACK; - str++; - } - end_of_line (str); -} - -/* ARM V6 SMMUL (argument parse). */ - -static void -do_smmul (str) - char* str; -{ - int rd, rm, rs; - - skip_whitespace (str); - if ((rd = reg_required_here (&str, 16)) == FAIL - || skip_past_comma (&str) == FAIL - || (rm = reg_required_here (&str, 0)) == FAIL - || skip_past_comma (&str) == FAIL - || (rs = reg_required_here (&str, 8)) == FAIL) - { - inst.error = BAD_ARGS; - return; - } - - if (rd == REG_PC - || rm == REG_PC - || rs == REG_PC) - { - inst.error = BAD_PC; - return; - } - - end_of_line (str); - -} - -/* ARM V6 SMLALD (argument parse). */ - -static void -do_smlald (str) - char* str; -{ - int rdlo, rdhi, rm, rs; - skip_whitespace (str); - if ((rdlo = reg_required_here (&str, 12)) == FAIL - || skip_past_comma (&str) == FAIL - || (rdhi = reg_required_here (&str, 16)) == FAIL - || skip_past_comma (&str) == FAIL - || (rm = reg_required_here (&str, 0)) == FAIL - || skip_past_comma (&str) == FAIL - || (rs = reg_required_here (&str, 8)) == FAIL) - { - inst.error = BAD_ARGS; - return; - } - - if (rdlo == REG_PC - || rdhi == REG_PC - || rm == REG_PC - || rs == REG_PC) - { - inst.error = BAD_PC; - return; - } - - end_of_line (str); -} - -/* ARM V6 SMLAD (argument parse). Signed multiply accumulate dual. - smlad{x}{} Rd, Rm, Rs, Rn */ - -static void -do_smlad (str) - char *str; -{ - int rd, rm, rs, rn; - - skip_whitespace (str); - if ((rd = reg_required_here (&str, 16)) == FAIL - || skip_past_comma (&str) == FAIL - || (rm = reg_required_here (&str, 0)) == FAIL - || skip_past_comma (&str) == FAIL - || (rs = reg_required_here (&str, 8)) == FAIL - || skip_past_comma (&str) == FAIL - || (rn = reg_required_here (&str, 12)) == FAIL) - { - inst.error = BAD_ARGS; - return; - } - - if (rd == REG_PC - || rn == REG_PC - || rs == REG_PC - || rm == REG_PC) - { - inst.error = BAD_PC; - return; - } - - end_of_line (str); -} - -/* ARM V6 SETEND (argument parse). Sets the E bit in the CPSR while - preserving the other bits. - - setend , where is either - BE or LE. */ - -static void -do_setend (str) - char *str; -{ - if (do_endian_specifier (str)) - inst.instruction |= 0x200; -} - -/* Returns true if the endian-specifier indicates big-endianness. */ - -static int -do_endian_specifier (str) - char *str; -{ - int big_endian = 0; - - skip_whitespace (str); - if (strlen (str) < 2) - inst.error = _("missing endian specifier"); - else if (strncasecmp (str, "BE", 2) == 0) - { - str += 2; - big_endian = 1; - } - else if (strncasecmp (str, "LE", 2) == 0) - str += 2; - else - inst.error = _("valid endian specifiers are be or le"); - - end_of_line (str); - - return big_endian; -} - -/* ARM V6 SXTH. - - SXTH {} , {, } - Condition defaults to COND_ALWAYS. - Error if any register uses R15. */ - -static void -do_sxth (str) - char *str; -{ - int rd, rm; - expressionS expr; - int rotation_clear_mask = 0xfffff3ff; - int rotation_eight_mask = 0x00000400; - int rotation_sixteen_mask = 0x00000800; - int rotation_twenty_four_mask = 0x00000c00; - - skip_whitespace (str); - if ((rd = reg_required_here (&str, 12)) == FAIL - || skip_past_comma (&str) == FAIL - || (rm = reg_required_here (&str, 0)) == FAIL) - { - inst.error = BAD_ARGS; - return; - } - - else if (rd == REG_PC || rm == REG_PC) - { - inst.error = BAD_PC; - return; - } - - /* Zero out the rotation field. */ - inst.instruction &= rotation_clear_mask; - - /* Check for lack of optional rotation field. */ - if (skip_past_comma (&str) == FAIL) - { - end_of_line (str); - return; - } - - /* Move past 'ROR'. */ - skip_whitespace (str); - if (strncasecmp (str, "ROR", 3) == 0) - str+=3; - else - { - inst.error = _("missing rotation field after comma"); - return; - } - - /* Get the immediate constant. */ - skip_whitespace (str); - if (is_immediate_prefix (* str)) - str++; - else - { - inst.error = _("immediate expression expected"); - return; - } - - if (my_get_expression (&expr, &str)) - { - inst.error = _("bad expression"); - return; - } - - if (expr.X_op != O_constant) - { - inst.error = _("constant expression expected"); - return; - } - - switch (expr.X_add_number) - { - case 0: - /* Rotation field has already been zeroed. */ - break; - case 8: - inst.instruction |= rotation_eight_mask; - break; - - case 16: - inst.instruction |= rotation_sixteen_mask; - break; - - case 24: - inst.instruction |= rotation_twenty_four_mask; - break; - - default: - inst.error = _("rotation can be 8, 16, 24 or 0 when field is ommited"); - break; - } - - end_of_line (str); - -} - -/* ARM V6 SXTAH extracts a 16-bit value from a register, sign - extends it to 32-bits, and adds the result to a value in another - register. You can specify a rotation by 0, 8, 16, or 24 bits - before extracting the 16-bit value. - SXTAH{} , , {, } - Condition defaults to COND_ALWAYS. - Error if any register uses R15. */ - -static void -do_sxtah (str) - char *str; -{ - int rd, rn, rm; - expressionS expr; - int rotation_clear_mask = 0xfffff3ff; - int rotation_eight_mask = 0x00000400; - int rotation_sixteen_mask = 0x00000800; - int rotation_twenty_four_mask = 0x00000c00; - - skip_whitespace (str); - if ((rd = reg_required_here (&str, 12)) == FAIL - || skip_past_comma (&str) == FAIL - || (rn = reg_required_here (&str, 16)) == FAIL - || skip_past_comma (&str) == FAIL - || (rm = reg_required_here (&str, 0)) == FAIL) - { - inst.error = BAD_ARGS; - return; - } - - else if (rd == REG_PC || rn == REG_PC || rm == REG_PC) - { - inst.error = BAD_PC; - return; - } - - /* Zero out the rotation field. */ - inst.instruction &= rotation_clear_mask; - - /* Check for lack of optional rotation field. */ - if (skip_past_comma (&str) == FAIL) - { - end_of_line (str); - return; - } - - /* Move past 'ROR'. */ - skip_whitespace (str); - if (strncasecmp (str, "ROR", 3) == 0) - str+=3; - else - { - inst.error = _("missing rotation field after comma"); - return; - } - - /* Get the immediate constant. */ - skip_whitespace (str); - if (is_immediate_prefix (* str)) - str++; - else - { - inst.error = _("immediate expression expected"); - return; - } - - if (my_get_expression (&expr, &str)) - { - inst.error = _("bad expression"); - return; - } - - if (expr.X_op != O_constant) - { - inst.error = _("constant expression expected"); - return; - } - - switch (expr.X_add_number) - { - case 0: - /* Rotation field has already been zeroed. */ - break; - - case 8: - inst.instruction |= rotation_eight_mask; - break; - - case 16: - inst.instruction |= rotation_sixteen_mask; - break; - - case 24: - inst.instruction |= rotation_twenty_four_mask; - break; - - default: - inst.error = _("rotation can be 8, 16, 24 or 0 when field is ommited"); - break; - } - - end_of_line (str); - -} - - -/* ARM V6 RFE (Return from Exception) loads the PC and CPSR from the - word at the specified address and the following word - respectively. - Unconditionally executed. - Error if Rn is R15. -*/ - -static void -do_rfe (str) - char *str; -{ - int rn; - - skip_whitespace (str); - - if ((rn = reg_required_here (&str, 16)) == FAIL) - return; - - if (rn == REG_PC) - { - inst.error = BAD_PC; - return; - } - - skip_whitespace (str); - - if (*str == '!') - { - inst.instruction |= WRITE_BACK; - str++; - } - end_of_line (str); -} - -/* ARM V6 REV (Byte Reverse Word) reverses the byte order in a 32-bit - register (argument parse). - REV{} Rd, Rm. - Condition defaults to COND_ALWAYS. - Error if Rd or Rm are R15. */ - -static void -do_rev (str) - char* str; -{ - int rd, rm; - - skip_whitespace (str); - - if ((rd = reg_required_here (&str, 12)) == FAIL - || skip_past_comma (&str) == FAIL - || (rm = reg_required_here (&str, 0)) == FAIL) - inst.error = BAD_ARGS; - - else if (rd == REG_PC || rm == REG_PC) - inst.error = BAD_PC; - - else - end_of_line (str); -} - -/* ARM V6 Perform Two Sixteen Bit Integer Additions. (argument parse). - QADD16{} , , - Condition defaults to COND_ALWAYS. - Error if Rd, Rn or Rm are R15. */ - -static void -do_qadd16 (str) - char* str; -{ - int rd, rm, rn; - - skip_whitespace (str); - - if ((rd = reg_required_here (&str, 12)) == FAIL - || skip_past_comma (&str) == FAIL - || (rn = reg_required_here (&str, 16)) == FAIL - || skip_past_comma (&str) == FAIL - || (rm = reg_required_here (&str, 0)) == FAIL) - inst.error = BAD_ARGS; - - else if (rd == REG_PC || rm == REG_PC || rn == REG_PC) - inst.error = BAD_PC; - - else - end_of_line (str); -} - -/* ARM V6 Pack Halfword Bottom Top instruction (argument parse). - PKHBT {} , , {, LSL #} - Condition defaults to COND_ALWAYS. - Error if Rd, Rn or Rm are R15. */ - -static void -do_pkhbt (str) - char* str; -{ - do_pkh_core (str, SHIFT_LSL_IMMEDIATE); -} - -/* ARM V6 PKHTB (Argument Parse). */ - -static void -do_pkhtb (str) - char* str; -{ - do_pkh_core (str, SHIFT_ASR_IMMEDIATE); -} - -static void -do_pkh_core (str, shift) - char* str; - int shift; -{ - int rd, rn, rm; - - skip_whitespace (str); - if (((rd = reg_required_here (&str, 12)) == FAIL) - || (skip_past_comma (&str) == FAIL) - || ((rn = reg_required_here (&str, 16)) == FAIL) - || (skip_past_comma (&str) == FAIL) - || ((rm = reg_required_here (&str, 0)) == FAIL)) - { - inst.error = BAD_ARGS; - return; - } - - else if (rd == REG_PC || rn == REG_PC || rm == REG_PC) - { - inst.error = BAD_PC; - return; - } - - /* Check for optional shift immediate constant. */ - if (skip_past_comma (&str) == FAIL) - { - if (shift == SHIFT_ASR_IMMEDIATE) - { - /* If the shift specifier is ommited, turn the instruction - into pkhbt rd, rm, rn. First, switch the instruction - code, and clear the rn and rm fields. */ - inst.instruction &= 0xfff0f010; - /* Now, re-encode the registers. */ - inst.instruction |= (rm << 16) | rn; - } - return; - } - - decode_shift (&str, shift); -} - -/* ARM V6 Load Register Exclusive instruction (argument parse). - LDREX{} ] - Condition defaults to COND_ALWAYS. - Error if Rd or Rn are R15. - See ARMARMv6 A4.1.27: LDREX. */ - - -static void -do_ldrex (str) - char * str; -{ - int rd, rn; - - skip_whitespace (str); - - /* Parse Rd. */ - if (((rd = reg_required_here (&str, 12)) == FAIL) - || (skip_past_comma (&str) == FAIL)) - { - inst.error = BAD_ARGS; - return; - } - else if (rd == REG_PC) - { - inst.error = BAD_PC; - return; - } - skip_whitespace (str); - - /* Skip past '['. */ - if ((strlen (str) >= 1) - &&strncmp (str, "[", 1) == 0) - str+=1; - skip_whitespace (str); - - /* Parse Rn. */ - if ((rn = reg_required_here (&str, 16)) == FAIL) - { - inst.error = BAD_ARGS; - return; - } - else if (rn == REG_PC) - { - inst.error = BAD_PC; - return; - } - skip_whitespace (str); - - /* Skip past ']'. */ - if ((strlen (str) >= 1) - && strncmp (str, "]", 1) == 0) - str+=1; - - end_of_line (str); -} - -/* ARM V6 change processor state instruction (argument parse) - CPS, CPSIE, CSPID . */ - -static void -do_cps (str) - char * str; -{ - do_cps_mode (&str); - end_of_line (str); -} - -static void -do_cpsi (str) - char * str; -{ - do_cps_flags (&str, /*thumb_p=*/0); - - if (skip_past_comma (&str) == SUCCESS) - { - skip_whitespace (str); - do_cps_mode (&str); - } - end_of_line (str); -} - -static void -do_cps_mode (str) - char **str; -{ - expressionS expr; - - skip_whitespace (*str); - - if (! is_immediate_prefix (**str)) - { - inst.error = _("immediate expression expected"); - return; - } - - (*str)++; /* Strip off the immediate signifier. */ - if (my_get_expression (&expr, str)) - { - inst.error = _("bad expression"); - return; - } - - if (expr.X_op != O_constant) - { - inst.error = _("constant expression expected"); - return; - } - - /* The mode is a 5 bit field. Valid values are 0-31. */ - if (((unsigned) expr.X_add_number) > 31 - || (inst.reloc.exp.X_add_number) < 0) - { - inst.error = _("invalid constant"); - return; - } - - inst.instruction |= expr.X_add_number; -} - -static void -do_cps_flags (str, thumb_p) - char **str; - int thumb_p; -{ - struct cps_flag { - char character; - unsigned long arm_value; - unsigned long thumb_value; - }; - static struct cps_flag flag_table[] = { - {'a', 0x100, 0x4 }, - {'i', 0x080, 0x2 }, - {'f', 0x040, 0x1 } - }; - - int saw_a_flag = 0; - - skip_whitespace (*str); - - /* Get the a, f and i flags. */ - while (**str && **str != ',') - { - struct cps_flag *p; - struct cps_flag *q = flag_table + sizeof (flag_table)/sizeof (*p); - for (p = flag_table; p < q; ++p) - if (strncasecmp (*str, &p->character, 1) == 0) - { - inst.instruction |= (thumb_p ? p->thumb_value : p->arm_value); - saw_a_flag = 1; - break; - } - if (p == q) - { - inst.error = _("unrecognized flag"); - return; - } - (*str)++; - } - if (!saw_a_flag) - inst.error = _("no 'a', 'i', or 'f' flags for 'cps'"); -} - -/* THUMB V5 breakpoint instruction (argument parse) - BKPT . */ - -static void -do_t_bkpt (str) - char * str; -{ - expressionS expr; - unsigned long number; - - skip_whitespace (str); - - /* Allow optional leading '#'. */ - if (is_immediate_prefix (*str)) - str ++; - - memset (& expr, '\0', sizeof (expr)); - if (my_get_expression (& expr, & str) - || (expr.X_op != O_constant - /* As a convenience we allow 'bkpt' without an operand. */ - && expr.X_op != O_absent)) - { - inst.error = _("bad expression"); - return; - } - - number = expr.X_add_number; - - /* Check it fits an 8 bit unsigned. */ - if (number != (number & 0xff)) - { - inst.error = _("immediate value out of range"); - return; - } - - inst.instruction |= number; - - end_of_line (str); -} - -/* ARM V5 branch-link-exchange (argument parse) for BLX(1) only. - Expects inst.instruction is set for BLX(1). - Note: this is cloned from do_branch, and the reloc changed to be a - new one that can cope with setting one extra bit (the H bit). */ - -static void -do_branch25 (str) - char * str; -{ - if (my_get_expression (& inst.reloc.exp, & str)) - return; - -#ifdef OBJ_ELF - { - char * save_in; - - /* ScottB: February 5, 1998 */ - /* Check to see of PLT32 reloc required for the instruction. */ - - /* arm_parse_reloc() works on input_line_pointer. - We actually want to parse the operands to the branch instruction - passed in 'str'. Save the input pointer and restore it later. */ - save_in = input_line_pointer; - input_line_pointer = str; - - if (inst.reloc.exp.X_op == O_symbol - && *str == '(' - && arm_parse_reloc () == BFD_RELOC_ARM_PLT32) - { - inst.reloc.type = BFD_RELOC_ARM_PLT32; - inst.reloc.pc_rel = 0; - /* Modify str to point to after parsed operands, otherwise - end_of_line() will complain about the (PLT) left in str. */ - str = input_line_pointer; - } - else - { - inst.reloc.type = BFD_RELOC_ARM_PCREL_BLX; - inst.reloc.pc_rel = 1; - } - - input_line_pointer = save_in; - } -#else - inst.reloc.type = BFD_RELOC_ARM_PCREL_BLX; - inst.reloc.pc_rel = 1; -#endif /* OBJ_ELF */ - - end_of_line (str); -} - -/* ARM V5 branch-link-exchange instruction (argument parse) - BLX ie BLX(1) - BLX{} ie BLX(2) - Unfortunately, there are two different opcodes for this mnemonic. - So, the insns[].value is not used, and the code here zaps values - into inst.instruction. - Also, the can be 25 bits, hence has its own reloc. */ - -static void -do_blx (str) - char * str; -{ - char * mystr = str; - int rm; - - skip_whitespace (mystr); - rm = reg_required_here (& mystr, 0); - - /* The above may set inst.error. Ignore his opinion. */ - inst.error = 0; - - if (rm != FAIL) - { - /* Arg is a register. - Use the condition code our caller put in inst.instruction. - Pass ourselves off as a BX with a funny opcode. */ - inst.instruction |= 0x012fff30; - do_bx (str); - } - else - { - /* This must be is BLX , no condition allowed. */ - if (inst.instruction != COND_ALWAYS) - { - inst.error = BAD_COND; - return; - } - - inst.instruction = 0xfafffffe; - - /* Process like a B/BL, but with a different reloc. - Note that B/BL expecte fffffe, not 0, offset in the opcode table. */ - do_branch25 (str); - } -} - -/* ARM V5 Thumb BLX (argument parse) - BLX which is BLX(1) - BLX which is BLX(2) - Unfortunately, there are two different opcodes for this mnemonic. - So, the tinsns[].value is not used, and the code here zaps values - into inst.instruction. */ - -static void -do_t_blx (str) - char * str; -{ - char * mystr = str; - int rm; - - skip_whitespace (mystr); - inst.instruction = 0x4780; - - /* Note that this call is to the ARM register recognizer. BLX(2) - uses the ARM register space, not the Thumb one, so a call to - thumb_reg() would be wrong. */ - rm = reg_required_here (& mystr, 3); - inst.error = 0; - - if (rm != FAIL) - { - /* It's BLX(2). The .instruction was zapped with rm & is final. */ - inst.size = 2; - } - else - { - /* No ARM register. This must be BLX(1). Change the .instruction. */ - inst.instruction = 0xf7ffeffe; - inst.size = 4; - - if (my_get_expression (& inst.reloc.exp, & mystr)) - return; - - inst.reloc.type = BFD_RELOC_THUMB_PCREL_BLX; - inst.reloc.pc_rel = 1; - } - - end_of_line (mystr); -} - -/* ARM V5 breakpoint instruction (argument parse) - BKPT <16 bit unsigned immediate> - Instruction is not conditional. - The bit pattern given in insns[] has the COND_ALWAYS condition, - and it is an error if the caller tried to override that. */ - -static void -do_bkpt (str) - char * str; -{ - expressionS expr; - unsigned long number; - - skip_whitespace (str); - - /* Allow optional leading '#'. */ - if (is_immediate_prefix (* str)) - str++; - - memset (& expr, '\0', sizeof (expr)); - - if (my_get_expression (& expr, & str) - || (expr.X_op != O_constant - /* As a convenience we allow 'bkpt' without an operand. */ - && expr.X_op != O_absent)) - { - inst.error = _("bad expression"); - return; - } - - number = expr.X_add_number; - - /* Check it fits a 16 bit unsigned. */ - if (number != (number & 0xffff)) - { - inst.error = _("immediate value out of range"); - return; - } - - /* Top 12 of 16 bits to bits 19:8. */ - inst.instruction |= (number & 0xfff0) << 4; - - /* Bottom 4 of 16 bits to bits 3:0. */ - inst.instruction |= number & 0xf; - - end_of_line (str); -} - -/* THUMB CPS instruction (argument parse). */ - -static void -do_t_cps (str) - char *str; -{ - do_cps_flags (&str, /*thumb_p=*/1); - end_of_line (str); -} - -/* THUMB CPY instruction (argument parse). */ - -static void -do_t_cpy (str) - char *str; -{ - thumb_mov_compare (str, THUMB_CPY); -} - -/* THUMB SETEND instruction (argument parse). */ - -static void -do_t_setend (str) - char *str; -{ - if (do_endian_specifier (str)) - inst.instruction |= 0x8; -} - -static unsigned long check_iwmmxt_insn PARAMS ((char *, enum iwmmxt_insn_type, int)); - -/* Parse INSN_TYPE insn STR having a possible IMMEDIATE_SIZE immediate. */ - -static unsigned long -check_iwmmxt_insn (str, insn_type, immediate_size) - char * str; - enum iwmmxt_insn_type insn_type; - int immediate_size; -{ - int reg = 0; - const char * inst_error; - expressionS expr; - unsigned long number; - - inst_error = inst.error; - if (!inst.error) - inst.error = BAD_ARGS; - skip_whitespace (str); - - switch (insn_type) - { - case check_rd: - if ((reg = reg_required_here (&str, 12)) == FAIL) - return FAIL; - break; - - case check_wr: - if ((wreg_required_here (&str, 0, IWMMXT_REG_WR)) == FAIL) - return FAIL; - break; - - case check_wrwr: - if ((wreg_required_here (&str, 12, IWMMXT_REG_WR) == FAIL - || skip_past_comma (&str) == FAIL - || wreg_required_here (&str, 16, IWMMXT_REG_WR) == FAIL)) - return FAIL; - break; - - case check_wrwrwr: - if ((wreg_required_here (&str, 12, IWMMXT_REG_WR) == FAIL - || skip_past_comma (&str) == FAIL - || wreg_required_here (&str, 16, IWMMXT_REG_WR) == FAIL - || skip_past_comma (&str) == FAIL - || wreg_required_here (&str, 0, IWMMXT_REG_WR) == FAIL)) - return FAIL; - break; - - case check_wrwrwcg: - if ((wreg_required_here (&str, 12, IWMMXT_REG_WR) == FAIL - || skip_past_comma (&str) == FAIL - || wreg_required_here (&str, 16, IWMMXT_REG_WR) == FAIL - || skip_past_comma (&str) == FAIL - || wreg_required_here (&str, 0, IWMMXT_REG_WCG) == FAIL)) - return FAIL; - break; - - case check_tbcst: - if ((wreg_required_here (&str, 16, IWMMXT_REG_WR) == FAIL - || skip_past_comma (&str) == FAIL - || reg_required_here (&str, 12) == FAIL)) - return FAIL; - break; - - case check_tmovmsk: - if ((reg_required_here (&str, 12) == FAIL - || skip_past_comma (&str) == FAIL - || wreg_required_here (&str, 16, IWMMXT_REG_WR) == FAIL)) - return FAIL; - break; - - case check_tmia: - if ((wreg_required_here (&str, 5, IWMMXT_REG_WR) == FAIL - || skip_past_comma (&str) == FAIL - || reg_required_here (&str, 0) == FAIL - || skip_past_comma (&str) == FAIL - || reg_required_here (&str, 12) == FAIL)) - return FAIL; - break; - - case check_tmcrr: - if ((wreg_required_here (&str, 0, IWMMXT_REG_WR) == FAIL - || skip_past_comma (&str) == FAIL - || reg_required_here (&str, 12) == FAIL - || skip_past_comma (&str) == FAIL - || reg_required_here (&str, 16) == FAIL)) - return FAIL; - break; - - case check_tmrrc: - if ((reg_required_here (&str, 12) == FAIL - || skip_past_comma (&str) == FAIL - || reg_required_here (&str, 16) == FAIL - || skip_past_comma (&str) == FAIL - || wreg_required_here (&str, 0, IWMMXT_REG_WR) == FAIL)) - return FAIL; - break; - - case check_tmcr: - if ((wreg_required_here (&str, 16, IWMMXT_REG_WC) == FAIL - || skip_past_comma (&str) == FAIL - || reg_required_here (&str, 12) == FAIL)) - return FAIL; - break; - - case check_tmrc: - if ((reg_required_here (&str, 12) == FAIL - || skip_past_comma (&str) == FAIL - || wreg_required_here (&str, 16, IWMMXT_REG_WC) == FAIL)) - return FAIL; - break; - - case check_tinsr: - if ((wreg_required_here (&str, 16, IWMMXT_REG_WR) == FAIL - || skip_past_comma (&str) == FAIL - || reg_required_here (&str, 12) == FAIL - || skip_past_comma (&str) == FAIL)) - return FAIL; - break; - - case check_textrc: - if ((reg_required_here (&str, 12) == FAIL - || skip_past_comma (&str) == FAIL)) - return FAIL; - break; - - case check_waligni: - if ((wreg_required_here (&str, 12, IWMMXT_REG_WR) == FAIL - || skip_past_comma (&str) == FAIL - || wreg_required_here (&str, 16, IWMMXT_REG_WR) == FAIL - || skip_past_comma (&str) == FAIL - || wreg_required_here (&str, 0, IWMMXT_REG_WR) == FAIL - || skip_past_comma (&str) == FAIL)) - return FAIL; - break; - - case check_textrm: - if ((reg_required_here (&str, 12) == FAIL - || skip_past_comma (&str) == FAIL - || wreg_required_here (&str, 16, IWMMXT_REG_WR) == FAIL - || skip_past_comma (&str) == FAIL)) - return FAIL; - break; - - case check_wshufh: - if ((wreg_required_here (&str, 12, IWMMXT_REG_WR) == FAIL - || skip_past_comma (&str) == FAIL - || wreg_required_here (&str, 16, IWMMXT_REG_WR) == FAIL - || skip_past_comma (&str) == FAIL)) - return FAIL; - break; - } - - if (immediate_size == 0) - { - end_of_line (str); - inst.error = inst_error; - return reg; - } - else - { - skip_whitespace (str); - - /* Allow optional leading '#'. */ - if (is_immediate_prefix (* str)) - str++; - - memset (& expr, '\0', sizeof (expr)); - - if (my_get_expression (& expr, & str) || (expr.X_op != O_constant)) - { - inst.error = _("bad or missing expression"); - return FAIL; - } - - number = expr.X_add_number; - - if (number != (number & immediate_size)) - { - inst.error = _("immediate value out of range"); - return FAIL; - } - end_of_line (str); - inst.error = inst_error; - return number; - } -} - -static void -do_iwmmxt_byte_addr (str) - char * str; -{ - int op = (inst.instruction & 0x300) >> 8; - int reg; - - inst.instruction &= ~0x300; - inst.instruction |= (op & 1) << 22 | (op & 2) << 7; - - skip_whitespace (str); - - if ((reg = wreg_required_here (&str, 12, IWMMXT_REG_WR_OR_WC)) == FAIL - || skip_past_comma (& str) == FAIL - || cp_byte_address_required_here (&str) == FAIL) - { - if (! inst.error) - inst.error = BAD_ARGS; - } - else - end_of_line (str); - - if (wc_register (reg)) - { - as_bad (_("non-word size not supported with control register")); - inst.instruction |= 0xf0000100; - inst.instruction &= ~0x00400000; - } -} - -static void -do_iwmmxt_tandc (str) - char * str; -{ - int reg; - - reg = check_iwmmxt_insn (str, check_rd, 0); - - if (reg != REG_PC && !inst.error) - inst.error = _("only r15 allowed here"); -} - -static void -do_iwmmxt_tbcst (str) - char * str; -{ - check_iwmmxt_insn (str, check_tbcst, 0); -} - -static void -do_iwmmxt_textrc (str) - char * str; -{ - unsigned long number; - - if ((number = check_iwmmxt_insn (str, check_textrc, 7)) == (unsigned long) FAIL) - return; - - inst.instruction |= number & 0x7; -} - -static void -do_iwmmxt_textrm (str) - char * str; -{ - unsigned long number; - - if ((number = check_iwmmxt_insn (str, check_textrm, 7)) == (unsigned long) FAIL) - return; - - inst.instruction |= number & 0x7; -} - -static void -do_iwmmxt_tinsr (str) - char * str; -{ - unsigned long number; - - if ((number = check_iwmmxt_insn (str, check_tinsr, 7)) == (unsigned long) FAIL) - return; - - inst.instruction |= number & 0x7; -} - -static void -do_iwmmxt_tmcr (str) - char * str; -{ - check_iwmmxt_insn (str, check_tmcr, 0); -} - -static void -do_iwmmxt_tmcrr (str) - char * str; -{ - check_iwmmxt_insn (str, check_tmcrr, 0); -} - -static void -do_iwmmxt_tmia (str) - char * str; -{ - check_iwmmxt_insn (str, check_tmia, 0); -} - -static void -do_iwmmxt_tmovmsk (str) - char * str; -{ - check_iwmmxt_insn (str, check_tmovmsk, 0); -} - -static void -do_iwmmxt_tmrc (str) - char * str; -{ - check_iwmmxt_insn (str, check_tmrc, 0); -} - -static void -do_iwmmxt_tmrrc (str) - char * str; -{ - check_iwmmxt_insn (str, check_tmrrc, 0); -} - -static void -do_iwmmxt_torc (str) - char * str; -{ - check_iwmmxt_insn (str, check_rd, 0); -} - -static void -do_iwmmxt_waligni (str) - char * str; -{ - unsigned long number; - - if ((number = check_iwmmxt_insn (str, check_waligni, 7)) == (unsigned long) FAIL) - return; - - inst.instruction |= ((number & 0x7) << 20); -} - -static void -do_iwmmxt_wmov (str) - char * str; -{ - if (check_iwmmxt_insn (str, check_wrwr, 0) == (unsigned long) FAIL) - return; - - inst.instruction |= ((inst.instruction >> 16) & 0xf); -} - -static void -do_iwmmxt_word_addr (str) - char * str; -{ - int op = (inst.instruction & 0x300) >> 8; - int reg; - - inst.instruction &= ~0x300; - inst.instruction |= (op & 1) << 22 | (op & 2) << 7; - - skip_whitespace (str); - - if ((reg = wreg_required_here (&str, 12, IWMMXT_REG_WR_OR_WC)) == FAIL - || skip_past_comma (& str) == FAIL - || cp_address_required_here (& str, CP_WB_OK) == FAIL) - { - if (! inst.error) - inst.error = BAD_ARGS; - } - else - end_of_line (str); - - if (wc_register (reg)) - { - if ((inst.instruction & COND_MASK) != COND_ALWAYS) - as_bad (_("conditional execution not supported with control register")); - if (op != 2) - as_bad (_("non-word size not supported with control register")); - inst.instruction |= 0xf0000100; - inst.instruction &= ~0x00400000; - } -} - -static void -do_iwmmxt_wrwr (str) - char * str; -{ - check_iwmmxt_insn (str, check_wrwr, 0); -} - -static void -do_iwmmxt_wrwrwcg (str) - char * str; -{ - check_iwmmxt_insn (str, check_wrwrwcg, 0); -} - -static void -do_iwmmxt_wrwrwr (str) - char * str; -{ - check_iwmmxt_insn (str, check_wrwrwr, 0); -} - -static void -do_iwmmxt_wshufh (str) - char * str; -{ - unsigned long number; - - if ((number = check_iwmmxt_insn (str, check_wshufh, 0xff)) == (unsigned long) FAIL) - return; - - inst.instruction |= ((number & 0xf0) << 16) | (number & 0xf); -} - -static void -do_iwmmxt_wzero (str) - char * str; -{ - if (check_iwmmxt_insn (str, check_wr, 0) == (unsigned long) FAIL) - return; - - inst.instruction |= ((inst.instruction & 0xf) << 12) | ((inst.instruction & 0xf) << 16); -} - -/* Xscale multiply-accumulate (argument parse) - MIAcc acc0,Rm,Rs - MIAPHcc acc0,Rm,Rs - MIAxycc acc0,Rm,Rs. */ - -static void -do_xsc_mia (str) - char * str; -{ - int rs; - int rm; - - if (accum0_required_here (& str) == FAIL) - inst.error = ERR_NO_ACCUM; - - else if (skip_past_comma (& str) == FAIL - || (rm = reg_required_here (& str, 0)) == FAIL) - inst.error = BAD_ARGS; - - else if (skip_past_comma (& str) == FAIL - || (rs = reg_required_here (& str, 12)) == FAIL) - inst.error = BAD_ARGS; - - /* inst.instruction has now been zapped with both rm and rs. */ - else if (rm == REG_PC || rs == REG_PC) - inst.error = BAD_PC; /* Undefined result if rm or rs is R15. */ - - else - end_of_line (str); -} - -/* Xscale move-accumulator-register (argument parse) - - MARcc acc0,RdLo,RdHi. */ - -static void -do_xsc_mar (str) - char * str; -{ - int rdlo, rdhi; - - if (accum0_required_here (& str) == FAIL) - inst.error = ERR_NO_ACCUM; - - else if (skip_past_comma (& str) == FAIL - || (rdlo = reg_required_here (& str, 12)) == FAIL) - inst.error = BAD_ARGS; - - else if (skip_past_comma (& str) == FAIL - || (rdhi = reg_required_here (& str, 16)) == FAIL) - inst.error = BAD_ARGS; - - /* inst.instruction has now been zapped with both rdlo and rdhi. */ - else if (rdlo == REG_PC || rdhi == REG_PC) - inst.error = BAD_PC; /* Undefined result if rdlo or rdhi is R15. */ - - else - end_of_line (str); -} - -/* Xscale move-register-accumulator (argument parse) - - MRAcc RdLo,RdHi,acc0. */ - -static void -do_xsc_mra (str) - char * str; -{ - int rdlo; - int rdhi; - - skip_whitespace (str); - - if ((rdlo = reg_required_here (& str, 12)) == FAIL) - inst.error = BAD_ARGS; - - else if (skip_past_comma (& str) == FAIL - || (rdhi = reg_required_here (& str, 16)) == FAIL) - inst.error = BAD_ARGS; - - else if (skip_past_comma (& str) == FAIL - || accum0_required_here (& str) == FAIL) - inst.error = ERR_NO_ACCUM; - - /* inst.instruction has now been zapped with both rdlo and rdhi. */ - else if (rdlo == rdhi) - inst.error = BAD_ARGS; /* Undefined result if 2 writes to same reg. */ - - else if (rdlo == REG_PC || rdhi == REG_PC) - inst.error = BAD_PC; /* Undefined result if rdlo or rdhi is R15. */ - else - end_of_line (str); -} - -/* ARMv5TE: Preload-Cache - - PLD - - Syntactically, like LDR with B=1, W=0, L=1. */ - -static void -do_pld (str) - char * str; -{ - int rd; - - skip_whitespace (str); - - if (* str != '[') - { - inst.error = _("'[' expected after PLD mnemonic"); - return; - } - - ++str; - skip_whitespace (str); - - if ((rd = reg_required_here (& str, 16)) == FAIL) - return; - - skip_whitespace (str); - - if (*str == ']') - { - /* [Rn], ... ? */ - ++str; - skip_whitespace (str); - - /* Post-indexed addressing is not allowed with PLD. */ - if (skip_past_comma (&str) == SUCCESS) - { - inst.error - = _("post-indexed expression used in preload instruction"); - return; - } - else if (*str == '!') /* [Rn]! */ - { - inst.error = _("writeback used in preload instruction"); - ++str; - } - else /* [Rn] */ - inst.instruction |= INDEX_UP | PRE_INDEX; - } - else /* [Rn, ...] */ - { - if (skip_past_comma (& str) == FAIL) - { - inst.error = _("pre-indexed expression expected"); - return; - } - - if (ldst_extend (&str) == FAIL) - return; - - skip_whitespace (str); - - if (* str != ']') - { - inst.error = _("missing ]"); - return; - } - - ++ str; - skip_whitespace (str); - - if (* str == '!') /* [Rn]! */ - { - inst.error = _("writeback used in preload instruction"); - ++ str; - } - - inst.instruction |= PRE_INDEX; - } - - end_of_line (str); -} - -/* ARMv5TE load-consecutive (argument parse) - Mode is like LDRH. - - LDRccD R, mode - STRccD R, mode. */ - -static void -do_ldrd (str) - char * str; -{ - int rd; - int rn; - - skip_whitespace (str); - - if ((rd = reg_required_here (& str, 12)) == FAIL) - { - inst.error = BAD_ARGS; - return; - } - - if (skip_past_comma (& str) == FAIL - || (rn = ld_mode_required_here (& str)) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - /* inst.instruction has now been zapped with Rd and the addressing mode. */ - if (rd & 1) /* Unpredictable result if Rd is odd. */ - { - inst.error = _("destination register must be even"); - return; - } - - if (rd == REG_LR) - { - inst.error = _("r14 not allowed here"); - return; - } - - if (((rd == rn) || (rd + 1 == rn)) - && ((inst.instruction & WRITE_BACK) - || (!(inst.instruction & PRE_INDEX)))) - as_warn (_("pre/post-indexing used when modified address register is destination")); - - /* For an index-register load, the index register must not overlap the - destination (even if not write-back). */ - if ((inst.instruction & V4_STR_BIT) == 0 - && (inst.instruction & HWOFFSET_IMM) == 0) - { - int rm = inst.instruction & 0x0000000f; - - if (rm == rd || (rm == rd + 1)) - as_warn (_("ldrd destination registers must not overlap index register")); - } - - end_of_line (str); } +#define skip_past_comma(str) skip_past_char (str, ',') -/* Returns the index into fp_values of a floating point number, - or -1 if not in the table. */ - -static int -my_get_float_expression (str) - char ** str; -{ - LITTLENUM_TYPE words[MAX_LITTLENUMS]; - char * save_in; - expressionS exp; - int i; - int j; - - memset (words, 0, MAX_LITTLENUMS * sizeof (LITTLENUM_TYPE)); - - /* Look for a raw floating point number. */ - if ((save_in = atof_ieee (*str, 'x', words)) != NULL - && is_end_of_line[(unsigned char) *save_in]) - { - for (i = 0; i < NUM_FLOAT_VALS; i++) - { - for (j = 0; j < MAX_LITTLENUMS; j++) - { - if (words[j] != fp_values[i][j]) - break; - } - - if (j == MAX_LITTLENUMS) - { - *str = save_in; - return i; - } - } - } - - /* Try and parse a more complex expression, this will probably fail - unless the code uses a floating point prefix (eg "0f"). */ - save_in = input_line_pointer; - input_line_pointer = *str; - if (expression (&exp) == absolute_section - && exp.X_op == O_big - && exp.X_add_number < 0) - { - /* FIXME: 5 = X_PRECISION, should be #define'd where we can use it. - Ditto for 15. */ - if (gen_to_words (words, 5, (long) 15) == 0) - { - for (i = 0; i < NUM_FLOAT_VALS; i++) - { - for (j = 0; j < MAX_LITTLENUMS; j++) - { - if (words[j] != fp_values[i][j]) - break; - } - - if (j == MAX_LITTLENUMS) - { - *str = input_line_pointer; - input_line_pointer = save_in; - return i; - } - } - } - } - - *str = input_line_pointer; - input_line_pointer = save_in; - return -1; -} +/* Arithmetic expressions (possibly involving symbols). */ /* Return TRUE if anything in the expression is a bignum. */ static int -walk_no_bignums (sp) - symbolS * sp; +walk_no_bignums (symbolS * sp) { if (symbol_get_value_expression (sp)->X_op == O_big) return 1; @@ -6814,13 +687,40 @@ walk_no_bignums (sp) static int in_my_get_expression = 0; +/* Third argument to my_get_expression. */ +#define GE_NO_PREFIX 0 +#define GE_IMM_PREFIX 1 +#define GE_OPT_PREFIX 2 + static int -my_get_expression (ep, str) - expressionS * ep; - char ** str; +my_get_expression (expressionS * ep, char ** str, int prefix_mode) { char * save_in; - segT seg; + segT seg; + + /* In unified syntax, all prefixes are optional. */ + if (unified_syntax) + prefix_mode = GE_OPT_PREFIX; + + switch (prefix_mode) + { + case GE_NO_PREFIX: break; + case GE_IMM_PREFIX: + if (!is_immediate_prefix (**str)) + { + inst.error = _("immediate expression requires a # prefix"); + return FAIL; + } + (*str)++; + break; + case GE_OPT_PREFIX: + if (is_immediate_prefix (**str)) + (*str)++; + break; + default: abort (); + } + + memset (ep, 0, sizeof (expressionS)); save_in = input_line_pointer; input_line_pointer = *str; @@ -6833,6 +733,8 @@ my_get_expression (ep, str) /* We found a bad expression in md_operand(). */ *str = input_line_pointer; input_line_pointer = save_in; + if (inst.error == NULL) + inst.error = _("bad expression"); return 1; } @@ -6843,7 +745,7 @@ my_get_expression (ep, str) && seg != bss_section && seg != undefined_section) { - inst.error = _("bad_segment"); + inst.error = _("bad segment"); *str = input_line_pointer; input_line_pointer = save_in; return 1; @@ -6851,7 +753,7 @@ my_get_expression (ep, str) #endif /* Get rid of any bignums now, so that we don't generate an error for which - we can't establish a line number later on. Big numbers are never valid + we can't establish a line number later on. Big numbers are never valid in instructions, which is where this routine is always called. */ if (ep->X_op == O_big || (ep->X_add_symbol @@ -6870,5027 +772,13 @@ my_get_expression (ep, str) return 0; } -/* We handle all bad expressions here, so that we can report the faulty - instruction in the error message. */ -void -md_operand (expr) - expressionS *expr; -{ - if (in_my_get_expression) - { - expr->X_op = O_illegal; - if (inst.error == NULL) - inst.error = _("bad expression"); - } -} - -/* KIND indicates what kind of shifts are accepted. */ - -static int -decode_shift (str, kind) - char ** str; - int kind; -{ - const struct asm_shift_name * shift; - char * p; - char c; - - skip_whitespace (* str); - - for (p = * str; ISALPHA (* p); p ++) - ; - - if (p == * str) - { - inst.error = _("shift expression expected"); - return FAIL; - } - - c = * p; - * p = '\0'; - shift = (const struct asm_shift_name *) hash_find (arm_shift_hsh, * str); - * p = c; - - if (shift == NULL) - { - inst.error = _("shift expression expected"); - return FAIL; - } - - assert (shift->properties->index == shift_properties[shift->properties->index].index); - - if (kind == SHIFT_LSL_OR_ASR_IMMEDIATE - && shift->properties->index != SHIFT_LSL - && shift->properties->index != SHIFT_ASR) - { - inst.error = _("'LSL' or 'ASR' required"); - return FAIL; - } - else if (kind == SHIFT_LSL_IMMEDIATE - && shift->properties->index != SHIFT_LSL) - { - inst.error = _("'LSL' required"); - return FAIL; - } - else if (kind == SHIFT_ASR_IMMEDIATE - && shift->properties->index != SHIFT_ASR) - { - inst.error = _("'ASR' required"); - return FAIL; - } - - if (shift->properties->index == SHIFT_RRX) - { - * str = p; - inst.instruction |= shift->properties->bit_field; - return SUCCESS; - } - - skip_whitespace (p); - - if (kind == NO_SHIFT_RESTRICT && reg_required_here (& p, 8) != FAIL) - { - inst.instruction |= shift->properties->bit_field | SHIFT_BY_REG; - * str = p; - return SUCCESS; - } - else if (! is_immediate_prefix (* p)) - { - inst.error = (NO_SHIFT_RESTRICT - ? _("shift requires register or #expression") - : _("shift requires #expression")); - * str = p; - return FAIL; - } - - inst.error = NULL; - p ++; - - if (my_get_expression (& inst.reloc.exp, & p)) - return FAIL; - - /* Validate some simple #expressions. */ - if (inst.reloc.exp.X_op == O_constant) - { - unsigned num = inst.reloc.exp.X_add_number; - - /* Reject operations greater than 32. */ - if (num > 32 - /* Reject a shift of 0 unless the mode allows it. */ - || (num == 0 && shift->properties->allows_0 == 0) - /* Reject a shift of 32 unless the mode allows it. */ - || (num == 32 && shift->properties->allows_32 == 0) - ) - { - /* As a special case we allow a shift of zero for - modes that do not support it to be recoded as an - logical shift left of zero (ie nothing). We warn - about this though. */ - if (num == 0) - { - as_warn (_("shift of 0 ignored.")); - shift = & shift_names[0]; - assert (shift->properties->index == SHIFT_LSL); - } - else - { - inst.error = _("invalid immediate shift"); - return FAIL; - } - } - - /* Shifts of 32 are encoded as 0, for those shifts that - support it. */ - if (num == 32) - num = 0; - - inst.instruction |= (num << 7) | shift->properties->bit_field; - } - else - { - inst.reloc.type = BFD_RELOC_ARM_SHIFT_IMM; - inst.reloc.pc_rel = 0; - inst.instruction |= shift->properties->bit_field; - } - - * str = p; - return SUCCESS; -} - -/* Do those data_ops which can take a negative immediate constant - by altering the instruction. A bit of a hack really. - MOV <-> MVN - AND <-> BIC - ADC <-> SBC - by inverting the second operand, and - ADD <-> SUB - CMP <-> CMN - by negating the second operand. */ - -static int -negate_data_op (instruction, value) - unsigned long * instruction; - unsigned long value; -{ - int op, new_inst; - unsigned long negated, inverted; - - negated = validate_immediate (-value); - inverted = validate_immediate (~value); - - op = (*instruction >> DATA_OP_SHIFT) & 0xf; - switch (op) - { - /* First negates. */ - case OPCODE_SUB: /* ADD <-> SUB */ - new_inst = OPCODE_ADD; - value = negated; - break; - - case OPCODE_ADD: - new_inst = OPCODE_SUB; - value = negated; - break; - - case OPCODE_CMP: /* CMP <-> CMN */ - new_inst = OPCODE_CMN; - value = negated; - break; - - case OPCODE_CMN: - new_inst = OPCODE_CMP; - value = negated; - break; - - /* Now Inverted ops. */ - case OPCODE_MOV: /* MOV <-> MVN */ - new_inst = OPCODE_MVN; - value = inverted; - break; - - case OPCODE_MVN: - new_inst = OPCODE_MOV; - value = inverted; - break; - - case OPCODE_AND: /* AND <-> BIC */ - new_inst = OPCODE_BIC; - value = inverted; - break; - - case OPCODE_BIC: - new_inst = OPCODE_AND; - value = inverted; - break; - - case OPCODE_ADC: /* ADC <-> SBC */ - new_inst = OPCODE_SBC; - value = inverted; - break; - - case OPCODE_SBC: - new_inst = OPCODE_ADC; - value = inverted; - break; - - /* We cannot do anything. */ - default: - return FAIL; - } - - if (value == (unsigned) FAIL) - return FAIL; - - *instruction &= OPCODE_MASK; - *instruction |= new_inst << DATA_OP_SHIFT; - return value; -} - -static int -data_op2 (str) - char ** str; -{ - int value; - expressionS expr; - - skip_whitespace (* str); - - if (reg_required_here (str, 0) != FAIL) - { - if (skip_past_comma (str) == SUCCESS) - /* Shift operation on register. */ - return decode_shift (str, NO_SHIFT_RESTRICT); - - return SUCCESS; - } - else - { - /* Immediate expression. */ - if (is_immediate_prefix (**str)) - { - (*str)++; - inst.error = NULL; - - if (my_get_expression (&inst.reloc.exp, str)) - return FAIL; - - if (inst.reloc.exp.X_add_symbol) - { - inst.reloc.type = BFD_RELOC_ARM_IMMEDIATE; - inst.reloc.pc_rel = 0; - } - else - { - if (skip_past_comma (str) == SUCCESS) - { - /* #x, y -- ie explicit rotation by Y. */ - if (my_get_expression (&expr, str)) - return FAIL; - - if (expr.X_op != O_constant) - { - inst.error = _("constant expression expected"); - return FAIL; - } - - /* Rotate must be a multiple of 2. */ - if (((unsigned) expr.X_add_number) > 30 - || (expr.X_add_number & 1) != 0 - || ((unsigned) inst.reloc.exp.X_add_number) > 255) - { - inst.error = _("invalid constant"); - return FAIL; - } - inst.instruction |= INST_IMMEDIATE; - inst.instruction |= inst.reloc.exp.X_add_number; - inst.instruction |= expr.X_add_number << 7; - return SUCCESS; - } - - /* Implicit rotation, select a suitable one. */ - value = validate_immediate (inst.reloc.exp.X_add_number); - - if (value == FAIL) - { - /* Can't be done. Perhaps the code reads something like - "add Rd, Rn, #-n", where "sub Rd, Rn, #n" would be OK. */ - if ((value = negate_data_op (&inst.instruction, - inst.reloc.exp.X_add_number)) - == FAIL) - { - inst.error = _("invalid constant"); - return FAIL; - } - } - - inst.instruction |= value; - } - - inst.instruction |= INST_IMMEDIATE; - return SUCCESS; - } - - (*str)++; - inst.error = _("register or shift expression expected"); - return FAIL; - } -} - -static int -fp_op2 (str) - char ** str; -{ - skip_whitespace (* str); - - if (fp_reg_required_here (str, 0) != FAIL) - return SUCCESS; - else - { - /* Immediate expression. */ - if (*((*str)++) == '#') - { - int i; - - inst.error = NULL; - - skip_whitespace (* str); - - /* First try and match exact strings, this is to guarantee - that some formats will work even for cross assembly. */ - - for (i = 0; fp_const[i]; i++) - { - if (strncmp (*str, fp_const[i], strlen (fp_const[i])) == 0) - { - char *start = *str; - - *str += strlen (fp_const[i]); - if (is_end_of_line[(unsigned char) **str]) - { - inst.instruction |= i + 8; - return SUCCESS; - } - *str = start; - } - } - - /* Just because we didn't get a match doesn't mean that the - constant isn't valid, just that it is in a format that we - don't automatically recognize. Try parsing it with - the standard expression routines. */ - if ((i = my_get_float_expression (str)) >= 0) - { - inst.instruction |= i + 8; - return SUCCESS; - } - - inst.error = _("invalid floating point immediate expression"); - return FAIL; - } - inst.error = - _("floating point register or immediate expression expected"); - return FAIL; - } -} - -static void -do_arit (str) - char * str; -{ - skip_whitespace (str); - - if (reg_required_here (&str, 12) == FAIL - || skip_past_comma (&str) == FAIL - || reg_required_here (&str, 16) == FAIL - || skip_past_comma (&str) == FAIL - || data_op2 (&str) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - end_of_line (str); -} - -static void -do_adr (str) - char * str; -{ - /* This is a pseudo-op of the form "adr rd, label" to be converted - into a relative address of the form "add rd, pc, #label-.-8". */ - skip_whitespace (str); - - if (reg_required_here (&str, 12) == FAIL - || skip_past_comma (&str) == FAIL - || my_get_expression (&inst.reloc.exp, &str)) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - /* Frag hacking will turn this into a sub instruction if the offset turns - out to be negative. */ - inst.reloc.type = BFD_RELOC_ARM_IMMEDIATE; -#ifndef TE_WINCE - inst.reloc.exp.X_add_number -= 8; /* PC relative adjust. */ -#endif - inst.reloc.pc_rel = 1; - - end_of_line (str); -} - -static void -do_adrl (str) - char * str; -{ - /* This is a pseudo-op of the form "adrl rd, label" to be converted - into a relative address of the form: - add rd, pc, #low(label-.-8)" - add rd, rd, #high(label-.-8)" */ - - skip_whitespace (str); - - if (reg_required_here (&str, 12) == FAIL - || skip_past_comma (&str) == FAIL - || my_get_expression (&inst.reloc.exp, &str)) - { - if (!inst.error) - inst.error = BAD_ARGS; - - return; - } - - end_of_line (str); - /* Frag hacking will turn this into a sub instruction if the offset turns - out to be negative. */ - inst.reloc.type = BFD_RELOC_ARM_ADRL_IMMEDIATE; -#ifndef TE_WINCE - inst.reloc.exp.X_add_number -= 8; /* PC relative adjust */ -#endif - inst.reloc.pc_rel = 1; - inst.size = INSN_SIZE * 2; -} - -static void -do_cmp (str) - char * str; -{ - skip_whitespace (str); - - if (reg_required_here (&str, 16) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - if (skip_past_comma (&str) == FAIL - || data_op2 (&str) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - end_of_line (str); -} - -static void -do_mov (str) - char * str; -{ - skip_whitespace (str); - - if (reg_required_here (&str, 12) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - if (skip_past_comma (&str) == FAIL - || data_op2 (&str) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - end_of_line (str); -} - -static int -ldst_extend (str) - char ** str; -{ - int add = INDEX_UP; - - switch (**str) - { - case '#': - case '$': - (*str)++; - if (my_get_expression (& inst.reloc.exp, str)) - return FAIL; - - if (inst.reloc.exp.X_op == O_constant) - { - int value = inst.reloc.exp.X_add_number; - - if (value < -4095 || value > 4095) - { - inst.error = _("address offset too large"); - return FAIL; - } - - if (value < 0) - { - value = -value; - add = 0; - } - - inst.instruction |= add | value; - } - else - { - inst.reloc.type = BFD_RELOC_ARM_OFFSET_IMM; - inst.reloc.pc_rel = 0; - } - return SUCCESS; - - case '-': - add = 0; - /* Fall through. */ - - case '+': - (*str)++; - /* Fall through. */ - - default: - if (reg_required_here (str, 0) == FAIL) - return FAIL; - - inst.instruction |= add | OFFSET_REG; - if (skip_past_comma (str) == SUCCESS) - return decode_shift (str, SHIFT_IMMEDIATE); - - return SUCCESS; - } -} - -static void -do_ldst (str) - char * str; -{ - int pre_inc = 0; - int conflict_reg; - int value; - - skip_whitespace (str); - - if ((conflict_reg = reg_required_here (&str, 12)) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - if (skip_past_comma (&str) == FAIL) - { - inst.error = _("address expected"); - return; - } - - if (*str == '[') - { - int reg; - - str++; - - skip_whitespace (str); - - if ((reg = reg_required_here (&str, 16)) == FAIL) - return; - - /* Conflicts can occur on stores as well as loads. */ - conflict_reg = (conflict_reg == reg); - - skip_whitespace (str); - - if (*str == ']') - { - str ++; - - if (skip_past_comma (&str) == SUCCESS) - { - /* [Rn],... (post inc) */ - if (ldst_extend (&str) == FAIL) - return; - if (conflict_reg) - as_warn (_("%s register same as write-back base"), - ((inst.instruction & LOAD_BIT) - ? _("destination") : _("source"))); - } - else - { - /* [Rn] */ - skip_whitespace (str); - - if (*str == '!') - { - if (conflict_reg) - as_warn (_("%s register same as write-back base"), - ((inst.instruction & LOAD_BIT) - ? _("destination") : _("source"))); - str++; - inst.instruction |= WRITE_BACK; - } - - inst.instruction |= INDEX_UP; - pre_inc = 1; - } - } - else - { - /* [Rn,...] */ - if (skip_past_comma (&str) == FAIL) - { - inst.error = _("pre-indexed expression expected"); - return; - } - - pre_inc = 1; - if (ldst_extend (&str) == FAIL) - return; - - skip_whitespace (str); - - if (*str++ != ']') - { - inst.error = _("missing ]"); - return; - } - - skip_whitespace (str); - - if (*str == '!') - { - if (conflict_reg) - as_warn (_("%s register same as write-back base"), - ((inst.instruction & LOAD_BIT) - ? _("destination") : _("source"))); - str++; - inst.instruction |= WRITE_BACK; - } - } - } - else if (*str == '=') - { - if ((inst.instruction & LOAD_BIT) == 0) - { - inst.error = _("invalid pseudo operation"); - return; - } - - /* Parse an "ldr Rd, =expr" instruction; this is another pseudo op. */ - str++; - - skip_whitespace (str); - - if (my_get_expression (&inst.reloc.exp, &str)) - return; - - if (inst.reloc.exp.X_op != O_constant - && inst.reloc.exp.X_op != O_symbol) - { - inst.error = _("constant expression expected"); - return; - } - - if (inst.reloc.exp.X_op == O_constant) - { - value = validate_immediate (inst.reloc.exp.X_add_number); - - if (value != FAIL) - { - /* This can be done with a mov instruction. */ - inst.instruction &= LITERAL_MASK; - inst.instruction |= (INST_IMMEDIATE - | (OPCODE_MOV << DATA_OP_SHIFT)); - inst.instruction |= value & 0xfff; - end_of_line (str); - return; - } - - value = validate_immediate (~inst.reloc.exp.X_add_number); - - if (value != FAIL) - { - /* This can be done with a mvn instruction. */ - inst.instruction &= LITERAL_MASK; - inst.instruction |= (INST_IMMEDIATE - | (OPCODE_MVN << DATA_OP_SHIFT)); - inst.instruction |= value & 0xfff; - end_of_line (str); - return; - } - } - - /* Insert into literal pool. */ - if (add_to_lit_pool () == FAIL) - { - if (!inst.error) - inst.error = _("literal pool insertion failed"); - return; - } - - /* Change the instruction exp to point to the pool. */ - inst.reloc.type = BFD_RELOC_ARM_LITERAL; - inst.reloc.pc_rel = 1; - inst.instruction |= (REG_PC << 16); - pre_inc = 1; - } - else - { - if (my_get_expression (&inst.reloc.exp, &str)) - return; - - inst.reloc.type = BFD_RELOC_ARM_OFFSET_IMM; -#ifndef TE_WINCE - /* PC rel adjust. */ - inst.reloc.exp.X_add_number -= 8; -#endif - inst.reloc.pc_rel = 1; - inst.instruction |= (REG_PC << 16); - pre_inc = 1; - } - - inst.instruction |= (pre_inc ? PRE_INDEX : 0); - end_of_line (str); -} - -static void -do_ldstt (str) - char * str; -{ - int conflict_reg; - - skip_whitespace (str); - - if ((conflict_reg = reg_required_here (& str, 12)) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - if (skip_past_comma (& str) == FAIL) - { - inst.error = _("address expected"); - return; - } - - if (*str == '[') - { - int reg; - - str++; - - skip_whitespace (str); - - if ((reg = reg_required_here (&str, 16)) == FAIL) - return; - - /* ldrt/strt always use post-indexed addressing, so if the base is - the same as Rd, we warn. */ - if (conflict_reg == reg) - as_warn (_("%s register same as write-back base"), - ((inst.instruction & LOAD_BIT) - ? _("destination") : _("source"))); - - skip_whitespace (str); - - if (*str == ']') - { - str ++; - - if (skip_past_comma (&str) == SUCCESS) - { - /* [Rn],... (post inc) */ - if (ldst_extend (&str) == FAIL) - return; - } - else - { - /* [Rn] */ - skip_whitespace (str); - - /* Skip a write-back '!'. */ - if (*str == '!') - str++; - - inst.instruction |= INDEX_UP; - } - } - else - { - inst.error = _("post-indexed expression expected"); - return; - } - } - else - { - inst.error = _("post-indexed expression expected"); - return; - } - - end_of_line (str); -} - -static int -ldst_extend_v4 (str) - char ** str; -{ - int add = INDEX_UP; - - switch (**str) - { - case '#': - case '$': - (*str)++; - if (my_get_expression (& inst.reloc.exp, str)) - return FAIL; - - if (inst.reloc.exp.X_op == O_constant) - { - int value = inst.reloc.exp.X_add_number; - - if (value < -255 || value > 255) - { - inst.error = _("address offset too large"); - return FAIL; - } - - if (value < 0) - { - value = -value; - add = 0; - } - - /* Halfword and signextension instructions have the - immediate value split across bits 11..8 and bits 3..0. */ - inst.instruction |= (add | HWOFFSET_IMM - | ((value >> 4) << 8) | (value & 0xF)); - } - else - { - inst.instruction |= HWOFFSET_IMM; - inst.reloc.type = BFD_RELOC_ARM_OFFSET_IMM8; - inst.reloc.pc_rel = 0; - } - return SUCCESS; - - case '-': - add = 0; - /* Fall through. */ - - case '+': - (*str)++; - /* Fall through. */ - - default: - if (reg_required_here (str, 0) == FAIL) - return FAIL; - - inst.instruction |= add; - return SUCCESS; - } -} - -/* Halfword and signed-byte load/store operations. */ -static void -do_ldstv4 (str) - char * str; -{ - int pre_inc = 0; - int conflict_reg; - int value; - - skip_whitespace (str); - - if ((conflict_reg = reg_required_here (& str, 12)) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - if (skip_past_comma (& str) == FAIL) - { - inst.error = _("address expected"); - return; - } - - if (*str == '[') - { - int reg; - - str++; - - skip_whitespace (str); - - if ((reg = reg_required_here (&str, 16)) == FAIL) - return; - - /* Conflicts can occur on stores as well as loads. */ - conflict_reg = (conflict_reg == reg); - - skip_whitespace (str); - - if (*str == ']') - { - str ++; - - if (skip_past_comma (&str) == SUCCESS) - { - /* [Rn],... (post inc) */ - if (ldst_extend_v4 (&str) == FAIL) - return; - if (conflict_reg) - as_warn (_("%s register same as write-back base"), - ((inst.instruction & LOAD_BIT) - ? _("destination") : _("source"))); - } - else - { - /* [Rn] */ - inst.instruction |= HWOFFSET_IMM; - - skip_whitespace (str); - - if (*str == '!') - { - if (conflict_reg) - as_warn (_("%s register same as write-back base"), - ((inst.instruction & LOAD_BIT) - ? _("destination") : _("source"))); - str++; - inst.instruction |= WRITE_BACK; - } - - inst.instruction |= INDEX_UP; - pre_inc = 1; - } - } - else - { - /* [Rn,...] */ - if (skip_past_comma (&str) == FAIL) - { - inst.error = _("pre-indexed expression expected"); - return; - } - - pre_inc = 1; - if (ldst_extend_v4 (&str) == FAIL) - return; - - skip_whitespace (str); - - if (*str++ != ']') - { - inst.error = _("missing ]"); - return; - } - - skip_whitespace (str); - - if (*str == '!') - { - if (conflict_reg) - as_warn (_("%s register same as write-back base"), - ((inst.instruction & LOAD_BIT) - ? _("destination") : _("source"))); - str++; - inst.instruction |= WRITE_BACK; - } - } - } - else if (*str == '=') - { - if ((inst.instruction & LOAD_BIT) == 0) - { - inst.error = _("invalid pseudo operation"); - return; - } - - /* XXX Does this work correctly for half-word/byte ops? */ - /* Parse an "ldr Rd, =expr" instruction; this is another pseudo op. */ - str++; - - skip_whitespace (str); - - if (my_get_expression (&inst.reloc.exp, &str)) - return; - - if (inst.reloc.exp.X_op != O_constant - && inst.reloc.exp.X_op != O_symbol) - { - inst.error = _("constant expression expected"); - return; - } - - if (inst.reloc.exp.X_op == O_constant) - { - value = validate_immediate (inst.reloc.exp.X_add_number); - - if (value != FAIL) - { - /* This can be done with a mov instruction. */ - inst.instruction &= LITERAL_MASK; - inst.instruction |= INST_IMMEDIATE | (OPCODE_MOV << DATA_OP_SHIFT); - inst.instruction |= value & 0xfff; - end_of_line (str); - return; - } - - value = validate_immediate (~ inst.reloc.exp.X_add_number); - - if (value != FAIL) - { - /* This can be done with a mvn instruction. */ - inst.instruction &= LITERAL_MASK; - inst.instruction |= INST_IMMEDIATE | (OPCODE_MVN << DATA_OP_SHIFT); - inst.instruction |= value & 0xfff; - end_of_line (str); - return; - } - } - - /* Insert into literal pool. */ - if (add_to_lit_pool () == FAIL) - { - if (!inst.error) - inst.error = _("literal pool insertion failed"); - return; - } - - /* Change the instruction exp to point to the pool. */ - inst.instruction |= HWOFFSET_IMM; - inst.reloc.type = BFD_RELOC_ARM_HWLITERAL; - inst.reloc.pc_rel = 1; - inst.instruction |= (REG_PC << 16); - pre_inc = 1; - } - else - { - if (my_get_expression (&inst.reloc.exp, &str)) - return; - - inst.instruction |= HWOFFSET_IMM; - inst.reloc.type = BFD_RELOC_ARM_OFFSET_IMM8; -#ifndef TE_WINCE - /* PC rel adjust. */ - inst.reloc.exp.X_add_number -= 8; -#endif - inst.reloc.pc_rel = 1; - inst.instruction |= (REG_PC << 16); - pre_inc = 1; - } - - inst.instruction |= (pre_inc ? PRE_INDEX : 0); - end_of_line (str); -} - -static long -reg_list (strp) - char ** strp; -{ - char * str = * strp; - long range = 0; - int another_range; - - /* We come back here if we get ranges concatenated by '+' or '|'. */ - do - { - another_range = 0; - - if (*str == '{') - { - int in_range = 0; - int cur_reg = -1; - - str++; - do - { - int reg; - - skip_whitespace (str); - - if ((reg = reg_required_here (& str, -1)) == FAIL) - return FAIL; - - if (in_range) - { - int i; - - if (reg <= cur_reg) - { - inst.error = _("bad range in register list"); - return FAIL; - } - - for (i = cur_reg + 1; i < reg; i++) - { - if (range & (1 << i)) - as_tsktsk - (_("Warning: duplicated register (r%d) in register list"), - i); - else - range |= 1 << i; - } - in_range = 0; - } - - if (range & (1 << reg)) - as_tsktsk (_("Warning: duplicated register (r%d) in register list"), - reg); - else if (reg <= cur_reg) - as_tsktsk (_("Warning: register range not in ascending order")); - - range |= 1 << reg; - cur_reg = reg; - } - while (skip_past_comma (&str) != FAIL - || (in_range = 1, *str++ == '-')); - str--; - skip_whitespace (str); - - if (*str++ != '}') - { - inst.error = _("missing `}'"); - return FAIL; - } - } - else - { - expressionS expr; - - if (my_get_expression (&expr, &str)) - return FAIL; - - if (expr.X_op == O_constant) - { - if (expr.X_add_number - != (expr.X_add_number & 0x0000ffff)) - { - inst.error = _("invalid register mask"); - return FAIL; - } - - if ((range & expr.X_add_number) != 0) - { - int regno = range & expr.X_add_number; - - regno &= -regno; - regno = (1 << regno) - 1; - as_tsktsk - (_("Warning: duplicated register (r%d) in register list"), - regno); - } - - range |= expr.X_add_number; - } - else - { - if (inst.reloc.type != 0) - { - inst.error = _("expression too complex"); - return FAIL; - } - - memcpy (&inst.reloc.exp, &expr, sizeof (expressionS)); - inst.reloc.type = BFD_RELOC_ARM_MULTI; - inst.reloc.pc_rel = 0; - } - } - - skip_whitespace (str); - - if (*str == '|' || *str == '+') - { - str++; - another_range = 1; - } - } - while (another_range); - - *strp = str; - return range; -} - -static void -do_ldmstm (str) - char * str; -{ - int base_reg; - long range; - - skip_whitespace (str); - - if ((base_reg = reg_required_here (&str, 16)) == FAIL) - return; - - if (base_reg == REG_PC) - { - inst.error = _("r15 not allowed as base register"); - return; - } - - skip_whitespace (str); - - if (*str == '!') - { - inst.instruction |= WRITE_BACK; - str++; - } - - if (skip_past_comma (&str) == FAIL - || (range = reg_list (&str)) == FAIL) - { - if (! inst.error) - inst.error = BAD_ARGS; - return; - } - - if (*str == '^') - { - str++; - inst.instruction |= LDM_TYPE_2_OR_3; - } - - if (inst.instruction & WRITE_BACK) - { - /* Check for unpredictable uses of writeback. */ - if (inst.instruction & LOAD_BIT) - { - /* Not allowed in LDM type 2. */ - if ((inst.instruction & LDM_TYPE_2_OR_3) - && ((range & (1 << REG_PC)) == 0)) - as_warn (_("writeback of base register is UNPREDICTABLE")); - /* Only allowed if base reg not in list for other types. */ - else if (range & (1 << base_reg)) - as_warn (_("writeback of base register when in register list is UNPREDICTABLE")); - } - else /* STM. */ - { - /* Not allowed for type 2. */ - if (inst.instruction & LDM_TYPE_2_OR_3) - as_warn (_("writeback of base register is UNPREDICTABLE")); - /* Only allowed if base reg not in list, or first in list. */ - else if ((range & (1 << base_reg)) - && (range & ((1 << base_reg) - 1))) - as_warn (_("if writeback register is in list, it must be the lowest reg in the list")); - } - } - - inst.instruction |= range; - end_of_line (str); -} - -static void -do_swi (str) - char * str; -{ - skip_whitespace (str); - - /* Allow optional leading '#'. */ - if (is_immediate_prefix (*str)) - str++; - - if (my_get_expression (& inst.reloc.exp, & str)) - return; - - inst.reloc.type = BFD_RELOC_ARM_SWI; - inst.reloc.pc_rel = 0; - end_of_line (str); -} - -static void -do_swap (str) - char * str; -{ - int reg; - - skip_whitespace (str); - - if ((reg = reg_required_here (&str, 12)) == FAIL) - return; - - if (reg == REG_PC) - { - inst.error = _("r15 not allowed in swap"); - return; - } - - if (skip_past_comma (&str) == FAIL - || (reg = reg_required_here (&str, 0)) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - if (reg == REG_PC) - { - inst.error = _("r15 not allowed in swap"); - return; - } - - if (skip_past_comma (&str) == FAIL - || *str++ != '[') - { - inst.error = BAD_ARGS; - return; - } - - skip_whitespace (str); - - if ((reg = reg_required_here (&str, 16)) == FAIL) - return; - - if (reg == REG_PC) - { - inst.error = BAD_PC; - return; - } - - skip_whitespace (str); - - if (*str++ != ']') - { - inst.error = _("missing ]"); - return; - } - - end_of_line (str); -} - -static void -do_branch (str) - char * str; -{ - if (my_get_expression (&inst.reloc.exp, &str)) - return; - -#ifdef OBJ_ELF - { - char * save_in; - - /* ScottB: February 5, 1998 - Check to see of PLT32 reloc - required for the instruction. */ - - /* arm_parse_reloc () works on input_line_pointer. - We actually want to parse the operands to the branch instruction - passed in 'str'. Save the input pointer and restore it later. */ - save_in = input_line_pointer; - input_line_pointer = str; - if (inst.reloc.exp.X_op == O_symbol - && *str == '(' - && arm_parse_reloc () == BFD_RELOC_ARM_PLT32) - { - inst.reloc.type = BFD_RELOC_ARM_PLT32; - inst.reloc.pc_rel = 0; - /* Modify str to point to after parsed operands, otherwise - end_of_line() will complain about the (PLT) left in str. */ - str = input_line_pointer; - } - else - { - inst.reloc.type = BFD_RELOC_ARM_PCREL_BRANCH; - inst.reloc.pc_rel = 1; - } - input_line_pointer = save_in; - } -#else - inst.reloc.type = BFD_RELOC_ARM_PCREL_BRANCH; - inst.reloc.pc_rel = 1; -#endif /* OBJ_ELF */ - - end_of_line (str); -} - -static void -do_bx (str) - char * str; -{ - int reg; - - skip_whitespace (str); - - if ((reg = reg_required_here (&str, 0)) == FAIL) - { - inst.error = BAD_ARGS; - return; - } - - /* Note - it is not illegal to do a "bx pc". Useless, but not illegal. */ - if (reg == REG_PC) - as_tsktsk (_("use of r15 in bx in ARM mode is not really useful")); - - end_of_line (str); -} - -static void -do_cdp (str) - char * str; -{ - /* Co-processor data operation. - Format: CDP{cond} CP#,,CRd,CRn,CRm{,} */ - skip_whitespace (str); - - if (co_proc_number (&str) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - if (skip_past_comma (&str) == FAIL - || cp_opc_expr (&str, 20,4) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - if (skip_past_comma (&str) == FAIL - || cp_reg_required_here (&str, 12) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - if (skip_past_comma (&str) == FAIL - || cp_reg_required_here (&str, 16) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - if (skip_past_comma (&str) == FAIL - || cp_reg_required_here (&str, 0) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - if (skip_past_comma (&str) == SUCCESS) - { - if (cp_opc_expr (&str, 5, 3) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - } - - end_of_line (str); -} - -static void -do_lstc (str) - char * str; -{ - /* Co-processor register load/store. - Format: */ - - skip_whitespace (str); - - if (co_proc_number (&str) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - if (skip_past_comma (&str) == FAIL - || cp_reg_required_here (&str, 12) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - if (skip_past_comma (&str) == FAIL - || cp_address_required_here (&str, CP_WB_OK) == FAIL) - { - if (! inst.error) - inst.error = BAD_ARGS; - return; - } - - end_of_line (str); -} - -static void -do_co_reg (str) - char * str; -{ - /* Co-processor register transfer. - Format: {cond} CP#,,Rd,CRn,CRm{,} */ - - skip_whitespace (str); - - if (co_proc_number (&str) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - if (skip_past_comma (&str) == FAIL - || cp_opc_expr (&str, 21, 3) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - if (skip_past_comma (&str) == FAIL - || reg_required_here (&str, 12) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - if (skip_past_comma (&str) == FAIL - || cp_reg_required_here (&str, 16) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - if (skip_past_comma (&str) == FAIL - || cp_reg_required_here (&str, 0) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - if (skip_past_comma (&str) == SUCCESS) - { - if (cp_opc_expr (&str, 5, 3) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - } - - end_of_line (str); -} - -static void -do_fpa_ctrl (str) - char * str; -{ - /* FP control registers. - Format: {cond} Rn */ - - skip_whitespace (str); - - if (reg_required_here (&str, 12) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - end_of_line (str); -} - -static void -do_fpa_ldst (str) - char * str; -{ - skip_whitespace (str); - - if (fp_reg_required_here (&str, 12) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - if (skip_past_comma (&str) == FAIL - || cp_address_required_here (&str, CP_WB_OK) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - end_of_line (str); -} - -static void -do_fpa_ldmstm (str) - char * str; -{ - int num_regs; - - skip_whitespace (str); - - if (fp_reg_required_here (&str, 12) == FAIL) - { - if (! inst.error) - inst.error = BAD_ARGS; - return; - } - - /* Get Number of registers to transfer. */ - if (skip_past_comma (&str) == FAIL - || my_get_expression (&inst.reloc.exp, &str)) - { - if (! inst.error) - inst.error = _("constant expression expected"); - return; - } - - if (inst.reloc.exp.X_op != O_constant) - { - inst.error = _("constant value required for number of registers"); - return; - } - - num_regs = inst.reloc.exp.X_add_number; - - if (num_regs < 1 || num_regs > 4) - { - inst.error = _("number of registers must be in the range [1:4]"); - return; - } - - switch (num_regs) - { - case 1: - inst.instruction |= CP_T_X; - break; - case 2: - inst.instruction |= CP_T_Y; - break; - case 3: - inst.instruction |= CP_T_Y | CP_T_X; - break; - case 4: - break; - default: - abort (); - } - - if (inst.instruction & (CP_T_Pre | CP_T_UD)) /* ea/fd format. */ - { - int reg; - int write_back; - int offset; - - /* The instruction specified "ea" or "fd", so we can only accept - [Rn]{!}. The instruction does not really support stacking or - unstacking, so we have to emulate these by setting appropriate - bits and offsets. */ - if (skip_past_comma (&str) == FAIL - || *str != '[') - { - if (! inst.error) - inst.error = BAD_ARGS; - return; - } - - str++; - skip_whitespace (str); - - if ((reg = reg_required_here (&str, 16)) == FAIL) - return; - - skip_whitespace (str); - - if (*str != ']') - { - inst.error = BAD_ARGS; - return; - } - - str++; - if (*str == '!') - { - write_back = 1; - str++; - if (reg == REG_PC) - { - inst.error = - _("r15 not allowed as base register with write-back"); - return; - } - } - else - write_back = 0; - - if (inst.instruction & CP_T_Pre) - { - /* Pre-decrement. */ - offset = 3 * num_regs; - if (write_back) - inst.instruction |= CP_T_WB; - } - else - { - /* Post-increment. */ - if (write_back) - { - inst.instruction |= CP_T_WB; - offset = 3 * num_regs; - } - else - { - /* No write-back, so convert this into a standard pre-increment - instruction -- aesthetically more pleasing. */ - inst.instruction |= CP_T_Pre | CP_T_UD; - offset = 0; - } - } - - inst.instruction |= offset; - } - else if (skip_past_comma (&str) == FAIL - || cp_address_required_here (&str, CP_WB_OK) == FAIL) - { - if (! inst.error) - inst.error = BAD_ARGS; - return; - } - - end_of_line (str); -} - -static void -do_fpa_dyadic (str) - char * str; -{ - skip_whitespace (str); - - if (fp_reg_required_here (&str, 12) == FAIL) - { - if (! inst.error) - inst.error = BAD_ARGS; - return; - } - - if (skip_past_comma (&str) == FAIL - || fp_reg_required_here (&str, 16) == FAIL) - { - if (! inst.error) - inst.error = BAD_ARGS; - return; - } - - if (skip_past_comma (&str) == FAIL - || fp_op2 (&str) == FAIL) - { - if (! inst.error) - inst.error = BAD_ARGS; - return; - } - - end_of_line (str); -} - -static void -do_fpa_monadic (str) - char * str; -{ - skip_whitespace (str); - - if (fp_reg_required_here (&str, 12) == FAIL) - { - if (! inst.error) - inst.error = BAD_ARGS; - return; - } - - if (skip_past_comma (&str) == FAIL - || fp_op2 (&str) == FAIL) - { - if (! inst.error) - inst.error = BAD_ARGS; - return; - } - - end_of_line (str); -} - -static void -do_fpa_cmp (str) - char * str; -{ - skip_whitespace (str); - - if (fp_reg_required_here (&str, 16) == FAIL) - { - if (! inst.error) - inst.error = BAD_ARGS; - return; - } - - if (skip_past_comma (&str) == FAIL - || fp_op2 (&str) == FAIL) - { - if (! inst.error) - inst.error = BAD_ARGS; - return; - } - - end_of_line (str); -} - -static void -do_fpa_from_reg (str) - char * str; -{ - skip_whitespace (str); - - if (fp_reg_required_here (&str, 16) == FAIL) - { - if (! inst.error) - inst.error = BAD_ARGS; - return; - } - - if (skip_past_comma (&str) == FAIL - || reg_required_here (&str, 12) == FAIL) - { - if (! inst.error) - inst.error = BAD_ARGS; - return; - } - - end_of_line (str); -} - -static void -do_fpa_to_reg (str) - char * str; -{ - skip_whitespace (str); - - if (reg_required_here (&str, 12) == FAIL) - return; - - if (skip_past_comma (&str) == FAIL - || fp_reg_required_here (&str, 0) == FAIL) - { - if (! inst.error) - inst.error = BAD_ARGS; - return; - } - - end_of_line (str); -} - -static int -vfp_sp_reg_required_here (str, pos) - char **str; - enum vfp_sp_reg_pos pos; -{ - int reg; - char *start = *str; - - if ((reg = arm_reg_parse (str, all_reg_maps[REG_TYPE_SN].htab)) != FAIL) - { - switch (pos) - { - case VFP_REG_Sd: - inst.instruction |= ((reg >> 1) << 12) | ((reg & 1) << 22); - break; - - case VFP_REG_Sn: - inst.instruction |= ((reg >> 1) << 16) | ((reg & 1) << 7); - break; - - case VFP_REG_Sm: - inst.instruction |= ((reg >> 1) << 0) | ((reg & 1) << 5); - break; - - default: - abort (); - } - return reg; - } - - /* In the few cases where we might be able to accept something else - this error can be overridden. */ - inst.error = _(all_reg_maps[REG_TYPE_SN].expected); - - /* Restore the start point. */ - *str = start; - return FAIL; -} - -static int -vfp_dp_reg_required_here (str, pos) - char **str; - enum vfp_dp_reg_pos pos; -{ - int reg; - char *start = *str; - - if ((reg = arm_reg_parse (str, all_reg_maps[REG_TYPE_DN].htab)) != FAIL) - { - switch (pos) - { - case VFP_REG_Dd: - inst.instruction |= reg << 12; - break; - - case VFP_REG_Dn: - inst.instruction |= reg << 16; - break; - - case VFP_REG_Dm: - inst.instruction |= reg << 0; - break; - - default: - abort (); - } - return reg; - } - - /* In the few cases where we might be able to accept something else - this error can be overridden. */ - inst.error = _(all_reg_maps[REG_TYPE_DN].expected); - - /* Restore the start point. */ - *str = start; - return FAIL; -} - -static void -do_vfp_sp_monadic (str) - char *str; -{ - skip_whitespace (str); - - if (vfp_sp_reg_required_here (&str, VFP_REG_Sd) == FAIL) - return; - - if (skip_past_comma (&str) == FAIL - || vfp_sp_reg_required_here (&str, VFP_REG_Sm) == FAIL) - { - if (! inst.error) - inst.error = BAD_ARGS; - return; - } - - end_of_line (str); -} - -static void -do_vfp_dp_monadic (str) - char *str; -{ - skip_whitespace (str); - - if (vfp_dp_reg_required_here (&str, VFP_REG_Dd) == FAIL) - return; - - if (skip_past_comma (&str) == FAIL - || vfp_dp_reg_required_here (&str, VFP_REG_Dm) == FAIL) - { - if (! inst.error) - inst.error = BAD_ARGS; - return; - } - - end_of_line (str); -} - -static void -do_vfp_sp_dyadic (str) - char *str; -{ - skip_whitespace (str); - - if (vfp_sp_reg_required_here (&str, VFP_REG_Sd) == FAIL) - return; - - if (skip_past_comma (&str) == FAIL - || vfp_sp_reg_required_here (&str, VFP_REG_Sn) == FAIL - || skip_past_comma (&str) == FAIL - || vfp_sp_reg_required_here (&str, VFP_REG_Sm) == FAIL) - { - if (! inst.error) - inst.error = BAD_ARGS; - return; - } - - end_of_line (str); -} - -static void -do_vfp_dp_dyadic (str) - char *str; -{ - skip_whitespace (str); - - if (vfp_dp_reg_required_here (&str, VFP_REG_Dd) == FAIL) - return; - - if (skip_past_comma (&str) == FAIL - || vfp_dp_reg_required_here (&str, VFP_REG_Dn) == FAIL - || skip_past_comma (&str) == FAIL - || vfp_dp_reg_required_here (&str, VFP_REG_Dm) == FAIL) - { - if (! inst.error) - inst.error = BAD_ARGS; - return; - } - - end_of_line (str); -} - -static void -do_vfp_reg_from_sp (str) - char *str; -{ - skip_whitespace (str); - - if (reg_required_here (&str, 12) == FAIL) - return; - - if (skip_past_comma (&str) == FAIL - || vfp_sp_reg_required_here (&str, VFP_REG_Sn) == FAIL) - { - if (! inst.error) - inst.error = BAD_ARGS; - return; - } - - end_of_line (str); -} - -static void -do_vfp_reg2_from_sp2 (str) - char *str; -{ - skip_whitespace (str); - - if (reg_required_here (&str, 12) == FAIL - || skip_past_comma (&str) == FAIL - || reg_required_here (&str, 16) == FAIL - || skip_past_comma (&str) == FAIL) - { - if (! inst.error) - inst.error = BAD_ARGS; - return; - } - - /* We require exactly two consecutive SP registers. */ - if (vfp_sp_reg_list (&str, VFP_REG_Sm) != 2) - { - if (! inst.error) - inst.error = _("only two consecutive VFP SP registers allowed here"); - } - - end_of_line (str); -} - -static void -do_vfp_sp_from_reg (str) - char *str; -{ - skip_whitespace (str); - - if (vfp_sp_reg_required_here (&str, VFP_REG_Sn) == FAIL) - return; - - if (skip_past_comma (&str) == FAIL - || reg_required_here (&str, 12) == FAIL) - { - if (! inst.error) - inst.error = BAD_ARGS; - return; - } - - end_of_line (str); -} - -static void -do_vfp_sp2_from_reg2 (str) - char *str; -{ - skip_whitespace (str); - - /* We require exactly two consecutive SP registers. */ - if (vfp_sp_reg_list (&str, VFP_REG_Sm) != 2) - { - if (! inst.error) - inst.error = _("only two consecutive VFP SP registers allowed here"); - } - - if (skip_past_comma (&str) == FAIL - || reg_required_here (&str, 12) == FAIL - || skip_past_comma (&str) == FAIL - || reg_required_here (&str, 16) == FAIL) - { - if (! inst.error) - inst.error = BAD_ARGS; - return; - } - - end_of_line (str); -} - -static void -do_vfp_reg_from_dp (str) - char *str; -{ - skip_whitespace (str); - - if (reg_required_here (&str, 12) == FAIL) - return; - - if (skip_past_comma (&str) == FAIL - || vfp_dp_reg_required_here (&str, VFP_REG_Dn) == FAIL) - { - if (! inst.error) - inst.error = BAD_ARGS; - return; - } - - end_of_line (str); -} - -static void -do_vfp_reg2_from_dp (str) - char *str; -{ - skip_whitespace (str); - - if (reg_required_here (&str, 12) == FAIL) - return; - - if (skip_past_comma (&str) == FAIL - || reg_required_here (&str, 16) == FAIL - || skip_past_comma (&str) == FAIL - || vfp_dp_reg_required_here (&str, VFP_REG_Dm) == FAIL) - { - if (! inst.error) - inst.error = BAD_ARGS; - return; - } - - end_of_line (str); -} - -static void -do_vfp_dp_from_reg (str) - char *str; -{ - skip_whitespace (str); - - if (vfp_dp_reg_required_here (&str, VFP_REG_Dn) == FAIL) - return; - - if (skip_past_comma (&str) == FAIL - || reg_required_here (&str, 12) == FAIL) - { - if (! inst.error) - inst.error = BAD_ARGS; - return; - } - - end_of_line (str); -} - -static void -do_vfp_dp_from_reg2 (str) - char *str; -{ - skip_whitespace (str); - - if (vfp_dp_reg_required_here (&str, VFP_REG_Dm) == FAIL) - return; - - if (skip_past_comma (&str) == FAIL - || reg_required_here (&str, 12) == FAIL - || skip_past_comma (&str) == FAIL - || reg_required_here (&str, 16) == FAIL) - { - if (! inst.error) - inst.error = BAD_ARGS; - return; - } - - end_of_line (str); -} - -static const struct vfp_reg * -vfp_psr_parse (str) - char **str; -{ - char *start = *str; - char c; - char *p; - const struct vfp_reg *vreg; - - p = start; - - /* Find the end of the current token. */ - do - { - c = *p++; - } - while (ISALPHA (c)); - - /* Mark it. */ - *--p = 0; - - for (vreg = vfp_regs + 0; - vreg < vfp_regs + sizeof (vfp_regs) / sizeof (struct vfp_reg); - vreg++) - { - if (strcmp (start, vreg->name) == 0) - { - *p = c; - *str = p; - return vreg; - } - } - - *p = c; - return NULL; -} - -static int -vfp_psr_required_here (str) - char **str; -{ - char *start = *str; - const struct vfp_reg *vreg; - - vreg = vfp_psr_parse (str); - - if (vreg) - { - inst.instruction |= vreg->regno; - return SUCCESS; - } - - inst.error = _("VFP system register expected"); - - *str = start; - return FAIL; -} - -static void -do_vfp_reg_from_ctrl (str) - char *str; -{ - skip_whitespace (str); - - if (reg_required_here (&str, 12) == FAIL) - return; - - if (skip_past_comma (&str) == FAIL - || vfp_psr_required_here (&str) == FAIL) - { - if (! inst.error) - inst.error = BAD_ARGS; - return; - } - - end_of_line (str); -} - -static void -do_vfp_ctrl_from_reg (str) - char *str; -{ - skip_whitespace (str); - - if (vfp_psr_required_here (&str) == FAIL) - return; - - if (skip_past_comma (&str) == FAIL - || reg_required_here (&str, 12) == FAIL) - { - if (! inst.error) - inst.error = BAD_ARGS; - return; - } - - end_of_line (str); -} - -static void -do_vfp_sp_ldst (str) - char *str; -{ - skip_whitespace (str); - - if (vfp_sp_reg_required_here (&str, VFP_REG_Sd) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - if (skip_past_comma (&str) == FAIL - || cp_address_required_here (&str, CP_NO_WB) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - end_of_line (str); -} - -static void -do_vfp_dp_ldst (str) - char *str; -{ - skip_whitespace (str); - - if (vfp_dp_reg_required_here (&str, VFP_REG_Dd) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - if (skip_past_comma (&str) == FAIL - || cp_address_required_here (&str, CP_NO_WB) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - end_of_line (str); -} - -/* Parse and encode a VFP SP register list, storing the initial - register in position POS and returning the range as the result. If - the string is invalid return FAIL (an invalid range). */ -static long -vfp_sp_reg_list (str, pos) - char **str; - enum vfp_sp_reg_pos pos; -{ - long range = 0; - int base_reg = 0; - int new_base; - long base_bits = 0; - int count = 0; - long tempinst; - unsigned long mask = 0; - int warned = 0; - - if (**str != '{') - return FAIL; - - (*str)++; - skip_whitespace (*str); - - tempinst = inst.instruction; - - do - { - inst.instruction = 0; - - if ((new_base = vfp_sp_reg_required_here (str, pos)) == FAIL) - return FAIL; - - if (count == 0 || base_reg > new_base) - { - base_reg = new_base; - base_bits = inst.instruction; - } - - if (mask & (1 << new_base)) - { - inst.error = _("invalid register list"); - return FAIL; - } - - if ((mask >> new_base) != 0 && ! warned) - { - as_tsktsk (_("register list not in ascending order")); - warned = 1; - } - - mask |= 1 << new_base; - count++; - - skip_whitespace (*str); - - if (**str == '-') /* We have the start of a range expression */ - { - int high_range; - - (*str)++; - - if ((high_range - = arm_reg_parse (str, all_reg_maps[REG_TYPE_SN].htab)) - == FAIL) - { - inst.error = _(all_reg_maps[REG_TYPE_SN].expected); - return FAIL; - } - - if (high_range <= new_base) - { - inst.error = _("register range not in ascending order"); - return FAIL; - } - - for (new_base++; new_base <= high_range; new_base++) - { - if (mask & (1 << new_base)) - { - inst.error = _("invalid register list"); - return FAIL; - } - - mask |= 1 << new_base; - count++; - } - } - } - while (skip_past_comma (str) != FAIL); - - if (**str != '}') - { - inst.error = _("invalid register list"); - return FAIL; - } - - (*str)++; - - range = count; - - /* Sanity check -- should have raised a parse error above. */ - if (count == 0 || count > 32) - abort (); - - /* Final test -- the registers must be consecutive. */ - while (count--) - { - if ((mask & (1 << base_reg++)) == 0) - { - inst.error = _("non-contiguous register range"); - return FAIL; - } - } - - inst.instruction = tempinst | base_bits; - return range; -} - -static long -vfp_dp_reg_list (str) - char **str; -{ - long range = 0; - int base_reg = 0; - int new_base; - int count = 0; - long tempinst; - unsigned long mask = 0; - int warned = 0; - - if (**str != '{') - return FAIL; - - (*str)++; - skip_whitespace (*str); - - tempinst = inst.instruction; - - do - { - inst.instruction = 0; - - if ((new_base = vfp_dp_reg_required_here (str, VFP_REG_Dd)) == FAIL) - return FAIL; - - if (count == 0 || base_reg > new_base) - { - base_reg = new_base; - range = inst.instruction; - } - - if (mask & (1 << new_base)) - { - inst.error = _("invalid register list"); - return FAIL; - } - - if ((mask >> new_base) != 0 && ! warned) - { - as_tsktsk (_("register list not in ascending order")); - warned = 1; - } - - mask |= 1 << new_base; - count++; - - skip_whitespace (*str); - - if (**str == '-') /* We have the start of a range expression */ - { - int high_range; - - (*str)++; - - if ((high_range - = arm_reg_parse (str, all_reg_maps[REG_TYPE_DN].htab)) - == FAIL) - { - inst.error = _(all_reg_maps[REG_TYPE_DN].expected); - return FAIL; - } - - if (high_range <= new_base) - { - inst.error = _("register range not in ascending order"); - return FAIL; - } - - for (new_base++; new_base <= high_range; new_base++) - { - if (mask & (1 << new_base)) - { - inst.error = _("invalid register list"); - return FAIL; - } - - mask |= 1 << new_base; - count++; - } - } - } - while (skip_past_comma (str) != FAIL); - - if (**str != '}') - { - inst.error = _("invalid register list"); - return FAIL; - } - - (*str)++; - - range |= 2 * count; - - /* Sanity check -- should have raised a parse error above. */ - if (count == 0 || count > 16) - abort (); - - /* Final test -- the registers must be consecutive. */ - while (count--) - { - if ((mask & (1 << base_reg++)) == 0) - { - inst.error = _("non-contiguous register range"); - return FAIL; - } - } - - inst.instruction = tempinst; - return range; -} - -static void -vfp_sp_ldstm (str, ldstm_type) - char *str; - enum vfp_ldstm_type ldstm_type; -{ - long range; - - skip_whitespace (str); - - if (reg_required_here (&str, 16) == FAIL) - return; - - skip_whitespace (str); - - if (*str == '!') - { - inst.instruction |= WRITE_BACK; - str++; - } - else if (ldstm_type != VFP_LDSTMIA) - { - inst.error = _("this addressing mode requires base-register writeback"); - return; - } - - if (skip_past_comma (&str) == FAIL - || (range = vfp_sp_reg_list (&str, VFP_REG_Sd)) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - inst.instruction |= range; - end_of_line (str); -} - -static void -vfp_dp_ldstm (str, ldstm_type) - char *str; - enum vfp_ldstm_type ldstm_type; -{ - long range; - - skip_whitespace (str); - - if (reg_required_here (&str, 16) == FAIL) - return; - - skip_whitespace (str); - - if (*str == '!') - { - inst.instruction |= WRITE_BACK; - str++; - } - else if (ldstm_type != VFP_LDSTMIA && ldstm_type != VFP_LDSTMIAX) - { - inst.error = _("this addressing mode requires base-register writeback"); - return; - } - - if (skip_past_comma (&str) == FAIL - || (range = vfp_dp_reg_list (&str)) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - if (ldstm_type == VFP_LDSTMIAX || ldstm_type == VFP_LDSTMDBX) - range += 1; - - inst.instruction |= range; - end_of_line (str); -} - -static void -do_vfp_sp_ldstmia (str) - char *str; -{ - vfp_sp_ldstm (str, VFP_LDSTMIA); -} - -static void -do_vfp_sp_ldstmdb (str) - char *str; -{ - vfp_sp_ldstm (str, VFP_LDSTMDB); -} - -static void -do_vfp_dp_ldstmia (str) - char *str; -{ - vfp_dp_ldstm (str, VFP_LDSTMIA); -} - -static void -do_vfp_dp_ldstmdb (str) - char *str; -{ - vfp_dp_ldstm (str, VFP_LDSTMDB); -} - -static void -do_vfp_xp_ldstmia (str) - char *str; -{ - vfp_dp_ldstm (str, VFP_LDSTMIAX); -} - -static void -do_vfp_xp_ldstmdb (str) - char *str; -{ - vfp_dp_ldstm (str, VFP_LDSTMDBX); -} - -static void -do_vfp_sp_compare_z (str) - char *str; -{ - skip_whitespace (str); - - if (vfp_sp_reg_required_here (&str, VFP_REG_Sd) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - end_of_line (str); -} - -static void -do_vfp_dp_compare_z (str) - char *str; -{ - skip_whitespace (str); - - if (vfp_dp_reg_required_here (&str, VFP_REG_Dd) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - end_of_line (str); -} - -static void -do_vfp_dp_sp_cvt (str) - char *str; -{ - skip_whitespace (str); - - if (vfp_dp_reg_required_here (&str, VFP_REG_Dd) == FAIL) - return; - - if (skip_past_comma (&str) == FAIL - || vfp_sp_reg_required_here (&str, VFP_REG_Sm) == FAIL) - { - if (! inst.error) - inst.error = BAD_ARGS; - return; - } - - end_of_line (str); -} - -static void -do_vfp_sp_dp_cvt (str) - char *str; -{ - skip_whitespace (str); - - if (vfp_sp_reg_required_here (&str, VFP_REG_Sd) == FAIL) - return; - - if (skip_past_comma (&str) == FAIL - || vfp_dp_reg_required_here (&str, VFP_REG_Dm) == FAIL) - { - if (! inst.error) - inst.error = BAD_ARGS; - return; - } - - end_of_line (str); -} - -/* Thumb specific routines. */ - -/* Parse and validate that a register is of the right form, this saves - repeated checking of this information in many similar cases. - Unlike the 32-bit case we do not insert the register into the opcode - here, since the position is often unknown until the full instruction - has been parsed. */ - -static int -thumb_reg (strp, hi_lo) - char ** strp; - int hi_lo; -{ - int reg; - - if ((reg = reg_required_here (strp, -1)) == FAIL) - return FAIL; - - switch (hi_lo) - { - case THUMB_REG_LO: - if (reg > 7) - { - inst.error = _("lo register required"); - return FAIL; - } - break; - - case THUMB_REG_HI: - if (reg < 8) - { - inst.error = _("hi register required"); - return FAIL; - } - break; - - default: - break; - } - - return reg; -} - -/* Parse an add or subtract instruction, SUBTRACT is non-zero if the opcode - was SUB. */ - -static void -thumb_add_sub (str, subtract) - char * str; - int subtract; -{ - int Rd, Rs, Rn = FAIL; - - skip_whitespace (str); - - if ((Rd = thumb_reg (&str, THUMB_REG_ANY)) == FAIL - || skip_past_comma (&str) == FAIL) - { - if (! inst.error) - inst.error = BAD_ARGS; - return; - } - - if (is_immediate_prefix (*str)) - { - Rs = Rd; - str++; - if (my_get_expression (&inst.reloc.exp, &str)) - return; - } - else - { - if ((Rs = thumb_reg (&str, THUMB_REG_ANY)) == FAIL) - return; - - if (skip_past_comma (&str) == FAIL) - { - /* Two operand format, shuffle the registers - and pretend there are 3. */ - Rn = Rs; - Rs = Rd; - } - else if (is_immediate_prefix (*str)) - { - str++; - if (my_get_expression (&inst.reloc.exp, &str)) - return; - } - else if ((Rn = thumb_reg (&str, THUMB_REG_ANY)) == FAIL) - return; - } - - /* We now have Rd and Rs set to registers, and Rn set to a register or FAIL; - for the latter case, EXPR contains the immediate that was found. */ - if (Rn != FAIL) - { - /* All register format. */ - if (Rd > 7 || Rs > 7 || Rn > 7) - { - if (Rs != Rd) - { - inst.error = _("dest and source1 must be the same register"); - return; - } - - /* Can't do this for SUB. */ - if (subtract) - { - inst.error = _("subtract valid only on lo regs"); - return; - } - - inst.instruction = (T_OPCODE_ADD_HI - | (Rd > 7 ? THUMB_H1 : 0) - | (Rn > 7 ? THUMB_H2 : 0)); - inst.instruction |= (Rd & 7) | ((Rn & 7) << 3); - } - else - { - inst.instruction = subtract ? T_OPCODE_SUB_R3 : T_OPCODE_ADD_R3; - inst.instruction |= Rd | (Rs << 3) | (Rn << 6); - } - } - else - { - /* Immediate expression, now things start to get nasty. */ - - /* First deal with HI regs, only very restricted cases allowed: - Adjusting SP, and using PC or SP to get an address. */ - if ((Rd > 7 && (Rd != REG_SP || Rs != REG_SP)) - || (Rs > 7 && Rs != REG_SP && Rs != REG_PC)) - { - inst.error = _("invalid Hi register with immediate"); - return; - } - - if (inst.reloc.exp.X_op != O_constant) - { - /* Value isn't known yet, all we can do is store all the fragments - we know about in the instruction and let the reloc hacking - work it all out. */ - inst.instruction = (subtract ? 0x8000 : 0) | (Rd << 4) | Rs; - inst.reloc.type = BFD_RELOC_ARM_THUMB_ADD; - } - else - { - int offset = inst.reloc.exp.X_add_number; - - if (subtract) - offset = - offset; - - if (offset < 0) - { - offset = - offset; - subtract = 1; - - /* Quick check, in case offset is MIN_INT. */ - if (offset < 0) - { - inst.error = _("immediate value out of range"); - return; - } - } - /* Note - you cannot convert a subtract of 0 into an - add of 0 because the carry flag is set differently. */ - else if (offset > 0) - subtract = 0; - - if (Rd == REG_SP) - { - if (offset & ~0x1fc) - { - inst.error = _("invalid immediate value for stack adjust"); - return; - } - inst.instruction = subtract ? T_OPCODE_SUB_ST : T_OPCODE_ADD_ST; - inst.instruction |= offset >> 2; - } - else if (Rs == REG_PC || Rs == REG_SP) - { - if (subtract - || (offset & ~0x3fc)) - { - inst.error = _("invalid immediate for address calculation"); - return; - } - inst.instruction = (Rs == REG_PC ? T_OPCODE_ADD_PC - : T_OPCODE_ADD_SP); - inst.instruction |= (Rd << 8) | (offset >> 2); - } - else if (Rs == Rd) - { - if (offset & ~0xff) - { - inst.error = _("immediate value out of range"); - return; - } - inst.instruction = subtract ? T_OPCODE_SUB_I8 : T_OPCODE_ADD_I8; - inst.instruction |= (Rd << 8) | offset; - } - else - { - if (offset & ~0x7) - { - inst.error = _("immediate value out of range"); - return; - } - inst.instruction = subtract ? T_OPCODE_SUB_I3 : T_OPCODE_ADD_I3; - inst.instruction |= Rd | (Rs << 3) | (offset << 6); - } - } - } - - end_of_line (str); -} - -static void -thumb_shift (str, shift) - char * str; - int shift; -{ - int Rd, Rs, Rn = FAIL; - - skip_whitespace (str); - - if ((Rd = thumb_reg (&str, THUMB_REG_LO)) == FAIL - || skip_past_comma (&str) == FAIL) - { - if (! inst.error) - inst.error = BAD_ARGS; - return; - } - - if (is_immediate_prefix (*str)) - { - /* Two operand immediate format, set Rs to Rd. */ - Rs = Rd; - str ++; - if (my_get_expression (&inst.reloc.exp, &str)) - return; - } - else - { - if ((Rs = thumb_reg (&str, THUMB_REG_LO)) == FAIL) - return; - - if (skip_past_comma (&str) == FAIL) - { - /* Two operand format, shuffle the registers - and pretend there are 3. */ - Rn = Rs; - Rs = Rd; - } - else if (is_immediate_prefix (*str)) - { - str++; - if (my_get_expression (&inst.reloc.exp, &str)) - return; - } - else if ((Rn = thumb_reg (&str, THUMB_REG_LO)) == FAIL) - return; - } - - /* We now have Rd and Rs set to registers, and Rn set to a register or FAIL; - for the latter case, EXPR contains the immediate that was found. */ - - if (Rn != FAIL) - { - if (Rs != Rd) - { - inst.error = _("source1 and dest must be same register"); - return; - } - - switch (shift) - { - case THUMB_ASR: inst.instruction = T_OPCODE_ASR_R; break; - case THUMB_LSL: inst.instruction = T_OPCODE_LSL_R; break; - case THUMB_LSR: inst.instruction = T_OPCODE_LSR_R; break; - } - - inst.instruction |= Rd | (Rn << 3); - } - else - { - switch (shift) - { - case THUMB_ASR: inst.instruction = T_OPCODE_ASR_I; break; - case THUMB_LSL: inst.instruction = T_OPCODE_LSL_I; break; - case THUMB_LSR: inst.instruction = T_OPCODE_LSR_I; break; - } - - if (inst.reloc.exp.X_op != O_constant) - { - /* Value isn't known yet, create a dummy reloc and let reloc - hacking fix it up. */ - inst.reloc.type = BFD_RELOC_ARM_THUMB_SHIFT; - } - else - { - unsigned shift_value = inst.reloc.exp.X_add_number; - - if (shift_value > 32 || (shift_value == 32 && shift == THUMB_LSL)) - { - inst.error = _("invalid immediate for shift"); - return; - } - - /* Shifts of zero are handled by converting to LSL. */ - if (shift_value == 0) - inst.instruction = T_OPCODE_LSL_I; - - /* Shifts of 32 are encoded as a shift of zero. */ - if (shift_value == 32) - shift_value = 0; - - inst.instruction |= shift_value << 6; - } - - inst.instruction |= Rd | (Rs << 3); - } - - end_of_line (str); -} - -static void -thumb_mov_compare (str, move) - char * str; - int move; -{ - int Rd, Rs = FAIL; - - skip_whitespace (str); - - if ((Rd = thumb_reg (&str, THUMB_REG_ANY)) == FAIL - || skip_past_comma (&str) == FAIL) - { - if (! inst.error) - inst.error = BAD_ARGS; - return; - } - - if (move != THUMB_CPY && is_immediate_prefix (*str)) - { - str++; - if (my_get_expression (&inst.reloc.exp, &str)) - return; - } - else if ((Rs = thumb_reg (&str, THUMB_REG_ANY)) == FAIL) - return; - - if (Rs != FAIL) - { - if (move != THUMB_CPY && Rs < 8 && Rd < 8) - { - if (move == THUMB_MOVE) - /* A move of two lowregs is encoded as ADD Rd, Rs, #0 - since a MOV instruction produces unpredictable results. */ - inst.instruction = T_OPCODE_ADD_I3; - else - inst.instruction = T_OPCODE_CMP_LR; - inst.instruction |= Rd | (Rs << 3); - } - else - { - if (move == THUMB_MOVE) - inst.instruction = T_OPCODE_MOV_HR; - else if (move != THUMB_CPY) - inst.instruction = T_OPCODE_CMP_HR; - - if (Rd > 7) - inst.instruction |= THUMB_H1; - - if (Rs > 7) - inst.instruction |= THUMB_H2; - - inst.instruction |= (Rd & 7) | ((Rs & 7) << 3); - } - } - else - { - if (Rd > 7) - { - inst.error = _("only lo regs allowed with immediate"); - return; - } - - if (move == THUMB_MOVE) - inst.instruction = T_OPCODE_MOV_I8; - else - inst.instruction = T_OPCODE_CMP_I8; - - inst.instruction |= Rd << 8; - - if (inst.reloc.exp.X_op != O_constant) - inst.reloc.type = BFD_RELOC_ARM_THUMB_IMM; - else - { - unsigned value = inst.reloc.exp.X_add_number; - - if (value > 255) - { - inst.error = _("invalid immediate"); - return; - } - - inst.instruction |= value; - } - } - - end_of_line (str); -} - -static void -thumb_load_store (str, load_store, size) - char * str; - int load_store; - int size; -{ - int Rd, Rb, Ro = FAIL; - - skip_whitespace (str); - - if ((Rd = thumb_reg (&str, THUMB_REG_LO)) == FAIL - || skip_past_comma (&str) == FAIL) - { - if (! inst.error) - inst.error = BAD_ARGS; - return; - } - - if (*str == '[') - { - str++; - if ((Rb = thumb_reg (&str, THUMB_REG_ANY)) == FAIL) - return; - - if (skip_past_comma (&str) != FAIL) - { - if (is_immediate_prefix (*str)) - { - str++; - if (my_get_expression (&inst.reloc.exp, &str)) - return; - } - else if ((Ro = thumb_reg (&str, THUMB_REG_LO)) == FAIL) - return; - } - else - { - inst.reloc.exp.X_op = O_constant; - inst.reloc.exp.X_add_number = 0; - } - - if (*str != ']') - { - inst.error = _("expected ']'"); - return; - } - str++; - } - else if (*str == '=') - { - if (load_store != THUMB_LOAD) - { - inst.error = _("invalid pseudo operation"); - return; - } - - /* Parse an "ldr Rd, =expr" instruction; this is another pseudo op. */ - str++; - - skip_whitespace (str); - - if (my_get_expression (& inst.reloc.exp, & str)) - return; - - end_of_line (str); - - if ( inst.reloc.exp.X_op != O_constant - && inst.reloc.exp.X_op != O_symbol) - { - inst.error = "Constant expression expected"; - return; - } - - if (inst.reloc.exp.X_op == O_constant - && ((inst.reloc.exp.X_add_number & ~0xFF) == 0)) - { - /* This can be done with a mov instruction. */ - - inst.instruction = T_OPCODE_MOV_I8 | (Rd << 8); - inst.instruction |= inst.reloc.exp.X_add_number; - return; - } - - /* Insert into literal pool. */ - if (add_to_lit_pool () == FAIL) - { - if (!inst.error) - inst.error = "literal pool insertion failed"; - return; - } - - inst.reloc.type = BFD_RELOC_ARM_THUMB_OFFSET; - inst.reloc.pc_rel = 1; - inst.instruction = T_OPCODE_LDR_PC | (Rd << 8); - /* Adjust ARM pipeline offset to Thumb. */ - inst.reloc.exp.X_add_number += 4; - - return; - } - else - { - if (my_get_expression (&inst.reloc.exp, &str)) - return; - - inst.instruction = T_OPCODE_LDR_PC | (Rd << 8); - inst.reloc.pc_rel = 1; - inst.reloc.exp.X_add_number -= 4; /* Pipeline offset. */ - inst.reloc.type = BFD_RELOC_ARM_THUMB_OFFSET; - end_of_line (str); - return; - } - - if (Rb == REG_PC || Rb == REG_SP) - { - if (size != THUMB_WORD) - { - inst.error = _("byte or halfword not valid for base register"); - return; - } - else if (Rb == REG_PC && load_store != THUMB_LOAD) - { - inst.error = _("r15 based store not allowed"); - return; - } - else if (Ro != FAIL) - { - inst.error = _("invalid base register for register offset"); - return; - } - - if (Rb == REG_PC) - inst.instruction = T_OPCODE_LDR_PC; - else if (load_store == THUMB_LOAD) - inst.instruction = T_OPCODE_LDR_SP; - else - inst.instruction = T_OPCODE_STR_SP; - - inst.instruction |= Rd << 8; - if (inst.reloc.exp.X_op == O_constant) - { - unsigned offset = inst.reloc.exp.X_add_number; - - if (offset & ~0x3fc) - { - inst.error = _("invalid offset"); - return; - } - - inst.instruction |= offset >> 2; - } - else - inst.reloc.type = BFD_RELOC_ARM_THUMB_OFFSET; - } - else if (Rb > 7) - { - inst.error = _("invalid base register in load/store"); - return; - } - else if (Ro == FAIL) - { - /* Immediate offset. */ - if (size == THUMB_WORD) - inst.instruction = (load_store == THUMB_LOAD - ? T_OPCODE_LDR_IW : T_OPCODE_STR_IW); - else if (size == THUMB_HALFWORD) - inst.instruction = (load_store == THUMB_LOAD - ? T_OPCODE_LDR_IH : T_OPCODE_STR_IH); - else - inst.instruction = (load_store == THUMB_LOAD - ? T_OPCODE_LDR_IB : T_OPCODE_STR_IB); - - inst.instruction |= Rd | (Rb << 3); - - if (inst.reloc.exp.X_op == O_constant) - { - unsigned offset = inst.reloc.exp.X_add_number; - - if (offset & ~(0x1f << size)) - { - inst.error = _("invalid offset"); - return; - } - inst.instruction |= (offset >> size) << 6; - } - else - inst.reloc.type = BFD_RELOC_ARM_THUMB_OFFSET; - } - else - { - /* Register offset. */ - if (size == THUMB_WORD) - inst.instruction = (load_store == THUMB_LOAD - ? T_OPCODE_LDR_RW : T_OPCODE_STR_RW); - else if (size == THUMB_HALFWORD) - inst.instruction = (load_store == THUMB_LOAD - ? T_OPCODE_LDR_RH : T_OPCODE_STR_RH); - else - inst.instruction = (load_store == THUMB_LOAD - ? T_OPCODE_LDR_RB : T_OPCODE_STR_RB); - - inst.instruction |= Rd | (Rb << 3) | (Ro << 6); - } - - end_of_line (str); -} - -/* A register must be given at this point. - - Shift is the place to put it in inst.instruction. - - Restores input start point on err. - Returns the reg#, or FAIL. */ - -static int -mav_reg_required_here (str, shift, regtype) - char ** str; - int shift; - enum arm_reg_type regtype; -{ - int reg; - char *start = *str; - - if ((reg = arm_reg_parse (str, all_reg_maps[regtype].htab)) != FAIL) - { - if (shift >= 0) - inst.instruction |= reg << shift; - - return reg; - } - - /* Restore the start point. */ - *str = start; - - /* In the few cases where we might be able to accept something else - this error can be overridden. */ - inst.error = _(all_reg_maps[regtype].expected); - - return FAIL; -} - -/* Cirrus Maverick Instructions. */ - -/* Wrapper functions. */ - -static void -do_mav_binops_1a (str) - char * str; -{ - do_mav_binops (str, MAV_MODE1, REG_TYPE_RN, REG_TYPE_MVF); -} - -static void -do_mav_binops_1b (str) - char * str; -{ - do_mav_binops (str, MAV_MODE1, REG_TYPE_RN, REG_TYPE_MVD); -} - -static void -do_mav_binops_1c (str) - char * str; -{ - do_mav_binops (str, MAV_MODE1, REG_TYPE_RN, REG_TYPE_MVDX); -} - -static void -do_mav_binops_1d (str) - char * str; -{ - do_mav_binops (str, MAV_MODE1, REG_TYPE_MVF, REG_TYPE_MVF); -} - -static void -do_mav_binops_1e (str) - char * str; -{ - do_mav_binops (str, MAV_MODE1, REG_TYPE_MVD, REG_TYPE_MVD); -} - -static void -do_mav_binops_1f (str) - char * str; -{ - do_mav_binops (str, MAV_MODE1, REG_TYPE_MVD, REG_TYPE_MVF); -} - -static void -do_mav_binops_1g (str) - char * str; -{ - do_mav_binops (str, MAV_MODE1, REG_TYPE_MVF, REG_TYPE_MVD); -} - -static void -do_mav_binops_1h (str) - char * str; -{ - do_mav_binops (str, MAV_MODE1, REG_TYPE_MVF, REG_TYPE_MVFX); -} - -static void -do_mav_binops_1i (str) - char * str; -{ - do_mav_binops (str, MAV_MODE1, REG_TYPE_MVD, REG_TYPE_MVFX); -} - -static void -do_mav_binops_1j (str) - char * str; -{ - do_mav_binops (str, MAV_MODE1, REG_TYPE_MVF, REG_TYPE_MVDX); -} - -static void -do_mav_binops_1k (str) - char * str; -{ - do_mav_binops (str, MAV_MODE1, REG_TYPE_MVD, REG_TYPE_MVDX); -} - -static void -do_mav_binops_1l (str) - char * str; -{ - do_mav_binops (str, MAV_MODE1, REG_TYPE_MVFX, REG_TYPE_MVF); -} - -static void -do_mav_binops_1m (str) - char * str; -{ - do_mav_binops (str, MAV_MODE1, REG_TYPE_MVFX, REG_TYPE_MVD); -} - -static void -do_mav_binops_1n (str) - char * str; -{ - do_mav_binops (str, MAV_MODE1, REG_TYPE_MVFX, REG_TYPE_MVFX); -} - -static void -do_mav_binops_1o (str) - char * str; -{ - do_mav_binops (str, MAV_MODE1, REG_TYPE_MVDX, REG_TYPE_MVDX); -} - -static void -do_mav_binops_2a (str) - char * str; -{ - do_mav_binops (str, MAV_MODE2, REG_TYPE_MVF, REG_TYPE_RN); -} - -static void -do_mav_binops_2b (str) - char * str; -{ - do_mav_binops (str, MAV_MODE2, REG_TYPE_MVD, REG_TYPE_RN); -} - -static void -do_mav_binops_2c (str) - char * str; -{ - do_mav_binops (str, MAV_MODE2, REG_TYPE_MVDX, REG_TYPE_RN); -} - -static void -do_mav_binops_3a (str) - char * str; -{ - do_mav_binops (str, MAV_MODE3, REG_TYPE_MVAX, REG_TYPE_MVFX); -} - -static void -do_mav_binops_3b (str) - char * str; -{ - do_mav_binops (str, MAV_MODE3, REG_TYPE_MVFX, REG_TYPE_MVAX); -} - -static void -do_mav_binops_3c (str) - char * str; -{ - do_mav_binops (str, MAV_MODE3, REG_TYPE_MVAX, REG_TYPE_MVDX); -} - -static void -do_mav_binops_3d (str) - char * str; -{ - do_mav_binops (str, MAV_MODE3, REG_TYPE_MVDX, REG_TYPE_MVAX); -} - -static void -do_mav_triple_4a (str) - char * str; -{ - do_mav_triple (str, MAV_MODE4, REG_TYPE_MVFX, REG_TYPE_MVFX, REG_TYPE_RN); -} - -static void -do_mav_triple_4b (str) - char * str; -{ - do_mav_triple (str, MAV_MODE4, REG_TYPE_MVDX, REG_TYPE_MVDX, REG_TYPE_RN); -} - -static void -do_mav_triple_5a (str) - char * str; -{ - do_mav_triple (str, MAV_MODE5, REG_TYPE_RN, REG_TYPE_MVF, REG_TYPE_MVF); -} - -static void -do_mav_triple_5b (str) - char * str; -{ - do_mav_triple (str, MAV_MODE5, REG_TYPE_RN, REG_TYPE_MVD, REG_TYPE_MVD); -} - -static void -do_mav_triple_5c (str) - char * str; -{ - do_mav_triple (str, MAV_MODE5, REG_TYPE_RN, REG_TYPE_MVFX, REG_TYPE_MVFX); -} - -static void -do_mav_triple_5d (str) - char * str; -{ - do_mav_triple (str, MAV_MODE5, REG_TYPE_RN, REG_TYPE_MVDX, REG_TYPE_MVDX); -} - -static void -do_mav_triple_5e (str) - char * str; -{ - do_mav_triple (str, MAV_MODE5, REG_TYPE_MVF, REG_TYPE_MVF, REG_TYPE_MVF); -} - -static void -do_mav_triple_5f (str) - char * str; -{ - do_mav_triple (str, MAV_MODE5, REG_TYPE_MVD, REG_TYPE_MVD, REG_TYPE_MVD); -} - -static void -do_mav_triple_5g (str) - char * str; -{ - do_mav_triple (str, MAV_MODE5, REG_TYPE_MVFX, REG_TYPE_MVFX, REG_TYPE_MVFX); -} - -static void -do_mav_triple_5h (str) - char * str; -{ - do_mav_triple (str, MAV_MODE5, REG_TYPE_MVDX, REG_TYPE_MVDX, REG_TYPE_MVDX); -} - -static void -do_mav_quad_6a (str) - char * str; -{ - do_mav_quad (str, MAV_MODE6, REG_TYPE_MVAX, REG_TYPE_MVFX, REG_TYPE_MVFX, - REG_TYPE_MVFX); -} - -static void -do_mav_quad_6b (str) - char * str; -{ - do_mav_quad (str, MAV_MODE6, REG_TYPE_MVAX, REG_TYPE_MVAX, REG_TYPE_MVFX, - REG_TYPE_MVFX); -} - -/* cfmvsc32 DSPSC,MVDX[15:0]. */ -static void -do_mav_dspsc_1 (str) - char * str; -{ - skip_whitespace (str); - - /* cfmvsc32. */ - if (mav_reg_required_here (&str, -1, REG_TYPE_DSPSC) == FAIL - || skip_past_comma (&str) == FAIL - || mav_reg_required_here (&str, 12, REG_TYPE_MVDX) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - - return; - } - - end_of_line (str); -} - -/* cfmv32sc MVDX[15:0],DSPSC. */ -static void -do_mav_dspsc_2 (str) - char * str; -{ - skip_whitespace (str); - - /* cfmv32sc. */ - if (mav_reg_required_here (&str, 12, REG_TYPE_MVDX) == FAIL - || skip_past_comma (&str) == FAIL - || mav_reg_required_here (&str, -1, REG_TYPE_DSPSC) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - - return; - } - - end_of_line (str); -} - -static void -do_mav_shift_1 (str) - char * str; -{ - do_mav_shift (str, REG_TYPE_MVFX, REG_TYPE_MVFX); -} - -static void -do_mav_shift_2 (str) - char * str; -{ - do_mav_shift (str, REG_TYPE_MVDX, REG_TYPE_MVDX); -} - -static void -do_mav_ldst_1 (str) - char * str; -{ - do_mav_ldst (str, REG_TYPE_MVF); -} - -static void -do_mav_ldst_2 (str) - char * str; -{ - do_mav_ldst (str, REG_TYPE_MVD); -} - -static void -do_mav_ldst_3 (str) - char * str; -{ - do_mav_ldst (str, REG_TYPE_MVFX); -} - -static void -do_mav_ldst_4 (str) - char * str; -{ - do_mav_ldst (str, REG_TYPE_MVDX); -} - -/* Isnsn like "foo X,Y". */ - -static void -do_mav_binops (str, mode, reg0, reg1) - char * str; - int mode; - enum arm_reg_type reg0; - enum arm_reg_type reg1; -{ - int shift0, shift1; - - shift0 = mode & 0xff; - shift1 = (mode >> 8) & 0xff; - - skip_whitespace (str); - - if (mav_reg_required_here (&str, shift0, reg0) == FAIL - || skip_past_comma (&str) == FAIL - || mav_reg_required_here (&str, shift1, reg1) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - } - else - end_of_line (str); -} - -/* Isnsn like "foo X,Y,Z". */ - -static void -do_mav_triple (str, mode, reg0, reg1, reg2) - char * str; - int mode; - enum arm_reg_type reg0; - enum arm_reg_type reg1; - enum arm_reg_type reg2; -{ - int shift0, shift1, shift2; - - shift0 = mode & 0xff; - shift1 = (mode >> 8) & 0xff; - shift2 = (mode >> 16) & 0xff; - - skip_whitespace (str); - - if (mav_reg_required_here (&str, shift0, reg0) == FAIL - || skip_past_comma (&str) == FAIL - || mav_reg_required_here (&str, shift1, reg1) == FAIL - || skip_past_comma (&str) == FAIL - || mav_reg_required_here (&str, shift2, reg2) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - } - else - end_of_line (str); -} - -/* Isnsn like "foo W,X,Y,Z". - where W=MVAX[0:3] and X,Y,Z=MVFX[0:15]. */ - -static void -do_mav_quad (str, mode, reg0, reg1, reg2, reg3) - char * str; - int mode; - enum arm_reg_type reg0; - enum arm_reg_type reg1; - enum arm_reg_type reg2; - enum arm_reg_type reg3; -{ - int shift0, shift1, shift2, shift3; - - shift0= mode & 0xff; - shift1 = (mode >> 8) & 0xff; - shift2 = (mode >> 16) & 0xff; - shift3 = (mode >> 24) & 0xff; - - skip_whitespace (str); - - if (mav_reg_required_here (&str, shift0, reg0) == FAIL - || skip_past_comma (&str) == FAIL - || mav_reg_required_here (&str, shift1, reg1) == FAIL - || skip_past_comma (&str) == FAIL - || mav_reg_required_here (&str, shift2, reg2) == FAIL - || skip_past_comma (&str) == FAIL - || mav_reg_required_here (&str, shift3, reg3) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - } - else - end_of_line (str); -} - -/* Maverick shift immediate instructions. - cfsh32 MVFX[15:0],MVFX[15:0],Shift[6:0]. - cfsh64 MVDX[15:0],MVDX[15:0],Shift[6:0]. */ - -static void -do_mav_shift (str, reg0, reg1) - char * str; - enum arm_reg_type reg0; - enum arm_reg_type reg1; -{ - int error; - int imm, neg = 0; - - skip_whitespace (str); - - error = 0; - - if (mav_reg_required_here (&str, 12, reg0) == FAIL - || skip_past_comma (&str) == FAIL - || mav_reg_required_here (&str, 16, reg1) == FAIL - || skip_past_comma (&str) == FAIL) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - /* Calculate the immediate operand. - The operand is a 7bit signed number. */ - skip_whitespace (str); - - if (*str == '#') - ++str; - - if (!ISDIGIT (*str) && *str != '-') - { - inst.error = _("expecting immediate, 7bit operand"); - return; - } - - if (*str == '-') - { - neg = 1; - ++str; - } - - for (imm = 0; *str && ISDIGIT (*str); ++str) - imm = imm * 10 + *str - '0'; - - if (imm > 64) - { - inst.error = _("immediate out of range"); - return; - } - - /* Make negative imm's into 7bit signed numbers. */ - if (neg) - { - imm = -imm; - imm &= 0x0000007f; - } - - /* Bits 0-3 of the insn should have bits 0-3 of the immediate. - Bits 5-7 of the insn should have bits 4-6 of the immediate. - Bit 4 should be 0. */ - imm = (imm & 0xf) | ((imm & 0x70) << 1); - - inst.instruction |= imm; - end_of_line (str); -} - -static int -mav_parse_offset (str, negative) - char ** str; - int *negative; -{ - char * p = *str; - int offset; - - *negative = 0; - - skip_whitespace (p); - - if (*p == '#') - ++p; - - if (*p == '-') - { - *negative = 1; - ++p; - } - - if (!ISDIGIT (*p)) - { - inst.error = _("offset expected"); - return 0; - } - - for (offset = 0; *p && ISDIGIT (*p); ++p) - offset = offset * 10 + *p - '0'; - - if (offset > 0xff) - { - inst.error = _("offset out of range"); - return 0; - } - - *str = p; - - return *negative ? -offset : offset; -} - -/* Maverick load/store instructions. - CRd,[Rn,]{!}. - CRd,[Rn],. */ - -static void -do_mav_ldst (str, reg0) - char * str; - enum arm_reg_type reg0; -{ - int offset, negative; - - skip_whitespace (str); - - if (mav_reg_required_here (&str, 12, reg0) == FAIL - || skip_past_comma (&str) == FAIL - || *str++ != '[' - || reg_required_here (&str, 16) == FAIL) - goto fail_ldst; - - if (skip_past_comma (&str) == SUCCESS) - { - /* You are here: "]{!}". */ - inst.instruction |= PRE_INDEX; - - offset = mav_parse_offset (&str, &negative); - - if (inst.error) - return; - - if (*str++ != ']') - { - inst.error = _("missing ]"); - return; - } - - if (*str == '!') - { - inst.instruction |= WRITE_BACK; - ++str; - } - } - else - { - /* You are here: "], ". */ - if (*str++ != ']') - { - inst.error = _("missing ]"); - return; - } - - if (skip_past_comma (&str) == FAIL - || (offset = mav_parse_offset (&str, &negative), inst.error)) - goto fail_ldst; - - inst.instruction |= CP_T_WB; /* Post indexed, set bit W. */ - } - - if (negative) - offset = -offset; - else - inst.instruction |= CP_T_UD; /* Positive, so set bit U. */ - - inst.instruction |= offset >> 2; - end_of_line (str); - return; - -fail_ldst: - if (!inst.error) - inst.error = BAD_ARGS; -} - -static void -do_t_nop (str) - char * str; -{ - /* Do nothing. */ - end_of_line (str); -} - -/* Handle the Format 4 instructions that do not have equivalents in other - formats. That is, ADC, AND, EOR, SBC, ROR, TST, NEG, CMN, ORR, MUL, - BIC and MVN. */ - -static void -do_t_arit (str) - char * str; -{ - int Rd, Rs, Rn; - - skip_whitespace (str); - - if ((Rd = thumb_reg (&str, THUMB_REG_LO)) == FAIL - || skip_past_comma (&str) == FAIL - || (Rs = thumb_reg (&str, THUMB_REG_LO)) == FAIL) - { - inst.error = BAD_ARGS; - return; - } - - if (skip_past_comma (&str) != FAIL) - { - /* Three operand format not allowed for TST, CMN, NEG and MVN. - (It isn't allowed for CMP either, but that isn't handled by this - function.) */ - if (inst.instruction == T_OPCODE_TST - || inst.instruction == T_OPCODE_CMN - || inst.instruction == T_OPCODE_NEG - || inst.instruction == T_OPCODE_MVN) - { - inst.error = BAD_ARGS; - return; - } - - if ((Rn = thumb_reg (&str, THUMB_REG_LO)) == FAIL) - return; - - if (Rs != Rd) - { - inst.error = _("dest and source1 must be the same register"); - return; - } - Rs = Rn; - } - - if (inst.instruction == T_OPCODE_MUL - && Rs == Rd) - as_tsktsk (_("Rs and Rd must be different in MUL")); - - inst.instruction |= Rd | (Rs << 3); - end_of_line (str); -} - -static void -do_t_add (str) - char * str; -{ - thumb_add_sub (str, 0); -} - -static void -do_t_asr (str) - char * str; -{ - thumb_shift (str, THUMB_ASR); -} - -static void -do_t_branch9 (str) - char * str; -{ - if (my_get_expression (&inst.reloc.exp, &str)) - return; - inst.reloc.type = BFD_RELOC_THUMB_PCREL_BRANCH9; - inst.reloc.pc_rel = 1; - end_of_line (str); -} - -static void -do_t_branch12 (str) - char * str; -{ - if (my_get_expression (&inst.reloc.exp, &str)) - return; - inst.reloc.type = BFD_RELOC_THUMB_PCREL_BRANCH12; - inst.reloc.pc_rel = 1; - end_of_line (str); -} - -/* Find the real, Thumb encoded start of a Thumb function. */ - -static symbolS * -find_real_start (symbolP) - symbolS * symbolP; -{ - char * real_start; - const char * name = S_GET_NAME (symbolP); - symbolS * new_target; - - /* This definition must agree with the one in gcc/config/arm/thumb.c. */ -#define STUB_NAME ".real_start_of" - - if (name == NULL) - abort (); - - /* Names that start with '.' are local labels, not function entry points. - The compiler may generate BL instructions to these labels because it - needs to perform a branch to a far away location. */ - if (name[0] == '.') - return symbolP; - - real_start = malloc (strlen (name) + strlen (STUB_NAME) + 1); - sprintf (real_start, "%s%s", STUB_NAME, name); - - new_target = symbol_find (real_start); - - if (new_target == NULL) - { - as_warn ("Failed to find real start of function: %s\n", name); - new_target = symbolP; - } - - free (real_start); - - return new_target; -} - -static void -do_t_branch23 (str) - char * str; -{ - if (my_get_expression (& inst.reloc.exp, & str)) - return; - - inst.reloc.type = BFD_RELOC_THUMB_PCREL_BRANCH23; - inst.reloc.pc_rel = 1; - end_of_line (str); - - /* If the destination of the branch is a defined symbol which does not have - the THUMB_FUNC attribute, then we must be calling a function which has - the (interfacearm) attribute. We look for the Thumb entry point to that - function and change the branch to refer to that function instead. */ - if ( inst.reloc.exp.X_op == O_symbol - && inst.reloc.exp.X_add_symbol != NULL - && S_IS_DEFINED (inst.reloc.exp.X_add_symbol) - && ! THUMB_IS_FUNC (inst.reloc.exp.X_add_symbol)) - inst.reloc.exp.X_add_symbol = - find_real_start (inst.reloc.exp.X_add_symbol); -} - -static void -do_t_bx (str) - char * str; -{ - int reg; - - skip_whitespace (str); - - if ((reg = thumb_reg (&str, THUMB_REG_ANY)) == FAIL) - return; - - /* This sets THUMB_H2 from the top bit of reg. */ - inst.instruction |= reg << 3; - - /* ??? FIXME: Should add a hacky reloc here if reg is REG_PC. The reloc - should cause the alignment to be checked once it is known. This is - because BX PC only works if the instruction is word aligned. */ - - end_of_line (str); -} - -static void -do_t_compare (str) - char * str; -{ - thumb_mov_compare (str, THUMB_COMPARE); -} - -static void -do_t_ldmstm (str) - char * str; -{ - int Rb; - long range; - - skip_whitespace (str); - - if ((Rb = thumb_reg (&str, THUMB_REG_LO)) == FAIL) - return; - - if (*str != '!') - as_warn (_("inserted missing '!': load/store multiple always writes back base register")); - else - str++; - - if (skip_past_comma (&str) == FAIL - || (range = reg_list (&str)) == FAIL) - { - if (! inst.error) - inst.error = BAD_ARGS; - return; - } - - if (inst.reloc.type != BFD_RELOC_NONE) - { - /* This really doesn't seem worth it. */ - inst.reloc.type = BFD_RELOC_NONE; - inst.error = _("expression too complex"); - return; - } - - if (range & ~0xff) - { - inst.error = _("only lo-regs valid in load/store multiple"); - return; - } - - inst.instruction |= (Rb << 8) | range; - end_of_line (str); -} - -static void -do_t_ldr (str) - char * str; -{ - thumb_load_store (str, THUMB_LOAD, THUMB_WORD); -} - -static void -do_t_ldrb (str) - char * str; -{ - thumb_load_store (str, THUMB_LOAD, THUMB_BYTE); -} - -static void -do_t_ldrh (str) - char * str; -{ - thumb_load_store (str, THUMB_LOAD, THUMB_HALFWORD); -} - -static void -do_t_lds (str) - char * str; -{ - int Rd, Rb, Ro; - - skip_whitespace (str); - - if ((Rd = thumb_reg (&str, THUMB_REG_LO)) == FAIL - || skip_past_comma (&str) == FAIL - || *str++ != '[' - || (Rb = thumb_reg (&str, THUMB_REG_LO)) == FAIL - || skip_past_comma (&str) == FAIL - || (Ro = thumb_reg (&str, THUMB_REG_LO)) == FAIL - || *str++ != ']') - { - if (! inst.error) - inst.error = _("syntax: ldrs[b] Rd, [Rb, Ro]"); - return; - } - - inst.instruction |= Rd | (Rb << 3) | (Ro << 6); - end_of_line (str); -} - -static void -do_t_lsl (str) - char * str; -{ - thumb_shift (str, THUMB_LSL); -} - -static void -do_t_lsr (str) - char * str; -{ - thumb_shift (str, THUMB_LSR); -} - -static void -do_t_mov (str) - char * str; -{ - thumb_mov_compare (str, THUMB_MOVE); -} - -static void -do_t_push_pop (str) - char * str; -{ - long range; - - skip_whitespace (str); - - if ((range = reg_list (&str)) == FAIL) - { - if (! inst.error) - inst.error = BAD_ARGS; - return; - } - - if (inst.reloc.type != BFD_RELOC_NONE) - { - /* This really doesn't seem worth it. */ - inst.reloc.type = BFD_RELOC_NONE; - inst.error = _("expression too complex"); - return; - } - - if (range & ~0xff) - { - if ((inst.instruction == T_OPCODE_PUSH - && (range & ~0xff) == 1 << REG_LR) - || (inst.instruction == T_OPCODE_POP - && (range & ~0xff) == 1 << REG_PC)) - { - inst.instruction |= THUMB_PP_PC_LR; - range &= 0xff; - } - else - { - inst.error = _("invalid register list to push/pop instruction"); - return; - } - } - - inst.instruction |= range; - end_of_line (str); -} - -static void -do_t_str (str) - char * str; -{ - thumb_load_store (str, THUMB_STORE, THUMB_WORD); -} - -static void -do_t_strb (str) - char * str; -{ - thumb_load_store (str, THUMB_STORE, THUMB_BYTE); -} - -static void -do_t_strh (str) - char * str; -{ - thumb_load_store (str, THUMB_STORE, THUMB_HALFWORD); -} - -static void -do_t_sub (str) - char * str; -{ - thumb_add_sub (str, 1); -} - -static void -do_t_swi (str) - char * str; -{ - skip_whitespace (str); - - if (my_get_expression (&inst.reloc.exp, &str)) - return; - - inst.reloc.type = BFD_RELOC_ARM_SWI; - end_of_line (str); -} - -static void -do_t_adr (str) - char * str; -{ - int reg; - - /* This is a pseudo-op of the form "adr rd, label" to be converted - into a relative address of the form "add rd, pc, #label-.-4". */ - skip_whitespace (str); - - /* Store Rd in temporary location inside instruction. */ - if ((reg = reg_required_here (&str, 4)) == FAIL - || (reg > 7) /* For Thumb reg must be r0..r7. */ - || skip_past_comma (&str) == FAIL - || my_get_expression (&inst.reloc.exp, &str)) - { - if (!inst.error) - inst.error = BAD_ARGS; - return; - } - - inst.reloc.type = BFD_RELOC_ARM_THUMB_ADD; - inst.reloc.exp.X_add_number -= 4; /* PC relative adjust. */ - inst.reloc.pc_rel = 1; - inst.instruction |= REG_PC; /* Rd is already placed into the instruction. */ - - end_of_line (str); -} - -static void -insert_reg (r, htab) - const struct reg_entry *r; - struct hash_control *htab; -{ - int len = strlen (r->name) + 2; - char * buf = (char *) xmalloc (len); - char * buf2 = (char *) xmalloc (len); - int i = 0; - -#ifdef REGISTER_PREFIX - buf[i++] = REGISTER_PREFIX; -#endif - - strcpy (buf + i, r->name); - - for (i = 0; buf[i]; i++) - buf2[i] = TOUPPER (buf[i]); - - buf2[i] = '\0'; - - hash_insert (htab, buf, (PTR) r); - hash_insert (htab, buf2, (PTR) r); -} - -static void -build_reg_hsh (map) - struct reg_map *map; -{ - const struct reg_entry *r; - - if ((map->htab = hash_new ()) == NULL) - as_fatal (_("virtual memory exhausted")); - - for (r = map->names; r->name != NULL; r++) - insert_reg (r, map->htab); -} - -static void -insert_reg_alias (str, regnum, htab) - char *str; - int regnum; - struct hash_control *htab; -{ - const char *error; - struct reg_entry *new = xmalloc (sizeof (struct reg_entry)); - const char *name = xmalloc (strlen (str) + 1); - - strcpy ((char *) name, str); - - new->name = name; - new->number = regnum; - new->builtin = FALSE; - - error = hash_insert (htab, name, (PTR) new); - if (error) - { - as_bad (_("failed to create an alias for %s, reason: %s"), - str, error); - free ((char *) name); - free (new); - } -} - -/* Look for the .req directive. This is of the form: - - new_register_name .req existing_register_name - - If we find one, or if it looks sufficiently like one that we want to - handle any error here, return non-zero. Otherwise return zero. */ -static int -create_register_alias (newname, p) - char *newname; - char *p; -{ - char *q; - char c; - - q = p; - skip_whitespace (q); - - c = *p; - *p = '\0'; - - if (*q && !strncmp (q, ".req ", 5)) - { - char *copy_of_str; - char *r; - -#ifdef IGNORE_OPCODE_CASE - newname = original_case_string; -#endif - copy_of_str = newname; - - q += 4; - skip_whitespace (q); - - for (r = q; *r != '\0'; r++) - if (*r == ' ') - break; - - if (r != q) - { - enum arm_reg_type new_type, old_type; - int old_regno; - char d = *r; - - *r = '\0'; - old_type = arm_reg_parse_any (q); - *r = d; - - new_type = arm_reg_parse_any (newname); - - if (new_type == REG_TYPE_MAX) - { - if (old_type != REG_TYPE_MAX) - { - old_regno = arm_reg_parse (&q, all_reg_maps[old_type].htab); - insert_reg_alias (newname, old_regno, - all_reg_maps[old_type].htab); - } - else - as_warn (_("register '%s' does not exist\n"), q); - } - else if (old_type == REG_TYPE_MAX) - { - as_warn (_("ignoring redefinition of register alias '%s' to non-existant register '%s'"), - copy_of_str, q); - } - else - { - /* Do not warn about redefinitions to the same alias. */ - if (new_type != old_type - || (arm_reg_parse (&q, all_reg_maps[old_type].htab) - != arm_reg_parse (&q, all_reg_maps[new_type].htab))) - as_warn (_("ignoring redefinition of register alias '%s'"), - copy_of_str); - - } - } - else - as_warn (_("ignoring incomplete .req pseuso op")); - - *p = c; - return 1; - } - - *p = c; - return 0; -} - -static void -set_constant_flonums () -{ - int i; - - for (i = 0; i < NUM_FLOAT_VALS; i++) - if (atof_ieee ((char *) fp_const[i], 'x', fp_values[i]) == NULL) - abort (); -} - -/* Iterate over the base tables to create the instruction patterns. */ -static void -build_arm_ops_hsh () -{ - unsigned int i; - unsigned int j; - static struct obstack insn_obstack; - - obstack_begin (&insn_obstack, 4000); - - for (i = 0; i < sizeof (insns) / sizeof (struct asm_opcode); i++) - { - const struct asm_opcode *insn = insns + i; - - if (insn->cond_offset != 0) - { - /* Insn supports conditional execution. Build the varaints - and insert them in the hash table. */ - for (j = 0; j < sizeof (conds) / sizeof (struct asm_cond); j++) - { - unsigned len = strlen (insn->template); - struct asm_opcode *new; - char *template; - - new = obstack_alloc (&insn_obstack, sizeof (struct asm_opcode)); - /* All condition codes are two characters. */ - template = obstack_alloc (&insn_obstack, len + 3); - - strncpy (template, insn->template, insn->cond_offset); - strcpy (template + insn->cond_offset, conds[j].template); - if (len > insn->cond_offset) - strcpy (template + insn->cond_offset + 2, - insn->template + insn->cond_offset); - new->template = template; - new->cond_offset = 0; - new->variant = insn->variant; - new->parms = insn->parms; - new->value = (insn->value & ~COND_MASK) | conds[j].value; - - hash_insert (arm_ops_hsh, new->template, (PTR) new); - } - } - /* Finally, insert the unconditional insn in the table directly; - no need to build a copy. */ - hash_insert (arm_ops_hsh, insn->template, (PTR) insn); - } -} - -#if 0 /* Suppressed - for now. */ -#if defined OBJ_ELF || defined OBJ_COFF - -#ifdef OBJ_ELF -#define arm_Note Elf_External_Note -#else -typedef struct -{ - unsigned char namesz[4]; /* Size of entry's owner string. */ - unsigned char descsz[4]; /* Size of the note descriptor. */ - unsigned char type[4]; /* Interpretation of the descriptor. */ - char name[1]; /* Start of the name+desc data. */ -} arm_Note; -#endif - -/* The description is kept to a fix sized in order to make updating - it and merging it easier. */ -#define ARM_NOTE_DESCRIPTION_LENGTH 8 - -static void -arm_add_note (name, description, type) - const char * name; - const char * description; - unsigned int type; -{ - arm_Note note ATTRIBUTE_UNUSED; - char * p; - unsigned int name_len; - - name_len = (strlen (name) + 1 + 3) & ~3; - - p = frag_more (sizeof (note.namesz)); - md_number_to_chars (p, (valueT) name_len, sizeof (note.namesz)); - - p = frag_more (sizeof (note.descsz)); - md_number_to_chars (p, (valueT) ARM_NOTE_DESCRIPTION_LENGTH, sizeof (note.descsz)); - - p = frag_more (sizeof (note.type)); - md_number_to_chars (p, (valueT) type, sizeof (note.type)); - - p = frag_more (name_len); - strcpy (p, name); - - p = frag_more (ARM_NOTE_DESCRIPTION_LENGTH); - strncpy (p, description, ARM_NOTE_DESCRIPTION_LENGTH); - frag_align (2, 0, 0); -} -#endif -#endif - -void -md_begin () -{ - unsigned mach; - unsigned int i; - - if ( (arm_ops_hsh = hash_new ()) == NULL - || (arm_tops_hsh = hash_new ()) == NULL - || (arm_cond_hsh = hash_new ()) == NULL - || (arm_shift_hsh = hash_new ()) == NULL - || (arm_psr_hsh = hash_new ()) == NULL) - as_fatal (_("virtual memory exhausted")); - - build_arm_ops_hsh (); - for (i = 0; i < sizeof (tinsns) / sizeof (struct thumb_opcode); i++) - hash_insert (arm_tops_hsh, tinsns[i].template, (PTR) (tinsns + i)); - for (i = 0; i < sizeof (conds) / sizeof (struct asm_cond); i++) - hash_insert (arm_cond_hsh, conds[i].template, (PTR) (conds + i)); - for (i = 0; i < sizeof (shift_names) / sizeof (struct asm_shift_name); i++) - hash_insert (arm_shift_hsh, shift_names[i].name, (PTR) (shift_names + i)); - for (i = 0; i < sizeof (psrs) / sizeof (struct asm_psr); i++) - hash_insert (arm_psr_hsh, psrs[i].template, (PTR) (psrs + i)); - - for (i = (int) REG_TYPE_FIRST; i < (int) REG_TYPE_MAX; i++) - build_reg_hsh (all_reg_maps + i); - - set_constant_flonums (); - - /* Set the cpu variant based on the command-line options. We prefer - -mcpu= over -march= if both are set (as for GCC); and we prefer - -mfpu= over any other way of setting the floating point unit. - Use of legacy options with new options are faulted. */ - if (legacy_cpu != -1) - { - if (mcpu_cpu_opt != -1 || march_cpu_opt != -1) - as_bad (_("use of old and new-style options to set CPU type")); - - mcpu_cpu_opt = legacy_cpu; - } - else if (mcpu_cpu_opt == -1) - mcpu_cpu_opt = march_cpu_opt; - - if (legacy_fpu != -1) - { - if (mfpu_opt != -1) - as_bad (_("use of old and new-style options to set FPU type")); - - mfpu_opt = legacy_fpu; - } - else if (mfpu_opt == -1) - { -#if !(defined (TE_LINUX) || defined (TE_NetBSD)) - /* Some environments specify a default FPU. If they don't, infer it - from the processor. */ - if (mcpu_fpu_opt != -1) - mfpu_opt = mcpu_fpu_opt; - else - mfpu_opt = march_fpu_opt; -#else - mfpu_opt = FPU_DEFAULT; -#endif - } - - if (mfpu_opt == -1) - { - if (mcpu_cpu_opt == -1) - mfpu_opt = FPU_DEFAULT; - else if (mcpu_cpu_opt & ARM_EXT_V5) - mfpu_opt = FPU_ARCH_VFP_V2; - else - mfpu_opt = FPU_ARCH_FPA; - } - - if (mcpu_cpu_opt == -1) - mcpu_cpu_opt = CPU_DEFAULT; - - cpu_variant = mcpu_cpu_opt | mfpu_opt; - -#if defined OBJ_COFF || defined OBJ_ELF - { - unsigned int flags = 0; - - /* Set the flags in the private structure. */ - if (uses_apcs_26) flags |= F_APCS26; - if (support_interwork) flags |= F_INTERWORK; - if (uses_apcs_float) flags |= F_APCS_FLOAT; - if (pic_code) flags |= F_PIC; - if ((cpu_variant & FPU_ANY) == FPU_NONE - || (cpu_variant & FPU_ANY) == FPU_ARCH_VFP) /* VFP layout only. */ - { - flags |= F_SOFT_FLOAT; - } - switch (mfloat_abi_opt) - { - case ARM_FLOAT_ABI_SOFT: - case ARM_FLOAT_ABI_SOFTFP: - flags |= F_SOFT_FLOAT; - break; - - case ARM_FLOAT_ABI_HARD: - if (flags & F_SOFT_FLOAT) - as_bad (_("hard-float conflicts with specified fpu")); - break; - } - /* Using VFP conventions (even if soft-float). */ - if (cpu_variant & FPU_VFP_EXT_NONE) flags |= F_VFP_FLOAT; - -#if defined OBJ_ELF - if (cpu_variant & FPU_ARCH_MAVERICK) - flags |= EF_ARM_MAVERICK_FLOAT; -#endif - - bfd_set_private_flags (stdoutput, flags); - - /* We have run out flags in the COFF header to encode the - status of ATPCS support, so instead we create a dummy, - empty, debug section called .arm.atpcs. */ - if (atpcs) - { - asection * sec; - - sec = bfd_make_section (stdoutput, ".arm.atpcs"); - - if (sec != NULL) - { - bfd_set_section_flags - (stdoutput, sec, SEC_READONLY | SEC_DEBUGGING /* | SEC_HAS_CONTENTS */); - bfd_set_section_size (stdoutput, sec, 0); - bfd_set_section_contents (stdoutput, sec, NULL, 0, 0); - } - } - } -#endif - - /* Record the CPU type as well. */ - switch (cpu_variant & ARM_CPU_MASK) - { - case ARM_2: - mach = bfd_mach_arm_2; - break; - - case ARM_3: /* Also ARM_250. */ - mach = bfd_mach_arm_2a; - break; - - case ARM_6: /* Also ARM_7. */ - mach = bfd_mach_arm_3; - break; - - default: - mach = bfd_mach_arm_unknown; - break; - } - - /* Catch special cases. */ - if (cpu_variant & ARM_CEXT_IWMMXT) - mach = bfd_mach_arm_iWMMXt; - else if (cpu_variant & ARM_CEXT_XSCALE) - mach = bfd_mach_arm_XScale; - else if (cpu_variant & ARM_CEXT_MAVERICK) - mach = bfd_mach_arm_ep9312; - else if (cpu_variant & ARM_EXT_V5E) - mach = bfd_mach_arm_5TE; - else if (cpu_variant & ARM_EXT_V5) - { - if (cpu_variant & ARM_EXT_V4T) - mach = bfd_mach_arm_5T; - else - mach = bfd_mach_arm_5; - } - else if (cpu_variant & ARM_EXT_V4) - { - if (cpu_variant & ARM_EXT_V4T) - mach = bfd_mach_arm_4T; - else - mach = bfd_mach_arm_4; - } - else if (cpu_variant & ARM_EXT_V3M) - mach = bfd_mach_arm_3M; - -#if 0 /* Suppressed - for now. */ -#if defined (OBJ_ELF) || defined (OBJ_COFF) - - /* Create a .note section to fully identify this arm binary. */ - -#define NOTE_ARCH_STRING "arch: " - -#if defined OBJ_COFF && ! defined NT_VERSION -#define NT_VERSION 1 -#define NT_ARCH 2 -#endif - - { - segT current_seg = now_seg; - subsegT current_subseg = now_subseg; - asection * arm_arch; - const char * arch_string; - - arm_arch = bfd_make_section_old_way (stdoutput, ARM_NOTE_SECTION); - -#ifdef OBJ_COFF - bfd_set_section_flags (stdoutput, arm_arch, - SEC_DATA | SEC_ALLOC | SEC_LOAD | SEC_LINK_ONCE \ - | SEC_HAS_CONTENTS); -#else - bfd_set_section_flags (stdoutput, arm_arch, - SEC_READONLY | SEC_HAS_CONTENTS); -#endif - arm_arch->output_section = arm_arch; - subseg_set (arm_arch, 0); - - switch (mach) - { - default: - case bfd_mach_arm_unknown: arch_string = "unknown"; break; - case bfd_mach_arm_2: arch_string = "armv2"; break; - case bfd_mach_arm_2a: arch_string = "armv2a"; break; - case bfd_mach_arm_3: arch_string = "armv3"; break; - case bfd_mach_arm_3M: arch_string = "armv3M"; break; - case bfd_mach_arm_4: arch_string = "armv4"; break; - case bfd_mach_arm_4T: arch_string = "armv4t"; break; - case bfd_mach_arm_5: arch_string = "armv5"; break; - case bfd_mach_arm_5T: arch_string = "armv5t"; break; - case bfd_mach_arm_5TE: arch_string = "armv5te"; break; - case bfd_mach_arm_XScale: arch_string = "XScale"; break; - case bfd_mach_arm_ep9312: arch_string = "ep9312"; break; - case bfd_mach_arm_iWMMXt: arch_string = "iWMMXt"; break; - } - - arm_add_note (NOTE_ARCH_STRING, arch_string, NT_ARCH); - - subseg_set (current_seg, current_subseg); - } -#endif -#endif /* Suppressed code. */ - - bfd_set_arch_mach (stdoutput, TARGET_ARCH, mach); -} - -/* Turn an integer of n bytes (in val) into a stream of bytes appropriate - for use in the a.out file, and stores them in the array pointed to by buf. - This knows about the endian-ness of the target machine and does - THE RIGHT THING, whatever it is. Possible values for n are 1 (byte) - 2 (short) and 4 (long) Floating numbers are put out as a series of - LITTLENUMS (shorts, here at least). */ - -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); -} - -static valueT -md_chars_to_number (buf, n) - char * buf; - int n; -{ - valueT result = 0; - unsigned char * where = (unsigned char *) buf; - - if (target_big_endian) - { - while (n--) - { - result <<= 8; - result |= (*where++ & 255); - } - } - else - { - while (n--) - { - result <<= 8; - result |= (where[n] & 255); - } - } - - return result; -} - /* 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. Note that fp constants aren't represent in the normal way on the ARM. - In big endian mode, things are as expected. However, in little endian + In big endian mode, things are as expected. However, in little endian mode fp constants are big-endian word-wise, and little-endian byte-wise within the words. For example, (double) 1.1 in big endian mode is the byte sequence 3f f1 99 99 99 99 99 9a, and in little endian mode is @@ -11899,10 +787,7 @@ md_chars_to_number (buf, n) ??? The format of 12 byte floats is uncertain according to gcc's arm.h. */ char * -md_atof (type, litP, sizeP) - char type; - char * litP; - int * sizeP; +md_atof (int type, char * litP, int * sizeP) { int prec; LITTLENUM_TYPE words[MAX_LITTLENUMS]; @@ -11955,7 +840,7 @@ md_atof (type, litP, sizeP) } else { - if (cpu_variant & FPU_ARCH_VFP) + if (ARM_CPU_HAS_FEATURE (cpu_variant, fpu_endian_pure)) for (i = prec - 1; i >= 0; i--) { md_number_to_chars (litP, (valueT) words[i], 2); @@ -11975,1769 +860,7162 @@ md_atof (type, litP, sizeP) return 0; } -/* The knowledge of the PC's pipeline offset is built into the insns - themselves. */ - -long -md_pcrel_from (fixP) - fixS * fixP; +/* We handle all bad expressions here, so that we can report the faulty + instruction in the error message. */ +void +md_operand (expressionS * expr) { - if (fixP->fx_addsy - && S_GET_SEGMENT (fixP->fx_addsy) == undefined_section - && fixP->fx_subsy == NULL) - return 0; - - if (fixP->fx_pcrel && (fixP->fx_r_type == BFD_RELOC_ARM_THUMB_ADD)) - { - /* PC relative addressing on the Thumb is slightly odd - as the bottom two bits of the PC are forced to zero - for the calculation. */ - return (fixP->fx_where + fixP->fx_frag->fr_address) & ~3; - } - -#ifdef TE_WINCE - /* The pattern was adjusted to accommodate CE's off-by-one fixups, - so we un-adjust here to compensate for the accommodation. */ - return fixP->fx_where + fixP->fx_frag->fr_address + 8; -#else - return fixP->fx_where + fixP->fx_frag->fr_address; -#endif + if (in_my_get_expression) + expr->X_op = O_illegal; } -/* Round up a section size to the appropriate boundary. */ +/* Immediate values. */ -valueT -md_section_align (segment, size) - segT segment ATTRIBUTE_UNUSED; - valueT size; -{ +/* Generic immediate-value read function for use in directives. + Accepts anything that 'expression' can fold to a constant. + *val receives the number. */ #ifdef OBJ_ELF - return size; -#else - /* Round all sects to multiple of 4. */ - return (size + 3) & ~3; -#endif -} - -/* Under ELF we need to default _GLOBAL_OFFSET_TABLE. - Otherwise we have no need to default values of symbols. */ - -symbolS * -md_undefined_symbol (name) - char * name ATTRIBUTE_UNUSED; -{ -#ifdef OBJ_ELF - if (name[0] == '_' && name[1] == 'G' - && streq (name, GLOBAL_OFFSET_TABLE_NAME)) - { - if (!GOT_symbol) - { - if (symbol_find (name)) - as_bad ("GOT already in the symbol table"); - - GOT_symbol = symbol_new (name, undefined_section, - (valueT) 0, & zero_address_frag); - } - - return GOT_symbol; - } -#endif - - return 0; -} - -/* arm_reg_parse () := if it looks like a register, return its token and - advance the pointer. */ - static int -arm_reg_parse (ccp, htab) - register char ** ccp; - struct hash_control *htab; +immediate_for_directive (int *val) { - char * start = * ccp; - char c; - char * p; - struct reg_entry * reg; + expressionS exp; + exp.X_op = O_illegal; + + if (is_immediate_prefix (*input_line_pointer)) + { + input_line_pointer++; + expression (&exp); + } + + if (exp.X_op != O_constant) + { + as_bad (_("expected #constant")); + ignore_rest_of_line (); + return FAIL; + } + *val = exp.X_add_number; + return SUCCESS; +} +#endif + +/* Register parsing. */ + +/* Generic register parser. CCP points to what should be the + beginning of a register name. If it is indeed a valid register + name, advance CCP over it and return the reg_entry structure; + otherwise return NULL. Does not issue diagnostics. */ + +static struct reg_entry * +arm_reg_parse_multi (char **ccp) +{ + char *start = *ccp; + char *p; + struct reg_entry *reg; #ifdef REGISTER_PREFIX if (*start != REGISTER_PREFIX) - return FAIL; - p = start + 1; -#else - p = start; + return NULL; + start++; +#endif #ifdef OPTIONAL_REGISTER_PREFIX - if (*p == OPTIONAL_REGISTER_PREFIX) - p++, start++; -#endif + if (*start == OPTIONAL_REGISTER_PREFIX) + start++; #endif + + p = start; if (!ISALPHA (*p) || !is_name_beginner (*p)) + return NULL; + + do + p++; + while (ISALPHA (*p) || ISDIGIT (*p) || *p == '_'); + + reg = (struct reg_entry *) hash_find_n (arm_reg_hsh, start, p - start); + + if (!reg) + return NULL; + + *ccp = p; + return reg; +} + +/* As above, but the register must be of type TYPE, and the return + value is the register number or FAIL. */ + +static int +arm_reg_parse (char **ccp, enum arm_reg_type type) +{ + char *start = *ccp; + struct reg_entry *reg = arm_reg_parse_multi (ccp); + + if (reg && reg->type == type) + return reg->number; + + /* Alternative syntaxes are accepted for a few register classes. */ + switch (type) + { + case REG_TYPE_MVF: + case REG_TYPE_MVD: + case REG_TYPE_MVFX: + case REG_TYPE_MVDX: + /* Generic coprocessor register names are allowed for these. */ + if (reg && reg->type == REG_TYPE_CN) + return reg->number; + break; + + case REG_TYPE_CP: + /* For backward compatibility, a bare number is valid here. */ + { + unsigned long processor = strtoul (start, ccp, 10); + if (*ccp != start && processor <= 15) + return processor; + } + + case REG_TYPE_MMXWC: + /* WC includes WCG. ??? I'm not sure this is true for all + instructions that take WC registers. */ + if (reg && reg->type == REG_TYPE_MMXWCG) + return reg->number; + break; + + default: + break; + } + + *ccp = start; + return FAIL; +} + +/* Parse an ARM register list. Returns the bitmask, or FAIL. */ +static long +parse_reg_list (char ** strp) +{ + char * str = * strp; + long range = 0; + int another_range; + + /* We come back here if we get ranges concatenated by '+' or '|'. */ + do + { + another_range = 0; + + if (*str == '{') + { + int in_range = 0; + int cur_reg = -1; + + str++; + do + { + int reg; + + if ((reg = arm_reg_parse (&str, REG_TYPE_RN)) == FAIL) + { + inst.error = _(reg_expected_msgs[REG_TYPE_RN]); + return FAIL; + } + + if (in_range) + { + int i; + + if (reg <= cur_reg) + { + inst.error = _("bad range in register list"); + return FAIL; + } + + for (i = cur_reg + 1; i < reg; i++) + { + if (range & (1 << i)) + as_tsktsk + (_("Warning: duplicated register (r%d) in register list"), + i); + else + range |= 1 << i; + } + in_range = 0; + } + + if (range & (1 << reg)) + as_tsktsk (_("Warning: duplicated register (r%d) in register list"), + reg); + else if (reg <= cur_reg) + as_tsktsk (_("Warning: register range not in ascending order")); + + range |= 1 << reg; + cur_reg = reg; + } + while (skip_past_comma (&str) != FAIL + || (in_range = 1, *str++ == '-')); + str--; + + if (*str++ != '}') + { + inst.error = _("missing `}'"); + return FAIL; + } + } + else + { + expressionS expr; + + if (my_get_expression (&expr, &str, GE_NO_PREFIX)) + return FAIL; + + if (expr.X_op == O_constant) + { + if (expr.X_add_number + != (expr.X_add_number & 0x0000ffff)) + { + inst.error = _("invalid register mask"); + return FAIL; + } + + if ((range & expr.X_add_number) != 0) + { + int regno = range & expr.X_add_number; + + regno &= -regno; + regno = (1 << regno) - 1; + as_tsktsk + (_("Warning: duplicated register (r%d) in register list"), + regno); + } + + range |= expr.X_add_number; + } + else + { + if (inst.reloc.type != 0) + { + inst.error = _("expression too complex"); + return FAIL; + } + + memcpy (&inst.reloc.exp, &expr, sizeof (expressionS)); + inst.reloc.type = BFD_RELOC_ARM_MULTI; + inst.reloc.pc_rel = 0; + } + } + + if (*str == '|' || *str == '+') + { + str++; + another_range = 1; + } + } + while (another_range); + + *strp = str; + return range; +} + +/* Parse a VFP register list. If the string is invalid return FAIL. + Otherwise return the number of registers, and set PBASE to the first + register. Double precision registers are matched if DP is nonzero. */ + +static int +parse_vfp_reg_list (char **str, unsigned int *pbase, int dp) +{ + int base_reg; + int new_base; + int regtype; + int max_regs; + int count = 0; + int warned = 0; + unsigned long mask = 0; + int i; + + if (**str != '{') return FAIL; - c = *p++; - while (ISALPHA (c) || ISDIGIT (c) || c == '_') - c = *p++; + (*str)++; - *--p = 0; - reg = (struct reg_entry *) hash_find (htab, start); - *p = c; - - if (reg) + if (dp) { - *ccp = p; - return reg->number; + regtype = REG_TYPE_VFD; + max_regs = 16; } + else + { + regtype = REG_TYPE_VFS; + max_regs = 32; + } + + base_reg = max_regs; + + do + { + new_base = arm_reg_parse (str, regtype); + if (new_base == FAIL) + { + inst.error = gettext (reg_expected_msgs[regtype]); + return FAIL; + } + + if (new_base < base_reg) + base_reg = new_base; + + if (mask & (1 << new_base)) + { + inst.error = _("invalid register list"); + return FAIL; + } + + if ((mask >> new_base) != 0 && ! warned) + { + as_tsktsk (_("register list not in ascending order")); + warned = 1; + } + + mask |= 1 << new_base; + count++; + + if (**str == '-') /* We have the start of a range expression */ + { + int high_range; + + (*str)++; + + if ((high_range = arm_reg_parse (str, regtype)) == FAIL) + { + inst.error = gettext (reg_expected_msgs[regtype]); + return FAIL; + } + + if (high_range <= new_base) + { + inst.error = _("register range not in ascending order"); + return FAIL; + } + + for (new_base++; new_base <= high_range; new_base++) + { + if (mask & (1 << new_base)) + { + inst.error = _("invalid register list"); + return FAIL; + } + + mask |= 1 << new_base; + count++; + } + } + } + while (skip_past_comma (str) != FAIL); + + (*str)++; + + /* Sanity check -- should have raised a parse error above. */ + if (count == 0 || count > max_regs) + abort (); + + *pbase = base_reg; + + /* Final test -- the registers must be consecutive. */ + mask >>= base_reg; + for (i = 0; i < count; i++) + { + if ((mask & (1u << i)) == 0) + { + inst.error = _("non-contiguous register range"); + return FAIL; + } + } + + return count; +} + +/* Parse an explicit relocation suffix on an expression. This is + either nothing, or a word in parentheses. Note that if !OBJ_ELF, + arm_reloc_hsh contains no entries, so this function can only + succeed if there is no () after the word. Returns -1 on error, + BFD_RELOC_UNUSED if there wasn't any suffix. */ +static int +parse_reloc (char **str) +{ + struct reloc_entry *r; + char *p, *q; + + if (**str != '(') + return BFD_RELOC_UNUSED; + + p = *str + 1; + q = p; + + while (*q && *q != ')' && *q != ',') + q++; + if (*q != ')') + return -1; + + if ((r = hash_find_n (arm_reloc_hsh, p, q - p)) == NULL) + return -1; + + *str = q + 1; + return r->reloc; +} + +/* Directives: register aliases. */ + +static void +insert_reg_alias (char *str, int number, int type) +{ + struct reg_entry *new; + const char *name; + + if ((new = hash_find (arm_reg_hsh, str)) != 0) + { + if (new->builtin) + as_warn (_("ignoring attempt to redefine built-in register '%s'"), str); + + /* Only warn about a redefinition if it's not defined as the + same register. */ + else if (new->number != number || new->type != type) + as_warn (_("ignoring redefinition of register alias '%s'"), str); + + return; + } + + name = xstrdup (str); + new = xmalloc (sizeof (struct reg_entry)); + + new->name = name; + new->number = number; + new->type = type; + new->builtin = FALSE; + + if (hash_insert (arm_reg_hsh, name, (PTR) new)) + abort (); +} + +/* Look for the .req directive. This is of the form: + + new_register_name .req existing_register_name + + If we find one, or if it looks sufficiently like one that we want to + handle any error here, return non-zero. Otherwise return zero. */ + +static int +create_register_alias (char * newname, char *p) +{ + struct reg_entry *old; + char *oldname, *nbuf; + size_t nlen; + + /* The input scrubber ensures that whitespace after the mnemonic is + collapsed to single spaces. */ + oldname = p; + if (strncmp (oldname, " .req ", 6) != 0) + return 0; + + oldname += 6; + if (*oldname == '\0') + return 0; + + old = hash_find (arm_reg_hsh, oldname); + if (!old) + { + as_warn (_("unknown register '%s' -- .req ignored"), oldname); + return 1; + } + + /* If TC_CASE_SENSITIVE is defined, then newname already points to + the desired alias name, and p points to its end. If not, then + the desired alias name is in the global original_case_string. */ +#ifdef TC_CASE_SENSITIVE + nlen = p - newname; +#else + newname = original_case_string; + nlen = strlen (newname); +#endif + + nbuf = alloca (nlen + 1); + memcpy (nbuf, newname, nlen); + nbuf[nlen] = '\0'; + + /* Create aliases under the new name as stated; an all-lowercase + version of the new name; and an all-uppercase version of the new + name. */ + insert_reg_alias (nbuf, old->number, old->type); + + for (p = nbuf; *p; p++) + *p = TOUPPER (*p); + + if (strncmp (nbuf, newname, nlen)) + insert_reg_alias (nbuf, old->number, old->type); + + for (p = nbuf; *p; p++) + *p = TOLOWER (*p); + + if (strncmp (nbuf, newname, nlen)) + insert_reg_alias (nbuf, old->number, old->type); + + return 1; +} + +/* Should never be called, as .req goes between the alias and the + register name, not at the beginning of the line. */ +static void +s_req (int a ATTRIBUTE_UNUSED) +{ + as_bad (_("invalid syntax for .req directive")); +} + +/* The .unreq directive deletes an alias which was previously defined + by .req. For example: + + my_alias .req r11 + .unreq my_alias */ + +static void +s_unreq (int a ATTRIBUTE_UNUSED) +{ + char * name; + char saved_char; + + name = input_line_pointer; + + while (*input_line_pointer != 0 + && *input_line_pointer != ' ' + && *input_line_pointer != '\n') + ++input_line_pointer; + + saved_char = *input_line_pointer; + *input_line_pointer = 0; + + if (!*name) + as_bad (_("invalid syntax for .unreq directive")); + else + { + struct reg_entry *reg = hash_find (arm_reg_hsh, name); + + if (!reg) + as_bad (_("unknown register alias '%s'"), name); + else if (reg->builtin) + as_warn (_("ignoring attempt to undefine built-in register '%s'"), + name); + else + { + hash_delete (arm_reg_hsh, name); + free ((char *) reg->name); + free (reg); + } + } + + *input_line_pointer = saved_char; + demand_empty_rest_of_line (); +} + +/* Directives: Instruction set selection. */ + +#ifdef OBJ_ELF +/* This code is to handle mapping symbols as defined in the ARM ELF spec. + (See "Mapping symbols", section 4.5.5, ARM AAELF version 1.0). + Note that previously, $a and $t has type STT_FUNC (BSF_OBJECT flag), + and $d has type STT_OBJECT (BSF_OBJECT flag). Now all three are untyped. */ + +static enum mstate mapstate = MAP_UNDEFINED; + +static void +mapping_state (enum mstate state) +{ + symbolS * symbolP; + const char * symname; + int type; + + if (mapstate == state) + /* The mapping symbol has already been emitted. + There is nothing else to do. */ + return; + + mapstate = state; + + switch (state) + { + case MAP_DATA: + symname = "$d"; + type = BSF_NO_FLAGS; + break; + case MAP_ARM: + symname = "$a"; + type = BSF_NO_FLAGS; + break; + case MAP_THUMB: + symname = "$t"; + type = BSF_NO_FLAGS; + break; + case MAP_UNDEFINED: + return; + default: + abort (); + } + + seg_info (now_seg)->tc_segment_info_data.mapstate = state; + + symbolP = symbol_new (symname, now_seg, (valueT) frag_now_fix (), frag_now); + symbol_table_insert (symbolP); + symbol_get_bfdsym (symbolP)->flags |= type | BSF_LOCAL; + + switch (state) + { + case MAP_ARM: + THUMB_SET_FUNC (symbolP, 0); + ARM_SET_THUMB (symbolP, 0); + ARM_SET_INTERWORK (symbolP, support_interwork); + break; + + case MAP_THUMB: + THUMB_SET_FUNC (symbolP, 1); + ARM_SET_THUMB (symbolP, 1); + ARM_SET_INTERWORK (symbolP, support_interwork); + break; + + case MAP_DATA: + default: + return; + } +} +#else +#define mapping_state(x) /* nothing */ +#endif + +/* Find the real, Thumb encoded start of a Thumb function. */ + +static symbolS * +find_real_start (symbolS * symbolP) +{ + char * real_start; + const char * name = S_GET_NAME (symbolP); + symbolS * new_target; + + /* This definition must agree with the one in gcc/config/arm/thumb.c. */ +#define STUB_NAME ".real_start_of" + + if (name == NULL) + abort (); + + /* The compiler may generate BL instructions to local labels because + it needs to perform a branch to a far away location. These labels + do not have a corresponding ".real_start_of" label. We check + both for S_IS_LOCAL and for a leading dot, to give a way to bypass + the ".real_start_of" convention for nonlocal branches. */ + if (S_IS_LOCAL (symbolP) || name[0] == '.') + return symbolP; + + real_start = ACONCAT ((STUB_NAME, name, NULL)); + new_target = symbol_find (real_start); + + if (new_target == NULL) + { + as_warn ("Failed to find real start of function: %s\n", name); + new_target = symbolP; + } + + return new_target; +} + +static void +opcode_select (int width) +{ + switch (width) + { + case 16: + if (! thumb_mode) + { + if (!ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_v4t)) + as_bad (_("selected processor does not support THUMB opcodes")); + + thumb_mode = 1; + /* No need to force the alignment, since we will have been + coming from ARM mode, which is word-aligned. */ + record_alignment (now_seg, 1); + } + mapping_state (MAP_THUMB); + break; + + case 32: + if (thumb_mode) + { + if (!ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_v1)) + as_bad (_("selected processor does not support ARM opcodes")); + + thumb_mode = 0; + + if (!need_pass_2) + frag_align (2, 0, 0); + + record_alignment (now_seg, 1); + } + mapping_state (MAP_ARM); + break; + + default: + as_bad (_("invalid instruction size selected (%d)"), width); + } +} + +static void +s_arm (int ignore ATTRIBUTE_UNUSED) +{ + opcode_select (32); + demand_empty_rest_of_line (); +} + +static void +s_thumb (int ignore ATTRIBUTE_UNUSED) +{ + opcode_select (16); + demand_empty_rest_of_line (); +} + +static void +s_code (int unused ATTRIBUTE_UNUSED) +{ + int temp; + + temp = get_absolute_expression (); + switch (temp) + { + case 16: + case 32: + opcode_select (temp); + break; + + default: + as_bad (_("invalid operand to .code directive (%d) (expecting 16 or 32)"), temp); + } +} + +static void +s_force_thumb (int ignore ATTRIBUTE_UNUSED) +{ + /* If we are not already in thumb mode go into it, EVEN if + the target processor does not support thumb instructions. + This is used by gcc/config/arm/lib1funcs.asm for example + to compile interworking support functions even if the + target processor should not support interworking. */ + if (! thumb_mode) + { + thumb_mode = 2; + record_alignment (now_seg, 1); + } + + demand_empty_rest_of_line (); +} + +static void +s_thumb_func (int ignore ATTRIBUTE_UNUSED) +{ + s_thumb (0); + + /* The following label is the name/address of the start of a Thumb function. + We need to know this for the interworking support. */ + label_is_thumb_function_name = TRUE; +} + +/* Perform a .set directive, but also mark the alias as + being a thumb function. */ + +static void +s_thumb_set (int equiv) +{ + /* XXX the following is a duplicate of the code for s_set() in read.c + We cannot just call that code as we need to get at the symbol that + is created. */ + char * name; + char delim; + char * end_name; + symbolS * symbolP; + + /* Especial apologies for the random logic: + This just grew, and could be parsed much more simply! + Dean - in haste. */ + name = input_line_pointer; + delim = get_symbol_end (); + end_name = input_line_pointer; + *end_name = delim; + + if (*input_line_pointer != ',') + { + *end_name = 0; + as_bad (_("expected comma after name \"%s\""), name); + *end_name = delim; + ignore_rest_of_line (); + return; + } + + input_line_pointer++; + *end_name = 0; + + if (name[0] == '.' && name[1] == '\0') + { + /* XXX - this should not happen to .thumb_set. */ + abort (); + } + + if ((symbolP = symbol_find (name)) == NULL + && (symbolP = md_undefined_symbol (name)) == NULL) + { +#ifndef NO_LISTING + /* When doing symbol listings, play games with dummy fragments living + outside the normal fragment chain to record the file and line info + for this symbol. */ + if (listing & LISTING_SYMBOLS) + { + extern struct list_info_struct * listing_tail; + fragS * dummy_frag = xmalloc (sizeof (fragS)); + + memset (dummy_frag, 0, sizeof (fragS)); + dummy_frag->fr_type = rs_fill; + dummy_frag->line = listing_tail; + symbolP = symbol_new (name, undefined_section, 0, dummy_frag); + dummy_frag->fr_symbol = symbolP; + } + else +#endif + symbolP = symbol_new (name, undefined_section, 0, &zero_address_frag); + +#ifdef OBJ_COFF + /* "set" symbols are local unless otherwise specified. */ + SF_SET_LOCAL (symbolP); +#endif /* OBJ_COFF */ + } /* Make a new symbol. */ + + symbol_table_insert (symbolP); + + * end_name = delim; + + if (equiv + && S_IS_DEFINED (symbolP) + && S_GET_SEGMENT (symbolP) != reg_section) + as_bad (_("symbol `%s' already defined"), S_GET_NAME (symbolP)); + + pseudo_set (symbolP); + + demand_empty_rest_of_line (); + + /* XXX Now we come to the Thumb specific bit of code. */ + + THUMB_SET_FUNC (symbolP, 1); + ARM_SET_THUMB (symbolP, 1); +#if defined OBJ_ELF || defined OBJ_COFF + ARM_SET_INTERWORK (symbolP, support_interwork); +#endif +} + +/* Directives: Mode selection. */ + +/* .syntax [unified|divided] - choose the new unified syntax + (same for Arm and Thumb encoding, modulo slight differences in what + can be represented) or the old divergent syntax for each mode. */ +static void +s_syntax (int unused ATTRIBUTE_UNUSED) +{ + char *name, delim; + + name = input_line_pointer; + delim = get_symbol_end (); + + if (!strcasecmp (name, "unified")) + unified_syntax = TRUE; + else if (!strcasecmp (name, "divided")) + unified_syntax = FALSE; + else + { + as_bad (_("unrecognized syntax mode \"%s\""), name); + return; + } + *input_line_pointer = delim; + demand_empty_rest_of_line (); +} + +/* Directives: sectioning and alignment. */ + +/* Same as s_align_ptwo but align 0 => align 2. */ + +static void +s_align (int unused ATTRIBUTE_UNUSED) +{ + int temp; + long temp_fill; + long max_alignment = 15; + + temp = get_absolute_expression (); + if (temp > max_alignment) + as_bad (_("alignment too large: %d assumed"), temp = max_alignment); + else if (temp < 0) + { + as_bad (_("alignment negative. 0 assumed.")); + temp = 0; + } + + if (*input_line_pointer == ',') + { + input_line_pointer++; + temp_fill = get_absolute_expression (); + } + else + temp_fill = 0; + + if (!temp) + temp = 2; + + /* Only make a frag if we HAVE to. */ + if (temp && !need_pass_2) + frag_align (temp, (int) temp_fill, 0); + demand_empty_rest_of_line (); + + record_alignment (now_seg, temp); +} + +static void +s_bss (int ignore ATTRIBUTE_UNUSED) +{ + /* We don't support putting frags in the BSS segment, we fake it by + marking in_bss, then looking at s_skip for clues. */ + subseg_set (bss_section, 0); + demand_empty_rest_of_line (); + mapping_state (MAP_DATA); +} + +static void +s_even (int ignore ATTRIBUTE_UNUSED) +{ + /* Never make frag if expect extra pass. */ + if (!need_pass_2) + frag_align (1, 0, 0); + + record_alignment (now_seg, 1); + + demand_empty_rest_of_line (); +} + +/* Directives: Literal pools. */ + +static literal_pool * +find_literal_pool (void) +{ + literal_pool * pool; + + for (pool = list_of_pools; pool != NULL; pool = pool->next) + { + if (pool->section == now_seg + && pool->sub_section == now_subseg) + break; + } + + return pool; +} + +static literal_pool * +find_or_make_literal_pool (void) +{ + /* Next literal pool ID number. */ + static unsigned int latest_pool_num = 1; + literal_pool * pool; + + pool = find_literal_pool (); + + if (pool == NULL) + { + /* Create a new pool. */ + pool = xmalloc (sizeof (* pool)); + if (! pool) + return NULL; + + pool->next_free_entry = 0; + pool->section = now_seg; + pool->sub_section = now_subseg; + pool->next = list_of_pools; + pool->symbol = NULL; + + /* Add it to the list. */ + list_of_pools = pool; + } + + /* New pools, and emptied pools, will have a NULL symbol. */ + if (pool->symbol == NULL) + { + pool->symbol = symbol_create (FAKE_LABEL_NAME, undefined_section, + (valueT) 0, &zero_address_frag); + pool->id = latest_pool_num ++; + } + + /* Done. */ + return pool; +} + +/* Add the literal in the global 'inst' + structure to the relevent literal pool. */ + +static int +add_to_lit_pool (void) +{ + literal_pool * pool; + unsigned int entry; + + pool = find_or_make_literal_pool (); + + /* Check if this literal value is already in the pool. */ + for (entry = 0; entry < pool->next_free_entry; entry ++) + { + if ((pool->literals[entry].X_op == inst.reloc.exp.X_op) + && (inst.reloc.exp.X_op == O_constant) + && (pool->literals[entry].X_add_number + == inst.reloc.exp.X_add_number) + && (pool->literals[entry].X_unsigned + == inst.reloc.exp.X_unsigned)) + break; + + if ((pool->literals[entry].X_op == inst.reloc.exp.X_op) + && (inst.reloc.exp.X_op == O_symbol) + && (pool->literals[entry].X_add_number + == inst.reloc.exp.X_add_number) + && (pool->literals[entry].X_add_symbol + == inst.reloc.exp.X_add_symbol) + && (pool->literals[entry].X_op_symbol + == inst.reloc.exp.X_op_symbol)) + break; + } + + /* Do we need to create a new entry? */ + if (entry == pool->next_free_entry) + { + if (entry >= MAX_LITERAL_POOL_SIZE) + { + inst.error = _("literal pool overflow"); + return FAIL; + } + + pool->literals[entry] = inst.reloc.exp; + pool->next_free_entry += 1; + } + + inst.reloc.exp.X_op = O_symbol; + inst.reloc.exp.X_add_number = ((int) entry) * 4; + inst.reloc.exp.X_add_symbol = pool->symbol; + + return SUCCESS; +} + +/* Can't use symbol_new here, so have to create a symbol and then at + a later date assign it a value. Thats what these functions do. */ + +static void +symbol_locate (symbolS * symbolP, + const char * name, /* It is copied, the caller can modify. */ + segT segment, /* Segment identifier (SEG_). */ + valueT valu, /* Symbol value. */ + fragS * frag) /* Associated fragment. */ +{ + unsigned int name_length; + char * preserved_copy_of_name; + + name_length = strlen (name) + 1; /* +1 for \0. */ + obstack_grow (¬es, name, name_length); + preserved_copy_of_name = obstack_finish (¬es); + +#ifdef tc_canonicalize_symbol_name + preserved_copy_of_name = + tc_canonicalize_symbol_name (preserved_copy_of_name); +#endif + + S_SET_NAME (symbolP, preserved_copy_of_name); + + S_SET_SEGMENT (symbolP, segment); + S_SET_VALUE (symbolP, valu); + symbol_clear_list_pointers (symbolP); + + symbol_set_frag (symbolP, frag); + + /* Link to end of symbol chain. */ + { + extern int symbol_table_frozen; + + if (symbol_table_frozen) + abort (); + } + + symbol_append (symbolP, symbol_lastP, & symbol_rootP, & symbol_lastP); + + obj_symbol_new_hook (symbolP); + +#ifdef tc_symbol_new_hook + tc_symbol_new_hook (symbolP); +#endif + +#ifdef DEBUG_SYMS + verify_symbol_chain (symbol_rootP, symbol_lastP); +#endif /* DEBUG_SYMS */ +} + + +static void +s_ltorg (int ignored ATTRIBUTE_UNUSED) +{ + unsigned int entry; + literal_pool * pool; + char sym_name[20]; + + pool = find_literal_pool (); + if (pool == NULL + || pool->symbol == NULL + || pool->next_free_entry == 0) + return; + + mapping_state (MAP_DATA); + + /* Align pool as you have word accesses. + Only make a frag if we have to. */ + if (!need_pass_2) + frag_align (2, 0, 0); + + record_alignment (now_seg, 2); + + sprintf (sym_name, "$$lit_\002%x", pool->id); + + symbol_locate (pool->symbol, sym_name, now_seg, + (valueT) frag_now_fix (), frag_now); + symbol_table_insert (pool->symbol); + + ARM_SET_THUMB (pool->symbol, thumb_mode); + +#if defined OBJ_COFF || defined OBJ_ELF + ARM_SET_INTERWORK (pool->symbol, support_interwork); +#endif + + for (entry = 0; entry < pool->next_free_entry; entry ++) + /* First output the expression in the instruction to the pool. */ + emit_expr (&(pool->literals[entry]), 4); /* .word */ + + /* Mark the pool as empty. */ + pool->next_free_entry = 0; + pool->symbol = NULL; +} + +#ifdef OBJ_ELF +/* Forward declarations for functions below, in the MD interface + section. */ +static void fix_new_arm (fragS *, int, short, expressionS *, int, int); +static valueT create_unwind_entry (int); +static void start_unwind_section (const segT, int); +static void add_unwind_opcode (valueT, int); +static void flush_pending_unwind (void); + +/* Directives: Data. */ + +static void +s_arm_elf_cons (int nbytes) +{ + expressionS exp; + +#ifdef md_flush_pending_output + md_flush_pending_output (); +#endif + + if (is_it_end_of_statement ()) + { + demand_empty_rest_of_line (); + return; + } + +#ifdef md_cons_align + md_cons_align (nbytes); +#endif + + mapping_state (MAP_DATA); + do + { + int reloc; + char *base = input_line_pointer; + + expression (& exp); + + if (exp.X_op != O_symbol) + emit_expr (&exp, (unsigned int) nbytes); + else + { + char *before_reloc = input_line_pointer; + reloc = parse_reloc (&input_line_pointer); + if (reloc == -1) + { + as_bad (_("unrecognized relocation suffix")); + ignore_rest_of_line (); + return; + } + else if (reloc == BFD_RELOC_UNUSED) + emit_expr (&exp, (unsigned int) nbytes); + else + { + reloc_howto_type *howto = bfd_reloc_type_lookup (stdoutput, reloc); + int size = bfd_get_reloc_size (howto); + + if (reloc == BFD_RELOC_ARM_PLT32) + { + as_bad (_("(plt) is only valid on branch targets")); + reloc = BFD_RELOC_UNUSED; + size = 0; + } + + if (size > nbytes) + as_bad (_("%s relocations do not fit in %d bytes"), + howto->name, nbytes); + else + { + /* We've parsed an expression stopping at O_symbol. + But there may be more expression left now that we + have parsed the relocation marker. Parse it again. + XXX Surely there is a cleaner way to do this. */ + char *p = input_line_pointer; + int offset; + char *save_buf = alloca (input_line_pointer - base); + memcpy (save_buf, base, input_line_pointer - base); + memmove (base + (input_line_pointer - before_reloc), + base, before_reloc - base); + + input_line_pointer = base + (input_line_pointer-before_reloc); + expression (&exp); + memcpy (base, save_buf, p - base); + + offset = nbytes - size; + p = frag_more ((int) nbytes); + fix_new_exp (frag_now, p - frag_now->fr_literal + offset, + size, &exp, 0, reloc); + } + } + } + } + while (*input_line_pointer++ == ','); + + /* Put terminator back into stream. */ + input_line_pointer --; + demand_empty_rest_of_line (); +} + + +/* Parse a .rel31 directive. */ + +static void +s_arm_rel31 (int ignored ATTRIBUTE_UNUSED) +{ + expressionS exp; + char *p; + valueT highbit; + + highbit = 0; + if (*input_line_pointer == '1') + highbit = 0x80000000; + else if (*input_line_pointer != '0') + as_bad (_("expected 0 or 1")); + + input_line_pointer++; + if (*input_line_pointer != ',') + as_bad (_("missing comma")); + input_line_pointer++; + +#ifdef md_flush_pending_output + md_flush_pending_output (); +#endif + +#ifdef md_cons_align + md_cons_align (4); +#endif + + mapping_state (MAP_DATA); + + expression (&exp); + + p = frag_more (4); + md_number_to_chars (p, highbit, 4); + fix_new_arm (frag_now, p - frag_now->fr_literal, 4, &exp, 1, + BFD_RELOC_ARM_PREL31); + + demand_empty_rest_of_line (); +} + +/* Directives: AEABI stack-unwind tables. */ + +/* Parse an unwind_fnstart directive. Simply records the current location. */ + +static void +s_arm_unwind_fnstart (int ignored ATTRIBUTE_UNUSED) +{ + demand_empty_rest_of_line (); + /* Mark the start of the function. */ + unwind.proc_start = expr_build_dot (); + + /* Reset the rest of the unwind info. */ + unwind.opcode_count = 0; + unwind.table_entry = NULL; + unwind.personality_routine = NULL; + unwind.personality_index = -1; + unwind.frame_size = 0; + unwind.fp_offset = 0; + unwind.fp_reg = 13; + unwind.fp_used = 0; + unwind.sp_restored = 0; +} + + +/* Parse a handlerdata directive. Creates the exception handling table entry + for the function. */ + +static void +s_arm_unwind_handlerdata (int ignored ATTRIBUTE_UNUSED) +{ + demand_empty_rest_of_line (); + if (unwind.table_entry) + as_bad (_("dupicate .handlerdata directive")); + + create_unwind_entry (1); +} + +/* Parse an unwind_fnend directive. Generates the index table entry. */ + +static void +s_arm_unwind_fnend (int ignored ATTRIBUTE_UNUSED) +{ + long where; + char *ptr; + valueT val; + + demand_empty_rest_of_line (); + + /* Add eh table entry. */ + if (unwind.table_entry == NULL) + val = create_unwind_entry (0); + else + val = 0; + + /* Add index table entry. This is two words. */ + start_unwind_section (unwind.saved_seg, 1); + frag_align (2, 0, 0); + record_alignment (now_seg, 2); + + ptr = frag_more (8); + where = frag_now_fix () - 8; + + /* Self relative offset of the function start. */ + fix_new (frag_now, where, 4, unwind.proc_start, 0, 1, + BFD_RELOC_ARM_PREL31); + + /* Indicate dependency on EHABI-defined personality routines to the + linker, if it hasn't been done already. */ + if (unwind.personality_index >= 0 && unwind.personality_index < 3 + && !(marked_pr_dependency & (1 << unwind.personality_index))) + { + static const char *const name[] = { + "__aeabi_unwind_cpp_pr0", + "__aeabi_unwind_cpp_pr1", + "__aeabi_unwind_cpp_pr2" + }; + symbolS *pr = symbol_find_or_make (name[unwind.personality_index]); + fix_new (frag_now, where, 0, pr, 0, 1, BFD_RELOC_NONE); + marked_pr_dependency |= 1 << unwind.personality_index; + seg_info (now_seg)->tc_segment_info_data.marked_pr_dependency + = marked_pr_dependency; + } + + if (val) + /* Inline exception table entry. */ + md_number_to_chars (ptr + 4, val, 4); + else + /* Self relative offset of the table entry. */ + fix_new (frag_now, where + 4, 4, unwind.table_entry, 0, 1, + BFD_RELOC_ARM_PREL31); + + /* Restore the original section. */ + subseg_set (unwind.saved_seg, unwind.saved_subseg); +} + + +/* Parse an unwind_cantunwind directive. */ + +static void +s_arm_unwind_cantunwind (int ignored ATTRIBUTE_UNUSED) +{ + demand_empty_rest_of_line (); + if (unwind.personality_routine || unwind.personality_index != -1) + as_bad (_("personality routine specified for cantunwind frame")); + + unwind.personality_index = -2; +} + + +/* Parse a personalityindex directive. */ + +static void +s_arm_unwind_personalityindex (int ignored ATTRIBUTE_UNUSED) +{ + expressionS exp; + + if (unwind.personality_routine || unwind.personality_index != -1) + as_bad (_("duplicate .personalityindex directive")); + + expression (&exp); + + if (exp.X_op != O_constant + || exp.X_add_number < 0 || exp.X_add_number > 15) + { + as_bad (_("bad personality routine number")); + ignore_rest_of_line (); + return; + } + + unwind.personality_index = exp.X_add_number; + + demand_empty_rest_of_line (); +} + + +/* Parse a personality directive. */ + +static void +s_arm_unwind_personality (int ignored ATTRIBUTE_UNUSED) +{ + char *name, *p, c; + + if (unwind.personality_routine || unwind.personality_index != -1) + as_bad (_("duplicate .personality directive")); + + name = input_line_pointer; + c = get_symbol_end (); + p = input_line_pointer; + unwind.personality_routine = symbol_find_or_make (name); + *p = c; + demand_empty_rest_of_line (); +} + + +/* Parse a directive saving core registers. */ + +static void +s_arm_unwind_save_core (void) +{ + valueT op; + long range; + int n; + + range = parse_reg_list (&input_line_pointer); + if (range == FAIL) + { + as_bad (_("expected register list")); + ignore_rest_of_line (); + return; + } + + demand_empty_rest_of_line (); + + /* Turn .unwind_movsp ip followed by .unwind_save {..., ip, ...} + into .unwind_save {..., sp...}. We aren't bothered about the value of + ip because it is clobbered by calls. */ + if (unwind.sp_restored && unwind.fp_reg == 12 + && (range & 0x3000) == 0x1000) + { + unwind.opcode_count--; + unwind.sp_restored = 0; + range = (range | 0x2000) & ~0x1000; + unwind.pending_offset = 0; + } + + /* Pop r4-r15. */ + if (range & 0xfff0) + { + /* See if we can use the short opcodes. These pop a block of up to 8 + registers starting with r4, plus maybe r14. */ + for (n = 0; n < 8; n++) + { + /* Break at the first non-saved register. */ + if ((range & (1 << (n + 4))) == 0) + break; + } + /* See if there are any other bits set. */ + if (n == 0 || (range & (0xfff0 << n) & 0xbff0) != 0) + { + /* Use the long form. */ + op = 0x8000 | ((range >> 4) & 0xfff); + add_unwind_opcode (op, 2); + } + else + { + /* Use the short form. */ + if (range & 0x4000) + op = 0xa8; /* Pop r14. */ + else + op = 0xa0; /* Do not pop r14. */ + op |= (n - 1); + add_unwind_opcode (op, 1); + } + } + + /* Pop r0-r3. */ + if (range & 0xf) + { + op = 0xb100 | (range & 0xf); + add_unwind_opcode (op, 2); + } + + /* Record the number of bytes pushed. */ + for (n = 0; n < 16; n++) + { + if (range & (1 << n)) + unwind.frame_size += 4; + } +} + + +/* Parse a directive saving FPA registers. */ + +static void +s_arm_unwind_save_fpa (int reg) +{ + expressionS exp; + int num_regs; + valueT op; + + /* Get Number of registers to transfer. */ + if (skip_past_comma (&input_line_pointer) != FAIL) + expression (&exp); + else + exp.X_op = O_illegal; + + if (exp.X_op != O_constant) + { + as_bad (_("expected , ")); + ignore_rest_of_line (); + return; + } + + num_regs = exp.X_add_number; + + if (num_regs < 1 || num_regs > 4) + { + as_bad (_("number of registers must be in the range [1:4]")); + ignore_rest_of_line (); + return; + } + + demand_empty_rest_of_line (); + + if (reg == 4) + { + /* Short form. */ + op = 0xb4 | (num_regs - 1); + add_unwind_opcode (op, 1); + } + else + { + /* Long form. */ + op = 0xc800 | (reg << 4) | (num_regs - 1); + add_unwind_opcode (op, 2); + } + unwind.frame_size += num_regs * 12; +} + + +/* Parse a directive saving VFP registers. */ + +static void +s_arm_unwind_save_vfp (void) +{ + int count; + unsigned int reg; + valueT op; + + count = parse_vfp_reg_list (&input_line_pointer, ®, 1); + if (count == FAIL) + { + as_bad (_("expected register list")); + ignore_rest_of_line (); + return; + } + + demand_empty_rest_of_line (); + + if (reg == 8) + { + /* Short form. */ + op = 0xb8 | (count - 1); + add_unwind_opcode (op, 1); + } + else + { + /* Long form. */ + op = 0xb300 | (reg << 4) | (count - 1); + add_unwind_opcode (op, 2); + } + unwind.frame_size += count * 8 + 4; +} + + +/* Parse a directive saving iWMMXt data registers. */ + +static void +s_arm_unwind_save_mmxwr (void) +{ + int reg; + int hi_reg; + int i; + unsigned mask = 0; + valueT op; + + if (*input_line_pointer == '{') + input_line_pointer++; + + do + { + reg = arm_reg_parse (&input_line_pointer, REG_TYPE_MMXWR); + + if (reg == FAIL) + { + as_bad (_(reg_expected_msgs[REG_TYPE_MMXWR])); + goto error; + } + + if (mask >> reg) + as_tsktsk (_("register list not in ascending order")); + mask |= 1 << reg; + + if (*input_line_pointer == '-') + { + input_line_pointer++; + hi_reg = arm_reg_parse (&input_line_pointer, REG_TYPE_MMXWR); + if (hi_reg == FAIL) + { + as_bad (_(reg_expected_msgs[REG_TYPE_MMXWR])); + goto error; + } + else if (reg >= hi_reg) + { + as_bad (_("bad register range")); + goto error; + } + for (; reg < hi_reg; reg++) + mask |= 1 << reg; + } + } + while (skip_past_comma (&input_line_pointer) != FAIL); + + if (*input_line_pointer == '}') + input_line_pointer++; + + demand_empty_rest_of_line (); + + /* Generate any deferred opcodes becuuse we're going to be looking at + the list. */ + flush_pending_unwind (); + + for (i = 0; i < 16; i++) + { + if (mask & (1 << i)) + unwind.frame_size += 8; + } + + /* Attempt to combine with a previous opcode. We do this because gcc + likes to output separate unwind directives for a single block of + registers. */ + if (unwind.opcode_count > 0) + { + i = unwind.opcodes[unwind.opcode_count - 1]; + if ((i & 0xf8) == 0xc0) + { + i &= 7; + /* Only merge if the blocks are contiguous. */ + if (i < 6) + { + if ((mask & 0xfe00) == (1 << 9)) + { + mask |= ((1 << (i + 11)) - 1) & 0xfc00; + unwind.opcode_count--; + } + } + else if (i == 6 && unwind.opcode_count >= 2) + { + i = unwind.opcodes[unwind.opcode_count - 2]; + reg = i >> 4; + i &= 0xf; + + op = 0xffff << (reg - 1); + if (reg > 0 + || ((mask & op) == (1u << (reg - 1)))) + { + op = (1 << (reg + i + 1)) - 1; + op &= ~((1 << reg) - 1); + mask |= op; + unwind.opcode_count -= 2; + } + } + } + } + + hi_reg = 15; + /* We want to generate opcodes in the order the registers have been + saved, ie. descending order. */ + for (reg = 15; reg >= -1; reg--) + { + /* Save registers in blocks. */ + if (reg < 0 + || !(mask & (1 << reg))) + { + /* We found an unsaved reg. Generate opcodes to save the + preceeding block. */ + if (reg != hi_reg) + { + if (reg == 9) + { + /* Short form. */ + op = 0xc0 | (hi_reg - 10); + add_unwind_opcode (op, 1); + } + else + { + /* Long form. */ + op = 0xc600 | ((reg + 1) << 4) | ((hi_reg - reg) - 1); + add_unwind_opcode (op, 2); + } + } + hi_reg = reg - 1; + } + } + + return; +error: + ignore_rest_of_line (); +} + +static void +s_arm_unwind_save_mmxwcg (void) +{ + int reg; + int hi_reg; + unsigned mask = 0; + valueT op; + + if (*input_line_pointer == '{') + input_line_pointer++; + + do + { + reg = arm_reg_parse (&input_line_pointer, REG_TYPE_MMXWCG); + + if (reg == FAIL) + { + as_bad (_(reg_expected_msgs[REG_TYPE_MMXWCG])); + goto error; + } + + reg -= 8; + if (mask >> reg) + as_tsktsk (_("register list not in ascending order")); + mask |= 1 << reg; + + if (*input_line_pointer == '-') + { + input_line_pointer++; + hi_reg = arm_reg_parse (&input_line_pointer, REG_TYPE_MMXWCG); + if (hi_reg == FAIL) + { + as_bad (_(reg_expected_msgs[REG_TYPE_MMXWCG])); + goto error; + } + else if (reg >= hi_reg) + { + as_bad (_("bad register range")); + goto error; + } + for (; reg < hi_reg; reg++) + mask |= 1 << reg; + } + } + while (skip_past_comma (&input_line_pointer) != FAIL); + + if (*input_line_pointer == '}') + input_line_pointer++; + + demand_empty_rest_of_line (); + + /* Generate any deferred opcodes becuuse we're going to be looking at + the list. */ + flush_pending_unwind (); + + for (reg = 0; reg < 16; reg++) + { + if (mask & (1 << reg)) + unwind.frame_size += 4; + } + op = 0xc700 | mask; + add_unwind_opcode (op, 2); + return; +error: + ignore_rest_of_line (); +} + + +/* Parse an unwind_save directive. */ + +static void +s_arm_unwind_save (int ignored ATTRIBUTE_UNUSED) +{ + char *peek; + struct reg_entry *reg; + bfd_boolean had_brace = FALSE; + + /* Figure out what sort of save we have. */ + peek = input_line_pointer; + + if (*peek == '{') + { + had_brace = TRUE; + peek++; + } + + reg = arm_reg_parse_multi (&peek); + + if (!reg) + { + as_bad (_("register expected")); + ignore_rest_of_line (); + return; + } + + switch (reg->type) + { + case REG_TYPE_FN: + if (had_brace) + { + as_bad (_("FPA .unwind_save does not take a register list")); + ignore_rest_of_line (); + return; + } + s_arm_unwind_save_fpa (reg->number); + return; + + case REG_TYPE_RN: s_arm_unwind_save_core (); return; + case REG_TYPE_VFD: s_arm_unwind_save_vfp (); return; + case REG_TYPE_MMXWR: s_arm_unwind_save_mmxwr (); return; + case REG_TYPE_MMXWCG: s_arm_unwind_save_mmxwcg (); return; + + default: + as_bad (_(".unwind_save does not support this kind of register")); + ignore_rest_of_line (); + } +} + + +/* Parse an unwind_movsp directive. */ + +static void +s_arm_unwind_movsp (int ignored ATTRIBUTE_UNUSED) +{ + int reg; + valueT op; + + reg = arm_reg_parse (&input_line_pointer, REG_TYPE_RN); + if (reg == FAIL) + { + as_bad (_(reg_expected_msgs[REG_TYPE_RN])); + ignore_rest_of_line (); + return; + } + demand_empty_rest_of_line (); + + if (reg == REG_SP || reg == REG_PC) + { + as_bad (_("SP and PC not permitted in .unwind_movsp directive")); + return; + } + + if (unwind.fp_reg != REG_SP) + as_bad (_("unexpected .unwind_movsp directive")); + + /* Generate opcode to restore the value. */ + op = 0x90 | reg; + add_unwind_opcode (op, 1); + + /* Record the information for later. */ + unwind.fp_reg = reg; + unwind.fp_offset = unwind.frame_size; + unwind.sp_restored = 1; +} + +/* Parse an unwind_pad directive. */ + +static void +s_arm_unwind_pad (int ignored ATTRIBUTE_UNUSED) +{ + int offset; + + if (immediate_for_directive (&offset) == FAIL) + return; + + if (offset & 3) + { + as_bad (_("stack increment must be multiple of 4")); + ignore_rest_of_line (); + return; + } + + /* Don't generate any opcodes, just record the details for later. */ + unwind.frame_size += offset; + unwind.pending_offset += offset; + + demand_empty_rest_of_line (); +} + +/* Parse an unwind_setfp directive. */ + +static void +s_arm_unwind_setfp (int ignored ATTRIBUTE_UNUSED) +{ + int sp_reg; + int fp_reg; + int offset; + + fp_reg = arm_reg_parse (&input_line_pointer, REG_TYPE_RN); + if (skip_past_comma (&input_line_pointer) == FAIL) + sp_reg = FAIL; + else + sp_reg = arm_reg_parse (&input_line_pointer, REG_TYPE_RN); + + if (fp_reg == FAIL || sp_reg == FAIL) + { + as_bad (_("expected , ")); + ignore_rest_of_line (); + return; + } + + /* Optional constant. */ + if (skip_past_comma (&input_line_pointer) != FAIL) + { + if (immediate_for_directive (&offset) == FAIL) + return; + } + else + offset = 0; + + demand_empty_rest_of_line (); + + if (sp_reg != 13 && sp_reg != unwind.fp_reg) + { + as_bad (_("register must be either sp or set by a previous" + "unwind_movsp directive")); + return; + } + + /* Don't generate any opcodes, just record the information for later. */ + unwind.fp_reg = fp_reg; + unwind.fp_used = 1; + if (sp_reg == 13) + unwind.fp_offset = unwind.frame_size - offset; + else + unwind.fp_offset -= offset; +} + +/* Parse an unwind_raw directive. */ + +static void +s_arm_unwind_raw (int ignored ATTRIBUTE_UNUSED) +{ + expressionS exp; + /* This is an arbitary limit. */ + unsigned char op[16]; + int count; + + expression (&exp); + if (exp.X_op == O_constant + && skip_past_comma (&input_line_pointer) != FAIL) + { + unwind.frame_size += exp.X_add_number; + expression (&exp); + } + else + exp.X_op = O_illegal; + + if (exp.X_op != O_constant) + { + as_bad (_("expected , ")); + ignore_rest_of_line (); + return; + } + + count = 0; + + /* Parse the opcode. */ + for (;;) + { + if (count >= 16) + { + as_bad (_("unwind opcode too long")); + ignore_rest_of_line (); + } + if (exp.X_op != O_constant || exp.X_add_number & ~0xff) + { + as_bad (_("invalid unwind opcode")); + ignore_rest_of_line (); + return; + } + op[count++] = exp.X_add_number; + + /* Parse the next byte. */ + if (skip_past_comma (&input_line_pointer) == FAIL) + break; + + expression (&exp); + } + + /* Add the opcode bytes in reverse order. */ + while (count--) + add_unwind_opcode (op[count], 1); + + demand_empty_rest_of_line (); +} + + +/* Parse a .eabi_attribute directive. */ + +static void +s_arm_eabi_attribute (int ignored ATTRIBUTE_UNUSED) +{ + expressionS exp; + bfd_boolean is_string; + int tag; + unsigned int i = 0; + char *s = NULL; + char saved_char; + + expression (& exp); + if (exp.X_op != O_constant) + goto bad; + + tag = exp.X_add_number; + if (tag == 4 || tag == 5 || tag == 32 || (tag > 32 && (tag & 1) != 0)) + is_string = 1; + else + is_string = 0; + + if (skip_past_comma (&input_line_pointer) == FAIL) + goto bad; + if (tag == 32 || !is_string) + { + expression (& exp); + if (exp.X_op != O_constant) + { + as_bad (_("expected numeric constant")); + ignore_rest_of_line (); + return; + } + i = exp.X_add_number; + } + if (tag == Tag_compatibility + && skip_past_comma (&input_line_pointer) == FAIL) + { + as_bad (_("expected comma")); + ignore_rest_of_line (); + return; + } + if (is_string) + { + skip_whitespace(input_line_pointer); + if (*input_line_pointer != '"') + goto bad_string; + input_line_pointer++; + s = input_line_pointer; + while (*input_line_pointer && *input_line_pointer != '"') + input_line_pointer++; + if (*input_line_pointer != '"') + goto bad_string; + saved_char = *input_line_pointer; + *input_line_pointer = 0; + } + else + { + s = NULL; + saved_char = 0; + } + + if (tag == Tag_compatibility) + elf32_arm_add_eabi_attr_compat (stdoutput, i, s); + else if (is_string) + elf32_arm_add_eabi_attr_string (stdoutput, tag, s); + else + elf32_arm_add_eabi_attr_int (stdoutput, tag, i); + + if (s) + { + *input_line_pointer = saved_char; + input_line_pointer++; + } + demand_empty_rest_of_line (); + return; +bad_string: + as_bad (_("bad string constant")); + ignore_rest_of_line (); + return; +bad: + as_bad (_("expected , ")); + ignore_rest_of_line (); +} + +static void s_arm_arch (int); +static void s_arm_cpu (int); +static void s_arm_fpu (int); +#endif /* OBJ_ELF */ + +/* 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. */ + +const pseudo_typeS md_pseudo_table[] = +{ + /* Never called because '.req' does not start a line. */ + { "req", s_req, 0 }, + { "unreq", s_unreq, 0 }, + { "bss", s_bss, 0 }, + { "align", s_align, 0 }, + { "arm", s_arm, 0 }, + { "thumb", s_thumb, 0 }, + { "code", s_code, 0 }, + { "force_thumb", s_force_thumb, 0 }, + { "thumb_func", s_thumb_func, 0 }, + { "thumb_set", s_thumb_set, 0 }, + { "even", s_even, 0 }, + { "ltorg", s_ltorg, 0 }, + { "pool", s_ltorg, 0 }, + { "syntax", s_syntax, 0 }, +#ifdef OBJ_ELF + { "word", s_arm_elf_cons, 4 }, + { "long", s_arm_elf_cons, 4 }, + { "rel31", s_arm_rel31, 0 }, + { "fnstart", s_arm_unwind_fnstart, 0 }, + { "fnend", s_arm_unwind_fnend, 0 }, + { "cantunwind", s_arm_unwind_cantunwind, 0 }, + { "personality", s_arm_unwind_personality, 0 }, + { "personalityindex", s_arm_unwind_personalityindex, 0 }, + { "handlerdata", s_arm_unwind_handlerdata, 0 }, + { "save", s_arm_unwind_save, 0 }, + { "movsp", s_arm_unwind_movsp, 0 }, + { "pad", s_arm_unwind_pad, 0 }, + { "setfp", s_arm_unwind_setfp, 0 }, + { "unwind_raw", s_arm_unwind_raw, 0 }, + { "cpu", s_arm_cpu, 0 }, + { "arch", s_arm_arch, 0 }, + { "fpu", s_arm_fpu, 0 }, + { "eabi_attribute", s_arm_eabi_attribute, 0 }, +#else + { "word", cons, 4}, +#endif + { "extend", float_cons, 'x' }, + { "ldouble", float_cons, 'x' }, + { "packed", float_cons, 'p' }, + { 0, 0, 0 } +}; + +/* Parser functions used exclusively in instruction operands. */ + +/* Generic immediate-value read function for use in insn parsing. + STR points to the beginning of the immediate (the leading #); + VAL receives the value; if the value is outside [MIN, MAX] + issue an error. PREFIX_OPT is true if the immediate prefix is + optional. */ + +static int +parse_immediate (char **str, int *val, int min, int max, + bfd_boolean prefix_opt) +{ + expressionS exp; + my_get_expression (&exp, str, prefix_opt ? GE_OPT_PREFIX : GE_IMM_PREFIX); + if (exp.X_op != O_constant) + { + inst.error = _("constant expression required"); + return FAIL; + } + + if (exp.X_add_number < min || exp.X_add_number > max) + { + inst.error = _("immediate value out of range"); + return FAIL; + } + + *val = exp.X_add_number; + return SUCCESS; +} + +/* Returns the pseudo-register number of an FPA immediate constant, + or FAIL if there isn't a valid constant here. */ + +static int +parse_fpa_immediate (char ** str) +{ + LITTLENUM_TYPE words[MAX_LITTLENUMS]; + char * save_in; + expressionS exp; + int i; + int j; + + /* First try and match exact strings, this is to guarantee + that some formats will work even for cross assembly. */ + + for (i = 0; fp_const[i]; i++) + { + if (strncmp (*str, fp_const[i], strlen (fp_const[i])) == 0) + { + char *start = *str; + + *str += strlen (fp_const[i]); + if (is_end_of_line[(unsigned char) **str]) + return i + 8; + *str = start; + } + } + + /* Just because we didn't get a match doesn't mean that the constant + isn't valid, just that it is in a format that we don't + automatically recognize. Try parsing it with the standard + expression routines. */ + + memset (words, 0, MAX_LITTLENUMS * sizeof (LITTLENUM_TYPE)); + + /* Look for a raw floating point number. */ + if ((save_in = atof_ieee (*str, 'x', words)) != NULL + && is_end_of_line[(unsigned char) *save_in]) + { + for (i = 0; i < NUM_FLOAT_VALS; i++) + { + for (j = 0; j < MAX_LITTLENUMS; j++) + { + if (words[j] != fp_values[i][j]) + break; + } + + if (j == MAX_LITTLENUMS) + { + *str = save_in; + return i + 8; + } + } + } + + /* Try and parse a more complex expression, this will probably fail + unless the code uses a floating point prefix (eg "0f"). */ + save_in = input_line_pointer; + input_line_pointer = *str; + if (expression (&exp) == absolute_section + && exp.X_op == O_big + && exp.X_add_number < 0) + { + /* FIXME: 5 = X_PRECISION, should be #define'd where we can use it. + Ditto for 15. */ + if (gen_to_words (words, 5, (long) 15) == 0) + { + for (i = 0; i < NUM_FLOAT_VALS; i++) + { + for (j = 0; j < MAX_LITTLENUMS; j++) + { + if (words[j] != fp_values[i][j]) + break; + } + + if (j == MAX_LITTLENUMS) + { + *str = input_line_pointer; + input_line_pointer = save_in; + return i + 8; + } + } + } + } + + *str = input_line_pointer; + input_line_pointer = save_in; + inst.error = _("invalid FPA immediate expression"); + return FAIL; +} + +/* Shift operands. */ +enum shift_kind +{ + SHIFT_LSL, SHIFT_LSR, SHIFT_ASR, SHIFT_ROR, SHIFT_RRX +}; + +struct asm_shift_name +{ + const char *name; + enum shift_kind kind; +}; + +/* Third argument to parse_shift. */ +enum parse_shift_mode +{ + NO_SHIFT_RESTRICT, /* Any kind of shift is accepted. */ + SHIFT_IMMEDIATE, /* Shift operand must be an immediate. */ + SHIFT_LSL_OR_ASR_IMMEDIATE, /* Shift must be LSL or ASR immediate. */ + SHIFT_ASR_IMMEDIATE, /* Shift must be ASR immediate. */ + SHIFT_LSL_IMMEDIATE, /* Shift must be LSL immediate. */ +}; + +/* Parse a specifier on an ARM data processing instruction. + This has three forms: + + (LSL|LSR|ASL|ASR|ROR) Rs + (LSL|LSR|ASL|ASR|ROR) #imm + RRX + + Note that ASL is assimilated to LSL in the instruction encoding, and + RRX to ROR #0 (which cannot be written as such). */ + +static int +parse_shift (char **str, int i, enum parse_shift_mode mode) +{ + const struct asm_shift_name *shift_name; + enum shift_kind shift; + char *s = *str; + char *p = s; + int reg; + + for (p = *str; ISALPHA (*p); p++) + ; + + if (p == *str) + { + inst.error = _("shift expression expected"); + return FAIL; + } + + shift_name = hash_find_n (arm_shift_hsh, *str, p - *str); + + if (shift_name == NULL) + { + inst.error = _("shift expression expected"); + return FAIL; + } + + shift = shift_name->kind; + + switch (mode) + { + case NO_SHIFT_RESTRICT: + case SHIFT_IMMEDIATE: break; + + case SHIFT_LSL_OR_ASR_IMMEDIATE: + if (shift != SHIFT_LSL && shift != SHIFT_ASR) + { + inst.error = _("'LSL' or 'ASR' required"); + return FAIL; + } + break; + + case SHIFT_LSL_IMMEDIATE: + if (shift != SHIFT_LSL) + { + inst.error = _("'LSL' required"); + return FAIL; + } + break; + + case SHIFT_ASR_IMMEDIATE: + if (shift != SHIFT_ASR) + { + inst.error = _("'ASR' required"); + return FAIL; + } + break; + + default: abort (); + } + + if (shift != SHIFT_RRX) + { + /* Whitespace can appear here if the next thing is a bare digit. */ + skip_whitespace (p); + + if (mode == NO_SHIFT_RESTRICT + && (reg = arm_reg_parse (&p, REG_TYPE_RN)) != FAIL) + { + inst.operands[i].imm = reg; + inst.operands[i].immisreg = 1; + } + else if (my_get_expression (&inst.reloc.exp, &p, GE_IMM_PREFIX)) + return FAIL; + } + inst.operands[i].shift_kind = shift; + inst.operands[i].shifted = 1; + *str = p; + return SUCCESS; +} + +/* Parse a for an ARM data processing instruction: + + # + #, + + , + + where is defined by parse_shift above, and is a + multiple of 2 between 0 and 30. Validation of immediate operands + is deferred to md_apply_fix. */ + +static int +parse_shifter_operand (char **str, int i) +{ + int value; + expressionS expr; + + if ((value = arm_reg_parse (str, REG_TYPE_RN)) != FAIL) + { + inst.operands[i].reg = value; + inst.operands[i].isreg = 1; + + /* parse_shift will override this if appropriate */ + inst.reloc.exp.X_op = O_constant; + inst.reloc.exp.X_add_number = 0; + + if (skip_past_comma (str) == FAIL) + return SUCCESS; + + /* Shift operation on register. */ + return parse_shift (str, i, NO_SHIFT_RESTRICT); + } + + if (my_get_expression (&inst.reloc.exp, str, GE_IMM_PREFIX)) + return FAIL; + + if (skip_past_comma (str) == SUCCESS) + { + /* #x, y -- ie explicit rotation by Y. */ + if (my_get_expression (&expr, str, GE_NO_PREFIX)) + return FAIL; + + if (expr.X_op != O_constant || inst.reloc.exp.X_op != O_constant) + { + inst.error = _("constant expression expected"); + return FAIL; + } + + value = expr.X_add_number; + if (value < 0 || value > 30 || value % 2 != 0) + { + inst.error = _("invalid rotation"); + return FAIL; + } + if (inst.reloc.exp.X_add_number < 0 || inst.reloc.exp.X_add_number > 255) + { + inst.error = _("invalid constant"); + return FAIL; + } + + /* Convert to decoded value. md_apply_fix will put it back. */ + inst.reloc.exp.X_add_number + = (((inst.reloc.exp.X_add_number << (32 - value)) + | (inst.reloc.exp.X_add_number >> value)) & 0xffffffff); + } + + inst.reloc.type = BFD_RELOC_ARM_IMMEDIATE; + inst.reloc.pc_rel = 0; + return SUCCESS; +} + +/* Parse all forms of an ARM address expression. Information is written + to inst.operands[i] and/or inst.reloc. + + Preindexed addressing (.preind=1): + + [Rn, #offset] .reg=Rn .reloc.exp=offset + [Rn, +/-Rm] .reg=Rn .imm=Rm .immisreg=1 .negative=0/1 + [Rn, +/-Rm, shift] .reg=Rn .imm=Rm .immisreg=1 .negative=0/1 + .shift_kind=shift .reloc.exp=shift_imm + + These three may have a trailing ! which causes .writeback to be set also. + + Postindexed addressing (.postind=1, .writeback=1): + + [Rn], #offset .reg=Rn .reloc.exp=offset + [Rn], +/-Rm .reg=Rn .imm=Rm .immisreg=1 .negative=0/1 + [Rn], +/-Rm, shift .reg=Rn .imm=Rm .immisreg=1 .negative=0/1 + .shift_kind=shift .reloc.exp=shift_imm + + Unindexed addressing (.preind=0, .postind=0): + + [Rn], {option} .reg=Rn .imm=option .immisreg=0 + + Other: + + [Rn]{!} shorthand for [Rn,#0]{!} + =immediate .isreg=0 .reloc.exp=immediate + label .reg=PC .reloc.pc_rel=1 .reloc.exp=label + + It is the caller's responsibility to check for addressing modes not + supported by the instruction, and to set inst.reloc.type. */ + +static int +parse_address (char **str, int i) +{ + char *p = *str; + int reg; + + if (skip_past_char (&p, '[') == FAIL) + { + if (skip_past_char (&p, '=') == FAIL) + { + /* bare address - translate to PC-relative offset */ + inst.reloc.pc_rel = 1; + inst.operands[i].reg = REG_PC; + inst.operands[i].isreg = 1; + inst.operands[i].preind = 1; + } + /* else a load-constant pseudo op, no special treatment needed here */ + + if (my_get_expression (&inst.reloc.exp, &p, GE_NO_PREFIX)) + return FAIL; + + *str = p; + return SUCCESS; + } + + if ((reg = arm_reg_parse (&p, REG_TYPE_RN)) == FAIL) + { + inst.error = _(reg_expected_msgs[REG_TYPE_RN]); + return FAIL; + } + inst.operands[i].reg = reg; + inst.operands[i].isreg = 1; + + if (skip_past_comma (&p) == SUCCESS) + { + inst.operands[i].preind = 1; + + if (*p == '+') p++; + else if (*p == '-') p++, inst.operands[i].negative = 1; + + if ((reg = arm_reg_parse (&p, REG_TYPE_RN)) != FAIL) + { + inst.operands[i].imm = reg; + inst.operands[i].immisreg = 1; + + if (skip_past_comma (&p) == SUCCESS) + if (parse_shift (&p, i, SHIFT_IMMEDIATE) == FAIL) + return FAIL; + } + else + { + if (inst.operands[i].negative) + { + inst.operands[i].negative = 0; + p--; + } + if (my_get_expression (&inst.reloc.exp, &p, GE_IMM_PREFIX)) + return FAIL; + } + } + + if (skip_past_char (&p, ']') == FAIL) + { + inst.error = _("']' expected"); + return FAIL; + } + + if (skip_past_char (&p, '!') == SUCCESS) + inst.operands[i].writeback = 1; + + else if (skip_past_comma (&p) == SUCCESS) + { + if (skip_past_char (&p, '{') == SUCCESS) + { + /* [Rn], {expr} - unindexed, with option */ + if (parse_immediate (&p, &inst.operands[i].imm, + 0, 255, TRUE) == FAIL) + return FAIL; + + if (skip_past_char (&p, '}') == FAIL) + { + inst.error = _("'}' expected at end of 'option' field"); + return FAIL; + } + if (inst.operands[i].preind) + { + inst.error = _("cannot combine index with option"); + return FAIL; + } + *str = p; + return SUCCESS; + } + else + { + inst.operands[i].postind = 1; + inst.operands[i].writeback = 1; + + if (inst.operands[i].preind) + { + inst.error = _("cannot combine pre- and post-indexing"); + return FAIL; + } + + if (*p == '+') p++; + else if (*p == '-') p++, inst.operands[i].negative = 1; + + if ((reg = arm_reg_parse (&p, REG_TYPE_RN)) != FAIL) + { + inst.operands[i].imm = reg; + inst.operands[i].immisreg = 1; + + if (skip_past_comma (&p) == SUCCESS) + if (parse_shift (&p, i, SHIFT_IMMEDIATE) == FAIL) + return FAIL; + } + else + { + if (inst.operands[i].negative) + { + inst.operands[i].negative = 0; + p--; + } + if (my_get_expression (&inst.reloc.exp, &p, GE_IMM_PREFIX)) + return FAIL; + } + } + } + + /* If at this point neither .preind nor .postind is set, we have a + bare [Rn]{!}, which is shorthand for [Rn,#0]{!}. */ + if (inst.operands[i].preind == 0 && inst.operands[i].postind == 0) + { + inst.operands[i].preind = 1; + inst.reloc.exp.X_op = O_constant; + inst.reloc.exp.X_add_number = 0; + } + *str = p; + return SUCCESS; +} + +/* Miscellaneous. */ + +/* Parse a PSR flag operand. The value returned is FAIL on syntax error, + or a bitmask suitable to be or-ed into the ARM msr instruction. */ +static int +parse_psr (char **str) +{ + char *p; + unsigned long psr_field; + const struct asm_psr *psr; + char *start; + + /* CPSR's and SPSR's can now be lowercase. This is just a convenience + feature for ease of use and backwards compatibility. */ + p = *str; + if (strncasecmp (p, "SPSR", 4) == 0) + psr_field = SPSR_BIT; + else if (strncasecmp (p, "CPSR", 4) == 0) + psr_field = 0; + else + { + start = p; + do + p++; + while (ISALNUM (*p) || *p == '_'); + + psr = hash_find_n (arm_v7m_psr_hsh, start, p - start); + if (!psr) + return FAIL; + + *str = p; + return psr->field; + } + + p += 4; + if (*p == '_') + { + /* A suffix follows. */ + p++; + start = p; + + do + p++; + while (ISALNUM (*p) || *p == '_'); + + psr = hash_find_n (arm_psr_hsh, start, p - start); + if (!psr) + goto error; + + psr_field |= psr->field; + } + else + { + if (ISALNUM (*p)) + goto error; /* Garbage after "[CS]PSR". */ + + psr_field |= (PSR_c | PSR_f); + } + *str = p; + return psr_field; + + error: + inst.error = _("flag for {c}psr instruction expected"); + return FAIL; +} + +/* Parse the flags argument to CPSI[ED]. Returns FAIL on error, or a + value suitable for splatting into the AIF field of the instruction. */ + +static int +parse_cps_flags (char **str) +{ + int val = 0; + int saw_a_flag = 0; + char *s = *str; + + for (;;) + switch (*s++) + { + case '\0': case ',': + goto done; + + case 'a': case 'A': saw_a_flag = 1; val |= 0x4; break; + case 'i': case 'I': saw_a_flag = 1; val |= 0x2; break; + case 'f': case 'F': saw_a_flag = 1; val |= 0x1; break; + + default: + inst.error = _("unrecognized CPS flag"); + return FAIL; + } + + done: + if (saw_a_flag == 0) + { + inst.error = _("missing CPS flags"); + return FAIL; + } + + *str = s - 1; + return val; +} + +/* Parse an endian specifier ("BE" or "LE", case insensitive); + returns 0 for big-endian, 1 for little-endian, FAIL for an error. */ + +static int +parse_endian_specifier (char **str) +{ + int little_endian; + char *s = *str; + + if (strncasecmp (s, "BE", 2)) + little_endian = 0; + else if (strncasecmp (s, "LE", 2)) + little_endian = 1; + else + { + inst.error = _("valid endian specifiers are be or le"); + return FAIL; + } + + if (ISALNUM (s[2]) || s[2] == '_') + { + inst.error = _("valid endian specifiers are be or le"); + return FAIL; + } + + *str = s + 2; + return little_endian; +} + +/* Parse a rotation specifier: ROR #0, #8, #16, #24. *val receives a + value suitable for poking into the rotate field of an sxt or sxta + instruction, or FAIL on error. */ + +static int +parse_ror (char **str) +{ + int rot; + char *s = *str; + + if (strncasecmp (s, "ROR", 3) == 0) + s += 3; + else + { + inst.error = _("missing rotation field after comma"); + return FAIL; + } + + if (parse_immediate (&s, &rot, 0, 24, FALSE) == FAIL) + return FAIL; + + switch (rot) + { + case 0: *str = s; return 0x0; + case 8: *str = s; return 0x1; + case 16: *str = s; return 0x2; + case 24: *str = s; return 0x3; + + default: + inst.error = _("rotation can only be 0, 8, 16, or 24"); + return FAIL; + } +} + +/* Parse a conditional code (from conds[] below). The value returned is in the + range 0 .. 14, or FAIL. */ +static int +parse_cond (char **str) +{ + char *p, *q; + const struct asm_cond *c; + + p = q = *str; + while (ISALPHA (*q)) + q++; + + c = hash_find_n (arm_cond_hsh, p, q - p); + if (!c) + { + inst.error = _("condition required"); + return FAIL; + } + + *str = q; + return c->value; +} + +/* Parse an option for a barrier instruction. Returns the encoding for the + option, or FAIL. */ +static int +parse_barrier (char **str) +{ + char *p, *q; + const struct asm_barrier_opt *o; + + p = q = *str; + while (ISALPHA (*q)) + q++; + + o = hash_find_n (arm_barrier_opt_hsh, p, q - p); + if (!o) + return FAIL; + + *str = q; + return o->value; +} + +/* Parse the operands of a table branch instruction. Similar to a memory + operand. */ +static int +parse_tb (char **str) +{ + char * p = *str; + int reg; + + if (skip_past_char (&p, '[') == FAIL) + { + inst.error = _("'[' expected"); + return FAIL; + } + + if ((reg = arm_reg_parse (&p, REG_TYPE_RN)) == FAIL) + { + inst.error = _(reg_expected_msgs[REG_TYPE_RN]); + return FAIL; + } + inst.operands[0].reg = reg; + + if (skip_past_comma (&p) == FAIL) + { + inst.error = _("',' expected"); + return FAIL; + } + + if ((reg = arm_reg_parse (&p, REG_TYPE_RN)) == FAIL) + { + inst.error = _(reg_expected_msgs[REG_TYPE_RN]); + return FAIL; + } + inst.operands[0].imm = reg; + + if (skip_past_comma (&p) == SUCCESS) + { + if (parse_shift (&p, 0, SHIFT_LSL_IMMEDIATE) == FAIL) + return FAIL; + if (inst.reloc.exp.X_add_number != 1) + { + inst.error = _("invalid shift"); + return FAIL; + } + inst.operands[0].shifted = 1; + } + + if (skip_past_char (&p, ']') == FAIL) + { + inst.error = _("']' expected"); + return FAIL; + } + *str = p; + return SUCCESS; +} + +/* Matcher codes for parse_operands. */ +enum operand_parse_code +{ + OP_stop, /* end of line */ + + OP_RR, /* ARM register */ + OP_RRnpc, /* ARM register, not r15 */ + OP_RRnpcb, /* ARM register, not r15, in square brackets */ + OP_RRw, /* ARM register, not r15, optional trailing ! */ + OP_RCP, /* Coprocessor number */ + OP_RCN, /* Coprocessor register */ + OP_RF, /* FPA register */ + OP_RVS, /* VFP single precision register */ + OP_RVD, /* VFP double precision register */ + OP_RVC, /* VFP control register */ + OP_RMF, /* Maverick F register */ + OP_RMD, /* Maverick D register */ + OP_RMFX, /* Maverick FX register */ + OP_RMDX, /* Maverick DX register */ + OP_RMAX, /* Maverick AX register */ + OP_RMDS, /* Maverick DSPSC register */ + OP_RIWR, /* iWMMXt wR register */ + OP_RIWC, /* iWMMXt wC register */ + OP_RIWG, /* iWMMXt wCG register */ + OP_RXA, /* XScale accumulator register */ + + OP_REGLST, /* ARM register list */ + OP_VRSLST, /* VFP single-precision register list */ + OP_VRDLST, /* VFP double-precision register list */ + + OP_I7, /* immediate value 0 .. 7 */ + OP_I15, /* 0 .. 15 */ + OP_I16, /* 1 .. 16 */ + OP_I31, /* 0 .. 31 */ + OP_I31w, /* 0 .. 31, optional trailing ! */ + OP_I32, /* 1 .. 32 */ + OP_I63s, /* -64 .. 63 */ + OP_I255, /* 0 .. 255 */ + OP_Iffff, /* 0 .. 65535 */ + + OP_I4b, /* immediate, prefix optional, 1 .. 4 */ + OP_I7b, /* 0 .. 7 */ + OP_I15b, /* 0 .. 15 */ + OP_I31b, /* 0 .. 31 */ + + OP_SH, /* shifter operand */ + OP_ADDR, /* Memory address expression (any mode) */ + OP_EXP, /* arbitrary expression */ + OP_EXPi, /* same, with optional immediate prefix */ + OP_EXPr, /* same, with optional relocation suffix */ + + OP_CPSF, /* CPS flags */ + OP_ENDI, /* Endianness specifier */ + OP_PSR, /* CPSR/SPSR mask for msr */ + OP_COND, /* conditional code */ + OP_TB, /* Table branch. */ + + OP_RRnpc_I0, /* ARM register or literal 0 */ + OP_RR_EXr, /* ARM register or expression with opt. reloc suff. */ + OP_RR_EXi, /* ARM register or expression with imm prefix */ + OP_RF_IF, /* FPA register or immediate */ + OP_RIWR_RIWC, /* iWMMXt R or C reg */ + + /* Optional operands. */ + OP_oI7b, /* immediate, prefix optional, 0 .. 7 */ + OP_oI31b, /* 0 .. 31 */ + OP_oIffffb, /* 0 .. 65535 */ + OP_oI255c, /* curly-brace enclosed, 0 .. 255 */ + + OP_oRR, /* ARM register */ + OP_oRRnpc, /* ARM register, not the PC */ + OP_oSHll, /* LSL immediate */ + OP_oSHar, /* ASR immediate */ + OP_oSHllar, /* LSL or ASR immediate */ + OP_oROR, /* ROR 0/8/16/24 */ + OP_oBARRIER, /* Option argument for a barrier instruction. */ + + OP_FIRST_OPTIONAL = OP_oI7b +}; + +/* Generic instruction operand parser. This does no encoding and no + semantic validation; it merely squirrels values away in the inst + structure. Returns SUCCESS or FAIL depending on whether the + specified grammar matched. */ +static int +parse_operands (char *str, const unsigned char *pattern) +{ + unsigned const char *upat = pattern; + char *backtrack_pos = 0; + const char *backtrack_error = 0; + int i, val, backtrack_index = 0; + +#define po_char_or_fail(chr) do { \ + if (skip_past_char (&str, chr) == FAIL) \ + goto bad_args; \ +} while (0) + +#define po_reg_or_fail(regtype) do { \ + val = arm_reg_parse (&str, regtype); \ + if (val == FAIL) \ + { \ + inst.error = _(reg_expected_msgs[regtype]); \ + goto failure; \ + } \ + inst.operands[i].reg = val; \ + inst.operands[i].isreg = 1; \ +} while (0) + +#define po_reg_or_goto(regtype, label) do { \ + val = arm_reg_parse (&str, regtype); \ + if (val == FAIL) \ + goto label; \ + \ + inst.operands[i].reg = val; \ + inst.operands[i].isreg = 1; \ +} while (0) + +#define po_imm_or_fail(min, max, popt) do { \ + if (parse_immediate (&str, &val, min, max, popt) == FAIL) \ + goto failure; \ + inst.operands[i].imm = val; \ +} while (0) + +#define po_misc_or_fail(expr) do { \ + if (expr) \ + goto failure; \ +} while (0) + + skip_whitespace (str); + + for (i = 0; upat[i] != OP_stop; i++) + { + if (upat[i] >= OP_FIRST_OPTIONAL) + { + /* Remember where we are in case we need to backtrack. */ + assert (!backtrack_pos); + backtrack_pos = str; + backtrack_error = inst.error; + backtrack_index = i; + } + + if (i > 0) + po_char_or_fail (','); + + switch (upat[i]) + { + /* Registers */ + case OP_oRRnpc: + case OP_RRnpc: + case OP_oRR: + case OP_RR: po_reg_or_fail (REG_TYPE_RN); break; + case OP_RCP: po_reg_or_fail (REG_TYPE_CP); break; + case OP_RCN: po_reg_or_fail (REG_TYPE_CN); break; + case OP_RF: po_reg_or_fail (REG_TYPE_FN); break; + case OP_RVS: po_reg_or_fail (REG_TYPE_VFS); break; + case OP_RVD: po_reg_or_fail (REG_TYPE_VFD); break; + case OP_RVC: po_reg_or_fail (REG_TYPE_VFC); break; + case OP_RMF: po_reg_or_fail (REG_TYPE_MVF); break; + case OP_RMD: po_reg_or_fail (REG_TYPE_MVD); break; + case OP_RMFX: po_reg_or_fail (REG_TYPE_MVFX); break; + case OP_RMDX: po_reg_or_fail (REG_TYPE_MVDX); break; + case OP_RMAX: po_reg_or_fail (REG_TYPE_MVAX); break; + case OP_RMDS: po_reg_or_fail (REG_TYPE_DSPSC); break; + case OP_RIWR: po_reg_or_fail (REG_TYPE_MMXWR); break; + case OP_RIWC: po_reg_or_fail (REG_TYPE_MMXWC); break; + case OP_RIWG: po_reg_or_fail (REG_TYPE_MMXWCG); break; + case OP_RXA: po_reg_or_fail (REG_TYPE_XSCALE); break; + + case OP_RRnpcb: + po_char_or_fail ('['); + po_reg_or_fail (REG_TYPE_RN); + po_char_or_fail (']'); + break; + + case OP_RRw: + po_reg_or_fail (REG_TYPE_RN); + if (skip_past_char (&str, '!') == SUCCESS) + inst.operands[i].writeback = 1; + break; + + /* Immediates */ + case OP_I7: po_imm_or_fail ( 0, 7, FALSE); break; + case OP_I15: po_imm_or_fail ( 0, 15, FALSE); break; + case OP_I16: po_imm_or_fail ( 1, 16, FALSE); break; + case OP_I31: po_imm_or_fail ( 0, 31, FALSE); break; + case OP_I32: po_imm_or_fail ( 1, 32, FALSE); break; + case OP_I63s: po_imm_or_fail (-64, 63, FALSE); break; + case OP_I255: po_imm_or_fail ( 0, 255, FALSE); break; + case OP_Iffff: po_imm_or_fail ( 0, 0xffff, FALSE); break; + + case OP_I4b: po_imm_or_fail ( 1, 4, TRUE); break; + case OP_oI7b: + case OP_I7b: po_imm_or_fail ( 0, 7, TRUE); break; + case OP_I15b: po_imm_or_fail ( 0, 15, TRUE); break; + case OP_oI31b: + case OP_I31b: po_imm_or_fail ( 0, 31, TRUE); break; + case OP_oIffffb: po_imm_or_fail ( 0, 0xffff, TRUE); break; + + /* Immediate variants */ + case OP_oI255c: + po_char_or_fail ('{'); + po_imm_or_fail (0, 255, TRUE); + po_char_or_fail ('}'); + break; + + case OP_I31w: + /* The expression parser chokes on a trailing !, so we have + to find it first and zap it. */ + { + char *s = str; + while (*s && *s != ',') + s++; + if (s[-1] == '!') + { + s[-1] = '\0'; + inst.operands[i].writeback = 1; + } + po_imm_or_fail (0, 31, TRUE); + if (str == s - 1) + str = s; + } + break; + + /* Expressions */ + case OP_EXPi: EXPi: + po_misc_or_fail (my_get_expression (&inst.reloc.exp, &str, + GE_OPT_PREFIX)); + break; + + case OP_EXP: + po_misc_or_fail (my_get_expression (&inst.reloc.exp, &str, + GE_NO_PREFIX)); + break; + + case OP_EXPr: EXPr: + po_misc_or_fail (my_get_expression (&inst.reloc.exp, &str, + GE_NO_PREFIX)); + if (inst.reloc.exp.X_op == O_symbol) + { + val = parse_reloc (&str); + if (val == -1) + { + inst.error = _("unrecognized relocation suffix"); + goto failure; + } + else if (val != BFD_RELOC_UNUSED) + { + inst.operands[i].imm = val; + inst.operands[i].hasreloc = 1; + } + } + break; + + /* Register or expression */ + case OP_RR_EXr: po_reg_or_goto (REG_TYPE_RN, EXPr); break; + case OP_RR_EXi: po_reg_or_goto (REG_TYPE_RN, EXPi); break; + + /* Register or immediate */ + case OP_RRnpc_I0: po_reg_or_goto (REG_TYPE_RN, I0); break; + I0: po_imm_or_fail (0, 0, FALSE); break; + + case OP_RF_IF: po_reg_or_goto (REG_TYPE_FN, IF); break; + IF: + if (!is_immediate_prefix (*str)) + goto bad_args; + str++; + val = parse_fpa_immediate (&str); + if (val == FAIL) + goto failure; + /* FPA immediates are encoded as registers 8-15. + parse_fpa_immediate has already applied the offset. */ + inst.operands[i].reg = val; + inst.operands[i].isreg = 1; + break; + + /* Two kinds of register */ + case OP_RIWR_RIWC: + { + struct reg_entry *rege = arm_reg_parse_multi (&str); + if (rege->type != REG_TYPE_MMXWR + && rege->type != REG_TYPE_MMXWC + && rege->type != REG_TYPE_MMXWCG) + { + inst.error = _("iWMMXt data or control register expected"); + goto failure; + } + inst.operands[i].reg = rege->number; + inst.operands[i].isreg = (rege->type == REG_TYPE_MMXWR); + } + break; + + /* Misc */ + case OP_CPSF: val = parse_cps_flags (&str); break; + case OP_ENDI: val = parse_endian_specifier (&str); break; + case OP_oROR: val = parse_ror (&str); break; + case OP_PSR: val = parse_psr (&str); break; + case OP_COND: val = parse_cond (&str); break; + case OP_oBARRIER:val = parse_barrier (&str); break; + + case OP_TB: + po_misc_or_fail (parse_tb (&str)); + break; + + /* Register lists */ + case OP_REGLST: + val = parse_reg_list (&str); + if (*str == '^') + { + inst.operands[1].writeback = 1; + str++; + } + break; + + case OP_VRSLST: + val = parse_vfp_reg_list (&str, &inst.operands[i].reg, 0); + break; + + case OP_VRDLST: + val = parse_vfp_reg_list (&str, &inst.operands[i].reg, 1); + break; + + /* Addressing modes */ + case OP_ADDR: + po_misc_or_fail (parse_address (&str, i)); + break; + + case OP_SH: + po_misc_or_fail (parse_shifter_operand (&str, i)); + break; + + case OP_oSHll: + po_misc_or_fail (parse_shift (&str, i, SHIFT_LSL_IMMEDIATE)); + break; + + case OP_oSHar: + po_misc_or_fail (parse_shift (&str, i, SHIFT_ASR_IMMEDIATE)); + break; + + case OP_oSHllar: + po_misc_or_fail (parse_shift (&str, i, SHIFT_LSL_OR_ASR_IMMEDIATE)); + break; + + default: + as_fatal ("unhandled operand code %d", upat[i]); + } + + /* Various value-based sanity checks and shared operations. We + do not signal immediate failures for the register constraints; + this allows a syntax error to take precedence. */ + switch (upat[i]) + { + case OP_oRRnpc: + case OP_RRnpc: + case OP_RRnpcb: + case OP_RRw: + case OP_RRnpc_I0: + if (inst.operands[i].isreg && inst.operands[i].reg == REG_PC) + inst.error = BAD_PC; + break; + + case OP_CPSF: + case OP_ENDI: + case OP_oROR: + case OP_PSR: + case OP_COND: + case OP_oBARRIER: + case OP_REGLST: + case OP_VRSLST: + case OP_VRDLST: + if (val == FAIL) + goto failure; + inst.operands[i].imm = val; + break; + + default: + break; + } + + /* If we get here, this operand was successfully parsed. */ + inst.operands[i].present = 1; + continue; + + bad_args: + inst.error = BAD_ARGS; + + failure: + if (!backtrack_pos) + { + /* The parse routine should already have set inst.error, but set a + defaut here just in case. */ + if (!inst.error) + inst.error = _("syntax error"); + return FAIL; + } + + /* Do not backtrack over a trailing optional argument that + absorbed some text. We will only fail again, with the + 'garbage following instruction' error message, which is + probably less helpful than the current one. */ + if (backtrack_index == i && backtrack_pos != str + && upat[i+1] == OP_stop) + { + if (!inst.error) + inst.error = _("syntax error"); + return FAIL; + } + + /* Try again, skipping the optional argument at backtrack_pos. */ + str = backtrack_pos; + inst.error = backtrack_error; + inst.operands[backtrack_index].present = 0; + i = backtrack_index; + backtrack_pos = 0; + } + + /* Check that we have parsed all the arguments. */ + if (*str != '\0' && !inst.error) + inst.error = _("garbage following instruction"); + + return inst.error ? FAIL : SUCCESS; +} + +#undef po_char_or_fail +#undef po_reg_or_fail +#undef po_reg_or_goto +#undef po_imm_or_fail + +/* Shorthand macro for instruction encoding functions issuing errors. */ +#define constraint(expr, err) do { \ + if (expr) \ + { \ + inst.error = err; \ + return; \ + } \ +} while (0) + +/* Functions for operand encoding. ARM, then Thumb. */ + +#define rotate_left(v, n) (v << n | v >> (32 - n)) + +/* If VAL can be encoded in the immediate field of an ARM instruction, + return the encoded form. Otherwise, return FAIL. */ + +static unsigned int +encode_arm_immediate (unsigned int val) +{ + unsigned int a, i; + + for (i = 0; i < 32; i += 2) + if ((a = rotate_left (val, i)) <= 0xff) + return a | (i << 7); /* 12-bit pack: [shift-cnt,const]. */ return FAIL; } -/* Search for the following register name in each of the possible reg name - tables. Return the classification if found, or REG_TYPE_MAX if not - present. */ -static enum arm_reg_type -arm_reg_parse_any (cp) - char *cp; +/* If VAL can be encoded in the immediate field of a Thumb32 instruction, + return the encoded form. Otherwise, return FAIL. */ +static unsigned int +encode_thumb32_immediate (unsigned int val) { - int i; + unsigned int a, i; - for (i = (int) REG_TYPE_FIRST; i < (int) REG_TYPE_MAX; i++) - if (arm_reg_parse (&cp, all_reg_maps[i].htab) != FAIL) - return (enum arm_reg_type) i; + if (val <= 0xff) + return val; - return REG_TYPE_MAX; -} - -void -md_apply_fix3 (fixP, valP, seg) - fixS * fixP; - valueT * valP; - segT seg; -{ - offsetT value = * valP; - offsetT newval; - unsigned int newimm; - unsigned long temp; - int sign; - char * buf = fixP->fx_where + fixP->fx_frag->fr_literal; - arm_fix_data * arm_data = (arm_fix_data *) fixP->tc_fix_data; - - assert (fixP->fx_r_type < BFD_RELOC_UNUSED); - - /* Note whether this will delete the relocation. */ -#if 0 - /* Patch from REarnshaw to JDavis (disabled for the moment, since it - doesn't work fully.) */ - if ((fixP->fx_addsy == 0 || symbol_constant_p (fixP->fx_addsy)) - && !fixP->fx_pcrel) -#else - if (fixP->fx_addsy == 0 && !fixP->fx_pcrel) -#endif - fixP->fx_done = 1; - - /* 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 (fixP->fx_pcrel) + for (i = 1; i <= 24; i++) { - if (fixP->fx_addsy != NULL - && S_IS_DEFINED (fixP->fx_addsy) - && S_GET_SEGMENT (fixP->fx_addsy) != seg) - { - if (target_oabi - && (fixP->fx_r_type == BFD_RELOC_ARM_PCREL_BRANCH - || fixP->fx_r_type == BFD_RELOC_ARM_PCREL_BLX - )) - value = 0; - else - value += md_pcrel_from (fixP); - } + a = val >> i; + if ((val & ~(0xff << i)) == 0) + return ((val >> i) & 0x7f) | ((32 - i) << 7); } - /* Remember value for emit_reloc. */ - fixP->fx_addnumber = value; + a = val & 0xff; + if (val == ((a << 16) | a)) + return 0x100 | a; + if (val == ((a << 24) | (a << 16) | (a << 8) | a)) + return 0x300 | a; - switch (fixP->fx_r_type) + a = val & 0xff00; + if (val == ((a << 16) | a)) + return 0x200 | (a >> 8); + + return FAIL; +} +/* Encode a VFP SP register number into inst.instruction. */ + +static void +encode_arm_vfp_sp_reg (int reg, enum vfp_sp_reg_pos pos) +{ + switch (pos) { - case BFD_RELOC_ARM_IMMEDIATE: - newimm = validate_immediate (value); - temp = md_chars_to_number (buf, INSN_SIZE); - - /* If the instruction will fail, see if we can fix things up by - changing the opcode. */ - if (newimm == (unsigned int) FAIL - && (newimm = negate_data_op (&temp, value)) == (unsigned int) FAIL) - { - as_bad_where (fixP->fx_file, fixP->fx_line, - _("invalid constant (%lx) after fixup"), - (unsigned long) value); - break; - } - - newimm |= (temp & 0xfffff000); - md_number_to_chars (buf, (valueT) newimm, INSN_SIZE); - fixP->fx_done = 1; + case VFP_REG_Sd: + inst.instruction |= ((reg >> 1) << 12) | ((reg & 1) << 22); break; - case BFD_RELOC_ARM_ADRL_IMMEDIATE: - { - unsigned int highpart = 0; - unsigned int newinsn = 0xe1a00000; /* nop. */ - - newimm = validate_immediate (value); - temp = md_chars_to_number (buf, INSN_SIZE); - - /* If the instruction will fail, see if we can fix things up by - changing the opcode. */ - if (newimm == (unsigned int) FAIL - && (newimm = negate_data_op (& temp, value)) == (unsigned int) FAIL) - { - /* No ? OK - try using two ADD instructions to generate - the value. */ - newimm = validate_immediate_twopart (value, & highpart); - - /* Yes - then make sure that the second instruction is - also an add. */ - if (newimm != (unsigned int) FAIL) - newinsn = temp; - /* Still No ? Try using a negated value. */ - else if ((newimm = validate_immediate_twopart (- value, & highpart)) != (unsigned int) FAIL) - temp = newinsn = (temp & OPCODE_MASK) | OPCODE_SUB << DATA_OP_SHIFT; - /* Otherwise - give up. */ - else - { - as_bad_where (fixP->fx_file, fixP->fx_line, - _("unable to compute ADRL instructions for PC offset of 0x%lx"), - (long) value); - break; - } - - /* Replace the first operand in the 2nd instruction (which - is the PC) with the destination register. We have - already added in the PC in the first instruction and we - do not want to do it again. */ - newinsn &= ~ 0xf0000; - newinsn |= ((newinsn & 0x0f000) << 4); - } - - newimm |= (temp & 0xfffff000); - md_number_to_chars (buf, (valueT) newimm, INSN_SIZE); - - highpart |= (newinsn & 0xfffff000); - md_number_to_chars (buf + INSN_SIZE, (valueT) highpart, INSN_SIZE); - } + case VFP_REG_Sn: + inst.instruction |= ((reg >> 1) << 16) | ((reg & 1) << 7); break; - case BFD_RELOC_ARM_OFFSET_IMM: - sign = value >= 0; - - if (value < 0) - value = - value; - - if (validate_offset_imm (value, 0) == FAIL) - { - as_bad_where (fixP->fx_file, fixP->fx_line, - _("bad immediate value for offset (%ld)"), - (long) value); - break; - } - - newval = md_chars_to_number (buf, INSN_SIZE); - newval &= 0xff7ff000; - newval |= value | (sign ? INDEX_UP : 0); - md_number_to_chars (buf, newval, INSN_SIZE); + case VFP_REG_Sm: + inst.instruction |= ((reg >> 1) << 0) | ((reg & 1) << 5); break; - case BFD_RELOC_ARM_OFFSET_IMM8: - case BFD_RELOC_ARM_HWLITERAL: - sign = value >= 0; + default: + abort (); + } +} - if (value < 0) - value = - value; - - if (validate_offset_imm (value, 1) == FAIL) +/* Encode a in an ARM-format instruction. The immediate, + if any, is handled by md_apply_fix. */ +static void +encode_arm_shift (int i) +{ + if (inst.operands[i].shift_kind == SHIFT_RRX) + inst.instruction |= SHIFT_ROR << 5; + else + { + inst.instruction |= inst.operands[i].shift_kind << 5; + if (inst.operands[i].immisreg) { - if (fixP->fx_r_type == BFD_RELOC_ARM_HWLITERAL) - as_bad_where (fixP->fx_file, fixP->fx_line, - _("invalid literal constant: pool needs to be closer")); - else - as_bad (_("bad immediate value for half-word offset (%ld)"), - (long) value); - break; - } - - newval = md_chars_to_number (buf, INSN_SIZE); - newval &= 0xff7ff0f0; - newval |= ((value >> 4) << 8) | (value & 0xf) | (sign ? INDEX_UP : 0); - md_number_to_chars (buf, newval, INSN_SIZE); - break; - - case BFD_RELOC_ARM_LITERAL: - sign = value >= 0; - - if (value < 0) - value = - value; - - if (validate_offset_imm (value, 0) == FAIL) - { - as_bad_where (fixP->fx_file, fixP->fx_line, - _("invalid literal constant: pool needs to be closer")); - break; - } - - newval = md_chars_to_number (buf, INSN_SIZE); - newval &= 0xff7ff000; - newval |= value | (sign ? INDEX_UP : 0); - md_number_to_chars (buf, newval, INSN_SIZE); - break; - - case BFD_RELOC_ARM_SHIFT_IMM: - newval = md_chars_to_number (buf, INSN_SIZE); - if (((unsigned long) value) > 32 - || (value == 32 - && (((newval & 0x60) == 0) || (newval & 0x60) == 0x60))) - { - as_bad_where (fixP->fx_file, fixP->fx_line, - _("shift expression is too large")); - break; - } - - if (value == 0) - /* Shifts of zero must be done as lsl. */ - newval &= ~0x60; - else if (value == 32) - value = 0; - newval &= 0xfffff07f; - newval |= (value & 0x1f) << 7; - md_number_to_chars (buf, newval, INSN_SIZE); - break; - - case BFD_RELOC_ARM_SWI: - if (arm_data->thumb_mode) - { - if (((unsigned long) value) > 0xff) - as_bad_where (fixP->fx_file, fixP->fx_line, - _("invalid swi expression")); - newval = md_chars_to_number (buf, THUMB_SIZE) & 0xff00; - newval |= value; - md_number_to_chars (buf, newval, THUMB_SIZE); + inst.instruction |= SHIFT_BY_REG; + inst.instruction |= inst.operands[i].imm << 8; } else - { - if (((unsigned long) value) > 0x00ffffff) - as_bad_where (fixP->fx_file, fixP->fx_line, - _("invalid swi expression")); - newval = md_chars_to_number (buf, INSN_SIZE) & 0xff000000; - newval |= value; - md_number_to_chars (buf, newval, INSN_SIZE); - } - break; - - case BFD_RELOC_ARM_MULTI: - if (((unsigned long) value) > 0xffff) - as_bad_where (fixP->fx_file, fixP->fx_line, - _("invalid expression in load/store multiple")); - newval = value | md_chars_to_number (buf, INSN_SIZE); - md_number_to_chars (buf, newval, INSN_SIZE); - break; - - case BFD_RELOC_ARM_PCREL_BRANCH: - newval = md_chars_to_number (buf, INSN_SIZE); - - /* Sign-extend a 24-bit number. */ -#define SEXT24(x) ((((x) & 0xffffff) ^ (~ 0x7fffff)) + 0x800000) - -#ifdef OBJ_ELF - if (! target_oabi) - value = fixP->fx_offset; -#endif - - /* We are going to store value (shifted right by two) in the - instruction, in a 24 bit, signed field. Thus we need to check - that none of the top 8 bits of the shifted value (top 7 bits of - the unshifted, unsigned value) are set, or that they are all set. */ - if ((value & ~ ((offsetT) 0x1ffffff)) != 0 - && ((value & ~ ((offsetT) 0x1ffffff)) != ~ ((offsetT) 0x1ffffff))) - { -#ifdef OBJ_ELF - /* Normally we would be stuck at this point, since we cannot store - the absolute address that is the destination of the branch in the - 24 bits of the branch instruction. If however, we happen to know - that the destination of the branch is in the same section as the - branch instruction itself, then we can compute the relocation for - ourselves and not have to bother the linker with it. - - FIXME: The tests for OBJ_ELF and ! target_oabi are only here - because I have not worked out how to do this for OBJ_COFF or - target_oabi. */ - if (! target_oabi - && fixP->fx_addsy != NULL - && S_IS_DEFINED (fixP->fx_addsy) - && S_GET_SEGMENT (fixP->fx_addsy) == seg) - { - /* Get pc relative value to go into the branch. */ - value = * valP; - - /* Permit a backward branch provided that enough bits - are set. Allow a forwards branch, provided that - enough bits are clear. */ - if ( (value & ~ ((offsetT) 0x1ffffff)) == ~ ((offsetT) 0x1ffffff) - || (value & ~ ((offsetT) 0x1ffffff)) == 0) - fixP->fx_done = 1; - } - - if (! fixP->fx_done) -#endif - as_bad_where (fixP->fx_file, fixP->fx_line, - _("GAS can't handle same-section branch dest >= 0x04000000")); - } - - value >>= 2; - value += SEXT24 (newval); - - if ( (value & ~ ((offsetT) 0xffffff)) != 0 - && ((value & ~ ((offsetT) 0xffffff)) != ~ ((offsetT) 0xffffff))) - as_bad_where (fixP->fx_file, fixP->fx_line, - _("out of range branch")); - - newval = (value & 0x00ffffff) | (newval & 0xff000000); - md_number_to_chars (buf, newval, INSN_SIZE); - break; - - case BFD_RELOC_ARM_PCREL_BLX: - { - offsetT hbit; - newval = md_chars_to_number (buf, INSN_SIZE); - -#ifdef OBJ_ELF - if (! target_oabi) - value = fixP->fx_offset; -#endif - hbit = (value >> 1) & 1; - value = (value >> 2) & 0x00ffffff; - value = (value + (newval & 0x00ffffff)) & 0x00ffffff; - newval = value | (newval & 0xfe000000) | (hbit << 24); - md_number_to_chars (buf, newval, INSN_SIZE); - } - break; - - case BFD_RELOC_THUMB_PCREL_BRANCH9: /* Conditional branch. */ - newval = md_chars_to_number (buf, THUMB_SIZE); - { - addressT diff = (newval & 0xff) << 1; - if (diff & 0x100) - diff |= ~0xff; - - value += diff; - if ((value & ~0xff) && ((value & ~0xff) != ~0xff)) - as_bad_where (fixP->fx_file, fixP->fx_line, - _("branch out of range")); - newval = (newval & 0xff00) | ((value & 0x1ff) >> 1); - } - md_number_to_chars (buf, newval, THUMB_SIZE); - break; - - case BFD_RELOC_THUMB_PCREL_BRANCH12: /* Unconditional branch. */ - newval = md_chars_to_number (buf, THUMB_SIZE); - { - addressT diff = (newval & 0x7ff) << 1; - if (diff & 0x800) - diff |= ~0x7ff; - - value += diff; - if ((value & ~0x7ff) && ((value & ~0x7ff) != ~0x7ff)) - as_bad_where (fixP->fx_file, fixP->fx_line, - _("branch out of range")); - newval = (newval & 0xf800) | ((value & 0xfff) >> 1); - } - md_number_to_chars (buf, newval, THUMB_SIZE); - break; - - case BFD_RELOC_THUMB_PCREL_BLX: - case BFD_RELOC_THUMB_PCREL_BRANCH23: - { - offsetT newval2; - addressT diff; - - newval = md_chars_to_number (buf, THUMB_SIZE); - newval2 = md_chars_to_number (buf + THUMB_SIZE, THUMB_SIZE); - diff = ((newval & 0x7ff) << 12) | ((newval2 & 0x7ff) << 1); - if (diff & 0x400000) - diff |= ~0x3fffff; -#ifdef OBJ_ELF - value = fixP->fx_offset; -#endif - value += diff; - - if ((value & ~0x3fffff) && ((value & ~0x3fffff) != ~0x3fffff)) - as_bad_where (fixP->fx_file, fixP->fx_line, - _("branch with link out of range")); - - newval = (newval & 0xf800) | ((value & 0x7fffff) >> 12); - newval2 = (newval2 & 0xf800) | ((value & 0xfff) >> 1); - if (fixP->fx_r_type == BFD_RELOC_THUMB_PCREL_BLX) - /* For a BLX instruction, make sure that the relocation is rounded up - to a word boundary. This follows the semantics of the instruction - which specifies that bit 1 of the target address will come from bit - 1 of the base address. */ - newval2 = (newval2 + 1) & ~ 1; - md_number_to_chars (buf, newval, THUMB_SIZE); - md_number_to_chars (buf + THUMB_SIZE, newval2, THUMB_SIZE); - } - break; - - case BFD_RELOC_8: - if (fixP->fx_done || fixP->fx_pcrel) - md_number_to_chars (buf, value, 1); -#ifdef OBJ_ELF - else if (!target_oabi) - { - value = fixP->fx_offset; - md_number_to_chars (buf, value, 1); - } -#endif - break; - - case BFD_RELOC_16: - if (fixP->fx_done || fixP->fx_pcrel) - md_number_to_chars (buf, value, 2); -#ifdef OBJ_ELF - else if (!target_oabi) - { - value = fixP->fx_offset; - md_number_to_chars (buf, value, 2); - } -#endif - break; - -#ifdef OBJ_ELF - case BFD_RELOC_ARM_GOT32: - case BFD_RELOC_ARM_GOTOFF: - md_number_to_chars (buf, 0, 4); - break; -#endif - - case BFD_RELOC_RVA: - case BFD_RELOC_32: - if (fixP->fx_done || fixP->fx_pcrel) - md_number_to_chars (buf, value, 4); -#ifdef OBJ_ELF - else if (!target_oabi) - { - value = fixP->fx_offset; - md_number_to_chars (buf, value, 4); - } -#endif - break; - -#ifdef OBJ_ELF - case BFD_RELOC_ARM_PLT32: - /* It appears the instruction is fully prepared at this point. */ - break; -#endif - - case BFD_RELOC_ARM_CP_OFF_IMM: - sign = value >= 0; - if (value < -1023 || value > 1023 || (value & 3)) - as_bad_where (fixP->fx_file, fixP->fx_line, - _("illegal value for co-processor offset")); - if (value < 0) - value = -value; - newval = md_chars_to_number (buf, INSN_SIZE) & 0xff7fff00; - newval |= (value >> 2) | (sign ? INDEX_UP : 0); - md_number_to_chars (buf, newval, INSN_SIZE); - break; - - case BFD_RELOC_ARM_CP_OFF_IMM_S2: - sign = value >= 0; - if (value < -255 || value > 255) - as_bad_where (fixP->fx_file, fixP->fx_line, - _("Illegal value for co-processor offset")); - if (value < 0) - value = -value; - newval = md_chars_to_number (buf, INSN_SIZE) & 0xff7fff00; - newval |= value | (sign ? INDEX_UP : 0); - md_number_to_chars (buf, newval , INSN_SIZE); - break; - - case BFD_RELOC_ARM_THUMB_OFFSET: - newval = md_chars_to_number (buf, THUMB_SIZE); - /* Exactly what ranges, and where the offset is inserted depends - on the type of instruction, we can establish this from the - top 4 bits. */ - switch (newval >> 12) - { - case 4: /* PC load. */ - /* Thumb PC loads are somewhat odd, bit 1 of the PC is - forced to zero for these loads, so we will need to round - up the offset if the instruction address is not word - aligned (since the final address produced must be, and - we can only describe word-aligned immediate offsets). */ - - if ((fixP->fx_frag->fr_address + fixP->fx_where + value) & 3) - as_bad_where (fixP->fx_file, fixP->fx_line, - _("invalid offset, target not word aligned (0x%08X)"), - (unsigned int) (fixP->fx_frag->fr_address - + fixP->fx_where + value)); - - if ((value + 2) & ~0x3fe) - as_bad_where (fixP->fx_file, fixP->fx_line, - _("invalid offset, value too big (0x%08lX)"), - (long) value); - - /* Round up, since pc will be rounded down. */ - newval |= (value + 2) >> 2; - break; - - case 9: /* SP load/store. */ - if (value & ~0x3fc) - as_bad_where (fixP->fx_file, fixP->fx_line, - _("invalid offset, value too big (0x%08lX)"), - (long) value); - newval |= value >> 2; - break; - - case 6: /* Word load/store. */ - if (value & ~0x7c) - as_bad_where (fixP->fx_file, fixP->fx_line, - _("invalid offset, value too big (0x%08lX)"), - (long) value); - newval |= value << 4; /* 6 - 2. */ - break; - - case 7: /* Byte load/store. */ - if (value & ~0x1f) - as_bad_where (fixP->fx_file, fixP->fx_line, - _("invalid offset, value too big (0x%08lX)"), - (long) value); - newval |= value << 6; - break; - - case 8: /* Halfword load/store. */ - if (value & ~0x3e) - as_bad_where (fixP->fx_file, fixP->fx_line, - _("invalid offset, value too big (0x%08lX)"), - (long) value); - newval |= value << 5; /* 6 - 1. */ - break; - - default: - as_bad_where (fixP->fx_file, fixP->fx_line, - "Unable to process relocation for thumb opcode: %lx", - (unsigned long) newval); - break; - } - md_number_to_chars (buf, newval, THUMB_SIZE); - break; - - case BFD_RELOC_ARM_THUMB_ADD: - /* This is a complicated relocation, since we use it for all of - the following immediate relocations: - - 3bit ADD/SUB - 8bit ADD/SUB - 9bit ADD/SUB SP word-aligned - 10bit ADD PC/SP word-aligned - - The type of instruction being processed is encoded in the - instruction field: - - 0x8000 SUB - 0x00F0 Rd - 0x000F Rs - */ - newval = md_chars_to_number (buf, THUMB_SIZE); - { - int rd = (newval >> 4) & 0xf; - int rs = newval & 0xf; - int subtract = newval & 0x8000; - - if (rd == REG_SP) - { - if (value & ~0x1fc) - as_bad_where (fixP->fx_file, fixP->fx_line, - _("invalid immediate for stack address calculation")); - newval = subtract ? T_OPCODE_SUB_ST : T_OPCODE_ADD_ST; - newval |= value >> 2; - } - else if (rs == REG_PC || rs == REG_SP) - { - if (subtract || - value & ~0x3fc) - as_bad_where (fixP->fx_file, fixP->fx_line, - _("invalid immediate for address calculation (value = 0x%08lX)"), - (unsigned long) value); - newval = (rs == REG_PC ? T_OPCODE_ADD_PC : T_OPCODE_ADD_SP); - newval |= rd << 8; - newval |= value >> 2; - } - else if (rs == rd) - { - if (value & ~0xff) - as_bad_where (fixP->fx_file, fixP->fx_line, - _("invalid 8bit immediate")); - newval = subtract ? T_OPCODE_SUB_I8 : T_OPCODE_ADD_I8; - newval |= (rd << 8) | value; - } - else - { - if (value & ~0x7) - as_bad_where (fixP->fx_file, fixP->fx_line, - _("invalid 3bit immediate")); - newval = subtract ? T_OPCODE_SUB_I3 : T_OPCODE_ADD_I3; - newval |= rd | (rs << 3) | (value << 6); - } - } - md_number_to_chars (buf, newval, THUMB_SIZE); - break; - - case BFD_RELOC_ARM_THUMB_IMM: - newval = md_chars_to_number (buf, THUMB_SIZE); - switch (newval >> 11) - { - case 0x04: /* 8bit immediate MOV. */ - case 0x05: /* 8bit immediate CMP. */ - if (value < 0 || value > 255) - as_bad_where (fixP->fx_file, fixP->fx_line, - _("invalid immediate: %ld is too large"), - (long) value); - newval |= value; - break; - - default: - abort (); - } - md_number_to_chars (buf, newval, THUMB_SIZE); - break; - - case BFD_RELOC_ARM_THUMB_SHIFT: - /* 5bit shift value (0..31). */ - if (value < 0 || value > 31) - as_bad_where (fixP->fx_file, fixP->fx_line, - _("illegal Thumb shift value: %ld"), (long) value); - newval = md_chars_to_number (buf, THUMB_SIZE) & 0xf03f; - newval |= value << 6; - md_number_to_chars (buf, newval, THUMB_SIZE); - break; - - case BFD_RELOC_VTABLE_INHERIT: - case BFD_RELOC_VTABLE_ENTRY: - fixP->fx_done = 0; - return; - - case BFD_RELOC_NONE: - default: - as_bad_where (fixP->fx_file, fixP->fx_line, - _("bad relocation fixup type (%d)"), fixP->fx_r_type); + inst.reloc.type = BFD_RELOC_ARM_SHIFT_IMM; } } -/* Translate internal representation of relocation info to BFD target - format. */ - -arelent * -tc_gen_reloc (section, fixp) - asection * section ATTRIBUTE_UNUSED; - fixS * fixp; -{ - arelent * reloc; - bfd_reloc_code_real_type code; - - 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; - - /* @@ Why fx_addnumber sometimes and fx_offset other times? */ -#ifndef OBJ_ELF - if (fixp->fx_pcrel == 0) - reloc->addend = fixp->fx_offset; - else - reloc->addend = fixp->fx_offset = reloc->address; -#else /* OBJ_ELF */ - reloc->addend = fixp->fx_offset; -#endif - - switch (fixp->fx_r_type) - { - case BFD_RELOC_8: - if (fixp->fx_pcrel) - { - code = BFD_RELOC_8_PCREL; - break; - } - - case BFD_RELOC_16: - if (fixp->fx_pcrel) - { - code = BFD_RELOC_16_PCREL; - break; - } - - case BFD_RELOC_32: - if (fixp->fx_pcrel) - { - code = BFD_RELOC_32_PCREL; - break; - } - - case BFD_RELOC_ARM_PCREL_BRANCH: - case BFD_RELOC_ARM_PCREL_BLX: - case BFD_RELOC_RVA: - case BFD_RELOC_THUMB_PCREL_BRANCH9: - case BFD_RELOC_THUMB_PCREL_BRANCH12: - case BFD_RELOC_THUMB_PCREL_BRANCH23: - case BFD_RELOC_THUMB_PCREL_BLX: - case BFD_RELOC_VTABLE_ENTRY: - case BFD_RELOC_VTABLE_INHERIT: - code = fixp->fx_r_type; - break; - - case BFD_RELOC_ARM_LITERAL: - case BFD_RELOC_ARM_HWLITERAL: - /* If this is called then the a literal has - been referenced across a section boundary. */ - as_bad_where (fixp->fx_file, fixp->fx_line, - _("literal referenced across section boundary")); - return NULL; - -#ifdef OBJ_ELF - case BFD_RELOC_ARM_GOT32: - case BFD_RELOC_ARM_GOTOFF: - case BFD_RELOC_ARM_PLT32: - code = fixp->fx_r_type; - break; -#endif - - case BFD_RELOC_ARM_IMMEDIATE: - as_bad_where (fixp->fx_file, fixp->fx_line, - _("internal relocation (type: IMMEDIATE) not fixed up")); - return NULL; - - case BFD_RELOC_ARM_ADRL_IMMEDIATE: - as_bad_where (fixp->fx_file, fixp->fx_line, - _("ADRL used for a symbol not defined in the same file")); - return NULL; - - case BFD_RELOC_ARM_OFFSET_IMM: - if (fixp->fx_addsy != NULL - && !S_IS_DEFINED (fixp->fx_addsy) - && S_IS_LOCAL (fixp->fx_addsy)) - { - as_bad_where (fixp->fx_file, fixp->fx_line, - _("undefined local label `%s'"), - S_GET_NAME (fixp->fx_addsy)); - return NULL; - } - - as_bad_where (fixp->fx_file, fixp->fx_line, - _("internal_relocation (type: OFFSET_IMM) not fixed up")); - return NULL; - - default: - { - char * type; - - switch (fixp->fx_r_type) - { - case BFD_RELOC_ARM_OFFSET_IMM8: type = "OFFSET_IMM8"; break; - case BFD_RELOC_ARM_SHIFT_IMM: type = "SHIFT_IMM"; break; - case BFD_RELOC_ARM_SWI: type = "SWI"; break; - case BFD_RELOC_ARM_MULTI: type = "MULTI"; break; - case BFD_RELOC_ARM_CP_OFF_IMM: type = "CP_OFF_IMM"; break; - case BFD_RELOC_ARM_THUMB_ADD: type = "THUMB_ADD"; break; - case BFD_RELOC_ARM_THUMB_SHIFT: type = "THUMB_SHIFT"; break; - case BFD_RELOC_ARM_THUMB_IMM: type = "THUMB_IMM"; break; - case BFD_RELOC_ARM_THUMB_OFFSET: type = "THUMB_OFFSET"; break; - default: type = _(""); break; - } - as_bad_where (fixp->fx_file, fixp->fx_line, - _("cannot represent %s relocation in this object file format"), - type); - return NULL; - } - } - -#ifdef OBJ_ELF - if ((code == BFD_RELOC_32_PCREL || code == BFD_RELOC_32) - && GOT_symbol - && fixp->fx_addsy == GOT_symbol) - { - code = BFD_RELOC_ARM_GOTPC; - reloc->addend = fixp->fx_offset = reloc->address; - } -#endif - - reloc->howto = bfd_reloc_type_lookup (stdoutput, code); - - if (reloc->howto == NULL) - { - as_bad_where (fixp->fx_file, fixp->fx_line, - _("cannot represent %s relocation in this object file format"), - bfd_get_reloc_code_name (code)); - return NULL; - } - - /* HACK: Since arm ELF uses Rel instead of Rela, encode the - vtable entry to be used in the relocation's section offset. */ - if (fixp->fx_r_type == BFD_RELOC_VTABLE_ENTRY) - reloc->address = fixp->fx_offset; - - return reloc; -} - -int -md_estimate_size_before_relax (fragP, segtype) - fragS * fragP ATTRIBUTE_UNUSED; - segT segtype ATTRIBUTE_UNUSED; -{ - as_fatal (_("md_estimate_size_before_relax\n")); - return 1; -} - static void -output_inst (str) - const char *str; +encode_arm_shifter_operand (int i) { - char * to = NULL; - - if (inst.error) + if (inst.operands[i].isreg) { - as_bad ("%s -- `%s'", inst.error, str); + inst.instruction |= inst.operands[i].reg; + encode_arm_shift (i); + } + else + inst.instruction |= INST_IMMEDIATE; +} + +/* Subroutine of encode_arm_addr_mode_2 and encode_arm_addr_mode_3. */ +static void +encode_arm_addr_mode_common (int i, bfd_boolean is_t) +{ + assert (inst.operands[i].isreg); + inst.instruction |= inst.operands[i].reg << 16; + + if (inst.operands[i].preind) + { + if (is_t) + { + inst.error = _("instruction does not accept preindexed addressing"); + return; + } + inst.instruction |= PRE_INDEX; + if (inst.operands[i].writeback) + inst.instruction |= WRITE_BACK; + + } + else if (inst.operands[i].postind) + { + assert (inst.operands[i].writeback); + if (is_t) + inst.instruction |= WRITE_BACK; + } + else /* unindexed - only for coprocessor */ + { + inst.error = _("instruction does not accept unindexed addressing"); return; } - to = frag_more (inst.size); - - if (thumb_mode && (inst.size > THUMB_SIZE)) - { - assert (inst.size == (2 * THUMB_SIZE)); - md_number_to_chars (to, inst.instruction >> 16, THUMB_SIZE); - md_number_to_chars (to + THUMB_SIZE, inst.instruction, THUMB_SIZE); - } - else if (inst.size > INSN_SIZE) - { - assert (inst.size == (2 * INSN_SIZE)); - md_number_to_chars (to, inst.instruction, INSN_SIZE); - md_number_to_chars (to + INSN_SIZE, inst.instruction, INSN_SIZE); - } - else - md_number_to_chars (to, inst.instruction, inst.size); - - if (inst.reloc.type != BFD_RELOC_NONE) - fix_new_arm (frag_now, to - frag_now->fr_literal, - inst.size, & inst.reloc.exp, inst.reloc.pc_rel, - inst.reloc.type); - -#ifdef OBJ_ELF - dwarf2_emit_insn (inst.size); -#endif + if (((inst.instruction & WRITE_BACK) || !(inst.instruction & PRE_INDEX)) + && (((inst.instruction & 0x000f0000) >> 16) + == ((inst.instruction & 0x0000f000) >> 12))) + as_warn ((inst.instruction & LOAD_BIT) + ? _("destination register same as write-back base") + : _("source register same as write-back base")); } -void -md_assemble (str) - char * str; +/* inst.operands[i] was set up by parse_address. Encode it into an + ARM-format mode 2 load or store instruction. If is_t is true, + reject forms that cannot be used with a T instruction (i.e. not + post-indexed). */ +static void +encode_arm_addr_mode_2 (int i, bfd_boolean is_t) { - char c; - char *p; - char *start; + encode_arm_addr_mode_common (i, is_t); - /* Align the instruction. - This may not be the right thing to do but ... */ -#if 0 - arm_align (2, 0); -#endif - - /* Align the previous label if needed. */ - if (last_label_seen != NULL) + if (inst.operands[i].immisreg) { - symbol_set_frag (last_label_seen, frag_now); - S_SET_VALUE (last_label_seen, (valueT) frag_now_fix ()); - S_SET_SEGMENT (last_label_seen, now_seg); + inst.instruction |= INST_IMMEDIATE; /* yes, this is backwards */ + inst.instruction |= inst.operands[i].imm; + if (!inst.operands[i].negative) + inst.instruction |= INDEX_UP; + if (inst.operands[i].shifted) + { + if (inst.operands[i].shift_kind == SHIFT_RRX) + inst.instruction |= SHIFT_ROR << 5; + else + { + inst.instruction |= inst.operands[i].shift_kind << 5; + inst.reloc.type = BFD_RELOC_ARM_SHIFT_IMM; + } + } } - - memset (&inst, '\0', sizeof (inst)); - inst.reloc.type = BFD_RELOC_NONE; - - skip_whitespace (str); - - /* Scan up to the end of the op-code, which must end in white space or - end of string. */ - for (start = p = str; *p != '\0'; p++) - if (*p == ' ') - break; - - if (p == str) + else /* immediate offset in inst.reloc */ { - as_bad (_("no operator -- statement `%s'\n"), str); + if (inst.reloc.type == BFD_RELOC_UNUSED) + inst.reloc.type = BFD_RELOC_ARM_OFFSET_IMM; + } +} + +/* inst.operands[i] was set up by parse_address. Encode it into an + ARM-format mode 3 load or store instruction. Reject forms that + cannot be used with such instructions. If is_t is true, reject + forms that cannot be used with a T instruction (i.e. not + post-indexed). */ +static void +encode_arm_addr_mode_3 (int i, bfd_boolean is_t) +{ + if (inst.operands[i].immisreg && inst.operands[i].shifted) + { + inst.error = _("instruction does not accept scaled register index"); return; } - if (thumb_mode) + encode_arm_addr_mode_common (i, is_t); + + if (inst.operands[i].immisreg) { - const struct thumb_opcode * opcode; - - c = *p; - *p = '\0'; - opcode = (const struct thumb_opcode *) hash_find (arm_tops_hsh, str); - *p = c; - - if (opcode) - { - /* Check that this instruction is supported for this CPU. */ - if (thumb_mode == 1 && (opcode->variant & cpu_variant) == 0) - { - as_bad (_("selected processor does not support `%s'"), str); - return; - } - - mapping_state (MAP_THUMB); - inst.instruction = opcode->value; - inst.size = opcode->size; - (*opcode->parms) (p); - output_inst (str); - return; - } + inst.instruction |= inst.operands[i].imm; + if (!inst.operands[i].negative) + inst.instruction |= INDEX_UP; } + else /* immediate offset in inst.reloc */ + { + inst.instruction |= HWOFFSET_IMM; + if (inst.reloc.type == BFD_RELOC_UNUSED) + inst.reloc.type = BFD_RELOC_ARM_OFFSET_IMM8; + } +} + +/* inst.operands[i] was set up by parse_address. Encode it into an + ARM-format instruction. Reject all forms which cannot be encoded + into a coprocessor load/store instruction. If wb_ok is false, + reject use of writeback; if unind_ok is false, reject use of + unindexed addressing. If reloc_override is not 0, use it instead + of BFD_ARM_CP_OFF_IMM. */ + +static int +encode_arm_cp_address (int i, int wb_ok, int unind_ok, int reloc_override) +{ + inst.instruction |= inst.operands[i].reg << 16; + + assert (!(inst.operands[i].preind && inst.operands[i].postind)); + + if (!inst.operands[i].preind && !inst.operands[i].postind) /* unindexed */ + { + assert (!inst.operands[i].writeback); + if (!unind_ok) + { + inst.error = _("instruction does not support unindexed addressing"); + return FAIL; + } + inst.instruction |= inst.operands[i].imm; + inst.instruction |= INDEX_UP; + return SUCCESS; + } + + if (inst.operands[i].preind) + inst.instruction |= PRE_INDEX; + + if (inst.operands[i].writeback) + { + if (inst.operands[i].reg == REG_PC) + { + inst.error = _("pc may not be used with write-back"); + return FAIL; + } + if (!wb_ok) + { + inst.error = _("instruction does not support writeback"); + return FAIL; + } + inst.instruction |= WRITE_BACK; + } + + if (reloc_override) + inst.reloc.type = reloc_override; + else if (thumb_mode) + inst.reloc.type = BFD_RELOC_ARM_T32_CP_OFF_IMM; else - { - const struct asm_opcode * opcode; - - c = *p; - *p = '\0'; - opcode = (const struct asm_opcode *) hash_find (arm_ops_hsh, str); - *p = c; - - if (opcode) - { - /* Check that this instruction is supported for this CPU. */ - if ((opcode->variant & cpu_variant) == 0) - { - as_bad (_("selected processor does not support `%s'"), str); - return; - } - - mapping_state (MAP_ARM); - inst.instruction = opcode->value; - inst.size = INSN_SIZE; - (*opcode->parms) (p); - output_inst (str); - return; - } - } - - /* It wasn't an instruction, but it might be a register alias of the form - alias .req reg. */ - if (create_register_alias (str, p)) - return; - - as_bad (_("bad instruction `%s'"), start); + inst.reloc.type = BFD_RELOC_ARM_CP_OFF_IMM; + return SUCCESS; } -/* md_parse_option - Invocation line includes a switch not recognized by the base assembler. - See if it's a processor-specific option. +/* inst.reloc.exp describes an "=expr" load pseudo-operation. + Determine whether it can be performed with a move instruction; if + it can, convert inst.instruction to that move instruction and + return 1; if it can't, convert inst.instruction to a literal-pool + load and return 0. If this is not a valid thing to do in the + current context, set inst.error and return 1. - This routine is somewhat complicated by the need for backwards - compatibility (since older releases of gcc can't be changed). - The new options try to make the interface as compatible as - possible with GCC. - - New options (supported) are: - - -mcpu= Assemble for selected processor - -march= Assemble for selected architecture - -mfpu= Assemble for selected FPU. - -EB/-mbig-endian Big-endian - -EL/-mlittle-endian Little-endian - -k Generate PIC code - -mthumb Start in Thumb mode - -mthumb-interwork Code supports ARM/Thumb interworking - - For now we will also provide support for: - - -mapcs-32 32-bit Program counter - -mapcs-26 26-bit Program counter - -macps-float Floats passed in FP registers - -mapcs-reentrant Reentrant code - -matpcs - (sometime these will probably be replaced with -mapcs= - and -matpcs=) - - The remaining options are only supported for back-wards compatibility. - Cpu variants, the arm part is optional: - -m[arm]1 Currently not supported. - -m[arm]2, -m[arm]250 Arm 2 and Arm 250 processor - -m[arm]3 Arm 3 processor - -m[arm]6[xx], Arm 6 processors - -m[arm]7[xx][t][[d]m] Arm 7 processors - -m[arm]8[10] Arm 8 processors - -m[arm]9[20][tdmi] Arm 9 processors - -mstrongarm[110[0]] StrongARM processors - -mxscale XScale processors - -m[arm]v[2345[t[e]]] Arm architectures - -mall All (except the ARM1) - FP variants: - -mfpa10, -mfpa11 FPA10 and 11 co-processor instructions - -mfpe-old (No float load/store multiples) - -mvfpxd VFP Single precision - -mvfp All VFP - -mno-fpu Disable all floating point instructions - - The following CPU names are recognized: - arm1, arm2, arm250, arm3, arm6, arm600, arm610, arm620, - arm7, arm7m, arm7d, arm7dm, arm7di, arm7dmi, arm70, arm700, - arm700i, arm710 arm710t, arm720, arm720t, arm740t, arm710c, - arm7100, arm7500, arm7500fe, arm7tdmi, arm8, arm810, arm9, - arm920, arm920t, arm940t, arm946, arm966, arm9tdmi, arm9e, - arm10t arm10e, arm1020t, arm1020e, arm10200e, - strongarm, strongarm110, strongarm1100, strongarm1110, xscale. - - */ - -const char * md_shortopts = "m:k"; - -#ifdef ARM_BI_ENDIAN -#define OPTION_EB (OPTION_MD_BASE + 0) -#define OPTION_EL (OPTION_MD_BASE + 1) -#else -#if TARGET_BYTES_BIG_ENDIAN -#define OPTION_EB (OPTION_MD_BASE + 0) -#else -#define OPTION_EL (OPTION_MD_BASE + 1) -#endif -#endif - -struct option md_longopts[] = -{ -#ifdef OPTION_EB - {"EB", no_argument, NULL, OPTION_EB}, -#endif -#ifdef OPTION_EL - {"EL", no_argument, NULL, OPTION_EL}, -#endif - {NULL, no_argument, NULL, 0} -}; - -size_t md_longopts_size = sizeof (md_longopts); - -struct arm_option_table -{ - char *option; /* Option name to match. */ - char *help; /* Help information. */ - int *var; /* Variable to change. */ - int value; /* What to change it to. */ - char *deprecated; /* If non-null, print this message. */ -}; - -struct arm_option_table arm_opts[] = -{ - {"k", N_("generate PIC code"), &pic_code, 1, NULL}, - {"mthumb", N_("assemble Thumb code"), &thumb_mode, 1, NULL}, - {"mthumb-interwork", N_("support ARM/Thumb interworking"), - &support_interwork, 1, NULL}, - {"moabi", N_("use old ABI (ELF only)"), &target_oabi, 1, NULL}, - {"mapcs-32", N_("code uses 32-bit program counter"), &uses_apcs_26, 0, NULL}, - {"mapcs-26", N_("code uses 26-bit program counter"), &uses_apcs_26, 1, NULL}, - {"mapcs-float", N_("floating point args are in fp regs"), &uses_apcs_float, - 1, NULL}, - {"mapcs-reentrant", N_("re-entrant code"), &pic_code, 1, NULL}, - {"matpcs", N_("code is ATPCS conformant"), &atpcs, 1, NULL}, - {"mbig-endian", N_("assemble for big-endian"), &target_big_endian, 1, NULL}, - {"mlittle-endian", N_("assemble for little-endian"), &target_big_endian, 1, - NULL}, - - /* These are recognized by the assembler, but have no affect on code. */ - {"mapcs-frame", N_("use frame pointer"), NULL, 0, NULL}, - {"mapcs-stack-check", N_("use stack size checking"), NULL, 0, NULL}, - - /* DON'T add any new processors to this list -- we want the whole list - to go away... Add them to the processors table instead. */ - {"marm1", NULL, &legacy_cpu, ARM_ARCH_V1, N_("use -mcpu=arm1")}, - {"m1", NULL, &legacy_cpu, ARM_ARCH_V1, N_("use -mcpu=arm1")}, - {"marm2", NULL, &legacy_cpu, ARM_ARCH_V2, N_("use -mcpu=arm2")}, - {"m2", NULL, &legacy_cpu, ARM_ARCH_V2, N_("use -mcpu=arm2")}, - {"marm250", NULL, &legacy_cpu, ARM_ARCH_V2S, N_("use -mcpu=arm250")}, - {"m250", NULL, &legacy_cpu, ARM_ARCH_V2S, N_("use -mcpu=arm250")}, - {"marm3", NULL, &legacy_cpu, ARM_ARCH_V2S, N_("use -mcpu=arm3")}, - {"m3", NULL, &legacy_cpu, ARM_ARCH_V2S, N_("use -mcpu=arm3")}, - {"marm6", NULL, &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm6")}, - {"m6", NULL, &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm6")}, - {"marm600", NULL, &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm600")}, - {"m600", NULL, &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm600")}, - {"marm610", NULL, &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm610")}, - {"m610", NULL, &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm610")}, - {"marm620", NULL, &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm620")}, - {"m620", NULL, &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm620")}, - {"marm7", NULL, &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm7")}, - {"m7", NULL, &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm7")}, - {"marm70", NULL, &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm70")}, - {"m70", NULL, &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm70")}, - {"marm700", NULL, &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm700")}, - {"m700", NULL, &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm700")}, - {"marm700i", NULL, &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm700i")}, - {"m700i", NULL, &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm700i")}, - {"marm710", NULL, &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm710")}, - {"m710", NULL, &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm710")}, - {"marm710c", NULL, &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm710c")}, - {"m710c", NULL, &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm710c")}, - {"marm720", NULL, &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm720")}, - {"m720", NULL, &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm720")}, - {"marm7d", NULL, &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm7d")}, - {"m7d", NULL, &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm7d")}, - {"marm7di", NULL, &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm7di")}, - {"m7di", NULL, &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm7di")}, - {"marm7m", NULL, &legacy_cpu, ARM_ARCH_V3M, N_("use -mcpu=arm7m")}, - {"m7m", NULL, &legacy_cpu, ARM_ARCH_V3M, N_("use -mcpu=arm7m")}, - {"marm7dm", NULL, &legacy_cpu, ARM_ARCH_V3M, N_("use -mcpu=arm7dm")}, - {"m7dm", NULL, &legacy_cpu, ARM_ARCH_V3M, N_("use -mcpu=arm7dm")}, - {"marm7dmi", NULL, &legacy_cpu, ARM_ARCH_V3M, N_("use -mcpu=arm7dmi")}, - {"m7dmi", NULL, &legacy_cpu, ARM_ARCH_V3M, N_("use -mcpu=arm7dmi")}, - {"marm7100", NULL, &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm7100")}, - {"m7100", NULL, &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm7100")}, - {"marm7500", NULL, &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm7500")}, - {"m7500", NULL, &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm7500")}, - {"marm7500fe", NULL, &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm7500fe")}, - {"m7500fe", NULL, &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm7500fe")}, - {"marm7t", NULL, &legacy_cpu, ARM_ARCH_V4T, N_("use -mcpu=arm7tdmi")}, - {"m7t", NULL, &legacy_cpu, ARM_ARCH_V4T, N_("use -mcpu=arm7tdmi")}, - {"marm7tdmi", NULL, &legacy_cpu, ARM_ARCH_V4T, N_("use -mcpu=arm7tdmi")}, - {"m7tdmi", NULL, &legacy_cpu, ARM_ARCH_V4T, N_("use -mcpu=arm7tdmi")}, - {"marm710t", NULL, &legacy_cpu, ARM_ARCH_V4T, N_("use -mcpu=arm710t")}, - {"m710t", NULL, &legacy_cpu, ARM_ARCH_V4T, N_("use -mcpu=arm710t")}, - {"marm720t", NULL, &legacy_cpu, ARM_ARCH_V4T, N_("use -mcpu=arm720t")}, - {"m720t", NULL, &legacy_cpu, ARM_ARCH_V4T, N_("use -mcpu=arm720t")}, - {"marm740t", NULL, &legacy_cpu, ARM_ARCH_V4T, N_("use -mcpu=arm740t")}, - {"m740t", NULL, &legacy_cpu, ARM_ARCH_V4T, N_("use -mcpu=arm740t")}, - {"marm8", NULL, &legacy_cpu, ARM_ARCH_V4, N_("use -mcpu=arm8")}, - {"m8", NULL, &legacy_cpu, ARM_ARCH_V4, N_("use -mcpu=arm8")}, - {"marm810", NULL, &legacy_cpu, ARM_ARCH_V4, N_("use -mcpu=arm810")}, - {"m810", NULL, &legacy_cpu, ARM_ARCH_V4, N_("use -mcpu=arm810")}, - {"marm9", NULL, &legacy_cpu, ARM_ARCH_V4T, N_("use -mcpu=arm9")}, - {"m9", NULL, &legacy_cpu, ARM_ARCH_V4T, N_("use -mcpu=arm9")}, - {"marm9tdmi", NULL, &legacy_cpu, ARM_ARCH_V4T, N_("use -mcpu=arm9tdmi")}, - {"m9tdmi", NULL, &legacy_cpu, ARM_ARCH_V4T, N_("use -mcpu=arm9tdmi")}, - {"marm920", NULL, &legacy_cpu, ARM_ARCH_V4T, N_("use -mcpu=arm920")}, - {"m920", NULL, &legacy_cpu, ARM_ARCH_V4T, N_("use -mcpu=arm920")}, - {"marm940", NULL, &legacy_cpu, ARM_ARCH_V4T, N_("use -mcpu=arm940")}, - {"m940", NULL, &legacy_cpu, ARM_ARCH_V4T, N_("use -mcpu=arm940")}, - {"mstrongarm", NULL, &legacy_cpu, ARM_ARCH_V4, N_("use -mcpu=strongarm")}, - {"mstrongarm110", NULL, &legacy_cpu, ARM_ARCH_V4, - N_("use -mcpu=strongarm110")}, - {"mstrongarm1100", NULL, &legacy_cpu, ARM_ARCH_V4, - N_("use -mcpu=strongarm1100")}, - {"mstrongarm1110", NULL, &legacy_cpu, ARM_ARCH_V4, - N_("use -mcpu=strongarm1110")}, - {"mxscale", NULL, &legacy_cpu, ARM_ARCH_XSCALE, N_("use -mcpu=xscale")}, - {"miwmmxt", NULL, &legacy_cpu, ARM_ARCH_IWMMXT, N_("use -mcpu=iwmmxt")}, - {"mall", NULL, &legacy_cpu, ARM_ANY, N_("use -mcpu=all")}, - - /* Architecture variants -- don't add any more to this list either. */ - {"mv2", NULL, &legacy_cpu, ARM_ARCH_V2, N_("use -march=armv2")}, - {"marmv2", NULL, &legacy_cpu, ARM_ARCH_V2, N_("use -march=armv2")}, - {"mv2a", NULL, &legacy_cpu, ARM_ARCH_V2S, N_("use -march=armv2a")}, - {"marmv2a", NULL, &legacy_cpu, ARM_ARCH_V2S, N_("use -march=armv2a")}, - {"mv3", NULL, &legacy_cpu, ARM_ARCH_V3, N_("use -march=armv3")}, - {"marmv3", NULL, &legacy_cpu, ARM_ARCH_V3, N_("use -march=armv3")}, - {"mv3m", NULL, &legacy_cpu, ARM_ARCH_V3M, N_("use -march=armv3m")}, - {"marmv3m", NULL, &legacy_cpu, ARM_ARCH_V3M, N_("use -march=armv3m")}, - {"mv4", NULL, &legacy_cpu, ARM_ARCH_V4, N_("use -march=armv4")}, - {"marmv4", NULL, &legacy_cpu, ARM_ARCH_V4, N_("use -march=armv4")}, - {"mv4t", NULL, &legacy_cpu, ARM_ARCH_V4T, N_("use -march=armv4t")}, - {"marmv4t", NULL, &legacy_cpu, ARM_ARCH_V4T, N_("use -march=armv4t")}, - {"mv5", NULL, &legacy_cpu, ARM_ARCH_V5, N_("use -march=armv5")}, - {"marmv5", NULL, &legacy_cpu, ARM_ARCH_V5, N_("use -march=armv5")}, - {"mv5t", NULL, &legacy_cpu, ARM_ARCH_V5T, N_("use -march=armv5t")}, - {"marmv5t", NULL, &legacy_cpu, ARM_ARCH_V5T, N_("use -march=armv5t")}, - {"mv5e", NULL, &legacy_cpu, ARM_ARCH_V5TE, N_("use -march=armv5te")}, - {"marmv5e", NULL, &legacy_cpu, ARM_ARCH_V5TE, N_("use -march=armv5te")}, - - /* Floating point variants -- don't add any more to this list either. */ - {"mfpe-old", NULL, &legacy_fpu, FPU_ARCH_FPE, N_("use -mfpu=fpe")}, - {"mfpa10", NULL, &legacy_fpu, FPU_ARCH_FPA, N_("use -mfpu=fpa10")}, - {"mfpa11", NULL, &legacy_fpu, FPU_ARCH_FPA, N_("use -mfpu=fpa11")}, - {"mno-fpu", NULL, &legacy_fpu, 0, - N_("use either -mfpu=softfpa or -mfpu=softvfp")}, - - {NULL, NULL, NULL, 0, NULL} -}; - -struct arm_cpu_option_table -{ - char *name; - int value; - /* For some CPUs we assume an FPU unless the user explicitly sets - -mfpu=... */ - int default_fpu; -}; - -/* This list should, at a minimum, contain all the cpu names - recognized by GCC. */ -static struct arm_cpu_option_table arm_cpus[] = -{ - {"all", ARM_ANY, FPU_ARCH_FPA}, - {"arm1", ARM_ARCH_V1, FPU_ARCH_FPA}, - {"arm2", ARM_ARCH_V2, FPU_ARCH_FPA}, - {"arm250", ARM_ARCH_V2S, FPU_ARCH_FPA}, - {"arm3", ARM_ARCH_V2S, FPU_ARCH_FPA}, - {"arm6", ARM_ARCH_V3, FPU_ARCH_FPA}, - {"arm60", ARM_ARCH_V3, FPU_ARCH_FPA}, - {"arm600", ARM_ARCH_V3, FPU_ARCH_FPA}, - {"arm610", ARM_ARCH_V3, FPU_ARCH_FPA}, - {"arm620", ARM_ARCH_V3, FPU_ARCH_FPA}, - {"arm7", ARM_ARCH_V3, FPU_ARCH_FPA}, - {"arm7m", ARM_ARCH_V3M, FPU_ARCH_FPA}, - {"arm7d", ARM_ARCH_V3, FPU_ARCH_FPA}, - {"arm7dm", ARM_ARCH_V3M, FPU_ARCH_FPA}, - {"arm7di", ARM_ARCH_V3, FPU_ARCH_FPA}, - {"arm7dmi", ARM_ARCH_V3M, FPU_ARCH_FPA}, - {"arm70", ARM_ARCH_V3, FPU_ARCH_FPA}, - {"arm700", ARM_ARCH_V3, FPU_ARCH_FPA}, - {"arm700i", ARM_ARCH_V3, FPU_ARCH_FPA}, - {"arm710", ARM_ARCH_V3, FPU_ARCH_FPA}, - {"arm710t", ARM_ARCH_V4T, FPU_ARCH_FPA}, - {"arm720", ARM_ARCH_V3, FPU_ARCH_FPA}, - {"arm720t", ARM_ARCH_V4T, FPU_ARCH_FPA}, - {"arm740t", ARM_ARCH_V4T, FPU_ARCH_FPA}, - {"arm710c", ARM_ARCH_V3, FPU_ARCH_FPA}, - {"arm7100", ARM_ARCH_V3, FPU_ARCH_FPA}, - {"arm7500", ARM_ARCH_V3, FPU_ARCH_FPA}, - {"arm7500fe", ARM_ARCH_V3, FPU_ARCH_FPA}, - {"arm7t", ARM_ARCH_V4T, FPU_ARCH_FPA}, - {"arm7tdmi", ARM_ARCH_V4T, FPU_ARCH_FPA}, - {"arm8", ARM_ARCH_V4, FPU_ARCH_FPA}, - {"arm810", ARM_ARCH_V4, FPU_ARCH_FPA}, - {"strongarm", ARM_ARCH_V4, FPU_ARCH_FPA}, - {"strongarm1", ARM_ARCH_V4, FPU_ARCH_FPA}, - {"strongarm110", ARM_ARCH_V4, FPU_ARCH_FPA}, - {"strongarm1100", ARM_ARCH_V4, FPU_ARCH_FPA}, - {"strongarm1110", ARM_ARCH_V4, FPU_ARCH_FPA}, - {"arm9", ARM_ARCH_V4T, FPU_ARCH_FPA}, - {"arm920", ARM_ARCH_V4T, FPU_ARCH_FPA}, - {"arm920t", ARM_ARCH_V4T, FPU_ARCH_FPA}, - {"arm922t", ARM_ARCH_V4T, FPU_ARCH_FPA}, - {"arm940t", ARM_ARCH_V4T, FPU_ARCH_FPA}, - {"arm9tdmi", ARM_ARCH_V4T, FPU_ARCH_FPA}, - /* For V5 or later processors we default to using VFP; but the user - should really set the FPU type explicitly. */ - {"arm9e-r0", ARM_ARCH_V5TExP, FPU_ARCH_VFP_V2}, - {"arm9e", ARM_ARCH_V5TE, FPU_ARCH_VFP_V2}, - {"arm926ej", ARM_ARCH_V5TEJ, FPU_ARCH_VFP_V2}, - {"arm926ejs", ARM_ARCH_V5TEJ, FPU_ARCH_VFP_V2}, - {"arm946e-r0", ARM_ARCH_V5TExP, FPU_ARCH_VFP_V2}, - {"arm946e", ARM_ARCH_V5TE, FPU_ARCH_VFP_V2}, - {"arm966e-r0", ARM_ARCH_V5TExP, FPU_ARCH_VFP_V2}, - {"arm966e", ARM_ARCH_V5TE, FPU_ARCH_VFP_V2}, - {"arm10t", ARM_ARCH_V5T, FPU_ARCH_VFP_V1}, - {"arm10e", ARM_ARCH_V5TE, FPU_ARCH_VFP_V2}, - {"arm1020", ARM_ARCH_V5TE, FPU_ARCH_VFP_V2}, - {"arm1020t", ARM_ARCH_V5T, FPU_ARCH_VFP_V1}, - {"arm1020e", ARM_ARCH_V5TE, FPU_ARCH_VFP_V2}, - {"arm1026ejs", ARM_ARCH_V5TE, FPU_ARCH_VFP_V2}, - {"arm1136js", ARM_ARCH_V6, FPU_NONE}, - {"arm1136jfs", ARM_ARCH_V6, FPU_ARCH_VFP_V2}, - /* ??? XSCALE is really an architecture. */ - {"xscale", ARM_ARCH_XSCALE, FPU_ARCH_VFP_V2}, - /* ??? iwmmxt is not a processor. */ - {"iwmmxt", ARM_ARCH_IWMMXT, FPU_ARCH_VFP_V2}, - {"i80200", ARM_ARCH_XSCALE, FPU_ARCH_VFP_V2}, - /* Maverick */ - {"ep9312", ARM_ARCH_V4T | ARM_CEXT_MAVERICK, FPU_ARCH_MAVERICK}, - {NULL, 0, 0} -}; - -struct arm_arch_option_table -{ - char *name; - int value; - int default_fpu; -}; - -/* This list should, at a minimum, contain all the architecture names - recognized by GCC. */ -static struct arm_arch_option_table arm_archs[] = -{ - {"all", ARM_ANY, FPU_ARCH_FPA}, - {"armv1", ARM_ARCH_V1, FPU_ARCH_FPA}, - {"armv2", ARM_ARCH_V2, FPU_ARCH_FPA}, - {"armv2a", ARM_ARCH_V2S, FPU_ARCH_FPA}, - {"armv2s", ARM_ARCH_V2S, FPU_ARCH_FPA}, - {"armv3", ARM_ARCH_V3, FPU_ARCH_FPA}, - {"armv3m", ARM_ARCH_V3M, FPU_ARCH_FPA}, - {"armv4", ARM_ARCH_V4, FPU_ARCH_FPA}, - {"armv4xm", ARM_ARCH_V4xM, FPU_ARCH_FPA}, - {"armv4t", ARM_ARCH_V4T, FPU_ARCH_FPA}, - {"armv4txm", ARM_ARCH_V4TxM, FPU_ARCH_FPA}, - {"armv5", ARM_ARCH_V5, FPU_ARCH_VFP}, - {"armv5t", ARM_ARCH_V5T, FPU_ARCH_VFP}, - {"armv5txm", ARM_ARCH_V5TxM, FPU_ARCH_VFP}, - {"armv5te", ARM_ARCH_V5TE, FPU_ARCH_VFP}, - {"armv5texp", ARM_ARCH_V5TExP, FPU_ARCH_VFP}, - {"armv5tej", ARM_ARCH_V5TEJ, FPU_ARCH_VFP}, - {"armv6", ARM_ARCH_V6, FPU_ARCH_VFP}, - {"armv6j", ARM_ARCH_V6, FPU_ARCH_VFP}, - {"xscale", ARM_ARCH_XSCALE, FPU_ARCH_VFP}, - {"iwmmxt", ARM_ARCH_IWMMXT, FPU_ARCH_VFP}, - {NULL, 0, 0} -}; - -/* ISA extensions in the co-processor space. */ -struct arm_arch_extension_table -{ - char *name; - int value; -}; - -static struct arm_arch_extension_table arm_extensions[] = -{ - {"maverick", ARM_CEXT_MAVERICK}, - {"xscale", ARM_CEXT_XSCALE}, - {"iwmmxt", ARM_CEXT_IWMMXT}, - {NULL, 0} -}; - -struct arm_fpu_option_table -{ - char *name; - int value; -}; - -/* This list should, at a minimum, contain all the fpu names - recognized by GCC. */ -static struct arm_fpu_option_table arm_fpus[] = -{ - {"softfpa", FPU_NONE}, - {"fpe", FPU_ARCH_FPE}, - {"fpe2", FPU_ARCH_FPE}, - {"fpe3", FPU_ARCH_FPA}, /* Third release supports LFM/SFM. */ - {"fpa", FPU_ARCH_FPA}, - {"fpa10", FPU_ARCH_FPA}, - {"fpa11", FPU_ARCH_FPA}, - {"arm7500fe", FPU_ARCH_FPA}, - {"softvfp", FPU_ARCH_VFP}, - {"softvfp+vfp", FPU_ARCH_VFP_V2}, - {"vfp", FPU_ARCH_VFP_V2}, - {"vfp9", FPU_ARCH_VFP_V2}, - {"vfp10", FPU_ARCH_VFP_V2}, - {"vfp10-r0", FPU_ARCH_VFP_V1}, - {"vfpxd", FPU_ARCH_VFP_V1xD}, - {"arm1020t", FPU_ARCH_VFP_V1}, - {"arm1020e", FPU_ARCH_VFP_V2}, - {"arm1136jfs", FPU_ARCH_VFP_V2}, - {"maverick", FPU_ARCH_MAVERICK}, - {NULL, 0} -}; - -struct arm_float_abi_option_table -{ - char *name; - int value; -}; - -static struct arm_float_abi_option_table arm_float_abis[] = -{ - {"hard", ARM_FLOAT_ABI_HARD}, - {"softfp", ARM_FLOAT_ABI_SOFTFP}, - {"soft", ARM_FLOAT_ABI_SOFT}, - {NULL, 0} -}; - -struct arm_long_option_table -{ - char *option; /* Substring to match. */ - char *help; /* Help information. */ - int (*func) PARAMS ((char *subopt)); /* Function to decode sub-option. */ - char *deprecated; /* If non-null, print this message. */ -}; + inst.operands[i] describes the destination register. */ static int -arm_parse_extension (str, opt_p) - char *str; - int *opt_p; +move_or_literal_pool (int i, bfd_boolean thumb_p, bfd_boolean mode_3) { - while (str != NULL && *str != 0) - { - struct arm_arch_extension_table *opt; - char *ext; - int optlen; + unsigned long tbit; - if (*str != '+') - { - as_bad (_("invalid architectural extension")); - return 0; - } - - str++; - ext = strchr (str, '+'); - - if (ext != NULL) - optlen = ext - str; - else - optlen = strlen (str); - - if (optlen == 0) - { - as_bad (_("missing architectural extension")); - return 0; - } - - for (opt = arm_extensions; opt->name != NULL; opt++) - if (strncmp (opt->name, str, optlen) == 0) - { - *opt_p |= opt->value; - break; - } - - if (opt->name == NULL) - { - as_bad (_("unknown architectural extnsion `%s'"), str); - return 0; - } - - str = ext; - }; - - return 1; -} - -static int -arm_parse_cpu (str) - char *str; -{ - struct arm_cpu_option_table *opt; - char *ext = strchr (str, '+'); - int optlen; - - if (ext != NULL) - optlen = ext - str; + if (thumb_p) + tbit = (inst.instruction > 0xffff) ? THUMB2_LOAD_BIT : THUMB_LOAD_BIT; else - optlen = strlen (str); + tbit = LOAD_BIT; - if (optlen == 0) + if ((inst.instruction & tbit) == 0) { - as_bad (_("missing cpu name `%s'"), str); - return 0; + inst.error = _("invalid pseudo operation"); + return 1; } - - for (opt = arm_cpus; opt->name != NULL; opt++) - if (strncmp (opt->name, str, optlen) == 0) - { - mcpu_cpu_opt = opt->value; - mcpu_fpu_opt = opt->default_fpu; - - if (ext != NULL) - return arm_parse_extension (ext, &mcpu_cpu_opt); - - return 1; - } - - as_bad (_("unknown cpu `%s'"), str); - return 0; -} - -static int -arm_parse_arch (str) - char *str; -{ - struct arm_arch_option_table *opt; - char *ext = strchr (str, '+'); - int optlen; - - if (ext != NULL) - optlen = ext - str; - else - optlen = strlen (str); - - if (optlen == 0) + if (inst.reloc.exp.X_op != O_constant && inst.reloc.exp.X_op != O_symbol) { - as_bad (_("missing architecture name `%s'"), str); - return 0; + inst.error = _("constant expression expected"); + return 1; } - - - for (opt = arm_archs; opt->name != NULL; opt++) - if (strcmp (opt->name, str) == 0) - { - march_cpu_opt = opt->value; - march_fpu_opt = opt->default_fpu; - - if (ext != NULL) - return arm_parse_extension (ext, &march_cpu_opt); - - return 1; - } - - as_bad (_("unknown architecture `%s'\n"), str); - return 0; -} - -static int -arm_parse_fpu (str) - char *str; -{ - struct arm_fpu_option_table *opt; - - for (opt = arm_fpus; opt->name != NULL; opt++) - if (strcmp (opt->name, str) == 0) - { - mfpu_opt = opt->value; - return 1; - } - - as_bad (_("unknown floating point format `%s'\n"), str); - return 0; -} - -static int -arm_parse_float_abi (str) - char * str; -{ - struct arm_float_abi_option_table *opt; - - for (opt = arm_float_abis; opt->name != NULL; opt++) - if (strcmp (opt->name, str) == 0) - { - mfloat_abi_opt = opt->value; - return 1; - } - - as_bad (_("unknown floating point abi `%s'\n"), str); - return 0; -} - -struct arm_long_option_table arm_long_opts[] = -{ - {"mcpu=", N_("\t assemble for CPU "), - arm_parse_cpu, NULL}, - {"march=", N_("\t assemble for architecture "), - arm_parse_arch, NULL}, - {"mfpu=", N_("\t assemble for FPU architecture "), - arm_parse_fpu, NULL}, - {"mfloat-abi=", N_("\t assemble for floating point ABI "), - arm_parse_float_abi, NULL}, - {NULL, NULL, 0, NULL} -}; - -int -md_parse_option (c, arg) - int c; - char * arg; -{ - struct arm_option_table *opt; - struct arm_long_option_table *lopt; - - switch (c) + if (inst.reloc.exp.X_op == O_constant) { -#ifdef OPTION_EB - case OPTION_EB: - target_big_endian = 1; - break; -#endif - -#ifdef OPTION_EL - case OPTION_EL: - target_big_endian = 0; - break; -#endif - - case 'a': - /* Listing option. Just ignore these, we don't support additional - ones. */ - return 0; - - default: - for (opt = arm_opts; opt->option != NULL; opt++) + if (thumb_p) { - if (c == opt->option[0] - && ((arg == NULL && opt->option[1] == 0) - || strcmp (arg, opt->option + 1) == 0)) + if (!unified_syntax && (inst.reloc.exp.X_add_number & ~0xFF) == 0) { -#if WARN_DEPRECATED - /* If the option is deprecated, tell the user. */ - if (opt->deprecated != NULL) - as_tsktsk (_("option `-%c%s' is deprecated: %s"), c, - arg ? arg : "", _(opt->deprecated)); -#endif - - if (opt->var != NULL) - *opt->var = opt->value; - + /* This can be done with a mov(1) instruction. */ + inst.instruction = T_OPCODE_MOV_I8 | (inst.operands[i].reg << 8); + inst.instruction |= inst.reloc.exp.X_add_number; return 1; } } - - for (lopt = arm_long_opts; lopt->option != NULL; lopt++) + else { - /* These options are expected to have an argument. */ - if (c == lopt->option[0] - && arg != NULL - && strncmp (arg, lopt->option + 1, - strlen (lopt->option + 1)) == 0) + int value = encode_arm_immediate (inst.reloc.exp.X_add_number); + if (value != FAIL) { -#if WARN_DEPRECATED - /* If the option is deprecated, tell the user. */ - if (lopt->deprecated != NULL) - as_tsktsk (_("option `-%c%s' is deprecated: %s"), c, arg, - _(lopt->deprecated)); -#endif + /* This can be done with a mov instruction. */ + inst.instruction &= LITERAL_MASK; + inst.instruction |= INST_IMMEDIATE | (OPCODE_MOV << DATA_OP_SHIFT); + inst.instruction |= value & 0xfff; + return 1; + } - /* Call the sup-option parser. */ - return (*lopt->func)(arg + strlen (lopt->option) - 1); + value = encode_arm_immediate (~inst.reloc.exp.X_add_number); + if (value != FAIL) + { + /* This can be done with a mvn instruction. */ + inst.instruction &= LITERAL_MASK; + inst.instruction |= INST_IMMEDIATE | (OPCODE_MVN << DATA_OP_SHIFT); + inst.instruction |= value & 0xfff; + return 1; } } - - as_bad (_("unrecognized option `-%c%s'"), c, arg ? arg : ""); - return 0; } - return 1; + if (add_to_lit_pool () == FAIL) + { + inst.error = _("literal pool insertion failed"); + return 1; + } + inst.operands[1].reg = REG_PC; + inst.operands[1].isreg = 1; + inst.operands[1].preind = 1; + inst.reloc.pc_rel = 1; + inst.reloc.type = (thumb_p + ? BFD_RELOC_ARM_THUMB_OFFSET + : (mode_3 + ? BFD_RELOC_ARM_HWLITERAL + : BFD_RELOC_ARM_LITERAL)); + return 0; } -void -md_show_usage (fp) - FILE * fp; +/* Functions for instruction encoding, sorted by subarchitecture. + First some generics; their names are taken from the conventional + bit positions for register arguments in ARM format instructions. */ + +static void +do_noargs (void) { - struct arm_option_table *opt; - struct arm_long_option_table *lopt; - - fprintf (fp, _(" ARM-specific assembler options:\n")); - - for (opt = arm_opts; opt->option != NULL; opt++) - if (opt->help != NULL) - fprintf (fp, " -%-23s%s\n", opt->option, _(opt->help)); - - for (lopt = arm_long_opts; lopt->option != NULL; lopt++) - if (lopt->help != NULL) - fprintf (fp, " -%s%s\n", lopt->option, _(lopt->help)); - -#ifdef OPTION_EB - fprintf (fp, _("\ - -EB assemble code for a big-endian cpu\n")); -#endif - -#ifdef OPTION_EL - fprintf (fp, _("\ - -EL assemble code for a little-endian cpu\n")); -#endif } +static void +do_rd (void) +{ + inst.instruction |= inst.operands[0].reg << 12; +} + +static void +do_rd_rm (void) +{ + inst.instruction |= inst.operands[0].reg << 12; + inst.instruction |= inst.operands[1].reg; +} + +static void +do_rd_rn (void) +{ + inst.instruction |= inst.operands[0].reg << 12; + inst.instruction |= inst.operands[1].reg << 16; +} + +static void +do_rn_rd (void) +{ + inst.instruction |= inst.operands[0].reg << 16; + inst.instruction |= inst.operands[1].reg << 12; +} + +static void +do_rd_rm_rn (void) +{ + unsigned Rn = inst.operands[2].reg; + /* Enforce resutrictions on SWP instruction. */ + if ((inst.instruction & 0x0fbfffff) == 0x01000090) + constraint (Rn == inst.operands[0].reg || Rn == inst.operands[1].reg, + _("Rn must not overlap other operands")); + inst.instruction |= inst.operands[0].reg << 12; + inst.instruction |= inst.operands[1].reg; + inst.instruction |= Rn << 16; +} + +static void +do_rd_rn_rm (void) +{ + inst.instruction |= inst.operands[0].reg << 12; + inst.instruction |= inst.operands[1].reg << 16; + inst.instruction |= inst.operands[2].reg; +} + +static void +do_rm_rd_rn (void) +{ + inst.instruction |= inst.operands[0].reg; + inst.instruction |= inst.operands[1].reg << 12; + inst.instruction |= inst.operands[2].reg << 16; +} + +static void +do_imm0 (void) +{ + inst.instruction |= inst.operands[0].imm; +} + +static void +do_rd_cpaddr (void) +{ + inst.instruction |= inst.operands[0].reg << 12; + encode_arm_cp_address (1, TRUE, TRUE, 0); +} + +/* ARM instructions, in alphabetical order by function name (except + that wrapper functions appear immediately after the function they + wrap). */ + +/* This is a pseudo-op of the form "adr rd, label" to be converted + into a relative address of the form "add rd, pc, #label-.-8". */ + +static void +do_adr (void) +{ + inst.instruction |= (inst.operands[0].reg << 12); /* Rd */ + + /* Frag hacking will turn this into a sub instruction if the offset turns + out to be negative. */ + inst.reloc.type = BFD_RELOC_ARM_IMMEDIATE; + inst.reloc.pc_rel = 1; + inst.reloc.exp.X_add_number -= 8; +} + +/* This is a pseudo-op of the form "adrl rd, label" to be converted + into a relative address of the form: + add rd, pc, #low(label-.-8)" + add rd, rd, #high(label-.-8)" */ + +static void +do_adrl (void) +{ + inst.instruction |= (inst.operands[0].reg << 12); /* Rd */ + + /* Frag hacking will turn this into a sub instruction if the offset turns + out to be negative. */ + inst.reloc.type = BFD_RELOC_ARM_ADRL_IMMEDIATE; + inst.reloc.pc_rel = 1; + inst.size = INSN_SIZE * 2; + inst.reloc.exp.X_add_number -= 8; +} + +static void +do_arit (void) +{ + if (!inst.operands[1].present) + inst.operands[1].reg = inst.operands[0].reg; + inst.instruction |= inst.operands[0].reg << 12; + inst.instruction |= inst.operands[1].reg << 16; + encode_arm_shifter_operand (2); +} + +static void +do_barrier (void) +{ + if (inst.operands[0].present) + { + constraint ((inst.instruction & 0xf0) != 0x40 + && inst.operands[0].imm != 0xf, + "bad barrier type"); + inst.instruction |= inst.operands[0].imm; + } + else + inst.instruction |= 0xf; +} + +static void +do_bfc (void) +{ + unsigned int msb = inst.operands[1].imm + inst.operands[2].imm; + constraint (msb > 32, _("bit-field extends past end of register")); + /* The instruction encoding stores the LSB and MSB, + not the LSB and width. */ + inst.instruction |= inst.operands[0].reg << 12; + inst.instruction |= inst.operands[1].imm << 7; + inst.instruction |= (msb - 1) << 16; +} + +static void +do_bfi (void) +{ + unsigned int msb; + + /* #0 in second position is alternative syntax for bfc, which is + the same instruction but with REG_PC in the Rm field. */ + if (!inst.operands[1].isreg) + inst.operands[1].reg = REG_PC; + + msb = inst.operands[2].imm + inst.operands[3].imm; + constraint (msb > 32, _("bit-field extends past end of register")); + /* The instruction encoding stores the LSB and MSB, + not the LSB and width. */ + inst.instruction |= inst.operands[0].reg << 12; + inst.instruction |= inst.operands[1].reg; + inst.instruction |= inst.operands[2].imm << 7; + inst.instruction |= (msb - 1) << 16; +} + +static void +do_bfx (void) +{ + constraint (inst.operands[2].imm + inst.operands[3].imm > 32, + _("bit-field extends past end of register")); + inst.instruction |= inst.operands[0].reg << 12; + inst.instruction |= inst.operands[1].reg; + inst.instruction |= inst.operands[2].imm << 7; + inst.instruction |= (inst.operands[3].imm - 1) << 16; +} + +/* ARM V5 breakpoint instruction (argument parse) + BKPT <16 bit unsigned immediate> + Instruction is not conditional. + The bit pattern given in insns[] has the COND_ALWAYS condition, + and it is an error if the caller tried to override that. */ + +static void +do_bkpt (void) +{ + /* Top 12 of 16 bits to bits 19:8. */ + inst.instruction |= (inst.operands[0].imm & 0xfff0) << 4; + + /* Bottom 4 of 16 bits to bits 3:0. */ + inst.instruction |= inst.operands[0].imm & 0xf; +} + +static void +encode_branch (int default_reloc) +{ + if (inst.operands[0].hasreloc) + { + constraint (inst.operands[0].imm != BFD_RELOC_ARM_PLT32, + _("the only suffix valid here is '(plt)'")); + inst.reloc.type = BFD_RELOC_ARM_PLT32; + } + else + { + inst.reloc.type = default_reloc; + } + inst.reloc.pc_rel = 1; +} + +static void +do_branch (void) +{ +#ifdef OBJ_ELF + if (EF_ARM_EABI_VERSION (meabi_flags) >= EF_ARM_EABI_VER4) + encode_branch (BFD_RELOC_ARM_PCREL_JUMP); + else +#endif + encode_branch (BFD_RELOC_ARM_PCREL_BRANCH); +} + +static void +do_bl (void) +{ +#ifdef OBJ_ELF + if (EF_ARM_EABI_VERSION (meabi_flags) >= EF_ARM_EABI_VER4) + { + if (inst.cond == COND_ALWAYS) + encode_branch (BFD_RELOC_ARM_PCREL_CALL); + else + encode_branch (BFD_RELOC_ARM_PCREL_JUMP); + } + else +#endif + encode_branch (BFD_RELOC_ARM_PCREL_BRANCH); +} + +/* ARM V5 branch-link-exchange instruction (argument parse) + BLX ie BLX(1) + BLX{} ie BLX(2) + Unfortunately, there are two different opcodes for this mnemonic. + So, the insns[].value is not used, and the code here zaps values + into inst.instruction. + Also, the can be 25 bits, hence has its own reloc. */ + +static void +do_blx (void) +{ + if (inst.operands[0].isreg) + { + /* Arg is a register; the opcode provided by insns[] is correct. + It is not illegal to do "blx pc", just useless. */ + if (inst.operands[0].reg == REG_PC) + as_tsktsk (_("use of r15 in blx in ARM mode is not really useful")); + + inst.instruction |= inst.operands[0].reg; + } + else + { + /* Arg is an address; this instruction cannot be executed + conditionally, and the opcode must be adjusted. */ + constraint (inst.cond != COND_ALWAYS, BAD_COND); + inst.instruction = 0xfa000000; +#ifdef OBJ_ELF + if (EF_ARM_EABI_VERSION (meabi_flags) >= EF_ARM_EABI_VER4) + encode_branch (BFD_RELOC_ARM_PCREL_CALL); + else +#endif + encode_branch (BFD_RELOC_ARM_PCREL_BLX); + } +} + +static void +do_bx (void) +{ + if (inst.operands[0].reg == REG_PC) + as_tsktsk (_("use of r15 in bx in ARM mode is not really useful")); + + inst.instruction |= inst.operands[0].reg; +} + + +/* ARM v5TEJ. Jump to Jazelle code. */ + +static void +do_bxj (void) +{ + if (inst.operands[0].reg == REG_PC) + as_tsktsk (_("use of r15 in bxj is not really useful")); + + inst.instruction |= inst.operands[0].reg; +} + +/* Co-processor data operation: + CDP{cond} , , , , {, } + CDP2 , , , , {, } */ +static void +do_cdp (void) +{ + inst.instruction |= inst.operands[0].reg << 8; + inst.instruction |= inst.operands[1].imm << 20; + inst.instruction |= inst.operands[2].reg << 12; + inst.instruction |= inst.operands[3].reg << 16; + inst.instruction |= inst.operands[4].reg; + inst.instruction |= inst.operands[5].imm << 5; +} + +static void +do_cmp (void) +{ + inst.instruction |= inst.operands[0].reg << 16; + encode_arm_shifter_operand (1); +} + +/* Transfer between coprocessor and ARM registers. + MRC{cond} , , , , {, } + MRC2 + MCR{cond} + MCR2 + + No special properties. */ + +static void +do_co_reg (void) +{ + inst.instruction |= inst.operands[0].reg << 8; + inst.instruction |= inst.operands[1].imm << 21; + inst.instruction |= inst.operands[2].reg << 12; + inst.instruction |= inst.operands[3].reg << 16; + inst.instruction |= inst.operands[4].reg; + inst.instruction |= inst.operands[5].imm << 5; +} + +/* Transfer between coprocessor register and pair of ARM registers. + MCRR{cond} , , , , . + MCRR2 + MRRC{cond} + MRRC2 + + Two XScale instructions are special cases of these: + + MAR{cond} acc0, , == MCRR{cond} p0, #0, , , c0 + MRA{cond} acc0, , == MRRC{cond} p0, #0, , , c0 + + Result unpredicatable if Rd or Rn is R15. */ + +static void +do_co_reg2c (void) +{ + inst.instruction |= inst.operands[0].reg << 8; + inst.instruction |= inst.operands[1].imm << 4; + inst.instruction |= inst.operands[2].reg << 12; + inst.instruction |= inst.operands[3].reg << 16; + inst.instruction |= inst.operands[4].reg; +} + +static void +do_cpsi (void) +{ + inst.instruction |= inst.operands[0].imm << 6; + inst.instruction |= inst.operands[1].imm; +} + +static void +do_dbg (void) +{ + inst.instruction |= inst.operands[0].imm; +} + +static void +do_it (void) +{ + /* There is no IT instruction in ARM mode. We + process it but do not generate code for it. */ + inst.size = 0; +} + +static void +do_ldmstm (void) +{ + int base_reg = inst.operands[0].reg; + int range = inst.operands[1].imm; + + inst.instruction |= base_reg << 16; + inst.instruction |= range; + + if (inst.operands[1].writeback) + inst.instruction |= LDM_TYPE_2_OR_3; + + if (inst.operands[0].writeback) + { + inst.instruction |= WRITE_BACK; + /* Check for unpredictable uses of writeback. */ + if (inst.instruction & LOAD_BIT) + { + /* Not allowed in LDM type 2. */ + if ((inst.instruction & LDM_TYPE_2_OR_3) + && ((range & (1 << REG_PC)) == 0)) + as_warn (_("writeback of base register is UNPREDICTABLE")); + /* Only allowed if base reg not in list for other types. */ + else if (range & (1 << base_reg)) + as_warn (_("writeback of base register when in register list is UNPREDICTABLE")); + } + else /* STM. */ + { + /* Not allowed for type 2. */ + if (inst.instruction & LDM_TYPE_2_OR_3) + as_warn (_("writeback of base register is UNPREDICTABLE")); + /* Only allowed if base reg not in list, or first in list. */ + else if ((range & (1 << base_reg)) + && (range & ((1 << base_reg) - 1))) + as_warn (_("if writeback register is in list, it must be the lowest reg in the list")); + } + } +} + +/* ARMv5TE load-consecutive (argument parse) + Mode is like LDRH. + + LDRccD R, mode + STRccD R, mode. */ + +static void +do_ldrd (void) +{ + constraint (inst.operands[0].reg % 2 != 0, + _("first destination register must be even")); + constraint (inst.operands[1].present + && inst.operands[1].reg != inst.operands[0].reg + 1, + _("can only load two consecutive registers")); + constraint (inst.operands[0].reg == REG_LR, _("r14 not allowed here")); + constraint (!inst.operands[2].isreg, _("'[' expected")); + + if (!inst.operands[1].present) + inst.operands[1].reg = inst.operands[0].reg + 1; + + if (inst.instruction & LOAD_BIT) + { + /* encode_arm_addr_mode_3 will diagnose overlap between the base + register and the first register written; we have to diagnose + overlap between the base and the second register written here. */ + + if (inst.operands[2].reg == inst.operands[1].reg + && (inst.operands[2].writeback || inst.operands[2].postind)) + as_warn (_("base register written back, and overlaps " + "second destination register")); + + /* For an index-register load, the index register must not overlap the + destination (even if not write-back). */ + else if (inst.operands[2].immisreg + && ((unsigned) inst.operands[2].imm == inst.operands[0].reg + || (unsigned) inst.operands[2].imm == inst.operands[1].reg)) + as_warn (_("index register overlaps destination register")); + } + + inst.instruction |= inst.operands[0].reg << 12; + encode_arm_addr_mode_3 (2, /*is_t=*/FALSE); +} + +static void +do_ldrex (void) +{ + constraint (!inst.operands[1].isreg || !inst.operands[1].preind + || inst.operands[1].postind || inst.operands[1].writeback + || inst.operands[1].immisreg || inst.operands[1].shifted + || inst.operands[1].negative + /* This can arise if the programmer has written + strex rN, rM, foo + or if they have mistakenly used a register name as the last + operand, eg: + strex rN, rM, rX + It is very difficult to distinguish between these two cases + because "rX" might actually be a label. ie the register + name has been occluded by a symbol of the same name. So we + just generate a general 'bad addressing mode' type error + message and leave it up to the programmer to discover the + true cause and fix their mistake. */ + || (inst.operands[1].reg == REG_PC), + BAD_ADDR_MODE); + + constraint (inst.reloc.exp.X_op != O_constant + || inst.reloc.exp.X_add_number != 0, + _("offset must be zero in ARM encoding")); + + inst.instruction |= inst.operands[0].reg << 12; + inst.instruction |= inst.operands[1].reg << 16; + inst.reloc.type = BFD_RELOC_UNUSED; +} + +static void +do_ldrexd (void) +{ + constraint (inst.operands[0].reg % 2 != 0, + _("even register required")); + constraint (inst.operands[1].present + && inst.operands[1].reg != inst.operands[0].reg + 1, + _("can only load two consecutive registers")); + /* If op 1 were present and equal to PC, this function wouldn't + have been called in the first place. */ + constraint (inst.operands[0].reg == REG_LR, _("r14 not allowed here")); + + inst.instruction |= inst.operands[0].reg << 12; + inst.instruction |= inst.operands[2].reg << 16; +} + +static void +do_ldst (void) +{ + inst.instruction |= inst.operands[0].reg << 12; + if (!inst.operands[1].isreg) + if (move_or_literal_pool (0, /*thumb_p=*/FALSE, /*mode_3=*/FALSE)) + return; + encode_arm_addr_mode_2 (1, /*is_t=*/FALSE); +} + +static void +do_ldstt (void) +{ + /* ldrt/strt always use post-indexed addressing. Turn [Rn] into [Rn]! and + reject [Rn,...]. */ + if (inst.operands[1].preind) + { + constraint (inst.reloc.exp.X_op != O_constant || + inst.reloc.exp.X_add_number != 0, + _("this instruction requires a post-indexed address")); + + inst.operands[1].preind = 0; + inst.operands[1].postind = 1; + inst.operands[1].writeback = 1; + } + inst.instruction |= inst.operands[0].reg << 12; + encode_arm_addr_mode_2 (1, /*is_t=*/TRUE); +} + +/* Halfword and signed-byte load/store operations. */ + +static void +do_ldstv4 (void) +{ + inst.instruction |= inst.operands[0].reg << 12; + if (!inst.operands[1].isreg) + if (move_or_literal_pool (0, /*thumb_p=*/FALSE, /*mode_3=*/TRUE)) + return; + encode_arm_addr_mode_3 (1, /*is_t=*/FALSE); +} + +static void +do_ldsttv4 (void) +{ + /* ldrt/strt always use post-indexed addressing. Turn [Rn] into [Rn]! and + reject [Rn,...]. */ + if (inst.operands[1].preind) + { + constraint (inst.reloc.exp.X_op != O_constant || + inst.reloc.exp.X_add_number != 0, + _("this instruction requires a post-indexed address")); + + inst.operands[1].preind = 0; + inst.operands[1].postind = 1; + inst.operands[1].writeback = 1; + } + inst.instruction |= inst.operands[0].reg << 12; + encode_arm_addr_mode_3 (1, /*is_t=*/TRUE); +} + +/* Co-processor register load/store. + Format: {cond}[L] CP#,CRd,
*/ +static void +do_lstc (void) +{ + inst.instruction |= inst.operands[0].reg << 8; + inst.instruction |= inst.operands[1].reg << 12; + encode_arm_cp_address (2, TRUE, TRUE, 0); +} + +static void +do_mlas (void) +{ + /* This restriction does not apply to mls (nor to mla in v6, but + that's hard to detect at present). */ + if (inst.operands[0].reg == inst.operands[1].reg + && !(inst.instruction & 0x00400000)) + as_tsktsk (_("rd and rm should be different in mla")); + + inst.instruction |= inst.operands[0].reg << 16; + inst.instruction |= inst.operands[1].reg; + inst.instruction |= inst.operands[2].reg << 8; + inst.instruction |= inst.operands[3].reg << 12; + +} + +static void +do_mov (void) +{ + inst.instruction |= inst.operands[0].reg << 12; + encode_arm_shifter_operand (1); +} + +/* ARM V6T2 16-bit immediate register load: MOV[WT]{cond} Rd, #. */ +static void +do_mov16 (void) +{ + inst.instruction |= inst.operands[0].reg << 12; + /* The value is in two pieces: 0:11, 16:19. */ + inst.instruction |= (inst.operands[1].imm & 0x00000fff); + inst.instruction |= (inst.operands[1].imm & 0x0000f000) << 4; +} + +static void +do_mrs (void) +{ + /* mrs only accepts CPSR/SPSR/CPSR_all/SPSR_all. */ + constraint ((inst.operands[1].imm & (PSR_c|PSR_x|PSR_s|PSR_f)) + != (PSR_c|PSR_f), + _("'CPSR' or 'SPSR' expected")); + inst.instruction |= inst.operands[0].reg << 12; + inst.instruction |= (inst.operands[1].imm & SPSR_BIT); +} + +/* Two possible forms: + "{C|S}PSR_, Rm", + "{C|S}PSR_f, #expression". */ + +static void +do_msr (void) +{ + inst.instruction |= inst.operands[0].imm; + if (inst.operands[1].isreg) + inst.instruction |= inst.operands[1].reg; + else + { + inst.instruction |= INST_IMMEDIATE; + inst.reloc.type = BFD_RELOC_ARM_IMMEDIATE; + inst.reloc.pc_rel = 0; + } +} + +static void +do_mul (void) +{ + if (!inst.operands[2].present) + inst.operands[2].reg = inst.operands[0].reg; + inst.instruction |= inst.operands[0].reg << 16; + inst.instruction |= inst.operands[1].reg; + inst.instruction |= inst.operands[2].reg << 8; + + if (inst.operands[0].reg == inst.operands[1].reg) + as_tsktsk (_("rd and rm should be different in mul")); +} + +/* Long Multiply Parser + UMULL RdLo, RdHi, Rm, Rs + SMULL RdLo, RdHi, Rm, Rs + UMLAL RdLo, RdHi, Rm, Rs + SMLAL RdLo, RdHi, Rm, Rs. */ + +static void +do_mull (void) +{ + inst.instruction |= inst.operands[0].reg << 12; + inst.instruction |= inst.operands[1].reg << 16; + inst.instruction |= inst.operands[2].reg; + inst.instruction |= inst.operands[3].reg << 8; + + /* rdhi, rdlo and rm must all be different. */ + if (inst.operands[0].reg == inst.operands[1].reg + || inst.operands[0].reg == inst.operands[2].reg + || inst.operands[1].reg == inst.operands[2].reg) + as_tsktsk (_("rdhi, rdlo and rm must all be different")); +} + +static void +do_nop (void) +{ + if (inst.operands[0].present) + { + /* Architectural NOP hints are CPSR sets with no bits selected. */ + inst.instruction &= 0xf0000000; + inst.instruction |= 0x0320f000 + inst.operands[0].imm; + } +} + +/* ARM V6 Pack Halfword Bottom Top instruction (argument parse). + PKHBT {} , , {, LSL #} + Condition defaults to COND_ALWAYS. + Error if Rd, Rn or Rm are R15. */ + +static void +do_pkhbt (void) +{ + inst.instruction |= inst.operands[0].reg << 12; + inst.instruction |= inst.operands[1].reg << 16; + inst.instruction |= inst.operands[2].reg; + if (inst.operands[3].present) + encode_arm_shift (3); +} + +/* ARM V6 PKHTB (Argument Parse). */ + +static void +do_pkhtb (void) +{ + if (!inst.operands[3].present) + { + /* If the shift specifier is omitted, turn the instruction + into pkhbt rd, rm, rn. */ + inst.instruction &= 0xfff00010; + inst.instruction |= inst.operands[0].reg << 12; + inst.instruction |= inst.operands[1].reg; + inst.instruction |= inst.operands[2].reg << 16; + } + else + { + inst.instruction |= inst.operands[0].reg << 12; + inst.instruction |= inst.operands[1].reg << 16; + inst.instruction |= inst.operands[2].reg; + encode_arm_shift (3); + } +} + +/* ARMv5TE: Preload-Cache + + PLD + + Syntactically, like LDR with B=1, W=0, L=1. */ + +static void +do_pld (void) +{ + constraint (!inst.operands[0].isreg, + _("'[' expected after PLD mnemonic")); + constraint (inst.operands[0].postind, + _("post-indexed expression used in preload instruction")); + constraint (inst.operands[0].writeback, + _("writeback used in preload instruction")); + constraint (!inst.operands[0].preind, + _("unindexed addressing used in preload instruction")); + encode_arm_addr_mode_2 (0, /*is_t=*/FALSE); +} + +/* ARMv7: PLI */ +static void +do_pli (void) +{ + constraint (!inst.operands[0].isreg, + _("'[' expected after PLI mnemonic")); + constraint (inst.operands[0].postind, + _("post-indexed expression used in preload instruction")); + constraint (inst.operands[0].writeback, + _("writeback used in preload instruction")); + constraint (!inst.operands[0].preind, + _("unindexed addressing used in preload instruction")); + encode_arm_addr_mode_2 (0, /*is_t=*/FALSE); + inst.instruction &= ~PRE_INDEX; +} + +static void +do_push_pop (void) +{ + inst.operands[1] = inst.operands[0]; + memset (&inst.operands[0], 0, sizeof inst.operands[0]); + inst.operands[0].isreg = 1; + inst.operands[0].writeback = 1; + inst.operands[0].reg = REG_SP; + do_ldmstm (); +} + +/* ARM V6 RFE (Return from Exception) loads the PC and CPSR from the + word at the specified address and the following word + respectively. + Unconditionally executed. + Error if Rn is R15. */ + +static void +do_rfe (void) +{ + inst.instruction |= inst.operands[0].reg << 16; + if (inst.operands[0].writeback) + inst.instruction |= WRITE_BACK; +} + +/* ARM V6 ssat (argument parse). */ + +static void +do_ssat (void) +{ + inst.instruction |= inst.operands[0].reg << 12; + inst.instruction |= (inst.operands[1].imm - 1) << 16; + inst.instruction |= inst.operands[2].reg; + + if (inst.operands[3].present) + encode_arm_shift (3); +} + +/* ARM V6 usat (argument parse). */ + +static void +do_usat (void) +{ + inst.instruction |= inst.operands[0].reg << 12; + inst.instruction |= inst.operands[1].imm << 16; + inst.instruction |= inst.operands[2].reg; + + if (inst.operands[3].present) + encode_arm_shift (3); +} + +/* ARM V6 ssat16 (argument parse). */ + +static void +do_ssat16 (void) +{ + inst.instruction |= inst.operands[0].reg << 12; + inst.instruction |= ((inst.operands[1].imm - 1) << 16); + inst.instruction |= inst.operands[2].reg; +} + +static void +do_usat16 (void) +{ + inst.instruction |= inst.operands[0].reg << 12; + inst.instruction |= inst.operands[1].imm << 16; + inst.instruction |= inst.operands[2].reg; +} + +/* ARM V6 SETEND (argument parse). Sets the E bit in the CPSR while + preserving the other bits. + + setend , where is either + BE or LE. */ + +static void +do_setend (void) +{ + if (inst.operands[0].imm) + inst.instruction |= 0x200; +} + +static void +do_shift (void) +{ + unsigned int Rm = (inst.operands[1].present + ? inst.operands[1].reg + : inst.operands[0].reg); + + inst.instruction |= inst.operands[0].reg << 12; + inst.instruction |= Rm; + if (inst.operands[2].isreg) /* Rd, {Rm,} Rs */ + { + inst.instruction |= inst.operands[2].reg << 8; + inst.instruction |= SHIFT_BY_REG; + } + else + inst.reloc.type = BFD_RELOC_ARM_SHIFT_IMM; +} + +static void +do_smc (void) +{ + inst.reloc.type = BFD_RELOC_ARM_SMC; + inst.reloc.pc_rel = 0; +} + +static void +do_swi (void) +{ + inst.reloc.type = BFD_RELOC_ARM_SWI; + inst.reloc.pc_rel = 0; +} + +/* ARM V5E (El Segundo) signed-multiply-accumulate (argument parse) + SMLAxy{cond} Rd,Rm,Rs,Rn + SMLAWy{cond} Rd,Rm,Rs,Rn + Error if any register is R15. */ + +static void +do_smla (void) +{ + inst.instruction |= inst.operands[0].reg << 16; + inst.instruction |= inst.operands[1].reg; + inst.instruction |= inst.operands[2].reg << 8; + inst.instruction |= inst.operands[3].reg << 12; +} + +/* ARM V5E (El Segundo) signed-multiply-accumulate-long (argument parse) + SMLALxy{cond} Rdlo,Rdhi,Rm,Rs + Error if any register is R15. + Warning if Rdlo == Rdhi. */ + +static void +do_smlal (void) +{ + inst.instruction |= inst.operands[0].reg << 12; + inst.instruction |= inst.operands[1].reg << 16; + inst.instruction |= inst.operands[2].reg; + inst.instruction |= inst.operands[3].reg << 8; + + if (inst.operands[0].reg == inst.operands[1].reg) + as_tsktsk (_("rdhi and rdlo must be different")); +} + +/* ARM V5E (El Segundo) signed-multiply (argument parse) + SMULxy{cond} Rd,Rm,Rs + Error if any register is R15. */ + +static void +do_smul (void) +{ + inst.instruction |= inst.operands[0].reg << 16; + inst.instruction |= inst.operands[1].reg; + inst.instruction |= inst.operands[2].reg << 8; +} + +/* ARM V6 srs (argument parse). */ + +static void +do_srs (void) +{ + inst.instruction |= inst.operands[0].imm; + if (inst.operands[0].writeback) + inst.instruction |= WRITE_BACK; +} + +/* ARM V6 strex (argument parse). */ + +static void +do_strex (void) +{ + constraint (!inst.operands[2].isreg || !inst.operands[2].preind + || inst.operands[2].postind || inst.operands[2].writeback + || inst.operands[2].immisreg || inst.operands[2].shifted + || inst.operands[2].negative + /* See comment in do_ldrex(). */ + || (inst.operands[2].reg == REG_PC), + BAD_ADDR_MODE); + + constraint (inst.operands[0].reg == inst.operands[1].reg + || inst.operands[0].reg == inst.operands[2].reg, BAD_OVERLAP); + + constraint (inst.reloc.exp.X_op != O_constant + || inst.reloc.exp.X_add_number != 0, + _("offset must be zero in ARM encoding")); + + inst.instruction |= inst.operands[0].reg << 12; + inst.instruction |= inst.operands[1].reg; + inst.instruction |= inst.operands[2].reg << 16; + inst.reloc.type = BFD_RELOC_UNUSED; +} + +static void +do_strexd (void) +{ + constraint (inst.operands[1].reg % 2 != 0, + _("even register required")); + constraint (inst.operands[2].present + && inst.operands[2].reg != inst.operands[1].reg + 1, + _("can only store two consecutive registers")); + /* If op 2 were present and equal to PC, this function wouldn't + have been called in the first place. */ + constraint (inst.operands[1].reg == REG_LR, _("r14 not allowed here")); + + constraint (inst.operands[0].reg == inst.operands[1].reg + || inst.operands[0].reg == inst.operands[1].reg + 1 + || inst.operands[0].reg == inst.operands[3].reg, + BAD_OVERLAP); + + inst.instruction |= inst.operands[0].reg << 12; + inst.instruction |= inst.operands[1].reg; + inst.instruction |= inst.operands[3].reg << 16; +} + +/* ARM V6 SXTAH extracts a 16-bit value from a register, sign + extends it to 32-bits, and adds the result to a value in another + register. You can specify a rotation by 0, 8, 16, or 24 bits + before extracting the 16-bit value. + SXTAH{} , , {, } + Condition defaults to COND_ALWAYS. + Error if any register uses R15. */ + +static void +do_sxtah (void) +{ + inst.instruction |= inst.operands[0].reg << 12; + inst.instruction |= inst.operands[1].reg << 16; + inst.instruction |= inst.operands[2].reg; + inst.instruction |= inst.operands[3].imm << 10; +} + +/* ARM V6 SXTH. + + SXTH {} , {, } + Condition defaults to COND_ALWAYS. + Error if any register uses R15. */ + +static void +do_sxth (void) +{ + inst.instruction |= inst.operands[0].reg << 12; + inst.instruction |= inst.operands[1].reg; + inst.instruction |= inst.operands[2].imm << 10; +} + +/* VFP instructions. In a logical order: SP variant first, monad + before dyad, arithmetic then move then load/store. */ + +static void +do_vfp_sp_monadic (void) +{ + encode_arm_vfp_sp_reg (inst.operands[0].reg, VFP_REG_Sd); + encode_arm_vfp_sp_reg (inst.operands[1].reg, VFP_REG_Sm); +} + +static void +do_vfp_sp_dyadic (void) +{ + encode_arm_vfp_sp_reg (inst.operands[0].reg, VFP_REG_Sd); + encode_arm_vfp_sp_reg (inst.operands[1].reg, VFP_REG_Sn); + encode_arm_vfp_sp_reg (inst.operands[2].reg, VFP_REG_Sm); +} + +static void +do_vfp_sp_compare_z (void) +{ + encode_arm_vfp_sp_reg (inst.operands[0].reg, VFP_REG_Sd); +} + +static void +do_vfp_dp_sp_cvt (void) +{ + inst.instruction |= inst.operands[0].reg << 12; + encode_arm_vfp_sp_reg (inst.operands[1].reg, VFP_REG_Sm); +} + +static void +do_vfp_sp_dp_cvt (void) +{ + encode_arm_vfp_sp_reg (inst.operands[0].reg, VFP_REG_Sd); + inst.instruction |= inst.operands[1].reg; +} + +static void +do_vfp_reg_from_sp (void) +{ + inst.instruction |= inst.operands[0].reg << 12; + encode_arm_vfp_sp_reg (inst.operands[1].reg, VFP_REG_Sn); +} + +static void +do_vfp_reg2_from_sp2 (void) +{ + constraint (inst.operands[2].imm != 2, + _("only two consecutive VFP SP registers allowed here")); + inst.instruction |= inst.operands[0].reg << 12; + inst.instruction |= inst.operands[1].reg << 16; + encode_arm_vfp_sp_reg (inst.operands[2].reg, VFP_REG_Sm); +} + +static void +do_vfp_sp_from_reg (void) +{ + encode_arm_vfp_sp_reg (inst.operands[0].reg, VFP_REG_Sn); + inst.instruction |= inst.operands[1].reg << 12; +} + +static void +do_vfp_sp2_from_reg2 (void) +{ + constraint (inst.operands[0].imm != 2, + _("only two consecutive VFP SP registers allowed here")); + encode_arm_vfp_sp_reg (inst.operands[0].reg, VFP_REG_Sm); + inst.instruction |= inst.operands[1].reg << 12; + inst.instruction |= inst.operands[2].reg << 16; +} + +static void +do_vfp_sp_ldst (void) +{ + encode_arm_vfp_sp_reg (inst.operands[0].reg, VFP_REG_Sd); + encode_arm_cp_address (1, FALSE, TRUE, 0); +} + +static void +do_vfp_dp_ldst (void) +{ + inst.instruction |= inst.operands[0].reg << 12; + encode_arm_cp_address (1, FALSE, TRUE, 0); +} + + +static void +vfp_sp_ldstm (enum vfp_ldstm_type ldstm_type) +{ + if (inst.operands[0].writeback) + inst.instruction |= WRITE_BACK; + else + constraint (ldstm_type != VFP_LDSTMIA, + _("this addressing mode requires base-register writeback")); + inst.instruction |= inst.operands[0].reg << 16; + encode_arm_vfp_sp_reg (inst.operands[1].reg, VFP_REG_Sd); + inst.instruction |= inst.operands[1].imm; +} + +static void +vfp_dp_ldstm (enum vfp_ldstm_type ldstm_type) +{ + int count; + + if (inst.operands[0].writeback) + inst.instruction |= WRITE_BACK; + else + constraint (ldstm_type != VFP_LDSTMIA && ldstm_type != VFP_LDSTMIAX, + _("this addressing mode requires base-register writeback")); + + inst.instruction |= inst.operands[0].reg << 16; + inst.instruction |= inst.operands[1].reg << 12; + + count = inst.operands[1].imm << 1; + if (ldstm_type == VFP_LDSTMIAX || ldstm_type == VFP_LDSTMDBX) + count += 1; + + inst.instruction |= count; +} + +static void +do_vfp_sp_ldstmia (void) +{ + vfp_sp_ldstm (VFP_LDSTMIA); +} + +static void +do_vfp_sp_ldstmdb (void) +{ + vfp_sp_ldstm (VFP_LDSTMDB); +} + +static void +do_vfp_dp_ldstmia (void) +{ + vfp_dp_ldstm (VFP_LDSTMIA); +} + +static void +do_vfp_dp_ldstmdb (void) +{ + vfp_dp_ldstm (VFP_LDSTMDB); +} + +static void +do_vfp_xp_ldstmia (void) +{ + vfp_dp_ldstm (VFP_LDSTMIAX); +} + +static void +do_vfp_xp_ldstmdb (void) +{ + vfp_dp_ldstm (VFP_LDSTMDBX); +} + +/* FPA instructions. Also in a logical order. */ + +static void +do_fpa_cmp (void) +{ + inst.instruction |= inst.operands[0].reg << 16; + inst.instruction |= inst.operands[1].reg; +} + +static void +do_fpa_ldmstm (void) +{ + inst.instruction |= inst.operands[0].reg << 12; + switch (inst.operands[1].imm) + { + case 1: inst.instruction |= CP_T_X; break; + case 2: inst.instruction |= CP_T_Y; break; + case 3: inst.instruction |= CP_T_Y | CP_T_X; break; + case 4: break; + default: abort (); + } + + if (inst.instruction & (PRE_INDEX | INDEX_UP)) + { + /* The instruction specified "ea" or "fd", so we can only accept + [Rn]{!}. The instruction does not really support stacking or + unstacking, so we have to emulate these by setting appropriate + bits and offsets. */ + constraint (inst.reloc.exp.X_op != O_constant + || inst.reloc.exp.X_add_number != 0, + _("this instruction does not support indexing")); + + if ((inst.instruction & PRE_INDEX) || inst.operands[2].writeback) + inst.reloc.exp.X_add_number = 12 * inst.operands[1].imm; + + if (!(inst.instruction & INDEX_UP)) + inst.reloc.exp.X_add_number = -inst.reloc.exp.X_add_number; + + if (!(inst.instruction & PRE_INDEX) && inst.operands[2].writeback) + { + inst.operands[2].preind = 0; + inst.operands[2].postind = 1; + } + } + + encode_arm_cp_address (2, TRUE, TRUE, 0); +} + +/* iWMMXt instructions: strictly in alphabetical order. */ + +static void +do_iwmmxt_tandorc (void) +{ + constraint (inst.operands[0].reg != REG_PC, _("only r15 allowed here")); +} + +static void +do_iwmmxt_textrc (void) +{ + inst.instruction |= inst.operands[0].reg << 12; + inst.instruction |= inst.operands[1].imm; +} + +static void +do_iwmmxt_textrm (void) +{ + inst.instruction |= inst.operands[0].reg << 12; + inst.instruction |= inst.operands[1].reg << 16; + inst.instruction |= inst.operands[2].imm; +} + +static void +do_iwmmxt_tinsr (void) +{ + inst.instruction |= inst.operands[0].reg << 16; + inst.instruction |= inst.operands[1].reg << 12; + inst.instruction |= inst.operands[2].imm; +} + +static void +do_iwmmxt_tmia (void) +{ + inst.instruction |= inst.operands[0].reg << 5; + inst.instruction |= inst.operands[1].reg; + inst.instruction |= inst.operands[2].reg << 12; +} + +static void +do_iwmmxt_waligni (void) +{ + inst.instruction |= inst.operands[0].reg << 12; + inst.instruction |= inst.operands[1].reg << 16; + inst.instruction |= inst.operands[2].reg; + inst.instruction |= inst.operands[3].imm << 20; +} + +static void +do_iwmmxt_wmov (void) +{ + /* WMOV rD, rN is an alias for WOR rD, rN, rN. */ + inst.instruction |= inst.operands[0].reg << 12; + inst.instruction |= inst.operands[1].reg << 16; + inst.instruction |= inst.operands[1].reg; +} + +static void +do_iwmmxt_wldstbh (void) +{ + int reloc; + inst.instruction |= inst.operands[0].reg << 12; + if (thumb_mode) + reloc = BFD_RELOC_ARM_T32_CP_OFF_IMM_S2; + else + reloc = BFD_RELOC_ARM_CP_OFF_IMM_S2; + encode_arm_cp_address (1, TRUE, FALSE, reloc); +} + +static void +do_iwmmxt_wldstw (void) +{ + /* RIWR_RIWC clears .isreg for a control register. */ + if (!inst.operands[0].isreg) + { + constraint (inst.cond != COND_ALWAYS, BAD_COND); + inst.instruction |= 0xf0000000; + } + + inst.instruction |= inst.operands[0].reg << 12; + encode_arm_cp_address (1, TRUE, TRUE, 0); +} + +static void +do_iwmmxt_wldstd (void) +{ + inst.instruction |= inst.operands[0].reg << 12; + encode_arm_cp_address (1, TRUE, FALSE, 0); +} + +static void +do_iwmmxt_wshufh (void) +{ + inst.instruction |= inst.operands[0].reg << 12; + inst.instruction |= inst.operands[1].reg << 16; + inst.instruction |= ((inst.operands[2].imm & 0xf0) << 16); + inst.instruction |= (inst.operands[2].imm & 0x0f); +} + +static void +do_iwmmxt_wzero (void) +{ + /* WZERO reg is an alias for WANDN reg, reg, reg. */ + inst.instruction |= inst.operands[0].reg; + inst.instruction |= inst.operands[0].reg << 12; + inst.instruction |= inst.operands[0].reg << 16; +} + +/* Cirrus Maverick instructions. Simple 2-, 3-, and 4-register + operations first, then control, shift, and load/store. */ + +/* Insns like "foo X,Y,Z". */ + +static void +do_mav_triple (void) +{ + inst.instruction |= inst.operands[0].reg << 16; + inst.instruction |= inst.operands[1].reg; + inst.instruction |= inst.operands[2].reg << 12; +} + +/* Insns like "foo W,X,Y,Z". + where W=MVAX[0:3] and X,Y,Z=MVFX[0:15]. */ + +static void +do_mav_quad (void) +{ + inst.instruction |= inst.operands[0].reg << 5; + inst.instruction |= inst.operands[1].reg << 12; + inst.instruction |= inst.operands[2].reg << 16; + inst.instruction |= inst.operands[3].reg; +} + +/* cfmvsc32 DSPSC,MVDX[15:0]. */ +static void +do_mav_dspsc (void) +{ + inst.instruction |= inst.operands[1].reg << 12; +} + +/* Maverick shift immediate instructions. + cfsh32 MVFX[15:0],MVFX[15:0],Shift[6:0]. + cfsh64 MVDX[15:0],MVDX[15:0],Shift[6:0]. */ + +static void +do_mav_shift (void) +{ + int imm = inst.operands[2].imm; + + inst.instruction |= inst.operands[0].reg << 12; + inst.instruction |= inst.operands[1].reg << 16; + + /* Bits 0-3 of the insn should have bits 0-3 of the immediate. + Bits 5-7 of the insn should have bits 4-6 of the immediate. + Bit 4 should be 0. */ + imm = (imm & 0xf) | ((imm & 0x70) << 1); + + inst.instruction |= imm; +} + +/* XScale instructions. Also sorted arithmetic before move. */ + +/* Xscale multiply-accumulate (argument parse) + MIAcc acc0,Rm,Rs + MIAPHcc acc0,Rm,Rs + MIAxycc acc0,Rm,Rs. */ + +static void +do_xsc_mia (void) +{ + inst.instruction |= inst.operands[1].reg; + inst.instruction |= inst.operands[2].reg << 12; +} + +/* Xscale move-accumulator-register (argument parse) + + MARcc acc0,RdLo,RdHi. */ + +static void +do_xsc_mar (void) +{ + inst.instruction |= inst.operands[1].reg << 12; + inst.instruction |= inst.operands[2].reg << 16; +} + +/* Xscale move-register-accumulator (argument parse) + + MRAcc RdLo,RdHi,acc0. */ + +static void +do_xsc_mra (void) +{ + constraint (inst.operands[0].reg == inst.operands[1].reg, BAD_OVERLAP); + inst.instruction |= inst.operands[0].reg << 12; + inst.instruction |= inst.operands[1].reg << 16; +} + +/* Encoding functions relevant only to Thumb. */ + +/* inst.operands[i] is a shifted-register operand; encode + it into inst.instruction in the format used by Thumb32. */ + +static void +encode_thumb32_shifted_operand (int i) +{ + unsigned int value = inst.reloc.exp.X_add_number; + unsigned int shift = inst.operands[i].shift_kind; + + constraint (inst.operands[i].immisreg, + _("shift by register not allowed in thumb mode")); + inst.instruction |= inst.operands[i].reg; + if (shift == SHIFT_RRX) + inst.instruction |= SHIFT_ROR << 4; + else + { + constraint (inst.reloc.exp.X_op != O_constant, + _("expression too complex")); + + constraint (value > 32 + || (value == 32 && (shift == SHIFT_LSL + || shift == SHIFT_ROR)), + _("shift expression is too large")); + + if (value == 0) + shift = SHIFT_LSL; + else if (value == 32) + value = 0; + + inst.instruction |= shift << 4; + inst.instruction |= (value & 0x1c) << 10; + inst.instruction |= (value & 0x03) << 6; + } +} + + +/* inst.operands[i] was set up by parse_address. Encode it into a + Thumb32 format load or store instruction. Reject forms that cannot + be used with such instructions. If is_t is true, reject forms that + cannot be used with a T instruction; if is_d is true, reject forms + that cannot be used with a D instruction. */ + +static void +encode_thumb32_addr_mode (int i, bfd_boolean is_t, bfd_boolean is_d) +{ + bfd_boolean is_pc = (inst.operands[i].reg == REG_PC); + + constraint (!inst.operands[i].isreg, + _("Instruction does not support =N addresses")); + + inst.instruction |= inst.operands[i].reg << 16; + if (inst.operands[i].immisreg) + { + constraint (is_pc, _("cannot use register index with PC-relative addressing")); + constraint (is_t || is_d, _("cannot use register index with this instruction")); + constraint (inst.operands[i].negative, + _("Thumb does not support negative register indexing")); + constraint (inst.operands[i].postind, + _("Thumb does not support register post-indexing")); + constraint (inst.operands[i].writeback, + _("Thumb does not support register indexing with writeback")); + constraint (inst.operands[i].shifted && inst.operands[i].shift_kind != SHIFT_LSL, + _("Thumb supports only LSL in shifted register indexing")); + + inst.instruction |= inst.operands[i].imm; + if (inst.operands[i].shifted) + { + constraint (inst.reloc.exp.X_op != O_constant, + _("expression too complex")); + constraint (inst.reloc.exp.X_add_number < 0 + || inst.reloc.exp.X_add_number > 3, + _("shift out of range")); + inst.instruction |= inst.reloc.exp.X_add_number << 4; + } + inst.reloc.type = BFD_RELOC_UNUSED; + } + else if (inst.operands[i].preind) + { + constraint (is_pc && inst.operands[i].writeback, + _("cannot use writeback with PC-relative addressing")); + constraint (is_t && inst.operands[i].writeback, + _("cannot use writeback with this instruction")); + + if (is_d) + { + inst.instruction |= 0x01000000; + if (inst.operands[i].writeback) + inst.instruction |= 0x00200000; + } + else + { + inst.instruction |= 0x00000c00; + if (inst.operands[i].writeback) + inst.instruction |= 0x00000100; + } + inst.reloc.type = BFD_RELOC_ARM_T32_OFFSET_IMM; + } + else if (inst.operands[i].postind) + { + assert (inst.operands[i].writeback); + constraint (is_pc, _("cannot use post-indexing with PC-relative addressing")); + constraint (is_t, _("cannot use post-indexing with this instruction")); + + if (is_d) + inst.instruction |= 0x00200000; + else + inst.instruction |= 0x00000900; + inst.reloc.type = BFD_RELOC_ARM_T32_OFFSET_IMM; + } + else /* unindexed - only for coprocessor */ + inst.error = _("instruction does not accept unindexed addressing"); +} + +/* Table of Thumb instructions which exist in both 16- and 32-bit + encodings (the latter only in post-V6T2 cores). The index is the + value used in the insns table below. When there is more than one + possible 16-bit encoding for the instruction, this table always + holds variant (1). + Also contains several pseudo-instructions used during relaxation. */ +#define T16_32_TAB \ + X(adc, 4140, eb400000), \ + X(adcs, 4140, eb500000), \ + X(add, 1c00, eb000000), \ + X(adds, 1c00, eb100000), \ + X(addi, 0000, f1000000), \ + X(addis, 0000, f1100000), \ + X(add_pc,000f, f20f0000), \ + X(add_sp,000d, f10d0000), \ + X(adr, 000f, f20f0000), \ + X(and, 4000, ea000000), \ + X(ands, 4000, ea100000), \ + X(asr, 1000, fa40f000), \ + X(asrs, 1000, fa50f000), \ + X(b, e000, f000b000), \ + X(bcond, d000, f0008000), \ + X(bic, 4380, ea200000), \ + X(bics, 4380, ea300000), \ + X(cmn, 42c0, eb100f00), \ + X(cmp, 2800, ebb00f00), \ + X(cpsie, b660, f3af8400), \ + X(cpsid, b670, f3af8600), \ + X(cpy, 4600, ea4f0000), \ + X(dec_sp,80dd, f1bd0d00), \ + X(eor, 4040, ea800000), \ + X(eors, 4040, ea900000), \ + X(inc_sp,00dd, f10d0d00), \ + X(ldmia, c800, e8900000), \ + X(ldr, 6800, f8500000), \ + X(ldrb, 7800, f8100000), \ + X(ldrh, 8800, f8300000), \ + X(ldrsb, 5600, f9100000), \ + X(ldrsh, 5e00, f9300000), \ + X(ldr_pc,4800, f85f0000), \ + X(ldr_pc2,4800, f85f0000), \ + X(ldr_sp,9800, f85d0000), \ + X(lsl, 0000, fa00f000), \ + X(lsls, 0000, fa10f000), \ + X(lsr, 0800, fa20f000), \ + X(lsrs, 0800, fa30f000), \ + X(mov, 2000, ea4f0000), \ + X(movs, 2000, ea5f0000), \ + X(mul, 4340, fb00f000), \ + X(muls, 4340, ffffffff), /* no 32b muls */ \ + X(mvn, 43c0, ea6f0000), \ + X(mvns, 43c0, ea7f0000), \ + X(neg, 4240, f1c00000), /* rsb #0 */ \ + X(negs, 4240, f1d00000), /* rsbs #0 */ \ + X(orr, 4300, ea400000), \ + X(orrs, 4300, ea500000), \ + X(pop, bc00, e8bd0000), /* ldmia sp!,... */ \ + X(push, b400, e92d0000), /* stmdb sp!,... */ \ + X(rev, ba00, fa90f080), \ + X(rev16, ba40, fa90f090), \ + X(revsh, bac0, fa90f0b0), \ + X(ror, 41c0, fa60f000), \ + X(rors, 41c0, fa70f000), \ + X(sbc, 4180, eb600000), \ + X(sbcs, 4180, eb700000), \ + X(stmia, c000, e8800000), \ + X(str, 6000, f8400000), \ + X(strb, 7000, f8000000), \ + X(strh, 8000, f8200000), \ + X(str_sp,9000, f84d0000), \ + X(sub, 1e00, eba00000), \ + X(subs, 1e00, ebb00000), \ + X(subi, 8000, f1a00000), \ + X(subis, 8000, f1b00000), \ + X(sxtb, b240, fa4ff080), \ + X(sxth, b200, fa0ff080), \ + X(tst, 4200, ea100f00), \ + X(uxtb, b2c0, fa5ff080), \ + X(uxth, b280, fa1ff080), \ + X(nop, bf00, f3af8000), \ + X(yield, bf10, f3af8001), \ + X(wfe, bf20, f3af8002), \ + X(wfi, bf30, f3af8003), \ + X(sev, bf40, f3af9004), /* typo, 8004? */ + +/* To catch errors in encoding functions, the codes are all offset by + 0xF800, putting them in one of the 32-bit prefix ranges, ergo undefined + as 16-bit instructions. */ +#define X(a,b,c) T_MNEM_##a +enum t16_32_codes { T16_32_OFFSET = 0xF7FF, T16_32_TAB }; +#undef X + +#define X(a,b,c) 0x##b +static const unsigned short thumb_op16[] = { T16_32_TAB }; +#define THUMB_OP16(n) (thumb_op16[(n) - (T16_32_OFFSET + 1)]) +#undef X + +#define X(a,b,c) 0x##c +static const unsigned int thumb_op32[] = { T16_32_TAB }; +#define THUMB_OP32(n) (thumb_op32[(n) - (T16_32_OFFSET + 1)]) +#define THUMB_SETS_FLAGS(n) (THUMB_OP32 (n) & 0x00100000) +#undef X +#undef T16_32_TAB + +/* Thumb instruction encoders, in alphabetical order. */ + +/* ADDW or SUBW. */ +static void +do_t_add_sub_w (void) +{ + int Rd, Rn; + + Rd = inst.operands[0].reg; + Rn = inst.operands[1].reg; + + constraint (Rd == 15, _("PC not allowed as destination")); + inst.instruction |= (Rn << 16) | (Rd << 8); + inst.reloc.type = BFD_RELOC_ARM_T32_IMM12; +} + +/* Parse an add or subtract instruction. We get here with inst.instruction + equalling any of THUMB_OPCODE_add, adds, sub, or subs. */ + +static void +do_t_add_sub (void) +{ + int Rd, Rs, Rn; + + Rd = inst.operands[0].reg; + Rs = (inst.operands[1].present + ? inst.operands[1].reg /* Rd, Rs, foo */ + : inst.operands[0].reg); /* Rd, foo -> Rd, Rd, foo */ + + if (unified_syntax) + { + bfd_boolean flags; + bfd_boolean narrow; + int opcode; + + flags = (inst.instruction == T_MNEM_adds + || inst.instruction == T_MNEM_subs); + if (flags) + narrow = (current_it_mask == 0); + else + narrow = (current_it_mask != 0); + if (!inst.operands[2].isreg) + { + opcode = 0; + if (inst.size_req != 4) + { + int add; + + add = (inst.instruction == T_MNEM_add + || inst.instruction == T_MNEM_adds); + /* Attempt to use a narrow opcode, with relaxation if + appropriate. */ + if (Rd == REG_SP && Rs == REG_SP && !flags) + opcode = add ? T_MNEM_inc_sp : T_MNEM_dec_sp; + else if (Rd <= 7 && Rs == REG_SP && add && !flags) + opcode = T_MNEM_add_sp; + else if (Rd <= 7 && Rs == REG_PC && add && !flags) + opcode = T_MNEM_add_pc; + else if (Rd <= 7 && Rs <= 7 && narrow) + { + if (flags) + opcode = add ? T_MNEM_addis : T_MNEM_subis; + else + opcode = add ? T_MNEM_addi : T_MNEM_subi; + } + if (opcode) + { + inst.instruction = THUMB_OP16(opcode); + inst.instruction |= (Rd << 4) | Rs; + inst.reloc.type = BFD_RELOC_ARM_THUMB_ADD; + if (inst.size_req != 2) + inst.relax = opcode; + } + else + constraint (inst.size_req == 2, BAD_HIREG); + } + if (inst.size_req == 4 + || (inst.size_req != 2 && !opcode)) + { + /* ??? Convert large immediates to addw/subw. */ + inst.instruction = THUMB_OP32 (inst.instruction); + inst.instruction = (inst.instruction & 0xe1ffffff) | 0x10000000; + inst.instruction |= inst.operands[0].reg << 8; + inst.instruction |= inst.operands[1].reg << 16; + inst.reloc.type = BFD_RELOC_ARM_T32_IMMEDIATE; + } + } + else + { + Rn = inst.operands[2].reg; + /* See if we can do this with a 16-bit instruction. */ + if (!inst.operands[2].shifted && inst.size_req != 4) + { + if (Rd > 7 || Rs > 7 || Rn > 7) + narrow = FALSE; + + if (narrow) + { + inst.instruction = ((inst.instruction == T_MNEM_adds + || inst.instruction == T_MNEM_add) + ? T_OPCODE_ADD_R3 + : T_OPCODE_SUB_R3); + inst.instruction |= Rd | (Rs << 3) | (Rn << 6); + return; + } + + if (inst.instruction == T_MNEM_add) + { + if (Rd == Rs) + { + inst.instruction = T_OPCODE_ADD_HI; + inst.instruction |= (Rd & 8) << 4; + inst.instruction |= (Rd & 7); + inst.instruction |= Rn << 3; + return; + } + /* ... because addition is commutative! */ + else if (Rd == Rn) + { + inst.instruction = T_OPCODE_ADD_HI; + inst.instruction |= (Rd & 8) << 4; + inst.instruction |= (Rd & 7); + inst.instruction |= Rs << 3; + return; + } + } + } + /* If we get here, it can't be done in 16 bits. */ + constraint (inst.operands[2].shifted && inst.operands[2].immisreg, + _("shift must be constant")); + inst.instruction = THUMB_OP32 (inst.instruction); + inst.instruction |= Rd << 8; + inst.instruction |= Rs << 16; + encode_thumb32_shifted_operand (2); + } + } + else + { + constraint (inst.instruction == T_MNEM_adds + || inst.instruction == T_MNEM_subs, + BAD_THUMB32); + + if (!inst.operands[2].isreg) /* Rd, Rs, #imm */ + { + constraint ((Rd > 7 && (Rd != REG_SP || Rs != REG_SP)) + || (Rs > 7 && Rs != REG_SP && Rs != REG_PC), + BAD_HIREG); + + inst.instruction = (inst.instruction == T_MNEM_add + ? 0x0000 : 0x8000); + inst.instruction |= (Rd << 4) | Rs; + inst.reloc.type = BFD_RELOC_ARM_THUMB_ADD; + return; + } + + Rn = inst.operands[2].reg; + constraint (inst.operands[2].shifted, _("unshifted register required")); + + /* We now have Rd, Rs, and Rn set to registers. */ + if (Rd > 7 || Rs > 7 || Rn > 7) + { + /* Can't do this for SUB. */ + constraint (inst.instruction == T_MNEM_sub, BAD_HIREG); + inst.instruction = T_OPCODE_ADD_HI; + inst.instruction |= (Rd & 8) << 4; + inst.instruction |= (Rd & 7); + if (Rs == Rd) + inst.instruction |= Rn << 3; + else if (Rn == Rd) + inst.instruction |= Rs << 3; + else + constraint (1, _("dest must overlap one source register")); + } + else + { + inst.instruction = (inst.instruction == T_MNEM_add + ? T_OPCODE_ADD_R3 : T_OPCODE_SUB_R3); + inst.instruction |= Rd | (Rs << 3) | (Rn << 6); + } + } +} + +static void +do_t_adr (void) +{ + if (unified_syntax && inst.size_req == 0 && inst.operands[0].reg <= 7) + { + /* Defer to section relaxation. */ + inst.relax = inst.instruction; + inst.instruction = THUMB_OP16 (inst.instruction); + inst.instruction |= inst.operands[0].reg << 4; + } + else if (unified_syntax && inst.size_req != 2) + { + /* Generate a 32-bit opcode. */ + inst.instruction = THUMB_OP32 (inst.instruction); + inst.instruction |= inst.operands[0].reg << 8; + inst.reloc.type = BFD_RELOC_ARM_T32_ADD_PC12; + inst.reloc.pc_rel = 1; + } + else + { + /* Generate a 16-bit opcode. */ + inst.instruction = THUMB_OP16 (inst.instruction); + inst.reloc.type = BFD_RELOC_ARM_THUMB_ADD; + inst.reloc.exp.X_add_number -= 4; /* PC relative adjust. */ + inst.reloc.pc_rel = 1; + + inst.instruction |= inst.operands[0].reg << 4; + } +} + +/* Arithmetic instructions for which there is just one 16-bit + instruction encoding, and it allows only two low registers. + For maximal compatibility with ARM syntax, we allow three register + operands even when Thumb-32 instructions are not available, as long + as the first two are identical. For instance, both "sbc r0,r1" and + "sbc r0,r0,r1" are allowed. */ +static void +do_t_arit3 (void) +{ + int Rd, Rs, Rn; + + Rd = inst.operands[0].reg; + Rs = (inst.operands[1].present + ? inst.operands[1].reg /* Rd, Rs, foo */ + : inst.operands[0].reg); /* Rd, foo -> Rd, Rd, foo */ + Rn = inst.operands[2].reg; + + if (unified_syntax) + { + if (!inst.operands[2].isreg) + { + /* For an immediate, we always generate a 32-bit opcode; + section relaxation will shrink it later if possible. */ + inst.instruction = THUMB_OP32 (inst.instruction); + inst.instruction = (inst.instruction & 0xe1ffffff) | 0x10000000; + inst.instruction |= Rd << 8; + inst.instruction |= Rs << 16; + inst.reloc.type = BFD_RELOC_ARM_T32_IMMEDIATE; + } + else + { + bfd_boolean narrow; + + /* See if we can do this with a 16-bit instruction. */ + if (THUMB_SETS_FLAGS (inst.instruction)) + narrow = current_it_mask == 0; + else + narrow = current_it_mask != 0; + + if (Rd > 7 || Rn > 7 || Rs > 7) + narrow = FALSE; + if (inst.operands[2].shifted) + narrow = FALSE; + if (inst.size_req == 4) + narrow = FALSE; + + if (narrow + && Rd == Rs) + { + inst.instruction = THUMB_OP16 (inst.instruction); + inst.instruction |= Rd; + inst.instruction |= Rn << 3; + return; + } + + /* If we get here, it can't be done in 16 bits. */ + constraint (inst.operands[2].shifted + && inst.operands[2].immisreg, + _("shift must be constant")); + inst.instruction = THUMB_OP32 (inst.instruction); + inst.instruction |= Rd << 8; + inst.instruction |= Rs << 16; + encode_thumb32_shifted_operand (2); + } + } + else + { + /* On its face this is a lie - the instruction does set the + flags. However, the only supported mnemonic in this mode + says it doesn't. */ + constraint (THUMB_SETS_FLAGS (inst.instruction), BAD_THUMB32); + + constraint (!inst.operands[2].isreg || inst.operands[2].shifted, + _("unshifted register required")); + constraint (Rd > 7 || Rs > 7 || Rn > 7, BAD_HIREG); + constraint (Rd != Rs, + _("dest and source1 must be the same register")); + + inst.instruction = THUMB_OP16 (inst.instruction); + inst.instruction |= Rd; + inst.instruction |= Rn << 3; + } +} + +/* Similarly, but for instructions where the arithmetic operation is + commutative, so we can allow either of them to be different from + the destination operand in a 16-bit instruction. For instance, all + three of "adc r0,r1", "adc r0,r0,r1", and "adc r0,r1,r0" are + accepted. */ +static void +do_t_arit3c (void) +{ + int Rd, Rs, Rn; + + Rd = inst.operands[0].reg; + Rs = (inst.operands[1].present + ? inst.operands[1].reg /* Rd, Rs, foo */ + : inst.operands[0].reg); /* Rd, foo -> Rd, Rd, foo */ + Rn = inst.operands[2].reg; + + if (unified_syntax) + { + if (!inst.operands[2].isreg) + { + /* For an immediate, we always generate a 32-bit opcode; + section relaxation will shrink it later if possible. */ + inst.instruction = THUMB_OP32 (inst.instruction); + inst.instruction = (inst.instruction & 0xe1ffffff) | 0x10000000; + inst.instruction |= Rd << 8; + inst.instruction |= Rs << 16; + inst.reloc.type = BFD_RELOC_ARM_T32_IMMEDIATE; + } + else + { + bfd_boolean narrow; + + /* See if we can do this with a 16-bit instruction. */ + if (THUMB_SETS_FLAGS (inst.instruction)) + narrow = current_it_mask == 0; + else + narrow = current_it_mask != 0; + + if (Rd > 7 || Rn > 7 || Rs > 7) + narrow = FALSE; + if (inst.operands[2].shifted) + narrow = FALSE; + if (inst.size_req == 4) + narrow = FALSE; + + if (narrow) + { + if (Rd == Rs) + { + inst.instruction = THUMB_OP16 (inst.instruction); + inst.instruction |= Rd; + inst.instruction |= Rn << 3; + return; + } + if (Rd == Rn) + { + inst.instruction = THUMB_OP16 (inst.instruction); + inst.instruction |= Rd; + inst.instruction |= Rs << 3; + return; + } + } + + /* If we get here, it can't be done in 16 bits. */ + constraint (inst.operands[2].shifted + && inst.operands[2].immisreg, + _("shift must be constant")); + inst.instruction = THUMB_OP32 (inst.instruction); + inst.instruction |= Rd << 8; + inst.instruction |= Rs << 16; + encode_thumb32_shifted_operand (2); + } + } + else + { + /* On its face this is a lie - the instruction does set the + flags. However, the only supported mnemonic in this mode + says it doesn't. */ + constraint (THUMB_SETS_FLAGS (inst.instruction), BAD_THUMB32); + + constraint (!inst.operands[2].isreg || inst.operands[2].shifted, + _("unshifted register required")); + constraint (Rd > 7 || Rs > 7 || Rn > 7, BAD_HIREG); + + inst.instruction = THUMB_OP16 (inst.instruction); + inst.instruction |= Rd; + + if (Rd == Rs) + inst.instruction |= Rn << 3; + else if (Rd == Rn) + inst.instruction |= Rs << 3; + else + constraint (1, _("dest must overlap one source register")); + } +} + +static void +do_t_barrier (void) +{ + if (inst.operands[0].present) + { + constraint ((inst.instruction & 0xf0) != 0x40 + && inst.operands[0].imm != 0xf, + "bad barrier type"); + inst.instruction |= inst.operands[0].imm; + } + else + inst.instruction |= 0xf; +} + +static void +do_t_bfc (void) +{ + unsigned int msb = inst.operands[1].imm + inst.operands[2].imm; + constraint (msb > 32, _("bit-field extends past end of register")); + /* The instruction encoding stores the LSB and MSB, + not the LSB and width. */ + inst.instruction |= inst.operands[0].reg << 8; + inst.instruction |= (inst.operands[1].imm & 0x1c) << 10; + inst.instruction |= (inst.operands[1].imm & 0x03) << 6; + inst.instruction |= msb - 1; +} + +static void +do_t_bfi (void) +{ + unsigned int msb; + + /* #0 in second position is alternative syntax for bfc, which is + the same instruction but with REG_PC in the Rm field. */ + if (!inst.operands[1].isreg) + inst.operands[1].reg = REG_PC; + + msb = inst.operands[2].imm + inst.operands[3].imm; + constraint (msb > 32, _("bit-field extends past end of register")); + /* The instruction encoding stores the LSB and MSB, + not the LSB and width. */ + inst.instruction |= inst.operands[0].reg << 8; + inst.instruction |= inst.operands[1].reg << 16; + inst.instruction |= (inst.operands[2].imm & 0x1c) << 10; + inst.instruction |= (inst.operands[2].imm & 0x03) << 6; + inst.instruction |= msb - 1; +} + +static void +do_t_bfx (void) +{ + constraint (inst.operands[2].imm + inst.operands[3].imm > 32, + _("bit-field extends past end of register")); + inst.instruction |= inst.operands[0].reg << 8; + inst.instruction |= inst.operands[1].reg << 16; + inst.instruction |= (inst.operands[2].imm & 0x1c) << 10; + inst.instruction |= (inst.operands[2].imm & 0x03) << 6; + inst.instruction |= inst.operands[3].imm - 1; +} + +/* ARM V5 Thumb BLX (argument parse) + BLX which is BLX(1) + BLX which is BLX(2) + Unfortunately, there are two different opcodes for this mnemonic. + So, the insns[].value is not used, and the code here zaps values + into inst.instruction. + + ??? How to take advantage of the additional two bits of displacement + available in Thumb32 mode? Need new relocation? */ + +static void +do_t_blx (void) +{ + constraint (current_it_mask && current_it_mask != 0x10, BAD_BRANCH); + if (inst.operands[0].isreg) + /* We have a register, so this is BLX(2). */ + inst.instruction |= inst.operands[0].reg << 3; + else + { + /* No register. This must be BLX(1). */ + inst.instruction = 0xf000e800; +#ifdef OBJ_ELF + if (EF_ARM_EABI_VERSION (meabi_flags) >= EF_ARM_EABI_VER4) + inst.reloc.type = BFD_RELOC_THUMB_PCREL_BRANCH23; + else +#endif + inst.reloc.type = BFD_RELOC_THUMB_PCREL_BLX; + inst.reloc.pc_rel = 1; + } +} + +static void +do_t_branch (void) +{ + int opcode; + int cond; + + if (current_it_mask) + { + /* Conditional branches inside IT blocks are encoded as unconditional + branches. */ + cond = COND_ALWAYS; + /* A branch must be the last instruction in an IT block. */ + constraint (current_it_mask != 0x10, BAD_BRANCH); + } + else + cond = inst.cond; + + if (cond != COND_ALWAYS) + opcode = T_MNEM_bcond; + else + opcode = inst.instruction; + + if (unified_syntax && inst.size_req == 4) + { + inst.instruction = THUMB_OP32(opcode); + if (cond == COND_ALWAYS) + inst.reloc.type = BFD_RELOC_THUMB_PCREL_BRANCH25; + else + { + assert (cond != 0xF); + inst.instruction |= cond << 22; + inst.reloc.type = BFD_RELOC_THUMB_PCREL_BRANCH20; + } + } + else + { + inst.instruction = THUMB_OP16(opcode); + if (cond == COND_ALWAYS) + inst.reloc.type = BFD_RELOC_THUMB_PCREL_BRANCH12; + else + { + inst.instruction |= cond << 8; + inst.reloc.type = BFD_RELOC_THUMB_PCREL_BRANCH9; + } + /* Allow section relaxation. */ + if (unified_syntax && inst.size_req != 2) + inst.relax = opcode; + } + + inst.reloc.pc_rel = 1; +} + +static void +do_t_bkpt (void) +{ + constraint (inst.cond != COND_ALWAYS, + _("instruction is always unconditional")); + if (inst.operands[0].present) + { + constraint (inst.operands[0].imm > 255, + _("immediate value out of range")); + inst.instruction |= inst.operands[0].imm; + } +} + +static void +do_t_branch23 (void) +{ + constraint (current_it_mask && current_it_mask != 0x10, BAD_BRANCH); + inst.reloc.type = BFD_RELOC_THUMB_PCREL_BRANCH23; + inst.reloc.pc_rel = 1; + + /* If the destination of the branch is a defined symbol which does not have + the THUMB_FUNC attribute, then we must be calling a function which has + the (interfacearm) attribute. We look for the Thumb entry point to that + function and change the branch to refer to that function instead. */ + if ( inst.reloc.exp.X_op == O_symbol + && inst.reloc.exp.X_add_symbol != NULL + && S_IS_DEFINED (inst.reloc.exp.X_add_symbol) + && ! THUMB_IS_FUNC (inst.reloc.exp.X_add_symbol)) + inst.reloc.exp.X_add_symbol = + find_real_start (inst.reloc.exp.X_add_symbol); +} + +static void +do_t_bx (void) +{ + constraint (current_it_mask && current_it_mask != 0x10, BAD_BRANCH); + inst.instruction |= inst.operands[0].reg << 3; + /* ??? FIXME: Should add a hacky reloc here if reg is REG_PC. The reloc + should cause the alignment to be checked once it is known. This is + because BX PC only works if the instruction is word aligned. */ +} + +static void +do_t_bxj (void) +{ + constraint (current_it_mask && current_it_mask != 0x10, BAD_BRANCH); + if (inst.operands[0].reg == REG_PC) + as_tsktsk (_("use of r15 in bxj is not really useful")); + + inst.instruction |= inst.operands[0].reg << 16; +} + +static void +do_t_clz (void) +{ + inst.instruction |= inst.operands[0].reg << 8; + inst.instruction |= inst.operands[1].reg << 16; + inst.instruction |= inst.operands[1].reg; +} + +static void +do_t_cps (void) +{ + constraint (current_it_mask, BAD_NOT_IT); + inst.instruction |= inst.operands[0].imm; +} + +static void +do_t_cpsi (void) +{ + constraint (current_it_mask, BAD_NOT_IT); + if (unified_syntax + && (inst.operands[1].present || inst.size_req == 4) + && ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_v6_notm)) + { + unsigned int imod = (inst.instruction & 0x0030) >> 4; + inst.instruction = 0xf3af8000; + inst.instruction |= imod << 9; + inst.instruction |= inst.operands[0].imm << 5; + if (inst.operands[1].present) + inst.instruction |= 0x100 | inst.operands[1].imm; + } + else + { + constraint (!ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_v1) + && (inst.operands[0].imm & 4), + _("selected processor does not support 'A' form " + "of this instruction")); + constraint (inst.operands[1].present || inst.size_req == 4, + _("Thumb does not support the 2-argument " + "form of this instruction")); + inst.instruction |= inst.operands[0].imm; + } +} + +/* THUMB CPY instruction (argument parse). */ + +static void +do_t_cpy (void) +{ + if (inst.size_req == 4) + { + inst.instruction = THUMB_OP32 (T_MNEM_mov); + inst.instruction |= inst.operands[0].reg << 8; + inst.instruction |= inst.operands[1].reg; + } + else + { + inst.instruction |= (inst.operands[0].reg & 0x8) << 4; + inst.instruction |= (inst.operands[0].reg & 0x7); + inst.instruction |= inst.operands[1].reg << 3; + } +} + +static void +do_t_czb (void) +{ + constraint (current_it_mask, BAD_NOT_IT); + constraint (inst.operands[0].reg > 7, BAD_HIREG); + inst.instruction |= inst.operands[0].reg; + inst.reloc.pc_rel = 1; + inst.reloc.type = BFD_RELOC_THUMB_PCREL_BRANCH7; +} + +static void +do_t_dbg (void) +{ + inst.instruction |= inst.operands[0].imm; +} + +static void +do_t_div (void) +{ + if (!inst.operands[1].present) + inst.operands[1].reg = inst.operands[0].reg; + inst.instruction |= inst.operands[0].reg << 8; + inst.instruction |= inst.operands[1].reg << 16; + inst.instruction |= inst.operands[2].reg; +} + +static void +do_t_hint (void) +{ + if (unified_syntax && inst.size_req == 4) + inst.instruction = THUMB_OP32 (inst.instruction); + else + inst.instruction = THUMB_OP16 (inst.instruction); +} + +static void +do_t_it (void) +{ + unsigned int cond = inst.operands[0].imm; + + constraint (current_it_mask, BAD_NOT_IT); + current_it_mask = (inst.instruction & 0xf) | 0x10; + current_cc = cond; + + /* If the condition is a negative condition, invert the mask. */ + if ((cond & 0x1) == 0x0) + { + unsigned int mask = inst.instruction & 0x000f; + + if ((mask & 0x7) == 0) + /* no conversion needed */; + else if ((mask & 0x3) == 0) + mask ^= 0x8; + else if ((mask & 0x1) == 0) + mask ^= 0xC; + else + mask ^= 0xE; + + inst.instruction &= 0xfff0; + inst.instruction |= mask; + } + + inst.instruction |= cond << 4; +} + +static void +do_t_ldmstm (void) +{ + /* This really doesn't seem worth it. */ + constraint (inst.reloc.type != BFD_RELOC_UNUSED, + _("expression too complex")); + constraint (inst.operands[1].writeback, + _("Thumb load/store multiple does not support {reglist}^")); + + if (unified_syntax) + { + /* See if we can use a 16-bit instruction. */ + if (inst.instruction < 0xffff /* not ldmdb/stmdb */ + && inst.size_req != 4 + && inst.operands[0].reg <= 7 + && !(inst.operands[1].imm & ~0xff) + && (inst.instruction == T_MNEM_stmia + ? inst.operands[0].writeback + : (inst.operands[0].writeback + == !(inst.operands[1].imm & (1 << inst.operands[0].reg))))) + { + if (inst.instruction == T_MNEM_stmia + && (inst.operands[1].imm & (1 << inst.operands[0].reg)) + && (inst.operands[1].imm & ((1 << inst.operands[0].reg) - 1))) + as_warn (_("value stored for r%d is UNPREDICTABLE"), + inst.operands[0].reg); + + inst.instruction = THUMB_OP16 (inst.instruction); + inst.instruction |= inst.operands[0].reg << 8; + inst.instruction |= inst.operands[1].imm; + } + else + { + if (inst.operands[1].imm & (1 << 13)) + as_warn (_("SP should not be in register list")); + if (inst.instruction == T_MNEM_stmia) + { + if (inst.operands[1].imm & (1 << 15)) + as_warn (_("PC should not be in register list")); + if (inst.operands[1].imm & (1 << inst.operands[0].reg)) + as_warn (_("value stored for r%d is UNPREDICTABLE"), + inst.operands[0].reg); + } + else + { + if (inst.operands[1].imm & (1 << 14) + && inst.operands[1].imm & (1 << 15)) + as_warn (_("LR and PC should not both be in register list")); + if ((inst.operands[1].imm & (1 << inst.operands[0].reg)) + && inst.operands[0].writeback) + as_warn (_("base register should not be in register list " + "when written back")); + } + if (inst.instruction < 0xffff) + inst.instruction = THUMB_OP32 (inst.instruction); + inst.instruction |= inst.operands[0].reg << 16; + inst.instruction |= inst.operands[1].imm; + if (inst.operands[0].writeback) + inst.instruction |= WRITE_BACK; + } + } + else + { + constraint (inst.operands[0].reg > 7 + || (inst.operands[1].imm & ~0xff), BAD_HIREG); + if (inst.instruction == T_MNEM_stmia) + { + if (!inst.operands[0].writeback) + as_warn (_("this instruction will write back the base register")); + if ((inst.operands[1].imm & (1 << inst.operands[0].reg)) + && (inst.operands[1].imm & ((1 << inst.operands[0].reg) - 1))) + as_warn (_("value stored for r%d is UNPREDICTABLE"), + inst.operands[0].reg); + } + else + { + if (!inst.operands[0].writeback + && !(inst.operands[1].imm & (1 << inst.operands[0].reg))) + as_warn (_("this instruction will write back the base register")); + else if (inst.operands[0].writeback + && (inst.operands[1].imm & (1 << inst.operands[0].reg))) + as_warn (_("this instruction will not write back the base register")); + } + + inst.instruction = THUMB_OP16 (inst.instruction); + inst.instruction |= inst.operands[0].reg << 8; + inst.instruction |= inst.operands[1].imm; + } +} + +static void +do_t_ldrex (void) +{ + constraint (!inst.operands[1].isreg || !inst.operands[1].preind + || inst.operands[1].postind || inst.operands[1].writeback + || inst.operands[1].immisreg || inst.operands[1].shifted + || inst.operands[1].negative, + BAD_ADDR_MODE); + + inst.instruction |= inst.operands[0].reg << 12; + inst.instruction |= inst.operands[1].reg << 16; + inst.reloc.type = BFD_RELOC_ARM_T32_OFFSET_U8; +} + +static void +do_t_ldrexd (void) +{ + if (!inst.operands[1].present) + { + constraint (inst.operands[0].reg == REG_LR, + _("r14 not allowed as first register " + "when second register is omitted")); + inst.operands[1].reg = inst.operands[0].reg + 1; + } + constraint (inst.operands[0].reg == inst.operands[1].reg, + BAD_OVERLAP); + + inst.instruction |= inst.operands[0].reg << 12; + inst.instruction |= inst.operands[1].reg << 8; + inst.instruction |= inst.operands[2].reg << 16; +} + +static void +do_t_ldst (void) +{ + unsigned long opcode; + int Rn; + + opcode = inst.instruction; + if (unified_syntax) + { + if (!inst.operands[1].isreg) + { + if (opcode <= 0xffff) + inst.instruction = THUMB_OP32 (opcode); + if (move_or_literal_pool (0, /*thumb_p=*/TRUE, /*mode_3=*/FALSE)) + return; + } + if (inst.operands[1].isreg + && !inst.operands[1].writeback + && !inst.operands[1].shifted && !inst.operands[1].postind + && !inst.operands[1].negative && inst.operands[0].reg <= 7 + && opcode <= 0xffff + && inst.size_req != 4) + { + /* Insn may have a 16-bit form. */ + Rn = inst.operands[1].reg; + if (inst.operands[1].immisreg) + { + inst.instruction = THUMB_OP16 (opcode); + /* [Rn, Ri] */ + if (Rn <= 7 && inst.operands[1].imm <= 7) + goto op16; + } + else if ((Rn <= 7 && opcode != T_MNEM_ldrsh + && opcode != T_MNEM_ldrsb) + || ((Rn == REG_PC || Rn == REG_SP) && opcode == T_MNEM_ldr) + || (Rn == REG_SP && opcode == T_MNEM_str)) + { + /* [Rn, #const] */ + if (Rn > 7) + { + if (Rn == REG_PC) + { + if (inst.reloc.pc_rel) + opcode = T_MNEM_ldr_pc2; + else + opcode = T_MNEM_ldr_pc; + } + else + { + if (opcode == T_MNEM_ldr) + opcode = T_MNEM_ldr_sp; + else + opcode = T_MNEM_str_sp; + } + inst.instruction = inst.operands[0].reg << 8; + } + else + { + inst.instruction = inst.operands[0].reg; + inst.instruction |= inst.operands[1].reg << 3; + } + inst.instruction |= THUMB_OP16 (opcode); + if (inst.size_req == 2) + inst.reloc.type = BFD_RELOC_ARM_THUMB_OFFSET; + else + inst.relax = opcode; + return; + } + } + /* Definitely a 32-bit variant. */ + inst.instruction = THUMB_OP32 (opcode); + inst.instruction |= inst.operands[0].reg << 12; + encode_thumb32_addr_mode (1, /*is_t=*/FALSE, /*is_d=*/FALSE); + return; + } + + constraint (inst.operands[0].reg > 7, BAD_HIREG); + + if (inst.instruction == T_MNEM_ldrsh || inst.instruction == T_MNEM_ldrsb) + { + /* Only [Rn,Rm] is acceptable. */ + constraint (inst.operands[1].reg > 7 || inst.operands[1].imm > 7, BAD_HIREG); + constraint (!inst.operands[1].isreg || !inst.operands[1].immisreg + || inst.operands[1].postind || inst.operands[1].shifted + || inst.operands[1].negative, + _("Thumb does not support this addressing mode")); + inst.instruction = THUMB_OP16 (inst.instruction); + goto op16; + } + + inst.instruction = THUMB_OP16 (inst.instruction); + if (!inst.operands[1].isreg) + if (move_or_literal_pool (0, /*thumb_p=*/TRUE, /*mode_3=*/FALSE)) + return; + + constraint (!inst.operands[1].preind + || inst.operands[1].shifted + || inst.operands[1].writeback, + _("Thumb does not support this addressing mode")); + if (inst.operands[1].reg == REG_PC || inst.operands[1].reg == REG_SP) + { + constraint (inst.instruction & 0x0600, + _("byte or halfword not valid for base register")); + constraint (inst.operands[1].reg == REG_PC + && !(inst.instruction & THUMB_LOAD_BIT), + _("r15 based store not allowed")); + constraint (inst.operands[1].immisreg, + _("invalid base register for register offset")); + + if (inst.operands[1].reg == REG_PC) + inst.instruction = T_OPCODE_LDR_PC; + else if (inst.instruction & THUMB_LOAD_BIT) + inst.instruction = T_OPCODE_LDR_SP; + else + inst.instruction = T_OPCODE_STR_SP; + + inst.instruction |= inst.operands[0].reg << 8; + inst.reloc.type = BFD_RELOC_ARM_THUMB_OFFSET; + return; + } + + constraint (inst.operands[1].reg > 7, BAD_HIREG); + if (!inst.operands[1].immisreg) + { + /* Immediate offset. */ + inst.instruction |= inst.operands[0].reg; + inst.instruction |= inst.operands[1].reg << 3; + inst.reloc.type = BFD_RELOC_ARM_THUMB_OFFSET; + return; + } + + /* Register offset. */ + constraint (inst.operands[1].imm > 7, BAD_HIREG); + constraint (inst.operands[1].negative, + _("Thumb does not support this addressing mode")); + + op16: + switch (inst.instruction) + { + case T_OPCODE_STR_IW: inst.instruction = T_OPCODE_STR_RW; break; + case T_OPCODE_STR_IH: inst.instruction = T_OPCODE_STR_RH; break; + case T_OPCODE_STR_IB: inst.instruction = T_OPCODE_STR_RB; break; + case T_OPCODE_LDR_IW: inst.instruction = T_OPCODE_LDR_RW; break; + case T_OPCODE_LDR_IH: inst.instruction = T_OPCODE_LDR_RH; break; + case T_OPCODE_LDR_IB: inst.instruction = T_OPCODE_LDR_RB; break; + case 0x5600 /* ldrsb */: + case 0x5e00 /* ldrsh */: break; + default: abort (); + } + + inst.instruction |= inst.operands[0].reg; + inst.instruction |= inst.operands[1].reg << 3; + inst.instruction |= inst.operands[1].imm << 6; +} + +static void +do_t_ldstd (void) +{ + if (!inst.operands[1].present) + { + inst.operands[1].reg = inst.operands[0].reg + 1; + constraint (inst.operands[0].reg == REG_LR, + _("r14 not allowed here")); + } + inst.instruction |= inst.operands[0].reg << 12; + inst.instruction |= inst.operands[1].reg << 8; + encode_thumb32_addr_mode (2, /*is_t=*/FALSE, /*is_d=*/TRUE); + +} + +static void +do_t_ldstt (void) +{ + inst.instruction |= inst.operands[0].reg << 12; + encode_thumb32_addr_mode (1, /*is_t=*/TRUE, /*is_d=*/FALSE); +} + +static void +do_t_mla (void) +{ + inst.instruction |= inst.operands[0].reg << 8; + inst.instruction |= inst.operands[1].reg << 16; + inst.instruction |= inst.operands[2].reg; + inst.instruction |= inst.operands[3].reg << 12; +} + +static void +do_t_mlal (void) +{ + inst.instruction |= inst.operands[0].reg << 12; + inst.instruction |= inst.operands[1].reg << 8; + inst.instruction |= inst.operands[2].reg << 16; + inst.instruction |= inst.operands[3].reg; +} + +static void +do_t_mov_cmp (void) +{ + if (unified_syntax) + { + int r0off = (inst.instruction == T_MNEM_mov + || inst.instruction == T_MNEM_movs) ? 8 : 16; + unsigned long opcode; + bfd_boolean narrow; + bfd_boolean low_regs; + + low_regs = (inst.operands[0].reg <= 7 && inst.operands[1].reg <= 7); + opcode = inst.instruction; + if (current_it_mask) + narrow = opcode != T_MNEM_movs; + else + narrow = opcode != T_MNEM_movs || low_regs; + if (inst.size_req == 4 + || inst.operands[1].shifted) + narrow = FALSE; + + if (!inst.operands[1].isreg) + { + /* Immediate operand. */ + if (current_it_mask == 0 && opcode == T_MNEM_mov) + narrow = 0; + if (low_regs && narrow) + { + inst.instruction = THUMB_OP16 (opcode); + inst.instruction |= inst.operands[0].reg << 8; + if (inst.size_req == 2) + inst.reloc.type = BFD_RELOC_ARM_THUMB_IMM; + else + inst.relax = opcode; + } + else + { + inst.instruction = THUMB_OP32 (inst.instruction); + inst.instruction = (inst.instruction & 0xe1ffffff) | 0x10000000; + inst.instruction |= inst.operands[0].reg << r0off; + inst.reloc.type = BFD_RELOC_ARM_T32_IMMEDIATE; + } + } + else if (!narrow) + { + inst.instruction = THUMB_OP32 (inst.instruction); + inst.instruction |= inst.operands[0].reg << r0off; + encode_thumb32_shifted_operand (1); + } + else + switch (inst.instruction) + { + case T_MNEM_mov: + inst.instruction = T_OPCODE_MOV_HR; + inst.instruction |= (inst.operands[0].reg & 0x8) << 4; + inst.instruction |= (inst.operands[0].reg & 0x7); + inst.instruction |= inst.operands[1].reg << 3; + break; + + case T_MNEM_movs: + /* We know we have low registers at this point. + Generate ADD Rd, Rs, #0. */ + inst.instruction = T_OPCODE_ADD_I3; + inst.instruction |= inst.operands[0].reg; + inst.instruction |= inst.operands[1].reg << 3; + break; + + case T_MNEM_cmp: + if (low_regs) + { + inst.instruction = T_OPCODE_CMP_LR; + inst.instruction |= inst.operands[0].reg; + inst.instruction |= inst.operands[1].reg << 3; + } + else + { + inst.instruction = T_OPCODE_CMP_HR; + inst.instruction |= (inst.operands[0].reg & 0x8) << 4; + inst.instruction |= (inst.operands[0].reg & 0x7); + inst.instruction |= inst.operands[1].reg << 3; + } + break; + } + return; + } + + inst.instruction = THUMB_OP16 (inst.instruction); + if (inst.operands[1].isreg) + { + if (inst.operands[0].reg < 8 && inst.operands[1].reg < 8) + { + /* A move of two lowregs is encoded as ADD Rd, Rs, #0 + since a MOV instruction produces unpredictable results. */ + if (inst.instruction == T_OPCODE_MOV_I8) + inst.instruction = T_OPCODE_ADD_I3; + else + inst.instruction = T_OPCODE_CMP_LR; + + inst.instruction |= inst.operands[0].reg; + inst.instruction |= inst.operands[1].reg << 3; + } + else + { + if (inst.instruction == T_OPCODE_MOV_I8) + inst.instruction = T_OPCODE_MOV_HR; + else + inst.instruction = T_OPCODE_CMP_HR; + do_t_cpy (); + } + } + else + { + constraint (inst.operands[0].reg > 7, + _("only lo regs allowed with immediate")); + inst.instruction |= inst.operands[0].reg << 8; + inst.reloc.type = BFD_RELOC_ARM_THUMB_IMM; + } +} + +static void +do_t_mov16 (void) +{ + inst.instruction |= inst.operands[0].reg << 8; + inst.instruction |= (inst.operands[1].imm & 0xf000) << 4; + inst.instruction |= (inst.operands[1].imm & 0x0800) << 15; + inst.instruction |= (inst.operands[1].imm & 0x0700) << 4; + inst.instruction |= (inst.operands[1].imm & 0x00ff); +} + +static void +do_t_mvn_tst (void) +{ + if (unified_syntax) + { + int r0off = (inst.instruction == T_MNEM_mvn + || inst.instruction == T_MNEM_mvns) ? 8 : 16; + bfd_boolean narrow; + + if (inst.size_req == 4 + || inst.instruction > 0xffff + || inst.operands[1].shifted + || inst.operands[0].reg > 7 || inst.operands[1].reg > 7) + narrow = FALSE; + else if (inst.instruction == T_MNEM_cmn) + narrow = TRUE; + else if (THUMB_SETS_FLAGS (inst.instruction)) + narrow = (current_it_mask == 0); + else + narrow = (current_it_mask != 0); + + if (!inst.operands[1].isreg) + { + /* For an immediate, we always generate a 32-bit opcode; + section relaxation will shrink it later if possible. */ + if (inst.instruction < 0xffff) + inst.instruction = THUMB_OP32 (inst.instruction); + inst.instruction = (inst.instruction & 0xe1ffffff) | 0x10000000; + inst.instruction |= inst.operands[0].reg << r0off; + inst.reloc.type = BFD_RELOC_ARM_T32_IMMEDIATE; + } + else + { + /* See if we can do this with a 16-bit instruction. */ + if (narrow) + { + inst.instruction = THUMB_OP16 (inst.instruction); + inst.instruction |= inst.operands[0].reg; + inst.instruction |= inst.operands[1].reg << 3; + } + else + { + constraint (inst.operands[1].shifted + && inst.operands[1].immisreg, + _("shift must be constant")); + if (inst.instruction < 0xffff) + inst.instruction = THUMB_OP32 (inst.instruction); + inst.instruction |= inst.operands[0].reg << r0off; + encode_thumb32_shifted_operand (1); + } + } + } + else + { + constraint (inst.instruction > 0xffff + || inst.instruction == T_MNEM_mvns, BAD_THUMB32); + constraint (!inst.operands[1].isreg || inst.operands[1].shifted, + _("unshifted register required")); + constraint (inst.operands[0].reg > 7 || inst.operands[1].reg > 7, + BAD_HIREG); + + inst.instruction = THUMB_OP16 (inst.instruction); + inst.instruction |= inst.operands[0].reg; + inst.instruction |= inst.operands[1].reg << 3; + } +} + +static void +do_t_mrs (void) +{ + int flags; + flags = inst.operands[1].imm & (PSR_c|PSR_x|PSR_s|PSR_f|SPSR_BIT); + if (flags == 0) + { + constraint (!ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_v7m), + _("selected processor does not support " + "requested special purpose register")); + } + else + { + constraint (!ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_v1), + _("selected processor does not support " + "requested special purpose register %x")); + /* mrs only accepts CPSR/SPSR/CPSR_all/SPSR_all. */ + constraint ((flags & ~SPSR_BIT) != (PSR_c|PSR_f), + _("'CPSR' or 'SPSR' expected")); + } + + inst.instruction |= inst.operands[0].reg << 8; + inst.instruction |= (flags & SPSR_BIT) >> 2; + inst.instruction |= inst.operands[1].imm & 0xff; +} + +static void +do_t_msr (void) +{ + int flags; + + constraint (!inst.operands[1].isreg, + _("Thumb encoding does not support an immediate here")); + flags = inst.operands[0].imm; + if (flags & ~0xff) + { + constraint (!ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_v1), + _("selected processor does not support " + "requested special purpose register")); + } + else + { + constraint (!ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_v7m), + _("selected processor does not support " + "requested special purpose register")); + flags |= PSR_f; + } + inst.instruction |= (flags & SPSR_BIT) >> 2; + inst.instruction |= (flags & ~SPSR_BIT) >> 8; + inst.instruction |= (flags & 0xff); + inst.instruction |= inst.operands[1].reg << 16; +} + +static void +do_t_mul (void) +{ + if (!inst.operands[2].present) + inst.operands[2].reg = inst.operands[0].reg; + + /* There is no 32-bit MULS and no 16-bit MUL. */ + if (unified_syntax && inst.instruction == T_MNEM_mul) + { + inst.instruction = THUMB_OP32 (inst.instruction); + inst.instruction |= inst.operands[0].reg << 8; + inst.instruction |= inst.operands[1].reg << 16; + inst.instruction |= inst.operands[2].reg << 0; + } + else + { + constraint (!unified_syntax + && inst.instruction == T_MNEM_muls, BAD_THUMB32); + constraint (inst.operands[0].reg > 7 || inst.operands[1].reg > 7, + BAD_HIREG); + + inst.instruction = THUMB_OP16 (inst.instruction); + inst.instruction |= inst.operands[0].reg; + + if (inst.operands[0].reg == inst.operands[1].reg) + inst.instruction |= inst.operands[2].reg << 3; + else if (inst.operands[0].reg == inst.operands[2].reg) + inst.instruction |= inst.operands[1].reg << 3; + else + constraint (1, _("dest must overlap one source register")); + } +} + +static void +do_t_mull (void) +{ + inst.instruction |= inst.operands[0].reg << 12; + inst.instruction |= inst.operands[1].reg << 8; + inst.instruction |= inst.operands[2].reg << 16; + inst.instruction |= inst.operands[3].reg; + + if (inst.operands[0].reg == inst.operands[1].reg) + as_tsktsk (_("rdhi and rdlo must be different")); +} + +static void +do_t_nop (void) +{ + if (unified_syntax) + { + if (inst.size_req == 4 || inst.operands[0].imm > 15) + { + inst.instruction = THUMB_OP32 (inst.instruction); + inst.instruction |= inst.operands[0].imm; + } + else + { + inst.instruction = THUMB_OP16 (inst.instruction); + inst.instruction |= inst.operands[0].imm << 4; + } + } + else + { + constraint (inst.operands[0].present, + _("Thumb does not support NOP with hints")); + inst.instruction = 0x46c0; + } +} + +static void +do_t_neg (void) +{ + if (unified_syntax) + { + bfd_boolean narrow; + + if (THUMB_SETS_FLAGS (inst.instruction)) + narrow = (current_it_mask == 0); + else + narrow = (current_it_mask != 0); + if (inst.operands[0].reg > 7 || inst.operands[1].reg > 7) + narrow = FALSE; + if (inst.size_req == 4) + narrow = FALSE; + + if (!narrow) + { + inst.instruction = THUMB_OP32 (inst.instruction); + inst.instruction |= inst.operands[0].reg << 8; + inst.instruction |= inst.operands[1].reg << 16; + } + else + { + inst.instruction = THUMB_OP16 (inst.instruction); + inst.instruction |= inst.operands[0].reg; + inst.instruction |= inst.operands[1].reg << 3; + } + } + else + { + constraint (inst.operands[0].reg > 7 || inst.operands[1].reg > 7, + BAD_HIREG); + constraint (THUMB_SETS_FLAGS (inst.instruction), BAD_THUMB32); + + inst.instruction = THUMB_OP16 (inst.instruction); + inst.instruction |= inst.operands[0].reg; + inst.instruction |= inst.operands[1].reg << 3; + } +} + +static void +do_t_pkhbt (void) +{ + inst.instruction |= inst.operands[0].reg << 8; + inst.instruction |= inst.operands[1].reg << 16; + inst.instruction |= inst.operands[2].reg; + if (inst.operands[3].present) + { + unsigned int val = inst.reloc.exp.X_add_number; + constraint (inst.reloc.exp.X_op != O_constant, + _("expression too complex")); + inst.instruction |= (val & 0x1c) << 10; + inst.instruction |= (val & 0x03) << 6; + } +} + +static void +do_t_pkhtb (void) +{ + if (!inst.operands[3].present) + inst.instruction &= ~0x00000020; + do_t_pkhbt (); +} + +static void +do_t_pld (void) +{ + encode_thumb32_addr_mode (0, /*is_t=*/FALSE, /*is_d=*/FALSE); +} + +static void +do_t_push_pop (void) +{ + unsigned mask; + + constraint (inst.operands[0].writeback, + _("push/pop do not support {reglist}^")); + constraint (inst.reloc.type != BFD_RELOC_UNUSED, + _("expression too complex")); + + mask = inst.operands[0].imm; + if ((mask & ~0xff) == 0) + inst.instruction = THUMB_OP16 (inst.instruction); + else if ((inst.instruction == T_MNEM_push + && (mask & ~0xff) == 1 << REG_LR) + || (inst.instruction == T_MNEM_pop + && (mask & ~0xff) == 1 << REG_PC)) + { + inst.instruction = THUMB_OP16 (inst.instruction); + inst.instruction |= THUMB_PP_PC_LR; + mask &= 0xff; + } + else if (unified_syntax) + { + if (mask & (1 << 13)) + inst.error = _("SP not allowed in register list"); + if (inst.instruction == T_MNEM_push) + { + if (mask & (1 << 15)) + inst.error = _("PC not allowed in register list"); + } + else + { + if (mask & (1 << 14) + && mask & (1 << 15)) + inst.error = _("LR and PC should not both be in register list"); + } + if ((mask & (mask - 1)) == 0) + { + /* Single register push/pop implemented as str/ldr. */ + if (inst.instruction == T_MNEM_push) + inst.instruction = 0xf84d0d04; /* str reg, [sp, #-4]! */ + else + inst.instruction = 0xf85d0b04; /* ldr reg, [sp], #4 */ + mask = ffs(mask) - 1; + mask <<= 12; + } + else + inst.instruction = THUMB_OP32 (inst.instruction); + } + else + { + inst.error = _("invalid register list to push/pop instruction"); + return; + } + + inst.instruction |= mask; +} + +static void +do_t_rbit (void) +{ + inst.instruction |= inst.operands[0].reg << 8; + inst.instruction |= inst.operands[1].reg << 16; +} + +static void +do_t_rev (void) +{ + if (inst.operands[0].reg <= 7 && inst.operands[1].reg <= 7 + && inst.size_req != 4) + { + inst.instruction = THUMB_OP16 (inst.instruction); + inst.instruction |= inst.operands[0].reg; + inst.instruction |= inst.operands[1].reg << 3; + } + else if (unified_syntax) + { + inst.instruction = THUMB_OP32 (inst.instruction); + inst.instruction |= inst.operands[0].reg << 8; + inst.instruction |= inst.operands[1].reg << 16; + inst.instruction |= inst.operands[1].reg; + } + else + inst.error = BAD_HIREG; +} + +static void +do_t_rsb (void) +{ + int Rd, Rs; + + Rd = inst.operands[0].reg; + Rs = (inst.operands[1].present + ? inst.operands[1].reg /* Rd, Rs, foo */ + : inst.operands[0].reg); /* Rd, foo -> Rd, Rd, foo */ + + inst.instruction |= Rd << 8; + inst.instruction |= Rs << 16; + if (!inst.operands[2].isreg) + { + inst.instruction = (inst.instruction & 0xe1ffffff) | 0x10000000; + inst.reloc.type = BFD_RELOC_ARM_T32_IMMEDIATE; + } + else + encode_thumb32_shifted_operand (2); +} + +static void +do_t_setend (void) +{ + constraint (current_it_mask, BAD_NOT_IT); + if (inst.operands[0].imm) + inst.instruction |= 0x8; +} + +static void +do_t_shift (void) +{ + if (!inst.operands[1].present) + inst.operands[1].reg = inst.operands[0].reg; + + if (unified_syntax) + { + bfd_boolean narrow; + int shift_kind; + + switch (inst.instruction) + { + case T_MNEM_asr: + case T_MNEM_asrs: shift_kind = SHIFT_ASR; break; + case T_MNEM_lsl: + case T_MNEM_lsls: shift_kind = SHIFT_LSL; break; + case T_MNEM_lsr: + case T_MNEM_lsrs: shift_kind = SHIFT_LSR; break; + case T_MNEM_ror: + case T_MNEM_rors: shift_kind = SHIFT_ROR; break; + default: abort (); + } + + if (THUMB_SETS_FLAGS (inst.instruction)) + narrow = (current_it_mask == 0); + else + narrow = (current_it_mask != 0); + if (inst.operands[0].reg > 7 || inst.operands[1].reg > 7) + narrow = FALSE; + if (!inst.operands[2].isreg && shift_kind == SHIFT_ROR) + narrow = FALSE; + if (inst.operands[2].isreg + && (inst.operands[1].reg != inst.operands[0].reg + || inst.operands[2].reg > 7)) + narrow = FALSE; + if (inst.size_req == 4) + narrow = FALSE; + + if (!narrow) + { + if (inst.operands[2].isreg) + { + inst.instruction = THUMB_OP32 (inst.instruction); + inst.instruction |= inst.operands[0].reg << 8; + inst.instruction |= inst.operands[1].reg << 16; + inst.instruction |= inst.operands[2].reg; + } + else + { + inst.operands[1].shifted = 1; + inst.operands[1].shift_kind = shift_kind; + inst.instruction = THUMB_OP32 (THUMB_SETS_FLAGS (inst.instruction) + ? T_MNEM_movs : T_MNEM_mov); + inst.instruction |= inst.operands[0].reg << 8; + encode_thumb32_shifted_operand (1); + /* Prevent the incorrect generation of an ARM_IMMEDIATE fixup. */ + inst.reloc.type = BFD_RELOC_UNUSED; + } + } + else + { + if (inst.operands[2].isreg) + { + switch (shift_kind) + { + case SHIFT_ASR: inst.instruction = T_OPCODE_ASR_R; break; + case SHIFT_LSL: inst.instruction = T_OPCODE_LSL_R; break; + case SHIFT_LSR: inst.instruction = T_OPCODE_LSR_R; break; + case SHIFT_ROR: inst.instruction = T_OPCODE_ROR_R; break; + default: abort (); + } + + inst.instruction |= inst.operands[0].reg; + inst.instruction |= inst.operands[2].reg << 3; + } + else + { + switch (shift_kind) + { + case SHIFT_ASR: inst.instruction = T_OPCODE_ASR_I; break; + case SHIFT_LSL: inst.instruction = T_OPCODE_LSL_I; break; + case SHIFT_LSR: inst.instruction = T_OPCODE_LSR_I; break; + default: abort (); + } + inst.reloc.type = BFD_RELOC_ARM_THUMB_SHIFT; + inst.instruction |= inst.operands[0].reg; + inst.instruction |= inst.operands[1].reg << 3; + } + } + } + else + { + constraint (inst.operands[0].reg > 7 + || inst.operands[1].reg > 7, BAD_HIREG); + constraint (THUMB_SETS_FLAGS (inst.instruction), BAD_THUMB32); + + if (inst.operands[2].isreg) /* Rd, {Rs,} Rn */ + { + constraint (inst.operands[2].reg > 7, BAD_HIREG); + constraint (inst.operands[0].reg != inst.operands[1].reg, + _("source1 and dest must be same register")); + + switch (inst.instruction) + { + case T_MNEM_asr: inst.instruction = T_OPCODE_ASR_R; break; + case T_MNEM_lsl: inst.instruction = T_OPCODE_LSL_R; break; + case T_MNEM_lsr: inst.instruction = T_OPCODE_LSR_R; break; + case T_MNEM_ror: inst.instruction = T_OPCODE_ROR_R; break; + default: abort (); + } + + inst.instruction |= inst.operands[0].reg; + inst.instruction |= inst.operands[2].reg << 3; + } + else + { + switch (inst.instruction) + { + case T_MNEM_asr: inst.instruction = T_OPCODE_ASR_I; break; + case T_MNEM_lsl: inst.instruction = T_OPCODE_LSL_I; break; + case T_MNEM_lsr: inst.instruction = T_OPCODE_LSR_I; break; + case T_MNEM_ror: inst.error = _("ror #imm not supported"); return; + default: abort (); + } + inst.reloc.type = BFD_RELOC_ARM_THUMB_SHIFT; + inst.instruction |= inst.operands[0].reg; + inst.instruction |= inst.operands[1].reg << 3; + } + } +} + +static void +do_t_simd (void) +{ + inst.instruction |= inst.operands[0].reg << 8; + inst.instruction |= inst.operands[1].reg << 16; + inst.instruction |= inst.operands[2].reg; +} + +static void +do_t_smc (void) +{ + unsigned int value = inst.reloc.exp.X_add_number; + constraint (inst.reloc.exp.X_op != O_constant, + _("expression too complex")); + inst.reloc.type = BFD_RELOC_UNUSED; + inst.instruction |= (value & 0xf000) >> 12; + inst.instruction |= (value & 0x0ff0); + inst.instruction |= (value & 0x000f) << 16; +} + +static void +do_t_ssat (void) +{ + inst.instruction |= inst.operands[0].reg << 8; + inst.instruction |= inst.operands[1].imm - 1; + inst.instruction |= inst.operands[2].reg << 16; + + if (inst.operands[3].present) + { + constraint (inst.reloc.exp.X_op != O_constant, + _("expression too complex")); + + if (inst.reloc.exp.X_add_number != 0) + { + if (inst.operands[3].shift_kind == SHIFT_ASR) + inst.instruction |= 0x00200000; /* sh bit */ + inst.instruction |= (inst.reloc.exp.X_add_number & 0x1c) << 10; + inst.instruction |= (inst.reloc.exp.X_add_number & 0x03) << 6; + } + inst.reloc.type = BFD_RELOC_UNUSED; + } +} + +static void +do_t_ssat16 (void) +{ + inst.instruction |= inst.operands[0].reg << 8; + inst.instruction |= inst.operands[1].imm - 1; + inst.instruction |= inst.operands[2].reg << 16; +} + +static void +do_t_strex (void) +{ + constraint (!inst.operands[2].isreg || !inst.operands[2].preind + || inst.operands[2].postind || inst.operands[2].writeback + || inst.operands[2].immisreg || inst.operands[2].shifted + || inst.operands[2].negative, + BAD_ADDR_MODE); + + inst.instruction |= inst.operands[0].reg << 8; + inst.instruction |= inst.operands[1].reg << 12; + inst.instruction |= inst.operands[2].reg << 16; + inst.reloc.type = BFD_RELOC_ARM_T32_OFFSET_U8; +} + +static void +do_t_strexd (void) +{ + if (!inst.operands[2].present) + inst.operands[2].reg = inst.operands[1].reg + 1; + + constraint (inst.operands[0].reg == inst.operands[1].reg + || inst.operands[0].reg == inst.operands[2].reg + || inst.operands[0].reg == inst.operands[3].reg + || inst.operands[1].reg == inst.operands[2].reg, + BAD_OVERLAP); + + inst.instruction |= inst.operands[0].reg; + inst.instruction |= inst.operands[1].reg << 12; + inst.instruction |= inst.operands[2].reg << 8; + inst.instruction |= inst.operands[3].reg << 16; +} + +static void +do_t_sxtah (void) +{ + inst.instruction |= inst.operands[0].reg << 8; + inst.instruction |= inst.operands[1].reg << 16; + inst.instruction |= inst.operands[2].reg; + inst.instruction |= inst.operands[3].imm << 4; +} + +static void +do_t_sxth (void) +{ + if (inst.instruction <= 0xffff && inst.size_req != 4 + && inst.operands[0].reg <= 7 && inst.operands[1].reg <= 7 + && (!inst.operands[2].present || inst.operands[2].imm == 0)) + { + inst.instruction = THUMB_OP16 (inst.instruction); + inst.instruction |= inst.operands[0].reg; + inst.instruction |= inst.operands[1].reg << 3; + } + else if (unified_syntax) + { + if (inst.instruction <= 0xffff) + inst.instruction = THUMB_OP32 (inst.instruction); + inst.instruction |= inst.operands[0].reg << 8; + inst.instruction |= inst.operands[1].reg; + inst.instruction |= inst.operands[2].imm << 4; + } + else + { + constraint (inst.operands[2].present && inst.operands[2].imm != 0, + _("Thumb encoding does not support rotation")); + constraint (1, BAD_HIREG); + } +} + +static void +do_t_swi (void) +{ + inst.reloc.type = BFD_RELOC_ARM_SWI; +} + +static void +do_t_tb (void) +{ + int half; + + half = (inst.instruction & 0x10) != 0; + constraint (current_it_mask && current_it_mask != 0x10, BAD_BRANCH); + constraint (inst.operands[0].immisreg, + _("instruction requires register index")); + constraint (inst.operands[0].imm == 15, + _("PC is not a valid index register")); + constraint (!half && inst.operands[0].shifted, + _("instruction does not allow shifted index")); + inst.instruction |= (inst.operands[0].reg << 16) | inst.operands[0].imm; +} + +static void +do_t_usat (void) +{ + inst.instruction |= inst.operands[0].reg << 8; + inst.instruction |= inst.operands[1].imm; + inst.instruction |= inst.operands[2].reg << 16; + + if (inst.operands[3].present) + { + constraint (inst.reloc.exp.X_op != O_constant, + _("expression too complex")); + if (inst.reloc.exp.X_add_number != 0) + { + if (inst.operands[3].shift_kind == SHIFT_ASR) + inst.instruction |= 0x00200000; /* sh bit */ + + inst.instruction |= (inst.reloc.exp.X_add_number & 0x1c) << 10; + inst.instruction |= (inst.reloc.exp.X_add_number & 0x03) << 6; + } + inst.reloc.type = BFD_RELOC_UNUSED; + } +} + +static void +do_t_usat16 (void) +{ + inst.instruction |= inst.operands[0].reg << 8; + inst.instruction |= inst.operands[1].imm; + inst.instruction |= inst.operands[2].reg << 16; +} + +/* Overall per-instruction processing. */ + /* We need to be able to fix up arbitrary expressions in some statements. This is so that we can handle symbols that are an arbitrary distance from the pc. The most common cases are of the form ((+/-sym -/+ . - 8) & mask), which returns part of an address in a form which will be valid for - a data instruction. We do this by pushing the expression into a symbol + a data instruction. We do this by pushing the expression into a symbol in the expr_section, and creating a fix for that. */ static void -fix_new_arm (frag, where, size, exp, pc_rel, reloc) - fragS * frag; - int where; - short int size; - expressionS * exp; - int pc_rel; - int reloc; +fix_new_arm (fragS * frag, + int where, + short int size, + expressionS * exp, + int pc_rel, + int reloc) { - fixS * new_fix; - arm_fix_data * arm_data; + fixS * new_fix; switch (exp->X_op) { @@ -13756,74 +8034,457 @@ fix_new_arm (frag, where, size, exp, pc_rel, reloc) /* Mark whether the fix is to a THUMB instruction, or an ARM instruction. */ - arm_data = (arm_fix_data *) obstack_alloc (& notes, sizeof (arm_fix_data)); - new_fix->tc_fix_data = (PTR) arm_data; - arm_data->thumb_mode = thumb_mode; + new_fix->tc_fix_data = thumb_mode; } -/* This fix_new is called by cons via TC_CONS_FIX_NEW. */ - -void -cons_fix_new_arm (frag, where, size, exp) - fragS * frag; - int where; - int size; - expressionS * exp; +/* Create a frg for an instruction requiring relaxation. */ +static void +output_relax_insn (void) { - bfd_reloc_code_real_type type; - int pcrel = 0; + char * to; + symbolS *sym; + int offset; - /* Pick a reloc. - FIXME: @@ Should look at CPU word size. */ - switch (size) - { - case 1: - type = BFD_RELOC_8; - break; - case 2: - type = BFD_RELOC_16; - break; - case 4: - default: - type = BFD_RELOC_32; - break; - case 8: - type = BFD_RELOC_64; - break; - } - - fix_new_exp (frag, where, (int) size, exp, pcrel, type); -} - -/* A good place to do this, although this was probably not intended - for this kind of use. We need to dump the literal pool before - references are made to a null symbol pointer. */ - -void -arm_cleanup () -{ - literal_pool * pool; - - for (pool = list_of_pools; pool; pool = pool->next) - { - /* Put it at the end of the relevent section. */ - subseg_set (pool->section, pool->sub_section); #ifdef OBJ_ELF - arm_elf_change_section (); + /* The size of the instruction is unknown, so tie the debug info to the + start of the instruction. */ + dwarf2_emit_insn (0); #endif - s_ltorg (0); + + switch (inst.reloc.exp.X_op) + { + case O_symbol: + sym = inst.reloc.exp.X_add_symbol; + offset = inst.reloc.exp.X_add_number; + break; + case O_constant: + sym = NULL; + offset = inst.reloc.exp.X_add_number; + break; + default: + sym = make_expr_symbol (&inst.reloc.exp); + offset = 0; + break; + } + to = frag_var (rs_machine_dependent, INSN_SIZE, THUMB_SIZE, + inst.relax, sym, offset, NULL/*offset, opcode*/); + md_number_to_chars (to, inst.instruction, THUMB_SIZE); +} + +/* Write a 32-bit thumb instruction to buf. */ +static void +put_thumb32_insn (char * buf, unsigned long insn) +{ + md_number_to_chars (buf, insn >> 16, THUMB_SIZE); + md_number_to_chars (buf + THUMB_SIZE, insn, THUMB_SIZE); +} + +static void +output_inst (const char * str) +{ + char * to = NULL; + + if (inst.error) + { + as_bad ("%s -- `%s'", inst.error, str); + return; } + if (inst.relax) { + output_relax_insn(); + return; + } + if (inst.size == 0) + return; + + to = frag_more (inst.size); + + if (thumb_mode && (inst.size > THUMB_SIZE)) + { + assert (inst.size == (2 * THUMB_SIZE)); + put_thumb32_insn (to, inst.instruction); + } + else if (inst.size > INSN_SIZE) + { + assert (inst.size == (2 * INSN_SIZE)); + md_number_to_chars (to, inst.instruction, INSN_SIZE); + md_number_to_chars (to + INSN_SIZE, inst.instruction, INSN_SIZE); + } + else + md_number_to_chars (to, inst.instruction, inst.size); + + if (inst.reloc.type != BFD_RELOC_UNUSED) + fix_new_arm (frag_now, to - frag_now->fr_literal, + inst.size, & inst.reloc.exp, inst.reloc.pc_rel, + inst.reloc.type); + +#ifdef OBJ_ELF + dwarf2_emit_insn (inst.size); +#endif +} + +/* Tag values used in struct asm_opcode's tag field. */ +enum opcode_tag +{ + OT_unconditional, /* Instruction cannot be conditionalized. + The ARM condition field is still 0xE. */ + OT_unconditionalF, /* Instruction cannot be conditionalized + and carries 0xF in its ARM condition field. */ + OT_csuffix, /* Instruction takes a conditional suffix. */ + OT_cinfix3, /* Instruction takes a conditional infix, + beginning at character index 3. (In + unified mode, it becomes a suffix.) */ + OT_cinfix3_legacy, /* Legacy instruction takes a conditional infix at + character index 3, even in unified mode. Used for + legacy instructions where suffix and infix forms + may be ambiguous. */ + OT_csuf_or_in3, /* Instruction takes either a conditional + suffix or an infix at character index 3. */ + OT_odd_infix_unc, /* This is the unconditional variant of an + instruction that takes a conditional infix + at an unusual position. In unified mode, + this variant will accept a suffix. */ + OT_odd_infix_0 /* Values greater than or equal to OT_odd_infix_0 + are the conditional variants of instructions that + take conditional infixes in unusual positions. + The infix appears at character index + (tag - OT_odd_infix_0). These are not accepted + in unified mode. */ +}; + +/* Subroutine of md_assemble, responsible for looking up the primary + opcode from the mnemonic the user wrote. STR points to the + beginning of the mnemonic. + + This is not simply a hash table lookup, because of conditional + variants. Most instructions have conditional variants, which are + expressed with a _conditional affix_ to the mnemonic. If we were + to encode each conditional variant as a literal string in the opcode + table, it would have approximately 20,000 entries. + + Most mnemonics take this affix as a suffix, and in unified syntax, + 'most' is upgraded to 'all'. However, in the divided syntax, some + instructions take the affix as an infix, notably the s-variants of + the arithmetic instructions. Of those instructions, all but six + have the infix appear after the third character of the mnemonic. + + Accordingly, the algorithm for looking up primary opcodes given + an identifier is: + + 1. Look up the identifier in the opcode table. + If we find a match, go to step U. + + 2. Look up the last two characters of the identifier in the + conditions table. If we find a match, look up the first N-2 + characters of the identifier in the opcode table. If we + find a match, go to step CE. + + 3. Look up the fourth and fifth characters of the identifier in + the conditions table. If we find a match, extract those + characters from the identifier, and look up the remaining + characters in the opcode table. If we find a match, go + to step CM. + + 4. Fail. + + U. Examine the tag field of the opcode structure, in case this is + one of the six instructions with its conditional infix in an + unusual place. If it is, the tag tells us where to find the + infix; look it up in the conditions table and set inst.cond + accordingly. Otherwise, this is an unconditional instruction. + Again set inst.cond accordingly. Return the opcode structure. + + CE. Examine the tag field to make sure this is an instruction that + should receive a conditional suffix. If it is not, fail. + Otherwise, set inst.cond from the suffix we already looked up, + and return the opcode structure. + + CM. Examine the tag field to make sure this is an instruction that + should receive a conditional infix after the third character. + If it is not, fail. Otherwise, undo the edits to the current + line of input and proceed as for case CE. */ + +static const struct asm_opcode * +opcode_lookup (char **str) +{ + char *end, *base; + char *affix; + const struct asm_opcode *opcode; + const struct asm_cond *cond; + char save[2]; + + /* Scan up to the end of the mnemonic, which must end in white space, + '.' (in unified mode only), or end of string. */ + for (base = end = *str; *end != '\0'; end++) + if (*end == ' ' || (unified_syntax && *end == '.')) + break; + + if (end == base) + return 0; + + /* Handle a possible width suffix. */ + if (end[0] == '.') + { + if (end[1] == 'w' && (end[2] == ' ' || end[2] == '\0')) + inst.size_req = 4; + else if (end[1] == 'n' && (end[2] == ' ' || end[2] == '\0')) + inst.size_req = 2; + else + return 0; + + *str = end + 2; + } + else + *str = end; + + /* Look for unaffixed or special-case affixed mnemonic. */ + opcode = hash_find_n (arm_ops_hsh, base, end - base); + if (opcode) + { + /* step U */ + if (opcode->tag < OT_odd_infix_0) + { + inst.cond = COND_ALWAYS; + return opcode; + } + + if (unified_syntax) + as_warn (_("conditional infixes are deprecated in unified syntax")); + affix = base + (opcode->tag - OT_odd_infix_0); + cond = hash_find_n (arm_cond_hsh, affix, 2); + assert (cond); + + inst.cond = cond->value; + return opcode; + } + + /* Cannot have a conditional suffix on a mnemonic of less than two + characters. */ + if (end - base < 3) + return 0; + + /* Look for suffixed mnemonic. */ + affix = end - 2; + cond = hash_find_n (arm_cond_hsh, affix, 2); + opcode = hash_find_n (arm_ops_hsh, base, affix - base); + if (opcode && cond) + { + /* step CE */ + switch (opcode->tag) + { + case OT_cinfix3_legacy: + /* Ignore conditional suffixes matched on infix only mnemonics. */ + break; + + case OT_cinfix3: + case OT_odd_infix_unc: + if (!unified_syntax) + return 0; + /* else fall through */ + + case OT_csuffix: + case OT_csuf_or_in3: + inst.cond = cond->value; + return opcode; + + case OT_unconditional: + case OT_unconditionalF: + if (thumb_mode) + { + inst.cond = cond->value; + } + else + { + /* delayed diagnostic */ + inst.error = BAD_COND; + inst.cond = COND_ALWAYS; + } + return opcode; + + default: + return 0; + } + } + + /* Cannot have a usual-position infix on a mnemonic of less than + six characters (five would be a suffix). */ + if (end - base < 6) + return 0; + + /* Look for infixed mnemonic in the usual position. */ + affix = base + 3; + cond = hash_find_n (arm_cond_hsh, affix, 2); + if (!cond) + return 0; + + memcpy (save, affix, 2); + memmove (affix, affix + 2, (end - affix) - 2); + opcode = hash_find_n (arm_ops_hsh, base, (end - base) - 2); + memmove (affix + 2, affix, (end - affix) - 2); + memcpy (affix, save, 2); + + if (opcode && (opcode->tag == OT_cinfix3 || opcode->tag == OT_csuf_or_in3 + || opcode->tag == OT_cinfix3_legacy)) + { + /* step CM */ + if (unified_syntax && opcode->tag == OT_cinfix3) + as_warn (_("conditional infixes are deprecated in unified syntax")); + + inst.cond = cond->value; + return opcode; + } + + return 0; } void -arm_start_line_hook () +md_assemble (char *str) +{ + char *p = str; + const struct asm_opcode * opcode; + + /* Align the previous label if needed. */ + if (last_label_seen != NULL) + { + symbol_set_frag (last_label_seen, frag_now); + S_SET_VALUE (last_label_seen, (valueT) frag_now_fix ()); + S_SET_SEGMENT (last_label_seen, now_seg); + } + + memset (&inst, '\0', sizeof (inst)); + inst.reloc.type = BFD_RELOC_UNUSED; + + opcode = opcode_lookup (&p); + if (!opcode) + { + /* It wasn't an instruction, but it might be a register alias of + the form alias .req reg. */ + if (!create_register_alias (str, p)) + as_bad (_("bad instruction `%s'"), str); + + return; + } + + if (thumb_mode) + { + arm_feature_set variant; + + variant = cpu_variant; + /* Only allow coprocessor instructions on Thumb-2 capable devices. */ + if (!ARM_CPU_HAS_FEATURE (variant, arm_arch_t2)) + ARM_CLEAR_FEATURE (variant, variant, fpu_any_hard); + /* Check that this instruction is supported for this CPU. */ + if (!opcode->tvariant + || (thumb_mode == 1 + && !ARM_CPU_HAS_FEATURE (variant, *opcode->tvariant))) + { + as_bad (_("selected processor does not support `%s'"), str); + return; + } + if (inst.cond != COND_ALWAYS && !unified_syntax + && opcode->tencode != do_t_branch) + { + as_bad (_("Thumb does not support conditional execution")); + return; + } + + /* Check conditional suffixes. */ + if (current_it_mask) + { + int cond; + cond = current_cc ^ ((current_it_mask >> 4) & 1) ^ 1; + current_it_mask <<= 1; + current_it_mask &= 0x1f; + /* The BKPT instruction is unconditional even in an IT block. */ + if (!inst.error + && cond != inst.cond && opcode->tencode != do_t_bkpt) + { + as_bad (_("incorrect condition in IT block")); + return; + } + } + else if (inst.cond != COND_ALWAYS && opcode->tencode != do_t_branch) + { + as_bad (_("thumb conditional instrunction not in IT block")); + return; + } + + mapping_state (MAP_THUMB); + inst.instruction = opcode->tvalue; + + if (!parse_operands (p, opcode->operands)) + opcode->tencode (); + + /* Clear current_it_mask at the end of an IT block. */ + if (current_it_mask == 0x10) + current_it_mask = 0; + + if (!(inst.error || inst.relax)) + { + assert (inst.instruction < 0xe800 || inst.instruction > 0xffff); + inst.size = (inst.instruction > 0xffff ? 4 : 2); + if (inst.size_req && inst.size_req != inst.size) + { + as_bad (_("cannot honor width suffix -- `%s'"), str); + return; + } + } + ARM_MERGE_FEATURE_SETS (thumb_arch_used, thumb_arch_used, + *opcode->tvariant); + /* Many Thumb-2 instructions also have Thumb-1 variants, so explicitly + set those bits when Thumb-2 32-bit instuctions are seen. ie. + anything other than bl/blx. + This is overly pessimistic for relaxable instructions. */ + if ((inst.size == 4 && (inst.instruction & 0xf800e800) != 0xf000e800) + || inst.relax) + ARM_MERGE_FEATURE_SETS (thumb_arch_used, thumb_arch_used, + arm_ext_v6t2); + } + else + { + /* Check that this instruction is supported for this CPU. */ + if (!opcode->avariant || + !ARM_CPU_HAS_FEATURE (cpu_variant, *opcode->avariant)) + { + as_bad (_("selected processor does not support `%s'"), str); + return; + } + if (inst.size_req) + { + as_bad (_("width suffixes are invalid in ARM mode -- `%s'"), str); + return; + } + + mapping_state (MAP_ARM); + inst.instruction = opcode->avalue; + if (opcode->tag == OT_unconditionalF) + inst.instruction |= 0xF << 28; + else + inst.instruction |= inst.cond << 28; + inst.size = INSN_SIZE; + if (!parse_operands (p, opcode->operands)) + opcode->aencode (); + /* Arm mode bx is marked as both v4T and v5 because it's still required + on a hypothetical non-thumb v5 core. */ + if (ARM_CPU_HAS_FEATURE (*opcode->avariant, arm_ext_v4t) + || ARM_CPU_HAS_FEATURE (*opcode->avariant, arm_ext_v5)) + ARM_MERGE_FEATURE_SETS (arm_arch_used, arm_arch_used, arm_ext_v4t); + else + ARM_MERGE_FEATURE_SETS (arm_arch_used, arm_arch_used, + *opcode->avariant); + } + output_inst (str); +} + +/* Various frobbings of labels and their addresses. */ + +void +arm_start_line_hook (void) { last_label_seen = NULL; } void -arm_frob_label (sym) - symbolS * sym; +arm_frob_label (symbolS * sym) { last_label_seen = sym; @@ -13836,19 +8497,19 @@ arm_frob_label (sym) /* Note - do not allow local symbols (.Lxxx) to be labeled as Thumb functions. This is because these labels, whilst they exist inside Thumb code, are not the entry points for - possible ARM->Thumb calls. Also, these labels can be used + possible ARM->Thumb calls. Also, these labels can be used as part of a computed goto or switch statement. eg gcc can generate code that looks like this: - ldr r2, [pc, .Laaa] - lsl r3, r3, #2 - ldr r2, [r3, r2] - mov pc, r2 + ldr r2, [pc, .Laaa] + lsl r3, r3, #2 + ldr r2, [r3, r2] + mov pc, r2 .Lbbb: .word .Lxxx .Lccc: .word .Lyyy ..etc... - .Laaa: .word Lbbb + .Laaa: .word Lbbb The first instruction loads the address of the jump table. The second instruction converts a table index into a byte offset. @@ -13875,83 +8536,14 @@ arm_frob_label (sym) label_is_thumb_function_name = FALSE; } -} -/* Adjust the symbol table. This marks Thumb symbols as distinct from - ARM ones. */ - -void -arm_adjust_symtab () -{ -#ifdef OBJ_COFF - symbolS * sym; - - for (sym = symbol_rootP; sym != NULL; sym = symbol_next (sym)) - { - if (ARM_IS_THUMB (sym)) - { - if (THUMB_IS_FUNC (sym)) - { - /* Mark the symbol as a Thumb function. */ - if ( S_GET_STORAGE_CLASS (sym) == C_STAT - || S_GET_STORAGE_CLASS (sym) == C_LABEL) /* This can happen! */ - S_SET_STORAGE_CLASS (sym, C_THUMBSTATFUNC); - - else if (S_GET_STORAGE_CLASS (sym) == C_EXT) - S_SET_STORAGE_CLASS (sym, C_THUMBEXTFUNC); - else - as_bad (_("%s: unexpected function type: %d"), - S_GET_NAME (sym), S_GET_STORAGE_CLASS (sym)); - } - else switch (S_GET_STORAGE_CLASS (sym)) - { - case C_EXT: - S_SET_STORAGE_CLASS (sym, C_THUMBEXT); - break; - case C_STAT: - S_SET_STORAGE_CLASS (sym, C_THUMBSTAT); - break; - case C_LABEL: - S_SET_STORAGE_CLASS (sym, C_THUMBLABEL); - break; - default: - /* Do nothing. */ - break; - } - } - - if (ARM_IS_INTERWORK (sym)) - coffsymbol (symbol_get_bfdsym (sym))->native->u.syment.n_flags = 0xFF; - } -#endif #ifdef OBJ_ELF - symbolS * sym; - char bind; - - for (sym = symbol_rootP; sym != NULL; sym = symbol_next (sym)) - { - if (ARM_IS_THUMB (sym)) - { - elf_symbol_type * elf_sym; - - elf_sym = elf_symbol (symbol_get_bfdsym (sym)); - bind = ELF_ST_BIND (elf_sym); - - /* If it's a .thumb_func, declare it as so, - otherwise tag label as .code 16. */ - if (THUMB_IS_FUNC (sym)) - elf_sym->internal_elf_sym.st_info = - ELF_ST_INFO (bind, STT_ARM_TFUNC); - else - elf_sym->internal_elf_sym.st_info = - ELF_ST_INFO (bind, STT_ARM_16BIT); - } - } + dwarf2_emit_label (sym); #endif } int -arm_data_in_code () +arm_data_in_code (void) { if (thumb_mode && ! strncmp (input_line_pointer + 1, "data:", 5)) { @@ -13965,8 +8557,7 @@ arm_data_in_code () } char * -arm_canonicalize_symbol_name (name) - char * name; +arm_canonicalize_symbol_name (char * name) { int len; @@ -13976,236 +8567,2088 @@ arm_canonicalize_symbol_name (name) return name; } + +/* Table of all register names defined by default. The user can + define additional names with .req. Note that all register names + should appear in both upper and lowercase variants. Some registers + also have mixed-case names. */ + +#define REGDEF(s,n,t) { #s, n, REG_TYPE_##t, TRUE } +#define REGNUM(p,n,t) REGDEF(p##n, n, t) +#define REGSET(p,t) \ + REGNUM(p, 0,t), REGNUM(p, 1,t), REGNUM(p, 2,t), REGNUM(p, 3,t), \ + REGNUM(p, 4,t), REGNUM(p, 5,t), REGNUM(p, 6,t), REGNUM(p, 7,t), \ + REGNUM(p, 8,t), REGNUM(p, 9,t), REGNUM(p,10,t), REGNUM(p,11,t), \ + REGNUM(p,12,t), REGNUM(p,13,t), REGNUM(p,14,t), REGNUM(p,15,t) + +static const struct reg_entry reg_names[] = +{ + /* ARM integer registers. */ + REGSET(r, RN), REGSET(R, RN), + + /* ATPCS synonyms. */ + REGDEF(a1,0,RN), REGDEF(a2,1,RN), REGDEF(a3, 2,RN), REGDEF(a4, 3,RN), + REGDEF(v1,4,RN), REGDEF(v2,5,RN), REGDEF(v3, 6,RN), REGDEF(v4, 7,RN), + REGDEF(v5,8,RN), REGDEF(v6,9,RN), REGDEF(v7,10,RN), REGDEF(v8,11,RN), + + REGDEF(A1,0,RN), REGDEF(A2,1,RN), REGDEF(A3, 2,RN), REGDEF(A4, 3,RN), + REGDEF(V1,4,RN), REGDEF(V2,5,RN), REGDEF(V3, 6,RN), REGDEF(V4, 7,RN), + REGDEF(V5,8,RN), REGDEF(V6,9,RN), REGDEF(V7,10,RN), REGDEF(V8,11,RN), + + /* Well-known aliases. */ + REGDEF(wr, 7,RN), REGDEF(sb, 9,RN), REGDEF(sl,10,RN), REGDEF(fp,11,RN), + REGDEF(ip,12,RN), REGDEF(sp,13,RN), REGDEF(lr,14,RN), REGDEF(pc,15,RN), + + REGDEF(WR, 7,RN), REGDEF(SB, 9,RN), REGDEF(SL,10,RN), REGDEF(FP,11,RN), + REGDEF(IP,12,RN), REGDEF(SP,13,RN), REGDEF(LR,14,RN), REGDEF(PC,15,RN), + + /* Coprocessor numbers. */ + REGSET(p, CP), REGSET(P, CP), + + /* Coprocessor register numbers. The "cr" variants are for backward + compatibility. */ + REGSET(c, CN), REGSET(C, CN), + REGSET(cr, CN), REGSET(CR, CN), + + /* FPA registers. */ + REGNUM(f,0,FN), REGNUM(f,1,FN), REGNUM(f,2,FN), REGNUM(f,3,FN), + REGNUM(f,4,FN), REGNUM(f,5,FN), REGNUM(f,6,FN), REGNUM(f,7, FN), + + REGNUM(F,0,FN), REGNUM(F,1,FN), REGNUM(F,2,FN), REGNUM(F,3,FN), + REGNUM(F,4,FN), REGNUM(F,5,FN), REGNUM(F,6,FN), REGNUM(F,7, FN), + + /* VFP SP registers. */ + REGSET(s,VFS), + REGNUM(s,16,VFS), REGNUM(s,17,VFS), REGNUM(s,18,VFS), REGNUM(s,19,VFS), + REGNUM(s,20,VFS), REGNUM(s,21,VFS), REGNUM(s,22,VFS), REGNUM(s,23,VFS), + REGNUM(s,24,VFS), REGNUM(s,25,VFS), REGNUM(s,26,VFS), REGNUM(s,27,VFS), + REGNUM(s,28,VFS), REGNUM(s,29,VFS), REGNUM(s,30,VFS), REGNUM(s,31,VFS), + + REGSET(S,VFS), + REGNUM(S,16,VFS), REGNUM(S,17,VFS), REGNUM(S,18,VFS), REGNUM(S,19,VFS), + REGNUM(S,20,VFS), REGNUM(S,21,VFS), REGNUM(S,22,VFS), REGNUM(S,23,VFS), + REGNUM(S,24,VFS), REGNUM(S,25,VFS), REGNUM(S,26,VFS), REGNUM(S,27,VFS), + REGNUM(S,28,VFS), REGNUM(S,29,VFS), REGNUM(S,30,VFS), REGNUM(S,31,VFS), + + /* VFP DP Registers. */ + REGSET(d,VFD), REGSET(D,VFS), + + /* VFP control registers. */ + REGDEF(fpsid,0,VFC), REGDEF(fpscr,1,VFC), REGDEF(fpexc,8,VFC), + REGDEF(FPSID,0,VFC), REGDEF(FPSCR,1,VFC), REGDEF(FPEXC,8,VFC), + + /* Maverick DSP coprocessor registers. */ + REGSET(mvf,MVF), REGSET(mvd,MVD), REGSET(mvfx,MVFX), REGSET(mvdx,MVDX), + REGSET(MVF,MVF), REGSET(MVD,MVD), REGSET(MVFX,MVFX), REGSET(MVDX,MVDX), + + REGNUM(mvax,0,MVAX), REGNUM(mvax,1,MVAX), + REGNUM(mvax,2,MVAX), REGNUM(mvax,3,MVAX), + REGDEF(dspsc,0,DSPSC), + + REGNUM(MVAX,0,MVAX), REGNUM(MVAX,1,MVAX), + REGNUM(MVAX,2,MVAX), REGNUM(MVAX,3,MVAX), + REGDEF(DSPSC,0,DSPSC), + + /* iWMMXt data registers - p0, c0-15. */ + REGSET(wr,MMXWR), REGSET(wR,MMXWR), REGSET(WR, MMXWR), + + /* iWMMXt control registers - p1, c0-3. */ + REGDEF(wcid, 0,MMXWC), REGDEF(wCID, 0,MMXWC), REGDEF(WCID, 0,MMXWC), + REGDEF(wcon, 1,MMXWC), REGDEF(wCon, 1,MMXWC), REGDEF(WCON, 1,MMXWC), + REGDEF(wcssf, 2,MMXWC), REGDEF(wCSSF, 2,MMXWC), REGDEF(WCSSF, 2,MMXWC), + REGDEF(wcasf, 3,MMXWC), REGDEF(wCASF, 3,MMXWC), REGDEF(WCASF, 3,MMXWC), + + /* iWMMXt scalar (constant/offset) registers - p1, c8-11. */ + REGDEF(wcgr0, 8,MMXWCG), REGDEF(wCGR0, 8,MMXWCG), REGDEF(WCGR0, 8,MMXWCG), + REGDEF(wcgr1, 9,MMXWCG), REGDEF(wCGR1, 9,MMXWCG), REGDEF(WCGR1, 9,MMXWCG), + REGDEF(wcgr2,10,MMXWCG), REGDEF(wCGR2,10,MMXWCG), REGDEF(WCGR2,10,MMXWCG), + REGDEF(wcgr3,11,MMXWCG), REGDEF(wCGR3,11,MMXWCG), REGDEF(WCGR3,11,MMXWCG), + + /* XScale accumulator registers. */ + REGNUM(acc,0,XSCALE), REGNUM(ACC,0,XSCALE), +}; +#undef REGDEF +#undef REGNUM +#undef REGSET + +/* Table of all PSR suffixes. Bare "CPSR" and "SPSR" are handled + within psr_required_here. */ +static const struct asm_psr psrs[] = +{ + /* Backward compatibility notation. Note that "all" is no longer + truly all possible PSR bits. */ + {"all", PSR_c | PSR_f}, + {"flg", PSR_f}, + {"ctl", PSR_c}, + + /* Individual flags. */ + {"f", PSR_f}, + {"c", PSR_c}, + {"x", PSR_x}, + {"s", PSR_s}, + /* Combinations of flags. */ + {"fs", PSR_f | PSR_s}, + {"fx", PSR_f | PSR_x}, + {"fc", PSR_f | PSR_c}, + {"sf", PSR_s | PSR_f}, + {"sx", PSR_s | PSR_x}, + {"sc", PSR_s | PSR_c}, + {"xf", PSR_x | PSR_f}, + {"xs", PSR_x | PSR_s}, + {"xc", PSR_x | PSR_c}, + {"cf", PSR_c | PSR_f}, + {"cs", PSR_c | PSR_s}, + {"cx", PSR_c | PSR_x}, + {"fsx", PSR_f | PSR_s | PSR_x}, + {"fsc", PSR_f | PSR_s | PSR_c}, + {"fxs", PSR_f | PSR_x | PSR_s}, + {"fxc", PSR_f | PSR_x | PSR_c}, + {"fcs", PSR_f | PSR_c | PSR_s}, + {"fcx", PSR_f | PSR_c | PSR_x}, + {"sfx", PSR_s | PSR_f | PSR_x}, + {"sfc", PSR_s | PSR_f | PSR_c}, + {"sxf", PSR_s | PSR_x | PSR_f}, + {"sxc", PSR_s | PSR_x | PSR_c}, + {"scf", PSR_s | PSR_c | PSR_f}, + {"scx", PSR_s | PSR_c | PSR_x}, + {"xfs", PSR_x | PSR_f | PSR_s}, + {"xfc", PSR_x | PSR_f | PSR_c}, + {"xsf", PSR_x | PSR_s | PSR_f}, + {"xsc", PSR_x | PSR_s | PSR_c}, + {"xcf", PSR_x | PSR_c | PSR_f}, + {"xcs", PSR_x | PSR_c | PSR_s}, + {"cfs", PSR_c | PSR_f | PSR_s}, + {"cfx", PSR_c | PSR_f | PSR_x}, + {"csf", PSR_c | PSR_s | PSR_f}, + {"csx", PSR_c | PSR_s | PSR_x}, + {"cxf", PSR_c | PSR_x | PSR_f}, + {"cxs", PSR_c | PSR_x | PSR_s}, + {"fsxc", PSR_f | PSR_s | PSR_x | PSR_c}, + {"fscx", PSR_f | PSR_s | PSR_c | PSR_x}, + {"fxsc", PSR_f | PSR_x | PSR_s | PSR_c}, + {"fxcs", PSR_f | PSR_x | PSR_c | PSR_s}, + {"fcsx", PSR_f | PSR_c | PSR_s | PSR_x}, + {"fcxs", PSR_f | PSR_c | PSR_x | PSR_s}, + {"sfxc", PSR_s | PSR_f | PSR_x | PSR_c}, + {"sfcx", PSR_s | PSR_f | PSR_c | PSR_x}, + {"sxfc", PSR_s | PSR_x | PSR_f | PSR_c}, + {"sxcf", PSR_s | PSR_x | PSR_c | PSR_f}, + {"scfx", PSR_s | PSR_c | PSR_f | PSR_x}, + {"scxf", PSR_s | PSR_c | PSR_x | PSR_f}, + {"xfsc", PSR_x | PSR_f | PSR_s | PSR_c}, + {"xfcs", PSR_x | PSR_f | PSR_c | PSR_s}, + {"xsfc", PSR_x | PSR_s | PSR_f | PSR_c}, + {"xscf", PSR_x | PSR_s | PSR_c | PSR_f}, + {"xcfs", PSR_x | PSR_c | PSR_f | PSR_s}, + {"xcsf", PSR_x | PSR_c | PSR_s | PSR_f}, + {"cfsx", PSR_c | PSR_f | PSR_s | PSR_x}, + {"cfxs", PSR_c | PSR_f | PSR_x | PSR_s}, + {"csfx", PSR_c | PSR_s | PSR_f | PSR_x}, + {"csxf", PSR_c | PSR_s | PSR_x | PSR_f}, + {"cxfs", PSR_c | PSR_x | PSR_f | PSR_s}, + {"cxsf", PSR_c | PSR_x | PSR_s | PSR_f}, +}; + +/* Table of V7M psr names. */ +static const struct asm_psr v7m_psrs[] = +{ + {"apsr", 0 }, + {"iapsr", 1 }, + {"eapsr", 2 }, + {"psr", 3 }, + {"ipsr", 5 }, + {"epsr", 6 }, + {"iepsr", 7 }, + {"msp", 8 }, + {"psp", 9 }, + {"primask", 16}, + {"basepri", 17}, + {"basepri_max", 18}, + {"faultmask", 19}, + {"control", 20} +}; + +/* Table of all shift-in-operand names. */ +static const struct asm_shift_name shift_names [] = +{ + { "asl", SHIFT_LSL }, { "ASL", SHIFT_LSL }, + { "lsl", SHIFT_LSL }, { "LSL", SHIFT_LSL }, + { "lsr", SHIFT_LSR }, { "LSR", SHIFT_LSR }, + { "asr", SHIFT_ASR }, { "ASR", SHIFT_ASR }, + { "ror", SHIFT_ROR }, { "ROR", SHIFT_ROR }, + { "rrx", SHIFT_RRX }, { "RRX", SHIFT_RRX } +}; + +/* Table of all explicit relocation names. */ +#ifdef OBJ_ELF +static struct reloc_entry reloc_names[] = +{ + { "got", BFD_RELOC_ARM_GOT32 }, { "GOT", BFD_RELOC_ARM_GOT32 }, + { "gotoff", BFD_RELOC_ARM_GOTOFF }, { "GOTOFF", BFD_RELOC_ARM_GOTOFF }, + { "plt", BFD_RELOC_ARM_PLT32 }, { "PLT", BFD_RELOC_ARM_PLT32 }, + { "target1", BFD_RELOC_ARM_TARGET1 }, { "TARGET1", BFD_RELOC_ARM_TARGET1 }, + { "target2", BFD_RELOC_ARM_TARGET2 }, { "TARGET2", BFD_RELOC_ARM_TARGET2 }, + { "sbrel", BFD_RELOC_ARM_SBREL32 }, { "SBREL", BFD_RELOC_ARM_SBREL32 }, + { "tlsgd", BFD_RELOC_ARM_TLS_GD32}, { "TLSGD", BFD_RELOC_ARM_TLS_GD32}, + { "tlsldm", BFD_RELOC_ARM_TLS_LDM32}, { "TLSLDM", BFD_RELOC_ARM_TLS_LDM32}, + { "tlsldo", BFD_RELOC_ARM_TLS_LDO32}, { "TLSLDO", BFD_RELOC_ARM_TLS_LDO32}, + { "gottpoff",BFD_RELOC_ARM_TLS_IE32}, { "GOTTPOFF",BFD_RELOC_ARM_TLS_IE32}, + { "tpoff", BFD_RELOC_ARM_TLS_LE32}, { "TPOFF", BFD_RELOC_ARM_TLS_LE32} +}; +#endif + +/* Table of all conditional affixes. 0xF is not defined as a condition code. */ +static const struct asm_cond conds[] = +{ + {"eq", 0x0}, + {"ne", 0x1}, + {"cs", 0x2}, {"hs", 0x2}, + {"cc", 0x3}, {"ul", 0x3}, {"lo", 0x3}, + {"mi", 0x4}, + {"pl", 0x5}, + {"vs", 0x6}, + {"vc", 0x7}, + {"hi", 0x8}, + {"ls", 0x9}, + {"ge", 0xa}, + {"lt", 0xb}, + {"gt", 0xc}, + {"le", 0xd}, + {"al", 0xe} +}; + +static struct asm_barrier_opt barrier_opt_names[] = +{ + { "sy", 0xf }, + { "un", 0x7 }, + { "st", 0xe }, + { "unst", 0x6 } +}; + +/* Table of ARM-format instructions. */ + +/* Macros for gluing together operand strings. N.B. In all cases + other than OPS0, the trailing OP_stop comes from default + zero-initialization of the unspecified elements of the array. */ +#define OPS0() { OP_stop, } +#define OPS1(a) { OP_##a, } +#define OPS2(a,b) { OP_##a,OP_##b, } +#define OPS3(a,b,c) { OP_##a,OP_##b,OP_##c, } +#define OPS4(a,b,c,d) { OP_##a,OP_##b,OP_##c,OP_##d, } +#define OPS5(a,b,c,d,e) { OP_##a,OP_##b,OP_##c,OP_##d,OP_##e, } +#define OPS6(a,b,c,d,e,f) { OP_##a,OP_##b,OP_##c,OP_##d,OP_##e,OP_##f, } + +/* These macros abstract out the exact format of the mnemonic table and + save some repeated characters. */ + +/* The normal sort of mnemonic; has a Thumb variant; takes a conditional suffix. */ +#define TxCE(mnem, op, top, nops, ops, ae, te) \ + { #mnem, OPS##nops ops, OT_csuffix, 0x##op, top, ARM_VARIANT, \ + THUMB_VARIANT, do_##ae, do_##te } + +/* Two variants of the above - TCE for a numeric Thumb opcode, tCE for + a T_MNEM_xyz enumerator. */ +#define TCE(mnem, aop, top, nops, ops, ae, te) \ + TxCE(mnem, aop, 0x##top, nops, ops, ae, te) +#define tCE(mnem, aop, top, nops, ops, ae, te) \ + TxCE(mnem, aop, T_MNEM_##top, nops, ops, ae, te) + +/* Second most common sort of mnemonic: has a Thumb variant, takes a conditional + infix after the third character. */ +#define TxC3(mnem, op, top, nops, ops, ae, te) \ + { #mnem, OPS##nops ops, OT_cinfix3, 0x##op, top, ARM_VARIANT, \ + THUMB_VARIANT, do_##ae, do_##te } +#define TC3(mnem, aop, top, nops, ops, ae, te) \ + TxC3(mnem, aop, 0x##top, nops, ops, ae, te) +#define tC3(mnem, aop, top, nops, ops, ae, te) \ + TxC3(mnem, aop, T_MNEM_##top, nops, ops, ae, te) + +/* Mnemonic with a conditional infix in an unusual place. Each and every variant has to + appear in the condition table. */ +#define TxCM_(m1, m2, m3, op, top, nops, ops, ae, te) \ + { #m1 #m2 #m3, OPS##nops ops, sizeof(#m2) == 1 ? OT_odd_infix_unc : OT_odd_infix_0 + sizeof(#m1) - 1, \ + 0x##op, top, ARM_VARIANT, THUMB_VARIANT, do_##ae, do_##te } + +#define TxCM(m1, m2, op, top, nops, ops, ae, te) \ + TxCM_(m1, , m2, op, top, nops, ops, ae, te), \ + TxCM_(m1, eq, m2, op, top, nops, ops, ae, te), \ + TxCM_(m1, ne, m2, op, top, nops, ops, ae, te), \ + TxCM_(m1, cs, m2, op, top, nops, ops, ae, te), \ + TxCM_(m1, hs, m2, op, top, nops, ops, ae, te), \ + TxCM_(m1, cc, m2, op, top, nops, ops, ae, te), \ + TxCM_(m1, ul, m2, op, top, nops, ops, ae, te), \ + TxCM_(m1, lo, m2, op, top, nops, ops, ae, te), \ + TxCM_(m1, mi, m2, op, top, nops, ops, ae, te), \ + TxCM_(m1, pl, m2, op, top, nops, ops, ae, te), \ + TxCM_(m1, vs, m2, op, top, nops, ops, ae, te), \ + TxCM_(m1, vc, m2, op, top, nops, ops, ae, te), \ + TxCM_(m1, hi, m2, op, top, nops, ops, ae, te), \ + TxCM_(m1, ls, m2, op, top, nops, ops, ae, te), \ + TxCM_(m1, ge, m2, op, top, nops, ops, ae, te), \ + TxCM_(m1, lt, m2, op, top, nops, ops, ae, te), \ + TxCM_(m1, gt, m2, op, top, nops, ops, ae, te), \ + TxCM_(m1, le, m2, op, top, nops, ops, ae, te), \ + TxCM_(m1, al, m2, op, top, nops, ops, ae, te) + +#define TCM(m1,m2, aop, top, nops, ops, ae, te) \ + TxCM(m1,m2, aop, 0x##top, nops, ops, ae, te) +#define tCM(m1,m2, aop, top, nops, ops, ae, te) \ + TxCM(m1,m2, aop, T_MNEM_##top, nops, ops, ae, te) + +/* Mnemonic that cannot be conditionalized. The ARM condition-code + field is still 0xE. Many of the Thumb variants can be executed + conditionally, so this is checked separately. */ +#define TUE(mnem, op, top, nops, ops, ae, te) \ + { #mnem, OPS##nops ops, OT_unconditional, 0x##op, 0x##top, ARM_VARIANT, \ + THUMB_VARIANT, do_##ae, do_##te } + +/* Mnemonic that cannot be conditionalized, and bears 0xF in its ARM + condition code field. */ +#define TUF(mnem, op, top, nops, ops, ae, te) \ + { #mnem, OPS##nops ops, OT_unconditionalF, 0x##op, 0x##top, ARM_VARIANT, \ + THUMB_VARIANT, do_##ae, do_##te } + +/* ARM-only variants of all the above. */ +#define CE(mnem, op, nops, ops, ae) \ + { #mnem, OPS##nops ops, OT_csuffix, 0x##op, 0x0, ARM_VARIANT, 0, do_##ae, NULL } + +#define C3(mnem, op, nops, ops, ae) \ + { #mnem, OPS##nops ops, OT_cinfix3, 0x##op, 0x0, ARM_VARIANT, 0, do_##ae, NULL } + +/* Legacy mnemonics that always have conditional infix after the third + character. */ +#define CL(mnem, op, nops, ops, ae) \ + { #mnem, OPS##nops ops, OT_cinfix3_legacy, \ + 0x##op, 0x0, ARM_VARIANT, 0, do_##ae, NULL } + +/* Coprocessor instructions. Isomorphic between Arm and Thumb-2. */ +#define cCE(mnem, op, nops, ops, ae) \ + { #mnem, OPS##nops ops, OT_csuffix, 0x##op, 0xe##op, ARM_VARIANT, ARM_VARIANT, do_##ae, do_##ae } + +/* Legacy coprocessor instructions where conditional infix and conditional + suffix are ambiguous. For consistency this includes all FPA instructions, + not just the potentially ambiguous ones. */ +#define cCL(mnem, op, nops, ops, ae) \ + { #mnem, OPS##nops ops, OT_cinfix3_legacy, \ + 0x##op, 0xe##op, ARM_VARIANT, ARM_VARIANT, do_##ae, do_##ae } + +/* Coprocessor, takes either a suffix or a position-3 infix + (for an FPA corner case). */ +#define C3E(mnem, op, nops, ops, ae) \ + { #mnem, OPS##nops ops, OT_csuf_or_in3, \ + 0x##op, 0xe##op, ARM_VARIANT, ARM_VARIANT, do_##ae, do_##ae } + +#define xCM_(m1, m2, m3, op, nops, ops, ae) \ + { #m1 #m2 #m3, OPS##nops ops, \ + sizeof(#m2) == 1 ? OT_odd_infix_unc : OT_odd_infix_0 + sizeof(#m1) - 1, \ + 0x##op, 0x0, ARM_VARIANT, 0, do_##ae, NULL } + +#define CM(m1, m2, op, nops, ops, ae) \ + xCM_(m1, , m2, op, nops, ops, ae), \ + xCM_(m1, eq, m2, op, nops, ops, ae), \ + xCM_(m1, ne, m2, op, nops, ops, ae), \ + xCM_(m1, cs, m2, op, nops, ops, ae), \ + xCM_(m1, hs, m2, op, nops, ops, ae), \ + xCM_(m1, cc, m2, op, nops, ops, ae), \ + xCM_(m1, ul, m2, op, nops, ops, ae), \ + xCM_(m1, lo, m2, op, nops, ops, ae), \ + xCM_(m1, mi, m2, op, nops, ops, ae), \ + xCM_(m1, pl, m2, op, nops, ops, ae), \ + xCM_(m1, vs, m2, op, nops, ops, ae), \ + xCM_(m1, vc, m2, op, nops, ops, ae), \ + xCM_(m1, hi, m2, op, nops, ops, ae), \ + xCM_(m1, ls, m2, op, nops, ops, ae), \ + xCM_(m1, ge, m2, op, nops, ops, ae), \ + xCM_(m1, lt, m2, op, nops, ops, ae), \ + xCM_(m1, gt, m2, op, nops, ops, ae), \ + xCM_(m1, le, m2, op, nops, ops, ae), \ + xCM_(m1, al, m2, op, nops, ops, ae) + +#define UE(mnem, op, nops, ops, ae) \ + { #mnem, OPS##nops ops, OT_unconditional, 0x##op, 0, ARM_VARIANT, 0, do_##ae, NULL } + +#define UF(mnem, op, nops, ops, ae) \ + { #mnem, OPS##nops ops, OT_unconditionalF, 0x##op, 0, ARM_VARIANT, 0, do_##ae, NULL } + +#define do_0 0 + +/* Thumb-only, unconditional. */ +#define UT(mnem, op, nops, ops, te) TUE(mnem, 0, op, nops, ops, 0, te) + +static const struct asm_opcode insns[] = +{ +#define ARM_VARIANT &arm_ext_v1 /* Core ARM Instructions. */ +#define THUMB_VARIANT &arm_ext_v4t + tCE(and, 0000000, and, 3, (RR, oRR, SH), arit, t_arit3c), + tC3(ands, 0100000, ands, 3, (RR, oRR, SH), arit, t_arit3c), + tCE(eor, 0200000, eor, 3, (RR, oRR, SH), arit, t_arit3c), + tC3(eors, 0300000, eors, 3, (RR, oRR, SH), arit, t_arit3c), + tCE(sub, 0400000, sub, 3, (RR, oRR, SH), arit, t_add_sub), + tC3(subs, 0500000, subs, 3, (RR, oRR, SH), arit, t_add_sub), + tCE(add, 0800000, add, 3, (RR, oRR, SH), arit, t_add_sub), + tC3(adds, 0900000, adds, 3, (RR, oRR, SH), arit, t_add_sub), + tCE(adc, 0a00000, adc, 3, (RR, oRR, SH), arit, t_arit3c), + tC3(adcs, 0b00000, adcs, 3, (RR, oRR, SH), arit, t_arit3c), + tCE(sbc, 0c00000, sbc, 3, (RR, oRR, SH), arit, t_arit3), + tC3(sbcs, 0d00000, sbcs, 3, (RR, oRR, SH), arit, t_arit3), + tCE(orr, 1800000, orr, 3, (RR, oRR, SH), arit, t_arit3c), + tC3(orrs, 1900000, orrs, 3, (RR, oRR, SH), arit, t_arit3c), + tCE(bic, 1c00000, bic, 3, (RR, oRR, SH), arit, t_arit3), + tC3(bics, 1d00000, bics, 3, (RR, oRR, SH), arit, t_arit3), + + /* The p-variants of tst/cmp/cmn/teq (below) are the pre-V6 mechanism + for setting PSR flag bits. They are obsolete in V6 and do not + have Thumb equivalents. */ + tCE(tst, 1100000, tst, 2, (RR, SH), cmp, t_mvn_tst), + tC3(tsts, 1100000, tst, 2, (RR, SH), cmp, t_mvn_tst), + CL(tstp, 110f000, 2, (RR, SH), cmp), + tCE(cmp, 1500000, cmp, 2, (RR, SH), cmp, t_mov_cmp), + tC3(cmps, 1500000, cmp, 2, (RR, SH), cmp, t_mov_cmp), + CL(cmpp, 150f000, 2, (RR, SH), cmp), + tCE(cmn, 1700000, cmn, 2, (RR, SH), cmp, t_mvn_tst), + tC3(cmns, 1700000, cmn, 2, (RR, SH), cmp, t_mvn_tst), + CL(cmnp, 170f000, 2, (RR, SH), cmp), + + tCE(mov, 1a00000, mov, 2, (RR, SH), mov, t_mov_cmp), + tC3(movs, 1b00000, movs, 2, (RR, SH), mov, t_mov_cmp), + tCE(mvn, 1e00000, mvn, 2, (RR, SH), mov, t_mvn_tst), + tC3(mvns, 1f00000, mvns, 2, (RR, SH), mov, t_mvn_tst), + + tCE(ldr, 4100000, ldr, 2, (RR, ADDR), ldst, t_ldst), + tC3(ldrb, 4500000, ldrb, 2, (RR, ADDR), ldst, t_ldst), + tCE(str, 4000000, str, 2, (RR, ADDR), ldst, t_ldst), + tC3(strb, 4400000, strb, 2, (RR, ADDR), ldst, t_ldst), + + tCE(stm, 8800000, stmia, 2, (RRw, REGLST), ldmstm, t_ldmstm), + tC3(stmia, 8800000, stmia, 2, (RRw, REGLST), ldmstm, t_ldmstm), + tC3(stmea, 8800000, stmia, 2, (RRw, REGLST), ldmstm, t_ldmstm), + tCE(ldm, 8900000, ldmia, 2, (RRw, REGLST), ldmstm, t_ldmstm), + tC3(ldmia, 8900000, ldmia, 2, (RRw, REGLST), ldmstm, t_ldmstm), + tC3(ldmfd, 8900000, ldmia, 2, (RRw, REGLST), ldmstm, t_ldmstm), + + TCE(swi, f000000, df00, 1, (EXPi), swi, t_swi), + TCE(svc, f000000, df00, 1, (EXPi), swi, t_swi), + tCE(b, a000000, b, 1, (EXPr), branch, t_branch), + TCE(bl, b000000, f000f800, 1, (EXPr), bl, t_branch23), + + /* Pseudo ops. */ + tCE(adr, 28f0000, adr, 2, (RR, EXP), adr, t_adr), + C3(adrl, 28f0000, 2, (RR, EXP), adrl), + tCE(nop, 1a00000, nop, 1, (oI255c), nop, t_nop), + + /* Thumb-compatibility pseudo ops. */ + tCE(lsl, 1a00000, lsl, 3, (RR, oRR, SH), shift, t_shift), + tC3(lsls, 1b00000, lsls, 3, (RR, oRR, SH), shift, t_shift), + tCE(lsr, 1a00020, lsr, 3, (RR, oRR, SH), shift, t_shift), + tC3(lsrs, 1b00020, lsrs, 3, (RR, oRR, SH), shift, t_shift), + tCE(asr, 1a00040, asr, 3, (RR, oRR, SH), shift, t_shift), + tC3(asrs, 1b00040, asrs, 3, (RR, oRR, SH), shift, t_shift), + tCE(ror, 1a00060, ror, 3, (RR, oRR, SH), shift, t_shift), + tC3(rors, 1b00060, rors, 3, (RR, oRR, SH), shift, t_shift), + tCE(neg, 2600000, neg, 2, (RR, RR), rd_rn, t_neg), + tC3(negs, 2700000, negs, 2, (RR, RR), rd_rn, t_neg), + tCE(push, 92d0000, push, 1, (REGLST), push_pop, t_push_pop), + tCE(pop, 8bd0000, pop, 1, (REGLST), push_pop, t_push_pop), + +#undef THUMB_VARIANT +#define THUMB_VARIANT &arm_ext_v6 + TCE(cpy, 1a00000, 4600, 2, (RR, RR), rd_rm, t_cpy), + + /* V1 instructions with no Thumb analogue prior to V6T2. */ +#undef THUMB_VARIANT +#define THUMB_VARIANT &arm_ext_v6t2 + TCE(rsb, 0600000, ebc00000, 3, (RR, oRR, SH), arit, t_rsb), + TC3(rsbs, 0700000, ebd00000, 3, (RR, oRR, SH), arit, t_rsb), + TCE(teq, 1300000, ea900f00, 2, (RR, SH), cmp, t_mvn_tst), + TC3(teqs, 1300000, ea900f00, 2, (RR, SH), cmp, t_mvn_tst), + CL(teqp, 130f000, 2, (RR, SH), cmp), + + TC3(ldrt, 4300000, f8500e00, 2, (RR, ADDR), ldstt, t_ldstt), + TC3(ldrbt, 4700000, f8100e00, 2, (RR, ADDR), ldstt, t_ldstt), + TC3(strt, 4200000, f8400e00, 2, (RR, ADDR), ldstt, t_ldstt), + TC3(strbt, 4600000, f8000e00, 2, (RR, ADDR), ldstt, t_ldstt), + + TC3(stmdb, 9000000, e9000000, 2, (RRw, REGLST), ldmstm, t_ldmstm), + TC3(stmfd, 9000000, e9000000, 2, (RRw, REGLST), ldmstm, t_ldmstm), + + TC3(ldmdb, 9100000, e9100000, 2, (RRw, REGLST), ldmstm, t_ldmstm), + TC3(ldmea, 9100000, e9100000, 2, (RRw, REGLST), ldmstm, t_ldmstm), + + /* V1 instructions with no Thumb analogue at all. */ + CE(rsc, 0e00000, 3, (RR, oRR, SH), arit), + C3(rscs, 0f00000, 3, (RR, oRR, SH), arit), + + C3(stmib, 9800000, 2, (RRw, REGLST), ldmstm), + C3(stmfa, 9800000, 2, (RRw, REGLST), ldmstm), + C3(stmda, 8000000, 2, (RRw, REGLST), ldmstm), + C3(stmed, 8000000, 2, (RRw, REGLST), ldmstm), + C3(ldmib, 9900000, 2, (RRw, REGLST), ldmstm), + C3(ldmed, 9900000, 2, (RRw, REGLST), ldmstm), + C3(ldmda, 8100000, 2, (RRw, REGLST), ldmstm), + C3(ldmfa, 8100000, 2, (RRw, REGLST), ldmstm), + +#undef ARM_VARIANT +#define ARM_VARIANT &arm_ext_v2 /* ARM 2 - multiplies. */ +#undef THUMB_VARIANT +#define THUMB_VARIANT &arm_ext_v4t + tCE(mul, 0000090, mul, 3, (RRnpc, RRnpc, oRR), mul, t_mul), + tC3(muls, 0100090, muls, 3, (RRnpc, RRnpc, oRR), mul, t_mul), + +#undef THUMB_VARIANT +#define THUMB_VARIANT &arm_ext_v6t2 + TCE(mla, 0200090, fb000000, 4, (RRnpc, RRnpc, RRnpc, RRnpc), mlas, t_mla), + C3(mlas, 0300090, 4, (RRnpc, RRnpc, RRnpc, RRnpc), mlas), + + /* Generic coprocessor instructions. */ + TCE(cdp, e000000, ee000000, 6, (RCP, I15b, RCN, RCN, RCN, oI7b), cdp, cdp), + TCE(ldc, c100000, ec100000, 3, (RCP, RCN, ADDR), lstc, lstc), + TC3(ldcl, c500000, ec500000, 3, (RCP, RCN, ADDR), lstc, lstc), + TCE(stc, c000000, ec000000, 3, (RCP, RCN, ADDR), lstc, lstc), + TC3(stcl, c400000, ec400000, 3, (RCP, RCN, ADDR), lstc, lstc), + TCE(mcr, e000010, ee000010, 6, (RCP, I7b, RR, RCN, RCN, oI7b), co_reg, co_reg), + TCE(mrc, e100010, ee100010, 6, (RCP, I7b, RR, RCN, RCN, oI7b), co_reg, co_reg), + +#undef ARM_VARIANT +#define ARM_VARIANT &arm_ext_v2s /* ARM 3 - swp instructions. */ + CE(swp, 1000090, 3, (RRnpc, RRnpc, RRnpcb), rd_rm_rn), + C3(swpb, 1400090, 3, (RRnpc, RRnpc, RRnpcb), rd_rm_rn), + +#undef ARM_VARIANT +#define ARM_VARIANT &arm_ext_v3 /* ARM 6 Status register instructions. */ + TCE(mrs, 10f0000, f3ef8000, 2, (RR, PSR), mrs, t_mrs), + TCE(msr, 120f000, f3808000, 2, (PSR, RR_EXi), msr, t_msr), + +#undef ARM_VARIANT +#define ARM_VARIANT &arm_ext_v3m /* ARM 7M long multiplies. */ + TCE(smull, 0c00090, fb800000, 4, (RRnpc, RRnpc, RRnpc, RRnpc), mull, t_mull), + CM(smull,s, 0d00090, 4, (RRnpc, RRnpc, RRnpc, RRnpc), mull), + TCE(umull, 0800090, fba00000, 4, (RRnpc, RRnpc, RRnpc, RRnpc), mull, t_mull), + CM(umull,s, 0900090, 4, (RRnpc, RRnpc, RRnpc, RRnpc), mull), + TCE(smlal, 0e00090, fbc00000, 4, (RRnpc, RRnpc, RRnpc, RRnpc), mull, t_mull), + CM(smlal,s, 0f00090, 4, (RRnpc, RRnpc, RRnpc, RRnpc), mull), + TCE(umlal, 0a00090, fbe00000, 4, (RRnpc, RRnpc, RRnpc, RRnpc), mull, t_mull), + CM(umlal,s, 0b00090, 4, (RRnpc, RRnpc, RRnpc, RRnpc), mull), + +#undef ARM_VARIANT +#define ARM_VARIANT &arm_ext_v4 /* ARM Architecture 4. */ +#undef THUMB_VARIANT +#define THUMB_VARIANT &arm_ext_v4t + tC3(ldrh, 01000b0, ldrh, 2, (RR, ADDR), ldstv4, t_ldst), + tC3(strh, 00000b0, strh, 2, (RR, ADDR), ldstv4, t_ldst), + tC3(ldrsh, 01000f0, ldrsh, 2, (RR, ADDR), ldstv4, t_ldst), + tC3(ldrsb, 01000d0, ldrsb, 2, (RR, ADDR), ldstv4, t_ldst), + tCM(ld,sh, 01000f0, ldrsh, 2, (RR, ADDR), ldstv4, t_ldst), + tCM(ld,sb, 01000d0, ldrsb, 2, (RR, ADDR), ldstv4, t_ldst), + +#undef ARM_VARIANT +#define ARM_VARIANT &arm_ext_v4t_5 + /* ARM Architecture 4T. */ + /* Note: bx (and blx) are required on V5, even if the processor does + not support Thumb. */ + TCE(bx, 12fff10, 4700, 1, (RR), bx, t_bx), + +#undef ARM_VARIANT +#define ARM_VARIANT &arm_ext_v5 /* ARM Architecture 5T. */ +#undef THUMB_VARIANT +#define THUMB_VARIANT &arm_ext_v5t + /* Note: blx has 2 variants; the .value coded here is for + BLX(2). Only this variant has conditional execution. */ + TCE(blx, 12fff30, 4780, 1, (RR_EXr), blx, t_blx), + TUE(bkpt, 1200070, be00, 1, (oIffffb), bkpt, t_bkpt), + +#undef THUMB_VARIANT +#define THUMB_VARIANT &arm_ext_v6t2 + TCE(clz, 16f0f10, fab0f080, 2, (RRnpc, RRnpc), rd_rm, t_clz), + TUF(ldc2, c100000, fc100000, 3, (RCP, RCN, ADDR), lstc, lstc), + TUF(ldc2l, c500000, fc500000, 3, (RCP, RCN, ADDR), lstc, lstc), + TUF(stc2, c000000, fc000000, 3, (RCP, RCN, ADDR), lstc, lstc), + TUF(stc2l, c400000, fc400000, 3, (RCP, RCN, ADDR), lstc, lstc), + TUF(cdp2, e000000, fe000000, 6, (RCP, I15b, RCN, RCN, RCN, oI7b), cdp, cdp), + TUF(mcr2, e000010, fe000010, 6, (RCP, I7b, RR, RCN, RCN, oI7b), co_reg, co_reg), + TUF(mrc2, e100010, fe100010, 6, (RCP, I7b, RR, RCN, RCN, oI7b), co_reg, co_reg), + +#undef ARM_VARIANT +#define ARM_VARIANT &arm_ext_v5exp /* ARM Architecture 5TExP. */ + TCE(smlabb, 1000080, fb100000, 4, (RRnpc, RRnpc, RRnpc, RRnpc), smla, t_mla), + TCE(smlatb, 10000a0, fb100020, 4, (RRnpc, RRnpc, RRnpc, RRnpc), smla, t_mla), + TCE(smlabt, 10000c0, fb100010, 4, (RRnpc, RRnpc, RRnpc, RRnpc), smla, t_mla), + TCE(smlatt, 10000e0, fb100030, 4, (RRnpc, RRnpc, RRnpc, RRnpc), smla, t_mla), + + TCE(smlawb, 1200080, fb300000, 4, (RRnpc, RRnpc, RRnpc, RRnpc), smla, t_mla), + TCE(smlawt, 12000c0, fb300010, 4, (RRnpc, RRnpc, RRnpc, RRnpc), smla, t_mla), + + TCE(smlalbb, 1400080, fbc00080, 4, (RRnpc, RRnpc, RRnpc, RRnpc), smlal, t_mlal), + TCE(smlaltb, 14000a0, fbc000a0, 4, (RRnpc, RRnpc, RRnpc, RRnpc), smlal, t_mlal), + TCE(smlalbt, 14000c0, fbc00090, 4, (RRnpc, RRnpc, RRnpc, RRnpc), smlal, t_mlal), + TCE(smlaltt, 14000e0, fbc000b0, 4, (RRnpc, RRnpc, RRnpc, RRnpc), smlal, t_mlal), + + TCE(smulbb, 1600080, fb10f000, 3, (RRnpc, RRnpc, RRnpc), smul, t_simd), + TCE(smultb, 16000a0, fb10f020, 3, (RRnpc, RRnpc, RRnpc), smul, t_simd), + TCE(smulbt, 16000c0, fb10f010, 3, (RRnpc, RRnpc, RRnpc), smul, t_simd), + TCE(smultt, 16000e0, fb10f030, 3, (RRnpc, RRnpc, RRnpc), smul, t_simd), + + TCE(smulwb, 12000a0, fb30f000, 3, (RRnpc, RRnpc, RRnpc), smul, t_simd), + TCE(smulwt, 12000e0, fb30f010, 3, (RRnpc, RRnpc, RRnpc), smul, t_simd), + + TCE(qadd, 1000050, fa80f080, 3, (RRnpc, RRnpc, RRnpc), rd_rm_rn, rd_rm_rn), + TCE(qdadd, 1400050, fa80f090, 3, (RRnpc, RRnpc, RRnpc), rd_rm_rn, rd_rm_rn), + TCE(qsub, 1200050, fa80f0a0, 3, (RRnpc, RRnpc, RRnpc), rd_rm_rn, rd_rm_rn), + TCE(qdsub, 1600050, fa80f0b0, 3, (RRnpc, RRnpc, RRnpc), rd_rm_rn, rd_rm_rn), + +#undef ARM_VARIANT +#define ARM_VARIANT &arm_ext_v5e /* ARM Architecture 5TE. */ + TUF(pld, 450f000, f810f000, 1, (ADDR), pld, t_pld), + TC3(ldrd, 00000d0, e9500000, 3, (RRnpc, oRRnpc, ADDR), ldrd, t_ldstd), + TC3(strd, 00000f0, e9400000, 3, (RRnpc, oRRnpc, ADDR), ldrd, t_ldstd), + + TCE(mcrr, c400000, ec400000, 5, (RCP, I15b, RRnpc, RRnpc, RCN), co_reg2c, co_reg2c), + TCE(mrrc, c500000, ec500000, 5, (RCP, I15b, RRnpc, RRnpc, RCN), co_reg2c, co_reg2c), + +#undef ARM_VARIANT +#define ARM_VARIANT &arm_ext_v5j /* ARM Architecture 5TEJ. */ + TCE(bxj, 12fff20, f3c08f00, 1, (RR), bxj, t_bxj), + +#undef ARM_VARIANT +#define ARM_VARIANT &arm_ext_v6 /* ARM V6. */ +#undef THUMB_VARIANT +#define THUMB_VARIANT &arm_ext_v6 + TUF(cpsie, 1080000, b660, 2, (CPSF, oI31b), cpsi, t_cpsi), + TUF(cpsid, 10c0000, b670, 2, (CPSF, oI31b), cpsi, t_cpsi), + tCE(rev, 6bf0f30, rev, 2, (RRnpc, RRnpc), rd_rm, t_rev), + tCE(rev16, 6bf0fb0, rev16, 2, (RRnpc, RRnpc), rd_rm, t_rev), + tCE(revsh, 6ff0fb0, revsh, 2, (RRnpc, RRnpc), rd_rm, t_rev), + tCE(sxth, 6bf0070, sxth, 3, (RRnpc, RRnpc, oROR), sxth, t_sxth), + tCE(uxth, 6ff0070, uxth, 3, (RRnpc, RRnpc, oROR), sxth, t_sxth), + tCE(sxtb, 6af0070, sxtb, 3, (RRnpc, RRnpc, oROR), sxth, t_sxth), + tCE(uxtb, 6ef0070, uxtb, 3, (RRnpc, RRnpc, oROR), sxth, t_sxth), + TUF(setend, 1010000, b650, 1, (ENDI), setend, t_setend), + +#undef THUMB_VARIANT +#define THUMB_VARIANT &arm_ext_v6t2 + TCE(ldrex, 1900f9f, e8500f00, 2, (RRnpc, ADDR), ldrex, t_ldrex), + TUF(mcrr2, c400000, fc400000, 5, (RCP, I15b, RRnpc, RRnpc, RCN), co_reg2c, co_reg2c), + TUF(mrrc2, c500000, fc500000, 5, (RCP, I15b, RRnpc, RRnpc, RCN), co_reg2c, co_reg2c), + + TCE(ssat, 6a00010, f3000000, 4, (RRnpc, I32, RRnpc, oSHllar),ssat, t_ssat), + TCE(usat, 6e00010, f3800000, 4, (RRnpc, I31, RRnpc, oSHllar),usat, t_usat), + +/* ARM V6 not included in V7M (eg. integer SIMD). */ +#undef THUMB_VARIANT +#define THUMB_VARIANT &arm_ext_v6_notm + TUF(cps, 1020000, f3af8100, 1, (I31b), imm0, t_cps), + TCE(pkhbt, 6800010, eac00000, 4, (RRnpc, RRnpc, RRnpc, oSHll), pkhbt, t_pkhbt), + TCE(pkhtb, 6800050, eac00020, 4, (RRnpc, RRnpc, RRnpc, oSHar), pkhtb, t_pkhtb), + TCE(qadd16, 6200f10, fa90f010, 3, (RRnpc, RRnpc, RRnpc), rd_rn_rm, t_simd), + TCE(qadd8, 6200f90, fa80f010, 3, (RRnpc, RRnpc, RRnpc), rd_rn_rm, t_simd), + TCE(qaddsubx, 6200f30, faa0f010, 3, (RRnpc, RRnpc, RRnpc), rd_rn_rm, t_simd), + TCE(qsub16, 6200f70, fad0f010, 3, (RRnpc, RRnpc, RRnpc), rd_rn_rm, t_simd), + TCE(qsub8, 6200ff0, fac0f010, 3, (RRnpc, RRnpc, RRnpc), rd_rn_rm, t_simd), + TCE(qsubaddx, 6200f50, fae0f010, 3, (RRnpc, RRnpc, RRnpc), rd_rn_rm, t_simd), + TCE(sadd16, 6100f10, fa90f000, 3, (RRnpc, RRnpc, RRnpc), rd_rn_rm, t_simd), + TCE(sadd8, 6100f90, fa80f000, 3, (RRnpc, RRnpc, RRnpc), rd_rn_rm, t_simd), + TCE(saddsubx, 6100f30, faa0f000, 3, (RRnpc, RRnpc, RRnpc), rd_rn_rm, t_simd), + TCE(shadd16, 6300f10, fa90f020, 3, (RRnpc, RRnpc, RRnpc), rd_rn_rm, t_simd), + TCE(shadd8, 6300f90, fa80f020, 3, (RRnpc, RRnpc, RRnpc), rd_rn_rm, t_simd), + TCE(shaddsubx, 6300f30, faa0f020, 3, (RRnpc, RRnpc, RRnpc), rd_rn_rm, t_simd), + TCE(shsub16, 6300f70, fad0f020, 3, (RRnpc, RRnpc, RRnpc), rd_rn_rm, t_simd), + TCE(shsub8, 6300ff0, fac0f020, 3, (RRnpc, RRnpc, RRnpc), rd_rn_rm, t_simd), + TCE(shsubaddx, 6300f50, fae0f020, 3, (RRnpc, RRnpc, RRnpc), rd_rn_rm, t_simd), + TCE(ssub16, 6100f70, fad0f000, 3, (RRnpc, RRnpc, RRnpc), rd_rn_rm, t_simd), + TCE(ssub8, 6100ff0, fac0f000, 3, (RRnpc, RRnpc, RRnpc), rd_rn_rm, t_simd), + TCE(ssubaddx, 6100f50, fae0f000, 3, (RRnpc, RRnpc, RRnpc), rd_rn_rm, t_simd), + TCE(uadd16, 6500f10, fa90f040, 3, (RRnpc, RRnpc, RRnpc), rd_rn_rm, t_simd), + TCE(uadd8, 6500f90, fa80f040, 3, (RRnpc, RRnpc, RRnpc), rd_rn_rm, t_simd), + TCE(uaddsubx, 6500f30, faa0f040, 3, (RRnpc, RRnpc, RRnpc), rd_rn_rm, t_simd), + TCE(uhadd16, 6700f10, fa90f060, 3, (RRnpc, RRnpc, RRnpc), rd_rn_rm, t_simd), + TCE(uhadd8, 6700f90, fa80f060, 3, (RRnpc, RRnpc, RRnpc), rd_rn_rm, t_simd), + TCE(uhaddsubx, 6700f30, faa0f060, 3, (RRnpc, RRnpc, RRnpc), rd_rn_rm, t_simd), + TCE(uhsub16, 6700f70, fad0f060, 3, (RRnpc, RRnpc, RRnpc), rd_rn_rm, t_simd), + TCE(uhsub8, 6700ff0, fac0f060, 3, (RRnpc, RRnpc, RRnpc), rd_rn_rm, t_simd), + TCE(uhsubaddx, 6700f50, fae0f060, 3, (RRnpc, RRnpc, RRnpc), rd_rn_rm, t_simd), + TCE(uqadd16, 6600f10, fa90f050, 3, (RRnpc, RRnpc, RRnpc), rd_rn_rm, t_simd), + TCE(uqadd8, 6600f90, fa80f050, 3, (RRnpc, RRnpc, RRnpc), rd_rn_rm, t_simd), + TCE(uqaddsubx, 6600f30, faa0f050, 3, (RRnpc, RRnpc, RRnpc), rd_rn_rm, t_simd), + TCE(uqsub16, 6600f70, fad0f050, 3, (RRnpc, RRnpc, RRnpc), rd_rn_rm, t_simd), + TCE(uqsub8, 6600ff0, fac0f050, 3, (RRnpc, RRnpc, RRnpc), rd_rn_rm, t_simd), + TCE(uqsubaddx, 6600f50, fae0f050, 3, (RRnpc, RRnpc, RRnpc), rd_rn_rm, t_simd), + TCE(usub16, 6500f70, fad0f040, 3, (RRnpc, RRnpc, RRnpc), rd_rn_rm, t_simd), + TCE(usub8, 6500ff0, fac0f040, 3, (RRnpc, RRnpc, RRnpc), rd_rn_rm, t_simd), + TCE(usubaddx, 6500f50, fae0f040, 3, (RRnpc, RRnpc, RRnpc), rd_rn_rm, t_simd), + TUF(rfeia, 8900a00, e990c000, 1, (RRw), rfe, rfe), + UF(rfeib, 9900a00, 1, (RRw), rfe), + UF(rfeda, 8100a00, 1, (RRw), rfe), + TUF(rfedb, 9100a00, e810c000, 1, (RRw), rfe, rfe), + TUF(rfefd, 8900a00, e990c000, 1, (RRw), rfe, rfe), + UF(rfefa, 9900a00, 1, (RRw), rfe), + UF(rfeea, 8100a00, 1, (RRw), rfe), + TUF(rfeed, 9100a00, e810c000, 1, (RRw), rfe, rfe), + TCE(sxtah, 6b00070, fa00f080, 4, (RRnpc, RRnpc, RRnpc, oROR), sxtah, t_sxtah), + TCE(sxtab16, 6800070, fa20f080, 4, (RRnpc, RRnpc, RRnpc, oROR), sxtah, t_sxtah), + TCE(sxtab, 6a00070, fa40f080, 4, (RRnpc, RRnpc, RRnpc, oROR), sxtah, t_sxtah), + TCE(sxtb16, 68f0070, fa2ff080, 3, (RRnpc, RRnpc, oROR), sxth, t_sxth), + TCE(uxtah, 6f00070, fa10f080, 4, (RRnpc, RRnpc, RRnpc, oROR), sxtah, t_sxtah), + TCE(uxtab16, 6c00070, fa30f080, 4, (RRnpc, RRnpc, RRnpc, oROR), sxtah, t_sxtah), + TCE(uxtab, 6e00070, fa50f080, 4, (RRnpc, RRnpc, RRnpc, oROR), sxtah, t_sxtah), + TCE(uxtb16, 6cf0070, fa3ff080, 3, (RRnpc, RRnpc, oROR), sxth, t_sxth), + TCE(sel, 6800fb0, faa0f080, 3, (RRnpc, RRnpc, RRnpc), rd_rn_rm, t_simd), + TCE(smlad, 7000010, fb200000, 4, (RRnpc, RRnpc, RRnpc, RRnpc),smla, t_mla), + TCE(smladx, 7000030, fb200010, 4, (RRnpc, RRnpc, RRnpc, RRnpc),smla, t_mla), + TCE(smlald, 7400010, fbc000c0, 4, (RRnpc, RRnpc, RRnpc, RRnpc),smlal,t_mlal), + TCE(smlaldx, 7400030, fbc000d0, 4, (RRnpc, RRnpc, RRnpc, RRnpc),smlal,t_mlal), + TCE(smlsd, 7000050, fb400000, 4, (RRnpc, RRnpc, RRnpc, RRnpc),smla, t_mla), + TCE(smlsdx, 7000070, fb400010, 4, (RRnpc, RRnpc, RRnpc, RRnpc),smla, t_mla), + TCE(smlsld, 7400050, fbd000c0, 4, (RRnpc, RRnpc, RRnpc, RRnpc),smlal,t_mlal), + TCE(smlsldx, 7400070, fbd000d0, 4, (RRnpc, RRnpc, RRnpc, RRnpc),smlal,t_mlal), + TCE(smmla, 7500010, fb500000, 4, (RRnpc, RRnpc, RRnpc, RRnpc),smla, t_mla), + TCE(smmlar, 7500030, fb500010, 4, (RRnpc, RRnpc, RRnpc, RRnpc),smla, t_mla), + TCE(smmls, 75000d0, fb600000, 4, (RRnpc, RRnpc, RRnpc, RRnpc),smla, t_mla), + TCE(smmlsr, 75000f0, fb600010, 4, (RRnpc, RRnpc, RRnpc, RRnpc),smla, t_mla), + TCE(smmul, 750f010, fb50f000, 3, (RRnpc, RRnpc, RRnpc), smul, t_simd), + TCE(smmulr, 750f030, fb50f010, 3, (RRnpc, RRnpc, RRnpc), smul, t_simd), + TCE(smuad, 700f010, fb20f000, 3, (RRnpc, RRnpc, RRnpc), smul, t_simd), + TCE(smuadx, 700f030, fb20f010, 3, (RRnpc, RRnpc, RRnpc), smul, t_simd), + TCE(smusd, 700f050, fb40f000, 3, (RRnpc, RRnpc, RRnpc), smul, t_simd), + TCE(smusdx, 700f070, fb40f010, 3, (RRnpc, RRnpc, RRnpc), smul, t_simd), + TUF(srsia, 8cd0500, e980c000, 1, (I31w), srs, srs), + UF(srsib, 9cd0500, 1, (I31w), srs), + UF(srsda, 84d0500, 1, (I31w), srs), + TUF(srsdb, 94d0500, e800c000, 1, (I31w), srs, srs), + TCE(ssat16, 6a00f30, f3200000, 3, (RRnpc, I16, RRnpc), ssat16, t_ssat16), + TCE(strex, 1800f90, e8400000, 3, (RRnpc, RRnpc, ADDR), strex, t_strex), + TCE(umaal, 0400090, fbe00060, 4, (RRnpc, RRnpc, RRnpc, RRnpc),smlal, t_mlal), + TCE(usad8, 780f010, fb70f000, 3, (RRnpc, RRnpc, RRnpc), smul, t_simd), + TCE(usada8, 7800010, fb700000, 4, (RRnpc, RRnpc, RRnpc, RRnpc),smla, t_mla), + TCE(usat16, 6e00f30, f3a00000, 3, (RRnpc, I15, RRnpc), usat16, t_usat16), + +#undef ARM_VARIANT +#define ARM_VARIANT &arm_ext_v6k +#undef THUMB_VARIANT +#define THUMB_VARIANT &arm_ext_v6k + tCE(yield, 320f001, yield, 0, (), noargs, t_hint), + tCE(wfe, 320f002, wfe, 0, (), noargs, t_hint), + tCE(wfi, 320f003, wfi, 0, (), noargs, t_hint), + tCE(sev, 320f004, sev, 0, (), noargs, t_hint), + +#undef THUMB_VARIANT +#define THUMB_VARIANT &arm_ext_v6_notm + TCE(ldrexd, 1b00f9f, e8d0007f, 3, (RRnpc, oRRnpc, RRnpcb), ldrexd, t_ldrexd), + TCE(strexd, 1a00f90, e8c00070, 4, (RRnpc, RRnpc, oRRnpc, RRnpcb), strexd, t_strexd), + +#undef THUMB_VARIANT +#define THUMB_VARIANT &arm_ext_v6t2 + TCE(ldrexb, 1d00f9f, e8d00f4f, 2, (RRnpc, RRnpcb), rd_rn, rd_rn), + TCE(ldrexh, 1f00f9f, e8d00f5f, 2, (RRnpc, RRnpcb), rd_rn, rd_rn), + TCE(strexb, 1c00f90, e8c00f40, 3, (RRnpc, RRnpc, ADDR), strex, rm_rd_rn), + TCE(strexh, 1e00f90, e8c00f50, 3, (RRnpc, RRnpc, ADDR), strex, rm_rd_rn), + TUF(clrex, 57ff01f, f3bf8f2f, 0, (), noargs, noargs), + +#undef ARM_VARIANT +#define ARM_VARIANT &arm_ext_v6z + TCE(smc, 1600070, f7f08000, 1, (EXPi), smc, t_smc), + +#undef ARM_VARIANT +#define ARM_VARIANT &arm_ext_v6t2 + TCE(bfc, 7c0001f, f36f0000, 3, (RRnpc, I31, I32), bfc, t_bfc), + TCE(bfi, 7c00010, f3600000, 4, (RRnpc, RRnpc_I0, I31, I32), bfi, t_bfi), + TCE(sbfx, 7a00050, f3400000, 4, (RR, RR, I31, I32), bfx, t_bfx), + TCE(ubfx, 7e00050, f3c00000, 4, (RR, RR, I31, I32), bfx, t_bfx), + + TCE(mls, 0600090, fb000010, 4, (RRnpc, RRnpc, RRnpc, RRnpc), mlas, t_mla), + TCE(movw, 3000000, f2400000, 2, (RRnpc, Iffff), mov16, t_mov16), + TCE(movt, 3400000, f2c00000, 2, (RRnpc, Iffff), mov16, t_mov16), + TCE(rbit, 3ff0f30, fa90f0a0, 2, (RR, RR), rd_rm, t_rbit), + + TC3(ldrht, 03000b0, f8300e00, 2, (RR, ADDR), ldsttv4, t_ldstt), + TC3(ldrsht, 03000f0, f9300e00, 2, (RR, ADDR), ldsttv4, t_ldstt), + TC3(ldrsbt, 03000d0, f9100e00, 2, (RR, ADDR), ldsttv4, t_ldstt), + TC3(strht, 02000b0, f8200e00, 2, (RR, ADDR), ldsttv4, t_ldstt), + + UT(cbnz, b900, 2, (RR, EXP), t_czb), + UT(cbz, b100, 2, (RR, EXP), t_czb), + /* ARM does not really have an IT instruction. */ + TUE(it, 0, bf08, 1, (COND), it, t_it), + TUE(itt, 0, bf0c, 1, (COND), it, t_it), + TUE(ite, 0, bf04, 1, (COND), it, t_it), + TUE(ittt, 0, bf0e, 1, (COND), it, t_it), + TUE(itet, 0, bf06, 1, (COND), it, t_it), + TUE(itte, 0, bf0a, 1, (COND), it, t_it), + TUE(itee, 0, bf02, 1, (COND), it, t_it), + TUE(itttt, 0, bf0f, 1, (COND), it, t_it), + TUE(itett, 0, bf07, 1, (COND), it, t_it), + TUE(ittet, 0, bf0b, 1, (COND), it, t_it), + TUE(iteet, 0, bf03, 1, (COND), it, t_it), + TUE(ittte, 0, bf0d, 1, (COND), it, t_it), + TUE(itete, 0, bf05, 1, (COND), it, t_it), + TUE(ittee, 0, bf09, 1, (COND), it, t_it), + TUE(iteee, 0, bf01, 1, (COND), it, t_it), + + /* Thumb2 only instructions. */ +#undef ARM_VARIANT +#define ARM_VARIANT NULL + + TCE(addw, 0, f2000000, 3, (RR, RR, EXPi), 0, t_add_sub_w), + TCE(subw, 0, f2a00000, 3, (RR, RR, EXPi), 0, t_add_sub_w), + TCE(tbb, 0, e8d0f000, 1, (TB), 0, t_tb), + TCE(tbh, 0, e8d0f010, 1, (TB), 0, t_tb), + + /* Thumb-2 hardware division instructions (R and M profiles only). */ +#undef THUMB_VARIANT +#define THUMB_VARIANT &arm_ext_div + TCE(sdiv, 0, fb90f0f0, 3, (RR, oRR, RR), 0, t_div), + TCE(udiv, 0, fbb0f0f0, 3, (RR, oRR, RR), 0, t_div), + + /* ARM V7 instructions. */ +#undef ARM_VARIANT +#define ARM_VARIANT &arm_ext_v7 +#undef THUMB_VARIANT +#define THUMB_VARIANT &arm_ext_v7 + TUF(pli, 450f000, f910f000, 1, (ADDR), pli, t_pld), + TCE(dbg, 320f0f0, f3af80f0, 1, (I15), dbg, t_dbg), + TUF(dmb, 57ff050, f3bf8f50, 1, (oBARRIER), barrier, t_barrier), + TUF(dsb, 57ff040, f3bf8f40, 1, (oBARRIER), barrier, t_barrier), + TUF(isb, 57ff060, f3bf8f60, 1, (oBARRIER), barrier, t_barrier), + +#undef ARM_VARIANT +#define ARM_VARIANT &fpu_fpa_ext_v1 /* Core FPA instruction set (V1). */ + cCE(wfs, e200110, 1, (RR), rd), + cCE(rfs, e300110, 1, (RR), rd), + cCE(wfc, e400110, 1, (RR), rd), + cCE(rfc, e500110, 1, (RR), rd), + + cCL(ldfs, c100100, 2, (RF, ADDR), rd_cpaddr), + cCL(ldfd, c108100, 2, (RF, ADDR), rd_cpaddr), + cCL(ldfe, c500100, 2, (RF, ADDR), rd_cpaddr), + cCL(ldfp, c508100, 2, (RF, ADDR), rd_cpaddr), + + cCL(stfs, c000100, 2, (RF, ADDR), rd_cpaddr), + cCL(stfd, c008100, 2, (RF, ADDR), rd_cpaddr), + cCL(stfe, c400100, 2, (RF, ADDR), rd_cpaddr), + cCL(stfp, c408100, 2, (RF, ADDR), rd_cpaddr), + + cCL(mvfs, e008100, 2, (RF, RF_IF), rd_rm), + cCL(mvfsp, e008120, 2, (RF, RF_IF), rd_rm), + cCL(mvfsm, e008140, 2, (RF, RF_IF), rd_rm), + cCL(mvfsz, e008160, 2, (RF, RF_IF), rd_rm), + cCL(mvfd, e008180, 2, (RF, RF_IF), rd_rm), + cCL(mvfdp, e0081a0, 2, (RF, RF_IF), rd_rm), + cCL(mvfdm, e0081c0, 2, (RF, RF_IF), rd_rm), + cCL(mvfdz, e0081e0, 2, (RF, RF_IF), rd_rm), + cCL(mvfe, e088100, 2, (RF, RF_IF), rd_rm), + cCL(mvfep, e088120, 2, (RF, RF_IF), rd_rm), + cCL(mvfem, e088140, 2, (RF, RF_IF), rd_rm), + cCL(mvfez, e088160, 2, (RF, RF_IF), rd_rm), + + cCL(mnfs, e108100, 2, (RF, RF_IF), rd_rm), + cCL(mnfsp, e108120, 2, (RF, RF_IF), rd_rm), + cCL(mnfsm, e108140, 2, (RF, RF_IF), rd_rm), + cCL(mnfsz, e108160, 2, (RF, RF_IF), rd_rm), + cCL(mnfd, e108180, 2, (RF, RF_IF), rd_rm), + cCL(mnfdp, e1081a0, 2, (RF, RF_IF), rd_rm), + cCL(mnfdm, e1081c0, 2, (RF, RF_IF), rd_rm), + cCL(mnfdz, e1081e0, 2, (RF, RF_IF), rd_rm), + cCL(mnfe, e188100, 2, (RF, RF_IF), rd_rm), + cCL(mnfep, e188120, 2, (RF, RF_IF), rd_rm), + cCL(mnfem, e188140, 2, (RF, RF_IF), rd_rm), + cCL(mnfez, e188160, 2, (RF, RF_IF), rd_rm), + + cCL(abss, e208100, 2, (RF, RF_IF), rd_rm), + cCL(abssp, e208120, 2, (RF, RF_IF), rd_rm), + cCL(abssm, e208140, 2, (RF, RF_IF), rd_rm), + cCL(abssz, e208160, 2, (RF, RF_IF), rd_rm), + cCL(absd, e208180, 2, (RF, RF_IF), rd_rm), + cCL(absdp, e2081a0, 2, (RF, RF_IF), rd_rm), + cCL(absdm, e2081c0, 2, (RF, RF_IF), rd_rm), + cCL(absdz, e2081e0, 2, (RF, RF_IF), rd_rm), + cCL(abse, e288100, 2, (RF, RF_IF), rd_rm), + cCL(absep, e288120, 2, (RF, RF_IF), rd_rm), + cCL(absem, e288140, 2, (RF, RF_IF), rd_rm), + cCL(absez, e288160, 2, (RF, RF_IF), rd_rm), + + cCL(rnds, e308100, 2, (RF, RF_IF), rd_rm), + cCL(rndsp, e308120, 2, (RF, RF_IF), rd_rm), + cCL(rndsm, e308140, 2, (RF, RF_IF), rd_rm), + cCL(rndsz, e308160, 2, (RF, RF_IF), rd_rm), + cCL(rndd, e308180, 2, (RF, RF_IF), rd_rm), + cCL(rnddp, e3081a0, 2, (RF, RF_IF), rd_rm), + cCL(rnddm, e3081c0, 2, (RF, RF_IF), rd_rm), + cCL(rnddz, e3081e0, 2, (RF, RF_IF), rd_rm), + cCL(rnde, e388100, 2, (RF, RF_IF), rd_rm), + cCL(rndep, e388120, 2, (RF, RF_IF), rd_rm), + cCL(rndem, e388140, 2, (RF, RF_IF), rd_rm), + cCL(rndez, e388160, 2, (RF, RF_IF), rd_rm), + + cCL(sqts, e408100, 2, (RF, RF_IF), rd_rm), + cCL(sqtsp, e408120, 2, (RF, RF_IF), rd_rm), + cCL(sqtsm, e408140, 2, (RF, RF_IF), rd_rm), + cCL(sqtsz, e408160, 2, (RF, RF_IF), rd_rm), + cCL(sqtd, e408180, 2, (RF, RF_IF), rd_rm), + cCL(sqtdp, e4081a0, 2, (RF, RF_IF), rd_rm), + cCL(sqtdm, e4081c0, 2, (RF, RF_IF), rd_rm), + cCL(sqtdz, e4081e0, 2, (RF, RF_IF), rd_rm), + cCL(sqte, e488100, 2, (RF, RF_IF), rd_rm), + cCL(sqtep, e488120, 2, (RF, RF_IF), rd_rm), + cCL(sqtem, e488140, 2, (RF, RF_IF), rd_rm), + cCL(sqtez, e488160, 2, (RF, RF_IF), rd_rm), + + cCL(logs, e508100, 2, (RF, RF_IF), rd_rm), + cCL(logsp, e508120, 2, (RF, RF_IF), rd_rm), + cCL(logsm, e508140, 2, (RF, RF_IF), rd_rm), + cCL(logsz, e508160, 2, (RF, RF_IF), rd_rm), + cCL(logd, e508180, 2, (RF, RF_IF), rd_rm), + cCL(logdp, e5081a0, 2, (RF, RF_IF), rd_rm), + cCL(logdm, e5081c0, 2, (RF, RF_IF), rd_rm), + cCL(logdz, e5081e0, 2, (RF, RF_IF), rd_rm), + cCL(loge, e588100, 2, (RF, RF_IF), rd_rm), + cCL(logep, e588120, 2, (RF, RF_IF), rd_rm), + cCL(logem, e588140, 2, (RF, RF_IF), rd_rm), + cCL(logez, e588160, 2, (RF, RF_IF), rd_rm), + + cCL(lgns, e608100, 2, (RF, RF_IF), rd_rm), + cCL(lgnsp, e608120, 2, (RF, RF_IF), rd_rm), + cCL(lgnsm, e608140, 2, (RF, RF_IF), rd_rm), + cCL(lgnsz, e608160, 2, (RF, RF_IF), rd_rm), + cCL(lgnd, e608180, 2, (RF, RF_IF), rd_rm), + cCL(lgndp, e6081a0, 2, (RF, RF_IF), rd_rm), + cCL(lgndm, e6081c0, 2, (RF, RF_IF), rd_rm), + cCL(lgndz, e6081e0, 2, (RF, RF_IF), rd_rm), + cCL(lgne, e688100, 2, (RF, RF_IF), rd_rm), + cCL(lgnep, e688120, 2, (RF, RF_IF), rd_rm), + cCL(lgnem, e688140, 2, (RF, RF_IF), rd_rm), + cCL(lgnez, e688160, 2, (RF, RF_IF), rd_rm), + + cCL(exps, e708100, 2, (RF, RF_IF), rd_rm), + cCL(expsp, e708120, 2, (RF, RF_IF), rd_rm), + cCL(expsm, e708140, 2, (RF, RF_IF), rd_rm), + cCL(expsz, e708160, 2, (RF, RF_IF), rd_rm), + cCL(expd, e708180, 2, (RF, RF_IF), rd_rm), + cCL(expdp, e7081a0, 2, (RF, RF_IF), rd_rm), + cCL(expdm, e7081c0, 2, (RF, RF_IF), rd_rm), + cCL(expdz, e7081e0, 2, (RF, RF_IF), rd_rm), + cCL(expe, e788100, 2, (RF, RF_IF), rd_rm), + cCL(expep, e788120, 2, (RF, RF_IF), rd_rm), + cCL(expem, e788140, 2, (RF, RF_IF), rd_rm), + cCL(expdz, e788160, 2, (RF, RF_IF), rd_rm), + + cCL(sins, e808100, 2, (RF, RF_IF), rd_rm), + cCL(sinsp, e808120, 2, (RF, RF_IF), rd_rm), + cCL(sinsm, e808140, 2, (RF, RF_IF), rd_rm), + cCL(sinsz, e808160, 2, (RF, RF_IF), rd_rm), + cCL(sind, e808180, 2, (RF, RF_IF), rd_rm), + cCL(sindp, e8081a0, 2, (RF, RF_IF), rd_rm), + cCL(sindm, e8081c0, 2, (RF, RF_IF), rd_rm), + cCL(sindz, e8081e0, 2, (RF, RF_IF), rd_rm), + cCL(sine, e888100, 2, (RF, RF_IF), rd_rm), + cCL(sinep, e888120, 2, (RF, RF_IF), rd_rm), + cCL(sinem, e888140, 2, (RF, RF_IF), rd_rm), + cCL(sinez, e888160, 2, (RF, RF_IF), rd_rm), + + cCL(coss, e908100, 2, (RF, RF_IF), rd_rm), + cCL(cossp, e908120, 2, (RF, RF_IF), rd_rm), + cCL(cossm, e908140, 2, (RF, RF_IF), rd_rm), + cCL(cossz, e908160, 2, (RF, RF_IF), rd_rm), + cCL(cosd, e908180, 2, (RF, RF_IF), rd_rm), + cCL(cosdp, e9081a0, 2, (RF, RF_IF), rd_rm), + cCL(cosdm, e9081c0, 2, (RF, RF_IF), rd_rm), + cCL(cosdz, e9081e0, 2, (RF, RF_IF), rd_rm), + cCL(cose, e988100, 2, (RF, RF_IF), rd_rm), + cCL(cosep, e988120, 2, (RF, RF_IF), rd_rm), + cCL(cosem, e988140, 2, (RF, RF_IF), rd_rm), + cCL(cosez, e988160, 2, (RF, RF_IF), rd_rm), + + cCL(tans, ea08100, 2, (RF, RF_IF), rd_rm), + cCL(tansp, ea08120, 2, (RF, RF_IF), rd_rm), + cCL(tansm, ea08140, 2, (RF, RF_IF), rd_rm), + cCL(tansz, ea08160, 2, (RF, RF_IF), rd_rm), + cCL(tand, ea08180, 2, (RF, RF_IF), rd_rm), + cCL(tandp, ea081a0, 2, (RF, RF_IF), rd_rm), + cCL(tandm, ea081c0, 2, (RF, RF_IF), rd_rm), + cCL(tandz, ea081e0, 2, (RF, RF_IF), rd_rm), + cCL(tane, ea88100, 2, (RF, RF_IF), rd_rm), + cCL(tanep, ea88120, 2, (RF, RF_IF), rd_rm), + cCL(tanem, ea88140, 2, (RF, RF_IF), rd_rm), + cCL(tanez, ea88160, 2, (RF, RF_IF), rd_rm), + + cCL(asns, eb08100, 2, (RF, RF_IF), rd_rm), + cCL(asnsp, eb08120, 2, (RF, RF_IF), rd_rm), + cCL(asnsm, eb08140, 2, (RF, RF_IF), rd_rm), + cCL(asnsz, eb08160, 2, (RF, RF_IF), rd_rm), + cCL(asnd, eb08180, 2, (RF, RF_IF), rd_rm), + cCL(asndp, eb081a0, 2, (RF, RF_IF), rd_rm), + cCL(asndm, eb081c0, 2, (RF, RF_IF), rd_rm), + cCL(asndz, eb081e0, 2, (RF, RF_IF), rd_rm), + cCL(asne, eb88100, 2, (RF, RF_IF), rd_rm), + cCL(asnep, eb88120, 2, (RF, RF_IF), rd_rm), + cCL(asnem, eb88140, 2, (RF, RF_IF), rd_rm), + cCL(asnez, eb88160, 2, (RF, RF_IF), rd_rm), + + cCL(acss, ec08100, 2, (RF, RF_IF), rd_rm), + cCL(acssp, ec08120, 2, (RF, RF_IF), rd_rm), + cCL(acssm, ec08140, 2, (RF, RF_IF), rd_rm), + cCL(acssz, ec08160, 2, (RF, RF_IF), rd_rm), + cCL(acsd, ec08180, 2, (RF, RF_IF), rd_rm), + cCL(acsdp, ec081a0, 2, (RF, RF_IF), rd_rm), + cCL(acsdm, ec081c0, 2, (RF, RF_IF), rd_rm), + cCL(acsdz, ec081e0, 2, (RF, RF_IF), rd_rm), + cCL(acse, ec88100, 2, (RF, RF_IF), rd_rm), + cCL(acsep, ec88120, 2, (RF, RF_IF), rd_rm), + cCL(acsem, ec88140, 2, (RF, RF_IF), rd_rm), + cCL(acsez, ec88160, 2, (RF, RF_IF), rd_rm), + + cCL(atns, ed08100, 2, (RF, RF_IF), rd_rm), + cCL(atnsp, ed08120, 2, (RF, RF_IF), rd_rm), + cCL(atnsm, ed08140, 2, (RF, RF_IF), rd_rm), + cCL(atnsz, ed08160, 2, (RF, RF_IF), rd_rm), + cCL(atnd, ed08180, 2, (RF, RF_IF), rd_rm), + cCL(atndp, ed081a0, 2, (RF, RF_IF), rd_rm), + cCL(atndm, ed081c0, 2, (RF, RF_IF), rd_rm), + cCL(atndz, ed081e0, 2, (RF, RF_IF), rd_rm), + cCL(atne, ed88100, 2, (RF, RF_IF), rd_rm), + cCL(atnep, ed88120, 2, (RF, RF_IF), rd_rm), + cCL(atnem, ed88140, 2, (RF, RF_IF), rd_rm), + cCL(atnez, ed88160, 2, (RF, RF_IF), rd_rm), + + cCL(urds, ee08100, 2, (RF, RF_IF), rd_rm), + cCL(urdsp, ee08120, 2, (RF, RF_IF), rd_rm), + cCL(urdsm, ee08140, 2, (RF, RF_IF), rd_rm), + cCL(urdsz, ee08160, 2, (RF, RF_IF), rd_rm), + cCL(urdd, ee08180, 2, (RF, RF_IF), rd_rm), + cCL(urddp, ee081a0, 2, (RF, RF_IF), rd_rm), + cCL(urddm, ee081c0, 2, (RF, RF_IF), rd_rm), + cCL(urddz, ee081e0, 2, (RF, RF_IF), rd_rm), + cCL(urde, ee88100, 2, (RF, RF_IF), rd_rm), + cCL(urdep, ee88120, 2, (RF, RF_IF), rd_rm), + cCL(urdem, ee88140, 2, (RF, RF_IF), rd_rm), + cCL(urdez, ee88160, 2, (RF, RF_IF), rd_rm), + + cCL(nrms, ef08100, 2, (RF, RF_IF), rd_rm), + cCL(nrmsp, ef08120, 2, (RF, RF_IF), rd_rm), + cCL(nrmsm, ef08140, 2, (RF, RF_IF), rd_rm), + cCL(nrmsz, ef08160, 2, (RF, RF_IF), rd_rm), + cCL(nrmd, ef08180, 2, (RF, RF_IF), rd_rm), + cCL(nrmdp, ef081a0, 2, (RF, RF_IF), rd_rm), + cCL(nrmdm, ef081c0, 2, (RF, RF_IF), rd_rm), + cCL(nrmdz, ef081e0, 2, (RF, RF_IF), rd_rm), + cCL(nrme, ef88100, 2, (RF, RF_IF), rd_rm), + cCL(nrmep, ef88120, 2, (RF, RF_IF), rd_rm), + cCL(nrmem, ef88140, 2, (RF, RF_IF), rd_rm), + cCL(nrmez, ef88160, 2, (RF, RF_IF), rd_rm), + + cCL(adfs, e000100, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(adfsp, e000120, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(adfsm, e000140, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(adfsz, e000160, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(adfd, e000180, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(adfdp, e0001a0, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(adfdm, e0001c0, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(adfdz, e0001e0, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(adfe, e080100, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(adfep, e080120, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(adfem, e080140, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(adfez, e080160, 3, (RF, RF, RF_IF), rd_rn_rm), + + cCL(sufs, e200100, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(sufsp, e200120, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(sufsm, e200140, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(sufsz, e200160, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(sufd, e200180, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(sufdp, e2001a0, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(sufdm, e2001c0, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(sufdz, e2001e0, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(sufe, e280100, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(sufep, e280120, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(sufem, e280140, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(sufez, e280160, 3, (RF, RF, RF_IF), rd_rn_rm), + + cCL(rsfs, e300100, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(rsfsp, e300120, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(rsfsm, e300140, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(rsfsz, e300160, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(rsfd, e300180, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(rsfdp, e3001a0, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(rsfdm, e3001c0, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(rsfdz, e3001e0, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(rsfe, e380100, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(rsfep, e380120, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(rsfem, e380140, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(rsfez, e380160, 3, (RF, RF, RF_IF), rd_rn_rm), + + cCL(mufs, e100100, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(mufsp, e100120, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(mufsm, e100140, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(mufsz, e100160, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(mufd, e100180, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(mufdp, e1001a0, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(mufdm, e1001c0, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(mufdz, e1001e0, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(mufe, e180100, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(mufep, e180120, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(mufem, e180140, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(mufez, e180160, 3, (RF, RF, RF_IF), rd_rn_rm), + + cCL(dvfs, e400100, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(dvfsp, e400120, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(dvfsm, e400140, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(dvfsz, e400160, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(dvfd, e400180, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(dvfdp, e4001a0, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(dvfdm, e4001c0, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(dvfdz, e4001e0, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(dvfe, e480100, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(dvfep, e480120, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(dvfem, e480140, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(dvfez, e480160, 3, (RF, RF, RF_IF), rd_rn_rm), + + cCL(rdfs, e500100, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(rdfsp, e500120, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(rdfsm, e500140, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(rdfsz, e500160, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(rdfd, e500180, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(rdfdp, e5001a0, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(rdfdm, e5001c0, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(rdfdz, e5001e0, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(rdfe, e580100, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(rdfep, e580120, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(rdfem, e580140, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(rdfez, e580160, 3, (RF, RF, RF_IF), rd_rn_rm), + + cCL(pows, e600100, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(powsp, e600120, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(powsm, e600140, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(powsz, e600160, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(powd, e600180, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(powdp, e6001a0, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(powdm, e6001c0, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(powdz, e6001e0, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(powe, e680100, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(powep, e680120, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(powem, e680140, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(powez, e680160, 3, (RF, RF, RF_IF), rd_rn_rm), + + cCL(rpws, e700100, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(rpwsp, e700120, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(rpwsm, e700140, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(rpwsz, e700160, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(rpwd, e700180, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(rpwdp, e7001a0, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(rpwdm, e7001c0, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(rpwdz, e7001e0, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(rpwe, e780100, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(rpwep, e780120, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(rpwem, e780140, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(rpwez, e780160, 3, (RF, RF, RF_IF), rd_rn_rm), + + cCL(rmfs, e800100, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(rmfsp, e800120, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(rmfsm, e800140, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(rmfsz, e800160, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(rmfd, e800180, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(rmfdp, e8001a0, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(rmfdm, e8001c0, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(rmfdz, e8001e0, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(rmfe, e880100, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(rmfep, e880120, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(rmfem, e880140, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(rmfez, e880160, 3, (RF, RF, RF_IF), rd_rn_rm), + + cCL(fmls, e900100, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(fmlsp, e900120, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(fmlsm, e900140, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(fmlsz, e900160, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(fmld, e900180, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(fmldp, e9001a0, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(fmldm, e9001c0, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(fmldz, e9001e0, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(fmle, e980100, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(fmlep, e980120, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(fmlem, e980140, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(fmlez, e980160, 3, (RF, RF, RF_IF), rd_rn_rm), + + cCL(fdvs, ea00100, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(fdvsp, ea00120, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(fdvsm, ea00140, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(fdvsz, ea00160, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(fdvd, ea00180, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(fdvdp, ea001a0, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(fdvdm, ea001c0, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(fdvdz, ea001e0, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(fdve, ea80100, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(fdvep, ea80120, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(fdvem, ea80140, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(fdvez, ea80160, 3, (RF, RF, RF_IF), rd_rn_rm), + + cCL(frds, eb00100, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(frdsp, eb00120, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(frdsm, eb00140, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(frdsz, eb00160, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(frdd, eb00180, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(frddp, eb001a0, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(frddm, eb001c0, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(frddz, eb001e0, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(frde, eb80100, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(frdep, eb80120, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(frdem, eb80140, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(frdez, eb80160, 3, (RF, RF, RF_IF), rd_rn_rm), + + cCL(pols, ec00100, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(polsp, ec00120, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(polsm, ec00140, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(polsz, ec00160, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(pold, ec00180, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(poldp, ec001a0, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(poldm, ec001c0, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(poldz, ec001e0, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(pole, ec80100, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(polep, ec80120, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(polem, ec80140, 3, (RF, RF, RF_IF), rd_rn_rm), + cCL(polez, ec80160, 3, (RF, RF, RF_IF), rd_rn_rm), + + cCE(cmf, e90f110, 2, (RF, RF_IF), fpa_cmp), + C3E(cmfe, ed0f110, 2, (RF, RF_IF), fpa_cmp), + cCE(cnf, eb0f110, 2, (RF, RF_IF), fpa_cmp), + C3E(cnfe, ef0f110, 2, (RF, RF_IF), fpa_cmp), + + cCL(flts, e000110, 2, (RF, RR), rn_rd), + cCL(fltsp, e000130, 2, (RF, RR), rn_rd), + cCL(fltsm, e000150, 2, (RF, RR), rn_rd), + cCL(fltsz, e000170, 2, (RF, RR), rn_rd), + cCL(fltd, e000190, 2, (RF, RR), rn_rd), + cCL(fltdp, e0001b0, 2, (RF, RR), rn_rd), + cCL(fltdm, e0001d0, 2, (RF, RR), rn_rd), + cCL(fltdz, e0001f0, 2, (RF, RR), rn_rd), + cCL(flte, e080110, 2, (RF, RR), rn_rd), + cCL(fltep, e080130, 2, (RF, RR), rn_rd), + cCL(fltem, e080150, 2, (RF, RR), rn_rd), + cCL(fltez, e080170, 2, (RF, RR), rn_rd), + + /* The implementation of the FIX instruction is broken on some + assemblers, in that it accepts a precision specifier as well as a + rounding specifier, despite the fact that this is meaningless. + To be more compatible, we accept it as well, though of course it + does not set any bits. */ + cCE(fix, e100110, 2, (RR, RF), rd_rm), + cCL(fixp, e100130, 2, (RR, RF), rd_rm), + cCL(fixm, e100150, 2, (RR, RF), rd_rm), + cCL(fixz, e100170, 2, (RR, RF), rd_rm), + cCL(fixsp, e100130, 2, (RR, RF), rd_rm), + cCL(fixsm, e100150, 2, (RR, RF), rd_rm), + cCL(fixsz, e100170, 2, (RR, RF), rd_rm), + cCL(fixdp, e100130, 2, (RR, RF), rd_rm), + cCL(fixdm, e100150, 2, (RR, RF), rd_rm), + cCL(fixdz, e100170, 2, (RR, RF), rd_rm), + cCL(fixep, e100130, 2, (RR, RF), rd_rm), + cCL(fixem, e100150, 2, (RR, RF), rd_rm), + cCL(fixez, e100170, 2, (RR, RF), rd_rm), + + /* Instructions that were new with the real FPA, call them V2. */ +#undef ARM_VARIANT +#define ARM_VARIANT &fpu_fpa_ext_v2 + cCE(lfm, c100200, 3, (RF, I4b, ADDR), fpa_ldmstm), + cCL(lfmfd, c900200, 3, (RF, I4b, ADDR), fpa_ldmstm), + cCL(lfmea, d100200, 3, (RF, I4b, ADDR), fpa_ldmstm), + cCE(sfm, c000200, 3, (RF, I4b, ADDR), fpa_ldmstm), + cCL(sfmfd, d000200, 3, (RF, I4b, ADDR), fpa_ldmstm), + cCL(sfmea, c800200, 3, (RF, I4b, ADDR), fpa_ldmstm), + +#undef ARM_VARIANT +#define ARM_VARIANT &fpu_vfp_ext_v1xd /* VFP V1xD (single precision). */ + /* Moves and type conversions. */ + cCE(fcpys, eb00a40, 2, (RVS, RVS), vfp_sp_monadic), + cCE(fmrs, e100a10, 2, (RR, RVS), vfp_reg_from_sp), + cCE(fmsr, e000a10, 2, (RVS, RR), vfp_sp_from_reg), + cCE(fmstat, ef1fa10, 0, (), noargs), + cCE(fsitos, eb80ac0, 2, (RVS, RVS), vfp_sp_monadic), + cCE(fuitos, eb80a40, 2, (RVS, RVS), vfp_sp_monadic), + cCE(ftosis, ebd0a40, 2, (RVS, RVS), vfp_sp_monadic), + cCE(ftosizs, ebd0ac0, 2, (RVS, RVS), vfp_sp_monadic), + cCE(ftouis, ebc0a40, 2, (RVS, RVS), vfp_sp_monadic), + cCE(ftouizs, ebc0ac0, 2, (RVS, RVS), vfp_sp_monadic), + cCE(fmrx, ef00a10, 2, (RR, RVC), rd_rn), + cCE(fmxr, ee00a10, 2, (RVC, RR), rn_rd), + + /* Memory operations. */ + cCE(flds, d100a00, 2, (RVS, ADDR), vfp_sp_ldst), + cCE(fsts, d000a00, 2, (RVS, ADDR), vfp_sp_ldst), + cCE(fldmias, c900a00, 2, (RRw, VRSLST), vfp_sp_ldstmia), + cCE(fldmfds, c900a00, 2, (RRw, VRSLST), vfp_sp_ldstmia), + cCE(fldmdbs, d300a00, 2, (RRw, VRSLST), vfp_sp_ldstmdb), + cCE(fldmeas, d300a00, 2, (RRw, VRSLST), vfp_sp_ldstmdb), + cCE(fldmiax, c900b00, 2, (RRw, VRDLST), vfp_xp_ldstmia), + cCE(fldmfdx, c900b00, 2, (RRw, VRDLST), vfp_xp_ldstmia), + cCE(fldmdbx, d300b00, 2, (RRw, VRDLST), vfp_xp_ldstmdb), + cCE(fldmeax, d300b00, 2, (RRw, VRDLST), vfp_xp_ldstmdb), + cCE(fstmias, c800a00, 2, (RRw, VRSLST), vfp_sp_ldstmia), + cCE(fstmeas, c800a00, 2, (RRw, VRSLST), vfp_sp_ldstmia), + cCE(fstmdbs, d200a00, 2, (RRw, VRSLST), vfp_sp_ldstmdb), + cCE(fstmfds, d200a00, 2, (RRw, VRSLST), vfp_sp_ldstmdb), + cCE(fstmiax, c800b00, 2, (RRw, VRDLST), vfp_xp_ldstmia), + cCE(fstmeax, c800b00, 2, (RRw, VRDLST), vfp_xp_ldstmia), + cCE(fstmdbx, d200b00, 2, (RRw, VRDLST), vfp_xp_ldstmdb), + cCE(fstmfdx, d200b00, 2, (RRw, VRDLST), vfp_xp_ldstmdb), + + /* Monadic operations. */ + cCE(fabss, eb00ac0, 2, (RVS, RVS), vfp_sp_monadic), + cCE(fnegs, eb10a40, 2, (RVS, RVS), vfp_sp_monadic), + cCE(fsqrts, eb10ac0, 2, (RVS, RVS), vfp_sp_monadic), + + /* Dyadic operations. */ + cCE(fadds, e300a00, 3, (RVS, RVS, RVS), vfp_sp_dyadic), + cCE(fsubs, e300a40, 3, (RVS, RVS, RVS), vfp_sp_dyadic), + cCE(fmuls, e200a00, 3, (RVS, RVS, RVS), vfp_sp_dyadic), + cCE(fdivs, e800a00, 3, (RVS, RVS, RVS), vfp_sp_dyadic), + cCE(fmacs, e000a00, 3, (RVS, RVS, RVS), vfp_sp_dyadic), + cCE(fmscs, e100a00, 3, (RVS, RVS, RVS), vfp_sp_dyadic), + cCE(fnmuls, e200a40, 3, (RVS, RVS, RVS), vfp_sp_dyadic), + cCE(fnmacs, e000a40, 3, (RVS, RVS, RVS), vfp_sp_dyadic), + cCE(fnmscs, e100a40, 3, (RVS, RVS, RVS), vfp_sp_dyadic), + + /* Comparisons. */ + cCE(fcmps, eb40a40, 2, (RVS, RVS), vfp_sp_monadic), + cCE(fcmpzs, eb50a40, 1, (RVS), vfp_sp_compare_z), + cCE(fcmpes, eb40ac0, 2, (RVS, RVS), vfp_sp_monadic), + cCE(fcmpezs, eb50ac0, 1, (RVS), vfp_sp_compare_z), + +#undef ARM_VARIANT +#define ARM_VARIANT &fpu_vfp_ext_v1 /* VFP V1 (Double precision). */ + /* Moves and type conversions. */ + cCE(fcpyd, eb00b40, 2, (RVD, RVD), rd_rm), + cCE(fcvtds, eb70ac0, 2, (RVD, RVS), vfp_dp_sp_cvt), + cCE(fcvtsd, eb70bc0, 2, (RVS, RVD), vfp_sp_dp_cvt), + cCE(fmdhr, e200b10, 2, (RVD, RR), rn_rd), + cCE(fmdlr, e000b10, 2, (RVD, RR), rn_rd), + cCE(fmrdh, e300b10, 2, (RR, RVD), rd_rn), + cCE(fmrdl, e100b10, 2, (RR, RVD), rd_rn), + cCE(fsitod, eb80bc0, 2, (RVD, RVS), vfp_dp_sp_cvt), + cCE(fuitod, eb80b40, 2, (RVD, RVS), vfp_dp_sp_cvt), + cCE(ftosid, ebd0b40, 2, (RVS, RVD), vfp_sp_dp_cvt), + cCE(ftosizd, ebd0bc0, 2, (RVS, RVD), vfp_sp_dp_cvt), + cCE(ftouid, ebc0b40, 2, (RVS, RVD), vfp_sp_dp_cvt), + cCE(ftouizd, ebc0bc0, 2, (RVS, RVD), vfp_sp_dp_cvt), + + /* Memory operations. */ + cCE(fldd, d100b00, 2, (RVD, ADDR), vfp_dp_ldst), + cCE(fstd, d000b00, 2, (RVD, ADDR), vfp_dp_ldst), + cCE(fldmiad, c900b00, 2, (RRw, VRDLST), vfp_dp_ldstmia), + cCE(fldmfdd, c900b00, 2, (RRw, VRDLST), vfp_dp_ldstmia), + cCE(fldmdbd, d300b00, 2, (RRw, VRDLST), vfp_dp_ldstmdb), + cCE(fldmead, d300b00, 2, (RRw, VRDLST), vfp_dp_ldstmdb), + cCE(fstmiad, c800b00, 2, (RRw, VRDLST), vfp_dp_ldstmia), + cCE(fstmead, c800b00, 2, (RRw, VRDLST), vfp_dp_ldstmia), + cCE(fstmdbd, d200b00, 2, (RRw, VRDLST), vfp_dp_ldstmdb), + cCE(fstmfdd, d200b00, 2, (RRw, VRDLST), vfp_dp_ldstmdb), + + /* Monadic operations. */ + cCE(fabsd, eb00bc0, 2, (RVD, RVD), rd_rm), + cCE(fnegd, eb10b40, 2, (RVD, RVD), rd_rm), + cCE(fsqrtd, eb10bc0, 2, (RVD, RVD), rd_rm), + + /* Dyadic operations. */ + cCE(faddd, e300b00, 3, (RVD, RVD, RVD), rd_rn_rm), + cCE(fsubd, e300b40, 3, (RVD, RVD, RVD), rd_rn_rm), + cCE(fmuld, e200b00, 3, (RVD, RVD, RVD), rd_rn_rm), + cCE(fdivd, e800b00, 3, (RVD, RVD, RVD), rd_rn_rm), + cCE(fmacd, e000b00, 3, (RVD, RVD, RVD), rd_rn_rm), + cCE(fmscd, e100b00, 3, (RVD, RVD, RVD), rd_rn_rm), + cCE(fnmuld, e200b40, 3, (RVD, RVD, RVD), rd_rn_rm), + cCE(fnmacd, e000b40, 3, (RVD, RVD, RVD), rd_rn_rm), + cCE(fnmscd, e100b40, 3, (RVD, RVD, RVD), rd_rn_rm), + + /* Comparisons. */ + cCE(fcmpd, eb40b40, 2, (RVD, RVD), rd_rm), + cCE(fcmpzd, eb50b40, 1, (RVD), rd), + cCE(fcmped, eb40bc0, 2, (RVD, RVD), rd_rm), + cCE(fcmpezd, eb50bc0, 1, (RVD), rd), + +#undef ARM_VARIANT +#define ARM_VARIANT &fpu_vfp_ext_v2 + cCE(fmsrr, c400a10, 3, (VRSLST, RR, RR), vfp_sp2_from_reg2), + cCE(fmrrs, c500a10, 3, (RR, RR, VRSLST), vfp_reg2_from_sp2), + cCE(fmdrr, c400b10, 3, (RVD, RR, RR), rm_rd_rn), + cCE(fmrrd, c500b10, 3, (RR, RR, RVD), rd_rn_rm), + +#undef ARM_VARIANT +#define ARM_VARIANT &arm_cext_xscale /* Intel XScale extensions. */ + cCE(mia, e200010, 3, (RXA, RRnpc, RRnpc), xsc_mia), + cCE(miaph, e280010, 3, (RXA, RRnpc, RRnpc), xsc_mia), + cCE(miabb, e2c0010, 3, (RXA, RRnpc, RRnpc), xsc_mia), + cCE(miabt, e2d0010, 3, (RXA, RRnpc, RRnpc), xsc_mia), + cCE(miatb, e2e0010, 3, (RXA, RRnpc, RRnpc), xsc_mia), + cCE(miatt, e2f0010, 3, (RXA, RRnpc, RRnpc), xsc_mia), + cCE(mar, c400000, 3, (RXA, RRnpc, RRnpc), xsc_mar), + cCE(mra, c500000, 3, (RRnpc, RRnpc, RXA), xsc_mra), + +#undef ARM_VARIANT +#define ARM_VARIANT &arm_cext_iwmmxt /* Intel Wireless MMX technology. */ + cCE(tandcb, e13f130, 1, (RR), iwmmxt_tandorc), + cCE(tandch, e53f130, 1, (RR), iwmmxt_tandorc), + cCE(tandcw, e93f130, 1, (RR), iwmmxt_tandorc), + cCE(tbcstb, e400010, 2, (RIWR, RR), rn_rd), + cCE(tbcsth, e400050, 2, (RIWR, RR), rn_rd), + cCE(tbcstw, e400090, 2, (RIWR, RR), rn_rd), + cCE(textrcb, e130170, 2, (RR, I7), iwmmxt_textrc), + cCE(textrch, e530170, 2, (RR, I7), iwmmxt_textrc), + cCE(textrcw, e930170, 2, (RR, I7), iwmmxt_textrc), + cCE(textrmub, e100070, 3, (RR, RIWR, I7), iwmmxt_textrm), + cCE(textrmuh, e500070, 3, (RR, RIWR, I7), iwmmxt_textrm), + cCE(textrmuw, e900070, 3, (RR, RIWR, I7), iwmmxt_textrm), + cCE(textrmsb, e100078, 3, (RR, RIWR, I7), iwmmxt_textrm), + cCE(textrmsh, e500078, 3, (RR, RIWR, I7), iwmmxt_textrm), + cCE(textrmsw, e900078, 3, (RR, RIWR, I7), iwmmxt_textrm), + cCE(tinsrb, e600010, 3, (RIWR, RR, I7), iwmmxt_tinsr), + cCE(tinsrh, e600050, 3, (RIWR, RR, I7), iwmmxt_tinsr), + cCE(tinsrw, e600090, 3, (RIWR, RR, I7), iwmmxt_tinsr), + cCE(tmcr, e000110, 2, (RIWC, RR), rn_rd), + cCE(tmcrr, c400000, 3, (RIWR, RR, RR), rm_rd_rn), + cCE(tmia, e200010, 3, (RIWR, RR, RR), iwmmxt_tmia), + cCE(tmiaph, e280010, 3, (RIWR, RR, RR), iwmmxt_tmia), + cCE(tmiabb, e2c0010, 3, (RIWR, RR, RR), iwmmxt_tmia), + cCE(tmiabt, e2d0010, 3, (RIWR, RR, RR), iwmmxt_tmia), + cCE(tmiatb, e2e0010, 3, (RIWR, RR, RR), iwmmxt_tmia), + cCE(tmiatt, e2f0010, 3, (RIWR, RR, RR), iwmmxt_tmia), + cCE(tmovmskb, e100030, 2, (RR, RIWR), rd_rn), + cCE(tmovmskh, e500030, 2, (RR, RIWR), rd_rn), + cCE(tmovmskw, e900030, 2, (RR, RIWR), rd_rn), + cCE(tmrc, e100110, 2, (RR, RIWC), rd_rn), + cCE(tmrrc, c500000, 3, (RR, RR, RIWR), rd_rn_rm), + cCE(torcb, e13f150, 1, (RR), iwmmxt_tandorc), + cCE(torch, e53f150, 1, (RR), iwmmxt_tandorc), + cCE(torcw, e93f150, 1, (RR), iwmmxt_tandorc), + cCE(waccb, e0001c0, 2, (RIWR, RIWR), rd_rn), + cCE(wacch, e4001c0, 2, (RIWR, RIWR), rd_rn), + cCE(waccw, e8001c0, 2, (RIWR, RIWR), rd_rn), + cCE(waddbss, e300180, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(waddb, e000180, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(waddbus, e100180, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(waddhss, e700180, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(waddh, e400180, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(waddhus, e500180, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(waddwss, eb00180, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(waddw, e800180, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(waddwus, e900180, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(waligni, e000020, 4, (RIWR, RIWR, RIWR, I7), iwmmxt_waligni), + cCE(walignr0, e800020, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(walignr1, e900020, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(walignr2, ea00020, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(walignr3, eb00020, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wand, e200000, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wandn, e300000, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wavg2b, e800000, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wavg2br, e900000, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wavg2h, ec00000, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wavg2hr, ed00000, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wcmpeqb, e000060, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wcmpeqh, e400060, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wcmpeqw, e800060, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wcmpgtub, e100060, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wcmpgtuh, e500060, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wcmpgtuw, e900060, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wcmpgtsb, e300060, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wcmpgtsh, e700060, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wcmpgtsw, eb00060, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wldrb, c100000, 2, (RIWR, ADDR), iwmmxt_wldstbh), + cCE(wldrh, c500000, 2, (RIWR, ADDR), iwmmxt_wldstbh), + cCE(wldrw, c100100, 2, (RIWR_RIWC, ADDR), iwmmxt_wldstw), + cCE(wldrd, c500100, 2, (RIWR, ADDR), iwmmxt_wldstd), + cCE(wmacs, e600100, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wmacsz, e700100, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wmacu, e400100, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wmacuz, e500100, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wmadds, ea00100, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wmaddu, e800100, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wmaxsb, e200160, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wmaxsh, e600160, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wmaxsw, ea00160, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wmaxub, e000160, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wmaxuh, e400160, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wmaxuw, e800160, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wminsb, e300160, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wminsh, e700160, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wminsw, eb00160, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wminub, e100160, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wminuh, e500160, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wminuw, e900160, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wmov, e000000, 2, (RIWR, RIWR), iwmmxt_wmov), + cCE(wmulsm, e300100, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wmulsl, e200100, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wmulum, e100100, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wmulul, e000100, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wor, e000000, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wpackhss, e700080, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wpackhus, e500080, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wpackwss, eb00080, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wpackwus, e900080, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wpackdss, ef00080, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wpackdus, ed00080, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wrorh, e700040, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wrorhg, e700148, 3, (RIWR, RIWR, RIWG), rd_rn_rm), + cCE(wrorw, eb00040, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wrorwg, eb00148, 3, (RIWR, RIWR, RIWG), rd_rn_rm), + cCE(wrord, ef00040, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wrordg, ef00148, 3, (RIWR, RIWR, RIWG), rd_rn_rm), + cCE(wsadb, e000120, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wsadbz, e100120, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wsadh, e400120, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wsadhz, e500120, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wshufh, e0001e0, 3, (RIWR, RIWR, I255), iwmmxt_wshufh), + cCE(wsllh, e500040, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wsllhg, e500148, 3, (RIWR, RIWR, RIWG), rd_rn_rm), + cCE(wsllw, e900040, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wsllwg, e900148, 3, (RIWR, RIWR, RIWG), rd_rn_rm), + cCE(wslld, ed00040, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wslldg, ed00148, 3, (RIWR, RIWR, RIWG), rd_rn_rm), + cCE(wsrah, e400040, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wsrahg, e400148, 3, (RIWR, RIWR, RIWG), rd_rn_rm), + cCE(wsraw, e800040, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wsrawg, e800148, 3, (RIWR, RIWR, RIWG), rd_rn_rm), + cCE(wsrad, ec00040, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wsradg, ec00148, 3, (RIWR, RIWR, RIWG), rd_rn_rm), + cCE(wsrlh, e600040, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wsrlhg, e600148, 3, (RIWR, RIWR, RIWG), rd_rn_rm), + cCE(wsrlw, ea00040, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wsrlwg, ea00148, 3, (RIWR, RIWR, RIWG), rd_rn_rm), + cCE(wsrld, ee00040, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wsrldg, ee00148, 3, (RIWR, RIWR, RIWG), rd_rn_rm), + cCE(wstrb, c000000, 2, (RIWR, ADDR), iwmmxt_wldstbh), + cCE(wstrh, c400000, 2, (RIWR, ADDR), iwmmxt_wldstbh), + cCE(wstrw, c000100, 2, (RIWR_RIWC, ADDR), iwmmxt_wldstw), + cCE(wstrd, c400100, 2, (RIWR, ADDR), iwmmxt_wldstd), + cCE(wsubbss, e3001a0, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wsubb, e0001a0, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wsubbus, e1001a0, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wsubhss, e7001a0, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wsubh, e4001a0, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wsubhus, e5001a0, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wsubwss, eb001a0, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wsubw, e8001a0, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wsubwus, e9001a0, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wunpckehub,e0000c0, 2, (RIWR, RIWR), rd_rn), + cCE(wunpckehuh,e4000c0, 2, (RIWR, RIWR), rd_rn), + cCE(wunpckehuw,e8000c0, 2, (RIWR, RIWR), rd_rn), + cCE(wunpckehsb,e2000c0, 2, (RIWR, RIWR), rd_rn), + cCE(wunpckehsh,e6000c0, 2, (RIWR, RIWR), rd_rn), + cCE(wunpckehsw,ea000c0, 2, (RIWR, RIWR), rd_rn), + cCE(wunpckihb, e1000c0, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wunpckihh, e5000c0, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wunpckihw, e9000c0, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wunpckelub,e0000e0, 2, (RIWR, RIWR), rd_rn), + cCE(wunpckeluh,e4000e0, 2, (RIWR, RIWR), rd_rn), + cCE(wunpckeluw,e8000e0, 2, (RIWR, RIWR), rd_rn), + cCE(wunpckelsb,e2000e0, 2, (RIWR, RIWR), rd_rn), + cCE(wunpckelsh,e6000e0, 2, (RIWR, RIWR), rd_rn), + cCE(wunpckelsw,ea000e0, 2, (RIWR, RIWR), rd_rn), + cCE(wunpckilb, e1000e0, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wunpckilh, e5000e0, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wunpckilw, e9000e0, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wxor, e100000, 3, (RIWR, RIWR, RIWR), rd_rn_rm), + cCE(wzero, e300000, 1, (RIWR), iwmmxt_wzero), + +#undef ARM_VARIANT +#define ARM_VARIANT &arm_cext_maverick /* Cirrus Maverick instructions. */ + cCE(cfldrs, c100400, 2, (RMF, ADDR), rd_cpaddr), + cCE(cfldrd, c500400, 2, (RMD, ADDR), rd_cpaddr), + cCE(cfldr32, c100500, 2, (RMFX, ADDR), rd_cpaddr), + cCE(cfldr64, c500500, 2, (RMDX, ADDR), rd_cpaddr), + cCE(cfstrs, c000400, 2, (RMF, ADDR), rd_cpaddr), + cCE(cfstrd, c400400, 2, (RMD, ADDR), rd_cpaddr), + cCE(cfstr32, c000500, 2, (RMFX, ADDR), rd_cpaddr), + cCE(cfstr64, c400500, 2, (RMDX, ADDR), rd_cpaddr), + cCE(cfmvsr, e000450, 2, (RMF, RR), rn_rd), + cCE(cfmvrs, e100450, 2, (RR, RMF), rd_rn), + cCE(cfmvdlr, e000410, 2, (RMD, RR), rn_rd), + cCE(cfmvrdl, e100410, 2, (RR, RMD), rd_rn), + cCE(cfmvdhr, e000430, 2, (RMD, RR), rn_rd), + cCE(cfmvrdh, e100430, 2, (RR, RMD), rd_rn), + cCE(cfmv64lr, e000510, 2, (RMDX, RR), rn_rd), + cCE(cfmvr64l, e100510, 2, (RR, RMDX), rd_rn), + cCE(cfmv64hr, e000530, 2, (RMDX, RR), rn_rd), + cCE(cfmvr64h, e100530, 2, (RR, RMDX), rd_rn), + cCE(cfmval32, e200440, 2, (RMAX, RMFX), rd_rn), + cCE(cfmv32al, e100440, 2, (RMFX, RMAX), rd_rn), + cCE(cfmvam32, e200460, 2, (RMAX, RMFX), rd_rn), + cCE(cfmv32am, e100460, 2, (RMFX, RMAX), rd_rn), + cCE(cfmvah32, e200480, 2, (RMAX, RMFX), rd_rn), + cCE(cfmv32ah, e100480, 2, (RMFX, RMAX), rd_rn), + cCE(cfmva32, e2004a0, 2, (RMAX, RMFX), rd_rn), + cCE(cfmv32a, e1004a0, 2, (RMFX, RMAX), rd_rn), + cCE(cfmva64, e2004c0, 2, (RMAX, RMDX), rd_rn), + cCE(cfmv64a, e1004c0, 2, (RMDX, RMAX), rd_rn), + cCE(cfmvsc32, e2004e0, 2, (RMDS, RMDX), mav_dspsc), + cCE(cfmv32sc, e1004e0, 2, (RMDX, RMDS), rd), + cCE(cfcpys, e000400, 2, (RMF, RMF), rd_rn), + cCE(cfcpyd, e000420, 2, (RMD, RMD), rd_rn), + cCE(cfcvtsd, e000460, 2, (RMD, RMF), rd_rn), + cCE(cfcvtds, e000440, 2, (RMF, RMD), rd_rn), + cCE(cfcvt32s, e000480, 2, (RMF, RMFX), rd_rn), + cCE(cfcvt32d, e0004a0, 2, (RMD, RMFX), rd_rn), + cCE(cfcvt64s, e0004c0, 2, (RMF, RMDX), rd_rn), + cCE(cfcvt64d, e0004e0, 2, (RMD, RMDX), rd_rn), + cCE(cfcvts32, e100580, 2, (RMFX, RMF), rd_rn), + cCE(cfcvtd32, e1005a0, 2, (RMFX, RMD), rd_rn), + cCE(cftruncs32,e1005c0, 2, (RMFX, RMF), rd_rn), + cCE(cftruncd32,e1005e0, 2, (RMFX, RMD), rd_rn), + cCE(cfrshl32, e000550, 3, (RMFX, RMFX, RR), mav_triple), + cCE(cfrshl64, e000570, 3, (RMDX, RMDX, RR), mav_triple), + cCE(cfsh32, e000500, 3, (RMFX, RMFX, I63s), mav_shift), + cCE(cfsh64, e200500, 3, (RMDX, RMDX, I63s), mav_shift), + cCE(cfcmps, e100490, 3, (RR, RMF, RMF), rd_rn_rm), + cCE(cfcmpd, e1004b0, 3, (RR, RMD, RMD), rd_rn_rm), + cCE(cfcmp32, e100590, 3, (RR, RMFX, RMFX), rd_rn_rm), + cCE(cfcmp64, e1005b0, 3, (RR, RMDX, RMDX), rd_rn_rm), + cCE(cfabss, e300400, 2, (RMF, RMF), rd_rn), + cCE(cfabsd, e300420, 2, (RMD, RMD), rd_rn), + cCE(cfnegs, e300440, 2, (RMF, RMF), rd_rn), + cCE(cfnegd, e300460, 2, (RMD, RMD), rd_rn), + cCE(cfadds, e300480, 3, (RMF, RMF, RMF), rd_rn_rm), + cCE(cfaddd, e3004a0, 3, (RMD, RMD, RMD), rd_rn_rm), + cCE(cfsubs, e3004c0, 3, (RMF, RMF, RMF), rd_rn_rm), + cCE(cfsubd, e3004e0, 3, (RMD, RMD, RMD), rd_rn_rm), + cCE(cfmuls, e100400, 3, (RMF, RMF, RMF), rd_rn_rm), + cCE(cfmuld, e100420, 3, (RMD, RMD, RMD), rd_rn_rm), + cCE(cfabs32, e300500, 2, (RMFX, RMFX), rd_rn), + cCE(cfabs64, e300520, 2, (RMDX, RMDX), rd_rn), + cCE(cfneg32, e300540, 2, (RMFX, RMFX), rd_rn), + cCE(cfneg64, e300560, 2, (RMDX, RMDX), rd_rn), + cCE(cfadd32, e300580, 3, (RMFX, RMFX, RMFX), rd_rn_rm), + cCE(cfadd64, e3005a0, 3, (RMDX, RMDX, RMDX), rd_rn_rm), + cCE(cfsub32, e3005c0, 3, (RMFX, RMFX, RMFX), rd_rn_rm), + cCE(cfsub64, e3005e0, 3, (RMDX, RMDX, RMDX), rd_rn_rm), + cCE(cfmul32, e100500, 3, (RMFX, RMFX, RMFX), rd_rn_rm), + cCE(cfmul64, e100520, 3, (RMDX, RMDX, RMDX), rd_rn_rm), + cCE(cfmac32, e100540, 3, (RMFX, RMFX, RMFX), rd_rn_rm), + cCE(cfmsc32, e100560, 3, (RMFX, RMFX, RMFX), rd_rn_rm), + cCE(cfmadd32, e000600, 4, (RMAX, RMFX, RMFX, RMFX), mav_quad), + cCE(cfmsub32, e100600, 4, (RMAX, RMFX, RMFX, RMFX), mav_quad), + cCE(cfmadda32, e200600, 4, (RMAX, RMAX, RMFX, RMFX), mav_quad), + cCE(cfmsuba32, e300600, 4, (RMAX, RMAX, RMFX, RMFX), mav_quad), +}; +#undef ARM_VARIANT +#undef THUMB_VARIANT +#undef TCE +#undef TCM +#undef TUE +#undef TUF +#undef TCC +#undef cCE +#undef cCL +#undef C3E +#undef CE +#undef CM +#undef UE +#undef UF +#undef UT +#undef OPS0 +#undef OPS1 +#undef OPS2 +#undef OPS3 +#undef OPS4 +#undef OPS5 +#undef OPS6 +#undef do_0 + +/* MD interface: bits in the object file. */ + +/* Turn an integer of n bytes (in val) into a stream of bytes appropriate + for use in the a.out file, and stores them in the array pointed to by buf. + This knows about the endian-ness of the target machine and does + THE RIGHT THING, whatever it is. Possible values for n are 1 (byte) + 2 (short) and 4 (long) Floating numbers are put out as a series of + LITTLENUMS (shorts, here at least). */ -#if defined OBJ_COFF || defined OBJ_ELF void -arm_validate_fix (fixP) - fixS * fixP; -{ - /* If the destination of the branch is a defined symbol which does not have - the THUMB_FUNC attribute, then we must be calling a function which has - the (interfacearm) attribute. We look for the Thumb entry point to that - function and change the branch to refer to that function instead. */ - if (fixP->fx_r_type == BFD_RELOC_THUMB_PCREL_BRANCH23 - && fixP->fx_addsy != NULL - && S_IS_DEFINED (fixP->fx_addsy) - && ! THUMB_IS_FUNC (fixP->fx_addsy)) - { - fixP->fx_addsy = find_real_start (fixP->fx_addsy); - } -} -#endif - -int -arm_force_relocation (fixp) - struct fix * fixp; -{ -#if defined (OBJ_COFF) && defined (TE_PE) - if (fixp->fx_r_type == BFD_RELOC_RVA) - return 1; -#endif -#ifdef OBJ_ELF - if (fixp->fx_r_type == BFD_RELOC_ARM_PCREL_BRANCH - || fixp->fx_r_type == BFD_RELOC_ARM_PCREL_BLX - || fixp->fx_r_type == BFD_RELOC_THUMB_PCREL_BLX - || fixp->fx_r_type == BFD_RELOC_THUMB_PCREL_BRANCH23) - return 1; -#endif - - /* Resolve these relocations even if the symbol is extern or weak. */ - if (fixp->fx_r_type == BFD_RELOC_ARM_IMMEDIATE - || fixp->fx_r_type == BFD_RELOC_ARM_OFFSET_IMM - || fixp->fx_r_type == BFD_RELOC_ARM_ADRL_IMMEDIATE) - return 0; - - return generic_force_reloc (fixp); -} - -#ifdef OBJ_COFF -/* This is a little hack to help the gas/arm/adrl.s test. It prevents - local labels from being added to the output symbol table when they - are used with the ADRL pseudo op. The ADRL relocation should always - be resolved before the binbary is emitted, so it is safe to say that - it is adjustable. */ - -bfd_boolean -arm_fix_adjustable (fixP) - fixS * fixP; -{ - if (fixP->fx_r_type == BFD_RELOC_ARM_ADRL_IMMEDIATE) - return 1; - return 0; -} -#endif - -#ifdef OBJ_ELF -/* Relocations against Thumb function names must be left unadjusted, - so that the linker can use this information to correctly set the - bottom bit of their addresses. The MIPS version of this function - also prevents relocations that are mips-16 specific, but I do not - know why it does this. - - FIXME: - There is one other problem that ought to be addressed here, but - which currently is not: Taking the address of a label (rather - than a function) and then later jumping to that address. Such - addresses also ought to have their bottom bit set (assuming that - they reside in Thumb code), but at the moment they will not. */ - -bfd_boolean -arm_fix_adjustable (fixP) - fixS * fixP; -{ - if (fixP->fx_addsy == NULL) - return 1; - - if (THUMB_IS_FUNC (fixP->fx_addsy) - && fixP->fx_subsy == NULL) - return 0; - - /* We need the symbol name for the VTABLE entries. */ - if ( fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT - || fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY) - return 0; - - /* Don't allow symbols to be discarded on GOT related relocs. */ - if (fixP->fx_r_type == BFD_RELOC_ARM_PLT32 - || fixP->fx_r_type == BFD_RELOC_ARM_GOT32 - || fixP->fx_r_type == BFD_RELOC_ARM_GOTOFF) - return 0; - - return 1; -} - -const char * -elf32_arm_target_format () +md_number_to_chars (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); +} + +static valueT +md_chars_to_number (char * buf, int n) +{ + valueT result = 0; + unsigned char * where = (unsigned char *) buf; + if (target_big_endian) { - if (target_oabi) - return "elf32-bigarm-oabi"; - else - return "elf32-bigarm"; + while (n--) + { + result <<= 8; + result |= (*where++ & 255); + } } else { - if (target_oabi) - return "elf32-littlearm-oabi"; - else - return "elf32-littlearm"; + while (n--) + { + result <<= 8; + result |= (where[n] & 255); + } } + + return result; } +/* MD interface: Sections. */ + +/* Estimate the size of a frag before relaxing. Assume everything fits in + 2 bytes. */ + +int +md_estimate_size_before_relax (fragS * fragp, + segT segtype ATTRIBUTE_UNUSED) +{ + fragp->fr_var = 2; + return 2; +} + +/* Convert a machine dependent frag. */ + void -armelf_frob_symbol (symp, puntp) - symbolS * symp; - int * puntp; -{ - elf_frob_symbol (symp, puntp); -} - -static bfd_reloc_code_real_type -arm_parse_reloc () -{ - char id [16]; - char * ip; - unsigned int i; - static struct - { - char * str; - int len; - bfd_reloc_code_real_type reloc; - } - reloc_map[] = - { -#define MAP(str,reloc) { str, sizeof (str) - 1, reloc } - MAP ("(got)", BFD_RELOC_ARM_GOT32), - MAP ("(gotoff)", BFD_RELOC_ARM_GOTOFF), - /* ScottB: Jan 30, 1998 - Added support for parsing "var(PLT)" - branch instructions generated by GCC for PLT relocs. */ - MAP ("(plt)", BFD_RELOC_ARM_PLT32), - { NULL, 0, BFD_RELOC_UNUSED } -#undef MAP - }; - - for (i = 0, ip = input_line_pointer; - i < sizeof (id) && (ISALNUM (*ip) || ISPUNCT (*ip)); - i++, ip++) - id[i] = TOLOWER (*ip); - - for (i = 0; reloc_map[i].str; i++) - if (strncmp (id, reloc_map[i].str, reloc_map[i].len) == 0) - break; - - input_line_pointer += reloc_map[i].len; - - return reloc_map[i].reloc; -} - -static void -s_arm_elf_cons (nbytes) - int nbytes; +md_convert_frag (bfd *abfd, segT asec ATTRIBUTE_UNUSED, fragS *fragp) { + unsigned long insn; + unsigned long old_op; + char *buf; expressionS exp; + fixS *fixp; + int reloc_type; + int pc_rel; + int opcode; -#ifdef md_flush_pending_output - md_flush_pending_output (); -#endif + buf = fragp->fr_literal + fragp->fr_fix; - if (is_it_end_of_statement ()) + old_op = bfd_get_16(abfd, buf); + if (fragp->fr_symbol) { + exp.X_op = O_symbol; + exp.X_add_symbol = fragp->fr_symbol; + } else { + exp.X_op = O_constant; + } + exp.X_add_number = fragp->fr_offset; + opcode = fragp->fr_subtype; + switch (opcode) { - demand_empty_rest_of_line (); - return; - } - -#ifdef md_cons_align - md_cons_align (nbytes); -#endif - - mapping_state (MAP_DATA); - do - { - bfd_reloc_code_real_type reloc; - - expression (& exp); - - if (exp.X_op == O_symbol - && * input_line_pointer == '(' - && (reloc = arm_parse_reloc ()) != BFD_RELOC_UNUSED) + case T_MNEM_ldr_pc: + case T_MNEM_ldr_pc2: + case T_MNEM_ldr_sp: + case T_MNEM_str_sp: + case T_MNEM_ldr: + case T_MNEM_ldrb: + case T_MNEM_ldrh: + case T_MNEM_str: + case T_MNEM_strb: + case T_MNEM_strh: + if (fragp->fr_var == 4) { - reloc_howto_type *howto = bfd_reloc_type_lookup (stdoutput, reloc); - int size = bfd_get_reloc_size (howto); - - if (size > nbytes) - as_bad ("%s relocations do not fit in %d bytes", - howto->name, nbytes); + insn = THUMB_OP32(opcode); + if ((old_op >> 12) == 4 || (old_op >> 12) == 9) + { + insn |= (old_op & 0x700) << 4; + } else { - register char *p = frag_more ((int) nbytes); - int offset = nbytes - size; - - fix_new_exp (frag_now, p - frag_now->fr_literal + offset, size, - &exp, 0, reloc); + insn |= (old_op & 7) << 12; + insn |= (old_op & 0x38) << 13; } + insn |= 0x00000c00; + put_thumb32_insn (buf, insn); + reloc_type = BFD_RELOC_ARM_T32_OFFSET_IMM; } else - emit_expr (&exp, (unsigned int) nbytes); - } - while (*input_line_pointer++ == ','); + { + reloc_type = BFD_RELOC_ARM_THUMB_OFFSET; + } + pc_rel = (opcode == T_MNEM_ldr_pc2); + break; + case T_MNEM_adr: + if (fragp->fr_var == 4) + { + insn = THUMB_OP32 (opcode); + insn |= (old_op & 0xf0) << 4; + put_thumb32_insn (buf, insn); + reloc_type = BFD_RELOC_ARM_T32_ADD_PC12; + } + else + { + reloc_type = BFD_RELOC_ARM_THUMB_ADD; + exp.X_add_number -= 4; + } + pc_rel = 1; + break; + case T_MNEM_mov: + case T_MNEM_movs: + case T_MNEM_cmp: + case T_MNEM_cmn: + if (fragp->fr_var == 4) + { + int r0off = (opcode == T_MNEM_mov + || opcode == T_MNEM_movs) ? 0 : 8; + insn = THUMB_OP32 (opcode); + insn = (insn & 0xe1ffffff) | 0x10000000; + insn |= (old_op & 0x700) << r0off; + put_thumb32_insn (buf, insn); + reloc_type = BFD_RELOC_ARM_T32_IMMEDIATE; + } + else + { + reloc_type = BFD_RELOC_ARM_THUMB_IMM; + } + pc_rel = 0; + break; + case T_MNEM_b: + if (fragp->fr_var == 4) + { + insn = THUMB_OP32(opcode); + put_thumb32_insn (buf, insn); + reloc_type = BFD_RELOC_THUMB_PCREL_BRANCH25; + } + else + reloc_type = BFD_RELOC_THUMB_PCREL_BRANCH12; + pc_rel = 1; + break; + case T_MNEM_bcond: + if (fragp->fr_var == 4) + { + insn = THUMB_OP32(opcode); + insn |= (old_op & 0xf00) << 14; + put_thumb32_insn (buf, insn); + reloc_type = BFD_RELOC_THUMB_PCREL_BRANCH20; + } + else + reloc_type = BFD_RELOC_THUMB_PCREL_BRANCH9; + pc_rel = 1; + break; + case T_MNEM_add_sp: + case T_MNEM_add_pc: + case T_MNEM_inc_sp: + case T_MNEM_dec_sp: + if (fragp->fr_var == 4) + { + /* ??? Choose between add and addw. */ + insn = THUMB_OP32 (opcode); + insn |= (old_op & 0xf0) << 4; + put_thumb32_insn (buf, insn); + reloc_type = BFD_RELOC_ARM_T32_IMMEDIATE; + } + else + reloc_type = BFD_RELOC_ARM_THUMB_ADD; + pc_rel = 0; + break; - /* Put terminator back into stream. */ - input_line_pointer --; - demand_empty_rest_of_line (); + case T_MNEM_addi: + case T_MNEM_addis: + case T_MNEM_subi: + case T_MNEM_subis: + if (fragp->fr_var == 4) + { + insn = THUMB_OP32 (opcode); + insn |= (old_op & 0xf0) << 4; + insn |= (old_op & 0xf) << 16; + put_thumb32_insn (buf, insn); + reloc_type = BFD_RELOC_ARM_T32_IMMEDIATE; + } + else + reloc_type = BFD_RELOC_ARM_THUMB_ADD; + pc_rel = 0; + break; + default: + abort(); + } + fixp = fix_new_exp (fragp, fragp->fr_fix, fragp->fr_var, &exp, pc_rel, + reloc_type); + fixp->fx_file = fragp->fr_file; + fixp->fx_line = fragp->fr_line; + fragp->fr_fix += fragp->fr_var; } -#endif /* OBJ_ELF */ +/* Return the size of a relaxable immediate operand instruction. + SHIFT and SIZE specify the form of the allowable immediate. */ +static int +relax_immediate (fragS *fragp, int size, int shift) +{ + offsetT offset; + offsetT mask; + offsetT low; -/* This is called from HANDLE_ALIGN in write.c. Fill in the contents + /* ??? Should be able to do better than this. */ + if (fragp->fr_symbol) + return 4; + + low = (1 << shift) - 1; + mask = (1 << (shift + size)) - (1 << shift); + offset = fragp->fr_offset; + /* Force misaligned offsets to 32-bit variant. */ + if (offset & low) + return -4; + if (offset & ~mask) + return 4; + return 2; +} + +/* Return the size of a relaxable adr pseudo-instruction or PC-relative + load. */ +static int +relax_adr (fragS *fragp, asection *sec) +{ + addressT addr; + offsetT val; + + /* Assume worst case for symbols not known to be in the same section. */ + if (!S_IS_DEFINED(fragp->fr_symbol) + || sec != S_GET_SEGMENT (fragp->fr_symbol)) + return 4; + + val = S_GET_VALUE(fragp->fr_symbol) + fragp->fr_offset; + addr = fragp->fr_address + fragp->fr_fix; + addr = (addr + 4) & ~3; + /* Fix the insn as the 4-byte version if the target address is not + sufficiently aligned. This is prevents an infinite loop when two + instructions have contradictory range/alignment requirements. */ + if (val & 3) + return -4; + val -= addr; + if (val < 0 || val > 1020) + return 4; + return 2; +} + +/* Return the size of a relaxable add/sub immediate instruction. */ +static int +relax_addsub (fragS *fragp, asection *sec) +{ + char *buf; + int op; + + buf = fragp->fr_literal + fragp->fr_fix; + op = bfd_get_16(sec->owner, buf); + if ((op & 0xf) == ((op >> 4) & 0xf)) + return relax_immediate (fragp, 8, 0); + else + return relax_immediate (fragp, 3, 0); +} + + +/* Return the size of a relaxable branch instruction. BITS is the + size of the offset field in the narrow instruction. */ + +static int +relax_branch (fragS *fragp, asection *sec, int bits) +{ + addressT addr; + offsetT val; + offsetT limit; + + /* Assume worst case for symbols not known to be in the same section. */ + if (!S_IS_DEFINED(fragp->fr_symbol) + || sec != S_GET_SEGMENT (fragp->fr_symbol)) + return 4; + + val = S_GET_VALUE(fragp->fr_symbol) + fragp->fr_offset; + addr = fragp->fr_address + fragp->fr_fix + 4; + val -= addr; + + /* Offset is a signed value *2 */ + limit = 1 << bits; + if (val >= limit || val < -limit) + return 4; + return 2; +} + + +/* Relax a machine dependent frag. This returns the amount by which + the current size of the frag should change. */ + +int +arm_relax_frag (asection *sec, fragS *fragp, long stretch ATTRIBUTE_UNUSED) +{ + int oldsize; + int newsize; + + oldsize = fragp->fr_var; + switch (fragp->fr_subtype) + { + case T_MNEM_ldr_pc2: + newsize = relax_adr(fragp, sec); + break; + case T_MNEM_ldr_pc: + case T_MNEM_ldr_sp: + case T_MNEM_str_sp: + newsize = relax_immediate(fragp, 8, 2); + break; + case T_MNEM_ldr: + case T_MNEM_str: + newsize = relax_immediate(fragp, 5, 2); + break; + case T_MNEM_ldrh: + case T_MNEM_strh: + newsize = relax_immediate(fragp, 5, 1); + break; + case T_MNEM_ldrb: + case T_MNEM_strb: + newsize = relax_immediate(fragp, 5, 0); + break; + case T_MNEM_adr: + newsize = relax_adr(fragp, sec); + break; + case T_MNEM_mov: + case T_MNEM_movs: + case T_MNEM_cmp: + case T_MNEM_cmn: + newsize = relax_immediate(fragp, 8, 0); + break; + case T_MNEM_b: + newsize = relax_branch(fragp, sec, 11); + break; + case T_MNEM_bcond: + newsize = relax_branch(fragp, sec, 8); + break; + case T_MNEM_add_sp: + case T_MNEM_add_pc: + newsize = relax_immediate (fragp, 8, 2); + break; + case T_MNEM_inc_sp: + case T_MNEM_dec_sp: + newsize = relax_immediate (fragp, 7, 2); + break; + case T_MNEM_addi: + case T_MNEM_addis: + case T_MNEM_subi: + case T_MNEM_subis: + newsize = relax_addsub (fragp, sec); + break; + default: + abort(); + } + if (newsize < 0) + { + fragp->fr_var = -newsize; + md_convert_frag (sec->owner, sec, fragp); + frag_wane(fragp); + return -(newsize + oldsize); + } + fragp->fr_var = newsize; + return newsize - oldsize; +} + +/* Round up a section size to the appropriate boundary. */ + +valueT +md_section_align (segT segment ATTRIBUTE_UNUSED, + valueT size) +{ +#ifdef OBJ_ELF + return size; +#else + /* Round all sects to multiple of 4. */ + return (size + 3) & ~3; +#endif +} + +/* This is called from HANDLE_ALIGN in write.c. Fill in the contents of an rs_align_code fragment. */ void -arm_handle_align (fragP) - fragS *fragP; +arm_handle_align (fragS * fragP) { static char const arm_noop[4] = { 0x00, 0x00, 0xa0, 0xe1 }; static char const thumb_noop[2] = { 0xc0, 0x46 }; @@ -14267,9 +10710,7 @@ arm_handle_align (fragP) frag in a code section. */ void -arm_frag_align_code (n, max) - int n; - int max; +arm_frag_align_code (int n, int max) { char * p; @@ -14286,15 +10727,3316 @@ arm_frag_align_code (n, max) (offsetT) n, (char *) NULL); *p = 0; - } /* Perform target specific initialisation of a frag. */ void -arm_init_frag (fragP) - fragS *fragP; +arm_init_frag (fragS * fragP) { /* Record whether this frag is in an ARM or a THUMB area. */ fragP->tc_frag_data = thumb_mode; } + +#ifdef OBJ_ELF +/* When we change sections we need to issue a new mapping symbol. */ + +void +arm_elf_change_section (void) +{ + flagword flags; + segment_info_type *seginfo; + + /* Link an unlinked unwind index table section to the .text section. */ + if (elf_section_type (now_seg) == SHT_ARM_EXIDX + && elf_linked_to_section (now_seg) == NULL) + elf_linked_to_section (now_seg) = text_section; + + if (!SEG_NORMAL (now_seg)) + return; + + flags = bfd_get_section_flags (stdoutput, now_seg); + + /* We can ignore sections that only contain debug info. */ + if ((flags & SEC_ALLOC) == 0) + return; + + seginfo = seg_info (now_seg); + mapstate = seginfo->tc_segment_info_data.mapstate; + marked_pr_dependency = seginfo->tc_segment_info_data.marked_pr_dependency; +} + +int +arm_elf_section_type (const char * str, size_t len) +{ + if (len == 5 && strncmp (str, "exidx", 5) == 0) + return SHT_ARM_EXIDX; + + return -1; +} + +/* Code to deal with unwinding tables. */ + +static void add_unwind_adjustsp (offsetT); + +/* Cenerate and deferred unwind frame offset. */ + +static void +flush_pending_unwind (void) +{ + offsetT offset; + + offset = unwind.pending_offset; + unwind.pending_offset = 0; + if (offset != 0) + add_unwind_adjustsp (offset); +} + +/* Add an opcode to this list for this function. Two-byte opcodes should + be passed as op[0] << 8 | op[1]. The list of opcodes is built in reverse + order. */ + +static void +add_unwind_opcode (valueT op, int length) +{ + /* Add any deferred stack adjustment. */ + if (unwind.pending_offset) + flush_pending_unwind (); + + unwind.sp_restored = 0; + + if (unwind.opcode_count + length > unwind.opcode_alloc) + { + unwind.opcode_alloc += ARM_OPCODE_CHUNK_SIZE; + if (unwind.opcodes) + unwind.opcodes = xrealloc (unwind.opcodes, + unwind.opcode_alloc); + else + unwind.opcodes = xmalloc (unwind.opcode_alloc); + } + while (length > 0) + { + length--; + unwind.opcodes[unwind.opcode_count] = op & 0xff; + op >>= 8; + unwind.opcode_count++; + } +} + +/* Add unwind opcodes to adjust the stack pointer. */ + +static void +add_unwind_adjustsp (offsetT offset) +{ + valueT op; + + if (offset > 0x200) + { + /* We need at most 5 bytes to hold a 32-bit value in a uleb128. */ + char bytes[5]; + int n; + valueT o; + + /* Long form: 0xb2, uleb128. */ + /* This might not fit in a word so add the individual bytes, + remembering the list is built in reverse order. */ + o = (valueT) ((offset - 0x204) >> 2); + if (o == 0) + add_unwind_opcode (0, 1); + + /* Calculate the uleb128 encoding of the offset. */ + n = 0; + while (o) + { + bytes[n] = o & 0x7f; + o >>= 7; + if (o) + bytes[n] |= 0x80; + n++; + } + /* Add the insn. */ + for (; n; n--) + add_unwind_opcode (bytes[n - 1], 1); + add_unwind_opcode (0xb2, 1); + } + else if (offset > 0x100) + { + /* Two short opcodes. */ + add_unwind_opcode (0x3f, 1); + op = (offset - 0x104) >> 2; + add_unwind_opcode (op, 1); + } + else if (offset > 0) + { + /* Short opcode. */ + op = (offset - 4) >> 2; + add_unwind_opcode (op, 1); + } + else if (offset < 0) + { + offset = -offset; + while (offset > 0x100) + { + add_unwind_opcode (0x7f, 1); + offset -= 0x100; + } + op = ((offset - 4) >> 2) | 0x40; + add_unwind_opcode (op, 1); + } +} + +/* Finish the list of unwind opcodes for this function. */ +static void +finish_unwind_opcodes (void) +{ + valueT op; + + if (unwind.fp_used) + { + /* Adjust sp as neccessary. */ + unwind.pending_offset += unwind.fp_offset - unwind.frame_size; + flush_pending_unwind (); + + /* After restoring sp from the frame pointer. */ + op = 0x90 | unwind.fp_reg; + add_unwind_opcode (op, 1); + } + else + flush_pending_unwind (); +} + + +/* Start an exception table entry. If idx is nonzero this is an index table + entry. */ + +static void +start_unwind_section (const segT text_seg, int idx) +{ + const char * text_name; + const char * prefix; + const char * prefix_once; + const char * group_name; + size_t prefix_len; + size_t text_len; + char * sec_name; + size_t sec_name_len; + int type; + int flags; + int linkonce; + + if (idx) + { + prefix = ELF_STRING_ARM_unwind; + prefix_once = ELF_STRING_ARM_unwind_once; + type = SHT_ARM_EXIDX; + } + else + { + prefix = ELF_STRING_ARM_unwind_info; + prefix_once = ELF_STRING_ARM_unwind_info_once; + type = SHT_PROGBITS; + } + + text_name = segment_name (text_seg); + if (streq (text_name, ".text")) + text_name = ""; + + if (strncmp (text_name, ".gnu.linkonce.t.", + strlen (".gnu.linkonce.t.")) == 0) + { + prefix = prefix_once; + text_name += strlen (".gnu.linkonce.t."); + } + + prefix_len = strlen (prefix); + text_len = strlen (text_name); + sec_name_len = prefix_len + text_len; + sec_name = xmalloc (sec_name_len + 1); + memcpy (sec_name, prefix, prefix_len); + memcpy (sec_name + prefix_len, text_name, text_len); + sec_name[prefix_len + text_len] = '\0'; + + flags = SHF_ALLOC; + linkonce = 0; + group_name = 0; + + /* Handle COMDAT group. */ + if (prefix != prefix_once && (text_seg->flags & SEC_LINK_ONCE) != 0) + { + group_name = elf_group_name (text_seg); + if (group_name == NULL) + { + as_bad ("Group section `%s' has no group signature", + segment_name (text_seg)); + ignore_rest_of_line (); + return; + } + flags |= SHF_GROUP; + linkonce = 1; + } + + obj_elf_change_section (sec_name, type, flags, 0, group_name, linkonce, 0); + + /* Set the setion link for index tables. */ + if (idx) + elf_linked_to_section (now_seg) = text_seg; +} + + +/* Start an unwind table entry. HAVE_DATA is nonzero if we have additional + personality routine data. Returns zero, or the index table value for + and inline entry. */ + +static valueT +create_unwind_entry (int have_data) +{ + int size; + addressT where; + char *ptr; + /* The current word of data. */ + valueT data; + /* The number of bytes left in this word. */ + int n; + + finish_unwind_opcodes (); + + /* Remember the current text section. */ + unwind.saved_seg = now_seg; + unwind.saved_subseg = now_subseg; + + start_unwind_section (now_seg, 0); + + if (unwind.personality_routine == NULL) + { + if (unwind.personality_index == -2) + { + if (have_data) + as_bad (_("handerdata in cantunwind frame")); + return 1; /* EXIDX_CANTUNWIND. */ + } + + /* Use a default personality routine if none is specified. */ + if (unwind.personality_index == -1) + { + if (unwind.opcode_count > 3) + unwind.personality_index = 1; + else + unwind.personality_index = 0; + } + + /* Space for the personality routine entry. */ + if (unwind.personality_index == 0) + { + if (unwind.opcode_count > 3) + as_bad (_("too many unwind opcodes for personality routine 0")); + + if (!have_data) + { + /* All the data is inline in the index table. */ + data = 0x80; + n = 3; + while (unwind.opcode_count > 0) + { + unwind.opcode_count--; + data = (data << 8) | unwind.opcodes[unwind.opcode_count]; + n--; + } + + /* Pad with "finish" opcodes. */ + while (n--) + data = (data << 8) | 0xb0; + + return data; + } + size = 0; + } + else + /* We get two opcodes "free" in the first word. */ + size = unwind.opcode_count - 2; + } + else + /* An extra byte is required for the opcode count. */ + size = unwind.opcode_count + 1; + + size = (size + 3) >> 2; + if (size > 0xff) + as_bad (_("too many unwind opcodes")); + + frag_align (2, 0, 0); + record_alignment (now_seg, 2); + unwind.table_entry = expr_build_dot (); + + /* Allocate the table entry. */ + ptr = frag_more ((size << 2) + 4); + where = frag_now_fix () - ((size << 2) + 4); + + switch (unwind.personality_index) + { + case -1: + /* ??? Should this be a PLT generating relocation? */ + /* Custom personality routine. */ + fix_new (frag_now, where, 4, unwind.personality_routine, 0, 1, + BFD_RELOC_ARM_PREL31); + + where += 4; + ptr += 4; + + /* Set the first byte to the number of additional words. */ + data = size - 1; + n = 3; + break; + + /* ABI defined personality routines. */ + case 0: + /* Three opcodes bytes are packed into the first word. */ + data = 0x80; + n = 3; + break; + + case 1: + case 2: + /* The size and first two opcode bytes go in the first word. */ + data = ((0x80 + unwind.personality_index) << 8) | size; + n = 2; + break; + + default: + /* Should never happen. */ + abort (); + } + + /* Pack the opcodes into words (MSB first), reversing the list at the same + time. */ + while (unwind.opcode_count > 0) + { + if (n == 0) + { + md_number_to_chars (ptr, data, 4); + ptr += 4; + n = 4; + data = 0; + } + unwind.opcode_count--; + n--; + data = (data << 8) | unwind.opcodes[unwind.opcode_count]; + } + + /* Finish off the last word. */ + if (n < 4) + { + /* Pad with "finish" opcodes. */ + while (n--) + data = (data << 8) | 0xb0; + + md_number_to_chars (ptr, data, 4); + } + + if (!have_data) + { + /* Add an empty descriptor if there is no user-specified data. */ + ptr = frag_more (4); + md_number_to_chars (ptr, 0, 4); + } + + return 0; +} + +/* Convert REGNAME to a DWARF-2 register number. */ + +int +tc_arm_regname_to_dw2regnum (const char *regname) +{ + int reg = arm_reg_parse ((char **) ®name, REG_TYPE_RN); + + if (reg == FAIL) + return -1; + + return reg; +} + +/* Initialize the DWARF-2 unwind information for this procedure. */ + +void +tc_arm_frame_initial_instructions (void) +{ + cfi_add_CFA_def_cfa (REG_SP, 0); +} +#endif /* OBJ_ELF */ + + +/* MD interface: Symbol and relocation handling. */ + +/* Return the address within the segment that a PC-relative fixup is + relative to. For ARM, PC-relative fixups applied to instructions + are generally relative to the location of the fixup plus 8 bytes. + Thumb branches are offset by 4, and Thumb loads relative to PC + require special handling. */ + +long +md_pcrel_from_section (fixS * fixP, segT seg) +{ + offsetT base = fixP->fx_where + fixP->fx_frag->fr_address; + + /* If this is pc-relative and we are going to emit a relocation + then we just want to put out any pipeline compensation that the linker + will need. Otherwise we want to use the calculated base. */ + if (fixP->fx_pcrel + && ((fixP->fx_addsy && S_GET_SEGMENT (fixP->fx_addsy) != seg) + || arm_force_relocation (fixP))) + base = 0; + + switch (fixP->fx_r_type) + { + /* PC relative addressing on the Thumb is slightly odd as the + bottom two bits of the PC are forced to zero for the + calculation. This happens *after* application of the + pipeline offset. However, Thumb adrl already adjusts for + this, so we need not do it again. */ + case BFD_RELOC_ARM_THUMB_ADD: + return base & ~3; + + case BFD_RELOC_ARM_THUMB_OFFSET: + case BFD_RELOC_ARM_T32_OFFSET_IMM: + case BFD_RELOC_ARM_T32_ADD_PC12: + case BFD_RELOC_ARM_T32_CP_OFF_IMM: + return (base + 4) & ~3; + + /* Thumb branches are simply offset by +4. */ + case BFD_RELOC_THUMB_PCREL_BRANCH7: + case BFD_RELOC_THUMB_PCREL_BRANCH9: + case BFD_RELOC_THUMB_PCREL_BRANCH12: + case BFD_RELOC_THUMB_PCREL_BRANCH20: + case BFD_RELOC_THUMB_PCREL_BRANCH23: + case BFD_RELOC_THUMB_PCREL_BRANCH25: + case BFD_RELOC_THUMB_PCREL_BLX: + return base + 4; + + /* ARM mode branches are offset by +8. However, the Windows CE + loader expects the relocation not to take this into account. */ + case BFD_RELOC_ARM_PCREL_BRANCH: + case BFD_RELOC_ARM_PCREL_CALL: + case BFD_RELOC_ARM_PCREL_JUMP: + case BFD_RELOC_ARM_PCREL_BLX: + case BFD_RELOC_ARM_PLT32: +#ifdef TE_WINCE + return base; +#else + return base + 8; +#endif + + /* ARM mode loads relative to PC are also offset by +8. Unlike + branches, the Windows CE loader *does* expect the relocation + to take this into account. */ + case BFD_RELOC_ARM_OFFSET_IMM: + case BFD_RELOC_ARM_OFFSET_IMM8: + case BFD_RELOC_ARM_HWLITERAL: + case BFD_RELOC_ARM_LITERAL: + case BFD_RELOC_ARM_CP_OFF_IMM: + return base + 8; + + + /* Other PC-relative relocations are un-offset. */ + default: + return base; + } +} + +/* Under ELF we need to default _GLOBAL_OFFSET_TABLE. + Otherwise we have no need to default values of symbols. */ + +symbolS * +md_undefined_symbol (char * name ATTRIBUTE_UNUSED) +{ +#ifdef OBJ_ELF + if (name[0] == '_' && name[1] == 'G' + && streq (name, GLOBAL_OFFSET_TABLE_NAME)) + { + if (!GOT_symbol) + { + if (symbol_find (name)) + as_bad ("GOT already in the symbol table"); + + GOT_symbol = symbol_new (name, undefined_section, + (valueT) 0, & zero_address_frag); + } + + return GOT_symbol; + } +#endif + + return 0; +} + +/* Subroutine of md_apply_fix. Check to see if an immediate can be + computed as two separate immediate values, added together. We + already know that this value cannot be computed by just one ARM + instruction. */ + +static unsigned int +validate_immediate_twopart (unsigned int val, + unsigned int * highpart) +{ + unsigned int a; + unsigned int i; + + for (i = 0; i < 32; i += 2) + if (((a = rotate_left (val, i)) & 0xff) != 0) + { + if (a & 0xff00) + { + if (a & ~ 0xffff) + continue; + * highpart = (a >> 8) | ((i + 24) << 7); + } + else if (a & 0xff0000) + { + if (a & 0xff000000) + continue; + * highpart = (a >> 16) | ((i + 16) << 7); + } + else + { + assert (a & 0xff000000); + * highpart = (a >> 24) | ((i + 8) << 7); + } + + return (a & 0xff) | (i << 7); + } + + return FAIL; +} + +static int +validate_offset_imm (unsigned int val, int hwse) +{ + if ((hwse && val > 255) || val > 4095) + return FAIL; + return val; +} + +/* Subroutine of md_apply_fix. Do those data_ops which can take a + negative immediate constant by altering the instruction. A bit of + a hack really. + MOV <-> MVN + AND <-> BIC + ADC <-> SBC + by inverting the second operand, and + ADD <-> SUB + CMP <-> CMN + by negating the second operand. */ + +static int +negate_data_op (unsigned long * instruction, + unsigned long value) +{ + int op, new_inst; + unsigned long negated, inverted; + + negated = encode_arm_immediate (-value); + inverted = encode_arm_immediate (~value); + + op = (*instruction >> DATA_OP_SHIFT) & 0xf; + switch (op) + { + /* First negates. */ + case OPCODE_SUB: /* ADD <-> SUB */ + new_inst = OPCODE_ADD; + value = negated; + break; + + case OPCODE_ADD: + new_inst = OPCODE_SUB; + value = negated; + break; + + case OPCODE_CMP: /* CMP <-> CMN */ + new_inst = OPCODE_CMN; + value = negated; + break; + + case OPCODE_CMN: + new_inst = OPCODE_CMP; + value = negated; + break; + + /* Now Inverted ops. */ + case OPCODE_MOV: /* MOV <-> MVN */ + new_inst = OPCODE_MVN; + value = inverted; + break; + + case OPCODE_MVN: + new_inst = OPCODE_MOV; + value = inverted; + break; + + case OPCODE_AND: /* AND <-> BIC */ + new_inst = OPCODE_BIC; + value = inverted; + break; + + case OPCODE_BIC: + new_inst = OPCODE_AND; + value = inverted; + break; + + case OPCODE_ADC: /* ADC <-> SBC */ + new_inst = OPCODE_SBC; + value = inverted; + break; + + case OPCODE_SBC: + new_inst = OPCODE_ADC; + value = inverted; + break; + + /* We cannot do anything. */ + default: + return FAIL; + } + + if (value == (unsigned) FAIL) + return FAIL; + + *instruction &= OPCODE_MASK; + *instruction |= new_inst << DATA_OP_SHIFT; + return value; +} + +/* Like negate_data_op, but for Thumb-2. */ + +static unsigned int +thumb32_negate_data_op (offsetT *instruction, offsetT value) +{ + int op, new_inst; + int rd; + offsetT negated, inverted; + + negated = encode_thumb32_immediate (-value); + inverted = encode_thumb32_immediate (~value); + + rd = (*instruction >> 8) & 0xf; + op = (*instruction >> T2_DATA_OP_SHIFT) & 0xf; + switch (op) + { + /* ADD <-> SUB. Includes CMP <-> CMN. */ + case T2_OPCODE_SUB: + new_inst = T2_OPCODE_ADD; + value = negated; + break; + + case T2_OPCODE_ADD: + new_inst = T2_OPCODE_SUB; + value = negated; + break; + + /* ORR <-> ORN. Includes MOV <-> MVN. */ + case T2_OPCODE_ORR: + new_inst = T2_OPCODE_ORN; + value = inverted; + break; + + case T2_OPCODE_ORN: + new_inst = T2_OPCODE_ORR; + value = inverted; + break; + + /* AND <-> BIC. TST has no inverted equivalent. */ + case T2_OPCODE_AND: + new_inst = T2_OPCODE_BIC; + if (rd == 15) + value = FAIL; + else + value = inverted; + break; + + case T2_OPCODE_BIC: + new_inst = T2_OPCODE_AND; + value = inverted; + break; + + /* ADC <-> SBC */ + case T2_OPCODE_ADC: + new_inst = T2_OPCODE_SBC; + value = inverted; + break; + + case T2_OPCODE_SBC: + new_inst = T2_OPCODE_ADC; + value = inverted; + break; + + /* We cannot do anything. */ + default: + return FAIL; + } + + if (value == FAIL) + return FAIL; + + *instruction &= T2_OPCODE_MASK; + *instruction |= new_inst << T2_DATA_OP_SHIFT; + return value; +} + +/* Read a 32-bit thumb instruction from buf. */ +static unsigned long +get_thumb32_insn (char * buf) +{ + unsigned long insn; + insn = md_chars_to_number (buf, THUMB_SIZE) << 16; + insn |= md_chars_to_number (buf + THUMB_SIZE, THUMB_SIZE); + + return insn; +} + + +/* We usually want to set the low bit on the address of thumb function + symbols. In particular .word foo - . should have the low bit set. + Generic code tries to fold the difference of two symbols to + a constant. Prevent this and force a relocation when the first symbols + is a thumb function. */ +int +arm_optimize_expr (expressionS *l, operatorT op, expressionS *r) +{ + if (op == O_subtract + && l->X_op == O_symbol + && r->X_op == O_symbol + && THUMB_IS_FUNC (l->X_add_symbol)) + { + l->X_op = O_subtract; + l->X_op_symbol = r->X_add_symbol; + l->X_add_number -= r->X_add_number; + return 1; + } + /* Process as normal. */ + return 0; +} + +void +md_apply_fix (fixS * fixP, + valueT * valP, + segT seg) +{ + offsetT value = * valP; + offsetT newval; + unsigned int newimm; + unsigned long temp; + int sign; + char * buf = fixP->fx_where + fixP->fx_frag->fr_literal; + + assert (fixP->fx_r_type <= BFD_RELOC_UNUSED); + + /* Note whether this will delete the relocation. */ + if (fixP->fx_addsy == 0 && !fixP->fx_pcrel) + fixP->fx_done = 1; + + /* On a 64-bit host, silently truncate 'value' to 32 bits for + consistency with the behavior on 32-bit hosts. Remember value + for emit_reloc. */ + value &= 0xffffffff; + value ^= 0x80000000; + value -= 0x80000000; + + *valP = value; + fixP->fx_addnumber = value; + + /* Same treatment for fixP->fx_offset. */ + fixP->fx_offset &= 0xffffffff; + fixP->fx_offset ^= 0x80000000; + fixP->fx_offset -= 0x80000000; + + switch (fixP->fx_r_type) + { + case BFD_RELOC_NONE: + /* This will need to go in the object file. */ + fixP->fx_done = 0; + break; + + case BFD_RELOC_ARM_IMMEDIATE: + /* We claim that this fixup has been processed here, + even if in fact we generate an error because we do + not have a reloc for it, so tc_gen_reloc will reject it. */ + fixP->fx_done = 1; + + if (fixP->fx_addsy + && ! S_IS_DEFINED (fixP->fx_addsy)) + { + as_bad_where (fixP->fx_file, fixP->fx_line, + _("undefined symbol %s used as an immediate value"), + S_GET_NAME (fixP->fx_addsy)); + break; + } + + newimm = encode_arm_immediate (value); + temp = md_chars_to_number (buf, INSN_SIZE); + + /* If the instruction will fail, see if we can fix things up by + changing the opcode. */ + if (newimm == (unsigned int) FAIL + && (newimm = negate_data_op (&temp, value)) == (unsigned int) FAIL) + { + as_bad_where (fixP->fx_file, fixP->fx_line, + _("invalid constant (%lx) after fixup"), + (unsigned long) value); + break; + } + + newimm |= (temp & 0xfffff000); + md_number_to_chars (buf, (valueT) newimm, INSN_SIZE); + break; + + case BFD_RELOC_ARM_ADRL_IMMEDIATE: + { + unsigned int highpart = 0; + unsigned int newinsn = 0xe1a00000; /* nop. */ + + newimm = encode_arm_immediate (value); + temp = md_chars_to_number (buf, INSN_SIZE); + + /* If the instruction will fail, see if we can fix things up by + changing the opcode. */ + if (newimm == (unsigned int) FAIL + && (newimm = negate_data_op (& temp, value)) == (unsigned int) FAIL) + { + /* No ? OK - try using two ADD instructions to generate + the value. */ + newimm = validate_immediate_twopart (value, & highpart); + + /* Yes - then make sure that the second instruction is + also an add. */ + if (newimm != (unsigned int) FAIL) + newinsn = temp; + /* Still No ? Try using a negated value. */ + else if ((newimm = validate_immediate_twopart (- value, & highpart)) != (unsigned int) FAIL) + temp = newinsn = (temp & OPCODE_MASK) | OPCODE_SUB << DATA_OP_SHIFT; + /* Otherwise - give up. */ + else + { + as_bad_where (fixP->fx_file, fixP->fx_line, + _("unable to compute ADRL instructions for PC offset of 0x%lx"), + (long) value); + break; + } + + /* Replace the first operand in the 2nd instruction (which + is the PC) with the destination register. We have + already added in the PC in the first instruction and we + do not want to do it again. */ + newinsn &= ~ 0xf0000; + newinsn |= ((newinsn & 0x0f000) << 4); + } + + newimm |= (temp & 0xfffff000); + md_number_to_chars (buf, (valueT) newimm, INSN_SIZE); + + highpart |= (newinsn & 0xfffff000); + md_number_to_chars (buf + INSN_SIZE, (valueT) highpart, INSN_SIZE); + } + break; + + case BFD_RELOC_ARM_OFFSET_IMM: + if (!fixP->fx_done && seg->use_rela_p) + value = 0; + + case BFD_RELOC_ARM_LITERAL: + sign = value >= 0; + + if (value < 0) + value = - value; + + if (validate_offset_imm (value, 0) == FAIL) + { + if (fixP->fx_r_type == BFD_RELOC_ARM_LITERAL) + as_bad_where (fixP->fx_file, fixP->fx_line, + _("invalid literal constant: pool needs to be closer")); + else + as_bad_where (fixP->fx_file, fixP->fx_line, + _("bad immediate value for offset (%ld)"), + (long) value); + break; + } + + newval = md_chars_to_number (buf, INSN_SIZE); + newval &= 0xff7ff000; + newval |= value | (sign ? INDEX_UP : 0); + md_number_to_chars (buf, newval, INSN_SIZE); + break; + + case BFD_RELOC_ARM_OFFSET_IMM8: + case BFD_RELOC_ARM_HWLITERAL: + sign = value >= 0; + + if (value < 0) + value = - value; + + if (validate_offset_imm (value, 1) == FAIL) + { + if (fixP->fx_r_type == BFD_RELOC_ARM_HWLITERAL) + as_bad_where (fixP->fx_file, fixP->fx_line, + _("invalid literal constant: pool needs to be closer")); + else + as_bad (_("bad immediate value for half-word offset (%ld)"), + (long) value); + break; + } + + newval = md_chars_to_number (buf, INSN_SIZE); + newval &= 0xff7ff0f0; + newval |= ((value >> 4) << 8) | (value & 0xf) | (sign ? INDEX_UP : 0); + md_number_to_chars (buf, newval, INSN_SIZE); + break; + + case BFD_RELOC_ARM_T32_OFFSET_U8: + if (value < 0 || value > 1020 || value % 4 != 0) + as_bad_where (fixP->fx_file, fixP->fx_line, + _("bad immediate value for offset (%ld)"), (long) value); + value /= 4; + + newval = md_chars_to_number (buf+2, THUMB_SIZE); + newval |= value; + md_number_to_chars (buf+2, newval, THUMB_SIZE); + break; + + case BFD_RELOC_ARM_T32_OFFSET_IMM: + /* This is a complicated relocation used for all varieties of Thumb32 + load/store instruction with immediate offset: + + 1110 100P u1WL NNNN XXXX YYYY iiii iiii - +/-(U) pre/post(P) 8-bit, + *4, optional writeback(W) + (doubleword load/store) + + 1111 100S uTTL 1111 XXXX iiii iiii iiii - +/-(U) 12-bit PC-rel + 1111 100S 0TTL NNNN XXXX 1Pu1 iiii iiii - +/-(U) pre/post(P) 8-bit + 1111 100S 0TTL NNNN XXXX 1110 iiii iiii - positive 8-bit (T instruction) + 1111 100S 1TTL NNNN XXXX iiii iiii iiii - positive 12-bit + 1111 100S 0TTL NNNN XXXX 1100 iiii iiii - negative 8-bit + + Uppercase letters indicate bits that are already encoded at + this point. Lowercase letters are our problem. For the + second block of instructions, the secondary opcode nybble + (bits 8..11) is present, and bit 23 is zero, even if this is + a PC-relative operation. */ + newval = md_chars_to_number (buf, THUMB_SIZE); + newval <<= 16; + newval |= md_chars_to_number (buf+THUMB_SIZE, THUMB_SIZE); + + if ((newval & 0xf0000000) == 0xe0000000) + { + /* Doubleword load/store: 8-bit offset, scaled by 4. */ + if (value >= 0) + newval |= (1 << 23); + else + value = -value; + if (value % 4 != 0) + { + as_bad_where (fixP->fx_file, fixP->fx_line, + _("offset not a multiple of 4")); + break; + } + value /= 4; + if (value > 0xff) + { + as_bad_where (fixP->fx_file, fixP->fx_line, + _("offset out of range")); + break; + } + newval &= ~0xff; + } + else if ((newval & 0x000f0000) == 0x000f0000) + { + /* PC-relative, 12-bit offset. */ + if (value >= 0) + newval |= (1 << 23); + else + value = -value; + if (value > 0xfff) + { + as_bad_where (fixP->fx_file, fixP->fx_line, + _("offset out of range")); + break; + } + newval &= ~0xfff; + } + else if ((newval & 0x00000100) == 0x00000100) + { + /* Writeback: 8-bit, +/- offset. */ + if (value >= 0) + newval |= (1 << 9); + else + value = -value; + if (value > 0xff) + { + as_bad_where (fixP->fx_file, fixP->fx_line, + _("offset out of range")); + break; + } + newval &= ~0xff; + } + else if ((newval & 0x00000f00) == 0x00000e00) + { + /* T-instruction: positive 8-bit offset. */ + if (value < 0 || value > 0xff) + { + as_bad_where (fixP->fx_file, fixP->fx_line, + _("offset out of range")); + break; + } + newval &= ~0xff; + newval |= value; + } + else + { + /* Positive 12-bit or negative 8-bit offset. */ + int limit; + if (value >= 0) + { + newval |= (1 << 23); + limit = 0xfff; + } + else + { + value = -value; + limit = 0xff; + } + if (value > limit) + { + as_bad_where (fixP->fx_file, fixP->fx_line, + _("offset out of range")); + break; + } + newval &= ~limit; + } + + newval |= value; + md_number_to_chars (buf, (newval >> 16) & 0xffff, THUMB_SIZE); + md_number_to_chars (buf + THUMB_SIZE, newval & 0xffff, THUMB_SIZE); + break; + + case BFD_RELOC_ARM_SHIFT_IMM: + newval = md_chars_to_number (buf, INSN_SIZE); + if (((unsigned long) value) > 32 + || (value == 32 + && (((newval & 0x60) == 0) || (newval & 0x60) == 0x60))) + { + as_bad_where (fixP->fx_file, fixP->fx_line, + _("shift expression is too large")); + break; + } + + if (value == 0) + /* Shifts of zero must be done as lsl. */ + newval &= ~0x60; + else if (value == 32) + value = 0; + newval &= 0xfffff07f; + newval |= (value & 0x1f) << 7; + md_number_to_chars (buf, newval, INSN_SIZE); + break; + + case BFD_RELOC_ARM_T32_IMMEDIATE: + case BFD_RELOC_ARM_T32_IMM12: + case BFD_RELOC_ARM_T32_ADD_PC12: + /* We claim that this fixup has been processed here, + even if in fact we generate an error because we do + not have a reloc for it, so tc_gen_reloc will reject it. */ + fixP->fx_done = 1; + + if (fixP->fx_addsy + && ! S_IS_DEFINED (fixP->fx_addsy)) + { + as_bad_where (fixP->fx_file, fixP->fx_line, + _("undefined symbol %s used as an immediate value"), + S_GET_NAME (fixP->fx_addsy)); + break; + } + + newval = md_chars_to_number (buf, THUMB_SIZE); + newval <<= 16; + newval |= md_chars_to_number (buf+2, THUMB_SIZE); + + /* FUTURE: Implement analogue of negate_data_op for T32. */ + if (fixP->fx_r_type == BFD_RELOC_ARM_T32_IMMEDIATE) + { + newimm = encode_thumb32_immediate (value); + if (newimm == (unsigned int) FAIL) + newimm = thumb32_negate_data_op (&newval, value); + } + else + { + /* 12 bit immediate for addw/subw. */ + if (value < 0) + { + value = -value; + newval ^= 0x00a00000; + } + if (value > 0xfff) + newimm = (unsigned int) FAIL; + else + newimm = value; + } + + if (newimm == (unsigned int)FAIL) + { + as_bad_where (fixP->fx_file, fixP->fx_line, + _("invalid constant (%lx) after fixup"), + (unsigned long) value); + break; + } + + newval |= (newimm & 0x800) << 15; + newval |= (newimm & 0x700) << 4; + newval |= (newimm & 0x0ff); + + md_number_to_chars (buf, (valueT) ((newval >> 16) & 0xffff), THUMB_SIZE); + md_number_to_chars (buf+2, (valueT) (newval & 0xffff), THUMB_SIZE); + break; + + case BFD_RELOC_ARM_SMC: + if (((unsigned long) value) > 0xffff) + as_bad_where (fixP->fx_file, fixP->fx_line, + _("invalid smc expression")); + newval = md_chars_to_number (buf, INSN_SIZE); + newval |= (value & 0xf) | ((value & 0xfff0) << 4); + md_number_to_chars (buf, newval, INSN_SIZE); + break; + + case BFD_RELOC_ARM_SWI: + if (fixP->tc_fix_data != 0) + { + if (((unsigned long) value) > 0xff) + as_bad_where (fixP->fx_file, fixP->fx_line, + _("invalid swi expression")); + newval = md_chars_to_number (buf, THUMB_SIZE); + newval |= value; + md_number_to_chars (buf, newval, THUMB_SIZE); + } + else + { + if (((unsigned long) value) > 0x00ffffff) + as_bad_where (fixP->fx_file, fixP->fx_line, + _("invalid swi expression")); + newval = md_chars_to_number (buf, INSN_SIZE); + newval |= value; + md_number_to_chars (buf, newval, INSN_SIZE); + } + break; + + case BFD_RELOC_ARM_MULTI: + if (((unsigned long) value) > 0xffff) + as_bad_where (fixP->fx_file, fixP->fx_line, + _("invalid expression in load/store multiple")); + newval = value | md_chars_to_number (buf, INSN_SIZE); + md_number_to_chars (buf, newval, INSN_SIZE); + break; + +#ifdef OBJ_ELF + case BFD_RELOC_ARM_PCREL_CALL: + newval = md_chars_to_number (buf, INSN_SIZE); + if ((newval & 0xf0000000) == 0xf0000000) + temp = 1; + else + temp = 3; + goto arm_branch_common; + + case BFD_RELOC_ARM_PCREL_JUMP: + case BFD_RELOC_ARM_PLT32: +#endif + case BFD_RELOC_ARM_PCREL_BRANCH: + temp = 3; + goto arm_branch_common; + + case BFD_RELOC_ARM_PCREL_BLX: + temp = 1; + arm_branch_common: + /* We are going to store value (shifted right by two) in the + instruction, in a 24 bit, signed field. Bits 26 through 32 either + all clear or all set and bit 0 must be clear. For B/BL bit 1 must + also be be clear. */ + if (value & temp) + as_bad_where (fixP->fx_file, fixP->fx_line, + _("misaligned branch destination")); + if ((value & (offsetT)0xfe000000) != (offsetT)0 + && (value & (offsetT)0xfe000000) != (offsetT)0xfe000000) + as_bad_where (fixP->fx_file, fixP->fx_line, + _("branch out of range")); + + if (fixP->fx_done || !seg->use_rela_p) + { + newval = md_chars_to_number (buf, INSN_SIZE); + newval |= (value >> 2) & 0x00ffffff; + /* Set the H bit on BLX instructions. */ + if (temp == 1) + { + if (value & 2) + newval |= 0x01000000; + else + newval &= ~0x01000000; + } + md_number_to_chars (buf, newval, INSN_SIZE); + } + break; + + case BFD_RELOC_THUMB_PCREL_BRANCH7: /* CZB */ + /* CZB can only branch forward. */ + if (value & ~0x7e) + as_bad_where (fixP->fx_file, fixP->fx_line, + _("branch out of range")); + + if (fixP->fx_done || !seg->use_rela_p) + { + newval = md_chars_to_number (buf, THUMB_SIZE); + newval |= ((value & 0x3e) << 2) | ((value & 0x40) << 3); + md_number_to_chars (buf, newval, THUMB_SIZE); + } + break; + + case BFD_RELOC_THUMB_PCREL_BRANCH9: /* Conditional branch. */ + if ((value & ~0xff) && ((value & ~0xff) != ~0xff)) + as_bad_where (fixP->fx_file, fixP->fx_line, + _("branch out of range")); + + if (fixP->fx_done || !seg->use_rela_p) + { + newval = md_chars_to_number (buf, THUMB_SIZE); + newval |= (value & 0x1ff) >> 1; + md_number_to_chars (buf, newval, THUMB_SIZE); + } + break; + + case BFD_RELOC_THUMB_PCREL_BRANCH12: /* Unconditional branch. */ + if ((value & ~0x7ff) && ((value & ~0x7ff) != ~0x7ff)) + as_bad_where (fixP->fx_file, fixP->fx_line, + _("branch out of range")); + + if (fixP->fx_done || !seg->use_rela_p) + { + newval = md_chars_to_number (buf, THUMB_SIZE); + newval |= (value & 0xfff) >> 1; + md_number_to_chars (buf, newval, THUMB_SIZE); + } + break; + + case BFD_RELOC_THUMB_PCREL_BRANCH20: + if ((value & ~0x1fffff) && ((value & ~0x1fffff) != ~0x1fffff)) + as_bad_where (fixP->fx_file, fixP->fx_line, + _("conditional branch out of range")); + + if (fixP->fx_done || !seg->use_rela_p) + { + offsetT newval2; + addressT S, J1, J2, lo, hi; + + S = (value & 0x00100000) >> 20; + J2 = (value & 0x00080000) >> 19; + J1 = (value & 0x00040000) >> 18; + hi = (value & 0x0003f000) >> 12; + lo = (value & 0x00000ffe) >> 1; + + newval = md_chars_to_number (buf, THUMB_SIZE); + newval2 = md_chars_to_number (buf + THUMB_SIZE, THUMB_SIZE); + newval |= (S << 10) | hi; + newval2 |= (J1 << 13) | (J2 << 11) | lo; + md_number_to_chars (buf, newval, THUMB_SIZE); + md_number_to_chars (buf + THUMB_SIZE, newval2, THUMB_SIZE); + } + break; + + case BFD_RELOC_THUMB_PCREL_BLX: + case BFD_RELOC_THUMB_PCREL_BRANCH23: + if ((value & ~0x3fffff) && ((value & ~0x3fffff) != ~0x3fffff)) + as_bad_where (fixP->fx_file, fixP->fx_line, + _("branch out of range")); + + if (fixP->fx_r_type == BFD_RELOC_THUMB_PCREL_BLX) + /* For a BLX instruction, make sure that the relocation is rounded up + to a word boundary. This follows the semantics of the instruction + which specifies that bit 1 of the target address will come from bit + 1 of the base address. */ + value = (value + 1) & ~ 1; + + if (fixP->fx_done || !seg->use_rela_p) + { + offsetT newval2; + + newval = md_chars_to_number (buf, THUMB_SIZE); + newval2 = md_chars_to_number (buf + THUMB_SIZE, THUMB_SIZE); + newval |= (value & 0x7fffff) >> 12; + newval2 |= (value & 0xfff) >> 1; + md_number_to_chars (buf, newval, THUMB_SIZE); + md_number_to_chars (buf + THUMB_SIZE, newval2, THUMB_SIZE); + } + break; + + case BFD_RELOC_THUMB_PCREL_BRANCH25: + if ((value & ~0x1ffffff) && ((value & ~0x1ffffff) != ~0x1ffffff)) + as_bad_where (fixP->fx_file, fixP->fx_line, + _("branch out of range")); + + if (fixP->fx_done || !seg->use_rela_p) + { + offsetT newval2; + addressT S, I1, I2, lo, hi; + + S = (value & 0x01000000) >> 24; + I1 = (value & 0x00800000) >> 23; + I2 = (value & 0x00400000) >> 22; + hi = (value & 0x003ff000) >> 12; + lo = (value & 0x00000ffe) >> 1; + + I1 = !(I1 ^ S); + I2 = !(I2 ^ S); + + newval = md_chars_to_number (buf, THUMB_SIZE); + newval2 = md_chars_to_number (buf + THUMB_SIZE, THUMB_SIZE); + newval |= (S << 10) | hi; + newval2 |= (I1 << 13) | (I2 << 11) | lo; + md_number_to_chars (buf, newval, THUMB_SIZE); + md_number_to_chars (buf + THUMB_SIZE, newval2, THUMB_SIZE); + } + break; + + case BFD_RELOC_8: + if (fixP->fx_done || !seg->use_rela_p) + md_number_to_chars (buf, value, 1); + break; + + case BFD_RELOC_16: + if (fixP->fx_done || !seg->use_rela_p) + md_number_to_chars (buf, value, 2); + break; + +#ifdef OBJ_ELF + case BFD_RELOC_ARM_TLS_GD32: + case BFD_RELOC_ARM_TLS_LE32: + case BFD_RELOC_ARM_TLS_IE32: + case BFD_RELOC_ARM_TLS_LDM32: + case BFD_RELOC_ARM_TLS_LDO32: + S_SET_THREAD_LOCAL (fixP->fx_addsy); + /* fall through */ + + case BFD_RELOC_ARM_GOT32: + case BFD_RELOC_ARM_GOTOFF: + case BFD_RELOC_ARM_TARGET2: + if (fixP->fx_done || !seg->use_rela_p) + md_number_to_chars (buf, 0, 4); + break; +#endif + + case BFD_RELOC_RVA: + case BFD_RELOC_32: + case BFD_RELOC_ARM_TARGET1: + case BFD_RELOC_ARM_ROSEGREL32: + case BFD_RELOC_ARM_SBREL32: + case BFD_RELOC_32_PCREL: + if (fixP->fx_done || !seg->use_rela_p) + md_number_to_chars (buf, value, 4); + break; + +#ifdef OBJ_ELF + case BFD_RELOC_ARM_PREL31: + if (fixP->fx_done || !seg->use_rela_p) + { + newval = md_chars_to_number (buf, 4) & 0x80000000; + if ((value ^ (value >> 1)) & 0x40000000) + { + as_bad_where (fixP->fx_file, fixP->fx_line, + _("rel31 relocation overflow")); + } + newval |= value & 0x7fffffff; + md_number_to_chars (buf, newval, 4); + } + break; +#endif + + case BFD_RELOC_ARM_CP_OFF_IMM: + case BFD_RELOC_ARM_T32_CP_OFF_IMM: + if (value < -1023 || value > 1023 || (value & 3)) + as_bad_where (fixP->fx_file, fixP->fx_line, + _("co-processor offset out of range")); + cp_off_common: + sign = value >= 0; + if (value < 0) + value = -value; + if (fixP->fx_r_type == BFD_RELOC_ARM_CP_OFF_IMM + || fixP->fx_r_type == BFD_RELOC_ARM_CP_OFF_IMM_S2) + newval = md_chars_to_number (buf, INSN_SIZE); + else + newval = get_thumb32_insn (buf); + newval &= 0xff7fff00; + newval |= (value >> 2) | (sign ? INDEX_UP : 0); + if (value == 0) + newval &= ~WRITE_BACK; + if (fixP->fx_r_type == BFD_RELOC_ARM_CP_OFF_IMM + || fixP->fx_r_type == BFD_RELOC_ARM_CP_OFF_IMM_S2) + md_number_to_chars (buf, newval, INSN_SIZE); + else + put_thumb32_insn (buf, newval); + break; + + case BFD_RELOC_ARM_CP_OFF_IMM_S2: + case BFD_RELOC_ARM_T32_CP_OFF_IMM_S2: + if (value < -255 || value > 255) + as_bad_where (fixP->fx_file, fixP->fx_line, + _("co-processor offset out of range")); + value *= 4; + goto cp_off_common; + + case BFD_RELOC_ARM_THUMB_OFFSET: + newval = md_chars_to_number (buf, THUMB_SIZE); + /* Exactly what ranges, and where the offset is inserted depends + on the type of instruction, we can establish this from the + top 4 bits. */ + switch (newval >> 12) + { + case 4: /* PC load. */ + /* Thumb PC loads are somewhat odd, bit 1 of the PC is + forced to zero for these loads; md_pcrel_from has already + compensated for this. */ + if (value & 3) + as_bad_where (fixP->fx_file, fixP->fx_line, + _("invalid offset, target not word aligned (0x%08lX)"), + (((unsigned long) fixP->fx_frag->fr_address + + (unsigned long) fixP->fx_where) & ~3) + + (unsigned long) value); + + if (value & ~0x3fc) + as_bad_where (fixP->fx_file, fixP->fx_line, + _("invalid offset, value too big (0x%08lX)"), + (long) value); + + newval |= value >> 2; + break; + + case 9: /* SP load/store. */ + if (value & ~0x3fc) + as_bad_where (fixP->fx_file, fixP->fx_line, + _("invalid offset, value too big (0x%08lX)"), + (long) value); + newval |= value >> 2; + break; + + case 6: /* Word load/store. */ + if (value & ~0x7c) + as_bad_where (fixP->fx_file, fixP->fx_line, + _("invalid offset, value too big (0x%08lX)"), + (long) value); + newval |= value << 4; /* 6 - 2. */ + break; + + case 7: /* Byte load/store. */ + if (value & ~0x1f) + as_bad_where (fixP->fx_file, fixP->fx_line, + _("invalid offset, value too big (0x%08lX)"), + (long) value); + newval |= value << 6; + break; + + case 8: /* Halfword load/store. */ + if (value & ~0x3e) + as_bad_where (fixP->fx_file, fixP->fx_line, + _("invalid offset, value too big (0x%08lX)"), + (long) value); + newval |= value << 5; /* 6 - 1. */ + break; + + default: + as_bad_where (fixP->fx_file, fixP->fx_line, + "Unable to process relocation for thumb opcode: %lx", + (unsigned long) newval); + break; + } + md_number_to_chars (buf, newval, THUMB_SIZE); + break; + + case BFD_RELOC_ARM_THUMB_ADD: + /* This is a complicated relocation, since we use it for all of + the following immediate relocations: + + 3bit ADD/SUB + 8bit ADD/SUB + 9bit ADD/SUB SP word-aligned + 10bit ADD PC/SP word-aligned + + The type of instruction being processed is encoded in the + instruction field: + + 0x8000 SUB + 0x00F0 Rd + 0x000F Rs + */ + newval = md_chars_to_number (buf, THUMB_SIZE); + { + int rd = (newval >> 4) & 0xf; + int rs = newval & 0xf; + int subtract = !!(newval & 0x8000); + + /* Check for HI regs, only very restricted cases allowed: + Adjusting SP, and using PC or SP to get an address. */ + if ((rd > 7 && (rd != REG_SP || rs != REG_SP)) + || (rs > 7 && rs != REG_SP && rs != REG_PC)) + as_bad_where (fixP->fx_file, fixP->fx_line, + _("invalid Hi register with immediate")); + + /* If value is negative, choose the opposite instruction. */ + if (value < 0) + { + value = -value; + subtract = !subtract; + if (value < 0) + as_bad_where (fixP->fx_file, fixP->fx_line, + _("immediate value out of range")); + } + + if (rd == REG_SP) + { + if (value & ~0x1fc) + as_bad_where (fixP->fx_file, fixP->fx_line, + _("invalid immediate for stack address calculation")); + newval = subtract ? T_OPCODE_SUB_ST : T_OPCODE_ADD_ST; + newval |= value >> 2; + } + else if (rs == REG_PC || rs == REG_SP) + { + if (subtract || value & ~0x3fc) + as_bad_where (fixP->fx_file, fixP->fx_line, + _("invalid immediate for address calculation (value = 0x%08lX)"), + (unsigned long) value); + newval = (rs == REG_PC ? T_OPCODE_ADD_PC : T_OPCODE_ADD_SP); + newval |= rd << 8; + newval |= value >> 2; + } + else if (rs == rd) + { + if (value & ~0xff) + as_bad_where (fixP->fx_file, fixP->fx_line, + _("immediate value out of range")); + newval = subtract ? T_OPCODE_SUB_I8 : T_OPCODE_ADD_I8; + newval |= (rd << 8) | value; + } + else + { + if (value & ~0x7) + as_bad_where (fixP->fx_file, fixP->fx_line, + _("immediate value out of range")); + newval = subtract ? T_OPCODE_SUB_I3 : T_OPCODE_ADD_I3; + newval |= rd | (rs << 3) | (value << 6); + } + } + md_number_to_chars (buf, newval, THUMB_SIZE); + break; + + case BFD_RELOC_ARM_THUMB_IMM: + newval = md_chars_to_number (buf, THUMB_SIZE); + if (value < 0 || value > 255) + as_bad_where (fixP->fx_file, fixP->fx_line, + _("invalid immediate: %ld is too large"), + (long) value); + newval |= value; + md_number_to_chars (buf, newval, THUMB_SIZE); + break; + + case BFD_RELOC_ARM_THUMB_SHIFT: + /* 5bit shift value (0..32). LSL cannot take 32. */ + newval = md_chars_to_number (buf, THUMB_SIZE) & 0xf83f; + temp = newval & 0xf800; + if (value < 0 || value > 32 || (value == 32 && temp == T_OPCODE_LSL_I)) + as_bad_where (fixP->fx_file, fixP->fx_line, + _("invalid shift value: %ld"), (long) value); + /* Shifts of zero must be encoded as LSL. */ + if (value == 0) + newval = (newval & 0x003f) | T_OPCODE_LSL_I; + /* Shifts of 32 are encoded as zero. */ + else if (value == 32) + value = 0; + newval |= value << 6; + md_number_to_chars (buf, newval, THUMB_SIZE); + break; + + case BFD_RELOC_VTABLE_INHERIT: + case BFD_RELOC_VTABLE_ENTRY: + fixP->fx_done = 0; + return; + + case BFD_RELOC_UNUSED: + default: + as_bad_where (fixP->fx_file, fixP->fx_line, + _("bad relocation fixup type (%d)"), fixP->fx_r_type); + } +} + +/* Translate internal representation of relocation info to BFD target + format. */ + +arelent * +tc_gen_reloc (asection *section, fixS *fixp) +{ + arelent * reloc; + bfd_reloc_code_real_type code; + + reloc = xmalloc (sizeof (arelent)); + + reloc->sym_ptr_ptr = xmalloc (sizeof (asymbol *)); + *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy); + reloc->address = fixp->fx_frag->fr_address + fixp->fx_where; + + if (fixp->fx_pcrel) + { + if (section->use_rela_p) + fixp->fx_offset -= md_pcrel_from_section (fixp, section); + else + fixp->fx_offset = reloc->address; + } + reloc->addend = fixp->fx_offset; + + switch (fixp->fx_r_type) + { + case BFD_RELOC_8: + if (fixp->fx_pcrel) + { + code = BFD_RELOC_8_PCREL; + break; + } + + case BFD_RELOC_16: + if (fixp->fx_pcrel) + { + code = BFD_RELOC_16_PCREL; + break; + } + + case BFD_RELOC_32: + if (fixp->fx_pcrel) + { + code = BFD_RELOC_32_PCREL; + break; + } + + case BFD_RELOC_NONE: + case BFD_RELOC_ARM_PCREL_BRANCH: + case BFD_RELOC_ARM_PCREL_BLX: + case BFD_RELOC_RVA: + case BFD_RELOC_THUMB_PCREL_BRANCH7: + case BFD_RELOC_THUMB_PCREL_BRANCH9: + case BFD_RELOC_THUMB_PCREL_BRANCH12: + case BFD_RELOC_THUMB_PCREL_BRANCH20: + case BFD_RELOC_THUMB_PCREL_BRANCH23: + case BFD_RELOC_THUMB_PCREL_BRANCH25: + case BFD_RELOC_THUMB_PCREL_BLX: + case BFD_RELOC_VTABLE_ENTRY: + case BFD_RELOC_VTABLE_INHERIT: + code = fixp->fx_r_type; + break; + + case BFD_RELOC_ARM_LITERAL: + case BFD_RELOC_ARM_HWLITERAL: + /* If this is called then the a literal has + been referenced across a section boundary. */ + as_bad_where (fixp->fx_file, fixp->fx_line, + _("literal referenced across section boundary")); + return NULL; + +#ifdef OBJ_ELF + case BFD_RELOC_ARM_GOT32: + case BFD_RELOC_ARM_GOTOFF: + case BFD_RELOC_ARM_PLT32: + case BFD_RELOC_ARM_TARGET1: + case BFD_RELOC_ARM_ROSEGREL32: + case BFD_RELOC_ARM_SBREL32: + case BFD_RELOC_ARM_PREL31: + case BFD_RELOC_ARM_TARGET2: + case BFD_RELOC_ARM_TLS_LE32: + case BFD_RELOC_ARM_TLS_LDO32: + case BFD_RELOC_ARM_PCREL_CALL: + case BFD_RELOC_ARM_PCREL_JUMP: + code = fixp->fx_r_type; + break; + + case BFD_RELOC_ARM_TLS_GD32: + case BFD_RELOC_ARM_TLS_IE32: + case BFD_RELOC_ARM_TLS_LDM32: + /* BFD will include the symbol's address in the addend. + But we don't want that, so subtract it out again here. */ + if (!S_IS_COMMON (fixp->fx_addsy)) + reloc->addend -= (*reloc->sym_ptr_ptr)->value; + code = fixp->fx_r_type; + break; +#endif + + case BFD_RELOC_ARM_IMMEDIATE: + as_bad_where (fixp->fx_file, fixp->fx_line, + _("internal relocation (type: IMMEDIATE) not fixed up")); + return NULL; + + case BFD_RELOC_ARM_ADRL_IMMEDIATE: + as_bad_where (fixp->fx_file, fixp->fx_line, + _("ADRL used for a symbol not defined in the same file")); + return NULL; + + case BFD_RELOC_ARM_OFFSET_IMM: + if (section->use_rela_p) + { + code = fixp->fx_r_type; + break; + } + + if (fixp->fx_addsy != NULL + && !S_IS_DEFINED (fixp->fx_addsy) + && S_IS_LOCAL (fixp->fx_addsy)) + { + as_bad_where (fixp->fx_file, fixp->fx_line, + _("undefined local label `%s'"), + S_GET_NAME (fixp->fx_addsy)); + return NULL; + } + + as_bad_where (fixp->fx_file, fixp->fx_line, + _("internal_relocation (type: OFFSET_IMM) not fixed up")); + return NULL; + + default: + { + char * type; + + switch (fixp->fx_r_type) + { + case BFD_RELOC_NONE: type = "NONE"; break; + case BFD_RELOC_ARM_OFFSET_IMM8: type = "OFFSET_IMM8"; break; + case BFD_RELOC_ARM_SHIFT_IMM: type = "SHIFT_IMM"; break; + case BFD_RELOC_ARM_SMC: type = "SMC"; break; + case BFD_RELOC_ARM_SWI: type = "SWI"; break; + case BFD_RELOC_ARM_MULTI: type = "MULTI"; break; + case BFD_RELOC_ARM_CP_OFF_IMM: type = "CP_OFF_IMM"; break; + case BFD_RELOC_ARM_T32_CP_OFF_IMM: type = "T32_CP_OFF_IMM"; break; + case BFD_RELOC_ARM_THUMB_ADD: type = "THUMB_ADD"; break; + case BFD_RELOC_ARM_THUMB_SHIFT: type = "THUMB_SHIFT"; break; + case BFD_RELOC_ARM_THUMB_IMM: type = "THUMB_IMM"; break; + case BFD_RELOC_ARM_THUMB_OFFSET: type = "THUMB_OFFSET"; break; + default: type = _(""); break; + } + as_bad_where (fixp->fx_file, fixp->fx_line, + _("cannot represent %s relocation in this object file format"), + type); + return NULL; + } + } + +#ifdef OBJ_ELF + if ((code == BFD_RELOC_32_PCREL || code == BFD_RELOC_32) + && GOT_symbol + && fixp->fx_addsy == GOT_symbol) + { + code = BFD_RELOC_ARM_GOTPC; + reloc->addend = fixp->fx_offset = reloc->address; + } +#endif + + reloc->howto = bfd_reloc_type_lookup (stdoutput, code); + + if (reloc->howto == NULL) + { + as_bad_where (fixp->fx_file, fixp->fx_line, + _("cannot represent %s relocation in this object file format"), + bfd_get_reloc_code_name (code)); + return NULL; + } + + /* HACK: Since arm ELF uses Rel instead of Rela, encode the + vtable entry to be used in the relocation's section offset. */ + if (fixp->fx_r_type == BFD_RELOC_VTABLE_ENTRY) + reloc->address = fixp->fx_offset; + + return reloc; +} + +/* This fix_new is called by cons via TC_CONS_FIX_NEW. */ + +void +cons_fix_new_arm (fragS * frag, + int where, + int size, + expressionS * exp) +{ + bfd_reloc_code_real_type type; + int pcrel = 0; + + /* Pick a reloc. + FIXME: @@ Should look at CPU word size. */ + switch (size) + { + case 1: + type = BFD_RELOC_8; + break; + case 2: + type = BFD_RELOC_16; + break; + case 4: + default: + type = BFD_RELOC_32; + break; + case 8: + type = BFD_RELOC_64; + break; + } + + fix_new_exp (frag, where, (int) size, exp, pcrel, type); +} + +#if defined OBJ_COFF || defined OBJ_ELF +void +arm_validate_fix (fixS * fixP) +{ + /* If the destination of the branch is a defined symbol which does not have + the THUMB_FUNC attribute, then we must be calling a function which has + the (interfacearm) attribute. We look for the Thumb entry point to that + function and change the branch to refer to that function instead. */ + if (fixP->fx_r_type == BFD_RELOC_THUMB_PCREL_BRANCH23 + && fixP->fx_addsy != NULL + && S_IS_DEFINED (fixP->fx_addsy) + && ! THUMB_IS_FUNC (fixP->fx_addsy)) + { + fixP->fx_addsy = find_real_start (fixP->fx_addsy); + } +} +#endif + +int +arm_force_relocation (struct fix * fixp) +{ +#if defined (OBJ_COFF) && defined (TE_PE) + if (fixp->fx_r_type == BFD_RELOC_RVA) + return 1; +#endif + + /* Resolve these relocations even if the symbol is extern or weak. */ + if (fixp->fx_r_type == BFD_RELOC_ARM_IMMEDIATE + || fixp->fx_r_type == BFD_RELOC_ARM_OFFSET_IMM + || fixp->fx_r_type == BFD_RELOC_ARM_ADRL_IMMEDIATE + || fixp->fx_r_type == BFD_RELOC_ARM_T32_IMMEDIATE + || fixp->fx_r_type == BFD_RELOC_ARM_T32_IMM12 + || fixp->fx_r_type == BFD_RELOC_ARM_T32_ADD_PC12) + return 0; + + return generic_force_reloc (fixp); +} + +#ifdef OBJ_COFF +/* This is a little hack to help the gas/arm/adrl.s test. It prevents + local labels from being added to the output symbol table when they + are used with the ADRL pseudo op. The ADRL relocation should always + be resolved before the binbary is emitted, so it is safe to say that + it is adjustable. */ + +bfd_boolean +arm_fix_adjustable (fixS * fixP) +{ + if (fixP->fx_r_type == BFD_RELOC_ARM_ADRL_IMMEDIATE) + return 1; + return 0; +} +#endif + +#ifdef OBJ_ELF +/* Relocations against Thumb function names must be left unadjusted, + so that the linker can use this information to correctly set the + bottom bit of their addresses. The MIPS version of this function + also prevents relocations that are mips-16 specific, but I do not + know why it does this. + + FIXME: + There is one other problem that ought to be addressed here, but + which currently is not: Taking the address of a label (rather + than a function) and then later jumping to that address. Such + addresses also ought to have their bottom bit set (assuming that + they reside in Thumb code), but at the moment they will not. */ + +bfd_boolean +arm_fix_adjustable (fixS * fixP) +{ + if (fixP->fx_addsy == NULL) + return 1; + + if (THUMB_IS_FUNC (fixP->fx_addsy) + && fixP->fx_subsy == NULL) + return 0; + + /* We need the symbol name for the VTABLE entries. */ + if ( fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT + || fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY) + return 0; + + /* Don't allow symbols to be discarded on GOT related relocs. */ + if (fixP->fx_r_type == BFD_RELOC_ARM_PLT32 + || fixP->fx_r_type == BFD_RELOC_ARM_GOT32 + || fixP->fx_r_type == BFD_RELOC_ARM_GOTOFF + || fixP->fx_r_type == BFD_RELOC_ARM_TLS_GD32 + || fixP->fx_r_type == BFD_RELOC_ARM_TLS_LE32 + || fixP->fx_r_type == BFD_RELOC_ARM_TLS_IE32 + || fixP->fx_r_type == BFD_RELOC_ARM_TLS_LDM32 + || fixP->fx_r_type == BFD_RELOC_ARM_TLS_LDO32 + || fixP->fx_r_type == BFD_RELOC_ARM_TARGET2) + return 0; + + return 1; +} + +const char * +elf32_arm_target_format (void) +{ +#ifdef TE_SYMBIAN + return (target_big_endian + ? "elf32-bigarm-symbian" + : "elf32-littlearm-symbian"); +#elif defined (TE_VXWORKS) + return (target_big_endian + ? "elf32-bigarm-vxworks" + : "elf32-littlearm-vxworks"); +#else + if (target_big_endian) + return "elf32-bigarm"; + else + return "elf32-littlearm"; +#endif +} + +void +armelf_frob_symbol (symbolS * symp, + int * puntp) +{ + elf_frob_symbol (symp, puntp); +} +#endif + +/* MD interface: Finalization. */ + +/* A good place to do this, although this was probably not intended + for this kind of use. We need to dump the literal pool before + references are made to a null symbol pointer. */ + +void +arm_cleanup (void) +{ + literal_pool * pool; + + for (pool = list_of_pools; pool; pool = pool->next) + { + /* Put it at the end of the relevent section. */ + subseg_set (pool->section, pool->sub_section); +#ifdef OBJ_ELF + arm_elf_change_section (); +#endif + s_ltorg (0); + } +} + +/* Adjust the symbol table. This marks Thumb symbols as distinct from + ARM ones. */ + +void +arm_adjust_symtab (void) +{ +#ifdef OBJ_COFF + symbolS * sym; + + for (sym = symbol_rootP; sym != NULL; sym = symbol_next (sym)) + { + if (ARM_IS_THUMB (sym)) + { + if (THUMB_IS_FUNC (sym)) + { + /* Mark the symbol as a Thumb function. */ + if ( S_GET_STORAGE_CLASS (sym) == C_STAT + || S_GET_STORAGE_CLASS (sym) == C_LABEL) /* This can happen! */ + S_SET_STORAGE_CLASS (sym, C_THUMBSTATFUNC); + + else if (S_GET_STORAGE_CLASS (sym) == C_EXT) + S_SET_STORAGE_CLASS (sym, C_THUMBEXTFUNC); + else + as_bad (_("%s: unexpected function type: %d"), + S_GET_NAME (sym), S_GET_STORAGE_CLASS (sym)); + } + else switch (S_GET_STORAGE_CLASS (sym)) + { + case C_EXT: + S_SET_STORAGE_CLASS (sym, C_THUMBEXT); + break; + case C_STAT: + S_SET_STORAGE_CLASS (sym, C_THUMBSTAT); + break; + case C_LABEL: + S_SET_STORAGE_CLASS (sym, C_THUMBLABEL); + break; + default: + /* Do nothing. */ + break; + } + } + + if (ARM_IS_INTERWORK (sym)) + coffsymbol (symbol_get_bfdsym (sym))->native->u.syment.n_flags = 0xFF; + } +#endif +#ifdef OBJ_ELF + symbolS * sym; + char bind; + + for (sym = symbol_rootP; sym != NULL; sym = symbol_next (sym)) + { + if (ARM_IS_THUMB (sym)) + { + elf_symbol_type * elf_sym; + + elf_sym = elf_symbol (symbol_get_bfdsym (sym)); + bind = ELF_ST_BIND (elf_sym->internal_elf_sym.st_info); + + if (! bfd_is_arm_mapping_symbol_name (elf_sym->symbol.name)) + { + /* If it's a .thumb_func, declare it as so, + otherwise tag label as .code 16. */ + if (THUMB_IS_FUNC (sym)) + elf_sym->internal_elf_sym.st_info = + ELF_ST_INFO (bind, STT_ARM_TFUNC); + else + elf_sym->internal_elf_sym.st_info = + ELF_ST_INFO (bind, STT_ARM_16BIT); + } + } + } +#endif +} + +/* MD interface: Initialization. */ + +static void +set_constant_flonums (void) +{ + int i; + + for (i = 0; i < NUM_FLOAT_VALS; i++) + if (atof_ieee ((char *) fp_const[i], 'x', fp_values[i]) == NULL) + abort (); +} + +void +md_begin (void) +{ + unsigned mach; + unsigned int i; + + if ( (arm_ops_hsh = hash_new ()) == NULL + || (arm_cond_hsh = hash_new ()) == NULL + || (arm_shift_hsh = hash_new ()) == NULL + || (arm_psr_hsh = hash_new ()) == NULL + || (arm_v7m_psr_hsh = hash_new ()) == NULL + || (arm_reg_hsh = hash_new ()) == NULL + || (arm_reloc_hsh = hash_new ()) == NULL + || (arm_barrier_opt_hsh = hash_new ()) == NULL) + as_fatal (_("virtual memory exhausted")); + + for (i = 0; i < sizeof (insns) / sizeof (struct asm_opcode); i++) + hash_insert (arm_ops_hsh, insns[i].template, (PTR) (insns + i)); + for (i = 0; i < sizeof (conds) / sizeof (struct asm_cond); i++) + hash_insert (arm_cond_hsh, conds[i].template, (PTR) (conds + i)); + for (i = 0; i < sizeof (shift_names) / sizeof (struct asm_shift_name); i++) + hash_insert (arm_shift_hsh, shift_names[i].name, (PTR) (shift_names + i)); + for (i = 0; i < sizeof (psrs) / sizeof (struct asm_psr); i++) + hash_insert (arm_psr_hsh, psrs[i].template, (PTR) (psrs + i)); + for (i = 0; i < sizeof (v7m_psrs) / sizeof (struct asm_psr); i++) + hash_insert (arm_v7m_psr_hsh, v7m_psrs[i].template, (PTR) (v7m_psrs + i)); + for (i = 0; i < sizeof (reg_names) / sizeof (struct reg_entry); i++) + hash_insert (arm_reg_hsh, reg_names[i].name, (PTR) (reg_names + i)); + for (i = 0; + i < sizeof (barrier_opt_names) / sizeof (struct asm_barrier_opt); + i++) + hash_insert (arm_barrier_opt_hsh, barrier_opt_names[i].template, + (PTR) (barrier_opt_names + i)); +#ifdef OBJ_ELF + for (i = 0; i < sizeof (reloc_names) / sizeof (struct reloc_entry); i++) + hash_insert (arm_reloc_hsh, reloc_names[i].name, (PTR) (reloc_names + i)); +#endif + + set_constant_flonums (); + + /* Set the cpu variant based on the command-line options. We prefer + -mcpu= over -march= if both are set (as for GCC); and we prefer + -mfpu= over any other way of setting the floating point unit. + Use of legacy options with new options are faulted. */ + if (legacy_cpu) + { + if (mcpu_cpu_opt || march_cpu_opt) + as_bad (_("use of old and new-style options to set CPU type")); + + mcpu_cpu_opt = legacy_cpu; + } + else if (!mcpu_cpu_opt) + mcpu_cpu_opt = march_cpu_opt; + + if (legacy_fpu) + { + if (mfpu_opt) + as_bad (_("use of old and new-style options to set FPU type")); + + mfpu_opt = legacy_fpu; + } + else if (!mfpu_opt) + { +#if !(defined (TE_LINUX) || defined (TE_NetBSD) || defined (TE_VXWORKS)) + /* Some environments specify a default FPU. If they don't, infer it + from the processor. */ + if (mcpu_fpu_opt) + mfpu_opt = mcpu_fpu_opt; + else + mfpu_opt = march_fpu_opt; +#else + mfpu_opt = &fpu_default; +#endif + } + + if (!mfpu_opt) + { + if (!mcpu_cpu_opt) + mfpu_opt = &fpu_default; + else if (ARM_CPU_HAS_FEATURE (*mcpu_fpu_opt, arm_ext_v5)) + mfpu_opt = &fpu_arch_vfp_v2; + else + mfpu_opt = &fpu_arch_fpa; + } + +#ifdef CPU_DEFAULT + if (!mcpu_cpu_opt) + { + mcpu_cpu_opt = &cpu_default; + selected_cpu = cpu_default; + } +#else + if (mcpu_cpu_opt) + selected_cpu = *mcpu_cpu_opt; + else + mcpu_cpu_opt = &arm_arch_any; +#endif + + ARM_MERGE_FEATURE_SETS (cpu_variant, *mcpu_cpu_opt, *mfpu_opt); + + arm_arch_used = thumb_arch_used = arm_arch_none; + +#if defined OBJ_COFF || defined OBJ_ELF + { + unsigned int flags = 0; + +#if defined OBJ_ELF + flags = meabi_flags; + + switch (meabi_flags) + { + case EF_ARM_EABI_UNKNOWN: +#endif + /* Set the flags in the private structure. */ + if (uses_apcs_26) flags |= F_APCS26; + if (support_interwork) flags |= F_INTERWORK; + if (uses_apcs_float) flags |= F_APCS_FLOAT; + if (pic_code) flags |= F_PIC; + if (!ARM_CPU_HAS_FEATURE (cpu_variant, fpu_any_hard)) + flags |= F_SOFT_FLOAT; + + switch (mfloat_abi_opt) + { + case ARM_FLOAT_ABI_SOFT: + case ARM_FLOAT_ABI_SOFTFP: + flags |= F_SOFT_FLOAT; + break; + + case ARM_FLOAT_ABI_HARD: + if (flags & F_SOFT_FLOAT) + as_bad (_("hard-float conflicts with specified fpu")); + break; + } + + /* Using pure-endian doubles (even if soft-float). */ + if (ARM_CPU_HAS_FEATURE (cpu_variant, fpu_endian_pure)) + flags |= F_VFP_FLOAT; + +#if defined OBJ_ELF + if (ARM_CPU_HAS_FEATURE (cpu_variant, fpu_arch_maverick)) + flags |= EF_ARM_MAVERICK_FLOAT; + break; + + case EF_ARM_EABI_VER4: + case EF_ARM_EABI_VER5: + /* No additional flags to set. */ + break; + + default: + abort (); + } +#endif + bfd_set_private_flags (stdoutput, flags); + + /* We have run out flags in the COFF header to encode the + status of ATPCS support, so instead we create a dummy, + empty, debug section called .arm.atpcs. */ + if (atpcs) + { + asection * sec; + + sec = bfd_make_section (stdoutput, ".arm.atpcs"); + + if (sec != NULL) + { + bfd_set_section_flags + (stdoutput, sec, SEC_READONLY | SEC_DEBUGGING /* | SEC_HAS_CONTENTS */); + bfd_set_section_size (stdoutput, sec, 0); + bfd_set_section_contents (stdoutput, sec, NULL, 0, 0); + } + } + } +#endif + + /* Record the CPU type as well. */ + if (ARM_CPU_HAS_FEATURE (cpu_variant, arm_cext_iwmmxt)) + mach = bfd_mach_arm_iWMMXt; + else if (ARM_CPU_HAS_FEATURE (cpu_variant, arm_cext_xscale)) + mach = bfd_mach_arm_XScale; + else if (ARM_CPU_HAS_FEATURE (cpu_variant, arm_cext_maverick)) + mach = bfd_mach_arm_ep9312; + else if (ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_v5e)) + mach = bfd_mach_arm_5TE; + else if (ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_v5)) + { + if (ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_v4t)) + mach = bfd_mach_arm_5T; + else + mach = bfd_mach_arm_5; + } + else if (ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_v4)) + { + if (ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_v4t)) + mach = bfd_mach_arm_4T; + else + mach = bfd_mach_arm_4; + } + else if (ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_v3m)) + mach = bfd_mach_arm_3M; + else if (ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_v3)) + mach = bfd_mach_arm_3; + else if (ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_v2s)) + mach = bfd_mach_arm_2a; + else if (ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_v2)) + mach = bfd_mach_arm_2; + else + mach = bfd_mach_arm_unknown; + + bfd_set_arch_mach (stdoutput, TARGET_ARCH, mach); +} + +/* Command line processing. */ + +/* md_parse_option + Invocation line includes a switch not recognized by the base assembler. + See if it's a processor-specific option. + + This routine is somewhat complicated by the need for backwards + compatibility (since older releases of gcc can't be changed). + The new options try to make the interface as compatible as + possible with GCC. + + New options (supported) are: + + -mcpu= Assemble for selected processor + -march= Assemble for selected architecture + -mfpu= Assemble for selected FPU. + -EB/-mbig-endian Big-endian + -EL/-mlittle-endian Little-endian + -k Generate PIC code + -mthumb Start in Thumb mode + -mthumb-interwork Code supports ARM/Thumb interworking + + For now we will also provide support for: + + -mapcs-32 32-bit Program counter + -mapcs-26 26-bit Program counter + -macps-float Floats passed in FP registers + -mapcs-reentrant Reentrant code + -matpcs + (sometime these will probably be replaced with -mapcs= + and -matpcs=) + + The remaining options are only supported for back-wards compatibility. + Cpu variants, the arm part is optional: + -m[arm]1 Currently not supported. + -m[arm]2, -m[arm]250 Arm 2 and Arm 250 processor + -m[arm]3 Arm 3 processor + -m[arm]6[xx], Arm 6 processors + -m[arm]7[xx][t][[d]m] Arm 7 processors + -m[arm]8[10] Arm 8 processors + -m[arm]9[20][tdmi] Arm 9 processors + -mstrongarm[110[0]] StrongARM processors + -mxscale XScale processors + -m[arm]v[2345[t[e]]] Arm architectures + -mall All (except the ARM1) + FP variants: + -mfpa10, -mfpa11 FPA10 and 11 co-processor instructions + -mfpe-old (No float load/store multiples) + -mvfpxd VFP Single precision + -mvfp All VFP + -mno-fpu Disable all floating point instructions + + The following CPU names are recognized: + arm1, arm2, arm250, arm3, arm6, arm600, arm610, arm620, + arm7, arm7m, arm7d, arm7dm, arm7di, arm7dmi, arm70, arm700, + arm700i, arm710 arm710t, arm720, arm720t, arm740t, arm710c, + arm7100, arm7500, arm7500fe, arm7tdmi, arm8, arm810, arm9, + arm920, arm920t, arm940t, arm946, arm966, arm9tdmi, arm9e, + arm10t arm10e, arm1020t, arm1020e, arm10200e, + strongarm, strongarm110, strongarm1100, strongarm1110, xscale. + + */ + +const char * md_shortopts = "m:k"; + +#ifdef ARM_BI_ENDIAN +#define OPTION_EB (OPTION_MD_BASE + 0) +#define OPTION_EL (OPTION_MD_BASE + 1) +#else +#if TARGET_BYTES_BIG_ENDIAN +#define OPTION_EB (OPTION_MD_BASE + 0) +#else +#define OPTION_EL (OPTION_MD_BASE + 1) +#endif +#endif + +struct option md_longopts[] = +{ +#ifdef OPTION_EB + {"EB", no_argument, NULL, OPTION_EB}, +#endif +#ifdef OPTION_EL + {"EL", no_argument, NULL, OPTION_EL}, +#endif + {NULL, no_argument, NULL, 0} +}; + +size_t md_longopts_size = sizeof (md_longopts); + +struct arm_option_table +{ + char *option; /* Option name to match. */ + char *help; /* Help information. */ + int *var; /* Variable to change. */ + int value; /* What to change it to. */ + char *deprecated; /* If non-null, print this message. */ +}; + +struct arm_option_table arm_opts[] = +{ + {"k", N_("generate PIC code"), &pic_code, 1, NULL}, + {"mthumb", N_("assemble Thumb code"), &thumb_mode, 1, NULL}, + {"mthumb-interwork", N_("support ARM/Thumb interworking"), + &support_interwork, 1, NULL}, + {"mapcs-32", N_("code uses 32-bit program counter"), &uses_apcs_26, 0, NULL}, + {"mapcs-26", N_("code uses 26-bit program counter"), &uses_apcs_26, 1, NULL}, + {"mapcs-float", N_("floating point args are in fp regs"), &uses_apcs_float, + 1, NULL}, + {"mapcs-reentrant", N_("re-entrant code"), &pic_code, 1, NULL}, + {"matpcs", N_("code is ATPCS conformant"), &atpcs, 1, NULL}, + {"mbig-endian", N_("assemble for big-endian"), &target_big_endian, 1, NULL}, + {"mlittle-endian", N_("assemble for little-endian"), &target_big_endian, 0, + NULL}, + + /* These are recognized by the assembler, but have no affect on code. */ + {"mapcs-frame", N_("use frame pointer"), NULL, 0, NULL}, + {"mapcs-stack-check", N_("use stack size checking"), NULL, 0, NULL}, + {NULL, NULL, NULL, 0, NULL} +}; + +struct arm_legacy_option_table +{ + char *option; /* Option name to match. */ + const arm_feature_set **var; /* Variable to change. */ + const arm_feature_set value; /* What to change it to. */ + char *deprecated; /* If non-null, print this message. */ +}; + +const struct arm_legacy_option_table arm_legacy_opts[] = +{ + /* DON'T add any new processors to this list -- we want the whole list + to go away... Add them to the processors table instead. */ + {"marm1", &legacy_cpu, ARM_ARCH_V1, N_("use -mcpu=arm1")}, + {"m1", &legacy_cpu, ARM_ARCH_V1, N_("use -mcpu=arm1")}, + {"marm2", &legacy_cpu, ARM_ARCH_V2, N_("use -mcpu=arm2")}, + {"m2", &legacy_cpu, ARM_ARCH_V2, N_("use -mcpu=arm2")}, + {"marm250", &legacy_cpu, ARM_ARCH_V2S, N_("use -mcpu=arm250")}, + {"m250", &legacy_cpu, ARM_ARCH_V2S, N_("use -mcpu=arm250")}, + {"marm3", &legacy_cpu, ARM_ARCH_V2S, N_("use -mcpu=arm3")}, + {"m3", &legacy_cpu, ARM_ARCH_V2S, N_("use -mcpu=arm3")}, + {"marm6", &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm6")}, + {"m6", &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm6")}, + {"marm600", &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm600")}, + {"m600", &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm600")}, + {"marm610", &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm610")}, + {"m610", &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm610")}, + {"marm620", &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm620")}, + {"m620", &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm620")}, + {"marm7", &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm7")}, + {"m7", &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm7")}, + {"marm70", &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm70")}, + {"m70", &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm70")}, + {"marm700", &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm700")}, + {"m700", &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm700")}, + {"marm700i", &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm700i")}, + {"m700i", &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm700i")}, + {"marm710", &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm710")}, + {"m710", &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm710")}, + {"marm710c", &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm710c")}, + {"m710c", &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm710c")}, + {"marm720", &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm720")}, + {"m720", &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm720")}, + {"marm7d", &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm7d")}, + {"m7d", &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm7d")}, + {"marm7di", &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm7di")}, + {"m7di", &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm7di")}, + {"marm7m", &legacy_cpu, ARM_ARCH_V3M, N_("use -mcpu=arm7m")}, + {"m7m", &legacy_cpu, ARM_ARCH_V3M, N_("use -mcpu=arm7m")}, + {"marm7dm", &legacy_cpu, ARM_ARCH_V3M, N_("use -mcpu=arm7dm")}, + {"m7dm", &legacy_cpu, ARM_ARCH_V3M, N_("use -mcpu=arm7dm")}, + {"marm7dmi", &legacy_cpu, ARM_ARCH_V3M, N_("use -mcpu=arm7dmi")}, + {"m7dmi", &legacy_cpu, ARM_ARCH_V3M, N_("use -mcpu=arm7dmi")}, + {"marm7100", &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm7100")}, + {"m7100", &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm7100")}, + {"marm7500", &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm7500")}, + {"m7500", &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm7500")}, + {"marm7500fe", &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm7500fe")}, + {"m7500fe", &legacy_cpu, ARM_ARCH_V3, N_("use -mcpu=arm7500fe")}, + {"marm7t", &legacy_cpu, ARM_ARCH_V4T, N_("use -mcpu=arm7tdmi")}, + {"m7t", &legacy_cpu, ARM_ARCH_V4T, N_("use -mcpu=arm7tdmi")}, + {"marm7tdmi", &legacy_cpu, ARM_ARCH_V4T, N_("use -mcpu=arm7tdmi")}, + {"m7tdmi", &legacy_cpu, ARM_ARCH_V4T, N_("use -mcpu=arm7tdmi")}, + {"marm710t", &legacy_cpu, ARM_ARCH_V4T, N_("use -mcpu=arm710t")}, + {"m710t", &legacy_cpu, ARM_ARCH_V4T, N_("use -mcpu=arm710t")}, + {"marm720t", &legacy_cpu, ARM_ARCH_V4T, N_("use -mcpu=arm720t")}, + {"m720t", &legacy_cpu, ARM_ARCH_V4T, N_("use -mcpu=arm720t")}, + {"marm740t", &legacy_cpu, ARM_ARCH_V4T, N_("use -mcpu=arm740t")}, + {"m740t", &legacy_cpu, ARM_ARCH_V4T, N_("use -mcpu=arm740t")}, + {"marm8", &legacy_cpu, ARM_ARCH_V4, N_("use -mcpu=arm8")}, + {"m8", &legacy_cpu, ARM_ARCH_V4, N_("use -mcpu=arm8")}, + {"marm810", &legacy_cpu, ARM_ARCH_V4, N_("use -mcpu=arm810")}, + {"m810", &legacy_cpu, ARM_ARCH_V4, N_("use -mcpu=arm810")}, + {"marm9", &legacy_cpu, ARM_ARCH_V4T, N_("use -mcpu=arm9")}, + {"m9", &legacy_cpu, ARM_ARCH_V4T, N_("use -mcpu=arm9")}, + {"marm9tdmi", &legacy_cpu, ARM_ARCH_V4T, N_("use -mcpu=arm9tdmi")}, + {"m9tdmi", &legacy_cpu, ARM_ARCH_V4T, N_("use -mcpu=arm9tdmi")}, + {"marm920", &legacy_cpu, ARM_ARCH_V4T, N_("use -mcpu=arm920")}, + {"m920", &legacy_cpu, ARM_ARCH_V4T, N_("use -mcpu=arm920")}, + {"marm940", &legacy_cpu, ARM_ARCH_V4T, N_("use -mcpu=arm940")}, + {"m940", &legacy_cpu, ARM_ARCH_V4T, N_("use -mcpu=arm940")}, + {"mstrongarm", &legacy_cpu, ARM_ARCH_V4, N_("use -mcpu=strongarm")}, + {"mstrongarm110", &legacy_cpu, ARM_ARCH_V4, + N_("use -mcpu=strongarm110")}, + {"mstrongarm1100", &legacy_cpu, ARM_ARCH_V4, + N_("use -mcpu=strongarm1100")}, + {"mstrongarm1110", &legacy_cpu, ARM_ARCH_V4, + N_("use -mcpu=strongarm1110")}, + {"mxscale", &legacy_cpu, ARM_ARCH_XSCALE, N_("use -mcpu=xscale")}, + {"miwmmxt", &legacy_cpu, ARM_ARCH_IWMMXT, N_("use -mcpu=iwmmxt")}, + {"mall", &legacy_cpu, ARM_ANY, N_("use -mcpu=all")}, + + /* Architecture variants -- don't add any more to this list either. */ + {"mv2", &legacy_cpu, ARM_ARCH_V2, N_("use -march=armv2")}, + {"marmv2", &legacy_cpu, ARM_ARCH_V2, N_("use -march=armv2")}, + {"mv2a", &legacy_cpu, ARM_ARCH_V2S, N_("use -march=armv2a")}, + {"marmv2a", &legacy_cpu, ARM_ARCH_V2S, N_("use -march=armv2a")}, + {"mv3", &legacy_cpu, ARM_ARCH_V3, N_("use -march=armv3")}, + {"marmv3", &legacy_cpu, ARM_ARCH_V3, N_("use -march=armv3")}, + {"mv3m", &legacy_cpu, ARM_ARCH_V3M, N_("use -march=armv3m")}, + {"marmv3m", &legacy_cpu, ARM_ARCH_V3M, N_("use -march=armv3m")}, + {"mv4", &legacy_cpu, ARM_ARCH_V4, N_("use -march=armv4")}, + {"marmv4", &legacy_cpu, ARM_ARCH_V4, N_("use -march=armv4")}, + {"mv4t", &legacy_cpu, ARM_ARCH_V4T, N_("use -march=armv4t")}, + {"marmv4t", &legacy_cpu, ARM_ARCH_V4T, N_("use -march=armv4t")}, + {"mv5", &legacy_cpu, ARM_ARCH_V5, N_("use -march=armv5")}, + {"marmv5", &legacy_cpu, ARM_ARCH_V5, N_("use -march=armv5")}, + {"mv5t", &legacy_cpu, ARM_ARCH_V5T, N_("use -march=armv5t")}, + {"marmv5t", &legacy_cpu, ARM_ARCH_V5T, N_("use -march=armv5t")}, + {"mv5e", &legacy_cpu, ARM_ARCH_V5TE, N_("use -march=armv5te")}, + {"marmv5e", &legacy_cpu, ARM_ARCH_V5TE, N_("use -march=armv5te")}, + + /* Floating point variants -- don't add any more to this list either. */ + {"mfpe-old", &legacy_fpu, FPU_ARCH_FPE, N_("use -mfpu=fpe")}, + {"mfpa10", &legacy_fpu, FPU_ARCH_FPA, N_("use -mfpu=fpa10")}, + {"mfpa11", &legacy_fpu, FPU_ARCH_FPA, N_("use -mfpu=fpa11")}, + {"mno-fpu", &legacy_fpu, ARM_ARCH_NONE, + N_("use either -mfpu=softfpa or -mfpu=softvfp")}, + + {NULL, NULL, ARM_ARCH_NONE, NULL} +}; + +struct arm_cpu_option_table +{ + char *name; + const arm_feature_set value; + /* For some CPUs we assume an FPU unless the user explicitly sets + -mfpu=... */ + const arm_feature_set default_fpu; + /* The canonical name of the CPU, or NULL to use NAME converted to upper + case. */ + const char *canonical_name; +}; + +/* This list should, at a minimum, contain all the cpu names + recognized by GCC. */ +static const struct arm_cpu_option_table arm_cpus[] = +{ + {"all", ARM_ANY, FPU_ARCH_FPA, NULL}, + {"arm1", ARM_ARCH_V1, FPU_ARCH_FPA, NULL}, + {"arm2", ARM_ARCH_V2, FPU_ARCH_FPA, NULL}, + {"arm250", ARM_ARCH_V2S, FPU_ARCH_FPA, NULL}, + {"arm3", ARM_ARCH_V2S, FPU_ARCH_FPA, NULL}, + {"arm6", ARM_ARCH_V3, FPU_ARCH_FPA, NULL}, + {"arm60", ARM_ARCH_V3, FPU_ARCH_FPA, NULL}, + {"arm600", ARM_ARCH_V3, FPU_ARCH_FPA, NULL}, + {"arm610", ARM_ARCH_V3, FPU_ARCH_FPA, NULL}, + {"arm620", ARM_ARCH_V3, FPU_ARCH_FPA, NULL}, + {"arm7", ARM_ARCH_V3, FPU_ARCH_FPA, NULL}, + {"arm7m", ARM_ARCH_V3M, FPU_ARCH_FPA, NULL}, + {"arm7d", ARM_ARCH_V3, FPU_ARCH_FPA, NULL}, + {"arm7dm", ARM_ARCH_V3M, FPU_ARCH_FPA, NULL}, + {"arm7di", ARM_ARCH_V3, FPU_ARCH_FPA, NULL}, + {"arm7dmi", ARM_ARCH_V3M, FPU_ARCH_FPA, NULL}, + {"arm70", ARM_ARCH_V3, FPU_ARCH_FPA, NULL}, + {"arm700", ARM_ARCH_V3, FPU_ARCH_FPA, NULL}, + {"arm700i", ARM_ARCH_V3, FPU_ARCH_FPA, NULL}, + {"arm710", ARM_ARCH_V3, FPU_ARCH_FPA, NULL}, + {"arm710t", ARM_ARCH_V4T, FPU_ARCH_FPA, NULL}, + {"arm720", ARM_ARCH_V3, FPU_ARCH_FPA, NULL}, + {"arm720t", ARM_ARCH_V4T, FPU_ARCH_FPA, NULL}, + {"arm740t", ARM_ARCH_V4T, FPU_ARCH_FPA, NULL}, + {"arm710c", ARM_ARCH_V3, FPU_ARCH_FPA, NULL}, + {"arm7100", ARM_ARCH_V3, FPU_ARCH_FPA, NULL}, + {"arm7500", ARM_ARCH_V3, FPU_ARCH_FPA, NULL}, + {"arm7500fe", ARM_ARCH_V3, FPU_ARCH_FPA, NULL}, + {"arm7t", ARM_ARCH_V4T, FPU_ARCH_FPA, NULL}, + {"arm7tdmi", ARM_ARCH_V4T, FPU_ARCH_FPA, NULL}, + {"arm7tdmi-s", ARM_ARCH_V4T, FPU_ARCH_FPA, NULL}, + {"arm8", ARM_ARCH_V4, FPU_ARCH_FPA, NULL}, + {"arm810", ARM_ARCH_V4, FPU_ARCH_FPA, NULL}, + {"strongarm", ARM_ARCH_V4, FPU_ARCH_FPA, NULL}, + {"strongarm1", ARM_ARCH_V4, FPU_ARCH_FPA, NULL}, + {"strongarm110", ARM_ARCH_V4, FPU_ARCH_FPA, NULL}, + {"strongarm1100", ARM_ARCH_V4, FPU_ARCH_FPA, NULL}, + {"strongarm1110", ARM_ARCH_V4, FPU_ARCH_FPA, NULL}, + {"arm9", ARM_ARCH_V4T, FPU_ARCH_FPA, NULL}, + {"arm920", ARM_ARCH_V4T, FPU_ARCH_FPA, "ARM920T"}, + {"arm920t", ARM_ARCH_V4T, FPU_ARCH_FPA, NULL}, + {"arm922t", ARM_ARCH_V4T, FPU_ARCH_FPA, NULL}, + {"arm940t", ARM_ARCH_V4T, FPU_ARCH_FPA, NULL}, + {"arm9tdmi", ARM_ARCH_V4T, FPU_ARCH_FPA, NULL}, + /* For V5 or later processors we default to using VFP; but the user + should really set the FPU type explicitly. */ + {"arm9e-r0", ARM_ARCH_V5TExP, FPU_ARCH_VFP_V2, NULL}, + {"arm9e", ARM_ARCH_V5TE, FPU_ARCH_VFP_V2, NULL}, + {"arm926ej", ARM_ARCH_V5TEJ, FPU_ARCH_VFP_V2, "ARM926EJ-S"}, + {"arm926ejs", ARM_ARCH_V5TEJ, FPU_ARCH_VFP_V2, "ARM926EJ-S"}, + {"arm926ej-s", ARM_ARCH_V5TEJ, FPU_ARCH_VFP_V2, NULL}, + {"arm946e-r0", ARM_ARCH_V5TExP, FPU_ARCH_VFP_V2, NULL}, + {"arm946e", ARM_ARCH_V5TE, FPU_ARCH_VFP_V2, "ARM946E-S"}, + {"arm946e-s", ARM_ARCH_V5TE, FPU_ARCH_VFP_V2, NULL}, + {"arm966e-r0", ARM_ARCH_V5TExP, FPU_ARCH_VFP_V2, NULL}, + {"arm966e", ARM_ARCH_V5TE, FPU_ARCH_VFP_V2, "ARM966E-S"}, + {"arm966e-s", ARM_ARCH_V5TE, FPU_ARCH_VFP_V2, NULL}, + {"arm968e-s", ARM_ARCH_V5TE, FPU_ARCH_VFP_V2, NULL}, + {"arm10t", ARM_ARCH_V5T, FPU_ARCH_VFP_V1, NULL}, + {"arm10tdmi", ARM_ARCH_V5T, FPU_ARCH_VFP_V1, NULL}, + {"arm10e", ARM_ARCH_V5TE, FPU_ARCH_VFP_V2, NULL}, + {"arm1020", ARM_ARCH_V5TE, FPU_ARCH_VFP_V2, "ARM1020E"}, + {"arm1020t", ARM_ARCH_V5T, FPU_ARCH_VFP_V1, NULL}, + {"arm1020e", ARM_ARCH_V5TE, FPU_ARCH_VFP_V2, NULL}, + {"arm1022e", ARM_ARCH_V5TE, FPU_ARCH_VFP_V2, NULL}, + {"arm1026ejs", ARM_ARCH_V5TEJ, FPU_ARCH_VFP_V2, "ARM1026EJ-S"}, + {"arm1026ej-s", ARM_ARCH_V5TEJ, FPU_ARCH_VFP_V2, NULL}, + {"arm1136js", ARM_ARCH_V6, FPU_NONE, "ARM1136J-S"}, + {"arm1136j-s", ARM_ARCH_V6, FPU_NONE, NULL}, + {"arm1136jfs", ARM_ARCH_V6, FPU_ARCH_VFP_V2, "ARM1136JF-S"}, + {"arm1136jf-s", ARM_ARCH_V6, FPU_ARCH_VFP_V2, NULL}, + {"mpcore", ARM_ARCH_V6K, FPU_ARCH_VFP_V2, NULL}, + {"mpcorenovfp", ARM_ARCH_V6K, FPU_NONE, NULL}, + {"arm1156t2-s", ARM_ARCH_V6T2, FPU_NONE, NULL}, + {"arm1156t2f-s", ARM_ARCH_V6T2, FPU_ARCH_VFP_V2, NULL}, + {"arm1176jz-s", ARM_ARCH_V6ZK, FPU_NONE, NULL}, + {"arm1176jzf-s", ARM_ARCH_V6ZK, FPU_ARCH_VFP_V2, NULL}, + {"cortex-a8", ARM_ARCH_V7A, FPU_ARCH_VFP_V2, NULL}, + {"cortex-r4", ARM_ARCH_V7R, FPU_NONE, NULL}, + {"cortex-m3", ARM_ARCH_V7M, FPU_NONE, NULL}, + /* ??? XSCALE is really an architecture. */ + {"xscale", ARM_ARCH_XSCALE, FPU_ARCH_VFP_V2, NULL}, + /* ??? iwmmxt is not a processor. */ + {"iwmmxt", ARM_ARCH_IWMMXT, FPU_ARCH_VFP_V2, NULL}, + {"i80200", ARM_ARCH_XSCALE, FPU_ARCH_VFP_V2, NULL}, + /* Maverick */ + {"ep9312", ARM_FEATURE(ARM_AEXT_V4T, ARM_CEXT_MAVERICK), FPU_ARCH_MAVERICK, "ARM920T"}, + {NULL, ARM_ARCH_NONE, ARM_ARCH_NONE, NULL} +}; + +struct arm_arch_option_table +{ + char *name; + const arm_feature_set value; + const arm_feature_set default_fpu; +}; + +/* This list should, at a minimum, contain all the architecture names + recognized by GCC. */ +static const struct arm_arch_option_table arm_archs[] = +{ + {"all", ARM_ANY, FPU_ARCH_FPA}, + {"armv1", ARM_ARCH_V1, FPU_ARCH_FPA}, + {"armv2", ARM_ARCH_V2, FPU_ARCH_FPA}, + {"armv2a", ARM_ARCH_V2S, FPU_ARCH_FPA}, + {"armv2s", ARM_ARCH_V2S, FPU_ARCH_FPA}, + {"armv3", ARM_ARCH_V3, FPU_ARCH_FPA}, + {"armv3m", ARM_ARCH_V3M, FPU_ARCH_FPA}, + {"armv4", ARM_ARCH_V4, FPU_ARCH_FPA}, + {"armv4xm", ARM_ARCH_V4xM, FPU_ARCH_FPA}, + {"armv4t", ARM_ARCH_V4T, FPU_ARCH_FPA}, + {"armv4txm", ARM_ARCH_V4TxM, FPU_ARCH_FPA}, + {"armv5", ARM_ARCH_V5, FPU_ARCH_VFP}, + {"armv5t", ARM_ARCH_V5T, FPU_ARCH_VFP}, + {"armv5txm", ARM_ARCH_V5TxM, FPU_ARCH_VFP}, + {"armv5te", ARM_ARCH_V5TE, FPU_ARCH_VFP}, + {"armv5texp", ARM_ARCH_V5TExP, FPU_ARCH_VFP}, + {"armv5tej", ARM_ARCH_V5TEJ, FPU_ARCH_VFP}, + {"armv6", ARM_ARCH_V6, FPU_ARCH_VFP}, + {"armv6j", ARM_ARCH_V6, FPU_ARCH_VFP}, + {"armv6k", ARM_ARCH_V6K, FPU_ARCH_VFP}, + {"armv6z", ARM_ARCH_V6Z, FPU_ARCH_VFP}, + {"armv6zk", ARM_ARCH_V6ZK, FPU_ARCH_VFP}, + {"armv6t2", ARM_ARCH_V6T2, FPU_ARCH_VFP}, + {"armv6kt2", ARM_ARCH_V6KT2, FPU_ARCH_VFP}, + {"armv6zt2", ARM_ARCH_V6ZT2, FPU_ARCH_VFP}, + {"armv6zkt2", ARM_ARCH_V6ZKT2, FPU_ARCH_VFP}, + {"armv7", ARM_ARCH_V7, FPU_ARCH_VFP}, + {"armv7a", ARM_ARCH_V7A, FPU_ARCH_VFP}, + {"armv7r", ARM_ARCH_V7R, FPU_ARCH_VFP}, + {"armv7m", ARM_ARCH_V7M, FPU_ARCH_VFP}, + {"xscale", ARM_ARCH_XSCALE, FPU_ARCH_VFP}, + {"iwmmxt", ARM_ARCH_IWMMXT, FPU_ARCH_VFP}, + {NULL, ARM_ARCH_NONE, ARM_ARCH_NONE} +}; + +/* ISA extensions in the co-processor space. */ +struct arm_option_cpu_value_table +{ + char *name; + const arm_feature_set value; +}; + +static const struct arm_option_cpu_value_table arm_extensions[] = +{ + {"maverick", ARM_FEATURE (0, ARM_CEXT_MAVERICK)}, + {"xscale", ARM_FEATURE (0, ARM_CEXT_XSCALE)}, + {"iwmmxt", ARM_FEATURE (0, ARM_CEXT_IWMMXT)}, + {NULL, ARM_ARCH_NONE} +}; + +/* This list should, at a minimum, contain all the fpu names + recognized by GCC. */ +static const struct arm_option_cpu_value_table arm_fpus[] = +{ + {"softfpa", FPU_NONE}, + {"fpe", FPU_ARCH_FPE}, + {"fpe2", FPU_ARCH_FPE}, + {"fpe3", FPU_ARCH_FPA}, /* Third release supports LFM/SFM. */ + {"fpa", FPU_ARCH_FPA}, + {"fpa10", FPU_ARCH_FPA}, + {"fpa11", FPU_ARCH_FPA}, + {"arm7500fe", FPU_ARCH_FPA}, + {"softvfp", FPU_ARCH_VFP}, + {"softvfp+vfp", FPU_ARCH_VFP_V2}, + {"vfp", FPU_ARCH_VFP_V2}, + {"vfp9", FPU_ARCH_VFP_V2}, + {"vfp10", FPU_ARCH_VFP_V2}, + {"vfp10-r0", FPU_ARCH_VFP_V1}, + {"vfpxd", FPU_ARCH_VFP_V1xD}, + {"arm1020t", FPU_ARCH_VFP_V1}, + {"arm1020e", FPU_ARCH_VFP_V2}, + {"arm1136jfs", FPU_ARCH_VFP_V2}, + {"arm1136jf-s", FPU_ARCH_VFP_V2}, + {"maverick", FPU_ARCH_MAVERICK}, + {NULL, ARM_ARCH_NONE} +}; + +struct arm_option_value_table +{ + char *name; + long value; +}; + +static const struct arm_option_value_table arm_float_abis[] = +{ + {"hard", ARM_FLOAT_ABI_HARD}, + {"softfp", ARM_FLOAT_ABI_SOFTFP}, + {"soft", ARM_FLOAT_ABI_SOFT}, + {NULL, 0} +}; + +#ifdef OBJ_ELF +/* We only know how to output GNU and ver 4/5 (AAELF) formats. */ +static const struct arm_option_value_table arm_eabis[] = +{ + {"gnu", EF_ARM_EABI_UNKNOWN}, + {"4", EF_ARM_EABI_VER4}, + {"5", EF_ARM_EABI_VER5}, + {NULL, 0} +}; +#endif + +struct arm_long_option_table +{ + char * option; /* Substring to match. */ + char * help; /* Help information. */ + int (* func) (char * subopt); /* Function to decode sub-option. */ + char * deprecated; /* If non-null, print this message. */ +}; + +static int +arm_parse_extension (char * str, const arm_feature_set **opt_p) +{ + arm_feature_set *ext_set = xmalloc (sizeof (arm_feature_set)); + + /* Copy the feature set, so that we can modify it. */ + *ext_set = **opt_p; + *opt_p = ext_set; + + while (str != NULL && *str != 0) + { + const struct arm_option_cpu_value_table * opt; + char * ext; + int optlen; + + if (*str != '+') + { + as_bad (_("invalid architectural extension")); + return 0; + } + + str++; + ext = strchr (str, '+'); + + if (ext != NULL) + optlen = ext - str; + else + optlen = strlen (str); + + if (optlen == 0) + { + as_bad (_("missing architectural extension")); + return 0; + } + + for (opt = arm_extensions; opt->name != NULL; opt++) + if (strncmp (opt->name, str, optlen) == 0) + { + ARM_MERGE_FEATURE_SETS (*ext_set, *ext_set, opt->value); + break; + } + + if (opt->name == NULL) + { + as_bad (_("unknown architectural extnsion `%s'"), str); + return 0; + } + + str = ext; + }; + + return 1; +} + +static int +arm_parse_cpu (char * str) +{ + const struct arm_cpu_option_table * opt; + char * ext = strchr (str, '+'); + int optlen; + + if (ext != NULL) + optlen = ext - str; + else + optlen = strlen (str); + + if (optlen == 0) + { + as_bad (_("missing cpu name `%s'"), str); + return 0; + } + + for (opt = arm_cpus; opt->name != NULL; opt++) + if (strncmp (opt->name, str, optlen) == 0) + { + mcpu_cpu_opt = &opt->value; + mcpu_fpu_opt = &opt->default_fpu; + if (opt->canonical_name) + strcpy(selected_cpu_name, opt->canonical_name); + else + { + int i; + for (i = 0; i < optlen; i++) + selected_cpu_name[i] = TOUPPER (opt->name[i]); + selected_cpu_name[i] = 0; + } + + if (ext != NULL) + return arm_parse_extension (ext, &mcpu_cpu_opt); + + return 1; + } + + as_bad (_("unknown cpu `%s'"), str); + return 0; +} + +static int +arm_parse_arch (char * str) +{ + const struct arm_arch_option_table *opt; + char *ext = strchr (str, '+'); + int optlen; + + if (ext != NULL) + optlen = ext - str; + else + optlen = strlen (str); + + if (optlen == 0) + { + as_bad (_("missing architecture name `%s'"), str); + return 0; + } + + for (opt = arm_archs; opt->name != NULL; opt++) + if (streq (opt->name, str)) + { + march_cpu_opt = &opt->value; + march_fpu_opt = &opt->default_fpu; + strcpy(selected_cpu_name, opt->name); + + if (ext != NULL) + return arm_parse_extension (ext, &march_cpu_opt); + + return 1; + } + + as_bad (_("unknown architecture `%s'\n"), str); + return 0; +} + +static int +arm_parse_fpu (char * str) +{ + const struct arm_option_cpu_value_table * opt; + + for (opt = arm_fpus; opt->name != NULL; opt++) + if (streq (opt->name, str)) + { + mfpu_opt = &opt->value; + return 1; + } + + as_bad (_("unknown floating point format `%s'\n"), str); + return 0; +} + +static int +arm_parse_float_abi (char * str) +{ + const struct arm_option_value_table * opt; + + for (opt = arm_float_abis; opt->name != NULL; opt++) + if (streq (opt->name, str)) + { + mfloat_abi_opt = opt->value; + return 1; + } + + as_bad (_("unknown floating point abi `%s'\n"), str); + return 0; +} + +#ifdef OBJ_ELF +static int +arm_parse_eabi (char * str) +{ + const struct arm_option_value_table *opt; + + for (opt = arm_eabis; opt->name != NULL; opt++) + if (streq (opt->name, str)) + { + meabi_flags = opt->value; + return 1; + } + as_bad (_("unknown EABI `%s'\n"), str); + return 0; +} +#endif + +struct arm_long_option_table arm_long_opts[] = +{ + {"mcpu=", N_("\t assemble for CPU "), + arm_parse_cpu, NULL}, + {"march=", N_("\t assemble for architecture "), + arm_parse_arch, NULL}, + {"mfpu=", N_("\t assemble for FPU architecture "), + arm_parse_fpu, NULL}, + {"mfloat-abi=", N_("\t assemble for floating point ABI "), + arm_parse_float_abi, NULL}, +#ifdef OBJ_ELF + {"meabi=", N_("\t assemble for eabi version "), + arm_parse_eabi, NULL}, +#endif + {NULL, NULL, 0, NULL} +}; + +int +md_parse_option (int c, char * arg) +{ + struct arm_option_table *opt; + const struct arm_legacy_option_table *fopt; + struct arm_long_option_table *lopt; + + switch (c) + { +#ifdef OPTION_EB + case OPTION_EB: + target_big_endian = 1; + break; +#endif + +#ifdef OPTION_EL + case OPTION_EL: + target_big_endian = 0; + break; +#endif + + case 'a': + /* Listing option. Just ignore these, we don't support additional + ones. */ + return 0; + + default: + for (opt = arm_opts; opt->option != NULL; opt++) + { + if (c == opt->option[0] + && ((arg == NULL && opt->option[1] == 0) + || streq (arg, opt->option + 1))) + { +#if WARN_DEPRECATED + /* If the option is deprecated, tell the user. */ + if (opt->deprecated != NULL) + as_tsktsk (_("option `-%c%s' is deprecated: %s"), c, + arg ? arg : "", _(opt->deprecated)); +#endif + + if (opt->var != NULL) + *opt->var = opt->value; + + return 1; + } + } + + for (fopt = arm_legacy_opts; fopt->option != NULL; fopt++) + { + if (c == fopt->option[0] + && ((arg == NULL && fopt->option[1] == 0) + || streq (arg, fopt->option + 1))) + { +#if WARN_DEPRECATED + /* If the option is deprecated, tell the user. */ + if (fopt->deprecated != NULL) + as_tsktsk (_("option `-%c%s' is deprecated: %s"), c, + arg ? arg : "", _(fopt->deprecated)); +#endif + + if (fopt->var != NULL) + *fopt->var = &fopt->value; + + return 1; + } + } + + for (lopt = arm_long_opts; lopt->option != NULL; lopt++) + { + /* These options are expected to have an argument. */ + if (c == lopt->option[0] + && arg != NULL + && strncmp (arg, lopt->option + 1, + strlen (lopt->option + 1)) == 0) + { +#if WARN_DEPRECATED + /* If the option is deprecated, tell the user. */ + if (lopt->deprecated != NULL) + as_tsktsk (_("option `-%c%s' is deprecated: %s"), c, arg, + _(lopt->deprecated)); +#endif + + /* Call the sup-option parser. */ + return lopt->func (arg + strlen (lopt->option) - 1); + } + } + + return 0; + } + + return 1; +} + +void +md_show_usage (FILE * fp) +{ + struct arm_option_table *opt; + struct arm_long_option_table *lopt; + + fprintf (fp, _(" ARM-specific assembler options:\n")); + + for (opt = arm_opts; opt->option != NULL; opt++) + if (opt->help != NULL) + fprintf (fp, " -%-23s%s\n", opt->option, _(opt->help)); + + for (lopt = arm_long_opts; lopt->option != NULL; lopt++) + if (lopt->help != NULL) + fprintf (fp, " -%s%s\n", lopt->option, _(lopt->help)); + +#ifdef OPTION_EB + fprintf (fp, _("\ + -EB assemble code for a big-endian cpu\n")); +#endif + +#ifdef OPTION_EL + fprintf (fp, _("\ + -EL assemble code for a little-endian cpu\n")); +#endif +} + + +#ifdef OBJ_ELF +typedef struct +{ + int val; + arm_feature_set flags; +} cpu_arch_ver_table; + +/* Mapping from CPU features to EABI CPU arch values. Table must be sorted + least features first. */ +static const cpu_arch_ver_table cpu_arch_ver[] = +{ + {1, ARM_ARCH_V4}, + {2, ARM_ARCH_V4T}, + {3, ARM_ARCH_V5}, + {4, ARM_ARCH_V5TE}, + {5, ARM_ARCH_V5TEJ}, + {6, ARM_ARCH_V6}, + {7, ARM_ARCH_V6Z}, + {8, ARM_ARCH_V6K}, + {9, ARM_ARCH_V6T2}, + {10, ARM_ARCH_V7A}, + {10, ARM_ARCH_V7R}, + {10, ARM_ARCH_V7M}, + {0, ARM_ARCH_NONE} +}; + +/* Set the public EABI object attributes. */ +static void +aeabi_set_public_attributes (void) +{ + int arch; + arm_feature_set flags; + arm_feature_set tmp; + const cpu_arch_ver_table *p; + + /* Choose the architecture based on the capabilities of the requested cpu + (if any) and/or the instructions actually used. */ + ARM_MERGE_FEATURE_SETS (flags, arm_arch_used, thumb_arch_used); + ARM_MERGE_FEATURE_SETS (flags, flags, *mfpu_opt); + ARM_MERGE_FEATURE_SETS (flags, flags, selected_cpu); + + tmp = flags; + arch = 0; + for (p = cpu_arch_ver; p->val; p++) + { + if (ARM_CPU_HAS_FEATURE (tmp, p->flags)) + { + arch = p->val; + ARM_CLEAR_FEATURE (tmp, tmp, p->flags); + } + } + + /* Tag_CPU_name. */ + if (selected_cpu_name[0]) + { + char *p; + + p = selected_cpu_name; + if (strncmp(p, "armv", 4) == 0) + { + int i; + + p += 4; + for (i = 0; p[i]; i++) + p[i] = TOUPPER (p[i]); + } + elf32_arm_add_eabi_attr_string (stdoutput, 5, p); + } + /* Tag_CPU_arch. */ + elf32_arm_add_eabi_attr_int (stdoutput, 6, arch); + /* Tag_CPU_arch_profile. */ + if (ARM_CPU_HAS_FEATURE (flags, arm_ext_v7a)) + elf32_arm_add_eabi_attr_int (stdoutput, 7, 'A'); + else if (ARM_CPU_HAS_FEATURE (flags, arm_ext_v7r)) + elf32_arm_add_eabi_attr_int (stdoutput, 7, 'R'); + else if (ARM_CPU_HAS_FEATURE (flags, arm_ext_v7m)) + elf32_arm_add_eabi_attr_int (stdoutput, 7, 'M'); + /* Tag_ARM_ISA_use. */ + if (ARM_CPU_HAS_FEATURE (arm_arch_used, arm_arch_full)) + elf32_arm_add_eabi_attr_int (stdoutput, 8, 1); + /* Tag_THUMB_ISA_use. */ + if (ARM_CPU_HAS_FEATURE (thumb_arch_used, arm_arch_full)) + elf32_arm_add_eabi_attr_int (stdoutput, 9, + ARM_CPU_HAS_FEATURE (thumb_arch_used, arm_arch_t2) ? 2 : 1); + /* Tag_VFP_arch. */ + if (ARM_CPU_HAS_FEATURE (thumb_arch_used, fpu_arch_vfp_v2) + || ARM_CPU_HAS_FEATURE (arm_arch_used, fpu_arch_vfp_v2)) + elf32_arm_add_eabi_attr_int (stdoutput, 10, 2); + else if (ARM_CPU_HAS_FEATURE (thumb_arch_used, fpu_arch_vfp_v1) + || ARM_CPU_HAS_FEATURE (arm_arch_used, fpu_arch_vfp_v1)) + elf32_arm_add_eabi_attr_int (stdoutput, 10, 1); + /* Tag_WMMX_arch. */ + if (ARM_CPU_HAS_FEATURE (thumb_arch_used, arm_cext_iwmmxt) + || ARM_CPU_HAS_FEATURE (arm_arch_used, arm_cext_iwmmxt)) + elf32_arm_add_eabi_attr_int (stdoutput, 11, 1); +} + +/* Add the .ARM.attributes section. */ +void +arm_md_end (void) +{ + segT s; + char *p; + addressT addr; + offsetT size; + + if (EF_ARM_EABI_VERSION (meabi_flags) < EF_ARM_EABI_VER4) + return; + + aeabi_set_public_attributes (); + size = elf32_arm_eabi_attr_size (stdoutput); + s = subseg_new (".ARM.attributes", 0); + bfd_set_section_flags (stdoutput, s, SEC_READONLY | SEC_DATA); + addr = frag_now_fix (); + p = frag_more (size); + elf32_arm_set_eabi_attr_contents (stdoutput, (bfd_byte *)p, size); +} + + +/* Parse a .cpu directive. */ + +static void +s_arm_cpu (int ignored ATTRIBUTE_UNUSED) +{ + const struct arm_cpu_option_table *opt; + char *name; + char saved_char; + + name = input_line_pointer; + while (*input_line_pointer && !ISSPACE(*input_line_pointer)) + input_line_pointer++; + saved_char = *input_line_pointer; + *input_line_pointer = 0; + + /* Skip the first "all" entry. */ + for (opt = arm_cpus + 1; opt->name != NULL; opt++) + if (streq (opt->name, name)) + { + mcpu_cpu_opt = &opt->value; + selected_cpu = opt->value; + if (opt->canonical_name) + strcpy(selected_cpu_name, opt->canonical_name); + else + { + int i; + for (i = 0; opt->name[i]; i++) + selected_cpu_name[i] = TOUPPER (opt->name[i]); + selected_cpu_name[i] = 0; + } + ARM_MERGE_FEATURE_SETS (cpu_variant, *mcpu_cpu_opt, *mfpu_opt); + *input_line_pointer = saved_char; + demand_empty_rest_of_line (); + return; + } + as_bad (_("unknown cpu `%s'"), name); + *input_line_pointer = saved_char; + ignore_rest_of_line (); +} + + +/* Parse a .arch directive. */ + +static void +s_arm_arch (int ignored ATTRIBUTE_UNUSED) +{ + const struct arm_arch_option_table *opt; + char saved_char; + char *name; + + name = input_line_pointer; + while (*input_line_pointer && !ISSPACE(*input_line_pointer)) + input_line_pointer++; + saved_char = *input_line_pointer; + *input_line_pointer = 0; + + /* Skip the first "all" entry. */ + for (opt = arm_archs + 1; opt->name != NULL; opt++) + if (streq (opt->name, name)) + { + mcpu_cpu_opt = &opt->value; + selected_cpu = opt->value; + strcpy(selected_cpu_name, opt->name); + ARM_MERGE_FEATURE_SETS (cpu_variant, *mcpu_cpu_opt, *mfpu_opt); + *input_line_pointer = saved_char; + demand_empty_rest_of_line (); + return; + } + + as_bad (_("unknown architecture `%s'\n"), name); + *input_line_pointer = saved_char; + ignore_rest_of_line (); +} + + +/* Parse a .fpu directive. */ + +static void +s_arm_fpu (int ignored ATTRIBUTE_UNUSED) +{ + const struct arm_option_cpu_value_table *opt; + char saved_char; + char *name; + + name = input_line_pointer; + while (*input_line_pointer && !ISSPACE(*input_line_pointer)) + input_line_pointer++; + saved_char = *input_line_pointer; + *input_line_pointer = 0; + + for (opt = arm_fpus; opt->name != NULL; opt++) + if (streq (opt->name, name)) + { + mfpu_opt = &opt->value; + ARM_MERGE_FEATURE_SETS (cpu_variant, *mcpu_cpu_opt, *mfpu_opt); + *input_line_pointer = saved_char; + demand_empty_rest_of_line (); + return; + } + + as_bad (_("unknown floating point format `%s'\n"), name); + *input_line_pointer = saved_char; + ignore_rest_of_line (); +} +#endif /* OBJ_ELF */ + diff --git a/contrib/binutils/gas/config/tc-arm.h b/contrib/binutils/gas/config/tc-arm.h index 4e791a083f4..f2615770c47 100644 --- a/contrib/binutils/gas/config/tc-arm.h +++ b/contrib/binutils/gas/config/tc-arm.h @@ -1,6 +1,6 @@ /* This file is tc-arm.h - Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004 - Free Software Foundation, Inc. + Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, + 2004 Free Software Foundation, Inc. Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org) Modified by David Taylor (dtaylor@armltd.co.uk) @@ -18,8 +18,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #define TC_ARM 1 @@ -32,8 +32,6 @@ #define COFF_MAGIC ARMMAGIC #define TARGET_ARCH bfd_arch_arm -#define AOUT_MACHTYPE 0 - #define DIFF_EXPR_OK #ifdef LITTLE_ENDIAN @@ -81,7 +79,12 @@ struct fix; #define TC_FORCE_RELOCATION(FIX) arm_force_relocation (FIX) -#define md_convert_frag(b, s, f) { as_fatal (_("arm convert_frag\n")); } +#define md_relax_frag(segment, fragp, stretch) \ + arm_relax_frag(segment, fragp, stretch) +extern int arm_relax_frag (asection *, struct frag *, long); + +#define md_optimize_expr(l,o,r) arm_optimize_expr (l, o, r) +extern int arm_optimize_expr (expressionS *, operatorT, expressionS *); #define md_cleanup() arm_cleanup () @@ -92,12 +95,17 @@ struct fix; /* We also need to mark assembler created symbols: */ #define tc_frob_fake_label(S) arm_frob_label (S) +#ifdef OBJ_ELF +#define md_end arm_md_end +extern void arm_md_end (void); +#endif + /* NOTE: The fake label creation in stabs.c:s_stab_generic() has deliberately not been updated to mark assembler created stabs symbols as Thumb. */ -#define TC_FIX_TYPE PTR -#define TC_INIT_FIX_DATA(FIX) ((FIX)->tc_fix_data = NULL) +#define TC_FIX_TYPE int +#define TC_INIT_FIX_DATA(FIX) ((FIX)->tc_fix_data = 0) /* We need to keep some local information on symbols. */ @@ -121,14 +129,13 @@ struct fix; #define TC_START_LABEL(C,STR) (c == ':' || (c == '/' && arm_data_in_code ())) #define tc_canonicalize_symbol_name(str) arm_canonicalize_symbol_name (str); #define obj_adjust_symtab() arm_adjust_symtab () -#define tc_aout_pre_write_hook(x) {;} /* not used */ #define LISTING_HEADER "ARM GAS " #define OPTIONAL_REGISTER_PREFIX '%' -#define LOCAL_LABEL(name) (name[0] == '.' && (name[1] == 'L')) -#define LOCAL_LABELS_FB 1 +#define LOCAL_LABEL(name) (name[0] == '.' && name[1] == 'L') +#define LOCAL_LABELS_FB 1 /* This expression evaluates to true if the relocation is for a local object for which we still want to do the relocation at runtime. @@ -140,11 +147,16 @@ struct fix; #define TC_FORCE_RELOCATION_LOCAL(FIX) \ (!(FIX)->fx_pcrel \ || (FIX)->fx_plt \ - || (FIX)->fx_r_type == BFD_RELOC_ARM_GOT12 \ || (FIX)->fx_r_type == BFD_RELOC_ARM_GOT32 \ || (FIX)->fx_r_type == BFD_RELOC_32 \ || TC_FORCE_RELOCATION (FIX)) +/* Force output of R_ARM_REL32 relocations against thumb function symbols. + This is needed to ensure the low bit is handled correctly. */ +#define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEG) \ + (THUMB_IS_FUNC ((FIX)->fx_addsy) \ + || !SEG_NORMAL (SEG)) + #define TC_CONS_FIX_NEW cons_fix_new_arm #define MAX_MEM_FOR_RS_ALIGN_CODE 31 @@ -167,9 +179,9 @@ struct fix; # define DWARF2_LINE_MIN_INSN_LENGTH 2 # define obj_frob_symbol(sym, punt) armelf_frob_symbol ((sym), & (punt)) # define md_elf_section_change_hook() arm_elf_change_section () +# define md_elf_section_type(str, len) arm_elf_section_type (str, len) # define GLOBAL_OFFSET_TABLE_NAME "_GLOBAL_OFFSET_TABLE_" -# define LOCAL_LABEL_PREFIX '.' -# define TC_SEGMENT_INFO_TYPE enum mstate +# define TC_SEGMENT_INFO_TYPE struct arm_segment_info_type enum mstate { @@ -179,6 +191,25 @@ enum mstate MAP_THUMB }; +struct arm_segment_info_type +{ + enum mstate mapstate; + unsigned int marked_pr_dependency; +}; + +/* We want .cfi_* pseudo-ops for generating unwind info. */ +#define TARGET_USE_CFIPOP 1 + +/* The lr register is r14. */ +#define DWARF2_DEFAULT_RETURN_COLUMN 14 + +/* Registers are generally saved at negative offsets to the CFA. */ +#define DWARF2_CIE_DATA_ALIGNMENT -4 + +/* CFI hooks. */ +#define tc_regname_to_dw2regnum tc_arm_regname_to_dw2regnum +#define tc_cfi_frame_initial_instructions tc_arm_frame_initial_instructions + #else /* Not OBJ_ELF. */ #define GLOBAL_OFFSET_TABLE_NAME "__GLOBAL_OFFSET_TABLE_" #endif @@ -187,12 +218,15 @@ enum mstate # define EXTERN_FORCE_RELOC 1 # define tc_fix_adjustable(FIX) arm_fix_adjustable (FIX) -/* Values passed to md_apply_fix3 don't include the symbol value. */ +/* Values passed to md_apply_fix don't include the symbol value. */ # define MD_APPLY_SYM_VALUE(FIX) 0 # define TC_VALIDATE_FIX(FIX, SEGTYPE, LABEL) arm_validate_fix (FIX) #endif +#define MD_PCREL_FROM_SECTION(F,S) md_pcrel_from_section(F,S) + +extern long md_pcrel_from_section (struct fix *, segT); extern void arm_frag_align_code (int, int); extern void arm_validate_fix (struct fix *); extern const char * elf32_arm_target_format (void); @@ -209,3 +243,6 @@ extern void cons_fix_new_arm (fragS *, int, int, expressionS *); extern void arm_init_frag (struct frag *); extern void arm_handle_align (struct frag *); extern bfd_boolean arm_fix_adjustable (struct fix *); +extern int arm_elf_section_type (const char *, size_t); +extern int tc_arm_regname_to_dw2regnum (const char *regname); +extern void tc_arm_frame_initial_instructions (void); diff --git a/contrib/binutils/gas/config/tc-generic.c b/contrib/binutils/gas/config/tc-generic.c index e69de29bb2d..8028403550b 100644 --- a/contrib/binutils/gas/config/tc-generic.c +++ b/contrib/binutils/gas/config/tc-generic.c @@ -0,0 +1,22 @@ +/* This file is tc-generic.c + + Copyright 2004 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, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* This file is tc-generic.c and is intended to be a template for + target cpu specific files. */ diff --git a/contrib/binutils/gas/config/tc-generic.h b/contrib/binutils/gas/config/tc-generic.h index f3b676ba011..fbeba9a25c1 100644 --- a/contrib/binutils/gas/config/tc-generic.h +++ b/contrib/binutils/gas/config/tc-generic.h @@ -16,7 +16,7 @@ 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. */ + Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* * This file is tc-generic.h and is intended to be a template for target cpu diff --git a/contrib/binutils/gas/config/tc-i386.c b/contrib/binutils/gas/config/tc-i386.c index 5de6a55d2f5..be384bc99a7 100644 --- a/contrib/binutils/gas/config/tc-i386.c +++ b/contrib/binutils/gas/config/tc-i386.c @@ -1,6 +1,6 @@ /* i386.c -- Assemble code for the Intel 80386 Copyright 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004 + 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -17,8 +17,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ /* Intel 80386 machine specific gas. Written by Eliot Dresselhaus (eliot@mgm.mit.edu). @@ -33,6 +33,7 @@ #include "dwarf2dbg.h" #include "dw2gencfi.h" #include "opcode/i386.h" +#include "elf/x86-64.h" #ifndef REGISTER_WARNINGS #define REGISTER_WARNINGS 1 @@ -76,6 +77,10 @@ static void set_code_flag PARAMS ((int)); static void set_16bit_gcc_code_flag PARAMS ((int)); static void set_intel_syntax PARAMS ((int)); static void set_cpu_arch PARAMS ((int)); +#ifdef TE_PE +static void pe_directive_secrel PARAMS ((int)); +#endif +static void signed_cons PARAMS ((int)); static char *output_invalid PARAMS ((int c)); static int i386_operand PARAMS ((char *operand_string)); static int i386_intel_operand PARAMS ((char *operand_string, int got_a_float)); @@ -107,6 +112,9 @@ static void output_disp PARAMS ((fragS *insn_start_frag, #ifndef I386COFF static void s_bss PARAMS ((int)); #endif +#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) +static void handle_large_common (int small ATTRIBUTE_UNUSED); +#endif static const char *default_arch = DEFAULT_ARCH; @@ -179,22 +187,34 @@ typedef struct _i386_insn i386_insn; /* List of chars besides those in app.c:symbol_chars that can start an operand. Used to prevent the scrubber eating vital white-space. */ +const char extra_symbol_chars[] = "*%-([" #ifdef LEX_AT -const char extra_symbol_chars[] = "*%-(@["; -#else -const char extra_symbol_chars[] = "*%-(["; + "@" #endif +#ifdef LEX_QM + "?" +#endif + ; #if (defined (TE_I386AIX) \ || ((defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)) \ + && !defined (TE_GNU) \ && !defined (TE_LINUX) \ + && !defined (TE_NETWARE) \ && !defined (TE_FreeBSD) \ && !defined (TE_NetBSD))) /* This array holds the chars that always start a comment. If the - pre-processor is disabled, these aren't very useful. */ -const char comment_chars[] = "#/"; + pre-processor is disabled, these aren't very useful. The option + --divide will remove '/' from this list. */ +const char *i386_comment_chars = "#/"; +#define SVR4_COMMENT_CHARS 1 #define PREFIX_SEPARATOR '\\' +#else +const char *i386_comment_chars = "#"; +#define PREFIX_SEPARATOR '/' +#endif + /* This array holds the chars that only start a comment at the beginning of a line. If the line seems to have the form '# 123 filename' .line and .file directives will appear in the pre-processed output. @@ -203,16 +223,7 @@ const char comment_chars[] = "#/"; #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[] = "#"; - -#else -/* Putting '/' here makes it impossible to use the divide operator. - However, we need it for compatibility with SVR4 systems. */ -const char comment_chars[] = "#"; -#define PREFIX_SEPARATOR '/' - -const char line_comment_chars[] = "/#"; -#endif +const char line_comment_chars[] = "#/"; const char line_separator_chars[] = ";"; @@ -276,6 +287,7 @@ enum flag_code { #define NUM_FLAG_CODE ((int) CODE_64BIT + 1) static enum flag_code flag_code; +static unsigned int object_64bit; static int use_rela_relocations = 0; /* The names used to print error messages. */ @@ -306,6 +318,7 @@ static int quiet_warnings = 0; /* CPU name. */ static const char *cpu_arch_name = NULL; +static const char *cpu_sub_arch_name = NULL; /* CPU feature flags. */ static unsigned int cpu_arch_flags = CpuUnknownFlags | CpuNo64; @@ -315,7 +328,7 @@ static unsigned int cpu_arch_flags = CpuUnknownFlags | CpuNo64; static unsigned int no_cond_jump_promotion = 0; /* Pre-defined "_GLOBAL_OFFSET_TABLE_". */ -symbolS *GOT_symbol; +static symbolS *GOT_symbol; /* The dwarf2 return column, adjusted for 32 or 64 bit. */ unsigned int x86_dwarf2_return_column; @@ -408,14 +421,28 @@ static const arch_entry cpu_arch[] = { {"i286", Cpu086|Cpu186|Cpu286 }, {"i386", Cpu086|Cpu186|Cpu286|Cpu386 }, {"i486", Cpu086|Cpu186|Cpu286|Cpu386|Cpu486 }, - {"i586", Cpu086|Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|CpuMMX }, - {"i686", Cpu086|Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|Cpu686|CpuMMX|CpuSSE }, - {"pentium", Cpu086|Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|CpuMMX }, - {"pentiumpro",Cpu086|Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|Cpu686|CpuMMX|CpuSSE }, - {"pentium4", Cpu086|Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|Cpu686|CpuP4|CpuMMX|CpuSSE|CpuSSE2 }, - {"k6", Cpu086|Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|CpuK6|CpuMMX|Cpu3dnow }, - {"athlon", Cpu086|Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|Cpu686|CpuK6|CpuAthlon|CpuMMX|Cpu3dnow }, - {"sledgehammer",Cpu086|Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|Cpu686|CpuK6|CpuAthlon|CpuSledgehammer|CpuMMX|Cpu3dnow|CpuSSE|CpuSSE2 }, + {"i586", Cpu086|Cpu186|Cpu286|Cpu386|Cpu486|Cpu586 }, + {"i686", Cpu086|Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|Cpu686 }, + {"pentium", Cpu086|Cpu186|Cpu286|Cpu386|Cpu486|Cpu586 }, + {"pentiumpro",Cpu086|Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|Cpu686 }, + {"pentiumii", Cpu086|Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|Cpu686|CpuMMX }, + {"pentiumiii",Cpu086|Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|Cpu686|CpuMMX|CpuMMX2|CpuSSE }, + {"pentium4", Cpu086|Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|Cpu686|CpuP4|CpuMMX|CpuMMX2|CpuSSE|CpuSSE2 }, + {"prescott", Cpu086|Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|Cpu686|CpuP4|CpuMMX|CpuMMX2|CpuSSE|CpuSSE2|CpuPNI }, + {"k6", Cpu086|Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|CpuK6|CpuMMX }, + {"k6_2", Cpu086|Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|CpuK6|CpuMMX|Cpu3dnow }, + {"athlon", Cpu086|Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|Cpu686|CpuK6|CpuAthlon|CpuMMX|CpuMMX2|Cpu3dnow|Cpu3dnowA }, + {"sledgehammer",Cpu086|Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|Cpu686|CpuK6|CpuAthlon|CpuSledgehammer|CpuMMX|CpuMMX2|Cpu3dnow|Cpu3dnowA|CpuSSE|CpuSSE2 }, + {"opteron", Cpu086|Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|Cpu686|CpuK6|CpuAthlon|CpuSledgehammer|CpuMMX|CpuMMX2|Cpu3dnow|Cpu3dnowA|CpuSSE|CpuSSE2 }, + {".mmx", CpuMMX }, + {".sse", CpuMMX|CpuMMX2|CpuSSE }, + {".sse2", CpuMMX|CpuMMX2|CpuSSE|CpuSSE2 }, + {".sse3", CpuMMX|CpuMMX2|CpuSSE|CpuSSE2|CpuSSE3 }, + {".3dnow", CpuMMX|Cpu3dnow }, + {".3dnowa", CpuMMX|CpuMMX2|Cpu3dnow|Cpu3dnowA }, + {".padlock", CpuPadLock }, + {".pacifica", CpuSVME }, + {".svme", CpuSVME }, {NULL, 0 } }; @@ -434,6 +461,7 @@ const pseudo_typeS md_pseudo_table[] = {"dfloat", float_cons, 'd'}, {"tfloat", float_cons, 'x'}, {"value", cons, 2}, + {"slong", signed_cons, 4}, {"noopt", s_ignore, 0}, {"optim", s_ignore, 0}, {"code16gcc", set_16bit_gcc_code_flag, CODE_16BIT}, @@ -442,8 +470,16 @@ const pseudo_typeS md_pseudo_table[] = {"code64", set_code_flag, CODE_64BIT}, {"intel_syntax", set_intel_syntax, 1}, {"att_syntax", set_intel_syntax, 0}, +#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) + {"largecomm", handle_large_common, 0}, +#else {"file", (void (*) PARAMS ((int))) dwarf2_directive_file, 0}, {"loc", dwarf2_directive_loc, 0}, + {"loc_mark_labels", dwarf2_directive_loc_mark_labels, 0}, +#endif +#ifdef TE_PE + {"secrel32", pe_directive_secrel, 0}, +#endif {0, 0, 0} }; @@ -694,55 +730,66 @@ add_prefix (prefix) unsigned int prefix; { int ret = 1; - int q; + unsigned int q; if (prefix >= REX_OPCODE && prefix < REX_OPCODE + 16 && flag_code == CODE_64BIT) - q = REX_PREFIX; - else - switch (prefix) - { - default: - abort (); - - case CS_PREFIX_OPCODE: - case DS_PREFIX_OPCODE: - case ES_PREFIX_OPCODE: - case FS_PREFIX_OPCODE: - case GS_PREFIX_OPCODE: - case SS_PREFIX_OPCODE: - q = SEG_PREFIX; - break; - - case REPNE_PREFIX_OPCODE: - case REPE_PREFIX_OPCODE: - ret = 2; - /* fall thru */ - case LOCK_PREFIX_OPCODE: - q = LOCKREP_PREFIX; - break; - - case FWAIT_OPCODE: - q = WAIT_PREFIX; - break; - - case ADDR_PREFIX_OPCODE: - q = ADDR_PREFIX; - break; - - case DATA_PREFIX_OPCODE: - q = DATA_PREFIX; - break; - } - - if (i.prefix[q] != 0) { - as_bad (_("same type of prefix used twice")); - return 0; + if ((i.prefix[REX_PREFIX] & prefix & REX_MODE64) + || ((i.prefix[REX_PREFIX] & (REX_EXTX | REX_EXTY | REX_EXTZ)) + && (prefix & (REX_EXTX | REX_EXTY | REX_EXTZ)))) + ret = 0; + q = REX_PREFIX; + } + else + { + switch (prefix) + { + default: + abort (); + + case CS_PREFIX_OPCODE: + case DS_PREFIX_OPCODE: + case ES_PREFIX_OPCODE: + case FS_PREFIX_OPCODE: + case GS_PREFIX_OPCODE: + case SS_PREFIX_OPCODE: + q = SEG_PREFIX; + break; + + case REPNE_PREFIX_OPCODE: + case REPE_PREFIX_OPCODE: + ret = 2; + /* fall thru */ + case LOCK_PREFIX_OPCODE: + q = LOCKREP_PREFIX; + break; + + case FWAIT_OPCODE: + q = WAIT_PREFIX; + break; + + case ADDR_PREFIX_OPCODE: + q = ADDR_PREFIX; + break; + + case DATA_PREFIX_OPCODE: + q = DATA_PREFIX; + break; + } + if (i.prefix[q] != 0) + ret = 0; } - i.prefixes += 1; - i.prefix[q] = prefix; + if (ret) + { + if (!i.prefix[q]) + ++i.prefixes; + i.prefix[q] |= prefix; + } + else + as_bad (_("same type of prefix used twice")); + return ret; } @@ -771,7 +818,7 @@ set_16bit_gcc_code_flag (new_code_flag) flag_code = new_code_flag; cpu_arch_flags &= ~(Cpu64 | CpuNo64); cpu_arch_flags |= (flag_code == CODE_64BIT ? Cpu64 : CpuNo64); - stackop_size = 'l'; + stackop_size = LONG_MNEM_SUFFIX; } static void @@ -804,6 +851,9 @@ set_intel_syntax (syntax_flag) && (bfd_get_symbol_leading_char (stdoutput) != '\0')); else allow_naked_reg = (ask_naked_reg < 0); + + identifier_chars['%'] = intel_syntax && allow_naked_reg ? '%' : 0; + identifier_chars['$'] = intel_syntax ? '$' : 0; } static void @@ -822,10 +872,22 @@ set_cpu_arch (dummy) { if (strcmp (string, cpu_arch[i].name) == 0) { - cpu_arch_name = cpu_arch[i].name; - cpu_arch_flags = (cpu_arch[i].flags - | (flag_code == CODE_64BIT ? Cpu64 : CpuNo64)); - break; + if (*string != '.') + { + cpu_arch_name = cpu_arch[i].name; + cpu_sub_arch_name = NULL; + cpu_arch_flags = (cpu_arch[i].flags + | (flag_code == CODE_64BIT ? Cpu64 : CpuNo64)); + break; + } + if ((cpu_arch_flags | cpu_arch[i].flags) != cpu_arch_flags) + { + cpu_sub_arch_name = cpu_arch[i].name; + cpu_arch_flags |= cpu_arch[i].flags; + } + *input_line_pointer = e; + demand_empty_rest_of_line (); + return; } } if (!cpu_arch[i].name) @@ -965,8 +1027,13 @@ md_begin () #ifdef LEX_AT identifier_chars['@'] = '@'; +#endif +#ifdef LEX_QM + identifier_chars['?'] = '?'; + operand_chars['?'] = '?'; #endif digit_chars['-'] = '-'; + mnemonic_chars['-'] = '-'; identifier_chars['_'] = '_'; identifier_chars['.'] = '.'; @@ -975,7 +1042,7 @@ md_begin () } #if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) - if (OUTPUT_FLAVOR == bfd_target_elf_flavour) + if (IS_ELF) { record_alignment (text_section, 2); record_alignment (data_section, 2); @@ -1102,13 +1169,12 @@ ps (s) segment_name (S_GET_SEGMENT (s))); } -struct type_name +static struct type_name { unsigned int mask; char *tname; } - -static const type_names[] = +const type_names[] = { { Reg8, "r8" }, { Reg16, "r16" }, @@ -1158,34 +1224,80 @@ pt (t) #endif /* DEBUG386 */ -static bfd_reloc_code_real_type reloc - PARAMS ((int, int, int, bfd_reloc_code_real_type)); - static bfd_reloc_code_real_type -reloc (size, pcrel, sign, other) - int size; - int pcrel; - int sign; - bfd_reloc_code_real_type other; +reloc (unsigned int size, + int pcrel, + int sign, + bfd_reloc_code_real_type other) { if (other != NO_RELOC) - return other; + { + reloc_howto_type *reloc; + + if (size == 8) + switch (other) + { + case BFD_RELOC_X86_64_GOT32: + return BFD_RELOC_X86_64_GOT64; + break; + case BFD_RELOC_X86_64_PLTOFF64: + return BFD_RELOC_X86_64_PLTOFF64; + break; + case BFD_RELOC_X86_64_GOTPC32: + other = BFD_RELOC_X86_64_GOTPC64; + break; + case BFD_RELOC_X86_64_GOTPCREL: + other = BFD_RELOC_X86_64_GOTPCREL64; + break; + case BFD_RELOC_X86_64_TPOFF32: + other = BFD_RELOC_X86_64_TPOFF64; + break; + case BFD_RELOC_X86_64_DTPOFF32: + other = BFD_RELOC_X86_64_DTPOFF64; + break; + default: + break; + } + + /* Sign-checking 4-byte relocations in 16-/32-bit code is pointless. */ + if (size == 4 && flag_code != CODE_64BIT) + sign = -1; + + reloc = bfd_reloc_type_lookup (stdoutput, other); + if (!reloc) + as_bad (_("unknown relocation (%u)"), other); + else if (size != bfd_get_reloc_size (reloc)) + as_bad (_("%u-byte relocation cannot be applied to %u-byte field"), + bfd_get_reloc_size (reloc), + size); + else if (pcrel && !reloc->pc_relative) + as_bad (_("non-pc-relative relocation for pc-relative field")); + else if ((reloc->complain_on_overflow == complain_overflow_signed + && !sign) + || (reloc->complain_on_overflow == complain_overflow_unsigned + && sign > 0)) + as_bad (_("relocated field and relocation type differ in signedness")); + else + return other; + return NO_RELOC; + } if (pcrel) { if (!sign) - as_bad (_("There are no unsigned pc-relative relocations")); + as_bad (_("there are no unsigned pc-relative relocations")); switch (size) { case 1: return BFD_RELOC_8_PCREL; case 2: return BFD_RELOC_16_PCREL; case 4: return BFD_RELOC_32_PCREL; + case 8: return BFD_RELOC_64_PCREL; } - as_bad (_("can not do %d byte pc-relative relocation"), size); + as_bad (_("cannot do %u byte pc-relative relocation"), size); } else { - if (sign) + if (sign > 0) switch (size) { case 4: return BFD_RELOC_X86_64_32S; @@ -1198,8 +1310,8 @@ reloc (size, pcrel, sign, other) case 4: return BFD_RELOC_32; case 8: return BFD_RELOC_64; } - as_bad (_("can not do %s %d byte relocation"), - sign ? "signed" : "unsigned", size); + as_bad (_("cannot do %s %u byte relocation"), + sign > 0 ? "signed" : "unsigned", size); } abort (); @@ -1216,7 +1328,7 @@ tc_i386_fix_adjustable (fixP) fixS *fixP ATTRIBUTE_UNUSED; { #if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) - if (OUTPUT_FLAVOR != bfd_target_elf_flavour) + if (!IS_ELF) return 1; /* Don't adjust pc-relative references to merge sections in 64-bit @@ -1244,14 +1356,21 @@ tc_i386_fix_adjustable (fixP) || fixP->fx_r_type == BFD_RELOC_386_TLS_GOTIE || fixP->fx_r_type == BFD_RELOC_386_TLS_LE_32 || fixP->fx_r_type == BFD_RELOC_386_TLS_LE + || fixP->fx_r_type == BFD_RELOC_386_TLS_GOTDESC + || fixP->fx_r_type == BFD_RELOC_386_TLS_DESC_CALL || fixP->fx_r_type == BFD_RELOC_X86_64_PLT32 || fixP->fx_r_type == BFD_RELOC_X86_64_GOT32 || fixP->fx_r_type == BFD_RELOC_X86_64_GOTPCREL || fixP->fx_r_type == BFD_RELOC_X86_64_TLSGD || fixP->fx_r_type == BFD_RELOC_X86_64_TLSLD || fixP->fx_r_type == BFD_RELOC_X86_64_DTPOFF32 + || fixP->fx_r_type == BFD_RELOC_X86_64_DTPOFF64 || fixP->fx_r_type == BFD_RELOC_X86_64_GOTTPOFF || fixP->fx_r_type == BFD_RELOC_X86_64_TPOFF32 + || fixP->fx_r_type == BFD_RELOC_X86_64_TPOFF64 + || fixP->fx_r_type == BFD_RELOC_X86_64_GOTOFF64 + || fixP->fx_r_type == BFD_RELOC_X86_64_GOTPC32_TLSDESC + || fixP->fx_r_type == BFD_RELOC_X86_64_TLSDESC_CALL || fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT || fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY) return 0; @@ -1265,13 +1384,54 @@ static int intel_float_operand (mnemonic) const char *mnemonic; { - if (mnemonic[0] == 'f' && mnemonic[1] == 'i') - return 2; + /* Note that the value returned is meaningful only for opcodes with (memory) + operands, hence the code here is free to improperly handle opcodes that + have no operands (for better performance and smaller code). */ - if (mnemonic[0] == 'f') - return 1; + if (mnemonic[0] != 'f') + return 0; /* non-math */ - return 0; + switch (mnemonic[1]) + { + /* fclex, fdecstp, fdisi, femms, feni, fincstp, finit, fsetpm, and + the fs segment override prefix not currently handled because no + call path can make opcodes without operands get here */ + case 'i': + return 2 /* integer op */; + case 'l': + if (mnemonic[2] == 'd' && (mnemonic[3] == 'c' || mnemonic[3] == 'e')) + return 3; /* fldcw/fldenv */ + break; + case 'n': + if (mnemonic[2] != 'o' /* fnop */) + return 3; /* non-waiting control op */ + break; + case 'r': + if (mnemonic[2] == 's') + return 3; /* frstor/frstpm */ + break; + case 's': + if (mnemonic[2] == 'a') + return 3; /* fsave */ + if (mnemonic[2] == 't') + { + switch (mnemonic[3]) + { + case 'c': /* fstcw */ + case 'd': /* fstdw */ + case 'e': /* fstenv */ + case 's': /* fsts[gw] */ + return 3; + } + } + break; + case 'x': + if (mnemonic[2] == 'r' || mnemonic[2] == 's') + return 0; /* fxsave/fxrstor are not really math ops */ + break; + } + + return 1; } /* This is the guts of the machine-dependent assembler. LINE points to a @@ -1316,13 +1476,18 @@ md_assemble (line) have two immediate operands. */ if (intel_syntax && i.operands > 1 && (strcmp (mnemonic, "bound") != 0) + && (strcmp (mnemonic, "invlpga") != 0) && !((i.types[0] & Imm) && (i.types[1] & Imm))) swap_operands (); if (i.imm_operands) optimize_imm (); - if (i.disp_operands) + /* Don't optimize displacement for movabs since it only takes 64bit + displacement. */ + if (i.disp_operands + && (flag_code != CODE_64BIT + || strcmp (mnemonic, "movabs") != 0)) optimize_disp (); /* Next, we find a template that matches the given insn, @@ -1343,7 +1508,20 @@ md_assemble (line) "word ptr" or "byte ptr" on the source operand, but we'll use the suffix later to choose the destination register. */ if ((i.tm.base_opcode & ~9) == 0x0fb6) - i.suffix = 0; + { + if (i.reg_operands < 2 + && !i.suffix + && (~i.tm.opcode_modifier + & (No_bSuf + | No_wSuf + | No_lSuf + | No_sSuf + | No_xSuf + | No_qSuf))) + as_bad (_("ambiguous operand size for `%s'"), i.tm.name); + + i.suffix = 0; + } } if (i.tm.opcode_modifier & FWait) @@ -1462,7 +1640,7 @@ md_assemble (line) { /* In case it is "hi" register, give up. */ if (i.op[x].regs->reg_num > 3) - as_bad (_("can't encode register '%%%s' in an instruction requiring REX prefix.\n"), + as_bad (_("can't encode register '%%%s' in an instruction requiring REX prefix."), i.op[x].regs->reg_name); /* Otherwise it is equivalent to the extended register. @@ -1489,6 +1667,8 @@ parse_insn (line, mnemonic) char *l = line; char *token_start = l; char *mnem_p; + int supported; + const template *t; /* Non-zero if we found a prefix only acceptable with string insns. */ const char *expecting_string_instruction = NULL; @@ -1508,8 +1688,9 @@ parse_insn (line, mnemonic) } if (!is_space_char (*l) && *l != END_OF_INSN - && *l != PREFIX_SEPARATOR - && *l != ',') + && (intel_syntax + || (*l != PREFIX_SEPARATOR + && *l != ','))) { as_bad (_("invalid character %s in mnemonic"), output_invalid (*l)); @@ -1517,7 +1698,7 @@ parse_insn (line, mnemonic) } if (token_start == l) { - if (*l == PREFIX_SEPARATOR) + if (!intel_syntax && *l == PREFIX_SEPARATOR) as_bad (_("expecting prefix; got nothing")); else as_bad (_("expecting mnemonic; got nothing")); @@ -1532,6 +1713,15 @@ parse_insn (line, mnemonic) && current_templates && (current_templates->start->opcode_modifier & IsPrefix)) { + if (current_templates->start->cpu_flags + & (flag_code != CODE_64BIT ? Cpu64 : CpuNo64)) + { + as_bad ((flag_code != CODE_64BIT + ? _("`%s' is only supported in 64-bit mode") + : _("`%s' is not supported in 64-bit mode")), + current_templates->start->name); + return NULL; + } /* If we are in 16-bit mode, do not allow addr16 or data16. Similarly, in 32-bit mode, do not allow addr32 or data32. */ if ((current_templates->start->opcode_modifier & (Size16 | Size32)) @@ -1565,6 +1755,9 @@ parse_insn (line, mnemonic) switch (mnem_p[-1]) { case WORD_MNEM_SUFFIX: + if (intel_syntax && (intel_float_operand (mnemonic) & 2)) + i.suffix = SHORT_MNEM_SUFFIX; + else case BYTE_MNEM_SUFFIX: case QWORD_MNEM_SUFFIX: i.suffix = mnem_p[-1]; @@ -1585,7 +1778,7 @@ parse_insn (line, mnemonic) case 'd': if (intel_syntax) { - if (intel_float_operand (mnemonic)) + if (intel_float_operand (mnemonic) == 1) i.suffix = SHORT_MNEM_SUFFIX; else i.suffix = LONG_MNEM_SUFFIX; @@ -1634,11 +1827,29 @@ parse_insn (line, mnemonic) } /* Check if instruction is supported on specified architecture. */ - if ((current_templates->start->cpu_flags & ~(Cpu64 | CpuNo64)) - & ~(cpu_arch_flags & ~(Cpu64 | CpuNo64))) + supported = 0; + for (t = current_templates->start; t < current_templates->end; ++t) { - as_warn (_("`%s' is not supported on `%s'"), - current_templates->start->name, cpu_arch_name); + if (!((t->cpu_flags & ~(Cpu64 | CpuNo64)) + & ~(cpu_arch_flags & ~(Cpu64 | CpuNo64)))) + supported |= 1; + if (!(t->cpu_flags & (flag_code == CODE_64BIT ? CpuNo64 : Cpu64))) + supported |= 2; + } + if (!(supported & 2)) + { + as_bad (flag_code == CODE_64BIT + ? _("`%s' is not supported in 64-bit mode") + : _("`%s' is only supported in 64-bit mode"), + current_templates->start->name); + return NULL; + } + if (!(supported & 1)) + { + as_warn (_("`%s' is not supported on `%s%s'"), + current_templates->start->name, + cpu_arch_name, + cpu_sub_arch_name ? cpu_sub_arch_name : ""); } else if ((Cpu386 & ~cpu_arch_flags) && (flag_code != CODE_16BIT)) { @@ -1646,12 +1857,24 @@ parse_insn (line, mnemonic) } /* Check for rep/repne without a string instruction. */ - if (expecting_string_instruction - && !(current_templates->start->opcode_modifier & IsString)) + if (expecting_string_instruction) { - as_bad (_("expecting string instruction after `%s'"), - expecting_string_instruction); - return NULL; + static templates override; + + for (t = current_templates->start; t < current_templates->end; ++t) + if (t->opcode_modifier & IsString) + break; + if (t >= current_templates->end) + { + as_bad (_("expecting string instruction after `%s'"), + expecting_string_instruction); + return NULL; + } + for (override.start = t; t < current_templates->end; ++t) + if (!(t->opcode_modifier & IsString)) + break; + override.end = t; + current_templates = &override; } return l; @@ -1901,24 +2124,36 @@ optimize_imm () /* Symbols and expressions. */ default: - /* Convert symbolic operand to proper sizes for matching. */ - switch (guess_suffix) - { - case QWORD_MNEM_SUFFIX: - i.types[op] = Imm64 | Imm32S; - break; - case LONG_MNEM_SUFFIX: - i.types[op] = Imm32 | Imm64; - break; - case WORD_MNEM_SUFFIX: - i.types[op] = Imm16 | Imm32 | Imm64; - break; - break; - case BYTE_MNEM_SUFFIX: - i.types[op] = Imm8 | Imm8S | Imm16 | Imm32S | Imm32; - break; - break; - } + /* Convert symbolic operand to proper sizes for matching, but don't + prevent matching a set of insns that only supports sizes other + than those matching the insn suffix. */ + { + unsigned int mask, allowed = 0; + const template *t; + + for (t = current_templates->start; t < current_templates->end; ++t) + allowed |= t->operand_types[op]; + switch (guess_suffix) + { + case QWORD_MNEM_SUFFIX: + mask = Imm64 | Imm32S; + break; + case LONG_MNEM_SUFFIX: + mask = Imm32; + break; + case WORD_MNEM_SUFFIX: + mask = Imm16; + break; + case BYTE_MNEM_SUFFIX: + mask = Imm8; + break; + default: + mask = 0; + break; + } + if (mask & allowed) + i.types[op] &= mask; + } break; } } @@ -1931,37 +2166,61 @@ optimize_disp () int op; for (op = i.operands; --op >= 0;) - if ((i.types[op] & Disp) && i.op[op].disps->X_op == O_constant) + if (i.types[op] & Disp) { - offsetT disp = i.op[op].disps->X_add_number; + if (i.op[op].disps->X_op == O_constant) + { + offsetT disp = i.op[op].disps->X_add_number; - if (i.types[op] & Disp16) - { - /* We know this operand is at most 16 bits, so - convert to a signed 16 bit number before trying - to see whether it will fit in an even smaller - size. */ - - disp = (((disp & 0xffff) ^ 0x8000) - 0x8000); + if ((i.types[op] & Disp16) + && (disp & ~(offsetT) 0xffff) == 0) + { + /* If this operand is at most 16 bits, convert + to a signed 16 bit number and don't use 64bit + displacement. */ + disp = (((disp & 0xffff) ^ 0x8000) - 0x8000); + i.types[op] &= ~Disp64; + } + if ((i.types[op] & Disp32) + && (disp & ~(((offsetT) 2 << 31) - 1)) == 0) + { + /* If this operand is at most 32 bits, convert + to a signed 32 bit number and don't use 64bit + displacement. */ + disp &= (((offsetT) 2 << 31) - 1); + disp = (disp ^ ((offsetT) 1 << 31)) - ((addressT) 1 << 31); + i.types[op] &= ~Disp64; + } + if (!disp && (i.types[op] & BaseIndex)) + { + i.types[op] &= ~Disp; + i.op[op].disps = 0; + i.disp_operands--; + } + else if (flag_code == CODE_64BIT) + { + if (fits_in_signed_long (disp)) + { + i.types[op] &= ~Disp64; + i.types[op] |= Disp32S; + } + if (fits_in_unsigned_long (disp)) + i.types[op] |= Disp32; + } + if ((i.types[op] & (Disp32 | Disp32S | Disp16)) + && fits_in_signed_byte (disp)) + i.types[op] |= Disp8; } - else if (i.types[op] & Disp32) + else if (i.reloc[op] == BFD_RELOC_386_TLS_DESC_CALL + || i.reloc[op] == BFD_RELOC_X86_64_TLSDESC_CALL) { - /* We know this operand is at most 32 bits, so convert to a - signed 32 bit number before trying to see whether it will - fit in an even smaller size. */ - disp &= (((offsetT) 2 << 31) - 1); - disp = (disp ^ ((offsetT) 1 << 31)) - ((addressT) 1 << 31); + fix_new_exp (frag_now, frag_more (0) - frag_now->fr_literal, 0, + i.op[op].disps, 0, i.reloc[op]); + i.types[op] &= ~Disp; } - if (flag_code == CODE_64BIT) - { - if (fits_in_signed_long (disp)) - i.types[op] |= Disp32S; - if (fits_in_unsigned_long (disp)) - i.types[op] |= Disp32; - } - if ((i.types[op] & (Disp32 | Disp32S | Disp16)) - && fits_in_signed_byte (disp)) - i.types[op] |= Disp8; + else + /* We only support 64bit displacement on constants. */ + i.types[op] &= ~Disp64; } } @@ -2004,9 +2263,7 @@ match_template () : (i.suffix == LONG_DOUBLE_MNEM_SUFFIX ? No_xSuf : 0)))))); - for (t = current_templates->start; - t < current_templates->end; - t++) + for (t = current_templates->start; t < current_templates->end; t++) { /* Must have right number of operands. */ if (i.operands != t->operands) @@ -2015,11 +2272,20 @@ match_template () /* Check the suffix, except for some instructions in intel mode. */ if ((t->opcode_modifier & suffix_check) && !(intel_syntax - && (t->opcode_modifier & IgnoreSize)) - && !(intel_syntax - && t->base_opcode == 0xd9 - && (t->extension_opcode == 5 /* 0xd9,5 "fldcw" */ - || t->extension_opcode == 7))) /* 0xd9,7 "f{n}stcw" */ + && (t->opcode_modifier & IgnoreSize))) + continue; + + /* In general, don't allow 64-bit operands in 32-bit mode. */ + if (i.suffix == QWORD_MNEM_SUFFIX + && flag_code != CODE_64BIT + && (intel_syntax + ? (!(t->opcode_modifier & IgnoreSize) + && !intel_float_operand (t->name)) + : intel_float_operand (t->name) != 2) + && (!(t->operand_types[0] & (RegMMX | RegXMM)) + || !(t->operand_types[t->operands > 1] & (RegMMX | RegXMM))) + && (t->base_opcode != 0x0fc7 + || t->extension_opcode != 1 /* cmpxchg8b */)) continue; /* Do not verify operands when there are none. */ @@ -2043,10 +2309,15 @@ match_template () overlap1 = i.types[1] & t->operand_types[1]; if (!MATCH (overlap0, i.types[0], t->operand_types[0]) || !MATCH (overlap1, i.types[1], t->operand_types[1]) - || !CONSISTENT_REGISTER_MATCH (overlap0, i.types[0], - t->operand_types[0], - overlap1, i.types[1], - t->operand_types[1])) + /* monitor in SSE3 is a very special case. The first + register and the second register may have differnet + sizes. */ + || !((t->base_opcode == 0x0f01 + && t->extension_opcode == 0xc8) + || CONSISTENT_REGISTER_MATCH (overlap0, i.types[0], + t->operand_types[0], + overlap1, i.types[1], + t->operand_types[1]))) { /* Check if other direction is valid ... */ if ((t->opcode_modifier & (D | FloatD)) == 0) @@ -2173,7 +2444,7 @@ check_string () } static int -process_suffix () +process_suffix (void) { /* If matched instruction specifies an explicit instruction mnemonic suffix, use it. */ @@ -2196,6 +2467,7 @@ process_suffix () Destination register type is more significant than source register type. */ int op; + for (op = i.operands; --op >= 0;) if ((i.types[op] & Reg) && !(i.tm.operand_types[op] & InOutPortReg)) @@ -2233,19 +2505,71 @@ process_suffix () else abort (); } - else if ((i.tm.opcode_modifier & DefaultSize) && !i.suffix) + else if ((i.tm.opcode_modifier & DefaultSize) + && !i.suffix + /* exclude fldenv/frstor/fsave/fstenv */ + && (i.tm.opcode_modifier & No_sSuf)) { i.suffix = stackop_size; } + else if (intel_syntax + && !i.suffix + && ((i.tm.operand_types[0] & JumpAbsolute) + || (i.tm.opcode_modifier & (JumpByte|JumpInterSegment)) + || (i.tm.base_opcode == 0x0f01 /* [ls][gi]dt */ + && i.tm.extension_opcode <= 3))) + { + switch (flag_code) + { + case CODE_64BIT: + if (!(i.tm.opcode_modifier & No_qSuf)) + { + i.suffix = QWORD_MNEM_SUFFIX; + break; + } + case CODE_32BIT: + if (!(i.tm.opcode_modifier & No_lSuf)) + i.suffix = LONG_MNEM_SUFFIX; + break; + case CODE_16BIT: + if (!(i.tm.opcode_modifier & No_wSuf)) + i.suffix = WORD_MNEM_SUFFIX; + break; + } + } + + if (!i.suffix) + { + if (!intel_syntax) + { + if (i.tm.opcode_modifier & W) + { + as_bad (_("no instruction mnemonic suffix given and no register operands; can't size instruction")); + return 0; + } + } + else + { + unsigned int suffixes = ~i.tm.opcode_modifier + & (No_bSuf + | No_wSuf + | No_lSuf + | No_sSuf + | No_xSuf + | No_qSuf); + + if ((i.tm.opcode_modifier & W) + || ((suffixes & (suffixes - 1)) + && !(i.tm.opcode_modifier & (DefaultSize | IgnoreSize)))) + { + as_bad (_("ambiguous operand size for `%s'"), i.tm.name); + return 0; + } + } + } /* Change the opcode based on the operand size given by i.suffix; - We need not change things for byte insns. */ - - if (!i.suffix && (i.tm.opcode_modifier & W)) - { - as_bad (_("no instruction mnemonic suffix given and no register operands; can't size instruction")); - return 0; - } + We don't need to change things for byte insns. */ if (i.suffix && i.suffix != BYTE_MNEM_SUFFIX) { @@ -2261,13 +2585,25 @@ process_suffix () /* Now select between word & dword operations via the operand size prefix, except for instructions that will ignore this prefix anyway. */ - if (i.suffix != QWORD_MNEM_SUFFIX - && !(i.tm.opcode_modifier & IgnoreSize) - && ((i.suffix == LONG_MNEM_SUFFIX) == (flag_code == CODE_16BIT) - || (flag_code == CODE_64BIT - && (i.tm.opcode_modifier & JumpByte)))) + if (i.tm.base_opcode == 0x0f01 && i.tm.extension_opcode == 0xc8) + { + /* monitor in SSE3 is a very special case. The default size + of AX is the size of mode. The address size override + prefix will change the size of AX. */ + if (i.op->regs[0].reg_type & + (flag_code == CODE_32BIT ? Reg16 : Reg32)) + if (!add_prefix (ADDR_PREFIX_OPCODE)) + return 0; + } + else if (i.suffix != QWORD_MNEM_SUFFIX + && i.suffix != LONG_DOUBLE_MNEM_SUFFIX + && !(i.tm.opcode_modifier & (IgnoreSize | FloatMF)) + && ((i.suffix == LONG_MNEM_SUFFIX) == (flag_code == CODE_16BIT) + || (flag_code == CODE_64BIT + && (i.tm.opcode_modifier & JumpByte)))) { unsigned int prefix = DATA_PREFIX_OPCODE; + if (i.tm.opcode_modifier & JumpByte) /* jcxz, loop */ prefix = ADDR_PREFIX_OPCODE; @@ -2283,19 +2619,18 @@ process_suffix () /* Size floating point instruction. */ if (i.suffix == LONG_MNEM_SUFFIX) - { - if (i.tm.opcode_modifier & FloatMF) - i.tm.base_opcode ^= 4; - } + if (i.tm.opcode_modifier & FloatMF) + i.tm.base_opcode ^= 4; } return 1; } static int -check_byte_reg () +check_byte_reg (void) { int op; + for (op = i.operands; --op >= 0;) { /* If this is an eight bit register, it's OK. If it's the 16 or @@ -2313,14 +2648,7 @@ check_byte_reg () || i.tm.base_opcode == 0xfbf)) continue; - if ((i.types[op] & WordReg) && i.op[op].regs->reg_num < 4 -#if 0 - /* Check that the template allows eight bit regs. This - kills insns such as `orb $1,%edx', which maybe should be - allowed. */ - && (i.tm.operand_types[op] & (Reg8 | InOutPortReg)) -#endif - ) + if ((i.types[op] & WordReg) && i.op[op].regs->reg_num < 4) { /* Prohibit these changes in the 64bit mode, since the lowering is more complicated. */ @@ -2490,7 +2818,7 @@ finalize_imm () unsigned int overlap0, overlap1, overlap2; overlap0 = i.types[0] & i.tm.operand_types[0]; - if ((overlap0 & (Imm8 | Imm8S | Imm16 | Imm32 | Imm32S)) + if ((overlap0 & (Imm8 | Imm8S | Imm16 | Imm32 | Imm32S | Imm64)) && overlap0 != Imm8 && overlap0 != Imm8S && overlap0 != Imm16 && overlap0 != Imm32S && overlap0 != Imm32 && overlap0 != Imm64) @@ -2523,7 +2851,7 @@ finalize_imm () i.types[0] = overlap0; overlap1 = i.types[1] & i.tm.operand_types[1]; - if ((overlap1 & (Imm8 | Imm8S | Imm16 | Imm32S | Imm32)) + if ((overlap1 & (Imm8 | Imm8S | Imm16 | Imm32S | Imm32 | Imm64)) && overlap1 != Imm8 && overlap1 != Imm8S && overlap1 != Imm16 && overlap1 != Imm32S && overlap1 != Imm32 && overlap1 != Imm64) @@ -2641,8 +2969,10 @@ process_operands () default_seg = &ds; } - if (i.tm.base_opcode == 0x8d /* lea */ && i.seg[0] && !quiet_warnings) - as_warn (_("segment override on `lea' is ineffectual")); + if ((i.tm.base_opcode == 0x8d /* lea */ + || (i.tm.cpu_flags & CpuSVME)) + && i.seg[0] && !quiet_warnings) + as_warn (_("segment override on `%s' is ineffectual"), i.tm.name); /* If a segment was explicitly specified, and the specified segment is not the default, use an opcode prefix to select it. If we @@ -2699,6 +3029,13 @@ build_modrm_byte () if ((i.op[source].regs->reg_flags & RegRex) != 0) i.rex |= REX_EXTX; } + if (flag_code != CODE_64BIT && (i.rex & (REX_EXTX | REX_EXTZ))) + { + if (!((i.types[0] | i.types[1]) & Control)) + abort (); + i.rex &= ~(REX_EXTX | REX_EXTZ); + add_prefix (LOCK_PREFIX_OPCODE); + } } else { /* If it's not 2 reg operands... */ @@ -2719,21 +3056,7 @@ build_modrm_byte () if (i.index_reg == 0) { /* Operand is just */ - if ((flag_code == CODE_16BIT) ^ (i.prefix[ADDR_PREFIX] != 0) - && (flag_code != CODE_64BIT)) - { - i.rm.regmem = NO_BASE_REGISTER_16; - i.types[op] &= ~Disp; - i.types[op] |= Disp16; - } - else if (flag_code != CODE_64BIT - || (i.prefix[ADDR_PREFIX] != 0)) - { - i.rm.regmem = NO_BASE_REGISTER; - i.types[op] &= ~Disp; - i.types[op] |= Disp32; - } - else + if (flag_code == CODE_64BIT) { /* 64bit mode overwrites the 32bit absolute addressing by RIP relative addressing and @@ -2742,8 +3065,17 @@ build_modrm_byte () i.rm.regmem = ESCAPE_TO_TWO_BYTE_ADDRESSING; i.sib.base = NO_BASE_REGISTER; i.sib.index = NO_INDEX_REGISTER; - i.types[op] &= ~Disp; - i.types[op] |= Disp32S; + i.types[op] = ((i.prefix[ADDR_PREFIX] == 0) ? Disp32S : Disp32); + } + else if ((flag_code == CODE_16BIT) ^ (i.prefix[ADDR_PREFIX] != 0)) + { + i.rm.regmem = NO_BASE_REGISTER_16; + i.types[op] = Disp16; + } + else + { + i.rm.regmem = NO_BASE_REGISTER; + i.types[op] = Disp32; } } else /* !i.base_reg && i.index_reg */ @@ -2765,9 +3097,11 @@ build_modrm_byte () else if (i.base_reg->reg_type == BaseIndex) { i.rm.regmem = NO_BASE_REGISTER; - i.types[op] &= ~Disp; + i.types[op] &= ~ Disp; i.types[op] |= Disp32S; i.flags[op] = Operand_PCrel; + if (! i.disp_operands) + fake_zero_displacement = 1; } else if (i.base_reg->reg_type & Reg16) { @@ -2803,12 +3137,8 @@ build_modrm_byte () { if (flag_code == CODE_64BIT && (i.types[op] & Disp)) - { - if (i.types[op] & Disp8) - i.types[op] = Disp8 | Disp32S; - else - i.types[op] = Disp32S; - } + i.types[op] = (i.types[op] & Disp8) | (i.prefix[ADDR_PREFIX] == 0 ? Disp32S : Disp32); + i.rm.regmem = i.base_reg->reg_num; if ((i.base_reg->reg_flags & RegRex) != 0) i.rex |= REX_EXTZ; @@ -2850,7 +3180,13 @@ build_modrm_byte () if ((i.index_reg->reg_flags & RegRex) != 0) i.rex |= REX_EXTY; } - i.rm.mode = mode_from_disp_size (i.types[op]); + + if (i.disp_operands + && (i.reloc[op] == BFD_RELOC_386_TLS_DESC_CALL + || i.reloc[op] == BFD_RELOC_X86_64_TLSDESC_CALL)) + i.rm.mode = 0; + else + i.rm.mode = mode_from_disp_size (i.types[op]); } if (fake_zero_displacement) @@ -3150,24 +3486,32 @@ output_insn () /* Output normal instructions here. */ char *p; unsigned char *q; + unsigned int prefix; - /* All opcodes on i386 have either 1 or 2 bytes, PadLock instructions - have 3 bytes. We may use one more higher byte to specify a prefix - the instruction requires. */ - if ((i.tm.cpu_flags & CpuPadLock) != 0 - && (i.tm.base_opcode & 0xff000000) != 0) - { - unsigned int prefix; - prefix = (i.tm.base_opcode >> 24) & 0xff; - - if (prefix != REPE_PREFIX_OPCODE - || i.prefix[LOCKREP_PREFIX] != REPE_PREFIX_OPCODE) + /* All opcodes on i386 have either 1 or 2 bytes. Merom New + Instructions have 3 bytes. We may use one more higher byte + to specify a prefix the instruction requires. */ + if ((i.tm.cpu_flags & CpuMNI) != 0) + { + if (i.tm.base_opcode & 0xff000000) + { + prefix = (i.tm.base_opcode >> 24) & 0xff; + goto check_prefix; + } + } + else if ((i.tm.base_opcode & 0xff0000) != 0) + { + prefix = (i.tm.base_opcode >> 16) & 0xff; + if ((i.tm.cpu_flags & CpuPadLock) != 0) + { +check_prefix: + if (prefix != REPE_PREFIX_OPCODE + || i.prefix[LOCKREP_PREFIX] != REPE_PREFIX_OPCODE) + add_prefix (prefix); + } + else add_prefix (prefix); } - else - if ((i.tm.cpu_flags & CpuPadLock) == 0 - && (i.tm.base_opcode & 0xff0000) != 0) - add_prefix ((i.tm.base_opcode >> 16) & 0xff); /* The prefix bytes. */ for (q = i.prefix; @@ -3188,7 +3532,7 @@ output_insn () } else { - if ((i.tm.cpu_flags & CpuPadLock) != 0) + if ((i.tm.cpu_flags & CpuMNI) != 0) { p = frag_more (3); *p++ = (i.tm.base_opcode >> 16) & 0xff; @@ -3237,7 +3581,7 @@ output_insn () #ifdef DEBUG386 if (flag_debug) { - pi (line, &i); + pi ("" /*line*/, &i); } #endif /* DEBUG386 */ } @@ -3319,14 +3663,18 @@ output_disp (insn_start_frag, insn_start_off) p = frag_more (size); reloc_type = reloc (size, pcrel, sign, i.reloc[n]); - if (reloc_type == BFD_RELOC_32 - && GOT_symbol + if (GOT_symbol && GOT_symbol == i.op[n].disps->X_add_symbol - && (i.op[n].disps->X_op == O_symbol - || (i.op[n].disps->X_op == O_add - && ((symbol_get_value_expression - (i.op[n].disps->X_op_symbol)->X_op) - == O_subtract)))) + && (((reloc_type == BFD_RELOC_32 + || reloc_type == BFD_RELOC_X86_64_32S + || (reloc_type == BFD_RELOC_64 + && object_64bit)) + && (i.op[n].disps->X_op == O_symbol + || (i.op[n].disps->X_op == O_add + && ((symbol_get_value_expression + (i.op[n].disps->X_op_symbol)->X_op) + == O_subtract)))) + || reloc_type == BFD_RELOC_32_PCREL)) { offsetT add; @@ -3343,11 +3691,18 @@ output_disp (insn_start_frag, insn_start_off) add += p - frag_now->fr_literal; } - /* We don't support dynamic linking on x86-64 yet. */ - if (flag_code == CODE_64BIT) - abort (); - reloc_type = BFD_RELOC_386_GOTPC; - i.op[n].disps->X_add_number += add; + if (!object_64bit) + { + reloc_type = BFD_RELOC_386_GOTPC; + i.op[n].imms->X_add_number += add; + } + else if (reloc_type == BFD_RELOC_64) + reloc_type = BFD_RELOC_X86_64_GOTPC64; + else + /* Don't do the adjustment for x86-64, as there + the pcrel addressing is relative to the _next_ + insn, and that is taken care of in other code. */ + reloc_type = BFD_RELOC_X86_64_GOTPC32; } fix_new_exp (frag_now, p - frag_now->fr_literal, size, i.op[n].disps, pcrel, reloc_type); @@ -3398,7 +3753,8 @@ output_imm (insn_start_frag, insn_start_off) int sign = 0; if ((i.types[n] & (Imm32S)) - && i.suffix == QWORD_MNEM_SUFFIX) + && (i.suffix == QWORD_MNEM_SUFFIX + || (!i.suffix && (i.tm.opcode_modifier & No_lSuf)))) sign = 1; if (i.types[n] & (Imm8 | Imm8S | Imm16 | Imm64)) { @@ -3454,7 +3810,9 @@ output_imm (insn_start_frag, insn_start_off) * since the expression is not pcrel, I felt it would be * confusing to do it this way. */ - if (reloc_type == BFD_RELOC_32 + if ((reloc_type == BFD_RELOC_32 + || reloc_type == BFD_RELOC_X86_64_32S + || reloc_type == BFD_RELOC_64) && GOT_symbol && GOT_symbol == i.op[n].imms->X_add_symbol && (i.op[n].imms->X_op == O_symbol @@ -3478,10 +3836,12 @@ output_imm (insn_start_frag, insn_start_off) add += p - frag_now->fr_literal; } - /* We don't support dynamic linking on x86-64 yet. */ - if (flag_code == CODE_64BIT) - abort (); - reloc_type = BFD_RELOC_386_GOTPC; + if (!object_64bit) + reloc_type = BFD_RELOC_386_GOTPC; + else if (size == 4) + reloc_type = BFD_RELOC_X86_64_GOTPC32; + else if (size == 8) + reloc_type = BFD_RELOC_X86_64_GOTPC64; i.op[n].imms->X_add_number += add; } fix_new_exp (frag_now, p - frag_now->fr_literal, size, @@ -3491,9 +3851,35 @@ output_imm (insn_start_frag, insn_start_off) } } -#ifndef LEX_AT -static char *lex_got PARAMS ((enum bfd_reloc_code_real *, int *)); +/* x86_cons_fix_new is called via the expression parsing code when a + reloc is needed. We use this hook to get the correct .got reloc. */ +static enum bfd_reloc_code_real got_reloc = NO_RELOC; +static int cons_sign = -1; +void +x86_cons_fix_new (fragS *frag, + unsigned int off, + unsigned int len, + expressionS *exp) +{ + enum bfd_reloc_code_real r = reloc (len, 0, cons_sign, got_reloc); + + got_reloc = NO_RELOC; + +#ifdef TE_PE + if (exp->X_op == O_secrel) + { + exp->X_op = O_symbol; + r = BFD_RELOC_32_SECREL; + } +#endif + + fix_new_exp (frag, off, len, exp, 0, r); +} + +#if (!defined (OBJ_ELF) && !defined (OBJ_MAYBE_ELF)) || defined (LEX_AT) +# define lex_got(reloc, adjust, types) NULL +#else /* Parse operands of the form @GOTOFF+ and similar .plt or .got references. @@ -3504,32 +3890,44 @@ static char *lex_got PARAMS ((enum bfd_reloc_code_real *, int *)); is non-null set it to the length of the string we removed from the input line. Otherwise return NULL. */ static char * -lex_got (reloc, adjust) - enum bfd_reloc_code_real *reloc; - int *adjust; +lex_got (enum bfd_reloc_code_real *reloc, + int *adjust, + unsigned int *types) { - static const char * const mode_name[NUM_FLAG_CODE] = { "32", "16", "64" }; + /* Some of the relocations depend on the size of what field is to + be relocated. But in our callers i386_immediate and i386_displacement + we don't yet know the operand size (this will be set by insn + matching). Hence we record the word32 relocation here, + and adjust the reloc according to the real size in reloc(). */ static const struct { const char *str; - const enum bfd_reloc_code_real rel[NUM_FLAG_CODE]; + const enum bfd_reloc_code_real rel[2]; + const unsigned int types64; } gotrel[] = { - { "PLT", { BFD_RELOC_386_PLT32, 0, BFD_RELOC_X86_64_PLT32 } }, - { "GOTOFF", { BFD_RELOC_386_GOTOFF, 0, 0 } }, - { "GOTPCREL", { 0, 0, BFD_RELOC_X86_64_GOTPCREL } }, - { "TLSGD", { BFD_RELOC_386_TLS_GD, 0, BFD_RELOC_X86_64_TLSGD } }, - { "TLSLDM", { BFD_RELOC_386_TLS_LDM, 0, 0 } }, - { "TLSLD", { 0, 0, BFD_RELOC_X86_64_TLSLD } }, - { "GOTTPOFF", { BFD_RELOC_386_TLS_IE_32, 0, BFD_RELOC_X86_64_GOTTPOFF } }, - { "TPOFF", { BFD_RELOC_386_TLS_LE_32, 0, BFD_RELOC_X86_64_TPOFF32 } }, - { "NTPOFF", { BFD_RELOC_386_TLS_LE, 0, 0 } }, - { "DTPOFF", { BFD_RELOC_386_TLS_LDO_32, 0, BFD_RELOC_X86_64_DTPOFF32 } }, - { "GOTNTPOFF",{ BFD_RELOC_386_TLS_GOTIE, 0, 0 } }, - { "INDNTPOFF",{ BFD_RELOC_386_TLS_IE, 0, 0 } }, - { "GOT", { BFD_RELOC_386_GOT32, 0, BFD_RELOC_X86_64_GOT32 } } + { "PLTOFF", { 0, BFD_RELOC_X86_64_PLTOFF64 }, Imm64 }, + { "PLT", { BFD_RELOC_386_PLT32, BFD_RELOC_X86_64_PLT32 }, Imm32|Imm32S|Disp32 }, + { "GOTPLT", { 0, BFD_RELOC_X86_64_GOTPLT64 }, Imm64|Disp64 }, + { "GOTOFF", { BFD_RELOC_386_GOTOFF, BFD_RELOC_X86_64_GOTOFF64 }, Imm64|Disp64 }, + { "GOTPCREL", { 0, BFD_RELOC_X86_64_GOTPCREL }, Imm32|Imm32S|Disp32 }, + { "TLSGD", { BFD_RELOC_386_TLS_GD, BFD_RELOC_X86_64_TLSGD }, Imm32|Imm32S|Disp32 }, + { "TLSLDM", { BFD_RELOC_386_TLS_LDM, 0 }, 0 }, + { "TLSLD", { 0, BFD_RELOC_X86_64_TLSLD }, Imm32|Imm32S|Disp32 }, + { "GOTTPOFF", { BFD_RELOC_386_TLS_IE_32, BFD_RELOC_X86_64_GOTTPOFF }, Imm32|Imm32S|Disp32 }, + { "TPOFF", { BFD_RELOC_386_TLS_LE_32, BFD_RELOC_X86_64_TPOFF32 }, Imm32|Imm32S|Imm64|Disp32|Disp64 }, + { "NTPOFF", { BFD_RELOC_386_TLS_LE, 0 }, 0 }, + { "DTPOFF", { BFD_RELOC_386_TLS_LDO_32, BFD_RELOC_X86_64_DTPOFF32 }, Imm32|Imm32S|Imm64|Disp32|Disp64 }, + { "GOTNTPOFF",{ BFD_RELOC_386_TLS_GOTIE, 0 }, 0 }, + { "INDNTPOFF",{ BFD_RELOC_386_TLS_IE, 0 }, 0 }, + { "GOT", { BFD_RELOC_386_GOT32, BFD_RELOC_X86_64_GOT32 }, Imm32|Imm32S|Disp32|Imm64 }, + { "TLSDESC", { BFD_RELOC_386_TLS_GOTDESC, BFD_RELOC_X86_64_GOTPC32_TLSDESC }, Imm32|Imm32S|Disp32 }, + { "TLSCALL", { BFD_RELOC_386_TLS_DESC_CALL, BFD_RELOC_X86_64_TLSDESC_CALL }, Imm32|Imm32S|Disp32 } }; char *cp; unsigned int j; + if (!IS_ELF) + return NULL; + for (cp = input_line_pointer; *cp != '@'; cp++) if (is_end_of_line[(unsigned char) *cp]) return NULL; @@ -3541,15 +3939,23 @@ lex_got (reloc, adjust) len = strlen (gotrel[j].str); if (strncasecmp (cp + 1, gotrel[j].str, len) == 0) { - if (gotrel[j].rel[(unsigned int) flag_code] != 0) + if (gotrel[j].rel[object_64bit] != 0) { int first, second; char *tmpbuf, *past_reloc; - *reloc = gotrel[j].rel[(unsigned int) flag_code]; + *reloc = gotrel[j].rel[object_64bit]; if (adjust) *adjust = len; + if (types) + { + if (flag_code != CODE_64BIT) + *types = Imm32|Disp32; + else + *types = gotrel[j].types64; + } + if (GOT_symbol == NULL) GOT_symbol = symbol_find_or_make (GLOBAL_OFFSET_TABLE_NAME); @@ -3577,8 +3983,8 @@ lex_got (reloc, adjust) return tmpbuf; } - as_bad (_("@%s reloc is not supported in %s bit mode"), - gotrel[j].str, mode_name[(unsigned int) flag_code]); + as_bad (_("@%s reloc is not supported with %d-bit output format"), + gotrel[j].str, 1 << (5 + object_64bit)); return NULL; } } @@ -3587,28 +3993,12 @@ lex_got (reloc, adjust) return NULL; } -/* x86_cons_fix_new is called via the expression parsing code when a - reloc is needed. We use this hook to get the correct .got reloc. */ -static enum bfd_reloc_code_real got_reloc = NO_RELOC; - -void -x86_cons_fix_new (frag, off, len, exp) - fragS *frag; - unsigned int off; - unsigned int len; - expressionS *exp; -{ - enum bfd_reloc_code_real r = reloc (len, 0, 0, got_reloc); - got_reloc = NO_RELOC; - fix_new_exp (frag, off, len, exp, 0, r); -} - void x86_cons (exp, size) expressionS *exp; int size; { - if (size == 4) + if (size == 4 || (object_64bit && size == 8)) { /* Handle @GOTOFF and the like in an expression. */ char *save; @@ -3616,7 +4006,7 @@ x86_cons (exp, size) int adjust; save = input_line_pointer; - gotfree_input_line = lex_got (&got_reloc, &adjust); + gotfree_input_line = lex_got (&got_reloc, &adjust, NULL); if (gotfree_input_line) input_line_pointer = gotfree_input_line; @@ -3638,6 +4028,36 @@ x86_cons (exp, size) } #endif +static void signed_cons (int size) +{ + if (flag_code == CODE_64BIT) + cons_sign = 1; + cons (size); + cons_sign = -1; +} + +#ifdef TE_PE +static void +pe_directive_secrel (dummy) + int dummy ATTRIBUTE_UNUSED; +{ + expressionS exp; + + do + { + expression (&exp); + if (exp.X_op == O_symbol) + exp.X_op = O_secrel; + + emit_expr (&exp, 4); + } + while (*input_line_pointer++ == ','); + + input_line_pointer--; + demand_empty_rest_of_line (); +} +#endif + static int i386_immediate PARAMS ((char *)); static int @@ -3645,11 +4065,10 @@ i386_immediate (imm_start) char *imm_start; { char *save_input_line_pointer; -#ifndef LEX_AT char *gotfree_input_line; -#endif segT exp_seg = 0; expressionS *exp; + unsigned int types = ~0U; if (i.imm_operands == MAX_IMMEDIATE_OPERANDS) { @@ -3666,11 +4085,9 @@ i386_immediate (imm_start) save_input_line_pointer = input_line_pointer; input_line_pointer = imm_start; -#ifndef LEX_AT - gotfree_input_line = lex_got (&i.reloc[this_operand], NULL); + gotfree_input_line = lex_got (&i.reloc[this_operand], NULL, &types); if (gotfree_input_line) input_line_pointer = gotfree_input_line; -#endif exp_seg = expression (exp); @@ -3679,10 +4096,8 @@ i386_immediate (imm_start) as_bad (_("junk `%s' after expression"), input_line_pointer); input_line_pointer = save_input_line_pointer; -#ifndef LEX_AT if (gotfree_input_line) free (gotfree_input_line); -#endif if (exp->X_op == O_absent || exp->X_op == O_big) { @@ -3722,6 +4137,7 @@ i386_immediate (imm_start) determined later, depending on destination register, suffix, or the default for the section. */ i.types[this_operand] |= Imm8 | Imm16 | Imm32 | Imm32S | Imm64; + i.types[this_operand] &= types; } return 1; @@ -3741,7 +4157,6 @@ i386_scale (scale) switch (val) { - case 0: case 1: i.log2_scale_factor = 0; break; @@ -3755,10 +4170,16 @@ i386_scale (scale) i.log2_scale_factor = 3; break; default: - as_bad (_("expecting scale factor of 1, 2, 4, or 8: got `%s'"), - scale); - input_line_pointer = save; - return NULL; + { + char sep = *input_line_pointer; + + *input_line_pointer = '\0'; + as_bad (_("expecting scale factor of 1, 2, 4, or 8: got `%s'"), + scale); + *input_line_pointer = sep; + input_line_pointer = save; + return NULL; + } } if (i.log2_scale_factor != 0 && i.index_reg == 0) { @@ -3783,18 +4204,45 @@ i386_displacement (disp_start, disp_end) expressionS *exp; segT exp_seg = 0; char *save_input_line_pointer; -#ifndef LEX_AT char *gotfree_input_line; -#endif - int bigdisp = Disp32; + int bigdisp, override; + unsigned int types = Disp; + if ((i.types[this_operand] & JumpAbsolute) + || !(current_templates->start->opcode_modifier & (Jump | JumpDword))) + { + bigdisp = Disp32; + override = (i.prefix[ADDR_PREFIX] != 0); + } + else + { + /* For PC-relative branches, the width of the displacement + is dependent upon data size, not address size. */ + bigdisp = 0; + override = (i.prefix[DATA_PREFIX] != 0); + } if (flag_code == CODE_64BIT) { - if (i.prefix[ADDR_PREFIX] == 0) - bigdisp = Disp64; + if (!bigdisp) + bigdisp = (override || i.suffix == WORD_MNEM_SUFFIX) + ? Disp16 + : Disp32S | Disp32; + else if (!override) + bigdisp = Disp64 | Disp32S | Disp32; + } + else + { + if (!bigdisp) + { + if (!override) + override = (i.suffix == (flag_code != CODE_16BIT + ? WORD_MNEM_SUFFIX + : LONG_MNEM_SUFFIX)); + bigdisp = Disp32; + } + if ((flag_code == CODE_16BIT) ^ override) + bigdisp = Disp16; } - else if ((flag_code == CODE_16BIT) ^ (i.prefix[ADDR_PREFIX] != 0)) - bigdisp = Disp16; i.types[this_operand] |= bigdisp; exp = &disp_expressions[i.disp_operands]; @@ -3848,11 +4296,9 @@ i386_displacement (disp_start, disp_end) *displacement_string_end = '0'; } #endif -#ifndef LEX_AT - gotfree_input_line = lex_got (&i.reloc[this_operand], NULL); + gotfree_input_line = lex_got (&i.reloc[this_operand], NULL, &types); if (gotfree_input_line) input_line_pointer = gotfree_input_line; -#endif exp_seg = expression (exp); @@ -3864,16 +4310,15 @@ i386_displacement (disp_start, disp_end) #endif RESTORE_END_STRING (disp_end); input_line_pointer = save_input_line_pointer; -#ifndef LEX_AT if (gotfree_input_line) free (gotfree_input_line); -#endif /* We do this to make sure that the section symbol is in the symbol table. We will ultimately change the relocation to be relative to the beginning of the section. */ if (i.reloc[this_operand] == BFD_RELOC_386_GOTOFF - || i.reloc[this_operand] == BFD_RELOC_X86_64_GOTPCREL) + || i.reloc[this_operand] == BFD_RELOC_X86_64_GOTPCREL + || i.reloc[this_operand] == BFD_RELOC_X86_64_GOTOFF64) { if (exp->X_op != O_symbol) { @@ -3891,6 +4336,8 @@ i386_displacement (disp_start, disp_end) exp->X_op_symbol = GOT_symbol; if (i.reloc[this_operand] == BFD_RELOC_X86_64_GOTPCREL) i.reloc[this_operand] = BFD_RELOC_32_PCREL; + else if (i.reloc[this_operand] == BFD_RELOC_X86_64_GOTOFF64) + i.reloc[this_operand] = BFD_RELOC_64; else i.reloc[this_operand] = BFD_RELOC_32; } @@ -3920,8 +4367,10 @@ i386_displacement (disp_start, disp_end) return 0; } #endif - else if (flag_code == CODE_64BIT) - i.types[this_operand] |= Disp32S | Disp32; + + if (!(i.types[this_operand] & ~Disp)) + i.types[this_operand] &= types; + return 1; } @@ -3941,30 +4390,41 @@ i386_index_check (operand_string) tryprefix: #endif ok = 1; - if (flag_code == CODE_64BIT) + if ((current_templates->start->cpu_flags & CpuSVME) + && current_templates->end[-1].operand_types[0] == AnyMem) { - if (i.prefix[ADDR_PREFIX] == 0) - { - /* 64bit checks. */ - if ((i.base_reg - && ((i.base_reg->reg_type & Reg64) == 0) - && (i.base_reg->reg_type != BaseIndex - || i.index_reg)) - || (i.index_reg - && ((i.index_reg->reg_type & (Reg64 | BaseIndex)) - != (Reg64 | BaseIndex)))) - ok = 0; - } + /* Memory operands of SVME insns are special in that they only allow + rAX as their memory address and ignore any segment override. */ + unsigned RegXX; + + /* SKINIT is even more restrictive: it always requires EAX. */ + if (strcmp (current_templates->start->name, "skinit") == 0) + RegXX = Reg32; + else if (flag_code == CODE_64BIT) + RegXX = i.prefix[ADDR_PREFIX] == 0 ? Reg64 : Reg32; else - { - /* 32bit checks. */ - if ((i.base_reg - && (i.base_reg->reg_type & (Reg32 | RegRex)) != Reg32) - || (i.index_reg - && ((i.index_reg->reg_type & (Reg32 | BaseIndex | RegRex)) - != (Reg32 | BaseIndex)))) - ok = 0; - } + RegXX = (flag_code == CODE_16BIT) ^ (i.prefix[ADDR_PREFIX] != 0) + ? Reg16 + : Reg32; + if (!i.base_reg + || !(i.base_reg->reg_type & Acc) + || !(i.base_reg->reg_type & RegXX) + || i.index_reg + || (i.types[0] & Disp)) + ok = 0; + } + else if (flag_code == CODE_64BIT) + { + unsigned RegXX = (i.prefix[ADDR_PREFIX] == 0 ? Reg64 : Reg32); + + if ((i.base_reg + && ((i.base_reg->reg_type & RegXX) == 0) + && (i.base_reg->reg_type != BaseIndex + || i.index_reg)) + || (i.index_reg + && ((i.index_reg->reg_type & (RegXX | BaseIndex)) + != (RegXX | BaseIndex)))) + ok = 0; } else { @@ -3997,8 +4457,7 @@ i386_index_check (operand_string) if (!ok) { #if INFER_ADDR_PREFIX - if (flag_code != CODE_64BIT - && i.prefix[ADDR_PREFIX] == 0 && stackop_size != '\0') + if (i.prefix[ADDR_PREFIX] == 0) { i.prefix[ADDR_PREFIX] = ADDR_PREFIX_OPCODE; i.prefixes += 1; @@ -4007,7 +4466,7 @@ i386_index_check (operand_string) FIXME. There doesn't seem to be any real need for separate Disp16 and Disp32 flags. The same goes for Imm16 and Imm32. Removing them would probably clean up the code quite a lot. */ - if (i.types[this_operand] & (Disp16 | Disp32)) + if (flag_code != CODE_64BIT && (i.types[this_operand] & (Disp16 | Disp32))) i.types[this_operand] ^= (Disp16 | Disp32); fudged = 1; goto tryprefix; @@ -4020,9 +4479,8 @@ i386_index_check (operand_string) as_bad (_("`%s' is not a valid %s bit base/index expression"), operand_string, flag_code_names[flag_code]); - return 0; } - return 1; + return ok; } /* Parse OPERAND_STRING into the i386_insn structure I. Returns non-zero @@ -4050,8 +4508,7 @@ i386_operand (operand_string) } /* Check if operand is a register. */ - if ((*op_string == REGISTER_PREFIX || allow_naked_reg) - && (r = parse_register (op_string, &end_op)) != NULL) + if ((r = parse_register (op_string, &end_op)) != NULL) { /* Check for a segment override by searching for ':' after a segment register. */ @@ -4189,8 +4646,7 @@ i386_operand (operand_string) ++base_string; if (*base_string == ',' - || ((*base_string == REGISTER_PREFIX || allow_naked_reg) - && (i.base_reg = parse_register (base_string, &end_op)) != NULL)) + || ((i.base_reg = parse_register (base_string, &end_op)) != NULL)) { displacement_string_end = temp_string; @@ -4210,8 +4666,7 @@ i386_operand (operand_string) if (is_space_char (*base_string)) ++base_string; - if ((*base_string == REGISTER_PREFIX || allow_naked_reg) - && (i.index_reg = parse_register (base_string, &end_op)) != NULL) + if ((i.index_reg = parse_register (base_string, &end_op)) != NULL) { base_string = end_op; if (is_space_char (*base_string)) @@ -4336,7 +4791,7 @@ md_estimate_size_before_relax (fragP, segment) shared library. */ if (S_GET_SEGMENT (fragP->fr_symbol) != segment #if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) - || (OUTPUT_FLAVOR == bfd_target_elf_flavour + || (IS_ELF && (S_IS_EXTERNAL (fragP->fr_symbol) || S_IS_WEAK (fragP->fr_symbol))) #endif @@ -4523,6 +4978,20 @@ md_convert_frag (abfd, sec, fragP) } } + /* If size if less then four we are sure that the operand fits, + but if it's 4, then it could be that the displacement is larger + then -/+ 2GB. */ + if (DISP_SIZE_FROM_RELAX_STATE (fragP->fr_subtype) == 4 + && object_64bit + && ((addressT) (displacement_from_opcode_start - extension + + ((addressT) 1 << 31)) + > (((addressT) 2 << 31) - 1))) + { + as_bad_where (fragP->fr_file, fragP->fr_line, + _("jump target out of range")); + /* Make us emit 0. */ + displacement_from_opcode_start = extension; + } /* Now put displacement after opcode. */ md_number_to_chars ((char *) where_to_put_displacement, (valueT) (displacement_from_opcode_start - extension), @@ -4536,9 +5005,6 @@ int md_short_jump_size = 2; /* Size of dword displacement jmp. */ int md_long_jump_size = 5; -/* Size of relocation record. */ -const int md_reloc_size = 8; - void md_create_short_jump (ptr, from_addr, to_addr, frag, to_symbol) char *ptr; @@ -4576,7 +5042,7 @@ md_create_long_jump (ptr, from_addr, to_addr, frag, to_symbol) we are handling. */ void -md_apply_fix3 (fixP, valP, seg) +md_apply_fix (fixP, valP, seg) /* The fix we're to put in. */ fixS *fixP; /* Pointer to the value of the bits. */ @@ -4595,7 +5061,11 @@ md_apply_fix3 (fixP, valP, seg) default: break; + case BFD_RELOC_64: + fixP->fx_r_type = BFD_RELOC_64_PCREL; + break; case BFD_RELOC_32: + case BFD_RELOC_X86_64_32S: fixP->fx_r_type = BFD_RELOC_32_PCREL; break; case BFD_RELOC_16: @@ -4609,6 +5079,7 @@ md_apply_fix3 (fixP, valP, seg) if (fixP->fx_addsy != NULL && (fixP->fx_r_type == BFD_RELOC_32_PCREL + || fixP->fx_r_type == BFD_RELOC_64_PCREL || fixP->fx_r_type == BFD_RELOC_16_PCREL || fixP->fx_r_type == BFD_RELOC_8_PCREL) && !use_rela_relocations) @@ -4618,7 +5089,7 @@ md_apply_fix3 (fixP, valP, seg) subtract the current location (for partial_inplace, PC relative relocations); see more below. */ #ifndef OBJ_AOUT - if (OUTPUT_FLAVOR == bfd_target_elf_flavour + if (IS_ELF #ifdef TE_PE || OUTPUT_FLAVOR == bfd_target_coff_flavour #endif @@ -4626,7 +5097,7 @@ md_apply_fix3 (fixP, valP, seg) value += fixP->fx_where + fixP->fx_frag->fr_address; #endif #if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) - if (OUTPUT_FLAVOR == bfd_target_elf_flavour) + if (IS_ELF) { segT sym_seg = S_GET_SEGMENT (fixP->fx_addsy); @@ -4644,9 +5115,10 @@ md_apply_fix3 (fixP, valP, seg) } #endif #if defined (OBJ_COFF) && defined (TE_PE) - /* For some reason, the PE format does not store a section - address offset for a PC relative symbol. */ - if (S_GET_SEGMENT (fixP->fx_addsy) != seg) + /* For some reason, the PE format does not store a + section address offset for a PC relative symbol. */ + if (S_GET_SEGMENT (fixP->fx_addsy) != seg + || S_IS_WEAK (fixP->fx_addsy)) value += md_pcrel_from (fixP); #endif } @@ -4654,8 +5126,7 @@ md_apply_fix3 (fixP, valP, seg) /* Fix a few things - the dynamic linker expects certain values here, and we must not disappoint it. */ #if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) - if (OUTPUT_FLAVOR == bfd_target_elf_flavour - && fixP->fx_addsy) + if (IS_ELF && fixP->fx_addsy) switch (fixP->fx_r_type) { case BFD_RELOC_386_PLT32: @@ -4670,19 +5141,30 @@ md_apply_fix3 (fixP, valP, seg) case BFD_RELOC_386_TLS_IE_32: case BFD_RELOC_386_TLS_IE: case BFD_RELOC_386_TLS_GOTIE: + case BFD_RELOC_386_TLS_GOTDESC: case BFD_RELOC_X86_64_TLSGD: case BFD_RELOC_X86_64_TLSLD: case BFD_RELOC_X86_64_GOTTPOFF: + case BFD_RELOC_X86_64_GOTPC32_TLSDESC: value = 0; /* Fully resolved at runtime. No addend. */ /* Fallthrough */ case BFD_RELOC_386_TLS_LE: case BFD_RELOC_386_TLS_LDO_32: case BFD_RELOC_386_TLS_LE_32: case BFD_RELOC_X86_64_DTPOFF32: + case BFD_RELOC_X86_64_DTPOFF64: case BFD_RELOC_X86_64_TPOFF32: + case BFD_RELOC_X86_64_TPOFF64: S_SET_THREAD_LOCAL (fixP->fx_addsy); break; + case BFD_RELOC_386_TLS_DESC_CALL: + case BFD_RELOC_X86_64_TLSDESC_CALL: + value = 0; /* Fully resolved at runtime. No addend. */ + S_SET_THREAD_LOCAL (fixP->fx_addsy); + fixP->fx_done = 0; + return; + case BFD_RELOC_386_GOT32: case BFD_RELOC_X86_64_GOT32: value = 0; /* Fully resolved at runtime. No addend. */ @@ -4768,7 +5250,7 @@ md_atof (type, litP, sizeP) return 0; } -char output_invalid_buf[8]; +static char output_invalid_buf[8]; static char * output_invalid (c) @@ -4784,9 +5266,7 @@ output_invalid (c) /* REG_STRING starts *before* REGISTER_PREFIX. */ static const reg_entry * -parse_register (reg_string, end_op) - char *reg_string; - char **end_op; +parse_real_register (char *reg_string, char **end_op) { char *s = reg_string; char *p; @@ -4846,14 +5326,87 @@ parse_register (reg_string, end_op) } if (r != NULL - && (r->reg_flags & (RegRex64 | RegRex)) != 0 + && ((r->reg_flags & (RegRex64 | RegRex)) | (r->reg_type & Reg64)) != 0 + && (r->reg_type != Control || !(cpu_arch_flags & CpuSledgehammer)) && flag_code != CODE_64BIT) - { - return (const reg_entry *) NULL; - } + return (const reg_entry *) NULL; return r; } + +/* REG_STRING starts *before* REGISTER_PREFIX. */ + +static const reg_entry * +parse_register (char *reg_string, char **end_op) +{ + const reg_entry *r; + + if (*reg_string == REGISTER_PREFIX || allow_naked_reg) + r = parse_real_register (reg_string, end_op); + else + r = NULL; + if (!r) + { + char *save = input_line_pointer; + char c; + symbolS *symbolP; + + input_line_pointer = reg_string; + c = get_symbol_end (); + symbolP = symbol_find (reg_string); + if (symbolP && S_GET_SEGMENT (symbolP) == reg_section) + { + const expressionS *e = symbol_get_value_expression (symbolP); + + know (e->X_op == O_register); + know (e->X_add_number >= 0 && (valueT) e->X_add_number < ARRAY_SIZE (i386_regtab)); + r = i386_regtab + e->X_add_number; + *end_op = input_line_pointer; + } + *input_line_pointer = c; + input_line_pointer = save; + } + return r; +} + +int +i386_parse_name (char *name, expressionS *e, char *nextcharP) +{ + const reg_entry *r; + char *end = input_line_pointer; + + *end = *nextcharP; + r = parse_register (name, &input_line_pointer); + if (r && end <= input_line_pointer) + { + *nextcharP = *input_line_pointer; + *input_line_pointer = 0; + e->X_op = O_register; + e->X_add_number = r - i386_regtab; + return 1; + } + input_line_pointer = end; + *end = 0; + return 0; +} + +void +md_operand (expressionS *e) +{ + if (*input_line_pointer == REGISTER_PREFIX) + { + char *end; + const reg_entry *r = parse_real_register (input_line_pointer, &end); + + if (r) + { + e->X_op = O_register; + e->X_add_number = r - i386_regtab; + input_line_pointer = end; + } + } +} + #if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) const char *md_shortopts = "kVQ:sqn"; @@ -4861,13 +5414,16 @@ const char *md_shortopts = "kVQ:sqn"; const char *md_shortopts = "qn"; #endif -struct option md_longopts[] = { #define OPTION_32 (OPTION_MD_BASE + 0) +#define OPTION_64 (OPTION_MD_BASE + 1) +#define OPTION_DIVIDE (OPTION_MD_BASE + 2) + +struct option md_longopts[] = { {"32", no_argument, NULL, OPTION_32}, #if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) -#define OPTION_64 (OPTION_MD_BASE + 1) {"64", no_argument, NULL, OPTION_64}, #endif + {"divide", no_argument, NULL, OPTION_DIVIDE}, {NULL, no_argument, NULL, 0} }; size_t md_longopts_size = sizeof (md_longopts); @@ -4929,6 +5485,23 @@ md_parse_option (c, arg) default_arch = "i386"; break; + case OPTION_DIVIDE: +#ifdef SVR4_COMMENT_CHARS + { + char *n, *t; + const char *s; + + n = (char *) xmalloc (strlen (i386_comment_chars) + 1); + t = n; + for (s = i386_comment_chars; *s != '\0'; s++) + if (*s != '/') + *t++ = *s; + *t = '\0'; + i386_comment_chars = n; + } +#endif + break; + default: return 0; } @@ -4943,14 +5516,21 @@ md_show_usage (stream) fprintf (stream, _("\ -Q ignored\n\ -V print assembler version number\n\ - -k ignored\n\ - -n Do not optimize code alignment\n\ - -q quieten some warnings\n\ - -s ignored\n")); -#else + -k ignored\n")); +#endif fprintf (stream, _("\ -n Do not optimize code alignment\n\ -q quieten some warnings\n")); +#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) + fprintf (stream, _("\ + -s ignored\n")); +#endif +#ifdef SVR4_COMMENT_CHARS + fprintf (stream, _("\ + --divide do not treat `/' as a comment character\n")); +#else + fprintf (stream, _("\ + --divide ignored\n")); #endif } @@ -4982,7 +5562,10 @@ i386_target_format () case bfd_target_elf_flavour: { if (flag_code == CODE_64BIT) - use_rela_relocations = 1; + { + object_64bit = 1; + use_rela_relocations = 1; + } return flag_code == CODE_64BIT ? "elf64-x86-64" : ELF_TARGET_FORMAT; } #endif @@ -4997,8 +5580,7 @@ i386_target_format () #if (defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)) void i386_elf_emit_arch_note () { - if (OUTPUT_FLAVOR == bfd_target_elf_flavour - && cpu_arch_name != NULL) + if (IS_ELF && cpu_arch_name != NULL) { char *p; asection *seg = now_seg; @@ -5101,6 +5683,10 @@ s_bss (ignore) { int temp; +#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) + if (IS_ELF) + obj_elf_section_change_hook (); +#endif temp = get_absolute_expression (); subseg_set (bss_section, (subsegT) temp); demand_empty_rest_of_line (); @@ -5114,18 +5700,18 @@ i386_validate_fix (fixp) { if (fixp->fx_subsy && fixp->fx_subsy == GOT_symbol) { - /* GOTOFF relocation are nonsense in 64bit mode. */ if (fixp->fx_r_type == BFD_RELOC_32_PCREL) { - if (flag_code != CODE_64BIT) + if (!object_64bit) abort (); fixp->fx_r_type = BFD_RELOC_X86_64_GOTPCREL; } else { - if (flag_code == CODE_64BIT) - abort (); - fixp->fx_r_type = BFD_RELOC_386_GOTOFF; + if (!object_64bit) + fixp->fx_r_type = BFD_RELOC_386_GOTOFF; + else + fixp->fx_r_type = BFD_RELOC_X86_64_GOTOFF64; } fixp->fx_subsy = 0; } @@ -5156,17 +5742,39 @@ tc_gen_reloc (section, fixp) case BFD_RELOC_386_TLS_GOTIE: case BFD_RELOC_386_TLS_LE_32: case BFD_RELOC_386_TLS_LE: - case BFD_RELOC_X86_64_32S: + case BFD_RELOC_386_TLS_GOTDESC: + case BFD_RELOC_386_TLS_DESC_CALL: case BFD_RELOC_X86_64_TLSGD: case BFD_RELOC_X86_64_TLSLD: case BFD_RELOC_X86_64_DTPOFF32: + case BFD_RELOC_X86_64_DTPOFF64: case BFD_RELOC_X86_64_GOTTPOFF: case BFD_RELOC_X86_64_TPOFF32: + case BFD_RELOC_X86_64_TPOFF64: + case BFD_RELOC_X86_64_GOTOFF64: + case BFD_RELOC_X86_64_GOTPC32: + case BFD_RELOC_X86_64_GOT64: + case BFD_RELOC_X86_64_GOTPCREL64: + case BFD_RELOC_X86_64_GOTPC64: + case BFD_RELOC_X86_64_GOTPLT64: + case BFD_RELOC_X86_64_PLTOFF64: + case BFD_RELOC_X86_64_GOTPC32_TLSDESC: + case BFD_RELOC_X86_64_TLSDESC_CALL: case BFD_RELOC_RVA: case BFD_RELOC_VTABLE_ENTRY: case BFD_RELOC_VTABLE_INHERIT: +#ifdef TE_PE + case BFD_RELOC_32_SECREL: +#endif code = fixp->fx_r_type; break; + case BFD_RELOC_X86_64_32S: + if (!fixp->fx_pcrel) + { + /* Don't turn BFD_RELOC_X86_64_32S into BFD_RELOC_32. */ + code = fixp->fx_r_type; + break; + } default: if (fixp->fx_pcrel) { @@ -5181,6 +5789,9 @@ tc_gen_reloc (section, fixp) case 1: code = BFD_RELOC_8_PCREL; break; case 2: code = BFD_RELOC_16_PCREL; break; case 4: code = BFD_RELOC_32_PCREL; break; +#ifdef BFD64 + case 8: code = BFD_RELOC_64_PCREL; break; +#endif } } else @@ -5204,14 +5815,22 @@ tc_gen_reloc (section, fixp) break; } - if (code == BFD_RELOC_32 + if ((code == BFD_RELOC_32 + || code == BFD_RELOC_32_PCREL + || code == BFD_RELOC_X86_64_32S) && GOT_symbol && fixp->fx_addsy == GOT_symbol) { - /* We don't support GOTPC on 64bit targets. */ - if (flag_code == CODE_64BIT) - abort (); - code = BFD_RELOC_386_GOTPC; + if (!object_64bit) + code = BFD_RELOC_386_GOTPC; + else + code = BFD_RELOC_X86_64_GOTPC32; + } + if ((code == BFD_RELOC_64 || code == BFD_RELOC_64_PCREL) + && GOT_symbol + && fixp->fx_addsy == GOT_symbol) + { + code = BFD_RELOC_X86_64_GOTPC64; } rel = (arelent *) xmalloc (sizeof (arelent)); @@ -5219,6 +5838,7 @@ tc_gen_reloc (section, fixp) *rel->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy); rel->address = fixp->fx_frag->fr_address + fixp->fx_where; + if (!use_rela_relocations) { /* HACK: Since i386 ELF uses Rel instead of Rela, encode the @@ -5242,6 +5862,8 @@ tc_gen_reloc (section, fixp) case BFD_RELOC_X86_64_TLSGD: case BFD_RELOC_X86_64_TLSLD: case BFD_RELOC_X86_64_GOTTPOFF: + case BFD_RELOC_X86_64_GOTPC32_TLSDESC: + case BFD_RELOC_X86_64_TLSDESC_CALL: rel->addend = fixp->fx_offset - fixp->fx_size; break; default: @@ -5287,11 +5909,13 @@ tc_gen_reloc (section, fixp) alpha [a-zA-Z] + binOp & | AND | \| | OR | ^ | XOR + byteRegister AL | AH | BL | BH | CL | CH | DL | DH constant digits [[ radixOverride ]] - dataType BYTE | WORD | DWORD | QWORD | XWORD + dataType BYTE | WORD | DWORD | FWORD | QWORD | TBYTE | OWORD | XMMWORD digits decdigit | digits decdigit @@ -5299,13 +5923,21 @@ tc_gen_reloc (section, fixp) decdigit [0-9] - e05 e05 addOp e06 + e04 e04 addOp e05 + | e05 + + e05 e05 binOp e06 | e06 e06 e06 mulOp e09 | e09 e09 OFFSET e10 + | SHORT e10 + | + e10 + | - e10 + | ~ e10 + | NOT e10 | e09 PTR e10 | e09 : e10 | e10 @@ -5321,8 +5953,8 @@ tc_gen_reloc (section, fixp) | $ | register - => expr SHORT e05 - | e05 + => expr expr cmpOp e04 + | e04 gpRegister AX | EAX | BX | EBX | CX | ECX | DX | EDX | BP | EBP | SP | ESP | DI | EDI | SI | ESI @@ -5334,7 +5966,7 @@ tc_gen_reloc (section, fixp) | id alpha | id decdigit - mulOp * | / | MOD + mulOp * | / | % | MOD | << | SHL | >> | SHR quote " | ' @@ -5344,7 +5976,7 @@ tc_gen_reloc (section, fixp) segmentRegister CS | DS | ES | FS | GS | SS - specialRegister CR0 | CR2 | CR3 + specialRegister CR0 | CR2 | CR3 | CR4 | DR0 | DR1 | DR2 | DR3 | DR6 | DR7 | TR3 | TR4 | TR5 | TR6 | TR7 @@ -5352,12 +5984,19 @@ tc_gen_reloc (section, fixp) done by calling parse_register) and eliminate immediate left recursion to implement a recursive-descent parser. - expr SHORT e05 - | e05 + expr e04 expr' + + expr' cmpOp e04 expr' + | Empty + + e04 e05 e04' + + e04' addOp e05 e04' + | Empty e05 e06 e05' - e05' addOp e06 e05' + e05' binOp e06 e05' | Empty e06 e09 e06' @@ -5366,6 +6005,11 @@ tc_gen_reloc (section, fixp) | Empty e09 OFFSET e10 e09' + | SHORT e10' + | + e10' + | - e10' + | ~ e10' + | NOT e10' | e10 e09' e09' PTR e10 e09' @@ -5382,8 +6026,11 @@ tc_gen_reloc (section, fixp) | BYTE | WORD | DWORD + | FWORD | QWORD - | XWORD + | TBYTE + | OWORD + | XMMWORD | . | $ | register @@ -5398,8 +6045,11 @@ struct intel_parser_s int got_a_float; /* Whether the operand is a float. */ int op_modifier; /* Operand modifier. */ int is_mem; /* 1 if operand is memory reference. */ + int in_offset; /* >=1 if parsing operand of offset. */ + int in_bracket; /* >=1 if parsing operand in brackets. */ const reg_entry *reg; /* Last register reference found. */ char *disp; /* Displacement string being built. */ + char *next_operand; /* Resume point when splitting operands. */ }; static struct intel_parser_s intel_parser; @@ -5421,28 +6071,30 @@ static struct intel_token cur_token, prev_token; #define T_REG 2 #define T_BYTE 3 #define T_WORD 4 -#define T_DWORD 5 -#define T_QWORD 6 -#define T_XWORD 7 +#define T_DWORD 5 +#define T_FWORD 6 +#define T_QWORD 7 +#define T_TBYTE 8 +#define T_XMMWORD 9 #undef T_SHORT -#define T_SHORT 8 -#define T_OFFSET 9 -#define T_PTR 10 -#define T_ID 11 +#define T_SHORT 10 +#define T_OFFSET 11 +#define T_PTR 12 +#define T_ID 13 +#define T_SHL 14 +#define T_SHR 15 /* Prototypes for intel parser functions. */ static int intel_match_token PARAMS ((int code)); static void intel_get_token PARAMS ((void)); static void intel_putback_token PARAMS ((void)); static int intel_expr PARAMS ((void)); +static int intel_e04 PARAMS ((void)); static int intel_e05 PARAMS ((void)); -static int intel_e05_1 PARAMS ((void)); static int intel_e06 PARAMS ((void)); -static int intel_e06_1 PARAMS ((void)); static int intel_e09 PARAMS ((void)); -static int intel_e09_1 PARAMS ((void)); +static int intel_bracket_expr PARAMS ((void)); static int intel_e10 PARAMS ((void)); -static int intel_e10_1 PARAMS ((void)); static int intel_e11 PARAMS ((void)); static int @@ -5453,34 +6105,42 @@ i386_intel_operand (operand_string, got_a_float) int ret; char *p; - /* Initialize token holders. */ - cur_token.code = prev_token.code = T_NIL; - cur_token.reg = prev_token.reg = NULL; - cur_token.str = prev_token.str = NULL; + p = intel_parser.op_string = xstrdup (operand_string); + intel_parser.disp = (char *) xmalloc (strlen (operand_string) + 1); - /* Initialize parser structure. */ - p = intel_parser.op_string = (char *) malloc (strlen (operand_string) + 1); - if (p == NULL) - abort (); - strcpy (intel_parser.op_string, operand_string); - intel_parser.got_a_float = got_a_float; - intel_parser.op_modifier = -1; - intel_parser.is_mem = 0; - intel_parser.reg = NULL; - intel_parser.disp = (char *) malloc (strlen (operand_string) + 1); - if (intel_parser.disp == NULL) - abort (); - intel_parser.disp[0] = '\0'; - - /* Read the first token and start the parser. */ - intel_get_token (); - ret = intel_expr (); - - if (ret) + for (;;) { + /* Initialize token holders. */ + cur_token.code = prev_token.code = T_NIL; + cur_token.reg = prev_token.reg = NULL; + cur_token.str = prev_token.str = NULL; + + /* Initialize parser structure. */ + intel_parser.got_a_float = got_a_float; + intel_parser.op_modifier = 0; + intel_parser.is_mem = 0; + intel_parser.in_offset = 0; + intel_parser.in_bracket = 0; + intel_parser.reg = NULL; + intel_parser.disp[0] = '\0'; + intel_parser.next_operand = NULL; + + /* Read the first token and start the parser. */ + intel_get_token (); + ret = intel_expr (); + + if (!ret) + break; + + if (cur_token.code != T_NIL) + { + as_bad (_("invalid operand for '%s' ('%s' unexpected)"), + current_templates->start->name, cur_token.str); + ret = 0; + } /* If we found a memory reference, hand it over to i386_displacement to fill in the rest of the operand fields. */ - if (intel_parser.is_mem) + else if (intel_parser.is_mem) { if ((i.mem_operands == 1 && (current_templates->start->opcode_modifier & IsString) == 0) @@ -5495,18 +6155,46 @@ i386_intel_operand (operand_string, got_a_float) char *s = intel_parser.disp; i.mem_operands++; + if (!quiet_warnings && intel_parser.is_mem < 0) + /* See the comments in intel_bracket_expr. */ + as_warn (_("Treating `%s' as memory reference"), operand_string); + /* Add the displacement expression. */ if (*s != '\0') ret = i386_displacement (s, s + strlen (s)); if (ret) - ret = i386_index_check (operand_string); + { + /* Swap base and index in 16-bit memory operands like + [si+bx]. Since i386_index_check is also used in AT&T + mode we have to do that here. */ + if (i.base_reg + && i.index_reg + && (i.base_reg->reg_type & Reg16) + && (i.index_reg->reg_type & Reg16) + && i.base_reg->reg_num >= 6 + && i.index_reg->reg_num < 6) + { + const reg_entry *base = i.index_reg; + + i.index_reg = i.base_reg; + i.base_reg = base; + } + ret = i386_index_check (operand_string); + } } } /* Constant and OFFSET expressions are handled by i386_immediate. */ - else if (intel_parser.op_modifier == OFFSET_FLAT + else if ((intel_parser.op_modifier & (1 << T_OFFSET)) || intel_parser.reg == NULL) ret = i386_immediate (intel_parser.disp); + + if (intel_parser.next_operand && this_operand >= MAX_OPERANDS - 1) + ret = 0; + if (!ret || !intel_parser.next_operand) + break; + intel_parser.op_string = intel_parser.next_operand; + this_operand = i.operands++; } free (p); @@ -5515,50 +6203,81 @@ i386_intel_operand (operand_string, got_a_float) return ret; } -/* expr SHORT e05 - | e05 */ +#define NUM_ADDRESS_REGS (!!i.base_reg + !!i.index_reg) + +/* expr e04 expr' + + expr' cmpOp e04 expr' + | Empty */ static int intel_expr () { - /* expr SHORT e05 */ - if (cur_token.code == T_SHORT) + /* XXX Implement the comparison operators. */ + return intel_e04 (); +} + +/* e04 e05 e04' + + e04' addOp e05 e04' + | Empty */ +static int +intel_e04 () +{ + int nregs = -1; + + for (;;) { - intel_parser.op_modifier = SHORT; - intel_match_token (T_SHORT); + if (!intel_e05()) + return 0; - return (intel_e05 ()); + if (nregs >= 0 && NUM_ADDRESS_REGS > nregs) + i.base_reg = i386_regtab + REGNAM_AL; /* al is invalid as base */ + + if (cur_token.code == '+') + nregs = -1; + else if (cur_token.code == '-') + nregs = NUM_ADDRESS_REGS; + else + return 1; + + strcat (intel_parser.disp, cur_token.str); + intel_match_token (cur_token.code); } - - /* expr e05 */ - else - return intel_e05 (); } /* e05 e06 e05' - e05' addOp e06 e05' + e05' binOp e06 e05' | Empty */ static int intel_e05 () { - return (intel_e06 () && intel_e05_1 ()); -} + int nregs = ~NUM_ADDRESS_REGS; -static int -intel_e05_1 () -{ - /* e05' addOp e06 e05' */ - if (cur_token.code == '+' || cur_token.code == '-') + for (;;) { - strcat (intel_parser.disp, cur_token.str); + if (!intel_e06()) + return 0; + + if (cur_token.code == '&' || cur_token.code == '|' || cur_token.code == '^') + { + char str[2]; + + str[0] = cur_token.code; + str[1] = 0; + strcat (intel_parser.disp, str); + } + else + break; + intel_match_token (cur_token.code); - return (intel_e06 () && intel_e05_1 ()); + if (nregs < 0) + nregs = ~nregs; } - - /* e05' Empty */ - else - return 1; + if (nregs >= 0 && NUM_ADDRESS_REGS > nregs) + i.base_reg = i386_regtab + REGNAM_AL + 1; /* cl is invalid as base */ + return 1; } /* e06 e09 e06' @@ -5568,27 +6287,44 @@ intel_e05_1 () static int intel_e06 () { - return (intel_e09 () && intel_e06_1 ()); -} + int nregs = ~NUM_ADDRESS_REGS; -static int -intel_e06_1 () -{ - /* e06' mulOp e09 e06' */ - if (cur_token.code == '*' || cur_token.code == '/') + for (;;) { - strcat (intel_parser.disp, cur_token.str); - intel_match_token (cur_token.code); + if (!intel_e09()) + return 0; - return (intel_e09 () && intel_e06_1 ()); + if (cur_token.code == '*' || cur_token.code == '/' || cur_token.code == '%') + { + char str[2]; + + str[0] = cur_token.code; + str[1] = 0; + strcat (intel_parser.disp, str); + } + else if (cur_token.code == T_SHL) + strcat (intel_parser.disp, "<<"); + else if (cur_token.code == T_SHR) + strcat (intel_parser.disp, ">>"); + else + break; + + intel_match_token (cur_token.code); + + if (nregs < 0) + nregs = ~nregs; } - - /* e06' Empty */ - else - return 1; + if (nregs >= 0 && NUM_ADDRESS_REGS > nregs) + i.base_reg = i386_regtab + REGNAM_AL + 2; /* dl is invalid as base */ + return 1; } -/* e09 OFFSET e10 e09' +/* e09 OFFSET e09 + | SHORT e09 + | + e09 + | - e09 + | ~ e09 + | NOT e09 | e10 e09' e09' PTR e10 e09' @@ -5597,82 +6333,287 @@ intel_e06_1 () static int intel_e09 () { - /* e09 OFFSET e10 e09' */ - if (cur_token.code == T_OFFSET) - { - intel_parser.is_mem = 0; - intel_parser.op_modifier = OFFSET_FLAT; - intel_match_token (T_OFFSET); + int nregs = ~NUM_ADDRESS_REGS; + int in_offset = 0; - return (intel_e10 () && intel_e09_1 ()); + for (;;) + { + /* Don't consume constants here. */ + if (cur_token.code == '+' || cur_token.code == '-') + { + /* Need to look one token ahead - if the next token + is a constant, the current token is its sign. */ + int next_code; + + intel_match_token (cur_token.code); + next_code = cur_token.code; + intel_putback_token (); + if (next_code == T_CONST) + break; + } + + /* e09 OFFSET e09 */ + if (cur_token.code == T_OFFSET) + { + if (!in_offset++) + ++intel_parser.in_offset; + } + + /* e09 SHORT e09 */ + else if (cur_token.code == T_SHORT) + intel_parser.op_modifier |= 1 << T_SHORT; + + /* e09 + e09 */ + else if (cur_token.code == '+') + strcat (intel_parser.disp, "+"); + + /* e09 - e09 + | ~ e09 + | NOT e09 */ + else if (cur_token.code == '-' || cur_token.code == '~') + { + char str[2]; + + if (nregs < 0) + nregs = ~nregs; + str[0] = cur_token.code; + str[1] = 0; + strcat (intel_parser.disp, str); + } + + /* e09 e10 e09' */ + else + break; + + intel_match_token (cur_token.code); } - /* e09 e10 e09' */ - else - return (intel_e10 () && intel_e09_1 ()); + for (;;) + { + if (!intel_e10 ()) + return 0; + + /* e09' PTR e10 e09' */ + if (cur_token.code == T_PTR) + { + char suffix; + + if (prev_token.code == T_BYTE) + suffix = BYTE_MNEM_SUFFIX; + + else if (prev_token.code == T_WORD) + { + if (current_templates->start->name[0] == 'l' + && current_templates->start->name[2] == 's' + && current_templates->start->name[3] == 0) + suffix = BYTE_MNEM_SUFFIX; /* so it will cause an error */ + else if (intel_parser.got_a_float == 2) /* "fi..." */ + suffix = SHORT_MNEM_SUFFIX; + else + suffix = WORD_MNEM_SUFFIX; + } + + else if (prev_token.code == T_DWORD) + { + if (current_templates->start->name[0] == 'l' + && current_templates->start->name[2] == 's' + && current_templates->start->name[3] == 0) + suffix = WORD_MNEM_SUFFIX; + else if (flag_code == CODE_16BIT + && (current_templates->start->opcode_modifier + & (Jump | JumpDword))) + suffix = LONG_DOUBLE_MNEM_SUFFIX; + else if (intel_parser.got_a_float == 1) /* "f..." */ + suffix = SHORT_MNEM_SUFFIX; + else + suffix = LONG_MNEM_SUFFIX; + } + + else if (prev_token.code == T_FWORD) + { + if (current_templates->start->name[0] == 'l' + && current_templates->start->name[2] == 's' + && current_templates->start->name[3] == 0) + suffix = LONG_MNEM_SUFFIX; + else if (!intel_parser.got_a_float) + { + if (flag_code == CODE_16BIT) + add_prefix (DATA_PREFIX_OPCODE); + suffix = LONG_DOUBLE_MNEM_SUFFIX; + } + else + suffix = BYTE_MNEM_SUFFIX; /* so it will cause an error */ + } + + else if (prev_token.code == T_QWORD) + { + if (intel_parser.got_a_float == 1) /* "f..." */ + suffix = LONG_MNEM_SUFFIX; + else + suffix = QWORD_MNEM_SUFFIX; + } + + else if (prev_token.code == T_TBYTE) + { + if (intel_parser.got_a_float == 1) + suffix = LONG_DOUBLE_MNEM_SUFFIX; + else + suffix = BYTE_MNEM_SUFFIX; /* so it will cause an error */ + } + + else if (prev_token.code == T_XMMWORD) + { + /* XXX ignored for now, but accepted since gcc uses it */ + suffix = 0; + } + + else + { + as_bad (_("Unknown operand modifier `%s'"), prev_token.str); + return 0; + } + + /* Operands for jump/call using 'ptr' notation denote absolute + addresses. */ + if (current_templates->start->opcode_modifier & (Jump | JumpDword)) + i.types[this_operand] |= JumpAbsolute; + + if (current_templates->start->base_opcode == 0x8d /* lea */) + ; + else if (!i.suffix) + i.suffix = suffix; + else if (i.suffix != suffix) + { + as_bad (_("Conflicting operand modifiers")); + return 0; + } + + } + + /* e09' : e10 e09' */ + else if (cur_token.code == ':') + { + if (prev_token.code != T_REG) + { + /* While {call,jmp} SSSS:OOOO is MASM syntax only when SSSS is a + segment/group identifier (which we don't have), using comma + as the operand separator there is even less consistent, since + there all branches only have a single operand. */ + if (this_operand != 0 + || intel_parser.in_offset + || intel_parser.in_bracket + || (!(current_templates->start->opcode_modifier + & (Jump|JumpDword|JumpInterSegment)) + && !(current_templates->start->operand_types[0] + & JumpAbsolute))) + return intel_match_token (T_NIL); + /* Remember the start of the 2nd operand and terminate 1st + operand here. + XXX This isn't right, yet (when SSSS:OOOO is right operand of + another expression), but it gets at least the simplest case + (a plain number or symbol on the left side) right. */ + intel_parser.next_operand = intel_parser.op_string; + *--intel_parser.op_string = '\0'; + return intel_match_token (':'); + } + } + + /* e09' Empty */ + else + break; + + intel_match_token (cur_token.code); + + } + + if (in_offset) + { + --intel_parser.in_offset; + if (nregs < 0) + nregs = ~nregs; + if (NUM_ADDRESS_REGS > nregs) + { + as_bad (_("Invalid operand to `OFFSET'")); + return 0; + } + intel_parser.op_modifier |= 1 << T_OFFSET; + } + + if (nregs >= 0 && NUM_ADDRESS_REGS > nregs) + i.base_reg = i386_regtab + REGNAM_AL + 3; /* bl is invalid as base */ + return 1; } static int -intel_e09_1 () +intel_bracket_expr () { - /* e09' PTR e10 e09' */ - if (cur_token.code == T_PTR) + int was_offset = intel_parser.op_modifier & (1 << T_OFFSET); + const char *start = intel_parser.op_string; + int len; + + if (i.op[this_operand].regs) + return intel_match_token (T_NIL); + + intel_match_token ('['); + + /* Mark as a memory operand only if it's not already known to be an + offset expression. If it's an offset expression, we need to keep + the brace in. */ + if (!intel_parser.in_offset) { - if (prev_token.code == T_BYTE) - i.suffix = BYTE_MNEM_SUFFIX; + ++intel_parser.in_bracket; - else if (prev_token.code == T_WORD) - { - if (intel_parser.got_a_float == 2) /* "fi..." */ - i.suffix = SHORT_MNEM_SUFFIX; - else - i.suffix = WORD_MNEM_SUFFIX; - } + /* Operands for jump/call inside brackets denote absolute addresses. */ + if (current_templates->start->opcode_modifier & (Jump | JumpDword)) + i.types[this_operand] |= JumpAbsolute; - else if (prev_token.code == T_DWORD) - { - if (intel_parser.got_a_float == 1) /* "f..." */ - i.suffix = SHORT_MNEM_SUFFIX; - else - i.suffix = LONG_MNEM_SUFFIX; - } + /* Unfortunately gas always diverged from MASM in a respect that can't + be easily fixed without risking to break code sequences likely to be + encountered (the testsuite even check for this): MASM doesn't consider + an expression inside brackets unconditionally as a memory reference. + When that is e.g. a constant, an offset expression, or the sum of the + two, this is still taken as a constant load. gas, however, always + treated these as memory references. As a compromise, we'll try to make + offset expressions inside brackets work the MASM way (since that's + less likely to be found in real world code), but make constants alone + continue to work the traditional gas way. In either case, issue a + warning. */ + intel_parser.op_modifier &= ~was_offset; + } + else + strcat (intel_parser.disp, "["); - else if (prev_token.code == T_QWORD) - { - if (intel_parser.got_a_float == 1) /* "f..." */ - i.suffix = LONG_MNEM_SUFFIX; - else - i.suffix = QWORD_MNEM_SUFFIX; - } - - else if (prev_token.code == T_XWORD) - i.suffix = LONG_DOUBLE_MNEM_SUFFIX; + /* Add a '+' to the displacement string if necessary. */ + if (*intel_parser.disp != '\0' + && *(intel_parser.disp + strlen (intel_parser.disp) - 1) != '+') + strcat (intel_parser.disp, "+"); + if (intel_expr () + && (len = intel_parser.op_string - start - 1, + intel_match_token (']'))) + { + /* Preserve brackets when the operand is an offset expression. */ + if (intel_parser.in_offset) + strcat (intel_parser.disp, "]"); else { - as_bad (_("Unknown operand modifier `%s'\n"), prev_token.str); - return 0; + --intel_parser.in_bracket; + if (i.base_reg || i.index_reg) + intel_parser.is_mem = 1; + if (!intel_parser.is_mem) + { + if (!(intel_parser.op_modifier & (1 << T_OFFSET))) + /* Defer the warning until all of the operand was parsed. */ + intel_parser.is_mem = -1; + else if (!quiet_warnings) + as_warn (_("`[%.*s]' taken to mean just `%.*s'"), len, start, len, start); + } } + intel_parser.op_modifier |= was_offset; - intel_match_token (T_PTR); - - return (intel_e10 () && intel_e09_1 ()); + return 1; } - - /* e09 : e10 e09' */ - else if (cur_token.code == ':') - { - /* Mark as a memory operand only if it's not already known to be an - offset expression. */ - if (intel_parser.op_modifier != OFFSET_FLAT) - intel_parser.is_mem = 1; - - return (intel_match_token (':') && intel_e10 () && intel_e09_1 ()); - } - - /* e09' Empty */ - else - return 1; + return 0; } /* e10 e11 e10' @@ -5682,45 +6623,16 @@ intel_e09_1 () static int intel_e10 () { - return (intel_e11 () && intel_e10_1 ()); -} + if (!intel_e11 ()) + return 0; -static int -intel_e10_1 () -{ - /* e10' [ expr ] e10' */ - if (cur_token.code == '[') + while (cur_token.code == '[') { - intel_match_token ('['); - - /* Mark as a memory operand only if it's not already known to be an - offset expression. If it's an offset expression, we need to keep - the brace in. */ - if (intel_parser.op_modifier != OFFSET_FLAT) - intel_parser.is_mem = 1; - else - strcat (intel_parser.disp, "["); - - /* Add a '+' to the displacement string if necessary. */ - if (*intel_parser.disp != '\0' - && *(intel_parser.disp + strlen (intel_parser.disp) - 1) != '+') - strcat (intel_parser.disp, "+"); - - if (intel_expr () && intel_match_token (']')) - { - /* Preserve brackets when the operand is an offset expression. */ - if (intel_parser.op_modifier == OFFSET_FLAT) - strcat (intel_parser.disp, "]"); - - return intel_e10_1 (); - } - else + if (!intel_bracket_expr ()) return 0; } - /* e10' Empty */ - else - return 1; + return 1; } /* e11 ( expr ) @@ -5728,8 +6640,11 @@ intel_e10_1 () | BYTE | WORD | DWORD + | FWORD | QWORD - | XWORD + | TBYTE + | OWORD + | XMMWORD | $ | . | register @@ -5738,9 +6653,10 @@ intel_e10_1 () static int intel_e11 () { - /* e11 ( expr ) */ - if (cur_token.code == '(') + switch (cur_token.code) { + /* e11 ( expr ) */ + case '(': intel_match_token ('('); strcat (intel_parser.disp, "("); @@ -5749,292 +6665,284 @@ intel_e11 () strcat (intel_parser.disp, ")"); return 1; } - else - return 0; - } + return 0; - /* e11 [ expr ] */ - else if (cur_token.code == '[') - { - intel_match_token ('['); + /* e11 [ expr ] */ + case '[': + return intel_bracket_expr (); - /* Mark as a memory operand only if it's not already known to be an - offset expression. If it's an offset expression, we need to keep - the brace in. */ - if (intel_parser.op_modifier != OFFSET_FLAT) - intel_parser.is_mem = 1; - else - strcat (intel_parser.disp, "["); - - /* Operands for jump/call inside brackets denote absolute addresses. */ - if (current_templates->start->opcode_modifier & Jump - || current_templates->start->opcode_modifier & JumpDword - || current_templates->start->opcode_modifier & JumpByte - || current_templates->start->opcode_modifier & JumpInterSegment) - i.types[this_operand] |= JumpAbsolute; - - /* Add a '+' to the displacement string if necessary. */ - if (*intel_parser.disp != '\0' - && *(intel_parser.disp + strlen (intel_parser.disp) - 1) != '+') - strcat (intel_parser.disp, "+"); - - if (intel_expr () && intel_match_token (']')) - { - /* Preserve brackets when the operand is an offset expression. */ - if (intel_parser.op_modifier == OFFSET_FLAT) - strcat (intel_parser.disp, "]"); - - return 1; - } - else - return 0; - } - - /* e11 BYTE - | WORD - | DWORD - | QWORD - | XWORD */ - else if (cur_token.code == T_BYTE - || cur_token.code == T_WORD - || cur_token.code == T_DWORD - || cur_token.code == T_QWORD - || cur_token.code == T_XWORD) - { - intel_match_token (cur_token.code); - - return 1; - } - - /* e11 $ - | . */ - else if (cur_token.code == '$' || cur_token.code == '.') - { + /* e11 $ + | . */ + case '.': strcat (intel_parser.disp, cur_token.str); intel_match_token (cur_token.code); /* Mark as a memory operand only if it's not already known to be an offset expression. */ - if (intel_parser.op_modifier != OFFSET_FLAT) + if (!intel_parser.in_offset) intel_parser.is_mem = 1; return 1; - } - /* e11 register */ - else if (cur_token.code == T_REG) - { - const reg_entry *reg = intel_parser.reg = cur_token.reg; + /* e11 register */ + case T_REG: + { + const reg_entry *reg = intel_parser.reg = cur_token.reg; - intel_match_token (T_REG); + intel_match_token (T_REG); - /* Check for segment change. */ - if (cur_token.code == ':') - { - if (reg->reg_type & (SReg2 | SReg3)) - { - switch (reg->reg_num) - { - case 0: - i.seg[i.mem_operands] = &es; - break; - case 1: - i.seg[i.mem_operands] = &cs; - break; - case 2: - i.seg[i.mem_operands] = &ss; - break; - case 3: - i.seg[i.mem_operands] = &ds; - break; - case 4: - i.seg[i.mem_operands] = &fs; - break; - case 5: - i.seg[i.mem_operands] = &gs; - break; - } - } - else - { - as_bad (_("`%s' is not a valid segment register"), reg->reg_name); - return 0; - } - } + /* Check for segment change. */ + if (cur_token.code == ':') + { + if (!(reg->reg_type & (SReg2 | SReg3))) + { + as_bad (_("`%s' is not a valid segment register"), reg->reg_name); + return 0; + } + else if (i.seg[i.mem_operands]) + as_warn (_("Extra segment override ignored")); + else + { + if (!intel_parser.in_offset) + intel_parser.is_mem = 1; + switch (reg->reg_num) + { + case 0: + i.seg[i.mem_operands] = &es; + break; + case 1: + i.seg[i.mem_operands] = &cs; + break; + case 2: + i.seg[i.mem_operands] = &ss; + break; + case 3: + i.seg[i.mem_operands] = &ds; + break; + case 4: + i.seg[i.mem_operands] = &fs; + break; + case 5: + i.seg[i.mem_operands] = &gs; + break; + } + } + } - /* Not a segment register. Check for register scaling. */ - else if (cur_token.code == '*') - { - if (!intel_parser.is_mem) - { - as_bad (_("Register scaling only allowed in memory operands.")); - return 0; - } + /* Not a segment register. Check for register scaling. */ + else if (cur_token.code == '*') + { + if (!intel_parser.in_bracket) + { + as_bad (_("Register scaling only allowed in memory operands")); + return 0; + } - /* What follows must be a valid scale. */ - if (intel_match_token ('*') - && strchr ("01248", *cur_token.str)) - { - i.index_reg = reg; - i.types[this_operand] |= BaseIndex; + if (reg->reg_type & Reg16) /* Disallow things like [si*1]. */ + reg = i386_regtab + REGNAM_AX + 4; /* sp is invalid as index */ + else if (i.index_reg) + reg = i386_regtab + REGNAM_EAX + 4; /* esp is invalid as index */ - /* Set the scale after setting the register (otherwise, - i386_scale will complain) */ - i386_scale (cur_token.str); - intel_match_token (T_CONST); - } - else - { - as_bad (_("expecting scale factor of 1, 2, 4, or 8: got `%s'"), - cur_token.str); - return 0; - } - } - - /* No scaling. If this is a memory operand, the register is either a - base register (first occurrence) or an index register (second - occurrence). */ - else if (intel_parser.is_mem && !(reg->reg_type & (SReg2 | SReg3))) - { - if (i.base_reg && i.index_reg) - { - as_bad (_("Too many register references in memory operand.\n")); - return 0; - } - - if (i.base_reg == NULL) - i.base_reg = reg; - else + /* What follows must be a valid scale. */ + intel_match_token ('*'); i.index_reg = reg; + i.types[this_operand] |= BaseIndex; - i.types[this_operand] |= BaseIndex; - } - - /* Offset modifier. Add the register to the displacement string to be - parsed as an immediate expression after we're done. */ - else if (intel_parser.op_modifier == OFFSET_FLAT) - strcat (intel_parser.disp, reg->reg_name); - - /* It's neither base nor index nor offset. */ - else - { - i.types[this_operand] |= reg->reg_type & ~BaseIndex; - i.op[this_operand].regs = reg; - i.reg_operands++; - } - - /* Since registers are not part of the displacement string (except - when we're parsing offset operands), we may need to remove any - preceding '+' from the displacement string. */ - if (*intel_parser.disp != '\0' - && intel_parser.op_modifier != OFFSET_FLAT) - { - char *s = intel_parser.disp; - s += strlen (s) - 1; - if (*s == '+') - *s = '\0'; - } - - return 1; - } - - /* e11 id */ - else if (cur_token.code == T_ID) - { - /* Add the identifier to the displacement string. */ - strcat (intel_parser.disp, cur_token.str); - intel_match_token (T_ID); - - /* The identifier represents a memory reference only if it's not - preceded by an offset modifier. */ - if (intel_parser.op_modifier != OFFSET_FLAT) - intel_parser.is_mem = 1; - - return 1; - } - - /* e11 constant */ - else if (cur_token.code == T_CONST - || cur_token.code == '-' - || cur_token.code == '+') - { - char *save_str; - - /* Allow constants that start with `+' or `-'. */ - if (cur_token.code == '-' || cur_token.code == '+') - { - strcat (intel_parser.disp, cur_token.str); - intel_match_token (cur_token.code); - if (cur_token.code != T_CONST) - { - as_bad (_("Syntax error. Expecting a constant. Got `%s'.\n"), - cur_token.str); + /* Set the scale after setting the register (otherwise, + i386_scale will complain) */ + if (cur_token.code == '+' || cur_token.code == '-') + { + char *str, sign = cur_token.code; + intel_match_token (cur_token.code); + if (cur_token.code != T_CONST) + { + as_bad (_("Syntax error: Expecting a constant, got `%s'"), + cur_token.str); + return 0; + } + str = (char *) xmalloc (strlen (cur_token.str) + 2); + strcpy (str + 1, cur_token.str); + *str = sign; + if (!i386_scale (str)) + return 0; + free (str); + } + else if (!i386_scale (cur_token.str)) return 0; - } - } + intel_match_token (cur_token.code); + } - save_str = (char *) malloc (strlen (cur_token.str) + 1); - if (save_str == NULL) - abort (); - strcpy (save_str, cur_token.str); + /* No scaling. If this is a memory operand, the register is either a + base register (first occurrence) or an index register (second + occurrence). */ + else if (intel_parser.in_bracket) + { - /* Get the next token to check for register scaling. */ + if (!i.base_reg) + i.base_reg = reg; + else if (!i.index_reg) + i.index_reg = reg; + else + { + as_bad (_("Too many register references in memory operand")); + return 0; + } + + i.types[this_operand] |= BaseIndex; + } + + /* It's neither base nor index. */ + else if (!intel_parser.in_offset && !intel_parser.is_mem) + { + i.types[this_operand] |= reg->reg_type & ~BaseIndex; + i.op[this_operand].regs = reg; + i.reg_operands++; + } + else + { + as_bad (_("Invalid use of register")); + return 0; + } + + /* Since registers are not part of the displacement string (except + when we're parsing offset operands), we may need to remove any + preceding '+' from the displacement string. */ + if (*intel_parser.disp != '\0' + && !intel_parser.in_offset) + { + char *s = intel_parser.disp; + s += strlen (s) - 1; + if (*s == '+') + *s = '\0'; + } + + return 1; + } + + /* e11 BYTE + | WORD + | DWORD + | FWORD + | QWORD + | TBYTE + | OWORD + | XMMWORD */ + case T_BYTE: + case T_WORD: + case T_DWORD: + case T_FWORD: + case T_QWORD: + case T_TBYTE: + case T_XMMWORD: intel_match_token (cur_token.code); - /* Check if this constant is a scaling factor for an index register. */ - if (cur_token.code == '*') + if (cur_token.code == T_PTR) + return 1; + + /* It must have been an identifier. */ + intel_putback_token (); + cur_token.code = T_ID; + /* FALLTHRU */ + + /* e11 id + | constant */ + case T_ID: + if (!intel_parser.in_offset && intel_parser.is_mem <= 0) { - if (intel_match_token ('*') && cur_token.code == T_REG) - { - if (!intel_parser.is_mem) - { - as_bad (_("Register scaling only allowed in memory operands.")); - return 0; - } + symbolS *symbolP; - /* The constant is followed by `* reg', so it must be - a valid scale. */ - if (strchr ("01248", *save_str)) - { - i.index_reg = cur_token.reg; - i.types[this_operand] |= BaseIndex; - - /* Set the scale after setting the register (otherwise, - i386_scale will complain) */ - i386_scale (save_str); - intel_match_token (T_REG); - - /* Since registers are not part of the displacement - string, we may need to remove any preceding '+' from - the displacement string. */ - if (*intel_parser.disp != '\0') - { - char *s = intel_parser.disp; - s += strlen (s) - 1; - if (*s == '+') - *s = '\0'; - } - - free (save_str); - - return 1; - } - else - return 0; - } - - /* The constant was not used for register scaling. Since we have - already consumed the token following `*' we now need to put it - back in the stream. */ - else - intel_putback_token (); + /* The identifier represents a memory reference only if it's not + preceded by an offset modifier and if it's not an equate. */ + symbolP = symbol_find(cur_token.str); + if (!symbolP || S_GET_SEGMENT(symbolP) != absolute_section) + intel_parser.is_mem = 1; } + /* FALLTHRU */ - /* Add the constant to the displacement string. */ - strcat (intel_parser.disp, save_str); - free (save_str); + case T_CONST: + case '-': + case '+': + { + char *save_str, sign = 0; - return 1; + /* Allow constants that start with `+' or `-'. */ + if (cur_token.code == '-' || cur_token.code == '+') + { + sign = cur_token.code; + intel_match_token (cur_token.code); + if (cur_token.code != T_CONST) + { + as_bad (_("Syntax error: Expecting a constant, got `%s'"), + cur_token.str); + return 0; + } + } + + save_str = (char *) xmalloc (strlen (cur_token.str) + 2); + strcpy (save_str + !!sign, cur_token.str); + if (sign) + *save_str = sign; + + /* Get the next token to check for register scaling. */ + intel_match_token (cur_token.code); + + /* Check if this constant is a scaling factor for an index register. */ + if (cur_token.code == '*') + { + if (intel_match_token ('*') && cur_token.code == T_REG) + { + const reg_entry *reg = cur_token.reg; + + if (!intel_parser.in_bracket) + { + as_bad (_("Register scaling only allowed in memory operands")); + return 0; + } + + if (reg->reg_type & Reg16) /* Disallow things like [1*si]. */ + reg = i386_regtab + REGNAM_AX + 4; /* sp is invalid as index */ + else if (i.index_reg) + reg = i386_regtab + REGNAM_EAX + 4; /* esp is invalid as index */ + + /* The constant is followed by `* reg', so it must be + a valid scale. */ + i.index_reg = reg; + i.types[this_operand] |= BaseIndex; + + /* Set the scale after setting the register (otherwise, + i386_scale will complain) */ + if (!i386_scale (save_str)) + return 0; + intel_match_token (T_REG); + + /* Since registers are not part of the displacement + string, we may need to remove any preceding '+' from + the displacement string. */ + if (*intel_parser.disp != '\0') + { + char *s = intel_parser.disp; + s += strlen (s) - 1; + if (*s == '+') + *s = '\0'; + } + + free (save_str); + + return 1; + } + + /* The constant was not used for register scaling. Since we have + already consumed the token following `*' we now need to put it + back in the stream. */ + intel_putback_token (); + } + + /* Add the constant to the displacement string. */ + strcat (intel_parser.disp, save_str); + free (save_str); + + return 1; + } } as_bad (_("Unrecognized token '%s'"), cur_token.str); @@ -6054,7 +6962,7 @@ intel_match_token (code) } else { - as_bad (_("Unexpected token `%s'\n"), cur_token.str); + as_bad (_("Unexpected token `%s'"), cur_token.str); return 0; } } @@ -6091,9 +6999,7 @@ intel_get_token () /* The new token cannot be larger than the remainder of the operand string. */ - new_token.str = (char *) malloc (strlen (intel_parser.op_string) + 1); - if (new_token.str == NULL) - abort (); + new_token.str = (char *) xmalloc (strlen (intel_parser.op_string) + 1); new_token.str[0] = '\0'; if (strchr ("0123456789", *intel_parser.op_string)) @@ -6115,26 +7021,15 @@ intel_get_token () new_token.code = T_ID; } - else if (strchr ("+-/*:[]()", *intel_parser.op_string)) + else if ((reg = parse_register (intel_parser.op_string, &end_op)) != NULL) { - new_token.code = *intel_parser.op_string; - new_token.str[0] = *intel_parser.op_string; - new_token.str[1] = '\0'; - } + size_t len = end_op - intel_parser.op_string; - else if ((*intel_parser.op_string == REGISTER_PREFIX || allow_naked_reg) - && ((reg = parse_register (intel_parser.op_string, &end_op)) != NULL)) - { new_token.code = T_REG; new_token.reg = reg; - if (*intel_parser.op_string == REGISTER_PREFIX) - { - new_token.str[0] = REGISTER_PREFIX; - new_token.str[1] = '\0'; - } - - strcat (new_token.str, reg->reg_name); + memcpy (new_token.str, intel_parser.op_string, len); + new_token.str[len] = '\0'; } else if (is_identifier_char (*intel_parser.op_string)) @@ -6146,8 +7041,8 @@ intel_get_token () Otherwise, it's operator '.' followed by an expression. */ if ((*q == '.' || *q == '$') && !is_identifier_char (*(q + 1))) { - new_token.code = *q; - new_token.str[0] = *q; + new_token.code = '.'; + new_token.str[0] = '.'; new_token.str[1] = '\0'; } else @@ -6156,7 +7051,28 @@ intel_get_token () *p++ = *q++; *p = '\0'; - if (strcasecmp (new_token.str, "BYTE") == 0) + if (strcasecmp (new_token.str, "NOT") == 0) + new_token.code = '~'; + + else if (strcasecmp (new_token.str, "MOD") == 0) + new_token.code = '%'; + + else if (strcasecmp (new_token.str, "AND") == 0) + new_token.code = '&'; + + else if (strcasecmp (new_token.str, "OR") == 0) + new_token.code = '|'; + + else if (strcasecmp (new_token.str, "XOR") == 0) + new_token.code = '^'; + + else if (strcasecmp (new_token.str, "SHL") == 0) + new_token.code = T_SHL; + + else if (strcasecmp (new_token.str, "SHR") == 0) + new_token.code = T_SHR; + + else if (strcasecmp (new_token.str, "BYTE") == 0) new_token.code = T_BYTE; else if (strcasecmp (new_token.str, "WORD") == 0) @@ -6165,11 +7081,20 @@ intel_get_token () else if (strcasecmp (new_token.str, "DWORD") == 0) new_token.code = T_DWORD; + else if (strcasecmp (new_token.str, "FWORD") == 0) + new_token.code = T_FWORD; + else if (strcasecmp (new_token.str, "QWORD") == 0) new_token.code = T_QWORD; - else if (strcasecmp (new_token.str, "XWORD") == 0) - new_token.code = T_XWORD; + else if (strcasecmp (new_token.str, "TBYTE") == 0 + /* XXX remove (gcc still uses it) */ + || strcasecmp (new_token.str, "XWORD") == 0) + new_token.code = T_TBYTE; + + else if (strcasecmp (new_token.str, "XMMWORD") == 0 + || strcasecmp (new_token.str, "OWORD") == 0) + new_token.code = T_XMMWORD; else if (strcasecmp (new_token.str, "PTR") == 0) new_token.code = T_PTR; @@ -6190,15 +7115,37 @@ intel_get_token () /* ??? This is not mentioned in the MASM grammar. */ else if (strcasecmp (new_token.str, "FLAT") == 0) - new_token.code = T_OFFSET; + { + new_token.code = T_OFFSET; + if (*q == ':') + strcat (new_token.str, ":"); + else + as_bad (_("`:' expected")); + } else new_token.code = T_ID; } } + else if (strchr ("+-/*%|&^:[]()~", *intel_parser.op_string)) + { + new_token.code = *intel_parser.op_string; + new_token.str[0] = *intel_parser.op_string; + new_token.str[1] = '\0'; + } + + else if (strchr ("<>", *intel_parser.op_string) + && *intel_parser.op_string == *(intel_parser.op_string + 1)) + { + new_token.code = *intel_parser.op_string == '<' ? T_SHL : T_SHR; + new_token.str[0] = *intel_parser.op_string; + new_token.str[1] = *intel_parser.op_string; + new_token.str[2] = '\0'; + } + else - as_bad (_("Unrecognized token `%s'\n"), intel_parser.op_string); + as_bad (_("Unrecognized token `%s'"), intel_parser.op_string); intel_parser.op_string += strlen (new_token.str); cur_token = new_token; @@ -6209,8 +7156,11 @@ intel_get_token () static void intel_putback_token () { - intel_parser.op_string -= strlen (cur_token.str); - free (cur_token.str); + if (cur_token.code != T_NIL) + { + intel_parser.op_string -= strlen (cur_token.str); + free (cur_token.str); + } cur_token = prev_token; /* Forget prev_token. */ @@ -6224,21 +7174,44 @@ tc_x86_regname_to_dw2regnum (const char *regname) { unsigned int regnum; unsigned int regnames_count; - char *regnames_32[] = + static const char *const regnames_32[] = { "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi", - "eip" + "eip", "eflags", NULL, + "st0", "st1", "st2", "st3", + "st4", "st5", "st6", "st7", + NULL, NULL, + "xmm0", "xmm1", "xmm2", "xmm3", + "xmm4", "xmm5", "xmm6", "xmm7", + "mm0", "mm1", "mm2", "mm3", + "mm4", "mm5", "mm6", "mm7", + "fcw", "fsw", "mxcsr", + "es", "cs", "ss", "ds", "fs", "gs", NULL, NULL, + "tr", "ldtr" }; - char *regnames_64[] = + static const char *const regnames_64[] = { - "rax", "rbx", "rcx", "rdx", - "rdi", "rsi", "rbp", "rsp", - "r8", "r9", "r10", "r11", + "rax", "rdx", "rcx", "rbx", + "rsi", "rdi", "rbp", "rsp", + "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", - "rip" + "rip", + "xmm0", "xmm1", "xmm2", "xmm3", + "xmm4", "xmm5", "xmm6", "xmm7", + "xmm8", "xmm9", "xmm10", "xmm11", + "xmm12", "xmm13", "xmm14", "xmm15", + "st0", "st1", "st2", "st3", + "st4", "st5", "st6", "st7", + "mm0", "mm1", "mm2", "mm3", + "mm4", "mm5", "mm6", "mm7", + "rflags", + "es", "cs", "ss", "ds", "fs", "gs", NULL, NULL, + "fs.base", "gs.base", NULL, NULL, + "tr", "ldtr", + "mxcsr", "fcw", "fsw" }; - char **regnames; + const char *const *regnames; if (flag_code == CODE_64BIT) { @@ -6252,7 +7225,8 @@ tc_x86_regname_to_dw2regnum (const char *regname) } for (regnum = 0; regnum < regnames_count; regnum++) - if (strcmp (regname, regnames[regnum]) == 0) + if (regnames[regnum] != NULL + && strcmp (regname, regnames[regnum]) == 0) return regnum; return -1; @@ -6270,3 +7244,95 @@ tc_x86_frame_initial_instructions (void) cfi_add_CFA_def_cfa (sp_regno, -x86_cie_data_alignment); cfi_add_CFA_offset (x86_dwarf2_return_column, x86_cie_data_alignment); } + +int +i386_elf_section_type (const char *str, size_t len) +{ + if (flag_code == CODE_64BIT + && len == sizeof ("unwind") - 1 + && strncmp (str, "unwind", 6) == 0) + return SHT_X86_64_UNWIND; + + return -1; +} + +#ifdef TE_PE +void +tc_pe_dwarf2_emit_offset (symbolS *symbol, unsigned int size) +{ + expressionS expr; + + expr.X_op = O_secrel; + expr.X_add_symbol = symbol; + expr.X_add_number = 0; + emit_expr (&expr, size); +} +#endif + +#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) +/* For ELF on x86-64, add support for SHF_X86_64_LARGE. */ + +int +x86_64_section_letter (int letter, char **ptr_msg) +{ + if (flag_code == CODE_64BIT) + { + if (letter == 'l') + return SHF_X86_64_LARGE; + + *ptr_msg = _("Bad .section directive: want a,l,w,x,M,S,G,T in string"); + } + else + *ptr_msg = _("Bad .section directive: want a,w,x,M,S,G,T in string"); + return -1; +} + +int +x86_64_section_word (char *str, size_t len) +{ + if (len == 5 && flag_code == CODE_64BIT && strncmp (str, "large", 5) == 0) + return SHF_X86_64_LARGE; + + return -1; +} + +static void +handle_large_common (int small ATTRIBUTE_UNUSED) +{ + if (flag_code != CODE_64BIT) + { + s_comm_internal (0, elf_common_parse); + as_warn (_(".largecomm supported only in 64bit mode, producing .comm")); + } + else + { + static segT lbss_section; + asection *saved_com_section_ptr = elf_com_section_ptr; + asection *saved_bss_section = bss_section; + + if (lbss_section == NULL) + { + flagword applicable; + segT seg = now_seg; + subsegT subseg = now_subseg; + + /* The .lbss section is for local .largecomm symbols. */ + lbss_section = subseg_new (".lbss", 0); + applicable = bfd_applicable_section_flags (stdoutput); + bfd_set_section_flags (stdoutput, lbss_section, + applicable & SEC_ALLOC); + seg_info (lbss_section)->bss = 1; + + subseg_set (seg, subseg); + } + + elf_com_section_ptr = &_bfd_elf_large_com_section; + bss_section = lbss_section; + + s_comm_internal (0, elf_common_parse); + + elf_com_section_ptr = saved_com_section_ptr; + bss_section = saved_bss_section; + } +} +#endif /* OBJ_ELF || OBJ_MAYBE_ELF */ diff --git a/contrib/binutils/gas/config/tc-i386.h b/contrib/binutils/gas/config/tc-i386.h index 14b522b5649..98517041dad 100644 --- a/contrib/binutils/gas/config/tc-i386.h +++ b/contrib/binutils/gas/config/tc-i386.h @@ -1,6 +1,6 @@ /* tc-i386.h -- Header file for tc-i386.c Copyright 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003, 2004 + 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -17,29 +17,19 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #ifndef TC_I386 #define TC_I386 1 -#ifndef BFD_ASSEMBLER -#error So, do you know what you are doing? -#endif - -#ifdef ANSI_PROTOTYPES struct fix; -#endif #define TARGET_BYTES_BIG_ENDIAN 0 -#ifdef TE_LYNX -#define TARGET_FORMAT "coff-i386-lynx" -#endif - #define TARGET_ARCH bfd_arch_i386 #define TARGET_MACH (i386_mach ()) -extern unsigned long i386_mach PARAMS ((void)); +extern unsigned long i386_mach (void); #ifdef TE_FreeBSD #define AOUT_TARGET_FORMAT "a.out-i386-freebsd" @@ -65,7 +55,10 @@ extern unsigned long i386_mach PARAMS ((void)); #ifdef TE_FreeBSD #define ELF_TARGET_FORMAT "elf32-i386-freebsd" +#elif defined (TE_VXWORKS) +#define ELF_TARGET_FORMAT "elf32-i386-vxworks" #endif + #ifndef ELF_TARGET_FORMAT #define ELF_TARGET_FORMAT "elf32-i386" #endif @@ -95,6 +88,9 @@ extern void i386_elf_emit_arch_note PARAMS ((void)); extern const char extra_symbol_chars[]; #define tc_symbol_chars extra_symbol_chars +extern const char *i386_comment_chars; +#define tc_comment_chars i386_comment_chars + #define MAX_OPERANDS 3 /* max operands per insn */ #define MAX_IMMEDIATE_OPERANDS 2/* max immediates per insn (lcall, ljmp) */ #define MAX_MEMORY_OPERANDS 2 /* max memory refs per insn (string ops) */ @@ -145,18 +141,6 @@ extern const char extra_symbol_chars[]; #define END_OF_INSN '\0' -/* Intel Syntax */ -/* Values 0-4 map onto scale factor */ -#define BYTE_PTR 0 -#define WORD_PTR 1 -#define DWORD_PTR 2 -#define QWORD_PTR 3 -#define XWORD_PTR 4 -#define SHORT 5 -#define OFFSET_FLAT 6 -#define FLAT 7 -#define NONE_FOUND 8 - typedef struct { /* instruction name sans width suffix ("mov" for movl insns) */ @@ -190,18 +174,26 @@ typedef struct #define CpuAthlon 0x200 /* AMD Athlon or better required*/ #define CpuSledgehammer 0x400 /* Sledgehammer or better required */ #define CpuMMX 0x800 /* MMX support required */ -#define CpuSSE 0x1000 /* Streaming SIMD extensions required */ -#define CpuSSE2 0x2000 /* Streaming SIMD extensions 2 required */ -#define Cpu3dnow 0x4000 /* 3dnow! support required */ -#define CpuPNI 0x8000 /* Prescott New Instructions required */ -#define CpuPadLock 0x10000 /* VIA PadLock required */ +#define CpuMMX2 0x1000 /* extended MMX support (with SSE or 3DNow!Ext) required */ +#define CpuSSE 0x2000 /* Streaming SIMD extensions required */ +#define CpuSSE2 0x4000 /* Streaming SIMD extensions 2 required */ +#define Cpu3dnow 0x8000 /* 3dnow! support required */ +#define Cpu3dnowA 0x10000 /* 3dnow!Extensions support required */ +#define CpuSSE3 0x20000 /* Streaming SIMD extensions 3 required */ +#define CpuPNI CpuSSE3 /* Prescott New Instructions required */ +#define CpuPadLock 0x40000 /* VIA PadLock required */ +#define CpuSVME 0x80000 /* AMD Secure Virtual Machine Ext-s required */ +#define CpuVMX 0x100000 /* VMX Instructions required */ +#define CpuMNI 0x200000 /* Merom New Instructions required */ /* These flags are set by gas depending on the flag_code. */ #define Cpu64 0x4000000 /* 64bit support required */ #define CpuNo64 0x8000000 /* Not supported in the 64bit mode */ /* The default value for unknown CPUs - enable all features to avoid problems. */ -#define CpuUnknownFlags (Cpu086|Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|Cpu686|CpuP4|CpuSledgehammer|CpuMMX|CpuSSE|CpuSSE2|CpuPNI|Cpu3dnow|CpuK6|CpuAthlon|CpuPadLock) +#define CpuUnknownFlags (Cpu086|Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|Cpu686 \ + |CpuP4|CpuSledgehammer|CpuMMX|CpuMMX2|CpuSSE|CpuSSE2|CpuPNI|CpuVMX \ + |Cpu3dnow|Cpu3dnowA|CpuK6|CpuAthlon|CpuPadLock|CpuSVME|CpuMNI) /* the bits in opcode_modifier are used to generate the final opcode from the base_opcode. These bits also are used to detect alternate forms of @@ -399,14 +391,14 @@ arch_entry; #define GLOBAL_OFFSET_TABLE_NAME "_GLOBAL_OFFSET_TABLE_" #endif -#ifndef LEX_AT +#if (defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)) && !defined (LEX_AT) #define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) x86_cons (EXP, NBYTES) extern void x86_cons PARAMS ((expressionS *, int)); +#endif #define TC_CONS_FIX_NEW(FRAG,OFF,LEN,EXP) x86_cons_fix_new(FRAG, OFF, LEN, EXP) extern void x86_cons_fix_new PARAMS ((fragS *, unsigned int, unsigned int, expressionS *)); -#endif #define DIFF_EXPR_OK /* foo-. gets turned into PC relative relocs */ @@ -418,7 +410,7 @@ void i386_validate_fix PARAMS ((struct fix *)); #define tc_fix_adjustable(X) tc_i386_fix_adjustable(X) extern int tc_i386_fix_adjustable PARAMS ((struct fix *)); -/* Values passed to md_apply_fix3 don't include the symbol value. */ +/* Values passed to md_apply_fix don't include the symbol value. */ #define MD_APPLY_SYM_VALUE(FIX) 0 /* ELF wants external syms kept, as does PE COFF. */ @@ -446,7 +438,8 @@ extern int tc_i386_fix_adjustable PARAMS ((struct fix *)); || (FIX)->fx_r_type == BFD_RELOC_386_GOTPC \ || TC_FORCE_RELOCATION (FIX)) -#define md_operand(x) +extern int i386_parse_name (char *, expressionS *, char *); +#define md_parse_name(s, e, m, c) i386_parse_name (s, e, c) extern const struct relax_type md_relax_table[]; #define TC_GENERIC_RELAX_TABLE md_relax_table @@ -500,4 +493,22 @@ extern int tc_x86_regname_to_dw2regnum PARAMS ((const char *regname)); #define tc_cfi_frame_initial_instructions tc_x86_frame_initial_instructions extern void tc_x86_frame_initial_instructions PARAMS ((void)); +#define md_elf_section_type(str,len) i386_elf_section_type (str, len) +extern int i386_elf_section_type PARAMS ((const char *, size_t len)); + +/* Support for SHF_X86_64_LARGE */ +extern int x86_64_section_word PARAMS ((char *, size_t)); +extern int x86_64_section_letter PARAMS ((int letter, char **ptr_msg)); +#define md_elf_section_letter(LETTER, PTR_MSG) x86_64_section_letter (LETTER, PTR_MSG) +#define md_elf_section_word(STR, LEN) x86_64_section_word (STR, LEN) + +#ifdef TE_PE + +#define O_secrel O_md1 + +#define TC_DWARF2_EMIT_OFFSET tc_pe_dwarf2_emit_offset +void tc_pe_dwarf2_emit_offset (symbolS *, unsigned int); + +#endif /* TE_PE */ + #endif /* TC_I386 */ diff --git a/contrib/binutils/gas/config/tc-ia64.c b/contrib/binutils/gas/config/tc-ia64.c index f5526c98010..426b60f589a 100644 --- a/contrib/binutils/gas/config/tc-ia64.c +++ b/contrib/binutils/gas/config/tc-ia64.c @@ -1,5 +1,6 @@ /* tc-ia64.c -- Assembler for the HP/Intel IA-64 architecture. - Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. Contributed by David Mosberger-Tang This file is part of GAS, the GNU Assembler. @@ -16,8 +17,8 @@ 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. */ + the Free Software Foundation, 51 Franklin Street - Fifth Floor, + Boston, MA 02110-1301, USA. */ /* TODO: @@ -50,7 +51,14 @@ #include "elf/ia64.h" +#ifdef HAVE_LIMITS_H +#include +#endif + #define NELEMS(a) ((int) (sizeof (a)/sizeof ((a)[0]))) + +/* Some systems define MIN in, e.g., param.h. */ +#undef MIN #define MIN(a,b) ((a) < (b) ? (a) : (b)) #define NUM_SLOTS 4 @@ -116,7 +124,6 @@ enum reg_symbol IND_DTR, IND_ITR, IND_IBR, - IND_MEM, IND_MSR, IND_PKR, IND_PMC, @@ -151,10 +158,15 @@ struct label_fix { struct label_fix *next; struct symbol *sym; + bfd_boolean dw2_mark_labels; }; +/* This is the endianness of the current section. */ extern int target_big_endian; +/* This is the default endianness. */ +static int default_big_endian = TARGET_BYTES_BIG_ENDIAN; + void (*ia64_number_to_chars) PARAMS ((char *, valueT, int)); static void ia64_float_to_chars_bigendian @@ -169,6 +181,10 @@ static struct hash_control *alias_name_hash; static struct hash_control *secalias_hash; static struct hash_control *secalias_name_hash; +/* List of chars besides those in app.c:symbol_chars that can start an + operand. Used to prevent the scrubber eating vital white-space. */ +const char ia64_symbol_chars[] = "@?"; + /* Characters which always start a comment. */ const char comment_chars[] = ""; @@ -177,7 +193,7 @@ const char line_comment_chars[] = "#"; /* Characters which may be used to separate multiple commands on a single line. */ -const char line_separator_chars[] = ";"; +const char line_separator_chars[] = ";{}"; /* Characters which are used to indicate an exponent in a floating point number. */ @@ -209,13 +225,26 @@ static struct struct hash_control *const_hash; /* constant hash table */ struct hash_control *entry_hash; /* code entry hint hash table */ - symbolS *regsym[REG_NUM]; - /* If X_op is != O_absent, the registername for the instruction's qualifying predicate. If NULL, p0 is assumed for instructions that are predicatable. */ expressionS qp; + /* Optimize for which CPU. */ + enum + { + itanium1, + itanium2 + } tune; + + /* What to do when hint.b is used. */ + enum + { + hint_b_error, + hint_b_warning, + hint_b_ok + } hint_b; + unsigned int manual_bundling : 1, debug_dv: 1, @@ -226,6 +255,13 @@ static struct auto_align : 1, keep_pending_output : 1; + /* What to do when something is wrong with unwind directives. */ + enum + { + unwind_check_warning, + unwind_check_error + } unwind_check; + /* Each bundle consists of up to three instructions. We keep track of four most recent instructions so we can correctly set the end_of_insn_group for the last instruction in a bundle. */ @@ -236,7 +272,8 @@ static struct unsigned int end_of_insn_group : 1, manual_bundling_on : 1, - manual_bundling_off : 1; + manual_bundling_off : 1, + loc_directive_seen : 1; signed char user_template; /* user-selected template, if any */ unsigned char qp_regno; /* qualifying predicate */ /* This duplicates a good fraction of "struct fix" but we @@ -286,31 +323,29 @@ static struct the current DV-checking block. */ int maxpaths; /* size currently allocated for entry_labels */ - /* Support for hardware errata workarounds. */ - - /* Record data about the last three insn groups. */ - struct group - { - /* B-step workaround. - For each predicate register, this is set if the corresponding insn - group conditionally sets this register with one of the affected - instructions. */ - int p_reg_set[64]; - /* B-step workaround. - For each general register, this is set if the corresponding insn - a) is conditional one one of the predicate registers for which - P_REG_SET is 1 in the corresponding entry of the previous group, - b) sets this general register with one of the affected - instructions. */ - int g_reg_set_conditionally[128]; - } last_groups[3]; - int group_idx; int pointer_size; /* size in bytes of a pointer */ int pointer_size_shift; /* shift size of a pointer for alignment */ + + symbolS *indregsym[IND_RR - IND_CPUID + 1]; } md; +/* These are not const, because they are modified to MMI for non-itanium1 + targets below. */ +/* MFI bundle of nops. */ +static unsigned char le_nop[16] = +{ + 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00 +}; +/* MFI bundle of nops with stop-bit. */ +static unsigned char le_nop_stop[16] = +{ + 0x0d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00 +}; + /* application registers: */ #define AR_K0 0 @@ -319,33 +354,52 @@ md; #define AR_BSP 17 #define AR_BSPSTORE 18 #define AR_RNAT 19 +#define AR_FCR 21 +#define AR_EFLAG 24 +#define AR_CSD 25 +#define AR_SSD 26 +#define AR_CFLG 27 +#define AR_FSR 28 +#define AR_FIR 29 +#define AR_FDR 30 +#define AR_CCV 32 #define AR_UNAT 36 #define AR_FPSR 40 #define AR_ITC 44 #define AR_PFS 64 #define AR_LC 65 +#define AR_EC 66 static const struct { const char *name; - int regnum; + unsigned int regnum; } ar[] = { - {"ar.k0", 0}, {"ar.k1", 1}, {"ar.k2", 2}, {"ar.k3", 3}, - {"ar.k4", 4}, {"ar.k5", 5}, {"ar.k6", 6}, {"ar.k7", 7}, - {"ar.rsc", 16}, {"ar.bsp", 17}, - {"ar.bspstore", 18}, {"ar.rnat", 19}, - {"ar.fcr", 21}, {"ar.eflag", 24}, - {"ar.csd", 25}, {"ar.ssd", 26}, - {"ar.cflg", 27}, {"ar.fsr", 28}, - {"ar.fir", 29}, {"ar.fdr", 30}, - {"ar.ccv", 32}, {"ar.unat", 36}, - {"ar.fpsr", 40}, {"ar.itc", 44}, - {"ar.pfs", 64}, {"ar.lc", 65}, - {"ar.ec", 66}, + {"ar.k0", AR_K0}, {"ar.k1", AR_K0 + 1}, + {"ar.k2", AR_K0 + 2}, {"ar.k3", AR_K0 + 3}, + {"ar.k4", AR_K0 + 4}, {"ar.k5", AR_K0 + 5}, + {"ar.k6", AR_K0 + 6}, {"ar.k7", AR_K7}, + {"ar.rsc", AR_RSC}, {"ar.bsp", AR_BSP}, + {"ar.bspstore", AR_BSPSTORE}, {"ar.rnat", AR_RNAT}, + {"ar.fcr", AR_FCR}, {"ar.eflag", AR_EFLAG}, + {"ar.csd", AR_CSD}, {"ar.ssd", AR_SSD}, + {"ar.cflg", AR_CFLG}, {"ar.fsr", AR_FSR}, + {"ar.fir", AR_FIR}, {"ar.fdr", AR_FDR}, + {"ar.ccv", AR_CCV}, {"ar.unat", AR_UNAT}, + {"ar.fpsr", AR_FPSR}, {"ar.itc", AR_ITC}, + {"ar.pfs", AR_PFS}, {"ar.lc", AR_LC}, + {"ar.ec", AR_EC}, }; +/* control registers: */ + +#define CR_DCR 0 +#define CR_ITM 1 +#define CR_IVA 2 +#define CR_PTA 8 +#define CR_GPTA 9 #define CR_IPSR 16 #define CR_ISR 17 #define CR_IIP 19 @@ -355,49 +409,52 @@ ar[] = #define CR_IFS 23 #define CR_IIM 24 #define CR_IHA 25 +#define CR_LID 64 #define CR_IVR 65 #define CR_TPR 66 #define CR_EOI 67 #define CR_IRR0 68 #define CR_IRR3 71 +#define CR_ITV 72 +#define CR_PMV 73 +#define CR_CMCV 74 #define CR_LRR0 80 #define CR_LRR1 81 -/* control registers: */ static const struct { const char *name; - int regnum; + unsigned int regnum; } cr[] = { - {"cr.dcr", 0}, - {"cr.itm", 1}, - {"cr.iva", 2}, - {"cr.pta", 8}, - {"cr.gpta", 9}, - {"cr.ipsr", 16}, - {"cr.isr", 17}, - {"cr.iip", 19}, - {"cr.ifa", 20}, - {"cr.itir", 21}, - {"cr.iipa", 22}, - {"cr.ifs", 23}, - {"cr.iim", 24}, - {"cr.iha", 25}, - {"cr.lid", 64}, - {"cr.ivr", 65}, - {"cr.tpr", 66}, - {"cr.eoi", 67}, - {"cr.irr0", 68}, - {"cr.irr1", 69}, - {"cr.irr2", 70}, - {"cr.irr3", 71}, - {"cr.itv", 72}, - {"cr.pmv", 73}, - {"cr.cmcv", 74}, - {"cr.lrr0", 80}, - {"cr.lrr1", 81} + {"cr.dcr", CR_DCR}, + {"cr.itm", CR_ITM}, + {"cr.iva", CR_IVA}, + {"cr.pta", CR_PTA}, + {"cr.gpta", CR_GPTA}, + {"cr.ipsr", CR_IPSR}, + {"cr.isr", CR_ISR}, + {"cr.iip", CR_IIP}, + {"cr.ifa", CR_IFA}, + {"cr.itir", CR_ITIR}, + {"cr.iipa", CR_IIPA}, + {"cr.ifs", CR_IFS}, + {"cr.iim", CR_IIM}, + {"cr.iha", CR_IHA}, + {"cr.lid", CR_LID}, + {"cr.ivr", CR_IVR}, + {"cr.tpr", CR_TPR}, + {"cr.eoi", CR_EOI}, + {"cr.irr0", CR_IRR0}, + {"cr.irr1", CR_IRR0 + 1}, + {"cr.irr2", CR_IRR0 + 2}, + {"cr.irr3", CR_IRR3}, + {"cr.itv", CR_ITV}, + {"cr.pmv", CR_PMV}, + {"cr.cmcv", CR_CMCV}, + {"cr.lrr0", CR_LRR0}, + {"cr.lrr1", CR_LRR1} }; #define PSR_MFL 4 @@ -455,7 +512,7 @@ const_bits[] = static const struct { const char *name; - int regnum; + unsigned int regnum; } indirect_reg[] = { @@ -508,10 +565,10 @@ pseudo_func[] = { "segrel", PSEUDO_FUNC_RELOC, { 0 } }, { "tprel", PSEUDO_FUNC_RELOC, { 0 } }, { "ltv", PSEUDO_FUNC_RELOC, { 0 } }, - { "", 0, { 0 } }, /* placeholder for FUNC_LT_FPTR_RELATIVE */ - { "", 0, { 0 } }, /* placeholder for FUNC_LT_DTP_MODULE */ - { "", 0, { 0 } }, /* placeholder for FUNC_LT_DTP_RELATIVE */ - { "", 0, { 0 } }, /* placeholder for FUNC_LT_TP_RELATIVE */ + { NULL, 0, { 0 } }, /* placeholder for FUNC_LT_FPTR_RELATIVE */ + { NULL, 0, { 0 } }, /* placeholder for FUNC_LT_DTP_MODULE */ + { NULL, 0, { 0 } }, /* placeholder for FUNC_LT_DTP_RELATIVE */ + { NULL, 0, { 0 } }, /* placeholder for FUNC_LT_TP_RELATIVE */ { "iplt", PSEUDO_FUNC_RELOC, { 0 } }, /* mbtype4 constants: */ @@ -558,7 +615,7 @@ static const bfd_vma nop[IA64_NUM_UNITS] = 0x0008000000LL, /* M-unit nop */ 0x4000000000LL, /* B-unit nop */ 0x0008000000LL, /* F-unit nop */ - 0x0008000000LL, /* L-"unit" nop */ + 0x0000000000LL, /* L-"unit" nop immediate */ 0x0008000000LL, /* X-unit nop */ }; @@ -571,11 +628,6 @@ static char special_section_name[][20] = {".init_array"}, {".fini_array"} }; -static char *special_linkonce_name[] = - { - ".gnu.linkonce.ia64unw.", ".gnu.linkonce.ia64unwi." - }; - /* The best template for a particular sequence of up to three instructions: */ #define N IA64_NUM_TYPES @@ -634,7 +686,17 @@ static struct gr { unsigned known:1; int path; valueT value; -} gr_values[128] = {{ 1, 0, 0 }}; +} gr_values[128] = { + { + 1, +#ifdef INT_MAX + INT_MAX, +#else + (((1 << (8 * sizeof(gr_values->path) - 2)) - 1) << 1) + 1, +#endif + 0 + } +}; /* Remember the alignment frag. */ static fragS *align_frag; @@ -655,8 +717,6 @@ typedef struct unw_rec_list { unwind_record r; unsigned long slot_number; fragS *slot_frag; - unsigned long next_slot_number; - fragS *next_slot_frag; struct unw_rec_list *next; } unw_rec_list; @@ -671,6 +731,12 @@ typedef struct label_prologue_count unsigned int prologue_count; } label_prologue_count; +typedef struct proc_pending +{ + symbolS *sym; + struct proc_pending *next; +} proc_pending; + static struct { /* Maintain a list of unwind entries for the current function. */ @@ -682,8 +748,7 @@ static struct unw_rec_list *current_entry; /* These are used to create the unwind table entry for this function. */ - symbolS *proc_start; - symbolS *proc_end; + proc_pending proc_pending; symbolS *info; /* pointer to unwind info */ symbolS *personality_routine; segT saved_text_seg; @@ -691,17 +756,28 @@ static struct unsigned int force_unwind_entry : 1; /* force generation of unwind entry? */ /* TRUE if processing unwind directives in a prologue region. */ - int prologue; - int prologue_mask; + unsigned int prologue : 1; + unsigned int prologue_mask : 4; + unsigned int prologue_gr : 7; + unsigned int body : 1; + unsigned int insn : 1; unsigned int prologue_count; /* number of .prologues seen so far */ /* Prologue counts at previous .label_state directives. */ struct label_prologue_count * saved_prologue_counts; + + /* List of split up .save-s. */ + unw_p_record *pending_saves; } unwind; +/* The input value is a negated offset from psp, and specifies an address + psp - offset. The encoded value is psp + 16 - (4 * offset). Thus we + must add 16 and divide by 4 to get the encoded value. */ + +#define ENCODED_PSP_OFFSET(OFFSET) (((OFFSET) + 16) / 4) + typedef void (*vbyte_func) PARAMS ((int, char *, char *)); /* Forward declarations: */ -static int ar_is_in_integer_unit PARAMS ((int regnum)); static void set_section PARAMS ((char *name)); static unsigned int set_regstack PARAMS ((unsigned int, unsigned int, unsigned int, unsigned int)); @@ -712,11 +788,9 @@ static void dot_proc PARAMS ((int)); static void dot_fframe PARAMS ((int)); static void dot_vframe PARAMS ((int)); static void dot_vframesp PARAMS ((int)); -static void dot_vframepsp PARAMS ((int)); static void dot_save PARAMS ((int)); static void dot_restore PARAMS ((int)); static void dot_restorereg PARAMS ((int)); -static void dot_restorereg_p PARAMS ((int)); static void dot_handlerdata PARAMS ((int)); static void dot_unwentry PARAMS ((int)); static void dot_altrp PARAMS ((int)); @@ -728,8 +802,6 @@ static void dot_savegf PARAMS ((int)); static void dot_spill PARAMS ((int)); static void dot_spillreg PARAMS ((int)); static void dot_spillmem PARAMS ((int)); -static void dot_spillreg_p PARAMS ((int)); -static void dot_spillmem_p PARAMS ((int)); static void dot_label_state PARAMS ((int)); static void dot_copy_state PARAMS ((int)); static void dot_unwabi PARAMS ((int)); @@ -744,7 +816,7 @@ static void dot_byteorder PARAMS ((int)); static void dot_psr PARAMS ((int)); static void dot_alias PARAMS ((int)); static void dot_ln PARAMS ((int)); -static char *parse_section_name PARAMS ((void)); +static void cross_section PARAMS ((int ref, void (*cons) PARAMS((int)), int ua)); static void dot_xdata PARAMS ((int)); static void stmt_float_cons PARAMS ((int)); static void stmt_cons_ua PARAMS ((int)); @@ -755,19 +827,19 @@ static void dot_xfloat_cons_ua PARAMS ((int)); static void print_prmask PARAMS ((valueT mask)); static void dot_pred_rel PARAMS ((int)); static void dot_reg_val PARAMS ((int)); +static void dot_serialize PARAMS ((int)); static void dot_dv_mode PARAMS ((int)); static void dot_entry PARAMS ((int)); static void dot_mem_offset PARAMS ((int)); -static void add_unwind_entry PARAMS((unw_rec_list *ptr)); -static symbolS *declare_register PARAMS ((const char *name, int regnum)); -static void declare_register_set PARAMS ((const char *, int, int)); +static void add_unwind_entry PARAMS((unw_rec_list *, int)); +static symbolS *declare_register PARAMS ((const char *name, unsigned int regnum)); +static void declare_register_set PARAMS ((const char *, unsigned int, unsigned int)); static unsigned int operand_width PARAMS ((enum ia64_opnd)); static enum operand_match_result operand_match PARAMS ((const struct ia64_opcode *idesc, int index, expressionS *e)); -static int parse_operand PARAMS ((expressionS *e)); +static int parse_operand PARAMS ((expressionS *, int)); static struct ia64_opcode * parse_operands PARAMS ((struct ia64_opcode *)); -static int errata_nop_necessary_p PARAMS ((struct slot *, enum ia64_unit)); static void build_insn PARAMS ((struct slot *, bfd_vma *)); static void emit_one_bundle PARAMS ((void)); static void fix_insn PARAMS ((fixS *, const struct ia64_operand *, valueT)); @@ -887,15 +959,11 @@ static unw_rec_list *output_unwabi PARAMS ((unsigned long, unsigned long)); static unw_rec_list *output_epilogue PARAMS ((unsigned long)); static unw_rec_list *output_label_state PARAMS ((unsigned long)); static unw_rec_list *output_copy_state PARAMS ((unsigned long)); -static unw_rec_list *output_spill_psprel PARAMS ((unsigned int, unsigned int, unsigned int)); -static unw_rec_list *output_spill_sprel PARAMS ((unsigned int, unsigned int, unsigned int)); -static unw_rec_list *output_spill_psprel_p PARAMS ((unsigned int, unsigned int, unsigned int, +static unw_rec_list *output_spill_psprel PARAMS ((unsigned int, unsigned int, unsigned int, unsigned int)); -static unw_rec_list *output_spill_sprel_p PARAMS ((unsigned int, unsigned int, unsigned int, +static unw_rec_list *output_spill_sprel PARAMS ((unsigned int, unsigned int, unsigned int, unsigned int)); static unw_rec_list *output_spill_reg PARAMS ((unsigned int, unsigned int, unsigned int, - unsigned int)); -static unw_rec_list *output_spill_reg_p PARAMS ((unsigned int, unsigned int, unsigned int, unsigned int, unsigned int)); static void process_one_record PARAMS ((unw_rec_list *, vbyte_func)); static void process_unw_records PARAMS ((unw_rec_list *, vbyte_func)); @@ -906,51 +974,29 @@ static unsigned long slot_index PARAMS ((unsigned long, fragS *, int)); static unw_rec_list *optimize_unw_records PARAMS ((unw_rec_list *)); static void fixup_unw_records PARAMS ((unw_rec_list *, int)); -static int convert_expr_to_ab_reg PARAMS ((expressionS *, unsigned int *, unsigned int *)); -static int convert_expr_to_xy_reg PARAMS ((expressionS *, unsigned int *, unsigned int *)); -static void generate_unwind_image PARAMS ((const char *)); +static int parse_predicate_and_operand PARAMS ((expressionS *, unsigned *, const char *)); +static void convert_expr_to_ab_reg PARAMS ((const expressionS *, unsigned int *, unsigned int *, const char *, int)); +static void convert_expr_to_xy_reg PARAMS ((const expressionS *, unsigned int *, unsigned int *, const char *, int)); static unsigned int get_saved_prologue_count PARAMS ((unsigned long)); static void save_prologue_count PARAMS ((unsigned long, unsigned int)); static void free_saved_prologue_counts PARAMS ((void)); -/* Build the unwind section name by appending the (possibly stripped) - text section NAME to the unwind PREFIX. The resulting string - pointer is assigned to RESULT. The string is allocated on the - stack, so this must be a macro... */ -#define make_unw_section_name(special, text_name, result) \ - { \ - const char *_prefix = special_section_name[special]; \ - const char *_suffix = text_name; \ - size_t _prefix_len, _suffix_len; \ - char *_result; \ - if (strncmp (text_name, ".gnu.linkonce.t.", \ - sizeof (".gnu.linkonce.t.") - 1) == 0) \ - { \ - _prefix = special_linkonce_name[special - SPECIAL_SECTION_UNWIND]; \ - _suffix += sizeof (".gnu.linkonce.t.") - 1; \ - } \ - _prefix_len = strlen (_prefix), _suffix_len = strlen (_suffix); \ - _result = alloca (_prefix_len + _suffix_len + 1); \ - memcpy (_result, _prefix, _prefix_len); \ - memcpy (_result + _prefix_len, _suffix, _suffix_len); \ - _result[_prefix_len + _suffix_len] = '\0'; \ - result = _result; \ - } \ -while (0) - -/* Determine if application register REGNUM resides in the integer +/* Determine if application register REGNUM resides only in the integer unit (as opposed to the memory unit). */ static int -ar_is_in_integer_unit (reg) - int reg; +ar_is_only_in_integer_unit (int reg) { reg -= REG_AR; + return reg >= 64 && reg <= 111; +} - return (reg == 64 /* pfs */ - || reg == 65 /* lc */ - || reg == 66 /* ec */ - /* ??? ias accepts and puts these in the integer unit. */ - || (reg >= 112 && reg <= 127)); +/* Determine if application register REGNUM resides only in the memory + unit (as opposed to the integer unit). */ +static int +ar_is_only_in_memory_unit (int reg) +{ + reg -= REG_AR; + return reg >= 0 && reg <= 47; } /* Switch to section NAME and create section if necessary. It's @@ -1019,12 +1065,6 @@ ia64_elf_section_type (str, len) if (STREQ ("unwind")) return SHT_IA_64_UNWIND; - if (STREQ ("init_array")) - return SHT_INIT_ARRAY; - - if (STREQ ("fini_array")) - return SHT_FINI_ARRAY; - return -1; #undef STREQ } @@ -1065,6 +1105,7 @@ ia64_flush_insns () segT saved_seg; subsegT saved_subseg; unw_rec_list *ptr; + bfd_boolean mark; if (!md.last_text_seg) return; @@ -1078,18 +1119,23 @@ ia64_flush_insns () emit_one_bundle (); /* force out queued instructions */ /* In case there are labels following the last instruction, resolve - those now: */ + those now. */ + mark = FALSE; for (lfix = CURR_SLOT.label_fixups; lfix; lfix = lfix->next) { - S_SET_VALUE (lfix->sym, frag_now_fix ()); - symbol_set_frag (lfix->sym, frag_now); + symbol_set_value_now (lfix->sym); + mark |= lfix->dw2_mark_labels; + } + if (mark) + { + dwarf2_where (&CURR_SLOT.debug_line); + CURR_SLOT.debug_line.flags |= DWARF2_FLAG_BASIC_BLOCK; + dwarf2_gen_line_info (frag_now_fix (), &CURR_SLOT.debug_line); } CURR_SLOT.label_fixups = 0; + for (lfix = CURR_SLOT.tag_fixups; lfix; lfix = lfix->next) - { - S_SET_VALUE (lfix->sym, frag_now_fix ()); - symbol_set_frag (lfix->sym, frag_now); - } + symbol_set_value_now (lfix->sym); CURR_SLOT.tag_fixups = 0; /* In case there are unwind directives following the last instruction, @@ -1160,7 +1206,7 @@ ia64_cons_align (nbytes) } /* Output COUNT bytes to a memory location. */ -static unsigned char *vbyte_mem_ptr = NULL; +static char *vbyte_mem_ptr = NULL; void output_vbyte_mem (count, ptr, comment) @@ -1337,7 +1383,7 @@ output_P4_format (f, imask, imask_size) unsigned long imask_size; { imask[0] = UNW_P4; - (*f) (imask_size, imask, NULL); + (*f) (imask_size, (char *) imask, NULL); } static void @@ -1723,6 +1769,55 @@ output_X4_format (f, qp, ab, reg, x, y, treg, t) (*f) (count, bytes, NULL); } +/* This function checks whether there are any outstanding .save-s and + discards them if so. */ + +static void +check_pending_save (void) +{ + if (unwind.pending_saves) + { + unw_rec_list *cur, *prev; + + as_warn ("Previous .save incomplete"); + for (cur = unwind.list, prev = NULL; cur; ) + if (&cur->r.record.p == unwind.pending_saves) + { + if (prev) + prev->next = cur->next; + else + unwind.list = cur->next; + if (cur == unwind.tail) + unwind.tail = prev; + if (cur == unwind.current_entry) + unwind.current_entry = cur->next; + /* Don't free the first discarded record, it's being used as + terminator for (currently) br_gr and gr_gr processing, and + also prevents leaving a dangling pointer to it in its + predecessor. */ + cur->r.record.p.grmask = 0; + cur->r.record.p.brmask = 0; + cur->r.record.p.frmask = 0; + prev = cur->r.record.p.next; + cur->r.record.p.next = NULL; + cur = prev; + break; + } + else + { + prev = cur; + cur = cur->next; + } + while (cur) + { + prev = cur; + cur = cur->r.record.p.next; + free (prev); + } + unwind.pending_saves = NULL; + } +} + /* This function allocates a record list structure, and initializes fields. */ static unw_rec_list * @@ -1730,11 +1825,9 @@ alloc_record (unw_record_type t) { unw_rec_list *ptr; ptr = xmalloc (sizeof (*ptr)); - ptr->next = NULL; + memset (ptr, 0, sizeof (*ptr)); ptr->slot_number = SLOT_NUM_NOT_SET; ptr->r.type = t; - ptr->next_slot_number = 0; - ptr->next_slot_frag = 0; return ptr; } @@ -1796,7 +1889,7 @@ output_psp_gr (gr) unsigned int gr; { unw_rec_list *ptr = alloc_record (psp_gr); - ptr->r.record.p.gr = gr; + ptr->r.record.p.r.gr = gr; return ptr; } @@ -1805,7 +1898,7 @@ output_psp_sprel (offset) unsigned int offset; { unw_rec_list *ptr = alloc_record (psp_sprel); - ptr->r.record.p.spoff = offset / 4; + ptr->r.record.p.off.sp = offset / 4; return ptr; } @@ -1821,7 +1914,7 @@ output_rp_gr (gr) unsigned int gr; { unw_rec_list *ptr = alloc_record (rp_gr); - ptr->r.record.p.gr = gr; + ptr->r.record.p.r.gr = gr; return ptr; } @@ -1830,7 +1923,7 @@ output_rp_br (br) unsigned int br; { unw_rec_list *ptr = alloc_record (rp_br); - ptr->r.record.p.br = br; + ptr->r.record.p.r.br = br; return ptr; } @@ -1839,7 +1932,7 @@ output_rp_psprel (offset) unsigned int offset; { unw_rec_list *ptr = alloc_record (rp_psprel); - ptr->r.record.p.pspoff = offset / 4; + ptr->r.record.p.off.psp = ENCODED_PSP_OFFSET (offset); return ptr; } @@ -1848,7 +1941,7 @@ output_rp_sprel (offset) unsigned int offset; { unw_rec_list *ptr = alloc_record (rp_sprel); - ptr->r.record.p.spoff = offset / 4; + ptr->r.record.p.off.sp = offset / 4; return ptr; } @@ -1864,7 +1957,7 @@ output_pfs_gr (gr) unsigned int gr; { unw_rec_list *ptr = alloc_record (pfs_gr); - ptr->r.record.p.gr = gr; + ptr->r.record.p.r.gr = gr; return ptr; } @@ -1873,7 +1966,7 @@ output_pfs_psprel (offset) unsigned int offset; { unw_rec_list *ptr = alloc_record (pfs_psprel); - ptr->r.record.p.pspoff = offset / 4; + ptr->r.record.p.off.psp = ENCODED_PSP_OFFSET (offset); return ptr; } @@ -1882,7 +1975,7 @@ output_pfs_sprel (offset) unsigned int offset; { unw_rec_list *ptr = alloc_record (pfs_sprel); - ptr->r.record.p.spoff = offset / 4; + ptr->r.record.p.off.sp = offset / 4; return ptr; } @@ -1898,7 +1991,7 @@ output_preds_gr (gr) unsigned int gr; { unw_rec_list *ptr = alloc_record (preds_gr); - ptr->r.record.p.gr = gr; + ptr->r.record.p.r.gr = gr; return ptr; } @@ -1907,7 +2000,7 @@ output_preds_psprel (offset) unsigned int offset; { unw_rec_list *ptr = alloc_record (preds_psprel); - ptr->r.record.p.pspoff = offset / 4; + ptr->r.record.p.off.psp = ENCODED_PSP_OFFSET (offset); return ptr; } @@ -1916,7 +2009,7 @@ output_preds_sprel (offset) unsigned int offset; { unw_rec_list *ptr = alloc_record (preds_sprel); - ptr->r.record.p.spoff = offset / 4; + ptr->r.record.p.off.sp = offset / 4; return ptr; } @@ -1925,8 +2018,24 @@ output_fr_mem (mask) unsigned int mask; { unw_rec_list *ptr = alloc_record (fr_mem); - ptr->r.record.p.rmask = mask; - return ptr; + unw_rec_list *cur = ptr; + + ptr->r.record.p.frmask = mask; + unwind.pending_saves = &ptr->r.record.p; + for (;;) + { + unw_rec_list *prev = cur; + + /* Clear least significant set bit. */ + mask &= ~(mask & (~mask + 1)); + if (!mask) + return ptr; + cur = alloc_record (fr_mem); + cur->r.record.p.frmask = mask; + /* Retain only least significant bit. */ + prev->r.record.p.frmask ^= mask; + prev->r.record.p.next = cur; + } } static unw_rec_list * @@ -1935,9 +2044,39 @@ output_frgr_mem (gr_mask, fr_mask) unsigned int fr_mask; { unw_rec_list *ptr = alloc_record (frgr_mem); - ptr->r.record.p.grmask = gr_mask; - ptr->r.record.p.frmask = fr_mask; - return ptr; + unw_rec_list *cur = ptr; + + unwind.pending_saves = &cur->r.record.p; + cur->r.record.p.frmask = fr_mask; + while (fr_mask) + { + unw_rec_list *prev = cur; + + /* Clear least significant set bit. */ + fr_mask &= ~(fr_mask & (~fr_mask + 1)); + if (!gr_mask && !fr_mask) + return ptr; + cur = alloc_record (frgr_mem); + cur->r.record.p.frmask = fr_mask; + /* Retain only least significant bit. */ + prev->r.record.p.frmask ^= fr_mask; + prev->r.record.p.next = cur; + } + cur->r.record.p.grmask = gr_mask; + for (;;) + { + unw_rec_list *prev = cur; + + /* Clear least significant set bit. */ + gr_mask &= ~(gr_mask & (~gr_mask + 1)); + if (!gr_mask) + return ptr; + cur = alloc_record (frgr_mem); + cur->r.record.p.grmask = gr_mask; + /* Retain only least significant bit. */ + prev->r.record.p.grmask ^= gr_mask; + prev->r.record.p.next = cur; + } } static unw_rec_list * @@ -1946,9 +2085,27 @@ output_gr_gr (mask, reg) unsigned int reg; { unw_rec_list *ptr = alloc_record (gr_gr); + unw_rec_list *cur = ptr; + ptr->r.record.p.grmask = mask; - ptr->r.record.p.gr = reg; - return ptr; + ptr->r.record.p.r.gr = reg; + unwind.pending_saves = &ptr->r.record.p; + for (;;) + { + unw_rec_list *prev = cur; + + /* Clear least significant set bit. */ + mask &= ~(mask & (~mask + 1)); + if (!mask) + return ptr; + cur = alloc_record (gr_gr); + cur->r.record.p.grmask = mask; + /* Indicate this record shouldn't be output. */ + cur->r.record.p.r.gr = REG_NUM; + /* Retain only least significant bit. */ + prev->r.record.p.grmask ^= mask; + prev->r.record.p.next = cur; + } } static unw_rec_list * @@ -1956,27 +2113,77 @@ output_gr_mem (mask) unsigned int mask; { unw_rec_list *ptr = alloc_record (gr_mem); - ptr->r.record.p.rmask = mask; - return ptr; + unw_rec_list *cur = ptr; + + ptr->r.record.p.grmask = mask; + unwind.pending_saves = &ptr->r.record.p; + for (;;) + { + unw_rec_list *prev = cur; + + /* Clear least significant set bit. */ + mask &= ~(mask & (~mask + 1)); + if (!mask) + return ptr; + cur = alloc_record (gr_mem); + cur->r.record.p.grmask = mask; + /* Retain only least significant bit. */ + prev->r.record.p.grmask ^= mask; + prev->r.record.p.next = cur; + } } static unw_rec_list * output_br_mem (unsigned int mask) { unw_rec_list *ptr = alloc_record (br_mem); + unw_rec_list *cur = ptr; + ptr->r.record.p.brmask = mask; - return ptr; + unwind.pending_saves = &ptr->r.record.p; + for (;;) + { + unw_rec_list *prev = cur; + + /* Clear least significant set bit. */ + mask &= ~(mask & (~mask + 1)); + if (!mask) + return ptr; + cur = alloc_record (br_mem); + cur->r.record.p.brmask = mask; + /* Retain only least significant bit. */ + prev->r.record.p.brmask ^= mask; + prev->r.record.p.next = cur; + } } static unw_rec_list * -output_br_gr (save_mask, reg) - unsigned int save_mask; +output_br_gr (mask, reg) + unsigned int mask; unsigned int reg; { unw_rec_list *ptr = alloc_record (br_gr); - ptr->r.record.p.brmask = save_mask; - ptr->r.record.p.gr = reg; - return ptr; + unw_rec_list *cur = ptr; + + ptr->r.record.p.brmask = mask; + ptr->r.record.p.r.gr = reg; + unwind.pending_saves = &ptr->r.record.p; + for (;;) + { + unw_rec_list *prev = cur; + + /* Clear least significant set bit. */ + mask &= ~(mask & (~mask + 1)); + if (!mask) + return ptr; + cur = alloc_record (br_gr); + cur->r.record.p.brmask = mask; + /* Indicate this record shouldn't be output. */ + cur->r.record.p.r.gr = REG_NUM; + /* Retain only least significant bit. */ + prev->r.record.p.brmask ^= mask; + prev->r.record.p.next = cur; + } } static unw_rec_list * @@ -1984,7 +2191,7 @@ output_spill_base (offset) unsigned int offset; { unw_rec_list *ptr = alloc_record (spill_base); - ptr->r.record.p.pspoff = offset / 4; + ptr->r.record.p.off.psp = ENCODED_PSP_OFFSET (offset); return ptr; } @@ -2000,7 +2207,7 @@ output_unat_gr (gr) unsigned int gr; { unw_rec_list *ptr = alloc_record (unat_gr); - ptr->r.record.p.gr = gr; + ptr->r.record.p.r.gr = gr; return ptr; } @@ -2009,7 +2216,7 @@ output_unat_psprel (offset) unsigned int offset; { unw_rec_list *ptr = alloc_record (unat_psprel); - ptr->r.record.p.pspoff = offset / 4; + ptr->r.record.p.off.psp = ENCODED_PSP_OFFSET (offset); return ptr; } @@ -2018,7 +2225,7 @@ output_unat_sprel (offset) unsigned int offset; { unw_rec_list *ptr = alloc_record (unat_sprel); - ptr->r.record.p.spoff = offset / 4; + ptr->r.record.p.off.sp = offset / 4; return ptr; } @@ -2034,7 +2241,7 @@ output_lc_gr (gr) unsigned int gr; { unw_rec_list *ptr = alloc_record (lc_gr); - ptr->r.record.p.gr = gr; + ptr->r.record.p.r.gr = gr; return ptr; } @@ -2043,7 +2250,7 @@ output_lc_psprel (offset) unsigned int offset; { unw_rec_list *ptr = alloc_record (lc_psprel); - ptr->r.record.p.pspoff = offset / 4; + ptr->r.record.p.off.psp = ENCODED_PSP_OFFSET (offset); return ptr; } @@ -2052,7 +2259,7 @@ output_lc_sprel (offset) unsigned int offset; { unw_rec_list *ptr = alloc_record (lc_sprel); - ptr->r.record.p.spoff = offset / 4; + ptr->r.record.p.off.sp = offset / 4; return ptr; } @@ -2068,7 +2275,7 @@ output_fpsr_gr (gr) unsigned int gr; { unw_rec_list *ptr = alloc_record (fpsr_gr); - ptr->r.record.p.gr = gr; + ptr->r.record.p.r.gr = gr; return ptr; } @@ -2077,7 +2284,7 @@ output_fpsr_psprel (offset) unsigned int offset; { unw_rec_list *ptr = alloc_record (fpsr_psprel); - ptr->r.record.p.pspoff = offset / 4; + ptr->r.record.p.off.psp = ENCODED_PSP_OFFSET (offset); return ptr; } @@ -2086,7 +2293,7 @@ output_fpsr_sprel (offset) unsigned int offset; { unw_rec_list *ptr = alloc_record (fpsr_sprel); - ptr->r.record.p.spoff = offset / 4; + ptr->r.record.p.off.sp = offset / 4; return ptr; } @@ -2109,7 +2316,7 @@ output_priunat_gr (gr) unsigned int gr; { unw_rec_list *ptr = alloc_record (priunat_gr); - ptr->r.record.p.gr = gr; + ptr->r.record.p.r.gr = gr; return ptr; } @@ -2118,7 +2325,7 @@ output_priunat_psprel (offset) unsigned int offset; { unw_rec_list *ptr = alloc_record (priunat_psprel); - ptr->r.record.p.pspoff = offset / 4; + ptr->r.record.p.off.psp = ENCODED_PSP_OFFSET (offset); return ptr; } @@ -2127,7 +2334,7 @@ output_priunat_sprel (offset) unsigned int offset; { unw_rec_list *ptr = alloc_record (priunat_sprel); - ptr->r.record.p.spoff = offset / 4; + ptr->r.record.p.off.sp = offset / 4; return ptr; } @@ -2143,7 +2350,7 @@ output_bsp_gr (gr) unsigned int gr; { unw_rec_list *ptr = alloc_record (bsp_gr); - ptr->r.record.p.gr = gr; + ptr->r.record.p.r.gr = gr; return ptr; } @@ -2152,7 +2359,7 @@ output_bsp_psprel (offset) unsigned int offset; { unw_rec_list *ptr = alloc_record (bsp_psprel); - ptr->r.record.p.pspoff = offset / 4; + ptr->r.record.p.off.psp = ENCODED_PSP_OFFSET (offset); return ptr; } @@ -2161,7 +2368,7 @@ output_bsp_sprel (offset) unsigned int offset; { unw_rec_list *ptr = alloc_record (bsp_sprel); - ptr->r.record.p.spoff = offset / 4; + ptr->r.record.p.off.sp = offset / 4; return ptr; } @@ -2177,7 +2384,7 @@ output_bspstore_gr (gr) unsigned int gr; { unw_rec_list *ptr = alloc_record (bspstore_gr); - ptr->r.record.p.gr = gr; + ptr->r.record.p.r.gr = gr; return ptr; } @@ -2186,7 +2393,7 @@ output_bspstore_psprel (offset) unsigned int offset; { unw_rec_list *ptr = alloc_record (bspstore_psprel); - ptr->r.record.p.pspoff = offset / 4; + ptr->r.record.p.off.psp = ENCODED_PSP_OFFSET (offset); return ptr; } @@ -2195,7 +2402,7 @@ output_bspstore_sprel (offset) unsigned int offset; { unw_rec_list *ptr = alloc_record (bspstore_sprel); - ptr->r.record.p.spoff = offset / 4; + ptr->r.record.p.off.sp = offset / 4; return ptr; } @@ -2211,7 +2418,7 @@ output_rnat_gr (gr) unsigned int gr; { unw_rec_list *ptr = alloc_record (rnat_gr); - ptr->r.record.p.gr = gr; + ptr->r.record.p.r.gr = gr; return ptr; } @@ -2220,7 +2427,7 @@ output_rnat_psprel (offset) unsigned int offset; { unw_rec_list *ptr = alloc_record (rnat_psprel); - ptr->r.record.p.pspoff = offset / 4; + ptr->r.record.p.off.psp = ENCODED_PSP_OFFSET (offset); return ptr; } @@ -2229,7 +2436,7 @@ output_rnat_sprel (offset) unsigned int offset; { unw_rec_list *ptr = alloc_record (rnat_sprel); - ptr->r.record.p.spoff = offset / 4; + ptr->r.record.p.off.sp = offset / 4; return ptr; } @@ -2269,88 +2476,47 @@ output_copy_state (unsigned long label) } static unw_rec_list * -output_spill_psprel (ab, reg, offset) - unsigned int ab; - unsigned int reg; - unsigned int offset; -{ - unw_rec_list *ptr = alloc_record (spill_psprel); - ptr->r.record.x.ab = ab; - ptr->r.record.x.reg = reg; - ptr->r.record.x.pspoff = offset / 4; - return ptr; -} - -static unw_rec_list * -output_spill_sprel (ab, reg, offset) - unsigned int ab; - unsigned int reg; - unsigned int offset; -{ - unw_rec_list *ptr = alloc_record (spill_sprel); - ptr->r.record.x.ab = ab; - ptr->r.record.x.reg = reg; - ptr->r.record.x.spoff = offset / 4; - return ptr; -} - -static unw_rec_list * -output_spill_psprel_p (ab, reg, offset, predicate) +output_spill_psprel (ab, reg, offset, predicate) unsigned int ab; unsigned int reg; unsigned int offset; unsigned int predicate; { - unw_rec_list *ptr = alloc_record (spill_psprel_p); + unw_rec_list *ptr = alloc_record (predicate ? spill_psprel_p : spill_psprel); ptr->r.record.x.ab = ab; ptr->r.record.x.reg = reg; - ptr->r.record.x.pspoff = offset / 4; + ptr->r.record.x.where.pspoff = ENCODED_PSP_OFFSET (offset); ptr->r.record.x.qp = predicate; return ptr; } static unw_rec_list * -output_spill_sprel_p (ab, reg, offset, predicate) +output_spill_sprel (ab, reg, offset, predicate) unsigned int ab; unsigned int reg; unsigned int offset; unsigned int predicate; { - unw_rec_list *ptr = alloc_record (spill_sprel_p); + unw_rec_list *ptr = alloc_record (predicate ? spill_sprel_p : spill_sprel); ptr->r.record.x.ab = ab; ptr->r.record.x.reg = reg; - ptr->r.record.x.spoff = offset / 4; + ptr->r.record.x.where.spoff = offset / 4; ptr->r.record.x.qp = predicate; return ptr; } static unw_rec_list * -output_spill_reg (ab, reg, targ_reg, xy) - unsigned int ab; - unsigned int reg; - unsigned int targ_reg; - unsigned int xy; -{ - unw_rec_list *ptr = alloc_record (spill_reg); - ptr->r.record.x.ab = ab; - ptr->r.record.x.reg = reg; - ptr->r.record.x.treg = targ_reg; - ptr->r.record.x.xy = xy; - return ptr; -} - -static unw_rec_list * -output_spill_reg_p (ab, reg, targ_reg, xy, predicate) +output_spill_reg (ab, reg, targ_reg, xy, predicate) unsigned int ab; unsigned int reg; unsigned int targ_reg; unsigned int xy; unsigned int predicate; { - unw_rec_list *ptr = alloc_record (spill_reg_p); + unw_rec_list *ptr = alloc_record (predicate ? spill_reg_p : spill_reg); ptr->r.record.x.ab = ab; ptr->r.record.x.reg = reg; - ptr->r.record.x.treg = targ_reg; + ptr->r.record.x.where.reg = targ_reg; ptr->r.record.x.xy = xy; ptr->r.record.x.qp = predicate; return ptr; @@ -2364,7 +2530,7 @@ process_one_record (ptr, f) unw_rec_list *ptr; vbyte_func f; { - unsigned long fr_mask, gr_mask; + unsigned int fr_mask, gr_mask; switch (ptr->r.type) { @@ -2430,13 +2596,13 @@ process_one_record (ptr, f) case bsp_gr: case bspstore_gr: case rnat_gr: - output_P3_format (f, ptr->r.type, ptr->r.record.p.gr); + output_P3_format (f, ptr->r.type, ptr->r.record.p.r.gr); break; case rp_br: - output_P3_format (f, rp_br, ptr->r.record.p.br); + output_P3_format (f, rp_br, ptr->r.record.p.r.br); break; case psp_sprel: - output_P7_format (f, psp_sprel, ptr->r.record.p.spoff, 0); + output_P7_format (f, psp_sprel, ptr->r.record.p.off.sp, 0); break; case rp_when: case pfs_when: @@ -2453,7 +2619,7 @@ process_one_record (ptr, f) case lc_psprel: case fpsr_psprel: case spill_base: - output_P7_format (f, ptr->r.type, ptr->r.record.p.pspoff, 0); + output_P7_format (f, ptr->r.type, ptr->r.record.p.off.psp, 0); break; case rp_sprel: case pfs_sprel: @@ -2465,13 +2631,29 @@ process_one_record (ptr, f) case bsp_sprel: case bspstore_sprel: case rnat_sprel: - output_P8_format (f, ptr->r.type, ptr->r.record.p.spoff); + output_P8_format (f, ptr->r.type, ptr->r.record.p.off.sp); break; case gr_gr: - output_P9_format (f, ptr->r.record.p.grmask, ptr->r.record.p.gr); + if (ptr->r.record.p.r.gr < REG_NUM) + { + const unw_rec_list *cur = ptr; + + gr_mask = cur->r.record.p.grmask; + while ((cur = cur->r.record.p.next) != NULL) + gr_mask |= cur->r.record.p.grmask; + output_P9_format (f, gr_mask, ptr->r.record.p.r.gr); + } break; case br_gr: - output_P2_format (f, ptr->r.record.p.brmask, ptr->r.record.p.gr); + if (ptr->r.record.p.r.gr < REG_NUM) + { + const unw_rec_list *cur = ptr; + + gr_mask = cur->r.record.p.brmask; + while ((cur = cur->r.record.p.next) != NULL) + gr_mask |= cur->r.record.p.brmask; + output_P2_format (f, gr_mask, ptr->r.record.p.r.gr); + } break; case spill_mask: as_bad ("spill_mask record unimplemented."); @@ -2487,7 +2669,7 @@ process_one_record (ptr, f) case bsp_psprel: case bspstore_psprel: case rnat_psprel: - output_P8_format (f, ptr->r.type, ptr->r.record.p.pspoff); + output_P8_format (f, ptr->r.type, ptr->r.record.p.off.psp); break; case unwabi: output_P10_format (f, ptr->r.record.p.abi, ptr->r.record.p.context); @@ -2502,32 +2684,32 @@ process_one_record (ptr, f) case spill_psprel: output_X1_format (f, ptr->r.type, ptr->r.record.x.ab, ptr->r.record.x.reg, ptr->r.record.x.t, - ptr->r.record.x.pspoff); + ptr->r.record.x.where.pspoff); break; case spill_sprel: output_X1_format (f, ptr->r.type, ptr->r.record.x.ab, ptr->r.record.x.reg, ptr->r.record.x.t, - ptr->r.record.x.spoff); + ptr->r.record.x.where.spoff); break; case spill_reg: output_X2_format (f, ptr->r.record.x.ab, ptr->r.record.x.reg, ptr->r.record.x.xy >> 1, ptr->r.record.x.xy, - ptr->r.record.x.treg, ptr->r.record.x.t); + ptr->r.record.x.where.reg, ptr->r.record.x.t); break; case spill_psprel_p: output_X3_format (f, ptr->r.type, ptr->r.record.x.qp, ptr->r.record.x.ab, ptr->r.record.x.reg, - ptr->r.record.x.t, ptr->r.record.x.pspoff); + ptr->r.record.x.t, ptr->r.record.x.where.pspoff); break; case spill_sprel_p: output_X3_format (f, ptr->r.type, ptr->r.record.x.qp, ptr->r.record.x.ab, ptr->r.record.x.reg, - ptr->r.record.x.t, ptr->r.record.x.spoff); + ptr->r.record.x.t, ptr->r.record.x.where.spoff); break; case spill_reg_p: output_X4_format (f, ptr->r.record.x.qp, ptr->r.record.x.ab, ptr->r.record.x.reg, ptr->r.record.x.xy >> 1, - ptr->r.record.x.xy, ptr->r.record.x.treg, + ptr->r.record.x.xy, ptr->r.record.x.where.reg, ptr->r.record.x.t); break; default: @@ -2558,6 +2740,28 @@ calc_record_size (list) return vbyte_count; } +/* Return the number of bits set in the input value. + Perhaps this has a better place... */ +#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) +# define popcount __builtin_popcount +#else +static int +popcount (unsigned x) +{ + static const unsigned char popcnt[16] = + { + 0, 1, 1, 2, + 1, 2, 2, 3, + 1, 2, 2, 3, + 2, 3, 3, 4 + }; + + if (x < NELEMS (popcnt)) + return popcnt[x]; + return popcnt[x % NELEMS (popcnt)] + popcount (x / NELEMS (popcnt)); +} +#endif + /* Update IMASK bitmask to reflect the fact that one or more registers of type TYPE are saved starting at instruction with index T. If N bits are set in REGMASK, it is assumed that instructions T through @@ -2689,6 +2893,13 @@ slot_index (slot_addr, slot_frag, first_addr, first_frag, before_relax) /* Move to the beginning of the next frag. */ first_frag = first_frag->fr_next; first_addr = (unsigned long) &first_frag->fr_literal; + + /* This can happen if there is section switching in the middle of a + function, causing the frag chain for the function to be broken. + It is too difficult to recover safely from this problem, so we just + exit with an error. */ + if (first_frag == NULL) + as_fatal ("Section switching in code is not supported."); } /* Add in the used part of the last frag. */ @@ -2770,7 +2981,13 @@ fixup_unw_records (list, before_relax) break; } case epilogue: - ptr->r.record.b.t = rlen - 1 - t; + if (t < rlen) + ptr->r.record.b.t = rlen - 1 - t; + else + /* This happens when a memory-stack-less procedure uses a + ".restore sp" directive at the end of a region to pop + the frame state. */ + ptr->r.record.b.t = 0; break; case mem_stack_f: @@ -2801,7 +3018,7 @@ fixup_unw_records (list, before_relax) case frgr_mem: if (!region) { - as_bad ("frgr_mem record before region record!\n"); + as_bad ("frgr_mem record before region record!"); return; } region->r.record.r.mask.fr_mem |= ptr->r.record.p.frmask; @@ -2812,25 +3029,25 @@ fixup_unw_records (list, before_relax) case fr_mem: if (!region) { - as_bad ("fr_mem record before region record!\n"); + as_bad ("fr_mem record before region record!"); return; } - region->r.record.r.mask.fr_mem |= ptr->r.record.p.rmask; - set_imask (region, ptr->r.record.p.rmask, t, 1); + region->r.record.r.mask.fr_mem |= ptr->r.record.p.frmask; + set_imask (region, ptr->r.record.p.frmask, t, 1); break; case gr_mem: if (!region) { - as_bad ("gr_mem record before region record!\n"); + as_bad ("gr_mem record before region record!"); return; } - region->r.record.r.mask.gr_mem |= ptr->r.record.p.rmask; - set_imask (region, ptr->r.record.p.rmask, t, 2); + region->r.record.r.mask.gr_mem |= ptr->r.record.p.grmask; + set_imask (region, ptr->r.record.p.grmask, t, 2); break; case br_mem: if (!region) { - as_bad ("br_mem record before region record!\n"); + as_bad ("br_mem record before region record!"); return; } region->r.record.r.mask.br_mem |= ptr->r.record.p.brmask; @@ -2840,7 +3057,7 @@ fixup_unw_records (list, before_relax) case gr_gr: if (!region) { - as_bad ("gr_gr record before region record!\n"); + as_bad ("gr_gr record before region record!"); return; } set_imask (region, ptr->r.record.p.grmask, t, 2); @@ -2848,7 +3065,7 @@ fixup_unw_records (list, before_relax) case br_gr: if (!region) { - as_bad ("br_gr record before region record!\n"); + as_bad ("br_gr record before region record!"); return; } set_imask (region, ptr->r.record.p.brmask, t, 3); @@ -2879,8 +3096,11 @@ ia64_estimate_size_before_relax (fragS *frag, pad = len % md.pointer_size; if (pad != 0) len += md.pointer_size - pad; - /* Add 8 for the header + a pointer for the personality offset. */ - size = len + 8 + md.pointer_size; + /* Add 8 for the header. */ + size = len + 8; + /* Add a pointer for the personality offset. */ + if (frag->fr_offset) + size += md.pointer_size; /* fr_var carries the max_chars that we created the fragment with. We must, of course, have allocated enough memory earlier. */ @@ -2907,8 +3127,11 @@ ia64_convert_frag (fragS *frag) pad = len % md.pointer_size; if (pad != 0) len += md.pointer_size - pad; - /* Add 8 for the header + a pointer for the personality offset. */ - size = len + 8 + md.pointer_size; + /* Add 8 for the header. */ + size = len + 8; + /* Add a pointer for the personality offset. */ + if (frag->fr_offset) + size += md.pointer_size; /* fr_var carries the max_chars that we created the fragment with. We must, of course, have allocated enough memory earlier. */ @@ -2949,17 +3172,43 @@ ia64_convert_frag (fragS *frag) } static int -convert_expr_to_ab_reg (e, ab, regp) - expressionS *e; +parse_predicate_and_operand (e, qp, po) + expressionS * e; + unsigned * qp; + const char * po; +{ + int sep = parse_operand (e, ','); + + *qp = e->X_add_number - REG_P; + if (e->X_op != O_register || *qp > 63) + { + as_bad ("First operand to .%s must be a predicate", po); + *qp = 0; + } + else if (*qp == 0) + as_warn ("Pointless use of p0 as first operand to .%s", po); + if (sep == ',') + sep = parse_operand (e, ','); + else + e->X_op = O_absent; + return sep; +} + +static void +convert_expr_to_ab_reg (e, ab, regp, po, n) + const expressionS *e; unsigned int *ab; unsigned int *regp; + const char * po; + int n; { - unsigned int reg; + unsigned int reg = e->X_add_number; + + *ab = *regp = 0; /* Anything valid is good here. */ if (e->X_op != O_register) - return 0; + reg = REG_GR; /* Anything invalid is good here. */ - reg = e->X_add_number; if (reg >= (REG_GR + 4) && reg <= (REG_GR + 7)) { *ab = 0; @@ -2994,31 +3243,33 @@ convert_expr_to_ab_reg (e, ab, regp) case REG_AR + AR_LC: *regp = 10; break; default: - return 0; + as_bad ("Operand %d to .%s must be a preserved register", n, po); + break; } } - return 1; } -static int -convert_expr_to_xy_reg (e, xy, regp) - expressionS *e; +static void +convert_expr_to_xy_reg (e, xy, regp, po, n) + const expressionS *e; unsigned int *xy; unsigned int *regp; + const char * po; + int n; { - unsigned int reg; + unsigned int reg = e->X_add_number; + + *xy = *regp = 0; /* Anything valid is good here. */ if (e->X_op != O_register) - return 0; + reg = REG_GR; /* Anything invalid is good here. */ - reg = e->X_add_number; - - if (/* reg >= REG_GR && */ reg <= (REG_GR + 127)) + if (reg >= (REG_GR + 1) && reg <= (REG_GR + 127)) { *xy = 0; *regp = reg - REG_GR; } - else if (reg >= REG_FR && reg <= (REG_FR + 127)) + else if (reg >= (REG_FR + 2) && reg <= (REG_FR + 127)) { *xy = 1; *regp = reg - REG_FR; @@ -3029,8 +3280,7 @@ convert_expr_to_xy_reg (e, xy, regp) *regp = reg - REG_BR; } else - return -1; - return 1; + as_bad ("Operand %d to .%s must be a writable register", n, po); } static void @@ -3045,17 +3295,31 @@ static void dot_radix (dummy) int dummy ATTRIBUTE_UNUSED; { - int radix; + char *radix; + int ch; SKIP_WHITESPACE (); - radix = *input_line_pointer++; - if (radix != 'C' && !is_end_of_line[(unsigned char) radix]) - { - as_bad ("Radix `%c' unsupported", *input_line_pointer); - ignore_rest_of_line (); - return; - } + if (is_it_end_of_statement ()) + return; + radix = input_line_pointer; + ch = get_symbol_end (); + ia64_canonicalize_symbol_name (radix); + if (strcasecmp (radix, "C")) + as_bad ("Radix `%s' unsupported or invalid", radix); + *input_line_pointer = ch; + demand_empty_rest_of_line (); +} + +/* Helper function for .loc directives. If the assembler is not generating + line number info, then we need to remember which instructions have a .loc + directive, and only call dwarf2_gen_line_info for those instructions. */ + +static void +dot_loc (int x) +{ + CURR_SLOT.loc_directive_seen = 1; + dwarf2_directive_loc (x); } /* .sbss, .bss etc. are macros that expand into ".section SECNAME". */ @@ -3066,19 +3330,112 @@ dot_special_section (which) set_section ((char *) special_section_name[which]); } -static void -add_unwind_entry (ptr) - unw_rec_list *ptr; +/* Return -1 for warning and 0 for error. */ + +static int +unwind_diagnostic (const char * region, const char *directive) { - if (unwind.tail) - unwind.tail->next = ptr; + if (md.unwind_check == unwind_check_warning) + { + as_warn (".%s outside of %s", directive, region); + return -1; + } else - unwind.list = ptr; - unwind.tail = ptr; + { + as_bad (".%s outside of %s", directive, region); + ignore_rest_of_line (); + return 0; + } +} + +/* Return 1 if a directive is in a procedure, -1 if a directive isn't in + a procedure but the unwind directive check is set to warning, 0 if + a directive isn't in a procedure and the unwind directive check is set + to error. */ + +static int +in_procedure (const char *directive) +{ + if (unwind.proc_pending.sym + && (!unwind.saved_text_seg || strcmp (directive, "endp") == 0)) + return 1; + return unwind_diagnostic ("procedure", directive); +} + +/* Return 1 if a directive is in a prologue, -1 if a directive isn't in + a prologue but the unwind directive check is set to warning, 0 if + a directive isn't in a prologue and the unwind directive check is set + to error. */ + +static int +in_prologue (const char *directive) +{ + int in = in_procedure (directive); + + if (in > 0 && !unwind.prologue) + in = unwind_diagnostic ("prologue", directive); + check_pending_save (); + return in; +} + +/* Return 1 if a directive is in a body, -1 if a directive isn't in + a body but the unwind directive check is set to warning, 0 if + a directive isn't in a body and the unwind directive check is set + to error. */ + +static int +in_body (const char *directive) +{ + int in = in_procedure (directive); + + if (in > 0 && !unwind.body) + in = unwind_diagnostic ("body region", directive); + return in; +} + +static void +add_unwind_entry (ptr, sep) + unw_rec_list *ptr; + int sep; +{ + if (ptr) + { + if (unwind.tail) + unwind.tail->next = ptr; + else + unwind.list = ptr; + unwind.tail = ptr; + + /* The current entry can in fact be a chain of unwind entries. */ + if (unwind.current_entry == NULL) + unwind.current_entry = ptr; + } /* The current entry can in fact be a chain of unwind entries. */ if (unwind.current_entry == NULL) unwind.current_entry = ptr; + + if (sep == ',') + { + /* Parse a tag permitted for the current directive. */ + int ch; + + SKIP_WHITESPACE (); + ch = get_symbol_end (); + /* FIXME: For now, just issue a warning that this isn't implemented. */ + { + static int warned; + + if (!warned) + { + warned = 1; + as_warn ("Tags on unwind pseudo-ops aren't supported, yet"); + } + } + *input_line_pointer = ch; + } + if (sep != NOT_A_CHAR) + demand_empty_rest_of_line (); } static void @@ -3086,13 +3443,19 @@ dot_fframe (dummy) int dummy ATTRIBUTE_UNUSED; { expressionS e; + int sep; - parse_operand (&e); + if (!in_prologue ("fframe")) + return; + + sep = parse_operand (&e, ','); if (e.X_op != O_constant) - as_bad ("Operand to .fframe must be a constant"); - else - add_unwind_entry (output_mem_stack_f (e.X_add_number)); + { + as_bad ("First operand to .fframe must be a constant"); + e.X_add_number = 0; + } + add_unwind_entry (output_mem_stack_f (e.X_add_number), sep); } static void @@ -3101,49 +3464,47 @@ dot_vframe (dummy) { expressionS e; unsigned reg; + int sep; - parse_operand (&e); + if (!in_prologue ("vframe")) + return; + + sep = parse_operand (&e, ','); reg = e.X_add_number - REG_GR; - if (e.X_op == O_register && reg < 128) + if (e.X_op != O_register || reg > 127) { - add_unwind_entry (output_mem_stack_v ()); - if (! (unwind.prologue_mask & 2)) - add_unwind_entry (output_psp_gr (reg)); + as_bad ("First operand to .vframe must be a general register"); + reg = 0; } - else - as_bad ("First operand to .vframe must be a general register"); + add_unwind_entry (output_mem_stack_v (), sep); + if (! (unwind.prologue_mask & 2)) + add_unwind_entry (output_psp_gr (reg), NOT_A_CHAR); + else if (reg != unwind.prologue_gr + + (unsigned) popcount (unwind.prologue_mask & (-2 << 1))) + as_warn ("Operand of .vframe contradicts .prologue"); } static void -dot_vframesp (dummy) - int dummy ATTRIBUTE_UNUSED; +dot_vframesp (psp) + int psp; { expressionS e; + int sep; - parse_operand (&e); - if (e.X_op == O_constant) + if (psp) + as_warn (".vframepsp is meaningless, assuming .vframesp was meant"); + + if (!in_prologue ("vframesp")) + return; + + sep = parse_operand (&e, ','); + if (e.X_op != O_constant) { - add_unwind_entry (output_mem_stack_v ()); - add_unwind_entry (output_psp_sprel (e.X_add_number)); + as_bad ("Operand to .vframesp must be a constant (sp-relative offset)"); + e.X_add_number = 0; } - else - as_bad ("Operand to .vframesp must be a constant (sp-relative offset)"); -} - -static void -dot_vframepsp (dummy) - int dummy ATTRIBUTE_UNUSED; -{ - expressionS e; - - parse_operand (&e); - if (e.X_op == O_constant) - { - add_unwind_entry (output_mem_stack_v ()); - add_unwind_entry (output_psp_sprel (e.X_add_number)); - } - else - as_bad ("Operand to .vframepsp must be a constant (psp-relative offset)"); + add_unwind_entry (output_mem_stack_v (), sep); + add_unwind_entry (output_psp_sprel (e.X_add_number), NOT_A_CHAR); } static void @@ -3151,100 +3512,115 @@ dot_save (dummy) int dummy ATTRIBUTE_UNUSED; { expressionS e1, e2; + unsigned reg1, reg2; int sep; - int reg1, reg2; - sep = parse_operand (&e1); - if (sep != ',') - as_bad ("No second operand to .save"); - sep = parse_operand (&e2); + if (!in_prologue ("save")) + return; + + sep = parse_operand (&e1, ','); + if (sep == ',') + sep = parse_operand (&e2, ','); + else + e2.X_op = O_absent; reg1 = e1.X_add_number; - reg2 = e2.X_add_number - REG_GR; - /* Make sure its a valid ar.xxx reg, OR its br0, aka 'rp'. */ - if (e1.X_op == O_register) + if (e1.X_op != O_register) { - if (e2.X_op == O_register && reg2 >= 0 && reg2 < 128) - { - switch (reg1) - { - case REG_AR + AR_BSP: - add_unwind_entry (output_bsp_when ()); - add_unwind_entry (output_bsp_gr (reg2)); - break; - case REG_AR + AR_BSPSTORE: - add_unwind_entry (output_bspstore_when ()); - add_unwind_entry (output_bspstore_gr (reg2)); - break; - case REG_AR + AR_RNAT: - add_unwind_entry (output_rnat_when ()); - add_unwind_entry (output_rnat_gr (reg2)); - break; - case REG_AR + AR_UNAT: - add_unwind_entry (output_unat_when ()); - add_unwind_entry (output_unat_gr (reg2)); - break; - case REG_AR + AR_FPSR: - add_unwind_entry (output_fpsr_when ()); - add_unwind_entry (output_fpsr_gr (reg2)); - break; - case REG_AR + AR_PFS: - add_unwind_entry (output_pfs_when ()); - if (! (unwind.prologue_mask & 4)) - add_unwind_entry (output_pfs_gr (reg2)); - break; - case REG_AR + AR_LC: - add_unwind_entry (output_lc_when ()); - add_unwind_entry (output_lc_gr (reg2)); - break; - case REG_BR: - add_unwind_entry (output_rp_when ()); - if (! (unwind.prologue_mask & 8)) - add_unwind_entry (output_rp_gr (reg2)); - break; - case REG_PR: - add_unwind_entry (output_preds_when ()); - if (! (unwind.prologue_mask & 1)) - add_unwind_entry (output_preds_gr (reg2)); - break; - case REG_PRIUNAT: - add_unwind_entry (output_priunat_when_gr ()); - add_unwind_entry (output_priunat_gr (reg2)); - break; - default: - as_bad ("First operand not a valid register"); - } - } - else - as_bad (" Second operand not a valid register"); + as_bad ("First operand to .save not a register"); + reg1 = REG_PR; /* Anything valid is good here. */ + } + reg2 = e2.X_add_number - REG_GR; + if (e2.X_op != O_register || reg2 > 127) + { + as_bad ("Second operand to .save not a valid register"); + reg2 = 0; + } + switch (reg1) + { + case REG_AR + AR_BSP: + add_unwind_entry (output_bsp_when (), sep); + add_unwind_entry (output_bsp_gr (reg2), NOT_A_CHAR); + break; + case REG_AR + AR_BSPSTORE: + add_unwind_entry (output_bspstore_when (), sep); + add_unwind_entry (output_bspstore_gr (reg2), NOT_A_CHAR); + break; + case REG_AR + AR_RNAT: + add_unwind_entry (output_rnat_when (), sep); + add_unwind_entry (output_rnat_gr (reg2), NOT_A_CHAR); + break; + case REG_AR + AR_UNAT: + add_unwind_entry (output_unat_when (), sep); + add_unwind_entry (output_unat_gr (reg2), NOT_A_CHAR); + break; + case REG_AR + AR_FPSR: + add_unwind_entry (output_fpsr_when (), sep); + add_unwind_entry (output_fpsr_gr (reg2), NOT_A_CHAR); + break; + case REG_AR + AR_PFS: + add_unwind_entry (output_pfs_when (), sep); + if (! (unwind.prologue_mask & 4)) + add_unwind_entry (output_pfs_gr (reg2), NOT_A_CHAR); + else if (reg2 != unwind.prologue_gr + + (unsigned) popcount (unwind.prologue_mask & (-4 << 1))) + as_warn ("Second operand of .save contradicts .prologue"); + break; + case REG_AR + AR_LC: + add_unwind_entry (output_lc_when (), sep); + add_unwind_entry (output_lc_gr (reg2), NOT_A_CHAR); + break; + case REG_BR: + add_unwind_entry (output_rp_when (), sep); + if (! (unwind.prologue_mask & 8)) + add_unwind_entry (output_rp_gr (reg2), NOT_A_CHAR); + else if (reg2 != unwind.prologue_gr) + as_warn ("Second operand of .save contradicts .prologue"); + break; + case REG_PR: + add_unwind_entry (output_preds_when (), sep); + if (! (unwind.prologue_mask & 1)) + add_unwind_entry (output_preds_gr (reg2), NOT_A_CHAR); + else if (reg2 != unwind.prologue_gr + + (unsigned) popcount (unwind.prologue_mask & (-1 << 1))) + as_warn ("Second operand of .save contradicts .prologue"); + break; + case REG_PRIUNAT: + add_unwind_entry (output_priunat_when_gr (), sep); + add_unwind_entry (output_priunat_gr (reg2), NOT_A_CHAR); + break; + default: + as_bad ("First operand to .save not a valid register"); + add_unwind_entry (NULL, sep); + break; } - else - as_bad ("First operand not a register"); } static void dot_restore (dummy) int dummy ATTRIBUTE_UNUSED; { - expressionS e1, e2; + expressionS e1; unsigned long ecount; /* # of _additional_ regions to pop */ int sep; - sep = parse_operand (&e1); + if (!in_body ("restore")) + return; + + sep = parse_operand (&e1, ','); if (e1.X_op != O_register || e1.X_add_number != REG_GR + 12) - { - as_bad ("First operand to .restore must be stack pointer (sp)"); - return; - } + as_bad ("First operand to .restore must be stack pointer (sp)"); if (sep == ',') { - parse_operand (&e2); + expressionS e2; + + sep = parse_operand (&e2, ','); if (e2.X_op != O_constant || e2.X_add_number < 0) { as_bad ("Second operand to .restore must be a constant >= 0"); - return; + e2.X_add_number = 0; } ecount = e2.X_add_number; } @@ -3255,10 +3631,10 @@ dot_restore (dummy) { as_bad ("Epilogue count of %lu exceeds number of nested prologues (%u)", ecount + 1, unwind.prologue_count); - return; + ecount = 0; } - add_unwind_entry (output_epilogue (ecount)); + add_unwind_entry (output_epilogue (ecount), sep); if (ecount < unwind.prologue_count) unwind.prologue_count -= ecount + 1; @@ -3267,64 +3643,155 @@ dot_restore (dummy) } static void -dot_restorereg (dummy) - int dummy ATTRIBUTE_UNUSED; -{ - unsigned int ab, reg; - expressionS e; - - parse_operand (&e); - - if (!convert_expr_to_ab_reg (&e, &ab, ®)) - { - as_bad ("First operand to .restorereg must be a preserved register"); - return; - } - add_unwind_entry (output_spill_reg (ab, reg, 0, 0)); -} - -static void -dot_restorereg_p (dummy) - int dummy ATTRIBUTE_UNUSED; +dot_restorereg (pred) + int pred; { unsigned int qp, ab, reg; - expressionS e1, e2; + expressionS e; int sep; + const char * const po = pred ? "restorereg.p" : "restorereg"; - sep = parse_operand (&e1); - if (sep != ',') + if (!in_procedure (po)) + return; + + if (pred) + sep = parse_predicate_and_operand (&e, &qp, po); + else { - as_bad ("No second operand to .restorereg.p"); + sep = parse_operand (&e, ','); + qp = 0; + } + convert_expr_to_ab_reg (&e, &ab, ®, po, 1 + pred); + + add_unwind_entry (output_spill_reg (ab, reg, 0, 0, qp), sep); +} + +static char *special_linkonce_name[] = + { + ".gnu.linkonce.ia64unw.", ".gnu.linkonce.ia64unwi." + }; + +static void +start_unwind_section (const segT text_seg, int sec_index) +{ + /* + Use a slightly ugly scheme to derive the unwind section names from + the text section name: + + text sect. unwind table sect. + name: name: comments: + ---------- ----------------- -------------------------------- + .text .IA_64.unwind + .text.foo .IA_64.unwind.text.foo + .foo .IA_64.unwind.foo + .gnu.linkonce.t.foo + .gnu.linkonce.ia64unw.foo + _info .IA_64.unwind_info gas issues error message (ditto) + _infoFOO .IA_64.unwind_infoFOO gas issues error message (ditto) + + This mapping is done so that: + + (a) An object file with unwind info only in .text will use + unwind section names .IA_64.unwind and .IA_64.unwind_info. + This follows the letter of the ABI and also ensures backwards + compatibility with older toolchains. + + (b) An object file with unwind info in multiple text sections + will use separate unwind sections for each text section. + This allows us to properly set the "sh_info" and "sh_link" + fields in SHT_IA_64_UNWIND as required by the ABI and also + lets GNU ld support programs with multiple segments + containing unwind info (as might be the case for certain + embedded applications). + + (c) An error is issued if there would be a name clash. + */ + + const char *text_name, *sec_text_name; + char *sec_name; + const char *prefix = special_section_name [sec_index]; + const char *suffix; + size_t prefix_len, suffix_len, sec_name_len; + + sec_text_name = segment_name (text_seg); + text_name = sec_text_name; + if (strncmp (text_name, "_info", 5) == 0) + { + as_bad ("Illegal section name `%s' (causes unwind section name clash)", + text_name); + ignore_rest_of_line (); return; } + if (strcmp (text_name, ".text") == 0) + text_name = ""; - parse_operand (&e2); - - qp = e1.X_add_number - REG_P; - if (e1.X_op != O_register || qp > 63) + /* Build the unwind section name by appending the (possibly stripped) + text section name to the unwind prefix. */ + suffix = text_name; + if (strncmp (text_name, ".gnu.linkonce.t.", + sizeof (".gnu.linkonce.t.") - 1) == 0) { - as_bad ("First operand to .restorereg.p must be a predicate"); - return; + prefix = special_linkonce_name [sec_index - SPECIAL_SECTION_UNWIND]; + suffix += sizeof (".gnu.linkonce.t.") - 1; } - if (!convert_expr_to_ab_reg (&e2, &ab, ®)) + prefix_len = strlen (prefix); + suffix_len = strlen (suffix); + sec_name_len = prefix_len + suffix_len; + sec_name = alloca (sec_name_len + 1); + memcpy (sec_name, prefix, prefix_len); + memcpy (sec_name + prefix_len, suffix, suffix_len); + sec_name [sec_name_len] = '\0'; + + /* Handle COMDAT group. */ + if ((text_seg->flags & SEC_LINK_ONCE) != 0 + && (elf_section_flags (text_seg) & SHF_GROUP) != 0) { - as_bad ("Second operand to .restorereg.p must be a preserved register"); - return; + char *section; + size_t len, group_name_len; + const char *group_name = elf_group_name (text_seg); + + if (group_name == NULL) + { + as_bad ("Group section `%s' has no group signature", + sec_text_name); + ignore_rest_of_line (); + return; + } + /* We have to construct a fake section directive. */ + group_name_len = strlen (group_name); + len = (sec_name_len + + 16 /* ,"aG",@progbits, */ + + group_name_len /* ,group_name */ + + 7); /* ,comdat */ + + section = alloca (len + 1); + memcpy (section, sec_name, sec_name_len); + memcpy (section + sec_name_len, ",\"aG\",@progbits,", 16); + memcpy (section + sec_name_len + 16, group_name, group_name_len); + memcpy (section + len - 7, ",comdat", 7); + section [len] = '\0'; + set_section (section); } - add_unwind_entry (output_spill_reg_p (ab, reg, 0, 0, qp)); + else + { + set_section (sec_name); + bfd_set_section_flags (stdoutput, now_seg, + SEC_LOAD | SEC_ALLOC | SEC_READONLY); + } + + elf_linked_to_section (now_seg) = text_seg; } static void -generate_unwind_image (text_name) - const char *text_name; +generate_unwind_image (const segT text_seg) { int size, pad; unw_rec_list *list; /* Mark the end of the unwind info, so that we can compute the size of the last unwind region. */ - add_unwind_entry (output_endp ()); + add_unwind_entry (output_endp (), NOT_A_CHAR); /* Force out pending instructions, to make sure all unwind records have a valid slot_number field. */ @@ -3342,22 +3809,20 @@ generate_unwind_image (text_name) pad = size % md.pointer_size; if (pad != 0) size += md.pointer_size - pad; - /* Add 8 for the header + a pointer for the personality - offset. */ - size += 8 + md.pointer_size; + /* Add 8 for the header. */ + size += 8; + /* Add a pointer for the personality offset. */ + if (unwind.personality_routine) + size += md.pointer_size; } /* If there are unwind records, switch sections, and output the info. */ if (size != 0) { - char *sec_name; expressionS exp; bfd_reloc_code_real_type reloc; - make_unw_section_name (SPECIAL_SECTION_UNWIND_INFO, text_name, sec_name); - set_section (sec_name); - bfd_set_section_flags (stdoutput, now_seg, - SEC_LOAD | SEC_ALLOC | SEC_READONLY); + start_unwind_section (text_seg, SPECIAL_SECTION_UNWIND_INFO); /* Make sure the section has 4 byte alignment for ILP32 and 8 byte alignment for LP64. */ @@ -3368,7 +3833,8 @@ generate_unwind_image (text_name) unwind.info = expr_build_dot (); frag_var (rs_machine_dependent, size, size, 0, 0, - (offsetT) unwind.personality_routine, (char *) list); + (offsetT) (long) unwind.personality_routine, + (char *) list); /* Add the personality address to the image. */ if (unwind.personality_routine != 0) @@ -3406,13 +3872,8 @@ static void dot_handlerdata (dummy) int dummy ATTRIBUTE_UNUSED; { - const char *text_name = segment_name (now_seg); - - /* If text section name starts with ".text" (which it should), - strip this prefix off. */ - if (strcmp (text_name, ".text") == 0) - text_name = ""; - + if (!in_procedure ("handlerdata")) + return; unwind.force_unwind_entry = 1; /* Remember which segment we're in so we can switch back after .endp */ @@ -3422,7 +3883,7 @@ dot_handlerdata (dummy) /* Generate unwind info into unwind-info section and then leave that section as the currently active one so dataXX directives go into the language specific data area of the unwind info block. */ - generate_unwind_image (text_name); + generate_unwind_image (now_seg); demand_empty_rest_of_line (); } @@ -3430,6 +3891,8 @@ static void dot_unwentry (dummy) int dummy ATTRIBUTE_UNUSED; { + if (!in_procedure ("unwentry")) + return; unwind.force_unwind_entry = 1; demand_empty_rest_of_line (); } @@ -3441,12 +3904,17 @@ dot_altrp (dummy) expressionS e; unsigned reg; - parse_operand (&e); + if (!in_prologue ("altrp")) + return; + + parse_operand (&e, 0); reg = e.X_add_number - REG_BR; - if (e.X_op == O_register && reg < 8) - add_unwind_entry (output_rp_br (reg)); - else - as_bad ("First operand not a valid branch register"); + if (e.X_op != O_register || reg > 7) + { + as_bad ("First operand to .altrp not a valid branch register"); + reg = 0; + } + add_unwind_entry (output_rp_br (reg), 0); } static void @@ -3456,168 +3924,210 @@ dot_savemem (psprel) expressionS e1, e2; int sep; int reg1, val; + const char * const po = psprel ? "savepsp" : "savesp"; - sep = parse_operand (&e1); - if (sep != ',') - as_bad ("No second operand to .save%ssp", psprel ? "p" : ""); - sep = parse_operand (&e2); + if (!in_prologue (po)) + return; + + sep = parse_operand (&e1, ','); + if (sep == ',') + sep = parse_operand (&e2, ','); + else + e2.X_op = O_absent; reg1 = e1.X_add_number; val = e2.X_add_number; /* Make sure its a valid ar.xxx reg, OR its br0, aka 'rp'. */ - if (e1.X_op == O_register) + if (e1.X_op != O_register) { - if (e2.X_op == O_constant) - { - switch (reg1) - { - case REG_AR + AR_BSP: - add_unwind_entry (output_bsp_when ()); - add_unwind_entry ((psprel - ? output_bsp_psprel - : output_bsp_sprel) (val)); - break; - case REG_AR + AR_BSPSTORE: - add_unwind_entry (output_bspstore_when ()); - add_unwind_entry ((psprel - ? output_bspstore_psprel - : output_bspstore_sprel) (val)); - break; - case REG_AR + AR_RNAT: - add_unwind_entry (output_rnat_when ()); - add_unwind_entry ((psprel - ? output_rnat_psprel - : output_rnat_sprel) (val)); - break; - case REG_AR + AR_UNAT: - add_unwind_entry (output_unat_when ()); - add_unwind_entry ((psprel - ? output_unat_psprel - : output_unat_sprel) (val)); - break; - case REG_AR + AR_FPSR: - add_unwind_entry (output_fpsr_when ()); - add_unwind_entry ((psprel - ? output_fpsr_psprel - : output_fpsr_sprel) (val)); - break; - case REG_AR + AR_PFS: - add_unwind_entry (output_pfs_when ()); - add_unwind_entry ((psprel - ? output_pfs_psprel - : output_pfs_sprel) (val)); - break; - case REG_AR + AR_LC: - add_unwind_entry (output_lc_when ()); - add_unwind_entry ((psprel - ? output_lc_psprel - : output_lc_sprel) (val)); - break; - case REG_BR: - add_unwind_entry (output_rp_when ()); - add_unwind_entry ((psprel - ? output_rp_psprel - : output_rp_sprel) (val)); - break; - case REG_PR: - add_unwind_entry (output_preds_when ()); - add_unwind_entry ((psprel - ? output_preds_psprel - : output_preds_sprel) (val)); - break; - case REG_PRIUNAT: - add_unwind_entry (output_priunat_when_mem ()); - add_unwind_entry ((psprel - ? output_priunat_psprel - : output_priunat_sprel) (val)); - break; - default: - as_bad ("First operand not a valid register"); - } - } - else - as_bad (" Second operand not a valid constant"); + as_bad ("First operand to .%s not a register", po); + reg1 = REG_PR; /* Anything valid is good here. */ + } + if (e2.X_op != O_constant) + { + as_bad ("Second operand to .%s not a constant", po); + val = 0; + } + + switch (reg1) + { + case REG_AR + AR_BSP: + add_unwind_entry (output_bsp_when (), sep); + add_unwind_entry ((psprel + ? output_bsp_psprel + : output_bsp_sprel) (val), NOT_A_CHAR); + break; + case REG_AR + AR_BSPSTORE: + add_unwind_entry (output_bspstore_when (), sep); + add_unwind_entry ((psprel + ? output_bspstore_psprel + : output_bspstore_sprel) (val), NOT_A_CHAR); + break; + case REG_AR + AR_RNAT: + add_unwind_entry (output_rnat_when (), sep); + add_unwind_entry ((psprel + ? output_rnat_psprel + : output_rnat_sprel) (val), NOT_A_CHAR); + break; + case REG_AR + AR_UNAT: + add_unwind_entry (output_unat_when (), sep); + add_unwind_entry ((psprel + ? output_unat_psprel + : output_unat_sprel) (val), NOT_A_CHAR); + break; + case REG_AR + AR_FPSR: + add_unwind_entry (output_fpsr_when (), sep); + add_unwind_entry ((psprel + ? output_fpsr_psprel + : output_fpsr_sprel) (val), NOT_A_CHAR); + break; + case REG_AR + AR_PFS: + add_unwind_entry (output_pfs_when (), sep); + add_unwind_entry ((psprel + ? output_pfs_psprel + : output_pfs_sprel) (val), NOT_A_CHAR); + break; + case REG_AR + AR_LC: + add_unwind_entry (output_lc_when (), sep); + add_unwind_entry ((psprel + ? output_lc_psprel + : output_lc_sprel) (val), NOT_A_CHAR); + break; + case REG_BR: + add_unwind_entry (output_rp_when (), sep); + add_unwind_entry ((psprel + ? output_rp_psprel + : output_rp_sprel) (val), NOT_A_CHAR); + break; + case REG_PR: + add_unwind_entry (output_preds_when (), sep); + add_unwind_entry ((psprel + ? output_preds_psprel + : output_preds_sprel) (val), NOT_A_CHAR); + break; + case REG_PRIUNAT: + add_unwind_entry (output_priunat_when_mem (), sep); + add_unwind_entry ((psprel + ? output_priunat_psprel + : output_priunat_sprel) (val), NOT_A_CHAR); + break; + default: + as_bad ("First operand to .%s not a valid register", po); + add_unwind_entry (NULL, sep); + break; } - else - as_bad ("First operand not a register"); } static void dot_saveg (dummy) int dummy ATTRIBUTE_UNUSED; { - expressionS e1, e2; + expressionS e; + unsigned grmask; int sep; - sep = parse_operand (&e1); - if (sep == ',') - parse_operand (&e2); - if (e1.X_op != O_constant) - as_bad ("First operand to .save.g must be a constant."); - else + if (!in_prologue ("save.g")) + return; + + sep = parse_operand (&e, ','); + + grmask = e.X_add_number; + if (e.X_op != O_constant + || e.X_add_number <= 0 + || e.X_add_number > 0xf) { - int grmask = e1.X_add_number; - if (sep != ',') - add_unwind_entry (output_gr_mem (grmask)); - else - { - int reg = e2.X_add_number - REG_GR; - if (e2.X_op == O_register && reg >= 0 && reg < 128) - add_unwind_entry (output_gr_gr (grmask, reg)); - else - as_bad ("Second operand is an invalid register."); - } + as_bad ("First operand to .save.g must be a positive 4-bit constant"); + grmask = 0; } + + if (sep == ',') + { + unsigned reg; + int n = popcount (grmask); + + parse_operand (&e, 0); + reg = e.X_add_number - REG_GR; + if (e.X_op != O_register || reg > 127) + { + as_bad ("Second operand to .save.g must be a general register"); + reg = 0; + } + else if (reg > 128U - n) + { + as_bad ("Second operand to .save.g must be the first of %d general registers", n); + reg = 0; + } + add_unwind_entry (output_gr_gr (grmask, reg), 0); + } + else + add_unwind_entry (output_gr_mem (grmask), 0); } static void dot_savef (dummy) int dummy ATTRIBUTE_UNUSED; { - expressionS e1; - int sep; - sep = parse_operand (&e1); + expressionS e; - if (e1.X_op != O_constant) - as_bad ("Operand to .save.f must be a constant."); - else - add_unwind_entry (output_fr_mem (e1.X_add_number)); + if (!in_prologue ("save.f")) + return; + + parse_operand (&e, 0); + + if (e.X_op != O_constant + || e.X_add_number <= 0 + || e.X_add_number > 0xfffff) + { + as_bad ("Operand to .save.f must be a positive 20-bit constant"); + e.X_add_number = 0; + } + add_unwind_entry (output_fr_mem (e.X_add_number), 0); } static void dot_saveb (dummy) int dummy ATTRIBUTE_UNUSED; { - expressionS e1, e2; - unsigned int reg; - unsigned char sep; - int brmask; + expressionS e; + unsigned brmask; + int sep; - sep = parse_operand (&e1); - if (e1.X_op != O_constant) + if (!in_prologue ("save.b")) + return; + + sep = parse_operand (&e, ','); + + brmask = e.X_add_number; + if (e.X_op != O_constant + || e.X_add_number <= 0 + || e.X_add_number > 0x1f) { - as_bad ("First operand to .save.b must be a constant."); - return; + as_bad ("First operand to .save.b must be a positive 5-bit constant"); + brmask = 0; } - brmask = e1.X_add_number; if (sep == ',') { - sep = parse_operand (&e2); - reg = e2.X_add_number - REG_GR; - if (e2.X_op != O_register || reg > 127) + unsigned reg; + int n = popcount (brmask); + + parse_operand (&e, 0); + reg = e.X_add_number - REG_GR; + if (e.X_op != O_register || reg > 127) { - as_bad ("Second operand to .save.b must be a general register."); - return; + as_bad ("Second operand to .save.b must be a general register"); + reg = 0; } - add_unwind_entry (output_br_gr (brmask, e2.X_add_number)); + else if (reg > 128U - n) + { + as_bad ("Second operand to .save.b must be the first of %d general registers", n); + reg = 0; + } + add_unwind_entry (output_br_gr (brmask, reg), 0); } else - add_unwind_entry (output_br_mem (brmask)); - - if (!is_end_of_line[sep] && !is_it_end_of_statement ()) - demand_empty_rest_of_line (); + add_unwind_entry (output_br_mem (brmask), 0); } static void @@ -3625,19 +4135,38 @@ dot_savegf (dummy) int dummy ATTRIBUTE_UNUSED; { expressionS e1, e2; - int sep; - sep = parse_operand (&e1); - if (sep == ',') - parse_operand (&e2); - if (e1.X_op != O_constant || sep != ',' || e2.X_op != O_constant) - as_bad ("Both operands of .save.gf must be constants."); + if (!in_prologue ("save.gf")) + return; + + if (parse_operand (&e1, ',') == ',') + parse_operand (&e2, 0); else + e2.X_op = O_absent; + + if (e1.X_op != O_constant + || e1.X_add_number < 0 + || e1.X_add_number > 0xf) { - int grmask = e1.X_add_number; - int frmask = e2.X_add_number; - add_unwind_entry (output_frgr_mem (grmask, frmask)); + as_bad ("First operand to .save.gf must be a non-negative 4-bit constant"); + e1.X_op = O_absent; + e1.X_add_number = 0; } + if (e2.X_op != O_constant + || e2.X_add_number < 0 + || e2.X_add_number > 0xfffff) + { + as_bad ("Second operand to .save.gf must be a non-negative 20-bit constant"); + e2.X_op = O_absent; + e2.X_add_number = 0; + } + if (e1.X_op == O_constant + && e2.X_op == O_constant + && e1.X_add_number == 0 + && e2.X_add_number == 0) + as_bad ("Operands to .save.gf may not be both zero"); + + add_unwind_entry (output_frgr_mem (e1.X_add_number, e2.X_add_number), 0); } static void @@ -3645,182 +4174,93 @@ dot_spill (dummy) int dummy ATTRIBUTE_UNUSED; { expressionS e; - unsigned char sep; - sep = parse_operand (&e); - if (!is_end_of_line[sep] && !is_it_end_of_statement ()) - demand_empty_rest_of_line (); + if (!in_prologue ("spill")) + return; + + parse_operand (&e, 0); if (e.X_op != O_constant) - as_bad ("Operand to .spill must be a constant"); - else - add_unwind_entry (output_spill_base (e.X_add_number)); + { + as_bad ("Operand to .spill must be a constant"); + e.X_add_number = 0; + } + add_unwind_entry (output_spill_base (e.X_add_number), 0); } static void -dot_spillreg (dummy) - int dummy ATTRIBUTE_UNUSED; +dot_spillreg (pred) + int pred; { - int sep, ab, xy, reg, treg; - expressionS e1, e2; + int sep; + unsigned int qp, ab, xy, reg, treg; + expressionS e; + const char * const po = pred ? "spillreg.p" : "spillreg"; - sep = parse_operand (&e1); - if (sep != ',') + if (!in_procedure (po)) + return; + + if (pred) + sep = parse_predicate_and_operand (&e, &qp, po); + else { - as_bad ("No second operand to .spillreg"); - return; + sep = parse_operand (&e, ','); + qp = 0; } + convert_expr_to_ab_reg (&e, &ab, ®, po, 1 + pred); - parse_operand (&e2); + if (sep == ',') + sep = parse_operand (&e, ','); + else + e.X_op = O_absent; + convert_expr_to_xy_reg (&e, &xy, &treg, po, 2 + pred); - if (!convert_expr_to_ab_reg (&e1, &ab, ®)) - { - as_bad ("First operand to .spillreg must be a preserved register"); - return; - } - - if (!convert_expr_to_xy_reg (&e2, &xy, &treg)) - { - as_bad ("Second operand to .spillreg must be a register"); - return; - } - - add_unwind_entry (output_spill_reg (ab, reg, treg, xy)); + add_unwind_entry (output_spill_reg (ab, reg, treg, xy, qp), sep); } static void dot_spillmem (psprel) int psprel; { - expressionS e1, e2; - int sep, ab, reg; + expressionS e; + int pred = (psprel < 0), sep; + unsigned int qp, ab, reg; + const char * po; - sep = parse_operand (&e1); - if (sep != ',') + if (pred) { - as_bad ("Second operand missing"); - return; + psprel = ~psprel; + po = psprel ? "spillpsp.p" : "spillsp.p"; } + else + po = psprel ? "spillpsp" : "spillsp"; - parse_operand (&e2); + if (!in_procedure (po)) + return; - if (!convert_expr_to_ab_reg (&e1, &ab, ®)) + if (pred) + sep = parse_predicate_and_operand (&e, &qp, po); + else { - as_bad ("First operand to .spill%s must be a preserved register", - psprel ? "psp" : "sp"); - return; + sep = parse_operand (&e, ','); + qp = 0; } + convert_expr_to_ab_reg (&e, &ab, ®, po, 1 + pred); - if (e2.X_op != O_constant) + if (sep == ',') + sep = parse_operand (&e, ','); + else + e.X_op = O_absent; + if (e.X_op != O_constant) { - as_bad ("Second operand to .spill%s must be a constant", - psprel ? "psp" : "sp"); - return; + as_bad ("Operand %d to .%s must be a constant", 2 + pred, po); + e.X_add_number = 0; } if (psprel) - add_unwind_entry (output_spill_psprel (ab, reg, e2.X_add_number)); + add_unwind_entry (output_spill_psprel (ab, reg, e.X_add_number, qp), sep); else - add_unwind_entry (output_spill_sprel (ab, reg, e2.X_add_number)); -} - -static void -dot_spillreg_p (dummy) - int dummy ATTRIBUTE_UNUSED; -{ - int sep, ab, xy, reg, treg; - expressionS e1, e2, e3; - unsigned int qp; - - sep = parse_operand (&e1); - if (sep != ',') - { - as_bad ("No second and third operand to .spillreg.p"); - return; - } - - sep = parse_operand (&e2); - if (sep != ',') - { - as_bad ("No third operand to .spillreg.p"); - return; - } - - parse_operand (&e3); - - qp = e1.X_add_number - REG_P; - - if (e1.X_op != O_register || qp > 63) - { - as_bad ("First operand to .spillreg.p must be a predicate"); - return; - } - - if (!convert_expr_to_ab_reg (&e2, &ab, ®)) - { - as_bad ("Second operand to .spillreg.p must be a preserved register"); - return; - } - - if (!convert_expr_to_xy_reg (&e3, &xy, &treg)) - { - as_bad ("Third operand to .spillreg.p must be a register"); - return; - } - - add_unwind_entry (output_spill_reg_p (ab, reg, treg, xy, qp)); -} - -static void -dot_spillmem_p (psprel) - int psprel; -{ - expressionS e1, e2, e3; - int sep, ab, reg; - unsigned int qp; - - sep = parse_operand (&e1); - if (sep != ',') - { - as_bad ("Second operand missing"); - return; - } - - parse_operand (&e2); - if (sep != ',') - { - as_bad ("Second operand missing"); - return; - } - - parse_operand (&e3); - - qp = e1.X_add_number - REG_P; - if (e1.X_op != O_register || qp > 63) - { - as_bad ("First operand to .spill%s_p must be a predicate", - psprel ? "psp" : "sp"); - return; - } - - if (!convert_expr_to_ab_reg (&e2, &ab, ®)) - { - as_bad ("Second operand to .spill%s_p must be a preserved register", - psprel ? "psp" : "sp"); - return; - } - - if (e3.X_op != O_constant) - { - as_bad ("Third operand to .spill%s_p must be a constant", - psprel ? "psp" : "sp"); - return; - } - - if (psprel) - add_unwind_entry (output_spill_psprel_p (ab, reg, e3.X_add_number, qp)); - else - add_unwind_entry (output_spill_sprel_p (ab, reg, e3.X_add_number, qp)); + add_unwind_entry (output_spill_sprel (ab, reg, e.X_add_number, qp), sep); } static unsigned int @@ -3884,14 +4324,18 @@ dot_label_state (dummy) { expressionS e; - parse_operand (&e); - if (e.X_op != O_constant) + if (!in_body ("label_state")) + return; + + parse_operand (&e, 0); + if (e.X_op == O_constant) + save_prologue_count (e.X_add_number, unwind.prologue_count); + else { as_bad ("Operand to .label_state must be a constant"); - return; + e.X_add_number = 0; } - add_unwind_entry (output_label_state (e.X_add_number)); - save_prologue_count (e.X_add_number, unwind.prologue_count); + add_unwind_entry (output_label_state (e.X_add_number), 0); } static void @@ -3900,14 +4344,18 @@ dot_copy_state (dummy) { expressionS e; - parse_operand (&e); - if (e.X_op != O_constant) + if (!in_body ("copy_state")) + return; + + parse_operand (&e, 0); + if (e.X_op == O_constant) + unwind.prologue_count = get_saved_prologue_count (e.X_add_number); + else { as_bad ("Operand to .copy_state must be a constant"); - return; + e.X_add_number = 0; } - add_unwind_entry (output_copy_state (e.X_add_number)); - unwind.prologue_count = get_saved_prologue_count (e.X_add_number); + add_unwind_entry (output_copy_state (e.X_add_number), 0); } static void @@ -3917,29 +4365,28 @@ dot_unwabi (dummy) expressionS e1, e2; unsigned char sep; - sep = parse_operand (&e1); - if (sep != ',') - { - as_bad ("Second operand to .unwabi missing"); - return; - } - sep = parse_operand (&e2); - if (!is_end_of_line[sep] && !is_it_end_of_statement ()) - demand_empty_rest_of_line (); + if (!in_prologue ("unwabi")) + return; + + sep = parse_operand (&e1, ','); + if (sep == ',') + parse_operand (&e2, 0); + else + e2.X_op = O_absent; if (e1.X_op != O_constant) { as_bad ("First operand to .unwabi must be a constant"); - return; + e1.X_add_number = 0; } if (e2.X_op != O_constant) { as_bad ("Second operand to .unwabi must be a constant"); - return; + e2.X_add_number = 0; } - add_unwind_entry (output_unwabi (e1.X_add_number, e2.X_add_number)); + add_unwind_entry (output_unwabi (e1.X_add_number, e2.X_add_number), 0); } static void @@ -3947,6 +4394,8 @@ dot_personality (dummy) int dummy ATTRIBUTE_UNUSED; { char *name, *p, c; + if (!in_procedure ("personality")) + return; SKIP_WHITESPACE (); name = input_line_pointer; c = get_symbol_end (); @@ -3964,8 +4413,22 @@ dot_proc (dummy) { char *name, *p, c; symbolS *sym; + proc_pending *pending, *last_pending; + + if (unwind.proc_pending.sym) + { + (md.unwind_check == unwind_check_warning + ? as_warn + : as_bad) ("Missing .endp after previous .proc"); + while (unwind.proc_pending.next) + { + pending = unwind.proc_pending.next; + unwind.proc_pending.next = pending->next; + free (pending); + } + } + last_pending = NULL; - unwind.proc_start = expr_build_dot (); /* Parse names of main and alternate entry points and mark them as function symbols: */ while (1) @@ -3974,22 +4437,45 @@ dot_proc (dummy) name = input_line_pointer; c = get_symbol_end (); p = input_line_pointer; - sym = symbol_find_or_make (name); - if (unwind.proc_start == 0) + if (!*name) + as_bad ("Empty argument of .proc"); + else { - unwind.proc_start = sym; + sym = symbol_find_or_make (name); + if (S_IS_DEFINED (sym)) + as_bad ("`%s' was already defined", name); + else if (!last_pending) + { + unwind.proc_pending.sym = sym; + last_pending = &unwind.proc_pending; + } + else + { + pending = xmalloc (sizeof (*pending)); + pending->sym = sym; + last_pending = last_pending->next = pending; + } + symbol_get_bfdsym (sym)->flags |= BSF_FUNCTION; } - symbol_get_bfdsym (sym)->flags |= BSF_FUNCTION; *p = c; SKIP_WHITESPACE (); if (*input_line_pointer != ',') break; ++input_line_pointer; } + if (!last_pending) + { + unwind.proc_pending.sym = expr_build_dot (); + last_pending = &unwind.proc_pending; + } + last_pending->next = NULL; demand_empty_rest_of_line (); ia64_do_align (16); + unwind.prologue = 0; unwind.prologue_count = 0; + unwind.body = 0; + unwind.insn = 0; unwind.list = unwind.tail = unwind.current_entry = NULL; unwind.personality_routine = 0; } @@ -3998,52 +4484,86 @@ static void dot_body (dummy) int dummy ATTRIBUTE_UNUSED; { + if (!in_procedure ("body")) + return; + if (!unwind.prologue && !unwind.body && unwind.insn) + as_warn ("Initial .body should precede any instructions"); + check_pending_save (); + unwind.prologue = 0; unwind.prologue_mask = 0; + unwind.body = 1; - add_unwind_entry (output_body ()); - demand_empty_rest_of_line (); + add_unwind_entry (output_body (), 0); } static void dot_prologue (dummy) int dummy ATTRIBUTE_UNUSED; { - unsigned char sep; - int mask = 0, grsave = 0; + unsigned mask = 0, grsave = 0; + + if (!in_procedure ("prologue")) + return; + if (unwind.prologue) + { + as_bad (".prologue within prologue"); + ignore_rest_of_line (); + return; + } + if (!unwind.body && unwind.insn) + as_warn ("Initial .prologue should precede any instructions"); if (!is_it_end_of_statement ()) { - expressionS e1, e2; - sep = parse_operand (&e1); - if (sep != ',') - as_bad ("No second operand to .prologue"); - sep = parse_operand (&e2); - if (!is_end_of_line[sep] && !is_it_end_of_statement ()) - demand_empty_rest_of_line (); + expressionS e; + int n, sep = parse_operand (&e, ','); - if (e1.X_op == O_constant) - { - mask = e1.X_add_number; - - if (e2.X_op == O_constant) - grsave = e2.X_add_number; - else if (e2.X_op == O_register - && (grsave = e2.X_add_number - REG_GR) < 128) - ; - else - as_bad ("Second operand not a constant or general register"); - - add_unwind_entry (output_prologue_gr (mask, grsave)); - } + if (e.X_op != O_constant + || e.X_add_number < 0 + || e.X_add_number > 0xf) + as_bad ("First operand to .prologue must be a positive 4-bit constant"); + else if (e.X_add_number == 0) + as_warn ("Pointless use of zero first operand to .prologue"); else - as_bad ("First operand not a constant"); + mask = e.X_add_number; + n = popcount (mask); + + if (sep == ',') + parse_operand (&e, 0); + else + e.X_op = O_absent; + if (e.X_op == O_constant + && e.X_add_number >= 0 + && e.X_add_number < 128) + { + if (md.unwind_check == unwind_check_error) + as_warn ("Using a constant as second operand to .prologue is deprecated"); + grsave = e.X_add_number; + } + else if (e.X_op != O_register + || (grsave = e.X_add_number - REG_GR) > 127) + { + as_bad ("Second operand to .prologue must be a general register"); + grsave = 0; + } + else if (grsave > 128U - n) + { + as_bad ("Second operand to .prologue must be the first of %d general registers", n); + grsave = 0; + } + } + + if (mask) + add_unwind_entry (output_prologue_gr (mask, grsave), 0); else - add_unwind_entry (output_prologue ()); + add_unwind_entry (output_prologue (), 0); unwind.prologue = 1; unwind.prologue_mask = mask; + unwind.prologue_gr = grsave; + unwind.body = 0; ++unwind.prologue_count; } @@ -4052,14 +4572,17 @@ dot_endp (dummy) int dummy ATTRIBUTE_UNUSED; { expressionS e; - unsigned char *ptr; int bytes_per_address; long where; segT saved_seg; subsegT saved_subseg; - const char *sec_name, *text_name; - char *name, *p, c; - symbolS *sym; + proc_pending *pending; + int unwind_check = md.unwind_check; + + md.unwind_check = unwind_check_error; + if (!in_procedure ("endp")) + return; + md.unwind_check = unwind_check; if (unwind.saved_text_seg) { @@ -4073,64 +4596,20 @@ dot_endp (dummy) saved_subseg = now_subseg; } - /* - Use a slightly ugly scheme to derive the unwind section names from - the text section name: - - text sect. unwind table sect. - name: name: comments: - ---------- ----------------- -------------------------------- - .text .IA_64.unwind - .text.foo .IA_64.unwind.text.foo - .foo .IA_64.unwind.foo - .gnu.linkonce.t.foo - .gnu.linkonce.ia64unw.foo - _info .IA_64.unwind_info gas issues error message (ditto) - _infoFOO .IA_64.unwind_infoFOO gas issues error message (ditto) - - This mapping is done so that: - - (a) An object file with unwind info only in .text will use - unwind section names .IA_64.unwind and .IA_64.unwind_info. - This follows the letter of the ABI and also ensures backwards - compatibility with older toolchains. - - (b) An object file with unwind info in multiple text sections - will use separate unwind sections for each text section. - This allows us to properly set the "sh_info" and "sh_link" - fields in SHT_IA_64_UNWIND as required by the ABI and also - lets GNU ld support programs with multiple segments - containing unwind info (as might be the case for certain - embedded applications). - - (c) An error is issued if there would be a name clash. - */ - text_name = segment_name (saved_seg); - if (strncmp (text_name, "_info", 5) == 0) - { - as_bad ("Illegal section name `%s' (causes unwind section name clash)", - text_name); - ignore_rest_of_line (); - return; - } - if (strcmp (text_name, ".text") == 0) - text_name = ""; - insn_group_break (1, 0, 0); /* If there wasn't a .handlerdata, we haven't generated an image yet. */ if (!unwind.info) - generate_unwind_image (text_name); + generate_unwind_image (saved_seg); if (unwind.info || unwind.force_unwind_entry) { - subseg_set (md.last_text_seg, 0); - unwind.proc_end = expr_build_dot (); + symbolS *proc_end; - make_unw_section_name (SPECIAL_SECTION_UNWIND, text_name, sec_name); - set_section ((char *) sec_name); - bfd_set_section_flags (stdoutput, now_seg, - SEC_LOAD | SEC_ALLOC | SEC_READONLY); + subseg_set (md.last_text_seg, 0); + proc_end = expr_build_dot (); + + start_unwind_section (saved_seg, SPECIAL_SECTION_UNWIND); /* Make sure that section has 4 byte alignment for ILP32 and 8 byte alignment for LP64. */ @@ -4138,7 +4617,7 @@ dot_endp (dummy) /* Need space for 3 pointers for procedure start, procedure end, and unwind info. */ - ptr = frag_more (3 * md.pointer_size); + memset (frag_more (3 * md.pointer_size), 0, 3 * md.pointer_size); where = frag_now_fix () - (3 * md.pointer_size); bytes_per_address = bfd_arch_bits_per_address (stdoutput) / 8; @@ -4146,13 +4625,19 @@ dot_endp (dummy) e.X_op = O_pseudo_fixup; e.X_op_symbol = pseudo_func[FUNC_SEG_RELATIVE].u.sym; e.X_add_number = 0; - e.X_add_symbol = unwind.proc_start; + if (!S_IS_LOCAL (unwind.proc_pending.sym) + && S_IS_DEFINED (unwind.proc_pending.sym)) + e.X_add_symbol = symbol_temp_new (S_GET_SEGMENT (unwind.proc_pending.sym), + S_GET_VALUE (unwind.proc_pending.sym), + symbol_get_frag (unwind.proc_pending.sym)); + else + e.X_add_symbol = unwind.proc_pending.sym; ia64_cons_fix_new (frag_now, where, bytes_per_address, &e); e.X_op = O_pseudo_fixup; e.X_op_symbol = pseudo_func[FUNC_SEG_RELATIVE].u.sym; e.X_add_number = 0; - e.X_add_symbol = unwind.proc_end; + e.X_add_symbol = proc_end; ia64_cons_fix_new (frag_now, where + bytes_per_address, bytes_per_address, &e); @@ -4165,48 +4650,71 @@ dot_endp (dummy) ia64_cons_fix_new (frag_now, where + (bytes_per_address * 2), bytes_per_address, &e); } - else - md_number_to_chars (ptr + (bytes_per_address * 2), 0, - bytes_per_address); - } subseg_set (saved_seg, saved_subseg); - /* Parse names of main and alternate entry points and set symbol sizes. */ + /* Set symbol sizes. */ + pending = &unwind.proc_pending; + if (S_GET_NAME (pending->sym)) + { + do + { + symbolS *sym = pending->sym; + + if (!S_IS_DEFINED (sym)) + as_bad ("`%s' was not defined within procedure", S_GET_NAME (sym)); + else if (S_GET_SIZE (sym) == 0 + && symbol_get_obj (sym)->size == NULL) + { + fragS *frag = symbol_get_frag (sym); + + if (frag) + { + if (frag == frag_now && SEG_NORMAL (now_seg)) + S_SET_SIZE (sym, frag_now_fix () - S_GET_VALUE (sym)); + else + { + symbol_get_obj (sym)->size = + (expressionS *) xmalloc (sizeof (expressionS)); + symbol_get_obj (sym)->size->X_op = O_subtract; + symbol_get_obj (sym)->size->X_add_symbol + = symbol_new (FAKE_LABEL_NAME, now_seg, + frag_now_fix (), frag_now); + symbol_get_obj (sym)->size->X_op_symbol = sym; + symbol_get_obj (sym)->size->X_add_number = 0; + } + } + } + } while ((pending = pending->next) != NULL); + } + + /* Parse names of main and alternate entry points. */ while (1) { + char *name, *p, c; + SKIP_WHITESPACE (); name = input_line_pointer; c = get_symbol_end (); p = input_line_pointer; - sym = symbol_find (name); - if (sym && unwind.proc_start - && (symbol_get_bfdsym (sym)->flags & BSF_FUNCTION) - && S_GET_SIZE (sym) == 0 && symbol_get_obj (sym)->size == NULL) + if (!*name) + (md.unwind_check == unwind_check_warning + ? as_warn + : as_bad) ("Empty argument of .endp"); + else { - fragS *fr = symbol_get_frag (unwind.proc_start); - fragS *frag = symbol_get_frag (sym); + symbolS *sym = symbol_find (name); - /* Check whether the function label is at or beyond last - .proc directive. */ - while (fr && fr != frag) - fr = fr->fr_next; - if (fr) + for (pending = &unwind.proc_pending; pending; pending = pending->next) { - if (frag == frag_now && SEG_NORMAL (now_seg)) - S_SET_SIZE (sym, frag_now_fix () - S_GET_VALUE (sym)); - else + if (sym == pending->sym) { - symbol_get_obj (sym)->size = - (expressionS *) xmalloc (sizeof (expressionS)); - symbol_get_obj (sym)->size->X_op = O_subtract; - symbol_get_obj (sym)->size->X_add_symbol - = symbol_new (FAKE_LABEL_NAME, now_seg, - frag_now_fix (), frag_now); - symbol_get_obj (sym)->size->X_op_symbol = sym; - symbol_get_obj (sym)->size->X_add_number = 0; + pending->sym = NULL; + break; } } + if (!sym || !pending) + as_warn ("`%s' was not specified with previous .proc", name); } *p = c; SKIP_WHITESPACE (); @@ -4215,7 +4723,21 @@ dot_endp (dummy) ++input_line_pointer; } demand_empty_rest_of_line (); - unwind.proc_start = unwind.proc_end = unwind.info = 0; + + /* Deliberately only checking for the main entry point here; the + language spec even says all arguments to .endp are ignored. */ + if (unwind.proc_pending.sym + && S_GET_NAME (unwind.proc_pending.sym) + && strcmp (S_GET_NAME (unwind.proc_pending.sym), FAKE_LABEL_NAME)) + as_warn ("`%s' should be an operand to this .endp", + S_GET_NAME (unwind.proc_pending.sym)); + while (unwind.proc_pending.next) + { + pending = unwind.proc_pending.next; + unwind.proc_pending.next = pending->next; + free (pending); + } + unwind.proc_pending.sym = unwind.info = NULL; } static void @@ -4258,7 +4780,8 @@ static void dot_rot (type) int type; { - unsigned num_regs, num_alloced = 0; + offsetT num_regs; + valueT num_alloced = 0; struct dynreg **drpp, *dr; int ch, base_reg = 0; char *name, *start; @@ -4276,6 +4799,7 @@ dot_rot (type) for (dr = md.dynreg[type]; dr && dr->num_regs; dr = dr->next) { hash_delete (md.dynreg_hash, dr->name); + /* FIXME: Free dr->name. */ dr->num_regs = 0; } @@ -4284,8 +4808,8 @@ dot_rot (type) { start = input_line_pointer; ch = get_symbol_end (); + len = strlen (ia64_canonicalize_symbol_name (start)); *input_line_pointer = ch; - len = (input_line_pointer - start); SKIP_WHITESPACE (); if (*input_line_pointer != '[') @@ -4302,6 +4826,11 @@ dot_rot (type) as_bad ("Expected ']'"); goto err; } + if (num_regs <= 0) + { + as_bad ("Number of elements must be positive"); + goto err; + } SKIP_WHITESPACE (); num_alloced += num_regs; @@ -4334,16 +4863,16 @@ dot_rot (type) break; } - name = obstack_alloc (¬es, len + 1); - memcpy (name, start, len); - name[len] = '\0'; - if (!*drpp) { *drpp = obstack_alloc (¬es, sizeof (*dr)); memset (*drpp, 0, sizeof (*dr)); } + name = obstack_alloc (¬es, len + 1); + memcpy (name, start, len); + name[len] = '\0'; + dr = *drpp; dr->name = name; dr->num_regs = num_regs; @@ -4354,6 +4883,7 @@ dot_rot (type) if (hash_insert (md.dynreg_hash, name, dr)) { as_bad ("Attempt to redefine register set `%s'", name); + obstack_free (¬es, name); goto err; } @@ -4378,8 +4908,7 @@ dot_byteorder (byteorder) if (byteorder == -1) { if (seginfo->tc_segment_info_data.endian == 0) - seginfo->tc_segment_info_data.endian - = TARGET_BYTES_BIG_ENDIAN ? 1 : 2; + seginfo->tc_segment_info_data.endian = default_big_endian ? 1 : 2; byteorder = seginfo->tc_segment_info_data.endian == 1; } else @@ -4442,49 +4971,75 @@ dot_ln (dummy) demand_empty_rest_of_line (); } -static char * -parse_section_name () +static void +cross_section (ref, cons, ua) + int ref; + void (*cons) PARAMS((int)); + int ua; { - char *name; - int len; + char *start, *end; + int saved_auto_align; + unsigned int section_count; SKIP_WHITESPACE (); - if (*input_line_pointer != '"') + start = input_line_pointer; + if (*start == '"') { - as_bad ("Missing section name"); - ignore_rest_of_line (); - return 0; + int len; + char *name; + + name = demand_copy_C_string (&len); + obstack_free(¬es, name); + if (!name) + { + ignore_rest_of_line (); + return; + } } - name = demand_copy_C_string (&len); - if (!name) + else { - ignore_rest_of_line (); - return 0; + char c = get_symbol_end (); + + if (input_line_pointer == start) + { + as_bad ("Missing section name"); + ignore_rest_of_line (); + return; + } + *input_line_pointer = c; } + end = input_line_pointer; SKIP_WHITESPACE (); if (*input_line_pointer != ',') { as_bad ("Comma expected after section name"); ignore_rest_of_line (); - return 0; + return; } - ++input_line_pointer; /* skip comma */ - return name; + *end = '\0'; + end = input_line_pointer + 1; /* skip comma */ + input_line_pointer = start; + md.keep_pending_output = 1; + section_count = bfd_count_sections(stdoutput); + obj_elf_section (0); + if (section_count != bfd_count_sections(stdoutput)) + as_warn ("Creating sections with .xdataN/.xrealN/.xstringZ is deprecated."); + input_line_pointer = end; + saved_auto_align = md.auto_align; + if (ua) + md.auto_align = 0; + (*cons) (ref); + if (ua) + md.auto_align = saved_auto_align; + obj_elf_previous (0); + md.keep_pending_output = 0; } static void dot_xdata (size) int size; { - char *name = parse_section_name (); - if (!name) - return; - - md.keep_pending_output = 1; - set_section (name); - cons (size); - obj_elf_previous (0); - md.keep_pending_output = 0; + cross_section (size, cons, 0); } /* Why doesn't float_cons() call md_cons_align() the way cons() does? */ @@ -4530,66 +5085,28 @@ static void dot_xfloat_cons (kind) int kind; { - char *name = parse_section_name (); - if (!name) - return; - - md.keep_pending_output = 1; - set_section (name); - stmt_float_cons (kind); - obj_elf_previous (0); - md.keep_pending_output = 0; + cross_section (kind, stmt_float_cons, 0); } static void dot_xstringer (zero) int zero; { - char *name = parse_section_name (); - if (!name) - return; - - md.keep_pending_output = 1; - set_section (name); - stringer (zero); - obj_elf_previous (0); - md.keep_pending_output = 0; + cross_section (zero, stringer, 0); } static void dot_xdata_ua (size) int size; { - int saved_auto_align = md.auto_align; - char *name = parse_section_name (); - if (!name) - return; - - md.keep_pending_output = 1; - set_section (name); - md.auto_align = 0; - cons (size); - md.auto_align = saved_auto_align; - obj_elf_previous (0); - md.keep_pending_output = 0; + cross_section (size, cons, 1); } static void dot_xfloat_cons_ua (kind) int kind; { - int saved_auto_align = md.auto_align; - char *name = parse_section_name (); - if (!name) - return; - - md.keep_pending_output = 1; - set_section (name); - md.auto_align = 0; - stmt_float_cons (kind); - md.auto_align = saved_auto_align; - obj_elf_previous (0); - md.keep_pending_output = 0; + cross_section (kind, float_cons, 1); } /* .reg.val ,value */ @@ -4600,7 +5117,7 @@ dot_reg_val (dummy) { expressionS reg; - expression (®); + expression_and_evaluate (®); if (reg.X_op != O_register) { as_bad (_("Register name expected")); @@ -4615,7 +5132,7 @@ dot_reg_val (dummy) { valueT value = get_absolute_expression (); int regno = reg.X_add_number; - if (regno < REG_GR || regno > REG_GR + 128) + if (regno <= REG_GR || regno > REG_GR + 127) as_warn (_("Register value annotation ignored")); else { @@ -4627,6 +5144,23 @@ dot_reg_val (dummy) demand_empty_rest_of_line (); } +/* + .serialize.data + .serialize.instruction + */ +static void +dot_serialize (type) + int type; +{ + insn_group_break (0, 0, 0); + if (type) + instruction_serialization (); + else + data_serialization (); + insn_group_break (0, 0, 0); + demand_empty_rest_of_line (); +} + /* select dv checking mode .auto .explicit @@ -4689,9 +5223,9 @@ print_prmask (mask) } /* - .pred.rel.clear [p1 [,p2 [,...]]] (also .pred.rel "clear") - .pred.rel.imply p1, p2 (also .pred.rel "imply") - .pred.rel.mutex p1, p2 [,...] (also .pred.rel "mutex") + .pred.rel.clear [p1 [,p2 [,...]]] (also .pred.rel "clear" or @clear) + .pred.rel.imply p1, p2 (also .pred.rel "imply" or @imply) + .pred.rel.mutex p1, p2 [,...] (also .pred.rel "mutex" or @mutex) .pred.safe_across_calls p1 [, p2 [,...]] */ @@ -4705,28 +5239,43 @@ dot_pred_rel (type) if (type == 0) { - if (*input_line_pointer != '"') - { - as_bad (_("Missing predicate relation type")); - ignore_rest_of_line (); - return; - } - else + if (*input_line_pointer == '"') { int len; char *form = demand_copy_C_string (&len); + if (strcmp (form, "mutex") == 0) type = 'm'; else if (strcmp (form, "clear") == 0) type = 'c'; else if (strcmp (form, "imply") == 0) type = 'i'; - else - { - as_bad (_("Unrecognized predicate relation type")); - ignore_rest_of_line (); - return; - } + obstack_free (¬es, form); + } + else if (*input_line_pointer == '@') + { + char *form = ++input_line_pointer; + char c = get_symbol_end(); + + if (strcmp (form, "mutex") == 0) + type = 'm'; + else if (strcmp (form, "clear") == 0) + type = 'c'; + else if (strcmp (form, "imply") == 0) + type = 'i'; + *input_line_pointer = c; + } + else + { + as_bad (_("Missing predicate relation type")); + ignore_rest_of_line (); + return; + } + if (type == 0) + { + as_bad (_("Unrecognized predicate relation type")); + ignore_rest_of_line (); + return; } if (*input_line_pointer == ',') ++input_line_pointer; @@ -4736,59 +5285,57 @@ dot_pred_rel (type) SKIP_WHITESPACE (); while (1) { - valueT bit = 1; + valueT bits = 1; int regno; + expressionS pr, *pr1, *pr2; - if (TOUPPER (*input_line_pointer) != 'P' - || (regno = atoi (++input_line_pointer)) < 0 - || regno > 63) + expression_and_evaluate (&pr); + if (pr.X_op == O_register + && pr.X_add_number >= REG_P + && pr.X_add_number <= REG_P + 63) { - as_bad (_("Predicate register expected")); - ignore_rest_of_line (); - return; + regno = pr.X_add_number - REG_P; + bits <<= regno; + count++; + if (p1 == -1) + p1 = regno; + else if (p2 == -1) + p2 = regno; } - while (ISDIGIT (*input_line_pointer)) - ++input_line_pointer; - if (p1 == -1) - p1 = regno; - else if (p2 == -1) - p2 = regno; - bit <<= regno; - if (mask & bit) - as_warn (_("Duplicate predicate register ignored")); - mask |= bit; - count++; - /* See if it's a range. */ - if (*input_line_pointer == '-') + else if (type != 'i' + && pr.X_op == O_subtract + && (pr1 = symbol_get_value_expression (pr.X_add_symbol)) + && pr1->X_op == O_register + && pr1->X_add_number >= REG_P + && pr1->X_add_number <= REG_P + 63 + && (pr2 = symbol_get_value_expression (pr.X_op_symbol)) + && pr2->X_op == O_register + && pr2->X_add_number >= REG_P + && pr2->X_add_number <= REG_P + 63) { - valueT stop = 1; - ++input_line_pointer; + /* It's a range. */ + int stop; - if (TOUPPER (*input_line_pointer) != 'P' - || (regno = atoi (++input_line_pointer)) < 0 - || regno > 63) - { - as_bad (_("Predicate register expected")); - ignore_rest_of_line (); - return; - } - while (ISDIGIT (*input_line_pointer)) - ++input_line_pointer; - stop <<= regno; - if (bit >= stop) + regno = pr1->X_add_number - REG_P; + stop = pr2->X_add_number - REG_P; + if (regno >= stop) { as_bad (_("Bad register range")); ignore_rest_of_line (); return; } - while (bit < stop) - { - bit <<= 1; - mask |= bit; - count++; - } - SKIP_WHITESPACE (); + bits = ((bits << stop) << 1) - (bits << regno); + count += stop - regno + 1; } + else + { + as_bad (_("Predicate register expected")); + ignore_rest_of_line (); + return; + } + if (mask & bits) + as_warn (_("Duplicate predicate register ignored")); + mask |= bits; if (*input_line_pointer != ',') break; ++input_line_pointer; @@ -4908,6 +5455,7 @@ const pseudo_typeS md_pseudo_table[] = { { "radix", dot_radix, 0 }, { "lcomm", s_lcomm_bytes, 1 }, + { "loc", dot_loc, 0 }, { "bss", dot_special_section, SPECIAL_SECTION_BSS }, { "sbss", dot_special_section, SPECIAL_SECTION_SBSS }, { "sdata", dot_special_section, SPECIAL_SECTION_SDATA }, @@ -4925,11 +5473,11 @@ const pseudo_typeS md_pseudo_table[] = { "fframe", dot_fframe, 0 }, { "vframe", dot_vframe, 0 }, { "vframesp", dot_vframesp, 0 }, - { "vframepsp", dot_vframepsp, 0 }, + { "vframepsp", dot_vframesp, 1 }, { "save", dot_save, 0 }, { "restore", dot_restore, 0 }, { "restorereg", dot_restorereg, 0 }, - { "restorereg.p", dot_restorereg_p, 0 }, + { "restorereg.p", dot_restorereg, 1 }, { "handlerdata", dot_handlerdata, 0 }, { "unwentry", dot_unwentry, 0 }, { "altrp", dot_altrp, 0 }, @@ -4943,16 +5491,13 @@ const pseudo_typeS md_pseudo_table[] = { "spillreg", dot_spillreg, 0 }, { "spillsp", dot_spillmem, 0 }, { "spillpsp", dot_spillmem, 1 }, - { "spillreg.p", dot_spillreg_p, 0 }, - { "spillsp.p", dot_spillmem_p, 0 }, - { "spillpsp.p", dot_spillmem_p, 1 }, + { "spillreg.p", dot_spillreg, 1 }, + { "spillsp.p", dot_spillmem, ~0 }, + { "spillpsp.p", dot_spillmem, ~1 }, { "label_state", dot_label_state, 0 }, { "copy_state", dot_copy_state, 0 }, { "unwabi", dot_unwabi, 0 }, { "personality", dot_personality, 0 }, -#if 0 - { "estate", dot_estate, 0 }, -#endif { "mii", dot_template, 0x0 }, { "mli", dot_template, 0x2 }, /* old format, for compatibility */ { "mlx", dot_template, 0x2 }, @@ -4964,10 +5509,6 @@ const pseudo_typeS md_pseudo_table[] = { "bbb", dot_template, 0xb }, { "mmb", dot_template, 0xc }, { "mfb", dot_template, 0xe }, -#if 0 - { "lb", dot_scope, 0 }, - { "le", dot_scope, 1 }, -#endif { "align", dot_align, 0 }, { "regstk", dot_regstk, 0 }, { "rotr", dot_rot, DYNREG_GR }, @@ -4984,6 +5525,7 @@ const pseudo_typeS md_pseudo_table[] = { "xdata2", dot_xdata, 2 }, { "xdata4", dot_xdata, 4 }, { "xdata8", dot_xdata, 8 }, + { "xdata16", dot_xdata, 16 }, { "xreal4", dot_xfloat_cons, 'f' }, { "xreal8", dot_xfloat_cons, 'd' }, { "xreal10", dot_xfloat_cons, 'x' }, @@ -4995,6 +5537,7 @@ const pseudo_typeS md_pseudo_table[] = { "xdata2.ua", dot_xdata_ua, 2 }, { "xdata4.ua", dot_xdata_ua, 4 }, { "xdata8.ua", dot_xdata_ua, 8 }, + { "xdata16.ua", dot_xdata_ua, 16 }, { "xreal4.ua", dot_xfloat_cons_ua, 'f' }, { "xreal8.ua", dot_xfloat_cons_ua, 'd' }, { "xreal10.ua", dot_xfloat_cons_ua, 'x' }, @@ -5009,6 +5552,8 @@ const pseudo_typeS md_pseudo_table[] = { "pred.rel.mutex", dot_pred_rel, 'm' }, { "pred.safe_across_calls", dot_pred_rel, 's' }, { "reg.val", dot_reg_val, 0 }, + { "serialize.data", dot_serialize, 0 }, + { "serialize.instruction", dot_serialize, 1 }, { "auto", dot_dv_mode, 'a' }, { "explicit", dot_dv_mode, 'e' }, { "default", dot_dv_mode, 'd' }, @@ -5063,12 +5608,12 @@ pseudo_opcode[] = static symbolS * declare_register (name, regnum) const char *name; - int regnum; + unsigned int regnum; { const char *err; symbolS *sym; - sym = symbol_new (name, reg_section, regnum, &zero_address_frag); + sym = symbol_create (name, reg_section, regnum, &zero_address_frag); err = hash_insert (md.reg_hash, S_GET_NAME (sym), (PTR) sym); if (err) @@ -5081,11 +5626,11 @@ declare_register (name, regnum) static void declare_register_set (prefix, num_regs, base_regnum) const char *prefix; - int num_regs; - int base_regnum; + unsigned int num_regs; + unsigned int base_regnum; { char name[8]; - int i; + unsigned int i; for (i = 0; i < num_regs; ++i) { @@ -5369,6 +5914,17 @@ operand_match (idesc, index, e) return OPERAND_MATCH; break; + case IA64_OPND_IMMU5b: + if (e->X_op == O_constant) + { + val = e->X_add_number; + if (val >= 32 && val <= 63) + return OPERAND_MATCH; + else + return OPERAND_OUT_OF_RANGE; + } + break; + case IA64_OPND_CCNT5: case IA64_OPND_CNT5: case IA64_OPND_CNT6: @@ -5611,7 +6167,7 @@ operand_match (idesc, index, e) case O_symbol: fix = CURR_SLOT.fixup + CURR_SLOT.num_fixups; /* There are no external relocs for TAG13/TAG13b fields, so we - create a dummy reloc. This will not live past md_apply_fix3. */ + create a dummy reloc. This will not live past md_apply_fix. */ fix->code = BFD_RELOC_UNUSED; fix->code = ia64_gen_real_reloc_type (e->X_op_symbol, fix->code); fix->opnd = idesc->operands[index]; @@ -5641,27 +6197,19 @@ operand_match (idesc, index, e) } static int -parse_operand (e) +parse_operand (e, more) expressionS *e; + int more; { int sep = '\0'; memset (e, 0, sizeof (*e)); e->X_op = O_absent; SKIP_WHITESPACE (); - if (*input_line_pointer != '}') - expression (e); - sep = *input_line_pointer++; - - if (sep == '}') - { - if (!md.manual_bundling) - as_warn ("Found '}' when manual bundling is off"); - else - CURR_SLOT.manual_bundling_off = 1; - md.manual_bundling = 0; - sep = '\0'; - } + expression_and_evaluate (e); + sep = *input_line_pointer; + if (more && (sep == ',' || sep == more)) + ++input_line_pointer; return sep; } @@ -5686,6 +6234,8 @@ parse_operands (idesc) { int i = 0, highest_unmatched_operand, num_operands = 0, num_outputs = 0; int error_pos, out_of_range_pos, curr_out_of_range_pos, sep = 0; + int reg1, reg2; + char reg_class; enum ia64_opnd expected_operand = IA64_OPND_NIL; enum operand_match_result result; char mnemonic[129]; @@ -5695,7 +6245,8 @@ parse_operands (idesc) assert (strlen (idesc->name) <= 128); strcpy (mnemonic, idesc->name); - if (idesc->operands[2] == IA64_OPND_SOF) + if (idesc->operands[2] == IA64_OPND_SOF + || idesc->operands[1] == IA64_OPND_SOF) { /* To make the common idiom "alloc loc?=ar.pfs,0,1,0,0" work, we can't parse the first operand until we have parsed the @@ -5713,11 +6264,22 @@ parse_operands (idesc) ++num_outputs; } - for (; i < NELEMS (CURR_SLOT.opnd); ++i) + for (; ; ++i) { - sep = parse_operand (CURR_SLOT.opnd + i); - if (CURR_SLOT.opnd[i].X_op == O_absent) - break; + if (i < NELEMS (CURR_SLOT.opnd)) + { + sep = parse_operand (CURR_SLOT.opnd + i, '='); + if (CURR_SLOT.opnd[i].X_op == O_absent) + break; + } + else + { + expressionS dummy; + + sep = parse_operand (&dummy, '='); + if (dummy.X_op == O_absent) + break; + } ++num_operands; @@ -5738,44 +6300,59 @@ parse_operands (idesc) return 0; } - if (idesc->operands[2] == IA64_OPND_SOF) + if (idesc->operands[2] == IA64_OPND_SOF + || idesc->operands[1] == IA64_OPND_SOF) { - /* map alloc r1=ar.pfs,i,l,o,r to alloc r1=ar.pfs,(i+l+o),(i+l),r */ + /* Map alloc r1=ar.pfs,i,l,o,r to alloc r1=ar.pfs,(i+l+o),(i+l),r. + Note, however, that due to that mapping operand numbers in error + messages for any of the constant operands will not be correct. */ know (strcmp (idesc->name, "alloc") == 0); - if (num_operands == 5 /* first_arg not included in this count! */ - && CURR_SLOT.opnd[2].X_op == O_constant - && CURR_SLOT.opnd[3].X_op == O_constant - && CURR_SLOT.opnd[4].X_op == O_constant - && CURR_SLOT.opnd[5].X_op == O_constant) - { - sof = set_regstack (CURR_SLOT.opnd[2].X_add_number, - CURR_SLOT.opnd[3].X_add_number, - CURR_SLOT.opnd[4].X_add_number, - CURR_SLOT.opnd[5].X_add_number); + /* The first operand hasn't been parsed/initialized, yet (but + num_operands intentionally doesn't account for that). */ + i = num_operands > 4 ? 2 : 1; +#define FORCE_CONST(n) (CURR_SLOT.opnd[n].X_op == O_constant \ + ? CURR_SLOT.opnd[n].X_add_number \ + : 0) + sof = set_regstack (FORCE_CONST(i), + FORCE_CONST(i + 1), + FORCE_CONST(i + 2), + FORCE_CONST(i + 3)); +#undef FORCE_CONST - /* now we can parse the first arg: */ - saved_input_pointer = input_line_pointer; - input_line_pointer = first_arg; - sep = parse_operand (CURR_SLOT.opnd + 0); - if (sep != '=') - --num_outputs; /* force error */ - input_line_pointer = saved_input_pointer; + /* now we can parse the first arg: */ + saved_input_pointer = input_line_pointer; + input_line_pointer = first_arg; + sep = parse_operand (CURR_SLOT.opnd + 0, '='); + if (sep != '=') + --num_outputs; /* force error */ + input_line_pointer = saved_input_pointer; - CURR_SLOT.opnd[2].X_add_number = sof; - CURR_SLOT.opnd[3].X_add_number - = sof - CURR_SLOT.opnd[4].X_add_number; - CURR_SLOT.opnd[4] = CURR_SLOT.opnd[5]; - } + CURR_SLOT.opnd[i].X_add_number = sof; + if (CURR_SLOT.opnd[i + 1].X_op == O_constant + && CURR_SLOT.opnd[i + 2].X_op == O_constant) + CURR_SLOT.opnd[i + 1].X_add_number + = sof - CURR_SLOT.opnd[i + 2].X_add_number; + else + CURR_SLOT.opnd[i + 1].X_op = O_illegal; + CURR_SLOT.opnd[i + 2] = CURR_SLOT.opnd[i + 3]; } - highest_unmatched_operand = 0; + highest_unmatched_operand = -4; curr_out_of_range_pos = -1; error_pos = 0; - expected_operand = idesc->operands[0]; for (; idesc; idesc = get_next_opcode (idesc)) { if (num_outputs != idesc->num_outputs) continue; /* mismatch in # of outputs */ + if (highest_unmatched_operand < 0) + highest_unmatched_operand |= 1; + if (num_operands > NELEMS (idesc->operands) + || (num_operands < NELEMS (idesc->operands) + && idesc->operands[num_operands]) + || (num_operands > 0 && !idesc->operands[num_operands - 1])) + continue; /* mismatch in number of arguments */ + if (highest_unmatched_operand < 0) + highest_unmatched_operand |= 2; CURR_SLOT.num_fixups = 0; @@ -5828,10 +6405,6 @@ parse_operands (idesc) continue; } - if (num_operands < NELEMS (idesc->operands) - && idesc->operands[num_operands]) - continue; /* mismatch in number of arguments */ - break; } if (!idesc) @@ -5840,103 +6413,136 @@ parse_operands (idesc) as_bad ("Operand %u of `%s' should be %s", error_pos + 1, mnemonic, elf64_ia64_operands[expected_operand].desc); + else if (highest_unmatched_operand < 0 && !(highest_unmatched_operand & 1)) + as_bad ("Wrong number of output operands"); + else if (highest_unmatched_operand < 0 && !(highest_unmatched_operand & 2)) + as_bad ("Wrong number of input operands"); else as_bad ("Operand mismatch"); return 0; } - return idesc; -} -/* Keep track of state necessary to determine whether a NOP is necessary - to avoid an erratum in A and B step Itanium chips, and return 1 if we - detect a case where additional NOPs may be necessary. */ -static int -errata_nop_necessary_p (slot, insn_unit) - struct slot *slot; - enum ia64_unit insn_unit; -{ - int i; - struct group *this_group = md.last_groups + md.group_idx; - struct group *prev_group = md.last_groups + (md.group_idx + 2) % 3; - struct ia64_opcode *idesc = slot->idesc; - - /* Test whether this could be the first insn in a problematic sequence. */ - if (insn_unit == IA64_UNIT_F) + /* Check that the instruction doesn't use + - r0, f0, or f1 as output operands + - the same predicate twice as output operands + - r0 as address of a base update load or store + - the same GR as output and address of a base update load + - two even- or two odd-numbered FRs as output operands of a floating + point parallel load. + At most two (conflicting) output (or output-like) operands can exist, + (floating point parallel loads have three outputs, but the base register, + if updated, cannot conflict with the actual outputs). */ + reg2 = reg1 = -1; + for (i = 0; i < num_operands; ++i) { - for (i = 0; i < idesc->num_outputs; i++) - if (idesc->operands[i] == IA64_OPND_P1 - || idesc->operands[i] == IA64_OPND_P2) - { - int regno = slot->opnd[i].X_add_number - REG_P; - /* Ignore invalid operands; they generate errors elsewhere. */ - if (regno >= 64) - return 0; - this_group->p_reg_set[regno] = 1; - } - } + int regno = 0; - /* Test whether this could be the second insn in a problematic sequence. */ - if (insn_unit == IA64_UNIT_M && slot->qp_regno > 0 - && prev_group->p_reg_set[slot->qp_regno]) - { - for (i = 0; i < idesc->num_outputs; i++) - if (idesc->operands[i] == IA64_OPND_R1 - || idesc->operands[i] == IA64_OPND_R2 - || idesc->operands[i] == IA64_OPND_R3) - { - int regno = slot->opnd[i].X_add_number - REG_GR; - /* Ignore invalid operands; they generate errors elsewhere. */ - if (regno >= 128) - return 0; - if (strncmp (idesc->name, "add", 3) != 0 - && strncmp (idesc->name, "sub", 3) != 0 - && strncmp (idesc->name, "shladd", 6) != 0 - && (idesc->flags & IA64_OPCODE_POSTINC) == 0) - this_group->g_reg_set_conditionally[regno] = 1; - } - } - - /* Test whether this could be the third insn in a problematic sequence. */ - for (i = 0; i < NELEMS (idesc->operands) && idesc->operands[i]; i++) - { - if (/* For fc, ptc, ptr, tak, thash, tpa, ttag, probe, ptr, ptc. */ - idesc->operands[i] == IA64_OPND_R3 - /* For mov indirect. */ - || idesc->operands[i] == IA64_OPND_RR_R3 - || idesc->operands[i] == IA64_OPND_DBR_R3 - || idesc->operands[i] == IA64_OPND_IBR_R3 - || idesc->operands[i] == IA64_OPND_PKR_R3 - || idesc->operands[i] == IA64_OPND_PMC_R3 - || idesc->operands[i] == IA64_OPND_PMD_R3 - || idesc->operands[i] == IA64_OPND_MSR_R3 - || idesc->operands[i] == IA64_OPND_CPUID_R3 - /* For itr. */ - || idesc->operands[i] == IA64_OPND_ITR_R3 - || idesc->operands[i] == IA64_OPND_DTR_R3 - /* Normal memory addresses (load, store, xchg, cmpxchg, etc.). */ - || idesc->operands[i] == IA64_OPND_MR3) + reg_class = 0; + switch (idesc->operands[i]) { - int regno = slot->opnd[i].X_add_number - REG_GR; - /* Ignore invalid operands; they generate errors elsewhere. */ - if (regno >= 128) - return 0; - if (idesc->operands[i] == IA64_OPND_R3) + case IA64_OPND_R1: + case IA64_OPND_R2: + case IA64_OPND_R3: + if (i < num_outputs) { - if (strcmp (idesc->name, "fc") != 0 - && strcmp (idesc->name, "tak") != 0 - && strcmp (idesc->name, "thash") != 0 - && strcmp (idesc->name, "tpa") != 0 - && strcmp (idesc->name, "ttag") != 0 - && strncmp (idesc->name, "ptr", 3) != 0 - && strncmp (idesc->name, "ptc", 3) != 0 - && strncmp (idesc->name, "probe", 5) != 0) - return 0; + if (CURR_SLOT.opnd[i].X_add_number == REG_GR) + reg_class = 'r'; + else if (reg1 < 0) + reg1 = CURR_SLOT.opnd[i].X_add_number; + else if (reg2 < 0) + reg2 = CURR_SLOT.opnd[i].X_add_number; } - if (prev_group->g_reg_set_conditionally[regno]) - return 1; + break; + case IA64_OPND_P1: + case IA64_OPND_P2: + if (i < num_outputs) + { + if (reg1 < 0) + reg1 = CURR_SLOT.opnd[i].X_add_number; + else if (reg2 < 0) + reg2 = CURR_SLOT.opnd[i].X_add_number; + } + break; + case IA64_OPND_F1: + case IA64_OPND_F2: + case IA64_OPND_F3: + case IA64_OPND_F4: + if (i < num_outputs) + { + if (CURR_SLOT.opnd[i].X_add_number >= REG_FR + && CURR_SLOT.opnd[i].X_add_number <= REG_FR + 1) + { + reg_class = 'f'; + regno = CURR_SLOT.opnd[i].X_add_number - REG_FR; + } + else if (reg1 < 0) + reg1 = CURR_SLOT.opnd[i].X_add_number; + else if (reg2 < 0) + reg2 = CURR_SLOT.opnd[i].X_add_number; + } + break; + case IA64_OPND_MR3: + if (idesc->flags & IA64_OPCODE_POSTINC) + { + if (CURR_SLOT.opnd[i].X_add_number == REG_GR) + reg_class = 'm'; + else if (reg1 < 0) + reg1 = CURR_SLOT.opnd[i].X_add_number; + else if (reg2 < 0) + reg2 = CURR_SLOT.opnd[i].X_add_number; + } + break; + default: + break; + } + switch (reg_class) + { + case 0: + break; + default: + as_warn ("Invalid use of `%c%d' as output operand", reg_class, regno); + break; + case 'm': + as_warn ("Invalid use of `r%d' as base update address operand", regno); + break; } } - return 0; + if (reg1 == reg2) + { + if (reg1 >= REG_GR && reg1 <= REG_GR + 127) + { + reg1 -= REG_GR; + reg_class = 'r'; + } + else if (reg1 >= REG_P && reg1 <= REG_P + 63) + { + reg1 -= REG_P; + reg_class = 'p'; + } + else if (reg1 >= REG_FR && reg1 <= REG_FR + 127) + { + reg1 -= REG_FR; + reg_class = 'f'; + } + else + reg_class = 0; + if (reg_class) + as_warn ("Invalid duplicate use of `%c%d'", reg_class, reg1); + } + else if (((reg1 >= REG_FR && reg1 <= REG_FR + 31 + && reg2 >= REG_FR && reg2 <= REG_FR + 31) + || (reg1 >= REG_FR + 32 && reg1 <= REG_FR + 127 + && reg2 >= REG_FR + 32 && reg2 <= REG_FR + 127)) + && ! ((reg1 ^ reg2) & 1)) + as_warn ("Invalid simultaneous use of `f%d' and `f%d'", + reg1 - REG_FR, reg2 - REG_FR); + else if ((reg1 >= REG_FR && reg1 <= REG_FR + 31 + && reg2 >= REG_FR + 32 && reg2 <= REG_FR + 127) + || (reg1 >= REG_FR + 32 && reg1 <= REG_FR + 127 + && reg2 >= REG_FR && reg2 <= REG_FR + 31)) + as_warn ("Dangerous simultaneous use of `f%d' and `f%d'", + reg1 - REG_FR, reg2 - REG_FR); + return idesc; } static void @@ -5946,7 +6552,8 @@ build_insn (slot, insnp) { const struct ia64_operand *odesc, *o2desc; struct ia64_opcode *idesc = slot->idesc; - bfd_signed_vma insn, val; + bfd_vma insn; + bfd_signed_vma val; const char *err; int i; @@ -6066,22 +6673,22 @@ build_insn (slot, insnp) static void emit_one_bundle () { - unsigned int manual_bundling_on = 0, manual_bundling_off = 0; - unsigned int manual_bundling = 0; + int manual_bundling_off = 0, manual_bundling = 0; enum ia64_unit required_unit, insn_unit = 0; enum ia64_insn_type type[3], insn_type; unsigned int template, orig_template; bfd_vma insn[3] = { -1, -1, -1 }; struct ia64_opcode *idesc; int end_of_insn_group = 0, user_template = -1; - int n, i, j, first, curr; - unw_rec_list *ptr, *last_ptr, *end_ptr; + int n, i, j, first, curr, last_slot; bfd_vma t0 = 0, t1 = 0; struct label_fix *lfix; + bfd_boolean mark_label; struct insn_fix *ifix; char mnemonic[16]; fixS *fix; char *f; + int addr_mod; first = (md.curr_slot + NUM_SLOTS - md.num_slots_in_use) % NUM_SLOTS; know (first >= 0 & first < NUM_SLOTS); @@ -6113,14 +6720,25 @@ emit_one_bundle () f = frag_more (16); + /* Check to see if this bundle is at an offset that is a multiple of 16-bytes + from the start of the frag. */ + addr_mod = frag_now_fix () & 15; + if (frag_now->has_code && frag_now->insn_addr != addr_mod) + as_bad (_("instruction address is not a multiple of 16")); + frag_now->insn_addr = addr_mod; + frag_now->has_code = 1; + /* now fill in slots with as many insns as possible: */ curr = first; idesc = md.slot[curr].idesc; end_of_insn_group = 0; + last_slot = -1; for (i = 0; i < 3 && md.num_slots_in_use > 0; ++i) { /* If we have unwind records, we may need to update some now. */ - ptr = md.slot[curr].unwind_record; + unw_rec_list *ptr = md.slot[curr].unwind_record; + unw_rec_list *end_ptr = NULL; + if (ptr) { /* Find the last prologue/body record in the list for the current @@ -6130,9 +6748,11 @@ emit_one_bundle () issued. This matters because there may have been nops emitted meanwhile. Any non-prologue non-body record followed by a prologue/body record must also refer to the current point. */ - last_ptr = NULL; - end_ptr = md.slot[(curr + 1) % NUM_SLOTS].unwind_record; - for (; ptr != end_ptr; ptr = ptr->next) + unw_rec_list *last_ptr; + + for (j = 1; end_ptr == NULL && j < md.num_slots_in_use; ++j) + end_ptr = md.slot[(curr + j) % NUM_SLOTS].unwind_record; + for (last_ptr = NULL; ptr != end_ptr; ptr = ptr->next) if (ptr->r.type == prologue || ptr->r.type == prologue_gr || ptr->r.type == body) last_ptr = ptr; @@ -6153,13 +6773,30 @@ emit_one_bundle () } } + manual_bundling_off = md.slot[curr].manual_bundling_off; + if (md.slot[curr].manual_bundling_on) + { + if (curr == first) + manual_bundling = 1; + else + break; /* Need to start a new bundle. */ + } + + /* If this instruction specifies a template, then it must be the first + instruction of a bundle. */ + if (curr != first && md.slot[curr].user_template >= 0) + break; + if (idesc->flags & IA64_OPCODE_SLOT2) { - if (manual_bundling && i != 2) - as_bad_where (md.slot[curr].src_file, md.slot[curr].src_line, - "`%s' must be last in bundle", idesc->name); - else - i = 2; + if (manual_bundling && !manual_bundling_off) + { + as_bad_where (md.slot[curr].src_file, md.slot[curr].src_line, + "`%s' must be last in bundle", idesc->name); + if (i < 2) + manual_bundling = -1; /* Suppress meaningless post-loop errors. */ + } + i = 2; } if (idesc->flags & IA64_OPCODE_LAST) { @@ -6192,10 +6829,19 @@ emit_one_bundle () required_slot = i; break; } - if (manual_bundling && i != required_slot) - as_bad_where (md.slot[curr].src_file, md.slot[curr].src_line, - "`%s' must be last in instruction group", - idesc->name); + if (manual_bundling + && (i > required_slot + || (required_slot == 2 && !manual_bundling_off) + || (user_template >= 0 + /* Changing from MMI to M;MI is OK. */ + && (template ^ required_template) > 1))) + { + as_bad_where (md.slot[curr].src_file, md.slot[curr].src_line, + "`%s' must be last in instruction group", + idesc->name); + if (i < 2 && required_slot == 2 && !manual_bundling_off) + manual_bundling = -1; /* Suppress meaningless post-loop errors. */ + } if (required_slot < i) /* Can't fit this instruction. */ break; @@ -6209,29 +6855,25 @@ emit_one_bundle () changing NOPs in front of this slot. */ for (j = i; j < 3; ++j) insn[j] = nop[ia64_templ_desc[required_template].exec_unit[j]]; + + /* We just picked a template that includes the stop bit in the + middle, so we don't need another one emitted later. */ + md.slot[curr].end_of_insn_group = 0; } template = required_template; } if (curr != first && md.slot[curr].label_fixups) { - if (manual_bundling_on) - as_bad_where (md.slot[curr].src_file, md.slot[curr].src_line, + if (manual_bundling) + { + as_bad_where (md.slot[curr].src_file, md.slot[curr].src_line, "Label must be first in a bundle"); + manual_bundling = -1; /* Suppress meaningless post-loop errors. */ + } /* This insn must go into the first slot of a bundle. */ break; } - manual_bundling_on = md.slot[curr].manual_bundling_on; - manual_bundling_off = md.slot[curr].manual_bundling_off; - - if (manual_bundling_on) - { - if (curr == first) - manual_bundling = 1; - else - break; /* need to start a new bundle */ - } - if (end_of_insn_group && md.num_slots_in_use >= 1) { /* We need an instruction group boundary in the middle of a @@ -6259,12 +6901,17 @@ emit_one_bundle () reason we have to check for this is that otherwise we may end up generating "MI;;I M.." which has the deadly effect that the second M instruction is no longer the - first in the bundle! --davidm 99/12/16 */ + first in the group! --davidm 99/12/16 */ && (idesc->flags & IA64_OPCODE_FIRST) == 0) { template = 1; end_of_insn_group = 0; } + else if (i == 1 + && user_template == 0 + && !(idesc->flags & IA64_OPCODE_FIRST)) + /* Use the next slot. */ + continue; else if (curr != first) /* can't fit this insn */ break; @@ -6282,25 +6929,62 @@ emit_one_bundle () /* resolve dynamic opcodes such as "break", "hint", and "nop": */ if (idesc->type == IA64_TYPE_DYN) { + enum ia64_opnd opnd1, opnd2; + if ((strcmp (idesc->name, "nop") == 0) - || (strcmp (idesc->name, "hint") == 0) || (strcmp (idesc->name, "break") == 0)) insn_unit = required_unit; - else if (strcmp (idesc->name, "chk.s") == 0) + else if (strcmp (idesc->name, "hint") == 0) + { + insn_unit = required_unit; + if (required_unit == IA64_UNIT_B) + { + switch (md.hint_b) + { + case hint_b_ok: + break; + case hint_b_warning: + as_warn ("hint in B unit may be treated as nop"); + break; + case hint_b_error: + /* When manual bundling is off and there is no + user template, we choose a different unit so + that hint won't go into the current slot. We + will fill the current bundle with nops and + try to put hint into the next bundle. */ + if (!manual_bundling && user_template < 0) + insn_unit = IA64_UNIT_I; + else + as_bad ("hint in B unit can't be used"); + break; + } + } + } + else if (strcmp (idesc->name, "chk.s") == 0 + || strcmp (idesc->name, "mov") == 0) { insn_unit = IA64_UNIT_M; - if (required_unit == IA64_UNIT_I) + if (required_unit == IA64_UNIT_I + || (required_unit == IA64_UNIT_F && template == 6)) insn_unit = IA64_UNIT_I; } else as_fatal ("emit_one_bundle: unexpected dynamic op"); - sprintf (mnemonic, "%s.%c", idesc->name, "?imbf??"[insn_unit]); + sprintf (mnemonic, "%s.%c", idesc->name, "?imbfxx"[insn_unit]); + opnd1 = idesc->operands[0]; + opnd2 = idesc->operands[1]; ia64_free_opcode (idesc); - md.slot[curr].idesc = idesc = ia64_find_opcode (mnemonic); -#if 0 - know (!idesc->next); /* no resolved dynamic ops have collisions */ -#endif + idesc = ia64_find_opcode (mnemonic); + /* moves to/from ARs have collisions */ + if (opnd1 == IA64_OPND_AR3 || opnd2 == IA64_OPND_AR3) + { + while (idesc != NULL + && (idesc->operands[0] != opnd1 + || idesc->operands[1] != opnd2)) + idesc = get_next_opcode (idesc); + } + md.slot[curr].idesc = idesc; } else { @@ -6322,37 +7006,34 @@ emit_one_bundle () } if (insn_unit != required_unit) + continue; /* Try next slot. */ + + /* Now is a good time to fix up the labels for this insn. */ + mark_label = FALSE; + for (lfix = md.slot[curr].label_fixups; lfix; lfix = lfix->next) { - if (required_unit == IA64_UNIT_L - && insn_unit == IA64_UNIT_I - && !(idesc->flags & IA64_OPCODE_X_IN_MLX)) - { - /* we got ourselves an MLX template but the current - instruction isn't an X-unit, or an I-unit instruction - that can go into the X slot of an MLX template. Duh. */ - if (md.num_slots_in_use >= NUM_SLOTS) - { - as_bad_where (md.slot[curr].src_file, - md.slot[curr].src_line, - "`%s' can't go in X slot of " - "MLX template", idesc->name); - /* drop this insn so we don't livelock: */ - --md.num_slots_in_use; - } - break; - } - continue; /* try next slot */ + S_SET_VALUE (lfix->sym, frag_now_fix () - 16); + symbol_set_frag (lfix->sym, frag_now); + mark_label |= lfix->dw2_mark_labels; + } + for (lfix = md.slot[curr].tag_fixups; lfix; lfix = lfix->next) + { + S_SET_VALUE (lfix->sym, frag_now_fix () - 16 + i); + symbol_set_frag (lfix->sym, frag_now); } - { - bfd_vma addr; + if (debug_type == DEBUG_DWARF2 + || md.slot[curr].loc_directive_seen + || mark_label) + { + bfd_vma addr = frag_now->fr_address + frag_now_fix () - 16 + i; - addr = frag_now->fr_address + frag_now_fix () - 16 + i; - dwarf2_gen_line_info (addr, &md.slot[curr].debug_line); - } + md.slot[curr].loc_directive_seen = 0; + if (mark_label) + md.slot[curr].debug_line.flags |= DWARF2_FLAG_BASIC_BLOCK; - if (errata_nop_necessary_p (md.slot + curr, insn_unit)) - as_warn (_("Additional NOP may be necessary to workaround Itanium processor A/B step errata")); + dwarf2_gen_line_info (addr, &md.slot[curr].debug_line); + } build_insn (md.slot + curr, insn + i); @@ -6362,7 +7043,6 @@ emit_one_bundle () /* Set slot numbers for all remaining unwind records belonging to the current insn. There can not be any prologue/body unwind records here. */ - end_ptr = md.slot[(curr + 1) % NUM_SLOTS].unwind_record; for (; ptr != end_ptr; ptr = ptr->next) { ptr->slot_number = (unsigned long) f + i; @@ -6378,19 +7058,7 @@ emit_one_bundle () ++i; } --md.num_slots_in_use; - - /* now is a good time to fix up the labels for this insn: */ - for (lfix = md.slot[curr].label_fixups; lfix; lfix = lfix->next) - { - S_SET_VALUE (lfix->sym, frag_now_fix () - 16); - symbol_set_frag (lfix->sym, frag_now); - } - /* and fix up the tags also. */ - for (lfix = md.slot[curr].tag_fixups; lfix; lfix = lfix->next) - { - S_SET_VALUE (lfix->sym, frag_now_fix () - 16 + i); - symbol_set_frag (lfix->sym, frag_now); - } + last_slot = i; for (j = 0; j < md.slot[curr].num_fixups; ++j) { @@ -6405,12 +7073,6 @@ emit_one_bundle () end_of_insn_group = md.slot[curr].end_of_insn_group; - if (end_of_insn_group) - { - md.group_idx = (md.group_idx + 1) % 3; - memset (md.last_groups + md.group_idx, 0, sizeof md.last_groups[0]); - } - /* clear slot: */ ia64_free_opcode (md.slot[curr].idesc); memset (md.slot + curr, 0, sizeof (md.slot[curr])); @@ -6424,16 +7086,48 @@ emit_one_bundle () curr = (curr + 1) % NUM_SLOTS; idesc = md.slot[curr].idesc; } - if (manual_bundling) + + /* A user template was specified, but the first following instruction did + not fit. This can happen with or without manual bundling. */ + if (md.num_slots_in_use > 0 && last_slot < 0) + { + as_bad_where (md.slot[curr].src_file, md.slot[curr].src_line, + "`%s' does not fit into %s template", + idesc->name, ia64_templ_desc[template].name); + /* Drop first insn so we don't livelock. */ + --md.num_slots_in_use; + know (curr == first); + ia64_free_opcode (md.slot[curr].idesc); + memset (md.slot + curr, 0, sizeof (md.slot[curr])); + md.slot[curr].user_template = -1; + } + else if (manual_bundling > 0) { if (md.num_slots_in_use > 0) - as_bad_where (md.slot[curr].src_file, md.slot[curr].src_line, - "`%s' does not fit into %s template", - idesc->name, ia64_templ_desc[template].name); + { + if (last_slot >= 2) + as_bad_where (md.slot[curr].src_file, md.slot[curr].src_line, + "`%s' does not fit into bundle", idesc->name); + else + { + const char *where; + + if (template == 2) + where = "X slot"; + else if (last_slot == 0) + where = "slots 2 or 3"; + else + where = "slot 3"; + as_bad_where (md.slot[curr].src_file, md.slot[curr].src_line, + "`%s' can't go in %s of %s template", + idesc->name, where, ia64_templ_desc[template].name); + } + } else as_bad_where (md.slot[curr].src_file, md.slot[curr].src_line, "Missing '}' at end of file"); } + know (md.num_slots_in_use < NUM_SLOTS); t0 = end_of_insn_group | (template << 1) | (insn[0] << 5) | (insn[1] << 46); @@ -6441,12 +7135,6 @@ emit_one_bundle () number_to_chars_littleendian (f + 0, t0, 8); number_to_chars_littleendian (f + 8, t1, 8); - - if (unwind.list) - { - unwind.list->next_slot_number = (unsigned long) f + 16; - unwind.list->next_slot_frag = frag_now; - } } int @@ -6472,10 +7160,44 @@ md_parse_option (c, arg) else if (strcmp (arg, "le") == 0) { md.flags &= ~EF_IA_64_BE; + default_big_endian = 0; } else if (strcmp (arg, "be") == 0) { md.flags |= EF_IA_64_BE; + default_big_endian = 1; + } + else if (strncmp (arg, "unwind-check=", 13) == 0) + { + arg += 13; + if (strcmp (arg, "warning") == 0) + md.unwind_check = unwind_check_warning; + else if (strcmp (arg, "error") == 0) + md.unwind_check = unwind_check_error; + else + return 0; + } + else if (strncmp (arg, "hint.b=", 7) == 0) + { + arg += 7; + if (strcmp (arg, "ok") == 0) + md.hint_b = hint_b_ok; + else if (strcmp (arg, "warning") == 0) + md.hint_b = hint_b_warning; + else if (strcmp (arg, "error") == 0) + md.hint_b = hint_b_error; + else + return 0; + } + else if (strncmp (arg, "tune=", 5) == 0) + { + arg += 5; + if (strcmp (arg, "itanium1") == 0) + md.tune = itanium1; + else if (strcmp (arg, "itanium2") == 0) + md.tune = itanium2; + else + return 0; } else return 0; @@ -6532,6 +7254,10 @@ md_parse_option (c, arg) { md.default_explicit_mode = 0; } + else if (strcmp (arg, "none") == 0) + { + md.detect_dv = 0; + } else if (strcmp (arg, "debug") == 0) { md.debug_dv = 1; @@ -6541,6 +7267,11 @@ md_parse_option (c, arg) md.default_explicit_mode = 1; md.debug_dv = 1; } + else if (strcmp (arg, "debugn") == 0) + { + md.debug_dv = 1; + md.detect_dv = 0; + } else { as_bad (_("Unrecognized option '-x%s'"), arg); @@ -6580,9 +7311,20 @@ IA-64 options:\n\ EF_IA_64_NOFUNCDESC_CONS_GP)\n\ -milp32|-milp64|-mlp64|-mp64 select data model (default -mlp64)\n\ -mle | -mbe select little- or big-endian byte order (default -mle)\n\ - -x | -xexplicit turn on dependency violation checking (default)\n\ - -xauto automagically remove dependency violations\n\ - -xdebug debug dependency violation checker\n"), + -mtune=[itanium1|itanium2]\n\ + tune for a specific CPU (default -mtune=itanium2)\n\ + -munwind-check=[warning|error]\n\ + unwind directive check (default -munwind-check=warning)\n\ + -mhint.b=[ok|warning|error]\n\ + hint.b check (default -mhint.b=error)\n\ + -x | -xexplicit turn on dependency violation checking\n\ + -xauto automagically remove dependency violations (default)\n\ + -xnone turn off dependency violation checking\n\ + -xdebug debug dependency violation checker\n\ + -xdebugn debug dependency violation checker but turn off\n\ + dependency violation checking\n\ + -xdebugx debug dependency violation checker and turn on\n\ + dependency violation checking\n"), stream); } @@ -6618,17 +7360,37 @@ match (int templ, int type, int slot) return result; } -/* Add a bit of extra goodness if a nop of type F or B would fit - in TEMPL at SLOT. */ +/* For Itanium 1, add a bit of extra goodness if a nop of type F or B would fit + in TEMPL at SLOT. For Itanium 2, add a bit of extra goodness if a nop of + type M or I would fit in TEMPL at SLOT. */ static inline int extra_goodness (int templ, int slot) { - if (slot == 1 && match (templ, IA64_TYPE_F, slot)) - return 2; - if (slot == 2 && match (templ, IA64_TYPE_B, slot)) - return 1; - return 0; + switch (md.tune) + { + case itanium1: + if (slot == 1 && match (templ, IA64_TYPE_F, slot)) + return 2; + else if (slot == 2 && match (templ, IA64_TYPE_B, slot)) + return 1; + else + return 0; + break; + case itanium2: + if (match (templ, IA64_TYPE_M, slot) + || match (templ, IA64_TYPE_I, slot)) + /* Favor M- and I-unit NOPs. We definitely want to avoid + F-unit and B-unit may cause split-issue or less-than-optimal + branch-prediction. */ + return 2; + else + return 0; + break; + default: + abort (); + return 0; + } } /* This function is called once, at assembler startup time. It sets @@ -6637,7 +7399,7 @@ extra_goodness (int templ, int slot) void md_begin () { - int i, j, k, t, total, ar_base, cr_base, goodness, best, regnum, ok; + int i, j, k, t, goodness, best, ok; const char *err; char name[8]; @@ -6648,7 +7410,7 @@ md_begin () /* Make sure function pointers get initialized. */ target_big_endian = -1; - dot_byteorder (TARGET_BYTES_BIG_ENDIAN); + dot_byteorder (default_big_endian); alias_hash = hash_new (); alias_name_hash = hash_new (); @@ -6723,11 +7485,17 @@ md_begin () symbol_new (".", undefined_section, FUNC_IPLT_RELOC, &zero_address_frag); + if (md.tune != itanium1) + { + /* Convert MFI NOPs bundles into MMI NOPs bundles. */ + le_nop[0] = 0x8; + le_nop_stop[0] = 0x9; + } + /* Compute the table of best templates. We compute goodness as a - base 4 value, in which each match counts for 3, each F counts - for 2, each B counts for 1. This should maximize the number of - F and B nops in the chosen bundles, which is good because these - pipelines are least likely to be overcommitted. */ + base 4 value, in which each match counts for 3. Match-failures + result in NOPs and we use extra_goodness() to pick the execution + units that are best suited for issuing the NOP. */ for (i = 0; i < IA64_NUM_TYPES; ++i) for (j = 0; j < IA64_NUM_TYPES; ++j) for (k = 0; k < IA64_NUM_TYPES; ++k) @@ -6740,7 +7508,7 @@ md_begin () { if (match (t, j, 1)) { - if (match (t, k, 2)) + if ((t == 2 && j == IA64_TYPE_X) || match (t, k, 2)) goodness = 3 + 3 + 3; else goodness = 3 + 3 + extra_goodness (t, 2); @@ -6756,7 +7524,7 @@ md_begin () } else if (match (t, i, 1)) { - if (match (t, j, 2)) + if ((t == 2 && i == IA64_TYPE_X) || match (t, j, 2)) goodness = 3 + 3; else goodness = 3 + extra_goodness (t, 2); @@ -6772,6 +7540,21 @@ md_begin () } } +#ifdef DEBUG_TEMPLATES + /* For debugging changes to the best_template calculations. We don't care + about combinations with invalid instructions, so start the loops at 1. */ + for (i = 0; i < IA64_NUM_TYPES; ++i) + for (j = 0; j < IA64_NUM_TYPES; ++j) + for (k = 0; k < IA64_NUM_TYPES; ++k) + { + char type_letter[IA64_NUM_TYPES] = { 'n', 'a', 'i', 'm', 'b', 'f', + 'x', 'd' }; + fprintf (stderr, "%c%c%c %s\n", type_letter[i], type_letter[j], + type_letter[k], + ia64_templ_desc[best_template[i][j][k]].name); + } +#endif + for (i = 0; i < NUM_SLOTS; ++i) md.slot[i].user_template = -1; @@ -6791,91 +7574,52 @@ md_begin () md.entry_hash = hash_new (); /* general registers: */ - - total = 128; - for (i = 0; i < total; ++i) - { - sprintf (name, "r%d", i - REG_GR); - md.regsym[i] = declare_register (name, i); - } + declare_register_set ("r", 128, REG_GR); + declare_register ("gp", REG_GR + 1); + declare_register ("sp", REG_GR + 12); + declare_register ("tp", REG_GR + 13); + declare_register_set ("ret", 4, REG_GR + 8); /* floating point registers: */ - total += 128; - for (; i < total; ++i) - { - sprintf (name, "f%d", i - REG_FR); - md.regsym[i] = declare_register (name, i); - } - - /* application registers: */ - total += 128; - ar_base = i; - for (; i < total; ++i) - { - sprintf (name, "ar%d", i - REG_AR); - md.regsym[i] = declare_register (name, i); - } - - /* control registers: */ - total += 128; - cr_base = i; - for (; i < total; ++i) - { - sprintf (name, "cr%d", i - REG_CR); - md.regsym[i] = declare_register (name, i); - } - - /* predicate registers: */ - total += 64; - for (; i < total; ++i) - { - sprintf (name, "p%d", i - REG_P); - md.regsym[i] = declare_register (name, i); - } + declare_register_set ("f", 128, REG_FR); + declare_register_set ("farg", 8, REG_FR + 8); + declare_register_set ("fret", 8, REG_FR + 8); /* branch registers: */ - total += 8; - for (; i < total; ++i) - { - sprintf (name, "b%d", i - REG_BR); - md.regsym[i] = declare_register (name, i); - } + declare_register_set ("b", 8, REG_BR); + declare_register ("rp", REG_BR + 0); - md.regsym[REG_IP] = declare_register ("ip", REG_IP); - md.regsym[REG_CFM] = declare_register ("cfm", REG_CFM); - md.regsym[REG_PR] = declare_register ("pr", REG_PR); - md.regsym[REG_PR_ROT] = declare_register ("pr.rot", REG_PR_ROT); - md.regsym[REG_PSR] = declare_register ("psr", REG_PSR); - md.regsym[REG_PSR_L] = declare_register ("psr.l", REG_PSR_L); - md.regsym[REG_PSR_UM] = declare_register ("psr.um", REG_PSR_UM); + /* predicate registers: */ + declare_register_set ("p", 64, REG_P); + declare_register ("pr", REG_PR); + declare_register ("pr.rot", REG_PR_ROT); + + /* application registers: */ + declare_register_set ("ar", 128, REG_AR); + for (i = 0; i < NELEMS (ar); ++i) + declare_register (ar[i].name, REG_AR + ar[i].regnum); + + /* control registers: */ + declare_register_set ("cr", 128, REG_CR); + for (i = 0; i < NELEMS (cr); ++i) + declare_register (cr[i].name, REG_CR + cr[i].regnum); + + declare_register ("ip", REG_IP); + declare_register ("cfm", REG_CFM); + declare_register ("psr", REG_PSR); + declare_register ("psr.l", REG_PSR_L); + declare_register ("psr.um", REG_PSR_UM); for (i = 0; i < NELEMS (indirect_reg); ++i) { - regnum = indirect_reg[i].regnum; - md.regsym[regnum] = declare_register (indirect_reg[i].name, regnum); + unsigned int regnum = indirect_reg[i].regnum; + + md.indregsym[regnum - IND_CPUID] = declare_register (indirect_reg[i].name, regnum); } - /* define synonyms for application registers: */ - for (i = REG_AR; i < REG_AR + NELEMS (ar); ++i) - md.regsym[i] = declare_register (ar[i - REG_AR].name, - REG_AR + ar[i - REG_AR].regnum); - - /* define synonyms for control registers: */ - for (i = REG_CR; i < REG_CR + NELEMS (cr); ++i) - md.regsym[i] = declare_register (cr[i - REG_CR].name, - REG_CR + cr[i - REG_CR].regnum); - - declare_register ("gp", REG_GR + 1); - declare_register ("sp", REG_GR + 12); - declare_register ("rp", REG_BR + 0); - /* pseudo-registers used to specify unwind info: */ declare_register ("psp", REG_PSP); - declare_register_set ("ret", 4, REG_GR + 8); - declare_register_set ("farg", 8, REG_FR + 8); - declare_register_set ("fret", 8, REG_FR + 8); - for (i = 0; i < NELEMS (const_bits); ++i) { err = hash_insert (md.const_hash, const_bits[i].name, @@ -6914,10 +7658,9 @@ md_begin () md.entry_labels = NULL; } -/* Set the elf type to 64 bit ABI by default. Cannot do this in md_begin - because that is called after md_parse_option which is where we do the - dynamic changing of md.flags based on -mlp64 or -milp32. Also, set the - default endianness. */ +/* Set the default options in md. Cannot do this in md_begin because + that is called after md_parse_option which is where we set the + options in md based on command line options. */ void ia64_init (argc, argv) @@ -6925,6 +7668,11 @@ ia64_init (argc, argv) char **argv ATTRIBUTE_UNUSED; { md.flags = MD_FLAGS_DEFAULT; + md.detect_dv = 1; + /* FIXME: We should change it to unwind_check_error someday. */ + md.unwind_check = unwind_check_warning; + md.hint_b = hint_b_error; + md.tune = itanium2; } /* Return a string for the target object file format. */ @@ -6990,6 +7738,15 @@ ia64_end_of_source () void ia64_start_line () { + static int first; + + if (!first) { + /* Make sure we don't reference input_line_pointer[-1] when that's + not valid. */ + first = 1; + return; + } + if (md.qp.X_op == O_register) as_bad ("qualifying predicate not followed by instruction"); md.qp.X_op = O_absent; @@ -7000,42 +7757,20 @@ ia64_start_line () if (input_line_pointer[0] == ';' && input_line_pointer[-1] == ';') { if (md.detect_dv && !md.explicit_mode) - as_warn (_("Explicit stops are ignored in auto mode")); + { + static int warned; + + if (!warned) + { + warned = 1; + as_warn (_("Explicit stops are ignored in auto mode")); + } + } else insn_group_break (1, 0, 0); } -} - -/* This is a hook for ia64_frob_label, so that it can distinguish tags from - labels. */ -static int defining_tag = 0; - -int -ia64_unrecognized_line (ch) - int ch; -{ - switch (ch) + else if (input_line_pointer[-1] == '{') { - case '(': - expression (&md.qp); - if (*input_line_pointer++ != ')') - { - as_bad ("Expected ')'"); - return 0; - } - if (md.qp.X_op != O_register) - { - as_bad ("Qualifying predicate expected"); - return 0; - } - if (md.qp.X_add_number < REG_P || md.qp.X_add_number >= REG_P + 64) - { - as_bad ("Predicate register expected"); - return 0; - } - return 1; - - case '{': if (md.manual_bundling) as_warn ("Found '{' when manual bundling is already turned on"); else @@ -7052,9 +7787,9 @@ ia64_unrecognized_line (ch) else as_warn (_("Found '{' after explicit switch to automatic mode")); } - return 1; - - case '}': + } + else if (input_line_pointer[-1] == '}') + { if (!md.manual_bundling) as_warn ("Found '}' when manual bundling is off"); else @@ -7067,17 +7802,36 @@ ia64_unrecognized_line (ch) && !md.mode_explicitly_set && !md.default_explicit_mode) dot_dv_mode ('A'); + } +} - /* Allow '{' to follow on the same line. We also allow ";;", but that - happens automatically because ';' is an end of line marker. */ - SKIP_WHITESPACE (); - if (input_line_pointer[0] == '{') +/* This is a hook for ia64_frob_label, so that it can distinguish tags from + labels. */ +static int defining_tag = 0; + +int +ia64_unrecognized_line (ch) + int ch; +{ + switch (ch) + { + case '(': + expression_and_evaluate (&md.qp); + if (*input_line_pointer++ != ')') { - input_line_pointer++; - return ia64_unrecognized_line ('{'); + as_bad ("Expected ')'"); + return 0; + } + if (md.qp.X_op != O_register) + { + as_bad ("Qualifying predicate expected"); + return 0; + } + if (md.qp.X_add_number < REG_P || md.qp.X_add_number >= REG_P + 64) + { + as_bad ("Predicate register expected"); + return 0; } - - demand_empty_rest_of_line (); return 1; case '[': @@ -7162,6 +7916,7 @@ ia64_frob_label (sym) fix = obstack_alloc (¬es, sizeof (*fix)); fix->sym = sym; fix->next = CURR_SLOT.tag_fixups; + fix->dw2_mark_labels = FALSE; CURR_SLOT.tag_fixups = fix; return; @@ -7173,6 +7928,7 @@ ia64_frob_label (sym) fix = obstack_alloc (¬es, sizeof (*fix)); fix->sym = sym; fix->next = CURR_SLOT.label_fixups; + fix->dw2_mark_labels = dwarf2_loc_mark_labels; CURR_SLOT.label_fixups = fix; /* Keep track of how many code entry points we've seen. */ @@ -7227,52 +7983,148 @@ ia64_optimize_expr (l, op, r) operatorT op; expressionS *r; { - unsigned num_regs; - - if (op == O_index) + if (op != O_index) + return 0; + resolve_expression (l); + if (l->X_op == O_register) { - if (l->X_op == O_register && r->X_op == O_constant) + unsigned num_regs = l->X_add_number >> 16; + + resolve_expression (r); + if (num_regs) { - num_regs = (l->X_add_number >> 16); - if ((unsigned) r->X_add_number >= num_regs) + /* Left side is a .rotX-allocated register. */ + if (r->X_op != O_constant) { - if (!num_regs) - as_bad ("No current frame"); - else - as_bad ("Index out of range 0..%u", num_regs - 1); + as_bad ("Rotating register index must be a non-negative constant"); + r->X_add_number = 0; + } + else if ((valueT) r->X_add_number >= num_regs) + { + as_bad ("Index out of range 0..%u", num_regs - 1); r->X_add_number = 0; } l->X_add_number = (l->X_add_number & 0xffff) + r->X_add_number; return 1; } - else if (l->X_op == O_register && r->X_op == O_register) + else if (l->X_add_number >= IND_CPUID && l->X_add_number <= IND_RR) { - if (l->X_add_number < IND_CPUID || l->X_add_number > IND_RR - || l->X_add_number == IND_MEM) + if (r->X_op != O_register + || r->X_add_number < REG_GR + || r->X_add_number > REG_GR + 127) { - as_bad ("Indirect register set name expected"); - l->X_add_number = IND_CPUID; + as_bad ("Indirect register index must be a general register"); + r->X_add_number = REG_GR; } l->X_op = O_index; - l->X_op_symbol = md.regsym[l->X_add_number]; + l->X_op_symbol = md.indregsym[l->X_add_number - IND_CPUID]; l->X_add_number = r->X_add_number; return 1; } } - return 0; + as_bad ("Index can only be applied to rotating or indirect registers"); + /* Fall back to some register use of which has as little as possible + side effects, to minimize subsequent error messages. */ + l->X_op = O_register; + l->X_add_number = REG_GR + 3; + return 1; } int -ia64_parse_name (name, e) +ia64_parse_name (name, e, nextcharP) char *name; expressionS *e; + char *nextcharP; { struct const_desc *cdesc; struct dynreg *dr = 0; - unsigned int regnum; + unsigned int idx; struct symbol *sym; char *end; + if (*name == '@') + { + enum pseudo_type pseudo_type = PSEUDO_FUNC_NONE; + + /* Find what relocation pseudo-function we're dealing with. */ + for (idx = 0; idx < NELEMS (pseudo_func); ++idx) + if (pseudo_func[idx].name + && pseudo_func[idx].name[0] == name[1] + && strcmp (pseudo_func[idx].name + 1, name + 2) == 0) + { + pseudo_type = pseudo_func[idx].type; + break; + } + switch (pseudo_type) + { + case PSEUDO_FUNC_RELOC: + end = input_line_pointer; + if (*nextcharP != '(') + { + as_bad ("Expected '('"); + break; + } + /* Skip '('. */ + ++input_line_pointer; + expression (e); + if (*input_line_pointer != ')') + { + as_bad ("Missing ')'"); + goto done; + } + /* Skip ')'. */ + ++input_line_pointer; + if (e->X_op != O_symbol) + { + if (e->X_op != O_pseudo_fixup) + { + as_bad ("Not a symbolic expression"); + goto done; + } + if (idx != FUNC_LT_RELATIVE) + { + as_bad ("Illegal combination of relocation functions"); + goto done; + } + switch (S_GET_VALUE (e->X_op_symbol)) + { + case FUNC_FPTR_RELATIVE: + idx = FUNC_LT_FPTR_RELATIVE; break; + case FUNC_DTP_MODULE: + idx = FUNC_LT_DTP_MODULE; break; + case FUNC_DTP_RELATIVE: + idx = FUNC_LT_DTP_RELATIVE; break; + case FUNC_TP_RELATIVE: + idx = FUNC_LT_TP_RELATIVE; break; + default: + as_bad ("Illegal combination of relocation functions"); + goto done; + } + } + /* Make sure gas doesn't get rid of local symbols that are used + in relocs. */ + e->X_op = O_pseudo_fixup; + e->X_op_symbol = pseudo_func[idx].u.sym; + done: + *nextcharP = *input_line_pointer; + break; + + case PSEUDO_FUNC_CONST: + e->X_op = O_constant; + e->X_add_number = pseudo_func[idx].u.ival; + break; + + case PSEUDO_FUNC_REG: + e->X_op = O_register; + e->X_add_number = pseudo_func[idx].u.ival; + break; + + default: + return 0; + } + return 1; + } + /* first see if NAME is a known register name: */ sym = hash_find (md.reg_hash, name); if (sym) @@ -7291,13 +8143,14 @@ ia64_parse_name (name, e) } /* check for inN, locN, or outN: */ + idx = 0; switch (name[0]) { case 'i': if (name[1] == 'n' && ISDIGIT (name[2])) { dr = &md.in; - name += 2; + idx = 2; } break; @@ -7305,7 +8158,7 @@ ia64_parse_name (name, e) if (name[1] == 'o' && name[2] == 'c' && ISDIGIT (name[3])) { dr = &md.loc; - name += 3; + idx = 3; } break; @@ -7313,7 +8166,7 @@ ia64_parse_name (name, e) if (name[1] == 'u' && name[2] == 't' && ISDIGIT (name[3])) { dr = &md.out; - name += 3; + idx = 3; } break; @@ -7321,13 +8174,16 @@ ia64_parse_name (name, e) break; } - if (dr) + /* Ignore register numbers with leading zeroes, except zero itself. */ + if (dr && (name[idx] != '0' || name[idx + 1] == '\0')) { + unsigned long regnum; + /* The name is inN, locN, or outN; parse the register number. */ - regnum = strtoul (name, &end, 10); - if (end > name && *end == '\0') + regnum = strtoul (name + idx, &end, 10); + if (end > name + idx && *end == '\0' && regnum < 96) { - if ((unsigned) regnum >= dr->num_regs) + if (regnum >= dr->num_regs) { if (!dr->num_regs) as_bad ("No current frame"); @@ -7342,6 +8198,9 @@ ia64_parse_name (name, e) } } + end = alloca (strlen (name) + 1); + strcpy (end, name); + name = ia64_canonicalize_symbol_name (end); if ((dr = hash_find (md.dynreg_hash, name))) { /* We've got ourselves the name of a rotating register set. @@ -7361,9 +8220,18 @@ char * ia64_canonicalize_symbol_name (name) char *name; { - size_t len = strlen (name); - if (len > 1 && name[len - 1] == '#') - name[len - 1] = '\0'; + size_t len = strlen (name), full = len; + + while (len > 0 && name[len - 1] == '#') + --len; + if (len <= 0) + { + if (full > 0) + as_bad ("Standalone `#' is illegal"); + } + else if (len < full - 1) + as_warn ("Redundant `#' suffix operators"); + name[len] = '\0'; return name; } @@ -7474,6 +8342,8 @@ depends_on (depind, idesc) IC:rse-writers. 15+16) Represents reserved instructions, which the assembler does not generate. + 17) CR[TPR] has a RAW dependency only between mov-to-CR-TPR and + mov-to-PSR-l or ssm instructions that set PSR.i, PSR.pp or PSR.up. Memory resources (i.e. locations in memory) are *not* marked or tracked by this code; there are no dependency violations based on memory access. @@ -7509,9 +8379,15 @@ specify_resource (dep, idesc, type, specs, note, path) tmpl.qp_regno = CURR_SLOT.qp_regno; tmpl.link_to_qp_branch = 1; tmpl.mem_offset.hint = 0; + tmpl.mem_offset.offset = 0; + tmpl.mem_offset.base = 0; tmpl.specific = 1; - tmpl.index = 0; + tmpl.index = -1; tmpl.cmp_type = CMP_NONE; + tmpl.depind = 0; + tmpl.file = NULL; + tmpl.line = 0; + tmpl.path = 0; #define UNHANDLED \ as_warn (_("Unhandled dependency %s for %s (%s), note %d"), \ @@ -8556,8 +9432,9 @@ dep->name, idesc->name, (rsrc_write?"write":"read"), note) break; case IA64_RS_CRX: - /* Handle all CR[REG] resources */ - if (note == 0 || note == 1) + /* Handle all CR[REG] resources. + ??? FIXME: The rule 17 isn't really handled correctly. */ + if (note == 0 || note == 1 || note == 17) { if (idesc->operands[!rsrc_write] == IA64_OPND_CR3) { @@ -8753,8 +9630,7 @@ dep->name, idesc->name, (rsrc_write?"write":"read"), note) if (idesc->operands[0] == IA64_OPND_AR3 && CURR_SLOT.opnd[0].X_add_number - REG_AR == AR_BSPSTORE) { - specs[count] = tmpl; - specs[count++].index = 0; /* IA64_RSE_BSPLOAD/RNATBITINDEX */ + specs[count++] = tmpl; } } else @@ -9208,6 +10084,7 @@ note_register_values (idesc) else if (idesc->operands[0] == IA64_OPND_R1 && (idesc->operands[1] == IA64_OPND_IMM22 || idesc->operands[1] == IA64_OPND_IMMU64) + && CURR_SLOT.opnd[1].X_op == O_constant && (strcmp (idesc->name, "mov") == 0 || strcmp (idesc->name, "movl") == 0)) { @@ -9225,6 +10102,30 @@ note_register_values (idesc) } } } + /* Look for dep.z imm insns. */ + else if (idesc->operands[0] == IA64_OPND_R1 + && idesc->operands[1] == IA64_OPND_IMM8 + && strcmp (idesc->name, "dep.z") == 0) + { + int regno = CURR_SLOT.opnd[0].X_add_number - REG_GR; + if (regno > 0 && regno < NELEMS (gr_values)) + { + valueT value = CURR_SLOT.opnd[1].X_add_number; + + if (CURR_SLOT.opnd[3].X_add_number < 64) + value &= ((valueT)1 << CURR_SLOT.opnd[3].X_add_number) - 1; + value <<= CURR_SLOT.opnd[2].X_add_number; + gr_values[regno].known = 1; + gr_values[regno].value = value; + gr_values[regno].path = md.path; + if (md.debug_dv) + { + fprintf (stderr, " Know gr%d = ", regno); + fprintf_vma (stderr, gr_values[regno].value); + fputs ("\n", stderr); + } + } + } else { clear_qp_mutex (qp_changemask); @@ -9330,10 +10231,6 @@ resources_match (rs, idesc, note, qp_regno, path) else if (specs[count].index == rs->index) return 1; } -#if 0 - if (md.debug_dv) - fprintf (stderr, " No %s conflicts\n", rs->dependency->name); -#endif return 0; } @@ -9449,7 +10346,7 @@ print_dependency (action, depind) fprintf (stderr, " %s %s '%s'", action, dv_mode[(regdeps[depind].dependency)->mode], (regdeps[depind].dependency)->name); - if (regdeps[depind].specific && regdeps[depind].index != 0) + if (regdeps[depind].specific && regdeps[depind].index >= 0) fprintf (stderr, " (%d)", regdeps[depind].index); if (regdeps[depind].mem_offset.hint) { @@ -9513,17 +10410,16 @@ remove_marked_resource (rs) insn_group_break (1, 0, 0); if (rs->insn_srlz < STATE_SRLZ) { - int oldqp = CURR_SLOT.qp_regno; - struct ia64_opcode *oldidesc = CURR_SLOT.idesc; + struct slot oldslot = CURR_SLOT; /* Manually jam a srlz.i insn into the stream */ - CURR_SLOT.qp_regno = 0; + memset (&CURR_SLOT, 0, sizeof (CURR_SLOT)); + CURR_SLOT.user_template = -1; CURR_SLOT.idesc = ia64_find_opcode ("srlz.i"); instruction_serialization (); md.curr_slot = (md.curr_slot + 1) % NUM_SLOTS; if (++md.num_slots_in_use >= NUM_SLOTS) emit_one_bundle (); - CURR_SLOT.qp_regno = oldqp; - CURR_SLOT.idesc = oldidesc; + CURR_SLOT = oldslot; } insn_group_break (1, 0, 0); break; @@ -9536,17 +10432,16 @@ remove_marked_resource (rs) if (rs->data_srlz < STATE_STOP) insn_group_break (1, 0, 0); { - int oldqp = CURR_SLOT.qp_regno; - struct ia64_opcode *oldidesc = CURR_SLOT.idesc; + struct slot oldslot = CURR_SLOT; /* Manually jam a srlz.d insn into the stream */ - CURR_SLOT.qp_regno = 0; + memset (&CURR_SLOT, 0, sizeof (CURR_SLOT)); + CURR_SLOT.user_template = -1; CURR_SLOT.idesc = ia64_find_opcode ("srlz.d"); data_serialization (); md.curr_slot = (md.curr_slot + 1) % NUM_SLOTS; if (++md.num_slots_in_use >= NUM_SLOTS) emit_one_bundle (); - CURR_SLOT.qp_regno = oldqp; - CURR_SLOT.idesc = oldidesc; + CURR_SLOT = oldslot; } break; case IA64_DVS_IMPLIED: @@ -9651,7 +10546,7 @@ check_dependencies (idesc) if (path != 0) sprintf (pathmsg, " when entry is at label '%s'", md.entry_labels[path - 1]); - if (rs->specific && rs->index != 0) + if (matchtype == 1 && rs->index >= 0) sprintf (indexmsg, ", specific resource number is %d", rs->index); sprintf (msg, "Use of '%s' %s %s dependency '%s' (%s)%s%s", @@ -9738,12 +10633,6 @@ mark_resources (idesc) count = specify_resource (dep, idesc, DV_REG, specs, note, md.path); -#if 0 - if (md.debug_dv && !count) - fprintf (stderr, " No %s %s usage found (path %d)\n", - dv_mode[dep->mode], dep->name, md.path); -#endif - while (count-- > 0) { mark_resource (idesc, dep, &specs[count], @@ -9960,9 +10849,6 @@ md_assemble (str) mnemonic = "adds"; ia64_free_opcode (idesc); idesc = ia64_find_opcode (mnemonic); -#if 0 - know (!idesc->next); -#endif } else if (strcmp (idesc->name, "mov") == 0) { @@ -9977,17 +10863,67 @@ md_assemble (str) rop = 1; else abort (); - if (CURR_SLOT.opnd[rop].X_op == O_register - && ar_is_in_integer_unit (CURR_SLOT.opnd[rop].X_add_number)) - mnemonic = "mov.i"; + if (CURR_SLOT.opnd[rop].X_op == O_register) + { + if (ar_is_only_in_integer_unit (CURR_SLOT.opnd[rop].X_add_number)) + mnemonic = "mov.i"; + else if (ar_is_only_in_memory_unit (CURR_SLOT.opnd[rop].X_add_number)) + mnemonic = "mov.m"; + else + rop = -1; + } else - mnemonic = "mov.m"; - ia64_free_opcode (idesc); - idesc = ia64_find_opcode (mnemonic); - while (idesc != NULL - && (idesc->operands[0] != opnd1 - || idesc->operands[1] != opnd2)) - idesc = get_next_opcode (idesc); + abort (); + if (rop >= 0) + { + ia64_free_opcode (idesc); + idesc = ia64_find_opcode (mnemonic); + while (idesc != NULL + && (idesc->operands[0] != opnd1 + || idesc->operands[1] != opnd2)) + idesc = get_next_opcode (idesc); + } + } + } + else if (strcmp (idesc->name, "mov.i") == 0 + || strcmp (idesc->name, "mov.m") == 0) + { + enum ia64_opnd opnd1, opnd2; + int rop; + + opnd1 = idesc->operands[0]; + opnd2 = idesc->operands[1]; + if (opnd1 == IA64_OPND_AR3) + rop = 0; + else if (opnd2 == IA64_OPND_AR3) + rop = 1; + else + abort (); + if (CURR_SLOT.opnd[rop].X_op == O_register) + { + char unit = 'a'; + if (ar_is_only_in_integer_unit (CURR_SLOT.opnd[rop].X_add_number)) + unit = 'i'; + else if (ar_is_only_in_memory_unit (CURR_SLOT.opnd[rop].X_add_number)) + unit = 'm'; + if (unit != 'a' && unit != idesc->name [4]) + as_bad ("AR %d can only be accessed by %c-unit", + (int) (CURR_SLOT.opnd[rop].X_add_number - REG_AR), + TOUPPER (unit)); + } + } + else if (strcmp (idesc->name, "hint.b") == 0) + { + switch (md.hint_b) + { + case hint_b_ok: + break; + case hint_b_warning: + as_warn ("hint.b may be treated as nop"); + break; + case hint_b_error: + as_bad ("hint.b shouldn't be used"); + break; } } @@ -10035,12 +10971,26 @@ md_assemble (str) as_where (&CURR_SLOT.src_file, &CURR_SLOT.src_line); dwarf2_where (&CURR_SLOT.debug_line); - /* Add unwind entry, if there is one. */ + /* Add unwind entries, if there are any. */ if (unwind.current_entry) { CURR_SLOT.unwind_record = unwind.current_entry; unwind.current_entry = NULL; } + if (unwind.pending_saves) + { + if (unwind.pending_saves->next) + { + /* Attach the next pending save to the next slot so that its + slot number will get set correctly. */ + add_unwind_entry (unwind.pending_saves->next, NOT_A_CHAR); + unwind.pending_saves = &unwind.pending_saves->next->r.record.p; + } + else + unwind.pending_saves = NULL; + } + if (unwind.proc_pending.sym && S_IS_DEFINED (unwind.proc_pending.sym)) + unwind.insn = 1; /* Check for dependency violations. */ if (md.detect_dv) @@ -10077,110 +11027,25 @@ void md_operand (e) expressionS *e; { - enum pseudo_type pseudo_type; - const char *name; - size_t len; - int ch, i; - switch (*input_line_pointer) { - case '@': - /* Find what relocation pseudo-function we're dealing with. */ - pseudo_type = 0; - ch = *++input_line_pointer; - for (i = 0; i < NELEMS (pseudo_func); ++i) - if (pseudo_func[i].name && pseudo_func[i].name[0] == ch) - { - len = strlen (pseudo_func[i].name); - if (strncmp (pseudo_func[i].name + 1, - input_line_pointer + 1, len - 1) == 0 - && !is_part_of_name (input_line_pointer[len])) - { - input_line_pointer += len; - pseudo_type = pseudo_func[i].type; - break; - } - } - switch (pseudo_type) - { - case PSEUDO_FUNC_RELOC: - SKIP_WHITESPACE (); - if (*input_line_pointer != '(') - { - as_bad ("Expected '('"); - goto err; - } - /* Skip '('. */ - ++input_line_pointer; - expression (e); - if (*input_line_pointer++ != ')') - { - as_bad ("Missing ')'"); - goto err; - } - if (e->X_op != O_symbol) - { - if (e->X_op != O_pseudo_fixup) - { - as_bad ("Not a symbolic expression"); - goto err; - } - if (i != FUNC_LT_RELATIVE) - { - as_bad ("Illegal combination of relocation functions"); - goto err; - } - switch (S_GET_VALUE (e->X_op_symbol)) - { - case FUNC_FPTR_RELATIVE: - i = FUNC_LT_FPTR_RELATIVE; break; - case FUNC_DTP_MODULE: - i = FUNC_LT_DTP_MODULE; break; - case FUNC_DTP_RELATIVE: - i = FUNC_LT_DTP_RELATIVE; break; - case FUNC_TP_RELATIVE: - i = FUNC_LT_TP_RELATIVE; break; - default: - as_bad ("Illegal combination of relocation functions"); - goto err; - } - } - /* Make sure gas doesn't get rid of local symbols that are used - in relocs. */ - e->X_op = O_pseudo_fixup; - e->X_op_symbol = pseudo_func[i].u.sym; - break; - - case PSEUDO_FUNC_CONST: - e->X_op = O_constant; - e->X_add_number = pseudo_func[i].u.ival; - break; - - case PSEUDO_FUNC_REG: - e->X_op = O_register; - e->X_add_number = pseudo_func[i].u.ival; - break; - - default: - name = input_line_pointer - 1; - get_symbol_end (); - as_bad ("Unknown pseudo function `%s'", name); - goto err; - } - break; - case '[': ++input_line_pointer; - expression (e); + expression_and_evaluate (e); if (*input_line_pointer != ']') { - as_bad ("Closing bracket misssing"); + as_bad ("Closing bracket missing"); goto err; } else { - if (e->X_op != O_register) - as_bad ("Register expected as index"); + if (e->X_op != O_register + || e->X_add_number < REG_GR + || e->X_add_number > REG_GR + 127) + { + as_bad ("Index must be a general register"); + e->X_add_number = REG_GR; + } ++input_line_pointer; e->X_op = O_index; @@ -10205,7 +11070,7 @@ ia64_fix_adjustable (fix) fixS *fix; { /* Prevent all adjustments to global symbols */ - if (S_IS_EXTERN (fix->fx_addsy) || S_IS_WEAK (fix->fx_addsy)) + if (S_IS_EXTERNAL (fix->fx_addsy) || S_IS_WEAK (fix->fx_addsy)) return 0; switch (fix->fx_r_type) @@ -10366,7 +11231,7 @@ ia64_cons_fix_new (f, where, nbytes, exp) fix = fix_new_exp (f, where, nbytes, exp, 0, code); /* We need to store the byte order in effect in case we're going to fix an 8 or 16 bit relocation (for which there no real - relocs available). See md_apply_fix3(). */ + relocs available). See md_apply_fix(). */ fix->tc_fix_data.bigendian = target_big_endian; } @@ -10380,6 +11245,7 @@ ia64_gen_real_reloc_type (sym, r_type) bfd_reloc_code_real_type r_type; { bfd_reloc_code_real_type new = 0; + const char *type = NULL, *suffix = ""; if (sym == NULL) { @@ -10396,7 +11262,7 @@ ia64_gen_real_reloc_type (sym, r_type) case BFD_RELOC_IA64_DIR32LSB: new = BFD_RELOC_IA64_FPTR32LSB; break; case BFD_RELOC_IA64_DIR64MSB: new = BFD_RELOC_IA64_FPTR64MSB; break; case BFD_RELOC_IA64_DIR64LSB: new = BFD_RELOC_IA64_FPTR64LSB; break; - default: break; + default: type = "FPTR"; break; } break; @@ -10409,7 +11275,7 @@ ia64_gen_real_reloc_type (sym, r_type) case BFD_RELOC_IA64_DIR32LSB: new = BFD_RELOC_IA64_GPREL32LSB; break; case BFD_RELOC_IA64_DIR64MSB: new = BFD_RELOC_IA64_GPREL64MSB; break; case BFD_RELOC_IA64_DIR64LSB: new = BFD_RELOC_IA64_GPREL64LSB; break; - default: break; + default: type = "GPREL"; break; } break; @@ -10418,7 +11284,7 @@ ia64_gen_real_reloc_type (sym, r_type) { case BFD_RELOC_IA64_IMM22: new = BFD_RELOC_IA64_LTOFF22; break; case BFD_RELOC_IA64_IMM64: new = BFD_RELOC_IA64_LTOFF64I; break; - default: break; + default: type = "LTOFF"; break; } break; @@ -10426,7 +11292,7 @@ ia64_gen_real_reloc_type (sym, r_type) switch (r_type) { case BFD_RELOC_IA64_IMM22: new = BFD_RELOC_IA64_LTOFF22X; break; - default: break; + default: type = "LTOFF"; suffix = "X"; break; } break; @@ -10439,7 +11305,7 @@ ia64_gen_real_reloc_type (sym, r_type) case BFD_RELOC_IA64_DIR32LSB: new = BFD_RELOC_IA64_PCREL32LSB; break; case BFD_RELOC_IA64_DIR64MSB: new = BFD_RELOC_IA64_PCREL64MSB; break; case BFD_RELOC_IA64_DIR64LSB: new = BFD_RELOC_IA64_PCREL64LSB; break; - default: break; + default: type = "PCREL"; break; } break; @@ -10450,7 +11316,7 @@ ia64_gen_real_reloc_type (sym, r_type) case BFD_RELOC_IA64_IMM64: new = BFD_RELOC_IA64_PLTOFF64I; break; case BFD_RELOC_IA64_DIR64MSB: new = BFD_RELOC_IA64_PLTOFF64MSB;break; case BFD_RELOC_IA64_DIR64LSB: new = BFD_RELOC_IA64_PLTOFF64LSB;break; - default: break; + default: type = "PLTOFF"; break; } break; @@ -10461,7 +11327,7 @@ ia64_gen_real_reloc_type (sym, r_type) case BFD_RELOC_IA64_DIR32LSB: new = BFD_RELOC_IA64_SECREL32LSB;break; case BFD_RELOC_IA64_DIR64MSB: new = BFD_RELOC_IA64_SECREL64MSB;break; case BFD_RELOC_IA64_DIR64LSB: new = BFD_RELOC_IA64_SECREL64LSB;break; - default: break; + default: type = "SECREL"; break; } break; @@ -10472,7 +11338,7 @@ ia64_gen_real_reloc_type (sym, r_type) case BFD_RELOC_IA64_DIR32LSB: new = BFD_RELOC_IA64_SEGREL32LSB;break; case BFD_RELOC_IA64_DIR64MSB: new = BFD_RELOC_IA64_SEGREL64MSB;break; case BFD_RELOC_IA64_DIR64LSB: new = BFD_RELOC_IA64_SEGREL64LSB;break; - default: break; + default: type = "SEGREL"; break; } break; @@ -10483,7 +11349,7 @@ ia64_gen_real_reloc_type (sym, r_type) case BFD_RELOC_IA64_DIR32LSB: new = BFD_RELOC_IA64_LTV32LSB; break; case BFD_RELOC_IA64_DIR64MSB: new = BFD_RELOC_IA64_LTV64MSB; break; case BFD_RELOC_IA64_DIR64LSB: new = BFD_RELOC_IA64_LTV64LSB; break; - default: break; + default: type = "LTV"; break; } break; @@ -10494,22 +11360,28 @@ ia64_gen_real_reloc_type (sym, r_type) new = BFD_RELOC_IA64_LTOFF_FPTR22; break; case BFD_RELOC_IA64_IMM64: new = BFD_RELOC_IA64_LTOFF_FPTR64I; break; + case BFD_RELOC_IA64_DIR32MSB: + new = BFD_RELOC_IA64_LTOFF_FPTR32MSB; break; + case BFD_RELOC_IA64_DIR32LSB: + new = BFD_RELOC_IA64_LTOFF_FPTR32LSB; break; + case BFD_RELOC_IA64_DIR64MSB: + new = BFD_RELOC_IA64_LTOFF_FPTR64MSB; break; + case BFD_RELOC_IA64_DIR64LSB: + new = BFD_RELOC_IA64_LTOFF_FPTR64LSB; break; default: - break; + type = "LTOFF_FPTR"; break; } break; case FUNC_TP_RELATIVE: switch (r_type) { - case BFD_RELOC_IA64_IMM14: - new = BFD_RELOC_IA64_TPREL14; break; - case BFD_RELOC_IA64_IMM22: - new = BFD_RELOC_IA64_TPREL22; break; - case BFD_RELOC_IA64_IMM64: - new = BFD_RELOC_IA64_TPREL64I; break; - default: - break; + case BFD_RELOC_IA64_IMM14: new = BFD_RELOC_IA64_TPREL14; break; + case BFD_RELOC_IA64_IMM22: new = BFD_RELOC_IA64_TPREL22; break; + case BFD_RELOC_IA64_IMM64: new = BFD_RELOC_IA64_TPREL64I; break; + case BFD_RELOC_IA64_DIR64MSB: new = BFD_RELOC_IA64_TPREL64MSB; break; + case BFD_RELOC_IA64_DIR64LSB: new = BFD_RELOC_IA64_TPREL64LSB; break; + default: type = "TPREL"; break; } break; @@ -10519,7 +11391,19 @@ ia64_gen_real_reloc_type (sym, r_type) case BFD_RELOC_IA64_IMM22: new = BFD_RELOC_IA64_LTOFF_TPREL22; break; default: - break; + type = "LTOFF_TPREL"; break; + } + break; + + case FUNC_DTP_MODULE: + switch (r_type) + { + case BFD_RELOC_IA64_DIR64MSB: + new = BFD_RELOC_IA64_DTPMOD64MSB; break; + case BFD_RELOC_IA64_DIR64LSB: + new = BFD_RELOC_IA64_DTPMOD64LSB; break; + default: + type = "DTPMOD"; break; } break; @@ -10529,13 +11413,17 @@ ia64_gen_real_reloc_type (sym, r_type) case BFD_RELOC_IA64_IMM22: new = BFD_RELOC_IA64_LTOFF_DTPMOD22; break; default: - break; + type = "LTOFF_DTPMOD"; break; } break; case FUNC_DTP_RELATIVE: switch (r_type) { + case BFD_RELOC_IA64_DIR32MSB: + new = BFD_RELOC_IA64_DTPREL32MSB; break; + case BFD_RELOC_IA64_DIR32LSB: + new = BFD_RELOC_IA64_DTPREL32LSB; break; case BFD_RELOC_IA64_DIR64MSB: new = BFD_RELOC_IA64_DTPREL64MSB; break; case BFD_RELOC_IA64_DIR64LSB: @@ -10547,7 +11435,7 @@ ia64_gen_real_reloc_type (sym, r_type) case BFD_RELOC_IA64_IMM64: new = BFD_RELOC_IA64_DTPREL64I; break; default: - break; + type = "DTPREL"; break; } break; @@ -10557,22 +11445,49 @@ ia64_gen_real_reloc_type (sym, r_type) case BFD_RELOC_IA64_IMM22: new = BFD_RELOC_IA64_LTOFF_DTPREL22; break; default: - break; + type = "LTOFF_DTPREL"; break; } break; case FUNC_IPLT_RELOC: + switch (r_type) + { + case BFD_RELOC_IA64_IPLTMSB: return r_type; + case BFD_RELOC_IA64_IPLTLSB: return r_type; + default: type = "IPLT"; break; + } break; default: abort (); } - /* Hmmmm. Should this ever occur? */ if (new) return new; else - return r_type; + { + int width; + + if (!type) + abort (); + switch (r_type) + { + case BFD_RELOC_IA64_DIR32MSB: width = 32; suffix = "MSB"; break; + case BFD_RELOC_IA64_DIR32LSB: width = 32; suffix = "LSB"; break; + case BFD_RELOC_IA64_DIR64MSB: width = 64; suffix = "MSB"; break; + case BFD_RELOC_IA64_DIR64LSB: width = 64; suffix = "LSB"; break; + case BFD_RELOC_UNUSED: width = 13; break; + case BFD_RELOC_IA64_IMM14: width = 14; break; + case BFD_RELOC_IA64_IMM22: width = 22; break; + case BFD_RELOC_IA64_IMM64: width = 64; suffix = "I"; break; + default: abort (); + } + + /* This should be an error, but since previously there wasn't any + diagnostic here, dont't make it fail because of this for now. */ + as_warn ("Cannot express %s%d%s relocation", type, width, suffix); + return r_type; + } } /* Here is where generate the appropriate reloc for pseudo relocation @@ -10663,7 +11578,7 @@ fix_insn (fix, odesc, value) (if possible). */ void -md_apply_fix3 (fix, valP, seg) +md_apply_fix (fix, valP, seg) fixS *fix; valueT *valP; segT seg ATTRIBUTE_UNUSED; @@ -10675,27 +11590,24 @@ md_apply_fix3 (fix, valP, seg) if (fix->fx_pcrel) { - switch (fix->fx_r_type) - { - case BFD_RELOC_IA64_DIR32MSB: - fix->fx_r_type = BFD_RELOC_IA64_PCREL32MSB; - break; - - case BFD_RELOC_IA64_DIR32LSB: - fix->fx_r_type = BFD_RELOC_IA64_PCREL32LSB; - break; - - case BFD_RELOC_IA64_DIR64MSB: - fix->fx_r_type = BFD_RELOC_IA64_PCREL64MSB; - break; - - case BFD_RELOC_IA64_DIR64LSB: - fix->fx_r_type = BFD_RELOC_IA64_PCREL64LSB; - break; - - default: - break; - } + switch (fix->fx_r_type) + { + case BFD_RELOC_IA64_PCREL21B: break; + case BFD_RELOC_IA64_PCREL21BI: break; + case BFD_RELOC_IA64_PCREL21F: break; + case BFD_RELOC_IA64_PCREL21M: break; + case BFD_RELOC_IA64_PCREL60B: break; + case BFD_RELOC_IA64_PCREL22: break; + case BFD_RELOC_IA64_PCREL64I: break; + case BFD_RELOC_IA64_PCREL32MSB: break; + case BFD_RELOC_IA64_PCREL32LSB: break; + case BFD_RELOC_IA64_PCREL64MSB: break; + case BFD_RELOC_IA64_PCREL64LSB: break; + default: + fix->fx_r_type = ia64_gen_real_reloc_type (pseudo_func[FUNC_PC_RELATIVE].u.sym, + fix->fx_r_type); + break; + } } if (fix->fx_addsy) { @@ -10850,14 +11762,6 @@ void ia64_handle_align (fragp) fragS *fragp; { - /* Use mfi bundle of nops with no stop bits. */ - static const unsigned char le_nop[] - = { 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00}; - static const unsigned char le_nop_stop[] - = { 0x0d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00}; - int bytes; char *p; const unsigned char *nop; @@ -10934,6 +11838,9 @@ ia64_float_to_chars_littleendian (char *lit, LITTLENUM_TYPE *words, void ia64_elf_section_change_hook (void) { + if (elf_section_type (now_seg) == SHT_IA_64_UNWIND + && elf_linked_to_section (now_seg) == NULL) + elf_linked_to_section (now_seg) = text_section; dot_byteorder (-1); } @@ -10981,7 +11888,7 @@ dot_alias (int section) if (name == end_name) { as_bad (_("expected symbol name")); - discard_rest_of_line (); + ignore_rest_of_line (); return; } @@ -10998,6 +11905,7 @@ dot_alias (int section) input_line_pointer++; *end_name = 0; + ia64_canonicalize_symbol_name (name); /* We call demand_copy_C_string to check if alias string is valid. There should be a closing `"' and no `\0' in the string. */ diff --git a/contrib/binutils/gas/config/tc-ia64.h b/contrib/binutils/gas/config/tc-ia64.h index dcc2c299602..c17494beb16 100644 --- a/contrib/binutils/gas/config/tc-ia64.h +++ b/contrib/binutils/gas/config/tc-ia64.h @@ -1,5 +1,6 @@ /* tc-ia64.h -- Header file for tc-ia64.c. - Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 + Free Software Foundation, Inc. Contributed by David Mosberger-Tang This file is part of GAS, the GNU Assembler. @@ -16,8 +17,8 @@ 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. */ + the Free Software Foundation, 51 Franklin Street - Fifth Floor, + Boston, MA 02110-1301, USA. */ #include "opcode/ia64.h" #include "elf/ia64.h" @@ -74,10 +75,13 @@ extern const char *ia64_target_format PARAMS ((void)); #define NEED_INDEX_OPERATOR /* [ ] is index operator */ #define QUOTES_IN_INSN /* allow `string "foo;bar"' */ -#define LEX_AT LEX_NAME /* allow `@' inside name */ -#define LEX_QM LEX_NAME /* allow `?' inside name */ +#define LEX_AT (LEX_NAME|LEX_BEGIN_NAME) /* allow `@' inside name */ +#define LEX_QM (LEX_NAME|LEX_BEGIN_NAME) /* allow `?' inside name */ #define LEX_HASH LEX_END_NAME /* allow `#' ending a name */ +extern const char ia64_symbol_chars[]; +#define tc_symbol_chars ia64_symbol_chars + #define SUB_SEGMENT_ALIGN(SEG, FRCHAIN) 0 struct ia64_fix @@ -94,7 +98,7 @@ extern void ia64_frob_label PARAMS((struct symbol *sym)); extern int ia64_frob_symbol PARAMS((struct symbol *sym)); #endif extern void ia64_flush_pending_output PARAMS((void)); -extern int ia64_parse_name (char *name, expressionS *e); +extern int ia64_parse_name PARAMS((char *name, expressionS *e, char *nextP)); extern int ia64_optimize_expr PARAMS((expressionS *l, operatorT op, expressionS *r)); extern void ia64_cons_align PARAMS((int)); @@ -125,7 +129,7 @@ extern void ia64_convert_frag (fragS *); #define tc_frob_symbol(s,p) p |= ia64_frob_symbol (s) #endif /* TE_HPUX */ #define md_flush_pending_output() ia64_flush_pending_output () -#define md_parse_name(s,e,c) ia64_parse_name (s, e) +#define md_parse_name(s,e,m,c) ia64_parse_name (s, e, c) #define tc_canonicalize_symbol_name(s) ia64_canonicalize_symbol_name (s) #define tc_canonicalize_section_name(s) ia64_canonicalize_symbol_name (s) #define md_optimize_expr(l,o,r) ia64_optimize_expr (l, o, r) @@ -158,6 +162,14 @@ extern void ia64_convert_frag (fragS *); #define TC_FRAG_TYPE int #define TC_FRAG_INIT(FRAGP) do {(FRAGP)->tc_frag_data = 0;}while (0) +/* Give an error if a frag containing code is not aligned to a 16 byte + boundary. */ +#define md_frag_check(FRAGP) \ + if ((FRAGP)->has_code \ + && (((FRAGP)->fr_address + (FRAGP)->insn_addr) & 15) != 0) \ + as_bad_where ((FRAGP)->fr_file, (FRAGP)->fr_line, \ + _("instruction address is not a multiple of 16")); + #define MAX_MEM_FOR_RS_ALIGN_CODE (15 + 16) #define WORKING_DOT_WORD /* don't do broken word processing for now */ @@ -229,7 +241,7 @@ typedef struct unw_r_record struct { unsigned char *i; - unsigned long fr_mem; + unsigned int fr_mem; unsigned char gr_mem; unsigned char br_mem; } mask; @@ -237,17 +249,22 @@ typedef struct unw_r_record typedef struct unw_p_record { - void *imask; + struct unw_rec_list *next; unsigned long t; unsigned long size; - unsigned long spoff; - unsigned long br; - unsigned long pspoff; - unsigned short gr; - unsigned short rmask; - unsigned short grmask; - unsigned long frmask; - unsigned short brmask; + union + { + unsigned long sp; + unsigned long psp; + } off; + union + { + unsigned short gr; + unsigned short br; + } r; + unsigned char grmask; + unsigned char brmask; + unsigned int frmask; unsigned char abi; unsigned char context; } unw_p_record; @@ -262,10 +279,13 @@ typedef struct unw_b_record typedef struct unw_x_record { unsigned long t; - unsigned long spoff; - unsigned long pspoff; + union + { + unsigned long spoff; + unsigned long pspoff; + unsigned int reg; + } where; unsigned short reg; - unsigned short treg; unsigned short qp; unsigned short ab; /* Value of the AB field.. */ unsigned short xy; /* Value of the XY field.. */ diff --git a/contrib/binutils/gas/config/tc-m68851.h b/contrib/binutils/gas/config/tc-m68851.h index 870e8810d0f..0374861a9cb 100644 --- a/contrib/binutils/gas/config/tc-m68851.h +++ b/contrib/binutils/gas/config/tc-m68851.h @@ -17,8 +17,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ /* * pmmu.h diff --git a/contrib/binutils/gas/config/tc-mips.c b/contrib/binutils/gas/config/tc-mips.c index b8ef69eea34..dc5ff68e3ec 100644 --- a/contrib/binutils/gas/config/tc-mips.c +++ b/contrib/binutils/gas/config/tc-mips.c @@ -1216,6 +1216,12 @@ mips_target_format (void) case bfd_target_coff_flavour: return "pe-mips"; case bfd_target_elf_flavour: +#ifdef TE_VXWORKS + if (!HAVE_64BIT_OBJECTS && !HAVE_NEWABI) + return (target_big_endian + ? "elf32-bigmips-vxworks" + : "elf32-littlemips-vxworks"); +#endif #ifdef TE_TMIPS /* This is traditional mips. */ return (target_big_endian @@ -1556,9 +1562,9 @@ md_begin (void) if (OUTPUT_FLAVOR == bfd_target_elf_flavour) { - /* On a native system, sections must be aligned to 16 byte - boundaries. When configured for an embedded ELF target, we - don't bother. */ + /* On a native system other than VxWorks, sections must be aligned + to 16 byte boundaries. When configured for an embedded ELF + target, we don't bother. */ if (strcmp (TARGET_OS, "elf") != 0 && strcmp (TARGET_OS, "vxworks") != 0) { @@ -1719,8 +1725,12 @@ md_assemble (char *str) static inline bfd_boolean reloc_needs_lo_p (bfd_reloc_code_real_type reloc) { - return (reloc == BFD_RELOC_HI16_S - || reloc == BFD_RELOC_MIPS_GOT16); + return (HAVE_IN_PLACE_ADDENDS + && (reloc == BFD_RELOC_HI16_S + || reloc == BFD_RELOC_MIPS16_HI16_S + /* VxWorks R_MIPS_GOT16 relocs never need a matching %lo(); + all GOT16 relocations evaluate to "G". */ + || (reloc == BFD_RELOC_MIPS_GOT16 && mips_pic != VXWORKS_PIC))); } /* Return true if the given fixup is followed by a matching R_MIPS_LO16 @@ -1730,7 +1740,8 @@ static inline bfd_boolean fixup_has_matching_lo_p (fixS *fixp) { return (fixp->fx_next != NULL - && fixp->fx_next->fx_r_type == BFD_RELOC_LO16 + && (fixp->fx_next->fx_r_type == BFD_RELOC_LO16 + || fixp->fx_next->fx_r_type == BFD_RELOC_MIPS16_LO16) && fixp->fx_addsy == fixp->fx_next->fx_addsy && fixp->fx_offset == fixp->fx_next->fx_offset); } @@ -2487,7 +2498,10 @@ append_insn (struct mips_cl_insn *ip, expressionS *address_expr, || reloc_type[0] == BFD_RELOC_MIPS_HIGHER || reloc_type[0] == BFD_RELOC_MIPS_SCN_DISP || reloc_type[0] == BFD_RELOC_MIPS_REL16 - || reloc_type[0] == BFD_RELOC_MIPS_RELGOT)) + || reloc_type[0] == BFD_RELOC_MIPS_RELGOT + || reloc_type[0] == BFD_RELOC_MIPS16_GPREL + || reloc_type[0] == BFD_RELOC_MIPS16_HI16_S + || reloc_type[0] == BFD_RELOC_MIPS16_LO16)) ip->fixp[0]->fx_no_overflow = 1; if (mips_relax.sequence) @@ -5687,6 +5701,8 @@ macro (struct mips_cl_insn *ip) } } } + else if (mips_pic == VXWORKS_PIC) + as_bad (_("Non-PIC jump used in PIC library")); else abort (); @@ -9726,10 +9742,34 @@ mips16_ip (char *str, struct mips_cl_insn *ip) && *imm_reloc > BFD_RELOC_UNUSED && insn->pinfo != INSN_MACRO) { + valueT tmp; + + switch (*offset_reloc) + { + case BFD_RELOC_MIPS16_HI16_S: + tmp = (imm_expr.X_add_number + 0x8000) >> 16; + break; + + case BFD_RELOC_MIPS16_HI16: + tmp = imm_expr.X_add_number >> 16; + break; + + case BFD_RELOC_MIPS16_LO16: + tmp = ((imm_expr.X_add_number + 0x8000) & 0xffff) + - 0x8000; + break; + + case BFD_RELOC_UNUSED: + tmp = imm_expr.X_add_number; + break; + + default: + internalError (); + } *offset_reloc = BFD_RELOC_UNUSED; mips16_immed (NULL, 0, *imm_reloc - BFD_RELOC_UNUSED, - imm_expr.X_add_number, TRUE, mips16_small, + tmp, TRUE, mips16_small, mips16_ext, &ip->insn_opcode, &ip->use_extend, &ip->extend); imm_expr.X_op = O_absent; @@ -10537,10 +10577,25 @@ static const struct percent_op_match mips_percent_op[] = {"%highest", BFD_RELOC_MIPS_HIGHEST}, {"%higher", BFD_RELOC_MIPS_HIGHER}, {"%neg", BFD_RELOC_MIPS_SUB}, + {"%tlsgd", BFD_RELOC_MIPS_TLS_GD}, + {"%tlsldm", BFD_RELOC_MIPS_TLS_LDM}, + {"%dtprel_hi", BFD_RELOC_MIPS_TLS_DTPREL_HI16}, + {"%dtprel_lo", BFD_RELOC_MIPS_TLS_DTPREL_LO16}, + {"%tprel_hi", BFD_RELOC_MIPS_TLS_TPREL_HI16}, + {"%tprel_lo", BFD_RELOC_MIPS_TLS_TPREL_LO16}, + {"%gottprel", BFD_RELOC_MIPS_TLS_GOTTPREL}, #endif {"%hi", BFD_RELOC_HI16_S} }; +static const struct percent_op_match mips16_percent_op[] = +{ + {"%lo", BFD_RELOC_MIPS16_LO16}, + {"%gprel", BFD_RELOC_MIPS16_GPREL}, + {"%hi", BFD_RELOC_MIPS16_HI16_S} +}; + + /* Return true if *STR points to a relocation operator. When returning true, move *STR over the operator and store its relocation code in *RELOC. Leave both *STR and *RELOC alone when returning false. */ @@ -10551,8 +10606,16 @@ parse_relocation (char **str, bfd_reloc_code_real_type *reloc) const struct percent_op_match *percent_op; size_t limit, i; - percent_op = mips_percent_op; - limit = ARRAY_SIZE (mips_percent_op); + if (mips_opts.mips16) + { + percent_op = mips16_percent_op; + limit = ARRAY_SIZE (mips16_percent_op); + } + else + { + percent_op = mips_percent_op; + limit = ARRAY_SIZE (mips_percent_op); + } for (i = 0; i < limit; i++) if (strncasecmp (*str, percent_op[i].str, strlen (percent_op[i].str)) == 0) @@ -10902,6 +10965,8 @@ struct option md_longopts[] = {"mpdr", no_argument, NULL, OPTION_PDR}, #define OPTION_NO_PDR (OPTION_ELF_BASE + 10) {"mno-pdr", no_argument, NULL, OPTION_NO_PDR}, +#define OPTION_MVXWORKS_PIC (OPTION_ELF_BASE + 11) + {"mvxworks-pic", no_argument, NULL, OPTION_MVXWORKS_PIC}, #endif /* OBJ_ELF */ #define OPTION_MOCTEON_UNSUPPORTED (OPTION_MISC_BASE + 28) @@ -11297,6 +11362,10 @@ md_parse_option (int c, char *arg) case OPTION_NO_PDR: mips_flag_pdr = FALSE; break; + + case OPTION_MVXWORKS_PIC: + mips_pic = VXWORKS_PIC; + break; #endif /* OBJ_ELF */ default: @@ -11509,7 +11578,7 @@ mips_frob_file_before_adjust (void) } /* Sort any unmatched HI16 and GOT16 relocs so that they immediately precede - the corresponding LO16 reloc. This is called before md_apply_fix3 and + the corresponding LO16 reloc. This is called before md_apply_fix and tc_gen_reloc. Unmatched relocs can only be generated by use of explicit relocation operators. @@ -11594,7 +11663,8 @@ mips_frob_file (void) if (*pos == l->fixp) hi_pos = pos; - if ((*pos)->fx_r_type == BFD_RELOC_LO16 + if (((*pos)->fx_r_type == BFD_RELOC_LO16 + || (*pos)->fx_r_type == BFD_RELOC_MIPS16_LO16) && (*pos)->fx_addsy == l->fixp->fx_addsy && (*pos)->fx_offset >= l->fixp->fx_offset && (lo_pos == NULL @@ -11650,7 +11720,7 @@ mips_force_relocation (fixS *fixp) /* Apply a fixup to the object file. */ void -md_apply_fix3 (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) +md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) { bfd_byte *buf; long insn; @@ -11688,6 +11758,16 @@ md_apply_fix3 (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) switch (fixP->fx_r_type) { + case BFD_RELOC_MIPS_TLS_GD: + case BFD_RELOC_MIPS_TLS_LDM: + case BFD_RELOC_MIPS_TLS_DTPREL_HI16: + case BFD_RELOC_MIPS_TLS_DTPREL_LO16: + case BFD_RELOC_MIPS_TLS_GOTTPREL: + case BFD_RELOC_MIPS_TLS_TPREL_HI16: + case BFD_RELOC_MIPS_TLS_TPREL_LO16: + S_SET_THREAD_LOCAL (fixP->fx_addsy); + /* fall through */ + case BFD_RELOC_MIPS_JMP: case BFD_RELOC_MIPS_SHIFT5: case BFD_RELOC_MIPS_SHIFT6: @@ -11716,6 +11796,8 @@ md_apply_fix3 (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) case BFD_RELOC_MIPS_CALL_HI16: case BFD_RELOC_MIPS_CALL_LO16: case BFD_RELOC_MIPS16_GPREL: + case BFD_RELOC_MIPS16_HI16: + case BFD_RELOC_MIPS16_HI16_S: /* Nothing needed to do. The value comes from the reloc entry */ break; @@ -11766,6 +11848,7 @@ md_apply_fix3 (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) break; case BFD_RELOC_LO16: + case BFD_RELOC_MIPS16_LO16: /* FIXME: Now that embedded-PIC is gone, some of this code/comment may be safe to remove, but if so it's not obvious. */ /* When handling an embedded PIC switch statement, we can wind @@ -11809,7 +11892,7 @@ md_apply_fix3 (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) && fixP->fx_done && fixP->fx_frag->fr_address >= text_section->vma && (fixP->fx_frag->fr_address - < text_section->vma + text_section->_raw_size) + < text_section->vma + bfd_get_section_size (text_section)) && ((insn & 0xffff0000) == 0x10000000 /* beq $0,$0 */ || (insn & 0xffff0000) == 0x04010000 /* bgez $0 */ || (insn & 0xffff0000) == 0x04110000)) /* bgezal $0 */ @@ -13423,6 +13506,9 @@ md_estimate_size_before_relax (fragS *fragp, asection *segtype) change = nopic_need_relax (fragp->fr_symbol, 0); else if (mips_pic == SVR4_PIC) change = pic_need_relax (fragp->fr_symbol, segtype); + else if (mips_pic == VXWORKS_PIC) + /* For vxworks, GOT16 relocations never have a corresponding LO16. */ + change = 0; else abort (); @@ -13468,6 +13554,7 @@ mips_fix_adjustable (fixS *fixp) this, it seems better not to force the issue, and instead keep the original symbol. This will work with either linker behavior. */ if ((fixp->fx_r_type == BFD_RELOC_LO16 + || fixp->fx_r_type == BFD_RELOC_MIPS16_LO16 || reloc_needs_lo_p (fixp->fx_r_type)) && HAVE_IN_PLACE_ADDENDS && (S_GET_SEGMENT (fixp->fx_addsy)->flags & SEC_MERGE) != 0) @@ -13988,6 +14075,10 @@ mips_define_label (symbolS *sym) l->label = sym; l->next = insn_labels; insn_labels = l; + +#ifdef OBJ_ELF + dwarf2_emit_label (sym); +#endif } #if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) @@ -14218,7 +14309,7 @@ s_mips_file (int x ATTRIBUTE_UNUSED) if (filename != NULL && ! first_file_directive) { (void) new_logical_line (filename, -1); - s_app_file_string (filename); + s_app_file_string (filename, 0); } first_file_directive = 1; } diff --git a/contrib/binutils/gas/config/tc-mips.h b/contrib/binutils/gas/config/tc-mips.h index 0621b2eaf49..5665d3decdd 100644 --- a/contrib/binutils/gas/config/tc-mips.h +++ b/contrib/binutils/gas/config/tc-mips.h @@ -1,5 +1,5 @@ /* tc-mips.h -- header file for tc-mips.c. - Copyright 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2002, 2003 + Copyright 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Contributed by the OSF and Ralph Campbell. Written by Keith Knowles and Ralph Campbell, working independently. @@ -19,8 +19,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #ifndef TC_MIPS #define TC_MIPS @@ -58,10 +58,6 @@ extern void mips_handle_align (struct frag *); #define MAX_MEM_FOR_RS_ALIGN_CODE (1 + 2) -/* We permit PC relative difference expressions when generating - embedded PIC code. */ -#define DIFF_EXPR_OK - /* Tell assembler that we have an itbl_mips.h header file to include. */ #define HAVE_ITBL_CPU @@ -80,11 +76,8 @@ enum mips_pic_level /* Generate PIC code as in the SVR4 MIPS ABI. */ SVR4_PIC, - /* Generate PIC code without using a global offset table: the data - segment has a maximum size of 64K, all data references are off - the $gp register, and all text references are PC relative. This - is used on some embedded systems. */ - EMBEDDED_PIC + /* VxWorks's PIC model. */ + VXWORKS_PIC }; extern enum mips_pic_level mips_pic; @@ -117,17 +110,15 @@ extern void mips_frob_file_after_relocs (void); #define tc_fix_adjustable(fixp) mips_fix_adjustable (fixp) extern int mips_fix_adjustable (struct fix *); -/* Values passed to md_apply_fix3 don't include symbol values. */ +/* Values passed to md_apply_fix don't include symbol values. */ #define MD_APPLY_SYM_VALUE(FIX) 0 -/* Global syms must not be resolved, to support ELF shared libraries. - When generating embedded code, we don't have shared libs. */ +/* Global syms must not be resolved, to support ELF shared libraries. */ #define EXTERN_FORCE_RELOC \ - (OUTPUT_FLAVOR == bfd_target_elf_flavour \ - && mips_pic != EMBEDDED_PIC) + (OUTPUT_FLAVOR == bfd_target_elf_flavour) -/* When generating embedded PIC code we must keep PC relative - relocations. */ +/* When generating NEWABI code, we may need to have to keep combined + relocations which don't have symbols. */ #define TC_FORCE_RELOCATION(FIX) mips_force_relocation (FIX) extern int mips_force_relocation (struct fix *); @@ -149,10 +140,6 @@ extern void mips_elf_final_processing (void); extern void md_mips_end (void); #define md_end() md_mips_end() -#define USE_GLOBAL_POINTER_OPT (OUTPUT_FLAVOR == bfd_target_ecoff_flavour \ - || OUTPUT_FLAVOR == bfd_target_coff_flavour \ - || OUTPUT_FLAVOR == bfd_target_elf_flavour) - extern void mips_pop_insert (void); #define md_pop_insert() mips_pop_insert() @@ -165,6 +152,15 @@ extern void mips_enable_auto_align (void); extern enum dwarf2_format mips_dwarf2_format (void); #define DWARF2_FORMAT() mips_dwarf2_format () +extern int mips_dwarf2_addr_size (void); #define DWARF2_ADDR_SIZE(bfd) mips_dwarf2_addr_size () +#define TARGET_USE_CFIPOP 1 + +#define tc_cfi_frame_initial_instructions mips_cfi_frame_initial_instructions +extern void mips_cfi_frame_initial_instructions (void); + +#define DWARF2_DEFAULT_RETURN_COLUMN 31 +#define DWARF2_CIE_DATA_ALIGNMENT -4 + #endif /* TC_MIPS */ diff --git a/contrib/binutils/gas/config/tc-ppc.c b/contrib/binutils/gas/config/tc-ppc.c index 66366a57d23..d5bdb9e643e 100644 --- a/contrib/binutils/gas/config/tc-ppc.c +++ b/contrib/binutils/gas/config/tc-ppc.c @@ -1,6 +1,6 @@ /* tc-ppc.c -- Assemble for the PowerPC or POWER (RS/6000) Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, - 2004 Free Software Foundation, Inc. + 2004, 2005 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. This file is part of GAS, the GNU Assembler. @@ -17,8 +17,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #include #include "as.h" @@ -184,8 +184,10 @@ const char EXP_CHARS[] = "eE"; const char FLT_CHARS[] = "dD"; /* '+' and '-' can be used as postfix predicate predictors for conditional - branches. So they need to be accepted as symbol characters. */ -const char ppc_symbol_chars[] = "+-"; + branches. So they need to be accepted as symbol characters. + Also, anything that can start an operand needs to be mentioned here, + to stop the input scrubber eating whitespace. */ +const char ppc_symbol_chars[] = "+-%["; /* The dwarf2 data alignment, adjusted for 32 or 64 bit. */ int ppc_cie_data_alignment; @@ -858,6 +860,9 @@ parse_cpu (const char *arg) || strcmp (arg, "7455") == 0) ppc_cpu = (PPC_OPCODE_PPC | PPC_OPCODE_CLASSIC | PPC_OPCODE_ALTIVEC | PPC_OPCODE_32); + else if (strcmp (arg, "e300") == 0) + ppc_cpu = (PPC_OPCODE_PPC | PPC_OPCODE_CLASSIC | PPC_OPCODE_32 + | PPC_OPCODE_E300); else if (strcmp (arg, "altivec") == 0) { if (ppc_cpu == 0) @@ -906,6 +911,12 @@ parse_cpu (const char *arg) ppc_cpu = (PPC_OPCODE_PPC | PPC_OPCODE_CLASSIC | PPC_OPCODE_64 | PPC_OPCODE_POWER4); } + else if (strcmp (arg, "power5") == 0) + { + ppc_cpu = (PPC_OPCODE_PPC | PPC_OPCODE_CLASSIC + | PPC_OPCODE_64 | PPC_OPCODE_POWER4 + | PPC_OPCODE_POWER5); + } /* -mcom means assemble for the common intersection between Power and PowerPC. At present, we just allow the union, rather than the intersection. */ @@ -1100,10 +1111,12 @@ PowerPC options:\n\ -mbooke64 generate code for 64-bit PowerPC BookE\n\ -mbooke, mbooke32 generate code for 32-bit PowerPC BookE\n\ -mpower4 generate code for Power4 architecture\n\ +-mpower5 generate code for Power5 architecture\n\ -mcom generate code Power/PowerPC common instructions\n\ -many generate code for any architecture (PWR/PWRX/PPC)\n")); fprintf (stream, _("\ -maltivec generate code for AltiVec\n\ +-me300 generate code for PowerPC e300 family\n\ -me500, -me500x2 generate code for Motorola e500 core complex\n\ -mspe generate code for Motorola SPE instructions\n\ -mregnames Allow symbolic names for registers\n\ @@ -1144,19 +1157,15 @@ ppc_set_cpu () else if (strcmp (default_cpu, "rs6000") == 0) ppc_cpu |= PPC_OPCODE_POWER | PPC_OPCODE_32; else if (strncmp (default_cpu, "powerpc", 7) == 0) - { - if (default_cpu[7] == '6' && default_cpu[8] == '4') - ppc_cpu |= PPC_OPCODE_PPC | PPC_OPCODE_CLASSIC | PPC_OPCODE_64; - else - ppc_cpu |= PPC_OPCODE_PPC | PPC_OPCODE_CLASSIC | PPC_OPCODE_32; - } + ppc_cpu |= PPC_OPCODE_PPC | PPC_OPCODE_CLASSIC | PPC_OPCODE_32; else as_fatal (_("Unknown default cpu = %s, os = %s"), default_cpu, default_os); } } -/* Figure out the BFD architecture to use. */ +/* Figure out the BFD architecture to use. This function and ppc_mach + are called well before md_begin, when the output file is opened. */ enum bfd_architecture ppc_arch () @@ -1208,9 +1217,13 @@ ppc_target_format () #endif #endif #ifdef OBJ_ELF +# ifdef TE_VXWORKS + return "elf32-powerpc-vxworks"; +# else return (target_big_endian ? (ppc_obj64 ? "elf64-powerpc" : "elf32-powerpc") : (ppc_obj64 ? "elf64-powerpcle" : "elf32-powerpcle")); +# endif #endif } @@ -1254,7 +1267,10 @@ ppc_setup_opcodes (void) || (ppc_cpu & PPC_OPCODE_BOOKE) == 0) && ((op->flags & (PPC_OPCODE_POWER4 | PPC_OPCODE_NOPOWER4)) == 0 || ((op->flags & PPC_OPCODE_POWER4) - == (ppc_cpu & PPC_OPCODE_POWER4)))) + == (ppc_cpu & PPC_OPCODE_POWER4))) + && ((op->flags & PPC_OPCODE_POWER5) == 0 + || ((op->flags & PPC_OPCODE_POWER5) + == (ppc_cpu & PPC_OPCODE_POWER5)))) { const char *retval; @@ -1457,14 +1473,7 @@ ppc_insert_operand (insn, operand, val, file, line) 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); - as_bad_where (file, line, err, buf, min, max); - } + as_bad_value_out_of_range (_("operand"), test, (offsetT) min, (offsetT) max, file, line); } if (operand->insert) @@ -1898,6 +1907,7 @@ void ppc_frob_file_before_adjust () { symbolS *symp; + asection *toc; if (!ppc_obj64) return; @@ -1921,15 +1931,19 @@ ppc_frob_file_before_adjust () dotname = xmalloc (len + 1); dotname[0] = '.'; memcpy (dotname + 1, name, len); - dotsym = symbol_find (dotname); + dotsym = symbol_find_noref (dotname, 1); free (dotname); if (dotsym != NULL && (symbol_used_p (dotsym) || symbol_used_in_reloc_p (dotsym))) - { - symbol_mark_used (symp); - } + symbol_mark_used (symp); + } + toc = bfd_get_section_by_name (stdoutput, ".toc"); + if (toc != NULL + && bfd_section_size (stdoutput, toc) > 0x10000) + as_warn (_("TOC section size exceeds 64k")); + /* Don't emit .TOC. symbol. */ symp = symbol_find (".TOC."); if (symp != NULL) @@ -2098,6 +2112,7 @@ md_assemble (str) struct ppc_fixup fixups[MAX_INSN_FIXUPS]; int fc; char *f; + int addr_mod; int i; #ifdef OBJ_ELF bfd_reloc_code_real_type reloc; @@ -2625,6 +2640,11 @@ md_assemble (str) /* Write out the instruction. */ f = frag_more (4); + addr_mod = frag_now_fix () & 3; + if (frag_now->has_code && frag_now->insn_addr != addr_mod) + as_bad (_("instruction address is not a multiple of 4")); + frag_now->insn_addr = addr_mod; + frag_now->has_code = 1; md_number_to_chars (f, insn, 4); #ifdef OBJ_ELF @@ -2636,7 +2656,7 @@ md_assemble (str) BFD_RELOC_UNUSED plus 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_fix3. */ + md_apply_fix. */ for (i = 0; i < fc; i++) { const struct powerpc_operand *operand; @@ -4396,6 +4416,7 @@ ppc_pe_comm (lcomm) { S_SET_VALUE (symbolP, (valueT) temp); S_SET_EXTERNAL (symbolP); + S_SET_SEGMENT (symbolP, bfd_com_section_ptr); } demand_empty_rest_of_line (); @@ -4820,6 +4841,10 @@ ppc_frob_label (sym) &symbol_rootP, &symbol_lastP); symbol_get_tc (ppc_current_csect)->within = sym; } + +#ifdef OBJ_ELF + dwarf2_emit_label (sym); +#endif } /* This variable is set by ppc_frob_symbol if any absolute symbols are @@ -4844,7 +4869,7 @@ ppc_frob_symbol (sym) table. */ if (! symbol_used_in_reloc_p (sym) && ((symbol_get_bfdsym (sym)->flags & BSF_SECTION_SYM) != 0 - || (! S_IS_EXTERNAL (sym) + || (! (S_IS_EXTERNAL (sym) || S_IS_WEAK (sym)) && ! symbol_get_tc (sym)->output && S_GET_STORAGE_CLASS (sym) != C_FILE))) return 1; @@ -4910,7 +4935,7 @@ ppc_frob_symbol (sym) } } - if (! S_IS_EXTERNAL (sym) + if (! (S_IS_EXTERNAL (sym) || S_IS_WEAK (sym)) && (symbol_get_bfdsym (sym)->flags & BSF_SECTION_SYM) == 0 && S_GET_STORAGE_CLASS (sym) != C_FILE && S_GET_STORAGE_CLASS (sym) != C_FCN @@ -5455,6 +5480,7 @@ ppc_force_relocation (fix) case BFD_RELOC_PPC_B16_BRNTAKEN: case BFD_RELOC_PPC_BA16_BRTAKEN: case BFD_RELOC_PPC_BA16_BRNTAKEN: + case BFD_RELOC_24_PLT_PCREL: case BFD_RELOC_PPC64_TOC: return 1; default: @@ -5480,12 +5506,7 @@ ppc_fix_adjustable (fix) && fix->fx_r_type != BFD_RELOC_VTABLE_INHERIT && fix->fx_r_type != BFD_RELOC_VTABLE_ENTRY && !(fix->fx_r_type >= BFD_RELOC_PPC_TLS - && fix->fx_r_type <= BFD_RELOC_PPC64_DTPREL16_HIGHESTA) - && (fix->fx_pcrel - || (fix->fx_subsy != NULL - && (S_GET_SEGMENT (fix->fx_subsy) - == S_GET_SEGMENT (fix->fx_addsy))) - || S_IS_LOCAL (fix->fx_addsy))); + && fix->fx_r_type <= BFD_RELOC_PPC64_DTPREL16_HIGHESTA)); } #endif @@ -5499,7 +5520,7 @@ ppc_fix_adjustable (fix) fixup. */ void -md_apply_fix3 (fixP, valP, seg) +md_apply_fix (fixP, valP, seg) fixS *fixP; valueT * valP; segT seg ATTRIBUTE_UNUSED; @@ -5517,11 +5538,11 @@ md_apply_fix3 (fixP, valP, seg) fixP->fx_done = 1; #else /* FIXME FIXME FIXME: The value we are passed in *valP 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 *valP since bfd_install_relocation is not being used. + the symbol values. 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 *valP since bfd_install_relocation is + not being used. However, if the reloc is not fully resolved we do not want to use *valP, and must use fx_offset instead. However, if the reloc is PC relative, we do want to use *valP since it includes the @@ -5707,8 +5728,6 @@ md_apply_fix3 (fixP, valP, seg) value, 8); break; - case BFD_RELOC_LO16: - case BFD_RELOC_16: case BFD_RELOC_GPREL16: case BFD_RELOC_16_GOT_PCREL: case BFD_RELOC_16_GOTOFF: @@ -5754,19 +5773,45 @@ md_apply_fix3 (fixP, valP, seg) value, 2); break; + case BFD_RELOC_16: + if (fixP->fx_pcrel) + fixP->fx_r_type = BFD_RELOC_16_PCREL; + /* fall through */ + + case BFD_RELOC_16_PCREL: + md_number_to_chars (fixP->fx_frag->fr_literal + fixP->fx_where, + value, 2); + break; + + case BFD_RELOC_LO16: + if (fixP->fx_pcrel) + fixP->fx_r_type = BFD_RELOC_LO16_PCREL; + /* fall through */ + + case BFD_RELOC_LO16_PCREL: + md_number_to_chars (fixP->fx_frag->fr_literal + fixP->fx_where, + value, 2); + break; + /* This case happens when you write, for example, lis %r3,(L1-L2)@ha where L1 and L2 are defined later. */ case BFD_RELOC_HI16: if (fixP->fx_pcrel) - abort (); + fixP->fx_r_type = BFD_RELOC_HI16_PCREL; + /* fall through */ + + case BFD_RELOC_HI16_PCREL: md_number_to_chars (fixP->fx_frag->fr_literal + fixP->fx_where, PPC_HI (value), 2); break; case BFD_RELOC_HI16_S: if (fixP->fx_pcrel) - abort (); + fixP->fx_r_type = BFD_RELOC_HI16_S_PCREL; + /* fall through */ + + case BFD_RELOC_HI16_S_PCREL: md_number_to_chars (fixP->fx_frag->fr_literal + fixP->fx_where, PPC_HA (value), 2); break; @@ -5814,7 +5859,7 @@ md_apply_fix3 (fixP, valP, seg) if (fixP->fx_pcrel) abort (); { - unsigned char *where = fixP->fx_frag->fr_literal + fixP->fx_where; + char *where = fixP->fx_frag->fr_literal + fixP->fx_where; unsigned long val, mask; if (target_big_endian) @@ -5841,6 +5886,8 @@ md_apply_fix3 (fixP, valP, seg) break; case BFD_RELOC_PPC_TLS: + break; + case BFD_RELOC_PPC_DTPMOD: case BFD_RELOC_PPC_TPREL16: case BFD_RELOC_PPC_TPREL16_LO: @@ -5880,6 +5927,7 @@ md_apply_fix3 (fixP, valP, seg) case BFD_RELOC_PPC64_DTPREL16_HIGHERA: case BFD_RELOC_PPC64_DTPREL16_HIGHEST: case BFD_RELOC_PPC64_DTPREL16_HIGHESTA: + S_SET_THREAD_LOCAL (fixP->fx_addsy); break; #endif /* Because SDA21 modifies the register field, the size is set to 4 @@ -5972,6 +6020,13 @@ md_apply_fix3 (fixP, valP, seg) #ifdef OBJ_ELF fixP->fx_addnumber = value; + + /* PowerPC uses RELA relocs, ie. the reloc addend is stored separately + from the section contents. If we are going to be emitting a reloc + then the section contents are immaterial, so don't warn if they + happen to overflow. Leave such warnings to ld. */ + if (!fixP->fx_done) + fixP->fx_no_overflow = 1; #else if (fixP->fx_r_type != BFD_RELOC_PPC_TOC16) fixP->fx_addnumber = 0; @@ -6033,7 +6088,7 @@ tc_ppc_regname_to_dw2regnum (const char *regname) { { "sp", 1 }, { "r.sp", 1 }, { "rtoc", 2 }, { "r.toc", 2 }, { "mq", 64 }, { "lr", 65 }, { "ctr", 66 }, { "ap", 67 }, - { "cc", 68 }, { "xer", 76 }, { "vrsave", 109 }, { "vscr", 110 }, + { "cr", 70 }, { "xer", 76 }, { "vrsave", 109 }, { "vscr", 110 }, { "spe_acc", 111 }, { "spefscr", 112 } }; diff --git a/contrib/binutils/gas/config/tc-ppc.h b/contrib/binutils/gas/config/tc-ppc.h index 0844f84cefa..f7c2da619cb 100644 --- a/contrib/binutils/gas/config/tc-ppc.h +++ b/contrib/binutils/gas/config/tc-ppc.h @@ -1,6 +1,6 @@ /* tc-ppc.h -- Header file for tc-ppc.c. - Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 - Free Software Foundation, Inc. + Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, + 2004, 2005 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. This file is part of GAS, the GNU Assembler. @@ -17,24 +17,18 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #define TC_PPC -#ifdef ANSI_PROTOTYPES struct fix; -#endif /* Set the endianness we are using. Default to big endian. */ #ifndef TARGET_BYTES_BIG_ENDIAN #define TARGET_BYTES_BIG_ENDIAN 1 #endif -#ifndef BFD_ASSEMBLER - #error PowerPC support requires BFD_ASSEMBLER -#endif - /* If OBJ_COFF is defined, and TE_PE is not defined, we are assembling XCOFF for AIX or PowerMac. If TE_PE is defined, we are assembling COFF for Windows NT. */ @@ -90,7 +84,7 @@ extern char *ppc_target_format PARAMS ((void)); - ((FRAGP)->fr_address + (FRAGP)->fr_fix)); \ if (count != 0 && (count & 3) == 0) \ { \ - unsigned char *dest = (FRAGP)->fr_literal + (FRAGP)->fr_fix; \ + char *dest = (FRAGP)->fr_literal + (FRAGP)->fr_fix; \ \ (FRAGP)->fr_var = 4; \ if (target_big_endian) \ @@ -110,6 +104,11 @@ extern char *ppc_target_format PARAMS ((void)); } \ } +#define md_frag_check(FRAGP) \ + if ((FRAGP)->has_code \ + && (((FRAGP)->fr_address + (FRAGP)->insn_addr) & 3) != 0) \ + as_bad_where ((FRAGP)->fr_file, (FRAGP)->fr_line, \ + _("instruction address is not a multiple of 4")); #ifdef TE_PE @@ -229,7 +228,7 @@ extern const char *ppc_comment_chars; #define tc_fix_adjustable(FIX) ppc_fix_adjustable (FIX) extern int ppc_fix_adjustable PARAMS ((struct fix *)); -/* Values passed to md_apply_fix3 don't include symbol values. */ +/* Values passed to md_apply_fix don't include symbol values. */ #define MD_APPLY_SYM_VALUE(FIX) 0 #define tc_frob_file_before_adjust ppc_frob_file_before_adjust @@ -246,7 +245,7 @@ extern int ppc_force_relocation PARAMS ((struct fix *)); #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section(FIX, SEC) extern long md_pcrel_from_section PARAMS ((struct fix *, segT)); -#define md_parse_name(name, exp, c) ppc_parse_name (name, exp) +#define md_parse_name(name, exp, mode, c) ppc_parse_name (name, exp) extern int ppc_parse_name PARAMS ((const char *, struct expressionS *)); #define md_operand(x) diff --git a/contrib/binutils/gas/config/tc-s390.c b/contrib/binutils/gas/config/tc-s390.c index 4fafbec35fe..56b5b2594f8 100644 --- a/contrib/binutils/gas/config/tc-s390.c +++ b/contrib/binutils/gas/config/tc-s390.c @@ -1,5 +1,6 @@ /* tc-s390.c -- Assemble for the S390 - Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + Copyright 2000, 2001, 2002, 2003, 2004, 2005 + Free Software Foundation, Inc. Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). This file is part of GAS, the GNU Assembler. @@ -16,8 +17,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #include #include "as.h" @@ -312,8 +313,8 @@ static flagword s390_flags = 0; symbolS *GOT_symbol; /* Pre-defined "_GLOBAL_OFFSET_TABLE_" */ #ifndef WORKING_DOT_WORD -const int md_short_jump_size = 4; -const int md_long_jump_size = 4; +int md_short_jump_size = 4; +int md_long_jump_size = 4; #endif const char *md_shortopts = "A:m:kVQ:"; @@ -409,6 +410,8 @@ md_parse_option (c, arg) current_cpu = S390_OPCODE_Z900; else if (strcmp (arg + 5, "z990") == 0) current_cpu = S390_OPCODE_Z990; + else if (strcmp (arg + 5, "z9-109") == 0) + current_cpu = S390_OPCODE_Z9_109; else { as_bad (_("invalid switch -m%s"), arg); @@ -601,21 +604,15 @@ s390_insert_operand (insn, operand, val, file, line) /* Check for underflow / overflow. */ if (uval < min || uval > max) { - const char *err = - "operand out of range (%s not between %ld and %ld)"; - char buf[100]; - if (operand->flags & S390_OPERAND_LENGTH) { uval++; min++; max++; } - sprint_value (buf, uval); - if (file == (char *) NULL) - as_bad (err, buf, (int) min, (int) max); - else - as_bad_where (file, line, err, buf, (int) min, (int) max); + + as_bad_value_out_of_range (_("operand"), uval, (offsetT) min, (offsetT) max, file, line); + return; } } @@ -1358,8 +1355,19 @@ md_gather_operands (str, insn, opcode) /* If there is a next operand it must be separated by a comma. */ if (opindex_ptr[1] != '\0') { - if (*str++ != ',') - as_bad (_("syntax error; expected ,")); + if (*str != ',') + { + while (opindex_ptr[1] != '\0') + { + operand = s390_operands + *(++opindex_ptr); + if (operand->flags & S390_OPERAND_OPTIONAL) + continue; + as_bad (_("syntax error; expected ,")); + break; + } + } + else + str++; } } else @@ -1391,8 +1399,19 @@ md_gather_operands (str, insn, opcode) /* If there is a next operand it must be separated by a comma. */ if (opindex_ptr[1] != '\0') { - if (*str++ != ',') - as_bad (_("syntax error; expected ,")); + if (*str != ',') + { + while (opindex_ptr[1] != '\0') + { + operand = s390_operands + *(++opindex_ptr); + if (operand->flags & S390_OPERAND_OPTIONAL) + continue; + as_bad (_("syntax error; expected ,")); + break; + } + } + else + str++; } } else @@ -1410,8 +1429,19 @@ md_gather_operands (str, insn, opcode) /* If there is a next operand it must be separated by a comma. */ if (opindex_ptr[1] != '\0') { - if (*str++ != ',') - as_bad (_("syntax error; expected ,")); + if (*str != ',') + { + while (opindex_ptr[1] != '\0') + { + operand = s390_operands + *(++opindex_ptr); + if (operand->flags & S390_OPERAND_OPTIONAL) + continue; + as_bad (_("syntax error; expected ,")); + break; + } + } + else + str++; } } } @@ -1454,7 +1484,7 @@ md_gather_operands (str, insn, opcode) BFD_RELOC_UNUSED plus 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_fix3. */ + md_apply_fix. */ for (i = 0; i < fc; i++) { @@ -1602,15 +1632,12 @@ s390_insn (ignore) if (exp.X_op == O_constant) { if ( ( opformat->oplen == 6 - && exp.X_add_number >= 0 && (addressT) exp.X_add_number < (1ULL << 48)) || ( opformat->oplen == 4 - && exp.X_add_number >= 0 && (addressT) exp.X_add_number < (1ULL << 32)) || ( opformat->oplen == 2 - && exp.X_add_number >= 0 && (addressT) exp.X_add_number < (1ULL << 16))) - md_number_to_chars (insn, exp.X_add_number, opformat->oplen); + md_number_to_chars ((char *) insn, exp.X_add_number, opformat->oplen); else as_bad (_("Invalid .insn format\n")); } @@ -1620,9 +1647,9 @@ s390_insn (ignore) && opformat->oplen == 6 && generic_bignum[3] == 0) { - md_number_to_chars (insn, generic_bignum[2], 2); - md_number_to_chars (&insn[2], generic_bignum[1], 2); - md_number_to_chars (&insn[4], generic_bignum[0], 2); + md_number_to_chars ((char *) insn, generic_bignum[2], 2); + md_number_to_chars ((char *) &insn[2], generic_bignum[1], 2); + md_number_to_chars ((char *) &insn[4], generic_bignum[0], 2); } else as_bad (_("Invalid .insn format\n")); @@ -1965,7 +1992,7 @@ tc_s390_force_relocation (fixp) fixup. */ void -md_apply_fix3 (fixP, valP, seg) +md_apply_fix (fixP, valP, seg) fixS *fixP; valueT *valP; segT seg ATTRIBUTE_UNUSED; @@ -2000,8 +2027,8 @@ md_apply_fix3 (fixP, valP, seg) if (fixP->fx_done) { /* Insert the fully resolved operand value. */ - s390_insert_operand (where, operand, (offsetT) value, - fixP->fx_file, fixP->fx_line); + s390_insert_operand ((unsigned char *) where, operand, + (offsetT) value, fixP->fx_file, fixP->fx_line); return; } @@ -2223,10 +2250,12 @@ md_apply_fix3 (fixP, valP, seg) case BFD_RELOC_390_TLS_DTPMOD: case BFD_RELOC_390_TLS_DTPOFF: case BFD_RELOC_390_TLS_TPOFF: + S_SET_THREAD_LOCAL (fixP->fx_addsy); /* Fully resolved at link time. */ break; case BFD_RELOC_390_TLS_IEENT: /* Fully resolved at link time. */ + S_SET_THREAD_LOCAL (fixP->fx_addsy); value += 2; break; diff --git a/contrib/binutils/gas/config/tc-s390.h b/contrib/binutils/gas/config/tc-s390.h index fe55e15c89d..dbecfef3a55 100644 --- a/contrib/binutils/gas/config/tc-s390.h +++ b/contrib/binutils/gas/config/tc-s390.h @@ -1,5 +1,6 @@ /* tc-s390.h -- Header file for tc-s390.c. - Copyright 2000, 2001, 2002, 2004 Free Software Foundation, Inc. + Copyright 2000, 2001, 2002, 2003, 2004, 2005 + Free Software Foundation, Inc. Written by Martin Schwidefsky (schwidefsky@de.ibm.com). This file is part of GAS, the GNU Assembler. @@ -16,18 +17,12 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #define TC_S390 -#ifdef ANSI_PROTOTYPES struct fix; -#endif - -#ifndef BFD_ASSEMBLER - #error S390 support requires BFD_ASSEMBLER -#endif #define TC_FORCE_RELOCATION(FIX) tc_s390_force_relocation(FIX) extern int tc_s390_force_relocation PARAMS ((struct fix *)); @@ -39,7 +34,7 @@ extern int tc_s390_force_relocation PARAMS ((struct fix *)); #define tc_fix_adjustable(X) tc_s390_fix_adjustable(X) extern int tc_s390_fix_adjustable PARAMS ((struct fix *)); -/* Values passed to md_apply_fix3 don't include symbol values. */ +/* Values passed to md_apply_fix don't include symbol values. */ #define MD_APPLY_SYM_VALUE(FIX) 0 /* The target BFD architecture. */ diff --git a/contrib/binutils/gas/config/tc-sparc.c b/contrib/binutils/gas/config/tc-sparc.c index ba6b4ed5689..10a1411b526 100644 --- a/contrib/binutils/gas/config/tc-sparc.c +++ b/contrib/binutils/gas/config/tc-sparc.c @@ -1,6 +1,6 @@ /* tc-sparc.c -- Assemble for the SPARC Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004 + 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -16,8 +16,8 @@ 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. */ + to the Free Software Foundation, 51 Franklin Street - Fifth Floor, + Boston, MA 02110-1301, USA. */ #include @@ -133,7 +133,7 @@ int sparc_cie_data_alignment; /* Handle of the OPCODE hash table. */ static struct hash_control *op_hash; -static int log2 PARAMS ((int)); +static int mylog2 PARAMS ((int)); static void s_data1 PARAMS ((void)); static void s_seg PARAMS ((int)); static void s_proc PARAMS ((int)); @@ -174,9 +174,6 @@ const pseudo_typeS md_pseudo_table[] = {NULL, 0, 0}, }; -/* Size of relocation record. */ -const int md_reloc_size = 12; - /* 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[] = "!"; /* JF removed '|' from @@ -207,7 +204,7 @@ const char FLT_CHARS[] = "rRsSfFdDxXpP"; changed in read.c. Ideally it shouldn't have to know about it at all, but nothing is ideal around here. */ -#define isoctal(c) ((unsigned) ((c) - '0') < '8') +#define isoctal(c) ((unsigned) ((c) - '0') < 8) struct sparc_it { @@ -337,6 +334,10 @@ sparc_target_format () #endif #endif +#ifdef TE_VXWORKS + return "elf32-sparc-vxworks"; +#endif + #ifdef OBJ_ELF return sparc_arch_size == 64 ? "elf64-sparc" : "elf32-sparc"; #endif @@ -727,7 +728,7 @@ struct {NULL, NULL, NULL}, }; -/* sparc64 privileged registers. */ +/* sparc64 privileged and hyperprivileged registers. */ struct priv_reg_entry { @@ -753,10 +754,22 @@ struct priv_reg_entry priv_reg_table[] = {"otherwin", 13}, {"wstate", 14}, {"fq", 15}, + {"gl", 16}, {"ver", 31}, {"", -1}, /* End marker. */ }; +struct priv_reg_entry hpriv_reg_table[] = +{ + {"hpstate", 0}, + {"htstate", 1}, + {"hintp", 3}, + {"htba", 5}, + {"hver", 6}, + {"hstick_cmpr", 31}, + {"", -1}, /* End marker. */ +}; + /* v9a specific asrs. */ struct priv_reg_entry v9a_asr_table[] = @@ -1304,11 +1317,12 @@ md_assemble (str) know (str); special_case = sparc_ip (str, &insn); + if (insn == NULL) + return; /* We warn about attempts to put a floating point branch in a delay slot, unless the delay slot has been annulled. */ - if (insn != NULL - && last_insn != NULL + if (last_insn != NULL && (insn->flags & F_FBR) != 0 && (last_insn->flags & F_DELAYED) != 0 /* ??? This test isn't completely accurate. We assume anything with @@ -1321,7 +1335,6 @@ md_assemble (str) point instruction and a floating point branch. We insert one automatically, with a warning. */ if (max_architecture < SPARC_OPCODE_ARCH_V9 - && insn != NULL && last_insn != NULL && (insn->flags & F_FBR) != 0 && (last_insn->flags & F_FLOAT) != 0) @@ -1417,7 +1430,9 @@ sparc_ip (str, pinsn) break; default: - as_fatal (_("Unknown opcode: `%s'"), str); + as_bad (_("Unknown opcode: `%s'"), str); + *pinsn = NULL; + return special_case; } insn = (struct sparc_opcode *) hash_find (op_hash, str); *pinsn = insn; @@ -1573,6 +1588,42 @@ sparc_ip (str, pinsn) goto error; } + case '$': + case '%': + /* Parse a sparc64 hyperprivileged register. */ + if (*s == '%') + { + struct priv_reg_entry *p = hpriv_reg_table; + unsigned int len = 9999999; /* Init to make gcc happy. */ + + s += 1; + while (p->name[0] > s[0]) + p++; + while (p->name[0] == s[0]) + { + len = strlen (p->name); + if (strncmp (p->name, s, len) == 0) + break; + p++; + } + if (p->name[0] != s[0]) + { + error_message = _(": unrecognizable hyperprivileged register"); + goto error; + } + if (*args == '$') + opcode |= (p->regnum << 14); + else + opcode |= (p->regnum << 25); + s += len; + continue; + } + else + { + error_message = _(": unrecognizable hyperprivileged register"); + goto error; + } + case '_': case '/': /* Parse a v9a/v9b ancillary state register. */ @@ -2231,7 +2282,7 @@ sparc_ip (str, pinsn) { char *s1; char *op_arg = NULL; - expressionS op_exp; + static expressionS op_exp; bfd_reloc_code_real_type old_reloc = the_insn.reloc; /* Check for %hi, etc. */ @@ -2484,12 +2535,12 @@ sparc_ip (str, pinsn) goto error; } - /* Constants that won't fit are checked in md_apply_fix3 + /* Constants that won't fit are checked in md_apply_fix and bfd_install_relocation. ??? It would be preferable to install the constants into the insn here and save having to create a fixS for each one. There already exists code to handle - all the various cases (e.g. in md_apply_fix3 and + all the various cases (e.g. in md_apply_fix and bfd_install_relocation) so duplicating all that code here isn't right. */ } @@ -2877,7 +2928,7 @@ output_insn (insn, the_insn) the_insn->pcrel, the_insn->reloc); /* Turn off overflow checking in fixup_segment. We'll do our - own overflow checking in md_apply_fix3. This is necessary because + own overflow checking in md_apply_fix. This is necessary because the insn size is 4 and fixup_segment will signal an overflow for large 8 byte quantities. */ fixP->fx_no_overflow = 1; @@ -2996,7 +3047,7 @@ md_number_to_chars (buf, val, n) hold. */ void -md_apply_fix3 (fixP, valP, segment) +md_apply_fix (fixP, valP, segment) fixS *fixP; valueT *valP; segT segment ATTRIBUTE_UNUSED; @@ -3012,7 +3063,41 @@ md_apply_fix3 (fixP, valP, segment) #ifdef OBJ_ELF /* SPARC ELF relocations don't use an addend in the data field. */ if (fixP->fx_addsy != NULL) - return; + { + switch (fixP->fx_r_type) + { + case BFD_RELOC_SPARC_TLS_GD_HI22: + case BFD_RELOC_SPARC_TLS_GD_LO10: + case BFD_RELOC_SPARC_TLS_GD_ADD: + case BFD_RELOC_SPARC_TLS_GD_CALL: + case BFD_RELOC_SPARC_TLS_LDM_HI22: + case BFD_RELOC_SPARC_TLS_LDM_LO10: + case BFD_RELOC_SPARC_TLS_LDM_ADD: + case BFD_RELOC_SPARC_TLS_LDM_CALL: + case BFD_RELOC_SPARC_TLS_LDO_HIX22: + case BFD_RELOC_SPARC_TLS_LDO_LOX10: + case BFD_RELOC_SPARC_TLS_LDO_ADD: + case BFD_RELOC_SPARC_TLS_IE_HI22: + case BFD_RELOC_SPARC_TLS_IE_LO10: + case BFD_RELOC_SPARC_TLS_IE_LD: + case BFD_RELOC_SPARC_TLS_IE_LDX: + case BFD_RELOC_SPARC_TLS_IE_ADD: + case BFD_RELOC_SPARC_TLS_LE_HIX22: + case BFD_RELOC_SPARC_TLS_LE_LOX10: + case BFD_RELOC_SPARC_TLS_DTPMOD32: + case BFD_RELOC_SPARC_TLS_DTPMOD64: + case BFD_RELOC_SPARC_TLS_DTPOFF32: + case BFD_RELOC_SPARC_TLS_DTPOFF64: + case BFD_RELOC_SPARC_TLS_TPOFF32: + case BFD_RELOC_SPARC_TLS_TPOFF64: + S_SET_THREAD_LOCAL (fixP->fx_addsy); + + default: + break; + } + + return; + } #endif /* This is a hack. There should be a better way to @@ -3446,6 +3531,10 @@ tc_gen_reloc (section, fixp) #define GOT_NAME "_GLOBAL_OFFSET_TABLE_" #else #define GOT_NAME "__GLOBAL_OFFSET_TABLE_" +#endif +#ifdef TE_VXWORKS +#define GOTT_BASE "__GOTT_BASE__" +#define GOTT_INDEX "__GOTT_INDEX__" #endif /* This code must be parallel to the OBJ_ELF tc_fix_adjustable. */ @@ -3459,18 +3548,30 @@ tc_gen_reloc (section, fixp) code = BFD_RELOC_SPARC_WPLT30; break; case BFD_RELOC_HI22: - if (fixp->fx_addsy != NULL - && strcmp (S_GET_NAME (fixp->fx_addsy), GOT_NAME) == 0) - code = BFD_RELOC_SPARC_PC22; - else - code = BFD_RELOC_SPARC_GOT22; + code = BFD_RELOC_SPARC_GOT22; + if (fixp->fx_addsy != NULL) + { + if (strcmp (S_GET_NAME (fixp->fx_addsy), GOT_NAME) == 0) + code = BFD_RELOC_SPARC_PC22; +#ifdef TE_VXWORKS + if (strcmp (S_GET_NAME (fixp->fx_addsy), GOTT_BASE) == 0 + || strcmp (S_GET_NAME (fixp->fx_addsy), GOTT_INDEX) == 0) + code = BFD_RELOC_HI22; /* Unchanged. */ +#endif + } break; case BFD_RELOC_LO10: - if (fixp->fx_addsy != NULL - && strcmp (S_GET_NAME (fixp->fx_addsy), GOT_NAME) == 0) - code = BFD_RELOC_SPARC_PC10; - else - code = BFD_RELOC_SPARC_GOT10; + code = BFD_RELOC_SPARC_GOT10; + if (fixp->fx_addsy != NULL) + { + if (strcmp (S_GET_NAME (fixp->fx_addsy), GOT_NAME) == 0) + code = BFD_RELOC_SPARC_PC10; +#ifdef TE_VXWORKS + if (strcmp (S_GET_NAME (fixp->fx_addsy), GOTT_BASE) == 0 + || strcmp (S_GET_NAME (fixp->fx_addsy), GOTT_INDEX) == 0) + code = BFD_RELOC_LO10; /* Unchanged. */ +#endif + } break; case BFD_RELOC_SPARC13: code = BFD_RELOC_SPARC_GOT13; @@ -3603,7 +3704,7 @@ md_pcrel_from (fixP) of two. */ static int -log2 (value) +mylog2 (value) int value; { int shift; @@ -3705,7 +3806,7 @@ s_reserve (ignore) if (align != 0) { - temp = log2 (align); + temp = mylog2 (align); if (temp < 0) { as_bad (_("alignment not a power of 2")); @@ -3843,7 +3944,7 @@ s_common (ignore) if (temp > max_alignment) { temp = max_alignment; - as_warn (_("alignment too large; assuming %d"), temp); + as_warn (_("alignment too large; assuming %ld"), (long) temp); } #endif @@ -3868,7 +3969,7 @@ s_common (ignore) if (temp == 0) align = 0; else - align = log2 (temp); + align = mylog2 (temp); if (align < 0) { @@ -3925,9 +4026,7 @@ s_common (ignore) goto allocate_common; } -#ifdef BFD_ASSEMBLER symbol_get_bfdsym (symbolP)->flags |= BSF_OBJECT; -#endif demand_empty_rest_of_line (); return; @@ -4191,7 +4290,7 @@ sparc_cons_align (nbytes) if (sparc_no_align_cons) return; - nalign = log2 (nbytes); + nalign = mylog2 (nbytes); if (nalign == 0) return; diff --git a/contrib/binutils/gas/config/tc-sparc.h b/contrib/binutils/gas/config/tc-sparc.h index e99222bab58..14da16ad627 100644 --- a/contrib/binutils/gas/config/tc-sparc.h +++ b/contrib/binutils/gas/config/tc-sparc.h @@ -1,6 +1,6 @@ /* tc-sparc.h - Macros and type defines for the sparc. Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + 1999, 2000, 2001, 2002, 2003, 2005 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -16,15 +16,13 @@ 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. */ + to the Free Software Foundation, 51 Franklin Street - Fifth Floor, + Boston, MA 02110-1301, USA. */ #ifndef TC_SPARC #define TC_SPARC 1 -#ifdef ANSI_PROTOTYPES struct frag; -#endif /* This is used to set the default value for `target_big_endian'. */ #define TARGET_BYTES_BIG_ENDIAN 1 @@ -39,13 +37,6 @@ extern const char *sparc_target_format PARAMS ((void)); #define RELOC_EXPANSION_POSSIBLE #define MAX_RELOC_EXPANSION 2 -#if 0 -#ifdef TE_SPARCAOUT -/* Bi-endian support may eventually be unconditional, but until things are - working well it's only provided for targets that need it. */ -#define SPARC_BIENDIAN -#endif -#endif /* Make it unconditional and check if -EL is valid after option parsing */ #define SPARC_BIENDIAN @@ -116,7 +107,7 @@ extern void sparc_handle_align PARAMS ((struct frag *)); == S_GET_SEGMENT ((FIX)->fx_addsy))) \ || S_IS_LOCAL ((FIX)->fx_addsy))))) -/* Values passed to md_apply_fix3 don't include the symbol value. */ +/* Values passed to md_apply_fix don't include the symbol value. */ #define MD_APPLY_SYM_VALUE(FIX) 0 /* Finish up the entire symtab. */ diff --git a/contrib/binutils/gas/config/te-386bsd.h b/contrib/binutils/gas/config/te-386bsd.h index da2d692f72f..ad7769c50b4 100644 --- a/contrib/binutils/gas/config/te-386bsd.h +++ b/contrib/binutils/gas/config/te-386bsd.h @@ -16,8 +16,8 @@ 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. */ + the Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #define TE_386BSD 1 diff --git a/contrib/binutils/gas/config/te-aux.h b/contrib/binutils/gas/config/te-aux.h deleted file mode 100644 index 38445d9920c..00000000000 --- a/contrib/binutils/gas/config/te-aux.h +++ /dev/null @@ -1,17 +0,0 @@ -#define TE_AUX - -/* From obj-coff.h: - This internal_lineno crap is to stop namespace pollution from the - bfd internal coff headerfile. */ -#define internal_lineno bfd_internal_lineno -#include "coff/aux-coff.h" /* override bits in coff/internal.h */ -#undef internal_lineno - -#define COFF_NOLOAD_PROBLEM -#define KEEP_RELOC_INFO - -#include "obj-format.h" - -#ifndef LOCAL_LABELS_FB -#define LOCAL_LABELS_FB 1 -#endif diff --git a/contrib/binutils/gas/config/te-freebsd.h b/contrib/binutils/gas/config/te-freebsd.h index 6992561bd59..eb16f3c4638 100644 --- a/contrib/binutils/gas/config/te-freebsd.h +++ b/contrib/binutils/gas/config/te-freebsd.h @@ -15,8 +15,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ /* Target environment for FreeBSD. It is the same as the generic target, except that it arranges via the TE_FreeBSD define to diff --git a/contrib/binutils/gas/config/te-nbsd.h b/contrib/binutils/gas/config/te-nbsd.h index cb8dc092eb5..e428fab68fc 100644 --- a/contrib/binutils/gas/config/te-nbsd.h +++ b/contrib/binutils/gas/config/te-nbsd.h @@ -16,8 +16,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #define TE_NetBSD 1 #define LOCAL_LABELS_FB 1 diff --git a/contrib/binutils/gas/config/te-ppcnw.h b/contrib/binutils/gas/config/te-ppcnw.h deleted file mode 100644 index 133759156ae..00000000000 --- a/contrib/binutils/gas/config/te-ppcnw.h +++ /dev/null @@ -1,32 +0,0 @@ -/* te-ppcnw.h -- Power PC running Netware environment declarations. - Copyright 1994, 1995, 2000 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. */ - -/* Added these, because if we don't know what we're targeting 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 */ -#include "obj-format.h" - -/* gcc uses escape sequences for ppc/netware. */ - -#undef NO_STRING_ESCAPES diff --git a/contrib/binutils/gas/config/te-sparcaout.h b/contrib/binutils/gas/config/te-sparcaout.h index edd37661726..79181161034 100644 --- a/contrib/binutils/gas/config/te-sparcaout.h +++ b/contrib/binutils/gas/config/te-sparcaout.h @@ -15,8 +15,8 @@ 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. */ + the Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #define TE_SPARCAOUT 1 #include "obj-format.h" diff --git a/contrib/binutils/gas/config/te-sysv32.h b/contrib/binutils/gas/config/te-sysv32.h deleted file mode 100644 index c60728a975d..00000000000 --- a/contrib/binutils/gas/config/te-sysv32.h +++ /dev/null @@ -1,6 +0,0 @@ -/* Remove leading underscore from the gcc generated symbol names. */ -#define STRIP_UNDERSCORE - -#include "obj-format.h" - -/* end of te-sysv32.h */ diff --git a/contrib/binutils/gas/config/te-tmips.h b/contrib/binutils/gas/config/te-tmips.h index 2fc6fd91005..87d432884f5 100644 --- a/contrib/binutils/gas/config/te-tmips.h +++ b/contrib/binutils/gas/config/te-tmips.h @@ -1,5 +1,5 @@ /* Traditional MIPS targets - Copyright 2000 Free Software Foundation, Inc. + Copyright 2000, 2003 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -15,8 +15,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ /* This file is te-tmips.h and is intended to provide support for traditional mips targets like mips-dde-sysv4.2MP (Supermax ) , diff --git a/contrib/binutils/gas/configure b/contrib/binutils/gas/configure index e66abca67bc..dca6497031c 100755 --- a/contrib/binutils/gas/configure +++ b/contrib/binutils/gas/configure @@ -309,7 +309,7 @@ ac_includes_default="\ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE LN_S RANLIB ac_ct_RANLIB LIBTOOL WARN_CFLAGS GDBINIT cgen_cpu_prefix extra_objects target_cpu_type obj_format te_file install_tooldir atof BFDLIB OPCODES_LIB BFDVER_H ALL_OBJ_DEPS YACC LEX LEXLIB LEX_OUTPUT_ROOT CPP EGREP ALLOCA USE_NLS MSGFMT GMSGFMT XGETTEXT USE_INCLUDED_LIBINTL CATALOGS CATOBJEXT DATADIRNAME GMOFILES INSTOBJEXT INTLDEPS INTLLIBS INTLOBJS POFILES POSUB INCLUDE_LOCALE_H GT_NO GT_YES MKINSTALLDIRS l MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LIBM LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE LN_S RANLIB ac_ct_RANLIB LIBTOOL WARN_CFLAGS NO_WERROR GDBINIT cgen_cpu_prefix extra_objects target_cpu_type obj_format te_file install_tooldir atof BFDLIB OPCODES_LIB BFDVER_H ALL_OBJ_DEPS YACC LEX LEXLIB LEX_OUTPUT_ROOT CPP EGREP ALLOCA USE_NLS MSGFMT GMSGFMT XGETTEXT USE_INCLUDED_LIBINTL CATALOGS CATOBJEXT DATADIRNAME GMOFILES INSTOBJEXT INTLDEPS INTLLIBS INTLOBJS POFILES POSUB INCLUDE_LOCALE_H GT_NO GT_YES MKINSTALLDIRS l MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LIBM datarootdir docdir htmldir LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -856,10 +856,10 @@ Optional Features: --enable-static=PKGS build static libraries default=yes --enable-fast-install=PKGS optimize for fast installation default=yes --disable-libtool-lock avoid locking (might break parallel builds) - --enable-bfd-assembler use BFD back end for writing object files - targets alternative target configurations besides the primary + --enable-targets alternative target configurations besides the primary --enable-commonbfdlib build shared BFD/opcodes/libiberty library - --enable-build-warnings Enable build-time compiler warnings if gcc is used + --enable-werror treat compile warnings as errors + --enable-build-warnings Enable build-time compiler warnings --disable-nls do not use Native Language Support --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer @@ -971,7 +971,7 @@ esac else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi - cd "$ac_popdir" + cd $ac_popdir done fi @@ -1994,7 +1994,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2052,7 +2053,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2168,7 +2170,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2222,7 +2225,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2267,7 +2271,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2311,7 +2316,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2389,7 +2395,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2443,7 +2450,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2477,7 +2485,7 @@ fi BFD_VERSION=`sed -n -e 's/^.._INIT_AUTOMAKE.*,[ ]*\([^ ]*\)[ ]*).*/\1/p' < ${srcdir}/../bfd/configure.in` -am__api_version="1.8" +am__api_version="1.9" # 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: @@ -2629,13 +2637,21 @@ echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then - # Keeping the `.' argument allows $(mkdir_p) to be used without - # argument. Indeed, we sometimes output rules like + # We used to keeping the `.' as first argument, in order to + # allow $(mkdir_p) to be used without argument. As in # $(mkdir_p) $(somedir) - # where $(somedir) is conditionally defined. - # (`test -n '$(somedir)' && $(mkdir_p) $(somedir)' is a more - # expensive solution, as it forces Make to start a sub-shell.) - mkdir_p='mkdir -p -- .' + # where $(somedir) is conditionally defined. However this is wrong + # for two reasons: + # 1. if the package is installed by a user who cannot write `.' + # make install will fail, + # 2. the above comment should most certainly read + # $(mkdir_p) $(DESTDIR)$(somedir) + # so it does not work when $(somedir) is undefined and + # $(DESTDIR) is not. + # To support the latter case, we have to write + # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), + # so the `.' trick is pointless. + mkdir_p='mkdir -p --' else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as @@ -2844,9 +2860,6 @@ AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} - -AMTAR=${AMTAR-"${am_missing_run}tar"} - install_sh=${install_sh-"$am_aux_dir/install-sh"} # Installed binaries are usually stripped using `strip' when the user @@ -2939,6 +2952,13 @@ INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" # We need awk for the "check" target. The system "awk" is bad on # some platforms. +# Always define AMTAR for backward compatibility. + +AMTAR=${AMTAR-"${am_missing_run}tar"} + +am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' + + depcc="$CC" am_compiler_list= @@ -3320,6 +3340,7 @@ cygwin* | mingw* |pw32*) ;; darwin* | rhapsody*) + # this will be overwritten by pass_all, but leave it in just in case lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' lt_cv_file_magic_cmd='/usr/bin/file -L' case "$host_os" in @@ -3330,9 +3351,10 @@ darwin* | rhapsody*) lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' ;; esac + lt_cv_deplibs_check_method=pass_all ;; -freebsd* ) +freebsd* | kfreebsd*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then case $host_cpu in i*86 ) @@ -3390,17 +3412,10 @@ irix5* | irix6*) # This must be Linux ELF. linux-gnu*) - case $host_cpu in - alpha* | mips* | hppa* | i*86 | powerpc* | sparc* | ia64* ) - lt_cv_deplibs_check_method=pass_all ;; - *) - # glibc up to 2.1.1 does not perform some relocations on ARM - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; - esac - lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` + lt_cv_deplibs_check_method=pass_all ;; -netbsd*) +netbsd* | knetbsd*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' else @@ -3458,6 +3473,67 @@ deplibs_check_method=$lt_cv_deplibs_check_method # Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! +# find the maximum length of command line arguments +echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5 +echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6 +if test "${lt_cv_sys_max_cmd_len+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + i=0 + teststring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + cygwin* | mingw*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for *BSD + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + esac + +fi + +if test -n "$lt_cv_sys_max_cmd_len" ; then + echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5 +echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6 +else + echo "$as_me:$LINENO: result: none" >&5 +echo "${ECHO_T}none" >&6 +fi + + # Only perform the check for file, if the check method requires it case $deplibs_check_method in file_magic*) @@ -3791,7 +3867,7 @@ test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic" case $host in *-*-irix6*) # Find out which ABI we are using. - echo '#line 3794 "configure"' > conftest.$ac_ext + echo '#line 3870 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -3846,6 +3922,52 @@ ia64-*-hpux*) rm -rf conftest* ;; +x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + case "`/usr/bin/file conftest.o`" in + *32-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" @@ -3887,7 +4009,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4031,18 +4154,7 @@ exec 5>>./config.log -user_bfd_gas= -# Check whether --enable-bfd-assembler or --disable-bfd-assembler was given. -if test "${enable_bfd_assembler+set}" = set; then - enableval="$enable_bfd_assembler" - case "${enableval}" in - yes) need_bfd=yes user_bfd_gas=yes ;; - no) user_bfd_gas=no ;; - *) { { echo "$as_me:$LINENO: error: bad value ${enableval} given for bfd-assembler option" >&5 -echo "$as_me: error: bad value ${enableval} given for bfd-assembler option" >&2;} - { (exit 1); exit 1; }; } ;; -esac -fi; # Check whether --enable-targets or --disable-targets was given. +# Check whether --enable-targets or --disable-targets was given. if test "${enable_targets+set}" = set; then enableval="$enable_targets" case "${enableval}" in @@ -4066,28 +4178,60 @@ esac fi; using_cgen=no -build_warnings="-W -Wall -Wstrict-prototypes -Wmissing-prototypes" + +GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes" + +# Check whether --enable-werror or --disable-werror was given. +if test "${enable_werror+set}" = set; then + enableval="$enable_werror" + case "${enableval}" in + yes | y) ERROR_ON_WARNING="yes" ;; + no | n) ERROR_ON_WARNING="no" ;; + *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-werror" >&5 +echo "$as_me: error: bad value ${enableval} for --enable-werror" >&2;} + { (exit 1); exit 1; }; } ;; + esac +fi; + +# Enable -Werror by default when using gcc +if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then + ERROR_ON_WARNING=yes +fi + +NO_WERROR= +if test "${ERROR_ON_WARNING}" = yes ; then + GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror" + NO_WERROR="-Wno-error" +fi + +if test "${GCC}" = yes ; then + WARN_CFLAGS="${GCC_WARN_CFLAGS}" +fi + # Check whether --enable-build-warnings or --disable-build-warnings was given. if test "${enable_build_warnings+set}" = set; then enableval="$enable_build_warnings" case "${enableval}" in - yes) ;; - no) build_warnings="-w";; + yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}";; + no) if test "${GCC}" = yes ; then + WARN_CFLAGS="-w" + fi;; ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"` - build_warnings="${build_warnings} ${t}";; + WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";; *,) t=`echo "${enableval}" | sed -e "s/,/ /g"` - build_warnings="${t} ${build_warnings}";; - *) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;; + WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";; + *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;; esac -if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then - echo "Setting warning flags = $build_warnings" 6>&1 -fi -fi; WARN_CFLAGS="" -if test "x${build_warnings}" != x -a "x$GCC" = xyes ; then - WARN_CFLAGS="${build_warnings}" +fi; + +if test x"$silent" != x"yes" && test x"$WARN_CFLAGS" != x""; then + echo "Setting warning flags = $WARN_CFLAGS" 6>&1 fi + + + # Generate a header file ac_config_headers="$ac_config_headers config.h:config.in" @@ -4108,6 +4252,238 @@ case "${host}" in esac +#We need this for the host. BOUT header is in host order. +echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 +echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6 +if test "${ac_cv_c_bigendian+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # See if sys/param.h defines the BYTE_ORDER macro. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include + +int +main () +{ +#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN + bogus endian macros +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + # It does; now see whether it defined to BIG_ENDIAN or not. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include + +int +main () +{ +#if BYTE_ORDER != BIG_ENDIAN + not big endian +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_bigendian=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_c_bigendian=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +# It does not; compile a test program. +if test "$cross_compiling" = yes; then + # try to guess the endianness by grepping values into an object file + ac_cv_c_bigendian=unknown + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; +short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; +void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } +short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; +short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; +void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } +int +main () +{ + _ascii (); _ebcdic (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then + ac_cv_c_bigendian=yes +fi +if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then + if test "$ac_cv_c_bigendian" = unknown; then + ac_cv_c_bigendian=no + else + # finding both strings is unlikely to happen, but who knows? + ac_cv_c_bigendian=unknown + fi +fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +int +main () +{ + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long l; + char c[sizeof (long)]; + } u; + u.l = 1; + exit (u.c[sizeof (long) - 1] == 1); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_bigendian=no +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_c_bigendian=yes +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 +echo "${ECHO_T}$ac_cv_c_bigendian" >&6 +case $ac_cv_c_bigendian in + yes) + +cat >>confdefs.h <<\_ACEOF +#define WORDS_BIGENDIAN 1 +_ACEOF + ;; + no) + ;; + *) + { { echo "$as_me:$LINENO: error: unknown endianness +presetting ac_cv_c_bigendian=no (or yes) will help" >&5 +echo "$as_me: error: unknown endianness +presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} + { (exit 1); exit 1; }; } ;; +esac + + te_file=generic # Makefile target for installing gas in $(tooldir)/bin. @@ -4148,55 +4524,17 @@ emulations="" for this_target in $target $canon_targets ; do - eval `echo $this_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/cpu=\1 vendor=\2 os=\3/'` + targ=${this_target} + . ${srcdir}/configure.tgt - # check for architecture variants - arch= - endian= - case ${cpu} in - am33_2.0) cpu_type=mn10300 endian=little ;; - alpha*) cpu_type=alpha ;; - arm*b|xscale*b|strongarm*b) cpu_type=arm endian=big ;; - arm*|xscale*|strongarm*) cpu_type=arm endian=little ;; - c4x*) cpu_type=tic4x ;; - hppa*) cpu_type=hppa ;; - i[3-7]86) cpu_type=i386 arch=i386;; - x86_64) cpu_type=i386 arch=x86_64;; - ia64) cpu_type=ia64 ;; - ip2k) cpu_type=ip2k endian=big ;; - iq2000) cpu_type=iq2000 endian=big ;; - m6811|m6812|m68hc12) cpu_type=m68hc11 ;; - m680[012346]0) cpu_type=m68k ;; - m68008) cpu_type=m68k ;; - m683??) cpu_type=m68k ;; - m5200) cpu_type=m68k ;; - m8*) cpu_type=m88k ;; - mips*el) cpu_type=mips endian=little ;; - mips*) cpu_type=mips endian=big ;; - or32*) cpu_type=or32 endian=big ;; - pjl*) cpu_type=pj endian=little ;; - pj*) cpu_type=pj endian=big ;; - powerpc*le*) cpu_type=ppc endian=little ;; - powerpc*) cpu_type=ppc endian=big ;; - rs6000*) cpu_type=ppc ;; - s390x*) cpu_type=s390 arch=s390x ;; - s390*) cpu_type=s390 arch=s390 ;; - sh5*) cpu_type=sh64 endian=big ;; - sh5le*) cpu_type=sh64 endian=little ;; - sh64*) cpu_type=sh64 endian=big ;; - sh64le*) cpu_type=sh64 endian=little ;; - sh*le) cpu_type=sh endian=little ;; - sh*) cpu_type=sh endian=big ;; - sparclite*) cpu_type=sparc arch=sparclite ;; - sparclet*) cpu_type=sparc arch=sparclet ;; - sparc64*) cpu_type=sparc arch=v9-64 ;; - sparc86x*) cpu_type=sparc arch=sparc86x ;; - sparc*) cpu_type=sparc arch=sparclite ;; # ??? See tc-sparc.c. - v850*) cpu_type=v850 ;; - xtensa*) cpu_type=xtensa arch=xtensa ;; - m32r) cpu_type=m32r target_cpu=m32r endian=big ;; - m32rle) cpu_type=m32r target_cpu=m32r endian=little ;; - *) cpu_type=${cpu} ;; + case ${target_cpu} in + crisv32) + +cat >>confdefs.h <<_ACEOF +#define DEFAULT_CRIS_ARCH $arch +_ACEOF + + ;; esac if test ${this_target} = $target ; then @@ -4205,371 +4543,78 @@ for this_target in $target $canon_targets ; do continue fi - generic_target=${cpu_type}-$vendor-$os - dev=no - bfd_gas=no - em=generic - - # assign object format + generic_target=${cpu_type}-${target_vendor}-${target_os} case ${generic_target} in - a29k-*-coff) fmt=coff ;; - a29k-amd-udi) fmt=coff ;; - a29k-amd-ebmon) fmt=coff ;; - a29k-nyu-sym1) fmt=coff ;; - a29k-*-rtems*) fmt=coff ;; - a29k-*-vxworks*) fmt=coff ;; - - alpha*-*-*vms*) fmt=evax ;; - alpha*-*-netware*) fmt=ecoff ;; - alpha*-*-osf*) fmt=ecoff ;; - alpha*-*-linuxecoff*) fmt=ecoff ;; - alpha*-*-linux-gnu*) fmt=elf em=linux ;; - alpha*-*-netbsd*) fmt=elf em=nbsd ;; - alpha*-*-openbsd*) fmt=elf em=obsd ;; - - # cpu_type for am33_2.0 is set to mn10300 - mn10300-*-linux*) fmt=elf bfd_gas=yes em=linux ;; - - arc-*-elf*) fmt=elf ;; - - arm-*-aout) fmt=aout ;; - arm-*-coff | thumb-*-coff) fmt=coff ;; - arm-*-rtems* | thumb-*-rtems*) fmt=elf ;; - arm-*-elf | thumb-*-elf) fmt=elf ;; - arm-*-kaos*) fmt=elf ;; - arm*-*-conix*) fmt=elf ;; - arm-*-linux*aout*) fmt=aout em=linux ;; - arm*-*-linux-gnu*) fmt=elf em=linux ;; - arm*-*-uclinux*) fmt=elf em=linux ;; - arm-*-netbsdelf*) fmt=elf em=nbsd ;; - arm-*-*n*bsd*) fmt=aout em=nbsd ;; - arm-**-nto*) fmt=elf ;; - arm-*-oabi | thumb-*-oabi) fmt=elf ;; - arm-epoc-pe | thumb-epoc-pe) fmt=coff em=epoc-pe ;; - arm-wince-pe | arm-*-wince) fmt=coff em=wince-pe ;; - arm-*-pe | thumb-*-pe) fmt=coff em=pe ;; - arm-*-riscix*) fmt=aout em=riscix ;; - - avr-*-*) fmt=elf ;; - - cris-*-linux-gnu*) fmt=multi bfd_gas=yes em=linux ;; - cris-*-*) fmt=multi bfd_gas=yes ;; - - d10v-*-*) fmt=elf ;; - d30v-*-*) fmt=elf ;; - dlx-*-*) fmt=elf ;; - - fr30-*-*) fmt=elf ;; - frv-*-*linux*) fmt=elf em=linux;; - frv-*-*) fmt=elf ;; - - hppa-*-linux*) case ${cpu} in - hppa*64*) fmt=elf em=hppalinux64;; - hppa*) fmt=elf em=linux;; - esac ;; - hppa-*-*elf*) fmt=elf em=hppa ;; - hppa-*-lites*) fmt=elf em=hppa ;; - hppa-*-netbsd*) fmt=elf em=nbsd ;; - hppa-*-openbsd*) fmt=elf em=hppa ;; - hppa-*-osf*) fmt=som em=hppa ;; - hppa-*-rtems*) fmt=elf em=hppa ;; - hppa-*-hpux11*) case ${cpu} in - hppa*64*) fmt=elf em=hppa64 ;; - hppa*) fmt=som em=hppa ;; - esac ;; - hppa-*-hpux*) fmt=som em=hppa ;; - hppa-*-mpeix*) fmt=som em=hppa ;; - hppa-*-bsd*) fmt=som em=hppa ;; - hppa-*-hiux*) fmt=som em=hppa ;; - - h8300-*-rtems*) fmt=coff ;; - h8300-*-coff) fmt=coff ;; - h8300-*-elf) fmt=elf ;; - h8500-*-rtems*) fmt=coff ;; - h8500-*-coff) fmt=coff ;; - - i370-*-elf* | i370-*-linux*) fmt=elf ;; - i386-ibm-aix*) fmt=coff em=i386aix ;; - i386-sequent-bsd*) fmt=aout em=dynix ;; - i386-*-beospe*) fmt=coff em=pe ;; - i386-*-beos*) fmt=elf ;; - i386-*-coff) fmt=coff ;; - i386-*-elf) fmt=elf ;; - i386-*-kaos*) fmt=elf ;; - i386-*-bsd*) fmt=aout em=386bsd ;; - i386-*-netbsd0.8) fmt=aout em=386bsd ;; - i386-*-netbsdpe*) fmt=coff em=pe ;; - i386-*-netbsd*-gnu* | \ - i386-*-knetbsd*-gnu | \ - i386-*-netbsdelf*) fmt=elf em=nbsd ;; - i386-*-*n*bsd*) case ${cpu} in - x86_64) fmt=elf em=nbsd ;; - *) fmt=aout em=nbsd ;; - esac ;; - i386-*-linux*aout*) fmt=aout em=linux ;; - i386-*-linux*oldld) fmt=aout em=linux ;; - i386-*-linux*coff*) fmt=coff em=linux ;; - i386-*-linux-gnu*) fmt=elf em=linux ;; - x86_64-*-linux-gnu*) fmt=elf em=linux ;; - i386-*-lynxos*) fmt=coff em=lynx ;; - i386-*-sysv[45]*) fmt=elf ;; - i386-*-solaris*) fmt=elf ;; - i386-*-freebsdaout*) fmt=aout em=386bsd ;; - i386-*-freebsd[12].*) fmt=aout em=386bsd ;; - i386-*-freebsd[12]) fmt=aout em=386bsd ;; - i386-*-freebsd* | i386-*-kfreebsd*-gnu) - fmt=elf em=freebsd ;; - i386-*-sysv*) fmt=coff ;; - i386-*-sco3.2v5*coff) fmt=coff ;; - i386-*-isc*) fmt=coff ;; - i386-*-sco3.2v5*) fmt=elf - if test ${this_target} = $target; then + i386-*-sco3.2v5*) + if test ${this_target} = $target; then cat >>confdefs.h <<\_ACEOF #define SCO_ELF 1 _ACEOF - fi ;; - i386-*-sco3.2*) fmt=coff ;; - i386-*-vsta) fmt=aout ;; + fi + ;; + i386-*-msdosdjgpp* \ | i386-*-go32* \ - | i386-go32-rtems*) fmt=coff em=go32 + | i386-go32-rtems*) cat >>confdefs.h <<\_ACEOF #define STRICTCOFF 1 _ACEOF - ;; - i386-*-rtemself*) fmt=elf ;; - i386-*-rtemscoff*) fmt=coff ;; - i386-*-rtems*) fmt=elf ;; - i386-*-gnu*) fmt=elf ;; - i386-*-mach*) fmt=aout em=mach ;; - i386-*-msdos*) fmt=aout ;; - i386-*-moss*) fmt=elf ;; - i386-*-pe) fmt=coff em=pe ;; - i386-*-cygwin*) fmt=coff em=pe ;; - i386-*-interix*) fmt=coff em=interix ;; - i386-*-mingw32*) fmt=coff em=pe ;; - i386-*-nto-qnx*) fmt=elf ;; - i386-*-*nt*) fmt=coff em=pe ;; - i386-*-chaos) fmt=elf ;; - i860-*-*) fmt=elf endian=little - { echo "$as_me:$LINENO: WARNING: GAS support for ${generic_target} is preliminary and a work in progress" >&5 -echo "$as_me: WARNING: GAS support for ${generic_target} is preliminary and a work in progress" >&2;} ;; - i960-*-bout) fmt=bout ;; - i960-*-coff) fmt=coff em=ic960 ;; - i960-*-rtems*) fmt=coff em=ic960 ;; - i960-*-nindy*) fmt=bout ;; - i960-*-vxworks5.0) fmt=bout ;; - i960-*-vxworks5.*) fmt=coff em=ic960 ;; - i960-*-vxworks*) fmt=bout ;; - i960-*-elf*) fmt=elf ;; + ;; - ia64-*-elf*) fmt=elf ;; - ia64-*-aix*) fmt=elf em=ia64aix ;; - ia64-*-linux-gnu*) fmt=elf em=linux ;; - ia64-*-hpux*) fmt=elf em=hpux ;; - ia64-*-netbsd*) fmt=elf em=nbsd ;; + i860-*-*) + { echo "$as_me:$LINENO: WARNING: GAS support for ${generic_target} is preliminary and a work in progress" >&5 +echo "$as_me: WARNING: GAS support for ${generic_target} is preliminary and a work in progress" >&2;} + ;; - ip2k-*-*) fmt=elf ;; - - iq2000-*-elf) fmt=elf bfd_gas=yes ;; - - m32r-*-elf*) fmt=elf ;; - m32r-*-linux*) fmt=elf em=linux;; - - m68hc11-*-* | m6811-*-*) fmt=elf ;; - m68hc12-*-* | m6812-*-*) fmt=elf ;; - - m68k-*-vxworks*) fmt=aout em=sun3 ;; - m68k-ericsson-ose) fmt=aout em=sun3 ;; - m68k-*-sunos*) fmt=aout em=sun3 ;; - m68k-motorola-sysv*) fmt=coff em=delta ;; - m68k-bull-sysv3*) fmt=coff em=dpx2 ;; - m68k-apollo-*) fmt=coff em=apollo ;; - m68k-*-elf*) fmt=elf ;; - m68k-*-sysv4*) fmt=elf em=svr4 ;; - m68k-*-sysv*) fmt=coff ;; - m68k-*-coff | m68k-*-rtemscoff*) fmt=coff ;; - m68k-*-rtems*) fmt=elf ;; - m68k-*-hpux*) fmt=hp300 em=hp300 ;; - m68k-*-linux*aout*) fmt=aout em=linux ;; - m68k-*-linux-gnu*) fmt=elf em=linux ;; - m68k-*-uclinux*) fmt=elf ;; - m68k-*-gnu*) fmt=elf ;; - m68k-*-lynxos*) fmt=coff em=lynx ;; - m68k-*-netbsdelf*) fmt=elf em=nbsd ;; - m68k-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes ;; - m68k-*-openbsd*) fmt=aout em=nbsd bfd_gas=yes ;; - m68k-apple-aux*) fmt=coff em=aux ;; - m68k-*-psos*) fmt=elf em=psos;; - - m88k-motorola-sysv3*) fmt=coff em=delt88 ;; - m88k-*-coff*) fmt=coff ;; - - mcore-*-elf) fmt=elf ;; - mcore-*-pe) fmt=coff em=pe bfd_gas=yes ;; - - # don't change em like *-*-bsd does - mips-dec-openbsd*) fmt=elf endian=little ;; - mips-sony-bsd*) fmt=ecoff ;; + mips-sony-bsd*) + ;; mips-*-bsd*) - { { echo "$as_me:$LINENO: error: Unknown vendor for mips-bsd configuration." >&5 + { { echo "$as_me:$LINENO: error: Unknown vendor for mips-bsd configuration." >&5 echo "$as_me: error: Unknown vendor for mips-bsd configuration." >&2;} - { (exit 1); exit 1; }; } ;; - mips-*-ultrix*) fmt=ecoff endian=little ;; - mips-*-osf*) fmt=ecoff endian=little ;; - mips-*-ecoff*) fmt=ecoff ;; - mips-*-pe*) fmt=coff endian=little em=pe ;; - mips-*-irix6*) fmt=elf em=irix ;; - mips-*-irix5*) fmt=elf em=irix ;; - mips-*-irix*) fmt=ecoff em=irix ;; - mips-*-lnews*) fmt=ecoff em=lnews ;; - mips-*-riscos*) fmt=ecoff ;; - mips*-*-linux*) fmt=elf em=tmips ;; - mips-*-sysv4*MP* | mips-*-gnu*) fmt=elf em=tmips ;; - mips-*-sysv*) fmt=ecoff ;; - mips-*-elf* | mips-*-rtems*) fmt=elf ;; - mips-*-netbsd*) fmt=elf ;; - mips-*-openbsd*) fmt=elf ;; + { (exit 1); exit 1; }; } + ;; - mmix-*-*) fmt=elf ;; - mn10200-*-*) fmt=elf ;; - mn10300-*-*) fmt=elf ;; - msp430-*-*) fmt=elf ;; - openrisc-*-*) fmt=elf ;; - or32-*-rtems*) fmt=elf ;; - or32-*-coff) fmt=coff ;; - or32-*-elf) fmt=elf ;; - pj*) fmt=elf ;; - - ppc-*-pe | ppc-*-cygwin*) fmt=coff em=pe ;; - ppc-*-winnt*) fmt=coff em=pe ;; - ppc-*-aix5.[01]) fmt=coff em=aix5 ;; - ppc-*-aix5.*) fmt=coff em=aix5 + ppc-*-aix5.*) cat >>confdefs.h <<\_ACEOF #define AIX_WEAK_SUPPORT 1 _ACEOF - ;; - ppc-*-aix*) fmt=coff ;; - ppc-*-beos*) fmt=coff ;; - ppc-*-*n*bsd* | ppc-*-elf*) fmt=elf ;; - ppc-*-eabi* | ppc-*-sysv4*) fmt=elf ;; - ppc-*-linux-gnu*) fmt=elf em=linux - case "$endian" in - big) ;; - *) { { echo "$as_me:$LINENO: error: GNU/Linux must be configured big endian" >&5 + ;; + ppc-*-linux-*) + case "$endian" in + big) ;; + *) { { echo "$as_me:$LINENO: error: GNU/Linux must be configured big endian" >&5 echo "$as_me: error: GNU/Linux must be configured big endian" >&2;} { (exit 1); exit 1; }; } ;; - esac ;; - ppc-*-solaris*) fmt=elf - if test ${this_target} = $target; then + esac + ;; + ppc-*-solaris*) + if test ${this_target} = $target; then cat >>confdefs.h <<\_ACEOF #define TARGET_SOLARIS_COMMENT 1 _ACEOF - fi - if test x${endian} = xbig; then - { { echo "$as_me:$LINENO: error: Solaris must be configured little endian" >&5 + fi + if test x${endian} = xbig; then + { { echo "$as_me:$LINENO: error: Solaris must be configured little endian" >&5 echo "$as_me: error: Solaris must be configured little endian" >&2;} { (exit 1); exit 1; }; } - fi ;; - ppc-*-rtems*) fmt=elf ;; - ppc-*-macos* | ppc-*-mpw*) fmt=coff em=macos ;; - ppc-*-netware*) fmt=elf em=ppcnw ;; - ppc-**-nto*) fmt=elf ;; - ppc-*-kaos*) fmt=elf ;; + fi + ;; - s390x-*-linux-gnu*) fmt=elf em=linux ;; - s390-*-linux-gnu*) fmt=elf em=linux ;; + sh*-*-symbianelf*) - sh*-*-linux*) fmt=elf em=linux - case ${cpu} in - sh*eb) endian=big ;; - *) endian=little ;; - esac ;; - sh5*-*-netbsd*) fmt=elf em=nbsd ;; - sh64*-*-netbsd*) fmt=elf em=nbsd ;; - sh*-*-netbsdelf*) fmt=elf em=nbsd ;; - sh-*-elf*) fmt=elf ;; - sh-*-coff*) fmt=coff ;; - sh-*-nto*) fmt=elf ;; - sh-*-pe*) fmt=coff em=pe bfd_gas=yes endian=little ;; - sh-*-rtemscoff*) fmt=coff ;; - sh-*-rtems*) fmt=elf ;; - sh-*-kaos*) fmt=elf ;; - shle*-*-kaos*) fmt=elf ;; - sh64-*-elf*) fmt=elf ;; +cat >>confdefs.h <<\_ACEOF +#define TARGET_SYMBIAN 1 +_ACEOF - ns32k-pc532-mach*) fmt=aout em=pc532mach ;; - ns32k-pc532-ux*) fmt=aout em=pc532mach ;; - ns32k-pc532-lites*) fmt=aout em=nbsd532 ;; - ns32k-*-*n*bsd*) fmt=aout em=nbsd532 ;; - - sparc-*-rtemsaout*) fmt=aout ;; - sparc-*-rtemself*) fmt=elf ;; - sparc-*-rtems*) fmt=elf ;; - sparc-*-sunos4*) fmt=aout em=sun3 ;; - sparc-*-aout | sparc*-*-vxworks*) fmt=aout em=sparcaout ;; - sparc-*-coff) fmt=coff ;; - sparc-*-linux*aout*) fmt=aout em=linux ;; - sparc-*-linux-gnu*) fmt=elf em=linux ;; - sparc-*-lynxos*) fmt=coff em=lynx ;; - sparc-fujitsu-none) fmt=aout ;; - sparc-*-elf) fmt=elf ;; - sparc-*-sysv4*) fmt=elf ;; - sparc-*-solaris*) fmt=elf ;; - sparc-*-netbsdelf*) fmt=elf em=nbsd ;; - sparc-*-*n*bsd*) case ${cpu} in - sparc64) fmt=elf em=nbsd ;; - *) fmt=aout em=nbsd ;; - esac ;; - strongarm-*-coff) fmt=coff ;; - strongarm-*-elf) fmt=elf ;; - strongarm-*-kaos*) fmt=elf ;; - xscale-*-coff) fmt=coff ;; - xscale-*-elf) fmt=elf ;; - - tic30-*-*aout*) fmt=aout bfd_gas=yes ;; - tic30-*-*coff*) fmt=coff bfd_gas=yes ;; - tic4x-*-* | c4x-*-*) fmt=coff bfd_gas=yes ;; - tic54x-*-* | c54x*-*-*) fmt=coff bfd_gas=yes need_libm=yes;; - tic80-*-*) fmt=coff ;; - - v850-*-*) fmt=elf ;; - v850e-*-*) fmt=elf ;; - v850ea-*-*) fmt=elf ;; - - vax-*-netbsdelf*) fmt=elf em=nbsd ;; - vax-*-netbsd*) fmt=aout em=nbsd ;; - vax-*-bsd* | vax-*-ultrix*) fmt=aout ;; - vax-*-linux-gnu*) fmt=elf em=linux bfd_gas=yes ;; - vax-*-vms) fmt=vms ;; - - w65-*-*) fmt=coff ;; - - xstormy16-*-*) fmt=elf ;; - - xtensa-*-*) fmt=elf ;; - - z8k-*-coff | z8k-*-sim) fmt=coff ;; - - *-*-aout | *-*-scout) fmt=aout ;; - *-*-freebsd* | *-*-kfreebsd*-gnu) fmt=elf em=freebsd ;; - *-*-nindy*) fmt=bout ;; - *-*-bsd*) fmt=aout em=sun3 ;; - *-*-generic) fmt=generic ;; - *-*-xray | *-*-hms) fmt=coff ;; - *-*-sim) fmt=coff ;; - *-*-elf | *-*-sysv4* | *-*-solaris*) fmt=elf dev=yes ;; - *-*-aros*) fmt=elf em=linux bfd_gas=yes ;; - *-*-vxworks | *-*-windiss) fmt=elf ;; - *-*-netware) fmt=elf ;; + ;; esac if test ${this_target} = $target ; then @@ -4588,13 +4633,6 @@ _ACEOF fi fi - case ${cpu_type}-${fmt} in - alpha*-* | arm-* | i386-* | ia64*-* | mips-* | ns32k-* \ - | pdp11-* | ppc-* | sparc-* | strongarm-* | xscale-* \ - | *-elf | *-ecoff | *-som) - bfd_gas=yes ;; - esac - # Other random stuff. case ${cpu_type} in @@ -4663,6 +4701,9 @@ echo "$as_me: error: $target_cpu isn't a supported MIPS CPU name" >&2;} mips*-linux*) mips_default_abi=O32_ABI ;; + mips64*-openbsd*) + mips_default_abi=N64_ABI + ;; *) mips_default_abi=NO_ABI ;; @@ -4703,19 +4744,31 @@ _ACEOF *opcodes*) shared_opcodes=true ;; *) shared_opcodes=false ;; esac - if test "${shared_opcodes}" = "true"; then - # A shared libopcodes must be linked against libbfd. - need_bfd=yes - fi ;; esac # Any other special object files needed ? case ${cpu_type} in + + bfin) + echo ${extra_objects} | grep -s "bfin-parse.o" + if test $? -ne 0 ; then + extra_objects="$extra_objects bfin-parse.o" + fi + + echo ${extra_objects} | grep -s "bfin-lex.o" + if test $? -ne 0 ; then + extra_objects="$extra_objects bfin-lex.o" + fi + ;; + fr30 | ip2k | iq2000 | m32r | openrisc) using_cgen=yes ;; + m32c) + using_cgen=yes + ;; frv) using_cgen=yes ;; @@ -4743,6 +4796,10 @@ _ACEOF fi ;; + mt) + using_cgen=yes + ;; + i386 | s390 | sparc) if test $this_target = $target ; then @@ -4757,6 +4814,10 @@ _ACEOF using_cgen=yes ;; + xc16x) + using_cgen=yes + ;; + xtensa) echo ${extra_objects} | grep -s "xtensa-relax.o" if test $? -ne 0 ; then @@ -4778,17 +4839,8 @@ _ACEOF # See if we really can support this configuration with the emulation code. if test $this_target = $target ; then - primary_bfd_gas=$bfd_gas obj_format=$fmt te_file=$em - - if test $bfd_gas = no ; then - # Can't support other configurations this way. - break - fi - elif test $bfd_gas = no ; then - # Can't support this configuration. - break fi # From target name and format, produce a list of supported emulations. @@ -4889,28 +4941,6 @@ echo "$as_me: error: GAS does not have support for object file format ${obj_form { (exit 1); exit 1; }; } fi -case ${user_bfd_gas}-${primary_bfd_gas} in - yes-yes | no-no) - # We didn't override user's choice. - ;; - no-yes) - { echo "$as_me:$LINENO: WARNING: Use of BFD is required for ${target}; overriding config options." >&5 -echo "$as_me: WARNING: Use of BFD is required for ${target}; overriding config options." >&2;} - ;; - no-preferred) - primary_bfd_gas=no - ;; - *-preferred) - primary_bfd_gas=yes - ;; - yes-*) - primary_bfd_gas=yes - ;; - -*) - # User specified nothing. - ;; -esac - # Some COFF configurations want these random other flags set. case ${obj_format} in coff) @@ -4935,8 +4965,8 @@ _ACEOF esac # Getting this done right is going to be a bitch. Each configuration specified -# with --enable-targets=... should be checked for environment, format, cpu, and -# bfd_gas setting. +# with --enable-targets=... should be checked for environment, format, cpu +# setting. # # For each configuration, the necessary object file support code must be linked # in. This might be only one, it might be up to four. The necessary emulation @@ -5039,11 +5069,6 @@ cat >>confdefs.h <<\_ACEOF #define OBJ_MAYBE_GENERIC 1 _ACEOF ;; - hp300) -cat >>confdefs.h <<\_ACEOF -#define OBJ_MAYBE_HP300 1 -_ACEOF - ;; ieee) cat >>confdefs.h <<\_ACEOF #define OBJ_MAYBE_IEEE 1 @@ -5052,11 +5077,6 @@ _ACEOF som) cat >>confdefs.h <<\_ACEOF #define OBJ_MAYBE_SOM 1 -_ACEOF - ;; - vms) -cat >>confdefs.h <<\_ACEOF -#define OBJ_MAYBE_VMS 1 _ACEOF ;; esac @@ -5091,16 +5111,6 @@ cat >>confdefs.h <<_ACEOF _ACEOF -case ${primary_bfd_gas}-${target_cpu_type}-${obj_format} in - yes-*-coff) need_bfd=yes ;; - no-*-coff) need_bfd=yes - -cat >>confdefs.h <<\_ACEOF -#define MANY_SEGMENTS 1 -_ACEOF - ;; -esac - reject_dev_configs=yes case ${reject_dev_configs}-${dev} in @@ -5117,15 +5127,6 @@ esac -case "${primary_bfd_gas}" in - yes) -cat >>confdefs.h <<\_ACEOF -#define BFD_ASSEMBLER 1 -_ACEOF - - need_bfd=yes ;; -esac - # do we need the opcodes library? case "${need_opcodes}" in yes) @@ -5133,13 +5134,9 @@ yes) ;; esac -case "${need_bfd}" in -yes) - BFDLIB=../bfd/libbfd.la - BFDVER_H=../bfd/bfdver.h - ALL_OBJ_DEPS="$ALL_OBJ_DEPS"' ../bfd/bfd.h $(INCDIR)/symcat.h' - ;; -esac +BFDLIB=../bfd/libbfd.la +BFDVER_H=../bfd/bfdver.h +ALL_OBJ_DEPS="$ALL_OBJ_DEPS"' ../bfd/bfd.h $(INCDIR)/symcat.h' @@ -5540,7 +5537,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5598,7 +5596,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5714,7 +5713,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5768,7 +5768,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5813,7 +5814,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5857,7 +5859,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -6019,7 +6022,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -6085,7 +6089,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -6174,7 +6179,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -6213,7 +6219,7 @@ if test "$LEX" = :; then LEX=${am_missing_run}flex fi -ALL_LINGUAS="fr tr es" +ALL_LINGUAS="fr tr es rw" if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 @@ -6577,7 +6583,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -6784,7 +6791,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -6844,7 +6852,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -6923,7 +6932,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -6988,7 +6998,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -7053,7 +7064,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -7117,7 +7129,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -7198,7 +7211,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -7339,7 +7353,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -7477,7 +7492,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -7661,7 +7677,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -7912,7 +7929,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8106,7 +8124,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8209,7 +8228,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8280,7 +8300,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8328,11 +8349,6 @@ echo "${ECHO_T}$USE_NLS" >&6 USE_INCLUDED_LIBINTL=no if test "$USE_NLS" = "yes"; then - -cat >>confdefs.h <<\_ACEOF -#define ENABLE_NLS 1 -_ACEOF - echo "$as_me:$LINENO: checking whether included gettext is requested" >&5 echo $ECHO_N "checking whether included gettext is requested... $ECHO_C" >&6 @@ -8350,7 +8366,7 @@ echo "${ECHO_T}$nls_cv_force_use_gnu_gettext" >&6 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then nls_cv_header_intl= nls_cv_header_libgt= - CATOBJEXT=NONE + CATOBJEXT= if test "${ac_cv_header_libintl_h+set}" = set; then echo "$as_me:$LINENO: checking for libintl.h" >&5 @@ -8382,7 +8398,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8518,7 +8535,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8582,7 +8600,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8637,7 +8656,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8777,7 +8797,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8910,7 +8931,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8942,8 +8964,10 @@ fi - if test "$CATOBJEXT" = "NONE"; then - nls_cv_use_gnu_gettext=yes + if test x"$CATOBJEXT" = x && test -d $srcdir/../intl; then + # Neither gettext nor catgets in included in the C library. + # Fall back on GNU gettext library (assuming it is present). + nls_cv_use_gnu_gettext=yes fi fi @@ -9114,6 +9138,13 @@ echo "${ECHO_T}found xgettext programs is not GNU xgettext; ignore it" >&6 + if test "x$CATOBJEXT" != "x"; then + +cat >>confdefs.h <<\_ACEOF +#define ENABLE_NLS 1 +_ACEOF + + fi if test "x$CATOBJEXT" != "x"; then @@ -9178,7 +9209,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9399,7 +9431,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9563,7 +9596,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9644,7 +9678,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9785,7 +9820,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9917,7 +9953,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -10030,7 +10067,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -10133,7 +10171,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -10171,8 +10210,9 @@ case "${need_libm}" in yes) LIBM= case $host in -*-*-beos* | *-*-cygwin* | *-*-pw32*) +*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) # These system don't have libm + # on darwin the libm is a symbolic link to libSystem.dylib ;; *-ncr-sysv4.3*) echo "$as_me:$LINENO: checking for _mwvalidcheckl in -lmw" >&5 @@ -10213,7 +10253,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -10274,7 +10315,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -10337,7 +10379,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -10414,7 +10457,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -10467,336 +10511,6 @@ gas_test_headers=" #endif " -echo "$as_me:$LINENO: checking whether declaration is required for strstr" >&5 -echo $ECHO_N "checking whether declaration is required for strstr... $ECHO_C" >&6 -if test "${gas_cv_decl_needed_strstr+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$gas_test_headers -int -main () -{ - -typedef char *(*f)(); -f x; -x = (f) strstr; - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - gas_cv_decl_needed_strstr=no -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -gas_cv_decl_needed_strstr=yes -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $gas_cv_decl_needed_strstr" >&5 -echo "${ECHO_T}$gas_cv_decl_needed_strstr" >&6 -if test $gas_cv_decl_needed_strstr = yes; then - -cat >>confdefs.h <<\_ACEOF -#define NEED_DECLARATION_STRSTR 1 -_ACEOF - -fi - - -echo "$as_me:$LINENO: checking whether declaration is required for malloc" >&5 -echo $ECHO_N "checking whether declaration is required for malloc... $ECHO_C" >&6 -if test "${gas_cv_decl_needed_malloc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$gas_test_headers -int -main () -{ - -typedef char *(*f)(); -f x; -x = (f) malloc; - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - gas_cv_decl_needed_malloc=no -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -gas_cv_decl_needed_malloc=yes -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $gas_cv_decl_needed_malloc" >&5 -echo "${ECHO_T}$gas_cv_decl_needed_malloc" >&6 -if test $gas_cv_decl_needed_malloc = yes; then - -cat >>confdefs.h <<\_ACEOF -#define NEED_DECLARATION_MALLOC 1 -_ACEOF - -fi - - -echo "$as_me:$LINENO: checking whether declaration is required for free" >&5 -echo $ECHO_N "checking whether declaration is required for free... $ECHO_C" >&6 -if test "${gas_cv_decl_needed_free+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$gas_test_headers -int -main () -{ - -typedef void (*f)(); -f x; -x = (f) free; - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - gas_cv_decl_needed_free=no -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -gas_cv_decl_needed_free=yes -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $gas_cv_decl_needed_free" >&5 -echo "${ECHO_T}$gas_cv_decl_needed_free" >&6 -if test $gas_cv_decl_needed_free = yes; then - -cat >>confdefs.h <<\_ACEOF -#define NEED_DECLARATION_FREE 1 -_ACEOF - -fi - - -echo "$as_me:$LINENO: checking whether declaration is required for sbrk" >&5 -echo $ECHO_N "checking whether declaration is required for sbrk... $ECHO_C" >&6 -if test "${gas_cv_decl_needed_sbrk+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$gas_test_headers -int -main () -{ - -typedef char *(*f)(); -f x; -x = (f) sbrk; - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - gas_cv_decl_needed_sbrk=no -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -gas_cv_decl_needed_sbrk=yes -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $gas_cv_decl_needed_sbrk" >&5 -echo "${ECHO_T}$gas_cv_decl_needed_sbrk" >&6 -if test $gas_cv_decl_needed_sbrk = yes; then - -cat >>confdefs.h <<\_ACEOF -#define NEED_DECLARATION_SBRK 1 -_ACEOF - -fi - - -echo "$as_me:$LINENO: checking whether declaration is required for environ" >&5 -echo $ECHO_N "checking whether declaration is required for environ... $ECHO_C" >&6 -if test "${gas_cv_decl_needed_environ+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$gas_test_headers -int -main () -{ - -typedef char **f; -f x; -x = (f) environ; - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - gas_cv_decl_needed_environ=no -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -gas_cv_decl_needed_environ=yes -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $gas_cv_decl_needed_environ" >&5 -echo "${ECHO_T}$gas_cv_decl_needed_environ" >&6 -if test $gas_cv_decl_needed_environ = yes; then - -cat >>confdefs.h <<\_ACEOF -#define NEED_DECLARATION_ENVIRON 1 -_ACEOF - -fi - - # Does errno.h declare errno, or do we have to add a separate declaration # for it? @@ -10837,7 +10551,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -10870,6 +10585,548 @@ _ACEOF fi +echo "$as_me:$LINENO: checking for a known getopt prototype in unistd.h" >&5 +echo $ECHO_N "checking for a known getopt prototype in unistd.h... $ECHO_C" >&6 +if test "${gas_cv_decl_getopt_unistd_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +extern int getopt (int, char *const*, const char *); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gas_cv_decl_getopt_unistd_h=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +gas_cv_decl_getopt_unistd_h=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +echo "$as_me:$LINENO: result: $gas_cv_decl_getopt_unistd_h" >&5 +echo "${ECHO_T}$gas_cv_decl_getopt_unistd_h" >&6 +if test $gas_cv_decl_getopt_unistd_h = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_DECL_GETOPT 1 +_ACEOF + +fi + + +echo "$as_me:$LINENO: checking whether declaration is required for environ" >&5 +echo $ECHO_N "checking whether declaration is required for environ... $ECHO_C" >&6 +if test "${gas_cv_decl_needed_environ+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$gas_test_headers +int +main () +{ + +typedef char **f; +f x; +x = (f) environ; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gas_cv_decl_needed_environ=no +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +gas_cv_decl_needed_environ=yes +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $gas_cv_decl_needed_environ" >&5 +echo "${ECHO_T}$gas_cv_decl_needed_environ" >&6 +if test $gas_cv_decl_needed_environ = yes; then + +cat >>confdefs.h <<\_ACEOF +#define NEED_DECLARATION_ENVIRON 1 +_ACEOF + +fi + + +echo "$as_me:$LINENO: checking whether declaration is required for ffs" >&5 +echo $ECHO_N "checking whether declaration is required for ffs... $ECHO_C" >&6 +if test "${gas_cv_decl_needed_ffs+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$gas_test_headers +int +main () +{ + +typedef int (*f)(int); +f x; +x = (f) ffs; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gas_cv_decl_needed_ffs=no +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +gas_cv_decl_needed_ffs=yes +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $gas_cv_decl_needed_ffs" >&5 +echo "${ECHO_T}$gas_cv_decl_needed_ffs" >&6 +if test $gas_cv_decl_needed_ffs = yes; then + +cat >>confdefs.h <<\_ACEOF +#define NEED_DECLARATION_FFS 1 +_ACEOF + +fi + + +echo "$as_me:$LINENO: checking whether declaration is required for free" >&5 +echo $ECHO_N "checking whether declaration is required for free... $ECHO_C" >&6 +if test "${gas_cv_decl_needed_free+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$gas_test_headers +int +main () +{ + +typedef void (*f)(); +f x; +x = (f) free; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gas_cv_decl_needed_free=no +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +gas_cv_decl_needed_free=yes +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $gas_cv_decl_needed_free" >&5 +echo "${ECHO_T}$gas_cv_decl_needed_free" >&6 +if test $gas_cv_decl_needed_free = yes; then + +cat >>confdefs.h <<\_ACEOF +#define NEED_DECLARATION_FREE 1 +_ACEOF + +fi + + +echo "$as_me:$LINENO: checking whether declaration is required for malloc" >&5 +echo $ECHO_N "checking whether declaration is required for malloc... $ECHO_C" >&6 +if test "${gas_cv_decl_needed_malloc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$gas_test_headers +int +main () +{ + +typedef char *(*f)(); +f x; +x = (f) malloc; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gas_cv_decl_needed_malloc=no +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +gas_cv_decl_needed_malloc=yes +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $gas_cv_decl_needed_malloc" >&5 +echo "${ECHO_T}$gas_cv_decl_needed_malloc" >&6 +if test $gas_cv_decl_needed_malloc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define NEED_DECLARATION_MALLOC 1 +_ACEOF + +fi + + +echo "$as_me:$LINENO: checking whether declaration is required for sbrk" >&5 +echo $ECHO_N "checking whether declaration is required for sbrk... $ECHO_C" >&6 +if test "${gas_cv_decl_needed_sbrk+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$gas_test_headers +int +main () +{ + +typedef char *(*f)(); +f x; +x = (f) sbrk; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gas_cv_decl_needed_sbrk=no +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +gas_cv_decl_needed_sbrk=yes +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $gas_cv_decl_needed_sbrk" >&5 +echo "${ECHO_T}$gas_cv_decl_needed_sbrk" >&6 +if test $gas_cv_decl_needed_sbrk = yes; then + +cat >>confdefs.h <<\_ACEOF +#define NEED_DECLARATION_SBRK 1 +_ACEOF + +fi + + +echo "$as_me:$LINENO: checking whether declaration is required for strstr" >&5 +echo $ECHO_N "checking whether declaration is required for strstr... $ECHO_C" >&6 +if test "${gas_cv_decl_needed_strstr+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$gas_test_headers +int +main () +{ + +typedef char *(*f)(); +f x; +x = (f) strstr; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gas_cv_decl_needed_strstr=no +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +gas_cv_decl_needed_strstr=yes +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $gas_cv_decl_needed_strstr" >&5 +echo "${ECHO_T}$gas_cv_decl_needed_strstr" >&6 +if test $gas_cv_decl_needed_strstr = yes; then + +cat >>confdefs.h <<\_ACEOF +#define NEED_DECLARATION_STRSTR 1 +_ACEOF + +fi + + +echo "$as_me:$LINENO: checking whether vsnprintf is declared" >&5 +echo $ECHO_N "checking whether vsnprintf is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_vsnprintf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef vsnprintf + char *p = (char *) vsnprintf; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_vsnprintf=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_vsnprintf=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_vsnprintf" >&5 +echo "${ECHO_T}$ac_cv_have_decl_vsnprintf" >&6 +if test $ac_cv_have_decl_vsnprintf = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_VSNPRINTF 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_VSNPRINTF 0 +_ACEOF + + +fi + + + + + + + ac_config_files="$ac_config_files Makefile doc/Makefile po/Makefile.in:po/Make-in" @@ -11560,7 +11817,6 @@ s,@AUTOCONF@,$AUTOCONF,;t t s,@AUTOMAKE@,$AUTOMAKE,;t t s,@AUTOHEADER@,$AUTOHEADER,;t t s,@MAKEINFO@,$MAKEINFO,;t t -s,@AMTAR@,$AMTAR,;t t s,@install_sh@,$install_sh,;t t s,@STRIP@,$STRIP,;t t s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t @@ -11569,6 +11825,9 @@ s,@mkdir_p@,$mkdir_p,;t t s,@AWK@,$AWK,;t t s,@SET_MAKE@,$SET_MAKE,;t t s,@am__leading_dot@,$am__leading_dot,;t t +s,@AMTAR@,$AMTAR,;t t +s,@am__tar@,$am__tar,;t t +s,@am__untar@,$am__untar,;t t s,@DEPDIR@,$DEPDIR,;t t s,@am__include@,$am__include,;t t s,@am__quote@,$am__quote,;t t @@ -11583,6 +11842,7 @@ s,@RANLIB@,$RANLIB,;t t s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t s,@LIBTOOL@,$LIBTOOL,;t t s,@WARN_CFLAGS@,$WARN_CFLAGS,;t t +s,@NO_WERROR@,$NO_WERROR,;t t s,@GDBINIT@,$GDBINIT,;t t s,@cgen_cpu_prefix@,$cgen_cpu_prefix,;t t s,@extra_objects@,$extra_objects,;t t @@ -11626,6 +11886,9 @@ s,@MAINTAINER_MODE_TRUE@,$MAINTAINER_MODE_TRUE,;t t s,@MAINTAINER_MODE_FALSE@,$MAINTAINER_MODE_FALSE,;t t s,@MAINT@,$MAINT,;t t s,@LIBM@,$LIBM,;t t +s,@datarootdir@,$datarootdir,;t t +s,@docdir@,$docdir,;t t +s,@htmldir@,$htmldir,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF @@ -11794,6 +12057,11 @@ esac *) ac_INSTALL=$ac_top_builddir$INSTALL ;; esac + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ @@ -11832,12 +12100,6 @@ echo "$as_me: error: cannot find input file: $f" >&2;} fi;; esac done` || { (exit 1); exit 1; } - - if test x"$ac_file" != x-; then - { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - rm -f "$ac_file" - fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub @@ -12251,27 +12513,21 @@ echo X"$mf" | else continue fi - grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue - # Extract the definition of DEP_FILES from the Makefile without - # running `make'. + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` - test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" - # We invoke sed twice because it is the simplest approach to - # changing $(DEPDIR) to its actual value in the expansion. - for file in `sed -n ' - /^DEP_FILES = .*\\\\$/ { - s/^DEP_FILES = // - :loop - s/\\\\$// - p - n - /\\\\$/ b loop - p - } - /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue diff --git a/contrib/binutils/gas/configure.in b/contrib/binutils/gas/configure.in index f7d0acbcae7..fe69a51c925 100644 --- a/contrib/binutils/gas/configure.in +++ b/contrib/binutils/gas/configure.in @@ -22,16 +22,8 @@ AM_INIT_AUTOMAKE(gas, ${BFD_VERSION}) AM_PROG_LIBTOOL -user_bfd_gas= -AC_ARG_ENABLE(bfd-assembler, -[ --enable-bfd-assembler use BFD back end for writing object files], -[case "${enableval}" in - yes) need_bfd=yes user_bfd_gas=yes ;; - no) user_bfd_gas=no ;; - *) AC_MSG_ERROR(bad value ${enableval} given for bfd-assembler option) ;; -esac])dnl AC_ARG_ENABLE(targets, -[ targets alternative target configurations besides the primary], +[ --enable-targets alternative target configurations besides the primary], [case "${enableval}" in yes | "") AC_ERROR(enable-targets option must specify target names or 'all') ;; @@ -48,26 +40,7 @@ esac])dnl using_cgen=no -build_warnings="-W -Wall -Wstrict-prototypes -Wmissing-prototypes" -AC_ARG_ENABLE(build-warnings, -[ --enable-build-warnings Enable build-time compiler warnings if gcc is used], -[case "${enableval}" in - yes) ;; - no) build_warnings="-w";; - ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"` - build_warnings="${build_warnings} ${t}";; - *,) t=`echo "${enableval}" | sed -e "s/,/ /g"` - build_warnings="${t} ${build_warnings}";; - *) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;; -esac -if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then - echo "Setting warning flags = $build_warnings" 6>&1 -fi])dnl -WARN_CFLAGS="" -if test "x${build_warnings}" != x -a "x$GCC" = xyes ; then - WARN_CFLAGS="${build_warnings}" -fi -AC_SUBST(WARN_CFLAGS) +AM_BINUTILS_WARNINGS # Generate a header file AM_CONFIG_HEADER(config.h:config.in) @@ -86,6 +59,9 @@ case "${host}" in esac AC_SUBST(GDBINIT) +#We need this for the host. BOUT header is in host order. +AC_C_BIGENDIAN + te_file=generic # Makefile target for installing gas in $(tooldir)/bin. @@ -114,59 +90,14 @@ emulations="" for this_target in $target $canon_targets ; do -changequote(,)dnl - eval `echo $this_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/cpu=\1 vendor=\2 os=\3/'` -changequote([,])dnl + targ=${this_target} + . ${srcdir}/configure.tgt - # check for architecture variants - arch= - endian= - case ${cpu} in - am33_2.0) cpu_type=mn10300 endian=little ;; - alpha*) cpu_type=alpha ;; - arm*b|xscale*b|strongarm*b) cpu_type=arm endian=big ;; - arm*|xscale*|strongarm*) cpu_type=arm endian=little ;; - c4x*) cpu_type=tic4x ;; - hppa*) cpu_type=hppa ;; -changequote(,)dnl - i[3-7]86) cpu_type=i386 arch=i386;; - x86_64) cpu_type=i386 arch=x86_64;; - ia64) cpu_type=ia64 ;; - ip2k) cpu_type=ip2k endian=big ;; - iq2000) cpu_type=iq2000 endian=big ;; - m6811|m6812|m68hc12) cpu_type=m68hc11 ;; - m680[012346]0) cpu_type=m68k ;; -changequote([,])dnl - m68008) cpu_type=m68k ;; - m683??) cpu_type=m68k ;; - m5200) cpu_type=m68k ;; - m8*) cpu_type=m88k ;; - mips*el) cpu_type=mips endian=little ;; - mips*) cpu_type=mips endian=big ;; - or32*) cpu_type=or32 endian=big ;; - pjl*) cpu_type=pj endian=little ;; - pj*) cpu_type=pj endian=big ;; - powerpc*le*) cpu_type=ppc endian=little ;; - powerpc*) cpu_type=ppc endian=big ;; - rs6000*) cpu_type=ppc ;; - s390x*) cpu_type=s390 arch=s390x ;; - s390*) cpu_type=s390 arch=s390 ;; - sh5*) cpu_type=sh64 endian=big ;; - sh5le*) cpu_type=sh64 endian=little ;; - sh64*) cpu_type=sh64 endian=big ;; - sh64le*) cpu_type=sh64 endian=little ;; - sh*le) cpu_type=sh endian=little ;; - sh*) cpu_type=sh endian=big ;; - sparclite*) cpu_type=sparc arch=sparclite ;; - sparclet*) cpu_type=sparc arch=sparclet ;; - sparc64*) cpu_type=sparc arch=v9-64 ;; - sparc86x*) cpu_type=sparc arch=sparc86x ;; - sparc*) cpu_type=sparc arch=sparclite ;; # ??? See tc-sparc.c. - v850*) cpu_type=v850 ;; - xtensa*) cpu_type=xtensa arch=xtensa ;; - m32r) cpu_type=m32r target_cpu=m32r endian=big ;; - m32rle) cpu_type=m32r target_cpu=m32r endian=little ;; - *) cpu_type=${cpu} ;; + case ${target_cpu} in + crisv32) + AC_DEFINE_UNQUOTED(DEFAULT_CRIS_ARCH, $arch, + [Default CRIS architecture.]) + ;; esac if test ${this_target} = $target ; then @@ -175,354 +106,53 @@ changequote([,])dnl continue fi - generic_target=${cpu_type}-$vendor-$os - dev=no - bfd_gas=no - em=generic - - # assign object format + generic_target=${cpu_type}-${target_vendor}-${target_os} case ${generic_target} in - a29k-*-coff) fmt=coff ;; - a29k-amd-udi) fmt=coff ;; - a29k-amd-ebmon) fmt=coff ;; - a29k-nyu-sym1) fmt=coff ;; - a29k-*-rtems*) fmt=coff ;; - a29k-*-vxworks*) fmt=coff ;; + i386-*-sco3.2v5*) + if test ${this_target} = $target; then + AC_DEFINE(SCO_ELF, 1, [Define if defaulting to ELF on SCO 5.]) + fi + ;; - alpha*-*-*vms*) fmt=evax ;; - alpha*-*-netware*) fmt=ecoff ;; - alpha*-*-osf*) fmt=ecoff ;; - alpha*-*-linuxecoff*) fmt=ecoff ;; - alpha*-*-linux-gnu*) fmt=elf em=linux ;; - alpha*-*-netbsd*) fmt=elf em=nbsd ;; - alpha*-*-openbsd*) fmt=elf em=obsd ;; - - # cpu_type for am33_2.0 is set to mn10300 - mn10300-*-linux*) fmt=elf bfd_gas=yes em=linux ;; - - arc-*-elf*) fmt=elf ;; - - arm-*-aout) fmt=aout ;; - arm-*-coff | thumb-*-coff) fmt=coff ;; - arm-*-rtems* | thumb-*-rtems*) fmt=elf ;; - arm-*-elf | thumb-*-elf) fmt=elf ;; - arm-*-kaos*) fmt=elf ;; - arm*-*-conix*) fmt=elf ;; - arm-*-linux*aout*) fmt=aout em=linux ;; - arm*-*-linux-gnu*) fmt=elf em=linux ;; - arm*-*-uclinux*) fmt=elf em=linux ;; - arm-*-netbsdelf*) fmt=elf em=nbsd ;; - arm-*-*n*bsd*) fmt=aout em=nbsd ;; - arm-**-nto*) fmt=elf ;; - arm-*-oabi | thumb-*-oabi) fmt=elf ;; - arm-epoc-pe | thumb-epoc-pe) fmt=coff em=epoc-pe ;; - arm-wince-pe | arm-*-wince) fmt=coff em=wince-pe ;; - arm-*-pe | thumb-*-pe) fmt=coff em=pe ;; - arm-*-riscix*) fmt=aout em=riscix ;; - - avr-*-*) fmt=elf ;; - - cris-*-linux-gnu*) fmt=multi bfd_gas=yes em=linux ;; - cris-*-*) fmt=multi bfd_gas=yes ;; - - d10v-*-*) fmt=elf ;; - d30v-*-*) fmt=elf ;; - dlx-*-*) fmt=elf ;; - - fr30-*-*) fmt=elf ;; - frv-*-*linux*) fmt=elf em=linux;; - frv-*-*) fmt=elf ;; - - hppa-*-linux*) case ${cpu} in - hppa*64*) fmt=elf em=hppalinux64;; - hppa*) fmt=elf em=linux;; - esac ;; - hppa-*-*elf*) fmt=elf em=hppa ;; - hppa-*-lites*) fmt=elf em=hppa ;; - hppa-*-netbsd*) fmt=elf em=nbsd ;; - hppa-*-openbsd*) fmt=elf em=hppa ;; - hppa-*-osf*) fmt=som em=hppa ;; - hppa-*-rtems*) fmt=elf em=hppa ;; - hppa-*-hpux11*) case ${cpu} in - hppa*64*) fmt=elf em=hppa64 ;; - hppa*) fmt=som em=hppa ;; - esac ;; - hppa-*-hpux*) fmt=som em=hppa ;; - hppa-*-mpeix*) fmt=som em=hppa ;; - hppa-*-bsd*) fmt=som em=hppa ;; - hppa-*-hiux*) fmt=som em=hppa ;; - - h8300-*-rtems*) fmt=coff ;; - h8300-*-coff) fmt=coff ;; - h8300-*-elf) fmt=elf ;; - h8500-*-rtems*) fmt=coff ;; - h8500-*-coff) fmt=coff ;; - - i370-*-elf* | i370-*-linux*) fmt=elf ;; - i386-ibm-aix*) fmt=coff em=i386aix ;; - i386-sequent-bsd*) fmt=aout em=dynix ;; - i386-*-beospe*) fmt=coff em=pe ;; - i386-*-beos*) fmt=elf ;; - i386-*-coff) fmt=coff ;; - i386-*-elf) fmt=elf ;; - i386-*-kaos*) fmt=elf ;; - i386-*-bsd*) fmt=aout em=386bsd ;; - i386-*-netbsd0.8) fmt=aout em=386bsd ;; - i386-*-netbsdpe*) fmt=coff em=pe ;; - i386-*-netbsd*-gnu* | \ - i386-*-knetbsd*-gnu | \ - i386-*-netbsdelf*) fmt=elf em=nbsd ;; - i386-*-*n*bsd*) case ${cpu} in - x86_64) fmt=elf em=nbsd ;; - *) fmt=aout em=nbsd ;; - esac ;; - i386-*-linux*aout*) fmt=aout em=linux ;; - i386-*-linux*oldld) fmt=aout em=linux ;; - i386-*-linux*coff*) fmt=coff em=linux ;; - i386-*-linux-gnu*) fmt=elf em=linux ;; - x86_64-*-linux-gnu*) fmt=elf em=linux ;; - i386-*-lynxos*) fmt=coff em=lynx ;; -changequote(,)dnl - i386-*-sysv[45]*) fmt=elf ;; - i386-*-solaris*) fmt=elf ;; - i386-*-freebsdaout*) fmt=aout em=386bsd ;; - i386-*-freebsd[12].*) fmt=aout em=386bsd ;; - i386-*-freebsd[12]) fmt=aout em=386bsd ;; -changequote([,])dnl - i386-*-freebsd* | i386-*-kfreebsd*-gnu) - fmt=elf em=freebsd ;; - i386-*-sysv*) fmt=coff ;; - i386-*-sco3.2v5*coff) fmt=coff ;; - i386-*-isc*) fmt=coff ;; - i386-*-sco3.2v5*) fmt=elf - if test ${this_target} = $target; then - AC_DEFINE(SCO_ELF, 1, [Define if defaulting to ELF on SCO 5.]) - fi ;; - i386-*-sco3.2*) fmt=coff ;; - i386-*-vsta) fmt=aout ;; i386-*-msdosdjgpp* \ | i386-*-go32* \ - | i386-go32-rtems*) fmt=coff em=go32 - AC_DEFINE(STRICTCOFF, 1, [Using strict COFF?]) ;; - i386-*-rtemself*) fmt=elf ;; - i386-*-rtemscoff*) fmt=coff ;; - i386-*-rtems*) fmt=elf ;; - i386-*-gnu*) fmt=elf ;; - i386-*-mach*) fmt=aout em=mach ;; - i386-*-msdos*) fmt=aout ;; - i386-*-moss*) fmt=elf ;; - i386-*-pe) fmt=coff em=pe ;; - i386-*-cygwin*) fmt=coff em=pe ;; - i386-*-interix*) fmt=coff em=interix ;; - i386-*-mingw32*) fmt=coff em=pe ;; - i386-*-nto-qnx*) fmt=elf ;; - i386-*-*nt*) fmt=coff em=pe ;; - i386-*-chaos) fmt=elf ;; + | i386-go32-rtems*) + AC_DEFINE(STRICTCOFF, 1, [Using strict COFF?]) + ;; - i860-*-*) fmt=elf endian=little - AC_MSG_WARN(GAS support for ${generic_target} is preliminary and a work in progress) ;; - i960-*-bout) fmt=bout ;; - i960-*-coff) fmt=coff em=ic960 ;; - i960-*-rtems*) fmt=coff em=ic960 ;; - i960-*-nindy*) fmt=bout ;; - i960-*-vxworks5.0) fmt=bout ;; - i960-*-vxworks5.*) fmt=coff em=ic960 ;; - i960-*-vxworks*) fmt=bout ;; - i960-*-elf*) fmt=elf ;; + i860-*-*) + AC_MSG_WARN(GAS support for ${generic_target} is preliminary and a work in progress) + ;; - ia64-*-elf*) fmt=elf ;; - ia64-*-aix*) fmt=elf em=ia64aix ;; - ia64-*-linux-gnu*) fmt=elf em=linux ;; - ia64-*-hpux*) fmt=elf em=hpux ;; - ia64-*-netbsd*) fmt=elf em=nbsd ;; - - ip2k-*-*) fmt=elf ;; - - iq2000-*-elf) fmt=elf bfd_gas=yes ;; - - m32r-*-elf*) fmt=elf ;; - m32r-*-linux*) fmt=elf em=linux;; - - m68hc11-*-* | m6811-*-*) fmt=elf ;; - m68hc12-*-* | m6812-*-*) fmt=elf ;; - - m68k-*-vxworks*) fmt=aout em=sun3 ;; - m68k-ericsson-ose) fmt=aout em=sun3 ;; - m68k-*-sunos*) fmt=aout em=sun3 ;; - m68k-motorola-sysv*) fmt=coff em=delta ;; - m68k-bull-sysv3*) fmt=coff em=dpx2 ;; - m68k-apollo-*) fmt=coff em=apollo ;; - m68k-*-elf*) fmt=elf ;; - m68k-*-sysv4*) fmt=elf em=svr4 ;; - m68k-*-sysv*) fmt=coff ;; - m68k-*-coff | m68k-*-rtemscoff*) fmt=coff ;; - m68k-*-rtems*) fmt=elf ;; - m68k-*-hpux*) fmt=hp300 em=hp300 ;; - m68k-*-linux*aout*) fmt=aout em=linux ;; - m68k-*-linux-gnu*) fmt=elf em=linux ;; - m68k-*-uclinux*) fmt=elf ;; - m68k-*-gnu*) fmt=elf ;; - m68k-*-lynxos*) fmt=coff em=lynx ;; - m68k-*-netbsdelf*) fmt=elf em=nbsd ;; - m68k-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes ;; - m68k-*-openbsd*) fmt=aout em=nbsd bfd_gas=yes ;; - m68k-apple-aux*) fmt=coff em=aux ;; - m68k-*-psos*) fmt=elf em=psos;; - - m88k-motorola-sysv3*) fmt=coff em=delt88 ;; - m88k-*-coff*) fmt=coff ;; - - mcore-*-elf) fmt=elf ;; - mcore-*-pe) fmt=coff em=pe bfd_gas=yes ;; - - # don't change em like *-*-bsd does - mips-dec-openbsd*) fmt=elf endian=little ;; - mips-sony-bsd*) fmt=ecoff ;; + mips-sony-bsd*) + ;; mips-*-bsd*) - AC_MSG_ERROR(Unknown vendor for mips-bsd configuration.) ;; - mips-*-ultrix*) fmt=ecoff endian=little ;; - mips-*-osf*) fmt=ecoff endian=little ;; - mips-*-ecoff*) fmt=ecoff ;; - mips-*-pe*) fmt=coff endian=little em=pe ;; - mips-*-irix6*) fmt=elf em=irix ;; - mips-*-irix5*) fmt=elf em=irix ;; - mips-*-irix*) fmt=ecoff em=irix ;; - mips-*-lnews*) fmt=ecoff em=lnews ;; - mips-*-riscos*) fmt=ecoff ;; - mips*-*-linux*) fmt=elf em=tmips ;; - mips-*-sysv4*MP* | mips-*-gnu*) fmt=elf em=tmips ;; - mips-*-sysv*) fmt=ecoff ;; - mips-*-elf* | mips-*-rtems*) fmt=elf ;; - mips-*-netbsd*) fmt=elf ;; - mips-*-openbsd*) fmt=elf ;; + AC_MSG_ERROR(Unknown vendor for mips-bsd configuration.) + ;; - mmix-*-*) fmt=elf ;; - mn10200-*-*) fmt=elf ;; - mn10300-*-*) fmt=elf ;; - msp430-*-*) fmt=elf ;; - openrisc-*-*) fmt=elf ;; - or32-*-rtems*) fmt=elf ;; - or32-*-coff) fmt=coff ;; - or32-*-elf) fmt=elf ;; - pj*) fmt=elf ;; - - ppc-*-pe | ppc-*-cygwin*) fmt=coff em=pe ;; - ppc-*-winnt*) fmt=coff em=pe ;; -changequote(,)dnl - ppc-*-aix5.[01]) fmt=coff em=aix5 ;; -changequote([,])dnl - ppc-*-aix5.*) fmt=coff em=aix5 - AC_DEFINE(AIX_WEAK_SUPPORT, 1, + ppc-*-aix5.*) + AC_DEFINE(AIX_WEAK_SUPPORT, 1, [Define if using AIX 5.2 value for C_WEAKEXT.]) - ;; - ppc-*-aix*) fmt=coff ;; - ppc-*-beos*) fmt=coff ;; - ppc-*-*n*bsd* | ppc-*-elf*) fmt=elf ;; - ppc-*-eabi* | ppc-*-sysv4*) fmt=elf ;; - ppc-*-linux-gnu*) fmt=elf em=linux - case "$endian" in - big) ;; - *) AC_MSG_ERROR(GNU/Linux must be configured big endian) ;; - esac ;; - ppc-*-solaris*) fmt=elf - if test ${this_target} = $target; then - AC_DEFINE(TARGET_SOLARIS_COMMENT, 1, - [Define if default target is PowerPC Solaris.]) - fi - if test x${endian} = xbig; then - AC_MSG_ERROR(Solaris must be configured little endian) - fi ;; - ppc-*-rtems*) fmt=elf ;; - ppc-*-macos* | ppc-*-mpw*) fmt=coff em=macos ;; - ppc-*-netware*) fmt=elf em=ppcnw ;; - ppc-**-nto*) fmt=elf ;; - ppc-*-kaos*) fmt=elf ;; + ;; + ppc-*-linux-*) + case "$endian" in + big) ;; + *) AC_MSG_ERROR(GNU/Linux must be configured big endian) ;; + esac + ;; + ppc-*-solaris*) + if test ${this_target} = $target; then + AC_DEFINE(TARGET_SOLARIS_COMMENT, 1, + [Define if default target is PowerPC Solaris.]) + fi + if test x${endian} = xbig; then + AC_MSG_ERROR(Solaris must be configured little endian) + fi + ;; - s390x-*-linux-gnu*) fmt=elf em=linux ;; - s390-*-linux-gnu*) fmt=elf em=linux ;; - - sh*-*-linux*) fmt=elf em=linux - case ${cpu} in - sh*eb) endian=big ;; - *) endian=little ;; - esac ;; - sh5*-*-netbsd*) fmt=elf em=nbsd ;; - sh64*-*-netbsd*) fmt=elf em=nbsd ;; - sh*-*-netbsdelf*) fmt=elf em=nbsd ;; - sh-*-elf*) fmt=elf ;; - sh-*-coff*) fmt=coff ;; - sh-*-nto*) fmt=elf ;; - sh-*-pe*) fmt=coff em=pe bfd_gas=yes endian=little ;; - sh-*-rtemscoff*) fmt=coff ;; - sh-*-rtems*) fmt=elf ;; - sh-*-kaos*) fmt=elf ;; - shle*-*-kaos*) fmt=elf ;; - sh64-*-elf*) fmt=elf ;; - - ns32k-pc532-mach*) fmt=aout em=pc532mach ;; - ns32k-pc532-ux*) fmt=aout em=pc532mach ;; - ns32k-pc532-lites*) fmt=aout em=nbsd532 ;; - ns32k-*-*n*bsd*) fmt=aout em=nbsd532 ;; - - sparc-*-rtemsaout*) fmt=aout ;; - sparc-*-rtemself*) fmt=elf ;; - sparc-*-rtems*) fmt=elf ;; - sparc-*-sunos4*) fmt=aout em=sun3 ;; - sparc-*-aout | sparc*-*-vxworks*) fmt=aout em=sparcaout ;; - sparc-*-coff) fmt=coff ;; - sparc-*-linux*aout*) fmt=aout em=linux ;; - sparc-*-linux-gnu*) fmt=elf em=linux ;; - sparc-*-lynxos*) fmt=coff em=lynx ;; - sparc-fujitsu-none) fmt=aout ;; - sparc-*-elf) fmt=elf ;; - sparc-*-sysv4*) fmt=elf ;; - sparc-*-solaris*) fmt=elf ;; - sparc-*-netbsdelf*) fmt=elf em=nbsd ;; - sparc-*-*n*bsd*) case ${cpu} in - sparc64) fmt=elf em=nbsd ;; - *) fmt=aout em=nbsd ;; - esac ;; - strongarm-*-coff) fmt=coff ;; - strongarm-*-elf) fmt=elf ;; - strongarm-*-kaos*) fmt=elf ;; - xscale-*-coff) fmt=coff ;; - xscale-*-elf) fmt=elf ;; - - tic30-*-*aout*) fmt=aout bfd_gas=yes ;; - tic30-*-*coff*) fmt=coff bfd_gas=yes ;; - tic4x-*-* | c4x-*-*) fmt=coff bfd_gas=yes ;; - tic54x-*-* | c54x*-*-*) fmt=coff bfd_gas=yes need_libm=yes;; - tic80-*-*) fmt=coff ;; - - v850-*-*) fmt=elf ;; - v850e-*-*) fmt=elf ;; - v850ea-*-*) fmt=elf ;; - - vax-*-netbsdelf*) fmt=elf em=nbsd ;; - vax-*-netbsd*) fmt=aout em=nbsd ;; - vax-*-bsd* | vax-*-ultrix*) fmt=aout ;; - vax-*-linux-gnu*) fmt=elf em=linux bfd_gas=yes ;; - vax-*-vms) fmt=vms ;; - - w65-*-*) fmt=coff ;; - - xstormy16-*-*) fmt=elf ;; - - xtensa-*-*) fmt=elf ;; - - z8k-*-coff | z8k-*-sim) fmt=coff ;; - - *-*-aout | *-*-scout) fmt=aout ;; - *-*-freebsd* | *-*-kfreebsd*-gnu) fmt=elf em=freebsd ;; - *-*-nindy*) fmt=bout ;; - *-*-bsd*) fmt=aout em=sun3 ;; - *-*-generic) fmt=generic ;; - *-*-xray | *-*-hms) fmt=coff ;; - *-*-sim) fmt=coff ;; - *-*-elf | *-*-sysv4* | *-*-solaris*) fmt=elf dev=yes ;; - *-*-aros*) fmt=elf em=linux bfd_gas=yes ;; - *-*-vxworks | *-*-windiss) fmt=elf ;; - *-*-netware) fmt=elf ;; + sh*-*-symbianelf*) + AC_DEFINE(TARGET_SYMBIAN, 1, [Define if target is Symbian OS.]) + ;; esac if test ${this_target} = $target ; then @@ -538,13 +168,6 @@ changequote([,])dnl fi fi - case ${cpu_type}-${fmt} in - alpha*-* | arm-* | i386-* | ia64*-* | mips-* | ns32k-* \ - | pdp11-* | ppc-* | sparc-* | strongarm-* | xscale-* \ - | *-elf | *-ecoff | *-som) - bfd_gas=yes ;; - esac - # Other random stuff. case ${cpu_type} in @@ -615,6 +238,9 @@ changequote([,])dnl mips*-linux*) mips_default_abi=O32_ABI ;; + mips64*-openbsd*) + mips_default_abi=N64_ABI + ;; *) mips_default_abi=NO_ABI ;; @@ -643,19 +269,31 @@ changequote([,])dnl *opcodes*) shared_opcodes=true ;; *) shared_opcodes=false ;; esac - if test "${shared_opcodes}" = "true"; then - # A shared libopcodes must be linked against libbfd. - need_bfd=yes - fi ;; esac # Any other special object files needed ? case ${cpu_type} in + + bfin) + echo ${extra_objects} | grep -s "bfin-parse.o" + if test $? -ne 0 ; then + extra_objects="$extra_objects bfin-parse.o" + fi + + echo ${extra_objects} | grep -s "bfin-lex.o" + if test $? -ne 0 ; then + extra_objects="$extra_objects bfin-lex.o" + fi + ;; + fr30 | ip2k | iq2000 | m32r | openrisc) using_cgen=yes ;; + m32c) + using_cgen=yes + ;; frv) using_cgen=yes ;; @@ -683,6 +321,10 @@ changequote([,])dnl fi ;; + mt) + using_cgen=yes + ;; + i386 | s390 | sparc) if test $this_target = $target ; then AC_DEFINE_UNQUOTED(DEFAULT_ARCH, "${arch}", [Default architecture.]) @@ -693,6 +335,10 @@ changequote([,])dnl using_cgen=yes ;; + xc16x) + using_cgen=yes + ;; + xtensa) echo ${extra_objects} | grep -s "xtensa-relax.o" if test $? -ne 0 ; then @@ -714,17 +360,8 @@ changequote([,])dnl # See if we really can support this configuration with the emulation code. if test $this_target = $target ; then - primary_bfd_gas=$bfd_gas obj_format=$fmt te_file=$em - - if test $bfd_gas = no ; then - # Can't support other configurations this way. - break - fi - elif test $bfd_gas = no ; then - # Can't support this configuration. - break fi # From target name and format, produce a list of supported emulations. @@ -818,27 +455,6 @@ if test ! -r ${srcdir}/config/obj-${obj_format}.c; then AC_MSG_ERROR(GAS does not have support for object file format ${obj_format}) fi -case ${user_bfd_gas}-${primary_bfd_gas} in - yes-yes | no-no) - # We didn't override user's choice. - ;; - no-yes) - AC_MSG_WARN(Use of BFD is required for ${target}; overriding config options.) - ;; - no-preferred) - primary_bfd_gas=no - ;; - *-preferred) - primary_bfd_gas=yes - ;; - yes-*) - primary_bfd_gas=yes - ;; - -*) - # User specified nothing. - ;; -esac - # Some COFF configurations want these random other flags set. case ${obj_format} in coff) @@ -851,8 +467,8 @@ case ${obj_format} in esac # Getting this done right is going to be a bitch. Each configuration specified -# with --enable-targets=... should be checked for environment, format, cpu, and -# bfd_gas setting. +# with --enable-targets=... should be checked for environment, format, cpu +# setting. # # For each configuration, the necessary object file support code must be linked # in. This might be only one, it might be up to four. The necessary emulation @@ -895,10 +511,8 @@ if test `set . $formats ; shift ; echo $#` -gt 1 ; then ecoff) AC_DEFINE(OBJ_MAYBE_ECOFF, 1, [ECOFF support?]) ;; elf) AC_DEFINE(OBJ_MAYBE_ELF, 1, [ELF support?]) ;; generic) AC_DEFINE(OBJ_MAYBE_GENERIC, 1, [generic support?]) ;; - hp300) AC_DEFINE(OBJ_MAYBE_HP300, 1, [HP300 support?]) ;; ieee) AC_DEFINE(OBJ_MAYBE_IEEE, 1, [IEEE support?]) ;; som) AC_DEFINE(OBJ_MAYBE_SOM, 1, [SOM support?]) ;; - vms) AC_DEFINE(OBJ_MAYBE_VMS, 1, [VMS support?]) ;; esac extra_objects="$extra_objects obj-$fmt.o" done @@ -920,12 +534,6 @@ AC_DEFINE_UNQUOTED(EMULATIONS, $EMULATIONS, [Supported emulations.]) AC_DEFINE_UNQUOTED(DEFAULT_EMULATION, "$DEFAULT_EMULATION", [Default emulation.]) -case ${primary_bfd_gas}-${target_cpu_type}-${obj_format} in - yes-*-coff) need_bfd=yes ;; - no-*-coff) need_bfd=yes - AC_DEFINE(MANY_SEGMENTS, 1, [old COFF support?]) ;; -esac - reject_dev_configs=yes case ${reject_dev_configs}-${dev} in @@ -941,11 +549,6 @@ AC_SUBST(install_tooldir) AC_SUBST(atof) dnl AC_SUBST(emulation) -case "${primary_bfd_gas}" in - yes) AC_DEFINE(BFD_ASSEMBLER, 1, [Use BFD interface?]) - need_bfd=yes ;; -esac - # do we need the opcodes library? case "${need_opcodes}" in yes) @@ -953,13 +556,9 @@ yes) ;; esac -case "${need_bfd}" in -yes) - BFDLIB=../bfd/libbfd.la - BFDVER_H=../bfd/bfdver.h - ALL_OBJ_DEPS="$ALL_OBJ_DEPS"' ../bfd/bfd.h $(INCDIR)/symcat.h' - ;; -esac +BFDLIB=../bfd/libbfd.la +BFDVER_H=../bfd/bfdver.h +ALL_OBJ_DEPS="$ALL_OBJ_DEPS"' ../bfd/bfd.h $(INCDIR)/symcat.h' AC_SUBST(BFDLIB) AC_SUBST(OPCODES_LIB) @@ -978,7 +577,7 @@ AC_PROG_CC AC_PROG_YACC AM_PROG_LEX -ALL_LINGUAS="fr tr es" +ALL_LINGUAS="fr tr es rw" CY_GNU_GETTEXT AM_MAINTAINER_MODE @@ -1042,11 +641,6 @@ gas_test_headers=" #include #endif " -GAS_CHECK_DECL_NEEDED(strstr, f, char *(*f)(), $gas_test_headers) -GAS_CHECK_DECL_NEEDED(malloc, f, char *(*f)(), $gas_test_headers) -GAS_CHECK_DECL_NEEDED(free, f, void (*f)(), $gas_test_headers) -GAS_CHECK_DECL_NEEDED(sbrk, f, char *(*f)(), $gas_test_headers) -GAS_CHECK_DECL_NEEDED(environ, f, char **f, $gas_test_headers) # Does errno.h declare errno, or do we have to add a separate declaration # for it? @@ -1056,6 +650,30 @@ GAS_CHECK_DECL_NEEDED(errno, f, int f, [ #endif ]) +AC_MSG_CHECKING(for a known getopt prototype in unistd.h) +AC_CACHE_VAL(gas_cv_decl_getopt_unistd_h, +[AC_TRY_COMPILE([#include ], [extern int getopt (int, char *const*, const char *);], +gas_cv_decl_getopt_unistd_h=yes, gas_cv_decl_getopt_unistd_h=no)]) +AC_MSG_RESULT($gas_cv_decl_getopt_unistd_h) +if test $gas_cv_decl_getopt_unistd_h = yes; then + AC_DEFINE([HAVE_DECL_GETOPT], 1, + [Is the prototype for getopt in in the expected format?]) +fi + +GAS_CHECK_DECL_NEEDED(environ, f, char **f, $gas_test_headers) +GAS_CHECK_DECL_NEEDED(ffs, f, int (*f)(int), $gas_test_headers) +GAS_CHECK_DECL_NEEDED(free, f, void (*f)(), $gas_test_headers) +GAS_CHECK_DECL_NEEDED(malloc, f, char *(*f)(), $gas_test_headers) +GAS_CHECK_DECL_NEEDED(sbrk, f, char *(*f)(), $gas_test_headers) +GAS_CHECK_DECL_NEEDED(strstr, f, char *(*f)(), $gas_test_headers) + +AC_CHECK_DECLS([vsnprintf]) + +dnl Required for html and install-html targets. +AC_SUBST(datarootdir) +AC_SUBST(docdir) +AC_SUBST(htmldir) + dnl This must come last. dnl We used to make symlinks to files in the source directory, but now diff --git a/contrib/binutils/gas/debug.c b/contrib/binutils/gas/debug.c index 7d1038736d9..fe2ed8c6536 100644 --- a/contrib/binutils/gas/debug.c +++ b/contrib/binutils/gas/debug.c @@ -16,7 +16,7 @@ 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. */ + the Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* Routines for debug use only. */ diff --git a/contrib/binutils/gas/dep-in.sed b/contrib/binutils/gas/dep-in.sed index 2e2717ccc67..f23c2018fe9 100644 --- a/contrib/binutils/gas/dep-in.sed +++ b/contrib/binutils/gas/dep-in.sed @@ -3,6 +3,7 @@ /\\$/b loop s! \.\./! !g +s! \./! !g s!@INCDIR@!$(INCDIR)!g s!@TOPDIR@/include!$(INCDIR)!g s!@BFDDIR@!$(BFDDIR)!g diff --git a/contrib/binutils/gas/depend.c b/contrib/binutils/gas/depend.c index 127c819180d..4a264aa7038 100644 --- a/contrib/binutils/gas/depend.c +++ b/contrib/binutils/gas/depend.c @@ -1,5 +1,5 @@ /* depend.c - Handle dependency tracking. - Copyright 1997, 1998, 2000, 2001 Free Software Foundation, Inc. + Copyright 1997, 1998, 2000, 2001, 2003 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -15,8 +15,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #include "as.h" diff --git a/contrib/binutils/gas/doc/Makefile.am b/contrib/binutils/gas/doc/Makefile.am index 7f0f805fbc5..d48a9ccb241 100644 --- a/contrib/binutils/gas/doc/Makefile.am +++ b/contrib/binutils/gas/doc/Makefile.am @@ -8,7 +8,7 @@ CONFIG=all # Options to extract the man page from as.texinfo MANCONF = -Dman -TEXI2POD = perl $(top_srcdir)/../etc/texi2pod.pl +TEXI2POD = perl $(BASEDIR)/etc/texi2pod.pl $(AM_MAKEINFOFLAGS) POD2MAN = pod2man --center="GNU Development Tools" \ --release="binutils-$(VERSION)" --section=1 @@ -17,33 +17,35 @@ man_MANS = as.1 info_TEXINFOS = as.texinfo +AM_MAKEINFOFLAGS = -I "$(srcdir)" -I "$(top_srcdir)/../libiberty" +TEXI2DVI = texi2dvi -I "$(srcdir)" -I "$(top_srcdir)/../libiberty" + asconfig.texi: $(CONFIG).texi rm -f asconfig.texi - ln -s $(srcdir)/$(CONFIG).texi ./asconfig.texi >/dev/null 2>&1 \ - || ln $(srcdir)/$(CONFIG).texi ./asconfig.texi >/dev/null 2>&1 \ - || cp $(srcdir)/$(CONFIG).texi ./asconfig.texi + cp $(srcdir)/$(CONFIG).texi ./asconfig.texi + chmod u+w ./asconfig.texi CPU_DOCS = \ - c-a29k.texi \ c-alpha.texi \ c-arc.texi \ c-arm.texi \ + c-bfin.texi \ c-d10v.texi \ c-cris.texi \ c-h8300.texi \ - c-h8500.texi \ c-hppa.texi \ c-i370.texi \ c-i386.texi \ c-i860.texi \ c-i960.texi \ c-ip2k.texi \ + c-m32c.texi \ c-m32r.texi \ c-m68hc11.texi \ c-m68k.texi \ - c-m88k.texi \ c-mips.texi \ c-mmix.texi \ + c-mt.texi \ c-msp430.texi \ c-ns32k.texi \ c-pdp11.texi \ @@ -56,26 +58,46 @@ CPU_DOCS = \ c-vax.texi \ c-v850.texi \ c-xtensa.texi \ + c-z80.texi \ c-z8k.texi -gasver.texi: Makefile +gasver.texi: $(srcdir)/../../bfd/configure rm -f $@ - echo '@set VERSION $(VERSION)' > $@ + eval `grep '^ *VERSION=' $(srcdir)/../../bfd/configure`; \ + echo "@set VERSION $$VERSION" > $@ -as.info: $(srcdir)/as.texinfo asconfig.texi gasver.texi $(CPU_DOCS) -as.dvi: $(srcdir)/as.texinfo asconfig.texi gasver.texi $(CPU_DOCS) +$(srcdir)/as.info as.dvi as.html: $(srcdir)/as.texinfo asconfig.texi gasver.texi $(CPU_DOCS) # We want install to imply install-info as per GNU standards, despite the # cygnus option. install-data-local: install-info +html__strip_dir = `echo $$p | sed -e 's|^.*/||'`; + +install-html: install-html-am + +install-html-am: $(HTMLS) + @$(NORMAL_INSTALL) + test -z "$(htmldir)" || $(mkdir_p) "$(DESTDIR)$(htmldir)" + @list='$(HTMLS)'; for p in $$list; do \ + if test -f "$$p" || test -d "$$p"; then d=""; else d="$(srcdir)/"; fi; \ + f=$(html__strip_dir) \ + if test -d "$$d$$p"; then \ + echo " $(mkdir_p) '$(DESTDIR)$(htmldir)/$$f'"; \ + $(mkdir_p) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \ + echo " $(INSTALL_DATA) '$$d$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \ + $(INSTALL_DATA) "$$d$$p"/* "$(DESTDIR)$(htmldir)/$$f"; \ + else \ + echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(htmldir)/$$f'"; \ + $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(htmldir)/$$f"; \ + fi; \ + done + # This one isn't ready for prime time yet. Not even a little bit. noinst_TEXINFOS = internals.texi -DISTCLEANFILES = asconfig.texi - -MAINTAINERCLEANFILES = gasver.texi +MAINTAINERCLEANFILES = asconfig.texi gasver.texi BASEDIR = $(srcdir)/../.. BFDDIR = $(BASEDIR)/bfd @@ -85,7 +107,7 @@ CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/configure.in # Maintenance # We need it for the taz target in ../../Makefile.in. -info: $(MANS) +info-local: $(MANS) # Build the man page from the texinfo file # The sed command removes the no-adjust Nroff command so that diff --git a/contrib/binutils/gas/doc/Makefile.in b/contrib/binutils/gas/doc/Makefile.in index 0c6a1b0ab98..cd9dad2baaf 100644 --- a/contrib/binutils/gas/doc/Makefile.in +++ b/contrib/binutils/gas/doc/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.8.4 from Makefile.am. +# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. +# 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -40,8 +40,8 @@ subdir = doc DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/../libtool.m4 $(top_srcdir)/../gettext.m4 \ - $(top_srcdir)/configure.in + $(top_srcdir)/../bfd/warning.m4 $(top_srcdir)/../libtool.m4 \ + $(top_srcdir)/../gettext.m4 $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs @@ -50,7 +50,6 @@ CONFIG_CLEAN_FILES = depcomp = am__depfiles_maybe = SOURCES = -DIST_SOURCES = INFO_DEPS = $(srcdir)/as.info TEXINFO_TEX = $(top_srcdir)/../texinfo/texinfo.tex am__TEXINFO_TEX_DIR = $(top_srcdir)/../texinfo @@ -59,11 +58,6 @@ PDFS = as.pdf PSS = as.ps HTMLS = as.html TEXINFOS = as.texinfo -TEXI2DVI = `if test -f $(top_srcdir)/../texinfo/util/texi2dvi; then \ - echo $(top_srcdir)/../texinfo/util/texi2dvi; \ - else \ - echo texi2dvi; \ - fi` TEXI2PDF = $(TEXI2DVI) --pdf --batch MAKEINFOHTML = $(MAKEINFO) --html AM_MAKEINFOHTMLFLAGS = $(AM_MAKEINFOFLAGS) @@ -130,6 +124,7 @@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MKINSTALLDIRS = @MKINSTALLDIRS@ MSGFMT = @MSGFMT@ +NO_WERROR = @NO_WERROR@ OBJEXT = @OBJEXT@ OPCODES_LIB = @OPCODES_LIB@ PACKAGE = @PACKAGE@ @@ -159,6 +154,8 @@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ atof = @atof@ bindir = @bindir@ build = @build@ @@ -168,6 +165,8 @@ build_os = @build_os@ build_vendor = @build_vendor@ cgen_cpu_prefix = @cgen_cpu_prefix@ datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ exec_prefix = @exec_prefix@ extra_objects = @extra_objects@ host = @host@ @@ -175,6 +174,7 @@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ +htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ @@ -206,33 +206,35 @@ CONFIG = all # Options to extract the man page from as.texinfo MANCONF = -Dman -TEXI2POD = perl $(top_srcdir)/../etc/texi2pod.pl +TEXI2POD = perl $(BASEDIR)/etc/texi2pod.pl $(AM_MAKEINFOFLAGS) POD2MAN = pod2man --center="GNU Development Tools" \ --release="binutils-$(VERSION)" --section=1 man_MANS = as.1 info_TEXINFOS = as.texinfo +AM_MAKEINFOFLAGS = -I "$(srcdir)" -I "$(top_srcdir)/../libiberty" +TEXI2DVI = texi2dvi -I "$(srcdir)" -I "$(top_srcdir)/../libiberty" CPU_DOCS = \ - c-a29k.texi \ c-alpha.texi \ c-arc.texi \ c-arm.texi \ + c-bfin.texi \ c-d10v.texi \ c-cris.texi \ c-h8300.texi \ - c-h8500.texi \ c-hppa.texi \ c-i370.texi \ c-i386.texi \ c-i860.texi \ c-i960.texi \ c-ip2k.texi \ + c-m32c.texi \ c-m32r.texi \ c-m68hc11.texi \ c-m68k.texi \ - c-m88k.texi \ c-mips.texi \ c-mmix.texi \ + c-mt.texi \ c-msp430.texi \ c-ns32k.texi \ c-pdp11.texi \ @@ -245,13 +247,14 @@ CPU_DOCS = \ c-vax.texi \ c-v850.texi \ c-xtensa.texi \ + c-z80.texi \ c-z8k.texi +html__strip_dir = `echo $$p | sed -e 's|^.*/||'`; # This one isn't ready for prime time yet. Not even a little bit. noinst_TEXINFOS = internals.texi -DISTCLEANFILES = asconfig.texi -MAINTAINERCLEANFILES = gasver.texi +MAINTAINERCLEANFILES = asconfig.texi gasver.texi BASEDIR = $(srcdir)/../.. BFDDIR = $(BASEDIR)/bfd CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/configure.in @@ -299,16 +302,14 @@ distclean-libtool: -rm -f libtool .texinfo.info: - restore=: && \ - backupdir="$(am__leading_dot)am$$$$" && \ + restore=: && backupdir="$(am__leading_dot)am$$$$" && \ am__cwd=`pwd` && cd $(srcdir) && \ rm -rf $$backupdir && mkdir $$backupdir && \ - for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]; do \ - if test -f $$f; then \ - mv $$f $$backupdir; \ - restore=mv; \ - fi; \ - done; \ + if ($(MAKEINFO) --version) >/dev/null 2>&1; then \ + for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]; do \ + if test -f $$f; then mv $$f $$backupdir; restore=mv; else :; fi; \ + done; \ + else :; fi && \ cd "$$am__cwd"; \ if $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \ -o $@ $<; \ @@ -320,8 +321,7 @@ distclean-libtool: cd $(srcdir) && \ $$restore $$backupdir/* `echo "./$@" | sed 's|[^/]*$$||'`; \ fi; \ - rm -rf $$backupdir; \ - exit $$rc + rm -rf $$backupdir; exit $$rc .texinfo.dvi: TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ @@ -334,18 +334,28 @@ distclean-libtool: $(TEXI2PDF) $< .texinfo.html: - $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \ - -o $@ $< - if test ! -d $@ && test -d $(@:.html=); then \ - mv $(@:.html=) $@; else :; fi + rm -rf $(@:.html=.htp) + if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \ + -o $(@:.html=.htp) $<; \ + then \ + rm -rf $@; \ + if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \ + mv $(@:.html=) $@; else mv $(@:.html=.htp) $@; fi; \ + else \ + if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \ + rm -rf $(@:.html=); else rm -Rf $(@:.html=.htp) $@; fi; \ + exit 1; \ + fi $(srcdir)/as.info: as.texinfo +as.dvi: as.texinfo as.pdf: as.texinfo as.html: as.texinfo .dvi.ps: + TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ $(DVIPS) -o $@ $< uninstall-info-am: - $(PRE_UNINSTALL) + @$(PRE_UNINSTALL) @if (install-info --version && \ install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \ list='$(INFO_DEPS)'; \ @@ -361,7 +371,7 @@ uninstall-info-am: relfile=`echo "$$file" | sed 's|^.*/||'`; \ relfile_i=`echo "$$relfile" | sed 's|\.info$$||;s|$$|.i|'`; \ (if cd "$(DESTDIR)$(infodir)"; then \ - echo " rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9])"; \ + echo " cd '$(DESTDIR)$(infodir)' && rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]"; \ rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]; \ else :; fi); \ done @@ -470,8 +480,7 @@ mostlyclean-generic: clean-generic: distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) - -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -493,7 +502,9 @@ html: html-am html-am: $(HTMLS) -info-am: $(INFO_DEPS) +info: info-am + +info-am: $(INFO_DEPS) info-local install-data-am: install-data-local install-man @@ -559,11 +570,11 @@ uninstall-man: uninstall-man1 .PHONY: all all-am check check-am clean clean-generic clean-info \ clean-libtool dist-info distclean distclean-generic \ - distclean-libtool dvi dvi-am html html-am info info-am install \ - install-am install-data install-data-am install-data-local \ - install-exec install-exec-am install-info install-info-am \ - install-man install-man1 install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ + distclean-libtool dvi dvi-am html html-am info info-am \ + info-local install install-am install-data install-data-am \ + install-data-local install-exec install-exec-am install-info \ + install-info-am install-man install-man1 install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-aminfo maintainer-clean-generic mostlyclean \ mostlyclean-aminfo mostlyclean-generic mostlyclean-libtool pdf \ pdf-am ps ps-am uninstall uninstall-am uninstall-info-am \ @@ -572,25 +583,43 @@ uninstall-man: uninstall-man1 asconfig.texi: $(CONFIG).texi rm -f asconfig.texi - ln -s $(srcdir)/$(CONFIG).texi ./asconfig.texi >/dev/null 2>&1 \ - || ln $(srcdir)/$(CONFIG).texi ./asconfig.texi >/dev/null 2>&1 \ - || cp $(srcdir)/$(CONFIG).texi ./asconfig.texi + cp $(srcdir)/$(CONFIG).texi ./asconfig.texi + chmod u+w ./asconfig.texi -gasver.texi: Makefile +gasver.texi: $(srcdir)/../../bfd/configure rm -f $@ - echo '@set VERSION $(VERSION)' > $@ + eval `grep '^ *VERSION=' $(srcdir)/../../bfd/configure`; \ + echo "@set VERSION $$VERSION" > $@ -as.info: $(srcdir)/as.texinfo asconfig.texi gasver.texi $(CPU_DOCS) -as.dvi: $(srcdir)/as.texinfo asconfig.texi gasver.texi $(CPU_DOCS) +$(srcdir)/as.info as.dvi as.html: $(srcdir)/as.texinfo asconfig.texi gasver.texi $(CPU_DOCS) # We want install to imply install-info as per GNU standards, despite the # cygnus option. install-data-local: install-info +install-html: install-html-am + +install-html-am: $(HTMLS) + @$(NORMAL_INSTALL) + test -z "$(htmldir)" || $(mkdir_p) "$(DESTDIR)$(htmldir)" + @list='$(HTMLS)'; for p in $$list; do \ + if test -f "$$p" || test -d "$$p"; then d=""; else d="$(srcdir)/"; fi; \ + f=$(html__strip_dir) \ + if test -d "$$d$$p"; then \ + echo " $(mkdir_p) '$(DESTDIR)$(htmldir)/$$f'"; \ + $(mkdir_p) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \ + echo " $(INSTALL_DATA) '$$d$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \ + $(INSTALL_DATA) "$$d$$p"/* "$(DESTDIR)$(htmldir)/$$f"; \ + else \ + echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(htmldir)/$$f'"; \ + $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(htmldir)/$$f"; \ + fi; \ + done + # Maintenance # We need it for the taz target in ../../Makefile.in. -info: $(MANS) +info-local: $(MANS) # Build the man page from the texinfo file # The sed command removes the no-adjust Nroff command so that diff --git a/contrib/binutils/gas/doc/all.texi b/contrib/binutils/gas/doc/all.texi index 4e302cea1f6..5192f5471c9 100644 --- a/contrib/binutils/gas/doc/all.texi +++ b/contrib/binutils/gas/doc/all.texi @@ -1,4 +1,5 @@ -@c Copyright 1992, 1993, 1994, 1996, 1997, 1999, 2000, 2001, 2002 +@c Copyright 1992, 1993, 1994, 1996, 1997, 1999, 2000, 2001, 2002, +@c 2003, 2005 @c Free Software Foundation, Inc. @c This file is part of the documentation for the GAS manual @@ -19,35 +20,36 @@ @c Object formats of interest @c ========================== @set AOUT -@set BOUT @set COFF @set ELF @set SOM @c CPUs of interest @c ================ -@set A29K @set ALPHA @set ARC @set ARM +@set BFIN @set CRIS @set D10V @set D30V @set H8/300 -@set H8/500 @set HPPA @set I370 @set I80386 @set I860 @set I960 +@set IA64 @set IP2K +@set M32C @set M32R +@set xc16x @set M68HC11 @set M680X0 -@set M880X0 @set MCORE @set MIPS @set MMIX +@set MS1 @set MSP430 @set PDP11 @set PJ @@ -57,8 +59,8 @@ @set TIC54X @set V850 @set VAX -@set VXWORKS @set XTENSA +@set Z80 @set Z8000 @c Does this version of the assembler use the difference-table kluge? diff --git a/contrib/binutils/gas/doc/as.1 b/contrib/binutils/gas/doc/as.1 index e16cbe920aa..89e3b4c2c7c 100644 --- a/contrib/binutils/gas/doc/as.1 +++ b/contrib/binutils/gas/doc/as.1 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14 +.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32 .\" .\" Standard preamble: .\" ======================================================================== @@ -25,11 +25,11 @@ .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left -.\" double quote, and \*(R" will give a right double quote. | will give a -.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to -.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' -.\" expand to `' in nroff, nothing in troff, for use with C<>. -.tr \(*W-|\(bv\*(Tr +.\" double quote, and \*(R" will give a right double quote. \*(C+ will +.\" give a nicer C++. Capital omega is used to do unbreakable dashes and +.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, +.\" nothing in troff, for use with C<>. +.tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- @@ -128,19 +128,21 @@ .\" ======================================================================== .\" .IX Title "AS 1" -.TH AS 1 "2004-05-17" "binutils-2.15" "GNU Development Tools" +.TH AS 1 "2006-06-23" "binutils-2.17" "GNU Development Tools" .SH "NAME" AS \- the portable GNU assembler. .SH "SYNOPSIS" .IX Header "SYNOPSIS" -as [\fB\-a\fR[\fBcdhlns\fR][=\fIfile\fR]] [\fB\-D\fR] [\fB\-\-defsym\fR \fIsym\fR=\fIval\fR] - [\fB\-f\fR] [\fB\-\-gstabs\fR] [\fB\-\-gstabs+\fR] [\fB\-\-gdwarf2\fR] [\fB\-\-help\fR] - [\fB\-I\fR \fIdir\fR] [\fB\-J\fR] [\fB\-K\fR] [\fB\-L\fR] - [\fB\-\-listing\-lhs\-width\fR=\fI\s-1NUM\s0\fR] [\fB\-\-listing\-lhs\-width2\fR=\fI\s-1NUM\s0\fR] - [\fB\-\-listing\-rhs\-width\fR=\fI\s-1NUM\s0\fR] [\fB\-\-listing\-cont\-lines\fR=\fI\s-1NUM\s0\fR] - [\fB\-\-keep\-locals\fR] [\fB\-o\fR \fIobjfile\fR] [\fB\-R\fR] [\fB\-\-statistics\fR] [\fB\-v\fR] - [\fB\-version\fR] [\fB\-\-version\fR] [\fB\-W\fR] [\fB\-\-warn\fR] [\fB\-\-fatal\-warnings\fR] - [\fB\-w\fR] [\fB\-x\fR] [\fB\-Z\fR] [\fB\-\-target\-help\fR] [\fItarget-options\fR] +as [\fB\-a\fR[\fBcdhlns\fR][=\fIfile\fR]] [\fB\-\-alternate\fR] [\fB\-D\fR] + [\fB\-\-defsym\fR \fIsym\fR=\fIval\fR] [\fB\-f\fR] [\fB\-g\fR] [\fB\-\-gstabs\fR] + [\fB\-\-gstabs+\fR] [\fB\-\-gdwarf\-2\fR] [\fB\-\-help\fR] [\fB\-I\fR \fIdir\fR] [\fB\-J\fR] + [\fB\-K\fR] [\fB\-L\fR] [\fB\-\-listing\-lhs\-width\fR=\fI\s-1NUM\s0\fR] + [\fB\-\-listing\-lhs\-width2\fR=\fI\s-1NUM\s0\fR] [\fB\-\-listing\-rhs\-width\fR=\fI\s-1NUM\s0\fR] + [\fB\-\-listing\-cont\-lines\fR=\fI\s-1NUM\s0\fR] [\fB\-\-keep\-locals\fR] [\fB\-o\fR + \fIobjfile\fR] [\fB\-R\fR] [\fB\-\-reduce\-memory\-overheads\fR] [\fB\-\-statistics\fR] + [\fB\-v\fR] [\fB\-version\fR] [\fB\-\-version\fR] [\fB\-W\fR] [\fB\-\-warn\fR] + [\fB\-\-fatal\-warnings\fR] [\fB\-w\fR] [\fB\-x\fR] [\fB\-Z\fR] [\fB@\fR\fI\s-1FILE\s0\fR] + [\fB\-\-target\-help\fR] [\fItarget-options\fR] [\fB\-\-\fR|\fIfiles\fR ...] .PP \&\fITarget Alpha options:\fR @@ -158,16 +160,18 @@ as [\fB\-a\fR[\fBcdhlns\fR][=\fIfile\fR]] [\fB\-D\fR] [\fB\-\-defsym\fR \fIsym\f [\fB\-march\fR=\fIarchitecture\fR[+\fIextension\fR...]] [\fB\-mfpu\fR=\fIfloating-point-format\fR] [\fB\-mfloat\-abi\fR=\fIabi\fR] + [\fB\-meabi\fR=\fIver\fR] [\fB\-mthumb\fR] [\fB\-EB\fR|\fB\-EL\fR] [\fB\-mapcs\-32\fR|\fB\-mapcs\-26\fR|\fB\-mapcs\-float\fR| \fB\-mapcs\-reentrant\fR] - [\fB\-mthumb\-interwork\fR] [\fB\-moabi\fR] [\fB\-k\fR] + [\fB\-mthumb\-interwork\fR] [\fB\-k\fR] .PP \&\fITarget \s-1CRIS\s0 options:\fR [\fB\-\-underscore\fR | \fB\-\-no\-underscore\fR] [\fB\-\-pic\fR] [\fB\-N\fR] [\fB\-\-emulation=criself\fR | \fB\-\-emulation=crisaout\fR] + [\fB\-\-march=v0_v10\fR | \fB\-\-march=v10\fR | \fB\-\-march=v32\fR | \fB\-\-march=common_v10_v32\fR] .PP \&\fITarget D10V options:\fR [\fB\-O\fR] @@ -183,9 +187,21 @@ as [\fB\-a\fR[\fBcdhlns\fR][=\fIfile\fR]] [\fB\-D\fR] [\fB\-\-defsym\fR \fIsym\f \fB\-AKC\fR|\fB\-AMC\fR] [\fB\-b\fR] [\fB\-no\-relax\fR] .PP +\&\fITarget \s-1IA\-64\s0 options:\fR + [\fB\-mconstant\-gp\fR|\fB\-mauto\-pic\fR] + [\fB\-milp32\fR|\fB\-milp64\fR|\fB\-mlp64\fR|\fB\-mp64\fR] + [\fB\-mle\fR|\fBmbe\fR] + [\fB\-mtune=itanium1\fR|\fB\-mtune=itanium2\fR] + [\fB\-munwind\-check=warning\fR|\fB\-munwind\-check=error\fR] + [\fB\-mhint.b=ok\fR|\fB\-mhint.b=warning\fR|\fB\-mhint.b=error\fR] + [\fB\-x\fR|\fB\-xexplicit\fR] [\fB\-xauto\fR] [\fB\-xdebug\fR] +.PP \&\fITarget \s-1IP2K\s0 options:\fR [\fB\-mip2022\fR|\fB\-mip2022ext\fR] .PP +\&\fITarget M32C options:\fR + [\fB\-m32c\fR|\fB\-m16c\fR] +.PP \&\fITarget M32R options:\fR [\fB\-\-m32rx\fR|\fB\-\-[no\-]warn\-explicit\-parallel\-conflicts\fR| \fB\-\-W[n]p\fR] @@ -208,7 +224,7 @@ as [\fB\-a\fR[\fBcdhlns\fR][=\fIfile\fR]] [\fB\-D\fR] [\fB\-\-defsym\fR \fIsym\f \&\fITarget \s-1MIPS\s0 options:\fR [\fB\-nocpp\fR] [\fB\-EL\fR] [\fB\-EB\fR] [\fB\-O\fR[\fIoptimization level\fR]] [\fB\-g\fR[\fIdebug level\fR]] [\fB\-G\fR \fInum\fR] [\fB\-KPIC\fR] [\fB\-call_shared\fR] - [\fB\-non_shared\fR] [\fB\-xgot\fR] [\fB\-\-membedded\-pic\fR] + [\fB\-non_shared\fR] [\fB\-xgot\fR] [\fB\-mabi\fR=\fI\s-1ABI\s0\fR] [\fB\-32\fR] [\fB\-n32\fR] [\fB\-64\fR] [\fB\-mfp32\fR] [\fB\-mgp32\fR] [\fB\-march\fR=\fI\s-1CPU\s0\fR] [\fB\-mtune\fR=\fI\s-1CPU\s0\fR] [\fB\-mips1\fR] [\fB\-mips2\fR] [\fB\-mips3\fR] [\fB\-mips4\fR] [\fB\-mips5\fR] [\fB\-mips32\fR] [\fB\-mips32r2\fR] @@ -219,6 +235,8 @@ as [\fB\-a\fR[\fBcdhlns\fR][=\fIfile\fR]] [\fB\-D\fR] [\fB\-\-defsym\fR \fIsym\f [\fB\-mips16\fR] [\fB\-no\-mips16\fR] [\fB\-mips3d\fR] [\fB\-no\-mips3d\fR] [\fB\-mdmx\fR] [\fB\-no\-mdmx\fR] + [\fB\-mdsp\fR] [\fB\-mno\-dsp\fR] + [\fB\-mmt\fR] [\fB\-mno\-mt\fR] [\fB\-mdebug\fR] [\fB\-no\-mdebug\fR] [\fB\-mpdr\fR] [\fB\-mno\-pdr\fR] .PP @@ -256,10 +274,20 @@ as [\fB\-a\fR[\fBcdhlns\fR][=\fIfile\fR]] [\fB\-D\fR] [\fB\-\-defsym\fR \fIsym\f [\fB\-mcpu=54[123589]\fR|\fB\-mcpu=54[56]lp\fR] [\fB\-mfar\-mode\fR|\fB\-mf\fR] [\fB\-merrors\-to\-file\fR \fI\fR|\fB\-me\fR \fI\fR] .PP +\&\fITarget Z80 options:\fR + [\fB\-z80\fR] [\fB\-r800\fR] + [ \fB\-ignore\-undocumented\-instructions\fR] [\fB\-Wnud\fR] + [ \fB\-ignore\-unportable\-instructions\fR] [\fB\-Wnup\fR] + [ \fB\-warn\-undocumented\-instructions\fR] [\fB\-Wud\fR] + [ \fB\-warn\-unportable\-instructions\fR] [\fB\-Wup\fR] + [ \fB\-forbid\-undocumented\-instructions\fR] [\fB\-Fud\fR] + [ \fB\-forbid\-unportable\-instructions\fR] [\fB\-Fup\fR] +.PP \&\fITarget Xtensa options:\fR - [\fB\-\-[no\-]density\fR] [\fB\-\-[no\-]relax\fR] [\fB\-\-[no\-]generics\fR] - [\fB\-\-[no\-]text\-section\-literals\fR] + [\fB\-\-[no\-]text\-section\-literals\fR] [\fB\-\-[no\-]absolute\-literals\fR] [\fB\-\-[no\-]target\-align\fR] [\fB\-\-[no\-]longcalls\fR] + [\fB\-\-[no\-]transform\fR] + [\fB\-\-rename\-section\fR \fIoldname\fR=\fInewname\fR] .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\s-1GNU\s0 \fBas\fR is really a family of assemblers. @@ -311,7 +339,7 @@ The assembler arguments must be separated from each other (and the \fB\-Wa\fR) by commas. For example: .PP .Vb 1 -\& gcc -c -g -O -Wa,-alh,-L file.c +\& gcc \-c \-g \-O \-Wa,\-alh,\-L file.c .Ve .PP This passes two options to the assembler: \fB\-alh\fR (emit a listing to @@ -325,6 +353,19 @@ precisely what options it passes to each compilation pass, including the assembler.) .SH "OPTIONS" .IX Header "OPTIONS" +.IP "\fB@\fR\fIfile\fR" 4 +.IX Item "@file" +Read command-line options from \fIfile\fR. The options read are +inserted in place of the original @\fIfile\fR option. If \fIfile\fR +does not exist, or cannot be read, then the option will be treated +literally, and not removed. +.Sp +Options in \fIfile\fR are separated by whitespace. A whitespace +character may be included in an option by surrounding the entire +option in either single or double quotes. Any character (including a +backslash) may be included by prefixing the character to be included +with a backslash. The \fIfile\fR may itself contain additional +@\fIfile\fR options; any such options will be processed recursively. .IP "\fB\-a[cdhlmns]\fR" 4 .IX Item "-a[cdhlmns]" Turn on listings, in any of a variety of ways: @@ -360,6 +401,9 @@ You may combine these options; for example, use \fB\-aln\fR for assembly listing without forms processing. The \fB=file\fR option, if used, must be the last one. By itself, \fB\-a\fR defaults to \fB\-ahls\fR. .RE +.IP "\fB\-\-alternate\fR" 4 +.IX Item "--alternate" +Begin in alternate macro mode, see \fBAltmacro,,\f(CB\*(C`.altmacro\*(C'\fB\fR. .IP "\fB\-D\fR" 4 .IX Item "-D" Ignored. This option is accepted for script compatibility with calls to @@ -371,8 +415,17 @@ Define the symbol \fIsym\fR to be \fIvalue\fR before assembling the input file. indicates a hexadecimal value, and a leading \fB0\fR indicates an octal value. .IP "\fB\-f\fR" 4 .IX Item "-f" -``fast''\-\-\-skip whitespace and comment preprocessing (assume source is +\&\*(L"fast\*(R"\-\-\-skip whitespace and comment preprocessing (assume source is compiler output). +.IP "\fB\-g\fR" 4 +.IX Item "-g" +.PD 0 +.IP "\fB\-\-gen\-debug\fR" 4 +.IX Item "--gen-debug" +.PD +Generate debugging information for each assembler source line using whichever +debug format is preferred by the target. This currently means either \s-1STABS\s0, +\&\s-1ECOFF\s0 or \s-1DWARF2\s0. .IP "\fB\-\-gstabs\fR" 4 .IX Item "--gstabs" Generate stabs debugging information for each assembler line. This @@ -384,8 +437,8 @@ extensions that probably only gdb can handle, and that could make other debuggers crash or refuse to read your program. This may help debugging assembler code. Currently the only \s-1GNU\s0 extension is the location of the current working directory at assembling time. -.IP "\fB\-\-gdwarf2\fR" 4 -.IX Item "--gdwarf2" +.IP "\fB\-\-gdwarf\-2\fR" 4 +.IX Item "--gdwarf-2" Generate \s-1DWARF2\s0 debugging information for each assembler line. This may help debugging assembler code, if the debugger can handle it. Note\-\-\-this option is only supported by some targets, not all of them. @@ -435,6 +488,17 @@ Name the object-file output from \fBas\fR \fIobjfile\fR. .IP "\fB\-R\fR" 4 .IX Item "-R" Fold the data section into the text section. +.Sp +Set the default size of \s-1GAS\s0's hash tables to a prime number close to +\&\fInumber\fR. Increasing this value can reduce the length of time it takes the +assembler to perform its tasks, at the expense of increasing the assembler's +memory requirements. Similarly reducing this value can reduce the memory +requirements at the expense of speed. +.IP "\fB\-\-reduce\-memory\-overheads\fR" 4 +.IX Item "--reduce-memory-overheads" +This option reduces \s-1GAS\s0's memory requirements, at the expense of making the +assembly processes slower. Currently this switch is a synonym for +\&\fB\-\-hash\-size=4051\fR, but in the future it may have other effects as well. .IP "\fB\-\-statistics\fR" 4 .IX Item "--statistics" Print the maximum space (in bytes) and total time (in seconds) used by @@ -504,8 +568,8 @@ Select which floating point \s-1ABI\s0 is in use. .IP "\fB\-mthumb\fR" 4 .IX Item "-mthumb" Enable Thumb only instruction decoding. -.IP "\fB\-mapcs\-32 | \-mapcs\-26 | \-mapcs\-float | \-mapcs\-reentrant | \-moabi\fR" 4 -.IX Item "-mapcs-32 | -mapcs-26 | -mapcs-float | -mapcs-reentrant | -moabi" +.IP "\fB\-mapcs\-32 | \-mapcs\-26 | \-mapcs\-float | \-mapcs\-reentrant\fR" 4 +.IX Item "-mapcs-32 | -mapcs-26 | -mapcs-float | -mapcs-reentrant" Select which procedure calling convention is in use. .IP "\fB\-EB | \-EL\fR" 4 .IX Item "-EB | -EL" @@ -562,6 +626,15 @@ Restores the default behaviour, which restricts the permitted instructions to just the basic \s-1IP2022\s0 ones. .PP The following options are available when as is configured for the +Renesas M32C and M16C processors. +.IP "\fB\-m32c\fR" 4 +.IX Item "-m32c" +Assemble M32C instructions. +.IP "\fB\-m16c\fR" 4 +.IX Item "-m16c" +Assemble M16C instructions (the default). +.PP +The following options are available when as is configured for the Renesas M32R (formerly Mitsubishi M32R) series. .IP "\fB\-\-m32rx\fR" 4 .IX Item "--m32rx" @@ -604,7 +677,7 @@ The target machine does (or does not) have a memory-management unit coprocessor. The default is to assume an \s-1MMU\s0 for 68020 and up. .PP For details about the \s-1PDP\-11\s0 machine dependent features options, -see \f(CW@ref\fR{PDP\-11\-Options}. +see \fBPDP\-11\-Options\fR. .IP "\fB\-mpic | \-mno\-pic\fR" 4 .IX Item "-mpic | -mno-pic" Generate position-independent (or position\-dependent) code. The @@ -635,10 +708,10 @@ The following options are available when as is configured for a picoJava processor. .IP "\fB\-mb\fR" 4 .IX Item "-mb" -Generate ``big endian'' format output. +Generate \*(L"big endian\*(R" format output. .IP "\fB\-ml\fR" 4 .IX Item "-ml" -Generate ``little endian'' format output. +Generate \*(L"little endian\*(R" format output. .PP The following options are available when as is configured for the Motorola 68HC11 or 68HC12 series. @@ -728,10 +801,10 @@ implicitly with the \f(CW\*(C`gp\*(C'\fR register. It is only accepted for targ use \s-1ECOFF\s0 format, such as a DECstation running Ultrix. The default value is 8. .IP "\fB\-EB\fR" 4 .IX Item "-EB" -Generate ``big endian'' format output. +Generate \*(L"big endian\*(R" format output. .IP "\fB\-EL\fR" 4 .IX Item "-EL" -Generate ``little endian'' format output. +Generate \*(L"little endian\*(R" format output. .IP "\fB\-mips1\fR" 4 .IX Item "-mips1" .PD 0 @@ -828,6 +901,24 @@ This tells the assembler to accept \s-1MIPS\-3D\s0 instructions. Generate code for the \s-1MDMX\s0 Application Specific Extension. This tells the assembler to accept \s-1MDMX\s0 instructions. \&\fB\-no\-mdmx\fR turns off this option. +.IP "\fB\-mdsp\fR" 4 +.IX Item "-mdsp" +.PD 0 +.IP "\fB\-mno\-dsp\fR" 4 +.IX Item "-mno-dsp" +.PD +Generate code for the \s-1DSP\s0 Application Specific Extension. +This tells the assembler to accept \s-1DSP\s0 instructions. +\&\fB\-mno\-dsp\fR turns off this option. +.IP "\fB\-mmt\fR" 4 +.IX Item "-mmt" +.PD 0 +.IP "\fB\-mno\-mt\fR" 4 +.IX Item "-mno-mt" +.PD +Generate code for the \s-1MT\s0 Application Specific Extension. +This tells the assembler to accept \s-1MT\s0 instructions. +\&\fB\-mno\-mt\fR turns off this option. .IP "\fB\-\-construct\-floats\fR" 4 .IX Item "--construct-floats" .PD 0 @@ -923,29 +1014,20 @@ See the info pages for documentation of the MMIX-specific options. .PP The following options are available when as is configured for an Xtensa processor. -.IP "\fB\-\-density | \-\-no\-density\fR" 4 -.IX Item "--density | --no-density" -Enable or disable use of instructions from the Xtensa code density -option. This is enabled by default when the Xtensa processor supports -the code density option. -.IP "\fB\-\-relax | \-\-no\-relax\fR" 4 -.IX Item "--relax | --no-relax" -Enable or disable instruction relaxation. This is enabled by default. -Note: In the current implementation, these options also control whether -assembler optimizations are performed, making these options equivalent -to \fB\-\-generics\fR and \fB\-\-no\-generics\fR. -.IP "\fB\-\-generics | \-\-no\-generics\fR" 4 -.IX Item "--generics | --no-generics" -Enable or disable all assembler transformations of Xtensa instructions. -The default is \fB\-\-generics\fR; -\&\fB\-\-no\-generics\fR should be used only in the rare cases when the -instructions must be exactly as specified in the assembly source. .IP "\fB\-\-text\-section\-literals | \-\-no\-text\-section\-literals\fR" 4 .IX Item "--text-section-literals | --no-text-section-literals" With \fB\-\-text\-section\-literals\fR, literal pools are interspersed in the text section. The default is \&\fB\-\-no\-text\-section\-literals\fR, which places literals in a -separate section in the output file. +separate section in the output file. These options only affect literals +referenced via PC-relative \f(CW\*(C`L32R\*(C'\fR instructions; literals for +absolute mode \f(CW\*(C`L32R\*(C'\fR instructions are handled separately. +.IP "\fB\-\-absolute\-literals | \-\-no\-absolute\-literals\fR" 4 +.IX Item "--absolute-literals | --no-absolute-literals" +Indicate to the assembler whether \f(CW\*(C`L32R\*(C'\fR instructions use absolute +or PC-relative addressing. The default is to assume absolute addressing +if the Xtensa processor includes the absolute \f(CW\*(C`L32R\*(C'\fR addressing +option. Otherwise, only the PC-relative \f(CW\*(C`L32R\*(C'\fR mode can be used. .IP "\fB\-\-target\-align | \-\-no\-target\-align\fR" 4 .IX Item "--target-align | --no-target-align" Enable or disable automatic alignment to reduce branch penalties at the @@ -955,6 +1037,63 @@ expense of some code density. The default is \fB\-\-target\-align\fR. Enable or disable transformation of call instructions to allow calls across a greater range of addresses. The default is \&\fB\-\-no\-longcalls\fR. +.IP "\fB\-\-transform | \-\-no\-transform\fR" 4 +.IX Item "--transform | --no-transform" +Enable or disable all assembler transformations of Xtensa instructions. +The default is \fB\-\-transform\fR; +\&\fB\-\-no\-transform\fR should be used only in the rare cases when the +instructions must be exactly as specified in the assembly source. +.PP +The following options are available when as is configured for +a Z80 family processor. +.IP "\fB\-z80\fR" 4 +.IX Item "-z80" +Assemble for Z80 processor. +.IP "\fB\-r800\fR" 4 +.IX Item "-r800" +Assemble for R800 processor. +.IP "\fB\-ignore\-undocumented\-instructions\fR" 4 +.IX Item "-ignore-undocumented-instructions" +.PD 0 +.IP "\fB\-Wnud\fR" 4 +.IX Item "-Wnud" +.PD +Assemble undocumented Z80 instructions that also work on R800 without warning. +.IP "\fB\-ignore\-unportable\-instructions\fR" 4 +.IX Item "-ignore-unportable-instructions" +.PD 0 +.IP "\fB\-Wnup\fR" 4 +.IX Item "-Wnup" +.PD +Assemble all undocumented Z80 instructions without warning. +.IP "\fB\-warn\-undocumented\-instructions\fR" 4 +.IX Item "-warn-undocumented-instructions" +.PD 0 +.IP "\fB\-Wud\fR" 4 +.IX Item "-Wud" +.PD +Issue a warning for undocumented Z80 instructions that also work on R800. +.IP "\fB\-warn\-unportable\-instructions\fR" 4 +.IX Item "-warn-unportable-instructions" +.PD 0 +.IP "\fB\-Wup\fR" 4 +.IX Item "-Wup" +.PD +Issue a warning for undocumented Z80 instructions that do notwork on R800. +.IP "\fB\-forbid\-undocumented\-instructions\fR" 4 +.IX Item "-forbid-undocumented-instructions" +.PD 0 +.IP "\fB\-Fud\fR" 4 +.IX Item "-Fud" +.PD +Treat all undocumented instructions as errors. +.IP "\fB\-forbid\-unportable\-instructions\fR" 4 +.IX Item "-forbid-unportable-instructions" +.PD 0 +.IP "\fB\-Fup\fR" 4 +.IX Item "-Fup" +.PD +Treat undocumented Z80 intructions that do notwork on R800 as errors. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fIgcc\fR\|(1), \fIld\fR\|(1), and the Info entries for \fIbinutils\fR and \fIld\fR. @@ -967,4 +1106,4 @@ under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the -section entitled ``\s-1GNU\s0 Free Documentation License''. +section entitled \*(L"\s-1GNU\s0 Free Documentation License\*(R". diff --git a/contrib/binutils/gas/doc/as.texinfo b/contrib/binutils/gas/doc/as.texinfo index d9d23dff59f..6daaed028c7 100644 --- a/contrib/binutils/gas/doc/as.texinfo +++ b/contrib/binutils/gas/doc/as.texinfo @@ -1,6 +1,6 @@ \input texinfo @c -*-Texinfo-*- @c Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -@c 2001, 2002, 2003, 2004 +@c 2001, 2002, 2003, 2004, 2005 @c Free Software Foundation, Inc. @c UPDATE!! On future updates-- @c (1) check for new machine-dep cmdline options in @@ -45,9 +45,6 @@ @ifset H8/300 @set H8 @end ifset -@ifset H8/500 -@set H8 -@end ifset @ifset SH @set H8 @end ifset @@ -226,21 +223,20 @@ gcc(1), ld(1), and the Info entries for @file{binutils} and @file{ld}. @c to be limited to one line for the header. @smallexample @c man begin SYNOPSIS -@value{AS} [@b{-a}[@b{cdhlns}][=@var{file}]] [@b{-D}] [@b{--defsym} @var{sym}=@var{val}] - [@b{-f}] [@b{--gstabs}] [@b{--gstabs+}] [@b{--gdwarf2}] [@b{--help}] - [@b{-I} @var{dir}] [@b{-J}] [@b{-K}] [@b{-L}] - [@b{--listing-lhs-width}=@var{NUM}] [@b{--listing-lhs-width2}=@var{NUM}] - [@b{--listing-rhs-width}=@var{NUM}] [@b{--listing-cont-lines}=@var{NUM}] - [@b{--keep-locals}] [@b{-o} @var{objfile}] [@b{-R}] [@b{--statistics}] [@b{-v}] - [@b{-version}] [@b{--version}] [@b{-W}] [@b{--warn}] [@b{--fatal-warnings}] - [@b{-w}] [@b{-x}] [@b{-Z}] [@b{--target-help}] [@var{target-options}] +@value{AS} [@b{-a}[@b{cdhlns}][=@var{file}]] [@b{--alternate}] [@b{-D}] + [@b{--defsym} @var{sym}=@var{val}] [@b{-f}] [@b{-g}] [@b{--gstabs}] + [@b{--gstabs+}] [@b{--gdwarf-2}] [@b{--help}] [@b{-I} @var{dir}] [@b{-J}] + [@b{-K}] [@b{-L}] [@b{--listing-lhs-width}=@var{NUM}] + [@b{--listing-lhs-width2}=@var{NUM}] [@b{--listing-rhs-width}=@var{NUM}] + [@b{--listing-cont-lines}=@var{NUM}] [@b{--keep-locals}] [@b{-o} + @var{objfile}] [@b{-R}] [@b{--reduce-memory-overheads}] [@b{--statistics}] + [@b{-v}] [@b{-version}] [@b{--version}] [@b{-W}] [@b{--warn}] + [@b{--fatal-warnings}] [@b{-w}] [@b{-x}] [@b{-Z}] [@b{@@@var{FILE}}] + [@b{--target-help}] [@var{target-options}] [@b{--}|@var{files} @dots{}] @c @c Target dependent options are listed below. Keep the list sorted. @c Add an empty line for separation. -@ifset A29K -@c am29k has no machine-dependent assembler options -@end ifset @ifset ALPHA @emph{Target Alpha options:} @@ -263,11 +259,12 @@ gcc(1), ld(1), and the Info entries for @file{binutils} and @file{ld}. [@b{-march}=@var{architecture}[+@var{extension}@dots{}]] [@b{-mfpu}=@var{floating-point-format}] [@b{-mfloat-abi}=@var{abi}] + [@b{-meabi}=@var{ver}] [@b{-mthumb}] [@b{-EB}|@b{-EL}] [@b{-mapcs-32}|@b{-mapcs-26}|@b{-mapcs-float}| @b{-mapcs-reentrant}] - [@b{-mthumb-interwork}] [@b{-moabi}] [@b{-k}] + [@b{-mthumb-interwork}] [@b{-k}] @end ifset @ifset CRIS @@ -275,6 +272,7 @@ gcc(1), ld(1), and the Info entries for @file{binutils} and @file{ld}. [@b{--underscore} | @b{--no-underscore}] [@b{--pic}] [@b{-N}] [@b{--emulation=criself} | @b{--emulation=crisaout}] + [@b{--march=v0_v10} | @b{--march=v10} | @b{--march=v32} | @b{--march=common_v10_v32}] @c Deprecated -- deliberately not documented. @c [@b{-h}] [@b{-H}] @end ifset @@ -313,6 +311,9 @@ gcc(1), ld(1), and the Info entries for @file{binutils} and @file{ld}. [@b{-mconstant-gp}|@b{-mauto-pic}] [@b{-milp32}|@b{-milp64}|@b{-mlp64}|@b{-mp64}] [@b{-mle}|@b{mbe}] + [@b{-mtune=itanium1}|@b{-mtune=itanium2}] + [@b{-munwind-check=warning}|@b{-munwind-check=error}] + [@b{-mhint.b=ok}|@b{-mhint.b=warning}|@b{-mhint.b=error}] [@b{-x}|@b{-xexplicit}] [@b{-xauto}] [@b{-xdebug}] @end ifset @ifset IP2K @@ -320,6 +321,11 @@ gcc(1), ld(1), and the Info entries for @file{binutils} and @file{ld}. @emph{Target IP2K options:} [@b{-mip2022}|@b{-mip2022ext}] @end ifset +@ifset M32C + +@emph{Target M32C options:} + [@b{-m32c}|@b{-m16c}] +@end ifset @ifset M32R @emph{Target M32R options:} @@ -352,7 +358,7 @@ gcc(1), ld(1), and the Info entries for @file{binutils} and @file{ld}. @emph{Target MIPS options:} [@b{-nocpp}] [@b{-EL}] [@b{-EB}] [@b{-O}[@var{optimization level}]] [@b{-g}[@var{debug level}]] [@b{-G} @var{num}] [@b{-KPIC}] [@b{-call_shared}] - [@b{-non_shared}] [@b{-xgot}] [@b{--membedded-pic}] + [@b{-non_shared}] [@b{-xgot}] [@b{-mabi}=@var{ABI}] [@b{-32}] [@b{-n32}] [@b{-64}] [@b{-mfp32}] [@b{-mgp32}] [@b{-march}=@var{CPU}] [@b{-mtune}=@var{CPU}] [@b{-mips1}] [@b{-mips2}] [@b{-mips3}] [@b{-mips4}] [@b{-mips5}] [@b{-mips32}] [@b{-mips32r2}] @@ -363,6 +369,8 @@ gcc(1), ld(1), and the Info entries for @file{binutils} and @file{ld}. [@b{-mips16}] [@b{-no-mips16}] [@b{-mips3d}] [@b{-no-mips3d}] [@b{-mdmx}] [@b{-no-mdmx}] + [@b{-mdsp}] [@b{-mno-dsp}] + [@b{-mmt}] [@b{-mno-mt}] [@b{-mdebug}] [@b{-no-mdebug}] [@b{-mpdr}] [@b{-mno-pdr}] @end ifset @@ -413,15 +421,29 @@ gcc(1), ld(1), and the Info entries for @file{binutils} and @file{ld}. [@b{-mcpu=54[123589]}|@b{-mcpu=54[56]lp}] [@b{-mfar-mode}|@b{-mf}] [@b{-merrors-to-file} @var{}|@b{-me} @var{}] @end ifset + +@ifset Z80 + +@emph{Target Z80 options:} + [@b{-z80}] [@b{-r800}] + [@b{ -ignore-undocumented-instructions}] [@b{-Wnud}] + [@b{ -ignore-unportable-instructions}] [@b{-Wnup}] + [@b{ -warn-undocumented-instructions}] [@b{-Wud}] + [@b{ -warn-unportable-instructions}] [@b{-Wup}] + [@b{ -forbid-undocumented-instructions}] [@b{-Fud}] + [@b{ -forbid-unportable-instructions}] [@b{-Fup}] +@end ifset + @ifset Z8000 @c Z8000 has no machine-dependent assembler options @end ifset @ifset XTENSA @emph{Target Xtensa options:} - [@b{--[no-]density}] [@b{--[no-]relax}] [@b{--[no-]generics}] - [@b{--[no-]text-section-literals}] + [@b{--[no-]text-section-literals}] [@b{--[no-]absolute-literals}] [@b{--[no-]target-align}] [@b{--[no-]longcalls}] + [@b{--[no-]transform}] + [@b{--rename-section} @var{oldname}=@var{newname}] @end ifset @c man end @end smallexample @@ -429,6 +451,8 @@ gcc(1), ld(1), and the Info entries for @file{binutils} and @file{ld}. @c man begin OPTIONS @table @gcctabopt +@include at-file.texi + @item -a[cdhlmns] Turn on listings, in any of a variety of ways: @@ -462,6 +486,9 @@ You may combine these options; for example, use @samp{-aln} for assembly listing without forms processing. The @samp{=file} option, if used, must be the last one. By itself, @samp{-a} defaults to @samp{-ahls}. +@item --alternate +Begin in alternate macro mode, see @ref{Altmacro,,@code{.altmacro}}. + @item -D Ignored. This option is accepted for script compatibility with calls to other assemblers. @@ -475,6 +502,12 @@ indicates a hexadecimal value, and a leading @samp{0} indicates an octal value. ``fast''---skip whitespace and comment preprocessing (assume source is compiler output). +@item -g +@itemx --gen-debug +Generate debugging information for each assembler source line using whichever +debug format is preferred by the target. This currently means either STABS, +ECOFF or DWARF2. + @item --gstabs Generate stabs debugging information for each assembler line. This may help debugging assembler code, if the debugger can handle it. @@ -486,7 +519,7 @@ debuggers crash or refuse to read your program. This may help debugging assembler code. Currently the only GNU extension is the location of the current working directory at assembling time. -@item --gdwarf2 +@item --gdwarf-2 Generate DWARF2 debugging information for each assembler line. This may help debugging assembler code, if the debugger can handle it. Note---this option is only supported by some targets, not all of them. @@ -539,6 +572,18 @@ Name the object-file output from @command{@value{AS}} @var{objfile}. @item -R Fold the data section into the text section. +@kindex --hash-size=@var{number} +Set the default size of GAS's hash tables to a prime number close to +@var{number}. Increasing this value can reduce the length of time it takes the +assembler to perform its tasks, at the expense of increasing the assembler's +memory requirements. Similarly reducing this value can reduce the memory +requirements at the expense of speed. + +@item --reduce-memory-overheads +This option reduces GAS's memory requirements, at the expense of making the +assembly processes slower. Currently this switch is a synonym for +@samp{--hash-size=4051}, but in the future it may have other effects as well. + @item --statistics Print the maximum space (in bytes) and total time (in seconds) used by assembly. @@ -604,7 +649,7 @@ Select which Floating Point architecture is the target. Select which floating point ABI is in use. @item -mthumb Enable Thumb only instruction decoding. -@item -mapcs-32 | -mapcs-26 | -mapcs-float | -mapcs-reentrant | -moabi +@item -mapcs-32 | -mapcs-26 | -mapcs-float | -mapcs-reentrant Select which procedure calling convention is in use. @item -EB | -EL Select either big-endian (-EB) or little-endian (-EL) output. @@ -684,6 +729,21 @@ just the basic IP2022 ones. @end table @end ifset +@ifset M32C +The following options are available when @value{AS} is configured for the +Renesas M32C and M16C processors. + +@table @gcctabopt + +@item -m32c +Assemble M32C instructions. + +@item -m16c +Assemble M16C instructions (the default). + +@end table +@end ifset + @ifset M32R The following options are available when @value{AS} is configured for the Renesas M32R (formerly Mitsubishi M32R) series. @@ -958,6 +1018,18 @@ Generate code for the MDMX Application Specific Extension. This tells the assembler to accept MDMX instructions. @samp{-no-mdmx} turns off this option. +@item -mdsp +@itemx -mno-dsp +Generate code for the DSP Application Specific Extension. +This tells the assembler to accept DSP instructions. +@samp{-mno-dsp} turns off this option. + +@item -mmt +@itemx -mno-mt +Generate code for the MT Application Specific Extension. +This tells the assembler to accept MT instructions. +@samp{-mno-mt} turns off this option. + @item --construct-floats @itemx --no-construct-floats The @samp{--no-construct-floats} option disables the construction of @@ -1051,28 +1123,19 @@ The following options are available when @value{AS} is configured for an Xtensa processor. @table @gcctabopt -@item --density | --no-density -Enable or disable use of instructions from the Xtensa code density -option. This is enabled by default when the Xtensa processor supports -the code density option. - -@item --relax | --no-relax -Enable or disable instruction relaxation. This is enabled by default. -Note: In the current implementation, these options also control whether -assembler optimizations are performed, making these options equivalent -to @option{--generics} and @option{--no-generics}. - -@item --generics | --no-generics -Enable or disable all assembler transformations of Xtensa instructions. -The default is @option{--generics}; -@option{--no-generics} should be used only in the rare cases when the -instructions must be exactly as specified in the assembly source. - @item --text-section-literals | --no-text-section-literals With @option{--text-@-section-@-literals}, literal pools are interspersed in the text section. The default is @option{--no-@-text-@-section-@-literals}, which places literals in a -separate section in the output file. +separate section in the output file. These options only affect literals +referenced via PC-relative @code{L32R} instructions; literals for +absolute mode @code{L32R} instructions are handled separately. + +@item --absolute-literals | --no-absolute-literals +Indicate to the assembler whether @code{L32R} instructions use absolute +or PC-relative addressing. The default is to assume absolute addressing +if the Xtensa processor includes the absolute @code{L32R} addressing +option. Otherwise, only the PC-relative @code{L32R} mode can be used. @item --target-align | --no-target-align Enable or disable automatic alignment to reduce branch penalties at the @@ -1082,6 +1145,41 @@ expense of some code density. The default is @option{--target-@-align}. Enable or disable transformation of call instructions to allow calls across a greater range of addresses. The default is @option{--no-@-longcalls}. + +@item --transform | --no-transform +Enable or disable all assembler transformations of Xtensa instructions. +The default is @option{--transform}; +@option{--no-transform} should be used only in the rare cases when the +instructions must be exactly as specified in the assembly source. +@end table +@end ifset + +@ifset Z80 +The following options are available when @value{AS} is configured for +a Z80 family processor. +@table @gcctabopt +@item -z80 +Assemble for Z80 processor. +@item -r800 +Assemble for R800 processor. +@item -ignore-undocumented-instructions +@itemx -Wnud +Assemble undocumented Z80 instructions that also work on R800 without warning. +@item -ignore-unportable-instructions +@itemx -Wnup +Assemble all undocumented Z80 instructions without warning. +@item -warn-undocumented-instructions +@itemx -Wud +Issue a warning for undocumented Z80 instructions that also work on R800. +@item -warn-unportable-instructions +@itemx -Wup +Issue a warning for undocumented Z80 instructions that do notwork on R800. +@item -forbid-undocumented-instructions +@itemx -Fud +Treat all undocumented instructions as errors. +@item -forbid-unportable-instructions +@itemx -Fup +Treat undocumented Z80 intructions that do notwork on R800 as errors. @end table @end ifset @@ -1132,10 +1230,6 @@ For information on the H8/300 machine instruction set, see @cite{H8/300 Series Programming Manual}. For the H8/300H, see @cite{H8/300H Series Programming Manual} (Renesas). @end ifset -@ifset H8/500 -For information on the H8/500 machine instruction set, see @cite{H8/500 -Series Programming Manual} (Renesas M21T001). -@end ifset @ifset SH For information on the Renesas (formerly Hitachi) / SuperH SH machine instruction set, see @cite{SH-Microcomputer User's Manual} (Renesas) or @@ -1225,10 +1319,6 @@ For the @value{TARGET} target, @command{@value{AS}} is configured to produce @value{OBJ-NAME} format object files. @end ifclear @c The following should exhaust all configs that set MULTI-OBJ, ideally -@ifset A29K -On the @value{TARGET}, @command{@value{AS}} can be configured to produce either -@code{a.out} or COFF format object files. -@end ifset @ifset I960 On the @value{TARGET}, @command{@value{AS}} can be configured to produce either @code{b.out} or COFF format object files. @@ -1395,14 +1485,6 @@ the current input file is used. If a logical line number was given @ifset GENERIC (@pxref{Line,,@code{.line}}) @end ifset -@ifclear GENERIC -@ifclear A29K -(@pxref{Line,,@code{.line}}) -@end ifclear -@ifset A29K -(@pxref{Ln,,@code{.ln}}) -@end ifset -@end ifclear then it is used to calculate the number printed, otherwise the actual line in the current source file is printed. The message text is intended to be self explanatory (in the grand Unix @@ -1456,6 +1538,7 @@ assembler.) @menu * a:: -a[cdhlns] enable listings +* alternate:: --alternate enable alternate macro syntax * D:: -D for compatibility * f:: -f to work faster * I:: -I for .include search path @@ -1528,6 +1611,12 @@ directives. This is because the listing code buffers input source lines from stdin only after they have been preprocessed by the assembler. This reduces memory usage and makes the code more efficient. +@node alternate +@section @option{--alternate} + +@kindex --alternate +Begin in alternate macro mode, see @ref{Altmacro,,@code{.altmacro}}. + @node D @section @option{-D} @@ -2035,9 +2124,6 @@ This means you may not nest these comments. @cindex line comment character Anything from the @dfn{line comment} character to the next newline is considered a comment and is ignored. The line comment character is -@ifset A29K -@samp{;} for the AMD 29K family; -@end ifset @ifset ARC @samp{;} on the ARC; @end ifset @@ -2047,9 +2133,6 @@ is considered a comment and is ignored. The line comment character is @ifset H8/300 @samp{;} for the H8/300 family; @end ifset -@ifset H8/500 -@samp{!} for the H8/500 family; -@end ifset @ifset HPPA @samp{;} for the HPPA; @end ifset @@ -2077,6 +2160,9 @@ is considered a comment and is ignored. The line comment character is @ifset IP2K @samp{#} on the ip2k; @end ifset +@ifset M32C +@samp{#} on the m32c; +@end ifset @ifset M32R @samp{#} on the m32r; @end ifset @@ -2086,12 +2172,12 @@ is considered a comment and is ignored. The line comment character is @ifset M68HC11 @samp{#} on the 68HC11 and 68HC12; @end ifset -@ifset M880X0 -@samp{;} on the M880x0; -@end ifset @ifset VAX @samp{#} on the Vax; @end ifset +@ifset Z80 +@samp{;} for the Z80; +@end ifset @ifset Z8000 @samp{!} for the Z8000; @end ifset @@ -2181,12 +2267,6 @@ the preceding statement. Newlines and semicolons within character constants are an exception: they do not end statements. @end ifclear @ifset abnormal-separator -@ifset A29K -A @dfn{statement} ends at a newline character (@samp{\n}) or an ``at'' -sign (@samp{@@}). The newline or at sign is considered part of the -preceding statement. Newlines and at signs within character constants -are an exception: they do not end statements. -@end ifset @ifset HPPA A @dfn{statement} ends at a newline character (@samp{\n}) or an exclamation point (@samp{!}). The newline or exclamation point is considered part of the @@ -2195,9 +2275,7 @@ constants are an exception: they do not end statements. @end ifset @ifset H8 A @dfn{statement} ends at a newline character (@samp{\n}); or (for the -H8/300) a dollar sign (@samp{$}); or (for the -Renesas-SH or the -H8/500) a semicolon +H8/300) a dollar sign (@samp{$}); or (for the Renesas-SH) a semicolon (@samp{;}). The newline or separator character is considered part of the preceding statement. Newlines and separators within character constants are an exception: they do not end statements. @@ -2416,12 +2494,9 @@ grave accent. A newline (or semicolon @samp{;}) @end ifclear @ifset abnormal-separator -@ifset A29K -(or at sign @samp{@@}) -@end ifset @ifset H8 (or dollar sign @samp{$}, for the H8/300; or semicolon @samp{;} for the -Renesas SH or H8/500) +Renesas SH) @end ifset @end ifset @end ifclear @@ -2524,8 +2599,7 @@ A letter, to tell @command{@value{AS}} the rest of the number is a flonum. 4.2 assembler seems to allow any of @samp{defghDEFGH}.) @end ignore -On the H8/300, H8/500, -Renesas / SuperH SH, +On the H8/300, Renesas / SuperH SH, and AMD 29K architectures, the letter must be one of the letters @samp{DFPRSX} (in upper or lower case). @@ -2538,9 +2612,6 @@ one of the letters @samp{DFT} (in upper or lower case). On the HPPA architecture, the letter must be @samp{E} (upper case only). @end ifset @ifclear GENERIC -@ifset A29K -One of the letters @samp{DFPRSX} (in upper or lower case). -@end ifset @ifset ARC One of the letters @samp{DFRS} (in upper or lower case). @end ifset @@ -2661,8 +2732,7 @@ run-time addresses to sections is called @dfn{relocation}. It includes the task of adjusting mentions of object-file addresses so they refer to the proper run-time addresses. @ifset H8 -For the H8/300 and H8/500, -and for the Renesas / SuperH SH, +For the H8/300, and for the Renesas / SuperH SH, @command{@value{AS}} pads sections if needed to ensure they end on a word (sixteen bit) boundary. @end ifset @@ -2954,7 +3024,7 @@ of @command{@value{AS}}.) @end ifset @ifclear GENERIC @ifset H8 -On the H8/300 and H8/500 platforms, each subsection is zero-padded to a word +On the H8/300 platform, each subsection is zero-padded to a word boundary (two bytes). The same is true on the Renesas SH. @end ifset @@ -2966,10 +3036,6 @@ The same is true on the Renesas SH. @c these paragraphs might need to vanish from this manual, and be @c discussed in BFD chapter of binutils (or some such). @end ifset -@ifset A29K -On the AMD 29K family, no particular padding is added to section or -subsection sizes; @value{AS} forces no alignment on this platform. -@end ifset @end ifclear Subsections appear in your object file in numeric order, lowest numbered @@ -2982,9 +3048,9 @@ data subsections as a data section. To specify which subsection you want subsequent statements assembled into, use a numeric argument to specify it, in a @samp{.text @var{expression}} or a @samp{.data @var{expression}} statement. -@ifset COFF-ELF +@ifset COFF @ifset GENERIC -When generating COFF or ELF output, you +When generating COFF output, you @end ifset @ifclear GENERIC You @@ -2993,6 +3059,16 @@ can also use an extra subsection argument with arbitrary named sections: @samp{.section @var{name}, @var{expression}}. @end ifset +@ifset ELF +@ifset GENERIC +When generating ELF output, you +@end ifset +@ifclear GENERIC +You +@end ifclear +can also use the @code{.subsection} directive (@pxref{SubSection}) +to specify a subsection: @samp{.subsection @var{expression}}. +@end ifset @var{Expression} should be an absolute expression. (@xref{Expressions}.) If you just say @samp{.text} then @samp{.text 0} is assumed. Likewise @samp{.data} means @samp{.data 0}. Assembly @@ -3091,7 +3167,9 @@ provides a special directive @code{.label} for defining labels more flexibly. A symbol can be given an arbitrary value by writing a symbol, followed by an equals sign @samp{=}, followed by an expression (@pxref{Expressions}). This is equivalent to using the @code{.set} -directive. @xref{Set,,@code{.set}}. +directive. @xref{Set,,@code{.set}}. In the same way, using a double +equals sign @samp{=}@samp{=} here represents an equivalent of the +@code{.eqv} directive. @xref{Eqv,,@code{.eqv}}. @node Symbol Names @section Symbol Names @@ -3105,15 +3183,10 @@ noted in @ref{Machine Dependencies}. That character may be followed by any string of digits, letters, dollar signs (unless otherwise noted in @ref{Machine Dependencies}), and underscores. @end ifclear -@ifset A29K -For the AMD 29K family, @samp{?} is also allowed in the -body of a symbol name, though not at its beginning. -@end ifset - @ifset SPECIAL-SYMS @ifset H8 Symbol names begin with a letter or with one of @samp{._}. On the -Renesas SH or the H8/500, you can also use @code{$} in symbol names. That +Renesas SH you can also use @code{$} in symbol names. That character may be followed by any string of digits, letters, dollar signs (save on the H8/300), and underscores. @end ifset @@ -3235,11 +3308,6 @@ directive. Thus, the expression @samp{.=.+4} is the same as saying @ifclear no-space-dir @samp{.space 4}. @end ifclear -@ifset no-space-dir -@ifset A29K -@samp{.block 4}. -@end ifset -@end ifset @node Symbol Attributes @section Symbol Attributes @@ -3389,8 +3457,8 @@ respectively, with @code{.val} and @code{.type}. @cindex auxiliary attributes, COFF symbols The @command{@value{AS}} directives @code{.dim}, @code{.line}, @code{.scl}, -@code{.size}, and @code{.tag} can generate auxiliary symbol table -information for COFF. +@code{.size}, @code{.tag}, and @code{.weak} can generate auxiliary symbol +table information for COFF. @end ifset @ifset SOM @@ -3549,12 +3617,10 @@ Highest Precedence @item % @dfn{Remainder}. -@item < -@itemx << +@item << @dfn{Shift Left}. Same as the C operator @samp{<<}. -@item > -@itemx >> +@item >> @dfn{Shift Right}. Same as the C operator @samp{>>}. @end table @@ -3603,14 +3669,15 @@ You may not subtract arguments from different sections. @item == @dfn{Is Equal To} @item <> +@itemx != @dfn{Is Not Equal To} @item < @dfn{Is Less Than} -@itemx > +@item > @dfn{Is Greater Than} -@itemx >= +@item >= @dfn{Is Greater Than Or Equal To} -@itemx <= +@item <= @dfn{Is Less Than Or Equal To} The comparison operators can be used as infix operators. A true results has a @@ -3666,6 +3733,7 @@ Some machine configurations provide additional directives. @end ifset * Align:: @code{.align @var{abs-expr} , @var{abs-expr}} +* Altmacro:: @code{.altmacro} * Ascii:: @code{.ascii "@var{string}"}@dots{} * Asciz:: @code{.asciz "@var{string}"}@dots{} * Balign:: @code{.balign @var{abs-expr} , @var{abs-expr}} @@ -3698,7 +3766,9 @@ Some machine configurations provide additional directives. * Endif:: @code{.endif} * Equ:: @code{.equ @var{symbol}, @var{expression}} * Equiv:: @code{.equiv @var{symbol}, @var{expression}} +* Eqv:: @code{.eqv @var{symbol}, @var{expression}} * Err:: @code{.err} +* Error:: @code{.error @var{string}} * Exitm:: @code{.exitm} * Extern:: @code{.extern} * Fail:: @code{.fail} @@ -3732,9 +3802,12 @@ Some machine configurations provide additional directives. * Line:: @code{.line @var{line-number}} @end ifclear -* Ln:: @code{.ln @var{line-number}} * Linkonce:: @code{.linkonce [@var{type}]} * List:: @code{.list} +* Ln:: @code{.ln @var{line-number}} + +* LNS directives:: @code{.file}, @code{.loc}, etc. + * Long:: @code{.long @var{expressions}} @ignore * Lsym:: @code{.lsym @var{symbol}, @var{expression}} @@ -3742,6 +3815,7 @@ Some machine configurations provide additional directives. * Macro:: @code{.macro @var{name} @var{args}}@dots{} * MRI:: @code{.mri @var{val}} +* Noaltmacro:: @code{.noaltmacro} * Nolist:: @code{.nolist} * Octa:: @code{.octa @var{bignums}} * Org:: @code{.org @var{new-lc} , @var{fill}} @@ -3812,9 +3886,11 @@ Some machine configurations provide additional directives. * Version:: @code{.version "@var{string}"} * VTableEntry:: @code{.vtable_entry @var{table}, @var{offset}} * VTableInherit:: @code{.vtable_inherit @var{child}, @var{parent}} -* Weak:: @code{.weak @var{names}} @end ifset +* Warning:: @code{.warning @var{string}} +* Weak:: @code{.weak @var{names}} +* Weakref:: @code{.weakref @var{alias}, @var{symbol}} * Word:: @code{.word @var{expressions}} * Deprecated:: Deprecated Directives @end menu @@ -3868,7 +3944,7 @@ required alignment; this can be useful if you want the alignment to be filled with no-op instructions when appropriate. The way the required alignment is specified varies from system to system. -For the a29k, arc, hppa, i386 using ELF, i860, iq2000, m68k, m88k, or32, +For the arc, hppa, i386 using ELF, i860, iq2000, m68k, or32, s390, sparc, tic4x, tic80 and xtensa, the first expression is the alignment request in bytes. For example @samp{.align 8} advances the location counter until it is a multiple of 8. If the location counter @@ -4026,6 +4102,9 @@ using the known displacement of the CFA register from the CFA. This is often easier to use, because the number will match the code it's annotating. +@section @code{.cfi_signal_frame} +Mark current function as signal trampoline. + @section @code{.cfi_window_save} SPARC register window has been saved. @@ -4034,6 +4113,61 @@ Allows the user to add arbitrary bytes to the unwind info. One might use this to add OS-specific CFI opcodes, or generic CFI opcodes that GAS does not yet support. +@node LNS directives +@section @code{.file @var{fileno} @var{filename}} +@cindex @code{file} directive +When emitting dwarf2 line number information @code{.file} assigns filenames +to the @code{.debug_line} file name table. The @var{fileno} operand should +be a unique positive integer to use as the index of the entry in the table. +The @var{filename} operand is a C string literal. + +The detail of filename indicies is exposed to the user because the filename +table is shared with the @code{.debug_info} section of the dwarf2 debugging +information, and thus the user must know the exact indicies that table +entries will have. + +@section @code{.loc @var{fileno} @var{lineno} [@var{column}] [@var{options}]} +@cindex @code{loc} directive +The @code{.loc} directive will add row to the @code{.debug_line} line +number matrix corresponding to the immediately following assembly +instruction. The @var{fileno}, @var{lineno}, and optional @var{column} +arguments will be applied to the @code{.debug_line} state machine before +the row is added. + +The @var{options} are a sequence of the following tokens in any order: + +@table @code +@item basic_block +This option will set the @code{basic_block} register in the +@code{.debug_line} state machine to @code{true}. + +@item prologue_end +This option will set the @code{prologue_end} register in the +@code{.debug_line} state machine to @code{true}. + +@item epilogue_begin +This option will set the @code{epilogue_begin} register in the +@code{.debug_line} state machine to @code{true}. + +@item is_stmt @var{value} +This option will set the @code{is_stmt} register in the +@code{.debug_line} state machine to @code{value}, which must be +either 0 or 1. + +@item isa @var{value} +This directive will set the @code{isa} register in the @code{.debug_line} +state machine to @var{value}, which must be an unsigned integer. + +@end table + +@section @code{.loc_mark_blocks @var{enable}} +@cindex @code{loc_mark_blocks} directive +The @code{.loc_mark_blocks} directive makes the assembler emit an entry +to the @code{.debug_line} line number matrix with the @code{basic_block} +register in the state machine set whenever a code label is seen. +The @var{enable} argument should be either 1 or 0, to enable or disable +this function respectively. + @node Data @section @code{.data @var{subsection}} @@ -4189,6 +4323,14 @@ The syntax for @code{equ} on the HPPA is @samp{@var{symbol} .equ @var{expression}}. @end ifset +@ifset Z80 +The syntax for @code{equ} on the Z80 is +@samp{@var{symbol} equ @var{expression}}. +On the Z80 it is an eror if @var{symbol} is already defined, +but the symbol is not protected from later redefinition, +compare @xref{Equiv}. +@end ifset + @node Equiv @section @code{.equiv @var{symbol}, @var{expression}} @cindex @code{equiv} directive @@ -4204,13 +4346,35 @@ Except for the contents of the error message, this is roughly equivalent to .endif .equ SYM,VAL @end smallexample +plus it protects the symbol from later redefinition. + +@node Eqv +@section @code{.eqv @var{symbol}, @var{expression}} +@cindex @code{eqv} directive +The @code{.eqv} directive is like @code{.equiv}, but no attempt is made to +evaluate the expression or any part of it immediately. Instead each time +the resulting symbol is used in an expression, a snapshot of its current +value is taken. @node Err @section @code{.err} @cindex @code{err} directive If @command{@value{AS}} assembles a @code{.err} directive, it will print an error message and, unless the @option{-Z} option was used, it will not generate an -object file. This can be used to signal error an conditionally compiled code. +object file. This can be used to signal an error in conditionally compiled code. + +@node Error +@section @code{.error "@var{string}"} +@cindex error directive + +Similarly to @code{.err}, this directive emits an error, but you can specify a +string that will be emitted as the error message. If you don't specify the +message, it defaults to @code{".error directive invoked in source file"}. +@xref{Errors, ,Error and Warning Messages}. + +@smallexample + .error "This code has not been assembled and tested." +@end smallexample @node Exitm @section @code{.exitm} @@ -4247,10 +4411,6 @@ recognized whether or not it is surrounded by quotes @samp{"}; but if you wish to specify an empty file name, you must give the quotes--@code{""}. This statement may go away in future: it is only recognized to be compatible with old @command{@value{AS}} programs. -@ifset A29K -In some configurations of @command{@value{AS}}, @code{.file} has already been -removed to avoid conflicts with other assemblers. @xref{Machine Dependencies}. -@end ifset @end ifclear @node Fill @@ -4333,7 +4493,7 @@ partial programs. You may need the HPPA-only @code{.EXPORT} directive as well. @cindex @code{hidden} directive @cindex visibility -This one of the ELF visibility directives. The other two are +This is one of the ELF visibility directives. The other two are @code{.internal} (@pxref{Internal,,@code{.internal}}) and @code{.protected} (@pxref{Protected,,@code{.protected}}). @@ -4370,10 +4530,14 @@ This directive is a synonym for both @samp{.short} and @samp{.word}. @section @code{.ident} @cindex @code{ident} directive -This directive is used by some assemblers to place tags in object files. -@command{@value{AS}} simply accepts the directive for source-file -compatibility with such assemblers, but does not actually emit anything -for it. + +This directive is used by some assemblers to place tags in object files. The +behavior of this directive varies depending on the target. When using the +a.out object file format, @command{@value{AS}} simply accepts the directive for +source-file compatibility with existing assemblers, but does not emit anything +for it. When using COFF, comments are emitted to the @code{.comment} or +@code{.rdata} section, depending on the target. When using ELF, comments are +emitted to the @code{.comment} section. @node If @section @code{.if @var{absolute expression}} @@ -4397,6 +4561,10 @@ Assembles the following section of code if the specified @var{symbol} has been defined. Note a symbol which has been referenced but not yet defined is considered to be undefined. +@cindex @code{ifb} directive +@item .ifb @var{text} +Assembles the following section of code if the operand is blank (empty). + @cindex @code{ifc} directive @item .ifc @var{string1},@var{string2} Assembles the following section of code if the two strings are the same. The @@ -4431,6 +4599,11 @@ to zero. @item .iflt @var{absolute expression} Assembles the following section of code if the argument is less than zero. +@cindex @code{ifnb} directive +@item .ifnb @var{text} +Like @code{.ifb}, but the sense of the test is reversed: this assembles the +following section of code if the operand is non-blank (non-empty). + @cindex @code{ifnc} directive @item .ifnc @var{string1},@var{string2}. Like @code{.ifc}, but the sense of the test is reversed: this assembles the @@ -4497,7 +4670,7 @@ of target the assembly is for. @ifclear GENERIC @ifset H8 -On the H8/500 and most forms of the H8/300, @code{.int} emits 16-bit +On most forms of the H8/300, @code{.int} emits 16-bit integers. On the H8/300H and the Renesas SH, however, @code{.int} emits 32-bit integers. @end ifset @@ -4509,7 +4682,7 @@ integers. On the H8/300H and the Renesas SH, however, @code{.int} emits @cindex @code{internal} directive @cindex visibility -This one of the ELF visibility directives. The other two are +This is one of the ELF visibility directives. The other two are @code{.hidden} (@pxref{Hidden,,@code{.hidden}}) and @code{.protected} (@pxref{Protected,,@code{.protected}}). @@ -4548,6 +4721,9 @@ is equivalent to assembling move d3,sp@@- @end example +For some caveats with the spelling of @var{symbol}, see also the discussion +at @xref{Macro}. + @node Irpc @section @code{.irpc @var{symbol},@var{values}}@dots{} @@ -4576,6 +4752,9 @@ is equivalent to assembling move d3,sp@@- @end example +For some caveats with the spelling of @var{symbol}, see also the discussion +at @xref{Macro}. + @node Lcomm @section @code{.lcomm @var{symbol} , @var{length}} @@ -4627,12 +4806,6 @@ reported as on logical line number @var{line-number} @minus{} 1. One day @command{@value{AS}} will no longer support this directive: it is recognized only for compatibility with existing assembler programs. -@ifset GENERIC -@ifset A29K -@emph{Warning:} In the AMD29K configuration of @value{AS}, this command is -not available; use the synonym @code{.ln} in that context. -@end ifset -@end ifset @end ifset @ifclear no-line-dir @@ -4792,9 +4965,14 @@ With that definition, @samp{SUM 0,5} is equivalent to this assembly input: @cindex @code{macro} directive Begin the definition of a macro called @var{macname}. If your macro definition requires arguments, specify their names after the macro name, -separated by commas or spaces. You can supply a default value for any -macro argument by following the name with @samp{=@var{deflt}}. For -example, these are all valid @code{.macro} statements: +separated by commas or spaces. You can qualify the macro argument to +indicate whether all invocations must specify a non-blank value (through +@samp{:@code{req}}), or whether it takes all of the remaining arguments +(through @samp{:@code{vararg}}). You can supply a default value for any +macro argument by following the name with @samp{=@var{deflt}}. You +cannot define two macros with the same @var{macname} unless it has been +subject to the @code{.purgem} directive (@xref{Purgem}.) between the two +definitions. For example, these are all valid @code{.macro} statements: @table @code @item .macro comm @@ -4817,10 +4995,42 @@ After the definition is complete, you can call the macro either as @samp{0}, and @samp{\p2} evaluating to @var{b}). @end table +@item .macro m p1:req, p2=0, p3:vararg +Begin the definition of a macro called @code{m}, with at least three +arguments. The first argument must always have a value specified, but +not the second, which instead has a default value. The third formal +will get assigned all remaining arguments specified at invocation time. + When you call a macro, you can specify the argument values either by position, or by keyword. For example, @samp{sum 9,17} is equivalent to @samp{sum to=17, from=9}. +Note that since each of the @var{macargs} can be an identifier exactly +as any other one permitted by the target architecture, there may be +occasional problems if the target hand-crafts special meanings to certain +characters when they occur in a special position. For example, if colon +(@code{:}) is generally permitted to be part of a symbol name, but the +architecture specific code special-cases it when occuring as the final +character of a symbol (to denote a label), then the macro parameter +replacement code will have no way of knowing that and consider the whole +construct (including the colon) an identifier, and check only this +identifier for being the subject to parameter substitution. In this +example, besides the potential of just separating identifier and colon +by white space, using alternate macro syntax (@xref{Altmacro}.) and +ampersand (@code{&}) as the character to separate literal text from macro +parameters (or macro parameters from one another) would provide a way to +achieve the same effect: + +@example + .altmacro + .macro label l +l&: + .endm +@end example + +This applies identically to the identifiers used in @code{.irp} (@xref{Irp}.) +and @code{.irpc} (@xref{Irpc}.). + @item .endm @cindex @code{endm} directive Mark the end of a macro definition. @@ -4836,20 +5046,52 @@ Exit early from the current macro definition. executed in this pseudo-variable; you can copy that number to your output with @samp{\@@}, but @emph{only within a macro definition}. -@ignore @item LOCAL @var{name} [ , @dots{} ] @emph{Warning: @code{LOCAL} is only available if you select ``alternate -macro syntax'' with @samp{-a} or @samp{--alternate}.} @xref{Alternate,, -Alternate macro syntax}. +macro syntax'' with @samp{--alternate} or @code{.altmacro}.} +@xref{Altmacro,,@code{.altmacro}}. +@end ftable -Generate a string replacement for each of the @var{name} arguments, and +@node Altmacro +@section @code{.altmacro} +Enable alternate macro mode, enabling: + +@ftable @code +@item LOCAL @var{name} [ , @dots{} ] +One additional directive, @code{LOCAL}, is available. It is used to +generate a string replacement for each of the @var{name} arguments, and replace any instances of @var{name} in each macro expansion. The replacement string is unique in the assembly, and different for each separate macro expansion. @code{LOCAL} allows you to write macros that define symbols, without fear of conflict between separate macro expansions. -@end ignore + +@item String delimiters +You can write strings delimited in these other ways besides +@code{"@var{string}"}: + +@table @code +@item '@var{string}' +You can delimit strings with single-quote charaters. + +@item <@var{string}> +You can delimit strings with matching angle brackets. +@end table + +@item single-character string escape +To include any single character literally in a string (even if the +character would otherwise have some special meaning), you can prefix the +character with @samp{!} (an exclamation mark). For example, you can +write @samp{<4.3 !> 5.4!!>} to get the literal text @samp{4.3 > 5.4!}. + +@item Expression results as strings +You can write @samp{%@var{expr}} to evaluate the expression @var{expr} +and use the result as a string. @end ftable +@node Noaltmacro +@section @code{.noaltmacro} +Disable alternate macro mode. @ref{Altmacro} + @node Nolist @section @code{.nolist} @@ -4996,7 +5238,7 @@ assembly. You must put @var{string} in double quotes. @cindex @code{protected} directive @cindex visibility -This one of the ELF visibility directives. The other two are +This is one of the ELF visibility directives. The other two are @code{.hidden} (@pxref{Hidden}) and @code{.internal} (@pxref{Internal}). This directive overrides the named symbols default visibility (which is set by @@ -5045,9 +5287,9 @@ This is one of the ELF section stack manipulation directives. The others are @code{.popsection} (@pxref{PopSection}), and @code{.previous} (@pxref{Previous}). -This directive is a synonym for @code{.section}. It pushes the current section -(and subsection) onto the top of the section stack, and then replaces the -current section and subsection with @code{name} and @code{subsection}. +This directive pushes the current section (and subsection) onto the +top of the section stack, and then replaces the current section and +subsection with @code{name} and @code{subsection}. @end ifset @node Quad @@ -5200,7 +5442,7 @@ This is one of the ELF section stack manipulation directives. The others are For ELF targets, the @code{.section} directive is used like this: @smallexample -.section @var{name} [, "@var{flags}"[, @@@var{type}[, @@@var{entsize}]]] +.section @var{name} [, "@var{flags}"[, @@@var{type}[,@var{flag_specific_arguments}]]] @end smallexample The optional @var{flags} argument is a quoted string which may contain any @@ -5216,6 +5458,10 @@ section is executable section is mergeable @item S section contains zero terminated strings +@item G +section is a member of a section group +@item T +section is used for thread-local-storage @end table The optional @var{type} argument may contain one of the following constants: @@ -5224,18 +5470,58 @@ The optional @var{type} argument may contain one of the following constants: section contains data @item @@nobits section does not contain data (i.e., section only occupies space) +@item @@note +section contains data which is used by things other than the program +@item @@init_array +section contains an array of pointers to init functions +@item @@fini_array +section contains an array of pointers to finish functions +@item @@preinit_array +section contains an array of pointers to pre-init functions @end table +Many targets only support the first three section types. + Note on targets where the @code{@@} character is the start of a comment (eg ARM) then another character is used instead. For example the ARM port uses the @code{%} character. -If @var{flags} contains @code{M} flag, @var{type} argument must be specified -as well as @var{entsize} argument. Sections with @code{M} flag but not -@code{S} flag must contain fixed size constants, each @var{entsize} octets -long. Sections with both @code{M} and @code{S} must contain zero terminated -strings where each character is @var{entsize} bytes long. The linker may remove -duplicates within sections with the same name, same entity size and same flags. +If @var{flags} contains the @code{M} symbol then the @var{type} argument must +be specified as well as an extra argument - @var{entsize} - like this: + +@smallexample +.section @var{name} , "@var{flags}"M, @@@var{type}, @var{entsize} +@end smallexample + +Sections with the @code{M} flag but not @code{S} flag must contain fixed size +constants, each @var{entsize} octets long. Sections with both @code{M} and +@code{S} must contain zero terminated strings where each character is +@var{entsize} bytes long. The linker may remove duplicates within sections with +the same name, same entity size and same flags. @var{entsize} must be an +absolute expression. + +If @var{flags} contains the @code{G} symbol then the @var{type} argument must +be present along with an additional field like this: + +@smallexample +.section @var{name} , "@var{flags}"G, @@@var{type}, @var{GroupName}[, @var{linkage}] +@end smallexample + +The @var{GroupName} field specifies the name of the section group to which this +particular section belongs. The optional linkage field can contain: +@table @code +@item comdat +indicates that only one copy of this section should be retained +@item .gnu.linkonce +an alias for comdat +@end table + +Note - if both the @var{M} and @var{G} flags are present then the fields for +the Merge flag should come first, like this: + +@smallexample +.section @var{name} , "@var{flags}"MG, @@@var{type}, @var{entsize}, @var{GroupName}[, @var{linkage}] +@end smallexample If no flags are specified, the default flags depend upon the section name. If the section name is not recognized, the default will be for the section to have @@ -5258,12 +5544,14 @@ section is allocatable section is writable @item #execinstr section is executable +@item #tls +section is used for thread local storage @end table -This directive replaces the current section and subsection. The replaced -section and subsection are pushed onto the section stack. See the contents of -the gas testsuite directory @code{gas/testsuite/gas/elf} for some examples of -how this directive and the other section stack directives work. +This directive replaces the current section and subsection. See the +contents of the gas testsuite directory @code{gas/testsuite/gas/elf} for +some examples of how this directive and the other section stack directives +work. @end ifset @end ifset @@ -5287,6 +5575,11 @@ The syntax for @code{set} on the HPPA is @samp{@var{symbol} .set @var{expression}}. @end ifset +@ifset Z80 +On Z80 @code{set} is a real instruction, use +@samp{@var{symbol} defl @var{expression}} instead. +@end ifset + @node Short @section @code{.short @var{expressions}} @@ -5413,21 +5706,6 @@ for a summary. @end ifset @end ifclear -@ifset A29K -@ifclear GENERIC -@node Space -@section @code{.space} -@cindex @code{space} directive -@end ifclear -On the AMD 29K, this directive is ignored; it is accepted for -compatibility with other AMD 29K assemblers. - -@quotation -@emph{Warning:} In most versions of the @sc{gnu} assembler, the directive -@code{.space} has the effect of @code{.block} @xref{Machine Dependencies}. -@end quotation -@end ifset - @ifset have-stabs @node Stab @section @code{.stabd, .stabn, .stabs} @@ -5745,28 +6023,59 @@ formatted note of type NT_VERSION. The note's name is set to @code{string}. @node VTableEntry @section @code{.vtable_entry @var{table}, @var{offset}} -@cindex @code{vtable_entry} +@cindex @code{vtable_entry} directive This directive finds or creates a symbol @code{table} and creates a @code{VTABLE_ENTRY} relocation for it with an addend of @code{offset}. @node VTableInherit @section @code{.vtable_inherit @var{child}, @var{parent}} -@cindex @code{vtable_inherit} +@cindex @code{vtable_inherit} directive This directive finds the symbol @code{child} and finds or creates the symbol @code{parent} and then creates a @code{VTABLE_INHERIT} relocation for the parent whose addend is the value of the child symbol. As a special case the parent name of @code{0} is treated as refering the @code{*ABS*} section. @end ifset -@ifset ELF +@node Warning +@section @code{.warning "@var{string}"} +@cindex warning directive +Similar to the directive @code{.error} +(@pxref{Error,,@code{.error "@var{string}"}}), but just emits a warning. + @node Weak @section @code{.weak @var{names}} @cindex @code{weak} directive This directive sets the weak attribute on the comma separated list of symbol @code{names}. If the symbols do not already exist, they will be created. -@end ifset + +On COFF targets other than PE, weak symbols are a GNU extension. This +directive sets the weak attribute on the comma separated list of symbol +@code{names}. If the symbols do not already exist, they will be created. + +On the PE target, weak symbols are supported natively as weak aliases. +When a weak symbol is created that is not an alias, GAS creates an +alternate symbol to hold the default value. + +@node Weakref +@section @code{.weakref @var{alias}, @var{target}} + +@cindex @code{weakref} directive +This directive creates an alias to the target symbol that enables the symbol to +be referenced with weak-symbol semantics, but without actually making it weak. +If direct references or definitions of the symbol are present, then the symbol +will not be weak, but if all references to it are through weak references, the +symbol will be marked as weak in the symbol table. + +The effect is equivalent to moving all references to the alias to a separate +assembly source file, renaming the alias to the symbol in it, declaring the +symbol as weak there, and running a reloadable link to merge the object files +resulting from the assembly of the new source file and the old source file that +had the references to the alias removed. + +The alias itself never makes to the symbol table, and is entirely handled +within the assembler. @node Word @section @code{.word @var{expressions}} @@ -5864,9 +6173,6 @@ include details on any machine's instruction set. For details on that subject, see the hardware manufacturer's manual. @menu -@ifset A29K -* AMD29K-Dependent:: AMD 29K Dependent Features -@end ifset @ifset ALPHA * Alpha-Dependent:: Alpha Dependent Features @end ifset @@ -5876,6 +6182,9 @@ subject, see the hardware manufacturer's manual. @ifset ARM * ARM-Dependent:: ARM Dependent Features @end ifset +@ifset BFIN +* BFIN-Dependent:: BFIN Dependent Features +@end ifset @ifset CRIS * CRIS-Dependent:: CRIS Dependent Features @end ifset @@ -5888,9 +6197,6 @@ subject, see the hardware manufacturer's manual. @ifset H8/300 * H8/300-Dependent:: Renesas H8/300 Dependent Features @end ifset -@ifset H8/500 -* H8/500-Dependent:: Renesas H8/500 Dependent Features -@end ifset @ifset HPPA * HPPA-Dependent:: HPPA Dependent Features @end ifset @@ -5906,9 +6212,15 @@ subject, see the hardware manufacturer's manual. @ifset I960 * i960-Dependent:: Intel 80960 Dependent Features @end ifset +@ifset IA64 +* IA-64-Dependent:: Intel IA-64 Dependent Features +@end ifset @ifset IP2K * IP2K-Dependent:: IP2K Dependent Features @end ifset +@ifset M32C +* M32C-Dependent:: M32C Dependent Features +@end ifset @ifset M32R * M32R-Dependent:: M32R Dependent Features @end ifset @@ -5918,9 +6230,6 @@ subject, see the hardware manufacturer's manual. @ifset M68HC11 * M68HC11-Dependent:: M68HC11 and 68HC12 Dependent Features @end ifset -@ifset M880X0 -* M88K-Dependent:: M880x0 Dependent Features -@end ifset @ifset MIPS * MIPS-Dependent:: MIPS Dependent Features @end ifset @@ -5955,6 +6264,9 @@ subject, see the hardware manufacturer's manual. @ifset XTENSA * Xtensa-Dependent:: Xtensa Dependent Features @end ifset +@ifset Z80 +* Z80-Dependent:: Z80 Dependent Features +@end ifset @ifset Z8000 * Z8000-Dependent:: Z8000 Dependent Features @end ifset @@ -5974,10 +6286,6 @@ subject, see the hardware manufacturer's manual. @c node and sectioning commands; hence the repetition of @chapter BLAH @c in both conditional blocks. -@ifset A29K -@include c-a29k.texi -@end ifset - @ifset ALPHA @include c-alpha.texi @end ifset @@ -5990,6 +6298,10 @@ subject, see the hardware manufacturer's manual. @include c-arm.texi @end ifset +@ifset BFIN +@include c-bfin.texi +@end ifset + @ifset CRIS @include c-cris.texi @end ifset @@ -6006,7 +6318,6 @@ family. @menu * H8/300-Dependent:: Renesas H8/300 Dependent Features -* H8/500-Dependent:: Renesas H8/500 Dependent Features * SH-Dependent:: Renesas SH Dependent Features @end menu @lowersections @@ -6025,10 +6336,6 @@ family. @include c-h8300.texi @end ifset -@ifset H8/500 -@include c-h8500.texi -@end ifset - @ifset HPPA @include c-hppa.texi @end ifset @@ -6057,6 +6364,10 @@ family. @include c-ip2k.texi @end ifset +@ifset M32C +@include c-m32c.texi +@end ifset + @ifset M32R @include c-m32r.texi @end ifset @@ -6069,10 +6380,6 @@ family. @include c-m68hc11.texi @end ifset -@ifset M880X0 -@include c-m88k.texi -@end ifset - @ifset MIPS @include c-mips.texi @end ifset @@ -6114,6 +6421,10 @@ family. @include c-tic54x.texi @end ifset +@ifset Z80 +@include c-z80.texi +@end ifset + @ifset Z8000 @include c-z8k.texi @end ifset @@ -6340,7 +6651,7 @@ things without first using the debugger to find the facts. @node Acknowledgements @chapter Acknowledgements -If you have contributed to @command{@value{AS}} and your name isn't listed here, +If you have contributed to GAS and your name isn't listed here, it is not meant as a slight. We just don't know about it. Send mail to the maintainer, and we'll correct the situation. Currently @c (January 1994), @@ -6382,8 +6693,8 @@ Keith Knowles at the Open Software Foundation wrote the original MIPS back end (which hasn't been merged in yet). Ralph Campbell worked with the MIPS code to support a.out format. -Support for the Zilog Z8k and Renesas H8/300 and H8/500 processors (tc-z8k, -tc-h8300, tc-h8500), and IEEE 695 object file format (obj-ieee), was written by +Support for the Zilog Z8k and Renesas H8/300 processors (tc-z8k, +tc-h8300), and IEEE 695 object file format (obj-ieee), was written by Steve Chamberlain of Cygnus Support. Steve also modified the COFF back end to use BFD for some low-level operations, for use with the H8/300 and AMD 29k targets. @@ -6401,7 +6712,7 @@ Ian Lance Taylor of Cygnus Support merged the Motorola and MIT syntax for the added support for MIPS ECOFF and ELF targets, wrote the initial RS/6000 and PowerPC assembler, and made a few other minor patches. -Steve Chamberlain made @command{@value{AS}} able to generate listings. +Steve Chamberlain made GAS able to generate listings. Hewlett-Packard contributed support for the HP9000/300. diff --git a/contrib/binutils/gas/doc/c-alpha.texi b/contrib/binutils/gas/doc/c-alpha.texi index 0aee06b2d8b..f426b822828 100644 --- a/contrib/binutils/gas/doc/c-alpha.texi +++ b/contrib/binutils/gas/doc/c-alpha.texi @@ -1,4 +1,4 @@ -@c Copyright 2002 +@c Copyright 2002, 2003 @c Free Software Foundation, Inc. @c This is part of the GAS manual. @c For copying conditions, see the file as.texinfo. @@ -203,6 +203,12 @@ Used with a register branch format instruction (e.g.@: @code{jsr}) to indicate that the literal is used for a call. During relaxation, the code may be altered to use a direct branch (e.g.@: @code{bsr}). +@item !lituse_jsrdirect!@var{N} +Similar to @code{lituse_jsr}, but also that this call cannot be vectored +through a PLT entry. This is useful for functions with special calling +conventions which do not allow the normal call-clobbered registers to be +clobbered. + @item !lituse_bytoff!@var{N} Used with a byte mask instruction (e.g.@: @code{extbl}) to indicate that only the low 3 bits of the address are relevant. During relaxation, diff --git a/contrib/binutils/gas/doc/c-arc.texi b/contrib/binutils/gas/doc/c-arc.texi index 700a01d15d8..04544d1e495 100644 --- a/contrib/binutils/gas/doc/c-arc.texi +++ b/contrib/binutils/gas/doc/c-arc.texi @@ -1,4 +1,4 @@ -@c Copyright 2000, 2001 Free Software Foundation, Inc. +@c Copyright 2000, 2001, 2005 Free Software Foundation, Inc. @c This is part of the GAS manual. @c For copying conditions, see the file as.texinfo. @@ -34,7 +34,7 @@ @cindex @code{-marc[5|6|7|8]} command line option, ARC @item -marc[5|6|7|8] -This option selects the core processor variant. Using +This option selects the core processor variant. Using @code{-marc} is the same as @code{-marc@value{ARC_CORE_DEFAULT}}, which is also the default. @@ -46,8 +46,8 @@ Base instruction set. @cindex @code{arc6} arc6, ARC @item arc6 -Jump-and-link (jl) instruction. No requirement of an instruction between -setting flags and conditional jump. For example: +Jump-and-link (jl) instruction. No requirement of an instruction between +setting flags and conditional jump. For example: @smallexample mov.f r0,r1 @@ -137,36 +137,161 @@ machine directives: @cindex @code{extAuxRegister} directive, ARC @item .extAuxRegister @var{name},@var{address},@var{mode} -*TODO* +The ARCtangent A4 has extensible auxiliary register space. The +auxiliary registers can be defined in the assembler source code by +using this directive. The first parameter is the @var{name} of the +new auxiallry register. The second parameter is the @var{address} of +the register in the auxiliary register memory map for the variant of +the ARC. The third parameter specifies the @var{mode} in which the +register can be operated is and it can be one of: + +@table @code +@item r (readonly) +@item w (write only) +@item r|w (read or write) +@end table + +For example: @smallexample .extAuxRegister mulhi,0x12,w @end smallexample +This specifies an extension auxiliary register called @emph{mulhi} +which is at address 0x12 in the memory space and which is only +writable. + @cindex @code{extCondCode} directive, ARC @item .extCondCode @var{suffix},@var{value} -*TODO* +The condition codes on the ARCtangent A4 are extensible and can be +specified by means of this assembler directive. They are specified +by the suffix and the value for the condition code. They can be used to +specify extra condition codes with any values. For example: @smallexample .extCondCode is_busy,0x14 + + add.is_busy r1,r2,r3 + bis_busy _main @end smallexample @cindex @code{extCoreRegister} directive, ARC @item .extCoreRegister @var{name},@var{regnum},@var{mode},@var{shortcut} -*TODO* +Specifies an extension core register @var{name} for the application. +This allows a register @var{name} with a valid @var{regnum} between 0 +and 60, with the following as valid values for @var{mode} + +@table @samp +@item @emph{r} (readonly) +@item @emph{w} (write only) +@item @emph{r|w} (read or write) +@end table + + +The other parameter gives a description of the register having a +@var{shortcut} in the pipeline. The valid values are: + +@table @code +@item can_shortcut +@item cannot_shortcut +@end table + +For example: @smallexample .extCoreRegister mlo,57,r,can_shortcut @end smallexample +This defines an extension core register mlo with the value 57 which +can shortcut the pipeline. + @cindex @code{extInstruction} directive, ARC @item .extInstruction @var{name},@var{opcode},@var{subopcode},@var{suffixclass},@var{syntaxclass} -*TODO* +The ARCtangent A4 allows the user to specify extension instructions. +The extension instructions are not macros. The assembler creates +encodings for use of these instructions according to the specification +by the user. The parameters are: + +@table @bullet +@item @var{name} +Name of the extension instruction + +@item @var{opcode} +Opcode to be used. (Bits 27:31 in the encoding). Valid values +0x10-0x1f or 0x03 + +@item @var{subopcode} +Subopcode to be used. Valid values are from 0x09-0x3f. However the +correct value also depends on @var{syntaxclass} + +@item @var{suffixclass} +Determines the kinds of suffixes to be allowed. Valid values are +@code{SUFFIX_NONE}, @code{SUFFIX_COND}, +@code{SUFFIX_FLAG} which indicates the absence or presence of +conditional suffixes and flag setting by the extension instruction. +It is also possible to specify that an instruction sets the flags and +is conditional by using @code{SUFFIX_CODE} | @code{SUFFIX_FLAG}. + +@item @var{syntaxclass} +Determines the syntax class for the instruction. It can have the +following values: + +@table @code +@item @code{SYNTAX_2OP}: +2 Operand Instruction +@item @code{SYNTAX_3OP}: +3 Operand Instruction +@end table + +In addition there could be modifiers for the syntax class as described +below: + +@itemize @minus +Syntax Class Modifiers are: + +@item @code{OP1_MUST_BE_IMM}: +Modifies syntax class SYNTAX_3OP, specifying that the first operand +of a three-operand instruction must be an immediate (i.e. the result +is discarded). OP1_MUST_BE_IMM is used by bitwise ORing it with +SYNTAX_3OP as given in the example below. This could usually be used +to set the flags using specific instructions and not retain results. + +@item @code{OP1_IMM_IMPLIED}: +Modifies syntax class SYNTAX_20P, it specifies that there is an +implied immediate destination operand which does not appear in the +syntax. For example, if the source code contains an instruction like: @smallexample - .extInstruction mul64,0x14,0x0,SUFFIX_COND,SYNTAX_3OP|OP1_MUST_BE_IMM +inst r1,r2 @end smallexample +it really means that the first argument is an implied immediate (that +is, the result is discarded). This is the same as though the source +code were: inst 0,r1,r2. You use OP1_IMM_IMPLIED by bitwise ORing it +with SYNTAX_20P. + +@end itemize +@end table + +For example, defining 64-bit multiplier with immediate operands: + +@smallexample +.extInstruction mp64,0x14,0x0,SUFFIX_COND | SUFFIX_FLAG , + SYNTAX_3OP|OP1_MUST_BE_IMM +@end smallexample + +The above specifies an extension instruction called mp64 which has 3 operands, +sets the flags, can be used with a condition code, for which the +first operand is an immediate. (Equivalent to discarding the result +of the operation). + +@smallexample + .extInstruction mul64,0x14,0x00,SUFFIX_COND, SYNTAX_2OP|OP1_IMM_IMPLIED +@end smallexample + +This describes a 2 operand instruction with an implicit first +immediate operand. The result of this operation would be discarded. + @cindex @code{half} directive, ARC @item .half @var{expressions} *TODO* @@ -204,4 +329,5 @@ between the two - even for the implicit default core version @cindex opcodes for ARC For information on the ARC instruction set, see @cite{ARC Programmers -Reference Manual}, ARC Cores Ltd. +Reference Manual}, ARC International (www.arc.com) + diff --git a/contrib/binutils/gas/doc/c-arm.texi b/contrib/binutils/gas/doc/c-arm.texi index 23cd7bb3fef..ca0998bea66 100644 --- a/contrib/binutils/gas/doc/c-arm.texi +++ b/contrib/binutils/gas/doc/c-arm.texi @@ -1,4 +1,4 @@ -@c Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2003 +@c Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 @c Free Software Foundation, Inc. @c This is part of the GAS manual. @c For copying conditions, see the file as.texinfo. @@ -67,6 +67,7 @@ recognized: @code{arm7500fe}, @code{arm7t}, @code{arm7tdmi}, +@code{arm7tdmi-s}, @code{arm8}, @code{arm810}, @code{strongarm}, @@ -82,19 +83,33 @@ recognized: @code{arm9tdmi}, @code{arm9e}, @code{arm926e}, -@code{arm926ejs}, +@code{arm926ej-s}, @code{arm946e-r0}, @code{arm946e}, +@code{arm946e-s}, @code{arm966e-r0}, @code{arm966e}, +@code{arm966e-s}, +@code{arm968e-s}, @code{arm10t}, +@code{arm10tdmi}, @code{arm10e}, @code{arm1020}, @code{arm1020t}, @code{arm1020e}, -@code{arm1026ejs}, -@code{arm1136js}, -@code{arm1136jfs}, +@code{arm1022e}, +@code{arm1026ej-s}, +@code{arm1136j-s}, +@code{arm1136jf-s}, +@code{arm1156t2-s}, +@code{arm1156t2f-s}, +@code{arm1176jz-s}, +@code{arm1176jzf-s}, +@code{mpcore}, +@code{mpcorenovfp}, +@code{cortex-a8}, +@code{cortex-r4}, +@code{cortex-m3}, @code{ep9312} (ARM920 with Cirrus Maverick coprocessor), @code{i80200} (Intel XScale processor) @code{iwmmxt} (Intel(r) XScale processor with Wireless MMX(tm) technology coprocessor) @@ -136,6 +151,13 @@ names are recognized: @code{armv5texp}, @code{armv6}, @code{armv6j}, +@code{armv6k}, +@code{armv6z}, +@code{armv6zk}, +@code{armv7}, +@code{armv7a}, +@code{armv7r}, +@code{armv7m}, @code{iwmmxt} and @code{xscale}. @@ -170,7 +192,7 @@ The following format options are recognized: @code{vfpxd}, @code{arm1020t}, @code{arm1020e}, -@code{arm1136jfs} +@code{arm1136jf-s} and @code{maverick}. @@ -228,6 +250,16 @@ The following values are recognized: and @code{hard}. +@cindex @code{-eabi=} command line option, ARM +@item -meabi=@var{ver} +This option specifies which EABI version the produced object files should +conform to. +The following values are recognised: +@code{gnu}, +@code{4} +and +@code{5}. + @cindex @code{-EB} command line option, ARM @item -EB This option specifies that the output generated by the assembler should @@ -244,13 +276,6 @@ be marked as being encoded for a little-endian processor. This option specifies that the output of the assembler should be marked as position-independent code (PIC). -@cindex @code{-moabi} command line option, ARM -@item -moabi -This indicates that the code should be assembled using the old ARM ELF -conventions, based on a beta release release of the ARM-ELF -specifications, rather than the default conventions which are based on -the final release of the ARM-ELF specifications. - @end table @@ -390,6 +415,125 @@ it prevents accurate control of the placement of literal pools. @item .pool This is a synonym for .ltorg. +@cindex @code{.fnstart} directive, ARM +@item .unwind_fnstart +Marks the start of a function with an unwind table entry. + +@cindex @code{.fnend} directive, ARM +@item .unwind_fnend +Marks the end of a function with an unwind table entry. The unwind index +table entry is created when this directive is processed. + +If no personality routine has been specified then standard personality +routine 0 or 1 will be used, depending on the number of unwind opcodes +required. + +@cindex @code{.cantunwind} directive, ARM +@item .cantunwind +Prevents unwinding through the current function. No personality routine +or exception table data is required or permitted. + +@cindex @code{.personality} directive, ARM +@item .personality @var{name} +Sets the personality routine for the current function to @var{name}. + +@cindex @code{.personalityindex} directive, ARM +@item .personalityindex @var{index} +Sets the personality routine for the current function to the EABI standard +routine number @var{index} + +@cindex @code{.handlerdata} directive, ARM +@item .handlerdata +Marks the end of the current function, and the start of the exception table +entry for that function. Anything between this directive and the +@code{.fnend} directive will be added to the exception table entry. + +Must be preceded by a @code{.personality} or @code{.personalityindex} +directive. + +@cindex @code{.save} directive, ARM +@item .save @var{reglist} +Generate unwinder annotations to restore the registers in @var{reglist}. +The format of @var{reglist} is the same as the corresponding store-multiple +instruction. + +@smallexample +@exdent @emph{core registers} + .save @{r4, r5, r6, lr@} + stmfd sp!, @{r4, r5, r6, lr@} +@exdent @emph{FPA registers} + .save f4, 2 + sfmfd f4, 2, [sp]! +@exdent @emph{VFP registers} + .save @{d8, d9, d10@} + fstmdf sp!, @{d8, d9, d10@} +@exdent @emph{iWMMXt registers} + .save @{wr10, wr11@} + wstrd wr11, [sp, #-8]! + wstrd wr10, [sp, #-8]! +or + .save wr11 + wstrd wr11, [sp, #-8]! + .save wr10 + wstrd wr10, [sp, #-8]! +@end smallexample + +@cindex @code{.pad} directive, ARM +@item .pad #@var{count} +Generate unwinder annotations for a stack adjustment of @var{count} bytes. +A positive value indicates the function prologue allocated stack space by +decrementing the stack pointer. + +@cindex @code{.movsp} directive, ARM +@item .movsp @var{reg} +Tell the unwinder that @var{reg} contains the current stack pointer. + +@cindex @code{.setfp} directive, ARM +@item .setfp @var{fpreg}, @var{spreg} [, #@var{offset}] +Make all unwinder annotations relaive to a frame pointer. Without this +the unwinder will use offsets from the stack pointer. + +The syntax of this directive is the same as the @code{sub} or @code{mov} +instruction used to set the frame pointer. @var{spreg} must be either +@code{sp} or mentioned in a previous @code{.movsp} directive. + +@smallexample +.movsp ip +mov ip, sp +@dots{} +.setfp fp, ip, #4 +sub fp, ip, #4 +@end smallexample + +@cindex @code{.unwind_raw} directive, ARM +@item .raw @var{offset}, @var{byte1}, @dots{} +Insert one of more arbitary unwind opcode bytes, which are known to adjust +the stack pointer by @var{offset} bytes. + +For example @code{.unwind_raw 4, 0xb1, 0x01} is equivalent to +@code{.save @{r0@}} + +@cindex @code{.cpu} directive, ARM +@item .cpu @var{name} +Select the target processor. Valid values for @var{name} are the same as +for the @option{-mcpu} commandline option. + +@cindex @code{.arch} directive, ARM +@item .arch @var{name} +Select the target architecture. Valid values for @var{name} are the same as +for the @option{-march} commandline option. + +@cindex @code{.fpu} directive, ARM +@item .fpu @var{name} +Select the floating point unit to assemble for. Valid values for @var{name} +are the same as for the @option{-mfpu} commandline option. + +@cindex @code{.eabi_attribute} directive, ARM +@item .eabi_attribute @var{tag}, @var{value} +Set the EABI object attribute number @var{tag} to @var{value}. The value +is either a @code{number}, @code{"string"}, or @code{number, "string"} +depending on the tag. + @end table @node ARM Opcodes diff --git a/contrib/binutils/gas/doc/c-i386.texi b/contrib/binutils/gas/doc/c-i386.texi index f0047f93825..81039c4dbe7 100644 --- a/contrib/binutils/gas/doc/c-i386.texi +++ b/contrib/binutils/gas/doc/c-i386.texi @@ -1,4 +1,5 @@ -@c Copyright 1991, 1992, 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001 +@c Copyright 1991, 1992, 1993, 1994, 1995, 1997, 1998, 1999, 2000, +@c 2001, 2003, 2004 @c Free Software Foundation, Inc. @c This is part of the GAS manual. @c For copying conditions, see the file as.texinfo. @@ -66,6 +67,15 @@ usage and use x86-64 as target platform). By default, x86 GAS replaces multiple nop instructions used for alignment within code sections with multi-byte nop instructions such as leal 0(%esi,1),%esi. This switch disables the optimization. + +@cindex @samp{--divide} option, i386 +@item --divide +On SVR4-derived platforms, the character @samp{/} is treated as a comment +character, which means that it cannot be used in expressions. The +@samp{--divide} option turns @samp{/} into a normal character. This does +not disable @samp{/} at the beginning of a line starting a comment, or +affect using @samp{#} for starting a comment. + @end table @node i386-Syntax @@ -227,7 +237,7 @@ The Intel-syntax conversion instructions (x86-64 only), @item -@samp{cdo} --- sign-extend quad in @samp{%rax} to octuple in +@samp{cqo} --- sign-extend quad in @samp{%rax} to octuple in @samp{%rdx:%rax} (x86-64 only), @end itemize @@ -691,15 +701,16 @@ register is @samp{%st(i)}. @cindex x86-64 arch directive @code{@value{AS}} may be told to assemble for a particular CPU -architecture with the @code{.arch @var{cpu_type}} directive. This +(sub-)architecture with the @code{.arch @var{cpu_type}} directive. This directive enables a warning when gas detects an instruction that is not supported on the CPU specified. The choices for @var{cpu_type} are: @multitable @columnfractions .20 .20 .20 .20 @item @samp{i8086} @tab @samp{i186} @tab @samp{i286} @tab @samp{i386} @item @samp{i486} @tab @samp{i586} @tab @samp{i686} @tab @samp{pentium} -@item @samp{pentiumpro} @tab @samp{pentium4} @tab @samp{k6} @tab @samp{athlon} -@item @samp{sledgehammer} +@item @samp{pentiumpro} @tab @samp{pentiumii} @tab @samp{pentiumiii} @tab @samp{pentium4} +@item @samp{k6} @tab @samp{athlon} @samp{sledgehammer} +@item @samp{.mmx} @samp{.sse} @samp{.sse2} @samp{.sse3} @samp{.3dnow} @end multitable Apart from the warning, there are only two other effects on @@ -715,13 +726,14 @@ conditional jumps will be promoted when necessary to a two instruction sequence consisting of a conditional jump of the opposite sense around an unconditional jump to the target. -Following the CPU architecture, you may specify @samp{jumps} or -@samp{nojumps} to control automatic promotion of conditional jumps. -@samp{jumps} is the default, and enables jump promotion; All external -jumps will be of the long variety, and file-local jumps will be promoted -as necessary. (@pxref{i386-Jumps}) @samp{nojumps} leaves external -conditional jumps as byte offset jumps, and warns about file-local -conditional jumps that @code{@value{AS}} promotes. +Following the CPU architecture (but not a sub-architecture, which are those +starting with a dot), you may specify @samp{jumps} or @samp{nojumps} to +control automatic promotion of conditional jumps. @samp{jumps} is the +default, and enables jump promotion; All external jumps will be of the long +variety, and file-local jumps will be promoted as necessary. +(@pxref{i386-Jumps}) @samp{nojumps} leaves external conditional jumps as +byte offset jumps, and warns about file-local conditional jumps that +@code{@value{AS}} promotes. Unconditional jumps are treated as for @samp{jumps}. For example diff --git a/contrib/binutils/gas/doc/c-ia64.texi b/contrib/binutils/gas/doc/c-ia64.texi index b62c05eb88d..6b0f3a9515d 100644 --- a/contrib/binutils/gas/doc/c-ia64.texi +++ b/contrib/binutils/gas/doc/c-ia64.texi @@ -1,4 +1,4 @@ -@c Copyright 2002 +@c Copyright 2002, 2003, 2005 @c Free Software Foundation, Inc. @c Contributed by David Mosberger-Tang @c This is part of the GAS manual. @@ -65,19 +65,49 @@ These options select the byte order. The @code{-mle} option selects little-endi byte order (default) and @code{-mbe} selects big-endian byte order. Note that IA-64 machine code always uses little-endian byte order. +@item -mtune=itanium1 +@item -mtune=itanium2 +Tune for a particular IA-64 CPU, @var{itanium1} or @var{itanium2}. The +default is @var{itanium2}. + +@item -munwind-check=warning +@item -munwind-check=error +These options control what the assembler will do when performing +consistency checks on unwind directives. @code{-munwind-check=warning} +will make the assembler issue a warning when an unwind directive check +fails. This is the default. @code{-munwind-check=error} will make the +assembler issue an error when an unwind directive check fails. + +@item -mhint.b=ok +@item -mhint.b=warning +@item -mhint.b=error +These options control what the assembler will do when the @samp{hint.b} +instruction is used. @code{-mhint.b=ok} will make the assembler accept +@samp{hint.b}. @code{-mint.b=warning} will make the assembler issue a +warning when @samp{hint.b} is used. @code{-mhint.b=error} will make +the assembler treat @samp{hint.b} as an error, which is the default. + @item -x @item -xexplicit -These options turn on dependency violation checking. This checking is turned on by -default. +These options turn on dependency violation checking. @item -xauto This option instructs the assembler to automatically insert stop bits where necessary -to remove dependency violations. +to remove dependency violations. This is the default mode. + +@item -xnone +This option turns off dependency violation checking. @item -xdebug This turns on debug output intended to help tracking down bugs in the dependency violation checker. +@item -xdebugn +This is a shortcut for -xnone -xdebug. + +@item -xdebugx +This is a shortcut for -xexplicit -xdebug. + @end table @cindex IA-64 Syntax @@ -90,7 +120,7 @@ Reference Guide. * IA-64-Chars:: Special Characters * IA-64-Regs:: Register Names * IA-64-Bits:: Bit Names -* IA-64-Relocs:: Relocations +@c * IA-64-Relocs:: Relocations // to be written @end menu @node IA-64-Chars @@ -136,7 +166,7 @@ the end-of-interrupt register (@samp{cr67}). The assembler defines bit masks for each of the bits in the IA-64 processor status register. For example, @samp{psr.ic} corresponds to a value of 0x2000. These masks are primarily intended for use with -the @sample{ssm}/@sample{sum} and @sample{rsm}/@sample{rum} +the @samp{ssm}/@samp{sum} and @samp{rsm}/@samp{rum} instructions, but they can be used anywhere else where an integer constant is expected. diff --git a/contrib/binutils/gas/doc/c-mips.texi b/contrib/binutils/gas/doc/c-mips.texi index 1375230a673..3c70ff29bc0 100644 --- a/contrib/binutils/gas/doc/c-mips.texi +++ b/contrib/binutils/gas/doc/c-mips.texi @@ -26,6 +26,7 @@ Assembly Language Programming'' in the same work. * MIPS Object:: ECOFF object code * MIPS Stabs:: Directives for debugging information * MIPS ISA:: Directives to override the ISA level +* MIPS symbol sizes:: Directives to override the size of symbols * MIPS autoextend:: Directives for extending MIPS 16 bit instructions * MIPS insn:: Directive to mark data as an instruction * MIPS option stack:: Directives to save and restore options @@ -117,6 +118,18 @@ Generate code for the MDMX Application Specific Extension. This tells the assembler to accept MDMX instructions. @samp{-no-mdmx} turns off this option. +@item -mdsp +@itemx -mno-dsp +Generate code for the DSP Application Specific Extension. +This tells the assembler to accept DSP instructions. +@samp{-mno-dsp} turns off this option. + +@item -mmt +@itemx -mno-mt +Generate code for the MT Application Specific Extension. +This tells the assembler to accept MT instructions. +@samp{-mno-mt} turns off this option. + @item -mfix7000 @itemx -mno-fix7000 Cause nops to be inserted if the read of the destination register @@ -128,6 +141,10 @@ Insert nops to work around certain VR4120 errata. This option is intended to be used on GCC-generated code: it is not designed to catch all problems in hand-written assembler code. +@item -mfix-vr4130 +@itemx -no-mfix-vr4130 +Insert nops to work around the VR4130 @samp{mflo}/@samp{mfhi} errata. + @item -m4010 @itemx -no-m4010 Generate code for the LSI @sc{r4010} chip. This tells the assembler to @@ -197,6 +214,13 @@ identical to @samp{-march=@var{cpu}}. Record which ABI the source code uses. The recognized arguments are: @samp{32}, @samp{n32}, @samp{o64}, @samp{64} and @samp{eabi}. +@item -msym32 +@itemx -mno-sym32 +@cindex -msym32 +@cindex -mno-sym32 +Equivalent to adding @code{.set sym32} or @code{.set nosym32} to +the beginning of the assembler input. @xref{MIPS symbol sizes}. + @cindex @code{-nocpp} ignored (MIPS) @item -nocpp This option is ignored. It is accepted for command-line compatibility with @@ -238,6 +262,16 @@ error is detected. This is the default. @itemx -mno-pdr Control generation of @code{.pdr} sections. Off by default on IRIX, on elsewhere. + +@item -mshared +@itemx -mno-shared +When generating code using the Unix calling conventions (selected by +@samp{-KPIC} or @samp{-mcall_shared}), gas will normally generate code +which can go into a shared library. The @samp{-mno-shared} option +tells gas to generate code which uses the calling convention, but can +not go into a shared library. The resulting code is slightly more +efficient. This option only affects the handling of the +@samp{.cpload} and @samp{.cpsetup} pseudo-ops. @end table @node MIPS Object @@ -287,6 +321,61 @@ not by traditional @sc{mips} debuggers (this enhancement is required to fully support C++ debugging). These directives are primarily used by compilers, not assembly language programmers! +@node MIPS symbol sizes +@section Directives to override the size of symbols + +@cindex @code{.set sym32} +@cindex @code{.set nosym32} +The n64 ABI allows symbols to have any 64-bit value. Although this +provides a great deal of flexibility, it means that some macros have +much longer expansions than their 32-bit counterparts. For example, +the non-PIC expansion of @samp{dla $4,sym} is usually: + +@smallexample +lui $4,%highest(sym) +lui $1,%hi(sym) +daddiu $4,$4,%higher(sym) +daddiu $1,$1,%lo(sym) +dsll32 $4,$4,0 +daddu $4,$4,$1 +@end smallexample + +whereas the 32-bit expansion is simply: + +@smallexample +lui $4,%hi(sym) +daddiu $4,$4,%lo(sym) +@end smallexample + +n64 code is sometimes constructed in such a way that all symbolic +constants are known to have 32-bit values, and in such cases, it's +preferable to use the 32-bit expansion instead of the 64-bit +expansion. + +You can use the @code{.set sym32} directive to tell the assembler +that, from this point on, all expressions of the form +@samp{@var{symbol}} or @samp{@var{symbol} + @var{offset}} +have 32-bit values. For example: + +@smallexample +.set sym32 +dla $4,sym +lw $4,sym+16 +sw $4,sym+0x8000($4) +@end smallexample + +will cause the assembler to treat @samp{sym}, @code{sym+16} and +@code{sym+0x8000} as 32-bit values. The handling of non-symbolic +addresses is not affected. + +The directive @code{.set nosym32} ends a @code{.set sym32} block and +reverts to the normal behavior. It is also possible to change the +symbol size using the command-line options @option{-msym32} and +@option{-mno-sym32}. + +These options and directives are always accepted, but at present, +they have no effect for anything other than n64. + @node MIPS ISA @section Directives to override the ISA level @@ -374,4 +463,20 @@ from the MDMX Application Specific Extension from that point on in the assembly. The @code{.set nomdmx} directive prevents MDMX instructions from being accepted. +@cindex MIPS DSP instruction generation override +@kindex @code{.set dsp} +@kindex @code{.set nodsp} +The directive @code{.set dsp} makes the assembler accept instructions +from the DSP Application Specific Extension from that point on +in the assembly. The @code{.set nodsp} directive prevents DSP +instructions from being accepted. + +@cindex MIPS MT instruction generation override +@kindex @code{.set mt} +@kindex @code{.set nomt} +The directive @code{.set mt} makes the assembler accept instructions +from the MT Application Specific Extension from that point on +in the assembly. The @code{.set nomt} directive prevents MT +instructions from being accepted. + Traditional @sc{mips} assemblers do not support these directives. diff --git a/contrib/binutils/gas/doc/c-ppc.texi b/contrib/binutils/gas/doc/c-ppc.texi index be90e336f8b..4c9c096c055 100644 --- a/contrib/binutils/gas/doc/c-ppc.texi +++ b/contrib/binutils/gas/doc/c-ppc.texi @@ -1,4 +1,4 @@ -@c Copyright 2001, 2002 +@c Copyright 2001, 2002, 2003, 2005 @c Free Software Foundation, Inc. @c This is part of the GAS manual. @c For copying conditions, see the file as.texinfo. @@ -67,12 +67,18 @@ Generate code for 64-bit BookE. @item -mbooke, mbooke32 Generate code for 32-bit BookE. +@item -me300 +Generate code for PowerPC e300 family. + @item -maltivec Generate code for processors with AltiVec instructions. @item -mpower4 Generate code for Power4 architecture. +@item -mpower5 +Generate code for Power5 architecture. + @item -mcom Generate code Power/PowerPC common instructions. diff --git a/contrib/binutils/gas/doc/c-sh.texi b/contrib/binutils/gas/doc/c-sh.texi index b08f325ee08..e6dbe4bf5c2 100644 --- a/contrib/binutils/gas/doc/c-sh.texi +++ b/contrib/binutils/gas/doc/c-sh.texi @@ -1,4 +1,4 @@ -@c Copyright 1991, 1992, 1993, 1994, 1995, 1997, 2001, 2004 +@c Copyright 1991, 1992, 1993, 1994, 1995, 1997, 2001, 2003, 2004, 2005 @c Free Software Foundation, Inc. @c This is part of the GAS manual. @c For copying conditions, see the file as.texinfo. @@ -24,39 +24,43 @@ (formerly Hitachi) / SuperH SH family. @table @code -@kindex -little -@kindex -big -@kindex -relax -@kindex -small -@kindex -dsp -@kindex -renesas +@kindex --little +@kindex --big +@kindex --relax +@kindex --small +@kindex --dsp +@kindex --renesas +@kindex --allow-reg-prefix -@item -little +@item --little Generate little endian code. -@item -big +@item --big Generate big endian code. -@item -relax +@item --relax Alter jump instructions for long displacements. -@item -small +@item --small Align sections to 4 byte boundaries, not 16. -@item -dsp +@item --dsp Enable sh-dsp insns, and disable sh3e / sh4 insns. -@item -renesas +@item --renesas Disable optimization with section symbol for compatibility with Renesas assembler. -@item -isa=sh4 | sh4a +@item --allow-reg-prefix +Allow '$' as a register name prefix. + +@item --isa=sh4 | sh4a Specify the sh4 or sh4a instruction set. -@item -isa=dsp +@item --isa=dsp Enable sh-dsp insns, and disable sh3e / sh4 insns. -@item -isa=fp +@item --isa=fp Enable sh2e, sh3e, sh4, and sh4a insn sets. -@item -isa=all +@item --isa=all Enable sh1, sh2, sh2e, sh3, sh3e, sh4, sh4a, and sh-dsp insn sets. @end table diff --git a/contrib/binutils/gas/doc/c-sparc.texi b/contrib/binutils/gas/doc/c-sparc.texi index c34950e13f7..351b300b2f1 100644 --- a/contrib/binutils/gas/doc/c-sparc.texi +++ b/contrib/binutils/gas/doc/c-sparc.texi @@ -1,4 +1,4 @@ -@c Copyright 1991, 1992, 1993, 1994, 1995, 1997, 1999 +@c Copyright 1991, 1992, 1993, 1994, 1995, 1997, 1999, 2002 @c Free Software Foundation, Inc. @c This is part of the GAS manual. @c For copying conditions, see the file as.texinfo. diff --git a/contrib/binutils/gas/doc/gasver.texi b/contrib/binutils/gas/doc/gasver.texi index 3610a96b967..11d1801d6e6 100644 --- a/contrib/binutils/gas/doc/gasver.texi +++ b/contrib/binutils/gas/doc/gasver.texi @@ -1 +1 @@ -@set VERSION 2.15 +@set VERSION 2.17 diff --git a/contrib/binutils/gas/doc/internals.texi b/contrib/binutils/gas/doc/internals.texi index 6719bbf945d..dffdb1e04fa 100644 --- a/contrib/binutils/gas/doc/internals.texi +++ b/contrib/binutils/gas/doc/internals.texi @@ -1,6 +1,6 @@ \input texinfo @c Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -@c 2001, 2002, 2003 +@c 2001, 2002, 2003, 2004, 2005 @c Free Software Foundation, Inc. @setfilename internals.info @node Top @@ -14,7 +14,6 @@ it may help a bit. This chapter is not updated regularly, and it may be out of date. @menu -* GAS versions:: GAS versions * Data types:: Data types * GAS processing:: What GAS does when it runs * Porting GAS:: Porting GAS @@ -24,80 +23,6 @@ This chapter is not updated regularly, and it may be out of date. * Test suite:: Test suite @end menu -@node GAS versions -@section GAS versions - -GAS has acquired layers of code over time. The original GAS only supported the -a.out object file format, with three sections. Support for multiple sections -has been added in two different ways. - -The preferred approach is to use the version of GAS created when the symbol -@code{BFD_ASSEMBLER} is defined. The other versions of GAS are documented for -historical purposes, and to help anybody who has to debug code written for -them. - -The type @code{segT} is used to represent a section in code which must work -with all versions of GAS. - -@menu -* Original GAS:: Original GAS version -* MANY_SEGMENTS:: MANY_SEGMENTS gas version -* BFD_ASSEMBLER:: BFD_ASSEMBLER gas version -@end menu - -@node Original GAS -@subsection Original GAS - -The original GAS only supported the a.out object file format with three -sections: @samp{.text}, @samp{.data}, and @samp{.bss}. This is the version of -GAS that is compiled if neither @code{BFD_ASSEMBLER} nor @code{MANY_SEGMENTS} -is defined. This version of GAS is still used for the m68k-aout target, and -perhaps others. - -This version of GAS should not be used for any new development. - -There is still code that is specific to this version of GAS, notably in -@file{write.c}. There is no way for this code to loop through all the -sections; it simply looks at global variables like @code{text_frag_root} and -@code{data_frag_root}. - -The type @code{segT} is an enum. - -@node MANY_SEGMENTS -@subsection MANY_SEGMENTS gas version -@cindex MANY_SEGMENTS - -The @code{MANY_SEGMENTS} version of gas is only used for COFF. It uses the BFD -library, but it writes out all the data itself using @code{bfd_write}. This -version of gas supports up to 40 normal sections. The section names are stored -in the @code{seg_name} array. Other information is stored in the -@code{segment_info} array. - -The type @code{segT} is an enum. Code that wants to examine all the sections -can use a @code{segT} variable as loop index from @code{SEG_E0} up to but not -including @code{SEG_UNKNOWN}. - -Most of the code specific to this version of GAS is in the file -@file{config/obj-coff.c}, in the portion of that file that is compiled when -@code{BFD_ASSEMBLER} is not defined. - -This version of GAS is still used for several COFF targets. - -@node BFD_ASSEMBLER -@subsection BFD_ASSEMBLER gas version -@cindex BFD_ASSEMBLER - -The preferred version of GAS is the @code{BFD_ASSEMBLER} version. In this -version of GAS, the output file is a normal BFD, and the BFD routines are used -to generate the output. - -@code{BFD_ASSEMBLER} will automatically be used for certain targets, including -those that use the ELF, ECOFF, and SOM object file formats, and also all Alpha, -MIPS, PowerPC, and SPARC targets. You can force the use of -@code{BFD_ASSEMBLER} for other targets with the configure option -@samp{--enable-bfd-assembler}; however, it has not been tested for many -targets, and can not be assumed to work. - @node Data types @section Data types @cindex internals, data types @@ -152,10 +77,8 @@ symbol list. @item sy_next @itemx sy_previous -These pointers to other @code{symbolS} structures describe a singly or doubly -linked list. (If @code{SYMBOLS_NEED_BACKPOINTERS} is not defined, the -@code{sy_previous} field will be omitted; @code{SYMBOLS_NEED_BACKPOINTERS} is -always defined if @code{BFD_ASSEMBLER}.) These fields should be accessed with +These pointers to other @code{symbolS} structures describe a doubly +linked list. These fields should be accessed with the @code{symbol_next} and @code{symbol_previous} macros. @item sy_frag @@ -170,24 +93,23 @@ responsible for setting it when a symbol is used in backend routines. Whether the symbol is an MRI common symbol created by the @code{COMMON} pseudo-op when assembling in MRI mode. +@item sy_volatile +Whether the symbol can be re-defined. + +@item sy_forward_ref +Whether the symbol's value must only be evaluated upon use. + +@item sy_weakrefr +Whether the symbol is a @code{weakref} alias to another symbol. + +@item sy_weakrefd +Whether the symbol is or was referenced by one or more @code{weakref} aliases, +and has not had any direct references. + @item bsym -If @code{BFD_ASSEMBLER} is defined, this points to the BFD @code{asymbol} that +This points to the BFD @code{asymbol} that will be used in writing the object file. -@item sy_name_offset -(Only used if @code{BFD_ASSEMBLER} is not defined.) This is the position of -the symbol's name in the string table of the object file. On some formats, -this will start at position 4, with position 0 reserved for unnamed symbols. -This field is not used until @code{write_object_file} is called. - -@item sy_symbol -(Only used if @code{BFD_ASSEMBLER} is not defined.) This is the -format-specific symbol structure, as it would be written into the object file. - -@item sy_number -(Only used if @code{BFD_ASSEMBLER} is not defined.) This is a 24-bit symbol -number, for use in constructing relocation table entries. - @item sy_obj This format-specific data is of type @code{OBJ_SYMFIELD_TYPE}. If no macro by that name is defined in @file{obj-format.h}, this field is not defined. @@ -237,7 +159,27 @@ A synonym for @code{S_IS_EXTERNAL}. Don't use it. @item S_IS_WEAK @cindex S_IS_WEAK -Return non-zero if the symbol is weak. +Return non-zero if the symbol is weak, or if it is a @code{weakref} alias or +symbol that has not been strongly referenced. + +@item S_IS_WEAKREFR +@cindex S_IS_WEAKREFR +Return non-zero if the symbol is a @code{weakref} alias. + +@item S_IS_WEAKREFD +@cindex S_IS_WEAKREFD +Return non-zero if the symbol was aliased by a @code{weakref} alias and has not +had any strong references. + +@item S_IS_VOLATILE +@cindex S_IS_VOLATILE +Return non-zero if the symbol may be re-defined. Such symbols get created by +the @code{=} operator, @code{equ}, or @code{set}. + +@item S_IS_FORWARD_REF +@cindex S_IS_FORWARD_REF +Return non-zero if the symbol is a forward reference, that is its value must +only be determined upon use. @item S_IS_COMMON @cindex S_IS_COMMON @@ -273,6 +215,42 @@ Mark the symbol as not externally visible. @cindex S_SET_WEAK Mark the symbol as weak. +@item S_SET_WEAKREFR +@cindex S_SET_WEAKREFR +Mark the symbol as the referrer in a @code{weakref} directive. The symbol it +aliases must have been set to the value expression before this point. If the +alias has already been used, the symbol is marked as used too. + +@item S_CLEAR_WEAKREFR +@cindex S_CLEAR_WEAKREFR +Clear the @code{weakref} alias status of a symbol. This is implicitly called +whenever a symbol is defined or set to a new expression. + +@item S_SET_WEAKREFD +@cindex S_SET_WEAKREFD +Mark the symbol as the referred symbol in a @code{weakref} directive. +Implicitly marks the symbol as weak, but see below. It should only be called +if the referenced symbol has just been added to the symbol table. + +@item S_SET_WEAKREFD +@cindex S_SET_WEAKREFD +Clear the @code{weakref} aliased status of a symbol. This is implicitly called +whenever the symbol is looked up, as part of a direct reference or a +definition, but not as part of a @code{weakref} directive. + +@item S_SET_VOLATILE +@cindex S_SET_VOLATILE +Indicate that the symbol may be re-defined. + +@item S_CLEAR_VOLATILE +@cindex S_CLEAR_VOLATILE +Indicate that the symbol may no longer be re-defined. + +@item S_SET_FORWARD_REF +@cindex S_SET_FORWARD_REF +Indicate that the symbol is a forward reference, that is its value must only +be determined upon use. + @item S_GET_TYPE @item S_GET_DESC @item S_GET_OTHER @@ -415,7 +393,7 @@ Set the @code{TC_SYMFIELD_TYPE} field of a symbol. @end table -When @code{BFD_ASSEMBLER} is defined, GAS attempts to store local +GAS attempts to store local symbols--symbols which will not be written to the output file--using a different structure, @code{struct local_symbol}. This structure can only represent symbols whose value is an offset within a frag. @@ -484,8 +462,8 @@ the fixup becomes a relocation entry in the object file. @cindex fix_new_exp A fixup is created by a call to @code{fix_new} or @code{fix_new_exp}. Both take a frag (@pxref{Frags}), a position within the frag, a size, an indication -of whether the fixup is PC relative, and a type. In a @code{BFD_ASSEMBLER} -GAS, the type is nominally a @code{bfd_reloc_code_real_type}, but several +of whether the fixup is PC relative, and a type. +The type is nominally a @code{bfd_reloc_code_real_type}, but several targets use other type codes to represent fixups that can not be described as relocations. @@ -512,15 +490,14 @@ A number which is added into the fixup. @item fx_addnumber Some CPU backends use this field to convey information between -@code{md_apply_fix3} and @code{tc_gen_reloc}. The machine independent code does +@code{md_apply_fix} and @code{tc_gen_reloc}. The machine independent code does not use it. @item fx_next The next fixup in the section. @item fx_r_type -The type of the fixup. This field is only defined if @code{BFD_ASSEMBLER}, or -if the target defines @code{NEED_FX_R_TYPE}. +The type of the fixup. @item fx_size The size of the fixup. This is mostly used for error checking. @@ -683,8 +660,7 @@ Indicates the section this frag chain belongs to. @item frch_subseg Subsection (subsegment) number of this frag chain. @item fix_root, fix_tail -(Defined only if @code{BFD_ASSEMBLER} is defined). Point to first and last -@code{fixS} structures associated with this subsection. +Point to first and last @code{fixS} structures associated with this subsection. @item frch_obstack Not currently used. Intended to be used for frag allocation for this subsection. This should reduce frag generation caused by switching sections. @@ -748,8 +724,7 @@ store relaxation information (@pxref{Relaxation}). When the input file is finished, the @code{write_object_file} routine is called. It assigns addresses to all the frags (@code{relax_segment}), resolves all the fixups (@code{fixup_segment}), resolves all the symbol values (using -@code{resolve_symbol_value}), and finally writes out the file (in the -@code{BFD_ASSEMBLER} case, this is done by simply calling @code{bfd_close}). +@code{resolve_symbol_value}), and finally writes out the file. @end itemize @node Porting GAS @@ -858,13 +833,17 @@ independent string passed to @code{getopt}. @code{md_longopts} is a passed to @code{getopt}; you may use @code{OPTION_MD_BASE}, defined in @file{as.h}, as the start of a set of long option indices, if necessary. @code{md_longopts_size} is a @code{size_t} holding the size @code{md_longopts}. + GAS will call @code{md_parse_option} whenever @code{getopt} returns an unrecognized code, presumably indicating a special code value which appears in -@code{md_longopts}. GAS will call @code{md_show_usage} when a usage message is -printed; it should print a description of the machine specific options. -@code{md_after_pase_args}, if defined, is called after all options are -processed, to let the backend override settings done by the generic option -parsing. +@code{md_longopts}. This function should return non-zero if it handled the +option and zero otherwise. There is no need to print a message about an option +not being recognised. This will be handled by the generic code. + +GAS will call @code{md_show_usage} when a usage message is printed; it should +print a description of the machine specific options. @code{md_after_pase_args}, +if defined, is called after all options are processed, to let the backend +override settings done by the generic option parsing. @item md_begin @cindex md_begin @@ -1015,6 +994,11 @@ default definition is to accept any name followed by a colon character. Same as TC_START_LABEL, but should be used instead of TC_START_LABEL when LABELS_WITHOUT_COLONS is defined. +@item TC_FAKE_LABEL +@cindex TC_FAKE_LABEL +You may define this macro to control what GAS considers to be a fake +label. The default fake label is FAKE_LABEL_NAME. + @item NO_PSEUDO_DOT @cindex NO_PSEUDO_DOT If you define this macro, GAS will not require pseudo-ops to start with a @@ -1025,7 +1009,7 @@ If you define this macro, GAS will not require pseudo-ops to start with a If you define this macro, it should return nonzero if the instruction is permitted to contain an @kbd{=} character. GAS will call it with two arguments, the character before the @kbd{=} character, and the value of -@code{input_line_pointer} at that point. GAS uses this macro to decide if a +the string preceding the equal sign. GAS uses this macro to decide if a @kbd{=} is an assignment or an instruction. @item TC_EOL_IN_INSN @@ -1118,6 +1102,11 @@ pseudo-op. @cindex TC_CONS_FIX_NEW You may define this macro to generate a fixup for a data allocation pseudo-op. +@item TC_ADDRESS_BYTES +@cindex TC_ADDRESS_BYTES +Define this macro to specify the number of bytes used to store an address. +Used to implement @code{dc.a}. The target must have a reloc for this size. + @item TC_INIT_FIX_DATA (@var{fixp}) @cindex TC_INIT_FIX_DATA A C statement to initialize the target specific fields of fixup @var{fixp}. @@ -1167,12 +1156,6 @@ single precision, @samp{D_PRECISION} for double precision, or The macro has a default definition which returns 0 for all cases. -@item md_reloc_size -@cindex md_reloc_size -This variable is only used in the original version of gas (not -@code{BFD_ASSEMBLER} and not @code{MANY_SEGMENTS}). It holds the size of a -relocation entry. - @item WORKING_DOT_WORD @itemx md_short_jump_size @itemx md_long_jump_size @@ -1236,7 +1219,7 @@ given section will be processed when the @var{linkrelax} variable is set. The macro is given the N_TYPE bits for the section in its @var{segT} argument. If the macro evaluates to a non-zero value then the fixups will be converted into relocs, otherwise they will -be passed to @var{md_apply_fix3} as normal. +be passed to @var{md_apply_fix} as normal. @item md_convert_frag @cindex md_convert_frag @@ -1263,11 +1246,11 @@ It may be used to change the fixup in @code{struct fix *@var{fixP}} before the generic code sees it, or to fully process the fixup. In the latter case, a @code{goto @var{skip}} will bypass the generic code. -@item md_apply_fix3 (@var{fixP}, @var{valP}, @var{seg}) -@cindex md_apply_fix3 +@item md_apply_fix (@var{fixP}, @var{valP}, @var{seg}) +@cindex md_apply_fix GAS will call this for each fixup that passes the @code{TC_VALIDATE_FIX} test when @var{linkrelax} is not set. It should store the correct value in the -object file. @code{struct fix *@var{fixP}} is the fixup @code{md_apply_fix3} +object file. @code{struct fix *@var{fixP}} is the fixup @code{md_apply_fix} is operating on. @code{valueT *@var{valP}} is the value to store into the object files, or at least is the generic code's best guess. Specifically, *@var{valP} is the value of the fixup symbol, perhaps modified by @@ -1275,8 +1258,8 @@ object files, or at least is the generic code's best guess. Specifically, less @code{MD_PCREL_FROM_SECTION} for pc-relative fixups. @code{segT @var{seg}} is the section the fix is in. @code{fixup_segment} performs a generic overflow check on *@var{valP} after -@code{md_apply_fix3} returns. If the overflow check is relevant for the target -machine, then @code{md_apply_fix3} should modify *@var{valP}, typically to the +@code{md_apply_fix} returns. If the overflow check is relevant for the target +machine, then @code{md_apply_fix} should modify *@var{valP}, typically to the value stored in the object file. @item TC_FORCE_RELOCATION (@var{fix}) @@ -1304,7 +1287,7 @@ returns non-zero, will emit relocs. This macro controls resolution of fixup expressions involving the difference of two symbols in the same section. If this macro returns zero, the subtrahend will be resolved and @code{fx_subsy} set to @code{NULL} for -@code{md_apply_fix3}. If undefined, the default of +@code{md_apply_fix}. If undefined, the default of @w{@code{! SEG_NORMAL (@var{seg}) || TC_FORCE_RELOCATION (@var{fix})}} will be used. @@ -1327,13 +1310,13 @@ This macro is evaluated for any fixup with a @code{fx_subsy} that @item MD_APPLY_SYM_VALUE (@var{fix}) @cindex MD_APPLY_SYM_VALUE This macro controls whether the symbol value becomes part of the value passed -to @code{md_apply_fix3}. If the macro is undefined, or returns non-zero, the +to @code{md_apply_fix}. If the macro is undefined, or returns non-zero, the symbol value will be included. For ELF, a suitable definition might simply be @code{0}, because ELF relocations don't include the symbol value in the addend. @item S_FORCE_RELOC (@var{sym}, @var{strict}) @cindex S_FORCE_RELOC -This macro (or function, for @code{BFD_ASSEMBLER} gas) returns true for symbols +This function returns true for symbols that should not be reduced to section symbols or eliminated from expressions, because they may be overridden by the linker. ie. for symbols that are undefined or common, and when @var{strict} is set, weak, or global (for ELF @@ -1347,7 +1330,7 @@ symbols. If undefined, the default is @code{true} for ELF assemblers, and @item tc_gen_reloc @cindex tc_gen_reloc -A @code{BFD_ASSEMBLER} GAS will call this to generate a reloc. GAS will pass +GAS will call this to generate a reloc. GAS will pass the resulting reloc to @code{bfd_install_relocation}. This currently works poorly, as @code{bfd_install_relocation} often does the wrong thing, and instances of @code{tc_gen_reloc} have been written to work around the problems, @@ -1432,7 +1415,7 @@ whitespace, or concatenated if there is not. @item tc_frob_section @cindex tc_frob_section -If you define this macro, a @code{BFD_ASSEMBLER} GAS will call it for each +If you define this macro, GAS will call it for each section at the end of the assembly. @item tc_frob_file_before_adjust @@ -1520,6 +1503,20 @@ It should return the size of an address, as it should be represented in debugging info. If you don't define this macro, the default definition uses the number of bits per address, as defined in @var{bfd}, divided by 8. +@item MD_DEBUG_FORMAT_SELECTOR +@cindex MD_DEBUG_FORMAT_SELECTOR +If defined this macro is the name of a function to be called when the +@samp{--gen-debug} switch is detected on the assembler's command line. The +prototype for the function looks like this: + +@smallexample + enum debug_info_type MD_DEBUG_FORMAT_SELECTOR (int * use_gnu_extensions) +@end smallexample + +The function should return the debug format that is preferred by the CPU +backend. This format will be used when generating assembler specific debug +information. + @end table @node Object format backend @@ -1534,11 +1531,6 @@ defining a number of pseudo-ops. The object format @file{.h} file must include @file{targ-cpu.h}. -This section will only define the @code{BFD_ASSEMBLER} version of GAS. It is -impossible to support a new object file format using any other version anyhow, -as the original GAS version only supports a.out, and the @code{MANY_SEGMENTS} -GAS version only supports COFF. - @table @code @item OBJ_@var{format} @cindex OBJ_@var{format} @@ -1610,6 +1602,16 @@ If you define this macro, GAS will call it for each symbol. You can indicate that the symbol should not be included in the object file by defining this macro to set its second argument to a non-zero value. +@item obj_set_weak_hook +@cindex obj_set_weak_hook +If you define this macro, @code{S_SET_WEAK} will call it before modifying the +symbol's flags. + +@item obj_clear_weak_hook +@cindex obj_clear_weak_hook +If you define this macro, @code{S_CLEAR_WEAKREFD} will call it after clearning +the @code{weakrefd} flag, but before modifying any other flags. + @item obj_frob_file @cindex obj_frob_file If you define this macro, GAS will call it after the symbol table has been @@ -1623,8 +1625,7 @@ generated. @cindex SET_SECTION_RELOCS If you define this, it will be called after the relocations have been set for the section @var{sec}. The list of relocations is in @var{relocs}, and the -number of relocations is in @var{n}. This is only used with -@code{BFD_ASSEMBLER}. +number of relocations is in @var{n}. @end table @node Emulations @@ -1870,9 +1871,8 @@ after all input has been read, but messages about fixups should refer to the original filename and line number that they are applicable to. @end deftypefun -@deftypefun @{@} void fprint_value (FILE *@var{file}, valueT @var{val}) -@deftypefunx @{@} void sprint_value (char *@var{buf}, valueT @var{val}) -These functions are helpful for converting a @code{valueT} value into printable +@deftypefun @{@} void sprint_value (char *@var{buf}, valueT @var{val}) +This function is helpful for converting a @code{valueT} value into printable format, in case it's wider than modes that @code{*printf} can handle. If the type is narrow enough, a decimal number will be produced; otherwise, it will be in hexadecimal. The value itself is not examined to make this determination. diff --git a/contrib/binutils/gas/dw2gencfi.c b/contrib/binutils/gas/dw2gencfi.c index ff0aa35353d..bfa5d5cf45a 100644 --- a/contrib/binutils/gas/dw2gencfi.c +++ b/contrib/binutils/gas/dw2gencfi.c @@ -1,5 +1,5 @@ /* dw2gencfi.c - Support for generating Dwarf2 CFI information. - Copyright 2003 Free Software Foundation, Inc. + Copyright 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Contributed by Michal Ludvig This file is part of GAS, the GNU Assembler. @@ -16,8 +16,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #include "as.h" #include "dw2gencfi.h" @@ -25,7 +25,7 @@ /* We re-use DWARF2_LINE_MIN_INSN_LENGTH for the code alignment field of the CIE. Default to 1 if not otherwise specified. */ -#ifndef DWARF2_LINE_MIN_INSN_LENGTH +#ifndef DWARF2_LINE_MIN_INSN_LENGTH # define DWARF2_LINE_MIN_INSN_LENGTH 1 #endif @@ -33,20 +33,16 @@ provide the following definitions. Otherwise provide them to allow compilation to continue. */ #ifndef TARGET_USE_CFIPOP -# ifndef DWARF2_DEFAULT_RETURN_COLUMN +# ifndef DWARF2_DEFAULT_RETURN_COLUMN # define DWARF2_DEFAULT_RETURN_COLUMN 0 # endif -# ifndef DWARF2_CIE_DATA_ALIGNMENT +# ifndef DWARF2_CIE_DATA_ALIGNMENT # define DWARF2_CIE_DATA_ALIGNMENT 1 # endif #endif #ifndef EH_FRAME_ALIGNMENT -# ifdef BFD_ASSEMBLER -# define EH_FRAME_ALIGNMENT (bfd_get_arch_size (stdoutput) == 64 ? 3 : 2) -# else -# define EH_FRAME_ALIGNMENT 2 -# endif +# define EH_FRAME_ALIGNMENT (bfd_get_arch_size (stdoutput) == 64 ? 3 : 2) #endif #ifndef tc_cfi_frame_initial_instructions @@ -92,6 +88,7 @@ struct fde_entry struct cfi_insn_data *data; struct cfi_insn_data **last; unsigned int return_column; + unsigned int signal_frame; }; struct cie_entry @@ -99,6 +96,7 @@ struct cie_entry struct cie_entry *next; symbolS *start_address; unsigned int return_column; + unsigned int signal_frame; struct cfi_insn_data *first, *last; }; @@ -341,6 +339,8 @@ cfi_add_CFA_restore_state (void) cfa_save_stack = p->next; free (p); } + else + as_bad (_("CFI state restore without previous remember")); } @@ -356,6 +356,7 @@ static void dot_cfi_endproc (int); #define CFI_return_column 0x101 #define CFI_rel_offset 0x102 #define CFI_escape 0x103 +#define CFI_signal_frame 0x104 const pseudo_typeS cfi_pseudo_table[] = { @@ -376,6 +377,7 @@ const pseudo_typeS cfi_pseudo_table[] = { "cfi_restore_state", dot_cfi, DW_CFA_restore_state }, { "cfi_window_save", dot_cfi, DW_CFA_GNU_window_save }, { "cfi_escape", dot_cfi_escape, 0 }, + { "cfi_signal_frame", dot_cfi, CFI_signal_frame }, { NULL, NULL, 0 } }; @@ -417,7 +419,7 @@ cfi_parse_reg (void) } #endif - expression (&exp); + expression_and_evaluate (&exp); switch (exp.X_op) { case O_register: @@ -449,6 +451,7 @@ dot_cfi (int arg) if (!cur_fde_data) { as_bad (_("CFI instruction used without previous .cfi_startproc")); + ignore_rest_of_line (); return; } @@ -503,13 +506,27 @@ dot_cfi (int arg) break; case DW_CFA_restore: - reg1 = cfi_parse_reg (); - cfi_add_CFA_restore (reg1); + for (;;) + { + reg1 = cfi_parse_reg (); + cfi_add_CFA_restore (reg1); + SKIP_WHITESPACE (); + if (*input_line_pointer != ',') + break; + ++input_line_pointer; + } break; case DW_CFA_undefined: - reg1 = cfi_parse_reg (); - cfi_add_CFA_undefined (reg1); + for (;;) + { + reg1 = cfi_parse_reg (); + cfi_add_CFA_undefined (reg1); + SKIP_WHITESPACE (); + if (*input_line_pointer != ',') + break; + ++input_line_pointer; + } break; case DW_CFA_same_value: @@ -534,6 +551,10 @@ dot_cfi (int arg) cfi_add_CFA_insn (DW_CFA_GNU_window_save); break; + case CFI_signal_frame: + cur_fde_data->signal_frame = 1; + break; + default: abort (); } @@ -550,6 +571,7 @@ dot_cfi_escape (int ignored ATTRIBUTE_UNUSED) if (!cur_fde_data) { as_bad (_("CFI instruction used without previous .cfi_startproc")); + ignore_rest_of_line (); return; } @@ -572,6 +594,9 @@ dot_cfi_escape (int ignored ATTRIBUTE_UNUSED) insn = alloc_cfi_insn_data (); insn->insn = CFI_escape; insn->u.esc = head; + + --input_line_pointer; + demand_empty_rest_of_line (); } static void @@ -582,6 +607,7 @@ dot_cfi_startproc (int ignored ATTRIBUTE_UNUSED) if (cur_fde_data) { as_bad (_("previous CFI entry not closed (missing .cfi_endproc)")); + ignore_rest_of_line (); return; } @@ -605,6 +631,7 @@ dot_cfi_startproc (int ignored ATTRIBUTE_UNUSED) } demand_empty_rest_of_line (); + cur_cfa_offset = 0; if (!simple) tc_cfi_frame_initial_instructions (); } @@ -615,10 +642,13 @@ dot_cfi_endproc (int ignored ATTRIBUTE_UNUSED) if (! cur_fde_data) { as_bad (_(".cfi_endproc without corresponding .cfi_startproc")); + ignore_rest_of_line (); return; } cfi_end_fde (symbol_temp_new_now ()); + + demand_empty_rest_of_line (); } @@ -726,7 +756,7 @@ output_cfi_insn (struct cfi_insn_data *insn) { out_one (DW_CFA_def_cfa_sf); out_uleb128 (insn->u.ri.reg); - out_uleb128 (offset); + out_sleb128 (offset / DWARF2_CIE_DATA_ALIGNMENT); } else { @@ -748,7 +778,7 @@ output_cfi_insn (struct cfi_insn_data *insn) if (offset < 0) { out_one (DW_CFA_def_cfa_offset_sf); - out_sleb128 (offset); + out_sleb128 (offset / DWARF2_CIE_DATA_ALIGNMENT); } else { @@ -836,17 +866,22 @@ output_cie (struct cie_entry *cie) exp.X_op_symbol = after_size_address; exp.X_add_number = 0; - emit_expr (&exp, 4); /* Length */ + emit_expr (&exp, 4); /* Length. */ symbol_set_value_now (after_size_address); - out_four (0); /* CIE id */ - out_one (DW_CIE_VERSION); /* Version */ - out_one ('z'); /* Augmentation */ + out_four (0); /* CIE id. */ + out_one (DW_CIE_VERSION); /* Version. */ + out_one ('z'); /* Augmentation. */ out_one ('R'); + if (cie->signal_frame) + out_one ('S'); out_one (0); - out_uleb128 (DWARF2_LINE_MIN_INSN_LENGTH); /* Code alignment */ - out_sleb128 (DWARF2_CIE_DATA_ALIGNMENT); /* Data alignment */ - out_one (cie->return_column); /* Return column */ - out_uleb128 (1); /* Augmentation size */ + out_uleb128 (DWARF2_LINE_MIN_INSN_LENGTH); /* Code alignment. */ + out_sleb128 (DWARF2_CIE_DATA_ALIGNMENT); /* Data alignment. */ + if (DW_CIE_VERSION == 1) /* Return column. */ + out_one (cie->return_column); + else + out_uleb128 (cie->return_column); + out_uleb128 (1); /* Augmentation size. */ #if defined DIFF_EXPR_OK || defined tc_cfi_emit_pcrel_expr out_one (DW_EH_PE_pcrel | DW_EH_PE_sdata4); #else @@ -857,7 +892,7 @@ output_cie (struct cie_entry *cie) for (i = cie->first; i != cie->last; i = i->next) output_cfi_insn (i); - frag_align (2, 0, 0); + frag_align (2, DW_CFA_nop, 0); symbol_set_value_now (end_address); } @@ -875,39 +910,39 @@ output_fde (struct fde_entry *fde, struct cie_entry *cie, exp.X_add_symbol = end_address; exp.X_op_symbol = after_size_address; exp.X_add_number = 0; - emit_expr (&exp, 4); /* Length */ + emit_expr (&exp, 4); /* Length. */ symbol_set_value_now (after_size_address); exp.X_add_symbol = after_size_address; exp.X_op_symbol = cie->start_address; - emit_expr (&exp, 4); /* CIE offset */ + emit_expr (&exp, 4); /* CIE offset. */ #ifdef DIFF_EXPR_OK exp.X_add_symbol = fde->start_address; exp.X_op_symbol = symbol_temp_new_now (); - emit_expr (&exp, 4); /* Code offset */ + emit_expr (&exp, 4); /* Code offset. */ #else exp.X_op = O_symbol; exp.X_add_symbol = fde->start_address; exp.X_op_symbol = NULL; #ifdef tc_cfi_emit_pcrel_expr - tc_cfi_emit_pcrel_expr (&exp, 4); /* Code offset */ + tc_cfi_emit_pcrel_expr (&exp, 4); /* Code offset. */ #else - emit_expr (&exp, 4); /* Code offset */ + emit_expr (&exp, 4); /* Code offset. */ #endif exp.X_op = O_subtract; #endif exp.X_add_symbol = fde->end_address; - exp.X_op_symbol = fde->start_address; /* Code length */ + exp.X_op_symbol = fde->start_address; /* Code length. */ emit_expr (&exp, 4); - out_uleb128 (0); /* Augmentation size */ + out_uleb128 (0); /* Augmentation size. */ for (; first; first = first->next) output_cfi_insn (first); - frag_align (align, 0, 0); + frag_align (align, DW_CFA_nop, 0); symbol_set_value_now (end_address); } @@ -919,7 +954,8 @@ select_cie_for_fde (struct fde_entry *fde, struct cfi_insn_data **pfirst) for (cie = cie_root; cie; cie = cie->next) { - if (cie->return_column != fde->return_column) + if (cie->return_column != fde->return_column + || cie->signal_frame != fde->signal_frame) continue; for (i = cie->first, j = fde->data; i != cie->last && j != NULL; @@ -930,8 +966,9 @@ select_cie_for_fde (struct fde_entry *fde, struct cfi_insn_data **pfirst) switch (i->insn) { case DW_CFA_advance_loc: - /* We reached the first advance in the FDE, but did not - reach the end of the CIE list. */ + case DW_CFA_remember_state: + /* We reached the first advance/remember in the FDE, + but did not reach the end of the CIE list. */ goto fail; case DW_CFA_offset: @@ -972,8 +1009,13 @@ select_cie_for_fde (struct fde_entry *fde, struct cfi_insn_data **pfirst) } /* Success if we reached the end of the CIE list, and we've either - run out of FDE entries or we've encountered an advance. */ - if (i == cie->last && (!j || j->insn == DW_CFA_advance_loc)) + run out of FDE entries or we've encountered an advance, + remember, or escape. */ + if (i == cie->last + && (!j + || j->insn == DW_CFA_advance_loc + || j->insn == DW_CFA_remember_state + || j->insn == CFI_escape)) { *pfirst = j; return cie; @@ -986,10 +1028,13 @@ select_cie_for_fde (struct fde_entry *fde, struct cfi_insn_data **pfirst) cie->next = cie_root; cie_root = cie; cie->return_column = fde->return_column; + cie->signal_frame = fde->signal_frame; cie->first = fde->data; for (i = cie->first; i ; i = i->next) - if (i->insn == DW_CFA_advance_loc) + if (i->insn == DW_CFA_advance_loc + || i->insn == DW_CFA_remember_state + || i->insn == CFI_escape) break; cie->last = i; @@ -1018,10 +1063,8 @@ cfi_finish (void) /* Open .eh_frame section. */ cfi_seg = subseg_new (".eh_frame", 0); -#ifdef BFD_ASSEMBLER bfd_set_section_flags (stdoutput, cfi_seg, SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_READONLY); -#endif subseg_set (cfi_seg, 0); record_alignment (cfi_seg, EH_FRAME_ALIGNMENT); diff --git a/contrib/binutils/gas/dw2gencfi.h b/contrib/binutils/gas/dw2gencfi.h index 75b6ec24610..53a35fcb68d 100644 --- a/contrib/binutils/gas/dw2gencfi.h +++ b/contrib/binutils/gas/dw2gencfi.h @@ -16,8 +16,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #ifndef DW2GENCFI_H #define DW2GENCFI_H diff --git a/contrib/binutils/gas/dwarf2dbg.c b/contrib/binutils/gas/dwarf2dbg.c index 3336453a4ee..16666fa4f28 100644 --- a/contrib/binutils/gas/dwarf2dbg.c +++ b/contrib/binutils/gas/dwarf2dbg.c @@ -1,5 +1,6 @@ /* dwarf2dbg.c - DWARF2 debug support - Copyright 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. Contributed by David Mosberger-Tang This file is part of GAS, the GNU Assembler. @@ -16,19 +17,20 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ /* Logical line numbers can be controlled by the compiler via the - following two directives: + following directives: .file FILENO "file.c" - .loc FILENO LINENO [COLUMN] - - FILENO is the filenumber. */ + .loc FILENO LINENO [COLUMN] [basic_block] [prologue_end] \ + [epilogue_begin] [is_stmt VALUE] [isa VALUE] +*/ #include "ansidecl.h" #include "as.h" +#include "safe-ctype.h" #ifdef HAVE_LIMITS_H #include @@ -52,8 +54,6 @@ # define DWARF2_ADDR_SIZE(bfd) (bfd_arch_bits_per_address (bfd) / 8) #endif -#ifdef BFD_ASSEMBLER - #include "subsegs.h" #include "elf/dwarf2.h" @@ -69,8 +69,8 @@ /* First special line opcde - leave room for the standard opcodes. Note: If you want to change this, you'll have to update the "standard_opcode_lengths" table that is emitted below in - dwarf2_finish(). */ -#define DWARF2_LINE_OPCODE_BASE 10 + out_debug_line(). */ +#define DWARF2_LINE_OPCODE_BASE 13 #ifndef DWARF2_LINE_BASE /* Minimum line offset in a special line info. opcode. This value @@ -89,10 +89,7 @@ # define DWARF2_LINE_MIN_INSN_LENGTH 1 #endif -/* Flag that indicates the initial value of the is_stmt_start flag. - In the present implementation, we do not mark any lines as - the beginning of a source statement, because that information - is not made available by the GCC front-end. */ +/* Flag that indicates the initial value of the is_stmt_start flag. */ #define DWARF2_LINE_DEFAULT_IS_STMT 1 /* Given a special op, return the line skip amount. */ @@ -108,8 +105,7 @@ struct line_entry { struct line_entry *next; - fragS *frag; - addressT frag_ofs; + symbolS *label; struct dwarf2_line_info loc; }; @@ -150,8 +146,15 @@ static unsigned int dirs_allocated; doing work when there's nothing to do. */ static bfd_boolean loc_directive_seen; +/* TRUE when we're supposed to set the basic block mark whenever a + label is seen. */ +bfd_boolean dwarf2_loc_mark_labels; + /* Current location as indicated by the most recent .loc directive. */ -static struct dwarf2_line_info current; +static struct dwarf2_line_info current = { + 1, 1, 0, 0, + DWARF2_LINE_DEFAULT_IS_STMT ? DWARF2_FLAG_IS_STMT : 0 +}; /* The size of an address on the target. */ static unsigned int sizeof_address; @@ -167,12 +170,11 @@ static void out_four (int); static void out_abbrev (int, int); static void out_uleb128 (addressT); static offsetT get_frag_fix (fragS *); -static void out_set_addr (segT, fragS *, addressT); +static void out_set_addr (symbolS *); static int size_inc_line_addr (int, addressT); static void emit_inc_line_addr (int, addressT, char *, int); static void out_inc_line_addr (int, addressT); -static void relax_inc_line_addr (int, segT, fragS *, addressT, - fragS *, addressT); +static void relax_inc_line_addr (int, symbolS *, symbolS *); static void process_entries (segT, struct line_entry *); static void out_file_list (void); static void out_debug_line (segT); @@ -207,21 +209,21 @@ get_line_subseg (segT seg, subsegT subseg) static subsegT last_subseg; static struct line_subseg *last_line_subseg; - struct line_seg *s; + struct line_seg **ps, *s; struct line_subseg **pss, *ss; if (seg == last_seg && subseg == last_subseg) return last_line_subseg; - for (s = all_segs; s; s = s->next) + for (ps = &all_segs; (s = *ps) != NULL; ps = &s->next) if (s->seg == seg) goto found_seg; s = (struct line_seg *) xmalloc (sizeof (*s)); - s->next = all_segs; + s->next = NULL; s->seg = seg; s->head = NULL; - all_segs = s; + *ps = s; found_seg: for (pss = &s->head; (ss = *pss) != NULL ; pss = &ss->next) @@ -247,16 +249,34 @@ get_line_subseg (segT seg, subsegT subseg) return ss; } +/* Record an entry for LOC occurring at LABEL. */ + +static void +dwarf2_gen_line_info_1 (symbolS *label, struct dwarf2_line_info *loc) +{ + struct line_subseg *ss; + struct line_entry *e; + + e = (struct line_entry *) xmalloc (sizeof (*e)); + e->next = NULL; + e->label = label; + e->loc = *loc; + + ss = get_line_subseg (now_seg, now_subseg); + *ss->ptail = e; + ss->ptail = &e->next; +} + /* Record an entry for LOC occurring at OFS within the current fragment. */ void dwarf2_gen_line_info (addressT ofs, struct dwarf2_line_info *loc) { - struct line_subseg *ss; - struct line_entry *e; static unsigned int line = -1; static unsigned int filenum = -1; + symbolS *sym; + /* Early out for as-yet incomplete location information. */ if (loc->filenum == 0 || loc->line == 0) return; @@ -272,17 +292,15 @@ dwarf2_gen_line_info (addressT ofs, struct dwarf2_line_info *loc) line = loc->line; filenum = loc->filenum; - e = (struct line_entry *) xmalloc (sizeof (*e)); - e->next = NULL; - e->frag = frag_now; - e->frag_ofs = ofs; - e->loc = *loc; - - ss = get_line_subseg (now_seg, now_subseg); - *ss->ptail = e; - ss->ptail = &e->next; + sym = symbol_temp_new (now_seg, ofs, frag_now); + dwarf2_gen_line_info_1 (sym, loc); } +/* Returns the current source information. If .file directives have + been encountered, the info for the corresponding source file is + returned. Otherwise, the info for the assembly source file is + returned. */ + void dwarf2_where (struct dwarf2_line_info *line) { @@ -292,12 +310,22 @@ dwarf2_where (struct dwarf2_line_info *line) as_where (&filename, &line->line); line->filenum = get_filenum (filename, 0); line->column = 0; - line->flags = DWARF2_FLAG_BEGIN_STMT; + line->flags = DWARF2_FLAG_IS_STMT; + line->isa = current.isa; } else *line = current; } +/* A hook to allow the target backend to inform the line number state + machine of isa changes when assembler debug info is enabled. */ + +void +dwarf2_set_isa (unsigned int isa) +{ + current.isa = isa; +} + /* Called for each machine instruction, or relatively atomic group of machine instructions (ie built-in macro). The instruction or group is SIZE bytes in length. If dwarf2 line number generation is called @@ -325,9 +353,45 @@ dwarf2_emit_insn (int size) else if (debug_type != DEBUG_DWARF2) return; else - dwarf2_where (& loc); + dwarf2_where (&loc); dwarf2_gen_line_info (frag_now_fix () - size, &loc); + + current.flags &= ~(DWARF2_FLAG_BASIC_BLOCK + | DWARF2_FLAG_PROLOGUE_END + | DWARF2_FLAG_EPILOGUE_BEGIN); +} + +/* Called for each (preferably code) label. If dwarf2_loc_mark_labels + is enabled, emit a basic block marker. */ + +void +dwarf2_emit_label (symbolS *label) +{ + struct dwarf2_line_info loc; + + if (!dwarf2_loc_mark_labels) + return; + if (S_GET_SEGMENT (label) != now_seg) + return; + if (!(bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE)) + return; + + if (debug_type == DEBUG_DWARF2) + dwarf2_where (&loc); + else + { + loc = current; + loc_directive_seen = FALSE; + } + + loc.flags |= DWARF2_FLAG_BASIC_BLOCK; + + current.flags &= ~(DWARF2_FLAG_BASIC_BLOCK + | DWARF2_FLAG_PROLOGUE_END + | DWARF2_FLAG_EPILOGUE_BEGIN); + + dwarf2_gen_line_info_1 (label, &loc); } /* Get a .debug_line file number for FILENAME. If NUM is nonzero, @@ -420,7 +484,8 @@ get_filenum (const char *filename, unsigned int num) files[i].filename = num ? file : xstrdup (file); files[i].dir = dir; - files_in_use = i + 1; + if (files_in_use < i + 1) + files_in_use = i + 1; last_used = i; last_used_dir_len = dir_len; @@ -450,6 +515,8 @@ dwarf2_directive_file (int dummy ATTRIBUTE_UNUSED) num = get_absolute_expression (); filename = demand_copy_C_string (&filename_len); + if (filename == NULL) + return NULL; demand_empty_rest_of_line (); if (num < 1) @@ -472,14 +539,11 @@ dwarf2_directive_file (int dummy ATTRIBUTE_UNUSED) void dwarf2_directive_loc (int dummy ATTRIBUTE_UNUSED) { - offsetT filenum, line, column; + offsetT filenum, line; filenum = get_absolute_expression (); SKIP_WHITESPACE (); line = get_absolute_expression (); - SKIP_WHITESPACE (); - column = get_absolute_expression (); - demand_empty_rest_of_line (); if (filenum < 1) { @@ -494,10 +558,6 @@ dwarf2_directive_loc (int dummy ATTRIBUTE_UNUSED) current.filenum = filenum; current.line = line; - current.column = column; - current.flags = DWARF2_FLAG_BEGIN_STMT; - - loc_directive_seen = TRUE; #ifndef NO_LISTING if (listing) @@ -519,6 +579,92 @@ dwarf2_directive_loc (int dummy ATTRIBUTE_UNUSED) listing_source_line (line); } #endif + + SKIP_WHITESPACE (); + if (ISDIGIT (*input_line_pointer)) + { + current.column = get_absolute_expression (); + SKIP_WHITESPACE (); + } + + while (ISALPHA (*input_line_pointer)) + { + char *p, c; + offsetT value; + + p = input_line_pointer; + c = get_symbol_end (); + + if (strcmp (p, "basic_block") == 0) + { + current.flags |= DWARF2_FLAG_BASIC_BLOCK; + *input_line_pointer = c; + } + else if (strcmp (p, "prologue_end") == 0) + { + current.flags |= DWARF2_FLAG_PROLOGUE_END; + *input_line_pointer = c; + } + else if (strcmp (p, "epilogue_begin") == 0) + { + current.flags |= DWARF2_FLAG_EPILOGUE_BEGIN; + *input_line_pointer = c; + } + else if (strcmp (p, "is_stmt") == 0) + { + *input_line_pointer = c; + value = get_absolute_expression (); + if (value == 0) + current.flags &= ~DWARF2_FLAG_IS_STMT; + else if (value == 1) + current.flags |= DWARF2_FLAG_IS_STMT; + else + { + as_bad (_("is_stmt value not 0 or 1")); + return; + } + } + else if (strcmp (p, "isa") == 0) + { + *input_line_pointer = c; + value = get_absolute_expression (); + if (value >= 0) + current.isa = value; + else + { + as_bad (_("isa number less than zero")); + return; + } + } + else + { + as_bad (_("unknown .loc sub-directive `%s'"), p); + *input_line_pointer = c; + return; + } + + SKIP_WHITESPACE (); + } + + demand_empty_rest_of_line (); + loc_directive_seen = TRUE; +} + +void +dwarf2_directive_loc_mark_labels (int dummy ATTRIBUTE_UNUSED) +{ + offsetT value = get_absolute_expression (); + + if (value != 0 && value != 1) + { + as_bad (_("expected 0 or 1")); + ignore_rest_of_line (); + } + else + { + dwarf2_loc_mark_labels = value != 0; + demand_empty_rest_of_line (); + } } static struct frag * @@ -619,12 +765,9 @@ get_frag_fix (fragS *frag) /* Set an absolute address (may result in a relocation entry). */ static void -out_set_addr (segT seg, fragS *frag, addressT ofs) +out_set_addr (symbolS *sym) { expressionS expr; - symbolS *sym; - - sym = symbol_temp_new (seg, ofs, frag); out_opcode (DW_LNS_extended_op); out_uleb128 (sizeof_address + 1); @@ -728,6 +871,10 @@ emit_inc_line_addr (int line_delta, addressT addr_delta, char *p, int len) int need_copy = 0; char *end = p + len; + /* Line number sequences cannot go backward in addresses. This means + we've incorrectly ordered the statements in the sequence. */ + assert ((offsetT) addr_delta >= 0); + /* Scale the address delta by the minimum instruction length. */ scale_addr_delta (&addr_delta); @@ -760,19 +907,19 @@ emit_inc_line_addr (int line_delta, addressT addr_delta, char *p, int len) *p++ = DW_LNS_advance_line; p += output_leb128 (p, line_delta, 1); - /* Prettier, I think, to use DW_LNS_copy instead of a - "line +0, addr +0" special opcode. */ - if (addr_delta == 0) - { - *p++ = DW_LNS_copy; - goto done; - } - line_delta = 0; tmp = 0 - DWARF2_LINE_BASE; need_copy = 1; } + /* Prettier, I think, to use DW_LNS_copy instead of a "line +0, addr +0" + special opcode. */ + if (line_delta == 0 && addr_delta == 0) + { + *p++ = DW_LNS_copy; + goto done; + } + /* Bias the opcode by the special opcode base. */ tmp += DWARF2_LINE_OPCODE_BASE; @@ -823,17 +970,11 @@ out_inc_line_addr (int line_delta, addressT addr_delta) increments between fragments of the target segment. */ static void -relax_inc_line_addr (int line_delta, segT seg, - fragS *to_frag, addressT to_ofs, - fragS *from_frag, addressT from_ofs) +relax_inc_line_addr (int line_delta, symbolS *to_sym, symbolS *from_sym) { - symbolS *to_sym, *from_sym; expressionS expr; int max_chars; - to_sym = symbol_temp_new (seg, to_ofs, to_frag); - from_sym = symbol_temp_new (seg, from_ofs, from_frag); - expr.X_op = O_subtract; expr.X_add_symbol = to_sym; expr.X_op_symbol = from_sym; @@ -914,23 +1055,22 @@ process_entries (segT seg, struct line_entry *e) unsigned filenum = 1; unsigned line = 1; unsigned column = 0; - unsigned flags = DWARF2_LINE_DEFAULT_IS_STMT ? DWARF2_FLAG_BEGIN_STMT : 0; - fragS *frag = NULL; - fragS *last_frag; - addressT frag_ofs = 0; - addressT last_frag_ofs; + unsigned isa = 0; + unsigned flags = DWARF2_LINE_DEFAULT_IS_STMT ? DWARF2_FLAG_IS_STMT : 0; + fragS *last_frag = NULL, *frag; + addressT last_frag_ofs = 0, frag_ofs; + symbolS *last_lab = NULL, *lab; struct line_entry *next; - while (e) + do { - int changed = 0; + int line_delta; if (filenum != e->loc.filenum) { filenum = e->loc.filenum; out_opcode (DW_LNS_set_file); out_uleb128 (filenum); - changed = 1; } if (column != e->loc.column) @@ -938,64 +1078,70 @@ process_entries (segT seg, struct line_entry *e) column = e->loc.column; out_opcode (DW_LNS_set_column); out_uleb128 (column); - changed = 1; } - if ((e->loc.flags ^ flags) & DWARF2_FLAG_BEGIN_STMT) + if (isa != e->loc.isa) + { + isa = e->loc.isa; + out_opcode (DW_LNS_set_isa); + out_uleb128 (isa); + } + + if ((e->loc.flags ^ flags) & DWARF2_FLAG_IS_STMT) { flags = e->loc.flags; out_opcode (DW_LNS_negate_stmt); - changed = 1; } - if (e->loc.flags & DWARF2_FLAG_BEGIN_BLOCK) - { - out_opcode (DW_LNS_set_basic_block); - changed = 1; - } + if (e->loc.flags & DWARF2_FLAG_BASIC_BLOCK) + out_opcode (DW_LNS_set_basic_block); + + if (e->loc.flags & DWARF2_FLAG_PROLOGUE_END) + out_opcode (DW_LNS_set_prologue_end); + + if (e->loc.flags & DWARF2_FLAG_EPILOGUE_BEGIN) + out_opcode (DW_LNS_set_epilogue_begin); /* Don't try to optimize away redundant entries; gdb wants two entries for a function where the code starts on the same line as the {, and there's no way to identify that case here. Trust gcc to optimize appropriately. */ - if (1 /* line != e->loc.line || changed */) - { - int line_delta = e->loc.line - line; - if (frag == NULL) - { - out_set_addr (seg, e->frag, e->frag_ofs); - out_inc_line_addr (line_delta, 0); - } - else if (frag == e->frag) - out_inc_line_addr (line_delta, e->frag_ofs - frag_ofs); - else - relax_inc_line_addr (line_delta, seg, e->frag, e->frag_ofs, - frag, frag_ofs); + line_delta = e->loc.line - line; + lab = e->label; + frag = symbol_get_frag (lab); + frag_ofs = S_GET_VALUE (lab); - frag = e->frag; - frag_ofs = e->frag_ofs; - line = e->loc.line; - } - else if (frag == NULL) + if (last_frag == NULL) { - out_set_addr (seg, e->frag, e->frag_ofs); - frag = e->frag; - frag_ofs = e->frag_ofs; + out_set_addr (lab); + out_inc_line_addr (line_delta, 0); } + else if (frag == last_frag) + out_inc_line_addr (line_delta, frag_ofs - last_frag_ofs); + else + relax_inc_line_addr (line_delta, lab, last_lab); + + line = e->loc.line; + last_lab = lab; + last_frag = frag; + last_frag_ofs = frag_ofs; next = e->next; free (e); e = next; } + while (e); /* Emit a DW_LNE_end_sequence for the end of the section. */ - last_frag = last_frag_for_seg (seg); - last_frag_ofs = get_frag_fix (last_frag); + frag = last_frag_for_seg (seg); + frag_ofs = get_frag_fix (frag); if (frag == last_frag) - out_inc_line_addr (INT_MAX, last_frag_ofs - frag_ofs); + out_inc_line_addr (INT_MAX, frag_ofs - last_frag_ofs); else - relax_inc_line_addr (INT_MAX, seg, last_frag, last_frag_ofs, - frag, frag_ofs); + { + lab = symbol_temp_new (seg, frag_ofs, frag); + relax_inc_line_addr (INT_MAX, lab, last_lab); + } } /* Emit the directory and file tables for .debug_line. */ @@ -1116,6 +1262,9 @@ out_debug_line (segT line_seg) out_byte (0); /* DW_LNS_set_basic_block */ out_byte (0); /* DW_LNS_const_add_pc */ out_byte (1); /* DW_LNS_fixed_advance_pc */ + out_byte (0); /* DW_LNS_set_prologue_end */ + out_byte (0); /* DW_LNS_set_epilogue_begin */ + out_byte (1); /* DW_LNS_set_isa */ out_file_list (); @@ -1349,21 +1498,28 @@ out_debug_info (segT info_seg, segT abbrev_seg, segT line_seg) symbol_set_value_now (info_end); } +/* Finish the dwarf2 debug sections. We emit .debug.line if there + were any .file/.loc directives, or --gdwarf2 was given, or if the + file has a non-empty .debug_info section. If we emit .debug_line, + and the .debug_info section is empty, we also emit .debug_info, + .debug_aranges and .debug_abbrev. ALL_SEGS will be non-null if + there were any .file/.loc directives, or --gdwarf2 was given and + there were any located instructions emitted. */ + void dwarf2_finish (void) { segT line_seg; struct line_seg *s; + segT info_seg; + int emit_other_sections = 0; - /* We don't need to do anything unless: - - Some debug information was recorded via .file/.loc - - or, we are generating DWARF2 information ourself (--gdwarf2) - - or, there is a user-provided .debug_info section which could - reference the file table in the .debug_line section we generate - below. */ - if (all_segs == NULL - && debug_type != DEBUG_DWARF2 - && bfd_get_section_by_name (stdoutput, ".debug_info") == NULL) + info_seg = bfd_get_section_by_name (stdoutput, ".debug_info"); + emit_other_sections = info_seg == NULL || !seg_not_empty_p (info_seg); + + if (!all_segs && emit_other_sections) + /* There is no line information and no non-empty .debug_info + section. */ return; /* Calculate the size of an address for the target machine. */ @@ -1371,7 +1527,7 @@ dwarf2_finish (void) /* Create and switch to the line number section. */ line_seg = subseg_new (".debug_line", 0); - bfd_set_section_flags (stdoutput, line_seg, SEC_READONLY); + bfd_set_section_flags (stdoutput, line_seg, SEC_READONLY | SEC_DEBUGGING); /* For each subsection, chain the debug entries together. */ for (s = all_segs; s; s = s->next) @@ -1388,21 +1544,26 @@ dwarf2_finish (void) out_debug_line (line_seg); - /* If this is assembler generated line info, we need .debug_info - and .debug_abbrev sections as well. */ - if (all_segs != NULL && debug_type == DEBUG_DWARF2) + /* If this is assembler generated line info, and there is no + debug_info already, we need .debug_info and .debug_abbrev + sections as well. */ + if (emit_other_sections) { segT abbrev_seg; - segT info_seg; segT aranges_seg; + assert (all_segs); + info_seg = subseg_new (".debug_info", 0); abbrev_seg = subseg_new (".debug_abbrev", 0); aranges_seg = subseg_new (".debug_aranges", 0); - bfd_set_section_flags (stdoutput, info_seg, SEC_READONLY); - bfd_set_section_flags (stdoutput, abbrev_seg, SEC_READONLY); - bfd_set_section_flags (stdoutput, aranges_seg, SEC_READONLY); + bfd_set_section_flags (stdoutput, info_seg, + SEC_READONLY | SEC_DEBUGGING); + bfd_set_section_flags (stdoutput, abbrev_seg, + SEC_READONLY | SEC_DEBUGGING); + bfd_set_section_flags (stdoutput, aranges_seg, + SEC_READONLY | SEC_DEBUGGING); record_alignment (aranges_seg, ffs (2 * sizeof_address) - 1); @@ -1411,54 +1572,3 @@ dwarf2_finish (void) out_debug_info (info_seg, abbrev_seg, line_seg); } } - -#else -void -dwarf2_finish () -{ -} - -int -dwarf2dbg_estimate_size_before_relax (frag) - fragS *frag ATTRIBUTE_UNUSED; -{ - as_fatal (_("dwarf2 is not supported for this object file format")); - return 0; -} - -int -dwarf2dbg_relax_frag (frag) - fragS *frag ATTRIBUTE_UNUSED; -{ - as_fatal (_("dwarf2 is not supported for this object file format")); - return 0; -} - -void -dwarf2dbg_convert_frag (frag) - fragS *frag ATTRIBUTE_UNUSED; -{ - as_fatal (_("dwarf2 is not supported for this object file format")); -} - -void -dwarf2_emit_insn (size) - int size ATTRIBUTE_UNUSED; -{ -} - -char * -dwarf2_directive_file (dummy) - int dummy ATTRIBUTE_UNUSED; -{ - s_app_file (0); - return NULL; -} - -void -dwarf2_directive_loc (dummy) - int dummy ATTRIBUTE_UNUSED; -{ - as_fatal (_("dwarf2 is not supported for this object file format")); -} -#endif /* BFD_ASSEMBLER */ diff --git a/contrib/binutils/gas/dwarf2dbg.h b/contrib/binutils/gas/dwarf2dbg.h index fe8bf277eaa..cd1d17b2031 100644 --- a/contrib/binutils/gas/dwarf2dbg.h +++ b/contrib/binutils/gas/dwarf2dbg.h @@ -1,5 +1,5 @@ /* dwarf2dbg.h - DWARF2 debug support - Copyright 1999, 2000 Free Software Foundation, Inc. + Copyright 1999, 2000, 2002, 2003 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -15,21 +15,24 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #ifndef AS_DWARF2DBG_H #define AS_DWARF2DBG_H #include "as.h" -#define DWARF2_FLAG_BEGIN_STMT (1 << 0) /* beginning of statement */ -#define DWARF2_FLAG_BEGIN_BLOCK (1 << 1) /* beginning of basic block */ +#define DWARF2_FLAG_IS_STMT (1 << 0) +#define DWARF2_FLAG_BASIC_BLOCK (1 << 1) +#define DWARF2_FLAG_PROLOGUE_END (1 << 2) +#define DWARF2_FLAG_EPILOGUE_BEGIN (1 << 3) struct dwarf2_line_info { unsigned int filenum; unsigned int line; unsigned int column; + unsigned int isa; unsigned int flags; }; @@ -46,12 +49,19 @@ extern char *dwarf2_directive_file (int dummy); used. */ extern void dwarf2_directive_loc (int dummy); +/* Implements the .loc_mark_labels {0,1} directive. */ +extern void dwarf2_directive_loc_mark_labels (int dummy); + /* Returns the current source information. If .file directives have been encountered, the info for the corresponding source file is returned. Otherwise, the info for the assembly source file is returned. */ extern void dwarf2_where (struct dwarf2_line_info *l); +/* A hook to allow the target backend to inform the line number state + machine of isa changes when assembler debug info is enabled. */ +extern void dwarf2_set_isa (unsigned int isa); + /* This function generates .debug_line info based on the address and source information passed in the arguments. ADDR should be the frag-relative offset of the instruction the information is for and @@ -62,6 +72,14 @@ extern void dwarf2_gen_line_info (addressT addr, struct dwarf2_line_info *l); /* Must be called for each generated instruction. */ extern void dwarf2_emit_insn (int); +/* Should be called for each code label. */ +extern void dwarf2_emit_label (symbolS *); + +/* True when we're supposed to set the basic block mark whenever a label + is seen. Unless the target is doing Something Weird, just call + dwarf2_emit_label. */ +bfd_boolean dwarf2_loc_mark_labels; + extern void dwarf2_finish (void); extern int dwarf2dbg_estimate_size_before_relax (fragS *); diff --git a/contrib/binutils/gas/ecoff.c b/contrib/binutils/gas/ecoff.c index 1de823e24df..45116e86db0 100644 --- a/contrib/binutils/gas/ecoff.c +++ b/contrib/binutils/gas/ecoff.c @@ -1,5 +1,6 @@ /* ECOFF debugging support. - Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 + Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, + 2003, 2004, 2005 Free Software Foundation, Inc. Contributed by Cygnus Support. This file was put together by Ian Lance Taylor . A @@ -20,8 +21,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #include "as.h" @@ -2312,7 +2313,7 @@ add_file (const char *file_name, int indx ATTRIBUTE_UNUSED, int fake) compiler output, only in hand coded assembler. */ void -ecoff_new_file (const char *name) +ecoff_new_file (const char *name, int appfile ATTRIBUTE_UNUSED) { if (cur_file_ptr != NULL && strcmp (cur_file_ptr->name, name) == 0) return; @@ -3185,14 +3186,10 @@ ecoff_directive_frame (int ignore ATTRIBUTE_UNUSED) cur_proc_ptr->pdr.pcreg = tc_get_register (0); -#if 0 /* Alpha-OSF1 adds "the offset of saved $a0 from $sp", according to Sandro. I don't yet know where this value should be stored, if - anywhere. */ - demand_empty_rest_of_line (); -#else + anywhere. Don't call demand_empty_rest_of_line (). */ s_ignore (42); -#endif } /* Parse .mask directives. */ @@ -3685,6 +3682,8 @@ ecoff_build_lineno (const struct ecoff_debug_swap *backend, iline = 0; totcount = 0; + /* FIXME? Now that MIPS embedded-PIC is gone, it may be safe to + remove this code. */ /* For some reason the address of the first procedure is ignored when reading line numbers. This doesn't matter if the address of the first procedure is 0, but when gcc is generating MIPS diff --git a/contrib/binutils/gas/ecoff.h b/contrib/binutils/gas/ecoff.h index 2f09afca857..3fa1293c6da 100644 --- a/contrib/binutils/gas/ecoff.h +++ b/contrib/binutils/gas/ecoff.h @@ -1,5 +1,5 @@ /* ecoff.h -- header file for ECOFF debugging support - Copyright 1993, 1994, 1995, 1996, 1997, 1998 + Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2003, 2005 Free Software Foundation, Inc. Contributed by Cygnus Support. Put together by Ian Lance Taylor . @@ -18,8 +18,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #ifndef GAS_ECOFF_H #define GAS_ECOFF_H @@ -38,7 +38,7 @@ extern void ecoff_read_begin_hook (void); /* This function should be called when the assembler switches to a new file. */ -extern void ecoff_new_file (const char *); +extern void ecoff_new_file (const char *, int); /* This function should be called when a new symbol is created, by obj_symbol_new_hook. */ diff --git a/contrib/binutils/gas/ehopt.c b/contrib/binutils/gas/ehopt.c index 451aaff18c9..6b0ac513237 100644 --- a/contrib/binutils/gas/ehopt.c +++ b/contrib/binutils/gas/ehopt.c @@ -1,5 +1,5 @@ /* ehopt.c--optimize gcc exception frame information. - Copyright 1998, 2000, 2001, 2003 Free Software Foundation, Inc. + Copyright 1998, 2000, 2001, 2003, 2005 Free Software Foundation, Inc. Written by Ian Lance Taylor . This file is part of GAS, the GNU Assembler. @@ -16,8 +16,8 @@ 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. */ +Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA +02110-1301, USA. */ #include "as.h" #include "subsegs.h" @@ -111,16 +111,8 @@ get_cie_info (struct cie_info *info) /* We should find the CIE at the start of the section. */ -#if defined (BFD_ASSEMBLER) || defined (MANY_SEGMENTS) f = seg_info (now_seg)->frchainP->frch_root; -#else - f = frchain_now->frch_root; -#endif -#ifdef BFD_ASSEMBLER fix = seg_info (now_seg)->frchainP->fix_root; -#else - fix = *seg_fix_rootP; -#endif /* Look through the frags of the section to find the code alignment. */ diff --git a/contrib/binutils/gas/emul-target.h b/contrib/binutils/gas/emul-target.h index 4c1a02a500f..506fc61f6e2 100644 --- a/contrib/binutils/gas/emul-target.h +++ b/contrib/binutils/gas/emul-target.h @@ -1,5 +1,5 @@ /* emul-target.h. Default values for struct emulation defined in emul.h - Copyright 2001 Free Software Foundation, Inc. + Copyright 1995 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -15,8 +15,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #ifndef emul_init #define emul_init common_emul_init diff --git a/contrib/binutils/gas/emul.h b/contrib/binutils/gas/emul.h index e4afa68339f..6e89ae9efa6 100644 --- a/contrib/binutils/gas/emul.h +++ b/contrib/binutils/gas/emul.h @@ -1,5 +1,5 @@ /* emul.h. File format emulation routines - Copyright 2001 Free Software Foundation, Inc. + Copyright 1995, 2003 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -15,8 +15,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #ifndef EMUL_DEFS #define EMUL_DEFS diff --git a/contrib/binutils/gas/expr.c b/contrib/binutils/gas/expr.c index d520a04bcd3..69f0aaccdb6 100644 --- a/contrib/binutils/gas/expr.c +++ b/contrib/binutils/gas/expr.c @@ -1,6 +1,6 @@ /* expr.c -operands, expressions- Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002 + 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -17,8 +17,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ /* This is really a branch office of as-read.c. I split it out to clearly distinguish the world of expressions from the world of statements. @@ -41,7 +41,7 @@ static void integer_constant (int radix, expressionS * expressionP); static void mri_char_constant (expressionS *); static void current_location (expressionS *); static void clean_up_expression (expressionS * expressionP); -static segT operand (expressionS *); +static segT operand (expressionS *, enum expr_mode); static operatorT operator (int *); extern const char EXP_CHARS[], FLT_CHARS[]; @@ -157,33 +157,6 @@ expr_build_uconstant (offsetT value) return make_expr_symbol (&e); } -/* Build an expression for OP s1. */ - -symbolS * -expr_build_unary (operatorT op, symbolS *s1) -{ - expressionS e; - - e.X_op = op; - e.X_add_symbol = s1; - e.X_add_number = 0; - return make_expr_symbol (&e); -} - -/* Build an expression for s1 OP s2. */ - -symbolS * -expr_build_binary (operatorT op, symbolS *s1, symbolS *s2) -{ - expressionS e; - - e.X_op = op; - e.X_add_symbol = s1; - e.X_op_symbol = s2; - e.X_add_number = 0; - return make_expr_symbol (&e); -} - /* Build an expression for the current location ('.'). */ symbolS * @@ -213,8 +186,6 @@ FLONUM_TYPE generic_floating_point_number = { 0 /* sign. */ }; -/* If nonzero, we've been asked to assemble nan, +inf or -inf. */ -int generic_floating_point_magic; static void floating_constant (expressionS *expressionP) @@ -330,7 +301,10 @@ integer_constant (int radix, expressionS *expressionP) { c = *--suffix; c = TOUPPER (c); - if (c == 'B') + /* If we have both NUMBERS_WITH_SUFFIX and LOCAL_LABELS_FB, + we distinguish between 'B' and 'b'. This is the case for + Z80. */ + if ((NUMBERS_WITH_SUFFIX && LOCAL_LABELS_FB ? *suffix : c) == 'B') radix = 2; else if (c == 'D') radix = 10; @@ -609,10 +583,6 @@ integer_constant (int radix, expressionS *expressionP) else { expressionP->X_op = O_constant; -#ifdef TARGET_WORD_SIZE - /* Sign extend NUMBER. */ - number |= (-(number >> (TARGET_WORD_SIZE - 1))) << (TARGET_WORD_SIZE - 1); -#endif expressionP->X_add_number = number; input_line_pointer--; /* Restore following character. */ } /* Really just a number. */ @@ -741,7 +711,7 @@ current_location (expressionS *expressionp) Input_line_pointer->(next non-blank) char after operand. */ static segT -operand (expressionS *expressionP) +operand (expressionS *expressionP, enum expr_mode mode) { char c; symbolS *symbolP; /* Points to symbol. */ @@ -977,16 +947,14 @@ operand (expressionS *expressionP) case '[': #endif /* Didn't begin with digit & not a name. */ - segment = expression (expressionP); + if (mode != expr_defer) + segment = expression (expressionP); + else + segment = deferred_expression (expressionP); /* expression () will pass trailing whitespace. */ if ((c == '(' && *input_line_pointer != ')') || (c == '[' && *input_line_pointer != ']')) - { -#ifdef RELAX_PAREN_GROUPING - if (c != '(') -#endif - as_bad (_("missing '%c'"), c == '(' ? ')' : ']'); - } + as_bad (_("missing '%c'"), c == '(' ? ')' : ']'); else input_line_pointer++; SKIP_WHITESPACE (); @@ -1020,14 +988,6 @@ operand (expressionS *expressionP) mri_char_constant (expressionP); break; - case '+': - /* Do not accept ++e as +(+e). - Disabled, since the preprocessor removes whitespace. */ - if (0 && *input_line_pointer == '+') - goto target_op; - (void) operand (expressionP); - break; - #ifdef TC_M68K case '"': /* Double quote is the bitwise not operator in MRI mode. */ @@ -1041,13 +1001,14 @@ operand (expressionS *expressionP) goto isname; case '!': case '-': + case '+': { - /* Do not accept --e as -(-e) + /* Do not accept ++e or --e as +(+e) or -(-e) Disabled, since the preprocessor removes whitespace. */ - if (0 && c == '-' && *input_line_pointer == '-') + if (0 && (c == '-' || c == '+') && *input_line_pointer == c) goto target_op; - operand (expressionP); + operand (expressionP, mode); if (expressionP->X_op == O_constant) { /* input_line_pointer -> char after operand. */ @@ -1061,7 +1022,7 @@ operand (expressionS *expressionP) } else if (c == '~' || c == '"') expressionP->X_add_number = ~ expressionP->X_add_number; - else + else if (c == '!') expressionP->X_add_number = ! expressionP->X_add_number; } else if (expressionP->X_op == O_big @@ -1076,17 +1037,49 @@ operand (expressionS *expressionP) else generic_floating_point_number.sign = 'N'; } + else if (expressionP->X_op == O_big + && expressionP->X_add_number > 0) + { + int i; + + if (c == '~' || c == '-') + { + for (i = 0; i < expressionP->X_add_number; ++i) + generic_bignum[i] = ~generic_bignum[i]; + if (c == '-') + for (i = 0; i < expressionP->X_add_number; ++i) + { + generic_bignum[i] += 1; + if (generic_bignum[i]) + break; + } + } + else if (c == '!') + { + int nonzero = 0; + for (i = 0; i < expressionP->X_add_number; ++i) + { + if (generic_bignum[i]) + nonzero = 1; + generic_bignum[i] = 0; + } + generic_bignum[0] = nonzero; + } + } else if (expressionP->X_op != O_illegal && expressionP->X_op != O_absent) { - expressionP->X_add_symbol = make_expr_symbol (expressionP); - if (c == '-') - expressionP->X_op = O_uminus; - else if (c == '~' || c == '"') - expressionP->X_op = O_bit_not; - else - expressionP->X_op = O_logical_not; - expressionP->X_add_number = 0; + if (c != '+') + { + expressionP->X_add_symbol = make_expr_symbol (expressionP); + if (c == '-') + expressionP->X_op = O_uminus; + else if (c == '~' || c == '"') + expressionP->X_op = O_bit_not; + else + expressionP->X_op = O_logical_not; + expressionP->X_add_number = 0; + } } else as_warn (_("Unary operator %c ignored because bad operand follows"), @@ -1102,10 +1095,10 @@ operand (expressionS *expressionP) if (! flag_m68k_mri) goto de_fault; #endif - if (flag_m68k_mri && hex_p (*input_line_pointer)) + if (DOLLAR_AMBIGU && hex_p (*input_line_pointer)) { - /* In MRI mode, '$' is also used as the prefix for a - hexadecimal constant. */ + /* In MRI mode and on Z80, '$' is also used as the prefix + for a hexadecimal constant. */ integer_constant (16, expressionP); break; } @@ -1227,7 +1220,7 @@ operand (expressionS *expressionP) specially in certain contexts. If a name always has a specific value, it can often be handled by simply entering it in the symbol table. */ - if (md_parse_name (name, expressionP, &c)) + if (md_parse_name (name, expressionP, mode, &c)) { *input_line_pointer = c; break; @@ -1278,12 +1271,12 @@ operand (expressionS *expressionP) /* If we have an absolute symbol or a reg, then we know its value now. */ segment = S_GET_SEGMENT (symbolP); - if (segment == absolute_section) + if (mode != expr_defer && segment == absolute_section) { expressionP->X_op = O_constant; expressionP->X_add_number = S_GET_VALUE (symbolP); } - else if (segment == reg_section) + else if (mode != expr_defer && segment == reg_section) { expressionP->X_op = O_register; expressionP->X_add_number = S_GET_VALUE (symbolP); @@ -1327,6 +1320,9 @@ operand (expressionS *expressionP) if (expressionP->X_add_symbol) symbol_mark_used (expressionP->X_add_symbol); + expressionP->X_add_symbol = symbol_clone_if_forward_ref (expressionP->X_add_symbol); + expressionP->X_op_symbol = symbol_clone_if_forward_ref (expressionP->X_op_symbol); + switch (expressionP->X_op) { default: @@ -1394,6 +1390,9 @@ clean_up_expression (expressionS *expressionP) #undef __ #define __ O_illegal +#ifndef O_SINGLE_EQ +#define O_SINGLE_EQ O_illegal +#endif /* Maps ASCII -> operators. */ static const operatorT op_encoding[256] = { @@ -1403,7 +1402,7 @@ static const operatorT op_encoding[256] = { __, O_bit_or_not, __, __, __, O_modulus, O_bit_and, __, __, __, O_multiply, O_add, __, O_subtract, __, O_divide, __, __, __, __, __, __, __, __, - __, __, __, __, O_lt, __, O_gt, __, + __, __, __, __, O_lt, O_SINGLE_EQ, O_gt, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, @@ -1600,15 +1599,21 @@ operator (int *num_chars) return ret; case '!': - /* We accept !! as equivalent to ^ for MRI compatibility. */ - if (input_line_pointer[1] != '!') + switch (input_line_pointer[1]) { + case '!': + /* We accept !! as equivalent to ^ for MRI compatibility. */ + *num_chars = 2; + return O_bit_exclusive_or; + case '=': + /* We accept != as equivalent to <>. */ + *num_chars = 2; + return O_ne; + default: if (flag_m68k_mri) return O_bit_inclusive_or; return op_encoding[c]; } - *num_chars = 2; - return O_bit_exclusive_or; case '|': if (input_line_pointer[1] != '|') @@ -1632,7 +1637,8 @@ operator (int *num_chars) segT expr (int rankarg, /* Larger # is higher rank. */ - expressionS *resultP /* Deliver result here. */) + expressionS *resultP, /* Deliver result here. */ + enum expr_mode mode /* Controls behavior. */) { operator_rankT rank = (operator_rankT) rankarg; segT retval; @@ -1647,7 +1653,7 @@ expr (int rankarg, /* Larger # is higher rank. */ if (rank == 0) dot_value = frag_now_fix (); - retval = operand (resultP); + retval = operand (resultP, mode); /* operand () gobbles spaces. */ know (*input_line_pointer != ' '); @@ -1656,10 +1662,11 @@ expr (int rankarg, /* Larger # is higher rank. */ while (op_left != O_illegal && op_rank[(int) op_left] > rank) { segT rightseg; + bfd_vma frag_off; input_line_pointer += op_chars; /* -> after operator. */ - rightseg = expr (op_rank[(int) op_left], &right); + rightseg = expr (op_rank[(int) op_left], &right, mode); if (right.X_op == O_absent) { as_warn (_("missing operand; zero assumed")); @@ -1687,7 +1694,7 @@ expr (int rankarg, /* Larger # is higher rank. */ know (op_right == O_illegal || op_rank[(int) op_right] <= op_rank[(int) op_left]); know ((int) op_left >= (int) O_multiply - && (int) op_left <= (int) O_logical_or); + && (int) op_left <= (int) O_index); /* input_line_pointer->after right-hand quantity. */ /* left-hand quantity in resultP. */ @@ -1735,12 +1742,15 @@ expr (int rankarg, /* Larger # is higher rank. */ else if (op_left == O_subtract && right.X_op == O_symbol && resultP->X_op == O_symbol - && (symbol_get_frag (right.X_add_symbol) - == symbol_get_frag (resultP->X_add_symbol)) + && retval == rightseg && (SEG_NORMAL (rightseg) - || right.X_add_symbol == resultP->X_add_symbol)) + || right.X_add_symbol == resultP->X_add_symbol) + && frag_offset_fixed_p (symbol_get_frag (resultP->X_add_symbol), + symbol_get_frag (right.X_add_symbol), + &frag_off)) { resultP->X_add_number -= right.X_add_number; + resultP->X_add_number -= frag_off / OCTETS_PER_BYTE; resultP->X_add_number += (S_GET_VALUE (resultP->X_add_symbol) - S_GET_VALUE (right.X_add_symbol)); resultP->X_op = O_constant; @@ -1874,8 +1884,269 @@ expr (int rankarg, /* Larger # is higher rank. */ if (resultP->X_add_symbol) symbol_mark_used (resultP->X_add_symbol); + if (rank == 0 && mode == expr_evaluate) + resolve_expression (resultP); + return resultP->X_op == O_constant ? absolute_section : retval; } + +/* Resolve an expression without changing any symbols/sub-expressions + used. */ + +int +resolve_expression (expressionS *expressionP) +{ + /* Help out with CSE. */ + valueT final_val = expressionP->X_add_number; + symbolS *add_symbol = expressionP->X_add_symbol; + symbolS *op_symbol = expressionP->X_op_symbol; + operatorT op = expressionP->X_op; + valueT left, right; + segT seg_left, seg_right; + fragS *frag_left, *frag_right; + bfd_vma frag_off; + + switch (op) + { + default: + return 0; + + case O_constant: + case O_register: + left = 0; + break; + + case O_symbol: + case O_symbol_rva: + if (!snapshot_symbol (&add_symbol, &left, &seg_left, &frag_left)) + return 0; + + break; + + case O_uminus: + case O_bit_not: + case O_logical_not: + if (!snapshot_symbol (&add_symbol, &left, &seg_left, &frag_left)) + return 0; + + if (seg_left != absolute_section) + return 0; + + if (op == O_logical_not) + left = !left; + else if (op == O_uminus) + left = -left; + else + left = ~left; + op = O_constant; + break; + + case O_multiply: + case O_divide: + case O_modulus: + case O_left_shift: + case O_right_shift: + case O_bit_inclusive_or: + case O_bit_or_not: + case O_bit_exclusive_or: + case O_bit_and: + case O_add: + case O_subtract: + case O_eq: + case O_ne: + case O_lt: + case O_le: + case O_ge: + case O_gt: + case O_logical_and: + case O_logical_or: + if (!snapshot_symbol (&add_symbol, &left, &seg_left, &frag_left) + || !snapshot_symbol (&op_symbol, &right, &seg_right, &frag_right)) + return 0; + + /* Simplify addition or subtraction of a constant by folding the + constant into X_add_number. */ + if (op == O_add) + { + if (seg_right == absolute_section) + { + final_val += right; + op = O_symbol; + break; + } + else if (seg_left == absolute_section) + { + final_val += left; + left = right; + seg_left = seg_right; + add_symbol = op_symbol; + op = O_symbol; + break; + } + } + else if (op == O_subtract) + { + if (seg_right == absolute_section) + { + final_val -= right; + op = O_symbol; + break; + } + } + + /* Equality and non-equality tests are permitted on anything. + Subtraction, and other comparison operators are permitted if + both operands are in the same section. + Shifts by constant zero are permitted on anything. + Multiplies, bit-ors, and bit-ands with constant zero are + permitted on anything. + Multiplies and divides by constant one are permitted on + anything. + Binary operations with both operands being the same register + or undefined symbol are permitted if the result doesn't depend + on the input value. + Otherwise, both operands must be absolute. We already handled + the case of addition or subtraction of a constant above. */ + frag_off = 0; + if (!(seg_left == absolute_section + && seg_right == absolute_section) + && !(op == O_eq || op == O_ne) + && !((op == O_subtract + || op == O_lt || op == O_le || op == O_ge || op == O_gt) + && seg_left == seg_right + && (finalize_syms + || frag_offset_fixed_p (frag_left, frag_right, &frag_off)) + && (seg_left != reg_section || left == right) + && (seg_left != undefined_section || add_symbol == op_symbol))) + { + if ((seg_left == absolute_section && left == 0) + || (seg_right == absolute_section && right == 0)) + { + if (op == O_bit_exclusive_or || op == O_bit_inclusive_or) + { + if (seg_right != absolute_section || right != 0) + { + seg_left = seg_right; + left = right; + add_symbol = op_symbol; + } + op = O_symbol; + break; + } + else if (op == O_left_shift || op == O_right_shift) + { + if (seg_left != absolute_section || left != 0) + { + op = O_symbol; + break; + } + } + else if (op != O_multiply + && op != O_bit_or_not && op != O_bit_and) + return 0; + } + else if (op == O_multiply + && seg_left == absolute_section && left == 1) + { + seg_left = seg_right; + left = right; + add_symbol = op_symbol; + op = O_symbol; + break; + } + else if ((op == O_multiply || op == O_divide) + && seg_right == absolute_section && right == 1) + { + op = O_symbol; + break; + } + else if (left != right + || ((seg_left != reg_section || seg_right != reg_section) + && (seg_left != undefined_section + || seg_right != undefined_section + || add_symbol != op_symbol))) + return 0; + else if (op == O_bit_and || op == O_bit_inclusive_or) + { + op = O_symbol; + break; + } + else if (op != O_bit_exclusive_or && op != O_bit_or_not) + return 0; + } + + right += frag_off / OCTETS_PER_BYTE; + switch (op) + { + case O_add: left += right; break; + case O_subtract: left -= right; break; + case O_multiply: left *= right; break; + case O_divide: + if (right == 0) + return 0; + left = (offsetT) left / (offsetT) right; + break; + case O_modulus: + if (right == 0) + return 0; + left = (offsetT) left % (offsetT) right; + break; + case O_left_shift: left <<= right; break; + case O_right_shift: left >>= right; break; + case O_bit_inclusive_or: left |= right; break; + case O_bit_or_not: left |= ~right; break; + case O_bit_exclusive_or: left ^= right; break; + case O_bit_and: left &= right; break; + case O_eq: + case O_ne: + left = (left == right + && seg_left == seg_right + && (finalize_syms || frag_left == frag_right) + && (seg_left != undefined_section + || add_symbol == op_symbol) + ? ~ (valueT) 0 : 0); + if (op == O_ne) + left = ~left; + break; + case O_lt: + left = (offsetT) left < (offsetT) right ? ~ (valueT) 0 : 0; + break; + case O_le: + left = (offsetT) left <= (offsetT) right ? ~ (valueT) 0 : 0; + break; + case O_ge: + left = (offsetT) left >= (offsetT) right ? ~ (valueT) 0 : 0; + break; + case O_gt: + left = (offsetT) left > (offsetT) right ? ~ (valueT) 0 : 0; + break; + case O_logical_and: left = left && right; break; + case O_logical_or: left = left || right; break; + default: abort (); + } + + op = O_constant; + break; + } + + if (op == O_symbol) + { + if (seg_left == absolute_section) + op = O_constant; + else if (seg_left == reg_section && final_val == 0) + op = O_register; + else if (add_symbol != expressionP->X_add_symbol) + final_val += left; + expressionP->X_add_symbol = add_symbol; + } + expressionP->X_op = op; + + if (op == O_constant || op == O_register) + final_val += left; + expressionP->X_add_number = final_val; + + return 1; +} /* This lives here because it belongs equally in expr.c & read.c. expr.c is just a branch office read.c anyway, and putting it @@ -1912,6 +2183,6 @@ unsigned int get_single_number (void) { expressionS exp; - operand (&exp); + operand (&exp, expr_normal); return exp.X_add_number; } diff --git a/contrib/binutils/gas/expr.h b/contrib/binutils/gas/expr.h index 382dda9b1f2..6b88d0dfe43 100644 --- a/contrib/binutils/gas/expr.h +++ b/contrib/binutils/gas/expr.h @@ -1,6 +1,6 @@ /* expr.h -> header file for expr.c - Copyright 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 - Free Software Foundation, Inc. + Copyright 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, + 2002, 2003 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -16,8 +16,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ /* * By popular demand, we define a struct to represent an expression. @@ -143,8 +143,17 @@ typedef struct expressionS { unsigned short X_md; } expressionS; +enum expr_mode +{ + expr_evaluate, + expr_normal, + expr_defer +}; + /* "result" should be type (expressionS *). */ -#define expression(result) expr (0, result) +#define expression(result) expr (0, result, expr_normal) +#define expression_and_evaluate(result) expr (0, result, expr_evaluate) +#define deferred_expression(result) expr (0, result, expr_defer) /* If an expression is O_big, look here for its value. These common data may be clobbered whenever expr() is called. */ @@ -160,12 +169,12 @@ typedef char operator_rankT; extern char get_symbol_end (void); extern void expr_begin (void); extern void expr_set_precedence (void); -extern segT expr (int rank, expressionS * resultP); +extern segT expr (int, expressionS *, enum expr_mode); extern unsigned int get_single_number (void); extern symbolS *make_expr_symbol (expressionS * expressionP); extern int expr_symbol_where (symbolS *, char **, unsigned int *); extern symbolS *expr_build_uconstant (offsetT); -extern symbolS *expr_build_unary (operatorT, symbolS *); -extern symbolS *expr_build_binary (operatorT, symbolS *, symbolS *); extern symbolS *expr_build_dot (void); + +int resolve_expression (expressionS *); diff --git a/contrib/binutils/gas/flonum-copy.c b/contrib/binutils/gas/flonum-copy.c index e3aba2c4661..b8b3e5e3cad 100644 --- a/contrib/binutils/gas/flonum-copy.c +++ b/contrib/binutils/gas/flonum-copy.c @@ -1,5 +1,5 @@ /* flonum_copy.c - copy a flonum - Copyright 1987, 1990, 1991, 1992, 1993, 2000 + Copyright 1987, 1990, 1991, 1992, 1993, 2000, 2003 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -16,8 +16,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #include "as.h" diff --git a/contrib/binutils/gas/flonum-konst.c b/contrib/binutils/gas/flonum-konst.c index 3e606fbfd7d..9d0cfe6f9c8 100644 --- a/contrib/binutils/gas/flonum-konst.c +++ b/contrib/binutils/gas/flonum-konst.c @@ -16,8 +16,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #include "ansidecl.h" #include "flonum.h" diff --git a/contrib/binutils/gas/flonum-mult.c b/contrib/binutils/gas/flonum-mult.c index 6d17f0a8697..c6dd8ffdd7b 100644 --- a/contrib/binutils/gas/flonum-mult.c +++ b/contrib/binutils/gas/flonum-mult.c @@ -1,5 +1,5 @@ /* flonum_mult.c - multiply two flonums - Copyright 1987, 1990, 1991, 1992, 1995, 2000, 2002 + Copyright 1987, 1990, 1991, 1992, 1995, 2000, 2002, 2003 Free Software Foundation, Inc. This file is part of Gas, the GNU Assembler. diff --git a/contrib/binutils/gas/flonum.h b/contrib/binutils/gas/flonum.h index 22aa7558e83..04f5b8990f9 100644 --- a/contrib/binutils/gas/flonum.h +++ b/contrib/binutils/gas/flonum.h @@ -1,5 +1,5 @@ /* flonum.h - Floating point package - Copyright 1987, 1990, 1991, 1992, 1994, 1996, 2000 + Copyright 1987, 1990, 1991, 1992, 1994, 1996, 2000, 2003 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -16,8 +16,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ /***********************************************************************\ * * diff --git a/contrib/binutils/gas/frags.c b/contrib/binutils/gas/frags.c index 83625d7fbf6..b08ef502cbf 100644 --- a/contrib/binutils/gas/frags.c +++ b/contrib/binutils/gas/frags.c @@ -1,6 +1,6 @@ /* frags.c - manage frags - Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2003 + 1999, 2000, 2001, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -17,8 +17,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #include "as.h" #include "subsegs.h" @@ -91,7 +91,14 @@ frag_grow (unsigned int nchars) frag_wane (frag_now); frag_new (0); oldc = frchain_now->frch_obstack.chunk_size; - frchain_now->frch_obstack.chunk_size = 2 * nchars + SIZEOF_STRUCT_FRAG; + /* Try to allocate a bit more than needed right now. But don't do + this if we would waste too much memory. Especially necessary + for extremely big (like 2GB initialized) frags. */ + if (nchars < 0x10000) + frchain_now->frch_obstack.chunk_size = 2 * nchars; + else + frchain_now->frch_obstack.chunk_size = nchars + 0x10000; + frchain_now->frch_obstack.chunk_size += SIZEOF_STRUCT_FRAG; if (frchain_now->frch_obstack.chunk_size > 0) while ((n = obstack_room (&frchain_now->frch_obstack)) < nchars && (unsigned long) frchain_now->frch_obstack.chunk_size > nchars) @@ -376,3 +383,56 @@ frag_append_1_char (int datum) } obstack_1grow (&frchain_now->frch_obstack, datum); } + +/* Return TRUE if FRAG1 and FRAG2 have a fixed relationship between + their start addresses. Set OFFSET to the difference in address + not already accounted for in the frag FR_ADDRESS. */ + +bfd_boolean +frag_offset_fixed_p (fragS *frag1, fragS *frag2, bfd_vma *offset) +{ + fragS *frag; + bfd_vma off; + + /* Start with offset initialised to difference between the two frags. + Prior to assigning frag addresses this will be zero. */ + off = frag1->fr_address - frag2->fr_address; + if (frag1 == frag2) + { + *offset = off; + return TRUE; + } + + /* Maybe frag2 is after frag1. */ + frag = frag1; + while (frag->fr_type == rs_fill) + { + off += frag->fr_fix + frag->fr_offset * frag->fr_var; + frag = frag->fr_next; + if (frag == NULL) + break; + if (frag == frag2) + { + *offset = off; + return TRUE; + } + } + + /* Maybe frag1 is after frag2. */ + off = frag1->fr_address - frag2->fr_address; + frag = frag2; + while (frag->fr_type == rs_fill) + { + off -= frag->fr_fix + frag->fr_offset * frag->fr_var; + frag = frag->fr_next; + if (frag == NULL) + break; + if (frag == frag1) + { + *offset = off; + return TRUE; + } + } + + return FALSE; +} diff --git a/contrib/binutils/gas/frags.h b/contrib/binutils/gas/frags.h index 52a6cfeb4bd..880446763a4 100644 --- a/contrib/binutils/gas/frags.h +++ b/contrib/binutils/gas/frags.h @@ -1,6 +1,6 @@ /* frags.h - Header file for the frag concept. - Copyright 1987, 1992, 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001 - Free Software Foundation, Inc. + Copyright 1987, 1992, 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001, + 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -16,15 +16,13 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #ifndef FRAGS_H #define FRAGS_H -#ifdef ANSI_PROTOTYPES struct obstack; -#endif /* A code fragment (frag) is some known number of chars, followed by some unknown number of chars. Typically the unknown number of chars is an @@ -74,6 +72,11 @@ struct frag { fr_address has been adjusted. */ unsigned int relax_marker:1; + /* Used to ensure that all insns are emitted on proper address + boundaries. */ + unsigned int has_code:1; + unsigned int insn_addr:6; + /* What state is my tail in? */ relax_stateT fr_type; relax_substateT fr_subtype; @@ -114,22 +117,8 @@ COMMON fragS zero_address_frag; /* For local common (N_BSS segment) fixups. */ COMMON fragS bss_address_frag; -#if 0 -/* A macro to speed up appending exactly 1 char to current frag. */ -/* JF changed < 1 to <= 1 to avoid a race condition. */ -#define FRAG_APPEND_1_CHAR(datum) \ -{ \ - if (obstack_room (&frags) <= 1) \ - { \ - frag_wane (frag_now); \ - frag_new (0); \ - } \ - obstack_1grow (&frags, datum); \ -} -#else extern void frag_append_1_char (int); #define FRAG_APPEND_1_CHAR(X) frag_append_1_char (X) -#endif void frag_init (void); fragS *frag_alloc (struct obstack *); @@ -159,4 +148,6 @@ char *frag_var (relax_stateT type, offsetT offset, char *opcode); +bfd_boolean frag_offset_fixed_p (fragS *, fragS *, bfd_vma *); + #endif /* FRAGS_H */ diff --git a/contrib/binutils/gas/hash.c b/contrib/binutils/gas/hash.c index a7b82987b20..6977ceeb532 100644 --- a/contrib/binutils/gas/hash.c +++ b/contrib/binutils/gas/hash.c @@ -1,6 +1,6 @@ /* hash.c -- gas hash table code Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, - 2000, 2001, 2002 + 2000, 2001, 2002, 2003, 2005 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -17,8 +17,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ /* This version of the hash table code is a wholescale replacement of the old hash table code, which was fairly bad. This is based on @@ -33,10 +33,6 @@ #include "safe-ctype.h" #include "obstack.h" -/* The default number of entries to use when creating a hash table. */ - -#define DEFAULT_SIZE (4051) - /* An entry in a hash table. */ struct hash_entry { @@ -72,21 +68,55 @@ struct hash_control { #endif /* HASH_STATISTICS */ }; +/* The default number of entries to use when creating a hash table. + Note this value can be reduced to 4051 by using the command line + switch --reduce-memory-overheads, or set to other values by using + the --hash-size= switch. */ + +static unsigned long gas_hash_table_size = 65537; + +void +set_gas_hash_table_size (unsigned long size) +{ + gas_hash_table_size = size; +} + +/* FIXME: This function should be amalgmated with bfd/hash.c:bfd_hash_set_default_size(). */ +static unsigned long +get_gas_hash_table_size (void) +{ + /* Extend this prime list if you want more granularity of hash table size. */ + static const unsigned long hash_size_primes[] = + { + 1021, 4051, 8599, 16699, 65537 + }; + unsigned int index; + + /* Work out the best prime number near the hash_size. + FIXME: This could be a more sophisticated algorithm, + but is it really worth implementing it ? */ + for (index = 0; index < ARRAY_SIZE (hash_size_primes) - 1; ++index) + if (gas_hash_table_size <= hash_size_primes[index]) + break; + + return hash_size_primes[index]; +} + /* Create a hash table. This return a control block. */ struct hash_control * hash_new (void) { - unsigned int size; + unsigned long size; + unsigned long alloc; struct hash_control *ret; - unsigned int alloc; - size = DEFAULT_SIZE; + size = get_gas_hash_table_size (); - ret = (struct hash_control *) xmalloc (sizeof *ret); + ret = xmalloc (sizeof *ret); obstack_begin (&ret->memory, chunksize); alloc = size * sizeof (struct hash_entry *); - ret->table = (struct hash_entry **) obstack_alloc (&ret->memory, alloc); + ret->table = obstack_alloc (&ret->memory, alloc); memset (ret->table, 0, alloc); ret->size = size; @@ -120,19 +150,13 @@ hash_die (struct hash_control *table) Each time we look up a string, we move it to the start of the list for its hash code, to take advantage of referential locality. */ -static struct hash_entry *hash_lookup (struct hash_control *, - const char *, - struct hash_entry ***, - unsigned long *); - static struct hash_entry * -hash_lookup (struct hash_control *table, const char *key, +hash_lookup (struct hash_control *table, const char *key, size_t len, struct hash_entry ***plist, unsigned long *phash) { - register unsigned long hash; - unsigned int len; - register const unsigned char *s; - register unsigned int c; + unsigned long hash; + size_t n; + unsigned int c; unsigned int index; struct hash_entry **list; struct hash_entry *p; @@ -143,13 +167,11 @@ hash_lookup (struct hash_control *table, const char *key, #endif hash = 0; - len = 0; - s = (const unsigned char *) key; - while ((c = *s++) != '\0') + for (n = 0; n < len; n++) { + c = key[n]; hash += c + (c << 17); hash ^= hash >> 2; - ++len; } hash += len + (len << 17); hash ^= hash >> 2; @@ -176,7 +198,7 @@ hash_lookup (struct hash_control *table, const char *key, ++table->string_compares; #endif - if (strcmp (p->string, key) == 0) + if (strncmp (p->string, key, len) == 0 && p->string[len] == '\0') { if (prev != NULL) { @@ -207,7 +229,7 @@ hash_insert (struct hash_control *table, const char *key, PTR value) struct hash_entry **list; unsigned long hash; - p = hash_lookup (table, key, &list, &hash); + p = hash_lookup (table, key, strlen (key), &list, &hash); if (p != NULL) return "exists"; @@ -237,7 +259,7 @@ hash_jam (struct hash_control *table, const char *key, PTR value) struct hash_entry **list; unsigned long hash; - p = hash_lookup (table, key, &list, &hash); + p = hash_lookup (table, key, strlen (key), &list, &hash); if (p != NULL) { #ifdef HASH_STATISTICS @@ -274,7 +296,7 @@ hash_replace (struct hash_control *table, const char *key, PTR value) struct hash_entry *p; PTR ret; - p = hash_lookup (table, key, NULL, NULL); + p = hash_lookup (table, key, strlen (key), NULL, NULL); if (p == NULL) return NULL; @@ -297,7 +319,22 @@ hash_find (struct hash_control *table, const char *key) { struct hash_entry *p; - p = hash_lookup (table, key, NULL, NULL); + p = hash_lookup (table, key, strlen (key), NULL, NULL); + if (p == NULL) + return NULL; + + return p->data; +} + +/* As hash_find, but KEY is of length LEN and is not guaranteed to be + NUL-terminated. */ + +PTR +hash_find_n (struct hash_control *table, const char *key, size_t len) +{ + struct hash_entry *p; + + p = hash_lookup (table, key, len, NULL, NULL); if (p == NULL) return NULL; @@ -313,7 +350,7 @@ hash_delete (struct hash_control *table, const char *key) struct hash_entry *p; struct hash_entry **list; - p = hash_lookup (table, key, &list, NULL); + p = hash_lookup (table, key, strlen (key), &list, NULL); if (p == NULL) return NULL; diff --git a/contrib/binutils/gas/hash.h b/contrib/binutils/gas/hash.h index 08f41e6c9de..c2a8a203f94 100644 --- a/contrib/binutils/gas/hash.h +++ b/contrib/binutils/gas/hash.h @@ -1,5 +1,6 @@ /* hash.h -- header file for gas hash table routines - Copyright 1987, 1992, 1993, 1995, 1999 Free Software Foundation, Inc. + Copyright 1987, 1992, 1993, 1995, 1999, 2003 + Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -15,14 +16,18 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #ifndef HASH_H #define HASH_H struct hash_control; +/* Set the size of the hash table used. */ + +void set_gas_hash_table_size (unsigned long); + /* Create a hash table. This return a control block. */ extern struct hash_control *hash_new (void); @@ -58,6 +63,11 @@ extern PTR hash_replace (struct hash_control *, const char *key, extern PTR hash_find (struct hash_control *, const char *key); +/* As hash_find, but KEY is of length LEN and is not guaranteed to be + NUL-terminated. */ + +extern PTR hash_find_n (struct hash_control *, const char *key, size_t len); + /* Delete an entry from a hash table. This returns the value stored for that entry, or NULL if there is no such entry. */ diff --git a/contrib/binutils/gas/input-file.c b/contrib/binutils/gas/input-file.c index 01cc669feff..343f0494087 100644 --- a/contrib/binutils/gas/input-file.c +++ b/contrib/binutils/gas/input-file.c @@ -1,5 +1,6 @@ /* input_file.c - Deal with Input Files - - Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1999, 2000, 2001, 2003 + Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1999, 2000, 2001, + 2002, 2003, 2005 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -16,8 +17,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ /* Confines all details of reading source bytes to this module. All O/S specific crocks should live here. @@ -79,12 +80,6 @@ input_file_buffer_size (void) return (BUFFER_SIZE); } -int -input_file_is_open (void) -{ - return f_in != (FILE *) 0; -} - /* Push the state of our input, returning a pointer to saved info that can be restored with input_file_pop (). */ @@ -146,21 +141,22 @@ input_file_open (char *filename, /* "" means use stdin. Must not be 0. */ file_name = _("{standard input}"); } - if (f_in) - c = getc (f_in); - - if (f_in == NULL || ferror (f_in)) + if (f_in == NULL) + { + bfd_set_error (bfd_error_system_call); + as_perror (_("Can't open %s for reading"), file_name); + return; + } + + c = getc (f_in); + + if (ferror (f_in)) { -#ifdef BFD_ASSEMBLER bfd_set_error (bfd_error_system_call); -#endif as_perror (_("Can't open %s for reading"), file_name); - if (f_in) - { - fclose (f_in); - f_in = NULL; - } + fclose (f_in); + f_in = NULL; return; } @@ -219,9 +215,7 @@ input_file_get (char *buf, int buflen) size = fread (buf, sizeof (char), buflen, f_in); if (size < 0) { -#ifdef BFD_ASSEMBLER bfd_set_error (bfd_error_system_call); -#endif as_perror (_("Can't read from %s"), file_name); size = 0; } @@ -248,9 +242,7 @@ input_file_give_next_buffer (char *where /* Where to place 1st character of new size = fread (where, sizeof (char), BUFFER_SIZE, f_in); if (size < 0) { -#ifdef BFD_ASSEMBLER bfd_set_error (bfd_error_system_call); -#endif as_perror (_("Can't read from %s"), file_name); size = 0; } @@ -260,9 +252,7 @@ input_file_give_next_buffer (char *where /* Where to place 1st character of new { if (fclose (f_in)) { -#ifdef BFD_ASSEMBLER bfd_set_error (bfd_error_system_call); -#endif as_perror (_("Can't close %s"), file_name); } f_in = (FILE *) 0; diff --git a/contrib/binutils/gas/input-file.h b/contrib/binutils/gas/input-file.h index b686a0d0656..bc8289e4e44 100644 --- a/contrib/binutils/gas/input-file.h +++ b/contrib/binutils/gas/input-file.h @@ -1,5 +1,5 @@ /* input_file.h header for input-file.c - Copyright 1987, 1992, 1993, 2000 Free Software Foundation, Inc. + Copyright 1987, 1992, 1993, 2000, 2003 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -15,8 +15,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ /*"input_file.c":Operating-system dependant functions to read source files.*/ @@ -58,7 +58,6 @@ char *input_file_give_next_buffer (char *where); char *input_file_push (void); unsigned int input_file_buffer_size (void); -int input_file_is_open (void); void input_file_begin (void); void input_file_close (void); void input_file_end (void); diff --git a/contrib/binutils/gas/input-scrub.c b/contrib/binutils/gas/input-scrub.c index 7a03965c967..8562ee25dff 100644 --- a/contrib/binutils/gas/input-scrub.c +++ b/contrib/binutils/gas/input-scrub.c @@ -1,6 +1,6 @@ /* input_scrub.c - Break up input buffers into whole numbers of lines. Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 2000 + 2000, 2001, 2003 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -17,8 +17,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #include /* Need this to make errno declaration right */ #include "as.h" @@ -123,7 +123,6 @@ struct input_save { static struct input_save *input_scrub_push (char *saved_position); static char *input_scrub_pop (struct input_save *arg); -static void as_1_char (unsigned int c, FILE * stream); /* Saved information about the file that .include'd this one. When we hit EOF, we automatically pop to that file. */ @@ -280,7 +279,7 @@ input_scrub_include_sb (sb *from, char *position, int is_expansion) /* Add the sentinel required by read.c. */ sb_add_char (&from_sb, '\n'); } - sb_add_sb (&from_sb, from); + sb_scrub_and_add_sb (&from_sb, from); sb_index = 1; /* These variables are reset by input_scrub_push. Restore them @@ -476,39 +475,3 @@ as_where (char **namep, unsigned int *linep) *linep = 0; } } - -/* Output to given stream how much of line we have scanned so far. - Assumes we have scanned up to and including input_line_pointer. - No free '\n' at end of line. */ - -void -as_howmuch (FILE *stream /* Opened for write please. */) -{ - register char *p; /* Scan input line. */ - - for (p = input_line_pointer - 1; *p != '\n'; --p) - { - } - ++p; /* p->1st char of line. */ - for (; p <= input_line_pointer; p++) - { - /* Assume ASCII. EBCDIC & other micro-computer char sets ignored. */ - as_1_char ((unsigned char) *p, stream); - } -} - -static void -as_1_char (unsigned int c, FILE *stream) -{ - if (c > 127) - { - (void) putc ('%', stream); - c -= 128; - } - if (c < 32) - { - (void) putc ('^', stream); - c += '@'; - } - (void) putc (c, stream); -} diff --git a/contrib/binutils/gas/itbl-lex.h b/contrib/binutils/gas/itbl-lex.h new file mode 100644 index 00000000000..45c4dacfcee --- /dev/null +++ b/contrib/binutils/gas/itbl-lex.h @@ -0,0 +1,23 @@ +/* itbl-lex.h + Copyright 2005 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, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ + +extern int insntbl_line; +extern int yyparse (void); +extern int yylex (void); diff --git a/contrib/binutils/gas/itbl-lex.l b/contrib/binutils/gas/itbl-lex.l index e924efc56ef..aceeac4f9f0 100644 --- a/contrib/binutils/gas/itbl-lex.l +++ b/contrib/binutils/gas/itbl-lex.l @@ -1,5 +1,5 @@ /* itbl-lex.l - Copyright 1997, 1998, 2001 Free Software Foundation, Inc. + Copyright 1997, 1998, 2001, 2002, 2005 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -15,14 +15,15 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ %{ #include #include #include +#include "itbl-lex.h" #include #ifdef DEBUG diff --git a/contrib/binutils/gas/itbl-ops.c b/contrib/binutils/gas/itbl-ops.c index 089bff4aac5..bd1f6473f45 100644 --- a/contrib/binutils/gas/itbl-ops.c +++ b/contrib/binutils/gas/itbl-ops.c @@ -1,5 +1,6 @@ /* itbl-ops.c - Copyright 1997, 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright 1997, 1999, 2000, 2001, 2002, 2003, 2005 + Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -15,8 +16,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ /*======================================================================*/ /* @@ -204,18 +205,6 @@ struct itbl_entry * itbl_add_reg (int yyprocessor, int yytype, char *regname, int regnum) { -#if 0 -#include "as.h" -#include "symbols.h" - /* Since register names 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 - regnum. */ - /* 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 (regname, reg_section, - regnum, &zero_address_frag)); -#endif return alloc_entry (get_processor (yyprocessor), get_type (yytype), regname, (unsigned long) regnum); } diff --git a/contrib/binutils/gas/itbl-ops.h b/contrib/binutils/gas/itbl-ops.h index 4c98d72da1a..47dc8b295b1 100644 --- a/contrib/binutils/gas/itbl-ops.h +++ b/contrib/binutils/gas/itbl-ops.h @@ -1,5 +1,5 @@ /* itbl-ops.h - Copyright 1997, 1999, 2000 Free Software Foundation, Inc. + Copyright 1997, 1999, 2000, 2003 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -15,8 +15,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ /* External functions, constants and defines for itbl support */ diff --git a/contrib/binutils/gas/itbl-parse.y b/contrib/binutils/gas/itbl-parse.y index 53552d7f31b..a7a52dfabff 100644 --- a/contrib/binutils/gas/itbl-parse.y +++ b/contrib/binutils/gas/itbl-parse.y @@ -1,5 +1,5 @@ /* itbl-parse.y - Copyright 1997 Free Software Foundation, Inc. + Copyright 1997, 2002, 2003, 2005 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -15,8 +15,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ %{ @@ -247,6 +247,7 @@ FIXME! hex is ambiguous with any digit */ #include +#include "itbl-lex.h" #include "itbl-ops.h" /* #define DEBUG */ @@ -273,9 +274,6 @@ FIXME! hex is ambiguous with any digit static int sbit, ebit; static struct itbl_entry *insn=0; -extern int insntbl_line; -int yyparse PARAMS ((void)); -int yylex PARAMS ((void)); static int yyerror PARAMS ((const char *)); %} diff --git a/contrib/binutils/gas/link.cmd b/contrib/binutils/gas/link.cmd deleted file mode 100644 index a035ca87daa..00000000000 --- a/contrib/binutils/gas/link.cmd +++ /dev/null @@ -1,10 +0,0 @@ -ALIGN=1024 -RESNUM 0x0000, 0x8000 -; Putting in .lit1 gives errors. -ORDER .data=0x80002000, .data1, .lit, .bss -; Let's put this on the command line so it goes first, which is what -; GDB expects. -; LOAD /s2/amd/29k/lib/crt0.o -LOAD /s2/amd/29k/lib/libqcb0h.lib -LOAD /s2/amd/29k/lib/libscb0h.lib -LOAD /s2/amd/29k/lib/libacb0h.lib diff --git a/contrib/binutils/gas/listing.c b/contrib/binutils/gas/listing.c index aa22c5e99e4..61ef6f55e40 100644 --- a/contrib/binutils/gas/listing.c +++ b/contrib/binutils/gas/listing.c @@ -1,6 +1,6 @@ /* listing.c - maintain assembly listings Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003 + 2001, 2002, 2003, 2005 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -17,8 +17,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ /* Contributed by Steve Chamberlain @@ -613,10 +613,6 @@ calc_hex (list_info_type *list) sprintf (data_buffer + data_buffer_size, "%02X", (frag_ptr->fr_literal[var_rep_idx]) & 0xff); -#if 0 - data_buffer[data_buffer_size++] = '*'; - data_buffer[data_buffer_size++] = '*'; -#endif data_buffer_size += 2; var_rep_idx++; @@ -753,11 +749,10 @@ list_symbol_table (void) if (SEG_NORMAL (S_GET_SEGMENT (ptr)) || S_GET_SEGMENT (ptr) == absolute_section) { -#ifdef BFD_ASSEMBLER /* Don't report section symbols. They are not interesting. */ if (symbol_section_p (ptr)) continue; -#endif + if (S_GET_NAME (ptr)) { char buf[30], fmt[8]; @@ -1090,9 +1085,7 @@ listing_print (char *name) using_stdout = 0; else { -#ifdef BFD_ASSEMBLER - bfd_set_error (bfd_error_system_call); -#endif + bfd_set_error (bfd_error_system_call); as_perror (_("can't open list file: %s"), name); list_file = stdout; using_stdout = 1; @@ -1112,9 +1105,7 @@ listing_print (char *name) { if (fclose (list_file) == EOF) { -#ifdef BFD_ASSEMBLER bfd_set_error (bfd_error_system_call); -#endif as_perror (_("error closing list file: %s"), name); } } diff --git a/contrib/binutils/gas/listing.h b/contrib/binutils/gas/listing.h index 424b6642d04..e234da4cb40 100644 --- a/contrib/binutils/gas/listing.h +++ b/contrib/binutils/gas/listing.h @@ -1,6 +1,6 @@ /* This file is listing.h - Copyright 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1995, 1997, 1998 - Free Software Foundation, Inc. + Copyright 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1995, 1997, 1998, + 2003 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -16,8 +16,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #ifndef __listing_h__ #define __listing_h__ diff --git a/contrib/binutils/gas/literal.c b/contrib/binutils/gas/literal.c index 7315f3eee03..cc3a2574971 100644 --- a/contrib/binutils/gas/literal.c +++ b/contrib/binutils/gas/literal.c @@ -1,5 +1,5 @@ -/* as.c - GAS literal pool management. - Copyright 1994, 2000 Free Software Foundation, Inc. +/* literal.c - GAS literal pool management. + Copyright 1994, 2000, 2005 Free Software Foundation, Inc. Written by Ken Raeburn (raeburn@cygnus.com). This file is part of GAS, the GNU Assembler. @@ -16,7 +16,7 @@ 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. */ + the Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* This isn't quite a "constant" pool. Some of the values may get adjusted at run time, e.g., for symbolic relocations when shared @@ -39,7 +39,7 @@ #include "as.h" #include "subsegs.h" -#if defined (BFD_ASSEMBLER) && defined (NEED_LITERAL_POOL) +#ifdef NEED_LITERAL_POOL valueT add_to_literal_pool (sym, addend, sec, size) @@ -92,4 +92,4 @@ add_to_literal_pool (sym, addend, sec, size) seginfo->literal_pool_size += size; return offset; } -#endif /* BFD_ASSEMBLER */ +#endif diff --git a/contrib/binutils/gas/macro.c b/contrib/binutils/gas/macro.c index 09917443a1d..af98bada6a8 100644 --- a/contrib/binutils/gas/macro.c +++ b/contrib/binutils/gas/macro.c @@ -1,6 +1,6 @@ /* macro.c - macro support for gas - Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 - Free Software Foundation, Inc. + Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, + 2004, 2005 Free Software Foundation, Inc. Written by Steve and Judy Chamberlain of Cygnus Support, sac@cygnus.com @@ -19,8 +19,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #include "config.h" @@ -54,6 +54,7 @@ extern void *alloca (); #ifdef HAVE_STDLIB_H #include #endif +#include "as.h" #include "libiberty.h" #include "safe-ctype.h" #include "sb.h" @@ -69,13 +70,16 @@ extern void *alloca (); static int get_token (int, sb *, sb *); static int getstring (int, sb *, sb *); -static int get_any_string (int, sb *, sb *, int, int); +static int get_any_string (int, sb *, sb *); +static formal_entry *new_formal (void); +static void del_formal (formal_entry *); static int do_formals (macro_entry *, int, sb *); static int get_apost_token (int, sb *, sb *, int); static int sub_actual (int, sb *, sb *, struct hash_control *, int, sb *, int); static const char *macro_expand_body - (sb *, sb *, formal_entry *, struct hash_control *, int); + (sb *, sb *, formal_entry *, struct hash_control *, const macro_entry *); static const char *macro_expand (int, sb *, macro_entry *, sb *); +static void free_macro(macro_entry *); #define ISWHITE(x) ((x) == ' ' || (x) == '\t') @@ -132,6 +136,14 @@ macro_init (int alternate, int mri, int strip_at, macro_expr = expr; } +/* Switch in and out of alternate mode on the fly. */ + +void +macro_set_alternate (int alternate) +{ + macro_alternate = alternate; +} + /* Switch in and out of MRI mode on the fly. */ void @@ -143,6 +155,7 @@ macro_mri_mode (int mri) /* Read input lines till we get to a TO string. Increase nesting depth if we get a FROM string. Put the results into sb at PTR. + FROM may be NULL (or will be ignored) if TO is "ENDR". Add a new input line to an sb using GET_LINE. Return 1 on success, 0 on unexpected EOF. */ @@ -150,59 +163,92 @@ int buffer_and_nest (const char *from, const char *to, sb *ptr, int (*get_line) (sb *)) { - int from_len = strlen (from); + int from_len; int to_len = strlen (to); int depth = 1; int line_start = ptr->len; int more = get_line (ptr); + if (to_len == 4 && strcasecmp(to, "ENDR") == 0) + { + from = NULL; + from_len = 0; + } + else + from_len = strlen (from); + while (more) { - /* Try and find the first pseudo op on the line. */ + /* Try to find the first pseudo op on the line. */ int i = line_start; - if (! macro_alternate && ! macro_mri) - { - /* With normal syntax we can suck what we want till we get - to the dot. With the alternate, labels have to start in - the first column, since we cant tell what's a label and - whats a pseudoop. */ + /* With normal syntax we can suck what we want till we get + to the dot. With the alternate, labels have to start in + the first column, since we can't tell what's a label and + what's a pseudoop. */ + if (! LABELS_WITHOUT_COLONS) + { /* Skip leading whitespace. */ while (i < ptr->len && ISWHITE (ptr->ptr[i])) i++; - - /* Skip over a label. */ - while (i < ptr->len - && (ISALNUM (ptr->ptr[i]) - || ptr->ptr[i] == '_' - || ptr->ptr[i] == '$')) - i++; - - /* And a colon. */ - if (i < ptr->len - && ptr->ptr[i] == ':') - i++; - } + + for (;;) + { + /* Skip over a label, if any. */ + if (i >= ptr->len || ! is_name_beginner (ptr->ptr[i])) + break; + i++; + while (i < ptr->len && is_part_of_name (ptr->ptr[i])) + i++; + if (i < ptr->len && is_name_ender (ptr->ptr[i])) + i++; + if (LABELS_WITHOUT_COLONS) + break; + /* Skip whitespace. */ + while (i < ptr->len && ISWHITE (ptr->ptr[i])) + i++; + /* Check for the colon. */ + if (i >= ptr->len || ptr->ptr[i] != ':') + { + i = line_start; + break; + } + i++; + line_start = i; + } + /* Skip trailing whitespace. */ while (i < ptr->len && ISWHITE (ptr->ptr[i])) i++; if (i < ptr->len && (ptr->ptr[i] == '.' - || macro_alternate + || NO_PSEUDO_DOT || macro_mri)) { - if (ptr->ptr[i] == '.') + if (! flag_m68k_mri && ptr->ptr[i] == '.') i++; - if (strncasecmp (ptr->ptr + i, from, from_len) == 0 + if (from == NULL + && strncasecmp (ptr->ptr + i, "IRPC", from_len = 4) != 0 + && strncasecmp (ptr->ptr + i, "IRP", from_len = 3) != 0 + && strncasecmp (ptr->ptr + i, "IREPC", from_len = 5) != 0 + && strncasecmp (ptr->ptr + i, "IREP", from_len = 4) != 0 + && strncasecmp (ptr->ptr + i, "REPT", from_len = 4) != 0 + && strncasecmp (ptr->ptr + i, "REP", from_len = 3) != 0) + from_len = 0; + if ((from != NULL + ? strncasecmp (ptr->ptr + i, from, from_len) == 0 + : from_len > 0) && (ptr->len == (i + from_len) - || ! ISALNUM (ptr->ptr[i + from_len]))) + || ! (is_part_of_name (ptr->ptr[i + from_len]) + || is_name_ender (ptr->ptr[i + from_len])))) depth++; if (strncasecmp (ptr->ptr + i, to, to_len) == 0 && (ptr->len == (i + to_len) - || ! ISALNUM (ptr->ptr[i + to_len]))) + || ! (is_part_of_name (ptr->ptr[i + to_len]) + || is_name_ender (ptr->ptr[i + to_len])))) { depth--; if (depth == 0) @@ -230,15 +276,16 @@ static int get_token (int idx, sb *in, sb *name) { if (idx < in->len - && (ISALPHA (in->ptr[idx]) - || in->ptr[idx] == '_' - || in->ptr[idx] == '$')) + && is_name_beginner (in->ptr[idx])) { sb_add_char (name, in->ptr[idx++]); while (idx < in->len - && (ISALNUM (in->ptr[idx]) - || in->ptr[idx] == '_' - || in->ptr[idx] == '$')) + && is_part_of_name (in->ptr[idx])) + { + sb_add_char (name, in->ptr[idx++]); + } + if (idx < in->len + && is_name_ender (in->ptr[idx])) { sb_add_char (name, in->ptr[idx++]); } @@ -254,8 +301,6 @@ get_token (int idx, sb *in, sb *name) static int getstring (int idx, sb *in, sb *acc) { - idx = sb_skip_white (idx, in); - while (idx < in->len && (in->ptr[idx] == '"' || (in->ptr[idx] == '<' && (macro_alternate || macro_mri)) @@ -334,13 +379,13 @@ getstring (int idx, sb *in, sb *acc) /* Fetch string from the input stream, rules: 'Bxyx -> return 'Bxyza - % -> return string of decimal value of x - "" -> return string - xyx -> return xyz -*/ + % -> return string of decimal value of + "string" -> return string + (string) -> return (string-including-whitespaces) + xyx -> return xyz. */ static int -get_any_string (int idx, sb *in, sb *out, int expand, int pretend_quoted) +get_any_string (int idx, sb *in, sb *out) { sb_reset (out); idx = sb_skip_white (idx, in); @@ -352,12 +397,11 @@ get_any_string (int idx, sb *in, sb *out, int expand, int pretend_quoted) while (!ISSEP (in->ptr[idx])) sb_add_char (out, in->ptr[idx++]); } - else if (in->ptr[idx] == '%' - && macro_alternate - && expand) + else if (in->ptr[idx] == '%' && macro_alternate) { int val; char buf[20]; + /* Turns the next expression into a string. */ /* xgettext: no-c-format */ idx = (*macro_expr) (_("% operator needs absolute expression"), @@ -371,15 +415,12 @@ get_any_string (int idx, sb *in, sb *out, int expand, int pretend_quoted) || (in->ptr[idx] == '<' && (macro_alternate || macro_mri)) || (macro_alternate && in->ptr[idx] == '\'')) { - if (macro_alternate - && ! macro_strip_at - && expand) + if (macro_alternate && ! macro_strip_at && in->ptr[idx] != '<') { /* Keep the quotes. */ - sb_add_char (out, '\"'); - + sb_add_char (out, '"'); idx = getstring (idx, in, out); - sb_add_char (out, '\"'); + sb_add_char (out, '"'); } else { @@ -388,93 +429,194 @@ get_any_string (int idx, sb *in, sb *out, int expand, int pretend_quoted) } else { + char *br_buf = xmalloc(1); + char *in_br = br_buf; + + *in_br = '\0'; while (idx < in->len - && (in->ptr[idx] == '"' - || in->ptr[idx] == '\'' - || pretend_quoted + && (*in_br || (in->ptr[idx] != ' ' - && in->ptr[idx] != '\t' - && in->ptr[idx] != ',' - && (in->ptr[idx] != '<' - || (! macro_alternate && ! macro_mri))))) + && in->ptr[idx] != '\t')) + && in->ptr[idx] != ',' + && (in->ptr[idx] != '<' + || (! macro_alternate && ! macro_mri))) { - if (in->ptr[idx] == '"' - || in->ptr[idx] == '\'') + char tchar = in->ptr[idx]; + + switch (tchar) { - char tchar = in->ptr[idx]; + case '"': + case '\'': sb_add_char (out, in->ptr[idx++]); while (idx < in->len && in->ptr[idx] != tchar) sb_add_char (out, in->ptr[idx++]); if (idx == in->len) return idx; + break; + case '(': + case '[': + if (in_br > br_buf) + --in_br; + else + { + br_buf = xmalloc(strlen(in_br) + 2); + strcpy(br_buf + 1, in_br); + free(in_br); + in_br = br_buf; + } + *in_br = tchar; + break; + case ')': + if (*in_br == '(') + ++in_br; + break; + case ']': + if (*in_br == '[') + ++in_br; + break; } - sb_add_char (out, in->ptr[idx++]); + sb_add_char (out, tchar); + ++idx; } + free(br_buf); } } return idx; } +/* Allocate a new formal. */ + +static formal_entry * +new_formal (void) +{ + formal_entry *formal; + + formal = xmalloc (sizeof (formal_entry)); + + sb_new (&formal->name); + sb_new (&formal->def); + sb_new (&formal->actual); + formal->next = NULL; + formal->type = FORMAL_OPTIONAL; + return formal; +} + +/* Free a formal. */ + +static void +del_formal (formal_entry *formal) +{ + sb_kill (&formal->actual); + sb_kill (&formal->def); + sb_kill (&formal->name); + free (formal); +} + /* Pick up the formal parameters of a macro definition. */ static int do_formals (macro_entry *macro, int idx, sb *in) { formal_entry **p = ¯o->formals; + const char *name; - macro->formal_count = 0; - macro->formal_hash = hash_new (); + idx = sb_skip_white (idx, in); while (idx < in->len) { - formal_entry *formal; + formal_entry *formal = new_formal (); + int cidx; - formal = (formal_entry *) xmalloc (sizeof (formal_entry)); - - sb_new (&formal->name); - sb_new (&formal->def); - sb_new (&formal->actual); - - idx = sb_skip_white (idx, in); idx = get_token (idx, in, &formal->name); if (formal->name.len == 0) - break; - idx = sb_skip_white (idx, in); - if (formal->name.len) { - /* This is a formal. */ - if (idx < in->len && in->ptr[idx] == '=') + if (macro->formal_count) + --idx; + break; + } + idx = sb_skip_white (idx, in); + /* This is a formal. */ + name = sb_terminate (&formal->name); + if (! macro_mri + && idx < in->len + && in->ptr[idx] == ':' + && (! is_name_beginner (':') + || idx + 1 >= in->len + || ! is_part_of_name (in->ptr[idx + 1]))) + { + /* Got a qualifier. */ + sb qual; + + sb_new (&qual); + idx = get_token (sb_skip_white (idx + 1, in), in, &qual); + sb_terminate (&qual); + if (qual.len == 0) + as_bad_where (macro->file, + macro->line, + _("Missing parameter qualifier for `%s' in macro `%s'"), + name, + macro->name); + else if (strcmp (qual.ptr, "req") == 0) + formal->type = FORMAL_REQUIRED; + else if (strcmp (qual.ptr, "vararg") == 0) + formal->type = FORMAL_VARARG; + else + as_bad_where (macro->file, + macro->line, + _("`%s' is not a valid parameter qualifier for `%s' in macro `%s'"), + qual.ptr, + name, + macro->name); + sb_kill (&qual); + idx = sb_skip_white (idx, in); + } + if (idx < in->len && in->ptr[idx] == '=') + { + /* Got a default. */ + idx = get_any_string (idx + 1, in, &formal->def); + idx = sb_skip_white (idx, in); + if (formal->type == FORMAL_REQUIRED) { - /* Got a default. */ - idx = get_any_string (idx + 1, in, &formal->def, 1, 0); + sb_reset (&formal->def); + as_warn_where (macro->file, + macro->line, + _("Pointless default value for required parameter `%s' in macro `%s'"), + name, + macro->name); } } /* Add to macro's hash table. */ - hash_jam (macro->formal_hash, sb_terminate (&formal->name), formal); + if (! hash_find (macro->formal_hash, name)) + hash_jam (macro->formal_hash, name, formal); + else + as_bad_where (macro->file, + macro->line, + _("A parameter named `%s' already exists for macro `%s'"), + name, + macro->name); - formal->index = macro->formal_count; - idx = sb_skip_comma (idx, in); - macro->formal_count++; + formal->index = macro->formal_count++; *p = formal; p = &formal->next; - *p = NULL; + if (formal->type == FORMAL_VARARG) + break; + cidx = idx; + idx = sb_skip_comma (idx, in); + if (idx != cidx && idx >= in->len) + { + idx = cidx; + break; + } } if (macro_mri) { - formal_entry *formal; - const char *name; + formal_entry *formal = new_formal (); /* Add a special NARG formal, which macro_expand will set to the number of arguments. */ - formal = (formal_entry *) xmalloc (sizeof (formal_entry)); - - sb_new (&formal->name); - sb_new (&formal->def); - sb_new (&formal->actual); - /* The same MRI assemblers which treat '@' characters also use the name $NARG. At least until we find an exception. */ if (macro_strip_at) @@ -485,11 +627,16 @@ do_formals (macro_entry *macro, int idx, sb *in) sb_add_string (&formal->name, name); /* Add to macro's hash table. */ + if (hash_find (macro->formal_hash, name)) + as_bad_where (macro->file, + macro->line, + _("Reserved word `%s' used as parameter in macro `%s'"), + name, + macro->name); hash_jam (macro->formal_hash, name, formal); formal->index = NARG_INDEX; *p = formal; - formal->next = NULL; } return idx; @@ -501,31 +648,39 @@ do_formals (macro_entry *macro, int idx, sb *in) const char * define_macro (int idx, sb *in, sb *label, - int (*get_line) (sb *), const char **namep) + int (*get_line) (sb *), + char *file, unsigned int line, + const char **namep) { macro_entry *macro; sb name; - const char *namestr; + const char *error = NULL; macro = (macro_entry *) xmalloc (sizeof (macro_entry)); sb_new (¯o->sub); sb_new (&name); + macro->file = file; + macro->line = line; macro->formal_count = 0; macro->formals = 0; + macro->formal_hash = hash_new (); idx = sb_skip_white (idx, in); if (! buffer_and_nest ("MACRO", "ENDM", ¯o->sub, get_line)) - return _("unexpected end of file in macro definition"); + error = _("unexpected end of file in macro `%s' definition"); if (label != NULL && label->len != 0) { sb_add_sb (&name, label); + macro->name = sb_terminate (&name); if (idx < in->len && in->ptr[idx] == '(') { /* It's the label: MACRO (formals,...) sort */ idx = do_formals (macro, idx + 1, in); - if (in->ptr[idx] != ')') - return _("missing ) after formals"); + if (idx < in->len && in->ptr[idx] == ')') + idx = sb_skip_white (idx + 1, in); + else if (!error) + error = _("missing `)' after formals in macro definition `%s'"); } else { @@ -535,23 +690,39 @@ define_macro (int idx, sb *in, sb *label, } else { + int cidx; + idx = get_token (idx, in, &name); - idx = sb_skip_comma (idx, in); - idx = do_formals (macro, idx, in); + macro->name = sb_terminate (&name); + if (name.len == 0) + error = _("Missing macro name"); + cidx = sb_skip_white (idx, in); + idx = sb_skip_comma (cidx, in); + if (idx == cidx || idx < in->len) + idx = do_formals (macro, idx, in); + else + idx = cidx; } + if (!error && idx < in->len) + error = _("Bad parameter list for macro `%s'"); /* And stick it in the macro hash table. */ for (idx = 0; idx < name.len; idx++) name.ptr[idx] = TOLOWER (name.ptr[idx]); - namestr = sb_terminate (&name); - hash_jam (macro_hash, namestr, (PTR) macro); - - macro_defined = 1; + if (hash_find (macro_hash, macro->name)) + error = _("Macro `%s' was already defined"); + if (!error) + error = hash_jam (macro_hash, macro->name, (PTR) macro); if (namep != NULL) - *namep = namestr; + *namep = macro->name; - return NULL; + if (!error) + macro_defined = 1; + else + free_macro (macro); + + return error; } /* Scan a token, and then skip KIND. */ @@ -619,16 +790,16 @@ sub_actual (int start, sb *in, sb *t, struct hash_control *formal_hash, static const char * macro_expand_body (sb *in, sb *out, formal_entry *formals, - struct hash_control *formal_hash, int locals) + struct hash_control *formal_hash, const macro_entry *macro) { sb t; - int src = 0; - int inquote = 0; + int src = 0, inquote = 0, macro_line = 0; formal_entry *loclist = NULL; + const char *err = NULL; sb_new (&t); - while (src < in->len) + while (src < in->len && !err) { if (in->ptr[src] == '&') { @@ -643,13 +814,15 @@ macro_expand_body (sb *in, sb *out, formal_entry *formals, else { /* FIXME: Why do we do this? */ + /* At least in alternate mode this seems correct; without this + one can't append a literal to a parameter. */ src = sub_actual (src + 1, in, &t, formal_hash, '&', out, 0); } } else if (in->ptr[src] == '\\') { src++; - if (in->ptr[src] == '(') + if (src < in->len && in->ptr[src] == '(') { /* Sub in till the next ')' literally. */ src++; @@ -657,12 +830,14 @@ macro_expand_body (sb *in, sb *out, formal_entry *formals, { sb_add_char (out, in->ptr[src++]); } - if (in->ptr[src] == ')') + if (src < in->len) src++; + else if (!macro) + err = _("missing `)'"); else - return _("missplaced )"); + as_bad_where (macro->file, macro->line + macro_line, _("missing `)'")); } - else if (in->ptr[src] == '@') + else if (src < in->len && in->ptr[src] == '@') { /* Sub in the macro invocation number. */ @@ -671,7 +846,7 @@ macro_expand_body (sb *in, sb *out, formal_entry *formals, sprintf (buffer, "%d", macro_number); sb_add_string (out, buffer); } - else if (in->ptr[src] == '&') + else if (src < in->len && in->ptr[src] == '&') { /* This is a preprocessor variable name, we don't do them here. */ @@ -679,7 +854,7 @@ macro_expand_body (sb *in, sb *out, formal_entry *formals, sb_add_char (out, '&'); src++; } - else if (macro_mri && ISALNUM (in->ptr[src])) + else if (macro_mri && src < in->len && ISALNUM (in->ptr[src])) { int ind; formal_entry *f; @@ -710,14 +885,12 @@ macro_expand_body (sb *in, sb *out, formal_entry *formals, } } else if ((macro_alternate || macro_mri) - && (ISALPHA (in->ptr[src]) - || in->ptr[src] == '_' - || in->ptr[src] == '$') + && is_name_beginner (in->ptr[src]) && (! inquote || ! macro_strip_at || (src > 0 && in->ptr[src - 1] == '@'))) { - if (! locals + if (! macro || src + 5 >= in->len || strncasecmp (in->ptr + src, "LOCAL", 5) != 0 || ! ISWHITE (in->ptr[src + 5])) @@ -729,31 +902,38 @@ macro_expand_body (sb *in, sb *out, formal_entry *formals, } else { - formal_entry *f; - src = sb_skip_white (src + 5, in); while (in->ptr[src] != '\n') { - static int loccnt; - char buf[20]; - const char *err; - - f = (formal_entry *) xmalloc (sizeof (formal_entry)); - sb_new (&f->name); - sb_new (&f->def); - sb_new (&f->actual); - f->index = LOCAL_INDEX; - f->next = loclist; - loclist = f; + const char *name; + formal_entry *f = new_formal (); src = get_token (src, in, &f->name); - ++loccnt; - sprintf (buf, "LL%04x", loccnt); - sb_add_string (&f->actual, buf); + name = sb_terminate (&f->name); + if (! hash_find (formal_hash, name)) + { + static int loccnt; + char buf[20]; - err = hash_jam (formal_hash, sb_terminate (&f->name), f); - if (err != NULL) - return err; + f->index = LOCAL_INDEX; + f->next = loclist; + loclist = f; + + sprintf (buf, IS_ELF ? ".LL%04x" : "LL%04x", ++loccnt); + sb_add_string (&f->actual, buf); + + err = hash_jam (formal_hash, name, f); + if (err != NULL) + break; + } + else + { + as_bad_where (macro->file, + macro->line + macro_line, + _("`%s' was already used as parameter (or another local) name"), + name); + del_formal (f); + } src = sb_skip_comma (src, in); } @@ -813,6 +993,8 @@ macro_expand_body (sb *in, sb *out, formal_entry *formals, } else { + if (in->ptr[src] == '\n') + ++macro_line; sb_add_char (out, in->ptr[src++]); } } @@ -827,14 +1009,11 @@ macro_expand_body (sb *in, sb *out, formal_entry *formals, /* Setting the value to NULL effectively deletes the entry. We avoid calling hash_delete because it doesn't reclaim memory. */ hash_jam (formal_hash, sb_terminate (&loclist->name), NULL); - sb_kill (&loclist->name); - sb_kill (&loclist->def); - sb_kill (&loclist->actual); - free (loclist); + del_formal (loclist); loclist = f; } - return NULL; + return err; } /* Assign values to the formal parameters of a macro, and expand the @@ -849,7 +1028,7 @@ macro_expand (int idx, sb *in, macro_entry *m, sb *out) int is_positional = 0; int is_keyword = 0; int narg = 0; - const char *err; + const char *err = NULL; sb_new (&t); @@ -873,18 +1052,14 @@ macro_expand (int idx, sb *in, macro_entry *m, sb *out) && in->ptr[idx] != ' ' && in->ptr[idx] != '\t') { - formal_entry *n; + formal_entry *n = new_formal (); - n = (formal_entry *) xmalloc (sizeof (formal_entry)); - sb_new (&n->name); - sb_new (&n->def); - sb_new (&n->actual); n->index = QUAL_INDEX; n->next = m->formals; m->formals = n; - idx = get_any_string (idx, in, &n->actual, 1, 0); + idx = get_any_string (idx, in, &n->actual); } } } @@ -913,17 +1088,28 @@ macro_expand (int idx, sb *in, macro_entry *m, sb *out) sb_reset (&t); idx = get_token (idx, in, &t); if (in->ptr[idx] != '=') - return _("confusion in formal parameters"); + { + err = _("confusion in formal parameters"); + break; + } /* Lookup the formal in the macro's list. */ ptr = (formal_entry *) hash_find (m->formal_hash, sb_terminate (&t)); if (!ptr) - return _("macro formal argument does not exist"); + as_bad (_("Parameter named `%s' does not exist for macro `%s'"), + t.ptr, + m->name); else { /* Insert this value into the right place. */ - sb_reset (&ptr->actual); - idx = get_any_string (idx + 1, in, &ptr->actual, 0, 0); + if (ptr->actual.len) + { + as_warn (_("Value for parameter `%s' of macro `%s' was already specified"), + ptr->name.ptr, + m->name); + sb_reset (&ptr->actual); + } + idx = get_any_string (idx + 1, in, &ptr->actual); if (ptr->actual.len > 0) ++narg; } @@ -933,7 +1119,10 @@ macro_expand (int idx, sb *in, macro_entry *m, sb *out) /* This is a positional arg. */ is_positional = 1; if (is_keyword) - return _("can't mix positional and keyword arguments"); + { + err = _("can't mix positional and keyword arguments"); + break; + } if (!f) { @@ -941,13 +1130,12 @@ macro_expand (int idx, sb *in, macro_entry *m, sb *out) int c; if (!macro_mri) - return _("too many positional arguments"); + { + err = _("too many positional arguments"); + break; + } - f = (formal_entry *) xmalloc (sizeof (formal_entry)); - sb_new (&f->name); - sb_new (&f->def); - sb_new (&f->actual); - f->next = NULL; + f = new_formal (); c = -1; for (pf = &m->formals; *pf != NULL; pf = &(*pf)->next) @@ -959,8 +1147,13 @@ macro_expand (int idx, sb *in, macro_entry *m, sb *out) f->index = c; } - sb_reset (&f->actual); - idx = get_any_string (idx, in, &f->actual, 1, 0); + if (f->type != FORMAL_VARARG) + idx = get_any_string (idx, in, &f->actual); + else + { + sb_add_buffer (&f->actual, in->ptr + idx, in->len - idx); + idx = in->len; + } if (f->actual.len > 0) ++narg; do @@ -981,22 +1174,30 @@ macro_expand (int idx, sb *in, macro_entry *m, sb *out) } } - if (macro_mri) + if (! err) { - char buffer[20]; + for (ptr = m->formals; ptr; ptr = ptr->next) + { + if (ptr->type == FORMAL_REQUIRED && ptr->actual.len == 0) + as_bad (_("Missing value for required parameter `%s' of macro `%s'"), + ptr->name.ptr, + m->name); + } - sb_reset (&t); - sb_add_string (&t, macro_strip_at ? "$NARG" : "NARG"); - ptr = (formal_entry *) hash_find (m->formal_hash, sb_terminate (&t)); - sb_reset (&ptr->actual); - sprintf (buffer, "%d", narg); - sb_add_string (&ptr->actual, buffer); + if (macro_mri) + { + char buffer[20]; + + sb_reset (&t); + sb_add_string (&t, macro_strip_at ? "$NARG" : "NARG"); + ptr = (formal_entry *) hash_find (m->formal_hash, sb_terminate (&t)); + sprintf (buffer, "%d", narg); + sb_add_string (&ptr->actual, buffer); + } + + err = macro_expand_body (&m->sub, out, m->formals, m->formal_hash, m); } - err = macro_expand_body (&m->sub, out, m->formals, m->formal_hash, 1); - if (err != NULL) - return err; - /* Discard any unnamed formal arguments. */ if (macro_mri) { @@ -1009,20 +1210,18 @@ macro_expand (int idx, sb *in, macro_entry *m, sb *out) pf = &(*pf)->next; else { - sb_kill (&(*pf)->name); - sb_kill (&(*pf)->def); - sb_kill (&(*pf)->actual); f = (*pf)->next; - free (*pf); + del_formal (*pf); *pf = f; } } } sb_kill (&t); - macro_number++; + if (!err) + macro_number++; - return NULL; + return err; } /* Check for a macro. If one is found, put the expansion into @@ -1037,16 +1236,14 @@ check_macro (const char *line, sb *expand, macro_entry *macro; sb line_sb; - if (! ISALPHA (*line) - && *line != '_' - && *line != '$' + if (! is_name_beginner (*line) && (! macro_mri || *line != '.')) return 0; s = line + 1; - while (ISALNUM (*s) - || *s == '_' - || *s == '$') + while (is_part_of_name (*s)) + ++s; + if (is_name_ender (*s)) ++s; copy = (char *) alloca (s - line + 1); @@ -1077,12 +1274,49 @@ check_macro (const char *line, sb *expand, return 1; } +/* Free the memory allocated to a macro. */ + +static void +free_macro(macro_entry *macro) +{ + formal_entry *formal; + + for (formal = macro->formals; formal; ) + { + formal_entry *f; + + f = formal; + formal = formal->next; + del_formal (f); + } + hash_die (macro->formal_hash); + sb_kill (¯o->sub); + free (macro); +} + /* Delete a macro. */ void delete_macro (const char *name) { - hash_delete (macro_hash, name); + char *copy; + size_t i, len; + macro_entry *macro; + + len = strlen (name); + copy = (char *) alloca (len + 1); + for (i = 0; i < len; ++i) + copy[i] = TOLOWER (name[i]); + copy[i] = '\0'; + + /* Since hash_delete doesn't free memory, just clear out the entry. */ + if ((macro = hash_find (macro_hash, copy)) != NULL) + { + hash_jam (macro_hash, copy, NULL); + free_macro (macro); + } + else + as_warn (_("Attempt to purge non-existant macro `%s'"), copy); } /* Handle the MRI IRP and IRPC pseudo-ops. These are handled as a @@ -1092,21 +1326,15 @@ delete_macro (const char *name) const char * expand_irp (int irpc, int idx, sb *in, sb *out, int (*get_line) (sb *)) { - const char *mn; sb sub; formal_entry f; struct hash_control *h; const char *err; - if (irpc) - mn = "IRPC"; - else - mn = "IRP"; - idx = sb_skip_white (idx, in); sb_new (&sub); - if (! buffer_and_nest (mn, "ENDR", &sub, get_line)) + if (! buffer_and_nest (NULL, "ENDR", &sub, get_line)) return _("unexpected end of file in irp or irpc"); sb_new (&f.name); @@ -1124,6 +1352,7 @@ expand_irp (int irpc, int idx, sb *in, sb *out, int (*get_line) (sb *)) f.index = 1; f.next = NULL; + f.type = FORMAL_OPTIONAL; sb_reset (out); @@ -1132,8 +1361,6 @@ expand_irp (int irpc, int idx, sb *in, sb *out, int (*get_line) (sb *)) { /* Expand once with a null string. */ err = macro_expand_body (&sub, out, &f, h, 0); - if (err != NULL) - return err; } else { @@ -1142,7 +1369,7 @@ expand_irp (int irpc, int idx, sb *in, sb *out, int (*get_line) (sb *)) while (idx < in->len) { if (!irpc) - idx = get_any_string (idx, in, &f.actual, 1, 0); + idx = get_any_string (idx, in, &f.actual); else { if (in->ptr[idx] == '"') @@ -1162,7 +1389,7 @@ expand_irp (int irpc, int idx, sb *in, sb *out, int (*get_line) (sb *)) } err = macro_expand_body (&sub, out, &f, h, 0); if (err != NULL) - return err; + break; if (!irpc) idx = sb_skip_comma (idx, in); else @@ -1171,7 +1398,10 @@ expand_irp (int irpc, int idx, sb *in, sb *out, int (*get_line) (sb *)) } hash_die (h); + sb_kill (&f.actual); + sb_kill (&f.def); + sb_kill (&f.name); sb_kill (&sub); - return NULL; + return err; } diff --git a/contrib/binutils/gas/macro.h b/contrib/binutils/gas/macro.h index a8bffaa0efc..4fdaa52d097 100644 --- a/contrib/binutils/gas/macro.h +++ b/contrib/binutils/gas/macro.h @@ -1,5 +1,5 @@ /* macro.h - header file for macro support for gas - Copyright 1994, 1995, 1996, 1997, 1998, 2000, 2002 + Copyright 1994, 1995, 1996, 1997, 1998, 2000, 2002, 2003, 2004 Free Software Foundation, Inc. Written by Steve and Judy Chamberlain of Cygnus Support, @@ -19,8 +19,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #ifndef MACRO_H @@ -45,6 +45,12 @@ typedef struct formal_struct { sb def; /* The default value. */ sb actual; /* The actual argument (changed on each expansion). */ int index; /* The index of the formal 0..formal_count - 1. */ + enum formal_type + { + FORMAL_OPTIONAL, + FORMAL_REQUIRED, + FORMAL_VARARG + } type; /* The kind of the formal. */ } formal_entry; /* Other values found in the index field of a formal_entry. */ @@ -60,6 +66,9 @@ typedef struct macro_struct int formal_count; /* Number of formal args. */ formal_entry *formals; /* Pointer to list of formal_structs. */ struct hash_control *formal_hash; /* Hash table of formals. */ + const char *name; /* Macro name. */ + char *file; /* File the macro was defined in. */ + unsigned int line; /* Line number of definition. */ } macro_entry; /* Whether any macros have been defined. */ @@ -70,12 +79,17 @@ extern int macro_defined; extern int macro_nest; +/* The macro hash table. */ + +extern struct hash_control *macro_hash; + extern int buffer_and_nest (const char *, const char *, sb *, int (*) (sb *)); extern void macro_init (int, int, int, int (*) (const char *, int, sb *, int *)); +extern void macro_set_alternate (int); extern void macro_mri_mode (int); extern const char *define_macro - (int, sb *, sb *, int (*) (sb *), const char **); + (int, sb *, sb *, int (*) (sb *), char *, unsigned int, const char **); extern int check_macro (const char *, sb *, const char **, macro_entry **); extern void delete_macro (const char *); extern const char *expand_irp (int, int, sb *, sb *, int (*) (sb *)); diff --git a/contrib/binutils/gas/messages.c b/contrib/binutils/gas/messages.c index 005cd22d417..b1b94cdf7c6 100644 --- a/contrib/binutils/gas/messages.c +++ b/contrib/binutils/gas/messages.c @@ -1,5 +1,6 @@ /* messages.c - error reporter - - Copyright 1987, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2001, 2003 + Copyright 1987, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2001, + 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -15,33 +16,11 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #include "as.h" -#include -#ifdef HAVE_ERRNO_H -#include -#endif - -#ifdef USE_STDARG -#include -#endif - -#ifdef USE_VARARGS -#include -#endif - -#if !defined (USE_STDARG) && !defined (USE_VARARGS) -/* Roll our own. */ -#define va_alist REST -#define va_dcl -typedef int * va_list; -#define va_start(ARGS) ARGS = &REST -#define va_end(ARGS) -#endif - static void identify (char *); static void as_show_where (void); static void as_warn_internal (char *, unsigned int, char *); @@ -149,16 +128,10 @@ as_perror (const char *gripe, /* Unpunctuated error theme. */ as_show_where (); fprintf (stderr, gripe, filename); errno = saved_errno; -#ifdef BFD_ASSEMBLER errtxt = bfd_errmsg (bfd_get_error ()); -#else - errtxt = xstrerror (errno); -#endif fprintf (stderr, ": %s\n", errtxt); errno = 0; -#ifdef BFD_ASSEMBLER bfd_set_error (bfd_error_no_error); -#endif } /* Send to stderr a string as a warning, and locate warning @@ -232,7 +205,7 @@ as_warn (const char *format, ...) if (!flag_no_warnings) { va_start (args, format); - vsprintf (buffer, format, args); + vsnprintf (buffer, sizeof (buffer), format, args); va_end (args); as_warn_internal ((char *) NULL, 0, buffer); } @@ -249,7 +222,7 @@ as_warn (format, va_alist) if (!flag_no_warnings) { va_start (args); - vsprintf (buffer, format, args); + vsnprintf (buffer, sizeof (buffer), format, args); va_end (args); as_warn_internal ((char *) NULL, 0, buffer); } @@ -270,7 +243,7 @@ as_warn_where (char *file, unsigned int line, const char *format, ...) if (!flag_no_warnings) { va_start (args, format); - vsprintf (buffer, format, args); + vsnprintf (buffer, sizeof (buffer), format, args); va_end (args); as_warn_internal (file, line, buffer); } @@ -289,7 +262,7 @@ as_warn_where (file, line, format, va_alist) if (!flag_no_warnings) { va_start (args); - vsprintf (buffer, format, args); + vsnprintf (buffer, sizeof (buffer), format, args); va_end (args); as_warn_internal (file, line, buffer); } @@ -331,7 +304,7 @@ as_bad (const char *format, ...) char buffer[2000]; va_start (args, format); - vsprintf (buffer, format, args); + vsnprintf (buffer, sizeof (buffer), format, args); va_end (args); as_bad_internal ((char *) NULL, 0, buffer); @@ -347,7 +320,7 @@ as_bad (format, va_alist) char buffer[2000]; va_start (args); - vsprintf (buffer, format, args); + vsnprintf (buffer, sizeof (buffer), format, args); va_end (args); as_bad_internal ((char *) NULL, 0, buffer); @@ -366,7 +339,7 @@ as_bad_where (char *file, unsigned int line, const char *format, ...) char buffer[2000]; va_start (args, format); - vsprintf (buffer, format, args); + vsnprintf (buffer, sizeof (buffer), format, args); va_end (args); as_bad_internal (file, line, buffer); @@ -384,7 +357,7 @@ as_bad_where (file, line, format, va_alist) char buffer[2000]; va_start (args); - vsprintf (buffer, format, args); + vsnprintf (buffer, sizeof (buffer), format, args); va_end (args); as_bad_internal (file, line, buffer); @@ -411,7 +384,7 @@ as_fatal (const char *format, ...) /* Delete the output file, if it exists. This will prevent make from thinking that a file was created and hence does not need rebuilding. */ if (out_file_name != NULL) - unlink (out_file_name); + unlink_if_ordinary (out_file_name); xexit (EXIT_FAILURE); } #else @@ -468,24 +441,6 @@ as_abort (const char *file, int line, const char *fn) /* Support routines. */ -void -fprint_value (FILE *file, valueT val) -{ - if (sizeof (val) <= sizeof (long)) - { - fprintf (file, "%ld", (long) val); - return; - } -#ifdef BFD_ASSEMBLER - if (sizeof (val) <= sizeof (bfd_vma)) - { - fprintf_vma (file, val); - return; - } -#endif - abort (); -} - void sprint_value (char *buf, valueT val) { @@ -494,12 +449,89 @@ sprint_value (char *buf, valueT val) sprintf (buf, "%ld", (long) val); return; } -#ifdef BFD_ASSEMBLER if (sizeof (val) <= sizeof (bfd_vma)) { sprintf_vma (buf, val); return; } -#endif abort (); } + +#define HEX_MAX_THRESHOLD 1024 +#define HEX_MIN_THRESHOLD -(HEX_MAX_THRESHOLD) + +static void +as_internal_value_out_of_range (char * prefix, + offsetT val, + offsetT min, + offsetT max, + char * file, + unsigned line, + int bad) +{ + const char * err; + + if (prefix == NULL) + prefix = ""; + + if ( val < HEX_MAX_THRESHOLD + && min < HEX_MAX_THRESHOLD + && max < HEX_MAX_THRESHOLD + && val > HEX_MIN_THRESHOLD + && min > HEX_MIN_THRESHOLD + && max > HEX_MIN_THRESHOLD) + { + /* xgettext:c-format */ + err = _("%s out of range (%d is not between %d and %d)"); + + if (bad) + as_bad_where (file, line, err, + prefix, (int) val, (int) min, (int) max); + else + as_warn_where (file, line, err, + prefix, (int) val, (int) min, (int) max); + } + else + { + char val_buf [sizeof (val) * 3 + 2]; + char min_buf [sizeof (val) * 3 + 2]; + char max_buf [sizeof (val) * 3 + 2]; + + if (sizeof (val) > sizeof (bfd_vma)) + abort (); + + sprintf_vma (val_buf, val); + sprintf_vma (min_buf, min); + sprintf_vma (max_buf, max); + + /* xgettext:c-format. */ + err = _("%s out of range (0x%s is not between 0x%s and 0x%s)"); + + if (bad) + as_bad_where (file, line, err, prefix, val_buf, min_buf, max_buf); + else + as_warn_where (file, line, err, prefix, val_buf, min_buf, max_buf); + } +} + +void +as_warn_value_out_of_range (char * prefix, + offsetT value, + offsetT min, + offsetT max, + char * file, + unsigned line) +{ + as_internal_value_out_of_range (prefix, value, min, max, file, line, 0); +} + +void +as_bad_value_out_of_range (char * prefix, + offsetT value, + offsetT min, + offsetT max, + char * file, + unsigned line) +{ + as_internal_value_out_of_range (prefix, value, min, max, file, line, 1); +} diff --git a/contrib/binutils/gas/obj.h b/contrib/binutils/gas/obj.h index 497524ac04e..0cceab066fc 100644 --- a/contrib/binutils/gas/obj.h +++ b/contrib/binutils/gas/obj.h @@ -1,8 +1,8 @@ /* obj.h - defines the object dependent hooks for all object format backends. - Copyright 1987, 1990, 1991, 1992, 1993, 1995, 1996, 1997, 1999, 2000, 2002 - Free Software Foundation, Inc. + Copyright 1987, 1990, 1991, 1992, 1993, 1995, 1996, 1997, 1999, 2000, + 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -18,8 +18,8 @@ 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. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ char *obj_default_output_file_name (void); void obj_emit_relocations (char **where, fixS * fixP, @@ -29,13 +29,6 @@ void obj_emit_symbols (char **where, symbolS * symbols); #ifndef obj_read_begin_hook void obj_read_begin_hook (void); #endif -#ifndef BFD_ASSEMBLER -void obj_crawl_symbol_chain (object_headers * headers); -void obj_header_append (char **where, object_headers * headers); -#ifndef obj_pre_write_hook -void obj_pre_write_hook (object_headers * headers); -#endif -#endif #ifndef obj_symbol_new_hook void obj_symbol_new_hook (symbolS * symbolP); @@ -45,13 +38,12 @@ void obj_symbol_to_chars (char **where, symbolS * symbolP); extern const pseudo_typeS obj_pseudo_table[]; -#ifdef BFD_ASSEMBLER struct format_ops { int flavor; unsigned dfl_leading_underscore : 1; unsigned emit_section_symbols : 1; void (*begin) (void); - void (*app_file) (const char *); + void (*app_file) (const char *, int); void (*frob_symbol) (symbolS *, int *); void (*frob_file) (void); void (*frob_file_before_adjust) (void); @@ -89,6 +81,5 @@ extern const struct format_ops aout_format_ops; #ifndef this_format COMMON const struct format_ops *this_format; #endif -#endif /* end of obj.h */ diff --git a/contrib/binutils/gas/output-file.c b/contrib/binutils/gas/output-file.c index 4c376b4dcc4..f94359ab6b0 100644 --- a/contrib/binutils/gas/output-file.c +++ b/contrib/binutils/gas/output-file.c @@ -1,6 +1,6 @@ /* output-file.c - Deal with the output file - Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1996, 1998, 1999, 2001, 2003 - Free Software Foundation, Inc. + Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1996, 1998, 1999, 2001, + 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -16,8 +16,8 @@ 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. */ + the Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #include @@ -25,18 +25,10 @@ #include "output-file.h" -#ifdef BFD_HEADERS -#define USE_BFD -#endif - -#ifdef BFD_ASSEMBLER -#define USE_BFD #ifndef TARGET_MACH #define TARGET_MACH 0 #endif -#endif -#ifdef USE_BFD #include "bfd.h" bfd *stdoutput; @@ -48,14 +40,15 @@ output_file_create (char *name) else if (!(stdoutput = bfd_openw (name, TARGET_FORMAT))) { - as_perror (_("FATAL: can't create %s"), name); + if (bfd_get_error () == bfd_error_invalid_target) + as_perror (_("Selected target format '%s' unknown"), TARGET_FORMAT); + else + as_perror (_("FATAL: can't create %s"), name); exit (EXIT_FAILURE); } bfd_set_format (stdoutput, bfd_object); -#ifdef BFD_ASSEMBLER bfd_set_arch_mach (stdoutput, TARGET_ARCH, TARGET_MACH); -#endif if (flag_traditional_format) stdoutput->flags |= BFD_TRADITIONAL_FORMAT; } @@ -63,7 +56,6 @@ output_file_create (char *name) void output_file_close (char *filename) { -#ifdef BFD_ASSEMBLER /* Close the bfd. */ if (bfd_close (stdoutput) == 0) { @@ -71,84 +63,5 @@ output_file_close (char *filename) as_perror (_("FATAL: can't close %s\n"), filename); exit (EXIT_FAILURE); } -#else - /* Close the bfd without getting bfd to write out anything by itself. */ - if (bfd_close_all_done (stdoutput) == 0) - { - as_perror (_("FATAL: can't close %s\n"), filename); - exit (EXIT_FAILURE); - } -#endif stdoutput = NULL; /* Trust nobody! */ } - -#ifndef BFD_ASSEMBLER -void -output_file_append (char *where ATTRIBUTE_UNUSED, - long length ATTRIBUTE_UNUSED, - char *filename ATTRIBUTE_UNUSED) -{ - abort (); -} -#endif - -#else - -static FILE *stdoutput; - -void -output_file_create (char *name) -{ - if (name[0] == '-' && name[1] == '\0') - { - stdoutput = stdout; - return; - } - - stdoutput = fopen (name, FOPEN_WB); - if (stdoutput == NULL) - { -#ifdef BFD_ASSEMBLER - bfd_set_error (bfd_error_system_call); -#endif - as_perror (_("FATAL: can't create %s"), name); - exit (EXIT_FAILURE); - } -} - -void -output_file_close (char *filename) -{ - if (EOF == fclose (stdoutput)) - { -#ifdef BFD_ASSEMBLER - bfd_set_error (bfd_error_system_call); -#endif - as_perror (_("FATAL: can't close %s"), filename); - exit (EXIT_FAILURE); - } - - /* Trust nobody! */ - stdoutput = NULL; -} - -void -output_file_append (char * where, long length, char * filename) -{ - for (; length; length--, where++) - { - (void) putc (*where, stdoutput); - - if (ferror (stdoutput)) - { -#ifdef BFD_ASSEMBLER - bfd_set_error (bfd_error_system_call); -#endif - as_perror (_("Failed to emit an object byte"), filename); - as_fatal (_("can't continue")); - } - } -} - -#endif - diff --git a/contrib/binutils/gas/output-file.h b/contrib/binutils/gas/output-file.h index 6779e4b4049..137115d5049 100644 --- a/contrib/binutils/gas/output-file.h +++ b/contrib/binutils/gas/output-file.h @@ -1,6 +1,6 @@ /* This file is output-file.h - Copyright 1987, 1988, 1989, 1990, 1991, 1992 + Copyright 1987, 1988, 1989, 1990, 1991, 1992, 2003 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -17,7 +17,7 @@ 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. */ + the Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ void output_file_append (char *where, long length, char *filename); void output_file_close (char *filename); diff --git a/contrib/binutils/gas/po/Make-in b/contrib/binutils/gas/po/Make-in index 6176dbf78c3..be09b4cd788 100644 --- a/contrib/binutils/gas/po/Make-in +++ b/contrib/binutils/gas/po/Make-in @@ -1,7 +1,8 @@ # Makefile for program source directory in GNU NLS utilities package. # Copyright (C) 1995, 1996, 1997 by Ulrich Drepper +# Copyright 2003, 2006 Free Software Foundation, Inc. # -# This file file be copied and used freely without restrictions. It can +# This file may 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. @@ -109,6 +110,7 @@ $(srcdir)/stamp-cat-id: $(PACKAGE).pot install: install-exec install-data install-exec: install-info: +install-html: install-data: install-data-@USE_NLS@ install-data-no: all install-data-yes: all @@ -184,7 +186,7 @@ check: all cat-id-tbl.o: ../intl/libgettext.h -dvi info tags TAGS ID: +html dvi pdf ps info tags TAGS ID: mostlyclean: rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp diff --git a/contrib/binutils/gas/po/POTFILES.in b/contrib/binutils/gas/po/POTFILES.in index e4e3e4ea6aa..3a173a536ff 100644 --- a/contrib/binutils/gas/po/POTFILES.in +++ b/contrib/binutils/gas/po/POTFILES.in @@ -1,18 +1,12 @@ app.c -app.c -as.c as.c as.h asintl.h atof-generic.c -atof-generic.c -bignum-copy.c -bignum-copy.c bignum.h bit_fix.h cgen.h cond.c -cond.c config/e-crisaout.c config/e-criself.c config/e-i386aout.c @@ -22,8 +16,6 @@ config/e-mipsecoff.c config/e-mipself.c config/obj-aout.c config/obj-aout.h -config/obj-bout.c -config/obj-bout.h config/obj-coff.c config/obj-coff.h config/obj-ecoff.c @@ -32,16 +24,10 @@ config/obj-elf.c config/obj-elf.h config/obj-evax.c config/obj-evax.h -config/obj-hp300.c -config/obj-hp300.h config/obj-ieee.c config/obj-ieee.h config/obj-som.c config/obj-som.h -config/obj-vms.c -config/obj-vms.h -config/tc-a29k.c -config/tc-a29k.h config/tc-alpha.c config/tc-alpha.h config/tc-arc.c @@ -50,8 +36,12 @@ config/tc-arm.c config/tc-arm.h config/tc-avr.c config/tc-avr.h +config/tc-bfin.c +config/tc-bfin.h config/tc-cris.c config/tc-cris.h +config/tc-crx.c +config/tc-crx.h config/tc-d10v.c config/tc-d10v.h config/tc-d30v.c @@ -64,8 +54,6 @@ config/tc-frv.c config/tc-frv.h config/tc-h8300.c config/tc-h8300.h -config/tc-h8500.c -config/tc-h8500.h config/tc-hppa.c config/tc-hppa.h config/tc-i370.c @@ -80,14 +68,14 @@ config/tc-ia64.c config/tc-ia64.h config/tc-ip2k.c config/tc-ip2k.h +config/tc-m32c.c +config/tc-m32c.h config/tc-m32r.c config/tc-m32r.h config/tc-m68hc11.c config/tc-m68hc11.h config/tc-m68k.c config/tc-m68k.h -config/tc-m88k.c -config/tc-m88k.h config/tc-mcore.c config/tc-mcore.h config/tc-mips.c @@ -120,94 +108,69 @@ config/tc-sh.c config/tc-sh.h config/tc-sparc.c config/tc-sparc.h -config/tc-tahoe.c -config/tc-tahoe.h config/tc-tic30.c config/tc-tic30.h config/tc-tic54x.c config/tc-tic54x.h -config/tc-tic80.c -config/tc-tic80.h config/tc-v850.c config/tc-v850.h config/tc-vax.c config/tc-vax.h -config/tc-w65.c -config/tc-w65.h +config/tc-xc16x.c +config/tc-xc16x.h config/tc-xstormy16.c config/tc-xstormy16.h config/tc-xtensa.c config/tc-xtensa.h +config/tc-z80.c +config/tc-z80.h config/tc-z8k.c config/tc-z8k.h depend.c -depend.c -dw2gencfi.c dw2gencfi.c dw2gencfi.h dwarf2dbg.c -dwarf2dbg.c dwarf2dbg.h ecoff.c -ecoff.c ecoff.h ehopt.c -ehopt.c emul.h emul-target.h expr.c -expr.c expr.h flonum-copy.c -flonum-copy.c flonum.h flonum-konst.c -flonum-konst.c flonum-mult.c -flonum-mult.c -frags.c frags.c frags.h hash.c -hash.c hash.h input-file.c -input-file.c input-file.h input-scrub.c -input-scrub.c +itbl-lex.h itbl-ops.c itbl-ops.h listing.c -listing.c listing.h literal.c -literal.c -macro.c macro.c macro.h messages.c -messages.c obj.h output-file.c -output-file.c output-file.h read.c -read.c read.h sb.c -sb.c sb.h stabs.c -stabs.c struc-symbol.h subsegs.c -subsegs.c subsegs.h symbols.c -symbols.c symbols.h tc.h write.c -write.c write.h diff --git a/contrib/binutils/gas/po/gas.pot b/contrib/binutils/gas/po/gas.pot index ae3cbabd833..122a678aa4a 100644 --- a/contrib/binutils/gas/po/gas.pot +++ b/contrib/binutils/gas/po/gas.pot @@ -1,12 +1,14 @@ # SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR Free Software Foundation, Inc. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2003-07-17 14:56+0100\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2005-10-25 08:41+0930\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -14,72 +16,65 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: app.c:474 app.c:488 +#: app.c:470 app.c:484 msgid "end of file in comment" msgstr "" -#: app.c:567 -msgid "end of file in string; inserted '\"'" +#: app.c:560 app.c:605 +#, c-format +msgid "end of file in string; '%c' inserted" msgstr "" -#: app.c:612 -msgid "end of file in string; '\"' inserted" -msgstr "" - -#: app.c:638 +#: app.c:631 #, c-format msgid "unknown escape '\\%c' in string; ignored" msgstr "" -#: app.c:790 +#: app.c:786 msgid "end of file not at end of a line; newline inserted" msgstr "" -#: app.c:949 +#: app.c:945 msgid "end of file in multiline comment" msgstr "" -#: app.c:1013 +#: app.c:1010 msgid "end of file after a one-character quote; \\0 inserted" msgstr "" -#: app.c:1021 +#: app.c:1018 msgid "end of file in escape character" msgstr "" -#: app.c:1033 +#: app.c:1030 msgid "missing close quote; (assumed)" msgstr "" -#: app.c:1101 app.c:1155 app.c:1166 app.c:1231 +#: app.c:1098 app.c:1152 app.c:1163 app.c:1228 msgid "end of file in comment; newline inserted" msgstr "" -#: as.c:160 +#: as.c:161 msgid "missing emulation mode name" msgstr "" -#: as.c:175 +#: as.c:176 #, c-format msgid "unrecognized emulation name `%s'" msgstr "" -#: as.c:222 +#: as.c:223 #, c-format -msgid "GNU assembler version %s (%s) using BFD version %s" +msgid "GNU assembler version %s (%s) using BFD version %s\n" msgstr "" -#: as.c:225 -#, c-format -msgid "GNU assembler version %s (%s)" -msgstr "" - -#: as.c:234 +#: as.c:230 #, c-format msgid "Usage: %s [option...] [asmfile...]\n" msgstr "" -#: as.c:236 +#: as.c:232 +#, c-format msgid "" "Options:\n" " -a[sub-option...]\t turn on listings\n" @@ -94,148 +89,208 @@ msgid "" " \t =FILE list to FILE (must be last sub-option)\n" msgstr "" -#: as.c:249 +#: as.c:245 +#, c-format +msgid " --alternate initially turn on alternate macro syntax\n" +msgstr "" + +#: as.c:247 +#, c-format msgid " -D produce assembler debugging messages\n" msgstr "" -#: as.c:251 +#: as.c:249 +#, c-format msgid " --defsym SYM=VAL define symbol SYM to given value\n" msgstr "" -#: as.c:267 +#: as.c:265 #, c-format msgid " emulate output (default %s)\n" msgstr "" -#: as.c:272 +#: as.c:270 +#, c-format msgid " --execstack require executable stack for this object\n" msgstr "" -#: as.c:274 +#: as.c:272 +#, c-format msgid "" " --noexecstack don't require executable stack for this object\n" msgstr "" -#: as.c:277 +#: as.c:275 +#, c-format msgid " -f skip whitespace and comment preprocessing\n" msgstr "" +#: as.c:277 +#, c-format +msgid " -g --gen-debug generate debugging information\n" +msgstr "" + #: as.c:279 -msgid " --gstabs generate stabs debugging information\n" +#, c-format +msgid " --gstabs generate STABS debugging information\n" msgstr "" #: as.c:281 -msgid " --gdwarf2 generate DWARF2 debugging information\n" +#, c-format +msgid "" +" --gstabs+ generate STABS debug info with GNU extensions\n" msgstr "" #: as.c:283 -msgid " --help show this message and exit\n" +#, c-format +msgid " --gdwarf-2 generate DWARF2 debugging information\n" msgstr "" #: as.c:285 -msgid " --target-help show target specific options\n" +#, c-format +msgid " --hash-size= set the hash table size close to \n" msgstr "" #: as.c:287 +#, c-format +msgid " --help show this message and exit\n" +msgstr "" + +#: as.c:289 +#, c-format +msgid " --target-help show target specific options\n" +msgstr "" + +#: as.c:291 +#, c-format msgid "" " -I DIR add DIR to search list for .include directives\n" msgstr "" -#: as.c:289 +#: as.c:293 +#, c-format msgid " -J don't warn about signed overflow\n" msgstr "" -#: as.c:291 +#: as.c:295 +#, c-format msgid "" " -K warn when differences altered for long " "displacements\n" msgstr "" -#: as.c:293 +#: as.c:297 +#, c-format msgid " -L,--keep-locals keep local symbols (e.g. starting with `L')\n" msgstr "" -#: as.c:295 +#: as.c:299 +#, c-format msgid " -M,--mri assemble in MRI compatibility mode\n" msgstr "" -#: as.c:297 +#: as.c:301 +#, c-format msgid "" " --MD FILE write dependency information in FILE (default " "none)\n" msgstr "" -#: as.c:299 +#: as.c:303 +#, c-format msgid " -nocpp ignored\n" msgstr "" -#: as.c:301 +#: as.c:305 +#, c-format msgid "" " -o OBJFILE name the object-file output OBJFILE (default a." "out)\n" msgstr "" -#: as.c:303 +#: as.c:307 +#, c-format msgid " -R fold data section into text section\n" msgstr "" -#: as.c:305 +#: as.c:309 +#, c-format +msgid "" +" --reduce-memory-overheads \n" +" prefer smaller memory use at the cost of longer\n" +" assembly times\n" +msgstr "" + +#: as.c:313 +#, c-format msgid "" " --statistics print various measured statistics from execution\n" msgstr "" -#: as.c:307 +#: as.c:315 +#, c-format msgid " --strip-local-absolute strip local absolute symbols\n" msgstr "" -#: as.c:309 +#: as.c:317 +#, c-format msgid "" " --traditional-format Use same format as native assembler when possible\n" msgstr "" -#: as.c:311 +#: as.c:319 +#, c-format msgid " --version print assembler version number and exit\n" msgstr "" -#: as.c:313 +#: as.c:321 +#, c-format msgid " -W --no-warn suppress warnings\n" msgstr "" -#: as.c:315 +#: as.c:323 +#, c-format msgid " --warn don't suppress warnings\n" msgstr "" -#: as.c:317 +#: as.c:325 +#, c-format msgid " --fatal-warnings treat warnings as errors\n" msgstr "" -#: as.c:319 +#: as.c:327 +#, c-format msgid "" " --itbl INSTTBL extend instruction set to include instructions\n" " matching the specifications defined in file " "INSTTBL\n" msgstr "" -#: as.c:322 +#: as.c:330 +#, c-format msgid " -w ignored\n" msgstr "" -#: as.c:324 +#: as.c:332 +#, c-format msgid " -X ignored\n" msgstr "" -#: as.c:326 +#: as.c:334 +#, c-format msgid " -Z generate object file even after errors\n" msgstr "" -#: as.c:328 +#: as.c:336 +#, c-format msgid "" " --listing-lhs-width set the width in words of the output data column " "of\n" " the listing\n" msgstr "" -#: as.c:331 +#: as.c:339 +#, c-format msgid "" " --listing-lhs-width2 set the width in words of the continuation lines\n" " of the output data column; ignored if smaller " @@ -243,110 +298,124 @@ msgid "" " the width of the first line\n" msgstr "" -#: as.c:335 +#: as.c:343 +#, c-format msgid "" " --listing-rhs-width set the max width in characters of the lines from\n" " the source file\n" msgstr "" -#: as.c:338 +#: as.c:346 +#, c-format msgid "" " --listing-cont-lines set the maximum number of continuation lines used\n" " for the output data column of the listing\n" msgstr "" -#: as.c:345 +#: as.c:353 #, c-format msgid "Report bugs to %s\n" msgstr "" -#: as.c:557 as.c:559 +#: as.c:553 +#, c-format +msgid "unrecognized option -%c%s" +msgstr "" + +#. This output is intended to follow the GNU standards document. +#: as.c:591 #, c-format msgid "GNU assembler %s\n" msgstr "" -#: as.c:561 -msgid "Copyright 2002 Free Software Foundation, Inc.\n" +#: as.c:592 +#, c-format +msgid "Copyright 2005 Free Software Foundation, Inc.\n" msgstr "" -#: as.c:562 +#: as.c:593 +#, c-format 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 "" -#: as.c:565 +#: as.c:596 #, c-format msgid "This assembler was configured for a target of `%s'.\n" msgstr "" -#: as.c:572 +#: as.c:603 msgid "multiple emulation names specified" msgstr "" -#: as.c:574 +#: as.c:605 msgid "emulations not handled in this configuration" msgstr "" -#: as.c:579 +#: as.c:610 #, c-format msgid "alias = %s\n" msgstr "" -#: as.c:580 +#: as.c:611 #, c-format msgid "canonical = %s\n" msgstr "" -#: as.c:581 +#: as.c:612 #, c-format msgid "cpu-type = %s\n" msgstr "" -#: as.c:583 +#: as.c:614 #, c-format msgid "format = %s\n" msgstr "" -#: as.c:586 +#: as.c:617 #, c-format msgid "bfd-target = %s\n" msgstr "" -#: as.c:599 +#: as.c:630 msgid "bad defsym; format is --defsym name=value" msgstr "" -#: as.c:623 +#: as.c:650 msgid "no file name following -t option" msgstr "" -#: as.c:638 +#: as.c:665 #, c-format msgid "failed to read instruction table %s\n" msgstr "" -#: as.c:765 +#: as.c:832 #, c-format msgid "invalid listing option `%c'" msgstr "" -#: as.c:984 -#, c-format -msgid "%d warnings, treating warnings as errors" +#: as.c:885 +msgid "--hash-size needs a numeric argument" msgstr "" -#: as.c:1015 +#: as.c:910 #, c-format msgid "%s: total time in assembly: %ld.%06ld\n" msgstr "" -#: as.c:1018 +#: as.c:913 #, c-format msgid "%s: data size %ld\n" msgstr "" -#: as.h:216 +#: as.c:1175 +#, c-format +msgid "%d warnings, treating warnings as errors" +msgstr "" + +#: as.h:200 #, c-format msgid "Case value %ld unexpected at line %d of file \"%s\"\n" msgstr "" @@ -355,772 +424,791 @@ msgstr "" #. * We have a GROSS internal error. #. * This should never happen. #. -#: atof-generic.c:437 config/tc-m68k.c:2869 +#: atof-generic.c:419 config/tc-m68k.c:3118 msgid "failed sanity check" msgstr "" -#: cond.c:83 +#: cond.c:82 msgid "invalid identifier for \".ifdef\"" msgstr "" -#: cond.c:151 +#: cond.c:149 msgid "non-constant expression in \".if\" statement" msgstr "" -#: cond.c:247 +#: cond.c:276 msgid "bad format for ifc or ifnc" msgstr "" -#: cond.c:278 +#: cond.c:306 msgid "\".elseif\" without matching \".if\"" msgstr "" -#: cond.c:282 +#: cond.c:310 msgid "\".elseif\" after \".else\"" msgstr "" -#: cond.c:285 cond.c:393 +#: cond.c:313 cond.c:419 msgid "here is the previous \"else\"" msgstr "" -#: cond.c:288 cond.c:396 +#: cond.c:316 cond.c:422 msgid "here is the previous \"if\"" msgstr "" -#: cond.c:317 +#: cond.c:345 msgid "non-constant expression in \".elseif\" statement" msgstr "" -#: cond.c:356 +#: cond.c:383 msgid "\".endif\" without \".if\"" msgstr "" -#: cond.c:386 +#: cond.c:412 msgid "\".else\" without matching \".if\"" msgstr "" -#: cond.c:390 +#: cond.c:416 msgid "duplicate \"else\"" msgstr "" -#: cond.c:442 +#: cond.c:467 msgid ".ifeqs syntax error" msgstr "" -#: cond.c:525 +#: cond.c:548 msgid "end of macro inside conditional" msgstr "" -#: cond.c:527 +#: cond.c:550 msgid "end of file inside conditional" msgstr "" -#: cond.c:530 +#: cond.c:553 msgid "here is the start of the unterminated conditional" msgstr "" -#: cond.c:534 +#: cond.c:557 msgid "here is the \"else\" of the unterminated conditional" msgstr "" -#: config/obj-aout.c:162 +#: config/obj-aout.c:85 #, c-format msgid "Attempt to put a common symbol into set %s" msgstr "" -#: config/obj-aout.c:166 +#: config/obj-aout.c:89 #, c-format msgid "Attempt to put an undefined symbol into set %s" msgstr "" -#: config/obj-aout.c:197 config/obj-coff.c:1276 +#: config/obj-aout.c:116 config/obj-coff.c:1328 #, c-format msgid "Symbol `%s' can not be both weak and common" msgstr "" -#: config/obj-aout.c:255 config/obj-coff.c:2022 -msgid "unresolved relocation" -msgstr "" - -#: config/obj-aout.c:257 config/obj-coff.c:2024 -#, c-format -msgid "bad relocation: symbol `%s' not in symbol table" -msgstr "" - -#: config/obj-aout.c:344 -#, c-format -msgid "%s: bad type for weak symbol" -msgstr "" - -#: config/obj-aout.c:458 config/obj-coff.c:2945 write.c:1931 -#, c-format -msgid "%s: global symbols not supported in common sections" -msgstr "" - -#: config/obj-aout.c:524 -#, c-format -msgid "Local symbol %s never defined." -msgstr "" - -#: config/obj-bout.c:319 config/obj-vms.c:629 -#, c-format -msgid "Local symbol %s never defined" -msgstr "" - -#: config/obj-coff.c:166 +#: config/obj-coff.c:133 #, c-format msgid "Inserting \"%s\" into structure table failed: %s" msgstr "" #. Zero is used as an end marker in the file. -#: config/obj-coff.c:469 +#: config/obj-coff.c:354 msgid "Line numbers must be positive integers\n" msgstr "" -#. Wrong context. -#: config/obj-coff.c:503 config/obj-coff.c:2367 +#: config/obj-coff.c:386 msgid ".ln pseudo-op inside .def/.endef: ignored." msgstr "" -#: config/obj-coff.c:546 ecoff.c:3278 +#: config/obj-coff.c:428 ecoff.c:3240 msgid ".loc outside of .text" msgstr "" -#: config/obj-coff.c:553 +#: config/obj-coff.c:435 msgid ".loc pseudo-op inside .def/.endef: ignored." msgstr "" -#: config/obj-coff.c:641 config/obj-coff.c:2419 +#: config/obj-coff.c:516 msgid ".def pseudo-op used inside of .def/.endef: ignored." msgstr "" -#: config/obj-coff.c:687 config/obj-coff.c:2471 +#: config/obj-coff.c:555 msgid ".endef pseudo-op used outside of .def/.endef: ignored." msgstr "" -#: config/obj-coff.c:725 +#: config/obj-coff.c:594 #, c-format msgid "`%s' symbol without preceding function" msgstr "" -#: config/obj-coff.c:812 config/obj-coff.c:2551 +#: config/obj-coff.c:681 #, c-format msgid "unexpected storage class %d" msgstr "" -#: config/obj-coff.c:925 config/obj-coff.c:2658 +#: config/obj-coff.c:790 msgid ".dim pseudo-op used outside of .def/.endef: ignored." msgstr "" -#: config/obj-coff.c:945 config/obj-coff.c:2678 +#: config/obj-coff.c:810 msgid "badly formed .dim directive ignored" msgstr "" -#: config/obj-coff.c:996 config/obj-coff.c:2738 +#: config/obj-coff.c:859 msgid ".size pseudo-op used outside of .def/.endef ignored." msgstr "" -#: config/obj-coff.c:1012 config/obj-coff.c:2754 +#: config/obj-coff.c:874 msgid ".scl pseudo-op used outside of .def/.endef ignored." msgstr "" -#: config/obj-coff.c:1030 config/obj-coff.c:2772 +#: config/obj-coff.c:891 msgid ".tag pseudo-op used outside of .def/.endef ignored." msgstr "" -#: config/obj-coff.c:1049 config/obj-coff.c:2789 +#: config/obj-coff.c:909 #, c-format msgid "tag not found for .tag %s" msgstr "" -#: config/obj-coff.c:1064 config/obj-coff.c:2803 +#: config/obj-coff.c:922 msgid ".type pseudo-op used outside of .def/.endef ignored." msgstr "" -#: config/obj-coff.c:1086 config/obj-coff.c:2823 +#: config/obj-coff.c:941 msgid ".val pseudo-op used outside of .def/.endef ignored." msgstr "" -#: config/obj-coff.c:1233 config/obj-coff.c:3016 +#: config/obj-coff.c:1108 +msgid "badly formed .weak directive ignored" +msgstr "" + +#: config/obj-coff.c:1286 msgid "mismatched .eb" msgstr "" -#: config/obj-coff.c:1254 config/obj-coff.c:3054 -msgid "C_EFCN symbol out of scope" +#: config/obj-coff.c:1307 +#, c-format +msgid "C_EFCN symbol for %s out of scope" msgstr "" #. STYP_INFO #. STYP_LIB #. STYP_OVER -#: config/obj-coff.c:1482 +#: config/obj-coff.c:1533 #, c-format msgid "unsupported section attribute '%c'" msgstr "" -#: config/obj-coff.c:1487 config/obj-coff.c:3759 config/tc-ppc.c:4508 +#: config/obj-coff.c:1538 config/tc-ppc.c:4610 #, c-format msgid "unknown section attribute '%c'" msgstr "" -#: config/obj-coff.c:1517 config/tc-ppc.c:4526 config/tc-tic54x.c:4339 -#: read.c:2562 +#: config/obj-coff.c:1568 config/tc-ppc.c:4628 config/tc-tic54x.c:4287 +#: read.c:2551 #, c-format msgid "error setting flags for \"%s\": %s" msgstr "" -#: config/obj-coff.c:1528 +#: config/obj-coff.c:1579 #, c-format msgid "Ignoring changed section attributes for %s" msgstr "" -#: config/obj-coff.c:1664 +#: config/obj-coff.c:1710 #, c-format msgid "0x%lx: \"%s\" type = %ld, class = %d, segment = %d\n" msgstr "" -#: config/obj-coff.c:1849 config/obj-ieee.c:69 -msgid "Out of step\n" -msgstr "" - -#: config/obj-coff.c:2286 -msgid "bfd_coff_swap_scnhdr_out failed" -msgstr "" - -#: config/obj-coff.c:2507 -msgid "`.bf' symbol without preceding function\n" -msgstr "" - -#: config/obj-coff.c:3457 config/obj-ieee.c:521 -#, c-format -msgid "FATAL: Can't create %s" -msgstr "" - -#: config/obj-coff.c:3635 -#, c-format -msgid "Can't close %s: %s" -msgstr "" - -#: config/obj-coff.c:3669 -#, c-format -msgid "Too many new sections; can't add \"%s\"" -msgstr "" - -#: config/obj-coff.c:4057 config/tc-sparc.c:3635 -msgid "Expected comma after name" -msgstr "" - -#: config/obj-coff.c:4063 -msgid "Missing size expression" -msgstr "" - -#: config/obj-coff.c:4069 -#, c-format -msgid "lcomm length (%d.) <0! Ignored." -msgstr "" - -#: config/obj-coff.c:4097 -#, c-format -msgid "Symbol %s already defined" -msgstr "" - -#: config/obj-coff.c:4193 config/tc-i960.c:3221 -#, c-format -msgid "No 'bal' entry point for leafproc %s" -msgstr "" - -#: config/obj-coff.c:4270 -#, c-format -msgid "Negative of non-absolute symbol %s" -msgstr "" - -#: config/obj-coff.c:4290 -msgid "callj to difference of 2 symbols" -msgstr "" - -#: config/obj-coff.c:4334 -#, c-format -msgid "Can't emit reloc {- %s-seg symbol \"%s\"} @ file address %ld." -msgstr "" - -#: config/obj-coff.c:4420 config/tc-i960.c:2844 -msgid "can't use COBR format with external label" -msgstr "" - -#: config/obj-coff.c:4493 -#, c-format -msgid "Value of %ld too large for field of %d bytes at 0x%lx" -msgstr "" - -#: config/obj-coff.c:4507 -#, c-format -msgid "Signed .word overflow; switch may be too large; %ld at 0x%lx" -msgstr "" - -#: config/obj-ecoff.c:192 +#: config/obj-ecoff.c:125 msgid "Can't set GP value" msgstr "" -#: config/obj-ecoff.c:199 +#: config/obj-ecoff.c:132 msgid "Can't set register masks" msgstr "" -#: config/obj-elf.c:316 -msgid "expected comma after symbol-name" -msgstr "" - -#: config/obj-elf.c:326 -#, c-format -msgid ".COMMon length (%ld) out of range, ignored." -msgstr "" - -#: config/obj-elf.c:335 ecoff.c:3397 read.c:1406 read.c:1507 read.c:2145 -#: read.c:2234 read.c:2863 read.c:4968 symbols.c:367 symbols.c:466 -#, c-format -msgid "symbol `%s' is already defined" -msgstr "" - -#: config/obj-elf.c:343 -#, c-format -msgid "length of .comm \"%s\" is already %ld; not changed to %ld" -msgstr "" - -#: config/obj-elf.c:367 -msgid "common alignment negative; 0 assumed" -msgstr "" - -#: config/obj-elf.c:386 -msgid "common alignment not a power of 2" -msgstr "" - -#: config/obj-elf.c:449 config/tc-sparc.c:3931 config/tc-v850.c:461 +#: config/obj-elf.c:318 config/tc-sparc.c:3973 config/tc-v850.c:451 #, c-format msgid "bad .common segment %s" msgstr "" -#: config/obj-elf.c:717 +#: config/obj-elf.c:596 #, c-format msgid "setting incorrect section type for %s" msgstr "" -#: config/obj-elf.c:721 +#: config/obj-elf.c:601 #, c-format msgid "ignoring incorrect section type for %s" msgstr "" -#: config/obj-elf.c:734 +#: config/obj-elf.c:638 #, c-format msgid "setting incorrect section attributes for %s" msgstr "" -#: config/obj-elf.c:786 +#: config/obj-elf.c:690 +#, c-format +msgid "ignoring changed section type for %s" +msgstr "" + +#: config/obj-elf.c:702 #, c-format msgid "ignoring changed section attributes for %s" msgstr "" -#: config/obj-elf.c:788 +#: config/obj-elf.c:704 #, c-format msgid "ignoring changed section entity size for %s" msgstr "" -#: config/obj-elf.c:791 -#, c-format -msgid "ignoring new section group for %s" -msgstr "" - -#: config/obj-elf.c:845 +#: config/obj-elf.c:757 msgid "unrecognized .section attribute: want a,w,x,M,S,G,T" msgstr "" -#: config/obj-elf.c:884 +#: config/obj-elf.c:794 msgid "unrecognized section attribute" msgstr "" -#: config/obj-elf.c:906 read.c:2545 +#: config/obj-elf.c:822 read.c:2535 msgid "unrecognized section type" msgstr "" -#: config/obj-elf.c:936 +#: config/obj-elf.c:852 msgid "missing name" msgstr "" -#: config/obj-elf.c:1048 +#: config/obj-elf.c:963 msgid "invalid merge entity size" msgstr "" -#: config/obj-elf.c:1055 +#: config/obj-elf.c:970 msgid "entity size for SHF_MERGE not specified" msgstr "" -#: config/obj-elf.c:1075 +#: config/obj-elf.c:990 msgid "group name for SHF_GROUP not specified" msgstr "" -#: config/obj-elf.c:1088 +#: config/obj-elf.c:1003 msgid "character following name is not '#'" msgstr "" -#: config/obj-elf.c:1189 +#: config/obj-elf.c:1118 msgid ".previous without corresponding .section; ignored" msgstr "" -#: config/obj-elf.c:1216 +#: config/obj-elf.c:1144 msgid ".popsection without corresponding .pushsection; ignored" msgstr "" -#: config/obj-elf.c:1270 +#: config/obj-elf.c:1196 msgid "expected comma after name in .symver" msgstr "" -#: config/obj-elf.c:1294 +#: config/obj-elf.c:1220 #, c-format msgid "missing version name in `%s' for symbol `%s'" msgstr "" -#: config/obj-elf.c:1305 +#: config/obj-elf.c:1231 #, c-format msgid "multiple versions [`%s'|`%s'] for symbol `%s'" msgstr "" -#: config/obj-elf.c:1541 +#: config/obj-elf.c:1461 msgid "expected quoted string" msgstr "" -#: config/obj-elf.c:1562 +#: config/obj-elf.c:1481 #, c-format msgid "expected comma after name `%s' in .size directive" msgstr "" -#: config/obj-elf.c:1571 +#: config/obj-elf.c:1490 msgid "missing expression in .size directive" msgstr "" -#: config/obj-elf.c:1660 +#: config/obj-elf.c:1577 #, c-format msgid "unrecognized symbol type \"%s\"" msgstr "" -#: config/obj-elf.c:1841 +#: config/obj-elf.c:1745 msgid ".size expression too complicated to fix up" msgstr "" -#: config/obj-elf.c:1873 +#: config/obj-elf.c:1777 #, c-format msgid "" "invalid attempt to declare external version name as default in symbol `%s'" msgstr "" -#: config/obj-elf.c:1934 ecoff.c:3642 +#: config/obj-elf.c:1838 ecoff.c:3598 #, c-format msgid "symbol `%s' can not be both weak and common" msgstr "" -#: config/obj-elf.c:2054 +#: config/obj-elf.c:1945 #, c-format msgid "assuming all members of group `%s' are COMDAT" msgstr "" -#: config/obj-elf.c:2076 +#: config/obj-elf.c:1967 #, c-format msgid "can't create group: %s" msgstr "" -#: config/obj-elf.c:2183 +#: config/obj-elf.c:2076 #, c-format msgid "failed to set up debugging information: %s" msgstr "" -#: config/obj-elf.c:2203 +#: config/obj-elf.c:2096 #, c-format msgid "can't start writing .mdebug section: %s" msgstr "" -#: config/obj-elf.c:2211 +#: config/obj-elf.c:2104 #, c-format msgid "could not write .mdebug section: %s" msgstr "" -#: config/obj-ieee.c:455 +#: config/obj-elf.h:140 +#, c-format +msgid "can't allocate ELF private section data: %s" +msgstr "" + +#: config/obj-ieee.c:69 +#, c-format +msgid "Out of step\n" +msgstr "" + +#: config/obj-ieee.c:449 msgid "too many sections" msgstr "" -#: config/obj-som.c:138 +#: config/obj-ieee.c:511 +#, c-format +msgid "FATAL: Can't create %s" +msgstr "" + +#: config/obj-som.c:129 msgid "Only one .version pseudo-op per file!" msgstr "" -#: config/obj-som.c:155 config/obj-som.c:201 +#: config/obj-som.c:146 config/obj-som.c:191 msgid "Expected quoted string" msgstr "" -#: config/obj-som.c:164 +#: config/obj-som.c:155 #, c-format msgid "FATAL: Attaching version header %s" msgstr "" -#: config/obj-som.c:184 +#: config/obj-som.c:174 msgid "Only one .copyright pseudo-op per file!" msgstr "" -#: config/obj-som.c:210 +#: config/obj-som.c:200 #, c-format msgid "FATAL: Attaching copyright header %s" msgstr "" -#: config/obj-vms.c:530 +#: config/tc-alpha.c:592 #, c-format -msgid "compiler emitted zero-size common symbol `%s' already defined" +msgid "No !literal!%ld was found" msgstr "" -#: config/obj-vms.c:540 +#: config/tc-alpha.c:599 #, c-format -msgid "compiler redefined zero-size common symbol `%s'" +msgid "No !tlsgd!%ld was found" msgstr "" -#: config/obj-vms.c:663 +#: config/tc-alpha.c:606 #, c-format -msgid "Couldn't create VMS object file \"%s\"" +msgid "No !tlsldm!%ld was found" msgstr "" -#: config/obj-vms.c:688 -msgid "I/O error writing VMS object file (length prefix)" -msgstr "" - -#: config/obj-vms.c:702 -msgid "I/O error writing VMS object file" -msgstr "" - -#: config/obj-vms.c:1292 +#: config/tc-alpha.c:615 #, c-format -msgid "Couldn't find source file \"%s\", status=%%X%x" +msgid "No ldah !gpdisp!%ld was found" msgstr "" -#: config/obj-vms.c:1790 config/obj-vms.c:2967 +#: config/tc-alpha.c:665 #, c-format -msgid "debugger forward reference error, dbx type %d" +msgid "too many !literal!%ld for %s" msgstr "" -#: config/obj-vms.c:1865 +#: config/tc-alpha.c:695 #, c-format -msgid "Variable descriptor %d too complicated. Defined as `void *'." +msgid "No lda !gpdisp!%ld was found" msgstr "" -#: config/obj-vms.c:2179 -msgid "" -"***Warning - the assembly code generated by the compiler has placed \n" -" global constant(s) in the text psect. These will not be available to \n" -" other modules, since this is not the correct way to handle this. You \n" -" have two options: 1) get a patched compiler that does not put global \n" -" constants in the text psect, or 2) remove the 'const' keyword from \n" -" definitions of global variables in your source module(s). Don't say \n" -" I didn't warn you! \n" +#. Only support one relocation op per insn. +#: config/tc-alpha.c:852 +msgid "More than one relocation op per insn" msgstr "" -#: config/obj-vms.c:2494 +#: config/tc-alpha.c:868 +msgid "No relocation operand" +msgstr "" + +#: config/tc-alpha.c:878 #, c-format -msgid "debugginer output: %d is an unknown untyped variable." +msgid "Unknown relocation operand: !%s" msgstr "" -#: config/obj-vms.c:2712 +#: config/tc-alpha.c:888 #, c-format -msgid "debugger output: structure element `%s' has undefined type" +msgid "no sequence number after !%s" msgstr "" -#: config/obj-vms.c:2823 +#: config/tc-alpha.c:898 #, c-format -msgid "debugger output: %d is an unknown type of variable." +msgid "!%s does not use a sequence number" msgstr "" -#: config/obj-vms.c:2956 +#: config/tc-alpha.c:908 #, c-format -msgid "debugger output: Unable to resolve %d circular references." +msgid "Bad sequence number: !%s!%s" msgstr "" -#: config/obj-vms.c:3158 +#: config/tc-alpha.c:1123 config/tc-alpha.c:3139 #, c-format -msgid "Module name truncated: %s\n" +msgid "inappropriate arguments for opcode `%s'" msgstr "" -#: config/obj-vms.c:3436 +#: config/tc-alpha.c:1125 config/tc-alpha.c:3141 #, c-format -msgid "Symbol %s replaced by %s\n" +msgid "opcode `%s' not supported for target %s" msgstr "" -#. impossible -#: config/obj-vms.c:3719 +#: config/tc-alpha.c:1129 config/tc-alpha.c:3145 config/tc-avr.c:1221 +#: config/tc-msp430.c:1870 #, c-format -msgid "Unknown VMS psect type (%ld)" +msgid "unknown opcode `%s'" msgstr "" -#: config/obj-vms.c:3760 +#: config/tc-alpha.c:1209 config/tc-alpha.c:1384 +msgid "overflow in literal (.lita) table" +msgstr "" + +#: config/tc-alpha.c:1216 config/tc-alpha.c:1240 config/tc-alpha.c:1397 +#: config/tc-alpha.c:2049 config/tc-alpha.c:2093 config/tc-alpha.c:2162 +#: config/tc-alpha.c:2245 config/tc-alpha.c:2470 config/tc-alpha.c:2568 +msgid "macro requires $at register while noat in effect" +msgstr "" + +#: config/tc-alpha.c:1218 config/tc-alpha.c:1242 config/tc-alpha.c:1399 +msgid "macro requires $at while $at in use" +msgstr "" + +#: config/tc-alpha.c:1346 +msgid "bignum invalid; zero assumed" +msgstr "" + +#: config/tc-alpha.c:1348 +msgid "floating point number invalid; zero assumed" +msgstr "" + +#: config/tc-alpha.c:1353 +msgid "can't handle expression" +msgstr "" + +#: config/tc-alpha.c:1390 +msgid "overflow in literal (.lit8) table" +msgstr "" + +#: config/tc-alpha.c:1674 #, c-format -msgid "Globalsymbol attribute for symbol %s was unexpected." +msgid "too many ldah insns for !gpdisp!%ld" msgstr "" -#: config/obj-vms.c:3909 -msgid "Invalid data type for globalvalue" -msgstr "" - -#: config/obj-vms.c:3921 +#: config/tc-alpha.c:1676 config/tc-alpha.c:1688 #, c-format -msgid "Invalid globalvalue of %s" +msgid "both insns for !gpdisp!%ld must be in the same section" msgstr "" -#: config/obj-vms.c:4271 -msgid "Couldn't find fixup fragment when checking for indirect reference" -msgstr "" - -#: config/obj-vms.c:4614 config/obj-vms.c:4757 -msgid "Fixup data addsy and subsy don't have the same type" -msgstr "" - -#: config/obj-vms.c:4618 config/obj-vms.c:4761 -msgid "Fixup data addsy and subsy don't have an appropriate type" -msgstr "" - -#: config/obj-vms.c:4621 config/obj-vms.c:4764 -msgid "Fixup data is erroneously \"pcrel\"" -msgstr "" - -#: config/obj-vms.c:4637 config/obj-vms.c:4783 -msgid "Fixup datum is not a longword" -msgstr "" - -#: config/obj-vms.c:4641 config/obj-vms.c:4787 -msgid "Fixup datum is not \"fixP->fx_addsy\"" -msgstr "" - -#: config/obj-vms.c:4858 +#: config/tc-alpha.c:1686 #, c-format -msgid "" -"g++ wrote an extern reference to `%s' as a routine.\n" -"I will fix it, but I hope that it was note really a routine." +msgid "too many lda insns for !gpdisp!%ld" msgstr "" -#: config/obj-vms.c:4990 -msgid "Can't handle global xtors symbols yet." -msgstr "" - -#: config/obj-vms.c:4993 +#: config/tc-alpha.c:1742 #, c-format -msgid "Unknown %s" +msgid "too many lituse insns for !lituse_tlsgd!%ld" msgstr "" -#. -#. * Error otherwise. -#. -#: config/obj-vms.c:5078 +#: config/tc-alpha.c:1745 #, c-format -msgid "unhandled stab type %d" +msgid "too many lituse insns for !lituse_tlsldm!%ld" msgstr "" -#: config/tc-a29k.c:163 config/tc-sparc.c:3983 -msgid "Unknown segment type" -msgstr "" - -#. Probably a memory allocation problem? Give up now. -#: config/tc-a29k.c:333 config/tc-dlx.c:369 config/tc-hppa.c:1463 -#: config/tc-mips.c:1108 config/tc-mips.c:1150 config/tc-or32.c:228 -#: config/tc-sparc.c:853 -msgid "Broken assembler. No assembly attempted." -msgstr "" - -#: config/tc-a29k.c:378 config/tc-avr.c:1121 config/tc-d10v.c:545 -#: config/tc-d30v.c:551 config/tc-h8300.c:492 config/tc-h8500.c:283 -#: config/tc-mcore.c:607 config/tc-mmix.c:470 config/tc-mn10200.c:940 -#: config/tc-mn10300.c:1815 config/tc-msp430.c:1544 config/tc-or32.c:334 -#: config/tc-or32.c:390 config/tc-ppc.c:2334 config/tc-s390.c:1236 -#: config/tc-sh.c:1264 config/tc-sh64.c:2254 config/tc-tic80.c:279 -#: config/tc-v850.c:2024 config/tc-w65.c:218 config/tc-z8k.c:376 -msgid "missing operand" -msgstr "" - -#: config/tc-a29k.c:417 config/tc-cris.c:1075 config/tc-cris.c:1083 -#: config/tc-dlx.c:834 config/tc-hppa.c:1599 config/tc-i860.c:453 -#: config/tc-i860.c:470 config/tc-i860.c:930 config/tc-sparc.c:1415 -#: config/tc-sparc.c:1421 +#: config/tc-alpha.c:1762 #, c-format -msgid "Unknown opcode: `%s'" +msgid "duplicate !tlsgd!%ld" msgstr "" -#: config/tc-a29k.c:422 config/tc-dlx.c:852 +#: config/tc-alpha.c:1764 #, c-format -msgid "Unknown opcode `%s'." +msgid "sequence number in use for !tlsldm!%ld" msgstr "" -#: config/tc-a29k.c:454 config/tc-dlx.c:913 +#: config/tc-alpha.c:1778 #, c-format -msgid "Too many operands: %s" +msgid "duplicate !tlsldm!%ld" msgstr "" -#: config/tc-a29k.c:476 config/tc-a29k.c:507 +#: config/tc-alpha.c:1780 #, c-format -msgid "Immediate value of %ld is too large" +msgid "sequence number in use for !tlsgd!%ld" msgstr "" -#: config/tc-a29k.c:546 config/tc-i860.c:355 config/tc-i860.c:902 -#: config/tc-m68k.c:3171 config/tc-m68k.c:3200 config/tc-sparc.c:2647 -msgid "failed sanity check." +#: config/tc-alpha.c:1823 config/tc-arc.c:294 config/tc-mn10200.c:889 +#: config/tc-mn10300.c:2600 config/tc-ppc.c:1476 config/tc-s390.c:614 +#: config/tc-v850.c:1573 +msgid "operand" msgstr "" -#: config/tc-a29k.c:892 config/tc-or32.c:1044 config/tc-or32.c:1178 +#: config/tc-alpha.c:1926 config/tc-alpha.c:1950 config/tc-d10v.c:585 +#: config/tc-d30v.c:573 config/tc-mn10200.c:1133 config/tc-mn10300.c:1893 +#: config/tc-ppc.c:2348 config/tc-ppc.c:2565 config/tc-ppc.c:2577 +#: config/tc-s390.c:1230 config/tc-s390.c:1330 config/tc-s390.c:1459 +#: config/tc-v850.c:1747 config/tc-v850.c:1770 config/tc-v850.c:1973 +msgid "too many fixups" +msgstr "" + +#: config/tc-alpha.c:1962 +msgid "invalid relocation for instruction" +msgstr "" + +#: config/tc-alpha.c:1973 +msgid "invalid relocation for field" +msgstr "" + +#: config/tc-alpha.c:2760 +msgid "can not resolve expression" +msgstr "" + +#: config/tc-alpha.c:3275 config/tc-ppc.c:1781 config/tc-ppc.c:4373 #, c-format -msgid "bad relocation type: 0x%02x" +msgid ".COMMon length (%ld.) <0! Ignored." msgstr "" -#: config/tc-a29k.c:919 +#: config/tc-alpha.c:3304 config/tc-sparc.c:3843 config/tc-v850.c:246 +msgid "Ignoring attempt to re-define symbol" +msgstr "" + +#: config/tc-alpha.c:3313 config/tc-alpha.c:3322 config/tc-ppc.c:4410 +#: config/tc-sparc.c:3851 #, c-format -msgid "need %o3\n" +msgid "Length of .comm \"%s\" is already %ld. Not changed to %ld." msgstr "" -#: config/tc-a29k.c:935 -msgid "a29k_convert_frag\n" +#: config/tc-alpha.c:3439 ecoff.c:3054 +msgid ".ent directive has no name" msgstr "" -#: config/tc-a29k.c:944 -msgid "a29k_estimate_size_before_relax\n" +#: config/tc-alpha.c:3447 +msgid "nested .ent directives" msgstr "" -#: config/tc-a29k.c:1095 config/tc-dlx.c:1283 config/tc-or32.c:1373 +#: config/tc-alpha.c:3491 ecoff.c:3005 +msgid ".end directive has no name" +msgstr "" + +#: config/tc-alpha.c:3500 +msgid ".end directive without matching .ent" +msgstr "" + +#: config/tc-alpha.c:3502 +msgid ".end directive names different symbol than .ent" +msgstr "" + +#: config/tc-alpha.c:3545 ecoff.c:3140 +msgid ".fmask outside of .ent" +msgstr "" + +#: config/tc-alpha.c:3547 ecoff.c:3204 +msgid ".mask outside of .ent" +msgstr "" + +#: config/tc-alpha.c:3555 ecoff.c:3147 +msgid "bad .fmask directive" +msgstr "" + +#: config/tc-alpha.c:3557 ecoff.c:3211 +msgid "bad .mask directive" +msgstr "" + +#: config/tc-alpha.c:3590 config/tc-mips.c:14022 ecoff.c:3168 +msgid ".frame outside of .ent" +msgstr "" + +#: config/tc-alpha.c:3601 ecoff.c:3179 +msgid "bad .frame directive" +msgstr "" + +#: config/tc-alpha.c:3633 +msgid ".prologue directive without a preceding .ent directive" +msgstr "" + +#: config/tc-alpha.c:3651 #, c-format -msgid "label \"$%d\" redefined" +msgid "Invalid argument %d to .prologue." msgstr "" -#: config/tc-a29k.c:1168 config/tc-dlx.c:511 config/tc-or32.c:1466 +#: config/tc-alpha.c:3742 +msgid "ECOFF debugging is disabled." +msgstr "" + +#: config/tc-alpha.c:3756 +msgid ".ent directive without matching .end" +msgstr "" + +#: config/tc-alpha.c:3841 +msgid ".usepv directive has no name" +msgstr "" + +#: config/tc-alpha.c:3852 +msgid ".usepv directive has no type" +msgstr "" + +#: config/tc-alpha.c:3867 +msgid "unknown argument for .usepv" +msgstr "" + +#: config/tc-alpha.c:3900 +msgid "Unknown section directive" +msgstr "" + +#: config/tc-alpha.c:3935 +msgid ".ent directive has no symbol" +msgstr "" + +#: config/tc-alpha.c:3960 +msgid "Bad .frame directive 1./2. param" +msgstr "" + +#: config/tc-alpha.c:3972 +msgid "Bad .frame directive 3./4. param" +msgstr "" + +#: config/tc-alpha.c:3994 +msgid ".pdesc directive not in link (.link) section" +msgstr "" + +#: config/tc-alpha.c:4002 +msgid ".pdesc has no matching .ent" +msgstr "" + +#: config/tc-alpha.c:4013 +msgid ".pdesc directive has no entry symbol" +msgstr "" + +#: config/tc-alpha.c:4026 +msgid "No comma after .pdesc " +msgstr "" + +#: config/tc-alpha.c:4046 +msgid "unknown procedure kind" +msgstr "" + +#: config/tc-alpha.c:4136 +msgid ".name directive not in link (.link) section" +msgstr "" + +#: config/tc-alpha.c:4144 +msgid ".name directive has no symbol" +msgstr "" + +#: config/tc-alpha.c:4175 +msgid "No symbol after .linkage" +msgstr "" + +#: config/tc-alpha.c:4199 +msgid "No symbol after .code_address" +msgstr "" + +#: config/tc-alpha.c:4226 +msgid "Bad .mask directive" +msgstr "" + +#: config/tc-alpha.c:4244 +msgid "Bad .fmask directive" +msgstr "" + +#: config/tc-alpha.c:4401 #, c-format -msgid "Invalid expression after %%%%\n" +msgid "Expected comma after name \"%s\"" msgstr "" -#: config/tc-a29k.c:1179 -msgid "Invalid register in & expression" +#. *symbol_get_obj (symbolP) = (signed char) temp; +#: config/tc-alpha.c:4412 +#, c-format +msgid "unhandled: .proc %s,%d" msgstr "" -#: config/tc-alpha.c:826 +#: config/tc-alpha.c:4446 +#, c-format +msgid "Tried to .set unrecognized mode `%s'" +msgstr "" + +#: config/tc-alpha.c:4472 +#, c-format +msgid "Bad base register, using $%d." +msgstr "" + +#: config/tc-alpha.c:4493 +#, c-format +msgid "Alignment too large: %d. assumed" +msgstr "" + +#: config/tc-alpha.c:4497 config/tc-d30v.c:2083 +msgid "Alignment negative: 0 assumed" +msgstr "" + +#: config/tc-alpha.c:4775 +#, c-format +msgid "Chose GP value of %lx\n" +msgstr "" + +#: config/tc-alpha.c:4789 +msgid "Bad .section directive: want a,s,w,x,M,S,G,T in string" +msgstr "" + +#: config/tc-alpha.c:4878 #, c-format msgid "internal error: can't hash opcode `%s': %s" msgstr "" -#: config/tc-alpha.c:860 +#: config/tc-alpha.c:4914 #, c-format msgid "internal error: can't hash macro `%s': %s" msgstr "" -#: config/tc-alpha.c:943 config/tc-i960.c:2707 config/tc-xtensa.c:4954 -#: config/tc-xtensa.c:5015 +#: config/tc-alpha.c:4998 config/tc-i960.c:710 config/tc-xtensa.c:5112 +#: config/tc-xtensa.c:5181 config/tc-xtensa.c:5227 msgid "syntax error" msgstr "" -#: config/tc-alpha.c:1017 config/tc-h8300.c:2099 config/tc-h8500.c:1204 -#: config/tc-hppa.c:4018 config/tc-i860.c:1004 config/tc-m68hc11.c:568 -#: config/tc-m68k.c:4196 config/tc-m88k.c:991 config/tc-ns32k.c:1689 -#: config/tc-or32.c:910 config/tc-sparc.c:2934 config/tc-z8k.c:1371 +#: config/tc-alpha.c:5067 config/tc-h8300.c:2055 config/tc-hppa.c:4041 +#: config/tc-i860.c:1059 config/tc-m68hc11.c:558 config/tc-m68k.c:4524 +#: config/tc-ns32k.c:1945 config/tc-or32.c:579 config/tc-sparc.c:2944 +#: config/tc-z8k.c:1310 msgid "Bad call to MD_ATOF()" msgstr "" -#: config/tc-alpha.c:1067 +#: config/tc-alpha.c:5116 #, c-format msgid "Unknown CPU identifier `%s'" msgstr "" -#: config/tc-alpha.c:1111 +#: config/tc-alpha.c:5159 msgid "" "Alpha options:\n" "-32addr\t\t\ttreat addresses as 32-bit values\n" @@ -1132,1528 +1220,1465 @@ msgid "" "\t\t\tthese variants include PALcode opcodes\n" msgstr "" -#: config/tc-alpha.c:1121 +#: config/tc-alpha.c:5169 msgid "" "VMS options:\n" "-+\t\t\thash encode (don't truncate) names longer than 64 characters\n" "-H\t\t\tshow new symbol after hash truncation\n" msgstr "" -#: config/tc-alpha.c:1298 +#: config/tc-alpha.c:5346 #, c-format msgid "unhandled relocation type %s" msgstr "" -#: config/tc-alpha.c:1311 +#: config/tc-alpha.c:5359 msgid "non-absolute expression in constant field" msgstr "" -#: config/tc-alpha.c:1325 +#: config/tc-alpha.c:5373 #, c-format msgid "type %d reloc done?\n" msgstr "" -#: config/tc-alpha.c:1373 config/tc-alpha.c:1380 config/tc-mips.c:8603 +#: config/tc-alpha.c:5420 config/tc-alpha.c:5427 config/tc-mips.c:8657 msgid "Used $at without \".set noat\"" msgstr "" -#: config/tc-alpha.c:1542 +#: config/tc-alpha.c:5589 #, c-format msgid "!samegp reloc against symbol without .prologue: %s" msgstr "" -#: config/tc-alpha.c:1581 config/tc-xtensa.c:5451 +#: config/tc-alpha.c:5626 config/tc-xtensa.c:5739 #, c-format msgid "cannot represent `%s' relocation in object file" msgstr "" -#: config/tc-alpha.c:1588 config/tc-xtensa.c:5458 +#: config/tc-alpha.c:5632 config/tc-xtensa.c:5747 #, c-format msgid "internal error? cannot generate `%s' relocation" msgstr "" -#: config/tc-alpha.c:1642 +#: config/tc-alpha.c:5683 #, c-format msgid "frame reg expected, using $%d." msgstr "" -#: config/tc-alpha.c:1743 -#, c-format -msgid "No !literal!%ld was found" -msgstr "" - -#: config/tc-alpha.c:1750 -#, c-format -msgid "No !tlsgd!%ld was found" -msgstr "" - -#: config/tc-alpha.c:1757 -#, c-format -msgid "No !tlsldm!%ld was found" -msgstr "" - -#: config/tc-alpha.c:1766 -#, c-format -msgid "No ldah !gpdisp!%ld was found" -msgstr "" - -#: config/tc-alpha.c:1816 -#, c-format -msgid "too many !literal!%ld for %s" -msgstr "" - -#: config/tc-alpha.c:1846 -#, c-format -msgid "No lda !gpdisp!%ld was found" -msgstr "" - -#. Only support one relocation op per insn. -#: config/tc-alpha.c:1994 -msgid "More than one relocation op per insn" -msgstr "" - -#: config/tc-alpha.c:2010 -msgid "No relocation operand" -msgstr "" - -#: config/tc-alpha.c:2020 -#, c-format -msgid "Unknown relocation operand: !%s" -msgstr "" - -#: config/tc-alpha.c:2030 -#, c-format -msgid "no sequence number after !%s" -msgstr "" - -#: config/tc-alpha.c:2040 -#, c-format -msgid "!%s does not use a sequence number" -msgstr "" - -#: config/tc-alpha.c:2050 -#, c-format -msgid "Bad sequence number: !%s!%s" -msgstr "" - -#: config/tc-alpha.c:2378 -#, c-format -msgid "operand out of range (%s not between %d and %d)" -msgstr "" - -#: config/tc-alpha.c:2490 config/tc-alpha.c:2514 config/tc-d10v.c:634 -#: config/tc-d30v.c:639 config/tc-mn10200.c:995 config/tc-mn10300.c:1888 -#: config/tc-ppc.c:2300 config/tc-ppc.c:2517 config/tc-ppc.c:2529 -#: config/tc-s390.c:1246 config/tc-s390.c:1346 config/tc-s390.c:1442 -#: config/tc-v850.c:1804 config/tc-v850.c:1827 config/tc-v850.c:2047 -msgid "too many fixups" -msgstr "" - -#: config/tc-alpha.c:2526 -msgid "invalid relocation for instruction" -msgstr "" - -#: config/tc-alpha.c:2537 -msgid "invalid relocation for field" -msgstr "" - -#: config/tc-alpha.c:2642 -#, c-format -msgid "too many ldah insns for !gpdisp!%ld" -msgstr "" - -#: config/tc-alpha.c:2644 config/tc-alpha.c:2656 -#, c-format -msgid "both insns for !gpdisp!%ld must be in the same section" -msgstr "" - -#: config/tc-alpha.c:2654 -#, c-format -msgid "too many lda insns for !gpdisp!%ld" -msgstr "" - -#: config/tc-alpha.c:2707 -#, c-format -msgid "too many lituse insns for !lituse_tlsgd!%ld" -msgstr "" - -#: config/tc-alpha.c:2710 -#, c-format -msgid "too many lituse insns for !lituse_tlsldm!%ld" -msgstr "" - -#: config/tc-alpha.c:2727 -#, c-format -msgid "duplicate !tlsgd!%ld" -msgstr "" - -#: config/tc-alpha.c:2729 -#, c-format -msgid "sequence number in use for !tlsldm!%ld" -msgstr "" - -#: config/tc-alpha.c:2743 -#, c-format -msgid "duplicate !tlsldm!%ld" -msgstr "" - -#: config/tc-alpha.c:2745 -#, c-format -msgid "sequence number in use for !tlsgd!%ld" -msgstr "" - -#: config/tc-alpha.c:2790 config/tc-alpha.c:2863 -#, c-format -msgid "inappropriate arguments for opcode `%s'" -msgstr "" - -#: config/tc-alpha.c:2792 config/tc-alpha.c:2865 -#, c-format -msgid "opcode `%s' not supported for target %s" -msgstr "" - -#: config/tc-alpha.c:2796 config/tc-alpha.c:2869 config/tc-avr.c:1087 -#: config/tc-msp430.c:446 -#, c-format -msgid "unknown opcode `%s'" -msgstr "" - -#: config/tc-alpha.c:2916 -msgid "can not resolve expression" -msgstr "" - -#: config/tc-alpha.c:3060 config/tc-alpha.c:3239 -msgid "overflow in literal (.lita) table" -msgstr "" - -#: config/tc-alpha.c:3067 config/tc-alpha.c:3090 config/tc-alpha.c:3252 -#: config/tc-alpha.c:3467 config/tc-alpha.c:3512 config/tc-alpha.c:3586 -#: config/tc-alpha.c:3678 config/tc-alpha.c:3926 config/tc-alpha.c:4025 -msgid "macro requires $at register while noat in effect" -msgstr "" - -#: config/tc-alpha.c:3069 config/tc-alpha.c:3092 config/tc-alpha.c:3254 -msgid "macro requires $at while $at in use" -msgstr "" - -#: config/tc-alpha.c:3200 -msgid "bignum invalid; zero assumed" -msgstr "" - -#: config/tc-alpha.c:3202 -msgid "floating point number invalid; zero assumed" -msgstr "" - -#: config/tc-alpha.c:3207 -msgid "can't handle expression" -msgstr "" - -#: config/tc-alpha.c:3245 -msgid "overflow in literal (.lit8) table" -msgstr "" - -#: config/tc-alpha.c:4262 config/tc-ppc.c:1740 config/tc-ppc.c:4271 -#, c-format -msgid ".COMMon length (%ld.) <0! Ignored." -msgstr "" - -#: config/tc-alpha.c:4291 config/tc-sparc.c:3799 config/tc-v850.c:256 -msgid "Ignoring attempt to re-define symbol" -msgstr "" - -#: config/tc-alpha.c:4300 config/tc-alpha.c:4309 config/tc-ppc.c:4308 -#, c-format -msgid "Length of .comm \"%s\" is already %ld. Not changed to %ld." -msgstr "" - -#: config/tc-alpha.c:4430 ecoff.c:3082 -msgid ".ent directive has no name" -msgstr "" - -#: config/tc-alpha.c:4438 -msgid "nested .ent directives" -msgstr "" - -#: config/tc-alpha.c:4483 ecoff.c:3032 -msgid ".end directive has no name" -msgstr "" - -#: config/tc-alpha.c:4492 -msgid ".end directive without matching .ent" -msgstr "" - -#: config/tc-alpha.c:4494 -msgid ".end directive names different symbol than .ent" -msgstr "" - -#: config/tc-alpha.c:4538 ecoff.c:3171 -msgid ".fmask outside of .ent" -msgstr "" - -#: config/tc-alpha.c:4540 ecoff.c:3241 -msgid ".mask outside of .ent" -msgstr "" - -#: config/tc-alpha.c:4548 ecoff.c:3178 -msgid "bad .fmask directive" -msgstr "" - -#: config/tc-alpha.c:4550 ecoff.c:3248 -msgid "bad .mask directive" -msgstr "" - -#: config/tc-alpha.c:4584 config/tc-mips.c:14143 ecoff.c:3200 -msgid ".frame outside of .ent" -msgstr "" - -#: config/tc-alpha.c:4595 ecoff.c:3211 -msgid "bad .frame directive" -msgstr "" - -#: config/tc-alpha.c:4628 -msgid ".prologue directive without a preceding .ent directive" -msgstr "" - -#: config/tc-alpha.c:4646 -#, c-format -msgid "Invalid argument %d to .prologue." -msgstr "" - -#: config/tc-alpha.c:4741 -msgid "ECOFF debugging is disabled." -msgstr "" - -#: config/tc-alpha.c:4755 -msgid ".ent directive without matching .end" -msgstr "" - -#: config/tc-alpha.c:4840 -msgid ".usepv directive has no name" -msgstr "" - -#: config/tc-alpha.c:4851 -msgid ".usepv directive has no type" -msgstr "" - -#: config/tc-alpha.c:4866 -msgid "unknown argument for .usepv" -msgstr "" - -#: config/tc-alpha.c:4900 -msgid "Unknown section directive" -msgstr "" - -#: config/tc-alpha.c:4936 -msgid ".ent directive has no symbol" -msgstr "" - -#: config/tc-alpha.c:4963 -msgid "Bad .frame directive 1./2. param" -msgstr "" - -#: config/tc-alpha.c:4975 -msgid "Bad .frame directive 3./4. param" -msgstr "" - -#: config/tc-alpha.c:5000 -msgid ".pdesc directive not in link (.link) section" -msgstr "" - -#: config/tc-alpha.c:5008 -msgid ".pdesc has no matching .ent" -msgstr "" - -#: config/tc-alpha.c:5019 -msgid ".pdesc directive has no entry symbol" -msgstr "" - -#: config/tc-alpha.c:5032 -msgid "No comma after .pdesc " -msgstr "" - -#: config/tc-alpha.c:5055 -msgid "unknown procedure kind" -msgstr "" - -#: config/tc-alpha.c:5148 -msgid ".name directive not in link (.link) section" -msgstr "" - -#: config/tc-alpha.c:5156 -msgid ".name directive has no symbol" -msgstr "" - -#: config/tc-alpha.c:5190 -msgid "No symbol after .linkage" -msgstr "" - -#: config/tc-alpha.c:5218 -msgid "No symbol after .code_address" -msgstr "" - -#: config/tc-alpha.c:5251 -msgid "Bad .mask directive" -msgstr "" - -#: config/tc-alpha.c:5272 -msgid "Bad .fmask directive" -msgstr "" - -#: config/tc-alpha.c:5440 -#, c-format -msgid "Expected comma after name \"%s\"" -msgstr "" - -#. *symbol_get_obj (symbolP) = (signed char) temp; -#: config/tc-alpha.c:5451 -#, c-format -msgid "unhandled: .proc %s,%d" -msgstr "" - -#: config/tc-alpha.c:5486 -#, c-format -msgid "Tried to .set unrecognized mode `%s'" -msgstr "" - -#. not fatal, but it might not work in the end -#: config/tc-alpha.c:5503 -msgid "File overrides no-base-register option." -msgstr "" - -#: config/tc-alpha.c:5520 -#, c-format -msgid "Bad base register, using $%d." -msgstr "" - -#: config/tc-alpha.c:5542 -#, c-format -msgid "Alignment too large: %d. assumed" -msgstr "" - -#: config/tc-alpha.c:5546 config/tc-d30v.c:2200 -msgid "Alignment negative: 0 assumed" -msgstr "" - -#: config/tc-alpha.c:5860 -#, c-format -msgid "Chose GP value of %lx\n" -msgstr "" - -#: config/tc-alpha.c:5876 -msgid "Bad .section directive: want a,s,w,x,M,S,G,T in string" -msgstr "" - -#: config/tc-arc.c:1615 config/tc-arm.c:11416 config/tc-ip2k.c:219 +#: config/tc-arc.c:1077 config/tc-ip2k.c:249 msgid "md_estimate_size_before_relax\n" msgstr "" -#: config/tc-arc.c:1627 +#: config/tc-arc.c:1088 msgid "md_convert_frag\n" msgstr "" #. We can't actually support subtracting a symbol. -#: config/tc-arc.c:1898 config/tc-arm.c:6617 config/tc-arm.c:9705 -#: config/tc-arm.c:9805 config/tc-avr.c:854 config/tc-cris.c:3123 -#: config/tc-d10v.c:1710 config/tc-d30v.c:1851 config/tc-mips.c:3630 -#: config/tc-mips.c:4695 config/tc-mips.c:5828 config/tc-mips.c:6517 -#: config/tc-msp430.c:1403 config/tc-ppc.c:5460 config/tc-v850.c:2356 -#: config/tc-xstormy16.c:483 +#: config/tc-arc.c:1288 config/tc-arm.c:1021 config/tc-arm.c:5764 +#: config/tc-arm.c:5815 config/tc-arm.c:6614 config/tc-arm.c:7256 +#: config/tc-arm.c:7284 config/tc-arm.c:7536 config/tc-arm.c:7553 +#: config/tc-arm.c:7674 config/tc-avr.c:970 config/tc-cris.c:3928 +#: config/tc-d10v.c:1539 config/tc-d30v.c:1938 config/tc-mips.c:3794 +#: config/tc-mips.c:4902 config/tc-mips.c:5834 config/tc-mips.c:6428 +#: config/tc-msp430.c:1979 config/tc-ppc.c:5562 config/tc-v850.c:2274 +#: config/tc-xstormy16.c:484 msgid "expression too complex" msgstr "" -#: config/tc-arm.c:763 +#: config/tc-arm.c:352 msgid "ARM register expected" msgstr "" -#: config/tc-arm.c:764 config/tc-arm.c:3174 +#: config/tc-arm.c:353 msgid "bad or missing co-processor number" msgstr "" -#. In the few cases where we might be able to accept something else -#. this error can be overridden. -#: config/tc-arm.c:765 config/tc-arm.c:3229 +#: config/tc-arm.c:354 msgid "co-processor register expected" msgstr "" -#: config/tc-arm.c:766 +#: config/tc-arm.c:355 msgid "FPA register expected" msgstr "" -#: config/tc-arm.c:767 +#: config/tc-arm.c:356 msgid "VFP single precision register expected" msgstr "" -#: config/tc-arm.c:768 +#: config/tc-arm.c:357 msgid "VFP double precision register expected" msgstr "" -#: config/tc-arm.c:769 +#: config/tc-arm.c:358 +msgid "VFP system register expected" +msgstr "" + +#: config/tc-arm.c:359 msgid "Maverick MVF register expected" msgstr "" -#: config/tc-arm.c:770 +#: config/tc-arm.c:360 msgid "Maverick MVD register expected" msgstr "" -#: config/tc-arm.c:771 config/tc-arm.c:772 +#: config/tc-arm.c:361 msgid "Maverick MVFX register expected" msgstr "" -#: config/tc-arm.c:773 +#: config/tc-arm.c:362 +msgid "Maverick MVDX register expected" +msgstr "" + +#: config/tc-arm.c:363 msgid "Maverick MVAX register expected" msgstr "" -#: config/tc-arm.c:774 +#: config/tc-arm.c:364 msgid "Maverick DSPSC register expected" msgstr "" -#: config/tc-arm.c:775 -msgid "Intel Wireless MMX technology register expected" +#: config/tc-arm.c:365 +msgid "iWMMXt data register expected" msgstr "" -#: config/tc-arm.c:2309 +#: config/tc-arm.c:366 +msgid "iWMMXt control register expected" +msgstr "" + +#: config/tc-arm.c:367 +msgid "iWMMXt scalar register expected" +msgstr "" + +#: config/tc-arm.c:368 +msgid "XScale accumulator register expected" +msgstr "" + +#: config/tc-arm.c:499 msgid "bad arguments to instruction" msgstr "" -#: config/tc-arm.c:2310 +#: config/tc-arm.c:500 msgid "r15 not allowed here" msgstr "" -#: config/tc-arm.c:2311 -msgid "instruction is not conditional" +#: config/tc-arm.c:501 +msgid "instruction cannot be conditional" msgstr "" -#: config/tc-arm.c:2312 -msgid "acc0 expected" +#: config/tc-arm.c:502 +msgid "registers may not be the same" msgstr "" -#: config/tc-arm.c:2505 -msgid "literal pool overflow" +#: config/tc-arm.c:503 +msgid "lo register required" msgstr "" -#: config/tc-arm.c:2647 -msgid "invalid syntax for .req directive" +#: config/tc-arm.c:504 +msgid "instruction not supported in Thumb16 mode" msgstr "" -#: config/tc-arm.c:2727 -#, c-format -msgid "alignment too large: %d assumed" +#: config/tc-arm.c:640 +msgid "immediate expression requires a # prefix" msgstr "" -#: config/tc-arm.c:2730 -msgid "alignment negative. 0 assumed." -msgstr "" - -#: config/tc-arm.c:2814 -#, c-format -msgid "expected comma after name \"%s\"" -msgstr "" - -#: config/tc-arm.c:2864 config/tc-m32r.c:420 -#, c-format -msgid "symbol `%s' already defined" -msgstr "" - -#: config/tc-arm.c:2889 -msgid "selected processor does not support THUMB opcodes" -msgstr "" - -#: config/tc-arm.c:2902 -msgid "selected processor does not support ARM opcodes" -msgstr "" - -#: config/tc-arm.c:2914 -#, c-format -msgid "invalid instruction size selected (%d)" -msgstr "" - -#: config/tc-arm.c:2949 -#, c-format -msgid "invalid operand to .code directive (%d) (expecting 16 or 32)" -msgstr "" - -#: config/tc-arm.c:2960 -msgid "garbage following instruction" -msgstr "" - -#. In the few cases where we might be able to accept something else -#. this error can be overridden. -#: config/tc-arm.c:3010 -#, c-format -msgid "register expected, not '%.100s'" -msgstr "" - -#. In the few cases where we might be able to accept -#. something else this error can be overridden. -#: config/tc-arm.c:3061 -#, c-format -msgid "Intel Wireless MMX technology register expected, not '%.100s'" -msgstr "" - -#. In the few cases where we might be able to accept -#. something else this error can be overridden. -#: config/tc-arm.c:3133 -msgid "flag for {c}psr instruction expected" -msgstr "" - -#: config/tc-arm.c:3167 -msgid "illegal co-processor number" -msgstr "" - -#: config/tc-arm.c:3199 config/tc-arm.c:4778 -msgid "bad or missing expression" -msgstr "" - -#: config/tc-arm.c:3205 -msgid "immediate co-processor expression too large" -msgstr "" - -#. In the few cases where we might be able to accept something else -#. this error can be overridden. -#: config/tc-arm.c:3252 -msgid "floating point register expected" -msgstr "" - -#: config/tc-arm.c:3269 config/tc-arm.c:3414 -msgid "immediate expression expected" -msgstr "" - -#: config/tc-arm.c:3284 -msgid "co-processor address must be word aligned" -msgstr "" - -#: config/tc-arm.c:3290 config/tc-arm.c:3429 -msgid "offset too large" -msgstr "" - -#: config/tc-arm.c:3339 config/tc-arm.c:3477 -msgid "pc may not be used in post-increment" -msgstr "" - -#: config/tc-arm.c:3355 config/tc-arm.c:3493 config/tc-arm.c:3938 -#: config/tc-arm.c:5197 config/tc-arm.c:6064 config/tc-arm.c:6398 -msgid "pre-indexed expression expected" -msgstr "" - -#: config/tc-arm.c:3368 config/tc-arm.c:3506 config/tc-arm.c:3951 -#: config/tc-arm.c:5208 config/tc-arm.c:6076 config/tc-arm.c:6410 -#: config/tc-arm.c:6784 config/tc-arm.c:9448 config/tc-arm.c:9463 -msgid "missing ]" -msgstr "" - -#: config/tc-arm.c:3378 config/tc-arm.c:3516 -msgid "pc may not be used with write-back" -msgstr "" - -#: config/tc-arm.c:3568 -msgid "comma expected after register name" -msgstr "" - -#: config/tc-arm.c:3587 -msgid "CPSR or SPSR expected" -msgstr "" - -#: config/tc-arm.c:3613 -msgid "comma missing after psr flags" -msgstr "" - -#: config/tc-arm.c:3629 config/tc-arm.c:3639 -msgid "only a register or immediate value can follow a psr flag" -msgstr "" - -#: config/tc-arm.c:3650 -msgid "immediate value cannot be used to set this field" -msgstr "" - -#: config/tc-arm.c:3668 config/tc-arm.c:5424 config/tc-arm.c:5704 -#: config/tc-arm.c:5724 config/tc-i960.c:1935 -msgid "invalid constant" -msgstr "" - -#: config/tc-arm.c:3716 -msgid "rdhi, rdlo and rm must all be different" -msgstr "" - -#: config/tc-arm.c:3770 -msgid "rd and rm should be different in mul" -msgstr "" - -#: config/tc-arm.c:3824 -msgid "rd and rm should be different in mla" -msgstr "" - -#: config/tc-arm.c:3872 -#, c-format -msgid "acc0 expected, not '%.100s'" -msgstr "" - -#: config/tc-arm.c:4050 -msgid "rdhi and rdlo must be different" -msgstr "" - -#: config/tc-arm.c:4158 -msgid "Warning: instruction unpredictable when using r15" -msgstr "" - -#: config/tc-arm.c:4373 -msgid "use of r15 in bxj is not really useful" -msgstr "" - -#: config/tc-arm.c:4400 config/tc-arm.c:4585 config/tc-arm.c:5445 expr.c:1318 -#: read.c:2206 +#: config/tc-arm.c:666 expr.c:1302 read.c:2228 msgid "bad expression" msgstr "" -#: config/tc-arm.c:4409 config/tc-arm.c:4594 config/tc-arm.c:4786 -#: config/tc-arm.c:8389 config/tc-arm.c:8424 config/tc-arm.c:8434 -#: config/tc-z8k.c:1161 config/tc-z8k.c:1173 -msgid "immediate value out of range" +#: config/tc-arm.c:677 config/tc-i860.c:1005 config/tc-sparc.c:2844 +msgid "bad segment" msgstr "" -#: config/tc-arm.c:4833 -msgid "only r15 allowed here" +#: config/tc-arm.c:693 config/tc-arm.c:3230 config/tc-i960.c:1302 +msgid "invalid constant" msgstr "" -#: config/tc-arm.c:5160 -msgid "'[' expected after PLD mnemonic" +#: config/tc-arm.c:754 +msgid "bad call to MD_ATOF()" msgstr "" -#: config/tc-arm.c:5182 -msgid "post-indexed expression used in preload instruction" +#: config/tc-arm.c:821 +msgid "expected #constant" msgstr "" -#: config/tc-arm.c:5187 config/tc-arm.c:5217 -msgid "writeback used in preload instruction" -msgstr "" - -#: config/tc-arm.c:5259 -msgid "destination register must be even" -msgstr "" - -#: config/tc-arm.c:5265 -msgid "r14 not allowed here" -msgstr "" - -#: config/tc-arm.c:5272 -msgid "pre/post-indexing used when modified address register is destination" -msgstr "" - -#: config/tc-arm.c:5282 -msgid "ldrd destination registers must not overlap index register" -msgstr "" - -#: config/tc-arm.c:5408 -msgid "bad_segment" -msgstr "" - -#: config/tc-arm.c:5468 config/tc-arm.c:5479 -msgid "shift expression expected" -msgstr "" - -#: config/tc-arm.c:5503 -msgid "shift requires register or #expression" -msgstr "" - -#: config/tc-arm.c:5504 -msgid "shift requires #expression" -msgstr "" - -#: config/tc-arm.c:5534 -msgid "shift of 0 ignored." -msgstr "" - -#: config/tc-arm.c:5540 -msgid "invalid immediate shift" -msgstr "" - -#: config/tc-arm.c:5695 config/tc-arm.c:6112 config/tc-arm.c:6447 -#: config/tc-arm.c:7081 config/tc-v850.c:1907 config/tc-v850.c:1928 -msgid "constant expression expected" -msgstr "" - -#: config/tc-arm.c:5737 -msgid "register or shift expression expected" -msgstr "" - -#: config/tc-arm.c:5790 -msgid "invalid floating point immediate expression" -msgstr "" - -#: config/tc-arm.c:5794 -msgid "floating point register or immediate expression expected" -msgstr "" - -#: config/tc-arm.c:5948 config/tc-arm.c:6278 -msgid "address offset too large" -msgstr "" - -#: config/tc-arm.c:6006 config/tc-arm.c:6196 config/tc-arm.c:6338 -msgid "address expected" -msgstr "" - -#: config/tc-arm.c:6036 config/tc-arm.c:6048 config/tc-arm.c:6085 -#: config/tc-arm.c:6214 config/tc-arm.c:6368 config/tc-arm.c:6382 -#: config/tc-arm.c:6419 -#, c-format -msgid "%s register same as write-back base" -msgstr "" - -#: config/tc-arm.c:6038 config/tc-arm.c:6050 config/tc-arm.c:6087 -#: config/tc-arm.c:6216 config/tc-arm.c:6370 config/tc-arm.c:6384 -#: config/tc-arm.c:6421 -msgid "destination" -msgstr "" - -#: config/tc-arm.c:6038 config/tc-arm.c:6050 config/tc-arm.c:6087 -#: config/tc-arm.c:6216 config/tc-arm.c:6370 config/tc-arm.c:6384 -#: config/tc-arm.c:6421 -msgid "source" -msgstr "" - -#: config/tc-arm.c:6097 config/tc-arm.c:6431 config/tc-arm.c:8695 -msgid "invalid pseudo operation" -msgstr "" - -#: config/tc-arm.c:6149 config/tc-arm.c:6482 -msgid "literal pool insertion failed" -msgstr "" - -#: config/tc-arm.c:6244 config/tc-arm.c:6250 -msgid "post-indexed expression expected" -msgstr "" - -#: config/tc-arm.c:6548 +#: config/tc-arm.c:953 msgid "bad range in register list" msgstr "" -#: config/tc-arm.c:6556 config/tc-arm.c:6565 config/tc-arm.c:6607 +#: config/tc-arm.c:961 config/tc-arm.c:970 config/tc-arm.c:1011 #, c-format msgid "Warning: duplicated register (r%d) in register list" msgstr "" -#: config/tc-arm.c:6568 +#: config/tc-arm.c:973 msgid "Warning: register range not in ascending order" msgstr "" -#: config/tc-arm.c:6580 +#: config/tc-arm.c:984 msgid "missing `}'" msgstr "" -#: config/tc-arm.c:6596 +#: config/tc-arm.c:1000 msgid "invalid register mask" msgstr "" -#: config/tc-arm.c:6655 -msgid "r15 not allowed as base register" -msgstr "" - -#: config/tc-arm.c:6689 config/tc-arm.c:6698 -msgid "writeback of base register is UNPREDICTABLE" -msgstr "" - -#: config/tc-arm.c:6692 -msgid "writeback of base register when in register list is UNPREDICTABLE" -msgstr "" - -#: config/tc-arm.c:6702 -msgid "if writeback register is in list, it must be the lowest reg in the list" -msgstr "" - -#: config/tc-arm.c:6744 config/tc-arm.c:6758 -msgid "r15 not allowed in swap" -msgstr "" - -#: config/tc-arm.c:6853 -msgid "use of r15 in bx in ARM mode is not really useful" -msgstr "" - -#: config/tc-arm.c:7087 -msgid "constant value required for number of registers" -msgstr "" - -#: config/tc-arm.c:7095 -msgid "number of registers must be in the range [1:4]" -msgstr "" - -#: config/tc-arm.c:7156 -msgid "r15 not allowed as base register with write-back" -msgstr "" - -#: config/tc-arm.c:7538 -msgid "only two consecutive VFP SP registers allowed here" -msgstr "" - -#: config/tc-arm.c:7706 -msgid "VFP system register expected" -msgstr "" - -#: config/tc-arm.c:7844 config/tc-arm.c:7883 config/tc-arm.c:7896 -#: config/tc-arm.c:7957 config/tc-arm.c:7996 config/tc-arm.c:8009 -#: config/tc-h8300.c:1035 config/tc-mips.c:9723 config/tc-mips.c:9753 +#: config/tc-arm.c:1091 config/tc-arm.c:1126 config/tc-h8300.c:991 +#: config/tc-mips.c:9797 config/tc-mips.c:9827 msgid "invalid register list" msgstr "" -#: config/tc-arm.c:7850 config/tc-arm.c:7963 +#: config/tc-arm.c:1097 config/tc-arm.c:2402 config/tc-arm.c:2535 msgid "register list not in ascending order" msgstr "" -#: config/tc-arm.c:7875 config/tc-arm.c:7988 +#: config/tc-arm.c:1118 msgid "register range not in ascending order" msgstr "" -#: config/tc-arm.c:7913 config/tc-arm.c:8026 +#: config/tc-arm.c:1151 msgid "non-contiguous register range" msgstr "" -#: config/tc-arm.c:8056 config/tc-arm.c:8093 -msgid "this addressing mode requires base-register writeback" -msgstr "" - -#: config/tc-arm.c:8253 -msgid "lo register required" -msgstr "" - -#: config/tc-arm.c:8261 -msgid "hi register required" -msgstr "" - -#: config/tc-arm.c:8331 config/tc-arm.c:9537 -msgid "dest and source1 must be the same register" -msgstr "" - -#: config/tc-arm.c:8338 -msgid "subtract valid only on lo regs" -msgstr "" - -#: config/tc-arm.c:8362 -msgid "invalid Hi register with immediate" -msgstr "" - -#: config/tc-arm.c:8402 -msgid "invalid immediate value for stack adjust" -msgstr "" - -#: config/tc-arm.c:8413 -msgid "invalid immediate for address calculation" -msgstr "" - -#: config/tc-arm.c:8500 -msgid "source1 and dest must be same register" -msgstr "" - -#: config/tc-arm.c:8534 -msgid "invalid immediate for shift" -msgstr "" - -#: config/tc-arm.c:8613 -msgid "only lo regs allowed with immediate" -msgstr "" - -#: config/tc-arm.c:8632 -msgid "invalid immediate" -msgstr "" - -#: config/tc-arm.c:8686 -msgid "expected ']'" -msgstr "" - -#: config/tc-arm.c:8759 -msgid "byte or halfword not valid for base register" -msgstr "" - -#: config/tc-arm.c:8764 -msgid "r15 based store not allowed" -msgstr "" - -#: config/tc-arm.c:8769 -msgid "invalid base register for register offset" -msgstr "" - -#: config/tc-arm.c:8787 config/tc-arm.c:8822 -msgid "invalid offset" -msgstr "" - -#: config/tc-arm.c:8798 -msgid "invalid base register in load/store" -msgstr "" - -#: config/tc-arm.c:9341 -msgid "expecting immediate, 7bit operand" -msgstr "" - -#: config/tc-arm.c:9356 -msgid "immediate out of range" -msgstr "" - -#: config/tc-arm.c:9399 -msgid "offset expected" -msgstr "" - -#: config/tc-arm.c:9408 config/tc-pj.c:537 config/tc-sh.c:3593 -msgid "offset out of range" -msgstr "" - -#: config/tc-arm.c:9545 -msgid "Rs and Rd must be different in MUL" -msgstr "" - -#: config/tc-arm.c:9689 -msgid "" -"inserted missing '!': load/store multiple always writes back base register" -msgstr "" - -#: config/tc-arm.c:9711 -msgid "only lo-regs valid in load/store multiple" -msgstr "" - -#: config/tc-arm.c:9757 -msgid "syntax: ldrs[b] Rd, [Rb, Ro]" -msgstr "" - -#: config/tc-arm.c:9821 -msgid "invalid register list to push/pop instruction" -msgstr "" - -#: config/tc-arm.c:9933 config/tc-arm.c:10159 -msgid "virtual memory exhausted" -msgstr "" - -#: config/tc-arm.c:10014 +#: config/tc-arm.c:1199 #, c-format -msgid "register '%s' does not exist\n" +msgid "ignoring attempt to redefine built-in register '%s'" msgstr "" -#: config/tc-arm.c:10018 -#, c-format -msgid "" -"ignoring redefinition of register alias '%s' to non-existant register '%s'" -msgstr "" - -#: config/tc-arm.c:10027 +#: config/tc-arm.c:1204 #, c-format msgid "ignoring redefinition of register alias '%s'" msgstr "" -#: config/tc-arm.c:10033 -msgid "ignoring incomplete .req pseuso op" -msgstr "" - -#: config/tc-arm.c:10183 -msgid "use of old and new-style options to set CPU type" -msgstr "" - -#: config/tc-arm.c:10193 -msgid "use of old and new-style options to set FPU type" -msgstr "" - -#: config/tc-arm.c:10473 -msgid "bad call to MD_ATOF()" -msgstr "" - -#: config/tc-arm.c:10703 +#: config/tc-arm.c:1248 #, c-format -msgid "invalid constant (%lx) after fixup" +msgid "unknown register '%s' -- .req ignored" msgstr "" -#: config/tc-arm.c:10741 +#: config/tc-arm.c:1291 +msgid "invalid syntax for .req directive" +msgstr "" + +#: config/tc-arm.c:1317 +msgid "invalid syntax for .unreq directive" +msgstr "" + +#: config/tc-arm.c:1323 #, c-format -msgid "unable to compute ADRL instructions for PC offset of 0x%lx" +msgid "unknown register alias '%s'" msgstr "" -#: config/tc-arm.c:10771 +#: config/tc-arm.c:1325 #, c-format -msgid "bad immediate value for offset (%ld)" +msgid "ignoring attempt to undefine built-in register '%s'" msgstr "" -#: config/tc-arm.c:10793 config/tc-arm.c:10815 -msgid "invalid literal constant: pool needs to be closer" +#: config/tc-arm.c:1456 +msgid "selected processor does not support THUMB opcodes" msgstr "" -#: config/tc-arm.c:10795 +#: config/tc-arm.c:1470 +msgid "selected processor does not support ARM opcodes" +msgstr "" + +#: config/tc-arm.c:1483 #, c-format -msgid "bad immediate value for half-word offset (%ld)" +msgid "invalid instruction size selected (%d)" msgstr "" -#: config/tc-arm.c:10832 +#: config/tc-arm.c:1515 +#, c-format +msgid "invalid operand to .code directive (%d) (expecting 16 or 32)" +msgstr "" + +#: config/tc-arm.c:1571 +#, c-format +msgid "expected comma after name \"%s\"" +msgstr "" + +#: config/tc-arm.c:1621 config/tc-m32r.c:589 +#, c-format +msgid "symbol `%s' already defined" +msgstr "" + +#: config/tc-arm.c:1655 +#, c-format +msgid "unrecognized syntax mode \"%s\"" +msgstr "" + +#: config/tc-arm.c:1675 +#, c-format +msgid "alignment too large: %d assumed" +msgstr "" + +#: config/tc-arm.c:1678 +msgid "alignment negative. 0 assumed." +msgstr "" + +#: config/tc-arm.c:1816 +msgid "literal pool overflow" +msgstr "" + +#: config/tc-arm.c:1972 config/tc-arm.c:3888 +msgid "unrecognized relocation suffix" +msgstr "" + +#: config/tc-arm.c:1985 +msgid "(plt) is only valid on branch targets" +msgstr "" + +#: config/tc-arm.c:1991 config/tc-s390.c:1128 config/tc-s390.c:1742 +#: config/tc-xtensa.c:1601 +#, c-format +msgid "%s relocations do not fit in %d bytes" +msgstr "" + +#: config/tc-arm.c:2039 dwarf2dbg.c:659 +msgid "expected 0 or 1" +msgstr "" + +#: config/tc-arm.c:2043 +msgid "missing comma" +msgstr "" + +#: config/tc-arm.c:2098 +msgid "dupicate .handlerdata directive" +msgstr "" + +#: config/tc-arm.c:2169 +msgid "personality routine specified for cantunwind frame" +msgstr "" + +#: config/tc-arm.c:2183 +msgid "duplicate .personalityindex directive" +msgstr "" + +#: config/tc-arm.c:2190 +msgid "bad personality routine number" +msgstr "" + +#: config/tc-arm.c:2209 +msgid "duplicate .personality directive" +msgstr "" + +#: config/tc-arm.c:2232 config/tc-arm.c:2354 +msgid "expected register list" +msgstr "" + +#: config/tc-arm.c:2310 +msgid "expected , " +msgstr "" + +#: config/tc-arm.c:2319 +msgid "number of registers must be in the range [1:4]" +msgstr "" + +#: config/tc-arm.c:2416 config/tc-arm.c:2549 +msgid "bad register range" +msgstr "" + +#: config/tc-arm.c:2602 +msgid "register expected" +msgstr "" + +#: config/tc-arm.c:2612 +msgid "FPA .unwind_save does not take a register list" +msgstr "" + +#: config/tc-arm.c:2625 +msgid ".unwind_save does not support this kind of register" +msgstr "" + +#: config/tc-arm.c:2650 +msgid "SP and PC not permitted in .unwind_movsp directive" +msgstr "" + +#: config/tc-arm.c:2655 +msgid "unexpected .unwind_movsp directive" +msgstr "" + +#: config/tc-arm.c:2679 +msgid "stack increment must be multiple of 4" +msgstr "" + +#: config/tc-arm.c:2708 +msgid "expected , " +msgstr "" + +#: config/tc-arm.c:2726 +msgid "register must be either sp or set by a previousunwind_movsp directive" +msgstr "" + +#: config/tc-arm.c:2762 +msgid "expected , " +msgstr "" + +#: config/tc-arm.c:2774 +msgid "unwind opcode too long" +msgstr "" + +#: config/tc-arm.c:2779 +msgid "invalid unwind opcode" +msgstr "" + +#: config/tc-arm.c:2829 +msgid "expected numeric constant" +msgstr "" + +#: config/tc-arm.c:2838 +msgid "expected comma" +msgstr "" + +#: config/tc-arm.c:2877 +msgid "bad string constant" +msgstr "" + +#: config/tc-arm.c:2881 +msgid "expected , " +msgstr "" + +#: config/tc-arm.c:2957 +msgid "constant expression required" +msgstr "" + +#: config/tc-arm.c:2963 config/tc-arm.c:6472 config/tc-arm.c:11799 +#: config/tc-arm.c:11824 config/tc-arm.c:11832 config/tc-z8k.c:1122 +#: config/tc-z8k.c:1132 +msgid "immediate value out of range" +msgstr "" + +#: config/tc-arm.c:3058 +msgid "invalid FPA immediate expression" +msgstr "" + +#: config/tc-arm.c:3108 config/tc-arm.c:3116 +msgid "shift expression expected" +msgstr "" + +#: config/tc-arm.c:3130 +msgid "'LSL' or 'ASR' required" +msgstr "" + +#: config/tc-arm.c:3138 +msgid "'LSL' required" +msgstr "" + +#: config/tc-arm.c:3146 +msgid "'ASR' required" +msgstr "" + +#: config/tc-arm.c:3218 config/tc-arm.c:4349 config/tc-v850.c:1844 +#: config/tc-v850.c:1865 +msgid "constant expression expected" +msgstr "" + +#: config/tc-arm.c:3225 +msgid "invalid rotation" +msgstr "" + +#: config/tc-arm.c:3340 config/tc-arm.c:3640 +msgid "']' expected" +msgstr "" + +#: config/tc-arm.c:3358 +msgid "'}' expected at end of 'option' field" +msgstr "" + +#: config/tc-arm.c:3363 +msgid "cannot combine index with option" +msgstr "" + +#: config/tc-arm.c:3376 +msgid "cannot combine pre- and post-indexing" +msgstr "" + +#: config/tc-arm.c:3472 +msgid "flag for {c}psr instruction expected" +msgstr "" + +#: config/tc-arm.c:3497 +msgid "unrecognized CPS flag" +msgstr "" + +#: config/tc-arm.c:3504 +msgid "missing CPS flags" +msgstr "" + +#: config/tc-arm.c:3527 config/tc-arm.c:3533 +msgid "valid endian specifiers are be or le" +msgstr "" + +#: config/tc-arm.c:3555 +msgid "missing rotation field after comma" +msgstr "" + +#: config/tc-arm.c:3570 +msgid "rotation can only be 0, 8, 16, or 24" +msgstr "" + +#: config/tc-arm.c:3590 +msgid "condition required" +msgstr "" + +#: config/tc-arm.c:3632 +msgid "invalid shift" +msgstr "" + +#: config/tc-arm.c:3929 +msgid "iWMMXt data or control register expected" +msgstr "" + +#: config/tc-arm.c:4051 +msgid "garbage following instruction" +msgstr "" + +#: config/tc-arm.c:4185 +msgid "instruction does not accept preindexed addressing" +msgstr "" + +#. unindexed - only for coprocessor +#: config/tc-arm.c:4201 config/tc-arm.c:5857 +msgid "instruction does not accept unindexed addressing" +msgstr "" + +#: config/tc-arm.c:4209 +msgid "destination register same as write-back base" +msgstr "" + +#: config/tc-arm.c:4210 +msgid "source register same as write-back base" +msgstr "" + +#: config/tc-arm.c:4256 +msgid "instruction does not accept scaled register index" +msgstr "" + +#: config/tc-arm.c:4295 +msgid "instruction does not support unindexed addressing" +msgstr "" + +#: config/tc-arm.c:4310 +msgid "pc may not be used with write-back" +msgstr "" + +#: config/tc-arm.c:4315 +msgid "instruction does not support writeback" +msgstr "" + +#: config/tc-arm.c:4344 +msgid "invalid pseudo operation" +msgstr "" + +#: config/tc-arm.c:4390 +msgid "literal pool insertion failed" +msgstr "" + +#: config/tc-arm.c:4448 +msgid "Rn must not overlap other operands" +msgstr "" + +#: config/tc-arm.c:4534 config/tc-arm.c:4553 config/tc-arm.c:4566 +#: config/tc-arm.c:6360 config/tc-arm.c:6380 config/tc-arm.c:6394 +msgid "bit-field extends past end of register" +msgstr "" + +#: config/tc-arm.c:4595 +msgid "the only suffix valid here is '(plt)'" +msgstr "" + +#: config/tc-arm.c:4627 +msgid "use of r15 in blx in ARM mode is not really useful" +msgstr "" + +#: config/tc-arm.c:4645 +msgid "use of r15 in bx in ARM mode is not really useful" +msgstr "" + +#: config/tc-arm.c:4657 config/tc-arm.c:6508 +msgid "use of r15 in bxj is not really useful" +msgstr "" + +#: config/tc-arm.c:4761 config/tc-arm.c:4770 +msgid "writeback of base register is UNPREDICTABLE" +msgstr "" + +#: config/tc-arm.c:4764 +msgid "writeback of base register when in register list is UNPREDICTABLE" +msgstr "" + +#: config/tc-arm.c:4774 +msgid "if writeback register is in list, it must be the lowest reg in the list" +msgstr "" + +#: config/tc-arm.c:4789 +msgid "first destination register must be even" +msgstr "" + +#: config/tc-arm.c:4792 config/tc-arm.c:4849 +msgid "can only load two consecutive registers" +msgstr "" + +#. If op 1 were present and equal to PC, this function wouldn't +#. have been called in the first place. +#. If op 2 were present and equal to PC, this function wouldn't +#. have been called in the first place. +#: config/tc-arm.c:4793 config/tc-arm.c:4852 config/tc-arm.c:5299 +#: config/tc-arm.c:6886 +msgid "r14 not allowed here" +msgstr "" + +#: config/tc-arm.c:4794 +msgid "'[' expected" +msgstr "" + +#: config/tc-arm.c:4807 +msgid "base register written back, and overlaps second destination register" +msgstr "" + +#: config/tc-arm.c:4815 +msgid "index register overlaps destination register" +msgstr "" + +#: config/tc-arm.c:4829 config/tc-arm.c:5272 config/tc-arm.c:6706 +#: config/tc-arm.c:7581 +msgid "instruction does not accept this addressing mode" +msgstr "" + +#: config/tc-arm.c:4835 config/tc-arm.c:5281 +msgid "offset must be zero in ARM encoding" +msgstr "" + +#: config/tc-arm.c:4846 config/tc-arm.c:5293 +msgid "even register required" +msgstr "" + +#: config/tc-arm.c:4877 config/tc-arm.c:4908 +msgid "this instruction requires a post-indexed address" +msgstr "" + +#: config/tc-arm.c:4935 +msgid "rd and rm should be different in mla" +msgstr "" + +#: config/tc-arm.c:4967 config/tc-arm.c:7121 +msgid "'CPSR' or 'SPSR' expected" +msgstr "" + +#: config/tc-arm.c:5000 +msgid "rd and rm should be different in mul" +msgstr "" + +#: config/tc-arm.c:5021 +msgid "rdhi, rdlo and rm must all be different" +msgstr "" + +#: config/tc-arm.c:5083 +msgid "'[' expected after PLD mnemonic" +msgstr "" + +#: config/tc-arm.c:5085 +msgid "post-indexed expression used in preload instruction" +msgstr "" + +#: config/tc-arm.c:5087 +msgid "writeback used in preload instruction" +msgstr "" + +#: config/tc-arm.c:5089 +msgid "unindexed addressing used in preload instruction" +msgstr "" + +#: config/tc-arm.c:5188 config/tc-arm.c:7492 +msgid "source1 and dest must be same register" +msgstr "" + +#: config/tc-arm.c:5238 config/tc-arm.c:7178 +msgid "rdhi and rdlo must be different" +msgstr "" + +#: config/tc-arm.c:5296 +msgid "can only store two consecutive registers" +msgstr "" + +#: config/tc-arm.c:5391 config/tc-arm.c:5408 +msgid "only two consecutive VFP SP registers allowed here" +msgstr "" + +#: config/tc-arm.c:5436 config/tc-arm.c:5451 +msgid "this addressing mode requires base-register writeback" +msgstr "" + +#: config/tc-arm.c:5529 +msgid "this instruction does not support indexing" +msgstr "" + +#: config/tc-arm.c:5552 +msgid "only r15 allowed here" +msgstr "" + +#: config/tc-arm.c:5757 +msgid "shift by register not allowed in thumb mode" +msgstr "" + +#: config/tc-arm.c:5769 config/tc-arm.c:11339 msgid "shift expression is too large" msgstr "" -#: config/tc-arm.c:10851 config/tc-arm.c:10860 -msgid "invalid swi expression" +#: config/tc-arm.c:5795 +msgid "Thumb does not support the ldr =N pseudo-operation" msgstr "" -#: config/tc-arm.c:10870 -msgid "invalid expression in load/store multiple" +#: config/tc-arm.c:5800 +msgid "cannot use register index with PC-relative addressing" msgstr "" -#: config/tc-arm.c:10923 -msgid "GAS can't handle same-section branch dest >= 0x04000000" +#: config/tc-arm.c:5801 +msgid "cannot use register index with this instruction" msgstr "" -#: config/tc-arm.c:10932 -msgid "out of range branch" +#: config/tc-arm.c:5803 +msgid "Thumb does not support negative register indexing" msgstr "" -#: config/tc-arm.c:10965 config/tc-arm.c:10981 -msgid "branch out of range" +#: config/tc-arm.c:5805 +msgid "Thumb does not support register post-indexing" msgstr "" -#: config/tc-arm.c:11005 -msgid "branch with link out of range" +#: config/tc-arm.c:5807 +msgid "Thumb does not support register indexing with writeback" msgstr "" -#: config/tc-arm.c:11074 -msgid "illegal value for co-processor offset" +#: config/tc-arm.c:5809 +msgid "Thumb supports only LSL in shifted register indexing" msgstr "" -#: config/tc-arm.c:11086 -msgid "Illegal value for co-processor offset" +#: config/tc-arm.c:5818 +msgid "shift out of range" msgstr "" -#: config/tc-arm.c:11110 +#: config/tc-arm.c:5826 +msgid "cannot use writeback with PC-relative addressing" +msgstr "" + +#: config/tc-arm.c:5828 +msgid "cannot use writeback with this instruction" +msgstr "" + +#: config/tc-arm.c:5847 +msgid "cannot use post-indexing with PC-relative addressing" +msgstr "" + +#: config/tc-arm.c:5848 +msgid "cannot use post-indexing with this instruction" +msgstr "" + +#: config/tc-arm.c:5975 +msgid "PC not allowed as destination" +msgstr "" + +#: config/tc-arm.c:6093 config/tc-arm.c:6234 config/tc-arm.c:6326 +#: config/tc-arm.c:7092 +msgid "shift must be constant" +msgstr "" + +#: config/tc-arm.c:6120 config/tc-arm.c:6249 config/tc-arm.c:6341 +#: config/tc-arm.c:7105 +msgid "unshifted register required" +msgstr "" + +#: config/tc-arm.c:6135 config/tc-arm.c:6352 config/tc-arm.c:7165 +msgid "dest must overlap one source register" +msgstr "" + +#: config/tc-arm.c:6252 +msgid "dest and source1 must be the same register" +msgstr "" + +#: config/tc-arm.c:6537 +msgid "Thumb does not support the 2-argument form of this instruction" +msgstr "" + +#: config/tc-arm.c:6616 +msgid "Thumb load/store multiple does not support {reglist}^" +msgstr "" + +#: config/tc-arm.c:6633 config/tc-arm.c:6649 config/tc-arm.c:6680 #, c-format -msgid "invalid offset, target not word aligned (0x%08X)" +msgid "value stored for r%d is UNPREDICTABLE" msgstr "" -#: config/tc-arm.c:11116 config/tc-arm.c:11126 config/tc-arm.c:11134 -#: config/tc-arm.c:11142 config/tc-arm.c:11150 -#, c-format -msgid "invalid offset, value too big (0x%08lX)" +#: config/tc-arm.c:6643 +msgid "SP should not be in register list" msgstr "" -#: config/tc-arm.c:11190 -msgid "invalid immediate for stack address calculation" +#: config/tc-arm.c:6647 +msgid "PC should not be in register list" msgstr "" -#: config/tc-arm.c:11199 -#, c-format -msgid "invalid immediate for address calculation (value = 0x%08lX)" +#: config/tc-arm.c:6656 config/tc-arm.c:7311 +msgid "LR and PC should not both be in register list" msgstr "" -#: config/tc-arm.c:11209 -msgid "invalid 8bit immediate" +#: config/tc-arm.c:6659 +msgid "base register should not be in register list when written back" msgstr "" -#: config/tc-arm.c:11217 -msgid "invalid 3bit immediate" +#: config/tc-arm.c:6677 config/tc-arm.c:6687 +msgid "this instruction will write back the base register" msgstr "" -#: config/tc-arm.c:11233 -#, c-format -msgid "invalid immediate: %ld is too large" +#: config/tc-arm.c:6690 +msgid "this instruction will not write back the base register" msgstr "" -#: config/tc-arm.c:11248 -#, c-format -msgid "illegal Thumb shift value: %ld" +#: config/tc-arm.c:6719 +msgid "r14 not allowed as first register when second register is omitted" msgstr "" -#: config/tc-arm.c:11262 -#, c-format -msgid "bad relocation fixup type (%d)" +#: config/tc-arm.c:6809 config/tc-arm.c:6822 config/tc-arm.c:6858 +msgid "Thumb does not support this addressing mode" msgstr "" -#: config/tc-arm.c:11333 -msgid "literal referenced across section boundary" +#: config/tc-arm.c:6826 +msgid "byte or halfword not valid for base register" msgstr "" -#: config/tc-arm.c:11346 -msgid "internal relocation (type: IMMEDIATE) not fixed up" +#: config/tc-arm.c:6829 +msgid "r15 based store not allowed" msgstr "" -#: config/tc-arm.c:11351 -msgid "ADRL used for a symbol not defined in the same file" +#: config/tc-arm.c:6831 +msgid "invalid base register for register offset" msgstr "" -#: config/tc-arm.c:11356 -msgid "internal_relocation (type: OFFSET_IMM) not fixed up" +#: config/tc-arm.c:7032 +msgid "only lo regs allowed with immediate" msgstr "" -#: config/tc-arm.c:11374 config/tc-cris.c:3063 config/tc-mcore.c:2052 -#: config/tc-mmix.c:2867 config/tc-ns32k.c:2396 -msgid "" +#: config/tc-arm.c:7130 +msgid "Thumb encoding does not support an immediate here" msgstr "" -#: config/tc-arm.c:11377 config/tc-arm.c:11398 -#, c-format -msgid "cannot represent %s relocation in this object file format" +#: config/tc-arm.c:7200 +msgid "Thumb does not support NOP with hints" msgstr "" -#: config/tc-arm.c:11494 -#, c-format -msgid "no operator -- statement `%s'\n" +#: config/tc-arm.c:7282 +msgid "push/pop do not support {reglist}^" msgstr "" -#: config/tc-arm.c:11512 config/tc-arm.c:11537 -#, c-format -msgid "selected processor does not support `%s'" +#: config/tc-arm.c:7301 +msgid "SP not allowed in register list" msgstr "" -#: config/tc-arm.c:11554 +#: config/tc-arm.c:7305 +msgid "PC not allowed in register list" +msgstr "" + +#: config/tc-arm.c:7328 +msgid "invalid register list to push/pop instruction" +msgstr "" + +#: config/tc-arm.c:7513 +msgid "ror #imm not supported" +msgstr "" + +#: config/tc-arm.c:7638 +msgid "Thumb encoding does not support rotation" +msgstr "" + +#: config/tc-arm.c:7656 +msgid "PC is not a valid index register" +msgstr "" + +#: config/tc-arm.c:7658 +msgid "instruction does not allow shifted index" +msgstr "" + +#: config/tc-arm.c:7660 +msgid "instruction requires shifted index" +msgstr "" + +#: config/tc-arm.c:7943 config/tc-arm.c:8015 +msgid "conditional infixes are deprecated in unified syntax" +msgstr "" + +#: config/tc-arm.c:8047 #, c-format msgid "bad instruction `%s'" msgstr "" -#: config/tc-arm.c:11655 -msgid "generate PIC code" +#: config/tc-arm.c:8063 config/tc-arm.c:8126 +#, c-format +msgid "selected processor does not support `%s'" msgstr "" -#: config/tc-arm.c:11656 -msgid "assemble Thumb code" +#: config/tc-arm.c:8069 +msgid "Thumb does not support conditional execution" +msgstr "" + +#: config/tc-arm.c:8080 +msgid "incorrect condition in IT block" +msgstr "" + +#: config/tc-arm.c:8088 +msgid "thumb conditional instrunction not in IT block" +msgstr "" + +#: config/tc-arm.c:8108 +#, c-format +msgid "cannot honor width suffix -- `%s'" +msgstr "" + +#: config/tc-arm.c:8131 +#, c-format +msgid "width suffixes are invalid in ARM mode -- `%s'" +msgstr "" + +#: config/tc-arm.c:10340 +msgid "alignments greater than 32 bytes not supported in .text sections." +msgstr "" + +#: config/tc-arm.c:10634 +msgid "handerdata in cantunwind frame" +msgstr "" + +#: config/tc-arm.c:10651 +msgid "too many unwind opcodes for personality routine 0" +msgstr "" + +#: config/tc-arm.c:10683 +msgid "too many unwind opcodes" +msgstr "" + +#: config/tc-arm.c:11085 config/tc-arm.c:11365 +#, c-format +msgid "undefined symbol %s used as an immediate value" +msgstr "" + +#: config/tc-arm.c:11099 config/tc-arm.c:11394 +#, c-format +msgid "invalid constant (%lx) after fixup" +msgstr "" + +#: config/tc-arm.c:11136 +#, c-format +msgid "unable to compute ADRL instructions for PC offset of 0x%lx" +msgstr "" + +#: config/tc-arm.c:11168 config/tc-arm.c:11193 +msgid "invalid literal constant: pool needs to be closer" +msgstr "" + +#: config/tc-arm.c:11171 config/tc-arm.c:11209 +#, c-format +msgid "bad immediate value for offset (%ld)" +msgstr "" + +#: config/tc-arm.c:11195 +#, c-format +msgid "bad immediate value for half-word offset (%ld)" +msgstr "" + +#: config/tc-arm.c:11250 +msgid "offset not a multiple of 4" +msgstr "" + +#: config/tc-arm.c:11257 config/tc-arm.c:11272 config/tc-arm.c:11287 +#: config/tc-arm.c:11298 config/tc-arm.c:11321 config/tc-pj.c:499 +#: config/tc-sh.c:4084 +msgid "offset out of range" +msgstr "" + +#: config/tc-arm.c:11410 +msgid "invalid smc expression" +msgstr "" + +#: config/tc-arm.c:11421 config/tc-arm.c:11430 +msgid "invalid swi expression" +msgstr "" + +#: config/tc-arm.c:11440 +msgid "invalid expression in load/store multiple" +msgstr "" + +#: config/tc-arm.c:11455 +msgid "misaligned branch destination" +msgstr "" + +#: config/tc-arm.c:11459 config/tc-arm.c:11479 config/tc-arm.c:11497 +#: config/tc-arm.c:11510 config/tc-arm.c:11523 config/tc-arm.c:11562 +#: config/tc-arm.c:11587 +msgid "branch out of range" +msgstr "" + +#: config/tc-arm.c:11475 +msgid "misaligned BLX destination" +msgstr "" + +#: config/tc-arm.c:11536 +msgid "conditional branch out of range" msgstr "" #: config/tc-arm.c:11657 +msgid "rel31 relocation overflow" +msgstr "" + +#: config/tc-arm.c:11669 config/tc-arm.c:11694 +msgid "co-processor offset out of range" +msgstr "" + +#: config/tc-arm.c:11710 +#, c-format +msgid "invalid offset, target not word aligned (0x%08lX)" +msgstr "" + +#: config/tc-arm.c:11716 config/tc-arm.c:11725 config/tc-arm.c:11733 +#: config/tc-arm.c:11741 config/tc-arm.c:11749 +#, c-format +msgid "invalid offset, value too big (0x%08lX)" +msgstr "" + +#: config/tc-arm.c:11790 +msgid "invalid Hi register with immediate" +msgstr "" + +#: config/tc-arm.c:11806 +msgid "invalid immediate for stack address calculation" +msgstr "" + +#: config/tc-arm.c:11814 +#, c-format +msgid "invalid immediate for address calculation (value = 0x%08lX)" +msgstr "" + +#: config/tc-arm.c:11844 +#, c-format +msgid "invalid immediate: %ld is too large" +msgstr "" + +#: config/tc-arm.c:11856 +#, c-format +msgid "invalid shift value: %ld" +msgstr "" + +#: config/tc-arm.c:11875 +#, c-format +msgid "bad relocation fixup type (%d)" +msgstr "" + +#: config/tc-arm.c:11943 +msgid "literal referenced across section boundary" +msgstr "" + +#: config/tc-arm.c:11973 +msgid "internal relocation (type: IMMEDIATE) not fixed up" +msgstr "" + +#: config/tc-arm.c:11978 +msgid "ADRL used for a symbol not defined in the same file" +msgstr "" + +#: config/tc-arm.c:11987 +#, c-format +msgid "undefined local label `%s'" +msgstr "" + +#: config/tc-arm.c:11993 +msgid "internal_relocation (type: OFFSET_IMM) not fixed up" +msgstr "" + +#: config/tc-arm.c:12014 config/tc-cris.c:3869 config/tc-mcore.c:1995 +#: config/tc-mmix.c:2888 config/tc-ns32k.c:2284 +msgid "" +msgstr "" + +#: config/tc-arm.c:12017 config/tc-arm.c:12038 +#, c-format +msgid "cannot represent %s relocation in this object file format" +msgstr "" + +#: config/tc-arm.c:12254 +#, c-format +msgid "%s: unexpected function type: %d" +msgstr "" + +#: config/tc-arm.c:12331 +msgid "virtual memory exhausted" +msgstr "" + +#: config/tc-arm.c:12357 +msgid "use of old and new-style options to set CPU type" +msgstr "" + +#: config/tc-arm.c:12367 +msgid "use of old and new-style options to set FPU type" +msgstr "" + +#: config/tc-arm.c:12441 +msgid "hard-float conflicts with specified fpu" +msgstr "" + +#: config/tc-arm.c:12633 +msgid "generate PIC code" +msgstr "" + +#: config/tc-arm.c:12634 +msgid "assemble Thumb code" +msgstr "" + +#: config/tc-arm.c:12635 msgid "support ARM/Thumb interworking" msgstr "" -#: config/tc-arm.c:11659 -msgid "use old ABI (ELF only)" -msgstr "" - -#: config/tc-arm.c:11660 +#: config/tc-arm.c:12637 msgid "code uses 32-bit program counter" msgstr "" -#: config/tc-arm.c:11661 +#: config/tc-arm.c:12638 msgid "code uses 26-bit program counter" msgstr "" -#: config/tc-arm.c:11662 +#: config/tc-arm.c:12639 msgid "floating point args are in fp regs" msgstr "" -#: config/tc-arm.c:11664 +#: config/tc-arm.c:12641 msgid "re-entrant code" msgstr "" -#: config/tc-arm.c:11665 +#: config/tc-arm.c:12642 msgid "code is ATPCS conformant" msgstr "" -#: config/tc-arm.c:11666 +#: config/tc-arm.c:12643 msgid "assemble for big-endian" msgstr "" -#: config/tc-arm.c:11667 +#: config/tc-arm.c:12644 msgid "assemble for little-endian" msgstr "" #. These are recognized by the assembler, but have no affect on code. -#: config/tc-arm.c:11671 +#: config/tc-arm.c:12648 msgid "use frame pointer" msgstr "" -#: config/tc-arm.c:11672 +#: config/tc-arm.c:12649 msgid "use stack size checking" msgstr "" #. DON'T add any new processors to this list -- we want the whole list #. to go away... Add them to the processors table instead. -#: config/tc-arm.c:11676 config/tc-arm.c:11677 +#: config/tc-arm.c:12653 config/tc-arm.c:12654 msgid "use -mcpu=arm1" msgstr "" -#: config/tc-arm.c:11678 config/tc-arm.c:11679 +#: config/tc-arm.c:12655 config/tc-arm.c:12656 msgid "use -mcpu=arm2" msgstr "" -#: config/tc-arm.c:11680 config/tc-arm.c:11681 +#: config/tc-arm.c:12657 config/tc-arm.c:12658 msgid "use -mcpu=arm250" msgstr "" -#: config/tc-arm.c:11682 config/tc-arm.c:11683 +#: config/tc-arm.c:12659 config/tc-arm.c:12660 msgid "use -mcpu=arm3" msgstr "" -#: config/tc-arm.c:11684 config/tc-arm.c:11685 +#: config/tc-arm.c:12661 config/tc-arm.c:12662 msgid "use -mcpu=arm6" msgstr "" -#: config/tc-arm.c:11686 config/tc-arm.c:11687 +#: config/tc-arm.c:12663 config/tc-arm.c:12664 msgid "use -mcpu=arm600" msgstr "" -#: config/tc-arm.c:11688 config/tc-arm.c:11689 +#: config/tc-arm.c:12665 config/tc-arm.c:12666 msgid "use -mcpu=arm610" msgstr "" -#: config/tc-arm.c:11690 config/tc-arm.c:11691 +#: config/tc-arm.c:12667 config/tc-arm.c:12668 msgid "use -mcpu=arm620" msgstr "" -#: config/tc-arm.c:11692 config/tc-arm.c:11693 +#: config/tc-arm.c:12669 config/tc-arm.c:12670 msgid "use -mcpu=arm7" msgstr "" -#: config/tc-arm.c:11694 config/tc-arm.c:11695 +#: config/tc-arm.c:12671 config/tc-arm.c:12672 msgid "use -mcpu=arm70" msgstr "" -#: config/tc-arm.c:11696 config/tc-arm.c:11697 +#: config/tc-arm.c:12673 config/tc-arm.c:12674 msgid "use -mcpu=arm700" msgstr "" -#: config/tc-arm.c:11698 config/tc-arm.c:11699 +#: config/tc-arm.c:12675 config/tc-arm.c:12676 msgid "use -mcpu=arm700i" msgstr "" -#: config/tc-arm.c:11700 config/tc-arm.c:11701 +#: config/tc-arm.c:12677 config/tc-arm.c:12678 msgid "use -mcpu=arm710" msgstr "" -#: config/tc-arm.c:11702 config/tc-arm.c:11703 +#: config/tc-arm.c:12679 config/tc-arm.c:12680 msgid "use -mcpu=arm710c" msgstr "" -#: config/tc-arm.c:11704 config/tc-arm.c:11705 +#: config/tc-arm.c:12681 config/tc-arm.c:12682 msgid "use -mcpu=arm720" msgstr "" -#: config/tc-arm.c:11706 config/tc-arm.c:11707 +#: config/tc-arm.c:12683 config/tc-arm.c:12684 msgid "use -mcpu=arm7d" msgstr "" -#: config/tc-arm.c:11708 config/tc-arm.c:11709 +#: config/tc-arm.c:12685 config/tc-arm.c:12686 msgid "use -mcpu=arm7di" msgstr "" -#: config/tc-arm.c:11710 config/tc-arm.c:11711 +#: config/tc-arm.c:12687 config/tc-arm.c:12688 msgid "use -mcpu=arm7m" msgstr "" -#: config/tc-arm.c:11712 config/tc-arm.c:11713 +#: config/tc-arm.c:12689 config/tc-arm.c:12690 msgid "use -mcpu=arm7dm" msgstr "" -#: config/tc-arm.c:11714 config/tc-arm.c:11715 +#: config/tc-arm.c:12691 config/tc-arm.c:12692 msgid "use -mcpu=arm7dmi" msgstr "" -#: config/tc-arm.c:11716 config/tc-arm.c:11717 +#: config/tc-arm.c:12693 config/tc-arm.c:12694 msgid "use -mcpu=arm7100" msgstr "" -#: config/tc-arm.c:11718 config/tc-arm.c:11719 +#: config/tc-arm.c:12695 config/tc-arm.c:12696 msgid "use -mcpu=arm7500" msgstr "" -#: config/tc-arm.c:11720 config/tc-arm.c:11721 +#: config/tc-arm.c:12697 config/tc-arm.c:12698 msgid "use -mcpu=arm7500fe" msgstr "" -#: config/tc-arm.c:11722 config/tc-arm.c:11723 config/tc-arm.c:11724 -#: config/tc-arm.c:11725 +#: config/tc-arm.c:12699 config/tc-arm.c:12700 config/tc-arm.c:12701 +#: config/tc-arm.c:12702 msgid "use -mcpu=arm7tdmi" msgstr "" -#: config/tc-arm.c:11726 config/tc-arm.c:11727 +#: config/tc-arm.c:12703 config/tc-arm.c:12704 msgid "use -mcpu=arm710t" msgstr "" -#: config/tc-arm.c:11728 config/tc-arm.c:11729 +#: config/tc-arm.c:12705 config/tc-arm.c:12706 msgid "use -mcpu=arm720t" msgstr "" -#: config/tc-arm.c:11730 config/tc-arm.c:11731 +#: config/tc-arm.c:12707 config/tc-arm.c:12708 msgid "use -mcpu=arm740t" msgstr "" -#: config/tc-arm.c:11732 config/tc-arm.c:11733 +#: config/tc-arm.c:12709 config/tc-arm.c:12710 msgid "use -mcpu=arm8" msgstr "" -#: config/tc-arm.c:11734 config/tc-arm.c:11735 +#: config/tc-arm.c:12711 config/tc-arm.c:12712 msgid "use -mcpu=arm810" msgstr "" -#: config/tc-arm.c:11736 config/tc-arm.c:11737 +#: config/tc-arm.c:12713 config/tc-arm.c:12714 msgid "use -mcpu=arm9" msgstr "" -#: config/tc-arm.c:11738 config/tc-arm.c:11739 +#: config/tc-arm.c:12715 config/tc-arm.c:12716 msgid "use -mcpu=arm9tdmi" msgstr "" -#: config/tc-arm.c:11740 config/tc-arm.c:11741 +#: config/tc-arm.c:12717 config/tc-arm.c:12718 msgid "use -mcpu=arm920" msgstr "" -#: config/tc-arm.c:11742 config/tc-arm.c:11743 +#: config/tc-arm.c:12719 config/tc-arm.c:12720 msgid "use -mcpu=arm940" msgstr "" -#: config/tc-arm.c:11744 +#: config/tc-arm.c:12721 msgid "use -mcpu=strongarm" msgstr "" -#: config/tc-arm.c:11746 +#: config/tc-arm.c:12723 msgid "use -mcpu=strongarm110" msgstr "" -#: config/tc-arm.c:11748 +#: config/tc-arm.c:12725 msgid "use -mcpu=strongarm1100" msgstr "" -#: config/tc-arm.c:11750 +#: config/tc-arm.c:12727 msgid "use -mcpu=strongarm1110" msgstr "" -#: config/tc-arm.c:11751 +#: config/tc-arm.c:12728 msgid "use -mcpu=xscale" msgstr "" -#: config/tc-arm.c:11752 +#: config/tc-arm.c:12729 msgid "use -mcpu=iwmmxt" msgstr "" -#: config/tc-arm.c:11753 +#: config/tc-arm.c:12730 msgid "use -mcpu=all" msgstr "" #. Architecture variants -- don't add any more to this list either. -#: config/tc-arm.c:11756 config/tc-arm.c:11757 +#: config/tc-arm.c:12733 config/tc-arm.c:12734 msgid "use -march=armv2" msgstr "" -#: config/tc-arm.c:11758 config/tc-arm.c:11759 +#: config/tc-arm.c:12735 config/tc-arm.c:12736 msgid "use -march=armv2a" msgstr "" -#: config/tc-arm.c:11760 config/tc-arm.c:11761 +#: config/tc-arm.c:12737 config/tc-arm.c:12738 msgid "use -march=armv3" msgstr "" -#: config/tc-arm.c:11762 config/tc-arm.c:11763 +#: config/tc-arm.c:12739 config/tc-arm.c:12740 msgid "use -march=armv3m" msgstr "" -#: config/tc-arm.c:11764 config/tc-arm.c:11765 +#: config/tc-arm.c:12741 config/tc-arm.c:12742 msgid "use -march=armv4" msgstr "" -#: config/tc-arm.c:11766 config/tc-arm.c:11767 +#: config/tc-arm.c:12743 config/tc-arm.c:12744 msgid "use -march=armv4t" msgstr "" -#: config/tc-arm.c:11768 config/tc-arm.c:11769 +#: config/tc-arm.c:12745 config/tc-arm.c:12746 msgid "use -march=armv5" msgstr "" -#: config/tc-arm.c:11770 config/tc-arm.c:11771 +#: config/tc-arm.c:12747 config/tc-arm.c:12748 msgid "use -march=armv5t" msgstr "" -#: config/tc-arm.c:11772 config/tc-arm.c:11773 +#: config/tc-arm.c:12749 config/tc-arm.c:12750 msgid "use -march=armv5te" msgstr "" #. Floating point variants -- don't add any more to this list either. -#: config/tc-arm.c:11776 +#: config/tc-arm.c:12753 msgid "use -mfpu=fpe" msgstr "" -#: config/tc-arm.c:11777 +#: config/tc-arm.c:12754 msgid "use -mfpu=fpa10" msgstr "" -#: config/tc-arm.c:11778 +#: config/tc-arm.c:12755 msgid "use -mfpu=fpa11" msgstr "" -#: config/tc-arm.c:11780 +#: config/tc-arm.c:12757 msgid "use either -mfpu=softfpa or -mfpu=softvfp" msgstr "" -#: config/tc-arm.c:11963 +#: config/tc-arm.c:12986 msgid "invalid architectural extension" msgstr "" -#: config/tc-arm.c:11977 +#: config/tc-arm.c:13000 msgid "missing architectural extension" msgstr "" -#: config/tc-arm.c:11990 +#: config/tc-arm.c:13013 #, c-format msgid "unknown architectural extnsion `%s'" msgstr "" -#: config/tc-arm.c:12015 +#: config/tc-arm.c:13037 #, c-format msgid "missing cpu name `%s'" msgstr "" -#: config/tc-arm.c:12031 +#: config/tc-arm.c:13062 config/tc-arm.c:13389 #, c-format msgid "unknown cpu `%s'" msgstr "" -#: config/tc-arm.c:12050 +#: config/tc-arm.c:13080 #, c-format msgid "missing architecture name `%s'" msgstr "" -#: config/tc-arm.c:12067 +#: config/tc-arm.c:13097 config/tc-arm.c:13423 #, c-format msgid "unknown architecture `%s'\n" msgstr "" -#: config/tc-arm.c:12084 +#: config/tc-arm.c:13113 config/tc-arm.c:13454 #, c-format msgid "unknown floating point format `%s'\n" msgstr "" -#: config/tc-arm.c:12090 +#: config/tc-arm.c:13129 +#, c-format +msgid "unknown floating point abi `%s'\n" +msgstr "" + +#: config/tc-arm.c:13145 +#, c-format +msgid "unknown EABI `%s'\n" +msgstr "" + +#: config/tc-arm.c:13152 msgid "\t assemble for CPU " msgstr "" -#: config/tc-arm.c:12092 +#: config/tc-arm.c:13154 msgid "\t assemble for architecture " msgstr "" -#: config/tc-arm.c:12094 +#: config/tc-arm.c:13156 msgid "\t assemble for FPU architecture " msgstr "" -#: config/tc-arm.c:12136 config/tc-arm.c:12158 +#: config/tc-arm.c:13158 +msgid "\t assemble for floating point ABI " +msgstr "" + +#: config/tc-arm.c:13161 +msgid "\t assemble for eabi version " +msgstr "" + +#: config/tc-arm.c:13202 config/tc-arm.c:13224 #, c-format msgid "option `-%c%s' is deprecated: %s" msgstr "" -#: config/tc-arm.c:12167 +#: config/tc-arm.c:13245 #, c-format -msgid "unrecognized option `-%c%s'" -msgstr "" - -#: config/tc-arm.c:12181 msgid " ARM-specific assembler options:\n" msgstr "" -#: config/tc-arm.c:12192 +#: config/tc-arm.c:13256 +#, c-format msgid " -EB assemble code for a big-endian cpu\n" msgstr "" -#: config/tc-arm.c:12197 +#: config/tc-arm.c:13261 +#, c-format msgid " -EL assemble code for a little-endian cpu\n" msgstr "" -#: config/tc-arm.c:12381 +#: config/tc-avr.c:209 #, c-format -msgid "%s: unexpected function type: %d" -msgstr "" - -#: config/tc-arm.c:12756 -msgid "alignments greater than 32 bytes not supported in .text sections." -msgstr "" - -#: config/tc-arm.h:98 -msgid "arm convert_frag\n" -msgstr "" - -#: config/tc-avr.c:203 msgid "Known MCU names:" msgstr "" -#: config/tc-avr.c:272 +#: config/tc-avr.c:275 +#, c-format msgid "" "AVR options:\n" " -mmcu=[avr-name] select microcontroller variant\n" @@ -2666,7 +2691,8 @@ msgid "" " or immediate microcontroller name.\n" msgstr "" -#: config/tc-avr.c:282 +#: config/tc-avr.c:285 +#, c-format msgid "" " -mall-opcodes accept all AVR opcodes, even if not supported by MCU\n" " -mno-skip-bug disable warnings for skipping two-word instructions\n" @@ -2675,389 +2701,677 @@ msgid "" " (default for avr3, avr5)\n" msgstr "" -#: config/tc-avr.c:330 config/tc-msp430.c:257 +#: config/tc-avr.c:329 config/tc-msp430.c:749 #, c-format msgid "unknown MCU: %s\n" msgstr "" -#: config/tc-avr.c:339 +#: config/tc-avr.c:338 #, c-format msgid "redefinition of mcu type `%s' to `%s'" msgstr "" -#: config/tc-avr.c:390 config/tc-d10v.c:319 config/tc-d30v.c:365 -#: config/tc-mips.c:10137 config/tc-mmix.c:2246 config/tc-mn10200.c:361 -#: config/tc-msp430.c:378 config/tc-pj.c:374 config/tc-ppc.c:5105 -#: config/tc-sh.c:2528 config/tc-v850.c:1244 +#: config/tc-avr.c:385 config/tc-crx.c:491 config/tc-d10v.c:278 +#: config/tc-d30v.c:312 config/tc-mips.c:10241 config/tc-mmix.c:2264 +#: config/tc-mn10200.c:342 config/tc-msp430.c:873 config/tc-pj.c:342 +#: config/tc-ppc.c:5211 config/tc-sh.c:2986 config/tc-v850.c:1199 msgid "bad call to md_atof" msgstr "" -#: config/tc-avr.c:453 +#: config/tc-avr.c:447 msgid "constant value required" msgstr "" -#: config/tc-avr.c:456 +#: config/tc-avr.c:450 #, c-format msgid "number must be less than %d" msgstr "" -#: config/tc-avr.c:508 -msgid "`,' required" -msgstr "" - -#: config/tc-avr.c:527 -msgid "undefined combination of operands" -msgstr "" - -#: config/tc-avr.c:536 -msgid "skipping two-word instruction" -msgstr "" - -#: config/tc-avr.c:598 -msgid "register r16-r23 required" -msgstr "" - -#: config/tc-avr.c:604 -msgid "register number above 15 required" -msgstr "" - -#: config/tc-avr.c:610 -msgid "even register number required" -msgstr "" - -#: config/tc-avr.c:616 -msgid "register r24, r26, r28 or r30 required" -msgstr "" - -#: config/tc-avr.c:622 -msgid "register name or number from 0 to 31 required" -msgstr "" - -#: config/tc-avr.c:640 -msgid "pointer register (X, Y or Z) required" -msgstr "" - -#: config/tc-avr.c:647 -msgid "cannot both predecrement and postincrement" -msgstr "" - -#: config/tc-avr.c:655 -msgid "addressing mode not supported" -msgstr "" - -#: config/tc-avr.c:661 -msgid "can't predecrement" -msgstr "" - -#: config/tc-avr.c:664 -msgid "pointer register Z required" -msgstr "" - -#: config/tc-avr.c:682 -msgid "pointer register (Y or Z) required" -msgstr "" - -#: config/tc-avr.c:787 -#, c-format -msgid "unknown constraint `%c'" -msgstr "" - -#: config/tc-avr.c:881 config/tc-avr.c:897 config/tc-avr.c:998 -#: config/tc-msp430.c:1431 config/tc-msp430.c:1448 -#, c-format -msgid "odd address operand: %ld" -msgstr "" - -#: config/tc-avr.c:889 config/tc-avr.c:908 config/tc-d10v.c:586 -#: config/tc-d30v.c:655 config/tc-msp430.c:1439 config/tc-msp430.c:1453 -#: config/tc-msp430.c:1463 -#, c-format -msgid "operand out of range: %ld" -msgstr "" - -#: config/tc-avr.c:1007 config/tc-d10v.c:1793 config/tc-d30v.c:1973 -#: config/tc-msp430.c:1481 -#, c-format -msgid "line %d: unknown relocation type: 0x%x" -msgstr "" - -#: config/tc-avr.c:1021 -msgid "only constant expression allowed" -msgstr "" - -#: config/tc-avr.c:1057 config/tc-d10v.c:1659 config/tc-d30v.c:1806 -#: config/tc-mn10200.c:1255 config/tc-mn10300.c:2303 config/tc-msp430.c:1520 -#: config/tc-or32.c:1618 config/tc-ppc.c:5919 config/tc-v850.c:2263 -#, c-format -msgid "reloc %d not supported by object file format" -msgstr "" - -#: config/tc-avr.c:1081 config/tc-d10v.c:1248 config/tc-d10v.c:1262 -#: config/tc-h8300.c:1915 config/tc-h8500.c:1106 config/tc-mcore.c:938 -#: config/tc-msp430.c:438 config/tc-pj.c:283 config/tc-sh.c:2096 -#: config/tc-z8k.c:1238 -msgid "can't find opcode " -msgstr "" - -#: config/tc-avr.c:1098 -#, c-format -msgid "illegal opcode %s for mcu %s" -msgstr "" - -#: config/tc-avr.c:1106 -msgid "garbage at end of line" -msgstr "" - -#: config/tc-avr.c:1170 read.c:3226 -msgid "illegal expression" -msgstr "" - -#: config/tc-avr.c:1196 config/tc-avr.c:1262 -msgid "`)' required" -msgstr "" - -#: config/tc-avr.c:1216 +#: config/tc-avr.c:476 config/tc-avr.c:583 #, c-format msgid "constant out of 8-bit range: %d" msgstr "" -#: config/tc-avr.c:1219 -msgid "expression possibly out of 8-bit range" +#: config/tc-avr.c:488 config/tc-d10v.c:498 config/tc-d30v.c:490 +#: config/tc-h8300.c:451 config/tc-mcore.c:665 config/tc-mmix.c:489 +#: config/tc-mn10200.c:1078 config/tc-mn10300.c:1820 config/tc-msp430.c:457 +#: config/tc-or32.c:306 config/tc-ppc.c:2382 config/tc-s390.c:1220 +#: config/tc-sh64.c:2213 config/tc-sh.c:1272 config/tc-v850.c:1952 +#: config/tc-z8k.c:328 +msgid "missing operand" msgstr "" -#: config/tc-avr.c:1290 config/tc-avr.c:1297 +#: config/tc-avr.c:536 read.c:3345 +msgid "illegal expression" +msgstr "" + +#: config/tc-avr.c:562 config/tc-avr.c:1282 +msgid "`)' required" +msgstr "" + +#: config/tc-avr.c:638 +msgid "register r16-r23 required" +msgstr "" + +#: config/tc-avr.c:644 +msgid "register number above 15 required" +msgstr "" + +#: config/tc-avr.c:650 +msgid "even register number required" +msgstr "" + +#: config/tc-avr.c:656 +msgid "register r24, r26, r28 or r30 required" +msgstr "" + +#: config/tc-avr.c:662 +msgid "register name or number from 0 to 31 required" +msgstr "" + +#: config/tc-avr.c:680 +msgid "pointer register (X, Y or Z) required" +msgstr "" + +#: config/tc-avr.c:687 +msgid "cannot both predecrement and postincrement" +msgstr "" + +#: config/tc-avr.c:695 +msgid "addressing mode not supported" +msgstr "" + +#: config/tc-avr.c:701 +msgid "can't predecrement" +msgstr "" + +#: config/tc-avr.c:704 +msgid "pointer register Z required" +msgstr "" + +#: config/tc-avr.c:722 +msgid "pointer register (Y or Z) required" +msgstr "" + +#: config/tc-avr.c:826 +#, c-format +msgid "unknown constraint `%c'" +msgstr "" + +#: config/tc-avr.c:878 +msgid "`,' required" +msgstr "" + +#: config/tc-avr.c:896 +msgid "undefined combination of operands" +msgstr "" + +#: config/tc-avr.c:905 +msgid "skipping two-word instruction" +msgstr "" + +#: config/tc-avr.c:997 config/tc-avr.c:1013 config/tc-avr.c:1135 +#: config/tc-msp430.c:2012 config/tc-msp430.c:2030 +#, c-format +msgid "odd address operand: %ld" +msgstr "" + +#: config/tc-avr.c:1005 config/tc-avr.c:1024 config/tc-avr.c:1046 +#: config/tc-avr.c:1053 config/tc-avr.c:1060 config/tc-d10v.c:538 +#: config/tc-d30v.c:589 config/tc-msp430.c:2020 config/tc-msp430.c:2035 +#: config/tc-msp430.c:2045 +#, c-format +msgid "operand out of range: %ld" +msgstr "" + +#: config/tc-avr.c:1144 config/tc-d10v.c:1622 config/tc-d30v.c:2060 +#: config/tc-msp430.c:2063 +#, c-format +msgid "line %d: unknown relocation type: 0x%x" +msgstr "" + +#: config/tc-avr.c:1158 +msgid "only constant expression allowed" +msgstr "" + +#. xgettext:c-format. +#: config/tc-avr.c:1192 config/tc-bfin.c:689 config/tc-d10v.c:1494 +#: config/tc-d30v.c:1804 config/tc-mn10200.c:814 config/tc-mn10300.c:2308 +#: config/tc-msp430.c:2098 config/tc-or32.c:1019 config/tc-ppc.c:6064 +#: config/tc-v850.c:2190 +#, c-format +msgid "reloc %d not supported by object file format" +msgstr "" + +#: config/tc-avr.c:1215 config/tc-d10v.c:1782 config/tc-d10v.c:1796 +#: config/tc-h8300.c:1868 config/tc-mcore.c:884 config/tc-msp430.c:1862 +#: config/tc-pj.c:254 config/tc-sh.c:2457 config/tc-z8k.c:1194 +msgid "can't find opcode " +msgstr "" + +#: config/tc-avr.c:1232 +#, c-format +msgid "illegal opcode %s for mcu %s" +msgstr "" + +#: config/tc-avr.c:1241 +msgid "garbage at end of line" +msgstr "" + +#: config/tc-avr.c:1309 config/tc-avr.c:1316 #, c-format msgid "illegal %srelocation size: %d" msgstr "" -#: config/tc-cris.c:386 config/tc-m68hc11.c:2831 +#: config/tc-bfin.c:263 +#, c-format +msgid " BFIN specific command line options:\n" +msgstr "" + +#: config/tc-bfin.c:646 config/tc-fr30.c:358 config/tc-frv.c:1600 +#: config/tc-i960.c:1756 config/tc-ip2k.c:371 config/tc-m32c.c:912 +#: config/tc-m32r.c:2143 config/tc-openrisc.c:376 config/tc-xstormy16.c:631 +msgid "Bad call to md_atof()" +msgstr "" + +#: config/tc-cris.c:532 config/tc-m68hc11.c:2794 #, c-format msgid "internal inconsistency problem in %s: fr_symbol %lx" msgstr "" -#: config/tc-cris.c:390 config/tc-m68hc11.c:2835 +#: config/tc-cris.c:536 config/tc-m68hc11.c:2798 config/tc-msp430.c:2289 #, c-format msgid "internal inconsistency problem in %s: resolved symbol" msgstr "" -#: config/tc-cris.c:396 config/tc-m68hc11.c:2841 +#: config/tc-cris.c:546 config/tc-m68hc11.c:2804 #, c-format msgid "internal inconsistency problem in %s: fr_subtype %d" msgstr "" -#: config/tc-cris.c:650 +#: config/tc-cris.c:872 +msgid "Relaxation to long branches for .arch common_v10_v32 not implemented" +msgstr "" + +#: config/tc-cris.c:902 +msgid "Complicated LAPC target operand is not a multiple of two. Use LAPC.D" +msgstr "" + +#: config/tc-cris.c:907 +#, c-format +msgid "" +"Internal error found in md_convert_frag: offset %ld. Please report this." +msgstr "" + +#: config/tc-cris.c:932 #, c-format msgid "internal inconsistency in %s: bdapq no symbol" msgstr "" -#: config/tc-cris.c:663 +#: config/tc-cris.c:945 #, c-format msgid "internal inconsistency in %s: bdap.w with no symbol" msgstr "" -#: config/tc-cris.c:807 +#: config/tc-cris.c:969 +msgid "section alignment must be >= 4 bytes to check MULS/MULU safeness" +msgstr "" + +#: config/tc-cris.c:978 +msgid "dangerous MULS/MULU location; give it higher alignment" +msgstr "" + +#: config/tc-cris.c:1083 +msgid "" +"Out-of-range .word offset handling is not implemented for .arch " +"common_v10_v32" +msgstr "" + +#: config/tc-cris.c:1148 config/tc-crx.c:582 config/tc-crx.c:609 +#: config/tc-crx.c:627 msgid "Virtual memory exhausted" msgstr "" -#: config/tc-cris.c:815 +#: config/tc-cris.c:1182 config/tc-crx.c:592 #, c-format msgid "Can't hash `%s': %s\n" msgstr "" -#: config/tc-cris.c:816 +#: config/tc-cris.c:1183 config/tc-crx.c:593 msgid "(unknown reason)" msgstr "" -#: config/tc-cris.c:820 +#: config/tc-cris.c:1187 #, c-format msgid "Buggy opcode: `%s' \"%s\"\n" msgstr "" -#: config/tc-cris.c:1164 +#: config/tc-cris.c:1493 config/tc-cris.c:1501 config/tc-crx.c:2029 +#: config/tc-dlx.c:685 config/tc-hppa.c:1625 config/tc-i860.c:492 +#: config/tc-i860.c:509 config/tc-i860.c:989 config/tc-sparc.c:1417 +#: config/tc-sparc.c:1425 +#, c-format +msgid "Unknown opcode: `%s'" +msgstr "" + +#: config/tc-cris.c:1599 #, c-format msgid "Immediate value not in 5 bit unsigned range: %ld" msgstr "" -#: config/tc-cris.c:1180 +#: config/tc-cris.c:1615 #, c-format msgid "Immediate value not in 4 bit unsigned range: %ld" msgstr "" -#: config/tc-cris.c:1219 +#: config/tc-cris.c:1667 #, c-format msgid "Immediate value not in 6 bit range: %ld" msgstr "" -#: config/tc-cris.c:1234 +#: config/tc-cris.c:1682 #, c-format msgid "Immediate value not in 6 bit unsigned range: %ld" msgstr "" #. Others have a generic warning. -#: config/tc-cris.c:1324 +#: config/tc-cris.c:1790 #, c-format msgid "Unimplemented register `%s' specified" msgstr "" #. We've come to the end of instructions with this #. opcode, so it must be an error. -#: config/tc-cris.c:1483 +#: config/tc-cris.c:2033 msgid "Illegal operands" msgstr "" -#: config/tc-cris.c:1514 config/tc-cris.c:1545 +#: config/tc-cris.c:2074 config/tc-cris.c:2114 #, c-format msgid "Immediate value not in 8 bit range: %ld" msgstr "" -#: config/tc-cris.c:1524 config/tc-cris.c:1552 +#: config/tc-cris.c:2084 config/tc-cris.c:2135 #, c-format msgid "Immediate value not in 16 bit range: %ld" msgstr "" -#: config/tc-cris.c:1573 +#: config/tc-cris.c:2119 +#, c-format +msgid "Immediate value not in 8 bit signed range: %ld" +msgstr "" + +#: config/tc-cris.c:2124 +#, c-format +msgid "Immediate value not in 8 bit unsigned range: %ld" +msgstr "" + +#: config/tc-cris.c:2140 +#, c-format +msgid "Immediate value not in 16 bit signed range: %ld" +msgstr "" + +#: config/tc-cris.c:2145 +#, c-format +msgid "Immediate value not in 16 bit unsigned range: %ld" +msgstr "" + +#: config/tc-cris.c:2167 msgid "PIC relocation size does not match operand size" msgstr "" -#: config/tc-cris.c:2572 +#: config/tc-cris.c:3304 +msgid "Calling gen_cond_branch_32 for .arch common_v10_v32\n" +msgstr "" + +#: config/tc-cris.c:3308 msgid "32-bit conditional branch generated" msgstr "" -#: config/tc-cris.c:2626 +#: config/tc-cris.c:3367 msgid "Complex expression not supported" msgstr "" #. FIXME: Is this function mentioned in the internals.texi manual? If #. not, add it. -#: config/tc-cris.c:2747 +#: config/tc-cris.c:3490 msgid "Bad call to md_atof () - floating point formats are not supported" msgstr "" -#: config/tc-cris.c:2794 +#: config/tc-cris.c:3531 msgid "PC-relative relocation must be trivially resolved" msgstr "" -#: config/tc-cris.c:2837 +#: config/tc-cris.c:3584 #, c-format msgid "Value not in 16 bit range: %ld" msgstr "" -#: config/tc-cris.c:2848 +#: config/tc-cris.c:3595 +#, c-format +msgid "Value not in 16 bit signed range: %ld" +msgstr "" + +#: config/tc-cris.c:3606 #, c-format msgid "Value not in 8 bit range: %ld" msgstr "" -#: config/tc-cris.c:2855 +#: config/tc-cris.c:3614 +#, c-format +msgid "Value not in 8 bit signed range: %ld" +msgstr "" + +#: config/tc-cris.c:3625 #, c-format msgid "Value not in 4 bit unsigned range: %ld" msgstr "" -#: config/tc-cris.c:2862 +#: config/tc-cris.c:3633 #, c-format msgid "Value not in 5 bit unsigned range: %ld" msgstr "" -#: config/tc-cris.c:2869 +#: config/tc-cris.c:3641 #, c-format msgid "Value not in 6 bit range: %ld" msgstr "" -#: config/tc-cris.c:2876 +#: config/tc-cris.c:3649 #, c-format msgid "Value not in 6 bit unsigned range: %ld" msgstr "" -#: config/tc-cris.c:2924 +#: config/tc-cris.c:3695 +#, c-format msgid "Please use --help to see usage and options for this assembler.\n" msgstr "" -#: config/tc-cris.c:2936 +#: config/tc-cris.c:3707 msgid "--no-underscore is invalid with a.out format" msgstr "" -#: config/tc-cris.c:3012 +#: config/tc-cris.c:3727 +#, c-format +msgid "invalid in --march=: %s" +msgstr "" + +#: config/tc-cris.c:3821 msgid "" "Semantics error. This type of operand can not be relocated, it must be an " "assembly-time constant" msgstr "" -#: config/tc-cris.c:3064 +#: config/tc-cris.c:3870 #, c-format msgid "Cannot generate relocation type for symbol %s, code %s" msgstr "" #. The messages are formatted to line up with the generic options. -#: config/tc-cris.c:3078 +#: config/tc-cris.c:3883 +#, c-format msgid "CRIS-specific options:\n" msgstr "" -#: config/tc-cris.c:3080 +#: config/tc-cris.c:3885 msgid "" " -h, -H Don't execute, print this help text. Deprecated.\n" msgstr "" -#: config/tc-cris.c:3082 +#: config/tc-cris.c:3887 msgid " -N Warn when branches are expanded to jumps.\n" msgstr "" -#: config/tc-cris.c:3084 +#: config/tc-cris.c:3889 msgid "" " --underscore User symbols are normally prepended with " "underscore.\n" msgstr "" -#: config/tc-cris.c:3086 +#: config/tc-cris.c:3891 msgid " Registers will not need any prefix.\n" msgstr "" -#: config/tc-cris.c:3088 +#: config/tc-cris.c:3893 msgid " --no-underscore User symbols do not have any prefix.\n" msgstr "" -#: config/tc-cris.c:3090 +#: config/tc-cris.c:3895 msgid " Registers will require a `$'-prefix.\n" msgstr "" -#: config/tc-cris.c:3092 +#: config/tc-cris.c:3897 msgid " --pic\t\t\tEnable generation of position-independent code.\n" msgstr "" -#: config/tc-cris.c:3115 +#: config/tc-cris.c:3899 +msgid "" +" --march=\t\tGenerate code for . Valid choices for \n" +"\t\t\t\tare v0_v10, v10, v32 and common_v10_v32.\n" +msgstr "" + +#: config/tc-cris.c:3920 msgid "Invalid relocation" msgstr "" -#: config/tc-cris.c:3149 +#: config/tc-cris.c:3957 msgid "Invalid pc-relative relocation" msgstr "" -#: config/tc-cris.c:3198 +#: config/tc-cris.c:4002 #, c-format msgid "Adjusted signed .word (%ld) overflows: `switch'-statement too large." msgstr "" -#: config/tc-cris.c:3225 +#: config/tc-cris.c:4032 #, c-format msgid ".syntax %s requires command-line option `--underscore'" msgstr "" -#: config/tc-cris.c:3234 +#: config/tc-cris.c:4041 #, c-format msgid ".syntax %s requires command-line option `--no-underscore'" msgstr "" -#: config/tc-cris.c:3272 +#: config/tc-cris.c:4078 msgid "Unknown .syntax operand" msgstr "" -#: config/tc-cris.c:3283 +#: config/tc-cris.c:4088 msgid "Pseudodirective .file is only valid when generating ELF" msgstr "" -#: config/tc-cris.c:3296 +#: config/tc-cris.c:4100 msgid "Pseudodirective .loc is only valid when generating ELF" msgstr "" -#: config/tc-d10v.c:252 +#: config/tc-cris.c:4243 +msgid "unknown operand to .arch" +msgstr "" + +#: config/tc-cris.c:4252 +msgid ".arch requires a matching --march=... option" +msgstr "" + +#: config/tc-crx.c:344 config/tc-mn10200.c:801 write.c:2209 +#, c-format +msgid "can't resolve `%s' {%s section} - `%s' {%s section}" +msgstr "" + +#: config/tc-crx.c:360 +#, c-format +msgid "internal error: reloc %d (`%s') not supported by object file format" +msgstr "" + +#: config/tc-crx.c:619 config/tc-crx.c:637 config/tc-i386.c:953 +#: config/tc-i386.c:976 config/tc-m68k.c:4149 +#, c-format +msgid "Internal Error: Can't hash %s: %s" +msgstr "" + +#. Missing or bad expr becomes absolute 0. +#: config/tc-crx.c:665 config/tc-i386.c:4259 +#, c-format +msgid "missing or invalid displacement expression `%s' taken as 0" +msgstr "" + +#: config/tc-crx.c:803 config/tc-crx.c:823 config/tc-crx.c:838 +#, c-format +msgid "Illegal register `%s' in Instruction `%s'" +msgstr "" + +#: config/tc-crx.c:866 +#, c-format +msgid "Illegal Scale - `%d'" +msgstr "" + +#: config/tc-crx.c:982 +#, c-format +msgid "Illegal operands (whitespace): `%s'" +msgstr "" + +#: config/tc-crx.c:994 config/tc-crx.c:1001 config/tc-crx.c:1018 +#: config/tc-crx.c:1804 +#, c-format +msgid "Missing matching brackets : `%s'" +msgstr "" + +#: config/tc-crx.c:1044 +#, c-format +msgid "Unknown exception: `%s'" +msgstr "" + +#: config/tc-crx.c:1140 +#, c-format +msgid "Illegal `cinv' parameter: `%c'" +msgstr "" + +#: config/tc-crx.c:1173 +#, c-format +msgid "Unknown register: `%d'" +msgstr "" + +#. Issue a error message when register is illegal. +#: config/tc-crx.c:1181 +#, c-format +msgid "Illegal register (`%s') in Instruction: `%s'" +msgstr "" + +#: config/tc-crx.c:1310 +#, c-format +msgid "Illegal Co-processor register in Instruction `%s' " +msgstr "" + +#: config/tc-crx.c:1317 +#, c-format +msgid "Illegal Co-processor special register in Instruction `%s' " +msgstr "" + +#: config/tc-crx.c:1616 +msgid "Incorrect number of operands" +msgstr "" + +#: config/tc-crx.c:1618 +#, c-format +msgid "Illegal type of operand (arg %d)" +msgstr "" + +#: config/tc-crx.c:1624 +#, c-format +msgid "Operand out of range (arg %d)" +msgstr "" + +#: config/tc-crx.c:1627 +#, c-format +msgid "Operand has odd displacement (arg %d)" +msgstr "" + +#: config/tc-crx.c:1630 +#, c-format +msgid "Invalid DISPU4 operand value (arg %d)" +msgstr "" + +#: config/tc-crx.c:1633 +#, c-format +msgid "Invalid CST4 operand value (arg %d)" +msgstr "" + +#: config/tc-crx.c:1636 +#, c-format +msgid "Operand value is not within upper 64 KB (arg %d)" +msgstr "" + +#: config/tc-crx.c:1640 config/tc-crx.c:1671 +#, c-format +msgid "Illegal operand (arg %d)" +msgstr "" + +#: config/tc-crx.c:1702 config/tc-crx.c:1719 +#, c-format +msgid "Same src/dest register is used (`r%d'), result is undefined" +msgstr "" + +#: config/tc-crx.c:1711 +#, c-format +msgid "`%s' has undefined result" +msgstr "" + +#: config/tc-crx.c:1773 +msgid "Invalid Register in Register List" +msgstr "" + +#: config/tc-crx.c:1827 +#, c-format +msgid "Illegal register `%s' in cop-register list" +msgstr "" + +#: config/tc-crx.c:1835 +#, c-format +msgid "Illegal register `%s' in cop-special-register list" +msgstr "" + +#: config/tc-crx.c:1854 +#, c-format +msgid "Illegal register `%s' in user register list" +msgstr "" + +#: config/tc-crx.c:1873 +#, c-format +msgid "Illegal register `%s' in register list" +msgstr "" + +#: config/tc-crx.c:1879 +#, c-format +msgid "Maximum %d bits may be set in `mask16' operand" +msgstr "" + +#: config/tc-crx.c:1888 +#, c-format +msgid "rest of line ignored; first ignored character is `%c'" +msgstr "" + +#: config/tc-crx.c:1896 +#, c-format +msgid "Illegal `mask16' operand, operation is undefined - `%s'" +msgstr "" + +#. HI can't be specified without LO (and vise-versa). +#: config/tc-crx.c:1902 +msgid "HI/LO registers should be specified together" +msgstr "" + +#: config/tc-crx.c:1908 +msgid "HI/LO registers should be specified without additional registers" +msgstr "" + +#. Give an error if a frag containing code is not aligned to a 2-byte +#. boundary. +#: config/tc-crx.c:1993 config/tc-crx.h:76 +msgid "instruction address is not a multiple of 2" +msgstr "" + +#: config/tc-d10v.c:217 +#, c-format msgid "" "D10V options:\n" "-O Optimize. Will do some operations in parallel.\n" @@ -3067,140 +3381,141 @@ msgid "" " instructions together.\n" msgstr "" -#: config/tc-d10v.c:543 config/tc-d30v.c:549 config/tc-mn10200.c:937 -#: config/tc-mn10300.c:1812 config/tc-ppc.c:2332 config/tc-s390.c:1234 -#: config/tc-tic80.c:275 config/tc-v850.c:2021 +#: config/tc-d10v.c:496 config/tc-d30v.c:488 config/tc-mn10200.c:1075 +#: config/tc-mn10300.c:1817 config/tc-ppc.c:2380 config/tc-s390.c:1218 +#: config/tc-v850.c:1949 msgid "illegal operand" msgstr "" -#: config/tc-d10v.c:657 +#: config/tc-d10v.c:608 msgid "operand is not an immediate" msgstr "" -#: config/tc-d10v.c:675 +#: config/tc-d10v.c:626 #, c-format msgid "operand out of range: %lu" msgstr "" -#: config/tc-d10v.c:736 +#: config/tc-d10v.c:684 msgid "Instruction must be executed in parallel with another instruction." msgstr "" -#: config/tc-d10v.c:792 +#: config/tc-d10v.c:738 config/tc-d10v.c:746 +#, c-format +msgid "packing conflict: %s must dispatch sequentially" +msgstr "" + +#: config/tc-d10v.c:845 +#, c-format +msgid "resource conflict (R%d)" +msgstr "" + +#: config/tc-d10v.c:848 +#, c-format +msgid "resource conflict (A%d)" +msgstr "" + +#: config/tc-d10v.c:850 +msgid "resource conflict (PSW)" +msgstr "" + +#: config/tc-d10v.c:852 +msgid "resource conflict (C flag)" +msgstr "" + +#: config/tc-d10v.c:854 +msgid "resource conflict (F flag)" +msgstr "" + +#: config/tc-d10v.c:1004 msgid "Instruction must be executed in parallel" msgstr "" -#: config/tc-d10v.c:795 +#: config/tc-d10v.c:1007 msgid "Long instructions may not be combined." msgstr "" -#: config/tc-d10v.c:828 +#: config/tc-d10v.c:1040 msgid "One of these instructions may not be executed in parallel." msgstr "" -#: config/tc-d10v.c:832 config/tc-d30v.c:876 +#: config/tc-d10v.c:1044 config/tc-d30v.c:1071 msgid "Two IU instructions may not be executed in parallel" msgstr "" -#: config/tc-d10v.c:834 config/tc-d10v.c:842 config/tc-d10v.c:856 -#: config/tc-d10v.c:871 config/tc-d30v.c:877 config/tc-d30v.c:886 +#: config/tc-d10v.c:1046 config/tc-d10v.c:1054 config/tc-d10v.c:1068 +#: config/tc-d10v.c:1083 config/tc-d30v.c:1072 config/tc-d30v.c:1081 msgid "Swapping instruction order" msgstr "" -#: config/tc-d10v.c:840 config/tc-d30v.c:883 +#: config/tc-d10v.c:1052 config/tc-d30v.c:1078 msgid "Two MU instructions may not be executed in parallel" msgstr "" -#: config/tc-d10v.c:860 config/tc-d30v.c:903 +#: config/tc-d10v.c:1072 config/tc-d30v.c:1098 msgid "IU instruction may not be in the left container" msgstr "" -#: config/tc-d10v.c:862 config/tc-d10v.c:877 +#: config/tc-d10v.c:1074 config/tc-d10v.c:1089 msgid "" "Instruction in R container is squashed by flow control instruction in L " "container." msgstr "" -#: config/tc-d10v.c:875 config/tc-d30v.c:914 +#: config/tc-d10v.c:1087 config/tc-d30v.c:1109 msgid "MU instruction may not be in the right container" msgstr "" -#: config/tc-d10v.c:881 config/tc-d30v.c:926 +#: config/tc-d10v.c:1093 config/tc-d30v.c:1121 msgid "unknown execution type passed to write_2_short()" msgstr "" -#: config/tc-d10v.c:1072 config/tc-d10v.c:1080 -#, c-format -msgid "packing conflict: %s must dispatch sequentially" -msgstr "" - -#: config/tc-d10v.c:1179 -#, c-format -msgid "resource conflict (R%d)" -msgstr "" - -#: config/tc-d10v.c:1182 -#, c-format -msgid "resource conflict (A%d)" -msgstr "" - -#: config/tc-d10v.c:1184 -msgid "resource conflict (PSW)" -msgstr "" - -#: config/tc-d10v.c:1186 -msgid "resource conflict (C flag)" -msgstr "" - -#: config/tc-d10v.c:1188 -msgid "resource conflict (F flag)" -msgstr "" - -#: config/tc-d10v.c:1276 config/tc-d10v.c:1298 config/tc-d30v.c:1410 -msgid "Unable to mix instructions as specified" -msgstr "" - -#: config/tc-d10v.c:1345 config/tc-d30v.c:1547 -#, c-format -msgid "unknown opcode: %s" -msgstr "" - -#: config/tc-d10v.c:1428 config/tc-d10v.c:1603 config/tc-tic80.c:532 +#: config/tc-d10v.c:1221 config/tc-d10v.c:1394 msgid "bad opcode or operands" msgstr "" -#: config/tc-d10v.c:1503 config/tc-m68k.c:4305 +#: config/tc-d10v.c:1296 config/tc-m68k.c:4625 msgid "value out of range" msgstr "" -#: config/tc-d10v.c:1579 +#: config/tc-d10v.c:1370 msgid "illegal operand - register name found where none expected" msgstr "" -#: config/tc-d10v.c:1614 config/tc-tic80.c:543 +#: config/tc-d10v.c:1405 msgid "Register number must be EVEN" msgstr "" -#: config/tc-d10v.c:1617 +#: config/tc-d10v.c:1408 msgid "Unsupported use of sp" msgstr "" -#: config/tc-d10v.c:1636 +#: config/tc-d10v.c:1427 #, c-format msgid "cr%ld is a reserved control register" msgstr "" -#: config/tc-d10v.c:1773 +#: config/tc-d10v.c:1466 config/tc-d30v.c:1430 +#, c-format +msgid "unknown opcode: %s" +msgstr "" + +#: config/tc-d10v.c:1602 #, c-format msgid "line %d: rep or repi must include at least 4 instructions" msgstr "" -#: config/tc-d30v.c:192 +#: config/tc-d10v.c:1810 config/tc-d10v.c:1832 config/tc-d30v.c:1777 +msgid "Unable to mix instructions as specified" +msgstr "" + +#: config/tc-d30v.c:150 #, c-format msgid "Register name %s conflicts with symbol of the same name" msgstr "" -#: config/tc-d30v.c:287 +#: config/tc-d30v.c:240 +#, c-format msgid "" "\n" "D30V options:\n" @@ -3213,1097 +3528,1134 @@ msgid "" "-C Opposite of -C. -c is the default.\n" msgstr "" -#: config/tc-d30v.c:461 +#: config/tc-d30v.c:402 msgid "unexpected 12-bit reloc type" msgstr "" -#: config/tc-d30v.c:468 +#: config/tc-d30v.c:409 msgid "unexpected 18-bit reloc type" msgstr "" -#: config/tc-d30v.c:719 +#: config/tc-d30v.c:659 #, c-format msgid "%s NOP inserted" msgstr "" -#: config/tc-d30v.c:720 +#: config/tc-d30v.c:660 msgid "sequential" msgstr "" -#: config/tc-d30v.c:720 +#: config/tc-d30v.c:660 msgid "parallel" msgstr "" -#: config/tc-d30v.c:872 +#: config/tc-d30v.c:1067 msgid "Instructions may not be executed in parallel" msgstr "" -#: config/tc-d30v.c:885 +#: config/tc-d30v.c:1080 #, c-format msgid "Executing %s in IU may not work" msgstr "" -#: config/tc-d30v.c:892 +#: config/tc-d30v.c:1087 #, c-format msgid "Executing %s in IU may not work in parallel execution" msgstr "" -#: config/tc-d30v.c:905 +#: config/tc-d30v.c:1100 #, c-format msgid "special left instruction `%s' kills instruction `%s' in right container" msgstr "" -#: config/tc-d30v.c:916 +#: config/tc-d30v.c:1111 #, c-format msgid "Executing %s in reverse serial with %s may not work" msgstr "" -#: config/tc-d30v.c:919 +#: config/tc-d30v.c:1114 #, c-format msgid "Executing %s in IU in reverse serial may not work" msgstr "" -#: config/tc-d30v.c:1289 config/tc-d30v.c:1306 -msgid "Cannot assemble instruction" +#: config/tc-d30v.c:1303 +msgid "Odd numbered register used as target of multi-register instruction" msgstr "" -#: config/tc-d30v.c:1291 -msgid "First opcode is long. Unable to mix instructions as specified." -msgstr "" - -#: config/tc-d30v.c:1360 -msgid "word of NOPs added between word multiply and load" -msgstr "" - -#: config/tc-d30v.c:1362 -msgid "word of NOPs added between word multiply and 16-bit multiply" -msgstr "" - -#: config/tc-d30v.c:1394 -msgid "Instruction uses long version, so it cannot be mixed as specified" -msgstr "" - -#: config/tc-d30v.c:1477 config/tc-d30v.c:1515 +#: config/tc-d30v.c:1367 config/tc-d30v.c:1402 #, c-format msgid "unknown condition code: %s" msgstr "" -#: config/tc-d30v.c:1508 +#: config/tc-d30v.c:1395 #, c-format msgid "cmpu doesn't support condition code %s" msgstr "" -#: config/tc-d30v.c:1558 +#: config/tc-d30v.c:1441 #, c-format msgid "operands for opcode `%s' do not match any valid format" msgstr "" -#: config/tc-d30v.c:1776 -msgid "Odd numbered register used as target of multi-register instruction" +#: config/tc-d30v.c:1656 config/tc-d30v.c:1673 +msgid "Cannot assemble instruction" msgstr "" -#: config/tc-d30v.c:1862 -#, c-format -msgid "line %d: unable to place address of symbol '%s' into a byte" +#: config/tc-d30v.c:1658 +msgid "First opcode is long. Unable to mix instructions as specified." msgstr "" -#: config/tc-d30v.c:1865 -#, c-format -msgid "line %d: unable to place value %lx into a byte" +#: config/tc-d30v.c:1727 +msgid "word of NOPs added between word multiply and load" msgstr "" -#: config/tc-d30v.c:1873 -#, c-format -msgid "line %d: unable to place address of symbol '%s' into a short" +#: config/tc-d30v.c:1729 +msgid "word of NOPs added between word multiply and 16-bit multiply" msgstr "" -#: config/tc-d30v.c:1876 -#, c-format -msgid "line %d: unable to place value %lx into a short" +#: config/tc-d30v.c:1761 +msgid "Instruction uses long version, so it cannot be mixed as specified" msgstr "" -#: config/tc-d30v.c:1884 -#, c-format -msgid "line %d: unable to place address of symbol '%s' into a quad" -msgstr "" - -#: config/tc-d30v.c:2053 +#: config/tc-d30v.c:1888 #, c-format msgid "value too large to fit in %d bits" msgstr "" -#: config/tc-d30v.c:2196 +#: config/tc-d30v.c:1949 +#, c-format +msgid "line %d: unable to place address of symbol '%s' into a byte" +msgstr "" + +#: config/tc-d30v.c:1952 +#, c-format +msgid "line %d: unable to place value %lx into a byte" +msgstr "" + +#: config/tc-d30v.c:1960 +#, c-format +msgid "line %d: unable to place address of symbol '%s' into a short" +msgstr "" + +#: config/tc-d30v.c:1963 +#, c-format +msgid "line %d: unable to place value %lx into a short" +msgstr "" + +#: config/tc-d30v.c:1971 +#, c-format +msgid "line %d: unable to place address of symbol '%s' into a quad" +msgstr "" + +#: config/tc-d30v.c:2079 #, c-format msgid "Alignment too large: %d assumed" msgstr "" -#: config/tc-dlx.c:283 +#: config/tc-dlx.c:211 msgid "missing .proc" msgstr "" -#: config/tc-dlx.c:300 +#: config/tc-dlx.c:228 msgid ".endfunc missing for previous .proc" msgstr "" -#: config/tc-dlx.c:498 -#, c-format -msgid "Expression Error for operand modifier %%hi/%%lo\n" +#. Probably a memory allocation problem? Give up now. +#: config/tc-dlx.c:297 config/tc-hppa.c:1489 config/tc-mips.c:1415 +#: config/tc-mips.c:1467 config/tc-or32.c:210 config/tc-sparc.c:855 +msgid "Broken assembler. No assembly attempted." msgstr "" -#: config/tc-dlx.c:552 +#: config/tc-dlx.c:327 #, c-format msgid "Bad operand for a load instruction: <%s>" msgstr "" -#: config/tc-dlx.c:667 +#: config/tc-dlx.c:441 #, c-format msgid "Bad operand for a store instruction: <%s>" msgstr "" -#: config/tc-dlx.c:865 +#: config/tc-dlx.c:621 +#, c-format +msgid "Expression Error for operand modifier %%hi/%%lo\n" +msgstr "" + +#: config/tc-dlx.c:634 config/tc-or32.c:873 +#, c-format +msgid "Invalid expression after %%%%\n" +msgstr "" + +#: config/tc-dlx.c:703 +#, c-format +msgid "Unknown opcode `%s'." +msgstr "" + +#: config/tc-dlx.c:716 msgid "Can not set dlx_skip_hi16_flag" msgstr "" -#: config/tc-dlx.c:879 +#: config/tc-dlx.c:730 #, c-format msgid "Missing arguments for opcode <%s>." msgstr "" -#: config/tc-dlx.c:950 +#: config/tc-dlx.c:764 +#, c-format +msgid "Too many operands: %s" +msgstr "" + +#: config/tc-dlx.c:801 #, c-format msgid "Both the_insn.HI and the_insn.LO are set : %s" msgstr "" -#: config/tc-dlx.c:1022 +#: config/tc-dlx.c:871 msgid "failed regnum sanity check." msgstr "" -#: config/tc-dlx.c:1035 +#: config/tc-dlx.c:884 msgid "failed general register sanity check." msgstr "" -#: config/tc-dlx.c:1324 +#: config/tc-dlx.c:1175 config/tc-or32.c:835 +#, c-format +msgid "label \"$%d\" redefined" +msgstr "" + +#: config/tc-dlx.c:1213 msgid "Invalid expression after # number\n" msgstr "" -#: config/tc-fr30.c:85 +#: config/tc-fr30.c:83 +#, c-format msgid " FR30 specific command line options:\n" msgstr "" -#: config/tc-fr30.c:139 config/tc-openrisc.c:152 +#: config/tc-fr30.c:136 #, c-format msgid "Instruction %s not allowed in a delay slot." msgstr "" -#: config/tc-fr30.c:383 config/tc-m32r.c:1576 -msgid "Addend to unresolved symbol not on word boundary." -msgstr "" - -#: config/tc-fr30.c:524 config/tc-frv.c:1289 config/tc-i960.c:798 -#: config/tc-ip2k.c:351 config/tc-m32r.c:1884 config/tc-openrisc.c:452 -#: config/tc-xstormy16.c:636 -msgid "Bad call to md_atof()" -msgstr "" - -#: config/tc-frv.c:413 +#: config/tc-frv.c:461 +#, c-format msgid "FRV specific command line options:\n" msgstr "" -#: config/tc-frv.c:414 +#: config/tc-frv.c:462 +#, c-format msgid "-G n Data >= n bytes is in small data area\n" msgstr "" -#: config/tc-frv.c:415 +#: config/tc-frv.c:463 +#, c-format msgid "-mgpr-32 Note 32 gprs are used\n" msgstr "" -#: config/tc-frv.c:416 +#: config/tc-frv.c:464 +#, c-format msgid "-mgpr-64 Note 64 gprs are used\n" msgstr "" -#: config/tc-frv.c:417 +#: config/tc-frv.c:465 +#, c-format msgid "-mfpr-32 Note 32 fprs are used\n" msgstr "" -#: config/tc-frv.c:418 +#: config/tc-frv.c:466 +#, c-format msgid "-mfpr-64 Note 64 fprs are used\n" msgstr "" -#: config/tc-frv.c:419 +#: config/tc-frv.c:467 +#, c-format msgid "-msoft-float Note software fp is used\n" msgstr "" -#: config/tc-frv.c:420 +#: config/tc-frv.c:468 +#, c-format msgid "-mdword Note stack is aligned to a 8 byte boundary\n" msgstr "" -#: config/tc-frv.c:421 +#: config/tc-frv.c:469 +#, c-format msgid "-mno-dword Note stack is aligned to a 4 byte boundary\n" msgstr "" -#: config/tc-frv.c:422 +#: config/tc-frv.c:470 +#, c-format msgid "-mdouble Note fp double insns are used\n" msgstr "" -#: config/tc-frv.c:423 +#: config/tc-frv.c:471 +#, c-format msgid "-mmedia Note media insns are used\n" msgstr "" -#: config/tc-frv.c:424 +#: config/tc-frv.c:472 +#, c-format msgid "-mmuladd Note multiply add/subtract insns are used\n" msgstr "" -#: config/tc-frv.c:425 +#: config/tc-frv.c:473 +#, c-format msgid "-mpack Note instructions are packed\n" msgstr "" -#: config/tc-frv.c:426 +#: config/tc-frv.c:474 +#, c-format msgid "-mno-pack Do not allow instructions to be packed\n" msgstr "" -#: config/tc-frv.c:427 +#: config/tc-frv.c:475 +#, c-format msgid "-mpic Note small position independent code\n" msgstr "" -#: config/tc-frv.c:428 +#: config/tc-frv.c:476 +#, c-format msgid "-mPIC Note large position independent code\n" msgstr "" -#: config/tc-frv.c:429 +#: config/tc-frv.c:477 +#, c-format msgid "-mlibrary-pic Compile library for large position indepedent code\n" msgstr "" -#: config/tc-frv.c:430 -msgid "-mcpu={fr500|fr400|fr300|frv|simple|tomcat}\n" +#: config/tc-frv.c:478 +#, c-format +msgid "-mfdpic Assemble for the FDPIC ABI\n" msgstr "" -#: config/tc-frv.c:431 +#: config/tc-frv.c:479 +#, c-format +msgid "-mnopic Disable -mpic, -mPIC, -mlibrary-pic and -mfdpic\n" +msgstr "" + +#: config/tc-frv.c:480 +#, c-format +msgid "-mcpu={fr500|fr550|fr400|fr405|fr450|fr300|frv|simple|tomcat}\n" +msgstr "" + +#: config/tc-frv.c:481 +#, c-format msgid " Record the cpu type\n" msgstr "" -#: config/tc-frv.c:432 +#: config/tc-frv.c:482 +#, c-format msgid "-mtomcat-stats Print out stats for tomcat workarounds\n" msgstr "" -#: config/tc-frv.c:433 +#: config/tc-frv.c:483 +#, c-format msgid "-mtomcat-debug Debug tomcat workarounds\n" msgstr "" -#: config/tc-frv.c:1012 +#: config/tc-frv.c:1187 msgid "VLIW packing used for -mno-pack" msgstr "" -#: config/tc-frv.c:1025 +#: config/tc-frv.c:1197 +msgid "Instruction not supported by this architecture" +msgstr "" + +#: config/tc-frv.c:1207 msgid "VLIW packing constraint violation" msgstr "" -#: config/tc-frv.c:1540 +#: config/tc-frv.c:1874 #, c-format msgid "Relocation %s is not safe for %s" msgstr "" -#: config/tc-h8300.c:84 config/tc-h8300.c:96 config/tc-h8300.c:109 -#: config/tc-h8300.c:122 config/tc-h8300.c:135 config/tc-h8300.c:149 -#: config/tc-h8300.c:222 config/tc-hppa.c:1423 config/tc-hppa.c:6909 -#: config/tc-hppa.c:6915 config/tc-hppa.c:6921 config/tc-hppa.c:6927 -#: config/tc-mn10300.c:1218 config/tc-mn10300.c:1223 config/tc-mn10300.c:2722 +#: config/tc-h8300.c:78 config/tc-h8300.c:87 config/tc-h8300.c:97 +#: config/tc-h8300.c:107 config/tc-h8300.c:117 config/tc-h8300.c:128 +#: config/tc-h8300.c:195 config/tc-hppa.c:1449 config/tc-hppa.c:6926 +#: config/tc-hppa.c:6932 config/tc-hppa.c:6938 config/tc-hppa.c:6944 +#: config/tc-mn10300.c:1223 config/tc-mn10300.c:1228 config/tc-mn10300.c:2725 msgid "could not set architecture and machine" msgstr "" -#: config/tc-h8300.c:436 config/tc-h8300.c:444 +#: config/tc-h8300.c:397 config/tc-h8300.c:405 msgid "Reg not valid for H8/300" msgstr "" -#: config/tc-h8300.c:529 +#: config/tc-h8300.c:486 msgid "invalid operand size requested" msgstr "" -#: config/tc-h8300.c:626 config/tc-h8300.c:629 +#: config/tc-h8300.c:585 msgid "Invalid register list for ldm/stm\n" msgstr "" -#: config/tc-h8300.c:632 -msgid "Invalid register list for ldm/stm)\n" -msgstr "" - -#: config/tc-h8300.c:658 config/tc-h8300.c:663 config/tc-h8300.c:670 +#: config/tc-h8300.c:611 config/tc-h8300.c:616 config/tc-h8300.c:623 msgid "mismatch between register and suffix" msgstr "" -#: config/tc-h8300.c:697 +#: config/tc-h8300.c:650 msgid "address too high for vector table jmp/jsr" msgstr "" -#: config/tc-h8300.c:722 config/tc-h8300.c:832 config/tc-h8300.c:840 +#: config/tc-h8300.c:677 config/tc-h8300.c:789 config/tc-h8300.c:799 msgid "Wrong size pointer register for architecture." msgstr "" -#: config/tc-h8300.c:781 config/tc-h8300.c:789 config/tc-h8300.c:818 +#: config/tc-h8300.c:736 config/tc-h8300.c:744 config/tc-h8300.c:773 msgid "expected @(exp, reg16)" msgstr "" -#: config/tc-h8300.c:807 +#: config/tc-h8300.c:762 msgid "expected .L, .W or .B for register in indexed addressing mode" msgstr "" -#: config/tc-h8300.c:1000 +#: config/tc-h8300.c:956 msgid "expected valid addressing mode for mova: \"@(disp, ea.sz),ERn\"" msgstr "" -#: config/tc-h8300.c:1018 config/tc-h8300.c:1027 +#: config/tc-h8300.c:974 config/tc-h8300.c:983 msgid "expected register" msgstr "" -#: config/tc-h8300.c:1043 +#: config/tc-h8300.c:999 msgid "expected closing paren" msgstr "" -#: config/tc-h8300.c:1104 +#: config/tc-h8300.c:1058 #, c-format msgid "can't use high part of register in operand %d" msgstr "" -#: config/tc-h8300.c:1268 +#: config/tc-h8300.c:1215 #, c-format msgid "Opcode `%s' with these operand types not available in %s mode" msgstr "" -#: config/tc-h8300.c:1277 +#: config/tc-h8300.c:1224 msgid "mismatch between opcode size and operand size" msgstr "" -#: config/tc-h8300.c:1316 +#: config/tc-h8300.c:1260 #, c-format msgid "operand %s0x%lx out of range." msgstr "" -#: config/tc-h8300.c:1415 +#: config/tc-h8300.c:1356 msgid "Can't work out size of operand.\n" msgstr "" -#: config/tc-h8300.c:1466 +#: config/tc-h8300.c:1405 #, c-format msgid "Opcode `%s' with these operand types not available in H8/300 mode" msgstr "" -#: config/tc-h8300.c:1471 +#: config/tc-h8300.c:1410 #, c-format msgid "Opcode `%s' with these operand types not available in H8/300H mode" msgstr "" -#: config/tc-h8300.c:1477 +#: config/tc-h8300.c:1416 #, c-format msgid "Opcode `%s' with these operand types not available in H8/300S mode" msgstr "" -#: config/tc-h8300.c:1538 config/tc-h8300.c:1558 +#: config/tc-h8300.c:1477 config/tc-h8300.c:1497 msgid "Need #1 or #2 here" msgstr "" -#: config/tc-h8300.c:1553 +#: config/tc-h8300.c:1492 msgid "#4 not valid on H8/300." msgstr "" -#: config/tc-h8300.c:1645 config/tc-h8300.c:1727 +#: config/tc-h8300.c:1598 config/tc-h8300.c:1680 #, c-format msgid "branch operand has odd offset (%lx)\n" msgstr "" -#: config/tc-h8300.c:1766 +#: config/tc-h8300.c:1718 msgid "destination operand must be 16 bit register" msgstr "" -#: config/tc-h8300.c:1775 +#: config/tc-h8300.c:1727 msgid "source operand must be 8 bit register" msgstr "" -#: config/tc-h8300.c:1783 +#: config/tc-h8300.c:1735 msgid "destination operand must be 16bit absolute address" msgstr "" -#: config/tc-h8300.c:1790 +#: config/tc-h8300.c:1742 msgid "destination operand must be 8 bit register" msgstr "" -#: config/tc-h8300.c:1798 +#: config/tc-h8300.c:1750 msgid "source operand must be 16bit absolute address" msgstr "" #. This seems more sane than saying "too many operands". We'll #. get here only if the trailing trash starts with a comma. -#: config/tc-h8300.c:1806 config/tc-mmix.c:454 config/tc-mmix.c:466 -#: config/tc-mmix.c:2502 config/tc-mmix.c:2526 config/tc-mmix.c:2802 -#: config/tc-or32.c:640 config/tc-or32.c:854 +#. Types or values of args don't match. +#: config/tc-h8300.c:1758 config/tc-mmix.c:473 config/tc-mmix.c:485 +#: config/tc-mmix.c:2526 config/tc-mmix.c:2550 config/tc-mmix.c:2823 +#: config/tc-or32.c:527 msgid "invalid operands" msgstr "" -#: config/tc-h8300.c:1839 +#: config/tc-h8300.c:1789 msgid "operand/size mis-match" msgstr "" -#: config/tc-h8300.c:1926 config/tc-h8500.c:1112 config/tc-mips.c:9302 -#: config/tc-sh.c:2363 config/tc-sh64.c:2837 config/tc-w65.c:691 -#: config/tc-z8k.c:1248 +#: config/tc-h8300.c:1885 config/tc-mips.c:9358 config/tc-sh64.c:2795 +#: config/tc-sh.c:2838 config/tc-z8k.c:1204 msgid "unknown opcode" msgstr "" -#: config/tc-h8300.c:2031 config/tc-h8500.c:1139 config/tc-sh.c:2483 -#: config/tc-z8k.c:1304 -msgid "call to tc_crawl_symbol_chain \n" +#: config/tc-h8300.c:1918 +msgid "invalid operand in ldm" msgstr "" -#: config/tc-h8300.c:2047 config/tc-h8500.c:1153 config/tc-sh.c:2490 -#: config/tc-z8k.c:1320 -msgid "call to tc_headers_hook \n" +#: config/tc-h8300.c:1927 +msgid "invalid operand in stm" msgstr "" -#: config/tc-h8300.c:2140 +#: config/tc-h8300.c:2093 +#, c-format msgid "call to tc_aout_fix_to_chars \n" msgstr "" -#: config/tc-h8300.c:2154 +#: config/tc-h8300.c:2102 +#, c-format msgid "call to md_convert_frag \n" msgstr "" -#: config/tc-h8300.c:2216 +#: config/tc-h8300.c:2146 +#, c-format msgid "call tomd_estimate_size_before_relax \n" msgstr "" -#: config/tc-h8300.c:2337 config/tc-mcore.c:2355 config/tc-pj.c:581 -#: config/tc-sh.c:3956 +#: config/tc-h8300.c:2197 config/tc-mcore.c:2282 config/tc-pj.c:538 +#: config/tc-sh.c:4270 #, c-format msgid "Cannot represent relocation type %s" msgstr "" -#: config/tc-h8500.c:325 -msgid ":24 not valid for this opcode" -msgstr "" - -#: config/tc-h8500.c:332 -msgid "expect :8,:16 or :24" -msgstr "" - -#: config/tc-h8500.c:391 -msgid "syntax error in reg list" -msgstr "" - -#: config/tc-h8500.c:409 -msgid "missing final register in range" -msgstr "" - -#: config/tc-h8500.c:498 config/tc-h8500.c:505 config/tc-h8500.c:511 -msgid "expected @(exp, Rn)" -msgstr "" - -#: config/tc-h8500.c:527 -msgid "@Rn+ needs word register" -msgstr "" - -#: config/tc-h8500.c:537 -msgid "@Rn needs word register" -msgstr "" - -#: config/tc-h8500.c:838 config/tc-sh.c:1827 -#, c-format -msgid "unhandled %d\n" -msgstr "" - -#: config/tc-h8500.c:868 -#, c-format -msgid "operand must be absolute in range %d..%d" -msgstr "" - -#: config/tc-h8500.c:963 config/tc-sh.c:2036 -#, c-format -msgid "failed for %d\n" -msgstr "" - -#: config/tc-h8500.c:1128 config/tc-sh.c:2138 config/tc-sh.c:2412 -#: config/tc-w65.c:710 -msgid "invalid operands for opcode" -msgstr "" - -#. Simple range checking for FIELD againt HIGH and LOW bounds. +#. Simple range checking for FIELD against HIGH and LOW bounds. #. IGNORE is used to suppress the error message. -#: config/tc-hppa.c:1156 config/tc-hppa.c:1170 +#. Variant of CHECK_FIELD for use in md_apply_fix and other places where +#. the current file and line number are not valid. +#: config/tc-hppa.c:1176 config/tc-hppa.c:1190 #, c-format msgid "Field out of range [%d..%d] (%d)." msgstr "" -#. Simple alignment checking for FIELD againt ALIGN (a power of two). +#. Simple alignment checking for FIELD against ALIGN (a power of two). #. IGNORE is used to suppress the error message. -#: config/tc-hppa.c:1184 +#: config/tc-hppa.c:1204 #, c-format msgid "Field not properly aligned [%d] (%d)." msgstr "" -#: config/tc-hppa.c:1213 +#: config/tc-hppa.c:1233 msgid "Missing .exit\n" msgstr "" -#: config/tc-hppa.c:1216 +#: config/tc-hppa.c:1236 msgid "Missing .procend\n" msgstr "" -#: config/tc-hppa.c:1396 +#: config/tc-hppa.c:1422 #, c-format msgid "Invalid field selector. Assuming F%%." msgstr "" -#: config/tc-hppa.c:1429 +#: config/tc-hppa.c:1455 msgid "-R option not supported on this target." msgstr "" -#: config/tc-hppa.c:1445 config/tc-sparc.c:809 config/tc-sparc.c:845 +#: config/tc-hppa.c:1471 config/tc-sparc.c:811 config/tc-sparc.c:847 #, c-format msgid "Internal error: can't hash `%s': %s\n" msgstr "" -#: config/tc-hppa.c:1453 config/tc-i860.c:201 +#: config/tc-hppa.c:1479 config/tc-i860.c:238 #, c-format msgid "internal error: losing opcode: `%s' \"%s\"\n" msgstr "" -#: config/tc-hppa.c:1524 config/tc-hppa.c:7048 config/tc-hppa.c:7105 +#: config/tc-hppa.c:1550 config/tc-hppa.c:7065 config/tc-hppa.c:7122 msgid "Missing function name for .PROC (corrupted label chain)" msgstr "" -#: config/tc-hppa.c:1527 config/tc-hppa.c:7108 +#: config/tc-hppa.c:1553 config/tc-hppa.c:7125 msgid "Missing function name for .PROC" msgstr "" -#: config/tc-hppa.c:1634 config/tc-hppa.c:4905 -msgid "could not update architecture and machine" -msgstr "" - -#: config/tc-hppa.c:1842 +#: config/tc-hppa.c:1857 msgid "Invalid Indexed Load Completer." msgstr "" -#: config/tc-hppa.c:1847 +#: config/tc-hppa.c:1862 msgid "Invalid Indexed Load Completer Syntax." msgstr "" -#: config/tc-hppa.c:1884 +#: config/tc-hppa.c:1896 msgid "Invalid Short Load/Store Completer." msgstr "" -#: config/tc-hppa.c:1944 config/tc-hppa.c:1949 +#: config/tc-hppa.c:1956 config/tc-hppa.c:1961 msgid "Invalid Store Bytes Short Completer" msgstr "" -#: config/tc-hppa.c:2260 config/tc-hppa.c:2266 +#: config/tc-hppa.c:2272 config/tc-hppa.c:2278 msgid "Invalid left/right combination completer" msgstr "" -#: config/tc-hppa.c:2315 config/tc-hppa.c:2322 +#: config/tc-hppa.c:2327 config/tc-hppa.c:2334 msgid "Invalid permutation completer" msgstr "" -#: config/tc-hppa.c:2423 +#: config/tc-hppa.c:2434 #, c-format msgid "Invalid Add Condition: %s" msgstr "" -#: config/tc-hppa.c:2434 config/tc-hppa.c:2444 +#: config/tc-hppa.c:2445 config/tc-hppa.c:2455 msgid "Invalid Add and Branch Condition" msgstr "" -#: config/tc-hppa.c:2465 config/tc-hppa.c:2603 +#: config/tc-hppa.c:2476 config/tc-hppa.c:2613 msgid "Invalid Compare/Subtract Condition" msgstr "" -#: config/tc-hppa.c:2505 +#: config/tc-hppa.c:2516 #, c-format msgid "Invalid Bit Branch Condition: %c" msgstr "" -#: config/tc-hppa.c:2591 +#: config/tc-hppa.c:2601 #, c-format msgid "Invalid Compare/Subtract Condition: %s" msgstr "" -#: config/tc-hppa.c:2618 +#: config/tc-hppa.c:2628 msgid "Invalid Compare and Branch Condition" msgstr "" -#: config/tc-hppa.c:2714 +#: config/tc-hppa.c:2724 msgid "Invalid Logical Instruction Condition." msgstr "" -#: config/tc-hppa.c:2769 +#: config/tc-hppa.c:2779 msgid "Invalid Shift/Extract/Deposit Condition." msgstr "" -#: config/tc-hppa.c:2881 +#: config/tc-hppa.c:2891 msgid "Invalid Unit Instruction Condition." msgstr "" -#: config/tc-hppa.c:3258 config/tc-hppa.c:3290 config/tc-hppa.c:3321 -#: config/tc-hppa.c:3351 +#: config/tc-hppa.c:3270 config/tc-hppa.c:3302 config/tc-hppa.c:3333 +#: config/tc-hppa.c:3363 msgid "Branch to unaligned address" msgstr "" -#: config/tc-hppa.c:3529 +#: config/tc-hppa.c:3541 msgid "Invalid SFU identifier" msgstr "" -#: config/tc-hppa.c:3579 +#: config/tc-hppa.c:3591 msgid "Invalid COPR identifier" msgstr "" -#: config/tc-hppa.c:3708 +#: config/tc-hppa.c:3720 msgid "Invalid Floating Point Operand Format." msgstr "" -#: config/tc-hppa.c:3825 config/tc-hppa.c:3845 config/tc-hppa.c:3865 -#: config/tc-hppa.c:3885 config/tc-hppa.c:3905 +#: config/tc-hppa.c:3837 config/tc-hppa.c:3857 config/tc-hppa.c:3877 +#: config/tc-hppa.c:3897 config/tc-hppa.c:3917 msgid "Invalid register for single precision fmpyadd or fmpysub" msgstr "" -#: config/tc-hppa.c:3962 +#: config/tc-hppa.c:3968 config/tc-hppa.c:4928 +msgid "could not update architecture and machine" +msgstr "" + +#: config/tc-hppa.c:3985 #, c-format msgid "Invalid operands %s" msgstr "" -#: config/tc-hppa.c:4080 +#: config/tc-hppa.c:4103 msgid "Cannot handle fixup" msgstr "" -#: config/tc-hppa.c:4381 +#: config/tc-hppa.c:4404 +#, c-format msgid " -Q ignored\n" msgstr "" -#: config/tc-hppa.c:4385 +#: config/tc-hppa.c:4408 +#, c-format msgid " -c print a warning if a comment is found\n" msgstr "" -#: config/tc-hppa.c:4456 +#: config/tc-hppa.c:4479 #, c-format msgid "no hppa_fixup entry for fixup type 0x%x" msgstr "" -#: config/tc-hppa.c:4627 +#: config/tc-hppa.c:4650 msgid "Unknown relocation encountered in md_apply_fix." msgstr "" -#: config/tc-hppa.c:4769 config/tc-hppa.c:4794 +#: config/tc-hppa.c:4792 config/tc-hppa.c:4817 #, c-format msgid "Undefined register: '%s'." msgstr "" -#: config/tc-hppa.c:4828 +#: config/tc-hppa.c:4851 #, c-format msgid "Non-absolute symbol: '%s'." msgstr "" -#: config/tc-hppa.c:4843 +#: config/tc-hppa.c:4866 #, c-format msgid "Undefined absolute constant: '%s'." msgstr "" -#: config/tc-hppa.c:4944 +#: config/tc-hppa.c:4967 #, c-format msgid "Invalid FP Compare Condition: %s" msgstr "" -#: config/tc-hppa.c:5000 +#: config/tc-hppa.c:5023 #, c-format msgid "Invalid FTEST completer: %s" msgstr "" -#: config/tc-hppa.c:5067 config/tc-hppa.c:5105 +#: config/tc-hppa.c:5090 config/tc-hppa.c:5128 #, c-format msgid "Invalid FP Operand Format: %3s" msgstr "" -#: config/tc-hppa.c:5184 +#: config/tc-hppa.c:5207 msgid "Bad segment in expression." msgstr "" -#: config/tc-hppa.c:5243 +#: config/tc-hppa.c:5266 msgid "Bad segment (should be absolute)." msgstr "" -#: config/tc-hppa.c:5286 +#: config/tc-hppa.c:5309 #, c-format msgid "Invalid argument location: %s\n" msgstr "" -#: config/tc-hppa.c:5317 +#: config/tc-hppa.c:5340 #, c-format msgid "Invalid argument description: %d" msgstr "" -#: config/tc-hppa.c:5340 +#: config/tc-hppa.c:5363 #, c-format msgid "Invalid Nullification: (%c)" msgstr "" -#: config/tc-hppa.c:6060 +#: config/tc-hppa.c:5960 +msgid "Argument to .BLOCK/.BLOCKZ must be between 0 and 0x3fffffff" +msgstr "" + +#: config/tc-hppa.c:6076 #, c-format msgid "Invalid .CALL argument: %s" msgstr "" -#: config/tc-hppa.c:6182 +#: config/tc-hppa.c:6198 msgid ".callinfo is not within a procedure definition" msgstr "" -#: config/tc-hppa.c:6202 +#: config/tc-hppa.c:6218 #, c-format msgid "FRAME parameter must be a multiple of 8: %d\n" msgstr "" -#: config/tc-hppa.c:6221 +#: config/tc-hppa.c:6237 msgid "Value for ENTRY_GR must be in the range 3..18\n" msgstr "" -#: config/tc-hppa.c:6233 +#: config/tc-hppa.c:6249 msgid "Value for ENTRY_FR must be in the range 12..21\n" msgstr "" -#: config/tc-hppa.c:6243 +#: config/tc-hppa.c:6259 msgid "Value for ENTRY_SR must be 3\n" msgstr "" -#: config/tc-hppa.c:6299 +#: config/tc-hppa.c:6315 #, c-format msgid "Invalid .CALLINFO argument: %s" msgstr "" -#: config/tc-hppa.c:6410 +#: config/tc-hppa.c:6427 msgid "The .ENTER pseudo-op is not supported" msgstr "" -#: config/tc-hppa.c:6426 +#: config/tc-hppa.c:6443 msgid "Misplaced .entry. Ignored." msgstr "" -#: config/tc-hppa.c:6430 +#: config/tc-hppa.c:6447 msgid "Missing .callinfo." msgstr "" -#: config/tc-hppa.c:6496 +#: config/tc-hppa.c:6513 msgid ".REG expression must be a register" msgstr "" -#: config/tc-hppa.c:6512 +#: config/tc-hppa.c:6529 msgid "bad or irreducible absolute expression; zero assumed" msgstr "" -#: config/tc-hppa.c:6523 +#: config/tc-hppa.c:6540 msgid ".REG must use a label" msgstr "" -#: config/tc-hppa.c:6525 +#: config/tc-hppa.c:6542 msgid ".EQU must use a label" msgstr "" -#: config/tc-hppa.c:6578 +#: config/tc-hppa.c:6595 msgid ".EXIT must appear within a procedure" msgstr "" -#: config/tc-hppa.c:6582 +#: config/tc-hppa.c:6599 msgid "Missing .callinfo" msgstr "" -#: config/tc-hppa.c:6586 +#: config/tc-hppa.c:6603 msgid "No .ENTRY for this .EXIT" msgstr "" -#: config/tc-hppa.c:6613 +#: config/tc-hppa.c:6630 #, c-format msgid "Cannot define export symbol: %s\n" msgstr "" -#: config/tc-hppa.c:6671 +#: config/tc-hppa.c:6688 #, c-format msgid "Using ENTRY rather than CODE in export directive for %s" msgstr "" -#: config/tc-hppa.c:6788 +#: config/tc-hppa.c:6805 #, c-format msgid "Undefined .EXPORT/.IMPORT argument (ignored): %s" msgstr "" -#: config/tc-hppa.c:6870 +#: config/tc-hppa.c:6887 msgid "Missing label name on .LABEL" msgstr "" -#: config/tc-hppa.c:6875 +#: config/tc-hppa.c:6892 msgid "extra .LABEL arguments ignored." msgstr "" -#: config/tc-hppa.c:6892 +#: config/tc-hppa.c:6909 msgid "The .LEAVE pseudo-op is not supported" msgstr "" -#: config/tc-hppa.c:6931 +#: config/tc-hppa.c:6948 msgid "Unrecognized .LEVEL argument\n" msgstr "" -#: config/tc-hppa.c:6967 +#: config/tc-hppa.c:6984 #, c-format msgid "Cannot define static symbol: %s\n" msgstr "" -#: config/tc-hppa.c:7002 +#: config/tc-hppa.c:7019 msgid "Nested procedures" msgstr "" -#: config/tc-hppa.c:7012 +#: config/tc-hppa.c:7029 msgid "Cannot allocate unwind descriptor\n" msgstr "" -#: config/tc-hppa.c:7112 +#: config/tc-hppa.c:7129 msgid "misplaced .procend" msgstr "" -#: config/tc-hppa.c:7115 +#: config/tc-hppa.c:7132 msgid "Missing .callinfo for this procedure" msgstr "" -#: config/tc-hppa.c:7118 +#: config/tc-hppa.c:7135 msgid "Missing .EXIT for a .ENTRY" msgstr "" -#: config/tc-hppa.c:7156 +#: config/tc-hppa.c:7173 msgid "Not in a space.\n" msgstr "" -#: config/tc-hppa.c:7159 +#: config/tc-hppa.c:7176 msgid "Not in a subspace.\n" msgstr "" -#: config/tc-hppa.c:7250 +#: config/tc-hppa.c:7267 msgid "Invalid .SPACE argument" msgstr "" -#: config/tc-hppa.c:7297 +#: config/tc-hppa.c:7314 msgid "Can't change spaces within a procedure definition. Ignored" msgstr "" -#: config/tc-hppa.c:7426 +#: config/tc-hppa.c:7443 #, c-format msgid "Undefined space: '%s' Assuming space number = 0." msgstr "" -#: config/tc-hppa.c:7450 +#: config/tc-hppa.c:7467 msgid "Must be in a space before changing or declaring subspaces.\n" msgstr "" -#: config/tc-hppa.c:7454 +#: config/tc-hppa.c:7471 msgid "Can't change subspaces within a procedure definition. Ignored" msgstr "" -#: config/tc-hppa.c:7489 +#: config/tc-hppa.c:7507 msgid "Parameters of an existing subspace can't be modified" msgstr "" -#: config/tc-hppa.c:7540 +#: config/tc-hppa.c:7559 msgid "Alignment must be a power of 2" msgstr "" -#: config/tc-hppa.c:7582 +#: config/tc-hppa.c:7606 msgid "FIRST not supported as a .SUBSPACE argument" msgstr "" -#: config/tc-hppa.c:7584 +#: config/tc-hppa.c:7608 msgid "Invalid .SUBSPACE argument" msgstr "" -#: config/tc-hppa.c:7764 +#: config/tc-hppa.c:7797 #, c-format msgid "Internal error: Unable to find containing space for %s." msgstr "" -#: config/tc-hppa.c:7803 +#: config/tc-hppa.c:7837 #, c-format msgid "Out of memory: could not allocate new space chain entry: %s\n" msgstr "" -#: config/tc-hppa.c:7889 +#: config/tc-hppa.c:7926 #, c-format msgid "Out of memory: could not allocate new subspace chain entry: %s\n" msgstr "" -#: config/tc-hppa.c:8622 +#: config/tc-hppa.c:8662 #, c-format msgid "Symbol '%s' could not be created." msgstr "" -#: config/tc-hppa.c:8626 +#: config/tc-hppa.c:8666 msgid "No memory for symbol name." msgstr "" -#: config/tc-i386.c:689 +#: config/tc-i386.c:721 #, c-format msgid "%s shortened to %s" msgstr "" -#: config/tc-i386.c:745 +#: config/tc-i386.c:777 msgid "same type of prefix used twice" msgstr "" -#: config/tc-i386.c:763 +#: config/tc-i386.c:795 msgid "64bit mode not supported on this CPU." msgstr "" -#: config/tc-i386.c:767 +#: config/tc-i386.c:799 msgid "32bit mode not supported on this CPU." msgstr "" -#: config/tc-i386.c:800 +#: config/tc-i386.c:832 msgid "bad argument to syntax directive." msgstr "" -#: config/tc-i386.c:844 +#: config/tc-i386.c:884 #, c-format msgid "no such architecture: `%s'" msgstr "" -#: config/tc-i386.c:849 +#: config/tc-i386.c:889 msgid "missing cpu architecture" msgstr "" -#: config/tc-i386.c:863 +#: config/tc-i386.c:903 #, c-format msgid "no such architecture modifier: `%s'" msgstr "" -#: config/tc-i386.c:880 config/tc-i386.c:5022 +#: config/tc-i386.c:919 config/tc-i386.c:5342 msgid "Unknown architecture" msgstr "" -#: config/tc-i386.c:915 config/tc-i386.c:938 config/tc-m68k.c:3816 +#: config/tc-i386.c:1247 #, c-format -msgid "Internal Error: Can't hash %s: %s" +msgid "unknown relocation (%u)" msgstr "" -#: config/tc-i386.c:1192 -msgid "There are no unsigned pc-relative relocations" -msgstr "" - -#: config/tc-i386.c:1199 config/tc-i386.c:5234 +#: config/tc-i386.c:1249 #, c-format -msgid "can not do %d byte pc-relative relocation" +msgid "%u-byte relocation cannot be applied to %u-byte field" msgstr "" -#: config/tc-i386.c:1216 +#: config/tc-i386.c:1253 +msgid "non-pc-relative relocation for pc-relative field" +msgstr "" + +#: config/tc-i386.c:1258 +msgid "relocated field and relocation type differ in signedness" +msgstr "" + +#: config/tc-i386.c:1267 +msgid "there are no unsigned pc-relative relocations" +msgstr "" + +#: config/tc-i386.c:1275 #, c-format -msgid "can not do %s %d byte relocation" +msgid "cannot do %u byte pc-relative relocation" msgstr "" -#: config/tc-i386.c:1428 +#: config/tc-i386.c:1292 +#, c-format +msgid "cannot do %s %u byte relocation" +msgstr "" + +#: config/tc-i386.c:1496 config/tc-i386.c:2527 +#, c-format +msgid "ambiguous operand size for `%s'" +msgstr "" + +#: config/tc-i386.c:1544 #, c-format msgid "can't use register '%%%s' as operand %d in '%s'." msgstr "" #. UnixWare fsub no args is alias for fsubp, fadd -> faddp, etc. -#: config/tc-i386.c:1457 +#: config/tc-i386.c:1573 #, c-format msgid "translating to `%sp'" msgstr "" -#: config/tc-i386.c:1502 +#: config/tc-i386.c:1618 #, c-format -msgid "can't encode register '%%%s' in an instruction requiring REX prefix.\n" +msgid "can't encode register '%%%s' in an instruction requiring REX prefix." msgstr "" -#: config/tc-i386.c:1541 config/tc-i386.c:1636 +#: config/tc-i386.c:1659 config/tc-i386.c:1767 #, c-format msgid "no such instruction: `%s'" msgstr "" -#: config/tc-i386.c:1551 config/tc-i386.c:1668 +#: config/tc-i386.c:1670 config/tc-i386.c:1799 #, c-format msgid "invalid character %s in mnemonic" msgstr "" -#: config/tc-i386.c:1558 +#: config/tc-i386.c:1677 msgid "expecting prefix; got nothing" msgstr "" -#: config/tc-i386.c:1560 +#: config/tc-i386.c:1679 msgid "expecting mnemonic; got nothing" msgstr "" -#: config/tc-i386.c:1579 +#: config/tc-i386.c:1695 config/tc-i386.c:1818 +#, c-format +msgid "`%s' is only supported in 64-bit mode" +msgstr "" + +#: config/tc-i386.c:1696 config/tc-i386.c:1817 +#, c-format +msgid "`%s' is not supported in 64-bit mode" +msgstr "" + +#: config/tc-i386.c:1707 #, c-format msgid "redundant %s prefix" msgstr "" -#: config/tc-i386.c:1677 +#: config/tc-i386.c:1824 #, c-format -msgid "`%s' is not supported on `%s'" +msgid "`%s' is not supported on `%s%s'" msgstr "" -#: config/tc-i386.c:1682 +#: config/tc-i386.c:1831 msgid "use .code16 to ensure correct addressing mode" msgstr "" -#: config/tc-i386.c:1689 +#: config/tc-i386.c:1844 #, c-format msgid "expecting string instruction after `%s'" msgstr "" -#: config/tc-i386.c:1717 +#: config/tc-i386.c:1878 #, c-format msgid "invalid character %s before operand %d" msgstr "" -#: config/tc-i386.c:1731 +#: config/tc-i386.c:1892 #, c-format msgid "unbalanced parenthesis in operand %d." msgstr "" -#: config/tc-i386.c:1734 +#: config/tc-i386.c:1895 #, c-format msgid "unbalanced brackets in operand %d." msgstr "" -#: config/tc-i386.c:1743 +#: config/tc-i386.c:1904 #, c-format msgid "invalid character %s in operand %d" msgstr "" -#: config/tc-i386.c:1770 +#: config/tc-i386.c:1931 #, c-format msgid "spurious operands; (%d operands/instruction max)" msgstr "" -#: config/tc-i386.c:1793 +#: config/tc-i386.c:1954 msgid "expecting operand after ','; got nothing" msgstr "" -#: config/tc-i386.c:1798 +#: config/tc-i386.c:1959 msgid "expecting operand before ','; got nothing" msgstr "" #. We found no match. -#: config/tc-i386.c:2140 +#: config/tc-i386.c:2336 #, c-format msgid "suffix or operands invalid for `%s'" msgstr "" -#: config/tc-i386.c:2151 +#: config/tc-i386.c:2347 #, c-format msgid "indirect %s without `*'" msgstr "" #. Warn them that a data or address size prefix doesn't #. affect assembly of the next line of code. -#: config/tc-i386.c:2159 +#: config/tc-i386.c:2355 #, c-format msgid "stand-alone `%s' prefix" msgstr "" -#: config/tc-i386.c:2188 config/tc-i386.c:2203 +#: config/tc-i386.c:2384 config/tc-i386.c:2399 #, c-format msgid "`%s' operand %d must use `%%es' segment" msgstr "" -#: config/tc-i386.c:2283 +#: config/tc-i386.c:2509 msgid "" "no instruction mnemonic suffix given and no register operands; can't size " "instruction" @@ -4311,192 +4663,182 @@ msgstr "" #. Prohibit these changes in the 64bit mode, since the #. lowering is more complicated. -#: config/tc-i386.c:2367 config/tc-i386.c:2426 config/tc-i386.c:2443 -#: config/tc-i386.c:2475 config/tc-i386.c:2508 +#: config/tc-i386.c:2610 config/tc-i386.c:2669 config/tc-i386.c:2686 +#: config/tc-i386.c:2718 config/tc-i386.c:2751 #, c-format msgid "Incorrect register `%%%s' used with `%c' suffix" msgstr "" -#: config/tc-i386.c:2375 config/tc-i386.c:2433 config/tc-i386.c:2515 +#: config/tc-i386.c:2618 config/tc-i386.c:2676 config/tc-i386.c:2758 #, c-format msgid "using `%%%s' instead of `%%%s' due to `%c' suffix" msgstr "" -#: config/tc-i386.c:2390 config/tc-i386.c:2411 config/tc-i386.c:2462 -#: config/tc-i386.c:2493 +#: config/tc-i386.c:2633 config/tc-i386.c:2654 config/tc-i386.c:2705 +#: config/tc-i386.c:2736 #, c-format msgid "`%%%s' not allowed with `%s%c'" msgstr "" -#: config/tc-i386.c:2556 +#: config/tc-i386.c:2799 msgid "no instruction mnemonic suffix given; can't determine immediate size" msgstr "" -#: config/tc-i386.c:2589 +#: config/tc-i386.c:2832 #, c-format msgid "" "no instruction mnemonic suffix given; can't determine immediate size %x %c" msgstr "" #. Reversed arguments on faddp, fsubp, etc. -#: config/tc-i386.c:2638 +#: config/tc-i386.c:2881 #, c-format msgid "translating to `%s %%%s,%%%s'" msgstr "" #. Extraneous `l' suffix on fp insn. -#: config/tc-i386.c:2645 +#: config/tc-i386.c:2888 #, c-format msgid "translating to `%s %%%s'" msgstr "" -#: config/tc-i386.c:2663 +#: config/tc-i386.c:2906 #, c-format msgid "you can't `pop %%cs'" msgstr "" -#. lea -#: config/tc-i386.c:2682 -msgid "segment override on `lea' is ineffectual" +#: config/tc-i386.c:2927 +#, c-format +msgid "segment override on `%s' is ineffectual" msgstr "" -#: config/tc-i386.c:2991 config/tc-i386.c:3085 config/tc-i386.c:3130 +#: config/tc-i386.c:3236 config/tc-i386.c:3330 config/tc-i386.c:3375 msgid "skipping prefixes on this instruction" msgstr "" -#: config/tc-i386.c:3150 +#: config/tc-i386.c:3395 msgid "16-bit jump out of range" msgstr "" -#: config/tc-i386.c:3159 +#: config/tc-i386.c:3404 #, c-format msgid "can't handle non absolute segment in `%s'" msgstr "" -#: config/tc-i386.c:3601 +#: config/tc-i386.c:3897 #, c-format -msgid "@%s reloc is not supported in %s bit mode" +msgid "@%s reloc is not supported with %d-bit output format" msgstr "" -#: config/tc-i386.c:3677 +#: config/tc-i386.c:3986 msgid "only 1 or 2 immediate operands are allowed" msgstr "" -#: config/tc-i386.c:3700 config/tc-i386.c:3892 +#: config/tc-i386.c:4007 config/tc-i386.c:4218 #, c-format msgid "junk `%s' after expression" msgstr "" #. Missing or bad expr becomes absolute 0. -#: config/tc-i386.c:3711 +#: config/tc-i386.c:4016 #, c-format msgid "missing or invalid immediate expression `%s' taken as 0" msgstr "" -#: config/tc-i386.c:3743 config/tc-i386.c:3958 +#: config/tc-i386.c:4041 config/tc-i386.c:4277 #, c-format msgid "unimplemented segment %s in operand" msgstr "" -#: config/tc-i386.c:3745 config/tc-i386.c:3960 -#, c-format -msgid "unimplemented segment type %d in operand" -msgstr "" - -#: config/tc-i386.c:3789 config/tc-i386.c:6011 +#: config/tc-i386.c:4088 #, c-format msgid "expecting scale factor of 1, 2, 4, or 8: got `%s'" msgstr "" -#: config/tc-i386.c:3796 +#: config/tc-i386.c:4097 #, c-format msgid "scale factor of %d without an index register" msgstr "" -#: config/tc-i386.c:3912 +#: config/tc-i386.c:4236 #, c-format msgid "bad expression used with @%s" msgstr "" -#. Missing or bad expr becomes absolute 0. -#: config/tc-i386.c:3934 -#, c-format -msgid "missing or invalid displacement expression `%s' taken as 0" -msgstr "" - -#: config/tc-i386.c:4058 +#: config/tc-i386.c:4386 #, c-format msgid "`%s' is not a valid base/index expression" msgstr "" -#: config/tc-i386.c:4062 +#: config/tc-i386.c:4390 #, c-format msgid "`%s' is not a valid %s bit base/index expression" msgstr "" -#: config/tc-i386.c:4137 +#: config/tc-i386.c:4464 #, c-format msgid "bad memory operand `%s'" msgstr "" -#: config/tc-i386.c:4152 +#: config/tc-i386.c:4479 #, c-format msgid "junk `%s' after register" msgstr "" -#: config/tc-i386.c:4161 config/tc-i386.c:4276 config/tc-i386.c:4314 +#: config/tc-i386.c:4488 config/tc-i386.c:4603 config/tc-i386.c:4641 #, c-format msgid "bad register name `%s'" msgstr "" -#: config/tc-i386.c:4169 +#: config/tc-i386.c:4496 msgid "immediate operand illegal with absolute jump" msgstr "" -#: config/tc-i386.c:4191 +#: config/tc-i386.c:4518 #, c-format msgid "too many memory references for `%s'" msgstr "" -#: config/tc-i386.c:4269 +#: config/tc-i386.c:4596 #, c-format msgid "expecting `,' or `)' after index register in `%s'" msgstr "" -#: config/tc-i386.c:4293 +#: config/tc-i386.c:4620 #, c-format msgid "expecting `)' after scale factor in `%s'" msgstr "" -#: config/tc-i386.c:4300 +#: config/tc-i386.c:4627 #, c-format msgid "expecting index register or scale factor after `,'; got '%c'" msgstr "" -#: config/tc-i386.c:4307 +#: config/tc-i386.c:4634 #, c-format msgid "expecting `,' or `)' after base register in `%s'" msgstr "" #. It's not a memory operand; argh! -#: config/tc-i386.c:4348 +#: config/tc-i386.c:4675 #, c-format msgid "invalid char %s beginning operand %d `%s'" msgstr "" -#: config/tc-i386.c:4531 +#: config/tc-i386.c:4850 msgid "long jump required" msgstr "" -#: config/tc-i386.c:4805 +#: config/tc-i386.c:5127 msgid "Bad call to md_atof ()" msgstr "" -#: config/tc-i386.c:4973 +#: config/tc-i386.c:5294 msgid "No compiled in support for x86_64" msgstr "" -#: config/tc-i386.c:4994 +#: config/tc-i386.c:5315 +#, c-format msgid "" " -Q ignored\n" " -V print assembler version number\n" @@ -4506,205 +4848,344 @@ msgid "" " -s ignored\n" msgstr "" -#: config/tc-i386.c:5002 +#: config/tc-i386.c:5323 +#, c-format msgid "" " -n Do not optimize code alignment\n" " -q quieten some warnings\n" msgstr "" -#: config/tc-i386.c:5104 config/tc-s390.c:1841 +#: config/tc-i386.c:5425 config/tc-s390.c:1861 msgid "GOT already in symbol table" msgstr "" -#: config/tc-i386.c:5249 +#: config/tc-i386.c:5568 +#, c-format +msgid "can not do %d byte pc-relative relocation" +msgstr "" + +#: config/tc-i386.c:5586 #, c-format msgid "can not do %d byte relocation" msgstr "" -#: config/tc-i386.c:5317 config/tc-s390.c:2285 +#: config/tc-i386.c:5657 config/tc-s390.c:2307 #, c-format msgid "cannot represent relocation type %s" msgstr "" -#: config/tc-i386.c:5613 +#: config/tc-i386.c:5912 +#, c-format +msgid "invalid operand for '%s' ('%s' unexpected)" +msgstr "" + +#: config/tc-i386.c:5924 #, c-format msgid "too many memory references for '%s'" msgstr "" -#: config/tc-i386.c:5776 +#. See the comments in intel_bracket_expr. +#: config/tc-i386.c:5935 #, c-format -msgid "Unknown operand modifier `%s'\n" +msgid "Treating `%s' as memory reference" msgstr "" -#: config/tc-i386.c:5983 +#: config/tc-i386.c:6247 +#, c-format +msgid "Unknown operand modifier `%s'" +msgstr "" + +#: config/tc-i386.c:6262 +msgid "Conflicting operand modifiers" +msgstr "" + +#: config/tc-i386.c:6311 +msgid "Invalid operand to `OFFSET'" +msgstr "" + +#: config/tc-i386.c:6384 +#, c-format +msgid "`[%.*s]' taken to mean just `%.*s'" +msgstr "" + +#: config/tc-i386.c:6474 #, c-format msgid "`%s' is not a valid segment register" msgstr "" -#: config/tc-i386.c:5993 config/tc-i386.c:6114 -msgid "Register scaling only allowed in memory operands." +#: config/tc-i386.c:6478 +msgid "Extra segment override ignored" msgstr "" -#: config/tc-i386.c:6024 -msgid "Too many register references in memory operand.\n" +#: config/tc-i386.c:6512 config/tc-i386.c:6681 +msgid "Register scaling only allowed in memory operands" msgstr "" -#: config/tc-i386.c:6093 +#: config/tc-i386.c:6534 config/tc-i386.c:6658 #, c-format -msgid "Syntax error. Expecting a constant. Got `%s'.\n" +msgid "Syntax error: Expecting a constant, got `%s'" msgstr "" -#: config/tc-i386.c:6163 +#: config/tc-i386.c:6562 +msgid "Too many register references in memory operand" +msgstr "" + +#: config/tc-i386.c:6573 +msgid "Using register names in OFFSET expressions is deprecated" +msgstr "" + +#: config/tc-i386.c:6586 +msgid "Invalid use of register" +msgstr "" + +#: config/tc-i386.c:6731 #, c-format msgid "Unrecognized token '%s'" msgstr "" -#: config/tc-i386.c:6180 +#: config/tc-i386.c:6748 #, c-format -msgid "Unexpected token `%s'\n" +msgid "Unexpected token `%s'" msgstr "" -#: config/tc-i386.c:6324 -#, c-format -msgid "Unrecognized token `%s'\n" +#: config/tc-i386.c:6910 +msgid "`:' expected" msgstr "" -#: config/tc-i860.c:165 config/tc-i860.c:169 +#: config/tc-i386.c:6935 +#, c-format +msgid "Unrecognized token `%s'" +msgstr "" + +#: config/tc-i386.c:7070 +msgid "Bad .section directive: want a,l,w,x,M,S,G,T in string" +msgstr "" + +#: config/tc-i386.c:7073 +msgid "Bad .section directive: want a,w,x,M,S,G,T in string" +msgstr "" + +#: config/tc-i386.c:7092 +msgid ".largecomm supported only in 64bit mode, producing .comm" +msgstr "" + +#: config/tc-i860.c:124 +msgid "Directive .dual available only with -mintel-syntax option" +msgstr "" + +#: config/tc-i860.c:134 +msgid "Directive .enddual available only with -mintel-syntax option" +msgstr "" + +#: config/tc-i860.c:147 +msgid "Directive .atmp available only with -mintel-syntax option" +msgstr "" + +#: config/tc-i860.c:169 config/tc-i860.c:173 msgid "Unknown temporary pseudo register" msgstr "" -#: config/tc-i860.c:192 config/tc-mips.c:1105 +#: config/tc-i860.c:229 config/tc-mips.c:1412 #, c-format msgid "internal error: can't hash `%s': %s\n" msgstr "" -#: config/tc-i860.c:212 +#: config/tc-i860.c:249 msgid "Defective assembler. No assembly attempted." msgstr "" -#: config/tc-i860.c:362 +#: config/tc-i860.c:395 config/tc-i860.c:940 config/tc-m68k.c:3443 +#: config/tc-m68k.c:3475 config/tc-sparc.c:2657 +msgid "failed sanity check." +msgstr "" + +#: config/tc-i860.c:402 #, c-format msgid "Expanded opcode after delayed branch: `%s'" msgstr "" -#: config/tc-i860.c:366 +#: config/tc-i860.c:406 #, c-format msgid "Expanded opcode in dual mode: `%s'" msgstr "" -#: config/tc-i860.c:370 +#: config/tc-i860.c:410 #, c-format msgid "An instruction was expanded (%s)" msgstr "" -#: config/tc-i860.c:643 +#: config/tc-i860.c:676 msgid "Pipelined instruction: fsrc1 = fdest" msgstr "" -#: config/tc-i860.c:844 config/tc-i860.c:851 config/tc-i860.c:858 +#: config/tc-i860.c:879 config/tc-i860.c:886 config/tc-i860.c:893 msgid "Assembler does not yet support PIC" msgstr "" -#: config/tc-i860.c:919 +#: config/tc-i860.c:957 #, c-format msgid "Illegal operands for %s" msgstr "" -#: config/tc-i860.c:947 config/tc-sparc.c:2834 -msgid "bad segment" +#: config/tc-i860.c:974 +#, c-format +msgid "'d.%s' must be 8-byte aligned" msgstr "" -#: config/tc-i860.c:1037 +#: config/tc-i860.c:982 +#, c-format +msgid "Prefix 'd.' invalid for instruction `%s'" +msgstr "" + +#: config/tc-i860.c:1088 msgid "i860_estimate_size_before_relax\n" msgstr "" -#: config/tc-i860.c:1134 +#: config/tc-i860.c:1187 +#, c-format msgid "" " -EL\t\t\t generate code for little endian mode (default)\n" " -EB\t\t\t generate code for big endian mode\n" " -mwarn-expand\t\t warn if pseudo operations are expanded\n" " -mxp\t\t\t enable i860XP support (disabled by default)\n" +" -mintel-syntax\t enable Intel syntax (default to AT&T/SVR4)\n" msgstr "" #. SVR4 compatibility flags. -#: config/tc-i860.c:1141 +#: config/tc-i860.c:1195 +#, c-format msgid "" " -V\t\t\t print assembler version number\n" " -Qy, -Qn\t\t ignored\n" msgstr "" -#: config/tc-i860.c:1210 +#: config/tc-i860.c:1258 msgid "This immediate requires 0 MOD 2 alignment" msgstr "" -#: config/tc-i860.c:1213 +#: config/tc-i860.c:1261 msgid "This immediate requires 0 MOD 4 alignment" msgstr "" -#: config/tc-i860.c:1216 +#: config/tc-i860.c:1264 msgid "This immediate requires 0 MOD 8 alignment" msgstr "" -#: config/tc-i860.c:1219 +#: config/tc-i860.c:1267 msgid "This immediate requires 0 MOD 16 alignment" msgstr "" -#: config/tc-i860.c:1317 +#: config/tc-i860.c:1362 msgid "5-bit immediate too large" msgstr "" -#: config/tc-i860.c:1320 +#: config/tc-i860.c:1365 msgid "5-bit field must be absolute" msgstr "" -#: config/tc-i860.c:1365 config/tc-i860.c:1388 +#: config/tc-i860.c:1410 config/tc-i860.c:1433 msgid "A branch offset requires 0 MOD 4 alignment" msgstr "" -#: config/tc-i860.c:1409 +#: config/tc-i860.c:1454 #, c-format msgid "Unrecognized fix-up (0x%08lx)" msgstr "" -#: config/tc-i860.h:80 +#: config/tc-i860.h:76 msgid "i860_convert_frag\n" msgstr "" -#: config/tc-i960.c:574 +#: config/tc-i960.c:488 #, c-format msgid "Hashing returned \"%s\"." msgstr "" -#. Offset of last character in opcode mnemonic -#: config/tc-i960.c:608 +#: config/tc-i960.c:584 config/tc-i960.c:1114 +msgid "expression syntax error" +msgstr "" + +#: config/tc-i960.c:620 +msgid "attempt to branch into different segment" +msgstr "" + +#: config/tc-i960.c:624 +#, c-format +msgid "target of %s instruction must be a label" +msgstr "" + +#: config/tc-i960.c:734 +msgid "unaligned register" +msgstr "" + +#: config/tc-i960.c:756 +msgid "no such sfr in this architecture" +msgstr "" + +#: config/tc-i960.c:794 +msgid "illegal literal" +msgstr "" + +#: config/tc-i960.c:837 +msgid "unmatched '['" +msgstr "" + +#: config/tc-i960.c:844 +msgid "garbage after index spec ignored" +msgstr "" + +#: config/tc-i960.c:944 +msgid "invalid index register" +msgstr "" + +#: config/tc-i960.c:967 +msgid "invalid scale factor" +msgstr "" + +#: config/tc-i960.c:1191 +msgid "architecture of opcode conflicts with that of earlier instruction(s)" +msgstr "" + +#: config/tc-i960.c:1425 config/tc-xtensa.c:11295 +msgid "too many operands" +msgstr "" + +#. We never moved: there was no opcode either! +#: config/tc-i960.c:1473 +msgid "missing opcode" +msgstr "" + +#: config/tc-i960.c:1613 msgid "branch prediction invalid on this opcode" msgstr "" -#: config/tc-i960.c:648 +#: config/tc-i960.c:1651 #, c-format msgid "invalid opcode, \"%s\"." msgstr "" -#: config/tc-i960.c:653 +#: config/tc-i960.c:1653 #, c-format msgid "improper number of operands. expecting %d, got %d" msgstr "" -#: config/tc-i960.c:877 +#: config/tc-i960.c:1810 #, c-format msgid "Fixup of %ld too large for field width of %d" msgstr "" -#: config/tc-i960.c:994 +#: config/tc-i960.c:1920 #, c-format msgid "invalid architecture %s" msgstr "" -#: config/tc-i960.c:1014 +#: config/tc-i960.c:1940 +#, c-format msgid "I960 options:\n" msgstr "" -#: config/tc-i960.c:1017 +#: config/tc-i960.c:1943 +#, c-format msgid "" "\n" "\t\t\tspecify variant of 960 architecture\n" @@ -4715,208 +5196,153 @@ msgid "" "\t\t\tlong displacements\n" msgstr "" -#: config/tc-i960.c:1419 config/tc-xtensa.c:8604 -msgid "too many operands" -msgstr "" - -#: config/tc-i960.c:1477 config/tc-i960.c:1702 -msgid "expression syntax error" -msgstr "" - -#: config/tc-i960.c:1515 -msgid "attempt to branch into different segment" -msgstr "" - -#: config/tc-i960.c:1519 -#, c-format -msgid "target of %s instruction must be a label" -msgstr "" - -#: config/tc-i960.c:1557 -msgid "unmatched '['" -msgstr "" - -#: config/tc-i960.c:1568 -msgid "garbage after index spec ignored" -msgstr "" - -#. We never moved: there was no opcode either! -#: config/tc-i960.c:1633 -msgid "missing opcode" -msgstr "" - -#: config/tc-i960.c:2046 -msgid "invalid index register" -msgstr "" - -#: config/tc-i960.c:2069 -msgid "invalid scale factor" -msgstr "" - -#: config/tc-i960.c:2250 -msgid "unaligned register" -msgstr "" - -#: config/tc-i960.c:2273 -msgid "no such sfr in this architecture" -msgstr "" - -#: config/tc-i960.c:2311 -msgid "illegal literal" -msgstr "" - -#. Should not happen: see block comment above -#: config/tc-i960.c:2539 -#, c-format -msgid "Trying to 'bal' to %s" -msgstr "" - -#: config/tc-i960.c:2550 -msgid "Looks like a proc, but can't tell what kind.\n" -msgstr "" - -#: config/tc-i960.c:2582 +#: config/tc-i960.c:2207 msgid "should have 1 or 2 operands" msgstr "" -#: config/tc-i960.c:2591 config/tc-i960.c:2610 +#: config/tc-i960.c:2215 config/tc-i960.c:2230 #, c-format msgid "Redefining leafproc %s" msgstr "" -#: config/tc-i960.c:2641 +#: config/tc-i960.c:2260 msgid "should have two operands" msgstr "" -#: config/tc-i960.c:2651 +#: config/tc-i960.c:2270 msgid "'entry_num' must be absolute number in [0,31]" msgstr "" -#: config/tc-i960.c:2660 +#: config/tc-i960.c:2278 #, c-format msgid "Redefining entrynum for sysproc %s" msgstr "" -#: config/tc-i960.c:2764 -msgid "architecture of opcode conflicts with that of earlier instruction(s)" +#. Should not happen: see block comment above. +#: config/tc-i960.c:2378 +#, c-format +msgid "Trying to 'bal' to %s" msgstr "" -#: config/tc-i960.c:2785 +#: config/tc-i960.c:2388 +msgid "Looks like a proc, but can't tell what kind.\n" +msgstr "" + +#: config/tc-i960.c:2407 msgid "big endian mode is not supported" msgstr "" -#: config/tc-i960.c:2787 +#: config/tc-i960.c:2409 #, c-format msgid "ignoring unrecognized .endian type `%s'" msgstr "" -#: config/tc-i960.c:3071 -#, c-format -msgid "leafproc symbol '%s' undefined" +#: config/tc-i960.c:2454 +msgid "can't use COBR format with external label" msgstr "" -#: config/tc-i960.c:3081 -#, c-format -msgid "Warning: making leafproc entries %s and %s both global\n" -msgstr "" - -#: config/tc-i960.c:3190 +#: config/tc-i960.c:2629 msgid "option --link-relax is only supported in b.out format" msgstr "" -#: config/tc-ia64.c:982 +#: config/tc-i960.c:2656 +#, c-format +msgid "No 'bal' entry point for leafproc %s" +msgstr "" + +#: config/tc-ia64.c:1008 msgid "Bad .section directive: want a,o,s,w,x,M,S,G,T in string" msgstr "" -#: config/tc-ia64.c:1105 +#: config/tc-ia64.c:1151 msgid "Unwind directive not followed by an instruction." msgstr "" -#: config/tc-ia64.c:4563 +#: config/tc-ia64.c:5114 msgid "Register name expected" msgstr "" -#: config/tc-ia64.c:4568 config/tc-ia64.c:4854 +#: config/tc-ia64.c:5119 config/tc-ia64.c:5435 msgid "Comma expected" msgstr "" -#: config/tc-ia64.c:4576 +#: config/tc-ia64.c:5127 msgid "Register value annotation ignored" msgstr "" -#: config/tc-ia64.c:4600 +#: config/tc-ia64.c:5168 msgid "Directive invalid within a bundle" msgstr "" -#: config/tc-ia64.c:4667 +#: config/tc-ia64.c:5261 msgid "Missing predicate relation type" msgstr "" -#: config/tc-ia64.c:4683 +#: config/tc-ia64.c:5267 msgid "Unrecognized predicate relation type" msgstr "" -#: config/tc-ia64.c:4703 config/tc-ia64.c:4728 -msgid "Predicate register expected" -msgstr "" - -#: config/tc-ia64.c:4715 -msgid "Duplicate predicate register ignored" -msgstr "" - -#: config/tc-ia64.c:4737 +#: config/tc-ia64.c:5314 msgid "Bad register range" msgstr "" -#: config/tc-ia64.c:4765 +#: config/tc-ia64.c:5323 +msgid "Predicate register expected" +msgstr "" + +#: config/tc-ia64.c:5328 +msgid "Duplicate predicate register ignored" +msgstr "" + +#: config/tc-ia64.c:5346 msgid "Predicate source and target required" msgstr "" -#: config/tc-ia64.c:4767 config/tc-ia64.c:4779 +#: config/tc-ia64.c:5348 config/tc-ia64.c:5360 msgid "Use of p0 is not valid in this context" msgstr "" -#: config/tc-ia64.c:4774 +#: config/tc-ia64.c:5355 msgid "At least two PR arguments expected" msgstr "" -#: config/tc-ia64.c:4788 +#: config/tc-ia64.c:5369 msgid "At least one PR argument expected" msgstr "" -#: config/tc-ia64.c:4824 +#: config/tc-ia64.c:5405 #, c-format msgid "Inserting \"%s\" into entry hint table failed: %s" msgstr "" #. FIXME -- need 62-bit relocation type -#: config/tc-ia64.c:5302 +#: config/tc-ia64.c:5881 msgid "62-bit relocation not yet implemented" msgstr "" #. XXX technically, this is wrong: we should not be issuing warning #. messages until we're sure this instruction pattern is going to #. be used! -#: config/tc-ia64.c:5375 +#: config/tc-ia64.c:5954 msgid "lower 16 bits of mask ignored" msgstr "" -#: config/tc-ia64.c:5939 +#: config/tc-ia64.c:6569 msgid "Value truncated to 62 bits" msgstr "" -#: config/tc-ia64.c:6291 -msgid "" -"Additional NOP may be necessary to workaround Itanium processor A/B step " -"errata" +#. Give an error if a frag containing code is not aligned to a 16 byte +#. boundary. +#: config/tc-ia64.c:6707 config/tc-ia64.h:171 +msgid "instruction address is not a multiple of 16" msgstr "" -#: config/tc-ia64.c:6474 +#: config/tc-ia64.c:7249 #, c-format msgid "Unrecognized option '-x%s'" msgstr "" -#: config/tc-ia64.c:6502 +#: config/tc-ia64.c:7277 msgid "" "IA-64 options:\n" " --mconstant-gp\t mark output file as using the constant-GP model\n" @@ -4926,264 +5352,386 @@ msgid "" "\t\t\t EF_IA_64_NOFUNCDESC_CONS_GP)\n" " -milp32|-milp64|-mlp64|-mp64\tselect data model (default -mlp64)\n" " -mle | -mbe\t\t select little- or big-endian byte order (default -mle)\n" -" -x | -xexplicit\t turn on dependency violation checking (default)\n" -" -xauto\t\t automagically remove dependency violations\n" +" -mtune=[itanium1|itanium2]\n" +"\t\t\t tune for a specific CPU (default -mtune=itanium2)\n" +" -munwind-check=[warning|error]\n" +"\t\t\t unwind directive check (default -munwind-check=warning)\n" +" -mhint.b=[ok|warning|error]\n" +"\t\t\t hint.b check (default -mhint.b=error)\n" +" -x | -xexplicit\t turn on dependency violation checking\n" +" -xauto\t\t automagically remove dependency violations (default)\n" +" -xnone\t\t turn off dependency violation checking\n" " -xdebug\t\t debug dependency violation checker\n" +" -xdebugn\t\t debug dependency violation checker but turn off\n" +"\t\t\t dependency violation checking\n" +" -xdebugx\t\t debug dependency violation checker and turn on\n" +"\t\t\t dependency violation checking\n" msgstr "" -#: config/tc-ia64.c:6521 +#: config/tc-ia64.c:7307 msgid "--gstabs is not supported for ia64" msgstr "" -#: config/tc-ia64.c:6824 config/tc-mips.c:1094 +#: config/tc-ia64.c:7641 config/tc-mips.c:1401 msgid "Could not set architecture and machine" msgstr "" -#: config/tc-ia64.c:6931 +#: config/tc-ia64.c:7767 msgid "Explicit stops are ignored in auto mode" msgstr "" -#: config/tc-ia64.c:6981 +#: config/tc-ia64.c:7789 msgid "Found '{' after explicit switch to automatic mode" msgstr "" -#: config/tc-ia64.c:7428 +#: config/tc-ia64.c:8392 #, c-format msgid "Unhandled dependency %s for %s (%s), note %d" msgstr "" -#: config/tc-ia64.c:8704 +#: config/tc-ia64.c:9667 #, c-format msgid "Unrecognized dependency specifier %d\n" msgstr "" -#: config/tc-ia64.c:9506 +#: config/tc-ia64.c:10561 msgid "Only the first path encountering the conflict is reported" msgstr "" -#: config/tc-ia64.c:9509 +#: config/tc-ia64.c:10564 msgid "This is the location of the conflicting usage" msgstr "" -#: config/tc-ia64.c:10778 read.c:1370 read.c:1976 read.c:2184 read.c:2795 +#: config/tc-ia64.c:11788 +msgid "Can't add stop bit to mark end of instruction group" +msgstr "" + +#: config/tc-ia64.c:11888 read.c:1440 read.c:2206 read.c:2846 read.c:3173 +#: read.c:3204 msgid "expected symbol name" msgstr "" -#: config/tc-ia64.c:10788 read.c:1380 read.c:2194 read.c:2805 stabs.c:478 +#: config/tc-ia64.c:11898 read.c:2216 read.c:2856 read.c:3188 stabs.c:466 #, c-format msgid "expected comma after \"%s\"" msgstr "" -#: config/tc-ia64.c:10829 +#: config/tc-ia64.c:11940 #, c-format msgid "`%s' is already the alias of %s `%s'" msgstr "" -#: config/tc-ia64.c:10839 +#: config/tc-ia64.c:11950 #, c-format msgid "%s `%s' already has an alias `%s'" msgstr "" -#: config/tc-ia64.c:10850 +#: config/tc-ia64.c:11961 #, c-format msgid "inserting \"%s\" into %s alias hash table failed: %s" msgstr "" -#: config/tc-ia64.c:10858 +#: config/tc-ia64.c:11969 #, c-format msgid "inserting \"%s\" into %s name hash table failed: %s" msgstr "" -#: config/tc-ia64.c:10877 +#: config/tc-ia64.c:11988 #, c-format msgid "symbol `%s' aliased to `%s' is not used" msgstr "" -#: config/tc-ia64.c:10899 +#: config/tc-ia64.c:12010 #, c-format msgid "section `%s' aliased to `%s' is not used" msgstr "" -#: config/tc-ip2k.c:123 +#: config/tc-ip2k.c:158 +#, c-format msgid "IP2K specific command line options:\n" msgstr "" -#: config/tc-ip2k.c:124 +#: config/tc-ip2k.c:159 +#, c-format msgid " -mip2022 restrict to IP2022 insns \n" msgstr "" -#: config/tc-ip2k.c:125 +#: config/tc-ip2k.c:160 +#, c-format msgid " -mip2022ext permit extended IP2022 insn\n" msgstr "" -#: config/tc-ip2k.c:246 +#: config/tc-ip2k.c:274 msgid "md_pcrel_from\n" msgstr "" +#: config/tc-m32c.c:128 +#, c-format +msgid " M32C specific command line options:\n" +msgstr "" + #. Pretend that we do not recognise this option. -#: config/tc-m32r.c:233 +#: config/tc-m32r.c:332 msgid "Unrecognised option: -hidden" msgstr "" -#: config/tc-m32r.c:267 +#: config/tc-m32r.c:359 config/tc-sparc.c:593 +msgid "Unrecognized option following -K" +msgstr "" + +#: config/tc-m32r.c:374 +#, c-format msgid " M32R specific command line options:\n" msgstr "" -#: config/tc-m32r.c:269 +#: config/tc-m32r.c:376 +#, c-format msgid "" " -m32r disable support for the m32rx instruction set\n" msgstr "" -#: config/tc-m32r.c:271 +#: config/tc-m32r.c:378 +#, c-format msgid " -m32rx support the extended m32rx instruction set\n" msgstr "" -#: config/tc-m32r.c:273 -msgid " -O try to combine instructions in parallel\n" +#: config/tc-m32r.c:380 +#, c-format +msgid " -m32r2 support the extended m32r2 instruction set\n" msgstr "" -#: config/tc-m32r.c:276 +#: config/tc-m32r.c:382 +#, c-format +msgid " -EL,-little produce little endian code and data\n" +msgstr "" + +#: config/tc-m32r.c:384 +#, c-format +msgid " -EB,-big produce big endian code and data\n" +msgstr "" + +#: config/tc-m32r.c:386 +#, c-format +msgid " -parallel try to combine instructions in parallel\n" +msgstr "" + +#: config/tc-m32r.c:388 +#, c-format +msgid " -no-parallel disable -parallel\n" +msgstr "" + +#: config/tc-m32r.c:390 +#, c-format +msgid "" +" -no-bitinst disallow the M32R2's extended bit-field " +"instructions\n" +msgstr "" + +#: config/tc-m32r.c:392 +#, c-format +msgid " -O try to optimize code. Implies -parallel\n" +msgstr "" + +#: config/tc-m32r.c:395 +#, c-format msgid "" " -warn-explicit-parallel-conflicts warn when parallel instructions\n" msgstr "" -#: config/tc-m32r.c:278 -msgid " violate contraints\n" +#: config/tc-m32r.c:397 +#, c-format +msgid " might violate contraints\n" msgstr "" -#: config/tc-m32r.c:280 +#: config/tc-m32r.c:399 +#, c-format msgid " -no-warn-explicit-parallel-conflicts do not warn when parallel\n" msgstr "" -#: config/tc-m32r.c:282 +#: config/tc-m32r.c:401 +#, c-format msgid "" -" instructions violate contraints\n" +" instructions might violate " +"contraints\n" msgstr "" -#: config/tc-m32r.c:284 +#: config/tc-m32r.c:403 +#, c-format msgid "" " -Wp synonym for -warn-explicit-parallel-conflicts\n" msgstr "" -#: config/tc-m32r.c:286 +#: config/tc-m32r.c:405 +#, c-format msgid "" " -Wnp synonym for -no-warn-explicit-parallel-conflicts\n" msgstr "" -#: config/tc-m32r.c:289 +#: config/tc-m32r.c:407 +#, c-format +msgid "" +" -ignore-parallel-conflicts do not check parallel instructions\n" +msgstr "" + +#: config/tc-m32r.c:409 +#, c-format +msgid " fo contraint violations\n" +msgstr "" + +#: config/tc-m32r.c:411 +#, c-format +msgid "" +" -no-ignore-parallel-conflicts check parallel instructions for\n" +msgstr "" + +#: config/tc-m32r.c:413 +#, c-format +msgid " contraint violations\n" +msgstr "" + +#: config/tc-m32r.c:415 +#, c-format +msgid " -Ip synonym for -ignore-parallel-conflicts\n" +msgstr "" + +#: config/tc-m32r.c:417 +#, c-format +msgid " -nIp synonym for -no-ignore-parallel-conflicts\n" +msgstr "" + +#: config/tc-m32r.c:420 +#, c-format msgid "" " -warn-unmatched-high warn when an (s)high reloc has no matching low " "reloc\n" msgstr "" -#: config/tc-m32r.c:291 +#: config/tc-m32r.c:422 +#, c-format msgid " -no-warn-unmatched-high do not warn about missing low relocs\n" msgstr "" -#: config/tc-m32r.c:293 +#: config/tc-m32r.c:424 +#, c-format msgid " -Wuh synonym for -warn-unmatched-high\n" msgstr "" -#: config/tc-m32r.c:295 +#: config/tc-m32r.c:426 +#, c-format msgid " -Wnuh synonym for -no-warn-unmatched-high\n" msgstr "" -#: config/tc-m32r.c:299 -msgid " -relax create linker relaxable code\n" +#: config/tc-m32r.c:429 +#, c-format +msgid " -KPIC generate PIC\n" msgstr "" -#: config/tc-m32r.c:301 -msgid " -cpu-desc provide runtime cpu description file\n" +#: config/tc-m32r.c:850 +msgid "instructions write to the same destination register." msgstr "" -#: config/tc-m32r.c:700 -msgid "Instructions write to the same destination register." -msgstr "" - -#: config/tc-m32r.c:708 +#: config/tc-m32r.c:858 msgid "Instructions do not use parallel execution pipelines." msgstr "" -#: config/tc-m32r.c:715 +#: config/tc-m32r.c:866 msgid "Instructions share the same execution pipeline" msgstr "" -#: config/tc-m32r.c:791 config/tc-m32r.c:887 +#: config/tc-m32r.c:931 config/tc-m32r.c:1045 #, c-format msgid "not a 16 bit instruction '%s'" msgstr "" -#: config/tc-m32r.c:798 config/tc-m32r.c:894 config/tc-m32r.c:1050 +#: config/tc-m32r.c:943 config/tc-m32r.c:1057 config/tc-m32r.c:1241 +#, c-format +msgid "instruction '%s' is for the M32R2 only" +msgstr "" + +#: config/tc-m32r.c:956 config/tc-m32r.c:1070 config/tc-m32r.c:1254 #, c-format msgid "unknown instruction '%s'" msgstr "" -#: config/tc-m32r.c:807 config/tc-m32r.c:901 config/tc-m32r.c:1057 +#: config/tc-m32r.c:965 config/tc-m32r.c:1077 config/tc-m32r.c:1261 #, c-format msgid "instruction '%s' is for the M32RX only" msgstr "" -#: config/tc-m32r.c:816 config/tc-m32r.c:910 +#: config/tc-m32r.c:974 config/tc-m32r.c:1086 #, c-format msgid "instruction '%s' cannot be executed in parallel." msgstr "" -#: config/tc-m32r.c:871 config/tc-m32r.c:935 config/tc-m32r.c:1107 +#: config/tc-m32r.c:1029 config/tc-m32r.c:1111 config/tc-m32r.c:1318 msgid "internal error: lookup/get operands failed" msgstr "" -#: config/tc-m32r.c:920 +#: config/tc-m32r.c:1096 #, c-format msgid "'%s': only the NOP instruction can be issued in parallel on the m32r" msgstr "" -#: config/tc-m32r.c:949 +#: config/tc-m32r.c:1125 #, c-format msgid "" "%s: output of 1st instruction is the same as an input to 2nd instruction - " "is this intentional ?" msgstr "" -#: config/tc-m32r.c:953 +#: config/tc-m32r.c:1129 #, c-format msgid "" "%s: output of 2nd instruction is the same as an input to 1st instruction - " "is this intentional ?" msgstr "" -#: config/tc-m32r.c:1267 config/tc-ppc.c:1732 config/tc-ppc.c:4263 +#: config/tc-m32r.c:1493 config/tc-ppc.c:1773 config/tc-ppc.c:4365 msgid "Expected comma after symbol-name: rest of line ignored." msgstr "" -#: config/tc-m32r.c:1277 +#: config/tc-m32r.c:1503 #, c-format msgid ".SCOMMon length (%ld.) <0! Ignored." msgstr "" -#: config/tc-m32r.c:1291 config/tc-ppc.c:1754 config/tc-ppc.c:2899 -#: config/tc-ppc.c:4287 +#: config/tc-m32r.c:1517 config/tc-ppc.c:1795 config/tc-ppc.c:2952 +#: config/tc-ppc.c:4389 msgid "ignoring bad alignment" msgstr "" -#: config/tc-m32r.c:1303 config/tc-ppc.c:1791 config/tc-v850.c:335 +#: config/tc-m32r.c:1529 config/tc-ppc.c:1832 config/tc-v850.c:323 msgid "Common alignment not a power of 2" msgstr "" -#: config/tc-m32r.c:1318 config/tc-ppc.c:1765 config/tc-ppc.c:4299 +#: config/tc-m32r.c:1544 config/tc-ppc.c:1806 config/tc-ppc.c:4401 #, c-format msgid "Ignoring attempt to re-define symbol `%s'." msgstr "" -#: config/tc-m32r.c:1327 +#: config/tc-m32r.c:1553 #, c-format msgid "Length of .scomm \"%s\" is already %ld. Not changed to %ld." msgstr "" -#: config/tc-m32r.c:1808 +#: config/tc-m32r.c:1789 +msgid "Addend to unresolved symbol not on word boundary." +msgstr "" + +#: config/tc-m32r.c:1930 config/tc-m32r.c:1983 config/tc-sh.c:749 +msgid "Invalid PIC expression." +msgstr "" + +#: config/tc-m32r.c:2074 msgid "Unmatched high/shigh reloc" msgstr "" -#: config/tc-m68hc11.c:372 +#: config/tc-m32r.c:2334 config/tc-sparc.c:3524 +#, c-format +msgid "internal error: can't export reloc type %d (`%s')" +msgstr "" + +#: config/tc-m68hc11.c:369 #, c-format msgid "" "Motorola 68HC11/68HC12/68HCS12 options:\n" @@ -5204,55 +5752,56 @@ msgid "" " (used for testing)\n" msgstr "" -#: config/tc-m68hc11.c:418 +#: config/tc-m68hc11.c:415 #, c-format msgid "Default target `%s' is not supported." msgstr "" #. Dump the opcode statistics table. -#: config/tc-m68hc11.c:437 +#: config/tc-m68hc11.c:433 +#, c-format msgid "Name # Modes Min ops Max ops Modes mask # Used\n" msgstr "" -#: config/tc-m68hc11.c:505 +#: config/tc-m68hc11.c:499 #, c-format msgid "Option `%s' is not recognized." msgstr "" -#: config/tc-m68hc11.c:737 +#: config/tc-m68hc11.c:721 msgid "#" msgstr "" -#: config/tc-m68hc11.c:746 +#: config/tc-m68hc11.c:730 msgid "#" msgstr "" -#: config/tc-m68hc11.c:755 config/tc-m68hc11.c:764 +#: config/tc-m68hc11.c:739 config/tc-m68hc11.c:748 msgid ",X" msgstr "" -#: config/tc-m68hc11.c:791 +#: config/tc-m68hc11.c:775 msgid "*" msgstr "" -#: config/tc-m68hc11.c:803 +#: config/tc-m68hc11.c:787 msgid "#" msgstr "" -#: config/tc-m68hc11.c:813 +#: config/tc-m68hc11.c:797 #, c-format msgid "symbol%d" msgstr "" -#: config/tc-m68hc11.c:815 +#: config/tc-m68hc11.c:799 msgid "" msgstr "" -#: config/tc-m68hc11.c:834 +#: config/tc-m68hc11.c:818 msgid "